id
int32
0
27.3k
func
stringlengths
26
142k
target
bool
2 classes
project
stringclasses
2 values
commit_id
stringlengths
40
40
func_clean
stringlengths
26
131k
vul_lines
dict
normalized_func
stringlengths
24
132k
lines
sequencelengths
1
2.8k
label
sequencelengths
1
2.8k
line_no
sequencelengths
1
2.8k
4,545
static void isa_mmio_writeb (void *opaque, target_phys_addr_t addr, uint32_t val) { cpu_outb(addr & IOPORTS_MASK, val); }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static void isa_mmio_writeb (void *opaque, target_phys_addr_t addr, uint32_t val) { cpu_outb(addr & IOPORTS_MASK, val); }
{ "code": [], "line_no": [] }
static void FUNC_0 (void *VAR_0, target_phys_addr_t VAR_1, uint32_t VAR_2) { cpu_outb(VAR_1 & IOPORTS_MASK, VAR_2); }
[ "static void FUNC_0 (void *VAR_0, target_phys_addr_t VAR_1,\nuint32_t VAR_2)\n{", "cpu_outb(VAR_1 & IOPORTS_MASK, VAR_2);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ] ]
4,546
static void kill_channel(DBDMA_channel *ch) { DBDMA_DPRINTF("kill_channel\n"); ch->regs[DBDMA_STATUS] |= cpu_to_be32(DEAD); ch->regs[DBDMA_STATUS] &= cpu_to_be32(~ACTIVE); qemu_irq_raise(ch->irq); }
false
qemu
ad674e53b5cce265fadafbde2c6a4f190345cd00
static void kill_channel(DBDMA_channel *ch) { DBDMA_DPRINTF("kill_channel\n"); ch->regs[DBDMA_STATUS] |= cpu_to_be32(DEAD); ch->regs[DBDMA_STATUS] &= cpu_to_be32(~ACTIVE); qemu_irq_raise(ch->irq); }
{ "code": [], "line_no": [] }
static void FUNC_0(DBDMA_channel *VAR_0) { DBDMA_DPRINTF("FUNC_0\n"); VAR_0->regs[DBDMA_STATUS] |= cpu_to_be32(DEAD); VAR_0->regs[DBDMA_STATUS] &= cpu_to_be32(~ACTIVE); qemu_irq_raise(VAR_0->irq); }
[ "static void FUNC_0(DBDMA_channel *VAR_0)\n{", "DBDMA_DPRINTF(\"FUNC_0\\n\");", "VAR_0->regs[DBDMA_STATUS] |= cpu_to_be32(DEAD);", "VAR_0->regs[DBDMA_STATUS] &= cpu_to_be32(~ACTIVE);", "qemu_irq_raise(VAR_0->irq);", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ] ]
4,547
static void scsi_do_read(SCSIDiskReq *r, int ret) { SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev); SCSIDiskClass *sdc = (SCSIDiskClass *) object_get_class(OBJECT(s)); assert (r->req.aiocb == NULL); if (r->req.io_canceled) { scsi_req_cancel_complete(&r->req); goto done; } if (ret < 0) { if (scsi_handle_rw_error(r, -ret, false)) { goto done; } } /* The request is used as the AIO opaque value, so add a ref. */ scsi_req_ref(&r->req); if (r->req.sg) { dma_acct_start(s->qdev.conf.blk, &r->acct, r->req.sg, BLOCK_ACCT_READ); r->req.resid -= r->req.sg->size; r->req.aiocb = dma_blk_io(blk_get_aio_context(s->qdev.conf.blk), r->req.sg, r->sector << BDRV_SECTOR_BITS, sdc->dma_readv, r, scsi_dma_complete, r, DMA_DIRECTION_FROM_DEVICE); } else { scsi_init_iovec(r, SCSI_DMA_BUF_SIZE); block_acct_start(blk_get_stats(s->qdev.conf.blk), &r->acct, r->qiov.size, BLOCK_ACCT_READ); r->req.aiocb = sdc->dma_readv(r->sector, &r->qiov, scsi_read_complete, r, r); } done: scsi_req_unref(&r->req); }
false
qemu
5b956f415a356449a4171d5e0c7d9a25bbc84b5a
static void scsi_do_read(SCSIDiskReq *r, int ret) { SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev); SCSIDiskClass *sdc = (SCSIDiskClass *) object_get_class(OBJECT(s)); assert (r->req.aiocb == NULL); if (r->req.io_canceled) { scsi_req_cancel_complete(&r->req); goto done; } if (ret < 0) { if (scsi_handle_rw_error(r, -ret, false)) { goto done; } } scsi_req_ref(&r->req); if (r->req.sg) { dma_acct_start(s->qdev.conf.blk, &r->acct, r->req.sg, BLOCK_ACCT_READ); r->req.resid -= r->req.sg->size; r->req.aiocb = dma_blk_io(blk_get_aio_context(s->qdev.conf.blk), r->req.sg, r->sector << BDRV_SECTOR_BITS, sdc->dma_readv, r, scsi_dma_complete, r, DMA_DIRECTION_FROM_DEVICE); } else { scsi_init_iovec(r, SCSI_DMA_BUF_SIZE); block_acct_start(blk_get_stats(s->qdev.conf.blk), &r->acct, r->qiov.size, BLOCK_ACCT_READ); r->req.aiocb = sdc->dma_readv(r->sector, &r->qiov, scsi_read_complete, r, r); } done: scsi_req_unref(&r->req); }
{ "code": [], "line_no": [] }
static void FUNC_0(SCSIDiskReq *VAR_0, int VAR_1) { SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, VAR_0->req.dev); SCSIDiskClass *sdc = (SCSIDiskClass *) object_get_class(OBJECT(s)); assert (VAR_0->req.aiocb == NULL); if (VAR_0->req.io_canceled) { scsi_req_cancel_complete(&VAR_0->req); goto done; } if (VAR_1 < 0) { if (scsi_handle_rw_error(VAR_0, -VAR_1, false)) { goto done; } } scsi_req_ref(&VAR_0->req); if (VAR_0->req.sg) { dma_acct_start(s->qdev.conf.blk, &VAR_0->acct, VAR_0->req.sg, BLOCK_ACCT_READ); VAR_0->req.resid -= VAR_0->req.sg->size; VAR_0->req.aiocb = dma_blk_io(blk_get_aio_context(s->qdev.conf.blk), VAR_0->req.sg, VAR_0->sector << BDRV_SECTOR_BITS, sdc->dma_readv, VAR_0, scsi_dma_complete, VAR_0, DMA_DIRECTION_FROM_DEVICE); } else { scsi_init_iovec(VAR_0, SCSI_DMA_BUF_SIZE); block_acct_start(blk_get_stats(s->qdev.conf.blk), &VAR_0->acct, VAR_0->qiov.size, BLOCK_ACCT_READ); VAR_0->req.aiocb = sdc->dma_readv(VAR_0->sector, &VAR_0->qiov, scsi_read_complete, VAR_0, VAR_0); } done: scsi_req_unref(&VAR_0->req); }
[ "static void FUNC_0(SCSIDiskReq *VAR_0, int VAR_1)\n{", "SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, VAR_0->req.dev);", "SCSIDiskClass *sdc = (SCSIDiskClass *) object_get_class(OBJECT(s));", "assert (VAR_0->req.aiocb == NULL);", "if (VAR_0->req.io_canceled) {", "scsi_req_cancel_complete(&VAR_0->req);", "goto done;", "}", "if (VAR_1 < 0) {", "if (scsi_handle_rw_error(VAR_0, -VAR_1, false)) {", "goto done;", "}", "}", "scsi_req_ref(&VAR_0->req);", "if (VAR_0->req.sg) {", "dma_acct_start(s->qdev.conf.blk, &VAR_0->acct, VAR_0->req.sg, BLOCK_ACCT_READ);", "VAR_0->req.resid -= VAR_0->req.sg->size;", "VAR_0->req.aiocb = dma_blk_io(blk_get_aio_context(s->qdev.conf.blk),\nVAR_0->req.sg, VAR_0->sector << BDRV_SECTOR_BITS,\nsdc->dma_readv, VAR_0, scsi_dma_complete, VAR_0,\nDMA_DIRECTION_FROM_DEVICE);", "} else {", "scsi_init_iovec(VAR_0, SCSI_DMA_BUF_SIZE);", "block_acct_start(blk_get_stats(s->qdev.conf.blk), &VAR_0->acct,\nVAR_0->qiov.size, BLOCK_ACCT_READ);", "VAR_0->req.aiocb = sdc->dma_readv(VAR_0->sector, &VAR_0->qiov,\nscsi_read_complete, VAR_0, VAR_0);", "}", "done:\nscsi_req_unref(&VAR_0->req);", "}" ]
[ 0, 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 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49, 51, 53, 55 ], [ 57 ], [ 59 ], [ 61, 63 ], [ 65, 67 ], [ 69 ], [ 73, 75 ], [ 77 ] ]
4,548
static inline void _cpu_ppc_store_hdecr(PowerPCCPU *cpu, uint32_t hdecr, uint32_t value, int is_excp) { ppc_tb_t *tb_env = cpu->env.tb_env; if (tb_env->hdecr_timer != NULL) { __cpu_ppc_store_decr(cpu, &tb_env->hdecr_next, tb_env->hdecr_timer, &cpu_ppc_hdecr_excp, hdecr, value, is_excp); } }
false
qemu
e81a982aa5398269a2cc344091ffa4930bdd242f
static inline void _cpu_ppc_store_hdecr(PowerPCCPU *cpu, uint32_t hdecr, uint32_t value, int is_excp) { ppc_tb_t *tb_env = cpu->env.tb_env; if (tb_env->hdecr_timer != NULL) { __cpu_ppc_store_decr(cpu, &tb_env->hdecr_next, tb_env->hdecr_timer, &cpu_ppc_hdecr_excp, hdecr, value, is_excp); } }
{ "code": [], "line_no": [] }
static inline void FUNC_0(PowerPCCPU *VAR_0, uint32_t VAR_1, uint32_t VAR_2, int VAR_3) { ppc_tb_t *tb_env = VAR_0->env.tb_env; if (tb_env->hdecr_timer != NULL) { __cpu_ppc_store_decr(VAR_0, &tb_env->hdecr_next, tb_env->hdecr_timer, &cpu_ppc_hdecr_excp, VAR_1, VAR_2, VAR_3); } }
[ "static inline void FUNC_0(PowerPCCPU *VAR_0, uint32_t VAR_1,\nuint32_t VAR_2, int VAR_3)\n{", "ppc_tb_t *tb_env = VAR_0->env.tb_env;", "if (tb_env->hdecr_timer != NULL) {", "__cpu_ppc_store_decr(VAR_0, &tb_env->hdecr_next, tb_env->hdecr_timer,\n&cpu_ppc_hdecr_excp, VAR_1, VAR_2, VAR_3);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13, 15 ], [ 17 ], [ 19 ] ]
4,549
static void readline_printf_func(void *opaque, const char *fmt, ...) { va_list ap; va_start(ap, fmt); vprintf(fmt, ap); va_end(ap); }
false
qemu
d5d1507b347b7cd6c3b82459b96f1889b29939ef
static void readline_printf_func(void *opaque, const char *fmt, ...) { va_list ap; va_start(ap, fmt); vprintf(fmt, ap); va_end(ap); }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, const char *VAR_1, ...) { va_list ap; va_start(ap, VAR_1); vprintf(VAR_1, ap); va_end(ap); }
[ "static void FUNC_0(void *VAR_0, const char *VAR_1, ...)\n{", "va_list ap;", "va_start(ap, VAR_1);", "vprintf(VAR_1, ap);", "va_end(ap);", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ] ]
4,550
static ssize_t virtio_net_receive(VLANClientState *vc, const uint8_t *buf, size_t size) { VirtIONet *n = vc->opaque; struct virtio_net_hdr_mrg_rxbuf *mhdr = NULL; size_t hdr_len, offset, i; if (!do_virtio_net_can_receive(n, size)) return 0; if (!receive_filter(n, buf, size)) return size; /* hdr_len refers to the header we supply to the guest */ hdr_len = n->mergeable_rx_bufs ? sizeof(struct virtio_net_hdr_mrg_rxbuf) : sizeof(struct virtio_net_hdr); offset = i = 0; while (offset < size) { VirtQueueElement elem; int len, total; struct iovec sg[VIRTQUEUE_MAX_SIZE]; len = total = 0; if ((i != 0 && !n->mergeable_rx_bufs) || virtqueue_pop(n->rx_vq, &elem) == 0) { if (i == 0) return -1; fprintf(stderr, "virtio-net truncating packet\n"); exit(1); } if (elem.in_num < 1) { fprintf(stderr, "virtio-net receive queue contains no in buffers\n"); exit(1); } if (!n->mergeable_rx_bufs && elem.in_sg[0].iov_len != hdr_len) { fprintf(stderr, "virtio-net header not in first element\n"); exit(1); } memcpy(&sg, &elem.in_sg[0], sizeof(sg[0]) * elem.in_num); if (i == 0) { if (n->mergeable_rx_bufs) mhdr = (struct virtio_net_hdr_mrg_rxbuf *)sg[0].iov_base; offset += receive_header(n, sg, elem.in_num, buf + offset, size - offset, hdr_len); total += hdr_len; } /* copy in packet. ugh */ len = iov_fill(sg, elem.in_num, buf + offset, size - offset); total += len; /* signal other side */ virtqueue_fill(n->rx_vq, &elem, total, i++); offset += len; } if (mhdr) mhdr->num_buffers = i; virtqueue_flush(n->rx_vq, i); virtio_notify(&n->vdev, n->rx_vq); return size; }
false
qemu
cdd5cc12ba8cf0c068da319370bdd3ba45eaf7ac
static ssize_t virtio_net_receive(VLANClientState *vc, const uint8_t *buf, size_t size) { VirtIONet *n = vc->opaque; struct virtio_net_hdr_mrg_rxbuf *mhdr = NULL; size_t hdr_len, offset, i; if (!do_virtio_net_can_receive(n, size)) return 0; if (!receive_filter(n, buf, size)) return size; hdr_len = n->mergeable_rx_bufs ? sizeof(struct virtio_net_hdr_mrg_rxbuf) : sizeof(struct virtio_net_hdr); offset = i = 0; while (offset < size) { VirtQueueElement elem; int len, total; struct iovec sg[VIRTQUEUE_MAX_SIZE]; len = total = 0; if ((i != 0 && !n->mergeable_rx_bufs) || virtqueue_pop(n->rx_vq, &elem) == 0) { if (i == 0) return -1; fprintf(stderr, "virtio-net truncating packet\n"); exit(1); } if (elem.in_num < 1) { fprintf(stderr, "virtio-net receive queue contains no in buffers\n"); exit(1); } if (!n->mergeable_rx_bufs && elem.in_sg[0].iov_len != hdr_len) { fprintf(stderr, "virtio-net header not in first element\n"); exit(1); } memcpy(&sg, &elem.in_sg[0], sizeof(sg[0]) * elem.in_num); if (i == 0) { if (n->mergeable_rx_bufs) mhdr = (struct virtio_net_hdr_mrg_rxbuf *)sg[0].iov_base; offset += receive_header(n, sg, elem.in_num, buf + offset, size - offset, hdr_len); total += hdr_len; } len = iov_fill(sg, elem.in_num, buf + offset, size - offset); total += len; virtqueue_fill(n->rx_vq, &elem, total, i++); offset += len; } if (mhdr) mhdr->num_buffers = i; virtqueue_flush(n->rx_vq, i); virtio_notify(&n->vdev, n->rx_vq); return size; }
{ "code": [], "line_no": [] }
static ssize_t FUNC_0(VLANClientState *vc, const uint8_t *buf, size_t size) { VirtIONet *n = vc->opaque; struct virtio_net_hdr_mrg_rxbuf *VAR_0 = NULL; size_t hdr_len, offset, i; if (!do_virtio_net_can_receive(n, size)) return 0; if (!receive_filter(n, buf, size)) return size; hdr_len = n->mergeable_rx_bufs ? sizeof(struct virtio_net_hdr_mrg_rxbuf) : sizeof(struct virtio_net_hdr); offset = i = 0; while (offset < size) { VirtQueueElement elem; int VAR_1, VAR_2; struct iovec VAR_3[VIRTQUEUE_MAX_SIZE]; VAR_1 = VAR_2 = 0; if ((i != 0 && !n->mergeable_rx_bufs) || virtqueue_pop(n->rx_vq, &elem) == 0) { if (i == 0) return -1; fprintf(stderr, "virtio-net truncating packet\n"); exit(1); } if (elem.in_num < 1) { fprintf(stderr, "virtio-net receive queue contains no in buffers\n"); exit(1); } if (!n->mergeable_rx_bufs && elem.in_sg[0].iov_len != hdr_len) { fprintf(stderr, "virtio-net header not in first element\n"); exit(1); } memcpy(&VAR_3, &elem.in_sg[0], sizeof(VAR_3[0]) * elem.in_num); if (i == 0) { if (n->mergeable_rx_bufs) VAR_0 = (struct virtio_net_hdr_mrg_rxbuf *)VAR_3[0].iov_base; offset += receive_header(n, VAR_3, elem.in_num, buf + offset, size - offset, hdr_len); VAR_2 += hdr_len; } VAR_1 = iov_fill(VAR_3, elem.in_num, buf + offset, size - offset); VAR_2 += VAR_1; virtqueue_fill(n->rx_vq, &elem, VAR_2, i++); offset += VAR_1; } if (VAR_0) VAR_0->num_buffers = i; virtqueue_flush(n->rx_vq, i); virtio_notify(&n->vdev, n->rx_vq); return size; }
[ "static ssize_t FUNC_0(VLANClientState *vc, const uint8_t *buf, size_t size)\n{", "VirtIONet *n = vc->opaque;", "struct virtio_net_hdr_mrg_rxbuf *VAR_0 = NULL;", "size_t hdr_len, offset, i;", "if (!do_virtio_net_can_receive(n, size))\nreturn 0;", "if (!receive_filter(n, buf, size))\nreturn size;", "hdr_len = n->mergeable_rx_bufs ?\nsizeof(struct virtio_net_hdr_mrg_rxbuf) : sizeof(struct virtio_net_hdr);", "offset = i = 0;", "while (offset < size) {", "VirtQueueElement elem;", "int VAR_1, VAR_2;", "struct iovec VAR_3[VIRTQUEUE_MAX_SIZE];", "VAR_1 = VAR_2 = 0;", "if ((i != 0 && !n->mergeable_rx_bufs) ||\nvirtqueue_pop(n->rx_vq, &elem) == 0) {", "if (i == 0)\nreturn -1;", "fprintf(stderr, \"virtio-net truncating packet\\n\");", "exit(1);", "}", "if (elem.in_num < 1) {", "fprintf(stderr, \"virtio-net receive queue contains no in buffers\\n\");", "exit(1);", "}", "if (!n->mergeable_rx_bufs && elem.in_sg[0].iov_len != hdr_len) {", "fprintf(stderr, \"virtio-net header not in first element\\n\");", "exit(1);", "}", "memcpy(&VAR_3, &elem.in_sg[0], sizeof(VAR_3[0]) * elem.in_num);", "if (i == 0) {", "if (n->mergeable_rx_bufs)\nVAR_0 = (struct virtio_net_hdr_mrg_rxbuf *)VAR_3[0].iov_base;", "offset += receive_header(n, VAR_3, elem.in_num,\nbuf + offset, size - offset, hdr_len);", "VAR_2 += hdr_len;", "}", "VAR_1 = iov_fill(VAR_3, elem.in_num,\nbuf + offset, size - offset);", "VAR_2 += VAR_1;", "virtqueue_fill(n->rx_vq, &elem, VAR_2, i++);", "offset += VAR_1;", "}", "if (VAR_0)\nVAR_0->num_buffers = i;", "virtqueue_flush(n->rx_vq, i);", "virtio_notify(&n->vdev, n->rx_vq);", "return size;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 27, 29 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 51, 53 ], [ 55, 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 87 ], [ 91 ], [ 93, 95 ], [ 99, 101 ], [ 103 ], [ 105 ], [ 111, 113 ], [ 115 ], [ 121 ], [ 125 ], [ 127 ], [ 131, 133 ], [ 137 ], [ 139 ], [ 143 ], [ 145 ] ]
4,552
static CharDriverState *text_console_init(ChardevVC *vc, Error **errp) { CharDriverState *chr; QemuConsole *s; unsigned width = 0; unsigned height = 0; chr = qemu_chr_alloc(); if (vc->has_width) { width = vc->width; } else if (vc->has_cols) { width = vc->cols * FONT_WIDTH; } if (vc->has_height) { height = vc->height; } else if (vc->has_rows) { height = vc->rows * FONT_HEIGHT; } trace_console_txt_new(width, height); if (width == 0 || height == 0) { s = new_console(NULL, TEXT_CONSOLE, 0); } else { s = new_console(NULL, TEXT_CONSOLE_FIXED_SIZE, 0); s->surface = qemu_create_displaysurface(width, height); } if (!s) { g_free(chr); error_setg(errp, "cannot create text console"); return NULL; } s->chr = chr; chr->opaque = s; chr->chr_set_echo = text_console_set_echo; /* console/chardev init sometimes completes elsewhere in a 2nd * stage, so defer OPENED events until they are fully initialized */ chr->explicit_be_open = true; if (display_state) { text_console_do_init(chr, display_state); } return chr; }
false
qemu
d0d7708ba29cbcc343364a46bff981e0ff88366f
static CharDriverState *text_console_init(ChardevVC *vc, Error **errp) { CharDriverState *chr; QemuConsole *s; unsigned width = 0; unsigned height = 0; chr = qemu_chr_alloc(); if (vc->has_width) { width = vc->width; } else if (vc->has_cols) { width = vc->cols * FONT_WIDTH; } if (vc->has_height) { height = vc->height; } else if (vc->has_rows) { height = vc->rows * FONT_HEIGHT; } trace_console_txt_new(width, height); if (width == 0 || height == 0) { s = new_console(NULL, TEXT_CONSOLE, 0); } else { s = new_console(NULL, TEXT_CONSOLE_FIXED_SIZE, 0); s->surface = qemu_create_displaysurface(width, height); } if (!s) { g_free(chr); error_setg(errp, "cannot create text console"); return NULL; } s->chr = chr; chr->opaque = s; chr->chr_set_echo = text_console_set_echo; chr->explicit_be_open = true; if (display_state) { text_console_do_init(chr, display_state); } return chr; }
{ "code": [], "line_no": [] }
static CharDriverState *FUNC_0(ChardevVC *vc, Error **errp) { CharDriverState *chr; QemuConsole *s; unsigned VAR_0 = 0; unsigned VAR_1 = 0; chr = qemu_chr_alloc(); if (vc->has_width) { VAR_0 = vc->VAR_0; } else if (vc->has_cols) { VAR_0 = vc->cols * FONT_WIDTH; } if (vc->has_height) { VAR_1 = vc->VAR_1; } else if (vc->has_rows) { VAR_1 = vc->rows * FONT_HEIGHT; } trace_console_txt_new(VAR_0, VAR_1); if (VAR_0 == 0 || VAR_1 == 0) { s = new_console(NULL, TEXT_CONSOLE, 0); } else { s = new_console(NULL, TEXT_CONSOLE_FIXED_SIZE, 0); s->surface = qemu_create_displaysurface(VAR_0, VAR_1); } if (!s) { g_free(chr); error_setg(errp, "cannot create text console"); return NULL; } s->chr = chr; chr->opaque = s; chr->chr_set_echo = text_console_set_echo; chr->explicit_be_open = true; if (display_state) { text_console_do_init(chr, display_state); } return chr; }
[ "static CharDriverState *FUNC_0(ChardevVC *vc, Error **errp)\n{", "CharDriverState *chr;", "QemuConsole *s;", "unsigned VAR_0 = 0;", "unsigned VAR_1 = 0;", "chr = qemu_chr_alloc();", "if (vc->has_width) {", "VAR_0 = vc->VAR_0;", "} else if (vc->has_cols) {", "VAR_0 = vc->cols * FONT_WIDTH;", "}", "if (vc->has_height) {", "VAR_1 = vc->VAR_1;", "} else if (vc->has_rows) {", "VAR_1 = vc->rows * FONT_HEIGHT;", "}", "trace_console_txt_new(VAR_0, VAR_1);", "if (VAR_0 == 0 || VAR_1 == 0) {", "s = new_console(NULL, TEXT_CONSOLE, 0);", "} else {", "s = new_console(NULL, TEXT_CONSOLE_FIXED_SIZE, 0);", "s->surface = qemu_create_displaysurface(VAR_0, VAR_1);", "}", "if (!s) {", "g_free(chr);", "error_setg(errp, \"cannot create text console\");", "return NULL;", "}", "s->chr = chr;", "chr->opaque = s;", "chr->chr_set_echo = text_console_set_echo;", "chr->explicit_be_open = true;", "if (display_state) {", "text_console_do_init(chr, display_state);", "}", "return chr;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 83 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ] ]
4,553
static int vhdx_log_flush(BlockDriverState *bs, BDRVVHDXState *s, VHDXLogSequence *logs) { int ret = 0; int i; uint32_t cnt, sectors_read; uint64_t new_file_size; void *data = NULL; int64_t file_length; VHDXLogDescEntries *desc_entries = NULL; VHDXLogEntryHeader hdr_tmp = { 0 }; cnt = logs->count; data = qemu_blockalign(bs, VHDX_LOG_SECTOR_SIZE); ret = vhdx_user_visible_write(bs, s); if (ret < 0) { goto exit; } /* each iteration represents one log sequence, which may span multiple * sectors */ while (cnt--) { ret = vhdx_log_peek_hdr(bs, &logs->log, &hdr_tmp); if (ret < 0) { goto exit; } file_length = bdrv_getlength(bs->file->bs); if (file_length < 0) { ret = file_length; goto exit; } /* if the log shows a FlushedFileOffset larger than our current file * size, then that means the file has been truncated / corrupted, and * we must refused to open it / use it */ if (hdr_tmp.flushed_file_offset > file_length) { ret = -EINVAL; goto exit; } ret = vhdx_log_read_desc(bs, s, &logs->log, &desc_entries, true); if (ret < 0) { goto exit; } for (i = 0; i < desc_entries->hdr.descriptor_count; i++) { if (desc_entries->desc[i].signature == VHDX_LOG_DESC_SIGNATURE) { /* data sector, so read a sector to flush */ ret = vhdx_log_read_sectors(bs, &logs->log, &sectors_read, data, 1, false); if (ret < 0) { goto exit; } if (sectors_read != 1) { ret = -EINVAL; goto exit; } vhdx_log_data_le_import(data); } ret = vhdx_log_flush_desc(bs, &desc_entries->desc[i], data); if (ret < 0) { goto exit; } } if (file_length < desc_entries->hdr.last_file_offset) { new_file_size = desc_entries->hdr.last_file_offset; if (new_file_size % (1024*1024)) { /* round up to nearest 1MB boundary */ new_file_size = QEMU_ALIGN_UP(new_file_size, MiB); if (new_file_size > INT64_MAX) { ret = -EINVAL; goto exit; } bdrv_truncate(bs->file, new_file_size, PREALLOC_MODE_OFF, NULL); } } qemu_vfree(desc_entries); desc_entries = NULL; } ret = bdrv_flush(bs); if (ret < 0) { goto exit; } /* once the log is fully flushed, indicate that we have an empty log * now. This also sets the log guid to 0, to indicate an empty log */ vhdx_log_reset(bs, s); exit: qemu_vfree(data); qemu_vfree(desc_entries); return ret; }
false
qemu
95d729835f3ceeed977eaf326a7ebb92788dee6d
static int vhdx_log_flush(BlockDriverState *bs, BDRVVHDXState *s, VHDXLogSequence *logs) { int ret = 0; int i; uint32_t cnt, sectors_read; uint64_t new_file_size; void *data = NULL; int64_t file_length; VHDXLogDescEntries *desc_entries = NULL; VHDXLogEntryHeader hdr_tmp = { 0 }; cnt = logs->count; data = qemu_blockalign(bs, VHDX_LOG_SECTOR_SIZE); ret = vhdx_user_visible_write(bs, s); if (ret < 0) { goto exit; } while (cnt--) { ret = vhdx_log_peek_hdr(bs, &logs->log, &hdr_tmp); if (ret < 0) { goto exit; } file_length = bdrv_getlength(bs->file->bs); if (file_length < 0) { ret = file_length; goto exit; } if (hdr_tmp.flushed_file_offset > file_length) { ret = -EINVAL; goto exit; } ret = vhdx_log_read_desc(bs, s, &logs->log, &desc_entries, true); if (ret < 0) { goto exit; } for (i = 0; i < desc_entries->hdr.descriptor_count; i++) { if (desc_entries->desc[i].signature == VHDX_LOG_DESC_SIGNATURE) { ret = vhdx_log_read_sectors(bs, &logs->log, &sectors_read, data, 1, false); if (ret < 0) { goto exit; } if (sectors_read != 1) { ret = -EINVAL; goto exit; } vhdx_log_data_le_import(data); } ret = vhdx_log_flush_desc(bs, &desc_entries->desc[i], data); if (ret < 0) { goto exit; } } if (file_length < desc_entries->hdr.last_file_offset) { new_file_size = desc_entries->hdr.last_file_offset; if (new_file_size % (1024*1024)) { new_file_size = QEMU_ALIGN_UP(new_file_size, MiB); if (new_file_size > INT64_MAX) { ret = -EINVAL; goto exit; } bdrv_truncate(bs->file, new_file_size, PREALLOC_MODE_OFF, NULL); } } qemu_vfree(desc_entries); desc_entries = NULL; } ret = bdrv_flush(bs); if (ret < 0) { goto exit; } vhdx_log_reset(bs, s); exit: qemu_vfree(data); qemu_vfree(desc_entries); return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(BlockDriverState *VAR_0, BDRVVHDXState *VAR_1, VHDXLogSequence *VAR_2) { int VAR_3 = 0; int VAR_4; uint32_t cnt, sectors_read; uint64_t new_file_size; void *VAR_5 = NULL; int64_t file_length; VHDXLogDescEntries *desc_entries = NULL; VHDXLogEntryHeader hdr_tmp = { 0 }; cnt = VAR_2->count; VAR_5 = qemu_blockalign(VAR_0, VHDX_LOG_SECTOR_SIZE); VAR_3 = vhdx_user_visible_write(VAR_0, VAR_1); if (VAR_3 < 0) { goto exit; } while (cnt--) { VAR_3 = vhdx_log_peek_hdr(VAR_0, &VAR_2->log, &hdr_tmp); if (VAR_3 < 0) { goto exit; } file_length = bdrv_getlength(VAR_0->file->VAR_0); if (file_length < 0) { VAR_3 = file_length; goto exit; } if (hdr_tmp.flushed_file_offset > file_length) { VAR_3 = -EINVAL; goto exit; } VAR_3 = vhdx_log_read_desc(VAR_0, VAR_1, &VAR_2->log, &desc_entries, true); if (VAR_3 < 0) { goto exit; } for (VAR_4 = 0; VAR_4 < desc_entries->hdr.descriptor_count; VAR_4++) { if (desc_entries->desc[VAR_4].signature == VHDX_LOG_DESC_SIGNATURE) { VAR_3 = vhdx_log_read_sectors(VAR_0, &VAR_2->log, &sectors_read, VAR_5, 1, false); if (VAR_3 < 0) { goto exit; } if (sectors_read != 1) { VAR_3 = -EINVAL; goto exit; } vhdx_log_data_le_import(VAR_5); } VAR_3 = vhdx_log_flush_desc(VAR_0, &desc_entries->desc[VAR_4], VAR_5); if (VAR_3 < 0) { goto exit; } } if (file_length < desc_entries->hdr.last_file_offset) { new_file_size = desc_entries->hdr.last_file_offset; if (new_file_size % (1024*1024)) { new_file_size = QEMU_ALIGN_UP(new_file_size, MiB); if (new_file_size > INT64_MAX) { VAR_3 = -EINVAL; goto exit; } bdrv_truncate(VAR_0->file, new_file_size, PREALLOC_MODE_OFF, NULL); } } qemu_vfree(desc_entries); desc_entries = NULL; } VAR_3 = bdrv_flush(VAR_0); if (VAR_3 < 0) { goto exit; } vhdx_log_reset(VAR_0, VAR_1); exit: qemu_vfree(VAR_5); qemu_vfree(desc_entries); return VAR_3; }
[ "static int FUNC_0(BlockDriverState *VAR_0, BDRVVHDXState *VAR_1,\nVHDXLogSequence *VAR_2)\n{", "int VAR_3 = 0;", "int VAR_4;", "uint32_t cnt, sectors_read;", "uint64_t new_file_size;", "void *VAR_5 = NULL;", "int64_t file_length;", "VHDXLogDescEntries *desc_entries = NULL;", "VHDXLogEntryHeader hdr_tmp = { 0 };", "cnt = VAR_2->count;", "VAR_5 = qemu_blockalign(VAR_0, VHDX_LOG_SECTOR_SIZE);", "VAR_3 = vhdx_user_visible_write(VAR_0, VAR_1);", "if (VAR_3 < 0) {", "goto exit;", "}", "while (cnt--) {", "VAR_3 = vhdx_log_peek_hdr(VAR_0, &VAR_2->log, &hdr_tmp);", "if (VAR_3 < 0) {", "goto exit;", "}", "file_length = bdrv_getlength(VAR_0->file->VAR_0);", "if (file_length < 0) {", "VAR_3 = file_length;", "goto exit;", "}", "if (hdr_tmp.flushed_file_offset > file_length) {", "VAR_3 = -EINVAL;", "goto exit;", "}", "VAR_3 = vhdx_log_read_desc(VAR_0, VAR_1, &VAR_2->log, &desc_entries, true);", "if (VAR_3 < 0) {", "goto exit;", "}", "for (VAR_4 = 0; VAR_4 < desc_entries->hdr.descriptor_count; VAR_4++) {", "if (desc_entries->desc[VAR_4].signature == VHDX_LOG_DESC_SIGNATURE) {", "VAR_3 = vhdx_log_read_sectors(VAR_0, &VAR_2->log, &sectors_read,\nVAR_5, 1, false);", "if (VAR_3 < 0) {", "goto exit;", "}", "if (sectors_read != 1) {", "VAR_3 = -EINVAL;", "goto exit;", "}", "vhdx_log_data_le_import(VAR_5);", "}", "VAR_3 = vhdx_log_flush_desc(VAR_0, &desc_entries->desc[VAR_4], VAR_5);", "if (VAR_3 < 0) {", "goto exit;", "}", "}", "if (file_length < desc_entries->hdr.last_file_offset) {", "new_file_size = desc_entries->hdr.last_file_offset;", "if (new_file_size % (1024*1024)) {", "new_file_size = QEMU_ALIGN_UP(new_file_size, MiB);", "if (new_file_size > INT64_MAX) {", "VAR_3 = -EINVAL;", "goto exit;", "}", "bdrv_truncate(VAR_0->file, new_file_size, PREALLOC_MODE_OFF, NULL);", "}", "}", "qemu_vfree(desc_entries);", "desc_entries = NULL;", "}", "VAR_3 = bdrv_flush(VAR_0);", "if (VAR_3 < 0) {", "goto exit;", "}", "vhdx_log_reset(VAR_0, VAR_1);", "exit:\nqemu_vfree(VAR_5);", "qemu_vfree(desc_entries);", "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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 93 ], [ 95 ], [ 99, 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 177 ], [ 181, 183 ], [ 185 ], [ 187 ], [ 189 ] ]
4,554
int ff_intel_h263_decode_picture_header(MpegEncContext *s) { int format; /* picture header */ if (get_bits_long(&s->gb, 22) != 0x20) { av_log(s->avctx, AV_LOG_ERROR, "Bad picture start code\n"); return -1; } s->picture_number = get_bits(&s->gb, 8); /* picture timestamp */ if (get_bits1(&s->gb) != 1) { av_log(s->avctx, AV_LOG_ERROR, "Bad marker\n"); return -1; /* marker */ } if (get_bits1(&s->gb) != 0) { av_log(s->avctx, AV_LOG_ERROR, "Bad H263 id\n"); return -1; /* h263 id */ } skip_bits1(&s->gb); /* split screen off */ skip_bits1(&s->gb); /* camera off */ skip_bits1(&s->gb); /* freeze picture release off */ format = get_bits(&s->gb, 3); if (format == 0 || format == 6) { av_log(s->avctx, AV_LOG_ERROR, "Intel H263 free format not supported\n"); return -1; } s->h263_plus = 0; s->pict_type = AV_PICTURE_TYPE_I + get_bits1(&s->gb); s->unrestricted_mv = get_bits1(&s->gb); s->h263_long_vectors = s->unrestricted_mv; if (get_bits1(&s->gb) != 0) { av_log(s->avctx, AV_LOG_ERROR, "SAC not supported\n"); return -1; /* SAC: off */ } s->obmc= get_bits1(&s->gb); s->pb_frame = get_bits1(&s->gb); if (format < 6) { s->width = ff_h263_format[format][0]; s->height = ff_h263_format[format][1]; s->avctx->sample_aspect_ratio.num = 12; s->avctx->sample_aspect_ratio.den = 11; } else { format = get_bits(&s->gb, 3); if(format == 0 || format == 7){ av_log(s->avctx, AV_LOG_ERROR, "Wrong Intel H263 format\n"); return -1; } if(get_bits(&s->gb, 2)) av_log(s->avctx, AV_LOG_ERROR, "Bad value for reserved field\n"); s->loop_filter = get_bits1(&s->gb); if(get_bits1(&s->gb)) av_log(s->avctx, AV_LOG_ERROR, "Bad value for reserved field\n"); if(get_bits1(&s->gb)) s->pb_frame = 2; if(get_bits(&s->gb, 5)) av_log(s->avctx, AV_LOG_ERROR, "Bad value for reserved field\n"); if(get_bits(&s->gb, 5) != 1) av_log(s->avctx, AV_LOG_ERROR, "Invalid marker\n"); } if(format == 6){ int ar = get_bits(&s->gb, 4); skip_bits(&s->gb, 9); // display width skip_bits1(&s->gb); skip_bits(&s->gb, 9); // display height if(ar == 15){ s->avctx->sample_aspect_ratio.num = get_bits(&s->gb, 8); // aspect ratio - width s->avctx->sample_aspect_ratio.den = get_bits(&s->gb, 8); // aspect ratio - height } else { s->avctx->sample_aspect_ratio = ff_h263_pixel_aspect[ar]; } if (s->avctx->sample_aspect_ratio.num == 0) av_log(s->avctx, AV_LOG_ERROR, "Invalid aspect ratio.\n"); } s->chroma_qscale= s->qscale = get_bits(&s->gb, 5); skip_bits1(&s->gb); /* Continuous Presence Multipoint mode: off */ if(s->pb_frame){ skip_bits(&s->gb, 3); //temporal reference for B-frame skip_bits(&s->gb, 2); //dbquant } /* PEI */ while (get_bits1(&s->gb) != 0) { skip_bits(&s->gb, 8); } s->f_code = 1; s->y_dc_scale_table= s->c_dc_scale_table= ff_mpeg1_dc_scale_table; ff_h263_show_pict_info(s); return 0; }
false
FFmpeg
cc229d4e83889d1298f1a0863b55feec6c5c339a
int ff_intel_h263_decode_picture_header(MpegEncContext *s) { int format; if (get_bits_long(&s->gb, 22) != 0x20) { av_log(s->avctx, AV_LOG_ERROR, "Bad picture start code\n"); return -1; } s->picture_number = get_bits(&s->gb, 8); if (get_bits1(&s->gb) != 1) { av_log(s->avctx, AV_LOG_ERROR, "Bad marker\n"); return -1; } if (get_bits1(&s->gb) != 0) { av_log(s->avctx, AV_LOG_ERROR, "Bad H263 id\n"); return -1; } skip_bits1(&s->gb); skip_bits1(&s->gb); skip_bits1(&s->gb); format = get_bits(&s->gb, 3); if (format == 0 || format == 6) { av_log(s->avctx, AV_LOG_ERROR, "Intel H263 free format not supported\n"); return -1; } s->h263_plus = 0; s->pict_type = AV_PICTURE_TYPE_I + get_bits1(&s->gb); s->unrestricted_mv = get_bits1(&s->gb); s->h263_long_vectors = s->unrestricted_mv; if (get_bits1(&s->gb) != 0) { av_log(s->avctx, AV_LOG_ERROR, "SAC not supported\n"); return -1; } s->obmc= get_bits1(&s->gb); s->pb_frame = get_bits1(&s->gb); if (format < 6) { s->width = ff_h263_format[format][0]; s->height = ff_h263_format[format][1]; s->avctx->sample_aspect_ratio.num = 12; s->avctx->sample_aspect_ratio.den = 11; } else { format = get_bits(&s->gb, 3); if(format == 0 || format == 7){ av_log(s->avctx, AV_LOG_ERROR, "Wrong Intel H263 format\n"); return -1; } if(get_bits(&s->gb, 2)) av_log(s->avctx, AV_LOG_ERROR, "Bad value for reserved field\n"); s->loop_filter = get_bits1(&s->gb); if(get_bits1(&s->gb)) av_log(s->avctx, AV_LOG_ERROR, "Bad value for reserved field\n"); if(get_bits1(&s->gb)) s->pb_frame = 2; if(get_bits(&s->gb, 5)) av_log(s->avctx, AV_LOG_ERROR, "Bad value for reserved field\n"); if(get_bits(&s->gb, 5) != 1) av_log(s->avctx, AV_LOG_ERROR, "Invalid marker\n"); } if(format == 6){ int ar = get_bits(&s->gb, 4); skip_bits(&s->gb, 9); skip_bits1(&s->gb); skip_bits(&s->gb, 9); if(ar == 15){ s->avctx->sample_aspect_ratio.num = get_bits(&s->gb, 8); s->avctx->sample_aspect_ratio.den = get_bits(&s->gb, 8); } else { s->avctx->sample_aspect_ratio = ff_h263_pixel_aspect[ar]; } if (s->avctx->sample_aspect_ratio.num == 0) av_log(s->avctx, AV_LOG_ERROR, "Invalid aspect ratio.\n"); } s->chroma_qscale= s->qscale = get_bits(&s->gb, 5); skip_bits1(&s->gb); if(s->pb_frame){ skip_bits(&s->gb, 3); skip_bits(&s->gb, 2); } while (get_bits1(&s->gb) != 0) { skip_bits(&s->gb, 8); } s->f_code = 1; s->y_dc_scale_table= s->c_dc_scale_table= ff_mpeg1_dc_scale_table; ff_h263_show_pict_info(s); return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(MpegEncContext *VAR_0) { int VAR_1; if (get_bits_long(&VAR_0->gb, 22) != 0x20) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Bad picture start code\n"); return -1; } VAR_0->picture_number = get_bits(&VAR_0->gb, 8); if (get_bits1(&VAR_0->gb) != 1) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Bad marker\n"); return -1; } if (get_bits1(&VAR_0->gb) != 0) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Bad H263 id\n"); return -1; } skip_bits1(&VAR_0->gb); skip_bits1(&VAR_0->gb); skip_bits1(&VAR_0->gb); VAR_1 = get_bits(&VAR_0->gb, 3); if (VAR_1 == 0 || VAR_1 == 6) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Intel H263 free VAR_1 not supported\n"); return -1; } VAR_0->h263_plus = 0; VAR_0->pict_type = AV_PICTURE_TYPE_I + get_bits1(&VAR_0->gb); VAR_0->unrestricted_mv = get_bits1(&VAR_0->gb); VAR_0->h263_long_vectors = VAR_0->unrestricted_mv; if (get_bits1(&VAR_0->gb) != 0) { av_log(VAR_0->avctx, AV_LOG_ERROR, "SAC not supported\n"); return -1; } VAR_0->obmc= get_bits1(&VAR_0->gb); VAR_0->pb_frame = get_bits1(&VAR_0->gb); if (VAR_1 < 6) { VAR_0->width = ff_h263_format[VAR_1][0]; VAR_0->height = ff_h263_format[VAR_1][1]; VAR_0->avctx->sample_aspect_ratio.num = 12; VAR_0->avctx->sample_aspect_ratio.den = 11; } else { VAR_1 = get_bits(&VAR_0->gb, 3); if(VAR_1 == 0 || VAR_1 == 7){ av_log(VAR_0->avctx, AV_LOG_ERROR, "Wrong Intel H263 VAR_1\n"); return -1; } if(get_bits(&VAR_0->gb, 2)) av_log(VAR_0->avctx, AV_LOG_ERROR, "Bad value for reserved field\n"); VAR_0->loop_filter = get_bits1(&VAR_0->gb); if(get_bits1(&VAR_0->gb)) av_log(VAR_0->avctx, AV_LOG_ERROR, "Bad value for reserved field\n"); if(get_bits1(&VAR_0->gb)) VAR_0->pb_frame = 2; if(get_bits(&VAR_0->gb, 5)) av_log(VAR_0->avctx, AV_LOG_ERROR, "Bad value for reserved field\n"); if(get_bits(&VAR_0->gb, 5) != 1) av_log(VAR_0->avctx, AV_LOG_ERROR, "Invalid marker\n"); } if(VAR_1 == 6){ int VAR_2 = get_bits(&VAR_0->gb, 4); skip_bits(&VAR_0->gb, 9); skip_bits1(&VAR_0->gb); skip_bits(&VAR_0->gb, 9); if(VAR_2 == 15){ VAR_0->avctx->sample_aspect_ratio.num = get_bits(&VAR_0->gb, 8); VAR_0->avctx->sample_aspect_ratio.den = get_bits(&VAR_0->gb, 8); } else { VAR_0->avctx->sample_aspect_ratio = ff_h263_pixel_aspect[VAR_2]; } if (VAR_0->avctx->sample_aspect_ratio.num == 0) av_log(VAR_0->avctx, AV_LOG_ERROR, "Invalid aspect ratio.\n"); } VAR_0->chroma_qscale= VAR_0->qscale = get_bits(&VAR_0->gb, 5); skip_bits1(&VAR_0->gb); if(VAR_0->pb_frame){ skip_bits(&VAR_0->gb, 3); skip_bits(&VAR_0->gb, 2); } while (get_bits1(&VAR_0->gb) != 0) { skip_bits(&VAR_0->gb, 8); } VAR_0->f_code = 1; VAR_0->y_dc_scale_table= VAR_0->c_dc_scale_table= ff_mpeg1_dc_scale_table; ff_h263_show_pict_info(VAR_0); return 0; }
[ "int FUNC_0(MpegEncContext *VAR_0)\n{", "int VAR_1;", "if (get_bits_long(&VAR_0->gb, 22) != 0x20) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Bad picture start code\\n\");", "return -1;", "}", "VAR_0->picture_number = get_bits(&VAR_0->gb, 8);", "if (get_bits1(&VAR_0->gb) != 1) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Bad marker\\n\");", "return -1;", "}", "if (get_bits1(&VAR_0->gb) != 0) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Bad H263 id\\n\");", "return -1;", "}", "skip_bits1(&VAR_0->gb);", "skip_bits1(&VAR_0->gb);", "skip_bits1(&VAR_0->gb);", "VAR_1 = get_bits(&VAR_0->gb, 3);", "if (VAR_1 == 0 || VAR_1 == 6) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Intel H263 free VAR_1 not supported\\n\");", "return -1;", "}", "VAR_0->h263_plus = 0;", "VAR_0->pict_type = AV_PICTURE_TYPE_I + get_bits1(&VAR_0->gb);", "VAR_0->unrestricted_mv = get_bits1(&VAR_0->gb);", "VAR_0->h263_long_vectors = VAR_0->unrestricted_mv;", "if (get_bits1(&VAR_0->gb) != 0) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"SAC not supported\\n\");", "return -1;", "}", "VAR_0->obmc= get_bits1(&VAR_0->gb);", "VAR_0->pb_frame = get_bits1(&VAR_0->gb);", "if (VAR_1 < 6) {", "VAR_0->width = ff_h263_format[VAR_1][0];", "VAR_0->height = ff_h263_format[VAR_1][1];", "VAR_0->avctx->sample_aspect_ratio.num = 12;", "VAR_0->avctx->sample_aspect_ratio.den = 11;", "} else {", "VAR_1 = get_bits(&VAR_0->gb, 3);", "if(VAR_1 == 0 || VAR_1 == 7){", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Wrong Intel H263 VAR_1\\n\");", "return -1;", "}", "if(get_bits(&VAR_0->gb, 2))\nav_log(VAR_0->avctx, AV_LOG_ERROR, \"Bad value for reserved field\\n\");", "VAR_0->loop_filter = get_bits1(&VAR_0->gb);", "if(get_bits1(&VAR_0->gb))\nav_log(VAR_0->avctx, AV_LOG_ERROR, \"Bad value for reserved field\\n\");", "if(get_bits1(&VAR_0->gb))\nVAR_0->pb_frame = 2;", "if(get_bits(&VAR_0->gb, 5))\nav_log(VAR_0->avctx, AV_LOG_ERROR, \"Bad value for reserved field\\n\");", "if(get_bits(&VAR_0->gb, 5) != 1)\nav_log(VAR_0->avctx, AV_LOG_ERROR, \"Invalid marker\\n\");", "}", "if(VAR_1 == 6){", "int VAR_2 = get_bits(&VAR_0->gb, 4);", "skip_bits(&VAR_0->gb, 9);", "skip_bits1(&VAR_0->gb);", "skip_bits(&VAR_0->gb, 9);", "if(VAR_2 == 15){", "VAR_0->avctx->sample_aspect_ratio.num = get_bits(&VAR_0->gb, 8);", "VAR_0->avctx->sample_aspect_ratio.den = get_bits(&VAR_0->gb, 8);", "} else {", "VAR_0->avctx->sample_aspect_ratio = ff_h263_pixel_aspect[VAR_2];", "}", "if (VAR_0->avctx->sample_aspect_ratio.num == 0)\nav_log(VAR_0->avctx, AV_LOG_ERROR, \"Invalid aspect ratio.\\n\");", "}", "VAR_0->chroma_qscale= VAR_0->qscale = get_bits(&VAR_0->gb, 5);", "skip_bits1(&VAR_0->gb);", "if(VAR_0->pb_frame){", "skip_bits(&VAR_0->gb, 3);", "skip_bits(&VAR_0->gb, 2);", "}", "while (get_bits1(&VAR_0->gb) != 0) {", "skip_bits(&VAR_0->gb, 8);", "}", "VAR_0->f_code = 1;", "VAR_0->y_dc_scale_table=\nVAR_0->c_dc_scale_table= ff_mpeg1_dc_scale_table;", "ff_h263_show_pict_info(VAR_0);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 65 ], [ 67 ], [ 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 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153, 155 ], [ 157 ], [ 161 ], [ 163 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 189, 191 ], [ 195 ], [ 199 ], [ 201 ] ]
4,558
static ssize_t nbd_co_send_reply(NBDRequest *req, struct nbd_reply *reply, int len) { NBDClient *client = req->client; int csock = client->sock; ssize_t rc, ret; qemu_co_mutex_lock(&client->send_lock); qemu_set_fd_handler2(csock, nbd_can_read, nbd_read, nbd_restart_write, client); client->send_coroutine = qemu_coroutine_self(); if (!len) { rc = nbd_send_reply(csock, reply); } else { socket_set_cork(csock, 1); rc = nbd_send_reply(csock, reply); if (rc >= 0) { ret = qemu_co_send(csock, req->data, len); if (ret != len) { rc = -EIO; } } socket_set_cork(csock, 0); } client->send_coroutine = NULL; qemu_set_fd_handler2(csock, nbd_can_read, nbd_read, NULL, client); qemu_co_mutex_unlock(&client->send_lock); return rc; }
false
qemu
958c717df97ea9ca47a2253b8371130fe5f22980
static ssize_t nbd_co_send_reply(NBDRequest *req, struct nbd_reply *reply, int len) { NBDClient *client = req->client; int csock = client->sock; ssize_t rc, ret; qemu_co_mutex_lock(&client->send_lock); qemu_set_fd_handler2(csock, nbd_can_read, nbd_read, nbd_restart_write, client); client->send_coroutine = qemu_coroutine_self(); if (!len) { rc = nbd_send_reply(csock, reply); } else { socket_set_cork(csock, 1); rc = nbd_send_reply(csock, reply); if (rc >= 0) { ret = qemu_co_send(csock, req->data, len); if (ret != len) { rc = -EIO; } } socket_set_cork(csock, 0); } client->send_coroutine = NULL; qemu_set_fd_handler2(csock, nbd_can_read, nbd_read, NULL, client); qemu_co_mutex_unlock(&client->send_lock); return rc; }
{ "code": [], "line_no": [] }
static ssize_t FUNC_0(NBDRequest *req, struct nbd_reply *reply, int len) { NBDClient *client = req->client; int VAR_0 = client->sock; ssize_t rc, ret; qemu_co_mutex_lock(&client->send_lock); qemu_set_fd_handler2(VAR_0, nbd_can_read, nbd_read, nbd_restart_write, client); client->send_coroutine = qemu_coroutine_self(); if (!len) { rc = nbd_send_reply(VAR_0, reply); } else { socket_set_cork(VAR_0, 1); rc = nbd_send_reply(VAR_0, reply); if (rc >= 0) { ret = qemu_co_send(VAR_0, req->data, len); if (ret != len) { rc = -EIO; } } socket_set_cork(VAR_0, 0); } client->send_coroutine = NULL; qemu_set_fd_handler2(VAR_0, nbd_can_read, nbd_read, NULL, client); qemu_co_mutex_unlock(&client->send_lock); return rc; }
[ "static ssize_t FUNC_0(NBDRequest *req, struct nbd_reply *reply,\nint len)\n{", "NBDClient *client = req->client;", "int VAR_0 = client->sock;", "ssize_t rc, ret;", "qemu_co_mutex_lock(&client->send_lock);", "qemu_set_fd_handler2(VAR_0, nbd_can_read, nbd_read,\nnbd_restart_write, client);", "client->send_coroutine = qemu_coroutine_self();", "if (!len) {", "rc = nbd_send_reply(VAR_0, reply);", "} else {", "socket_set_cork(VAR_0, 1);", "rc = nbd_send_reply(VAR_0, reply);", "if (rc >= 0) {", "ret = qemu_co_send(VAR_0, req->data, len);", "if (ret != len) {", "rc = -EIO;", "}", "}", "socket_set_cork(VAR_0, 0);", "}", "client->send_coroutine = NULL;", "qemu_set_fd_handler2(VAR_0, nbd_can_read, nbd_read, NULL, client);", "qemu_co_mutex_unlock(&client->send_lock);", "return rc;", "}" ]
[ 0, 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 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ] ]
4,559
int64_t qemu_file_set_rate_limit(QEMUFile *f, int64_t new_rate) { /* any failed or completed migration keeps its state to allow probing of * migration data, but has no associated file anymore */ if (f && f->ops->set_rate_limit) return f->ops->set_rate_limit(f->opaque, new_rate); return 0; }
false
qemu
1964a397063967acc5ce71a2a24ed26e74824ee1
int64_t qemu_file_set_rate_limit(QEMUFile *f, int64_t new_rate) { if (f && f->ops->set_rate_limit) return f->ops->set_rate_limit(f->opaque, new_rate); return 0; }
{ "code": [], "line_no": [] }
int64_t FUNC_0(QEMUFile *f, int64_t new_rate) { if (f && f->ops->set_rate_limit) return f->ops->set_rate_limit(f->opaque, new_rate); return 0; }
[ "int64_t FUNC_0(QEMUFile *f, int64_t new_rate)\n{", "if (f && f->ops->set_rate_limit)\nreturn f->ops->set_rate_limit(f->opaque, new_rate);", "return 0;", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 9, 11 ], [ 15 ], [ 17 ] ]
4,560
static uint64_t lance_mem_read(void *opaque, target_phys_addr_t addr, unsigned size) { SysBusPCNetState *d = opaque; uint32_t val; val = pcnet_ioport_readw(&d->state, addr); trace_lance_mem_readw(addr, val & 0xffff); return val & 0xffff; }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static uint64_t lance_mem_read(void *opaque, target_phys_addr_t addr, unsigned size) { SysBusPCNetState *d = opaque; uint32_t val; val = pcnet_ioport_readw(&d->state, addr); trace_lance_mem_readw(addr, val & 0xffff); return val & 0xffff; }
{ "code": [], "line_no": [] }
static uint64_t FUNC_0(void *opaque, target_phys_addr_t addr, unsigned size) { SysBusPCNetState *d = opaque; uint32_t val; val = pcnet_ioport_readw(&d->state, addr); trace_lance_mem_readw(addr, val & 0xffff); return val & 0xffff; }
[ "static uint64_t FUNC_0(void *opaque, target_phys_addr_t addr,\nunsigned size)\n{", "SysBusPCNetState *d = opaque;", "uint32_t val;", "val = pcnet_ioport_readw(&d->state, addr);", "trace_lance_mem_readw(addr, val & 0xffff);", "return val & 0xffff;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ] ]
4,561
int tcp_socket_outgoing_opts(QemuOpts *opts) { Error *local_err = NULL; int fd = inet_connect_opts(opts, &local_err, NULL, NULL); if (local_err != NULL) { qerror_report_err(local_err); error_free(local_err); } return fd; }
false
qemu
77e8b9ca64e85d3d309f322410964b7852ec091e
int tcp_socket_outgoing_opts(QemuOpts *opts) { Error *local_err = NULL; int fd = inet_connect_opts(opts, &local_err, NULL, NULL); if (local_err != NULL) { qerror_report_err(local_err); error_free(local_err); } return fd; }
{ "code": [], "line_no": [] }
int FUNC_0(QemuOpts *VAR_0) { Error *local_err = NULL; int VAR_1 = inet_connect_opts(VAR_0, &local_err, NULL, NULL); if (local_err != NULL) { qerror_report_err(local_err); error_free(local_err); } return VAR_1; }
[ "int FUNC_0(QemuOpts *VAR_0)\n{", "Error *local_err = NULL;", "int VAR_1 = inet_connect_opts(VAR_0, &local_err, NULL, NULL);", "if (local_err != NULL) {", "qerror_report_err(local_err);", "error_free(local_err);", "}", "return VAR_1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ] ]
4,562
static inline int onenand_prog_spare(OneNANDState *s, int sec, int secn, void *src) { int result = 0; if (secn > 0) { const uint8_t *sp = (const uint8_t *)src; uint8_t *dp = 0, *dpp = 0; if (s->bdrv_cur) { dp = g_malloc(512); if (!dp || bdrv_read(s->bdrv_cur, s->secs_cur + (sec >> 5), dp, 1) < 0) { result = 1; } else { dpp = dp + ((sec & 31) << 4); } } else { if (sec + secn > s->secs_cur) { result = 1; } else { dpp = s->current + (s->secs_cur << 9) + (sec << 4); } } if (!result) { uint32_t i; for (i = 0; i < (secn << 4); i++) { dpp[i] &= sp[i]; } if (s->bdrv_cur) { result = bdrv_write(s->bdrv_cur, s->secs_cur + (sec >> 5), dp, 1) < 0; } } g_free(dp); } return result; }
false
qemu
4be746345f13e99e468c60acbd3a355e8183e3ce
static inline int onenand_prog_spare(OneNANDState *s, int sec, int secn, void *src) { int result = 0; if (secn > 0) { const uint8_t *sp = (const uint8_t *)src; uint8_t *dp = 0, *dpp = 0; if (s->bdrv_cur) { dp = g_malloc(512); if (!dp || bdrv_read(s->bdrv_cur, s->secs_cur + (sec >> 5), dp, 1) < 0) { result = 1; } else { dpp = dp + ((sec & 31) << 4); } } else { if (sec + secn > s->secs_cur) { result = 1; } else { dpp = s->current + (s->secs_cur << 9) + (sec << 4); } } if (!result) { uint32_t i; for (i = 0; i < (secn << 4); i++) { dpp[i] &= sp[i]; } if (s->bdrv_cur) { result = bdrv_write(s->bdrv_cur, s->secs_cur + (sec >> 5), dp, 1) < 0; } } g_free(dp); } return result; }
{ "code": [], "line_no": [] }
static inline int FUNC_0(OneNANDState *VAR_0, int VAR_1, int VAR_2, void *VAR_3) { int VAR_4 = 0; if (VAR_2 > 0) { const uint8_t *VAR_5 = (const uint8_t *)VAR_3; uint8_t *dp = 0, *dpp = 0; if (VAR_0->bdrv_cur) { dp = g_malloc(512); if (!dp || bdrv_read(VAR_0->bdrv_cur, VAR_0->secs_cur + (VAR_1 >> 5), dp, 1) < 0) { VAR_4 = 1; } else { dpp = dp + ((VAR_1 & 31) << 4); } } else { if (VAR_1 + VAR_2 > VAR_0->secs_cur) { VAR_4 = 1; } else { dpp = VAR_0->current + (VAR_0->secs_cur << 9) + (VAR_1 << 4); } } if (!VAR_4) { uint32_t i; for (i = 0; i < (VAR_2 << 4); i++) { dpp[i] &= VAR_5[i]; } if (VAR_0->bdrv_cur) { VAR_4 = bdrv_write(VAR_0->bdrv_cur, VAR_0->secs_cur + (VAR_1 >> 5), dp, 1) < 0; } } g_free(dp); } return VAR_4; }
[ "static inline int FUNC_0(OneNANDState *VAR_0, int VAR_1, int VAR_2,\nvoid *VAR_3)\n{", "int VAR_4 = 0;", "if (VAR_2 > 0) {", "const uint8_t *VAR_5 = (const uint8_t *)VAR_3;", "uint8_t *dp = 0, *dpp = 0;", "if (VAR_0->bdrv_cur) {", "dp = g_malloc(512);", "if (!dp || bdrv_read(VAR_0->bdrv_cur,\nVAR_0->secs_cur + (VAR_1 >> 5),\ndp, 1) < 0) {", "VAR_4 = 1;", "} else {", "dpp = dp + ((VAR_1 & 31) << 4);", "}", "} else {", "if (VAR_1 + VAR_2 > VAR_0->secs_cur) {", "VAR_4 = 1;", "} else {", "dpp = VAR_0->current + (VAR_0->secs_cur << 9) + (VAR_1 << 4);", "}", "}", "if (!VAR_4) {", "uint32_t i;", "for (i = 0; i < (VAR_2 << 4); i++) {", "dpp[i] &= VAR_5[i];", "}", "if (VAR_0->bdrv_cur) {", "VAR_4 = bdrv_write(VAR_0->bdrv_cur, VAR_0->secs_cur + (VAR_1 >> 5),\ndp, 1) < 0;", "}", "}", "g_free(dp);", "}", "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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19, 21, 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59, 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ] ]
4,564
static void setup_rt_frame(int sig, struct target_sigaction *ka, target_siginfo_t *info, target_sigset_t *set, CPUM68KState *env) { struct target_rt_sigframe *frame; abi_ulong frame_addr; abi_ulong retcode_addr; abi_ulong info_addr; abi_ulong uc_addr; int err = 0; int i; frame_addr = get_sigframe(ka, env, sizeof *frame); if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 0)) goto give_sigsegv; __put_user(sig, &frame->sig); info_addr = frame_addr + offsetof(struct target_rt_sigframe, info); __put_user(info_addr, &frame->pinfo); uc_addr = frame_addr + offsetof(struct target_rt_sigframe, uc); __put_user(uc_addr, &frame->puc); err |= copy_siginfo_to_user(&frame->info, info); /* Create the ucontext */ __put_user(0, &frame->uc.tuc_flags); __put_user(0, &frame->uc.tuc_link); __put_user(target_sigaltstack_used.ss_sp, &frame->uc.tuc_stack.ss_sp); __put_user(sas_ss_flags(env->aregs[7]), &frame->uc.tuc_stack.ss_flags); __put_user(target_sigaltstack_used.ss_size, &frame->uc.tuc_stack.ss_size); err |= target_rt_setup_ucontext(&frame->uc, env); if (err) goto give_sigsegv; for(i = 0; i < TARGET_NSIG_WORDS; i++) { if (__put_user(set->sig[i], &frame->uc.tuc_sigmask.sig[i])) goto give_sigsegv; } /* Set up to return from userspace. */ retcode_addr = frame_addr + offsetof(struct target_sigframe, retcode); __put_user(retcode_addr, &frame->pretcode); /* moveq #,d0; notb d0; trap #0 */ __put_user(0x70004600 + ((TARGET_NR_rt_sigreturn ^ 0xff) << 16), (long *)(frame->retcode + 0)); __put_user(0x4e40, (short *)(frame->retcode + 4)); if (err) goto give_sigsegv; /* Set up to return from userspace */ env->aregs[7] = frame_addr; env->pc = ka->_sa_handler; unlock_user_struct(frame, frame_addr, 1); return; give_sigsegv: unlock_user_struct(frame, frame_addr, 1); force_sig(TARGET_SIGSEGV); }
false
qemu
b0fd8d18683f0d77a8e6b482771ebea82234d727
static void setup_rt_frame(int sig, struct target_sigaction *ka, target_siginfo_t *info, target_sigset_t *set, CPUM68KState *env) { struct target_rt_sigframe *frame; abi_ulong frame_addr; abi_ulong retcode_addr; abi_ulong info_addr; abi_ulong uc_addr; int err = 0; int i; frame_addr = get_sigframe(ka, env, sizeof *frame); if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 0)) goto give_sigsegv; __put_user(sig, &frame->sig); info_addr = frame_addr + offsetof(struct target_rt_sigframe, info); __put_user(info_addr, &frame->pinfo); uc_addr = frame_addr + offsetof(struct target_rt_sigframe, uc); __put_user(uc_addr, &frame->puc); err |= copy_siginfo_to_user(&frame->info, info); __put_user(0, &frame->uc.tuc_flags); __put_user(0, &frame->uc.tuc_link); __put_user(target_sigaltstack_used.ss_sp, &frame->uc.tuc_stack.ss_sp); __put_user(sas_ss_flags(env->aregs[7]), &frame->uc.tuc_stack.ss_flags); __put_user(target_sigaltstack_used.ss_size, &frame->uc.tuc_stack.ss_size); err |= target_rt_setup_ucontext(&frame->uc, env); if (err) goto give_sigsegv; for(i = 0; i < TARGET_NSIG_WORDS; i++) { if (__put_user(set->sig[i], &frame->uc.tuc_sigmask.sig[i])) goto give_sigsegv; } retcode_addr = frame_addr + offsetof(struct target_sigframe, retcode); __put_user(retcode_addr, &frame->pretcode); __put_user(0x70004600 + ((TARGET_NR_rt_sigreturn ^ 0xff) << 16), (long *)(frame->retcode + 0)); __put_user(0x4e40, (short *)(frame->retcode + 4)); if (err) goto give_sigsegv; env->aregs[7] = frame_addr; env->pc = ka->_sa_handler; unlock_user_struct(frame, frame_addr, 1); return; give_sigsegv: unlock_user_struct(frame, frame_addr, 1); force_sig(TARGET_SIGSEGV); }
{ "code": [], "line_no": [] }
static void FUNC_0(int VAR_0, struct target_sigaction *VAR_1, target_siginfo_t *VAR_2, target_sigset_t *VAR_3, CPUM68KState *VAR_4) { struct target_rt_sigframe *VAR_5; abi_ulong frame_addr; abi_ulong retcode_addr; abi_ulong info_addr; abi_ulong uc_addr; int VAR_6 = 0; int VAR_7; frame_addr = get_sigframe(VAR_1, VAR_4, sizeof *VAR_5); if (!lock_user_struct(VERIFY_WRITE, VAR_5, frame_addr, 0)) goto give_sigsegv; __put_user(VAR_0, &VAR_5->VAR_0); info_addr = frame_addr + offsetof(struct target_rt_sigframe, VAR_2); __put_user(info_addr, &VAR_5->pinfo); uc_addr = frame_addr + offsetof(struct target_rt_sigframe, uc); __put_user(uc_addr, &VAR_5->puc); VAR_6 |= copy_siginfo_to_user(&VAR_5->VAR_2, VAR_2); __put_user(0, &VAR_5->uc.tuc_flags); __put_user(0, &VAR_5->uc.tuc_link); __put_user(target_sigaltstack_used.ss_sp, &VAR_5->uc.tuc_stack.ss_sp); __put_user(sas_ss_flags(VAR_4->aregs[7]), &VAR_5->uc.tuc_stack.ss_flags); __put_user(target_sigaltstack_used.ss_size, &VAR_5->uc.tuc_stack.ss_size); VAR_6 |= target_rt_setup_ucontext(&VAR_5->uc, VAR_4); if (VAR_6) goto give_sigsegv; for(VAR_7 = 0; VAR_7 < TARGET_NSIG_WORDS; VAR_7++) { if (__put_user(VAR_3->VAR_0[VAR_7], &VAR_5->uc.tuc_sigmask.VAR_0[VAR_7])) goto give_sigsegv; } retcode_addr = frame_addr + offsetof(struct target_sigframe, retcode); __put_user(retcode_addr, &VAR_5->pretcode); __put_user(0x70004600 + ((TARGET_NR_rt_sigreturn ^ 0xff) << 16), (long *)(VAR_5->retcode + 0)); __put_user(0x4e40, (short *)(VAR_5->retcode + 4)); if (VAR_6) goto give_sigsegv; VAR_4->aregs[7] = frame_addr; VAR_4->pc = VAR_1->_sa_handler; unlock_user_struct(VAR_5, frame_addr, 1); return; give_sigsegv: unlock_user_struct(VAR_5, frame_addr, 1); force_sig(TARGET_SIGSEGV); }
[ "static void FUNC_0(int VAR_0, struct target_sigaction *VAR_1,\ntarget_siginfo_t *VAR_2,\ntarget_sigset_t *VAR_3, CPUM68KState *VAR_4)\n{", "struct target_rt_sigframe *VAR_5;", "abi_ulong frame_addr;", "abi_ulong retcode_addr;", "abi_ulong info_addr;", "abi_ulong uc_addr;", "int VAR_6 = 0;", "int VAR_7;", "frame_addr = get_sigframe(VAR_1, VAR_4, sizeof *VAR_5);", "if (!lock_user_struct(VERIFY_WRITE, VAR_5, frame_addr, 0))\ngoto give_sigsegv;", "__put_user(VAR_0, &VAR_5->VAR_0);", "info_addr = frame_addr + offsetof(struct target_rt_sigframe, VAR_2);", "__put_user(info_addr, &VAR_5->pinfo);", "uc_addr = frame_addr + offsetof(struct target_rt_sigframe, uc);", "__put_user(uc_addr, &VAR_5->puc);", "VAR_6 |= copy_siginfo_to_user(&VAR_5->VAR_2, VAR_2);", "__put_user(0, &VAR_5->uc.tuc_flags);", "__put_user(0, &VAR_5->uc.tuc_link);", "__put_user(target_sigaltstack_used.ss_sp,\n&VAR_5->uc.tuc_stack.ss_sp);", "__put_user(sas_ss_flags(VAR_4->aregs[7]),\n&VAR_5->uc.tuc_stack.ss_flags);", "__put_user(target_sigaltstack_used.ss_size,\n&VAR_5->uc.tuc_stack.ss_size);", "VAR_6 |= target_rt_setup_ucontext(&VAR_5->uc, VAR_4);", "if (VAR_6)\ngoto give_sigsegv;", "for(VAR_7 = 0; VAR_7 < TARGET_NSIG_WORDS; VAR_7++) {", "if (__put_user(VAR_3->VAR_0[VAR_7], &VAR_5->uc.tuc_sigmask.VAR_0[VAR_7]))\ngoto give_sigsegv;", "}", "retcode_addr = frame_addr + offsetof(struct target_sigframe, retcode);", "__put_user(retcode_addr, &VAR_5->pretcode);", "__put_user(0x70004600 + ((TARGET_NR_rt_sigreturn ^ 0xff) << 16),\n(long *)(VAR_5->retcode + 0));", "__put_user(0x4e40, (short *)(VAR_5->retcode + 4));", "if (VAR_6)\ngoto give_sigsegv;", "VAR_4->aregs[7] = frame_addr;", "VAR_4->pc = VAR_1->_sa_handler;", "unlock_user_struct(VAR_5, frame_addr, 1);", "return;", "give_sigsegv:\nunlock_user_struct(VAR_5, frame_addr, 1);", "force_sig(TARGET_SIGSEGV);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27, 29 ], [ 33 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 49 ], [ 57 ], [ 59 ], [ 61, 63 ], [ 65, 67 ], [ 69, 71 ], [ 73 ], [ 77, 79 ], [ 83 ], [ 85, 87 ], [ 89 ], [ 97 ], [ 99 ], [ 107, 109 ], [ 111 ], [ 115, 117 ], [ 125 ], [ 127 ], [ 131 ], [ 133 ], [ 137, 139 ], [ 141 ], [ 143 ] ]
4,565
static int mov_read_stsz(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; MOVStreamContext *sc; unsigned int i, entries, sample_size, field_size, num_bytes; GetBitContext gb; unsigned char* buf; if (c->fc->nb_streams < 1) return 0; st = c->fc->streams[c->fc->nb_streams-1]; sc = st->priv_data; avio_r8(pb); /* version */ avio_rb24(pb); /* flags */ if (atom.type == MKTAG('s','t','s','z')) { sample_size = avio_rb32(pb); if (!sc->sample_size) /* do not overwrite value computed in stsd */ sc->sample_size = sample_size; field_size = 32; } else { sample_size = 0; avio_rb24(pb); /* reserved */ field_size = avio_r8(pb); } entries = avio_rb32(pb); av_dlog(c->fc, "sample_size = %d sample_count = %d\n", sc->sample_size, entries); sc->sample_count = entries; if (sample_size) return 0; if (field_size != 4 && field_size != 8 && field_size != 16 && field_size != 32) { av_log(c->fc, AV_LOG_ERROR, "Invalid sample field size %d\n", field_size); return AVERROR_INVALIDDATA; } if (!entries) return 0; if (entries >= UINT_MAX / sizeof(int) || entries >= (UINT_MAX - 4) / field_size) return AVERROR_INVALIDDATA; sc->sample_sizes = av_malloc(entries * sizeof(int)); if (!sc->sample_sizes) return AVERROR(ENOMEM); num_bytes = (entries*field_size+4)>>3; buf = av_malloc(num_bytes+FF_INPUT_BUFFER_PADDING_SIZE); if (!buf) { av_freep(&sc->sample_sizes); return AVERROR(ENOMEM); } if (avio_read(pb, buf, num_bytes) < num_bytes) { av_freep(&sc->sample_sizes); av_free(buf); return AVERROR_INVALIDDATA; } init_get_bits(&gb, buf, 8*num_bytes); for (i = 0; i < entries; i++) { sc->sample_sizes[i] = get_bits_long(&gb, field_size); sc->data_size += sc->sample_sizes[i]; } av_free(buf); return 0; }
false
FFmpeg
9888ffb1ce5e0a17f711b01933d504c72ea29d3b
static int mov_read_stsz(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; MOVStreamContext *sc; unsigned int i, entries, sample_size, field_size, num_bytes; GetBitContext gb; unsigned char* buf; if (c->fc->nb_streams < 1) return 0; st = c->fc->streams[c->fc->nb_streams-1]; sc = st->priv_data; avio_r8(pb); avio_rb24(pb); if (atom.type == MKTAG('s','t','s','z')) { sample_size = avio_rb32(pb); if (!sc->sample_size) sc->sample_size = sample_size; field_size = 32; } else { sample_size = 0; avio_rb24(pb); field_size = avio_r8(pb); } entries = avio_rb32(pb); av_dlog(c->fc, "sample_size = %d sample_count = %d\n", sc->sample_size, entries); sc->sample_count = entries; if (sample_size) return 0; if (field_size != 4 && field_size != 8 && field_size != 16 && field_size != 32) { av_log(c->fc, AV_LOG_ERROR, "Invalid sample field size %d\n", field_size); return AVERROR_INVALIDDATA; } if (!entries) return 0; if (entries >= UINT_MAX / sizeof(int) || entries >= (UINT_MAX - 4) / field_size) return AVERROR_INVALIDDATA; sc->sample_sizes = av_malloc(entries * sizeof(int)); if (!sc->sample_sizes) return AVERROR(ENOMEM); num_bytes = (entries*field_size+4)>>3; buf = av_malloc(num_bytes+FF_INPUT_BUFFER_PADDING_SIZE); if (!buf) { av_freep(&sc->sample_sizes); return AVERROR(ENOMEM); } if (avio_read(pb, buf, num_bytes) < num_bytes) { av_freep(&sc->sample_sizes); av_free(buf); return AVERROR_INVALIDDATA; } init_get_bits(&gb, buf, 8*num_bytes); for (i = 0; i < entries; i++) { sc->sample_sizes[i] = get_bits_long(&gb, field_size); sc->data_size += sc->sample_sizes[i]; } av_free(buf); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(MOVContext *VAR_0, AVIOContext *VAR_1, MOVAtom VAR_2) { AVStream *st; MOVStreamContext *sc; unsigned int VAR_3, VAR_4, VAR_5, VAR_6, VAR_7; GetBitContext gb; unsigned char* VAR_8; if (VAR_0->fc->nb_streams < 1) return 0; st = VAR_0->fc->streams[VAR_0->fc->nb_streams-1]; sc = st->priv_data; avio_r8(VAR_1); avio_rb24(VAR_1); if (VAR_2.type == MKTAG('s','t','s','z')) { VAR_5 = avio_rb32(VAR_1); if (!sc->VAR_5) sc->VAR_5 = VAR_5; VAR_6 = 32; } else { VAR_5 = 0; avio_rb24(VAR_1); VAR_6 = avio_r8(VAR_1); } VAR_4 = avio_rb32(VAR_1); av_dlog(VAR_0->fc, "VAR_5 = %d sample_count = %d\n", sc->VAR_5, VAR_4); sc->sample_count = VAR_4; if (VAR_5) return 0; if (VAR_6 != 4 && VAR_6 != 8 && VAR_6 != 16 && VAR_6 != 32) { av_log(VAR_0->fc, AV_LOG_ERROR, "Invalid sample field size %d\n", VAR_6); return AVERROR_INVALIDDATA; } if (!VAR_4) return 0; if (VAR_4 >= UINT_MAX / sizeof(int) || VAR_4 >= (UINT_MAX - 4) / VAR_6) return AVERROR_INVALIDDATA; sc->sample_sizes = av_malloc(VAR_4 * sizeof(int)); if (!sc->sample_sizes) return AVERROR(ENOMEM); VAR_7 = (VAR_4*VAR_6+4)>>3; VAR_8 = av_malloc(VAR_7+FF_INPUT_BUFFER_PADDING_SIZE); if (!VAR_8) { av_freep(&sc->sample_sizes); return AVERROR(ENOMEM); } if (avio_read(VAR_1, VAR_8, VAR_7) < VAR_7) { av_freep(&sc->sample_sizes); av_free(VAR_8); return AVERROR_INVALIDDATA; } init_get_bits(&gb, VAR_8, 8*VAR_7); for (VAR_3 = 0; VAR_3 < VAR_4; VAR_3++) { sc->sample_sizes[VAR_3] = get_bits_long(&gb, VAR_6); sc->data_size += sc->sample_sizes[VAR_3]; } av_free(VAR_8); return 0; }
[ "static int FUNC_0(MOVContext *VAR_0, AVIOContext *VAR_1, MOVAtom VAR_2)\n{", "AVStream *st;", "MOVStreamContext *sc;", "unsigned int VAR_3, VAR_4, VAR_5, VAR_6, VAR_7;", "GetBitContext gb;", "unsigned char* VAR_8;", "if (VAR_0->fc->nb_streams < 1)\nreturn 0;", "st = VAR_0->fc->streams[VAR_0->fc->nb_streams-1];", "sc = st->priv_data;", "avio_r8(VAR_1);", "avio_rb24(VAR_1);", "if (VAR_2.type == MKTAG('s','t','s','z')) {", "VAR_5 = avio_rb32(VAR_1);", "if (!sc->VAR_5)\nsc->VAR_5 = VAR_5;", "VAR_6 = 32;", "} else {", "VAR_5 = 0;", "avio_rb24(VAR_1);", "VAR_6 = avio_r8(VAR_1);", "}", "VAR_4 = avio_rb32(VAR_1);", "av_dlog(VAR_0->fc, \"VAR_5 = %d sample_count = %d\\n\", sc->VAR_5, VAR_4);", "sc->sample_count = VAR_4;", "if (VAR_5)\nreturn 0;", "if (VAR_6 != 4 && VAR_6 != 8 && VAR_6 != 16 && VAR_6 != 32) {", "av_log(VAR_0->fc, AV_LOG_ERROR, \"Invalid sample field size %d\\n\", VAR_6);", "return AVERROR_INVALIDDATA;", "}", "if (!VAR_4)\nreturn 0;", "if (VAR_4 >= UINT_MAX / sizeof(int) || VAR_4 >= (UINT_MAX - 4) / VAR_6)\nreturn AVERROR_INVALIDDATA;", "sc->sample_sizes = av_malloc(VAR_4 * sizeof(int));", "if (!sc->sample_sizes)\nreturn AVERROR(ENOMEM);", "VAR_7 = (VAR_4*VAR_6+4)>>3;", "VAR_8 = av_malloc(VAR_7+FF_INPUT_BUFFER_PADDING_SIZE);", "if (!VAR_8) {", "av_freep(&sc->sample_sizes);", "return AVERROR(ENOMEM);", "}", "if (avio_read(VAR_1, VAR_8, VAR_7) < VAR_7) {", "av_freep(&sc->sample_sizes);", "av_free(VAR_8);", "return AVERROR_INVALIDDATA;", "}", "init_get_bits(&gb, VAR_8, 8*VAR_7);", "for (VAR_3 = 0; VAR_3 < VAR_4; VAR_3++) {", "sc->sample_sizes[VAR_3] = get_bits_long(&gb, VAR_6);", "sc->data_size += sc->sample_sizes[VAR_3];", "}", "av_free(VAR_8);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17, 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37, 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 61 ], [ 63, 65 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79, 81 ], [ 83, 85 ], [ 87 ], [ 89, 91 ], [ 95 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 123 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 137 ], [ 139 ], [ 141 ] ]
4,566
static QEMUFile *qemu_fopen_bdrv(BlockDriverState *bs, int64_t offset, int is_writable) { QEMUFile *f; f = qemu_mallocz(sizeof(QEMUFile)); if (!f) return NULL; f->is_file = 0; f->bs = bs; f->is_writable = is_writable; f->base_offset = offset; return f; }
false
qemu
5dafc53f1fb091d242f2179ffcb43bb28af36d1e
static QEMUFile *qemu_fopen_bdrv(BlockDriverState *bs, int64_t offset, int is_writable) { QEMUFile *f; f = qemu_mallocz(sizeof(QEMUFile)); if (!f) return NULL; f->is_file = 0; f->bs = bs; f->is_writable = is_writable; f->base_offset = offset; return f; }
{ "code": [], "line_no": [] }
static QEMUFile *FUNC_0(BlockDriverState *bs, int64_t offset, int is_writable) { QEMUFile *f; f = qemu_mallocz(sizeof(QEMUFile)); if (!f) return NULL; f->is_file = 0; f->bs = bs; f->is_writable = is_writable; f->base_offset = offset; return f; }
[ "static QEMUFile *FUNC_0(BlockDriverState *bs, int64_t offset, int is_writable)\n{", "QEMUFile *f;", "f = qemu_mallocz(sizeof(QEMUFile));", "if (!f)\nreturn NULL;", "f->is_file = 0;", "f->bs = bs;", "f->is_writable = is_writable;", "f->base_offset = offset;", "return f;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11, 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ] ]
4,567
static void virtio_setup(void) { struct irb irb; int i; int r; bool found = false; blk_schid.one = 1; for (i = 0; i < 0x10000; i++) { blk_schid.sch_no = i; r = tsch(blk_schid, &irb); if (r != 3) { if (virtio_is_blk(blk_schid)) { found = true; break; } } } if (!found) { virtio_panic("No virtio-blk device found!\n"); } virtio_setup_block(blk_schid); }
false
qemu
22d67ab55aad82383a0e5628b902a1a0556b2fc9
static void virtio_setup(void) { struct irb irb; int i; int r; bool found = false; blk_schid.one = 1; for (i = 0; i < 0x10000; i++) { blk_schid.sch_no = i; r = tsch(blk_schid, &irb); if (r != 3) { if (virtio_is_blk(blk_schid)) { found = true; break; } } } if (!found) { virtio_panic("No virtio-blk device found!\n"); } virtio_setup_block(blk_schid); }
{ "code": [], "line_no": [] }
static void FUNC_0(void) { struct VAR_0 VAR_0; int VAR_1; int VAR_2; bool found = false; blk_schid.one = 1; for (VAR_1 = 0; VAR_1 < 0x10000; VAR_1++) { blk_schid.sch_no = VAR_1; VAR_2 = tsch(blk_schid, &VAR_0); if (VAR_2 != 3) { if (virtio_is_blk(blk_schid)) { found = true; break; } } } if (!found) { virtio_panic("No virtio-blk device found!\n"); } virtio_setup_block(blk_schid); }
[ "static void FUNC_0(void)\n{", "struct VAR_0 VAR_0;", "int VAR_1;", "int VAR_2;", "bool found = false;", "blk_schid.one = 1;", "for (VAR_1 = 0; VAR_1 < 0x10000; VAR_1++) {", "blk_schid.sch_no = VAR_1;", "VAR_2 = tsch(blk_schid, &VAR_0);", "if (VAR_2 != 3) {", "if (virtio_is_blk(blk_schid)) {", "found = true;", "break;", "}", "}", "}", "if (!found) {", "virtio_panic(\"No virtio-blk device found!\\n\");", "}", "virtio_setup_block(blk_schid);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ] ]
4,568
int if_encap(Slirp *slirp, struct mbuf *ifm) { uint8_t buf[1600]; struct ethhdr *eh = (struct ethhdr *)buf; uint8_t ethaddr[ETH_ALEN]; const struct ip *iph = (const struct ip *)ifm->m_data; int ret; if (ifm->m_len + ETH_HLEN > sizeof(buf)) { return 1; } switch (iph->ip_v) { case IPVERSION: ret = if_encap4(slirp, ifm, eh, ethaddr); if (ret < 2) { return ret; } break; default: /* Do not assert while we don't manage IP6VERSION */ /* assert(0); */ break; } memcpy(eh->h_dest, ethaddr, ETH_ALEN); DEBUG_ARGS((dfd, " src = %02x:%02x:%02x:%02x:%02x:%02x\n", eh->h_source[0], eh->h_source[1], eh->h_source[2], eh->h_source[3], eh->h_source[4], eh->h_source[5])); DEBUG_ARGS((dfd, " dst = %02x:%02x:%02x:%02x:%02x:%02x\n", eh->h_dest[0], eh->h_dest[1], eh->h_dest[2], eh->h_dest[3], eh->h_dest[4], eh->h_dest[5])); memcpy(buf + sizeof(struct ethhdr), ifm->m_data, ifm->m_len); slirp_output(slirp->opaque, buf, ifm->m_len + ETH_HLEN); return 1; }
false
qemu
0d6ff71ae3c7ac3a446d295ef71884a05093b37c
int if_encap(Slirp *slirp, struct mbuf *ifm) { uint8_t buf[1600]; struct ethhdr *eh = (struct ethhdr *)buf; uint8_t ethaddr[ETH_ALEN]; const struct ip *iph = (const struct ip *)ifm->m_data; int ret; if (ifm->m_len + ETH_HLEN > sizeof(buf)) { return 1; } switch (iph->ip_v) { case IPVERSION: ret = if_encap4(slirp, ifm, eh, ethaddr); if (ret < 2) { return ret; } break; default: break; } memcpy(eh->h_dest, ethaddr, ETH_ALEN); DEBUG_ARGS((dfd, " src = %02x:%02x:%02x:%02x:%02x:%02x\n", eh->h_source[0], eh->h_source[1], eh->h_source[2], eh->h_source[3], eh->h_source[4], eh->h_source[5])); DEBUG_ARGS((dfd, " dst = %02x:%02x:%02x:%02x:%02x:%02x\n", eh->h_dest[0], eh->h_dest[1], eh->h_dest[2], eh->h_dest[3], eh->h_dest[4], eh->h_dest[5])); memcpy(buf + sizeof(struct ethhdr), ifm->m_data, ifm->m_len); slirp_output(slirp->opaque, buf, ifm->m_len + ETH_HLEN); return 1; }
{ "code": [], "line_no": [] }
int FUNC_0(Slirp *VAR_0, struct mbuf *VAR_1) { uint8_t buf[1600]; struct ethhdr *VAR_2 = (struct ethhdr *)buf; uint8_t ethaddr[ETH_ALEN]; const struct ip *VAR_3 = (const struct ip *)VAR_1->m_data; int VAR_4; if (VAR_1->m_len + ETH_HLEN > sizeof(buf)) { return 1; } switch (VAR_3->ip_v) { case IPVERSION: VAR_4 = if_encap4(VAR_0, VAR_1, VAR_2, ethaddr); if (VAR_4 < 2) { return VAR_4; } break; default: break; } memcpy(VAR_2->h_dest, ethaddr, ETH_ALEN); DEBUG_ARGS((dfd, " src = %02x:%02x:%02x:%02x:%02x:%02x\n", VAR_2->h_source[0], VAR_2->h_source[1], VAR_2->h_source[2], VAR_2->h_source[3], VAR_2->h_source[4], VAR_2->h_source[5])); DEBUG_ARGS((dfd, " dst = %02x:%02x:%02x:%02x:%02x:%02x\n", VAR_2->h_dest[0], VAR_2->h_dest[1], VAR_2->h_dest[2], VAR_2->h_dest[3], VAR_2->h_dest[4], VAR_2->h_dest[5])); memcpy(buf + sizeof(struct ethhdr), VAR_1->m_data, VAR_1->m_len); slirp_output(VAR_0->opaque, buf, VAR_1->m_len + ETH_HLEN); return 1; }
[ "int FUNC_0(Slirp *VAR_0, struct mbuf *VAR_1)\n{", "uint8_t buf[1600];", "struct ethhdr *VAR_2 = (struct ethhdr *)buf;", "uint8_t ethaddr[ETH_ALEN];", "const struct ip *VAR_3 = (const struct ip *)VAR_1->m_data;", "int VAR_4;", "if (VAR_1->m_len + ETH_HLEN > sizeof(buf)) {", "return 1;", "}", "switch (VAR_3->ip_v) {", "case IPVERSION:\nVAR_4 = if_encap4(VAR_0, VAR_1, VAR_2, ethaddr);", "if (VAR_4 < 2) {", "return VAR_4;", "}", "break;", "default:\nbreak;", "}", "memcpy(VAR_2->h_dest, ethaddr, ETH_ALEN);", "DEBUG_ARGS((dfd, \" src = %02x:%02x:%02x:%02x:%02x:%02x\\n\",\nVAR_2->h_source[0], VAR_2->h_source[1], VAR_2->h_source[2],\nVAR_2->h_source[3], VAR_2->h_source[4], VAR_2->h_source[5]));", "DEBUG_ARGS((dfd, \" dst = %02x:%02x:%02x:%02x:%02x:%02x\\n\",\nVAR_2->h_dest[0], VAR_2->h_dest[1], VAR_2->h_dest[2],\nVAR_2->h_dest[3], VAR_2->h_dest[4], VAR_2->h_dest[5]));", "memcpy(buf + sizeof(struct ethhdr), VAR_1->m_data, VAR_1->m_len);", "slirp_output(VAR_0->opaque, buf, VAR_1->m_len + ETH_HLEN);", "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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41, 47 ], [ 49 ], [ 53 ], [ 55, 57, 59 ], [ 61, 63, 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ] ]
4,572
static void fill_thread_info(struct elf_note_info *info, const CPUState *env) { TaskState *ts = (TaskState *)env->opaque; struct elf_thread_status *ets; ets = qemu_mallocz(sizeof (*ets)); ets->num_notes = 1; /* only prstatus is dumped */ fill_prstatus(&ets->prstatus, ts, 0); elf_core_copy_regs(&ets->prstatus.pr_reg, env); fill_note(&ets->notes[0], "CORE", NT_PRSTATUS, sizeof (ets->prstatus), &ets->prstatus); TAILQ_INSERT_TAIL(&info->thread_list, ets, ets_link); info->notes_size += note_size(&ets->notes[0]); }
false
qemu
72cf2d4f0e181d0d3a3122e04129c58a95da713e
static void fill_thread_info(struct elf_note_info *info, const CPUState *env) { TaskState *ts = (TaskState *)env->opaque; struct elf_thread_status *ets; ets = qemu_mallocz(sizeof (*ets)); ets->num_notes = 1; fill_prstatus(&ets->prstatus, ts, 0); elf_core_copy_regs(&ets->prstatus.pr_reg, env); fill_note(&ets->notes[0], "CORE", NT_PRSTATUS, sizeof (ets->prstatus), &ets->prstatus); TAILQ_INSERT_TAIL(&info->thread_list, ets, ets_link); info->notes_size += note_size(&ets->notes[0]); }
{ "code": [], "line_no": [] }
static void FUNC_0(struct elf_note_info *VAR_0, const CPUState *VAR_1) { TaskState *ts = (TaskState *)VAR_1->opaque; struct elf_thread_status *VAR_2; VAR_2 = qemu_mallocz(sizeof (*VAR_2)); VAR_2->num_notes = 1; fill_prstatus(&VAR_2->prstatus, ts, 0); elf_core_copy_regs(&VAR_2->prstatus.pr_reg, VAR_1); fill_note(&VAR_2->notes[0], "CORE", NT_PRSTATUS, sizeof (VAR_2->prstatus), &VAR_2->prstatus); TAILQ_INSERT_TAIL(&VAR_0->thread_list, VAR_2, ets_link); VAR_0->notes_size += note_size(&VAR_2->notes[0]); }
[ "static void FUNC_0(struct elf_note_info *VAR_0, const CPUState *VAR_1)\n{", "TaskState *ts = (TaskState *)VAR_1->opaque;", "struct elf_thread_status *VAR_2;", "VAR_2 = qemu_mallocz(sizeof (*VAR_2));", "VAR_2->num_notes = 1;", "fill_prstatus(&VAR_2->prstatus, ts, 0);", "elf_core_copy_regs(&VAR_2->prstatus.pr_reg, VAR_1);", "fill_note(&VAR_2->notes[0], \"CORE\", NT_PRSTATUS, sizeof (VAR_2->prstatus),\n&VAR_2->prstatus);", "TAILQ_INSERT_TAIL(&VAR_0->thread_list, VAR_2, ets_link);", "VAR_0->notes_size += note_size(&VAR_2->notes[0]);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19, 21 ], [ 25 ], [ 29 ], [ 31 ] ]
4,573
static void omap_screen_dump(void *opaque, const char *filename, bool cswitch, Error **errp) { struct omap_lcd_panel_s *omap_lcd = opaque; DisplaySurface *surface = qemu_console_surface(omap_lcd->con); omap_update_display(opaque); if (omap_lcd && surface_data(surface)) omap_ppm_save(filename, surface_data(surface), omap_lcd->width, omap_lcd->height, surface_stride(surface), errp); }
false
qemu
2c62f08ddbf3fa80dc7202eb9a2ea60ae44e2cc5
static void omap_screen_dump(void *opaque, const char *filename, bool cswitch, Error **errp) { struct omap_lcd_panel_s *omap_lcd = opaque; DisplaySurface *surface = qemu_console_surface(omap_lcd->con); omap_update_display(opaque); if (omap_lcd && surface_data(surface)) omap_ppm_save(filename, surface_data(surface), omap_lcd->width, omap_lcd->height, surface_stride(surface), errp); }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, const char *VAR_1, bool VAR_2, Error **VAR_3) { struct omap_lcd_panel_s *VAR_4 = VAR_0; DisplaySurface *surface = qemu_console_surface(VAR_4->con); omap_update_display(VAR_0); if (VAR_4 && surface_data(surface)) omap_ppm_save(VAR_1, surface_data(surface), VAR_4->width, VAR_4->height, surface_stride(surface), VAR_3); }
[ "static void FUNC_0(void *VAR_0, const char *VAR_1, bool VAR_2,\nError **VAR_3)\n{", "struct omap_lcd_panel_s *VAR_4 = VAR_0;", "DisplaySurface *surface = qemu_console_surface(VAR_4->con);", "omap_update_display(VAR_0);", "if (VAR_4 && surface_data(surface))\nomap_ppm_save(VAR_1, surface_data(surface),\nVAR_4->width, VAR_4->height,\nsurface_stride(surface), VAR_3);", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15, 17, 19, 21 ], [ 23 ] ]
4,574
static void con_disconnect(struct XenDevice *xendev) { struct XenConsole *con = container_of(xendev, struct XenConsole, xendev); if (!xendev->dev) { return; } if (con->chr) { qemu_chr_add_handlers(con->chr, NULL, NULL, NULL, NULL); qemu_chr_fe_release(con->chr); } xen_be_unbind_evtchn(&con->xendev); if (con->sring) { if (!xendev->gnttabdev) { munmap(con->sring, XC_PAGE_SIZE); } else { xc_gnttab_munmap(xendev->gnttabdev, con->sring, 1); } con->sring = NULL; } }
false
qemu
549e9bcabc2f5b37b0be8c24257e0b527bffb49a
static void con_disconnect(struct XenDevice *xendev) { struct XenConsole *con = container_of(xendev, struct XenConsole, xendev); if (!xendev->dev) { return; } if (con->chr) { qemu_chr_add_handlers(con->chr, NULL, NULL, NULL, NULL); qemu_chr_fe_release(con->chr); } xen_be_unbind_evtchn(&con->xendev); if (con->sring) { if (!xendev->gnttabdev) { munmap(con->sring, XC_PAGE_SIZE); } else { xc_gnttab_munmap(xendev->gnttabdev, con->sring, 1); } con->sring = NULL; } }
{ "code": [], "line_no": [] }
static void FUNC_0(struct XenDevice *VAR_0) { struct XenConsole *VAR_1 = container_of(VAR_0, struct XenConsole, VAR_0); if (!VAR_0->dev) { return; } if (VAR_1->chr) { qemu_chr_add_handlers(VAR_1->chr, NULL, NULL, NULL, NULL); qemu_chr_fe_release(VAR_1->chr); } xen_be_unbind_evtchn(&VAR_1->VAR_0); if (VAR_1->sring) { if (!VAR_0->gnttabdev) { munmap(VAR_1->sring, XC_PAGE_SIZE); } else { xc_gnttab_munmap(VAR_0->gnttabdev, VAR_1->sring, 1); } VAR_1->sring = NULL; } }
[ "static void FUNC_0(struct XenDevice *VAR_0)\n{", "struct XenConsole *VAR_1 = container_of(VAR_0, struct XenConsole, VAR_0);", "if (!VAR_0->dev) {", "return;", "}", "if (VAR_1->chr) {", "qemu_chr_add_handlers(VAR_1->chr, NULL, NULL, NULL, NULL);", "qemu_chr_fe_release(VAR_1->chr);", "}", "xen_be_unbind_evtchn(&VAR_1->VAR_0);", "if (VAR_1->sring) {", "if (!VAR_0->gnttabdev) {", "munmap(VAR_1->sring, XC_PAGE_SIZE);", "} else {", "xc_gnttab_munmap(VAR_0->gnttabdev, VAR_1->sring, 1);", "}", "VAR_1->sring = NULL;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ] ]
4,576
static int configure_input_video_filter(FilterGraph *fg, InputFilter *ifilter, AVFilterInOut *in) { AVFilterContext *last_filter; const AVFilter *buffer_filt = avfilter_get_by_name("buffer"); InputStream *ist = ifilter->ist; InputFile *f = input_files[ist->file_index]; AVRational tb = ist->framerate.num ? av_inv_q(ist->framerate) : ist->st->time_base; AVRational sar; char args[255], name[255]; int ret, pad_idx = 0; sar = ist->st->sample_aspect_ratio.num ? ist->st->sample_aspect_ratio : ist->st->codec->sample_aspect_ratio; snprintf(args, sizeof(args), "%d:%d:%d:%d:%d:%d:%d", ist->st->codec->width, ist->st->codec->height, ist->st->codec->pix_fmt, tb.num, tb.den, sar.num, sar.den); snprintf(name, sizeof(name), "graph %d input from stream %d:%d", fg->index, ist->file_index, ist->st->index); if ((ret = avfilter_graph_create_filter(&ifilter->filter, buffer_filt, name, args, NULL, fg->graph)) < 0) return ret; last_filter = ifilter->filter; if (ist->framerate.num) { AVFilterContext *setpts; snprintf(name, sizeof(name), "force CFR for input from stream %d:%d", ist->file_index, ist->st->index); if ((ret = avfilter_graph_create_filter(&setpts, avfilter_get_by_name("setpts"), name, "N", NULL, fg->graph)) < 0) return ret; if ((ret = avfilter_link(last_filter, 0, setpts, 0)) < 0) return ret; last_filter = setpts; } snprintf(name, sizeof(name), "trim for input stream %d:%d", ist->file_index, ist->st->index); ret = insert_trim(((f->start_time == AV_NOPTS_VALUE) || !f->accurate_seek) ? AV_NOPTS_VALUE : 0, INT64_MAX, &last_filter, &pad_idx, name); if (ret < 0) return ret; if ((ret = avfilter_link(last_filter, 0, in->filter_ctx, in->pad_idx)) < 0) return ret; return 0; }
false
FFmpeg
488a0fa68973d48e264d54f1722f7afb18afbea7
static int configure_input_video_filter(FilterGraph *fg, InputFilter *ifilter, AVFilterInOut *in) { AVFilterContext *last_filter; const AVFilter *buffer_filt = avfilter_get_by_name("buffer"); InputStream *ist = ifilter->ist; InputFile *f = input_files[ist->file_index]; AVRational tb = ist->framerate.num ? av_inv_q(ist->framerate) : ist->st->time_base; AVRational sar; char args[255], name[255]; int ret, pad_idx = 0; sar = ist->st->sample_aspect_ratio.num ? ist->st->sample_aspect_ratio : ist->st->codec->sample_aspect_ratio; snprintf(args, sizeof(args), "%d:%d:%d:%d:%d:%d:%d", ist->st->codec->width, ist->st->codec->height, ist->st->codec->pix_fmt, tb.num, tb.den, sar.num, sar.den); snprintf(name, sizeof(name), "graph %d input from stream %d:%d", fg->index, ist->file_index, ist->st->index); if ((ret = avfilter_graph_create_filter(&ifilter->filter, buffer_filt, name, args, NULL, fg->graph)) < 0) return ret; last_filter = ifilter->filter; if (ist->framerate.num) { AVFilterContext *setpts; snprintf(name, sizeof(name), "force CFR for input from stream %d:%d", ist->file_index, ist->st->index); if ((ret = avfilter_graph_create_filter(&setpts, avfilter_get_by_name("setpts"), name, "N", NULL, fg->graph)) < 0) return ret; if ((ret = avfilter_link(last_filter, 0, setpts, 0)) < 0) return ret; last_filter = setpts; } snprintf(name, sizeof(name), "trim for input stream %d:%d", ist->file_index, ist->st->index); ret = insert_trim(((f->start_time == AV_NOPTS_VALUE) || !f->accurate_seek) ? AV_NOPTS_VALUE : 0, INT64_MAX, &last_filter, &pad_idx, name); if (ret < 0) return ret; if ((ret = avfilter_link(last_filter, 0, in->filter_ctx, in->pad_idx)) < 0) return ret; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(FilterGraph *VAR_0, InputFilter *VAR_1, AVFilterInOut *VAR_2) { AVFilterContext *last_filter; const AVFilter *VAR_3 = avfilter_get_by_name("buffer"); InputStream *ist = VAR_1->ist; InputFile *f = input_files[ist->file_index]; AVRational tb = ist->framerate.num ? av_inv_q(ist->framerate) : ist->st->time_base; AVRational sar; char VAR_4[255], VAR_5[255]; int VAR_6, VAR_7 = 0; sar = ist->st->sample_aspect_ratio.num ? ist->st->sample_aspect_ratio : ist->st->codec->sample_aspect_ratio; snprintf(VAR_4, sizeof(VAR_4), "%d:%d:%d:%d:%d:%d:%d", ist->st->codec->width, ist->st->codec->height, ist->st->codec->pix_fmt, tb.num, tb.den, sar.num, sar.den); snprintf(VAR_5, sizeof(VAR_5), "graph %d input from stream %d:%d", VAR_0->index, ist->file_index, ist->st->index); if ((VAR_6 = avfilter_graph_create_filter(&VAR_1->filter, VAR_3, VAR_5, VAR_4, NULL, VAR_0->graph)) < 0) return VAR_6; last_filter = VAR_1->filter; if (ist->framerate.num) { AVFilterContext *setpts; snprintf(VAR_5, sizeof(VAR_5), "force CFR for input from stream %d:%d", ist->file_index, ist->st->index); if ((VAR_6 = avfilter_graph_create_filter(&setpts, avfilter_get_by_name("setpts"), VAR_5, "N", NULL, VAR_0->graph)) < 0) return VAR_6; if ((VAR_6 = avfilter_link(last_filter, 0, setpts, 0)) < 0) return VAR_6; last_filter = setpts; } snprintf(VAR_5, sizeof(VAR_5), "trim for input stream %d:%d", ist->file_index, ist->st->index); VAR_6 = insert_trim(((f->start_time == AV_NOPTS_VALUE) || !f->accurate_seek) ? AV_NOPTS_VALUE : 0, INT64_MAX, &last_filter, &VAR_7, VAR_5); if (VAR_6 < 0) return VAR_6; if ((VAR_6 = avfilter_link(last_filter, 0, VAR_2->filter_ctx, VAR_2->VAR_7)) < 0) return VAR_6; return 0; }
[ "static int FUNC_0(FilterGraph *VAR_0, InputFilter *VAR_1,\nAVFilterInOut *VAR_2)\n{", "AVFilterContext *last_filter;", "const AVFilter *VAR_3 = avfilter_get_by_name(\"buffer\");", "InputStream *ist = VAR_1->ist;", "InputFile *f = input_files[ist->file_index];", "AVRational tb = ist->framerate.num ? av_inv_q(ist->framerate) :\nist->st->time_base;", "AVRational sar;", "char VAR_4[255], VAR_5[255];", "int VAR_6, VAR_7 = 0;", "sar = ist->st->sample_aspect_ratio.num ?\nist->st->sample_aspect_ratio :\nist->st->codec->sample_aspect_ratio;", "snprintf(VAR_4, sizeof(VAR_4), \"%d:%d:%d:%d:%d:%d:%d\", ist->st->codec->width,\nist->st->codec->height, ist->st->codec->pix_fmt,\ntb.num, tb.den, sar.num, sar.den);", "snprintf(VAR_5, sizeof(VAR_5), \"graph %d input from stream %d:%d\", VAR_0->index,\nist->file_index, ist->st->index);", "if ((VAR_6 = avfilter_graph_create_filter(&VAR_1->filter, VAR_3, VAR_5,\nVAR_4, NULL, VAR_0->graph)) < 0)\nreturn VAR_6;", "last_filter = VAR_1->filter;", "if (ist->framerate.num) {", "AVFilterContext *setpts;", "snprintf(VAR_5, sizeof(VAR_5), \"force CFR for input from stream %d:%d\",\nist->file_index, ist->st->index);", "if ((VAR_6 = avfilter_graph_create_filter(&setpts,\navfilter_get_by_name(\"setpts\"),\nVAR_5, \"N\", NULL,\nVAR_0->graph)) < 0)\nreturn VAR_6;", "if ((VAR_6 = avfilter_link(last_filter, 0, setpts, 0)) < 0)\nreturn VAR_6;", "last_filter = setpts;", "}", "snprintf(VAR_5, sizeof(VAR_5), \"trim for input stream %d:%d\",\nist->file_index, ist->st->index);", "VAR_6 = insert_trim(((f->start_time == AV_NOPTS_VALUE) || !f->accurate_seek) ?\nAV_NOPTS_VALUE : 0, INT64_MAX, &last_filter, &VAR_7, VAR_5);", "if (VAR_6 < 0)\nreturn VAR_6;", "if ((VAR_6 = avfilter_link(last_filter, 0, VAR_2->filter_ctx, VAR_2->VAR_7)) < 0)\nreturn VAR_6;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15, 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27, 29, 31 ], [ 33, 35, 37 ], [ 39, 41 ], [ 45, 47, 49 ], [ 51 ], [ 55 ], [ 57 ], [ 61, 63 ], [ 65, 67, 69, 71, 73 ], [ 77, 79 ], [ 83 ], [ 85 ], [ 89, 91 ], [ 93, 95 ], [ 97, 99 ], [ 103, 105 ], [ 107 ], [ 109 ] ]
4,577
void ff_put_h264_qpel16_mc33_msa(uint8_t *dst, const uint8_t *src, ptrdiff_t stride) { avc_luma_hv_qrt_16w_msa(src + stride - 2, src - (stride * 2) + sizeof(uint8_t), stride, dst, stride, 16); }
false
FFmpeg
2aab7c2dfaca4386c38e5d565cd2bf73096bcc86
void ff_put_h264_qpel16_mc33_msa(uint8_t *dst, const uint8_t *src, ptrdiff_t stride) { avc_luma_hv_qrt_16w_msa(src + stride - 2, src - (stride * 2) + sizeof(uint8_t), stride, dst, stride, 16); }
{ "code": [], "line_no": [] }
void FUNC_0(uint8_t *VAR_0, const uint8_t *VAR_1, ptrdiff_t VAR_2) { avc_luma_hv_qrt_16w_msa(VAR_1 + VAR_2 - 2, VAR_1 - (VAR_2 * 2) + sizeof(uint8_t), VAR_2, VAR_0, VAR_2, 16); }
[ "void FUNC_0(uint8_t *VAR_0, const uint8_t *VAR_1,\nptrdiff_t VAR_2)\n{", "avc_luma_hv_qrt_16w_msa(VAR_1 + VAR_2 - 2,\nVAR_1 - (VAR_2 * 2) +\nsizeof(uint8_t), VAR_2, VAR_0, VAR_2, 16);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7, 9, 11 ], [ 13 ] ]
4,579
int qcow2_backing_read1(BlockDriverState *bs, QEMUIOVector *qiov, int64_t offset, int bytes) { uint64_t bs_size = bs->total_sectors * BDRV_SECTOR_SIZE; int n1; if ((offset + bytes) <= bs_size) { return bytes; } if (offset >= bs_size) { n1 = 0; } else { n1 = bs_size - offset; } qemu_iovec_memset(qiov, n1, 0, bytes - n1); return n1; }
true
qemu
546a7dc40e8b8b6440a052e2b5cdfe9aadcaccf6
int qcow2_backing_read1(BlockDriverState *bs, QEMUIOVector *qiov, int64_t offset, int bytes) { uint64_t bs_size = bs->total_sectors * BDRV_SECTOR_SIZE; int n1; if ((offset + bytes) <= bs_size) { return bytes; } if (offset >= bs_size) { n1 = 0; } else { n1 = bs_size - offset; } qemu_iovec_memset(qiov, n1, 0, bytes - n1); return n1; }
{ "code": [ "int qcow2_backing_read1(BlockDriverState *bs, QEMUIOVector *qiov,", " int64_t offset, int bytes)", " uint64_t bs_size = bs->total_sectors * BDRV_SECTOR_SIZE;", " int n1;", " if ((offset + bytes) <= bs_size) {", " return bytes;", " if (offset >= bs_size) {", " n1 = 0;", " } else {", " n1 = bs_size - offset;", " qemu_iovec_memset(qiov, n1, 0, bytes - n1);", " return n1;", "int qcow2_backing_read1(BlockDriverState *bs, QEMUIOVector *qiov," ], "line_no": [ 1, 3, 7, 9, 13, 15, 21, 23, 25, 27, 33, 37, 1 ] }
int FUNC_0(BlockDriverState *VAR_0, QEMUIOVector *VAR_1, int64_t VAR_2, int VAR_3) { uint64_t bs_size = VAR_0->total_sectors * BDRV_SECTOR_SIZE; int VAR_4; if ((VAR_2 + VAR_3) <= bs_size) { return VAR_3; } if (VAR_2 >= bs_size) { VAR_4 = 0; } else { VAR_4 = bs_size - VAR_2; } qemu_iovec_memset(VAR_1, VAR_4, 0, VAR_3 - VAR_4); return VAR_4; }
[ "int FUNC_0(BlockDriverState *VAR_0, QEMUIOVector *VAR_1,\nint64_t VAR_2, int VAR_3)\n{", "uint64_t bs_size = VAR_0->total_sectors * BDRV_SECTOR_SIZE;", "int VAR_4;", "if ((VAR_2 + VAR_3) <= bs_size) {", "return VAR_3;", "}", "if (VAR_2 >= bs_size) {", "VAR_4 = 0;", "} else {", "VAR_4 = bs_size - VAR_2;", "}", "qemu_iovec_memset(VAR_1, VAR_4, 0, VAR_3 - VAR_4);", "return VAR_4;", "}" ]
[ 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 37 ], [ 39 ] ]
4,581
static void property_get_bool(Object *obj, Visitor *v, void *opaque, const char *name, Error **errp) { BoolProperty *prop = opaque; bool value; value = prop->get(obj, errp); visit_type_bool(v, &value, name, errp); }
true
qemu
4715d42efe8632b0f9d2594a80e917de45e4ef88
static void property_get_bool(Object *obj, Visitor *v, void *opaque, const char *name, Error **errp) { BoolProperty *prop = opaque; bool value; value = prop->get(obj, errp); visit_type_bool(v, &value, name, errp); }
{ "code": [ " value = prop->get(obj, errp);", " value = prop->get(obj, errp);" ], "line_no": [ 13, 13 ] }
static void FUNC_0(Object *VAR_0, Visitor *VAR_1, void *VAR_2, const char *VAR_3, Error **VAR_4) { BoolProperty *prop = VAR_2; bool value; value = prop->get(VAR_0, VAR_4); visit_type_bool(VAR_1, &value, VAR_3, VAR_4); }
[ "static void FUNC_0(Object *VAR_0, Visitor *VAR_1, void *VAR_2,\nconst char *VAR_3, Error **VAR_4)\n{", "BoolProperty *prop = VAR_2;", "bool value;", "value = prop->get(VAR_0, VAR_4);", "visit_type_bool(VAR_1, &value, VAR_3, VAR_4);", "}" ]
[ 0, 0, 0, 1, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ] ]
4,582
static int read_header(ShortenContext *s) { int i, ret; int maxnlpc = 0; /* shorten signature */ if (get_bits_long(&s->gb, 32) != AV_RB32("ajkg")) { av_log(s->avctx, AV_LOG_ERROR, "missing shorten magic 'ajkg'\n"); s->lpcqoffset = 0; s->blocksize = DEFAULT_BLOCK_SIZE; s->nmean = -1; s->version = get_bits(&s->gb, 8); s->internal_ftype = get_uint(s, TYPESIZE); s->channels = get_uint(s, CHANSIZE); if (!s->channels) { av_log(s->avctx, AV_LOG_ERROR, "No channels reported\n"); if (s->channels > MAX_CHANNELS) { av_log(s->avctx, AV_LOG_ERROR, "too many channels: %d\n", s->channels); s->channels = 0; s->avctx->channels = s->channels; /* get blocksize if version > 0 */ if (s->version > 0) { int skip_bytes; unsigned blocksize; blocksize = get_uint(s, av_log2(DEFAULT_BLOCK_SIZE)); if (!blocksize || blocksize > MAX_BLOCKSIZE) { av_log(s->avctx, AV_LOG_ERROR, "invalid or unsupported block size: %d\n", blocksize); return AVERROR(EINVAL); s->blocksize = blocksize; maxnlpc = get_uint(s, LPCQSIZE); s->nmean = get_uint(s, 0); skip_bytes = get_uint(s, NSKIPSIZE); if ((unsigned)skip_bytes > get_bits_left(&s->gb)/8) { av_log(s->avctx, AV_LOG_ERROR, "invalid skip_bytes: %d\n", skip_bytes); for (i = 0; i < skip_bytes; i++) skip_bits(&s->gb, 8); s->nwrap = FFMAX(NWRAP, maxnlpc); if ((ret = allocate_buffers(s)) < 0) return ret; if ((ret = init_offset(s)) < 0) return ret; if (s->version > 1) s->lpcqoffset = V2LPCQOFFSET; if (s->avctx->extradata_size > 0) goto end; if (get_ur_golomb_shorten(&s->gb, FNSIZE) != FN_VERBATIM) { av_log(s->avctx, AV_LOG_ERROR, "missing verbatim section at beginning of stream\n"); s->header_size = get_ur_golomb_shorten(&s->gb, VERBATIM_CKSIZE_SIZE); if (s->header_size >= OUT_BUFFER_SIZE || s->header_size < CANONICAL_HEADER_SIZE) { av_log(s->avctx, AV_LOG_ERROR, "header is wrong size: %d\n", s->header_size); for (i = 0; i < s->header_size; i++) s->header[i] = (char)get_ur_golomb_shorten(&s->gb, VERBATIM_BYTE_SIZE); if (AV_RL32(s->header) == MKTAG('R','I','F','F')) { if ((ret = decode_wave_header(s->avctx, s->header, s->header_size)) < 0) return ret; } else if (AV_RL32(s->header) == MKTAG('F','O','R','M')) { if ((ret = decode_aiff_header(s->avctx, s->header, s->header_size)) < 0) return ret; } else { avpriv_report_missing_feature(s->avctx, "unsupported bit packing %" PRIX32, AV_RL32(s->header)); return AVERROR_PATCHWELCOME; end: s->cur_chan = 0; s->bitshift = 0; s->got_header = 1; return 0;
true
FFmpeg
e77ddd31a8e14bcf5eccd6008d866ae90b4b0d4c
static int read_header(ShortenContext *s) { int i, ret; int maxnlpc = 0; if (get_bits_long(&s->gb, 32) != AV_RB32("ajkg")) { av_log(s->avctx, AV_LOG_ERROR, "missing shorten magic 'ajkg'\n"); s->lpcqoffset = 0; s->blocksize = DEFAULT_BLOCK_SIZE; s->nmean = -1; s->version = get_bits(&s->gb, 8); s->internal_ftype = get_uint(s, TYPESIZE); s->channels = get_uint(s, CHANSIZE); if (!s->channels) { av_log(s->avctx, AV_LOG_ERROR, "No channels reported\n"); if (s->channels > MAX_CHANNELS) { av_log(s->avctx, AV_LOG_ERROR, "too many channels: %d\n", s->channels); s->channels = 0; s->avctx->channels = s->channels; if (s->version > 0) { int skip_bytes; unsigned blocksize; blocksize = get_uint(s, av_log2(DEFAULT_BLOCK_SIZE)); if (!blocksize || blocksize > MAX_BLOCKSIZE) { av_log(s->avctx, AV_LOG_ERROR, "invalid or unsupported block size: %d\n", blocksize); return AVERROR(EINVAL); s->blocksize = blocksize; maxnlpc = get_uint(s, LPCQSIZE); s->nmean = get_uint(s, 0); skip_bytes = get_uint(s, NSKIPSIZE); if ((unsigned)skip_bytes > get_bits_left(&s->gb)/8) { av_log(s->avctx, AV_LOG_ERROR, "invalid skip_bytes: %d\n", skip_bytes); for (i = 0; i < skip_bytes; i++) skip_bits(&s->gb, 8); s->nwrap = FFMAX(NWRAP, maxnlpc); if ((ret = allocate_buffers(s)) < 0) return ret; if ((ret = init_offset(s)) < 0) return ret; if (s->version > 1) s->lpcqoffset = V2LPCQOFFSET; if (s->avctx->extradata_size > 0) goto end; if (get_ur_golomb_shorten(&s->gb, FNSIZE) != FN_VERBATIM) { av_log(s->avctx, AV_LOG_ERROR, "missing verbatim section at beginning of stream\n"); s->header_size = get_ur_golomb_shorten(&s->gb, VERBATIM_CKSIZE_SIZE); if (s->header_size >= OUT_BUFFER_SIZE || s->header_size < CANONICAL_HEADER_SIZE) { av_log(s->avctx, AV_LOG_ERROR, "header is wrong size: %d\n", s->header_size); for (i = 0; i < s->header_size; i++) s->header[i] = (char)get_ur_golomb_shorten(&s->gb, VERBATIM_BYTE_SIZE); if (AV_RL32(s->header) == MKTAG('R','I','F','F')) { if ((ret = decode_wave_header(s->avctx, s->header, s->header_size)) < 0) return ret; } else if (AV_RL32(s->header) == MKTAG('F','O','R','M')) { if ((ret = decode_aiff_header(s->avctx, s->header, s->header_size)) < 0) return ret; } else { avpriv_report_missing_feature(s->avctx, "unsupported bit packing %" PRIX32, AV_RL32(s->header)); return AVERROR_PATCHWELCOME; end: s->cur_chan = 0; s->bitshift = 0; s->got_header = 1; return 0;
{ "code": [], "line_no": [] }
static int FUNC_0(ShortenContext *VAR_0) { int VAR_1, VAR_2; int VAR_3 = 0; if (get_bits_long(&VAR_0->gb, 32) != AV_RB32("ajkg")) { av_log(VAR_0->avctx, AV_LOG_ERROR, "missing shorten magic 'ajkg'\n"); VAR_0->lpcqoffset = 0; VAR_0->VAR_5 = DEFAULT_BLOCK_SIZE; VAR_0->nmean = -1; VAR_0->version = get_bits(&VAR_0->gb, 8); VAR_0->internal_ftype = get_uint(VAR_0, TYPESIZE); VAR_0->channels = get_uint(VAR_0, CHANSIZE); if (!VAR_0->channels) { av_log(VAR_0->avctx, AV_LOG_ERROR, "No channels reported\n"); if (VAR_0->channels > MAX_CHANNELS) { av_log(VAR_0->avctx, AV_LOG_ERROR, "too many channels: %d\n", VAR_0->channels); VAR_0->channels = 0; VAR_0->avctx->channels = VAR_0->channels; if (VAR_0->version > 0) { int VAR_4; unsigned VAR_5; VAR_5 = get_uint(VAR_0, av_log2(DEFAULT_BLOCK_SIZE)); if (!VAR_5 || VAR_5 > MAX_BLOCKSIZE) { av_log(VAR_0->avctx, AV_LOG_ERROR, "invalid or unsupported block size: %d\n", VAR_5); return AVERROR(EINVAL); VAR_0->VAR_5 = VAR_5; VAR_3 = get_uint(VAR_0, LPCQSIZE); VAR_0->nmean = get_uint(VAR_0, 0); VAR_4 = get_uint(VAR_0, NSKIPSIZE); if ((unsigned)VAR_4 > get_bits_left(&VAR_0->gb)/8) { av_log(VAR_0->avctx, AV_LOG_ERROR, "invalid VAR_4: %d\n", VAR_4); for (VAR_1 = 0; VAR_1 < VAR_4; VAR_1++) skip_bits(&VAR_0->gb, 8); VAR_0->nwrap = FFMAX(NWRAP, VAR_3); if ((VAR_2 = allocate_buffers(VAR_0)) < 0) return VAR_2; if ((VAR_2 = init_offset(VAR_0)) < 0) return VAR_2; if (VAR_0->version > 1) VAR_0->lpcqoffset = V2LPCQOFFSET; if (VAR_0->avctx->extradata_size > 0) goto end; if (get_ur_golomb_shorten(&VAR_0->gb, FNSIZE) != FN_VERBATIM) { av_log(VAR_0->avctx, AV_LOG_ERROR, "missing verbatim section at beginning of stream\n"); VAR_0->header_size = get_ur_golomb_shorten(&VAR_0->gb, VERBATIM_CKSIZE_SIZE); if (VAR_0->header_size >= OUT_BUFFER_SIZE || VAR_0->header_size < CANONICAL_HEADER_SIZE) { av_log(VAR_0->avctx, AV_LOG_ERROR, "header is wrong size: %d\n", VAR_0->header_size); for (VAR_1 = 0; VAR_1 < VAR_0->header_size; VAR_1++) VAR_0->header[VAR_1] = (char)get_ur_golomb_shorten(&VAR_0->gb, VERBATIM_BYTE_SIZE); if (AV_RL32(VAR_0->header) == MKTAG('R','I','F','F')) { if ((VAR_2 = decode_wave_header(VAR_0->avctx, VAR_0->header, VAR_0->header_size)) < 0) return VAR_2; } else if (AV_RL32(VAR_0->header) == MKTAG('F','O','R','M')) { if ((VAR_2 = decode_aiff_header(VAR_0->avctx, VAR_0->header, VAR_0->header_size)) < 0) return VAR_2; } else { avpriv_report_missing_feature(VAR_0->avctx, "unsupported bit packing %" PRIX32, AV_RL32(VAR_0->header)); return AVERROR_PATCHWELCOME; end: VAR_0->cur_chan = 0; VAR_0->bitshift = 0; VAR_0->got_header = 1; return 0;
[ "static int FUNC_0(ShortenContext *VAR_0)\n{", "int VAR_1, VAR_2;", "int VAR_3 = 0;", "if (get_bits_long(&VAR_0->gb, 32) != AV_RB32(\"ajkg\")) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"missing shorten magic 'ajkg'\\n\");", "VAR_0->lpcqoffset = 0;", "VAR_0->VAR_5 = DEFAULT_BLOCK_SIZE;", "VAR_0->nmean = -1;", "VAR_0->version = get_bits(&VAR_0->gb, 8);", "VAR_0->internal_ftype = get_uint(VAR_0, TYPESIZE);", "VAR_0->channels = get_uint(VAR_0, CHANSIZE);", "if (!VAR_0->channels) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"No channels reported\\n\");", "if (VAR_0->channels > MAX_CHANNELS) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"too many channels: %d\\n\", VAR_0->channels);", "VAR_0->channels = 0;", "VAR_0->avctx->channels = VAR_0->channels;", "if (VAR_0->version > 0) {", "int VAR_4;", "unsigned VAR_5;", "VAR_5 = get_uint(VAR_0, av_log2(DEFAULT_BLOCK_SIZE));", "if (!VAR_5 || VAR_5 > MAX_BLOCKSIZE) {", "av_log(VAR_0->avctx, AV_LOG_ERROR,\n\"invalid or unsupported block size: %d\\n\",\nVAR_5);", "return AVERROR(EINVAL);", "VAR_0->VAR_5 = VAR_5;", "VAR_3 = get_uint(VAR_0, LPCQSIZE);", "VAR_0->nmean = get_uint(VAR_0, 0);", "VAR_4 = get_uint(VAR_0, NSKIPSIZE);", "if ((unsigned)VAR_4 > get_bits_left(&VAR_0->gb)/8) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"invalid VAR_4: %d\\n\", VAR_4);", "for (VAR_1 = 0; VAR_1 < VAR_4; VAR_1++)", "skip_bits(&VAR_0->gb, 8);", "VAR_0->nwrap = FFMAX(NWRAP, VAR_3);", "if ((VAR_2 = allocate_buffers(VAR_0)) < 0)\nreturn VAR_2;", "if ((VAR_2 = init_offset(VAR_0)) < 0)\nreturn VAR_2;", "if (VAR_0->version > 1)\nVAR_0->lpcqoffset = V2LPCQOFFSET;", "if (VAR_0->avctx->extradata_size > 0)\ngoto end;", "if (get_ur_golomb_shorten(&VAR_0->gb, FNSIZE) != FN_VERBATIM) {", "av_log(VAR_0->avctx, AV_LOG_ERROR,\n\"missing verbatim section at beginning of stream\\n\");", "VAR_0->header_size = get_ur_golomb_shorten(&VAR_0->gb, VERBATIM_CKSIZE_SIZE);", "if (VAR_0->header_size >= OUT_BUFFER_SIZE ||\nVAR_0->header_size < CANONICAL_HEADER_SIZE) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"header is wrong size: %d\\n\",\nVAR_0->header_size);", "for (VAR_1 = 0; VAR_1 < VAR_0->header_size; VAR_1++)", "VAR_0->header[VAR_1] = (char)get_ur_golomb_shorten(&VAR_0->gb, VERBATIM_BYTE_SIZE);", "if (AV_RL32(VAR_0->header) == MKTAG('R','I','F','F')) {", "if ((VAR_2 = decode_wave_header(VAR_0->avctx, VAR_0->header, VAR_0->header_size)) < 0)\nreturn VAR_2;", "} else if (AV_RL32(VAR_0->header) == MKTAG('F','O','R','M')) {", "if ((VAR_2 = decode_aiff_header(VAR_0->avctx, VAR_0->header, VAR_0->header_size)) < 0)\nreturn VAR_2;", "} else {", "avpriv_report_missing_feature(VAR_0->avctx, \"unsupported bit packing %\"\nPRIX32, AV_RL32(VAR_0->header));", "return AVERROR_PATCHWELCOME;", "end:\nVAR_0->cur_chan = 0;", "VAR_0->bitshift = 0;", "VAR_0->got_header = 1;", "return 0;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 65, 67, 69 ], [ 71 ], [ 74 ], [ 78 ], [ 84 ], [ 88 ], [ 90 ], [ 92 ], [ 98 ], [ 100 ], [ 103 ], [ 107, 109 ], [ 113, 115 ], [ 119, 121 ], [ 125, 127 ], [ 131 ], [ 133, 135 ], [ 141 ], [ 143, 145 ], [ 147, 149 ], [ 155 ], [ 157 ], [ 161 ], [ 163, 165 ], [ 167 ], [ 169, 171 ], [ 173 ], [ 175, 177 ], [ 179 ], [ 184, 186 ], [ 188 ], [ 192 ], [ 196 ] ]
4,584
int avcodec_get_pix_fmt_loss(enum PixelFormat dst_pix_fmt, enum PixelFormat src_pix_fmt, int has_alpha) { const PixFmtInfo *pf, *ps; const AVPixFmtDescriptor *src_desc = &av_pix_fmt_descriptors[src_pix_fmt]; const AVPixFmtDescriptor *dst_desc = &av_pix_fmt_descriptors[dst_pix_fmt]; int loss; ps = &pix_fmt_info[src_pix_fmt]; /* compute loss */ loss = 0; pf = &pix_fmt_info[dst_pix_fmt]; if (pf->depth < ps->depth || ((dst_pix_fmt == PIX_FMT_RGB555BE || dst_pix_fmt == PIX_FMT_RGB555LE || dst_pix_fmt == PIX_FMT_BGR555BE || dst_pix_fmt == PIX_FMT_BGR555LE) && (src_pix_fmt == PIX_FMT_RGB565BE || src_pix_fmt == PIX_FMT_RGB565LE || src_pix_fmt == PIX_FMT_BGR565BE || src_pix_fmt == PIX_FMT_BGR565LE))) loss |= FF_LOSS_DEPTH; if (dst_desc->log2_chroma_w > src_desc->log2_chroma_w || dst_desc->log2_chroma_h > src_desc->log2_chroma_h) loss |= FF_LOSS_RESOLUTION; switch(pf->color_type) { case FF_COLOR_RGB: if (ps->color_type != FF_COLOR_RGB && ps->color_type != FF_COLOR_GRAY) loss |= FF_LOSS_COLORSPACE; break; case FF_COLOR_GRAY: if (ps->color_type != FF_COLOR_GRAY) loss |= FF_LOSS_COLORSPACE; break; case FF_COLOR_YUV: if (ps->color_type != FF_COLOR_YUV) loss |= FF_LOSS_COLORSPACE; break; case FF_COLOR_YUV_JPEG: if (ps->color_type != FF_COLOR_YUV_JPEG && ps->color_type != FF_COLOR_YUV && ps->color_type != FF_COLOR_GRAY) loss |= FF_LOSS_COLORSPACE; break; default: /* fail safe test */ if (ps->color_type != pf->color_type) loss |= FF_LOSS_COLORSPACE; break; } if (pf->color_type == FF_COLOR_GRAY && ps->color_type != FF_COLOR_GRAY) loss |= FF_LOSS_CHROMA; if (!pf->is_alpha && (ps->is_alpha && has_alpha)) loss |= FF_LOSS_ALPHA; if (pf->pixel_type == FF_PIXEL_PALETTE && (ps->pixel_type != FF_PIXEL_PALETTE && ps->color_type != FF_COLOR_GRAY)) loss |= FF_LOSS_COLORQUANT; return loss; }
false
FFmpeg
d7e14c0d103a2c9cca6c50568e09b40d6f48ea19
int avcodec_get_pix_fmt_loss(enum PixelFormat dst_pix_fmt, enum PixelFormat src_pix_fmt, int has_alpha) { const PixFmtInfo *pf, *ps; const AVPixFmtDescriptor *src_desc = &av_pix_fmt_descriptors[src_pix_fmt]; const AVPixFmtDescriptor *dst_desc = &av_pix_fmt_descriptors[dst_pix_fmt]; int loss; ps = &pix_fmt_info[src_pix_fmt]; loss = 0; pf = &pix_fmt_info[dst_pix_fmt]; if (pf->depth < ps->depth || ((dst_pix_fmt == PIX_FMT_RGB555BE || dst_pix_fmt == PIX_FMT_RGB555LE || dst_pix_fmt == PIX_FMT_BGR555BE || dst_pix_fmt == PIX_FMT_BGR555LE) && (src_pix_fmt == PIX_FMT_RGB565BE || src_pix_fmt == PIX_FMT_RGB565LE || src_pix_fmt == PIX_FMT_BGR565BE || src_pix_fmt == PIX_FMT_BGR565LE))) loss |= FF_LOSS_DEPTH; if (dst_desc->log2_chroma_w > src_desc->log2_chroma_w || dst_desc->log2_chroma_h > src_desc->log2_chroma_h) loss |= FF_LOSS_RESOLUTION; switch(pf->color_type) { case FF_COLOR_RGB: if (ps->color_type != FF_COLOR_RGB && ps->color_type != FF_COLOR_GRAY) loss |= FF_LOSS_COLORSPACE; break; case FF_COLOR_GRAY: if (ps->color_type != FF_COLOR_GRAY) loss |= FF_LOSS_COLORSPACE; break; case FF_COLOR_YUV: if (ps->color_type != FF_COLOR_YUV) loss |= FF_LOSS_COLORSPACE; break; case FF_COLOR_YUV_JPEG: if (ps->color_type != FF_COLOR_YUV_JPEG && ps->color_type != FF_COLOR_YUV && ps->color_type != FF_COLOR_GRAY) loss |= FF_LOSS_COLORSPACE; break; default: if (ps->color_type != pf->color_type) loss |= FF_LOSS_COLORSPACE; break; } if (pf->color_type == FF_COLOR_GRAY && ps->color_type != FF_COLOR_GRAY) loss |= FF_LOSS_CHROMA; if (!pf->is_alpha && (ps->is_alpha && has_alpha)) loss |= FF_LOSS_ALPHA; if (pf->pixel_type == FF_PIXEL_PALETTE && (ps->pixel_type != FF_PIXEL_PALETTE && ps->color_type != FF_COLOR_GRAY)) loss |= FF_LOSS_COLORQUANT; return loss; }
{ "code": [], "line_no": [] }
int FUNC_0(enum PixelFormat VAR_0, enum PixelFormat VAR_1, int VAR_2) { const PixFmtInfo *VAR_3, *ps; const AVPixFmtDescriptor *VAR_4 = &av_pix_fmt_descriptors[VAR_1]; const AVPixFmtDescriptor *VAR_5 = &av_pix_fmt_descriptors[VAR_0]; int VAR_6; ps = &pix_fmt_info[VAR_1]; VAR_6 = 0; VAR_3 = &pix_fmt_info[VAR_0]; if (VAR_3->depth < ps->depth || ((VAR_0 == PIX_FMT_RGB555BE || VAR_0 == PIX_FMT_RGB555LE || VAR_0 == PIX_FMT_BGR555BE || VAR_0 == PIX_FMT_BGR555LE) && (VAR_1 == PIX_FMT_RGB565BE || VAR_1 == PIX_FMT_RGB565LE || VAR_1 == PIX_FMT_BGR565BE || VAR_1 == PIX_FMT_BGR565LE))) VAR_6 |= FF_LOSS_DEPTH; if (VAR_5->log2_chroma_w > VAR_4->log2_chroma_w || VAR_5->log2_chroma_h > VAR_4->log2_chroma_h) VAR_6 |= FF_LOSS_RESOLUTION; switch(VAR_3->color_type) { case FF_COLOR_RGB: if (ps->color_type != FF_COLOR_RGB && ps->color_type != FF_COLOR_GRAY) VAR_6 |= FF_LOSS_COLORSPACE; break; case FF_COLOR_GRAY: if (ps->color_type != FF_COLOR_GRAY) VAR_6 |= FF_LOSS_COLORSPACE; break; case FF_COLOR_YUV: if (ps->color_type != FF_COLOR_YUV) VAR_6 |= FF_LOSS_COLORSPACE; break; case FF_COLOR_YUV_JPEG: if (ps->color_type != FF_COLOR_YUV_JPEG && ps->color_type != FF_COLOR_YUV && ps->color_type != FF_COLOR_GRAY) VAR_6 |= FF_LOSS_COLORSPACE; break; default: if (ps->color_type != VAR_3->color_type) VAR_6 |= FF_LOSS_COLORSPACE; break; } if (VAR_3->color_type == FF_COLOR_GRAY && ps->color_type != FF_COLOR_GRAY) VAR_6 |= FF_LOSS_CHROMA; if (!VAR_3->is_alpha && (ps->is_alpha && VAR_2)) VAR_6 |= FF_LOSS_ALPHA; if (VAR_3->pixel_type == FF_PIXEL_PALETTE && (ps->pixel_type != FF_PIXEL_PALETTE && ps->color_type != FF_COLOR_GRAY)) VAR_6 |= FF_LOSS_COLORQUANT; return VAR_6; }
[ "int FUNC_0(enum PixelFormat VAR_0, enum PixelFormat VAR_1,\nint VAR_2)\n{", "const PixFmtInfo *VAR_3, *ps;", "const AVPixFmtDescriptor *VAR_4 = &av_pix_fmt_descriptors[VAR_1];", "const AVPixFmtDescriptor *VAR_5 = &av_pix_fmt_descriptors[VAR_0];", "int VAR_6;", "ps = &pix_fmt_info[VAR_1];", "VAR_6 = 0;", "VAR_3 = &pix_fmt_info[VAR_0];", "if (VAR_3->depth < ps->depth ||\n((VAR_0 == PIX_FMT_RGB555BE || VAR_0 == PIX_FMT_RGB555LE ||\nVAR_0 == PIX_FMT_BGR555BE || VAR_0 == PIX_FMT_BGR555LE) &&\n(VAR_1 == PIX_FMT_RGB565BE || VAR_1 == PIX_FMT_RGB565LE ||\nVAR_1 == PIX_FMT_BGR565BE || VAR_1 == PIX_FMT_BGR565LE)))\nVAR_6 |= FF_LOSS_DEPTH;", "if (VAR_5->log2_chroma_w > VAR_4->log2_chroma_w ||\nVAR_5->log2_chroma_h > VAR_4->log2_chroma_h)\nVAR_6 |= FF_LOSS_RESOLUTION;", "switch(VAR_3->color_type) {", "case FF_COLOR_RGB:\nif (ps->color_type != FF_COLOR_RGB &&\nps->color_type != FF_COLOR_GRAY)\nVAR_6 |= FF_LOSS_COLORSPACE;", "break;", "case FF_COLOR_GRAY:\nif (ps->color_type != FF_COLOR_GRAY)\nVAR_6 |= FF_LOSS_COLORSPACE;", "break;", "case FF_COLOR_YUV:\nif (ps->color_type != FF_COLOR_YUV)\nVAR_6 |= FF_LOSS_COLORSPACE;", "break;", "case FF_COLOR_YUV_JPEG:\nif (ps->color_type != FF_COLOR_YUV_JPEG &&\nps->color_type != FF_COLOR_YUV &&\nps->color_type != FF_COLOR_GRAY)\nVAR_6 |= FF_LOSS_COLORSPACE;", "break;", "default:\nif (ps->color_type != VAR_3->color_type)\nVAR_6 |= FF_LOSS_COLORSPACE;", "break;", "}", "if (VAR_3->color_type == FF_COLOR_GRAY &&\nps->color_type != FF_COLOR_GRAY)\nVAR_6 |= FF_LOSS_CHROMA;", "if (!VAR_3->is_alpha && (ps->is_alpha && VAR_2))\nVAR_6 |= FF_LOSS_ALPHA;", "if (VAR_3->pixel_type == FF_PIXEL_PALETTE &&\n(ps->pixel_type != FF_PIXEL_PALETTE && ps->color_type != FF_COLOR_GRAY))\nVAR_6 |= FF_LOSS_COLORQUANT;", "return VAR_6;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 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 ], [ 97, 99, 101 ], [ 103, 105 ], [ 107, 109, 111 ], [ 113 ], [ 115 ] ]
4,585
static void svq1_parse_string(GetBitContext *bitbuf, uint8_t *out) { uint8_t seed; int i; out[0] = get_bits(bitbuf, 8); seed = string_table[out[0]]; for (i = 1; i <= out[0]; i++) { out[i] = get_bits(bitbuf, 8) ^ seed; seed = string_table[out[i] ^ seed]; } }
false
FFmpeg
e91ba2efa949470e9157b652535d207a101f91e0
static void svq1_parse_string(GetBitContext *bitbuf, uint8_t *out) { uint8_t seed; int i; out[0] = get_bits(bitbuf, 8); seed = string_table[out[0]]; for (i = 1; i <= out[0]; i++) { out[i] = get_bits(bitbuf, 8) ^ seed; seed = string_table[out[i] ^ seed]; } }
{ "code": [], "line_no": [] }
static void FUNC_0(GetBitContext *VAR_0, uint8_t *VAR_1) { uint8_t seed; int VAR_2; VAR_1[0] = get_bits(VAR_0, 8); seed = string_table[VAR_1[0]]; for (VAR_2 = 1; VAR_2 <= VAR_1[0]; VAR_2++) { VAR_1[VAR_2] = get_bits(VAR_0, 8) ^ seed; seed = string_table[VAR_1[VAR_2] ^ seed]; } }
[ "static void FUNC_0(GetBitContext *VAR_0, uint8_t *VAR_1)\n{", "uint8_t seed;", "int VAR_2;", "VAR_1[0] = get_bits(VAR_0, 8);", "seed = string_table[VAR_1[0]];", "for (VAR_2 = 1; VAR_2 <= VAR_1[0]; VAR_2++) {", "VAR_1[VAR_2] = get_bits(VAR_0, 8) ^ seed;", "seed = string_table[VAR_1[VAR_2] ^ seed];", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ] ]
4,586
static int vda_h264_end_frame(AVCodecContext *avctx) { H264Context *h = avctx->priv_data; VDAContext *vda = avctx->internal->hwaccel_priv_data; AVVDAContext *vda_ctx = avctx->hwaccel_context; AVFrame *frame = h->cur_pic_ptr->f; uint32_t flush_flags = 1 << 0; ///< kVDADecoderFlush_emitFrames CFDataRef coded_frame; OSStatus status; if (!vda->bitstream_size) return AVERROR_INVALIDDATA; coded_frame = CFDataCreate(kCFAllocatorDefault, vda->bitstream, vda->bitstream_size); status = VDADecoderDecode(vda_ctx->decoder, 0, coded_frame, NULL); if (status == kVDADecoderNoErr) status = VDADecoderFlush(vda_ctx->decoder, flush_flags); CFRelease(coded_frame); if (!vda->frame) return AVERROR_UNKNOWN; if (status != kVDADecoderNoErr) { av_log(avctx, AV_LOG_ERROR, "Failed to decode frame (%d)\n", status); return AVERROR_UNKNOWN; } av_buffer_unref(&frame->buf[0]); frame->buf[0] = av_buffer_create((uint8_t*)vda->frame, sizeof(vda->frame), release_buffer, NULL, AV_BUFFER_FLAG_READONLY); if (!frame->buf) return AVERROR(ENOMEM); frame->data[3] = (uint8_t*)vda->frame; vda->frame = NULL; return 0; }
false
FFmpeg
80f955c90867561dcce769216bc497e13281eb38
static int vda_h264_end_frame(AVCodecContext *avctx) { H264Context *h = avctx->priv_data; VDAContext *vda = avctx->internal->hwaccel_priv_data; AVVDAContext *vda_ctx = avctx->hwaccel_context; AVFrame *frame = h->cur_pic_ptr->f; uint32_t flush_flags = 1 << 0; CFDataRef coded_frame; OSStatus status; if (!vda->bitstream_size) return AVERROR_INVALIDDATA; coded_frame = CFDataCreate(kCFAllocatorDefault, vda->bitstream, vda->bitstream_size); status = VDADecoderDecode(vda_ctx->decoder, 0, coded_frame, NULL); if (status == kVDADecoderNoErr) status = VDADecoderFlush(vda_ctx->decoder, flush_flags); CFRelease(coded_frame); if (!vda->frame) return AVERROR_UNKNOWN; if (status != kVDADecoderNoErr) { av_log(avctx, AV_LOG_ERROR, "Failed to decode frame (%d)\n", status); return AVERROR_UNKNOWN; } av_buffer_unref(&frame->buf[0]); frame->buf[0] = av_buffer_create((uint8_t*)vda->frame, sizeof(vda->frame), release_buffer, NULL, AV_BUFFER_FLAG_READONLY); if (!frame->buf) return AVERROR(ENOMEM); frame->data[3] = (uint8_t*)vda->frame; vda->frame = NULL; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0) { H264Context *h = VAR_0->priv_data; VDAContext *vda = VAR_0->internal->hwaccel_priv_data; AVVDAContext *vda_ctx = VAR_0->hwaccel_context; AVFrame *frame = h->cur_pic_ptr->f; uint32_t flush_flags = 1 << 0; CFDataRef coded_frame; OSStatus status; if (!vda->bitstream_size) return AVERROR_INVALIDDATA; coded_frame = CFDataCreate(kCFAllocatorDefault, vda->bitstream, vda->bitstream_size); status = VDADecoderDecode(vda_ctx->decoder, 0, coded_frame, NULL); if (status == kVDADecoderNoErr) status = VDADecoderFlush(vda_ctx->decoder, flush_flags); CFRelease(coded_frame); if (!vda->frame) return AVERROR_UNKNOWN; if (status != kVDADecoderNoErr) { av_log(VAR_0, AV_LOG_ERROR, "Failed to decode frame (%d)\n", status); return AVERROR_UNKNOWN; } av_buffer_unref(&frame->buf[0]); frame->buf[0] = av_buffer_create((uint8_t*)vda->frame, sizeof(vda->frame), release_buffer, NULL, AV_BUFFER_FLAG_READONLY); if (!frame->buf) return AVERROR(ENOMEM); frame->data[3] = (uint8_t*)vda->frame; vda->frame = NULL; return 0; }
[ "static int FUNC_0(AVCodecContext *VAR_0)\n{", "H264Context *h = VAR_0->priv_data;", "VDAContext *vda = VAR_0->internal->hwaccel_priv_data;", "AVVDAContext *vda_ctx = VAR_0->hwaccel_context;", "AVFrame *frame = h->cur_pic_ptr->f;", "uint32_t flush_flags = 1 << 0;", "CFDataRef coded_frame;", "OSStatus status;", "if (!vda->bitstream_size)\nreturn AVERROR_INVALIDDATA;", "coded_frame = CFDataCreate(kCFAllocatorDefault,\nvda->bitstream,\nvda->bitstream_size);", "status = VDADecoderDecode(vda_ctx->decoder, 0, coded_frame, NULL);", "if (status == kVDADecoderNoErr)\nstatus = VDADecoderFlush(vda_ctx->decoder, flush_flags);", "CFRelease(coded_frame);", "if (!vda->frame)\nreturn AVERROR_UNKNOWN;", "if (status != kVDADecoderNoErr) {", "av_log(VAR_0, AV_LOG_ERROR, \"Failed to decode frame (%d)\\n\", status);", "return AVERROR_UNKNOWN;", "}", "av_buffer_unref(&frame->buf[0]);", "frame->buf[0] = av_buffer_create((uint8_t*)vda->frame,\nsizeof(vda->frame),\nrelease_buffer, NULL,\nAV_BUFFER_FLAG_READONLY);", "if (!frame->buf)\nreturn AVERROR(ENOMEM);", "frame->data[3] = (uint8_t*)vda->frame;", "vda->frame = NULL;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21, 23 ], [ 29, 31, 33 ], [ 37 ], [ 41, 43 ], [ 47 ], [ 51, 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 71, 73, 75, 77 ], [ 79, 81 ], [ 85 ], [ 87 ], [ 91 ], [ 93 ] ]
4,587
int img_pad(AVPicture *dst, const AVPicture *src, int height, int width, int pix_fmt, int padtop, int padbottom, int padleft, int padright, int *color) { uint8_t *optr, *iptr; int y_shift; int x_shift; int yheight; int i, y; if (pix_fmt < 0 || pix_fmt >= PIX_FMT_NB || !is_yuv_planar(&pix_fmt_info[pix_fmt])) return -1; for (i = 0; i < 3; i++) { x_shift = i ? pix_fmt_info[pix_fmt].x_chroma_shift : 0; y_shift = i ? pix_fmt_info[pix_fmt].y_chroma_shift : 0; if (padtop || padleft) { memset(dst->data[i], color[i], dst->linesize[i] * (padtop >> y_shift) + (padleft >> x_shift)); } if (padleft || padright || src) { if (src) { /* first line */ iptr = src->data[i]; optr = dst->data[i] + dst->linesize[i] * (padtop >> y_shift) + (padleft >> x_shift); memcpy(optr, iptr, src->linesize[i]); iptr += src->linesize[i]; } optr = dst->data[i] + dst->linesize[i] * (padtop >> y_shift) + (dst->linesize[i] - (padright >> x_shift)); yheight = (height - 1 - (padtop + padbottom)) >> y_shift; for (y = 0; y < yheight; y++) { memset(optr, color[i], (padleft + padright) >> x_shift); if (src) { memcpy(optr + ((padleft + padright) >> x_shift), iptr, src->linesize[i]); iptr += src->linesize[i]; } optr += dst->linesize[i]; } } if (padbottom || padright) { optr = dst->data[i] + dst->linesize[i] * ((height - padbottom) >> y_shift) - (padright >> x_shift); memset(optr, color[i],dst->linesize[i] * (padbottom >> y_shift) + (padright >> x_shift)); } } return 0; }
false
FFmpeg
79acfb0e133317c3a38c55b73c3b80f3212af2f9
int img_pad(AVPicture *dst, const AVPicture *src, int height, int width, int pix_fmt, int padtop, int padbottom, int padleft, int padright, int *color) { uint8_t *optr, *iptr; int y_shift; int x_shift; int yheight; int i, y; if (pix_fmt < 0 || pix_fmt >= PIX_FMT_NB || !is_yuv_planar(&pix_fmt_info[pix_fmt])) return -1; for (i = 0; i < 3; i++) { x_shift = i ? pix_fmt_info[pix_fmt].x_chroma_shift : 0; y_shift = i ? pix_fmt_info[pix_fmt].y_chroma_shift : 0; if (padtop || padleft) { memset(dst->data[i], color[i], dst->linesize[i] * (padtop >> y_shift) + (padleft >> x_shift)); } if (padleft || padright || src) { if (src) { iptr = src->data[i]; optr = dst->data[i] + dst->linesize[i] * (padtop >> y_shift) + (padleft >> x_shift); memcpy(optr, iptr, src->linesize[i]); iptr += src->linesize[i]; } optr = dst->data[i] + dst->linesize[i] * (padtop >> y_shift) + (dst->linesize[i] - (padright >> x_shift)); yheight = (height - 1 - (padtop + padbottom)) >> y_shift; for (y = 0; y < yheight; y++) { memset(optr, color[i], (padleft + padright) >> x_shift); if (src) { memcpy(optr + ((padleft + padright) >> x_shift), iptr, src->linesize[i]); iptr += src->linesize[i]; } optr += dst->linesize[i]; } } if (padbottom || padright) { optr = dst->data[i] + dst->linesize[i] * ((height - padbottom) >> y_shift) - (padright >> x_shift); memset(optr, color[i],dst->linesize[i] * (padbottom >> y_shift) + (padright >> x_shift)); } } return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(AVPicture *VAR_0, const AVPicture *VAR_1, int VAR_2, int VAR_3, int VAR_4, int VAR_5, int VAR_6, int VAR_7, int VAR_8, int *VAR_9) { uint8_t *optr, *iptr; int VAR_10; int VAR_11; int VAR_12; int VAR_13, VAR_14; if (VAR_4 < 0 || VAR_4 >= PIX_FMT_NB || !is_yuv_planar(&pix_fmt_info[VAR_4])) return -1; for (VAR_13 = 0; VAR_13 < 3; VAR_13++) { VAR_11 = VAR_13 ? pix_fmt_info[VAR_4].x_chroma_shift : 0; VAR_10 = VAR_13 ? pix_fmt_info[VAR_4].y_chroma_shift : 0; if (VAR_5 || VAR_7) { memset(VAR_0->data[VAR_13], VAR_9[VAR_13], VAR_0->linesize[VAR_13] * (VAR_5 >> VAR_10) + (VAR_7 >> VAR_11)); } if (VAR_7 || VAR_8 || VAR_1) { if (VAR_1) { iptr = VAR_1->data[VAR_13]; optr = VAR_0->data[VAR_13] + VAR_0->linesize[VAR_13] * (VAR_5 >> VAR_10) + (VAR_7 >> VAR_11); memcpy(optr, iptr, VAR_1->linesize[VAR_13]); iptr += VAR_1->linesize[VAR_13]; } optr = VAR_0->data[VAR_13] + VAR_0->linesize[VAR_13] * (VAR_5 >> VAR_10) + (VAR_0->linesize[VAR_13] - (VAR_8 >> VAR_11)); VAR_12 = (VAR_2 - 1 - (VAR_5 + VAR_6)) >> VAR_10; for (VAR_14 = 0; VAR_14 < VAR_12; VAR_14++) { memset(optr, VAR_9[VAR_13], (VAR_7 + VAR_8) >> VAR_11); if (VAR_1) { memcpy(optr + ((VAR_7 + VAR_8) >> VAR_11), iptr, VAR_1->linesize[VAR_13]); iptr += VAR_1->linesize[VAR_13]; } optr += VAR_0->linesize[VAR_13]; } } if (VAR_6 || VAR_8) { optr = VAR_0->data[VAR_13] + VAR_0->linesize[VAR_13] * ((VAR_2 - VAR_6) >> VAR_10) - (VAR_8 >> VAR_11); memset(optr, VAR_9[VAR_13],VAR_0->linesize[VAR_13] * (VAR_6 >> VAR_10) + (VAR_8 >> VAR_11)); } } return 0; }
[ "int FUNC_0(AVPicture *VAR_0, const AVPicture *VAR_1, int VAR_2, int VAR_3,\nint VAR_4, int VAR_5, int VAR_6, int VAR_7, int VAR_8,\nint *VAR_9)\n{", "uint8_t *optr, *iptr;", "int VAR_10;", "int VAR_11;", "int VAR_12;", "int VAR_13, VAR_14;", "if (VAR_4 < 0 || VAR_4 >= PIX_FMT_NB ||\n!is_yuv_planar(&pix_fmt_info[VAR_4])) return -1;", "for (VAR_13 = 0; VAR_13 < 3; VAR_13++) {", "VAR_11 = VAR_13 ? pix_fmt_info[VAR_4].x_chroma_shift : 0;", "VAR_10 = VAR_13 ? pix_fmt_info[VAR_4].y_chroma_shift : 0;", "if (VAR_5 || VAR_7) {", "memset(VAR_0->data[VAR_13], VAR_9[VAR_13],\nVAR_0->linesize[VAR_13] * (VAR_5 >> VAR_10) + (VAR_7 >> VAR_11));", "}", "if (VAR_7 || VAR_8 || VAR_1) {", "if (VAR_1) {", "iptr = VAR_1->data[VAR_13];", "optr = VAR_0->data[VAR_13] + VAR_0->linesize[VAR_13] * (VAR_5 >> VAR_10) +\n(VAR_7 >> VAR_11);", "memcpy(optr, iptr, VAR_1->linesize[VAR_13]);", "iptr += VAR_1->linesize[VAR_13];", "}", "optr = VAR_0->data[VAR_13] + VAR_0->linesize[VAR_13] * (VAR_5 >> VAR_10) +\n(VAR_0->linesize[VAR_13] - (VAR_8 >> VAR_11));", "VAR_12 = (VAR_2 - 1 - (VAR_5 + VAR_6)) >> VAR_10;", "for (VAR_14 = 0; VAR_14 < VAR_12; VAR_14++) {", "memset(optr, VAR_9[VAR_13], (VAR_7 + VAR_8) >> VAR_11);", "if (VAR_1) {", "memcpy(optr + ((VAR_7 + VAR_8) >> VAR_11), iptr,\nVAR_1->linesize[VAR_13]);", "iptr += VAR_1->linesize[VAR_13];", "}", "optr += VAR_0->linesize[VAR_13];", "}", "}", "if (VAR_6 || VAR_8) {", "optr = VAR_0->data[VAR_13] + VAR_0->linesize[VAR_13] *\n((VAR_2 - VAR_6) >> VAR_10) - (VAR_8 >> VAR_11);", "memset(optr, VAR_9[VAR_13],VAR_0->linesize[VAR_13] *\n(VAR_6 >> VAR_10) + (VAR_8 >> VAR_11));", "}", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21, 23 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37, 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51, 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61, 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73, 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 89 ], [ 91, 93 ], [ 95, 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ] ]
4,588
void avfilter_draw_slice(AVFilterLink *link, int y, int h) { uint8_t *src[4], *dst[4]; int i, j, hsub, vsub; /* copy the slice if needed for permission reasons */ if(link->srcpic) { avcodec_get_chroma_sub_sample(link->format, &hsub, &vsub); src[0] = link->srcpic-> data[0] + y * link->srcpic-> linesize[0]; dst[0] = link->cur_pic->data[0] + y * link->cur_pic->linesize[0]; for(i = 1; i < 4; i ++) { if(link->srcpic->data[i]) { src[i] = link->srcpic-> data[i] + (y >> vsub) * link->srcpic-> linesize[i]; dst[i] = link->cur_pic->data[i] + (y >> vsub) * link->cur_pic->linesize[i]; } else src[i] = dst[i] = NULL; } for(j = 0; j < h; j ++) { memcpy(dst[0], src[0], link->cur_pic->linesize[0]); src[0] += link->srcpic ->linesize[0]; dst[0] += link->cur_pic->linesize[0]; } for(i = 1; i < 4; i ++) { if(!src[i]) continue; for(j = 0; j < h >> vsub; j ++) { memcpy(dst[i], src[i], link->cur_pic->linesize[i]); src[i] += link->srcpic ->linesize[i]; dst[i] += link->cur_pic->linesize[i]; } } } if(!link_dpad(link).draw_slice) return; link_dpad(link).draw_slice(link, y, h); }
false
FFmpeg
19dc71045d2833d2b3b77648608687eb687b4af1
void avfilter_draw_slice(AVFilterLink *link, int y, int h) { uint8_t *src[4], *dst[4]; int i, j, hsub, vsub; if(link->srcpic) { avcodec_get_chroma_sub_sample(link->format, &hsub, &vsub); src[0] = link->srcpic-> data[0] + y * link->srcpic-> linesize[0]; dst[0] = link->cur_pic->data[0] + y * link->cur_pic->linesize[0]; for(i = 1; i < 4; i ++) { if(link->srcpic->data[i]) { src[i] = link->srcpic-> data[i] + (y >> vsub) * link->srcpic-> linesize[i]; dst[i] = link->cur_pic->data[i] + (y >> vsub) * link->cur_pic->linesize[i]; } else src[i] = dst[i] = NULL; } for(j = 0; j < h; j ++) { memcpy(dst[0], src[0], link->cur_pic->linesize[0]); src[0] += link->srcpic ->linesize[0]; dst[0] += link->cur_pic->linesize[0]; } for(i = 1; i < 4; i ++) { if(!src[i]) continue; for(j = 0; j < h >> vsub; j ++) { memcpy(dst[i], src[i], link->cur_pic->linesize[i]); src[i] += link->srcpic ->linesize[i]; dst[i] += link->cur_pic->linesize[i]; } } } if(!link_dpad(link).draw_slice) return; link_dpad(link).draw_slice(link, y, h); }
{ "code": [], "line_no": [] }
void FUNC_0(AVFilterLink *VAR_0, int VAR_1, int VAR_2) { uint8_t *src[4], *dst[4]; int VAR_3, VAR_4, VAR_5, VAR_6; if(VAR_0->srcpic) { avcodec_get_chroma_sub_sample(VAR_0->format, &VAR_5, &VAR_6); src[0] = VAR_0->srcpic-> data[0] + VAR_1 * VAR_0->srcpic-> linesize[0]; dst[0] = VAR_0->cur_pic->data[0] + VAR_1 * VAR_0->cur_pic->linesize[0]; for(VAR_3 = 1; VAR_3 < 4; VAR_3 ++) { if(VAR_0->srcpic->data[VAR_3]) { src[VAR_3] = VAR_0->srcpic-> data[VAR_3] + (VAR_1 >> VAR_6) * VAR_0->srcpic-> linesize[VAR_3]; dst[VAR_3] = VAR_0->cur_pic->data[VAR_3] + (VAR_1 >> VAR_6) * VAR_0->cur_pic->linesize[VAR_3]; } else src[VAR_3] = dst[VAR_3] = NULL; } for(VAR_4 = 0; VAR_4 < VAR_2; VAR_4 ++) { memcpy(dst[0], src[0], VAR_0->cur_pic->linesize[0]); src[0] += VAR_0->srcpic ->linesize[0]; dst[0] += VAR_0->cur_pic->linesize[0]; } for(VAR_3 = 1; VAR_3 < 4; VAR_3 ++) { if(!src[VAR_3]) continue; for(VAR_4 = 0; VAR_4 < VAR_2 >> VAR_6; VAR_4 ++) { memcpy(dst[VAR_3], src[VAR_3], VAR_0->cur_pic->linesize[VAR_3]); src[VAR_3] += VAR_0->srcpic ->linesize[VAR_3]; dst[VAR_3] += VAR_0->cur_pic->linesize[VAR_3]; } } } if(!link_dpad(VAR_0).draw_slice) return; link_dpad(VAR_0).draw_slice(VAR_0, VAR_1, VAR_2); }
[ "void FUNC_0(AVFilterLink *VAR_0, int VAR_1, int VAR_2)\n{", "uint8_t *src[4], *dst[4];", "int VAR_3, VAR_4, VAR_5, VAR_6;", "if(VAR_0->srcpic) {", "avcodec_get_chroma_sub_sample(VAR_0->format, &VAR_5, &VAR_6);", "src[0] = VAR_0->srcpic-> data[0] + VAR_1 * VAR_0->srcpic-> linesize[0];", "dst[0] = VAR_0->cur_pic->data[0] + VAR_1 * VAR_0->cur_pic->linesize[0];", "for(VAR_3 = 1; VAR_3 < 4; VAR_3 ++) {", "if(VAR_0->srcpic->data[VAR_3]) {", "src[VAR_3] = VAR_0->srcpic-> data[VAR_3] + (VAR_1 >> VAR_6) * VAR_0->srcpic-> linesize[VAR_3];", "dst[VAR_3] = VAR_0->cur_pic->data[VAR_3] + (VAR_1 >> VAR_6) * VAR_0->cur_pic->linesize[VAR_3];", "} else", "src[VAR_3] = dst[VAR_3] = NULL;", "}", "for(VAR_4 = 0; VAR_4 < VAR_2; VAR_4 ++) {", "memcpy(dst[0], src[0], VAR_0->cur_pic->linesize[0]);", "src[0] += VAR_0->srcpic ->linesize[0];", "dst[0] += VAR_0->cur_pic->linesize[0];", "}", "for(VAR_3 = 1; VAR_3 < 4; VAR_3 ++) {", "if(!src[VAR_3]) continue;", "for(VAR_4 = 0; VAR_4 < VAR_2 >> VAR_6; VAR_4 ++) {", "memcpy(dst[VAR_3], src[VAR_3], VAR_0->cur_pic->linesize[VAR_3]);", "src[VAR_3] += VAR_0->srcpic ->linesize[VAR_3];", "dst[VAR_3] += VAR_0->cur_pic->linesize[VAR_3];", "}", "}", "}", "if(!link_dpad(VAR_0).draw_slice)\nreturn;", "link_dpad(VAR_0).draw_slice(VAR_0, VAR_1, 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69, 71 ], [ 75 ], [ 77 ] ]
4,589
static int ff_sctp_send(int s, const void *msg, size_t len, const struct sctp_sndrcvinfo *sinfo, int flags) { struct msghdr outmsg; struct iovec iov; outmsg.msg_name = NULL; outmsg.msg_namelen = 0; outmsg.msg_iov = &iov; iov.iov_base = msg; iov.iov_len = len; outmsg.msg_iovlen = 1; outmsg.msg_controllen = 0; if (sinfo) { char outcmsg[CMSG_SPACE(sizeof(struct sctp_sndrcvinfo))]; struct cmsghdr *cmsg; outmsg.msg_control = outcmsg; outmsg.msg_controllen = sizeof(outcmsg); outmsg.msg_flags = 0; cmsg = CMSG_FIRSTHDR(&outmsg); cmsg->cmsg_level = IPPROTO_SCTP; cmsg->cmsg_type = SCTP_SNDRCV; cmsg->cmsg_len = CMSG_LEN(sizeof(struct sctp_sndrcvinfo)); outmsg.msg_controllen = cmsg->cmsg_len; memcpy(CMSG_DATA(cmsg), sinfo, sizeof(struct sctp_sndrcvinfo)); } return sendmsg(s, &outmsg, flags | MSG_NOSIGNAL); }
false
FFmpeg
8ef98855d25e457094468e2e1a79d9b10d6445b2
static int ff_sctp_send(int s, const void *msg, size_t len, const struct sctp_sndrcvinfo *sinfo, int flags) { struct msghdr outmsg; struct iovec iov; outmsg.msg_name = NULL; outmsg.msg_namelen = 0; outmsg.msg_iov = &iov; iov.iov_base = msg; iov.iov_len = len; outmsg.msg_iovlen = 1; outmsg.msg_controllen = 0; if (sinfo) { char outcmsg[CMSG_SPACE(sizeof(struct sctp_sndrcvinfo))]; struct cmsghdr *cmsg; outmsg.msg_control = outcmsg; outmsg.msg_controllen = sizeof(outcmsg); outmsg.msg_flags = 0; cmsg = CMSG_FIRSTHDR(&outmsg); cmsg->cmsg_level = IPPROTO_SCTP; cmsg->cmsg_type = SCTP_SNDRCV; cmsg->cmsg_len = CMSG_LEN(sizeof(struct sctp_sndrcvinfo)); outmsg.msg_controllen = cmsg->cmsg_len; memcpy(CMSG_DATA(cmsg), sinfo, sizeof(struct sctp_sndrcvinfo)); } return sendmsg(s, &outmsg, flags | MSG_NOSIGNAL); }
{ "code": [], "line_no": [] }
static int FUNC_0(int VAR_0, const void *VAR_1, size_t VAR_2, const struct sctp_sndrcvinfo *VAR_3, int VAR_4) { struct msghdr VAR_5; struct iovec VAR_6; VAR_5.msg_name = NULL; VAR_5.msg_namelen = 0; VAR_5.msg_iov = &VAR_6; VAR_6.iov_base = VAR_1; VAR_6.iov_len = VAR_2; VAR_5.msg_iovlen = 1; VAR_5.msg_controllen = 0; if (VAR_3) { char VAR_7[CMSG_SPACE(sizeof(struct sctp_sndrcvinfo))]; struct cmsghdr *VAR_8; VAR_5.msg_control = VAR_7; VAR_5.msg_controllen = sizeof(VAR_7); VAR_5.msg_flags = 0; VAR_8 = CMSG_FIRSTHDR(&VAR_5); VAR_8->cmsg_level = IPPROTO_SCTP; VAR_8->cmsg_type = SCTP_SNDRCV; VAR_8->cmsg_len = CMSG_LEN(sizeof(struct sctp_sndrcvinfo)); VAR_5.msg_controllen = VAR_8->cmsg_len; memcpy(CMSG_DATA(VAR_8), VAR_3, sizeof(struct sctp_sndrcvinfo)); } return sendmsg(VAR_0, &VAR_5, VAR_4 | MSG_NOSIGNAL); }
[ "static int FUNC_0(int VAR_0, const void *VAR_1, size_t VAR_2,\nconst struct sctp_sndrcvinfo *VAR_3, int VAR_4)\n{", "struct msghdr VAR_5;", "struct iovec VAR_6;", "VAR_5.msg_name = NULL;", "VAR_5.msg_namelen = 0;", "VAR_5.msg_iov = &VAR_6;", "VAR_6.iov_base = VAR_1;", "VAR_6.iov_len = VAR_2;", "VAR_5.msg_iovlen = 1;", "VAR_5.msg_controllen = 0;", "if (VAR_3) {", "char VAR_7[CMSG_SPACE(sizeof(struct sctp_sndrcvinfo))];", "struct cmsghdr *VAR_8;", "VAR_5.msg_control = VAR_7;", "VAR_5.msg_controllen = sizeof(VAR_7);", "VAR_5.msg_flags = 0;", "VAR_8 = CMSG_FIRSTHDR(&VAR_5);", "VAR_8->cmsg_level = IPPROTO_SCTP;", "VAR_8->cmsg_type = SCTP_SNDRCV;", "VAR_8->cmsg_len = CMSG_LEN(sizeof(struct sctp_sndrcvinfo));", "VAR_5.msg_controllen = VAR_8->cmsg_len;", "memcpy(CMSG_DATA(VAR_8), VAR_3, sizeof(struct sctp_sndrcvinfo));", "}", "return sendmsg(VAR_0, &VAR_5, VAR_4 | MSG_NOSIGNAL);", "}" ]
[ 0, 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 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ] ]
4,590
static int dxtory_decode_v1_420(AVCodecContext *avctx, AVFrame *pic, const uint8_t *src, int src_size) { int h, w; uint8_t *Y1, *Y2, *U, *V; int ret; if (src_size < avctx->width * avctx->height * 3LL / 2) { av_log(avctx, AV_LOG_ERROR, "packet too small\n"); return AVERROR_INVALIDDATA; } avctx->pix_fmt = AV_PIX_FMT_YUV420P; if ((ret = ff_get_buffer(avctx, pic, 0)) < 0) return ret; Y1 = pic->data[0]; Y2 = pic->data[0] + pic->linesize[0]; U = pic->data[1]; V = pic->data[2]; for (h = 0; h < avctx->height; h += 2) { for (w = 0; w < avctx->width; w += 2) { AV_COPY16(Y1 + w, src); AV_COPY16(Y2 + w, src + 2); U[w >> 1] = src[4] + 0x80; V[w >> 1] = src[5] + 0x80; src += 6; } Y1 += pic->linesize[0] << 1; Y2 += pic->linesize[0] << 1; U += pic->linesize[1]; V += pic->linesize[2]; } return 0; }
false
FFmpeg
9caa9414ccf2dcf8aee2695377dee830a5024c82
static int dxtory_decode_v1_420(AVCodecContext *avctx, AVFrame *pic, const uint8_t *src, int src_size) { int h, w; uint8_t *Y1, *Y2, *U, *V; int ret; if (src_size < avctx->width * avctx->height * 3LL / 2) { av_log(avctx, AV_LOG_ERROR, "packet too small\n"); return AVERROR_INVALIDDATA; } avctx->pix_fmt = AV_PIX_FMT_YUV420P; if ((ret = ff_get_buffer(avctx, pic, 0)) < 0) return ret; Y1 = pic->data[0]; Y2 = pic->data[0] + pic->linesize[0]; U = pic->data[1]; V = pic->data[2]; for (h = 0; h < avctx->height; h += 2) { for (w = 0; w < avctx->width; w += 2) { AV_COPY16(Y1 + w, src); AV_COPY16(Y2 + w, src + 2); U[w >> 1] = src[4] + 0x80; V[w >> 1] = src[5] + 0x80; src += 6; } Y1 += pic->linesize[0] << 1; Y2 += pic->linesize[0] << 1; U += pic->linesize[1]; V += pic->linesize[2]; } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, AVFrame *VAR_1, const uint8_t *VAR_2, int VAR_3) { int VAR_4, VAR_5; uint8_t *Y1, *Y2, *U, *V; int VAR_6; if (VAR_3 < VAR_0->width * VAR_0->height * 3LL / 2) { av_log(VAR_0, AV_LOG_ERROR, "packet too small\n"); return AVERROR_INVALIDDATA; } VAR_0->pix_fmt = AV_PIX_FMT_YUV420P; if ((VAR_6 = ff_get_buffer(VAR_0, VAR_1, 0)) < 0) return VAR_6; Y1 = VAR_1->data[0]; Y2 = VAR_1->data[0] + VAR_1->linesize[0]; U = VAR_1->data[1]; V = VAR_1->data[2]; for (VAR_4 = 0; VAR_4 < VAR_0->height; VAR_4 += 2) { for (VAR_5 = 0; VAR_5 < VAR_0->width; VAR_5 += 2) { AV_COPY16(Y1 + VAR_5, VAR_2); AV_COPY16(Y2 + VAR_5, VAR_2 + 2); U[VAR_5 >> 1] = VAR_2[4] + 0x80; V[VAR_5 >> 1] = VAR_2[5] + 0x80; VAR_2 += 6; } Y1 += VAR_1->linesize[0] << 1; Y2 += VAR_1->linesize[0] << 1; U += VAR_1->linesize[1]; V += VAR_1->linesize[2]; } return 0; }
[ "static int FUNC_0(AVCodecContext *VAR_0, AVFrame *VAR_1,\nconst uint8_t *VAR_2, int VAR_3)\n{", "int VAR_4, VAR_5;", "uint8_t *Y1, *Y2, *U, *V;", "int VAR_6;", "if (VAR_3 < VAR_0->width * VAR_0->height * 3LL / 2) {", "av_log(VAR_0, AV_LOG_ERROR, \"packet too small\\n\");", "return AVERROR_INVALIDDATA;", "}", "VAR_0->pix_fmt = AV_PIX_FMT_YUV420P;", "if ((VAR_6 = ff_get_buffer(VAR_0, VAR_1, 0)) < 0)\nreturn VAR_6;", "Y1 = VAR_1->data[0];", "Y2 = VAR_1->data[0] + VAR_1->linesize[0];", "U = VAR_1->data[1];", "V = VAR_1->data[2];", "for (VAR_4 = 0; VAR_4 < VAR_0->height; VAR_4 += 2) {", "for (VAR_5 = 0; VAR_5 < VAR_0->width; VAR_5 += 2) {", "AV_COPY16(Y1 + VAR_5, VAR_2);", "AV_COPY16(Y2 + VAR_5, VAR_2 + 2);", "U[VAR_5 >> 1] = VAR_2[4] + 0x80;", "V[VAR_5 >> 1] = VAR_2[5] + 0x80;", "VAR_2 += 6;", "}", "Y1 += VAR_1->linesize[0] << 1;", "Y2 += VAR_1->linesize[0] << 1;", "U += VAR_1->linesize[1];", "V += VAR_1->linesize[2];", "}", "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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27, 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ] ]
4,591
void ff_avg_h264_qpel16_mc13_msa(uint8_t *dst, const uint8_t *src, ptrdiff_t stride) { avc_luma_hv_qrt_and_aver_dst_16x16_msa(src + stride - 2, src - (stride * 2), stride, dst, stride); }
false
FFmpeg
1181d93231e9b807965724587d363c1cfd5a1d0d
void ff_avg_h264_qpel16_mc13_msa(uint8_t *dst, const uint8_t *src, ptrdiff_t stride) { avc_luma_hv_qrt_and_aver_dst_16x16_msa(src + stride - 2, src - (stride * 2), stride, dst, stride); }
{ "code": [], "line_no": [] }
void FUNC_0(uint8_t *VAR_0, const uint8_t *VAR_1, ptrdiff_t VAR_2) { avc_luma_hv_qrt_and_aver_dst_16x16_msa(VAR_1 + VAR_2 - 2, VAR_1 - (VAR_2 * 2), VAR_2, VAR_0, VAR_2); }
[ "void FUNC_0(uint8_t *VAR_0, const uint8_t *VAR_1,\nptrdiff_t VAR_2)\n{", "avc_luma_hv_qrt_and_aver_dst_16x16_msa(VAR_1 + VAR_2 - 2,\nVAR_1 - (VAR_2 * 2),\nVAR_2, VAR_0, VAR_2);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7, 9, 11 ], [ 13 ] ]
4,592
void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, int log2_trafo_size, enum ScanType scan_idx, int c_idx) { #define GET_COORD(offset, n) \ do { \ x_c = (x_cg << 2) + scan_x_off[n]; \ y_c = (y_cg << 2) + scan_y_off[n]; \ } while (0) HEVCLocalContext *lc = s->HEVClc; int transform_skip_flag = 0; int last_significant_coeff_x, last_significant_coeff_y; int last_scan_pos; int n_end; int num_coeff = 0; int greater1_ctx = 1; int num_last_subset; int x_cg_last_sig, y_cg_last_sig; const uint8_t *scan_x_cg, *scan_y_cg, *scan_x_off, *scan_y_off; ptrdiff_t stride = s->frame->linesize[c_idx]; int hshift = s->sps->hshift[c_idx]; int vshift = s->sps->vshift[c_idx]; uint8_t *dst = &s->frame->data[c_idx][(y0 >> vshift) * stride + ((x0 >> hshift) << s->sps->pixel_shift)]; int16_t *coeffs = lc->tu.coeffs[c_idx > 0]; uint8_t significant_coeff_group_flag[8][8] = {{0}}; int explicit_rdpcm_flag = 0; int explicit_rdpcm_dir_flag; int trafo_size = 1 << log2_trafo_size; int i; int qp,shift,add,scale,scale_m; const uint8_t level_scale[] = { 40, 45, 51, 57, 64, 72 }; const uint8_t *scale_matrix = NULL; uint8_t dc_scale; int pred_mode_intra = (c_idx == 0) ? lc->tu.intra_pred_mode : lc->tu.intra_pred_mode_c; memset(coeffs, 0, trafo_size * trafo_size * sizeof(int16_t)); // Derive QP for dequant if (!lc->cu.cu_transquant_bypass_flag) { static const int qp_c[] = { 29, 30, 31, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37 }; static const uint8_t rem6[51 + 4 * 6 + 1] = { 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1 }; static const uint8_t div6[51 + 4 * 6 + 1] = { 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 12, 12 }; int qp_y = lc->qp_y; if (s->pps->transform_skip_enabled_flag && log2_trafo_size <= s->pps->log2_max_transform_skip_block_size) { transform_skip_flag = ff_hevc_transform_skip_flag_decode(s, c_idx); } if (c_idx == 0) { qp = qp_y + s->sps->qp_bd_offset; } else { int qp_i, offset; if (c_idx == 1) offset = s->pps->cb_qp_offset + s->sh.slice_cb_qp_offset + lc->tu.cu_qp_offset_cb; else offset = s->pps->cr_qp_offset + s->sh.slice_cr_qp_offset + lc->tu.cu_qp_offset_cr; qp_i = av_clip(qp_y + offset, - s->sps->qp_bd_offset, 57); if (s->sps->chroma_format_idc == 1) { if (qp_i < 30) qp = qp_i; else if (qp_i > 43) qp = qp_i - 6; else qp = qp_c[qp_i - 30]; } else { if (qp_i > 51) qp = 51; else qp = qp_i; } qp += s->sps->qp_bd_offset; } shift = s->sps->bit_depth + log2_trafo_size - 5; add = 1 << (shift-1); scale = level_scale[rem6[qp]] << (div6[qp]); scale_m = 16; // default when no custom scaling lists. dc_scale = 16; if (s->sps->scaling_list_enable_flag && !(transform_skip_flag && log2_trafo_size > 2)) { const ScalingList *sl = s->pps->scaling_list_data_present_flag ? &s->pps->scaling_list : &s->sps->scaling_list; int matrix_id = lc->cu.pred_mode != MODE_INTRA; matrix_id = 3 * matrix_id + c_idx; scale_matrix = sl->sl[log2_trafo_size - 2][matrix_id]; if (log2_trafo_size >= 4) dc_scale = sl->sl_dc[log2_trafo_size - 4][matrix_id]; } } else { shift = 0; add = 0; scale = 0; dc_scale = 0; } if (lc->cu.pred_mode == MODE_INTER && s->sps->explicit_rdpcm_enabled_flag && (transform_skip_flag || lc->cu.cu_transquant_bypass_flag)) { explicit_rdpcm_flag = explicit_rdpcm_flag_decode(s, c_idx); if (explicit_rdpcm_flag) { explicit_rdpcm_dir_flag = explicit_rdpcm_dir_flag_decode(s, c_idx); } } last_significant_coeff_xy_prefix_decode(s, c_idx, log2_trafo_size, &last_significant_coeff_x, &last_significant_coeff_y); if (last_significant_coeff_x > 3) { int suffix = last_significant_coeff_suffix_decode(s, last_significant_coeff_x); last_significant_coeff_x = (1 << ((last_significant_coeff_x >> 1) - 1)) * (2 + (last_significant_coeff_x & 1)) + suffix; } if (last_significant_coeff_y > 3) { int suffix = last_significant_coeff_suffix_decode(s, last_significant_coeff_y); last_significant_coeff_y = (1 << ((last_significant_coeff_y >> 1) - 1)) * (2 + (last_significant_coeff_y & 1)) + suffix; } if (scan_idx == SCAN_VERT) FFSWAP(int, last_significant_coeff_x, last_significant_coeff_y); x_cg_last_sig = last_significant_coeff_x >> 2; y_cg_last_sig = last_significant_coeff_y >> 2; switch (scan_idx) { case SCAN_DIAG: { int last_x_c = last_significant_coeff_x & 3; int last_y_c = last_significant_coeff_y & 3; scan_x_off = ff_hevc_diag_scan4x4_x; scan_y_off = ff_hevc_diag_scan4x4_y; num_coeff = diag_scan4x4_inv[last_y_c][last_x_c]; if (trafo_size == 4) { scan_x_cg = scan_1x1; scan_y_cg = scan_1x1; } else if (trafo_size == 8) { num_coeff += diag_scan2x2_inv[y_cg_last_sig][x_cg_last_sig] << 4; scan_x_cg = diag_scan2x2_x; scan_y_cg = diag_scan2x2_y; } else if (trafo_size == 16) { num_coeff += diag_scan4x4_inv[y_cg_last_sig][x_cg_last_sig] << 4; scan_x_cg = ff_hevc_diag_scan4x4_x; scan_y_cg = ff_hevc_diag_scan4x4_y; } else { // trafo_size == 32 num_coeff += diag_scan8x8_inv[y_cg_last_sig][x_cg_last_sig] << 4; scan_x_cg = ff_hevc_diag_scan8x8_x; scan_y_cg = ff_hevc_diag_scan8x8_y; } break; } case SCAN_HORIZ: scan_x_cg = horiz_scan2x2_x; scan_y_cg = horiz_scan2x2_y; scan_x_off = horiz_scan4x4_x; scan_y_off = horiz_scan4x4_y; num_coeff = horiz_scan8x8_inv[last_significant_coeff_y][last_significant_coeff_x]; break; default: //SCAN_VERT scan_x_cg = horiz_scan2x2_y; scan_y_cg = horiz_scan2x2_x; scan_x_off = horiz_scan4x4_y; scan_y_off = horiz_scan4x4_x; num_coeff = horiz_scan8x8_inv[last_significant_coeff_x][last_significant_coeff_y]; break; } num_coeff++; num_last_subset = (num_coeff - 1) >> 4; for (i = num_last_subset; i >= 0; i--) { int n, m; int x_cg, y_cg, x_c, y_c, pos; int implicit_non_zero_coeff = 0; int64_t trans_coeff_level; int prev_sig = 0; int offset = i << 4; int rice_init = 0; uint8_t significant_coeff_flag_idx[16]; uint8_t nb_significant_coeff_flag = 0; x_cg = scan_x_cg[i]; y_cg = scan_y_cg[i]; if ((i < num_last_subset) && (i > 0)) { int ctx_cg = 0; if (x_cg < (1 << (log2_trafo_size - 2)) - 1) ctx_cg += significant_coeff_group_flag[x_cg + 1][y_cg]; if (y_cg < (1 << (log2_trafo_size - 2)) - 1) ctx_cg += significant_coeff_group_flag[x_cg][y_cg + 1]; significant_coeff_group_flag[x_cg][y_cg] = significant_coeff_group_flag_decode(s, c_idx, ctx_cg); implicit_non_zero_coeff = 1; } else { significant_coeff_group_flag[x_cg][y_cg] = ((x_cg == x_cg_last_sig && y_cg == y_cg_last_sig) || (x_cg == 0 && y_cg == 0)); } last_scan_pos = num_coeff - offset - 1; if (i == num_last_subset) { n_end = last_scan_pos - 1; significant_coeff_flag_idx[0] = last_scan_pos; nb_significant_coeff_flag = 1; } else { n_end = 15; } if (x_cg < ((1 << log2_trafo_size) - 1) >> 2) prev_sig = !!significant_coeff_group_flag[x_cg + 1][y_cg]; if (y_cg < ((1 << log2_trafo_size) - 1) >> 2) prev_sig += (!!significant_coeff_group_flag[x_cg][y_cg + 1] << 1); if (significant_coeff_group_flag[x_cg][y_cg] && n_end >= 0) { static const uint8_t ctx_idx_map[] = { 0, 1, 4, 5, 2, 3, 4, 5, 6, 6, 8, 8, 7, 7, 8, 8, // log2_trafo_size == 2 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, // prev_sig == 0 2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, // prev_sig == 1 2, 1, 0, 0, 2, 1, 0, 0, 2, 1, 0, 0, 2, 1, 0, 0, // prev_sig == 2 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 // default }; const uint8_t *ctx_idx_map_p; int scf_offset = 0; if (s->sps->transform_skip_context_enabled_flag && (transform_skip_flag || lc->cu.cu_transquant_bypass_flag)) { ctx_idx_map_p = (uint8_t*) &ctx_idx_map[4 * 16]; if (c_idx == 0) { scf_offset = 40; } else { scf_offset = 14 + 27; } } else { if (c_idx != 0) scf_offset = 27; if (log2_trafo_size == 2) { ctx_idx_map_p = (uint8_t*) &ctx_idx_map[0]; } else { ctx_idx_map_p = (uint8_t*) &ctx_idx_map[(prev_sig + 1) << 4]; if (c_idx == 0) { if ((x_cg > 0 || y_cg > 0)) scf_offset += 3; if (log2_trafo_size == 3) { scf_offset += (scan_idx == SCAN_DIAG) ? 9 : 15; } else { scf_offset += 21; } } else { if (log2_trafo_size == 3) scf_offset += 9; else scf_offset += 12; } } } for (n = n_end; n > 0; n--) { x_c = scan_x_off[n]; y_c = scan_y_off[n]; if (significant_coeff_flag_decode(s, x_c, y_c, scf_offset, ctx_idx_map_p)) { significant_coeff_flag_idx[nb_significant_coeff_flag] = n; nb_significant_coeff_flag++; implicit_non_zero_coeff = 0; } } if (implicit_non_zero_coeff == 0) { if (s->sps->transform_skip_context_enabled_flag && (transform_skip_flag || lc->cu.cu_transquant_bypass_flag)) { if (c_idx == 0) { scf_offset = 42; } else { scf_offset = 16 + 27; } } else { if (i == 0) { if (c_idx == 0) scf_offset = 0; else scf_offset = 27; } else { scf_offset = 2 + scf_offset; } } if (significant_coeff_flag_decode_0(s, c_idx, scf_offset) == 1) { significant_coeff_flag_idx[nb_significant_coeff_flag] = 0; nb_significant_coeff_flag++; } } else { significant_coeff_flag_idx[nb_significant_coeff_flag] = 0; nb_significant_coeff_flag++; } } n_end = nb_significant_coeff_flag; if (n_end) { int first_nz_pos_in_cg; int last_nz_pos_in_cg; int c_rice_param = 0; int first_greater1_coeff_idx = -1; uint8_t coeff_abs_level_greater1_flag[8]; uint16_t coeff_sign_flag; int sum_abs = 0; int sign_hidden; int sb_type; // initialize first elem of coeff_bas_level_greater1_flag int ctx_set = (i > 0 && c_idx == 0) ? 2 : 0; if (s->sps->persistent_rice_adaptation_enabled_flag) { if (!transform_skip_flag && !lc->cu.cu_transquant_bypass_flag) sb_type = 2 * (c_idx == 0 ? 1 : 0); else sb_type = 2 * (c_idx == 0 ? 1 : 0) + 1; c_rice_param = lc->stat_coeff[sb_type] / 4; } if (!(i == num_last_subset) && greater1_ctx == 0) ctx_set++; greater1_ctx = 1; last_nz_pos_in_cg = significant_coeff_flag_idx[0]; for (m = 0; m < (n_end > 8 ? 8 : n_end); m++) { int inc = (ctx_set << 2) + greater1_ctx; coeff_abs_level_greater1_flag[m] = coeff_abs_level_greater1_flag_decode(s, c_idx, inc); if (coeff_abs_level_greater1_flag[m]) { greater1_ctx = 0; if (first_greater1_coeff_idx == -1) first_greater1_coeff_idx = m; } else if (greater1_ctx > 0 && greater1_ctx < 3) { greater1_ctx++; } } first_nz_pos_in_cg = significant_coeff_flag_idx[n_end - 1]; if (lc->cu.cu_transquant_bypass_flag || (lc->cu.pred_mode == MODE_INTRA && s->sps->implicit_rdpcm_enabled_flag && transform_skip_flag && (pred_mode_intra == 10 || pred_mode_intra == 26 )) || explicit_rdpcm_flag) sign_hidden = 0; else sign_hidden = (last_nz_pos_in_cg - first_nz_pos_in_cg >= 4); if (first_greater1_coeff_idx != -1) { coeff_abs_level_greater1_flag[first_greater1_coeff_idx] += coeff_abs_level_greater2_flag_decode(s, c_idx, ctx_set); } if (!s->pps->sign_data_hiding_flag || !sign_hidden ) { coeff_sign_flag = coeff_sign_flag_decode(s, nb_significant_coeff_flag) << (16 - nb_significant_coeff_flag); } else { coeff_sign_flag = coeff_sign_flag_decode(s, nb_significant_coeff_flag - 1) << (16 - (nb_significant_coeff_flag - 1)); } for (m = 0; m < n_end; m++) { n = significant_coeff_flag_idx[m]; GET_COORD(offset, n); if (m < 8) { trans_coeff_level = 1 + coeff_abs_level_greater1_flag[m]; if (trans_coeff_level == ((m == first_greater1_coeff_idx) ? 3 : 2)) { int last_coeff_abs_level_remaining = coeff_abs_level_remaining_decode(s, c_rice_param); trans_coeff_level += last_coeff_abs_level_remaining; if (trans_coeff_level > (3 << c_rice_param)) c_rice_param = s->sps->persistent_rice_adaptation_enabled_flag ? c_rice_param + 1 : FFMIN(c_rice_param + 1, 4); if (s->sps->persistent_rice_adaptation_enabled_flag && !rice_init) { int c_rice_p_init = lc->stat_coeff[sb_type] / 4; if (last_coeff_abs_level_remaining >= (3 << c_rice_p_init)) lc->stat_coeff[sb_type]++; else if (2 * last_coeff_abs_level_remaining < (1 << c_rice_p_init)) if (lc->stat_coeff[sb_type] > 0) lc->stat_coeff[sb_type]--; rice_init = 1; } } } else { int last_coeff_abs_level_remaining = coeff_abs_level_remaining_decode(s, c_rice_param); trans_coeff_level = 1 + last_coeff_abs_level_remaining; if (trans_coeff_level > (3 << c_rice_param)) c_rice_param = s->sps->persistent_rice_adaptation_enabled_flag ? c_rice_param + 1 : FFMIN(c_rice_param + 1, 4); if (s->sps->persistent_rice_adaptation_enabled_flag && !rice_init) { int c_rice_p_init = lc->stat_coeff[sb_type] / 4; if (last_coeff_abs_level_remaining >= (3 << c_rice_p_init)) lc->stat_coeff[sb_type]++; else if (2 * last_coeff_abs_level_remaining < (1 << c_rice_p_init)) if (lc->stat_coeff[sb_type] > 0) lc->stat_coeff[sb_type]--; rice_init = 1; } } if (s->pps->sign_data_hiding_flag && sign_hidden) { sum_abs += trans_coeff_level; if (n == first_nz_pos_in_cg && (sum_abs&1)) trans_coeff_level = -trans_coeff_level; } if (coeff_sign_flag >> 15) trans_coeff_level = -trans_coeff_level; coeff_sign_flag <<= 1; if(!lc->cu.cu_transquant_bypass_flag) { if (s->sps->scaling_list_enable_flag && !(transform_skip_flag && log2_trafo_size > 2)) { if(y_c || x_c || log2_trafo_size < 4) { switch(log2_trafo_size) { case 3: pos = (y_c << 3) + x_c; break; case 4: pos = ((y_c >> 1) << 3) + (x_c >> 1); break; case 5: pos = ((y_c >> 2) << 3) + (x_c >> 2); break; default: pos = (y_c << 2) + x_c; break; } scale_m = scale_matrix[pos]; } else { scale_m = dc_scale; } } trans_coeff_level = (trans_coeff_level * (int64_t)scale * (int64_t)scale_m + add) >> shift; if(trans_coeff_level < 0) { if((~trans_coeff_level) & 0xFffffffffff8000) trans_coeff_level = -32768; } else { if(trans_coeff_level & 0xffffffffffff8000) trans_coeff_level = 32767; } } coeffs[y_c * trafo_size + x_c] = trans_coeff_level; } } } if (lc->cu.cu_transquant_bypass_flag) { if (explicit_rdpcm_flag || (s->sps->implicit_rdpcm_enabled_flag && (pred_mode_intra == 10 || pred_mode_intra == 26))) { int mode = s->sps->implicit_rdpcm_enabled_flag ? (pred_mode_intra == 26) : explicit_rdpcm_dir_flag; s->hevcdsp.transform_rdpcm(coeffs, log2_trafo_size, mode); } } else { if (transform_skip_flag) { int rot = s->sps->transform_skip_rotation_enabled_flag && log2_trafo_size == 2 && lc->cu.pred_mode == MODE_INTRA; if (rot) { for (i = 0; i < 8; i++) FFSWAP(int16_t, coeffs[i], coeffs[16 - i - 1]); } s->hevcdsp.transform_skip(coeffs, log2_trafo_size); if (explicit_rdpcm_flag || (s->sps->implicit_rdpcm_enabled_flag && lc->cu.pred_mode == MODE_INTRA && (pred_mode_intra == 10 || pred_mode_intra == 26))) { int mode = explicit_rdpcm_flag ? explicit_rdpcm_dir_flag : (pred_mode_intra == 26); s->hevcdsp.transform_rdpcm(coeffs, log2_trafo_size, mode); } } else if (lc->cu.pred_mode == MODE_INTRA && c_idx == 0 && log2_trafo_size == 2) { s->hevcdsp.idct_4x4_luma(coeffs); } else { int max_xy = FFMAX(last_significant_coeff_x, last_significant_coeff_y); if (max_xy == 0) s->hevcdsp.idct_dc[log2_trafo_size-2](coeffs); else { int col_limit = last_significant_coeff_x + last_significant_coeff_y + 4; if (max_xy < 4) col_limit = FFMIN(4, col_limit); else if (max_xy < 8) col_limit = FFMIN(8, col_limit); else if (max_xy < 12) col_limit = FFMIN(24, col_limit); s->hevcdsp.idct[log2_trafo_size-2](coeffs, col_limit); } } } if (lc->tu.cross_pf) { int16_t *coeffs_y = lc->tu.coeffs[0]; for (i = 0; i < (trafo_size * trafo_size); i++) { coeffs[i] = coeffs[i] + ((lc->tu.res_scale_val * coeffs_y[i]) >> 3); } } s->hevcdsp.transform_add[log2_trafo_size-2](dst, coeffs, stride); }
false
FFmpeg
9a3653c9ecc4bbbbb502513a70bccd4090ed12b0
void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, int log2_trafo_size, enum ScanType scan_idx, int c_idx) { #define GET_COORD(offset, n) \ do { \ x_c = (x_cg << 2) + scan_x_off[n]; \ y_c = (y_cg << 2) + scan_y_off[n]; \ } while (0) HEVCLocalContext *lc = s->HEVClc; int transform_skip_flag = 0; int last_significant_coeff_x, last_significant_coeff_y; int last_scan_pos; int n_end; int num_coeff = 0; int greater1_ctx = 1; int num_last_subset; int x_cg_last_sig, y_cg_last_sig; const uint8_t *scan_x_cg, *scan_y_cg, *scan_x_off, *scan_y_off; ptrdiff_t stride = s->frame->linesize[c_idx]; int hshift = s->sps->hshift[c_idx]; int vshift = s->sps->vshift[c_idx]; uint8_t *dst = &s->frame->data[c_idx][(y0 >> vshift) * stride + ((x0 >> hshift) << s->sps->pixel_shift)]; int16_t *coeffs = lc->tu.coeffs[c_idx > 0]; uint8_t significant_coeff_group_flag[8][8] = {{0}}; int explicit_rdpcm_flag = 0; int explicit_rdpcm_dir_flag; int trafo_size = 1 << log2_trafo_size; int i; int qp,shift,add,scale,scale_m; const uint8_t level_scale[] = { 40, 45, 51, 57, 64, 72 }; const uint8_t *scale_matrix = NULL; uint8_t dc_scale; int pred_mode_intra = (c_idx == 0) ? lc->tu.intra_pred_mode : lc->tu.intra_pred_mode_c; memset(coeffs, 0, trafo_size * trafo_size * sizeof(int16_t)); if (!lc->cu.cu_transquant_bypass_flag) { static const int qp_c[] = { 29, 30, 31, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37 }; static const uint8_t rem6[51 + 4 * 6 + 1] = { 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1 }; static const uint8_t div6[51 + 4 * 6 + 1] = { 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 12, 12 }; int qp_y = lc->qp_y; if (s->pps->transform_skip_enabled_flag && log2_trafo_size <= s->pps->log2_max_transform_skip_block_size) { transform_skip_flag = ff_hevc_transform_skip_flag_decode(s, c_idx); } if (c_idx == 0) { qp = qp_y + s->sps->qp_bd_offset; } else { int qp_i, offset; if (c_idx == 1) offset = s->pps->cb_qp_offset + s->sh.slice_cb_qp_offset + lc->tu.cu_qp_offset_cb; else offset = s->pps->cr_qp_offset + s->sh.slice_cr_qp_offset + lc->tu.cu_qp_offset_cr; qp_i = av_clip(qp_y + offset, - s->sps->qp_bd_offset, 57); if (s->sps->chroma_format_idc == 1) { if (qp_i < 30) qp = qp_i; else if (qp_i > 43) qp = qp_i - 6; else qp = qp_c[qp_i - 30]; } else { if (qp_i > 51) qp = 51; else qp = qp_i; } qp += s->sps->qp_bd_offset; } shift = s->sps->bit_depth + log2_trafo_size - 5; add = 1 << (shift-1); scale = level_scale[rem6[qp]] << (div6[qp]); scale_m = 16; dc_scale = 16; if (s->sps->scaling_list_enable_flag && !(transform_skip_flag && log2_trafo_size > 2)) { const ScalingList *sl = s->pps->scaling_list_data_present_flag ? &s->pps->scaling_list : &s->sps->scaling_list; int matrix_id = lc->cu.pred_mode != MODE_INTRA; matrix_id = 3 * matrix_id + c_idx; scale_matrix = sl->sl[log2_trafo_size - 2][matrix_id]; if (log2_trafo_size >= 4) dc_scale = sl->sl_dc[log2_trafo_size - 4][matrix_id]; } } else { shift = 0; add = 0; scale = 0; dc_scale = 0; } if (lc->cu.pred_mode == MODE_INTER && s->sps->explicit_rdpcm_enabled_flag && (transform_skip_flag || lc->cu.cu_transquant_bypass_flag)) { explicit_rdpcm_flag = explicit_rdpcm_flag_decode(s, c_idx); if (explicit_rdpcm_flag) { explicit_rdpcm_dir_flag = explicit_rdpcm_dir_flag_decode(s, c_idx); } } last_significant_coeff_xy_prefix_decode(s, c_idx, log2_trafo_size, &last_significant_coeff_x, &last_significant_coeff_y); if (last_significant_coeff_x > 3) { int suffix = last_significant_coeff_suffix_decode(s, last_significant_coeff_x); last_significant_coeff_x = (1 << ((last_significant_coeff_x >> 1) - 1)) * (2 + (last_significant_coeff_x & 1)) + suffix; } if (last_significant_coeff_y > 3) { int suffix = last_significant_coeff_suffix_decode(s, last_significant_coeff_y); last_significant_coeff_y = (1 << ((last_significant_coeff_y >> 1) - 1)) * (2 + (last_significant_coeff_y & 1)) + suffix; } if (scan_idx == SCAN_VERT) FFSWAP(int, last_significant_coeff_x, last_significant_coeff_y); x_cg_last_sig = last_significant_coeff_x >> 2; y_cg_last_sig = last_significant_coeff_y >> 2; switch (scan_idx) { case SCAN_DIAG: { int last_x_c = last_significant_coeff_x & 3; int last_y_c = last_significant_coeff_y & 3; scan_x_off = ff_hevc_diag_scan4x4_x; scan_y_off = ff_hevc_diag_scan4x4_y; num_coeff = diag_scan4x4_inv[last_y_c][last_x_c]; if (trafo_size == 4) { scan_x_cg = scan_1x1; scan_y_cg = scan_1x1; } else if (trafo_size == 8) { num_coeff += diag_scan2x2_inv[y_cg_last_sig][x_cg_last_sig] << 4; scan_x_cg = diag_scan2x2_x; scan_y_cg = diag_scan2x2_y; } else if (trafo_size == 16) { num_coeff += diag_scan4x4_inv[y_cg_last_sig][x_cg_last_sig] << 4; scan_x_cg = ff_hevc_diag_scan4x4_x; scan_y_cg = ff_hevc_diag_scan4x4_y; } else { num_coeff += diag_scan8x8_inv[y_cg_last_sig][x_cg_last_sig] << 4; scan_x_cg = ff_hevc_diag_scan8x8_x; scan_y_cg = ff_hevc_diag_scan8x8_y; } break; } case SCAN_HORIZ: scan_x_cg = horiz_scan2x2_x; scan_y_cg = horiz_scan2x2_y; scan_x_off = horiz_scan4x4_x; scan_y_off = horiz_scan4x4_y; num_coeff = horiz_scan8x8_inv[last_significant_coeff_y][last_significant_coeff_x]; break; default: scan_x_cg = horiz_scan2x2_y; scan_y_cg = horiz_scan2x2_x; scan_x_off = horiz_scan4x4_y; scan_y_off = horiz_scan4x4_x; num_coeff = horiz_scan8x8_inv[last_significant_coeff_x][last_significant_coeff_y]; break; } num_coeff++; num_last_subset = (num_coeff - 1) >> 4; for (i = num_last_subset; i >= 0; i--) { int n, m; int x_cg, y_cg, x_c, y_c, pos; int implicit_non_zero_coeff = 0; int64_t trans_coeff_level; int prev_sig = 0; int offset = i << 4; int rice_init = 0; uint8_t significant_coeff_flag_idx[16]; uint8_t nb_significant_coeff_flag = 0; x_cg = scan_x_cg[i]; y_cg = scan_y_cg[i]; if ((i < num_last_subset) && (i > 0)) { int ctx_cg = 0; if (x_cg < (1 << (log2_trafo_size - 2)) - 1) ctx_cg += significant_coeff_group_flag[x_cg + 1][y_cg]; if (y_cg < (1 << (log2_trafo_size - 2)) - 1) ctx_cg += significant_coeff_group_flag[x_cg][y_cg + 1]; significant_coeff_group_flag[x_cg][y_cg] = significant_coeff_group_flag_decode(s, c_idx, ctx_cg); implicit_non_zero_coeff = 1; } else { significant_coeff_group_flag[x_cg][y_cg] = ((x_cg == x_cg_last_sig && y_cg == y_cg_last_sig) || (x_cg == 0 && y_cg == 0)); } last_scan_pos = num_coeff - offset - 1; if (i == num_last_subset) { n_end = last_scan_pos - 1; significant_coeff_flag_idx[0] = last_scan_pos; nb_significant_coeff_flag = 1; } else { n_end = 15; } if (x_cg < ((1 << log2_trafo_size) - 1) >> 2) prev_sig = !!significant_coeff_group_flag[x_cg + 1][y_cg]; if (y_cg < ((1 << log2_trafo_size) - 1) >> 2) prev_sig += (!!significant_coeff_group_flag[x_cg][y_cg + 1] << 1); if (significant_coeff_group_flag[x_cg][y_cg] && n_end >= 0) { static const uint8_t ctx_idx_map[] = { 0, 1, 4, 5, 2, 3, 4, 5, 6, 6, 8, 8, 7, 7, 8, 8, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 0, 0, 2, 1, 0, 0, 2, 1, 0, 0, 2, 1, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 }; const uint8_t *ctx_idx_map_p; int scf_offset = 0; if (s->sps->transform_skip_context_enabled_flag && (transform_skip_flag || lc->cu.cu_transquant_bypass_flag)) { ctx_idx_map_p = (uint8_t*) &ctx_idx_map[4 * 16]; if (c_idx == 0) { scf_offset = 40; } else { scf_offset = 14 + 27; } } else { if (c_idx != 0) scf_offset = 27; if (log2_trafo_size == 2) { ctx_idx_map_p = (uint8_t*) &ctx_idx_map[0]; } else { ctx_idx_map_p = (uint8_t*) &ctx_idx_map[(prev_sig + 1) << 4]; if (c_idx == 0) { if ((x_cg > 0 || y_cg > 0)) scf_offset += 3; if (log2_trafo_size == 3) { scf_offset += (scan_idx == SCAN_DIAG) ? 9 : 15; } else { scf_offset += 21; } } else { if (log2_trafo_size == 3) scf_offset += 9; else scf_offset += 12; } } } for (n = n_end; n > 0; n--) { x_c = scan_x_off[n]; y_c = scan_y_off[n]; if (significant_coeff_flag_decode(s, x_c, y_c, scf_offset, ctx_idx_map_p)) { significant_coeff_flag_idx[nb_significant_coeff_flag] = n; nb_significant_coeff_flag++; implicit_non_zero_coeff = 0; } } if (implicit_non_zero_coeff == 0) { if (s->sps->transform_skip_context_enabled_flag && (transform_skip_flag || lc->cu.cu_transquant_bypass_flag)) { if (c_idx == 0) { scf_offset = 42; } else { scf_offset = 16 + 27; } } else { if (i == 0) { if (c_idx == 0) scf_offset = 0; else scf_offset = 27; } else { scf_offset = 2 + scf_offset; } } if (significant_coeff_flag_decode_0(s, c_idx, scf_offset) == 1) { significant_coeff_flag_idx[nb_significant_coeff_flag] = 0; nb_significant_coeff_flag++; } } else { significant_coeff_flag_idx[nb_significant_coeff_flag] = 0; nb_significant_coeff_flag++; } } n_end = nb_significant_coeff_flag; if (n_end) { int first_nz_pos_in_cg; int last_nz_pos_in_cg; int c_rice_param = 0; int first_greater1_coeff_idx = -1; uint8_t coeff_abs_level_greater1_flag[8]; uint16_t coeff_sign_flag; int sum_abs = 0; int sign_hidden; int sb_type; int ctx_set = (i > 0 && c_idx == 0) ? 2 : 0; if (s->sps->persistent_rice_adaptation_enabled_flag) { if (!transform_skip_flag && !lc->cu.cu_transquant_bypass_flag) sb_type = 2 * (c_idx == 0 ? 1 : 0); else sb_type = 2 * (c_idx == 0 ? 1 : 0) + 1; c_rice_param = lc->stat_coeff[sb_type] / 4; } if (!(i == num_last_subset) && greater1_ctx == 0) ctx_set++; greater1_ctx = 1; last_nz_pos_in_cg = significant_coeff_flag_idx[0]; for (m = 0; m < (n_end > 8 ? 8 : n_end); m++) { int inc = (ctx_set << 2) + greater1_ctx; coeff_abs_level_greater1_flag[m] = coeff_abs_level_greater1_flag_decode(s, c_idx, inc); if (coeff_abs_level_greater1_flag[m]) { greater1_ctx = 0; if (first_greater1_coeff_idx == -1) first_greater1_coeff_idx = m; } else if (greater1_ctx > 0 && greater1_ctx < 3) { greater1_ctx++; } } first_nz_pos_in_cg = significant_coeff_flag_idx[n_end - 1]; if (lc->cu.cu_transquant_bypass_flag || (lc->cu.pred_mode == MODE_INTRA && s->sps->implicit_rdpcm_enabled_flag && transform_skip_flag && (pred_mode_intra == 10 || pred_mode_intra == 26 )) || explicit_rdpcm_flag) sign_hidden = 0; else sign_hidden = (last_nz_pos_in_cg - first_nz_pos_in_cg >= 4); if (first_greater1_coeff_idx != -1) { coeff_abs_level_greater1_flag[first_greater1_coeff_idx] += coeff_abs_level_greater2_flag_decode(s, c_idx, ctx_set); } if (!s->pps->sign_data_hiding_flag || !sign_hidden ) { coeff_sign_flag = coeff_sign_flag_decode(s, nb_significant_coeff_flag) << (16 - nb_significant_coeff_flag); } else { coeff_sign_flag = coeff_sign_flag_decode(s, nb_significant_coeff_flag - 1) << (16 - (nb_significant_coeff_flag - 1)); } for (m = 0; m < n_end; m++) { n = significant_coeff_flag_idx[m]; GET_COORD(offset, n); if (m < 8) { trans_coeff_level = 1 + coeff_abs_level_greater1_flag[m]; if (trans_coeff_level == ((m == first_greater1_coeff_idx) ? 3 : 2)) { int last_coeff_abs_level_remaining = coeff_abs_level_remaining_decode(s, c_rice_param); trans_coeff_level += last_coeff_abs_level_remaining; if (trans_coeff_level > (3 << c_rice_param)) c_rice_param = s->sps->persistent_rice_adaptation_enabled_flag ? c_rice_param + 1 : FFMIN(c_rice_param + 1, 4); if (s->sps->persistent_rice_adaptation_enabled_flag && !rice_init) { int c_rice_p_init = lc->stat_coeff[sb_type] / 4; if (last_coeff_abs_level_remaining >= (3 << c_rice_p_init)) lc->stat_coeff[sb_type]++; else if (2 * last_coeff_abs_level_remaining < (1 << c_rice_p_init)) if (lc->stat_coeff[sb_type] > 0) lc->stat_coeff[sb_type]--; rice_init = 1; } } } else { int last_coeff_abs_level_remaining = coeff_abs_level_remaining_decode(s, c_rice_param); trans_coeff_level = 1 + last_coeff_abs_level_remaining; if (trans_coeff_level > (3 << c_rice_param)) c_rice_param = s->sps->persistent_rice_adaptation_enabled_flag ? c_rice_param + 1 : FFMIN(c_rice_param + 1, 4); if (s->sps->persistent_rice_adaptation_enabled_flag && !rice_init) { int c_rice_p_init = lc->stat_coeff[sb_type] / 4; if (last_coeff_abs_level_remaining >= (3 << c_rice_p_init)) lc->stat_coeff[sb_type]++; else if (2 * last_coeff_abs_level_remaining < (1 << c_rice_p_init)) if (lc->stat_coeff[sb_type] > 0) lc->stat_coeff[sb_type]--; rice_init = 1; } } if (s->pps->sign_data_hiding_flag && sign_hidden) { sum_abs += trans_coeff_level; if (n == first_nz_pos_in_cg && (sum_abs&1)) trans_coeff_level = -trans_coeff_level; } if (coeff_sign_flag >> 15) trans_coeff_level = -trans_coeff_level; coeff_sign_flag <<= 1; if(!lc->cu.cu_transquant_bypass_flag) { if (s->sps->scaling_list_enable_flag && !(transform_skip_flag && log2_trafo_size > 2)) { if(y_c || x_c || log2_trafo_size < 4) { switch(log2_trafo_size) { case 3: pos = (y_c << 3) + x_c; break; case 4: pos = ((y_c >> 1) << 3) + (x_c >> 1); break; case 5: pos = ((y_c >> 2) << 3) + (x_c >> 2); break; default: pos = (y_c << 2) + x_c; break; } scale_m = scale_matrix[pos]; } else { scale_m = dc_scale; } } trans_coeff_level = (trans_coeff_level * (int64_t)scale * (int64_t)scale_m + add) >> shift; if(trans_coeff_level < 0) { if((~trans_coeff_level) & 0xFffffffffff8000) trans_coeff_level = -32768; } else { if(trans_coeff_level & 0xffffffffffff8000) trans_coeff_level = 32767; } } coeffs[y_c * trafo_size + x_c] = trans_coeff_level; } } } if (lc->cu.cu_transquant_bypass_flag) { if (explicit_rdpcm_flag || (s->sps->implicit_rdpcm_enabled_flag && (pred_mode_intra == 10 || pred_mode_intra == 26))) { int mode = s->sps->implicit_rdpcm_enabled_flag ? (pred_mode_intra == 26) : explicit_rdpcm_dir_flag; s->hevcdsp.transform_rdpcm(coeffs, log2_trafo_size, mode); } } else { if (transform_skip_flag) { int rot = s->sps->transform_skip_rotation_enabled_flag && log2_trafo_size == 2 && lc->cu.pred_mode == MODE_INTRA; if (rot) { for (i = 0; i < 8; i++) FFSWAP(int16_t, coeffs[i], coeffs[16 - i - 1]); } s->hevcdsp.transform_skip(coeffs, log2_trafo_size); if (explicit_rdpcm_flag || (s->sps->implicit_rdpcm_enabled_flag && lc->cu.pred_mode == MODE_INTRA && (pred_mode_intra == 10 || pred_mode_intra == 26))) { int mode = explicit_rdpcm_flag ? explicit_rdpcm_dir_flag : (pred_mode_intra == 26); s->hevcdsp.transform_rdpcm(coeffs, log2_trafo_size, mode); } } else if (lc->cu.pred_mode == MODE_INTRA && c_idx == 0 && log2_trafo_size == 2) { s->hevcdsp.idct_4x4_luma(coeffs); } else { int max_xy = FFMAX(last_significant_coeff_x, last_significant_coeff_y); if (max_xy == 0) s->hevcdsp.idct_dc[log2_trafo_size-2](coeffs); else { int col_limit = last_significant_coeff_x + last_significant_coeff_y + 4; if (max_xy < 4) col_limit = FFMIN(4, col_limit); else if (max_xy < 8) col_limit = FFMIN(8, col_limit); else if (max_xy < 12) col_limit = FFMIN(24, col_limit); s->hevcdsp.idct[log2_trafo_size-2](coeffs, col_limit); } } } if (lc->tu.cross_pf) { int16_t *coeffs_y = lc->tu.coeffs[0]; for (i = 0; i < (trafo_size * trafo_size); i++) { coeffs[i] = coeffs[i] + ((lc->tu.res_scale_val * coeffs_y[i]) >> 3); } } s->hevcdsp.transform_add[log2_trafo_size-2](dst, coeffs, stride); }
{ "code": [], "line_no": [] }
void FUNC_0(HEVCContext *VAR_0, int VAR_1, int VAR_2, int VAR_3, enum ScanType VAR_4, int VAR_5) { #define GET_COORD(VAR_51, VAR_42) \ do { \ VAR_46 = (VAR_44 << 2) + scan_x_off[VAR_42]; \ VAR_47 = (VAR_45 << 2) + scan_y_off[VAR_42]; \ } while (0) HEVCLocalContext *lc = VAR_0->HEVClc; int VAR_6 = 0; int VAR_7, VAR_8; int VAR_9; int VAR_10; int VAR_11 = 0; int VAR_12 = 1; int VAR_13; int VAR_14, VAR_15; const uint8_t *VAR_16, *scan_y_cg, *scan_x_off, *scan_y_off; ptrdiff_t stride = VAR_0->frame->linesize[VAR_5]; int VAR_17 = VAR_0->sps->VAR_17[VAR_5]; int VAR_18 = VAR_0->sps->VAR_18[VAR_5]; uint8_t *dst = &VAR_0->frame->data[VAR_5][(VAR_2 >> VAR_18) * stride + ((VAR_1 >> VAR_17) << VAR_0->sps->pixel_shift)]; int16_t *coeffs = lc->tu.coeffs[VAR_5 > 0]; uint8_t significant_coeff_group_flag[8][8] = {{0}}; int VAR_19 = 0; int VAR_20; int VAR_21 = 1 << VAR_3; int VAR_22; int VAR_23,VAR_24,VAR_25,VAR_26,VAR_27; const uint8_t VAR_28[] = { 40, 45, 51, 57, 64, 72 }; const uint8_t *VAR_29 = NULL; uint8_t dc_scale; int VAR_30 = (VAR_5 == 0) ? lc->tu.intra_pred_mode : lc->tu.intra_pred_mode_c; memset(coeffs, 0, VAR_21 * VAR_21 * sizeof(int16_t)); if (!lc->cu.cu_transquant_bypass_flag) { static const int VAR_31[] = { 29, 30, 31, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37 }; static const uint8_t VAR_32[51 + 4 * 6 + 1] = { 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1 }; static const uint8_t VAR_33[51 + 4 * 6 + 1] = { 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 12, 12 }; int VAR_34 = lc->VAR_34; if (VAR_0->pps->transform_skip_enabled_flag && VAR_3 <= VAR_0->pps->log2_max_transform_skip_block_size) { VAR_6 = ff_hevc_transform_skip_flag_decode(VAR_0, VAR_5); } if (VAR_5 == 0) { VAR_23 = VAR_34 + VAR_0->sps->qp_bd_offset; } else { int VAR_35, VAR_51; if (VAR_5 == 1) VAR_51 = VAR_0->pps->cb_qp_offset + VAR_0->sh.slice_cb_qp_offset + lc->tu.cu_qp_offset_cb; else VAR_51 = VAR_0->pps->cr_qp_offset + VAR_0->sh.slice_cr_qp_offset + lc->tu.cu_qp_offset_cr; VAR_35 = av_clip(VAR_34 + VAR_51, - VAR_0->sps->qp_bd_offset, 57); if (VAR_0->sps->chroma_format_idc == 1) { if (VAR_35 < 30) VAR_23 = VAR_35; else if (VAR_35 > 43) VAR_23 = VAR_35 - 6; else VAR_23 = VAR_31[VAR_35 - 30]; } else { if (VAR_35 > 51) VAR_23 = 51; else VAR_23 = VAR_35; } VAR_23 += VAR_0->sps->qp_bd_offset; } VAR_24 = VAR_0->sps->bit_depth + VAR_3 - 5; VAR_25 = 1 << (VAR_24-1); VAR_26 = VAR_28[VAR_32[VAR_23]] << (VAR_33[VAR_23]); VAR_27 = 16; dc_scale = 16; if (VAR_0->sps->scaling_list_enable_flag && !(VAR_6 && VAR_3 > 2)) { const ScalingList *VAR_37 = VAR_0->pps->scaling_list_data_present_flag ? &VAR_0->pps->scaling_list : &VAR_0->sps->scaling_list; int VAR_38 = lc->cu.pred_mode != MODE_INTRA; VAR_38 = 3 * VAR_38 + VAR_5; VAR_29 = VAR_37->VAR_37[VAR_3 - 2][VAR_38]; if (VAR_3 >= 4) dc_scale = VAR_37->sl_dc[VAR_3 - 4][VAR_38]; } } else { VAR_24 = 0; VAR_25 = 0; VAR_26 = 0; dc_scale = 0; } if (lc->cu.pred_mode == MODE_INTER && VAR_0->sps->explicit_rdpcm_enabled_flag && (VAR_6 || lc->cu.cu_transquant_bypass_flag)) { VAR_19 = explicit_rdpcm_flag_decode(VAR_0, VAR_5); if (VAR_19) { VAR_20 = explicit_rdpcm_dir_flag_decode(VAR_0, VAR_5); } } last_significant_coeff_xy_prefix_decode(VAR_0, VAR_5, VAR_3, &VAR_7, &VAR_8); if (VAR_7 > 3) { int VAR_40 = last_significant_coeff_suffix_decode(VAR_0, VAR_7); VAR_7 = (1 << ((VAR_7 >> 1) - 1)) * (2 + (VAR_7 & 1)) + VAR_40; } if (VAR_8 > 3) { int VAR_40 = last_significant_coeff_suffix_decode(VAR_0, VAR_8); VAR_8 = (1 << ((VAR_8 >> 1) - 1)) * (2 + (VAR_8 & 1)) + VAR_40; } if (VAR_4 == SCAN_VERT) FFSWAP(int, VAR_7, VAR_8); VAR_14 = VAR_7 >> 2; VAR_15 = VAR_8 >> 2; switch (VAR_4) { case SCAN_DIAG: { int VAR_40 = VAR_7 & 3; int VAR_41 = VAR_8 & 3; scan_x_off = ff_hevc_diag_scan4x4_x; scan_y_off = ff_hevc_diag_scan4x4_y; VAR_11 = diag_scan4x4_inv[VAR_41][VAR_40]; if (VAR_21 == 4) { VAR_16 = scan_1x1; scan_y_cg = scan_1x1; } else if (VAR_21 == 8) { VAR_11 += diag_scan2x2_inv[VAR_15][VAR_14] << 4; VAR_16 = diag_scan2x2_x; scan_y_cg = diag_scan2x2_y; } else if (VAR_21 == 16) { VAR_11 += diag_scan4x4_inv[VAR_15][VAR_14] << 4; VAR_16 = ff_hevc_diag_scan4x4_x; scan_y_cg = ff_hevc_diag_scan4x4_y; } else { VAR_11 += diag_scan8x8_inv[VAR_15][VAR_14] << 4; VAR_16 = ff_hevc_diag_scan8x8_x; scan_y_cg = ff_hevc_diag_scan8x8_y; } break; } case SCAN_HORIZ: VAR_16 = horiz_scan2x2_x; scan_y_cg = horiz_scan2x2_y; scan_x_off = horiz_scan4x4_x; scan_y_off = horiz_scan4x4_y; VAR_11 = horiz_scan8x8_inv[VAR_8][VAR_7]; break; default: VAR_16 = horiz_scan2x2_y; scan_y_cg = horiz_scan2x2_x; scan_x_off = horiz_scan4x4_y; scan_y_off = horiz_scan4x4_x; VAR_11 = horiz_scan8x8_inv[VAR_7][VAR_8]; break; } VAR_11++; VAR_13 = (VAR_11 - 1) >> 4; for (VAR_22 = VAR_13; VAR_22 >= 0; VAR_22--) { int VAR_42, VAR_43; int VAR_44, VAR_45, VAR_46, VAR_47, VAR_48; int VAR_49 = 0; int64_t trans_coeff_level; int VAR_50 = 0; int VAR_51 = VAR_22 << 4; int VAR_51 = 0; uint8_t significant_coeff_flag_idx[16]; uint8_t nb_significant_coeff_flag = 0; VAR_44 = VAR_16[VAR_22]; VAR_45 = scan_y_cg[VAR_22]; if ((VAR_22 < VAR_13) && (VAR_22 > 0)) { int VAR_52 = 0; if (VAR_44 < (1 << (VAR_3 - 2)) - 1) VAR_52 += significant_coeff_group_flag[VAR_44 + 1][VAR_45]; if (VAR_45 < (1 << (VAR_3 - 2)) - 1) VAR_52 += significant_coeff_group_flag[VAR_44][VAR_45 + 1]; significant_coeff_group_flag[VAR_44][VAR_45] = significant_coeff_group_flag_decode(VAR_0, VAR_5, VAR_52); VAR_49 = 1; } else { significant_coeff_group_flag[VAR_44][VAR_45] = ((VAR_44 == VAR_14 && VAR_45 == VAR_15) || (VAR_44 == 0 && VAR_45 == 0)); } VAR_9 = VAR_11 - VAR_51 - 1; if (VAR_22 == VAR_13) { VAR_10 = VAR_9 - 1; significant_coeff_flag_idx[0] = VAR_9; nb_significant_coeff_flag = 1; } else { VAR_10 = 15; } if (VAR_44 < ((1 << VAR_3) - 1) >> 2) VAR_50 = !!significant_coeff_group_flag[VAR_44 + 1][VAR_45]; if (VAR_45 < ((1 << VAR_3) - 1) >> 2) VAR_50 += (!!significant_coeff_group_flag[VAR_44][VAR_45 + 1] << 1); if (significant_coeff_group_flag[VAR_44][VAR_45] && VAR_10 >= 0) { static const uint8_t VAR_53[] = { 0, 1, 4, 5, 2, 3, 4, 5, 6, 6, 8, 8, 7, 7, 8, 8, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 0, 0, 2, 1, 0, 0, 2, 1, 0, 0, 2, 1, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 }; const uint8_t *VAR_54; int VAR_55 = 0; if (VAR_0->sps->transform_skip_context_enabled_flag && (VAR_6 || lc->cu.cu_transquant_bypass_flag)) { VAR_54 = (uint8_t*) &VAR_53[4 * 16]; if (VAR_5 == 0) { VAR_55 = 40; } else { VAR_55 = 14 + 27; } } else { if (VAR_5 != 0) VAR_55 = 27; if (VAR_3 == 2) { VAR_54 = (uint8_t*) &VAR_53[0]; } else { VAR_54 = (uint8_t*) &VAR_53[(VAR_50 + 1) << 4]; if (VAR_5 == 0) { if ((VAR_44 > 0 || VAR_45 > 0)) VAR_55 += 3; if (VAR_3 == 3) { VAR_55 += (VAR_4 == SCAN_DIAG) ? 9 : 15; } else { VAR_55 += 21; } } else { if (VAR_3 == 3) VAR_55 += 9; else VAR_55 += 12; } } } for (VAR_42 = VAR_10; VAR_42 > 0; VAR_42--) { VAR_46 = scan_x_off[VAR_42]; VAR_47 = scan_y_off[VAR_42]; if (significant_coeff_flag_decode(VAR_0, VAR_46, VAR_47, VAR_55, VAR_54)) { significant_coeff_flag_idx[nb_significant_coeff_flag] = VAR_42; nb_significant_coeff_flag++; VAR_49 = 0; } } if (VAR_49 == 0) { if (VAR_0->sps->transform_skip_context_enabled_flag && (VAR_6 || lc->cu.cu_transquant_bypass_flag)) { if (VAR_5 == 0) { VAR_55 = 42; } else { VAR_55 = 16 + 27; } } else { if (VAR_22 == 0) { if (VAR_5 == 0) VAR_55 = 0; else VAR_55 = 27; } else { VAR_55 = 2 + VAR_55; } } if (significant_coeff_flag_decode_0(VAR_0, VAR_5, VAR_55) == 1) { significant_coeff_flag_idx[nb_significant_coeff_flag] = 0; nb_significant_coeff_flag++; } } else { significant_coeff_flag_idx[nb_significant_coeff_flag] = 0; nb_significant_coeff_flag++; } } VAR_10 = nb_significant_coeff_flag; if (VAR_10) { int VAR_56; int VAR_57; int VAR_58 = 0; int VAR_59 = -1; uint8_t coeff_abs_level_greater1_flag[8]; uint16_t coeff_sign_flag; int VAR_60 = 0; int VAR_61; int VAR_62; int VAR_63 = (VAR_22 > 0 && VAR_5 == 0) ? 2 : 0; if (VAR_0->sps->persistent_rice_adaptation_enabled_flag) { if (!VAR_6 && !lc->cu.cu_transquant_bypass_flag) VAR_62 = 2 * (VAR_5 == 0 ? 1 : 0); else VAR_62 = 2 * (VAR_5 == 0 ? 1 : 0) + 1; VAR_58 = lc->stat_coeff[VAR_62] / 4; } if (!(VAR_22 == VAR_13) && VAR_12 == 0) VAR_63++; VAR_12 = 1; VAR_57 = significant_coeff_flag_idx[0]; for (VAR_43 = 0; VAR_43 < (VAR_10 > 8 ? 8 : VAR_10); VAR_43++) { int VAR_64 = (VAR_63 << 2) + VAR_12; coeff_abs_level_greater1_flag[VAR_43] = coeff_abs_level_greater1_flag_decode(VAR_0, VAR_5, VAR_64); if (coeff_abs_level_greater1_flag[VAR_43]) { VAR_12 = 0; if (VAR_59 == -1) VAR_59 = VAR_43; } else if (VAR_12 > 0 && VAR_12 < 3) { VAR_12++; } } VAR_56 = significant_coeff_flag_idx[VAR_10 - 1]; if (lc->cu.cu_transquant_bypass_flag || (lc->cu.pred_mode == MODE_INTRA && VAR_0->sps->implicit_rdpcm_enabled_flag && VAR_6 && (VAR_30 == 10 || VAR_30 == 26 )) || VAR_19) VAR_61 = 0; else VAR_61 = (VAR_57 - VAR_56 >= 4); if (VAR_59 != -1) { coeff_abs_level_greater1_flag[VAR_59] += coeff_abs_level_greater2_flag_decode(VAR_0, VAR_5, VAR_63); } if (!VAR_0->pps->sign_data_hiding_flag || !VAR_61 ) { coeff_sign_flag = coeff_sign_flag_decode(VAR_0, nb_significant_coeff_flag) << (16 - nb_significant_coeff_flag); } else { coeff_sign_flag = coeff_sign_flag_decode(VAR_0, nb_significant_coeff_flag - 1) << (16 - (nb_significant_coeff_flag - 1)); } for (VAR_43 = 0; VAR_43 < VAR_10; VAR_43++) { VAR_42 = significant_coeff_flag_idx[VAR_43]; GET_COORD(VAR_51, VAR_42); if (VAR_43 < 8) { trans_coeff_level = 1 + coeff_abs_level_greater1_flag[VAR_43]; if (trans_coeff_level == ((VAR_43 == VAR_59) ? 3 : 2)) { int VAR_67 = coeff_abs_level_remaining_decode(VAR_0, VAR_58); trans_coeff_level += VAR_67; if (trans_coeff_level > (3 << VAR_58)) VAR_58 = VAR_0->sps->persistent_rice_adaptation_enabled_flag ? VAR_58 + 1 : FFMIN(VAR_58 + 1, 4); if (VAR_0->sps->persistent_rice_adaptation_enabled_flag && !VAR_51) { int VAR_67 = lc->stat_coeff[VAR_62] / 4; if (VAR_67 >= (3 << VAR_67)) lc->stat_coeff[VAR_62]++; else if (2 * VAR_67 < (1 << VAR_67)) if (lc->stat_coeff[VAR_62] > 0) lc->stat_coeff[VAR_62]--; VAR_51 = 1; } } } else { int VAR_67 = coeff_abs_level_remaining_decode(VAR_0, VAR_58); trans_coeff_level = 1 + VAR_67; if (trans_coeff_level > (3 << VAR_58)) VAR_58 = VAR_0->sps->persistent_rice_adaptation_enabled_flag ? VAR_58 + 1 : FFMIN(VAR_58 + 1, 4); if (VAR_0->sps->persistent_rice_adaptation_enabled_flag && !VAR_51) { int VAR_67 = lc->stat_coeff[VAR_62] / 4; if (VAR_67 >= (3 << VAR_67)) lc->stat_coeff[VAR_62]++; else if (2 * VAR_67 < (1 << VAR_67)) if (lc->stat_coeff[VAR_62] > 0) lc->stat_coeff[VAR_62]--; VAR_51 = 1; } } if (VAR_0->pps->sign_data_hiding_flag && VAR_61) { VAR_60 += trans_coeff_level; if (VAR_42 == VAR_56 && (VAR_60&1)) trans_coeff_level = -trans_coeff_level; } if (coeff_sign_flag >> 15) trans_coeff_level = -trans_coeff_level; coeff_sign_flag <<= 1; if(!lc->cu.cu_transquant_bypass_flag) { if (VAR_0->sps->scaling_list_enable_flag && !(VAR_6 && VAR_3 > 2)) { if(VAR_47 || VAR_46 || VAR_3 < 4) { switch(VAR_3) { case 3: VAR_48 = (VAR_47 << 3) + VAR_46; break; case 4: VAR_48 = ((VAR_47 >> 1) << 3) + (VAR_46 >> 1); break; case 5: VAR_48 = ((VAR_47 >> 2) << 3) + (VAR_46 >> 2); break; default: VAR_48 = (VAR_47 << 2) + VAR_46; break; } VAR_27 = VAR_29[VAR_48]; } else { VAR_27 = dc_scale; } } trans_coeff_level = (trans_coeff_level * (int64_t)VAR_26 * (int64_t)VAR_27 + VAR_25) >> VAR_24; if(trans_coeff_level < 0) { if((~trans_coeff_level) & 0xFffffffffff8000) trans_coeff_level = -32768; } else { if(trans_coeff_level & 0xffffffffffff8000) trans_coeff_level = 32767; } } coeffs[VAR_47 * VAR_21 + VAR_46] = trans_coeff_level; } } } if (lc->cu.cu_transquant_bypass_flag) { if (VAR_19 || (VAR_0->sps->implicit_rdpcm_enabled_flag && (VAR_30 == 10 || VAR_30 == 26))) { int VAR_69 = VAR_0->sps->implicit_rdpcm_enabled_flag ? (VAR_30 == 26) : VAR_20; VAR_0->hevcdsp.transform_rdpcm(coeffs, VAR_3, VAR_69); } } else { if (VAR_6) { int VAR_68 = VAR_0->sps->transform_skip_rotation_enabled_flag && VAR_3 == 2 && lc->cu.pred_mode == MODE_INTRA; if (VAR_68) { for (VAR_22 = 0; VAR_22 < 8; VAR_22++) FFSWAP(int16_t, coeffs[VAR_22], coeffs[16 - VAR_22 - 1]); } VAR_0->hevcdsp.transform_skip(coeffs, VAR_3); if (VAR_19 || (VAR_0->sps->implicit_rdpcm_enabled_flag && lc->cu.pred_mode == MODE_INTRA && (VAR_30 == 10 || VAR_30 == 26))) { int VAR_69 = VAR_19 ? VAR_20 : (VAR_30 == 26); VAR_0->hevcdsp.transform_rdpcm(coeffs, VAR_3, VAR_69); } } else if (lc->cu.pred_mode == MODE_INTRA && VAR_5 == 0 && VAR_3 == 2) { VAR_0->hevcdsp.idct_4x4_luma(coeffs); } else { int VAR_69 = FFMAX(VAR_7, VAR_8); if (VAR_69 == 0) VAR_0->hevcdsp.idct_dc[VAR_3-2](coeffs); else { int VAR_70 = VAR_7 + VAR_8 + 4; if (VAR_69 < 4) VAR_70 = FFMIN(4, VAR_70); else if (VAR_69 < 8) VAR_70 = FFMIN(8, VAR_70); else if (VAR_69 < 12) VAR_70 = FFMIN(24, VAR_70); VAR_0->hevcdsp.idct[VAR_3-2](coeffs, VAR_70); } } } if (lc->tu.cross_pf) { int16_t *coeffs_y = lc->tu.coeffs[0]; for (VAR_22 = 0; VAR_22 < (VAR_21 * VAR_21); VAR_22++) { coeffs[VAR_22] = coeffs[VAR_22] + ((lc->tu.res_scale_val * coeffs_y[VAR_22]) >> 3); } } VAR_0->hevcdsp.transform_add[VAR_3-2](dst, coeffs, stride); }
[ "void FUNC_0(HEVCContext *VAR_0, int VAR_1, int VAR_2,\nint VAR_3, enum ScanType VAR_4,\nint VAR_5)\n{", "#define GET_COORD(VAR_51, VAR_42) \\\ndo { \\", "VAR_46 = (VAR_44 << 2) + scan_x_off[VAR_42]; \\", "VAR_47 = (VAR_45 << 2) + scan_y_off[VAR_42]; \\", "} while (0)", "HEVCLocalContext *lc = VAR_0->HEVClc;", "int VAR_6 = 0;", "int VAR_7, VAR_8;", "int VAR_9;", "int VAR_10;", "int VAR_11 = 0;", "int VAR_12 = 1;", "int VAR_13;", "int VAR_14, VAR_15;", "const uint8_t *VAR_16, *scan_y_cg, *scan_x_off, *scan_y_off;", "ptrdiff_t stride = VAR_0->frame->linesize[VAR_5];", "int VAR_17 = VAR_0->sps->VAR_17[VAR_5];", "int VAR_18 = VAR_0->sps->VAR_18[VAR_5];", "uint8_t *dst = &VAR_0->frame->data[VAR_5][(VAR_2 >> VAR_18) * stride +\n((VAR_1 >> VAR_17) << VAR_0->sps->pixel_shift)];", "int16_t *coeffs = lc->tu.coeffs[VAR_5 > 0];", "uint8_t significant_coeff_group_flag[8][8] = {{0}};", "int VAR_19 = 0;", "int VAR_20;", "int VAR_21 = 1 << VAR_3;", "int VAR_22;", "int VAR_23,VAR_24,VAR_25,VAR_26,VAR_27;", "const uint8_t VAR_28[] = { 40, 45, 51, 57, 64, 72 };", "const uint8_t *VAR_29 = NULL;", "uint8_t dc_scale;", "int VAR_30 = (VAR_5 == 0) ? lc->tu.intra_pred_mode :\nlc->tu.intra_pred_mode_c;", "memset(coeffs, 0, VAR_21 * VAR_21 * sizeof(int16_t));", "if (!lc->cu.cu_transquant_bypass_flag) {", "static const int VAR_31[] = { 29, 30, 31, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37 };", "static const uint8_t VAR_32[51 + 4 * 6 + 1] = {", "0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2,\n3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5,\n0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3,\n4, 5, 0, 1, 2, 3, 4, 5, 0, 1\n};", "static const uint8_t VAR_33[51 + 4 * 6 + 1] = {", "0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3,\n3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6,\n7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10,\n10, 10, 11, 11, 11, 11, 11, 11, 12, 12\n};", "int VAR_34 = lc->VAR_34;", "if (VAR_0->pps->transform_skip_enabled_flag &&\nVAR_3 <= VAR_0->pps->log2_max_transform_skip_block_size) {", "VAR_6 = ff_hevc_transform_skip_flag_decode(VAR_0, VAR_5);", "}", "if (VAR_5 == 0) {", "VAR_23 = VAR_34 + VAR_0->sps->qp_bd_offset;", "} else {", "int VAR_35, VAR_51;", "if (VAR_5 == 1)\nVAR_51 = VAR_0->pps->cb_qp_offset + VAR_0->sh.slice_cb_qp_offset +\nlc->tu.cu_qp_offset_cb;", "else\nVAR_51 = VAR_0->pps->cr_qp_offset + VAR_0->sh.slice_cr_qp_offset +\nlc->tu.cu_qp_offset_cr;", "VAR_35 = av_clip(VAR_34 + VAR_51, - VAR_0->sps->qp_bd_offset, 57);", "if (VAR_0->sps->chroma_format_idc == 1) {", "if (VAR_35 < 30)\nVAR_23 = VAR_35;", "else if (VAR_35 > 43)\nVAR_23 = VAR_35 - 6;", "else\nVAR_23 = VAR_31[VAR_35 - 30];", "} else {", "if (VAR_35 > 51)\nVAR_23 = 51;", "else\nVAR_23 = VAR_35;", "}", "VAR_23 += VAR_0->sps->qp_bd_offset;", "}", "VAR_24 = VAR_0->sps->bit_depth + VAR_3 - 5;", "VAR_25 = 1 << (VAR_24-1);", "VAR_26 = VAR_28[VAR_32[VAR_23]] << (VAR_33[VAR_23]);", "VAR_27 = 16;", "dc_scale = 16;", "if (VAR_0->sps->scaling_list_enable_flag && !(VAR_6 && VAR_3 > 2)) {", "const ScalingList *VAR_37 = VAR_0->pps->scaling_list_data_present_flag ?\n&VAR_0->pps->scaling_list : &VAR_0->sps->scaling_list;", "int VAR_38 = lc->cu.pred_mode != MODE_INTRA;", "VAR_38 = 3 * VAR_38 + VAR_5;", "VAR_29 = VAR_37->VAR_37[VAR_3 - 2][VAR_38];", "if (VAR_3 >= 4)\ndc_scale = VAR_37->sl_dc[VAR_3 - 4][VAR_38];", "}", "} else {", "VAR_24 = 0;", "VAR_25 = 0;", "VAR_26 = 0;", "dc_scale = 0;", "}", "if (lc->cu.pred_mode == MODE_INTER && VAR_0->sps->explicit_rdpcm_enabled_flag &&\n(VAR_6 || lc->cu.cu_transquant_bypass_flag)) {", "VAR_19 = explicit_rdpcm_flag_decode(VAR_0, VAR_5);", "if (VAR_19) {", "VAR_20 = explicit_rdpcm_dir_flag_decode(VAR_0, VAR_5);", "}", "}", "last_significant_coeff_xy_prefix_decode(VAR_0, VAR_5, VAR_3,\n&VAR_7, &VAR_8);", "if (VAR_7 > 3) {", "int VAR_40 = last_significant_coeff_suffix_decode(VAR_0, VAR_7);", "VAR_7 = (1 << ((VAR_7 >> 1) - 1)) *\n(2 + (VAR_7 & 1)) +\nVAR_40;", "}", "if (VAR_8 > 3) {", "int VAR_40 = last_significant_coeff_suffix_decode(VAR_0, VAR_8);", "VAR_8 = (1 << ((VAR_8 >> 1) - 1)) *\n(2 + (VAR_8 & 1)) +\nVAR_40;", "}", "if (VAR_4 == SCAN_VERT)\nFFSWAP(int, VAR_7, VAR_8);", "VAR_14 = VAR_7 >> 2;", "VAR_15 = VAR_8 >> 2;", "switch (VAR_4) {", "case SCAN_DIAG: {", "int VAR_40 = VAR_7 & 3;", "int VAR_41 = VAR_8 & 3;", "scan_x_off = ff_hevc_diag_scan4x4_x;", "scan_y_off = ff_hevc_diag_scan4x4_y;", "VAR_11 = diag_scan4x4_inv[VAR_41][VAR_40];", "if (VAR_21 == 4) {", "VAR_16 = scan_1x1;", "scan_y_cg = scan_1x1;", "} else if (VAR_21 == 8) {", "VAR_11 += diag_scan2x2_inv[VAR_15][VAR_14] << 4;", "VAR_16 = diag_scan2x2_x;", "scan_y_cg = diag_scan2x2_y;", "} else if (VAR_21 == 16) {", "VAR_11 += diag_scan4x4_inv[VAR_15][VAR_14] << 4;", "VAR_16 = ff_hevc_diag_scan4x4_x;", "scan_y_cg = ff_hevc_diag_scan4x4_y;", "} else {", "VAR_11 += diag_scan8x8_inv[VAR_15][VAR_14] << 4;", "VAR_16 = ff_hevc_diag_scan8x8_x;", "scan_y_cg = ff_hevc_diag_scan8x8_y;", "}", "break;", "}", "case SCAN_HORIZ:\nVAR_16 = horiz_scan2x2_x;", "scan_y_cg = horiz_scan2x2_y;", "scan_x_off = horiz_scan4x4_x;", "scan_y_off = horiz_scan4x4_y;", "VAR_11 = horiz_scan8x8_inv[VAR_8][VAR_7];", "break;", "default:\nVAR_16 = horiz_scan2x2_y;", "scan_y_cg = horiz_scan2x2_x;", "scan_x_off = horiz_scan4x4_y;", "scan_y_off = horiz_scan4x4_x;", "VAR_11 = horiz_scan8x8_inv[VAR_7][VAR_8];", "break;", "}", "VAR_11++;", "VAR_13 = (VAR_11 - 1) >> 4;", "for (VAR_22 = VAR_13; VAR_22 >= 0; VAR_22--) {", "int VAR_42, VAR_43;", "int VAR_44, VAR_45, VAR_46, VAR_47, VAR_48;", "int VAR_49 = 0;", "int64_t trans_coeff_level;", "int VAR_50 = 0;", "int VAR_51 = VAR_22 << 4;", "int VAR_51 = 0;", "uint8_t significant_coeff_flag_idx[16];", "uint8_t nb_significant_coeff_flag = 0;", "VAR_44 = VAR_16[VAR_22];", "VAR_45 = scan_y_cg[VAR_22];", "if ((VAR_22 < VAR_13) && (VAR_22 > 0)) {", "int VAR_52 = 0;", "if (VAR_44 < (1 << (VAR_3 - 2)) - 1)\nVAR_52 += significant_coeff_group_flag[VAR_44 + 1][VAR_45];", "if (VAR_45 < (1 << (VAR_3 - 2)) - 1)\nVAR_52 += significant_coeff_group_flag[VAR_44][VAR_45 + 1];", "significant_coeff_group_flag[VAR_44][VAR_45] =\nsignificant_coeff_group_flag_decode(VAR_0, VAR_5, VAR_52);", "VAR_49 = 1;", "} else {", "significant_coeff_group_flag[VAR_44][VAR_45] =\n((VAR_44 == VAR_14 && VAR_45 == VAR_15) ||\n(VAR_44 == 0 && VAR_45 == 0));", "}", "VAR_9 = VAR_11 - VAR_51 - 1;", "if (VAR_22 == VAR_13) {", "VAR_10 = VAR_9 - 1;", "significant_coeff_flag_idx[0] = VAR_9;", "nb_significant_coeff_flag = 1;", "} else {", "VAR_10 = 15;", "}", "if (VAR_44 < ((1 << VAR_3) - 1) >> 2)\nVAR_50 = !!significant_coeff_group_flag[VAR_44 + 1][VAR_45];", "if (VAR_45 < ((1 << VAR_3) - 1) >> 2)\nVAR_50 += (!!significant_coeff_group_flag[VAR_44][VAR_45 + 1] << 1);", "if (significant_coeff_group_flag[VAR_44][VAR_45] && VAR_10 >= 0) {", "static const uint8_t VAR_53[] = {", "0, 1, 4, 5, 2, 3, 4, 5, 6, 6, 8, 8, 7, 7, 8, 8,\n1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,\n2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,\n2, 1, 0, 0, 2, 1, 0, 0, 2, 1, 0, 0, 2, 1, 0, 0,\n2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2\n};", "const uint8_t *VAR_54;", "int VAR_55 = 0;", "if (VAR_0->sps->transform_skip_context_enabled_flag &&\n(VAR_6 || lc->cu.cu_transquant_bypass_flag)) {", "VAR_54 = (uint8_t*) &VAR_53[4 * 16];", "if (VAR_5 == 0) {", "VAR_55 = 40;", "} else {", "VAR_55 = 14 + 27;", "}", "} else {", "if (VAR_5 != 0)\nVAR_55 = 27;", "if (VAR_3 == 2) {", "VAR_54 = (uint8_t*) &VAR_53[0];", "} else {", "VAR_54 = (uint8_t*) &VAR_53[(VAR_50 + 1) << 4];", "if (VAR_5 == 0) {", "if ((VAR_44 > 0 || VAR_45 > 0))\nVAR_55 += 3;", "if (VAR_3 == 3) {", "VAR_55 += (VAR_4 == SCAN_DIAG) ? 9 : 15;", "} else {", "VAR_55 += 21;", "}", "} else {", "if (VAR_3 == 3)\nVAR_55 += 9;", "else\nVAR_55 += 12;", "}", "}", "}", "for (VAR_42 = VAR_10; VAR_42 > 0; VAR_42--) {", "VAR_46 = scan_x_off[VAR_42];", "VAR_47 = scan_y_off[VAR_42];", "if (significant_coeff_flag_decode(VAR_0, VAR_46, VAR_47, VAR_55, VAR_54)) {", "significant_coeff_flag_idx[nb_significant_coeff_flag] = VAR_42;", "nb_significant_coeff_flag++;", "VAR_49 = 0;", "}", "}", "if (VAR_49 == 0) {", "if (VAR_0->sps->transform_skip_context_enabled_flag &&\n(VAR_6 || lc->cu.cu_transquant_bypass_flag)) {", "if (VAR_5 == 0) {", "VAR_55 = 42;", "} else {", "VAR_55 = 16 + 27;", "}", "} else {", "if (VAR_22 == 0) {", "if (VAR_5 == 0)\nVAR_55 = 0;", "else\nVAR_55 = 27;", "} else {", "VAR_55 = 2 + VAR_55;", "}", "}", "if (significant_coeff_flag_decode_0(VAR_0, VAR_5, VAR_55) == 1) {", "significant_coeff_flag_idx[nb_significant_coeff_flag] = 0;", "nb_significant_coeff_flag++;", "}", "} else {", "significant_coeff_flag_idx[nb_significant_coeff_flag] = 0;", "nb_significant_coeff_flag++;", "}", "}", "VAR_10 = nb_significant_coeff_flag;", "if (VAR_10) {", "int VAR_56;", "int VAR_57;", "int VAR_58 = 0;", "int VAR_59 = -1;", "uint8_t coeff_abs_level_greater1_flag[8];", "uint16_t coeff_sign_flag;", "int VAR_60 = 0;", "int VAR_61;", "int VAR_62;", "int VAR_63 = (VAR_22 > 0 && VAR_5 == 0) ? 2 : 0;", "if (VAR_0->sps->persistent_rice_adaptation_enabled_flag) {", "if (!VAR_6 && !lc->cu.cu_transquant_bypass_flag)\nVAR_62 = 2 * (VAR_5 == 0 ? 1 : 0);", "else\nVAR_62 = 2 * (VAR_5 == 0 ? 1 : 0) + 1;", "VAR_58 = lc->stat_coeff[VAR_62] / 4;", "}", "if (!(VAR_22 == VAR_13) && VAR_12 == 0)\nVAR_63++;", "VAR_12 = 1;", "VAR_57 = significant_coeff_flag_idx[0];", "for (VAR_43 = 0; VAR_43 < (VAR_10 > 8 ? 8 : VAR_10); VAR_43++) {", "int VAR_64 = (VAR_63 << 2) + VAR_12;", "coeff_abs_level_greater1_flag[VAR_43] =\ncoeff_abs_level_greater1_flag_decode(VAR_0, VAR_5, VAR_64);", "if (coeff_abs_level_greater1_flag[VAR_43]) {", "VAR_12 = 0;", "if (VAR_59 == -1)\nVAR_59 = VAR_43;", "} else if (VAR_12 > 0 && VAR_12 < 3) {", "VAR_12++;", "}", "}", "VAR_56 = significant_coeff_flag_idx[VAR_10 - 1];", "if (lc->cu.cu_transquant_bypass_flag ||\n(lc->cu.pred_mode == MODE_INTRA &&\nVAR_0->sps->implicit_rdpcm_enabled_flag && VAR_6 &&\n(VAR_30 == 10 || VAR_30 == 26 )) ||\nVAR_19)\nVAR_61 = 0;", "else\nVAR_61 = (VAR_57 - VAR_56 >= 4);", "if (VAR_59 != -1) {", "coeff_abs_level_greater1_flag[VAR_59] += coeff_abs_level_greater2_flag_decode(VAR_0, VAR_5, VAR_63);", "}", "if (!VAR_0->pps->sign_data_hiding_flag || !VAR_61 ) {", "coeff_sign_flag = coeff_sign_flag_decode(VAR_0, nb_significant_coeff_flag) << (16 - nb_significant_coeff_flag);", "} else {", "coeff_sign_flag = coeff_sign_flag_decode(VAR_0, nb_significant_coeff_flag - 1) << (16 - (nb_significant_coeff_flag - 1));", "}", "for (VAR_43 = 0; VAR_43 < VAR_10; VAR_43++) {", "VAR_42 = significant_coeff_flag_idx[VAR_43];", "GET_COORD(VAR_51, VAR_42);", "if (VAR_43 < 8) {", "trans_coeff_level = 1 + coeff_abs_level_greater1_flag[VAR_43];", "if (trans_coeff_level == ((VAR_43 == VAR_59) ? 3 : 2)) {", "int VAR_67 = coeff_abs_level_remaining_decode(VAR_0, VAR_58);", "trans_coeff_level += VAR_67;", "if (trans_coeff_level > (3 << VAR_58))\nVAR_58 = VAR_0->sps->persistent_rice_adaptation_enabled_flag ? VAR_58 + 1 : FFMIN(VAR_58 + 1, 4);", "if (VAR_0->sps->persistent_rice_adaptation_enabled_flag && !VAR_51) {", "int VAR_67 = lc->stat_coeff[VAR_62] / 4;", "if (VAR_67 >= (3 << VAR_67))\nlc->stat_coeff[VAR_62]++;", "else if (2 * VAR_67 < (1 << VAR_67))\nif (lc->stat_coeff[VAR_62] > 0)\nlc->stat_coeff[VAR_62]--;", "VAR_51 = 1;", "}", "}", "} else {", "int VAR_67 = coeff_abs_level_remaining_decode(VAR_0, VAR_58);", "trans_coeff_level = 1 + VAR_67;", "if (trans_coeff_level > (3 << VAR_58))\nVAR_58 = VAR_0->sps->persistent_rice_adaptation_enabled_flag ? VAR_58 + 1 : FFMIN(VAR_58 + 1, 4);", "if (VAR_0->sps->persistent_rice_adaptation_enabled_flag && !VAR_51) {", "int VAR_67 = lc->stat_coeff[VAR_62] / 4;", "if (VAR_67 >= (3 << VAR_67))\nlc->stat_coeff[VAR_62]++;", "else if (2 * VAR_67 < (1 << VAR_67))\nif (lc->stat_coeff[VAR_62] > 0)\nlc->stat_coeff[VAR_62]--;", "VAR_51 = 1;", "}", "}", "if (VAR_0->pps->sign_data_hiding_flag && VAR_61) {", "VAR_60 += trans_coeff_level;", "if (VAR_42 == VAR_56 && (VAR_60&1))\ntrans_coeff_level = -trans_coeff_level;", "}", "if (coeff_sign_flag >> 15)\ntrans_coeff_level = -trans_coeff_level;", "coeff_sign_flag <<= 1;", "if(!lc->cu.cu_transquant_bypass_flag) {", "if (VAR_0->sps->scaling_list_enable_flag && !(VAR_6 && VAR_3 > 2)) {", "if(VAR_47 || VAR_46 || VAR_3 < 4) {", "switch(VAR_3) {", "case 3: VAR_48 = (VAR_47 << 3) + VAR_46; break;", "case 4: VAR_48 = ((VAR_47 >> 1) << 3) + (VAR_46 >> 1); break;", "case 5: VAR_48 = ((VAR_47 >> 2) << 3) + (VAR_46 >> 2); break;", "default: VAR_48 = (VAR_47 << 2) + VAR_46; break;", "}", "VAR_27 = VAR_29[VAR_48];", "} else {", "VAR_27 = dc_scale;", "}", "}", "trans_coeff_level = (trans_coeff_level * (int64_t)VAR_26 * (int64_t)VAR_27 + VAR_25) >> VAR_24;", "if(trans_coeff_level < 0) {", "if((~trans_coeff_level) & 0xFffffffffff8000)\ntrans_coeff_level = -32768;", "} else {", "if(trans_coeff_level & 0xffffffffffff8000)\ntrans_coeff_level = 32767;", "}", "}", "coeffs[VAR_47 * VAR_21 + VAR_46] = trans_coeff_level;", "}", "}", "}", "if (lc->cu.cu_transquant_bypass_flag) {", "if (VAR_19 || (VAR_0->sps->implicit_rdpcm_enabled_flag &&\n(VAR_30 == 10 || VAR_30 == 26))) {", "int VAR_69 = VAR_0->sps->implicit_rdpcm_enabled_flag ? (VAR_30 == 26) : VAR_20;", "VAR_0->hevcdsp.transform_rdpcm(coeffs, VAR_3, VAR_69);", "}", "} else {", "if (VAR_6) {", "int VAR_68 = VAR_0->sps->transform_skip_rotation_enabled_flag &&\nVAR_3 == 2 &&\nlc->cu.pred_mode == MODE_INTRA;", "if (VAR_68) {", "for (VAR_22 = 0; VAR_22 < 8; VAR_22++)", "FFSWAP(int16_t, coeffs[VAR_22], coeffs[16 - VAR_22 - 1]);", "}", "VAR_0->hevcdsp.transform_skip(coeffs, VAR_3);", "if (VAR_19 || (VAR_0->sps->implicit_rdpcm_enabled_flag &&\nlc->cu.pred_mode == MODE_INTRA &&\n(VAR_30 == 10 || VAR_30 == 26))) {", "int VAR_69 = VAR_19 ? VAR_20 : (VAR_30 == 26);", "VAR_0->hevcdsp.transform_rdpcm(coeffs, VAR_3, VAR_69);", "}", "} else if (lc->cu.pred_mode == MODE_INTRA && VAR_5 == 0 && VAR_3 == 2) {", "VAR_0->hevcdsp.idct_4x4_luma(coeffs);", "} else {", "int VAR_69 = FFMAX(VAR_7, VAR_8);", "if (VAR_69 == 0)\nVAR_0->hevcdsp.idct_dc[VAR_3-2](coeffs);", "else {", "int VAR_70 = VAR_7 + VAR_8 + 4;", "if (VAR_69 < 4)\nVAR_70 = FFMIN(4, VAR_70);", "else if (VAR_69 < 8)\nVAR_70 = FFMIN(8, VAR_70);", "else if (VAR_69 < 12)\nVAR_70 = FFMIN(24, VAR_70);", "VAR_0->hevcdsp.idct[VAR_3-2](coeffs, VAR_70);", "}", "}", "}", "if (lc->tu.cross_pf) {", "int16_t *coeffs_y = lc->tu.coeffs[0];", "for (VAR_22 = 0; VAR_22 < (VAR_21 * VAR_21); VAR_22++) {", "coeffs[VAR_22] = coeffs[VAR_22] + ((lc->tu.res_scale_val * coeffs_y[VAR_22]) >> 3);", "}", "}", "VAR_0->hevcdsp.transform_add[VAR_3-2](dst, coeffs, stride);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9, 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53, 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79, 81 ], [ 85 ], [ 91 ], [ 93 ], [ 95 ], [ 97, 99, 101, 103, 105 ], [ 109 ], [ 111, 113, 115, 117, 119 ], [ 121 ], [ 125, 127 ], [ 129 ], [ 131 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 145, 147, 149 ], [ 151, 153, 155 ], [ 159 ], [ 161 ], [ 163, 165 ], [ 167, 169 ], [ 171, 173 ], [ 175 ], [ 177, 179 ], [ 181, 183 ], [ 185 ], [ 189 ], [ 191 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 207 ], [ 209, 211 ], [ 213 ], [ 217 ], [ 221 ], [ 223, 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 243, 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ], [ 259, 261 ], [ 265 ], [ 267 ], [ 269, 271, 273 ], [ 275 ], [ 279 ], [ 281 ], [ 283, 285, 287 ], [ 289 ], [ 293, 295 ], [ 299 ], [ 301 ], [ 305 ], [ 307 ], [ 309 ], [ 311 ], [ 315 ], [ 317 ], [ 319 ], [ 321 ], [ 323 ], [ 325 ], [ 327 ], [ 329 ], [ 331 ], [ 333 ], [ 335 ], [ 337 ], [ 339 ], [ 341 ], [ 343 ], [ 345 ], [ 347 ], [ 349 ], [ 351 ], [ 353 ], [ 355 ], [ 357, 359 ], [ 361 ], [ 363 ], [ 365 ], [ 367 ], [ 369 ], [ 371, 373 ], [ 375 ], [ 377 ], [ 379 ], [ 381 ], [ 383 ], [ 385 ], [ 387 ], [ 389 ], [ 393 ], [ 395 ], [ 397 ], [ 399 ], [ 401 ], [ 403 ], [ 405 ], [ 407 ], [ 411 ], [ 413 ], [ 417 ], [ 419 ], [ 423 ], [ 425 ], [ 427, 429 ], [ 431, 433 ], [ 437, 439 ], [ 441 ], [ 443 ], [ 445, 447, 449 ], [ 451 ], [ 455 ], [ 459 ], [ 461 ], [ 463 ], [ 465 ], [ 467 ], [ 469 ], [ 471 ], [ 475, 477 ], [ 479, 481 ], [ 485 ], [ 487 ], [ 489, 491, 493, 495, 497, 499 ], [ 501 ], [ 503 ], [ 505, 507 ], [ 509 ], [ 511 ], [ 513 ], [ 515 ], [ 517 ], [ 519 ], [ 521 ], [ 523, 525 ], [ 527 ], [ 529 ], [ 531 ], [ 533 ], [ 535 ], [ 537, 539 ], [ 541 ], [ 543 ], [ 545 ], [ 547 ], [ 549 ], [ 551 ], [ 553, 555 ], [ 557, 559 ], [ 561 ], [ 563 ], [ 565 ], [ 567 ], [ 569 ], [ 571 ], [ 573 ], [ 575 ], [ 577 ], [ 579 ], [ 581 ], [ 583 ], [ 585 ], [ 587, 589 ], [ 591 ], [ 593 ], [ 595 ], [ 597 ], [ 599 ], [ 601 ], [ 603 ], [ 605, 607 ], [ 609, 611 ], [ 613 ], [ 615 ], [ 617 ], [ 619 ], [ 621 ], [ 623 ], [ 625 ], [ 627 ], [ 629 ], [ 631 ], [ 633 ], [ 635 ], [ 637 ], [ 641 ], [ 647 ], [ 649 ], [ 651 ], [ 653 ], [ 655 ], [ 657 ], [ 659 ], [ 661 ], [ 663 ], [ 665 ], [ 673 ], [ 677 ], [ 679, 681 ], [ 683, 685 ], [ 687 ], [ 689 ], [ 693, 695 ], [ 697 ], [ 699 ], [ 703 ], [ 705 ], [ 707, 709 ], [ 711 ], [ 713 ], [ 715, 717 ], [ 719 ], [ 721 ], [ 723 ], [ 725 ], [ 727 ], [ 731, 733, 735, 737, 739, 741 ], [ 743, 745 ], [ 749 ], [ 751 ], [ 753 ], [ 755 ], [ 757 ], [ 759 ], [ 761 ], [ 763 ], [ 767 ], [ 769 ], [ 771 ], [ 773 ], [ 775 ], [ 777 ], [ 779 ], [ 783 ], [ 785, 787 ], [ 789 ], [ 791 ], [ 793, 795 ], [ 797, 799, 801 ], [ 803 ], [ 805 ], [ 807 ], [ 809 ], [ 811 ], [ 815 ], [ 817, 819 ], [ 821 ], [ 823 ], [ 825, 827 ], [ 829, 831, 833 ], [ 835 ], [ 837 ], [ 839 ], [ 841 ], [ 843 ], [ 845, 847 ], [ 849 ], [ 851, 853 ], [ 855 ], [ 857 ], [ 859 ], [ 861 ], [ 863 ], [ 865 ], [ 867 ], [ 869 ], [ 871 ], [ 873 ], [ 875 ], [ 877 ], [ 879 ], [ 881 ], [ 883 ], [ 885 ], [ 887 ], [ 889, 891 ], [ 893 ], [ 895, 897 ], [ 899 ], [ 901 ], [ 903 ], [ 905 ], [ 907 ], [ 909 ], [ 913 ], [ 915, 917 ], [ 919 ], [ 923 ], [ 925 ], [ 927 ], [ 929 ], [ 931, 933, 935 ], [ 937 ], [ 939 ], [ 941 ], [ 943 ], [ 947 ], [ 951, 953, 955 ], [ 957 ], [ 961 ], [ 963 ], [ 965 ], [ 967 ], [ 969 ], [ 971 ], [ 973, 975 ], [ 977 ], [ 979 ], [ 981, 983 ], [ 985, 987 ], [ 989, 991 ], [ 993 ], [ 995 ], [ 997 ], [ 999 ], [ 1001 ], [ 1003 ], [ 1007 ], [ 1009 ], [ 1011 ], [ 1013 ], [ 1015 ], [ 1017 ] ]
4,593
static int mov_write_sidx_tag(AVIOContext *pb, MOVTrack *track, int ref_size, int total_sidx_size) { int64_t pos = avio_tell(pb), offset_pos, end_pos; int64_t presentation_time, duration, offset; int starts_with_SAP, i, entries; if (track->entry) { entries = 1; presentation_time = track->start_dts + track->frag_start + track->cluster[0].cts; duration = track->end_pts - (track->cluster[0].dts + track->cluster[0].cts); starts_with_SAP = track->cluster[0].flags & MOV_SYNC_SAMPLE; // pts<0 should be cut away using edts if (presentation_time < 0) { duration += presentation_time; presentation_time = 0; } } else { entries = track->nb_frag_info; presentation_time = track->frag_info[0].time; } avio_wb32(pb, 0); /* size */ ffio_wfourcc(pb, "sidx"); avio_w8(pb, 1); /* version */ avio_wb24(pb, 0); avio_wb32(pb, track->track_id); /* reference_ID */ avio_wb32(pb, track->timescale); /* timescale */ avio_wb64(pb, presentation_time); /* earliest_presentation_time */ offset_pos = avio_tell(pb); avio_wb64(pb, 0); /* first_offset (offset to referenced moof) */ avio_wb16(pb, 0); /* reserved */ avio_wb16(pb, entries); /* reference_count */ for (i = 0; i < entries; i++) { if (!track->entry) { if (i > 1 && track->frag_info[i].offset != track->frag_info[i - 1].offset + track->frag_info[i - 1].size) { av_log(NULL, AV_LOG_ERROR, "Non-consecutive fragments, writing incorrect sidx\n"); } duration = track->frag_info[i].duration; ref_size = track->frag_info[i].size; starts_with_SAP = 1; } avio_wb32(pb, (0 << 31) | (ref_size & 0x7fffffff)); /* reference_type (0 = media) | referenced_size */ avio_wb32(pb, duration); /* subsegment_duration */ avio_wb32(pb, (starts_with_SAP << 31) | (0 << 28) | 0); /* starts_with_SAP | SAP_type | SAP_delta_time */ } end_pos = avio_tell(pb); offset = pos + total_sidx_size - end_pos; avio_seek(pb, offset_pos, SEEK_SET); avio_wb64(pb, offset); avio_seek(pb, end_pos, SEEK_SET); return update_size(pb, pos); }
true
FFmpeg
8e34089e265a6b01e1e3301e8864439d26793753
static int mov_write_sidx_tag(AVIOContext *pb, MOVTrack *track, int ref_size, int total_sidx_size) { int64_t pos = avio_tell(pb), offset_pos, end_pos; int64_t presentation_time, duration, offset; int starts_with_SAP, i, entries; if (track->entry) { entries = 1; presentation_time = track->start_dts + track->frag_start + track->cluster[0].cts; duration = track->end_pts - (track->cluster[0].dts + track->cluster[0].cts); starts_with_SAP = track->cluster[0].flags & MOV_SYNC_SAMPLE; if (presentation_time < 0) { duration += presentation_time; presentation_time = 0; } } else { entries = track->nb_frag_info; presentation_time = track->frag_info[0].time; } avio_wb32(pb, 0); ffio_wfourcc(pb, "sidx"); avio_w8(pb, 1); avio_wb24(pb, 0); avio_wb32(pb, track->track_id); avio_wb32(pb, track->timescale); avio_wb64(pb, presentation_time); offset_pos = avio_tell(pb); avio_wb64(pb, 0); avio_wb16(pb, 0); avio_wb16(pb, entries); for (i = 0; i < entries; i++) { if (!track->entry) { if (i > 1 && track->frag_info[i].offset != track->frag_info[i - 1].offset + track->frag_info[i - 1].size) { av_log(NULL, AV_LOG_ERROR, "Non-consecutive fragments, writing incorrect sidx\n"); } duration = track->frag_info[i].duration; ref_size = track->frag_info[i].size; starts_with_SAP = 1; } avio_wb32(pb, (0 << 31) | (ref_size & 0x7fffffff)); avio_wb32(pb, duration); avio_wb32(pb, (starts_with_SAP << 31) | (0 << 28) | 0); } end_pos = avio_tell(pb); offset = pos + total_sidx_size - end_pos; avio_seek(pb, offset_pos, SEEK_SET); avio_wb64(pb, offset); avio_seek(pb, end_pos, SEEK_SET); return update_size(pb, pos); }
{ "code": [], "line_no": [] }
static int FUNC_0(AVIOContext *VAR_0, MOVTrack *VAR_1, int VAR_2, int VAR_3) { int64_t pos = avio_tell(VAR_0), offset_pos, end_pos; int64_t presentation_time, duration, offset; int VAR_4, VAR_5, VAR_6; if (VAR_1->entry) { VAR_6 = 1; presentation_time = VAR_1->start_dts + VAR_1->frag_start + VAR_1->cluster[0].cts; duration = VAR_1->end_pts - (VAR_1->cluster[0].dts + VAR_1->cluster[0].cts); VAR_4 = VAR_1->cluster[0].flags & MOV_SYNC_SAMPLE; if (presentation_time < 0) { duration += presentation_time; presentation_time = 0; } } else { VAR_6 = VAR_1->nb_frag_info; presentation_time = VAR_1->frag_info[0].time; } avio_wb32(VAR_0, 0); ffio_wfourcc(VAR_0, "sidx"); avio_w8(VAR_0, 1); avio_wb24(VAR_0, 0); avio_wb32(VAR_0, VAR_1->track_id); avio_wb32(VAR_0, VAR_1->timescale); avio_wb64(VAR_0, presentation_time); offset_pos = avio_tell(VAR_0); avio_wb64(VAR_0, 0); avio_wb16(VAR_0, 0); avio_wb16(VAR_0, VAR_6); for (VAR_5 = 0; VAR_5 < VAR_6; VAR_5++) { if (!VAR_1->entry) { if (VAR_5 > 1 && VAR_1->frag_info[VAR_5].offset != VAR_1->frag_info[VAR_5 - 1].offset + VAR_1->frag_info[VAR_5 - 1].size) { av_log(NULL, AV_LOG_ERROR, "Non-consecutive fragments, writing incorrect sidx\n"); } duration = VAR_1->frag_info[VAR_5].duration; VAR_2 = VAR_1->frag_info[VAR_5].size; VAR_4 = 1; } avio_wb32(VAR_0, (0 << 31) | (VAR_2 & 0x7fffffff)); avio_wb32(VAR_0, duration); avio_wb32(VAR_0, (VAR_4 << 31) | (0 << 28) | 0); } end_pos = avio_tell(VAR_0); offset = pos + VAR_3 - end_pos; avio_seek(VAR_0, offset_pos, SEEK_SET); avio_wb64(VAR_0, offset); avio_seek(VAR_0, end_pos, SEEK_SET); return update_size(VAR_0, pos); }
[ "static int FUNC_0(AVIOContext *VAR_0,\nMOVTrack *VAR_1, int VAR_2, int VAR_3)\n{", "int64_t pos = avio_tell(VAR_0), offset_pos, end_pos;", "int64_t presentation_time, duration, offset;", "int VAR_4, VAR_5, VAR_6;", "if (VAR_1->entry) {", "VAR_6 = 1;", "presentation_time = VAR_1->start_dts + VAR_1->frag_start +\nVAR_1->cluster[0].cts;", "duration = VAR_1->end_pts -\n(VAR_1->cluster[0].dts + VAR_1->cluster[0].cts);", "VAR_4 = VAR_1->cluster[0].flags & MOV_SYNC_SAMPLE;", "if (presentation_time < 0) {", "duration += presentation_time;", "presentation_time = 0;", "}", "} else {", "VAR_6 = VAR_1->nb_frag_info;", "presentation_time = VAR_1->frag_info[0].time;", "}", "avio_wb32(VAR_0, 0);", "ffio_wfourcc(VAR_0, \"sidx\");", "avio_w8(VAR_0, 1);", "avio_wb24(VAR_0, 0);", "avio_wb32(VAR_0, VAR_1->track_id);", "avio_wb32(VAR_0, VAR_1->timescale);", "avio_wb64(VAR_0, presentation_time);", "offset_pos = avio_tell(VAR_0);", "avio_wb64(VAR_0, 0);", "avio_wb16(VAR_0, 0);", "avio_wb16(VAR_0, VAR_6);", "for (VAR_5 = 0; VAR_5 < VAR_6; VAR_5++) {", "if (!VAR_1->entry) {", "if (VAR_5 > 1 && VAR_1->frag_info[VAR_5].offset != VAR_1->frag_info[VAR_5 - 1].offset + VAR_1->frag_info[VAR_5 - 1].size) {", "av_log(NULL, AV_LOG_ERROR, \"Non-consecutive fragments, writing incorrect sidx\\n\");", "}", "duration = VAR_1->frag_info[VAR_5].duration;", "VAR_2 = VAR_1->frag_info[VAR_5].size;", "VAR_4 = 1;", "}", "avio_wb32(VAR_0, (0 << 31) | (VAR_2 & 0x7fffffff));", "avio_wb32(VAR_0, duration);", "avio_wb32(VAR_0, (VAR_4 << 31) | (0 << 28) | 0);", "}", "end_pos = avio_tell(VAR_0);", "offset = pos + VAR_3 - end_pos;", "avio_seek(VAR_0, offset_pos, SEEK_SET);", "avio_wb64(VAR_0, offset);", "avio_seek(VAR_0, end_pos, SEEK_SET);", "return update_size(VAR_0, pos);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ] ]
4,595
static uint64_t vfio_rtl8168_window_quirk_read(void *opaque, hwaddr addr, unsigned size) { VFIOQuirk *quirk = opaque; VFIOPCIDevice *vdev = quirk->vdev; switch (addr) { case 4: /* address */ if (quirk->data.flags) { trace_vfio_rtl8168_window_quirk_read_fake( memory_region_name(&quirk->mem), vdev->vbasedev.name); return quirk->data.address_match ^ 0x80000000U; } break; case 0: /* data */ if (quirk->data.flags) { uint64_t val; trace_vfio_rtl8168_window_quirk_read_table( memory_region_name(&quirk->mem), vdev->vbasedev.name); if (!(vdev->pdev.cap_present & QEMU_PCI_CAP_MSIX)) { return 0; } memory_region_dispatch_read(&vdev->pdev.msix_table_mmio, (hwaddr)(quirk->data.address_match & 0xfff), &val, size, MEMTXATTRS_UNSPECIFIED); return val; } } trace_vfio_rtl8168_window_quirk_read_direct(memory_region_name(&quirk->mem), vdev->vbasedev.name); return vfio_region_read(&vdev->bars[quirk->data.bar].region, addr + 0x70, size); }
true
qemu
d451008e0fdf7fb817c791397e7999d5f3687e58
static uint64_t vfio_rtl8168_window_quirk_read(void *opaque, hwaddr addr, unsigned size) { VFIOQuirk *quirk = opaque; VFIOPCIDevice *vdev = quirk->vdev; switch (addr) { case 4: if (quirk->data.flags) { trace_vfio_rtl8168_window_quirk_read_fake( memory_region_name(&quirk->mem), vdev->vbasedev.name); return quirk->data.address_match ^ 0x80000000U; } break; case 0: if (quirk->data.flags) { uint64_t val; trace_vfio_rtl8168_window_quirk_read_table( memory_region_name(&quirk->mem), vdev->vbasedev.name); if (!(vdev->pdev.cap_present & QEMU_PCI_CAP_MSIX)) { return 0; } memory_region_dispatch_read(&vdev->pdev.msix_table_mmio, (hwaddr)(quirk->data.address_match & 0xfff), &val, size, MEMTXATTRS_UNSPECIFIED); return val; } } trace_vfio_rtl8168_window_quirk_read_direct(memory_region_name(&quirk->mem), vdev->vbasedev.name); return vfio_region_read(&vdev->bars[quirk->data.bar].region, addr + 0x70, size); }
{ "code": [ " if (quirk->data.flags) {", " trace_vfio_rtl8168_window_quirk_read_fake(", " memory_region_name(&quirk->mem),", " vdev->vbasedev.name);", " return quirk->data.address_match ^ 0x80000000U;", " if (quirk->data.flags) {", " uint64_t val;", " trace_vfio_rtl8168_window_quirk_read_table(", " memory_region_name(&quirk->mem),", " vdev->vbasedev.name);", " if (!(vdev->pdev.cap_present & QEMU_PCI_CAP_MSIX)) {", " return 0;", " (hwaddr)(quirk->data.address_match", " & 0xfff),", " &val,", " size,", " MEMTXATTRS_UNSPECIFIED);", " return val;", " trace_vfio_rtl8168_window_quirk_read_direct(memory_region_name(&quirk->mem),", " vdev->vbasedev.name);", " return vfio_region_read(&vdev->bars[quirk->data.bar].region,", " addr + 0x70, size);" ], "line_no": [ 17, 19, 21, 23, 27, 17, 37, 41, 21, 23, 49, 51, 59, 61, 63, 65, 67, 69, 77, 79, 83, 85 ] }
static uint64_t FUNC_0(void *opaque, hwaddr addr, unsigned size) { VFIOQuirk *quirk = opaque; VFIOPCIDevice *vdev = quirk->vdev; switch (addr) { case 4: if (quirk->data.flags) { trace_vfio_rtl8168_window_quirk_read_fake( memory_region_name(&quirk->mem), vdev->vbasedev.name); return quirk->data.address_match ^ 0x80000000U; } break; case 0: if (quirk->data.flags) { uint64_t val; trace_vfio_rtl8168_window_quirk_read_table( memory_region_name(&quirk->mem), vdev->vbasedev.name); if (!(vdev->pdev.cap_present & QEMU_PCI_CAP_MSIX)) { return 0; } memory_region_dispatch_read(&vdev->pdev.msix_table_mmio, (hwaddr)(quirk->data.address_match & 0xfff), &val, size, MEMTXATTRS_UNSPECIFIED); return val; } } trace_vfio_rtl8168_window_quirk_read_direct(memory_region_name(&quirk->mem), vdev->vbasedev.name); return vfio_region_read(&vdev->bars[quirk->data.bar].region, addr + 0x70, size); }
[ "static uint64_t FUNC_0(void *opaque,\nhwaddr addr, unsigned size)\n{", "VFIOQuirk *quirk = opaque;", "VFIOPCIDevice *vdev = quirk->vdev;", "switch (addr) {", "case 4:\nif (quirk->data.flags) {", "trace_vfio_rtl8168_window_quirk_read_fake(\nmemory_region_name(&quirk->mem),\nvdev->vbasedev.name);", "return quirk->data.address_match ^ 0x80000000U;", "}", "break;", "case 0:\nif (quirk->data.flags) {", "uint64_t val;", "trace_vfio_rtl8168_window_quirk_read_table(\nmemory_region_name(&quirk->mem),\nvdev->vbasedev.name);", "if (!(vdev->pdev.cap_present & QEMU_PCI_CAP_MSIX)) {", "return 0;", "}", "memory_region_dispatch_read(&vdev->pdev.msix_table_mmio,\n(hwaddr)(quirk->data.address_match\n& 0xfff),\n&val,\nsize,\nMEMTXATTRS_UNSPECIFIED);", "return val;", "}", "}", "trace_vfio_rtl8168_window_quirk_read_direct(memory_region_name(&quirk->mem),\nvdev->vbasedev.name);", "return vfio_region_read(&vdev->bars[quirk->data.bar].region,\naddr + 0x70, size);", "}" ]
[ 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15, 17 ], [ 19, 21, 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 41, 43, 45 ], [ 49 ], [ 51 ], [ 53 ], [ 57, 59, 61, 63, 65, 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77, 79 ], [ 83, 85 ], [ 87 ] ]
4,596
static int teletext_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *pkt) { TeletextContext *ctx = avctx->priv_data; AVSubtitle *sub = data; const uint8_t *buf = pkt->data; int left = pkt->size; uint8_t pesheader[45] = {0x00, 0x00, 0x01, 0xbd, 0x00, 0x00, 0x85, 0x80, 0x24, 0x21, 0x00, 0x01, 0x00, 0x01}; int pesheader_size = sizeof(pesheader); const uint8_t *pesheader_buf = pesheader; int ret = 0; if (!ctx->vbi) { if (!(ctx->vbi = vbi_decoder_new())) return AVERROR(ENOMEM); if (!vbi_event_handler_add(ctx->vbi, VBI_EVENT_TTX_PAGE, handler, ctx)) { vbi_decoder_delete(ctx->vbi); ctx->vbi = NULL; return AVERROR(ENOMEM); } } if (!ctx->dx && (!(ctx->dx = vbi_dvb_pes_demux_new (/* callback */ NULL, NULL)))) return AVERROR(ENOMEM); if (avctx->pkt_timebase.den && pkt->pts != AV_NOPTS_VALUE) ctx->pts = av_rescale_q(pkt->pts, avctx->pkt_timebase, AV_TIME_BASE_Q); if (left) { // We allow unreasonably big packets, even if the standard only allows a max size of 1472 if ((pesheader_size + left) < 184 || (pesheader_size + left) > 65504 || (pesheader_size + left) % 184 != 0) return AVERROR_INVALIDDATA; memset(pesheader + 14, 0xff, pesheader_size - 14); AV_WB16(pesheader + 4, left + pesheader_size - 6); /* PTS is deliberately left as 0 in the PES header, otherwise libzvbi uses * it to detect dropped frames. Unforunatey the guessed packet PTS values * (see mpegts demuxer) are not accurate enough to pass that test. */ vbi_dvb_demux_cor(ctx->dx, ctx->sliced, 64, NULL, &pesheader_buf, &pesheader_size); ctx->handler_ret = pkt->size; while (left > 0) { int64_t pts = 0; unsigned int lines = vbi_dvb_demux_cor(ctx->dx, ctx->sliced, 64, &pts, &buf, &left); av_dlog(avctx, "ctx=%p buf_size=%d left=%u lines=%u pts=%f pkt_pts=%f\n", ctx, pkt->size, left, lines, (double)pts/90000.0, (double)pkt->pts/90000.0); if (lines > 0) { #ifdef DEBUGx int i; for(i=0; i<lines; ++i) av_log(avctx, AV_LOG_DEBUG, "lines=%d id=%x\n", i, ctx->sliced[i].id); #endif vbi_decode(ctx->vbi, ctx->sliced, lines, (double)pts/90000.0); ctx->lines_processed += lines; } } ctx->pts = AV_NOPTS_VALUE; ret = ctx->handler_ret; } if (ret < 0) return ret; // is there a subtitle to pass? if (ctx->nb_pages) { int i; sub->format = ctx->format_id; sub->start_display_time = 0; sub->end_display_time = ctx->sub_duration; sub->num_rects = 0; sub->pts = ctx->pages->pts; if (ctx->pages->sub_rect->type != SUBTITLE_NONE) { sub->rects = av_malloc(sizeof(*sub->rects) * 1); if (sub->rects) { sub->num_rects = 1; sub->rects[0] = ctx->pages->sub_rect; } else { ret = AVERROR(ENOMEM); } } else { av_log(avctx, AV_LOG_DEBUG, "sending empty sub\n"); sub->rects = NULL; } if (!sub->rects) // no rect was passed subtitle_rect_free(&ctx->pages->sub_rect); for (i = 0; i < ctx->nb_pages - 1; i++) ctx->pages[i] = ctx->pages[i + 1]; ctx->nb_pages--; if (ret >= 0) *data_size = 1; } else *data_size = 0; return ret; }
true
FFmpeg
085ca7dcdbf9ab6c23e3a5397b1f6d4aa23f763d
static int teletext_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *pkt) { TeletextContext *ctx = avctx->priv_data; AVSubtitle *sub = data; const uint8_t *buf = pkt->data; int left = pkt->size; uint8_t pesheader[45] = {0x00, 0x00, 0x01, 0xbd, 0x00, 0x00, 0x85, 0x80, 0x24, 0x21, 0x00, 0x01, 0x00, 0x01}; int pesheader_size = sizeof(pesheader); const uint8_t *pesheader_buf = pesheader; int ret = 0; if (!ctx->vbi) { if (!(ctx->vbi = vbi_decoder_new())) return AVERROR(ENOMEM); if (!vbi_event_handler_add(ctx->vbi, VBI_EVENT_TTX_PAGE, handler, ctx)) { vbi_decoder_delete(ctx->vbi); ctx->vbi = NULL; return AVERROR(ENOMEM); } } if (!ctx->dx && (!(ctx->dx = vbi_dvb_pes_demux_new ( NULL, NULL)))) return AVERROR(ENOMEM); if (avctx->pkt_timebase.den && pkt->pts != AV_NOPTS_VALUE) ctx->pts = av_rescale_q(pkt->pts, avctx->pkt_timebase, AV_TIME_BASE_Q); if (left) { if ((pesheader_size + left) < 184 || (pesheader_size + left) > 65504 || (pesheader_size + left) % 184 != 0) return AVERROR_INVALIDDATA; memset(pesheader + 14, 0xff, pesheader_size - 14); AV_WB16(pesheader + 4, left + pesheader_size - 6); vbi_dvb_demux_cor(ctx->dx, ctx->sliced, 64, NULL, &pesheader_buf, &pesheader_size); ctx->handler_ret = pkt->size; while (left > 0) { int64_t pts = 0; unsigned int lines = vbi_dvb_demux_cor(ctx->dx, ctx->sliced, 64, &pts, &buf, &left); av_dlog(avctx, "ctx=%p buf_size=%d left=%u lines=%u pts=%f pkt_pts=%f\n", ctx, pkt->size, left, lines, (double)pts/90000.0, (double)pkt->pts/90000.0); if (lines > 0) { #ifdef DEBUGx int i; for(i=0; i<lines; ++i) av_log(avctx, AV_LOG_DEBUG, "lines=%d id=%x\n", i, ctx->sliced[i].id); #endif vbi_decode(ctx->vbi, ctx->sliced, lines, (double)pts/90000.0); ctx->lines_processed += lines; } } ctx->pts = AV_NOPTS_VALUE; ret = ctx->handler_ret; } if (ret < 0) return ret; if (ctx->nb_pages) { int i; sub->format = ctx->format_id; sub->start_display_time = 0; sub->end_display_time = ctx->sub_duration; sub->num_rects = 0; sub->pts = ctx->pages->pts; if (ctx->pages->sub_rect->type != SUBTITLE_NONE) { sub->rects = av_malloc(sizeof(*sub->rects) * 1); if (sub->rects) { sub->num_rects = 1; sub->rects[0] = ctx->pages->sub_rect; } else { ret = AVERROR(ENOMEM); } } else { av_log(avctx, AV_LOG_DEBUG, "sending empty sub\n"); sub->rects = NULL; } if (!sub->rects) subtitle_rect_free(&ctx->pages->sub_rect); for (i = 0; i < ctx->nb_pages - 1; i++) ctx->pages[i] = ctx->pages[i + 1]; ctx->nb_pages--; if (ret >= 0) *data_size = 1; } else *data_size = 0; return ret; }
{ "code": [ " const uint8_t *buf = pkt->data;", " int left = pkt->size;", " uint8_t pesheader[45] = {0x00, 0x00, 0x01, 0xbd, 0x00, 0x00, 0x85, 0x80, 0x24, 0x21, 0x00, 0x01, 0x00, 0x01};", " int pesheader_size = sizeof(pesheader);", " const uint8_t *pesheader_buf = pesheader;", " return AVERROR(ENOMEM);", " if (left) {", " if ((pesheader_size + left) < 184 || (pesheader_size + left) > 65504 || (pesheader_size + left) % 184 != 0)", " memset(pesheader + 14, 0xff, pesheader_size - 14);", " AV_WB16(pesheader + 4, left + pesheader_size - 6);", " vbi_dvb_demux_cor(ctx->dx, ctx->sliced, 64, NULL, &pesheader_buf, &pesheader_size);", " while (left > 0) {", " int64_t pts = 0;", " unsigned int lines = vbi_dvb_demux_cor(ctx->dx, ctx->sliced, 64, &pts, &buf, &left);", " av_dlog(avctx, \"ctx=%p buf_size=%d left=%u lines=%u pts=%f pkt_pts=%f\\n\",", " ctx, pkt->size, left, lines, (double)pts/90000.0, (double)pkt->pts/90000.0);", "#ifdef DEBUGx", " for(i=0; i<lines; ++i)", " av_log(avctx, AV_LOG_DEBUG,", " \"lines=%d id=%x\\n\", i, ctx->sliced[i].id);", " vbi_decode(ctx->vbi, ctx->sliced, lines, (double)pts/90000.0);" ], "line_no": [ 9, 11, 13, 15, 17, 43, 53, 57, 63, 65, 75, 83, 85, 87, 89, 91, 95, 99, 101, 103, 107 ] }
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3) { TeletextContext *ctx = VAR_0->priv_data; AVSubtitle *sub = VAR_1; const uint8_t *VAR_4 = VAR_3->VAR_1; int VAR_5 = VAR_3->size; uint8_t pesheader[45] = {0x00, 0x00, 0x01, 0xbd, 0x00, 0x00, 0x85, 0x80, 0x24, 0x21, 0x00, 0x01, 0x00, 0x01}; int VAR_6 = sizeof(pesheader); const uint8_t *VAR_7 = pesheader; int VAR_8 = 0; if (!ctx->vbi) { if (!(ctx->vbi = vbi_decoder_new())) return AVERROR(ENOMEM); if (!vbi_event_handler_add(ctx->vbi, VBI_EVENT_TTX_PAGE, handler, ctx)) { vbi_decoder_delete(ctx->vbi); ctx->vbi = NULL; return AVERROR(ENOMEM); } } if (!ctx->dx && (!(ctx->dx = vbi_dvb_pes_demux_new ( NULL, NULL)))) return AVERROR(ENOMEM); if (VAR_0->pkt_timebase.den && VAR_3->pts != AV_NOPTS_VALUE) ctx->pts = av_rescale_q(VAR_3->pts, VAR_0->pkt_timebase, AV_TIME_BASE_Q); if (VAR_5) { if ((VAR_6 + VAR_5) < 184 || (VAR_6 + VAR_5) > 65504 || (VAR_6 + VAR_5) % 184 != 0) return AVERROR_INVALIDDATA; memset(pesheader + 14, 0xff, VAR_6 - 14); AV_WB16(pesheader + 4, VAR_5 + VAR_6 - 6); vbi_dvb_demux_cor(ctx->dx, ctx->sliced, 64, NULL, &VAR_7, &VAR_6); ctx->handler_ret = VAR_3->size; while (VAR_5 > 0) { int64_t pts = 0; unsigned int VAR_9 = vbi_dvb_demux_cor(ctx->dx, ctx->sliced, 64, &pts, &VAR_4, &VAR_5); av_dlog(VAR_0, "ctx=%p buf_size=%d VAR_5=%u VAR_9=%u pts=%f pkt_pts=%f\n", ctx, VAR_3->size, VAR_5, VAR_9, (double)pts/90000.0, (double)VAR_3->pts/90000.0); if (VAR_9 > 0) { #ifdef DEBUGx int VAR_10; for(VAR_10=0; VAR_10<VAR_9; ++VAR_10) av_log(VAR_0, AV_LOG_DEBUG, "VAR_9=%d id=%x\n", VAR_10, ctx->sliced[VAR_10].id); #endif vbi_decode(ctx->vbi, ctx->sliced, VAR_9, (double)pts/90000.0); ctx->lines_processed += VAR_9; } } ctx->pts = AV_NOPTS_VALUE; VAR_8 = ctx->handler_ret; } if (VAR_8 < 0) return VAR_8; if (ctx->nb_pages) { int VAR_10; sub->format = ctx->format_id; sub->start_display_time = 0; sub->end_display_time = ctx->sub_duration; sub->num_rects = 0; sub->pts = ctx->pages->pts; if (ctx->pages->sub_rect->type != SUBTITLE_NONE) { sub->rects = av_malloc(sizeof(*sub->rects) * 1); if (sub->rects) { sub->num_rects = 1; sub->rects[0] = ctx->pages->sub_rect; } else { VAR_8 = AVERROR(ENOMEM); } } else { av_log(VAR_0, AV_LOG_DEBUG, "sending empty sub\n"); sub->rects = NULL; } if (!sub->rects) subtitle_rect_free(&ctx->pages->sub_rect); for (VAR_10 = 0; VAR_10 < ctx->nb_pages - 1; VAR_10++) ctx->pages[VAR_10] = ctx->pages[VAR_10 + 1]; ctx->nb_pages--; if (VAR_8 >= 0) *VAR_2 = 1; } else *VAR_2 = 0; return VAR_8; }
[ "static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3)\n{", "TeletextContext *ctx = VAR_0->priv_data;", "AVSubtitle *sub = VAR_1;", "const uint8_t *VAR_4 = VAR_3->VAR_1;", "int VAR_5 = VAR_3->size;", "uint8_t pesheader[45] = {0x00, 0x00, 0x01, 0xbd, 0x00, 0x00, 0x85, 0x80, 0x24, 0x21, 0x00, 0x01, 0x00, 0x01};", "int VAR_6 = sizeof(pesheader);", "const uint8_t *VAR_7 = pesheader;", "int VAR_8 = 0;", "if (!ctx->vbi) {", "if (!(ctx->vbi = vbi_decoder_new()))\nreturn AVERROR(ENOMEM);", "if (!vbi_event_handler_add(ctx->vbi, VBI_EVENT_TTX_PAGE, handler, ctx)) {", "vbi_decoder_delete(ctx->vbi);", "ctx->vbi = NULL;", "return AVERROR(ENOMEM);", "}", "}", "if (!ctx->dx && (!(ctx->dx = vbi_dvb_pes_demux_new ( NULL, NULL))))\nreturn AVERROR(ENOMEM);", "if (VAR_0->pkt_timebase.den && VAR_3->pts != AV_NOPTS_VALUE)\nctx->pts = av_rescale_q(VAR_3->pts, VAR_0->pkt_timebase, AV_TIME_BASE_Q);", "if (VAR_5) {", "if ((VAR_6 + VAR_5) < 184 || (VAR_6 + VAR_5) > 65504 || (VAR_6 + VAR_5) % 184 != 0)\nreturn AVERROR_INVALIDDATA;", "memset(pesheader + 14, 0xff, VAR_6 - 14);", "AV_WB16(pesheader + 4, VAR_5 + VAR_6 - 6);", "vbi_dvb_demux_cor(ctx->dx, ctx->sliced, 64, NULL, &VAR_7, &VAR_6);", "ctx->handler_ret = VAR_3->size;", "while (VAR_5 > 0) {", "int64_t pts = 0;", "unsigned int VAR_9 = vbi_dvb_demux_cor(ctx->dx, ctx->sliced, 64, &pts, &VAR_4, &VAR_5);", "av_dlog(VAR_0, \"ctx=%p buf_size=%d VAR_5=%u VAR_9=%u pts=%f pkt_pts=%f\\n\",\nctx, VAR_3->size, VAR_5, VAR_9, (double)pts/90000.0, (double)VAR_3->pts/90000.0);", "if (VAR_9 > 0) {", "#ifdef DEBUGx\nint VAR_10;", "for(VAR_10=0; VAR_10<VAR_9; ++VAR_10)", "av_log(VAR_0, AV_LOG_DEBUG,\n\"VAR_9=%d id=%x\\n\", VAR_10, ctx->sliced[VAR_10].id);", "#endif\nvbi_decode(ctx->vbi, ctx->sliced, VAR_9, (double)pts/90000.0);", "ctx->lines_processed += VAR_9;", "}", "}", "ctx->pts = AV_NOPTS_VALUE;", "VAR_8 = ctx->handler_ret;", "}", "if (VAR_8 < 0)\nreturn VAR_8;", "if (ctx->nb_pages) {", "int VAR_10;", "sub->format = ctx->format_id;", "sub->start_display_time = 0;", "sub->end_display_time = ctx->sub_duration;", "sub->num_rects = 0;", "sub->pts = ctx->pages->pts;", "if (ctx->pages->sub_rect->type != SUBTITLE_NONE) {", "sub->rects = av_malloc(sizeof(*sub->rects) * 1);", "if (sub->rects) {", "sub->num_rects = 1;", "sub->rects[0] = ctx->pages->sub_rect;", "} else {", "VAR_8 = AVERROR(ENOMEM);", "}", "} else {", "av_log(VAR_0, AV_LOG_DEBUG, \"sending empty sub\\n\");", "sub->rects = NULL;", "}", "if (!sub->rects)\nsubtitle_rect_free(&ctx->pages->sub_rect);", "for (VAR_10 = 0; VAR_10 < ctx->nb_pages - 1; VAR_10++)", "ctx->pages[VAR_10] = ctx->pages[VAR_10 + 1];", "ctx->nb_pages--;", "if (VAR_8 >= 0)\n*VAR_2 = 1;", "} else", "*VAR_2 = 0;", "return VAR_8;", "}" ]
[ 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 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, 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 ], [ 47, 49 ], [ 53 ], [ 57, 59 ], [ 63 ], [ 65 ], [ 75 ], [ 79 ], [ 83 ], [ 85 ], [ 87 ], [ 89, 91 ], [ 93 ], [ 95, 97 ], [ 99 ], [ 101, 103 ], [ 105, 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 123, 125 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171, 173 ], [ 177 ], [ 179 ], [ 181 ], [ 185, 187 ], [ 189 ], [ 191 ], [ 195 ], [ 197 ] ]
4,597
static int enable_write_target(BlockDriverState *bs, Error **errp) { BDRVVVFATState *s = bs->opaque; BlockDriver *bdrv_qcow = NULL; BlockDriverState *backing; QemuOpts *opts = NULL; int ret; int size = sector2cluster(s, s->sector_count); QDict *options; s->used_clusters = calloc(size, 1); array_init(&(s->commits), sizeof(commit_t)); s->qcow_filename = g_malloc(PATH_MAX); ret = get_tmp_filename(s->qcow_filename, PATH_MAX); if (ret < 0) { error_setg_errno(errp, -ret, "can't create temporary file"); goto err; } bdrv_qcow = bdrv_find_format("qcow"); if (!bdrv_qcow) { error_setg(errp, "Failed to locate qcow driver"); ret = -ENOENT; goto err; } opts = qemu_opts_create(bdrv_qcow->create_opts, NULL, 0, &error_abort); qemu_opt_set_number(opts, BLOCK_OPT_SIZE, s->sector_count * 512, &error_abort); qemu_opt_set(opts, BLOCK_OPT_BACKING_FILE, "fat:", &error_abort); ret = bdrv_create(bdrv_qcow, s->qcow_filename, opts, errp); qemu_opts_del(opts); if (ret < 0) { goto err; } options = qdict_new(); qdict_put(options, "write-target.driver", qstring_from_str("qcow")); s->qcow = bdrv_open_child(s->qcow_filename, options, "write-target", bs, &child_vvfat_qcow, false, errp); QDECREF(options); if (!s->qcow) { ret = -EINVAL; goto err; } #ifndef _WIN32 unlink(s->qcow_filename); #endif backing = bdrv_new(); bdrv_set_backing_hd(s->bs, backing); bdrv_unref(backing); s->bs->backing->bs->drv = &vvfat_write_target; s->bs->backing->bs->opaque = g_new(void *, 1); *(void**)s->bs->backing->bs->opaque = s; return 0; err: g_free(s->qcow_filename); s->qcow_filename = NULL; return ret; }
true
qemu
a8a4d15c1c34d3cec704fb64eba4a3745a140a97
static int enable_write_target(BlockDriverState *bs, Error **errp) { BDRVVVFATState *s = bs->opaque; BlockDriver *bdrv_qcow = NULL; BlockDriverState *backing; QemuOpts *opts = NULL; int ret; int size = sector2cluster(s, s->sector_count); QDict *options; s->used_clusters = calloc(size, 1); array_init(&(s->commits), sizeof(commit_t)); s->qcow_filename = g_malloc(PATH_MAX); ret = get_tmp_filename(s->qcow_filename, PATH_MAX); if (ret < 0) { error_setg_errno(errp, -ret, "can't create temporary file"); goto err; } bdrv_qcow = bdrv_find_format("qcow"); if (!bdrv_qcow) { error_setg(errp, "Failed to locate qcow driver"); ret = -ENOENT; goto err; } opts = qemu_opts_create(bdrv_qcow->create_opts, NULL, 0, &error_abort); qemu_opt_set_number(opts, BLOCK_OPT_SIZE, s->sector_count * 512, &error_abort); qemu_opt_set(opts, BLOCK_OPT_BACKING_FILE, "fat:", &error_abort); ret = bdrv_create(bdrv_qcow, s->qcow_filename, opts, errp); qemu_opts_del(opts); if (ret < 0) { goto err; } options = qdict_new(); qdict_put(options, "write-target.driver", qstring_from_str("qcow")); s->qcow = bdrv_open_child(s->qcow_filename, options, "write-target", bs, &child_vvfat_qcow, false, errp); QDECREF(options); if (!s->qcow) { ret = -EINVAL; goto err; } #ifndef _WIN32 unlink(s->qcow_filename); #endif backing = bdrv_new(); bdrv_set_backing_hd(s->bs, backing); bdrv_unref(backing); s->bs->backing->bs->drv = &vvfat_write_target; s->bs->backing->bs->opaque = g_new(void *, 1); *(void**)s->bs->backing->bs->opaque = s; return 0; err: g_free(s->qcow_filename); s->qcow_filename = NULL; return ret; }
{ "code": [ " backing = bdrv_new();", " s->bs->backing->bs->drv = &vvfat_write_target;", " s->bs->backing->bs->opaque = g_new(void *, 1);", " *(void**)s->bs->backing->bs->opaque = s;" ], "line_no": [ 107, 115, 117, 119 ] }
static int FUNC_0(BlockDriverState *VAR_0, Error **VAR_1) { BDRVVVFATState *s = VAR_0->opaque; BlockDriver *bdrv_qcow = NULL; BlockDriverState *backing; QemuOpts *opts = NULL; int VAR_2; int VAR_3 = sector2cluster(s, s->sector_count); QDict *options; s->used_clusters = calloc(VAR_3, 1); array_init(&(s->commits), sizeof(commit_t)); s->qcow_filename = g_malloc(PATH_MAX); VAR_2 = get_tmp_filename(s->qcow_filename, PATH_MAX); if (VAR_2 < 0) { error_setg_errno(VAR_1, -VAR_2, "can't create temporary file"); goto err; } bdrv_qcow = bdrv_find_format("qcow"); if (!bdrv_qcow) { error_setg(VAR_1, "Failed to locate qcow driver"); VAR_2 = -ENOENT; goto err; } opts = qemu_opts_create(bdrv_qcow->create_opts, NULL, 0, &error_abort); qemu_opt_set_number(opts, BLOCK_OPT_SIZE, s->sector_count * 512, &error_abort); qemu_opt_set(opts, BLOCK_OPT_BACKING_FILE, "fat:", &error_abort); VAR_2 = bdrv_create(bdrv_qcow, s->qcow_filename, opts, VAR_1); qemu_opts_del(opts); if (VAR_2 < 0) { goto err; } options = qdict_new(); qdict_put(options, "write-target.driver", qstring_from_str("qcow")); s->qcow = bdrv_open_child(s->qcow_filename, options, "write-target", VAR_0, &child_vvfat_qcow, false, VAR_1); QDECREF(options); if (!s->qcow) { VAR_2 = -EINVAL; goto err; } #ifndef _WIN32 unlink(s->qcow_filename); #endif backing = bdrv_new(); bdrv_set_backing_hd(s->VAR_0, backing); bdrv_unref(backing); s->VAR_0->backing->VAR_0->drv = &vvfat_write_target; s->VAR_0->backing->VAR_0->opaque = g_new(void *, 1); *(void**)s->VAR_0->backing->VAR_0->opaque = s; return 0; err: g_free(s->qcow_filename); s->qcow_filename = NULL; return VAR_2; }
[ "static int FUNC_0(BlockDriverState *VAR_0, Error **VAR_1)\n{", "BDRVVVFATState *s = VAR_0->opaque;", "BlockDriver *bdrv_qcow = NULL;", "BlockDriverState *backing;", "QemuOpts *opts = NULL;", "int VAR_2;", "int VAR_3 = sector2cluster(s, s->sector_count);", "QDict *options;", "s->used_clusters = calloc(VAR_3, 1);", "array_init(&(s->commits), sizeof(commit_t));", "s->qcow_filename = g_malloc(PATH_MAX);", "VAR_2 = get_tmp_filename(s->qcow_filename, PATH_MAX);", "if (VAR_2 < 0) {", "error_setg_errno(VAR_1, -VAR_2, \"can't create temporary file\");", "goto err;", "}", "bdrv_qcow = bdrv_find_format(\"qcow\");", "if (!bdrv_qcow) {", "error_setg(VAR_1, \"Failed to locate qcow driver\");", "VAR_2 = -ENOENT;", "goto err;", "}", "opts = qemu_opts_create(bdrv_qcow->create_opts, NULL, 0, &error_abort);", "qemu_opt_set_number(opts, BLOCK_OPT_SIZE, s->sector_count * 512,\n&error_abort);", "qemu_opt_set(opts, BLOCK_OPT_BACKING_FILE, \"fat:\", &error_abort);", "VAR_2 = bdrv_create(bdrv_qcow, s->qcow_filename, opts, VAR_1);", "qemu_opts_del(opts);", "if (VAR_2 < 0) {", "goto err;", "}", "options = qdict_new();", "qdict_put(options, \"write-target.driver\", qstring_from_str(\"qcow\"));", "s->qcow = bdrv_open_child(s->qcow_filename, options, \"write-target\", VAR_0,\n&child_vvfat_qcow, false, VAR_1);", "QDECREF(options);", "if (!s->qcow) {", "VAR_2 = -EINVAL;", "goto err;", "}", "#ifndef _WIN32\nunlink(s->qcow_filename);", "#endif\nbacking = bdrv_new();", "bdrv_set_backing_hd(s->VAR_0, backing);", "bdrv_unref(backing);", "s->VAR_0->backing->VAR_0->drv = &vvfat_write_target;", "s->VAR_0->backing->VAR_0->opaque = g_new(void *, 1);", "*(void**)s->VAR_0->backing->VAR_0->opaque = s;", "return 0;", "err:\ng_free(s->qcow_filename);", "s->qcow_filename = NULL;", "return VAR_2;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59, 61 ], [ 63 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ], [ 83, 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99, 101 ], [ 103, 107 ], [ 109 ], [ 111 ], [ 115 ], [ 117 ], [ 119 ], [ 123 ], [ 127, 129 ], [ 131 ], [ 133 ], [ 135 ] ]
4,601
static int apng_read_header(AVFormatContext *s) { APNGDemuxContext *ctx = s->priv_data; AVIOContext *pb = s->pb; uint32_t len, tag; AVStream *st; int acTL_found = 0; int64_t ret = AVERROR_INVALIDDATA; /* verify PNGSIG */ if (avio_rb64(pb) != PNGSIG) return ret; /* parse IHDR (must be first chunk) */ len = avio_rb32(pb); tag = avio_rl32(pb); if (len != 13 || tag != MKTAG('I', 'H', 'D', 'R')) return ret; st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); /* set the timebase to something large enough (1/100,000 of second) * to hopefully cope with all sane frame durations */ avpriv_set_pts_info(st, 64, 1, 100000); st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO; st->codecpar->codec_id = AV_CODEC_ID_APNG; st->codecpar->width = avio_rb32(pb); st->codecpar->height = avio_rb32(pb); if ((ret = av_image_check_size(st->codecpar->width, st->codecpar->height, 0, s)) < 0) return ret; /* extradata will contain every chunk up to the first fcTL (excluded) */ ctx->extra_data = av_malloc(len + 12 + AV_INPUT_BUFFER_PADDING_SIZE); if (!ctx->extra_data) return AVERROR(ENOMEM); ctx->extra_data_size = len + 12; AV_WB32(ctx->extra_data, len); AV_WL32(ctx->extra_data+4, tag); AV_WB32(ctx->extra_data+8, st->codecpar->width); AV_WB32(ctx->extra_data+12, st->codecpar->height); if ((ret = avio_read(pb, ctx->extra_data+16, 9)) < 0) goto fail; while (!avio_feof(pb)) { if (acTL_found && ctx->num_play != 1) { int64_t size = avio_size(pb); int64_t offset = avio_tell(pb); if (size < 0) { ret = size; goto fail; } else if (offset < 0) { ret = offset; goto fail; } else if ((ret = ffio_ensure_seekback(pb, size - offset)) < 0) { av_log(s, AV_LOG_WARNING, "Could not ensure seekback, will not loop\n"); ctx->num_play = 1; } } if ((ctx->num_play == 1 || !acTL_found) && ((ret = ffio_ensure_seekback(pb, 4 /* len */ + 4 /* tag */)) < 0)) goto fail; len = avio_rb32(pb); if (len > 0x7fffffff) { ret = AVERROR_INVALIDDATA; goto fail; } tag = avio_rl32(pb); switch (tag) { case MKTAG('a', 'c', 'T', 'L'): if ((ret = avio_seek(pb, -8, SEEK_CUR)) < 0 || (ret = append_extradata(ctx, pb, len + 12)) < 0) goto fail; acTL_found = 1; ctx->num_frames = AV_RB32(ctx->extra_data + ret + 8); ctx->num_play = AV_RB32(ctx->extra_data + ret + 12); av_log(s, AV_LOG_DEBUG, "num_frames: %"PRIu32", num_play: %"PRIu32"\n", ctx->num_frames, ctx->num_play); break; case MKTAG('f', 'c', 'T', 'L'): if (!acTL_found) { ret = AVERROR_INVALIDDATA; goto fail; } if ((ret = avio_seek(pb, -8, SEEK_CUR)) < 0) goto fail; return 0; default: if ((ret = avio_seek(pb, -8, SEEK_CUR)) < 0 || (ret = append_extradata(ctx, pb, len + 12)) < 0) goto fail; } } fail: if (ctx->extra_data_size) { av_freep(&ctx->extra_data); ctx->extra_data_size = 0; } return ret; }
true
FFmpeg
16c429166ddf1736972b6ccce84bd3509ec16a34
static int apng_read_header(AVFormatContext *s) { APNGDemuxContext *ctx = s->priv_data; AVIOContext *pb = s->pb; uint32_t len, tag; AVStream *st; int acTL_found = 0; int64_t ret = AVERROR_INVALIDDATA; if (avio_rb64(pb) != PNGSIG) return ret; len = avio_rb32(pb); tag = avio_rl32(pb); if (len != 13 || tag != MKTAG('I', 'H', 'D', 'R')) return ret; st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); avpriv_set_pts_info(st, 64, 1, 100000); st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO; st->codecpar->codec_id = AV_CODEC_ID_APNG; st->codecpar->width = avio_rb32(pb); st->codecpar->height = avio_rb32(pb); if ((ret = av_image_check_size(st->codecpar->width, st->codecpar->height, 0, s)) < 0) return ret; ctx->extra_data = av_malloc(len + 12 + AV_INPUT_BUFFER_PADDING_SIZE); if (!ctx->extra_data) return AVERROR(ENOMEM); ctx->extra_data_size = len + 12; AV_WB32(ctx->extra_data, len); AV_WL32(ctx->extra_data+4, tag); AV_WB32(ctx->extra_data+8, st->codecpar->width); AV_WB32(ctx->extra_data+12, st->codecpar->height); if ((ret = avio_read(pb, ctx->extra_data+16, 9)) < 0) goto fail; while (!avio_feof(pb)) { if (acTL_found && ctx->num_play != 1) { int64_t size = avio_size(pb); int64_t offset = avio_tell(pb); if (size < 0) { ret = size; goto fail; } else if (offset < 0) { ret = offset; goto fail; } else if ((ret = ffio_ensure_seekback(pb, size - offset)) < 0) { av_log(s, AV_LOG_WARNING, "Could not ensure seekback, will not loop\n"); ctx->num_play = 1; } } if ((ctx->num_play == 1 || !acTL_found) && ((ret = ffio_ensure_seekback(pb, 4 + 4 )) < 0)) goto fail; len = avio_rb32(pb); if (len > 0x7fffffff) { ret = AVERROR_INVALIDDATA; goto fail; } tag = avio_rl32(pb); switch (tag) { case MKTAG('a', 'c', 'T', 'L'): if ((ret = avio_seek(pb, -8, SEEK_CUR)) < 0 || (ret = append_extradata(ctx, pb, len + 12)) < 0) goto fail; acTL_found = 1; ctx->num_frames = AV_RB32(ctx->extra_data + ret + 8); ctx->num_play = AV_RB32(ctx->extra_data + ret + 12); av_log(s, AV_LOG_DEBUG, "num_frames: %"PRIu32", num_play: %"PRIu32"\n", ctx->num_frames, ctx->num_play); break; case MKTAG('f', 'c', 'T', 'L'): if (!acTL_found) { ret = AVERROR_INVALIDDATA; goto fail; } if ((ret = avio_seek(pb, -8, SEEK_CUR)) < 0) goto fail; return 0; default: if ((ret = avio_seek(pb, -8, SEEK_CUR)) < 0 || (ret = append_extradata(ctx, pb, len + 12)) < 0) goto fail; } } fail: if (ctx->extra_data_size) { av_freep(&ctx->extra_data); ctx->extra_data_size = 0; } return ret; }
{ "code": [ " ctx->extra_data = av_malloc(len + 12 + AV_INPUT_BUFFER_PADDING_SIZE);", " if (!ctx->extra_data)", " ctx->extra_data_size = len + 12;", " AV_WB32(ctx->extra_data, len);", " AV_WL32(ctx->extra_data+4, tag);", " AV_WB32(ctx->extra_data+8, st->codecpar->width);", " AV_WB32(ctx->extra_data+12, st->codecpar->height);", " if ((ret = avio_read(pb, ctx->extra_data+16, 9)) < 0)", " (ret = append_extradata(ctx, pb, len + 12)) < 0)", " ctx->num_frames = AV_RB32(ctx->extra_data + ret + 8);", " ctx->num_play = AV_RB32(ctx->extra_data + ret + 12);", " (ret = append_extradata(ctx, pb, len + 12)) < 0)", " if (ctx->extra_data_size) {", " av_freep(&ctx->extra_data);", " ctx->extra_data_size = 0;", " APNGDemuxContext *ctx = s->priv_data;" ], "line_no": [ 69, 71, 75, 77, 79, 81, 83, 85, 149, 155, 157, 149, 197, 199, 201, 5 ] }
static int FUNC_0(AVFormatContext *VAR_0) { APNGDemuxContext *ctx = VAR_0->priv_data; AVIOContext *pb = VAR_0->pb; uint32_t len, tag; AVStream *st; int VAR_1 = 0; int64_t ret = AVERROR_INVALIDDATA; if (avio_rb64(pb) != PNGSIG) return ret; len = avio_rb32(pb); tag = avio_rl32(pb); if (len != 13 || tag != MKTAG('I', 'H', 'D', 'R')) return ret; st = avformat_new_stream(VAR_0, NULL); if (!st) return AVERROR(ENOMEM); avpriv_set_pts_info(st, 64, 1, 100000); st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO; st->codecpar->codec_id = AV_CODEC_ID_APNG; st->codecpar->width = avio_rb32(pb); st->codecpar->height = avio_rb32(pb); if ((ret = av_image_check_size(st->codecpar->width, st->codecpar->height, 0, VAR_0)) < 0) return ret; ctx->extra_data = av_malloc(len + 12 + AV_INPUT_BUFFER_PADDING_SIZE); if (!ctx->extra_data) return AVERROR(ENOMEM); ctx->extra_data_size = len + 12; AV_WB32(ctx->extra_data, len); AV_WL32(ctx->extra_data+4, tag); AV_WB32(ctx->extra_data+8, st->codecpar->width); AV_WB32(ctx->extra_data+12, st->codecpar->height); if ((ret = avio_read(pb, ctx->extra_data+16, 9)) < 0) goto fail; while (!avio_feof(pb)) { if (VAR_1 && ctx->num_play != 1) { int64_t size = avio_size(pb); int64_t offset = avio_tell(pb); if (size < 0) { ret = size; goto fail; } else if (offset < 0) { ret = offset; goto fail; } else if ((ret = ffio_ensure_seekback(pb, size - offset)) < 0) { av_log(VAR_0, AV_LOG_WARNING, "Could not ensure seekback, will not loop\n"); ctx->num_play = 1; } } if ((ctx->num_play == 1 || !VAR_1) && ((ret = ffio_ensure_seekback(pb, 4 + 4 )) < 0)) goto fail; len = avio_rb32(pb); if (len > 0x7fffffff) { ret = AVERROR_INVALIDDATA; goto fail; } tag = avio_rl32(pb); switch (tag) { case MKTAG('a', 'c', 'T', 'L'): if ((ret = avio_seek(pb, -8, SEEK_CUR)) < 0 || (ret = append_extradata(ctx, pb, len + 12)) < 0) goto fail; VAR_1 = 1; ctx->num_frames = AV_RB32(ctx->extra_data + ret + 8); ctx->num_play = AV_RB32(ctx->extra_data + ret + 12); av_log(VAR_0, AV_LOG_DEBUG, "num_frames: %"PRIu32", num_play: %"PRIu32"\n", ctx->num_frames, ctx->num_play); break; case MKTAG('f', 'c', 'T', 'L'): if (!VAR_1) { ret = AVERROR_INVALIDDATA; goto fail; } if ((ret = avio_seek(pb, -8, SEEK_CUR)) < 0) goto fail; return 0; default: if ((ret = avio_seek(pb, -8, SEEK_CUR)) < 0 || (ret = append_extradata(ctx, pb, len + 12)) < 0) goto fail; } } fail: if (ctx->extra_data_size) { av_freep(&ctx->extra_data); ctx->extra_data_size = 0; } return ret; }
[ "static int FUNC_0(AVFormatContext *VAR_0)\n{", "APNGDemuxContext *ctx = VAR_0->priv_data;", "AVIOContext *pb = VAR_0->pb;", "uint32_t len, tag;", "AVStream *st;", "int VAR_1 = 0;", "int64_t ret = AVERROR_INVALIDDATA;", "if (avio_rb64(pb) != PNGSIG)\nreturn ret;", "len = avio_rb32(pb);", "tag = avio_rl32(pb);", "if (len != 13 || tag != MKTAG('I', 'H', 'D', 'R'))\nreturn ret;", "st = avformat_new_stream(VAR_0, NULL);", "if (!st)\nreturn AVERROR(ENOMEM);", "avpriv_set_pts_info(st, 64, 1, 100000);", "st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;", "st->codecpar->codec_id = AV_CODEC_ID_APNG;", "st->codecpar->width = avio_rb32(pb);", "st->codecpar->height = avio_rb32(pb);", "if ((ret = av_image_check_size(st->codecpar->width, st->codecpar->height, 0, VAR_0)) < 0)\nreturn ret;", "ctx->extra_data = av_malloc(len + 12 + AV_INPUT_BUFFER_PADDING_SIZE);", "if (!ctx->extra_data)\nreturn AVERROR(ENOMEM);", "ctx->extra_data_size = len + 12;", "AV_WB32(ctx->extra_data, len);", "AV_WL32(ctx->extra_data+4, tag);", "AV_WB32(ctx->extra_data+8, st->codecpar->width);", "AV_WB32(ctx->extra_data+12, st->codecpar->height);", "if ((ret = avio_read(pb, ctx->extra_data+16, 9)) < 0)\ngoto fail;", "while (!avio_feof(pb)) {", "if (VAR_1 && ctx->num_play != 1) {", "int64_t size = avio_size(pb);", "int64_t offset = avio_tell(pb);", "if (size < 0) {", "ret = size;", "goto fail;", "} else if (offset < 0) {", "ret = offset;", "goto fail;", "} else if ((ret = ffio_ensure_seekback(pb, size - offset)) < 0) {", "av_log(VAR_0, AV_LOG_WARNING, \"Could not ensure seekback, will not loop\\n\");", "ctx->num_play = 1;", "}", "}", "if ((ctx->num_play == 1 || !VAR_1) &&\n((ret = ffio_ensure_seekback(pb, 4 + 4 )) < 0))\ngoto fail;", "len = avio_rb32(pb);", "if (len > 0x7fffffff) {", "ret = AVERROR_INVALIDDATA;", "goto fail;", "}", "tag = avio_rl32(pb);", "switch (tag) {", "case MKTAG('a', 'c', 'T', 'L'):\nif ((ret = avio_seek(pb, -8, SEEK_CUR)) < 0 ||\n(ret = append_extradata(ctx, pb, len + 12)) < 0)\ngoto fail;", "VAR_1 = 1;", "ctx->num_frames = AV_RB32(ctx->extra_data + ret + 8);", "ctx->num_play = AV_RB32(ctx->extra_data + ret + 12);", "av_log(VAR_0, AV_LOG_DEBUG, \"num_frames: %\"PRIu32\", num_play: %\"PRIu32\"\\n\",\nctx->num_frames, ctx->num_play);", "break;", "case MKTAG('f', 'c', 'T', 'L'):\nif (!VAR_1) {", "ret = AVERROR_INVALIDDATA;", "goto fail;", "}", "if ((ret = avio_seek(pb, -8, SEEK_CUR)) < 0)\ngoto fail;", "return 0;", "default:\nif ((ret = avio_seek(pb, -8, SEEK_CUR)) < 0 ||\n(ret = append_extradata(ctx, pb, len + 12)) < 0)\ngoto fail;", "}", "}", "fail:\nif (ctx->extra_data_size) {", "av_freep(&ctx->extra_data);", "ctx->extra_data_size = 0;", "}", "return ret;", "}" ]
[ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 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, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 21, 23 ], [ 29 ], [ 31 ], [ 33, 35 ], [ 39 ], [ 41, 43 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61, 63 ], [ 69 ], [ 71, 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85, 87 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121, 123, 125 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 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 ], [ 195, 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ] ]
4,602
static int local_statfs(FsContext *s, V9fsPath *fs_path, struct statfs *stbuf) { char *buffer; int ret; char *path = fs_path->data; buffer = rpath(s, path); ret = statfs(buffer, stbuf); g_free(buffer); return ret; }
true
qemu
31e51d1c15b35dc98b88a301812914b70a2b55dc
static int local_statfs(FsContext *s, V9fsPath *fs_path, struct statfs *stbuf) { char *buffer; int ret; char *path = fs_path->data; buffer = rpath(s, path); ret = statfs(buffer, stbuf); g_free(buffer); return ret; }
{ "code": [ " char *buffer;", " int ret;", " char *path = fs_path->data;", " buffer = rpath(s, path);", " ret = statfs(buffer, stbuf);", " g_free(buffer);" ], "line_no": [ 5, 7, 9, 13, 15, 17 ] }
static int FUNC_0(FsContext *VAR_0, V9fsPath *VAR_1, struct statfs *VAR_2) { char *VAR_3; int VAR_4; char *VAR_5 = VAR_1->data; VAR_3 = rpath(VAR_0, VAR_5); VAR_4 = statfs(VAR_3, VAR_2); g_free(VAR_3); return VAR_4; }
[ "static int FUNC_0(FsContext *VAR_0, V9fsPath *VAR_1, struct statfs *VAR_2)\n{", "char *VAR_3;", "int VAR_4;", "char *VAR_5 = VAR_1->data;", "VAR_3 = rpath(VAR_0, VAR_5);", "VAR_4 = statfs(VAR_3, VAR_2);", "g_free(VAR_3);", "return VAR_4;", "}" ]
[ 0, 1, 1, 1, 1, 1, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
4,603
int av_image_fill_black(uint8_t *dst_data[4], const ptrdiff_t dst_linesize[4], enum AVPixelFormat pix_fmt, enum AVColorRange range, int width, int height) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt); int nb_planes = av_pix_fmt_count_planes(pix_fmt); // A pixel or a group of pixels on each plane, with a value that represents black. // Consider e.g. AV_PIX_FMT_UYVY422 for non-trivial cases. uint8_t clear_block[4][MAX_BLOCK_SIZE] = {0}; // clear padding with 0 int clear_block_size[4] = {0}; ptrdiff_t plane_line_bytes[4] = {0}; int rgb, limited; int plane, c; if (!desc || nb_planes < 1 || nb_planes > 4 || desc->flags & AV_PIX_FMT_FLAG_HWACCEL) return AVERROR(EINVAL); rgb = !!(desc->flags & AV_PIX_FMT_FLAG_RGB); limited = !rgb && range != AVCOL_RANGE_JPEG; if (desc->flags & AV_PIX_FMT_FLAG_BITSTREAM) { ptrdiff_t bytewidth = av_image_get_linesize(pix_fmt, width, 0); uint8_t *data; int mono = pix_fmt == AV_PIX_FMT_MONOWHITE || pix_fmt == AV_PIX_FMT_MONOBLACK; int fill = pix_fmt == AV_PIX_FMT_MONOWHITE ? 0xFF : 0; if (nb_planes != 1 || !(rgb || mono) || bytewidth < 1) return AVERROR(EINVAL); if (!dst_data) return 0; data = dst_data[0]; // (Bitstream + alpha will be handled incorrectly - it'll remain transparent.) for (;height > 0; height--) { memset(data, fill, bytewidth); data += dst_linesize[0]; } return 0; } for (c = 0; c < desc->nb_components; c++) { const AVComponentDescriptor comp = desc->comp[c]; // We try to operate on entire non-subsampled pixel groups (for // AV_PIX_FMT_UYVY422 this would mean two consecutive pixels). clear_block_size[comp.plane] = FFMAX(clear_block_size[comp.plane], comp.step); if (clear_block_size[comp.plane] > MAX_BLOCK_SIZE) return AVERROR(EINVAL); } // Create a byte array for clearing 1 pixel (sometimes several pixels). for (c = 0; c < desc->nb_components; c++) { const AVComponentDescriptor comp = desc->comp[c]; // (Multiple pixels happen e.g. with AV_PIX_FMT_UYVY422.) int w = clear_block_size[comp.plane] / comp.step; uint8_t *c_data[4]; const int c_linesize[4] = {0}; uint16_t src_array[MAX_BLOCK_SIZE]; uint16_t src = 0; int x; if (comp.depth > 16) return AVERROR(EINVAL); if (!rgb && comp.depth < 8) return AVERROR(EINVAL); if (w < 1) return AVERROR(EINVAL); if (c == 0 && limited) { src = 16 << (comp.depth - 8); } else if ((c == 1 || c == 2) && !rgb) { src = 128 << (comp.depth - 8); } else if (c == 3) { // (Assume even limited YUV uses full range alpha.) src = (1 << comp.depth) - 1; } for (x = 0; x < w; x++) src_array[x] = src; for (x = 0; x < 4; x++) c_data[x] = &clear_block[x][0]; av_write_image_line(src_array, c_data, c_linesize, desc, 0, 0, c, w); } for (plane = 0; plane < nb_planes; plane++) { plane_line_bytes[plane] = av_image_get_linesize(pix_fmt, width, plane); if (plane_line_bytes[plane] < 0) return AVERROR(EINVAL); } if (!dst_data) return 0; for (plane = 0; plane < nb_planes; plane++) { size_t bytewidth = plane_line_bytes[plane]; uint8_t *data = dst_data[plane]; int chroma_div = plane == 1 || plane == 2 ? desc->log2_chroma_h : 0; int plane_h = ((height + ( 1 << chroma_div) - 1)) >> chroma_div; for (; plane_h > 0; plane_h--) { memset_bytes(data, bytewidth, &clear_block[plane][0], clear_block_size[plane]); data += dst_linesize[plane]; } } return 0; }
true
FFmpeg
0f5576a22b11ef726a01b14d1eaae2fa780c2f52
int av_image_fill_black(uint8_t *dst_data[4], const ptrdiff_t dst_linesize[4], enum AVPixelFormat pix_fmt, enum AVColorRange range, int width, int height) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt); int nb_planes = av_pix_fmt_count_planes(pix_fmt); uint8_t clear_block[4][MAX_BLOCK_SIZE] = {0}; int clear_block_size[4] = {0}; ptrdiff_t plane_line_bytes[4] = {0}; int rgb, limited; int plane, c; if (!desc || nb_planes < 1 || nb_planes > 4 || desc->flags & AV_PIX_FMT_FLAG_HWACCEL) return AVERROR(EINVAL); rgb = !!(desc->flags & AV_PIX_FMT_FLAG_RGB); limited = !rgb && range != AVCOL_RANGE_JPEG; if (desc->flags & AV_PIX_FMT_FLAG_BITSTREAM) { ptrdiff_t bytewidth = av_image_get_linesize(pix_fmt, width, 0); uint8_t *data; int mono = pix_fmt == AV_PIX_FMT_MONOWHITE || pix_fmt == AV_PIX_FMT_MONOBLACK; int fill = pix_fmt == AV_PIX_FMT_MONOWHITE ? 0xFF : 0; if (nb_planes != 1 || !(rgb || mono) || bytewidth < 1) return AVERROR(EINVAL); if (!dst_data) return 0; data = dst_data[0]; for (;height > 0; height--) { memset(data, fill, bytewidth); data += dst_linesize[0]; } return 0; } for (c = 0; c < desc->nb_components; c++) { const AVComponentDescriptor comp = desc->comp[c]; clear_block_size[comp.plane] = FFMAX(clear_block_size[comp.plane], comp.step); if (clear_block_size[comp.plane] > MAX_BLOCK_SIZE) return AVERROR(EINVAL); } for (c = 0; c < desc->nb_components; c++) { const AVComponentDescriptor comp = desc->comp[c]; int w = clear_block_size[comp.plane] / comp.step; uint8_t *c_data[4]; const int c_linesize[4] = {0}; uint16_t src_array[MAX_BLOCK_SIZE]; uint16_t src = 0; int x; if (comp.depth > 16) return AVERROR(EINVAL); if (!rgb && comp.depth < 8) return AVERROR(EINVAL); if (w < 1) return AVERROR(EINVAL); if (c == 0 && limited) { src = 16 << (comp.depth - 8); } else if ((c == 1 || c == 2) && !rgb) { src = 128 << (comp.depth - 8); } else if (c == 3) { src = (1 << comp.depth) - 1; } for (x = 0; x < w; x++) src_array[x] = src; for (x = 0; x < 4; x++) c_data[x] = &clear_block[x][0]; av_write_image_line(src_array, c_data, c_linesize, desc, 0, 0, c, w); } for (plane = 0; plane < nb_planes; plane++) { plane_line_bytes[plane] = av_image_get_linesize(pix_fmt, width, plane); if (plane_line_bytes[plane] < 0) return AVERROR(EINVAL); } if (!dst_data) return 0; for (plane = 0; plane < nb_planes; plane++) { size_t bytewidth = plane_line_bytes[plane]; uint8_t *data = dst_data[plane]; int chroma_div = plane == 1 || plane == 2 ? desc->log2_chroma_h : 0; int plane_h = ((height + ( 1 << chroma_div) - 1)) >> chroma_div; for (; plane_h > 0; plane_h--) { memset_bytes(data, bytewidth, &clear_block[plane][0], clear_block_size[plane]); data += dst_linesize[plane]; } } return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(uint8_t *VAR_0[4], const ptrdiff_t VAR_1[4], enum AVPixelFormat VAR_2, enum AVColorRange VAR_3, int VAR_4, int VAR_5) { const AVPixFmtDescriptor *VAR_6 = av_pix_fmt_desc_get(VAR_2); int VAR_7 = av_pix_fmt_count_planes(VAR_2); uint8_t clear_block[4][MAX_BLOCK_SIZE] = {0}; int VAR_8[4] = {0}; ptrdiff_t plane_line_bytes[4] = {0}; int VAR_9, VAR_10; int VAR_11, VAR_12; if (!VAR_6 || VAR_7 < 1 || VAR_7 > 4 || VAR_6->flags & AV_PIX_FMT_FLAG_HWACCEL) return AVERROR(EINVAL); VAR_9 = !!(VAR_6->flags & AV_PIX_FMT_FLAG_RGB); VAR_10 = !VAR_9 && VAR_3 != AVCOL_RANGE_JPEG; if (VAR_6->flags & AV_PIX_FMT_FLAG_BITSTREAM) { ptrdiff_t bytewidth = av_image_get_linesize(VAR_2, VAR_4, 0); uint8_t *data; int VAR_13 = VAR_2 == AV_PIX_FMT_MONOWHITE || VAR_2 == AV_PIX_FMT_MONOBLACK; int VAR_14 = VAR_2 == AV_PIX_FMT_MONOWHITE ? 0xFF : 0; if (VAR_7 != 1 || !(VAR_9 || VAR_13) || bytewidth < 1) return AVERROR(EINVAL); if (!VAR_0) return 0; data = VAR_0[0]; for (;VAR_5 > 0; VAR_5--) { memset(data, VAR_14, bytewidth); data += VAR_1[0]; } return 0; } for (VAR_12 = 0; VAR_12 < VAR_6->nb_components; VAR_12++) { const AVComponentDescriptor comp = VAR_6->comp[VAR_12]; VAR_8[comp.VAR_11] = FFMAX(VAR_8[comp.VAR_11], comp.step); if (VAR_8[comp.VAR_11] > MAX_BLOCK_SIZE) return AVERROR(EINVAL); } for (VAR_12 = 0; VAR_12 < VAR_6->nb_components; VAR_12++) { const AVComponentDescriptor comp = VAR_6->comp[VAR_12]; int w = VAR_8[comp.VAR_11] / comp.step; uint8_t *c_data[4]; const int c_linesize[4] = {0}; uint16_t src_array[MAX_BLOCK_SIZE]; uint16_t src = 0; int x; if (comp.depth > 16) return AVERROR(EINVAL); if (!VAR_9 && comp.depth < 8) return AVERROR(EINVAL); if (w < 1) return AVERROR(EINVAL); if (VAR_12 == 0 && VAR_10) { src = 16 << (comp.depth - 8); } else if ((VAR_12 == 1 || VAR_12 == 2) && !VAR_9) { src = 128 << (comp.depth - 8); } else if (VAR_12 == 3) { src = (1 << comp.depth) - 1; } for (x = 0; x < w; x++) src_array[x] = src; for (x = 0; x < 4; x++) c_data[x] = &clear_block[x][0]; av_write_image_line(src_array, c_data, c_linesize, VAR_6, 0, 0, VAR_12, w); } for (VAR_11 = 0; VAR_11 < VAR_7; VAR_11++) { plane_line_bytes[VAR_11] = av_image_get_linesize(VAR_2, VAR_4, VAR_11); if (plane_line_bytes[VAR_11] < 0) return AVERROR(EINVAL); } if (!VAR_0) return 0; for (VAR_11 = 0; VAR_11 < VAR_7; VAR_11++) { size_t bytewidth = plane_line_bytes[VAR_11]; uint8_t *data = VAR_0[VAR_11]; int VAR_15 = VAR_11 == 1 || VAR_11 == 2 ? VAR_6->log2_chroma_h : 0; int VAR_16 = ((VAR_5 + ( 1 << VAR_15) - 1)) >> VAR_15; for (; VAR_16 > 0; VAR_16--) { memset_bytes(data, bytewidth, &clear_block[VAR_11][0], VAR_8[VAR_11]); data += VAR_1[VAR_11]; } } return 0; }
[ "int FUNC_0(uint8_t *VAR_0[4], const ptrdiff_t VAR_1[4],\nenum AVPixelFormat VAR_2, enum AVColorRange VAR_3,\nint VAR_4, int VAR_5)\n{", "const AVPixFmtDescriptor *VAR_6 = av_pix_fmt_desc_get(VAR_2);", "int VAR_7 = av_pix_fmt_count_planes(VAR_2);", "uint8_t clear_block[4][MAX_BLOCK_SIZE] = {0};", "int VAR_8[4] = {0};", "ptrdiff_t plane_line_bytes[4] = {0};", "int VAR_9, VAR_10;", "int VAR_11, VAR_12;", "if (!VAR_6 || VAR_7 < 1 || VAR_7 > 4 || VAR_6->flags & AV_PIX_FMT_FLAG_HWACCEL)\nreturn AVERROR(EINVAL);", "VAR_9 = !!(VAR_6->flags & AV_PIX_FMT_FLAG_RGB);", "VAR_10 = !VAR_9 && VAR_3 != AVCOL_RANGE_JPEG;", "if (VAR_6->flags & AV_PIX_FMT_FLAG_BITSTREAM) {", "ptrdiff_t bytewidth = av_image_get_linesize(VAR_2, VAR_4, 0);", "uint8_t *data;", "int VAR_13 = VAR_2 == AV_PIX_FMT_MONOWHITE || VAR_2 == AV_PIX_FMT_MONOBLACK;", "int VAR_14 = VAR_2 == AV_PIX_FMT_MONOWHITE ? 0xFF : 0;", "if (VAR_7 != 1 || !(VAR_9 || VAR_13) || bytewidth < 1)\nreturn AVERROR(EINVAL);", "if (!VAR_0)\nreturn 0;", "data = VAR_0[0];", "for (;VAR_5 > 0; VAR_5--) {", "memset(data, VAR_14, bytewidth);", "data += VAR_1[0];", "}", "return 0;", "}", "for (VAR_12 = 0; VAR_12 < VAR_6->nb_components; VAR_12++) {", "const AVComponentDescriptor comp = VAR_6->comp[VAR_12];", "VAR_8[comp.VAR_11] = FFMAX(VAR_8[comp.VAR_11], comp.step);", "if (VAR_8[comp.VAR_11] > MAX_BLOCK_SIZE)\nreturn AVERROR(EINVAL);", "}", "for (VAR_12 = 0; VAR_12 < VAR_6->nb_components; VAR_12++) {", "const AVComponentDescriptor comp = VAR_6->comp[VAR_12];", "int w = VAR_8[comp.VAR_11] / comp.step;", "uint8_t *c_data[4];", "const int c_linesize[4] = {0};", "uint16_t src_array[MAX_BLOCK_SIZE];", "uint16_t src = 0;", "int x;", "if (comp.depth > 16)\nreturn AVERROR(EINVAL);", "if (!VAR_9 && comp.depth < 8)\nreturn AVERROR(EINVAL);", "if (w < 1)\nreturn AVERROR(EINVAL);", "if (VAR_12 == 0 && VAR_10) {", "src = 16 << (comp.depth - 8);", "} else if ((VAR_12 == 1 || VAR_12 == 2) && !VAR_9) {", "src = 128 << (comp.depth - 8);", "} else if (VAR_12 == 3) {", "src = (1 << comp.depth) - 1;", "}", "for (x = 0; x < w; x++)", "src_array[x] = src;", "for (x = 0; x < 4; x++)", "c_data[x] = &clear_block[x][0];", "av_write_image_line(src_array, c_data, c_linesize, VAR_6, 0, 0, VAR_12, w);", "}", "for (VAR_11 = 0; VAR_11 < VAR_7; VAR_11++) {", "plane_line_bytes[VAR_11] = av_image_get_linesize(VAR_2, VAR_4, VAR_11);", "if (plane_line_bytes[VAR_11] < 0)\nreturn AVERROR(EINVAL);", "}", "if (!VAR_0)\nreturn 0;", "for (VAR_11 = 0; VAR_11 < VAR_7; VAR_11++) {", "size_t bytewidth = plane_line_bytes[VAR_11];", "uint8_t *data = VAR_0[VAR_11];", "int VAR_15 = VAR_11 == 1 || VAR_11 == 2 ? VAR_6->log2_chroma_h : 0;", "int VAR_16 = ((VAR_5 + ( 1 << VAR_15) - 1)) >> VAR_15;", "for (; VAR_16 > 0; VAR_16--) {", "memset_bytes(data, bytewidth, &clear_block[VAR_11][0], VAR_8[VAR_11]);", "data += VAR_1[VAR_11];", "}", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29, 31 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51, 53 ], [ 57, 59 ], [ 63 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 85 ], [ 93 ], [ 97, 99 ], [ 101 ], [ 107 ], [ 109 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 127, 129 ], [ 131, 133 ], [ 135, 137 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 153 ], [ 155 ], [ 159 ], [ 161 ], [ 165 ], [ 167 ], [ 171 ], [ 173 ], [ 177 ], [ 179 ], [ 181, 183 ], [ 185 ], [ 189, 191 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 219 ], [ 221 ] ]
4,604
bool cache_is_cached(const PageCache *cache, uint64_t addr) { size_t pos; g_assert(cache); g_assert(cache->page_cache); pos = cache_get_cache_pos(cache, addr); return (cache->page_cache[pos].it_addr == addr); }
true
qemu
27af7d6ea5015e5ef1f7985eab94a8a218267a2b
bool cache_is_cached(const PageCache *cache, uint64_t addr) { size_t pos; g_assert(cache); g_assert(cache->page_cache); pos = cache_get_cache_pos(cache, addr); return (cache->page_cache[pos].it_addr == addr); }
{ "code": [ "bool cache_is_cached(const PageCache *cache, uint64_t addr)", " return (cache->page_cache[pos].it_addr == addr);" ], "line_no": [ 1, 19 ] }
bool FUNC_0(const PageCache *cache, uint64_t addr) { size_t pos; g_assert(cache); g_assert(cache->page_cache); pos = cache_get_cache_pos(cache, addr); return (cache->page_cache[pos].it_addr == addr); }
[ "bool FUNC_0(const PageCache *cache, uint64_t addr)\n{", "size_t pos;", "g_assert(cache);", "g_assert(cache->page_cache);", "pos = cache_get_cache_pos(cache, addr);", "return (cache->page_cache[pos].it_addr == addr);", "}" ]
[ 1, 0, 0, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 15 ], [ 19 ], [ 21 ] ]
4,605
static void superio_ioport_writeb(void *opaque, hwaddr addr, uint64_t data, unsigned size) { int can_write; SuperIOConfig *superio_conf = opaque; DPRINTF("superio_ioport_writeb address 0x%x val 0x%x\n", addr, data); if (addr == 0x3f0) { superio_conf->index = data & 0xff; } else { /* 0x3f1 */ switch (superio_conf->index) { case 0x00 ... 0xdf: case 0xe4: case 0xe5: case 0xe9 ... 0xed: case 0xf3: case 0xf5: case 0xf7: case 0xf9 ... 0xfb: case 0xfd ... 0xff: can_write = 0; break; default: can_write = 1; if (can_write) { switch (superio_conf->index) { case 0xe7: if ((data & 0xff) != 0xfe) { DPRINTF("chage uart 1 base. unsupported yet\n"); } break; case 0xe8: if ((data & 0xff) != 0xbe) { DPRINTF("chage uart 2 base. unsupported yet\n"); } break; default: superio_conf->config[superio_conf->index] = data & 0xff; } } } superio_conf->config[superio_conf->index] = data & 0xff; } }
true
qemu
b196d969efa3987148994f0f8da79a10ebda7641
static void superio_ioport_writeb(void *opaque, hwaddr addr, uint64_t data, unsigned size) { int can_write; SuperIOConfig *superio_conf = opaque; DPRINTF("superio_ioport_writeb address 0x%x val 0x%x\n", addr, data); if (addr == 0x3f0) { superio_conf->index = data & 0xff; } else { switch (superio_conf->index) { case 0x00 ... 0xdf: case 0xe4: case 0xe5: case 0xe9 ... 0xed: case 0xf3: case 0xf5: case 0xf7: case 0xf9 ... 0xfb: case 0xfd ... 0xff: can_write = 0; break; default: can_write = 1; if (can_write) { switch (superio_conf->index) { case 0xe7: if ((data & 0xff) != 0xfe) { DPRINTF("chage uart 1 base. unsupported yet\n"); } break; case 0xe8: if ((data & 0xff) != 0xbe) { DPRINTF("chage uart 2 base. unsupported yet\n"); } break; default: superio_conf->config[superio_conf->index] = data & 0xff; } } } superio_conf->config[superio_conf->index] = data & 0xff; } }
{ "code": [ " int can_write;", " can_write = 0;", " default:", " can_write = 1;", " if (can_write) {", " switch (superio_conf->index) {", " case 0xe7:", " if ((data & 0xff) != 0xfe) {", " DPRINTF(\"chage uart 1 base. unsupported yet\\n\");", " break;", " case 0xe8:", " if ((data & 0xff) != 0xbe) {", " DPRINTF(\"chage uart 2 base. unsupported yet\\n\");", " break;", " default:", " superio_conf->config[superio_conf->index] = data & 0xff;", " superio_conf->config[superio_conf->index] = data & 0xff;" ], "line_no": [ 7, 43, 47, 49, 53, 55, 57, 59, 61, 65, 67, 69, 71, 65, 79, 81, 89 ] }
static void FUNC_0(void *VAR_0, hwaddr VAR_1, uint64_t VAR_2, unsigned VAR_3) { int VAR_4; SuperIOConfig *superio_conf = VAR_0; DPRINTF("FUNC_0 address 0x%x val 0x%x\n", VAR_1, VAR_2); if (VAR_1 == 0x3f0) { superio_conf->index = VAR_2 & 0xff; } else { switch (superio_conf->index) { case 0x00 ... 0xdf: case 0xe4: case 0xe5: case 0xe9 ... 0xed: case 0xf3: case 0xf5: case 0xf7: case 0xf9 ... 0xfb: case 0xfd ... 0xff: VAR_4 = 0; break; default: VAR_4 = 1; if (VAR_4) { switch (superio_conf->index) { case 0xe7: if ((VAR_2 & 0xff) != 0xfe) { DPRINTF("chage uart 1 base. unsupported yet\n"); } break; case 0xe8: if ((VAR_2 & 0xff) != 0xbe) { DPRINTF("chage uart 2 base. unsupported yet\n"); } break; default: superio_conf->config[superio_conf->index] = VAR_2 & 0xff; } } } superio_conf->config[superio_conf->index] = VAR_2 & 0xff; } }
[ "static void FUNC_0(void *VAR_0, hwaddr VAR_1, uint64_t VAR_2,\nunsigned VAR_3)\n{", "int VAR_4;", "SuperIOConfig *superio_conf = VAR_0;", "DPRINTF(\"FUNC_0 address 0x%x val 0x%x\\n\", VAR_1, VAR_2);", "if (VAR_1 == 0x3f0) {", "superio_conf->index = VAR_2 & 0xff;", "} else {", "switch (superio_conf->index) {", "case 0x00 ... 0xdf:\ncase 0xe4:\ncase 0xe5:\ncase 0xe9 ... 0xed:\ncase 0xf3:\ncase 0xf5:\ncase 0xf7:\ncase 0xf9 ... 0xfb:\ncase 0xfd ... 0xff:\nVAR_4 = 0;", "break;", "default:\nVAR_4 = 1;", "if (VAR_4) {", "switch (superio_conf->index) {", "case 0xe7:\nif ((VAR_2 & 0xff) != 0xfe) {", "DPRINTF(\"chage uart 1 base. unsupported yet\\n\");", "}", "break;", "case 0xe8:\nif ((VAR_2 & 0xff) != 0xbe) {", "DPRINTF(\"chage uart 2 base. unsupported yet\\n\");", "}", "break;", "default:\nsuperio_conf->config[superio_conf->index] = VAR_2 & 0xff;", "}", "}", "}", "superio_conf->config[superio_conf->index] = VAR_2 & 0xff;", "}", "}" ]
[ 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25, 27, 29, 31, 33, 35, 37, 39, 41, 43 ], [ 45 ], [ 47, 49 ], [ 53 ], [ 55 ], [ 57, 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67, 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79, 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ] ]
4,608
static int default_fdset_get_fd(int64_t fdset_id, int flags) { return -1; }
false
qemu
1f001dc7bc9e435bf231a5b0edcad1c7c2bd6214
static int default_fdset_get_fd(int64_t fdset_id, int flags) { return -1; }
{ "code": [], "line_no": [] }
static int FUNC_0(int64_t VAR_0, int VAR_1) { return -1; }
[ "static int FUNC_0(int64_t VAR_0, int VAR_1)\n{", "return -1;", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
4,613
static void virtio_scsi_fail_cmd_req(VirtIOSCSIReq *req) { req->resp.cmd->response = VIRTIO_SCSI_S_FAILURE; virtio_scsi_complete_cmd_req(req); }
false
qemu
3eff1f46f08a360a4ae9f834ce9fef4c45bf6f0f
static void virtio_scsi_fail_cmd_req(VirtIOSCSIReq *req) { req->resp.cmd->response = VIRTIO_SCSI_S_FAILURE; virtio_scsi_complete_cmd_req(req); }
{ "code": [], "line_no": [] }
static void FUNC_0(VirtIOSCSIReq *VAR_0) { VAR_0->resp.cmd->response = VIRTIO_SCSI_S_FAILURE; virtio_scsi_complete_cmd_req(VAR_0); }
[ "static void FUNC_0(VirtIOSCSIReq *VAR_0)\n{", "VAR_0->resp.cmd->response = VIRTIO_SCSI_S_FAILURE;", "virtio_scsi_complete_cmd_req(VAR_0);", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
4,614
static int iscsi_open(BlockDriverState *bs, QDict *options, int flags, Error **errp) { IscsiLun *iscsilun = bs->opaque; struct iscsi_context *iscsi = NULL; struct iscsi_url *iscsi_url = NULL; struct scsi_task *task = NULL; struct scsi_inquiry_standard *inq = NULL; struct scsi_inquiry_supported_pages *inq_vpd; char *initiator_name = NULL; QemuOpts *opts; Error *local_err = NULL; const char *filename; int i, ret = 0; if ((BDRV_SECTOR_SIZE % 512) != 0) { error_setg(errp, "iSCSI: Invalid BDRV_SECTOR_SIZE. " "BDRV_SECTOR_SIZE(%lld) is not a multiple " "of 512", BDRV_SECTOR_SIZE); return -EINVAL; } opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort); qemu_opts_absorb_qdict(opts, options, &local_err); if (local_err) { error_propagate(errp, local_err); ret = -EINVAL; goto out; } filename = qemu_opt_get(opts, "filename"); iscsi_url = iscsi_parse_full_url(iscsi, filename); if (iscsi_url == NULL) { error_setg(errp, "Failed to parse URL : %s", filename); ret = -EINVAL; goto out; } memset(iscsilun, 0, sizeof(IscsiLun)); initiator_name = parse_initiator_name(iscsi_url->target); iscsi = iscsi_create_context(initiator_name); if (iscsi == NULL) { error_setg(errp, "iSCSI: Failed to create iSCSI context."); ret = -ENOMEM; goto out; } if (iscsi_set_targetname(iscsi, iscsi_url->target)) { error_setg(errp, "iSCSI: Failed to set target name."); ret = -EINVAL; goto out; } if (iscsi_url->user != NULL) { ret = iscsi_set_initiator_username_pwd(iscsi, iscsi_url->user, iscsi_url->passwd); if (ret != 0) { error_setg(errp, "Failed to set initiator username and password"); ret = -EINVAL; goto out; } } /* check if we got CHAP username/password via the options */ parse_chap(iscsi, iscsi_url->target, &local_err); if (local_err != NULL) { error_propagate(errp, local_err); ret = -EINVAL; goto out; } if (iscsi_set_session_type(iscsi, ISCSI_SESSION_NORMAL) != 0) { error_setg(errp, "iSCSI: Failed to set session type to normal."); ret = -EINVAL; goto out; } iscsi_set_header_digest(iscsi, ISCSI_HEADER_DIGEST_NONE_CRC32C); /* check if we got HEADER_DIGEST via the options */ parse_header_digest(iscsi, iscsi_url->target, &local_err); if (local_err != NULL) { error_propagate(errp, local_err); ret = -EINVAL; goto out; } if (iscsi_full_connect_sync(iscsi, iscsi_url->portal, iscsi_url->lun) != 0) { error_setg(errp, "iSCSI: Failed to connect to LUN : %s", iscsi_get_error(iscsi)); ret = -EINVAL; goto out; } iscsilun->iscsi = iscsi; iscsilun->aio_context = bdrv_get_aio_context(bs); iscsilun->lun = iscsi_url->lun; iscsilun->has_write_same = true; task = iscsi_do_inquiry(iscsilun->iscsi, iscsilun->lun, 0, 0, (void **) &inq, errp); if (task == NULL) { ret = -EINVAL; goto out; } iscsilun->type = inq->periperal_device_type; scsi_free_scsi_task(task); task = NULL; /* Check the write protect flag of the LUN if we want to write */ if (iscsilun->type == TYPE_DISK && (flags & BDRV_O_RDWR) && iscsi_is_write_protected(iscsilun)) { error_setg(errp, "Cannot open a write protected LUN as read-write"); ret = -EACCES; goto out; } iscsi_readcapacity_sync(iscsilun, &local_err); if (local_err != NULL) { error_propagate(errp, local_err); ret = -EINVAL; goto out; } bs->total_sectors = sector_lun2qemu(iscsilun->num_blocks, iscsilun); bs->request_alignment = iscsilun->block_size; /* We don't have any emulation for devices other than disks and CD-ROMs, so * this must be sg ioctl compatible. We force it to be sg, otherwise qemu * will try to read from the device to guess the image format. */ if (iscsilun->type != TYPE_DISK && iscsilun->type != TYPE_ROM) { bs->sg = 1; } task = iscsi_do_inquiry(iscsilun->iscsi, iscsilun->lun, 1, SCSI_INQUIRY_PAGECODE_SUPPORTED_VPD_PAGES, (void **) &inq_vpd, errp); if (task == NULL) { ret = -EINVAL; goto out; } for (i = 0; i < inq_vpd->num_pages; i++) { struct scsi_task *inq_task; struct scsi_inquiry_logical_block_provisioning *inq_lbp; struct scsi_inquiry_block_limits *inq_bl; switch (inq_vpd->pages[i]) { case SCSI_INQUIRY_PAGECODE_LOGICAL_BLOCK_PROVISIONING: inq_task = iscsi_do_inquiry(iscsilun->iscsi, iscsilun->lun, 1, SCSI_INQUIRY_PAGECODE_LOGICAL_BLOCK_PROVISIONING, (void **) &inq_lbp, errp); if (inq_task == NULL) { ret = -EINVAL; goto out; } memcpy(&iscsilun->lbp, inq_lbp, sizeof(struct scsi_inquiry_logical_block_provisioning)); scsi_free_scsi_task(inq_task); break; case SCSI_INQUIRY_PAGECODE_BLOCK_LIMITS: inq_task = iscsi_do_inquiry(iscsilun->iscsi, iscsilun->lun, 1, SCSI_INQUIRY_PAGECODE_BLOCK_LIMITS, (void **) &inq_bl, errp); if (inq_task == NULL) { ret = -EINVAL; goto out; } memcpy(&iscsilun->bl, inq_bl, sizeof(struct scsi_inquiry_block_limits)); scsi_free_scsi_task(inq_task); break; default: break; } } scsi_free_scsi_task(task); task = NULL; iscsi_attach_aio_context(bs, iscsilun->aio_context); /* Guess the internal cluster (page) size of the iscsi target by the means * of opt_unmap_gran. Transfer the unmap granularity only if it has a * reasonable size */ if (iscsilun->bl.opt_unmap_gran * iscsilun->block_size >= 4 * 1024 && iscsilun->bl.opt_unmap_gran * iscsilun->block_size <= 16 * 1024 * 1024) { iscsilun->cluster_sectors = (iscsilun->bl.opt_unmap_gran * iscsilun->block_size) >> BDRV_SECTOR_BITS; if (iscsilun->lbprz && !(bs->open_flags & BDRV_O_NOCACHE)) { iscsilun->allocationmap = iscsi_allocationmap_init(iscsilun); if (iscsilun->allocationmap == NULL) { ret = -ENOMEM; } } } out: qemu_opts_del(opts); g_free(initiator_name); if (iscsi_url != NULL) { iscsi_destroy_url(iscsi_url); } if (task != NULL) { scsi_free_scsi_task(task); } if (ret) { if (iscsi != NULL) { iscsi_destroy_context(iscsi); } memset(iscsilun, 0, sizeof(IscsiLun)); } return ret; }
false
qemu
43ae8fb10c5f6ca78f242624c1f446e0050a9d43
static int iscsi_open(BlockDriverState *bs, QDict *options, int flags, Error **errp) { IscsiLun *iscsilun = bs->opaque; struct iscsi_context *iscsi = NULL; struct iscsi_url *iscsi_url = NULL; struct scsi_task *task = NULL; struct scsi_inquiry_standard *inq = NULL; struct scsi_inquiry_supported_pages *inq_vpd; char *initiator_name = NULL; QemuOpts *opts; Error *local_err = NULL; const char *filename; int i, ret = 0; if ((BDRV_SECTOR_SIZE % 512) != 0) { error_setg(errp, "iSCSI: Invalid BDRV_SECTOR_SIZE. " "BDRV_SECTOR_SIZE(%lld) is not a multiple " "of 512", BDRV_SECTOR_SIZE); return -EINVAL; } opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort); qemu_opts_absorb_qdict(opts, options, &local_err); if (local_err) { error_propagate(errp, local_err); ret = -EINVAL; goto out; } filename = qemu_opt_get(opts, "filename"); iscsi_url = iscsi_parse_full_url(iscsi, filename); if (iscsi_url == NULL) { error_setg(errp, "Failed to parse URL : %s", filename); ret = -EINVAL; goto out; } memset(iscsilun, 0, sizeof(IscsiLun)); initiator_name = parse_initiator_name(iscsi_url->target); iscsi = iscsi_create_context(initiator_name); if (iscsi == NULL) { error_setg(errp, "iSCSI: Failed to create iSCSI context."); ret = -ENOMEM; goto out; } if (iscsi_set_targetname(iscsi, iscsi_url->target)) { error_setg(errp, "iSCSI: Failed to set target name."); ret = -EINVAL; goto out; } if (iscsi_url->user != NULL) { ret = iscsi_set_initiator_username_pwd(iscsi, iscsi_url->user, iscsi_url->passwd); if (ret != 0) { error_setg(errp, "Failed to set initiator username and password"); ret = -EINVAL; goto out; } } parse_chap(iscsi, iscsi_url->target, &local_err); if (local_err != NULL) { error_propagate(errp, local_err); ret = -EINVAL; goto out; } if (iscsi_set_session_type(iscsi, ISCSI_SESSION_NORMAL) != 0) { error_setg(errp, "iSCSI: Failed to set session type to normal."); ret = -EINVAL; goto out; } iscsi_set_header_digest(iscsi, ISCSI_HEADER_DIGEST_NONE_CRC32C); parse_header_digest(iscsi, iscsi_url->target, &local_err); if (local_err != NULL) { error_propagate(errp, local_err); ret = -EINVAL; goto out; } if (iscsi_full_connect_sync(iscsi, iscsi_url->portal, iscsi_url->lun) != 0) { error_setg(errp, "iSCSI: Failed to connect to LUN : %s", iscsi_get_error(iscsi)); ret = -EINVAL; goto out; } iscsilun->iscsi = iscsi; iscsilun->aio_context = bdrv_get_aio_context(bs); iscsilun->lun = iscsi_url->lun; iscsilun->has_write_same = true; task = iscsi_do_inquiry(iscsilun->iscsi, iscsilun->lun, 0, 0, (void **) &inq, errp); if (task == NULL) { ret = -EINVAL; goto out; } iscsilun->type = inq->periperal_device_type; scsi_free_scsi_task(task); task = NULL; if (iscsilun->type == TYPE_DISK && (flags & BDRV_O_RDWR) && iscsi_is_write_protected(iscsilun)) { error_setg(errp, "Cannot open a write protected LUN as read-write"); ret = -EACCES; goto out; } iscsi_readcapacity_sync(iscsilun, &local_err); if (local_err != NULL) { error_propagate(errp, local_err); ret = -EINVAL; goto out; } bs->total_sectors = sector_lun2qemu(iscsilun->num_blocks, iscsilun); bs->request_alignment = iscsilun->block_size; if (iscsilun->type != TYPE_DISK && iscsilun->type != TYPE_ROM) { bs->sg = 1; } task = iscsi_do_inquiry(iscsilun->iscsi, iscsilun->lun, 1, SCSI_INQUIRY_PAGECODE_SUPPORTED_VPD_PAGES, (void **) &inq_vpd, errp); if (task == NULL) { ret = -EINVAL; goto out; } for (i = 0; i < inq_vpd->num_pages; i++) { struct scsi_task *inq_task; struct scsi_inquiry_logical_block_provisioning *inq_lbp; struct scsi_inquiry_block_limits *inq_bl; switch (inq_vpd->pages[i]) { case SCSI_INQUIRY_PAGECODE_LOGICAL_BLOCK_PROVISIONING: inq_task = iscsi_do_inquiry(iscsilun->iscsi, iscsilun->lun, 1, SCSI_INQUIRY_PAGECODE_LOGICAL_BLOCK_PROVISIONING, (void **) &inq_lbp, errp); if (inq_task == NULL) { ret = -EINVAL; goto out; } memcpy(&iscsilun->lbp, inq_lbp, sizeof(struct scsi_inquiry_logical_block_provisioning)); scsi_free_scsi_task(inq_task); break; case SCSI_INQUIRY_PAGECODE_BLOCK_LIMITS: inq_task = iscsi_do_inquiry(iscsilun->iscsi, iscsilun->lun, 1, SCSI_INQUIRY_PAGECODE_BLOCK_LIMITS, (void **) &inq_bl, errp); if (inq_task == NULL) { ret = -EINVAL; goto out; } memcpy(&iscsilun->bl, inq_bl, sizeof(struct scsi_inquiry_block_limits)); scsi_free_scsi_task(inq_task); break; default: break; } } scsi_free_scsi_task(task); task = NULL; iscsi_attach_aio_context(bs, iscsilun->aio_context); if (iscsilun->bl.opt_unmap_gran * iscsilun->block_size >= 4 * 1024 && iscsilun->bl.opt_unmap_gran * iscsilun->block_size <= 16 * 1024 * 1024) { iscsilun->cluster_sectors = (iscsilun->bl.opt_unmap_gran * iscsilun->block_size) >> BDRV_SECTOR_BITS; if (iscsilun->lbprz && !(bs->open_flags & BDRV_O_NOCACHE)) { iscsilun->allocationmap = iscsi_allocationmap_init(iscsilun); if (iscsilun->allocationmap == NULL) { ret = -ENOMEM; } } } out: qemu_opts_del(opts); g_free(initiator_name); if (iscsi_url != NULL) { iscsi_destroy_url(iscsi_url); } if (task != NULL) { scsi_free_scsi_task(task); } if (ret) { if (iscsi != NULL) { iscsi_destroy_context(iscsi); } memset(iscsilun, 0, sizeof(IscsiLun)); } return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(BlockDriverState *VAR_0, QDict *VAR_1, int VAR_2, Error **VAR_3) { IscsiLun *iscsilun = VAR_0->opaque; struct iscsi_context *VAR_4 = NULL; struct VAR_5 *VAR_5 = NULL; struct scsi_task *VAR_6 = NULL; struct scsi_inquiry_standard *VAR_7 = NULL; struct scsi_inquiry_supported_pages *VAR_8; char *VAR_9 = NULL; QemuOpts *opts; Error *local_err = NULL; const char *VAR_10; int VAR_11, VAR_12 = 0; if ((BDRV_SECTOR_SIZE % 512) != 0) { error_setg(VAR_3, "iSCSI: Invalid BDRV_SECTOR_SIZE. " "BDRV_SECTOR_SIZE(%lld) is not a multiple " "of 512", BDRV_SECTOR_SIZE); return -EINVAL; } opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort); qemu_opts_absorb_qdict(opts, VAR_1, &local_err); if (local_err) { error_propagate(VAR_3, local_err); VAR_12 = -EINVAL; goto out; } VAR_10 = qemu_opt_get(opts, "VAR_10"); VAR_5 = iscsi_parse_full_url(VAR_4, VAR_10); if (VAR_5 == NULL) { error_setg(VAR_3, "Failed to parse URL : %s", VAR_10); VAR_12 = -EINVAL; goto out; } memset(iscsilun, 0, sizeof(IscsiLun)); VAR_9 = parse_initiator_name(VAR_5->target); VAR_4 = iscsi_create_context(VAR_9); if (VAR_4 == NULL) { error_setg(VAR_3, "iSCSI: Failed to create iSCSI context."); VAR_12 = -ENOMEM; goto out; } if (iscsi_set_targetname(VAR_4, VAR_5->target)) { error_setg(VAR_3, "iSCSI: Failed to set target name."); VAR_12 = -EINVAL; goto out; } if (VAR_5->user != NULL) { VAR_12 = iscsi_set_initiator_username_pwd(VAR_4, VAR_5->user, VAR_5->passwd); if (VAR_12 != 0) { error_setg(VAR_3, "Failed to set initiator username and password"); VAR_12 = -EINVAL; goto out; } } parse_chap(VAR_4, VAR_5->target, &local_err); if (local_err != NULL) { error_propagate(VAR_3, local_err); VAR_12 = -EINVAL; goto out; } if (iscsi_set_session_type(VAR_4, ISCSI_SESSION_NORMAL) != 0) { error_setg(VAR_3, "iSCSI: Failed to set session type to normal."); VAR_12 = -EINVAL; goto out; } iscsi_set_header_digest(VAR_4, ISCSI_HEADER_DIGEST_NONE_CRC32C); parse_header_digest(VAR_4, VAR_5->target, &local_err); if (local_err != NULL) { error_propagate(VAR_3, local_err); VAR_12 = -EINVAL; goto out; } if (iscsi_full_connect_sync(VAR_4, VAR_5->portal, VAR_5->lun) != 0) { error_setg(VAR_3, "iSCSI: Failed to connect to LUN : %s", iscsi_get_error(VAR_4)); VAR_12 = -EINVAL; goto out; } iscsilun->VAR_4 = VAR_4; iscsilun->aio_context = bdrv_get_aio_context(VAR_0); iscsilun->lun = VAR_5->lun; iscsilun->has_write_same = true; VAR_6 = iscsi_do_inquiry(iscsilun->VAR_4, iscsilun->lun, 0, 0, (void **) &VAR_7, VAR_3); if (VAR_6 == NULL) { VAR_12 = -EINVAL; goto out; } iscsilun->type = VAR_7->periperal_device_type; scsi_free_scsi_task(VAR_6); VAR_6 = NULL; if (iscsilun->type == TYPE_DISK && (VAR_2 & BDRV_O_RDWR) && iscsi_is_write_protected(iscsilun)) { error_setg(VAR_3, "Cannot open a write protected LUN as read-write"); VAR_12 = -EACCES; goto out; } iscsi_readcapacity_sync(iscsilun, &local_err); if (local_err != NULL) { error_propagate(VAR_3, local_err); VAR_12 = -EINVAL; goto out; } VAR_0->total_sectors = sector_lun2qemu(iscsilun->num_blocks, iscsilun); VAR_0->request_alignment = iscsilun->block_size; if (iscsilun->type != TYPE_DISK && iscsilun->type != TYPE_ROM) { VAR_0->sg = 1; } VAR_6 = iscsi_do_inquiry(iscsilun->VAR_4, iscsilun->lun, 1, SCSI_INQUIRY_PAGECODE_SUPPORTED_VPD_PAGES, (void **) &VAR_8, VAR_3); if (VAR_6 == NULL) { VAR_12 = -EINVAL; goto out; } for (VAR_11 = 0; VAR_11 < VAR_8->num_pages; VAR_11++) { struct scsi_task *VAR_13; struct scsi_inquiry_logical_block_provisioning *VAR_14; struct scsi_inquiry_block_limits *VAR_15; switch (VAR_8->pages[VAR_11]) { case SCSI_INQUIRY_PAGECODE_LOGICAL_BLOCK_PROVISIONING: VAR_13 = iscsi_do_inquiry(iscsilun->VAR_4, iscsilun->lun, 1, SCSI_INQUIRY_PAGECODE_LOGICAL_BLOCK_PROVISIONING, (void **) &VAR_14, VAR_3); if (VAR_13 == NULL) { VAR_12 = -EINVAL; goto out; } memcpy(&iscsilun->lbp, VAR_14, sizeof(struct scsi_inquiry_logical_block_provisioning)); scsi_free_scsi_task(VAR_13); break; case SCSI_INQUIRY_PAGECODE_BLOCK_LIMITS: VAR_13 = iscsi_do_inquiry(iscsilun->VAR_4, iscsilun->lun, 1, SCSI_INQUIRY_PAGECODE_BLOCK_LIMITS, (void **) &VAR_15, VAR_3); if (VAR_13 == NULL) { VAR_12 = -EINVAL; goto out; } memcpy(&iscsilun->bl, VAR_15, sizeof(struct scsi_inquiry_block_limits)); scsi_free_scsi_task(VAR_13); break; default: break; } } scsi_free_scsi_task(VAR_6); VAR_6 = NULL; iscsi_attach_aio_context(VAR_0, iscsilun->aio_context); if (iscsilun->bl.opt_unmap_gran * iscsilun->block_size >= 4 * 1024 && iscsilun->bl.opt_unmap_gran * iscsilun->block_size <= 16 * 1024 * 1024) { iscsilun->cluster_sectors = (iscsilun->bl.opt_unmap_gran * iscsilun->block_size) >> BDRV_SECTOR_BITS; if (iscsilun->lbprz && !(VAR_0->open_flags & BDRV_O_NOCACHE)) { iscsilun->allocationmap = iscsi_allocationmap_init(iscsilun); if (iscsilun->allocationmap == NULL) { VAR_12 = -ENOMEM; } } } out: qemu_opts_del(opts); g_free(VAR_9); if (VAR_5 != NULL) { iscsi_destroy_url(VAR_5); } if (VAR_6 != NULL) { scsi_free_scsi_task(VAR_6); } if (VAR_12) { if (VAR_4 != NULL) { iscsi_destroy_context(VAR_4); } memset(iscsilun, 0, sizeof(IscsiLun)); } return VAR_12; }
[ "static int FUNC_0(BlockDriverState *VAR_0, QDict *VAR_1, int VAR_2,\nError **VAR_3)\n{", "IscsiLun *iscsilun = VAR_0->opaque;", "struct iscsi_context *VAR_4 = NULL;", "struct VAR_5 *VAR_5 = NULL;", "struct scsi_task *VAR_6 = NULL;", "struct scsi_inquiry_standard *VAR_7 = NULL;", "struct scsi_inquiry_supported_pages *VAR_8;", "char *VAR_9 = NULL;", "QemuOpts *opts;", "Error *local_err = NULL;", "const char *VAR_10;", "int VAR_11, VAR_12 = 0;", "if ((BDRV_SECTOR_SIZE % 512) != 0) {", "error_setg(VAR_3, \"iSCSI: Invalid BDRV_SECTOR_SIZE. \"\n\"BDRV_SECTOR_SIZE(%lld) is not a multiple \"\n\"of 512\", BDRV_SECTOR_SIZE);", "return -EINVAL;", "}", "opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort);", "qemu_opts_absorb_qdict(opts, VAR_1, &local_err);", "if (local_err) {", "error_propagate(VAR_3, local_err);", "VAR_12 = -EINVAL;", "goto out;", "}", "VAR_10 = qemu_opt_get(opts, \"VAR_10\");", "VAR_5 = iscsi_parse_full_url(VAR_4, VAR_10);", "if (VAR_5 == NULL) {", "error_setg(VAR_3, \"Failed to parse URL : %s\", VAR_10);", "VAR_12 = -EINVAL;", "goto out;", "}", "memset(iscsilun, 0, sizeof(IscsiLun));", "VAR_9 = parse_initiator_name(VAR_5->target);", "VAR_4 = iscsi_create_context(VAR_9);", "if (VAR_4 == NULL) {", "error_setg(VAR_3, \"iSCSI: Failed to create iSCSI context.\");", "VAR_12 = -ENOMEM;", "goto out;", "}", "if (iscsi_set_targetname(VAR_4, VAR_5->target)) {", "error_setg(VAR_3, \"iSCSI: Failed to set target name.\");", "VAR_12 = -EINVAL;", "goto out;", "}", "if (VAR_5->user != NULL) {", "VAR_12 = iscsi_set_initiator_username_pwd(VAR_4, VAR_5->user,\nVAR_5->passwd);", "if (VAR_12 != 0) {", "error_setg(VAR_3, \"Failed to set initiator username and password\");", "VAR_12 = -EINVAL;", "goto out;", "}", "}", "parse_chap(VAR_4, VAR_5->target, &local_err);", "if (local_err != NULL) {", "error_propagate(VAR_3, local_err);", "VAR_12 = -EINVAL;", "goto out;", "}", "if (iscsi_set_session_type(VAR_4, ISCSI_SESSION_NORMAL) != 0) {", "error_setg(VAR_3, \"iSCSI: Failed to set session type to normal.\");", "VAR_12 = -EINVAL;", "goto out;", "}", "iscsi_set_header_digest(VAR_4, ISCSI_HEADER_DIGEST_NONE_CRC32C);", "parse_header_digest(VAR_4, VAR_5->target, &local_err);", "if (local_err != NULL) {", "error_propagate(VAR_3, local_err);", "VAR_12 = -EINVAL;", "goto out;", "}", "if (iscsi_full_connect_sync(VAR_4, VAR_5->portal, VAR_5->lun) != 0) {", "error_setg(VAR_3, \"iSCSI: Failed to connect to LUN : %s\",\niscsi_get_error(VAR_4));", "VAR_12 = -EINVAL;", "goto out;", "}", "iscsilun->VAR_4 = VAR_4;", "iscsilun->aio_context = bdrv_get_aio_context(VAR_0);", "iscsilun->lun = VAR_5->lun;", "iscsilun->has_write_same = true;", "VAR_6 = iscsi_do_inquiry(iscsilun->VAR_4, iscsilun->lun, 0, 0,\n(void **) &VAR_7, VAR_3);", "if (VAR_6 == NULL) {", "VAR_12 = -EINVAL;", "goto out;", "}", "iscsilun->type = VAR_7->periperal_device_type;", "scsi_free_scsi_task(VAR_6);", "VAR_6 = NULL;", "if (iscsilun->type == TYPE_DISK && (VAR_2 & BDRV_O_RDWR) &&\niscsi_is_write_protected(iscsilun)) {", "error_setg(VAR_3, \"Cannot open a write protected LUN as read-write\");", "VAR_12 = -EACCES;", "goto out;", "}", "iscsi_readcapacity_sync(iscsilun, &local_err);", "if (local_err != NULL) {", "error_propagate(VAR_3, local_err);", "VAR_12 = -EINVAL;", "goto out;", "}", "VAR_0->total_sectors = sector_lun2qemu(iscsilun->num_blocks, iscsilun);", "VAR_0->request_alignment = iscsilun->block_size;", "if (iscsilun->type != TYPE_DISK && iscsilun->type != TYPE_ROM) {", "VAR_0->sg = 1;", "}", "VAR_6 = iscsi_do_inquiry(iscsilun->VAR_4, iscsilun->lun, 1,\nSCSI_INQUIRY_PAGECODE_SUPPORTED_VPD_PAGES,\n(void **) &VAR_8, VAR_3);", "if (VAR_6 == NULL) {", "VAR_12 = -EINVAL;", "goto out;", "}", "for (VAR_11 = 0; VAR_11 < VAR_8->num_pages; VAR_11++) {", "struct scsi_task *VAR_13;", "struct scsi_inquiry_logical_block_provisioning *VAR_14;", "struct scsi_inquiry_block_limits *VAR_15;", "switch (VAR_8->pages[VAR_11]) {", "case SCSI_INQUIRY_PAGECODE_LOGICAL_BLOCK_PROVISIONING:\nVAR_13 = iscsi_do_inquiry(iscsilun->VAR_4, iscsilun->lun, 1,\nSCSI_INQUIRY_PAGECODE_LOGICAL_BLOCK_PROVISIONING,\n(void **) &VAR_14, VAR_3);", "if (VAR_13 == NULL) {", "VAR_12 = -EINVAL;", "goto out;", "}", "memcpy(&iscsilun->lbp, VAR_14,\nsizeof(struct scsi_inquiry_logical_block_provisioning));", "scsi_free_scsi_task(VAR_13);", "break;", "case SCSI_INQUIRY_PAGECODE_BLOCK_LIMITS:\nVAR_13 = iscsi_do_inquiry(iscsilun->VAR_4, iscsilun->lun, 1,\nSCSI_INQUIRY_PAGECODE_BLOCK_LIMITS,\n(void **) &VAR_15, VAR_3);", "if (VAR_13 == NULL) {", "VAR_12 = -EINVAL;", "goto out;", "}", "memcpy(&iscsilun->bl, VAR_15,\nsizeof(struct scsi_inquiry_block_limits));", "scsi_free_scsi_task(VAR_13);", "break;", "default:\nbreak;", "}", "}", "scsi_free_scsi_task(VAR_6);", "VAR_6 = NULL;", "iscsi_attach_aio_context(VAR_0, iscsilun->aio_context);", "if (iscsilun->bl.opt_unmap_gran * iscsilun->block_size >= 4 * 1024 &&\niscsilun->bl.opt_unmap_gran * iscsilun->block_size <= 16 * 1024 * 1024) {", "iscsilun->cluster_sectors = (iscsilun->bl.opt_unmap_gran *\niscsilun->block_size) >> BDRV_SECTOR_BITS;", "if (iscsilun->lbprz && !(VAR_0->open_flags & BDRV_O_NOCACHE)) {", "iscsilun->allocationmap = iscsi_allocationmap_init(iscsilun);", "if (iscsilun->allocationmap == NULL) {", "VAR_12 = -ENOMEM;", "}", "}", "}", "out:\nqemu_opts_del(opts);", "g_free(VAR_9);", "if (VAR_5 != NULL) {", "iscsi_destroy_url(VAR_5);", "}", "if (VAR_6 != NULL) {", "scsi_free_scsi_task(VAR_6);", "}", "if (VAR_12) {", "if (VAR_4 != NULL) {", "iscsi_destroy_context(VAR_4);", "}", "memset(iscsilun, 0, sizeof(IscsiLun));", "}", "return VAR_12;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33, 35, 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 83 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 113 ], [ 115, 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 161 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 181 ], [ 183, 185 ], [ 187 ], [ 189 ], [ 191 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 205, 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 227, 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ], [ 267 ], [ 269 ], [ 271 ], [ 275, 277, 279 ], [ 281 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ], [ 291 ], [ 293 ], [ 295 ], [ 297 ], [ 299, 301, 303, 305 ], [ 307 ], [ 309 ], [ 311 ], [ 313 ], [ 315, 317 ], [ 319 ], [ 321 ], [ 323, 325, 327, 329 ], [ 331 ], [ 333 ], [ 335 ], [ 337 ], [ 339, 341 ], [ 343 ], [ 345 ], [ 347, 349 ], [ 351 ], [ 353 ], [ 355 ], [ 357 ], [ 361 ], [ 371, 373 ], [ 375, 377 ], [ 379 ], [ 381 ], [ 383 ], [ 385 ], [ 387 ], [ 389 ], [ 391 ], [ 395, 397 ], [ 399 ], [ 401 ], [ 403 ], [ 405 ], [ 407 ], [ 409 ], [ 411 ], [ 415 ], [ 417 ], [ 419 ], [ 421 ], [ 423 ], [ 425 ], [ 427 ], [ 429 ] ]
4,616
static void string_output_append_range(StringOutputVisitor *sov, int64_t s, int64_t e) { Range *r = g_malloc0(sizeof(*r)); r->begin = s; r->end = e + 1; sov->ranges = range_list_insert(sov->ranges, r); }
false
qemu
a0efbf16604770b9d805bcf210ec29942321134f
static void string_output_append_range(StringOutputVisitor *sov, int64_t s, int64_t e) { Range *r = g_malloc0(sizeof(*r)); r->begin = s; r->end = e + 1; sov->ranges = range_list_insert(sov->ranges, r); }
{ "code": [], "line_no": [] }
static void FUNC_0(StringOutputVisitor *VAR_0, int64_t VAR_1, int64_t VAR_2) { Range *r = g_malloc0(sizeof(*r)); r->begin = VAR_1; r->end = VAR_2 + 1; VAR_0->ranges = range_list_insert(VAR_0->ranges, r); }
[ "static void FUNC_0(StringOutputVisitor *VAR_0,\nint64_t VAR_1, int64_t VAR_2)\n{", "Range *r = g_malloc0(sizeof(*r));", "r->begin = VAR_1;", "r->end = VAR_2 + 1;", "VAR_0->ranges = range_list_insert(VAR_0->ranges, r);", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ] ]
4,617
static int coroutine_fn iscsi_co_readv(BlockDriverState *bs, int64_t sector_num, int nb_sectors, QEMUIOVector *iov) { IscsiLun *iscsilun = bs->opaque; struct IscsiTask iTask; uint64_t lba; uint32_t num_sectors; if (!is_sector_request_lun_aligned(sector_num, nb_sectors, iscsilun)) { return -EINVAL; } if (bs->bl.max_transfer && nb_sectors << BDRV_SECTOR_BITS > bs->bl.max_transfer) { error_report("iSCSI Error: Read of %d sectors exceeds max_xfer_len " "of %" PRIu32 " bytes", nb_sectors, bs->bl.max_transfer); return -EINVAL; } if (iscsilun->lbprz && nb_sectors >= ISCSI_CHECKALLOC_THRES && !iscsi_allocationmap_is_allocated(iscsilun, sector_num, nb_sectors)) { int64_t ret; int pnum; BlockDriverState *file; ret = iscsi_co_get_block_status(bs, sector_num, BDRV_REQUEST_MAX_SECTORS, &pnum, &file); if (ret < 0) { return ret; } if (ret & BDRV_BLOCK_ZERO && pnum >= nb_sectors) { qemu_iovec_memset(iov, 0, 0x00, iov->size); return 0; } } lba = sector_qemu2lun(sector_num, iscsilun); num_sectors = sector_qemu2lun(nb_sectors, iscsilun); iscsi_co_init_iscsitask(iscsilun, &iTask); retry: if (iscsilun->use_16_for_rw) { iTask.task = iscsi_read16_task(iscsilun->iscsi, iscsilun->lun, lba, num_sectors * iscsilun->block_size, iscsilun->block_size, 0, 0, 0, 0, 0, iscsi_co_generic_cb, &iTask); } else { iTask.task = iscsi_read10_task(iscsilun->iscsi, iscsilun->lun, lba, num_sectors * iscsilun->block_size, iscsilun->block_size, 0, 0, 0, 0, 0, iscsi_co_generic_cb, &iTask); } if (iTask.task == NULL) { return -ENOMEM; } scsi_task_set_iov_in(iTask.task, (struct scsi_iovec *) iov->iov, iov->niov); while (!iTask.complete) { iscsi_set_events(iscsilun); qemu_coroutine_yield(); } if (iTask.task != NULL) { scsi_free_scsi_task(iTask.task); iTask.task = NULL; } if (iTask.do_retry) { iTask.complete = 0; goto retry; } if (iTask.status != SCSI_STATUS_GOOD) { return iTask.err_code; } return 0; }
false
qemu
e1123a3b40a1a9a625a29c8ed4debb7e206ea690
static int coroutine_fn iscsi_co_readv(BlockDriverState *bs, int64_t sector_num, int nb_sectors, QEMUIOVector *iov) { IscsiLun *iscsilun = bs->opaque; struct IscsiTask iTask; uint64_t lba; uint32_t num_sectors; if (!is_sector_request_lun_aligned(sector_num, nb_sectors, iscsilun)) { return -EINVAL; } if (bs->bl.max_transfer && nb_sectors << BDRV_SECTOR_BITS > bs->bl.max_transfer) { error_report("iSCSI Error: Read of %d sectors exceeds max_xfer_len " "of %" PRIu32 " bytes", nb_sectors, bs->bl.max_transfer); return -EINVAL; } if (iscsilun->lbprz && nb_sectors >= ISCSI_CHECKALLOC_THRES && !iscsi_allocationmap_is_allocated(iscsilun, sector_num, nb_sectors)) { int64_t ret; int pnum; BlockDriverState *file; ret = iscsi_co_get_block_status(bs, sector_num, BDRV_REQUEST_MAX_SECTORS, &pnum, &file); if (ret < 0) { return ret; } if (ret & BDRV_BLOCK_ZERO && pnum >= nb_sectors) { qemu_iovec_memset(iov, 0, 0x00, iov->size); return 0; } } lba = sector_qemu2lun(sector_num, iscsilun); num_sectors = sector_qemu2lun(nb_sectors, iscsilun); iscsi_co_init_iscsitask(iscsilun, &iTask); retry: if (iscsilun->use_16_for_rw) { iTask.task = iscsi_read16_task(iscsilun->iscsi, iscsilun->lun, lba, num_sectors * iscsilun->block_size, iscsilun->block_size, 0, 0, 0, 0, 0, iscsi_co_generic_cb, &iTask); } else { iTask.task = iscsi_read10_task(iscsilun->iscsi, iscsilun->lun, lba, num_sectors * iscsilun->block_size, iscsilun->block_size, 0, 0, 0, 0, 0, iscsi_co_generic_cb, &iTask); } if (iTask.task == NULL) { return -ENOMEM; } scsi_task_set_iov_in(iTask.task, (struct scsi_iovec *) iov->iov, iov->niov); while (!iTask.complete) { iscsi_set_events(iscsilun); qemu_coroutine_yield(); } if (iTask.task != NULL) { scsi_free_scsi_task(iTask.task); iTask.task = NULL; } if (iTask.do_retry) { iTask.complete = 0; goto retry; } if (iTask.status != SCSI_STATUS_GOOD) { return iTask.err_code; } return 0; }
{ "code": [], "line_no": [] }
static int VAR_0 iscsi_co_readv(BlockDriverState *bs, int64_t sector_num, int nb_sectors, QEMUIOVector *iov) { IscsiLun *iscsilun = bs->opaque; struct IscsiTask iTask; uint64_t lba; uint32_t num_sectors; if (!is_sector_request_lun_aligned(sector_num, nb_sectors, iscsilun)) { return -EINVAL; } if (bs->bl.max_transfer && nb_sectors << BDRV_SECTOR_BITS > bs->bl.max_transfer) { error_report("iSCSI Error: Read of %d sectors exceeds max_xfer_len " "of %" PRIu32 " bytes", nb_sectors, bs->bl.max_transfer); return -EINVAL; } if (iscsilun->lbprz && nb_sectors >= ISCSI_CHECKALLOC_THRES && !iscsi_allocationmap_is_allocated(iscsilun, sector_num, nb_sectors)) { int64_t ret; int pnum; BlockDriverState *file; ret = iscsi_co_get_block_status(bs, sector_num, BDRV_REQUEST_MAX_SECTORS, &pnum, &file); if (ret < 0) { return ret; } if (ret & BDRV_BLOCK_ZERO && pnum >= nb_sectors) { qemu_iovec_memset(iov, 0, 0x00, iov->size); return 0; } } lba = sector_qemu2lun(sector_num, iscsilun); num_sectors = sector_qemu2lun(nb_sectors, iscsilun); iscsi_co_init_iscsitask(iscsilun, &iTask); retry: if (iscsilun->use_16_for_rw) { iTask.task = iscsi_read16_task(iscsilun->iscsi, iscsilun->lun, lba, num_sectors * iscsilun->block_size, iscsilun->block_size, 0, 0, 0, 0, 0, iscsi_co_generic_cb, &iTask); } else { iTask.task = iscsi_read10_task(iscsilun->iscsi, iscsilun->lun, lba, num_sectors * iscsilun->block_size, iscsilun->block_size, 0, 0, 0, 0, 0, iscsi_co_generic_cb, &iTask); } if (iTask.task == NULL) { return -ENOMEM; } scsi_task_set_iov_in(iTask.task, (struct scsi_iovec *) iov->iov, iov->niov); while (!iTask.complete) { iscsi_set_events(iscsilun); qemu_coroutine_yield(); } if (iTask.task != NULL) { scsi_free_scsi_task(iTask.task); iTask.task = NULL; } if (iTask.do_retry) { iTask.complete = 0; goto retry; } if (iTask.status != SCSI_STATUS_GOOD) { return iTask.err_code; } return 0; }
[ "static int VAR_0 iscsi_co_readv(BlockDriverState *bs,\nint64_t sector_num, int nb_sectors,\nQEMUIOVector *iov)\n{", "IscsiLun *iscsilun = bs->opaque;", "struct IscsiTask iTask;", "uint64_t lba;", "uint32_t num_sectors;", "if (!is_sector_request_lun_aligned(sector_num, nb_sectors, iscsilun)) {", "return -EINVAL;", "}", "if (bs->bl.max_transfer &&\nnb_sectors << BDRV_SECTOR_BITS > bs->bl.max_transfer) {", "error_report(\"iSCSI Error: Read of %d sectors exceeds max_xfer_len \"\n\"of %\" PRIu32 \" bytes\", nb_sectors, bs->bl.max_transfer);", "return -EINVAL;", "}", "if (iscsilun->lbprz && nb_sectors >= ISCSI_CHECKALLOC_THRES &&\n!iscsi_allocationmap_is_allocated(iscsilun, sector_num, nb_sectors)) {", "int64_t ret;", "int pnum;", "BlockDriverState *file;", "ret = iscsi_co_get_block_status(bs, sector_num,\nBDRV_REQUEST_MAX_SECTORS, &pnum, &file);", "if (ret < 0) {", "return ret;", "}", "if (ret & BDRV_BLOCK_ZERO && pnum >= nb_sectors) {", "qemu_iovec_memset(iov, 0, 0x00, iov->size);", "return 0;", "}", "}", "lba = sector_qemu2lun(sector_num, iscsilun);", "num_sectors = sector_qemu2lun(nb_sectors, iscsilun);", "iscsi_co_init_iscsitask(iscsilun, &iTask);", "retry:\nif (iscsilun->use_16_for_rw) {", "iTask.task = iscsi_read16_task(iscsilun->iscsi, iscsilun->lun, lba,\nnum_sectors * iscsilun->block_size,\niscsilun->block_size, 0, 0, 0, 0, 0,\niscsi_co_generic_cb, &iTask);", "} else {", "iTask.task = iscsi_read10_task(iscsilun->iscsi, iscsilun->lun, lba,\nnum_sectors * iscsilun->block_size,\niscsilun->block_size,\n0, 0, 0, 0, 0,\niscsi_co_generic_cb, &iTask);", "}", "if (iTask.task == NULL) {", "return -ENOMEM;", "}", "scsi_task_set_iov_in(iTask.task, (struct scsi_iovec *) iov->iov, iov->niov);", "while (!iTask.complete) {", "iscsi_set_events(iscsilun);", "qemu_coroutine_yield();", "}", "if (iTask.task != NULL) {", "scsi_free_scsi_task(iTask.task);", "iTask.task = NULL;", "}", "if (iTask.do_retry) {", "iTask.complete = 0;", "goto retry;", "}", "if (iTask.status != SCSI_STATUS_GOOD) {", "return iTask.err_code;", "}", "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 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 27, 29 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 41, 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51, 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 73 ], [ 75 ], [ 79 ], [ 81, 83 ], [ 85, 87, 89, 91 ], [ 93 ], [ 95, 97, 99, 101, 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 147 ], [ 149 ], [ 151 ], [ 155 ], [ 157 ] ]
4,618
static DeviceClass *qdev_get_device_class(const char **driver, Error **errp) { ObjectClass *oc; DeviceClass *dc; oc = object_class_by_name(*driver); if (!oc) { const char *typename = find_typename_by_alias(*driver); if (typename) { *driver = typename; oc = object_class_by_name(*driver); } } if (!object_class_dynamic_cast(oc, TYPE_DEVICE)) { error_setg(errp, "'%s' is not a valid device model name", *driver); return NULL; } if (object_class_is_abstract(oc)) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "driver", "non-abstract device type"); return NULL; } dc = DEVICE_CLASS(oc); if (dc->cannot_instantiate_with_device_add_yet || (qdev_hotplug && !dc->hotpluggable)) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "driver", "pluggable device type"); return NULL; } return dc; }
false
qemu
f6b5319d412cda360695e2005737f91ca8201af0
static DeviceClass *qdev_get_device_class(const char **driver, Error **errp) { ObjectClass *oc; DeviceClass *dc; oc = object_class_by_name(*driver); if (!oc) { const char *typename = find_typename_by_alias(*driver); if (typename) { *driver = typename; oc = object_class_by_name(*driver); } } if (!object_class_dynamic_cast(oc, TYPE_DEVICE)) { error_setg(errp, "'%s' is not a valid device model name", *driver); return NULL; } if (object_class_is_abstract(oc)) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "driver", "non-abstract device type"); return NULL; } dc = DEVICE_CLASS(oc); if (dc->cannot_instantiate_with_device_add_yet || (qdev_hotplug && !dc->hotpluggable)) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "driver", "pluggable device type"); return NULL; } return dc; }
{ "code": [], "line_no": [] }
static DeviceClass *FUNC_0(const char **driver, Error **errp) { ObjectClass *oc; DeviceClass *dc; oc = object_class_by_name(*driver); if (!oc) { const char *VAR_0 = find_typename_by_alias(*driver); if (VAR_0) { *driver = VAR_0; oc = object_class_by_name(*driver); } } if (!object_class_dynamic_cast(oc, TYPE_DEVICE)) { error_setg(errp, "'%s' is not a valid device model name", *driver); return NULL; } if (object_class_is_abstract(oc)) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "driver", "non-abstract device type"); return NULL; } dc = DEVICE_CLASS(oc); if (dc->cannot_instantiate_with_device_add_yet || (qdev_hotplug && !dc->hotpluggable)) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "driver", "pluggable device type"); return NULL; } return dc; }
[ "static DeviceClass *FUNC_0(const char **driver, Error **errp)\n{", "ObjectClass *oc;", "DeviceClass *dc;", "oc = object_class_by_name(*driver);", "if (!oc) {", "const char *VAR_0 = find_typename_by_alias(*driver);", "if (VAR_0) {", "*driver = VAR_0;", "oc = object_class_by_name(*driver);", "}", "}", "if (!object_class_dynamic_cast(oc, TYPE_DEVICE)) {", "error_setg(errp, \"'%s' is not a valid device model name\", *driver);", "return NULL;", "}", "if (object_class_is_abstract(oc)) {", "error_setg(errp, QERR_INVALID_PARAMETER_VALUE, \"driver\",\n\"non-abstract device type\");", "return NULL;", "}", "dc = DEVICE_CLASS(oc);", "if (dc->cannot_instantiate_with_device_add_yet ||\n(qdev_hotplug && !dc->hotpluggable)) {", "error_setg(errp, QERR_INVALID_PARAMETER_VALUE, \"driver\",\n\"pluggable device type\");", "return NULL;", "}", "return dc;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55, 57 ], [ 59, 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ] ]
4,619
static int usb_net_handle_control(USBDevice *dev, int request, int value, int index, int length, uint8_t *data) { USBNetState *s = (USBNetState *) dev; int ret = 0; switch(request) { case DeviceRequest | USB_REQ_GET_STATUS: data[0] = (1 << USB_DEVICE_SELF_POWERED) | (dev->remote_wakeup << USB_DEVICE_REMOTE_WAKEUP); data[1] = 0x00; ret = 2; break; case DeviceOutRequest | USB_REQ_CLEAR_FEATURE: if (value == USB_DEVICE_REMOTE_WAKEUP) { dev->remote_wakeup = 0; } else { goto fail; } ret = 0; break; case DeviceOutRequest | USB_REQ_SET_FEATURE: if (value == USB_DEVICE_REMOTE_WAKEUP) { dev->remote_wakeup = 1; } else { goto fail; } ret = 0; break; case DeviceOutRequest | USB_REQ_SET_ADDRESS: dev->addr = value; ret = 0; break; case ClassInterfaceOutRequest | USB_CDC_SEND_ENCAPSULATED_COMMAND: if (!s->rndis || value || index != 0) goto fail; #ifdef TRAFFIC_DEBUG { unsigned int i; fprintf(stderr, "SEND_ENCAPSULATED_COMMAND:"); for (i = 0; i < length; i++) { if (!(i & 15)) fprintf(stderr, "\n%04x:", i); fprintf(stderr, " %02x", data[i]); } fprintf(stderr, "\n\n"); } #endif ret = rndis_parse(s, data, length); break; case ClassInterfaceRequest | USB_CDC_GET_ENCAPSULATED_RESPONSE: if (!s->rndis || value || index != 0) goto fail; ret = rndis_get_response(s, data); if (!ret) { data[0] = 0; ret = 1; } #ifdef TRAFFIC_DEBUG { unsigned int i; fprintf(stderr, "GET_ENCAPSULATED_RESPONSE:"); for (i = 0; i < ret; i++) { if (!(i & 15)) fprintf(stderr, "\n%04x:", i); fprintf(stderr, " %02x", data[i]); } fprintf(stderr, "\n\n"); } #endif break; case DeviceRequest | USB_REQ_GET_DESCRIPTOR: switch(value >> 8) { case USB_DT_DEVICE: ret = sizeof(qemu_net_dev_descriptor); memcpy(data, qemu_net_dev_descriptor, ret); break; case USB_DT_CONFIG: switch (value & 0xff) { case 0: ret = sizeof(qemu_net_rndis_config_descriptor); memcpy(data, qemu_net_rndis_config_descriptor, ret); break; case 1: ret = sizeof(qemu_net_cdc_config_descriptor); memcpy(data, qemu_net_cdc_config_descriptor, ret); break; default: goto fail; } data[2] = ret & 0xff; data[3] = ret >> 8; break; case USB_DT_STRING: switch (value & 0xff) { case 0: /* language ids */ data[0] = 4; data[1] = 3; data[2] = 0x09; data[3] = 0x04; ret = 4; break; case STRING_ETHADDR: ret = set_usb_string(data, s->usbstring_mac); break; default: if (usb_net_stringtable[value & 0xff]) { ret = set_usb_string(data, usb_net_stringtable[value & 0xff]); break; } goto fail; } break; default: goto fail; } break; case DeviceRequest | USB_REQ_GET_CONFIGURATION: data[0] = s->rndis ? DEV_RNDIS_CONFIG_VALUE : DEV_CONFIG_VALUE; ret = 1; break; case DeviceOutRequest | USB_REQ_SET_CONFIGURATION: switch (value & 0xff) { case DEV_CONFIG_VALUE: s->rndis = 0; break; case DEV_RNDIS_CONFIG_VALUE: s->rndis = 1; break; default: goto fail; } ret = 0; break; case DeviceRequest | USB_REQ_GET_INTERFACE: case InterfaceRequest | USB_REQ_GET_INTERFACE: data[0] = 0; ret = 1; break; case DeviceOutRequest | USB_REQ_SET_INTERFACE: case InterfaceOutRequest | USB_REQ_SET_INTERFACE: ret = 0; break; default: fail: fprintf(stderr, "usbnet: failed control transaction: " "request 0x%x value 0x%x index 0x%x length 0x%x\n", request, value, index, length); ret = USB_RET_STALL; break; } return ret; }
false
qemu
d59f8ba938afd837182e666cce777dfb860559e4
static int usb_net_handle_control(USBDevice *dev, int request, int value, int index, int length, uint8_t *data) { USBNetState *s = (USBNetState *) dev; int ret = 0; switch(request) { case DeviceRequest | USB_REQ_GET_STATUS: data[0] = (1 << USB_DEVICE_SELF_POWERED) | (dev->remote_wakeup << USB_DEVICE_REMOTE_WAKEUP); data[1] = 0x00; ret = 2; break; case DeviceOutRequest | USB_REQ_CLEAR_FEATURE: if (value == USB_DEVICE_REMOTE_WAKEUP) { dev->remote_wakeup = 0; } else { goto fail; } ret = 0; break; case DeviceOutRequest | USB_REQ_SET_FEATURE: if (value == USB_DEVICE_REMOTE_WAKEUP) { dev->remote_wakeup = 1; } else { goto fail; } ret = 0; break; case DeviceOutRequest | USB_REQ_SET_ADDRESS: dev->addr = value; ret = 0; break; case ClassInterfaceOutRequest | USB_CDC_SEND_ENCAPSULATED_COMMAND: if (!s->rndis || value || index != 0) goto fail; #ifdef TRAFFIC_DEBUG { unsigned int i; fprintf(stderr, "SEND_ENCAPSULATED_COMMAND:"); for (i = 0; i < length; i++) { if (!(i & 15)) fprintf(stderr, "\n%04x:", i); fprintf(stderr, " %02x", data[i]); } fprintf(stderr, "\n\n"); } #endif ret = rndis_parse(s, data, length); break; case ClassInterfaceRequest | USB_CDC_GET_ENCAPSULATED_RESPONSE: if (!s->rndis || value || index != 0) goto fail; ret = rndis_get_response(s, data); if (!ret) { data[0] = 0; ret = 1; } #ifdef TRAFFIC_DEBUG { unsigned int i; fprintf(stderr, "GET_ENCAPSULATED_RESPONSE:"); for (i = 0; i < ret; i++) { if (!(i & 15)) fprintf(stderr, "\n%04x:", i); fprintf(stderr, " %02x", data[i]); } fprintf(stderr, "\n\n"); } #endif break; case DeviceRequest | USB_REQ_GET_DESCRIPTOR: switch(value >> 8) { case USB_DT_DEVICE: ret = sizeof(qemu_net_dev_descriptor); memcpy(data, qemu_net_dev_descriptor, ret); break; case USB_DT_CONFIG: switch (value & 0xff) { case 0: ret = sizeof(qemu_net_rndis_config_descriptor); memcpy(data, qemu_net_rndis_config_descriptor, ret); break; case 1: ret = sizeof(qemu_net_cdc_config_descriptor); memcpy(data, qemu_net_cdc_config_descriptor, ret); break; default: goto fail; } data[2] = ret & 0xff; data[3] = ret >> 8; break; case USB_DT_STRING: switch (value & 0xff) { case 0: data[0] = 4; data[1] = 3; data[2] = 0x09; data[3] = 0x04; ret = 4; break; case STRING_ETHADDR: ret = set_usb_string(data, s->usbstring_mac); break; default: if (usb_net_stringtable[value & 0xff]) { ret = set_usb_string(data, usb_net_stringtable[value & 0xff]); break; } goto fail; } break; default: goto fail; } break; case DeviceRequest | USB_REQ_GET_CONFIGURATION: data[0] = s->rndis ? DEV_RNDIS_CONFIG_VALUE : DEV_CONFIG_VALUE; ret = 1; break; case DeviceOutRequest | USB_REQ_SET_CONFIGURATION: switch (value & 0xff) { case DEV_CONFIG_VALUE: s->rndis = 0; break; case DEV_RNDIS_CONFIG_VALUE: s->rndis = 1; break; default: goto fail; } ret = 0; break; case DeviceRequest | USB_REQ_GET_INTERFACE: case InterfaceRequest | USB_REQ_GET_INTERFACE: data[0] = 0; ret = 1; break; case DeviceOutRequest | USB_REQ_SET_INTERFACE: case InterfaceOutRequest | USB_REQ_SET_INTERFACE: ret = 0; break; default: fail: fprintf(stderr, "usbnet: failed control transaction: " "request 0x%x value 0x%x index 0x%x length 0x%x\n", request, value, index, length); ret = USB_RET_STALL; break; } return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(USBDevice *VAR_0, int VAR_1, int VAR_2, int VAR_3, int VAR_4, uint8_t *VAR_5) { USBNetState *s = (USBNetState *) VAR_0; int VAR_6 = 0; switch(VAR_1) { case DeviceRequest | USB_REQ_GET_STATUS: VAR_5[0] = (1 << USB_DEVICE_SELF_POWERED) | (VAR_0->remote_wakeup << USB_DEVICE_REMOTE_WAKEUP); VAR_5[1] = 0x00; VAR_6 = 2; break; case DeviceOutRequest | USB_REQ_CLEAR_FEATURE: if (VAR_2 == USB_DEVICE_REMOTE_WAKEUP) { VAR_0->remote_wakeup = 0; } else { goto fail; } VAR_6 = 0; break; case DeviceOutRequest | USB_REQ_SET_FEATURE: if (VAR_2 == USB_DEVICE_REMOTE_WAKEUP) { VAR_0->remote_wakeup = 1; } else { goto fail; } VAR_6 = 0; break; case DeviceOutRequest | USB_REQ_SET_ADDRESS: VAR_0->addr = VAR_2; VAR_6 = 0; break; case ClassInterfaceOutRequest | USB_CDC_SEND_ENCAPSULATED_COMMAND: if (!s->rndis || VAR_2 || VAR_3 != 0) goto fail; #ifdef TRAFFIC_DEBUG { unsigned int i; fprintf(stderr, "SEND_ENCAPSULATED_COMMAND:"); for (i = 0; i < VAR_4; i++) { if (!(i & 15)) fprintf(stderr, "\n%04x:", i); fprintf(stderr, " %02x", VAR_5[i]); } fprintf(stderr, "\n\n"); } #endif VAR_6 = rndis_parse(s, VAR_5, VAR_4); break; case ClassInterfaceRequest | USB_CDC_GET_ENCAPSULATED_RESPONSE: if (!s->rndis || VAR_2 || VAR_3 != 0) goto fail; VAR_6 = rndis_get_response(s, VAR_5); if (!VAR_6) { VAR_5[0] = 0; VAR_6 = 1; } #ifdef TRAFFIC_DEBUG { unsigned int i; fprintf(stderr, "GET_ENCAPSULATED_RESPONSE:"); for (i = 0; i < VAR_6; i++) { if (!(i & 15)) fprintf(stderr, "\n%04x:", i); fprintf(stderr, " %02x", VAR_5[i]); } fprintf(stderr, "\n\n"); } #endif break; case DeviceRequest | USB_REQ_GET_DESCRIPTOR: switch(VAR_2 >> 8) { case USB_DT_DEVICE: VAR_6 = sizeof(qemu_net_dev_descriptor); memcpy(VAR_5, qemu_net_dev_descriptor, VAR_6); break; case USB_DT_CONFIG: switch (VAR_2 & 0xff) { case 0: VAR_6 = sizeof(qemu_net_rndis_config_descriptor); memcpy(VAR_5, qemu_net_rndis_config_descriptor, VAR_6); break; case 1: VAR_6 = sizeof(qemu_net_cdc_config_descriptor); memcpy(VAR_5, qemu_net_cdc_config_descriptor, VAR_6); break; default: goto fail; } VAR_5[2] = VAR_6 & 0xff; VAR_5[3] = VAR_6 >> 8; break; case USB_DT_STRING: switch (VAR_2 & 0xff) { case 0: VAR_5[0] = 4; VAR_5[1] = 3; VAR_5[2] = 0x09; VAR_5[3] = 0x04; VAR_6 = 4; break; case STRING_ETHADDR: VAR_6 = set_usb_string(VAR_5, s->usbstring_mac); break; default: if (usb_net_stringtable[VAR_2 & 0xff]) { VAR_6 = set_usb_string(VAR_5, usb_net_stringtable[VAR_2 & 0xff]); break; } goto fail; } break; default: goto fail; } break; case DeviceRequest | USB_REQ_GET_CONFIGURATION: VAR_5[0] = s->rndis ? DEV_RNDIS_CONFIG_VALUE : DEV_CONFIG_VALUE; VAR_6 = 1; break; case DeviceOutRequest | USB_REQ_SET_CONFIGURATION: switch (VAR_2 & 0xff) { case DEV_CONFIG_VALUE: s->rndis = 0; break; case DEV_RNDIS_CONFIG_VALUE: s->rndis = 1; break; default: goto fail; } VAR_6 = 0; break; case DeviceRequest | USB_REQ_GET_INTERFACE: case InterfaceRequest | USB_REQ_GET_INTERFACE: VAR_5[0] = 0; VAR_6 = 1; break; case DeviceOutRequest | USB_REQ_SET_INTERFACE: case InterfaceOutRequest | USB_REQ_SET_INTERFACE: VAR_6 = 0; break; default: fail: fprintf(stderr, "usbnet: failed control transaction: " "VAR_1 0x%x VAR_2 0x%x VAR_3 0x%x VAR_4 0x%x\n", VAR_1, VAR_2, VAR_3, VAR_4); VAR_6 = USB_RET_STALL; break; } return VAR_6; }
[ "static int FUNC_0(USBDevice *VAR_0, int VAR_1, int VAR_2,\nint VAR_3, int VAR_4, uint8_t *VAR_5)\n{", "USBNetState *s = (USBNetState *) VAR_0;", "int VAR_6 = 0;", "switch(VAR_1) {", "case DeviceRequest | USB_REQ_GET_STATUS:\nVAR_5[0] = (1 << USB_DEVICE_SELF_POWERED) |\n(VAR_0->remote_wakeup << USB_DEVICE_REMOTE_WAKEUP);", "VAR_5[1] = 0x00;", "VAR_6 = 2;", "break;", "case DeviceOutRequest | USB_REQ_CLEAR_FEATURE:\nif (VAR_2 == USB_DEVICE_REMOTE_WAKEUP) {", "VAR_0->remote_wakeup = 0;", "} else {", "goto fail;", "}", "VAR_6 = 0;", "break;", "case DeviceOutRequest | USB_REQ_SET_FEATURE:\nif (VAR_2 == USB_DEVICE_REMOTE_WAKEUP) {", "VAR_0->remote_wakeup = 1;", "} else {", "goto fail;", "}", "VAR_6 = 0;", "break;", "case DeviceOutRequest | USB_REQ_SET_ADDRESS:\nVAR_0->addr = VAR_2;", "VAR_6 = 0;", "break;", "case ClassInterfaceOutRequest | USB_CDC_SEND_ENCAPSULATED_COMMAND:\nif (!s->rndis || VAR_2 || VAR_3 != 0)\ngoto fail;", "#ifdef TRAFFIC_DEBUG\n{", "unsigned int i;", "fprintf(stderr, \"SEND_ENCAPSULATED_COMMAND:\");", "for (i = 0; i < VAR_4; i++) {", "if (!(i & 15))\nfprintf(stderr, \"\\n%04x:\", i);", "fprintf(stderr, \" %02x\", VAR_5[i]);", "}", "fprintf(stderr, \"\\n\\n\");", "}", "#endif\nVAR_6 = rndis_parse(s, VAR_5, VAR_4);", "break;", "case ClassInterfaceRequest | USB_CDC_GET_ENCAPSULATED_RESPONSE:\nif (!s->rndis || VAR_2 || VAR_3 != 0)\ngoto fail;", "VAR_6 = rndis_get_response(s, VAR_5);", "if (!VAR_6) {", "VAR_5[0] = 0;", "VAR_6 = 1;", "}", "#ifdef TRAFFIC_DEBUG\n{", "unsigned int i;", "fprintf(stderr, \"GET_ENCAPSULATED_RESPONSE:\");", "for (i = 0; i < VAR_6; i++) {", "if (!(i & 15))\nfprintf(stderr, \"\\n%04x:\", i);", "fprintf(stderr, \" %02x\", VAR_5[i]);", "}", "fprintf(stderr, \"\\n\\n\");", "}", "#endif\nbreak;", "case DeviceRequest | USB_REQ_GET_DESCRIPTOR:\nswitch(VAR_2 >> 8) {", "case USB_DT_DEVICE:\nVAR_6 = sizeof(qemu_net_dev_descriptor);", "memcpy(VAR_5, qemu_net_dev_descriptor, VAR_6);", "break;", "case USB_DT_CONFIG:\nswitch (VAR_2 & 0xff) {", "case 0:\nVAR_6 = sizeof(qemu_net_rndis_config_descriptor);", "memcpy(VAR_5, qemu_net_rndis_config_descriptor, VAR_6);", "break;", "case 1:\nVAR_6 = sizeof(qemu_net_cdc_config_descriptor);", "memcpy(VAR_5, qemu_net_cdc_config_descriptor, VAR_6);", "break;", "default:\ngoto fail;", "}", "VAR_5[2] = VAR_6 & 0xff;", "VAR_5[3] = VAR_6 >> 8;", "break;", "case USB_DT_STRING:\nswitch (VAR_2 & 0xff) {", "case 0:\nVAR_5[0] = 4;", "VAR_5[1] = 3;", "VAR_5[2] = 0x09;", "VAR_5[3] = 0x04;", "VAR_6 = 4;", "break;", "case STRING_ETHADDR:\nVAR_6 = set_usb_string(VAR_5, s->usbstring_mac);", "break;", "default:\nif (usb_net_stringtable[VAR_2 & 0xff]) {", "VAR_6 = set_usb_string(VAR_5,\nusb_net_stringtable[VAR_2 & 0xff]);", "break;", "}", "goto fail;", "}", "break;", "default:\ngoto fail;", "}", "break;", "case DeviceRequest | USB_REQ_GET_CONFIGURATION:\nVAR_5[0] = s->rndis ? DEV_RNDIS_CONFIG_VALUE : DEV_CONFIG_VALUE;", "VAR_6 = 1;", "break;", "case DeviceOutRequest | USB_REQ_SET_CONFIGURATION:\nswitch (VAR_2 & 0xff) {", "case DEV_CONFIG_VALUE:\ns->rndis = 0;", "break;", "case DEV_RNDIS_CONFIG_VALUE:\ns->rndis = 1;", "break;", "default:\ngoto fail;", "}", "VAR_6 = 0;", "break;", "case DeviceRequest | USB_REQ_GET_INTERFACE:\ncase InterfaceRequest | USB_REQ_GET_INTERFACE:\nVAR_5[0] = 0;", "VAR_6 = 1;", "break;", "case DeviceOutRequest | USB_REQ_SET_INTERFACE:\ncase InterfaceOutRequest | USB_REQ_SET_INTERFACE:\nVAR_6 = 0;", "break;", "default:\nfail:\nfprintf(stderr, \"usbnet: failed control transaction: \"\n\"VAR_1 0x%x VAR_2 0x%x VAR_3 0x%x VAR_4 0x%x\\n\",\nVAR_1, VAR_2, VAR_3, VAR_4);", "VAR_6 = USB_RET_STALL;", "break;", "}", "return VAR_6;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47, 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65, 67 ], [ 69 ], [ 71 ], [ 75, 77, 79 ], [ 81, 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91, 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103, 105 ], [ 107 ], [ 111, 113, 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127, 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137, 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149, 151 ], [ 155, 157 ], [ 159, 161 ], [ 163 ], [ 165 ], [ 169, 171 ], [ 173, 175 ], [ 177 ], [ 179 ], [ 183, 185 ], [ 187 ], [ 189 ], [ 193, 195 ], [ 197 ], [ 201 ], [ 203 ], [ 205 ], [ 209, 211 ], [ 213, 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 231, 233 ], [ 235 ], [ 239, 241 ], [ 243, 245 ], [ 247 ], [ 249 ], [ 253 ], [ 255 ], [ 257 ], [ 261, 263 ], [ 265 ], [ 267 ], [ 271, 273 ], [ 275 ], [ 277 ], [ 281, 283 ], [ 285, 287 ], [ 289 ], [ 293, 295 ], [ 297 ], [ 301, 303 ], [ 305 ], [ 307 ], [ 309 ], [ 313, 315, 317 ], [ 319 ], [ 321 ], [ 325, 327, 329 ], [ 331 ], [ 335, 337, 339, 341, 343 ], [ 345 ], [ 347 ], [ 349 ], [ 351 ], [ 353 ] ]
4,620
static void v9fs_synth_rewinddir(FsContext *ctx, V9fsFidOpenState *fs) { v9fs_synth_seekdir(ctx, fs, 0); }
false
qemu
364031f17932814484657e5551ba12957d993d7e
static void v9fs_synth_rewinddir(FsContext *ctx, V9fsFidOpenState *fs) { v9fs_synth_seekdir(ctx, fs, 0); }
{ "code": [], "line_no": [] }
static void FUNC_0(FsContext *VAR_0, V9fsFidOpenState *VAR_1) { v9fs_synth_seekdir(VAR_0, VAR_1, 0); }
[ "static void FUNC_0(FsContext *VAR_0, V9fsFidOpenState *VAR_1)\n{", "v9fs_synth_seekdir(VAR_0, VAR_1, 0);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
4,621
void ff_vp3_h_loop_filter_c(uint8_t *first_pixel, int stride, int *bounding_values) { unsigned char *end; int filter_value; for (end= first_pixel + 8*stride; first_pixel != end; first_pixel += stride) { filter_value = (first_pixel[-2] - first_pixel[ 1]) +3*(first_pixel[ 0] - first_pixel[-1]); filter_value = bounding_values[(filter_value + 4) >> 3]; first_pixel[-1] = av_clip_uint8(first_pixel[-1] + filter_value); first_pixel[ 0] = av_clip_uint8(first_pixel[ 0] - filter_value); } }
false
FFmpeg
28f9ab7029bd1a02f659995919f899f84ee7361b
void ff_vp3_h_loop_filter_c(uint8_t *first_pixel, int stride, int *bounding_values) { unsigned char *end; int filter_value; for (end= first_pixel + 8*stride; first_pixel != end; first_pixel += stride) { filter_value = (first_pixel[-2] - first_pixel[ 1]) +3*(first_pixel[ 0] - first_pixel[-1]); filter_value = bounding_values[(filter_value + 4) >> 3]; first_pixel[-1] = av_clip_uint8(first_pixel[-1] + filter_value); first_pixel[ 0] = av_clip_uint8(first_pixel[ 0] - filter_value); } }
{ "code": [], "line_no": [] }
void FUNC_0(uint8_t *VAR_0, int VAR_1, int *VAR_2) { unsigned char *VAR_3; int VAR_4; for (VAR_3= VAR_0 + 8*VAR_1; VAR_0 != VAR_3; VAR_0 += VAR_1) { VAR_4 = (VAR_0[-2] - VAR_0[ 1]) +3*(VAR_0[ 0] - VAR_0[-1]); VAR_4 = VAR_2[(VAR_4 + 4) >> 3]; VAR_0[-1] = av_clip_uint8(VAR_0[-1] + VAR_4); VAR_0[ 0] = av_clip_uint8(VAR_0[ 0] - VAR_4); } }
[ "void FUNC_0(uint8_t *VAR_0, int VAR_1, int *VAR_2)\n{", "unsigned char *VAR_3;", "int VAR_4;", "for (VAR_3= VAR_0 + 8*VAR_1; VAR_0 != VAR_3; VAR_0 += VAR_1) {", "VAR_4 =\n(VAR_0[-2] - VAR_0[ 1])\n+3*(VAR_0[ 0] - VAR_0[-1]);", "VAR_4 = VAR_2[(VAR_4 + 4) >> 3];", "VAR_0[-1] = av_clip_uint8(VAR_0[-1] + VAR_4);", "VAR_0[ 0] = av_clip_uint8(VAR_0[ 0] - VAR_4);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13, 15, 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ] ]
4,622
static int huffman_decode(MPADecodeContext *s, GranuleDef *g, int16_t *exponents, int end_pos2) { int s_index; int i; int last_pos, bits_left; VLC *vlc; int end_pos = FFMIN(end_pos2, s->gb.size_in_bits); /* low frequencies (called big values) */ s_index = 0; for (i = 0; i < 3; i++) { int j, k, l, linbits; j = g->region_size[i]; if (j == 0) continue; /* select vlc table */ k = g->table_select[i]; l = mpa_huff_data[k][0]; linbits = mpa_huff_data[k][1]; vlc = &huff_vlc[l]; if (!l) { memset(&g->sb_hybrid[s_index], 0, sizeof(*g->sb_hybrid) * 2 * j); s_index += 2 * j; continue; } /* read huffcode and compute each couple */ for (; j > 0; j--) { int exponent, x, y; int v; int pos = get_bits_count(&s->gb); if (pos >= end_pos){ // av_log(NULL, AV_LOG_ERROR, "pos: %d %d %d %d\n", pos, end_pos, end_pos2, s_index); switch_buffer(s, &pos, &end_pos, &end_pos2); // av_log(NULL, AV_LOG_ERROR, "new pos: %d %d\n", pos, end_pos); if (pos >= end_pos) break; } y = get_vlc2(&s->gb, vlc->table, 7, 3); if (!y) { g->sb_hybrid[s_index ] = g->sb_hybrid[s_index+1] = 0; s_index += 2; continue; } exponent= exponents[s_index]; av_dlog(s->avctx, "region=%d n=%d x=%d y=%d exp=%d\n", i, g->region_size[i] - j, x, y, exponent); if (y & 16) { x = y >> 5; y = y & 0x0f; if (x < 15) { READ_FLIP_SIGN(g->sb_hybrid + s_index, RENAME(expval_table)[exponent] + x) } else { x += get_bitsz(&s->gb, linbits); v = l3_unscale(x, exponent); if (get_bits1(&s->gb)) v = -v; g->sb_hybrid[s_index] = v; } if (y < 15) { READ_FLIP_SIGN(g->sb_hybrid + s_index + 1, RENAME(expval_table)[exponent] + y) } else { y += get_bitsz(&s->gb, linbits); v = l3_unscale(y, exponent); if (get_bits1(&s->gb)) v = -v; g->sb_hybrid[s_index+1] = v; } } else { x = y >> 5; y = y & 0x0f; x += y; if (x < 15) { READ_FLIP_SIGN(g->sb_hybrid + s_index + !!y, RENAME(expval_table)[exponent] + x) } else { x += get_bitsz(&s->gb, linbits); v = l3_unscale(x, exponent); if (get_bits1(&s->gb)) v = -v; g->sb_hybrid[s_index+!!y] = v; } g->sb_hybrid[s_index + !y] = 0; } s_index += 2; } } /* high frequencies */ vlc = &huff_quad_vlc[g->count1table_select]; last_pos = 0; while (s_index <= 572) { int pos, code; pos = get_bits_count(&s->gb); if (pos >= end_pos) { if (pos > end_pos2 && last_pos) { /* some encoders generate an incorrect size for this part. We must go back into the data */ s_index -= 4; skip_bits_long(&s->gb, last_pos - pos); av_log(s->avctx, AV_LOG_INFO, "overread, skip %d enddists: %d %d\n", last_pos - pos, end_pos-pos, end_pos2-pos); if(s->err_recognition & AV_EF_BITSTREAM) s_index=0; break; } // av_log(NULL, AV_LOG_ERROR, "pos2: %d %d %d %d\n", pos, end_pos, end_pos2, s_index); switch_buffer(s, &pos, &end_pos, &end_pos2); // av_log(NULL, AV_LOG_ERROR, "new pos2: %d %d %d\n", pos, end_pos, s_index); if (pos >= end_pos) break; } last_pos = pos; code = get_vlc2(&s->gb, vlc->table, vlc->bits, 1); av_dlog(s->avctx, "t=%d code=%d\n", g->count1table_select, code); g->sb_hybrid[s_index+0] = g->sb_hybrid[s_index+1] = g->sb_hybrid[s_index+2] = g->sb_hybrid[s_index+3] = 0; while (code) { static const int idxtab[16] = { 3,3,2,2,1,1,1,1,0,0,0,0,0,0,0,0 }; int v; int pos = s_index + idxtab[code]; code ^= 8 >> idxtab[code]; READ_FLIP_SIGN(g->sb_hybrid + pos, RENAME(exp_table)+exponents[pos]) } s_index += 4; } /* skip extension bits */ bits_left = end_pos2 - get_bits_count(&s->gb); //av_log(NULL, AV_LOG_ERROR, "left:%d buf:%p\n", bits_left, s->in_gb.buffer); if (bits_left < 0 && (s->err_recognition & AV_EF_BITSTREAM)) { av_log(s->avctx, AV_LOG_ERROR, "bits_left=%d\n", bits_left); s_index=0; } else if (bits_left > 0 && (s->err_recognition & AV_EF_BUFFER)) { av_log(s->avctx, AV_LOG_ERROR, "bits_left=%d\n", bits_left); s_index = 0; } memset(&g->sb_hybrid[s_index], 0, sizeof(*g->sb_hybrid) * (576 - s_index)); skip_bits_long(&s->gb, bits_left); i = get_bits_count(&s->gb); switch_buffer(s, &i, &end_pos, &end_pos2); return 0; }
false
FFmpeg
d2a0041c2075a553bb8d4f94591f8556680190c8
static int huffman_decode(MPADecodeContext *s, GranuleDef *g, int16_t *exponents, int end_pos2) { int s_index; int i; int last_pos, bits_left; VLC *vlc; int end_pos = FFMIN(end_pos2, s->gb.size_in_bits); s_index = 0; for (i = 0; i < 3; i++) { int j, k, l, linbits; j = g->region_size[i]; if (j == 0) continue; k = g->table_select[i]; l = mpa_huff_data[k][0]; linbits = mpa_huff_data[k][1]; vlc = &huff_vlc[l]; if (!l) { memset(&g->sb_hybrid[s_index], 0, sizeof(*g->sb_hybrid) * 2 * j); s_index += 2 * j; continue; } for (; j > 0; j--) { int exponent, x, y; int v; int pos = get_bits_count(&s->gb); if (pos >= end_pos){ switch_buffer(s, &pos, &end_pos, &end_pos2); if (pos >= end_pos) break; } y = get_vlc2(&s->gb, vlc->table, 7, 3); if (!y) { g->sb_hybrid[s_index ] = g->sb_hybrid[s_index+1] = 0; s_index += 2; continue; } exponent= exponents[s_index]; av_dlog(s->avctx, "region=%d n=%d x=%d y=%d exp=%d\n", i, g->region_size[i] - j, x, y, exponent); if (y & 16) { x = y >> 5; y = y & 0x0f; if (x < 15) { READ_FLIP_SIGN(g->sb_hybrid + s_index, RENAME(expval_table)[exponent] + x) } else { x += get_bitsz(&s->gb, linbits); v = l3_unscale(x, exponent); if (get_bits1(&s->gb)) v = -v; g->sb_hybrid[s_index] = v; } if (y < 15) { READ_FLIP_SIGN(g->sb_hybrid + s_index + 1, RENAME(expval_table)[exponent] + y) } else { y += get_bitsz(&s->gb, linbits); v = l3_unscale(y, exponent); if (get_bits1(&s->gb)) v = -v; g->sb_hybrid[s_index+1] = v; } } else { x = y >> 5; y = y & 0x0f; x += y; if (x < 15) { READ_FLIP_SIGN(g->sb_hybrid + s_index + !!y, RENAME(expval_table)[exponent] + x) } else { x += get_bitsz(&s->gb, linbits); v = l3_unscale(x, exponent); if (get_bits1(&s->gb)) v = -v; g->sb_hybrid[s_index+!!y] = v; } g->sb_hybrid[s_index + !y] = 0; } s_index += 2; } } vlc = &huff_quad_vlc[g->count1table_select]; last_pos = 0; while (s_index <= 572) { int pos, code; pos = get_bits_count(&s->gb); if (pos >= end_pos) { if (pos > end_pos2 && last_pos) { s_index -= 4; skip_bits_long(&s->gb, last_pos - pos); av_log(s->avctx, AV_LOG_INFO, "overread, skip %d enddists: %d %d\n", last_pos - pos, end_pos-pos, end_pos2-pos); if(s->err_recognition & AV_EF_BITSTREAM) s_index=0; break; } switch_buffer(s, &pos, &end_pos, &end_pos2); if (pos >= end_pos) break; } last_pos = pos; code = get_vlc2(&s->gb, vlc->table, vlc->bits, 1); av_dlog(s->avctx, "t=%d code=%d\n", g->count1table_select, code); g->sb_hybrid[s_index+0] = g->sb_hybrid[s_index+1] = g->sb_hybrid[s_index+2] = g->sb_hybrid[s_index+3] = 0; while (code) { static const int idxtab[16] = { 3,3,2,2,1,1,1,1,0,0,0,0,0,0,0,0 }; int v; int pos = s_index + idxtab[code]; code ^= 8 >> idxtab[code]; READ_FLIP_SIGN(g->sb_hybrid + pos, RENAME(exp_table)+exponents[pos]) } s_index += 4; } bits_left = end_pos2 - get_bits_count(&s->gb); if (bits_left < 0 && (s->err_recognition & AV_EF_BITSTREAM)) { av_log(s->avctx, AV_LOG_ERROR, "bits_left=%d\n", bits_left); s_index=0; } else if (bits_left > 0 && (s->err_recognition & AV_EF_BUFFER)) { av_log(s->avctx, AV_LOG_ERROR, "bits_left=%d\n", bits_left); s_index = 0; } memset(&g->sb_hybrid[s_index], 0, sizeof(*g->sb_hybrid) * (576 - s_index)); skip_bits_long(&s->gb, bits_left); i = get_bits_count(&s->gb); switch_buffer(s, &i, &end_pos, &end_pos2); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(MPADecodeContext *VAR_0, GranuleDef *VAR_1, int16_t *VAR_2, int VAR_3) { int VAR_4; int VAR_5; int VAR_6, VAR_7; VLC *vlc; int VAR_8 = FFMIN(VAR_3, VAR_0->gb.size_in_bits); VAR_4 = 0; for (VAR_5 = 0; VAR_5 < 3; VAR_5++) { int VAR_9, VAR_10, VAR_11, VAR_12; VAR_9 = VAR_1->region_size[VAR_5]; if (VAR_9 == 0) continue; VAR_10 = VAR_1->table_select[VAR_5]; VAR_11 = mpa_huff_data[VAR_10][0]; VAR_12 = mpa_huff_data[VAR_10][1]; vlc = &huff_vlc[VAR_11]; if (!VAR_11) { memset(&VAR_1->sb_hybrid[VAR_4], 0, sizeof(*VAR_1->sb_hybrid) * 2 * VAR_9); VAR_4 += 2 * VAR_9; continue; } for (; VAR_9 > 0; VAR_9--) { int VAR_13, VAR_14, VAR_15; int VAR_20; int VAR_20 = get_bits_count(&VAR_0->gb); if (VAR_20 >= VAR_8){ switch_buffer(VAR_0, &VAR_20, &VAR_8, &VAR_3); if (VAR_20 >= VAR_8) break; } VAR_15 = get_vlc2(&VAR_0->gb, vlc->table, 7, 3); if (!VAR_15) { VAR_1->sb_hybrid[VAR_4 ] = VAR_1->sb_hybrid[VAR_4+1] = 0; VAR_4 += 2; continue; } VAR_13= VAR_2[VAR_4]; av_dlog(VAR_0->avctx, "region=%d n=%d VAR_14=%d VAR_15=%d exp=%d\n", VAR_5, VAR_1->region_size[VAR_5] - VAR_9, VAR_14, VAR_15, VAR_13); if (VAR_15 & 16) { VAR_14 = VAR_15 >> 5; VAR_15 = VAR_15 & 0x0f; if (VAR_14 < 15) { READ_FLIP_SIGN(VAR_1->sb_hybrid + VAR_4, RENAME(expval_table)[VAR_13] + VAR_14) } else { VAR_14 += get_bitsz(&VAR_0->gb, VAR_12); VAR_20 = l3_unscale(VAR_14, VAR_13); if (get_bits1(&VAR_0->gb)) VAR_20 = -VAR_20; VAR_1->sb_hybrid[VAR_4] = VAR_20; } if (VAR_15 < 15) { READ_FLIP_SIGN(VAR_1->sb_hybrid + VAR_4 + 1, RENAME(expval_table)[VAR_13] + VAR_15) } else { VAR_15 += get_bitsz(&VAR_0->gb, VAR_12); VAR_20 = l3_unscale(VAR_15, VAR_13); if (get_bits1(&VAR_0->gb)) VAR_20 = -VAR_20; VAR_1->sb_hybrid[VAR_4+1] = VAR_20; } } else { VAR_14 = VAR_15 >> 5; VAR_15 = VAR_15 & 0x0f; VAR_14 += VAR_15; if (VAR_14 < 15) { READ_FLIP_SIGN(VAR_1->sb_hybrid + VAR_4 + !!VAR_15, RENAME(expval_table)[VAR_13] + VAR_14) } else { VAR_14 += get_bitsz(&VAR_0->gb, VAR_12); VAR_20 = l3_unscale(VAR_14, VAR_13); if (get_bits1(&VAR_0->gb)) VAR_20 = -VAR_20; VAR_1->sb_hybrid[VAR_4+!!VAR_15] = VAR_20; } VAR_1->sb_hybrid[VAR_4 + !VAR_15] = 0; } VAR_4 += 2; } } vlc = &huff_quad_vlc[VAR_1->count1table_select]; VAR_6 = 0; while (VAR_4 <= 572) { int VAR_20, VAR_18; VAR_20 = get_bits_count(&VAR_0->gb); if (VAR_20 >= VAR_8) { if (VAR_20 > VAR_3 && VAR_6) { VAR_4 -= 4; skip_bits_long(&VAR_0->gb, VAR_6 - VAR_20); av_log(VAR_0->avctx, AV_LOG_INFO, "overread, skip %d enddists: %d %d\n", VAR_6 - VAR_20, VAR_8-VAR_20, VAR_3-VAR_20); if(VAR_0->err_recognition & AV_EF_BITSTREAM) VAR_4=0; break; } switch_buffer(VAR_0, &VAR_20, &VAR_8, &VAR_3); if (VAR_20 >= VAR_8) break; } VAR_6 = VAR_20; VAR_18 = get_vlc2(&VAR_0->gb, vlc->table, vlc->bits, 1); av_dlog(VAR_0->avctx, "t=%d VAR_18=%d\n", VAR_1->count1table_select, VAR_18); VAR_1->sb_hybrid[VAR_4+0] = VAR_1->sb_hybrid[VAR_4+1] = VAR_1->sb_hybrid[VAR_4+2] = VAR_1->sb_hybrid[VAR_4+3] = 0; while (VAR_18) { static const int VAR_19[16] = { 3,3,2,2,1,1,1,1,0,0,0,0,0,0,0,0 }; int VAR_20; int VAR_20 = VAR_4 + VAR_19[VAR_18]; VAR_18 ^= 8 >> VAR_19[VAR_18]; READ_FLIP_SIGN(VAR_1->sb_hybrid + VAR_20, RENAME(exp_table)+VAR_2[VAR_20]) } VAR_4 += 4; } VAR_7 = VAR_3 - get_bits_count(&VAR_0->gb); if (VAR_7 < 0 && (VAR_0->err_recognition & AV_EF_BITSTREAM)) { av_log(VAR_0->avctx, AV_LOG_ERROR, "VAR_7=%d\n", VAR_7); VAR_4=0; } else if (VAR_7 > 0 && (VAR_0->err_recognition & AV_EF_BUFFER)) { av_log(VAR_0->avctx, AV_LOG_ERROR, "VAR_7=%d\n", VAR_7); VAR_4 = 0; } memset(&VAR_1->sb_hybrid[VAR_4], 0, sizeof(*VAR_1->sb_hybrid) * (576 - VAR_4)); skip_bits_long(&VAR_0->gb, VAR_7); VAR_5 = get_bits_count(&VAR_0->gb); switch_buffer(VAR_0, &VAR_5, &VAR_8, &VAR_3); return 0; }
[ "static int FUNC_0(MPADecodeContext *VAR_0, GranuleDef *VAR_1,\nint16_t *VAR_2, int VAR_3)\n{", "int VAR_4;", "int VAR_5;", "int VAR_6, VAR_7;", "VLC *vlc;", "int VAR_8 = FFMIN(VAR_3, VAR_0->gb.size_in_bits);", "VAR_4 = 0;", "for (VAR_5 = 0; VAR_5 < 3; VAR_5++) {", "int VAR_9, VAR_10, VAR_11, VAR_12;", "VAR_9 = VAR_1->region_size[VAR_5];", "if (VAR_9 == 0)\ncontinue;", "VAR_10 = VAR_1->table_select[VAR_5];", "VAR_11 = mpa_huff_data[VAR_10][0];", "VAR_12 = mpa_huff_data[VAR_10][1];", "vlc = &huff_vlc[VAR_11];", "if (!VAR_11) {", "memset(&VAR_1->sb_hybrid[VAR_4], 0, sizeof(*VAR_1->sb_hybrid) * 2 * VAR_9);", "VAR_4 += 2 * VAR_9;", "continue;", "}", "for (; VAR_9 > 0; VAR_9--) {", "int VAR_13, VAR_14, VAR_15;", "int VAR_20;", "int VAR_20 = get_bits_count(&VAR_0->gb);", "if (VAR_20 >= VAR_8){", "switch_buffer(VAR_0, &VAR_20, &VAR_8, &VAR_3);", "if (VAR_20 >= VAR_8)\nbreak;", "}", "VAR_15 = get_vlc2(&VAR_0->gb, vlc->table, 7, 3);", "if (!VAR_15) {", "VAR_1->sb_hybrid[VAR_4 ] =\nVAR_1->sb_hybrid[VAR_4+1] = 0;", "VAR_4 += 2;", "continue;", "}", "VAR_13= VAR_2[VAR_4];", "av_dlog(VAR_0->avctx, \"region=%d n=%d VAR_14=%d VAR_15=%d exp=%d\\n\",\nVAR_5, VAR_1->region_size[VAR_5] - VAR_9, VAR_14, VAR_15, VAR_13);", "if (VAR_15 & 16) {", "VAR_14 = VAR_15 >> 5;", "VAR_15 = VAR_15 & 0x0f;", "if (VAR_14 < 15) {", "READ_FLIP_SIGN(VAR_1->sb_hybrid + VAR_4, RENAME(expval_table)[VAR_13] + VAR_14)\n} else {", "VAR_14 += get_bitsz(&VAR_0->gb, VAR_12);", "VAR_20 = l3_unscale(VAR_14, VAR_13);", "if (get_bits1(&VAR_0->gb))\nVAR_20 = -VAR_20;", "VAR_1->sb_hybrid[VAR_4] = VAR_20;", "}", "if (VAR_15 < 15) {", "READ_FLIP_SIGN(VAR_1->sb_hybrid + VAR_4 + 1, RENAME(expval_table)[VAR_13] + VAR_15)\n} else {", "VAR_15 += get_bitsz(&VAR_0->gb, VAR_12);", "VAR_20 = l3_unscale(VAR_15, VAR_13);", "if (get_bits1(&VAR_0->gb))\nVAR_20 = -VAR_20;", "VAR_1->sb_hybrid[VAR_4+1] = VAR_20;", "}", "} else {", "VAR_14 = VAR_15 >> 5;", "VAR_15 = VAR_15 & 0x0f;", "VAR_14 += VAR_15;", "if (VAR_14 < 15) {", "READ_FLIP_SIGN(VAR_1->sb_hybrid + VAR_4 + !!VAR_15, RENAME(expval_table)[VAR_13] + VAR_14)\n} else {", "VAR_14 += get_bitsz(&VAR_0->gb, VAR_12);", "VAR_20 = l3_unscale(VAR_14, VAR_13);", "if (get_bits1(&VAR_0->gb))\nVAR_20 = -VAR_20;", "VAR_1->sb_hybrid[VAR_4+!!VAR_15] = VAR_20;", "}", "VAR_1->sb_hybrid[VAR_4 + !VAR_15] = 0;", "}", "VAR_4 += 2;", "}", "}", "vlc = &huff_quad_vlc[VAR_1->count1table_select];", "VAR_6 = 0;", "while (VAR_4 <= 572) {", "int VAR_20, VAR_18;", "VAR_20 = get_bits_count(&VAR_0->gb);", "if (VAR_20 >= VAR_8) {", "if (VAR_20 > VAR_3 && VAR_6) {", "VAR_4 -= 4;", "skip_bits_long(&VAR_0->gb, VAR_6 - VAR_20);", "av_log(VAR_0->avctx, AV_LOG_INFO, \"overread, skip %d enddists: %d %d\\n\", VAR_6 - VAR_20, VAR_8-VAR_20, VAR_3-VAR_20);", "if(VAR_0->err_recognition & AV_EF_BITSTREAM)\nVAR_4=0;", "break;", "}", "switch_buffer(VAR_0, &VAR_20, &VAR_8, &VAR_3);", "if (VAR_20 >= VAR_8)\nbreak;", "}", "VAR_6 = VAR_20;", "VAR_18 = get_vlc2(&VAR_0->gb, vlc->table, vlc->bits, 1);", "av_dlog(VAR_0->avctx, \"t=%d VAR_18=%d\\n\", VAR_1->count1table_select, VAR_18);", "VAR_1->sb_hybrid[VAR_4+0] =\nVAR_1->sb_hybrid[VAR_4+1] =\nVAR_1->sb_hybrid[VAR_4+2] =\nVAR_1->sb_hybrid[VAR_4+3] = 0;", "while (VAR_18) {", "static const int VAR_19[16] = { 3,3,2,2,1,1,1,1,0,0,0,0,0,0,0,0 };", "int VAR_20;", "int VAR_20 = VAR_4 + VAR_19[VAR_18];", "VAR_18 ^= 8 >> VAR_19[VAR_18];", "READ_FLIP_SIGN(VAR_1->sb_hybrid + VAR_20, RENAME(exp_table)+VAR_2[VAR_20])\n}", "VAR_4 += 4;", "}", "VAR_7 = VAR_3 - get_bits_count(&VAR_0->gb);", "if (VAR_7 < 0 && (VAR_0->err_recognition & AV_EF_BITSTREAM)) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"VAR_7=%d\\n\", VAR_7);", "VAR_4=0;", "} else if (VAR_7 > 0 && (VAR_0->err_recognition & AV_EF_BUFFER)) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"VAR_7=%d\\n\", VAR_7);", "VAR_4 = 0;", "}", "memset(&VAR_1->sb_hybrid[VAR_4], 0, sizeof(*VAR_1->sb_hybrid) * (576 - VAR_4));", "skip_bits_long(&VAR_0->gb, VAR_7);", "VAR_5 = get_bits_count(&VAR_0->gb);", "switch_buffer(VAR_0, &VAR_5, &VAR_8, &VAR_3);", "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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29, 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 73 ], [ 77, 79 ], [ 81 ], [ 83 ], [ 87 ], [ 89, 91 ], [ 93 ], [ 95 ], [ 97 ], [ 101 ], [ 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 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 209 ], [ 211 ], [ 213 ], [ 215, 217 ], [ 219 ], [ 221 ], [ 225 ], [ 229, 231 ], [ 233 ], [ 235 ], [ 239 ], [ 241 ], [ 243, 245, 247, 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261, 263 ], [ 265 ], [ 267 ], [ 271 ], [ 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ], [ 291 ], [ 295 ], [ 297 ], [ 301 ], [ 303 ] ]
4,623
static void memory_region_write_thunk_n(void *_mr, target_phys_addr_t addr, unsigned size, uint64_t data) { MemoryRegion *mr = _mr; if (!memory_region_access_valid(mr, addr, size)) { return; /* FIXME: better signalling */ } if (!mr->ops->write) { mr->ops->old_mmio.write[bitops_ffsl(size)](mr->opaque, addr, data); return; } /* FIXME: support unaligned access */ access_with_adjusted_size(addr + mr->offset, &data, size, mr->ops->impl.min_access_size, mr->ops->impl.max_access_size, memory_region_write_accessor, mr); }
false
qemu
897fa7cff21a98b260a5b3e73eae39273fa60272
static void memory_region_write_thunk_n(void *_mr, target_phys_addr_t addr, unsigned size, uint64_t data) { MemoryRegion *mr = _mr; if (!memory_region_access_valid(mr, addr, size)) { return; } if (!mr->ops->write) { mr->ops->old_mmio.write[bitops_ffsl(size)](mr->opaque, addr, data); return; } access_with_adjusted_size(addr + mr->offset, &data, size, mr->ops->impl.min_access_size, mr->ops->impl.max_access_size, memory_region_write_accessor, mr); }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1, unsigned VAR_2, uint64_t VAR_3) { MemoryRegion *mr = VAR_0; if (!memory_region_access_valid(mr, VAR_1, VAR_2)) { return; } if (!mr->ops->write) { mr->ops->old_mmio.write[bitops_ffsl(VAR_2)](mr->opaque, VAR_1, VAR_3); return; } access_with_adjusted_size(VAR_1 + mr->offset, &VAR_3, VAR_2, mr->ops->impl.min_access_size, mr->ops->impl.max_access_size, memory_region_write_accessor, mr); }
[ "static void FUNC_0(void *VAR_0,\ntarget_phys_addr_t VAR_1,\nunsigned VAR_2,\nuint64_t VAR_3)\n{", "MemoryRegion *mr = VAR_0;", "if (!memory_region_access_valid(mr, VAR_1, VAR_2)) {", "return;", "}", "if (!mr->ops->write) {", "mr->ops->old_mmio.write[bitops_ffsl(VAR_2)](mr->opaque, VAR_1, VAR_3);", "return;", "}", "access_with_adjusted_size(VAR_1 + mr->offset, &VAR_3, VAR_2,\nmr->ops->impl.min_access_size,\nmr->ops->impl.max_access_size,\nmemory_region_write_accessor, mr);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 35, 37, 39, 41 ], [ 43 ] ]
4,624
static int zipl_load_segment(struct component_entry *entry) { const int max_entries = (SECTOR_SIZE / sizeof(struct scsi_blockptr)); struct scsi_blockptr *bprs = (void*)sec; const int bprs_size = sizeof(sec); uint64_t blockno; long address; int i; blockno = entry->data.blockno; address = entry->load_address; debug_print_int("loading segment at block", blockno); debug_print_int("addr", address); do { memset(bprs, FREE_SPACE_FILLER, bprs_size); if (virtio_read(blockno, (uint8_t *)bprs)) { debug_print_int("failed reading bprs at", blockno); goto fail; } for (i = 0;; i++) { u64 *cur_desc = (void*)&bprs[i]; blockno = bprs[i].blockno; if (!blockno) break; /* we need the updated blockno for the next indirect entry in the chain, but don't want to advance address */ if (i == (max_entries - 1)) break; if (bprs[i].blockct == 0 && unused_space(&bprs[i + 1], sizeof(struct scsi_blockptr))) { /* This is a "continue" pointer. * This ptr is the last one in the current script section. * I.e. the next ptr must point to the unused memory area. * The blockno is not zero, so the upper loop must continue * reading next section of BPRS. */ break; } address = virtio_load_direct(cur_desc[0], cur_desc[1], 0, (void*)address); if (address == -1) goto fail; } } while (blockno); return 0; fail: sclp_print("failed loading segment\n"); return -1; }
false
qemu
abd696e4f74a9d30801c6ae2693efe4e5979c2f2
static int zipl_load_segment(struct component_entry *entry) { const int max_entries = (SECTOR_SIZE / sizeof(struct scsi_blockptr)); struct scsi_blockptr *bprs = (void*)sec; const int bprs_size = sizeof(sec); uint64_t blockno; long address; int i; blockno = entry->data.blockno; address = entry->load_address; debug_print_int("loading segment at block", blockno); debug_print_int("addr", address); do { memset(bprs, FREE_SPACE_FILLER, bprs_size); if (virtio_read(blockno, (uint8_t *)bprs)) { debug_print_int("failed reading bprs at", blockno); goto fail; } for (i = 0;; i++) { u64 *cur_desc = (void*)&bprs[i]; blockno = bprs[i].blockno; if (!blockno) break; if (i == (max_entries - 1)) break; if (bprs[i].blockct == 0 && unused_space(&bprs[i + 1], sizeof(struct scsi_blockptr))) { break; } address = virtio_load_direct(cur_desc[0], cur_desc[1], 0, (void*)address); if (address == -1) goto fail; } } while (blockno); return 0; fail: sclp_print("failed loading segment\n"); return -1; }
{ "code": [], "line_no": [] }
static int FUNC_0(struct component_entry *VAR_0) { const int VAR_1 = (SECTOR_SIZE / sizeof(struct scsi_blockptr)); struct scsi_blockptr *VAR_2 = (void*)sec; const int VAR_3 = sizeof(sec); uint64_t blockno; long VAR_4; int VAR_5; blockno = VAR_0->data.blockno; VAR_4 = VAR_0->load_address; debug_print_int("loading segment at block", blockno); debug_print_int("addr", VAR_4); do { memset(VAR_2, FREE_SPACE_FILLER, VAR_3); if (virtio_read(blockno, (uint8_t *)VAR_2)) { debug_print_int("failed reading VAR_2 at", blockno); goto fail; } for (VAR_5 = 0;; VAR_5++) { u64 *cur_desc = (void*)&VAR_2[VAR_5]; blockno = VAR_2[VAR_5].blockno; if (!blockno) break; if (VAR_5 == (VAR_1 - 1)) break; if (VAR_2[VAR_5].blockct == 0 && unused_space(&VAR_2[VAR_5 + 1], sizeof(struct scsi_blockptr))) { break; } VAR_4 = virtio_load_direct(cur_desc[0], cur_desc[1], 0, (void*)VAR_4); if (VAR_4 == -1) goto fail; } } while (blockno); return 0; fail: sclp_print("failed loading segment\n"); return -1; }
[ "static int FUNC_0(struct component_entry *VAR_0)\n{", "const int VAR_1 = (SECTOR_SIZE / sizeof(struct scsi_blockptr));", "struct scsi_blockptr *VAR_2 = (void*)sec;", "const int VAR_3 = sizeof(sec);", "uint64_t blockno;", "long VAR_4;", "int VAR_5;", "blockno = VAR_0->data.blockno;", "VAR_4 = VAR_0->load_address;", "debug_print_int(\"loading segment at block\", blockno);", "debug_print_int(\"addr\", VAR_4);", "do {", "memset(VAR_2, FREE_SPACE_FILLER, VAR_3);", "if (virtio_read(blockno, (uint8_t *)VAR_2)) {", "debug_print_int(\"failed reading VAR_2 at\", blockno);", "goto fail;", "}", "for (VAR_5 = 0;; VAR_5++) {", "u64 *cur_desc = (void*)&VAR_2[VAR_5];", "blockno = VAR_2[VAR_5].blockno;", "if (!blockno)\nbreak;", "if (VAR_5 == (VAR_1 - 1))\nbreak;", "if (VAR_2[VAR_5].blockct == 0 && unused_space(&VAR_2[VAR_5 + 1],\nsizeof(struct scsi_blockptr))) {", "break;", "}", "VAR_4 = virtio_load_direct(cur_desc[0], cur_desc[1], 0,\n(void*)VAR_4);", "if (VAR_4 == -1)\ngoto fail;", "}", "} while (blockno);", "return 0;", "fail:\nsclp_print(\"failed loading segment\\n\");", "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 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 51 ], [ 53, 55 ], [ 63, 65 ], [ 69, 71 ], [ 85 ], [ 87 ], [ 89, 91 ], [ 93, 95 ], [ 97 ], [ 99 ], [ 103 ], [ 107, 109 ], [ 111 ], [ 113 ] ]
4,625
int event_notifier_set(EventNotifier *e) { uint64_t value = 1; int r = write(e->fd, &value, sizeof(value)); return r == sizeof(value); }
false
qemu
d0cc2fbfa607678866475383c508be84818ceb64
int event_notifier_set(EventNotifier *e) { uint64_t value = 1; int r = write(e->fd, &value, sizeof(value)); return r == sizeof(value); }
{ "code": [], "line_no": [] }
int FUNC_0(EventNotifier *VAR_0) { uint64_t value = 1; int VAR_1 = write(VAR_0->fd, &value, sizeof(value)); return VAR_1 == sizeof(value); }
[ "int FUNC_0(EventNotifier *VAR_0)\n{", "uint64_t value = 1;", "int VAR_1 = write(VAR_0->fd, &value, sizeof(value));", "return VAR_1 == sizeof(value);", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ] ]
4,626
long do_sigreturn(CPUSPARCState *env) { abi_ulong sf_addr; struct target_signal_frame *sf; uint32_t up_psr, pc, npc; target_sigset_t set; sigset_t host_set; int err=0, i; sf_addr = env->regwptr[UREG_FP]; trace_user_do_sigreturn(env, sf_addr); if (!lock_user_struct(VERIFY_READ, sf, sf_addr, 1)) { goto segv_and_exit; } /* 1. Make sure we are not getting garbage from the user */ if (sf_addr & 3) goto segv_and_exit; __get_user(pc, &sf->info.si_regs.pc); __get_user(npc, &sf->info.si_regs.npc); if ((pc | npc) & 3) { goto segv_and_exit; } /* 2. Restore the state */ __get_user(up_psr, &sf->info.si_regs.psr); /* User can only change condition codes and FPU enabling in %psr. */ env->psr = (up_psr & (PSR_ICC /* | PSR_EF */)) | (env->psr & ~(PSR_ICC /* | PSR_EF */)); env->pc = pc; env->npc = npc; __get_user(env->y, &sf->info.si_regs.y); for (i=0; i < 8; i++) { __get_user(env->gregs[i], &sf->info.si_regs.u_regs[i]); } for (i=0; i < 8; i++) { __get_user(env->regwptr[i + UREG_I0], &sf->info.si_regs.u_regs[i+8]); } /* FIXME: implement FPU save/restore: * __get_user(fpu_save, &sf->fpu_save); * if (fpu_save) * err |= restore_fpu_state(env, fpu_save); */ /* This is pretty much atomic, no amount locking would prevent * the races which exist anyways. */ __get_user(set.sig[0], &sf->info.si_mask); for(i = 1; i < TARGET_NSIG_WORDS; i++) { __get_user(set.sig[i], &sf->extramask[i - 1]); } target_to_host_sigset_internal(&host_set, &set); do_sigprocmask(SIG_SETMASK, &host_set, NULL); if (err) { goto segv_and_exit; } unlock_user_struct(sf, sf_addr, 0); return env->regwptr[0]; segv_and_exit: unlock_user_struct(sf, sf_addr, 0); force_sig(TARGET_SIGSEGV); }
false
qemu
c0bea68f9ea48f0dea7a06a259a613bfd3a7e35e
long do_sigreturn(CPUSPARCState *env) { abi_ulong sf_addr; struct target_signal_frame *sf; uint32_t up_psr, pc, npc; target_sigset_t set; sigset_t host_set; int err=0, i; sf_addr = env->regwptr[UREG_FP]; trace_user_do_sigreturn(env, sf_addr); if (!lock_user_struct(VERIFY_READ, sf, sf_addr, 1)) { goto segv_and_exit; } if (sf_addr & 3) goto segv_and_exit; __get_user(pc, &sf->info.si_regs.pc); __get_user(npc, &sf->info.si_regs.npc); if ((pc | npc) & 3) { goto segv_and_exit; } __get_user(up_psr, &sf->info.si_regs.psr); env->psr = (up_psr & (PSR_ICC )) | (env->psr & ~(PSR_ICC )); env->pc = pc; env->npc = npc; __get_user(env->y, &sf->info.si_regs.y); for (i=0; i < 8; i++) { __get_user(env->gregs[i], &sf->info.si_regs.u_regs[i]); } for (i=0; i < 8; i++) { __get_user(env->regwptr[i + UREG_I0], &sf->info.si_regs.u_regs[i+8]); } __get_user(set.sig[0], &sf->info.si_mask); for(i = 1; i < TARGET_NSIG_WORDS; i++) { __get_user(set.sig[i], &sf->extramask[i - 1]); } target_to_host_sigset_internal(&host_set, &set); do_sigprocmask(SIG_SETMASK, &host_set, NULL); if (err) { goto segv_and_exit; } unlock_user_struct(sf, sf_addr, 0); return env->regwptr[0]; segv_and_exit: unlock_user_struct(sf, sf_addr, 0); force_sig(TARGET_SIGSEGV); }
{ "code": [], "line_no": [] }
long FUNC_0(CPUSPARCState *VAR_0) { abi_ulong sf_addr; struct target_signal_frame *VAR_1; uint32_t up_psr, pc, npc; target_sigset_t set; sigset_t host_set; int VAR_2=0, VAR_3; sf_addr = VAR_0->regwptr[UREG_FP]; trace_user_do_sigreturn(VAR_0, sf_addr); if (!lock_user_struct(VERIFY_READ, VAR_1, sf_addr, 1)) { goto segv_and_exit; } if (sf_addr & 3) goto segv_and_exit; __get_user(pc, &VAR_1->info.si_regs.pc); __get_user(npc, &VAR_1->info.si_regs.npc); if ((pc | npc) & 3) { goto segv_and_exit; } __get_user(up_psr, &VAR_1->info.si_regs.psr); VAR_0->psr = (up_psr & (PSR_ICC )) | (VAR_0->psr & ~(PSR_ICC )); VAR_0->pc = pc; VAR_0->npc = npc; __get_user(VAR_0->y, &VAR_1->info.si_regs.y); for (VAR_3=0; VAR_3 < 8; VAR_3++) { __get_user(VAR_0->gregs[VAR_3], &VAR_1->info.si_regs.u_regs[VAR_3]); } for (VAR_3=0; VAR_3 < 8; VAR_3++) { __get_user(VAR_0->regwptr[VAR_3 + UREG_I0], &VAR_1->info.si_regs.u_regs[VAR_3+8]); } __get_user(set.sig[0], &VAR_1->info.si_mask); for(VAR_3 = 1; VAR_3 < TARGET_NSIG_WORDS; VAR_3++) { __get_user(set.sig[VAR_3], &VAR_1->extramask[VAR_3 - 1]); } target_to_host_sigset_internal(&host_set, &set); do_sigprocmask(SIG_SETMASK, &host_set, NULL); if (VAR_2) { goto segv_and_exit; } unlock_user_struct(VAR_1, sf_addr, 0); return VAR_0->regwptr[0]; segv_and_exit: unlock_user_struct(VAR_1, sf_addr, 0); force_sig(TARGET_SIGSEGV); }
[ "long FUNC_0(CPUSPARCState *VAR_0)\n{", "abi_ulong sf_addr;", "struct target_signal_frame *VAR_1;", "uint32_t up_psr, pc, npc;", "target_sigset_t set;", "sigset_t host_set;", "int VAR_2=0, VAR_3;", "sf_addr = VAR_0->regwptr[UREG_FP];", "trace_user_do_sigreturn(VAR_0, sf_addr);", "if (!lock_user_struct(VERIFY_READ, VAR_1, sf_addr, 1)) {", "goto segv_and_exit;", "}", "if (sf_addr & 3)\ngoto segv_and_exit;", "__get_user(pc, &VAR_1->info.si_regs.pc);", "__get_user(npc, &VAR_1->info.si_regs.npc);", "if ((pc | npc) & 3) {", "goto segv_and_exit;", "}", "__get_user(up_psr, &VAR_1->info.si_regs.psr);", "VAR_0->psr = (up_psr & (PSR_ICC ))\n| (VAR_0->psr & ~(PSR_ICC ));", "VAR_0->pc = pc;", "VAR_0->npc = npc;", "__get_user(VAR_0->y, &VAR_1->info.si_regs.y);", "for (VAR_3=0; VAR_3 < 8; VAR_3++) {", "__get_user(VAR_0->gregs[VAR_3], &VAR_1->info.si_regs.u_regs[VAR_3]);", "}", "for (VAR_3=0; VAR_3 < 8; VAR_3++) {", "__get_user(VAR_0->regwptr[VAR_3 + UREG_I0], &VAR_1->info.si_regs.u_regs[VAR_3+8]);", "}", "__get_user(set.sig[0], &VAR_1->info.si_mask);", "for(VAR_3 = 1; VAR_3 < TARGET_NSIG_WORDS; VAR_3++) {", "__get_user(set.sig[VAR_3], &VAR_1->extramask[VAR_3 - 1]);", "}", "target_to_host_sigset_internal(&host_set, &set);", "do_sigprocmask(SIG_SETMASK, &host_set, NULL);", "if (VAR_2) {", "goto segv_and_exit;", "}", "unlock_user_struct(VAR_1, sf_addr, 0);", "return VAR_0->regwptr[0];", "segv_and_exit:\nunlock_user_struct(VAR_1, sf_addr, 0);", "force_sig(TARGET_SIGSEGV);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 35, 37 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 57 ], [ 63, 65 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 117 ], [ 119 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 135, 137 ], [ 139 ], [ 141 ] ]
4,627
void qcow2_free_any_clusters(BlockDriverState *bs, uint64_t l2_entry, int nb_clusters, enum qcow2_discard_type type) { BDRVQcow2State *s = bs->opaque; switch (qcow2_get_cluster_type(l2_entry)) { case QCOW2_CLUSTER_COMPRESSED: { int nb_csectors; nb_csectors = ((l2_entry >> s->csize_shift) & s->csize_mask) + 1; qcow2_free_clusters(bs, (l2_entry & s->cluster_offset_mask) & ~511, nb_csectors * 512, type); } break; case QCOW2_CLUSTER_NORMAL: case QCOW2_CLUSTER_ZERO: if (l2_entry & L2E_OFFSET_MASK) { if (offset_into_cluster(s, l2_entry & L2E_OFFSET_MASK)) { qcow2_signal_corruption(bs, false, -1, -1, "Cannot free unaligned cluster %#llx", l2_entry & L2E_OFFSET_MASK); } else { qcow2_free_clusters(bs, l2_entry & L2E_OFFSET_MASK, nb_clusters << s->cluster_bits, type); } } break; case QCOW2_CLUSTER_UNALLOCATED: break; default: abort(); } }
false
qemu
fdfab37dfeffefbd4533b4158055c9b82d7c3e69
void qcow2_free_any_clusters(BlockDriverState *bs, uint64_t l2_entry, int nb_clusters, enum qcow2_discard_type type) { BDRVQcow2State *s = bs->opaque; switch (qcow2_get_cluster_type(l2_entry)) { case QCOW2_CLUSTER_COMPRESSED: { int nb_csectors; nb_csectors = ((l2_entry >> s->csize_shift) & s->csize_mask) + 1; qcow2_free_clusters(bs, (l2_entry & s->cluster_offset_mask) & ~511, nb_csectors * 512, type); } break; case QCOW2_CLUSTER_NORMAL: case QCOW2_CLUSTER_ZERO: if (l2_entry & L2E_OFFSET_MASK) { if (offset_into_cluster(s, l2_entry & L2E_OFFSET_MASK)) { qcow2_signal_corruption(bs, false, -1, -1, "Cannot free unaligned cluster %#llx", l2_entry & L2E_OFFSET_MASK); } else { qcow2_free_clusters(bs, l2_entry & L2E_OFFSET_MASK, nb_clusters << s->cluster_bits, type); } } break; case QCOW2_CLUSTER_UNALLOCATED: break; default: abort(); } }
{ "code": [], "line_no": [] }
void FUNC_0(BlockDriverState *VAR_0, uint64_t VAR_1, int VAR_2, enum qcow2_discard_type VAR_3) { BDRVQcow2State *s = VAR_0->opaque; switch (qcow2_get_cluster_type(VAR_1)) { case QCOW2_CLUSTER_COMPRESSED: { int VAR_4; VAR_4 = ((VAR_1 >> s->csize_shift) & s->csize_mask) + 1; qcow2_free_clusters(VAR_0, (VAR_1 & s->cluster_offset_mask) & ~511, VAR_4 * 512, VAR_3); } break; case QCOW2_CLUSTER_NORMAL: case QCOW2_CLUSTER_ZERO: if (VAR_1 & L2E_OFFSET_MASK) { if (offset_into_cluster(s, VAR_1 & L2E_OFFSET_MASK)) { qcow2_signal_corruption(VAR_0, false, -1, -1, "Cannot free unaligned cluster %#llx", VAR_1 & L2E_OFFSET_MASK); } else { qcow2_free_clusters(VAR_0, VAR_1 & L2E_OFFSET_MASK, VAR_2 << s->cluster_bits, VAR_3); } } break; case QCOW2_CLUSTER_UNALLOCATED: break; default: abort(); } }
[ "void FUNC_0(BlockDriverState *VAR_0, uint64_t VAR_1,\nint VAR_2, enum qcow2_discard_type VAR_3)\n{", "BDRVQcow2State *s = VAR_0->opaque;", "switch (qcow2_get_cluster_type(VAR_1)) {", "case QCOW2_CLUSTER_COMPRESSED:\n{", "int VAR_4;", "VAR_4 = ((VAR_1 >> s->csize_shift) &\ns->csize_mask) + 1;", "qcow2_free_clusters(VAR_0,\n(VAR_1 & s->cluster_offset_mask) & ~511,\nVAR_4 * 512, VAR_3);", "}", "break;", "case QCOW2_CLUSTER_NORMAL:\ncase QCOW2_CLUSTER_ZERO:\nif (VAR_1 & L2E_OFFSET_MASK) {", "if (offset_into_cluster(s, VAR_1 & L2E_OFFSET_MASK)) {", "qcow2_signal_corruption(VAR_0, false, -1, -1,\n\"Cannot free unaligned cluster %#llx\",\nVAR_1 & L2E_OFFSET_MASK);", "} else {", "qcow2_free_clusters(VAR_0, VAR_1 & L2E_OFFSET_MASK,\nVAR_2 << s->cluster_bits, VAR_3);", "}", "}", "break;", "case QCOW2_CLUSTER_UNALLOCATED:\nbreak;", "default:\nabort();", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13, 15 ], [ 17 ], [ 19, 21 ], [ 23, 25, 27 ], [ 29 ], [ 31 ], [ 33, 35, 37 ], [ 39 ], [ 41, 43, 45 ], [ 47 ], [ 49, 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59, 61 ], [ 63, 65 ], [ 67 ], [ 69 ] ]
4,628
void qemu_put_byte(QEMUFile *f, int v) { if (!f->last_error && f->is_write == 0 && f->buf_index > 0) { fprintf(stderr, "Attempted to write to buffer while read buffer is not empty\n"); abort(); } f->buf[f->buf_index++] = v; f->is_write = 1; if (f->buf_index >= IO_BUF_SIZE) { int ret = qemu_fflush(f); qemu_file_set_if_error(f, ret); } }
false
qemu
c10682cb031525a8bdf3999ef6a033777929d304
void qemu_put_byte(QEMUFile *f, int v) { if (!f->last_error && f->is_write == 0 && f->buf_index > 0) { fprintf(stderr, "Attempted to write to buffer while read buffer is not empty\n"); abort(); } f->buf[f->buf_index++] = v; f->is_write = 1; if (f->buf_index >= IO_BUF_SIZE) { int ret = qemu_fflush(f); qemu_file_set_if_error(f, ret); } }
{ "code": [], "line_no": [] }
void FUNC_0(QEMUFile *VAR_0, int VAR_1) { if (!VAR_0->last_error && VAR_0->is_write == 0 && VAR_0->buf_index > 0) { fprintf(stderr, "Attempted to write to buffer while read buffer is not empty\n"); abort(); } VAR_0->buf[VAR_0->buf_index++] = VAR_1; VAR_0->is_write = 1; if (VAR_0->buf_index >= IO_BUF_SIZE) { int VAR_2 = qemu_fflush(VAR_0); qemu_file_set_if_error(VAR_0, VAR_2); } }
[ "void FUNC_0(QEMUFile *VAR_0, int VAR_1)\n{", "if (!VAR_0->last_error && VAR_0->is_write == 0 && VAR_0->buf_index > 0) {", "fprintf(stderr,\n\"Attempted to write to buffer while read buffer is not empty\\n\");", "abort();", "}", "VAR_0->buf[VAR_0->buf_index++] = VAR_1;", "VAR_0->is_write = 1;", "if (VAR_0->buf_index >= IO_BUF_SIZE) {", "int VAR_2 = qemu_fflush(VAR_0);", "qemu_file_set_if_error(VAR_0, VAR_2);", "}", "}" ]
[ 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 ] ]
4,629
static void n8x0_i2c_setup(struct n800_s *s) { DeviceState *dev; qemu_irq tmp_irq = qdev_get_gpio_in(s->cpu->gpio, N8X0_TMP105_GPIO); /* Attach the CPU on one end of our I2C bus. */ s->i2c = omap_i2c_bus(s->cpu->i2c[0]); /* Attach a menelaus PM chip */ dev = i2c_create_slave(s->i2c, "twl92230", N8X0_MENELAUS_ADDR); qdev_connect_gpio_out(dev, 3, s->cpu->irq[0][OMAP_INT_24XX_SYS_NIRQ]); /* Attach a TMP105 PM chip (A0 wired to ground) */ dev = i2c_create_slave(s->i2c, "tmp105", N8X0_TMP105_ADDR); qdev_connect_gpio_out(dev, 0, tmp_irq); }
false
qemu
0919ac787641db11024912651f3bc5764d4f1286
static void n8x0_i2c_setup(struct n800_s *s) { DeviceState *dev; qemu_irq tmp_irq = qdev_get_gpio_in(s->cpu->gpio, N8X0_TMP105_GPIO); s->i2c = omap_i2c_bus(s->cpu->i2c[0]); dev = i2c_create_slave(s->i2c, "twl92230", N8X0_MENELAUS_ADDR); qdev_connect_gpio_out(dev, 3, s->cpu->irq[0][OMAP_INT_24XX_SYS_NIRQ]); dev = i2c_create_slave(s->i2c, "tmp105", N8X0_TMP105_ADDR); qdev_connect_gpio_out(dev, 0, tmp_irq); }
{ "code": [], "line_no": [] }
static void FUNC_0(struct n800_s *VAR_0) { DeviceState *dev; qemu_irq tmp_irq = qdev_get_gpio_in(VAR_0->cpu->gpio, N8X0_TMP105_GPIO); VAR_0->i2c = omap_i2c_bus(VAR_0->cpu->i2c[0]); dev = i2c_create_slave(VAR_0->i2c, "twl92230", N8X0_MENELAUS_ADDR); qdev_connect_gpio_out(dev, 3, VAR_0->cpu->irq[0][OMAP_INT_24XX_SYS_NIRQ]); dev = i2c_create_slave(VAR_0->i2c, "tmp105", N8X0_TMP105_ADDR); qdev_connect_gpio_out(dev, 0, tmp_irq); }
[ "static void FUNC_0(struct n800_s *VAR_0)\n{", "DeviceState *dev;", "qemu_irq tmp_irq = qdev_get_gpio_in(VAR_0->cpu->gpio, N8X0_TMP105_GPIO);", "VAR_0->i2c = omap_i2c_bus(VAR_0->cpu->i2c[0]);", "dev = i2c_create_slave(VAR_0->i2c, \"twl92230\", N8X0_MENELAUS_ADDR);", "qdev_connect_gpio_out(dev, 3, VAR_0->cpu->irq[0][OMAP_INT_24XX_SYS_NIRQ]);", "dev = i2c_create_slave(VAR_0->i2c, \"tmp105\", N8X0_TMP105_ADDR);", "qdev_connect_gpio_out(dev, 0, tmp_irq);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 13 ], [ 19 ], [ 21 ], [ 27 ], [ 29 ], [ 31 ] ]
4,630
void destroy_bdrvs(dev_match_fn *match_fn, void *arg) { DriveInfo *dinfo; struct BlockDriverState *bs; TAILQ_FOREACH(dinfo, &drives, next) { bs = dinfo->bdrv; if (bs) { if (bs->private && match_fn(bs->private, arg)) { drive_uninit(bs); bdrv_delete(bs); } } } }
false
qemu
72cf2d4f0e181d0d3a3122e04129c58a95da713e
void destroy_bdrvs(dev_match_fn *match_fn, void *arg) { DriveInfo *dinfo; struct BlockDriverState *bs; TAILQ_FOREACH(dinfo, &drives, next) { bs = dinfo->bdrv; if (bs) { if (bs->private && match_fn(bs->private, arg)) { drive_uninit(bs); bdrv_delete(bs); } } } }
{ "code": [], "line_no": [] }
void FUNC_0(dev_match_fn *VAR_0, void *VAR_1) { DriveInfo *dinfo; struct BlockDriverState *VAR_2; TAILQ_FOREACH(dinfo, &drives, next) { VAR_2 = dinfo->bdrv; if (VAR_2) { if (VAR_2->private && VAR_0(VAR_2->private, VAR_1)) { drive_uninit(VAR_2); bdrv_delete(VAR_2); } } } }
[ "void FUNC_0(dev_match_fn *VAR_0, void *VAR_1)\n{", "DriveInfo *dinfo;", "struct BlockDriverState *VAR_2;", "TAILQ_FOREACH(dinfo, &drives, next) {", "VAR_2 = dinfo->bdrv;", "if (VAR_2) {", "if (VAR_2->private && VAR_0(VAR_2->private, VAR_1)) {", "drive_uninit(VAR_2);", "bdrv_delete(VAR_2);", "}", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ] ]
4,631
TranslationBlock *tb_gen_code(CPUState *cpu, target_ulong pc, target_ulong cs_base, int flags, int cflags) { CPUArchState *env = cpu->env_ptr; TranslationBlock *tb; tb_page_addr_t phys_pc, phys_page2; target_ulong virt_page2; tcg_insn_unit *gen_code_buf; int gen_code_size, search_size; #ifdef CONFIG_PROFILER int64_t ti; #endif phys_pc = get_page_addr_code(env, pc); if (use_icount) { cflags |= CF_USE_ICOUNT; } tb = tb_alloc(pc); if (unlikely(!tb)) { buffer_overflow: /* flush must be done */ tb_flush(cpu); /* cannot fail at this point */ tb = tb_alloc(pc); assert(tb != NULL); /* Don't forget to invalidate previous TB info. */ tcg_ctx.tb_ctx.tb_invalidated_flag = 1; } gen_code_buf = tcg_ctx.code_gen_ptr; tb->tc_ptr = gen_code_buf; tb->cs_base = cs_base; tb->flags = flags; tb->cflags = cflags; #ifdef CONFIG_PROFILER tcg_ctx.tb_count1++; /* includes aborted translations because of exceptions */ ti = profile_getclock(); #endif tcg_func_start(&tcg_ctx); gen_intermediate_code(env, tb); trace_translate_block(tb, tb->pc, tb->tc_ptr); /* generate machine code */ tb->tb_next_offset[0] = 0xffff; tb->tb_next_offset[1] = 0xffff; tcg_ctx.tb_next_offset = tb->tb_next_offset; #ifdef USE_DIRECT_JUMP tcg_ctx.tb_jmp_offset = tb->tb_jmp_offset; tcg_ctx.tb_next = NULL; #else tcg_ctx.tb_jmp_offset = NULL; tcg_ctx.tb_next = tb->tb_next; #endif #ifdef CONFIG_PROFILER tcg_ctx.tb_count++; tcg_ctx.interm_time += profile_getclock() - ti; tcg_ctx.code_time -= profile_getclock(); #endif /* ??? Overflow could be handled better here. In particular, we don't need to re-do gen_intermediate_code, nor should we re-do the tcg optimization currently hidden inside tcg_gen_code. All that should be required is to flush the TBs, allocate a new TB, re-initialize it per above, and re-do the actual code generation. */ gen_code_size = tcg_gen_code(&tcg_ctx, gen_code_buf); if (unlikely(gen_code_size < 0)) { goto buffer_overflow; } search_size = encode_search(tb, (void *)gen_code_buf + gen_code_size); if (unlikely(search_size < 0)) { goto buffer_overflow; } #ifdef CONFIG_PROFILER tcg_ctx.code_time += profile_getclock(); tcg_ctx.code_in_len += tb->size; tcg_ctx.code_out_len += gen_code_size; tcg_ctx.search_out_len += search_size; #endif #ifdef DEBUG_DISAS if (qemu_loglevel_mask(CPU_LOG_TB_OUT_ASM)) { qemu_log("OUT: [size=%d]\n", gen_code_size); log_disas(tb->tc_ptr, gen_code_size); qemu_log("\n"); qemu_log_flush(); } #endif tcg_ctx.code_gen_ptr = (void *) ROUND_UP((uintptr_t)gen_code_buf + gen_code_size + search_size, CODE_GEN_ALIGN); /* check next page if needed */ virt_page2 = (pc + tb->size - 1) & TARGET_PAGE_MASK; phys_page2 = -1; if ((pc & TARGET_PAGE_MASK) != virt_page2) { phys_page2 = get_page_addr_code(env, virt_page2); } tb_link_page(tb, phys_pc, phys_page2); return tb; }
false
qemu
56c0269a9ec105d3848d9f900b5e38e6b35e2478
TranslationBlock *tb_gen_code(CPUState *cpu, target_ulong pc, target_ulong cs_base, int flags, int cflags) { CPUArchState *env = cpu->env_ptr; TranslationBlock *tb; tb_page_addr_t phys_pc, phys_page2; target_ulong virt_page2; tcg_insn_unit *gen_code_buf; int gen_code_size, search_size; #ifdef CONFIG_PROFILER int64_t ti; #endif phys_pc = get_page_addr_code(env, pc); if (use_icount) { cflags |= CF_USE_ICOUNT; } tb = tb_alloc(pc); if (unlikely(!tb)) { buffer_overflow: tb_flush(cpu); tb = tb_alloc(pc); assert(tb != NULL); tcg_ctx.tb_ctx.tb_invalidated_flag = 1; } gen_code_buf = tcg_ctx.code_gen_ptr; tb->tc_ptr = gen_code_buf; tb->cs_base = cs_base; tb->flags = flags; tb->cflags = cflags; #ifdef CONFIG_PROFILER tcg_ctx.tb_count1++; ti = profile_getclock(); #endif tcg_func_start(&tcg_ctx); gen_intermediate_code(env, tb); trace_translate_block(tb, tb->pc, tb->tc_ptr); tb->tb_next_offset[0] = 0xffff; tb->tb_next_offset[1] = 0xffff; tcg_ctx.tb_next_offset = tb->tb_next_offset; #ifdef USE_DIRECT_JUMP tcg_ctx.tb_jmp_offset = tb->tb_jmp_offset; tcg_ctx.tb_next = NULL; #else tcg_ctx.tb_jmp_offset = NULL; tcg_ctx.tb_next = tb->tb_next; #endif #ifdef CONFIG_PROFILER tcg_ctx.tb_count++; tcg_ctx.interm_time += profile_getclock() - ti; tcg_ctx.code_time -= profile_getclock(); #endif gen_code_size = tcg_gen_code(&tcg_ctx, gen_code_buf); if (unlikely(gen_code_size < 0)) { goto buffer_overflow; } search_size = encode_search(tb, (void *)gen_code_buf + gen_code_size); if (unlikely(search_size < 0)) { goto buffer_overflow; } #ifdef CONFIG_PROFILER tcg_ctx.code_time += profile_getclock(); tcg_ctx.code_in_len += tb->size; tcg_ctx.code_out_len += gen_code_size; tcg_ctx.search_out_len += search_size; #endif #ifdef DEBUG_DISAS if (qemu_loglevel_mask(CPU_LOG_TB_OUT_ASM)) { qemu_log("OUT: [size=%d]\n", gen_code_size); log_disas(tb->tc_ptr, gen_code_size); qemu_log("\n"); qemu_log_flush(); } #endif tcg_ctx.code_gen_ptr = (void *) ROUND_UP((uintptr_t)gen_code_buf + gen_code_size + search_size, CODE_GEN_ALIGN); virt_page2 = (pc + tb->size - 1) & TARGET_PAGE_MASK; phys_page2 = -1; if ((pc & TARGET_PAGE_MASK) != virt_page2) { phys_page2 = get_page_addr_code(env, virt_page2); } tb_link_page(tb, phys_pc, phys_page2); return tb; }
{ "code": [], "line_no": [] }
TranslationBlock *FUNC_0(CPUState *cpu, target_ulong pc, target_ulong cs_base, int flags, int cflags) { CPUArchState *env = cpu->env_ptr; TranslationBlock *tb; tb_page_addr_t phys_pc, phys_page2; target_ulong virt_page2; tcg_insn_unit *gen_code_buf; int VAR_0, VAR_1; #ifdef CONFIG_PROFILER int64_t ti; #endif phys_pc = get_page_addr_code(env, pc); if (use_icount) { cflags |= CF_USE_ICOUNT; } tb = tb_alloc(pc); if (unlikely(!tb)) { buffer_overflow: tb_flush(cpu); tb = tb_alloc(pc); assert(tb != NULL); tcg_ctx.tb_ctx.tb_invalidated_flag = 1; } gen_code_buf = tcg_ctx.code_gen_ptr; tb->tc_ptr = gen_code_buf; tb->cs_base = cs_base; tb->flags = flags; tb->cflags = cflags; #ifdef CONFIG_PROFILER tcg_ctx.tb_count1++; ti = profile_getclock(); #endif tcg_func_start(&tcg_ctx); gen_intermediate_code(env, tb); trace_translate_block(tb, tb->pc, tb->tc_ptr); tb->tb_next_offset[0] = 0xffff; tb->tb_next_offset[1] = 0xffff; tcg_ctx.tb_next_offset = tb->tb_next_offset; #ifdef USE_DIRECT_JUMP tcg_ctx.tb_jmp_offset = tb->tb_jmp_offset; tcg_ctx.tb_next = NULL; #else tcg_ctx.tb_jmp_offset = NULL; tcg_ctx.tb_next = tb->tb_next; #endif #ifdef CONFIG_PROFILER tcg_ctx.tb_count++; tcg_ctx.interm_time += profile_getclock() - ti; tcg_ctx.code_time -= profile_getclock(); #endif VAR_0 = tcg_gen_code(&tcg_ctx, gen_code_buf); if (unlikely(VAR_0 < 0)) { goto buffer_overflow; } VAR_1 = encode_search(tb, (void *)gen_code_buf + VAR_0); if (unlikely(VAR_1 < 0)) { goto buffer_overflow; } #ifdef CONFIG_PROFILER tcg_ctx.code_time += profile_getclock(); tcg_ctx.code_in_len += tb->size; tcg_ctx.code_out_len += VAR_0; tcg_ctx.search_out_len += VAR_1; #endif #ifdef DEBUG_DISAS if (qemu_loglevel_mask(CPU_LOG_TB_OUT_ASM)) { qemu_log("OUT: [size=%d]\n", VAR_0); log_disas(tb->tc_ptr, VAR_0); qemu_log("\n"); qemu_log_flush(); } #endif tcg_ctx.code_gen_ptr = (void *) ROUND_UP((uintptr_t)gen_code_buf + VAR_0 + VAR_1, CODE_GEN_ALIGN); virt_page2 = (pc + tb->size - 1) & TARGET_PAGE_MASK; phys_page2 = -1; if ((pc & TARGET_PAGE_MASK) != virt_page2) { phys_page2 = get_page_addr_code(env, virt_page2); } tb_link_page(tb, phys_pc, phys_page2); return tb; }
[ "TranslationBlock *FUNC_0(CPUState *cpu,\ntarget_ulong pc, target_ulong cs_base,\nint flags, int cflags)\n{", "CPUArchState *env = cpu->env_ptr;", "TranslationBlock *tb;", "tb_page_addr_t phys_pc, phys_page2;", "target_ulong virt_page2;", "tcg_insn_unit *gen_code_buf;", "int VAR_0, VAR_1;", "#ifdef CONFIG_PROFILER\nint64_t ti;", "#endif\nphys_pc = get_page_addr_code(env, pc);", "if (use_icount) {", "cflags |= CF_USE_ICOUNT;", "}", "tb = tb_alloc(pc);", "if (unlikely(!tb)) {", "buffer_overflow:\ntb_flush(cpu);", "tb = tb_alloc(pc);", "assert(tb != NULL);", "tcg_ctx.tb_ctx.tb_invalidated_flag = 1;", "}", "gen_code_buf = tcg_ctx.code_gen_ptr;", "tb->tc_ptr = gen_code_buf;", "tb->cs_base = cs_base;", "tb->flags = flags;", "tb->cflags = cflags;", "#ifdef CONFIG_PROFILER\ntcg_ctx.tb_count1++;", "ti = profile_getclock();", "#endif\ntcg_func_start(&tcg_ctx);", "gen_intermediate_code(env, tb);", "trace_translate_block(tb, tb->pc, tb->tc_ptr);", "tb->tb_next_offset[0] = 0xffff;", "tb->tb_next_offset[1] = 0xffff;", "tcg_ctx.tb_next_offset = tb->tb_next_offset;", "#ifdef USE_DIRECT_JUMP\ntcg_ctx.tb_jmp_offset = tb->tb_jmp_offset;", "tcg_ctx.tb_next = NULL;", "#else\ntcg_ctx.tb_jmp_offset = NULL;", "tcg_ctx.tb_next = tb->tb_next;", "#endif\n#ifdef CONFIG_PROFILER\ntcg_ctx.tb_count++;", "tcg_ctx.interm_time += profile_getclock() - ti;", "tcg_ctx.code_time -= profile_getclock();", "#endif\nVAR_0 = tcg_gen_code(&tcg_ctx, gen_code_buf);", "if (unlikely(VAR_0 < 0)) {", "goto buffer_overflow;", "}", "VAR_1 = encode_search(tb, (void *)gen_code_buf + VAR_0);", "if (unlikely(VAR_1 < 0)) {", "goto buffer_overflow;", "}", "#ifdef CONFIG_PROFILER\ntcg_ctx.code_time += profile_getclock();", "tcg_ctx.code_in_len += tb->size;", "tcg_ctx.code_out_len += VAR_0;", "tcg_ctx.search_out_len += VAR_1;", "#endif\n#ifdef DEBUG_DISAS\nif (qemu_loglevel_mask(CPU_LOG_TB_OUT_ASM)) {", "qemu_log(\"OUT: [size=%d]\\n\", VAR_0);", "log_disas(tb->tc_ptr, VAR_0);", "qemu_log(\"\\n\");", "qemu_log_flush();", "}", "#endif\ntcg_ctx.code_gen_ptr = (void *)\nROUND_UP((uintptr_t)gen_code_buf + VAR_0 + VAR_1,\nCODE_GEN_ALIGN);", "virt_page2 = (pc + tb->size - 1) & TARGET_PAGE_MASK;", "phys_page2 = -1;", "if ((pc & TARGET_PAGE_MASK) != virt_page2) {", "phys_page2 = get_page_addr_code(env, virt_page2);", "}", "tb_link_page(tb, phys_pc, phys_page2);", "return tb;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21, 23 ], [ 25, 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43, 47 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 75, 77 ], [ 81 ], [ 83, 87 ], [ 91 ], [ 95 ], [ 101 ], [ 103 ], [ 105 ], [ 107, 109 ], [ 111 ], [ 113, 115 ], [ 117 ], [ 119, 123, 125 ], [ 127 ], [ 129 ], [ 131, 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 163, 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173, 177, 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191, 195, 197, 199 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ] ]
4,632
static void virtio_blk_handle_write(VirtIOBlockReq *req, MultiReqBuffer *mrb) { BlockRequest *blkreq; uint64_t sector; sector = virtio_ldq_p(VIRTIO_DEVICE(req->dev), &req->out.sector); trace_virtio_blk_handle_write(req, sector, req->qiov.size / 512); if (!virtio_blk_sect_range_ok(req->dev, sector, req->qiov.size)) { virtio_blk_req_complete(req, VIRTIO_BLK_S_IOERR); virtio_blk_free_request(req); return; } block_acct_start(bdrv_get_stats(req->dev->bs), &req->acct, req->qiov.size, BLOCK_ACCT_WRITE); if (mrb->num_writes == 32) { virtio_submit_multiwrite(req->dev->bs, mrb); } blkreq = &mrb->blkreq[mrb->num_writes]; blkreq->sector = sector; blkreq->nb_sectors = req->qiov.size / BDRV_SECTOR_SIZE; blkreq->qiov = &req->qiov; blkreq->cb = virtio_blk_rw_complete; blkreq->opaque = req; blkreq->error = 0; mrb->num_writes++; }
false
qemu
4be746345f13e99e468c60acbd3a355e8183e3ce
static void virtio_blk_handle_write(VirtIOBlockReq *req, MultiReqBuffer *mrb) { BlockRequest *blkreq; uint64_t sector; sector = virtio_ldq_p(VIRTIO_DEVICE(req->dev), &req->out.sector); trace_virtio_blk_handle_write(req, sector, req->qiov.size / 512); if (!virtio_blk_sect_range_ok(req->dev, sector, req->qiov.size)) { virtio_blk_req_complete(req, VIRTIO_BLK_S_IOERR); virtio_blk_free_request(req); return; } block_acct_start(bdrv_get_stats(req->dev->bs), &req->acct, req->qiov.size, BLOCK_ACCT_WRITE); if (mrb->num_writes == 32) { virtio_submit_multiwrite(req->dev->bs, mrb); } blkreq = &mrb->blkreq[mrb->num_writes]; blkreq->sector = sector; blkreq->nb_sectors = req->qiov.size / BDRV_SECTOR_SIZE; blkreq->qiov = &req->qiov; blkreq->cb = virtio_blk_rw_complete; blkreq->opaque = req; blkreq->error = 0; mrb->num_writes++; }
{ "code": [], "line_no": [] }
static void FUNC_0(VirtIOBlockReq *VAR_0, MultiReqBuffer *VAR_1) { BlockRequest *blkreq; uint64_t sector; sector = virtio_ldq_p(VIRTIO_DEVICE(VAR_0->dev), &VAR_0->out.sector); trace_virtio_blk_handle_write(VAR_0, sector, VAR_0->qiov.size / 512); if (!virtio_blk_sect_range_ok(VAR_0->dev, sector, VAR_0->qiov.size)) { virtio_blk_req_complete(VAR_0, VIRTIO_BLK_S_IOERR); virtio_blk_free_request(VAR_0); return; } block_acct_start(bdrv_get_stats(VAR_0->dev->bs), &VAR_0->acct, VAR_0->qiov.size, BLOCK_ACCT_WRITE); if (VAR_1->num_writes == 32) { virtio_submit_multiwrite(VAR_0->dev->bs, VAR_1); } blkreq = &VAR_1->blkreq[VAR_1->num_writes]; blkreq->sector = sector; blkreq->nb_sectors = VAR_0->qiov.size / BDRV_SECTOR_SIZE; blkreq->qiov = &VAR_0->qiov; blkreq->cb = virtio_blk_rw_complete; blkreq->opaque = VAR_0; blkreq->error = 0; VAR_1->num_writes++; }
[ "static void FUNC_0(VirtIOBlockReq *VAR_0, MultiReqBuffer *VAR_1)\n{", "BlockRequest *blkreq;", "uint64_t sector;", "sector = virtio_ldq_p(VIRTIO_DEVICE(VAR_0->dev), &VAR_0->out.sector);", "trace_virtio_blk_handle_write(VAR_0, sector, VAR_0->qiov.size / 512);", "if (!virtio_blk_sect_range_ok(VAR_0->dev, sector, VAR_0->qiov.size)) {", "virtio_blk_req_complete(VAR_0, VIRTIO_BLK_S_IOERR);", "virtio_blk_free_request(VAR_0);", "return;", "}", "block_acct_start(bdrv_get_stats(VAR_0->dev->bs), &VAR_0->acct, VAR_0->qiov.size,\nBLOCK_ACCT_WRITE);", "if (VAR_1->num_writes == 32) {", "virtio_submit_multiwrite(VAR_0->dev->bs, VAR_1);", "}", "blkreq = &VAR_1->blkreq[VAR_1->num_writes];", "blkreq->sector = sector;", "blkreq->nb_sectors = VAR_0->qiov.size / BDRV_SECTOR_SIZE;", "blkreq->qiov = &VAR_0->qiov;", "blkreq->cb = virtio_blk_rw_complete;", "blkreq->opaque = VAR_0;", "blkreq->error = 0;", "VAR_1->num_writes++;", "}" ]
[ 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 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31, 33 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ] ]
4,633
static int vc1_parse(AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size) { /* Here we do the searching for frame boundaries and headers at * the same time. Only a minimal amount at the start of each * header is unescaped. */ VC1ParseContext *vpc = s->priv_data; int pic_found = vpc->pc.frame_start_found; uint8_t *unesc_buffer = vpc->unesc_buffer; size_t unesc_index = vpc->unesc_index; VC1ParseSearchState search_state = vpc->search_state; int start_code_found; int next = END_NOT_FOUND; int i = vpc->bytes_to_skip; if (pic_found && buf_size == 0) { /* EOF considered as end of frame */ memset(unesc_buffer + unesc_index, 0, UNESCAPED_THRESHOLD - unesc_index); vc1_extract_header(s, avctx, unesc_buffer, unesc_index); next = 0; } while (i < buf_size) { uint8_t b; start_code_found = 0; while (i < buf_size && unesc_index < UNESCAPED_THRESHOLD) { b = buf[i++]; unesc_buffer[unesc_index++] = b; if (search_state <= ONE_ZERO) search_state = b ? NO_MATCH : search_state + 1; else if (search_state == TWO_ZEROS) { if (b == 1) search_state = ONE; else if (b > 1) { if (b == 3) unesc_index--; // swallow emulation prevention byte search_state = NO_MATCH; } } else { // search_state == ONE // Header unescaping terminates early due to detection of next start code search_state = NO_MATCH; start_code_found = 1; break; } } if ((s->flags & PARSER_FLAG_COMPLETE_FRAMES) && unesc_index >= UNESCAPED_THRESHOLD && vpc->prev_start_code == (VC1_CODE_FRAME & 0xFF)) { // No need to keep scanning the rest of the buffer for // start codes if we know it contains a complete frame and // we've already unescaped all we need of the frame header vc1_extract_header(s, avctx, unesc_buffer, unesc_index); break; } if (unesc_index >= UNESCAPED_THRESHOLD && !start_code_found) { while (i < buf_size) { if (search_state == NO_MATCH) { i += vpc->v.vc1dsp.startcode_find_candidate(buf + i, buf_size - i); if (i < buf_size) { search_state = ONE_ZERO; } i++; } else { b = buf[i++]; if (search_state == ONE_ZERO) search_state = b ? NO_MATCH : TWO_ZEROS; else if (search_state == TWO_ZEROS) { if (b >= 1) search_state = b == 1 ? ONE : NO_MATCH; } else { // search_state == ONE search_state = NO_MATCH; start_code_found = 1; break; } } } } if (start_code_found) { vc1_extract_header(s, avctx, unesc_buffer, unesc_index); vpc->prev_start_code = b; unesc_index = 0; if (!(s->flags & PARSER_FLAG_COMPLETE_FRAMES)) { if (!pic_found && (b == (VC1_CODE_FRAME & 0xFF) || b == (VC1_CODE_FIELD & 0xFF))) { pic_found = 1; } else if (pic_found && b != (VC1_CODE_FIELD & 0xFF) && b != (VC1_CODE_SLICE & 0xFF)) { next = i - 4; pic_found = b == (VC1_CODE_FRAME & 0xFF); break; } } } } vpc->pc.frame_start_found = pic_found; vpc->unesc_index = unesc_index; vpc->search_state = search_state; if (s->flags & PARSER_FLAG_COMPLETE_FRAMES) { next = buf_size; } else { if (ff_combine_frame(&vpc->pc, next, &buf, &buf_size) < 0) { vpc->bytes_to_skip = 0; *poutbuf = NULL; *poutbuf_size = 0; return buf_size; } } /* If we return with a valid pointer to a combined frame buffer * then on the next call then we'll have been unhelpfully rewound * by up to 4 bytes (depending upon whether the start code * overlapped the input buffer, and if so by how much). We don't * want this: it will either cause spurious second detections of * the start code we've already seen, or cause extra bytes to be * inserted at the start of the unescaped buffer. */ vpc->bytes_to_skip = 4; if (next < 0 && start_code_found) vpc->bytes_to_skip += next; *poutbuf = buf; *poutbuf_size = buf_size; return next; }
false
FFmpeg
ff771f79b55a346b4163d814b58ee4c98114745e
static int vc1_parse(AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size) { VC1ParseContext *vpc = s->priv_data; int pic_found = vpc->pc.frame_start_found; uint8_t *unesc_buffer = vpc->unesc_buffer; size_t unesc_index = vpc->unesc_index; VC1ParseSearchState search_state = vpc->search_state; int start_code_found; int next = END_NOT_FOUND; int i = vpc->bytes_to_skip; if (pic_found && buf_size == 0) { memset(unesc_buffer + unesc_index, 0, UNESCAPED_THRESHOLD - unesc_index); vc1_extract_header(s, avctx, unesc_buffer, unesc_index); next = 0; } while (i < buf_size) { uint8_t b; start_code_found = 0; while (i < buf_size && unesc_index < UNESCAPED_THRESHOLD) { b = buf[i++]; unesc_buffer[unesc_index++] = b; if (search_state <= ONE_ZERO) search_state = b ? NO_MATCH : search_state + 1; else if (search_state == TWO_ZEROS) { if (b == 1) search_state = ONE; else if (b > 1) { if (b == 3) unesc_index--; search_state = NO_MATCH; } } else { search_state = NO_MATCH; start_code_found = 1; break; } } if ((s->flags & PARSER_FLAG_COMPLETE_FRAMES) && unesc_index >= UNESCAPED_THRESHOLD && vpc->prev_start_code == (VC1_CODE_FRAME & 0xFF)) { vc1_extract_header(s, avctx, unesc_buffer, unesc_index); break; } if (unesc_index >= UNESCAPED_THRESHOLD && !start_code_found) { while (i < buf_size) { if (search_state == NO_MATCH) { i += vpc->v.vc1dsp.startcode_find_candidate(buf + i, buf_size - i); if (i < buf_size) { search_state = ONE_ZERO; } i++; } else { b = buf[i++]; if (search_state == ONE_ZERO) search_state = b ? NO_MATCH : TWO_ZEROS; else if (search_state == TWO_ZEROS) { if (b >= 1) search_state = b == 1 ? ONE : NO_MATCH; } else { search_state = NO_MATCH; start_code_found = 1; break; } } } } if (start_code_found) { vc1_extract_header(s, avctx, unesc_buffer, unesc_index); vpc->prev_start_code = b; unesc_index = 0; if (!(s->flags & PARSER_FLAG_COMPLETE_FRAMES)) { if (!pic_found && (b == (VC1_CODE_FRAME & 0xFF) || b == (VC1_CODE_FIELD & 0xFF))) { pic_found = 1; } else if (pic_found && b != (VC1_CODE_FIELD & 0xFF) && b != (VC1_CODE_SLICE & 0xFF)) { next = i - 4; pic_found = b == (VC1_CODE_FRAME & 0xFF); break; } } } } vpc->pc.frame_start_found = pic_found; vpc->unesc_index = unesc_index; vpc->search_state = search_state; if (s->flags & PARSER_FLAG_COMPLETE_FRAMES) { next = buf_size; } else { if (ff_combine_frame(&vpc->pc, next, &buf, &buf_size) < 0) { vpc->bytes_to_skip = 0; *poutbuf = NULL; *poutbuf_size = 0; return buf_size; } } vpc->bytes_to_skip = 4; if (next < 0 && start_code_found) vpc->bytes_to_skip += next; *poutbuf = buf; *poutbuf_size = buf_size; return next; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecParserContext *VAR_0, AVCodecContext *VAR_1, const uint8_t **VAR_2, int *VAR_3, const uint8_t *VAR_4, int VAR_5) { VC1ParseContext *vpc = VAR_0->priv_data; int VAR_6 = vpc->pc.frame_start_found; uint8_t *unesc_buffer = vpc->unesc_buffer; size_t unesc_index = vpc->unesc_index; VC1ParseSearchState search_state = vpc->search_state; int VAR_7; int VAR_8 = END_NOT_FOUND; int VAR_9 = vpc->bytes_to_skip; if (VAR_6 && VAR_5 == 0) { memset(unesc_buffer + unesc_index, 0, UNESCAPED_THRESHOLD - unesc_index); vc1_extract_header(VAR_0, VAR_1, unesc_buffer, unesc_index); VAR_8 = 0; } while (VAR_9 < VAR_5) { uint8_t b; VAR_7 = 0; while (VAR_9 < VAR_5 && unesc_index < UNESCAPED_THRESHOLD) { b = VAR_4[VAR_9++]; unesc_buffer[unesc_index++] = b; if (search_state <= ONE_ZERO) search_state = b ? NO_MATCH : search_state + 1; else if (search_state == TWO_ZEROS) { if (b == 1) search_state = ONE; else if (b > 1) { if (b == 3) unesc_index--; search_state = NO_MATCH; } } else { search_state = NO_MATCH; VAR_7 = 1; break; } } if ((VAR_0->flags & PARSER_FLAG_COMPLETE_FRAMES) && unesc_index >= UNESCAPED_THRESHOLD && vpc->prev_start_code == (VC1_CODE_FRAME & 0xFF)) { vc1_extract_header(VAR_0, VAR_1, unesc_buffer, unesc_index); break; } if (unesc_index >= UNESCAPED_THRESHOLD && !VAR_7) { while (VAR_9 < VAR_5) { if (search_state == NO_MATCH) { VAR_9 += vpc->v.vc1dsp.startcode_find_candidate(VAR_4 + VAR_9, VAR_5 - VAR_9); if (VAR_9 < VAR_5) { search_state = ONE_ZERO; } VAR_9++; } else { b = VAR_4[VAR_9++]; if (search_state == ONE_ZERO) search_state = b ? NO_MATCH : TWO_ZEROS; else if (search_state == TWO_ZEROS) { if (b >= 1) search_state = b == 1 ? ONE : NO_MATCH; } else { search_state = NO_MATCH; VAR_7 = 1; break; } } } } if (VAR_7) { vc1_extract_header(VAR_0, VAR_1, unesc_buffer, unesc_index); vpc->prev_start_code = b; unesc_index = 0; if (!(VAR_0->flags & PARSER_FLAG_COMPLETE_FRAMES)) { if (!VAR_6 && (b == (VC1_CODE_FRAME & 0xFF) || b == (VC1_CODE_FIELD & 0xFF))) { VAR_6 = 1; } else if (VAR_6 && b != (VC1_CODE_FIELD & 0xFF) && b != (VC1_CODE_SLICE & 0xFF)) { VAR_8 = VAR_9 - 4; VAR_6 = b == (VC1_CODE_FRAME & 0xFF); break; } } } } vpc->pc.frame_start_found = VAR_6; vpc->unesc_index = unesc_index; vpc->search_state = search_state; if (VAR_0->flags & PARSER_FLAG_COMPLETE_FRAMES) { VAR_8 = VAR_5; } else { if (ff_combine_frame(&vpc->pc, VAR_8, &VAR_4, &VAR_5) < 0) { vpc->bytes_to_skip = 0; *VAR_2 = NULL; *VAR_3 = 0; return VAR_5; } } vpc->bytes_to_skip = 4; if (VAR_8 < 0 && VAR_7) vpc->bytes_to_skip += VAR_8; *VAR_2 = VAR_4; *VAR_3 = VAR_5; return VAR_8; }
[ "static int FUNC_0(AVCodecParserContext *VAR_0,\nAVCodecContext *VAR_1,\nconst uint8_t **VAR_2, int *VAR_3,\nconst uint8_t *VAR_4, int VAR_5)\n{", "VC1ParseContext *vpc = VAR_0->priv_data;", "int VAR_6 = vpc->pc.frame_start_found;", "uint8_t *unesc_buffer = vpc->unesc_buffer;", "size_t unesc_index = vpc->unesc_index;", "VC1ParseSearchState search_state = vpc->search_state;", "int VAR_7;", "int VAR_8 = END_NOT_FOUND;", "int VAR_9 = vpc->bytes_to_skip;", "if (VAR_6 && VAR_5 == 0) {", "memset(unesc_buffer + unesc_index, 0, UNESCAPED_THRESHOLD - unesc_index);", "vc1_extract_header(VAR_0, VAR_1, unesc_buffer, unesc_index);", "VAR_8 = 0;", "}", "while (VAR_9 < VAR_5) {", "uint8_t b;", "VAR_7 = 0;", "while (VAR_9 < VAR_5 && unesc_index < UNESCAPED_THRESHOLD) {", "b = VAR_4[VAR_9++];", "unesc_buffer[unesc_index++] = b;", "if (search_state <= ONE_ZERO)\nsearch_state = b ? NO_MATCH : search_state + 1;", "else if (search_state == TWO_ZEROS) {", "if (b == 1)\nsearch_state = ONE;", "else if (b > 1) {", "if (b == 3)\nunesc_index--;", "search_state = NO_MATCH;", "}", "}", "else {", "search_state = NO_MATCH;", "VAR_7 = 1;", "break;", "}", "}", "if ((VAR_0->flags & PARSER_FLAG_COMPLETE_FRAMES) &&\nunesc_index >= UNESCAPED_THRESHOLD &&\nvpc->prev_start_code == (VC1_CODE_FRAME & 0xFF))\n{", "vc1_extract_header(VAR_0, VAR_1, unesc_buffer, unesc_index);", "break;", "}", "if (unesc_index >= UNESCAPED_THRESHOLD && !VAR_7) {", "while (VAR_9 < VAR_5) {", "if (search_state == NO_MATCH) {", "VAR_9 += vpc->v.vc1dsp.startcode_find_candidate(VAR_4 + VAR_9, VAR_5 - VAR_9);", "if (VAR_9 < VAR_5) {", "search_state = ONE_ZERO;", "}", "VAR_9++;", "} else {", "b = VAR_4[VAR_9++];", "if (search_state == ONE_ZERO)\nsearch_state = b ? NO_MATCH : TWO_ZEROS;", "else if (search_state == TWO_ZEROS) {", "if (b >= 1)\nsearch_state = b == 1 ? ONE : NO_MATCH;", "}", "else {", "search_state = NO_MATCH;", "VAR_7 = 1;", "break;", "}", "}", "}", "}", "if (VAR_7) {", "vc1_extract_header(VAR_0, VAR_1, unesc_buffer, unesc_index);", "vpc->prev_start_code = b;", "unesc_index = 0;", "if (!(VAR_0->flags & PARSER_FLAG_COMPLETE_FRAMES)) {", "if (!VAR_6 && (b == (VC1_CODE_FRAME & 0xFF) || b == (VC1_CODE_FIELD & 0xFF))) {", "VAR_6 = 1;", "}", "else if (VAR_6 && b != (VC1_CODE_FIELD & 0xFF) && b != (VC1_CODE_SLICE & 0xFF)) {", "VAR_8 = VAR_9 - 4;", "VAR_6 = b == (VC1_CODE_FRAME & 0xFF);", "break;", "}", "}", "}", "}", "vpc->pc.frame_start_found = VAR_6;", "vpc->unesc_index = unesc_index;", "vpc->search_state = search_state;", "if (VAR_0->flags & PARSER_FLAG_COMPLETE_FRAMES) {", "VAR_8 = VAR_5;", "} else {", "if (ff_combine_frame(&vpc->pc, VAR_8, &VAR_4, &VAR_5) < 0) {", "vpc->bytes_to_skip = 0;", "*VAR_2 = NULL;", "*VAR_3 = 0;", "return VAR_5;", "}", "}", "vpc->bytes_to_skip = 4;", "if (VAR_8 < 0 && VAR_7)\nvpc->bytes_to_skip += VAR_8;", "*VAR_2 = VAR_4;", "*VAR_3 = VAR_5;", "return VAR_8;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 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 ], [ 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 ], [ 169 ], [ 171 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 201 ], [ 203 ], [ 205 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 245 ], [ 247, 249 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ] ]
4,634
static void bdrv_co_complete(BlockAIOCBCoroutine *acb) { if (!acb->need_bh) { acb->common.cb(acb->common.opaque, acb->req.error); qemu_aio_unref(acb); } }
false
qemu
61007b316cd71ee7333ff7a0a749a8949527575f
static void bdrv_co_complete(BlockAIOCBCoroutine *acb) { if (!acb->need_bh) { acb->common.cb(acb->common.opaque, acb->req.error); qemu_aio_unref(acb); } }
{ "code": [], "line_no": [] }
static void FUNC_0(BlockAIOCBCoroutine *VAR_0) { if (!VAR_0->need_bh) { VAR_0->common.cb(VAR_0->common.opaque, VAR_0->req.error); qemu_aio_unref(VAR_0); } }
[ "static void FUNC_0(BlockAIOCBCoroutine *VAR_0)\n{", "if (!VAR_0->need_bh) {", "VAR_0->common.cb(VAR_0->common.opaque, VAR_0->req.error);", "qemu_aio_unref(VAR_0);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ] ]
4,635
QObject *qmp_output_get_qobject(QmpOutputVisitor *qov) { /* FIXME: we should require that a visit occurred, and that it is * complete (no starts without a matching end) */ QObject *obj = qov->root; if (obj) { qobject_incref(obj); } else { obj = qnull(); } return obj; }
false
qemu
56a6f02b8ce1fe41a2a9077593e46eca7d98267d
QObject *qmp_output_get_qobject(QmpOutputVisitor *qov) { QObject *obj = qov->root; if (obj) { qobject_incref(obj); } else { obj = qnull(); } return obj; }
{ "code": [], "line_no": [] }
QObject *FUNC_0(QmpOutputVisitor *qov) { QObject *obj = qov->root; if (obj) { qobject_incref(obj); } else { obj = qnull(); } return obj; }
[ "QObject *FUNC_0(QmpOutputVisitor *qov)\n{", "QObject *obj = qov->root;", "if (obj) {", "qobject_incref(obj);", "} else {", "obj = qnull();", "}", "return obj;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ] ]
4,637
eeprom_t *eeprom93xx_new(DeviceState *dev, uint16_t nwords) { /* Add a new EEPROM (with 16, 64 or 256 words). */ eeprom_t *eeprom; uint8_t addrbits; switch (nwords) { case 16: case 64: addrbits = 6; break; case 128: case 256: addrbits = 8; break; default: assert(!"Unsupported EEPROM size, fallback to 64 words!"); nwords = 64; addrbits = 6; } eeprom = (eeprom_t *)g_malloc0(sizeof(*eeprom) + nwords * 2); eeprom->size = nwords; eeprom->addrbits = addrbits; /* Output DO is tristate, read results in 1. */ eeprom->eedo = 1; logout("eeprom = 0x%p, nwords = %u\n", eeprom, nwords); vmstate_register(dev, 0, &vmstate_eeprom, eeprom); return eeprom; }
false
qemu
6fedcaa1c5419fa89c31fd34dabbd71861c615d2
eeprom_t *eeprom93xx_new(DeviceState *dev, uint16_t nwords) { eeprom_t *eeprom; uint8_t addrbits; switch (nwords) { case 16: case 64: addrbits = 6; break; case 128: case 256: addrbits = 8; break; default: assert(!"Unsupported EEPROM size, fallback to 64 words!"); nwords = 64; addrbits = 6; } eeprom = (eeprom_t *)g_malloc0(sizeof(*eeprom) + nwords * 2); eeprom->size = nwords; eeprom->addrbits = addrbits; eeprom->eedo = 1; logout("eeprom = 0x%p, nwords = %u\n", eeprom, nwords); vmstate_register(dev, 0, &vmstate_eeprom, eeprom); return eeprom; }
{ "code": [], "line_no": [] }
eeprom_t *FUNC_0(DeviceState *dev, uint16_t nwords) { eeprom_t *eeprom; uint8_t addrbits; switch (nwords) { case 16: case 64: addrbits = 6; break; case 128: case 256: addrbits = 8; break; default: assert(!"Unsupported EEPROM size, fallback to 64 words!"); nwords = 64; addrbits = 6; } eeprom = (eeprom_t *)g_malloc0(sizeof(*eeprom) + nwords * 2); eeprom->size = nwords; eeprom->addrbits = addrbits; eeprom->eedo = 1; logout("eeprom = 0x%p, nwords = %u\n", eeprom, nwords); vmstate_register(dev, 0, &vmstate_eeprom, eeprom); return eeprom; }
[ "eeprom_t *FUNC_0(DeviceState *dev, uint16_t nwords)\n{", "eeprom_t *eeprom;", "uint8_t addrbits;", "switch (nwords) {", "case 16:\ncase 64:\naddrbits = 6;", "break;", "case 128:\ncase 256:\naddrbits = 8;", "break;", "default:\nassert(!\"Unsupported EEPROM size, fallback to 64 words!\");", "nwords = 64;", "addrbits = 6;", "}", "eeprom = (eeprom_t *)g_malloc0(sizeof(*eeprom) + nwords * 2);", "eeprom->size = nwords;", "eeprom->addrbits = addrbits;", "eeprom->eedo = 1;", "logout(\"eeprom = 0x%p, nwords = %u\\n\", eeprom, nwords);", "vmstate_register(dev, 0, &vmstate_eeprom, eeprom);", "return eeprom;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 7 ], [ 9 ], [ 13 ], [ 15, 17, 19 ], [ 21 ], [ 23, 25, 27 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ] ]
4,638
static void cdrom_change_cb(void *opaque) { IDEState *s = opaque; uint64_t nb_sectors; /* XXX: send interrupt too */ bdrv_get_geometry(s->bs, &nb_sectors); s->nb_sectors = nb_sectors; }
false
qemu
9118e7f08f39001c92d595090b41305ef45c200a
static void cdrom_change_cb(void *opaque) { IDEState *s = opaque; uint64_t nb_sectors; bdrv_get_geometry(s->bs, &nb_sectors); s->nb_sectors = nb_sectors; }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0) { IDEState *s = VAR_0; uint64_t nb_sectors; bdrv_get_geometry(s->bs, &nb_sectors); s->nb_sectors = nb_sectors; }
[ "static void FUNC_0(void *VAR_0)\n{", "IDEState *s = VAR_0;", "uint64_t nb_sectors;", "bdrv_get_geometry(s->bs, &nb_sectors);", "s->nb_sectors = nb_sectors;", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 13 ], [ 15 ], [ 17 ] ]
4,641
void *qpci_legacy_iomap(QPCIDevice *dev, uint16_t addr) { return (void *)(uintptr_t)addr; }
true
qemu
b4ba67d9a702507793c2724e56f98e9b0f7be02b
void *qpci_legacy_iomap(QPCIDevice *dev, uint16_t addr) { return (void *)(uintptr_t)addr; }
{ "code": [ "void *qpci_legacy_iomap(QPCIDevice *dev, uint16_t addr)", " return (void *)(uintptr_t)addr;" ], "line_no": [ 1, 5 ] }
void *FUNC_0(QPCIDevice *VAR_0, uint16_t VAR_1) { return (void *)(uintptr_t)VAR_1; }
[ "void *FUNC_0(QPCIDevice *VAR_0, uint16_t VAR_1)\n{", "return (void *)(uintptr_t)VAR_1;", "}" ]
[ 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
4,642
static void trace(TraceEventID event, uint64_t x1, uint64_t x2, uint64_t x3, uint64_t x4, uint64_t x5, uint64_t x6) { TraceRecord *rec = &trace_buf[trace_idx]; if (!trace_list[event].state) { return; } rec->event = event; rec->timestamp_ns = get_clock(); rec->x1 = x1; rec->x2 = x2; rec->x3 = x3; rec->x4 = x4; rec->x5 = x5; rec->x6 = x6; if (++trace_idx == TRACE_BUF_LEN) { st_flush_trace_buffer(); } }
true
qemu
0b5538c300a56c3cfb33022840fe0b4968147e7a
static void trace(TraceEventID event, uint64_t x1, uint64_t x2, uint64_t x3, uint64_t x4, uint64_t x5, uint64_t x6) { TraceRecord *rec = &trace_buf[trace_idx]; if (!trace_list[event].state) { return; } rec->event = event; rec->timestamp_ns = get_clock(); rec->x1 = x1; rec->x2 = x2; rec->x3 = x3; rec->x4 = x4; rec->x5 = x5; rec->x6 = x6; if (++trace_idx == TRACE_BUF_LEN) { st_flush_trace_buffer(); } }
{ "code": [ " TraceRecord *rec = &trace_buf[trace_idx];", " rec->event = event;", " rec->timestamp_ns = get_clock();", " rec->x1 = x1;", " rec->x2 = x2;", " rec->x3 = x3;", " rec->x4 = x4;", " rec->x5 = x5;", " rec->x6 = x6;", " if (++trace_idx == TRACE_BUF_LEN) {", " st_flush_trace_buffer();" ], "line_no": [ 7, 19, 21, 23, 25, 27, 29, 31, 33, 37, 39 ] }
static void FUNC_0(TraceEventID VAR_0, uint64_t VAR_1, uint64_t VAR_2, uint64_t VAR_3, uint64_t VAR_4, uint64_t VAR_5, uint64_t VAR_6) { TraceRecord *rec = &trace_buf[trace_idx]; if (!trace_list[VAR_0].state) { return; } rec->VAR_0 = VAR_0; rec->timestamp_ns = get_clock(); rec->VAR_1 = VAR_1; rec->VAR_2 = VAR_2; rec->VAR_3 = VAR_3; rec->VAR_4 = VAR_4; rec->VAR_5 = VAR_5; rec->VAR_6 = VAR_6; if (++trace_idx == TRACE_BUF_LEN) { st_flush_trace_buffer(); } }
[ "static void FUNC_0(TraceEventID VAR_0, uint64_t VAR_1, uint64_t VAR_2, uint64_t VAR_3,\nuint64_t VAR_4, uint64_t VAR_5, uint64_t VAR_6)\n{", "TraceRecord *rec = &trace_buf[trace_idx];", "if (!trace_list[VAR_0].state) {", "return;", "}", "rec->VAR_0 = VAR_0;", "rec->timestamp_ns = get_clock();", "rec->VAR_1 = VAR_1;", "rec->VAR_2 = VAR_2;", "rec->VAR_3 = VAR_3;", "rec->VAR_4 = VAR_4;", "rec->VAR_5 = VAR_5;", "rec->VAR_6 = VAR_6;", "if (++trace_idx == TRACE_BUF_LEN) {", "st_flush_trace_buffer();", "}", "}" ]
[ 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ] ]
4,643
static void gen_intermediate_code_internal(CPULM32State *env, TranslationBlock *tb, int search_pc) { struct DisasContext ctx, *dc = &ctx; uint16_t *gen_opc_end; uint32_t pc_start; int j, lj; uint32_t next_page_start; int num_insns; int max_insns; qemu_log_try_set_file(stderr); pc_start = tb->pc; dc->env = env; dc->tb = tb; gen_opc_end = tcg_ctx.gen_opc_buf + OPC_MAX_SIZE; dc->is_jmp = DISAS_NEXT; dc->pc = pc_start; dc->singlestep_enabled = env->singlestep_enabled; dc->nr_nops = 0; if (pc_start & 3) { cpu_abort(env, "LM32: unaligned PC=%x\n", pc_start); } if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) { qemu_log("-----------------------------------------\n"); log_cpu_state(env, 0); } next_page_start = (pc_start & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE; lj = -1; num_insns = 0; max_insns = tb->cflags & CF_COUNT_MASK; if (max_insns == 0) { max_insns = CF_COUNT_MASK; } gen_icount_start(); do { check_breakpoint(env, dc); if (search_pc) { j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf; if (lj < j) { lj++; while (lj < j) { tcg_ctx.gen_opc_instr_start[lj++] = 0; } } tcg_ctx.gen_opc_pc[lj] = dc->pc; tcg_ctx.gen_opc_instr_start[lj] = 1; tcg_ctx.gen_opc_icount[lj] = num_insns; } /* Pretty disas. */ LOG_DIS("%8.8x:\t", dc->pc); if (num_insns + 1 == max_insns && (tb->cflags & CF_LAST_IO)) { gen_io_start(); } decode(dc, cpu_ldl_code(env, dc->pc)); dc->pc += 4; num_insns++; } while (!dc->is_jmp && tcg_ctx.gen_opc_ptr < gen_opc_end && !env->singlestep_enabled && !singlestep && (dc->pc < next_page_start) && num_insns < max_insns); if (tb->cflags & CF_LAST_IO) { gen_io_end(); } if (unlikely(env->singlestep_enabled)) { if (dc->is_jmp == DISAS_NEXT) { tcg_gen_movi_tl(cpu_pc, dc->pc); } t_gen_raise_exception(dc, EXCP_DEBUG); } else { switch (dc->is_jmp) { case DISAS_NEXT: gen_goto_tb(dc, 1, dc->pc); break; default: case DISAS_JUMP: case DISAS_UPDATE: /* indicate that the hash table must be used to find the next TB */ tcg_gen_exit_tb(0); break; case DISAS_TB_JUMP: /* nothing more to generate */ break; } } gen_icount_end(tb, num_insns); *tcg_ctx.gen_opc_ptr = INDEX_op_end; if (search_pc) { j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf; lj++; while (lj <= j) { tcg_ctx.gen_opc_instr_start[lj++] = 0; } } else { tb->size = dc->pc - pc_start; tb->icount = num_insns; } #ifdef DEBUG_DISAS if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) { qemu_log("\n"); log_target_disas(env, pc_start, dc->pc - pc_start, 0); qemu_log("\nisize=%d osize=%td\n", dc->pc - pc_start, tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf); } #endif }
true
qemu
632314c49ce20ee9c974f07544d9125fbbbfbe1b
static void gen_intermediate_code_internal(CPULM32State *env, TranslationBlock *tb, int search_pc) { struct DisasContext ctx, *dc = &ctx; uint16_t *gen_opc_end; uint32_t pc_start; int j, lj; uint32_t next_page_start; int num_insns; int max_insns; qemu_log_try_set_file(stderr); pc_start = tb->pc; dc->env = env; dc->tb = tb; gen_opc_end = tcg_ctx.gen_opc_buf + OPC_MAX_SIZE; dc->is_jmp = DISAS_NEXT; dc->pc = pc_start; dc->singlestep_enabled = env->singlestep_enabled; dc->nr_nops = 0; if (pc_start & 3) { cpu_abort(env, "LM32: unaligned PC=%x\n", pc_start); } if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) { qemu_log("-----------------------------------------\n"); log_cpu_state(env, 0); } next_page_start = (pc_start & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE; lj = -1; num_insns = 0; max_insns = tb->cflags & CF_COUNT_MASK; if (max_insns == 0) { max_insns = CF_COUNT_MASK; } gen_icount_start(); do { check_breakpoint(env, dc); if (search_pc) { j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf; if (lj < j) { lj++; while (lj < j) { tcg_ctx.gen_opc_instr_start[lj++] = 0; } } tcg_ctx.gen_opc_pc[lj] = dc->pc; tcg_ctx.gen_opc_instr_start[lj] = 1; tcg_ctx.gen_opc_icount[lj] = num_insns; } LOG_DIS("%8.8x:\t", dc->pc); if (num_insns + 1 == max_insns && (tb->cflags & CF_LAST_IO)) { gen_io_start(); } decode(dc, cpu_ldl_code(env, dc->pc)); dc->pc += 4; num_insns++; } while (!dc->is_jmp && tcg_ctx.gen_opc_ptr < gen_opc_end && !env->singlestep_enabled && !singlestep && (dc->pc < next_page_start) && num_insns < max_insns); if (tb->cflags & CF_LAST_IO) { gen_io_end(); } if (unlikely(env->singlestep_enabled)) { if (dc->is_jmp == DISAS_NEXT) { tcg_gen_movi_tl(cpu_pc, dc->pc); } t_gen_raise_exception(dc, EXCP_DEBUG); } else { switch (dc->is_jmp) { case DISAS_NEXT: gen_goto_tb(dc, 1, dc->pc); break; default: case DISAS_JUMP: case DISAS_UPDATE: tcg_gen_exit_tb(0); break; case DISAS_TB_JUMP: break; } } gen_icount_end(tb, num_insns); *tcg_ctx.gen_opc_ptr = INDEX_op_end; if (search_pc) { j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf; lj++; while (lj <= j) { tcg_ctx.gen_opc_instr_start[lj++] = 0; } } else { tb->size = dc->pc - pc_start; tb->icount = num_insns; } #ifdef DEBUG_DISAS if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) { qemu_log("\n"); log_target_disas(env, pc_start, dc->pc - pc_start, 0); qemu_log("\nisize=%d osize=%td\n", dc->pc - pc_start, tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf); } #endif }
{ "code": [ " qemu_log_try_set_file(stderr);", " qemu_log_try_set_file(stderr);", " qemu_log_try_set_file(stderr);", " qemu_log_try_set_file(stderr);" ], "line_no": [ 23, 23, 23, 23 ] }
static void FUNC_0(CPULM32State *VAR_0, TranslationBlock *VAR_1, int VAR_2) { struct DisasContext VAR_3, *VAR_4 = &VAR_3; uint16_t *gen_opc_end; uint32_t pc_start; int VAR_5, VAR_6; uint32_t next_page_start; int VAR_7; int VAR_8; qemu_log_try_set_file(stderr); pc_start = VAR_1->pc; VAR_4->VAR_0 = VAR_0; VAR_4->VAR_1 = VAR_1; gen_opc_end = tcg_ctx.gen_opc_buf + OPC_MAX_SIZE; VAR_4->is_jmp = DISAS_NEXT; VAR_4->pc = pc_start; VAR_4->singlestep_enabled = VAR_0->singlestep_enabled; VAR_4->nr_nops = 0; if (pc_start & 3) { cpu_abort(VAR_0, "LM32: unaligned PC=%x\n", pc_start); } if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) { qemu_log("-----------------------------------------\n"); log_cpu_state(VAR_0, 0); } next_page_start = (pc_start & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE; VAR_6 = -1; VAR_7 = 0; VAR_8 = VAR_1->cflags & CF_COUNT_MASK; if (VAR_8 == 0) { VAR_8 = CF_COUNT_MASK; } gen_icount_start(); do { check_breakpoint(VAR_0, VAR_4); if (VAR_2) { VAR_5 = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf; if (VAR_6 < VAR_5) { VAR_6++; while (VAR_6 < VAR_5) { tcg_ctx.gen_opc_instr_start[VAR_6++] = 0; } } tcg_ctx.gen_opc_pc[VAR_6] = VAR_4->pc; tcg_ctx.gen_opc_instr_start[VAR_6] = 1; tcg_ctx.gen_opc_icount[VAR_6] = VAR_7; } LOG_DIS("%8.8x:\t", VAR_4->pc); if (VAR_7 + 1 == VAR_8 && (VAR_1->cflags & CF_LAST_IO)) { gen_io_start(); } decode(VAR_4, cpu_ldl_code(VAR_0, VAR_4->pc)); VAR_4->pc += 4; VAR_7++; } while (!VAR_4->is_jmp && tcg_ctx.gen_opc_ptr < gen_opc_end && !VAR_0->singlestep_enabled && !singlestep && (VAR_4->pc < next_page_start) && VAR_7 < VAR_8); if (VAR_1->cflags & CF_LAST_IO) { gen_io_end(); } if (unlikely(VAR_0->singlestep_enabled)) { if (VAR_4->is_jmp == DISAS_NEXT) { tcg_gen_movi_tl(cpu_pc, VAR_4->pc); } t_gen_raise_exception(VAR_4, EXCP_DEBUG); } else { switch (VAR_4->is_jmp) { case DISAS_NEXT: gen_goto_tb(VAR_4, 1, VAR_4->pc); break; default: case DISAS_JUMP: case DISAS_UPDATE: tcg_gen_exit_tb(0); break; case DISAS_TB_JUMP: break; } } gen_icount_end(VAR_1, VAR_7); *tcg_ctx.gen_opc_ptr = INDEX_op_end; if (VAR_2) { VAR_5 = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf; VAR_6++; while (VAR_6 <= VAR_5) { tcg_ctx.gen_opc_instr_start[VAR_6++] = 0; } } else { VAR_1->size = VAR_4->pc - pc_start; VAR_1->icount = VAR_7; } #ifdef DEBUG_DISAS if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) { qemu_log("\n"); log_target_disas(VAR_0, pc_start, VAR_4->pc - pc_start, 0); qemu_log("\nisize=%d osize=%td\n", VAR_4->pc - pc_start, tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf); } #endif }
[ "static void FUNC_0(CPULM32State *VAR_0,\nTranslationBlock *VAR_1, int VAR_2)\n{", "struct DisasContext VAR_3, *VAR_4 = &VAR_3;", "uint16_t *gen_opc_end;", "uint32_t pc_start;", "int VAR_5, VAR_6;", "uint32_t next_page_start;", "int VAR_7;", "int VAR_8;", "qemu_log_try_set_file(stderr);", "pc_start = VAR_1->pc;", "VAR_4->VAR_0 = VAR_0;", "VAR_4->VAR_1 = VAR_1;", "gen_opc_end = tcg_ctx.gen_opc_buf + OPC_MAX_SIZE;", "VAR_4->is_jmp = DISAS_NEXT;", "VAR_4->pc = pc_start;", "VAR_4->singlestep_enabled = VAR_0->singlestep_enabled;", "VAR_4->nr_nops = 0;", "if (pc_start & 3) {", "cpu_abort(VAR_0, \"LM32: unaligned PC=%x\\n\", pc_start);", "}", "if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) {", "qemu_log(\"-----------------------------------------\\n\");", "log_cpu_state(VAR_0, 0);", "}", "next_page_start = (pc_start & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE;", "VAR_6 = -1;", "VAR_7 = 0;", "VAR_8 = VAR_1->cflags & CF_COUNT_MASK;", "if (VAR_8 == 0) {", "VAR_8 = CF_COUNT_MASK;", "}", "gen_icount_start();", "do {", "check_breakpoint(VAR_0, VAR_4);", "if (VAR_2) {", "VAR_5 = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;", "if (VAR_6 < VAR_5) {", "VAR_6++;", "while (VAR_6 < VAR_5) {", "tcg_ctx.gen_opc_instr_start[VAR_6++] = 0;", "}", "}", "tcg_ctx.gen_opc_pc[VAR_6] = VAR_4->pc;", "tcg_ctx.gen_opc_instr_start[VAR_6] = 1;", "tcg_ctx.gen_opc_icount[VAR_6] = VAR_7;", "}", "LOG_DIS(\"%8.8x:\\t\", VAR_4->pc);", "if (VAR_7 + 1 == VAR_8 && (VAR_1->cflags & CF_LAST_IO)) {", "gen_io_start();", "}", "decode(VAR_4, cpu_ldl_code(VAR_0, VAR_4->pc));", "VAR_4->pc += 4;", "VAR_7++;", "} while (!VAR_4->is_jmp", "&& tcg_ctx.gen_opc_ptr < gen_opc_end\n&& !VAR_0->singlestep_enabled\n&& !singlestep\n&& (VAR_4->pc < next_page_start)\n&& VAR_7 < VAR_8);", "if (VAR_1->cflags & CF_LAST_IO) {", "gen_io_end();", "}", "if (unlikely(VAR_0->singlestep_enabled)) {", "if (VAR_4->is_jmp == DISAS_NEXT) {", "tcg_gen_movi_tl(cpu_pc, VAR_4->pc);", "}", "t_gen_raise_exception(VAR_4, EXCP_DEBUG);", "} else {", "switch (VAR_4->is_jmp) {", "case DISAS_NEXT:\ngen_goto_tb(VAR_4, 1, VAR_4->pc);", "break;", "default:\ncase DISAS_JUMP:\ncase DISAS_UPDATE:\ntcg_gen_exit_tb(0);", "break;", "case DISAS_TB_JUMP:\nbreak;", "}", "}", "gen_icount_end(VAR_1, VAR_7);", "*tcg_ctx.gen_opc_ptr = INDEX_op_end;", "if (VAR_2) {", "VAR_5 = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;", "VAR_6++;", "while (VAR_6 <= VAR_5) {", "tcg_ctx.gen_opc_instr_start[VAR_6++] = 0;", "}", "} else {", "VAR_1->size = VAR_4->pc - pc_start;", "VAR_1->icount = VAR_7;", "}", "#ifdef DEBUG_DISAS\nif (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) {", "qemu_log(\"\\n\");", "log_target_disas(VAR_0, pc_start, VAR_4->pc - pc_start, 0);", "qemu_log(\"\\nisize=%d osize=%td\\n\",\nVAR_4->pc - pc_start, tcg_ctx.gen_opc_ptr -\ntcg_ctx.gen_opc_buf);", "}", "#endif\n}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 85 ], [ 87 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 119 ], [ 123 ], [ 125 ], [ 127 ], [ 131 ], [ 133 ], [ 135 ], [ 139 ], [ 141, 143, 145, 147, 149 ], [ 153 ], [ 155 ], [ 157 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175, 177 ], [ 179 ], [ 181, 183, 185, 191 ], [ 193 ], [ 195, 199 ], [ 201 ], [ 203 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 233, 235 ], [ 237 ], [ 239 ], [ 241, 243, 245 ], [ 247 ], [ 249, 251 ] ]
4,644
void acpi_gpe_init(ACPIREGS *ar, uint8_t len) { ar->gpe.len = len; ar->gpe.sts = g_malloc0(len / 2); ar->gpe.en = g_malloc0(len / 2); }
true
qemu
d9a3b33d2c9f996537b7f1d0246dee2d0120cefb
void acpi_gpe_init(ACPIREGS *ar, uint8_t len) { ar->gpe.len = len; ar->gpe.sts = g_malloc0(len / 2); ar->gpe.en = g_malloc0(len / 2); }
{ "code": [ " ar->gpe.sts = g_malloc0(len / 2);", " ar->gpe.en = g_malloc0(len / 2);" ], "line_no": [ 7, 9 ] }
void FUNC_0(ACPIREGS *VAR_0, uint8_t VAR_1) { VAR_0->gpe.VAR_1 = VAR_1; VAR_0->gpe.sts = g_malloc0(VAR_1 / 2); VAR_0->gpe.en = g_malloc0(VAR_1 / 2); }
[ "void FUNC_0(ACPIREGS *VAR_0, uint8_t VAR_1)\n{", "VAR_0->gpe.VAR_1 = VAR_1;", "VAR_0->gpe.sts = g_malloc0(VAR_1 / 2);", "VAR_0->gpe.en = g_malloc0(VAR_1 / 2);", "}" ]
[ 0, 0, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ] ]
4,646
static void xtensa_cpu_initfn(Object *obj) { CPUState *cs = CPU(obj); XtensaCPU *cpu = XTENSA_CPU(obj); XtensaCPUClass *xcc = XTENSA_CPU_GET_CLASS(obj); CPUXtensaState *env = &cpu->env; static bool tcg_inited; cs->env_ptr = env; env->config = xcc->config; cpu_exec_init(cs, &error_abort); if (tcg_enabled() && !tcg_inited) { tcg_inited = true; xtensa_translate_init(); } }
true
qemu
ce5b1bbf624b977a55ff7f85bb3871682d03baff
static void xtensa_cpu_initfn(Object *obj) { CPUState *cs = CPU(obj); XtensaCPU *cpu = XTENSA_CPU(obj); XtensaCPUClass *xcc = XTENSA_CPU_GET_CLASS(obj); CPUXtensaState *env = &cpu->env; static bool tcg_inited; cs->env_ptr = env; env->config = xcc->config; cpu_exec_init(cs, &error_abort); if (tcg_enabled() && !tcg_inited) { tcg_inited = true; xtensa_translate_init(); } }
{ "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": [ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 ] }
static void FUNC_0(Object *VAR_0) { CPUState *cs = CPU(VAR_0); XtensaCPU *cpu = XTENSA_CPU(VAR_0); XtensaCPUClass *xcc = XTENSA_CPU_GET_CLASS(VAR_0); CPUXtensaState *env = &cpu->env; static bool VAR_1; cs->env_ptr = env; env->config = xcc->config; cpu_exec_init(cs, &error_abort); if (tcg_enabled() && !VAR_1) { VAR_1 = true; xtensa_translate_init(); } }
[ "static void FUNC_0(Object *VAR_0)\n{", "CPUState *cs = CPU(VAR_0);", "XtensaCPU *cpu = XTENSA_CPU(VAR_0);", "XtensaCPUClass *xcc = XTENSA_CPU_GET_CLASS(VAR_0);", "CPUXtensaState *env = &cpu->env;", "static bool VAR_1;", "cs->env_ptr = env;", "env->config = xcc->config;", "cpu_exec_init(cs, &error_abort);", "if (tcg_enabled() && !VAR_1) {", "VAR_1 = true;", "xtensa_translate_init();", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ] ]
4,648
static void dp8393x_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); set_bit(DEVICE_CATEGORY_NETWORK, dc->categories); dc->realize = dp8393x_realize; dc->reset = dp8393x_reset; dc->vmsd = &vmstate_dp8393x; dc->props = dp8393x_properties; }
true
qemu
f6351288b65130deb8102b17143f5d84f817a02a
static void dp8393x_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); set_bit(DEVICE_CATEGORY_NETWORK, dc->categories); dc->realize = dp8393x_realize; dc->reset = dp8393x_reset; dc->vmsd = &vmstate_dp8393x; dc->props = dp8393x_properties; }
{ "code": [], "line_no": [] }
static void FUNC_0(ObjectClass *VAR_0, void *VAR_1) { DeviceClass *dc = DEVICE_CLASS(VAR_0); set_bit(DEVICE_CATEGORY_NETWORK, dc->categories); dc->realize = dp8393x_realize; dc->reset = dp8393x_reset; dc->vmsd = &vmstate_dp8393x; dc->props = dp8393x_properties; }
[ "static void FUNC_0(ObjectClass *VAR_0, void *VAR_1)\n{", "DeviceClass *dc = DEVICE_CLASS(VAR_0);", "set_bit(DEVICE_CATEGORY_NETWORK, dc->categories);", "dc->realize = dp8393x_realize;", "dc->reset = dp8393x_reset;", "dc->vmsd = &vmstate_dp8393x;", "dc->props = dp8393x_properties;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ] ]
4,649
static int mjpeg_decode_sof0(MJpegDecodeContext *s, UINT8 *buf, int buf_size) { int len, nb_components, i, width, height; init_get_bits(&s->gb, buf, buf_size); /* XXX: verify len field validity */ len = get_bits(&s->gb, 16); /* only 8 bits/component accepted */ if (get_bits(&s->gb, 8) != 8) return -1; height = get_bits(&s->gb, 16); width = get_bits(&s->gb, 16); nb_components = get_bits(&s->gb, 8); if (nb_components <= 0 || nb_components > MAX_COMPONENTS) return -1; s->nb_components = nb_components; s->h_max = 1; s->v_max = 1; for(i=0;i<nb_components;i++) { /* component id */ s->component_id[i] = get_bits(&s->gb, 8) - 1; s->h_count[i] = get_bits(&s->gb, 4); s->v_count[i] = get_bits(&s->gb, 4); /* compute hmax and vmax (only used in interleaved case) */ if (s->h_count[i] > s->h_max) s->h_max = s->h_count[i]; if (s->v_count[i] > s->v_max) s->v_max = s->v_count[i]; s->quant_index[i] = get_bits(&s->gb, 8); if (s->quant_index[i] >= 4) return -1; dprintf("component %d %d:%d\n", i, s->h_count[i], s->v_count[i]); } /* if different size, realloc/alloc picture */ /* XXX: also check h_count and v_count */ if (width != s->width || height != s->height) { for(i=0;i<MAX_COMPONENTS;i++) { free(s->current_picture[i]); s->current_picture[i] = NULL; } s->width = width; s->height = height; /* test interlaced mode */ if (s->first_picture && s->org_height != 0 && s->height < ((s->org_height * 3) / 4)) { s->interlaced = 1; s->bottom_field = 0; } for(i=0;i<nb_components;i++) { int w, h; w = (s->width + 8 * s->h_max - 1) / (8 * s->h_max); h = (s->height + 8 * s->v_max - 1) / (8 * s->v_max); w = w * 8 * s->h_count[i]; h = h * 8 * s->v_count[i]; if (s->interlaced) w *= 2; s->linesize[i] = w; /* memory test is done in mjpeg_decode_sos() */ s->current_picture[i] = av_mallocz(w * h); } s->first_picture = 0; } if (len != 8+(3*nb_components)) dprintf("decode_sof0: error, len(%d) mismatch\n", len); return 0; }
true
FFmpeg
af289048d8f720743ed82a4e674cff01ab02a836
static int mjpeg_decode_sof0(MJpegDecodeContext *s, UINT8 *buf, int buf_size) { int len, nb_components, i, width, height; init_get_bits(&s->gb, buf, buf_size); len = get_bits(&s->gb, 16); if (get_bits(&s->gb, 8) != 8) return -1; height = get_bits(&s->gb, 16); width = get_bits(&s->gb, 16); nb_components = get_bits(&s->gb, 8); if (nb_components <= 0 || nb_components > MAX_COMPONENTS) return -1; s->nb_components = nb_components; s->h_max = 1; s->v_max = 1; for(i=0;i<nb_components;i++) { s->component_id[i] = get_bits(&s->gb, 8) - 1; s->h_count[i] = get_bits(&s->gb, 4); s->v_count[i] = get_bits(&s->gb, 4); if (s->h_count[i] > s->h_max) s->h_max = s->h_count[i]; if (s->v_count[i] > s->v_max) s->v_max = s->v_count[i]; s->quant_index[i] = get_bits(&s->gb, 8); if (s->quant_index[i] >= 4) return -1; dprintf("component %d %d:%d\n", i, s->h_count[i], s->v_count[i]); } if (width != s->width || height != s->height) { for(i=0;i<MAX_COMPONENTS;i++) { free(s->current_picture[i]); s->current_picture[i] = NULL; } s->width = width; s->height = height; if (s->first_picture && s->org_height != 0 && s->height < ((s->org_height * 3) / 4)) { s->interlaced = 1; s->bottom_field = 0; } for(i=0;i<nb_components;i++) { int w, h; w = (s->width + 8 * s->h_max - 1) / (8 * s->h_max); h = (s->height + 8 * s->v_max - 1) / (8 * s->v_max); w = w * 8 * s->h_count[i]; h = h * 8 * s->v_count[i]; if (s->interlaced) w *= 2; s->linesize[i] = w; s->current_picture[i] = av_mallocz(w * h); } s->first_picture = 0; } if (len != 8+(3*nb_components)) dprintf("decode_sof0: error, len(%d) mismatch\n", len); return 0; }
{ "code": [ " if (len != 8+(3*nb_components))" ], "line_no": [ 141 ] }
static int FUNC_0(MJpegDecodeContext *VAR_0, UINT8 *VAR_1, int VAR_2) { int VAR_3, VAR_4, VAR_5, VAR_6, VAR_7; init_get_bits(&VAR_0->gb, VAR_1, VAR_2); VAR_3 = get_bits(&VAR_0->gb, 16); if (get_bits(&VAR_0->gb, 8) != 8) return -1; VAR_7 = get_bits(&VAR_0->gb, 16); VAR_6 = get_bits(&VAR_0->gb, 16); VAR_4 = get_bits(&VAR_0->gb, 8); if (VAR_4 <= 0 || VAR_4 > MAX_COMPONENTS) return -1; VAR_0->VAR_4 = VAR_4; VAR_0->h_max = 1; VAR_0->v_max = 1; for(VAR_5=0;VAR_5<VAR_4;VAR_5++) { VAR_0->component_id[VAR_5] = get_bits(&VAR_0->gb, 8) - 1; VAR_0->h_count[VAR_5] = get_bits(&VAR_0->gb, 4); VAR_0->v_count[VAR_5] = get_bits(&VAR_0->gb, 4); if (VAR_0->h_count[VAR_5] > VAR_0->h_max) VAR_0->h_max = VAR_0->h_count[VAR_5]; if (VAR_0->v_count[VAR_5] > VAR_0->v_max) VAR_0->v_max = VAR_0->v_count[VAR_5]; VAR_0->quant_index[VAR_5] = get_bits(&VAR_0->gb, 8); if (VAR_0->quant_index[VAR_5] >= 4) return -1; dprintf("component %d %d:%d\n", VAR_5, VAR_0->h_count[VAR_5], VAR_0->v_count[VAR_5]); } if (VAR_6 != VAR_0->VAR_6 || VAR_7 != VAR_0->VAR_7) { for(VAR_5=0;VAR_5<MAX_COMPONENTS;VAR_5++) { free(VAR_0->current_picture[VAR_5]); VAR_0->current_picture[VAR_5] = NULL; } VAR_0->VAR_6 = VAR_6; VAR_0->VAR_7 = VAR_7; if (VAR_0->first_picture && VAR_0->org_height != 0 && VAR_0->VAR_7 < ((VAR_0->org_height * 3) / 4)) { VAR_0->interlaced = 1; VAR_0->bottom_field = 0; } for(VAR_5=0;VAR_5<VAR_4;VAR_5++) { int VAR_8, VAR_9; VAR_8 = (VAR_0->VAR_6 + 8 * VAR_0->h_max - 1) / (8 * VAR_0->h_max); VAR_9 = (VAR_0->VAR_7 + 8 * VAR_0->v_max - 1) / (8 * VAR_0->v_max); VAR_8 = VAR_8 * 8 * VAR_0->h_count[VAR_5]; VAR_9 = VAR_9 * 8 * VAR_0->v_count[VAR_5]; if (VAR_0->interlaced) VAR_8 *= 2; VAR_0->linesize[VAR_5] = VAR_8; VAR_0->current_picture[VAR_5] = av_mallocz(VAR_8 * VAR_9); } VAR_0->first_picture = 0; } if (VAR_3 != 8+(3*VAR_4)) dprintf("decode_sof0: error, VAR_3(%d) mismatch\n", VAR_3); return 0; }
[ "static int FUNC_0(MJpegDecodeContext *VAR_0,\nUINT8 *VAR_1, int VAR_2)\n{", "int VAR_3, VAR_4, VAR_5, VAR_6, VAR_7;", "init_get_bits(&VAR_0->gb, VAR_1, VAR_2);", "VAR_3 = get_bits(&VAR_0->gb, 16);", "if (get_bits(&VAR_0->gb, 8) != 8)\nreturn -1;", "VAR_7 = get_bits(&VAR_0->gb, 16);", "VAR_6 = get_bits(&VAR_0->gb, 16);", "VAR_4 = get_bits(&VAR_0->gb, 8);", "if (VAR_4 <= 0 ||\nVAR_4 > MAX_COMPONENTS)\nreturn -1;", "VAR_0->VAR_4 = VAR_4;", "VAR_0->h_max = 1;", "VAR_0->v_max = 1;", "for(VAR_5=0;VAR_5<VAR_4;VAR_5++) {", "VAR_0->component_id[VAR_5] = get_bits(&VAR_0->gb, 8) - 1;", "VAR_0->h_count[VAR_5] = get_bits(&VAR_0->gb, 4);", "VAR_0->v_count[VAR_5] = get_bits(&VAR_0->gb, 4);", "if (VAR_0->h_count[VAR_5] > VAR_0->h_max)\nVAR_0->h_max = VAR_0->h_count[VAR_5];", "if (VAR_0->v_count[VAR_5] > VAR_0->v_max)\nVAR_0->v_max = VAR_0->v_count[VAR_5];", "VAR_0->quant_index[VAR_5] = get_bits(&VAR_0->gb, 8);", "if (VAR_0->quant_index[VAR_5] >= 4)\nreturn -1;", "dprintf(\"component %d %d:%d\\n\", VAR_5, VAR_0->h_count[VAR_5], VAR_0->v_count[VAR_5]);", "}", "if (VAR_6 != VAR_0->VAR_6 || VAR_7 != VAR_0->VAR_7) {", "for(VAR_5=0;VAR_5<MAX_COMPONENTS;VAR_5++) {", "free(VAR_0->current_picture[VAR_5]);", "VAR_0->current_picture[VAR_5] = NULL;", "}", "VAR_0->VAR_6 = VAR_6;", "VAR_0->VAR_7 = VAR_7;", "if (VAR_0->first_picture &&\nVAR_0->org_height != 0 &&\nVAR_0->VAR_7 < ((VAR_0->org_height * 3) / 4)) {", "VAR_0->interlaced = 1;", "VAR_0->bottom_field = 0;", "}", "for(VAR_5=0;VAR_5<VAR_4;VAR_5++) {", "int VAR_8, VAR_9;", "VAR_8 = (VAR_0->VAR_6 + 8 * VAR_0->h_max - 1) / (8 * VAR_0->h_max);", "VAR_9 = (VAR_0->VAR_7 + 8 * VAR_0->v_max - 1) / (8 * VAR_0->v_max);", "VAR_8 = VAR_8 * 8 * VAR_0->h_count[VAR_5];", "VAR_9 = VAR_9 * 8 * VAR_0->v_count[VAR_5];", "if (VAR_0->interlaced)\nVAR_8 *= 2;", "VAR_0->linesize[VAR_5] = VAR_8;", "VAR_0->current_picture[VAR_5] = av_mallocz(VAR_8 * VAR_9);", "}", "VAR_0->first_picture = 0;", "}", "if (VAR_3 != 8+(3*VAR_4))\ndprintf(\"decode_sof0: error, VAR_3(%d) mismatch\\n\", VAR_3);", "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, 1, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 17 ], [ 21, 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33, 35, 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 57, 59 ], [ 61, 63 ], [ 65 ], [ 67, 69 ], [ 71 ], [ 73 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 97, 99, 101 ], [ 103 ], [ 105 ], [ 107 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123, 125 ], [ 127 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 141, 143 ], [ 147 ], [ 149 ] ]
4,651
int ff_avfilter_graph_config_formats(AVFilterGraph *graph, AVClass *log_ctx) { int ret; /* find supported formats from sub-filters, and merge along links */ if ((ret = query_formats(graph, log_ctx)) < 0) return ret; /* Once everything is merged, it's possible that we'll still have * multiple valid media format choices. We pick the first one. */ pick_formats(graph); return 0; }
false
FFmpeg
63736fe48c30c5db313c3a25d1462ad31b2a1671
int ff_avfilter_graph_config_formats(AVFilterGraph *graph, AVClass *log_ctx) { int ret; if ((ret = query_formats(graph, log_ctx)) < 0) return ret; pick_formats(graph); return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(AVFilterGraph *VAR_0, AVClass *VAR_1) { int VAR_2; if ((VAR_2 = query_formats(VAR_0, VAR_1)) < 0) return VAR_2; pick_formats(VAR_0); return 0; }
[ "int FUNC_0(AVFilterGraph *VAR_0, AVClass *VAR_1)\n{", "int VAR_2;", "if ((VAR_2 = query_formats(VAR_0, VAR_1)) < 0)\nreturn VAR_2;", "pick_formats(VAR_0);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 11, 13 ], [ 21 ], [ 25 ], [ 27 ] ]
4,652
static void avc_luma_midh_qrt_8w_msa(const uint8_t *src, int32_t src_stride, uint8_t *dst, int32_t dst_stride, int32_t height, uint8_t horiz_offset) { uint32_t multiple8_cnt; for (multiple8_cnt = 2; multiple8_cnt--;) { avc_luma_midh_qrt_4w_msa(src, src_stride, dst, dst_stride, height, horiz_offset); src += 4; dst += 4; } }
false
FFmpeg
e549933a270dd2cfc36f2cf9bb6b29acf3dc6d08
static void avc_luma_midh_qrt_8w_msa(const uint8_t *src, int32_t src_stride, uint8_t *dst, int32_t dst_stride, int32_t height, uint8_t horiz_offset) { uint32_t multiple8_cnt; for (multiple8_cnt = 2; multiple8_cnt--;) { avc_luma_midh_qrt_4w_msa(src, src_stride, dst, dst_stride, height, horiz_offset); src += 4; dst += 4; } }
{ "code": [], "line_no": [] }
static void FUNC_0(const uint8_t *VAR_0, int32_t VAR_1, uint8_t *VAR_2, int32_t VAR_3, int32_t VAR_4, uint8_t VAR_5) { uint32_t multiple8_cnt; for (multiple8_cnt = 2; multiple8_cnt--;) { avc_luma_midh_qrt_4w_msa(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5); VAR_0 += 4; VAR_2 += 4; } }
[ "static void FUNC_0(const uint8_t *VAR_0, int32_t VAR_1,\nuint8_t *VAR_2, int32_t VAR_3,\nint32_t VAR_4, uint8_t VAR_5)\n{", "uint32_t multiple8_cnt;", "for (multiple8_cnt = 2; multiple8_cnt--;) {", "avc_luma_midh_qrt_4w_msa(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4,\nVAR_5);", "VAR_0 += 4;", "VAR_2 += 4;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 13 ], [ 15, 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ] ]
4,653
target_ulong helper_msub32_suov(CPUTriCoreState *env, target_ulong r1, target_ulong r2, target_ulong r3) { int64_t t1 = extract64(r1, 0, 32); int64_t t2 = extract64(r2, 0, 32); int64_t t3 = extract64(r3, 0, 32); int64_t result; result = t2 - (t1 * t3); return suov32_neg(env, result); }
true
qemu
3debbb5af5f63440b170b71bf3aecc0e778f5691
target_ulong helper_msub32_suov(CPUTriCoreState *env, target_ulong r1, target_ulong r2, target_ulong r3) { int64_t t1 = extract64(r1, 0, 32); int64_t t2 = extract64(r2, 0, 32); int64_t t3 = extract64(r3, 0, 32); int64_t result; result = t2 - (t1 * t3); return suov32_neg(env, result); }
{ "code": [ " int64_t t1 = extract64(r1, 0, 32);", " int64_t t2 = extract64(r2, 0, 32);", " int64_t t3 = extract64(r3, 0, 32);", " int64_t result;", " result = t2 - (t1 * t3);", " return suov32_neg(env, result);" ], "line_no": [ 7, 9, 11, 13, 17, 19 ] }
target_ulong FUNC_0(CPUTriCoreState *env, target_ulong r1, target_ulong r2, target_ulong r3) { int64_t t1 = extract64(r1, 0, 32); int64_t t2 = extract64(r2, 0, 32); int64_t t3 = extract64(r3, 0, 32); int64_t result; result = t2 - (t1 * t3); return suov32_neg(env, result); }
[ "target_ulong FUNC_0(CPUTriCoreState *env, target_ulong r1,\ntarget_ulong r2, target_ulong r3)\n{", "int64_t t1 = extract64(r1, 0, 32);", "int64_t t2 = extract64(r2, 0, 32);", "int64_t t3 = extract64(r3, 0, 32);", "int64_t result;", "result = t2 - (t1 * t3);", "return suov32_neg(env, result);", "}" ]
[ 0, 1, 1, 1, 1, 1, 1, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ] ]
4,655
static CharDriverState *qemu_chr_open_fd(int fd_in, int fd_out) { CharDriverState *chr; FDCharDriver *s; chr = qemu_chr_alloc(); s = g_malloc0(sizeof(FDCharDriver)); s->fd_in = io_channel_from_fd(fd_in); s->fd_out = io_channel_from_fd(fd_out); qemu_set_nonblock(fd_out); s->chr = chr; chr->opaque = s; chr->chr_add_watch = fd_chr_add_watch; chr->chr_write = fd_chr_write; chr->chr_update_read_handler = fd_chr_update_read_handler; chr->chr_close = fd_chr_close; return chr; }
true
qemu
2d528d45ecf5ee3c1a566a9f3d664464925ef830
static CharDriverState *qemu_chr_open_fd(int fd_in, int fd_out) { CharDriverState *chr; FDCharDriver *s; chr = qemu_chr_alloc(); s = g_malloc0(sizeof(FDCharDriver)); s->fd_in = io_channel_from_fd(fd_in); s->fd_out = io_channel_from_fd(fd_out); qemu_set_nonblock(fd_out); s->chr = chr; chr->opaque = s; chr->chr_add_watch = fd_chr_add_watch; chr->chr_write = fd_chr_write; chr->chr_update_read_handler = fd_chr_update_read_handler; chr->chr_close = fd_chr_close; return chr; }
{ "code": [ " s = g_malloc0(sizeof(FDCharDriver));" ], "line_no": [ 13 ] }
static CharDriverState *FUNC_0(int fd_in, int fd_out) { CharDriverState *chr; FDCharDriver *s; chr = qemu_chr_alloc(); s = g_malloc0(sizeof(FDCharDriver)); s->fd_in = io_channel_from_fd(fd_in); s->fd_out = io_channel_from_fd(fd_out); qemu_set_nonblock(fd_out); s->chr = chr; chr->opaque = s; chr->chr_add_watch = fd_chr_add_watch; chr->chr_write = fd_chr_write; chr->chr_update_read_handler = fd_chr_update_read_handler; chr->chr_close = fd_chr_close; return chr; }
[ "static CharDriverState *FUNC_0(int fd_in, int fd_out)\n{", "CharDriverState *chr;", "FDCharDriver *s;", "chr = qemu_chr_alloc();", "s = g_malloc0(sizeof(FDCharDriver));", "s->fd_in = io_channel_from_fd(fd_in);", "s->fd_out = io_channel_from_fd(fd_out);", "qemu_set_nonblock(fd_out);", "s->chr = chr;", "chr->opaque = s;", "chr->chr_add_watch = fd_chr_add_watch;", "chr->chr_write = fd_chr_write;", "chr->chr_update_read_handler = fd_chr_update_read_handler;", "chr->chr_close = fd_chr_close;", "return chr;", "}" ]
[ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ] ]
4,656
static void mpeg_er_decode_mb(void *opaque, int ref, int mv_dir, int mv_type, int (*mv)[2][4][2], int mb_x, int mb_y, int mb_intra, int mb_skipped) { MpegEncContext *s = opaque; s->mv_dir = mv_dir; s->mv_type = mv_type; s->mb_intra = mb_intra; s->mb_skipped = mb_skipped; s->mb_x = mb_x; s->mb_y = mb_y; memcpy(s->mv, mv, sizeof(*mv)); ff_init_block_index(s); ff_update_block_index(s); s->bdsp.clear_blocks(s->block[0]); s->dest[0] = s->current_picture.f->data[0] + s->mb_y * 16 * s->linesize + s->mb_x * 16; s->dest[1] = s->current_picture.f->data[1] + s->mb_y * (16 >> s->chroma_y_shift) * s->uvlinesize + s->mb_x * (16 >> s->chroma_x_shift); s->dest[2] = s->current_picture.f->data[2] + s->mb_y * (16 >> s->chroma_y_shift) * s->uvlinesize + s->mb_x * (16 >> s->chroma_x_shift); if (ref) av_log(s->avctx, AV_LOG_DEBUG, "Interlaced error concealment is not fully implemented\n"); ff_mpv_reconstruct_mb(s, s->block); }
true
FFmpeg
127a362630e11fe724e2e63fc871791fdcbcfa64
static void mpeg_er_decode_mb(void *opaque, int ref, int mv_dir, int mv_type, int (*mv)[2][4][2], int mb_x, int mb_y, int mb_intra, int mb_skipped) { MpegEncContext *s = opaque; s->mv_dir = mv_dir; s->mv_type = mv_type; s->mb_intra = mb_intra; s->mb_skipped = mb_skipped; s->mb_x = mb_x; s->mb_y = mb_y; memcpy(s->mv, mv, sizeof(*mv)); ff_init_block_index(s); ff_update_block_index(s); s->bdsp.clear_blocks(s->block[0]); s->dest[0] = s->current_picture.f->data[0] + s->mb_y * 16 * s->linesize + s->mb_x * 16; s->dest[1] = s->current_picture.f->data[1] + s->mb_y * (16 >> s->chroma_y_shift) * s->uvlinesize + s->mb_x * (16 >> s->chroma_x_shift); s->dest[2] = s->current_picture.f->data[2] + s->mb_y * (16 >> s->chroma_y_shift) * s->uvlinesize + s->mb_x * (16 >> s->chroma_x_shift); if (ref) av_log(s->avctx, AV_LOG_DEBUG, "Interlaced error concealment is not fully implemented\n"); ff_mpv_reconstruct_mb(s, s->block); }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, int VAR_1, int VAR_2, int VAR_3, int (*VAR_4)[2][4][2], int VAR_5, int VAR_6, int VAR_7, int VAR_8) { MpegEncContext *s = VAR_0; s->VAR_2 = VAR_2; s->VAR_3 = VAR_3; s->VAR_7 = VAR_7; s->VAR_8 = VAR_8; s->VAR_5 = VAR_5; s->VAR_6 = VAR_6; memcpy(s->VAR_4, VAR_4, sizeof(*VAR_4)); ff_init_block_index(s); ff_update_block_index(s); s->bdsp.clear_blocks(s->block[0]); s->dest[0] = s->current_picture.f->data[0] + s->VAR_6 * 16 * s->linesize + s->VAR_5 * 16; s->dest[1] = s->current_picture.f->data[1] + s->VAR_6 * (16 >> s->chroma_y_shift) * s->uvlinesize + s->VAR_5 * (16 >> s->chroma_x_shift); s->dest[2] = s->current_picture.f->data[2] + s->VAR_6 * (16 >> s->chroma_y_shift) * s->uvlinesize + s->VAR_5 * (16 >> s->chroma_x_shift); if (VAR_1) av_log(s->avctx, AV_LOG_DEBUG, "Interlaced error concealment is not fully implemented\n"); ff_mpv_reconstruct_mb(s, s->block); }
[ "static void FUNC_0(void *VAR_0, int VAR_1, int VAR_2, int VAR_3,\nint (*VAR_4)[2][4][2], int VAR_5, int VAR_6,\nint VAR_7, int VAR_8)\n{", "MpegEncContext *s = VAR_0;", "s->VAR_2 = VAR_2;", "s->VAR_3 = VAR_3;", "s->VAR_7 = VAR_7;", "s->VAR_8 = VAR_8;", "s->VAR_5 = VAR_5;", "s->VAR_6 = VAR_6;", "memcpy(s->VAR_4, VAR_4, sizeof(*VAR_4));", "ff_init_block_index(s);", "ff_update_block_index(s);", "s->bdsp.clear_blocks(s->block[0]);", "s->dest[0] = s->current_picture.f->data[0] +\ns->VAR_6 * 16 * s->linesize +\ns->VAR_5 * 16;", "s->dest[1] = s->current_picture.f->data[1] +\ns->VAR_6 * (16 >> s->chroma_y_shift) * s->uvlinesize +\ns->VAR_5 * (16 >> s->chroma_x_shift);", "s->dest[2] = s->current_picture.f->data[2] +\ns->VAR_6 * (16 >> s->chroma_y_shift) * s->uvlinesize +\ns->VAR_5 * (16 >> s->chroma_x_shift);", "if (VAR_1)\nav_log(s->avctx, AV_LOG_DEBUG,\n\"Interlaced error concealment is not fully implemented\\n\");", "ff_mpv_reconstruct_mb(s, s->block);", "}" ]
[ 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 ], [ 26 ], [ 30 ], [ 32 ], [ 36 ], [ 40, 42, 44 ], [ 46, 48, 50 ], [ 52, 54, 56 ], [ 60, 62, 64 ], [ 66 ], [ 68 ] ]
4,657
static int field_end(H264Context *h, int in_setup) { MpegEncContext *const s = &h->s; AVCodecContext *const avctx = s->avctx; int err = 0; s->mb_y = 0; if (!in_setup && !s->dropable) ff_thread_report_progress(&s->current_picture_ptr->f, (16 * s->mb_height >> FIELD_PICTURE) - 1, s->picture_structure == PICT_BOTTOM_FIELD); if (CONFIG_H264_VDPAU_DECODER && s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU) ff_vdpau_h264_set_reference_frames(s); if (in_setup || !(avctx->active_thread_type & FF_THREAD_FRAME)) { if (!s->dropable) { err = ff_h264_execute_ref_pic_marking(h, h->mmco, h->mmco_index); h->prev_poc_msb = h->poc_msb; h->prev_poc_lsb = h->poc_lsb; } h->prev_frame_num_offset = h->frame_num_offset; h->prev_frame_num = h->frame_num; h->outputed_poc = h->next_outputed_poc; } if (avctx->hwaccel) { if (avctx->hwaccel->end_frame(avctx) < 0) av_log(avctx, AV_LOG_ERROR, "hardware accelerator failed to decode picture\n"); } if (CONFIG_H264_VDPAU_DECODER && s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU) ff_vdpau_h264_picture_complete(s); /* * FIXME: Error handling code does not seem to support interlaced * when slices span multiple rows * The ff_er_add_slice calls don't work right for bottom * fields; they cause massive erroneous error concealing * Error marking covers both fields (top and bottom). * This causes a mismatched s->error_count * and a bad error table. Further, the error count goes to * INT_MAX when called for bottom field, because mb_y is * past end by one (callers fault) and resync_mb_y != 0 * causes problems for the first MB line, too. */ if (!FIELD_PICTURE) ff_er_frame_end(s); ff_MPV_frame_end(s); h->current_slice = 0; return err; }
true
FFmpeg
1e26a48fa23ef8e1cbc424667d387184d8155f15
static int field_end(H264Context *h, int in_setup) { MpegEncContext *const s = &h->s; AVCodecContext *const avctx = s->avctx; int err = 0; s->mb_y = 0; if (!in_setup && !s->dropable) ff_thread_report_progress(&s->current_picture_ptr->f, (16 * s->mb_height >> FIELD_PICTURE) - 1, s->picture_structure == PICT_BOTTOM_FIELD); if (CONFIG_H264_VDPAU_DECODER && s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU) ff_vdpau_h264_set_reference_frames(s); if (in_setup || !(avctx->active_thread_type & FF_THREAD_FRAME)) { if (!s->dropable) { err = ff_h264_execute_ref_pic_marking(h, h->mmco, h->mmco_index); h->prev_poc_msb = h->poc_msb; h->prev_poc_lsb = h->poc_lsb; } h->prev_frame_num_offset = h->frame_num_offset; h->prev_frame_num = h->frame_num; h->outputed_poc = h->next_outputed_poc; } if (avctx->hwaccel) { if (avctx->hwaccel->end_frame(avctx) < 0) av_log(avctx, AV_LOG_ERROR, "hardware accelerator failed to decode picture\n"); } if (CONFIG_H264_VDPAU_DECODER && s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU) ff_vdpau_h264_picture_complete(s); if (!FIELD_PICTURE) ff_er_frame_end(s); ff_MPV_frame_end(s); h->current_slice = 0; return err; }
{ "code": [ " ff_thread_report_progress(&s->current_picture_ptr->f,", " (16 * s->mb_height >> FIELD_PICTURE) - 1," ], "line_no": [ 17, 19 ] }
static int FUNC_0(H264Context *VAR_0, int VAR_1) { MpegEncContext *const s = &VAR_0->s; AVCodecContext *const avctx = s->avctx; int VAR_2 = 0; s->mb_y = 0; if (!VAR_1 && !s->dropable) ff_thread_report_progress(&s->current_picture_ptr->f, (16 * s->mb_height >> FIELD_PICTURE) - 1, s->picture_structure == PICT_BOTTOM_FIELD); if (CONFIG_H264_VDPAU_DECODER && s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU) ff_vdpau_h264_set_reference_frames(s); if (VAR_1 || !(avctx->active_thread_type & FF_THREAD_FRAME)) { if (!s->dropable) { VAR_2 = ff_h264_execute_ref_pic_marking(VAR_0, VAR_0->mmco, VAR_0->mmco_index); VAR_0->prev_poc_msb = VAR_0->poc_msb; VAR_0->prev_poc_lsb = VAR_0->poc_lsb; } VAR_0->prev_frame_num_offset = VAR_0->frame_num_offset; VAR_0->prev_frame_num = VAR_0->frame_num; VAR_0->outputed_poc = VAR_0->next_outputed_poc; } if (avctx->hwaccel) { if (avctx->hwaccel->end_frame(avctx) < 0) av_log(avctx, AV_LOG_ERROR, "hardware accelerator failed to decode picture\n"); } if (CONFIG_H264_VDPAU_DECODER && s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU) ff_vdpau_h264_picture_complete(s); if (!FIELD_PICTURE) ff_er_frame_end(s); ff_MPV_frame_end(s); VAR_0->current_slice = 0; return VAR_2; }
[ "static int FUNC_0(H264Context *VAR_0, int VAR_1)\n{", "MpegEncContext *const s = &VAR_0->s;", "AVCodecContext *const avctx = s->avctx;", "int VAR_2 = 0;", "s->mb_y = 0;", "if (!VAR_1 && !s->dropable)\nff_thread_report_progress(&s->current_picture_ptr->f,\n(16 * s->mb_height >> FIELD_PICTURE) - 1,\ns->picture_structure == PICT_BOTTOM_FIELD);", "if (CONFIG_H264_VDPAU_DECODER &&\ns->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU)\nff_vdpau_h264_set_reference_frames(s);", "if (VAR_1 || !(avctx->active_thread_type & FF_THREAD_FRAME)) {", "if (!s->dropable) {", "VAR_2 = ff_h264_execute_ref_pic_marking(VAR_0, VAR_0->mmco, VAR_0->mmco_index);", "VAR_0->prev_poc_msb = VAR_0->poc_msb;", "VAR_0->prev_poc_lsb = VAR_0->poc_lsb;", "}", "VAR_0->prev_frame_num_offset = VAR_0->frame_num_offset;", "VAR_0->prev_frame_num = VAR_0->frame_num;", "VAR_0->outputed_poc = VAR_0->next_outputed_poc;", "}", "if (avctx->hwaccel) {", "if (avctx->hwaccel->end_frame(avctx) < 0)\nav_log(avctx, AV_LOG_ERROR,\n\"hardware accelerator failed to decode picture\\n\");", "}", "if (CONFIG_H264_VDPAU_DECODER &&\ns->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU)\nff_vdpau_h264_picture_complete(s);", "if (!FIELD_PICTURE)\nff_er_frame_end(s);", "ff_MPV_frame_end(s);", "VAR_0->current_slice = 0;", "return VAR_2;", "}" ]
[ 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15, 17, 19, 21 ], [ 25, 27, 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57, 59, 61 ], [ 63 ], [ 67, 69, 71 ], [ 99, 101 ], [ 105 ], [ 109 ], [ 113 ], [ 115 ] ]
4,658
static void coroutine_fn backup_run(void *opaque) { BackupBlockJob *job = opaque; BackupCompleteData *data; BlockDriverState *bs = job->common.bs; BlockDriverState *target = job->target; BlockdevOnError on_target_error = job->on_target_error; NotifierWithReturn before_write = { .notify = backup_before_write_notify, }; int64_t start, end; int ret = 0; QLIST_INIT(&job->inflight_reqs); qemu_co_rwlock_init(&job->flush_rwlock); start = 0; end = DIV_ROUND_UP(job->common.len / BDRV_SECTOR_SIZE, BACKUP_SECTORS_PER_CLUSTER); job->bitmap = hbitmap_alloc(end, 0); bdrv_set_enable_write_cache(target, true); bdrv_set_on_error(target, on_target_error, on_target_error); bdrv_iostatus_enable(target); bdrv_add_before_write_notifier(bs, &before_write); if (job->sync_mode == MIRROR_SYNC_MODE_NONE) { while (!block_job_is_cancelled(&job->common)) { /* Yield until the job is cancelled. We just let our before_write * notify callback service CoW requests. */ job->common.busy = false; qemu_coroutine_yield(); job->common.busy = true; } } else { /* Both FULL and TOP SYNC_MODE's require copying.. */ for (; start < end; start++) { bool error_is_read; if (block_job_is_cancelled(&job->common)) { break; } /* we need to yield so that qemu_aio_flush() returns. * (without, VM does not reboot) */ if (job->common.speed) { uint64_t delay_ns = ratelimit_calculate_delay( &job->limit, job->sectors_read); job->sectors_read = 0; block_job_sleep_ns(&job->common, QEMU_CLOCK_REALTIME, delay_ns); } else { block_job_sleep_ns(&job->common, QEMU_CLOCK_REALTIME, 0); } if (block_job_is_cancelled(&job->common)) { break; } if (job->sync_mode == MIRROR_SYNC_MODE_TOP) { int i, n; int alloced = 0; /* Check to see if these blocks are already in the * backing file. */ for (i = 0; i < BACKUP_SECTORS_PER_CLUSTER;) { /* bdrv_is_allocated() only returns true/false based * on the first set of sectors it comes across that * are are all in the same state. * For that reason we must verify each sector in the * backup cluster length. We end up copying more than * needed but at some point that is always the case. */ alloced = bdrv_is_allocated(bs, start * BACKUP_SECTORS_PER_CLUSTER + i, BACKUP_SECTORS_PER_CLUSTER - i, &n); i += n; if (alloced == 1 || n == 0) { break; } } /* If the above loop never found any sectors that are in * the topmost image, skip this backup. */ if (alloced == 0) { continue; } } /* FULL sync mode we copy the whole drive. */ ret = backup_do_cow(bs, start * BACKUP_SECTORS_PER_CLUSTER, BACKUP_SECTORS_PER_CLUSTER, &error_is_read); if (ret < 0) { /* Depending on error action, fail now or retry cluster */ BlockErrorAction action = backup_error_action(job, error_is_read, -ret); if (action == BLOCK_ERROR_ACTION_REPORT) { break; } else { start--; continue; } } } } notifier_with_return_remove(&before_write); /* wait until pending backup_do_cow() calls have completed */ qemu_co_rwlock_wrlock(&job->flush_rwlock); qemu_co_rwlock_unlock(&job->flush_rwlock); hbitmap_free(job->bitmap); bdrv_iostatus_disable(target); data = g_malloc(sizeof(*data)); data->ret = ret; block_job_defer_to_main_loop(&job->common, backup_complete, data); }
true
qemu
c29c1dd312f39ec18a3c6177c6da09a75e095d70
static void coroutine_fn backup_run(void *opaque) { BackupBlockJob *job = opaque; BackupCompleteData *data; BlockDriverState *bs = job->common.bs; BlockDriverState *target = job->target; BlockdevOnError on_target_error = job->on_target_error; NotifierWithReturn before_write = { .notify = backup_before_write_notify, }; int64_t start, end; int ret = 0; QLIST_INIT(&job->inflight_reqs); qemu_co_rwlock_init(&job->flush_rwlock); start = 0; end = DIV_ROUND_UP(job->common.len / BDRV_SECTOR_SIZE, BACKUP_SECTORS_PER_CLUSTER); job->bitmap = hbitmap_alloc(end, 0); bdrv_set_enable_write_cache(target, true); bdrv_set_on_error(target, on_target_error, on_target_error); bdrv_iostatus_enable(target); bdrv_add_before_write_notifier(bs, &before_write); if (job->sync_mode == MIRROR_SYNC_MODE_NONE) { while (!block_job_is_cancelled(&job->common)) { job->common.busy = false; qemu_coroutine_yield(); job->common.busy = true; } } else { for (; start < end; start++) { bool error_is_read; if (block_job_is_cancelled(&job->common)) { break; } if (job->common.speed) { uint64_t delay_ns = ratelimit_calculate_delay( &job->limit, job->sectors_read); job->sectors_read = 0; block_job_sleep_ns(&job->common, QEMU_CLOCK_REALTIME, delay_ns); } else { block_job_sleep_ns(&job->common, QEMU_CLOCK_REALTIME, 0); } if (block_job_is_cancelled(&job->common)) { break; } if (job->sync_mode == MIRROR_SYNC_MODE_TOP) { int i, n; int alloced = 0; for (i = 0; i < BACKUP_SECTORS_PER_CLUSTER;) { alloced = bdrv_is_allocated(bs, start * BACKUP_SECTORS_PER_CLUSTER + i, BACKUP_SECTORS_PER_CLUSTER - i, &n); i += n; if (alloced == 1 || n == 0) { break; } } if (alloced == 0) { continue; } } ret = backup_do_cow(bs, start * BACKUP_SECTORS_PER_CLUSTER, BACKUP_SECTORS_PER_CLUSTER, &error_is_read); if (ret < 0) { BlockErrorAction action = backup_error_action(job, error_is_read, -ret); if (action == BLOCK_ERROR_ACTION_REPORT) { break; } else { start--; continue; } } } } notifier_with_return_remove(&before_write); qemu_co_rwlock_wrlock(&job->flush_rwlock); qemu_co_rwlock_unlock(&job->flush_rwlock); hbitmap_free(job->bitmap); bdrv_iostatus_disable(target); data = g_malloc(sizeof(*data)); data->ret = ret; block_job_defer_to_main_loop(&job->common, backup_complete, data); }
{ "code": [], "line_no": [] }
static void VAR_0 backup_run(void *opaque) { BackupBlockJob *job = opaque; BackupCompleteData *data; BlockDriverState *bs = job->common.bs; BlockDriverState *target = job->target; BlockdevOnError on_target_error = job->on_target_error; NotifierWithReturn before_write = { .notify = backup_before_write_notify, }; int64_t start, end; int ret = 0; QLIST_INIT(&job->inflight_reqs); qemu_co_rwlock_init(&job->flush_rwlock); start = 0; end = DIV_ROUND_UP(job->common.len / BDRV_SECTOR_SIZE, BACKUP_SECTORS_PER_CLUSTER); job->bitmap = hbitmap_alloc(end, 0); bdrv_set_enable_write_cache(target, true); bdrv_set_on_error(target, on_target_error, on_target_error); bdrv_iostatus_enable(target); bdrv_add_before_write_notifier(bs, &before_write); if (job->sync_mode == MIRROR_SYNC_MODE_NONE) { while (!block_job_is_cancelled(&job->common)) { job->common.busy = false; qemu_coroutine_yield(); job->common.busy = true; } } else { for (; start < end; start++) { bool error_is_read; if (block_job_is_cancelled(&job->common)) { break; } if (job->common.speed) { uint64_t delay_ns = ratelimit_calculate_delay( &job->limit, job->sectors_read); job->sectors_read = 0; block_job_sleep_ns(&job->common, QEMU_CLOCK_REALTIME, delay_ns); } else { block_job_sleep_ns(&job->common, QEMU_CLOCK_REALTIME, 0); } if (block_job_is_cancelled(&job->common)) { break; } if (job->sync_mode == MIRROR_SYNC_MODE_TOP) { int i, n; int alloced = 0; for (i = 0; i < BACKUP_SECTORS_PER_CLUSTER;) { alloced = bdrv_is_allocated(bs, start * BACKUP_SECTORS_PER_CLUSTER + i, BACKUP_SECTORS_PER_CLUSTER - i, &n); i += n; if (alloced == 1 || n == 0) { break; } } if (alloced == 0) { continue; } } ret = backup_do_cow(bs, start * BACKUP_SECTORS_PER_CLUSTER, BACKUP_SECTORS_PER_CLUSTER, &error_is_read); if (ret < 0) { BlockErrorAction action = backup_error_action(job, error_is_read, -ret); if (action == BLOCK_ERROR_ACTION_REPORT) { break; } else { start--; continue; } } } } notifier_with_return_remove(&before_write); qemu_co_rwlock_wrlock(&job->flush_rwlock); qemu_co_rwlock_unlock(&job->flush_rwlock); hbitmap_free(job->bitmap); bdrv_iostatus_disable(target); data = g_malloc(sizeof(*data)); data->ret = ret; block_job_defer_to_main_loop(&job->common, backup_complete, data); }
[ "static void VAR_0 backup_run(void *opaque)\n{", "BackupBlockJob *job = opaque;", "BackupCompleteData *data;", "BlockDriverState *bs = job->common.bs;", "BlockDriverState *target = job->target;", "BlockdevOnError on_target_error = job->on_target_error;", "NotifierWithReturn before_write = {", ".notify = backup_before_write_notify,\n};", "int64_t start, end;", "int ret = 0;", "QLIST_INIT(&job->inflight_reqs);", "qemu_co_rwlock_init(&job->flush_rwlock);", "start = 0;", "end = DIV_ROUND_UP(job->common.len / BDRV_SECTOR_SIZE,\nBACKUP_SECTORS_PER_CLUSTER);", "job->bitmap = hbitmap_alloc(end, 0);", "bdrv_set_enable_write_cache(target, true);", "bdrv_set_on_error(target, on_target_error, on_target_error);", "bdrv_iostatus_enable(target);", "bdrv_add_before_write_notifier(bs, &before_write);", "if (job->sync_mode == MIRROR_SYNC_MODE_NONE) {", "while (!block_job_is_cancelled(&job->common)) {", "job->common.busy = false;", "qemu_coroutine_yield();", "job->common.busy = true;", "}", "} else {", "for (; start < end; start++) {", "bool error_is_read;", "if (block_job_is_cancelled(&job->common)) {", "break;", "}", "if (job->common.speed) {", "uint64_t delay_ns = ratelimit_calculate_delay(\n&job->limit, job->sectors_read);", "job->sectors_read = 0;", "block_job_sleep_ns(&job->common, QEMU_CLOCK_REALTIME, delay_ns);", "} else {", "block_job_sleep_ns(&job->common, QEMU_CLOCK_REALTIME, 0);", "}", "if (block_job_is_cancelled(&job->common)) {", "break;", "}", "if (job->sync_mode == MIRROR_SYNC_MODE_TOP) {", "int i, n;", "int alloced = 0;", "for (i = 0; i < BACKUP_SECTORS_PER_CLUSTER;) {", "alloced =\nbdrv_is_allocated(bs,\nstart * BACKUP_SECTORS_PER_CLUSTER + i,\nBACKUP_SECTORS_PER_CLUSTER - i, &n);", "i += n;", "if (alloced == 1 || n == 0) {", "break;", "}", "}", "if (alloced == 0) {", "continue;", "}", "}", "ret = backup_do_cow(bs, start * BACKUP_SECTORS_PER_CLUSTER,\nBACKUP_SECTORS_PER_CLUSTER, &error_is_read);", "if (ret < 0) {", "BlockErrorAction action =\nbackup_error_action(job, error_is_read, -ret);", "if (action == BLOCK_ERROR_ACTION_REPORT) {", "break;", "} else {", "start--;", "continue;", "}", "}", "}", "}", "notifier_with_return_remove(&before_write);", "qemu_co_rwlock_wrlock(&job->flush_rwlock);", "qemu_co_rwlock_unlock(&job->flush_rwlock);", "hbitmap_free(job->bitmap);", "bdrv_iostatus_disable(target);", "data = g_malloc(sizeof(*data));", "data->ret = ret;", "block_job_defer_to_main_loop(&job->common, backup_complete, data);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17, 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 33 ], [ 35, 37 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 57 ], [ 59 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 79 ], [ 83 ], [ 85 ], [ 87 ], [ 97 ], [ 99, 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 115 ], [ 117 ], [ 119 ], [ 123 ], [ 125 ], [ 127 ], [ 137 ], [ 151, 153, 155, 157 ], [ 159 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 187, 189 ], [ 191 ], [ 195, 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 219 ], [ 225 ], [ 227 ], [ 231 ], [ 235 ], [ 240 ], [ 242 ], [ 244 ], [ 246 ] ]
4,659
static void force_sigsegv(int oldsig) { CPUState *cpu = thread_cpu; CPUArchState *env = cpu->env_ptr; target_siginfo_t info; if (oldsig == SIGSEGV) { /* Make sure we don't try to deliver the signal again; this will * end up with handle_pending_signal() calling force_sig(). */ sigact_table[oldsig - 1]._sa_handler = TARGET_SIG_DFL; } info.si_signo = TARGET_SIGSEGV; info.si_errno = 0; info.si_code = TARGET_SI_KERNEL; info._sifields._kill._pid = 0; info._sifields._kill._uid = 0; queue_signal(env, info.si_signo, QEMU_SI_KILL, &info); }
true
qemu
c599d4d6d6e9bfdb64e54c33a22cb26e3496b96d
static void force_sigsegv(int oldsig) { CPUState *cpu = thread_cpu; CPUArchState *env = cpu->env_ptr; target_siginfo_t info; if (oldsig == SIGSEGV) { sigact_table[oldsig - 1]._sa_handler = TARGET_SIG_DFL; } info.si_signo = TARGET_SIGSEGV; info.si_errno = 0; info.si_code = TARGET_SI_KERNEL; info._sifields._kill._pid = 0; info._sifields._kill._uid = 0; queue_signal(env, info.si_signo, QEMU_SI_KILL, &info); }
{ "code": [], "line_no": [] }
static void FUNC_0(int VAR_0) { CPUState *cpu = thread_cpu; CPUArchState *env = cpu->env_ptr; target_siginfo_t info; if (VAR_0 == SIGSEGV) { sigact_table[VAR_0 - 1]._sa_handler = TARGET_SIG_DFL; } info.si_signo = TARGET_SIGSEGV; info.si_errno = 0; info.si_code = TARGET_SI_KERNEL; info._sifields._kill._pid = 0; info._sifields._kill._uid = 0; queue_signal(env, info.si_signo, QEMU_SI_KILL, &info); }
[ "static void FUNC_0(int VAR_0)\n{", "CPUState *cpu = thread_cpu;", "CPUArchState *env = cpu->env_ptr;", "target_siginfo_t info;", "if (VAR_0 == SIGSEGV) {", "sigact_table[VAR_0 - 1]._sa_handler = TARGET_SIG_DFL;", "}", "info.si_signo = TARGET_SIGSEGV;", "info.si_errno = 0;", "info.si_code = TARGET_SI_KERNEL;", "info._sifields._kill._pid = 0;", "info._sifields._kill._uid = 0;", "queue_signal(env, info.si_signo, QEMU_SI_KILL, &info);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ] ]
4,660
static void vnc_update_client(void *opaque) { VncState *vs = opaque; if (vs->need_update && vs->csock != -1) { int y; uint8_t *row; char *old_row; uint32_t width_mask[VNC_DIRTY_WORDS]; int n_rectangles; int saved_offset; int has_dirty = 0; vga_hw_update(); vnc_set_bits(width_mask, (ds_get_width(vs->ds) / 16), VNC_DIRTY_WORDS); /* Walk through the dirty map and eliminate tiles that really aren't dirty */ row = ds_get_data(vs->ds); old_row = vs->old_data; for (y = 0; y < ds_get_height(vs->ds); y++) { if (vnc_and_bits(vs->dirty_row[y], width_mask, VNC_DIRTY_WORDS)) { int x; uint8_t *ptr; char *old_ptr; ptr = row; old_ptr = (char*)old_row; for (x = 0; x < ds_get_width(vs->ds); x += 16) { if (memcmp(old_ptr, ptr, 16 * ds_get_bytes_per_pixel(vs->ds)) == 0) { vnc_clear_bit(vs->dirty_row[y], (x / 16)); } else { has_dirty = 1; memcpy(old_ptr, ptr, 16 * ds_get_bytes_per_pixel(vs->ds)); } ptr += 16 * ds_get_bytes_per_pixel(vs->ds); old_ptr += 16 * ds_get_bytes_per_pixel(vs->ds); } } row += ds_get_linesize(vs->ds); old_row += ds_get_linesize(vs->ds); } if (!has_dirty && !vs->audio_cap) { qemu_mod_timer(vs->timer, qemu_get_clock(rt_clock) + VNC_REFRESH_INTERVAL); return; } /* Count rectangles */ n_rectangles = 0; vnc_write_u8(vs, 0); /* msg id */ vnc_write_u8(vs, 0); saved_offset = vs->output.offset; vnc_write_u16(vs, 0); for (y = 0; y < vs->serverds.height; y++) { int x; int last_x = -1; for (x = 0; x < vs->serverds.width / 16; x++) { if (vnc_get_bit(vs->dirty_row[y], x)) { if (last_x == -1) { last_x = x; } vnc_clear_bit(vs->dirty_row[y], x); } else { if (last_x != -1) { int h = find_dirty_height(vs, y, last_x, x); send_framebuffer_update(vs, last_x * 16, y, (x - last_x) * 16, h); n_rectangles++; } last_x = -1; } } if (last_x != -1) { int h = find_dirty_height(vs, y, last_x, x); send_framebuffer_update(vs, last_x * 16, y, (x - last_x) * 16, h); n_rectangles++; } } vs->output.buffer[saved_offset] = (n_rectangles >> 8) & 0xFF; vs->output.buffer[saved_offset + 1] = n_rectangles & 0xFF; vnc_flush(vs); } if (vs->csock != -1) { qemu_mod_timer(vs->timer, qemu_get_clock(rt_clock) + VNC_REFRESH_INTERVAL); } }
true
qemu
6baebed7698a37a0ac5168faf26023426b0ac940
static void vnc_update_client(void *opaque) { VncState *vs = opaque; if (vs->need_update && vs->csock != -1) { int y; uint8_t *row; char *old_row; uint32_t width_mask[VNC_DIRTY_WORDS]; int n_rectangles; int saved_offset; int has_dirty = 0; vga_hw_update(); vnc_set_bits(width_mask, (ds_get_width(vs->ds) / 16), VNC_DIRTY_WORDS); row = ds_get_data(vs->ds); old_row = vs->old_data; for (y = 0; y < ds_get_height(vs->ds); y++) { if (vnc_and_bits(vs->dirty_row[y], width_mask, VNC_DIRTY_WORDS)) { int x; uint8_t *ptr; char *old_ptr; ptr = row; old_ptr = (char*)old_row; for (x = 0; x < ds_get_width(vs->ds); x += 16) { if (memcmp(old_ptr, ptr, 16 * ds_get_bytes_per_pixel(vs->ds)) == 0) { vnc_clear_bit(vs->dirty_row[y], (x / 16)); } else { has_dirty = 1; memcpy(old_ptr, ptr, 16 * ds_get_bytes_per_pixel(vs->ds)); } ptr += 16 * ds_get_bytes_per_pixel(vs->ds); old_ptr += 16 * ds_get_bytes_per_pixel(vs->ds); } } row += ds_get_linesize(vs->ds); old_row += ds_get_linesize(vs->ds); } if (!has_dirty && !vs->audio_cap) { qemu_mod_timer(vs->timer, qemu_get_clock(rt_clock) + VNC_REFRESH_INTERVAL); return; } n_rectangles = 0; vnc_write_u8(vs, 0); vnc_write_u8(vs, 0); saved_offset = vs->output.offset; vnc_write_u16(vs, 0); for (y = 0; y < vs->serverds.height; y++) { int x; int last_x = -1; for (x = 0; x < vs->serverds.width / 16; x++) { if (vnc_get_bit(vs->dirty_row[y], x)) { if (last_x == -1) { last_x = x; } vnc_clear_bit(vs->dirty_row[y], x); } else { if (last_x != -1) { int h = find_dirty_height(vs, y, last_x, x); send_framebuffer_update(vs, last_x * 16, y, (x - last_x) * 16, h); n_rectangles++; } last_x = -1; } } if (last_x != -1) { int h = find_dirty_height(vs, y, last_x, x); send_framebuffer_update(vs, last_x * 16, y, (x - last_x) * 16, h); n_rectangles++; } } vs->output.buffer[saved_offset] = (n_rectangles >> 8) & 0xFF; vs->output.buffer[saved_offset + 1] = n_rectangles & 0xFF; vnc_flush(vs); } if (vs->csock != -1) { qemu_mod_timer(vs->timer, qemu_get_clock(rt_clock) + VNC_REFRESH_INTERVAL); } }
{ "code": [ " uint8_t *row;", " char *old_row;", " row = ds_get_data(vs->ds);", " old_row = vs->old_data;", " for (y = 0; y < ds_get_height(vs->ds); y++) {", " if (vnc_and_bits(vs->dirty_row[y], width_mask, VNC_DIRTY_WORDS)) {", " uint8_t *ptr;", " char *old_ptr;", " ptr = row;", " old_ptr = (char*)old_row;", " for (x = 0; x < ds_get_width(vs->ds); x += 16) {", " if (memcmp(old_ptr, ptr, 16 * ds_get_bytes_per_pixel(vs->ds)) == 0) {", " vnc_clear_bit(vs->dirty_row[y], (x / 16));", " } else {", " has_dirty = 1;", " memcpy(old_ptr, ptr, 16 * ds_get_bytes_per_pixel(vs->ds));", " ptr += 16 * ds_get_bytes_per_pixel(vs->ds);", " old_ptr += 16 * ds_get_bytes_per_pixel(vs->ds);", " row += ds_get_linesize(vs->ds);", " old_row += ds_get_linesize(vs->ds);", " for (y = 0; y < vs->serverds.height; y++) {", " for (x = 0; x < vs->serverds.width / 16; x++) {", " if (vnc_get_bit(vs->dirty_row[y], x)) {", " vnc_clear_bit(vs->dirty_row[y], x);", " int h = find_dirty_height(vs, y, last_x, x);", " int h = find_dirty_height(vs, y, last_x, x);", " old_row += ds_get_linesize(vs->ds);" ], "line_no": [ 11, 13, 37, 39, 43, 45, 49, 51, 55, 57, 61, 63, 65, 67, 69, 71, 77, 79, 87, 89, 119, 125, 127, 135, 141, 157, 89 ] }
static void FUNC_0(void *VAR_0) { VncState *vs = VAR_0; if (vs->need_update && vs->csock != -1) { int VAR_1; uint8_t *row; char *VAR_2; uint32_t width_mask[VNC_DIRTY_WORDS]; int VAR_3; int VAR_4; int VAR_5 = 0; vga_hw_update(); vnc_set_bits(width_mask, (ds_get_width(vs->ds) / 16), VNC_DIRTY_WORDS); row = ds_get_data(vs->ds); VAR_2 = vs->old_data; for (VAR_1 = 0; VAR_1 < ds_get_height(vs->ds); VAR_1++) { if (vnc_and_bits(vs->dirty_row[VAR_1], width_mask, VNC_DIRTY_WORDS)) { int x; uint8_t *ptr; char *old_ptr; ptr = row; old_ptr = (char*)VAR_2; for (x = 0; x < ds_get_width(vs->ds); x += 16) { if (memcmp(old_ptr, ptr, 16 * ds_get_bytes_per_pixel(vs->ds)) == 0) { vnc_clear_bit(vs->dirty_row[VAR_1], (x / 16)); } else { VAR_5 = 1; memcpy(old_ptr, ptr, 16 * ds_get_bytes_per_pixel(vs->ds)); } ptr += 16 * ds_get_bytes_per_pixel(vs->ds); old_ptr += 16 * ds_get_bytes_per_pixel(vs->ds); } } row += ds_get_linesize(vs->ds); VAR_2 += ds_get_linesize(vs->ds); } if (!VAR_5 && !vs->audio_cap) { qemu_mod_timer(vs->timer, qemu_get_clock(rt_clock) + VNC_REFRESH_INTERVAL); return; } VAR_3 = 0; vnc_write_u8(vs, 0); vnc_write_u8(vs, 0); VAR_4 = vs->output.offset; vnc_write_u16(vs, 0); for (VAR_1 = 0; VAR_1 < vs->serverds.height; VAR_1++) { int x; int last_x = -1; for (x = 0; x < vs->serverds.width / 16; x++) { if (vnc_get_bit(vs->dirty_row[VAR_1], x)) { if (last_x == -1) { last_x = x; } vnc_clear_bit(vs->dirty_row[VAR_1], x); } else { if (last_x != -1) { int h = find_dirty_height(vs, VAR_1, last_x, x); send_framebuffer_update(vs, last_x * 16, VAR_1, (x - last_x) * 16, h); VAR_3++; } last_x = -1; } } if (last_x != -1) { int h = find_dirty_height(vs, VAR_1, last_x, x); send_framebuffer_update(vs, last_x * 16, VAR_1, (x - last_x) * 16, h); VAR_3++; } } vs->output.buffer[VAR_4] = (VAR_3 >> 8) & 0xFF; vs->output.buffer[VAR_4 + 1] = VAR_3 & 0xFF; vnc_flush(vs); } if (vs->csock != -1) { qemu_mod_timer(vs->timer, qemu_get_clock(rt_clock) + VNC_REFRESH_INTERVAL); } }
[ "static void FUNC_0(void *VAR_0)\n{", "VncState *vs = VAR_0;", "if (vs->need_update && vs->csock != -1) {", "int VAR_1;", "uint8_t *row;", "char *VAR_2;", "uint32_t width_mask[VNC_DIRTY_WORDS];", "int VAR_3;", "int VAR_4;", "int VAR_5 = 0;", "vga_hw_update();", "vnc_set_bits(width_mask, (ds_get_width(vs->ds) / 16), VNC_DIRTY_WORDS);", "row = ds_get_data(vs->ds);", "VAR_2 = vs->old_data;", "for (VAR_1 = 0; VAR_1 < ds_get_height(vs->ds); VAR_1++) {", "if (vnc_and_bits(vs->dirty_row[VAR_1], width_mask, VNC_DIRTY_WORDS)) {", "int x;", "uint8_t *ptr;", "char *old_ptr;", "ptr = row;", "old_ptr = (char*)VAR_2;", "for (x = 0; x < ds_get_width(vs->ds); x += 16) {", "if (memcmp(old_ptr, ptr, 16 * ds_get_bytes_per_pixel(vs->ds)) == 0) {", "vnc_clear_bit(vs->dirty_row[VAR_1], (x / 16));", "} else {", "VAR_5 = 1;", "memcpy(old_ptr, ptr, 16 * ds_get_bytes_per_pixel(vs->ds));", "}", "ptr += 16 * ds_get_bytes_per_pixel(vs->ds);", "old_ptr += 16 * ds_get_bytes_per_pixel(vs->ds);", "}", "}", "row += ds_get_linesize(vs->ds);", "VAR_2 += ds_get_linesize(vs->ds);", "}", "if (!VAR_5 && !vs->audio_cap) {", "qemu_mod_timer(vs->timer, qemu_get_clock(rt_clock) + VNC_REFRESH_INTERVAL);", "return;", "}", "VAR_3 = 0;", "vnc_write_u8(vs, 0);", "vnc_write_u8(vs, 0);", "VAR_4 = vs->output.offset;", "vnc_write_u16(vs, 0);", "for (VAR_1 = 0; VAR_1 < vs->serverds.height; VAR_1++) {", "int x;", "int last_x = -1;", "for (x = 0; x < vs->serverds.width / 16; x++) {", "if (vnc_get_bit(vs->dirty_row[VAR_1], x)) {", "if (last_x == -1) {", "last_x = x;", "}", "vnc_clear_bit(vs->dirty_row[VAR_1], x);", "} else {", "if (last_x != -1) {", "int h = find_dirty_height(vs, VAR_1, last_x, x);", "send_framebuffer_update(vs, last_x * 16, VAR_1, (x - last_x) * 16, h);", "VAR_3++;", "}", "last_x = -1;", "}", "}", "if (last_x != -1) {", "int h = find_dirty_height(vs, VAR_1, last_x, x);", "send_framebuffer_update(vs, last_x * 16, VAR_1, (x - last_x) * 16, h);", "VAR_3++;", "}", "}", "vs->output.buffer[VAR_4] = (VAR_3 >> 8) & 0xFF;", "vs->output.buffer[VAR_4 + 1] = VAR_3 & 0xFF;", "vnc_flush(vs);", "}", "if (vs->csock != -1) {", "qemu_mod_timer(vs->timer, qemu_get_clock(rt_clock) + VNC_REFRESH_INTERVAL);", "}", "}" ]
[ 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 29 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 87 ], [ 89 ], [ 91 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 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 ], [ 175 ], [ 179 ], [ 181 ], [ 183 ], [ 187 ] ]
4,661
static int video_open(VideoState *is) { int w,h; if (screen_width) { w = screen_width; h = screen_height; } else { w = default_width; h = default_height; } if (!window) { int flags = SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE; if (!window_title) window_title = input_filename; if (is_full_screen) flags |= SDL_WINDOW_FULLSCREEN_DESKTOP; window = SDL_CreateWindow(window_title, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, w, h, flags); SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear"); if (window) { SDL_RendererInfo info; renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC); if (!renderer) { av_log(NULL, AV_LOG_WARNING, "Failed to initialize a hardware accelerated renderer: %s\n", SDL_GetError()); renderer = SDL_CreateRenderer(window, -1, 0); } if (renderer) { if (!SDL_GetRendererInfo(renderer, &info)) av_log(NULL, AV_LOG_VERBOSE, "Initialized %s renderer.\n", info.name); } } } else { SDL_SetWindowSize(window, w, h); } if (!window || !renderer) { av_log(NULL, AV_LOG_FATAL, "SDL: could not set video mode - exiting\n"); do_exit(is); } is->width = w; is->height = h; return 0; }
true
FFmpeg
15d7e31dcb68f30ebd725c495a191d5917a3b602
static int video_open(VideoState *is) { int w,h; if (screen_width) { w = screen_width; h = screen_height; } else { w = default_width; h = default_height; } if (!window) { int flags = SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE; if (!window_title) window_title = input_filename; if (is_full_screen) flags |= SDL_WINDOW_FULLSCREEN_DESKTOP; window = SDL_CreateWindow(window_title, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, w, h, flags); SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear"); if (window) { SDL_RendererInfo info; renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC); if (!renderer) { av_log(NULL, AV_LOG_WARNING, "Failed to initialize a hardware accelerated renderer: %s\n", SDL_GetError()); renderer = SDL_CreateRenderer(window, -1, 0); } if (renderer) { if (!SDL_GetRendererInfo(renderer, &info)) av_log(NULL, AV_LOG_VERBOSE, "Initialized %s renderer.\n", info.name); } } } else { SDL_SetWindowSize(window, w, h); } if (!window || !renderer) { av_log(NULL, AV_LOG_FATAL, "SDL: could not set video mode - exiting\n"); do_exit(is); } is->width = w; is->height = h; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(VideoState *VAR_0) { int VAR_1,VAR_2; if (screen_width) { VAR_1 = screen_width; VAR_2 = screen_height; } else { VAR_1 = default_width; VAR_2 = default_height; } if (!window) { int VAR_3 = SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE; if (!window_title) window_title = input_filename; if (is_full_screen) VAR_3 |= SDL_WINDOW_FULLSCREEN_DESKTOP; window = SDL_CreateWindow(window_title, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, VAR_1, VAR_2, VAR_3); SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear"); if (window) { SDL_RendererInfo info; renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC); if (!renderer) { av_log(NULL, AV_LOG_WARNING, "Failed to initialize a hardware accelerated renderer: %s\n", SDL_GetError()); renderer = SDL_CreateRenderer(window, -1, 0); } if (renderer) { if (!SDL_GetRendererInfo(renderer, &info)) av_log(NULL, AV_LOG_VERBOSE, "Initialized %s renderer.\n", info.name); } } } else { SDL_SetWindowSize(window, VAR_1, VAR_2); } if (!window || !renderer) { av_log(NULL, AV_LOG_FATAL, "SDL: could not set video mode - exiting\n"); do_exit(VAR_0); } VAR_0->width = VAR_1; VAR_0->height = VAR_2; return 0; }
[ "static int FUNC_0(VideoState *VAR_0)\n{", "int VAR_1,VAR_2;", "if (screen_width) {", "VAR_1 = screen_width;", "VAR_2 = screen_height;", "} else {", "VAR_1 = default_width;", "VAR_2 = default_height;", "}", "if (!window) {", "int VAR_3 = SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE;", "if (!window_title)\nwindow_title = input_filename;", "if (is_full_screen)\nVAR_3 |= SDL_WINDOW_FULLSCREEN_DESKTOP;", "window = SDL_CreateWindow(window_title, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, VAR_1, VAR_2, VAR_3);", "SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, \"linear\");", "if (window) {", "SDL_RendererInfo info;", "renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);", "if (!renderer) {", "av_log(NULL, AV_LOG_WARNING, \"Failed to initialize a hardware accelerated renderer: %s\\n\", SDL_GetError());", "renderer = SDL_CreateRenderer(window, -1, 0);", "}", "if (renderer) {", "if (!SDL_GetRendererInfo(renderer, &info))\nav_log(NULL, AV_LOG_VERBOSE, \"Initialized %s renderer.\\n\", info.name);", "}", "}", "} else {", "SDL_SetWindowSize(window, VAR_1, VAR_2);", "}", "if (!window || !renderer) {", "av_log(NULL, AV_LOG_FATAL, \"SDL: could not set video mode - exiting\\n\");", "do_exit(VAR_0);", "}", "VAR_0->width = VAR_1;", "VAR_0->height = VAR_2;", "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 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29, 31 ], [ 33, 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59, 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 85 ], [ 87 ], [ 91 ], [ 93 ] ]
4,662
static void FUNCC(pred4x4_129_dc)(uint8_t *_src, const uint8_t *topright, int _stride){ pixel *src = (pixel*)_src; int stride = _stride/sizeof(pixel); ((pixel4*)(src+0*stride))[0]= ((pixel4*)(src+1*stride))[0]= ((pixel4*)(src+2*stride))[0]= ((pixel4*)(src+3*stride))[0]= PIXEL_SPLAT_X4((1<<(BIT_DEPTH-1))+1); }
true
FFmpeg
2caf19e90f270abe1e80a3e85acaf0eb5c9d0aac
static void FUNCC(pred4x4_129_dc)(uint8_t *_src, const uint8_t *topright, int _stride){ pixel *src = (pixel*)_src; int stride = _stride/sizeof(pixel); ((pixel4*)(src+0*stride))[0]= ((pixel4*)(src+1*stride))[0]= ((pixel4*)(src+2*stride))[0]= ((pixel4*)(src+3*stride))[0]= PIXEL_SPLAT_X4((1<<(BIT_DEPTH-1))+1); }
{ "code": [ " ((pixel4*)(src+0*stride))[0]=", " ((pixel4*)(src+1*stride))[0]=", " ((pixel4*)(src+2*stride))[0]=", " ((pixel4*)(src+0*stride))[0]=", " ((pixel4*)(src+1*stride))[0]=", " ((pixel4*)(src+2*stride))[0]=", " ((pixel4*)(src+0*stride))[0]=", " ((pixel4*)(src+1*stride))[0]=", " ((pixel4*)(src+2*stride))[0]=", " ((pixel4*)(src+0*stride))[0]=", " ((pixel4*)(src+1*stride))[0]=", " ((pixel4*)(src+2*stride))[0]=", " ((pixel4*)(src+0*stride))[0]=", " ((pixel4*)(src+1*stride))[0]=", " ((pixel4*)(src+2*stride))[0]=", " ((pixel4*)(src+0*stride))[0]=", " ((pixel4*)(src+1*stride))[0]=", " ((pixel4*)(src+2*stride))[0]=", " ((pixel4*)(src+3*stride))[0]= PIXEL_SPLAT_X4((1<<(BIT_DEPTH-1))+1);" ], "line_no": [ 7, 9, 11, 7, 9, 11, 7, 9, 11, 7, 9, 11, 7, 9, 11, 7, 9, 11, 13 ] }
static void FUNC_0(pred4x4_129_dc)(uint8_t *_src, const uint8_t *topright, int _stride){ pixel *src = (pixel*)_src; int VAR_0 = _stride/sizeof(pixel); ((pixel4*)(src+0*VAR_0))[0]= ((pixel4*)(src+1*VAR_0))[0]= ((pixel4*)(src+2*VAR_0))[0]= ((pixel4*)(src+3*VAR_0))[0]= PIXEL_SPLAT_X4((1<<(BIT_DEPTH-1))+1); }
[ "static void FUNC_0(pred4x4_129_dc)(uint8_t *_src, const uint8_t *topright, int _stride){", "pixel *src = (pixel*)_src;", "int VAR_0 = _stride/sizeof(pixel);", "((pixel4*)(src+0*VAR_0))[0]=\n((pixel4*)(src+1*VAR_0))[0]=\n((pixel4*)(src+2*VAR_0))[0]=\n((pixel4*)(src+3*VAR_0))[0]= PIXEL_SPLAT_X4((1<<(BIT_DEPTH-1))+1);", "}" ]
[ 0, 0, 0, 1, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7, 9, 11, 13 ], [ 15 ] ]
4,663
static int ehci_reset_queue(EHCIQueue *q) { int packets; trace_usb_ehci_queue_action(q, "reset"); packets = ehci_cancel_queue(q); q->dev = NULL; q->qtdaddr = 0; return packets; }
true
qemu
bbbc39ccacf66ef58261c155f9eed503947c3023
static int ehci_reset_queue(EHCIQueue *q) { int packets; trace_usb_ehci_queue_action(q, "reset"); packets = ehci_cancel_queue(q); q->dev = NULL; q->qtdaddr = 0; return packets; }
{ "code": [], "line_no": [] }
static int FUNC_0(EHCIQueue *VAR_0) { int VAR_1; trace_usb_ehci_queue_action(VAR_0, "reset"); VAR_1 = ehci_cancel_queue(VAR_0); VAR_0->dev = NULL; VAR_0->qtdaddr = 0; return VAR_1; }
[ "static int FUNC_0(EHCIQueue *VAR_0)\n{", "int VAR_1;", "trace_usb_ehci_queue_action(VAR_0, \"reset\");", "VAR_1 = ehci_cancel_queue(VAR_0);", "VAR_0->dev = NULL;", "VAR_0->qtdaddr = 0;", "return VAR_1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 18 ], [ 20 ] ]
4,664
static void fill_caches(H264Context *h, int mb_type, int for_deblock){ MpegEncContext * const s = &h->s; const int mb_xy= h->mb_xy; int topleft_xy, top_xy, topright_xy, left_xy[2]; int topleft_type, top_type, topright_type, left_type[2]; int * left_block; int topleft_partition= -1; int i; top_xy = mb_xy - (s->mb_stride << FIELD_PICTURE); //FIXME deblocking could skip the intra and nnz parts. if(for_deblock && (h->slice_num == 1 || h->slice_table[mb_xy] == h->slice_table[top_xy]) && !FRAME_MBAFF) return; /* Wow, what a mess, why didn't they simplify the interlacing & intra * stuff, I can't imagine that these complex rules are worth it. */ topleft_xy = top_xy - 1; topright_xy= top_xy + 1; left_xy[1] = left_xy[0] = mb_xy-1; left_block = left_block_options[0]; if(FRAME_MBAFF){ const int pair_xy = s->mb_x + (s->mb_y & ~1)*s->mb_stride; const int top_pair_xy = pair_xy - s->mb_stride; const int topleft_pair_xy = top_pair_xy - 1; const int topright_pair_xy = top_pair_xy + 1; const int topleft_mb_frame_flag = !IS_INTERLACED(s->current_picture.mb_type[topleft_pair_xy]); const int top_mb_frame_flag = !IS_INTERLACED(s->current_picture.mb_type[top_pair_xy]); const int topright_mb_frame_flag = !IS_INTERLACED(s->current_picture.mb_type[topright_pair_xy]); const int left_mb_frame_flag = !IS_INTERLACED(s->current_picture.mb_type[pair_xy-1]); const int curr_mb_frame_flag = !IS_INTERLACED(mb_type); const int bottom = (s->mb_y & 1); tprintf(s->avctx, "fill_caches: curr_mb_frame_flag:%d, left_mb_frame_flag:%d, topleft_mb_frame_flag:%d, top_mb_frame_flag:%d, topright_mb_frame_flag:%d\n", curr_mb_frame_flag, left_mb_frame_flag, topleft_mb_frame_flag, top_mb_frame_flag, topright_mb_frame_flag); if (bottom ? !curr_mb_frame_flag // bottom macroblock : (!curr_mb_frame_flag && !top_mb_frame_flag) // top macroblock ) { top_xy -= s->mb_stride; } if (bottom ? !curr_mb_frame_flag // bottom macroblock : (!curr_mb_frame_flag && !topleft_mb_frame_flag) // top macroblock ) { topleft_xy -= s->mb_stride; } else if(bottom && curr_mb_frame_flag && !left_mb_frame_flag) { topleft_xy += s->mb_stride; // take top left mv from the middle of the mb, as opposed to all other modes which use the bottom right partition topleft_partition = 0; } if (bottom ? !curr_mb_frame_flag // bottom macroblock : (!curr_mb_frame_flag && !topright_mb_frame_flag) // top macroblock ) { topright_xy -= s->mb_stride; } if (left_mb_frame_flag != curr_mb_frame_flag) { left_xy[1] = left_xy[0] = pair_xy - 1; if (curr_mb_frame_flag) { if (bottom) { left_block = left_block_options[1]; } else { left_block= left_block_options[2]; } } else { left_xy[1] += s->mb_stride; left_block = left_block_options[3]; } } } h->top_mb_xy = top_xy; h->left_mb_xy[0] = left_xy[0]; h->left_mb_xy[1] = left_xy[1]; if(for_deblock){ topleft_type = 0; topright_type = 0; top_type = h->slice_table[top_xy ] < 255 ? s->current_picture.mb_type[top_xy] : 0; left_type[0] = h->slice_table[left_xy[0] ] < 255 ? s->current_picture.mb_type[left_xy[0]] : 0; left_type[1] = h->slice_table[left_xy[1] ] < 255 ? s->current_picture.mb_type[left_xy[1]] : 0; if(FRAME_MBAFF && !IS_INTRA(mb_type)){ int list; for(list=0; list<h->list_count; list++){ if(USES_LIST(mb_type,list)){ int8_t *ref = &s->current_picture.ref_index[list][h->mb2b8_xy[mb_xy]]; *(uint32_t*)&h->ref_cache[list][scan8[ 0]] = *(uint32_t*)&h->ref_cache[list][scan8[ 2]] = pack16to32(ref[0],ref[1])*0x0101; ref += h->b8_stride; *(uint32_t*)&h->ref_cache[list][scan8[ 8]] = *(uint32_t*)&h->ref_cache[list][scan8[10]] = pack16to32(ref[0],ref[1])*0x0101; }else{ fill_rectangle(&h-> mv_cache[list][scan8[ 0]], 4, 4, 8, 0, 4); fill_rectangle(&h->ref_cache[list][scan8[ 0]], 4, 4, 8, (uint8_t)LIST_NOT_USED, 1); } } } }else{ topleft_type = h->slice_table[topleft_xy ] == h->slice_num ? s->current_picture.mb_type[topleft_xy] : 0; top_type = h->slice_table[top_xy ] == h->slice_num ? s->current_picture.mb_type[top_xy] : 0; topright_type= h->slice_table[topright_xy] == h->slice_num ? s->current_picture.mb_type[topright_xy]: 0; left_type[0] = h->slice_table[left_xy[0] ] == h->slice_num ? s->current_picture.mb_type[left_xy[0]] : 0; left_type[1] = h->slice_table[left_xy[1] ] == h->slice_num ? s->current_picture.mb_type[left_xy[1]] : 0; } if(IS_INTRA(mb_type)){ h->topleft_samples_available= h->top_samples_available= h->left_samples_available= 0xFFFF; h->topright_samples_available= 0xEEEA; if(!IS_INTRA(top_type) && (top_type==0 || h->pps.constrained_intra_pred)){ h->topleft_samples_available= 0xB3FF; h->top_samples_available= 0x33FF; h->topright_samples_available= 0x26EA; } for(i=0; i<2; i++){ if(!IS_INTRA(left_type[i]) && (left_type[i]==0 || h->pps.constrained_intra_pred)){ h->topleft_samples_available&= 0xDF5F; h->left_samples_available&= 0x5F5F; } } if(!IS_INTRA(topleft_type) && (topleft_type==0 || h->pps.constrained_intra_pred)) h->topleft_samples_available&= 0x7FFF; if(!IS_INTRA(topright_type) && (topright_type==0 || h->pps.constrained_intra_pred)) h->topright_samples_available&= 0xFBFF; if(IS_INTRA4x4(mb_type)){ if(IS_INTRA4x4(top_type)){ h->intra4x4_pred_mode_cache[4+8*0]= h->intra4x4_pred_mode[top_xy][4]; h->intra4x4_pred_mode_cache[5+8*0]= h->intra4x4_pred_mode[top_xy][5]; h->intra4x4_pred_mode_cache[6+8*0]= h->intra4x4_pred_mode[top_xy][6]; h->intra4x4_pred_mode_cache[7+8*0]= h->intra4x4_pred_mode[top_xy][3]; }else{ int pred; if(!top_type || (IS_INTER(top_type) && h->pps.constrained_intra_pred)) pred= -1; else{ pred= 2; } h->intra4x4_pred_mode_cache[4+8*0]= h->intra4x4_pred_mode_cache[5+8*0]= h->intra4x4_pred_mode_cache[6+8*0]= h->intra4x4_pred_mode_cache[7+8*0]= pred; } for(i=0; i<2; i++){ if(IS_INTRA4x4(left_type[i])){ h->intra4x4_pred_mode_cache[3+8*1 + 2*8*i]= h->intra4x4_pred_mode[left_xy[i]][left_block[0+2*i]]; h->intra4x4_pred_mode_cache[3+8*2 + 2*8*i]= h->intra4x4_pred_mode[left_xy[i]][left_block[1+2*i]]; }else{ int pred; if(!left_type[i] || (IS_INTER(left_type[i]) && h->pps.constrained_intra_pred)) pred= -1; else{ pred= 2; } h->intra4x4_pred_mode_cache[3+8*1 + 2*8*i]= h->intra4x4_pred_mode_cache[3+8*2 + 2*8*i]= pred; } } } } /* 0 . T T. T T T T 1 L . .L . . . . 2 L . .L . . . . 3 . T TL . . . . 4 L . .L . . . . 5 L . .. . . . . */ //FIXME constraint_intra_pred & partitioning & nnz (let us hope this is just a typo in the spec) if(top_type){ h->non_zero_count_cache[4+8*0]= h->non_zero_count[top_xy][4]; h->non_zero_count_cache[5+8*0]= h->non_zero_count[top_xy][5]; h->non_zero_count_cache[6+8*0]= h->non_zero_count[top_xy][6]; h->non_zero_count_cache[7+8*0]= h->non_zero_count[top_xy][3]; h->non_zero_count_cache[1+8*0]= h->non_zero_count[top_xy][9]; h->non_zero_count_cache[2+8*0]= h->non_zero_count[top_xy][8]; h->non_zero_count_cache[1+8*3]= h->non_zero_count[top_xy][12]; h->non_zero_count_cache[2+8*3]= h->non_zero_count[top_xy][11]; }else{ h->non_zero_count_cache[4+8*0]= h->non_zero_count_cache[5+8*0]= h->non_zero_count_cache[6+8*0]= h->non_zero_count_cache[7+8*0]= h->non_zero_count_cache[1+8*0]= h->non_zero_count_cache[2+8*0]= h->non_zero_count_cache[1+8*3]= h->non_zero_count_cache[2+8*3]= h->pps.cabac && !IS_INTRA(mb_type) ? 0 : 64; } for (i=0; i<2; i++) { if(left_type[i]){ h->non_zero_count_cache[3+8*1 + 2*8*i]= h->non_zero_count[left_xy[i]][left_block[0+2*i]]; h->non_zero_count_cache[3+8*2 + 2*8*i]= h->non_zero_count[left_xy[i]][left_block[1+2*i]]; h->non_zero_count_cache[0+8*1 + 8*i]= h->non_zero_count[left_xy[i]][left_block[4+2*i]]; h->non_zero_count_cache[0+8*4 + 8*i]= h->non_zero_count[left_xy[i]][left_block[5+2*i]]; }else{ h->non_zero_count_cache[3+8*1 + 2*8*i]= h->non_zero_count_cache[3+8*2 + 2*8*i]= h->non_zero_count_cache[0+8*1 + 8*i]= h->non_zero_count_cache[0+8*4 + 8*i]= h->pps.cabac && !IS_INTRA(mb_type) ? 0 : 64; } } if( h->pps.cabac ) { // top_cbp if(top_type) { h->top_cbp = h->cbp_table[top_xy]; } else if(IS_INTRA(mb_type)) { h->top_cbp = 0x1C0; } else { h->top_cbp = 0; } // left_cbp if (left_type[0]) { h->left_cbp = h->cbp_table[left_xy[0]] & 0x1f0; } else if(IS_INTRA(mb_type)) { h->left_cbp = 0x1C0; } else { h->left_cbp = 0; } if (left_type[0]) { h->left_cbp |= ((h->cbp_table[left_xy[0]]>>((left_block[0]&(~1))+1))&0x1) << 1; } if (left_type[1]) { h->left_cbp |= ((h->cbp_table[left_xy[1]]>>((left_block[2]&(~1))+1))&0x1) << 3; } } #if 1 if(IS_INTER(mb_type) || IS_DIRECT(mb_type)){ int list; for(list=0; list<h->list_count; list++){ if(!USES_LIST(mb_type, list) && !IS_DIRECT(mb_type) && !h->deblocking_filter){ /*if(!h->mv_cache_clean[list]){ memset(h->mv_cache [list], 0, 8*5*2*sizeof(int16_t)); //FIXME clean only input? clean at all? memset(h->ref_cache[list], PART_NOT_AVAILABLE, 8*5*sizeof(int8_t)); h->mv_cache_clean[list]= 1; }*/ continue; } h->mv_cache_clean[list]= 0; if(USES_LIST(top_type, list)){ const int b_xy= h->mb2b_xy[top_xy] + 3*h->b_stride; const int b8_xy= h->mb2b8_xy[top_xy] + h->b8_stride; *(uint32_t*)h->mv_cache[list][scan8[0] + 0 - 1*8]= *(uint32_t*)s->current_picture.motion_val[list][b_xy + 0]; *(uint32_t*)h->mv_cache[list][scan8[0] + 1 - 1*8]= *(uint32_t*)s->current_picture.motion_val[list][b_xy + 1]; *(uint32_t*)h->mv_cache[list][scan8[0] + 2 - 1*8]= *(uint32_t*)s->current_picture.motion_val[list][b_xy + 2]; *(uint32_t*)h->mv_cache[list][scan8[0] + 3 - 1*8]= *(uint32_t*)s->current_picture.motion_val[list][b_xy + 3]; h->ref_cache[list][scan8[0] + 0 - 1*8]= h->ref_cache[list][scan8[0] + 1 - 1*8]= s->current_picture.ref_index[list][b8_xy + 0]; h->ref_cache[list][scan8[0] + 2 - 1*8]= h->ref_cache[list][scan8[0] + 3 - 1*8]= s->current_picture.ref_index[list][b8_xy + 1]; }else{ *(uint32_t*)h->mv_cache [list][scan8[0] + 0 - 1*8]= *(uint32_t*)h->mv_cache [list][scan8[0] + 1 - 1*8]= *(uint32_t*)h->mv_cache [list][scan8[0] + 2 - 1*8]= *(uint32_t*)h->mv_cache [list][scan8[0] + 3 - 1*8]= 0; *(uint32_t*)&h->ref_cache[list][scan8[0] + 0 - 1*8]= ((top_type ? LIST_NOT_USED : PART_NOT_AVAILABLE)&0xFF)*0x01010101; } for(i=0; i<2; i++){ int cache_idx = scan8[0] - 1 + i*2*8; if(USES_LIST(left_type[i], list)){ const int b_xy= h->mb2b_xy[left_xy[i]] + 3; const int b8_xy= h->mb2b8_xy[left_xy[i]] + 1; *(uint32_t*)h->mv_cache[list][cache_idx ]= *(uint32_t*)s->current_picture.motion_val[list][b_xy + h->b_stride*left_block[0+i*2]]; *(uint32_t*)h->mv_cache[list][cache_idx+8]= *(uint32_t*)s->current_picture.motion_val[list][b_xy + h->b_stride*left_block[1+i*2]]; h->ref_cache[list][cache_idx ]= s->current_picture.ref_index[list][b8_xy + h->b8_stride*(left_block[0+i*2]>>1)]; h->ref_cache[list][cache_idx+8]= s->current_picture.ref_index[list][b8_xy + h->b8_stride*(left_block[1+i*2]>>1)]; }else{ *(uint32_t*)h->mv_cache [list][cache_idx ]= *(uint32_t*)h->mv_cache [list][cache_idx+8]= 0; h->ref_cache[list][cache_idx ]= h->ref_cache[list][cache_idx+8]= left_type[i] ? LIST_NOT_USED : PART_NOT_AVAILABLE; } } if((for_deblock || (IS_DIRECT(mb_type) && !h->direct_spatial_mv_pred)) && !FRAME_MBAFF) continue; if(USES_LIST(topleft_type, list)){ const int b_xy = h->mb2b_xy[topleft_xy] + 3 + h->b_stride + (topleft_partition & 2*h->b_stride); const int b8_xy= h->mb2b8_xy[topleft_xy] + 1 + (topleft_partition & h->b8_stride); *(uint32_t*)h->mv_cache[list][scan8[0] - 1 - 1*8]= *(uint32_t*)s->current_picture.motion_val[list][b_xy]; h->ref_cache[list][scan8[0] - 1 - 1*8]= s->current_picture.ref_index[list][b8_xy]; }else{ *(uint32_t*)h->mv_cache[list][scan8[0] - 1 - 1*8]= 0; h->ref_cache[list][scan8[0] - 1 - 1*8]= topleft_type ? LIST_NOT_USED : PART_NOT_AVAILABLE; } if(USES_LIST(topright_type, list)){ const int b_xy= h->mb2b_xy[topright_xy] + 3*h->b_stride; const int b8_xy= h->mb2b8_xy[topright_xy] + h->b8_stride; *(uint32_t*)h->mv_cache[list][scan8[0] + 4 - 1*8]= *(uint32_t*)s->current_picture.motion_val[list][b_xy]; h->ref_cache[list][scan8[0] + 4 - 1*8]= s->current_picture.ref_index[list][b8_xy]; }else{ *(uint32_t*)h->mv_cache [list][scan8[0] + 4 - 1*8]= 0; h->ref_cache[list][scan8[0] + 4 - 1*8]= topright_type ? LIST_NOT_USED : PART_NOT_AVAILABLE; } if((IS_SKIP(mb_type) || IS_DIRECT(mb_type)) && !FRAME_MBAFF) continue; h->ref_cache[list][scan8[5 ]+1] = h->ref_cache[list][scan8[7 ]+1] = h->ref_cache[list][scan8[13]+1] = //FIXME remove past 3 (init somewhere else) h->ref_cache[list][scan8[4 ]] = h->ref_cache[list][scan8[12]] = PART_NOT_AVAILABLE; *(uint32_t*)h->mv_cache [list][scan8[5 ]+1]= *(uint32_t*)h->mv_cache [list][scan8[7 ]+1]= *(uint32_t*)h->mv_cache [list][scan8[13]+1]= //FIXME remove past 3 (init somewhere else) *(uint32_t*)h->mv_cache [list][scan8[4 ]]= *(uint32_t*)h->mv_cache [list][scan8[12]]= 0; if( h->pps.cabac ) { /* XXX beurk, Load mvd */ if(USES_LIST(top_type, list)){ const int b_xy= h->mb2b_xy[top_xy] + 3*h->b_stride; *(uint32_t*)h->mvd_cache[list][scan8[0] + 0 - 1*8]= *(uint32_t*)h->mvd_table[list][b_xy + 0]; *(uint32_t*)h->mvd_cache[list][scan8[0] + 1 - 1*8]= *(uint32_t*)h->mvd_table[list][b_xy + 1]; *(uint32_t*)h->mvd_cache[list][scan8[0] + 2 - 1*8]= *(uint32_t*)h->mvd_table[list][b_xy + 2]; *(uint32_t*)h->mvd_cache[list][scan8[0] + 3 - 1*8]= *(uint32_t*)h->mvd_table[list][b_xy + 3]; }else{ *(uint32_t*)h->mvd_cache [list][scan8[0] + 0 - 1*8]= *(uint32_t*)h->mvd_cache [list][scan8[0] + 1 - 1*8]= *(uint32_t*)h->mvd_cache [list][scan8[0] + 2 - 1*8]= *(uint32_t*)h->mvd_cache [list][scan8[0] + 3 - 1*8]= 0; } if(USES_LIST(left_type[0], list)){ const int b_xy= h->mb2b_xy[left_xy[0]] + 3; *(uint32_t*)h->mvd_cache[list][scan8[0] - 1 + 0*8]= *(uint32_t*)h->mvd_table[list][b_xy + h->b_stride*left_block[0]]; *(uint32_t*)h->mvd_cache[list][scan8[0] - 1 + 1*8]= *(uint32_t*)h->mvd_table[list][b_xy + h->b_stride*left_block[1]]; }else{ *(uint32_t*)h->mvd_cache [list][scan8[0] - 1 + 0*8]= *(uint32_t*)h->mvd_cache [list][scan8[0] - 1 + 1*8]= 0; } if(USES_LIST(left_type[1], list)){ const int b_xy= h->mb2b_xy[left_xy[1]] + 3; *(uint32_t*)h->mvd_cache[list][scan8[0] - 1 + 2*8]= *(uint32_t*)h->mvd_table[list][b_xy + h->b_stride*left_block[2]]; *(uint32_t*)h->mvd_cache[list][scan8[0] - 1 + 3*8]= *(uint32_t*)h->mvd_table[list][b_xy + h->b_stride*left_block[3]]; }else{ *(uint32_t*)h->mvd_cache [list][scan8[0] - 1 + 2*8]= *(uint32_t*)h->mvd_cache [list][scan8[0] - 1 + 3*8]= 0; } *(uint32_t*)h->mvd_cache [list][scan8[5 ]+1]= *(uint32_t*)h->mvd_cache [list][scan8[7 ]+1]= *(uint32_t*)h->mvd_cache [list][scan8[13]+1]= //FIXME remove past 3 (init somewhere else) *(uint32_t*)h->mvd_cache [list][scan8[4 ]]= *(uint32_t*)h->mvd_cache [list][scan8[12]]= 0; if(h->slice_type_nos == FF_B_TYPE){ fill_rectangle(&h->direct_cache[scan8[0]], 4, 4, 8, 0, 1); if(IS_DIRECT(top_type)){ *(uint32_t*)&h->direct_cache[scan8[0] - 1*8]= 0x01010101; }else if(IS_8X8(top_type)){ int b8_xy = h->mb2b8_xy[top_xy] + h->b8_stride; h->direct_cache[scan8[0] + 0 - 1*8]= h->direct_table[b8_xy]; h->direct_cache[scan8[0] + 2 - 1*8]= h->direct_table[b8_xy + 1]; }else{ *(uint32_t*)&h->direct_cache[scan8[0] - 1*8]= 0; } if(IS_DIRECT(left_type[0])) h->direct_cache[scan8[0] - 1 + 0*8]= 1; else if(IS_8X8(left_type[0])) h->direct_cache[scan8[0] - 1 + 0*8]= h->direct_table[h->mb2b8_xy[left_xy[0]] + 1 + h->b8_stride*(left_block[0]>>1)]; else h->direct_cache[scan8[0] - 1 + 0*8]= 0; if(IS_DIRECT(left_type[1])) h->direct_cache[scan8[0] - 1 + 2*8]= 1; else if(IS_8X8(left_type[1])) h->direct_cache[scan8[0] - 1 + 2*8]= h->direct_table[h->mb2b8_xy[left_xy[1]] + 1 + h->b8_stride*(left_block[2]>>1)]; else h->direct_cache[scan8[0] - 1 + 2*8]= 0; } } if(FRAME_MBAFF){ #define MAP_MVS\ MAP_F2F(scan8[0] - 1 - 1*8, topleft_type)\ MAP_F2F(scan8[0] + 0 - 1*8, top_type)\ MAP_F2F(scan8[0] + 1 - 1*8, top_type)\ MAP_F2F(scan8[0] + 2 - 1*8, top_type)\ MAP_F2F(scan8[0] + 3 - 1*8, top_type)\ MAP_F2F(scan8[0] + 4 - 1*8, topright_type)\ MAP_F2F(scan8[0] - 1 + 0*8, left_type[0])\ MAP_F2F(scan8[0] - 1 + 1*8, left_type[0])\ MAP_F2F(scan8[0] - 1 + 2*8, left_type[1])\ MAP_F2F(scan8[0] - 1 + 3*8, left_type[1]) if(MB_FIELD){ #define MAP_F2F(idx, mb_type)\ if(!IS_INTERLACED(mb_type) && h->ref_cache[list][idx] >= 0){\ h->ref_cache[list][idx] <<= 1;\ h->mv_cache[list][idx][1] /= 2;\ h->mvd_cache[list][idx][1] /= 2;\ } MAP_MVS #undef MAP_F2F }else{ #define MAP_F2F(idx, mb_type)\ if(IS_INTERLACED(mb_type) && h->ref_cache[list][idx] >= 0){\ h->ref_cache[list][idx] >>= 1;\ h->mv_cache[list][idx][1] <<= 1;\ h->mvd_cache[list][idx][1] <<= 1;\ } MAP_MVS #undef MAP_F2F } } } } #endif h->neighbor_transform_size= !!IS_8x8DCT(top_type) + !!IS_8x8DCT(left_type[0]); }
true
FFmpeg
0281d32550639c806b7eccd2b17cc5d125e4253d
static void fill_caches(H264Context *h, int mb_type, int for_deblock){ MpegEncContext * const s = &h->s; const int mb_xy= h->mb_xy; int topleft_xy, top_xy, topright_xy, left_xy[2]; int topleft_type, top_type, topright_type, left_type[2]; int * left_block; int topleft_partition= -1; int i; top_xy = mb_xy - (s->mb_stride << FIELD_PICTURE); if(for_deblock && (h->slice_num == 1 || h->slice_table[mb_xy] == h->slice_table[top_xy]) && !FRAME_MBAFF) return; topleft_xy = top_xy - 1; topright_xy= top_xy + 1; left_xy[1] = left_xy[0] = mb_xy-1; left_block = left_block_options[0]; if(FRAME_MBAFF){ const int pair_xy = s->mb_x + (s->mb_y & ~1)*s->mb_stride; const int top_pair_xy = pair_xy - s->mb_stride; const int topleft_pair_xy = top_pair_xy - 1; const int topright_pair_xy = top_pair_xy + 1; const int topleft_mb_frame_flag = !IS_INTERLACED(s->current_picture.mb_type[topleft_pair_xy]); const int top_mb_frame_flag = !IS_INTERLACED(s->current_picture.mb_type[top_pair_xy]); const int topright_mb_frame_flag = !IS_INTERLACED(s->current_picture.mb_type[topright_pair_xy]); const int left_mb_frame_flag = !IS_INTERLACED(s->current_picture.mb_type[pair_xy-1]); const int curr_mb_frame_flag = !IS_INTERLACED(mb_type); const int bottom = (s->mb_y & 1); tprintf(s->avctx, "fill_caches: curr_mb_frame_flag:%d, left_mb_frame_flag:%d, topleft_mb_frame_flag:%d, top_mb_frame_flag:%d, topright_mb_frame_flag:%d\n", curr_mb_frame_flag, left_mb_frame_flag, topleft_mb_frame_flag, top_mb_frame_flag, topright_mb_frame_flag); if (bottom ? !curr_mb_frame_flag : (!curr_mb_frame_flag && !top_mb_frame_flag) ) { top_xy -= s->mb_stride; } if (bottom ? !curr_mb_frame_flag : (!curr_mb_frame_flag && !topleft_mb_frame_flag) ) { topleft_xy -= s->mb_stride; } else if(bottom && curr_mb_frame_flag && !left_mb_frame_flag) { topleft_xy += s->mb_stride; topleft_partition = 0; } if (bottom ? !curr_mb_frame_flag : (!curr_mb_frame_flag && !topright_mb_frame_flag) ) { topright_xy -= s->mb_stride; } if (left_mb_frame_flag != curr_mb_frame_flag) { left_xy[1] = left_xy[0] = pair_xy - 1; if (curr_mb_frame_flag) { if (bottom) { left_block = left_block_options[1]; } else { left_block= left_block_options[2]; } } else { left_xy[1] += s->mb_stride; left_block = left_block_options[3]; } } } h->top_mb_xy = top_xy; h->left_mb_xy[0] = left_xy[0]; h->left_mb_xy[1] = left_xy[1]; if(for_deblock){ topleft_type = 0; topright_type = 0; top_type = h->slice_table[top_xy ] < 255 ? s->current_picture.mb_type[top_xy] : 0; left_type[0] = h->slice_table[left_xy[0] ] < 255 ? s->current_picture.mb_type[left_xy[0]] : 0; left_type[1] = h->slice_table[left_xy[1] ] < 255 ? s->current_picture.mb_type[left_xy[1]] : 0; if(FRAME_MBAFF && !IS_INTRA(mb_type)){ int list; for(list=0; list<h->list_count; list++){ if(USES_LIST(mb_type,list)){ int8_t *ref = &s->current_picture.ref_index[list][h->mb2b8_xy[mb_xy]]; *(uint32_t*)&h->ref_cache[list][scan8[ 0]] = *(uint32_t*)&h->ref_cache[list][scan8[ 2]] = pack16to32(ref[0],ref[1])*0x0101; ref += h->b8_stride; *(uint32_t*)&h->ref_cache[list][scan8[ 8]] = *(uint32_t*)&h->ref_cache[list][scan8[10]] = pack16to32(ref[0],ref[1])*0x0101; }else{ fill_rectangle(&h-> mv_cache[list][scan8[ 0]], 4, 4, 8, 0, 4); fill_rectangle(&h->ref_cache[list][scan8[ 0]], 4, 4, 8, (uint8_t)LIST_NOT_USED, 1); } } } }else{ topleft_type = h->slice_table[topleft_xy ] == h->slice_num ? s->current_picture.mb_type[topleft_xy] : 0; top_type = h->slice_table[top_xy ] == h->slice_num ? s->current_picture.mb_type[top_xy] : 0; topright_type= h->slice_table[topright_xy] == h->slice_num ? s->current_picture.mb_type[topright_xy]: 0; left_type[0] = h->slice_table[left_xy[0] ] == h->slice_num ? s->current_picture.mb_type[left_xy[0]] : 0; left_type[1] = h->slice_table[left_xy[1] ] == h->slice_num ? s->current_picture.mb_type[left_xy[1]] : 0; } if(IS_INTRA(mb_type)){ h->topleft_samples_available= h->top_samples_available= h->left_samples_available= 0xFFFF; h->topright_samples_available= 0xEEEA; if(!IS_INTRA(top_type) && (top_type==0 || h->pps.constrained_intra_pred)){ h->topleft_samples_available= 0xB3FF; h->top_samples_available= 0x33FF; h->topright_samples_available= 0x26EA; } for(i=0; i<2; i++){ if(!IS_INTRA(left_type[i]) && (left_type[i]==0 || h->pps.constrained_intra_pred)){ h->topleft_samples_available&= 0xDF5F; h->left_samples_available&= 0x5F5F; } } if(!IS_INTRA(topleft_type) && (topleft_type==0 || h->pps.constrained_intra_pred)) h->topleft_samples_available&= 0x7FFF; if(!IS_INTRA(topright_type) && (topright_type==0 || h->pps.constrained_intra_pred)) h->topright_samples_available&= 0xFBFF; if(IS_INTRA4x4(mb_type)){ if(IS_INTRA4x4(top_type)){ h->intra4x4_pred_mode_cache[4+8*0]= h->intra4x4_pred_mode[top_xy][4]; h->intra4x4_pred_mode_cache[5+8*0]= h->intra4x4_pred_mode[top_xy][5]; h->intra4x4_pred_mode_cache[6+8*0]= h->intra4x4_pred_mode[top_xy][6]; h->intra4x4_pred_mode_cache[7+8*0]= h->intra4x4_pred_mode[top_xy][3]; }else{ int pred; if(!top_type || (IS_INTER(top_type) && h->pps.constrained_intra_pred)) pred= -1; else{ pred= 2; } h->intra4x4_pred_mode_cache[4+8*0]= h->intra4x4_pred_mode_cache[5+8*0]= h->intra4x4_pred_mode_cache[6+8*0]= h->intra4x4_pred_mode_cache[7+8*0]= pred; } for(i=0; i<2; i++){ if(IS_INTRA4x4(left_type[i])){ h->intra4x4_pred_mode_cache[3+8*1 + 2*8*i]= h->intra4x4_pred_mode[left_xy[i]][left_block[0+2*i]]; h->intra4x4_pred_mode_cache[3+8*2 + 2*8*i]= h->intra4x4_pred_mode[left_xy[i]][left_block[1+2*i]]; }else{ int pred; if(!left_type[i] || (IS_INTER(left_type[i]) && h->pps.constrained_intra_pred)) pred= -1; else{ pred= 2; } h->intra4x4_pred_mode_cache[3+8*1 + 2*8*i]= h->intra4x4_pred_mode_cache[3+8*2 + 2*8*i]= pred; } } } } if(top_type){ h->non_zero_count_cache[4+8*0]= h->non_zero_count[top_xy][4]; h->non_zero_count_cache[5+8*0]= h->non_zero_count[top_xy][5]; h->non_zero_count_cache[6+8*0]= h->non_zero_count[top_xy][6]; h->non_zero_count_cache[7+8*0]= h->non_zero_count[top_xy][3]; h->non_zero_count_cache[1+8*0]= h->non_zero_count[top_xy][9]; h->non_zero_count_cache[2+8*0]= h->non_zero_count[top_xy][8]; h->non_zero_count_cache[1+8*3]= h->non_zero_count[top_xy][12]; h->non_zero_count_cache[2+8*3]= h->non_zero_count[top_xy][11]; }else{ h->non_zero_count_cache[4+8*0]= h->non_zero_count_cache[5+8*0]= h->non_zero_count_cache[6+8*0]= h->non_zero_count_cache[7+8*0]= h->non_zero_count_cache[1+8*0]= h->non_zero_count_cache[2+8*0]= h->non_zero_count_cache[1+8*3]= h->non_zero_count_cache[2+8*3]= h->pps.cabac && !IS_INTRA(mb_type) ? 0 : 64; } for (i=0; i<2; i++) { if(left_type[i]){ h->non_zero_count_cache[3+8*1 + 2*8*i]= h->non_zero_count[left_xy[i]][left_block[0+2*i]]; h->non_zero_count_cache[3+8*2 + 2*8*i]= h->non_zero_count[left_xy[i]][left_block[1+2*i]]; h->non_zero_count_cache[0+8*1 + 8*i]= h->non_zero_count[left_xy[i]][left_block[4+2*i]]; h->non_zero_count_cache[0+8*4 + 8*i]= h->non_zero_count[left_xy[i]][left_block[5+2*i]]; }else{ h->non_zero_count_cache[3+8*1 + 2*8*i]= h->non_zero_count_cache[3+8*2 + 2*8*i]= h->non_zero_count_cache[0+8*1 + 8*i]= h->non_zero_count_cache[0+8*4 + 8*i]= h->pps.cabac && !IS_INTRA(mb_type) ? 0 : 64; } } if( h->pps.cabac ) { if(top_type) { h->top_cbp = h->cbp_table[top_xy]; } else if(IS_INTRA(mb_type)) { h->top_cbp = 0x1C0; } else { h->top_cbp = 0; } if (left_type[0]) { h->left_cbp = h->cbp_table[left_xy[0]] & 0x1f0; } else if(IS_INTRA(mb_type)) { h->left_cbp = 0x1C0; } else { h->left_cbp = 0; } if (left_type[0]) { h->left_cbp |= ((h->cbp_table[left_xy[0]]>>((left_block[0]&(~1))+1))&0x1) << 1; } if (left_type[1]) { h->left_cbp |= ((h->cbp_table[left_xy[1]]>>((left_block[2]&(~1))+1))&0x1) << 3; } } #if 1 if(IS_INTER(mb_type) || IS_DIRECT(mb_type)){ int list; for(list=0; list<h->list_count; list++){ if(!USES_LIST(mb_type, list) && !IS_DIRECT(mb_type) && !h->deblocking_filter){ continue; } h->mv_cache_clean[list]= 0; if(USES_LIST(top_type, list)){ const int b_xy= h->mb2b_xy[top_xy] + 3*h->b_stride; const int b8_xy= h->mb2b8_xy[top_xy] + h->b8_stride; *(uint32_t*)h->mv_cache[list][scan8[0] + 0 - 1*8]= *(uint32_t*)s->current_picture.motion_val[list][b_xy + 0]; *(uint32_t*)h->mv_cache[list][scan8[0] + 1 - 1*8]= *(uint32_t*)s->current_picture.motion_val[list][b_xy + 1]; *(uint32_t*)h->mv_cache[list][scan8[0] + 2 - 1*8]= *(uint32_t*)s->current_picture.motion_val[list][b_xy + 2]; *(uint32_t*)h->mv_cache[list][scan8[0] + 3 - 1*8]= *(uint32_t*)s->current_picture.motion_val[list][b_xy + 3]; h->ref_cache[list][scan8[0] + 0 - 1*8]= h->ref_cache[list][scan8[0] + 1 - 1*8]= s->current_picture.ref_index[list][b8_xy + 0]; h->ref_cache[list][scan8[0] + 2 - 1*8]= h->ref_cache[list][scan8[0] + 3 - 1*8]= s->current_picture.ref_index[list][b8_xy + 1]; }else{ *(uint32_t*)h->mv_cache [list][scan8[0] + 0 - 1*8]= *(uint32_t*)h->mv_cache [list][scan8[0] + 1 - 1*8]= *(uint32_t*)h->mv_cache [list][scan8[0] + 2 - 1*8]= *(uint32_t*)h->mv_cache [list][scan8[0] + 3 - 1*8]= 0; *(uint32_t*)&h->ref_cache[list][scan8[0] + 0 - 1*8]= ((top_type ? LIST_NOT_USED : PART_NOT_AVAILABLE)&0xFF)*0x01010101; } for(i=0; i<2; i++){ int cache_idx = scan8[0] - 1 + i*2*8; if(USES_LIST(left_type[i], list)){ const int b_xy= h->mb2b_xy[left_xy[i]] + 3; const int b8_xy= h->mb2b8_xy[left_xy[i]] + 1; *(uint32_t*)h->mv_cache[list][cache_idx ]= *(uint32_t*)s->current_picture.motion_val[list][b_xy + h->b_stride*left_block[0+i*2]]; *(uint32_t*)h->mv_cache[list][cache_idx+8]= *(uint32_t*)s->current_picture.motion_val[list][b_xy + h->b_stride*left_block[1+i*2]]; h->ref_cache[list][cache_idx ]= s->current_picture.ref_index[list][b8_xy + h->b8_stride*(left_block[0+i*2]>>1)]; h->ref_cache[list][cache_idx+8]= s->current_picture.ref_index[list][b8_xy + h->b8_stride*(left_block[1+i*2]>>1)]; }else{ *(uint32_t*)h->mv_cache [list][cache_idx ]= *(uint32_t*)h->mv_cache [list][cache_idx+8]= 0; h->ref_cache[list][cache_idx ]= h->ref_cache[list][cache_idx+8]= left_type[i] ? LIST_NOT_USED : PART_NOT_AVAILABLE; } } if((for_deblock || (IS_DIRECT(mb_type) && !h->direct_spatial_mv_pred)) && !FRAME_MBAFF) continue; if(USES_LIST(topleft_type, list)){ const int b_xy = h->mb2b_xy[topleft_xy] + 3 + h->b_stride + (topleft_partition & 2*h->b_stride); const int b8_xy= h->mb2b8_xy[topleft_xy] + 1 + (topleft_partition & h->b8_stride); *(uint32_t*)h->mv_cache[list][scan8[0] - 1 - 1*8]= *(uint32_t*)s->current_picture.motion_val[list][b_xy]; h->ref_cache[list][scan8[0] - 1 - 1*8]= s->current_picture.ref_index[list][b8_xy]; }else{ *(uint32_t*)h->mv_cache[list][scan8[0] - 1 - 1*8]= 0; h->ref_cache[list][scan8[0] - 1 - 1*8]= topleft_type ? LIST_NOT_USED : PART_NOT_AVAILABLE; } if(USES_LIST(topright_type, list)){ const int b_xy= h->mb2b_xy[topright_xy] + 3*h->b_stride; const int b8_xy= h->mb2b8_xy[topright_xy] + h->b8_stride; *(uint32_t*)h->mv_cache[list][scan8[0] + 4 - 1*8]= *(uint32_t*)s->current_picture.motion_val[list][b_xy]; h->ref_cache[list][scan8[0] + 4 - 1*8]= s->current_picture.ref_index[list][b8_xy]; }else{ *(uint32_t*)h->mv_cache [list][scan8[0] + 4 - 1*8]= 0; h->ref_cache[list][scan8[0] + 4 - 1*8]= topright_type ? LIST_NOT_USED : PART_NOT_AVAILABLE; } if((IS_SKIP(mb_type) || IS_DIRECT(mb_type)) && !FRAME_MBAFF) continue; h->ref_cache[list][scan8[5 ]+1] = h->ref_cache[list][scan8[7 ]+1] = h->ref_cache[list][scan8[13]+1] = h->ref_cache[list][scan8[4 ]] = h->ref_cache[list][scan8[12]] = PART_NOT_AVAILABLE; *(uint32_t*)h->mv_cache [list][scan8[5 ]+1]= *(uint32_t*)h->mv_cache [list][scan8[7 ]+1]= *(uint32_t*)h->mv_cache [list][scan8[13]+1]= *(uint32_t*)h->mv_cache [list][scan8[4 ]]= *(uint32_t*)h->mv_cache [list][scan8[12]]= 0; if( h->pps.cabac ) { if(USES_LIST(top_type, list)){ const int b_xy= h->mb2b_xy[top_xy] + 3*h->b_stride; *(uint32_t*)h->mvd_cache[list][scan8[0] + 0 - 1*8]= *(uint32_t*)h->mvd_table[list][b_xy + 0]; *(uint32_t*)h->mvd_cache[list][scan8[0] + 1 - 1*8]= *(uint32_t*)h->mvd_table[list][b_xy + 1]; *(uint32_t*)h->mvd_cache[list][scan8[0] + 2 - 1*8]= *(uint32_t*)h->mvd_table[list][b_xy + 2]; *(uint32_t*)h->mvd_cache[list][scan8[0] + 3 - 1*8]= *(uint32_t*)h->mvd_table[list][b_xy + 3]; }else{ *(uint32_t*)h->mvd_cache [list][scan8[0] + 0 - 1*8]= *(uint32_t*)h->mvd_cache [list][scan8[0] + 1 - 1*8]= *(uint32_t*)h->mvd_cache [list][scan8[0] + 2 - 1*8]= *(uint32_t*)h->mvd_cache [list][scan8[0] + 3 - 1*8]= 0; } if(USES_LIST(left_type[0], list)){ const int b_xy= h->mb2b_xy[left_xy[0]] + 3; *(uint32_t*)h->mvd_cache[list][scan8[0] - 1 + 0*8]= *(uint32_t*)h->mvd_table[list][b_xy + h->b_stride*left_block[0]]; *(uint32_t*)h->mvd_cache[list][scan8[0] - 1 + 1*8]= *(uint32_t*)h->mvd_table[list][b_xy + h->b_stride*left_block[1]]; }else{ *(uint32_t*)h->mvd_cache [list][scan8[0] - 1 + 0*8]= *(uint32_t*)h->mvd_cache [list][scan8[0] - 1 + 1*8]= 0; } if(USES_LIST(left_type[1], list)){ const int b_xy= h->mb2b_xy[left_xy[1]] + 3; *(uint32_t*)h->mvd_cache[list][scan8[0] - 1 + 2*8]= *(uint32_t*)h->mvd_table[list][b_xy + h->b_stride*left_block[2]]; *(uint32_t*)h->mvd_cache[list][scan8[0] - 1 + 3*8]= *(uint32_t*)h->mvd_table[list][b_xy + h->b_stride*left_block[3]]; }else{ *(uint32_t*)h->mvd_cache [list][scan8[0] - 1 + 2*8]= *(uint32_t*)h->mvd_cache [list][scan8[0] - 1 + 3*8]= 0; } *(uint32_t*)h->mvd_cache [list][scan8[5 ]+1]= *(uint32_t*)h->mvd_cache [list][scan8[7 ]+1]= *(uint32_t*)h->mvd_cache [list][scan8[13]+1]= *(uint32_t*)h->mvd_cache [list][scan8[4 ]]= *(uint32_t*)h->mvd_cache [list][scan8[12]]= 0; if(h->slice_type_nos == FF_B_TYPE){ fill_rectangle(&h->direct_cache[scan8[0]], 4, 4, 8, 0, 1); if(IS_DIRECT(top_type)){ *(uint32_t*)&h->direct_cache[scan8[0] - 1*8]= 0x01010101; }else if(IS_8X8(top_type)){ int b8_xy = h->mb2b8_xy[top_xy] + h->b8_stride; h->direct_cache[scan8[0] + 0 - 1*8]= h->direct_table[b8_xy]; h->direct_cache[scan8[0] + 2 - 1*8]= h->direct_table[b8_xy + 1]; }else{ *(uint32_t*)&h->direct_cache[scan8[0] - 1*8]= 0; } if(IS_DIRECT(left_type[0])) h->direct_cache[scan8[0] - 1 + 0*8]= 1; else if(IS_8X8(left_type[0])) h->direct_cache[scan8[0] - 1 + 0*8]= h->direct_table[h->mb2b8_xy[left_xy[0]] + 1 + h->b8_stride*(left_block[0]>>1)]; else h->direct_cache[scan8[0] - 1 + 0*8]= 0; if(IS_DIRECT(left_type[1])) h->direct_cache[scan8[0] - 1 + 2*8]= 1; else if(IS_8X8(left_type[1])) h->direct_cache[scan8[0] - 1 + 2*8]= h->direct_table[h->mb2b8_xy[left_xy[1]] + 1 + h->b8_stride*(left_block[2]>>1)]; else h->direct_cache[scan8[0] - 1 + 2*8]= 0; } } if(FRAME_MBAFF){ #define MAP_MVS\ MAP_F2F(scan8[0] - 1 - 1*8, topleft_type)\ MAP_F2F(scan8[0] + 0 - 1*8, top_type)\ MAP_F2F(scan8[0] + 1 - 1*8, top_type)\ MAP_F2F(scan8[0] + 2 - 1*8, top_type)\ MAP_F2F(scan8[0] + 3 - 1*8, top_type)\ MAP_F2F(scan8[0] + 4 - 1*8, topright_type)\ MAP_F2F(scan8[0] - 1 + 0*8, left_type[0])\ MAP_F2F(scan8[0] - 1 + 1*8, left_type[0])\ MAP_F2F(scan8[0] - 1 + 2*8, left_type[1])\ MAP_F2F(scan8[0] - 1 + 3*8, left_type[1]) if(MB_FIELD){ #define MAP_F2F(idx, mb_type)\ if(!IS_INTERLACED(mb_type) && h->ref_cache[list][idx] >= 0){\ h->ref_cache[list][idx] <<= 1;\ h->mv_cache[list][idx][1] /= 2;\ h->mvd_cache[list][idx][1] /= 2;\ } MAP_MVS #undef MAP_F2F }else{ #define MAP_F2F(idx, mb_type)\ if(IS_INTERLACED(mb_type) && h->ref_cache[list][idx] >= 0){\ h->ref_cache[list][idx] >>= 1;\ h->mv_cache[list][idx][1] <<= 1;\ h->mvd_cache[list][idx][1] <<= 1;\ } MAP_MVS #undef MAP_F2F } } } } #endif h->neighbor_transform_size= !!IS_8x8DCT(top_type) + !!IS_8x8DCT(left_type[0]); }
{ "code": [ " if((for_deblock || (IS_DIRECT(mb_type) && !h->direct_spatial_mv_pred)) && !FRAME_MBAFF)" ], "line_no": [ 581 ] }
static void FUNC_0(H264Context *VAR_0, int VAR_1, int VAR_2){ MpegEncContext * const s = &VAR_0->s; const int VAR_3= VAR_0->VAR_3; int VAR_4, VAR_5, VAR_6, VAR_7[2]; int VAR_8, VAR_9, VAR_10, VAR_11[2]; int * VAR_12; int VAR_13= -1; int VAR_14; VAR_5 = VAR_3 - (s->mb_stride << FIELD_PICTURE); if(VAR_2 && (VAR_0->slice_num == 1 || VAR_0->slice_table[VAR_3] == VAR_0->slice_table[VAR_5]) && !FRAME_MBAFF) return; VAR_4 = VAR_5 - 1; VAR_6= VAR_5 + 1; VAR_7[1] = VAR_7[0] = VAR_3-1; VAR_12 = left_block_options[0]; if(FRAME_MBAFF){ const int VAR_15 = s->mb_x + (s->mb_y & ~1)*s->mb_stride; const int VAR_16 = VAR_15 - s->mb_stride; const int VAR_17 = VAR_16 - 1; const int VAR_18 = VAR_16 + 1; const int VAR_19 = !IS_INTERLACED(s->current_picture.VAR_1[VAR_17]); const int VAR_20 = !IS_INTERLACED(s->current_picture.VAR_1[VAR_16]); const int VAR_21 = !IS_INTERLACED(s->current_picture.VAR_1[VAR_18]); const int VAR_22 = !IS_INTERLACED(s->current_picture.VAR_1[VAR_15-1]); const int VAR_23 = !IS_INTERLACED(VAR_1); const int VAR_24 = (s->mb_y & 1); tprintf(s->avctx, "FUNC_0: VAR_23:%d, VAR_22:%d, VAR_19:%d, VAR_20:%d, VAR_21:%d\n", VAR_23, VAR_22, VAR_19, VAR_20, VAR_21); if (VAR_24 ? !VAR_23 : (!VAR_23 && !VAR_20) ) { VAR_5 -= s->mb_stride; } if (VAR_24 ? !VAR_23 : (!VAR_23 && !VAR_19) ) { VAR_4 -= s->mb_stride; } else if(VAR_24 && VAR_23 && !VAR_22) { VAR_4 += s->mb_stride; VAR_13 = 0; } if (VAR_24 ? !VAR_23 : (!VAR_23 && !VAR_21) ) { VAR_6 -= s->mb_stride; } if (VAR_22 != VAR_23) { VAR_7[1] = VAR_7[0] = VAR_15 - 1; if (VAR_23) { if (VAR_24) { VAR_12 = left_block_options[1]; } else { VAR_12= left_block_options[2]; } } else { VAR_7[1] += s->mb_stride; VAR_12 = left_block_options[3]; } } } VAR_0->top_mb_xy = VAR_5; VAR_0->left_mb_xy[0] = VAR_7[0]; VAR_0->left_mb_xy[1] = VAR_7[1]; if(VAR_2){ VAR_8 = 0; VAR_10 = 0; VAR_9 = VAR_0->slice_table[VAR_5 ] < 255 ? s->current_picture.VAR_1[VAR_5] : 0; VAR_11[0] = VAR_0->slice_table[VAR_7[0] ] < 255 ? s->current_picture.VAR_1[VAR_7[0]] : 0; VAR_11[1] = VAR_0->slice_table[VAR_7[1] ] < 255 ? s->current_picture.VAR_1[VAR_7[1]] : 0; if(FRAME_MBAFF && !IS_INTRA(VAR_1)){ int VAR_27; for(VAR_27=0; VAR_27<VAR_0->list_count; VAR_27++){ if(USES_LIST(VAR_1,VAR_27)){ int8_t *ref = &s->current_picture.ref_index[VAR_27][VAR_0->mb2b8_xy[VAR_3]]; *(uint32_t*)&VAR_0->ref_cache[VAR_27][scan8[ 0]] = *(uint32_t*)&VAR_0->ref_cache[VAR_27][scan8[ 2]] = pack16to32(ref[0],ref[1])*0x0101; ref += VAR_0->b8_stride; *(uint32_t*)&VAR_0->ref_cache[VAR_27][scan8[ 8]] = *(uint32_t*)&VAR_0->ref_cache[VAR_27][scan8[10]] = pack16to32(ref[0],ref[1])*0x0101; }else{ fill_rectangle(&VAR_0-> mv_cache[VAR_27][scan8[ 0]], 4, 4, 8, 0, 4); fill_rectangle(&VAR_0->ref_cache[VAR_27][scan8[ 0]], 4, 4, 8, (uint8_t)LIST_NOT_USED, 1); } } } }else{ VAR_8 = VAR_0->slice_table[VAR_4 ] == VAR_0->slice_num ? s->current_picture.VAR_1[VAR_4] : 0; VAR_9 = VAR_0->slice_table[VAR_5 ] == VAR_0->slice_num ? s->current_picture.VAR_1[VAR_5] : 0; VAR_10= VAR_0->slice_table[VAR_6] == VAR_0->slice_num ? s->current_picture.VAR_1[VAR_6]: 0; VAR_11[0] = VAR_0->slice_table[VAR_7[0] ] == VAR_0->slice_num ? s->current_picture.VAR_1[VAR_7[0]] : 0; VAR_11[1] = VAR_0->slice_table[VAR_7[1] ] == VAR_0->slice_num ? s->current_picture.VAR_1[VAR_7[1]] : 0; } if(IS_INTRA(VAR_1)){ VAR_0->topleft_samples_available= VAR_0->top_samples_available= VAR_0->left_samples_available= 0xFFFF; VAR_0->topright_samples_available= 0xEEEA; if(!IS_INTRA(VAR_9) && (VAR_9==0 || VAR_0->pps.constrained_intra_pred)){ VAR_0->topleft_samples_available= 0xB3FF; VAR_0->top_samples_available= 0x33FF; VAR_0->topright_samples_available= 0x26EA; } for(VAR_14=0; VAR_14<2; VAR_14++){ if(!IS_INTRA(VAR_11[VAR_14]) && (VAR_11[VAR_14]==0 || VAR_0->pps.constrained_intra_pred)){ VAR_0->topleft_samples_available&= 0xDF5F; VAR_0->left_samples_available&= 0x5F5F; } } if(!IS_INTRA(VAR_8) && (VAR_8==0 || VAR_0->pps.constrained_intra_pred)) VAR_0->topleft_samples_available&= 0x7FFF; if(!IS_INTRA(VAR_10) && (VAR_10==0 || VAR_0->pps.constrained_intra_pred)) VAR_0->topright_samples_available&= 0xFBFF; if(IS_INTRA4x4(VAR_1)){ if(IS_INTRA4x4(VAR_9)){ VAR_0->intra4x4_pred_mode_cache[4+8*0]= VAR_0->intra4x4_pred_mode[VAR_5][4]; VAR_0->intra4x4_pred_mode_cache[5+8*0]= VAR_0->intra4x4_pred_mode[VAR_5][5]; VAR_0->intra4x4_pred_mode_cache[6+8*0]= VAR_0->intra4x4_pred_mode[VAR_5][6]; VAR_0->intra4x4_pred_mode_cache[7+8*0]= VAR_0->intra4x4_pred_mode[VAR_5][3]; }else{ int VAR_27; if(!VAR_9 || (IS_INTER(VAR_9) && VAR_0->pps.constrained_intra_pred)) VAR_27= -1; else{ VAR_27= 2; } VAR_0->intra4x4_pred_mode_cache[4+8*0]= VAR_0->intra4x4_pred_mode_cache[5+8*0]= VAR_0->intra4x4_pred_mode_cache[6+8*0]= VAR_0->intra4x4_pred_mode_cache[7+8*0]= VAR_27; } for(VAR_14=0; VAR_14<2; VAR_14++){ if(IS_INTRA4x4(VAR_11[VAR_14])){ VAR_0->intra4x4_pred_mode_cache[3+8*1 + 2*8*VAR_14]= VAR_0->intra4x4_pred_mode[VAR_7[VAR_14]][VAR_12[0+2*VAR_14]]; VAR_0->intra4x4_pred_mode_cache[3+8*2 + 2*8*VAR_14]= VAR_0->intra4x4_pred_mode[VAR_7[VAR_14]][VAR_12[1+2*VAR_14]]; }else{ int VAR_27; if(!VAR_11[VAR_14] || (IS_INTER(VAR_11[VAR_14]) && VAR_0->pps.constrained_intra_pred)) VAR_27= -1; else{ VAR_27= 2; } VAR_0->intra4x4_pred_mode_cache[3+8*1 + 2*8*VAR_14]= VAR_0->intra4x4_pred_mode_cache[3+8*2 + 2*8*VAR_14]= VAR_27; } } } } if(VAR_9){ VAR_0->non_zero_count_cache[4+8*0]= VAR_0->non_zero_count[VAR_5][4]; VAR_0->non_zero_count_cache[5+8*0]= VAR_0->non_zero_count[VAR_5][5]; VAR_0->non_zero_count_cache[6+8*0]= VAR_0->non_zero_count[VAR_5][6]; VAR_0->non_zero_count_cache[7+8*0]= VAR_0->non_zero_count[VAR_5][3]; VAR_0->non_zero_count_cache[1+8*0]= VAR_0->non_zero_count[VAR_5][9]; VAR_0->non_zero_count_cache[2+8*0]= VAR_0->non_zero_count[VAR_5][8]; VAR_0->non_zero_count_cache[1+8*3]= VAR_0->non_zero_count[VAR_5][12]; VAR_0->non_zero_count_cache[2+8*3]= VAR_0->non_zero_count[VAR_5][11]; }else{ VAR_0->non_zero_count_cache[4+8*0]= VAR_0->non_zero_count_cache[5+8*0]= VAR_0->non_zero_count_cache[6+8*0]= VAR_0->non_zero_count_cache[7+8*0]= VAR_0->non_zero_count_cache[1+8*0]= VAR_0->non_zero_count_cache[2+8*0]= VAR_0->non_zero_count_cache[1+8*3]= VAR_0->non_zero_count_cache[2+8*3]= VAR_0->pps.cabac && !IS_INTRA(VAR_1) ? 0 : 64; } for (VAR_14=0; VAR_14<2; VAR_14++) { if(VAR_11[VAR_14]){ VAR_0->non_zero_count_cache[3+8*1 + 2*8*VAR_14]= VAR_0->non_zero_count[VAR_7[VAR_14]][VAR_12[0+2*VAR_14]]; VAR_0->non_zero_count_cache[3+8*2 + 2*8*VAR_14]= VAR_0->non_zero_count[VAR_7[VAR_14]][VAR_12[1+2*VAR_14]]; VAR_0->non_zero_count_cache[0+8*1 + 8*VAR_14]= VAR_0->non_zero_count[VAR_7[VAR_14]][VAR_12[4+2*VAR_14]]; VAR_0->non_zero_count_cache[0+8*4 + 8*VAR_14]= VAR_0->non_zero_count[VAR_7[VAR_14]][VAR_12[5+2*VAR_14]]; }else{ VAR_0->non_zero_count_cache[3+8*1 + 2*8*VAR_14]= VAR_0->non_zero_count_cache[3+8*2 + 2*8*VAR_14]= VAR_0->non_zero_count_cache[0+8*1 + 8*VAR_14]= VAR_0->non_zero_count_cache[0+8*4 + 8*VAR_14]= VAR_0->pps.cabac && !IS_INTRA(VAR_1) ? 0 : 64; } } if( VAR_0->pps.cabac ) { if(VAR_9) { VAR_0->top_cbp = VAR_0->cbp_table[VAR_5]; } else if(IS_INTRA(VAR_1)) { VAR_0->top_cbp = 0x1C0; } else { VAR_0->top_cbp = 0; } if (VAR_11[0]) { VAR_0->left_cbp = VAR_0->cbp_table[VAR_7[0]] & 0x1f0; } else if(IS_INTRA(VAR_1)) { VAR_0->left_cbp = 0x1C0; } else { VAR_0->left_cbp = 0; } if (VAR_11[0]) { VAR_0->left_cbp |= ((VAR_0->cbp_table[VAR_7[0]]>>((VAR_12[0]&(~1))+1))&0x1) << 1; } if (VAR_11[1]) { VAR_0->left_cbp |= ((VAR_0->cbp_table[VAR_7[1]]>>((VAR_12[2]&(~1))+1))&0x1) << 3; } } #if 1 if(IS_INTER(VAR_1) || IS_DIRECT(VAR_1)){ int VAR_27; for(VAR_27=0; VAR_27<VAR_0->list_count; VAR_27++){ if(!USES_LIST(VAR_1, VAR_27) && !IS_DIRECT(VAR_1) && !VAR_0->deblocking_filter){ continue; } VAR_0->mv_cache_clean[VAR_27]= 0; if(USES_LIST(VAR_9, VAR_27)){ const int b_xy= VAR_0->mb2b_xy[VAR_5] + 3*VAR_0->b_stride; const int b8_xy= VAR_0->mb2b8_xy[VAR_5] + VAR_0->b8_stride; *(uint32_t*)VAR_0->mv_cache[VAR_27][scan8[0] + 0 - 1*8]= *(uint32_t*)s->current_picture.motion_val[VAR_27][b_xy + 0]; *(uint32_t*)VAR_0->mv_cache[VAR_27][scan8[0] + 1 - 1*8]= *(uint32_t*)s->current_picture.motion_val[VAR_27][b_xy + 1]; *(uint32_t*)VAR_0->mv_cache[VAR_27][scan8[0] + 2 - 1*8]= *(uint32_t*)s->current_picture.motion_val[VAR_27][b_xy + 2]; *(uint32_t*)VAR_0->mv_cache[VAR_27][scan8[0] + 3 - 1*8]= *(uint32_t*)s->current_picture.motion_val[VAR_27][b_xy + 3]; VAR_0->ref_cache[VAR_27][scan8[0] + 0 - 1*8]= VAR_0->ref_cache[VAR_27][scan8[0] + 1 - 1*8]= s->current_picture.ref_index[VAR_27][b8_xy + 0]; VAR_0->ref_cache[VAR_27][scan8[0] + 2 - 1*8]= VAR_0->ref_cache[VAR_27][scan8[0] + 3 - 1*8]= s->current_picture.ref_index[VAR_27][b8_xy + 1]; }else{ *(uint32_t*)VAR_0->mv_cache [VAR_27][scan8[0] + 0 - 1*8]= *(uint32_t*)VAR_0->mv_cache [VAR_27][scan8[0] + 1 - 1*8]= *(uint32_t*)VAR_0->mv_cache [VAR_27][scan8[0] + 2 - 1*8]= *(uint32_t*)VAR_0->mv_cache [VAR_27][scan8[0] + 3 - 1*8]= 0; *(uint32_t*)&VAR_0->ref_cache[VAR_27][scan8[0] + 0 - 1*8]= ((VAR_9 ? LIST_NOT_USED : PART_NOT_AVAILABLE)&0xFF)*0x01010101; } for(VAR_14=0; VAR_14<2; VAR_14++){ int cache_idx = scan8[0] - 1 + VAR_14*2*8; if(USES_LIST(VAR_11[VAR_14], VAR_27)){ const int b_xy= VAR_0->mb2b_xy[VAR_7[VAR_14]] + 3; const int b8_xy= VAR_0->mb2b8_xy[VAR_7[VAR_14]] + 1; *(uint32_t*)VAR_0->mv_cache[VAR_27][cache_idx ]= *(uint32_t*)s->current_picture.motion_val[VAR_27][b_xy + VAR_0->b_stride*VAR_12[0+VAR_14*2]]; *(uint32_t*)VAR_0->mv_cache[VAR_27][cache_idx+8]= *(uint32_t*)s->current_picture.motion_val[VAR_27][b_xy + VAR_0->b_stride*VAR_12[1+VAR_14*2]]; VAR_0->ref_cache[VAR_27][cache_idx ]= s->current_picture.ref_index[VAR_27][b8_xy + VAR_0->b8_stride*(VAR_12[0+VAR_14*2]>>1)]; VAR_0->ref_cache[VAR_27][cache_idx+8]= s->current_picture.ref_index[VAR_27][b8_xy + VAR_0->b8_stride*(VAR_12[1+VAR_14*2]>>1)]; }else{ *(uint32_t*)VAR_0->mv_cache [VAR_27][cache_idx ]= *(uint32_t*)VAR_0->mv_cache [VAR_27][cache_idx+8]= 0; VAR_0->ref_cache[VAR_27][cache_idx ]= VAR_0->ref_cache[VAR_27][cache_idx+8]= VAR_11[VAR_14] ? LIST_NOT_USED : PART_NOT_AVAILABLE; } } if((VAR_2 || (IS_DIRECT(VAR_1) && !VAR_0->direct_spatial_mv_pred)) && !FRAME_MBAFF) continue; if(USES_LIST(VAR_8, VAR_27)){ const int b_xy = VAR_0->mb2b_xy[VAR_4] + 3 + VAR_0->b_stride + (VAR_13 & 2*VAR_0->b_stride); const int b8_xy= VAR_0->mb2b8_xy[VAR_4] + 1 + (VAR_13 & VAR_0->b8_stride); *(uint32_t*)VAR_0->mv_cache[VAR_27][scan8[0] - 1 - 1*8]= *(uint32_t*)s->current_picture.motion_val[VAR_27][b_xy]; VAR_0->ref_cache[VAR_27][scan8[0] - 1 - 1*8]= s->current_picture.ref_index[VAR_27][b8_xy]; }else{ *(uint32_t*)VAR_0->mv_cache[VAR_27][scan8[0] - 1 - 1*8]= 0; VAR_0->ref_cache[VAR_27][scan8[0] - 1 - 1*8]= VAR_8 ? LIST_NOT_USED : PART_NOT_AVAILABLE; } if(USES_LIST(VAR_10, VAR_27)){ const int b_xy= VAR_0->mb2b_xy[VAR_6] + 3*VAR_0->b_stride; const int b8_xy= VAR_0->mb2b8_xy[VAR_6] + VAR_0->b8_stride; *(uint32_t*)VAR_0->mv_cache[VAR_27][scan8[0] + 4 - 1*8]= *(uint32_t*)s->current_picture.motion_val[VAR_27][b_xy]; VAR_0->ref_cache[VAR_27][scan8[0] + 4 - 1*8]= s->current_picture.ref_index[VAR_27][b8_xy]; }else{ *(uint32_t*)VAR_0->mv_cache [VAR_27][scan8[0] + 4 - 1*8]= 0; VAR_0->ref_cache[VAR_27][scan8[0] + 4 - 1*8]= VAR_10 ? LIST_NOT_USED : PART_NOT_AVAILABLE; } if((IS_SKIP(VAR_1) || IS_DIRECT(VAR_1)) && !FRAME_MBAFF) continue; VAR_0->ref_cache[VAR_27][scan8[5 ]+1] = VAR_0->ref_cache[VAR_27][scan8[7 ]+1] = VAR_0->ref_cache[VAR_27][scan8[13]+1] = VAR_0->ref_cache[VAR_27][scan8[4 ]] = VAR_0->ref_cache[VAR_27][scan8[12]] = PART_NOT_AVAILABLE; *(uint32_t*)VAR_0->mv_cache [VAR_27][scan8[5 ]+1]= *(uint32_t*)VAR_0->mv_cache [VAR_27][scan8[7 ]+1]= *(uint32_t*)VAR_0->mv_cache [VAR_27][scan8[13]+1]= *(uint32_t*)VAR_0->mv_cache [VAR_27][scan8[4 ]]= *(uint32_t*)VAR_0->mv_cache [VAR_27][scan8[12]]= 0; if( VAR_0->pps.cabac ) { if(USES_LIST(VAR_9, VAR_27)){ const int b_xy= VAR_0->mb2b_xy[VAR_5] + 3*VAR_0->b_stride; *(uint32_t*)VAR_0->mvd_cache[VAR_27][scan8[0] + 0 - 1*8]= *(uint32_t*)VAR_0->mvd_table[VAR_27][b_xy + 0]; *(uint32_t*)VAR_0->mvd_cache[VAR_27][scan8[0] + 1 - 1*8]= *(uint32_t*)VAR_0->mvd_table[VAR_27][b_xy + 1]; *(uint32_t*)VAR_0->mvd_cache[VAR_27][scan8[0] + 2 - 1*8]= *(uint32_t*)VAR_0->mvd_table[VAR_27][b_xy + 2]; *(uint32_t*)VAR_0->mvd_cache[VAR_27][scan8[0] + 3 - 1*8]= *(uint32_t*)VAR_0->mvd_table[VAR_27][b_xy + 3]; }else{ *(uint32_t*)VAR_0->mvd_cache [VAR_27][scan8[0] + 0 - 1*8]= *(uint32_t*)VAR_0->mvd_cache [VAR_27][scan8[0] + 1 - 1*8]= *(uint32_t*)VAR_0->mvd_cache [VAR_27][scan8[0] + 2 - 1*8]= *(uint32_t*)VAR_0->mvd_cache [VAR_27][scan8[0] + 3 - 1*8]= 0; } if(USES_LIST(VAR_11[0], VAR_27)){ const int b_xy= VAR_0->mb2b_xy[VAR_7[0]] + 3; *(uint32_t*)VAR_0->mvd_cache[VAR_27][scan8[0] - 1 + 0*8]= *(uint32_t*)VAR_0->mvd_table[VAR_27][b_xy + VAR_0->b_stride*VAR_12[0]]; *(uint32_t*)VAR_0->mvd_cache[VAR_27][scan8[0] - 1 + 1*8]= *(uint32_t*)VAR_0->mvd_table[VAR_27][b_xy + VAR_0->b_stride*VAR_12[1]]; }else{ *(uint32_t*)VAR_0->mvd_cache [VAR_27][scan8[0] - 1 + 0*8]= *(uint32_t*)VAR_0->mvd_cache [VAR_27][scan8[0] - 1 + 1*8]= 0; } if(USES_LIST(VAR_11[1], VAR_27)){ const int b_xy= VAR_0->mb2b_xy[VAR_7[1]] + 3; *(uint32_t*)VAR_0->mvd_cache[VAR_27][scan8[0] - 1 + 2*8]= *(uint32_t*)VAR_0->mvd_table[VAR_27][b_xy + VAR_0->b_stride*VAR_12[2]]; *(uint32_t*)VAR_0->mvd_cache[VAR_27][scan8[0] - 1 + 3*8]= *(uint32_t*)VAR_0->mvd_table[VAR_27][b_xy + VAR_0->b_stride*VAR_12[3]]; }else{ *(uint32_t*)VAR_0->mvd_cache [VAR_27][scan8[0] - 1 + 2*8]= *(uint32_t*)VAR_0->mvd_cache [VAR_27][scan8[0] - 1 + 3*8]= 0; } *(uint32_t*)VAR_0->mvd_cache [VAR_27][scan8[5 ]+1]= *(uint32_t*)VAR_0->mvd_cache [VAR_27][scan8[7 ]+1]= *(uint32_t*)VAR_0->mvd_cache [VAR_27][scan8[13]+1]= *(uint32_t*)VAR_0->mvd_cache [VAR_27][scan8[4 ]]= *(uint32_t*)VAR_0->mvd_cache [VAR_27][scan8[12]]= 0; if(VAR_0->slice_type_nos == FF_B_TYPE){ fill_rectangle(&VAR_0->direct_cache[scan8[0]], 4, 4, 8, 0, 1); if(IS_DIRECT(VAR_9)){ *(uint32_t*)&VAR_0->direct_cache[scan8[0] - 1*8]= 0x01010101; }else if(IS_8X8(VAR_9)){ int b8_xy = VAR_0->mb2b8_xy[VAR_5] + VAR_0->b8_stride; VAR_0->direct_cache[scan8[0] + 0 - 1*8]= VAR_0->direct_table[b8_xy]; VAR_0->direct_cache[scan8[0] + 2 - 1*8]= VAR_0->direct_table[b8_xy + 1]; }else{ *(uint32_t*)&VAR_0->direct_cache[scan8[0] - 1*8]= 0; } if(IS_DIRECT(VAR_11[0])) VAR_0->direct_cache[scan8[0] - 1 + 0*8]= 1; else if(IS_8X8(VAR_11[0])) VAR_0->direct_cache[scan8[0] - 1 + 0*8]= VAR_0->direct_table[VAR_0->mb2b8_xy[VAR_7[0]] + 1 + VAR_0->b8_stride*(VAR_12[0]>>1)]; else VAR_0->direct_cache[scan8[0] - 1 + 0*8]= 0; if(IS_DIRECT(VAR_11[1])) VAR_0->direct_cache[scan8[0] - 1 + 2*8]= 1; else if(IS_8X8(VAR_11[1])) VAR_0->direct_cache[scan8[0] - 1 + 2*8]= VAR_0->direct_table[VAR_0->mb2b8_xy[VAR_7[1]] + 1 + VAR_0->b8_stride*(VAR_12[2]>>1)]; else VAR_0->direct_cache[scan8[0] - 1 + 2*8]= 0; } } if(FRAME_MBAFF){ #define MAP_MVS\ MAP_F2F(scan8[0] - 1 - 1*8, VAR_8)\ MAP_F2F(scan8[0] + 0 - 1*8, VAR_9)\ MAP_F2F(scan8[0] + 1 - 1*8, VAR_9)\ MAP_F2F(scan8[0] + 2 - 1*8, VAR_9)\ MAP_F2F(scan8[0] + 3 - 1*8, VAR_9)\ MAP_F2F(scan8[0] + 4 - 1*8, VAR_10)\ MAP_F2F(scan8[0] - 1 + 0*8, VAR_11[0])\ MAP_F2F(scan8[0] - 1 + 1*8, VAR_11[0])\ MAP_F2F(scan8[0] - 1 + 2*8, VAR_11[1])\ MAP_F2F(scan8[0] - 1 + 3*8, VAR_11[1]) if(MB_FIELD){ #define MAP_F2F(idx, VAR_1)\ if(!IS_INTERLACED(VAR_1) && VAR_0->ref_cache[VAR_27][idx] >= 0){\ VAR_0->ref_cache[VAR_27][idx] <<= 1;\ VAR_0->mv_cache[VAR_27][idx][1] /= 2;\ VAR_0->mvd_cache[VAR_27][idx][1] /= 2;\ } MAP_MVS #undef MAP_F2F }else{ #define MAP_F2F(idx, VAR_1)\ if(IS_INTERLACED(VAR_1) && VAR_0->ref_cache[VAR_27][idx] >= 0){\ VAR_0->ref_cache[VAR_27][idx] >>= 1;\ VAR_0->mv_cache[VAR_27][idx][1] <<= 1;\ VAR_0->mvd_cache[VAR_27][idx][1] <<= 1;\ } MAP_MVS #undef MAP_F2F } } } } #endif VAR_0->neighbor_transform_size= !!IS_8x8DCT(VAR_9) + !!IS_8x8DCT(VAR_11[0]); }
[ "static void FUNC_0(H264Context *VAR_0, int VAR_1, int VAR_2){", "MpegEncContext * const s = &VAR_0->s;", "const int VAR_3= VAR_0->VAR_3;", "int VAR_4, VAR_5, VAR_6, VAR_7[2];", "int VAR_8, VAR_9, VAR_10, VAR_11[2];", "int * VAR_12;", "int VAR_13= -1;", "int VAR_14;", "VAR_5 = VAR_3 - (s->mb_stride << FIELD_PICTURE);", "if(VAR_2 && (VAR_0->slice_num == 1 || VAR_0->slice_table[VAR_3] == VAR_0->slice_table[VAR_5]) && !FRAME_MBAFF)\nreturn;", "VAR_4 = VAR_5 - 1;", "VAR_6= VAR_5 + 1;", "VAR_7[1] = VAR_7[0] = VAR_3-1;", "VAR_12 = left_block_options[0];", "if(FRAME_MBAFF){", "const int VAR_15 = s->mb_x + (s->mb_y & ~1)*s->mb_stride;", "const int VAR_16 = VAR_15 - s->mb_stride;", "const int VAR_17 = VAR_16 - 1;", "const int VAR_18 = VAR_16 + 1;", "const int VAR_19 = !IS_INTERLACED(s->current_picture.VAR_1[VAR_17]);", "const int VAR_20 = !IS_INTERLACED(s->current_picture.VAR_1[VAR_16]);", "const int VAR_21 = !IS_INTERLACED(s->current_picture.VAR_1[VAR_18]);", "const int VAR_22 = !IS_INTERLACED(s->current_picture.VAR_1[VAR_15-1]);", "const int VAR_23 = !IS_INTERLACED(VAR_1);", "const int VAR_24 = (s->mb_y & 1);", "tprintf(s->avctx, \"FUNC_0: VAR_23:%d, VAR_22:%d, VAR_19:%d, VAR_20:%d, VAR_21:%d\\n\", VAR_23, VAR_22, VAR_19, VAR_20, VAR_21);", "if (VAR_24\n? !VAR_23\n: (!VAR_23 && !VAR_20)\n) {", "VAR_5 -= s->mb_stride;", "}", "if (VAR_24\n? !VAR_23\n: (!VAR_23 && !VAR_19)\n) {", "VAR_4 -= s->mb_stride;", "} else if(VAR_24 && VAR_23 && !VAR_22) {", "VAR_4 += s->mb_stride;", "VAR_13 = 0;", "}", "if (VAR_24\n? !VAR_23\n: (!VAR_23 && !VAR_21)\n) {", "VAR_6 -= s->mb_stride;", "}", "if (VAR_22 != VAR_23) {", "VAR_7[1] = VAR_7[0] = VAR_15 - 1;", "if (VAR_23) {", "if (VAR_24) {", "VAR_12 = left_block_options[1];", "} else {", "VAR_12= left_block_options[2];", "}", "} else {", "VAR_7[1] += s->mb_stride;", "VAR_12 = left_block_options[3];", "}", "}", "}", "VAR_0->top_mb_xy = VAR_5;", "VAR_0->left_mb_xy[0] = VAR_7[0];", "VAR_0->left_mb_xy[1] = VAR_7[1];", "if(VAR_2){", "VAR_8 = 0;", "VAR_10 = 0;", "VAR_9 = VAR_0->slice_table[VAR_5 ] < 255 ? s->current_picture.VAR_1[VAR_5] : 0;", "VAR_11[0] = VAR_0->slice_table[VAR_7[0] ] < 255 ? s->current_picture.VAR_1[VAR_7[0]] : 0;", "VAR_11[1] = VAR_0->slice_table[VAR_7[1] ] < 255 ? s->current_picture.VAR_1[VAR_7[1]] : 0;", "if(FRAME_MBAFF && !IS_INTRA(VAR_1)){", "int VAR_27;", "for(VAR_27=0; VAR_27<VAR_0->list_count; VAR_27++){", "if(USES_LIST(VAR_1,VAR_27)){", "int8_t *ref = &s->current_picture.ref_index[VAR_27][VAR_0->mb2b8_xy[VAR_3]];", "*(uint32_t*)&VAR_0->ref_cache[VAR_27][scan8[ 0]] =\n*(uint32_t*)&VAR_0->ref_cache[VAR_27][scan8[ 2]] = pack16to32(ref[0],ref[1])*0x0101;", "ref += VAR_0->b8_stride;", "*(uint32_t*)&VAR_0->ref_cache[VAR_27][scan8[ 8]] =\n*(uint32_t*)&VAR_0->ref_cache[VAR_27][scan8[10]] = pack16to32(ref[0],ref[1])*0x0101;", "}else{", "fill_rectangle(&VAR_0-> mv_cache[VAR_27][scan8[ 0]], 4, 4, 8, 0, 4);", "fill_rectangle(&VAR_0->ref_cache[VAR_27][scan8[ 0]], 4, 4, 8, (uint8_t)LIST_NOT_USED, 1);", "}", "}", "}", "}else{", "VAR_8 = VAR_0->slice_table[VAR_4 ] == VAR_0->slice_num ? s->current_picture.VAR_1[VAR_4] : 0;", "VAR_9 = VAR_0->slice_table[VAR_5 ] == VAR_0->slice_num ? s->current_picture.VAR_1[VAR_5] : 0;", "VAR_10= VAR_0->slice_table[VAR_6] == VAR_0->slice_num ? s->current_picture.VAR_1[VAR_6]: 0;", "VAR_11[0] = VAR_0->slice_table[VAR_7[0] ] == VAR_0->slice_num ? s->current_picture.VAR_1[VAR_7[0]] : 0;", "VAR_11[1] = VAR_0->slice_table[VAR_7[1] ] == VAR_0->slice_num ? s->current_picture.VAR_1[VAR_7[1]] : 0;", "}", "if(IS_INTRA(VAR_1)){", "VAR_0->topleft_samples_available=\nVAR_0->top_samples_available=\nVAR_0->left_samples_available= 0xFFFF;", "VAR_0->topright_samples_available= 0xEEEA;", "if(!IS_INTRA(VAR_9) && (VAR_9==0 || VAR_0->pps.constrained_intra_pred)){", "VAR_0->topleft_samples_available= 0xB3FF;", "VAR_0->top_samples_available= 0x33FF;", "VAR_0->topright_samples_available= 0x26EA;", "}", "for(VAR_14=0; VAR_14<2; VAR_14++){", "if(!IS_INTRA(VAR_11[VAR_14]) && (VAR_11[VAR_14]==0 || VAR_0->pps.constrained_intra_pred)){", "VAR_0->topleft_samples_available&= 0xDF5F;", "VAR_0->left_samples_available&= 0x5F5F;", "}", "}", "if(!IS_INTRA(VAR_8) && (VAR_8==0 || VAR_0->pps.constrained_intra_pred))\nVAR_0->topleft_samples_available&= 0x7FFF;", "if(!IS_INTRA(VAR_10) && (VAR_10==0 || VAR_0->pps.constrained_intra_pred))\nVAR_0->topright_samples_available&= 0xFBFF;", "if(IS_INTRA4x4(VAR_1)){", "if(IS_INTRA4x4(VAR_9)){", "VAR_0->intra4x4_pred_mode_cache[4+8*0]= VAR_0->intra4x4_pred_mode[VAR_5][4];", "VAR_0->intra4x4_pred_mode_cache[5+8*0]= VAR_0->intra4x4_pred_mode[VAR_5][5];", "VAR_0->intra4x4_pred_mode_cache[6+8*0]= VAR_0->intra4x4_pred_mode[VAR_5][6];", "VAR_0->intra4x4_pred_mode_cache[7+8*0]= VAR_0->intra4x4_pred_mode[VAR_5][3];", "}else{", "int VAR_27;", "if(!VAR_9 || (IS_INTER(VAR_9) && VAR_0->pps.constrained_intra_pred))\nVAR_27= -1;", "else{", "VAR_27= 2;", "}", "VAR_0->intra4x4_pred_mode_cache[4+8*0]=\nVAR_0->intra4x4_pred_mode_cache[5+8*0]=\nVAR_0->intra4x4_pred_mode_cache[6+8*0]=\nVAR_0->intra4x4_pred_mode_cache[7+8*0]= VAR_27;", "}", "for(VAR_14=0; VAR_14<2; VAR_14++){", "if(IS_INTRA4x4(VAR_11[VAR_14])){", "VAR_0->intra4x4_pred_mode_cache[3+8*1 + 2*8*VAR_14]= VAR_0->intra4x4_pred_mode[VAR_7[VAR_14]][VAR_12[0+2*VAR_14]];", "VAR_0->intra4x4_pred_mode_cache[3+8*2 + 2*8*VAR_14]= VAR_0->intra4x4_pred_mode[VAR_7[VAR_14]][VAR_12[1+2*VAR_14]];", "}else{", "int VAR_27;", "if(!VAR_11[VAR_14] || (IS_INTER(VAR_11[VAR_14]) && VAR_0->pps.constrained_intra_pred))\nVAR_27= -1;", "else{", "VAR_27= 2;", "}", "VAR_0->intra4x4_pred_mode_cache[3+8*1 + 2*8*VAR_14]=\nVAR_0->intra4x4_pred_mode_cache[3+8*2 + 2*8*VAR_14]= VAR_27;", "}", "}", "}", "}", "if(VAR_9){", "VAR_0->non_zero_count_cache[4+8*0]= VAR_0->non_zero_count[VAR_5][4];", "VAR_0->non_zero_count_cache[5+8*0]= VAR_0->non_zero_count[VAR_5][5];", "VAR_0->non_zero_count_cache[6+8*0]= VAR_0->non_zero_count[VAR_5][6];", "VAR_0->non_zero_count_cache[7+8*0]= VAR_0->non_zero_count[VAR_5][3];", "VAR_0->non_zero_count_cache[1+8*0]= VAR_0->non_zero_count[VAR_5][9];", "VAR_0->non_zero_count_cache[2+8*0]= VAR_0->non_zero_count[VAR_5][8];", "VAR_0->non_zero_count_cache[1+8*3]= VAR_0->non_zero_count[VAR_5][12];", "VAR_0->non_zero_count_cache[2+8*3]= VAR_0->non_zero_count[VAR_5][11];", "}else{", "VAR_0->non_zero_count_cache[4+8*0]=\nVAR_0->non_zero_count_cache[5+8*0]=\nVAR_0->non_zero_count_cache[6+8*0]=\nVAR_0->non_zero_count_cache[7+8*0]=\nVAR_0->non_zero_count_cache[1+8*0]=\nVAR_0->non_zero_count_cache[2+8*0]=\nVAR_0->non_zero_count_cache[1+8*3]=\nVAR_0->non_zero_count_cache[2+8*3]= VAR_0->pps.cabac && !IS_INTRA(VAR_1) ? 0 : 64;", "}", "for (VAR_14=0; VAR_14<2; VAR_14++) {", "if(VAR_11[VAR_14]){", "VAR_0->non_zero_count_cache[3+8*1 + 2*8*VAR_14]= VAR_0->non_zero_count[VAR_7[VAR_14]][VAR_12[0+2*VAR_14]];", "VAR_0->non_zero_count_cache[3+8*2 + 2*8*VAR_14]= VAR_0->non_zero_count[VAR_7[VAR_14]][VAR_12[1+2*VAR_14]];", "VAR_0->non_zero_count_cache[0+8*1 + 8*VAR_14]= VAR_0->non_zero_count[VAR_7[VAR_14]][VAR_12[4+2*VAR_14]];", "VAR_0->non_zero_count_cache[0+8*4 + 8*VAR_14]= VAR_0->non_zero_count[VAR_7[VAR_14]][VAR_12[5+2*VAR_14]];", "}else{", "VAR_0->non_zero_count_cache[3+8*1 + 2*8*VAR_14]=\nVAR_0->non_zero_count_cache[3+8*2 + 2*8*VAR_14]=\nVAR_0->non_zero_count_cache[0+8*1 + 8*VAR_14]=\nVAR_0->non_zero_count_cache[0+8*4 + 8*VAR_14]= VAR_0->pps.cabac && !IS_INTRA(VAR_1) ? 0 : 64;", "}", "}", "if( VAR_0->pps.cabac ) {", "if(VAR_9) {", "VAR_0->top_cbp = VAR_0->cbp_table[VAR_5];", "} else if(IS_INTRA(VAR_1)) {", "VAR_0->top_cbp = 0x1C0;", "} else {", "VAR_0->top_cbp = 0;", "}", "if (VAR_11[0]) {", "VAR_0->left_cbp = VAR_0->cbp_table[VAR_7[0]] & 0x1f0;", "} else if(IS_INTRA(VAR_1)) {", "VAR_0->left_cbp = 0x1C0;", "} else {", "VAR_0->left_cbp = 0;", "}", "if (VAR_11[0]) {", "VAR_0->left_cbp |= ((VAR_0->cbp_table[VAR_7[0]]>>((VAR_12[0]&(~1))+1))&0x1) << 1;", "}", "if (VAR_11[1]) {", "VAR_0->left_cbp |= ((VAR_0->cbp_table[VAR_7[1]]>>((VAR_12[2]&(~1))+1))&0x1) << 3;", "}", "}", "#if 1\nif(IS_INTER(VAR_1) || IS_DIRECT(VAR_1)){", "int VAR_27;", "for(VAR_27=0; VAR_27<VAR_0->list_count; VAR_27++){", "if(!USES_LIST(VAR_1, VAR_27) && !IS_DIRECT(VAR_1) && !VAR_0->deblocking_filter){", "continue;", "}", "VAR_0->mv_cache_clean[VAR_27]= 0;", "if(USES_LIST(VAR_9, VAR_27)){", "const int b_xy= VAR_0->mb2b_xy[VAR_5] + 3*VAR_0->b_stride;", "const int b8_xy= VAR_0->mb2b8_xy[VAR_5] + VAR_0->b8_stride;", "*(uint32_t*)VAR_0->mv_cache[VAR_27][scan8[0] + 0 - 1*8]= *(uint32_t*)s->current_picture.motion_val[VAR_27][b_xy + 0];", "*(uint32_t*)VAR_0->mv_cache[VAR_27][scan8[0] + 1 - 1*8]= *(uint32_t*)s->current_picture.motion_val[VAR_27][b_xy + 1];", "*(uint32_t*)VAR_0->mv_cache[VAR_27][scan8[0] + 2 - 1*8]= *(uint32_t*)s->current_picture.motion_val[VAR_27][b_xy + 2];", "*(uint32_t*)VAR_0->mv_cache[VAR_27][scan8[0] + 3 - 1*8]= *(uint32_t*)s->current_picture.motion_val[VAR_27][b_xy + 3];", "VAR_0->ref_cache[VAR_27][scan8[0] + 0 - 1*8]=\nVAR_0->ref_cache[VAR_27][scan8[0] + 1 - 1*8]= s->current_picture.ref_index[VAR_27][b8_xy + 0];", "VAR_0->ref_cache[VAR_27][scan8[0] + 2 - 1*8]=\nVAR_0->ref_cache[VAR_27][scan8[0] + 3 - 1*8]= s->current_picture.ref_index[VAR_27][b8_xy + 1];", "}else{", "*(uint32_t*)VAR_0->mv_cache [VAR_27][scan8[0] + 0 - 1*8]=\n*(uint32_t*)VAR_0->mv_cache [VAR_27][scan8[0] + 1 - 1*8]=\n*(uint32_t*)VAR_0->mv_cache [VAR_27][scan8[0] + 2 - 1*8]=\n*(uint32_t*)VAR_0->mv_cache [VAR_27][scan8[0] + 3 - 1*8]= 0;", "*(uint32_t*)&VAR_0->ref_cache[VAR_27][scan8[0] + 0 - 1*8]= ((VAR_9 ? LIST_NOT_USED : PART_NOT_AVAILABLE)&0xFF)*0x01010101;", "}", "for(VAR_14=0; VAR_14<2; VAR_14++){", "int cache_idx = scan8[0] - 1 + VAR_14*2*8;", "if(USES_LIST(VAR_11[VAR_14], VAR_27)){", "const int b_xy= VAR_0->mb2b_xy[VAR_7[VAR_14]] + 3;", "const int b8_xy= VAR_0->mb2b8_xy[VAR_7[VAR_14]] + 1;", "*(uint32_t*)VAR_0->mv_cache[VAR_27][cache_idx ]= *(uint32_t*)s->current_picture.motion_val[VAR_27][b_xy + VAR_0->b_stride*VAR_12[0+VAR_14*2]];", "*(uint32_t*)VAR_0->mv_cache[VAR_27][cache_idx+8]= *(uint32_t*)s->current_picture.motion_val[VAR_27][b_xy + VAR_0->b_stride*VAR_12[1+VAR_14*2]];", "VAR_0->ref_cache[VAR_27][cache_idx ]= s->current_picture.ref_index[VAR_27][b8_xy + VAR_0->b8_stride*(VAR_12[0+VAR_14*2]>>1)];", "VAR_0->ref_cache[VAR_27][cache_idx+8]= s->current_picture.ref_index[VAR_27][b8_xy + VAR_0->b8_stride*(VAR_12[1+VAR_14*2]>>1)];", "}else{", "*(uint32_t*)VAR_0->mv_cache [VAR_27][cache_idx ]=\n*(uint32_t*)VAR_0->mv_cache [VAR_27][cache_idx+8]= 0;", "VAR_0->ref_cache[VAR_27][cache_idx ]=\nVAR_0->ref_cache[VAR_27][cache_idx+8]= VAR_11[VAR_14] ? LIST_NOT_USED : PART_NOT_AVAILABLE;", "}", "}", "if((VAR_2 || (IS_DIRECT(VAR_1) && !VAR_0->direct_spatial_mv_pred)) && !FRAME_MBAFF)\ncontinue;", "if(USES_LIST(VAR_8, VAR_27)){", "const int b_xy = VAR_0->mb2b_xy[VAR_4] + 3 + VAR_0->b_stride + (VAR_13 & 2*VAR_0->b_stride);", "const int b8_xy= VAR_0->mb2b8_xy[VAR_4] + 1 + (VAR_13 & VAR_0->b8_stride);", "*(uint32_t*)VAR_0->mv_cache[VAR_27][scan8[0] - 1 - 1*8]= *(uint32_t*)s->current_picture.motion_val[VAR_27][b_xy];", "VAR_0->ref_cache[VAR_27][scan8[0] - 1 - 1*8]= s->current_picture.ref_index[VAR_27][b8_xy];", "}else{", "*(uint32_t*)VAR_0->mv_cache[VAR_27][scan8[0] - 1 - 1*8]= 0;", "VAR_0->ref_cache[VAR_27][scan8[0] - 1 - 1*8]= VAR_8 ? LIST_NOT_USED : PART_NOT_AVAILABLE;", "}", "if(USES_LIST(VAR_10, VAR_27)){", "const int b_xy= VAR_0->mb2b_xy[VAR_6] + 3*VAR_0->b_stride;", "const int b8_xy= VAR_0->mb2b8_xy[VAR_6] + VAR_0->b8_stride;", "*(uint32_t*)VAR_0->mv_cache[VAR_27][scan8[0] + 4 - 1*8]= *(uint32_t*)s->current_picture.motion_val[VAR_27][b_xy];", "VAR_0->ref_cache[VAR_27][scan8[0] + 4 - 1*8]= s->current_picture.ref_index[VAR_27][b8_xy];", "}else{", "*(uint32_t*)VAR_0->mv_cache [VAR_27][scan8[0] + 4 - 1*8]= 0;", "VAR_0->ref_cache[VAR_27][scan8[0] + 4 - 1*8]= VAR_10 ? LIST_NOT_USED : PART_NOT_AVAILABLE;", "}", "if((IS_SKIP(VAR_1) || IS_DIRECT(VAR_1)) && !FRAME_MBAFF)\ncontinue;", "VAR_0->ref_cache[VAR_27][scan8[5 ]+1] =\nVAR_0->ref_cache[VAR_27][scan8[7 ]+1] =\nVAR_0->ref_cache[VAR_27][scan8[13]+1] =\nVAR_0->ref_cache[VAR_27][scan8[4 ]] =\nVAR_0->ref_cache[VAR_27][scan8[12]] = PART_NOT_AVAILABLE;", "*(uint32_t*)VAR_0->mv_cache [VAR_27][scan8[5 ]+1]=\n*(uint32_t*)VAR_0->mv_cache [VAR_27][scan8[7 ]+1]=\n*(uint32_t*)VAR_0->mv_cache [VAR_27][scan8[13]+1]=\n*(uint32_t*)VAR_0->mv_cache [VAR_27][scan8[4 ]]=\n*(uint32_t*)VAR_0->mv_cache [VAR_27][scan8[12]]= 0;", "if( VAR_0->pps.cabac ) {", "if(USES_LIST(VAR_9, VAR_27)){", "const int b_xy= VAR_0->mb2b_xy[VAR_5] + 3*VAR_0->b_stride;", "*(uint32_t*)VAR_0->mvd_cache[VAR_27][scan8[0] + 0 - 1*8]= *(uint32_t*)VAR_0->mvd_table[VAR_27][b_xy + 0];", "*(uint32_t*)VAR_0->mvd_cache[VAR_27][scan8[0] + 1 - 1*8]= *(uint32_t*)VAR_0->mvd_table[VAR_27][b_xy + 1];", "*(uint32_t*)VAR_0->mvd_cache[VAR_27][scan8[0] + 2 - 1*8]= *(uint32_t*)VAR_0->mvd_table[VAR_27][b_xy + 2];", "*(uint32_t*)VAR_0->mvd_cache[VAR_27][scan8[0] + 3 - 1*8]= *(uint32_t*)VAR_0->mvd_table[VAR_27][b_xy + 3];", "}else{", "*(uint32_t*)VAR_0->mvd_cache [VAR_27][scan8[0] + 0 - 1*8]=\n*(uint32_t*)VAR_0->mvd_cache [VAR_27][scan8[0] + 1 - 1*8]=\n*(uint32_t*)VAR_0->mvd_cache [VAR_27][scan8[0] + 2 - 1*8]=\n*(uint32_t*)VAR_0->mvd_cache [VAR_27][scan8[0] + 3 - 1*8]= 0;", "}", "if(USES_LIST(VAR_11[0], VAR_27)){", "const int b_xy= VAR_0->mb2b_xy[VAR_7[0]] + 3;", "*(uint32_t*)VAR_0->mvd_cache[VAR_27][scan8[0] - 1 + 0*8]= *(uint32_t*)VAR_0->mvd_table[VAR_27][b_xy + VAR_0->b_stride*VAR_12[0]];", "*(uint32_t*)VAR_0->mvd_cache[VAR_27][scan8[0] - 1 + 1*8]= *(uint32_t*)VAR_0->mvd_table[VAR_27][b_xy + VAR_0->b_stride*VAR_12[1]];", "}else{", "*(uint32_t*)VAR_0->mvd_cache [VAR_27][scan8[0] - 1 + 0*8]=\n*(uint32_t*)VAR_0->mvd_cache [VAR_27][scan8[0] - 1 + 1*8]= 0;", "}", "if(USES_LIST(VAR_11[1], VAR_27)){", "const int b_xy= VAR_0->mb2b_xy[VAR_7[1]] + 3;", "*(uint32_t*)VAR_0->mvd_cache[VAR_27][scan8[0] - 1 + 2*8]= *(uint32_t*)VAR_0->mvd_table[VAR_27][b_xy + VAR_0->b_stride*VAR_12[2]];", "*(uint32_t*)VAR_0->mvd_cache[VAR_27][scan8[0] - 1 + 3*8]= *(uint32_t*)VAR_0->mvd_table[VAR_27][b_xy + VAR_0->b_stride*VAR_12[3]];", "}else{", "*(uint32_t*)VAR_0->mvd_cache [VAR_27][scan8[0] - 1 + 2*8]=\n*(uint32_t*)VAR_0->mvd_cache [VAR_27][scan8[0] - 1 + 3*8]= 0;", "}", "*(uint32_t*)VAR_0->mvd_cache [VAR_27][scan8[5 ]+1]=\n*(uint32_t*)VAR_0->mvd_cache [VAR_27][scan8[7 ]+1]=\n*(uint32_t*)VAR_0->mvd_cache [VAR_27][scan8[13]+1]=\n*(uint32_t*)VAR_0->mvd_cache [VAR_27][scan8[4 ]]=\n*(uint32_t*)VAR_0->mvd_cache [VAR_27][scan8[12]]= 0;", "if(VAR_0->slice_type_nos == FF_B_TYPE){", "fill_rectangle(&VAR_0->direct_cache[scan8[0]], 4, 4, 8, 0, 1);", "if(IS_DIRECT(VAR_9)){", "*(uint32_t*)&VAR_0->direct_cache[scan8[0] - 1*8]= 0x01010101;", "}else if(IS_8X8(VAR_9)){", "int b8_xy = VAR_0->mb2b8_xy[VAR_5] + VAR_0->b8_stride;", "VAR_0->direct_cache[scan8[0] + 0 - 1*8]= VAR_0->direct_table[b8_xy];", "VAR_0->direct_cache[scan8[0] + 2 - 1*8]= VAR_0->direct_table[b8_xy + 1];", "}else{", "*(uint32_t*)&VAR_0->direct_cache[scan8[0] - 1*8]= 0;", "}", "if(IS_DIRECT(VAR_11[0]))\nVAR_0->direct_cache[scan8[0] - 1 + 0*8]= 1;", "else if(IS_8X8(VAR_11[0]))\nVAR_0->direct_cache[scan8[0] - 1 + 0*8]= VAR_0->direct_table[VAR_0->mb2b8_xy[VAR_7[0]] + 1 + VAR_0->b8_stride*(VAR_12[0]>>1)];", "else\nVAR_0->direct_cache[scan8[0] - 1 + 0*8]= 0;", "if(IS_DIRECT(VAR_11[1]))\nVAR_0->direct_cache[scan8[0] - 1 + 2*8]= 1;", "else if(IS_8X8(VAR_11[1]))\nVAR_0->direct_cache[scan8[0] - 1 + 2*8]= VAR_0->direct_table[VAR_0->mb2b8_xy[VAR_7[1]] + 1 + VAR_0->b8_stride*(VAR_12[2]>>1)];", "else\nVAR_0->direct_cache[scan8[0] - 1 + 2*8]= 0;", "}", "}", "if(FRAME_MBAFF){", "#define MAP_MVS\\\nMAP_F2F(scan8[0] - 1 - 1*8, VAR_8)\\\nMAP_F2F(scan8[0] + 0 - 1*8, VAR_9)\\\nMAP_F2F(scan8[0] + 1 - 1*8, VAR_9)\\\nMAP_F2F(scan8[0] + 2 - 1*8, VAR_9)\\\nMAP_F2F(scan8[0] + 3 - 1*8, VAR_9)\\\nMAP_F2F(scan8[0] + 4 - 1*8, VAR_10)\\\nMAP_F2F(scan8[0] - 1 + 0*8, VAR_11[0])\\\nMAP_F2F(scan8[0] - 1 + 1*8, VAR_11[0])\\\nMAP_F2F(scan8[0] - 1 + 2*8, VAR_11[1])\\\nMAP_F2F(scan8[0] - 1 + 3*8, VAR_11[1])\nif(MB_FIELD){", "#define MAP_F2F(idx, VAR_1)\\\nif(!IS_INTERLACED(VAR_1) && VAR_0->ref_cache[VAR_27][idx] >= 0){\\", "VAR_0->ref_cache[VAR_27][idx] <<= 1;\\", "VAR_0->mv_cache[VAR_27][idx][1] /= 2;\\", "VAR_0->mvd_cache[VAR_27][idx][1] /= 2;\\", "}", "MAP_MVS\n#undef MAP_F2F\n}else{", "#define MAP_F2F(idx, VAR_1)\\\nif(IS_INTERLACED(VAR_1) && VAR_0->ref_cache[VAR_27][idx] >= 0){\\", "VAR_0->ref_cache[VAR_27][idx] >>= 1;\\", "VAR_0->mv_cache[VAR_27][idx][1] <<= 1;\\", "VAR_0->mvd_cache[VAR_27][idx][1] <<= 1;\\", "}", "MAP_MVS\n#undef MAP_F2F\n}", "}", "}", "}", "#endif\nVAR_0->neighbor_transform_size= !!IS_8x8DCT(VAR_9) + !!IS_8x8DCT(VAR_11[0]);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 25, 27 ], [ 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 ], [ 97 ], [ 99 ], [ 101, 103, 105, 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173, 175 ], [ 177 ], [ 179, 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 211 ], [ 213, 215, 217 ], [ 219 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 247, 249 ], [ 253, 255 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275, 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285, 287, 289, 291 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305 ], [ 307, 309 ], [ 311 ], [ 313 ], [ 315 ], [ 317, 319 ], [ 321 ], [ 323 ], [ 325 ], [ 327 ], [ 351 ], [ 353 ], [ 355 ], [ 357 ], [ 359 ], [ 363 ], [ 365 ], [ 369 ], [ 371 ], [ 375 ], [ 377, 379, 381, 383, 387, 389, 393, 395 ], [ 399 ], [ 403 ], [ 405 ], [ 407 ], [ 409 ], [ 411 ], [ 413 ], [ 415 ], [ 417, 419, 421, 423 ], [ 425 ], [ 427 ], [ 431 ], [ 435 ], [ 437 ], [ 439 ], [ 441 ], [ 443 ], [ 445 ], [ 447 ], [ 451 ], [ 453 ], [ 455 ], [ 457 ], [ 459 ], [ 461 ], [ 463 ], [ 465 ], [ 467 ], [ 469 ], [ 471 ], [ 473 ], [ 475 ], [ 477 ], [ 481, 483 ], [ 485 ], [ 487 ], [ 489 ], [ 501 ], [ 503 ], [ 505 ], [ 509 ], [ 511 ], [ 513 ], [ 515 ], [ 517 ], [ 519 ], [ 521 ], [ 523, 525 ], [ 527, 529 ], [ 531 ], [ 533, 535, 537, 539 ], [ 541 ], [ 543 ], [ 547 ], [ 549 ], [ 551 ], [ 553 ], [ 555 ], [ 557 ], [ 559 ], [ 561 ], [ 563 ], [ 565 ], [ 567, 569 ], [ 571, 573 ], [ 575 ], [ 577 ], [ 581, 583 ], [ 587 ], [ 589 ], [ 591 ], [ 593 ], [ 595 ], [ 597 ], [ 599 ], [ 601 ], [ 603 ], [ 607 ], [ 609 ], [ 611 ], [ 613 ], [ 615 ], [ 617 ], [ 619 ], [ 621 ], [ 623 ], [ 627, 629 ], [ 633, 635, 637, 639, 641 ], [ 643, 645, 647, 649, 651 ], [ 655 ], [ 659 ], [ 661 ], [ 663 ], [ 665 ], [ 667 ], [ 669 ], [ 671 ], [ 673, 675, 677, 679 ], [ 681 ], [ 683 ], [ 685 ], [ 687 ], [ 689 ], [ 691 ], [ 693, 695 ], [ 697 ], [ 699 ], [ 701 ], [ 703 ], [ 705 ], [ 707 ], [ 709, 711 ], [ 713 ], [ 715, 717, 719, 721, 723 ], [ 727 ], [ 729 ], [ 733 ], [ 735 ], [ 737 ], [ 739 ], [ 741 ], [ 743 ], [ 745 ], [ 747 ], [ 749 ], [ 753, 755 ], [ 757, 759 ], [ 761, 763 ], [ 767, 769 ], [ 771, 773 ], [ 775, 777 ], [ 779 ], [ 781 ], [ 785 ], [ 787, 789, 791, 793, 795, 797, 799, 801, 803, 805, 807, 809 ], [ 811, 813 ], [ 815 ], [ 817 ], [ 819 ], [ 821 ], [ 823, 825, 827 ], [ 829, 831 ], [ 833 ], [ 835 ], [ 837 ], [ 839 ], [ 841, 843, 845 ], [ 847 ], [ 849 ], [ 851 ], [ 853, 857 ], [ 859 ] ]
4,666
static void lsi_scsi_init(PCIDevice *dev) { LSIState *s = (LSIState *)dev; uint8_t *pci_conf; pci_conf = s->pci_dev.config; /* PCI Vendor ID (word) */ pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_LSI_LOGIC); /* PCI device ID (word) */ pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_LSI_53C895A); /* PCI base class code */ pci_config_set_class(pci_conf, PCI_CLASS_STORAGE_SCSI); /* PCI subsystem ID */ pci_conf[0x2e] = 0x00; pci_conf[0x2f] = 0x10; /* PCI latency timer = 255 */ pci_conf[0x0d] = 0xff; /* Interrupt pin 1 */ pci_conf[0x3d] = 0x01; s->mmio_io_addr = cpu_register_io_memory(lsi_mmio_readfn, lsi_mmio_writefn, s); s->ram_io_addr = cpu_register_io_memory(lsi_ram_readfn, lsi_ram_writefn, s); pci_register_bar((struct PCIDevice *)s, 0, 256, PCI_ADDRESS_SPACE_IO, lsi_io_mapfunc); pci_register_bar((struct PCIDevice *)s, 1, 0x400, PCI_ADDRESS_SPACE_MEM, lsi_mmio_mapfunc); pci_register_bar((struct PCIDevice *)s, 2, 0x2000, PCI_ADDRESS_SPACE_MEM, lsi_ram_mapfunc); s->queue = qemu_malloc(sizeof(lsi_queue)); s->queue_len = 1; s->active_commands = 0; s->pci_dev.unregister = lsi_scsi_uninit; lsi_soft_reset(s); scsi_bus_new(&dev->qdev, lsi_scsi_attach); }
true
qemu
777aec7ac91b1306d77897aafc8097a87bf4a672
static void lsi_scsi_init(PCIDevice *dev) { LSIState *s = (LSIState *)dev; uint8_t *pci_conf; pci_conf = s->pci_dev.config; pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_LSI_LOGIC); pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_LSI_53C895A); pci_config_set_class(pci_conf, PCI_CLASS_STORAGE_SCSI); pci_conf[0x2e] = 0x00; pci_conf[0x2f] = 0x10; pci_conf[0x0d] = 0xff; pci_conf[0x3d] = 0x01; s->mmio_io_addr = cpu_register_io_memory(lsi_mmio_readfn, lsi_mmio_writefn, s); s->ram_io_addr = cpu_register_io_memory(lsi_ram_readfn, lsi_ram_writefn, s); pci_register_bar((struct PCIDevice *)s, 0, 256, PCI_ADDRESS_SPACE_IO, lsi_io_mapfunc); pci_register_bar((struct PCIDevice *)s, 1, 0x400, PCI_ADDRESS_SPACE_MEM, lsi_mmio_mapfunc); pci_register_bar((struct PCIDevice *)s, 2, 0x2000, PCI_ADDRESS_SPACE_MEM, lsi_ram_mapfunc); s->queue = qemu_malloc(sizeof(lsi_queue)); s->queue_len = 1; s->active_commands = 0; s->pci_dev.unregister = lsi_scsi_uninit; lsi_soft_reset(s); scsi_bus_new(&dev->qdev, lsi_scsi_attach); }
{ "code": [], "line_no": [] }
static void FUNC_0(PCIDevice *VAR_0) { LSIState *s = (LSIState *)VAR_0; uint8_t *pci_conf; pci_conf = s->pci_dev.config; pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_LSI_LOGIC); pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_LSI_53C895A); pci_config_set_class(pci_conf, PCI_CLASS_STORAGE_SCSI); pci_conf[0x2e] = 0x00; pci_conf[0x2f] = 0x10; pci_conf[0x0d] = 0xff; pci_conf[0x3d] = 0x01; s->mmio_io_addr = cpu_register_io_memory(lsi_mmio_readfn, lsi_mmio_writefn, s); s->ram_io_addr = cpu_register_io_memory(lsi_ram_readfn, lsi_ram_writefn, s); pci_register_bar((struct PCIDevice *)s, 0, 256, PCI_ADDRESS_SPACE_IO, lsi_io_mapfunc); pci_register_bar((struct PCIDevice *)s, 1, 0x400, PCI_ADDRESS_SPACE_MEM, lsi_mmio_mapfunc); pci_register_bar((struct PCIDevice *)s, 2, 0x2000, PCI_ADDRESS_SPACE_MEM, lsi_ram_mapfunc); s->queue = qemu_malloc(sizeof(lsi_queue)); s->queue_len = 1; s->active_commands = 0; s->pci_dev.unregister = lsi_scsi_uninit; lsi_soft_reset(s); scsi_bus_new(&VAR_0->qdev, lsi_scsi_attach); }
[ "static void FUNC_0(PCIDevice *VAR_0)\n{", "LSIState *s = (LSIState *)VAR_0;", "uint8_t *pci_conf;", "pci_conf = s->pci_dev.config;", "pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_LSI_LOGIC);", "pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_LSI_53C895A);", "pci_config_set_class(pci_conf, PCI_CLASS_STORAGE_SCSI);", "pci_conf[0x2e] = 0x00;", "pci_conf[0x2f] = 0x10;", "pci_conf[0x0d] = 0xff;", "pci_conf[0x3d] = 0x01;", "s->mmio_io_addr = cpu_register_io_memory(lsi_mmio_readfn,\nlsi_mmio_writefn, s);", "s->ram_io_addr = cpu_register_io_memory(lsi_ram_readfn,\nlsi_ram_writefn, s);", "pci_register_bar((struct PCIDevice *)s, 0, 256,\nPCI_ADDRESS_SPACE_IO, lsi_io_mapfunc);", "pci_register_bar((struct PCIDevice *)s, 1, 0x400,\nPCI_ADDRESS_SPACE_MEM, lsi_mmio_mapfunc);", "pci_register_bar((struct PCIDevice *)s, 2, 0x2000,\nPCI_ADDRESS_SPACE_MEM, lsi_ram_mapfunc);", "s->queue = qemu_malloc(sizeof(lsi_queue));", "s->queue_len = 1;", "s->active_commands = 0;", "s->pci_dev.unregister = lsi_scsi_uninit;", "lsi_soft_reset(s);", "scsi_bus_new(&VAR_0->qdev, lsi_scsi_attach);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2 ], [ 3 ], [ 4 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 14 ], [ 16 ], [ 18 ], [ 19, 20 ], [ 21, 22 ], [ 23, 24 ], [ 25, 26 ], [ 27, 28 ], [ 29 ], [ 30 ], [ 31 ], [ 32 ], [ 33 ], [ 34 ], [ 35 ] ]
4,667
int ff_j2k_init_component(J2kComponent *comp, J2kCodingStyle *codsty, J2kQuantStyle *qntsty, int cbps, int dx, int dy) { int reslevelno, bandno, gbandno = 0, ret, i, j, csize = 1; if (ret=ff_j2k_dwt_init(&comp->dwt, comp->coord, codsty->nreslevels-1, codsty->transform)) return ret; for (i = 0; i < 2; i++) csize *= comp->coord[i][1] - comp->coord[i][0]; comp->data = av_malloc(csize * sizeof(int)); if (!comp->data) return AVERROR(ENOMEM); comp->reslevel = av_malloc(codsty->nreslevels * sizeof(J2kResLevel)); if (!comp->reslevel) return AVERROR(ENOMEM); for (reslevelno = 0; reslevelno < codsty->nreslevels; reslevelno++){ int declvl = codsty->nreslevels - reslevelno; J2kResLevel *reslevel = comp->reslevel + reslevelno; for (i = 0; i < 2; i++) for (j = 0; j < 2; j++) reslevel->coord[i][j] = ff_j2k_ceildivpow2(comp->coord[i][j], declvl - 1); if (reslevelno == 0) reslevel->nbands = 1; else reslevel->nbands = 3; if (reslevel->coord[0][1] == reslevel->coord[0][0]) reslevel->num_precincts_x = 0; else reslevel->num_precincts_x = ff_j2k_ceildivpow2(reslevel->coord[0][1], codsty->log2_prec_width) - (reslevel->coord[0][0] >> codsty->log2_prec_width); if (reslevel->coord[1][1] == reslevel->coord[1][0]) reslevel->num_precincts_y = 0; else reslevel->num_precincts_y = ff_j2k_ceildivpow2(reslevel->coord[1][1], codsty->log2_prec_height) - (reslevel->coord[1][0] >> codsty->log2_prec_height); reslevel->band = av_malloc(reslevel->nbands * sizeof(J2kBand)); if (!reslevel->band) return AVERROR(ENOMEM); for (bandno = 0; bandno < reslevel->nbands; bandno++, gbandno++){ J2kBand *band = reslevel->band + bandno; int cblkno, precx, precy, precno; int x0, y0, x1, y1; int xi0, yi0, xi1, yi1; int cblkperprecw, cblkperprech; if (qntsty->quantsty != J2K_QSTY_NONE){ static const uint8_t lut_gain[2][4] = {{0, 0, 0, 0}, {0, 1, 1, 2}}; int numbps; numbps = cbps + lut_gain[codsty->transform][bandno + reslevelno>0]; band->stepsize = SHL(2048 + qntsty->mant[gbandno], 2 + numbps - qntsty->expn[gbandno]); } else band->stepsize = 1 << 13; if (reslevelno == 0){ // the same everywhere band->codeblock_width = 1 << FFMIN(codsty->log2_cblk_width, codsty->log2_prec_width-1); band->codeblock_height = 1 << FFMIN(codsty->log2_cblk_height, codsty->log2_prec_height-1); for (i = 0; i < 2; i++) for (j = 0; j < 2; j++) band->coord[i][j] = ff_j2k_ceildivpow2(comp->coord[i][j], declvl-1); } else{ band->codeblock_width = 1 << FFMIN(codsty->log2_cblk_width, codsty->log2_prec_width); band->codeblock_height = 1 << FFMIN(codsty->log2_cblk_height, codsty->log2_prec_height); for (i = 0; i < 2; i++) for (j = 0; j < 2; j++) band->coord[i][j] = ff_j2k_ceildivpow2(comp->coord[i][j] - (((bandno+1>>i)&1) << declvl-1), declvl); } band->cblknx = ff_j2k_ceildiv(band->coord[0][1], band->codeblock_width) - band->coord[0][0] / band->codeblock_width; band->cblkny = ff_j2k_ceildiv(band->coord[1][1], band->codeblock_height) - band->coord[1][0] / band->codeblock_height; for (j = 0; j < 2; j++) band->coord[0][j] = ff_j2k_ceildiv(band->coord[0][j], dx); for (j = 0; j < 2; j++) band->coord[1][j] = ff_j2k_ceildiv(band->coord[1][j], dy); band->cblknx = ff_j2k_ceildiv(band->cblknx, dx); band->cblkny = ff_j2k_ceildiv(band->cblkny, dy); band->cblk = av_malloc(band->cblknx * band->cblkny * sizeof(J2kCblk)); if (!band->cblk) return AVERROR(ENOMEM); band->prec = av_malloc(reslevel->num_precincts_x * reslevel->num_precincts_y * sizeof(J2kPrec)); if (!band->prec) return AVERROR(ENOMEM); for (cblkno = 0; cblkno < band->cblknx * band->cblkny; cblkno++){ J2kCblk *cblk = band->cblk + cblkno; cblk->zero = 0; cblk->lblock = 3; cblk->length = 0; cblk->lengthinc = 0; cblk->npasses = 0; } y0 = band->coord[1][0]; y1 = ((band->coord[1][0] + (1<<codsty->log2_prec_height)) & ~((1<<codsty->log2_prec_height)-1)) - y0; yi0 = 0; yi1 = ff_j2k_ceildivpow2(y1 - y0, codsty->log2_cblk_height) << codsty->log2_cblk_height; yi1 = FFMIN(yi1, band->cblkny); cblkperprech = 1<<(codsty->log2_prec_height - codsty->log2_cblk_height); for (precy = 0, precno = 0; precy < reslevel->num_precincts_y; precy++){ for (precx = 0; precx < reslevel->num_precincts_x; precx++, precno++){ band->prec[precno].yi0 = yi0; band->prec[precno].yi1 = yi1; } yi1 += cblkperprech; yi0 = yi1 - cblkperprech; yi1 = FFMIN(yi1, band->cblkny); } x0 = band->coord[0][0]; x1 = ((band->coord[0][0] + (1<<codsty->log2_prec_width)) & ~((1<<codsty->log2_prec_width)-1)) - x0; xi0 = 0; xi1 = ff_j2k_ceildivpow2(x1 - x0, codsty->log2_cblk_width) << codsty->log2_cblk_width; xi1 = FFMIN(xi1, band->cblknx); cblkperprecw = 1<<(codsty->log2_prec_width - codsty->log2_cblk_width); for (precx = 0, precno = 0; precx < reslevel->num_precincts_x; precx++){ for (precy = 0; precy < reslevel->num_precincts_y; precy++, precno = 0){ J2kPrec *prec = band->prec + precno; prec->xi0 = xi0; prec->xi1 = xi1; prec->cblkincl = ff_j2k_tag_tree_init(prec->xi1 - prec->xi0, prec->yi1 - prec->yi0); prec->zerobits = ff_j2k_tag_tree_init(prec->xi1 - prec->xi0, prec->yi1 - prec->yi0); if (!prec->cblkincl || !prec->zerobits) return AVERROR(ENOMEM); } xi1 += cblkperprecw; xi0 = xi1 - cblkperprecw; xi1 = FFMIN(xi1, band->cblknx); } } } return 0; }
true
FFmpeg
45ae9a8fc903d5b5041a5d34015aa98ab2bc12be
int ff_j2k_init_component(J2kComponent *comp, J2kCodingStyle *codsty, J2kQuantStyle *qntsty, int cbps, int dx, int dy) { int reslevelno, bandno, gbandno = 0, ret, i, j, csize = 1; if (ret=ff_j2k_dwt_init(&comp->dwt, comp->coord, codsty->nreslevels-1, codsty->transform)) return ret; for (i = 0; i < 2; i++) csize *= comp->coord[i][1] - comp->coord[i][0]; comp->data = av_malloc(csize * sizeof(int)); if (!comp->data) return AVERROR(ENOMEM); comp->reslevel = av_malloc(codsty->nreslevels * sizeof(J2kResLevel)); if (!comp->reslevel) return AVERROR(ENOMEM); for (reslevelno = 0; reslevelno < codsty->nreslevels; reslevelno++){ int declvl = codsty->nreslevels - reslevelno; J2kResLevel *reslevel = comp->reslevel + reslevelno; for (i = 0; i < 2; i++) for (j = 0; j < 2; j++) reslevel->coord[i][j] = ff_j2k_ceildivpow2(comp->coord[i][j], declvl - 1); if (reslevelno == 0) reslevel->nbands = 1; else reslevel->nbands = 3; if (reslevel->coord[0][1] == reslevel->coord[0][0]) reslevel->num_precincts_x = 0; else reslevel->num_precincts_x = ff_j2k_ceildivpow2(reslevel->coord[0][1], codsty->log2_prec_width) - (reslevel->coord[0][0] >> codsty->log2_prec_width); if (reslevel->coord[1][1] == reslevel->coord[1][0]) reslevel->num_precincts_y = 0; else reslevel->num_precincts_y = ff_j2k_ceildivpow2(reslevel->coord[1][1], codsty->log2_prec_height) - (reslevel->coord[1][0] >> codsty->log2_prec_height); reslevel->band = av_malloc(reslevel->nbands * sizeof(J2kBand)); if (!reslevel->band) return AVERROR(ENOMEM); for (bandno = 0; bandno < reslevel->nbands; bandno++, gbandno++){ J2kBand *band = reslevel->band + bandno; int cblkno, precx, precy, precno; int x0, y0, x1, y1; int xi0, yi0, xi1, yi1; int cblkperprecw, cblkperprech; if (qntsty->quantsty != J2K_QSTY_NONE){ static const uint8_t lut_gain[2][4] = {{0, 0, 0, 0}, {0, 1, 1, 2}}; int numbps; numbps = cbps + lut_gain[codsty->transform][bandno + reslevelno>0]; band->stepsize = SHL(2048 + qntsty->mant[gbandno], 2 + numbps - qntsty->expn[gbandno]); } else band->stepsize = 1 << 13; if (reslevelno == 0){ band->codeblock_width = 1 << FFMIN(codsty->log2_cblk_width, codsty->log2_prec_width-1); band->codeblock_height = 1 << FFMIN(codsty->log2_cblk_height, codsty->log2_prec_height-1); for (i = 0; i < 2; i++) for (j = 0; j < 2; j++) band->coord[i][j] = ff_j2k_ceildivpow2(comp->coord[i][j], declvl-1); } else{ band->codeblock_width = 1 << FFMIN(codsty->log2_cblk_width, codsty->log2_prec_width); band->codeblock_height = 1 << FFMIN(codsty->log2_cblk_height, codsty->log2_prec_height); for (i = 0; i < 2; i++) for (j = 0; j < 2; j++) band->coord[i][j] = ff_j2k_ceildivpow2(comp->coord[i][j] - (((bandno+1>>i)&1) << declvl-1), declvl); } band->cblknx = ff_j2k_ceildiv(band->coord[0][1], band->codeblock_width) - band->coord[0][0] / band->codeblock_width; band->cblkny = ff_j2k_ceildiv(band->coord[1][1], band->codeblock_height) - band->coord[1][0] / band->codeblock_height; for (j = 0; j < 2; j++) band->coord[0][j] = ff_j2k_ceildiv(band->coord[0][j], dx); for (j = 0; j < 2; j++) band->coord[1][j] = ff_j2k_ceildiv(band->coord[1][j], dy); band->cblknx = ff_j2k_ceildiv(band->cblknx, dx); band->cblkny = ff_j2k_ceildiv(band->cblkny, dy); band->cblk = av_malloc(band->cblknx * band->cblkny * sizeof(J2kCblk)); if (!band->cblk) return AVERROR(ENOMEM); band->prec = av_malloc(reslevel->num_precincts_x * reslevel->num_precincts_y * sizeof(J2kPrec)); if (!band->prec) return AVERROR(ENOMEM); for (cblkno = 0; cblkno < band->cblknx * band->cblkny; cblkno++){ J2kCblk *cblk = band->cblk + cblkno; cblk->zero = 0; cblk->lblock = 3; cblk->length = 0; cblk->lengthinc = 0; cblk->npasses = 0; } y0 = band->coord[1][0]; y1 = ((band->coord[1][0] + (1<<codsty->log2_prec_height)) & ~((1<<codsty->log2_prec_height)-1)) - y0; yi0 = 0; yi1 = ff_j2k_ceildivpow2(y1 - y0, codsty->log2_cblk_height) << codsty->log2_cblk_height; yi1 = FFMIN(yi1, band->cblkny); cblkperprech = 1<<(codsty->log2_prec_height - codsty->log2_cblk_height); for (precy = 0, precno = 0; precy < reslevel->num_precincts_y; precy++){ for (precx = 0; precx < reslevel->num_precincts_x; precx++, precno++){ band->prec[precno].yi0 = yi0; band->prec[precno].yi1 = yi1; } yi1 += cblkperprech; yi0 = yi1 - cblkperprech; yi1 = FFMIN(yi1, band->cblkny); } x0 = band->coord[0][0]; x1 = ((band->coord[0][0] + (1<<codsty->log2_prec_width)) & ~((1<<codsty->log2_prec_width)-1)) - x0; xi0 = 0; xi1 = ff_j2k_ceildivpow2(x1 - x0, codsty->log2_cblk_width) << codsty->log2_cblk_width; xi1 = FFMIN(xi1, band->cblknx); cblkperprecw = 1<<(codsty->log2_prec_width - codsty->log2_cblk_width); for (precx = 0, precno = 0; precx < reslevel->num_precincts_x; precx++){ for (precy = 0; precy < reslevel->num_precincts_y; precy++, precno = 0){ J2kPrec *prec = band->prec + precno; prec->xi0 = xi0; prec->xi1 = xi1; prec->cblkincl = ff_j2k_tag_tree_init(prec->xi1 - prec->xi0, prec->yi1 - prec->yi0); prec->zerobits = ff_j2k_tag_tree_init(prec->xi1 - prec->xi0, prec->yi1 - prec->yi0); if (!prec->cblkincl || !prec->zerobits) return AVERROR(ENOMEM); } xi1 += cblkperprecw; xi0 = xi1 - cblkperprecw; xi1 = FFMIN(xi1, band->cblknx); } } } return 0; }
{ "code": [ " band->cblk = av_malloc(band->cblknx * band->cblkny * sizeof(J2kCblk));" ], "line_no": [ 173 ] }
int FUNC_0(J2kComponent *VAR_0, J2kCodingStyle *VAR_1, J2kQuantStyle *VAR_2, int VAR_3, int VAR_4, int VAR_5) { int VAR_6, VAR_7, VAR_8 = 0, VAR_9, VAR_10, VAR_11, VAR_12 = 1; if (VAR_9=ff_j2k_dwt_init(&VAR_0->dwt, VAR_0->coord, VAR_1->nreslevels-1, VAR_1->transform)) return VAR_9; for (VAR_10 = 0; VAR_10 < 2; VAR_10++) VAR_12 *= VAR_0->coord[VAR_10][1] - VAR_0->coord[VAR_10][0]; VAR_0->data = av_malloc(VAR_12 * sizeof(int)); if (!VAR_0->data) return AVERROR(ENOMEM); VAR_0->reslevel = av_malloc(VAR_1->nreslevels * sizeof(J2kResLevel)); if (!VAR_0->reslevel) return AVERROR(ENOMEM); for (VAR_6 = 0; VAR_6 < VAR_1->nreslevels; VAR_6++){ int declvl = VAR_1->nreslevels - VAR_6; J2kResLevel *reslevel = VAR_0->reslevel + VAR_6; for (VAR_10 = 0; VAR_10 < 2; VAR_10++) for (VAR_11 = 0; VAR_11 < 2; VAR_11++) reslevel->coord[VAR_10][VAR_11] = ff_j2k_ceildivpow2(VAR_0->coord[VAR_10][VAR_11], declvl - 1); if (VAR_6 == 0) reslevel->nbands = 1; else reslevel->nbands = 3; if (reslevel->coord[0][1] == reslevel->coord[0][0]) reslevel->num_precincts_x = 0; else reslevel->num_precincts_x = ff_j2k_ceildivpow2(reslevel->coord[0][1], VAR_1->log2_prec_width) - (reslevel->coord[0][0] >> VAR_1->log2_prec_width); if (reslevel->coord[1][1] == reslevel->coord[1][0]) reslevel->num_precincts_y = 0; else reslevel->num_precincts_y = ff_j2k_ceildivpow2(reslevel->coord[1][1], VAR_1->log2_prec_height) - (reslevel->coord[1][0] >> VAR_1->log2_prec_height); reslevel->band = av_malloc(reslevel->nbands * sizeof(J2kBand)); if (!reslevel->band) return AVERROR(ENOMEM); for (VAR_7 = 0; VAR_7 < reslevel->nbands; VAR_7++, VAR_8++){ J2kBand *band = reslevel->band + VAR_7; int cblkno, precx, precy, precno; int x0, y0, x1, y1; int xi0, yi0, xi1, yi1; int cblkperprecw, cblkperprech; if (VAR_2->quantsty != J2K_QSTY_NONE){ static const uint8_t lut_gain[2][4] = {{0, 0, 0, 0}, {0, 1, 1, 2}}; int numbps; numbps = VAR_3 + lut_gain[VAR_1->transform][VAR_7 + VAR_6>0]; band->stepsize = SHL(2048 + VAR_2->mant[VAR_8], 2 + numbps - VAR_2->expn[VAR_8]); } else band->stepsize = 1 << 13; if (VAR_6 == 0){ band->codeblock_width = 1 << FFMIN(VAR_1->log2_cblk_width, VAR_1->log2_prec_width-1); band->codeblock_height = 1 << FFMIN(VAR_1->log2_cblk_height, VAR_1->log2_prec_height-1); for (VAR_10 = 0; VAR_10 < 2; VAR_10++) for (VAR_11 = 0; VAR_11 < 2; VAR_11++) band->coord[VAR_10][VAR_11] = ff_j2k_ceildivpow2(VAR_0->coord[VAR_10][VAR_11], declvl-1); } else{ band->codeblock_width = 1 << FFMIN(VAR_1->log2_cblk_width, VAR_1->log2_prec_width); band->codeblock_height = 1 << FFMIN(VAR_1->log2_cblk_height, VAR_1->log2_prec_height); for (VAR_10 = 0; VAR_10 < 2; VAR_10++) for (VAR_11 = 0; VAR_11 < 2; VAR_11++) band->coord[VAR_10][VAR_11] = ff_j2k_ceildivpow2(VAR_0->coord[VAR_10][VAR_11] - (((VAR_7+1>>VAR_10)&1) << declvl-1), declvl); } band->cblknx = ff_j2k_ceildiv(band->coord[0][1], band->codeblock_width) - band->coord[0][0] / band->codeblock_width; band->cblkny = ff_j2k_ceildiv(band->coord[1][1], band->codeblock_height) - band->coord[1][0] / band->codeblock_height; for (VAR_11 = 0; VAR_11 < 2; VAR_11++) band->coord[0][VAR_11] = ff_j2k_ceildiv(band->coord[0][VAR_11], VAR_4); for (VAR_11 = 0; VAR_11 < 2; VAR_11++) band->coord[1][VAR_11] = ff_j2k_ceildiv(band->coord[1][VAR_11], VAR_5); band->cblknx = ff_j2k_ceildiv(band->cblknx, VAR_4); band->cblkny = ff_j2k_ceildiv(band->cblkny, VAR_5); band->cblk = av_malloc(band->cblknx * band->cblkny * sizeof(J2kCblk)); if (!band->cblk) return AVERROR(ENOMEM); band->prec = av_malloc(reslevel->num_precincts_x * reslevel->num_precincts_y * sizeof(J2kPrec)); if (!band->prec) return AVERROR(ENOMEM); for (cblkno = 0; cblkno < band->cblknx * band->cblkny; cblkno++){ J2kCblk *cblk = band->cblk + cblkno; cblk->zero = 0; cblk->lblock = 3; cblk->length = 0; cblk->lengthinc = 0; cblk->npasses = 0; } y0 = band->coord[1][0]; y1 = ((band->coord[1][0] + (1<<VAR_1->log2_prec_height)) & ~((1<<VAR_1->log2_prec_height)-1)) - y0; yi0 = 0; yi1 = ff_j2k_ceildivpow2(y1 - y0, VAR_1->log2_cblk_height) << VAR_1->log2_cblk_height; yi1 = FFMIN(yi1, band->cblkny); cblkperprech = 1<<(VAR_1->log2_prec_height - VAR_1->log2_cblk_height); for (precy = 0, precno = 0; precy < reslevel->num_precincts_y; precy++){ for (precx = 0; precx < reslevel->num_precincts_x; precx++, precno++){ band->prec[precno].yi0 = yi0; band->prec[precno].yi1 = yi1; } yi1 += cblkperprech; yi0 = yi1 - cblkperprech; yi1 = FFMIN(yi1, band->cblkny); } x0 = band->coord[0][0]; x1 = ((band->coord[0][0] + (1<<VAR_1->log2_prec_width)) & ~((1<<VAR_1->log2_prec_width)-1)) - x0; xi0 = 0; xi1 = ff_j2k_ceildivpow2(x1 - x0, VAR_1->log2_cblk_width) << VAR_1->log2_cblk_width; xi1 = FFMIN(xi1, band->cblknx); cblkperprecw = 1<<(VAR_1->log2_prec_width - VAR_1->log2_cblk_width); for (precx = 0, precno = 0; precx < reslevel->num_precincts_x; precx++){ for (precy = 0; precy < reslevel->num_precincts_y; precy++, precno = 0){ J2kPrec *prec = band->prec + precno; prec->xi0 = xi0; prec->xi1 = xi1; prec->cblkincl = ff_j2k_tag_tree_init(prec->xi1 - prec->xi0, prec->yi1 - prec->yi0); prec->zerobits = ff_j2k_tag_tree_init(prec->xi1 - prec->xi0, prec->yi1 - prec->yi0); if (!prec->cblkincl || !prec->zerobits) return AVERROR(ENOMEM); } xi1 += cblkperprecw; xi0 = xi1 - cblkperprecw; xi1 = FFMIN(xi1, band->cblknx); } } } return 0; }
[ "int FUNC_0(J2kComponent *VAR_0, J2kCodingStyle *VAR_1, J2kQuantStyle *VAR_2, int VAR_3, int VAR_4, int VAR_5)\n{", "int VAR_6, VAR_7, VAR_8 = 0, VAR_9, VAR_10, VAR_11, VAR_12 = 1;", "if (VAR_9=ff_j2k_dwt_init(&VAR_0->dwt, VAR_0->coord, VAR_1->nreslevels-1, VAR_1->transform))\nreturn VAR_9;", "for (VAR_10 = 0; VAR_10 < 2; VAR_10++)", "VAR_12 *= VAR_0->coord[VAR_10][1] - VAR_0->coord[VAR_10][0];", "VAR_0->data = av_malloc(VAR_12 * sizeof(int));", "if (!VAR_0->data)\nreturn AVERROR(ENOMEM);", "VAR_0->reslevel = av_malloc(VAR_1->nreslevels * sizeof(J2kResLevel));", "if (!VAR_0->reslevel)\nreturn AVERROR(ENOMEM);", "for (VAR_6 = 0; VAR_6 < VAR_1->nreslevels; VAR_6++){", "int declvl = VAR_1->nreslevels - VAR_6;", "J2kResLevel *reslevel = VAR_0->reslevel + VAR_6;", "for (VAR_10 = 0; VAR_10 < 2; VAR_10++)", "for (VAR_11 = 0; VAR_11 < 2; VAR_11++)", "reslevel->coord[VAR_10][VAR_11] =\nff_j2k_ceildivpow2(VAR_0->coord[VAR_10][VAR_11], declvl - 1);", "if (VAR_6 == 0)\nreslevel->nbands = 1;", "else\nreslevel->nbands = 3;", "if (reslevel->coord[0][1] == reslevel->coord[0][0])\nreslevel->num_precincts_x = 0;", "else\nreslevel->num_precincts_x = ff_j2k_ceildivpow2(reslevel->coord[0][1], VAR_1->log2_prec_width)\n- (reslevel->coord[0][0] >> VAR_1->log2_prec_width);", "if (reslevel->coord[1][1] == reslevel->coord[1][0])\nreslevel->num_precincts_y = 0;", "else\nreslevel->num_precincts_y = ff_j2k_ceildivpow2(reslevel->coord[1][1], VAR_1->log2_prec_height)\n- (reslevel->coord[1][0] >> VAR_1->log2_prec_height);", "reslevel->band = av_malloc(reslevel->nbands * sizeof(J2kBand));", "if (!reslevel->band)\nreturn AVERROR(ENOMEM);", "for (VAR_7 = 0; VAR_7 < reslevel->nbands; VAR_7++, VAR_8++){", "J2kBand *band = reslevel->band + VAR_7;", "int cblkno, precx, precy, precno;", "int x0, y0, x1, y1;", "int xi0, yi0, xi1, yi1;", "int cblkperprecw, cblkperprech;", "if (VAR_2->quantsty != J2K_QSTY_NONE){", "static const uint8_t lut_gain[2][4] = {{0, 0, 0, 0}, {0, 1, 1, 2}};", "int numbps;", "numbps = VAR_3 + lut_gain[VAR_1->transform][VAR_7 + VAR_6>0];", "band->stepsize = SHL(2048 + VAR_2->mant[VAR_8], 2 + numbps - VAR_2->expn[VAR_8]);", "} else", "band->stepsize = 1 << 13;", "if (VAR_6 == 0){", "band->codeblock_width = 1 << FFMIN(VAR_1->log2_cblk_width, VAR_1->log2_prec_width-1);", "band->codeblock_height = 1 << FFMIN(VAR_1->log2_cblk_height, VAR_1->log2_prec_height-1);", "for (VAR_10 = 0; VAR_10 < 2; VAR_10++)", "for (VAR_11 = 0; VAR_11 < 2; VAR_11++)", "band->coord[VAR_10][VAR_11] = ff_j2k_ceildivpow2(VAR_0->coord[VAR_10][VAR_11], declvl-1);", "} else{", "band->codeblock_width = 1 << FFMIN(VAR_1->log2_cblk_width, VAR_1->log2_prec_width);", "band->codeblock_height = 1 << FFMIN(VAR_1->log2_cblk_height, VAR_1->log2_prec_height);", "for (VAR_10 = 0; VAR_10 < 2; VAR_10++)", "for (VAR_11 = 0; VAR_11 < 2; VAR_11++)", "band->coord[VAR_10][VAR_11] = ff_j2k_ceildivpow2(VAR_0->coord[VAR_10][VAR_11] - (((VAR_7+1>>VAR_10)&1) << declvl-1), declvl);", "}", "band->cblknx = ff_j2k_ceildiv(band->coord[0][1], band->codeblock_width) - band->coord[0][0] / band->codeblock_width;", "band->cblkny = ff_j2k_ceildiv(band->coord[1][1], band->codeblock_height) - band->coord[1][0] / band->codeblock_height;", "for (VAR_11 = 0; VAR_11 < 2; VAR_11++)", "band->coord[0][VAR_11] = ff_j2k_ceildiv(band->coord[0][VAR_11], VAR_4);", "for (VAR_11 = 0; VAR_11 < 2; VAR_11++)", "band->coord[1][VAR_11] = ff_j2k_ceildiv(band->coord[1][VAR_11], VAR_5);", "band->cblknx = ff_j2k_ceildiv(band->cblknx, VAR_4);", "band->cblkny = ff_j2k_ceildiv(band->cblkny, VAR_5);", "band->cblk = av_malloc(band->cblknx * band->cblkny * sizeof(J2kCblk));", "if (!band->cblk)\nreturn AVERROR(ENOMEM);", "band->prec = av_malloc(reslevel->num_precincts_x * reslevel->num_precincts_y * sizeof(J2kPrec));", "if (!band->prec)\nreturn AVERROR(ENOMEM);", "for (cblkno = 0; cblkno < band->cblknx * band->cblkny; cblkno++){", "J2kCblk *cblk = band->cblk + cblkno;", "cblk->zero = 0;", "cblk->lblock = 3;", "cblk->length = 0;", "cblk->lengthinc = 0;", "cblk->npasses = 0;", "}", "y0 = band->coord[1][0];", "y1 = ((band->coord[1][0] + (1<<VAR_1->log2_prec_height)) & ~((1<<VAR_1->log2_prec_height)-1)) - y0;", "yi0 = 0;", "yi1 = ff_j2k_ceildivpow2(y1 - y0, VAR_1->log2_cblk_height) << VAR_1->log2_cblk_height;", "yi1 = FFMIN(yi1, band->cblkny);", "cblkperprech = 1<<(VAR_1->log2_prec_height - VAR_1->log2_cblk_height);", "for (precy = 0, precno = 0; precy < reslevel->num_precincts_y; precy++){", "for (precx = 0; precx < reslevel->num_precincts_x; precx++, precno++){", "band->prec[precno].yi0 = yi0;", "band->prec[precno].yi1 = yi1;", "}", "yi1 += cblkperprech;", "yi0 = yi1 - cblkperprech;", "yi1 = FFMIN(yi1, band->cblkny);", "}", "x0 = band->coord[0][0];", "x1 = ((band->coord[0][0] + (1<<VAR_1->log2_prec_width)) & ~((1<<VAR_1->log2_prec_width)-1)) - x0;", "xi0 = 0;", "xi1 = ff_j2k_ceildivpow2(x1 - x0, VAR_1->log2_cblk_width) << VAR_1->log2_cblk_width;", "xi1 = FFMIN(xi1, band->cblknx);", "cblkperprecw = 1<<(VAR_1->log2_prec_width - VAR_1->log2_cblk_width);", "for (precx = 0, precno = 0; precx < reslevel->num_precincts_x; precx++){", "for (precy = 0; precy < reslevel->num_precincts_y; precy++, precno = 0){", "J2kPrec *prec = band->prec + precno;", "prec->xi0 = xi0;", "prec->xi1 = xi1;", "prec->cblkincl = ff_j2k_tag_tree_init(prec->xi1 - prec->xi0,\nprec->yi1 - prec->yi0);", "prec->zerobits = ff_j2k_tag_tree_init(prec->xi1 - prec->xi0,\nprec->yi1 - prec->yi0);", "if (!prec->cblkincl || !prec->zerobits)\nreturn AVERROR(ENOMEM);", "}", "xi1 += cblkperprecw;", "xi0 = xi1 - cblkperprecw;", "xi1 = FFMIN(xi1, band->cblknx);", "}", "}", "}", "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, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21, 23 ], [ 25 ], [ 29, 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45, 47 ], [ 51, 53 ], [ 55, 57 ], [ 61, 63 ], [ 65, 67, 69 ], [ 73, 75 ], [ 77, 79, 81 ], [ 85 ], [ 87, 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 105 ], [ 107 ], [ 109 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 167 ], [ 169 ], [ 173 ], [ 175, 177 ], [ 179 ], [ 181, 183 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259, 261 ], [ 263, 265 ], [ 267, 269 ], [ 273 ], [ 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ] ]
4,669
void vncws_tls_handshake_io(void *opaque) { VncState *vs = (VncState *)opaque; if (!vs->tls.session) { VNC_DEBUG("TLS Websocket setup\n"); if (vnc_tls_client_setup(vs, vs->vd->tls.x509cert != NULL) < 0) { return; } } VNC_DEBUG("Handshake IO continue\n"); vncws_start_tls_handshake(vs); }
true
qemu
3e305e4a4752f70c0b5c3cf5b43ec957881714f7
void vncws_tls_handshake_io(void *opaque) { VncState *vs = (VncState *)opaque; if (!vs->tls.session) { VNC_DEBUG("TLS Websocket setup\n"); if (vnc_tls_client_setup(vs, vs->vd->tls.x509cert != NULL) < 0) { return; } } VNC_DEBUG("Handshake IO continue\n"); vncws_start_tls_handshake(vs); }
{ "code": [ " if (!vs->tls.session) {", " VNC_DEBUG(\"TLS Websocket setup\\n\");", " if (vnc_tls_client_setup(vs, vs->vd->tls.x509cert != NULL) < 0) {", " VNC_DEBUG(\"Handshake IO continue\\n\");" ], "line_no": [ 9, 11, 13, 21 ] }
void FUNC_0(void *VAR_0) { VncState *vs = (VncState *)VAR_0; if (!vs->tls.session) { VNC_DEBUG("TLS Websocket setup\n"); if (vnc_tls_client_setup(vs, vs->vd->tls.x509cert != NULL) < 0) { return; } } VNC_DEBUG("Handshake IO continue\n"); vncws_start_tls_handshake(vs); }
[ "void FUNC_0(void *VAR_0)\n{", "VncState *vs = (VncState *)VAR_0;", "if (!vs->tls.session) {", "VNC_DEBUG(\"TLS Websocket setup\\n\");", "if (vnc_tls_client_setup(vs, vs->vd->tls.x509cert != NULL) < 0) {", "return;", "}", "}", "VNC_DEBUG(\"Handshake IO continue\\n\");", "vncws_start_tls_handshake(vs);", "}" ]
[ 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ] ]
4,670
int css_do_rsch(SubchDev *sch) { SCSW *s = &sch->curr_status.scsw; PMCW *p = &sch->curr_status.pmcw; int ret; if (~(p->flags) & (PMCW_FLAGS_MASK_DNV | PMCW_FLAGS_MASK_ENA)) { ret = -ENODEV; goto out; } if (s->ctrl & SCSW_STCTL_STATUS_PEND) { ret = -EINPROGRESS; goto out; } if (((s->ctrl & SCSW_CTRL_MASK_FCTL) != SCSW_FCTL_START_FUNC) || (s->ctrl & SCSW_ACTL_RESUME_PEND) || (!(s->ctrl & SCSW_ACTL_SUSP))) { ret = -EINVAL; goto out; } /* If monitoring is active, update counter. */ if (channel_subsys.chnmon_active) { css_update_chnmon(sch); } s->ctrl |= SCSW_ACTL_RESUME_PEND; do_subchannel_work(sch); ret = 0; out: return ret; }
true
qemu
66dc50f7057b9a0191f54e55764412202306858d
int css_do_rsch(SubchDev *sch) { SCSW *s = &sch->curr_status.scsw; PMCW *p = &sch->curr_status.pmcw; int ret; if (~(p->flags) & (PMCW_FLAGS_MASK_DNV | PMCW_FLAGS_MASK_ENA)) { ret = -ENODEV; goto out; } if (s->ctrl & SCSW_STCTL_STATUS_PEND) { ret = -EINPROGRESS; goto out; } if (((s->ctrl & SCSW_CTRL_MASK_FCTL) != SCSW_FCTL_START_FUNC) || (s->ctrl & SCSW_ACTL_RESUME_PEND) || (!(s->ctrl & SCSW_ACTL_SUSP))) { ret = -EINVAL; goto out; } if (channel_subsys.chnmon_active) { css_update_chnmon(sch); } s->ctrl |= SCSW_ACTL_RESUME_PEND; do_subchannel_work(sch); ret = 0; out: return ret; }
{ "code": [ " int ret;", " ret = -ENODEV;", " return ret;", " return ret;", " int ret;", " ret = -ENODEV;", " goto out;", " ret = -EINPROGRESS;", " goto out;", " goto out;", "out:", " return ret;", "int css_do_rsch(SubchDev *sch)", " int ret;", " ret = -ENODEV;", " goto out;", " ret = -EINPROGRESS;", " goto out;", " ret = -EINVAL;", " goto out;", " do_subchannel_work(sch);", " ret = 0;", "out:", " return ret;" ], "line_no": [ 9, 15, 67, 67, 9, 15, 17, 25, 17, 17, 65, 67, 1, 9, 15, 17, 25, 17, 39, 17, 59, 61, 65, 67 ] }
int FUNC_0(SubchDev *VAR_0) { SCSW *s = &VAR_0->curr_status.scsw; PMCW *p = &VAR_0->curr_status.pmcw; int VAR_1; if (~(p->flags) & (PMCW_FLAGS_MASK_DNV | PMCW_FLAGS_MASK_ENA)) { VAR_1 = -ENODEV; goto out; } if (s->ctrl & SCSW_STCTL_STATUS_PEND) { VAR_1 = -EINPROGRESS; goto out; } if (((s->ctrl & SCSW_CTRL_MASK_FCTL) != SCSW_FCTL_START_FUNC) || (s->ctrl & SCSW_ACTL_RESUME_PEND) || (!(s->ctrl & SCSW_ACTL_SUSP))) { VAR_1 = -EINVAL; goto out; } if (channel_subsys.chnmon_active) { css_update_chnmon(VAR_0); } s->ctrl |= SCSW_ACTL_RESUME_PEND; do_subchannel_work(VAR_0); VAR_1 = 0; out: return VAR_1; }
[ "int FUNC_0(SubchDev *VAR_0)\n{", "SCSW *s = &VAR_0->curr_status.scsw;", "PMCW *p = &VAR_0->curr_status.pmcw;", "int VAR_1;", "if (~(p->flags) & (PMCW_FLAGS_MASK_DNV | PMCW_FLAGS_MASK_ENA)) {", "VAR_1 = -ENODEV;", "goto out;", "}", "if (s->ctrl & SCSW_STCTL_STATUS_PEND) {", "VAR_1 = -EINPROGRESS;", "goto out;", "}", "if (((s->ctrl & SCSW_CTRL_MASK_FCTL) != SCSW_FCTL_START_FUNC) ||\n(s->ctrl & SCSW_ACTL_RESUME_PEND) ||\n(!(s->ctrl & SCSW_ACTL_SUSP))) {", "VAR_1 = -EINVAL;", "goto out;", "}", "if (channel_subsys.chnmon_active) {", "css_update_chnmon(VAR_0);", "}", "s->ctrl |= SCSW_ACTL_RESUME_PEND;", "do_subchannel_work(VAR_0);", "VAR_1 = 0;", "out:\nreturn VAR_1;", "}" ]
[ 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33, 35, 37 ], [ 39 ], [ 41 ], [ 43 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 65, 67 ], [ 69 ] ]
4,671
ram_addr_t ppc4xx_sdram_adjust(ram_addr_t ram_size, int nr_banks, MemoryRegion ram_memories[], hwaddr ram_bases[], hwaddr ram_sizes[], const unsigned int sdram_bank_sizes[]) { ram_addr_t size_left = ram_size; ram_addr_t base = 0; int i; int j; for (i = 0; i < nr_banks; i++) { for (j = 0; sdram_bank_sizes[j] != 0; j++) { unsigned int bank_size = sdram_bank_sizes[j]; if (bank_size <= size_left) { char name[32]; snprintf(name, sizeof(name), "ppc4xx.sdram%d", i); memory_region_allocate_system_memory(&ram_memories[i], NULL, name, bank_size); ram_bases[i] = base; ram_sizes[i] = bank_size; base += bank_size; size_left -= bank_size; break; } } if (!size_left) { /* No need to use the remaining banks. */ break; } } ram_size -= size_left; if (size_left) printf("Truncating memory to %d MiB to fit SDRAM controller limits.\n", (int)(ram_size >> 20)); return ram_size; }
true
qemu
e206ad48333c50373663945746828fc893b50700
ram_addr_t ppc4xx_sdram_adjust(ram_addr_t ram_size, int nr_banks, MemoryRegion ram_memories[], hwaddr ram_bases[], hwaddr ram_sizes[], const unsigned int sdram_bank_sizes[]) { ram_addr_t size_left = ram_size; ram_addr_t base = 0; int i; int j; for (i = 0; i < nr_banks; i++) { for (j = 0; sdram_bank_sizes[j] != 0; j++) { unsigned int bank_size = sdram_bank_sizes[j]; if (bank_size <= size_left) { char name[32]; snprintf(name, sizeof(name), "ppc4xx.sdram%d", i); memory_region_allocate_system_memory(&ram_memories[i], NULL, name, bank_size); ram_bases[i] = base; ram_sizes[i] = bank_size; base += bank_size; size_left -= bank_size; break; } } if (!size_left) { break; } } ram_size -= size_left; if (size_left) printf("Truncating memory to %d MiB to fit SDRAM controller limits.\n", (int)(ram_size >> 20)); return ram_size; }
{ "code": [ " unsigned int bank_size = sdram_bank_sizes[j];", " char name[32];", " snprintf(name, sizeof(name), \"ppc4xx.sdram%d\", i);", " memory_region_allocate_system_memory(&ram_memories[i], NULL,", " name, bank_size);", " ram_bases[i] = base;", " ram_sizes[i] = bank_size;", " base += bank_size;", " break;", " if (size_left)" ], "line_no": [ 27, 33, 35, 37, 39, 41, 43, 45, 49, 71 ] }
ram_addr_t FUNC_0(ram_addr_t ram_size, int nr_banks, MemoryRegion ram_memories[], hwaddr ram_bases[], hwaddr ram_sizes[], const unsigned int sdram_bank_sizes[]) { ram_addr_t size_left = ram_size; ram_addr_t base = 0; int VAR_0; int VAR_1; for (VAR_0 = 0; VAR_0 < nr_banks; VAR_0++) { for (VAR_1 = 0; sdram_bank_sizes[VAR_1] != 0; VAR_1++) { unsigned int VAR_2 = sdram_bank_sizes[VAR_1]; if (VAR_2 <= size_left) { char VAR_3[32]; snprintf(VAR_3, sizeof(VAR_3), "ppc4xx.sdram%d", VAR_0); memory_region_allocate_system_memory(&ram_memories[VAR_0], NULL, VAR_3, VAR_2); ram_bases[VAR_0] = base; ram_sizes[VAR_0] = VAR_2; base += VAR_2; size_left -= VAR_2; break; } } if (!size_left) { break; } } ram_size -= size_left; if (size_left) printf("Truncating memory to %d MiB to fit SDRAM controller limits.\n", (int)(ram_size >> 20)); return ram_size; }
[ "ram_addr_t FUNC_0(ram_addr_t ram_size, int nr_banks,\nMemoryRegion ram_memories[],\nhwaddr ram_bases[],\nhwaddr ram_sizes[],\nconst unsigned int sdram_bank_sizes[])\n{", "ram_addr_t size_left = ram_size;", "ram_addr_t base = 0;", "int VAR_0;", "int VAR_1;", "for (VAR_0 = 0; VAR_0 < nr_banks; VAR_0++) {", "for (VAR_1 = 0; sdram_bank_sizes[VAR_1] != 0; VAR_1++) {", "unsigned int VAR_2 = sdram_bank_sizes[VAR_1];", "if (VAR_2 <= size_left) {", "char VAR_3[32];", "snprintf(VAR_3, sizeof(VAR_3), \"ppc4xx.sdram%d\", VAR_0);", "memory_region_allocate_system_memory(&ram_memories[VAR_0], NULL,\nVAR_3, VAR_2);", "ram_bases[VAR_0] = base;", "ram_sizes[VAR_0] = VAR_2;", "base += VAR_2;", "size_left -= VAR_2;", "break;", "}", "}", "if (!size_left) {", "break;", "}", "}", "ram_size -= size_left;", "if (size_left)\nprintf(\"Truncating memory to %d MiB to fit SDRAM controller limits.\\n\",\n(int)(ram_size >> 20));", "return ram_size;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37, 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71, 73, 75 ], [ 79 ], [ 81 ] ]
4,672
static int mxf_read_cryptographic_context(void *arg, AVIOContext *pb, int tag, int size, UID uid) { MXFCryptoContext *cryptocontext = arg; if (size != 16) return -1; if (IS_KLV_KEY(uid, mxf_crypto_source_container_ul)) avio_read(pb, cryptocontext->source_container_ul, 16); return 0; }
true
FFmpeg
fd34dbea58e097609ff09cf7dcc59f74930195d3
static int mxf_read_cryptographic_context(void *arg, AVIOContext *pb, int tag, int size, UID uid) { MXFCryptoContext *cryptocontext = arg; if (size != 16) return -1; if (IS_KLV_KEY(uid, mxf_crypto_source_container_ul)) avio_read(pb, cryptocontext->source_container_ul, 16); return 0; }
{ "code": [ "static int mxf_read_cryptographic_context(void *arg, AVIOContext *pb, int tag, int size, UID uid)" ], "line_no": [ 1 ] }
static int FUNC_0(void *VAR_0, AVIOContext *VAR_1, int VAR_2, int VAR_3, UID VAR_4) { MXFCryptoContext *cryptocontext = VAR_0; if (VAR_3 != 16) return -1; if (IS_KLV_KEY(VAR_4, mxf_crypto_source_container_ul)) avio_read(VAR_1, cryptocontext->source_container_ul, 16); return 0; }
[ "static int FUNC_0(void *VAR_0, AVIOContext *VAR_1, int VAR_2, int VAR_3, UID VAR_4)\n{", "MXFCryptoContext *cryptocontext = VAR_0;", "if (VAR_3 != 16)\nreturn -1;", "if (IS_KLV_KEY(VAR_4, mxf_crypto_source_container_ul))\navio_read(VAR_1, cryptocontext->source_container_ul, 16);", "return 0;", "}" ]
[ 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 11, 13 ], [ 15 ], [ 17 ] ]
4,673
void ff_eac3_decode_transform_coeffs_aht_ch(AC3DecodeContext *s, int ch) { int bin, blk, gs; int end_bap, gaq_mode; GetBitContext *gbc = &s->gbc; int gaq_gain[AC3_MAX_COEFS]; gaq_mode = get_bits(gbc, 2); end_bap = (gaq_mode < 2) ? 12 : 17; /* if GAQ gain is used, decode gain codes for bins with hebap between 8 and end_bap */ gs = 0; if (gaq_mode == EAC3_GAQ_12 || gaq_mode == EAC3_GAQ_14) { /* read 1-bit GAQ gain codes */ for (bin = s->start_freq[ch]; bin < s->end_freq[ch]; bin++) { if (s->bap[ch][bin] > 7 && s->bap[ch][bin] < end_bap) gaq_gain[gs++] = get_bits1(gbc) << (gaq_mode-1); } } else if (gaq_mode == EAC3_GAQ_124) { /* read 1.67-bit GAQ gain codes (3 codes in 5 bits) */ int gc = 2; for (bin = s->start_freq[ch]; bin < s->end_freq[ch]; bin++) { if (s->bap[ch][bin] > 7 && s->bap[ch][bin] < 17) { if (gc++ == 2) { int group_code = get_bits(gbc, 5); if (group_code > 26) { av_log(s->avctx, AV_LOG_WARNING, "GAQ gain group code out-of-range\n"); group_code = 26; } gaq_gain[gs++] = ff_ac3_ungroup_3_in_5_bits_tab[group_code][0]; gaq_gain[gs++] = ff_ac3_ungroup_3_in_5_bits_tab[group_code][1]; gaq_gain[gs++] = ff_ac3_ungroup_3_in_5_bits_tab[group_code][2]; gc = 0; } } } } gs=0; for (bin = s->start_freq[ch]; bin < s->end_freq[ch]; bin++) { int hebap = s->bap[ch][bin]; int bits = ff_eac3_bits_vs_hebap[hebap]; if (!hebap) { /* zero-mantissa dithering */ for (blk = 0; blk < 6; blk++) { s->pre_mantissa[ch][bin][blk] = (av_lfg_get(&s->dith_state) & 0x7FFFFF) - 0x400000; } } else if (hebap < 8) { /* Vector Quantization */ int v = get_bits(gbc, bits); for (blk = 0; blk < 6; blk++) { s->pre_mantissa[ch][bin][blk] = ff_eac3_mantissa_vq[hebap][v][blk] << 8; } } else { /* Gain Adaptive Quantization */ int gbits, log_gain; if (gaq_mode != EAC3_GAQ_NO && hebap < end_bap) { log_gain = gaq_gain[gs++]; } else { log_gain = 0; } gbits = bits - log_gain; for (blk = 0; blk < 6; blk++) { int mant = get_sbits(gbc, gbits); if (log_gain && mant == -(1 << (gbits-1))) { /* large mantissa */ int b; int mbits = bits - (2 - log_gain); mant = get_sbits(gbc, mbits); mant <<= (23 - (mbits - 1)); /* remap mantissa value to correct for asymmetric quantization */ if (mant >= 0) b = 1 << (23 - log_gain); else b = ff_eac3_gaq_remap_2_4_b[hebap-8][log_gain-1] << 8; mant += ((ff_eac3_gaq_remap_2_4_a[hebap-8][log_gain-1] * (int64_t)mant) >> 15) + b; } else { /* small mantissa, no GAQ, or Gk=1 */ mant <<= 24 - bits; if (!log_gain) { /* remap mantissa value for no GAQ or Gk=1 */ mant += (ff_eac3_gaq_remap_1[hebap-8] * (int64_t)mant) >> 15; } } s->pre_mantissa[ch][bin][blk] = mant; } } idct6(s->pre_mantissa[ch][bin]); } }
true
FFmpeg
7b05b5093ea67a3397b0c37cf398bab471e1ce2b
void ff_eac3_decode_transform_coeffs_aht_ch(AC3DecodeContext *s, int ch) { int bin, blk, gs; int end_bap, gaq_mode; GetBitContext *gbc = &s->gbc; int gaq_gain[AC3_MAX_COEFS]; gaq_mode = get_bits(gbc, 2); end_bap = (gaq_mode < 2) ? 12 : 17; gs = 0; if (gaq_mode == EAC3_GAQ_12 || gaq_mode == EAC3_GAQ_14) { for (bin = s->start_freq[ch]; bin < s->end_freq[ch]; bin++) { if (s->bap[ch][bin] > 7 && s->bap[ch][bin] < end_bap) gaq_gain[gs++] = get_bits1(gbc) << (gaq_mode-1); } } else if (gaq_mode == EAC3_GAQ_124) { int gc = 2; for (bin = s->start_freq[ch]; bin < s->end_freq[ch]; bin++) { if (s->bap[ch][bin] > 7 && s->bap[ch][bin] < 17) { if (gc++ == 2) { int group_code = get_bits(gbc, 5); if (group_code > 26) { av_log(s->avctx, AV_LOG_WARNING, "GAQ gain group code out-of-range\n"); group_code = 26; } gaq_gain[gs++] = ff_ac3_ungroup_3_in_5_bits_tab[group_code][0]; gaq_gain[gs++] = ff_ac3_ungroup_3_in_5_bits_tab[group_code][1]; gaq_gain[gs++] = ff_ac3_ungroup_3_in_5_bits_tab[group_code][2]; gc = 0; } } } } gs=0; for (bin = s->start_freq[ch]; bin < s->end_freq[ch]; bin++) { int hebap = s->bap[ch][bin]; int bits = ff_eac3_bits_vs_hebap[hebap]; if (!hebap) { for (blk = 0; blk < 6; blk++) { s->pre_mantissa[ch][bin][blk] = (av_lfg_get(&s->dith_state) & 0x7FFFFF) - 0x400000; } } else if (hebap < 8) { int v = get_bits(gbc, bits); for (blk = 0; blk < 6; blk++) { s->pre_mantissa[ch][bin][blk] = ff_eac3_mantissa_vq[hebap][v][blk] << 8; } } else { int gbits, log_gain; if (gaq_mode != EAC3_GAQ_NO && hebap < end_bap) { log_gain = gaq_gain[gs++]; } else { log_gain = 0; } gbits = bits - log_gain; for (blk = 0; blk < 6; blk++) { int mant = get_sbits(gbc, gbits); if (log_gain && mant == -(1 << (gbits-1))) { int b; int mbits = bits - (2 - log_gain); mant = get_sbits(gbc, mbits); mant <<= (23 - (mbits - 1)); if (mant >= 0) b = 1 << (23 - log_gain); else b = ff_eac3_gaq_remap_2_4_b[hebap-8][log_gain-1] << 8; mant += ((ff_eac3_gaq_remap_2_4_a[hebap-8][log_gain-1] * (int64_t)mant) >> 15) + b; } else { mant <<= 24 - bits; if (!log_gain) { mant += (ff_eac3_gaq_remap_1[hebap-8] * (int64_t)mant) >> 15; } } s->pre_mantissa[ch][bin][blk] = mant; } } idct6(s->pre_mantissa[ch][bin]); } }
{ "code": [ "void ff_eac3_decode_transform_coeffs_aht_ch(AC3DecodeContext *s, int ch)" ], "line_no": [ 1 ] }
void FUNC_0(AC3DecodeContext *VAR_0, int VAR_1) { int VAR_2, VAR_3, VAR_4; int VAR_5, VAR_6; GetBitContext *gbc = &VAR_0->gbc; int VAR_7[AC3_MAX_COEFS]; VAR_6 = get_bits(gbc, 2); VAR_5 = (VAR_6 < 2) ? 12 : 17; VAR_4 = 0; if (VAR_6 == EAC3_GAQ_12 || VAR_6 == EAC3_GAQ_14) { for (VAR_2 = VAR_0->start_freq[VAR_1]; VAR_2 < VAR_0->end_freq[VAR_1]; VAR_2++) { if (VAR_0->bap[VAR_1][VAR_2] > 7 && VAR_0->bap[VAR_1][VAR_2] < VAR_5) VAR_7[VAR_4++] = get_bits1(gbc) << (VAR_6-1); } } else if (VAR_6 == EAC3_GAQ_124) { int VAR_8 = 2; for (VAR_2 = VAR_0->start_freq[VAR_1]; VAR_2 < VAR_0->end_freq[VAR_1]; VAR_2++) { if (VAR_0->bap[VAR_1][VAR_2] > 7 && VAR_0->bap[VAR_1][VAR_2] < 17) { if (VAR_8++ == 2) { int group_code = get_bits(gbc, 5); if (group_code > 26) { av_log(VAR_0->avctx, AV_LOG_WARNING, "GAQ gain group code out-of-range\n"); group_code = 26; } VAR_7[VAR_4++] = ff_ac3_ungroup_3_in_5_bits_tab[group_code][0]; VAR_7[VAR_4++] = ff_ac3_ungroup_3_in_5_bits_tab[group_code][1]; VAR_7[VAR_4++] = ff_ac3_ungroup_3_in_5_bits_tab[group_code][2]; VAR_8 = 0; } } } } VAR_4=0; for (VAR_2 = VAR_0->start_freq[VAR_1]; VAR_2 < VAR_0->end_freq[VAR_1]; VAR_2++) { int hebap = VAR_0->bap[VAR_1][VAR_2]; int bits = ff_eac3_bits_vs_hebap[hebap]; if (!hebap) { for (VAR_3 = 0; VAR_3 < 6; VAR_3++) { VAR_0->pre_mantissa[VAR_1][VAR_2][VAR_3] = (av_lfg_get(&VAR_0->dith_state) & 0x7FFFFF) - 0x400000; } } else if (hebap < 8) { int v = get_bits(gbc, bits); for (VAR_3 = 0; VAR_3 < 6; VAR_3++) { VAR_0->pre_mantissa[VAR_1][VAR_2][VAR_3] = ff_eac3_mantissa_vq[hebap][v][VAR_3] << 8; } } else { int gbits, log_gain; if (VAR_6 != EAC3_GAQ_NO && hebap < VAR_5) { log_gain = VAR_7[VAR_4++]; } else { log_gain = 0; } gbits = bits - log_gain; for (VAR_3 = 0; VAR_3 < 6; VAR_3++) { int mant = get_sbits(gbc, gbits); if (log_gain && mant == -(1 << (gbits-1))) { int b; int mbits = bits - (2 - log_gain); mant = get_sbits(gbc, mbits); mant <<= (23 - (mbits - 1)); if (mant >= 0) b = 1 << (23 - log_gain); else b = ff_eac3_gaq_remap_2_4_b[hebap-8][log_gain-1] << 8; mant += ((ff_eac3_gaq_remap_2_4_a[hebap-8][log_gain-1] * (int64_t)mant) >> 15) + b; } else { mant <<= 24 - bits; if (!log_gain) { mant += (ff_eac3_gaq_remap_1[hebap-8] * (int64_t)mant) >> 15; } } VAR_0->pre_mantissa[VAR_1][VAR_2][VAR_3] = mant; } } idct6(VAR_0->pre_mantissa[VAR_1][VAR_2]); } }
[ "void FUNC_0(AC3DecodeContext *VAR_0, int VAR_1)\n{", "int VAR_2, VAR_3, VAR_4;", "int VAR_5, VAR_6;", "GetBitContext *gbc = &VAR_0->gbc;", "int VAR_7[AC3_MAX_COEFS];", "VAR_6 = get_bits(gbc, 2);", "VAR_5 = (VAR_6 < 2) ? 12 : 17;", "VAR_4 = 0;", "if (VAR_6 == EAC3_GAQ_12 || VAR_6 == EAC3_GAQ_14) {", "for (VAR_2 = VAR_0->start_freq[VAR_1]; VAR_2 < VAR_0->end_freq[VAR_1]; VAR_2++) {", "if (VAR_0->bap[VAR_1][VAR_2] > 7 && VAR_0->bap[VAR_1][VAR_2] < VAR_5)\nVAR_7[VAR_4++] = get_bits1(gbc) << (VAR_6-1);", "}", "} else if (VAR_6 == EAC3_GAQ_124) {", "int VAR_8 = 2;", "for (VAR_2 = VAR_0->start_freq[VAR_1]; VAR_2 < VAR_0->end_freq[VAR_1]; VAR_2++) {", "if (VAR_0->bap[VAR_1][VAR_2] > 7 && VAR_0->bap[VAR_1][VAR_2] < 17) {", "if (VAR_8++ == 2) {", "int group_code = get_bits(gbc, 5);", "if (group_code > 26) {", "av_log(VAR_0->avctx, AV_LOG_WARNING, \"GAQ gain group code out-of-range\\n\");", "group_code = 26;", "}", "VAR_7[VAR_4++] = ff_ac3_ungroup_3_in_5_bits_tab[group_code][0];", "VAR_7[VAR_4++] = ff_ac3_ungroup_3_in_5_bits_tab[group_code][1];", "VAR_7[VAR_4++] = ff_ac3_ungroup_3_in_5_bits_tab[group_code][2];", "VAR_8 = 0;", "}", "}", "}", "}", "VAR_4=0;", "for (VAR_2 = VAR_0->start_freq[VAR_1]; VAR_2 < VAR_0->end_freq[VAR_1]; VAR_2++) {", "int hebap = VAR_0->bap[VAR_1][VAR_2];", "int bits = ff_eac3_bits_vs_hebap[hebap];", "if (!hebap) {", "for (VAR_3 = 0; VAR_3 < 6; VAR_3++) {", "VAR_0->pre_mantissa[VAR_1][VAR_2][VAR_3] = (av_lfg_get(&VAR_0->dith_state) & 0x7FFFFF) - 0x400000;", "}", "} else if (hebap < 8) {", "int v = get_bits(gbc, bits);", "for (VAR_3 = 0; VAR_3 < 6; VAR_3++) {", "VAR_0->pre_mantissa[VAR_1][VAR_2][VAR_3] = ff_eac3_mantissa_vq[hebap][v][VAR_3] << 8;", "}", "} else {", "int gbits, log_gain;", "if (VAR_6 != EAC3_GAQ_NO && hebap < VAR_5) {", "log_gain = VAR_7[VAR_4++];", "} else {", "log_gain = 0;", "}", "gbits = bits - log_gain;", "for (VAR_3 = 0; VAR_3 < 6; VAR_3++) {", "int mant = get_sbits(gbc, gbits);", "if (log_gain && mant == -(1 << (gbits-1))) {", "int b;", "int mbits = bits - (2 - log_gain);", "mant = get_sbits(gbc, mbits);", "mant <<= (23 - (mbits - 1));", "if (mant >= 0)\nb = 1 << (23 - log_gain);", "else\nb = ff_eac3_gaq_remap_2_4_b[hebap-8][log_gain-1] << 8;", "mant += ((ff_eac3_gaq_remap_2_4_a[hebap-8][log_gain-1] * (int64_t)mant) >> 15) + b;", "} else {", "mant <<= 24 - bits;", "if (!log_gain) {", "mant += (ff_eac3_gaq_remap_1[hebap-8] * (int64_t)mant) >> 15;", "}", "}", "VAR_0->pre_mantissa[VAR_1][VAR_2][VAR_3] = mant;", "}", "}", "idct6(VAR_0->pre_mantissa[VAR_1][VAR_2]);", "}", "}" ]
[ 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 25 ], [ 27 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 129 ], [ 131 ], [ 133 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 147, 149 ], [ 151, 153 ], [ 155 ], [ 157 ], [ 161 ], [ 163 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ] ]
4,675
void unregister_displaychangelistener(DisplayChangeListener *dcl) { DisplayState *ds = dcl->ds; trace_displaychangelistener_unregister(dcl, dcl->ops->dpy_name); if (dcl->con) { dcl->con->dcls--; } QLIST_REMOVE(dcl, next); gui_setup_refresh(ds); }
true
qemu
777c5f1e436d334a57b650b6951c13d8d2799df0
void unregister_displaychangelistener(DisplayChangeListener *dcl) { DisplayState *ds = dcl->ds; trace_displaychangelistener_unregister(dcl, dcl->ops->dpy_name); if (dcl->con) { dcl->con->dcls--; } QLIST_REMOVE(dcl, next); gui_setup_refresh(ds); }
{ "code": [], "line_no": [] }
void FUNC_0(DisplayChangeListener *VAR_0) { DisplayState *ds = VAR_0->ds; trace_displaychangelistener_unregister(VAR_0, VAR_0->ops->dpy_name); if (VAR_0->con) { VAR_0->con->dcls--; } QLIST_REMOVE(VAR_0, next); gui_setup_refresh(ds); }
[ "void FUNC_0(DisplayChangeListener *VAR_0)\n{", "DisplayState *ds = VAR_0->ds;", "trace_displaychangelistener_unregister(VAR_0, VAR_0->ops->dpy_name);", "if (VAR_0->con) {", "VAR_0->con->dcls--;", "}", "QLIST_REMOVE(VAR_0, next);", "gui_setup_refresh(ds);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 18 ], [ 20 ] ]
4,677
int avpicture_layout(const AVPicture* src, enum AVPixelFormat pix_fmt, int width, int height, unsigned char *dest, int dest_size) { int i, j, nb_planes = 0, linesizes[4]; const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt); int size = avpicture_get_size(pix_fmt, width, height); if (size > dest_size || size < 0) return AVERROR(EINVAL); for (i = 0; i < desc->nb_components; i++) nb_planes = FFMAX(desc->comp[i].plane, nb_planes); nb_planes++; av_image_fill_linesizes(linesizes, pix_fmt, width); for (i = 0; i < nb_planes; i++) { int h, shift = (i == 1 || i == 2) ? desc->log2_chroma_h : 0; const unsigned char *s = src->data[i]; h = (height + (1 << shift) - 1) >> shift; for (j = 0; j < h; j++) { memcpy(dest, s, linesizes[i]); dest += linesizes[i]; s += src->linesize[i]; } } if (desc->flags & AV_PIX_FMT_FLAG_PAL) memcpy((unsigned char *)(((size_t)dest + 3) & ~3), src->data[1], 256 * 4); return size; }
false
FFmpeg
e2ad0b66fa273c5c823978e8f601f2c0d9ee42f8
int avpicture_layout(const AVPicture* src, enum AVPixelFormat pix_fmt, int width, int height, unsigned char *dest, int dest_size) { int i, j, nb_planes = 0, linesizes[4]; const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt); int size = avpicture_get_size(pix_fmt, width, height); if (size > dest_size || size < 0) return AVERROR(EINVAL); for (i = 0; i < desc->nb_components; i++) nb_planes = FFMAX(desc->comp[i].plane, nb_planes); nb_planes++; av_image_fill_linesizes(linesizes, pix_fmt, width); for (i = 0; i < nb_planes; i++) { int h, shift = (i == 1 || i == 2) ? desc->log2_chroma_h : 0; const unsigned char *s = src->data[i]; h = (height + (1 << shift) - 1) >> shift; for (j = 0; j < h; j++) { memcpy(dest, s, linesizes[i]); dest += linesizes[i]; s += src->linesize[i]; } } if (desc->flags & AV_PIX_FMT_FLAG_PAL) memcpy((unsigned char *)(((size_t)dest + 3) & ~3), src->data[1], 256 * 4); return size; }
{ "code": [], "line_no": [] }
int FUNC_0(const AVPicture* VAR_0, enum AVPixelFormat VAR_1, int VAR_2, int VAR_3, unsigned char *VAR_4, int VAR_5) { int VAR_6, VAR_7, VAR_8 = 0, VAR_9[4]; const AVPixFmtDescriptor *VAR_10 = av_pix_fmt_desc_get(VAR_1); int VAR_11 = avpicture_get_size(VAR_1, VAR_2, VAR_3); if (VAR_11 > VAR_5 || VAR_11 < 0) return AVERROR(EINVAL); for (VAR_6 = 0; VAR_6 < VAR_10->nb_components; VAR_6++) VAR_8 = FFMAX(VAR_10->comp[VAR_6].plane, VAR_8); VAR_8++; av_image_fill_linesizes(VAR_9, VAR_1, VAR_2); for (VAR_6 = 0; VAR_6 < VAR_8; VAR_6++) { int VAR_12, VAR_13 = (VAR_6 == 1 || VAR_6 == 2) ? VAR_10->log2_chroma_h : 0; const unsigned char *VAR_14 = VAR_0->data[VAR_6]; VAR_12 = (VAR_3 + (1 << VAR_13) - 1) >> VAR_13; for (VAR_7 = 0; VAR_7 < VAR_12; VAR_7++) { memcpy(VAR_4, VAR_14, VAR_9[VAR_6]); VAR_4 += VAR_9[VAR_6]; VAR_14 += VAR_0->linesize[VAR_6]; } } if (VAR_10->flags & AV_PIX_FMT_FLAG_PAL) memcpy((unsigned char *)(((size_t)VAR_4 + 3) & ~3), VAR_0->data[1], 256 * 4); return VAR_11; }
[ "int FUNC_0(const AVPicture* VAR_0, enum AVPixelFormat VAR_1,\nint VAR_2, int VAR_3,\nunsigned char *VAR_4, int VAR_5)\n{", "int VAR_6, VAR_7, VAR_8 = 0, VAR_9[4];", "const AVPixFmtDescriptor *VAR_10 = av_pix_fmt_desc_get(VAR_1);", "int VAR_11 = avpicture_get_size(VAR_1, VAR_2, VAR_3);", "if (VAR_11 > VAR_5 || VAR_11 < 0)\nreturn AVERROR(EINVAL);", "for (VAR_6 = 0; VAR_6 < VAR_10->nb_components; VAR_6++)", "VAR_8 = FFMAX(VAR_10->comp[VAR_6].plane, VAR_8);", "VAR_8++;", "av_image_fill_linesizes(VAR_9, VAR_1, VAR_2);", "for (VAR_6 = 0; VAR_6 < VAR_8; VAR_6++) {", "int VAR_12, VAR_13 = (VAR_6 == 1 || VAR_6 == 2) ? VAR_10->log2_chroma_h : 0;", "const unsigned char *VAR_14 = VAR_0->data[VAR_6];", "VAR_12 = (VAR_3 + (1 << VAR_13) - 1) >> VAR_13;", "for (VAR_7 = 0; VAR_7 < VAR_12; VAR_7++) {", "memcpy(VAR_4, VAR_14, VAR_9[VAR_6]);", "VAR_4 += VAR_9[VAR_6];", "VAR_14 += VAR_0->linesize[VAR_6];", "}", "}", "if (VAR_10->flags & AV_PIX_FMT_FLAG_PAL)\nmemcpy((unsigned char *)(((size_t)VAR_4 + 3) & ~3),\nVAR_0->data[1], 256 * 4);", "return VAR_11;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17, 19 ], [ 23 ], [ 25 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59, 61, 63 ], [ 67 ], [ 69 ] ]
4,678
static int pipe_open(URLContext *h, const char *filename, int flags) { int fd; if (flags & URL_WRONLY) { fd = 1; } else { fd = 0; } #if defined(__MINGW32__) || defined(CONFIG_OS2) || defined(__CYGWIN__) setmode(fd, O_BINARY); #endif h->priv_data = (void *)(size_t)fd; h->is_streamed = 1; return 0; }
false
FFmpeg
05d00e953f4cc08273fbb5f795f4fdc307140108
static int pipe_open(URLContext *h, const char *filename, int flags) { int fd; if (flags & URL_WRONLY) { fd = 1; } else { fd = 0; } #if defined(__MINGW32__) || defined(CONFIG_OS2) || defined(__CYGWIN__) setmode(fd, O_BINARY); #endif h->priv_data = (void *)(size_t)fd; h->is_streamed = 1; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(URLContext *VAR_0, const char *VAR_1, int VAR_2) { int VAR_3; if (VAR_2 & URL_WRONLY) { VAR_3 = 1; } else { VAR_3 = 0; } #if defined(__MINGW32__) || defined(CONFIG_OS2) || defined(__CYGWIN__) setmode(VAR_3, O_BINARY); #endif VAR_0->priv_data = (void *)(size_t)VAR_3; VAR_0->is_streamed = 1; return 0; }
[ "static int FUNC_0(URLContext *VAR_0, const char *VAR_1, int VAR_2)\n{", "int VAR_3;", "if (VAR_2 & URL_WRONLY) {", "VAR_3 = 1;", "} else {", "VAR_3 = 0;", "}", "#if defined(__MINGW32__) || defined(CONFIG_OS2) || defined(__CYGWIN__)\nsetmode(VAR_3, O_BINARY);", "#endif\nVAR_0->priv_data = (void *)(size_t)VAR_3;", "VAR_0->is_streamed = 1;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19, 21 ], [ 23, 25 ], [ 27 ], [ 29 ], [ 31 ] ]