id
int32
0
27.3k
func
stringlengths
26
142k
target
bool
2 classes
project
stringclasses
2 values
commit_id
stringlengths
40
40
func_clean
stringlengths
26
131k
vul_lines
dict
normalized_func
stringlengths
24
132k
lines
listlengths
1
2.8k
label
listlengths
1
2.8k
line_no
listlengths
1
2.8k
10,084
static uint16_t md_common_read(PCMCIACardState *card, uint32_t at) { MicroDriveState *s = MICRODRIVE(card); IDEState *ifs; uint16_t ret; at -= s->io_base; switch (s->opt & OPT_MODE) { case OPT_MODE_MMAP: if ((at & ~0x3ff) == 0x400) { at = 0; } break; case OPT_MODE_IOMAP16: at &= 0xf; break; case OPT_MODE_IOMAP1: if ((at & ~0xf) == 0x3f0) { at -= 0x3e8; } else if ((at & ~0xf) == 0x1f0) { at -= 0x1f0; } break; case OPT_MODE_IOMAP2: if ((at & ~0xf) == 0x370) { at -= 0x368; } else if ((at & ~0xf) == 0x170) { at -= 0x170; } } switch (at) { case 0x0: /* Even RD Data */ case 0x8: return ide_data_readw(&s->bus, 0); /* TODO: 8-bit accesses */ if (s->cycle) { ret = s->io >> 8; } else { s->io = ide_data_readw(&s->bus, 0); ret = s->io & 0xff; } s->cycle = !s->cycle; return ret; case 0x9: /* Odd RD Data */ return s->io >> 8; case 0xd: /* Error */ return ide_ioport_read(&s->bus, 0x1); case 0xe: /* Alternate Status */ ifs = idebus_active_if(&s->bus); if (ifs->bs) { return ifs->status; } else { return 0; } case 0xf: /* Device Address */ ifs = idebus_active_if(&s->bus); return 0xc2 | ((~ifs->select << 2) & 0x3c); default: return ide_ioport_read(&s->bus, at); } return 0; }
false
qemu
4be746345f13e99e468c60acbd3a355e8183e3ce
static uint16_t md_common_read(PCMCIACardState *card, uint32_t at) { MicroDriveState *s = MICRODRIVE(card); IDEState *ifs; uint16_t ret; at -= s->io_base; switch (s->opt & OPT_MODE) { case OPT_MODE_MMAP: if ((at & ~0x3ff) == 0x400) { at = 0; } break; case OPT_MODE_IOMAP16: at &= 0xf; break; case OPT_MODE_IOMAP1: if ((at & ~0xf) == 0x3f0) { at -= 0x3e8; } else if ((at & ~0xf) == 0x1f0) { at -= 0x1f0; } break; case OPT_MODE_IOMAP2: if ((at & ~0xf) == 0x370) { at -= 0x368; } else if ((at & ~0xf) == 0x170) { at -= 0x170; } } switch (at) { case 0x0: case 0x8: return ide_data_readw(&s->bus, 0); if (s->cycle) { ret = s->io >> 8; } else { s->io = ide_data_readw(&s->bus, 0); ret = s->io & 0xff; } s->cycle = !s->cycle; return ret; case 0x9: return s->io >> 8; case 0xd: return ide_ioport_read(&s->bus, 0x1); case 0xe: ifs = idebus_active_if(&s->bus); if (ifs->bs) { return ifs->status; } else { return 0; } case 0xf: ifs = idebus_active_if(&s->bus); return 0xc2 | ((~ifs->select << 2) & 0x3c); default: return ide_ioport_read(&s->bus, at); } return 0; }
{ "code": [], "line_no": [] }
static uint16_t FUNC_0(PCMCIACardState *card, uint32_t at) { MicroDriveState *s = MICRODRIVE(card); IDEState *ifs; uint16_t ret; at -= s->io_base; switch (s->opt & OPT_MODE) { case OPT_MODE_MMAP: if ((at & ~0x3ff) == 0x400) { at = 0; } break; case OPT_MODE_IOMAP16: at &= 0xf; break; case OPT_MODE_IOMAP1: if ((at & ~0xf) == 0x3f0) { at -= 0x3e8; } else if ((at & ~0xf) == 0x1f0) { at -= 0x1f0; } break; case OPT_MODE_IOMAP2: if ((at & ~0xf) == 0x370) { at -= 0x368; } else if ((at & ~0xf) == 0x170) { at -= 0x170; } } switch (at) { case 0x0: case 0x8: return ide_data_readw(&s->bus, 0); if (s->cycle) { ret = s->io >> 8; } else { s->io = ide_data_readw(&s->bus, 0); ret = s->io & 0xff; } s->cycle = !s->cycle; return ret; case 0x9: return s->io >> 8; case 0xd: return ide_ioport_read(&s->bus, 0x1); case 0xe: ifs = idebus_active_if(&s->bus); if (ifs->bs) { return ifs->status; } else { return 0; } case 0xf: ifs = idebus_active_if(&s->bus); return 0xc2 | ((~ifs->select << 2) & 0x3c); default: return ide_ioport_read(&s->bus, at); } return 0; }
[ "static uint16_t FUNC_0(PCMCIACardState *card, uint32_t at)\n{", "MicroDriveState *s = MICRODRIVE(card);", "IDEState *ifs;", "uint16_t ret;", "at -= s->io_base;", "switch (s->opt & OPT_MODE) {", "case OPT_MODE_MMAP:\nif ((at & ~0x3ff) == 0x400) {", "at = 0;", "}", "break;", "case OPT_MODE_IOMAP16:\nat &= 0xf;", "break;", "case OPT_MODE_IOMAP1:\nif ((at & ~0xf) == 0x3f0) {", "at -= 0x3e8;", "} else if ((at & ~0xf) == 0x1f0) {", "at -= 0x1f0;", "}", "break;", "case OPT_MODE_IOMAP2:\nif ((at & ~0xf) == 0x370) {", "at -= 0x368;", "} else if ((at & ~0xf) == 0x170) {", "at -= 0x170;", "}", "}", "switch (at) {", "case 0x0:\ncase 0x8:\nreturn ide_data_readw(&s->bus, 0);", "if (s->cycle) {", "ret = s->io >> 8;", "} else {", "s->io = ide_data_readw(&s->bus, 0);", "ret = s->io & 0xff;", "}", "s->cycle = !s->cycle;", "return ret;", "case 0x9:\nreturn s->io >> 8;", "case 0xd:\nreturn ide_ioport_read(&s->bus, 0x1);", "case 0xe:\nifs = idebus_active_if(&s->bus);", "if (ifs->bs) {", "return ifs->status;", "} else {", "return 0;", "}", "case 0xf:\nifs = idebus_active_if(&s->bus);", "return 0xc2 | ((~ifs->select << 2) & 0x3c);", "default:\nreturn ide_ioport_read(&s->bus, at);", "}", "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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17, 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47, 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65, 67, 69 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91, 93 ], [ 95, 97 ], [ 99, 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113, 115 ], [ 117 ], [ 119, 121 ], [ 123 ], [ 127 ], [ 129 ] ]
10,085
static void usb_msd_handle_data(USBDevice *dev, USBPacket *p) { MSDState *s = (MSDState *)dev; uint32_t tag; struct usb_msd_cbw cbw; uint8_t devep = p->ep->nr; switch (p->pid) { case USB_TOKEN_OUT: if (devep != 2) goto fail; switch (s->mode) { case USB_MSDM_CBW: if (p->iov.size != 31) { fprintf(stderr, "usb-msd: Bad CBW size"); goto fail; } usb_packet_copy(p, &cbw, 31); if (le32_to_cpu(cbw.sig) != 0x43425355) { fprintf(stderr, "usb-msd: Bad signature %08x\n", le32_to_cpu(cbw.sig)); goto fail; } DPRINTF("Command on LUN %d\n", cbw.lun); if (cbw.lun != 0) { fprintf(stderr, "usb-msd: Bad LUN %d\n", cbw.lun); goto fail; } tag = le32_to_cpu(cbw.tag); s->data_len = le32_to_cpu(cbw.data_len); if (s->data_len == 0) { s->mode = USB_MSDM_CSW; } else if (cbw.flags & 0x80) { s->mode = USB_MSDM_DATAIN; } else { s->mode = USB_MSDM_DATAOUT; } DPRINTF("Command tag 0x%x flags %08x len %d data %d\n", tag, cbw.flags, cbw.cmd_len, s->data_len); assert(le32_to_cpu(s->csw.residue) == 0); s->scsi_len = 0; s->req = scsi_req_new(s->scsi_dev, tag, 0, cbw.cmd, NULL); #ifdef DEBUG_MSD scsi_req_print(s->req); #endif scsi_req_enqueue(s->req); if (s->req && s->req->cmd.xfer != SCSI_XFER_NONE) { scsi_req_continue(s->req); } break; case USB_MSDM_DATAOUT: DPRINTF("Data out %zd/%d\n", p->iov.size, s->data_len); if (p->iov.size > s->data_len) { goto fail; } if (s->scsi_len) { usb_msd_copy_data(s, p); } if (le32_to_cpu(s->csw.residue)) { int len = p->iov.size - p->actual_length; if (len) { usb_packet_skip(p, len); s->data_len -= len; if (s->data_len == 0) { s->mode = USB_MSDM_CSW; } } } if (p->actual_length < p->iov.size) { DPRINTF("Deferring packet %p [wait data-out]\n", p); s->packet = p; p->status = USB_RET_ASYNC; } break; default: DPRINTF("Unexpected write (len %zd)\n", p->iov.size); goto fail; } break; case USB_TOKEN_IN: if (devep != 1) goto fail; switch (s->mode) { case USB_MSDM_DATAOUT: if (s->data_len != 0 || p->iov.size < 13) { goto fail; } /* Waiting for SCSI write to complete. */ s->packet = p; p->status = USB_RET_ASYNC; break; case USB_MSDM_CSW: if (p->iov.size < 13) { goto fail; } if (s->req) { /* still in flight */ DPRINTF("Deferring packet %p [wait status]\n", p); s->packet = p; p->status = USB_RET_ASYNC; } else { usb_msd_send_status(s, p); s->mode = USB_MSDM_CBW; } break; case USB_MSDM_DATAIN: DPRINTF("Data in %zd/%d, scsi_len %d\n", p->iov.size, s->data_len, s->scsi_len); if (s->scsi_len) { usb_msd_copy_data(s, p); } if (le32_to_cpu(s->csw.residue)) { int len = p->iov.size - p->actual_length; if (len) { usb_packet_skip(p, len); s->data_len -= len; if (s->data_len == 0) { s->mode = USB_MSDM_CSW; } } } if (p->actual_length < p->iov.size) { DPRINTF("Deferring packet %p [wait data-in]\n", p); s->packet = p; p->status = USB_RET_ASYNC; } break; default: DPRINTF("Unexpected read (len %zd)\n", p->iov.size); goto fail; } break; default: DPRINTF("Bad token\n"); fail: p->status = USB_RET_STALL; break; } }
false
qemu
a1cbfd554e11bb8af38c2f3e1f1574bf4c563cd2
static void usb_msd_handle_data(USBDevice *dev, USBPacket *p) { MSDState *s = (MSDState *)dev; uint32_t tag; struct usb_msd_cbw cbw; uint8_t devep = p->ep->nr; switch (p->pid) { case USB_TOKEN_OUT: if (devep != 2) goto fail; switch (s->mode) { case USB_MSDM_CBW: if (p->iov.size != 31) { fprintf(stderr, "usb-msd: Bad CBW size"); goto fail; } usb_packet_copy(p, &cbw, 31); if (le32_to_cpu(cbw.sig) != 0x43425355) { fprintf(stderr, "usb-msd: Bad signature %08x\n", le32_to_cpu(cbw.sig)); goto fail; } DPRINTF("Command on LUN %d\n", cbw.lun); if (cbw.lun != 0) { fprintf(stderr, "usb-msd: Bad LUN %d\n", cbw.lun); goto fail; } tag = le32_to_cpu(cbw.tag); s->data_len = le32_to_cpu(cbw.data_len); if (s->data_len == 0) { s->mode = USB_MSDM_CSW; } else if (cbw.flags & 0x80) { s->mode = USB_MSDM_DATAIN; } else { s->mode = USB_MSDM_DATAOUT; } DPRINTF("Command tag 0x%x flags %08x len %d data %d\n", tag, cbw.flags, cbw.cmd_len, s->data_len); assert(le32_to_cpu(s->csw.residue) == 0); s->scsi_len = 0; s->req = scsi_req_new(s->scsi_dev, tag, 0, cbw.cmd, NULL); #ifdef DEBUG_MSD scsi_req_print(s->req); #endif scsi_req_enqueue(s->req); if (s->req && s->req->cmd.xfer != SCSI_XFER_NONE) { scsi_req_continue(s->req); } break; case USB_MSDM_DATAOUT: DPRINTF("Data out %zd/%d\n", p->iov.size, s->data_len); if (p->iov.size > s->data_len) { goto fail; } if (s->scsi_len) { usb_msd_copy_data(s, p); } if (le32_to_cpu(s->csw.residue)) { int len = p->iov.size - p->actual_length; if (len) { usb_packet_skip(p, len); s->data_len -= len; if (s->data_len == 0) { s->mode = USB_MSDM_CSW; } } } if (p->actual_length < p->iov.size) { DPRINTF("Deferring packet %p [wait data-out]\n", p); s->packet = p; p->status = USB_RET_ASYNC; } break; default: DPRINTF("Unexpected write (len %zd)\n", p->iov.size); goto fail; } break; case USB_TOKEN_IN: if (devep != 1) goto fail; switch (s->mode) { case USB_MSDM_DATAOUT: if (s->data_len != 0 || p->iov.size < 13) { goto fail; } s->packet = p; p->status = USB_RET_ASYNC; break; case USB_MSDM_CSW: if (p->iov.size < 13) { goto fail; } if (s->req) { DPRINTF("Deferring packet %p [wait status]\n", p); s->packet = p; p->status = USB_RET_ASYNC; } else { usb_msd_send_status(s, p); s->mode = USB_MSDM_CBW; } break; case USB_MSDM_DATAIN: DPRINTF("Data in %zd/%d, scsi_len %d\n", p->iov.size, s->data_len, s->scsi_len); if (s->scsi_len) { usb_msd_copy_data(s, p); } if (le32_to_cpu(s->csw.residue)) { int len = p->iov.size - p->actual_length; if (len) { usb_packet_skip(p, len); s->data_len -= len; if (s->data_len == 0) { s->mode = USB_MSDM_CSW; } } } if (p->actual_length < p->iov.size) { DPRINTF("Deferring packet %p [wait data-in]\n", p); s->packet = p; p->status = USB_RET_ASYNC; } break; default: DPRINTF("Unexpected read (len %zd)\n", p->iov.size); goto fail; } break; default: DPRINTF("Bad token\n"); fail: p->status = USB_RET_STALL; break; } }
{ "code": [], "line_no": [] }
static void FUNC_0(USBDevice *VAR_0, USBPacket *VAR_1) { MSDState *s = (MSDState *)VAR_0; uint32_t tag; struct usb_msd_cbw VAR_2; uint8_t devep = VAR_1->ep->nr; switch (VAR_1->pid) { case USB_TOKEN_OUT: if (devep != 2) goto fail; switch (s->mode) { case USB_MSDM_CBW: if (VAR_1->iov.size != 31) { fprintf(stderr, "usb-msd: Bad CBW size"); goto fail; } usb_packet_copy(VAR_1, &VAR_2, 31); if (le32_to_cpu(VAR_2.sig) != 0x43425355) { fprintf(stderr, "usb-msd: Bad signature %08x\n", le32_to_cpu(VAR_2.sig)); goto fail; } DPRINTF("Command on LUN %d\n", VAR_2.lun); if (VAR_2.lun != 0) { fprintf(stderr, "usb-msd: Bad LUN %d\n", VAR_2.lun); goto fail; } tag = le32_to_cpu(VAR_2.tag); s->data_len = le32_to_cpu(VAR_2.data_len); if (s->data_len == 0) { s->mode = USB_MSDM_CSW; } else if (VAR_2.flags & 0x80) { s->mode = USB_MSDM_DATAIN; } else { s->mode = USB_MSDM_DATAOUT; } DPRINTF("Command tag 0x%x flags %08x VAR_4 %d data %d\n", tag, VAR_2.flags, VAR_2.cmd_len, s->data_len); assert(le32_to_cpu(s->csw.residue) == 0); s->scsi_len = 0; s->req = scsi_req_new(s->scsi_dev, tag, 0, VAR_2.cmd, NULL); #ifdef DEBUG_MSD scsi_req_print(s->req); #endif scsi_req_enqueue(s->req); if (s->req && s->req->cmd.xfer != SCSI_XFER_NONE) { scsi_req_continue(s->req); } break; case USB_MSDM_DATAOUT: DPRINTF("Data out %zd/%d\n", VAR_1->iov.size, s->data_len); if (VAR_1->iov.size > s->data_len) { goto fail; } if (s->scsi_len) { usb_msd_copy_data(s, VAR_1); } if (le32_to_cpu(s->csw.residue)) { int VAR_4 = VAR_1->iov.size - VAR_1->actual_length; if (VAR_4) { usb_packet_skip(VAR_1, VAR_4); s->data_len -= VAR_4; if (s->data_len == 0) { s->mode = USB_MSDM_CSW; } } } if (VAR_1->actual_length < VAR_1->iov.size) { DPRINTF("Deferring packet %VAR_1 [wait data-out]\n", VAR_1); s->packet = VAR_1; VAR_1->status = USB_RET_ASYNC; } break; default: DPRINTF("Unexpected write (VAR_4 %zd)\n", VAR_1->iov.size); goto fail; } break; case USB_TOKEN_IN: if (devep != 1) goto fail; switch (s->mode) { case USB_MSDM_DATAOUT: if (s->data_len != 0 || VAR_1->iov.size < 13) { goto fail; } s->packet = VAR_1; VAR_1->status = USB_RET_ASYNC; break; case USB_MSDM_CSW: if (VAR_1->iov.size < 13) { goto fail; } if (s->req) { DPRINTF("Deferring packet %VAR_1 [wait status]\n", VAR_1); s->packet = VAR_1; VAR_1->status = USB_RET_ASYNC; } else { usb_msd_send_status(s, VAR_1); s->mode = USB_MSDM_CBW; } break; case USB_MSDM_DATAIN: DPRINTF("Data in %zd/%d, scsi_len %d\n", VAR_1->iov.size, s->data_len, s->scsi_len); if (s->scsi_len) { usb_msd_copy_data(s, VAR_1); } if (le32_to_cpu(s->csw.residue)) { int VAR_4 = VAR_1->iov.size - VAR_1->actual_length; if (VAR_4) { usb_packet_skip(VAR_1, VAR_4); s->data_len -= VAR_4; if (s->data_len == 0) { s->mode = USB_MSDM_CSW; } } } if (VAR_1->actual_length < VAR_1->iov.size) { DPRINTF("Deferring packet %VAR_1 [wait data-in]\n", VAR_1); s->packet = VAR_1; VAR_1->status = USB_RET_ASYNC; } break; default: DPRINTF("Unexpected read (VAR_4 %zd)\n", VAR_1->iov.size); goto fail; } break; default: DPRINTF("Bad token\n"); fail: VAR_1->status = USB_RET_STALL; break; } }
[ "static void FUNC_0(USBDevice *VAR_0, USBPacket *VAR_1)\n{", "MSDState *s = (MSDState *)VAR_0;", "uint32_t tag;", "struct usb_msd_cbw VAR_2;", "uint8_t devep = VAR_1->ep->nr;", "switch (VAR_1->pid) {", "case USB_TOKEN_OUT:\nif (devep != 2)\ngoto fail;", "switch (s->mode) {", "case USB_MSDM_CBW:\nif (VAR_1->iov.size != 31) {", "fprintf(stderr, \"usb-msd: Bad CBW size\");", "goto fail;", "}", "usb_packet_copy(VAR_1, &VAR_2, 31);", "if (le32_to_cpu(VAR_2.sig) != 0x43425355) {", "fprintf(stderr, \"usb-msd: Bad signature %08x\\n\",\nle32_to_cpu(VAR_2.sig));", "goto fail;", "}", "DPRINTF(\"Command on LUN %d\\n\", VAR_2.lun);", "if (VAR_2.lun != 0) {", "fprintf(stderr, \"usb-msd: Bad LUN %d\\n\", VAR_2.lun);", "goto fail;", "}", "tag = le32_to_cpu(VAR_2.tag);", "s->data_len = le32_to_cpu(VAR_2.data_len);", "if (s->data_len == 0) {", "s->mode = USB_MSDM_CSW;", "} else if (VAR_2.flags & 0x80) {", "s->mode = USB_MSDM_DATAIN;", "} else {", "s->mode = USB_MSDM_DATAOUT;", "}", "DPRINTF(\"Command tag 0x%x flags %08x VAR_4 %d data %d\\n\",\ntag, VAR_2.flags, VAR_2.cmd_len, s->data_len);", "assert(le32_to_cpu(s->csw.residue) == 0);", "s->scsi_len = 0;", "s->req = scsi_req_new(s->scsi_dev, tag, 0, VAR_2.cmd, NULL);", "#ifdef DEBUG_MSD\nscsi_req_print(s->req);", "#endif\nscsi_req_enqueue(s->req);", "if (s->req && s->req->cmd.xfer != SCSI_XFER_NONE) {", "scsi_req_continue(s->req);", "}", "break;", "case USB_MSDM_DATAOUT:\nDPRINTF(\"Data out %zd/%d\\n\", VAR_1->iov.size, s->data_len);", "if (VAR_1->iov.size > s->data_len) {", "goto fail;", "}", "if (s->scsi_len) {", "usb_msd_copy_data(s, VAR_1);", "}", "if (le32_to_cpu(s->csw.residue)) {", "int VAR_4 = VAR_1->iov.size - VAR_1->actual_length;", "if (VAR_4) {", "usb_packet_skip(VAR_1, VAR_4);", "s->data_len -= VAR_4;", "if (s->data_len == 0) {", "s->mode = USB_MSDM_CSW;", "}", "}", "}", "if (VAR_1->actual_length < VAR_1->iov.size) {", "DPRINTF(\"Deferring packet %VAR_1 [wait data-out]\\n\", VAR_1);", "s->packet = VAR_1;", "VAR_1->status = USB_RET_ASYNC;", "}", "break;", "default:\nDPRINTF(\"Unexpected write (VAR_4 %zd)\\n\", VAR_1->iov.size);", "goto fail;", "}", "break;", "case USB_TOKEN_IN:\nif (devep != 1)\ngoto fail;", "switch (s->mode) {", "case USB_MSDM_DATAOUT:\nif (s->data_len != 0 || VAR_1->iov.size < 13) {", "goto fail;", "}", "s->packet = VAR_1;", "VAR_1->status = USB_RET_ASYNC;", "break;", "case USB_MSDM_CSW:\nif (VAR_1->iov.size < 13) {", "goto fail;", "}", "if (s->req) {", "DPRINTF(\"Deferring packet %VAR_1 [wait status]\\n\", VAR_1);", "s->packet = VAR_1;", "VAR_1->status = USB_RET_ASYNC;", "} else {", "usb_msd_send_status(s, VAR_1);", "s->mode = USB_MSDM_CBW;", "}", "break;", "case USB_MSDM_DATAIN:\nDPRINTF(\"Data in %zd/%d, scsi_len %d\\n\",\nVAR_1->iov.size, s->data_len, s->scsi_len);", "if (s->scsi_len) {", "usb_msd_copy_data(s, VAR_1);", "}", "if (le32_to_cpu(s->csw.residue)) {", "int VAR_4 = VAR_1->iov.size - VAR_1->actual_length;", "if (VAR_4) {", "usb_packet_skip(VAR_1, VAR_4);", "s->data_len -= VAR_4;", "if (s->data_len == 0) {", "s->mode = USB_MSDM_CSW;", "}", "}", "}", "if (VAR_1->actual_length < VAR_1->iov.size) {", "DPRINTF(\"Deferring packet %VAR_1 [wait data-in]\\n\", VAR_1);", "s->packet = VAR_1;", "VAR_1->status = USB_RET_ASYNC;", "}", "break;", "default:\nDPRINTF(\"Unexpected read (VAR_4 %zd)\\n\", VAR_1->iov.size);", "goto fail;", "}", "break;", "default:\nDPRINTF(\"Bad token\\n\");", "fail:\nVAR_1->status = USB_RET_STALL;", "break;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17, 19, 21 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41, 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77, 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87, 89 ], [ 91, 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 105, 107 ], [ 109 ], [ 111 ], [ 113 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 157, 159 ], [ 161 ], [ 163 ], [ 165 ], [ 169, 171, 173 ], [ 177 ], [ 179, 181 ], [ 183 ], [ 185 ], [ 189 ], [ 191 ], [ 193 ], [ 197, 199 ], [ 201 ], [ 203 ], [ 207 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 229, 231, 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 275, 277 ], [ 279 ], [ 281 ], [ 283 ], [ 287, 289 ], [ 291, 293 ], [ 295 ], [ 297 ], [ 299 ] ]
10,086
void optimize_flags_init(void) { cpu_env = tcg_global_reg_new_ptr(TCG_AREG0, "env"); cpu_cc_op = tcg_global_mem_new_i32(TCG_AREG0, offsetof(CPUX86State, cc_op), "cc_op"); cpu_cc_src = tcg_global_mem_new(TCG_AREG0, offsetof(CPUX86State, cc_src), "cc_src"); cpu_cc_dst = tcg_global_mem_new(TCG_AREG0, offsetof(CPUX86State, cc_dst), "cc_dst"); #ifdef TARGET_X86_64 cpu_regs[R_EAX] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUX86State, regs[R_EAX]), "rax"); cpu_regs[R_ECX] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUX86State, regs[R_ECX]), "rcx"); cpu_regs[R_EDX] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUX86State, regs[R_EDX]), "rdx"); cpu_regs[R_EBX] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUX86State, regs[R_EBX]), "rbx"); cpu_regs[R_ESP] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUX86State, regs[R_ESP]), "rsp"); cpu_regs[R_EBP] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUX86State, regs[R_EBP]), "rbp"); cpu_regs[R_ESI] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUX86State, regs[R_ESI]), "rsi"); cpu_regs[R_EDI] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUX86State, regs[R_EDI]), "rdi"); cpu_regs[8] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUX86State, regs[8]), "r8"); cpu_regs[9] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUX86State, regs[9]), "r9"); cpu_regs[10] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUX86State, regs[10]), "r10"); cpu_regs[11] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUX86State, regs[11]), "r11"); cpu_regs[12] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUX86State, regs[12]), "r12"); cpu_regs[13] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUX86State, regs[13]), "r13"); cpu_regs[14] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUX86State, regs[14]), "r14"); cpu_regs[15] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUX86State, regs[15]), "r15"); #else cpu_regs[R_EAX] = tcg_global_mem_new_i32(TCG_AREG0, offsetof(CPUX86State, regs[R_EAX]), "eax"); cpu_regs[R_ECX] = tcg_global_mem_new_i32(TCG_AREG0, offsetof(CPUX86State, regs[R_ECX]), "ecx"); cpu_regs[R_EDX] = tcg_global_mem_new_i32(TCG_AREG0, offsetof(CPUX86State, regs[R_EDX]), "edx"); cpu_regs[R_EBX] = tcg_global_mem_new_i32(TCG_AREG0, offsetof(CPUX86State, regs[R_EBX]), "ebx"); cpu_regs[R_ESP] = tcg_global_mem_new_i32(TCG_AREG0, offsetof(CPUX86State, regs[R_ESP]), "esp"); cpu_regs[R_EBP] = tcg_global_mem_new_i32(TCG_AREG0, offsetof(CPUX86State, regs[R_EBP]), "ebp"); cpu_regs[R_ESI] = tcg_global_mem_new_i32(TCG_AREG0, offsetof(CPUX86State, regs[R_ESI]), "esi"); cpu_regs[R_EDI] = tcg_global_mem_new_i32(TCG_AREG0, offsetof(CPUX86State, regs[R_EDI]), "edi"); #endif /* register helpers */ #define GEN_HELPER 2 #include "helper.h" }
false
qemu
a3251186fc6a04d421e9c4b65aa04ec32379ec38
void optimize_flags_init(void) { cpu_env = tcg_global_reg_new_ptr(TCG_AREG0, "env"); cpu_cc_op = tcg_global_mem_new_i32(TCG_AREG0, offsetof(CPUX86State, cc_op), "cc_op"); cpu_cc_src = tcg_global_mem_new(TCG_AREG0, offsetof(CPUX86State, cc_src), "cc_src"); cpu_cc_dst = tcg_global_mem_new(TCG_AREG0, offsetof(CPUX86State, cc_dst), "cc_dst"); #ifdef TARGET_X86_64 cpu_regs[R_EAX] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUX86State, regs[R_EAX]), "rax"); cpu_regs[R_ECX] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUX86State, regs[R_ECX]), "rcx"); cpu_regs[R_EDX] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUX86State, regs[R_EDX]), "rdx"); cpu_regs[R_EBX] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUX86State, regs[R_EBX]), "rbx"); cpu_regs[R_ESP] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUX86State, regs[R_ESP]), "rsp"); cpu_regs[R_EBP] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUX86State, regs[R_EBP]), "rbp"); cpu_regs[R_ESI] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUX86State, regs[R_ESI]), "rsi"); cpu_regs[R_EDI] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUX86State, regs[R_EDI]), "rdi"); cpu_regs[8] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUX86State, regs[8]), "r8"); cpu_regs[9] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUX86State, regs[9]), "r9"); cpu_regs[10] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUX86State, regs[10]), "r10"); cpu_regs[11] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUX86State, regs[11]), "r11"); cpu_regs[12] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUX86State, regs[12]), "r12"); cpu_regs[13] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUX86State, regs[13]), "r13"); cpu_regs[14] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUX86State, regs[14]), "r14"); cpu_regs[15] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUX86State, regs[15]), "r15"); #else cpu_regs[R_EAX] = tcg_global_mem_new_i32(TCG_AREG0, offsetof(CPUX86State, regs[R_EAX]), "eax"); cpu_regs[R_ECX] = tcg_global_mem_new_i32(TCG_AREG0, offsetof(CPUX86State, regs[R_ECX]), "ecx"); cpu_regs[R_EDX] = tcg_global_mem_new_i32(TCG_AREG0, offsetof(CPUX86State, regs[R_EDX]), "edx"); cpu_regs[R_EBX] = tcg_global_mem_new_i32(TCG_AREG0, offsetof(CPUX86State, regs[R_EBX]), "ebx"); cpu_regs[R_ESP] = tcg_global_mem_new_i32(TCG_AREG0, offsetof(CPUX86State, regs[R_ESP]), "esp"); cpu_regs[R_EBP] = tcg_global_mem_new_i32(TCG_AREG0, offsetof(CPUX86State, regs[R_EBP]), "ebp"); cpu_regs[R_ESI] = tcg_global_mem_new_i32(TCG_AREG0, offsetof(CPUX86State, regs[R_ESI]), "esi"); cpu_regs[R_EDI] = tcg_global_mem_new_i32(TCG_AREG0, offsetof(CPUX86State, regs[R_EDI]), "edi"); #endif #define GEN_HELPER 2 #include "helper.h" }
{ "code": [], "line_no": [] }
void FUNC_0(void) { cpu_env = tcg_global_reg_new_ptr(TCG_AREG0, "env"); cpu_cc_op = tcg_global_mem_new_i32(TCG_AREG0, offsetof(CPUX86State, cc_op), "cc_op"); cpu_cc_src = tcg_global_mem_new(TCG_AREG0, offsetof(CPUX86State, cc_src), "cc_src"); cpu_cc_dst = tcg_global_mem_new(TCG_AREG0, offsetof(CPUX86State, cc_dst), "cc_dst"); #ifdef TARGET_X86_64 cpu_regs[R_EAX] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUX86State, regs[R_EAX]), "rax"); cpu_regs[R_ECX] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUX86State, regs[R_ECX]), "rcx"); cpu_regs[R_EDX] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUX86State, regs[R_EDX]), "rdx"); cpu_regs[R_EBX] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUX86State, regs[R_EBX]), "rbx"); cpu_regs[R_ESP] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUX86State, regs[R_ESP]), "rsp"); cpu_regs[R_EBP] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUX86State, regs[R_EBP]), "rbp"); cpu_regs[R_ESI] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUX86State, regs[R_ESI]), "rsi"); cpu_regs[R_EDI] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUX86State, regs[R_EDI]), "rdi"); cpu_regs[8] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUX86State, regs[8]), "r8"); cpu_regs[9] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUX86State, regs[9]), "r9"); cpu_regs[10] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUX86State, regs[10]), "r10"); cpu_regs[11] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUX86State, regs[11]), "r11"); cpu_regs[12] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUX86State, regs[12]), "r12"); cpu_regs[13] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUX86State, regs[13]), "r13"); cpu_regs[14] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUX86State, regs[14]), "r14"); cpu_regs[15] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUX86State, regs[15]), "r15"); #else cpu_regs[R_EAX] = tcg_global_mem_new_i32(TCG_AREG0, offsetof(CPUX86State, regs[R_EAX]), "eax"); cpu_regs[R_ECX] = tcg_global_mem_new_i32(TCG_AREG0, offsetof(CPUX86State, regs[R_ECX]), "ecx"); cpu_regs[R_EDX] = tcg_global_mem_new_i32(TCG_AREG0, offsetof(CPUX86State, regs[R_EDX]), "edx"); cpu_regs[R_EBX] = tcg_global_mem_new_i32(TCG_AREG0, offsetof(CPUX86State, regs[R_EBX]), "ebx"); cpu_regs[R_ESP] = tcg_global_mem_new_i32(TCG_AREG0, offsetof(CPUX86State, regs[R_ESP]), "esp"); cpu_regs[R_EBP] = tcg_global_mem_new_i32(TCG_AREG0, offsetof(CPUX86State, regs[R_EBP]), "ebp"); cpu_regs[R_ESI] = tcg_global_mem_new_i32(TCG_AREG0, offsetof(CPUX86State, regs[R_ESI]), "esi"); cpu_regs[R_EDI] = tcg_global_mem_new_i32(TCG_AREG0, offsetof(CPUX86State, regs[R_EDI]), "edi"); #endif #define GEN_HELPER 2 #include "helper.h" }
[ "void FUNC_0(void)\n{", "cpu_env = tcg_global_reg_new_ptr(TCG_AREG0, \"env\");", "cpu_cc_op = tcg_global_mem_new_i32(TCG_AREG0,\noffsetof(CPUX86State, cc_op), \"cc_op\");", "cpu_cc_src = tcg_global_mem_new(TCG_AREG0, offsetof(CPUX86State, cc_src),\n\"cc_src\");", "cpu_cc_dst = tcg_global_mem_new(TCG_AREG0, offsetof(CPUX86State, cc_dst),\n\"cc_dst\");", "#ifdef TARGET_X86_64\ncpu_regs[R_EAX] = tcg_global_mem_new_i64(TCG_AREG0,\noffsetof(CPUX86State, regs[R_EAX]), \"rax\");", "cpu_regs[R_ECX] = tcg_global_mem_new_i64(TCG_AREG0,\noffsetof(CPUX86State, regs[R_ECX]), \"rcx\");", "cpu_regs[R_EDX] = tcg_global_mem_new_i64(TCG_AREG0,\noffsetof(CPUX86State, regs[R_EDX]), \"rdx\");", "cpu_regs[R_EBX] = tcg_global_mem_new_i64(TCG_AREG0,\noffsetof(CPUX86State, regs[R_EBX]), \"rbx\");", "cpu_regs[R_ESP] = tcg_global_mem_new_i64(TCG_AREG0,\noffsetof(CPUX86State, regs[R_ESP]), \"rsp\");", "cpu_regs[R_EBP] = tcg_global_mem_new_i64(TCG_AREG0,\noffsetof(CPUX86State, regs[R_EBP]), \"rbp\");", "cpu_regs[R_ESI] = tcg_global_mem_new_i64(TCG_AREG0,\noffsetof(CPUX86State, regs[R_ESI]), \"rsi\");", "cpu_regs[R_EDI] = tcg_global_mem_new_i64(TCG_AREG0,\noffsetof(CPUX86State, regs[R_EDI]), \"rdi\");", "cpu_regs[8] = tcg_global_mem_new_i64(TCG_AREG0,\noffsetof(CPUX86State, regs[8]), \"r8\");", "cpu_regs[9] = tcg_global_mem_new_i64(TCG_AREG0,\noffsetof(CPUX86State, regs[9]), \"r9\");", "cpu_regs[10] = tcg_global_mem_new_i64(TCG_AREG0,\noffsetof(CPUX86State, regs[10]), \"r10\");", "cpu_regs[11] = tcg_global_mem_new_i64(TCG_AREG0,\noffsetof(CPUX86State, regs[11]), \"r11\");", "cpu_regs[12] = tcg_global_mem_new_i64(TCG_AREG0,\noffsetof(CPUX86State, regs[12]), \"r12\");", "cpu_regs[13] = tcg_global_mem_new_i64(TCG_AREG0,\noffsetof(CPUX86State, regs[13]), \"r13\");", "cpu_regs[14] = tcg_global_mem_new_i64(TCG_AREG0,\noffsetof(CPUX86State, regs[14]), \"r14\");", "cpu_regs[15] = tcg_global_mem_new_i64(TCG_AREG0,\noffsetof(CPUX86State, regs[15]), \"r15\");", "#else\ncpu_regs[R_EAX] = tcg_global_mem_new_i32(TCG_AREG0,\noffsetof(CPUX86State, regs[R_EAX]), \"eax\");", "cpu_regs[R_ECX] = tcg_global_mem_new_i32(TCG_AREG0,\noffsetof(CPUX86State, regs[R_ECX]), \"ecx\");", "cpu_regs[R_EDX] = tcg_global_mem_new_i32(TCG_AREG0,\noffsetof(CPUX86State, regs[R_EDX]), \"edx\");", "cpu_regs[R_EBX] = tcg_global_mem_new_i32(TCG_AREG0,\noffsetof(CPUX86State, regs[R_EBX]), \"ebx\");", "cpu_regs[R_ESP] = tcg_global_mem_new_i32(TCG_AREG0,\noffsetof(CPUX86State, regs[R_ESP]), \"esp\");", "cpu_regs[R_EBP] = tcg_global_mem_new_i32(TCG_AREG0,\noffsetof(CPUX86State, regs[R_EBP]), \"ebp\");", "cpu_regs[R_ESI] = tcg_global_mem_new_i32(TCG_AREG0,\noffsetof(CPUX86State, regs[R_ESI]), \"esi\");", "cpu_regs[R_EDI] = tcg_global_mem_new_i32(TCG_AREG0,\noffsetof(CPUX86State, regs[R_EDI]), \"edi\");", "#endif\n#define GEN_HELPER 2\n#include \"helper.h\"\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 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 11, 13 ], [ 15, 17 ], [ 21, 23, 25 ], [ 27, 29 ], [ 31, 33 ], [ 35, 37 ], [ 39, 41 ], [ 43, 45 ], [ 47, 49 ], [ 51, 53 ], [ 55, 57 ], [ 59, 61 ], [ 63, 65 ], [ 67, 69 ], [ 71, 73 ], [ 75, 77 ], [ 79, 81 ], [ 83, 85 ], [ 87, 89, 91 ], [ 93, 95 ], [ 97, 99 ], [ 101, 103 ], [ 105, 107 ], [ 109, 111 ], [ 113, 115 ], [ 117, 119 ], [ 121, 127, 129, 131 ] ]
10,087
static size_t handle_aiocb_rw(struct qemu_paiocb *aiocb) { size_t nbytes; char *buf; if (!(aiocb->aio_type & QEMU_AIO_MISALIGNED)) { /* * If there is just a single buffer, and it is properly aligned * we can just use plain pread/pwrite without any problems. */ if (aiocb->aio_niov == 1) return handle_aiocb_rw_linear(aiocb, aiocb->aio_iov->iov_base); /* * We have more than one iovec, and all are properly aligned. * * Try preadv/pwritev first and fall back to linearizing the * buffer if it's not supported. */ if (preadv_present) { nbytes = handle_aiocb_rw_vector(aiocb); if (nbytes == aiocb->aio_nbytes) return nbytes; if (nbytes < 0 && nbytes != -ENOSYS) return nbytes; preadv_present = 0; } /* * XXX(hch): short read/write. no easy way to handle the reminder * using these interfaces. For now retry using plain * pread/pwrite? */ } /* * Ok, we have to do it the hard way, copy all segments into * a single aligned buffer. */ buf = qemu_memalign(512, aiocb->aio_nbytes); if (aiocb->aio_type & QEMU_AIO_WRITE) { char *p = buf; int i; for (i = 0; i < aiocb->aio_niov; ++i) { memcpy(p, aiocb->aio_iov[i].iov_base, aiocb->aio_iov[i].iov_len); p += aiocb->aio_iov[i].iov_len; } } nbytes = handle_aiocb_rw_linear(aiocb, buf); if (!(aiocb->aio_type & QEMU_AIO_WRITE)) { char *p = buf; size_t count = aiocb->aio_nbytes, copy; int i; for (i = 0; i < aiocb->aio_niov && count; ++i) { copy = count; if (copy > aiocb->aio_iov[i].iov_len) copy = aiocb->aio_iov[i].iov_len; memcpy(aiocb->aio_iov[i].iov_base, p, copy); p += copy; count -= copy; } } qemu_vfree(buf); return nbytes; }
false
qemu
6769da29c7a3caa9de4020db87f495de692cf8e2
static size_t handle_aiocb_rw(struct qemu_paiocb *aiocb) { size_t nbytes; char *buf; if (!(aiocb->aio_type & QEMU_AIO_MISALIGNED)) { if (aiocb->aio_niov == 1) return handle_aiocb_rw_linear(aiocb, aiocb->aio_iov->iov_base); if (preadv_present) { nbytes = handle_aiocb_rw_vector(aiocb); if (nbytes == aiocb->aio_nbytes) return nbytes; if (nbytes < 0 && nbytes != -ENOSYS) return nbytes; preadv_present = 0; } } buf = qemu_memalign(512, aiocb->aio_nbytes); if (aiocb->aio_type & QEMU_AIO_WRITE) { char *p = buf; int i; for (i = 0; i < aiocb->aio_niov; ++i) { memcpy(p, aiocb->aio_iov[i].iov_base, aiocb->aio_iov[i].iov_len); p += aiocb->aio_iov[i].iov_len; } } nbytes = handle_aiocb_rw_linear(aiocb, buf); if (!(aiocb->aio_type & QEMU_AIO_WRITE)) { char *p = buf; size_t count = aiocb->aio_nbytes, copy; int i; for (i = 0; i < aiocb->aio_niov && count; ++i) { copy = count; if (copy > aiocb->aio_iov[i].iov_len) copy = aiocb->aio_iov[i].iov_len; memcpy(aiocb->aio_iov[i].iov_base, p, copy); p += copy; count -= copy; } } qemu_vfree(buf); return nbytes; }
{ "code": [], "line_no": [] }
static size_t FUNC_0(struct qemu_paiocb *aiocb) { size_t nbytes; char *VAR_0; if (!(aiocb->aio_type & QEMU_AIO_MISALIGNED)) { if (aiocb->aio_niov == 1) return handle_aiocb_rw_linear(aiocb, aiocb->aio_iov->iov_base); if (preadv_present) { nbytes = handle_aiocb_rw_vector(aiocb); if (nbytes == aiocb->aio_nbytes) return nbytes; if (nbytes < 0 && nbytes != -ENOSYS) return nbytes; preadv_present = 0; } } VAR_0 = qemu_memalign(512, aiocb->aio_nbytes); if (aiocb->aio_type & QEMU_AIO_WRITE) { char *VAR_3 = VAR_0; int VAR_3; for (VAR_3 = 0; VAR_3 < aiocb->aio_niov; ++VAR_3) { memcpy(VAR_3, aiocb->aio_iov[VAR_3].iov_base, aiocb->aio_iov[VAR_3].iov_len); VAR_3 += aiocb->aio_iov[VAR_3].iov_len; } } nbytes = handle_aiocb_rw_linear(aiocb, VAR_0); if (!(aiocb->aio_type & QEMU_AIO_WRITE)) { char *VAR_3 = VAR_0; size_t count = aiocb->aio_nbytes, copy; int VAR_3; for (VAR_3 = 0; VAR_3 < aiocb->aio_niov && count; ++VAR_3) { copy = count; if (copy > aiocb->aio_iov[VAR_3].iov_len) copy = aiocb->aio_iov[VAR_3].iov_len; memcpy(aiocb->aio_iov[VAR_3].iov_base, VAR_3, copy); VAR_3 += copy; count -= copy; } } qemu_vfree(VAR_0); return nbytes; }
[ "static size_t FUNC_0(struct qemu_paiocb *aiocb)\n{", "size_t nbytes;", "char *VAR_0;", "if (!(aiocb->aio_type & QEMU_AIO_MISALIGNED)) {", "if (aiocb->aio_niov == 1)\nreturn handle_aiocb_rw_linear(aiocb, aiocb->aio_iov->iov_base);", "if (preadv_present) {", "nbytes = handle_aiocb_rw_vector(aiocb);", "if (nbytes == aiocb->aio_nbytes)\nreturn nbytes;", "if (nbytes < 0 && nbytes != -ENOSYS)\nreturn nbytes;", "preadv_present = 0;", "}", "}", "VAR_0 = qemu_memalign(512, aiocb->aio_nbytes);", "if (aiocb->aio_type & QEMU_AIO_WRITE) {", "char *VAR_3 = VAR_0;", "int VAR_3;", "for (VAR_3 = 0; VAR_3 < aiocb->aio_niov; ++VAR_3) {", "memcpy(VAR_3, aiocb->aio_iov[VAR_3].iov_base, aiocb->aio_iov[VAR_3].iov_len);", "VAR_3 += aiocb->aio_iov[VAR_3].iov_len;", "}", "}", "nbytes = handle_aiocb_rw_linear(aiocb, VAR_0);", "if (!(aiocb->aio_type & QEMU_AIO_WRITE)) {", "char *VAR_3 = VAR_0;", "size_t count = aiocb->aio_nbytes, copy;", "int VAR_3;", "for (VAR_3 = 0; VAR_3 < aiocb->aio_niov && count; ++VAR_3) {", "copy = count;", "if (copy > aiocb->aio_iov[VAR_3].iov_len)\ncopy = aiocb->aio_iov[VAR_3].iov_len;", "memcpy(aiocb->aio_iov[VAR_3].iov_base, VAR_3, copy);", "VAR_3 += copy;", "count -= copy;", "}", "}", "qemu_vfree(VAR_0);", "return nbytes;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 21, 23 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 47, 49 ], [ 51 ], [ 53 ], [ 67 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 113 ], [ 115 ], [ 117, 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 135 ], [ 137 ] ]
10,088
static int coroutine_fn bdrv_co_do_copy_on_readv(BlockDriverState *bs, int64_t offset, unsigned int bytes, QEMUIOVector *qiov) { /* Perform I/O through a temporary buffer so that users who scribble over * their read buffer while the operation is in progress do not end up * modifying the image file. This is critical for zero-copy guest I/O * where anything might happen inside guest memory. */ void *bounce_buffer; BlockDriver *drv = bs->drv; struct iovec iov; QEMUIOVector bounce_qiov; int64_t cluster_offset; unsigned int cluster_bytes; size_t skip_bytes; int ret; /* Cover entire cluster so no additional backing file I/O is required when * allocating cluster in the image file. */ bdrv_round_to_clusters(bs, offset, bytes, &cluster_offset, &cluster_bytes); trace_bdrv_co_do_copy_on_readv(bs, offset, bytes, cluster_offset, cluster_bytes); iov.iov_len = cluster_bytes; iov.iov_base = bounce_buffer = qemu_try_blockalign(bs, iov.iov_len); if (bounce_buffer == NULL) { ret = -ENOMEM; goto err; } qemu_iovec_init_external(&bounce_qiov, &iov, 1); ret = bdrv_driver_preadv(bs, cluster_offset, cluster_bytes, &bounce_qiov, 0); if (ret < 0) { goto err; } if (drv->bdrv_co_pwrite_zeroes && buffer_is_zero(bounce_buffer, iov.iov_len)) { /* FIXME: Should we (perhaps conditionally) be setting * BDRV_REQ_MAY_UNMAP, if it will allow for a sparser copy * that still correctly reads as zero? */ ret = bdrv_co_do_pwrite_zeroes(bs, cluster_offset, cluster_bytes, 0); } else { /* This does not change the data on the disk, it is not necessary * to flush even in cache=writethrough mode. */ ret = bdrv_driver_pwritev(bs, cluster_offset, cluster_bytes, &bounce_qiov, 0); } if (ret < 0) { /* It might be okay to ignore write errors for guest requests. If this * is a deliberate copy-on-read then we don't want to ignore the error. * Simply report it in all cases. */ goto err; } skip_bytes = offset - cluster_offset; qemu_iovec_from_buf(qiov, 0, bounce_buffer + skip_bytes, bytes); err: qemu_vfree(bounce_buffer); return ret; }
false
qemu
85c97ca7a10b93216bc95052e9dabe3a4bb8736a
static int coroutine_fn bdrv_co_do_copy_on_readv(BlockDriverState *bs, int64_t offset, unsigned int bytes, QEMUIOVector *qiov) { void *bounce_buffer; BlockDriver *drv = bs->drv; struct iovec iov; QEMUIOVector bounce_qiov; int64_t cluster_offset; unsigned int cluster_bytes; size_t skip_bytes; int ret; bdrv_round_to_clusters(bs, offset, bytes, &cluster_offset, &cluster_bytes); trace_bdrv_co_do_copy_on_readv(bs, offset, bytes, cluster_offset, cluster_bytes); iov.iov_len = cluster_bytes; iov.iov_base = bounce_buffer = qemu_try_blockalign(bs, iov.iov_len); if (bounce_buffer == NULL) { ret = -ENOMEM; goto err; } qemu_iovec_init_external(&bounce_qiov, &iov, 1); ret = bdrv_driver_preadv(bs, cluster_offset, cluster_bytes, &bounce_qiov, 0); if (ret < 0) { goto err; } if (drv->bdrv_co_pwrite_zeroes && buffer_is_zero(bounce_buffer, iov.iov_len)) { ret = bdrv_co_do_pwrite_zeroes(bs, cluster_offset, cluster_bytes, 0); } else { ret = bdrv_driver_pwritev(bs, cluster_offset, cluster_bytes, &bounce_qiov, 0); } if (ret < 0) { goto err; } skip_bytes = offset - cluster_offset; qemu_iovec_from_buf(qiov, 0, bounce_buffer + skip_bytes, bytes); err: qemu_vfree(bounce_buffer); return ret; }
{ "code": [], "line_no": [] }
static int VAR_0 bdrv_co_do_copy_on_readv(BlockDriverState *bs, int64_t offset, unsigned int bytes, QEMUIOVector *qiov) { void *bounce_buffer; BlockDriver *drv = bs->drv; struct iovec iov; QEMUIOVector bounce_qiov; int64_t cluster_offset; unsigned int cluster_bytes; size_t skip_bytes; int ret; bdrv_round_to_clusters(bs, offset, bytes, &cluster_offset, &cluster_bytes); trace_bdrv_co_do_copy_on_readv(bs, offset, bytes, cluster_offset, cluster_bytes); iov.iov_len = cluster_bytes; iov.iov_base = bounce_buffer = qemu_try_blockalign(bs, iov.iov_len); if (bounce_buffer == NULL) { ret = -ENOMEM; goto err; } qemu_iovec_init_external(&bounce_qiov, &iov, 1); ret = bdrv_driver_preadv(bs, cluster_offset, cluster_bytes, &bounce_qiov, 0); if (ret < 0) { goto err; } if (drv->bdrv_co_pwrite_zeroes && buffer_is_zero(bounce_buffer, iov.iov_len)) { ret = bdrv_co_do_pwrite_zeroes(bs, cluster_offset, cluster_bytes, 0); } else { ret = bdrv_driver_pwritev(bs, cluster_offset, cluster_bytes, &bounce_qiov, 0); } if (ret < 0) { goto err; } skip_bytes = offset - cluster_offset; qemu_iovec_from_buf(qiov, 0, bounce_buffer + skip_bytes, bytes); err: qemu_vfree(bounce_buffer); return ret; }
[ "static int VAR_0 bdrv_co_do_copy_on_readv(BlockDriverState *bs,\nint64_t offset, unsigned int bytes, QEMUIOVector *qiov)\n{", "void *bounce_buffer;", "BlockDriver *drv = bs->drv;", "struct iovec iov;", "QEMUIOVector bounce_qiov;", "int64_t cluster_offset;", "unsigned int cluster_bytes;", "size_t skip_bytes;", "int ret;", "bdrv_round_to_clusters(bs, offset, bytes, &cluster_offset, &cluster_bytes);", "trace_bdrv_co_do_copy_on_readv(bs, offset, bytes,\ncluster_offset, cluster_bytes);", "iov.iov_len = cluster_bytes;", "iov.iov_base = bounce_buffer = qemu_try_blockalign(bs, iov.iov_len);", "if (bounce_buffer == NULL) {", "ret = -ENOMEM;", "goto err;", "}", "qemu_iovec_init_external(&bounce_qiov, &iov, 1);", "ret = bdrv_driver_preadv(bs, cluster_offset, cluster_bytes,\n&bounce_qiov, 0);", "if (ret < 0) {", "goto err;", "}", "if (drv->bdrv_co_pwrite_zeroes &&\nbuffer_is_zero(bounce_buffer, iov.iov_len)) {", "ret = bdrv_co_do_pwrite_zeroes(bs, cluster_offset, cluster_bytes, 0);", "} else {", "ret = bdrv_driver_pwritev(bs, cluster_offset, cluster_bytes,\n&bounce_qiov, 0);", "}", "if (ret < 0) {", "goto err;", "}", "skip_bytes = offset - cluster_offset;", "qemu_iovec_from_buf(qiov, 0, bounce_buffer + skip_bytes, bytes);", "err:\nqemu_vfree(bounce_buffer);", "return ret;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 43 ], [ 47, 49 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 71, 73 ], [ 75 ], [ 77 ], [ 79 ], [ 83, 85 ], [ 93 ], [ 95 ], [ 103, 105 ], [ 107 ], [ 111 ], [ 121 ], [ 123 ], [ 127 ], [ 129 ], [ 133, 135 ], [ 137 ], [ 139 ] ]
10,089
static int sector_limits_lun2qemu(int64_t sector, IscsiLun *iscsilun) { int limit = MIN(sector_lun2qemu(sector, iscsilun), INT_MAX / 2 + 1); return limit < BDRV_REQUEST_MAX_SECTORS ? limit : 0; }
false
qemu
b9f7855a50a7cbf04454fa84e9d1f333151f2259
static int sector_limits_lun2qemu(int64_t sector, IscsiLun *iscsilun) { int limit = MIN(sector_lun2qemu(sector, iscsilun), INT_MAX / 2 + 1); return limit < BDRV_REQUEST_MAX_SECTORS ? limit : 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(int64_t VAR_0, IscsiLun *VAR_1) { int VAR_2 = MIN(sector_lun2qemu(VAR_0, VAR_1), INT_MAX / 2 + 1); return VAR_2 < BDRV_REQUEST_MAX_SECTORS ? VAR_2 : 0; }
[ "static int FUNC_0(int64_t VAR_0, IscsiLun *VAR_1)\n{", "int VAR_2 = MIN(sector_lun2qemu(VAR_0, VAR_1), INT_MAX / 2 + 1);", "return VAR_2 < BDRV_REQUEST_MAX_SECTORS ? VAR_2 : 0;", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ] ]
10,090
static ssize_t test_block_init_func(QCryptoBlock *block, size_t headerlen, Error **errp, void *opaque) { Buffer *header = opaque; g_assert_cmpint(header->capacity, ==, 0); buffer_reserve(header, headerlen); return headerlen; }
false
qemu
375092332eeaa6e47561ce47fd36144cdaf964d0
static ssize_t test_block_init_func(QCryptoBlock *block, size_t headerlen, Error **errp, void *opaque) { Buffer *header = opaque; g_assert_cmpint(header->capacity, ==, 0); buffer_reserve(header, headerlen); return headerlen; }
{ "code": [], "line_no": [] }
static ssize_t FUNC_0(QCryptoBlock *block, size_t headerlen, Error **errp, void *opaque) { Buffer *header = opaque; g_assert_cmpint(header->capacity, ==, 0); buffer_reserve(header, headerlen); return headerlen; }
[ "static ssize_t FUNC_0(QCryptoBlock *block,\nsize_t headerlen,\nError **errp,\nvoid *opaque)\n{", "Buffer *header = opaque;", "g_assert_cmpint(header->capacity, ==, 0);", "buffer_reserve(header, headerlen);", "return headerlen;", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 15 ], [ 19 ], [ 23 ], [ 25 ] ]
10,091
e1000_mmio_write(void *opaque, hwaddr 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
bc0f0674f037a01f2ce0870ad6270a356a7a8347
e1000_mmio_write(void *opaque, hwaddr 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, hwaddr 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, hwaddr 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 ] ]
10,092
void vnc_hextile_set_pixel_conversion(VncState *vs, int generic) { if (!generic) { switch (vs->ds->surface->pf.bits_per_pixel) { case 8: vs->send_hextile_tile = send_hextile_tile_8; break; case 16: vs->send_hextile_tile = send_hextile_tile_16; break; case 32: vs->send_hextile_tile = send_hextile_tile_32; break; } } else { switch (vs->ds->surface->pf.bits_per_pixel) { case 8: vs->send_hextile_tile = send_hextile_tile_generic_8; break; case 16: vs->send_hextile_tile = send_hextile_tile_generic_16; break; case 32: vs->send_hextile_tile = send_hextile_tile_generic_32; break; } } }
false
qemu
245f7b51c0ea04fb2224b1127430a096c91aee70
void vnc_hextile_set_pixel_conversion(VncState *vs, int generic) { if (!generic) { switch (vs->ds->surface->pf.bits_per_pixel) { case 8: vs->send_hextile_tile = send_hextile_tile_8; break; case 16: vs->send_hextile_tile = send_hextile_tile_16; break; case 32: vs->send_hextile_tile = send_hextile_tile_32; break; } } else { switch (vs->ds->surface->pf.bits_per_pixel) { case 8: vs->send_hextile_tile = send_hextile_tile_generic_8; break; case 16: vs->send_hextile_tile = send_hextile_tile_generic_16; break; case 32: vs->send_hextile_tile = send_hextile_tile_generic_32; break; } } }
{ "code": [], "line_no": [] }
void FUNC_0(VncState *VAR_0, int VAR_1) { if (!VAR_1) { switch (VAR_0->ds->surface->pf.bits_per_pixel) { case 8: VAR_0->send_hextile_tile = send_hextile_tile_8; break; case 16: VAR_0->send_hextile_tile = send_hextile_tile_16; break; case 32: VAR_0->send_hextile_tile = send_hextile_tile_32; break; } } else { switch (VAR_0->ds->surface->pf.bits_per_pixel) { case 8: VAR_0->send_hextile_tile = send_hextile_tile_generic_8; break; case 16: VAR_0->send_hextile_tile = send_hextile_tile_generic_16; break; case 32: VAR_0->send_hextile_tile = send_hextile_tile_generic_32; break; } } }
[ "void FUNC_0(VncState *VAR_0, int VAR_1)\n{", "if (!VAR_1) {", "switch (VAR_0->ds->surface->pf.bits_per_pixel) {", "case 8:\nVAR_0->send_hextile_tile = send_hextile_tile_8;", "break;", "case 16:\nVAR_0->send_hextile_tile = send_hextile_tile_16;", "break;", "case 32:\nVAR_0->send_hextile_tile = send_hextile_tile_32;", "break;", "}", "} else {", "switch (VAR_0->ds->surface->pf.bits_per_pixel) {", "case 8:\nVAR_0->send_hextile_tile = send_hextile_tile_generic_8;", "break;", "case 16:\nVAR_0->send_hextile_tile = send_hextile_tile_generic_16;", "break;", "case 32:\nVAR_0->send_hextile_tile = send_hextile_tile_generic_32;", "break;", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9, 11 ], [ 13 ], [ 15, 17 ], [ 19 ], [ 21, 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45, 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ] ]
10,093
static void qemu_rbd_aio_event_reader(void *opaque) { BDRVRBDState *s = opaque; ssize_t ret; do { char *p = (char *)&s->event_rcb; /* now read the rcb pointer that was sent from a non qemu thread */ if ((ret = read(s->fds[RBD_FD_READ], p + s->event_reader_pos, sizeof(s->event_rcb) - s->event_reader_pos)) > 0) { if (ret > 0) { s->event_reader_pos += ret; if (s->event_reader_pos == sizeof(s->event_rcb)) { s->event_reader_pos = 0; qemu_rbd_complete_aio(s->event_rcb); s->qemu_aio_count--; } } } } while (ret < 0 && errno == EINTR); }
false
qemu
dfe80b071b6ef6c9c0b4e36191e2fe2d16050766
static void qemu_rbd_aio_event_reader(void *opaque) { BDRVRBDState *s = opaque; ssize_t ret; do { char *p = (char *)&s->event_rcb; if ((ret = read(s->fds[RBD_FD_READ], p + s->event_reader_pos, sizeof(s->event_rcb) - s->event_reader_pos)) > 0) { if (ret > 0) { s->event_reader_pos += ret; if (s->event_reader_pos == sizeof(s->event_rcb)) { s->event_reader_pos = 0; qemu_rbd_complete_aio(s->event_rcb); s->qemu_aio_count--; } } } } while (ret < 0 && errno == EINTR); }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0) { BDRVRBDState *s = VAR_0; ssize_t ret; do { char *VAR_1 = (char *)&s->event_rcb; if ((ret = read(s->fds[RBD_FD_READ], VAR_1 + s->event_reader_pos, sizeof(s->event_rcb) - s->event_reader_pos)) > 0) { if (ret > 0) { s->event_reader_pos += ret; if (s->event_reader_pos == sizeof(s->event_rcb)) { s->event_reader_pos = 0; qemu_rbd_complete_aio(s->event_rcb); s->qemu_aio_count--; } } } } while (ret < 0 && errno == EINTR); }
[ "static void FUNC_0(void *VAR_0)\n{", "BDRVRBDState *s = VAR_0;", "ssize_t ret;", "do {", "char *VAR_1 = (char *)&s->event_rcb;", "if ((ret = read(s->fds[RBD_FD_READ], VAR_1 + s->event_reader_pos,\nsizeof(s->event_rcb) - s->event_reader_pos)) > 0) {", "if (ret > 0) {", "s->event_reader_pos += ret;", "if (s->event_reader_pos == sizeof(s->event_rcb)) {", "s->event_reader_pos = 0;", "qemu_rbd_complete_aio(s->event_rcb);", "s->qemu_aio_count--;", "}", "}", "}", "} while (ret < 0 && errno == EINTR);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 13 ], [ 15 ], [ 21, 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ] ]
10,094
static coroutine_fn int send_co_req(int sockfd, SheepdogReq *hdr, void *data, unsigned int *wlen) { int ret; ret = qemu_co_send(sockfd, hdr, sizeof(*hdr)); if (ret < sizeof(*hdr)) { error_report("failed to send a req, %s", strerror(errno)); return ret; } ret = qemu_co_send(sockfd, data, *wlen); if (ret < *wlen) { error_report("failed to send a req, %s", strerror(errno)); } return ret; }
false
qemu
80731d9da560461bbdcda5ad4b05f4a8a846fccd
static coroutine_fn int send_co_req(int sockfd, SheepdogReq *hdr, void *data, unsigned int *wlen) { int ret; ret = qemu_co_send(sockfd, hdr, sizeof(*hdr)); if (ret < sizeof(*hdr)) { error_report("failed to send a req, %s", strerror(errno)); return ret; } ret = qemu_co_send(sockfd, data, *wlen); if (ret < *wlen) { error_report("failed to send a req, %s", strerror(errno)); } return ret; }
{ "code": [], "line_no": [] }
static coroutine_fn int FUNC_0(int sockfd, SheepdogReq *hdr, void *data, unsigned int *wlen) { int VAR_0; VAR_0 = qemu_co_send(sockfd, hdr, sizeof(*hdr)); if (VAR_0 < sizeof(*hdr)) { error_report("failed to send a req, %s", strerror(errno)); return VAR_0; } VAR_0 = qemu_co_send(sockfd, data, *wlen); if (VAR_0 < *wlen) { error_report("failed to send a req, %s", strerror(errno)); } return VAR_0; }
[ "static coroutine_fn int FUNC_0(int sockfd, SheepdogReq *hdr, void *data,\nunsigned int *wlen)\n{", "int VAR_0;", "VAR_0 = qemu_co_send(sockfd, hdr, sizeof(*hdr));", "if (VAR_0 < sizeof(*hdr)) {", "error_report(\"failed to send a req, %s\", strerror(errno));", "return VAR_0;", "}", "VAR_0 = qemu_co_send(sockfd, data, *wlen);", "if (VAR_0 < *wlen) {", "error_report(\"failed to send a req, %s\", strerror(errno));", "}", "return VAR_0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ] ]
10,095
static inline void start_exclusive(void) { CPUState *other; pthread_mutex_lock(&exclusive_lock); exclusive_idle(); pending_cpus = 1; /* Make all other cpus stop executing. */ for (other = first_cpu; other; other = other->next_cpu) { if (other->running) { pending_cpus++; cpu_interrupt(other, CPU_INTERRUPT_EXIT); } } if (pending_cpus > 1) { pthread_cond_wait(&exclusive_cond, &exclusive_lock); } }
false
qemu
3098dba01c7daab60762b6f6624ea88c0d6cb65a
static inline void start_exclusive(void) { CPUState *other; pthread_mutex_lock(&exclusive_lock); exclusive_idle(); pending_cpus = 1; for (other = first_cpu; other; other = other->next_cpu) { if (other->running) { pending_cpus++; cpu_interrupt(other, CPU_INTERRUPT_EXIT); } } if (pending_cpus > 1) { pthread_cond_wait(&exclusive_cond, &exclusive_lock); } }
{ "code": [], "line_no": [] }
static inline void FUNC_0(void) { CPUState *other; pthread_mutex_lock(&exclusive_lock); exclusive_idle(); pending_cpus = 1; for (other = first_cpu; other; other = other->next_cpu) { if (other->running) { pending_cpus++; cpu_interrupt(other, CPU_INTERRUPT_EXIT); } } if (pending_cpus > 1) { pthread_cond_wait(&exclusive_cond, &exclusive_lock); } }
[ "static inline void FUNC_0(void)\n{", "CPUState *other;", "pthread_mutex_lock(&exclusive_lock);", "exclusive_idle();", "pending_cpus = 1;", "for (other = first_cpu; other; other = other->next_cpu) {", "if (other->running) {", "pending_cpus++;", "cpu_interrupt(other, CPU_INTERRUPT_EXIT);", "}", "}", "if (pending_cpus > 1) {", "pthread_cond_wait(&exclusive_cond, &exclusive_lock);", "}", "}" ]
[ 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 ] ]
10,096
matroska_parse_cluster (MatroskaDemuxContext *matroska) { int res = 0; uint32_t id; uint64_t cluster_time = 0; uint8_t *data; int64_t pos; int size; av_log(matroska->ctx, AV_LOG_DEBUG, "parsing cluster at %"PRId64"\n", url_ftell(&matroska->ctx->pb)); while (res == 0) { if (!(id = ebml_peek_id(matroska, &matroska->level_up))) { res = AVERROR_IO; break; } else if (matroska->level_up) { matroska->level_up--; break; } switch (id) { /* cluster timecode */ case MATROSKA_ID_CLUSTERTIMECODE: { uint64_t num; if ((res = ebml_read_uint(matroska, &id, &num)) < 0) break; cluster_time = num; break; } /* a group of blocks inside a cluster */ case MATROSKA_ID_BLOCKGROUP: if ((res = ebml_read_master(matroska, &id)) < 0) break; res = matroska_parse_blockgroup(matroska, cluster_time); break; case MATROSKA_ID_SIMPLEBLOCK: pos = url_ftell(&matroska->ctx->pb); res = ebml_read_binary(matroska, &id, &data, &size); if (res == 0) res = matroska_parse_block(matroska, data, size, pos, cluster_time, -1, NULL, NULL); break; default: av_log(matroska->ctx, AV_LOG_INFO, "Unknown entry 0x%x in cluster data\n", id); /* fall-through */ case EBML_ID_VOID: res = ebml_read_skip(matroska); break; } if (matroska->level_up) { matroska->level_up--; break; } } return res; }
false
FFmpeg
6bed20f45a484f5709fec4c97a238240161b1797
matroska_parse_cluster (MatroskaDemuxContext *matroska) { int res = 0; uint32_t id; uint64_t cluster_time = 0; uint8_t *data; int64_t pos; int size; av_log(matroska->ctx, AV_LOG_DEBUG, "parsing cluster at %"PRId64"\n", url_ftell(&matroska->ctx->pb)); while (res == 0) { if (!(id = ebml_peek_id(matroska, &matroska->level_up))) { res = AVERROR_IO; break; } else if (matroska->level_up) { matroska->level_up--; break; } switch (id) { case MATROSKA_ID_CLUSTERTIMECODE: { uint64_t num; if ((res = ebml_read_uint(matroska, &id, &num)) < 0) break; cluster_time = num; break; } case MATROSKA_ID_BLOCKGROUP: if ((res = ebml_read_master(matroska, &id)) < 0) break; res = matroska_parse_blockgroup(matroska, cluster_time); break; case MATROSKA_ID_SIMPLEBLOCK: pos = url_ftell(&matroska->ctx->pb); res = ebml_read_binary(matroska, &id, &data, &size); if (res == 0) res = matroska_parse_block(matroska, data, size, pos, cluster_time, -1, NULL, NULL); break; default: av_log(matroska->ctx, AV_LOG_INFO, "Unknown entry 0x%x in cluster data\n", id); case EBML_ID_VOID: res = ebml_read_skip(matroska); break; } if (matroska->level_up) { matroska->level_up--; break; } } return res; }
{ "code": [], "line_no": [] }
FUNC_0 (MatroskaDemuxContext *VAR_0) { int VAR_1 = 0; uint32_t id; uint64_t cluster_time = 0; uint8_t *data; int64_t pos; int VAR_2; av_log(VAR_0->ctx, AV_LOG_DEBUG, "parsing cluster at %"PRId64"\n", url_ftell(&VAR_0->ctx->pb)); while (VAR_1 == 0) { if (!(id = ebml_peek_id(VAR_0, &VAR_0->level_up))) { VAR_1 = AVERROR_IO; break; } else if (VAR_0->level_up) { VAR_0->level_up--; break; } switch (id) { case MATROSKA_ID_CLUSTERTIMECODE: { uint64_t num; if ((VAR_1 = ebml_read_uint(VAR_0, &id, &num)) < 0) break; cluster_time = num; break; } case MATROSKA_ID_BLOCKGROUP: if ((VAR_1 = ebml_read_master(VAR_0, &id)) < 0) break; VAR_1 = matroska_parse_blockgroup(VAR_0, cluster_time); break; case MATROSKA_ID_SIMPLEBLOCK: pos = url_ftell(&VAR_0->ctx->pb); VAR_1 = ebml_read_binary(VAR_0, &id, &data, &VAR_2); if (VAR_1 == 0) VAR_1 = matroska_parse_block(VAR_0, data, VAR_2, pos, cluster_time, -1, NULL, NULL); break; default: av_log(VAR_0->ctx, AV_LOG_INFO, "Unknown entry 0x%x in cluster data\n", id); case EBML_ID_VOID: VAR_1 = ebml_read_skip(VAR_0); break; } if (VAR_0->level_up) { VAR_0->level_up--; break; } } return VAR_1; }
[ "FUNC_0 (MatroskaDemuxContext *VAR_0)\n{", "int VAR_1 = 0;", "uint32_t id;", "uint64_t cluster_time = 0;", "uint8_t *data;", "int64_t pos;", "int VAR_2;", "av_log(VAR_0->ctx, AV_LOG_DEBUG,\n\"parsing cluster at %\"PRId64\"\\n\", url_ftell(&VAR_0->ctx->pb));", "while (VAR_1 == 0) {", "if (!(id = ebml_peek_id(VAR_0, &VAR_0->level_up))) {", "VAR_1 = AVERROR_IO;", "break;", "} else if (VAR_0->level_up) {", "VAR_0->level_up--;", "break;", "}", "switch (id) {", "case MATROSKA_ID_CLUSTERTIMECODE: {", "uint64_t num;", "if ((VAR_1 = ebml_read_uint(VAR_0, &id, &num)) < 0)\nbreak;", "cluster_time = num;", "break;", "}", "case MATROSKA_ID_BLOCKGROUP:\nif ((VAR_1 = ebml_read_master(VAR_0, &id)) < 0)\nbreak;", "VAR_1 = matroska_parse_blockgroup(VAR_0, cluster_time);", "break;", "case MATROSKA_ID_SIMPLEBLOCK:\npos = url_ftell(&VAR_0->ctx->pb);", "VAR_1 = ebml_read_binary(VAR_0, &id, &data, &VAR_2);", "if (VAR_1 == 0)\nVAR_1 = matroska_parse_block(VAR_0, data, VAR_2, pos,\ncluster_time, -1, NULL, NULL);", "break;", "default:\nav_log(VAR_0->ctx, AV_LOG_INFO,\n\"Unknown entry 0x%x in cluster data\\n\", id);", "case EBML_ID_VOID:\nVAR_1 = ebml_read_skip(VAR_0);", "break;", "}", "if (VAR_0->level_up) {", "VAR_0->level_up--;", "break;", "}", "}", "return VAR_1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19, 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 47 ], [ 49 ], [ 51, 53 ], [ 55 ], [ 57 ], [ 59 ], [ 65, 67, 69 ], [ 71 ], [ 73 ], [ 77, 79 ], [ 81 ], [ 83, 85, 87 ], [ 89 ], [ 93, 95, 97 ], [ 103, 105 ], [ 107 ], [ 109 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 125 ], [ 127 ] ]
10,097
static inline void gen_evsel(DisasContext *ctx) { int l1 = gen_new_label(); int l2 = gen_new_label(); int l3 = gen_new_label(); int l4 = gen_new_label(); TCGv_i32 t0 = tcg_temp_local_new_i32(); tcg_gen_andi_i32(t0, cpu_crf[ctx->opcode & 0x07], 1 << 3); tcg_gen_brcondi_i32(TCG_COND_EQ, t0, 0, l1); tcg_gen_mov_tl(cpu_gprh[rD(ctx->opcode)], cpu_gprh[rA(ctx->opcode)]); tcg_gen_br(l2); gen_set_label(l1); tcg_gen_mov_tl(cpu_gprh[rD(ctx->opcode)], cpu_gprh[rB(ctx->opcode)]); gen_set_label(l2); tcg_gen_andi_i32(t0, cpu_crf[ctx->opcode & 0x07], 1 << 2); tcg_gen_brcondi_i32(TCG_COND_EQ, t0, 0, l3); tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcode)]); tcg_gen_br(l4); gen_set_label(l3); tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rB(ctx->opcode)]); gen_set_label(l4); tcg_temp_free_i32(t0); }
false
qemu
42a268c241183877192c376d03bd9b6d527407c7
static inline void gen_evsel(DisasContext *ctx) { int l1 = gen_new_label(); int l2 = gen_new_label(); int l3 = gen_new_label(); int l4 = gen_new_label(); TCGv_i32 t0 = tcg_temp_local_new_i32(); tcg_gen_andi_i32(t0, cpu_crf[ctx->opcode & 0x07], 1 << 3); tcg_gen_brcondi_i32(TCG_COND_EQ, t0, 0, l1); tcg_gen_mov_tl(cpu_gprh[rD(ctx->opcode)], cpu_gprh[rA(ctx->opcode)]); tcg_gen_br(l2); gen_set_label(l1); tcg_gen_mov_tl(cpu_gprh[rD(ctx->opcode)], cpu_gprh[rB(ctx->opcode)]); gen_set_label(l2); tcg_gen_andi_i32(t0, cpu_crf[ctx->opcode & 0x07], 1 << 2); tcg_gen_brcondi_i32(TCG_COND_EQ, t0, 0, l3); tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcode)]); tcg_gen_br(l4); gen_set_label(l3); tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rB(ctx->opcode)]); gen_set_label(l4); tcg_temp_free_i32(t0); }
{ "code": [], "line_no": [] }
static inline void FUNC_0(DisasContext *VAR_0) { int VAR_1 = gen_new_label(); int VAR_2 = gen_new_label(); int VAR_3 = gen_new_label(); int VAR_4 = gen_new_label(); TCGv_i32 t0 = tcg_temp_local_new_i32(); tcg_gen_andi_i32(t0, cpu_crf[VAR_0->opcode & 0x07], 1 << 3); tcg_gen_brcondi_i32(TCG_COND_EQ, t0, 0, VAR_1); tcg_gen_mov_tl(cpu_gprh[rD(VAR_0->opcode)], cpu_gprh[rA(VAR_0->opcode)]); tcg_gen_br(VAR_2); gen_set_label(VAR_1); tcg_gen_mov_tl(cpu_gprh[rD(VAR_0->opcode)], cpu_gprh[rB(VAR_0->opcode)]); gen_set_label(VAR_2); tcg_gen_andi_i32(t0, cpu_crf[VAR_0->opcode & 0x07], 1 << 2); tcg_gen_brcondi_i32(TCG_COND_EQ, t0, 0, VAR_3); tcg_gen_mov_tl(cpu_gpr[rD(VAR_0->opcode)], cpu_gpr[rA(VAR_0->opcode)]); tcg_gen_br(VAR_4); gen_set_label(VAR_3); tcg_gen_mov_tl(cpu_gpr[rD(VAR_0->opcode)], cpu_gpr[rB(VAR_0->opcode)]); gen_set_label(VAR_4); tcg_temp_free_i32(t0); }
[ "static inline void FUNC_0(DisasContext *VAR_0)\n{", "int VAR_1 = gen_new_label();", "int VAR_2 = gen_new_label();", "int VAR_3 = gen_new_label();", "int VAR_4 = gen_new_label();", "TCGv_i32 t0 = tcg_temp_local_new_i32();", "tcg_gen_andi_i32(t0, cpu_crf[VAR_0->opcode & 0x07], 1 << 3);", "tcg_gen_brcondi_i32(TCG_COND_EQ, t0, 0, VAR_1);", "tcg_gen_mov_tl(cpu_gprh[rD(VAR_0->opcode)], cpu_gprh[rA(VAR_0->opcode)]);", "tcg_gen_br(VAR_2);", "gen_set_label(VAR_1);", "tcg_gen_mov_tl(cpu_gprh[rD(VAR_0->opcode)], cpu_gprh[rB(VAR_0->opcode)]);", "gen_set_label(VAR_2);", "tcg_gen_andi_i32(t0, cpu_crf[VAR_0->opcode & 0x07], 1 << 2);", "tcg_gen_brcondi_i32(TCG_COND_EQ, t0, 0, VAR_3);", "tcg_gen_mov_tl(cpu_gpr[rD(VAR_0->opcode)], cpu_gpr[rA(VAR_0->opcode)]);", "tcg_gen_br(VAR_4);", "gen_set_label(VAR_3);", "tcg_gen_mov_tl(cpu_gpr[rD(VAR_0->opcode)], cpu_gpr[rB(VAR_0->opcode)]);", "gen_set_label(VAR_4);", "tcg_temp_free_i32(t0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ] ]
10,098
static void x86_cpu_realizefn(DeviceState *dev, Error **errp) { CPUState *cs = CPU(dev); X86CPU *cpu = X86_CPU(dev); X86CPUClass *xcc = X86_CPU_GET_CLASS(dev); CPUX86State *env = &cpu->env; Error *local_err = NULL; static bool ht_warned; if (xcc->kvm_required && !kvm_enabled()) { char *name = x86_cpu_class_get_model_name(xcc); error_setg(&local_err, "CPU model '%s' requires KVM", name); g_free(name); goto out; } if (cpu->apic_id == UNASSIGNED_APIC_ID) { error_setg(errp, "apic-id property was not initialized properly"); return; } x86_cpu_load_features(cpu, &local_err); if (local_err) { goto out; } if (x86_cpu_filter_features(cpu) && (cpu->check_cpuid || cpu->enforce_cpuid)) { x86_cpu_report_filtered_features(cpu); if (cpu->enforce_cpuid) { error_setg(&local_err, kvm_enabled() ? "Host doesn't support requested features" : "TCG doesn't support requested features"); goto out; } } /* On AMD CPUs, some CPUID[8000_0001].EDX bits must match the bits on * CPUID[1].EDX. */ if (IS_AMD_CPU(env)) { env->features[FEAT_8000_0001_EDX] &= ~CPUID_EXT2_AMD_ALIASES; env->features[FEAT_8000_0001_EDX] |= (env->features[FEAT_1_EDX] & CPUID_EXT2_AMD_ALIASES); } /* For 64bit systems think about the number of physical bits to present. * ideally this should be the same as the host; anything other than matching * the host can cause incorrect guest behaviour. * QEMU used to pick the magic value of 40 bits that corresponds to * consumer AMD devices but nothing else. */ if (env->features[FEAT_8000_0001_EDX] & CPUID_EXT2_LM) { if (kvm_enabled()) { uint32_t host_phys_bits = x86_host_phys_bits(); static bool warned; if (cpu->host_phys_bits) { /* The user asked for us to use the host physical bits */ cpu->phys_bits = host_phys_bits; } /* Print a warning if the user set it to a value that's not the * host value. */ if (cpu->phys_bits != host_phys_bits && cpu->phys_bits != 0 && !warned) { error_report("Warning: Host physical bits (%u)" " does not match phys-bits property (%u)", host_phys_bits, cpu->phys_bits); warned = true; } if (cpu->phys_bits && (cpu->phys_bits > TARGET_PHYS_ADDR_SPACE_BITS || cpu->phys_bits < 32)) { error_setg(errp, "phys-bits should be between 32 and %u " " (but is %u)", TARGET_PHYS_ADDR_SPACE_BITS, cpu->phys_bits); return; } } else { if (cpu->phys_bits && cpu->phys_bits != TCG_PHYS_ADDR_BITS) { error_setg(errp, "TCG only supports phys-bits=%u", TCG_PHYS_ADDR_BITS); return; } } /* 0 means it was not explicitly set by the user (or by machine * compat_props or by the host code above). In this case, the default * is the value used by TCG (40). */ if (cpu->phys_bits == 0) { cpu->phys_bits = TCG_PHYS_ADDR_BITS; } } else { /* For 32 bit systems don't use the user set value, but keep * phys_bits consistent with what we tell the guest. */ if (cpu->phys_bits != 0) { error_setg(errp, "phys-bits is not user-configurable in 32 bit"); return; } if (env->features[FEAT_1_EDX] & CPUID_PSE36) { cpu->phys_bits = 36; } else { cpu->phys_bits = 32; } } cpu_exec_init(cs, &error_abort); if (tcg_enabled()) { tcg_x86_init(); } #ifndef CONFIG_USER_ONLY qemu_register_reset(x86_cpu_machine_reset_cb, cpu); if (cpu->env.features[FEAT_1_EDX] & CPUID_APIC || smp_cpus > 1) { x86_cpu_apic_create(cpu, &local_err); if (local_err != NULL) { goto out; } } #endif mce_init(cpu); #ifndef CONFIG_USER_ONLY if (tcg_enabled()) { AddressSpace *newas = g_new(AddressSpace, 1); cpu->cpu_as_mem = g_new(MemoryRegion, 1); cpu->cpu_as_root = g_new(MemoryRegion, 1); /* Outer container... */ memory_region_init(cpu->cpu_as_root, OBJECT(cpu), "memory", ~0ull); memory_region_set_enabled(cpu->cpu_as_root, true); /* ... with two regions inside: normal system memory with low * priority, and... */ memory_region_init_alias(cpu->cpu_as_mem, OBJECT(cpu), "memory", get_system_memory(), 0, ~0ull); memory_region_add_subregion_overlap(cpu->cpu_as_root, 0, cpu->cpu_as_mem, 0); memory_region_set_enabled(cpu->cpu_as_mem, true); address_space_init(newas, cpu->cpu_as_root, "CPU"); cs->num_ases = 1; cpu_address_space_init(cs, newas, 0); /* ... SMRAM with higher priority, linked from /machine/smram. */ cpu->machine_done.notify = x86_cpu_machine_done; qemu_add_machine_init_done_notifier(&cpu->machine_done); } #endif qemu_init_vcpu(cs); /* Only Intel CPUs support hyperthreading. Even though QEMU fixes this * issue by adjusting CPUID_0000_0001_EBX and CPUID_8000_0008_ECX * based on inputs (sockets,cores,threads), it is still better to gives * users a warning. * * NOTE: the following code has to follow qemu_init_vcpu(). Otherwise * cs->nr_threads hasn't be populated yet and the checking is incorrect. */ if (!IS_INTEL_CPU(env) && cs->nr_threads > 1 && !ht_warned) { error_report("AMD CPU doesn't support hyperthreading. Please configure" " -smp options properly."); ht_warned = true; } x86_cpu_apic_realize(cpu, &local_err); if (local_err != NULL) { goto out; } cpu_reset(cs); xcc->parent_realize(dev, &local_err); out: if (local_err != NULL) { error_propagate(errp, local_err); return; } }
true
qemu
ce5b1bbf624b977a55ff7f85bb3871682d03baff
static void x86_cpu_realizefn(DeviceState *dev, Error **errp) { CPUState *cs = CPU(dev); X86CPU *cpu = X86_CPU(dev); X86CPUClass *xcc = X86_CPU_GET_CLASS(dev); CPUX86State *env = &cpu->env; Error *local_err = NULL; static bool ht_warned; if (xcc->kvm_required && !kvm_enabled()) { char *name = x86_cpu_class_get_model_name(xcc); error_setg(&local_err, "CPU model '%s' requires KVM", name); g_free(name); goto out; } if (cpu->apic_id == UNASSIGNED_APIC_ID) { error_setg(errp, "apic-id property was not initialized properly"); return; } x86_cpu_load_features(cpu, &local_err); if (local_err) { goto out; } if (x86_cpu_filter_features(cpu) && (cpu->check_cpuid || cpu->enforce_cpuid)) { x86_cpu_report_filtered_features(cpu); if (cpu->enforce_cpuid) { error_setg(&local_err, kvm_enabled() ? "Host doesn't support requested features" : "TCG doesn't support requested features"); goto out; } } if (IS_AMD_CPU(env)) { env->features[FEAT_8000_0001_EDX] &= ~CPUID_EXT2_AMD_ALIASES; env->features[FEAT_8000_0001_EDX] |= (env->features[FEAT_1_EDX] & CPUID_EXT2_AMD_ALIASES); } if (env->features[FEAT_8000_0001_EDX] & CPUID_EXT2_LM) { if (kvm_enabled()) { uint32_t host_phys_bits = x86_host_phys_bits(); static bool warned; if (cpu->host_phys_bits) { cpu->phys_bits = host_phys_bits; } if (cpu->phys_bits != host_phys_bits && cpu->phys_bits != 0 && !warned) { error_report("Warning: Host physical bits (%u)" " does not match phys-bits property (%u)", host_phys_bits, cpu->phys_bits); warned = true; } if (cpu->phys_bits && (cpu->phys_bits > TARGET_PHYS_ADDR_SPACE_BITS || cpu->phys_bits < 32)) { error_setg(errp, "phys-bits should be between 32 and %u " " (but is %u)", TARGET_PHYS_ADDR_SPACE_BITS, cpu->phys_bits); return; } } else { if (cpu->phys_bits && cpu->phys_bits != TCG_PHYS_ADDR_BITS) { error_setg(errp, "TCG only supports phys-bits=%u", TCG_PHYS_ADDR_BITS); return; } } if (cpu->phys_bits == 0) { cpu->phys_bits = TCG_PHYS_ADDR_BITS; } } else { if (cpu->phys_bits != 0) { error_setg(errp, "phys-bits is not user-configurable in 32 bit"); return; } if (env->features[FEAT_1_EDX] & CPUID_PSE36) { cpu->phys_bits = 36; } else { cpu->phys_bits = 32; } } cpu_exec_init(cs, &error_abort); if (tcg_enabled()) { tcg_x86_init(); } #ifndef CONFIG_USER_ONLY qemu_register_reset(x86_cpu_machine_reset_cb, cpu); if (cpu->env.features[FEAT_1_EDX] & CPUID_APIC || smp_cpus > 1) { x86_cpu_apic_create(cpu, &local_err); if (local_err != NULL) { goto out; } } #endif mce_init(cpu); #ifndef CONFIG_USER_ONLY if (tcg_enabled()) { AddressSpace *newas = g_new(AddressSpace, 1); cpu->cpu_as_mem = g_new(MemoryRegion, 1); cpu->cpu_as_root = g_new(MemoryRegion, 1); memory_region_init(cpu->cpu_as_root, OBJECT(cpu), "memory", ~0ull); memory_region_set_enabled(cpu->cpu_as_root, true); memory_region_init_alias(cpu->cpu_as_mem, OBJECT(cpu), "memory", get_system_memory(), 0, ~0ull); memory_region_add_subregion_overlap(cpu->cpu_as_root, 0, cpu->cpu_as_mem, 0); memory_region_set_enabled(cpu->cpu_as_mem, true); address_space_init(newas, cpu->cpu_as_root, "CPU"); cs->num_ases = 1; cpu_address_space_init(cs, newas, 0); cpu->machine_done.notify = x86_cpu_machine_done; qemu_add_machine_init_done_notifier(&cpu->machine_done); } #endif qemu_init_vcpu(cs); if (!IS_INTEL_CPU(env) && cs->nr_threads > 1 && !ht_warned) { error_report("AMD CPU doesn't support hyperthreading. Please configure" " -smp options properly."); ht_warned = true; } x86_cpu_apic_realize(cpu, &local_err); if (local_err != NULL) { goto out; } cpu_reset(cs); xcc->parent_realize(dev, &local_err); out: if (local_err != NULL) { error_propagate(errp, local_err); return; } }
{ "code": [ " cpu_exec_init(cs, &error_abort);", " cpu_exec_init(cs, &error_abort);", " cpu_exec_init(cs, &error_abort);", " cpu_exec_init(cs, &error_abort);", " cpu_exec_init(cs, &error_abort);", " cpu_exec_init(cs, &error_abort);", " cpu_exec_init(cs, &error_abort);", " cpu_exec_init(cs, &error_abort);", " cpu_exec_init(cs, &error_abort);", " cpu_exec_init(cs, &error_abort);", " cpu_exec_init(cs, &error_abort);", " cpu_exec_init(cs, &error_abort);", " cpu_exec_init(cs, &error_abort);", " cpu_exec_init(cs, &error_abort);", " cpu_exec_init(cs, &error_abort);", " cpu_exec_init(cs, &error_abort);" ], "line_no": [ 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223 ] }
static void FUNC_0(DeviceState *VAR_0, Error **VAR_1) { CPUState *cs = CPU(VAR_0); X86CPU *cpu = X86_CPU(VAR_0); X86CPUClass *xcc = X86_CPU_GET_CLASS(VAR_0); CPUX86State *env = &cpu->env; Error *local_err = NULL; static bool VAR_2; if (xcc->kvm_required && !kvm_enabled()) { char *VAR_3 = x86_cpu_class_get_model_name(xcc); error_setg(&local_err, "CPU model '%s' requires KVM", VAR_3); g_free(VAR_3); goto out; } if (cpu->apic_id == UNASSIGNED_APIC_ID) { error_setg(VAR_1, "apic-id property was not initialized properly"); return; } x86_cpu_load_features(cpu, &local_err); if (local_err) { goto out; } if (x86_cpu_filter_features(cpu) && (cpu->check_cpuid || cpu->enforce_cpuid)) { x86_cpu_report_filtered_features(cpu); if (cpu->enforce_cpuid) { error_setg(&local_err, kvm_enabled() ? "Host doesn't support requested features" : "TCG doesn't support requested features"); goto out; } } if (IS_AMD_CPU(env)) { env->features[FEAT_8000_0001_EDX] &= ~CPUID_EXT2_AMD_ALIASES; env->features[FEAT_8000_0001_EDX] |= (env->features[FEAT_1_EDX] & CPUID_EXT2_AMD_ALIASES); } if (env->features[FEAT_8000_0001_EDX] & CPUID_EXT2_LM) { if (kvm_enabled()) { uint32_t host_phys_bits = x86_host_phys_bits(); static bool VAR_4; if (cpu->host_phys_bits) { cpu->phys_bits = host_phys_bits; } if (cpu->phys_bits != host_phys_bits && cpu->phys_bits != 0 && !VAR_4) { error_report("Warning: Host physical bits (%u)" " does not match phys-bits property (%u)", host_phys_bits, cpu->phys_bits); VAR_4 = true; } if (cpu->phys_bits && (cpu->phys_bits > TARGET_PHYS_ADDR_SPACE_BITS || cpu->phys_bits < 32)) { error_setg(VAR_1, "phys-bits should be between 32 and %u " " (but is %u)", TARGET_PHYS_ADDR_SPACE_BITS, cpu->phys_bits); return; } } else { if (cpu->phys_bits && cpu->phys_bits != TCG_PHYS_ADDR_BITS) { error_setg(VAR_1, "TCG only supports phys-bits=%u", TCG_PHYS_ADDR_BITS); return; } } if (cpu->phys_bits == 0) { cpu->phys_bits = TCG_PHYS_ADDR_BITS; } } else { if (cpu->phys_bits != 0) { error_setg(VAR_1, "phys-bits is not user-configurable in 32 bit"); return; } if (env->features[FEAT_1_EDX] & CPUID_PSE36) { cpu->phys_bits = 36; } else { cpu->phys_bits = 32; } } cpu_exec_init(cs, &error_abort); if (tcg_enabled()) { tcg_x86_init(); } #ifndef CONFIG_USER_ONLY qemu_register_reset(x86_cpu_machine_reset_cb, cpu); if (cpu->env.features[FEAT_1_EDX] & CPUID_APIC || smp_cpus > 1) { x86_cpu_apic_create(cpu, &local_err); if (local_err != NULL) { goto out; } } #endif mce_init(cpu); #ifndef CONFIG_USER_ONLY if (tcg_enabled()) { AddressSpace *newas = g_new(AddressSpace, 1); cpu->cpu_as_mem = g_new(MemoryRegion, 1); cpu->cpu_as_root = g_new(MemoryRegion, 1); memory_region_init(cpu->cpu_as_root, OBJECT(cpu), "memory", ~0ull); memory_region_set_enabled(cpu->cpu_as_root, true); memory_region_init_alias(cpu->cpu_as_mem, OBJECT(cpu), "memory", get_system_memory(), 0, ~0ull); memory_region_add_subregion_overlap(cpu->cpu_as_root, 0, cpu->cpu_as_mem, 0); memory_region_set_enabled(cpu->cpu_as_mem, true); address_space_init(newas, cpu->cpu_as_root, "CPU"); cs->num_ases = 1; cpu_address_space_init(cs, newas, 0); cpu->machine_done.notify = x86_cpu_machine_done; qemu_add_machine_init_done_notifier(&cpu->machine_done); } #endif qemu_init_vcpu(cs); if (!IS_INTEL_CPU(env) && cs->nr_threads > 1 && !VAR_2) { error_report("AMD CPU doesn't support hyperthreading. Please configure" " -smp options properly."); VAR_2 = true; } x86_cpu_apic_realize(cpu, &local_err); if (local_err != NULL) { goto out; } cpu_reset(cs); xcc->parent_realize(VAR_0, &local_err); out: if (local_err != NULL) { error_propagate(VAR_1, local_err); return; } }
[ "static void FUNC_0(DeviceState *VAR_0, Error **VAR_1)\n{", "CPUState *cs = CPU(VAR_0);", "X86CPU *cpu = X86_CPU(VAR_0);", "X86CPUClass *xcc = X86_CPU_GET_CLASS(VAR_0);", "CPUX86State *env = &cpu->env;", "Error *local_err = NULL;", "static bool VAR_2;", "if (xcc->kvm_required && !kvm_enabled()) {", "char *VAR_3 = x86_cpu_class_get_model_name(xcc);", "error_setg(&local_err, \"CPU model '%s' requires KVM\", VAR_3);", "g_free(VAR_3);", "goto out;", "}", "if (cpu->apic_id == UNASSIGNED_APIC_ID) {", "error_setg(VAR_1, \"apic-id property was not initialized properly\");", "return;", "}", "x86_cpu_load_features(cpu, &local_err);", "if (local_err) {", "goto out;", "}", "if (x86_cpu_filter_features(cpu) &&\n(cpu->check_cpuid || cpu->enforce_cpuid)) {", "x86_cpu_report_filtered_features(cpu);", "if (cpu->enforce_cpuid) {", "error_setg(&local_err,\nkvm_enabled() ?\n\"Host doesn't support requested features\" :\n\"TCG doesn't support requested features\");", "goto out;", "}", "}", "if (IS_AMD_CPU(env)) {", "env->features[FEAT_8000_0001_EDX] &= ~CPUID_EXT2_AMD_ALIASES;", "env->features[FEAT_8000_0001_EDX] |= (env->features[FEAT_1_EDX]\n& CPUID_EXT2_AMD_ALIASES);", "}", "if (env->features[FEAT_8000_0001_EDX] & CPUID_EXT2_LM) {", "if (kvm_enabled()) {", "uint32_t host_phys_bits = x86_host_phys_bits();", "static bool VAR_4;", "if (cpu->host_phys_bits) {", "cpu->phys_bits = host_phys_bits;", "}", "if (cpu->phys_bits != host_phys_bits && cpu->phys_bits != 0 &&\n!VAR_4) {", "error_report(\"Warning: Host physical bits (%u)\"\n\" does not match phys-bits property (%u)\",\nhost_phys_bits, cpu->phys_bits);", "VAR_4 = true;", "}", "if (cpu->phys_bits &&\n(cpu->phys_bits > TARGET_PHYS_ADDR_SPACE_BITS ||\ncpu->phys_bits < 32)) {", "error_setg(VAR_1, \"phys-bits should be between 32 and %u \"\n\" (but is %u)\",\nTARGET_PHYS_ADDR_SPACE_BITS, cpu->phys_bits);", "return;", "}", "} else {", "if (cpu->phys_bits && cpu->phys_bits != TCG_PHYS_ADDR_BITS) {", "error_setg(VAR_1, \"TCG only supports phys-bits=%u\",\nTCG_PHYS_ADDR_BITS);", "return;", "}", "}", "if (cpu->phys_bits == 0) {", "cpu->phys_bits = TCG_PHYS_ADDR_BITS;", "}", "} else {", "if (cpu->phys_bits != 0) {", "error_setg(VAR_1, \"phys-bits is not user-configurable in 32 bit\");", "return;", "}", "if (env->features[FEAT_1_EDX] & CPUID_PSE36) {", "cpu->phys_bits = 36;", "} else {", "cpu->phys_bits = 32;", "}", "}", "cpu_exec_init(cs, &error_abort);", "if (tcg_enabled()) {", "tcg_x86_init();", "}", "#ifndef CONFIG_USER_ONLY\nqemu_register_reset(x86_cpu_machine_reset_cb, cpu);", "if (cpu->env.features[FEAT_1_EDX] & CPUID_APIC || smp_cpus > 1) {", "x86_cpu_apic_create(cpu, &local_err);", "if (local_err != NULL) {", "goto out;", "}", "}", "#endif\nmce_init(cpu);", "#ifndef CONFIG_USER_ONLY\nif (tcg_enabled()) {", "AddressSpace *newas = g_new(AddressSpace, 1);", "cpu->cpu_as_mem = g_new(MemoryRegion, 1);", "cpu->cpu_as_root = g_new(MemoryRegion, 1);", "memory_region_init(cpu->cpu_as_root, OBJECT(cpu), \"memory\", ~0ull);", "memory_region_set_enabled(cpu->cpu_as_root, true);", "memory_region_init_alias(cpu->cpu_as_mem, OBJECT(cpu), \"memory\",\nget_system_memory(), 0, ~0ull);", "memory_region_add_subregion_overlap(cpu->cpu_as_root, 0, cpu->cpu_as_mem, 0);", "memory_region_set_enabled(cpu->cpu_as_mem, true);", "address_space_init(newas, cpu->cpu_as_root, \"CPU\");", "cs->num_ases = 1;", "cpu_address_space_init(cs, newas, 0);", "cpu->machine_done.notify = x86_cpu_machine_done;", "qemu_add_machine_init_done_notifier(&cpu->machine_done);", "}", "#endif\nqemu_init_vcpu(cs);", "if (!IS_INTEL_CPU(env) && cs->nr_threads > 1 && !VAR_2) {", "error_report(\"AMD CPU doesn't support hyperthreading. Please configure\"\n\" -smp options properly.\");", "VAR_2 = true;", "}", "x86_cpu_apic_realize(cpu, &local_err);", "if (local_err != NULL) {", "goto out;", "}", "cpu_reset(cs);", "xcc->parent_realize(VAR_0, &local_err);", "out:\nif (local_err != NULL) {", "error_propagate(VAR_1, local_err);", "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, 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53, 55 ], [ 57 ], [ 59 ], [ 61, 63, 65, 67 ], [ 69 ], [ 71 ], [ 73 ], [ 83 ], [ 85 ], [ 87, 89 ], [ 91 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 117 ], [ 121 ], [ 123 ], [ 133, 135 ], [ 137, 139, 141 ], [ 143 ], [ 145 ], [ 149, 151, 153 ], [ 155, 157, 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169, 171 ], [ 173 ], [ 175 ], [ 177 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 227 ], [ 229 ], [ 231 ], [ 235, 237 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253, 257 ], [ 261, 263 ], [ 265 ], [ 269 ], [ 271 ], [ 277 ], [ 279 ], [ 289, 291 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 301 ], [ 307 ], [ 309 ], [ 311 ], [ 313, 317 ], [ 337 ], [ 339, 341 ], [ 343 ], [ 345 ], [ 349 ], [ 351 ], [ 353 ], [ 355 ], [ 357 ], [ 361 ], [ 365, 367 ], [ 369 ], [ 371 ], [ 373 ], [ 375 ] ]
10,099
static int http_proxy_open(URLContext *h, const char *uri, int flags) { HTTPContext *s = h->priv_data; char hostname[1024], hoststr[1024]; char auth[1024], pathbuf[1024], *path; char line[1024], lower_url[100]; int port, ret = 0; HTTPAuthType cur_auth_type; char *authstr; h->is_streamed = 1; av_url_split(NULL, 0, auth, sizeof(auth), hostname, sizeof(hostname), &port, pathbuf, sizeof(pathbuf), uri); ff_url_join(hoststr, sizeof(hoststr), NULL, NULL, hostname, port, NULL); path = pathbuf; if (*path == '/') path++; ff_url_join(lower_url, sizeof(lower_url), "tcp", NULL, hostname, port, NULL); redo: ret = ffurl_open(&s->hd, lower_url, AVIO_FLAG_READ_WRITE, &h->interrupt_callback, NULL); if (ret < 0) return ret; authstr = ff_http_auth_create_response(&s->proxy_auth_state, auth, path, "CONNECT"); snprintf(s->buffer, sizeof(s->buffer), "CONNECT %s HTTP/1.1\r\n" "Host: %s\r\n" "Connection: close\r\n" "%s%s" "\r\n", path, hoststr, authstr ? "Proxy-" : "", authstr ? authstr : ""); av_freep(&authstr); if ((ret = ffurl_write(s->hd, s->buffer, strlen(s->buffer))) < 0) goto fail; s->buf_ptr = s->buffer; s->buf_end = s->buffer; s->line_count = 0; s->filesize = -1; cur_auth_type = s->proxy_auth_state.auth_type; for (;;) { int new_loc; // Note: This uses buffering, potentially reading more than the // HTTP header. If tunneling a protocol where the server starts // the conversation, we might buffer part of that here, too. // Reading that requires using the proper ffurl_read() function // on this URLContext, not using the fd directly (as the tls // protocol does). This shouldn't be an issue for tls though, // since the client starts the conversation there, so there // is no extra data that we might buffer up here. if (http_get_line(s, line, sizeof(line)) < 0) { ret = AVERROR(EIO); goto fail; } av_dlog(h, "header='%s'\n", line); ret = process_line(h, line, s->line_count, &new_loc); if (ret < 0) goto fail; if (ret == 0) break; s->line_count++; } if (s->http_code == 407 && cur_auth_type == HTTP_AUTH_NONE && s->proxy_auth_state.auth_type != HTTP_AUTH_NONE) { ffurl_close(s->hd); s->hd = NULL; goto redo; } if (s->http_code < 400) return 0; ret = AVERROR(EIO); fail: http_proxy_close(h); return ret; }
true
FFmpeg
e75bbcf493aeb549d04c56f49406aeee3950d93b
static int http_proxy_open(URLContext *h, const char *uri, int flags) { HTTPContext *s = h->priv_data; char hostname[1024], hoststr[1024]; char auth[1024], pathbuf[1024], *path; char line[1024], lower_url[100]; int port, ret = 0; HTTPAuthType cur_auth_type; char *authstr; h->is_streamed = 1; av_url_split(NULL, 0, auth, sizeof(auth), hostname, sizeof(hostname), &port, pathbuf, sizeof(pathbuf), uri); ff_url_join(hoststr, sizeof(hoststr), NULL, NULL, hostname, port, NULL); path = pathbuf; if (*path == '/') path++; ff_url_join(lower_url, sizeof(lower_url), "tcp", NULL, hostname, port, NULL); redo: ret = ffurl_open(&s->hd, lower_url, AVIO_FLAG_READ_WRITE, &h->interrupt_callback, NULL); if (ret < 0) return ret; authstr = ff_http_auth_create_response(&s->proxy_auth_state, auth, path, "CONNECT"); snprintf(s->buffer, sizeof(s->buffer), "CONNECT %s HTTP/1.1\r\n" "Host: %s\r\n" "Connection: close\r\n" "%s%s" "\r\n", path, hoststr, authstr ? "Proxy-" : "", authstr ? authstr : ""); av_freep(&authstr); if ((ret = ffurl_write(s->hd, s->buffer, strlen(s->buffer))) < 0) goto fail; s->buf_ptr = s->buffer; s->buf_end = s->buffer; s->line_count = 0; s->filesize = -1; cur_auth_type = s->proxy_auth_state.auth_type; for (;;) { int new_loc; if (http_get_line(s, line, sizeof(line)) < 0) { ret = AVERROR(EIO); goto fail; } av_dlog(h, "header='%s'\n", line); ret = process_line(h, line, s->line_count, &new_loc); if (ret < 0) goto fail; if (ret == 0) break; s->line_count++; } if (s->http_code == 407 && cur_auth_type == HTTP_AUTH_NONE && s->proxy_auth_state.auth_type != HTTP_AUTH_NONE) { ffurl_close(s->hd); s->hd = NULL; goto redo; } if (s->http_code < 400) return 0; ret = AVERROR(EIO); fail: http_proxy_close(h); return ret; }
{ "code": [ " int port, ret = 0;", " if (s->http_code == 407 && cur_auth_type == HTTP_AUTH_NONE &&", " s->proxy_auth_state.auth_type != HTTP_AUTH_NONE) {" ], "line_no": [ 13, 147, 149 ] }
static int FUNC_0(URLContext *VAR_0, const char *VAR_1, int VAR_2) { HTTPContext *s = VAR_0->priv_data; char VAR_3[1024], VAR_4[1024]; char VAR_5[1024], VAR_6[1024], *VAR_7; char VAR_8[1024], VAR_9[100]; int VAR_10, VAR_11 = 0; HTTPAuthType cur_auth_type; char *VAR_12; VAR_0->is_streamed = 1; av_url_split(NULL, 0, VAR_5, sizeof(VAR_5), VAR_3, sizeof(VAR_3), &VAR_10, VAR_6, sizeof(VAR_6), VAR_1); ff_url_join(VAR_4, sizeof(VAR_4), NULL, NULL, VAR_3, VAR_10, NULL); VAR_7 = VAR_6; if (*VAR_7 == '/') VAR_7++; ff_url_join(VAR_9, sizeof(VAR_9), "tcp", NULL, VAR_3, VAR_10, NULL); redo: VAR_11 = ffurl_open(&s->hd, VAR_9, AVIO_FLAG_READ_WRITE, &VAR_0->interrupt_callback, NULL); if (VAR_11 < 0) return VAR_11; VAR_12 = ff_http_auth_create_response(&s->proxy_auth_state, VAR_5, VAR_7, "CONNECT"); snprintf(s->buffer, sizeof(s->buffer), "CONNECT %s HTTP/1.1\r\n" "Host: %s\r\n" "Connection: close\r\n" "%s%s" "\r\n", VAR_7, VAR_4, VAR_12 ? "Proxy-" : "", VAR_12 ? VAR_12 : ""); av_freep(&VAR_12); if ((VAR_11 = ffurl_write(s->hd, s->buffer, strlen(s->buffer))) < 0) goto fail; s->buf_ptr = s->buffer; s->buf_end = s->buffer; s->line_count = 0; s->filesize = -1; cur_auth_type = s->proxy_auth_state.auth_type; for (;;) { int VAR_13; if (http_get_line(s, VAR_8, sizeof(VAR_8)) < 0) { VAR_11 = AVERROR(EIO); goto fail; } av_dlog(VAR_0, "header='%s'\n", VAR_8); VAR_11 = process_line(VAR_0, VAR_8, s->line_count, &VAR_13); if (VAR_11 < 0) goto fail; if (VAR_11 == 0) break; s->line_count++; } if (s->http_code == 407 && cur_auth_type == HTTP_AUTH_NONE && s->proxy_auth_state.auth_type != HTTP_AUTH_NONE) { ffurl_close(s->hd); s->hd = NULL; goto redo; } if (s->http_code < 400) return 0; VAR_11 = AVERROR(EIO); fail: http_proxy_close(VAR_0); return VAR_11; }
[ "static int FUNC_0(URLContext *VAR_0, const char *VAR_1, int VAR_2)\n{", "HTTPContext *s = VAR_0->priv_data;", "char VAR_3[1024], VAR_4[1024];", "char VAR_5[1024], VAR_6[1024], *VAR_7;", "char VAR_8[1024], VAR_9[100];", "int VAR_10, VAR_11 = 0;", "HTTPAuthType cur_auth_type;", "char *VAR_12;", "VAR_0->is_streamed = 1;", "av_url_split(NULL, 0, VAR_5, sizeof(VAR_5), VAR_3, sizeof(VAR_3), &VAR_10,\nVAR_6, sizeof(VAR_6), VAR_1);", "ff_url_join(VAR_4, sizeof(VAR_4), NULL, NULL, VAR_3, VAR_10, NULL);", "VAR_7 = VAR_6;", "if (*VAR_7 == '/')\nVAR_7++;", "ff_url_join(VAR_9, sizeof(VAR_9), \"tcp\", NULL, VAR_3, VAR_10,\nNULL);", "redo:\nVAR_11 = ffurl_open(&s->hd, VAR_9, AVIO_FLAG_READ_WRITE,\n&VAR_0->interrupt_callback, NULL);", "if (VAR_11 < 0)\nreturn VAR_11;", "VAR_12 = ff_http_auth_create_response(&s->proxy_auth_state, VAR_5,\nVAR_7, \"CONNECT\");", "snprintf(s->buffer, sizeof(s->buffer),\n\"CONNECT %s HTTP/1.1\\r\\n\"\n\"Host: %s\\r\\n\"\n\"Connection: close\\r\\n\"\n\"%s%s\"\n\"\\r\\n\",\nVAR_7,\nVAR_4,\nVAR_12 ? \"Proxy-\" : \"\", VAR_12 ? VAR_12 : \"\");", "av_freep(&VAR_12);", "if ((VAR_11 = ffurl_write(s->hd, s->buffer, strlen(s->buffer))) < 0)\ngoto fail;", "s->buf_ptr = s->buffer;", "s->buf_end = s->buffer;", "s->line_count = 0;", "s->filesize = -1;", "cur_auth_type = s->proxy_auth_state.auth_type;", "for (;;) {", "int VAR_13;", "if (http_get_line(s, VAR_8, sizeof(VAR_8)) < 0) {", "VAR_11 = AVERROR(EIO);", "goto fail;", "}", "av_dlog(VAR_0, \"header='%s'\\n\", VAR_8);", "VAR_11 = process_line(VAR_0, VAR_8, s->line_count, &VAR_13);", "if (VAR_11 < 0)\ngoto fail;", "if (VAR_11 == 0)\nbreak;", "s->line_count++;", "}", "if (s->http_code == 407 && cur_auth_type == HTTP_AUTH_NONE &&\ns->proxy_auth_state.auth_type != HTTP_AUTH_NONE) {", "ffurl_close(s->hd);", "s->hd = NULL;", "goto redo;", "}", "if (s->http_code < 400)\nreturn 0;", "VAR_11 = AVERROR(EIO);", "fail:\nhttp_proxy_close(VAR_0);", "return VAR_11;", "}" ]
[ 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, 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 ], [ 39, 41 ], [ 43, 45, 47 ], [ 49, 51 ], [ 55, 57 ], [ 59, 61, 63, 65, 67, 69, 71, 73, 75 ], [ 77 ], [ 81, 83 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99 ], [ 101 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 129 ], [ 133 ], [ 135, 137 ], [ 139, 141 ], [ 143 ], [ 145 ], [ 147, 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 161, 163 ], [ 165 ], [ 169, 171 ], [ 173 ], [ 175 ] ]
10,100
void rtp_parse_close(RTPDemuxContext *s) { // TODO: fold this into the protocol specific data fields. if (!strcmp(ff_rtp_enc_name(s->payload_type), "MP2T")) { ff_mpegts_parse_close(s->ts); } av_free(s); }
true
FFmpeg
0e4b185a8df12c7b42642699a8df45e0de48de07
void rtp_parse_close(RTPDemuxContext *s) { if (!strcmp(ff_rtp_enc_name(s->payload_type), "MP2T")) { ff_mpegts_parse_close(s->ts); } av_free(s); }
{ "code": [], "line_no": [] }
void FUNC_0(RTPDemuxContext *VAR_0) { if (!strcmp(ff_rtp_enc_name(VAR_0->payload_type), "MP2T")) { ff_mpegts_parse_close(VAR_0->ts); } av_free(VAR_0); }
[ "void FUNC_0(RTPDemuxContext *VAR_0)\n{", "if (!strcmp(ff_rtp_enc_name(VAR_0->payload_type), \"MP2T\")) {", "ff_mpegts_parse_close(VAR_0->ts);", "}", "av_free(VAR_0);", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ] ]
10,101
static long gethugepagesize(const char *path, Error **errp) { struct statfs fs; int ret; do { ret = statfs(path, &fs); } while (ret != 0 && errno == EINTR); if (ret != 0) { error_setg_errno(errp, errno, "failed to get page size of file %s", path); return 0; } return fs.f_bsize; }
true
qemu
fd97fd4408040a9a6dfaf2fdaeca1c566db6d0aa
static long gethugepagesize(const char *path, Error **errp) { struct statfs fs; int ret; do { ret = statfs(path, &fs); } while (ret != 0 && errno == EINTR); if (ret != 0) { error_setg_errno(errp, errno, "failed to get page size of file %s", path); return 0; } return fs.f_bsize; }
{ "code": [ "static long gethugepagesize(const char *path, Error **errp)", " ret = statfs(path, &fs);", " error_setg_errno(errp, errno, \"failed to get page size of file %s\",", " path);", " return 0;" ], "line_no": [ 1, 13, 21, 23, 25 ] }
static long FUNC_0(const char *VAR_0, Error **VAR_1) { struct statfs VAR_2; int VAR_3; do { VAR_3 = statfs(VAR_0, &VAR_2); } while (VAR_3 != 0 && errno == EINTR); if (VAR_3 != 0) { error_setg_errno(VAR_1, errno, "failed to get page size of file %s", VAR_0); return 0; } return VAR_2.f_bsize; }
[ "static long FUNC_0(const char *VAR_0, Error **VAR_1)\n{", "struct statfs VAR_2;", "int VAR_3;", "do {", "VAR_3 = statfs(VAR_0, &VAR_2);", "} while (VAR_3 != 0 && errno == EINTR);", "if (VAR_3 != 0) {", "error_setg_errno(VAR_1, errno, \"failed to get page size of file %s\",\nVAR_0);", "return 0;", "}", "return VAR_2.f_bsize;", "}" ]
[ 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21, 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ] ]
10,102
void qpci_device_foreach(QPCIBus *bus, int vendor_id, int device_id, void (*func)(QPCIDevice *dev, int devfn, void *data), void *data) { int slot; for (slot = 0; slot < 32; slot++) { int fn; for (fn = 0; fn < 8; fn++) { QPCIDevice *dev; dev = qpci_device_find(bus, QPCI_DEVFN(slot, fn)); if (!dev) { continue; } if (vendor_id != -1 && qpci_config_readw(dev, PCI_VENDOR_ID) != vendor_id) { continue; } if (device_id != -1 && qpci_config_readw(dev, PCI_DEVICE_ID) != device_id) { continue; } func(dev, QPCI_DEVFN(slot, fn), data); } } }
true
qemu
ea53854a54bc54dddeec0c56572adf53384e960c
void qpci_device_foreach(QPCIBus *bus, int vendor_id, int device_id, void (*func)(QPCIDevice *dev, int devfn, void *data), void *data) { int slot; for (slot = 0; slot < 32; slot++) { int fn; for (fn = 0; fn < 8; fn++) { QPCIDevice *dev; dev = qpci_device_find(bus, QPCI_DEVFN(slot, fn)); if (!dev) { continue; } if (vendor_id != -1 && qpci_config_readw(dev, PCI_VENDOR_ID) != vendor_id) { continue; } if (device_id != -1 && qpci_config_readw(dev, PCI_DEVICE_ID) != device_id) { continue; } func(dev, QPCI_DEVFN(slot, fn), data); } } }
{ "code": [], "line_no": [] }
void FUNC_0(QPCIBus *VAR_0, int VAR_1, int VAR_2, void (*VAR_3)(QPCIDevice *VAR_4, int VAR_5, void *VAR_7), void *VAR_7) { int VAR_7; for (VAR_7 = 0; VAR_7 < 32; VAR_7++) { int VAR_8; for (VAR_8 = 0; VAR_8 < 8; VAR_8++) { QPCIDevice *VAR_4; VAR_4 = qpci_device_find(VAR_0, QPCI_DEVFN(VAR_7, VAR_8)); if (!VAR_4) { continue; } if (VAR_1 != -1 && qpci_config_readw(VAR_4, PCI_VENDOR_ID) != VAR_1) { continue; } if (VAR_2 != -1 && qpci_config_readw(VAR_4, PCI_DEVICE_ID) != VAR_2) { continue; } VAR_3(VAR_4, QPCI_DEVFN(VAR_7, VAR_8), VAR_7); } } }
[ "void FUNC_0(QPCIBus *VAR_0, int VAR_1, int VAR_2,\nvoid (*VAR_3)(QPCIDevice *VAR_4, int VAR_5, void *VAR_7),\nvoid *VAR_7)\n{", "int VAR_7;", "for (VAR_7 = 0; VAR_7 < 32; VAR_7++) {", "int VAR_8;", "for (VAR_8 = 0; VAR_8 < 8; VAR_8++) {", "QPCIDevice *VAR_4;", "VAR_4 = qpci_device_find(VAR_0, QPCI_DEVFN(VAR_7, VAR_8));", "if (!VAR_4) {", "continue;", "}", "if (VAR_1 != -1 &&\nqpci_config_readw(VAR_4, PCI_VENDOR_ID) != VAR_1) {", "continue;", "}", "if (VAR_2 != -1 &&\nqpci_config_readw(VAR_4, PCI_DEVICE_ID) != VAR_2) {", "continue;", "}", "VAR_3(VAR_4, QPCI_DEVFN(VAR_7, VAR_8), VAR_7);", "}", "}", "}" ]
[ 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 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35, 37 ], [ 40 ], [ 42 ], [ 46, 48 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ] ]
10,103
static int vc1_decode_frame(AVCodecContext *avctx, void *data, int *data_size, const uint8_t *buf, int buf_size) { VC1Context *v = avctx->priv_data; MpegEncContext *s = &v->s; AVFrame *pict = data; uint8_t *buf2 = NULL; /* no supplementary picture */ if (buf_size == 0) { /* special case for last picture */ if (s->low_delay==0 && s->next_picture_ptr) { *pict= *(AVFrame*)s->next_picture_ptr; s->next_picture_ptr= NULL; *data_size = sizeof(AVFrame); } return 0; } /* We need to set current_picture_ptr before reading the header, * otherwise we cannot store anything in there. */ if(s->current_picture_ptr==NULL || s->current_picture_ptr->data[0]){ int i= ff_find_unused_picture(s, 0); s->current_picture_ptr= &s->picture[i]; } //for advanced profile we may need to parse and unescape data if (avctx->codec_id == CODEC_ID_VC1) { int buf_size2 = 0; buf2 = av_mallocz(buf_size + FF_INPUT_BUFFER_PADDING_SIZE); if(IS_MARKER(AV_RB32(buf))){ /* frame starts with marker and needs to be parsed */ const uint8_t *start, *end, *next; int size; next = buf; for(start = buf, end = buf + buf_size; next < end; start = next){ next = find_next_marker(start + 4, end); size = next - start - 4; if(size <= 0) continue; switch(AV_RB32(start)){ case VC1_CODE_FRAME: buf_size2 = vc1_unescape_buffer(start + 4, size, buf2); break; case VC1_CODE_ENTRYPOINT: /* it should be before frame data */ buf_size2 = vc1_unescape_buffer(start + 4, size, buf2); init_get_bits(&s->gb, buf2, buf_size2*8); decode_entry_point(avctx, &s->gb); break; case VC1_CODE_SLICE: av_log(avctx, AV_LOG_ERROR, "Sliced decoding is not implemented (yet)\n"); return -1; } } }else if(v->interlace && ((buf[0] & 0xC0) == 0xC0)){ /* WVC1 interlaced stores both fields divided by marker */ const uint8_t *divider; divider = find_next_marker(buf, buf + buf_size); if((divider == (buf + buf_size)) || AV_RB32(divider) != VC1_CODE_FIELD){ av_log(avctx, AV_LOG_ERROR, "Error in WVC1 interlaced frame\n"); return -1; } buf_size2 = vc1_unescape_buffer(buf, divider - buf, buf2); // TODO av_free(buf2);return -1; }else{ buf_size2 = vc1_unescape_buffer(buf, buf_size, buf2); } init_get_bits(&s->gb, buf2, buf_size2*8); } else init_get_bits(&s->gb, buf, buf_size*8); // do parse frame header if(v->profile < PROFILE_ADVANCED) { if(vc1_parse_frame_header(v, &s->gb) == -1) { return -1; } } else { if(vc1_parse_frame_header_adv(v, &s->gb) == -1) { return -1; } } if(s->pict_type != FF_I_TYPE && !v->res_rtm_flag){ return -1; } // for hurry_up==5 s->current_picture.pict_type= s->pict_type; s->current_picture.key_frame= s->pict_type == FF_I_TYPE; /* skip B-frames if we don't have reference frames */ if(s->last_picture_ptr==NULL && (s->pict_type==FF_B_TYPE || s->dropable)){ return -1;//buf_size; } /* skip b frames if we are in a hurry */ if(avctx->hurry_up && s->pict_type==FF_B_TYPE) return -1;//buf_size; if( (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==FF_B_TYPE) || (avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=FF_I_TYPE) || avctx->skip_frame >= AVDISCARD_ALL) { return buf_size; } /* skip everything if we are in a hurry>=5 */ if(avctx->hurry_up>=5) { return -1;//buf_size; } if(s->next_p_frame_damaged){ if(s->pict_type==FF_B_TYPE) return buf_size; else s->next_p_frame_damaged=0; } if(MPV_frame_start(s, avctx) < 0) { return -1; } s->me.qpel_put= s->dsp.put_qpel_pixels_tab; s->me.qpel_avg= s->dsp.avg_qpel_pixels_tab; ff_er_frame_start(s); v->bits = buf_size * 8; vc1_decode_blocks(v); //av_log(s->avctx, AV_LOG_INFO, "Consumed %i/%i bits\n", get_bits_count(&s->gb), buf_size*8); // if(get_bits_count(&s->gb) > buf_size * 8) // return -1; ff_er_frame_end(s); MPV_frame_end(s); assert(s->current_picture.pict_type == s->current_picture_ptr->pict_type); assert(s->current_picture.pict_type == s->pict_type); if (s->pict_type == FF_B_TYPE || s->low_delay) { *pict= *(AVFrame*)s->current_picture_ptr; } else if (s->last_picture_ptr != NULL) { *pict= *(AVFrame*)s->last_picture_ptr; } if(s->last_picture_ptr || s->low_delay){ *data_size = sizeof(AVFrame); ff_print_debug_info(s, pict); } /* Return the Picture timestamp as the frame number */ /* we subtract 1 because it is added on utils.c */ avctx->frame_number = s->picture_number - 1; return buf_size; }
true
FFmpeg
8d8d2b73914a47cf9ce5ca4ff96de6fd067b84a6
static int vc1_decode_frame(AVCodecContext *avctx, void *data, int *data_size, const uint8_t *buf, int buf_size) { VC1Context *v = avctx->priv_data; MpegEncContext *s = &v->s; AVFrame *pict = data; uint8_t *buf2 = NULL; if (buf_size == 0) { if (s->low_delay==0 && s->next_picture_ptr) { *pict= *(AVFrame*)s->next_picture_ptr; s->next_picture_ptr= NULL; *data_size = sizeof(AVFrame); } return 0; } if(s->current_picture_ptr==NULL || s->current_picture_ptr->data[0]){ int i= ff_find_unused_picture(s, 0); s->current_picture_ptr= &s->picture[i]; } if (avctx->codec_id == CODEC_ID_VC1) { int buf_size2 = 0; buf2 = av_mallocz(buf_size + FF_INPUT_BUFFER_PADDING_SIZE); if(IS_MARKER(AV_RB32(buf))){ const uint8_t *start, *end, *next; int size; next = buf; for(start = buf, end = buf + buf_size; next < end; start = next){ next = find_next_marker(start + 4, end); size = next - start - 4; if(size <= 0) continue; switch(AV_RB32(start)){ case VC1_CODE_FRAME: buf_size2 = vc1_unescape_buffer(start + 4, size, buf2); break; case VC1_CODE_ENTRYPOINT: buf_size2 = vc1_unescape_buffer(start + 4, size, buf2); init_get_bits(&s->gb, buf2, buf_size2*8); decode_entry_point(avctx, &s->gb); break; case VC1_CODE_SLICE: av_log(avctx, AV_LOG_ERROR, "Sliced decoding is not implemented (yet)\n"); return -1; } } }else if(v->interlace && ((buf[0] & 0xC0) == 0xC0)){ const uint8_t *divider; divider = find_next_marker(buf, buf + buf_size); if((divider == (buf + buf_size)) || AV_RB32(divider) != VC1_CODE_FIELD){ av_log(avctx, AV_LOG_ERROR, "Error in WVC1 interlaced frame\n"); return -1; } buf_size2 = vc1_unescape_buffer(buf, divider - buf, buf2); av_free(buf2);return -1; }else{ buf_size2 = vc1_unescape_buffer(buf, buf_size, buf2); } init_get_bits(&s->gb, buf2, buf_size2*8); } else init_get_bits(&s->gb, buf, buf_size*8); if(v->profile < PROFILE_ADVANCED) { if(vc1_parse_frame_header(v, &s->gb) == -1) { return -1; } } else { if(vc1_parse_frame_header_adv(v, &s->gb) == -1) { return -1; } } if(s->pict_type != FF_I_TYPE && !v->res_rtm_flag){ return -1; } s->current_picture.pict_type= s->pict_type; s->current_picture.key_frame= s->pict_type == FF_I_TYPE; if(s->last_picture_ptr==NULL && (s->pict_type==FF_B_TYPE || s->dropable)){ return -1; } if(avctx->hurry_up && s->pict_type==FF_B_TYPE) return -1; if( (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==FF_B_TYPE) || (avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=FF_I_TYPE) || avctx->skip_frame >= AVDISCARD_ALL) { return buf_size; } if(avctx->hurry_up>=5) { return -1; } if(s->next_p_frame_damaged){ if(s->pict_type==FF_B_TYPE) return buf_size; else s->next_p_frame_damaged=0; } if(MPV_frame_start(s, avctx) < 0) { return -1; } s->me.qpel_put= s->dsp.put_qpel_pixels_tab; s->me.qpel_avg= s->dsp.avg_qpel_pixels_tab; ff_er_frame_start(s); v->bits = buf_size * 8; vc1_decode_blocks(v); ff_er_frame_end(s); MPV_frame_end(s); assert(s->current_picture.pict_type == s->current_picture_ptr->pict_type); assert(s->current_picture.pict_type == s->pict_type); if (s->pict_type == FF_B_TYPE || s->low_delay) { *pict= *(AVFrame*)s->current_picture_ptr; } else if (s->last_picture_ptr != NULL) { *pict= *(AVFrame*)s->last_picture_ptr; } if(s->last_picture_ptr || s->low_delay){ *data_size = sizeof(AVFrame); ff_print_debug_info(s, pict); } avctx->frame_number = s->picture_number - 1; return buf_size; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, const uint8_t *VAR_3, int VAR_4) { VC1Context *v = VAR_0->priv_data; MpegEncContext *s = &v->s; AVFrame *pict = VAR_1; uint8_t *buf2 = NULL; if (VAR_4 == 0) { if (s->low_delay==0 && s->next_picture_ptr) { *pict= *(AVFrame*)s->next_picture_ptr; s->next_picture_ptr= NULL; *VAR_2 = sizeof(AVFrame); } return 0; } if(s->current_picture_ptr==NULL || s->current_picture_ptr->VAR_1[0]){ int VAR_5= ff_find_unused_picture(s, 0); s->current_picture_ptr= &s->picture[VAR_5]; } if (VAR_0->codec_id == CODEC_ID_VC1) { int VAR_6 = 0; buf2 = av_mallocz(VAR_4 + FF_INPUT_BUFFER_PADDING_SIZE); if(IS_MARKER(AV_RB32(VAR_3))){ const uint8_t *VAR_7, *end, *next; int VAR_8; next = VAR_3; for(VAR_7 = VAR_3, end = VAR_3 + VAR_4; next < end; VAR_7 = next){ next = find_next_marker(VAR_7 + 4, end); VAR_8 = next - VAR_7 - 4; if(VAR_8 <= 0) continue; switch(AV_RB32(VAR_7)){ case VC1_CODE_FRAME: VAR_6 = vc1_unescape_buffer(VAR_7 + 4, VAR_8, buf2); break; case VC1_CODE_ENTRYPOINT: VAR_6 = vc1_unescape_buffer(VAR_7 + 4, VAR_8, buf2); init_get_bits(&s->gb, buf2, VAR_6*8); decode_entry_point(VAR_0, &s->gb); break; case VC1_CODE_SLICE: av_log(VAR_0, AV_LOG_ERROR, "Sliced decoding is not implemented (yet)\n"); return -1; } } }else if(v->interlace && ((VAR_3[0] & 0xC0) == 0xC0)){ const uint8_t *VAR_9; VAR_9 = find_next_marker(VAR_3, VAR_3 + VAR_4); if((VAR_9 == (VAR_3 + VAR_4)) || AV_RB32(VAR_9) != VC1_CODE_FIELD){ av_log(VAR_0, AV_LOG_ERROR, "Error in WVC1 interlaced frame\n"); return -1; } VAR_6 = vc1_unescape_buffer(VAR_3, VAR_9 - VAR_3, buf2); av_free(buf2);return -1; }else{ VAR_6 = vc1_unescape_buffer(VAR_3, VAR_4, buf2); } init_get_bits(&s->gb, buf2, VAR_6*8); } else init_get_bits(&s->gb, VAR_3, VAR_4*8); if(v->profile < PROFILE_ADVANCED) { if(vc1_parse_frame_header(v, &s->gb) == -1) { return -1; } } else { if(vc1_parse_frame_header_adv(v, &s->gb) == -1) { return -1; } } if(s->pict_type != FF_I_TYPE && !v->res_rtm_flag){ return -1; } s->current_picture.pict_type= s->pict_type; s->current_picture.key_frame= s->pict_type == FF_I_TYPE; if(s->last_picture_ptr==NULL && (s->pict_type==FF_B_TYPE || s->dropable)){ return -1; } if(VAR_0->hurry_up && s->pict_type==FF_B_TYPE) return -1; if( (VAR_0->skip_frame >= AVDISCARD_NONREF && s->pict_type==FF_B_TYPE) || (VAR_0->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=FF_I_TYPE) || VAR_0->skip_frame >= AVDISCARD_ALL) { return VAR_4; } if(VAR_0->hurry_up>=5) { return -1; } if(s->next_p_frame_damaged){ if(s->pict_type==FF_B_TYPE) return VAR_4; else s->next_p_frame_damaged=0; } if(MPV_frame_start(s, VAR_0) < 0) { return -1; } s->me.qpel_put= s->dsp.put_qpel_pixels_tab; s->me.qpel_avg= s->dsp.avg_qpel_pixels_tab; ff_er_frame_start(s); v->bits = VAR_4 * 8; vc1_decode_blocks(v); ff_er_frame_end(s); MPV_frame_end(s); assert(s->current_picture.pict_type == s->current_picture_ptr->pict_type); assert(s->current_picture.pict_type == s->pict_type); if (s->pict_type == FF_B_TYPE || s->low_delay) { *pict= *(AVFrame*)s->current_picture_ptr; } else if (s->last_picture_ptr != NULL) { *pict= *(AVFrame*)s->last_picture_ptr; } if(s->last_picture_ptr || s->low_delay){ *VAR_2 = sizeof(AVFrame); ff_print_debug_info(s, pict); } VAR_0->frame_number = s->picture_number - 1; return VAR_4; }
[ "static int FUNC_0(AVCodecContext *VAR_0,\nvoid *VAR_1, int *VAR_2,\nconst uint8_t *VAR_3, int VAR_4)\n{", "VC1Context *v = VAR_0->priv_data;", "MpegEncContext *s = &v->s;", "AVFrame *pict = VAR_1;", "uint8_t *buf2 = NULL;", "if (VAR_4 == 0) {", "if (s->low_delay==0 && s->next_picture_ptr) {", "*pict= *(AVFrame*)s->next_picture_ptr;", "s->next_picture_ptr= NULL;", "*VAR_2 = sizeof(AVFrame);", "}", "return 0;", "}", "if(s->current_picture_ptr==NULL || s->current_picture_ptr->VAR_1[0]){", "int VAR_5= ff_find_unused_picture(s, 0);", "s->current_picture_ptr= &s->picture[VAR_5];", "}", "if (VAR_0->codec_id == CODEC_ID_VC1) {", "int VAR_6 = 0;", "buf2 = av_mallocz(VAR_4 + FF_INPUT_BUFFER_PADDING_SIZE);", "if(IS_MARKER(AV_RB32(VAR_3))){", "const uint8_t *VAR_7, *end, *next;", "int VAR_8;", "next = VAR_3;", "for(VAR_7 = VAR_3, end = VAR_3 + VAR_4; next < end; VAR_7 = next){", "next = find_next_marker(VAR_7 + 4, end);", "VAR_8 = next - VAR_7 - 4;", "if(VAR_8 <= 0) continue;", "switch(AV_RB32(VAR_7)){", "case VC1_CODE_FRAME:\nVAR_6 = vc1_unescape_buffer(VAR_7 + 4, VAR_8, buf2);", "break;", "case VC1_CODE_ENTRYPOINT:\nVAR_6 = vc1_unescape_buffer(VAR_7 + 4, VAR_8, buf2);", "init_get_bits(&s->gb, buf2, VAR_6*8);", "decode_entry_point(VAR_0, &s->gb);", "break;", "case VC1_CODE_SLICE:\nav_log(VAR_0, AV_LOG_ERROR, \"Sliced decoding is not implemented (yet)\\n\");", "return -1;", "}", "}", "}else if(v->interlace && ((VAR_3[0] & 0xC0) == 0xC0)){", "const uint8_t *VAR_9;", "VAR_9 = find_next_marker(VAR_3, VAR_3 + VAR_4);", "if((VAR_9 == (VAR_3 + VAR_4)) || AV_RB32(VAR_9) != VC1_CODE_FIELD){", "av_log(VAR_0, AV_LOG_ERROR, \"Error in WVC1 interlaced frame\\n\");", "return -1;", "}", "VAR_6 = vc1_unescape_buffer(VAR_3, VAR_9 - VAR_3, buf2);", "av_free(buf2);return -1;", "}else{", "VAR_6 = vc1_unescape_buffer(VAR_3, VAR_4, buf2);", "}", "init_get_bits(&s->gb, buf2, VAR_6*8);", "} else", "init_get_bits(&s->gb, VAR_3, VAR_4*8);", "if(v->profile < PROFILE_ADVANCED) {", "if(vc1_parse_frame_header(v, &s->gb) == -1) {", "return -1;", "}", "} else {", "if(vc1_parse_frame_header_adv(v, &s->gb) == -1) {", "return -1;", "}", "}", "if(s->pict_type != FF_I_TYPE && !v->res_rtm_flag){", "return -1;", "}", "s->current_picture.pict_type= s->pict_type;", "s->current_picture.key_frame= s->pict_type == FF_I_TYPE;", "if(s->last_picture_ptr==NULL && (s->pict_type==FF_B_TYPE || s->dropable)){", "return -1;", "}", "if(VAR_0->hurry_up && s->pict_type==FF_B_TYPE) return -1;", "if( (VAR_0->skip_frame >= AVDISCARD_NONREF && s->pict_type==FF_B_TYPE)\n|| (VAR_0->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=FF_I_TYPE)\n|| VAR_0->skip_frame >= AVDISCARD_ALL) {", "return VAR_4;", "}", "if(VAR_0->hurry_up>=5) {", "return -1;", "}", "if(s->next_p_frame_damaged){", "if(s->pict_type==FF_B_TYPE)\nreturn VAR_4;", "else\ns->next_p_frame_damaged=0;", "}", "if(MPV_frame_start(s, VAR_0) < 0) {", "return -1;", "}", "s->me.qpel_put= s->dsp.put_qpel_pixels_tab;", "s->me.qpel_avg= s->dsp.avg_qpel_pixels_tab;", "ff_er_frame_start(s);", "v->bits = VAR_4 * 8;", "vc1_decode_blocks(v);", "ff_er_frame_end(s);", "MPV_frame_end(s);", "assert(s->current_picture.pict_type == s->current_picture_ptr->pict_type);", "assert(s->current_picture.pict_type == s->pict_type);", "if (s->pict_type == FF_B_TYPE || s->low_delay) {", "*pict= *(AVFrame*)s->current_picture_ptr;", "} else if (s->last_picture_ptr != NULL) {", "*pict= *(AVFrame*)s->last_picture_ptr;", "}", "if(s->last_picture_ptr || s->low_delay){", "*VAR_2 = sizeof(AVFrame);", "ff_print_debug_info(s, pict);", "}", "VAR_0->frame_number = s->picture_number - 1;", "return VAR_4;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89, 91 ], [ 93 ], [ 95, 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105, 107 ], [ 110 ], [ 112 ], [ 114 ], [ 116 ], [ 118 ], [ 122 ], [ 124 ], [ 126 ], [ 129 ], [ 131 ], [ 135 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 155 ], [ 157 ], [ 160 ], [ 162 ], [ 164 ], [ 166 ], [ 169 ], [ 171 ], [ 173 ], [ 177 ], [ 180 ], [ 182 ], [ 188 ], [ 190 ], [ 196 ], [ 199 ], [ 201 ], [ 205 ], [ 207, 209, 211 ], [ 214 ], [ 216 ], [ 220 ], [ 223 ], [ 225 ], [ 229 ], [ 231, 233 ], [ 235, 237 ], [ 239 ], [ 243 ], [ 246 ], [ 248 ], [ 252 ], [ 254 ], [ 258 ], [ 262 ], [ 264 ], [ 272 ], [ 276 ], [ 280 ], [ 282 ], [ 284 ], [ 286 ], [ 288 ], [ 290 ], [ 292 ], [ 296 ], [ 298 ], [ 300 ], [ 302 ], [ 310 ], [ 315 ], [ 317 ] ]
10,105
static int configuration_post_load(void *opaque, int version_id) { SaveState *state = opaque; const char *current_name = MACHINE_GET_CLASS(current_machine)->name; if (strncmp(state->name, current_name, state->len) != 0) { error_report("Machine type received is '%s' and local is '%s'", state->name, current_name); return -EINVAL; } return 0; }
true
qemu
15d61692da651fc79b3fc40050b986c5a73055c0
static int configuration_post_load(void *opaque, int version_id) { SaveState *state = opaque; const char *current_name = MACHINE_GET_CLASS(current_machine)->name; if (strncmp(state->name, current_name, state->len) != 0) { error_report("Machine type received is '%s' and local is '%s'", state->name, current_name); return -EINVAL; } return 0; }
{ "code": [ " error_report(\"Machine type received is '%s' and local is '%s'\",", " state->name, current_name);" ], "line_no": [ 13, 15 ] }
static int FUNC_0(void *VAR_0, int VAR_1) { SaveState *state = VAR_0; const char *VAR_2 = MACHINE_GET_CLASS(current_machine)->name; if (strncmp(state->name, VAR_2, state->len) != 0) { error_report("Machine type received is '%s' and local is '%s'", state->name, VAR_2); return -EINVAL; } return 0; }
[ "static int FUNC_0(void *VAR_0, int VAR_1)\n{", "SaveState *state = VAR_0;", "const char *VAR_2 = MACHINE_GET_CLASS(current_machine)->name;", "if (strncmp(state->name, VAR_2, state->len) != 0) {", "error_report(\"Machine type received is '%s' and local is '%s'\",\nstate->name, VAR_2);", "return -EINVAL;", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ] ]
10,106
static inline void vmsvga_copy_rect(struct vmsvga_state_s *s, int x0, int y0, int x1, int y1, int w, int h) { DisplaySurface *surface = qemu_console_surface(s->vga.con); uint8_t *vram = s->vga.vram_ptr; int bypl = surface_stride(surface); int bypp = surface_bytes_per_pixel(surface); int width = bypp * w; int line = h; uint8_t *ptr[2]; if (y1 > y0) { ptr[0] = vram + bypp * x0 + bypl * (y0 + h - 1); ptr[1] = vram + bypp * x1 + bypl * (y1 + h - 1); for (; line > 0; line --, ptr[0] -= bypl, ptr[1] -= bypl) { memmove(ptr[1], ptr[0], width); } } else { ptr[0] = vram + bypp * x0 + bypl * y0; ptr[1] = vram + bypp * x1 + bypl * y1; for (; line > 0; line --, ptr[0] += bypl, ptr[1] += bypl) { memmove(ptr[1], ptr[0], width); } } vmsvga_update_rect_delayed(s, x1, y1, w, h); }
true
qemu
61b41b4c20eba08d2185297767e69153d7f3e09d
static inline void vmsvga_copy_rect(struct vmsvga_state_s *s, int x0, int y0, int x1, int y1, int w, int h) { DisplaySurface *surface = qemu_console_surface(s->vga.con); uint8_t *vram = s->vga.vram_ptr; int bypl = surface_stride(surface); int bypp = surface_bytes_per_pixel(surface); int width = bypp * w; int line = h; uint8_t *ptr[2]; if (y1 > y0) { ptr[0] = vram + bypp * x0 + bypl * (y0 + h - 1); ptr[1] = vram + bypp * x1 + bypl * (y1 + h - 1); for (; line > 0; line --, ptr[0] -= bypl, ptr[1] -= bypl) { memmove(ptr[1], ptr[0], width); } } else { ptr[0] = vram + bypp * x0 + bypl * y0; ptr[1] = vram + bypp * x1 + bypl * y1; for (; line > 0; line --, ptr[0] += bypl, ptr[1] += bypl) { memmove(ptr[1], ptr[0], width); } } vmsvga_update_rect_delayed(s, x1, y1, w, h); }
{ "code": [ "static inline void vmsvga_copy_rect(struct vmsvga_state_s *s," ], "line_no": [ 1 ] }
static inline void FUNC_0(struct vmsvga_state_s *VAR_0, int VAR_1, int VAR_2, int VAR_3, int VAR_4, int VAR_5, int VAR_6) { DisplaySurface *surface = qemu_console_surface(VAR_0->vga.con); uint8_t *vram = VAR_0->vga.vram_ptr; int VAR_7 = surface_stride(surface); int VAR_8 = surface_bytes_per_pixel(surface); int VAR_9 = VAR_8 * VAR_5; int VAR_10 = VAR_6; uint8_t *ptr[2]; if (VAR_4 > VAR_2) { ptr[0] = vram + VAR_8 * VAR_1 + VAR_7 * (VAR_2 + VAR_6 - 1); ptr[1] = vram + VAR_8 * VAR_3 + VAR_7 * (VAR_4 + VAR_6 - 1); for (; VAR_10 > 0; VAR_10 --, ptr[0] -= VAR_7, ptr[1] -= VAR_7) { memmove(ptr[1], ptr[0], VAR_9); } } else { ptr[0] = vram + VAR_8 * VAR_1 + VAR_7 * VAR_2; ptr[1] = vram + VAR_8 * VAR_3 + VAR_7 * VAR_4; for (; VAR_10 > 0; VAR_10 --, ptr[0] += VAR_7, ptr[1] += VAR_7) { memmove(ptr[1], ptr[0], VAR_9); } } vmsvga_update_rect_delayed(VAR_0, VAR_3, VAR_4, VAR_5, VAR_6); }
[ "static inline void FUNC_0(struct vmsvga_state_s *VAR_0,\nint VAR_1, int VAR_2, int VAR_3, int VAR_4, int VAR_5, int VAR_6)\n{", "DisplaySurface *surface = qemu_console_surface(VAR_0->vga.con);", "uint8_t *vram = VAR_0->vga.vram_ptr;", "int VAR_7 = surface_stride(surface);", "int VAR_8 = surface_bytes_per_pixel(surface);", "int VAR_9 = VAR_8 * VAR_5;", "int VAR_10 = VAR_6;", "uint8_t *ptr[2];", "if (VAR_4 > VAR_2) {", "ptr[0] = vram + VAR_8 * VAR_1 + VAR_7 * (VAR_2 + VAR_6 - 1);", "ptr[1] = vram + VAR_8 * VAR_3 + VAR_7 * (VAR_4 + VAR_6 - 1);", "for (; VAR_10 > 0; VAR_10 --, ptr[0] -= VAR_7, ptr[1] -= VAR_7) {", "memmove(ptr[1], ptr[0], VAR_9);", "}", "} else {", "ptr[0] = vram + VAR_8 * VAR_1 + VAR_7 * VAR_2;", "ptr[1] = vram + VAR_8 * VAR_3 + VAR_7 * VAR_4;", "for (; VAR_10 > 0; VAR_10 --, ptr[0] += VAR_7, ptr[1] += VAR_7) {", "memmove(ptr[1], ptr[0], VAR_9);", "}", "}", "vmsvga_update_rect_delayed(VAR_0, VAR_3, VAR_4, VAR_5, VAR_6);", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ] ]
10,107
static inline int decode_mb(MDECContext *a, DCTELEM block[6][64]){ int i; const int block_index[6]= {5,4,0,1,2,3}; a->dsp.clear_blocks(block[0]); for(i=0; i<6; i++){ if( mdec_decode_block_intra(a, block[ block_index[i] ], block_index[i]) < 0) return -1; } return 0; }
true
FFmpeg
32ac63ee10ca5daa149344a75d736c1b98177392
static inline int decode_mb(MDECContext *a, DCTELEM block[6][64]){ int i; const int block_index[6]= {5,4,0,1,2,3}; a->dsp.clear_blocks(block[0]); for(i=0; i<6; i++){ if( mdec_decode_block_intra(a, block[ block_index[i] ], block_index[i]) < 0) return -1; } return 0; }
{ "code": [ " if( mdec_decode_block_intra(a, block[ block_index[i] ], block_index[i]) < 0)" ], "line_no": [ 15 ] }
static inline int FUNC_0(MDECContext *VAR_0, DCTELEM VAR_1[6][64]){ int VAR_2; const int VAR_3[6]= {5,4,0,1,2,3}; VAR_0->dsp.clear_blocks(VAR_1[0]); for(VAR_2=0; VAR_2<6; VAR_2++){ if( mdec_decode_block_intra(VAR_0, VAR_1[ VAR_3[VAR_2] ], VAR_3[VAR_2]) < 0) return -1; } return 0; }
[ "static inline int FUNC_0(MDECContext *VAR_0, DCTELEM VAR_1[6][64]){", "int VAR_2;", "const int VAR_3[6]= {5,4,0,1,2,3};", "VAR_0->dsp.clear_blocks(VAR_1[0]);", "for(VAR_2=0; VAR_2<6; VAR_2++){", "if( mdec_decode_block_intra(VAR_0, VAR_1[ VAR_3[VAR_2] ], VAR_3[VAR_2]) < 0)\nreturn -1;", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 1, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 9 ], [ 13 ], [ 15, 17 ], [ 19 ], [ 21 ], [ 23 ] ]
10,108
static int vnc_start_vencrypt_handshake(VncState *vs) { int ret; if ((ret = gnutls_handshake(vs->tls.session)) < 0) { if (!gnutls_error_is_fatal(ret)) { VNC_DEBUG("Handshake interrupted (blocking)\n"); if (!gnutls_record_get_direction(vs->tls.session)) qemu_set_fd_handler(vs->csock, vnc_tls_handshake_io, NULL, vs); else qemu_set_fd_handler(vs->csock, NULL, vnc_tls_handshake_io, vs); return 0; } VNC_DEBUG("Handshake failed %s\n", gnutls_strerror(ret)); vnc_client_error(vs); return -1; } if (vs->vd->tls.x509verify) { if (vnc_tls_validate_certificate(vs) < 0) { VNC_DEBUG("Client verification failed\n"); vnc_client_error(vs); return -1; } else { VNC_DEBUG("Client verification passed\n"); } } VNC_DEBUG("Handshake done, switching to TLS data mode\n"); qemu_set_fd_handler(vs->csock, vnc_client_read, vnc_client_write, vs); start_auth_vencrypt_subauth(vs); return 0; }
true
qemu
3e305e4a4752f70c0b5c3cf5b43ec957881714f7
static int vnc_start_vencrypt_handshake(VncState *vs) { int ret; if ((ret = gnutls_handshake(vs->tls.session)) < 0) { if (!gnutls_error_is_fatal(ret)) { VNC_DEBUG("Handshake interrupted (blocking)\n"); if (!gnutls_record_get_direction(vs->tls.session)) qemu_set_fd_handler(vs->csock, vnc_tls_handshake_io, NULL, vs); else qemu_set_fd_handler(vs->csock, NULL, vnc_tls_handshake_io, vs); return 0; } VNC_DEBUG("Handshake failed %s\n", gnutls_strerror(ret)); vnc_client_error(vs); return -1; } if (vs->vd->tls.x509verify) { if (vnc_tls_validate_certificate(vs) < 0) { VNC_DEBUG("Client verification failed\n"); vnc_client_error(vs); return -1; } else { VNC_DEBUG("Client verification passed\n"); } } VNC_DEBUG("Handshake done, switching to TLS data mode\n"); qemu_set_fd_handler(vs->csock, vnc_client_read, vnc_client_write, vs); start_auth_vencrypt_subauth(vs); return 0; }
{ "code": [ " int ret;", " if ((ret = gnutls_handshake(vs->tls.session)) < 0) {", " if (!gnutls_error_is_fatal(ret)) {", " VNC_DEBUG(\"Handshake interrupted (blocking)\\n\");", " if (!gnutls_record_get_direction(vs->tls.session))", " qemu_set_fd_handler(vs->csock, vnc_tls_handshake_io, NULL, vs);", " qemu_set_fd_handler(vs->csock, NULL, vnc_tls_handshake_io, vs);", " return 0;", " VNC_DEBUG(\"Handshake failed %s\\n\", gnutls_strerror(ret));", " vnc_client_error(vs);", " return -1;", " if (vs->vd->tls.x509verify) {", " if (vnc_tls_validate_certificate(vs) < 0) {", " VNC_DEBUG(\"Client verification failed\\n\");", " vnc_client_error(vs);", " return -1;", " } else {", " VNC_DEBUG(\"Client verification passed\\n\");", " VNC_DEBUG(\"Handshake done, switching to TLS data mode\\n\");", " qemu_set_fd_handler(vs->csock, vnc_client_read, vnc_client_write, vs);", " start_auth_vencrypt_subauth(vs);", " int ret;", " int ret;", " int ret;", " int ret;", " int ret;", " return -1;", " return -1;", " return -1;", " return -1;", " return -1;", " return 0;", " return 0;", " return 0;", " vnc_client_error(vs);", " return -1;", " vnc_client_error(vs);", " return -1;", " vnc_client_error(vs);", " return -1;", " } else {", " return 0;", " return 0;", " return 0;", " if (vs->vd->tls.x509verify) {", " if (vnc_tls_validate_certificate(vs) < 0) {", " VNC_DEBUG(\"Client verification failed\\n\");", " vnc_client_error(vs);", " return -1;", " } else {", " VNC_DEBUG(\"Client verification passed\\n\");", " VNC_DEBUG(\"Handshake done, switching to TLS data mode\\n\");", " } else {", " } else {" ], "line_no": [ 5, 9, 11, 13, 15, 17, 21, 23, 27, 29, 31, 37, 39, 41, 43, 45, 47, 49, 57, 59, 63, 5, 5, 5, 5, 5, 45, 45, 45, 45, 45, 67, 67, 67, 43, 45, 43, 45, 43, 45, 47, 67, 67, 67, 37, 39, 41, 43, 45, 47, 49, 57, 47, 47 ] }
static int FUNC_0(VncState *VAR_0) { int VAR_1; if ((VAR_1 = gnutls_handshake(VAR_0->tls.session)) < 0) { if (!gnutls_error_is_fatal(VAR_1)) { VNC_DEBUG("Handshake interrupted (blocking)\n"); if (!gnutls_record_get_direction(VAR_0->tls.session)) qemu_set_fd_handler(VAR_0->csock, vnc_tls_handshake_io, NULL, VAR_0); else qemu_set_fd_handler(VAR_0->csock, NULL, vnc_tls_handshake_io, VAR_0); return 0; } VNC_DEBUG("Handshake failed %s\n", gnutls_strerror(VAR_1)); vnc_client_error(VAR_0); return -1; } if (VAR_0->vd->tls.x509verify) { if (vnc_tls_validate_certificate(VAR_0) < 0) { VNC_DEBUG("Client verification failed\n"); vnc_client_error(VAR_0); return -1; } else { VNC_DEBUG("Client verification passed\n"); } } VNC_DEBUG("Handshake done, switching to TLS data mode\n"); qemu_set_fd_handler(VAR_0->csock, vnc_client_read, vnc_client_write, VAR_0); start_auth_vencrypt_subauth(VAR_0); return 0; }
[ "static int FUNC_0(VncState *VAR_0)\n{", "int VAR_1;", "if ((VAR_1 = gnutls_handshake(VAR_0->tls.session)) < 0) {", "if (!gnutls_error_is_fatal(VAR_1)) {", "VNC_DEBUG(\"Handshake interrupted (blocking)\\n\");", "if (!gnutls_record_get_direction(VAR_0->tls.session))\nqemu_set_fd_handler(VAR_0->csock, vnc_tls_handshake_io, NULL, VAR_0);", "else\nqemu_set_fd_handler(VAR_0->csock, NULL, vnc_tls_handshake_io, VAR_0);", "return 0;", "}", "VNC_DEBUG(\"Handshake failed %s\\n\", gnutls_strerror(VAR_1));", "vnc_client_error(VAR_0);", "return -1;", "}", "if (VAR_0->vd->tls.x509verify) {", "if (vnc_tls_validate_certificate(VAR_0) < 0) {", "VNC_DEBUG(\"Client verification failed\\n\");", "vnc_client_error(VAR_0);", "return -1;", "} else {", "VNC_DEBUG(\"Client verification passed\\n\");", "}", "}", "VNC_DEBUG(\"Handshake done, switching to TLS data mode\\n\");", "qemu_set_fd_handler(VAR_0->csock, vnc_client_read, vnc_client_write, VAR_0);", "start_auth_vencrypt_subauth(VAR_0);", "return 0;", "}" ]
[ 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15, 17 ], [ 19, 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 63 ], [ 67 ], [ 69 ] ]
10,109
static VirtIOBlockReq *virtio_blk_alloc_request(VirtIOBlock *s) { VirtIOBlockReq *req = g_slice_new(VirtIOBlockReq); req->dev = s; req->qiov.size = 0; req->next = NULL; req->elem = g_slice_new(VirtQueueElement); return req; }
true
qemu
f897bf751fbd95e4015b95d202c706548586813a
static VirtIOBlockReq *virtio_blk_alloc_request(VirtIOBlock *s) { VirtIOBlockReq *req = g_slice_new(VirtIOBlockReq); req->dev = s; req->qiov.size = 0; req->next = NULL; req->elem = g_slice_new(VirtQueueElement); return req; }
{ "code": [ "static VirtIOBlockReq *virtio_blk_alloc_request(VirtIOBlock *s)", " req->elem = g_slice_new(VirtQueueElement);" ], "line_no": [ 1, 13 ] }
static VirtIOBlockReq *FUNC_0(VirtIOBlock *s) { VirtIOBlockReq *req = g_slice_new(VirtIOBlockReq); req->dev = s; req->qiov.size = 0; req->next = NULL; req->elem = g_slice_new(VirtQueueElement); return req; }
[ "static VirtIOBlockReq *FUNC_0(VirtIOBlock *s)\n{", "VirtIOBlockReq *req = g_slice_new(VirtIOBlockReq);", "req->dev = s;", "req->qiov.size = 0;", "req->next = NULL;", "req->elem = g_slice_new(VirtQueueElement);", "return req;", "}" ]
[ 1, 0, 0, 0, 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ] ]
10,111
static int decompress_i(AVCodecContext *avctx, uint32_t *dst, int linesize) { SCPRContext *s = avctx->priv_data; GetByteContext *gb = &s->gb; int cx = 0, cx1 = 0, k = 0, clr = 0; int run, r, g, b, off, y = 0, x = 0, z, ret; unsigned backstep = linesize - avctx->width; const int cxshift = s->cxshift; unsigned lx, ly, ptype; reinit_tables(s); bytestream2_skip(gb, 2); init_rangecoder(&s->rc, gb); while (k < avctx->width + 1) { ret = decode_unit(s, &s->pixel_model[0][cx + cx1], 400, &r); if (ret < 0) return ret; cx1 = (cx << 6) & 0xFC0; cx = r >> cxshift; ret = decode_unit(s, &s->pixel_model[1][cx + cx1], 400, &g); if (ret < 0) return ret; cx1 = (cx << 6) & 0xFC0; cx = g >> cxshift; ret = decode_unit(s, &s->pixel_model[2][cx + cx1], 400, &b); if (ret < 0) return ret; cx1 = (cx << 6) & 0xFC0; cx = b >> cxshift; ret = decode_value(s, s->run_model[0], 256, 400, &run); if (ret < 0) return ret; clr = (b << 16) + (g << 8) + r; k += run; while (run-- > 0) { if (y >= avctx->height) return AVERROR_INVALIDDATA; dst[y * linesize + x] = clr; lx = x; ly = y; x++; if (x >= avctx->width) { x = 0; y++; } } } off = -linesize - 1; ptype = 0; while (x < avctx->width && y < avctx->height) { ret = decode_value(s, s->op_model[ptype], 6, 1000, &ptype); if (ret < 0) return ret; if (ptype == 0) { ret = decode_unit(s, &s->pixel_model[0][cx + cx1], 400, &r); if (ret < 0) return ret; cx1 = (cx << 6) & 0xFC0; cx = r >> cxshift; ret = decode_unit(s, &s->pixel_model[1][cx + cx1], 400, &g); if (ret < 0) return ret; cx1 = (cx << 6) & 0xFC0; cx = g >> cxshift; ret = decode_unit(s, &s->pixel_model[2][cx + cx1], 400, &b); if (ret < 0) return ret; clr = (b << 16) + (g << 8) + r; } if (ptype > 5) return AVERROR_INVALIDDATA; ret = decode_value(s, s->run_model[ptype], 256, 400, &run); if (ret < 0) return ret; switch (ptype) { case 0: while (run-- > 0) { if (y >= avctx->height) return AVERROR_INVALIDDATA; dst[y * linesize + x] = clr; lx = x; ly = y; x++; if (x >= avctx->width) { x = 0; y++; } } break; case 1: while (run-- > 0) { if (y >= avctx->height) return AVERROR_INVALIDDATA; dst[y * linesize + x] = dst[ly * linesize + lx]; lx = x; ly = y; x++; if (x >= avctx->width) { x = 0; y++; } } clr = dst[ly * linesize + lx]; break; case 2: while (run-- > 0) { if (y < 1 || y >= avctx->height) return AVERROR_INVALIDDATA; clr = dst[y * linesize + x + off + 1]; dst[y * linesize + x] = clr; lx = x; ly = y; x++; if (x >= avctx->width) { x = 0; y++; } } break; case 4: while (run-- > 0) { uint8_t *odst = (uint8_t *)dst; if (y < 1 || y >= avctx->height || (y == 1 && x == 0)) return AVERROR_INVALIDDATA; if (x == 0) { z = backstep; } else { z = 0; } r = odst[(ly * linesize + lx) * 4] + odst[((y * linesize + x) + off - z) * 4 + 4] - odst[((y * linesize + x) + off - z) * 4]; g = odst[(ly * linesize + lx) * 4 + 1] + odst[((y * linesize + x) + off - z) * 4 + 5] - odst[((y * linesize + x) + off - z) * 4 + 1]; b = odst[(ly * linesize + lx) * 4 + 2] + odst[((y * linesize + x) + off - z) * 4 + 6] - odst[((y * linesize + x) + off - z) * 4 + 2]; clr = ((b & 0xFF) << 16) + ((g & 0xFF) << 8) + (r & 0xFF); dst[y * linesize + x] = clr; lx = x; ly = y; x++; if (x >= avctx->width) { x = 0; y++; } } break; case 5: while (run-- > 0) { if (y < 1 || y >= avctx->height || (y == 1 && x == 0)) return AVERROR_INVALIDDATA; if (x == 0) { z = backstep; } else { z = 0; } clr = dst[y * linesize + x + off - z]; dst[y * linesize + x] = clr; lx = x; ly = y; x++; if (x >= avctx->width) { x = 0; y++; } } break; } if (avctx->bits_per_coded_sample == 16) { cx1 = (clr & 0x3F00) >> 2; cx = (clr & 0xFFFFFF) >> 16; } else { cx1 = (clr & 0xFC00) >> 4; cx = (clr & 0xFFFFFF) >> 18; } } return 0; }
true
FFmpeg
5666b95c9f27efa6f9b1e1bb6c592b9a8d78bca5
static int decompress_i(AVCodecContext *avctx, uint32_t *dst, int linesize) { SCPRContext *s = avctx->priv_data; GetByteContext *gb = &s->gb; int cx = 0, cx1 = 0, k = 0, clr = 0; int run, r, g, b, off, y = 0, x = 0, z, ret; unsigned backstep = linesize - avctx->width; const int cxshift = s->cxshift; unsigned lx, ly, ptype; reinit_tables(s); bytestream2_skip(gb, 2); init_rangecoder(&s->rc, gb); while (k < avctx->width + 1) { ret = decode_unit(s, &s->pixel_model[0][cx + cx1], 400, &r); if (ret < 0) return ret; cx1 = (cx << 6) & 0xFC0; cx = r >> cxshift; ret = decode_unit(s, &s->pixel_model[1][cx + cx1], 400, &g); if (ret < 0) return ret; cx1 = (cx << 6) & 0xFC0; cx = g >> cxshift; ret = decode_unit(s, &s->pixel_model[2][cx + cx1], 400, &b); if (ret < 0) return ret; cx1 = (cx << 6) & 0xFC0; cx = b >> cxshift; ret = decode_value(s, s->run_model[0], 256, 400, &run); if (ret < 0) return ret; clr = (b << 16) + (g << 8) + r; k += run; while (run-- > 0) { if (y >= avctx->height) return AVERROR_INVALIDDATA; dst[y * linesize + x] = clr; lx = x; ly = y; x++; if (x >= avctx->width) { x = 0; y++; } } } off = -linesize - 1; ptype = 0; while (x < avctx->width && y < avctx->height) { ret = decode_value(s, s->op_model[ptype], 6, 1000, &ptype); if (ret < 0) return ret; if (ptype == 0) { ret = decode_unit(s, &s->pixel_model[0][cx + cx1], 400, &r); if (ret < 0) return ret; cx1 = (cx << 6) & 0xFC0; cx = r >> cxshift; ret = decode_unit(s, &s->pixel_model[1][cx + cx1], 400, &g); if (ret < 0) return ret; cx1 = (cx << 6) & 0xFC0; cx = g >> cxshift; ret = decode_unit(s, &s->pixel_model[2][cx + cx1], 400, &b); if (ret < 0) return ret; clr = (b << 16) + (g << 8) + r; } if (ptype > 5) return AVERROR_INVALIDDATA; ret = decode_value(s, s->run_model[ptype], 256, 400, &run); if (ret < 0) return ret; switch (ptype) { case 0: while (run-- > 0) { if (y >= avctx->height) return AVERROR_INVALIDDATA; dst[y * linesize + x] = clr; lx = x; ly = y; x++; if (x >= avctx->width) { x = 0; y++; } } break; case 1: while (run-- > 0) { if (y >= avctx->height) return AVERROR_INVALIDDATA; dst[y * linesize + x] = dst[ly * linesize + lx]; lx = x; ly = y; x++; if (x >= avctx->width) { x = 0; y++; } } clr = dst[ly * linesize + lx]; break; case 2: while (run-- > 0) { if (y < 1 || y >= avctx->height) return AVERROR_INVALIDDATA; clr = dst[y * linesize + x + off + 1]; dst[y * linesize + x] = clr; lx = x; ly = y; x++; if (x >= avctx->width) { x = 0; y++; } } break; case 4: while (run-- > 0) { uint8_t *odst = (uint8_t *)dst; if (y < 1 || y >= avctx->height || (y == 1 && x == 0)) return AVERROR_INVALIDDATA; if (x == 0) { z = backstep; } else { z = 0; } r = odst[(ly * linesize + lx) * 4] + odst[((y * linesize + x) + off - z) * 4 + 4] - odst[((y * linesize + x) + off - z) * 4]; g = odst[(ly * linesize + lx) * 4 + 1] + odst[((y * linesize + x) + off - z) * 4 + 5] - odst[((y * linesize + x) + off - z) * 4 + 1]; b = odst[(ly * linesize + lx) * 4 + 2] + odst[((y * linesize + x) + off - z) * 4 + 6] - odst[((y * linesize + x) + off - z) * 4 + 2]; clr = ((b & 0xFF) << 16) + ((g & 0xFF) << 8) + (r & 0xFF); dst[y * linesize + x] = clr; lx = x; ly = y; x++; if (x >= avctx->width) { x = 0; y++; } } break; case 5: while (run-- > 0) { if (y < 1 || y >= avctx->height || (y == 1 && x == 0)) return AVERROR_INVALIDDATA; if (x == 0) { z = backstep; } else { z = 0; } clr = dst[y * linesize + x + off - z]; dst[y * linesize + x] = clr; lx = x; ly = y; x++; if (x >= avctx->width) { x = 0; y++; } } break; } if (avctx->bits_per_coded_sample == 16) { cx1 = (clr & 0x3F00) >> 2; cx = (clr & 0xFFFFFF) >> 16; } else { cx1 = (clr & 0xFC00) >> 4; cx = (clr & 0xFFFFFF) >> 18; } } return 0; }
{ "code": [ " cx = (clr & 0xFFFFFF) >> 16;" ], "line_no": [ 391 ] }
static int FUNC_0(AVCodecContext *VAR_0, uint32_t *VAR_1, int VAR_2) { SCPRContext *s = VAR_0->priv_data; GetByteContext *gb = &s->gb; int VAR_3 = 0, VAR_4 = 0, VAR_5 = 0, VAR_6 = 0; int VAR_7, VAR_8, VAR_9, VAR_10, VAR_11, VAR_12 = 0, VAR_13 = 0, VAR_14, VAR_15; unsigned VAR_16 = VAR_2 - VAR_0->width; const int VAR_17 = s->VAR_17; unsigned VAR_18, VAR_19, VAR_20; reinit_tables(s); bytestream2_skip(gb, 2); init_rangecoder(&s->rc, gb); while (VAR_5 < VAR_0->width + 1) { VAR_15 = decode_unit(s, &s->pixel_model[0][VAR_3 + VAR_4], 400, &VAR_8); if (VAR_15 < 0) return VAR_15; VAR_4 = (VAR_3 << 6) & 0xFC0; VAR_3 = VAR_8 >> VAR_17; VAR_15 = decode_unit(s, &s->pixel_model[1][VAR_3 + VAR_4], 400, &VAR_9); if (VAR_15 < 0) return VAR_15; VAR_4 = (VAR_3 << 6) & 0xFC0; VAR_3 = VAR_9 >> VAR_17; VAR_15 = decode_unit(s, &s->pixel_model[2][VAR_3 + VAR_4], 400, &VAR_10); if (VAR_15 < 0) return VAR_15; VAR_4 = (VAR_3 << 6) & 0xFC0; VAR_3 = VAR_10 >> VAR_17; VAR_15 = decode_value(s, s->run_model[0], 256, 400, &VAR_7); if (VAR_15 < 0) return VAR_15; VAR_6 = (VAR_10 << 16) + (VAR_9 << 8) + VAR_8; VAR_5 += VAR_7; while (VAR_7-- > 0) { if (VAR_12 >= VAR_0->height) return AVERROR_INVALIDDATA; VAR_1[VAR_12 * VAR_2 + VAR_13] = VAR_6; VAR_18 = VAR_13; VAR_19 = VAR_12; VAR_13++; if (VAR_13 >= VAR_0->width) { VAR_13 = 0; VAR_12++; } } } VAR_11 = -VAR_2 - 1; VAR_20 = 0; while (VAR_13 < VAR_0->width && VAR_12 < VAR_0->height) { VAR_15 = decode_value(s, s->op_model[VAR_20], 6, 1000, &VAR_20); if (VAR_15 < 0) return VAR_15; if (VAR_20 == 0) { VAR_15 = decode_unit(s, &s->pixel_model[0][VAR_3 + VAR_4], 400, &VAR_8); if (VAR_15 < 0) return VAR_15; VAR_4 = (VAR_3 << 6) & 0xFC0; VAR_3 = VAR_8 >> VAR_17; VAR_15 = decode_unit(s, &s->pixel_model[1][VAR_3 + VAR_4], 400, &VAR_9); if (VAR_15 < 0) return VAR_15; VAR_4 = (VAR_3 << 6) & 0xFC0; VAR_3 = VAR_9 >> VAR_17; VAR_15 = decode_unit(s, &s->pixel_model[2][VAR_3 + VAR_4], 400, &VAR_10); if (VAR_15 < 0) return VAR_15; VAR_6 = (VAR_10 << 16) + (VAR_9 << 8) + VAR_8; } if (VAR_20 > 5) return AVERROR_INVALIDDATA; VAR_15 = decode_value(s, s->run_model[VAR_20], 256, 400, &VAR_7); if (VAR_15 < 0) return VAR_15; switch (VAR_20) { case 0: while (VAR_7-- > 0) { if (VAR_12 >= VAR_0->height) return AVERROR_INVALIDDATA; VAR_1[VAR_12 * VAR_2 + VAR_13] = VAR_6; VAR_18 = VAR_13; VAR_19 = VAR_12; VAR_13++; if (VAR_13 >= VAR_0->width) { VAR_13 = 0; VAR_12++; } } break; case 1: while (VAR_7-- > 0) { if (VAR_12 >= VAR_0->height) return AVERROR_INVALIDDATA; VAR_1[VAR_12 * VAR_2 + VAR_13] = VAR_1[VAR_19 * VAR_2 + VAR_18]; VAR_18 = VAR_13; VAR_19 = VAR_12; VAR_13++; if (VAR_13 >= VAR_0->width) { VAR_13 = 0; VAR_12++; } } VAR_6 = VAR_1[VAR_19 * VAR_2 + VAR_18]; break; case 2: while (VAR_7-- > 0) { if (VAR_12 < 1 || VAR_12 >= VAR_0->height) return AVERROR_INVALIDDATA; VAR_6 = VAR_1[VAR_12 * VAR_2 + VAR_13 + VAR_11 + 1]; VAR_1[VAR_12 * VAR_2 + VAR_13] = VAR_6; VAR_18 = VAR_13; VAR_19 = VAR_12; VAR_13++; if (VAR_13 >= VAR_0->width) { VAR_13 = 0; VAR_12++; } } break; case 4: while (VAR_7-- > 0) { uint8_t *odst = (uint8_t *)VAR_1; if (VAR_12 < 1 || VAR_12 >= VAR_0->height || (VAR_12 == 1 && VAR_13 == 0)) return AVERROR_INVALIDDATA; if (VAR_13 == 0) { VAR_14 = VAR_16; } else { VAR_14 = 0; } VAR_8 = odst[(VAR_19 * VAR_2 + VAR_18) * 4] + odst[((VAR_12 * VAR_2 + VAR_13) + VAR_11 - VAR_14) * 4 + 4] - odst[((VAR_12 * VAR_2 + VAR_13) + VAR_11 - VAR_14) * 4]; VAR_9 = odst[(VAR_19 * VAR_2 + VAR_18) * 4 + 1] + odst[((VAR_12 * VAR_2 + VAR_13) + VAR_11 - VAR_14) * 4 + 5] - odst[((VAR_12 * VAR_2 + VAR_13) + VAR_11 - VAR_14) * 4 + 1]; VAR_10 = odst[(VAR_19 * VAR_2 + VAR_18) * 4 + 2] + odst[((VAR_12 * VAR_2 + VAR_13) + VAR_11 - VAR_14) * 4 + 6] - odst[((VAR_12 * VAR_2 + VAR_13) + VAR_11 - VAR_14) * 4 + 2]; VAR_6 = ((VAR_10 & 0xFF) << 16) + ((VAR_9 & 0xFF) << 8) + (VAR_8 & 0xFF); VAR_1[VAR_12 * VAR_2 + VAR_13] = VAR_6; VAR_18 = VAR_13; VAR_19 = VAR_12; VAR_13++; if (VAR_13 >= VAR_0->width) { VAR_13 = 0; VAR_12++; } } break; case 5: while (VAR_7-- > 0) { if (VAR_12 < 1 || VAR_12 >= VAR_0->height || (VAR_12 == 1 && VAR_13 == 0)) return AVERROR_INVALIDDATA; if (VAR_13 == 0) { VAR_14 = VAR_16; } else { VAR_14 = 0; } VAR_6 = VAR_1[VAR_12 * VAR_2 + VAR_13 + VAR_11 - VAR_14]; VAR_1[VAR_12 * VAR_2 + VAR_13] = VAR_6; VAR_18 = VAR_13; VAR_19 = VAR_12; VAR_13++; if (VAR_13 >= VAR_0->width) { VAR_13 = 0; VAR_12++; } } break; } if (VAR_0->bits_per_coded_sample == 16) { VAR_4 = (VAR_6 & 0x3F00) >> 2; VAR_3 = (VAR_6 & 0xFFFFFF) >> 16; } else { VAR_4 = (VAR_6 & 0xFC00) >> 4; VAR_3 = (VAR_6 & 0xFFFFFF) >> 18; } } return 0; }
[ "static int FUNC_0(AVCodecContext *VAR_0, uint32_t *VAR_1, int VAR_2)\n{", "SCPRContext *s = VAR_0->priv_data;", "GetByteContext *gb = &s->gb;", "int VAR_3 = 0, VAR_4 = 0, VAR_5 = 0, VAR_6 = 0;", "int VAR_7, VAR_8, VAR_9, VAR_10, VAR_11, VAR_12 = 0, VAR_13 = 0, VAR_14, VAR_15;", "unsigned VAR_16 = VAR_2 - VAR_0->width;", "const int VAR_17 = s->VAR_17;", "unsigned VAR_18, VAR_19, VAR_20;", "reinit_tables(s);", "bytestream2_skip(gb, 2);", "init_rangecoder(&s->rc, gb);", "while (VAR_5 < VAR_0->width + 1) {", "VAR_15 = decode_unit(s, &s->pixel_model[0][VAR_3 + VAR_4], 400, &VAR_8);", "if (VAR_15 < 0)\nreturn VAR_15;", "VAR_4 = (VAR_3 << 6) & 0xFC0;", "VAR_3 = VAR_8 >> VAR_17;", "VAR_15 = decode_unit(s, &s->pixel_model[1][VAR_3 + VAR_4], 400, &VAR_9);", "if (VAR_15 < 0)\nreturn VAR_15;", "VAR_4 = (VAR_3 << 6) & 0xFC0;", "VAR_3 = VAR_9 >> VAR_17;", "VAR_15 = decode_unit(s, &s->pixel_model[2][VAR_3 + VAR_4], 400, &VAR_10);", "if (VAR_15 < 0)\nreturn VAR_15;", "VAR_4 = (VAR_3 << 6) & 0xFC0;", "VAR_3 = VAR_10 >> VAR_17;", "VAR_15 = decode_value(s, s->run_model[0], 256, 400, &VAR_7);", "if (VAR_15 < 0)\nreturn VAR_15;", "VAR_6 = (VAR_10 << 16) + (VAR_9 << 8) + VAR_8;", "VAR_5 += VAR_7;", "while (VAR_7-- > 0) {", "if (VAR_12 >= VAR_0->height)\nreturn AVERROR_INVALIDDATA;", "VAR_1[VAR_12 * VAR_2 + VAR_13] = VAR_6;", "VAR_18 = VAR_13;", "VAR_19 = VAR_12;", "VAR_13++;", "if (VAR_13 >= VAR_0->width) {", "VAR_13 = 0;", "VAR_12++;", "}", "}", "}", "VAR_11 = -VAR_2 - 1;", "VAR_20 = 0;", "while (VAR_13 < VAR_0->width && VAR_12 < VAR_0->height) {", "VAR_15 = decode_value(s, s->op_model[VAR_20], 6, 1000, &VAR_20);", "if (VAR_15 < 0)\nreturn VAR_15;", "if (VAR_20 == 0) {", "VAR_15 = decode_unit(s, &s->pixel_model[0][VAR_3 + VAR_4], 400, &VAR_8);", "if (VAR_15 < 0)\nreturn VAR_15;", "VAR_4 = (VAR_3 << 6) & 0xFC0;", "VAR_3 = VAR_8 >> VAR_17;", "VAR_15 = decode_unit(s, &s->pixel_model[1][VAR_3 + VAR_4], 400, &VAR_9);", "if (VAR_15 < 0)\nreturn VAR_15;", "VAR_4 = (VAR_3 << 6) & 0xFC0;", "VAR_3 = VAR_9 >> VAR_17;", "VAR_15 = decode_unit(s, &s->pixel_model[2][VAR_3 + VAR_4], 400, &VAR_10);", "if (VAR_15 < 0)\nreturn VAR_15;", "VAR_6 = (VAR_10 << 16) + (VAR_9 << 8) + VAR_8;", "}", "if (VAR_20 > 5)\nreturn AVERROR_INVALIDDATA;", "VAR_15 = decode_value(s, s->run_model[VAR_20], 256, 400, &VAR_7);", "if (VAR_15 < 0)\nreturn VAR_15;", "switch (VAR_20) {", "case 0:\nwhile (VAR_7-- > 0) {", "if (VAR_12 >= VAR_0->height)\nreturn AVERROR_INVALIDDATA;", "VAR_1[VAR_12 * VAR_2 + VAR_13] = VAR_6;", "VAR_18 = VAR_13;", "VAR_19 = VAR_12;", "VAR_13++;", "if (VAR_13 >= VAR_0->width) {", "VAR_13 = 0;", "VAR_12++;", "}", "}", "break;", "case 1:\nwhile (VAR_7-- > 0) {", "if (VAR_12 >= VAR_0->height)\nreturn AVERROR_INVALIDDATA;", "VAR_1[VAR_12 * VAR_2 + VAR_13] = VAR_1[VAR_19 * VAR_2 + VAR_18];", "VAR_18 = VAR_13;", "VAR_19 = VAR_12;", "VAR_13++;", "if (VAR_13 >= VAR_0->width) {", "VAR_13 = 0;", "VAR_12++;", "}", "}", "VAR_6 = VAR_1[VAR_19 * VAR_2 + VAR_18];", "break;", "case 2:\nwhile (VAR_7-- > 0) {", "if (VAR_12 < 1 || VAR_12 >= VAR_0->height)\nreturn AVERROR_INVALIDDATA;", "VAR_6 = VAR_1[VAR_12 * VAR_2 + VAR_13 + VAR_11 + 1];", "VAR_1[VAR_12 * VAR_2 + VAR_13] = VAR_6;", "VAR_18 = VAR_13;", "VAR_19 = VAR_12;", "VAR_13++;", "if (VAR_13 >= VAR_0->width) {", "VAR_13 = 0;", "VAR_12++;", "}", "}", "break;", "case 4:\nwhile (VAR_7-- > 0) {", "uint8_t *odst = (uint8_t *)VAR_1;", "if (VAR_12 < 1 || VAR_12 >= VAR_0->height ||\n(VAR_12 == 1 && VAR_13 == 0))\nreturn AVERROR_INVALIDDATA;", "if (VAR_13 == 0) {", "VAR_14 = VAR_16;", "} else {", "VAR_14 = 0;", "}", "VAR_8 = odst[(VAR_19 * VAR_2 + VAR_18) * 4] +\nodst[((VAR_12 * VAR_2 + VAR_13) + VAR_11 - VAR_14) * 4 + 4] -\nodst[((VAR_12 * VAR_2 + VAR_13) + VAR_11 - VAR_14) * 4];", "VAR_9 = odst[(VAR_19 * VAR_2 + VAR_18) * 4 + 1] +\nodst[((VAR_12 * VAR_2 + VAR_13) + VAR_11 - VAR_14) * 4 + 5] -\nodst[((VAR_12 * VAR_2 + VAR_13) + VAR_11 - VAR_14) * 4 + 1];", "VAR_10 = odst[(VAR_19 * VAR_2 + VAR_18) * 4 + 2] +\nodst[((VAR_12 * VAR_2 + VAR_13) + VAR_11 - VAR_14) * 4 + 6] -\nodst[((VAR_12 * VAR_2 + VAR_13) + VAR_11 - VAR_14) * 4 + 2];", "VAR_6 = ((VAR_10 & 0xFF) << 16) + ((VAR_9 & 0xFF) << 8) + (VAR_8 & 0xFF);", "VAR_1[VAR_12 * VAR_2 + VAR_13] = VAR_6;", "VAR_18 = VAR_13;", "VAR_19 = VAR_12;", "VAR_13++;", "if (VAR_13 >= VAR_0->width) {", "VAR_13 = 0;", "VAR_12++;", "}", "}", "break;", "case 5:\nwhile (VAR_7-- > 0) {", "if (VAR_12 < 1 || VAR_12 >= VAR_0->height ||\n(VAR_12 == 1 && VAR_13 == 0))\nreturn AVERROR_INVALIDDATA;", "if (VAR_13 == 0) {", "VAR_14 = VAR_16;", "} else {", "VAR_14 = 0;", "}", "VAR_6 = VAR_1[VAR_12 * VAR_2 + VAR_13 + VAR_11 - VAR_14];", "VAR_1[VAR_12 * VAR_2 + VAR_13] = VAR_6;", "VAR_18 = VAR_13;", "VAR_19 = VAR_12;", "VAR_13++;", "if (VAR_13 >= VAR_0->width) {", "VAR_13 = 0;", "VAR_12++;", "}", "}", "break;", "}", "if (VAR_0->bits_per_coded_sample == 16) {", "VAR_4 = (VAR_6 & 0x3F00) >> 2;", "VAR_3 = (VAR_6 & 0xFFFFFF) >> 16;", "} else {", "VAR_4 = (VAR_6 & 0xFC00) >> 4;", "VAR_3 = (VAR_6 & 0xFFFFFF) >> 18;", "}", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33, 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45, 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57, 59 ], [ 63 ], [ 65 ], [ 69 ], [ 71, 73 ], [ 77 ], [ 79 ], [ 81 ], [ 83, 85 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 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 ], [ 157 ], [ 159 ], [ 161, 163 ], [ 165 ], [ 167, 169 ], [ 173 ], [ 175, 177 ], [ 179, 181 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205, 207 ], [ 209, 211 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237, 239 ], [ 241, 243 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269, 271 ], [ 273 ], [ 277, 279, 281 ], [ 285 ], [ 287 ], [ 289 ], [ 291 ], [ 293 ], [ 297, 299, 301 ], [ 303, 305, 307 ], [ 309, 311, 313 ], [ 315 ], [ 317 ], [ 319 ], [ 321 ], [ 323 ], [ 325 ], [ 327 ], [ 329 ], [ 331 ], [ 333 ], [ 335 ], [ 337, 339 ], [ 341, 343, 345 ], [ 349 ], [ 351 ], [ 353 ], [ 355 ], [ 357 ], [ 361 ], [ 363 ], [ 365 ], [ 367 ], [ 369 ], [ 371 ], [ 373 ], [ 375 ], [ 377 ], [ 379 ], [ 381 ], [ 383 ], [ 387 ], [ 389 ], [ 391 ], [ 393 ], [ 395 ], [ 397 ], [ 399 ], [ 401 ], [ 405 ], [ 407 ] ]
10,112
static int scale_vector(int16_t *vector, int length) { int bits, max = 0; int64_t scale; int i; for (i = 0; i < length; i++) max = FFMAX(max, FFABS(vector[i])); max = FFMIN(max, 0x7FFF); bits = normalize_bits(max, 15); scale = (bits == 15) ? 0x7FFF : (1 << bits); for (i = 0; i < length; i++) vector[i] = av_clipl_int32(vector[i] * scale << 1) >> 4; return bits - 3; }
true
FFmpeg
4aca716a531b0bc1f05c96209cf30577d6e48baa
static int scale_vector(int16_t *vector, int length) { int bits, max = 0; int64_t scale; int i; for (i = 0; i < length; i++) max = FFMAX(max, FFABS(vector[i])); max = FFMIN(max, 0x7FFF); bits = normalize_bits(max, 15); scale = (bits == 15) ? 0x7FFF : (1 << bits); for (i = 0; i < length; i++) vector[i] = av_clipl_int32(vector[i] * scale << 1) >> 4; return bits - 3; }
{ "code": [ " int64_t scale;", " max = FFMAX(max, FFABS(vector[i]));", " scale = (bits == 15) ? 0x7FFF : (1 << bits);", " for (i = 0; i < length; i++)", " vector[i] = av_clipl_int32(vector[i] * scale << 1) >> 4;" ], "line_no": [ 7, 17, 25, 15, 31 ] }
static int FUNC_0(int16_t *VAR_0, int VAR_1) { int VAR_2, VAR_3 = 0; int64_t scale; int VAR_4; for (VAR_4 = 0; VAR_4 < VAR_1; VAR_4++) VAR_3 = FFMAX(VAR_3, FFABS(VAR_0[VAR_4])); VAR_3 = FFMIN(VAR_3, 0x7FFF); VAR_2 = normalize_bits(VAR_3, 15); scale = (VAR_2 == 15) ? 0x7FFF : (1 << VAR_2); for (VAR_4 = 0; VAR_4 < VAR_1; VAR_4++) VAR_0[VAR_4] = av_clipl_int32(VAR_0[VAR_4] * scale << 1) >> 4; return VAR_2 - 3; }
[ "static int FUNC_0(int16_t *VAR_0, int VAR_1)\n{", "int VAR_2, VAR_3 = 0;", "int64_t scale;", "int VAR_4;", "for (VAR_4 = 0; VAR_4 < VAR_1; VAR_4++)", "VAR_3 = FFMAX(VAR_3, FFABS(VAR_0[VAR_4]));", "VAR_3 = FFMIN(VAR_3, 0x7FFF);", "VAR_2 = normalize_bits(VAR_3, 15);", "scale = (VAR_2 == 15) ? 0x7FFF : (1 << VAR_2);", "for (VAR_4 = 0; VAR_4 < VAR_1; VAR_4++)", "VAR_0[VAR_4] = av_clipl_int32(VAR_0[VAR_4] * scale << 1) >> 4;", "return VAR_2 - 3;", "}" ]
[ 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ] ]
10,113
static int fileTest(uint8_t *ref[4], int refStride[4], int w, int h, FILE *fp, enum AVPixelFormat srcFormat_in, enum AVPixelFormat dstFormat_in) { char buf[256]; while (fgets(buf, sizeof(buf), fp)) { struct Results r; enum AVPixelFormat srcFormat; char srcStr[12]; int srcW, srcH; enum AVPixelFormat dstFormat; char dstStr[12]; int dstW, dstH; int flags; int ret; ret = sscanf(buf, " %12s %dx%d -> %12s %dx%d flags=%d CRC=%x" " SSD=%"SCNu64 ", %"SCNu64 ", %"SCNu64 ", %"SCNu64 "\n", srcStr, &srcW, &srcH, dstStr, &dstW, &dstH, &flags, &r.crc, &r.ssdY, &r.ssdU, &r.ssdV, &r.ssdA); if (ret != 12) { srcStr[0] = dstStr[0] = 0; ret = sscanf(buf, "%12s -> %12s\n", srcStr, dstStr); } srcFormat = av_get_pix_fmt(srcStr); dstFormat = av_get_pix_fmt(dstStr); if (srcFormat == AV_PIX_FMT_NONE || dstFormat == AV_PIX_FMT_NONE || srcW > 8192U || srcH > 8192U || dstW > 8192U || dstH > 8192U) { fprintf(stderr, "malformed input file\n"); return -1; } if ((srcFormat_in != AV_PIX_FMT_NONE && srcFormat_in != srcFormat) || (dstFormat_in != AV_PIX_FMT_NONE && dstFormat_in != dstFormat)) continue; if (ret != 12) { printf("%s", buf); continue; } doTest(ref, refStride, w, h, srcFormat, dstFormat, srcW, srcH, dstW, dstH, flags, &r); } return 0; }
true
FFmpeg
7796f290653349a4126f2d448d11bb4440b9f257
static int fileTest(uint8_t *ref[4], int refStride[4], int w, int h, FILE *fp, enum AVPixelFormat srcFormat_in, enum AVPixelFormat dstFormat_in) { char buf[256]; while (fgets(buf, sizeof(buf), fp)) { struct Results r; enum AVPixelFormat srcFormat; char srcStr[12]; int srcW, srcH; enum AVPixelFormat dstFormat; char dstStr[12]; int dstW, dstH; int flags; int ret; ret = sscanf(buf, " %12s %dx%d -> %12s %dx%d flags=%d CRC=%x" " SSD=%"SCNu64 ", %"SCNu64 ", %"SCNu64 ", %"SCNu64 "\n", srcStr, &srcW, &srcH, dstStr, &dstW, &dstH, &flags, &r.crc, &r.ssdY, &r.ssdU, &r.ssdV, &r.ssdA); if (ret != 12) { srcStr[0] = dstStr[0] = 0; ret = sscanf(buf, "%12s -> %12s\n", srcStr, dstStr); } srcFormat = av_get_pix_fmt(srcStr); dstFormat = av_get_pix_fmt(dstStr); if (srcFormat == AV_PIX_FMT_NONE || dstFormat == AV_PIX_FMT_NONE || srcW > 8192U || srcH > 8192U || dstW > 8192U || dstH > 8192U) { fprintf(stderr, "malformed input file\n"); return -1; } if ((srcFormat_in != AV_PIX_FMT_NONE && srcFormat_in != srcFormat) || (dstFormat_in != AV_PIX_FMT_NONE && dstFormat_in != dstFormat)) continue; if (ret != 12) { printf("%s", buf); continue; } doTest(ref, refStride, w, h, srcFormat, dstFormat, srcW, srcH, dstW, dstH, flags, &r); } return 0; }
{ "code": [ " int srcW, srcH;", " int dstW, dstH;" ], "line_no": [ 21, 27 ] }
static int FUNC_0(uint8_t *VAR_0[4], int VAR_1[4], int VAR_2, int VAR_3, FILE *VAR_4, enum AVPixelFormat VAR_5, enum AVPixelFormat VAR_6) { char VAR_7[256]; while (fgets(VAR_7, sizeof(VAR_7), VAR_4)) { struct Results VAR_8; enum AVPixelFormat VAR_9; char VAR_10[12]; int VAR_11, VAR_12; enum AVPixelFormat VAR_13; char VAR_14[12]; int VAR_15, VAR_16; int VAR_17; int VAR_18; VAR_18 = sscanf(VAR_7, " %12s %dx%d -> %12s %dx%d VAR_17=%d CRC=%x" " SSD=%"SCNu64 ", %"SCNu64 ", %"SCNu64 ", %"SCNu64 "\n", VAR_10, &VAR_11, &VAR_12, VAR_14, &VAR_15, &VAR_16, &VAR_17, &VAR_8.crc, &VAR_8.ssdY, &VAR_8.ssdU, &VAR_8.ssdV, &VAR_8.ssdA); if (VAR_18 != 12) { VAR_10[0] = VAR_14[0] = 0; VAR_18 = sscanf(VAR_7, "%12s -> %12s\n", VAR_10, VAR_14); } VAR_9 = av_get_pix_fmt(VAR_10); VAR_13 = av_get_pix_fmt(VAR_14); if (VAR_9 == AV_PIX_FMT_NONE || VAR_13 == AV_PIX_FMT_NONE || VAR_11 > 8192U || VAR_12 > 8192U || VAR_15 > 8192U || VAR_16 > 8192U) { fprintf(stderr, "malformed input file\n"); return -1; } if ((VAR_5 != AV_PIX_FMT_NONE && VAR_5 != VAR_9) || (VAR_6 != AV_PIX_FMT_NONE && VAR_6 != VAR_13)) continue; if (VAR_18 != 12) { printf("%s", VAR_7); continue; } doTest(VAR_0, VAR_1, VAR_2, VAR_3, VAR_9, VAR_13, VAR_11, VAR_12, VAR_15, VAR_16, VAR_17, &VAR_8); } return 0; }
[ "static int FUNC_0(uint8_t *VAR_0[4], int VAR_1[4], int VAR_2, int VAR_3, FILE *VAR_4,\nenum AVPixelFormat VAR_5,\nenum AVPixelFormat VAR_6)\n{", "char VAR_7[256];", "while (fgets(VAR_7, sizeof(VAR_7), VAR_4)) {", "struct Results VAR_8;", "enum AVPixelFormat VAR_9;", "char VAR_10[12];", "int VAR_11, VAR_12;", "enum AVPixelFormat VAR_13;", "char VAR_14[12];", "int VAR_15, VAR_16;", "int VAR_17;", "int VAR_18;", "VAR_18 = sscanf(VAR_7,\n\" %12s %dx%d -> %12s %dx%d VAR_17=%d CRC=%x\"\n\" SSD=%\"SCNu64 \", %\"SCNu64 \", %\"SCNu64 \", %\"SCNu64 \"\\n\",\nVAR_10, &VAR_11, &VAR_12, VAR_14, &VAR_15, &VAR_16,\n&VAR_17, &VAR_8.crc, &VAR_8.ssdY, &VAR_8.ssdU, &VAR_8.ssdV, &VAR_8.ssdA);", "if (VAR_18 != 12) {", "VAR_10[0] = VAR_14[0] = 0;", "VAR_18 = sscanf(VAR_7, \"%12s -> %12s\\n\", VAR_10, VAR_14);", "}", "VAR_9 = av_get_pix_fmt(VAR_10);", "VAR_13 = av_get_pix_fmt(VAR_14);", "if (VAR_9 == AV_PIX_FMT_NONE || VAR_13 == AV_PIX_FMT_NONE ||\nVAR_11 > 8192U || VAR_12 > 8192U || VAR_15 > 8192U || VAR_16 > 8192U) {", "fprintf(stderr, \"malformed input file\\n\");", "return -1;", "}", "if ((VAR_5 != AV_PIX_FMT_NONE && VAR_5 != VAR_9) ||\n(VAR_6 != AV_PIX_FMT_NONE && VAR_6 != VAR_13))\ncontinue;", "if (VAR_18 != 12) {", "printf(\"%s\", VAR_7);", "continue;", "}", "doTest(VAR_0, VAR_1, VAR_2, VAR_3,\nVAR_9, VAR_13,\nVAR_11, VAR_12, VAR_15, VAR_16, VAR_17,\n&VAR_8);", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35, 37, 39, 41, 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 61, 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71, 73, 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 87, 89, 91, 93 ], [ 95 ], [ 99 ], [ 101 ] ]
10,114
static int lut2_config_output(AVFilterLink *outlink) { AVFilterContext *ctx = outlink->src; LUT2Context *s = ctx->priv; AVFilterLink *srcx = ctx->inputs[0]; AVFilterLink *srcy = ctx->inputs[1]; FFFrameSyncIn *in; int ret; if (srcx->format != srcy->format) { av_log(ctx, AV_LOG_ERROR, "inputs must be of same pixel format\n"); return AVERROR(EINVAL); } if (srcx->w != srcy->w || srcx->h != srcy->h || srcx->sample_aspect_ratio.num != srcy->sample_aspect_ratio.num || srcx->sample_aspect_ratio.den != srcy->sample_aspect_ratio.den) { av_log(ctx, AV_LOG_ERROR, "First input link %s parameters " "(size %dx%d, SAR %d:%d) do not match the corresponding " "second input link %s parameters (%dx%d, SAR %d:%d)\n", ctx->input_pads[0].name, srcx->w, srcx->h, srcx->sample_aspect_ratio.num, srcx->sample_aspect_ratio.den, ctx->input_pads[1].name, srcy->w, srcy->h, srcy->sample_aspect_ratio.num, srcy->sample_aspect_ratio.den); return AVERROR(EINVAL); } outlink->w = srcx->w; outlink->h = srcx->h; outlink->time_base = srcx->time_base; outlink->sample_aspect_ratio = srcx->sample_aspect_ratio; outlink->frame_rate = srcx->frame_rate; if ((ret = ff_framesync2_init(&s->fs, ctx, 2)) < 0) return ret; in = s->fs.in; in[0].time_base = srcx->time_base; in[1].time_base = srcy->time_base; in[0].sync = 1; in[0].before = EXT_STOP; in[0].after = EXT_INFINITY; in[1].sync = 1; in[1].before = EXT_STOP; in[1].after = EXT_INFINITY; s->fs.opaque = s; s->fs.on_event = process_frame; if ((ret = config_output(outlink)) < 0) return ret; return ff_framesync2_configure(&s->fs); }
true
FFmpeg
a4d18a3f54e5b0277234d8fcff65dff8516417a0
static int lut2_config_output(AVFilterLink *outlink) { AVFilterContext *ctx = outlink->src; LUT2Context *s = ctx->priv; AVFilterLink *srcx = ctx->inputs[0]; AVFilterLink *srcy = ctx->inputs[1]; FFFrameSyncIn *in; int ret; if (srcx->format != srcy->format) { av_log(ctx, AV_LOG_ERROR, "inputs must be of same pixel format\n"); return AVERROR(EINVAL); } if (srcx->w != srcy->w || srcx->h != srcy->h || srcx->sample_aspect_ratio.num != srcy->sample_aspect_ratio.num || srcx->sample_aspect_ratio.den != srcy->sample_aspect_ratio.den) { av_log(ctx, AV_LOG_ERROR, "First input link %s parameters " "(size %dx%d, SAR %d:%d) do not match the corresponding " "second input link %s parameters (%dx%d, SAR %d:%d)\n", ctx->input_pads[0].name, srcx->w, srcx->h, srcx->sample_aspect_ratio.num, srcx->sample_aspect_ratio.den, ctx->input_pads[1].name, srcy->w, srcy->h, srcy->sample_aspect_ratio.num, srcy->sample_aspect_ratio.den); return AVERROR(EINVAL); } outlink->w = srcx->w; outlink->h = srcx->h; outlink->time_base = srcx->time_base; outlink->sample_aspect_ratio = srcx->sample_aspect_ratio; outlink->frame_rate = srcx->frame_rate; if ((ret = ff_framesync2_init(&s->fs, ctx, 2)) < 0) return ret; in = s->fs.in; in[0].time_base = srcx->time_base; in[1].time_base = srcy->time_base; in[0].sync = 1; in[0].before = EXT_STOP; in[0].after = EXT_INFINITY; in[1].sync = 1; in[1].before = EXT_STOP; in[1].after = EXT_INFINITY; s->fs.opaque = s; s->fs.on_event = process_frame; if ((ret = config_output(outlink)) < 0) return ret; return ff_framesync2_configure(&s->fs); }
{ "code": [ " in[0].sync = 1;" ], "line_no": [ 85 ] }
static int FUNC_0(AVFilterLink *VAR_0) { AVFilterContext *ctx = VAR_0->src; LUT2Context *s = ctx->priv; AVFilterLink *srcx = ctx->inputs[0]; AVFilterLink *srcy = ctx->inputs[1]; FFFrameSyncIn *in; int VAR_1; if (srcx->format != srcy->format) { av_log(ctx, AV_LOG_ERROR, "inputs must be of same pixel format\n"); return AVERROR(EINVAL); } if (srcx->w != srcy->w || srcx->h != srcy->h || srcx->sample_aspect_ratio.num != srcy->sample_aspect_ratio.num || srcx->sample_aspect_ratio.den != srcy->sample_aspect_ratio.den) { av_log(ctx, AV_LOG_ERROR, "First input link %s parameters " "(size %dx%d, SAR %d:%d) do not match the corresponding " "second input link %s parameters (%dx%d, SAR %d:%d)\n", ctx->input_pads[0].name, srcx->w, srcx->h, srcx->sample_aspect_ratio.num, srcx->sample_aspect_ratio.den, ctx->input_pads[1].name, srcy->w, srcy->h, srcy->sample_aspect_ratio.num, srcy->sample_aspect_ratio.den); return AVERROR(EINVAL); } VAR_0->w = srcx->w; VAR_0->h = srcx->h; VAR_0->time_base = srcx->time_base; VAR_0->sample_aspect_ratio = srcx->sample_aspect_ratio; VAR_0->frame_rate = srcx->frame_rate; if ((VAR_1 = ff_framesync2_init(&s->fs, ctx, 2)) < 0) return VAR_1; in = s->fs.in; in[0].time_base = srcx->time_base; in[1].time_base = srcy->time_base; in[0].sync = 1; in[0].before = EXT_STOP; in[0].after = EXT_INFINITY; in[1].sync = 1; in[1].before = EXT_STOP; in[1].after = EXT_INFINITY; s->fs.opaque = s; s->fs.on_event = process_frame; if ((VAR_1 = config_output(VAR_0)) < 0) return VAR_1; return ff_framesync2_configure(&s->fs); }
[ "static int FUNC_0(AVFilterLink *VAR_0)\n{", "AVFilterContext *ctx = VAR_0->src;", "LUT2Context *s = ctx->priv;", "AVFilterLink *srcx = ctx->inputs[0];", "AVFilterLink *srcy = ctx->inputs[1];", "FFFrameSyncIn *in;", "int VAR_1;", "if (srcx->format != srcy->format) {", "av_log(ctx, AV_LOG_ERROR, \"inputs must be of same pixel format\\n\");", "return AVERROR(EINVAL);", "}", "if (srcx->w != srcy->w ||\nsrcx->h != srcy->h ||\nsrcx->sample_aspect_ratio.num != srcy->sample_aspect_ratio.num ||\nsrcx->sample_aspect_ratio.den != srcy->sample_aspect_ratio.den) {", "av_log(ctx, AV_LOG_ERROR, \"First input link %s parameters \"\n\"(size %dx%d, SAR %d:%d) do not match the corresponding \"\n\"second input link %s parameters (%dx%d, SAR %d:%d)\\n\",\nctx->input_pads[0].name, srcx->w, srcx->h,\nsrcx->sample_aspect_ratio.num,\nsrcx->sample_aspect_ratio.den,\nctx->input_pads[1].name,\nsrcy->w, srcy->h,\nsrcy->sample_aspect_ratio.num,\nsrcy->sample_aspect_ratio.den);", "return AVERROR(EINVAL);", "}", "VAR_0->w = srcx->w;", "VAR_0->h = srcx->h;", "VAR_0->time_base = srcx->time_base;", "VAR_0->sample_aspect_ratio = srcx->sample_aspect_ratio;", "VAR_0->frame_rate = srcx->frame_rate;", "if ((VAR_1 = ff_framesync2_init(&s->fs, ctx, 2)) < 0)\nreturn VAR_1;", "in = s->fs.in;", "in[0].time_base = srcx->time_base;", "in[1].time_base = srcy->time_base;", "in[0].sync = 1;", "in[0].before = EXT_STOP;", "in[0].after = EXT_INFINITY;", "in[1].sync = 1;", "in[1].before = EXT_STOP;", "in[1].after = EXT_INFINITY;", "s->fs.opaque = s;", "s->fs.on_event = process_frame;", "if ((VAR_1 = config_output(VAR_0)) < 0)\nreturn VAR_1;", "return ff_framesync2_configure(&s->fs);", "}" ]
[ 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27, 29, 31, 33 ], [ 35, 37, 39, 41, 43, 45, 47, 49, 51, 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 73, 75 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 103, 105 ], [ 109 ], [ 111 ] ]
10,116
void do_subfe (void) { T0 = T1 + ~T0 + xer_ca; if (likely(T0 >= T1 && (xer_ca == 0 || T0 != T1))) { xer_ca = 0; } else { xer_ca = 1; } }
true
qemu
d9bce9d99f4656ae0b0127f7472db9067b8f84ab
void do_subfe (void) { T0 = T1 + ~T0 + xer_ca; if (likely(T0 >= T1 && (xer_ca == 0 || T0 != T1))) { xer_ca = 0; } else { xer_ca = 1; } }
{ "code": [ " xer_ca = 1;", " } else {", " xer_ca = 0;", " xer_ca = 1;", " } else {", " xer_ca = 0;", " xer_ca = 1;", " } else {", " } else {", " xer_ca = 0;", " } else {", " xer_ca = 1;", " } else {", " } else {", " xer_ca = 0;", " } else {", " xer_ca = 0;", " } else {", " xer_ca = 1;", " if (likely(T0 >= T1 && (xer_ca == 0 || T0 != T1))) {", " if (likely(T0 >= T1 && (xer_ca == 0 || T0 != T1))) {", " xer_ca = 0;", " } else {" ], "line_no": [ 13, 11, 9, 13, 11, 9, 13, 11, 11, 9, 11, 13, 11, 11, 9, 11, 9, 11, 13, 7, 7, 9, 11 ] }
void FUNC_0 (void) { T0 = T1 + ~T0 + xer_ca; if (likely(T0 >= T1 && (xer_ca == 0 || T0 != T1))) { xer_ca = 0; } else { xer_ca = 1; } }
[ "void FUNC_0 (void)\n{", "T0 = T1 + ~T0 + xer_ca;", "if (likely(T0 >= T1 && (xer_ca == 0 || T0 != T1))) {", "xer_ca = 0;", "} else {", "xer_ca = 1;", "}", "}" ]
[ 0, 0, 1, 1, 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ] ]
10,117
static inline void unpack_coeffs(SnowContext *s, SubBand *b, SubBand * parent, int orientation){ const int w= b->width; const int h= b->height; int x,y; if(1){ int run; x_and_coeff *xc= b->x_coeff; x_and_coeff *prev_xc= NULL; x_and_coeff *prev2_xc= xc; x_and_coeff *parent_xc= parent ? parent->x_coeff : NULL; x_and_coeff *prev_parent_xc= parent_xc; run= get_symbol2(&s->c, b->state[1], 3); for(y=0; y<h; y++){ int v=0; int lt=0, t=0, rt=0; if(y && prev_xc->x == 0){ rt= prev_xc->coeff; } for(x=0; x<w; x++){ int p=0; const int l= v; lt= t; t= rt; if(y){ if(prev_xc->x <= x) prev_xc++; if(prev_xc->x == x + 1) rt= prev_xc->coeff; else rt=0; } if(parent_xc){ if(x>>1 > parent_xc->x){ parent_xc++; } if(x>>1 == parent_xc->x){ p= parent_xc->coeff; } } if(/*ll|*/l|lt|t|rt|p){ int context= av_log2(/*ABS(ll) + */3*(l>>1) + (lt>>1) + (t&~1) + (rt>>1) + (p>>1)); v=get_rac(&s->c, &b->state[0][context]); if(v){ v= 2*(get_symbol2(&s->c, b->state[context + 2], context-4) + 1); v+=get_rac(&s->c, &b->state[0][16 + 1 + 3 + quant3bA[l&0xFF] + 3*quant3bA[t&0xFF]]); xc->x=x; (xc++)->coeff= v; } }else{ if(!run){ run= get_symbol2(&s->c, b->state[1], 3); v= 2*(get_symbol2(&s->c, b->state[0 + 2], 0-4) + 1); v+=get_rac(&s->c, &b->state[0][16 + 1 + 3]); xc->x=x; (xc++)->coeff= v; }else{ int max_run; run--; v=0; if(y) max_run= FFMIN(run, prev_xc->x - x - 2); else max_run= FFMIN(run, w-x-1); if(parent_xc) max_run= FFMIN(max_run, 2*parent_xc->x - x - 1); x+= max_run; run-= max_run; } } } (xc++)->x= w+1; //end marker prev_xc= prev2_xc; prev2_xc= xc; if(parent_xc){ if(y&1){ while(parent_xc->x != parent->width+1) parent_xc++; parent_xc++; prev_parent_xc= parent_xc; }else{ parent_xc= prev_parent_xc; } } } (xc++)->x= w+1; //end marker } }
false
FFmpeg
b44985ba12d927d643a7bc03b0db98b83bf4fc9e
static inline void unpack_coeffs(SnowContext *s, SubBand *b, SubBand * parent, int orientation){ const int w= b->width; const int h= b->height; int x,y; if(1){ int run; x_and_coeff *xc= b->x_coeff; x_and_coeff *prev_xc= NULL; x_and_coeff *prev2_xc= xc; x_and_coeff *parent_xc= parent ? parent->x_coeff : NULL; x_and_coeff *prev_parent_xc= parent_xc; run= get_symbol2(&s->c, b->state[1], 3); for(y=0; y<h; y++){ int v=0; int lt=0, t=0, rt=0; if(y && prev_xc->x == 0){ rt= prev_xc->coeff; } for(x=0; x<w; x++){ int p=0; const int l= v; lt= t; t= rt; if(y){ if(prev_xc->x <= x) prev_xc++; if(prev_xc->x == x + 1) rt= prev_xc->coeff; else rt=0; } if(parent_xc){ if(x>>1 > parent_xc->x){ parent_xc++; } if(x>>1 == parent_xc->x){ p= parent_xc->coeff; } } if(l|lt|t|rt|p){ int context= av_log2(3*(l>>1) + (lt>>1) + (t&~1) + (rt>>1) + (p>>1)); v=get_rac(&s->c, &b->state[0][context]); if(v){ v= 2*(get_symbol2(&s->c, b->state[context + 2], context-4) + 1); v+=get_rac(&s->c, &b->state[0][16 + 1 + 3 + quant3bA[l&0xFF] + 3*quant3bA[t&0xFF]]); xc->x=x; (xc++)->coeff= v; } }else{ if(!run){ run= get_symbol2(&s->c, b->state[1], 3); v= 2*(get_symbol2(&s->c, b->state[0 + 2], 0-4) + 1); v+=get_rac(&s->c, &b->state[0][16 + 1 + 3]); xc->x=x; (xc++)->coeff= v; }else{ int max_run; run--; v=0; if(y) max_run= FFMIN(run, prev_xc->x - x - 2); else max_run= FFMIN(run, w-x-1); if(parent_xc) max_run= FFMIN(max_run, 2*parent_xc->x - x - 1); x+= max_run; run-= max_run; } } } (xc++)->x= w+1; prev_xc= prev2_xc; prev2_xc= xc; if(parent_xc){ if(y&1){ while(parent_xc->x != parent->width+1) parent_xc++; parent_xc++; prev_parent_xc= parent_xc; }else{ parent_xc= prev_parent_xc; } } } (xc++)->x= w+1; } }
{ "code": [], "line_no": [] }
static inline void FUNC_0(SnowContext *VAR_0, SubBand *VAR_1, SubBand * VAR_2, int VAR_3){ const int VAR_4= VAR_1->width; const int VAR_5= VAR_1->height; int VAR_6,VAR_7; if(1){ int VAR_8; x_and_coeff *xc= VAR_1->x_coeff; x_and_coeff *prev_xc= NULL; x_and_coeff *prev2_xc= xc; x_and_coeff *parent_xc= VAR_2 ? VAR_2->x_coeff : NULL; x_and_coeff *prev_parent_xc= parent_xc; VAR_8= get_symbol2(&VAR_0->c, VAR_1->state[1], 3); for(VAR_7=0; VAR_7<VAR_5; VAR_7++){ int VAR_9=0; int VAR_10=0, VAR_11=0, VAR_12=0; if(VAR_7 && prev_xc->VAR_6 == 0){ VAR_12= prev_xc->coeff; } for(VAR_6=0; VAR_6<VAR_4; VAR_6++){ int VAR_13=0; const int VAR_14= VAR_9; VAR_10= VAR_11; VAR_11= VAR_12; if(VAR_7){ if(prev_xc->VAR_6 <= VAR_6) prev_xc++; if(prev_xc->VAR_6 == VAR_6 + 1) VAR_12= prev_xc->coeff; else VAR_12=0; } if(parent_xc){ if(VAR_6>>1 > parent_xc->VAR_6){ parent_xc++; } if(VAR_6>>1 == parent_xc->VAR_6){ VAR_13= parent_xc->coeff; } } if(VAR_14|VAR_10|VAR_11|VAR_12|VAR_13){ int VAR_15= av_log2(3*(VAR_14>>1) + (VAR_10>>1) + (VAR_11&~1) + (VAR_12>>1) + (VAR_13>>1)); VAR_9=get_rac(&VAR_0->c, &VAR_1->state[0][VAR_15]); if(VAR_9){ VAR_9= 2*(get_symbol2(&VAR_0->c, VAR_1->state[VAR_15 + 2], VAR_15-4) + 1); VAR_9+=get_rac(&VAR_0->c, &VAR_1->state[0][16 + 1 + 3 + quant3bA[VAR_14&0xFF] + 3*quant3bA[VAR_11&0xFF]]); xc->VAR_6=VAR_6; (xc++)->coeff= VAR_9; } }else{ if(!VAR_8){ VAR_8= get_symbol2(&VAR_0->c, VAR_1->state[1], 3); VAR_9= 2*(get_symbol2(&VAR_0->c, VAR_1->state[0 + 2], 0-4) + 1); VAR_9+=get_rac(&VAR_0->c, &VAR_1->state[0][16 + 1 + 3]); xc->VAR_6=VAR_6; (xc++)->coeff= VAR_9; }else{ int VAR_16; VAR_8--; VAR_9=0; if(VAR_7) VAR_16= FFMIN(VAR_8, prev_xc->VAR_6 - VAR_6 - 2); else VAR_16= FFMIN(VAR_8, VAR_4-VAR_6-1); if(parent_xc) VAR_16= FFMIN(VAR_16, 2*parent_xc->VAR_6 - VAR_6 - 1); VAR_6+= VAR_16; VAR_8-= VAR_16; } } } (xc++)->VAR_6= VAR_4+1; prev_xc= prev2_xc; prev2_xc= xc; if(parent_xc){ if(VAR_7&1){ while(parent_xc->VAR_6 != VAR_2->width+1) parent_xc++; parent_xc++; prev_parent_xc= parent_xc; }else{ parent_xc= prev_parent_xc; } } } (xc++)->VAR_6= VAR_4+1; } }
[ "static inline void FUNC_0(SnowContext *VAR_0, SubBand *VAR_1, SubBand * VAR_2, int VAR_3){", "const int VAR_4= VAR_1->width;", "const int VAR_5= VAR_1->height;", "int VAR_6,VAR_7;", "if(1){", "int VAR_8;", "x_and_coeff *xc= VAR_1->x_coeff;", "x_and_coeff *prev_xc= NULL;", "x_and_coeff *prev2_xc= xc;", "x_and_coeff *parent_xc= VAR_2 ? VAR_2->x_coeff : NULL;", "x_and_coeff *prev_parent_xc= parent_xc;", "VAR_8= get_symbol2(&VAR_0->c, VAR_1->state[1], 3);", "for(VAR_7=0; VAR_7<VAR_5; VAR_7++){", "int VAR_9=0;", "int VAR_10=0, VAR_11=0, VAR_12=0;", "if(VAR_7 && prev_xc->VAR_6 == 0){", "VAR_12= prev_xc->coeff;", "}", "for(VAR_6=0; VAR_6<VAR_4; VAR_6++){", "int VAR_13=0;", "const int VAR_14= VAR_9;", "VAR_10= VAR_11; VAR_11= VAR_12;", "if(VAR_7){", "if(prev_xc->VAR_6 <= VAR_6)\nprev_xc++;", "if(prev_xc->VAR_6 == VAR_6 + 1)\nVAR_12= prev_xc->coeff;", "else\nVAR_12=0;", "}", "if(parent_xc){", "if(VAR_6>>1 > parent_xc->VAR_6){", "parent_xc++;", "}", "if(VAR_6>>1 == parent_xc->VAR_6){", "VAR_13= parent_xc->coeff;", "}", "}", "if(VAR_14|VAR_10|VAR_11|VAR_12|VAR_13){", "int VAR_15= av_log2(3*(VAR_14>>1) + (VAR_10>>1) + (VAR_11&~1) + (VAR_12>>1) + (VAR_13>>1));", "VAR_9=get_rac(&VAR_0->c, &VAR_1->state[0][VAR_15]);", "if(VAR_9){", "VAR_9= 2*(get_symbol2(&VAR_0->c, VAR_1->state[VAR_15 + 2], VAR_15-4) + 1);", "VAR_9+=get_rac(&VAR_0->c, &VAR_1->state[0][16 + 1 + 3 + quant3bA[VAR_14&0xFF] + 3*quant3bA[VAR_11&0xFF]]);", "xc->VAR_6=VAR_6;", "(xc++)->coeff= VAR_9;", "}", "}else{", "if(!VAR_8){", "VAR_8= get_symbol2(&VAR_0->c, VAR_1->state[1], 3);", "VAR_9= 2*(get_symbol2(&VAR_0->c, VAR_1->state[0 + 2], 0-4) + 1);", "VAR_9+=get_rac(&VAR_0->c, &VAR_1->state[0][16 + 1 + 3]);", "xc->VAR_6=VAR_6;", "(xc++)->coeff= VAR_9;", "}else{", "int VAR_16;", "VAR_8--;", "VAR_9=0;", "if(VAR_7) VAR_16= FFMIN(VAR_8, prev_xc->VAR_6 - VAR_6 - 2);", "else VAR_16= FFMIN(VAR_8, VAR_4-VAR_6-1);", "if(parent_xc)\nVAR_16= FFMIN(VAR_16, 2*parent_xc->VAR_6 - VAR_6 - 1);", "VAR_6+= VAR_16;", "VAR_8-= VAR_16;", "}", "}", "}", "(xc++)->VAR_6= VAR_4+1;", "prev_xc= prev2_xc;", "prev2_xc= xc;", "if(parent_xc){", "if(VAR_7&1){", "while(parent_xc->VAR_6 != VAR_2->width+1)\nparent_xc++;", "parent_xc++;", "prev_parent_xc= parent_xc;", "}else{", "parent_xc= prev_parent_xc;", "}", "}", "}", "(xc++)->VAR_6= VAR_4+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 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 55 ], [ 57, 59 ], [ 61, 63 ], [ 65, 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 135 ], [ 137 ], [ 139, 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 161 ], [ 163 ], [ 165, 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 185 ], [ 187 ], [ 189 ] ]
10,118
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; VmncContext * const c = avctx->priv_data; GetByteContext *gb = &c->gb; uint8_t *outptr; int dx, dy, w, h, depth, enc, chunks, res, size_left, ret; if ((ret = ff_reget_buffer(avctx, c->pic)) < 0) { av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); return ret; } bytestream2_init(gb, buf, buf_size); c->pic->key_frame = 0; c->pic->pict_type = AV_PICTURE_TYPE_P; // restore screen after cursor if (c->screendta) { int i; w = c->cur_w; if (c->width < c->cur_x + w) w = c->width - c->cur_x; h = c->cur_h; if (c->height < c->cur_y + h) h = c->height - c->cur_y; dx = c->cur_x; if (dx < 0) { w += dx; dx = 0; } dy = c->cur_y; if (dy < 0) { h += dy; dy = 0; } if ((w > 0) && (h > 0)) { outptr = c->pic->data[0] + dx * c->bpp2 + dy * c->pic->linesize[0]; for (i = 0; i < h; i++) { memcpy(outptr, c->screendta + i * c->cur_w * c->bpp2, w * c->bpp2); outptr += c->pic->linesize[0]; } } } bytestream2_skip(gb, 2); chunks = bytestream2_get_be16(gb); while (chunks--) { dx = bytestream2_get_be16(gb); dy = bytestream2_get_be16(gb); w = bytestream2_get_be16(gb); h = bytestream2_get_be16(gb); enc = bytestream2_get_be32(gb); outptr = c->pic->data[0] + dx * c->bpp2 + dy * c->pic->linesize[0]; size_left = bytestream2_get_bytes_left(gb); switch (enc) { case MAGIC_WMVd: // cursor if (size_left < 2 + w * h * c->bpp2 * 2) { av_log(avctx, AV_LOG_ERROR, "Premature end of data! (need %i got %i)\n", 2 + w * h * c->bpp2 * 2, size_left); return AVERROR_INVALIDDATA; } bytestream2_skip(gb, 2); c->cur_w = w; c->cur_h = h; c->cur_hx = dx; c->cur_hy = dy; if ((c->cur_hx > c->cur_w) || (c->cur_hy > c->cur_h)) { av_log(avctx, AV_LOG_ERROR, "Cursor hot spot is not in image: " "%ix%i of %ix%i cursor size\n", c->cur_hx, c->cur_hy, c->cur_w, c->cur_h); c->cur_hx = c->cur_hy = 0; } if (c->cur_w * c->cur_h >= INT_MAX / c->bpp2) { reset_buffers(c); return AVERROR(EINVAL); } else { int screen_size = c->cur_w * c->cur_h * c->bpp2; if ((ret = av_reallocp(&c->curbits, screen_size)) < 0 || (ret = av_reallocp(&c->curmask, screen_size)) < 0 || (ret = av_reallocp(&c->screendta, screen_size)) < 0) { reset_buffers(c); return ret; } } load_cursor(c); break; case MAGIC_WMVe: // unknown bytestream2_skip(gb, 2); break; case MAGIC_WMVf: // update cursor position c->cur_x = dx - c->cur_hx; c->cur_y = dy - c->cur_hy; break; case MAGIC_WMVg: // unknown bytestream2_skip(gb, 10); break; case MAGIC_WMVh: // unknown bytestream2_skip(gb, 4); break; case MAGIC_WMVi: // ServerInitialization struct c->pic->key_frame = 1; c->pic->pict_type = AV_PICTURE_TYPE_I; depth = bytestream2_get_byte(gb); if (depth != c->bpp) { av_log(avctx, AV_LOG_INFO, "Depth mismatch. Container %i bpp, " "Frame data: %i bpp\n", c->bpp, depth); } bytestream2_skip(gb, 1); c->bigendian = bytestream2_get_byte(gb); if (c->bigendian & (~1)) { av_log(avctx, AV_LOG_INFO, "Invalid header: bigendian flag = %i\n", c->bigendian); return AVERROR_INVALIDDATA; } //skip the rest of pixel format data bytestream2_skip(gb, 13); break; case MAGIC_WMVj: // unknown bytestream2_skip(gb, 2); break; case 0x00000000: // raw rectangle data if ((dx + w > c->width) || (dy + h > c->height)) { av_log(avctx, AV_LOG_ERROR, "Incorrect frame size: %ix%i+%ix%i of %ix%i\n", w, h, dx, dy, c->width, c->height); return AVERROR_INVALIDDATA; } if (size_left < w * h * c->bpp2) { av_log(avctx, AV_LOG_ERROR, "Premature end of data! (need %i got %i)\n", w * h * c->bpp2, size_left); return AVERROR_INVALIDDATA; } paint_raw(outptr, w, h, gb, c->bpp2, c->bigendian, c->pic->linesize[0]); break; case 0x00000005: // HexTile encoded rectangle if ((dx + w > c->width) || (dy + h > c->height)) { av_log(avctx, AV_LOG_ERROR, "Incorrect frame size: %ix%i+%ix%i of %ix%i\n", w, h, dx, dy, c->width, c->height); return AVERROR_INVALIDDATA; } res = decode_hextile(c, outptr, gb, w, h, c->pic->linesize[0]); if (res < 0) return res; break; default: av_log(avctx, AV_LOG_ERROR, "Unsupported block type 0x%08X\n", enc); chunks = 0; // leave chunks decoding loop } } if (c->screendta) { int i; // save screen data before painting cursor w = c->cur_w; if (c->width < c->cur_x + w) w = c->width - c->cur_x; h = c->cur_h; if (c->height < c->cur_y + h) h = c->height - c->cur_y; dx = c->cur_x; if (dx < 0) { w += dx; dx = 0; } dy = c->cur_y; if (dy < 0) { h += dy; dy = 0; } if ((w > 0) && (h > 0)) { outptr = c->pic->data[0] + dx * c->bpp2 + dy * c->pic->linesize[0]; for (i = 0; i < h; i++) { memcpy(c->screendta + i * c->cur_w * c->bpp2, outptr, w * c->bpp2); outptr += c->pic->linesize[0]; } outptr = c->pic->data[0]; put_cursor(outptr, c->pic->linesize[0], c, c->cur_x, c->cur_y); } } *got_frame = 1; if ((ret = av_frame_ref(data, c->pic)) < 0) return ret; /* always report that the buffer was completely consumed */ return buf_size; }
false
FFmpeg
eafbc6716cede6d4a652f8bedf82f2901c68d06d
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; VmncContext * const c = avctx->priv_data; GetByteContext *gb = &c->gb; uint8_t *outptr; int dx, dy, w, h, depth, enc, chunks, res, size_left, ret; if ((ret = ff_reget_buffer(avctx, c->pic)) < 0) { av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); return ret; } bytestream2_init(gb, buf, buf_size); c->pic->key_frame = 0; c->pic->pict_type = AV_PICTURE_TYPE_P; if (c->screendta) { int i; w = c->cur_w; if (c->width < c->cur_x + w) w = c->width - c->cur_x; h = c->cur_h; if (c->height < c->cur_y + h) h = c->height - c->cur_y; dx = c->cur_x; if (dx < 0) { w += dx; dx = 0; } dy = c->cur_y; if (dy < 0) { h += dy; dy = 0; } if ((w > 0) && (h > 0)) { outptr = c->pic->data[0] + dx * c->bpp2 + dy * c->pic->linesize[0]; for (i = 0; i < h; i++) { memcpy(outptr, c->screendta + i * c->cur_w * c->bpp2, w * c->bpp2); outptr += c->pic->linesize[0]; } } } bytestream2_skip(gb, 2); chunks = bytestream2_get_be16(gb); while (chunks--) { dx = bytestream2_get_be16(gb); dy = bytestream2_get_be16(gb); w = bytestream2_get_be16(gb); h = bytestream2_get_be16(gb); enc = bytestream2_get_be32(gb); outptr = c->pic->data[0] + dx * c->bpp2 + dy * c->pic->linesize[0]; size_left = bytestream2_get_bytes_left(gb); switch (enc) { case MAGIC_WMVd: if (size_left < 2 + w * h * c->bpp2 * 2) { av_log(avctx, AV_LOG_ERROR, "Premature end of data! (need %i got %i)\n", 2 + w * h * c->bpp2 * 2, size_left); return AVERROR_INVALIDDATA; } bytestream2_skip(gb, 2); c->cur_w = w; c->cur_h = h; c->cur_hx = dx; c->cur_hy = dy; if ((c->cur_hx > c->cur_w) || (c->cur_hy > c->cur_h)) { av_log(avctx, AV_LOG_ERROR, "Cursor hot spot is not in image: " "%ix%i of %ix%i cursor size\n", c->cur_hx, c->cur_hy, c->cur_w, c->cur_h); c->cur_hx = c->cur_hy = 0; } if (c->cur_w * c->cur_h >= INT_MAX / c->bpp2) { reset_buffers(c); return AVERROR(EINVAL); } else { int screen_size = c->cur_w * c->cur_h * c->bpp2; if ((ret = av_reallocp(&c->curbits, screen_size)) < 0 || (ret = av_reallocp(&c->curmask, screen_size)) < 0 || (ret = av_reallocp(&c->screendta, screen_size)) < 0) { reset_buffers(c); return ret; } } load_cursor(c); break; case MAGIC_WMVe: bytestream2_skip(gb, 2); break; case MAGIC_WMVf: c->cur_x = dx - c->cur_hx; c->cur_y = dy - c->cur_hy; break; case MAGIC_WMVg: bytestream2_skip(gb, 10); break; case MAGIC_WMVh: bytestream2_skip(gb, 4); break; case MAGIC_WMVi: c->pic->key_frame = 1; c->pic->pict_type = AV_PICTURE_TYPE_I; depth = bytestream2_get_byte(gb); if (depth != c->bpp) { av_log(avctx, AV_LOG_INFO, "Depth mismatch. Container %i bpp, " "Frame data: %i bpp\n", c->bpp, depth); } bytestream2_skip(gb, 1); c->bigendian = bytestream2_get_byte(gb); if (c->bigendian & (~1)) { av_log(avctx, AV_LOG_INFO, "Invalid header: bigendian flag = %i\n", c->bigendian); return AVERROR_INVALIDDATA; } bytestream2_skip(gb, 13); break; case MAGIC_WMVj: bytestream2_skip(gb, 2); break; case 0x00000000: if ((dx + w > c->width) || (dy + h > c->height)) { av_log(avctx, AV_LOG_ERROR, "Incorrect frame size: %ix%i+%ix%i of %ix%i\n", w, h, dx, dy, c->width, c->height); return AVERROR_INVALIDDATA; } if (size_left < w * h * c->bpp2) { av_log(avctx, AV_LOG_ERROR, "Premature end of data! (need %i got %i)\n", w * h * c->bpp2, size_left); return AVERROR_INVALIDDATA; } paint_raw(outptr, w, h, gb, c->bpp2, c->bigendian, c->pic->linesize[0]); break; case 0x00000005: if ((dx + w > c->width) || (dy + h > c->height)) { av_log(avctx, AV_LOG_ERROR, "Incorrect frame size: %ix%i+%ix%i of %ix%i\n", w, h, dx, dy, c->width, c->height); return AVERROR_INVALIDDATA; } res = decode_hextile(c, outptr, gb, w, h, c->pic->linesize[0]); if (res < 0) return res; break; default: av_log(avctx, AV_LOG_ERROR, "Unsupported block type 0x%08X\n", enc); chunks = 0; } } if (c->screendta) { int i; w = c->cur_w; if (c->width < c->cur_x + w) w = c->width - c->cur_x; h = c->cur_h; if (c->height < c->cur_y + h) h = c->height - c->cur_y; dx = c->cur_x; if (dx < 0) { w += dx; dx = 0; } dy = c->cur_y; if (dy < 0) { h += dy; dy = 0; } if ((w > 0) && (h > 0)) { outptr = c->pic->data[0] + dx * c->bpp2 + dy * c->pic->linesize[0]; for (i = 0; i < h; i++) { memcpy(c->screendta + i * c->cur_w * c->bpp2, outptr, w * c->bpp2); outptr += c->pic->linesize[0]; } outptr = c->pic->data[0]; put_cursor(outptr, c->pic->linesize[0], c, c->cur_x, c->cur_y); } } *got_frame = 1; if ((ret = av_frame_ref(data, c->pic)) < 0) return ret; return buf_size; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3) { const uint8_t *VAR_4 = VAR_3->VAR_1; int VAR_5 = VAR_3->size; VmncContext * const c = VAR_0->priv_data; GetByteContext *gb = &c->gb; uint8_t *outptr; int VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_11, VAR_12, VAR_13, VAR_14, VAR_15; if ((VAR_15 = ff_reget_buffer(VAR_0, c->pic)) < 0) { av_log(VAR_0, AV_LOG_ERROR, "reget_buffer() failed\n"); return VAR_15; } bytestream2_init(gb, VAR_4, VAR_5); c->pic->key_frame = 0; c->pic->pict_type = AV_PICTURE_TYPE_P; if (c->screendta) { int VAR_18; VAR_8 = c->cur_w; if (c->width < c->cur_x + VAR_8) VAR_8 = c->width - c->cur_x; VAR_9 = c->cur_h; if (c->height < c->cur_y + VAR_9) VAR_9 = c->height - c->cur_y; VAR_6 = c->cur_x; if (VAR_6 < 0) { VAR_8 += VAR_6; VAR_6 = 0; } VAR_7 = c->cur_y; if (VAR_7 < 0) { VAR_9 += VAR_7; VAR_7 = 0; } if ((VAR_8 > 0) && (VAR_9 > 0)) { outptr = c->pic->VAR_1[0] + VAR_6 * c->bpp2 + VAR_7 * c->pic->linesize[0]; for (VAR_18 = 0; VAR_18 < VAR_9; VAR_18++) { memcpy(outptr, c->screendta + VAR_18 * c->cur_w * c->bpp2, VAR_8 * c->bpp2); outptr += c->pic->linesize[0]; } } } bytestream2_skip(gb, 2); VAR_12 = bytestream2_get_be16(gb); while (VAR_12--) { VAR_6 = bytestream2_get_be16(gb); VAR_7 = bytestream2_get_be16(gb); VAR_8 = bytestream2_get_be16(gb); VAR_9 = bytestream2_get_be16(gb); VAR_11 = bytestream2_get_be32(gb); outptr = c->pic->VAR_1[0] + VAR_6 * c->bpp2 + VAR_7 * c->pic->linesize[0]; VAR_14 = bytestream2_get_bytes_left(gb); switch (VAR_11) { case MAGIC_WMVd: if (VAR_14 < 2 + VAR_8 * VAR_9 * c->bpp2 * 2) { av_log(VAR_0, AV_LOG_ERROR, "Premature end of VAR_1! (need %VAR_18 got %VAR_18)\n", 2 + VAR_8 * VAR_9 * c->bpp2 * 2, VAR_14); return AVERROR_INVALIDDATA; } bytestream2_skip(gb, 2); c->cur_w = VAR_8; c->cur_h = VAR_9; c->cur_hx = VAR_6; c->cur_hy = VAR_7; if ((c->cur_hx > c->cur_w) || (c->cur_hy > c->cur_h)) { av_log(VAR_0, AV_LOG_ERROR, "Cursor hot spot is not in image: " "%ix%VAR_18 of %ix%VAR_18 cursor size\n", c->cur_hx, c->cur_hy, c->cur_w, c->cur_h); c->cur_hx = c->cur_hy = 0; } if (c->cur_w * c->cur_h >= INT_MAX / c->bpp2) { reset_buffers(c); return AVERROR(EINVAL); } else { int VAR_17 = c->cur_w * c->cur_h * c->bpp2; if ((VAR_15 = av_reallocp(&c->curbits, VAR_17)) < 0 || (VAR_15 = av_reallocp(&c->curmask, VAR_17)) < 0 || (VAR_15 = av_reallocp(&c->screendta, VAR_17)) < 0) { reset_buffers(c); return VAR_15; } } load_cursor(c); break; case MAGIC_WMVe: bytestream2_skip(gb, 2); break; case MAGIC_WMVf: c->cur_x = VAR_6 - c->cur_hx; c->cur_y = VAR_7 - c->cur_hy; break; case MAGIC_WMVg: bytestream2_skip(gb, 10); break; case MAGIC_WMVh: bytestream2_skip(gb, 4); break; case MAGIC_WMVi: c->pic->key_frame = 1; c->pic->pict_type = AV_PICTURE_TYPE_I; VAR_10 = bytestream2_get_byte(gb); if (VAR_10 != c->bpp) { av_log(VAR_0, AV_LOG_INFO, "Depth mismatch. Container %VAR_18 bpp, " "Frame VAR_1: %VAR_18 bpp\n", c->bpp, VAR_10); } bytestream2_skip(gb, 1); c->bigendian = bytestream2_get_byte(gb); if (c->bigendian & (~1)) { av_log(VAR_0, AV_LOG_INFO, "Invalid header: bigendian flag = %VAR_18\n", c->bigendian); return AVERROR_INVALIDDATA; } bytestream2_skip(gb, 13); break; case MAGIC_WMVj: bytestream2_skip(gb, 2); break; case 0x00000000: if ((VAR_6 + VAR_8 > c->width) || (VAR_7 + VAR_9 > c->height)) { av_log(VAR_0, AV_LOG_ERROR, "Incorrect frame size: %ix%VAR_18+%ix%VAR_18 of %ix%VAR_18\n", VAR_8, VAR_9, VAR_6, VAR_7, c->width, c->height); return AVERROR_INVALIDDATA; } if (VAR_14 < VAR_8 * VAR_9 * c->bpp2) { av_log(VAR_0, AV_LOG_ERROR, "Premature end of VAR_1! (need %VAR_18 got %VAR_18)\n", VAR_8 * VAR_9 * c->bpp2, VAR_14); return AVERROR_INVALIDDATA; } paint_raw(outptr, VAR_8, VAR_9, gb, c->bpp2, c->bigendian, c->pic->linesize[0]); break; case 0x00000005: if ((VAR_6 + VAR_8 > c->width) || (VAR_7 + VAR_9 > c->height)) { av_log(VAR_0, AV_LOG_ERROR, "Incorrect frame size: %ix%VAR_18+%ix%VAR_18 of %ix%VAR_18\n", VAR_8, VAR_9, VAR_6, VAR_7, c->width, c->height); return AVERROR_INVALIDDATA; } VAR_13 = decode_hextile(c, outptr, gb, VAR_8, VAR_9, c->pic->linesize[0]); if (VAR_13 < 0) return VAR_13; break; default: av_log(VAR_0, AV_LOG_ERROR, "Unsupported block type 0x%08X\n", VAR_11); VAR_12 = 0; } } if (c->screendta) { int VAR_18; VAR_8 = c->cur_w; if (c->width < c->cur_x + VAR_8) VAR_8 = c->width - c->cur_x; VAR_9 = c->cur_h; if (c->height < c->cur_y + VAR_9) VAR_9 = c->height - c->cur_y; VAR_6 = c->cur_x; if (VAR_6 < 0) { VAR_8 += VAR_6; VAR_6 = 0; } VAR_7 = c->cur_y; if (VAR_7 < 0) { VAR_9 += VAR_7; VAR_7 = 0; } if ((VAR_8 > 0) && (VAR_9 > 0)) { outptr = c->pic->VAR_1[0] + VAR_6 * c->bpp2 + VAR_7 * c->pic->linesize[0]; for (VAR_18 = 0; VAR_18 < VAR_9; VAR_18++) { memcpy(c->screendta + VAR_18 * c->cur_w * c->bpp2, outptr, VAR_8 * c->bpp2); outptr += c->pic->linesize[0]; } outptr = c->pic->VAR_1[0]; put_cursor(outptr, c->pic->linesize[0], c, c->cur_x, c->cur_y); } } *VAR_2 = 1; if ((VAR_15 = av_frame_ref(VAR_1, c->pic)) < 0) return VAR_15; return VAR_5; }
[ "static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2,\nAVPacket *VAR_3)\n{", "const uint8_t *VAR_4 = VAR_3->VAR_1;", "int VAR_5 = VAR_3->size;", "VmncContext * const c = VAR_0->priv_data;", "GetByteContext *gb = &c->gb;", "uint8_t *outptr;", "int VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_11, VAR_12, VAR_13, VAR_14, VAR_15;", "if ((VAR_15 = ff_reget_buffer(VAR_0, c->pic)) < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"reget_buffer() failed\\n\");", "return VAR_15;", "}", "bytestream2_init(gb, VAR_4, VAR_5);", "c->pic->key_frame = 0;", "c->pic->pict_type = AV_PICTURE_TYPE_P;", "if (c->screendta) {", "int VAR_18;", "VAR_8 = c->cur_w;", "if (c->width < c->cur_x + VAR_8)\nVAR_8 = c->width - c->cur_x;", "VAR_9 = c->cur_h;", "if (c->height < c->cur_y + VAR_9)\nVAR_9 = c->height - c->cur_y;", "VAR_6 = c->cur_x;", "if (VAR_6 < 0) {", "VAR_8 += VAR_6;", "VAR_6 = 0;", "}", "VAR_7 = c->cur_y;", "if (VAR_7 < 0) {", "VAR_9 += VAR_7;", "VAR_7 = 0;", "}", "if ((VAR_8 > 0) && (VAR_9 > 0)) {", "outptr = c->pic->VAR_1[0] + VAR_6 * c->bpp2 + VAR_7 * c->pic->linesize[0];", "for (VAR_18 = 0; VAR_18 < VAR_9; VAR_18++) {", "memcpy(outptr, c->screendta + VAR_18 * c->cur_w * c->bpp2,\nVAR_8 * c->bpp2);", "outptr += c->pic->linesize[0];", "}", "}", "}", "bytestream2_skip(gb, 2);", "VAR_12 = bytestream2_get_be16(gb);", "while (VAR_12--) {", "VAR_6 = bytestream2_get_be16(gb);", "VAR_7 = bytestream2_get_be16(gb);", "VAR_8 = bytestream2_get_be16(gb);", "VAR_9 = bytestream2_get_be16(gb);", "VAR_11 = bytestream2_get_be32(gb);", "outptr = c->pic->VAR_1[0] + VAR_6 * c->bpp2 + VAR_7 * c->pic->linesize[0];", "VAR_14 = bytestream2_get_bytes_left(gb);", "switch (VAR_11) {", "case MAGIC_WMVd:\nif (VAR_14 < 2 + VAR_8 * VAR_9 * c->bpp2 * 2) {", "av_log(VAR_0, AV_LOG_ERROR,\n\"Premature end of VAR_1! (need %VAR_18 got %VAR_18)\\n\",\n2 + VAR_8 * VAR_9 * c->bpp2 * 2, VAR_14);", "return AVERROR_INVALIDDATA;", "}", "bytestream2_skip(gb, 2);", "c->cur_w = VAR_8;", "c->cur_h = VAR_9;", "c->cur_hx = VAR_6;", "c->cur_hy = VAR_7;", "if ((c->cur_hx > c->cur_w) || (c->cur_hy > c->cur_h)) {", "av_log(VAR_0, AV_LOG_ERROR,\n\"Cursor hot spot is not in image: \"\n\"%ix%VAR_18 of %ix%VAR_18 cursor size\\n\",\nc->cur_hx, c->cur_hy, c->cur_w, c->cur_h);", "c->cur_hx = c->cur_hy = 0;", "}", "if (c->cur_w * c->cur_h >= INT_MAX / c->bpp2) {", "reset_buffers(c);", "return AVERROR(EINVAL);", "} else {", "int VAR_17 = c->cur_w * c->cur_h * c->bpp2;", "if ((VAR_15 = av_reallocp(&c->curbits, VAR_17)) < 0 ||\n(VAR_15 = av_reallocp(&c->curmask, VAR_17)) < 0 ||\n(VAR_15 = av_reallocp(&c->screendta, VAR_17)) < 0) {", "reset_buffers(c);", "return VAR_15;", "}", "}", "load_cursor(c);", "break;", "case MAGIC_WMVe:\nbytestream2_skip(gb, 2);", "break;", "case MAGIC_WMVf:\nc->cur_x = VAR_6 - c->cur_hx;", "c->cur_y = VAR_7 - c->cur_hy;", "break;", "case MAGIC_WMVg:\nbytestream2_skip(gb, 10);", "break;", "case MAGIC_WMVh:\nbytestream2_skip(gb, 4);", "break;", "case MAGIC_WMVi:\nc->pic->key_frame = 1;", "c->pic->pict_type = AV_PICTURE_TYPE_I;", "VAR_10 = bytestream2_get_byte(gb);", "if (VAR_10 != c->bpp) {", "av_log(VAR_0, AV_LOG_INFO,\n\"Depth mismatch. Container %VAR_18 bpp, \"\n\"Frame VAR_1: %VAR_18 bpp\\n\",\nc->bpp, VAR_10);", "}", "bytestream2_skip(gb, 1);", "c->bigendian = bytestream2_get_byte(gb);", "if (c->bigendian & (~1)) {", "av_log(VAR_0, AV_LOG_INFO,\n\"Invalid header: bigendian flag = %VAR_18\\n\", c->bigendian);", "return AVERROR_INVALIDDATA;", "}", "bytestream2_skip(gb, 13);", "break;", "case MAGIC_WMVj:\nbytestream2_skip(gb, 2);", "break;", "case 0x00000000:\nif ((VAR_6 + VAR_8 > c->width) || (VAR_7 + VAR_9 > c->height)) {", "av_log(VAR_0, AV_LOG_ERROR,\n\"Incorrect frame size: %ix%VAR_18+%ix%VAR_18 of %ix%VAR_18\\n\",\nVAR_8, VAR_9, VAR_6, VAR_7, c->width, c->height);", "return AVERROR_INVALIDDATA;", "}", "if (VAR_14 < VAR_8 * VAR_9 * c->bpp2) {", "av_log(VAR_0, AV_LOG_ERROR,\n\"Premature end of VAR_1! (need %VAR_18 got %VAR_18)\\n\",\nVAR_8 * VAR_9 * c->bpp2, VAR_14);", "return AVERROR_INVALIDDATA;", "}", "paint_raw(outptr, VAR_8, VAR_9, gb, c->bpp2, c->bigendian,\nc->pic->linesize[0]);", "break;", "case 0x00000005:\nif ((VAR_6 + VAR_8 > c->width) || (VAR_7 + VAR_9 > c->height)) {", "av_log(VAR_0, AV_LOG_ERROR,\n\"Incorrect frame size: %ix%VAR_18+%ix%VAR_18 of %ix%VAR_18\\n\",\nVAR_8, VAR_9, VAR_6, VAR_7, c->width, c->height);", "return AVERROR_INVALIDDATA;", "}", "VAR_13 = decode_hextile(c, outptr, gb, VAR_8, VAR_9, c->pic->linesize[0]);", "if (VAR_13 < 0)\nreturn VAR_13;", "break;", "default:\nav_log(VAR_0, AV_LOG_ERROR, \"Unsupported block type 0x%08X\\n\", VAR_11);", "VAR_12 = 0;", "}", "}", "if (c->screendta) {", "int VAR_18;", "VAR_8 = c->cur_w;", "if (c->width < c->cur_x + VAR_8)\nVAR_8 = c->width - c->cur_x;", "VAR_9 = c->cur_h;", "if (c->height < c->cur_y + VAR_9)\nVAR_9 = c->height - c->cur_y;", "VAR_6 = c->cur_x;", "if (VAR_6 < 0) {", "VAR_8 += VAR_6;", "VAR_6 = 0;", "}", "VAR_7 = c->cur_y;", "if (VAR_7 < 0) {", "VAR_9 += VAR_7;", "VAR_7 = 0;", "}", "if ((VAR_8 > 0) && (VAR_9 > 0)) {", "outptr = c->pic->VAR_1[0] + VAR_6 * c->bpp2 + VAR_7 * c->pic->linesize[0];", "for (VAR_18 = 0; VAR_18 < VAR_9; VAR_18++) {", "memcpy(c->screendta + VAR_18 * c->cur_w * c->bpp2, outptr,\nVAR_8 * c->bpp2);", "outptr += c->pic->linesize[0];", "}", "outptr = c->pic->VAR_1[0];", "put_cursor(outptr, c->pic->linesize[0], c, c->cur_x, c->cur_y);", "}", "}", "*VAR_2 = 1;", "if ((VAR_15 = av_frame_ref(VAR_1, c->pic)) < 0)\nreturn VAR_15;", "return VAR_5;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 35 ], [ 37 ], [ 43 ], [ 45 ], [ 47 ], [ 49, 51 ], [ 53 ], [ 55, 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85, 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119, 121 ], [ 123, 125, 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145, 147, 149, 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167, 169, 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185, 187 ], [ 189 ], [ 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 ], [ 247 ], [ 249 ], [ 251, 253 ], [ 255 ], [ 257, 259 ], [ 261, 263, 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273, 275, 277 ], [ 279 ], [ 281 ], [ 283, 285 ], [ 287 ], [ 289, 291 ], [ 293, 295, 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305, 307 ], [ 309 ], [ 311, 313 ], [ 315 ], [ 317 ], [ 319 ], [ 321 ], [ 323 ], [ 327 ], [ 329, 331 ], [ 333 ], [ 335, 337 ], [ 339 ], [ 341 ], [ 343 ], [ 345 ], [ 347 ], [ 349 ], [ 351 ], [ 353 ], [ 355 ], [ 357 ], [ 359 ], [ 361 ], [ 363 ], [ 365, 367 ], [ 369 ], [ 371 ], [ 373 ], [ 375 ], [ 377 ], [ 379 ], [ 381 ], [ 383, 385 ], [ 391 ], [ 393 ] ]
10,119
void ff_fft_calc_sse(FFTContext *s, FFTComplex *z) { int ln = s->nbits; long i, j; long nblocks, nloops; FFTComplex *p, *cptr; asm volatile( "movaps %0, %%xmm4 \n\t" "movaps %1, %%xmm5 \n\t" ::"m"(*p1p1m1m1), "m"(*(s->inverse ? p1p1m1p1 : p1p1p1m1)) ); i = 8 << ln; asm volatile( "1: \n\t" "sub $32, %0 \n\t" /* do the pass 0 butterfly */ "movaps (%0,%1), %%xmm0 \n\t" "movaps %%xmm0, %%xmm1 \n\t" "shufps $0x4E, %%xmm0, %%xmm0 \n\t" "xorps %%xmm4, %%xmm1 \n\t" "addps %%xmm1, %%xmm0 \n\t" "movaps 16(%0,%1), %%xmm2 \n\t" "movaps %%xmm2, %%xmm3 \n\t" "shufps $0x4E, %%xmm2, %%xmm2 \n\t" "xorps %%xmm4, %%xmm3 \n\t" "addps %%xmm3, %%xmm2 \n\t" /* multiply third by -i */ /* by toggling the sign bit */ "shufps $0xB4, %%xmm2, %%xmm2 \n\t" "xorps %%xmm5, %%xmm2 \n\t" /* do the pass 1 butterfly */ "movaps %%xmm0, %%xmm1 \n\t" "addps %%xmm2, %%xmm0 \n\t" "subps %%xmm2, %%xmm1 \n\t" "movaps %%xmm0, (%0,%1) \n\t" "movaps %%xmm1, 16(%0,%1) \n\t" "jg 1b \n\t" :"+r"(i) :"r"(z) ); /* pass 2 .. ln-1 */ nblocks = 1 << (ln-3); nloops = 1 << 2; cptr = s->exptab1; do { p = z; j = nblocks; do { i = nloops*8; asm volatile( "1: \n\t" "sub $16, %0 \n\t" "movaps (%2,%0), %%xmm1 \n\t" "movaps (%1,%0), %%xmm0 \n\t" "movaps %%xmm1, %%xmm2 \n\t" "shufps $0xA0, %%xmm1, %%xmm1 \n\t" "shufps $0xF5, %%xmm2, %%xmm2 \n\t" "mulps (%3,%0,2), %%xmm1 \n\t" // cre*re cim*re "mulps 16(%3,%0,2), %%xmm2 \n\t" // -cim*im cre*im "addps %%xmm2, %%xmm1 \n\t" "movaps %%xmm0, %%xmm3 \n\t" "addps %%xmm1, %%xmm0 \n\t" "subps %%xmm1, %%xmm3 \n\t" "movaps %%xmm0, (%1,%0) \n\t" "movaps %%xmm3, (%2,%0) \n\t" "jg 1b \n\t" :"+r"(i) :"r"(p), "r"(p + nloops), "r"(cptr) ); p += nloops*2; } while (--j); cptr += nloops*2; nblocks >>= 1; nloops <<= 1; } while (nblocks != 0); }
false
FFmpeg
25e4f8aaeee05a963146ebf8cd1d01817dba91d6
void ff_fft_calc_sse(FFTContext *s, FFTComplex *z) { int ln = s->nbits; long i, j; long nblocks, nloops; FFTComplex *p, *cptr; asm volatile( "movaps %0, %%xmm4 \n\t" "movaps %1, %%xmm5 \n\t" ::"m"(*p1p1m1m1), "m"(*(s->inverse ? p1p1m1p1 : p1p1p1m1)) ); i = 8 << ln; asm volatile( "1: \n\t" "sub $32, %0 \n\t" "movaps (%0,%1), %%xmm0 \n\t" "movaps %%xmm0, %%xmm1 \n\t" "shufps $0x4E, %%xmm0, %%xmm0 \n\t" "xorps %%xmm4, %%xmm1 \n\t" "addps %%xmm1, %%xmm0 \n\t" "movaps 16(%0,%1), %%xmm2 \n\t" "movaps %%xmm2, %%xmm3 \n\t" "shufps $0x4E, %%xmm2, %%xmm2 \n\t" "xorps %%xmm4, %%xmm3 \n\t" "addps %%xmm3, %%xmm2 \n\t" "shufps $0xB4, %%xmm2, %%xmm2 \n\t" "xorps %%xmm5, %%xmm2 \n\t" "movaps %%xmm0, %%xmm1 \n\t" "addps %%xmm2, %%xmm0 \n\t" "subps %%xmm2, %%xmm1 \n\t" "movaps %%xmm0, (%0,%1) \n\t" "movaps %%xmm1, 16(%0,%1) \n\t" "jg 1b \n\t" :"+r"(i) :"r"(z) ); nblocks = 1 << (ln-3); nloops = 1 << 2; cptr = s->exptab1; do { p = z; j = nblocks; do { i = nloops*8; asm volatile( "1: \n\t" "sub $16, %0 \n\t" "movaps (%2,%0), %%xmm1 \n\t" "movaps (%1,%0), %%xmm0 \n\t" "movaps %%xmm1, %%xmm2 \n\t" "shufps $0xA0, %%xmm1, %%xmm1 \n\t" "shufps $0xF5, %%xmm2, %%xmm2 \n\t" "mulps (%3,%0,2), %%xmm1 \n\t" "mulps 16(%3,%0,2), %%xmm2 \n\t" "addps %%xmm2, %%xmm1 \n\t" "movaps %%xmm0, %%xmm3 \n\t" "addps %%xmm1, %%xmm0 \n\t" "subps %%xmm1, %%xmm3 \n\t" "movaps %%xmm0, (%1,%0) \n\t" "movaps %%xmm3, (%2,%0) \n\t" "jg 1b \n\t" :"+r"(i) :"r"(p), "r"(p + nloops), "r"(cptr) ); p += nloops*2; } while (--j); cptr += nloops*2; nblocks >>= 1; nloops <<= 1; } while (nblocks != 0); }
{ "code": [], "line_no": [] }
void FUNC_0(FFTContext *VAR_0, FFTComplex *VAR_1) { int VAR_2 = VAR_0->nbits; long VAR_3, VAR_4; long VAR_5, VAR_6; FFTComplex *p, *cptr; asm volatile( "movaps %0, %%xmm4 \n\t" "movaps %1, %%xmm5 \n\t" ::"m"(*p1p1m1m1), "m"(*(VAR_0->inverse ? p1p1m1p1 : p1p1p1m1)) ); VAR_3 = 8 << VAR_2; asm volatile( "1: \n\t" "sub $32, %0 \n\t" "movaps (%0,%1), %%xmm0 \n\t" "movaps %%xmm0, %%xmm1 \n\t" "shufps $0x4E, %%xmm0, %%xmm0 \n\t" "xorps %%xmm4, %%xmm1 \n\t" "addps %%xmm1, %%xmm0 \n\t" "movaps 16(%0,%1), %%xmm2 \n\t" "movaps %%xmm2, %%xmm3 \n\t" "shufps $0x4E, %%xmm2, %%xmm2 \n\t" "xorps %%xmm4, %%xmm3 \n\t" "addps %%xmm3, %%xmm2 \n\t" "shufps $0xB4, %%xmm2, %%xmm2 \n\t" "xorps %%xmm5, %%xmm2 \n\t" "movaps %%xmm0, %%xmm1 \n\t" "addps %%xmm2, %%xmm0 \n\t" "subps %%xmm2, %%xmm1 \n\t" "movaps %%xmm0, (%0,%1) \n\t" "movaps %%xmm1, 16(%0,%1) \n\t" "jg 1b \n\t" :"+r"(VAR_3) :"r"(VAR_1) ); VAR_5 = 1 << (VAR_2-3); VAR_6 = 1 << 2; cptr = VAR_0->exptab1; do { p = VAR_1; VAR_4 = VAR_5; do { VAR_3 = VAR_6*8; asm volatile( "1: \n\t" "sub $16, %0 \n\t" "movaps (%2,%0), %%xmm1 \n\t" "movaps (%1,%0), %%xmm0 \n\t" "movaps %%xmm1, %%xmm2 \n\t" "shufps $0xA0, %%xmm1, %%xmm1 \n\t" "shufps $0xF5, %%xmm2, %%xmm2 \n\t" "mulps (%3,%0,2), %%xmm1 \n\t" "mulps 16(%3,%0,2), %%xmm2 \n\t" "addps %%xmm2, %%xmm1 \n\t" "movaps %%xmm0, %%xmm3 \n\t" "addps %%xmm1, %%xmm0 \n\t" "subps %%xmm1, %%xmm3 \n\t" "movaps %%xmm0, (%1,%0) \n\t" "movaps %%xmm3, (%2,%0) \n\t" "jg 1b \n\t" :"+r"(VAR_3) :"r"(p), "r"(p + VAR_6), "r"(cptr) ); p += VAR_6*2; } while (--VAR_4); cptr += VAR_6*2; VAR_5 >>= 1; VAR_6 <<= 1; } while (VAR_5 != 0); }
[ "void FUNC_0(FFTContext *VAR_0, FFTComplex *VAR_1)\n{", "int VAR_2 = VAR_0->nbits;", "long VAR_3, VAR_4;", "long VAR_5, VAR_6;", "FFTComplex *p, *cptr;", "asm volatile(\n\"movaps %0, %%xmm4 \\n\\t\"\n\"movaps %1, %%xmm5 \\n\\t\"\n::\"m\"(*p1p1m1m1),\n\"m\"(*(VAR_0->inverse ? p1p1m1p1 : p1p1p1m1))\n);", "VAR_3 = 8 << VAR_2;", "asm volatile(\n\"1: \\n\\t\"\n\"sub $32, %0 \\n\\t\"\n\"movaps (%0,%1), %%xmm0 \\n\\t\"\n\"movaps %%xmm0, %%xmm1 \\n\\t\"\n\"shufps $0x4E, %%xmm0, %%xmm0 \\n\\t\"\n\"xorps %%xmm4, %%xmm1 \\n\\t\"\n\"addps %%xmm1, %%xmm0 \\n\\t\"\n\"movaps 16(%0,%1), %%xmm2 \\n\\t\"\n\"movaps %%xmm2, %%xmm3 \\n\\t\"\n\"shufps $0x4E, %%xmm2, %%xmm2 \\n\\t\"\n\"xorps %%xmm4, %%xmm3 \\n\\t\"\n\"addps %%xmm3, %%xmm2 \\n\\t\"\n\"shufps $0xB4, %%xmm2, %%xmm2 \\n\\t\"\n\"xorps %%xmm5, %%xmm2 \\n\\t\"\n\"movaps %%xmm0, %%xmm1 \\n\\t\"\n\"addps %%xmm2, %%xmm0 \\n\\t\"\n\"subps %%xmm2, %%xmm1 \\n\\t\"\n\"movaps %%xmm0, (%0,%1) \\n\\t\"\n\"movaps %%xmm1, 16(%0,%1) \\n\\t\"\n\"jg 1b \\n\\t\"\n:\"+r\"(VAR_3)\n:\"r\"(VAR_1)\n);", "VAR_5 = 1 << (VAR_2-3);", "VAR_6 = 1 << 2;", "cptr = VAR_0->exptab1;", "do {", "p = VAR_1;", "VAR_4 = VAR_5;", "do {", "VAR_3 = VAR_6*8;", "asm volatile(\n\"1: \\n\\t\"\n\"sub $16, %0 \\n\\t\"\n\"movaps (%2,%0), %%xmm1 \\n\\t\"\n\"movaps (%1,%0), %%xmm0 \\n\\t\"\n\"movaps %%xmm1, %%xmm2 \\n\\t\"\n\"shufps $0xA0, %%xmm1, %%xmm1 \\n\\t\"\n\"shufps $0xF5, %%xmm2, %%xmm2 \\n\\t\"\n\"mulps (%3,%0,2), %%xmm1 \\n\\t\"\n\"mulps 16(%3,%0,2), %%xmm2 \\n\\t\"\n\"addps %%xmm2, %%xmm1 \\n\\t\"\n\"movaps %%xmm0, %%xmm3 \\n\\t\"\n\"addps %%xmm1, %%xmm0 \\n\\t\"\n\"subps %%xmm1, %%xmm3 \\n\\t\"\n\"movaps %%xmm0, (%1,%0) \\n\\t\"\n\"movaps %%xmm3, (%2,%0) \\n\\t\"\n\"jg 1b \\n\\t\"\n:\"+r\"(VAR_3)\n:\"r\"(p), \"r\"(p + VAR_6), \"r\"(cptr)\n);", "p += VAR_6*2;", "} while (--VAR_4);", "cptr += VAR_6*2;", "VAR_5 >>= 1;", "VAR_6 <<= 1;", "} while (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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15, 17, 19, 21, 23, 25 ], [ 29 ], [ 31, 33, 35, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 63, 65, 69, 71, 73, 75, 77, 79, 81, 83, 85 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107, 109, 111, 113, 115, 117, 119, 121, 123, 125, 127, 129, 131, 133, 135, 137, 139, 141, 143, 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ] ]
10,120
static av_cold int cfhd_decode_init(AVCodecContext *avctx) { CFHDContext *s = avctx->priv_data; avctx->bits_per_raw_sample = 10; s->avctx = avctx; avctx->width = 0; avctx->height = 0; return ff_cfhd_init_vlcs(s); }
false
FFmpeg
7888ae8266d8f721cc443fe3aa627d350ca01204
static av_cold int cfhd_decode_init(AVCodecContext *avctx) { CFHDContext *s = avctx->priv_data; avctx->bits_per_raw_sample = 10; s->avctx = avctx; avctx->width = 0; avctx->height = 0; return ff_cfhd_init_vlcs(s); }
{ "code": [], "line_no": [] }
static av_cold int FUNC_0(AVCodecContext *avctx) { CFHDContext *s = avctx->priv_data; avctx->bits_per_raw_sample = 10; s->avctx = avctx; avctx->width = 0; avctx->height = 0; return ff_cfhd_init_vlcs(s); }
[ "static av_cold int FUNC_0(AVCodecContext *avctx)\n{", "CFHDContext *s = avctx->priv_data;", "avctx->bits_per_raw_sample = 10;", "s->avctx = avctx;", "avctx->width = 0;", "avctx->height = 0;", "return ff_cfhd_init_vlcs(s);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ] ]
10,121
static int dump_init(DumpState *s, int fd, bool paging, bool has_filter, int64_t begin, int64_t length, Error **errp) { CPUState *cpu; int nr_cpus; Error *err = NULL; int ret; if (runstate_is_running()) { vm_stop(RUN_STATE_SAVE_VM); s->resume = true; } else { s->resume = false; } /* If we use KVM, we should synchronize the registers before we get dump * info or physmap info. */ cpu_synchronize_all_states(); nr_cpus = 0; for (cpu = first_cpu; cpu != NULL; cpu = cpu->next_cpu) { nr_cpus++; } s->errp = errp; s->fd = fd; s->has_filter = has_filter; s->begin = begin; s->length = length; guest_phys_blocks_init(&s->guest_phys_blocks); /* FILL LIST */ s->start = get_start_block(s); if (s->start == -1) { error_set(errp, QERR_INVALID_PARAMETER, "begin"); goto cleanup; } /* get dump info: endian, class and architecture. * If the target architecture is not supported, cpu_get_dump_info() will * return -1. */ ret = cpu_get_dump_info(&s->dump_info); if (ret < 0) { error_set(errp, QERR_UNSUPPORTED); goto cleanup; } s->note_size = cpu_get_note_size(s->dump_info.d_class, s->dump_info.d_machine, nr_cpus); if (ret < 0) { error_set(errp, QERR_UNSUPPORTED); goto cleanup; } /* get memory mapping */ memory_mapping_list_init(&s->list); if (paging) { qemu_get_guest_memory_mapping(&s->list, &err); if (err != NULL) { error_propagate(errp, err); goto cleanup; } } else { qemu_get_guest_simple_memory_mapping(&s->list); } if (s->has_filter) { memory_mapping_filter(&s->list, s->begin, s->length); } /* * calculate phdr_num * * the type of ehdr->e_phnum is uint16_t, so we should avoid overflow */ s->phdr_num = 1; /* PT_NOTE */ if (s->list.num < UINT16_MAX - 2) { s->phdr_num += s->list.num; s->have_section = false; } else { s->have_section = true; s->phdr_num = PN_XNUM; s->sh_info = 1; /* PT_NOTE */ /* the type of shdr->sh_info is uint32_t, so we should avoid overflow */ if (s->list.num <= UINT32_MAX - 1) { s->sh_info += s->list.num; } else { s->sh_info = UINT32_MAX; } } if (s->dump_info.d_class == ELFCLASS64) { if (s->have_section) { s->memory_offset = sizeof(Elf64_Ehdr) + sizeof(Elf64_Phdr) * s->sh_info + sizeof(Elf64_Shdr) + s->note_size; } else { s->memory_offset = sizeof(Elf64_Ehdr) + sizeof(Elf64_Phdr) * s->phdr_num + s->note_size; } } else { if (s->have_section) { s->memory_offset = sizeof(Elf32_Ehdr) + sizeof(Elf32_Phdr) * s->sh_info + sizeof(Elf32_Shdr) + s->note_size; } else { s->memory_offset = sizeof(Elf32_Ehdr) + sizeof(Elf32_Phdr) * s->phdr_num + s->note_size; } } return 0; cleanup: guest_phys_blocks_free(&s->guest_phys_blocks); if (s->resume) { vm_start(); } return -1; }
false
qemu
c5d7f60f0614250bd925071e25220ce5958f75d0
static int dump_init(DumpState *s, int fd, bool paging, bool has_filter, int64_t begin, int64_t length, Error **errp) { CPUState *cpu; int nr_cpus; Error *err = NULL; int ret; if (runstate_is_running()) { vm_stop(RUN_STATE_SAVE_VM); s->resume = true; } else { s->resume = false; } cpu_synchronize_all_states(); nr_cpus = 0; for (cpu = first_cpu; cpu != NULL; cpu = cpu->next_cpu) { nr_cpus++; } s->errp = errp; s->fd = fd; s->has_filter = has_filter; s->begin = begin; s->length = length; guest_phys_blocks_init(&s->guest_phys_blocks); s->start = get_start_block(s); if (s->start == -1) { error_set(errp, QERR_INVALID_PARAMETER, "begin"); goto cleanup; } ret = cpu_get_dump_info(&s->dump_info); if (ret < 0) { error_set(errp, QERR_UNSUPPORTED); goto cleanup; } s->note_size = cpu_get_note_size(s->dump_info.d_class, s->dump_info.d_machine, nr_cpus); if (ret < 0) { error_set(errp, QERR_UNSUPPORTED); goto cleanup; } memory_mapping_list_init(&s->list); if (paging) { qemu_get_guest_memory_mapping(&s->list, &err); if (err != NULL) { error_propagate(errp, err); goto cleanup; } } else { qemu_get_guest_simple_memory_mapping(&s->list); } if (s->has_filter) { memory_mapping_filter(&s->list, s->begin, s->length); } s->phdr_num = 1; if (s->list.num < UINT16_MAX - 2) { s->phdr_num += s->list.num; s->have_section = false; } else { s->have_section = true; s->phdr_num = PN_XNUM; s->sh_info = 1; if (s->list.num <= UINT32_MAX - 1) { s->sh_info += s->list.num; } else { s->sh_info = UINT32_MAX; } } if (s->dump_info.d_class == ELFCLASS64) { if (s->have_section) { s->memory_offset = sizeof(Elf64_Ehdr) + sizeof(Elf64_Phdr) * s->sh_info + sizeof(Elf64_Shdr) + s->note_size; } else { s->memory_offset = sizeof(Elf64_Ehdr) + sizeof(Elf64_Phdr) * s->phdr_num + s->note_size; } } else { if (s->have_section) { s->memory_offset = sizeof(Elf32_Ehdr) + sizeof(Elf32_Phdr) * s->sh_info + sizeof(Elf32_Shdr) + s->note_size; } else { s->memory_offset = sizeof(Elf32_Ehdr) + sizeof(Elf32_Phdr) * s->phdr_num + s->note_size; } } return 0; cleanup: guest_phys_blocks_free(&s->guest_phys_blocks); if (s->resume) { vm_start(); } return -1; }
{ "code": [], "line_no": [] }
static int FUNC_0(DumpState *VAR_0, int VAR_1, bool VAR_2, bool VAR_3, int64_t VAR_4, int64_t VAR_5, Error **VAR_6) { CPUState *cpu; int VAR_7; Error *err = NULL; int VAR_8; if (runstate_is_running()) { vm_stop(RUN_STATE_SAVE_VM); VAR_0->resume = true; } else { VAR_0->resume = false; } cpu_synchronize_all_states(); VAR_7 = 0; for (cpu = first_cpu; cpu != NULL; cpu = cpu->next_cpu) { VAR_7++; } VAR_0->VAR_6 = VAR_6; VAR_0->VAR_1 = VAR_1; VAR_0->VAR_3 = VAR_3; VAR_0->VAR_4 = VAR_4; VAR_0->VAR_5 = VAR_5; guest_phys_blocks_init(&VAR_0->guest_phys_blocks); VAR_0->start = get_start_block(VAR_0); if (VAR_0->start == -1) { error_set(VAR_6, QERR_INVALID_PARAMETER, "VAR_4"); goto cleanup; } VAR_8 = cpu_get_dump_info(&VAR_0->dump_info); if (VAR_8 < 0) { error_set(VAR_6, QERR_UNSUPPORTED); goto cleanup; } VAR_0->note_size = cpu_get_note_size(VAR_0->dump_info.d_class, VAR_0->dump_info.d_machine, VAR_7); if (VAR_8 < 0) { error_set(VAR_6, QERR_UNSUPPORTED); goto cleanup; } memory_mapping_list_init(&VAR_0->list); if (VAR_2) { qemu_get_guest_memory_mapping(&VAR_0->list, &err); if (err != NULL) { error_propagate(VAR_6, err); goto cleanup; } } else { qemu_get_guest_simple_memory_mapping(&VAR_0->list); } if (VAR_0->VAR_3) { memory_mapping_filter(&VAR_0->list, VAR_0->VAR_4, VAR_0->VAR_5); } VAR_0->phdr_num = 1; if (VAR_0->list.num < UINT16_MAX - 2) { VAR_0->phdr_num += VAR_0->list.num; VAR_0->have_section = false; } else { VAR_0->have_section = true; VAR_0->phdr_num = PN_XNUM; VAR_0->sh_info = 1; if (VAR_0->list.num <= UINT32_MAX - 1) { VAR_0->sh_info += VAR_0->list.num; } else { VAR_0->sh_info = UINT32_MAX; } } if (VAR_0->dump_info.d_class == ELFCLASS64) { if (VAR_0->have_section) { VAR_0->memory_offset = sizeof(Elf64_Ehdr) + sizeof(Elf64_Phdr) * VAR_0->sh_info + sizeof(Elf64_Shdr) + VAR_0->note_size; } else { VAR_0->memory_offset = sizeof(Elf64_Ehdr) + sizeof(Elf64_Phdr) * VAR_0->phdr_num + VAR_0->note_size; } } else { if (VAR_0->have_section) { VAR_0->memory_offset = sizeof(Elf32_Ehdr) + sizeof(Elf32_Phdr) * VAR_0->sh_info + sizeof(Elf32_Shdr) + VAR_0->note_size; } else { VAR_0->memory_offset = sizeof(Elf32_Ehdr) + sizeof(Elf32_Phdr) * VAR_0->phdr_num + VAR_0->note_size; } } return 0; cleanup: guest_phys_blocks_free(&VAR_0->guest_phys_blocks); if (VAR_0->resume) { vm_start(); } return -1; }
[ "static int FUNC_0(DumpState *VAR_0, int VAR_1, bool VAR_2, bool VAR_3,\nint64_t VAR_4, int64_t VAR_5, Error **VAR_6)\n{", "CPUState *cpu;", "int VAR_7;", "Error *err = NULL;", "int VAR_8;", "if (runstate_is_running()) {", "vm_stop(RUN_STATE_SAVE_VM);", "VAR_0->resume = true;", "} else {", "VAR_0->resume = false;", "}", "cpu_synchronize_all_states();", "VAR_7 = 0;", "for (cpu = first_cpu; cpu != NULL; cpu = cpu->next_cpu) {", "VAR_7++;", "}", "VAR_0->VAR_6 = VAR_6;", "VAR_0->VAR_1 = VAR_1;", "VAR_0->VAR_3 = VAR_3;", "VAR_0->VAR_4 = VAR_4;", "VAR_0->VAR_5 = VAR_5;", "guest_phys_blocks_init(&VAR_0->guest_phys_blocks);", "VAR_0->start = get_start_block(VAR_0);", "if (VAR_0->start == -1) {", "error_set(VAR_6, QERR_INVALID_PARAMETER, \"VAR_4\");", "goto cleanup;", "}", "VAR_8 = cpu_get_dump_info(&VAR_0->dump_info);", "if (VAR_8 < 0) {", "error_set(VAR_6, QERR_UNSUPPORTED);", "goto cleanup;", "}", "VAR_0->note_size = cpu_get_note_size(VAR_0->dump_info.d_class,\nVAR_0->dump_info.d_machine, VAR_7);", "if (VAR_8 < 0) {", "error_set(VAR_6, QERR_UNSUPPORTED);", "goto cleanup;", "}", "memory_mapping_list_init(&VAR_0->list);", "if (VAR_2) {", "qemu_get_guest_memory_mapping(&VAR_0->list, &err);", "if (err != NULL) {", "error_propagate(VAR_6, err);", "goto cleanup;", "}", "} else {", "qemu_get_guest_simple_memory_mapping(&VAR_0->list);", "}", "if (VAR_0->VAR_3) {", "memory_mapping_filter(&VAR_0->list, VAR_0->VAR_4, VAR_0->VAR_5);", "}", "VAR_0->phdr_num = 1;", "if (VAR_0->list.num < UINT16_MAX - 2) {", "VAR_0->phdr_num += VAR_0->list.num;", "VAR_0->have_section = false;", "} else {", "VAR_0->have_section = true;", "VAR_0->phdr_num = PN_XNUM;", "VAR_0->sh_info = 1;", "if (VAR_0->list.num <= UINT32_MAX - 1) {", "VAR_0->sh_info += VAR_0->list.num;", "} else {", "VAR_0->sh_info = UINT32_MAX;", "}", "}", "if (VAR_0->dump_info.d_class == ELFCLASS64) {", "if (VAR_0->have_section) {", "VAR_0->memory_offset = sizeof(Elf64_Ehdr) +\nsizeof(Elf64_Phdr) * VAR_0->sh_info +\nsizeof(Elf64_Shdr) + VAR_0->note_size;", "} else {", "VAR_0->memory_offset = sizeof(Elf64_Ehdr) +\nsizeof(Elf64_Phdr) * VAR_0->phdr_num + VAR_0->note_size;", "}", "} else {", "if (VAR_0->have_section) {", "VAR_0->memory_offset = sizeof(Elf32_Ehdr) +\nsizeof(Elf32_Phdr) * VAR_0->sh_info +\nsizeof(Elf32_Shdr) + VAR_0->note_size;", "} else {", "VAR_0->memory_offset = sizeof(Elf32_Ehdr) +\nsizeof(Elf32_Phdr) * VAR_0->phdr_num + VAR_0->note_size;", "}", "}", "return 0;", "cleanup:\nguest_phys_blocks_free(&VAR_0->guest_phys_blocks);", "if (VAR_0->resume) {", "vm_start();", "}", "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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99, 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 137 ], [ 139 ], [ 141 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 189 ], [ 191 ], [ 193, 195, 197 ], [ 199 ], [ 201, 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211, 213, 215 ], [ 217 ], [ 219, 221 ], [ 223 ], [ 225 ], [ 229 ], [ 233, 235 ], [ 239 ], [ 241 ], [ 243 ], [ 247 ], [ 249 ] ]
10,122
qemu_irq xics_assign_irq(struct icp_state *icp, int irq, enum xics_irq_type type) { if ((irq < icp->ics->offset) || (irq >= (icp->ics->offset + icp->ics->nr_irqs))) { return NULL; } assert((type == XICS_MSI) || (type == XICS_LSI)); icp->ics->irqs[irq - icp->ics->offset].type = type; return icp->ics->qirqs[irq - icp->ics->offset]; }
false
qemu
a307d59434ba78b97544b42b8cfd24a1b62e39a6
qemu_irq xics_assign_irq(struct icp_state *icp, int irq, enum xics_irq_type type) { if ((irq < icp->ics->offset) || (irq >= (icp->ics->offset + icp->ics->nr_irqs))) { return NULL; } assert((type == XICS_MSI) || (type == XICS_LSI)); icp->ics->irqs[irq - icp->ics->offset].type = type; return icp->ics->qirqs[irq - icp->ics->offset]; }
{ "code": [], "line_no": [] }
qemu_irq FUNC_0(struct icp_state *icp, int irq, enum xics_irq_type type) { if ((irq < icp->ics->offset) || (irq >= (icp->ics->offset + icp->ics->nr_irqs))) { return NULL; } assert((type == XICS_MSI) || (type == XICS_LSI)); icp->ics->irqs[irq - icp->ics->offset].type = type; return icp->ics->qirqs[irq - icp->ics->offset]; }
[ "qemu_irq FUNC_0(struct icp_state *icp, int irq,\nenum xics_irq_type type)\n{", "if ((irq < icp->ics->offset)\n|| (irq >= (icp->ics->offset + icp->ics->nr_irqs))) {", "return NULL;", "}", "assert((type == XICS_MSI) || (type == XICS_LSI));", "icp->ics->irqs[irq - icp->ics->offset].type = type;", "return icp->ics->qirqs[irq - icp->ics->offset];", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7, 9 ], [ 11 ], [ 13 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ] ]
10,123
int load_aout(const char *filename, target_phys_addr_t addr, int max_sz, int bswap_needed, target_phys_addr_t target_page_size) { int fd, size, ret; struct exec e; uint32_t magic; fd = open(filename, O_RDONLY | O_BINARY); if (fd < 0) return -1; size = read(fd, &e, sizeof(e)); if (size < 0) goto fail; if (bswap_needed) { bswap_ahdr(&e); } magic = N_MAGIC(e); switch (magic) { case ZMAGIC: case QMAGIC: case OMAGIC: if (e.a_text + e.a_data > max_sz) goto fail; lseek(fd, N_TXTOFF(e), SEEK_SET); size = read_targphys(fd, addr, e.a_text + e.a_data); if (size < 0) goto fail; break; case NMAGIC: if (N_DATADDR(e, target_page_size) + e.a_data > max_sz) goto fail; lseek(fd, N_TXTOFF(e), SEEK_SET); size = read_targphys(fd, addr, e.a_text); if (size < 0) goto fail; ret = read_targphys(fd, addr + N_DATADDR(e, target_page_size), e.a_data); if (ret < 0) goto fail; size += ret; break; default: goto fail; } close(fd); return size; fail: close(fd); return -1; }
false
qemu
45a50b1668822c23afc2a89f724654e176518bc4
int load_aout(const char *filename, target_phys_addr_t addr, int max_sz, int bswap_needed, target_phys_addr_t target_page_size) { int fd, size, ret; struct exec e; uint32_t magic; fd = open(filename, O_RDONLY | O_BINARY); if (fd < 0) return -1; size = read(fd, &e, sizeof(e)); if (size < 0) goto fail; if (bswap_needed) { bswap_ahdr(&e); } magic = N_MAGIC(e); switch (magic) { case ZMAGIC: case QMAGIC: case OMAGIC: if (e.a_text + e.a_data > max_sz) goto fail; lseek(fd, N_TXTOFF(e), SEEK_SET); size = read_targphys(fd, addr, e.a_text + e.a_data); if (size < 0) goto fail; break; case NMAGIC: if (N_DATADDR(e, target_page_size) + e.a_data > max_sz) goto fail; lseek(fd, N_TXTOFF(e), SEEK_SET); size = read_targphys(fd, addr, e.a_text); if (size < 0) goto fail; ret = read_targphys(fd, addr + N_DATADDR(e, target_page_size), e.a_data); if (ret < 0) goto fail; size += ret; break; default: goto fail; } close(fd); return size; fail: close(fd); return -1; }
{ "code": [], "line_no": [] }
int FUNC_0(const char *VAR_0, target_phys_addr_t VAR_1, int VAR_2, int VAR_3, target_phys_addr_t VAR_4) { int VAR_5, VAR_6, VAR_7; struct exec VAR_8; uint32_t magic; VAR_5 = open(VAR_0, O_RDONLY | O_BINARY); if (VAR_5 < 0) return -1; VAR_6 = read(VAR_5, &VAR_8, sizeof(VAR_8)); if (VAR_6 < 0) goto fail; if (VAR_3) { bswap_ahdr(&VAR_8); } magic = N_MAGIC(VAR_8); switch (magic) { case ZMAGIC: case QMAGIC: case OMAGIC: if (VAR_8.a_text + VAR_8.a_data > VAR_2) goto fail; lseek(VAR_5, N_TXTOFF(VAR_8), SEEK_SET); VAR_6 = read_targphys(VAR_5, VAR_1, VAR_8.a_text + VAR_8.a_data); if (VAR_6 < 0) goto fail; break; case NMAGIC: if (N_DATADDR(VAR_8, VAR_4) + VAR_8.a_data > VAR_2) goto fail; lseek(VAR_5, N_TXTOFF(VAR_8), SEEK_SET); VAR_6 = read_targphys(VAR_5, VAR_1, VAR_8.a_text); if (VAR_6 < 0) goto fail; VAR_7 = read_targphys(VAR_5, VAR_1 + N_DATADDR(VAR_8, VAR_4), VAR_8.a_data); if (VAR_7 < 0) goto fail; VAR_6 += VAR_7; break; default: goto fail; } close(VAR_5); return VAR_6; fail: close(VAR_5); return -1; }
[ "int FUNC_0(const char *VAR_0, target_phys_addr_t VAR_1, int VAR_2,\nint VAR_3, target_phys_addr_t VAR_4)\n{", "int VAR_5, VAR_6, VAR_7;", "struct exec VAR_8;", "uint32_t magic;", "VAR_5 = open(VAR_0, O_RDONLY | O_BINARY);", "if (VAR_5 < 0)\nreturn -1;", "VAR_6 = read(VAR_5, &VAR_8, sizeof(VAR_8));", "if (VAR_6 < 0)\ngoto fail;", "if (VAR_3) {", "bswap_ahdr(&VAR_8);", "}", "magic = N_MAGIC(VAR_8);", "switch (magic) {", "case ZMAGIC:\ncase QMAGIC:\ncase OMAGIC:\nif (VAR_8.a_text + VAR_8.a_data > VAR_2)\ngoto fail;", "lseek(VAR_5, N_TXTOFF(VAR_8), SEEK_SET);", "VAR_6 = read_targphys(VAR_5, VAR_1, VAR_8.a_text + VAR_8.a_data);", "if (VAR_6 < 0)\ngoto fail;", "break;", "case NMAGIC:\nif (N_DATADDR(VAR_8, VAR_4) + VAR_8.a_data > VAR_2)\ngoto fail;", "lseek(VAR_5, N_TXTOFF(VAR_8), SEEK_SET);", "VAR_6 = read_targphys(VAR_5, VAR_1, VAR_8.a_text);", "if (VAR_6 < 0)\ngoto fail;", "VAR_7 = read_targphys(VAR_5, VAR_1 + N_DATADDR(VAR_8, VAR_4),\nVAR_8.a_data);", "if (VAR_7 < 0)\ngoto fail;", "VAR_6 += VAR_7;", "break;", "default:\ngoto fail;", "}", "close(VAR_5);", "return VAR_6;", "fail:\nclose(VAR_5);", "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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17, 19 ], [ 23 ], [ 25, 27 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43, 45, 47, 49, 51 ], [ 53 ], [ 55 ], [ 57, 59 ], [ 61 ], [ 63, 65, 67 ], [ 69 ], [ 71 ], [ 73, 75 ], [ 77, 79 ], [ 81, 83 ], [ 85 ], [ 87 ], [ 89, 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99, 101 ], [ 103 ], [ 105 ] ]
10,125
SH7750State *sh7750_init(CPUSH4State * cpu) { SH7750State *s; int sh7750_io_memory; int cpu_model = SH_CPU_SH7751R; /* for now */ s = qemu_mallocz(sizeof(SH7750State)); s->cpu = cpu; s->periph_freq = 60000000; /* 60MHz */ sh7750_io_memory = cpu_register_io_memory(0, sh7750_mem_read, sh7750_mem_write, s); cpu_register_physical_memory(0x1c000000, 0x04000000, sh7750_io_memory); sh_intc_init(&s->intc, NR_SOURCES, _INTC_ARRAY(mask_registers), _INTC_ARRAY(prio_registers)); sh_intc_register_sources(&s->intc, _INTC_ARRAY(vectors), _INTC_ARRAY(groups)); sh_serial_init(0x1fe00000, 0, s->periph_freq, serial_hds[0]); sh_serial_init(0x1fe80000, SH_SERIAL_FEAT_SCIF, s->periph_freq, serial_hds[1]); tmu012_init(0x1fd80000, TMU012_FEAT_TOCR | TMU012_FEAT_3CHAN | TMU012_FEAT_EXTCLK, s->periph_freq); if (cpu_model & (SH_CPU_SH7750 | SH_CPU_SH7750S | SH_CPU_SH7751)) { sh_intc_register_sources(&s->intc, _INTC_ARRAY(vectors_dma4), _INTC_ARRAY(groups_dma4)); } if (cpu_model & (SH_CPU_SH7750R | SH_CPU_SH7751R)) { sh_intc_register_sources(&s->intc, _INTC_ARRAY(vectors_dma8), _INTC_ARRAY(groups_dma8)); } if (cpu_model & (SH_CPU_SH7750R | SH_CPU_SH7751 | SH_CPU_SH7751R)) { sh_intc_register_sources(&s->intc, _INTC_ARRAY(vectors_tmu34), _INTC_ARRAY(NULL)); tmu012_init(0x1e100000, 0, s->periph_freq); } if (cpu_model & (SH_CPU_SH7751_ALL)) { sh_intc_register_sources(&s->intc, _INTC_ARRAY(vectors_pci), _INTC_ARRAY(groups_pci)); } if (cpu_model & (SH_CPU_SH7750S | SH_CPU_SH7750R | SH_CPU_SH7751_ALL)) { sh_intc_register_sources(&s->intc, _INTC_ARRAY(vectors_irlm), _INTC_ARRAY(NULL)); } return s; }
false
qemu
f26ae302648d2977ba36d3dfcd0b70dce4e51060
SH7750State *sh7750_init(CPUSH4State * cpu) { SH7750State *s; int sh7750_io_memory; int cpu_model = SH_CPU_SH7751R; s = qemu_mallocz(sizeof(SH7750State)); s->cpu = cpu; s->periph_freq = 60000000; sh7750_io_memory = cpu_register_io_memory(0, sh7750_mem_read, sh7750_mem_write, s); cpu_register_physical_memory(0x1c000000, 0x04000000, sh7750_io_memory); sh_intc_init(&s->intc, NR_SOURCES, _INTC_ARRAY(mask_registers), _INTC_ARRAY(prio_registers)); sh_intc_register_sources(&s->intc, _INTC_ARRAY(vectors), _INTC_ARRAY(groups)); sh_serial_init(0x1fe00000, 0, s->periph_freq, serial_hds[0]); sh_serial_init(0x1fe80000, SH_SERIAL_FEAT_SCIF, s->periph_freq, serial_hds[1]); tmu012_init(0x1fd80000, TMU012_FEAT_TOCR | TMU012_FEAT_3CHAN | TMU012_FEAT_EXTCLK, s->periph_freq); if (cpu_model & (SH_CPU_SH7750 | SH_CPU_SH7750S | SH_CPU_SH7751)) { sh_intc_register_sources(&s->intc, _INTC_ARRAY(vectors_dma4), _INTC_ARRAY(groups_dma4)); } if (cpu_model & (SH_CPU_SH7750R | SH_CPU_SH7751R)) { sh_intc_register_sources(&s->intc, _INTC_ARRAY(vectors_dma8), _INTC_ARRAY(groups_dma8)); } if (cpu_model & (SH_CPU_SH7750R | SH_CPU_SH7751 | SH_CPU_SH7751R)) { sh_intc_register_sources(&s->intc, _INTC_ARRAY(vectors_tmu34), _INTC_ARRAY(NULL)); tmu012_init(0x1e100000, 0, s->periph_freq); } if (cpu_model & (SH_CPU_SH7751_ALL)) { sh_intc_register_sources(&s->intc, _INTC_ARRAY(vectors_pci), _INTC_ARRAY(groups_pci)); } if (cpu_model & (SH_CPU_SH7750S | SH_CPU_SH7750R | SH_CPU_SH7751_ALL)) { sh_intc_register_sources(&s->intc, _INTC_ARRAY(vectors_irlm), _INTC_ARRAY(NULL)); } return s; }
{ "code": [], "line_no": [] }
SH7750State *FUNC_0(CPUSH4State * cpu) { SH7750State *s; int VAR_0; int VAR_1 = SH_CPU_SH7751R; s = qemu_mallocz(sizeof(SH7750State)); s->cpu = cpu; s->periph_freq = 60000000; VAR_0 = cpu_register_io_memory(0, sh7750_mem_read, sh7750_mem_write, s); cpu_register_physical_memory(0x1c000000, 0x04000000, VAR_0); sh_intc_init(&s->intc, NR_SOURCES, _INTC_ARRAY(mask_registers), _INTC_ARRAY(prio_registers)); sh_intc_register_sources(&s->intc, _INTC_ARRAY(vectors), _INTC_ARRAY(groups)); sh_serial_init(0x1fe00000, 0, s->periph_freq, serial_hds[0]); sh_serial_init(0x1fe80000, SH_SERIAL_FEAT_SCIF, s->periph_freq, serial_hds[1]); tmu012_init(0x1fd80000, TMU012_FEAT_TOCR | TMU012_FEAT_3CHAN | TMU012_FEAT_EXTCLK, s->periph_freq); if (VAR_1 & (SH_CPU_SH7750 | SH_CPU_SH7750S | SH_CPU_SH7751)) { sh_intc_register_sources(&s->intc, _INTC_ARRAY(vectors_dma4), _INTC_ARRAY(groups_dma4)); } if (VAR_1 & (SH_CPU_SH7750R | SH_CPU_SH7751R)) { sh_intc_register_sources(&s->intc, _INTC_ARRAY(vectors_dma8), _INTC_ARRAY(groups_dma8)); } if (VAR_1 & (SH_CPU_SH7750R | SH_CPU_SH7751 | SH_CPU_SH7751R)) { sh_intc_register_sources(&s->intc, _INTC_ARRAY(vectors_tmu34), _INTC_ARRAY(NULL)); tmu012_init(0x1e100000, 0, s->periph_freq); } if (VAR_1 & (SH_CPU_SH7751_ALL)) { sh_intc_register_sources(&s->intc, _INTC_ARRAY(vectors_pci), _INTC_ARRAY(groups_pci)); } if (VAR_1 & (SH_CPU_SH7750S | SH_CPU_SH7750R | SH_CPU_SH7751_ALL)) { sh_intc_register_sources(&s->intc, _INTC_ARRAY(vectors_irlm), _INTC_ARRAY(NULL)); } return s; }
[ "SH7750State *FUNC_0(CPUSH4State * cpu)\n{", "SH7750State *s;", "int VAR_0;", "int VAR_1 = SH_CPU_SH7751R;", "s = qemu_mallocz(sizeof(SH7750State));", "s->cpu = cpu;", "s->periph_freq = 60000000;", "VAR_0 = cpu_register_io_memory(0,\nsh7750_mem_read,\nsh7750_mem_write, s);", "cpu_register_physical_memory(0x1c000000, 0x04000000, VAR_0);", "sh_intc_init(&s->intc, NR_SOURCES,\n_INTC_ARRAY(mask_registers),\n_INTC_ARRAY(prio_registers));", "sh_intc_register_sources(&s->intc,\n_INTC_ARRAY(vectors),\n_INTC_ARRAY(groups));", "sh_serial_init(0x1fe00000, 0, s->periph_freq, serial_hds[0]);", "sh_serial_init(0x1fe80000, SH_SERIAL_FEAT_SCIF,\ns->periph_freq, serial_hds[1]);", "tmu012_init(0x1fd80000,\nTMU012_FEAT_TOCR | TMU012_FEAT_3CHAN | TMU012_FEAT_EXTCLK,\ns->periph_freq);", "if (VAR_1 & (SH_CPU_SH7750 | SH_CPU_SH7750S | SH_CPU_SH7751)) {", "sh_intc_register_sources(&s->intc,\n_INTC_ARRAY(vectors_dma4),\n_INTC_ARRAY(groups_dma4));", "}", "if (VAR_1 & (SH_CPU_SH7750R | SH_CPU_SH7751R)) {", "sh_intc_register_sources(&s->intc,\n_INTC_ARRAY(vectors_dma8),\n_INTC_ARRAY(groups_dma8));", "}", "if (VAR_1 & (SH_CPU_SH7750R | SH_CPU_SH7751 | SH_CPU_SH7751R)) {", "sh_intc_register_sources(&s->intc,\n_INTC_ARRAY(vectors_tmu34),\n_INTC_ARRAY(NULL));", "tmu012_init(0x1e100000, 0, s->periph_freq);", "}", "if (VAR_1 & (SH_CPU_SH7751_ALL)) {", "sh_intc_register_sources(&s->intc,\n_INTC_ARRAY(vectors_pci),\n_INTC_ARRAY(groups_pci));", "}", "if (VAR_1 & (SH_CPU_SH7750S | SH_CPU_SH7750R | SH_CPU_SH7751_ALL)) {", "sh_intc_register_sources(&s->intc,\n_INTC_ARRAY(vectors_irlm),\n_INTC_ARRAY(NULL));", "}", "return s;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19, 21, 23 ], [ 25 ], [ 29, 31, 33 ], [ 37, 39, 41 ], [ 45 ], [ 47, 49 ], [ 53, 55, 57 ], [ 63 ], [ 65, 67, 69 ], [ 71 ], [ 75 ], [ 77, 79, 81 ], [ 83 ], [ 87 ], [ 89, 91, 93 ], [ 95 ], [ 97 ], [ 101 ], [ 103, 105, 107 ], [ 109 ], [ 113 ], [ 115, 117, 119 ], [ 121 ], [ 125 ], [ 127 ] ]
10,126
static void *buffered_file_thread(void *opaque) { MigrationState *s = opaque; int64_t initial_time = qemu_get_clock_ms(rt_clock); int64_t sleep_time = 0; int64_t max_size = 0; bool last_round = false; int ret; qemu_mutex_lock_iothread(); DPRINTF("beginning savevm\n"); ret = qemu_savevm_state_begin(s->file, &s->params); qemu_mutex_unlock_iothread(); while (ret >= 0) { int64_t current_time; uint64_t pending_size; qemu_mutex_lock_iothread(); if (s->state != MIG_STATE_ACTIVE) { DPRINTF("put_ready returning because of non-active state\n"); qemu_mutex_unlock_iothread(); break; } if (s->complete) { qemu_mutex_unlock_iothread(); break; } if (s->bytes_xfer < s->xfer_limit) { DPRINTF("iterate\n"); pending_size = qemu_savevm_state_pending(s->file, max_size); DPRINTF("pending size %lu max %lu\n", pending_size, max_size); if (pending_size && pending_size >= max_size) { ret = qemu_savevm_state_iterate(s->file); if (ret < 0) { qemu_mutex_unlock_iothread(); break; } } else { int old_vm_running = runstate_is_running(); int64_t start_time, end_time; DPRINTF("done iterating\n"); start_time = qemu_get_clock_ms(rt_clock); qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER); vm_stop_force_state(RUN_STATE_FINISH_MIGRATE); ret = qemu_savevm_state_complete(s->file); if (ret < 0) { qemu_mutex_unlock_iothread(); break; } else { migrate_fd_completed(s); } end_time = qemu_get_clock_ms(rt_clock); s->total_time = end_time - s->total_time; s->downtime = end_time - start_time; if (s->state != MIG_STATE_COMPLETED) { if (old_vm_running) { vm_start(); } } last_round = true; } } qemu_mutex_unlock_iothread(); current_time = qemu_get_clock_ms(rt_clock); if (current_time >= initial_time + BUFFER_DELAY) { uint64_t transferred_bytes = s->bytes_xfer; uint64_t time_spent = current_time - initial_time - sleep_time; double bandwidth = transferred_bytes / time_spent; max_size = bandwidth * migrate_max_downtime() / 1000000; DPRINTF("transferred %" PRIu64 " time_spent %" PRIu64 " bandwidth %g max_size %" PRId64 "\n", transferred_bytes, time_spent, bandwidth, max_size); /* if we haven't sent anything, we don't want to recalculate 10000 is a small enough number for our purposes */ if (s->dirty_bytes_rate && transferred_bytes > 10000) { s->expected_downtime = s->dirty_bytes_rate / bandwidth; } s->bytes_xfer = 0; sleep_time = 0; initial_time = current_time; } if (!last_round && (s->bytes_xfer >= s->xfer_limit)) { /* usleep expects microseconds */ g_usleep((initial_time + BUFFER_DELAY - current_time)*1000); sleep_time += qemu_get_clock_ms(rt_clock) - current_time; } buffered_flush(s); ret = qemu_file_get_error(s->file); } if (ret < 0) { migrate_fd_error(s); } g_free(s->buffer); return NULL; }
false
qemu
dba433c03a0f5dc22a459435dd89557886298921
static void *buffered_file_thread(void *opaque) { MigrationState *s = opaque; int64_t initial_time = qemu_get_clock_ms(rt_clock); int64_t sleep_time = 0; int64_t max_size = 0; bool last_round = false; int ret; qemu_mutex_lock_iothread(); DPRINTF("beginning savevm\n"); ret = qemu_savevm_state_begin(s->file, &s->params); qemu_mutex_unlock_iothread(); while (ret >= 0) { int64_t current_time; uint64_t pending_size; qemu_mutex_lock_iothread(); if (s->state != MIG_STATE_ACTIVE) { DPRINTF("put_ready returning because of non-active state\n"); qemu_mutex_unlock_iothread(); break; } if (s->complete) { qemu_mutex_unlock_iothread(); break; } if (s->bytes_xfer < s->xfer_limit) { DPRINTF("iterate\n"); pending_size = qemu_savevm_state_pending(s->file, max_size); DPRINTF("pending size %lu max %lu\n", pending_size, max_size); if (pending_size && pending_size >= max_size) { ret = qemu_savevm_state_iterate(s->file); if (ret < 0) { qemu_mutex_unlock_iothread(); break; } } else { int old_vm_running = runstate_is_running(); int64_t start_time, end_time; DPRINTF("done iterating\n"); start_time = qemu_get_clock_ms(rt_clock); qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER); vm_stop_force_state(RUN_STATE_FINISH_MIGRATE); ret = qemu_savevm_state_complete(s->file); if (ret < 0) { qemu_mutex_unlock_iothread(); break; } else { migrate_fd_completed(s); } end_time = qemu_get_clock_ms(rt_clock); s->total_time = end_time - s->total_time; s->downtime = end_time - start_time; if (s->state != MIG_STATE_COMPLETED) { if (old_vm_running) { vm_start(); } } last_round = true; } } qemu_mutex_unlock_iothread(); current_time = qemu_get_clock_ms(rt_clock); if (current_time >= initial_time + BUFFER_DELAY) { uint64_t transferred_bytes = s->bytes_xfer; uint64_t time_spent = current_time - initial_time - sleep_time; double bandwidth = transferred_bytes / time_spent; max_size = bandwidth * migrate_max_downtime() / 1000000; DPRINTF("transferred %" PRIu64 " time_spent %" PRIu64 " bandwidth %g max_size %" PRId64 "\n", transferred_bytes, time_spent, bandwidth, max_size); if (s->dirty_bytes_rate && transferred_bytes > 10000) { s->expected_downtime = s->dirty_bytes_rate / bandwidth; } s->bytes_xfer = 0; sleep_time = 0; initial_time = current_time; } if (!last_round && (s->bytes_xfer >= s->xfer_limit)) { g_usleep((initial_time + BUFFER_DELAY - current_time)*1000); sleep_time += qemu_get_clock_ms(rt_clock) - current_time; } buffered_flush(s); ret = qemu_file_get_error(s->file); } if (ret < 0) { migrate_fd_error(s); } g_free(s->buffer); return NULL; }
{ "code": [], "line_no": [] }
static void *FUNC_0(void *VAR_0) { MigrationState *s = VAR_0; int64_t initial_time = qemu_get_clock_ms(rt_clock); int64_t sleep_time = 0; int64_t max_size = 0; bool last_round = false; int VAR_1; qemu_mutex_lock_iothread(); DPRINTF("beginning savevm\n"); VAR_1 = qemu_savevm_state_begin(s->file, &s->params); qemu_mutex_unlock_iothread(); while (VAR_1 >= 0) { int64_t current_time; uint64_t pending_size; qemu_mutex_lock_iothread(); if (s->state != MIG_STATE_ACTIVE) { DPRINTF("put_ready returning because of non-active state\n"); qemu_mutex_unlock_iothread(); break; } if (s->complete) { qemu_mutex_unlock_iothread(); break; } if (s->bytes_xfer < s->xfer_limit) { DPRINTF("iterate\n"); pending_size = qemu_savevm_state_pending(s->file, max_size); DPRINTF("pending size %lu max %lu\n", pending_size, max_size); if (pending_size && pending_size >= max_size) { VAR_1 = qemu_savevm_state_iterate(s->file); if (VAR_1 < 0) { qemu_mutex_unlock_iothread(); break; } } else { int VAR_2 = runstate_is_running(); int64_t start_time, end_time; DPRINTF("done iterating\n"); start_time = qemu_get_clock_ms(rt_clock); qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER); vm_stop_force_state(RUN_STATE_FINISH_MIGRATE); VAR_1 = qemu_savevm_state_complete(s->file); if (VAR_1 < 0) { qemu_mutex_unlock_iothread(); break; } else { migrate_fd_completed(s); } end_time = qemu_get_clock_ms(rt_clock); s->total_time = end_time - s->total_time; s->downtime = end_time - start_time; if (s->state != MIG_STATE_COMPLETED) { if (VAR_2) { vm_start(); } } last_round = true; } } qemu_mutex_unlock_iothread(); current_time = qemu_get_clock_ms(rt_clock); if (current_time >= initial_time + BUFFER_DELAY) { uint64_t transferred_bytes = s->bytes_xfer; uint64_t time_spent = current_time - initial_time - sleep_time; double VAR_3 = transferred_bytes / time_spent; max_size = VAR_3 * migrate_max_downtime() / 1000000; DPRINTF("transferred %" PRIu64 " time_spent %" PRIu64 " VAR_3 %g max_size %" PRId64 "\n", transferred_bytes, time_spent, VAR_3, max_size); if (s->dirty_bytes_rate && transferred_bytes > 10000) { s->expected_downtime = s->dirty_bytes_rate / VAR_3; } s->bytes_xfer = 0; sleep_time = 0; initial_time = current_time; } if (!last_round && (s->bytes_xfer >= s->xfer_limit)) { g_usleep((initial_time + BUFFER_DELAY - current_time)*1000); sleep_time += qemu_get_clock_ms(rt_clock) - current_time; } buffered_flush(s); VAR_1 = qemu_file_get_error(s->file); } if (VAR_1 < 0) { migrate_fd_error(s); } g_free(s->buffer); return NULL; }
[ "static void *FUNC_0(void *VAR_0)\n{", "MigrationState *s = VAR_0;", "int64_t initial_time = qemu_get_clock_ms(rt_clock);", "int64_t sleep_time = 0;", "int64_t max_size = 0;", "bool last_round = false;", "int VAR_1;", "qemu_mutex_lock_iothread();", "DPRINTF(\"beginning savevm\\n\");", "VAR_1 = qemu_savevm_state_begin(s->file, &s->params);", "qemu_mutex_unlock_iothread();", "while (VAR_1 >= 0) {", "int64_t current_time;", "uint64_t pending_size;", "qemu_mutex_lock_iothread();", "if (s->state != MIG_STATE_ACTIVE) {", "DPRINTF(\"put_ready returning because of non-active state\\n\");", "qemu_mutex_unlock_iothread();", "break;", "}", "if (s->complete) {", "qemu_mutex_unlock_iothread();", "break;", "}", "if (s->bytes_xfer < s->xfer_limit) {", "DPRINTF(\"iterate\\n\");", "pending_size = qemu_savevm_state_pending(s->file, max_size);", "DPRINTF(\"pending size %lu max %lu\\n\", pending_size, max_size);", "if (pending_size && pending_size >= max_size) {", "VAR_1 = qemu_savevm_state_iterate(s->file);", "if (VAR_1 < 0) {", "qemu_mutex_unlock_iothread();", "break;", "}", "} else {", "int VAR_2 = runstate_is_running();", "int64_t start_time, end_time;", "DPRINTF(\"done iterating\\n\");", "start_time = qemu_get_clock_ms(rt_clock);", "qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER);", "vm_stop_force_state(RUN_STATE_FINISH_MIGRATE);", "VAR_1 = qemu_savevm_state_complete(s->file);", "if (VAR_1 < 0) {", "qemu_mutex_unlock_iothread();", "break;", "} else {", "migrate_fd_completed(s);", "}", "end_time = qemu_get_clock_ms(rt_clock);", "s->total_time = end_time - s->total_time;", "s->downtime = end_time - start_time;", "if (s->state != MIG_STATE_COMPLETED) {", "if (VAR_2) {", "vm_start();", "}", "}", "last_round = true;", "}", "}", "qemu_mutex_unlock_iothread();", "current_time = qemu_get_clock_ms(rt_clock);", "if (current_time >= initial_time + BUFFER_DELAY) {", "uint64_t transferred_bytes = s->bytes_xfer;", "uint64_t time_spent = current_time - initial_time - sleep_time;", "double VAR_3 = transferred_bytes / time_spent;", "max_size = VAR_3 * migrate_max_downtime() / 1000000;", "DPRINTF(\"transferred %\" PRIu64 \" time_spent %\" PRIu64\n\" VAR_3 %g max_size %\" PRId64 \"\\n\",\ntransferred_bytes, time_spent, VAR_3, max_size);", "if (s->dirty_bytes_rate && transferred_bytes > 10000) {", "s->expected_downtime = s->dirty_bytes_rate / VAR_3;", "}", "s->bytes_xfer = 0;", "sleep_time = 0;", "initial_time = current_time;", "}", "if (!last_round && (s->bytes_xfer >= s->xfer_limit)) {", "g_usleep((initial_time + BUFFER_DELAY - current_time)*1000);", "sleep_time += qemu_get_clock_ms(rt_clock) - current_time;", "}", "buffered_flush(s);", "VAR_1 = qemu_file_get_error(s->file);", "}", "if (VAR_1 < 0) {", "migrate_fd_error(s);", "}", "g_free(s->buffer);", "return NULL;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 145, 147, 149 ], [ 155 ], [ 157 ], [ 159 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ] ]
10,127
static void test_qemu_strtoul_trailing(void) { const char *str = "123xxx"; 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, ==, 123); g_assert(endptr == str + 3); }
false
qemu
bc7c08a2c375acb7ae4d433054415588b176d34c
static void test_qemu_strtoul_trailing(void) { const char *str = "123xxx"; 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, ==, 123); g_assert(endptr == str + 3); }
{ "code": [], "line_no": [] }
static void FUNC_0(void) { const char *VAR_0 = "123xxx"; 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, ==, 123); g_assert(VAR_2 == VAR_0 + 3); }
[ "static void FUNC_0(void)\n{", "const char *VAR_0 = \"123xxx\";", "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, ==, 123);", "g_assert(VAR_2 == VAR_0 + 3);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ] ]
10,129
static inline void downmix_3f_2r_to_stereo(float *samples) { int i; for (i = 0; i < 256; i++) { samples[i] += (samples[i + 256] + samples[i + 768]); samples[i + 256] = (samples[i + 512] + samples[i + 1024]); samples[i + 512] = samples[i + 768] = samples[i + 1024] = 0; } }
false
FFmpeg
0058584580b87feb47898e60e4b80c7f425882ad
static inline void downmix_3f_2r_to_stereo(float *samples) { int i; for (i = 0; i < 256; i++) { samples[i] += (samples[i + 256] + samples[i + 768]); samples[i + 256] = (samples[i + 512] + samples[i + 1024]); samples[i + 512] = samples[i + 768] = samples[i + 1024] = 0; } }
{ "code": [], "line_no": [] }
static inline void FUNC_0(float *VAR_0) { int VAR_1; for (VAR_1 = 0; VAR_1 < 256; VAR_1++) { VAR_0[VAR_1] += (VAR_0[VAR_1 + 256] + VAR_0[VAR_1 + 768]); VAR_0[VAR_1 + 256] = (VAR_0[VAR_1 + 512] + VAR_0[VAR_1 + 1024]); VAR_0[VAR_1 + 512] = VAR_0[VAR_1 + 768] = VAR_0[VAR_1 + 1024] = 0; } }
[ "static inline void FUNC_0(float *VAR_0)\n{", "int VAR_1;", "for (VAR_1 = 0; VAR_1 < 256; VAR_1++) {", "VAR_0[VAR_1] += (VAR_0[VAR_1 + 256] + VAR_0[VAR_1 + 768]);", "VAR_0[VAR_1 + 256] = (VAR_0[VAR_1 + 512] + VAR_0[VAR_1 + 1024]);", "VAR_0[VAR_1 + 512] = VAR_0[VAR_1 + 768] = VAR_0[VAR_1 + 1024] = 0;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ] ]
10,130
static void mirror_write_complete(void *opaque, int ret) { MirrorOp *op = opaque; MirrorBlockJob *s = op->s; aio_context_acquire(blk_get_aio_context(s->common.blk)); if (ret < 0) { BlockErrorAction action; bdrv_set_dirty_bitmap(s->dirty_bitmap, op->sector_num, op->nb_sectors); action = mirror_error_action(s, false, -ret); if (action == BLOCK_ERROR_ACTION_REPORT && s->ret >= 0) { s->ret = ret; } } mirror_iteration_done(op, ret); aio_context_release(blk_get_aio_context(s->common.blk)); }
false
qemu
b436982f04fb33bb29fcdea190bd1fdc97dc65ef
static void mirror_write_complete(void *opaque, int ret) { MirrorOp *op = opaque; MirrorBlockJob *s = op->s; aio_context_acquire(blk_get_aio_context(s->common.blk)); if (ret < 0) { BlockErrorAction action; bdrv_set_dirty_bitmap(s->dirty_bitmap, op->sector_num, op->nb_sectors); action = mirror_error_action(s, false, -ret); if (action == BLOCK_ERROR_ACTION_REPORT && s->ret >= 0) { s->ret = ret; } } mirror_iteration_done(op, ret); aio_context_release(blk_get_aio_context(s->common.blk)); }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, int VAR_1) { MirrorOp *op = VAR_0; MirrorBlockJob *s = op->s; aio_context_acquire(blk_get_aio_context(s->common.blk)); if (VAR_1 < 0) { BlockErrorAction action; bdrv_set_dirty_bitmap(s->dirty_bitmap, op->sector_num, op->nb_sectors); action = mirror_error_action(s, false, -VAR_1); if (action == BLOCK_ERROR_ACTION_REPORT && s->VAR_1 >= 0) { s->VAR_1 = VAR_1; } } mirror_iteration_done(op, VAR_1); aio_context_release(blk_get_aio_context(s->common.blk)); }
[ "static void FUNC_0(void *VAR_0, int VAR_1)\n{", "MirrorOp *op = VAR_0;", "MirrorBlockJob *s = op->s;", "aio_context_acquire(blk_get_aio_context(s->common.blk));", "if (VAR_1 < 0) {", "BlockErrorAction action;", "bdrv_set_dirty_bitmap(s->dirty_bitmap, op->sector_num, op->nb_sectors);", "action = mirror_error_action(s, false, -VAR_1);", "if (action == BLOCK_ERROR_ACTION_REPORT && s->VAR_1 >= 0) {", "s->VAR_1 = VAR_1;", "}", "}", "mirror_iteration_done(op, VAR_1);", "aio_context_release(blk_get_aio_context(s->common.blk));", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ] ]
10,131
static void qemu_remap_bucket(MapCacheEntry *entry, target_phys_addr_t size, target_phys_addr_t address_index) { uint8_t *vaddr_base; xen_pfn_t *pfns; int *err; unsigned int i, j; target_phys_addr_t nb_pfn = size >> XC_PAGE_SHIFT; trace_qemu_remap_bucket(address_index); pfns = qemu_mallocz(nb_pfn * sizeof (xen_pfn_t)); err = qemu_mallocz(nb_pfn * sizeof (int)); if (entry->vaddr_base != NULL) { if (munmap(entry->vaddr_base, size) != 0) { perror("unmap fails"); exit(-1); } } for (i = 0; i < nb_pfn; i++) { pfns[i] = (address_index << (MCACHE_BUCKET_SHIFT-XC_PAGE_SHIFT)) + i; } vaddr_base = xc_map_foreign_bulk(xen_xc, xen_domid, PROT_READ|PROT_WRITE, pfns, err, nb_pfn); if (vaddr_base == NULL) { perror("xc_map_foreign_bulk"); exit(-1); } entry->vaddr_base = vaddr_base; entry->paddr_index = address_index; for (i = 0; i < nb_pfn; i += BITS_PER_LONG) { unsigned long word = 0; if ((i + BITS_PER_LONG) > nb_pfn) { j = nb_pfn % BITS_PER_LONG; } else { j = BITS_PER_LONG; } while (j > 0) { word = (word << 1) | !err[i + --j]; } entry->valid_mapping[i / BITS_PER_LONG] = word; } qemu_free(pfns); qemu_free(err); }
false
qemu
ea6c5f8ffe6de12e04e63acbb9937683b30216e2
static void qemu_remap_bucket(MapCacheEntry *entry, target_phys_addr_t size, target_phys_addr_t address_index) { uint8_t *vaddr_base; xen_pfn_t *pfns; int *err; unsigned int i, j; target_phys_addr_t nb_pfn = size >> XC_PAGE_SHIFT; trace_qemu_remap_bucket(address_index); pfns = qemu_mallocz(nb_pfn * sizeof (xen_pfn_t)); err = qemu_mallocz(nb_pfn * sizeof (int)); if (entry->vaddr_base != NULL) { if (munmap(entry->vaddr_base, size) != 0) { perror("unmap fails"); exit(-1); } } for (i = 0; i < nb_pfn; i++) { pfns[i] = (address_index << (MCACHE_BUCKET_SHIFT-XC_PAGE_SHIFT)) + i; } vaddr_base = xc_map_foreign_bulk(xen_xc, xen_domid, PROT_READ|PROT_WRITE, pfns, err, nb_pfn); if (vaddr_base == NULL) { perror("xc_map_foreign_bulk"); exit(-1); } entry->vaddr_base = vaddr_base; entry->paddr_index = address_index; for (i = 0; i < nb_pfn; i += BITS_PER_LONG) { unsigned long word = 0; if ((i + BITS_PER_LONG) > nb_pfn) { j = nb_pfn % BITS_PER_LONG; } else { j = BITS_PER_LONG; } while (j > 0) { word = (word << 1) | !err[i + --j]; } entry->valid_mapping[i / BITS_PER_LONG] = word; } qemu_free(pfns); qemu_free(err); }
{ "code": [], "line_no": [] }
static void FUNC_0(MapCacheEntry *VAR_0, target_phys_addr_t VAR_1, target_phys_addr_t VAR_2) { uint8_t *vaddr_base; xen_pfn_t *pfns; int *VAR_3; unsigned int VAR_4, VAR_5; target_phys_addr_t nb_pfn = VAR_1 >> XC_PAGE_SHIFT; trace_qemu_remap_bucket(VAR_2); pfns = qemu_mallocz(nb_pfn * sizeof (xen_pfn_t)); VAR_3 = qemu_mallocz(nb_pfn * sizeof (int)); if (VAR_0->vaddr_base != NULL) { if (munmap(VAR_0->vaddr_base, VAR_1) != 0) { perror("unmap fails"); exit(-1); } } for (VAR_4 = 0; VAR_4 < nb_pfn; VAR_4++) { pfns[VAR_4] = (VAR_2 << (MCACHE_BUCKET_SHIFT-XC_PAGE_SHIFT)) + VAR_4; } vaddr_base = xc_map_foreign_bulk(xen_xc, xen_domid, PROT_READ|PROT_WRITE, pfns, VAR_3, nb_pfn); if (vaddr_base == NULL) { perror("xc_map_foreign_bulk"); exit(-1); } VAR_0->vaddr_base = vaddr_base; VAR_0->paddr_index = VAR_2; for (VAR_4 = 0; VAR_4 < nb_pfn; VAR_4 += BITS_PER_LONG) { unsigned long word = 0; if ((VAR_4 + BITS_PER_LONG) > nb_pfn) { VAR_5 = nb_pfn % BITS_PER_LONG; } else { VAR_5 = BITS_PER_LONG; } while (VAR_5 > 0) { word = (word << 1) | !VAR_3[VAR_4 + --VAR_5]; } VAR_0->valid_mapping[VAR_4 / BITS_PER_LONG] = word; } qemu_free(pfns); qemu_free(VAR_3); }
[ "static void FUNC_0(MapCacheEntry *VAR_0,\ntarget_phys_addr_t VAR_1,\ntarget_phys_addr_t VAR_2)\n{", "uint8_t *vaddr_base;", "xen_pfn_t *pfns;", "int *VAR_3;", "unsigned int VAR_4, VAR_5;", "target_phys_addr_t nb_pfn = VAR_1 >> XC_PAGE_SHIFT;", "trace_qemu_remap_bucket(VAR_2);", "pfns = qemu_mallocz(nb_pfn * sizeof (xen_pfn_t));", "VAR_3 = qemu_mallocz(nb_pfn * sizeof (int));", "if (VAR_0->vaddr_base != NULL) {", "if (munmap(VAR_0->vaddr_base, VAR_1) != 0) {", "perror(\"unmap fails\");", "exit(-1);", "}", "}", "for (VAR_4 = 0; VAR_4 < nb_pfn; VAR_4++) {", "pfns[VAR_4] = (VAR_2 << (MCACHE_BUCKET_SHIFT-XC_PAGE_SHIFT)) + VAR_4;", "}", "vaddr_base = xc_map_foreign_bulk(xen_xc, xen_domid, PROT_READ|PROT_WRITE,\npfns, VAR_3, nb_pfn);", "if (vaddr_base == NULL) {", "perror(\"xc_map_foreign_bulk\");", "exit(-1);", "}", "VAR_0->vaddr_base = vaddr_base;", "VAR_0->paddr_index = VAR_2;", "for (VAR_4 = 0; VAR_4 < nb_pfn; VAR_4 += BITS_PER_LONG) {", "unsigned long word = 0;", "if ((VAR_4 + BITS_PER_LONG) > nb_pfn) {", "VAR_5 = nb_pfn % BITS_PER_LONG;", "} else {", "VAR_5 = BITS_PER_LONG;", "}", "while (VAR_5 > 0) {", "word = (word << 1) | !VAR_3[VAR_4 + --VAR_5];", "}", "VAR_0->valid_mapping[VAR_4 / BITS_PER_LONG] = word;", "}", "qemu_free(pfns);", "qemu_free(VAR_3);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 53, 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99 ], [ 101 ], [ 103 ] ]
10,132
uint64_t kvmppc_hash64_read_pteg(PowerPCCPU *cpu, target_ulong pte_index) { int htab_fd; struct kvm_get_htab_fd ghf; struct kvm_get_htab_buf *hpte_buf; ghf.flags = 0; ghf.start_index = pte_index; htab_fd = kvm_vm_ioctl(kvm_state, KVM_PPC_GET_HTAB_FD, &ghf); if (htab_fd < 0) { goto error_out; } hpte_buf = g_malloc0(sizeof(*hpte_buf)); /* * Read the hpte group */ if (read(htab_fd, hpte_buf, sizeof(*hpte_buf)) < 0) { goto out_close; } close(htab_fd); return (uint64_t)(uintptr_t) hpte_buf->hpte; out_close: g_free(hpte_buf); close(htab_fd); error_out: return 0; }
false
qemu
1ad9f0a464fe78d30ee60b3629f7a825cf2fab13
uint64_t kvmppc_hash64_read_pteg(PowerPCCPU *cpu, target_ulong pte_index) { int htab_fd; struct kvm_get_htab_fd ghf; struct kvm_get_htab_buf *hpte_buf; ghf.flags = 0; ghf.start_index = pte_index; htab_fd = kvm_vm_ioctl(kvm_state, KVM_PPC_GET_HTAB_FD, &ghf); if (htab_fd < 0) { goto error_out; } hpte_buf = g_malloc0(sizeof(*hpte_buf)); if (read(htab_fd, hpte_buf, sizeof(*hpte_buf)) < 0) { goto out_close; } close(htab_fd); return (uint64_t)(uintptr_t) hpte_buf->hpte; out_close: g_free(hpte_buf); close(htab_fd); error_out: return 0; }
{ "code": [], "line_no": [] }
uint64_t FUNC_0(PowerPCCPU *cpu, target_ulong pte_index) { int VAR_0; struct kvm_get_htab_fd VAR_1; struct kvm_get_htab_buf *VAR_2; VAR_1.flags = 0; VAR_1.start_index = pte_index; VAR_0 = kvm_vm_ioctl(kvm_state, KVM_PPC_GET_HTAB_FD, &VAR_1); if (VAR_0 < 0) { goto error_out; } VAR_2 = g_malloc0(sizeof(*VAR_2)); if (read(VAR_0, VAR_2, sizeof(*VAR_2)) < 0) { goto out_close; } close(VAR_0); return (uint64_t)(uintptr_t) VAR_2->hpte; out_close: g_free(VAR_2); close(VAR_0); error_out: return 0; }
[ "uint64_t FUNC_0(PowerPCCPU *cpu, target_ulong pte_index)\n{", "int VAR_0;", "struct kvm_get_htab_fd VAR_1;", "struct kvm_get_htab_buf *VAR_2;", "VAR_1.flags = 0;", "VAR_1.start_index = pte_index;", "VAR_0 = kvm_vm_ioctl(kvm_state, KVM_PPC_GET_HTAB_FD, &VAR_1);", "if (VAR_0 < 0) {", "goto error_out;", "}", "VAR_2 = g_malloc0(sizeof(*VAR_2));", "if (read(VAR_0, VAR_2, sizeof(*VAR_2)) < 0) {", "goto out_close;", "}", "close(VAR_0);", "return (uint64_t)(uintptr_t) VAR_2->hpte;", "out_close:\ng_free(VAR_2);", "close(VAR_0);", "error_out:\nreturn 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 49, 51 ], [ 53 ], [ 55, 57 ], [ 59 ] ]
10,134
static void xenfb_guest_copy(struct XenFB *xenfb, int x, int y, int w, int h) { DisplaySurface *surface = qemu_console_surface(xenfb->c.con); int line, oops = 0; int bpp = surface_bits_per_pixel(surface); int linesize = surface_stride(surface); uint8_t *data = surface_data(surface); if (!is_buffer_shared(surface)) { switch (xenfb->depth) { case 8: if (bpp == 16) { BLT(uint8_t, uint16_t, 3, 3, 2, 5, 6, 5); } else if (bpp == 32) { BLT(uint8_t, uint32_t, 3, 3, 2, 8, 8, 8); } else { oops = 1; } break; case 24: if (bpp == 16) { BLT(uint32_t, uint16_t, 8, 8, 8, 5, 6, 5); } else if (bpp == 32) { BLT(uint32_t, uint32_t, 8, 8, 8, 8, 8, 8); } else { oops = 1; } break; default: oops = 1; } } if (oops) /* should not happen */ xen_pv_printf(&xenfb->c.xendev, 0, "%s: oops: convert %d -> %d bpp?\n", __FUNCTION__, xenfb->depth, bpp); dpy_gfx_update(xenfb->c.con, x, y, w, h); }
false
qemu
9f2130f58d5dd4e1fcb435cca08bf77e7c32e6c6
static void xenfb_guest_copy(struct XenFB *xenfb, int x, int y, int w, int h) { DisplaySurface *surface = qemu_console_surface(xenfb->c.con); int line, oops = 0; int bpp = surface_bits_per_pixel(surface); int linesize = surface_stride(surface); uint8_t *data = surface_data(surface); if (!is_buffer_shared(surface)) { switch (xenfb->depth) { case 8: if (bpp == 16) { BLT(uint8_t, uint16_t, 3, 3, 2, 5, 6, 5); } else if (bpp == 32) { BLT(uint8_t, uint32_t, 3, 3, 2, 8, 8, 8); } else { oops = 1; } break; case 24: if (bpp == 16) { BLT(uint32_t, uint16_t, 8, 8, 8, 5, 6, 5); } else if (bpp == 32) { BLT(uint32_t, uint32_t, 8, 8, 8, 8, 8, 8); } else { oops = 1; } break; default: oops = 1; } } if (oops) xen_pv_printf(&xenfb->c.xendev, 0, "%s: oops: convert %d -> %d bpp?\n", __FUNCTION__, xenfb->depth, bpp); dpy_gfx_update(xenfb->c.con, x, y, w, h); }
{ "code": [], "line_no": [] }
static void FUNC_0(struct XenFB *VAR_0, int VAR_1, int VAR_2, int VAR_3, int VAR_4) { DisplaySurface *surface = qemu_console_surface(VAR_0->c.con); int VAR_5, VAR_6 = 0; int VAR_7 = surface_bits_per_pixel(surface); int VAR_8 = surface_stride(surface); uint8_t *data = surface_data(surface); if (!is_buffer_shared(surface)) { switch (VAR_0->depth) { case 8: if (VAR_7 == 16) { BLT(uint8_t, uint16_t, 3, 3, 2, 5, 6, 5); } else if (VAR_7 == 32) { BLT(uint8_t, uint32_t, 3, 3, 2, 8, 8, 8); } else { VAR_6 = 1; } break; case 24: if (VAR_7 == 16) { BLT(uint32_t, uint16_t, 8, 8, 8, 5, 6, 5); } else if (VAR_7 == 32) { BLT(uint32_t, uint32_t, 8, 8, 8, 8, 8, 8); } else { VAR_6 = 1; } break; default: VAR_6 = 1; } } if (VAR_6) xen_pv_printf(&VAR_0->c.xendev, 0, "%s: VAR_6: convert %d -> %d VAR_7?\n", __FUNCTION__, VAR_0->depth, VAR_7); dpy_gfx_update(VAR_0->c.con, VAR_1, VAR_2, VAR_3, VAR_4); }
[ "static void FUNC_0(struct XenFB *VAR_0, int VAR_1, int VAR_2, int VAR_3, int VAR_4)\n{", "DisplaySurface *surface = qemu_console_surface(VAR_0->c.con);", "int VAR_5, VAR_6 = 0;", "int VAR_7 = surface_bits_per_pixel(surface);", "int VAR_8 = surface_stride(surface);", "uint8_t *data = surface_data(surface);", "if (!is_buffer_shared(surface)) {", "switch (VAR_0->depth) {", "case 8:\nif (VAR_7 == 16) {", "BLT(uint8_t, uint16_t, 3, 3, 2, 5, 6, 5);", "} else if (VAR_7 == 32) {", "BLT(uint8_t, uint32_t, 3, 3, 2, 8, 8, 8);", "} else {", "VAR_6 = 1;", "}", "break;", "case 24:\nif (VAR_7 == 16) {", "BLT(uint32_t, uint16_t, 8, 8, 8, 5, 6, 5);", "} else if (VAR_7 == 32) {", "BLT(uint32_t, uint32_t, 8, 8, 8, 8, 8, 8);", "} else {", "VAR_6 = 1;", "}", "break;", "default:\nVAR_6 = 1;", "}", "}", "if (VAR_6)\nxen_pv_printf(&VAR_0->c.xendev, 0, \"%s: VAR_6: convert %d -> %d VAR_7?\\n\",\n__FUNCTION__, VAR_0->depth, VAR_7);", "dpy_gfx_update(VAR_0->c.con, VAR_1, VAR_2, VAR_3, VAR_4);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 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 ], [ 73 ], [ 75 ] ]
10,135
DISAS_INSN(fbcc) { uint32_t offset; uint32_t addr; TCGv flag; int l1; addr = s->pc; offset = cpu_ldsw_code(env, s->pc); s->pc += 2; if (insn & (1 << 6)) { offset = (offset << 16) | cpu_lduw_code(env, s->pc); s->pc += 2; } l1 = gen_new_label(); /* TODO: Raise BSUN exception. */ flag = tcg_temp_new(); gen_helper_compare_f64(flag, cpu_env, QREG_FP_RESULT); /* Jump to l1 if condition is true. */ switch (insn & 0xf) { case 0: /* f */ break; case 1: /* eq (=0) */ tcg_gen_brcond_i32(TCG_COND_EQ, flag, tcg_const_i32(0), l1); break; case 2: /* ogt (=1) */ tcg_gen_brcond_i32(TCG_COND_EQ, flag, tcg_const_i32(1), l1); break; case 3: /* oge (=0 or =1) */ tcg_gen_brcond_i32(TCG_COND_LEU, flag, tcg_const_i32(1), l1); break; case 4: /* olt (=-1) */ tcg_gen_brcond_i32(TCG_COND_LT, flag, tcg_const_i32(0), l1); break; case 5: /* ole (=-1 or =0) */ tcg_gen_brcond_i32(TCG_COND_LE, flag, tcg_const_i32(0), l1); break; case 6: /* ogl (=-1 or =1) */ tcg_gen_andi_i32(flag, flag, 1); tcg_gen_brcond_i32(TCG_COND_NE, flag, tcg_const_i32(0), l1); break; case 7: /* or (=2) */ tcg_gen_brcond_i32(TCG_COND_EQ, flag, tcg_const_i32(2), l1); break; case 8: /* un (<2) */ tcg_gen_brcond_i32(TCG_COND_LT, flag, tcg_const_i32(2), l1); break; case 9: /* ueq (=0 or =2) */ tcg_gen_andi_i32(flag, flag, 1); tcg_gen_brcond_i32(TCG_COND_EQ, flag, tcg_const_i32(0), l1); break; case 10: /* ugt (>0) */ tcg_gen_brcond_i32(TCG_COND_GT, flag, tcg_const_i32(0), l1); break; case 11: /* uge (>=0) */ tcg_gen_brcond_i32(TCG_COND_GE, flag, tcg_const_i32(0), l1); break; case 12: /* ult (=-1 or =2) */ tcg_gen_brcond_i32(TCG_COND_GEU, flag, tcg_const_i32(2), l1); break; case 13: /* ule (!=1) */ tcg_gen_brcond_i32(TCG_COND_NE, flag, tcg_const_i32(1), l1); break; case 14: /* ne (!=0) */ tcg_gen_brcond_i32(TCG_COND_NE, flag, tcg_const_i32(0), l1); break; case 15: /* t */ tcg_gen_br(l1); break; } gen_jmp_tb(s, 0, s->pc); gen_set_label(l1); gen_jmp_tb(s, 1, addr + offset); }
false
qemu
42a268c241183877192c376d03bd9b6d527407c7
DISAS_INSN(fbcc) { uint32_t offset; uint32_t addr; TCGv flag; int l1; addr = s->pc; offset = cpu_ldsw_code(env, s->pc); s->pc += 2; if (insn & (1 << 6)) { offset = (offset << 16) | cpu_lduw_code(env, s->pc); s->pc += 2; } l1 = gen_new_label(); flag = tcg_temp_new(); gen_helper_compare_f64(flag, cpu_env, QREG_FP_RESULT); switch (insn & 0xf) { case 0: break; case 1: tcg_gen_brcond_i32(TCG_COND_EQ, flag, tcg_const_i32(0), l1); break; case 2: tcg_gen_brcond_i32(TCG_COND_EQ, flag, tcg_const_i32(1), l1); break; case 3: tcg_gen_brcond_i32(TCG_COND_LEU, flag, tcg_const_i32(1), l1); break; case 4: tcg_gen_brcond_i32(TCG_COND_LT, flag, tcg_const_i32(0), l1); break; case 5: tcg_gen_brcond_i32(TCG_COND_LE, flag, tcg_const_i32(0), l1); break; case 6: tcg_gen_andi_i32(flag, flag, 1); tcg_gen_brcond_i32(TCG_COND_NE, flag, tcg_const_i32(0), l1); break; case 7: tcg_gen_brcond_i32(TCG_COND_EQ, flag, tcg_const_i32(2), l1); break; case 8: tcg_gen_brcond_i32(TCG_COND_LT, flag, tcg_const_i32(2), l1); break; case 9: tcg_gen_andi_i32(flag, flag, 1); tcg_gen_brcond_i32(TCG_COND_EQ, flag, tcg_const_i32(0), l1); break; case 10: tcg_gen_brcond_i32(TCG_COND_GT, flag, tcg_const_i32(0), l1); break; case 11: tcg_gen_brcond_i32(TCG_COND_GE, flag, tcg_const_i32(0), l1); break; case 12: tcg_gen_brcond_i32(TCG_COND_GEU, flag, tcg_const_i32(2), l1); break; case 13: tcg_gen_brcond_i32(TCG_COND_NE, flag, tcg_const_i32(1), l1); break; case 14: tcg_gen_brcond_i32(TCG_COND_NE, flag, tcg_const_i32(0), l1); break; case 15: tcg_gen_br(l1); break; } gen_jmp_tb(s, 0, s->pc); gen_set_label(l1); gen_jmp_tb(s, 1, addr + offset); }
{ "code": [], "line_no": [] }
FUNC_0(VAR_0) { uint32_t offset; uint32_t addr; TCGv flag; int VAR_1; addr = s->pc; offset = cpu_ldsw_code(env, s->pc); s->pc += 2; if (insn & (1 << 6)) { offset = (offset << 16) | cpu_lduw_code(env, s->pc); s->pc += 2; } VAR_1 = gen_new_label(); flag = tcg_temp_new(); gen_helper_compare_f64(flag, cpu_env, QREG_FP_RESULT); switch (insn & 0xf) { case 0: break; case 1: tcg_gen_brcond_i32(TCG_COND_EQ, flag, tcg_const_i32(0), VAR_1); break; case 2: tcg_gen_brcond_i32(TCG_COND_EQ, flag, tcg_const_i32(1), VAR_1); break; case 3: tcg_gen_brcond_i32(TCG_COND_LEU, flag, tcg_const_i32(1), VAR_1); break; case 4: tcg_gen_brcond_i32(TCG_COND_LT, flag, tcg_const_i32(0), VAR_1); break; case 5: tcg_gen_brcond_i32(TCG_COND_LE, flag, tcg_const_i32(0), VAR_1); break; case 6: tcg_gen_andi_i32(flag, flag, 1); tcg_gen_brcond_i32(TCG_COND_NE, flag, tcg_const_i32(0), VAR_1); break; case 7: tcg_gen_brcond_i32(TCG_COND_EQ, flag, tcg_const_i32(2), VAR_1); break; case 8: tcg_gen_brcond_i32(TCG_COND_LT, flag, tcg_const_i32(2), VAR_1); break; case 9: tcg_gen_andi_i32(flag, flag, 1); tcg_gen_brcond_i32(TCG_COND_EQ, flag, tcg_const_i32(0), VAR_1); break; case 10: tcg_gen_brcond_i32(TCG_COND_GT, flag, tcg_const_i32(0), VAR_1); break; case 11: tcg_gen_brcond_i32(TCG_COND_GE, flag, tcg_const_i32(0), VAR_1); break; case 12: tcg_gen_brcond_i32(TCG_COND_GEU, flag, tcg_const_i32(2), VAR_1); break; case 13: tcg_gen_brcond_i32(TCG_COND_NE, flag, tcg_const_i32(1), VAR_1); break; case 14: tcg_gen_brcond_i32(TCG_COND_NE, flag, tcg_const_i32(0), VAR_1); break; case 15: tcg_gen_br(VAR_1); break; } gen_jmp_tb(s, 0, s->pc); gen_set_label(VAR_1); gen_jmp_tb(s, 1, addr + offset); }
[ "FUNC_0(VAR_0)\n{", "uint32_t offset;", "uint32_t addr;", "TCGv flag;", "int VAR_1;", "addr = s->pc;", "offset = cpu_ldsw_code(env, s->pc);", "s->pc += 2;", "if (insn & (1 << 6)) {", "offset = (offset << 16) | cpu_lduw_code(env, s->pc);", "s->pc += 2;", "}", "VAR_1 = gen_new_label();", "flag = tcg_temp_new();", "gen_helper_compare_f64(flag, cpu_env, QREG_FP_RESULT);", "switch (insn & 0xf) {", "case 0:\nbreak;", "case 1:\ntcg_gen_brcond_i32(TCG_COND_EQ, flag, tcg_const_i32(0), VAR_1);", "break;", "case 2:\ntcg_gen_brcond_i32(TCG_COND_EQ, flag, tcg_const_i32(1), VAR_1);", "break;", "case 3:\ntcg_gen_brcond_i32(TCG_COND_LEU, flag, tcg_const_i32(1), VAR_1);", "break;", "case 4:\ntcg_gen_brcond_i32(TCG_COND_LT, flag, tcg_const_i32(0), VAR_1);", "break;", "case 5:\ntcg_gen_brcond_i32(TCG_COND_LE, flag, tcg_const_i32(0), VAR_1);", "break;", "case 6:\ntcg_gen_andi_i32(flag, flag, 1);", "tcg_gen_brcond_i32(TCG_COND_NE, flag, tcg_const_i32(0), VAR_1);", "break;", "case 7:\ntcg_gen_brcond_i32(TCG_COND_EQ, flag, tcg_const_i32(2), VAR_1);", "break;", "case 8:\ntcg_gen_brcond_i32(TCG_COND_LT, flag, tcg_const_i32(2), VAR_1);", "break;", "case 9:\ntcg_gen_andi_i32(flag, flag, 1);", "tcg_gen_brcond_i32(TCG_COND_EQ, flag, tcg_const_i32(0), VAR_1);", "break;", "case 10:\ntcg_gen_brcond_i32(TCG_COND_GT, flag, tcg_const_i32(0), VAR_1);", "break;", "case 11:\ntcg_gen_brcond_i32(TCG_COND_GE, flag, tcg_const_i32(0), VAR_1);", "break;", "case 12:\ntcg_gen_brcond_i32(TCG_COND_GEU, flag, tcg_const_i32(2), VAR_1);", "break;", "case 13:\ntcg_gen_brcond_i32(TCG_COND_NE, flag, tcg_const_i32(1), VAR_1);", "break;", "case 14:\ntcg_gen_brcond_i32(TCG_COND_NE, flag, tcg_const_i32(0), VAR_1);", "break;", "case 15:\ntcg_gen_br(VAR_1);", "break;", "}", "gen_jmp_tb(s, 0, s->pc);", "gen_set_label(VAR_1);", "gen_jmp_tb(s, 1, addr + offset);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 35 ], [ 37 ], [ 41 ], [ 43, 45 ], [ 47, 49 ], [ 51 ], [ 53, 55 ], [ 57 ], [ 59, 61 ], [ 63 ], [ 65, 67 ], [ 69 ], [ 71, 73 ], [ 75 ], [ 77, 79 ], [ 81 ], [ 83 ], [ 85, 87 ], [ 89 ], [ 91, 93 ], [ 95 ], [ 97, 99 ], [ 101 ], [ 103 ], [ 105, 107 ], [ 109 ], [ 111, 113 ], [ 115 ], [ 117, 119 ], [ 121 ], [ 123, 125 ], [ 127 ], [ 129, 131 ], [ 133 ], [ 135, 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ] ]
10,138
int omap_validate_local_addr(struct omap_mpu_state_s *s, target_phys_addr_t addr) { return addr >= OMAP_LOCALBUS_BASE && addr < OMAP_LOCALBUS_BASE + 0x1000000; }
false
qemu
b854bc196f5c4b4e3299c0b0ee63cf828ece9e77
int omap_validate_local_addr(struct omap_mpu_state_s *s, target_phys_addr_t addr) { return addr >= OMAP_LOCALBUS_BASE && addr < OMAP_LOCALBUS_BASE + 0x1000000; }
{ "code": [], "line_no": [] }
int FUNC_0(struct omap_mpu_state_s *VAR_0, target_phys_addr_t VAR_1) { return VAR_1 >= OMAP_LOCALBUS_BASE && VAR_1 < OMAP_LOCALBUS_BASE + 0x1000000; }
[ "int FUNC_0(struct omap_mpu_state_s *VAR_0,\ntarget_phys_addr_t VAR_1)\n{", "return VAR_1 >= OMAP_LOCALBUS_BASE && VAR_1 < OMAP_LOCALBUS_BASE + 0x1000000;", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ] ]
10,139
static void build_pci_bus_state_init(AcpiBuildPciBusHotplugState *state, AcpiBuildPciBusHotplugState *parent, bool pcihp_bridge_en) { state->parent = parent; state->device_table = build_alloc_array(); state->notify_table = build_alloc_array(); state->pcihp_bridge_en = pcihp_bridge_en; }
false
qemu
b23046abe78f48498a423b802d6d86ba0172d57f
static void build_pci_bus_state_init(AcpiBuildPciBusHotplugState *state, AcpiBuildPciBusHotplugState *parent, bool pcihp_bridge_en) { state->parent = parent; state->device_table = build_alloc_array(); state->notify_table = build_alloc_array(); state->pcihp_bridge_en = pcihp_bridge_en; }
{ "code": [], "line_no": [] }
static void FUNC_0(AcpiBuildPciBusHotplugState *VAR_0, AcpiBuildPciBusHotplugState *VAR_1, bool VAR_2) { VAR_0->VAR_1 = VAR_1; VAR_0->device_table = build_alloc_array(); VAR_0->notify_table = build_alloc_array(); VAR_0->VAR_2 = VAR_2; }
[ "static void FUNC_0(AcpiBuildPciBusHotplugState *VAR_0,\nAcpiBuildPciBusHotplugState *VAR_1,\nbool VAR_2)\n{", "VAR_0->VAR_1 = VAR_1;", "VAR_0->device_table = build_alloc_array();", "VAR_0->notify_table = build_alloc_array();", "VAR_0->VAR_2 = VAR_2;", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ] ]
10,140
int ff_MPV_encode_picture(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *pic_arg, int *got_packet) { MpegEncContext *s = avctx->priv_data; int i, stuffing_count, ret; int context_count = s->slice_context_count; s->picture_in_gop_number++; if (load_input_picture(s, pic_arg) < 0) return -1; if (select_input_picture(s) < 0) { return -1; } /* output? */ if (s->new_picture.f->data[0]) { if (!pkt->data && (ret = ff_alloc_packet(pkt, s->mb_width*s->mb_height*MAX_MB_BYTES)) < 0) return ret; if (s->mb_info) { s->mb_info_ptr = av_packet_new_side_data(pkt, AV_PKT_DATA_H263_MB_INFO, s->mb_width*s->mb_height*12); s->prev_mb_info = s->last_mb_info = s->mb_info_size = 0; } for (i = 0; i < context_count; i++) { int start_y = s->thread_context[i]->start_mb_y; int end_y = s->thread_context[i]-> end_mb_y; int h = s->mb_height; uint8_t *start = pkt->data + (size_t)(((int64_t) pkt->size) * start_y / h); uint8_t *end = pkt->data + (size_t)(((int64_t) pkt->size) * end_y / h); init_put_bits(&s->thread_context[i]->pb, start, end - start); } s->pict_type = s->new_picture.f->pict_type; //emms_c(); ret = frame_start(s); if (ret < 0) return ret; vbv_retry: if (encode_picture(s, s->picture_number) < 0) return -1; avctx->header_bits = s->header_bits; avctx->mv_bits = s->mv_bits; avctx->misc_bits = s->misc_bits; avctx->i_tex_bits = s->i_tex_bits; avctx->p_tex_bits = s->p_tex_bits; avctx->i_count = s->i_count; // FIXME f/b_count in avctx avctx->p_count = s->mb_num - s->i_count - s->skip_count; avctx->skip_count = s->skip_count; frame_end(s); if (CONFIG_MJPEG_ENCODER && s->out_format == FMT_MJPEG) ff_mjpeg_encode_picture_trailer(&s->pb, s->header_bits); if (avctx->rc_buffer_size) { RateControlContext *rcc = &s->rc_context; int max_size = rcc->buffer_index * avctx->rc_max_available_vbv_use; if (put_bits_count(&s->pb) > max_size && s->lambda < s->avctx->lmax) { s->next_lambda = FFMAX(s->lambda + 1, s->lambda * (s->qscale + 1) / s->qscale); if (s->adaptive_quant) { int i; for (i = 0; i < s->mb_height * s->mb_stride; i++) s->lambda_table[i] = FFMAX(s->lambda_table[i] + 1, s->lambda_table[i] * (s->qscale + 1) / s->qscale); } s->mb_skipped = 0; // done in frame_start() // done in encode_picture() so we must undo it if (s->pict_type == AV_PICTURE_TYPE_P) { if (s->flipflop_rounding || s->codec_id == AV_CODEC_ID_H263P || s->codec_id == AV_CODEC_ID_MPEG4) s->no_rounding ^= 1; } if (s->pict_type != AV_PICTURE_TYPE_B) { s->time_base = s->last_time_base; s->last_non_b_time = s->time - s->pp_time; } for (i = 0; i < context_count; i++) { PutBitContext *pb = &s->thread_context[i]->pb; init_put_bits(pb, pb->buf, pb->buf_end - pb->buf); } goto vbv_retry; } assert(s->avctx->rc_max_rate); } if (s->flags & CODEC_FLAG_PASS1) ff_write_pass1_stats(s); for (i = 0; i < 4; i++) { s->current_picture_ptr->f->error[i] = s->current_picture.f->error[i]; avctx->error[i] += s->current_picture_ptr->f->error[i]; } if (s->flags & CODEC_FLAG_PASS1) assert(avctx->header_bits + avctx->mv_bits + avctx->misc_bits + avctx->i_tex_bits + avctx->p_tex_bits == put_bits_count(&s->pb)); flush_put_bits(&s->pb); s->frame_bits = put_bits_count(&s->pb); stuffing_count = ff_vbv_update(s, s->frame_bits); if (stuffing_count) { if (s->pb.buf_end - s->pb.buf - (put_bits_count(&s->pb) >> 3) < stuffing_count + 50) { av_log(s->avctx, AV_LOG_ERROR, "stuffing too large\n"); return -1; } switch (s->codec_id) { case AV_CODEC_ID_MPEG1VIDEO: case AV_CODEC_ID_MPEG2VIDEO: while (stuffing_count--) { put_bits(&s->pb, 8, 0); } break; case AV_CODEC_ID_MPEG4: put_bits(&s->pb, 16, 0); put_bits(&s->pb, 16, 0x1C3); stuffing_count -= 4; while (stuffing_count--) { put_bits(&s->pb, 8, 0xFF); } break; default: av_log(s->avctx, AV_LOG_ERROR, "vbv buffer overflow\n"); } flush_put_bits(&s->pb); s->frame_bits = put_bits_count(&s->pb); } /* update mpeg1/2 vbv_delay for CBR */ if (s->avctx->rc_max_rate && s->avctx->rc_min_rate == s->avctx->rc_max_rate && s->out_format == FMT_MPEG1 && 90000LL * (avctx->rc_buffer_size - 1) <= s->avctx->rc_max_rate * 0xFFFFLL) { int vbv_delay, min_delay; double inbits = s->avctx->rc_max_rate * av_q2d(s->avctx->time_base); int minbits = s->frame_bits - 8 * (s->vbv_delay_ptr - s->pb.buf - 1); double bits = s->rc_context.buffer_index + minbits - inbits; if (bits < 0) av_log(s->avctx, AV_LOG_ERROR, "Internal error, negative bits\n"); assert(s->repeat_first_field == 0); vbv_delay = bits * 90000 / s->avctx->rc_max_rate; min_delay = (minbits * 90000LL + s->avctx->rc_max_rate - 1) / s->avctx->rc_max_rate; vbv_delay = FFMAX(vbv_delay, min_delay); assert(vbv_delay < 0xFFFF); s->vbv_delay_ptr[0] &= 0xF8; s->vbv_delay_ptr[0] |= vbv_delay >> 13; s->vbv_delay_ptr[1] = vbv_delay >> 5; s->vbv_delay_ptr[2] &= 0x07; s->vbv_delay_ptr[2] |= vbv_delay << 3; avctx->vbv_delay = vbv_delay * 300; } s->total_bits += s->frame_bits; avctx->frame_bits = s->frame_bits; pkt->pts = s->current_picture.f->pts; if (!s->low_delay) { if (!s->current_picture.f->coded_picture_number) pkt->dts = pkt->pts - s->dts_delta; else pkt->dts = s->reordered_pts; s->reordered_pts = s->input_picture[0]->f->pts; } else pkt->dts = pkt->pts; if (s->current_picture.f->key_frame) pkt->flags |= AV_PKT_FLAG_KEY; if (s->mb_info) av_packet_shrink_side_data(pkt, AV_PKT_DATA_H263_MB_INFO, s->mb_info_size); } else { s->frame_bits = 0; } assert((s->frame_bits & 7) == 0); pkt->size = s->frame_bits / 8; *got_packet = !!pkt->size; return 0; }
false
FFmpeg
1c7b71a5bdb88ebb69734100405bbb5441b871e8
int ff_MPV_encode_picture(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *pic_arg, int *got_packet) { MpegEncContext *s = avctx->priv_data; int i, stuffing_count, ret; int context_count = s->slice_context_count; s->picture_in_gop_number++; if (load_input_picture(s, pic_arg) < 0) return -1; if (select_input_picture(s) < 0) { return -1; } if (s->new_picture.f->data[0]) { if (!pkt->data && (ret = ff_alloc_packet(pkt, s->mb_width*s->mb_height*MAX_MB_BYTES)) < 0) return ret; if (s->mb_info) { s->mb_info_ptr = av_packet_new_side_data(pkt, AV_PKT_DATA_H263_MB_INFO, s->mb_width*s->mb_height*12); s->prev_mb_info = s->last_mb_info = s->mb_info_size = 0; } for (i = 0; i < context_count; i++) { int start_y = s->thread_context[i]->start_mb_y; int end_y = s->thread_context[i]-> end_mb_y; int h = s->mb_height; uint8_t *start = pkt->data + (size_t)(((int64_t) pkt->size) * start_y / h); uint8_t *end = pkt->data + (size_t)(((int64_t) pkt->size) * end_y / h); init_put_bits(&s->thread_context[i]->pb, start, end - start); } s->pict_type = s->new_picture.f->pict_type; ret = frame_start(s); if (ret < 0) return ret; vbv_retry: if (encode_picture(s, s->picture_number) < 0) return -1; avctx->header_bits = s->header_bits; avctx->mv_bits = s->mv_bits; avctx->misc_bits = s->misc_bits; avctx->i_tex_bits = s->i_tex_bits; avctx->p_tex_bits = s->p_tex_bits; avctx->i_count = s->i_count; avctx->p_count = s->mb_num - s->i_count - s->skip_count; avctx->skip_count = s->skip_count; frame_end(s); if (CONFIG_MJPEG_ENCODER && s->out_format == FMT_MJPEG) ff_mjpeg_encode_picture_trailer(&s->pb, s->header_bits); if (avctx->rc_buffer_size) { RateControlContext *rcc = &s->rc_context; int max_size = rcc->buffer_index * avctx->rc_max_available_vbv_use; if (put_bits_count(&s->pb) > max_size && s->lambda < s->avctx->lmax) { s->next_lambda = FFMAX(s->lambda + 1, s->lambda * (s->qscale + 1) / s->qscale); if (s->adaptive_quant) { int i; for (i = 0; i < s->mb_height * s->mb_stride; i++) s->lambda_table[i] = FFMAX(s->lambda_table[i] + 1, s->lambda_table[i] * (s->qscale + 1) / s->qscale); } s->mb_skipped = 0; if (s->pict_type == AV_PICTURE_TYPE_P) { if (s->flipflop_rounding || s->codec_id == AV_CODEC_ID_H263P || s->codec_id == AV_CODEC_ID_MPEG4) s->no_rounding ^= 1; } if (s->pict_type != AV_PICTURE_TYPE_B) { s->time_base = s->last_time_base; s->last_non_b_time = s->time - s->pp_time; } for (i = 0; i < context_count; i++) { PutBitContext *pb = &s->thread_context[i]->pb; init_put_bits(pb, pb->buf, pb->buf_end - pb->buf); } goto vbv_retry; } assert(s->avctx->rc_max_rate); } if (s->flags & CODEC_FLAG_PASS1) ff_write_pass1_stats(s); for (i = 0; i < 4; i++) { s->current_picture_ptr->f->error[i] = s->current_picture.f->error[i]; avctx->error[i] += s->current_picture_ptr->f->error[i]; } if (s->flags & CODEC_FLAG_PASS1) assert(avctx->header_bits + avctx->mv_bits + avctx->misc_bits + avctx->i_tex_bits + avctx->p_tex_bits == put_bits_count(&s->pb)); flush_put_bits(&s->pb); s->frame_bits = put_bits_count(&s->pb); stuffing_count = ff_vbv_update(s, s->frame_bits); if (stuffing_count) { if (s->pb.buf_end - s->pb.buf - (put_bits_count(&s->pb) >> 3) < stuffing_count + 50) { av_log(s->avctx, AV_LOG_ERROR, "stuffing too large\n"); return -1; } switch (s->codec_id) { case AV_CODEC_ID_MPEG1VIDEO: case AV_CODEC_ID_MPEG2VIDEO: while (stuffing_count--) { put_bits(&s->pb, 8, 0); } break; case AV_CODEC_ID_MPEG4: put_bits(&s->pb, 16, 0); put_bits(&s->pb, 16, 0x1C3); stuffing_count -= 4; while (stuffing_count--) { put_bits(&s->pb, 8, 0xFF); } break; default: av_log(s->avctx, AV_LOG_ERROR, "vbv buffer overflow\n"); } flush_put_bits(&s->pb); s->frame_bits = put_bits_count(&s->pb); } if (s->avctx->rc_max_rate && s->avctx->rc_min_rate == s->avctx->rc_max_rate && s->out_format == FMT_MPEG1 && 90000LL * (avctx->rc_buffer_size - 1) <= s->avctx->rc_max_rate * 0xFFFFLL) { int vbv_delay, min_delay; double inbits = s->avctx->rc_max_rate * av_q2d(s->avctx->time_base); int minbits = s->frame_bits - 8 * (s->vbv_delay_ptr - s->pb.buf - 1); double bits = s->rc_context.buffer_index + minbits - inbits; if (bits < 0) av_log(s->avctx, AV_LOG_ERROR, "Internal error, negative bits\n"); assert(s->repeat_first_field == 0); vbv_delay = bits * 90000 / s->avctx->rc_max_rate; min_delay = (minbits * 90000LL + s->avctx->rc_max_rate - 1) / s->avctx->rc_max_rate; vbv_delay = FFMAX(vbv_delay, min_delay); assert(vbv_delay < 0xFFFF); s->vbv_delay_ptr[0] &= 0xF8; s->vbv_delay_ptr[0] |= vbv_delay >> 13; s->vbv_delay_ptr[1] = vbv_delay >> 5; s->vbv_delay_ptr[2] &= 0x07; s->vbv_delay_ptr[2] |= vbv_delay << 3; avctx->vbv_delay = vbv_delay * 300; } s->total_bits += s->frame_bits; avctx->frame_bits = s->frame_bits; pkt->pts = s->current_picture.f->pts; if (!s->low_delay) { if (!s->current_picture.f->coded_picture_number) pkt->dts = pkt->pts - s->dts_delta; else pkt->dts = s->reordered_pts; s->reordered_pts = s->input_picture[0]->f->pts; } else pkt->dts = pkt->pts; if (s->current_picture.f->key_frame) pkt->flags |= AV_PKT_FLAG_KEY; if (s->mb_info) av_packet_shrink_side_data(pkt, AV_PKT_DATA_H263_MB_INFO, s->mb_info_size); } else { s->frame_bits = 0; } assert((s->frame_bits & 7) == 0); pkt->size = s->frame_bits / 8; *got_packet = !!pkt->size; return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(AVCodecContext *VAR_0, AVPacket *VAR_1, const AVFrame *VAR_2, int *VAR_3) { MpegEncContext *s = VAR_0->priv_data; int VAR_12, VAR_5, VAR_6; int VAR_7 = s->slice_context_count; s->picture_in_gop_number++; if (load_input_picture(s, VAR_2) < 0) return -1; if (select_input_picture(s) < 0) { return -1; } if (s->new_picture.f->data[0]) { if (!VAR_1->data && (VAR_6 = ff_alloc_packet(VAR_1, s->mb_width*s->mb_height*MAX_MB_BYTES)) < 0) return VAR_6; if (s->mb_info) { s->mb_info_ptr = av_packet_new_side_data(VAR_1, AV_PKT_DATA_H263_MB_INFO, s->mb_width*s->mb_height*12); s->prev_mb_info = s->last_mb_info = s->mb_info_size = 0; } for (VAR_12 = 0; VAR_12 < VAR_7; VAR_12++) { int VAR_8 = s->thread_context[VAR_12]->start_mb_y; int VAR_9 = s->thread_context[VAR_12]-> end_mb_y; int VAR_10 = s->mb_height; uint8_t *start = VAR_1->data + (size_t)(((int64_t) VAR_1->size) * VAR_8 / VAR_10); uint8_t *end = VAR_1->data + (size_t)(((int64_t) VAR_1->size) * VAR_9 / VAR_10); init_put_bits(&s->thread_context[VAR_12]->pb, start, end - start); } s->pict_type = s->new_picture.f->pict_type; VAR_6 = frame_start(s); if (VAR_6 < 0) return VAR_6; vbv_retry: if (encode_picture(s, s->picture_number) < 0) return -1; VAR_0->header_bits = s->header_bits; VAR_0->mv_bits = s->mv_bits; VAR_0->misc_bits = s->misc_bits; VAR_0->i_tex_bits = s->i_tex_bits; VAR_0->p_tex_bits = s->p_tex_bits; VAR_0->i_count = s->i_count; VAR_0->p_count = s->mb_num - s->i_count - s->skip_count; VAR_0->skip_count = s->skip_count; frame_end(s); if (CONFIG_MJPEG_ENCODER && s->out_format == FMT_MJPEG) ff_mjpeg_encode_picture_trailer(&s->pb, s->header_bits); if (VAR_0->rc_buffer_size) { RateControlContext *rcc = &s->rc_context; int VAR_11 = rcc->buffer_index * VAR_0->rc_max_available_vbv_use; if (put_bits_count(&s->pb) > VAR_11 && s->lambda < s->VAR_0->lmax) { s->next_lambda = FFMAX(s->lambda + 1, s->lambda * (s->qscale + 1) / s->qscale); if (s->adaptive_quant) { int VAR_12; for (VAR_12 = 0; VAR_12 < s->mb_height * s->mb_stride; VAR_12++) s->lambda_table[VAR_12] = FFMAX(s->lambda_table[VAR_12] + 1, s->lambda_table[VAR_12] * (s->qscale + 1) / s->qscale); } s->mb_skipped = 0; if (s->pict_type == AV_PICTURE_TYPE_P) { if (s->flipflop_rounding || s->codec_id == AV_CODEC_ID_H263P || s->codec_id == AV_CODEC_ID_MPEG4) s->no_rounding ^= 1; } if (s->pict_type != AV_PICTURE_TYPE_B) { s->time_base = s->last_time_base; s->last_non_b_time = s->time - s->pp_time; } for (VAR_12 = 0; VAR_12 < VAR_7; VAR_12++) { PutBitContext *pb = &s->thread_context[VAR_12]->pb; init_put_bits(pb, pb->buf, pb->buf_end - pb->buf); } goto vbv_retry; } assert(s->VAR_0->rc_max_rate); } if (s->flags & CODEC_FLAG_PASS1) ff_write_pass1_stats(s); for (VAR_12 = 0; VAR_12 < 4; VAR_12++) { s->current_picture_ptr->f->error[VAR_12] = s->current_picture.f->error[VAR_12]; VAR_0->error[VAR_12] += s->current_picture_ptr->f->error[VAR_12]; } if (s->flags & CODEC_FLAG_PASS1) assert(VAR_0->header_bits + VAR_0->mv_bits + VAR_0->misc_bits + VAR_0->i_tex_bits + VAR_0->p_tex_bits == put_bits_count(&s->pb)); flush_put_bits(&s->pb); s->frame_bits = put_bits_count(&s->pb); VAR_5 = ff_vbv_update(s, s->frame_bits); if (VAR_5) { if (s->pb.buf_end - s->pb.buf - (put_bits_count(&s->pb) >> 3) < VAR_5 + 50) { av_log(s->VAR_0, AV_LOG_ERROR, "stuffing too large\n"); return -1; } switch (s->codec_id) { case AV_CODEC_ID_MPEG1VIDEO: case AV_CODEC_ID_MPEG2VIDEO: while (VAR_5--) { put_bits(&s->pb, 8, 0); } break; case AV_CODEC_ID_MPEG4: put_bits(&s->pb, 16, 0); put_bits(&s->pb, 16, 0x1C3); VAR_5 -= 4; while (VAR_5--) { put_bits(&s->pb, 8, 0xFF); } break; default: av_log(s->VAR_0, AV_LOG_ERROR, "vbv buffer overflow\n"); } flush_put_bits(&s->pb); s->frame_bits = put_bits_count(&s->pb); } if (s->VAR_0->rc_max_rate && s->VAR_0->rc_min_rate == s->VAR_0->rc_max_rate && s->out_format == FMT_MPEG1 && 90000LL * (VAR_0->rc_buffer_size - 1) <= s->VAR_0->rc_max_rate * 0xFFFFLL) { int VAR_12, VAR_13; double VAR_14 = s->VAR_0->rc_max_rate * av_q2d(s->VAR_0->time_base); int VAR_15 = s->frame_bits - 8 * (s->vbv_delay_ptr - s->pb.buf - 1); double VAR_16 = s->rc_context.buffer_index + VAR_15 - VAR_14; if (VAR_16 < 0) av_log(s->VAR_0, AV_LOG_ERROR, "Internal error, negative VAR_16\n"); assert(s->repeat_first_field == 0); VAR_12 = VAR_16 * 90000 / s->VAR_0->rc_max_rate; VAR_13 = (VAR_15 * 90000LL + s->VAR_0->rc_max_rate - 1) / s->VAR_0->rc_max_rate; VAR_12 = FFMAX(VAR_12, VAR_13); assert(VAR_12 < 0xFFFF); s->vbv_delay_ptr[0] &= 0xF8; s->vbv_delay_ptr[0] |= VAR_12 >> 13; s->vbv_delay_ptr[1] = VAR_12 >> 5; s->vbv_delay_ptr[2] &= 0x07; s->vbv_delay_ptr[2] |= VAR_12 << 3; VAR_0->VAR_12 = VAR_12 * 300; } s->total_bits += s->frame_bits; VAR_0->frame_bits = s->frame_bits; VAR_1->pts = s->current_picture.f->pts; if (!s->low_delay) { if (!s->current_picture.f->coded_picture_number) VAR_1->dts = VAR_1->pts - s->dts_delta; else VAR_1->dts = s->reordered_pts; s->reordered_pts = s->input_picture[0]->f->pts; } else VAR_1->dts = VAR_1->pts; if (s->current_picture.f->key_frame) VAR_1->flags |= AV_PKT_FLAG_KEY; if (s->mb_info) av_packet_shrink_side_data(VAR_1, AV_PKT_DATA_H263_MB_INFO, s->mb_info_size); } else { s->frame_bits = 0; } assert((s->frame_bits & 7) == 0); VAR_1->size = s->frame_bits / 8; *VAR_3 = !!VAR_1->size; return 0; }
[ "int FUNC_0(AVCodecContext *VAR_0, AVPacket *VAR_1,\nconst AVFrame *VAR_2, int *VAR_3)\n{", "MpegEncContext *s = VAR_0->priv_data;", "int VAR_12, VAR_5, VAR_6;", "int VAR_7 = s->slice_context_count;", "s->picture_in_gop_number++;", "if (load_input_picture(s, VAR_2) < 0)\nreturn -1;", "if (select_input_picture(s) < 0) {", "return -1;", "}", "if (s->new_picture.f->data[0]) {", "if (!VAR_1->data &&\n(VAR_6 = ff_alloc_packet(VAR_1, s->mb_width*s->mb_height*MAX_MB_BYTES)) < 0)\nreturn VAR_6;", "if (s->mb_info) {", "s->mb_info_ptr = av_packet_new_side_data(VAR_1,\nAV_PKT_DATA_H263_MB_INFO,\ns->mb_width*s->mb_height*12);", "s->prev_mb_info = s->last_mb_info = s->mb_info_size = 0;", "}", "for (VAR_12 = 0; VAR_12 < VAR_7; VAR_12++) {", "int VAR_8 = s->thread_context[VAR_12]->start_mb_y;", "int VAR_9 = s->thread_context[VAR_12]-> end_mb_y;", "int VAR_10 = s->mb_height;", "uint8_t *start = VAR_1->data + (size_t)(((int64_t) VAR_1->size) * VAR_8 / VAR_10);", "uint8_t *end = VAR_1->data + (size_t)(((int64_t) VAR_1->size) * VAR_9 / VAR_10);", "init_put_bits(&s->thread_context[VAR_12]->pb, start, end - start);", "}", "s->pict_type = s->new_picture.f->pict_type;", "VAR_6 = frame_start(s);", "if (VAR_6 < 0)\nreturn VAR_6;", "vbv_retry:\nif (encode_picture(s, s->picture_number) < 0)\nreturn -1;", "VAR_0->header_bits = s->header_bits;", "VAR_0->mv_bits = s->mv_bits;", "VAR_0->misc_bits = s->misc_bits;", "VAR_0->i_tex_bits = s->i_tex_bits;", "VAR_0->p_tex_bits = s->p_tex_bits;", "VAR_0->i_count = s->i_count;", "VAR_0->p_count = s->mb_num - s->i_count - s->skip_count;", "VAR_0->skip_count = s->skip_count;", "frame_end(s);", "if (CONFIG_MJPEG_ENCODER && s->out_format == FMT_MJPEG)\nff_mjpeg_encode_picture_trailer(&s->pb, s->header_bits);", "if (VAR_0->rc_buffer_size) {", "RateControlContext *rcc = &s->rc_context;", "int VAR_11 = rcc->buffer_index * VAR_0->rc_max_available_vbv_use;", "if (put_bits_count(&s->pb) > VAR_11 &&\ns->lambda < s->VAR_0->lmax) {", "s->next_lambda = FFMAX(s->lambda + 1, s->lambda *\n(s->qscale + 1) / s->qscale);", "if (s->adaptive_quant) {", "int VAR_12;", "for (VAR_12 = 0; VAR_12 < s->mb_height * s->mb_stride; VAR_12++)", "s->lambda_table[VAR_12] =\nFFMAX(s->lambda_table[VAR_12] + 1,\ns->lambda_table[VAR_12] * (s->qscale + 1) /\ns->qscale);", "}", "s->mb_skipped = 0;", "if (s->pict_type == AV_PICTURE_TYPE_P) {", "if (s->flipflop_rounding ||\ns->codec_id == AV_CODEC_ID_H263P ||\ns->codec_id == AV_CODEC_ID_MPEG4)\ns->no_rounding ^= 1;", "}", "if (s->pict_type != AV_PICTURE_TYPE_B) {", "s->time_base = s->last_time_base;", "s->last_non_b_time = s->time - s->pp_time;", "}", "for (VAR_12 = 0; VAR_12 < VAR_7; VAR_12++) {", "PutBitContext *pb = &s->thread_context[VAR_12]->pb;", "init_put_bits(pb, pb->buf, pb->buf_end - pb->buf);", "}", "goto vbv_retry;", "}", "assert(s->VAR_0->rc_max_rate);", "}", "if (s->flags & CODEC_FLAG_PASS1)\nff_write_pass1_stats(s);", "for (VAR_12 = 0; VAR_12 < 4; VAR_12++) {", "s->current_picture_ptr->f->error[VAR_12] = s->current_picture.f->error[VAR_12];", "VAR_0->error[VAR_12] += s->current_picture_ptr->f->error[VAR_12];", "}", "if (s->flags & CODEC_FLAG_PASS1)\nassert(VAR_0->header_bits + VAR_0->mv_bits + VAR_0->misc_bits +\nVAR_0->i_tex_bits + VAR_0->p_tex_bits ==\nput_bits_count(&s->pb));", "flush_put_bits(&s->pb);", "s->frame_bits = put_bits_count(&s->pb);", "VAR_5 = ff_vbv_update(s, s->frame_bits);", "if (VAR_5) {", "if (s->pb.buf_end - s->pb.buf - (put_bits_count(&s->pb) >> 3) <\nVAR_5 + 50) {", "av_log(s->VAR_0, AV_LOG_ERROR, \"stuffing too large\\n\");", "return -1;", "}", "switch (s->codec_id) {", "case AV_CODEC_ID_MPEG1VIDEO:\ncase AV_CODEC_ID_MPEG2VIDEO:\nwhile (VAR_5--) {", "put_bits(&s->pb, 8, 0);", "}", "break;", "case AV_CODEC_ID_MPEG4:\nput_bits(&s->pb, 16, 0);", "put_bits(&s->pb, 16, 0x1C3);", "VAR_5 -= 4;", "while (VAR_5--) {", "put_bits(&s->pb, 8, 0xFF);", "}", "break;", "default:\nav_log(s->VAR_0, AV_LOG_ERROR, \"vbv buffer overflow\\n\");", "}", "flush_put_bits(&s->pb);", "s->frame_bits = put_bits_count(&s->pb);", "}", "if (s->VAR_0->rc_max_rate &&\ns->VAR_0->rc_min_rate == s->VAR_0->rc_max_rate &&\ns->out_format == FMT_MPEG1 &&\n90000LL * (VAR_0->rc_buffer_size - 1) <=\ns->VAR_0->rc_max_rate * 0xFFFFLL) {", "int VAR_12, VAR_13;", "double VAR_14 = s->VAR_0->rc_max_rate *\nav_q2d(s->VAR_0->time_base);", "int VAR_15 = s->frame_bits - 8 *\n(s->vbv_delay_ptr - s->pb.buf - 1);", "double VAR_16 = s->rc_context.buffer_index + VAR_15 - VAR_14;", "if (VAR_16 < 0)\nav_log(s->VAR_0, AV_LOG_ERROR,\n\"Internal error, negative VAR_16\\n\");", "assert(s->repeat_first_field == 0);", "VAR_12 = VAR_16 * 90000 / s->VAR_0->rc_max_rate;", "VAR_13 = (VAR_15 * 90000LL + s->VAR_0->rc_max_rate - 1) /\ns->VAR_0->rc_max_rate;", "VAR_12 = FFMAX(VAR_12, VAR_13);", "assert(VAR_12 < 0xFFFF);", "s->vbv_delay_ptr[0] &= 0xF8;", "s->vbv_delay_ptr[0] |= VAR_12 >> 13;", "s->vbv_delay_ptr[1] = VAR_12 >> 5;", "s->vbv_delay_ptr[2] &= 0x07;", "s->vbv_delay_ptr[2] |= VAR_12 << 3;", "VAR_0->VAR_12 = VAR_12 * 300;", "}", "s->total_bits += s->frame_bits;", "VAR_0->frame_bits = s->frame_bits;", "VAR_1->pts = s->current_picture.f->pts;", "if (!s->low_delay) {", "if (!s->current_picture.f->coded_picture_number)\nVAR_1->dts = VAR_1->pts - s->dts_delta;", "else\nVAR_1->dts = s->reordered_pts;", "s->reordered_pts = s->input_picture[0]->f->pts;", "} else", "VAR_1->dts = VAR_1->pts;", "if (s->current_picture.f->key_frame)\nVAR_1->flags |= AV_PKT_FLAG_KEY;", "if (s->mb_info)\nav_packet_shrink_side_data(VAR_1, AV_PKT_DATA_H263_MB_INFO, s->mb_info_size);", "} else {", "s->frame_bits = 0;", "}", "assert((s->frame_bits & 7) == 0);", "VAR_1->size = s->frame_bits / 8;", "*VAR_3 = !!VAR_1->size;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 25 ], [ 27 ], [ 29 ], [ 35 ], [ 37, 39, 41 ], [ 43 ], [ 45, 47, 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 77 ], [ 81 ], [ 83, 85 ], [ 87, 89, 91 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 109 ], [ 111 ], [ 115 ], [ 119, 121 ], [ 125 ], [ 127 ], [ 129 ], [ 133, 135 ], [ 137, 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147, 149, 151, 153 ], [ 155 ], [ 157 ], [ 161 ], [ 163, 165, 167, 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 195 ], [ 197 ], [ 201, 203 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 217, 219, 221, 223 ], [ 225 ], [ 227 ], [ 231 ], [ 233 ], [ 235, 237 ], [ 239 ], [ 241 ], [ 243 ], [ 247 ], [ 249, 251, 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261, 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277, 279 ], [ 281 ], [ 283 ], [ 285 ], [ 287 ], [ 293, 295, 297, 299, 301 ], [ 303 ], [ 305, 307 ], [ 309, 311 ], [ 313 ], [ 317, 319, 321 ], [ 325 ], [ 329 ], [ 331, 333 ], [ 337 ], [ 341 ], [ 345 ], [ 347 ], [ 349 ], [ 351 ], [ 353 ], [ 355 ], [ 357 ], [ 359 ], [ 361 ], [ 365 ], [ 367 ], [ 369, 371 ], [ 373, 375 ], [ 377 ], [ 379 ], [ 381 ], [ 383, 385 ], [ 387, 389 ], [ 391 ], [ 393 ], [ 395 ], [ 397 ], [ 401 ], [ 403 ], [ 405 ], [ 407 ] ]
10,141
void s390x_cpu_debug_excp_handler(CPUState *cs) { S390CPU *cpu = S390_CPU(cs); CPUS390XState *env = &cpu->env; CPUWatchpoint *wp_hit = cs->watchpoint_hit; if (wp_hit && wp_hit->flags & BP_CPU) { /* FIXME: When the storage-alteration-space control bit is set, the exception should only be triggered if the memory access is done using an address space with the storage-alteration-event bit set. We have no way to detect that with the current watchpoint code. */ cs->watchpoint_hit = NULL; env->per_address = env->psw.addr; env->per_perc_atmid |= PER_CODE_EVENT_STORE | get_per_atmid(env); /* FIXME: We currently no way to detect the address space used to trigger the watchpoint. For now just consider it is the current default ASC. This turn to be true except when MVCP and MVCS instrutions are not used. */ env->per_perc_atmid |= env->psw.mask & (PSW_MASK_ASC) >> 46; /* Remove all watchpoints to re-execute the code. A PER exception will be triggered, it will call load_psw which will recompute the watchpoints. */ cpu_watchpoint_remove_all(cs, BP_CPU); cpu_resume_from_signal(cs, NULL); } }
false
qemu
6886b98036a8f8f5bce8b10756ce080084cef11b
void s390x_cpu_debug_excp_handler(CPUState *cs) { S390CPU *cpu = S390_CPU(cs); CPUS390XState *env = &cpu->env; CPUWatchpoint *wp_hit = cs->watchpoint_hit; if (wp_hit && wp_hit->flags & BP_CPU) { cs->watchpoint_hit = NULL; env->per_address = env->psw.addr; env->per_perc_atmid |= PER_CODE_EVENT_STORE | get_per_atmid(env); env->per_perc_atmid |= env->psw.mask & (PSW_MASK_ASC) >> 46; cpu_watchpoint_remove_all(cs, BP_CPU); cpu_resume_from_signal(cs, NULL); } }
{ "code": [], "line_no": [] }
void FUNC_0(CPUState *VAR_0) { S390CPU *cpu = S390_CPU(VAR_0); CPUS390XState *env = &cpu->env; CPUWatchpoint *wp_hit = VAR_0->watchpoint_hit; if (wp_hit && wp_hit->flags & BP_CPU) { VAR_0->watchpoint_hit = NULL; env->per_address = env->psw.addr; env->per_perc_atmid |= PER_CODE_EVENT_STORE | get_per_atmid(env); env->per_perc_atmid |= env->psw.mask & (PSW_MASK_ASC) >> 46; cpu_watchpoint_remove_all(VAR_0, BP_CPU); cpu_resume_from_signal(VAR_0, NULL); } }
[ "void FUNC_0(CPUState *VAR_0)\n{", "S390CPU *cpu = S390_CPU(VAR_0);", "CPUS390XState *env = &cpu->env;", "CPUWatchpoint *wp_hit = VAR_0->watchpoint_hit;", "if (wp_hit && wp_hit->flags & BP_CPU) {", "VAR_0->watchpoint_hit = NULL;", "env->per_address = env->psw.addr;", "env->per_perc_atmid |= PER_CODE_EVENT_STORE | get_per_atmid(env);", "env->per_perc_atmid |= env->psw.mask & (PSW_MASK_ASC) >> 46;", "cpu_watchpoint_remove_all(VAR_0, BP_CPU);", "cpu_resume_from_signal(VAR_0, NULL);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 25 ], [ 29 ], [ 31 ], [ 41 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ] ]
10,142
static AVIOContext * wtvfile_open_sector(int first_sector, uint64_t length, int depth, AVFormatContext *s) { AVIOContext *pb; WtvFile *wf; uint8_t *buffer; if (seek_by_sector(s->pb, first_sector, 0) < 0) return NULL; wf = av_mallocz(sizeof(WtvFile)); if (!wf) return NULL; if (depth == 0) { wf->sectors = av_malloc(sizeof(uint32_t)); if (!wf->sectors) { av_free(wf); return NULL; } wf->sectors[0] = first_sector; wf->nb_sectors = 1; } else if (depth == 1) { wf->sectors = av_malloc(WTV_SECTOR_SIZE); if (!wf->sectors) { av_free(wf); return NULL; } wf->nb_sectors = read_ints(s->pb, wf->sectors, WTV_SECTOR_SIZE / 4); } else if (depth == 2) { uint32_t sectors1[WTV_SECTOR_SIZE / 4]; int nb_sectors1 = read_ints(s->pb, sectors1, WTV_SECTOR_SIZE / 4); int i; wf->sectors = av_malloc_array(nb_sectors1, 1 << WTV_SECTOR_BITS); if (!wf->sectors) { av_free(wf); return NULL; } wf->nb_sectors = 0; for (i = 0; i < nb_sectors1; i++) { if (seek_by_sector(s->pb, sectors1[i], 0) < 0) break; wf->nb_sectors += read_ints(s->pb, wf->sectors + i * WTV_SECTOR_SIZE / 4, WTV_SECTOR_SIZE / 4); } } else { av_log(s, AV_LOG_ERROR, "unsupported file allocation table depth (0x%x)\n", depth); av_free(wf); return NULL; } wf->sector_bits = length & (1ULL<<63) ? WTV_SECTOR_BITS : WTV_BIGSECTOR_BITS; if (!wf->nb_sectors) { av_free(wf->sectors); av_free(wf); return NULL; } if ((int64_t)wf->sectors[wf->nb_sectors - 1] << WTV_SECTOR_BITS > avio_tell(s->pb)) av_log(s, AV_LOG_WARNING, "truncated file\n"); /* check length */ length &= 0xFFFFFFFFFFFF; if (length > ((int64_t)wf->nb_sectors << wf->sector_bits)) { av_log(s, AV_LOG_WARNING, "reported file length (0x%"PRIx64") exceeds number of available sectors (0x%"PRIx64")\n", length, (int64_t)wf->nb_sectors << wf->sector_bits); length = (int64_t)wf->nb_sectors << wf->sector_bits; } wf->length = length; /* seek to initial sector */ wf->position = 0; if (seek_by_sector(s->pb, wf->sectors[0], 0) < 0) { av_free(wf->sectors); av_free(wf); return NULL; } wf->pb_filesystem = s->pb; buffer = av_malloc(1 << wf->sector_bits); if (!buffer) { av_free(wf->sectors); av_free(wf); return NULL; } pb = avio_alloc_context(buffer, 1 << wf->sector_bits, 0, wf, wtvfile_read_packet, NULL, wtvfile_seek); if (!pb) { av_free(buffer); av_free(wf->sectors); av_free(wf); } return pb; }
false
FFmpeg
8baaa924bd42977c1f5c4aae0fe24985afb52a87
static AVIOContext * wtvfile_open_sector(int first_sector, uint64_t length, int depth, AVFormatContext *s) { AVIOContext *pb; WtvFile *wf; uint8_t *buffer; if (seek_by_sector(s->pb, first_sector, 0) < 0) return NULL; wf = av_mallocz(sizeof(WtvFile)); if (!wf) return NULL; if (depth == 0) { wf->sectors = av_malloc(sizeof(uint32_t)); if (!wf->sectors) { av_free(wf); return NULL; } wf->sectors[0] = first_sector; wf->nb_sectors = 1; } else if (depth == 1) { wf->sectors = av_malloc(WTV_SECTOR_SIZE); if (!wf->sectors) { av_free(wf); return NULL; } wf->nb_sectors = read_ints(s->pb, wf->sectors, WTV_SECTOR_SIZE / 4); } else if (depth == 2) { uint32_t sectors1[WTV_SECTOR_SIZE / 4]; int nb_sectors1 = read_ints(s->pb, sectors1, WTV_SECTOR_SIZE / 4); int i; wf->sectors = av_malloc_array(nb_sectors1, 1 << WTV_SECTOR_BITS); if (!wf->sectors) { av_free(wf); return NULL; } wf->nb_sectors = 0; for (i = 0; i < nb_sectors1; i++) { if (seek_by_sector(s->pb, sectors1[i], 0) < 0) break; wf->nb_sectors += read_ints(s->pb, wf->sectors + i * WTV_SECTOR_SIZE / 4, WTV_SECTOR_SIZE / 4); } } else { av_log(s, AV_LOG_ERROR, "unsupported file allocation table depth (0x%x)\n", depth); av_free(wf); return NULL; } wf->sector_bits = length & (1ULL<<63) ? WTV_SECTOR_BITS : WTV_BIGSECTOR_BITS; if (!wf->nb_sectors) { av_free(wf->sectors); av_free(wf); return NULL; } if ((int64_t)wf->sectors[wf->nb_sectors - 1] << WTV_SECTOR_BITS > avio_tell(s->pb)) av_log(s, AV_LOG_WARNING, "truncated file\n"); length &= 0xFFFFFFFFFFFF; if (length > ((int64_t)wf->nb_sectors << wf->sector_bits)) { av_log(s, AV_LOG_WARNING, "reported file length (0x%"PRIx64") exceeds number of available sectors (0x%"PRIx64")\n", length, (int64_t)wf->nb_sectors << wf->sector_bits); length = (int64_t)wf->nb_sectors << wf->sector_bits; } wf->length = length; wf->position = 0; if (seek_by_sector(s->pb, wf->sectors[0], 0) < 0) { av_free(wf->sectors); av_free(wf); return NULL; } wf->pb_filesystem = s->pb; buffer = av_malloc(1 << wf->sector_bits); if (!buffer) { av_free(wf->sectors); av_free(wf); return NULL; } pb = avio_alloc_context(buffer, 1 << wf->sector_bits, 0, wf, wtvfile_read_packet, NULL, wtvfile_seek); if (!pb) { av_free(buffer); av_free(wf->sectors); av_free(wf); } return pb; }
{ "code": [], "line_no": [] }
static AVIOContext * FUNC_0(int first_sector, uint64_t length, int depth, AVFormatContext *s) { AVIOContext *pb; WtvFile *wf; uint8_t *buffer; if (seek_by_sector(s->pb, first_sector, 0) < 0) return NULL; wf = av_mallocz(sizeof(WtvFile)); if (!wf) return NULL; if (depth == 0) { wf->sectors = av_malloc(sizeof(uint32_t)); if (!wf->sectors) { av_free(wf); return NULL; } wf->sectors[0] = first_sector; wf->nb_sectors = 1; } else if (depth == 1) { wf->sectors = av_malloc(WTV_SECTOR_SIZE); if (!wf->sectors) { av_free(wf); return NULL; } wf->nb_sectors = read_ints(s->pb, wf->sectors, WTV_SECTOR_SIZE / 4); } else if (depth == 2) { uint32_t sectors1[WTV_SECTOR_SIZE / 4]; int VAR_0 = read_ints(s->pb, sectors1, WTV_SECTOR_SIZE / 4); int VAR_1; wf->sectors = av_malloc_array(VAR_0, 1 << WTV_SECTOR_BITS); if (!wf->sectors) { av_free(wf); return NULL; } wf->nb_sectors = 0; for (VAR_1 = 0; VAR_1 < VAR_0; VAR_1++) { if (seek_by_sector(s->pb, sectors1[VAR_1], 0) < 0) break; wf->nb_sectors += read_ints(s->pb, wf->sectors + VAR_1 * WTV_SECTOR_SIZE / 4, WTV_SECTOR_SIZE / 4); } } else { av_log(s, AV_LOG_ERROR, "unsupported file allocation table depth (0x%x)\n", depth); av_free(wf); return NULL; } wf->sector_bits = length & (1ULL<<63) ? WTV_SECTOR_BITS : WTV_BIGSECTOR_BITS; if (!wf->nb_sectors) { av_free(wf->sectors); av_free(wf); return NULL; } if ((int64_t)wf->sectors[wf->nb_sectors - 1] << WTV_SECTOR_BITS > avio_tell(s->pb)) av_log(s, AV_LOG_WARNING, "truncated file\n"); length &= 0xFFFFFFFFFFFF; if (length > ((int64_t)wf->nb_sectors << wf->sector_bits)) { av_log(s, AV_LOG_WARNING, "reported file length (0x%"PRIx64") exceeds number of available sectors (0x%"PRIx64")\n", length, (int64_t)wf->nb_sectors << wf->sector_bits); length = (int64_t)wf->nb_sectors << wf->sector_bits; } wf->length = length; wf->position = 0; if (seek_by_sector(s->pb, wf->sectors[0], 0) < 0) { av_free(wf->sectors); av_free(wf); return NULL; } wf->pb_filesystem = s->pb; buffer = av_malloc(1 << wf->sector_bits); if (!buffer) { av_free(wf->sectors); av_free(wf); return NULL; } pb = avio_alloc_context(buffer, 1 << wf->sector_bits, 0, wf, wtvfile_read_packet, NULL, wtvfile_seek); if (!pb) { av_free(buffer); av_free(wf->sectors); av_free(wf); } return pb; }
[ "static AVIOContext * FUNC_0(int first_sector, uint64_t length, int depth, AVFormatContext *s)\n{", "AVIOContext *pb;", "WtvFile *wf;", "uint8_t *buffer;", "if (seek_by_sector(s->pb, first_sector, 0) < 0)\nreturn NULL;", "wf = av_mallocz(sizeof(WtvFile));", "if (!wf)\nreturn NULL;", "if (depth == 0) {", "wf->sectors = av_malloc(sizeof(uint32_t));", "if (!wf->sectors) {", "av_free(wf);", "return NULL;", "}", "wf->sectors[0] = first_sector;", "wf->nb_sectors = 1;", "} else if (depth == 1) {", "wf->sectors = av_malloc(WTV_SECTOR_SIZE);", "if (!wf->sectors) {", "av_free(wf);", "return NULL;", "}", "wf->nb_sectors = read_ints(s->pb, wf->sectors, WTV_SECTOR_SIZE / 4);", "} else if (depth == 2) {", "uint32_t sectors1[WTV_SECTOR_SIZE / 4];", "int VAR_0 = read_ints(s->pb, sectors1, WTV_SECTOR_SIZE / 4);", "int VAR_1;", "wf->sectors = av_malloc_array(VAR_0, 1 << WTV_SECTOR_BITS);", "if (!wf->sectors) {", "av_free(wf);", "return NULL;", "}", "wf->nb_sectors = 0;", "for (VAR_1 = 0; VAR_1 < VAR_0; VAR_1++) {", "if (seek_by_sector(s->pb, sectors1[VAR_1], 0) < 0)\nbreak;", "wf->nb_sectors += read_ints(s->pb, wf->sectors + VAR_1 * WTV_SECTOR_SIZE / 4, WTV_SECTOR_SIZE / 4);", "}", "} else {", "av_log(s, AV_LOG_ERROR, \"unsupported file allocation table depth (0x%x)\\n\", depth);", "av_free(wf);", "return NULL;", "}", "wf->sector_bits = length & (1ULL<<63) ? WTV_SECTOR_BITS : WTV_BIGSECTOR_BITS;", "if (!wf->nb_sectors) {", "av_free(wf->sectors);", "av_free(wf);", "return NULL;", "}", "if ((int64_t)wf->sectors[wf->nb_sectors - 1] << WTV_SECTOR_BITS > avio_tell(s->pb))\nav_log(s, AV_LOG_WARNING, \"truncated file\\n\");", "length &= 0xFFFFFFFFFFFF;", "if (length > ((int64_t)wf->nb_sectors << wf->sector_bits)) {", "av_log(s, AV_LOG_WARNING, \"reported file length (0x%\"PRIx64\") exceeds number of available sectors (0x%\"PRIx64\")\\n\", length, (int64_t)wf->nb_sectors << wf->sector_bits);", "length = (int64_t)wf->nb_sectors << wf->sector_bits;", "}", "wf->length = length;", "wf->position = 0;", "if (seek_by_sector(s->pb, wf->sectors[0], 0) < 0) {", "av_free(wf->sectors);", "av_free(wf);", "return NULL;", "}", "wf->pb_filesystem = s->pb;", "buffer = av_malloc(1 << wf->sector_bits);", "if (!buffer) {", "av_free(wf->sectors);", "av_free(wf);", "return NULL;", "}", "pb = avio_alloc_context(buffer, 1 << wf->sector_bits, 0, wf,\nwtvfile_read_packet, NULL, wtvfile_seek);", "if (!pb) {", "av_free(buffer);", "av_free(wf->sectors);", "av_free(wf);", "}", "return pb;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81, 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 115, 117 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 169, 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ] ]
10,143
static int smacker_probe(AVProbeData *p) { if (p->buf_size < 4) return 0; if(p->buf[0] == 'S' && p->buf[1] == 'M' && p->buf[2] == 'K' && (p->buf[3] == '2' || p->buf[3] == '4')) return AVPROBE_SCORE_MAX; else return 0; }
false
FFmpeg
87e8788680e16c51f6048af26f3f7830c35207a5
static int smacker_probe(AVProbeData *p) { if (p->buf_size < 4) return 0; if(p->buf[0] == 'S' && p->buf[1] == 'M' && p->buf[2] == 'K' && (p->buf[3] == '2' || p->buf[3] == '4')) return AVPROBE_SCORE_MAX; else return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVProbeData *VAR_0) { if (VAR_0->buf_size < 4) return 0; if(VAR_0->buf[0] == 'S' && VAR_0->buf[1] == 'M' && VAR_0->buf[2] == 'K' && (VAR_0->buf[3] == '2' || VAR_0->buf[3] == '4')) return AVPROBE_SCORE_MAX; else return 0; }
[ "static int FUNC_0(AVProbeData *VAR_0)\n{", "if (VAR_0->buf_size < 4)\nreturn 0;", "if(VAR_0->buf[0] == 'S' && VAR_0->buf[1] == 'M' && VAR_0->buf[2] == 'K'\n&& (VAR_0->buf[3] == '2' || VAR_0->buf[3] == '4'))\nreturn AVPROBE_SCORE_MAX;", "else\nreturn 0;", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9, 11, 13 ], [ 15, 17 ], [ 19 ] ]
10,144
int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque) #endif { AVDictionary *options = NULL; AVDictionaryEntry *e; int ret=0; if (args && *args) { if (!filter->filter->priv_class) { av_log(filter, AV_LOG_ERROR, "This filter does not take any " "options, but options were provided: %s.\n", args); return AVERROR(EINVAL); } #if FF_API_OLD_FILTER_OPTS if (!strcmp(filter->filter->name, "scale") && strchr(args, ':') < strchr(args, '=')) { /* old w:h:flags=<flags> syntax */ char *copy = av_strdup(args); char *p; av_log(filter, AV_LOG_WARNING, "The <w>:<h>:flags=<flags> option " "syntax is deprecated. Use either <w>:<h>:<flags> or " "w=<w>:h=<h>:flags=<flags>.\n"); if (!copy) { ret = AVERROR(ENOMEM); goto fail; } p = strrchr(copy, ':'); if (p) { *p++ = 0; ret = av_dict_parse_string(&options, p, "=", ":", 0); } if (ret >= 0) ret = process_options(filter, &options, copy); av_freep(&copy); if (ret < 0) goto fail; } else if (!strcmp(filter->filter->name, "format") || !strcmp(filter->filter->name, "noformat") || !strcmp(filter->filter->name, "frei0r") || !strcmp(filter->filter->name, "frei0r_src") || !strcmp(filter->filter->name, "ocv") || !strcmp(filter->filter->name, "pan") || !strcmp(filter->filter->name, "pp") || !strcmp(filter->filter->name, "aevalsrc")) { /* a hack for compatibility with the old syntax * replace colons with |s */ char *copy = av_strdup(args); char *p = copy; int nb_leading = 0; // number of leading colons to skip int deprecated = 0; if (!copy) { ret = AVERROR(ENOMEM); goto fail; } if (!strcmp(filter->filter->name, "frei0r") || !strcmp(filter->filter->name, "ocv")) nb_leading = 1; else if (!strcmp(filter->filter->name, "frei0r_src")) nb_leading = 3; while (nb_leading--) { p = strchr(p, ':'); if (!p) { p = copy + strlen(copy); break; } p++; } deprecated = strchr(p, ':') != NULL; if (!strcmp(filter->filter->name, "aevalsrc")) { deprecated = 0; while ((p = strchr(p, ':')) && p[1] != ':') { const char *epos = strchr(p + 1, '='); const char *spos = strchr(p + 1, ':'); const int next_token_is_opt = epos && (!spos || epos < spos); if (next_token_is_opt) { p++; break; } /* next token does not contain a '=', assume a channel expression */ deprecated = 1; *p++ = '|'; } if (p && *p == ':') { // double sep '::' found deprecated = 1; memmove(p, p + 1, strlen(p)); } } else while ((p = strchr(p, ':'))) *p++ = '|'; if (deprecated) av_log(filter, AV_LOG_WARNING, "This syntax is deprecated. Use " "'|' to separate the list items.\n"); av_log(filter, AV_LOG_DEBUG, "compat: called with args=[%s]\n", copy); ret = process_options(filter, &options, copy); av_freep(&copy); if (ret < 0) goto fail; #endif } else { #if CONFIG_MP_FILTER if (!strcmp(filter->filter->name, "mp")) { char *escaped; if (!strncmp(args, "filter=", 7)) args += 7; ret = av_escape(&escaped, args, ":=", AV_ESCAPE_MODE_BACKSLASH, 0); if (ret < 0) { av_log(filter, AV_LOG_ERROR, "Unable to escape MPlayer filters arg '%s'\n", args); goto fail; } ret = process_options(filter, &options, escaped); av_free(escaped); } else #endif ret = process_options(filter, &options, args); if (ret < 0) goto fail; } } if (filter->filter->priv_class) { ret = av_opt_set_dict(filter->priv, &options); if (ret < 0) { av_log(filter, AV_LOG_ERROR, "Error applying options to the filter.\n"); goto fail; } } if (filter->filter->init_opaque) ret = filter->filter->init_opaque(filter, opaque); else if (filter->filter->init) ret = filter->filter->init(filter); else if (filter->filter->init_dict) ret = filter->filter->init_dict(filter, &options); if (ret < 0) goto fail; if ((e = av_dict_get(options, "", NULL, AV_DICT_IGNORE_SUFFIX))) { av_log(filter, AV_LOG_ERROR, "No such option: %s.\n", e->key); ret = AVERROR_OPTION_NOT_FOUND; goto fail; } fail: av_dict_free(&options); return ret; }
false
FFmpeg
f1e62af0e03f5d62e3f022031e0fca563fcc2c9d
int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque) #endif { AVDictionary *options = NULL; AVDictionaryEntry *e; int ret=0; if (args && *args) { if (!filter->filter->priv_class) { av_log(filter, AV_LOG_ERROR, "This filter does not take any " "options, but options were provided: %s.\n", args); return AVERROR(EINVAL); } #if FF_API_OLD_FILTER_OPTS if (!strcmp(filter->filter->name, "scale") && strchr(args, ':') < strchr(args, '=')) { char *copy = av_strdup(args); char *p; av_log(filter, AV_LOG_WARNING, "The <w>:<h>:flags=<flags> option " "syntax is deprecated. Use either <w>:<h>:<flags> or " "w=<w>:h=<h>:flags=<flags>.\n"); if (!copy) { ret = AVERROR(ENOMEM); goto fail; } p = strrchr(copy, ':'); if (p) { *p++ = 0; ret = av_dict_parse_string(&options, p, "=", ":", 0); } if (ret >= 0) ret = process_options(filter, &options, copy); av_freep(&copy); if (ret < 0) goto fail; } else if (!strcmp(filter->filter->name, "format") || !strcmp(filter->filter->name, "noformat") || !strcmp(filter->filter->name, "frei0r") || !strcmp(filter->filter->name, "frei0r_src") || !strcmp(filter->filter->name, "ocv") || !strcmp(filter->filter->name, "pan") || !strcmp(filter->filter->name, "pp") || !strcmp(filter->filter->name, "aevalsrc")) { char *copy = av_strdup(args); char *p = copy; int nb_leading = 0; int deprecated = 0; if (!copy) { ret = AVERROR(ENOMEM); goto fail; } if (!strcmp(filter->filter->name, "frei0r") || !strcmp(filter->filter->name, "ocv")) nb_leading = 1; else if (!strcmp(filter->filter->name, "frei0r_src")) nb_leading = 3; while (nb_leading--) { p = strchr(p, ':'); if (!p) { p = copy + strlen(copy); break; } p++; } deprecated = strchr(p, ':') != NULL; if (!strcmp(filter->filter->name, "aevalsrc")) { deprecated = 0; while ((p = strchr(p, ':')) && p[1] != ':') { const char *epos = strchr(p + 1, '='); const char *spos = strchr(p + 1, ':'); const int next_token_is_opt = epos && (!spos || epos < spos); if (next_token_is_opt) { p++; break; } deprecated = 1; *p++ = '|'; } if (p && *p == ':') { deprecated = 1; memmove(p, p + 1, strlen(p)); } } else while ((p = strchr(p, ':'))) *p++ = '|'; if (deprecated) av_log(filter, AV_LOG_WARNING, "This syntax is deprecated. Use " "'|' to separate the list items.\n"); av_log(filter, AV_LOG_DEBUG, "compat: called with args=[%s]\n", copy); ret = process_options(filter, &options, copy); av_freep(&copy); if (ret < 0) goto fail; #endif } else { #if CONFIG_MP_FILTER if (!strcmp(filter->filter->name, "mp")) { char *escaped; if (!strncmp(args, "filter=", 7)) args += 7; ret = av_escape(&escaped, args, ":=", AV_ESCAPE_MODE_BACKSLASH, 0); if (ret < 0) { av_log(filter, AV_LOG_ERROR, "Unable to escape MPlayer filters arg '%s'\n", args); goto fail; } ret = process_options(filter, &options, escaped); av_free(escaped); } else #endif ret = process_options(filter, &options, args); if (ret < 0) goto fail; } } if (filter->filter->priv_class) { ret = av_opt_set_dict(filter->priv, &options); if (ret < 0) { av_log(filter, AV_LOG_ERROR, "Error applying options to the filter.\n"); goto fail; } } if (filter->filter->init_opaque) ret = filter->filter->init_opaque(filter, opaque); else if (filter->filter->init) ret = filter->filter->init(filter); else if (filter->filter->init_dict) ret = filter->filter->init_dict(filter, &options); if (ret < 0) goto fail; if ((e = av_dict_get(options, "", NULL, AV_DICT_IGNORE_SUFFIX))) { av_log(filter, AV_LOG_ERROR, "No such option: %s.\n", e->key); ret = AVERROR_OPTION_NOT_FOUND; goto fail; } fail: av_dict_free(&options); return ret; }
{ "code": [], "line_no": [] }
int FUNC_0(AVFilterContext *VAR_0, const char *VAR_1, void *VAR_2) #endif { AVDictionary *options = NULL; AVDictionaryEntry *e; int VAR_3=0; if (VAR_1 && *VAR_1) { if (!VAR_0->VAR_0->priv_class) { av_log(VAR_0, AV_LOG_ERROR, "This VAR_0 does not take any " "options, but options were provided: %s.\n", VAR_1); return AVERROR(EINVAL); } #if FF_API_OLD_FILTER_OPTS if (!strcmp(VAR_0->VAR_0->name, "scale") && strchr(VAR_1, ':') < strchr(VAR_1, '=')) { char *copy = av_strdup(VAR_1); char *p; av_log(VAR_0, AV_LOG_WARNING, "The <w>:<h>:flags=<flags> option " "syntax is deprecated. Use either <w>:<h>:<flags> or " "w=<w>:h=<h>:flags=<flags>.\n"); if (!copy) { VAR_3 = AVERROR(ENOMEM); goto VAR_4; } p = strrchr(copy, ':'); if (p) { *p++ = 0; VAR_3 = av_dict_parse_string(&options, p, "=", ":", 0); } if (VAR_3 >= 0) VAR_3 = process_options(VAR_0, &options, copy); av_freep(&copy); if (VAR_3 < 0) goto VAR_4; } else if (!strcmp(VAR_0->VAR_0->name, "format") || !strcmp(VAR_0->VAR_0->name, "noformat") || !strcmp(VAR_0->VAR_0->name, "frei0r") || !strcmp(VAR_0->VAR_0->name, "frei0r_src") || !strcmp(VAR_0->VAR_0->name, "ocv") || !strcmp(VAR_0->VAR_0->name, "pan") || !strcmp(VAR_0->VAR_0->name, "pp") || !strcmp(VAR_0->VAR_0->name, "aevalsrc")) { char *copy = av_strdup(VAR_1); char *p = copy; int nb_leading = 0; int deprecated = 0; if (!copy) { VAR_3 = AVERROR(ENOMEM); goto VAR_4; } if (!strcmp(VAR_0->VAR_0->name, "frei0r") || !strcmp(VAR_0->VAR_0->name, "ocv")) nb_leading = 1; else if (!strcmp(VAR_0->VAR_0->name, "frei0r_src")) nb_leading = 3; while (nb_leading--) { p = strchr(p, ':'); if (!p) { p = copy + strlen(copy); break; } p++; } deprecated = strchr(p, ':') != NULL; if (!strcmp(VAR_0->VAR_0->name, "aevalsrc")) { deprecated = 0; while ((p = strchr(p, ':')) && p[1] != ':') { const char *epos = strchr(p + 1, '='); const char *spos = strchr(p + 1, ':'); const int next_token_is_opt = epos && (!spos || epos < spos); if (next_token_is_opt) { p++; break; } deprecated = 1; *p++ = '|'; } if (p && *p == ':') { deprecated = 1; memmove(p, p + 1, strlen(p)); } } else while ((p = strchr(p, ':'))) *p++ = '|'; if (deprecated) av_log(VAR_0, AV_LOG_WARNING, "This syntax is deprecated. Use " "'|' to separate the list items.\n"); av_log(VAR_0, AV_LOG_DEBUG, "compat: called with VAR_1=[%s]\n", copy); VAR_3 = process_options(VAR_0, &options, copy); av_freep(&copy); if (VAR_3 < 0) goto VAR_4; #endif } else { #if CONFIG_MP_FILTER if (!strcmp(VAR_0->VAR_0->name, "mp")) { char *escaped; if (!strncmp(VAR_1, "VAR_0=", 7)) VAR_1 += 7; VAR_3 = av_escape(&escaped, VAR_1, ":=", AV_ESCAPE_MODE_BACKSLASH, 0); if (VAR_3 < 0) { av_log(VAR_0, AV_LOG_ERROR, "Unable to escape MPlayer filters arg '%s'\n", VAR_1); goto VAR_4; } VAR_3 = process_options(VAR_0, &options, escaped); av_free(escaped); } else #endif VAR_3 = process_options(VAR_0, &options, VAR_1); if (VAR_3 < 0) goto VAR_4; } } if (VAR_0->VAR_0->priv_class) { VAR_3 = av_opt_set_dict(VAR_0->priv, &options); if (VAR_3 < 0) { av_log(VAR_0, AV_LOG_ERROR, "Error applying options to the VAR_0.\n"); goto VAR_4; } } if (VAR_0->VAR_0->init_opaque) VAR_3 = VAR_0->VAR_0->init_opaque(VAR_0, VAR_2); else if (VAR_0->VAR_0->init) VAR_3 = VAR_0->VAR_0->init(VAR_0); else if (VAR_0->VAR_0->init_dict) VAR_3 = VAR_0->VAR_0->init_dict(VAR_0, &options); if (VAR_3 < 0) goto VAR_4; if ((e = av_dict_get(options, "", NULL, AV_DICT_IGNORE_SUFFIX))) { av_log(VAR_0, AV_LOG_ERROR, "No such option: %s.\n", e->key); VAR_3 = AVERROR_OPTION_NOT_FOUND; goto VAR_4; } VAR_4: FUNC_1(&options); return VAR_3; }
[ "int FUNC_0(AVFilterContext *VAR_0, const char *VAR_1, void *VAR_2)\n#endif\n{", "AVDictionary *options = NULL;", "AVDictionaryEntry *e;", "int VAR_3=0;", "if (VAR_1 && *VAR_1) {", "if (!VAR_0->VAR_0->priv_class) {", "av_log(VAR_0, AV_LOG_ERROR, \"This VAR_0 does not take any \"\n\"options, but options were provided: %s.\\n\", VAR_1);", "return AVERROR(EINVAL);", "}", "#if FF_API_OLD_FILTER_OPTS\nif (!strcmp(VAR_0->VAR_0->name, \"scale\") &&\nstrchr(VAR_1, ':') < strchr(VAR_1, '=')) {", "char *copy = av_strdup(VAR_1);", "char *p;", "av_log(VAR_0, AV_LOG_WARNING, \"The <w>:<h>:flags=<flags> option \"\n\"syntax is deprecated. Use either <w>:<h>:<flags> or \"\n\"w=<w>:h=<h>:flags=<flags>.\\n\");", "if (!copy) {", "VAR_3 = AVERROR(ENOMEM);", "goto VAR_4;", "}", "p = strrchr(copy, ':');", "if (p) {", "*p++ = 0;", "VAR_3 = av_dict_parse_string(&options, p, \"=\", \":\", 0);", "}", "if (VAR_3 >= 0)\nVAR_3 = process_options(VAR_0, &options, copy);", "av_freep(&copy);", "if (VAR_3 < 0)\ngoto VAR_4;", "} else if (!strcmp(VAR_0->VAR_0->name, \"format\") ||", "!strcmp(VAR_0->VAR_0->name, \"noformat\") ||\n!strcmp(VAR_0->VAR_0->name, \"frei0r\") ||\n!strcmp(VAR_0->VAR_0->name, \"frei0r_src\") ||\n!strcmp(VAR_0->VAR_0->name, \"ocv\") ||\n!strcmp(VAR_0->VAR_0->name, \"pan\") ||\n!strcmp(VAR_0->VAR_0->name, \"pp\") ||\n!strcmp(VAR_0->VAR_0->name, \"aevalsrc\")) {", "char *copy = av_strdup(VAR_1);", "char *p = copy;", "int nb_leading = 0;", "int deprecated = 0;", "if (!copy) {", "VAR_3 = AVERROR(ENOMEM);", "goto VAR_4;", "}", "if (!strcmp(VAR_0->VAR_0->name, \"frei0r\") ||\n!strcmp(VAR_0->VAR_0->name, \"ocv\"))\nnb_leading = 1;", "else if (!strcmp(VAR_0->VAR_0->name, \"frei0r_src\"))\nnb_leading = 3;", "while (nb_leading--) {", "p = strchr(p, ':');", "if (!p) {", "p = copy + strlen(copy);", "break;", "}", "p++;", "}", "deprecated = strchr(p, ':') != NULL;", "if (!strcmp(VAR_0->VAR_0->name, \"aevalsrc\")) {", "deprecated = 0;", "while ((p = strchr(p, ':')) && p[1] != ':') {", "const char *epos = strchr(p + 1, '=');", "const char *spos = strchr(p + 1, ':');", "const int next_token_is_opt = epos && (!spos || epos < spos);", "if (next_token_is_opt) {", "p++;", "break;", "}", "deprecated = 1;", "*p++ = '|';", "}", "if (p && *p == ':') {", "deprecated = 1;", "memmove(p, p + 1, strlen(p));", "}", "} else", "while ((p = strchr(p, ':')))\n*p++ = '|';", "if (deprecated)\nav_log(VAR_0, AV_LOG_WARNING, \"This syntax is deprecated. Use \"\n\"'|' to separate the list items.\\n\");", "av_log(VAR_0, AV_LOG_DEBUG, \"compat: called with VAR_1=[%s]\\n\", copy);", "VAR_3 = process_options(VAR_0, &options, copy);", "av_freep(&copy);", "if (VAR_3 < 0)\ngoto VAR_4;", "#endif\n} else {", "#if CONFIG_MP_FILTER\nif (!strcmp(VAR_0->VAR_0->name, \"mp\")) {", "char *escaped;", "if (!strncmp(VAR_1, \"VAR_0=\", 7))\nVAR_1 += 7;", "VAR_3 = av_escape(&escaped, VAR_1, \":=\", AV_ESCAPE_MODE_BACKSLASH, 0);", "if (VAR_3 < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"Unable to escape MPlayer filters arg '%s'\\n\", VAR_1);", "goto VAR_4;", "}", "VAR_3 = process_options(VAR_0, &options, escaped);", "av_free(escaped);", "} else", "#endif\nVAR_3 = process_options(VAR_0, &options, VAR_1);", "if (VAR_3 < 0)\ngoto VAR_4;", "}", "}", "if (VAR_0->VAR_0->priv_class) {", "VAR_3 = av_opt_set_dict(VAR_0->priv, &options);", "if (VAR_3 < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"Error applying options to the VAR_0.\\n\");", "goto VAR_4;", "}", "}", "if (VAR_0->VAR_0->init_opaque)\nVAR_3 = VAR_0->VAR_0->init_opaque(VAR_0, VAR_2);", "else if (VAR_0->VAR_0->init)\nVAR_3 = VAR_0->VAR_0->init(VAR_0);", "else if (VAR_0->VAR_0->init_dict)\nVAR_3 = VAR_0->VAR_0->init_dict(VAR_0, &options);", "if (VAR_3 < 0)\ngoto VAR_4;", "if ((e = av_dict_get(options, \"\", NULL, AV_DICT_IGNORE_SUFFIX))) {", "av_log(VAR_0, AV_LOG_ERROR, \"No such option: %s.\\n\", e->key);", "VAR_3 = AVERROR_OPTION_NOT_FOUND;", "goto VAR_4;", "}", "VAR_4:\nFUNC_1(&options);", "return VAR_3;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 29, 31, 33 ], [ 37 ], [ 39 ], [ 43, 45, 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71, 73 ], [ 75 ], [ 79, 81 ], [ 83 ], [ 85, 87, 89, 91, 93, 95, 97 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 123, 125, 127 ], [ 129, 131 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 153 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195, 197 ], [ 201, 203, 205 ], [ 209 ], [ 211 ], [ 213 ], [ 217, 219 ], [ 221, 223 ], [ 225, 227 ], [ 229 ], [ 233, 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253, 255 ], [ 257, 259 ], [ 261 ], [ 263 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277 ], [ 279 ], [ 283, 285 ], [ 287, 289 ], [ 291, 293 ], [ 295, 297 ], [ 301 ], [ 303 ], [ 305 ], [ 307 ], [ 309 ], [ 313, 315 ], [ 319 ], [ 321 ] ]
10,145
void audio_encode_example(const char *filename) { AVCodec *codec; AVCodecContext *c= NULL; int frame_size, i, j, out_size, outbuf_size; FILE *f; short *samples; float t, tincr; uint8_t *outbuf; printf("Audio encoding\n"); /* find the MP2 encoder */ codec = avcodec_find_encoder(CODEC_ID_MP2); if (!codec) { fprintf(stderr, "codec not found\n"); exit(1); } c= avcodec_alloc_context(); /* put sample parameters */ c->bit_rate = 64000; c->sample_rate = 44100; c->channels = 2; /* open it */ if (avcodec_open(c, codec) < 0) { fprintf(stderr, "could not open codec\n"); exit(1); } /* the codec gives us the frame size, in samples */ frame_size = c->frame_size; samples = malloc(frame_size * 2 * c->channels); outbuf_size = 10000; outbuf = malloc(outbuf_size); f = fopen(filename, "w"); if (!f) { fprintf(stderr, "could not open %s\n", filename); exit(1); } /* encode a single tone sound */ t = 0; tincr = 2 * M_PI * 440.0 / c->sample_rate; for(i=0;i<200;i++) { for(j=0;j<frame_size;j++) { samples[2*j] = (int)(sin(t) * 10000); samples[2*j+1] = samples[2*j]; t += tincr; } /* encode the samples */ out_size = avcodec_encode_audio(c, outbuf, outbuf_size, samples); fwrite(outbuf, 1, out_size, f); } fclose(f); free(outbuf); free(samples); avcodec_close(c); free(c); }
true
FFmpeg
1c0e205fab4bd5bbfa0399af2cd5e281b414b3d5
void audio_encode_example(const char *filename) { AVCodec *codec; AVCodecContext *c= NULL; int frame_size, i, j, out_size, outbuf_size; FILE *f; short *samples; float t, tincr; uint8_t *outbuf; printf("Audio encoding\n"); codec = avcodec_find_encoder(CODEC_ID_MP2); if (!codec) { fprintf(stderr, "codec not found\n"); exit(1); } c= avcodec_alloc_context(); c->bit_rate = 64000; c->sample_rate = 44100; c->channels = 2; if (avcodec_open(c, codec) < 0) { fprintf(stderr, "could not open codec\n"); exit(1); } frame_size = c->frame_size; samples = malloc(frame_size * 2 * c->channels); outbuf_size = 10000; outbuf = malloc(outbuf_size); f = fopen(filename, "w"); if (!f) { fprintf(stderr, "could not open %s\n", filename); exit(1); } t = 0; tincr = 2 * M_PI * 440.0 / c->sample_rate; for(i=0;i<200;i++) { for(j=0;j<frame_size;j++) { samples[2*j] = (int)(sin(t) * 10000); samples[2*j+1] = samples[2*j]; t += tincr; } out_size = avcodec_encode_audio(c, outbuf, outbuf_size, samples); fwrite(outbuf, 1, out_size, f); } fclose(f); free(outbuf); free(samples); avcodec_close(c); free(c); }
{ "code": [ " f = fopen(filename, \"w\");", " f = fopen(filename, \"w\");" ], "line_no": [ 77, 77 ] }
void FUNC_0(const char *VAR_0) { AVCodec *codec; AVCodecContext *c= NULL; int VAR_1, VAR_2, VAR_3, VAR_4, VAR_5; FILE *f; short *VAR_6; float VAR_7, VAR_8; uint8_t *outbuf; printf("Audio encoding\n"); codec = avcodec_find_encoder(CODEC_ID_MP2); if (!codec) { fprintf(stderr, "codec not found\n"); exit(1); } c= avcodec_alloc_context(); c->bit_rate = 64000; c->sample_rate = 44100; c->channels = 2; if (avcodec_open(c, codec) < 0) { fprintf(stderr, "could not open codec\n"); exit(1); } VAR_1 = c->VAR_1; VAR_6 = malloc(VAR_1 * 2 * c->channels); VAR_5 = 10000; outbuf = malloc(VAR_5); f = fopen(VAR_0, "w"); if (!f) { fprintf(stderr, "could not open %s\n", VAR_0); exit(1); } VAR_7 = 0; VAR_8 = 2 * M_PI * 440.0 / c->sample_rate; for(VAR_2=0;VAR_2<200;VAR_2++) { for(VAR_3=0;VAR_3<VAR_1;VAR_3++) { VAR_6[2*VAR_3] = (int)(sin(VAR_7) * 10000); VAR_6[2*VAR_3+1] = VAR_6[2*VAR_3]; VAR_7 += VAR_8; } VAR_4 = avcodec_encode_audio(c, outbuf, VAR_5, VAR_6); fwrite(outbuf, 1, VAR_4, f); } fclose(f); free(outbuf); free(VAR_6); avcodec_close(c); free(c); }
[ "void FUNC_0(const char *VAR_0)\n{", "AVCodec *codec;", "AVCodecContext *c= NULL;", "int VAR_1, VAR_2, VAR_3, VAR_4, VAR_5;", "FILE *f;", "short *VAR_6;", "float VAR_7, VAR_8;", "uint8_t *outbuf;", "printf(\"Audio encoding\\n\");", "codec = avcodec_find_encoder(CODEC_ID_MP2);", "if (!codec) {", "fprintf(stderr, \"codec not found\\n\");", "exit(1);", "}", "c= avcodec_alloc_context();", "c->bit_rate = 64000;", "c->sample_rate = 44100;", "c->channels = 2;", "if (avcodec_open(c, codec) < 0) {", "fprintf(stderr, \"could not open codec\\n\");", "exit(1);", "}", "VAR_1 = c->VAR_1;", "VAR_6 = malloc(VAR_1 * 2 * c->channels);", "VAR_5 = 10000;", "outbuf = malloc(VAR_5);", "f = fopen(VAR_0, \"w\");", "if (!f) {", "fprintf(stderr, \"could not open %s\\n\", VAR_0);", "exit(1);", "}", "VAR_7 = 0;", "VAR_8 = 2 * M_PI * 440.0 / c->sample_rate;", "for(VAR_2=0;VAR_2<200;VAR_2++) {", "for(VAR_3=0;VAR_3<VAR_1;VAR_3++) {", "VAR_6[2*VAR_3] = (int)(sin(VAR_7) * 10000);", "VAR_6[2*VAR_3+1] = VAR_6[2*VAR_3];", "VAR_7 += VAR_8;", "}", "VAR_4 = avcodec_encode_audio(c, outbuf, VAR_5, VAR_6);", "fwrite(outbuf, 1, VAR_4, f);", "}", "fclose(f);", "free(outbuf);", "free(VAR_6);", "avcodec_close(c);", "free(c);", "}" ]
[ 0, 0, 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 45 ], [ 47 ], [ 49 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 123 ], [ 125 ], [ 127 ] ]
10,147
static int w64_read_header(AVFormatContext *s) { int64_t size, data_ofs = 0; AVIOContext *pb = s->pb; WAVDemuxContext *wav = s->priv_data; AVStream *st; uint8_t guid[16]; int ret; avio_read(pb, guid, 16); if (memcmp(guid, ff_w64_guid_riff, 16)) /* riff + wave + fmt + sizes */ if (avio_rl64(pb) < 16 + 8 + 16 + 8 + 16 + 8) avio_read(pb, guid, 16); if (memcmp(guid, ff_w64_guid_wave, 16)) { av_log(s, AV_LOG_ERROR, "could not find wave guid\n"); } wav->w64 = 1; st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); while (!avio_feof(pb)) { if (avio_read(pb, guid, 16) != 16) break; size = avio_rl64(pb); if (size <= 24 || INT64_MAX - size < avio_tell(pb)) if (!memcmp(guid, ff_w64_guid_fmt, 16)) { /* subtract chunk header size - normal wav file doesn't count it */ ret = ff_get_wav_header(s, pb, st->codecpar, size - 24, 0); if (ret < 0) return ret; avio_skip(pb, FFALIGN(size, INT64_C(8)) - size); avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate); } else if (!memcmp(guid, ff_w64_guid_fact, 16)) { int64_t samples; samples = avio_rl64(pb); if (samples > 0) st->duration = samples; } else if (!memcmp(guid, ff_w64_guid_data, 16)) { wav->data_end = avio_tell(pb) + size - 24; data_ofs = avio_tell(pb); if (!(pb->seekable & AVIO_SEEKABLE_NORMAL)) break; avio_skip(pb, size - 24); } else if (!memcmp(guid, ff_w64_guid_summarylist, 16)) { int64_t start, end, cur; uint32_t count, chunk_size, i; start = avio_tell(pb); end = start + FFALIGN(size, INT64_C(8)) - 24; count = avio_rl32(pb); for (i = 0; i < count; i++) { char chunk_key[5], *value; if (avio_feof(pb) || (cur = avio_tell(pb)) < 0 || cur > end - 8 /* = tag + size */) break; chunk_key[4] = 0; avio_read(pb, chunk_key, 4); chunk_size = avio_rl32(pb); value = av_mallocz(chunk_size + 1); if (!value) return AVERROR(ENOMEM); ret = avio_get_str16le(pb, chunk_size, value, chunk_size); avio_skip(pb, chunk_size - ret); av_dict_set(&s->metadata, chunk_key, value, AV_DICT_DONT_STRDUP_VAL); } avio_skip(pb, end - avio_tell(pb)); } else { av_log(s, AV_LOG_DEBUG, "unknown guid: "FF_PRI_GUID"\n", FF_ARG_GUID(guid)); avio_skip(pb, FFALIGN(size, INT64_C(8)) - 24); } } if (!data_ofs) return AVERROR_EOF; ff_metadata_conv_ctx(s, NULL, wav_metadata_conv); ff_metadata_conv_ctx(s, NULL, ff_riff_info_conv); handle_stream_probing(st); st->need_parsing = AVSTREAM_PARSE_FULL_RAW; avio_seek(pb, data_ofs, SEEK_SET); set_spdif(s, wav); return 0; }
true
FFmpeg
3d232196372f309a75ed074c4cef30578eec1782
static int w64_read_header(AVFormatContext *s) { int64_t size, data_ofs = 0; AVIOContext *pb = s->pb; WAVDemuxContext *wav = s->priv_data; AVStream *st; uint8_t guid[16]; int ret; avio_read(pb, guid, 16); if (memcmp(guid, ff_w64_guid_riff, 16)) if (avio_rl64(pb) < 16 + 8 + 16 + 8 + 16 + 8) avio_read(pb, guid, 16); if (memcmp(guid, ff_w64_guid_wave, 16)) { av_log(s, AV_LOG_ERROR, "could not find wave guid\n"); } wav->w64 = 1; st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); while (!avio_feof(pb)) { if (avio_read(pb, guid, 16) != 16) break; size = avio_rl64(pb); if (size <= 24 || INT64_MAX - size < avio_tell(pb)) if (!memcmp(guid, ff_w64_guid_fmt, 16)) { ret = ff_get_wav_header(s, pb, st->codecpar, size - 24, 0); if (ret < 0) return ret; avio_skip(pb, FFALIGN(size, INT64_C(8)) - size); avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate); } else if (!memcmp(guid, ff_w64_guid_fact, 16)) { int64_t samples; samples = avio_rl64(pb); if (samples > 0) st->duration = samples; } else if (!memcmp(guid, ff_w64_guid_data, 16)) { wav->data_end = avio_tell(pb) + size - 24; data_ofs = avio_tell(pb); if (!(pb->seekable & AVIO_SEEKABLE_NORMAL)) break; avio_skip(pb, size - 24); } else if (!memcmp(guid, ff_w64_guid_summarylist, 16)) { int64_t start, end, cur; uint32_t count, chunk_size, i; start = avio_tell(pb); end = start + FFALIGN(size, INT64_C(8)) - 24; count = avio_rl32(pb); for (i = 0; i < count; i++) { char chunk_key[5], *value; if (avio_feof(pb) || (cur = avio_tell(pb)) < 0 || cur > end - 8 ) break; chunk_key[4] = 0; avio_read(pb, chunk_key, 4); chunk_size = avio_rl32(pb); value = av_mallocz(chunk_size + 1); if (!value) return AVERROR(ENOMEM); ret = avio_get_str16le(pb, chunk_size, value, chunk_size); avio_skip(pb, chunk_size - ret); av_dict_set(&s->metadata, chunk_key, value, AV_DICT_DONT_STRDUP_VAL); } avio_skip(pb, end - avio_tell(pb)); } else { av_log(s, AV_LOG_DEBUG, "unknown guid: "FF_PRI_GUID"\n", FF_ARG_GUID(guid)); avio_skip(pb, FFALIGN(size, INT64_C(8)) - 24); } } if (!data_ofs) return AVERROR_EOF; ff_metadata_conv_ctx(s, NULL, wav_metadata_conv); ff_metadata_conv_ctx(s, NULL, ff_riff_info_conv); handle_stream_probing(st); st->need_parsing = AVSTREAM_PARSE_FULL_RAW; avio_seek(pb, data_ofs, SEEK_SET); set_spdif(s, wav); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0) { int64_t size, data_ofs = 0; AVIOContext *pb = VAR_0->pb; WAVDemuxContext *wav = VAR_0->priv_data; AVStream *st; uint8_t guid[16]; int VAR_1; avio_read(pb, guid, 16); if (memcmp(guid, ff_w64_guid_riff, 16)) if (avio_rl64(pb) < 16 + 8 + 16 + 8 + 16 + 8) avio_read(pb, guid, 16); if (memcmp(guid, ff_w64_guid_wave, 16)) { av_log(VAR_0, AV_LOG_ERROR, "could not find wave guid\n"); } wav->w64 = 1; st = avformat_new_stream(VAR_0, NULL); if (!st) return AVERROR(ENOMEM); while (!avio_feof(pb)) { if (avio_read(pb, guid, 16) != 16) break; size = avio_rl64(pb); if (size <= 24 || INT64_MAX - size < avio_tell(pb)) if (!memcmp(guid, ff_w64_guid_fmt, 16)) { VAR_1 = ff_get_wav_header(VAR_0, pb, st->codecpar, size - 24, 0); if (VAR_1 < 0) return VAR_1; avio_skip(pb, FFALIGN(size, INT64_C(8)) - size); avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate); } else if (!memcmp(guid, ff_w64_guid_fact, 16)) { int64_t samples; samples = avio_rl64(pb); if (samples > 0) st->duration = samples; } else if (!memcmp(guid, ff_w64_guid_data, 16)) { wav->data_end = avio_tell(pb) + size - 24; data_ofs = avio_tell(pb); if (!(pb->seekable & AVIO_SEEKABLE_NORMAL)) break; avio_skip(pb, size - 24); } else if (!memcmp(guid, ff_w64_guid_summarylist, 16)) { int64_t start, end, cur; uint32_t count, chunk_size, i; start = avio_tell(pb); end = start + FFALIGN(size, INT64_C(8)) - 24; count = avio_rl32(pb); for (i = 0; i < count; i++) { char chunk_key[5], *value; if (avio_feof(pb) || (cur = avio_tell(pb)) < 0 || cur > end - 8 ) break; chunk_key[4] = 0; avio_read(pb, chunk_key, 4); chunk_size = avio_rl32(pb); value = av_mallocz(chunk_size + 1); if (!value) return AVERROR(ENOMEM); VAR_1 = avio_get_str16le(pb, chunk_size, value, chunk_size); avio_skip(pb, chunk_size - VAR_1); av_dict_set(&VAR_0->metadata, chunk_key, value, AV_DICT_DONT_STRDUP_VAL); } avio_skip(pb, end - avio_tell(pb)); } else { av_log(VAR_0, AV_LOG_DEBUG, "unknown guid: "FF_PRI_GUID"\n", FF_ARG_GUID(guid)); avio_skip(pb, FFALIGN(size, INT64_C(8)) - 24); } } if (!data_ofs) return AVERROR_EOF; ff_metadata_conv_ctx(VAR_0, NULL, wav_metadata_conv); ff_metadata_conv_ctx(VAR_0, NULL, ff_riff_info_conv); handle_stream_probing(st); st->need_parsing = AVSTREAM_PARSE_FULL_RAW; avio_seek(pb, data_ofs, SEEK_SET); set_spdif(VAR_0, wav); return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0)\n{", "int64_t size, data_ofs = 0;", "AVIOContext *pb = VAR_0->pb;", "WAVDemuxContext *wav = VAR_0->priv_data;", "AVStream *st;", "uint8_t guid[16];", "int VAR_1;", "avio_read(pb, guid, 16);", "if (memcmp(guid, ff_w64_guid_riff, 16))\nif (avio_rl64(pb) < 16 + 8 + 16 + 8 + 16 + 8)\navio_read(pb, guid, 16);", "if (memcmp(guid, ff_w64_guid_wave, 16)) {", "av_log(VAR_0, AV_LOG_ERROR, \"could not find wave guid\\n\");", "}", "wav->w64 = 1;", "st = avformat_new_stream(VAR_0, NULL);", "if (!st)\nreturn AVERROR(ENOMEM);", "while (!avio_feof(pb)) {", "if (avio_read(pb, guid, 16) != 16)\nbreak;", "size = avio_rl64(pb);", "if (size <= 24 || INT64_MAX - size < avio_tell(pb))\nif (!memcmp(guid, ff_w64_guid_fmt, 16)) {", "VAR_1 = ff_get_wav_header(VAR_0, pb, st->codecpar, size - 24, 0);", "if (VAR_1 < 0)\nreturn VAR_1;", "avio_skip(pb, FFALIGN(size, INT64_C(8)) - size);", "avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate);", "} else if (!memcmp(guid, ff_w64_guid_fact, 16)) {", "int64_t samples;", "samples = avio_rl64(pb);", "if (samples > 0)\nst->duration = samples;", "} else if (!memcmp(guid, ff_w64_guid_data, 16)) {", "wav->data_end = avio_tell(pb) + size - 24;", "data_ofs = avio_tell(pb);", "if (!(pb->seekable & AVIO_SEEKABLE_NORMAL))\nbreak;", "avio_skip(pb, size - 24);", "} else if (!memcmp(guid, ff_w64_guid_summarylist, 16)) {", "int64_t start, end, cur;", "uint32_t count, chunk_size, i;", "start = avio_tell(pb);", "end = start + FFALIGN(size, INT64_C(8)) - 24;", "count = avio_rl32(pb);", "for (i = 0; i < count; i++) {", "char chunk_key[5], *value;", "if (avio_feof(pb) || (cur = avio_tell(pb)) < 0 || cur > end - 8 )\nbreak;", "chunk_key[4] = 0;", "avio_read(pb, chunk_key, 4);", "chunk_size = avio_rl32(pb);", "value = av_mallocz(chunk_size + 1);", "if (!value)\nreturn AVERROR(ENOMEM);", "VAR_1 = avio_get_str16le(pb, chunk_size, value, chunk_size);", "avio_skip(pb, chunk_size - VAR_1);", "av_dict_set(&VAR_0->metadata, chunk_key, value, AV_DICT_DONT_STRDUP_VAL);", "}", "avio_skip(pb, end - avio_tell(pb));", "} else {", "av_log(VAR_0, AV_LOG_DEBUG, \"unknown guid: \"FF_PRI_GUID\"\\n\", FF_ARG_GUID(guid));", "avio_skip(pb, FFALIGN(size, INT64_C(8)) - 24);", "}", "}", "if (!data_ofs)\nreturn AVERROR_EOF;", "ff_metadata_conv_ctx(VAR_0, NULL, wav_metadata_conv);", "ff_metadata_conv_ctx(VAR_0, NULL, ff_riff_info_conv);", "handle_stream_probing(st);", "st->need_parsing = AVSTREAM_PARSE_FULL_RAW;", "avio_seek(pb, data_ofs, SEEK_SET);", "set_spdif(VAR_0, wav);", "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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21, 28, 33 ], [ 35 ], [ 37 ], [ 40 ], [ 44 ], [ 48 ], [ 50, 52 ], [ 56 ], [ 58, 60 ], [ 62 ], [ 64, 69 ], [ 73 ], [ 75, 77 ], [ 79 ], [ 83 ], [ 85 ], [ 87 ], [ 91 ], [ 93, 95 ], [ 97 ], [ 99 ], [ 103 ], [ 105, 107 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 121 ], [ 123 ], [ 125 ], [ 129 ], [ 131 ], [ 135, 137 ], [ 141 ], [ 143 ], [ 145 ], [ 151 ], [ 153, 155 ], [ 159 ], [ 161 ], [ 165 ], [ 167 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 185, 187 ], [ 191 ], [ 193 ], [ 197 ], [ 199 ], [ 203 ], [ 207 ], [ 211 ], [ 213 ] ]
10,148
static void floor_fit(venc_context_t * venc, floor_t * fc, float * coeffs, int * posts, int samples) { int range = 255 / fc->multiplier + 1; int i; for (i = 0; i < fc->values; i++) { int position = fc->list[fc->list[i].sort].x; int begin = fc->list[fc->list[FFMAX(i-1, 0)].sort].x; int end = fc->list[fc->list[FFMIN(i+1, fc->values - 1)].sort].x; int j; float average = 0; begin = (position + begin) / 2; end = (position + end ) / 2; assert(end <= samples); for (j = begin; j < end; j++) average += fabs(coeffs[j]); average /= end - begin; average /= 32; // MAGIC! for (j = 0; j < range - 1; j++) if (floor1_inverse_db_table[j * fc->multiplier] > average) break; posts[fc->list[i].sort] = j; } }
false
FFmpeg
68e75e4dec6b5f46a190118eecbba1e95c396e3d
static void floor_fit(venc_context_t * venc, floor_t * fc, float * coeffs, int * posts, int samples) { int range = 255 / fc->multiplier + 1; int i; for (i = 0; i < fc->values; i++) { int position = fc->list[fc->list[i].sort].x; int begin = fc->list[fc->list[FFMAX(i-1, 0)].sort].x; int end = fc->list[fc->list[FFMIN(i+1, fc->values - 1)].sort].x; int j; float average = 0; begin = (position + begin) / 2; end = (position + end ) / 2; assert(end <= samples); for (j = begin; j < end; j++) average += fabs(coeffs[j]); average /= end - begin; average /= 32; for (j = 0; j < range - 1; j++) if (floor1_inverse_db_table[j * fc->multiplier] > average) break; posts[fc->list[i].sort] = j; } }
{ "code": [], "line_no": [] }
static void FUNC_0(venc_context_t * VAR_0, floor_t * VAR_1, float * VAR_2, int * VAR_3, int VAR_4) { int VAR_5 = 255 / VAR_1->multiplier + 1; int VAR_6; for (VAR_6 = 0; VAR_6 < VAR_1->values; VAR_6++) { int position = VAR_1->list[VAR_1->list[VAR_6].sort].x; int begin = VAR_1->list[VAR_1->list[FFMAX(VAR_6-1, 0)].sort].x; int end = VAR_1->list[VAR_1->list[FFMIN(VAR_6+1, VAR_1->values - 1)].sort].x; int j; float average = 0; begin = (position + begin) / 2; end = (position + end ) / 2; assert(end <= VAR_4); for (j = begin; j < end; j++) average += fabs(VAR_2[j]); average /= end - begin; average /= 32; for (j = 0; j < VAR_5 - 1; j++) if (floor1_inverse_db_table[j * VAR_1->multiplier] > average) break; VAR_3[VAR_1->list[VAR_6].sort] = j; } }
[ "static void FUNC_0(venc_context_t * VAR_0, floor_t * VAR_1, float * VAR_2, int * VAR_3, int VAR_4) {", "int VAR_5 = 255 / VAR_1->multiplier + 1;", "int VAR_6;", "for (VAR_6 = 0; VAR_6 < VAR_1->values; VAR_6++) {", "int position = VAR_1->list[VAR_1->list[VAR_6].sort].x;", "int begin = VAR_1->list[VAR_1->list[FFMAX(VAR_6-1, 0)].sort].x;", "int end = VAR_1->list[VAR_1->list[FFMIN(VAR_6+1, VAR_1->values - 1)].sort].x;", "int j;", "float average = 0;", "begin = (position + begin) / 2;", "end = (position + end ) / 2;", "assert(end <= VAR_4);", "for (j = begin; j < end; j++) average += fabs(VAR_2[j]);", "average /= end - begin;", "average /= 32;", "for (j = 0; j < VAR_5 - 1; j++) if (floor1_inverse_db_table[j * VAR_1->multiplier] > average) break;", "VAR_3[VAR_1->list[VAR_6].sort] = j;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ] ]
10,150
static int audio_decode_frame(VideoState *is) { AVPacket *pkt_temp = &is->audio_pkt_temp; AVPacket *pkt = &is->audio_pkt; AVCodecContext *dec = is->audio_st->codec; int len1, data_size, resampled_data_size; int64_t dec_channel_layout; int got_frame; av_unused double audio_clock0; int new_packet = 0; int flush_complete = 0; int wanted_nb_samples; AVRational tb; int ret; int reconfigure; for (;;) { /* NOTE: the audio packet can contain several frames */ while (pkt_temp->size > 0 || (!pkt_temp->data && new_packet) || is->audio_buf_frames_pending) { if (!is->frame) { if (!(is->frame = avcodec_alloc_frame())) return AVERROR(ENOMEM); } else { av_frame_unref(is->frame); avcodec_get_frame_defaults(is->frame); } if (is->audioq.serial != is->audio_pkt_temp_serial) break; if (is->paused) return -1; if (!is->audio_buf_frames_pending) { if (flush_complete) break; new_packet = 0; len1 = avcodec_decode_audio4(dec, is->frame, &got_frame, pkt_temp); if (len1 < 0) { /* if error, we skip the frame */ pkt_temp->size = 0; break; } pkt_temp->data += len1; pkt_temp->size -= len1; if (!got_frame) { /* stop sending empty packets if the decoder is finished */ if (!pkt_temp->data && dec->codec->capabilities & CODEC_CAP_DELAY) flush_complete = 1; continue; } tb = (AVRational){1, is->frame->sample_rate}; if (is->frame->pts != AV_NOPTS_VALUE) is->frame->pts = av_rescale_q(is->frame->pts, dec->time_base, tb); else if (is->frame->pkt_pts != AV_NOPTS_VALUE) is->frame->pts = av_rescale_q(is->frame->pkt_pts, is->audio_st->time_base, tb); if (pkt_temp->pts != AV_NOPTS_VALUE) pkt_temp->pts += (double) is->frame->nb_samples / is->frame->sample_rate / av_q2d(is->audio_st->time_base); #if CONFIG_AVFILTER dec_channel_layout = get_valid_channel_layout(is->frame->channel_layout, av_frame_get_channels(is->frame)); reconfigure = cmp_audio_fmts(is->audio_filter_src.fmt, is->audio_filter_src.channels, is->frame->format, av_frame_get_channels(is->frame)) || is->audio_filter_src.channel_layout != dec_channel_layout || is->audio_filter_src.freq != is->frame->sample_rate || is->audio_pkt_temp_serial != is->audio_last_serial; if (reconfigure) { char buf1[1024], buf2[1024]; av_get_channel_layout_string(buf1, sizeof(buf1), -1, is->audio_filter_src.channel_layout); av_get_channel_layout_string(buf2, sizeof(buf2), -1, dec_channel_layout); av_log(NULL, AV_LOG_DEBUG, "Audio frame changed from rate:%d ch:%d fmt:%s layout:%s serial:%d to rate:%d ch:%d fmt:%s layout:%s serial:%d\n", is->audio_filter_src.freq, is->audio_filter_src.channels, av_get_sample_fmt_name(is->audio_filter_src.fmt), buf1, is->audio_last_serial, is->frame->sample_rate, av_frame_get_channels(is->frame), av_get_sample_fmt_name(is->frame->format), buf2, is->audio_pkt_temp_serial); is->audio_filter_src.fmt = is->frame->format; is->audio_filter_src.channels = av_frame_get_channels(is->frame); is->audio_filter_src.channel_layout = dec_channel_layout; is->audio_filter_src.freq = is->frame->sample_rate; is->audio_last_serial = is->audio_pkt_temp_serial; if ((ret = configure_audio_filters(is, afilters, 1)) < 0) return ret; } if ((ret = av_buffersrc_add_frame(is->in_audio_filter, is->frame)) < 0) return ret; av_frame_unref(is->frame); #endif } #if CONFIG_AVFILTER if ((ret = av_buffersink_get_frame_flags(is->out_audio_filter, is->frame, 0)) < 0) { if (ret == AVERROR(EAGAIN)) { is->audio_buf_frames_pending = 0; continue; } return ret; } is->audio_buf_frames_pending = 1; tb = is->out_audio_filter->inputs[0]->time_base; #endif data_size = av_samples_get_buffer_size(NULL, av_frame_get_channels(is->frame), is->frame->nb_samples, is->frame->format, 1); dec_channel_layout = (is->frame->channel_layout && av_frame_get_channels(is->frame) == av_get_channel_layout_nb_channels(is->frame->channel_layout)) ? is->frame->channel_layout : av_get_default_channel_layout(av_frame_get_channels(is->frame)); wanted_nb_samples = synchronize_audio(is, is->frame->nb_samples); if (is->frame->format != is->audio_src.fmt || dec_channel_layout != is->audio_src.channel_layout || is->frame->sample_rate != is->audio_src.freq || (wanted_nb_samples != is->frame->nb_samples && !is->swr_ctx)) { swr_free(&is->swr_ctx); is->swr_ctx = swr_alloc_set_opts(NULL, is->audio_tgt.channel_layout, is->audio_tgt.fmt, is->audio_tgt.freq, dec_channel_layout, is->frame->format, is->frame->sample_rate, 0, NULL); if (!is->swr_ctx || swr_init(is->swr_ctx) < 0) { av_log(NULL, AV_LOG_ERROR, "Cannot create sample rate converter for conversion of %d Hz %s %d channels to %d Hz %s %d channels!\n", is->frame->sample_rate, av_get_sample_fmt_name(is->frame->format), av_frame_get_channels(is->frame), is->audio_tgt.freq, av_get_sample_fmt_name(is->audio_tgt.fmt), is->audio_tgt.channels); break; } is->audio_src.channel_layout = dec_channel_layout; is->audio_src.channels = av_frame_get_channels(is->frame); is->audio_src.freq = is->frame->sample_rate; is->audio_src.fmt = is->frame->format; } if (is->swr_ctx) { const uint8_t **in = (const uint8_t **)is->frame->extended_data; uint8_t **out = &is->audio_buf1; int out_count = (int64_t)wanted_nb_samples * is->audio_tgt.freq / is->frame->sample_rate + 256; int out_size = av_samples_get_buffer_size(NULL, is->audio_tgt.channels, out_count, is->audio_tgt.fmt, 0); int len2; if (out_size < 0) { av_log(NULL, AV_LOG_ERROR, "av_samples_get_buffer_size() failed\n"); break; } if (wanted_nb_samples != is->frame->nb_samples) { if (swr_set_compensation(is->swr_ctx, (wanted_nb_samples - is->frame->nb_samples) * is->audio_tgt.freq / is->frame->sample_rate, wanted_nb_samples * is->audio_tgt.freq / is->frame->sample_rate) < 0) { av_log(NULL, AV_LOG_ERROR, "swr_set_compensation() failed\n"); break; } } av_fast_malloc(&is->audio_buf1, &is->audio_buf1_size, out_size); if (!is->audio_buf1) return AVERROR(ENOMEM); len2 = swr_convert(is->swr_ctx, out, out_count, in, is->frame->nb_samples); if (len2 < 0) { av_log(NULL, AV_LOG_ERROR, "swr_convert() failed\n"); break; } if (len2 == out_count) { av_log(NULL, AV_LOG_WARNING, "audio buffer is probably too small\n"); swr_init(is->swr_ctx); } is->audio_buf = is->audio_buf1; resampled_data_size = len2 * is->audio_tgt.channels * av_get_bytes_per_sample(is->audio_tgt.fmt); } else { is->audio_buf = is->frame->data[0]; resampled_data_size = data_size; } audio_clock0 = is->audio_clock; /* update the audio clock with the pts */ if (is->frame->pts != AV_NOPTS_VALUE) is->audio_clock = is->frame->pts * av_q2d(tb) + (double) is->frame->nb_samples / is->frame->sample_rate; else is->audio_clock = NAN; is->audio_clock_serial = is->audio_pkt_temp_serial; #ifdef DEBUG { static double last_clock; printf("audio: delay=%0.3f clock=%0.3f clock0=%0.3f\n", is->audio_clock - last_clock, is->audio_clock, audio_clock0); last_clock = is->audio_clock; } #endif return resampled_data_size; } /* free the current packet */ if (pkt->data) av_free_packet(pkt); memset(pkt_temp, 0, sizeof(*pkt_temp)); if (is->audioq.abort_request) { return -1; } if (is->audioq.nb_packets == 0) SDL_CondSignal(is->continue_read_thread); /* read next packet */ if ((new_packet = packet_queue_get(&is->audioq, pkt, 1, &is->audio_pkt_temp_serial)) < 0) return -1; if (pkt->data == flush_pkt.data) { avcodec_flush_buffers(dec); flush_complete = 0; is->audio_buf_frames_pending = 0; } *pkt_temp = *pkt; } }
false
FFmpeg
782e06e292c59abc8528484bd1cb253a42d7f53e
static int audio_decode_frame(VideoState *is) { AVPacket *pkt_temp = &is->audio_pkt_temp; AVPacket *pkt = &is->audio_pkt; AVCodecContext *dec = is->audio_st->codec; int len1, data_size, resampled_data_size; int64_t dec_channel_layout; int got_frame; av_unused double audio_clock0; int new_packet = 0; int flush_complete = 0; int wanted_nb_samples; AVRational tb; int ret; int reconfigure; for (;;) { while (pkt_temp->size > 0 || (!pkt_temp->data && new_packet) || is->audio_buf_frames_pending) { if (!is->frame) { if (!(is->frame = avcodec_alloc_frame())) return AVERROR(ENOMEM); } else { av_frame_unref(is->frame); avcodec_get_frame_defaults(is->frame); } if (is->audioq.serial != is->audio_pkt_temp_serial) break; if (is->paused) return -1; if (!is->audio_buf_frames_pending) { if (flush_complete) break; new_packet = 0; len1 = avcodec_decode_audio4(dec, is->frame, &got_frame, pkt_temp); if (len1 < 0) { pkt_temp->size = 0; break; } pkt_temp->data += len1; pkt_temp->size -= len1; if (!got_frame) { if (!pkt_temp->data && dec->codec->capabilities & CODEC_CAP_DELAY) flush_complete = 1; continue; } tb = (AVRational){1, is->frame->sample_rate}; if (is->frame->pts != AV_NOPTS_VALUE) is->frame->pts = av_rescale_q(is->frame->pts, dec->time_base, tb); else if (is->frame->pkt_pts != AV_NOPTS_VALUE) is->frame->pts = av_rescale_q(is->frame->pkt_pts, is->audio_st->time_base, tb); if (pkt_temp->pts != AV_NOPTS_VALUE) pkt_temp->pts += (double) is->frame->nb_samples / is->frame->sample_rate / av_q2d(is->audio_st->time_base); #if CONFIG_AVFILTER dec_channel_layout = get_valid_channel_layout(is->frame->channel_layout, av_frame_get_channels(is->frame)); reconfigure = cmp_audio_fmts(is->audio_filter_src.fmt, is->audio_filter_src.channels, is->frame->format, av_frame_get_channels(is->frame)) || is->audio_filter_src.channel_layout != dec_channel_layout || is->audio_filter_src.freq != is->frame->sample_rate || is->audio_pkt_temp_serial != is->audio_last_serial; if (reconfigure) { char buf1[1024], buf2[1024]; av_get_channel_layout_string(buf1, sizeof(buf1), -1, is->audio_filter_src.channel_layout); av_get_channel_layout_string(buf2, sizeof(buf2), -1, dec_channel_layout); av_log(NULL, AV_LOG_DEBUG, "Audio frame changed from rate:%d ch:%d fmt:%s layout:%s serial:%d to rate:%d ch:%d fmt:%s layout:%s serial:%d\n", is->audio_filter_src.freq, is->audio_filter_src.channels, av_get_sample_fmt_name(is->audio_filter_src.fmt), buf1, is->audio_last_serial, is->frame->sample_rate, av_frame_get_channels(is->frame), av_get_sample_fmt_name(is->frame->format), buf2, is->audio_pkt_temp_serial); is->audio_filter_src.fmt = is->frame->format; is->audio_filter_src.channels = av_frame_get_channels(is->frame); is->audio_filter_src.channel_layout = dec_channel_layout; is->audio_filter_src.freq = is->frame->sample_rate; is->audio_last_serial = is->audio_pkt_temp_serial; if ((ret = configure_audio_filters(is, afilters, 1)) < 0) return ret; } if ((ret = av_buffersrc_add_frame(is->in_audio_filter, is->frame)) < 0) return ret; av_frame_unref(is->frame); #endif } #if CONFIG_AVFILTER if ((ret = av_buffersink_get_frame_flags(is->out_audio_filter, is->frame, 0)) < 0) { if (ret == AVERROR(EAGAIN)) { is->audio_buf_frames_pending = 0; continue; } return ret; } is->audio_buf_frames_pending = 1; tb = is->out_audio_filter->inputs[0]->time_base; #endif data_size = av_samples_get_buffer_size(NULL, av_frame_get_channels(is->frame), is->frame->nb_samples, is->frame->format, 1); dec_channel_layout = (is->frame->channel_layout && av_frame_get_channels(is->frame) == av_get_channel_layout_nb_channels(is->frame->channel_layout)) ? is->frame->channel_layout : av_get_default_channel_layout(av_frame_get_channels(is->frame)); wanted_nb_samples = synchronize_audio(is, is->frame->nb_samples); if (is->frame->format != is->audio_src.fmt || dec_channel_layout != is->audio_src.channel_layout || is->frame->sample_rate != is->audio_src.freq || (wanted_nb_samples != is->frame->nb_samples && !is->swr_ctx)) { swr_free(&is->swr_ctx); is->swr_ctx = swr_alloc_set_opts(NULL, is->audio_tgt.channel_layout, is->audio_tgt.fmt, is->audio_tgt.freq, dec_channel_layout, is->frame->format, is->frame->sample_rate, 0, NULL); if (!is->swr_ctx || swr_init(is->swr_ctx) < 0) { av_log(NULL, AV_LOG_ERROR, "Cannot create sample rate converter for conversion of %d Hz %s %d channels to %d Hz %s %d channels!\n", is->frame->sample_rate, av_get_sample_fmt_name(is->frame->format), av_frame_get_channels(is->frame), is->audio_tgt.freq, av_get_sample_fmt_name(is->audio_tgt.fmt), is->audio_tgt.channels); break; } is->audio_src.channel_layout = dec_channel_layout; is->audio_src.channels = av_frame_get_channels(is->frame); is->audio_src.freq = is->frame->sample_rate; is->audio_src.fmt = is->frame->format; } if (is->swr_ctx) { const uint8_t **in = (const uint8_t **)is->frame->extended_data; uint8_t **out = &is->audio_buf1; int out_count = (int64_t)wanted_nb_samples * is->audio_tgt.freq / is->frame->sample_rate + 256; int out_size = av_samples_get_buffer_size(NULL, is->audio_tgt.channels, out_count, is->audio_tgt.fmt, 0); int len2; if (out_size < 0) { av_log(NULL, AV_LOG_ERROR, "av_samples_get_buffer_size() failed\n"); break; } if (wanted_nb_samples != is->frame->nb_samples) { if (swr_set_compensation(is->swr_ctx, (wanted_nb_samples - is->frame->nb_samples) * is->audio_tgt.freq / is->frame->sample_rate, wanted_nb_samples * is->audio_tgt.freq / is->frame->sample_rate) < 0) { av_log(NULL, AV_LOG_ERROR, "swr_set_compensation() failed\n"); break; } } av_fast_malloc(&is->audio_buf1, &is->audio_buf1_size, out_size); if (!is->audio_buf1) return AVERROR(ENOMEM); len2 = swr_convert(is->swr_ctx, out, out_count, in, is->frame->nb_samples); if (len2 < 0) { av_log(NULL, AV_LOG_ERROR, "swr_convert() failed\n"); break; } if (len2 == out_count) { av_log(NULL, AV_LOG_WARNING, "audio buffer is probably too small\n"); swr_init(is->swr_ctx); } is->audio_buf = is->audio_buf1; resampled_data_size = len2 * is->audio_tgt.channels * av_get_bytes_per_sample(is->audio_tgt.fmt); } else { is->audio_buf = is->frame->data[0]; resampled_data_size = data_size; } audio_clock0 = is->audio_clock; if (is->frame->pts != AV_NOPTS_VALUE) is->audio_clock = is->frame->pts * av_q2d(tb) + (double) is->frame->nb_samples / is->frame->sample_rate; else is->audio_clock = NAN; is->audio_clock_serial = is->audio_pkt_temp_serial; #ifdef DEBUG { static double last_clock; printf("audio: delay=%0.3f clock=%0.3f clock0=%0.3f\n", is->audio_clock - last_clock, is->audio_clock, audio_clock0); last_clock = is->audio_clock; } #endif return resampled_data_size; } if (pkt->data) av_free_packet(pkt); memset(pkt_temp, 0, sizeof(*pkt_temp)); if (is->audioq.abort_request) { return -1; } if (is->audioq.nb_packets == 0) SDL_CondSignal(is->continue_read_thread); if ((new_packet = packet_queue_get(&is->audioq, pkt, 1, &is->audio_pkt_temp_serial)) < 0) return -1; if (pkt->data == flush_pkt.data) { avcodec_flush_buffers(dec); flush_complete = 0; is->audio_buf_frames_pending = 0; } *pkt_temp = *pkt; } }
{ "code": [], "line_no": [] }
static int FUNC_0(VideoState *VAR_0) { AVPacket *pkt_temp = &VAR_0->audio_pkt_temp; AVPacket *pkt = &VAR_0->audio_pkt; AVCodecContext *dec = VAR_0->audio_st->codec; int VAR_1, VAR_2, VAR_3; int64_t dec_channel_layout; int VAR_4; av_unused double audio_clock0; int VAR_5 = 0; int VAR_6 = 0; int VAR_7; AVRational tb; int VAR_8; int VAR_9; for (;;) { while (pkt_temp->size > 0 || (!pkt_temp->data && VAR_5) || VAR_0->audio_buf_frames_pending) { if (!VAR_0->frame) { if (!(VAR_0->frame = avcodec_alloc_frame())) return AVERROR(ENOMEM); } else { av_frame_unref(VAR_0->frame); avcodec_get_frame_defaults(VAR_0->frame); } if (VAR_0->audioq.serial != VAR_0->audio_pkt_temp_serial) break; if (VAR_0->paused) return -1; if (!VAR_0->audio_buf_frames_pending) { if (VAR_6) break; VAR_5 = 0; VAR_1 = avcodec_decode_audio4(dec, VAR_0->frame, &VAR_4, pkt_temp); if (VAR_1 < 0) { pkt_temp->size = 0; break; } pkt_temp->data += VAR_1; pkt_temp->size -= VAR_1; if (!VAR_4) { if (!pkt_temp->data && dec->codec->capabilities & CODEC_CAP_DELAY) VAR_6 = 1; continue; } tb = (AVRational){1, VAR_0->frame->sample_rate}; if (VAR_0->frame->pts != AV_NOPTS_VALUE) VAR_0->frame->pts = av_rescale_q(VAR_0->frame->pts, dec->time_base, tb); else if (VAR_0->frame->pkt_pts != AV_NOPTS_VALUE) VAR_0->frame->pts = av_rescale_q(VAR_0->frame->pkt_pts, VAR_0->audio_st->time_base, tb); if (pkt_temp->pts != AV_NOPTS_VALUE) pkt_temp->pts += (double) VAR_0->frame->nb_samples / VAR_0->frame->sample_rate / av_q2d(VAR_0->audio_st->time_base); #if CONFIG_AVFILTER dec_channel_layout = get_valid_channel_layout(VAR_0->frame->channel_layout, av_frame_get_channels(VAR_0->frame)); VAR_9 = cmp_audio_fmts(VAR_0->audio_filter_src.fmt, VAR_0->audio_filter_src.channels, VAR_0->frame->format, av_frame_get_channels(VAR_0->frame)) || VAR_0->audio_filter_src.channel_layout != dec_channel_layout || VAR_0->audio_filter_src.freq != VAR_0->frame->sample_rate || VAR_0->audio_pkt_temp_serial != VAR_0->audio_last_serial; if (VAR_9) { char buf1[1024], buf2[1024]; av_get_channel_layout_string(buf1, sizeof(buf1), -1, VAR_0->audio_filter_src.channel_layout); av_get_channel_layout_string(buf2, sizeof(buf2), -1, dec_channel_layout); av_log(NULL, AV_LOG_DEBUG, "Audio frame changed from rate:%d ch:%d fmt:%s layout:%s serial:%d to rate:%d ch:%d fmt:%s layout:%s serial:%d\n", VAR_0->audio_filter_src.freq, VAR_0->audio_filter_src.channels, av_get_sample_fmt_name(VAR_0->audio_filter_src.fmt), buf1, VAR_0->audio_last_serial, VAR_0->frame->sample_rate, av_frame_get_channels(VAR_0->frame), av_get_sample_fmt_name(VAR_0->frame->format), buf2, VAR_0->audio_pkt_temp_serial); VAR_0->audio_filter_src.fmt = VAR_0->frame->format; VAR_0->audio_filter_src.channels = av_frame_get_channels(VAR_0->frame); VAR_0->audio_filter_src.channel_layout = dec_channel_layout; VAR_0->audio_filter_src.freq = VAR_0->frame->sample_rate; VAR_0->audio_last_serial = VAR_0->audio_pkt_temp_serial; if ((VAR_8 = configure_audio_filters(VAR_0, afilters, 1)) < 0) return VAR_8; } if ((VAR_8 = av_buffersrc_add_frame(VAR_0->in_audio_filter, VAR_0->frame)) < 0) return VAR_8; av_frame_unref(VAR_0->frame); #endif } #if CONFIG_AVFILTER if ((VAR_8 = av_buffersink_get_frame_flags(VAR_0->out_audio_filter, VAR_0->frame, 0)) < 0) { if (VAR_8 == AVERROR(EAGAIN)) { VAR_0->audio_buf_frames_pending = 0; continue; } return VAR_8; } VAR_0->audio_buf_frames_pending = 1; tb = VAR_0->out_audio_filter->inputs[0]->time_base; #endif VAR_2 = av_samples_get_buffer_size(NULL, av_frame_get_channels(VAR_0->frame), VAR_0->frame->nb_samples, VAR_0->frame->format, 1); dec_channel_layout = (VAR_0->frame->channel_layout && av_frame_get_channels(VAR_0->frame) == av_get_channel_layout_nb_channels(VAR_0->frame->channel_layout)) ? VAR_0->frame->channel_layout : av_get_default_channel_layout(av_frame_get_channels(VAR_0->frame)); VAR_7 = synchronize_audio(VAR_0, VAR_0->frame->nb_samples); if (VAR_0->frame->format != VAR_0->audio_src.fmt || dec_channel_layout != VAR_0->audio_src.channel_layout || VAR_0->frame->sample_rate != VAR_0->audio_src.freq || (VAR_7 != VAR_0->frame->nb_samples && !VAR_0->swr_ctx)) { swr_free(&VAR_0->swr_ctx); VAR_0->swr_ctx = swr_alloc_set_opts(NULL, VAR_0->audio_tgt.channel_layout, VAR_0->audio_tgt.fmt, VAR_0->audio_tgt.freq, dec_channel_layout, VAR_0->frame->format, VAR_0->frame->sample_rate, 0, NULL); if (!VAR_0->swr_ctx || swr_init(VAR_0->swr_ctx) < 0) { av_log(NULL, AV_LOG_ERROR, "Cannot create sample rate converter for conversion of %d Hz %s %d channels to %d Hz %s %d channels!\n", VAR_0->frame->sample_rate, av_get_sample_fmt_name(VAR_0->frame->format), av_frame_get_channels(VAR_0->frame), VAR_0->audio_tgt.freq, av_get_sample_fmt_name(VAR_0->audio_tgt.fmt), VAR_0->audio_tgt.channels); break; } VAR_0->audio_src.channel_layout = dec_channel_layout; VAR_0->audio_src.channels = av_frame_get_channels(VAR_0->frame); VAR_0->audio_src.freq = VAR_0->frame->sample_rate; VAR_0->audio_src.fmt = VAR_0->frame->format; } if (VAR_0->swr_ctx) { const uint8_t **VAR_10 = (const uint8_t **)VAR_0->frame->extended_data; uint8_t **out = &VAR_0->audio_buf1; int VAR_11 = (int64_t)VAR_7 * VAR_0->audio_tgt.freq / VAR_0->frame->sample_rate + 256; int VAR_12 = av_samples_get_buffer_size(NULL, VAR_0->audio_tgt.channels, VAR_11, VAR_0->audio_tgt.fmt, 0); int VAR_13; if (VAR_12 < 0) { av_log(NULL, AV_LOG_ERROR, "av_samples_get_buffer_size() failed\n"); break; } if (VAR_7 != VAR_0->frame->nb_samples) { if (swr_set_compensation(VAR_0->swr_ctx, (VAR_7 - VAR_0->frame->nb_samples) * VAR_0->audio_tgt.freq / VAR_0->frame->sample_rate, VAR_7 * VAR_0->audio_tgt.freq / VAR_0->frame->sample_rate) < 0) { av_log(NULL, AV_LOG_ERROR, "swr_set_compensation() failed\n"); break; } } av_fast_malloc(&VAR_0->audio_buf1, &VAR_0->audio_buf1_size, VAR_12); if (!VAR_0->audio_buf1) return AVERROR(ENOMEM); VAR_13 = swr_convert(VAR_0->swr_ctx, out, VAR_11, VAR_10, VAR_0->frame->nb_samples); if (VAR_13 < 0) { av_log(NULL, AV_LOG_ERROR, "swr_convert() failed\n"); break; } if (VAR_13 == VAR_11) { av_log(NULL, AV_LOG_WARNING, "audio buffer VAR_0 probably too small\n"); swr_init(VAR_0->swr_ctx); } VAR_0->audio_buf = VAR_0->audio_buf1; VAR_3 = VAR_13 * VAR_0->audio_tgt.channels * av_get_bytes_per_sample(VAR_0->audio_tgt.fmt); } else { VAR_0->audio_buf = VAR_0->frame->data[0]; VAR_3 = VAR_2; } audio_clock0 = VAR_0->audio_clock; if (VAR_0->frame->pts != AV_NOPTS_VALUE) VAR_0->audio_clock = VAR_0->frame->pts * av_q2d(tb) + (double) VAR_0->frame->nb_samples / VAR_0->frame->sample_rate; else VAR_0->audio_clock = NAN; VAR_0->audio_clock_serial = VAR_0->audio_pkt_temp_serial; #ifdef DEBUG { static double last_clock; printf("audio: delay=%0.3f clock=%0.3f clock0=%0.3f\n", VAR_0->audio_clock - last_clock, VAR_0->audio_clock, audio_clock0); last_clock = VAR_0->audio_clock; } #endif return VAR_3; } if (pkt->data) av_free_packet(pkt); memset(pkt_temp, 0, sizeof(*pkt_temp)); if (VAR_0->audioq.abort_request) { return -1; } if (VAR_0->audioq.nb_packets == 0) SDL_CondSignal(VAR_0->continue_read_thread); if ((VAR_5 = packet_queue_get(&VAR_0->audioq, pkt, 1, &VAR_0->audio_pkt_temp_serial)) < 0) return -1; if (pkt->data == flush_pkt.data) { avcodec_flush_buffers(dec); VAR_6 = 0; VAR_0->audio_buf_frames_pending = 0; } *pkt_temp = *pkt; } }
[ "static int FUNC_0(VideoState *VAR_0)\n{", "AVPacket *pkt_temp = &VAR_0->audio_pkt_temp;", "AVPacket *pkt = &VAR_0->audio_pkt;", "AVCodecContext *dec = VAR_0->audio_st->codec;", "int VAR_1, VAR_2, VAR_3;", "int64_t dec_channel_layout;", "int VAR_4;", "av_unused double audio_clock0;", "int VAR_5 = 0;", "int VAR_6 = 0;", "int VAR_7;", "AVRational tb;", "int VAR_8;", "int VAR_9;", "for (;;) {", "while (pkt_temp->size > 0 || (!pkt_temp->data && VAR_5) || VAR_0->audio_buf_frames_pending) {", "if (!VAR_0->frame) {", "if (!(VAR_0->frame = avcodec_alloc_frame()))\nreturn AVERROR(ENOMEM);", "} else {", "av_frame_unref(VAR_0->frame);", "avcodec_get_frame_defaults(VAR_0->frame);", "}", "if (VAR_0->audioq.serial != VAR_0->audio_pkt_temp_serial)\nbreak;", "if (VAR_0->paused)\nreturn -1;", "if (!VAR_0->audio_buf_frames_pending) {", "if (VAR_6)\nbreak;", "VAR_5 = 0;", "VAR_1 = avcodec_decode_audio4(dec, VAR_0->frame, &VAR_4, pkt_temp);", "if (VAR_1 < 0) {", "pkt_temp->size = 0;", "break;", "}", "pkt_temp->data += VAR_1;", "pkt_temp->size -= VAR_1;", "if (!VAR_4) {", "if (!pkt_temp->data && dec->codec->capabilities & CODEC_CAP_DELAY)\nVAR_6 = 1;", "continue;", "}", "tb = (AVRational){1, VAR_0->frame->sample_rate};", "if (VAR_0->frame->pts != AV_NOPTS_VALUE)\nVAR_0->frame->pts = av_rescale_q(VAR_0->frame->pts, dec->time_base, tb);", "else if (VAR_0->frame->pkt_pts != AV_NOPTS_VALUE)\nVAR_0->frame->pts = av_rescale_q(VAR_0->frame->pkt_pts, VAR_0->audio_st->time_base, tb);", "if (pkt_temp->pts != AV_NOPTS_VALUE)\npkt_temp->pts += (double) VAR_0->frame->nb_samples / VAR_0->frame->sample_rate / av_q2d(VAR_0->audio_st->time_base);", "#if CONFIG_AVFILTER\ndec_channel_layout = get_valid_channel_layout(VAR_0->frame->channel_layout, av_frame_get_channels(VAR_0->frame));", "VAR_9 =\ncmp_audio_fmts(VAR_0->audio_filter_src.fmt, VAR_0->audio_filter_src.channels,\nVAR_0->frame->format, av_frame_get_channels(VAR_0->frame)) ||\nVAR_0->audio_filter_src.channel_layout != dec_channel_layout ||\nVAR_0->audio_filter_src.freq != VAR_0->frame->sample_rate ||\nVAR_0->audio_pkt_temp_serial != VAR_0->audio_last_serial;", "if (VAR_9) {", "char buf1[1024], buf2[1024];", "av_get_channel_layout_string(buf1, sizeof(buf1), -1, VAR_0->audio_filter_src.channel_layout);", "av_get_channel_layout_string(buf2, sizeof(buf2), -1, dec_channel_layout);", "av_log(NULL, AV_LOG_DEBUG,\n\"Audio frame changed from rate:%d ch:%d fmt:%s layout:%s serial:%d to rate:%d ch:%d fmt:%s layout:%s serial:%d\\n\",\nVAR_0->audio_filter_src.freq, VAR_0->audio_filter_src.channels, av_get_sample_fmt_name(VAR_0->audio_filter_src.fmt), buf1, VAR_0->audio_last_serial,\nVAR_0->frame->sample_rate, av_frame_get_channels(VAR_0->frame), av_get_sample_fmt_name(VAR_0->frame->format), buf2, VAR_0->audio_pkt_temp_serial);", "VAR_0->audio_filter_src.fmt = VAR_0->frame->format;", "VAR_0->audio_filter_src.channels = av_frame_get_channels(VAR_0->frame);", "VAR_0->audio_filter_src.channel_layout = dec_channel_layout;", "VAR_0->audio_filter_src.freq = VAR_0->frame->sample_rate;", "VAR_0->audio_last_serial = VAR_0->audio_pkt_temp_serial;", "if ((VAR_8 = configure_audio_filters(VAR_0, afilters, 1)) < 0)\nreturn VAR_8;", "}", "if ((VAR_8 = av_buffersrc_add_frame(VAR_0->in_audio_filter, VAR_0->frame)) < 0)\nreturn VAR_8;", "av_frame_unref(VAR_0->frame);", "#endif\n}", "#if CONFIG_AVFILTER\nif ((VAR_8 = av_buffersink_get_frame_flags(VAR_0->out_audio_filter, VAR_0->frame, 0)) < 0) {", "if (VAR_8 == AVERROR(EAGAIN)) {", "VAR_0->audio_buf_frames_pending = 0;", "continue;", "}", "return VAR_8;", "}", "VAR_0->audio_buf_frames_pending = 1;", "tb = VAR_0->out_audio_filter->inputs[0]->time_base;", "#endif\nVAR_2 = av_samples_get_buffer_size(NULL, av_frame_get_channels(VAR_0->frame),\nVAR_0->frame->nb_samples,\nVAR_0->frame->format, 1);", "dec_channel_layout =\n(VAR_0->frame->channel_layout && av_frame_get_channels(VAR_0->frame) == av_get_channel_layout_nb_channels(VAR_0->frame->channel_layout)) ?\nVAR_0->frame->channel_layout : av_get_default_channel_layout(av_frame_get_channels(VAR_0->frame));", "VAR_7 = synchronize_audio(VAR_0, VAR_0->frame->nb_samples);", "if (VAR_0->frame->format != VAR_0->audio_src.fmt ||\ndec_channel_layout != VAR_0->audio_src.channel_layout ||\nVAR_0->frame->sample_rate != VAR_0->audio_src.freq ||\n(VAR_7 != VAR_0->frame->nb_samples && !VAR_0->swr_ctx)) {", "swr_free(&VAR_0->swr_ctx);", "VAR_0->swr_ctx = swr_alloc_set_opts(NULL,\nVAR_0->audio_tgt.channel_layout, VAR_0->audio_tgt.fmt, VAR_0->audio_tgt.freq,\ndec_channel_layout, VAR_0->frame->format, VAR_0->frame->sample_rate,\n0, NULL);", "if (!VAR_0->swr_ctx || swr_init(VAR_0->swr_ctx) < 0) {", "av_log(NULL, AV_LOG_ERROR,\n\"Cannot create sample rate converter for conversion of %d Hz %s %d channels to %d Hz %s %d channels!\\n\",\nVAR_0->frame->sample_rate, av_get_sample_fmt_name(VAR_0->frame->format), av_frame_get_channels(VAR_0->frame),\nVAR_0->audio_tgt.freq, av_get_sample_fmt_name(VAR_0->audio_tgt.fmt), VAR_0->audio_tgt.channels);", "break;", "}", "VAR_0->audio_src.channel_layout = dec_channel_layout;", "VAR_0->audio_src.channels = av_frame_get_channels(VAR_0->frame);", "VAR_0->audio_src.freq = VAR_0->frame->sample_rate;", "VAR_0->audio_src.fmt = VAR_0->frame->format;", "}", "if (VAR_0->swr_ctx) {", "const uint8_t **VAR_10 = (const uint8_t **)VAR_0->frame->extended_data;", "uint8_t **out = &VAR_0->audio_buf1;", "int VAR_11 = (int64_t)VAR_7 * VAR_0->audio_tgt.freq / VAR_0->frame->sample_rate + 256;", "int VAR_12 = av_samples_get_buffer_size(NULL, VAR_0->audio_tgt.channels, VAR_11, VAR_0->audio_tgt.fmt, 0);", "int VAR_13;", "if (VAR_12 < 0) {", "av_log(NULL, AV_LOG_ERROR, \"av_samples_get_buffer_size() failed\\n\");", "break;", "}", "if (VAR_7 != VAR_0->frame->nb_samples) {", "if (swr_set_compensation(VAR_0->swr_ctx, (VAR_7 - VAR_0->frame->nb_samples) * VAR_0->audio_tgt.freq / VAR_0->frame->sample_rate,\nVAR_7 * VAR_0->audio_tgt.freq / VAR_0->frame->sample_rate) < 0) {", "av_log(NULL, AV_LOG_ERROR, \"swr_set_compensation() failed\\n\");", "break;", "}", "}", "av_fast_malloc(&VAR_0->audio_buf1, &VAR_0->audio_buf1_size, VAR_12);", "if (!VAR_0->audio_buf1)\nreturn AVERROR(ENOMEM);", "VAR_13 = swr_convert(VAR_0->swr_ctx, out, VAR_11, VAR_10, VAR_0->frame->nb_samples);", "if (VAR_13 < 0) {", "av_log(NULL, AV_LOG_ERROR, \"swr_convert() failed\\n\");", "break;", "}", "if (VAR_13 == VAR_11) {", "av_log(NULL, AV_LOG_WARNING, \"audio buffer VAR_0 probably too small\\n\");", "swr_init(VAR_0->swr_ctx);", "}", "VAR_0->audio_buf = VAR_0->audio_buf1;", "VAR_3 = VAR_13 * VAR_0->audio_tgt.channels * av_get_bytes_per_sample(VAR_0->audio_tgt.fmt);", "} else {", "VAR_0->audio_buf = VAR_0->frame->data[0];", "VAR_3 = VAR_2;", "}", "audio_clock0 = VAR_0->audio_clock;", "if (VAR_0->frame->pts != AV_NOPTS_VALUE)\nVAR_0->audio_clock = VAR_0->frame->pts * av_q2d(tb) + (double) VAR_0->frame->nb_samples / VAR_0->frame->sample_rate;", "else\nVAR_0->audio_clock = NAN;", "VAR_0->audio_clock_serial = VAR_0->audio_pkt_temp_serial;", "#ifdef DEBUG\n{", "static double last_clock;", "printf(\"audio: delay=%0.3f clock=%0.3f clock0=%0.3f\\n\",\nVAR_0->audio_clock - last_clock,\nVAR_0->audio_clock, audio_clock0);", "last_clock = VAR_0->audio_clock;", "}", "#endif\nreturn VAR_3;", "}", "if (pkt->data)\nav_free_packet(pkt);", "memset(pkt_temp, 0, sizeof(*pkt_temp));", "if (VAR_0->audioq.abort_request) {", "return -1;", "}", "if (VAR_0->audioq.nb_packets == 0)\nSDL_CondSignal(VAR_0->continue_read_thread);", "if ((VAR_5 = packet_queue_get(&VAR_0->audioq, pkt, 1, &VAR_0->audio_pkt_temp_serial)) < 0)\nreturn -1;", "if (pkt->data == flush_pkt.data) {", "avcodec_flush_buffers(dec);", "VAR_6 = 0;", "VAR_0->audio_buf_frames_pending = 0;", "}", "*pkt_temp = *pkt;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55, 57 ], [ 61, 63 ], [ 67 ], [ 69, 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 83 ], [ 85 ], [ 89 ], [ 91 ], [ 95 ], [ 99, 101 ], [ 103 ], [ 105 ], [ 109 ], [ 111, 113 ], [ 115, 117 ], [ 119, 121 ], [ 125, 127 ], [ 131, 133, 135, 137, 139, 141 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153, 155, 157, 159 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 175, 177 ], [ 179 ], [ 183, 185 ], [ 187 ], [ 189, 191 ], [ 193, 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213, 217, 219, 221 ], [ 225, 227, 229 ], [ 231 ], [ 235, 237, 239, 241 ], [ 243 ], [ 245, 247, 249, 251 ], [ 253 ], [ 255, 257, 259, 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ], [ 291 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 301, 303 ], [ 305 ], [ 307 ], [ 309 ], [ 311 ], [ 313 ], [ 315, 317 ], [ 319 ], [ 321 ], [ 323 ], [ 325 ], [ 327 ], [ 329 ], [ 331 ], [ 333 ], [ 335 ], [ 337 ], [ 339 ], [ 341 ], [ 343 ], [ 345 ], [ 347 ], [ 351 ], [ 355, 357 ], [ 359, 361 ], [ 363 ], [ 365, 367 ], [ 369 ], [ 371, 373, 375 ], [ 377 ], [ 379 ], [ 381, 383 ], [ 385 ], [ 391, 393 ], [ 395 ], [ 399 ], [ 401 ], [ 403 ], [ 407, 409 ], [ 415, 417 ], [ 421 ], [ 423 ], [ 425 ], [ 427 ], [ 429 ], [ 433 ], [ 435 ], [ 437 ] ]
10,151
static hwaddr ppc_hash64_pte_raddr(ppc_slb_t *slb, ppc_hash_pte64_t pte, target_ulong eaddr) { hwaddr mask; int target_page_bits; hwaddr rpn = pte.pte1 & HPTE64_R_RPN; /* * We support 4K, 64K and 16M now */ target_page_bits = ppc_hash64_page_shift(slb); mask = (1ULL << target_page_bits) - 1; return (rpn & ~mask) | (eaddr & mask); }
true
qemu
cd6a9bb6e977864b1b7ec21b983fa0678b4b82e9
static hwaddr ppc_hash64_pte_raddr(ppc_slb_t *slb, ppc_hash_pte64_t pte, target_ulong eaddr) { hwaddr mask; int target_page_bits; hwaddr rpn = pte.pte1 & HPTE64_R_RPN; target_page_bits = ppc_hash64_page_shift(slb); mask = (1ULL << target_page_bits) - 1; return (rpn & ~mask) | (eaddr & mask); }
{ "code": [ "static hwaddr ppc_hash64_pte_raddr(ppc_slb_t *slb, ppc_hash_pte64_t pte,", " target_ulong eaddr)", " hwaddr mask;", " int target_page_bits;", " hwaddr rpn = pte.pte1 & HPTE64_R_RPN;", " target_page_bits = ppc_hash64_page_shift(slb);", " mask = (1ULL << target_page_bits) - 1;", " return (rpn & ~mask) | (eaddr & mask);" ], "line_no": [ 1, 3, 7, 9, 11, 19, 21, 23 ] }
static hwaddr FUNC_0(ppc_slb_t *slb, ppc_hash_pte64_t pte, target_ulong eaddr) { hwaddr mask; int VAR_0; hwaddr rpn = pte.pte1 & HPTE64_R_RPN; VAR_0 = ppc_hash64_page_shift(slb); mask = (1ULL << VAR_0) - 1; return (rpn & ~mask) | (eaddr & mask); }
[ "static hwaddr FUNC_0(ppc_slb_t *slb, ppc_hash_pte64_t pte,\ntarget_ulong eaddr)\n{", "hwaddr mask;", "int VAR_0;", "hwaddr rpn = pte.pte1 & HPTE64_R_RPN;", "VAR_0 = ppc_hash64_page_shift(slb);", "mask = (1ULL << VAR_0) - 1;", "return (rpn & ~mask) | (eaddr & mask);", "}" ]
[ 1, 1, 1, 1, 1, 1, 1, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ] ]
10,152
static void nfs_file_close(BlockDriverState *bs) { NFSClient *client = bs->opaque; nfs_client_close(client); qemu_mutex_destroy(&client->mutex); }
true
qemu
113fe792fd4931dd0538f03859278b8719ee4fa2
static void nfs_file_close(BlockDriverState *bs) { NFSClient *client = bs->opaque; nfs_client_close(client); qemu_mutex_destroy(&client->mutex); }
{ "code": [ " qemu_mutex_destroy(&client->mutex);" ], "line_no": [ 9 ] }
static void FUNC_0(BlockDriverState *VAR_0) { NFSClient *client = VAR_0->opaque; nfs_client_close(client); qemu_mutex_destroy(&client->mutex); }
[ "static void FUNC_0(BlockDriverState *VAR_0)\n{", "NFSClient *client = VAR_0->opaque;", "nfs_client_close(client);", "qemu_mutex_destroy(&client->mutex);", "}" ]
[ 0, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ] ]
10,153
static int mp3_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags) { MP3Context *mp3 = s->priv_data; AVIndexEntry *ie; AVStream *st = s->streams[0]; int64_t ret = av_index_search_timestamp(st, timestamp, flags); uint32_t header = 0; if (!mp3->xing_toc) { st->skip_samples = timestamp <= 0 ? mp3->start_pad + 528 + 1 : 0; return -1; } if (ret < 0) return ret; ie = &st->index_entries[ret]; ret = avio_seek(s->pb, ie->pos, SEEK_SET); if (ret < 0) return ret; while (!s->pb->eof_reached) { header = (header << 8) + avio_r8(s->pb); if (ff_mpa_check_header(header) >= 0) { ff_update_cur_dts(s, st, ie->timestamp); ret = avio_seek(s->pb, -4, SEEK_CUR); st->skip_samples = ie->timestamp <= 0 ? mp3->start_pad + 528 + 1 : 0; return (ret >= 0) ? 0 : ret; } } return AVERROR_EOF; }
true
FFmpeg
b6267901c466c482b2f1af3578b0a6d88265d144
static int mp3_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags) { MP3Context *mp3 = s->priv_data; AVIndexEntry *ie; AVStream *st = s->streams[0]; int64_t ret = av_index_search_timestamp(st, timestamp, flags); uint32_t header = 0; if (!mp3->xing_toc) { st->skip_samples = timestamp <= 0 ? mp3->start_pad + 528 + 1 : 0; return -1; } if (ret < 0) return ret; ie = &st->index_entries[ret]; ret = avio_seek(s->pb, ie->pos, SEEK_SET); if (ret < 0) return ret; while (!s->pb->eof_reached) { header = (header << 8) + avio_r8(s->pb); if (ff_mpa_check_header(header) >= 0) { ff_update_cur_dts(s, st, ie->timestamp); ret = avio_seek(s->pb, -4, SEEK_CUR); st->skip_samples = ie->timestamp <= 0 ? mp3->start_pad + 528 + 1 : 0; return (ret >= 0) ? 0 : ret; } } return AVERROR_EOF; }
{ "code": [ " while (!s->pb->eof_reached) {", " header = (header << 8) + avio_r8(s->pb);", " if (ff_mpa_check_header(header) >= 0) {", " ff_update_cur_dts(s, st, ie->timestamp);", " ret = avio_seek(s->pb, -4, SEEK_CUR);", " st->skip_samples = ie->timestamp <= 0 ? mp3->start_pad + 528 + 1 : 0;", " return (ret >= 0) ? 0 : ret;", " return AVERROR_EOF;" ], "line_no": [ 47, 49, 51, 53, 55, 59, 63, 71 ] }
static int FUNC_0(AVFormatContext *VAR_0, int VAR_1, int64_t VAR_2, int VAR_3) { MP3Context *mp3 = VAR_0->priv_data; AVIndexEntry *ie; AVStream *st = VAR_0->streams[0]; int64_t ret = av_index_search_timestamp(st, VAR_2, VAR_3); uint32_t header = 0; if (!mp3->xing_toc) { st->skip_samples = VAR_2 <= 0 ? mp3->start_pad + 528 + 1 : 0; return -1; } if (ret < 0) return ret; ie = &st->index_entries[ret]; ret = avio_seek(VAR_0->pb, ie->pos, SEEK_SET); if (ret < 0) return ret; while (!VAR_0->pb->eof_reached) { header = (header << 8) + avio_r8(VAR_0->pb); if (ff_mpa_check_header(header) >= 0) { ff_update_cur_dts(VAR_0, st, ie->VAR_2); ret = avio_seek(VAR_0->pb, -4, SEEK_CUR); st->skip_samples = ie->VAR_2 <= 0 ? mp3->start_pad + 528 + 1 : 0; return (ret >= 0) ? 0 : ret; } } return AVERROR_EOF; }
[ "static int FUNC_0(AVFormatContext *VAR_0, int VAR_1, int64_t VAR_2,\nint VAR_3)\n{", "MP3Context *mp3 = VAR_0->priv_data;", "AVIndexEntry *ie;", "AVStream *st = VAR_0->streams[0];", "int64_t ret = av_index_search_timestamp(st, VAR_2, VAR_3);", "uint32_t header = 0;", "if (!mp3->xing_toc) {", "st->skip_samples = VAR_2 <= 0 ? mp3->start_pad + 528 + 1 : 0;", "return -1;", "}", "if (ret < 0)\nreturn ret;", "ie = &st->index_entries[ret];", "ret = avio_seek(VAR_0->pb, ie->pos, SEEK_SET);", "if (ret < 0)\nreturn ret;", "while (!VAR_0->pb->eof_reached) {", "header = (header << 8) + avio_r8(VAR_0->pb);", "if (ff_mpa_check_header(header) >= 0) {", "ff_update_cur_dts(VAR_0, st, ie->VAR_2);", "ret = avio_seek(VAR_0->pb, -4, SEEK_CUR);", "st->skip_samples = ie->VAR_2 <= 0 ? mp3->start_pad + 528 + 1 : 0;", "return (ret >= 0) ? 0 : ret;", "}", "}", "return AVERROR_EOF;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 31, 33 ], [ 37 ], [ 39 ], [ 41, 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ] ]
10,154
static void test_bmdma_no_busmaster(void) { QPCIDevice *dev; void *bmdma_base, *ide_base; uint8_t status; dev = get_pci_device(&bmdma_base, &ide_base); /* No PRDT_EOT, each entry addr 0/size 64k, and in theory qemu shouldn't be * able to access it anyway because the Bus Master bit in the PCI command * register isn't set. This is complete nonsense, but it used to be pretty * good at confusing and occasionally crashing qemu. */ PrdtEntry prdt[4096] = { }; status = send_dma_request(CMD_READ_DMA | CMDF_NO_BM, 0, 512, prdt, ARRAY_SIZE(prdt), NULL); /* Not entirely clear what the expected result is, but this is what we get * in practice. At least we want to be aware of any changes. */ g_assert_cmphex(status, ==, BM_STS_ACTIVE | BM_STS_INTR); assert_bit_clear(qpci_io_readb(dev, ide_base + reg_status), DF | ERR); }
true
qemu
b4ba67d9a702507793c2724e56f98e9b0f7be02b
static void test_bmdma_no_busmaster(void) { QPCIDevice *dev; void *bmdma_base, *ide_base; uint8_t status; dev = get_pci_device(&bmdma_base, &ide_base); PrdtEntry prdt[4096] = { }; status = send_dma_request(CMD_READ_DMA | CMDF_NO_BM, 0, 512, prdt, ARRAY_SIZE(prdt), NULL); g_assert_cmphex(status, ==, BM_STS_ACTIVE | BM_STS_INTR); assert_bit_clear(qpci_io_readb(dev, ide_base + reg_status), DF | ERR); }
{ "code": [ " dev = get_pci_device(&bmdma_base, &ide_base);", " void *bmdma_base, *ide_base;", " dev = get_pci_device(&bmdma_base, &ide_base);", " assert_bit_clear(qpci_io_readb(dev, ide_base + reg_status), DF | ERR);", " assert_bit_clear(qpci_io_readb(dev, ide_base + reg_status), DF | ERR);", " assert_bit_clear(qpci_io_readb(dev, ide_base + reg_status), DF | ERR);", " assert_bit_clear(qpci_io_readb(dev, ide_base + reg_status), DF | ERR);", " void *bmdma_base, *ide_base;", " dev = get_pci_device(&bmdma_base, &ide_base);", " assert_bit_clear(qpci_io_readb(dev, ide_base + reg_status), DF | ERR);", " assert_bit_clear(qpci_io_readb(dev, ide_base + reg_status), DF | ERR);", " void *bmdma_base, *ide_base;", " dev = get_pci_device(&bmdma_base, &ide_base);", " assert_bit_clear(qpci_io_readb(dev, ide_base + reg_status), DF | ERR);", " assert_bit_clear(qpci_io_readb(dev, ide_base + reg_status), DF | ERR);", " void *bmdma_base, *ide_base;", " dev = get_pci_device(&bmdma_base, &ide_base);", " assert_bit_clear(qpci_io_readb(dev, ide_base + reg_status), DF | ERR);", " assert_bit_clear(qpci_io_readb(dev, ide_base + reg_status), DF | ERR);", " void *bmdma_base, *ide_base;", " dev = get_pci_device(&bmdma_base, &ide_base);", " assert_bit_clear(qpci_io_readb(dev, ide_base + reg_status), DF | ERR);", " void *bmdma_base, *ide_base;", " dev = get_pci_device(&bmdma_base, &ide_base);", " void *bmdma_base, *ide_base;", " dev = get_pci_device(&bmdma_base, &ide_base);", " assert_bit_clear(qpci_io_readb(dev, ide_base + reg_status), DF | ERR);", " void *bmdma_base, *ide_base;", " dev = get_pci_device(&bmdma_base, &ide_base);", " void *bmdma_base, *ide_base;", " dev = get_pci_device(&bmdma_base, &ide_base);", " void *bmdma_base, *ide_base;", " dev = get_pci_device(&bmdma_base, &ide_base);", " void *bmdma_base, *ide_base;", " dev = get_pci_device(&bmdma_base, &ide_base);", " void *bmdma_base, *ide_base;", " dev = get_pci_device(&bmdma_base, &ide_base);" ], "line_no": [ 13, 7, 13, 41, 41, 41, 41, 7, 13, 41, 41, 7, 13, 41, 41, 7, 13, 41, 41, 7, 13, 41, 7, 13, 7, 13, 41, 7, 13, 7, 13, 7, 13, 7, 13, 7, 13 ] }
static void FUNC_0(void) { QPCIDevice *dev; void *VAR_0, *VAR_1; uint8_t status; dev = get_pci_device(&VAR_0, &VAR_1); PrdtEntry prdt[4096] = { }; status = send_dma_request(CMD_READ_DMA | CMDF_NO_BM, 0, 512, prdt, ARRAY_SIZE(prdt), NULL); g_assert_cmphex(status, ==, BM_STS_ACTIVE | BM_STS_INTR); assert_bit_clear(qpci_io_readb(dev, VAR_1 + reg_status), DF | ERR); }
[ "static void FUNC_0(void)\n{", "QPCIDevice *dev;", "void *VAR_0, *VAR_1;", "uint8_t status;", "dev = get_pci_device(&VAR_0, &VAR_1);", "PrdtEntry prdt[4096] = { };", "status = send_dma_request(CMD_READ_DMA | CMDF_NO_BM, 0, 512,\nprdt, ARRAY_SIZE(prdt), NULL);", "g_assert_cmphex(status, ==, BM_STS_ACTIVE | BM_STS_INTR);", "assert_bit_clear(qpci_io_readb(dev, VAR_1 + reg_status), DF | ERR);", "}" ]
[ 0, 0, 1, 0, 1, 0, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 25 ], [ 29, 31 ], [ 39 ], [ 41 ], [ 43 ] ]
10,155
static int configure_output_video_filter(FilterGraph *fg, OutputFilter *ofilter, AVFilterInOut *out) { char *pix_fmts; OutputStream *ost = ofilter->ost; AVCodecContext *codec = ost->st->codec; AVFilterContext *last_filter = out->filter_ctx; int pad_idx = out->pad_idx; int ret; char name[255]; snprintf(name, sizeof(name), "output stream %d:%d", ost->file_index, ost->index); ret = avfilter_graph_create_filter(&ofilter->filter, avfilter_get_by_name("buffersink"), name, NULL, pix_fmts, fg->graph); if (ret < 0) return ret; if (codec->width || codec->height) { char args[255]; AVFilterContext *filter; snprintf(args, sizeof(args), "%d:%d:flags=0x%X", codec->width, codec->height, (unsigned)ost->sws_flags); snprintf(name, sizeof(name), "scaler for output stream %d:%d", ost->file_index, ost->index); if ((ret = avfilter_graph_create_filter(&filter, avfilter_get_by_name("scale"), name, args, NULL, fg->graph)) < 0) return ret; if ((ret = avfilter_link(last_filter, pad_idx, filter, 0)) < 0) return ret; last_filter = filter; pad_idx = 0; } if ((pix_fmts = choose_pix_fmts(ost))) { AVFilterContext *filter; snprintf(name, sizeof(name), "pixel format for output stream %d:%d", ost->file_index, ost->index); if ((ret = avfilter_graph_create_filter(&filter, avfilter_get_by_name("format"), "format", pix_fmts, NULL, fg->graph)) < 0) return ret; if ((ret = avfilter_link(last_filter, pad_idx, filter, 0)) < 0) return ret; last_filter = filter; pad_idx = 0; av_freep(&pix_fmts); } if (ost->frame_rate.num) { AVFilterContext *fps; char args[255]; snprintf(args, sizeof(args), "fps=%d/%d", ost->frame_rate.num, ost->frame_rate.den); snprintf(name, sizeof(name), "fps for output stream %d:%d", ost->file_index, ost->index); ret = avfilter_graph_create_filter(&fps, avfilter_get_by_name("fps"), name, args, NULL, fg->graph); if (ret < 0) return ret; ret = avfilter_link(last_filter, pad_idx, fps, 0); if (ret < 0) return ret; last_filter = fps; pad_idx = 0; } if ((ret = avfilter_link(last_filter, pad_idx, ofilter->filter, 0)) < 0) return ret; return 0; }
true
FFmpeg
58dee6e62d593747b5dbe8ce6c2ff1833151b9b0
static int configure_output_video_filter(FilterGraph *fg, OutputFilter *ofilter, AVFilterInOut *out) { char *pix_fmts; OutputStream *ost = ofilter->ost; AVCodecContext *codec = ost->st->codec; AVFilterContext *last_filter = out->filter_ctx; int pad_idx = out->pad_idx; int ret; char name[255]; snprintf(name, sizeof(name), "output stream %d:%d", ost->file_index, ost->index); ret = avfilter_graph_create_filter(&ofilter->filter, avfilter_get_by_name("buffersink"), name, NULL, pix_fmts, fg->graph); if (ret < 0) return ret; if (codec->width || codec->height) { char args[255]; AVFilterContext *filter; snprintf(args, sizeof(args), "%d:%d:flags=0x%X", codec->width, codec->height, (unsigned)ost->sws_flags); snprintf(name, sizeof(name), "scaler for output stream %d:%d", ost->file_index, ost->index); if ((ret = avfilter_graph_create_filter(&filter, avfilter_get_by_name("scale"), name, args, NULL, fg->graph)) < 0) return ret; if ((ret = avfilter_link(last_filter, pad_idx, filter, 0)) < 0) return ret; last_filter = filter; pad_idx = 0; } if ((pix_fmts = choose_pix_fmts(ost))) { AVFilterContext *filter; snprintf(name, sizeof(name), "pixel format for output stream %d:%d", ost->file_index, ost->index); if ((ret = avfilter_graph_create_filter(&filter, avfilter_get_by_name("format"), "format", pix_fmts, NULL, fg->graph)) < 0) return ret; if ((ret = avfilter_link(last_filter, pad_idx, filter, 0)) < 0) return ret; last_filter = filter; pad_idx = 0; av_freep(&pix_fmts); } if (ost->frame_rate.num) { AVFilterContext *fps; char args[255]; snprintf(args, sizeof(args), "fps=%d/%d", ost->frame_rate.num, ost->frame_rate.den); snprintf(name, sizeof(name), "fps for output stream %d:%d", ost->file_index, ost->index); ret = avfilter_graph_create_filter(&fps, avfilter_get_by_name("fps"), name, args, NULL, fg->graph); if (ret < 0) return ret; ret = avfilter_link(last_filter, pad_idx, fps, 0); if (ret < 0) return ret; last_filter = fps; pad_idx = 0; } if ((ret = avfilter_link(last_filter, pad_idx, ofilter->filter, 0)) < 0) return ret; return 0; }
{ "code": [ " name, NULL, pix_fmts, fg->graph);" ], "line_no": [ 27 ] }
static int FUNC_0(FilterGraph *VAR_0, OutputFilter *VAR_1, AVFilterInOut *VAR_2) { char *VAR_3; OutputStream *ost = VAR_1->ost; AVCodecContext *codec = ost->st->codec; AVFilterContext *last_filter = VAR_2->filter_ctx; int VAR_4 = VAR_2->VAR_4; int VAR_5; char VAR_6[255]; snprintf(VAR_6, sizeof(VAR_6), "output stream %d:%d", ost->file_index, ost->index); VAR_5 = avfilter_graph_create_filter(&VAR_1->filter, avfilter_get_by_name("buffersink"), VAR_6, NULL, VAR_3, VAR_0->graph); if (VAR_5 < 0) return VAR_5; if (codec->width || codec->height) { char VAR_8[255]; AVFilterContext *filter; snprintf(VAR_8, sizeof(VAR_8), "%d:%d:flags=0x%X", codec->width, codec->height, (unsigned)ost->sws_flags); snprintf(VAR_6, sizeof(VAR_6), "scaler for output stream %d:%d", ost->file_index, ost->index); if ((VAR_5 = avfilter_graph_create_filter(&filter, avfilter_get_by_name("scale"), VAR_6, VAR_8, NULL, VAR_0->graph)) < 0) return VAR_5; if ((VAR_5 = avfilter_link(last_filter, VAR_4, filter, 0)) < 0) return VAR_5; last_filter = filter; VAR_4 = 0; } if ((VAR_3 = choose_pix_fmts(ost))) { AVFilterContext *filter; snprintf(VAR_6, sizeof(VAR_6), "pixel format for output stream %d:%d", ost->file_index, ost->index); if ((VAR_5 = avfilter_graph_create_filter(&filter, avfilter_get_by_name("format"), "format", VAR_3, NULL, VAR_0->graph)) < 0) return VAR_5; if ((VAR_5 = avfilter_link(last_filter, VAR_4, filter, 0)) < 0) return VAR_5; last_filter = filter; VAR_4 = 0; av_freep(&VAR_3); } if (ost->frame_rate.num) { AVFilterContext *fps; char VAR_8[255]; snprintf(VAR_8, sizeof(VAR_8), "fps=%d/%d", ost->frame_rate.num, ost->frame_rate.den); snprintf(VAR_6, sizeof(VAR_6), "fps for output stream %d:%d", ost->file_index, ost->index); VAR_5 = avfilter_graph_create_filter(&fps, avfilter_get_by_name("fps"), VAR_6, VAR_8, NULL, VAR_0->graph); if (VAR_5 < 0) return VAR_5; VAR_5 = avfilter_link(last_filter, VAR_4, fps, 0); if (VAR_5 < 0) return VAR_5; last_filter = fps; VAR_4 = 0; } if ((VAR_5 = avfilter_link(last_filter, VAR_4, VAR_1->filter, 0)) < 0) return VAR_5; return 0; }
[ "static int FUNC_0(FilterGraph *VAR_0, OutputFilter *VAR_1, AVFilterInOut *VAR_2)\n{", "char *VAR_3;", "OutputStream *ost = VAR_1->ost;", "AVCodecContext *codec = ost->st->codec;", "AVFilterContext *last_filter = VAR_2->filter_ctx;", "int VAR_4 = VAR_2->VAR_4;", "int VAR_5;", "char VAR_6[255];", "snprintf(VAR_6, sizeof(VAR_6), \"output stream %d:%d\", ost->file_index, ost->index);", "VAR_5 = avfilter_graph_create_filter(&VAR_1->filter,\navfilter_get_by_name(\"buffersink\"),\nVAR_6, NULL, VAR_3, VAR_0->graph);", "if (VAR_5 < 0)\nreturn VAR_5;", "if (codec->width || codec->height) {", "char VAR_8[255];", "AVFilterContext *filter;", "snprintf(VAR_8, sizeof(VAR_8), \"%d:%d:flags=0x%X\",\ncodec->width,\ncodec->height,\n(unsigned)ost->sws_flags);", "snprintf(VAR_6, sizeof(VAR_6), \"scaler for output stream %d:%d\",\nost->file_index, ost->index);", "if ((VAR_5 = avfilter_graph_create_filter(&filter, avfilter_get_by_name(\"scale\"),\nVAR_6, VAR_8, NULL, VAR_0->graph)) < 0)\nreturn VAR_5;", "if ((VAR_5 = avfilter_link(last_filter, VAR_4, filter, 0)) < 0)\nreturn VAR_5;", "last_filter = filter;", "VAR_4 = 0;", "}", "if ((VAR_3 = choose_pix_fmts(ost))) {", "AVFilterContext *filter;", "snprintf(VAR_6, sizeof(VAR_6), \"pixel format for output stream %d:%d\",\nost->file_index, ost->index);", "if ((VAR_5 = avfilter_graph_create_filter(&filter,\navfilter_get_by_name(\"format\"),\n\"format\", VAR_3, NULL,\nVAR_0->graph)) < 0)\nreturn VAR_5;", "if ((VAR_5 = avfilter_link(last_filter, VAR_4, filter, 0)) < 0)\nreturn VAR_5;", "last_filter = filter;", "VAR_4 = 0;", "av_freep(&VAR_3);", "}", "if (ost->frame_rate.num) {", "AVFilterContext *fps;", "char VAR_8[255];", "snprintf(VAR_8, sizeof(VAR_8), \"fps=%d/%d\", ost->frame_rate.num,\nost->frame_rate.den);", "snprintf(VAR_6, sizeof(VAR_6), \"fps for output stream %d:%d\",\nost->file_index, ost->index);", "VAR_5 = avfilter_graph_create_filter(&fps, avfilter_get_by_name(\"fps\"),\nVAR_6, VAR_8, NULL, VAR_0->graph);", "if (VAR_5 < 0)\nreturn VAR_5;", "VAR_5 = avfilter_link(last_filter, VAR_4, fps, 0);", "if (VAR_5 < 0)\nreturn VAR_5;", "last_filter = fps;", "VAR_4 = 0;", "}", "if ((VAR_5 = avfilter_link(last_filter, VAR_4, VAR_1->filter, 0)) < 0)\nreturn VAR_5;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23, 25, 27 ], [ 29, 31 ], [ 35 ], [ 37 ], [ 39 ], [ 43, 45, 47, 49 ], [ 51, 53 ], [ 55, 57, 59 ], [ 61, 63 ], [ 67 ], [ 69 ], [ 71 ], [ 75 ], [ 77 ], [ 79, 81 ], [ 83, 85, 87, 89, 91 ], [ 93, 95 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 109 ], [ 111 ], [ 113 ], [ 117, 119 ], [ 121, 123 ], [ 125, 127 ], [ 129, 131 ], [ 135 ], [ 137, 139 ], [ 141 ], [ 143 ], [ 145 ], [ 149, 151 ], [ 155 ], [ 157 ] ]
10,156
static inline int handle_cpu_signal(uintptr_t pc, siginfo_t *info, int is_write, sigset_t *old_set) { CPUState *cpu = current_cpu; CPUClass *cc; int ret; unsigned long address = (unsigned long)info->si_addr; /* We must handle PC addresses from two different sources: * a call return address and a signal frame address. * * Within cpu_restore_state_from_tb we assume the former and adjust * the address by -GETPC_ADJ so that the address is within the call * insn so that addr does not accidentally match the beginning of the * next guest insn. * * However, when the PC comes from the signal frame, it points to * the actual faulting host insn and not a call insn. Subtracting * GETPC_ADJ in that case may accidentally match the previous guest insn. * * So for the later case, adjust forward to compensate for what * will be done later by cpu_restore_state_from_tb. */ if (helper_retaddr) { pc = helper_retaddr; } else { pc += GETPC_ADJ; } /* For synchronous signals we expect to be coming from the vCPU * thread (so current_cpu should be valid) and either from running * code or during translation which can fault as we cross pages. * * If neither is true then something has gone wrong and we should * abort rather than try and restart the vCPU execution. */ if (!cpu || !cpu->running) { printf("qemu:%s received signal outside vCPU context @ pc=0x%" PRIxPTR "\n", __func__, pc); abort(); } #if defined(DEBUG_SIGNAL) printf("qemu: SIGSEGV pc=0x%08lx address=%08lx w=%d oldset=0x%08lx\n", pc, address, is_write, *(unsigned long *)old_set); #endif /* XXX: locking issue */ if (is_write && h2g_valid(address)) { switch (page_unprotect(h2g(address), pc)) { case 0: /* Fault not caused by a page marked unwritable to protect * cached translations, must be the guest binary's problem. */ break; case 1: /* Fault caused by protection of cached translation; TBs * invalidated, so resume execution. Retain helper_retaddr * for a possible second fault. */ return 1; case 2: /* Fault caused by protection of cached translation, and the * currently executing TB was modified and must be exited * immediately. Clear helper_retaddr for next execution. */ helper_retaddr = 0; cpu_exit_tb_from_sighandler(cpu, old_set); /* NORETURN */ default: g_assert_not_reached(); } } /* Convert forcefully to guest address space, invalid addresses are still valid segv ones */ address = h2g_nocheck(address); cc = CPU_GET_CLASS(cpu); /* see if it is an MMU fault */ g_assert(cc->handle_mmu_fault); ret = cc->handle_mmu_fault(cpu, address, is_write, MMU_USER_IDX); if (ret == 0) { /* The MMU fault was handled without causing real CPU fault. * Retain helper_retaddr for a possible second fault. */ return 1; } /* All other paths lead to cpu_exit; clear helper_retaddr * for next execution. */ helper_retaddr = 0; if (ret < 0) { return 0; /* not an MMU fault */ } /* Now we have a real cpu fault. */ cpu_restore_state(cpu, pc); sigprocmask(SIG_SETMASK, old_set, NULL); cpu_loop_exit(cpu); /* never comes here */ return 1; }
true
qemu
9c4bbee9e3b83544257e82566342c29e15a88637
static inline int handle_cpu_signal(uintptr_t pc, siginfo_t *info, int is_write, sigset_t *old_set) { CPUState *cpu = current_cpu; CPUClass *cc; int ret; unsigned long address = (unsigned long)info->si_addr; if (helper_retaddr) { pc = helper_retaddr; } else { pc += GETPC_ADJ; } if (!cpu || !cpu->running) { printf("qemu:%s received signal outside vCPU context @ pc=0x%" PRIxPTR "\n", __func__, pc); abort(); } #if defined(DEBUG_SIGNAL) printf("qemu: SIGSEGV pc=0x%08lx address=%08lx w=%d oldset=0x%08lx\n", pc, address, is_write, *(unsigned long *)old_set); #endif if (is_write && h2g_valid(address)) { switch (page_unprotect(h2g(address), pc)) { case 0: break; case 1: return 1; case 2: helper_retaddr = 0; cpu_exit_tb_from_sighandler(cpu, old_set); default: g_assert_not_reached(); } } address = h2g_nocheck(address); cc = CPU_GET_CLASS(cpu); g_assert(cc->handle_mmu_fault); ret = cc->handle_mmu_fault(cpu, address, is_write, MMU_USER_IDX); if (ret == 0) { return 1; } helper_retaddr = 0; if (ret < 0) { return 0; } cpu_restore_state(cpu, pc); sigprocmask(SIG_SETMASK, old_set, NULL); cpu_loop_exit(cpu); return 1; }
{ "code": [ " if (is_write && h2g_valid(address)) {" ], "line_no": [ 95 ] }
static inline int FUNC_0(uintptr_t VAR_0, siginfo_t *VAR_1, int VAR_2, sigset_t *VAR_3) { CPUState *cpu = current_cpu; CPUClass *cc; int VAR_4; unsigned long VAR_5 = (unsigned long)VAR_1->si_addr; if (helper_retaddr) { VAR_0 = helper_retaddr; } else { VAR_0 += GETPC_ADJ; } if (!cpu || !cpu->running) { printf("qemu:%s received signal outside vCPU context @ VAR_0=0x%" PRIxPTR "\n", __func__, VAR_0); abort(); } #if defined(DEBUG_SIGNAL) printf("qemu: SIGSEGV VAR_0=0x%08lx VAR_5=%08lx w=%d oldset=0x%08lx\n", VAR_0, VAR_5, VAR_2, *(unsigned long *)VAR_3); #endif if (VAR_2 && h2g_valid(VAR_5)) { switch (page_unprotect(h2g(VAR_5), VAR_0)) { case 0: break; case 1: return 1; case 2: helper_retaddr = 0; cpu_exit_tb_from_sighandler(cpu, VAR_3); default: g_assert_not_reached(); } } VAR_5 = h2g_nocheck(VAR_5); cc = CPU_GET_CLASS(cpu); g_assert(cc->handle_mmu_fault); VAR_4 = cc->handle_mmu_fault(cpu, VAR_5, VAR_2, MMU_USER_IDX); if (VAR_4 == 0) { return 1; } helper_retaddr = 0; if (VAR_4 < 0) { return 0; } cpu_restore_state(cpu, VAR_0); sigprocmask(SIG_SETMASK, VAR_3, NULL); cpu_loop_exit(cpu); return 1; }
[ "static inline int FUNC_0(uintptr_t VAR_0, siginfo_t *VAR_1,\nint VAR_2, sigset_t *VAR_3)\n{", "CPUState *cpu = current_cpu;", "CPUClass *cc;", "int VAR_4;", "unsigned long VAR_5 = (unsigned long)VAR_1->si_addr;", "if (helper_retaddr) {", "VAR_0 = helper_retaddr;", "} else {", "VAR_0 += GETPC_ADJ;", "}", "if (!cpu || !cpu->running) {", "printf(\"qemu:%s received signal outside vCPU context @ VAR_0=0x%\"\nPRIxPTR \"\\n\", __func__, VAR_0);", "abort();", "}", "#if defined(DEBUG_SIGNAL)\nprintf(\"qemu: SIGSEGV VAR_0=0x%08lx VAR_5=%08lx w=%d oldset=0x%08lx\\n\",\nVAR_0, VAR_5, VAR_2, *(unsigned long *)VAR_3);", "#endif\nif (VAR_2 && h2g_valid(VAR_5)) {", "switch (page_unprotect(h2g(VAR_5), VAR_0)) {", "case 0:\nbreak;", "case 1:\nreturn 1;", "case 2:\nhelper_retaddr = 0;", "cpu_exit_tb_from_sighandler(cpu, VAR_3);", "default:\ng_assert_not_reached();", "}", "}", "VAR_5 = h2g_nocheck(VAR_5);", "cc = CPU_GET_CLASS(cpu);", "g_assert(cc->handle_mmu_fault);", "VAR_4 = cc->handle_mmu_fault(cpu, VAR_5, VAR_2, MMU_USER_IDX);", "if (VAR_4 == 0) {", "return 1;", "}", "helper_retaddr = 0;", "if (VAR_4 < 0) {", "return 0;", "}", "cpu_restore_state(cpu, VAR_0);", "sigprocmask(SIG_SETMASK, VAR_3, NULL);", "cpu_loop_exit(cpu);", "return 1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 73 ], [ 75, 77 ], [ 79 ], [ 81 ], [ 85, 87, 89 ], [ 91, 95 ], [ 97 ], [ 99, 107 ], [ 109, 119 ], [ 121, 131 ], [ 133 ], [ 139, 141 ], [ 143 ], [ 145 ], [ 153 ], [ 157 ], [ 161 ], [ 163 ], [ 167 ], [ 175 ], [ 177 ], [ 187 ], [ 191 ], [ 193 ], [ 195 ], [ 201 ], [ 205 ], [ 207 ], [ 213 ], [ 215 ] ]
10,157
static void vc1_sprite_flush(AVCodecContext *avctx) { VC1Context *v = avctx->priv_data; MpegEncContext *s = &v->s; AVFrame *f = &s->current_picture.f; int plane, i; /* Windows Media Image codecs have a convergence interval of two keyframes. Since we can't enforce it, clear to black the missing sprite. This is wrong but it looks better than doing nothing. */ if (f->data[0]) for (plane = 0; plane < (s->flags&CODEC_FLAG_GRAY ? 1 : 3); plane++) for (i = 0; i < v->sprite_height>>!!plane; i++) memset(f->data[plane] + i * f->linesize[plane], plane ? 128 : 0, f->linesize[plane]); }
true
FFmpeg
f6774f905fb3cfdc319523ac640be30b14c1bc55
static void vc1_sprite_flush(AVCodecContext *avctx) { VC1Context *v = avctx->priv_data; MpegEncContext *s = &v->s; AVFrame *f = &s->current_picture.f; int plane, i; if (f->data[0]) for (plane = 0; plane < (s->flags&CODEC_FLAG_GRAY ? 1 : 3); plane++) for (i = 0; i < v->sprite_height>>!!plane; i++) memset(f->data[plane] + i * f->linesize[plane], plane ? 128 : 0, f->linesize[plane]); }
{ "code": [ " AVFrame *f = &s->current_picture.f;" ], "line_no": [ 9 ] }
static void FUNC_0(AVCodecContext *VAR_0) { VC1Context *v = VAR_0->priv_data; MpegEncContext *s = &v->s; AVFrame *f = &s->current_picture.f; int VAR_1, VAR_2; if (f->data[0]) for (VAR_1 = 0; VAR_1 < (s->flags&CODEC_FLAG_GRAY ? 1 : 3); VAR_1++) for (VAR_2 = 0; VAR_2 < v->sprite_height>>!!VAR_1; VAR_2++) memset(f->data[VAR_1] + VAR_2 * f->linesize[VAR_1], VAR_1 ? 128 : 0, f->linesize[VAR_1]); }
[ "static void FUNC_0(AVCodecContext *VAR_0)\n{", "VC1Context *v = VAR_0->priv_data;", "MpegEncContext *s = &v->s;", "AVFrame *f = &s->current_picture.f;", "int VAR_1, VAR_2;", "if (f->data[0])\nfor (VAR_1 = 0; VAR_1 < (s->flags&CODEC_FLAG_GRAY ? 1 : 3); VAR_1++)", "for (VAR_2 = 0; VAR_2 < v->sprite_height>>!!VAR_1; VAR_2++)", "memset(f->data[VAR_1] + VAR_2 * f->linesize[VAR_1],\nVAR_1 ? 128 : 0, f->linesize[VAR_1]);", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 23, 25 ], [ 27 ], [ 29, 31 ], [ 33 ] ]
10,158
void pause_all_vcpus(void) { }
true
qemu
12d4536f7d911b6d87a766ad7300482ea663cea2
void pause_all_vcpus(void) { }
{ "code": [ "void pause_all_vcpus(void)" ], "line_no": [ 1 ] }
void FUNC_0(void) { }
[ "void FUNC_0(void)\n{", "}" ]
[ 1, 0 ]
[ [ 1, 3 ], [ 5 ] ]
10,160
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags) { OverlayContext *over = ctx->priv; int ret; if (!strcmp(cmd, "x")) ret = set_expr(&over->x_pexpr, args, ctx); else if (!strcmp(cmd, "y")) ret = set_expr(&over->y_pexpr, args, ctx); else if (!strcmp(cmd, "enable")) ret = set_expr(&over->enable_pexpr, args, ctx); else ret = AVERROR(ENOSYS); if (ret < 0) return ret; if (over->eval_mode == EVAL_MODE_INIT) { eval_expr(ctx, EVAL_ALL); av_log(ctx, AV_LOG_VERBOSE, "x:%f xi:%d y:%f yi:%d enable:%f\n", over->var_values[VAR_X], over->x, over->var_values[VAR_Y], over->y, over->enable); } return ret; }
false
FFmpeg
9da369604ecf31d9dce2dee21ed214b8c43264c6
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags) { OverlayContext *over = ctx->priv; int ret; if (!strcmp(cmd, "x")) ret = set_expr(&over->x_pexpr, args, ctx); else if (!strcmp(cmd, "y")) ret = set_expr(&over->y_pexpr, args, ctx); else if (!strcmp(cmd, "enable")) ret = set_expr(&over->enable_pexpr, args, ctx); else ret = AVERROR(ENOSYS); if (ret < 0) return ret; if (over->eval_mode == EVAL_MODE_INIT) { eval_expr(ctx, EVAL_ALL); av_log(ctx, AV_LOG_VERBOSE, "x:%f xi:%d y:%f yi:%d enable:%f\n", over->var_values[VAR_X], over->x, over->var_values[VAR_Y], over->y, over->enable); } return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFilterContext *VAR_0, const char *VAR_1, const char *VAR_2, char *VAR_3, int VAR_4, int VAR_5) { OverlayContext *over = VAR_0->priv; int VAR_6; if (!strcmp(VAR_1, "x")) VAR_6 = set_expr(&over->x_pexpr, VAR_2, VAR_0); else if (!strcmp(VAR_1, "y")) VAR_6 = set_expr(&over->y_pexpr, VAR_2, VAR_0); else if (!strcmp(VAR_1, "enable")) VAR_6 = set_expr(&over->enable_pexpr, VAR_2, VAR_0); else VAR_6 = AVERROR(ENOSYS); if (VAR_6 < 0) return VAR_6; if (over->eval_mode == EVAL_MODE_INIT) { eval_expr(VAR_0, EVAL_ALL); av_log(VAR_0, AV_LOG_VERBOSE, "x:%f xi:%d y:%f yi:%d enable:%f\n", over->var_values[VAR_X], over->x, over->var_values[VAR_Y], over->y, over->enable); } return VAR_6; }
[ "static int FUNC_0(AVFilterContext *VAR_0, const char *VAR_1, const char *VAR_2,\nchar *VAR_3, int VAR_4, int VAR_5)\n{", "OverlayContext *over = VAR_0->priv;", "int VAR_6;", "if (!strcmp(VAR_1, \"x\"))\nVAR_6 = set_expr(&over->x_pexpr, VAR_2, VAR_0);", "else if (!strcmp(VAR_1, \"y\"))\nVAR_6 = set_expr(&over->y_pexpr, VAR_2, VAR_0);", "else if (!strcmp(VAR_1, \"enable\"))\nVAR_6 = set_expr(&over->enable_pexpr, VAR_2, VAR_0);", "else\nVAR_6 = AVERROR(ENOSYS);", "if (VAR_6 < 0)\nreturn VAR_6;", "if (over->eval_mode == EVAL_MODE_INIT) {", "eval_expr(VAR_0, EVAL_ALL);", "av_log(VAR_0, AV_LOG_VERBOSE, \"x:%f xi:%d y:%f yi:%d enable:%f\\n\",\nover->var_values[VAR_X], over->x,\nover->var_values[VAR_Y], over->y,\nover->enable);", "}", "return VAR_6;", "}" ]
[ 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 ], [ 31, 33 ], [ 37 ], [ 39 ], [ 41, 43, 45, 47 ], [ 49 ], [ 51 ], [ 53 ] ]
10,162
static int rv20_decode_picture_header(RVDecContext *rv) { MpegEncContext *s = &rv->m; int seq, mb_pos, i; int rpr_bits; #if 0 GetBitContext gb= s->gb; for(i=0; i<64; i++){ av_log(s->avctx, AV_LOG_DEBUG, "%d", get_bits1(&gb)); if(i%4==3) av_log(s->avctx, AV_LOG_DEBUG, " "); } av_log(s->avctx, AV_LOG_DEBUG, "\n"); #endif #if 0 av_log(s->avctx, AV_LOG_DEBUG, "%3dx%03d/%02Xx%02X ", s->width, s->height, s->width/4, s->height/4); for(i=0; i<s->avctx->extradata_size; i++){ av_log(s->avctx, AV_LOG_DEBUG, "%02X ", ((uint8_t*)s->avctx->extradata)[i]); if(i%4==3) av_log(s->avctx, AV_LOG_DEBUG, " "); } av_log(s->avctx, AV_LOG_DEBUG, "\n"); #endif i= get_bits(&s->gb, 2); switch(i){ case 0: s->pict_type= AV_PICTURE_TYPE_I; break; case 1: s->pict_type= AV_PICTURE_TYPE_I; break; //hmm ... case 2: s->pict_type= AV_PICTURE_TYPE_P; break; case 3: s->pict_type= AV_PICTURE_TYPE_B; break; default: av_log(s->avctx, AV_LOG_ERROR, "unknown frame type\n"); return -1; } if(s->low_delay && s->pict_type==AV_PICTURE_TYPE_B){ av_log(s->avctx, AV_LOG_ERROR, "low delay B\n"); return -1; } if(s->last_picture_ptr==NULL && s->pict_type==AV_PICTURE_TYPE_B){ av_log(s->avctx, AV_LOG_ERROR, "early B pix\n"); return -1; } if (get_bits1(&s->gb)){ av_log(s->avctx, AV_LOG_ERROR, "reserved bit set\n"); return -1; } s->qscale = get_bits(&s->gb, 5); if(s->qscale==0){ av_log(s->avctx, AV_LOG_ERROR, "error, qscale:0\n"); return -1; } if(RV_GET_MINOR_VER(rv->sub_id) >= 2) s->loop_filter = get_bits1(&s->gb) && !s->avctx->lowres; if(RV_GET_MINOR_VER(rv->sub_id) <= 1) seq = get_bits(&s->gb, 8) << 7; else seq = get_bits(&s->gb, 13) << 2; rpr_bits = s->avctx->extradata[1] & 7; if(rpr_bits){ int f, new_w, new_h; rpr_bits = FFMIN((rpr_bits >> 1) + 1, 3); f = get_bits(&s->gb, rpr_bits); if(f){ new_w= 4*((uint8_t*)s->avctx->extradata)[6+2*f]; new_h= 4*((uint8_t*)s->avctx->extradata)[7+2*f]; }else{ new_w= s->orig_width ; new_h= s->orig_height; } if(new_w != s->width || new_h != s->height){ AVRational old_aspect = s->avctx->sample_aspect_ratio; av_log(s->avctx, AV_LOG_DEBUG, "attempting to change resolution to %dx%d\n", new_w, new_h); if (av_image_check_size(new_w, new_h, 0, s->avctx) < 0) return -1; ff_MPV_common_end(s); // attempt to keep aspect during typical resolution switches if (!old_aspect.num) old_aspect = (AVRational){1, 1}; if (2 * new_w * s->height == new_h * s->width) s->avctx->sample_aspect_ratio = av_mul_q(old_aspect, (AVRational){2, 1}); if (new_w * s->height == 2 * new_h * s->width) s->avctx->sample_aspect_ratio = av_mul_q(old_aspect, (AVRational){1, 2}); avcodec_set_dimensions(s->avctx, new_w, new_h); s->width = new_w; s->height = new_h; if (ff_MPV_common_init(s) < 0) return -1; } if(s->avctx->debug & FF_DEBUG_PICT_INFO){ av_log(s->avctx, AV_LOG_DEBUG, "F %d/%d\n", f, rpr_bits); } } if (av_image_check_size(s->width, s->height, 0, s->avctx) < 0) return AVERROR_INVALIDDATA; mb_pos = ff_h263_decode_mba(s); seq |= s->time &~0x7FFF; if(seq - s->time > 0x4000) seq -= 0x8000; if(seq - s->time < -0x4000) seq += 0x8000; if(seq != s->time){ if(s->pict_type!=AV_PICTURE_TYPE_B){ s->time= seq; s->pp_time= s->time - s->last_non_b_time; s->last_non_b_time= s->time; }else{ s->time= seq; s->pb_time= s->pp_time - (s->last_non_b_time - s->time); if(s->pp_time <=s->pb_time || s->pp_time <= s->pp_time - s->pb_time || s->pp_time<=0){ av_log(s->avctx, AV_LOG_DEBUG, "messed up order, possible from seeking? skipping current b frame\n"); return FRAME_SKIPPED; } ff_mpeg4_init_direct_mv(s); } } s->no_rounding= get_bits1(&s->gb); if(RV_GET_MINOR_VER(rv->sub_id) <= 1 && s->pict_type == AV_PICTURE_TYPE_B) skip_bits(&s->gb, 5); // binary decoder reads 3+2 bits here but they don't seem to be used s->f_code = 1; s->unrestricted_mv = 1; s->h263_aic= s->pict_type == AV_PICTURE_TYPE_I; // s->alt_inter_vlc=1; // s->obmc=1; // s->umvplus=1; s->modified_quant=1; if(!s->avctx->lowres) s->loop_filter=1; if(s->avctx->debug & FF_DEBUG_PICT_INFO){ av_log(s->avctx, AV_LOG_INFO, "num:%5d x:%2d y:%2d type:%d qscale:%2d rnd:%d\n", seq, s->mb_x, s->mb_y, s->pict_type, s->qscale, s->no_rounding); } av_assert0(s->pict_type != AV_PICTURE_TYPE_B || !s->low_delay); return s->mb_width*s->mb_height - mb_pos; }
true
FFmpeg
f65daf577af25df69f3b43a49879158d2f77f3f8
static int rv20_decode_picture_header(RVDecContext *rv) { MpegEncContext *s = &rv->m; int seq, mb_pos, i; int rpr_bits; #if 0 GetBitContext gb= s->gb; for(i=0; i<64; i++){ av_log(s->avctx, AV_LOG_DEBUG, "%d", get_bits1(&gb)); if(i%4==3) av_log(s->avctx, AV_LOG_DEBUG, " "); } av_log(s->avctx, AV_LOG_DEBUG, "\n"); #endif #if 0 av_log(s->avctx, AV_LOG_DEBUG, "%3dx%03d/%02Xx%02X ", s->width, s->height, s->width/4, s->height/4); for(i=0; i<s->avctx->extradata_size; i++){ av_log(s->avctx, AV_LOG_DEBUG, "%02X ", ((uint8_t*)s->avctx->extradata)[i]); if(i%4==3) av_log(s->avctx, AV_LOG_DEBUG, " "); } av_log(s->avctx, AV_LOG_DEBUG, "\n"); #endif i= get_bits(&s->gb, 2); switch(i){ case 0: s->pict_type= AV_PICTURE_TYPE_I; break; case 1: s->pict_type= AV_PICTURE_TYPE_I; break; case 2: s->pict_type= AV_PICTURE_TYPE_P; break; case 3: s->pict_type= AV_PICTURE_TYPE_B; break; default: av_log(s->avctx, AV_LOG_ERROR, "unknown frame type\n"); return -1; } if(s->low_delay && s->pict_type==AV_PICTURE_TYPE_B){ av_log(s->avctx, AV_LOG_ERROR, "low delay B\n"); return -1; } if(s->last_picture_ptr==NULL && s->pict_type==AV_PICTURE_TYPE_B){ av_log(s->avctx, AV_LOG_ERROR, "early B pix\n"); return -1; } if (get_bits1(&s->gb)){ av_log(s->avctx, AV_LOG_ERROR, "reserved bit set\n"); return -1; } s->qscale = get_bits(&s->gb, 5); if(s->qscale==0){ av_log(s->avctx, AV_LOG_ERROR, "error, qscale:0\n"); return -1; } if(RV_GET_MINOR_VER(rv->sub_id) >= 2) s->loop_filter = get_bits1(&s->gb) && !s->avctx->lowres; if(RV_GET_MINOR_VER(rv->sub_id) <= 1) seq = get_bits(&s->gb, 8) << 7; else seq = get_bits(&s->gb, 13) << 2; rpr_bits = s->avctx->extradata[1] & 7; if(rpr_bits){ int f, new_w, new_h; rpr_bits = FFMIN((rpr_bits >> 1) + 1, 3); f = get_bits(&s->gb, rpr_bits); if(f){ new_w= 4*((uint8_t*)s->avctx->extradata)[6+2*f]; new_h= 4*((uint8_t*)s->avctx->extradata)[7+2*f]; }else{ new_w= s->orig_width ; new_h= s->orig_height; } if(new_w != s->width || new_h != s->height){ AVRational old_aspect = s->avctx->sample_aspect_ratio; av_log(s->avctx, AV_LOG_DEBUG, "attempting to change resolution to %dx%d\n", new_w, new_h); if (av_image_check_size(new_w, new_h, 0, s->avctx) < 0) return -1; ff_MPV_common_end(s); if (!old_aspect.num) old_aspect = (AVRational){1, 1}; if (2 * new_w * s->height == new_h * s->width) s->avctx->sample_aspect_ratio = av_mul_q(old_aspect, (AVRational){2, 1}); if (new_w * s->height == 2 * new_h * s->width) s->avctx->sample_aspect_ratio = av_mul_q(old_aspect, (AVRational){1, 2}); avcodec_set_dimensions(s->avctx, new_w, new_h); s->width = new_w; s->height = new_h; if (ff_MPV_common_init(s) < 0) return -1; } if(s->avctx->debug & FF_DEBUG_PICT_INFO){ av_log(s->avctx, AV_LOG_DEBUG, "F %d/%d\n", f, rpr_bits); } } if (av_image_check_size(s->width, s->height, 0, s->avctx) < 0) return AVERROR_INVALIDDATA; mb_pos = ff_h263_decode_mba(s); seq |= s->time &~0x7FFF; if(seq - s->time > 0x4000) seq -= 0x8000; if(seq - s->time < -0x4000) seq += 0x8000; if(seq != s->time){ if(s->pict_type!=AV_PICTURE_TYPE_B){ s->time= seq; s->pp_time= s->time - s->last_non_b_time; s->last_non_b_time= s->time; }else{ s->time= seq; s->pb_time= s->pp_time - (s->last_non_b_time - s->time); if(s->pp_time <=s->pb_time || s->pp_time <= s->pp_time - s->pb_time || s->pp_time<=0){ av_log(s->avctx, AV_LOG_DEBUG, "messed up order, possible from seeking? skipping current b frame\n"); return FRAME_SKIPPED; } ff_mpeg4_init_direct_mv(s); } } s->no_rounding= get_bits1(&s->gb); if(RV_GET_MINOR_VER(rv->sub_id) <= 1 && s->pict_type == AV_PICTURE_TYPE_B) skip_bits(&s->gb, 5); s->f_code = 1; s->unrestricted_mv = 1; s->h263_aic= s->pict_type == AV_PICTURE_TYPE_I; s->modified_quant=1; if(!s->avctx->lowres) s->loop_filter=1; if(s->avctx->debug & FF_DEBUG_PICT_INFO){ av_log(s->avctx, AV_LOG_INFO, "num:%5d x:%2d y:%2d type:%d qscale:%2d rnd:%d\n", seq, s->mb_x, s->mb_y, s->pict_type, s->qscale, s->no_rounding); } av_assert0(s->pict_type != AV_PICTURE_TYPE_B || !s->low_delay); return s->mb_width*s->mb_height - mb_pos; }
{ "code": [ " if(s->pp_time <=s->pb_time || s->pp_time <= s->pp_time - s->pb_time || s->pp_time<=0){", " av_log(s->avctx, AV_LOG_DEBUG, \"messed up order, possible from seeking? skipping current b frame\\n\");", " return FRAME_SKIPPED;", " ff_mpeg4_init_direct_mv(s);" ], "line_no": [ 235, 237, 239, 243 ] }
static int FUNC_0(RVDecContext *VAR_0) { MpegEncContext *s = &VAR_0->m; int VAR_1, VAR_2, VAR_3; int VAR_4; #if 0 GetBitContext gb= s->gb; for(VAR_3=0; VAR_3<64; VAR_3++){ av_log(s->avctx, AV_LOG_DEBUG, "%d", get_bits1(&gb)); if(VAR_3%4==3) av_log(s->avctx, AV_LOG_DEBUG, " "); } av_log(s->avctx, AV_LOG_DEBUG, "\n"); #endif #if 0 av_log(s->avctx, AV_LOG_DEBUG, "%3dx%03d/%02Xx%02X ", s->width, s->height, s->width/4, s->height/4); for(VAR_3=0; VAR_3<s->avctx->extradata_size; VAR_3++){ av_log(s->avctx, AV_LOG_DEBUG, "%02X ", ((uint8_t*)s->avctx->extradata)[VAR_3]); if(VAR_3%4==3) av_log(s->avctx, AV_LOG_DEBUG, " "); } av_log(s->avctx, AV_LOG_DEBUG, "\n"); #endif VAR_3= get_bits(&s->gb, 2); switch(VAR_3){ case 0: s->pict_type= AV_PICTURE_TYPE_I; break; case 1: s->pict_type= AV_PICTURE_TYPE_I; break; case 2: s->pict_type= AV_PICTURE_TYPE_P; break; case 3: s->pict_type= AV_PICTURE_TYPE_B; break; default: av_log(s->avctx, AV_LOG_ERROR, "unknown frame type\n"); return -1; } if(s->low_delay && s->pict_type==AV_PICTURE_TYPE_B){ av_log(s->avctx, AV_LOG_ERROR, "low delay B\n"); return -1; } if(s->last_picture_ptr==NULL && s->pict_type==AV_PICTURE_TYPE_B){ av_log(s->avctx, AV_LOG_ERROR, "early B pix\n"); return -1; } if (get_bits1(&s->gb)){ av_log(s->avctx, AV_LOG_ERROR, "reserved bit set\n"); return -1; } s->qscale = get_bits(&s->gb, 5); if(s->qscale==0){ av_log(s->avctx, AV_LOG_ERROR, "error, qscale:0\n"); return -1; } if(RV_GET_MINOR_VER(VAR_0->sub_id) >= 2) s->loop_filter = get_bits1(&s->gb) && !s->avctx->lowres; if(RV_GET_MINOR_VER(VAR_0->sub_id) <= 1) VAR_1 = get_bits(&s->gb, 8) << 7; else VAR_1 = get_bits(&s->gb, 13) << 2; VAR_4 = s->avctx->extradata[1] & 7; if(VAR_4){ int VAR_5, VAR_6, VAR_7; VAR_4 = FFMIN((VAR_4 >> 1) + 1, 3); VAR_5 = get_bits(&s->gb, VAR_4); if(VAR_5){ VAR_6= 4*((uint8_t*)s->avctx->extradata)[6+2*VAR_5]; VAR_7= 4*((uint8_t*)s->avctx->extradata)[7+2*VAR_5]; }else{ VAR_6= s->orig_width ; VAR_7= s->orig_height; } if(VAR_6 != s->width || VAR_7 != s->height){ AVRational old_aspect = s->avctx->sample_aspect_ratio; av_log(s->avctx, AV_LOG_DEBUG, "attempting to change resolution to %dx%d\n", VAR_6, VAR_7); if (av_image_check_size(VAR_6, VAR_7, 0, s->avctx) < 0) return -1; ff_MPV_common_end(s); if (!old_aspect.num) old_aspect = (AVRational){1, 1}; if (2 * VAR_6 * s->height == VAR_7 * s->width) s->avctx->sample_aspect_ratio = av_mul_q(old_aspect, (AVRational){2, 1}); if (VAR_6 * s->height == 2 * VAR_7 * s->width) s->avctx->sample_aspect_ratio = av_mul_q(old_aspect, (AVRational){1, 2}); avcodec_set_dimensions(s->avctx, VAR_6, VAR_7); s->width = VAR_6; s->height = VAR_7; if (ff_MPV_common_init(s) < 0) return -1; } if(s->avctx->debug & FF_DEBUG_PICT_INFO){ av_log(s->avctx, AV_LOG_DEBUG, "F %d/%d\n", VAR_5, VAR_4); } } if (av_image_check_size(s->width, s->height, 0, s->avctx) < 0) return AVERROR_INVALIDDATA; VAR_2 = ff_h263_decode_mba(s); VAR_1 |= s->time &~0x7FFF; if(VAR_1 - s->time > 0x4000) VAR_1 -= 0x8000; if(VAR_1 - s->time < -0x4000) VAR_1 += 0x8000; if(VAR_1 != s->time){ if(s->pict_type!=AV_PICTURE_TYPE_B){ s->time= VAR_1; s->pp_time= s->time - s->last_non_b_time; s->last_non_b_time= s->time; }else{ s->time= VAR_1; s->pb_time= s->pp_time - (s->last_non_b_time - s->time); if(s->pp_time <=s->pb_time || s->pp_time <= s->pp_time - s->pb_time || s->pp_time<=0){ av_log(s->avctx, AV_LOG_DEBUG, "messed up order, possible from seeking? skipping current b frame\n"); return FRAME_SKIPPED; } ff_mpeg4_init_direct_mv(s); } } s->no_rounding= get_bits1(&s->gb); if(RV_GET_MINOR_VER(VAR_0->sub_id) <= 1 && s->pict_type == AV_PICTURE_TYPE_B) skip_bits(&s->gb, 5); s->f_code = 1; s->unrestricted_mv = 1; s->h263_aic= s->pict_type == AV_PICTURE_TYPE_I; s->modified_quant=1; if(!s->avctx->lowres) s->loop_filter=1; if(s->avctx->debug & FF_DEBUG_PICT_INFO){ av_log(s->avctx, AV_LOG_INFO, "num:%5d x:%2d y:%2d type:%d qscale:%2d rnd:%d\n", VAR_1, s->mb_x, s->mb_y, s->pict_type, s->qscale, s->no_rounding); } av_assert0(s->pict_type != AV_PICTURE_TYPE_B || !s->low_delay); return s->mb_width*s->mb_height - VAR_2; }
[ "static int FUNC_0(RVDecContext *VAR_0)\n{", "MpegEncContext *s = &VAR_0->m;", "int VAR_1, VAR_2, VAR_3;", "int VAR_4;", "#if 0\nGetBitContext gb= s->gb;", "for(VAR_3=0; VAR_3<64; VAR_3++){", "av_log(s->avctx, AV_LOG_DEBUG, \"%d\", get_bits1(&gb));", "if(VAR_3%4==3) av_log(s->avctx, AV_LOG_DEBUG, \" \");", "}", "av_log(s->avctx, AV_LOG_DEBUG, \"\\n\");", "#endif\n#if 0\nav_log(s->avctx, AV_LOG_DEBUG, \"%3dx%03d/%02Xx%02X \", s->width, s->height, s->width/4, s->height/4);", "for(VAR_3=0; VAR_3<s->avctx->extradata_size; VAR_3++){", "av_log(s->avctx, AV_LOG_DEBUG, \"%02X \", ((uint8_t*)s->avctx->extradata)[VAR_3]);", "if(VAR_3%4==3) av_log(s->avctx, AV_LOG_DEBUG, \" \");", "}", "av_log(s->avctx, AV_LOG_DEBUG, \"\\n\");", "#endif\nVAR_3= get_bits(&s->gb, 2);", "switch(VAR_3){", "case 0: s->pict_type= AV_PICTURE_TYPE_I; break;", "case 1: s->pict_type= AV_PICTURE_TYPE_I; break;", "case 2: s->pict_type= AV_PICTURE_TYPE_P; break;", "case 3: s->pict_type= AV_PICTURE_TYPE_B; break;", "default:\nav_log(s->avctx, AV_LOG_ERROR, \"unknown frame type\\n\");", "return -1;", "}", "if(s->low_delay && s->pict_type==AV_PICTURE_TYPE_B){", "av_log(s->avctx, AV_LOG_ERROR, \"low delay B\\n\");", "return -1;", "}", "if(s->last_picture_ptr==NULL && s->pict_type==AV_PICTURE_TYPE_B){", "av_log(s->avctx, AV_LOG_ERROR, \"early B pix\\n\");", "return -1;", "}", "if (get_bits1(&s->gb)){", "av_log(s->avctx, AV_LOG_ERROR, \"reserved bit set\\n\");", "return -1;", "}", "s->qscale = get_bits(&s->gb, 5);", "if(s->qscale==0){", "av_log(s->avctx, AV_LOG_ERROR, \"error, qscale:0\\n\");", "return -1;", "}", "if(RV_GET_MINOR_VER(VAR_0->sub_id) >= 2)\ns->loop_filter = get_bits1(&s->gb) && !s->avctx->lowres;", "if(RV_GET_MINOR_VER(VAR_0->sub_id) <= 1)\nVAR_1 = get_bits(&s->gb, 8) << 7;", "else\nVAR_1 = get_bits(&s->gb, 13) << 2;", "VAR_4 = s->avctx->extradata[1] & 7;", "if(VAR_4){", "int VAR_5, VAR_6, VAR_7;", "VAR_4 = FFMIN((VAR_4 >> 1) + 1, 3);", "VAR_5 = get_bits(&s->gb, VAR_4);", "if(VAR_5){", "VAR_6= 4*((uint8_t*)s->avctx->extradata)[6+2*VAR_5];", "VAR_7= 4*((uint8_t*)s->avctx->extradata)[7+2*VAR_5];", "}else{", "VAR_6= s->orig_width ;", "VAR_7= s->orig_height;", "}", "if(VAR_6 != s->width || VAR_7 != s->height){", "AVRational old_aspect = s->avctx->sample_aspect_ratio;", "av_log(s->avctx, AV_LOG_DEBUG, \"attempting to change resolution to %dx%d\\n\", VAR_6, VAR_7);", "if (av_image_check_size(VAR_6, VAR_7, 0, s->avctx) < 0)\nreturn -1;", "ff_MPV_common_end(s);", "if (!old_aspect.num)\nold_aspect = (AVRational){1, 1};", "if (2 * VAR_6 * s->height == VAR_7 * s->width)\ns->avctx->sample_aspect_ratio = av_mul_q(old_aspect, (AVRational){2, 1});", "if (VAR_6 * s->height == 2 * VAR_7 * s->width)\ns->avctx->sample_aspect_ratio = av_mul_q(old_aspect, (AVRational){1, 2});", "avcodec_set_dimensions(s->avctx, VAR_6, VAR_7);", "s->width = VAR_6;", "s->height = VAR_7;", "if (ff_MPV_common_init(s) < 0)\nreturn -1;", "}", "if(s->avctx->debug & FF_DEBUG_PICT_INFO){", "av_log(s->avctx, AV_LOG_DEBUG, \"F %d/%d\\n\", VAR_5, VAR_4);", "}", "}", "if (av_image_check_size(s->width, s->height, 0, s->avctx) < 0)\nreturn AVERROR_INVALIDDATA;", "VAR_2 = ff_h263_decode_mba(s);", "VAR_1 |= s->time &~0x7FFF;", "if(VAR_1 - s->time > 0x4000) VAR_1 -= 0x8000;", "if(VAR_1 - s->time < -0x4000) VAR_1 += 0x8000;", "if(VAR_1 != s->time){", "if(s->pict_type!=AV_PICTURE_TYPE_B){", "s->time= VAR_1;", "s->pp_time= s->time - s->last_non_b_time;", "s->last_non_b_time= s->time;", "}else{", "s->time= VAR_1;", "s->pb_time= s->pp_time - (s->last_non_b_time - s->time);", "if(s->pp_time <=s->pb_time || s->pp_time <= s->pp_time - s->pb_time || s->pp_time<=0){", "av_log(s->avctx, AV_LOG_DEBUG, \"messed up order, possible from seeking? skipping current b frame\\n\");", "return FRAME_SKIPPED;", "}", "ff_mpeg4_init_direct_mv(s);", "}", "}", "s->no_rounding= get_bits1(&s->gb);", "if(RV_GET_MINOR_VER(VAR_0->sub_id) <= 1 && s->pict_type == AV_PICTURE_TYPE_B)\nskip_bits(&s->gb, 5);", "s->f_code = 1;", "s->unrestricted_mv = 1;", "s->h263_aic= s->pict_type == AV_PICTURE_TYPE_I;", "s->modified_quant=1;", "if(!s->avctx->lowres)\ns->loop_filter=1;", "if(s->avctx->debug & FF_DEBUG_PICT_INFO){", "av_log(s->avctx, AV_LOG_INFO, \"num:%5d x:%2d y:%2d type:%d qscale:%2d rnd:%d\\n\",\nVAR_1, s->mb_x, s->mb_y, s->pict_type, s->qscale, s->no_rounding);", "}", "av_assert0(s->pict_type != AV_PICTURE_TYPE_B || !s->low_delay);", "return s->mb_width*s->mb_height - VAR_2;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 1, 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, 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59, 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 109, 111 ], [ 115, 117 ], [ 119, 121 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 135 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159, 161 ], [ 163 ], [ 169, 171 ], [ 173, 175 ], [ 177, 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187, 189 ], [ 191 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203, 205 ], [ 209 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 251 ], [ 255, 257 ], [ 261 ], [ 263 ], [ 265 ], [ 273 ], [ 275, 277 ], [ 281 ], [ 283, 285 ], [ 287 ], [ 291 ], [ 295 ], [ 297 ] ]
10,163
void qio_channel_test_validate(QIOChannelTest *test) { g_assert_cmpint(memcmp(test->input, test->output, test->len), ==, 0); g_assert(test->readerr == NULL); g_assert(test->writeerr == NULL); g_free(test->inputv); g_free(test->outputv); g_free(test->input); g_free(test->output); g_free(test); }
true
qemu
294bbbb4252ab5ff42d0e2c09f209c0bd7eb9748
void qio_channel_test_validate(QIOChannelTest *test) { g_assert_cmpint(memcmp(test->input, test->output, test->len), ==, 0); g_assert(test->readerr == NULL); g_assert(test->writeerr == NULL); g_free(test->inputv); g_free(test->outputv); g_free(test->input); g_free(test->output); g_free(test); }
{ "code": [ " g_assert(test->readerr == NULL);", " g_assert(test->writeerr == NULL);" ], "line_no": [ 11, 13 ] }
void FUNC_0(QIOChannelTest *VAR_0) { g_assert_cmpint(memcmp(VAR_0->input, VAR_0->output, VAR_0->len), ==, 0); g_assert(VAR_0->readerr == NULL); g_assert(VAR_0->writeerr == NULL); g_free(VAR_0->inputv); g_free(VAR_0->outputv); g_free(VAR_0->input); g_free(VAR_0->output); g_free(VAR_0); }
[ "void FUNC_0(QIOChannelTest *VAR_0)\n{", "g_assert_cmpint(memcmp(VAR_0->input,\nVAR_0->output,\nVAR_0->len), ==, 0);", "g_assert(VAR_0->readerr == NULL);", "g_assert(VAR_0->writeerr == NULL);", "g_free(VAR_0->inputv);", "g_free(VAR_0->outputv);", "g_free(VAR_0->input);", "g_free(VAR_0->output);", "g_free(VAR_0);", "}" ]
[ 0, 0, 1, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7, 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ] ]
10,164
static void vapic_map_rom_writable(VAPICROMState *s) { hwaddr rom_paddr = s->rom_state_paddr & ROM_BLOCK_MASK; MemoryRegionSection section; MemoryRegion *as; size_t rom_size; uint8_t *ram; as = sysbus_address_space(&s->busdev); if (s->rom_mapped_writable) { memory_region_del_subregion(as, &s->rom); memory_region_destroy(&s->rom); } /* grab RAM memory region (region @rom_paddr may still be pc.rom) */ section = memory_region_find(as, 0, 1); /* read ROM size from RAM region */ ram = memory_region_get_ram_ptr(section.mr); rom_size = ram[rom_paddr + 2] * ROM_BLOCK_SIZE; s->rom_size = rom_size; /* We need to round to avoid creating subpages * from which we cannot run code. */ rom_size += rom_paddr & ~TARGET_PAGE_MASK; rom_paddr &= TARGET_PAGE_MASK; rom_size = TARGET_PAGE_ALIGN(rom_size); memory_region_init_alias(&s->rom, OBJECT(s), "kvmvapic-rom", section.mr, rom_paddr, rom_size); memory_region_add_subregion_overlap(as, rom_paddr, &s->rom, 1000); s->rom_mapped_writable = true; memory_region_unref(section.mr); }
true
qemu
18e5eec4db96a00907eb588a2b803401637c7f67
static void vapic_map_rom_writable(VAPICROMState *s) { hwaddr rom_paddr = s->rom_state_paddr & ROM_BLOCK_MASK; MemoryRegionSection section; MemoryRegion *as; size_t rom_size; uint8_t *ram; as = sysbus_address_space(&s->busdev); if (s->rom_mapped_writable) { memory_region_del_subregion(as, &s->rom); memory_region_destroy(&s->rom); } section = memory_region_find(as, 0, 1); ram = memory_region_get_ram_ptr(section.mr); rom_size = ram[rom_paddr + 2] * ROM_BLOCK_SIZE; s->rom_size = rom_size; rom_size += rom_paddr & ~TARGET_PAGE_MASK; rom_paddr &= TARGET_PAGE_MASK; rom_size = TARGET_PAGE_ALIGN(rom_size); memory_region_init_alias(&s->rom, OBJECT(s), "kvmvapic-rom", section.mr, rom_paddr, rom_size); memory_region_add_subregion_overlap(as, rom_paddr, &s->rom, 1000); s->rom_mapped_writable = true; memory_region_unref(section.mr); }
{ "code": [ "static void vapic_map_rom_writable(VAPICROMState *s)" ], "line_no": [ 1 ] }
static void FUNC_0(VAPICROMState *VAR_0) { hwaddr rom_paddr = VAR_0->rom_state_paddr & ROM_BLOCK_MASK; MemoryRegionSection section; MemoryRegion *as; size_t rom_size; uint8_t *ram; as = sysbus_address_space(&VAR_0->busdev); if (VAR_0->rom_mapped_writable) { memory_region_del_subregion(as, &VAR_0->rom); memory_region_destroy(&VAR_0->rom); } section = memory_region_find(as, 0, 1); ram = memory_region_get_ram_ptr(section.mr); rom_size = ram[rom_paddr + 2] * ROM_BLOCK_SIZE; VAR_0->rom_size = rom_size; rom_size += rom_paddr & ~TARGET_PAGE_MASK; rom_paddr &= TARGET_PAGE_MASK; rom_size = TARGET_PAGE_ALIGN(rom_size); memory_region_init_alias(&VAR_0->rom, OBJECT(VAR_0), "kvmvapic-rom", section.mr, rom_paddr, rom_size); memory_region_add_subregion_overlap(as, rom_paddr, &VAR_0->rom, 1000); VAR_0->rom_mapped_writable = true; memory_region_unref(section.mr); }
[ "static void FUNC_0(VAPICROMState *VAR_0)\n{", "hwaddr rom_paddr = VAR_0->rom_state_paddr & ROM_BLOCK_MASK;", "MemoryRegionSection section;", "MemoryRegion *as;", "size_t rom_size;", "uint8_t *ram;", "as = sysbus_address_space(&VAR_0->busdev);", "if (VAR_0->rom_mapped_writable) {", "memory_region_del_subregion(as, &VAR_0->rom);", "memory_region_destroy(&VAR_0->rom);", "}", "section = memory_region_find(as, 0, 1);", "ram = memory_region_get_ram_ptr(section.mr);", "rom_size = ram[rom_paddr + 2] * ROM_BLOCK_SIZE;", "VAR_0->rom_size = rom_size;", "rom_size += rom_paddr & ~TARGET_PAGE_MASK;", "rom_paddr &= TARGET_PAGE_MASK;", "rom_size = TARGET_PAGE_ALIGN(rom_size);", "memory_region_init_alias(&VAR_0->rom, OBJECT(VAR_0), \"kvmvapic-rom\", section.mr,\nrom_paddr, rom_size);", "memory_region_add_subregion_overlap(as, rom_paddr, &VAR_0->rom, 1000);", "VAR_0->rom_mapped_writable = true;", "memory_region_unref(section.mr);", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 33 ], [ 39 ], [ 41 ], [ 43 ], [ 51 ], [ 53 ], [ 55 ], [ 59, 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ] ]
10,165
static int handle_intercept(S390CPU *cpu) { CPUState *cs = CPU(cpu); struct kvm_run *run = cs->kvm_run; int icpt_code = run->s390_sieic.icptcode; int r = 0; DPRINTF("intercept: 0x%x (at 0x%lx)\n", icpt_code, (long)cs->kvm_run->psw_addr); switch (icpt_code) { case ICPT_INSTRUCTION: r = handle_instruction(cpu, run); break; case ICPT_WAITPSW: /* disabled wait, since enabled wait is handled in kernel */ if (s390_del_running_cpu(cpu) == 0) { if (is_special_wait_psw(cs)) { qemu_system_shutdown_request(); } else { QObject *data; data = qobject_from_jsonf("{ 'action': %s }", "pause"); monitor_protocol_event(QEVENT_GUEST_PANICKED, data); qobject_decref(data); vm_stop(RUN_STATE_GUEST_PANICKED); } } r = EXCP_HALTED; break; case ICPT_CPU_STOP: if (s390_del_running_cpu(cpu) == 0) { qemu_system_shutdown_request(); } r = EXCP_HALTED; break; case ICPT_SOFT_INTERCEPT: fprintf(stderr, "KVM unimplemented icpt SOFT\n"); exit(1); break; case ICPT_IO: fprintf(stderr, "KVM unimplemented icpt IO\n"); exit(1); break; default: fprintf(stderr, "Unknown intercept code: %d\n", icpt_code); exit(1); break; } return r; }
true
qemu
a2689242b10a7bbc9a952659a2a5cc04a86d10e1
static int handle_intercept(S390CPU *cpu) { CPUState *cs = CPU(cpu); struct kvm_run *run = cs->kvm_run; int icpt_code = run->s390_sieic.icptcode; int r = 0; DPRINTF("intercept: 0x%x (at 0x%lx)\n", icpt_code, (long)cs->kvm_run->psw_addr); switch (icpt_code) { case ICPT_INSTRUCTION: r = handle_instruction(cpu, run); break; case ICPT_WAITPSW: if (s390_del_running_cpu(cpu) == 0) { if (is_special_wait_psw(cs)) { qemu_system_shutdown_request(); } else { QObject *data; data = qobject_from_jsonf("{ 'action': %s }", "pause"); monitor_protocol_event(QEVENT_GUEST_PANICKED, data); qobject_decref(data); vm_stop(RUN_STATE_GUEST_PANICKED); } } r = EXCP_HALTED; break; case ICPT_CPU_STOP: if (s390_del_running_cpu(cpu) == 0) { qemu_system_shutdown_request(); } r = EXCP_HALTED; break; case ICPT_SOFT_INTERCEPT: fprintf(stderr, "KVM unimplemented icpt SOFT\n"); exit(1); break; case ICPT_IO: fprintf(stderr, "KVM unimplemented icpt IO\n"); exit(1); break; default: fprintf(stderr, "Unknown intercept code: %d\n", icpt_code); exit(1); break; } return r; }
{ "code": [ " QObject *data;", " data = qobject_from_jsonf(\"{ 'action': %s }\", \"pause\");", " monitor_protocol_event(QEVENT_GUEST_PANICKED, data);", " qobject_decref(data);", " vm_stop(RUN_STATE_GUEST_PANICKED);" ], "line_no": [ 39, 43, 45, 47, 49 ] }
static int FUNC_0(S390CPU *VAR_0) { CPUState *cs = CPU(VAR_0); struct kvm_run *VAR_1 = cs->kvm_run; int VAR_2 = VAR_1->s390_sieic.icptcode; int VAR_3 = 0; DPRINTF("intercept: 0x%x (at 0x%lx)\n", VAR_2, (long)cs->kvm_run->psw_addr); switch (VAR_2) { case ICPT_INSTRUCTION: VAR_3 = handle_instruction(VAR_0, VAR_1); break; case ICPT_WAITPSW: if (s390_del_running_cpu(VAR_0) == 0) { if (is_special_wait_psw(cs)) { qemu_system_shutdown_request(); } else { QObject *data; data = qobject_from_jsonf("{ 'action': %s }", "pause"); monitor_protocol_event(QEVENT_GUEST_PANICKED, data); qobject_decref(data); vm_stop(RUN_STATE_GUEST_PANICKED); } } VAR_3 = EXCP_HALTED; break; case ICPT_CPU_STOP: if (s390_del_running_cpu(VAR_0) == 0) { qemu_system_shutdown_request(); } VAR_3 = EXCP_HALTED; break; case ICPT_SOFT_INTERCEPT: fprintf(stderr, "KVM unimplemented icpt SOFT\n"); exit(1); break; case ICPT_IO: fprintf(stderr, "KVM unimplemented icpt IO\n"); exit(1); break; default: fprintf(stderr, "Unknown intercept code: %d\n", VAR_2); exit(1); break; } return VAR_3; }
[ "static int FUNC_0(S390CPU *VAR_0)\n{", "CPUState *cs = CPU(VAR_0);", "struct kvm_run *VAR_1 = cs->kvm_run;", "int VAR_2 = VAR_1->s390_sieic.icptcode;", "int VAR_3 = 0;", "DPRINTF(\"intercept: 0x%x (at 0x%lx)\\n\", VAR_2,\n(long)cs->kvm_run->psw_addr);", "switch (VAR_2) {", "case ICPT_INSTRUCTION:\nVAR_3 = handle_instruction(VAR_0, VAR_1);", "break;", "case ICPT_WAITPSW:\nif (s390_del_running_cpu(VAR_0) == 0) {", "if (is_special_wait_psw(cs)) {", "qemu_system_shutdown_request();", "} else {", "QObject *data;", "data = qobject_from_jsonf(\"{ 'action': %s }\", \"pause\");", "monitor_protocol_event(QEVENT_GUEST_PANICKED, data);", "qobject_decref(data);", "vm_stop(RUN_STATE_GUEST_PANICKED);", "}", "}", "VAR_3 = EXCP_HALTED;", "break;", "case ICPT_CPU_STOP:\nif (s390_del_running_cpu(VAR_0) == 0) {", "qemu_system_shutdown_request();", "}", "VAR_3 = EXCP_HALTED;", "break;", "case ICPT_SOFT_INTERCEPT:\nfprintf(stderr, \"KVM unimplemented icpt SOFT\\n\");", "exit(1);", "break;", "case ICPT_IO:\nfprintf(stderr, \"KVM unimplemented icpt IO\\n\");", "exit(1);", "break;", "default:\nfprintf(stderr, \"Unknown intercept code: %d\\n\", VAR_2);", "exit(1);", "break;", "}", "return VAR_3;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15, 17 ], [ 19 ], [ 21, 23 ], [ 25 ], [ 27, 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59, 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71, 73 ], [ 75 ], [ 77 ], [ 79, 81 ], [ 83 ], [ 85 ], [ 87, 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99 ], [ 101 ] ]
10,166
static void dump_op_count(void) { int i; FILE *f; f = fopen("/tmp/op.log", "w"); for(i = INDEX_op_end; i < NB_OPS; i++) { fprintf(f, "%s %" PRId64 "\n", tcg_op_defs[i].name, tcg_table_op_count[i]); } fclose(f); }
true
qemu
d70724cec84ff99ffc7f70dd567466acf228b389
static void dump_op_count(void) { int i; FILE *f; f = fopen("/tmp/op.log", "w"); for(i = INDEX_op_end; i < NB_OPS; i++) { fprintf(f, "%s %" PRId64 "\n", tcg_op_defs[i].name, tcg_table_op_count[i]); } fclose(f); }
{ "code": [ " FILE *f;", " f = fopen(\"/tmp/op.log\", \"w\");", " fprintf(f, \"%s %\" PRId64 \"\\n\", tcg_op_defs[i].name, tcg_table_op_count[i]);", " fclose(f);" ], "line_no": [ 7, 9, 13, 17 ] }
static void FUNC_0(void) { int VAR_0; FILE *f; f = fopen("/tmp/op.log", "w"); for(VAR_0 = INDEX_op_end; VAR_0 < NB_OPS; VAR_0++) { fprintf(f, "%s %" PRId64 "\n", tcg_op_defs[VAR_0].name, tcg_table_op_count[VAR_0]); } fclose(f); }
[ "static void FUNC_0(void)\n{", "int VAR_0;", "FILE *f;", "f = fopen(\"/tmp/op.log\", \"w\");", "for(VAR_0 = INDEX_op_end; VAR_0 < NB_OPS; VAR_0++) {", "fprintf(f, \"%s %\" PRId64 \"\\n\", tcg_op_defs[VAR_0].name, tcg_table_op_count[VAR_0]);", "}", "fclose(f);", "}" ]
[ 0, 0, 1, 1, 0, 1, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ] ]
10,167
static void qed_check_for_leaks(QEDCheck *check) { BDRVQEDState *s = check->s; size_t i; for (i = s->header.header_size; i < check->nclusters; i++) { if (!qed_test_bit(check->used_clusters, i)) { check->result->leaks++; } } }
true
qemu
19dfc44a94f759848a0f7de7378b2f8b9af6b5d0
static void qed_check_for_leaks(QEDCheck *check) { BDRVQEDState *s = check->s; size_t i; for (i = s->header.header_size; i < check->nclusters; i++) { if (!qed_test_bit(check->used_clusters, i)) { check->result->leaks++; } } }
{ "code": [ " size_t i;" ], "line_no": [ 7 ] }
static void FUNC_0(QEDCheck *VAR_0) { BDRVQEDState *s = VAR_0->s; size_t i; for (i = s->header.header_size; i < VAR_0->nclusters; i++) { if (!qed_test_bit(VAR_0->used_clusters, i)) { VAR_0->result->leaks++; } } }
[ "static void FUNC_0(QEDCheck *VAR_0)\n{", "BDRVQEDState *s = VAR_0->s;", "size_t i;", "for (i = s->header.header_size; i < VAR_0->nclusters; i++) {", "if (!qed_test_bit(VAR_0->used_clusters, i)) {", "VAR_0->result->leaks++;", "}", "}", "}" ]
[ 0, 0, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
10,168
static void test_qemu_strtol_full_max(void) { const char *str = g_strdup_printf("%ld", LONG_MAX); long res; int err; err = qemu_strtol(str, NULL, 0, &res); g_assert_cmpint(err, ==, 0); g_assert_cmpint(res, ==, LONG_MAX); }
true
qemu
d6f723b513a0c3c4e58343b7c52a2f9850861fa0
static void test_qemu_strtol_full_max(void) { const char *str = g_strdup_printf("%ld", LONG_MAX); long res; int err; err = qemu_strtol(str, NULL, 0, &res); g_assert_cmpint(err, ==, 0); g_assert_cmpint(res, ==, LONG_MAX); }
{ "code": [ " const char *str = g_strdup_printf(\"%ld\", LONG_MAX);", " const char *str = g_strdup_printf(\"%ld\", LONG_MAX);" ], "line_no": [ 5, 5 ] }
static void FUNC_0(void) { const char *VAR_0 = g_strdup_printf("%ld", LONG_MAX); long VAR_1; int VAR_2; VAR_2 = qemu_strtol(VAR_0, NULL, 0, &VAR_1); g_assert_cmpint(VAR_2, ==, 0); g_assert_cmpint(VAR_1, ==, LONG_MAX); }
[ "static void FUNC_0(void)\n{", "const char *VAR_0 = g_strdup_printf(\"%ld\", LONG_MAX);", "long VAR_1;", "int VAR_2;", "VAR_2 = qemu_strtol(VAR_0, NULL, 0, &VAR_1);", "g_assert_cmpint(VAR_2, ==, 0);", "g_assert_cmpint(VAR_1, ==, LONG_MAX);", "}" ]
[ 0, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ] ]
10,169
char *spapr_get_cpu_core_type(const char *model) { char *core_type; gchar **model_pieces = g_strsplit(model, ",", 2); core_type = g_strdup_printf("%s-%s", model_pieces[0], TYPE_SPAPR_CPU_CORE); g_strfreev(model_pieces); /* Check whether it exists or whether we have to look up an alias name */ if (!object_class_by_name(core_type)) { const char *realmodel; g_free(core_type); realmodel = ppc_cpu_lookup_alias(model); if (realmodel) { return spapr_get_cpu_core_type(realmodel); } return NULL; } return core_type; }
true
qemu
e17a87792d4886d2a508672c1639df3c1d40f1d1
char *spapr_get_cpu_core_type(const char *model) { char *core_type; gchar **model_pieces = g_strsplit(model, ",", 2); core_type = g_strdup_printf("%s-%s", model_pieces[0], TYPE_SPAPR_CPU_CORE); g_strfreev(model_pieces); if (!object_class_by_name(core_type)) { const char *realmodel; g_free(core_type); realmodel = ppc_cpu_lookup_alias(model); if (realmodel) { return spapr_get_cpu_core_type(realmodel); } return NULL; } return core_type; }
{ "code": [ " g_strfreev(model_pieces);", " realmodel = ppc_cpu_lookup_alias(model);", " return spapr_get_cpu_core_type(realmodel);", " return NULL;" ], "line_no": [ 13, 27, 31, 35 ] }
char *FUNC_0(const char *VAR_0) { char *VAR_1; gchar **model_pieces = g_strsplit(VAR_0, ",", 2); VAR_1 = g_strdup_printf("%s-%s", model_pieces[0], TYPE_SPAPR_CPU_CORE); g_strfreev(model_pieces); if (!object_class_by_name(VAR_1)) { const char *VAR_2; g_free(VAR_1); VAR_2 = ppc_cpu_lookup_alias(VAR_0); if (VAR_2) { return FUNC_0(VAR_2); } return NULL; } return VAR_1; }
[ "char *FUNC_0(const char *VAR_0)\n{", "char *VAR_1;", "gchar **model_pieces = g_strsplit(VAR_0, \",\", 2);", "VAR_1 = g_strdup_printf(\"%s-%s\", model_pieces[0], TYPE_SPAPR_CPU_CORE);", "g_strfreev(model_pieces);", "if (!object_class_by_name(VAR_1)) {", "const char *VAR_2;", "g_free(VAR_1);", "VAR_2 = ppc_cpu_lookup_alias(VAR_0);", "if (VAR_2) {", "return FUNC_0(VAR_2);", "}", "return NULL;", "}", "return VAR_1;", "}" ]
[ 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ] ]
10,170
static int get_refcount(BlockDriverState *bs, int64_t cluster_index) { BDRVQcowState *s = bs->opaque; int refcount_table_index, block_index; int64_t refcount_block_offset; int ret; uint16_t *refcount_block; uint16_t refcount; refcount_table_index = cluster_index >> (s->cluster_bits - REFCOUNT_SHIFT); if (refcount_table_index >= s->refcount_table_size) return 0; refcount_block_offset = s->refcount_table[refcount_table_index] & REFT_OFFSET_MASK; if (!refcount_block_offset) return 0; ret = qcow2_cache_get(bs, s->refcount_block_cache, refcount_block_offset, (void**) &refcount_block); if (ret < 0) { return ret; } block_index = cluster_index & ((1 << (s->cluster_bits - REFCOUNT_SHIFT)) - 1); refcount = be16_to_cpu(refcount_block[block_index]); ret = qcow2_cache_put(bs, s->refcount_block_cache, (void**) &refcount_block); if (ret < 0) { return ret; } return refcount; }
true
qemu
db8a31d11d6a60f48d6817530640d75aa72a9a2f
static int get_refcount(BlockDriverState *bs, int64_t cluster_index) { BDRVQcowState *s = bs->opaque; int refcount_table_index, block_index; int64_t refcount_block_offset; int ret; uint16_t *refcount_block; uint16_t refcount; refcount_table_index = cluster_index >> (s->cluster_bits - REFCOUNT_SHIFT); if (refcount_table_index >= s->refcount_table_size) return 0; refcount_block_offset = s->refcount_table[refcount_table_index] & REFT_OFFSET_MASK; if (!refcount_block_offset) return 0; ret = qcow2_cache_get(bs, s->refcount_block_cache, refcount_block_offset, (void**) &refcount_block); if (ret < 0) { return ret; } block_index = cluster_index & ((1 << (s->cluster_bits - REFCOUNT_SHIFT)) - 1); refcount = be16_to_cpu(refcount_block[block_index]); ret = qcow2_cache_put(bs, s->refcount_block_cache, (void**) &refcount_block); if (ret < 0) { return ret; } return refcount; }
{ "code": [ " int refcount_table_index, block_index;" ], "line_no": [ 7 ] }
static int FUNC_0(BlockDriverState *VAR_0, int64_t VAR_1) { BDRVQcowState *s = VAR_0->opaque; int VAR_2, VAR_3; int64_t refcount_block_offset; int VAR_4; uint16_t *refcount_block; uint16_t refcount; VAR_2 = VAR_1 >> (s->cluster_bits - REFCOUNT_SHIFT); if (VAR_2 >= s->refcount_table_size) return 0; refcount_block_offset = s->refcount_table[VAR_2] & REFT_OFFSET_MASK; if (!refcount_block_offset) return 0; VAR_4 = qcow2_cache_get(VAR_0, s->refcount_block_cache, refcount_block_offset, (void**) &refcount_block); if (VAR_4 < 0) { return VAR_4; } VAR_3 = VAR_1 & ((1 << (s->cluster_bits - REFCOUNT_SHIFT)) - 1); refcount = be16_to_cpu(refcount_block[VAR_3]); VAR_4 = qcow2_cache_put(VAR_0, s->refcount_block_cache, (void**) &refcount_block); if (VAR_4 < 0) { return VAR_4; } return refcount; }
[ "static int FUNC_0(BlockDriverState *VAR_0, int64_t VAR_1)\n{", "BDRVQcowState *s = VAR_0->opaque;", "int VAR_2, VAR_3;", "int64_t refcount_block_offset;", "int VAR_4;", "uint16_t *refcount_block;", "uint16_t refcount;", "VAR_2 = VAR_1 >> (s->cluster_bits - REFCOUNT_SHIFT);", "if (VAR_2 >= s->refcount_table_size)\nreturn 0;", "refcount_block_offset =\ns->refcount_table[VAR_2] & REFT_OFFSET_MASK;", "if (!refcount_block_offset)\nreturn 0;", "VAR_4 = qcow2_cache_get(VAR_0, s->refcount_block_cache, refcount_block_offset,\n(void**) &refcount_block);", "if (VAR_4 < 0) {", "return VAR_4;", "}", "VAR_3 = VAR_1 &\n((1 << (s->cluster_bits - REFCOUNT_SHIFT)) - 1);", "refcount = be16_to_cpu(refcount_block[VAR_3]);", "VAR_4 = qcow2_cache_put(VAR_0, s->refcount_block_cache,\n(void**) &refcount_block);", "if (VAR_4 < 0) {", "return VAR_4;", "}", "return refcount;", "}" ]
[ 0, 0, 1, 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 ], [ 35, 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47, 49 ], [ 51 ], [ 55, 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ] ]
10,171
static void openpic_irq_raise(OpenPICState *opp, int n_CPU, IRQ_src_t *src) { int n_ci = IDR_CI0_SHIFT - n_CPU; if ((opp->flags & OPENPIC_FLAG_IDE_CRIT) && (src->ide & (1 << n_ci))) { qemu_irq_raise(opp->dst[n_CPU].irqs[OPENPIC_OUTPUT_CINT]); } else { qemu_irq_raise(opp->dst[n_CPU].irqs[OPENPIC_OUTPUT_INT]); } }
true
qemu
af7e9e74c6a62a5bcd911726a9e88d28b61490e0
static void openpic_irq_raise(OpenPICState *opp, int n_CPU, IRQ_src_t *src) { int n_ci = IDR_CI0_SHIFT - n_CPU; if ((opp->flags & OPENPIC_FLAG_IDE_CRIT) && (src->ide & (1 << n_ci))) { qemu_irq_raise(opp->dst[n_CPU].irqs[OPENPIC_OUTPUT_CINT]); } else { qemu_irq_raise(opp->dst[n_CPU].irqs[OPENPIC_OUTPUT_INT]); } }
{ "code": [ "static void openpic_irq_raise(OpenPICState *opp, int n_CPU, IRQ_src_t *src)" ], "line_no": [ 1 ] }
static void FUNC_0(OpenPICState *VAR_0, int VAR_1, IRQ_src_t *VAR_2) { int VAR_3 = IDR_CI0_SHIFT - VAR_1; if ((VAR_0->flags & OPENPIC_FLAG_IDE_CRIT) && (VAR_2->ide & (1 << VAR_3))) { qemu_irq_raise(VAR_0->dst[VAR_1].irqs[OPENPIC_OUTPUT_CINT]); } else { qemu_irq_raise(VAR_0->dst[VAR_1].irqs[OPENPIC_OUTPUT_INT]); } }
[ "static void FUNC_0(OpenPICState *VAR_0, int VAR_1, IRQ_src_t *VAR_2)\n{", "int VAR_3 = IDR_CI0_SHIFT - VAR_1;", "if ((VAR_0->flags & OPENPIC_FLAG_IDE_CRIT) && (VAR_2->ide & (1 << VAR_3))) {", "qemu_irq_raise(VAR_0->dst[VAR_1].irqs[OPENPIC_OUTPUT_CINT]);", "} else {", "qemu_irq_raise(VAR_0->dst[VAR_1].irqs[OPENPIC_OUTPUT_INT]);", "}", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ] ]
10,172
static int dx2_decode_slice_420(GetBitContext *gb, AVFrame *frame, int line, int left, uint8_t lru[3][8]) { int x, y; int width = frame->width; int ystride = frame->linesize[0]; int ustride = frame->linesize[1]; int vstride = frame->linesize[2]; uint8_t *Y = frame->data[0] + ystride * line; uint8_t *U = frame->data[1] + (ustride >> 1) * line; uint8_t *V = frame->data[2] + (vstride >> 1) * line; for (y = 0; y < left - 1 && get_bits_left(gb) > 16; y += 2) { for (x = 0; x < width; x += 2) { Y[x + 0 + 0 * ystride] = decode_sym(gb, lru[0]); Y[x + 1 + 0 * ystride] = decode_sym(gb, lru[0]); Y[x + 0 + 1 * ystride] = decode_sym(gb, lru[0]); Y[x + 1 + 1 * ystride] = decode_sym(gb, lru[0]); U[x >> 1] = decode_sym(gb, lru[1]) ^ 0x80; V[x >> 1] = decode_sym(gb, lru[2]) ^ 0x80; } Y += ystride << 1; U += ustride; V += vstride; } return y; }
true
FFmpeg
6e1a167c5564085385488b4f579e9efb987d4bfa
static int dx2_decode_slice_420(GetBitContext *gb, AVFrame *frame, int line, int left, uint8_t lru[3][8]) { int x, y; int width = frame->width; int ystride = frame->linesize[0]; int ustride = frame->linesize[1]; int vstride = frame->linesize[2]; uint8_t *Y = frame->data[0] + ystride * line; uint8_t *U = frame->data[1] + (ustride >> 1) * line; uint8_t *V = frame->data[2] + (vstride >> 1) * line; for (y = 0; y < left - 1 && get_bits_left(gb) > 16; y += 2) { for (x = 0; x < width; x += 2) { Y[x + 0 + 0 * ystride] = decode_sym(gb, lru[0]); Y[x + 1 + 0 * ystride] = decode_sym(gb, lru[0]); Y[x + 0 + 1 * ystride] = decode_sym(gb, lru[0]); Y[x + 1 + 1 * ystride] = decode_sym(gb, lru[0]); U[x >> 1] = decode_sym(gb, lru[1]) ^ 0x80; V[x >> 1] = decode_sym(gb, lru[2]) ^ 0x80; } Y += ystride << 1; U += ustride; V += vstride; } return y; }
{ "code": [ " for (y = 0; y < left - 1 && get_bits_left(gb) > 16; y += 2) {" ], "line_no": [ 35 ] }
static int FUNC_0(GetBitContext *VAR_0, AVFrame *VAR_1, int VAR_2, int VAR_3, uint8_t VAR_4[3][8]) { int VAR_5, VAR_6; int VAR_7 = VAR_1->VAR_7; int VAR_8 = VAR_1->linesize[0]; int VAR_9 = VAR_1->linesize[1]; int VAR_10 = VAR_1->linesize[2]; uint8_t *Y = VAR_1->data[0] + VAR_8 * VAR_2; uint8_t *U = VAR_1->data[1] + (VAR_9 >> 1) * VAR_2; uint8_t *V = VAR_1->data[2] + (VAR_10 >> 1) * VAR_2; for (VAR_6 = 0; VAR_6 < VAR_3 - 1 && get_bits_left(VAR_0) > 16; VAR_6 += 2) { for (VAR_5 = 0; VAR_5 < VAR_7; VAR_5 += 2) { Y[VAR_5 + 0 + 0 * VAR_8] = decode_sym(VAR_0, VAR_4[0]); Y[VAR_5 + 1 + 0 * VAR_8] = decode_sym(VAR_0, VAR_4[0]); Y[VAR_5 + 0 + 1 * VAR_8] = decode_sym(VAR_0, VAR_4[0]); Y[VAR_5 + 1 + 1 * VAR_8] = decode_sym(VAR_0, VAR_4[0]); U[VAR_5 >> 1] = decode_sym(VAR_0, VAR_4[1]) ^ 0x80; V[VAR_5 >> 1] = decode_sym(VAR_0, VAR_4[2]) ^ 0x80; } Y += VAR_8 << 1; U += VAR_9; V += VAR_10; } return VAR_6; }
[ "static int FUNC_0(GetBitContext *VAR_0, AVFrame *VAR_1,\nint VAR_2, int VAR_3,\nuint8_t VAR_4[3][8])\n{", "int VAR_5, VAR_6;", "int VAR_7 = VAR_1->VAR_7;", "int VAR_8 = VAR_1->linesize[0];", "int VAR_9 = VAR_1->linesize[1];", "int VAR_10 = VAR_1->linesize[2];", "uint8_t *Y = VAR_1->data[0] + VAR_8 * VAR_2;", "uint8_t *U = VAR_1->data[1] + (VAR_9 >> 1) * VAR_2;", "uint8_t *V = VAR_1->data[2] + (VAR_10 >> 1) * VAR_2;", "for (VAR_6 = 0; VAR_6 < VAR_3 - 1 && get_bits_left(VAR_0) > 16; VAR_6 += 2) {", "for (VAR_5 = 0; VAR_5 < VAR_7; VAR_5 += 2) {", "Y[VAR_5 + 0 + 0 * VAR_8] = decode_sym(VAR_0, VAR_4[0]);", "Y[VAR_5 + 1 + 0 * VAR_8] = decode_sym(VAR_0, VAR_4[0]);", "Y[VAR_5 + 0 + 1 * VAR_8] = decode_sym(VAR_0, VAR_4[0]);", "Y[VAR_5 + 1 + 1 * VAR_8] = decode_sym(VAR_0, VAR_4[0]);", "U[VAR_5 >> 1] = decode_sym(VAR_0, VAR_4[1]) ^ 0x80;", "V[VAR_5 >> 1] = decode_sym(VAR_0, VAR_4[2]) ^ 0x80;", "}", "Y += VAR_8 << 1;", "U += VAR_9;", "V += VAR_10;", "}", "return VAR_6;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ] ]
10,173
static inline void RENAME(bgr16ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, uint8_t *src2, int width) { int i; assert(src1==src2); for(i=0; i<width; i++) { int d0= ((uint32_t*)src1)[i]; int dl= (d0&0x07E0F81F); int dh= ((d0>>5)&0x07C0F83F); int dh2= (dh>>11) + (dh<<21); int d= dh2 + dl; int b= d&0x7F; int r= (d>>11)&0x7F; int g= d>>21; dstU[i]= ((2*RU*r + GU*g + 2*BU*b)>>(RGB2YUV_SHIFT+1-2)) + 128; dstV[i]= ((2*RV*r + GV*g + 2*BV*b)>>(RGB2YUV_SHIFT+1-2)) + 128; } }
true
FFmpeg
2da0d70d5eebe42f9fcd27ee554419ebe2a5da06
static inline void RENAME(bgr16ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, uint8_t *src2, int width) { int i; assert(src1==src2); for(i=0; i<width; i++) { int d0= ((uint32_t*)src1)[i]; int dl= (d0&0x07E0F81F); int dh= ((d0>>5)&0x07C0F83F); int dh2= (dh>>11) + (dh<<21); int d= dh2 + dl; int b= d&0x7F; int r= (d>>11)&0x7F; int g= d>>21; dstU[i]= ((2*RU*r + GU*g + 2*BU*b)>>(RGB2YUV_SHIFT+1-2)) + 128; dstV[i]= ((2*RV*r + GV*g + 2*BV*b)>>(RGB2YUV_SHIFT+1-2)) + 128; } }
{ "code": [ "\tint i;", "\tint i;", "\tint i;", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", " assert(src1==src2);", "\tfor(i=0; i<width; i++)", "\t\tint d0= ((uint32_t*)src1)[i];", "\t\tint dl= (d0&0x07E0F81F);", "\t\tint dh= ((d0>>5)&0x07C0F83F);", "\t\tint dh2= (dh>>11) + (dh<<21);", "\t\tint d= dh2 + dl;", "\t\tint b= d&0x7F;", "\t\tint r= (d>>11)&0x7F;", "\t\tint g= d>>21;", "\t\tdstU[i]= ((2*RU*r + GU*g + 2*BU*b)>>(RGB2YUV_SHIFT+1-2)) + 128;", "\t\tdstV[i]= ((2*RV*r + GV*g + 2*BV*b)>>(RGB2YUV_SHIFT+1-2)) + 128;", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", " assert(src1==src2);", "\tfor(i=0; i<width; i++)", "\t\tint d0= ((uint32_t*)src1)[i];", "\t\tint dh2= (dh>>11) + (dh<<21);", "\t\tint d= dh2 + dl;", "\t\tint b= d&0x7F;", "\t\tint g= d>>21;", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", " assert(src1==src2);", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", " assert(src1==src2);", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\t\tint d0= ((uint32_t*)src1)[i];", "\t\tint dl= (d0&0x07E0F81F);", "\t\tint dh= ((d0>>5)&0x07C0F83F);", "\t\tint dh2= (dh>>11) + (dh<<21);", "\t\tint d= dh2 + dl;", "\t\tint g= d>>21;", "\t\tdstU[i]= ((2*RU*r + GU*g + 2*BU*b)>>(RGB2YUV_SHIFT+1-2)) + 128;", "\t\tdstV[i]= ((2*RV*r + GV*g + 2*BV*b)>>(RGB2YUV_SHIFT+1-2)) + 128;", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\t\tint d0= ((uint32_t*)src1)[i];", "\t\tint dh2= (dh>>11) + (dh<<21);", "\t\tint d= dh2 + dl;", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tint i;", "\tint i;", "\tint i;", "\tint i;" ], "line_no": [ 5, 5, 5, 5, 9, 5, 9, 5, 9, 5, 9, 5, 9, 5, 9, 5, 9, 5, 9, 5, 9, 5, 7, 9, 13, 17, 19, 23, 25, 29, 31, 33, 35, 37, 5, 9, 5, 7, 9, 13, 23, 25, 29, 33, 5, 9, 5, 7, 9, 5, 9, 5, 7, 9, 5, 9, 5, 9, 13, 17, 19, 23, 25, 33, 35, 37, 5, 9, 5, 9, 13, 23, 25, 5, 9, 5, 9, 5, 5, 5, 5, 5 ] }
static inline void FUNC_0(bgr16ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, uint8_t *src2, int width) { int VAR_0; assert(src1==src2); for(VAR_0=0; VAR_0<width; VAR_0++) { int d0= ((uint32_t*)src1)[VAR_0]; int dl= (d0&0x07E0F81F); int dh= ((d0>>5)&0x07C0F83F); int dh2= (dh>>11) + (dh<<21); int d= dh2 + dl; int b= d&0x7F; int r= (d>>11)&0x7F; int g= d>>21; dstU[VAR_0]= ((2*RU*r + GU*g + 2*BU*b)>>(RGB2YUV_SHIFT+1-2)) + 128; dstV[VAR_0]= ((2*RV*r + GV*g + 2*BV*b)>>(RGB2YUV_SHIFT+1-2)) + 128; } }
[ "static inline void FUNC_0(bgr16ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, uint8_t *src2, int width)\n{", "int VAR_0;", "assert(src1==src2);", "for(VAR_0=0; VAR_0<width; VAR_0++)", "{", "int d0= ((uint32_t*)src1)[VAR_0];", "int dl= (d0&0x07E0F81F);", "int dh= ((d0>>5)&0x07C0F83F);", "int dh2= (dh>>11) + (dh<<21);", "int d= dh2 + dl;", "int b= d&0x7F;", "int r= (d>>11)&0x7F;", "int g= d>>21;", "dstU[VAR_0]= ((2*RU*r + GU*g + 2*BU*b)>>(RGB2YUV_SHIFT+1-2)) + 128;", "dstV[VAR_0]= ((2*RV*r + GV*g + 2*BV*b)>>(RGB2YUV_SHIFT+1-2)) + 128;", "}", "}" ]
[ 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ] ]
10,174
static int file_close_dir(URLContext *h) { #if HAVE_DIRENT_H FileContext *c = h->priv_data; closedir(c->dir); return 0; #else return AVERROR(ENOSYS); #endif /* HAVE_DIRENT_H */ }
false
FFmpeg
d65b9114f35c1afe2a7061f0a1ec957d33ba02b5
static int file_close_dir(URLContext *h) { #if HAVE_DIRENT_H FileContext *c = h->priv_data; closedir(c->dir); return 0; #else return AVERROR(ENOSYS); #endif }
{ "code": [], "line_no": [] }
static int FUNC_0(URLContext *VAR_0) { #if HAVE_DIRENT_H FileContext *c = VAR_0->priv_data; closedir(c->dir); return 0; #else return AVERROR(ENOSYS); #endif }
[ "static int FUNC_0(URLContext *VAR_0)\n{", "#if HAVE_DIRENT_H\nFileContext *c = VAR_0->priv_data;", "closedir(c->dir);", "return 0;", "#else\nreturn AVERROR(ENOSYS);", "#endif\n}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9 ], [ 11 ], [ 13, 15 ], [ 17, 19 ] ]
10,176
static int sdp_read_header(AVFormatContext *s, AVFormatParameters *ap) { RTSPState *rt = s->priv_data; RTSPStream *rtsp_st; int size, i, err; char *content; char url[1024]; /* read the whole sdp file */ /* XXX: better loading */ content = av_malloc(SDP_MAX_SIZE); size = get_buffer(s->pb, content, SDP_MAX_SIZE - 1); if (size <= 0) { av_free(content); return AVERROR_INVALIDDATA; } content[size] ='\0'; sdp_parse(s, content); av_free(content); /* open each RTP stream */ for(i=0;i<rt->nb_rtsp_streams;i++) { rtsp_st = rt->rtsp_streams[i]; snprintf(url, sizeof(url), "rtp://%s:%d?localport=%d&ttl=%d", inet_ntoa(rtsp_st->sdp_ip), rtsp_st->sdp_port, rtsp_st->sdp_port, rtsp_st->sdp_ttl); if (url_open(&rtsp_st->rtp_handle, url, URL_RDWR) < 0) { err = AVERROR_INVALIDDATA; goto fail; } if ((err = rtsp_open_transport_ctx(s, rtsp_st))) goto fail; } return 0; fail: rtsp_close_streams(rt); return err; }
false
FFmpeg
c89658008705d949c319df3fa6f400c481ad73e1
static int sdp_read_header(AVFormatContext *s, AVFormatParameters *ap) { RTSPState *rt = s->priv_data; RTSPStream *rtsp_st; int size, i, err; char *content; char url[1024]; content = av_malloc(SDP_MAX_SIZE); size = get_buffer(s->pb, content, SDP_MAX_SIZE - 1); if (size <= 0) { av_free(content); return AVERROR_INVALIDDATA; } content[size] ='\0'; sdp_parse(s, content); av_free(content); for(i=0;i<rt->nb_rtsp_streams;i++) { rtsp_st = rt->rtsp_streams[i]; snprintf(url, sizeof(url), "rtp: inet_ntoa(rtsp_st->sdp_ip), rtsp_st->sdp_port, rtsp_st->sdp_port, rtsp_st->sdp_ttl); if (url_open(&rtsp_st->rtp_handle, url, URL_RDWR) < 0) { err = AVERROR_INVALIDDATA; goto fail; } if ((err = rtsp_open_transport_ctx(s, rtsp_st))) goto fail; } return 0; fail: rtsp_close_streams(rt); return err; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0, AVFormatParameters *VAR_1) { RTSPState *rt = VAR_0->priv_data; RTSPStream *rtsp_st; int VAR_2, VAR_3, VAR_4; char *VAR_5; char VAR_6[1024]; VAR_5 = av_malloc(SDP_MAX_SIZE); VAR_2 = get_buffer(VAR_0->pb, VAR_5, SDP_MAX_SIZE - 1); if (VAR_2 <= 0) { av_free(VAR_5); return AVERROR_INVALIDDATA; } VAR_5[VAR_2] ='\0'; sdp_parse(VAR_0, VAR_5); av_free(VAR_5); for(VAR_3=0;VAR_3<rt->nb_rtsp_streams;VAR_3++) { rtsp_st = rt->rtsp_streams[VAR_3]; snprintf(VAR_6, sizeof(VAR_6), "rtp: inet_ntoa(rtsp_st->sdp_ip), rtsp_st->sdp_port, rtsp_st->sdp_port, rtsp_st->sdp_ttl); if (url_open(&rtsp_st->rtp_handle, VAR_6, URL_RDWR) < 0) { VAR_4 = AVERROR_INVALIDDATA; goto fail; } if ((VAR_4 = rtsp_open_transport_ctx(VAR_0, rtsp_st))) goto fail; } return 0; fail: rtsp_close_streams(rt); return VAR_4; }
[ "static int FUNC_0(AVFormatContext *VAR_0,\nAVFormatParameters *VAR_1)\n{", "RTSPState *rt = VAR_0->priv_data;", "RTSPStream *rtsp_st;", "int VAR_2, VAR_3, VAR_4;", "char *VAR_5;", "char VAR_6[1024];", "VAR_5 = av_malloc(SDP_MAX_SIZE);", "VAR_2 = get_buffer(VAR_0->pb, VAR_5, SDP_MAX_SIZE - 1);", "if (VAR_2 <= 0) {", "av_free(VAR_5);", "return AVERROR_INVALIDDATA;", "}", "VAR_5[VAR_2] ='\\0';", "sdp_parse(VAR_0, VAR_5);", "av_free(VAR_5);", "for(VAR_3=0;VAR_3<rt->nb_rtsp_streams;VAR_3++) {", "rtsp_st = rt->rtsp_streams[VAR_3];", "snprintf(VAR_6, sizeof(VAR_6), \"rtp:\ninet_ntoa(rtsp_st->sdp_ip),\nrtsp_st->sdp_port,\nrtsp_st->sdp_port,\nrtsp_st->sdp_ttl);", "if (url_open(&rtsp_st->rtp_handle, VAR_6, URL_RDWR) < 0) {", "VAR_4 = AVERROR_INVALIDDATA;", "goto fail;", "}", "if ((VAR_4 = rtsp_open_transport_ctx(VAR_0, rtsp_st)))\ngoto fail;", "}", "return 0;", "fail:\nrtsp_close_streams(rt);", "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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 47 ], [ 49 ], [ 53, 55, 57, 59, 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71, 73 ], [ 75 ], [ 77 ], [ 79, 81 ], [ 83 ], [ 85 ] ]
10,177
static void ff_h264_idct_add16intra_mmx2(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){ int i; for(i=0; i<16; i++){ if(nnzc[ scan8[i] ]) ff_h264_idct_add_mmx (dst + block_offset[i], block + i*16, stride); else if(block[i*16]) ff_h264_idct_dc_add_mmx2(dst + block_offset[i], block + i*16, stride); } }
false
FFmpeg
1d16a1cf99488f16492b1bb48e023f4da8377e07
static void ff_h264_idct_add16intra_mmx2(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){ int i; for(i=0; i<16; i++){ if(nnzc[ scan8[i] ]) ff_h264_idct_add_mmx (dst + block_offset[i], block + i*16, stride); else if(block[i*16]) ff_h264_idct_dc_add_mmx2(dst + block_offset[i], block + i*16, stride); } }
{ "code": [], "line_no": [] }
static void FUNC_0(uint8_t *VAR_0, const int *VAR_1, DCTELEM *VAR_2, int VAR_3, const uint8_t VAR_4[6*8]){ int VAR_5; for(VAR_5=0; VAR_5<16; VAR_5++){ if(VAR_4[ scan8[VAR_5] ]) ff_h264_idct_add_mmx (VAR_0 + VAR_1[VAR_5], VAR_2 + VAR_5*16, VAR_3); else if(VAR_2[VAR_5*16]) ff_h264_idct_dc_add_mmx2(VAR_0 + VAR_1[VAR_5], VAR_2 + VAR_5*16, VAR_3); } }
[ "static void FUNC_0(uint8_t *VAR_0, const int *VAR_1, DCTELEM *VAR_2, int VAR_3, const uint8_t VAR_4[6*8]){", "int VAR_5;", "for(VAR_5=0; VAR_5<16; VAR_5++){", "if(VAR_4[ scan8[VAR_5] ]) ff_h264_idct_add_mmx (VAR_0 + VAR_1[VAR_5], VAR_2 + VAR_5*16, VAR_3);", "else if(VAR_2[VAR_5*16]) ff_h264_idct_dc_add_mmx2(VAR_0 + VAR_1[VAR_5], VAR_2 + VAR_5*16, VAR_3);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ] ]
10,178
static void floor_encode(vorbis_enc_context *venc, vorbis_enc_floor *fc, PutBitContext *pb, uint16_t *posts, float *floor, int samples) { int range = 255 / fc->multiplier + 1; int coded[MAX_FLOOR_VALUES]; // first 2 values are unused int i, counter; put_bits(pb, 1, 1); // non zero put_bits(pb, ilog(range - 1), posts[0]); put_bits(pb, ilog(range - 1), posts[1]); coded[0] = coded[1] = 1; for (i = 2; i < fc->values; i++) { int predicted = render_point(fc->list[fc->list[i].low].x, posts[fc->list[i].low], fc->list[fc->list[i].high].x, posts[fc->list[i].high], fc->list[i].x); int highroom = range - predicted; int lowroom = predicted; int room = FFMIN(highroom, lowroom); if (predicted == posts[i]) { coded[i] = 0; // must be used later as flag! continue; } else { if (!coded[fc->list[i].low ]) coded[fc->list[i].low ] = -1; if (!coded[fc->list[i].high]) coded[fc->list[i].high] = -1; } if (posts[i] > predicted) { if (posts[i] - predicted > room) coded[i] = posts[i] - predicted + lowroom; else coded[i] = (posts[i] - predicted) << 1; } else { if (predicted - posts[i] > room) coded[i] = predicted - posts[i] + highroom - 1; else coded[i] = ((predicted - posts[i]) << 1) - 1; } } counter = 2; for (i = 0; i < fc->partitions; i++) { vorbis_enc_floor_class * c = &fc->classes[fc->partition_to_class[i]]; int k, cval = 0, csub = 1<<c->subclass; if (c->subclass) { vorbis_enc_codebook * book = &venc->codebooks[c->masterbook]; int cshift = 0; for (k = 0; k < c->dim; k++) { int l; for (l = 0; l < csub; l++) { int maxval = 1; if (c->books[l] != -1) maxval = venc->codebooks[c->books[l]].nentries; // coded could be -1, but this still works, cause that is 0 if (coded[counter + k] < maxval) break; } assert(l != csub); cval |= l << cshift; cshift += c->subclass; } put_codeword(pb, book, cval); } for (k = 0; k < c->dim; k++) { int book = c->books[cval & (csub-1)]; int entry = coded[counter++]; cval >>= c->subclass; if (book == -1) continue; if (entry == -1) entry = 0; put_codeword(pb, &venc->codebooks[book], entry); } } ff_vorbis_floor1_render_list(fc->list, fc->values, posts, coded, fc->multiplier, floor, samples); }
true
FFmpeg
1ba08c94f5bb4d1c3c2d3651b5e01edb4ce172e2
static void floor_encode(vorbis_enc_context *venc, vorbis_enc_floor *fc, PutBitContext *pb, uint16_t *posts, float *floor, int samples) { int range = 255 / fc->multiplier + 1; int coded[MAX_FLOOR_VALUES]; int i, counter; put_bits(pb, 1, 1); put_bits(pb, ilog(range - 1), posts[0]); put_bits(pb, ilog(range - 1), posts[1]); coded[0] = coded[1] = 1; for (i = 2; i < fc->values; i++) { int predicted = render_point(fc->list[fc->list[i].low].x, posts[fc->list[i].low], fc->list[fc->list[i].high].x, posts[fc->list[i].high], fc->list[i].x); int highroom = range - predicted; int lowroom = predicted; int room = FFMIN(highroom, lowroom); if (predicted == posts[i]) { coded[i] = 0; continue; } else { if (!coded[fc->list[i].low ]) coded[fc->list[i].low ] = -1; if (!coded[fc->list[i].high]) coded[fc->list[i].high] = -1; } if (posts[i] > predicted) { if (posts[i] - predicted > room) coded[i] = posts[i] - predicted + lowroom; else coded[i] = (posts[i] - predicted) << 1; } else { if (predicted - posts[i] > room) coded[i] = predicted - posts[i] + highroom - 1; else coded[i] = ((predicted - posts[i]) << 1) - 1; } } counter = 2; for (i = 0; i < fc->partitions; i++) { vorbis_enc_floor_class * c = &fc->classes[fc->partition_to_class[i]]; int k, cval = 0, csub = 1<<c->subclass; if (c->subclass) { vorbis_enc_codebook * book = &venc->codebooks[c->masterbook]; int cshift = 0; for (k = 0; k < c->dim; k++) { int l; for (l = 0; l < csub; l++) { int maxval = 1; if (c->books[l] != -1) maxval = venc->codebooks[c->books[l]].nentries; if (coded[counter + k] < maxval) break; } assert(l != csub); cval |= l << cshift; cshift += c->subclass; } put_codeword(pb, book, cval); } for (k = 0; k < c->dim; k++) { int book = c->books[cval & (csub-1)]; int entry = coded[counter++]; cval >>= c->subclass; if (book == -1) continue; if (entry == -1) entry = 0; put_codeword(pb, &venc->codebooks[book], entry); } } ff_vorbis_floor1_render_list(fc->list, fc->values, posts, coded, fc->multiplier, floor, samples); }
{ "code": [ "static void floor_encode(vorbis_enc_context *venc, vorbis_enc_floor *fc,", " PutBitContext *pb, uint16_t *posts,", " float *floor, int samples)", " put_codeword(pb, book, cval);", " put_codeword(pb, &venc->codebooks[book], entry);" ], "line_no": [ 1, 3, 5, 131, 151 ] }
static void FUNC_0(vorbis_enc_context *VAR_0, vorbis_enc_floor *VAR_1, PutBitContext *VAR_2, uint16_t *VAR_3, float *VAR_4, int VAR_5) { int VAR_6 = 255 / VAR_1->multiplier + 1; int VAR_7[MAX_FLOOR_VALUES]; int VAR_8, VAR_9; put_bits(VAR_2, 1, 1); put_bits(VAR_2, ilog(VAR_6 - 1), VAR_3[0]); put_bits(VAR_2, ilog(VAR_6 - 1), VAR_3[1]); VAR_7[0] = VAR_7[1] = 1; for (VAR_8 = 2; VAR_8 < VAR_1->values; VAR_8++) { int predicted = render_point(VAR_1->list[VAR_1->list[VAR_8].low].x, VAR_3[VAR_1->list[VAR_8].low], VAR_1->list[VAR_1->list[VAR_8].high].x, VAR_3[VAR_1->list[VAR_8].high], VAR_1->list[VAR_8].x); int highroom = VAR_6 - predicted; int lowroom = predicted; int room = FFMIN(highroom, lowroom); if (predicted == VAR_3[VAR_8]) { VAR_7[VAR_8] = 0; continue; } else { if (!VAR_7[VAR_1->list[VAR_8].low ]) VAR_7[VAR_1->list[VAR_8].low ] = -1; if (!VAR_7[VAR_1->list[VAR_8].high]) VAR_7[VAR_1->list[VAR_8].high] = -1; } if (VAR_3[VAR_8] > predicted) { if (VAR_3[VAR_8] - predicted > room) VAR_7[VAR_8] = VAR_3[VAR_8] - predicted + lowroom; else VAR_7[VAR_8] = (VAR_3[VAR_8] - predicted) << 1; } else { if (predicted - VAR_3[VAR_8] > room) VAR_7[VAR_8] = predicted - VAR_3[VAR_8] + highroom - 1; else VAR_7[VAR_8] = ((predicted - VAR_3[VAR_8]) << 1) - 1; } } VAR_9 = 2; for (VAR_8 = 0; VAR_8 < VAR_1->partitions; VAR_8++) { vorbis_enc_floor_class * c = &VAR_1->classes[VAR_1->partition_to_class[VAR_8]]; int k, cval = 0, csub = 1<<c->subclass; if (c->subclass) { vorbis_enc_codebook * book = &VAR_0->codebooks[c->masterbook]; int cshift = 0; for (k = 0; k < c->dim; k++) { int l; for (l = 0; l < csub; l++) { int maxval = 1; if (c->books[l] != -1) maxval = VAR_0->codebooks[c->books[l]].nentries; if (VAR_7[VAR_9 + k] < maxval) break; } assert(l != csub); cval |= l << cshift; cshift += c->subclass; } put_codeword(VAR_2, book, cval); } for (k = 0; k < c->dim; k++) { int book = c->books[cval & (csub-1)]; int entry = VAR_7[VAR_9++]; cval >>= c->subclass; if (book == -1) continue; if (entry == -1) entry = 0; put_codeword(VAR_2, &VAR_0->codebooks[book], entry); } } ff_vorbis_floor1_render_list(VAR_1->list, VAR_1->values, VAR_3, VAR_7, VAR_1->multiplier, VAR_4, VAR_5); }
[ "static void FUNC_0(vorbis_enc_context *VAR_0, vorbis_enc_floor *VAR_1,\nPutBitContext *VAR_2, uint16_t *VAR_3,\nfloat *VAR_4, int VAR_5)\n{", "int VAR_6 = 255 / VAR_1->multiplier + 1;", "int VAR_7[MAX_FLOOR_VALUES];", "int VAR_8, VAR_9;", "put_bits(VAR_2, 1, 1);", "put_bits(VAR_2, ilog(VAR_6 - 1), VAR_3[0]);", "put_bits(VAR_2, ilog(VAR_6 - 1), VAR_3[1]);", "VAR_7[0] = VAR_7[1] = 1;", "for (VAR_8 = 2; VAR_8 < VAR_1->values; VAR_8++) {", "int predicted = render_point(VAR_1->list[VAR_1->list[VAR_8].low].x,\nVAR_3[VAR_1->list[VAR_8].low],\nVAR_1->list[VAR_1->list[VAR_8].high].x,\nVAR_3[VAR_1->list[VAR_8].high],\nVAR_1->list[VAR_8].x);", "int highroom = VAR_6 - predicted;", "int lowroom = predicted;", "int room = FFMIN(highroom, lowroom);", "if (predicted == VAR_3[VAR_8]) {", "VAR_7[VAR_8] = 0;", "continue;", "} else {", "if (!VAR_7[VAR_1->list[VAR_8].low ])\nVAR_7[VAR_1->list[VAR_8].low ] = -1;", "if (!VAR_7[VAR_1->list[VAR_8].high])\nVAR_7[VAR_1->list[VAR_8].high] = -1;", "}", "if (VAR_3[VAR_8] > predicted) {", "if (VAR_3[VAR_8] - predicted > room)\nVAR_7[VAR_8] = VAR_3[VAR_8] - predicted + lowroom;", "else\nVAR_7[VAR_8] = (VAR_3[VAR_8] - predicted) << 1;", "} else {", "if (predicted - VAR_3[VAR_8] > room)\nVAR_7[VAR_8] = predicted - VAR_3[VAR_8] + highroom - 1;", "else\nVAR_7[VAR_8] = ((predicted - VAR_3[VAR_8]) << 1) - 1;", "}", "}", "VAR_9 = 2;", "for (VAR_8 = 0; VAR_8 < VAR_1->partitions; VAR_8++) {", "vorbis_enc_floor_class * c = &VAR_1->classes[VAR_1->partition_to_class[VAR_8]];", "int k, cval = 0, csub = 1<<c->subclass;", "if (c->subclass) {", "vorbis_enc_codebook * book = &VAR_0->codebooks[c->masterbook];", "int cshift = 0;", "for (k = 0; k < c->dim; k++) {", "int l;", "for (l = 0; l < csub; l++) {", "int maxval = 1;", "if (c->books[l] != -1)\nmaxval = VAR_0->codebooks[c->books[l]].nentries;", "if (VAR_7[VAR_9 + k] < maxval)\nbreak;", "}", "assert(l != csub);", "cval |= l << cshift;", "cshift += c->subclass;", "}", "put_codeword(VAR_2, book, cval);", "}", "for (k = 0; k < c->dim; k++) {", "int book = c->books[cval & (csub-1)];", "int entry = VAR_7[VAR_9++];", "cval >>= c->subclass;", "if (book == -1)\ncontinue;", "if (entry == -1)\nentry = 0;", "put_codeword(VAR_2, &VAR_0->codebooks[book], entry);", "}", "}", "ff_vorbis_floor1_render_list(VAR_1->list, VAR_1->values, VAR_3, VAR_7,\nVAR_1->multiplier, VAR_4, VAR_5);", "}" ]
[ 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, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29, 31, 33, 35, 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53, 55 ], [ 57, 59 ], [ 61 ], [ 63 ], [ 65, 67 ], [ 69, 71 ], [ 73 ], [ 75, 77 ], [ 79, 81 ], [ 83 ], [ 85 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111, 113 ], [ 117, 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143, 145 ], [ 147, 149 ], [ 151 ], [ 153 ], [ 155 ], [ 159, 161 ], [ 163 ] ]
10,179
void qtest_quit(QTestState *s) { int status; pid_t pid = qtest_qemu_pid(s); if (pid != -1) { kill(pid, SIGTERM); waitpid(pid, &status, 0); } unlink(s->pid_file); unlink(s->socket_path); unlink(s->qmp_socket_path); g_free(s->pid_file); g_free(s->socket_path); g_free(s->qmp_socket_path); }
true
qemu
fdd26fca3ce66863e547560fbde1a444fc5d71b7
void qtest_quit(QTestState *s) { int status; pid_t pid = qtest_qemu_pid(s); if (pid != -1) { kill(pid, SIGTERM); waitpid(pid, &status, 0); } unlink(s->pid_file); unlink(s->socket_path); unlink(s->qmp_socket_path); g_free(s->pid_file); g_free(s->socket_path); g_free(s->qmp_socket_path); }
{ "code": [], "line_no": [] }
void FUNC_0(QTestState *VAR_0) { int VAR_1; pid_t pid = qtest_qemu_pid(VAR_0); if (pid != -1) { kill(pid, SIGTERM); waitpid(pid, &VAR_1, 0); } unlink(VAR_0->pid_file); unlink(VAR_0->socket_path); unlink(VAR_0->qmp_socket_path); g_free(VAR_0->pid_file); g_free(VAR_0->socket_path); g_free(VAR_0->qmp_socket_path); }
[ "void FUNC_0(QTestState *VAR_0)\n{", "int VAR_1;", "pid_t pid = qtest_qemu_pid(VAR_0);", "if (pid != -1) {", "kill(pid, SIGTERM);", "waitpid(pid, &VAR_1, 0);", "}", "unlink(VAR_0->pid_file);", "unlink(VAR_0->socket_path);", "unlink(VAR_0->qmp_socket_path);", "g_free(VAR_0->pid_file);", "g_free(VAR_0->socket_path);", "g_free(VAR_0->qmp_socket_path);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 24 ], [ 26 ], [ 28 ], [ 30 ], [ 32 ], [ 34 ], [ 37 ] ]
10,181
static void guess_mv(MpegEncContext *s){ uint8_t fixed[s->mb_stride * s->mb_height]; #define MV_FROZEN 3 #define MV_CHANGED 2 #define MV_UNCHANGED 1 const int mb_stride = s->mb_stride; const int mb_width = s->mb_width; const int mb_height= s->mb_height; int i, depth, num_avail; int mb_x, mb_y, mot_step, mot_stride; set_mv_strides(s, &mot_step, &mot_stride); num_avail=0; for(i=0; i<s->mb_num; i++){ const int mb_xy= s->mb_index2xy[ i ]; int f=0; int error= s->error_status_table[mb_xy]; if(IS_INTRA(s->current_picture.mb_type[mb_xy])) f=MV_FROZEN; //intra //FIXME check if(!(error&MV_ERROR)) f=MV_FROZEN; //inter with undamaged MV fixed[mb_xy]= f; if(f==MV_FROZEN) num_avail++; } if((!(s->avctx->error_concealment&FF_EC_GUESS_MVS)) || num_avail <= mb_width/2){ for(mb_y=0; mb_y<s->mb_height; mb_y++){ for(mb_x=0; mb_x<s->mb_width; mb_x++){ const int mb_xy= mb_x + mb_y*s->mb_stride; if(IS_INTRA(s->current_picture.mb_type[mb_xy])) continue; if(!(s->error_status_table[mb_xy]&MV_ERROR)) continue; s->mv_dir = s->last_picture.data[0] ? MV_DIR_FORWARD : MV_DIR_BACKWARD; s->mb_intra=0; s->mv_type = MV_TYPE_16X16; s->mb_skipped=0; s->dsp.clear_blocks(s->block[0]); s->mb_x= mb_x; s->mb_y= mb_y; s->mv[0][0][0]= 0; s->mv[0][0][1]= 0; decode_mb(s, 0); } } return; } for(depth=0;; depth++){ int changed, pass, none_left; none_left=1; changed=1; for(pass=0; (changed || pass<2) && pass<10; pass++){ int mb_x, mb_y; int score_sum=0; changed=0; for(mb_y=0; mb_y<s->mb_height; mb_y++){ for(mb_x=0; mb_x<s->mb_width; mb_x++){ const int mb_xy= mb_x + mb_y*s->mb_stride; int mv_predictor[8][2]={{0}}; int ref[8]={0}; int pred_count=0; int j; int best_score=256*256*256*64; int best_pred=0; const int mot_index= (mb_x + mb_y*mot_stride) * mot_step; int prev_x, prev_y, prev_ref; if((mb_x^mb_y^pass)&1) continue; if(fixed[mb_xy]==MV_FROZEN) continue; assert(!IS_INTRA(s->current_picture.mb_type[mb_xy])); assert(s->last_picture_ptr && s->last_picture_ptr->data[0]); j=0; if(mb_x>0 && fixed[mb_xy-1 ]==MV_FROZEN) j=1; if(mb_x+1<mb_width && fixed[mb_xy+1 ]==MV_FROZEN) j=1; if(mb_y>0 && fixed[mb_xy-mb_stride]==MV_FROZEN) j=1; if(mb_y+1<mb_height && fixed[mb_xy+mb_stride]==MV_FROZEN) j=1; if(j==0) continue; j=0; if(mb_x>0 && fixed[mb_xy-1 ]==MV_CHANGED) j=1; if(mb_x+1<mb_width && fixed[mb_xy+1 ]==MV_CHANGED) j=1; if(mb_y>0 && fixed[mb_xy-mb_stride]==MV_CHANGED) j=1; if(mb_y+1<mb_height && fixed[mb_xy+mb_stride]==MV_CHANGED) j=1; if(j==0 && pass>1) continue; none_left=0; if(mb_x>0 && fixed[mb_xy-1]){ mv_predictor[pred_count][0]= s->current_picture.motion_val[0][mot_index - mot_step][0]; mv_predictor[pred_count][1]= s->current_picture.motion_val[0][mot_index - mot_step][1]; ref [pred_count] = s->current_picture.ref_index[0][4*(mb_xy-1)]; pred_count++; } if(mb_x+1<mb_width && fixed[mb_xy+1]){ mv_predictor[pred_count][0]= s->current_picture.motion_val[0][mot_index + mot_step][0]; mv_predictor[pred_count][1]= s->current_picture.motion_val[0][mot_index + mot_step][1]; ref [pred_count] = s->current_picture.ref_index[0][4*(mb_xy+1)]; pred_count++; } if(mb_y>0 && fixed[mb_xy-mb_stride]){ mv_predictor[pred_count][0]= s->current_picture.motion_val[0][mot_index - mot_stride*mot_step][0]; mv_predictor[pred_count][1]= s->current_picture.motion_val[0][mot_index - mot_stride*mot_step][1]; ref [pred_count] = s->current_picture.ref_index[0][4*(mb_xy-s->mb_stride)]; pred_count++; } if(mb_y+1<mb_height && fixed[mb_xy+mb_stride]){ mv_predictor[pred_count][0]= s->current_picture.motion_val[0][mot_index + mot_stride*mot_step][0]; mv_predictor[pred_count][1]= s->current_picture.motion_val[0][mot_index + mot_stride*mot_step][1]; ref [pred_count] = s->current_picture.ref_index[0][4*(mb_xy+s->mb_stride)]; pred_count++; } if(pred_count==0) continue; if(pred_count>1){ int sum_x=0, sum_y=0, sum_r=0; int max_x, max_y, min_x, min_y, max_r, min_r; for(j=0; j<pred_count; j++){ sum_x+= mv_predictor[j][0]; sum_y+= mv_predictor[j][1]; sum_r+= ref[j]; if(j && ref[j] != ref[j-1]) goto skip_mean_and_median; } /* mean */ mv_predictor[pred_count][0] = sum_x/j; mv_predictor[pred_count][1] = sum_y/j; ref [pred_count] = sum_r/j; /* median */ if(pred_count>=3){ min_y= min_x= min_r= 99999; max_y= max_x= max_r=-99999; }else{ min_x=min_y=max_x=max_y=min_r=max_r=0; } for(j=0; j<pred_count; j++){ max_x= FFMAX(max_x, mv_predictor[j][0]); max_y= FFMAX(max_y, mv_predictor[j][1]); max_r= FFMAX(max_r, ref[j]); min_x= FFMIN(min_x, mv_predictor[j][0]); min_y= FFMIN(min_y, mv_predictor[j][1]); min_r= FFMIN(min_r, ref[j]); } mv_predictor[pred_count+1][0] = sum_x - max_x - min_x; mv_predictor[pred_count+1][1] = sum_y - max_y - min_y; ref [pred_count+1] = sum_r - max_r - min_r; if(pred_count==4){ mv_predictor[pred_count+1][0] /= 2; mv_predictor[pred_count+1][1] /= 2; ref [pred_count+1] /= 2; } pred_count+=2; } skip_mean_and_median: /* zero MV */ pred_count++; if (!fixed[mb_xy]) { if (s->avctx->codec_id == CODEC_ID_H264) { // FIXME } else { ff_thread_await_progress((AVFrame *) s->last_picture_ptr, mb_y, 0); } if (!s->last_picture.motion_val[0] || !s->last_picture.ref_index[0]) goto skip_last_mv; prev_x = s->last_picture.motion_val[0][mot_index][0]; prev_y = s->last_picture.motion_val[0][mot_index][1]; prev_ref = s->last_picture.ref_index[0][4*mb_xy]; } else { prev_x = s->current_picture.motion_val[0][mot_index][0]; prev_y = s->current_picture.motion_val[0][mot_index][1]; prev_ref = s->current_picture.ref_index[0][4*mb_xy]; } /* last MV */ mv_predictor[pred_count][0]= prev_x; mv_predictor[pred_count][1]= prev_y; ref [pred_count] = prev_ref; pred_count++; s->mv_dir = MV_DIR_FORWARD; s->mb_intra=0; s->mv_type = MV_TYPE_16X16; s->mb_skipped=0; s->dsp.clear_blocks(s->block[0]); s->mb_x= mb_x; s->mb_y= mb_y; for(j=0; j<pred_count; j++){ int score=0; uint8_t *src= s->current_picture.data[0] + mb_x*16 + mb_y*16*s->linesize; s->current_picture.motion_val[0][mot_index][0]= s->mv[0][0][0]= mv_predictor[j][0]; s->current_picture.motion_val[0][mot_index][1]= s->mv[0][0][1]= mv_predictor[j][1]; if(ref[j]<0) //predictor intra or otherwise not available continue; decode_mb(s, ref[j]); if(mb_x>0 && fixed[mb_xy-1]){ int k; for(k=0; k<16; k++) score += FFABS(src[k*s->linesize-1 ]-src[k*s->linesize ]); } if(mb_x+1<mb_width && fixed[mb_xy+1]){ int k; for(k=0; k<16; k++) score += FFABS(src[k*s->linesize+15]-src[k*s->linesize+16]); } if(mb_y>0 && fixed[mb_xy-mb_stride]){ int k; for(k=0; k<16; k++) score += FFABS(src[k-s->linesize ]-src[k ]); } if(mb_y+1<mb_height && fixed[mb_xy+mb_stride]){ int k; for(k=0; k<16; k++) score += FFABS(src[k+s->linesize*15]-src[k+s->linesize*16]); } if(score <= best_score){ // <= will favor the last MV best_score= score; best_pred= j; } } score_sum+= best_score; s->mv[0][0][0]= mv_predictor[best_pred][0]; s->mv[0][0][1]= mv_predictor[best_pred][1]; for(i=0; i<mot_step; i++) for(j=0; j<mot_step; j++){ s->current_picture.motion_val[0][mot_index+i+j*mot_stride][0]= s->mv[0][0][0]; s->current_picture.motion_val[0][mot_index+i+j*mot_stride][1]= s->mv[0][0][1]; } decode_mb(s, ref[best_pred]); if(s->mv[0][0][0] != prev_x || s->mv[0][0][1] != prev_y){ fixed[mb_xy]=MV_CHANGED; changed++; }else fixed[mb_xy]=MV_UNCHANGED; } } // printf(".%d/%d", changed, score_sum); fflush(stdout); } if(none_left) return; for(i=0; i<s->mb_num; i++){ int mb_xy= s->mb_index2xy[i]; if(fixed[mb_xy]) fixed[mb_xy]=MV_FROZEN; } // printf(":"); fflush(stdout); } }
true
FFmpeg
20153fb8f6ce7f482298170d2700befe898fa1cd
static void guess_mv(MpegEncContext *s){ uint8_t fixed[s->mb_stride * s->mb_height]; #define MV_FROZEN 3 #define MV_CHANGED 2 #define MV_UNCHANGED 1 const int mb_stride = s->mb_stride; const int mb_width = s->mb_width; const int mb_height= s->mb_height; int i, depth, num_avail; int mb_x, mb_y, mot_step, mot_stride; set_mv_strides(s, &mot_step, &mot_stride); num_avail=0; for(i=0; i<s->mb_num; i++){ const int mb_xy= s->mb_index2xy[ i ]; int f=0; int error= s->error_status_table[mb_xy]; if(IS_INTRA(s->current_picture.mb_type[mb_xy])) f=MV_FROZEN; if(!(error&MV_ERROR)) f=MV_FROZEN; fixed[mb_xy]= f; if(f==MV_FROZEN) num_avail++; } if((!(s->avctx->error_concealment&FF_EC_GUESS_MVS)) || num_avail <= mb_width/2){ for(mb_y=0; mb_y<s->mb_height; mb_y++){ for(mb_x=0; mb_x<s->mb_width; mb_x++){ const int mb_xy= mb_x + mb_y*s->mb_stride; if(IS_INTRA(s->current_picture.mb_type[mb_xy])) continue; if(!(s->error_status_table[mb_xy]&MV_ERROR)) continue; s->mv_dir = s->last_picture.data[0] ? MV_DIR_FORWARD : MV_DIR_BACKWARD; s->mb_intra=0; s->mv_type = MV_TYPE_16X16; s->mb_skipped=0; s->dsp.clear_blocks(s->block[0]); s->mb_x= mb_x; s->mb_y= mb_y; s->mv[0][0][0]= 0; s->mv[0][0][1]= 0; decode_mb(s, 0); } } return; } for(depth=0;; depth++){ int changed, pass, none_left; none_left=1; changed=1; for(pass=0; (changed || pass<2) && pass<10; pass++){ int mb_x, mb_y; int score_sum=0; changed=0; for(mb_y=0; mb_y<s->mb_height; mb_y++){ for(mb_x=0; mb_x<s->mb_width; mb_x++){ const int mb_xy= mb_x + mb_y*s->mb_stride; int mv_predictor[8][2]={{0}}; int ref[8]={0}; int pred_count=0; int j; int best_score=256*256*256*64; int best_pred=0; const int mot_index= (mb_x + mb_y*mot_stride) * mot_step; int prev_x, prev_y, prev_ref; if((mb_x^mb_y^pass)&1) continue; if(fixed[mb_xy]==MV_FROZEN) continue; assert(!IS_INTRA(s->current_picture.mb_type[mb_xy])); assert(s->last_picture_ptr && s->last_picture_ptr->data[0]); j=0; if(mb_x>0 && fixed[mb_xy-1 ]==MV_FROZEN) j=1; if(mb_x+1<mb_width && fixed[mb_xy+1 ]==MV_FROZEN) j=1; if(mb_y>0 && fixed[mb_xy-mb_stride]==MV_FROZEN) j=1; if(mb_y+1<mb_height && fixed[mb_xy+mb_stride]==MV_FROZEN) j=1; if(j==0) continue; j=0; if(mb_x>0 && fixed[mb_xy-1 ]==MV_CHANGED) j=1; if(mb_x+1<mb_width && fixed[mb_xy+1 ]==MV_CHANGED) j=1; if(mb_y>0 && fixed[mb_xy-mb_stride]==MV_CHANGED) j=1; if(mb_y+1<mb_height && fixed[mb_xy+mb_stride]==MV_CHANGED) j=1; if(j==0 && pass>1) continue; none_left=0; if(mb_x>0 && fixed[mb_xy-1]){ mv_predictor[pred_count][0]= s->current_picture.motion_val[0][mot_index - mot_step][0]; mv_predictor[pred_count][1]= s->current_picture.motion_val[0][mot_index - mot_step][1]; ref [pred_count] = s->current_picture.ref_index[0][4*(mb_xy-1)]; pred_count++; } if(mb_x+1<mb_width && fixed[mb_xy+1]){ mv_predictor[pred_count][0]= s->current_picture.motion_val[0][mot_index + mot_step][0]; mv_predictor[pred_count][1]= s->current_picture.motion_val[0][mot_index + mot_step][1]; ref [pred_count] = s->current_picture.ref_index[0][4*(mb_xy+1)]; pred_count++; } if(mb_y>0 && fixed[mb_xy-mb_stride]){ mv_predictor[pred_count][0]= s->current_picture.motion_val[0][mot_index - mot_stride*mot_step][0]; mv_predictor[pred_count][1]= s->current_picture.motion_val[0][mot_index - mot_stride*mot_step][1]; ref [pred_count] = s->current_picture.ref_index[0][4*(mb_xy-s->mb_stride)]; pred_count++; } if(mb_y+1<mb_height && fixed[mb_xy+mb_stride]){ mv_predictor[pred_count][0]= s->current_picture.motion_val[0][mot_index + mot_stride*mot_step][0]; mv_predictor[pred_count][1]= s->current_picture.motion_val[0][mot_index + mot_stride*mot_step][1]; ref [pred_count] = s->current_picture.ref_index[0][4*(mb_xy+s->mb_stride)]; pred_count++; } if(pred_count==0) continue; if(pred_count>1){ int sum_x=0, sum_y=0, sum_r=0; int max_x, max_y, min_x, min_y, max_r, min_r; for(j=0; j<pred_count; j++){ sum_x+= mv_predictor[j][0]; sum_y+= mv_predictor[j][1]; sum_r+= ref[j]; if(j && ref[j] != ref[j-1]) goto skip_mean_and_median; } mv_predictor[pred_count][0] = sum_x/j; mv_predictor[pred_count][1] = sum_y/j; ref [pred_count] = sum_r/j; if(pred_count>=3){ min_y= min_x= min_r= 99999; max_y= max_x= max_r=-99999; }else{ min_x=min_y=max_x=max_y=min_r=max_r=0; } for(j=0; j<pred_count; j++){ max_x= FFMAX(max_x, mv_predictor[j][0]); max_y= FFMAX(max_y, mv_predictor[j][1]); max_r= FFMAX(max_r, ref[j]); min_x= FFMIN(min_x, mv_predictor[j][0]); min_y= FFMIN(min_y, mv_predictor[j][1]); min_r= FFMIN(min_r, ref[j]); } mv_predictor[pred_count+1][0] = sum_x - max_x - min_x; mv_predictor[pred_count+1][1] = sum_y - max_y - min_y; ref [pred_count+1] = sum_r - max_r - min_r; if(pred_count==4){ mv_predictor[pred_count+1][0] /= 2; mv_predictor[pred_count+1][1] /= 2; ref [pred_count+1] /= 2; } pred_count+=2; } skip_mean_and_median: pred_count++; if (!fixed[mb_xy]) { if (s->avctx->codec_id == CODEC_ID_H264) { } else { ff_thread_await_progress((AVFrame *) s->last_picture_ptr, mb_y, 0); } if (!s->last_picture.motion_val[0] || !s->last_picture.ref_index[0]) goto skip_last_mv; prev_x = s->last_picture.motion_val[0][mot_index][0]; prev_y = s->last_picture.motion_val[0][mot_index][1]; prev_ref = s->last_picture.ref_index[0][4*mb_xy]; } else { prev_x = s->current_picture.motion_val[0][mot_index][0]; prev_y = s->current_picture.motion_val[0][mot_index][1]; prev_ref = s->current_picture.ref_index[0][4*mb_xy]; } mv_predictor[pred_count][0]= prev_x; mv_predictor[pred_count][1]= prev_y; ref [pred_count] = prev_ref; pred_count++; s->mv_dir = MV_DIR_FORWARD; s->mb_intra=0; s->mv_type = MV_TYPE_16X16; s->mb_skipped=0; s->dsp.clear_blocks(s->block[0]); s->mb_x= mb_x; s->mb_y= mb_y; for(j=0; j<pred_count; j++){ int score=0; uint8_t *src= s->current_picture.data[0] + mb_x*16 + mb_y*16*s->linesize; s->current_picture.motion_val[0][mot_index][0]= s->mv[0][0][0]= mv_predictor[j][0]; s->current_picture.motion_val[0][mot_index][1]= s->mv[0][0][1]= mv_predictor[j][1]; if(ref[j]<0) continue; decode_mb(s, ref[j]); if(mb_x>0 && fixed[mb_xy-1]){ int k; for(k=0; k<16; k++) score += FFABS(src[k*s->linesize-1 ]-src[k*s->linesize ]); } if(mb_x+1<mb_width && fixed[mb_xy+1]){ int k; for(k=0; k<16; k++) score += FFABS(src[k*s->linesize+15]-src[k*s->linesize+16]); } if(mb_y>0 && fixed[mb_xy-mb_stride]){ int k; for(k=0; k<16; k++) score += FFABS(src[k-s->linesize ]-src[k ]); } if(mb_y+1<mb_height && fixed[mb_xy+mb_stride]){ int k; for(k=0; k<16; k++) score += FFABS(src[k+s->linesize*15]-src[k+s->linesize*16]); } if(score <= best_score){ best_score= score; best_pred= j; } } score_sum+= best_score; s->mv[0][0][0]= mv_predictor[best_pred][0]; s->mv[0][0][1]= mv_predictor[best_pred][1]; for(i=0; i<mot_step; i++) for(j=0; j<mot_step; j++){ s->current_picture.motion_val[0][mot_index+i+j*mot_stride][0]= s->mv[0][0][0]; s->current_picture.motion_val[0][mot_index+i+j*mot_stride][1]= s->mv[0][0][1]; } decode_mb(s, ref[best_pred]); if(s->mv[0][0][0] != prev_x || s->mv[0][0][1] != prev_y){ fixed[mb_xy]=MV_CHANGED; changed++; }else fixed[mb_xy]=MV_UNCHANGED; } } } if(none_left) return; for(i=0; i<s->mb_num; i++){ int mb_xy= s->mb_index2xy[i]; if(fixed[mb_xy]) fixed[mb_xy]=MV_FROZEN; } } }
{ "code": [], "line_no": [] }
static void FUNC_0(MpegEncContext *VAR_0){ uint8_t fixed[VAR_0->VAR_1 * VAR_0->VAR_3]; #define MV_FROZEN 3 #define MV_CHANGED 2 #define MV_UNCHANGED 1 const int VAR_1 = VAR_0->VAR_1; const int VAR_2 = VAR_0->VAR_2; const int VAR_3= VAR_0->VAR_3; int VAR_4, VAR_5, VAR_6; int VAR_14, VAR_14, VAR_9, VAR_10; set_mv_strides(VAR_0, &VAR_9, &VAR_10); VAR_6=0; for(VAR_4=0; VAR_4<VAR_0->mb_num; VAR_4++){ const int mb_xy= VAR_0->mb_index2xy[ VAR_4 ]; int f=0; int error= VAR_0->error_status_table[mb_xy]; if(IS_INTRA(VAR_0->current_picture.mb_type[mb_xy])) f=MV_FROZEN; if(!(error&MV_ERROR)) f=MV_FROZEN; fixed[mb_xy]= f; if(f==MV_FROZEN) VAR_6++; } if((!(VAR_0->avctx->error_concealment&FF_EC_GUESS_MVS)) || VAR_6 <= VAR_2/2){ for(VAR_14=0; VAR_14<VAR_0->VAR_3; VAR_14++){ for(VAR_14=0; VAR_14<VAR_0->VAR_2; VAR_14++){ const int mb_xy= VAR_14 + VAR_14*VAR_0->VAR_1; if(IS_INTRA(VAR_0->current_picture.mb_type[mb_xy])) continue; if(!(VAR_0->error_status_table[mb_xy]&MV_ERROR)) continue; VAR_0->mv_dir = VAR_0->last_picture.data[0] ? MV_DIR_FORWARD : MV_DIR_BACKWARD; VAR_0->mb_intra=0; VAR_0->mv_type = MV_TYPE_16X16; VAR_0->mb_skipped=0; VAR_0->dsp.clear_blocks(VAR_0->block[0]); VAR_0->VAR_14= VAR_14; VAR_0->VAR_14= VAR_14; VAR_0->mv[0][0][0]= 0; VAR_0->mv[0][0][1]= 0; decode_mb(VAR_0, 0); } } return; } for(VAR_5=0;; VAR_5++){ int VAR_11, VAR_12, VAR_13; VAR_13=1; VAR_11=1; for(VAR_12=0; (VAR_11 || VAR_12<2) && VAR_12<10; VAR_12++){ int VAR_14, VAR_14; int VAR_14=0; VAR_11=0; for(VAR_14=0; VAR_14<VAR_0->VAR_3; VAR_14++){ for(VAR_14=0; VAR_14<VAR_0->VAR_2; VAR_14++){ const int mb_xy= VAR_14 + VAR_14*VAR_0->VAR_1; int mv_predictor[8][2]={{0}}; int ref[8]={0}; int pred_count=0; int j; int best_score=256*256*256*64; int best_pred=0; const int mot_index= (VAR_14 + VAR_14*VAR_10) * VAR_9; int prev_x, prev_y, prev_ref; if((VAR_14^VAR_14^VAR_12)&1) continue; if(fixed[mb_xy]==MV_FROZEN) continue; assert(!IS_INTRA(VAR_0->current_picture.mb_type[mb_xy])); assert(VAR_0->last_picture_ptr && VAR_0->last_picture_ptr->data[0]); j=0; if(VAR_14>0 && fixed[mb_xy-1 ]==MV_FROZEN) j=1; if(VAR_14+1<VAR_2 && fixed[mb_xy+1 ]==MV_FROZEN) j=1; if(VAR_14>0 && fixed[mb_xy-VAR_1]==MV_FROZEN) j=1; if(VAR_14+1<VAR_3 && fixed[mb_xy+VAR_1]==MV_FROZEN) j=1; if(j==0) continue; j=0; if(VAR_14>0 && fixed[mb_xy-1 ]==MV_CHANGED) j=1; if(VAR_14+1<VAR_2 && fixed[mb_xy+1 ]==MV_CHANGED) j=1; if(VAR_14>0 && fixed[mb_xy-VAR_1]==MV_CHANGED) j=1; if(VAR_14+1<VAR_3 && fixed[mb_xy+VAR_1]==MV_CHANGED) j=1; if(j==0 && VAR_12>1) continue; VAR_13=0; if(VAR_14>0 && fixed[mb_xy-1]){ mv_predictor[pred_count][0]= VAR_0->current_picture.motion_val[0][mot_index - VAR_9][0]; mv_predictor[pred_count][1]= VAR_0->current_picture.motion_val[0][mot_index - VAR_9][1]; ref [pred_count] = VAR_0->current_picture.ref_index[0][4*(mb_xy-1)]; pred_count++; } if(VAR_14+1<VAR_2 && fixed[mb_xy+1]){ mv_predictor[pred_count][0]= VAR_0->current_picture.motion_val[0][mot_index + VAR_9][0]; mv_predictor[pred_count][1]= VAR_0->current_picture.motion_val[0][mot_index + VAR_9][1]; ref [pred_count] = VAR_0->current_picture.ref_index[0][4*(mb_xy+1)]; pred_count++; } if(VAR_14>0 && fixed[mb_xy-VAR_1]){ mv_predictor[pred_count][0]= VAR_0->current_picture.motion_val[0][mot_index - VAR_10*VAR_9][0]; mv_predictor[pred_count][1]= VAR_0->current_picture.motion_val[0][mot_index - VAR_10*VAR_9][1]; ref [pred_count] = VAR_0->current_picture.ref_index[0][4*(mb_xy-VAR_0->VAR_1)]; pred_count++; } if(VAR_14+1<VAR_3 && fixed[mb_xy+VAR_1]){ mv_predictor[pred_count][0]= VAR_0->current_picture.motion_val[0][mot_index + VAR_10*VAR_9][0]; mv_predictor[pred_count][1]= VAR_0->current_picture.motion_val[0][mot_index + VAR_10*VAR_9][1]; ref [pred_count] = VAR_0->current_picture.ref_index[0][4*(mb_xy+VAR_0->VAR_1)]; pred_count++; } if(pred_count==0) continue; if(pred_count>1){ int sum_x=0, sum_y=0, sum_r=0; int max_x, max_y, min_x, min_y, max_r, min_r; for(j=0; j<pred_count; j++){ sum_x+= mv_predictor[j][0]; sum_y+= mv_predictor[j][1]; sum_r+= ref[j]; if(j && ref[j] != ref[j-1]) goto skip_mean_and_median; } mv_predictor[pred_count][0] = sum_x/j; mv_predictor[pred_count][1] = sum_y/j; ref [pred_count] = sum_r/j; if(pred_count>=3){ min_y= min_x= min_r= 99999; max_y= max_x= max_r=-99999; }else{ min_x=min_y=max_x=max_y=min_r=max_r=0; } for(j=0; j<pred_count; j++){ max_x= FFMAX(max_x, mv_predictor[j][0]); max_y= FFMAX(max_y, mv_predictor[j][1]); max_r= FFMAX(max_r, ref[j]); min_x= FFMIN(min_x, mv_predictor[j][0]); min_y= FFMIN(min_y, mv_predictor[j][1]); min_r= FFMIN(min_r, ref[j]); } mv_predictor[pred_count+1][0] = sum_x - max_x - min_x; mv_predictor[pred_count+1][1] = sum_y - max_y - min_y; ref [pred_count+1] = sum_r - max_r - min_r; if(pred_count==4){ mv_predictor[pred_count+1][0] /= 2; mv_predictor[pred_count+1][1] /= 2; ref [pred_count+1] /= 2; } pred_count+=2; } skip_mean_and_median: pred_count++; if (!fixed[mb_xy]) { if (VAR_0->avctx->codec_id == CODEC_ID_H264) { } else { ff_thread_await_progress((AVFrame *) VAR_0->last_picture_ptr, VAR_14, 0); } if (!VAR_0->last_picture.motion_val[0] || !VAR_0->last_picture.ref_index[0]) goto skip_last_mv; prev_x = VAR_0->last_picture.motion_val[0][mot_index][0]; prev_y = VAR_0->last_picture.motion_val[0][mot_index][1]; prev_ref = VAR_0->last_picture.ref_index[0][4*mb_xy]; } else { prev_x = VAR_0->current_picture.motion_val[0][mot_index][0]; prev_y = VAR_0->current_picture.motion_val[0][mot_index][1]; prev_ref = VAR_0->current_picture.ref_index[0][4*mb_xy]; } mv_predictor[pred_count][0]= prev_x; mv_predictor[pred_count][1]= prev_y; ref [pred_count] = prev_ref; pred_count++; VAR_0->mv_dir = MV_DIR_FORWARD; VAR_0->mb_intra=0; VAR_0->mv_type = MV_TYPE_16X16; VAR_0->mb_skipped=0; VAR_0->dsp.clear_blocks(VAR_0->block[0]); VAR_0->VAR_14= VAR_14; VAR_0->VAR_14= VAR_14; for(j=0; j<pred_count; j++){ int score=0; uint8_t *src= VAR_0->current_picture.data[0] + VAR_14*16 + VAR_14*16*VAR_0->linesize; VAR_0->current_picture.motion_val[0][mot_index][0]= VAR_0->mv[0][0][0]= mv_predictor[j][0]; VAR_0->current_picture.motion_val[0][mot_index][1]= VAR_0->mv[0][0][1]= mv_predictor[j][1]; if(ref[j]<0) continue; decode_mb(VAR_0, ref[j]); if(VAR_14>0 && fixed[mb_xy-1]){ int k; for(k=0; k<16; k++) score += FFABS(src[k*VAR_0->linesize-1 ]-src[k*VAR_0->linesize ]); } if(VAR_14+1<VAR_2 && fixed[mb_xy+1]){ int k; for(k=0; k<16; k++) score += FFABS(src[k*VAR_0->linesize+15]-src[k*VAR_0->linesize+16]); } if(VAR_14>0 && fixed[mb_xy-VAR_1]){ int k; for(k=0; k<16; k++) score += FFABS(src[k-VAR_0->linesize ]-src[k ]); } if(VAR_14+1<VAR_3 && fixed[mb_xy+VAR_1]){ int k; for(k=0; k<16; k++) score += FFABS(src[k+VAR_0->linesize*15]-src[k+VAR_0->linesize*16]); } if(score <= best_score){ best_score= score; best_pred= j; } } VAR_14+= best_score; VAR_0->mv[0][0][0]= mv_predictor[best_pred][0]; VAR_0->mv[0][0][1]= mv_predictor[best_pred][1]; for(VAR_4=0; VAR_4<VAR_9; VAR_4++) for(j=0; j<VAR_9; j++){ VAR_0->current_picture.motion_val[0][mot_index+VAR_4+j*VAR_10][0]= VAR_0->mv[0][0][0]; VAR_0->current_picture.motion_val[0][mot_index+VAR_4+j*VAR_10][1]= VAR_0->mv[0][0][1]; } decode_mb(VAR_0, ref[best_pred]); if(VAR_0->mv[0][0][0] != prev_x || VAR_0->mv[0][0][1] != prev_y){ fixed[mb_xy]=MV_CHANGED; VAR_11++; }else fixed[mb_xy]=MV_UNCHANGED; } } } if(VAR_13) return; for(VAR_4=0; VAR_4<VAR_0->mb_num; VAR_4++){ int mb_xy= VAR_0->mb_index2xy[VAR_4]; if(fixed[mb_xy]) fixed[mb_xy]=MV_FROZEN; } } }
[ "static void FUNC_0(MpegEncContext *VAR_0){", "uint8_t fixed[VAR_0->VAR_1 * VAR_0->VAR_3];", "#define MV_FROZEN 3\n#define MV_CHANGED 2\n#define MV_UNCHANGED 1\nconst int VAR_1 = VAR_0->VAR_1;", "const int VAR_2 = VAR_0->VAR_2;", "const int VAR_3= VAR_0->VAR_3;", "int VAR_4, VAR_5, VAR_6;", "int VAR_14, VAR_14, VAR_9, VAR_10;", "set_mv_strides(VAR_0, &VAR_9, &VAR_10);", "VAR_6=0;", "for(VAR_4=0; VAR_4<VAR_0->mb_num; VAR_4++){", "const int mb_xy= VAR_0->mb_index2xy[ VAR_4 ];", "int f=0;", "int error= VAR_0->error_status_table[mb_xy];", "if(IS_INTRA(VAR_0->current_picture.mb_type[mb_xy])) f=MV_FROZEN;", "if(!(error&MV_ERROR)) f=MV_FROZEN;", "fixed[mb_xy]= f;", "if(f==MV_FROZEN)\nVAR_6++;", "}", "if((!(VAR_0->avctx->error_concealment&FF_EC_GUESS_MVS)) || VAR_6 <= VAR_2/2){", "for(VAR_14=0; VAR_14<VAR_0->VAR_3; VAR_14++){", "for(VAR_14=0; VAR_14<VAR_0->VAR_2; VAR_14++){", "const int mb_xy= VAR_14 + VAR_14*VAR_0->VAR_1;", "if(IS_INTRA(VAR_0->current_picture.mb_type[mb_xy])) continue;", "if(!(VAR_0->error_status_table[mb_xy]&MV_ERROR)) continue;", "VAR_0->mv_dir = VAR_0->last_picture.data[0] ? MV_DIR_FORWARD : MV_DIR_BACKWARD;", "VAR_0->mb_intra=0;", "VAR_0->mv_type = MV_TYPE_16X16;", "VAR_0->mb_skipped=0;", "VAR_0->dsp.clear_blocks(VAR_0->block[0]);", "VAR_0->VAR_14= VAR_14;", "VAR_0->VAR_14= VAR_14;", "VAR_0->mv[0][0][0]= 0;", "VAR_0->mv[0][0][1]= 0;", "decode_mb(VAR_0, 0);", "}", "}", "return;", "}", "for(VAR_5=0;; VAR_5++){", "int VAR_11, VAR_12, VAR_13;", "VAR_13=1;", "VAR_11=1;", "for(VAR_12=0; (VAR_11 || VAR_12<2) && VAR_12<10; VAR_12++){", "int VAR_14, VAR_14;", "int VAR_14=0;", "VAR_11=0;", "for(VAR_14=0; VAR_14<VAR_0->VAR_3; VAR_14++){", "for(VAR_14=0; VAR_14<VAR_0->VAR_2; VAR_14++){", "const int mb_xy= VAR_14 + VAR_14*VAR_0->VAR_1;", "int mv_predictor[8][2]={{0}};", "int ref[8]={0};", "int pred_count=0;", "int j;", "int best_score=256*256*256*64;", "int best_pred=0;", "const int mot_index= (VAR_14 + VAR_14*VAR_10) * VAR_9;", "int prev_x, prev_y, prev_ref;", "if((VAR_14^VAR_14^VAR_12)&1) continue;", "if(fixed[mb_xy]==MV_FROZEN) continue;", "assert(!IS_INTRA(VAR_0->current_picture.mb_type[mb_xy]));", "assert(VAR_0->last_picture_ptr && VAR_0->last_picture_ptr->data[0]);", "j=0;", "if(VAR_14>0 && fixed[mb_xy-1 ]==MV_FROZEN) j=1;", "if(VAR_14+1<VAR_2 && fixed[mb_xy+1 ]==MV_FROZEN) j=1;", "if(VAR_14>0 && fixed[mb_xy-VAR_1]==MV_FROZEN) j=1;", "if(VAR_14+1<VAR_3 && fixed[mb_xy+VAR_1]==MV_FROZEN) j=1;", "if(j==0) continue;", "j=0;", "if(VAR_14>0 && fixed[mb_xy-1 ]==MV_CHANGED) j=1;", "if(VAR_14+1<VAR_2 && fixed[mb_xy+1 ]==MV_CHANGED) j=1;", "if(VAR_14>0 && fixed[mb_xy-VAR_1]==MV_CHANGED) j=1;", "if(VAR_14+1<VAR_3 && fixed[mb_xy+VAR_1]==MV_CHANGED) j=1;", "if(j==0 && VAR_12>1) continue;", "VAR_13=0;", "if(VAR_14>0 && fixed[mb_xy-1]){", "mv_predictor[pred_count][0]= VAR_0->current_picture.motion_val[0][mot_index - VAR_9][0];", "mv_predictor[pred_count][1]= VAR_0->current_picture.motion_val[0][mot_index - VAR_9][1];", "ref [pred_count] = VAR_0->current_picture.ref_index[0][4*(mb_xy-1)];", "pred_count++;", "}", "if(VAR_14+1<VAR_2 && fixed[mb_xy+1]){", "mv_predictor[pred_count][0]= VAR_0->current_picture.motion_val[0][mot_index + VAR_9][0];", "mv_predictor[pred_count][1]= VAR_0->current_picture.motion_val[0][mot_index + VAR_9][1];", "ref [pred_count] = VAR_0->current_picture.ref_index[0][4*(mb_xy+1)];", "pred_count++;", "}", "if(VAR_14>0 && fixed[mb_xy-VAR_1]){", "mv_predictor[pred_count][0]= VAR_0->current_picture.motion_val[0][mot_index - VAR_10*VAR_9][0];", "mv_predictor[pred_count][1]= VAR_0->current_picture.motion_val[0][mot_index - VAR_10*VAR_9][1];", "ref [pred_count] = VAR_0->current_picture.ref_index[0][4*(mb_xy-VAR_0->VAR_1)];", "pred_count++;", "}", "if(VAR_14+1<VAR_3 && fixed[mb_xy+VAR_1]){", "mv_predictor[pred_count][0]= VAR_0->current_picture.motion_val[0][mot_index + VAR_10*VAR_9][0];", "mv_predictor[pred_count][1]= VAR_0->current_picture.motion_val[0][mot_index + VAR_10*VAR_9][1];", "ref [pred_count] = VAR_0->current_picture.ref_index[0][4*(mb_xy+VAR_0->VAR_1)];", "pred_count++;", "}", "if(pred_count==0) continue;", "if(pred_count>1){", "int sum_x=0, sum_y=0, sum_r=0;", "int max_x, max_y, min_x, min_y, max_r, min_r;", "for(j=0; j<pred_count; j++){", "sum_x+= mv_predictor[j][0];", "sum_y+= mv_predictor[j][1];", "sum_r+= ref[j];", "if(j && ref[j] != ref[j-1])\ngoto skip_mean_and_median;", "}", "mv_predictor[pred_count][0] = sum_x/j;", "mv_predictor[pred_count][1] = sum_y/j;", "ref [pred_count] = sum_r/j;", "if(pred_count>=3){", "min_y= min_x= min_r= 99999;", "max_y= max_x= max_r=-99999;", "}else{", "min_x=min_y=max_x=max_y=min_r=max_r=0;", "}", "for(j=0; j<pred_count; j++){", "max_x= FFMAX(max_x, mv_predictor[j][0]);", "max_y= FFMAX(max_y, mv_predictor[j][1]);", "max_r= FFMAX(max_r, ref[j]);", "min_x= FFMIN(min_x, mv_predictor[j][0]);", "min_y= FFMIN(min_y, mv_predictor[j][1]);", "min_r= FFMIN(min_r, ref[j]);", "}", "mv_predictor[pred_count+1][0] = sum_x - max_x - min_x;", "mv_predictor[pred_count+1][1] = sum_y - max_y - min_y;", "ref [pred_count+1] = sum_r - max_r - min_r;", "if(pred_count==4){", "mv_predictor[pred_count+1][0] /= 2;", "mv_predictor[pred_count+1][1] /= 2;", "ref [pred_count+1] /= 2;", "}", "pred_count+=2;", "}", "skip_mean_and_median:\npred_count++;", "if (!fixed[mb_xy]) {", "if (VAR_0->avctx->codec_id == CODEC_ID_H264) {", "} else {", "ff_thread_await_progress((AVFrame *) VAR_0->last_picture_ptr,\nVAR_14, 0);", "}", "if (!VAR_0->last_picture.motion_val[0] ||\n!VAR_0->last_picture.ref_index[0])\ngoto skip_last_mv;", "prev_x = VAR_0->last_picture.motion_val[0][mot_index][0];", "prev_y = VAR_0->last_picture.motion_val[0][mot_index][1];", "prev_ref = VAR_0->last_picture.ref_index[0][4*mb_xy];", "} else {", "prev_x = VAR_0->current_picture.motion_val[0][mot_index][0];", "prev_y = VAR_0->current_picture.motion_val[0][mot_index][1];", "prev_ref = VAR_0->current_picture.ref_index[0][4*mb_xy];", "}", "mv_predictor[pred_count][0]= prev_x;", "mv_predictor[pred_count][1]= prev_y;", "ref [pred_count] = prev_ref;", "pred_count++;", "VAR_0->mv_dir = MV_DIR_FORWARD;", "VAR_0->mb_intra=0;", "VAR_0->mv_type = MV_TYPE_16X16;", "VAR_0->mb_skipped=0;", "VAR_0->dsp.clear_blocks(VAR_0->block[0]);", "VAR_0->VAR_14= VAR_14;", "VAR_0->VAR_14= VAR_14;", "for(j=0; j<pred_count; j++){", "int score=0;", "uint8_t *src= VAR_0->current_picture.data[0] + VAR_14*16 + VAR_14*16*VAR_0->linesize;", "VAR_0->current_picture.motion_val[0][mot_index][0]= VAR_0->mv[0][0][0]= mv_predictor[j][0];", "VAR_0->current_picture.motion_val[0][mot_index][1]= VAR_0->mv[0][0][1]= mv_predictor[j][1];", "if(ref[j]<0)\ncontinue;", "decode_mb(VAR_0, ref[j]);", "if(VAR_14>0 && fixed[mb_xy-1]){", "int k;", "for(k=0; k<16; k++)", "score += FFABS(src[k*VAR_0->linesize-1 ]-src[k*VAR_0->linesize ]);", "}", "if(VAR_14+1<VAR_2 && fixed[mb_xy+1]){", "int k;", "for(k=0; k<16; k++)", "score += FFABS(src[k*VAR_0->linesize+15]-src[k*VAR_0->linesize+16]);", "}", "if(VAR_14>0 && fixed[mb_xy-VAR_1]){", "int k;", "for(k=0; k<16; k++)", "score += FFABS(src[k-VAR_0->linesize ]-src[k ]);", "}", "if(VAR_14+1<VAR_3 && fixed[mb_xy+VAR_1]){", "int k;", "for(k=0; k<16; k++)", "score += FFABS(src[k+VAR_0->linesize*15]-src[k+VAR_0->linesize*16]);", "}", "if(score <= best_score){", "best_score= score;", "best_pred= j;", "}", "}", "VAR_14+= best_score;", "VAR_0->mv[0][0][0]= mv_predictor[best_pred][0];", "VAR_0->mv[0][0][1]= mv_predictor[best_pred][1];", "for(VAR_4=0; VAR_4<VAR_9; VAR_4++)", "for(j=0; j<VAR_9; j++){", "VAR_0->current_picture.motion_val[0][mot_index+VAR_4+j*VAR_10][0]= VAR_0->mv[0][0][0];", "VAR_0->current_picture.motion_val[0][mot_index+VAR_4+j*VAR_10][1]= VAR_0->mv[0][0][1];", "}", "decode_mb(VAR_0, ref[best_pred]);", "if(VAR_0->mv[0][0][0] != prev_x || VAR_0->mv[0][0][1] != prev_y){", "fixed[mb_xy]=MV_CHANGED;", "VAR_11++;", "}else", "fixed[mb_xy]=MV_UNCHANGED;", "}", "}", "}", "if(VAR_13)\nreturn;", "for(VAR_4=0; VAR_4<VAR_0->mb_num; VAR_4++){", "int mb_xy= VAR_0->mb_index2xy[VAR_4];", "if(fixed[mb_xy])\nfixed[mb_xy]=MV_FROZEN;", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 45 ], [ 47, 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 105 ], [ 107 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 149 ], [ 153 ], [ 155 ], [ 157 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 189 ], [ 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 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261, 263 ], [ 265 ], [ 271 ], [ 273 ], [ 275 ], [ 281 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ], [ 291 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305 ], [ 307 ], [ 309 ], [ 311 ], [ 313 ], [ 317 ], [ 319 ], [ 321 ], [ 323 ], [ 325 ], [ 327 ], [ 329 ], [ 331, 337 ], [ 341 ], [ 343 ], [ 347 ], [ 349, 351 ], [ 353 ], [ 355, 357, 359 ], [ 361 ], [ 363 ], [ 365 ], [ 367 ], [ 369 ], [ 371 ], [ 373 ], [ 375 ], [ 381 ], [ 383 ], [ 385 ], [ 387 ], [ 392 ], [ 394 ], [ 396 ], [ 398 ], [ 402 ], [ 406 ], [ 408 ], [ 412 ], [ 414 ], [ 416 ], [ 420 ], [ 422 ], [ 426, 428 ], [ 432 ], [ 436 ], [ 438 ], [ 440 ], [ 442 ], [ 444 ], [ 446 ], [ 448 ], [ 450 ], [ 452 ], [ 454 ], [ 456 ], [ 458 ], [ 460 ], [ 462 ], [ 464 ], [ 466 ], [ 468 ], [ 470 ], [ 472 ], [ 474 ], [ 478 ], [ 480 ], [ 482 ], [ 484 ], [ 486 ], [ 488 ], [ 490 ], [ 492 ], [ 496 ], [ 498 ], [ 500 ], [ 502 ], [ 504 ], [ 508 ], [ 514 ], [ 516 ], [ 518 ], [ 520 ], [ 522 ], [ 524 ], [ 526 ], [ 532 ], [ 536, 538 ], [ 542 ], [ 544 ], [ 546, 548 ], [ 550 ], [ 554 ], [ 556 ] ]
10,182
void qemu_bh_delete(QEMUBH *bh) { qemu_bh_cancel(bh); qemu_free(bh); }
true
qemu
1b435b10324fe9937f254bb00718f78d5e50837a
void qemu_bh_delete(QEMUBH *bh) { qemu_bh_cancel(bh); qemu_free(bh); }
{ "code": [ " qemu_bh_cancel(bh);", " qemu_free(bh);" ], "line_no": [ 5, 7 ] }
void FUNC_0(QEMUBH *VAR_0) { qemu_bh_cancel(VAR_0); qemu_free(VAR_0); }
[ "void FUNC_0(QEMUBH *VAR_0)\n{", "qemu_bh_cancel(VAR_0);", "qemu_free(VAR_0);", "}" ]
[ 0, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
10,183
static int read_var_block_data(ALSDecContext *ctx, ALSBlockData *bd) { ALSSpecificConfig *sconf = &ctx->sconf; AVCodecContext *avctx = ctx->avctx; GetBitContext *gb = &ctx->gb; unsigned int k; unsigned int s[8]; unsigned int sx[8]; unsigned int sub_blocks, log2_sub_blocks, sb_length; unsigned int start = 0; unsigned int opt_order; int sb; int32_t *quant_cof = bd->quant_cof; int32_t *current_res; // ensure variable block decoding by reusing this field *bd->const_block = 0; *bd->opt_order = 1; bd->js_blocks = get_bits1(gb); opt_order = *bd->opt_order; // determine the number of subblocks for entropy decoding if (!sconf->bgmc && !sconf->sb_part) { log2_sub_blocks = 0; } else { if (sconf->bgmc && sconf->sb_part) log2_sub_blocks = get_bits(gb, 2); else log2_sub_blocks = 2 * get_bits1(gb); sub_blocks = 1 << log2_sub_blocks; // do not continue in case of a damaged stream since // block_length must be evenly divisible by sub_blocks if (bd->block_length & (sub_blocks - 1)) { av_log(avctx, AV_LOG_WARNING, "Block length is not evenly divisible by the number of subblocks.\n"); sb_length = bd->block_length >> log2_sub_blocks; if (sconf->bgmc) { s[0] = get_bits(gb, 8 + (sconf->resolution > 1)); s[k] = s[k - 1] + decode_rice(gb, 2); for (k = 0; k < sub_blocks; k++) { sx[k] = s[k] & 0x0F; s [k] >>= 4; } else { s[0] = get_bits(gb, 4 + (sconf->resolution > 1)); s[k] = s[k - 1] + decode_rice(gb, 0); if (get_bits1(gb)) *bd->shift_lsbs = get_bits(gb, 4) + 1; *bd->store_prev_samples = (bd->js_blocks && bd->raw_other) || *bd->shift_lsbs; if (!sconf->rlslms) { if (sconf->adapt_order) { int opt_order_length = av_ceil_log2(av_clip((bd->block_length >> 3) - 1, 2, sconf->max_order + 1)); *bd->opt_order = get_bits(gb, opt_order_length); if (*bd->opt_order > sconf->max_order) { *bd->opt_order = sconf->max_order; av_log(avctx, AV_LOG_ERROR, "Predictor order too large!\n"); } else { *bd->opt_order = sconf->max_order; opt_order = *bd->opt_order; if (opt_order) { int add_base; if (sconf->coef_table == 3) { add_base = 0x7F; // read coefficient 0 quant_cof[0] = 32 * parcor_scaled_values[get_bits(gb, 7)]; // read coefficient 1 if (opt_order > 1) quant_cof[1] = -32 * parcor_scaled_values[get_bits(gb, 7)]; // read coefficients 2 to opt_order for (k = 2; k < opt_order; k++) quant_cof[k] = get_bits(gb, 7); } else { int k_max; add_base = 1; // read coefficient 0 to 19 k_max = FFMIN(opt_order, 20); for (k = 0; k < k_max; k++) { int rice_param = parcor_rice_table[sconf->coef_table][k][1]; int offset = parcor_rice_table[sconf->coef_table][k][0]; quant_cof[k] = decode_rice(gb, rice_param) + offset; if (quant_cof[k] < -64 || quant_cof[k] > 63) { av_log(avctx, AV_LOG_ERROR, "Quantization coefficient %d is out of range!\n", quant_cof[k]); return AVERROR_INVALIDDATA; // read coefficients 20 to 126 k_max = FFMIN(opt_order, 127); for (; k < k_max; k++) quant_cof[k] = decode_rice(gb, 2) + (k & 1); // read coefficients 127 to opt_order for (; k < opt_order; k++) quant_cof[k] = decode_rice(gb, 1); quant_cof[0] = 32 * parcor_scaled_values[quant_cof[0] + 64]; if (opt_order > 1) quant_cof[1] = -32 * parcor_scaled_values[quant_cof[1] + 64]; for (k = 2; k < opt_order; k++) quant_cof[k] = (quant_cof[k] << 14) + (add_base << 13); // read LTP gain and lag values if (sconf->long_term_prediction) { *bd->use_ltp = get_bits1(gb); if (*bd->use_ltp) { int r, c; bd->ltp_gain[0] = decode_rice(gb, 1) << 3; bd->ltp_gain[1] = decode_rice(gb, 2) << 3; r = get_unary(gb, 0, 3); c = get_bits(gb, 2); bd->ltp_gain[2] = ltp_gain_values[r][c]; bd->ltp_gain[3] = decode_rice(gb, 2) << 3; bd->ltp_gain[4] = decode_rice(gb, 1) << 3; *bd->ltp_lag = get_bits(gb, ctx->ltp_lag_length); *bd->ltp_lag += FFMAX(4, opt_order + 1); // read first value and residuals in case of a random access block if (bd->ra_block) { if (opt_order) bd->raw_samples[0] = decode_rice(gb, avctx->bits_per_raw_sample - 4); if (opt_order > 1) bd->raw_samples[1] = decode_rice(gb, FFMIN(s[0] + 3, ctx->s_max)); if (opt_order > 2) bd->raw_samples[2] = decode_rice(gb, FFMIN(s[0] + 1, ctx->s_max)); start = FFMIN(opt_order, 3); // read all residuals if (sconf->bgmc) { int delta[8]; unsigned int k [8]; unsigned int b = av_clip((av_ceil_log2(bd->block_length) - 3) >> 1, 0, 5); unsigned int i = start; // read most significant bits unsigned int high; unsigned int low; unsigned int value; ff_bgmc_decode_init(gb, &high, &low, &value); current_res = bd->raw_samples + start; for (sb = 0; sb < sub_blocks; sb++, i = 0) { k [sb] = s[sb] > b ? s[sb] - b : 0; delta[sb] = 5 - s[sb] + k[sb]; ff_bgmc_decode(gb, sb_length, current_res, delta[sb], sx[sb], &high, &low, &value, ctx->bgmc_lut, ctx->bgmc_lut_status); current_res += sb_length; ff_bgmc_decode_end(gb); // read least significant bits and tails i = start; current_res = bd->raw_samples + start; for (sb = 0; sb < sub_blocks; sb++, i = 0) { unsigned int cur_tail_code = tail_code[sx[sb]][delta[sb]]; unsigned int cur_k = k[sb]; unsigned int cur_s = s[sb]; for (; i < sb_length; i++) { int32_t res = *current_res; if (res == cur_tail_code) { unsigned int max_msb = (2 + (sx[sb] > 2) + (sx[sb] > 10)) << (5 - delta[sb]); res = decode_rice(gb, cur_s); if (res >= 0) { res += (max_msb ) << cur_k; } else { res -= (max_msb - 1) << cur_k; } else { if (res > cur_tail_code) res--; if (res & 1) res = -res; res >>= 1; if (cur_k) { res <<= cur_k; res |= get_bits_long(gb, cur_k); *current_res++ = res; } else { current_res = bd->raw_samples + start; for (sb = 0; sb < sub_blocks; sb++, start = 0) for (; start < sb_length; start++) *current_res++ = decode_rice(gb, s[sb]); if (!sconf->mc_coding || ctx->js_switch) align_get_bits(gb); return 0;
true
FFmpeg
6c3d6a214c6a5b0a7e9c4aa1990d1c5b290806d5
static int read_var_block_data(ALSDecContext *ctx, ALSBlockData *bd) { ALSSpecificConfig *sconf = &ctx->sconf; AVCodecContext *avctx = ctx->avctx; GetBitContext *gb = &ctx->gb; unsigned int k; unsigned int s[8]; unsigned int sx[8]; unsigned int sub_blocks, log2_sub_blocks, sb_length; unsigned int start = 0; unsigned int opt_order; int sb; int32_t *quant_cof = bd->quant_cof; int32_t *current_res; *bd->const_block = 0; *bd->opt_order = 1; bd->js_blocks = get_bits1(gb); opt_order = *bd->opt_order; if (!sconf->bgmc && !sconf->sb_part) { log2_sub_blocks = 0; } else { if (sconf->bgmc && sconf->sb_part) log2_sub_blocks = get_bits(gb, 2); else log2_sub_blocks = 2 * get_bits1(gb); sub_blocks = 1 << log2_sub_blocks; if (bd->block_length & (sub_blocks - 1)) { av_log(avctx, AV_LOG_WARNING, "Block length is not evenly divisible by the number of subblocks.\n"); sb_length = bd->block_length >> log2_sub_blocks; if (sconf->bgmc) { s[0] = get_bits(gb, 8 + (sconf->resolution > 1)); s[k] = s[k - 1] + decode_rice(gb, 2); for (k = 0; k < sub_blocks; k++) { sx[k] = s[k] & 0x0F; s [k] >>= 4; } else { s[0] = get_bits(gb, 4 + (sconf->resolution > 1)); s[k] = s[k - 1] + decode_rice(gb, 0); if (get_bits1(gb)) *bd->shift_lsbs = get_bits(gb, 4) + 1; *bd->store_prev_samples = (bd->js_blocks && bd->raw_other) || *bd->shift_lsbs; if (!sconf->rlslms) { if (sconf->adapt_order) { int opt_order_length = av_ceil_log2(av_clip((bd->block_length >> 3) - 1, 2, sconf->max_order + 1)); *bd->opt_order = get_bits(gb, opt_order_length); if (*bd->opt_order > sconf->max_order) { *bd->opt_order = sconf->max_order; av_log(avctx, AV_LOG_ERROR, "Predictor order too large!\n"); } else { *bd->opt_order = sconf->max_order; opt_order = *bd->opt_order; if (opt_order) { int add_base; if (sconf->coef_table == 3) { add_base = 0x7F; quant_cof[0] = 32 * parcor_scaled_values[get_bits(gb, 7)]; if (opt_order > 1) quant_cof[1] = -32 * parcor_scaled_values[get_bits(gb, 7)]; for (k = 2; k < opt_order; k++) quant_cof[k] = get_bits(gb, 7); } else { int k_max; add_base = 1; to 19 k_max = FFMIN(opt_order, 20); for (k = 0; k < k_max; k++) { int rice_param = parcor_rice_table[sconf->coef_table][k][1]; int offset = parcor_rice_table[sconf->coef_table][k][0]; quant_cof[k] = decode_rice(gb, rice_param) + offset; if (quant_cof[k] < -64 || quant_cof[k] > 63) { av_log(avctx, AV_LOG_ERROR, "Quantization coefficient %d is out of range!\n", quant_cof[k]); return AVERROR_INVALIDDATA; k_max = FFMIN(opt_order, 127); for (; k < k_max; k++) quant_cof[k] = decode_rice(gb, 2) + (k & 1); for (; k < opt_order; k++) quant_cof[k] = decode_rice(gb, 1); quant_cof[0] = 32 * parcor_scaled_values[quant_cof[0] + 64]; if (opt_order > 1) quant_cof[1] = -32 * parcor_scaled_values[quant_cof[1] + 64]; for (k = 2; k < opt_order; k++) quant_cof[k] = (quant_cof[k] << 14) + (add_base << 13); if (sconf->long_term_prediction) { *bd->use_ltp = get_bits1(gb); if (*bd->use_ltp) { int r, c; bd->ltp_gain[0] = decode_rice(gb, 1) << 3; bd->ltp_gain[1] = decode_rice(gb, 2) << 3; r = get_unary(gb, 0, 3); c = get_bits(gb, 2); bd->ltp_gain[2] = ltp_gain_values[r][c]; bd->ltp_gain[3] = decode_rice(gb, 2) << 3; bd->ltp_gain[4] = decode_rice(gb, 1) << 3; *bd->ltp_lag = get_bits(gb, ctx->ltp_lag_length); *bd->ltp_lag += FFMAX(4, opt_order + 1); if (bd->ra_block) { if (opt_order) bd->raw_samples[0] = decode_rice(gb, avctx->bits_per_raw_sample - 4); if (opt_order > 1) bd->raw_samples[1] = decode_rice(gb, FFMIN(s[0] + 3, ctx->s_max)); if (opt_order > 2) bd->raw_samples[2] = decode_rice(gb, FFMIN(s[0] + 1, ctx->s_max)); start = FFMIN(opt_order, 3); if (sconf->bgmc) { int delta[8]; unsigned int k [8]; unsigned int b = av_clip((av_ceil_log2(bd->block_length) - 3) >> 1, 0, 5); unsigned int i = start; unsigned int high; unsigned int low; unsigned int value; ff_bgmc_decode_init(gb, &high, &low, &value); current_res = bd->raw_samples + start; for (sb = 0; sb < sub_blocks; sb++, i = 0) { k [sb] = s[sb] > b ? s[sb] - b : 0; delta[sb] = 5 - s[sb] + k[sb]; ff_bgmc_decode(gb, sb_length, current_res, delta[sb], sx[sb], &high, &low, &value, ctx->bgmc_lut, ctx->bgmc_lut_status); current_res += sb_length; ff_bgmc_decode_end(gb); i = start; current_res = bd->raw_samples + start; for (sb = 0; sb < sub_blocks; sb++, i = 0) { unsigned int cur_tail_code = tail_code[sx[sb]][delta[sb]]; unsigned int cur_k = k[sb]; unsigned int cur_s = s[sb]; for (; i < sb_length; i++) { int32_t res = *current_res; if (res == cur_tail_code) { unsigned int max_msb = (2 + (sx[sb] > 2) + (sx[sb] > 10)) << (5 - delta[sb]); res = decode_rice(gb, cur_s); if (res >= 0) { res += (max_msb ) << cur_k; } else { res -= (max_msb - 1) << cur_k; } else { if (res > cur_tail_code) res--; if (res & 1) res = -res; res >>= 1; if (cur_k) { res <<= cur_k; res |= get_bits_long(gb, cur_k); *current_res++ = res; } else { current_res = bd->raw_samples + start; for (sb = 0; sb < sub_blocks; sb++, start = 0) for (; start < sb_length; start++) *current_res++ = decode_rice(gb, s[sb]); if (!sconf->mc_coding || ctx->js_switch) align_get_bits(gb); return 0;
{ "code": [], "line_no": [] }
static int FUNC_0(ALSDecContext *VAR_0, ALSBlockData *VAR_1) { ALSSpecificConfig *sconf = &VAR_0->sconf; AVCodecContext *avctx = VAR_0->avctx; GetBitContext *gb = &VAR_0->gb; unsigned int VAR_2; unsigned int VAR_3[8]; unsigned int VAR_4[8]; unsigned int VAR_5, VAR_6, VAR_7; unsigned int VAR_8 = 0; unsigned int VAR_9; int VAR_10; int32_t *quant_cof = VAR_1->quant_cof; int32_t *current_res; *VAR_1->const_block = 0; *VAR_1->VAR_9 = 1; VAR_1->js_blocks = get_bits1(gb); VAR_9 = *VAR_1->VAR_9; if (!sconf->bgmc && !sconf->sb_part) { VAR_6 = 0; } else { if (sconf->bgmc && sconf->sb_part) VAR_6 = get_bits(gb, 2); else VAR_6 = 2 * get_bits1(gb); VAR_5 = 1 << VAR_6; if (VAR_1->block_length & (VAR_5 - 1)) { av_log(avctx, AV_LOG_WARNING, "Block length is not evenly divisible by the number of subblocks.\n"); VAR_7 = VAR_1->block_length >> VAR_6; if (sconf->bgmc) { VAR_3[0] = get_bits(gb, 8 + (sconf->resolution > 1)); VAR_3[VAR_2] = VAR_3[VAR_2 - 1] + decode_rice(gb, 2); for (VAR_2 = 0; VAR_2 < VAR_5; VAR_2++) { VAR_4[VAR_2] = VAR_3[VAR_2] & 0x0F; VAR_3 [VAR_2] >>= 4; } else { VAR_3[0] = get_bits(gb, 4 + (sconf->resolution > 1)); VAR_3[VAR_2] = VAR_3[VAR_2 - 1] + decode_rice(gb, 0); if (get_bits1(gb)) *VAR_1->shift_lsbs = get_bits(gb, 4) + 1; *VAR_1->store_prev_samples = (VAR_1->js_blocks && VAR_1->raw_other) || *VAR_1->shift_lsbs; if (!sconf->rlslms) { if (sconf->adapt_order) { int opt_order_length = av_ceil_log2(av_clip((VAR_1->block_length >> 3) - 1, 2, sconf->max_order + 1)); *VAR_1->VAR_9 = get_bits(gb, opt_order_length); if (*VAR_1->VAR_9 > sconf->max_order) { *VAR_1->VAR_9 = sconf->max_order; av_log(avctx, AV_LOG_ERROR, "Predictor order too large!\n"); } else { *VAR_1->VAR_9 = sconf->max_order; VAR_9 = *VAR_1->VAR_9; if (VAR_9) { int add_base; if (sconf->coef_table == 3) { add_base = 0x7F; quant_cof[0] = 32 * parcor_scaled_values[get_bits(gb, 7)]; if (VAR_9 > 1) quant_cof[1] = -32 * parcor_scaled_values[get_bits(gb, 7)]; for (VAR_2 = 2; VAR_2 < VAR_9; VAR_2++) quant_cof[VAR_2] = get_bits(gb, 7); } else { int k_max; add_base = 1; to 19 k_max = FFMIN(VAR_9, 20); for (VAR_2 = 0; VAR_2 < k_max; VAR_2++) { int rice_param = parcor_rice_table[sconf->coef_table][VAR_2][1]; int offset = parcor_rice_table[sconf->coef_table][VAR_2][0]; quant_cof[VAR_2] = decode_rice(gb, rice_param) + offset; if (quant_cof[VAR_2] < -64 || quant_cof[VAR_2] > 63) { av_log(avctx, AV_LOG_ERROR, "Quantization coefficient %d is out of range!\n", quant_cof[VAR_2]); return AVERROR_INVALIDDATA; k_max = FFMIN(VAR_9, 127); for (; VAR_2 < k_max; VAR_2++) quant_cof[VAR_2] = decode_rice(gb, 2) + (VAR_2 & 1); for (; VAR_2 < VAR_9; VAR_2++) quant_cof[VAR_2] = decode_rice(gb, 1); quant_cof[0] = 32 * parcor_scaled_values[quant_cof[0] + 64]; if (VAR_9 > 1) quant_cof[1] = -32 * parcor_scaled_values[quant_cof[1] + 64]; for (VAR_2 = 2; VAR_2 < VAR_9; VAR_2++) quant_cof[VAR_2] = (quant_cof[VAR_2] << 14) + (add_base << 13); if (sconf->long_term_prediction) { *VAR_1->use_ltp = get_bits1(gb); if (*VAR_1->use_ltp) { int r, c; VAR_1->ltp_gain[0] = decode_rice(gb, 1) << 3; VAR_1->ltp_gain[1] = decode_rice(gb, 2) << 3; r = get_unary(gb, 0, 3); c = get_bits(gb, 2); VAR_1->ltp_gain[2] = ltp_gain_values[r][c]; VAR_1->ltp_gain[3] = decode_rice(gb, 2) << 3; VAR_1->ltp_gain[4] = decode_rice(gb, 1) << 3; *VAR_1->ltp_lag = get_bits(gb, VAR_0->ltp_lag_length); *VAR_1->ltp_lag += FFMAX(4, VAR_9 + 1); if (VAR_1->ra_block) { if (VAR_9) VAR_1->raw_samples[0] = decode_rice(gb, avctx->bits_per_raw_sample - 4); if (VAR_9 > 1) VAR_1->raw_samples[1] = decode_rice(gb, FFMIN(VAR_3[0] + 3, VAR_0->s_max)); if (VAR_9 > 2) VAR_1->raw_samples[2] = decode_rice(gb, FFMIN(VAR_3[0] + 1, VAR_0->s_max)); VAR_8 = FFMIN(VAR_9, 3); if (sconf->bgmc) { int delta[8]; unsigned int VAR_2 [8]; unsigned int b = av_clip((av_ceil_log2(VAR_1->block_length) - 3) >> 1, 0, 5); unsigned int i = VAR_8; unsigned int high; unsigned int low; unsigned int value; ff_bgmc_decode_init(gb, &high, &low, &value); current_res = VAR_1->raw_samples + VAR_8; for (VAR_10 = 0; VAR_10 < VAR_5; VAR_10++, i = 0) { VAR_2 [VAR_10] = VAR_3[VAR_10] > b ? VAR_3[VAR_10] - b : 0; delta[VAR_10] = 5 - VAR_3[VAR_10] + VAR_2[VAR_10]; ff_bgmc_decode(gb, VAR_7, current_res, delta[VAR_10], VAR_4[VAR_10], &high, &low, &value, VAR_0->bgmc_lut, VAR_0->bgmc_lut_status); current_res += VAR_7; ff_bgmc_decode_end(gb); i = VAR_8; current_res = VAR_1->raw_samples + VAR_8; for (VAR_10 = 0; VAR_10 < VAR_5; VAR_10++, i = 0) { unsigned int cur_tail_code = tail_code[VAR_4[VAR_10]][delta[VAR_10]]; unsigned int cur_k = VAR_2[VAR_10]; unsigned int cur_s = VAR_3[VAR_10]; for (; i < VAR_7; i++) { int32_t res = *current_res; if (res == cur_tail_code) { unsigned int max_msb = (2 + (VAR_4[VAR_10] > 2) + (VAR_4[VAR_10] > 10)) << (5 - delta[VAR_10]); res = decode_rice(gb, cur_s); if (res >= 0) { res += (max_msb ) << cur_k; } else { res -= (max_msb - 1) << cur_k; } else { if (res > cur_tail_code) res--; if (res & 1) res = -res; res >>= 1; if (cur_k) { res <<= cur_k; res |= get_bits_long(gb, cur_k); *current_res++ = res; } else { current_res = VAR_1->raw_samples + VAR_8; for (VAR_10 = 0; VAR_10 < VAR_5; VAR_10++, VAR_8 = 0) for (; VAR_8 < VAR_7; VAR_8++) *current_res++ = decode_rice(gb, VAR_3[VAR_10]); if (!sconf->mc_coding || VAR_0->js_switch) align_get_bits(gb); return 0;
[ "static int FUNC_0(ALSDecContext *VAR_0, ALSBlockData *VAR_1)\n{", "ALSSpecificConfig *sconf = &VAR_0->sconf;", "AVCodecContext *avctx = VAR_0->avctx;", "GetBitContext *gb = &VAR_0->gb;", "unsigned int VAR_2;", "unsigned int VAR_3[8];", "unsigned int VAR_4[8];", "unsigned int VAR_5, VAR_6, VAR_7;", "unsigned int VAR_8 = 0;", "unsigned int VAR_9;", "int VAR_10;", "int32_t *quant_cof = VAR_1->quant_cof;", "int32_t *current_res;", "*VAR_1->const_block = 0;", "*VAR_1->VAR_9 = 1;", "VAR_1->js_blocks = get_bits1(gb);", "VAR_9 = *VAR_1->VAR_9;", "if (!sconf->bgmc && !sconf->sb_part) {", "VAR_6 = 0;", "} else {", "if (sconf->bgmc && sconf->sb_part)\nVAR_6 = get_bits(gb, 2);", "else\nVAR_6 = 2 * get_bits1(gb);", "VAR_5 = 1 << VAR_6;", "if (VAR_1->block_length & (VAR_5 - 1)) {", "av_log(avctx, AV_LOG_WARNING,\n\"Block length is not evenly divisible by the number of subblocks.\\n\");", "VAR_7 = VAR_1->block_length >> VAR_6;", "if (sconf->bgmc) {", "VAR_3[0] = get_bits(gb, 8 + (sconf->resolution > 1));", "VAR_3[VAR_2] = VAR_3[VAR_2 - 1] + decode_rice(gb, 2);", "for (VAR_2 = 0; VAR_2 < VAR_5; VAR_2++) {", "VAR_4[VAR_2] = VAR_3[VAR_2] & 0x0F;", "VAR_3 [VAR_2] >>= 4;", "} else {", "VAR_3[0] = get_bits(gb, 4 + (sconf->resolution > 1));", "VAR_3[VAR_2] = VAR_3[VAR_2 - 1] + decode_rice(gb, 0);", "if (get_bits1(gb))\n*VAR_1->shift_lsbs = get_bits(gb, 4) + 1;", "*VAR_1->store_prev_samples = (VAR_1->js_blocks && VAR_1->raw_other) || *VAR_1->shift_lsbs;", "if (!sconf->rlslms) {", "if (sconf->adapt_order) {", "int opt_order_length = av_ceil_log2(av_clip((VAR_1->block_length >> 3) - 1,\n2, sconf->max_order + 1));", "*VAR_1->VAR_9 = get_bits(gb, opt_order_length);", "if (*VAR_1->VAR_9 > sconf->max_order) {", "*VAR_1->VAR_9 = sconf->max_order;", "av_log(avctx, AV_LOG_ERROR, \"Predictor order too large!\\n\");", "} else {", "*VAR_1->VAR_9 = sconf->max_order;", "VAR_9 = *VAR_1->VAR_9;", "if (VAR_9) {", "int add_base;", "if (sconf->coef_table == 3) {", "add_base = 0x7F;", "quant_cof[0] = 32 * parcor_scaled_values[get_bits(gb, 7)];", "if (VAR_9 > 1)\nquant_cof[1] = -32 * parcor_scaled_values[get_bits(gb, 7)];", "for (VAR_2 = 2; VAR_2 < VAR_9; VAR_2++)", "quant_cof[VAR_2] = get_bits(gb, 7);", "} else {", "int k_max;", "add_base = 1;", "to 19\nk_max = FFMIN(VAR_9, 20);", "for (VAR_2 = 0; VAR_2 < k_max; VAR_2++) {", "int rice_param = parcor_rice_table[sconf->coef_table][VAR_2][1];", "int offset = parcor_rice_table[sconf->coef_table][VAR_2][0];", "quant_cof[VAR_2] = decode_rice(gb, rice_param) + offset;", "if (quant_cof[VAR_2] < -64 || quant_cof[VAR_2] > 63) {", "av_log(avctx, AV_LOG_ERROR, \"Quantization coefficient %d is out of range!\\n\", quant_cof[VAR_2]);", "return AVERROR_INVALIDDATA;", "k_max = FFMIN(VAR_9, 127);", "for (; VAR_2 < k_max; VAR_2++)", "quant_cof[VAR_2] = decode_rice(gb, 2) + (VAR_2 & 1);", "for (; VAR_2 < VAR_9; VAR_2++)", "quant_cof[VAR_2] = decode_rice(gb, 1);", "quant_cof[0] = 32 * parcor_scaled_values[quant_cof[0] + 64];", "if (VAR_9 > 1)\nquant_cof[1] = -32 * parcor_scaled_values[quant_cof[1] + 64];", "for (VAR_2 = 2; VAR_2 < VAR_9; VAR_2++)", "quant_cof[VAR_2] = (quant_cof[VAR_2] << 14) + (add_base << 13);", "if (sconf->long_term_prediction) {", "*VAR_1->use_ltp = get_bits1(gb);", "if (*VAR_1->use_ltp) {", "int r, c;", "VAR_1->ltp_gain[0] = decode_rice(gb, 1) << 3;", "VAR_1->ltp_gain[1] = decode_rice(gb, 2) << 3;", "r = get_unary(gb, 0, 3);", "c = get_bits(gb, 2);", "VAR_1->ltp_gain[2] = ltp_gain_values[r][c];", "VAR_1->ltp_gain[3] = decode_rice(gb, 2) << 3;", "VAR_1->ltp_gain[4] = decode_rice(gb, 1) << 3;", "*VAR_1->ltp_lag = get_bits(gb, VAR_0->ltp_lag_length);", "*VAR_1->ltp_lag += FFMAX(4, VAR_9 + 1);", "if (VAR_1->ra_block) {", "if (VAR_9)\nVAR_1->raw_samples[0] = decode_rice(gb, avctx->bits_per_raw_sample - 4);", "if (VAR_9 > 1)\nVAR_1->raw_samples[1] = decode_rice(gb, FFMIN(VAR_3[0] + 3, VAR_0->s_max));", "if (VAR_9 > 2)\nVAR_1->raw_samples[2] = decode_rice(gb, FFMIN(VAR_3[0] + 1, VAR_0->s_max));", "VAR_8 = FFMIN(VAR_9, 3);", "if (sconf->bgmc) {", "int delta[8];", "unsigned int VAR_2 [8];", "unsigned int b = av_clip((av_ceil_log2(VAR_1->block_length) - 3) >> 1, 0, 5);", "unsigned int i = VAR_8;", "unsigned int high;", "unsigned int low;", "unsigned int value;", "ff_bgmc_decode_init(gb, &high, &low, &value);", "current_res = VAR_1->raw_samples + VAR_8;", "for (VAR_10 = 0; VAR_10 < VAR_5; VAR_10++, i = 0) {", "VAR_2 [VAR_10] = VAR_3[VAR_10] > b ? VAR_3[VAR_10] - b : 0;", "delta[VAR_10] = 5 - VAR_3[VAR_10] + VAR_2[VAR_10];", "ff_bgmc_decode(gb, VAR_7, current_res,\ndelta[VAR_10], VAR_4[VAR_10], &high, &low, &value, VAR_0->bgmc_lut, VAR_0->bgmc_lut_status);", "current_res += VAR_7;", "ff_bgmc_decode_end(gb);", "i = VAR_8;", "current_res = VAR_1->raw_samples + VAR_8;", "for (VAR_10 = 0; VAR_10 < VAR_5; VAR_10++, i = 0) {", "unsigned int cur_tail_code = tail_code[VAR_4[VAR_10]][delta[VAR_10]];", "unsigned int cur_k = VAR_2[VAR_10];", "unsigned int cur_s = VAR_3[VAR_10];", "for (; i < VAR_7; i++) {", "int32_t res = *current_res;", "if (res == cur_tail_code) {", "unsigned int max_msb = (2 + (VAR_4[VAR_10] > 2) + (VAR_4[VAR_10] > 10))\n<< (5 - delta[VAR_10]);", "res = decode_rice(gb, cur_s);", "if (res >= 0) {", "res += (max_msb ) << cur_k;", "} else {", "res -= (max_msb - 1) << cur_k;", "} else {", "if (res > cur_tail_code)\nres--;", "if (res & 1)\nres = -res;", "res >>= 1;", "if (cur_k) {", "res <<= cur_k;", "res |= get_bits_long(gb, cur_k);", "*current_res++ = res;", "} else {", "current_res = VAR_1->raw_samples + VAR_8;", "for (VAR_10 = 0; VAR_10 < VAR_5; VAR_10++, VAR_8 = 0)", "for (; VAR_8 < VAR_7; VAR_8++)", "*current_res++ = decode_rice(gb, VAR_3[VAR_10]);", "if (!sconf->mc_coding || VAR_0->js_switch)\nalign_get_bits(gb);", "return 0;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 35 ], [ 39 ], [ 41 ], [ 45 ], [ 51 ], [ 53 ], [ 55 ], [ 57, 59 ], [ 61, 63 ], [ 68 ], [ 76 ], [ 78, 80 ], [ 86 ], [ 90 ], [ 92 ], [ 95 ], [ 99 ], [ 101 ], [ 103 ], [ 106 ], [ 108 ], [ 111 ], [ 121, 123 ], [ 127 ], [ 133 ], [ 135 ], [ 137, 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 151 ], [ 153 ], [ 158 ], [ 162 ], [ 164 ], [ 168 ], [ 170 ], [ 176 ], [ 182, 184 ], [ 190 ], [ 192 ], [ 194 ], [ 196 ], [ 198 ], [ 202, 204 ], [ 206 ], [ 208 ], [ 210 ], [ 212 ], [ 214 ], [ 216 ], [ 218 ], [ 226 ], [ 228 ], [ 230 ], [ 236 ], [ 238 ], [ 242 ], [ 246, 248 ], [ 253 ], [ 255 ], [ 263 ], [ 265 ], [ 269 ], [ 271 ], [ 275 ], [ 277 ], [ 281 ], [ 283 ], [ 285 ], [ 289 ], [ 291 ], [ 295 ], [ 297 ], [ 305 ], [ 307, 309 ], [ 311, 313 ], [ 315, 317 ], [ 321 ], [ 328 ], [ 330 ], [ 332 ], [ 334 ], [ 336 ], [ 342 ], [ 344 ], [ 346 ], [ 350 ], [ 354 ], [ 358 ], [ 360 ], [ 362 ], [ 366, 368 ], [ 372 ], [ 377 ], [ 385 ], [ 387 ], [ 391 ], [ 393 ], [ 395 ], [ 397 ], [ 401 ], [ 403 ], [ 407 ], [ 409, 411 ], [ 415 ], [ 419 ], [ 421 ], [ 423 ], [ 425 ], [ 428 ], [ 430, 432 ], [ 436, 438 ], [ 442 ], [ 446 ], [ 448 ], [ 450 ], [ 456 ], [ 460 ], [ 462 ], [ 466 ], [ 468 ], [ 470 ], [ 475, 477 ], [ 481 ] ]
10,184
void select_soundhw(const char *optarg) { }
false
qemu
ffa48cf5ab719e1e181e51b87bc0f5d397b791fa
void select_soundhw(const char *optarg) { }
{ "code": [], "line_no": [] }
void FUNC_0(const char *VAR_0) { }
[ "void FUNC_0(const char *VAR_0)\n{", "}" ]
[ 0, 0 ]
[ [ 1, 3 ], [ 5 ] ]
10,185
static void cpu_exec_nocache(CPUState *cpu, int max_cycles, TranslationBlock *orig_tb) { TranslationBlock *tb; /* Should never happen. We only end up here when an existing TB is too long. */ if (max_cycles > CF_COUNT_MASK) max_cycles = CF_COUNT_MASK; tb = tb_gen_code(cpu, orig_tb->pc, orig_tb->cs_base, orig_tb->flags, max_cycles | CF_NOCACHE); tb->orig_tb = tcg_ctx.tb_ctx.tb_invalidated_flag ? NULL : orig_tb; cpu->current_tb = tb; /* execute the generated code */ trace_exec_tb_nocache(tb, tb->pc); cpu_tb_exec(cpu, tb->tc_ptr); cpu->current_tb = NULL; tb_phys_invalidate(tb, -1); tb_free(tb); }
false
qemu
56c0269a9ec105d3848d9f900b5e38e6b35e2478
static void cpu_exec_nocache(CPUState *cpu, int max_cycles, TranslationBlock *orig_tb) { TranslationBlock *tb; if (max_cycles > CF_COUNT_MASK) max_cycles = CF_COUNT_MASK; tb = tb_gen_code(cpu, orig_tb->pc, orig_tb->cs_base, orig_tb->flags, max_cycles | CF_NOCACHE); tb->orig_tb = tcg_ctx.tb_ctx.tb_invalidated_flag ? NULL : orig_tb; cpu->current_tb = tb; trace_exec_tb_nocache(tb, tb->pc); cpu_tb_exec(cpu, tb->tc_ptr); cpu->current_tb = NULL; tb_phys_invalidate(tb, -1); tb_free(tb); }
{ "code": [], "line_no": [] }
static void FUNC_0(CPUState *VAR_0, int VAR_1, TranslationBlock *VAR_2) { TranslationBlock *tb; if (VAR_1 > CF_COUNT_MASK) VAR_1 = CF_COUNT_MASK; tb = tb_gen_code(VAR_0, VAR_2->pc, VAR_2->cs_base, VAR_2->flags, VAR_1 | CF_NOCACHE); tb->VAR_2 = tcg_ctx.tb_ctx.tb_invalidated_flag ? NULL : VAR_2; VAR_0->current_tb = tb; trace_exec_tb_nocache(tb, tb->pc); cpu_tb_exec(VAR_0, tb->tc_ptr); VAR_0->current_tb = NULL; tb_phys_invalidate(tb, -1); tb_free(tb); }
[ "static void FUNC_0(CPUState *VAR_0, int VAR_1,\nTranslationBlock *VAR_2)\n{", "TranslationBlock *tb;", "if (VAR_1 > CF_COUNT_MASK)\nVAR_1 = CF_COUNT_MASK;", "tb = tb_gen_code(VAR_0, VAR_2->pc, VAR_2->cs_base, VAR_2->flags,\nVAR_1 | CF_NOCACHE);", "tb->VAR_2 = tcg_ctx.tb_ctx.tb_invalidated_flag ? NULL : VAR_2;", "VAR_0->current_tb = tb;", "trace_exec_tb_nocache(tb, tb->pc);", "cpu_tb_exec(VAR_0, tb->tc_ptr);", "VAR_0->current_tb = NULL;", "tb_phys_invalidate(tb, -1);", "tb_free(tb);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 15, 17 ], [ 21, 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ] ]
10,186
static int xhci_submit(XHCIState *xhci, XHCITransfer *xfer, XHCIEPContext *epctx) { uint64_t mfindex; DPRINTF("xhci_submit(slotid=%d,epid=%d)\n", xfer->slotid, xfer->epid); xfer->in_xfer = epctx->type>>2; switch(epctx->type) { case ET_INTR_OUT: case ET_INTR_IN: xfer->pkts = 0; xfer->iso_xfer = false; xfer->timed_xfer = true; mfindex = xhci_mfindex_get(xhci); xhci_calc_intr_kick(xhci, xfer, epctx, mfindex); xhci_check_intr_iso_kick(xhci, xfer, epctx, mfindex); if (xfer->running_retry) { return -1; } break; case ET_BULK_OUT: case ET_BULK_IN: xfer->pkts = 0; xfer->iso_xfer = false; xfer->timed_xfer = false; break; case ET_ISO_OUT: case ET_ISO_IN: xfer->pkts = 1; xfer->iso_xfer = true; xfer->timed_xfer = true; mfindex = xhci_mfindex_get(xhci); xhci_calc_iso_kick(xhci, xfer, epctx, mfindex); xhci_check_intr_iso_kick(xhci, xfer, epctx, mfindex); if (xfer->running_retry) { return -1; } break; default: trace_usb_xhci_unimplemented("endpoint type", epctx->type); return -1; } if (xhci_setup_packet(xfer) < 0) { return -1; } usb_handle_packet(xfer->packet.ep->dev, &xfer->packet); xhci_try_complete_packet(xfer); if (!xfer->running_async && !xfer->running_retry) { xhci_kick_epctx(xfer->epctx, xfer->streamid); } return 0; }
false
qemu
ddb603ab6c981c1d67cb42266fc700c33e5b2d8f
static int xhci_submit(XHCIState *xhci, XHCITransfer *xfer, XHCIEPContext *epctx) { uint64_t mfindex; DPRINTF("xhci_submit(slotid=%d,epid=%d)\n", xfer->slotid, xfer->epid); xfer->in_xfer = epctx->type>>2; switch(epctx->type) { case ET_INTR_OUT: case ET_INTR_IN: xfer->pkts = 0; xfer->iso_xfer = false; xfer->timed_xfer = true; mfindex = xhci_mfindex_get(xhci); xhci_calc_intr_kick(xhci, xfer, epctx, mfindex); xhci_check_intr_iso_kick(xhci, xfer, epctx, mfindex); if (xfer->running_retry) { return -1; } break; case ET_BULK_OUT: case ET_BULK_IN: xfer->pkts = 0; xfer->iso_xfer = false; xfer->timed_xfer = false; break; case ET_ISO_OUT: case ET_ISO_IN: xfer->pkts = 1; xfer->iso_xfer = true; xfer->timed_xfer = true; mfindex = xhci_mfindex_get(xhci); xhci_calc_iso_kick(xhci, xfer, epctx, mfindex); xhci_check_intr_iso_kick(xhci, xfer, epctx, mfindex); if (xfer->running_retry) { return -1; } break; default: trace_usb_xhci_unimplemented("endpoint type", epctx->type); return -1; } if (xhci_setup_packet(xfer) < 0) { return -1; } usb_handle_packet(xfer->packet.ep->dev, &xfer->packet); xhci_try_complete_packet(xfer); if (!xfer->running_async && !xfer->running_retry) { xhci_kick_epctx(xfer->epctx, xfer->streamid); } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(XHCIState *VAR_0, XHCITransfer *VAR_1, XHCIEPContext *VAR_2) { uint64_t mfindex; DPRINTF("FUNC_0(slotid=%d,epid=%d)\n", VAR_1->slotid, VAR_1->epid); VAR_1->in_xfer = VAR_2->type>>2; switch(VAR_2->type) { case ET_INTR_OUT: case ET_INTR_IN: VAR_1->pkts = 0; VAR_1->iso_xfer = false; VAR_1->timed_xfer = true; mfindex = xhci_mfindex_get(VAR_0); xhci_calc_intr_kick(VAR_0, VAR_1, VAR_2, mfindex); xhci_check_intr_iso_kick(VAR_0, VAR_1, VAR_2, mfindex); if (VAR_1->running_retry) { return -1; } break; case ET_BULK_OUT: case ET_BULK_IN: VAR_1->pkts = 0; VAR_1->iso_xfer = false; VAR_1->timed_xfer = false; break; case ET_ISO_OUT: case ET_ISO_IN: VAR_1->pkts = 1; VAR_1->iso_xfer = true; VAR_1->timed_xfer = true; mfindex = xhci_mfindex_get(VAR_0); xhci_calc_iso_kick(VAR_0, VAR_1, VAR_2, mfindex); xhci_check_intr_iso_kick(VAR_0, VAR_1, VAR_2, mfindex); if (VAR_1->running_retry) { return -1; } break; default: trace_usb_xhci_unimplemented("endpoint type", VAR_2->type); return -1; } if (xhci_setup_packet(VAR_1) < 0) { return -1; } usb_handle_packet(VAR_1->packet.ep->dev, &VAR_1->packet); xhci_try_complete_packet(VAR_1); if (!VAR_1->running_async && !VAR_1->running_retry) { xhci_kick_epctx(VAR_1->VAR_2, VAR_1->streamid); } return 0; }
[ "static int FUNC_0(XHCIState *VAR_0, XHCITransfer *VAR_1, XHCIEPContext *VAR_2)\n{", "uint64_t mfindex;", "DPRINTF(\"FUNC_0(slotid=%d,epid=%d)\\n\", VAR_1->slotid, VAR_1->epid);", "VAR_1->in_xfer = VAR_2->type>>2;", "switch(VAR_2->type) {", "case ET_INTR_OUT:\ncase ET_INTR_IN:\nVAR_1->pkts = 0;", "VAR_1->iso_xfer = false;", "VAR_1->timed_xfer = true;", "mfindex = xhci_mfindex_get(VAR_0);", "xhci_calc_intr_kick(VAR_0, VAR_1, VAR_2, mfindex);", "xhci_check_intr_iso_kick(VAR_0, VAR_1, VAR_2, mfindex);", "if (VAR_1->running_retry) {", "return -1;", "}", "break;", "case ET_BULK_OUT:\ncase ET_BULK_IN:\nVAR_1->pkts = 0;", "VAR_1->iso_xfer = false;", "VAR_1->timed_xfer = false;", "break;", "case ET_ISO_OUT:\ncase ET_ISO_IN:\nVAR_1->pkts = 1;", "VAR_1->iso_xfer = true;", "VAR_1->timed_xfer = true;", "mfindex = xhci_mfindex_get(VAR_0);", "xhci_calc_iso_kick(VAR_0, VAR_1, VAR_2, mfindex);", "xhci_check_intr_iso_kick(VAR_0, VAR_1, VAR_2, mfindex);", "if (VAR_1->running_retry) {", "return -1;", "}", "break;", "default:\ntrace_usb_xhci_unimplemented(\"endpoint type\", VAR_2->type);", "return -1;", "}", "if (xhci_setup_packet(VAR_1) < 0) {", "return -1;", "}", "usb_handle_packet(VAR_1->packet.ep->dev, &VAR_1->packet);", "xhci_try_complete_packet(VAR_1);", "if (!VAR_1->running_async && !VAR_1->running_retry) {", "xhci_kick_epctx(VAR_1->VAR_2, VAR_1->streamid);", "}", "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 ], [ 9 ], [ 13 ], [ 17 ], [ 19, 21, 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43, 45, 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55, 57, 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79, 81 ], [ 83 ], [ 85 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ] ]
10,188
static void nvram_writel (void *opaque, target_phys_addr_t addr, uint32_t value) { M48t59State *NVRAM = opaque; m48t59_write(NVRAM, addr, (value >> 24) & 0xff); m48t59_write(NVRAM, addr + 1, (value >> 16) & 0xff); m48t59_write(NVRAM, addr + 2, (value >> 8) & 0xff); m48t59_write(NVRAM, addr + 3, value & 0xff); }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static void nvram_writel (void *opaque, target_phys_addr_t addr, uint32_t value) { M48t59State *NVRAM = opaque; m48t59_write(NVRAM, addr, (value >> 24) & 0xff); m48t59_write(NVRAM, addr + 1, (value >> 16) & 0xff); m48t59_write(NVRAM, addr + 2, (value >> 8) & 0xff); m48t59_write(NVRAM, addr + 3, value & 0xff); }
{ "code": [], "line_no": [] }
static void FUNC_0 (void *VAR_0, target_phys_addr_t VAR_1, uint32_t VAR_2) { M48t59State *NVRAM = VAR_0; m48t59_write(NVRAM, VAR_1, (VAR_2 >> 24) & 0xff); m48t59_write(NVRAM, VAR_1 + 1, (VAR_2 >> 16) & 0xff); m48t59_write(NVRAM, VAR_1 + 2, (VAR_2 >> 8) & 0xff); m48t59_write(NVRAM, VAR_1 + 3, VAR_2 & 0xff); }
[ "static void FUNC_0 (void *VAR_0, target_phys_addr_t VAR_1, uint32_t VAR_2)\n{", "M48t59State *NVRAM = VAR_0;", "m48t59_write(NVRAM, VAR_1, (VAR_2 >> 24) & 0xff);", "m48t59_write(NVRAM, VAR_1 + 1, (VAR_2 >> 16) & 0xff);", "m48t59_write(NVRAM, VAR_1 + 2, (VAR_2 >> 8) & 0xff);", "m48t59_write(NVRAM, VAR_1 + 3, VAR_2 & 0xff);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ] ]
10,189
static QIOChannelSocket *nbd_establish_connection(SocketAddress *saddr, Error **errp) { QIOChannelSocket *sioc; Error *local_err = NULL; sioc = qio_channel_socket_new(); qio_channel_set_name(QIO_CHANNEL(sioc), "nbd-client"); qio_channel_socket_connect_sync(sioc, saddr, &local_err); if (local_err) { error_propagate(errp, local_err); return NULL; } qio_channel_set_delay(QIO_CHANNEL(sioc), false); return sioc; }
false
qemu
9445673ea67c272616b9f718396e267caa6446b7
static QIOChannelSocket *nbd_establish_connection(SocketAddress *saddr, Error **errp) { QIOChannelSocket *sioc; Error *local_err = NULL; sioc = qio_channel_socket_new(); qio_channel_set_name(QIO_CHANNEL(sioc), "nbd-client"); qio_channel_socket_connect_sync(sioc, saddr, &local_err); if (local_err) { error_propagate(errp, local_err); return NULL; } qio_channel_set_delay(QIO_CHANNEL(sioc), false); return sioc; }
{ "code": [], "line_no": [] }
static QIOChannelSocket *FUNC_0(SocketAddress *saddr, Error **errp) { QIOChannelSocket *sioc; Error *local_err = NULL; sioc = qio_channel_socket_new(); qio_channel_set_name(QIO_CHANNEL(sioc), "nbd-client"); qio_channel_socket_connect_sync(sioc, saddr, &local_err); if (local_err) { error_propagate(errp, local_err); return NULL; } qio_channel_set_delay(QIO_CHANNEL(sioc), false); return sioc; }
[ "static QIOChannelSocket *FUNC_0(SocketAddress *saddr,\nError **errp)\n{", "QIOChannelSocket *sioc;", "Error *local_err = NULL;", "sioc = qio_channel_socket_new();", "qio_channel_set_name(QIO_CHANNEL(sioc), \"nbd-client\");", "qio_channel_socket_connect_sync(sioc,\nsaddr,\n&local_err);", "if (local_err) {", "error_propagate(errp, local_err);", "return NULL;", "}", "qio_channel_set_delay(QIO_CHANNEL(sioc), false);", "return sioc;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 19, 21, 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 39 ], [ 41 ] ]
10,191
static int write_abst(AVFormatContext *s, OutputStream *os, int final) { HDSContext *c = s->priv_data; AVIOContext *out; char filename[1024], temp_filename[1024]; int i, ret; int64_t asrt_pos, afrt_pos; int start = 0, fragments; int index = s->streams[os->first_stream]->id; int64_t cur_media_time = 0; if (c->window_size) start = FFMAX(os->nb_fragments - c->window_size, 0); fragments = os->nb_fragments - start; if (final) cur_media_time = os->last_ts; else if (os->nb_fragments) cur_media_time = os->fragments[os->nb_fragments - 1]->start_time; snprintf(filename, sizeof(filename), "%s/stream%d.abst", s->filename, index); snprintf(temp_filename, sizeof(temp_filename), "%s/stream%d.abst.tmp", s->filename, index); ret = avio_open2(&out, temp_filename, AVIO_FLAG_WRITE, &s->interrupt_callback, NULL); if (ret < 0) { av_log(s, AV_LOG_ERROR, "Unable to open %s for writing\n", temp_filename); return ret; } avio_wb32(out, 0); // abst size avio_wl32(out, MKTAG('a','b','s','t')); avio_wb32(out, 0); // version + flags avio_wb32(out, os->fragment_index - 1); // BootstrapinfoVersion avio_w8(out, final ? 0 : 0x20); // profile, live, update avio_wb32(out, 1000); // timescale avio_wb64(out, cur_media_time); avio_wb64(out, 0); // SmpteTimeCodeOffset avio_w8(out, 0); // MovieIdentifer (null string) avio_w8(out, 0); // ServerEntryCount avio_w8(out, 0); // QualityEntryCount avio_w8(out, 0); // DrmData (null string) avio_w8(out, 0); // MetaData (null string) avio_w8(out, 1); // SegmentRunTableCount asrt_pos = avio_tell(out); avio_wb32(out, 0); // asrt size avio_wl32(out, MKTAG('a','s','r','t')); avio_wb32(out, 0); // version + flags avio_w8(out, 0); // QualityEntryCount avio_wb32(out, 1); // SegmentRunEntryCount avio_wb32(out, 1); // FirstSegment avio_wb32(out, final ? (os->fragment_index - 1) : 0xffffffff); // FragmentsPerSegment update_size(out, asrt_pos); avio_w8(out, 1); // FragmentRunTableCount afrt_pos = avio_tell(out); avio_wb32(out, 0); // afrt size avio_wl32(out, MKTAG('a','f','r','t')); avio_wb32(out, 0); // version + flags avio_wb32(out, 1000); // timescale avio_w8(out, 0); // QualityEntryCount avio_wb32(out, fragments); // FragmentRunEntryCount for (i = start; i < os->nb_fragments; i++) { avio_wb32(out, os->fragments[i]->n); avio_wb64(out, os->fragments[i]->start_time); avio_wb32(out, os->fragments[i]->duration); } update_size(out, afrt_pos); update_size(out, 0); avio_close(out); return ff_rename(temp_filename, filename); }
false
FFmpeg
9f61abc8111c7c43f49ca012e957a108b9cc7610
static int write_abst(AVFormatContext *s, OutputStream *os, int final) { HDSContext *c = s->priv_data; AVIOContext *out; char filename[1024], temp_filename[1024]; int i, ret; int64_t asrt_pos, afrt_pos; int start = 0, fragments; int index = s->streams[os->first_stream]->id; int64_t cur_media_time = 0; if (c->window_size) start = FFMAX(os->nb_fragments - c->window_size, 0); fragments = os->nb_fragments - start; if (final) cur_media_time = os->last_ts; else if (os->nb_fragments) cur_media_time = os->fragments[os->nb_fragments - 1]->start_time; snprintf(filename, sizeof(filename), "%s/stream%d.abst", s->filename, index); snprintf(temp_filename, sizeof(temp_filename), "%s/stream%d.abst.tmp", s->filename, index); ret = avio_open2(&out, temp_filename, AVIO_FLAG_WRITE, &s->interrupt_callback, NULL); if (ret < 0) { av_log(s, AV_LOG_ERROR, "Unable to open %s for writing\n", temp_filename); return ret; } avio_wb32(out, 0); avio_wl32(out, MKTAG('a','b','s','t')); avio_wb32(out, 0); avio_wb32(out, os->fragment_index - 1); avio_w8(out, final ? 0 : 0x20); avio_wb32(out, 1000); avio_wb64(out, cur_media_time); avio_wb64(out, 0); avio_w8(out, 0); avio_w8(out, 0); avio_w8(out, 0); avio_w8(out, 0); avio_w8(out, 0); avio_w8(out, 1); asrt_pos = avio_tell(out); avio_wb32(out, 0); avio_wl32(out, MKTAG('a','s','r','t')); avio_wb32(out, 0); avio_w8(out, 0); avio_wb32(out, 1); avio_wb32(out, 1); avio_wb32(out, final ? (os->fragment_index - 1) : 0xffffffff); update_size(out, asrt_pos); avio_w8(out, 1); afrt_pos = avio_tell(out); avio_wb32(out, 0); avio_wl32(out, MKTAG('a','f','r','t')); avio_wb32(out, 0); avio_wb32(out, 1000); avio_w8(out, 0); avio_wb32(out, fragments); for (i = start; i < os->nb_fragments; i++) { avio_wb32(out, os->fragments[i]->n); avio_wb64(out, os->fragments[i]->start_time); avio_wb32(out, os->fragments[i]->duration); } update_size(out, afrt_pos); update_size(out, 0); avio_close(out); return ff_rename(temp_filename, filename); }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0, OutputStream *VAR_1, int VAR_2) { HDSContext *c = VAR_0->priv_data; AVIOContext *out; char VAR_3[1024], VAR_4[1024]; int VAR_5, VAR_6; int64_t asrt_pos, afrt_pos; int VAR_7 = 0, VAR_8; int VAR_9 = VAR_0->streams[VAR_1->first_stream]->id; int64_t cur_media_time = 0; if (c->window_size) VAR_7 = FFMAX(VAR_1->nb_fragments - c->window_size, 0); VAR_8 = VAR_1->nb_fragments - VAR_7; if (VAR_2) cur_media_time = VAR_1->last_ts; else if (VAR_1->nb_fragments) cur_media_time = VAR_1->VAR_8[VAR_1->nb_fragments - 1]->start_time; snprintf(VAR_3, sizeof(VAR_3), "%VAR_0/stream%d.abst", VAR_0->VAR_3, VAR_9); snprintf(VAR_4, sizeof(VAR_4), "%VAR_0/stream%d.abst.tmp", VAR_0->VAR_3, VAR_9); VAR_6 = avio_open2(&out, VAR_4, AVIO_FLAG_WRITE, &VAR_0->interrupt_callback, NULL); if (VAR_6 < 0) { av_log(VAR_0, AV_LOG_ERROR, "Unable to open %VAR_0 for writing\n", VAR_4); return VAR_6; } avio_wb32(out, 0); avio_wl32(out, MKTAG('a','b','VAR_0','t')); avio_wb32(out, 0); avio_wb32(out, VAR_1->fragment_index - 1); avio_w8(out, VAR_2 ? 0 : 0x20); avio_wb32(out, 1000); avio_wb64(out, cur_media_time); avio_wb64(out, 0); avio_w8(out, 0); avio_w8(out, 0); avio_w8(out, 0); avio_w8(out, 0); avio_w8(out, 0); avio_w8(out, 1); asrt_pos = avio_tell(out); avio_wb32(out, 0); avio_wl32(out, MKTAG('a','VAR_0','r','t')); avio_wb32(out, 0); avio_w8(out, 0); avio_wb32(out, 1); avio_wb32(out, 1); avio_wb32(out, VAR_2 ? (VAR_1->fragment_index - 1) : 0xffffffff); update_size(out, asrt_pos); avio_w8(out, 1); afrt_pos = avio_tell(out); avio_wb32(out, 0); avio_wl32(out, MKTAG('a','f','r','t')); avio_wb32(out, 0); avio_wb32(out, 1000); avio_w8(out, 0); avio_wb32(out, VAR_8); for (VAR_5 = VAR_7; VAR_5 < VAR_1->nb_fragments; VAR_5++) { avio_wb32(out, VAR_1->VAR_8[VAR_5]->n); avio_wb64(out, VAR_1->VAR_8[VAR_5]->start_time); avio_wb32(out, VAR_1->VAR_8[VAR_5]->duration); } update_size(out, afrt_pos); update_size(out, 0); avio_close(out); return ff_rename(VAR_4, VAR_3); }
[ "static int FUNC_0(AVFormatContext *VAR_0, OutputStream *VAR_1, int VAR_2)\n{", "HDSContext *c = VAR_0->priv_data;", "AVIOContext *out;", "char VAR_3[1024], VAR_4[1024];", "int VAR_5, VAR_6;", "int64_t asrt_pos, afrt_pos;", "int VAR_7 = 0, VAR_8;", "int VAR_9 = VAR_0->streams[VAR_1->first_stream]->id;", "int64_t cur_media_time = 0;", "if (c->window_size)\nVAR_7 = FFMAX(VAR_1->nb_fragments - c->window_size, 0);", "VAR_8 = VAR_1->nb_fragments - VAR_7;", "if (VAR_2)\ncur_media_time = VAR_1->last_ts;", "else if (VAR_1->nb_fragments)\ncur_media_time = VAR_1->VAR_8[VAR_1->nb_fragments - 1]->start_time;", "snprintf(VAR_3, sizeof(VAR_3),\n\"%VAR_0/stream%d.abst\", VAR_0->VAR_3, VAR_9);", "snprintf(VAR_4, sizeof(VAR_4),\n\"%VAR_0/stream%d.abst.tmp\", VAR_0->VAR_3, VAR_9);", "VAR_6 = avio_open2(&out, VAR_4, AVIO_FLAG_WRITE,\n&VAR_0->interrupt_callback, NULL);", "if (VAR_6 < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"Unable to open %VAR_0 for writing\\n\", VAR_4);", "return VAR_6;", "}", "avio_wb32(out, 0);", "avio_wl32(out, MKTAG('a','b','VAR_0','t'));", "avio_wb32(out, 0);", "avio_wb32(out, VAR_1->fragment_index - 1);", "avio_w8(out, VAR_2 ? 0 : 0x20);", "avio_wb32(out, 1000);", "avio_wb64(out, cur_media_time);", "avio_wb64(out, 0);", "avio_w8(out, 0);", "avio_w8(out, 0);", "avio_w8(out, 0);", "avio_w8(out, 0);", "avio_w8(out, 0);", "avio_w8(out, 1);", "asrt_pos = avio_tell(out);", "avio_wb32(out, 0);", "avio_wl32(out, MKTAG('a','VAR_0','r','t'));", "avio_wb32(out, 0);", "avio_w8(out, 0);", "avio_wb32(out, 1);", "avio_wb32(out, 1);", "avio_wb32(out, VAR_2 ? (VAR_1->fragment_index - 1) : 0xffffffff);", "update_size(out, asrt_pos);", "avio_w8(out, 1);", "afrt_pos = avio_tell(out);", "avio_wb32(out, 0);", "avio_wl32(out, MKTAG('a','f','r','t'));", "avio_wb32(out, 0);", "avio_wb32(out, 1000);", "avio_w8(out, 0);", "avio_wb32(out, VAR_8);", "for (VAR_5 = VAR_7; VAR_5 < VAR_1->nb_fragments; VAR_5++) {", "avio_wb32(out, VAR_1->VAR_8[VAR_5]->n);", "avio_wb64(out, VAR_1->VAR_8[VAR_5]->start_time);", "avio_wb32(out, VAR_1->VAR_8[VAR_5]->duration);", "}", "update_size(out, afrt_pos);", "update_size(out, 0);", "avio_close(out);", "return ff_rename(VAR_4, VAR_3);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21, 23 ], [ 25 ], [ 27, 29 ], [ 31, 33 ], [ 37, 39 ], [ 41, 43 ], [ 45, 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ] ]
10,195
static int mptsas_process_scsi_io_request(MPTSASState *s, MPIMsgSCSIIORequest *scsi_io, hwaddr addr) { MPTSASRequest *req; MPIMsgSCSIIOReply reply; SCSIDevice *sdev; int status; mptsas_fix_scsi_io_endianness(scsi_io); trace_mptsas_process_scsi_io_request(s, scsi_io->Bus, scsi_io->TargetID, scsi_io->LUN[1], scsi_io->DataLength); status = mptsas_scsi_device_find(s, scsi_io->Bus, scsi_io->TargetID, scsi_io->LUN, &sdev); if (status) { goto bad; } req = g_new(MPTSASRequest, 1); QTAILQ_INSERT_TAIL(&s->pending, req, next); req->scsi_io = *scsi_io; req->dev = s; status = mptsas_build_sgl(s, req, addr); if (status) { goto free_bad; } if (req->qsg.size < scsi_io->DataLength) { trace_mptsas_sgl_overflow(s, scsi_io->MsgContext, scsi_io->DataLength, req->qsg.size); status = MPI_IOCSTATUS_INVALID_SGL; goto free_bad; } req->sreq = scsi_req_new(sdev, scsi_io->MsgContext, scsi_io->LUN[1], scsi_io->CDB, req); if (req->sreq->cmd.xfer > scsi_io->DataLength) { goto overrun; } switch (scsi_io->Control & MPI_SCSIIO_CONTROL_DATADIRECTION_MASK) { case MPI_SCSIIO_CONTROL_NODATATRANSFER: if (req->sreq->cmd.mode != SCSI_XFER_NONE) { goto overrun; } break; case MPI_SCSIIO_CONTROL_WRITE: if (req->sreq->cmd.mode != SCSI_XFER_TO_DEV) { goto overrun; } break; case MPI_SCSIIO_CONTROL_READ: if (req->sreq->cmd.mode != SCSI_XFER_FROM_DEV) { goto overrun; } break; } if (scsi_req_enqueue(req->sreq)) { scsi_req_continue(req->sreq); } return 0; overrun: trace_mptsas_scsi_overflow(s, scsi_io->MsgContext, req->sreq->cmd.xfer, scsi_io->DataLength); status = MPI_IOCSTATUS_SCSI_DATA_OVERRUN; free_bad: mptsas_free_request(req); bad: memset(&reply, 0, sizeof(reply)); reply.TargetID = scsi_io->TargetID; reply.Bus = scsi_io->Bus; reply.MsgLength = sizeof(reply) / 4; reply.Function = scsi_io->Function; reply.CDBLength = scsi_io->CDBLength; reply.SenseBufferLength = scsi_io->SenseBufferLength; reply.MsgContext = scsi_io->MsgContext; reply.SCSIState = MPI_SCSI_STATE_NO_SCSI_STATUS; reply.IOCStatus = status; mptsas_fix_scsi_io_reply_endianness(&reply); mptsas_reply(s, (MPIDefaultReply *)&reply); return 0; }
false
qemu
670e56d3ed2918b3861d9216f2c0540d9e9ae0d5
static int mptsas_process_scsi_io_request(MPTSASState *s, MPIMsgSCSIIORequest *scsi_io, hwaddr addr) { MPTSASRequest *req; MPIMsgSCSIIOReply reply; SCSIDevice *sdev; int status; mptsas_fix_scsi_io_endianness(scsi_io); trace_mptsas_process_scsi_io_request(s, scsi_io->Bus, scsi_io->TargetID, scsi_io->LUN[1], scsi_io->DataLength); status = mptsas_scsi_device_find(s, scsi_io->Bus, scsi_io->TargetID, scsi_io->LUN, &sdev); if (status) { goto bad; } req = g_new(MPTSASRequest, 1); QTAILQ_INSERT_TAIL(&s->pending, req, next); req->scsi_io = *scsi_io; req->dev = s; status = mptsas_build_sgl(s, req, addr); if (status) { goto free_bad; } if (req->qsg.size < scsi_io->DataLength) { trace_mptsas_sgl_overflow(s, scsi_io->MsgContext, scsi_io->DataLength, req->qsg.size); status = MPI_IOCSTATUS_INVALID_SGL; goto free_bad; } req->sreq = scsi_req_new(sdev, scsi_io->MsgContext, scsi_io->LUN[1], scsi_io->CDB, req); if (req->sreq->cmd.xfer > scsi_io->DataLength) { goto overrun; } switch (scsi_io->Control & MPI_SCSIIO_CONTROL_DATADIRECTION_MASK) { case MPI_SCSIIO_CONTROL_NODATATRANSFER: if (req->sreq->cmd.mode != SCSI_XFER_NONE) { goto overrun; } break; case MPI_SCSIIO_CONTROL_WRITE: if (req->sreq->cmd.mode != SCSI_XFER_TO_DEV) { goto overrun; } break; case MPI_SCSIIO_CONTROL_READ: if (req->sreq->cmd.mode != SCSI_XFER_FROM_DEV) { goto overrun; } break; } if (scsi_req_enqueue(req->sreq)) { scsi_req_continue(req->sreq); } return 0; overrun: trace_mptsas_scsi_overflow(s, scsi_io->MsgContext, req->sreq->cmd.xfer, scsi_io->DataLength); status = MPI_IOCSTATUS_SCSI_DATA_OVERRUN; free_bad: mptsas_free_request(req); bad: memset(&reply, 0, sizeof(reply)); reply.TargetID = scsi_io->TargetID; reply.Bus = scsi_io->Bus; reply.MsgLength = sizeof(reply) / 4; reply.Function = scsi_io->Function; reply.CDBLength = scsi_io->CDBLength; reply.SenseBufferLength = scsi_io->SenseBufferLength; reply.MsgContext = scsi_io->MsgContext; reply.SCSIState = MPI_SCSI_STATE_NO_SCSI_STATUS; reply.IOCStatus = status; mptsas_fix_scsi_io_reply_endianness(&reply); mptsas_reply(s, (MPIDefaultReply *)&reply); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(MPTSASState *VAR_0, MPIMsgSCSIIORequest *VAR_1, hwaddr VAR_2) { MPTSASRequest *req; MPIMsgSCSIIOReply reply; SCSIDevice *sdev; int VAR_3; mptsas_fix_scsi_io_endianness(VAR_1); trace_mptsas_process_scsi_io_request(VAR_0, VAR_1->Bus, VAR_1->TargetID, VAR_1->LUN[1], VAR_1->DataLength); VAR_3 = mptsas_scsi_device_find(VAR_0, VAR_1->Bus, VAR_1->TargetID, VAR_1->LUN, &sdev); if (VAR_3) { goto bad; } req = g_new(MPTSASRequest, 1); QTAILQ_INSERT_TAIL(&VAR_0->pending, req, next); req->VAR_1 = *VAR_1; req->dev = VAR_0; VAR_3 = mptsas_build_sgl(VAR_0, req, VAR_2); if (VAR_3) { goto free_bad; } if (req->qsg.size < VAR_1->DataLength) { trace_mptsas_sgl_overflow(VAR_0, VAR_1->MsgContext, VAR_1->DataLength, req->qsg.size); VAR_3 = MPI_IOCSTATUS_INVALID_SGL; goto free_bad; } req->sreq = scsi_req_new(sdev, VAR_1->MsgContext, VAR_1->LUN[1], VAR_1->CDB, req); if (req->sreq->cmd.xfer > VAR_1->DataLength) { goto overrun; } switch (VAR_1->Control & MPI_SCSIIO_CONTROL_DATADIRECTION_MASK) { case MPI_SCSIIO_CONTROL_NODATATRANSFER: if (req->sreq->cmd.mode != SCSI_XFER_NONE) { goto overrun; } break; case MPI_SCSIIO_CONTROL_WRITE: if (req->sreq->cmd.mode != SCSI_XFER_TO_DEV) { goto overrun; } break; case MPI_SCSIIO_CONTROL_READ: if (req->sreq->cmd.mode != SCSI_XFER_FROM_DEV) { goto overrun; } break; } if (scsi_req_enqueue(req->sreq)) { scsi_req_continue(req->sreq); } return 0; overrun: trace_mptsas_scsi_overflow(VAR_0, VAR_1->MsgContext, req->sreq->cmd.xfer, VAR_1->DataLength); VAR_3 = MPI_IOCSTATUS_SCSI_DATA_OVERRUN; free_bad: mptsas_free_request(req); bad: memset(&reply, 0, sizeof(reply)); reply.TargetID = VAR_1->TargetID; reply.Bus = VAR_1->Bus; reply.MsgLength = sizeof(reply) / 4; reply.Function = VAR_1->Function; reply.CDBLength = VAR_1->CDBLength; reply.SenseBufferLength = VAR_1->SenseBufferLength; reply.MsgContext = VAR_1->MsgContext; reply.SCSIState = MPI_SCSI_STATE_NO_SCSI_STATUS; reply.IOCStatus = VAR_3; mptsas_fix_scsi_io_reply_endianness(&reply); mptsas_reply(VAR_0, (MPIDefaultReply *)&reply); return 0; }
[ "static int FUNC_0(MPTSASState *VAR_0,\nMPIMsgSCSIIORequest *VAR_1,\nhwaddr VAR_2)\n{", "MPTSASRequest *req;", "MPIMsgSCSIIOReply reply;", "SCSIDevice *sdev;", "int VAR_3;", "mptsas_fix_scsi_io_endianness(VAR_1);", "trace_mptsas_process_scsi_io_request(VAR_0, VAR_1->Bus, VAR_1->TargetID,\nVAR_1->LUN[1], VAR_1->DataLength);", "VAR_3 = mptsas_scsi_device_find(VAR_0, VAR_1->Bus, VAR_1->TargetID,\nVAR_1->LUN, &sdev);", "if (VAR_3) {", "goto bad;", "}", "req = g_new(MPTSASRequest, 1);", "QTAILQ_INSERT_TAIL(&VAR_0->pending, req, next);", "req->VAR_1 = *VAR_1;", "req->dev = VAR_0;", "VAR_3 = mptsas_build_sgl(VAR_0, req, VAR_2);", "if (VAR_3) {", "goto free_bad;", "}", "if (req->qsg.size < VAR_1->DataLength) {", "trace_mptsas_sgl_overflow(VAR_0, VAR_1->MsgContext, VAR_1->DataLength,\nreq->qsg.size);", "VAR_3 = MPI_IOCSTATUS_INVALID_SGL;", "goto free_bad;", "}", "req->sreq = scsi_req_new(sdev, VAR_1->MsgContext,\nVAR_1->LUN[1], VAR_1->CDB, req);", "if (req->sreq->cmd.xfer > VAR_1->DataLength) {", "goto overrun;", "}", "switch (VAR_1->Control & MPI_SCSIIO_CONTROL_DATADIRECTION_MASK) {", "case MPI_SCSIIO_CONTROL_NODATATRANSFER:\nif (req->sreq->cmd.mode != SCSI_XFER_NONE) {", "goto overrun;", "}", "break;", "case MPI_SCSIIO_CONTROL_WRITE:\nif (req->sreq->cmd.mode != SCSI_XFER_TO_DEV) {", "goto overrun;", "}", "break;", "case MPI_SCSIIO_CONTROL_READ:\nif (req->sreq->cmd.mode != SCSI_XFER_FROM_DEV) {", "goto overrun;", "}", "break;", "}", "if (scsi_req_enqueue(req->sreq)) {", "scsi_req_continue(req->sreq);", "}", "return 0;", "overrun:\ntrace_mptsas_scsi_overflow(VAR_0, VAR_1->MsgContext, req->sreq->cmd.xfer,\nVAR_1->DataLength);", "VAR_3 = MPI_IOCSTATUS_SCSI_DATA_OVERRUN;", "free_bad:\nmptsas_free_request(req);", "bad:\nmemset(&reply, 0, sizeof(reply));", "reply.TargetID = VAR_1->TargetID;", "reply.Bus = VAR_1->Bus;", "reply.MsgLength = sizeof(reply) / 4;", "reply.Function = VAR_1->Function;", "reply.CDBLength = VAR_1->CDBLength;", "reply.SenseBufferLength = VAR_1->SenseBufferLength;", "reply.MsgContext = VAR_1->MsgContext;", "reply.SCSIState = MPI_SCSI_STATE_NO_SCSI_STATUS;", "reply.IOCStatus = VAR_3;", "mptsas_fix_scsi_io_reply_endianness(&reply);", "mptsas_reply(VAR_0, (MPIDefaultReply *)&reply);", "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 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 23, 25 ], [ 29, 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63, 65 ], [ 67 ], [ 69 ], [ 71 ], [ 75, 77 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89, 91 ], [ 93 ], [ 95 ], [ 97 ], [ 101, 103 ], [ 105 ], [ 107 ], [ 109 ], [ 113, 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 137, 139, 141 ], [ 143 ], [ 145, 147 ], [ 149, 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 173 ], [ 175 ], [ 179 ], [ 181 ] ]
10,196
bool s390_cpu_exec_interrupt(CPUState *cs, int interrupt_request) { if (interrupt_request & CPU_INTERRUPT_HARD) { S390CPU *cpu = S390_CPU(cs); CPUS390XState *env = &cpu->env; if (env->ex_value) { /* Execution of the target insn is indivisible from the parent EXECUTE insn. */ return false; } if (env->psw.mask & PSW_MASK_EXT) { s390_cpu_do_interrupt(cs); return true; } } return false; }
false
qemu
8417f904bad50021b432dfea12613345d9fb1f68
bool s390_cpu_exec_interrupt(CPUState *cs, int interrupt_request) { if (interrupt_request & CPU_INTERRUPT_HARD) { S390CPU *cpu = S390_CPU(cs); CPUS390XState *env = &cpu->env; if (env->ex_value) { return false; } if (env->psw.mask & PSW_MASK_EXT) { s390_cpu_do_interrupt(cs); return true; } } return false; }
{ "code": [], "line_no": [] }
bool FUNC_0(CPUState *cs, int interrupt_request) { if (interrupt_request & CPU_INTERRUPT_HARD) { S390CPU *cpu = S390_CPU(cs); CPUS390XState *env = &cpu->env; if (env->ex_value) { return false; } if (env->psw.mask & PSW_MASK_EXT) { s390_cpu_do_interrupt(cs); return true; } } return false; }
[ "bool FUNC_0(CPUState *cs, int interrupt_request)\n{", "if (interrupt_request & CPU_INTERRUPT_HARD) {", "S390CPU *cpu = S390_CPU(cs);", "CPUS390XState *env = &cpu->env;", "if (env->ex_value) {", "return false;", "}", "if (env->psw.mask & PSW_MASK_EXT) {", "s390_cpu_do_interrupt(cs);", "return true;", "}", "}", "return false;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ] ]
10,197
ioapic_mem_read(void *opaque, target_phys_addr_t addr, unsigned int size) { IOAPICCommonState *s = opaque; int index; uint32_t val = 0; switch (addr & 0xff) { case IOAPIC_IOREGSEL: val = s->ioregsel; break; case IOAPIC_IOWIN: if (size != 4) { break; } switch (s->ioregsel) { case IOAPIC_REG_ID: val = s->id << IOAPIC_ID_SHIFT; break; case IOAPIC_REG_VER: val = IOAPIC_VERSION | ((IOAPIC_NUM_PINS - 1) << IOAPIC_VER_ENTRIES_SHIFT); break; case IOAPIC_REG_ARB: val = 0; break; default: index = (s->ioregsel - IOAPIC_REG_REDTBL_BASE) >> 1; if (index >= 0 && index < IOAPIC_NUM_PINS) { if (s->ioregsel & 1) { val = s->ioredtbl[index] >> 32; } else { val = s->ioredtbl[index] & 0xffffffff; } } } DPRINTF("read: %08x = %08x\n", s->ioregsel, val); break; } return val; }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
ioapic_mem_read(void *opaque, target_phys_addr_t addr, unsigned int size) { IOAPICCommonState *s = opaque; int index; uint32_t val = 0; switch (addr & 0xff) { case IOAPIC_IOREGSEL: val = s->ioregsel; break; case IOAPIC_IOWIN: if (size != 4) { break; } switch (s->ioregsel) { case IOAPIC_REG_ID: val = s->id << IOAPIC_ID_SHIFT; break; case IOAPIC_REG_VER: val = IOAPIC_VERSION | ((IOAPIC_NUM_PINS - 1) << IOAPIC_VER_ENTRIES_SHIFT); break; case IOAPIC_REG_ARB: val = 0; break; default: index = (s->ioregsel - IOAPIC_REG_REDTBL_BASE) >> 1; if (index >= 0 && index < IOAPIC_NUM_PINS) { if (s->ioregsel & 1) { val = s->ioredtbl[index] >> 32; } else { val = s->ioredtbl[index] & 0xffffffff; } } } DPRINTF("read: %08x = %08x\n", s->ioregsel, val); break; } return val; }
{ "code": [], "line_no": [] }
FUNC_0(void *VAR_0, target_phys_addr_t VAR_1, unsigned int VAR_2) { IOAPICCommonState *s = VAR_0; int VAR_3; uint32_t val = 0; switch (VAR_1 & 0xff) { case IOAPIC_IOREGSEL: val = s->ioregsel; break; case IOAPIC_IOWIN: if (VAR_2 != 4) { break; } switch (s->ioregsel) { case IOAPIC_REG_ID: val = s->id << IOAPIC_ID_SHIFT; break; case IOAPIC_REG_VER: val = IOAPIC_VERSION | ((IOAPIC_NUM_PINS - 1) << IOAPIC_VER_ENTRIES_SHIFT); break; case IOAPIC_REG_ARB: val = 0; break; default: VAR_3 = (s->ioregsel - IOAPIC_REG_REDTBL_BASE) >> 1; if (VAR_3 >= 0 && VAR_3 < IOAPIC_NUM_PINS) { if (s->ioregsel & 1) { val = s->ioredtbl[VAR_3] >> 32; } else { val = s->ioredtbl[VAR_3] & 0xffffffff; } } } DPRINTF("read: %08x = %08x\n", s->ioregsel, val); break; } return val; }
[ "FUNC_0(void *VAR_0, target_phys_addr_t VAR_1, unsigned int VAR_2)\n{", "IOAPICCommonState *s = VAR_0;", "int VAR_3;", "uint32_t val = 0;", "switch (VAR_1 & 0xff) {", "case IOAPIC_IOREGSEL:\nval = s->ioregsel;", "break;", "case IOAPIC_IOWIN:\nif (VAR_2 != 4) {", "break;", "}", "switch (s->ioregsel) {", "case IOAPIC_REG_ID:\nval = s->id << IOAPIC_ID_SHIFT;", "break;", "case IOAPIC_REG_VER:\nval = IOAPIC_VERSION |\n((IOAPIC_NUM_PINS - 1) << IOAPIC_VER_ENTRIES_SHIFT);", "break;", "case IOAPIC_REG_ARB:\nval = 0;", "break;", "default:\nVAR_3 = (s->ioregsel - IOAPIC_REG_REDTBL_BASE) >> 1;", "if (VAR_3 >= 0 && VAR_3 < IOAPIC_NUM_PINS) {", "if (s->ioregsel & 1) {", "val = s->ioredtbl[VAR_3] >> 32;", "} else {", "val = s->ioredtbl[VAR_3] & 0xffffffff;", "}", "}", "}", "DPRINTF(\"read: %08x = %08x\\n\", s->ioregsel, val);", "break;", "}", "return val;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15, 17 ], [ 19 ], [ 21, 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 37, 39, 41 ], [ 43 ], [ 45, 47 ], [ 49 ], [ 51, 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ] ]
10,198
static void piix4_pm_machine_ready(Notifier *n, void *opaque) { PIIX4PMState *s = container_of(n, PIIX4PMState, machine_ready); PCIDevice *d = PCI_DEVICE(s); MemoryRegion *io_as = pci_address_space_io(d); uint8_t *pci_conf; pci_conf = d->config; pci_conf[0x5f] = 0x10 | (memory_region_present(io_as, 0x378) ? 0x80 : 0); pci_conf[0x63] = 0x60; pci_conf[0x67] = (memory_region_present(io_as, 0x3f8) ? 0x08 : 0) | (memory_region_present(io_as, 0x2f8) ? 0x90 : 0); if (s->use_acpi_pci_hotplug) { pci_for_each_bus(d->bus, piix4_update_bus_hotplug, s); } else { piix4_update_bus_hotplug(d->bus, s); } }
false
qemu
fd56e0612b6454a282fa6a953fdb09281a98c589
static void piix4_pm_machine_ready(Notifier *n, void *opaque) { PIIX4PMState *s = container_of(n, PIIX4PMState, machine_ready); PCIDevice *d = PCI_DEVICE(s); MemoryRegion *io_as = pci_address_space_io(d); uint8_t *pci_conf; pci_conf = d->config; pci_conf[0x5f] = 0x10 | (memory_region_present(io_as, 0x378) ? 0x80 : 0); pci_conf[0x63] = 0x60; pci_conf[0x67] = (memory_region_present(io_as, 0x3f8) ? 0x08 : 0) | (memory_region_present(io_as, 0x2f8) ? 0x90 : 0); if (s->use_acpi_pci_hotplug) { pci_for_each_bus(d->bus, piix4_update_bus_hotplug, s); } else { piix4_update_bus_hotplug(d->bus, s); } }
{ "code": [], "line_no": [] }
static void FUNC_0(Notifier *VAR_0, void *VAR_1) { PIIX4PMState *s = container_of(VAR_0, PIIX4PMState, machine_ready); PCIDevice *d = PCI_DEVICE(s); MemoryRegion *io_as = pci_address_space_io(d); uint8_t *pci_conf; pci_conf = d->config; pci_conf[0x5f] = 0x10 | (memory_region_present(io_as, 0x378) ? 0x80 : 0); pci_conf[0x63] = 0x60; pci_conf[0x67] = (memory_region_present(io_as, 0x3f8) ? 0x08 : 0) | (memory_region_present(io_as, 0x2f8) ? 0x90 : 0); if (s->use_acpi_pci_hotplug) { pci_for_each_bus(d->bus, piix4_update_bus_hotplug, s); } else { piix4_update_bus_hotplug(d->bus, s); } }
[ "static void FUNC_0(Notifier *VAR_0, void *VAR_1)\n{", "PIIX4PMState *s = container_of(VAR_0, PIIX4PMState, machine_ready);", "PCIDevice *d = PCI_DEVICE(s);", "MemoryRegion *io_as = pci_address_space_io(d);", "uint8_t *pci_conf;", "pci_conf = d->config;", "pci_conf[0x5f] = 0x10 |\n(memory_region_present(io_as, 0x378) ? 0x80 : 0);", "pci_conf[0x63] = 0x60;", "pci_conf[0x67] = (memory_region_present(io_as, 0x3f8) ? 0x08 : 0) |\n(memory_region_present(io_as, 0x2f8) ? 0x90 : 0);", "if (s->use_acpi_pci_hotplug) {", "pci_for_each_bus(d->bus, piix4_update_bus_hotplug, s);", "} else {", "piix4_update_bus_hotplug(d->bus, s);", "}", "}" ]
[ 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 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ] ]
10,199
static void vnc_dpy_resize(DisplayState *ds) { int size_changed; VncDisplay *vd = ds->opaque; VncState *vs; /* server surface */ if (!vd->server) vd->server = qemu_mallocz(sizeof(*vd->server)); if (vd->server->data) qemu_free(vd->server->data); *(vd->server) = *(ds->surface); vd->server->data = qemu_mallocz(vd->server->linesize * vd->server->height); /* guest surface */ if (!vd->guest.ds) vd->guest.ds = qemu_mallocz(sizeof(*vd->guest.ds)); if (ds_get_bytes_per_pixel(ds) != vd->guest.ds->pf.bytes_per_pixel) console_color_init(ds); size_changed = ds_get_width(ds) != vd->guest.ds->width || ds_get_height(ds) != vd->guest.ds->height; *(vd->guest.ds) = *(ds->surface); memset(vd->guest.dirty, 0xFF, sizeof(vd->guest.dirty)); QTAILQ_FOREACH(vs, &vd->clients, next) { vnc_colordepth(vs); if (size_changed) { vnc_desktop_resize(vs); } if (vs->vd->cursor) { vnc_cursor_define(vs); } memset(vs->dirty, 0xFF, sizeof(vs->dirty)); } }
false
qemu
1d4b638ad1fc273a19d93c7d4725fecdd7e5182a
static void vnc_dpy_resize(DisplayState *ds) { int size_changed; VncDisplay *vd = ds->opaque; VncState *vs; if (!vd->server) vd->server = qemu_mallocz(sizeof(*vd->server)); if (vd->server->data) qemu_free(vd->server->data); *(vd->server) = *(ds->surface); vd->server->data = qemu_mallocz(vd->server->linesize * vd->server->height); if (!vd->guest.ds) vd->guest.ds = qemu_mallocz(sizeof(*vd->guest.ds)); if (ds_get_bytes_per_pixel(ds) != vd->guest.ds->pf.bytes_per_pixel) console_color_init(ds); size_changed = ds_get_width(ds) != vd->guest.ds->width || ds_get_height(ds) != vd->guest.ds->height; *(vd->guest.ds) = *(ds->surface); memset(vd->guest.dirty, 0xFF, sizeof(vd->guest.dirty)); QTAILQ_FOREACH(vs, &vd->clients, next) { vnc_colordepth(vs); if (size_changed) { vnc_desktop_resize(vs); } if (vs->vd->cursor) { vnc_cursor_define(vs); } memset(vs->dirty, 0xFF, sizeof(vs->dirty)); } }
{ "code": [], "line_no": [] }
static void FUNC_0(DisplayState *VAR_0) { int VAR_1; VncDisplay *vd = VAR_0->opaque; VncState *vs; if (!vd->server) vd->server = qemu_mallocz(sizeof(*vd->server)); if (vd->server->data) qemu_free(vd->server->data); *(vd->server) = *(VAR_0->surface); vd->server->data = qemu_mallocz(vd->server->linesize * vd->server->height); if (!vd->guest.VAR_0) vd->guest.VAR_0 = qemu_mallocz(sizeof(*vd->guest.VAR_0)); if (ds_get_bytes_per_pixel(VAR_0) != vd->guest.VAR_0->pf.bytes_per_pixel) console_color_init(VAR_0); VAR_1 = ds_get_width(VAR_0) != vd->guest.VAR_0->width || ds_get_height(VAR_0) != vd->guest.VAR_0->height; *(vd->guest.VAR_0) = *(VAR_0->surface); memset(vd->guest.dirty, 0xFF, sizeof(vd->guest.dirty)); QTAILQ_FOREACH(vs, &vd->clients, next) { vnc_colordepth(vs); if (VAR_1) { vnc_desktop_resize(vs); } if (vs->vd->cursor) { vnc_cursor_define(vs); } memset(vs->dirty, 0xFF, sizeof(vs->dirty)); } }
[ "static void FUNC_0(DisplayState *VAR_0)\n{", "int VAR_1;", "VncDisplay *vd = VAR_0->opaque;", "VncState *vs;", "if (!vd->server)\nvd->server = qemu_mallocz(sizeof(*vd->server));", "if (vd->server->data)\nqemu_free(vd->server->data);", "*(vd->server) = *(VAR_0->surface);", "vd->server->data = qemu_mallocz(vd->server->linesize *\nvd->server->height);", "if (!vd->guest.VAR_0)\nvd->guest.VAR_0 = qemu_mallocz(sizeof(*vd->guest.VAR_0));", "if (ds_get_bytes_per_pixel(VAR_0) != vd->guest.VAR_0->pf.bytes_per_pixel)\nconsole_color_init(VAR_0);", "VAR_1 = ds_get_width(VAR_0) != vd->guest.VAR_0->width ||\nds_get_height(VAR_0) != vd->guest.VAR_0->height;", "*(vd->guest.VAR_0) = *(VAR_0->surface);", "memset(vd->guest.dirty, 0xFF, sizeof(vd->guest.dirty));", "QTAILQ_FOREACH(vs, &vd->clients, next) {", "vnc_colordepth(vs);", "if (VAR_1) {", "vnc_desktop_resize(vs);", "}", "if (vs->vd->cursor) {", "vnc_cursor_define(vs);", "}", "memset(vs->dirty, 0xFF, sizeof(vs->dirty));", "}", "}" ]
[ 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 ], [ 15, 17 ], [ 19, 21 ], [ 23 ], [ 25, 27 ], [ 33, 35 ], [ 37, 39 ], [ 41, 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ] ]
10,200
bool hpet_find(void) { return object_resolve_path_type("", TYPE_HPET, NULL); }
false
qemu
142e0950cfaf023a81112dc3cdfa799d769886a4
bool hpet_find(void) { return object_resolve_path_type("", TYPE_HPET, NULL); }
{ "code": [], "line_no": [] }
bool FUNC_0(void) { return object_resolve_path_type("", TYPE_HPET, NULL); }
[ "bool FUNC_0(void)\n{", "return object_resolve_path_type(\"\", TYPE_HPET, NULL);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
10,201
static void gen_load_exclusive(DisasContext *s, int rt, int rt2, TCGv_i32 addr, int size) { TCGv_i32 tmp = tcg_temp_new_i32(); s->is_ldex = true; switch (size) { case 0: gen_aa32_ld8u(tmp, addr, get_mem_index(s)); break; case 1: gen_aa32_ld16u(tmp, addr, get_mem_index(s)); break; case 2: case 3: gen_aa32_ld32u(tmp, addr, get_mem_index(s)); break; default: abort(); } if (size == 3) { TCGv_i32 tmp2 = tcg_temp_new_i32(); TCGv_i32 tmp3 = tcg_temp_new_i32(); tcg_gen_addi_i32(tmp2, addr, 4); gen_aa32_ld32u(tmp3, tmp2, get_mem_index(s)); tcg_temp_free_i32(tmp2); tcg_gen_concat_i32_i64(cpu_exclusive_val, tmp, tmp3); store_reg(s, rt2, tmp3); } else { tcg_gen_extu_i32_i64(cpu_exclusive_val, tmp); } store_reg(s, rt, tmp); tcg_gen_extu_i32_i64(cpu_exclusive_addr, addr); }
false
qemu
30901475b91ef1f46304404ab4bfe89097f61b96
static void gen_load_exclusive(DisasContext *s, int rt, int rt2, TCGv_i32 addr, int size) { TCGv_i32 tmp = tcg_temp_new_i32(); s->is_ldex = true; switch (size) { case 0: gen_aa32_ld8u(tmp, addr, get_mem_index(s)); break; case 1: gen_aa32_ld16u(tmp, addr, get_mem_index(s)); break; case 2: case 3: gen_aa32_ld32u(tmp, addr, get_mem_index(s)); break; default: abort(); } if (size == 3) { TCGv_i32 tmp2 = tcg_temp_new_i32(); TCGv_i32 tmp3 = tcg_temp_new_i32(); tcg_gen_addi_i32(tmp2, addr, 4); gen_aa32_ld32u(tmp3, tmp2, get_mem_index(s)); tcg_temp_free_i32(tmp2); tcg_gen_concat_i32_i64(cpu_exclusive_val, tmp, tmp3); store_reg(s, rt2, tmp3); } else { tcg_gen_extu_i32_i64(cpu_exclusive_val, tmp); } store_reg(s, rt, tmp); tcg_gen_extu_i32_i64(cpu_exclusive_addr, addr); }
{ "code": [], "line_no": [] }
static void FUNC_0(DisasContext *VAR_0, int VAR_1, int VAR_2, TCGv_i32 VAR_3, int VAR_4) { TCGv_i32 tmp = tcg_temp_new_i32(); VAR_0->is_ldex = true; switch (VAR_4) { case 0: gen_aa32_ld8u(tmp, VAR_3, get_mem_index(VAR_0)); break; case 1: gen_aa32_ld16u(tmp, VAR_3, get_mem_index(VAR_0)); break; case 2: case 3: gen_aa32_ld32u(tmp, VAR_3, get_mem_index(VAR_0)); break; default: abort(); } if (VAR_4 == 3) { TCGv_i32 tmp2 = tcg_temp_new_i32(); TCGv_i32 tmp3 = tcg_temp_new_i32(); tcg_gen_addi_i32(tmp2, VAR_3, 4); gen_aa32_ld32u(tmp3, tmp2, get_mem_index(VAR_0)); tcg_temp_free_i32(tmp2); tcg_gen_concat_i32_i64(cpu_exclusive_val, tmp, tmp3); store_reg(VAR_0, VAR_2, tmp3); } else { tcg_gen_extu_i32_i64(cpu_exclusive_val, tmp); } store_reg(VAR_0, VAR_1, tmp); tcg_gen_extu_i32_i64(cpu_exclusive_addr, VAR_3); }
[ "static void FUNC_0(DisasContext *VAR_0, int VAR_1, int VAR_2,\nTCGv_i32 VAR_3, int VAR_4)\n{", "TCGv_i32 tmp = tcg_temp_new_i32();", "VAR_0->is_ldex = true;", "switch (VAR_4) {", "case 0:\ngen_aa32_ld8u(tmp, VAR_3, get_mem_index(VAR_0));", "break;", "case 1:\ngen_aa32_ld16u(tmp, VAR_3, get_mem_index(VAR_0));", "break;", "case 2:\ncase 3:\ngen_aa32_ld32u(tmp, VAR_3, get_mem_index(VAR_0));", "break;", "default:\nabort();", "}", "if (VAR_4 == 3) {", "TCGv_i32 tmp2 = tcg_temp_new_i32();", "TCGv_i32 tmp3 = tcg_temp_new_i32();", "tcg_gen_addi_i32(tmp2, VAR_3, 4);", "gen_aa32_ld32u(tmp3, tmp2, get_mem_index(VAR_0));", "tcg_temp_free_i32(tmp2);", "tcg_gen_concat_i32_i64(cpu_exclusive_val, tmp, tmp3);", "store_reg(VAR_0, VAR_2, tmp3);", "} else {", "tcg_gen_extu_i32_i64(cpu_exclusive_val, tmp);", "}", "store_reg(VAR_0, VAR_1, tmp);", "tcg_gen_extu_i32_i64(cpu_exclusive_addr, 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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 15 ], [ 17, 19 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 29, 31, 33 ], [ 35 ], [ 37, 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ] ]
10,202
static inline void RENAME(bgr24ToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, long width, uint32_t *unused) { #if COMPILE_TEMPLATE_MMX RENAME(bgr24ToUV_mmx)(dstU, dstV, src1, width, PIX_FMT_BGR24); #else int i; for (i=0; i<width; i++) { int b= src1[3*i + 0]; int g= src1[3*i + 1]; int r= src1[3*i + 2]; dstU[i]= (RU*r + GU*g + BU*b + (257<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT; dstV[i]= (RV*r + GV*g + BV*b + (257<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT; } #endif /* COMPILE_TEMPLATE_MMX */ assert(src1 == src2); }
false
FFmpeg
d1adad3cca407f493c3637e20ecd4f7124e69212
static inline void RENAME(bgr24ToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, long width, uint32_t *unused) { #if COMPILE_TEMPLATE_MMX RENAME(bgr24ToUV_mmx)(dstU, dstV, src1, width, PIX_FMT_BGR24); #else int i; for (i=0; i<width; i++) { int b= src1[3*i + 0]; int g= src1[3*i + 1]; int r= src1[3*i + 2]; dstU[i]= (RU*r + GU*g + BU*b + (257<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT; dstV[i]= (RV*r + GV*g + BV*b + (257<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT; } #endif assert(src1 == src2); }
{ "code": [], "line_no": [] }
static inline void FUNC_0(bgr24ToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, long width, uint32_t *unused) { #if COMPILE_TEMPLATE_MMX FUNC_0(bgr24ToUV_mmx)(dstU, dstV, src1, width, PIX_FMT_BGR24); #else int VAR_0; for (VAR_0=0; VAR_0<width; VAR_0++) { int b= src1[3*VAR_0 + 0]; int g= src1[3*VAR_0 + 1]; int r= src1[3*VAR_0 + 2]; dstU[VAR_0]= (RU*r + GU*g + BU*b + (257<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT; dstV[VAR_0]= (RV*r + GV*g + BV*b + (257<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT; } #endif assert(src1 == src2); }
[ "static inline void FUNC_0(bgr24ToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, long width, uint32_t *unused)\n{", "#if COMPILE_TEMPLATE_MMX\nFUNC_0(bgr24ToUV_mmx)(dstU, dstV, src1, width, PIX_FMT_BGR24);", "#else\nint VAR_0;", "for (VAR_0=0; VAR_0<width; VAR_0++) {", "int b= src1[3*VAR_0 + 0];", "int g= src1[3*VAR_0 + 1];", "int r= src1[3*VAR_0 + 2];", "dstU[VAR_0]= (RU*r + GU*g + BU*b + (257<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT;", "dstV[VAR_0]= (RV*r + GV*g + BV*b + (257<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT;", "}", "#endif\nassert(src1 == src2);", "}" ]
[ 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 ] ]