id
int32
0
27.3k
func
stringlengths
26
142k
target
bool
2 classes
project
stringclasses
2 values
commit_id
stringlengths
40
40
func_clean
stringlengths
26
131k
vul_lines
dict
normalized_func
stringlengths
24
132k
lines
listlengths
1
2.8k
label
listlengths
1
2.8k
line_no
listlengths
1
2.8k
12,591
static const unsigned char *seq_decode_op1(SeqVideoContext *seq, const unsigned char *src, unsigned char *dst) { const unsigned char *color_table; int b, i, len, bits; GetBitContext gb; unsigned char block[8 * 8]; len = *src++; if (len & 0x80) { switch (len & 3) { case 1: src = seq_unpack_rle_block(src, block, sizeof(block)); for (b = 0; b < 8; b++) { memcpy(dst, &block[b * 8], 8); dst += seq->frame.linesize[0]; } break; case 2: src = seq_unpack_rle_block(src, block, sizeof(block)); for (i = 0; i < 8; i++) { for (b = 0; b < 8; b++) dst[b * seq->frame.linesize[0]] = block[i * 8 + b]; ++dst; } break; } } else { color_table = src; src += len; bits = ff_log2_tab[len - 1] + 1; init_get_bits(&gb, src, bits * 8 * 8); src += bits * 8; for (b = 0; b < 8; b++) { for (i = 0; i < 8; i++) dst[i] = color_table[get_bits(&gb, bits)]; dst += seq->frame.linesize[0]; } } return src; }
true
FFmpeg
64263dd526ec25ede1591fc1144715a20cc7bc4e
static const unsigned char *seq_decode_op1(SeqVideoContext *seq, const unsigned char *src, unsigned char *dst) { const unsigned char *color_table; int b, i, len, bits; GetBitContext gb; unsigned char block[8 * 8]; len = *src++; if (len & 0x80) { switch (len & 3) { case 1: src = seq_unpack_rle_block(src, block, sizeof(block)); for (b = 0; b < 8; b++) { memcpy(dst, &block[b * 8], 8); dst += seq->frame.linesize[0]; } break; case 2: src = seq_unpack_rle_block(src, block, sizeof(block)); for (i = 0; i < 8; i++) { for (b = 0; b < 8; b++) dst[b * seq->frame.linesize[0]] = block[i * 8 + b]; ++dst; } break; } } else { color_table = src; src += len; bits = ff_log2_tab[len - 1] + 1; init_get_bits(&gb, src, bits * 8 * 8); src += bits * 8; for (b = 0; b < 8; b++) { for (i = 0; i < 8; i++) dst[i] = color_table[get_bits(&gb, bits)]; dst += seq->frame.linesize[0]; } } return src; }
{ "code": [ "static const unsigned char *seq_decode_op1(SeqVideoContext *seq, const unsigned char *src, unsigned char *dst)", " src = seq_unpack_rle_block(src, block, sizeof(block));", " src = seq_unpack_rle_block(src, block, sizeof(block));", " bits = ff_log2_tab[len - 1] + 1;" ], "line_no": [ 1, 23, 23, 59 ] }
static const unsigned char *FUNC_0(SeqVideoContext *VAR_0, const unsigned char *VAR_1, unsigned char *VAR_2) { const unsigned char *VAR_3; int VAR_4, VAR_5, VAR_6, VAR_7; GetBitContext gb; unsigned char VAR_8[8 * 8]; VAR_6 = *VAR_1++; if (VAR_6 & 0x80) { switch (VAR_6 & 3) { case 1: VAR_1 = seq_unpack_rle_block(VAR_1, VAR_8, sizeof(VAR_8)); for (VAR_4 = 0; VAR_4 < 8; VAR_4++) { memcpy(VAR_2, &VAR_8[VAR_4 * 8], 8); VAR_2 += VAR_0->frame.linesize[0]; } break; case 2: VAR_1 = seq_unpack_rle_block(VAR_1, VAR_8, sizeof(VAR_8)); for (VAR_5 = 0; VAR_5 < 8; VAR_5++) { for (VAR_4 = 0; VAR_4 < 8; VAR_4++) VAR_2[VAR_4 * VAR_0->frame.linesize[0]] = VAR_8[VAR_5 * 8 + VAR_4]; ++VAR_2; } break; } } else { VAR_3 = VAR_1; VAR_1 += VAR_6; VAR_7 = ff_log2_tab[VAR_6 - 1] + 1; init_get_bits(&gb, VAR_1, VAR_7 * 8 * 8); VAR_1 += VAR_7 * 8; for (VAR_4 = 0; VAR_4 < 8; VAR_4++) { for (VAR_5 = 0; VAR_5 < 8; VAR_5++) VAR_2[VAR_5] = VAR_3[get_bits(&gb, VAR_7)]; VAR_2 += VAR_0->frame.linesize[0]; } } return VAR_1; }
[ "static const unsigned char *FUNC_0(SeqVideoContext *VAR_0, const unsigned char *VAR_1, unsigned char *VAR_2)\n{", "const unsigned char *VAR_3;", "int VAR_4, VAR_5, VAR_6, VAR_7;", "GetBitContext gb;", "unsigned char VAR_8[8 * 8];", "VAR_6 = *VAR_1++;", "if (VAR_6 & 0x80) {", "switch (VAR_6 & 3) {", "case 1:\nVAR_1 = seq_unpack_rle_block(VAR_1, VAR_8, sizeof(VAR_8));", "for (VAR_4 = 0; VAR_4 < 8; VAR_4++) {", "memcpy(VAR_2, &VAR_8[VAR_4 * 8], 8);", "VAR_2 += VAR_0->frame.linesize[0];", "}", "break;", "case 2:\nVAR_1 = seq_unpack_rle_block(VAR_1, VAR_8, sizeof(VAR_8));", "for (VAR_5 = 0; VAR_5 < 8; VAR_5++) {", "for (VAR_4 = 0; VAR_4 < 8; VAR_4++)", "VAR_2[VAR_4 * VAR_0->frame.linesize[0]] = VAR_8[VAR_5 * 8 + VAR_4];", "++VAR_2;", "}", "break;", "}", "} else {", "VAR_3 = VAR_1;", "VAR_1 += VAR_6;", "VAR_7 = ff_log2_tab[VAR_6 - 1] + 1;", "init_get_bits(&gb, VAR_1, VAR_7 * 8 * 8); VAR_1 += VAR_7 * 8;", "for (VAR_4 = 0; VAR_4 < 8; VAR_4++) {", "for (VAR_5 = 0; VAR_5 < 8; VAR_5++)", "VAR_2[VAR_5] = VAR_3[get_bits(&gb, VAR_7)];", "VAR_2 += VAR_0->frame.linesize[0];", "}", "}", "return VAR_1;", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21, 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35, 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 79 ] ]
12,592
static void qed_commit_l2_update(void *opaque, int ret) { QEDAIOCB *acb = opaque; BDRVQEDState *s = acb_to_s(acb); CachedL2Table *l2_table = acb->request.l2_table; qed_commit_l2_cache_entry(&s->l2_cache, l2_table); /* This is guaranteed to succeed because we just committed the entry to the * cache. */ acb->request.l2_table = qed_find_l2_cache_entry(&s->l2_cache, l2_table->offset); assert(acb->request.l2_table != NULL); qed_aio_next_io(opaque, ret); }
true
qemu
e4fc8781db7c49b0c5ac5d24762e17c59dfe0871
static void qed_commit_l2_update(void *opaque, int ret) { QEDAIOCB *acb = opaque; BDRVQEDState *s = acb_to_s(acb); CachedL2Table *l2_table = acb->request.l2_table; qed_commit_l2_cache_entry(&s->l2_cache, l2_table); acb->request.l2_table = qed_find_l2_cache_entry(&s->l2_cache, l2_table->offset); assert(acb->request.l2_table != NULL); qed_aio_next_io(opaque, ret); }
{ "code": [ " l2_table->offset);", " acb->request.l2_table = qed_find_l2_cache_entry(&s->l2_cache,", " l2_table->offset);" ], "line_no": [ 25, 23, 25 ] }
static void FUNC_0(void *VAR_0, int VAR_1) { QEDAIOCB *acb = VAR_0; BDRVQEDState *s = acb_to_s(acb); CachedL2Table *l2_table = acb->request.l2_table; qed_commit_l2_cache_entry(&s->l2_cache, l2_table); acb->request.l2_table = qed_find_l2_cache_entry(&s->l2_cache, l2_table->offset); assert(acb->request.l2_table != NULL); qed_aio_next_io(VAR_0, VAR_1); }
[ "static void FUNC_0(void *VAR_0, int VAR_1)\n{", "QEDAIOCB *acb = VAR_0;", "BDRVQEDState *s = acb_to_s(acb);", "CachedL2Table *l2_table = acb->request.l2_table;", "qed_commit_l2_cache_entry(&s->l2_cache, l2_table);", "acb->request.l2_table = qed_find_l2_cache_entry(&s->l2_cache,\nl2_table->offset);", "assert(acb->request.l2_table != NULL);", "qed_aio_next_io(VAR_0, VAR_1);", "}" ]
[ 0, 0, 0, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 23, 25 ], [ 27 ], [ 31 ], [ 33 ] ]
12,593
static void pci_qdev_unrealize(DeviceState *dev, Error **errp) { PCIDevice *pci_dev = PCI_DEVICE(dev); PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(pci_dev); pci_unregister_io_regions(pci_dev); pci_del_option_rom(pci_dev); if (pc->exit) { pc->exit(pci_dev); } do_pci_unregister_device(pci_dev); }
true
qemu
3936161f1fd72d1dfa577aaba910819c5e873260
static void pci_qdev_unrealize(DeviceState *dev, Error **errp) { PCIDevice *pci_dev = PCI_DEVICE(dev); PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(pci_dev); pci_unregister_io_regions(pci_dev); pci_del_option_rom(pci_dev); if (pc->exit) { pc->exit(pci_dev); } do_pci_unregister_device(pci_dev); }
{ "code": [], "line_no": [] }
static void FUNC_0(DeviceState *VAR_0, Error **VAR_1) { PCIDevice *pci_dev = PCI_DEVICE(VAR_0); PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(pci_dev); pci_unregister_io_regions(pci_dev); pci_del_option_rom(pci_dev); if (pc->exit) { pc->exit(pci_dev); } do_pci_unregister_device(pci_dev); }
[ "static void FUNC_0(DeviceState *VAR_0, Error **VAR_1)\n{", "PCIDevice *pci_dev = PCI_DEVICE(VAR_0);", "PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(pci_dev);", "pci_unregister_io_regions(pci_dev);", "pci_del_option_rom(pci_dev);", "if (pc->exit) {", "pc->exit(pci_dev);", "}", "do_pci_unregister_device(pci_dev);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 26 ], [ 28 ] ]
12,594
static int start_frame(AVFilterLink *link, AVFilterBufferRef *picref) { SliceContext *slice = link->dst->priv; if (slice->use_random_h) { slice->lcg_state = slice->lcg_state * 1664525 + 1013904223; slice->h = 8 + (uint64_t)slice->lcg_state * 25 / UINT32_MAX; } /* ensure that slices play nice with chroma subsampling, and enforce * a reasonable minimum size for the slices */ slice->h = FFMAX(8, slice->h & (-1 << slice->vshift)); av_log(link->dst, AV_LOG_DEBUG, "h:%d\n", slice->h); link->cur_buf = NULL; return ff_start_frame(link->dst->outputs[0], picref); }
true
FFmpeg
bb6c67bb36b136de10256f0999128df4a42f9ffc
static int start_frame(AVFilterLink *link, AVFilterBufferRef *picref) { SliceContext *slice = link->dst->priv; if (slice->use_random_h) { slice->lcg_state = slice->lcg_state * 1664525 + 1013904223; slice->h = 8 + (uint64_t)slice->lcg_state * 25 / UINT32_MAX; } slice->h = FFMAX(8, slice->h & (-1 << slice->vshift)); av_log(link->dst, AV_LOG_DEBUG, "h:%d\n", slice->h); link->cur_buf = NULL; return ff_start_frame(link->dst->outputs[0], picref); }
{ "code": [ " SliceContext *slice = link->dst->priv;", "static int start_frame(AVFilterLink *link, AVFilterBufferRef *picref)", " SliceContext *slice = link->dst->priv;", " if (slice->use_random_h) {", " slice->lcg_state = slice->lcg_state * 1664525 + 1013904223;", " slice->h = 8 + (uint64_t)slice->lcg_state * 25 / UINT32_MAX;", " slice->h = FFMAX(8, slice->h & (-1 << slice->vshift));", " av_log(link->dst, AV_LOG_DEBUG, \"h:%d\\n\", slice->h);", " link->cur_buf = NULL;", " return ff_start_frame(link->dst->outputs[0], picref);", " SliceContext *slice = link->dst->priv;" ], "line_no": [ 5, 1, 5, 9, 11, 13, 23, 27, 29, 33, 5 ] }
static int FUNC_0(AVFilterLink *VAR_0, AVFilterBufferRef *VAR_1) { SliceContext *slice = VAR_0->dst->priv; if (slice->use_random_h) { slice->lcg_state = slice->lcg_state * 1664525 + 1013904223; slice->h = 8 + (uint64_t)slice->lcg_state * 25 / UINT32_MAX; } slice->h = FFMAX(8, slice->h & (-1 << slice->vshift)); av_log(VAR_0->dst, AV_LOG_DEBUG, "h:%d\n", slice->h); VAR_0->cur_buf = NULL; return ff_start_frame(VAR_0->dst->outputs[0], VAR_1); }
[ "static int FUNC_0(AVFilterLink *VAR_0, AVFilterBufferRef *VAR_1)\n{", "SliceContext *slice = VAR_0->dst->priv;", "if (slice->use_random_h) {", "slice->lcg_state = slice->lcg_state * 1664525 + 1013904223;", "slice->h = 8 + (uint64_t)slice->lcg_state * 25 / UINT32_MAX;", "}", "slice->h = FFMAX(8, slice->h & (-1 << slice->vshift));", "av_log(VAR_0->dst, AV_LOG_DEBUG, \"h:%d\\n\", slice->h);", "VAR_0->cur_buf = NULL;", "return ff_start_frame(VAR_0->dst->outputs[0], VAR_1);", "}" ]
[ 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 23 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ] ]
12,595
static void virtio_balloon_save(QEMUFile *f, void *opaque) { VirtIOBalloon *s = opaque; virtio_save(&s->vdev, f); qemu_put_be32(f, s->num_pages); qemu_put_be32(f, s->actual); qemu_put_buffer(f, (uint8_t *)&s->stats_vq_elem, sizeof(VirtQueueElement)); qemu_put_buffer(f, (uint8_t *)&s->stats_vq_offset, sizeof(size_t)); qemu_put_buffer(f, (uint8_t *)&s->stats_callback, sizeof(MonitorCompletion)); qemu_put_buffer(f, (uint8_t *)&s->stats_opaque_callback_data, sizeof(void)); }
true
qemu
6d0ee85040e4d238e2483191fe6e74aebbecd5d5
static void virtio_balloon_save(QEMUFile *f, void *opaque) { VirtIOBalloon *s = opaque; virtio_save(&s->vdev, f); qemu_put_be32(f, s->num_pages); qemu_put_be32(f, s->actual); qemu_put_buffer(f, (uint8_t *)&s->stats_vq_elem, sizeof(VirtQueueElement)); qemu_put_buffer(f, (uint8_t *)&s->stats_vq_offset, sizeof(size_t)); qemu_put_buffer(f, (uint8_t *)&s->stats_callback, sizeof(MonitorCompletion)); qemu_put_buffer(f, (uint8_t *)&s->stats_opaque_callback_data, sizeof(void)); }
{ "code": [ " qemu_put_buffer(f, (uint8_t *)&s->stats_vq_elem, sizeof(VirtQueueElement));", " qemu_put_buffer(f, (uint8_t *)&s->stats_vq_offset, sizeof(size_t));", " qemu_put_buffer(f, (uint8_t *)&s->stats_callback, sizeof(MonitorCompletion));", " qemu_put_buffer(f, (uint8_t *)&s->stats_opaque_callback_data, sizeof(void));" ], "line_no": [ 17, 19, 21, 23 ] }
static void FUNC_0(QEMUFile *VAR_0, void *VAR_1) { VirtIOBalloon *s = VAR_1; virtio_save(&s->vdev, VAR_0); qemu_put_be32(VAR_0, s->num_pages); qemu_put_be32(VAR_0, s->actual); qemu_put_buffer(VAR_0, (uint8_t *)&s->stats_vq_elem, sizeof(VirtQueueElement)); qemu_put_buffer(VAR_0, (uint8_t *)&s->stats_vq_offset, sizeof(size_t)); qemu_put_buffer(VAR_0, (uint8_t *)&s->stats_callback, sizeof(MonitorCompletion)); qemu_put_buffer(VAR_0, (uint8_t *)&s->stats_opaque_callback_data, sizeof(void)); }
[ "static void FUNC_0(QEMUFile *VAR_0, void *VAR_1)\n{", "VirtIOBalloon *s = VAR_1;", "virtio_save(&s->vdev, VAR_0);", "qemu_put_be32(VAR_0, s->num_pages);", "qemu_put_be32(VAR_0, s->actual);", "qemu_put_buffer(VAR_0, (uint8_t *)&s->stats_vq_elem, sizeof(VirtQueueElement));", "qemu_put_buffer(VAR_0, (uint8_t *)&s->stats_vq_offset, sizeof(size_t));", "qemu_put_buffer(VAR_0, (uint8_t *)&s->stats_callback, sizeof(MonitorCompletion));", "qemu_put_buffer(VAR_0, (uint8_t *)&s->stats_opaque_callback_data, sizeof(void));", "}" ]
[ 0, 0, 0, 0, 0, 1, 1, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ] ]
12,597
static int inject_error(BlockDriverState *bs, BlkdebugRule *rule) { BDRVBlkdebugState *s = bs->opaque; int error = rule->options.inject.error; bool immediately = rule->options.inject.immediately; if (rule->options.inject.once) { QSIMPLEQ_REMOVE(&s->active_rules, rule, BlkdebugRule, active_next); remove_rule(rule); } if (!immediately) { aio_bh_schedule_oneshot(bdrv_get_aio_context(bs), error_callback_bh, qemu_coroutine_self()); qemu_coroutine_yield(); } return -error; }
true
qemu
e5c67ab552fb056827b5b40356c0ef235e975e7e
static int inject_error(BlockDriverState *bs, BlkdebugRule *rule) { BDRVBlkdebugState *s = bs->opaque; int error = rule->options.inject.error; bool immediately = rule->options.inject.immediately; if (rule->options.inject.once) { QSIMPLEQ_REMOVE(&s->active_rules, rule, BlkdebugRule, active_next); remove_rule(rule); } if (!immediately) { aio_bh_schedule_oneshot(bdrv_get_aio_context(bs), error_callback_bh, qemu_coroutine_self()); qemu_coroutine_yield(); } return -error; }
{ "code": [ " aio_bh_schedule_oneshot(bdrv_get_aio_context(bs), error_callback_bh,", " qemu_coroutine_self());" ], "line_no": [ 25, 27 ] }
static int FUNC_0(BlockDriverState *VAR_0, BlkdebugRule *VAR_1) { BDRVBlkdebugState *s = VAR_0->opaque; int VAR_2 = VAR_1->options.inject.VAR_2; bool immediately = VAR_1->options.inject.immediately; if (VAR_1->options.inject.once) { QSIMPLEQ_REMOVE(&s->active_rules, VAR_1, BlkdebugRule, active_next); remove_rule(VAR_1); } if (!immediately) { aio_bh_schedule_oneshot(bdrv_get_aio_context(VAR_0), error_callback_bh, qemu_coroutine_self()); qemu_coroutine_yield(); } return -VAR_2; }
[ "static int FUNC_0(BlockDriverState *VAR_0, BlkdebugRule *VAR_1)\n{", "BDRVBlkdebugState *s = VAR_0->opaque;", "int VAR_2 = VAR_1->options.inject.VAR_2;", "bool immediately = VAR_1->options.inject.immediately;", "if (VAR_1->options.inject.once) {", "QSIMPLEQ_REMOVE(&s->active_rules, VAR_1, BlkdebugRule, active_next);", "remove_rule(VAR_1);", "}", "if (!immediately) {", "aio_bh_schedule_oneshot(bdrv_get_aio_context(VAR_0), error_callback_bh,\nqemu_coroutine_self());", "qemu_coroutine_yield();", "}", "return -VAR_2;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ] ]
12,598
static void output_segment_list(OutputStream *os, AVIOContext *out, DASHContext *c, int representation_id, int final) { int i, start_index = 0, start_number = 1; if (c->window_size) { start_index = FFMAX(os->nb_segments - c->window_size, 0); start_number = FFMAX(os->segment_index - c->window_size, 1); } if (c->use_template) { int timescale = c->use_timeline ? os->ctx->streams[0]->time_base.den : AV_TIME_BASE; avio_printf(out, "\t\t\t\t<SegmentTemplate timescale=\"%d\" ", timescale); if (!c->use_timeline) avio_printf(out, "duration=\"%"PRId64"\" ", c->last_duration); avio_printf(out, "initialization=\"%s\" media=\"%s\" startNumber=\"%d\">\n", c->init_seg_name, c->media_seg_name, c->use_timeline ? start_number : 1); if (c->use_timeline) { int64_t cur_time = 0; avio_printf(out, "\t\t\t\t\t<SegmentTimeline>\n"); for (i = start_index; i < os->nb_segments; ) { Segment *seg = os->segments[i]; int repeat = 0; avio_printf(out, "\t\t\t\t\t\t<S "); if (i == start_index || seg->time != cur_time) { cur_time = seg->time; avio_printf(out, "t=\"%"PRId64"\" ", seg->time); } avio_printf(out, "d=\"%d\" ", seg->duration); while (i + repeat + 1 < os->nb_segments && os->segments[i + repeat + 1]->duration == seg->duration && os->segments[i + repeat + 1]->time == os->segments[i + repeat]->time + os->segments[i + repeat]->duration) repeat++; if (repeat > 0) avio_printf(out, "r=\"%d\" ", repeat); avio_printf(out, "/>\n"); i += 1 + repeat; cur_time += (1 + repeat) * seg->duration; } avio_printf(out, "\t\t\t\t\t</SegmentTimeline>\n"); } avio_printf(out, "\t\t\t\t</SegmentTemplate>\n"); } else if (c->single_file) { avio_printf(out, "\t\t\t\t<BaseURL>%s</BaseURL>\n", os->initfile); avio_printf(out, "\t\t\t\t<SegmentList timescale=\"%d\" duration=\"%"PRId64"\" startNumber=\"%d\">\n", AV_TIME_BASE, c->last_duration, start_number); avio_printf(out, "\t\t\t\t\t<Initialization range=\"%"PRId64"-%"PRId64"\" />\n", os->init_start_pos, os->init_start_pos + os->init_range_length - 1); for (i = start_index; i < os->nb_segments; i++) { Segment *seg = os->segments[i]; avio_printf(out, "\t\t\t\t\t<SegmentURL mediaRange=\"%"PRId64"-%"PRId64"\" ", seg->start_pos, seg->start_pos + seg->range_length - 1); if (seg->index_length) avio_printf(out, "indexRange=\"%"PRId64"-%"PRId64"\" ", seg->start_pos, seg->start_pos + seg->index_length - 1); avio_printf(out, "/>\n"); } avio_printf(out, "\t\t\t\t</SegmentList>\n"); } else { avio_printf(out, "\t\t\t\t<SegmentList timescale=\"%d\" duration=\"%"PRId64"\" startNumber=\"%d\">\n", AV_TIME_BASE, c->last_duration, start_number); avio_printf(out, "\t\t\t\t\t<Initialization sourceURL=\"%s\" />\n", os->initfile); for (i = start_index; i < os->nb_segments; i++) { Segment *seg = os->segments[i]; avio_printf(out, "\t\t\t\t\t<SegmentURL media=\"%s\" />\n", seg->file); } avio_printf(out, "\t\t\t\t</SegmentList>\n"); } if (c->hls_playlist && start_index < os->nb_segments) { int timescale = os->ctx->streams[0]->time_base.den; char temp_filename_hls[1024]; char filename_hls[1024]; AVIOContext *out_hls = NULL; AVDictionary *http_opts = NULL; int target_duration = 0; int ret = 0; const char *proto = avio_find_protocol_name(c->dirname); int use_rename = proto && !strcmp(proto, "file"); get_hls_playlist_name(filename_hls, sizeof(filename_hls), c->dirname, representation_id); snprintf(temp_filename_hls, sizeof(temp_filename_hls), use_rename ? "%s.tmp" : "%s", filename_hls); set_http_options(&http_opts, c); avio_open2(&out_hls, temp_filename_hls, AVIO_FLAG_WRITE, NULL, &http_opts); av_dict_free(&http_opts); for (i = start_index; i < os->nb_segments; i++) { Segment *seg = os->segments[i]; double duration = (double) seg->duration / timescale; if (target_duration <= duration) target_duration = hls_get_int_from_double(duration); } ff_hls_write_playlist_header(out_hls, 6, -1, target_duration, start_number, PLAYLIST_TYPE_NONE); ff_hls_write_init_file(out_hls, os->initfile, c->single_file, os->init_range_length, os->init_start_pos); for (i = start_index; i < os->nb_segments; i++) { Segment *seg = os->segments[i]; ret = ff_hls_write_file_entry(out_hls, 0, c->single_file, (double) seg->duration / timescale, 0, seg->range_length, seg->start_pos, NULL, c->single_file ? os->initfile : seg->file, NULL); if (ret < 0) { av_log(os->ctx, AV_LOG_WARNING, "ff_hls_write_file_entry get error\n"); } } if (final) ff_hls_write_end_list(out_hls); avio_close(out_hls); if (use_rename) avpriv_io_move(temp_filename_hls, filename_hls); } }
false
FFmpeg
1cfde7abd0008e58fcd10f8804812e72a1a5295a
static void output_segment_list(OutputStream *os, AVIOContext *out, DASHContext *c, int representation_id, int final) { int i, start_index = 0, start_number = 1; if (c->window_size) { start_index = FFMAX(os->nb_segments - c->window_size, 0); start_number = FFMAX(os->segment_index - c->window_size, 1); } if (c->use_template) { int timescale = c->use_timeline ? os->ctx->streams[0]->time_base.den : AV_TIME_BASE; avio_printf(out, "\t\t\t\t<SegmentTemplate timescale=\"%d\" ", timescale); if (!c->use_timeline) avio_printf(out, "duration=\"%"PRId64"\" ", c->last_duration); avio_printf(out, "initialization=\"%s\" media=\"%s\" startNumber=\"%d\">\n", c->init_seg_name, c->media_seg_name, c->use_timeline ? start_number : 1); if (c->use_timeline) { int64_t cur_time = 0; avio_printf(out, "\t\t\t\t\t<SegmentTimeline>\n"); for (i = start_index; i < os->nb_segments; ) { Segment *seg = os->segments[i]; int repeat = 0; avio_printf(out, "\t\t\t\t\t\t<S "); if (i == start_index || seg->time != cur_time) { cur_time = seg->time; avio_printf(out, "t=\"%"PRId64"\" ", seg->time); } avio_printf(out, "d=\"%d\" ", seg->duration); while (i + repeat + 1 < os->nb_segments && os->segments[i + repeat + 1]->duration == seg->duration && os->segments[i + repeat + 1]->time == os->segments[i + repeat]->time + os->segments[i + repeat]->duration) repeat++; if (repeat > 0) avio_printf(out, "r=\"%d\" ", repeat); avio_printf(out, "/>\n"); i += 1 + repeat; cur_time += (1 + repeat) * seg->duration; } avio_printf(out, "\t\t\t\t\t</SegmentTimeline>\n"); } avio_printf(out, "\t\t\t\t</SegmentTemplate>\n"); } else if (c->single_file) { avio_printf(out, "\t\t\t\t<BaseURL>%s</BaseURL>\n", os->initfile); avio_printf(out, "\t\t\t\t<SegmentList timescale=\"%d\" duration=\"%"PRId64"\" startNumber=\"%d\">\n", AV_TIME_BASE, c->last_duration, start_number); avio_printf(out, "\t\t\t\t\t<Initialization range=\"%"PRId64"-%"PRId64"\" />\n", os->init_start_pos, os->init_start_pos + os->init_range_length - 1); for (i = start_index; i < os->nb_segments; i++) { Segment *seg = os->segments[i]; avio_printf(out, "\t\t\t\t\t<SegmentURL mediaRange=\"%"PRId64"-%"PRId64"\" ", seg->start_pos, seg->start_pos + seg->range_length - 1); if (seg->index_length) avio_printf(out, "indexRange=\"%"PRId64"-%"PRId64"\" ", seg->start_pos, seg->start_pos + seg->index_length - 1); avio_printf(out, "/>\n"); } avio_printf(out, "\t\t\t\t</SegmentList>\n"); } else { avio_printf(out, "\t\t\t\t<SegmentList timescale=\"%d\" duration=\"%"PRId64"\" startNumber=\"%d\">\n", AV_TIME_BASE, c->last_duration, start_number); avio_printf(out, "\t\t\t\t\t<Initialization sourceURL=\"%s\" />\n", os->initfile); for (i = start_index; i < os->nb_segments; i++) { Segment *seg = os->segments[i]; avio_printf(out, "\t\t\t\t\t<SegmentURL media=\"%s\" />\n", seg->file); } avio_printf(out, "\t\t\t\t</SegmentList>\n"); } if (c->hls_playlist && start_index < os->nb_segments) { int timescale = os->ctx->streams[0]->time_base.den; char temp_filename_hls[1024]; char filename_hls[1024]; AVIOContext *out_hls = NULL; AVDictionary *http_opts = NULL; int target_duration = 0; int ret = 0; const char *proto = avio_find_protocol_name(c->dirname); int use_rename = proto && !strcmp(proto, "file"); get_hls_playlist_name(filename_hls, sizeof(filename_hls), c->dirname, representation_id); snprintf(temp_filename_hls, sizeof(temp_filename_hls), use_rename ? "%s.tmp" : "%s", filename_hls); set_http_options(&http_opts, c); avio_open2(&out_hls, temp_filename_hls, AVIO_FLAG_WRITE, NULL, &http_opts); av_dict_free(&http_opts); for (i = start_index; i < os->nb_segments; i++) { Segment *seg = os->segments[i]; double duration = (double) seg->duration / timescale; if (target_duration <= duration) target_duration = hls_get_int_from_double(duration); } ff_hls_write_playlist_header(out_hls, 6, -1, target_duration, start_number, PLAYLIST_TYPE_NONE); ff_hls_write_init_file(out_hls, os->initfile, c->single_file, os->init_range_length, os->init_start_pos); for (i = start_index; i < os->nb_segments; i++) { Segment *seg = os->segments[i]; ret = ff_hls_write_file_entry(out_hls, 0, c->single_file, (double) seg->duration / timescale, 0, seg->range_length, seg->start_pos, NULL, c->single_file ? os->initfile : seg->file, NULL); if (ret < 0) { av_log(os->ctx, AV_LOG_WARNING, "ff_hls_write_file_entry get error\n"); } } if (final) ff_hls_write_end_list(out_hls); avio_close(out_hls); if (use_rename) avpriv_io_move(temp_filename_hls, filename_hls); } }
{ "code": [], "line_no": [] }
static void FUNC_0(OutputStream *VAR_0, AVIOContext *VAR_1, DASHContext *VAR_2, int VAR_3, int VAR_4) { int VAR_5, VAR_6 = 0, VAR_7 = 1; if (VAR_2->window_size) { VAR_6 = FFMAX(VAR_0->nb_segments - VAR_2->window_size, 0); VAR_7 = FFMAX(VAR_0->segment_index - VAR_2->window_size, 1); } if (VAR_2->use_template) { int VAR_9 = VAR_2->use_timeline ? VAR_0->ctx->streams[0]->time_base.den : AV_TIME_BASE; avio_printf(VAR_1, "\t\t\t\t<SegmentTemplate VAR_9=\"%d\" ", VAR_9); if (!VAR_2->use_timeline) avio_printf(VAR_1, "duration=\"%"PRId64"\" ", VAR_2->last_duration); avio_printf(VAR_1, "initialization=\"%s\" media=\"%s\" startNumber=\"%d\">\n", VAR_2->init_seg_name, VAR_2->media_seg_name, VAR_2->use_timeline ? VAR_7 : 1); if (VAR_2->use_timeline) { int64_t cur_time = 0; avio_printf(VAR_1, "\t\t\t\t\t<SegmentTimeline>\n"); for (VAR_5 = VAR_6; VAR_5 < VAR_0->nb_segments; ) { Segment *seg = VAR_0->segments[VAR_5]; int repeat = 0; avio_printf(VAR_1, "\t\t\t\t\t\t<S "); if (VAR_5 == VAR_6 || seg->time != cur_time) { cur_time = seg->time; avio_printf(VAR_1, "t=\"%"PRId64"\" ", seg->time); } avio_printf(VAR_1, "d=\"%d\" ", seg->duration); while (VAR_5 + repeat + 1 < VAR_0->nb_segments && VAR_0->segments[VAR_5 + repeat + 1]->duration == seg->duration && VAR_0->segments[VAR_5 + repeat + 1]->time == VAR_0->segments[VAR_5 + repeat]->time + VAR_0->segments[VAR_5 + repeat]->duration) repeat++; if (repeat > 0) avio_printf(VAR_1, "r=\"%d\" ", repeat); avio_printf(VAR_1, "/>\n"); VAR_5 += 1 + repeat; cur_time += (1 + repeat) * seg->duration; } avio_printf(VAR_1, "\t\t\t\t\t</SegmentTimeline>\n"); } avio_printf(VAR_1, "\t\t\t\t</SegmentTemplate>\n"); } else if (VAR_2->single_file) { avio_printf(VAR_1, "\t\t\t\t<BaseURL>%s</BaseURL>\n", VAR_0->initfile); avio_printf(VAR_1, "\t\t\t\t<SegmentList VAR_9=\"%d\" duration=\"%"PRId64"\" startNumber=\"%d\">\n", AV_TIME_BASE, VAR_2->last_duration, VAR_7); avio_printf(VAR_1, "\t\t\t\t\t<Initialization range=\"%"PRId64"-%"PRId64"\" />\n", VAR_0->init_start_pos, VAR_0->init_start_pos + VAR_0->init_range_length - 1); for (VAR_5 = VAR_6; VAR_5 < VAR_0->nb_segments; VAR_5++) { Segment *seg = VAR_0->segments[VAR_5]; avio_printf(VAR_1, "\t\t\t\t\t<SegmentURL mediaRange=\"%"PRId64"-%"PRId64"\" ", seg->start_pos, seg->start_pos + seg->range_length - 1); if (seg->index_length) avio_printf(VAR_1, "indexRange=\"%"PRId64"-%"PRId64"\" ", seg->start_pos, seg->start_pos + seg->index_length - 1); avio_printf(VAR_1, "/>\n"); } avio_printf(VAR_1, "\t\t\t\t</SegmentList>\n"); } else { avio_printf(VAR_1, "\t\t\t\t<SegmentList VAR_9=\"%d\" duration=\"%"PRId64"\" startNumber=\"%d\">\n", AV_TIME_BASE, VAR_2->last_duration, VAR_7); avio_printf(VAR_1, "\t\t\t\t\t<Initialization sourceURL=\"%s\" />\n", VAR_0->initfile); for (VAR_5 = VAR_6; VAR_5 < VAR_0->nb_segments; VAR_5++) { Segment *seg = VAR_0->segments[VAR_5]; avio_printf(VAR_1, "\t\t\t\t\t<SegmentURL media=\"%s\" />\n", seg->file); } avio_printf(VAR_1, "\t\t\t\t</SegmentList>\n"); } if (VAR_2->hls_playlist && VAR_6 < VAR_0->nb_segments) { int VAR_9 = VAR_0->ctx->streams[0]->time_base.den; char VAR_9[1024]; char VAR_10[1024]; AVIOContext *out_hls = NULL; AVDictionary *http_opts = NULL; int VAR_11 = 0; int VAR_12 = 0; const char *VAR_13 = avio_find_protocol_name(VAR_2->dirname); int VAR_14 = VAR_13 && !strcmp(VAR_13, "file"); get_hls_playlist_name(VAR_10, sizeof(VAR_10), VAR_2->dirname, VAR_3); snprintf(VAR_9, sizeof(VAR_9), VAR_14 ? "%s.tmp" : "%s", VAR_10); set_http_options(&http_opts, VAR_2); avio_open2(&out_hls, VAR_9, AVIO_FLAG_WRITE, NULL, &http_opts); av_dict_free(&http_opts); for (VAR_5 = VAR_6; VAR_5 < VAR_0->nb_segments; VAR_5++) { Segment *seg = VAR_0->segments[VAR_5]; double duration = (double) seg->duration / VAR_9; if (VAR_11 <= duration) VAR_11 = hls_get_int_from_double(duration); } ff_hls_write_playlist_header(out_hls, 6, -1, VAR_11, VAR_7, PLAYLIST_TYPE_NONE); ff_hls_write_init_file(out_hls, VAR_0->initfile, VAR_2->single_file, VAR_0->init_range_length, VAR_0->init_start_pos); for (VAR_5 = VAR_6; VAR_5 < VAR_0->nb_segments; VAR_5++) { Segment *seg = VAR_0->segments[VAR_5]; VAR_12 = ff_hls_write_file_entry(out_hls, 0, VAR_2->single_file, (double) seg->duration / VAR_9, 0, seg->range_length, seg->start_pos, NULL, VAR_2->single_file ? VAR_0->initfile : seg->file, NULL); if (VAR_12 < 0) { av_log(VAR_0->ctx, AV_LOG_WARNING, "ff_hls_write_file_entry get error\n"); } } if (VAR_4) ff_hls_write_end_list(out_hls); avio_close(out_hls); if (VAR_14) avpriv_io_move(VAR_9, VAR_10); } }
[ "static void FUNC_0(OutputStream *VAR_0, AVIOContext *VAR_1, DASHContext *VAR_2,\nint VAR_3, int VAR_4)\n{", "int VAR_5, VAR_6 = 0, VAR_7 = 1;", "if (VAR_2->window_size) {", "VAR_6 = FFMAX(VAR_0->nb_segments - VAR_2->window_size, 0);", "VAR_7 = FFMAX(VAR_0->segment_index - VAR_2->window_size, 1);", "}", "if (VAR_2->use_template) {", "int VAR_9 = VAR_2->use_timeline ? VAR_0->ctx->streams[0]->time_base.den : AV_TIME_BASE;", "avio_printf(VAR_1, \"\\t\\t\\t\\t<SegmentTemplate VAR_9=\\\"%d\\\" \", VAR_9);", "if (!VAR_2->use_timeline)\navio_printf(VAR_1, \"duration=\\\"%\"PRId64\"\\\" \", VAR_2->last_duration);", "avio_printf(VAR_1, \"initialization=\\\"%s\\\" media=\\\"%s\\\" startNumber=\\\"%d\\\">\\n\", VAR_2->init_seg_name, VAR_2->media_seg_name, VAR_2->use_timeline ? VAR_7 : 1);", "if (VAR_2->use_timeline) {", "int64_t cur_time = 0;", "avio_printf(VAR_1, \"\\t\\t\\t\\t\\t<SegmentTimeline>\\n\");", "for (VAR_5 = VAR_6; VAR_5 < VAR_0->nb_segments; ) {", "Segment *seg = VAR_0->segments[VAR_5];", "int repeat = 0;", "avio_printf(VAR_1, \"\\t\\t\\t\\t\\t\\t<S \");", "if (VAR_5 == VAR_6 || seg->time != cur_time) {", "cur_time = seg->time;", "avio_printf(VAR_1, \"t=\\\"%\"PRId64\"\\\" \", seg->time);", "}", "avio_printf(VAR_1, \"d=\\\"%d\\\" \", seg->duration);", "while (VAR_5 + repeat + 1 < VAR_0->nb_segments &&\nVAR_0->segments[VAR_5 + repeat + 1]->duration == seg->duration &&\nVAR_0->segments[VAR_5 + repeat + 1]->time == VAR_0->segments[VAR_5 + repeat]->time + VAR_0->segments[VAR_5 + repeat]->duration)\nrepeat++;", "if (repeat > 0)\navio_printf(VAR_1, \"r=\\\"%d\\\" \", repeat);", "avio_printf(VAR_1, \"/>\\n\");", "VAR_5 += 1 + repeat;", "cur_time += (1 + repeat) * seg->duration;", "}", "avio_printf(VAR_1, \"\\t\\t\\t\\t\\t</SegmentTimeline>\\n\");", "}", "avio_printf(VAR_1, \"\\t\\t\\t\\t</SegmentTemplate>\\n\");", "} else if (VAR_2->single_file) {", "avio_printf(VAR_1, \"\\t\\t\\t\\t<BaseURL>%s</BaseURL>\\n\", VAR_0->initfile);", "avio_printf(VAR_1, \"\\t\\t\\t\\t<SegmentList VAR_9=\\\"%d\\\" duration=\\\"%\"PRId64\"\\\" startNumber=\\\"%d\\\">\\n\", AV_TIME_BASE, VAR_2->last_duration, VAR_7);", "avio_printf(VAR_1, \"\\t\\t\\t\\t\\t<Initialization range=\\\"%\"PRId64\"-%\"PRId64\"\\\" />\\n\", VAR_0->init_start_pos, VAR_0->init_start_pos + VAR_0->init_range_length - 1);", "for (VAR_5 = VAR_6; VAR_5 < VAR_0->nb_segments; VAR_5++) {", "Segment *seg = VAR_0->segments[VAR_5];", "avio_printf(VAR_1, \"\\t\\t\\t\\t\\t<SegmentURL mediaRange=\\\"%\"PRId64\"-%\"PRId64\"\\\" \", seg->start_pos, seg->start_pos + seg->range_length - 1);", "if (seg->index_length)\navio_printf(VAR_1, \"indexRange=\\\"%\"PRId64\"-%\"PRId64\"\\\" \", seg->start_pos, seg->start_pos + seg->index_length - 1);", "avio_printf(VAR_1, \"/>\\n\");", "}", "avio_printf(VAR_1, \"\\t\\t\\t\\t</SegmentList>\\n\");", "} else {", "avio_printf(VAR_1, \"\\t\\t\\t\\t<SegmentList VAR_9=\\\"%d\\\" duration=\\\"%\"PRId64\"\\\" startNumber=\\\"%d\\\">\\n\", AV_TIME_BASE, VAR_2->last_duration, VAR_7);", "avio_printf(VAR_1, \"\\t\\t\\t\\t\\t<Initialization sourceURL=\\\"%s\\\" />\\n\", VAR_0->initfile);", "for (VAR_5 = VAR_6; VAR_5 < VAR_0->nb_segments; VAR_5++) {", "Segment *seg = VAR_0->segments[VAR_5];", "avio_printf(VAR_1, \"\\t\\t\\t\\t\\t<SegmentURL media=\\\"%s\\\" />\\n\", seg->file);", "}", "avio_printf(VAR_1, \"\\t\\t\\t\\t</SegmentList>\\n\");", "}", "if (VAR_2->hls_playlist && VAR_6 < VAR_0->nb_segments)\n{", "int VAR_9 = VAR_0->ctx->streams[0]->time_base.den;", "char VAR_9[1024];", "char VAR_10[1024];", "AVIOContext *out_hls = NULL;", "AVDictionary *http_opts = NULL;", "int VAR_11 = 0;", "int VAR_12 = 0;", "const char *VAR_13 = avio_find_protocol_name(VAR_2->dirname);", "int VAR_14 = VAR_13 && !strcmp(VAR_13, \"file\");", "get_hls_playlist_name(VAR_10, sizeof(VAR_10),\nVAR_2->dirname, VAR_3);", "snprintf(VAR_9, sizeof(VAR_9), VAR_14 ? \"%s.tmp\" : \"%s\", VAR_10);", "set_http_options(&http_opts, VAR_2);", "avio_open2(&out_hls, VAR_9, AVIO_FLAG_WRITE, NULL, &http_opts);", "av_dict_free(&http_opts);", "for (VAR_5 = VAR_6; VAR_5 < VAR_0->nb_segments; VAR_5++) {", "Segment *seg = VAR_0->segments[VAR_5];", "double duration = (double) seg->duration / VAR_9;", "if (VAR_11 <= duration)\nVAR_11 = hls_get_int_from_double(duration);", "}", "ff_hls_write_playlist_header(out_hls, 6, -1, VAR_11,\nVAR_7, PLAYLIST_TYPE_NONE);", "ff_hls_write_init_file(out_hls, VAR_0->initfile, VAR_2->single_file,\nVAR_0->init_range_length, VAR_0->init_start_pos);", "for (VAR_5 = VAR_6; VAR_5 < VAR_0->nb_segments; VAR_5++) {", "Segment *seg = VAR_0->segments[VAR_5];", "VAR_12 = ff_hls_write_file_entry(out_hls, 0, VAR_2->single_file,\n(double) seg->duration / VAR_9, 0,\nseg->range_length, seg->start_pos, NULL,\nVAR_2->single_file ? VAR_0->initfile : seg->file,\nNULL);", "if (VAR_12 < 0) {", "av_log(VAR_0->ctx, AV_LOG_WARNING, \"ff_hls_write_file_entry get error\\n\");", "}", "}", "if (VAR_4)\nff_hls_write_end_list(out_hls);", "avio_close(out_hls);", "if (VAR_14)\navpriv_io_move(VAR_9, VAR_10);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55, 57, 59, 61 ], [ 63, 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95, 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123, 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 147, 149 ], [ 153 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169, 171 ], [ 173 ], [ 177, 179 ], [ 183, 185 ], [ 189 ], [ 191 ], [ 193, 195, 197, 199, 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 213, 215 ], [ 219 ], [ 221, 223 ], [ 225 ], [ 229 ] ]
12,599
static int ptx_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; const uint8_t *buf_end = avpkt->data + avpkt->size; PTXContext * const s = avctx->priv_data; AVFrame *picture = data; AVFrame * const p = &s->picture; unsigned int offset, w, h, y, stride, bytes_per_pixel; uint8_t *ptr; if (buf_end - buf < 14) return AVERROR_INVALIDDATA; offset = AV_RL16(buf); w = AV_RL16(buf+8); h = AV_RL16(buf+10); bytes_per_pixel = AV_RL16(buf+12) >> 3; if (bytes_per_pixel != 2) { av_log_ask_for_sample(avctx, "Image format is not RGB15.\n"); return -1; } avctx->pix_fmt = PIX_FMT_RGB555; if (buf_end - buf < offset) return AVERROR_INVALIDDATA; if (offset != 0x2c) av_log_ask_for_sample(avctx, "offset != 0x2c\n"); buf += offset; if (p->data[0]) avctx->release_buffer(avctx, p); if (av_image_check_size(w, h, 0, avctx)) return -1; if (w != avctx->width || h != avctx->height) avcodec_set_dimensions(avctx, w, h); if (avctx->get_buffer(avctx, p) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } p->pict_type = AV_PICTURE_TYPE_I; ptr = p->data[0]; stride = p->linesize[0]; for (y=0; y<h; y++) { if (buf_end - buf < w * bytes_per_pixel) break; #if HAVE_BIGENDIAN unsigned int x; for (x=0; x<w*bytes_per_pixel; x+=bytes_per_pixel) AV_WN16(ptr+x, AV_RL16(buf+x)); #else memcpy(ptr, buf, w*bytes_per_pixel); #endif ptr += stride; buf += w*bytes_per_pixel; } *picture = s->picture; *data_size = sizeof(AVPicture); return offset + w*h*bytes_per_pixel; }
false
FFmpeg
2b53e696c864c4ade3c38707f8595e17a998bedc
static int ptx_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; const uint8_t *buf_end = avpkt->data + avpkt->size; PTXContext * const s = avctx->priv_data; AVFrame *picture = data; AVFrame * const p = &s->picture; unsigned int offset, w, h, y, stride, bytes_per_pixel; uint8_t *ptr; if (buf_end - buf < 14) return AVERROR_INVALIDDATA; offset = AV_RL16(buf); w = AV_RL16(buf+8); h = AV_RL16(buf+10); bytes_per_pixel = AV_RL16(buf+12) >> 3; if (bytes_per_pixel != 2) { av_log_ask_for_sample(avctx, "Image format is not RGB15.\n"); return -1; } avctx->pix_fmt = PIX_FMT_RGB555; if (buf_end - buf < offset) return AVERROR_INVALIDDATA; if (offset != 0x2c) av_log_ask_for_sample(avctx, "offset != 0x2c\n"); buf += offset; if (p->data[0]) avctx->release_buffer(avctx, p); if (av_image_check_size(w, h, 0, avctx)) return -1; if (w != avctx->width || h != avctx->height) avcodec_set_dimensions(avctx, w, h); if (avctx->get_buffer(avctx, p) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } p->pict_type = AV_PICTURE_TYPE_I; ptr = p->data[0]; stride = p->linesize[0]; for (y=0; y<h; y++) { if (buf_end - buf < w * bytes_per_pixel) break; #if HAVE_BIGENDIAN unsigned int x; for (x=0; x<w*bytes_per_pixel; x+=bytes_per_pixel) AV_WN16(ptr+x, AV_RL16(buf+x)); #else memcpy(ptr, buf, w*bytes_per_pixel); #endif ptr += stride; buf += w*bytes_per_pixel; } *picture = s->picture; *data_size = sizeof(AVPicture); return offset + w*h*bytes_per_pixel; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3) { const uint8_t *VAR_4 = VAR_3->VAR_1; const uint8_t *VAR_5 = VAR_3->VAR_1 + VAR_3->size; PTXContext * const s = VAR_0->priv_data; AVFrame *picture = VAR_1; AVFrame * const p = &s->picture; unsigned int VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_11; uint8_t *ptr; if (VAR_5 - VAR_4 < 14) return AVERROR_INVALIDDATA; VAR_6 = AV_RL16(VAR_4); VAR_7 = AV_RL16(VAR_4+8); VAR_8 = AV_RL16(VAR_4+10); VAR_11 = AV_RL16(VAR_4+12) >> 3; if (VAR_11 != 2) { av_log_ask_for_sample(VAR_0, "Image format is not RGB15.\n"); return -1; } VAR_0->pix_fmt = PIX_FMT_RGB555; if (VAR_5 - VAR_4 < VAR_6) return AVERROR_INVALIDDATA; if (VAR_6 != 0x2c) av_log_ask_for_sample(VAR_0, "VAR_6 != 0x2c\n"); VAR_4 += VAR_6; if (p->VAR_1[0]) VAR_0->release_buffer(VAR_0, p); if (av_image_check_size(VAR_7, VAR_8, 0, VAR_0)) return -1; if (VAR_7 != VAR_0->width || VAR_8 != VAR_0->height) avcodec_set_dimensions(VAR_0, VAR_7, VAR_8); if (VAR_0->get_buffer(VAR_0, p) < 0) { av_log(VAR_0, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } p->pict_type = AV_PICTURE_TYPE_I; ptr = p->VAR_1[0]; VAR_10 = p->linesize[0]; for (VAR_9=0; VAR_9<VAR_8; VAR_9++) { if (VAR_5 - VAR_4 < VAR_7 * VAR_11) break; #if HAVE_BIGENDIAN unsigned int x; for (x=0; x<VAR_7*VAR_11; x+=VAR_11) AV_WN16(ptr+x, AV_RL16(VAR_4+x)); #else memcpy(ptr, VAR_4, VAR_7*VAR_11); #endif ptr += VAR_10; VAR_4 += VAR_7*VAR_11; } *picture = s->picture; *VAR_2 = sizeof(AVPicture); return VAR_6 + VAR_7*VAR_8*VAR_11; }
[ "static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2,\nAVPacket *VAR_3) {", "const uint8_t *VAR_4 = VAR_3->VAR_1;", "const uint8_t *VAR_5 = VAR_3->VAR_1 + VAR_3->size;", "PTXContext * const s = VAR_0->priv_data;", "AVFrame *picture = VAR_1;", "AVFrame * const p = &s->picture;", "unsigned int VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_11;", "uint8_t *ptr;", "if (VAR_5 - VAR_4 < 14)\nreturn AVERROR_INVALIDDATA;", "VAR_6 = AV_RL16(VAR_4);", "VAR_7 = AV_RL16(VAR_4+8);", "VAR_8 = AV_RL16(VAR_4+10);", "VAR_11 = AV_RL16(VAR_4+12) >> 3;", "if (VAR_11 != 2) {", "av_log_ask_for_sample(VAR_0, \"Image format is not RGB15.\\n\");", "return -1;", "}", "VAR_0->pix_fmt = PIX_FMT_RGB555;", "if (VAR_5 - VAR_4 < VAR_6)\nreturn AVERROR_INVALIDDATA;", "if (VAR_6 != 0x2c)\nav_log_ask_for_sample(VAR_0, \"VAR_6 != 0x2c\\n\");", "VAR_4 += VAR_6;", "if (p->VAR_1[0])\nVAR_0->release_buffer(VAR_0, p);", "if (av_image_check_size(VAR_7, VAR_8, 0, VAR_0))\nreturn -1;", "if (VAR_7 != VAR_0->width || VAR_8 != VAR_0->height)\navcodec_set_dimensions(VAR_0, VAR_7, VAR_8);", "if (VAR_0->get_buffer(VAR_0, p) < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"get_buffer() failed\\n\");", "return -1;", "}", "p->pict_type = AV_PICTURE_TYPE_I;", "ptr = p->VAR_1[0];", "VAR_10 = p->linesize[0];", "for (VAR_9=0; VAR_9<VAR_8; VAR_9++) {", "if (VAR_5 - VAR_4 < VAR_7 * VAR_11)\nbreak;", "#if HAVE_BIGENDIAN\nunsigned int x;", "for (x=0; x<VAR_7*VAR_11; x+=VAR_11)", "AV_WN16(ptr+x, AV_RL16(VAR_4+x));", "#else\nmemcpy(ptr, VAR_4, VAR_7*VAR_11);", "#endif\nptr += VAR_10;", "VAR_4 += VAR_7*VAR_11;", "}", "*picture = s->picture;", "*VAR_2 = sizeof(AVPicture);", "return VAR_6 + VAR_7*VAR_8*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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21, 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 49, 51 ], [ 53, 55 ], [ 59 ], [ 63, 65 ], [ 69, 71 ], [ 73, 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 87 ], [ 91 ], [ 93 ], [ 97 ], [ 99, 101 ], [ 103, 105 ], [ 107 ], [ 109 ], [ 111, 113 ], [ 115, 117 ], [ 119 ], [ 121 ], [ 125 ], [ 127 ], [ 131 ], [ 133 ] ]
12,600
static int alloc_sequence_buffers(DiracContext *s) { int sbwidth = DIVRNDUP(s->source.width, 4); int sbheight = DIVRNDUP(s->source.height, 4); int i, w, h, top_padding; /* todo: think more about this / use or set Plane here */ for (i = 0; i < 3; i++) { int max_xblen = MAX_BLOCKSIZE >> (i ? s->chroma_x_shift : 0); int max_yblen = MAX_BLOCKSIZE >> (i ? s->chroma_y_shift : 0); w = s->source.width >> (i ? s->chroma_x_shift : 0); h = s->source.height >> (i ? s->chroma_y_shift : 0); /* we allocate the max we support here since num decompositions can * change from frame to frame. Stride is aligned to 16 for SIMD, and * 1<<MAX_DWT_LEVELS top padding to avoid if(y>0) in arith decoding * MAX_BLOCKSIZE padding for MC: blocks can spill up to half of that * on each side */ top_padding = FFMAX(1<<MAX_DWT_LEVELS, max_yblen/2); w = FFALIGN(CALC_PADDING(w, MAX_DWT_LEVELS), 8); /* FIXME: Should this be 16 for SSE??? */ h = top_padding + CALC_PADDING(h, MAX_DWT_LEVELS) + max_yblen/2; s->plane[i].idwt_buf_base = av_mallocz_array((w+max_xblen), h * sizeof(IDWTELEM)); s->plane[i].idwt_tmp = av_malloc_array((w+16), sizeof(IDWTELEM)); s->plane[i].idwt_buf = s->plane[i].idwt_buf_base + top_padding*w; if (!s->plane[i].idwt_buf_base || !s->plane[i].idwt_tmp) return AVERROR(ENOMEM); } w = s->source.width; h = s->source.height; /* fixme: allocate using real stride here */ s->sbsplit = av_malloc_array(sbwidth, sbheight); s->blmotion = av_malloc_array(sbwidth, sbheight * 16 * sizeof(*s->blmotion)); s->edge_emu_buffer_base = av_malloc_array((w+64), MAX_BLOCKSIZE); s->mctmp = av_malloc_array((w+64+MAX_BLOCKSIZE), (h+MAX_BLOCKSIZE) * sizeof(*s->mctmp)); s->mcscratch = av_malloc_array((w+64), MAX_BLOCKSIZE); if (!s->sbsplit || !s->blmotion || !s->mctmp || !s->mcscratch) return AVERROR(ENOMEM); return 0; }
false
FFmpeg
4a30f08505a4e85718896ff233c97be41a9754ca
static int alloc_sequence_buffers(DiracContext *s) { int sbwidth = DIVRNDUP(s->source.width, 4); int sbheight = DIVRNDUP(s->source.height, 4); int i, w, h, top_padding; for (i = 0; i < 3; i++) { int max_xblen = MAX_BLOCKSIZE >> (i ? s->chroma_x_shift : 0); int max_yblen = MAX_BLOCKSIZE >> (i ? s->chroma_y_shift : 0); w = s->source.width >> (i ? s->chroma_x_shift : 0); h = s->source.height >> (i ? s->chroma_y_shift : 0); top_padding = FFMAX(1<<MAX_DWT_LEVELS, max_yblen/2); w = FFALIGN(CALC_PADDING(w, MAX_DWT_LEVELS), 8); h = top_padding + CALC_PADDING(h, MAX_DWT_LEVELS) + max_yblen/2; s->plane[i].idwt_buf_base = av_mallocz_array((w+max_xblen), h * sizeof(IDWTELEM)); s->plane[i].idwt_tmp = av_malloc_array((w+16), sizeof(IDWTELEM)); s->plane[i].idwt_buf = s->plane[i].idwt_buf_base + top_padding*w; if (!s->plane[i].idwt_buf_base || !s->plane[i].idwt_tmp) return AVERROR(ENOMEM); } w = s->source.width; h = s->source.height; s->sbsplit = av_malloc_array(sbwidth, sbheight); s->blmotion = av_malloc_array(sbwidth, sbheight * 16 * sizeof(*s->blmotion)); s->edge_emu_buffer_base = av_malloc_array((w+64), MAX_BLOCKSIZE); s->mctmp = av_malloc_array((w+64+MAX_BLOCKSIZE), (h+MAX_BLOCKSIZE) * sizeof(*s->mctmp)); s->mcscratch = av_malloc_array((w+64), MAX_BLOCKSIZE); if (!s->sbsplit || !s->blmotion || !s->mctmp || !s->mcscratch) return AVERROR(ENOMEM); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(DiracContext *VAR_0) { int VAR_1 = DIVRNDUP(VAR_0->source.width, 4); int VAR_2 = DIVRNDUP(VAR_0->source.height, 4); int VAR_3, VAR_4, VAR_5, VAR_6; for (VAR_3 = 0; VAR_3 < 3; VAR_3++) { int VAR_7 = MAX_BLOCKSIZE >> (VAR_3 ? VAR_0->chroma_x_shift : 0); int VAR_8 = MAX_BLOCKSIZE >> (VAR_3 ? VAR_0->chroma_y_shift : 0); VAR_4 = VAR_0->source.width >> (VAR_3 ? VAR_0->chroma_x_shift : 0); VAR_5 = VAR_0->source.height >> (VAR_3 ? VAR_0->chroma_y_shift : 0); VAR_6 = FFMAX(1<<MAX_DWT_LEVELS, VAR_8/2); VAR_4 = FFALIGN(CALC_PADDING(VAR_4, MAX_DWT_LEVELS), 8); VAR_5 = VAR_6 + CALC_PADDING(VAR_5, MAX_DWT_LEVELS) + VAR_8/2; VAR_0->plane[VAR_3].idwt_buf_base = av_mallocz_array((VAR_4+VAR_7), VAR_5 * sizeof(IDWTELEM)); VAR_0->plane[VAR_3].idwt_tmp = av_malloc_array((VAR_4+16), sizeof(IDWTELEM)); VAR_0->plane[VAR_3].idwt_buf = VAR_0->plane[VAR_3].idwt_buf_base + VAR_6*VAR_4; if (!VAR_0->plane[VAR_3].idwt_buf_base || !VAR_0->plane[VAR_3].idwt_tmp) return AVERROR(ENOMEM); } VAR_4 = VAR_0->source.width; VAR_5 = VAR_0->source.height; VAR_0->sbsplit = av_malloc_array(VAR_1, VAR_2); VAR_0->blmotion = av_malloc_array(VAR_1, VAR_2 * 16 * sizeof(*VAR_0->blmotion)); VAR_0->edge_emu_buffer_base = av_malloc_array((VAR_4+64), MAX_BLOCKSIZE); VAR_0->mctmp = av_malloc_array((VAR_4+64+MAX_BLOCKSIZE), (VAR_5+MAX_BLOCKSIZE) * sizeof(*VAR_0->mctmp)); VAR_0->mcscratch = av_malloc_array((VAR_4+64), MAX_BLOCKSIZE); if (!VAR_0->sbsplit || !VAR_0->blmotion || !VAR_0->mctmp || !VAR_0->mcscratch) return AVERROR(ENOMEM); return 0; }
[ "static int FUNC_0(DiracContext *VAR_0)\n{", "int VAR_1 = DIVRNDUP(VAR_0->source.width, 4);", "int VAR_2 = DIVRNDUP(VAR_0->source.height, 4);", "int VAR_3, VAR_4, VAR_5, VAR_6;", "for (VAR_3 = 0; VAR_3 < 3; VAR_3++) {", "int VAR_7 = MAX_BLOCKSIZE >> (VAR_3 ? VAR_0->chroma_x_shift : 0);", "int VAR_8 = MAX_BLOCKSIZE >> (VAR_3 ? VAR_0->chroma_y_shift : 0);", "VAR_4 = VAR_0->source.width >> (VAR_3 ? VAR_0->chroma_x_shift : 0);", "VAR_5 = VAR_0->source.height >> (VAR_3 ? VAR_0->chroma_y_shift : 0);", "VAR_6 = FFMAX(1<<MAX_DWT_LEVELS, VAR_8/2);", "VAR_4 = FFALIGN(CALC_PADDING(VAR_4, MAX_DWT_LEVELS), 8);", "VAR_5 = VAR_6 + CALC_PADDING(VAR_5, MAX_DWT_LEVELS) + VAR_8/2;", "VAR_0->plane[VAR_3].idwt_buf_base = av_mallocz_array((VAR_4+VAR_7), VAR_5 * sizeof(IDWTELEM));", "VAR_0->plane[VAR_3].idwt_tmp = av_malloc_array((VAR_4+16), sizeof(IDWTELEM));", "VAR_0->plane[VAR_3].idwt_buf = VAR_0->plane[VAR_3].idwt_buf_base + VAR_6*VAR_4;", "if (!VAR_0->plane[VAR_3].idwt_buf_base || !VAR_0->plane[VAR_3].idwt_tmp)\nreturn AVERROR(ENOMEM);", "}", "VAR_4 = VAR_0->source.width;", "VAR_5 = VAR_0->source.height;", "VAR_0->sbsplit = av_malloc_array(VAR_1, VAR_2);", "VAR_0->blmotion = av_malloc_array(VAR_1, VAR_2 * 16 * sizeof(*VAR_0->blmotion));", "VAR_0->edge_emu_buffer_base = av_malloc_array((VAR_4+64), MAX_BLOCKSIZE);", "VAR_0->mctmp = av_malloc_array((VAR_4+64+MAX_BLOCKSIZE), (VAR_5+MAX_BLOCKSIZE) * sizeof(*VAR_0->mctmp));", "VAR_0->mcscratch = av_malloc_array((VAR_4+64), MAX_BLOCKSIZE);", "if (!VAR_0->sbsplit || !VAR_0->blmotion || !VAR_0->mctmp || !VAR_0->mcscratch)\nreturn AVERROR(ENOMEM);", "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 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51, 53 ], [ 55 ], [ 59 ], [ 61 ], [ 67 ], [ 69 ], [ 71 ], [ 75 ], [ 77 ], [ 81, 83 ], [ 85 ], [ 87 ] ]
12,601
static av_cold int vpx_init(AVCodecContext *avctx, const struct vpx_codec_iface *iface) { VP8Context *ctx = avctx->priv_data; struct vpx_codec_enc_cfg enccfg = { 0 }; int res; av_log(avctx, AV_LOG_INFO, "%s\n", vpx_codec_version_str()); av_log(avctx, AV_LOG_VERBOSE, "%s\n", vpx_codec_build_config()); if ((res = vpx_codec_enc_config_default(iface, &enccfg, 0)) != VPX_CODEC_OK) { av_log(avctx, AV_LOG_ERROR, "Failed to get config: %s\n", vpx_codec_err_to_string(res)); return AVERROR(EINVAL); } dump_enc_cfg(avctx, &enccfg); enccfg.g_w = avctx->width; enccfg.g_h = avctx->height; enccfg.g_timebase.num = avctx->time_base.num; enccfg.g_timebase.den = avctx->time_base.den; enccfg.g_threads = avctx->thread_count; if (ctx->lag_in_frames >= 0) enccfg.g_lag_in_frames = ctx->lag_in_frames; if (avctx->flags & CODEC_FLAG_PASS1) enccfg.g_pass = VPX_RC_FIRST_PASS; else if (avctx->flags & CODEC_FLAG_PASS2) enccfg.g_pass = VPX_RC_LAST_PASS; else enccfg.g_pass = VPX_RC_ONE_PASS; if (!avctx->bit_rate) avctx->bit_rate = enccfg.rc_target_bitrate * 1000; else enccfg.rc_target_bitrate = av_rescale_rnd(avctx->bit_rate, 1, 1000, AV_ROUND_NEAR_INF); if (ctx->crf) enccfg.rc_end_usage = VPX_CQ; else if (avctx->rc_min_rate == avctx->rc_max_rate && avctx->rc_min_rate == avctx->bit_rate) enccfg.rc_end_usage = VPX_CBR; if (avctx->qmin > 0) enccfg.rc_min_quantizer = avctx->qmin; if (avctx->qmax > 0) enccfg.rc_max_quantizer = avctx->qmax; enccfg.rc_dropframe_thresh = avctx->frame_skip_threshold; //0-100 (0 => CBR, 100 => VBR) enccfg.rc_2pass_vbr_bias_pct = round(avctx->qcompress * 100); enccfg.rc_2pass_vbr_minsection_pct = avctx->rc_min_rate * 100LL / avctx->bit_rate; if (avctx->rc_max_rate) enccfg.rc_2pass_vbr_maxsection_pct = avctx->rc_max_rate * 100LL / avctx->bit_rate; if (avctx->rc_buffer_size) enccfg.rc_buf_sz = avctx->rc_buffer_size * 1000LL / avctx->bit_rate; if (avctx->rc_initial_buffer_occupancy) enccfg.rc_buf_initial_sz = avctx->rc_initial_buffer_occupancy * 1000LL / avctx->bit_rate; enccfg.rc_buf_optimal_sz = enccfg.rc_buf_sz * 5 / 6; //_enc_init() will balk if kf_min_dist differs from max w/VPX_KF_AUTO if (avctx->keyint_min >= 0 && avctx->keyint_min == avctx->gop_size) enccfg.kf_min_dist = avctx->keyint_min; if (avctx->gop_size >= 0) enccfg.kf_max_dist = avctx->gop_size; if (enccfg.g_pass == VPX_RC_FIRST_PASS) enccfg.g_lag_in_frames = 0; else if (enccfg.g_pass == VPX_RC_LAST_PASS) { int decode_size, ret; if (!avctx->stats_in) { av_log(avctx, AV_LOG_ERROR, "No stats file for second pass\n"); return AVERROR_INVALIDDATA; } ctx->twopass_stats.sz = strlen(avctx->stats_in) * 3 / 4; ret = av_reallocp(&ctx->twopass_stats.buf, ctx->twopass_stats.sz); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, "Stat buffer alloc (%zu bytes) failed\n", ctx->twopass_stats.sz); return ret; } decode_size = av_base64_decode(ctx->twopass_stats.buf, avctx->stats_in, ctx->twopass_stats.sz); if (decode_size < 0) { av_log(avctx, AV_LOG_ERROR, "Stat buffer decode failed\n"); return AVERROR_INVALIDDATA; } ctx->twopass_stats.sz = decode_size; enccfg.rc_twopass_stats_in = ctx->twopass_stats; } /* 0-3: For non-zero values the encoder increasingly optimizes for reduced complexity playback on low powered devices at the expense of encode quality. */ if (avctx->profile != FF_PROFILE_UNKNOWN) enccfg.g_profile = avctx->profile; else if (avctx->pix_fmt == AV_PIX_FMT_YUV420P) avctx->profile = enccfg.g_profile = FF_PROFILE_VP9_0; else avctx->profile = enccfg.g_profile = FF_PROFILE_VP9_1; enccfg.g_error_resilient = ctx->error_resilient; dump_enc_cfg(avctx, &enccfg); /* Construct Encoder Context */ res = vpx_codec_enc_init(&ctx->encoder, iface, &enccfg, 0); if (res != VPX_CODEC_OK) { log_encoder_error(avctx, "Failed to initialize encoder"); return AVERROR(EINVAL); } //codec control failures are currently treated only as warnings av_log(avctx, AV_LOG_DEBUG, "vpx_codec_control\n"); if (ctx->cpu_used != INT_MIN) codecctl_int(avctx, VP8E_SET_CPUUSED, ctx->cpu_used); if (ctx->auto_alt_ref >= 0) codecctl_int(avctx, VP8E_SET_ENABLEAUTOALTREF, ctx->auto_alt_ref); if (ctx->arnr_max_frames >= 0) codecctl_int(avctx, VP8E_SET_ARNR_MAXFRAMES, ctx->arnr_max_frames); if (ctx->arnr_strength >= 0) codecctl_int(avctx, VP8E_SET_ARNR_STRENGTH, ctx->arnr_strength); if (ctx->arnr_type >= 0) codecctl_int(avctx, VP8E_SET_ARNR_TYPE, ctx->arnr_type); if (CONFIG_LIBVPX_VP8_ENCODER && iface == &vpx_codec_vp8_cx_algo) { codecctl_int(avctx, VP8E_SET_NOISE_SENSITIVITY, avctx->noise_reduction); codecctl_int(avctx, VP8E_SET_TOKEN_PARTITIONS, av_log2(avctx->slices)); } #if FF_API_MPV_OPT FF_DISABLE_DEPRECATION_WARNINGS if (avctx->mb_threshold) { av_log(avctx, AV_LOG_WARNING, "The mb_threshold option is deprecated, " "use the static-thresh private option instead.\n"); ctx->static_thresh = avctx->mb_threshold; } FF_ENABLE_DEPRECATION_WARNINGS #endif codecctl_int(avctx, VP8E_SET_STATIC_THRESHOLD, ctx->static_thresh); codecctl_int(avctx, VP8E_SET_CQ_LEVEL, ctx->crf); //provide dummy value to initialize wrapper, values will be updated each _encode() vpx_img_wrap(&ctx->rawimg, ff_vpx_pixfmt_to_imgfmt(avctx->pix_fmt), avctx->width, avctx->height, 1, (unsigned char *)1); avctx->coded_frame = av_frame_alloc(); if (!avctx->coded_frame) { av_log(avctx, AV_LOG_ERROR, "Error allocating coded frame\n"); vp8_free(avctx); return AVERROR(ENOMEM); } return 0; }
false
FFmpeg
d6604b29ef544793479d7fb4e05ef6622bb3e534
static av_cold int vpx_init(AVCodecContext *avctx, const struct vpx_codec_iface *iface) { VP8Context *ctx = avctx->priv_data; struct vpx_codec_enc_cfg enccfg = { 0 }; int res; av_log(avctx, AV_LOG_INFO, "%s\n", vpx_codec_version_str()); av_log(avctx, AV_LOG_VERBOSE, "%s\n", vpx_codec_build_config()); if ((res = vpx_codec_enc_config_default(iface, &enccfg, 0)) != VPX_CODEC_OK) { av_log(avctx, AV_LOG_ERROR, "Failed to get config: %s\n", vpx_codec_err_to_string(res)); return AVERROR(EINVAL); } dump_enc_cfg(avctx, &enccfg); enccfg.g_w = avctx->width; enccfg.g_h = avctx->height; enccfg.g_timebase.num = avctx->time_base.num; enccfg.g_timebase.den = avctx->time_base.den; enccfg.g_threads = avctx->thread_count; if (ctx->lag_in_frames >= 0) enccfg.g_lag_in_frames = ctx->lag_in_frames; if (avctx->flags & CODEC_FLAG_PASS1) enccfg.g_pass = VPX_RC_FIRST_PASS; else if (avctx->flags & CODEC_FLAG_PASS2) enccfg.g_pass = VPX_RC_LAST_PASS; else enccfg.g_pass = VPX_RC_ONE_PASS; if (!avctx->bit_rate) avctx->bit_rate = enccfg.rc_target_bitrate * 1000; else enccfg.rc_target_bitrate = av_rescale_rnd(avctx->bit_rate, 1, 1000, AV_ROUND_NEAR_INF); if (ctx->crf) enccfg.rc_end_usage = VPX_CQ; else if (avctx->rc_min_rate == avctx->rc_max_rate && avctx->rc_min_rate == avctx->bit_rate) enccfg.rc_end_usage = VPX_CBR; if (avctx->qmin > 0) enccfg.rc_min_quantizer = avctx->qmin; if (avctx->qmax > 0) enccfg.rc_max_quantizer = avctx->qmax; enccfg.rc_dropframe_thresh = avctx->frame_skip_threshold; enccfg.rc_2pass_vbr_bias_pct = round(avctx->qcompress * 100); enccfg.rc_2pass_vbr_minsection_pct = avctx->rc_min_rate * 100LL / avctx->bit_rate; if (avctx->rc_max_rate) enccfg.rc_2pass_vbr_maxsection_pct = avctx->rc_max_rate * 100LL / avctx->bit_rate; if (avctx->rc_buffer_size) enccfg.rc_buf_sz = avctx->rc_buffer_size * 1000LL / avctx->bit_rate; if (avctx->rc_initial_buffer_occupancy) enccfg.rc_buf_initial_sz = avctx->rc_initial_buffer_occupancy * 1000LL / avctx->bit_rate; enccfg.rc_buf_optimal_sz = enccfg.rc_buf_sz * 5 / 6; if (avctx->keyint_min >= 0 && avctx->keyint_min == avctx->gop_size) enccfg.kf_min_dist = avctx->keyint_min; if (avctx->gop_size >= 0) enccfg.kf_max_dist = avctx->gop_size; if (enccfg.g_pass == VPX_RC_FIRST_PASS) enccfg.g_lag_in_frames = 0; else if (enccfg.g_pass == VPX_RC_LAST_PASS) { int decode_size, ret; if (!avctx->stats_in) { av_log(avctx, AV_LOG_ERROR, "No stats file for second pass\n"); return AVERROR_INVALIDDATA; } ctx->twopass_stats.sz = strlen(avctx->stats_in) * 3 / 4; ret = av_reallocp(&ctx->twopass_stats.buf, ctx->twopass_stats.sz); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, "Stat buffer alloc (%zu bytes) failed\n", ctx->twopass_stats.sz); return ret; } decode_size = av_base64_decode(ctx->twopass_stats.buf, avctx->stats_in, ctx->twopass_stats.sz); if (decode_size < 0) { av_log(avctx, AV_LOG_ERROR, "Stat buffer decode failed\n"); return AVERROR_INVALIDDATA; } ctx->twopass_stats.sz = decode_size; enccfg.rc_twopass_stats_in = ctx->twopass_stats; } if (avctx->profile != FF_PROFILE_UNKNOWN) enccfg.g_profile = avctx->profile; else if (avctx->pix_fmt == AV_PIX_FMT_YUV420P) avctx->profile = enccfg.g_profile = FF_PROFILE_VP9_0; else avctx->profile = enccfg.g_profile = FF_PROFILE_VP9_1; enccfg.g_error_resilient = ctx->error_resilient; dump_enc_cfg(avctx, &enccfg); res = vpx_codec_enc_init(&ctx->encoder, iface, &enccfg, 0); if (res != VPX_CODEC_OK) { log_encoder_error(avctx, "Failed to initialize encoder"); return AVERROR(EINVAL); } av_log(avctx, AV_LOG_DEBUG, "vpx_codec_control\n"); if (ctx->cpu_used != INT_MIN) codecctl_int(avctx, VP8E_SET_CPUUSED, ctx->cpu_used); if (ctx->auto_alt_ref >= 0) codecctl_int(avctx, VP8E_SET_ENABLEAUTOALTREF, ctx->auto_alt_ref); if (ctx->arnr_max_frames >= 0) codecctl_int(avctx, VP8E_SET_ARNR_MAXFRAMES, ctx->arnr_max_frames); if (ctx->arnr_strength >= 0) codecctl_int(avctx, VP8E_SET_ARNR_STRENGTH, ctx->arnr_strength); if (ctx->arnr_type >= 0) codecctl_int(avctx, VP8E_SET_ARNR_TYPE, ctx->arnr_type); if (CONFIG_LIBVPX_VP8_ENCODER && iface == &vpx_codec_vp8_cx_algo) { codecctl_int(avctx, VP8E_SET_NOISE_SENSITIVITY, avctx->noise_reduction); codecctl_int(avctx, VP8E_SET_TOKEN_PARTITIONS, av_log2(avctx->slices)); } #if FF_API_MPV_OPT FF_DISABLE_DEPRECATION_WARNINGS if (avctx->mb_threshold) { av_log(avctx, AV_LOG_WARNING, "The mb_threshold option is deprecated, " "use the static-thresh private option instead.\n"); ctx->static_thresh = avctx->mb_threshold; } FF_ENABLE_DEPRECATION_WARNINGS #endif codecctl_int(avctx, VP8E_SET_STATIC_THRESHOLD, ctx->static_thresh); codecctl_int(avctx, VP8E_SET_CQ_LEVEL, ctx->crf); vpx_img_wrap(&ctx->rawimg, ff_vpx_pixfmt_to_imgfmt(avctx->pix_fmt), avctx->width, avctx->height, 1, (unsigned char *)1); avctx->coded_frame = av_frame_alloc(); if (!avctx->coded_frame) { av_log(avctx, AV_LOG_ERROR, "Error allocating coded frame\n"); vp8_free(avctx); return AVERROR(ENOMEM); } return 0; }
{ "code": [], "line_no": [] }
static av_cold int FUNC_0(AVCodecContext *avctx, const struct vpx_codec_iface *iface) { VP8Context *ctx = avctx->priv_data; struct vpx_codec_enc_cfg VAR_0 = { 0 }; int VAR_1; av_log(avctx, AV_LOG_INFO, "%s\n", vpx_codec_version_str()); av_log(avctx, AV_LOG_VERBOSE, "%s\n", vpx_codec_build_config()); if ((VAR_1 = vpx_codec_enc_config_default(iface, &VAR_0, 0)) != VPX_CODEC_OK) { av_log(avctx, AV_LOG_ERROR, "Failed to get config: %s\n", vpx_codec_err_to_string(VAR_1)); return AVERROR(EINVAL); } dump_enc_cfg(avctx, &VAR_0); VAR_0.g_w = avctx->width; VAR_0.g_h = avctx->height; VAR_0.g_timebase.num = avctx->time_base.num; VAR_0.g_timebase.den = avctx->time_base.den; VAR_0.g_threads = avctx->thread_count; if (ctx->lag_in_frames >= 0) VAR_0.g_lag_in_frames = ctx->lag_in_frames; if (avctx->flags & CODEC_FLAG_PASS1) VAR_0.g_pass = VPX_RC_FIRST_PASS; else if (avctx->flags & CODEC_FLAG_PASS2) VAR_0.g_pass = VPX_RC_LAST_PASS; else VAR_0.g_pass = VPX_RC_ONE_PASS; if (!avctx->bit_rate) avctx->bit_rate = VAR_0.rc_target_bitrate * 1000; else VAR_0.rc_target_bitrate = av_rescale_rnd(avctx->bit_rate, 1, 1000, AV_ROUND_NEAR_INF); if (ctx->crf) VAR_0.rc_end_usage = VPX_CQ; else if (avctx->rc_min_rate == avctx->rc_max_rate && avctx->rc_min_rate == avctx->bit_rate) VAR_0.rc_end_usage = VPX_CBR; if (avctx->qmin > 0) VAR_0.rc_min_quantizer = avctx->qmin; if (avctx->qmax > 0) VAR_0.rc_max_quantizer = avctx->qmax; VAR_0.rc_dropframe_thresh = avctx->frame_skip_threshold; VAR_0.rc_2pass_vbr_bias_pct = round(avctx->qcompress * 100); VAR_0.rc_2pass_vbr_minsection_pct = avctx->rc_min_rate * 100LL / avctx->bit_rate; if (avctx->rc_max_rate) VAR_0.rc_2pass_vbr_maxsection_pct = avctx->rc_max_rate * 100LL / avctx->bit_rate; if (avctx->rc_buffer_size) VAR_0.rc_buf_sz = avctx->rc_buffer_size * 1000LL / avctx->bit_rate; if (avctx->rc_initial_buffer_occupancy) VAR_0.rc_buf_initial_sz = avctx->rc_initial_buffer_occupancy * 1000LL / avctx->bit_rate; VAR_0.rc_buf_optimal_sz = VAR_0.rc_buf_sz * 5 / 6; if (avctx->keyint_min >= 0 && avctx->keyint_min == avctx->gop_size) VAR_0.kf_min_dist = avctx->keyint_min; if (avctx->gop_size >= 0) VAR_0.kf_max_dist = avctx->gop_size; if (VAR_0.g_pass == VPX_RC_FIRST_PASS) VAR_0.g_lag_in_frames = 0; else if (VAR_0.g_pass == VPX_RC_LAST_PASS) { int VAR_2, VAR_3; if (!avctx->stats_in) { av_log(avctx, AV_LOG_ERROR, "No stats file for second pass\n"); return AVERROR_INVALIDDATA; } ctx->twopass_stats.sz = strlen(avctx->stats_in) * 3 / 4; VAR_3 = av_reallocp(&ctx->twopass_stats.buf, ctx->twopass_stats.sz); if (VAR_3 < 0) { av_log(avctx, AV_LOG_ERROR, "Stat buffer alloc (%zu bytes) failed\n", ctx->twopass_stats.sz); return VAR_3; } VAR_2 = av_base64_decode(ctx->twopass_stats.buf, avctx->stats_in, ctx->twopass_stats.sz); if (VAR_2 < 0) { av_log(avctx, AV_LOG_ERROR, "Stat buffer decode failed\n"); return AVERROR_INVALIDDATA; } ctx->twopass_stats.sz = VAR_2; VAR_0.rc_twopass_stats_in = ctx->twopass_stats; } if (avctx->profile != FF_PROFILE_UNKNOWN) VAR_0.g_profile = avctx->profile; else if (avctx->pix_fmt == AV_PIX_FMT_YUV420P) avctx->profile = VAR_0.g_profile = FF_PROFILE_VP9_0; else avctx->profile = VAR_0.g_profile = FF_PROFILE_VP9_1; VAR_0.g_error_resilient = ctx->error_resilient; dump_enc_cfg(avctx, &VAR_0); VAR_1 = vpx_codec_enc_init(&ctx->encoder, iface, &VAR_0, 0); if (VAR_1 != VPX_CODEC_OK) { log_encoder_error(avctx, "Failed to initialize encoder"); return AVERROR(EINVAL); } av_log(avctx, AV_LOG_DEBUG, "vpx_codec_control\n"); if (ctx->cpu_used != INT_MIN) codecctl_int(avctx, VP8E_SET_CPUUSED, ctx->cpu_used); if (ctx->auto_alt_ref >= 0) codecctl_int(avctx, VP8E_SET_ENABLEAUTOALTREF, ctx->auto_alt_ref); if (ctx->arnr_max_frames >= 0) codecctl_int(avctx, VP8E_SET_ARNR_MAXFRAMES, ctx->arnr_max_frames); if (ctx->arnr_strength >= 0) codecctl_int(avctx, VP8E_SET_ARNR_STRENGTH, ctx->arnr_strength); if (ctx->arnr_type >= 0) codecctl_int(avctx, VP8E_SET_ARNR_TYPE, ctx->arnr_type); if (CONFIG_LIBVPX_VP8_ENCODER && iface == &vpx_codec_vp8_cx_algo) { codecctl_int(avctx, VP8E_SET_NOISE_SENSITIVITY, avctx->noise_reduction); codecctl_int(avctx, VP8E_SET_TOKEN_PARTITIONS, av_log2(avctx->slices)); } #if FF_API_MPV_OPT FF_DISABLE_DEPRECATION_WARNINGS if (avctx->mb_threshold) { av_log(avctx, AV_LOG_WARNING, "The mb_threshold option is deprecated, " "use the static-thresh private option instead.\n"); ctx->static_thresh = avctx->mb_threshold; } FF_ENABLE_DEPRECATION_WARNINGS #endif codecctl_int(avctx, VP8E_SET_STATIC_THRESHOLD, ctx->static_thresh); codecctl_int(avctx, VP8E_SET_CQ_LEVEL, ctx->crf); vpx_img_wrap(&ctx->rawimg, ff_vpx_pixfmt_to_imgfmt(avctx->pix_fmt), avctx->width, avctx->height, 1, (unsigned char *)1); avctx->coded_frame = av_frame_alloc(); if (!avctx->coded_frame) { av_log(avctx, AV_LOG_ERROR, "Error allocating coded frame\n"); vp8_free(avctx); return AVERROR(ENOMEM); } return 0; }
[ "static av_cold int FUNC_0(AVCodecContext *avctx,\nconst struct vpx_codec_iface *iface)\n{", "VP8Context *ctx = avctx->priv_data;", "struct vpx_codec_enc_cfg VAR_0 = { 0 };", "int VAR_1;", "av_log(avctx, AV_LOG_INFO, \"%s\\n\", vpx_codec_version_str());", "av_log(avctx, AV_LOG_VERBOSE, \"%s\\n\", vpx_codec_build_config());", "if ((VAR_1 = vpx_codec_enc_config_default(iface, &VAR_0, 0)) != VPX_CODEC_OK) {", "av_log(avctx, AV_LOG_ERROR, \"Failed to get config: %s\\n\",\nvpx_codec_err_to_string(VAR_1));", "return AVERROR(EINVAL);", "}", "dump_enc_cfg(avctx, &VAR_0);", "VAR_0.g_w = avctx->width;", "VAR_0.g_h = avctx->height;", "VAR_0.g_timebase.num = avctx->time_base.num;", "VAR_0.g_timebase.den = avctx->time_base.den;", "VAR_0.g_threads = avctx->thread_count;", "if (ctx->lag_in_frames >= 0)\nVAR_0.g_lag_in_frames = ctx->lag_in_frames;", "if (avctx->flags & CODEC_FLAG_PASS1)\nVAR_0.g_pass = VPX_RC_FIRST_PASS;", "else if (avctx->flags & CODEC_FLAG_PASS2)\nVAR_0.g_pass = VPX_RC_LAST_PASS;", "else\nVAR_0.g_pass = VPX_RC_ONE_PASS;", "if (!avctx->bit_rate)\navctx->bit_rate = VAR_0.rc_target_bitrate * 1000;", "else\nVAR_0.rc_target_bitrate = av_rescale_rnd(avctx->bit_rate, 1, 1000,\nAV_ROUND_NEAR_INF);", "if (ctx->crf)\nVAR_0.rc_end_usage = VPX_CQ;", "else if (avctx->rc_min_rate == avctx->rc_max_rate &&\navctx->rc_min_rate == avctx->bit_rate)\nVAR_0.rc_end_usage = VPX_CBR;", "if (avctx->qmin > 0)\nVAR_0.rc_min_quantizer = avctx->qmin;", "if (avctx->qmax > 0)\nVAR_0.rc_max_quantizer = avctx->qmax;", "VAR_0.rc_dropframe_thresh = avctx->frame_skip_threshold;", "VAR_0.rc_2pass_vbr_bias_pct = round(avctx->qcompress * 100);", "VAR_0.rc_2pass_vbr_minsection_pct =\navctx->rc_min_rate * 100LL / avctx->bit_rate;", "if (avctx->rc_max_rate)\nVAR_0.rc_2pass_vbr_maxsection_pct =\navctx->rc_max_rate * 100LL / avctx->bit_rate;", "if (avctx->rc_buffer_size)\nVAR_0.rc_buf_sz =\navctx->rc_buffer_size * 1000LL / avctx->bit_rate;", "if (avctx->rc_initial_buffer_occupancy)\nVAR_0.rc_buf_initial_sz =\navctx->rc_initial_buffer_occupancy * 1000LL / avctx->bit_rate;", "VAR_0.rc_buf_optimal_sz = VAR_0.rc_buf_sz * 5 / 6;", "if (avctx->keyint_min >= 0 && avctx->keyint_min == avctx->gop_size)\nVAR_0.kf_min_dist = avctx->keyint_min;", "if (avctx->gop_size >= 0)\nVAR_0.kf_max_dist = avctx->gop_size;", "if (VAR_0.g_pass == VPX_RC_FIRST_PASS)\nVAR_0.g_lag_in_frames = 0;", "else if (VAR_0.g_pass == VPX_RC_LAST_PASS) {", "int VAR_2, VAR_3;", "if (!avctx->stats_in) {", "av_log(avctx, AV_LOG_ERROR, \"No stats file for second pass\\n\");", "return AVERROR_INVALIDDATA;", "}", "ctx->twopass_stats.sz = strlen(avctx->stats_in) * 3 / 4;", "VAR_3 = av_reallocp(&ctx->twopass_stats.buf, ctx->twopass_stats.sz);", "if (VAR_3 < 0) {", "av_log(avctx, AV_LOG_ERROR,\n\"Stat buffer alloc (%zu bytes) failed\\n\",\nctx->twopass_stats.sz);", "return VAR_3;", "}", "VAR_2 = av_base64_decode(ctx->twopass_stats.buf, avctx->stats_in,\nctx->twopass_stats.sz);", "if (VAR_2 < 0) {", "av_log(avctx, AV_LOG_ERROR, \"Stat buffer decode failed\\n\");", "return AVERROR_INVALIDDATA;", "}", "ctx->twopass_stats.sz = VAR_2;", "VAR_0.rc_twopass_stats_in = ctx->twopass_stats;", "}", "if (avctx->profile != FF_PROFILE_UNKNOWN)\nVAR_0.g_profile = avctx->profile;", "else if (avctx->pix_fmt == AV_PIX_FMT_YUV420P)\navctx->profile = VAR_0.g_profile = FF_PROFILE_VP9_0;", "else\navctx->profile = VAR_0.g_profile = FF_PROFILE_VP9_1;", "VAR_0.g_error_resilient = ctx->error_resilient;", "dump_enc_cfg(avctx, &VAR_0);", "VAR_1 = vpx_codec_enc_init(&ctx->encoder, iface, &VAR_0, 0);", "if (VAR_1 != VPX_CODEC_OK) {", "log_encoder_error(avctx, \"Failed to initialize encoder\");", "return AVERROR(EINVAL);", "}", "av_log(avctx, AV_LOG_DEBUG, \"vpx_codec_control\\n\");", "if (ctx->cpu_used != INT_MIN)\ncodecctl_int(avctx, VP8E_SET_CPUUSED, ctx->cpu_used);", "if (ctx->auto_alt_ref >= 0)\ncodecctl_int(avctx, VP8E_SET_ENABLEAUTOALTREF, ctx->auto_alt_ref);", "if (ctx->arnr_max_frames >= 0)\ncodecctl_int(avctx, VP8E_SET_ARNR_MAXFRAMES, ctx->arnr_max_frames);", "if (ctx->arnr_strength >= 0)\ncodecctl_int(avctx, VP8E_SET_ARNR_STRENGTH, ctx->arnr_strength);", "if (ctx->arnr_type >= 0)\ncodecctl_int(avctx, VP8E_SET_ARNR_TYPE, ctx->arnr_type);", "if (CONFIG_LIBVPX_VP8_ENCODER && iface == &vpx_codec_vp8_cx_algo) {", "codecctl_int(avctx, VP8E_SET_NOISE_SENSITIVITY, avctx->noise_reduction);", "codecctl_int(avctx, VP8E_SET_TOKEN_PARTITIONS, av_log2(avctx->slices));", "}", "#if FF_API_MPV_OPT\nFF_DISABLE_DEPRECATION_WARNINGS\nif (avctx->mb_threshold) {", "av_log(avctx, AV_LOG_WARNING, \"The mb_threshold option is deprecated, \"\n\"use the static-thresh private option instead.\\n\");", "ctx->static_thresh = avctx->mb_threshold;", "}", "FF_ENABLE_DEPRECATION_WARNINGS\n#endif\ncodecctl_int(avctx, VP8E_SET_STATIC_THRESHOLD, ctx->static_thresh);", "codecctl_int(avctx, VP8E_SET_CQ_LEVEL, ctx->crf);", "vpx_img_wrap(&ctx->rawimg, ff_vpx_pixfmt_to_imgfmt(avctx->pix_fmt),\navctx->width, avctx->height, 1, (unsigned char *)1);", "avctx->coded_frame = av_frame_alloc();", "if (!avctx->coded_frame) {", "av_log(avctx, AV_LOG_ERROR, \"Error allocating coded frame\\n\");", "vp8_free(avctx);", "return AVERROR(ENOMEM);", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47, 49 ], [ 53, 55 ], [ 57, 59 ], [ 61, 63 ], [ 67, 69 ], [ 71, 73, 75 ], [ 79, 81 ], [ 83, 85, 87 ], [ 91, 93 ], [ 95, 97 ], [ 99 ], [ 105 ], [ 107, 109 ], [ 111, 113, 115 ], [ 119, 121, 123 ], [ 125, 127, 129 ], [ 131 ], [ 137, 139 ], [ 141, 143 ], [ 147, 149 ], [ 151 ], [ 153 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 167 ], [ 169 ], [ 171 ], [ 173, 175, 177 ], [ 179 ], [ 181 ], [ 183, 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 197 ], [ 199 ], [ 201 ], [ 211, 213 ], [ 215, 217 ], [ 219, 221 ], [ 225 ], [ 229 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 247 ], [ 249, 251 ], [ 253, 255 ], [ 257, 259 ], [ 261, 263 ], [ 265, 267 ], [ 271 ], [ 273 ], [ 275 ], [ 277 ], [ 279, 281, 283 ], [ 285, 287 ], [ 289 ], [ 291 ], [ 293, 295, 297 ], [ 299 ], [ 305, 307 ], [ 311 ], [ 313 ], [ 315 ], [ 317 ], [ 319 ], [ 321 ], [ 323 ], [ 325 ] ]
12,602
static int virtio_pci_start_ioeventfd(VirtIOPCIProxy *proxy) { int n, r; if (!(proxy->flags & VIRTIO_PCI_FLAG_USE_IOEVENTFD) || proxy->ioeventfd_disabled || proxy->ioeventfd_started) { return 0; } for (n = 0; n < VIRTIO_PCI_QUEUE_MAX; n++) { if (!virtio_queue_get_num(proxy->vdev, n)) { continue; } r = virtio_pci_set_host_notifier_internal(proxy, n, true); if (r < 0) { goto assign_error; } virtio_pci_set_host_notifier_fd_handler(proxy, n, true); } proxy->ioeventfd_started = true; return 0; assign_error: while (--n >= 0) { if (!virtio_queue_get_num(proxy->vdev, n)) { continue; } virtio_pci_set_host_notifier_fd_handler(proxy, n, false); virtio_pci_set_host_notifier_internal(proxy, n, false); } proxy->ioeventfd_started = false; proxy->ioeventfd_disabled = true; return r; }
true
qemu
b36e391441906c36ed0856b69de84001860402bf
static int virtio_pci_start_ioeventfd(VirtIOPCIProxy *proxy) { int n, r; if (!(proxy->flags & VIRTIO_PCI_FLAG_USE_IOEVENTFD) || proxy->ioeventfd_disabled || proxy->ioeventfd_started) { return 0; } for (n = 0; n < VIRTIO_PCI_QUEUE_MAX; n++) { if (!virtio_queue_get_num(proxy->vdev, n)) { continue; } r = virtio_pci_set_host_notifier_internal(proxy, n, true); if (r < 0) { goto assign_error; } virtio_pci_set_host_notifier_fd_handler(proxy, n, true); } proxy->ioeventfd_started = true; return 0; assign_error: while (--n >= 0) { if (!virtio_queue_get_num(proxy->vdev, n)) { continue; } virtio_pci_set_host_notifier_fd_handler(proxy, n, false); virtio_pci_set_host_notifier_internal(proxy, n, false); } proxy->ioeventfd_started = false; proxy->ioeventfd_disabled = true; return r; }
{ "code": [ "static int virtio_pci_start_ioeventfd(VirtIOPCIProxy *proxy)", " return 0;", " return 0;", " virtio_pci_set_host_notifier_internal(proxy, n, false);", " proxy->ioeventfd_disabled = true;", " return r;", " return 0;", " virtio_pci_set_host_notifier_internal(proxy, n, false);", " return 0;" ], "line_no": [ 1, 15, 47, 65, 71, 73, 15, 65, 47 ] }
static int FUNC_0(VirtIOPCIProxy *VAR_0) { int VAR_1, VAR_2; if (!(VAR_0->flags & VIRTIO_PCI_FLAG_USE_IOEVENTFD) || VAR_0->ioeventfd_disabled || VAR_0->ioeventfd_started) { return 0; } for (VAR_1 = 0; VAR_1 < VIRTIO_PCI_QUEUE_MAX; VAR_1++) { if (!virtio_queue_get_num(VAR_0->vdev, VAR_1)) { continue; } VAR_2 = virtio_pci_set_host_notifier_internal(VAR_0, VAR_1, true); if (VAR_2 < 0) { goto assign_error; } virtio_pci_set_host_notifier_fd_handler(VAR_0, VAR_1, true); } VAR_0->ioeventfd_started = true; return 0; assign_error: while (--VAR_1 >= 0) { if (!virtio_queue_get_num(VAR_0->vdev, VAR_1)) { continue; } virtio_pci_set_host_notifier_fd_handler(VAR_0, VAR_1, false); virtio_pci_set_host_notifier_internal(VAR_0, VAR_1, false); } VAR_0->ioeventfd_started = false; VAR_0->ioeventfd_disabled = true; return VAR_2; }
[ "static int FUNC_0(VirtIOPCIProxy *VAR_0)\n{", "int VAR_1, VAR_2;", "if (!(VAR_0->flags & VIRTIO_PCI_FLAG_USE_IOEVENTFD) ||\nVAR_0->ioeventfd_disabled ||\nVAR_0->ioeventfd_started) {", "return 0;", "}", "for (VAR_1 = 0; VAR_1 < VIRTIO_PCI_QUEUE_MAX; VAR_1++) {", "if (!virtio_queue_get_num(VAR_0->vdev, VAR_1)) {", "continue;", "}", "VAR_2 = virtio_pci_set_host_notifier_internal(VAR_0, VAR_1, true);", "if (VAR_2 < 0) {", "goto assign_error;", "}", "virtio_pci_set_host_notifier_fd_handler(VAR_0, VAR_1, true);", "}", "VAR_0->ioeventfd_started = true;", "return 0;", "assign_error:\nwhile (--VAR_1 >= 0) {", "if (!virtio_queue_get_num(VAR_0->vdev, VAR_1)) {", "continue;", "}", "virtio_pci_set_host_notifier_fd_handler(VAR_0, VAR_1, false);", "virtio_pci_set_host_notifier_internal(VAR_0, VAR_1, false);", "}", "VAR_0->ioeventfd_started = false;", "VAR_0->ioeventfd_disabled = true;", "return VAR_2;", "}" ]
[ 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11, 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51, 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ] ]
12,603
static void block_set_params(const MigrationParams *params, void *opaque) { block_mig_state.blk_enable = params->blk; block_mig_state.shared_base = params->shared; /* shared base means that blk_enable = 1 */ block_mig_state.blk_enable |= params->shared; }
true
qemu
60fe637bf0e4d7989e21e50f52526444765c63b4
static void block_set_params(const MigrationParams *params, void *opaque) { block_mig_state.blk_enable = params->blk; block_mig_state.shared_base = params->shared; block_mig_state.blk_enable |= params->shared; }
{ "code": [], "line_no": [] }
static void FUNC_0(const MigrationParams *VAR_0, void *VAR_1) { block_mig_state.blk_enable = VAR_0->blk; block_mig_state.shared_base = VAR_0->shared; block_mig_state.blk_enable |= VAR_0->shared; }
[ "static void FUNC_0(const MigrationParams *VAR_0, void *VAR_1)\n{", "block_mig_state.blk_enable = VAR_0->blk;", "block_mig_state.shared_base = VAR_0->shared;", "block_mig_state.blk_enable |= VAR_0->shared;", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 13 ], [ 15 ] ]
12,604
static void show_packets(WriterContext *w, AVFormatContext *fmt_ctx) { AVPacket pkt; AVFrame frame; int i = 0; av_init_packet(&pkt); while (!av_read_frame(fmt_ctx, &pkt)) { if (do_show_packets) show_packet(w, fmt_ctx, &pkt, i++); if (do_show_frames && get_video_frame(fmt_ctx, &frame, &pkt)) { show_frame(w, &frame, fmt_ctx->streams[pkt.stream_index]); av_destruct_packet(&pkt); } } av_init_packet(&pkt); pkt.data = NULL; pkt.size = 0; //Flush remaining frames that are cached in the decoder for (i = 0; i < fmt_ctx->nb_streams; i++) { pkt.stream_index = i; while (get_video_frame(fmt_ctx, &frame, &pkt)) show_frame(w, &frame, fmt_ctx->streams[pkt.stream_index]); } }
true
FFmpeg
7328c2fc2184476235ebc9a9b9247a986bdea1cf
static void show_packets(WriterContext *w, AVFormatContext *fmt_ctx) { AVPacket pkt; AVFrame frame; int i = 0; av_init_packet(&pkt); while (!av_read_frame(fmt_ctx, &pkt)) { if (do_show_packets) show_packet(w, fmt_ctx, &pkt, i++); if (do_show_frames && get_video_frame(fmt_ctx, &frame, &pkt)) { show_frame(w, &frame, fmt_ctx->streams[pkt.stream_index]); av_destruct_packet(&pkt); } } av_init_packet(&pkt); pkt.data = NULL; pkt.size = 0; for (i = 0; i < fmt_ctx->nb_streams; i++) { pkt.stream_index = i; while (get_video_frame(fmt_ctx, &frame, &pkt)) show_frame(w, &frame, fmt_ctx->streams[pkt.stream_index]); } }
{ "code": [ " av_destruct_packet(&pkt);" ], "line_no": [ 29 ] }
static void FUNC_0(WriterContext *VAR_0, AVFormatContext *VAR_1) { AVPacket pkt; AVFrame frame; int VAR_2 = 0; av_init_packet(&pkt); while (!av_read_frame(VAR_1, &pkt)) { if (do_show_packets) show_packet(VAR_0, VAR_1, &pkt, VAR_2++); if (do_show_frames && get_video_frame(VAR_1, &frame, &pkt)) { show_frame(VAR_0, &frame, VAR_1->streams[pkt.stream_index]); av_destruct_packet(&pkt); } } av_init_packet(&pkt); pkt.data = NULL; pkt.size = 0; for (VAR_2 = 0; VAR_2 < VAR_1->nb_streams; VAR_2++) { pkt.stream_index = VAR_2; while (get_video_frame(VAR_1, &frame, &pkt)) show_frame(VAR_0, &frame, VAR_1->streams[pkt.stream_index]); } }
[ "static void FUNC_0(WriterContext *VAR_0, AVFormatContext *VAR_1)\n{", "AVPacket pkt;", "AVFrame frame;", "int VAR_2 = 0;", "av_init_packet(&pkt);", "while (!av_read_frame(VAR_1, &pkt)) {", "if (do_show_packets)\nshow_packet(VAR_0, VAR_1, &pkt, VAR_2++);", "if (do_show_frames &&\nget_video_frame(VAR_1, &frame, &pkt)) {", "show_frame(VAR_0, &frame, VAR_1->streams[pkt.stream_index]);", "av_destruct_packet(&pkt);", "}", "}", "av_init_packet(&pkt);", "pkt.data = NULL;", "pkt.size = 0;", "for (VAR_2 = 0; VAR_2 < VAR_1->nb_streams; VAR_2++) {", "pkt.stream_index = VAR_2;", "while (get_video_frame(VAR_1, &frame, &pkt))\nshow_frame(VAR_0, &frame, VAR_1->streams[pkt.stream_index]);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17 ], [ 19, 21 ], [ 23, 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47, 49 ], [ 51 ], [ 53 ] ]
12,605
static void bios_supports_mode(const char *pmutils_bin, const char *pmutils_arg, const char *sysfile_str, Error **err) { pid_t pid; ssize_t ret; char *pmutils_path; int status, pipefds[2]; if (pipe(pipefds) < 0) { error_set(err, QERR_UNDEFINED_ERROR); return; } pmutils_path = g_find_program_in_path(pmutils_bin); pid = fork(); if (!pid) { struct sigaction act; memset(&act, 0, sizeof(act)); act.sa_handler = SIG_DFL; sigaction(SIGCHLD, &act, NULL); setsid(); close(pipefds[0]); reopen_fd_to_null(0); reopen_fd_to_null(1); reopen_fd_to_null(2); pid = fork(); if (!pid) { int fd; char buf[32]; /* hopefully big enough */ if (pmutils_path) { execle(pmutils_path, pmutils_bin, pmutils_arg, NULL, environ); } /* * If we get here either pm-utils is not installed or execle() has * failed. Let's try the manual method if the caller wants it. */ if (!sysfile_str) { _exit(SUSPEND_NOT_SUPPORTED); } fd = open(LINUX_SYS_STATE_FILE, O_RDONLY); if (fd < 0) { _exit(SUSPEND_NOT_SUPPORTED); } ret = read(fd, buf, sizeof(buf)-1); if (ret <= 0) { _exit(SUSPEND_NOT_SUPPORTED); } buf[ret] = '\0'; if (strstr(buf, sysfile_str)) { _exit(SUSPEND_SUPPORTED); } _exit(SUSPEND_NOT_SUPPORTED); } if (pid > 0) { wait(&status); } else { status = SUSPEND_NOT_SUPPORTED; } ret = write(pipefds[1], &status, sizeof(status)); if (ret != sizeof(status)) { _exit(EXIT_FAILURE); } _exit(EXIT_SUCCESS); } close(pipefds[1]); g_free(pmutils_path); if (pid < 0) { error_set(err, QERR_UNDEFINED_ERROR); goto out; } ret = read(pipefds[0], &status, sizeof(status)); if (ret == sizeof(status) && WIFEXITED(status) && WEXITSTATUS(status) == SUSPEND_SUPPORTED) { goto out; } error_set(err, QERR_UNSUPPORTED); out: close(pipefds[0]); }
true
qemu
dc8764f06155a7b3e635e02281b747a9e292127e
static void bios_supports_mode(const char *pmutils_bin, const char *pmutils_arg, const char *sysfile_str, Error **err) { pid_t pid; ssize_t ret; char *pmutils_path; int status, pipefds[2]; if (pipe(pipefds) < 0) { error_set(err, QERR_UNDEFINED_ERROR); return; } pmutils_path = g_find_program_in_path(pmutils_bin); pid = fork(); if (!pid) { struct sigaction act; memset(&act, 0, sizeof(act)); act.sa_handler = SIG_DFL; sigaction(SIGCHLD, &act, NULL); setsid(); close(pipefds[0]); reopen_fd_to_null(0); reopen_fd_to_null(1); reopen_fd_to_null(2); pid = fork(); if (!pid) { int fd; char buf[32]; if (pmutils_path) { execle(pmutils_path, pmutils_bin, pmutils_arg, NULL, environ); } if (!sysfile_str) { _exit(SUSPEND_NOT_SUPPORTED); } fd = open(LINUX_SYS_STATE_FILE, O_RDONLY); if (fd < 0) { _exit(SUSPEND_NOT_SUPPORTED); } ret = read(fd, buf, sizeof(buf)-1); if (ret <= 0) { _exit(SUSPEND_NOT_SUPPORTED); } buf[ret] = '\0'; if (strstr(buf, sysfile_str)) { _exit(SUSPEND_SUPPORTED); } _exit(SUSPEND_NOT_SUPPORTED); } if (pid > 0) { wait(&status); } else { status = SUSPEND_NOT_SUPPORTED; } ret = write(pipefds[1], &status, sizeof(status)); if (ret != sizeof(status)) { _exit(EXIT_FAILURE); } _exit(EXIT_SUCCESS); } close(pipefds[1]); g_free(pmutils_path); if (pid < 0) { error_set(err, QERR_UNDEFINED_ERROR); goto out; } ret = read(pipefds[0], &status, sizeof(status)); if (ret == sizeof(status) && WIFEXITED(status) && WEXITSTATUS(status) == SUSPEND_SUPPORTED) { goto out; } error_set(err, QERR_UNSUPPORTED); out: close(pipefds[0]); }
{ "code": [ " pid_t pid;", " ssize_t ret;", " int status, pipefds[2];", " if (pipe(pipefds) < 0) {", " error_set(err, QERR_UNDEFINED_ERROR);", " struct sigaction act;", " memset(&act, 0, sizeof(act));", " act.sa_handler = SIG_DFL;", " sigaction(SIGCHLD, &act, NULL);", " close(pipefds[0]);", " pid = fork();", " if (!pid) {", " int fd;", " if (pmutils_path) {", " execle(pmutils_path, pmutils_bin, pmutils_arg, NULL, environ);", " if (!sysfile_str) {", " _exit(SUSPEND_NOT_SUPPORTED);", " fd = open(LINUX_SYS_STATE_FILE, O_RDONLY);", " if (fd < 0) {", " _exit(SUSPEND_NOT_SUPPORTED);", " ret = read(fd, buf, sizeof(buf)-1);", " if (ret <= 0) {", " _exit(SUSPEND_NOT_SUPPORTED);", " buf[ret] = '\\0';", " if (strstr(buf, sysfile_str)) {", " _exit(SUSPEND_SUPPORTED);", " if (pid > 0) {", " wait(&status);", " } else {", " status = SUSPEND_NOT_SUPPORTED;", " ret = write(pipefds[1], &status, sizeof(status));", " if (ret != sizeof(status)) {", " _exit(EXIT_FAILURE);", " _exit(EXIT_SUCCESS);", " close(pipefds[1]);", " error_set(err, QERR_UNDEFINED_ERROR);", " goto out;", " ret = read(pipefds[0], &status, sizeof(status));", " if (ret == sizeof(status) && WIFEXITED(status) &&", " WEXITSTATUS(status) == SUSPEND_SUPPORTED) {", " goto out;", " error_set(err, QERR_UNSUPPORTED);", "out:", " close(pipefds[0]);", " pid_t pid;", " error_set(err, QERR_UNDEFINED_ERROR);" ], "line_no": [ 7, 9, 13, 17, 19, 35, 39, 41, 43, 49, 59, 61, 63, 69, 71, 87, 89, 95, 97, 89, 105, 107, 89, 113, 117, 119, 131, 133, 135, 137, 143, 145, 147, 153, 159, 19, 169, 175, 177, 179, 181, 187, 191, 193, 7, 19 ] }
static void FUNC_0(const char *VAR_0, const char *VAR_1, const char *VAR_2, Error **VAR_3) { pid_t pid; ssize_t ret; char *VAR_4; int VAR_5, VAR_6[2]; if (pipe(VAR_6) < 0) { error_set(VAR_3, QERR_UNDEFINED_ERROR); return; } VAR_4 = g_find_program_in_path(VAR_0); pid = fork(); if (!pid) { struct sigaction VAR_7; memset(&VAR_7, 0, sizeof(VAR_7)); VAR_7.sa_handler = SIG_DFL; sigaction(SIGCHLD, &VAR_7, NULL); setsid(); close(VAR_6[0]); reopen_fd_to_null(0); reopen_fd_to_null(1); reopen_fd_to_null(2); pid = fork(); if (!pid) { int VAR_8; char VAR_9[32]; if (VAR_4) { execle(VAR_4, VAR_0, VAR_1, NULL, environ); } if (!VAR_2) { _exit(SUSPEND_NOT_SUPPORTED); } VAR_8 = open(LINUX_SYS_STATE_FILE, O_RDONLY); if (VAR_8 < 0) { _exit(SUSPEND_NOT_SUPPORTED); } ret = read(VAR_8, VAR_9, sizeof(VAR_9)-1); if (ret <= 0) { _exit(SUSPEND_NOT_SUPPORTED); } VAR_9[ret] = '\0'; if (strstr(VAR_9, VAR_2)) { _exit(SUSPEND_SUPPORTED); } _exit(SUSPEND_NOT_SUPPORTED); } if (pid > 0) { wait(&VAR_5); } else { VAR_5 = SUSPEND_NOT_SUPPORTED; } ret = write(VAR_6[1], &VAR_5, sizeof(VAR_5)); if (ret != sizeof(VAR_5)) { _exit(EXIT_FAILURE); } _exit(EXIT_SUCCESS); } close(VAR_6[1]); g_free(VAR_4); if (pid < 0) { error_set(VAR_3, QERR_UNDEFINED_ERROR); goto out; } ret = read(VAR_6[0], &VAR_5, sizeof(VAR_5)); if (ret == sizeof(VAR_5) && WIFEXITED(VAR_5) && WEXITSTATUS(VAR_5) == SUSPEND_SUPPORTED) { goto out; } error_set(VAR_3, QERR_UNSUPPORTED); out: close(VAR_6[0]); }
[ "static void FUNC_0(const char *VAR_0, const char *VAR_1,\nconst char *VAR_2, Error **VAR_3)\n{", "pid_t pid;", "ssize_t ret;", "char *VAR_4;", "int VAR_5, VAR_6[2];", "if (pipe(VAR_6) < 0) {", "error_set(VAR_3, QERR_UNDEFINED_ERROR);", "return;", "}", "VAR_4 = g_find_program_in_path(VAR_0);", "pid = fork();", "if (!pid) {", "struct sigaction VAR_7;", "memset(&VAR_7, 0, sizeof(VAR_7));", "VAR_7.sa_handler = SIG_DFL;", "sigaction(SIGCHLD, &VAR_7, NULL);", "setsid();", "close(VAR_6[0]);", "reopen_fd_to_null(0);", "reopen_fd_to_null(1);", "reopen_fd_to_null(2);", "pid = fork();", "if (!pid) {", "int VAR_8;", "char VAR_9[32];", "if (VAR_4) {", "execle(VAR_4, VAR_0, VAR_1, NULL, environ);", "}", "if (!VAR_2) {", "_exit(SUSPEND_NOT_SUPPORTED);", "}", "VAR_8 = open(LINUX_SYS_STATE_FILE, O_RDONLY);", "if (VAR_8 < 0) {", "_exit(SUSPEND_NOT_SUPPORTED);", "}", "ret = read(VAR_8, VAR_9, sizeof(VAR_9)-1);", "if (ret <= 0) {", "_exit(SUSPEND_NOT_SUPPORTED);", "}", "VAR_9[ret] = '\\0';", "if (strstr(VAR_9, VAR_2)) {", "_exit(SUSPEND_SUPPORTED);", "}", "_exit(SUSPEND_NOT_SUPPORTED);", "}", "if (pid > 0) {", "wait(&VAR_5);", "} else {", "VAR_5 = SUSPEND_NOT_SUPPORTED;", "}", "ret = write(VAR_6[1], &VAR_5, sizeof(VAR_5));", "if (ret != sizeof(VAR_5)) {", "_exit(EXIT_FAILURE);", "}", "_exit(EXIT_SUCCESS);", "}", "close(VAR_6[1]);", "g_free(VAR_4);", "if (pid < 0) {", "error_set(VAR_3, QERR_UNDEFINED_ERROR);", "goto out;", "}", "ret = read(VAR_6[0], &VAR_5, sizeof(VAR_5));", "if (ret == sizeof(VAR_5) && WIFEXITED(VAR_5) &&\nWEXITSTATUS(VAR_5) == SUSPEND_SUPPORTED) {", "goto out;", "}", "error_set(VAR_3, QERR_UNSUPPORTED);", "out:\nclose(VAR_6[0]);", "}" ]
[ 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ], [ 73 ], [ 87 ], [ 89 ], [ 91 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 117 ], [ 119 ], [ 121 ], [ 125 ], [ 127 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 153 ], [ 155 ], [ 159 ], [ 161 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 175 ], [ 177, 179 ], [ 181 ], [ 183 ], [ 187 ], [ 191, 193 ], [ 195 ] ]
12,606
void tlb_reset_dirty_range(CPUTLBEntry *tlb_entry, uintptr_t start, uintptr_t length) { uintptr_t addr; if (tlb_is_dirty_ram(tlb_entry)) { addr = (tlb_entry->addr_write & TARGET_PAGE_MASK) + tlb_entry->addend; if ((addr - start) < length) { tlb_entry->addr_write |= TLB_NOTDIRTY; } } }
true
qemu
b0706b716769494f321a0d2bfd9fa9893992f995
void tlb_reset_dirty_range(CPUTLBEntry *tlb_entry, uintptr_t start, uintptr_t length) { uintptr_t addr; if (tlb_is_dirty_ram(tlb_entry)) { addr = (tlb_entry->addr_write & TARGET_PAGE_MASK) + tlb_entry->addend; if ((addr - start) < length) { tlb_entry->addr_write |= TLB_NOTDIRTY; } } }
{ "code": [ "void tlb_reset_dirty_range(CPUTLBEntry *tlb_entry, uintptr_t start,", " uintptr_t addr;", " if (tlb_is_dirty_ram(tlb_entry)) {", " addr = (tlb_entry->addr_write & TARGET_PAGE_MASK) + tlb_entry->addend;", "void tlb_reset_dirty_range(CPUTLBEntry *tlb_entry, uintptr_t start," ], "line_no": [ 1, 7, 11, 13, 1 ] }
void FUNC_0(CPUTLBEntry *VAR_0, uintptr_t VAR_1, uintptr_t VAR_2) { uintptr_t addr; if (tlb_is_dirty_ram(VAR_0)) { addr = (VAR_0->addr_write & TARGET_PAGE_MASK) + VAR_0->addend; if ((addr - VAR_1) < VAR_2) { VAR_0->addr_write |= TLB_NOTDIRTY; } } }
[ "void FUNC_0(CPUTLBEntry *VAR_0, uintptr_t VAR_1,\nuintptr_t VAR_2)\n{", "uintptr_t addr;", "if (tlb_is_dirty_ram(VAR_0)) {", "addr = (VAR_0->addr_write & TARGET_PAGE_MASK) + VAR_0->addend;", "if ((addr - VAR_1) < VAR_2) {", "VAR_0->addr_write |= TLB_NOTDIRTY;", "}", "}", "}" ]
[ 1, 1, 1, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ] ]
12,608
static const char *scsi_command_name(uint8_t cmd) { static const char *names[] = { [ TEST_UNIT_READY ] = "TEST_UNIT_READY", [ REQUEST_SENSE ] = "REQUEST_SENSE", [ FORMAT_UNIT ] = "FORMAT_UNIT", [ READ_BLOCK_LIMITS ] = "READ_BLOCK_LIMITS", [ REASSIGN_BLOCKS ] = "REASSIGN_BLOCKS", [ READ_6 ] = "READ_6", [ WRITE_6 ] = "WRITE_6", [ SEEK_6 ] = "SEEK_6", [ READ_REVERSE ] = "READ_REVERSE", [ WRITE_FILEMARKS ] = "WRITE_FILEMARKS", [ SPACE ] = "SPACE", [ INQUIRY ] = "INQUIRY", [ RECOVER_BUFFERED_DATA ] = "RECOVER_BUFFERED_DATA", [ MAINTENANCE_IN ] = "MAINTENANCE_IN", [ MAINTENANCE_OUT ] = "MAINTENANCE_OUT", [ MODE_SELECT ] = "MODE_SELECT", [ RESERVE ] = "RESERVE", [ RELEASE ] = "RELEASE", [ COPY ] = "COPY", [ ERASE ] = "ERASE", [ MODE_SENSE ] = "MODE_SENSE", [ START_STOP ] = "START_STOP", [ RECEIVE_DIAGNOSTIC ] = "RECEIVE_DIAGNOSTIC", [ SEND_DIAGNOSTIC ] = "SEND_DIAGNOSTIC", [ ALLOW_MEDIUM_REMOVAL ] = "ALLOW_MEDIUM_REMOVAL", [ READ_CAPACITY ] = "READ_CAPACITY", [ READ_10 ] = "READ_10", [ WRITE_10 ] = "WRITE_10", [ SEEK_10 ] = "SEEK_10", [ WRITE_VERIFY ] = "WRITE_VERIFY", [ VERIFY ] = "VERIFY", [ SEARCH_HIGH ] = "SEARCH_HIGH", [ SEARCH_EQUAL ] = "SEARCH_EQUAL", [ SEARCH_LOW ] = "SEARCH_LOW", [ SET_LIMITS ] = "SET_LIMITS", [ PRE_FETCH ] = "PRE_FETCH", /* READ_POSITION and PRE_FETCH use the same operation code */ [ SYNCHRONIZE_CACHE ] = "SYNCHRONIZE_CACHE", [ LOCK_UNLOCK_CACHE ] = "LOCK_UNLOCK_CACHE", [ READ_DEFECT_DATA ] = "READ_DEFECT_DATA", [ MEDIUM_SCAN ] = "MEDIUM_SCAN", [ COMPARE ] = "COMPARE", [ COPY_VERIFY ] = "COPY_VERIFY", [ WRITE_BUFFER ] = "WRITE_BUFFER", [ READ_BUFFER ] = "READ_BUFFER", [ UPDATE_BLOCK ] = "UPDATE_BLOCK", [ READ_LONG ] = "READ_LONG", [ WRITE_LONG ] = "WRITE_LONG", [ CHANGE_DEFINITION ] = "CHANGE_DEFINITION", [ WRITE_SAME ] = "WRITE_SAME", [ READ_TOC ] = "READ_TOC", [ LOG_SELECT ] = "LOG_SELECT", [ LOG_SENSE ] = "LOG_SENSE", [ MODE_SELECT_10 ] = "MODE_SELECT_10", [ RESERVE_10 ] = "RESERVE_10", [ RELEASE_10 ] = "RELEASE_10", [ MODE_SENSE_10 ] = "MODE_SENSE_10", [ PERSISTENT_RESERVE_IN ] = "PERSISTENT_RESERVE_IN", [ PERSISTENT_RESERVE_OUT ] = "PERSISTENT_RESERVE_OUT", [ MOVE_MEDIUM ] = "MOVE_MEDIUM", [ READ_12 ] = "READ_12", [ WRITE_12 ] = "WRITE_12", [ WRITE_VERIFY_12 ] = "WRITE_VERIFY_12", [ SEARCH_HIGH_12 ] = "SEARCH_HIGH_12", [ SEARCH_EQUAL_12 ] = "SEARCH_EQUAL_12", [ SEARCH_LOW_12 ] = "SEARCH_LOW_12", [ READ_ELEMENT_STATUS ] = "READ_ELEMENT_STATUS", [ SEND_VOLUME_TAG ] = "SEND_VOLUME_TAG", [ WRITE_LONG_2 ] = "WRITE_LONG_2", [ REPORT_DENSITY_SUPPORT ] = "REPORT_DENSITY_SUPPORT", [ GET_CONFIGURATION ] = "GET_CONFIGURATION", [ READ_16 ] = "READ_16", [ WRITE_16 ] = "WRITE_16", [ WRITE_VERIFY_16 ] = "WRITE_VERIFY_16", [ SERVICE_ACTION_IN ] = "SERVICE_ACTION_IN", [ REPORT_LUNS ] = "REPORT_LUNS", [ LOAD_UNLOAD ] = "LOAD_UNLOAD", [ SET_CD_SPEED ] = "SET_CD_SPEED", [ BLANK ] = "BLANK", }; if (cmd >= ARRAY_SIZE(names) || names[cmd] == NULL) return "*UNKNOWN*"; return names[cmd]; }
true
qemu
5e30a07d6d70d3073ff61e6db79d61c2b688502f
static const char *scsi_command_name(uint8_t cmd) { static const char *names[] = { [ TEST_UNIT_READY ] = "TEST_UNIT_READY", [ REQUEST_SENSE ] = "REQUEST_SENSE", [ FORMAT_UNIT ] = "FORMAT_UNIT", [ READ_BLOCK_LIMITS ] = "READ_BLOCK_LIMITS", [ REASSIGN_BLOCKS ] = "REASSIGN_BLOCKS", [ READ_6 ] = "READ_6", [ WRITE_6 ] = "WRITE_6", [ SEEK_6 ] = "SEEK_6", [ READ_REVERSE ] = "READ_REVERSE", [ WRITE_FILEMARKS ] = "WRITE_FILEMARKS", [ SPACE ] = "SPACE", [ INQUIRY ] = "INQUIRY", [ RECOVER_BUFFERED_DATA ] = "RECOVER_BUFFERED_DATA", [ MAINTENANCE_IN ] = "MAINTENANCE_IN", [ MAINTENANCE_OUT ] = "MAINTENANCE_OUT", [ MODE_SELECT ] = "MODE_SELECT", [ RESERVE ] = "RESERVE", [ RELEASE ] = "RELEASE", [ COPY ] = "COPY", [ ERASE ] = "ERASE", [ MODE_SENSE ] = "MODE_SENSE", [ START_STOP ] = "START_STOP", [ RECEIVE_DIAGNOSTIC ] = "RECEIVE_DIAGNOSTIC", [ SEND_DIAGNOSTIC ] = "SEND_DIAGNOSTIC", [ ALLOW_MEDIUM_REMOVAL ] = "ALLOW_MEDIUM_REMOVAL", [ READ_CAPACITY ] = "READ_CAPACITY", [ READ_10 ] = "READ_10", [ WRITE_10 ] = "WRITE_10", [ SEEK_10 ] = "SEEK_10", [ WRITE_VERIFY ] = "WRITE_VERIFY", [ VERIFY ] = "VERIFY", [ SEARCH_HIGH ] = "SEARCH_HIGH", [ SEARCH_EQUAL ] = "SEARCH_EQUAL", [ SEARCH_LOW ] = "SEARCH_LOW", [ SET_LIMITS ] = "SET_LIMITS", [ PRE_FETCH ] = "PRE_FETCH", [ SYNCHRONIZE_CACHE ] = "SYNCHRONIZE_CACHE", [ LOCK_UNLOCK_CACHE ] = "LOCK_UNLOCK_CACHE", [ READ_DEFECT_DATA ] = "READ_DEFECT_DATA", [ MEDIUM_SCAN ] = "MEDIUM_SCAN", [ COMPARE ] = "COMPARE", [ COPY_VERIFY ] = "COPY_VERIFY", [ WRITE_BUFFER ] = "WRITE_BUFFER", [ READ_BUFFER ] = "READ_BUFFER", [ UPDATE_BLOCK ] = "UPDATE_BLOCK", [ READ_LONG ] = "READ_LONG", [ WRITE_LONG ] = "WRITE_LONG", [ CHANGE_DEFINITION ] = "CHANGE_DEFINITION", [ WRITE_SAME ] = "WRITE_SAME", [ READ_TOC ] = "READ_TOC", [ LOG_SELECT ] = "LOG_SELECT", [ LOG_SENSE ] = "LOG_SENSE", [ MODE_SELECT_10 ] = "MODE_SELECT_10", [ RESERVE_10 ] = "RESERVE_10", [ RELEASE_10 ] = "RELEASE_10", [ MODE_SENSE_10 ] = "MODE_SENSE_10", [ PERSISTENT_RESERVE_IN ] = "PERSISTENT_RESERVE_IN", [ PERSISTENT_RESERVE_OUT ] = "PERSISTENT_RESERVE_OUT", [ MOVE_MEDIUM ] = "MOVE_MEDIUM", [ READ_12 ] = "READ_12", [ WRITE_12 ] = "WRITE_12", [ WRITE_VERIFY_12 ] = "WRITE_VERIFY_12", [ SEARCH_HIGH_12 ] = "SEARCH_HIGH_12", [ SEARCH_EQUAL_12 ] = "SEARCH_EQUAL_12", [ SEARCH_LOW_12 ] = "SEARCH_LOW_12", [ READ_ELEMENT_STATUS ] = "READ_ELEMENT_STATUS", [ SEND_VOLUME_TAG ] = "SEND_VOLUME_TAG", [ WRITE_LONG_2 ] = "WRITE_LONG_2", [ REPORT_DENSITY_SUPPORT ] = "REPORT_DENSITY_SUPPORT", [ GET_CONFIGURATION ] = "GET_CONFIGURATION", [ READ_16 ] = "READ_16", [ WRITE_16 ] = "WRITE_16", [ WRITE_VERIFY_16 ] = "WRITE_VERIFY_16", [ SERVICE_ACTION_IN ] = "SERVICE_ACTION_IN", [ REPORT_LUNS ] = "REPORT_LUNS", [ LOAD_UNLOAD ] = "LOAD_UNLOAD", [ SET_CD_SPEED ] = "SET_CD_SPEED", [ BLANK ] = "BLANK", }; if (cmd >= ARRAY_SIZE(names) || names[cmd] == NULL) return "*UNKNOWN*"; return names[cmd]; }
{ "code": [ " [ READ_CAPACITY ] = \"READ_CAPACITY\",", " [ WRITE_VERIFY ] = \"WRITE_VERIFY\",", " [ VERIFY ] = \"VERIFY\",", " [ READ_LONG ] = \"READ_LONG\",", " [ WRITE_LONG ] = \"WRITE_LONG\",", " [ WRITE_SAME ] = \"WRITE_SAME\",", " [ WRITE_LONG_2 ] = \"WRITE_LONG_2\",", " [ REPORT_DENSITY_SUPPORT ] = \"REPORT_DENSITY_SUPPORT\",", " [ GET_CONFIGURATION ] = \"GET_CONFIGURATION\",", " [ READ_16 ] = \"READ_16\",", " [ WRITE_16 ] = \"WRITE_16\",", " [ WRITE_VERIFY_16 ] = \"WRITE_VERIFY_16\",", " [ SERVICE_ACTION_IN ] = \"SERVICE_ACTION_IN\",", " [ REPORT_LUNS ] = \"REPORT_LUNS\",", " [ LOAD_UNLOAD ] = \"LOAD_UNLOAD\",", " [ BLANK ] = \"BLANK\"," ], "line_no": [ 59, 67, 69, 101, 103, 107, 145, 149, 151, 153, 155, 157, 159, 161, 163, 167 ] }
static const char *FUNC_0(uint8_t VAR_0) { static const char *VAR_1[] = { [ TEST_UNIT_READY ] = "TEST_UNIT_READY", [ REQUEST_SENSE ] = "REQUEST_SENSE", [ FORMAT_UNIT ] = "FORMAT_UNIT", [ READ_BLOCK_LIMITS ] = "READ_BLOCK_LIMITS", [ REASSIGN_BLOCKS ] = "REASSIGN_BLOCKS", [ READ_6 ] = "READ_6", [ WRITE_6 ] = "WRITE_6", [ SEEK_6 ] = "SEEK_6", [ READ_REVERSE ] = "READ_REVERSE", [ WRITE_FILEMARKS ] = "WRITE_FILEMARKS", [ SPACE ] = "SPACE", [ INQUIRY ] = "INQUIRY", [ RECOVER_BUFFERED_DATA ] = "RECOVER_BUFFERED_DATA", [ MAINTENANCE_IN ] = "MAINTENANCE_IN", [ MAINTENANCE_OUT ] = "MAINTENANCE_OUT", [ MODE_SELECT ] = "MODE_SELECT", [ RESERVE ] = "RESERVE", [ RELEASE ] = "RELEASE", [ COPY ] = "COPY", [ ERASE ] = "ERASE", [ MODE_SENSE ] = "MODE_SENSE", [ START_STOP ] = "START_STOP", [ RECEIVE_DIAGNOSTIC ] = "RECEIVE_DIAGNOSTIC", [ SEND_DIAGNOSTIC ] = "SEND_DIAGNOSTIC", [ ALLOW_MEDIUM_REMOVAL ] = "ALLOW_MEDIUM_REMOVAL", [ READ_CAPACITY ] = "READ_CAPACITY", [ READ_10 ] = "READ_10", [ WRITE_10 ] = "WRITE_10", [ SEEK_10 ] = "SEEK_10", [ WRITE_VERIFY ] = "WRITE_VERIFY", [ VERIFY ] = "VERIFY", [ SEARCH_HIGH ] = "SEARCH_HIGH", [ SEARCH_EQUAL ] = "SEARCH_EQUAL", [ SEARCH_LOW ] = "SEARCH_LOW", [ SET_LIMITS ] = "SET_LIMITS", [ PRE_FETCH ] = "PRE_FETCH", [ SYNCHRONIZE_CACHE ] = "SYNCHRONIZE_CACHE", [ LOCK_UNLOCK_CACHE ] = "LOCK_UNLOCK_CACHE", [ READ_DEFECT_DATA ] = "READ_DEFECT_DATA", [ MEDIUM_SCAN ] = "MEDIUM_SCAN", [ COMPARE ] = "COMPARE", [ COPY_VERIFY ] = "COPY_VERIFY", [ WRITE_BUFFER ] = "WRITE_BUFFER", [ READ_BUFFER ] = "READ_BUFFER", [ UPDATE_BLOCK ] = "UPDATE_BLOCK", [ READ_LONG ] = "READ_LONG", [ WRITE_LONG ] = "WRITE_LONG", [ CHANGE_DEFINITION ] = "CHANGE_DEFINITION", [ WRITE_SAME ] = "WRITE_SAME", [ READ_TOC ] = "READ_TOC", [ LOG_SELECT ] = "LOG_SELECT", [ LOG_SENSE ] = "LOG_SENSE", [ MODE_SELECT_10 ] = "MODE_SELECT_10", [ RESERVE_10 ] = "RESERVE_10", [ RELEASE_10 ] = "RELEASE_10", [ MODE_SENSE_10 ] = "MODE_SENSE_10", [ PERSISTENT_RESERVE_IN ] = "PERSISTENT_RESERVE_IN", [ PERSISTENT_RESERVE_OUT ] = "PERSISTENT_RESERVE_OUT", [ MOVE_MEDIUM ] = "MOVE_MEDIUM", [ READ_12 ] = "READ_12", [ WRITE_12 ] = "WRITE_12", [ WRITE_VERIFY_12 ] = "WRITE_VERIFY_12", [ SEARCH_HIGH_12 ] = "SEARCH_HIGH_12", [ SEARCH_EQUAL_12 ] = "SEARCH_EQUAL_12", [ SEARCH_LOW_12 ] = "SEARCH_LOW_12", [ READ_ELEMENT_STATUS ] = "READ_ELEMENT_STATUS", [ SEND_VOLUME_TAG ] = "SEND_VOLUME_TAG", [ WRITE_LONG_2 ] = "WRITE_LONG_2", [ REPORT_DENSITY_SUPPORT ] = "REPORT_DENSITY_SUPPORT", [ GET_CONFIGURATION ] = "GET_CONFIGURATION", [ READ_16 ] = "READ_16", [ WRITE_16 ] = "WRITE_16", [ WRITE_VERIFY_16 ] = "WRITE_VERIFY_16", [ SERVICE_ACTION_IN ] = "SERVICE_ACTION_IN", [ REPORT_LUNS ] = "REPORT_LUNS", [ LOAD_UNLOAD ] = "LOAD_UNLOAD", [ SET_CD_SPEED ] = "SET_CD_SPEED", [ BLANK ] = "BLANK", }; if (VAR_0 >= ARRAY_SIZE(VAR_1) || VAR_1[VAR_0] == NULL) return "*UNKNOWN*"; return VAR_1[VAR_0]; }
[ "static const char *FUNC_0(uint8_t VAR_0)\n{", "static const char *VAR_1[] = {", "[ TEST_UNIT_READY ] = \"TEST_UNIT_READY\",\n[ REQUEST_SENSE ] = \"REQUEST_SENSE\",\n[ FORMAT_UNIT ] = \"FORMAT_UNIT\",\n[ READ_BLOCK_LIMITS ] = \"READ_BLOCK_LIMITS\",\n[ REASSIGN_BLOCKS ] = \"REASSIGN_BLOCKS\",\n[ READ_6 ] = \"READ_6\",\n[ WRITE_6 ] = \"WRITE_6\",\n[ SEEK_6 ] = \"SEEK_6\",\n[ READ_REVERSE ] = \"READ_REVERSE\",\n[ WRITE_FILEMARKS ] = \"WRITE_FILEMARKS\",\n[ SPACE ] = \"SPACE\",\n[ INQUIRY ] = \"INQUIRY\",\n[ RECOVER_BUFFERED_DATA ] = \"RECOVER_BUFFERED_DATA\",\n[ MAINTENANCE_IN ] = \"MAINTENANCE_IN\",\n[ MAINTENANCE_OUT ] = \"MAINTENANCE_OUT\",\n[ MODE_SELECT ] = \"MODE_SELECT\",\n[ RESERVE ] = \"RESERVE\",\n[ RELEASE ] = \"RELEASE\",\n[ COPY ] = \"COPY\",\n[ ERASE ] = \"ERASE\",\n[ MODE_SENSE ] = \"MODE_SENSE\",\n[ START_STOP ] = \"START_STOP\",\n[ RECEIVE_DIAGNOSTIC ] = \"RECEIVE_DIAGNOSTIC\",\n[ SEND_DIAGNOSTIC ] = \"SEND_DIAGNOSTIC\",\n[ ALLOW_MEDIUM_REMOVAL ] = \"ALLOW_MEDIUM_REMOVAL\",\n[ READ_CAPACITY ] = \"READ_CAPACITY\",\n[ READ_10 ] = \"READ_10\",\n[ WRITE_10 ] = \"WRITE_10\",\n[ SEEK_10 ] = \"SEEK_10\",\n[ WRITE_VERIFY ] = \"WRITE_VERIFY\",\n[ VERIFY ] = \"VERIFY\",\n[ SEARCH_HIGH ] = \"SEARCH_HIGH\",\n[ SEARCH_EQUAL ] = \"SEARCH_EQUAL\",\n[ SEARCH_LOW ] = \"SEARCH_LOW\",\n[ SET_LIMITS ] = \"SET_LIMITS\",\n[ PRE_FETCH ] = \"PRE_FETCH\",\n[ SYNCHRONIZE_CACHE ] = \"SYNCHRONIZE_CACHE\",\n[ LOCK_UNLOCK_CACHE ] = \"LOCK_UNLOCK_CACHE\",\n[ READ_DEFECT_DATA ] = \"READ_DEFECT_DATA\",\n[ MEDIUM_SCAN ] = \"MEDIUM_SCAN\",\n[ COMPARE ] = \"COMPARE\",\n[ COPY_VERIFY ] = \"COPY_VERIFY\",\n[ WRITE_BUFFER ] = \"WRITE_BUFFER\",\n[ READ_BUFFER ] = \"READ_BUFFER\",\n[ UPDATE_BLOCK ] = \"UPDATE_BLOCK\",\n[ READ_LONG ] = \"READ_LONG\",\n[ WRITE_LONG ] = \"WRITE_LONG\",\n[ CHANGE_DEFINITION ] = \"CHANGE_DEFINITION\",\n[ WRITE_SAME ] = \"WRITE_SAME\",\n[ READ_TOC ] = \"READ_TOC\",\n[ LOG_SELECT ] = \"LOG_SELECT\",\n[ LOG_SENSE ] = \"LOG_SENSE\",\n[ MODE_SELECT_10 ] = \"MODE_SELECT_10\",\n[ RESERVE_10 ] = \"RESERVE_10\",\n[ RELEASE_10 ] = \"RELEASE_10\",\n[ MODE_SENSE_10 ] = \"MODE_SENSE_10\",\n[ PERSISTENT_RESERVE_IN ] = \"PERSISTENT_RESERVE_IN\",\n[ PERSISTENT_RESERVE_OUT ] = \"PERSISTENT_RESERVE_OUT\",\n[ MOVE_MEDIUM ] = \"MOVE_MEDIUM\",\n[ READ_12 ] = \"READ_12\",\n[ WRITE_12 ] = \"WRITE_12\",\n[ WRITE_VERIFY_12 ] = \"WRITE_VERIFY_12\",\n[ SEARCH_HIGH_12 ] = \"SEARCH_HIGH_12\",\n[ SEARCH_EQUAL_12 ] = \"SEARCH_EQUAL_12\",\n[ SEARCH_LOW_12 ] = \"SEARCH_LOW_12\",\n[ READ_ELEMENT_STATUS ] = \"READ_ELEMENT_STATUS\",\n[ SEND_VOLUME_TAG ] = \"SEND_VOLUME_TAG\",\n[ WRITE_LONG_2 ] = \"WRITE_LONG_2\",\n[ REPORT_DENSITY_SUPPORT ] = \"REPORT_DENSITY_SUPPORT\",\n[ GET_CONFIGURATION ] = \"GET_CONFIGURATION\",\n[ READ_16 ] = \"READ_16\",\n[ WRITE_16 ] = \"WRITE_16\",\n[ WRITE_VERIFY_16 ] = \"WRITE_VERIFY_16\",\n[ SERVICE_ACTION_IN ] = \"SERVICE_ACTION_IN\",\n[ REPORT_LUNS ] = \"REPORT_LUNS\",\n[ LOAD_UNLOAD ] = \"LOAD_UNLOAD\",\n[ SET_CD_SPEED ] = \"SET_CD_SPEED\",\n[ BLANK ] = \"BLANK\",\n};", "if (VAR_0 >= ARRAY_SIZE(VAR_1) || VAR_1[VAR_0] == NULL)\nreturn \"*UNKNOWN*\";", "return VAR_1[VAR_0];", "}" ]
[ 0, 0, 1, 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, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 83, 85, 87, 89, 91, 93, 95, 97, 99, 101, 103, 105, 107, 109, 111, 113, 115, 117, 119, 121, 123, 125, 127, 129, 131, 133, 135, 137, 139, 141, 143, 145, 149, 151, 153, 155, 157, 159, 161, 163, 165, 167, 169 ], [ 173, 175 ], [ 177 ], [ 179 ] ]
12,609
X264_close(AVCodecContext *avctx) { X264Context *x4 = avctx->priv_data; if(x4->enc) x264_encoder_close(x4->enc); return 0; }
true
FFmpeg
5c4e97282f52d4045bd4498805f508ca50b313dd
X264_close(AVCodecContext *avctx) { X264Context *x4 = avctx->priv_data; if(x4->enc) x264_encoder_close(x4->enc); return 0; }
{ "code": [], "line_no": [] }
FUNC_0(AVCodecContext *VAR_0) { X264Context *x4 = VAR_0->priv_data; if(x4->enc) x264_encoder_close(x4->enc); return 0; }
[ "FUNC_0(AVCodecContext *VAR_0)\n{", "X264Context *x4 = VAR_0->priv_data;", "if(x4->enc)\nx264_encoder_close(x4->enc);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 2 ], [ 3 ], [ 4, 5 ], [ 6 ], [ 7 ] ]
12,610
static void synthfilt_build_sb_samples (QDM2Context *q, GetBitContext *gb, int length, int sb_min, int sb_max) { int sb, j, k, n, ch, run, channels; int joined_stereo, zero_encoding, chs; int type34_first; float type34_div = 0; float type34_predictor; float samples[10], sign_bits[16]; if (length == 0) { // If no data use noise for (sb=sb_min; sb < sb_max; sb++) build_sb_samples_from_noise (q, sb); return; } for (sb = sb_min; sb < sb_max; sb++) { FIX_NOISE_IDX(q->noise_idx); channels = q->nb_channels; if (q->nb_channels <= 1 || sb < 12) joined_stereo = 0; else if (sb >= 24) joined_stereo = 1; else joined_stereo = (BITS_LEFT(length,gb) >= 1) ? get_bits1 (gb) : 0; if (joined_stereo) { if (BITS_LEFT(length,gb) >= 16) for (j = 0; j < 16; j++) sign_bits[j] = get_bits1 (gb); for (j = 0; j < 64; j++) if (q->coding_method[1][sb][j] > q->coding_method[0][sb][j]) q->coding_method[0][sb][j] = q->coding_method[1][sb][j]; fix_coding_method_array(sb, q->nb_channels, q->coding_method); channels = 1; } for (ch = 0; ch < channels; ch++) { zero_encoding = (BITS_LEFT(length,gb) >= 1) ? get_bits1(gb) : 0; type34_predictor = 0.0; type34_first = 1; for (j = 0; j < 128; ) { switch (q->coding_method[ch][sb][j / 2]) { case 8: if (BITS_LEFT(length,gb) >= 10) { if (zero_encoding) { for (k = 0; k < 5; k++) { if ((j + 2 * k) >= 128) break; samples[2 * k] = get_bits1(gb) ? dequant_1bit[joined_stereo][2 * get_bits1(gb)] : 0; } } else { n = get_bits(gb, 8); for (k = 0; k < 5; k++) samples[2 * k] = dequant_1bit[joined_stereo][random_dequant_index[n][k]]; } for (k = 0; k < 5; k++) samples[2 * k + 1] = SB_DITHERING_NOISE(sb,q->noise_idx); } else { for (k = 0; k < 10; k++) samples[k] = SB_DITHERING_NOISE(sb,q->noise_idx); } run = 10; break; case 10: if (BITS_LEFT(length,gb) >= 1) { float f = 0.81; if (get_bits1(gb)) f = -f; f -= noise_samples[((sb + 1) * (j +5 * ch + 1)) & 127] * 9.0 / 40.0; samples[0] = f; } else { samples[0] = SB_DITHERING_NOISE(sb,q->noise_idx); } run = 1; break; case 16: if (BITS_LEFT(length,gb) >= 10) { if (zero_encoding) { for (k = 0; k < 5; k++) { if ((j + k) >= 128) break; samples[k] = (get_bits1(gb) == 0) ? 0 : dequant_1bit[joined_stereo][2 * get_bits1(gb)]; } } else { n = get_bits (gb, 8); for (k = 0; k < 5; k++) samples[k] = dequant_1bit[joined_stereo][random_dequant_index[n][k]]; } } else { for (k = 0; k < 5; k++) samples[k] = SB_DITHERING_NOISE(sb,q->noise_idx); } run = 5; break; case 24: if (BITS_LEFT(length,gb) >= 7) { n = get_bits(gb, 7); for (k = 0; k < 3; k++) samples[k] = (random_dequant_type24[n][k] - 2.0) * 0.5; } else { for (k = 0; k < 3; k++) samples[k] = SB_DITHERING_NOISE(sb,q->noise_idx); } run = 3; break; case 30: if (BITS_LEFT(length,gb) >= 4) samples[0] = type30_dequant[qdm2_get_vlc(gb, &vlc_tab_type30, 0, 1)]; else samples[0] = SB_DITHERING_NOISE(sb,q->noise_idx); run = 1; break; case 34: if (BITS_LEFT(length,gb) >= 7) { if (type34_first) { type34_div = (float)(1 << get_bits(gb, 2)); samples[0] = ((float)get_bits(gb, 5) - 16.0) / 15.0; type34_predictor = samples[0]; type34_first = 0; } else { samples[0] = type34_delta[qdm2_get_vlc(gb, &vlc_tab_type34, 0, 1)] / type34_div + type34_predictor; type34_predictor = samples[0]; } } else { samples[0] = SB_DITHERING_NOISE(sb,q->noise_idx); } run = 1; break; default: samples[0] = SB_DITHERING_NOISE(sb,q->noise_idx); run = 1; break; } if (joined_stereo) { float tmp[10][MPA_MAX_CHANNELS]; for (k = 0; k < run; k++) { tmp[k][0] = samples[k]; tmp[k][1] = (sign_bits[(j + k) / 8]) ? -samples[k] : samples[k]; } for (chs = 0; chs < q->nb_channels; chs++) for (k = 0; k < run; k++) if ((j + k) < 128) q->sb_samples[chs][j + k][sb] = q->tone_level[chs][sb][((j + k)/2)] * tmp[k][chs]; } else { for (k = 0; k < run; k++) if ((j + k) < 128) q->sb_samples[ch][j + k][sb] = q->tone_level[ch][sb][(j + k)/2] * samples[k]; } j += run; } // j loop } // channel loop } // subband loop }
false
FFmpeg
7d74aaf6985e0f286e10c851e4d7e80fd687a774
static void synthfilt_build_sb_samples (QDM2Context *q, GetBitContext *gb, int length, int sb_min, int sb_max) { int sb, j, k, n, ch, run, channels; int joined_stereo, zero_encoding, chs; int type34_first; float type34_div = 0; float type34_predictor; float samples[10], sign_bits[16]; if (length == 0) { for (sb=sb_min; sb < sb_max; sb++) build_sb_samples_from_noise (q, sb); return; } for (sb = sb_min; sb < sb_max; sb++) { FIX_NOISE_IDX(q->noise_idx); channels = q->nb_channels; if (q->nb_channels <= 1 || sb < 12) joined_stereo = 0; else if (sb >= 24) joined_stereo = 1; else joined_stereo = (BITS_LEFT(length,gb) >= 1) ? get_bits1 (gb) : 0; if (joined_stereo) { if (BITS_LEFT(length,gb) >= 16) for (j = 0; j < 16; j++) sign_bits[j] = get_bits1 (gb); for (j = 0; j < 64; j++) if (q->coding_method[1][sb][j] > q->coding_method[0][sb][j]) q->coding_method[0][sb][j] = q->coding_method[1][sb][j]; fix_coding_method_array(sb, q->nb_channels, q->coding_method); channels = 1; } for (ch = 0; ch < channels; ch++) { zero_encoding = (BITS_LEFT(length,gb) >= 1) ? get_bits1(gb) : 0; type34_predictor = 0.0; type34_first = 1; for (j = 0; j < 128; ) { switch (q->coding_method[ch][sb][j / 2]) { case 8: if (BITS_LEFT(length,gb) >= 10) { if (zero_encoding) { for (k = 0; k < 5; k++) { if ((j + 2 * k) >= 128) break; samples[2 * k] = get_bits1(gb) ? dequant_1bit[joined_stereo][2 * get_bits1(gb)] : 0; } } else { n = get_bits(gb, 8); for (k = 0; k < 5; k++) samples[2 * k] = dequant_1bit[joined_stereo][random_dequant_index[n][k]]; } for (k = 0; k < 5; k++) samples[2 * k + 1] = SB_DITHERING_NOISE(sb,q->noise_idx); } else { for (k = 0; k < 10; k++) samples[k] = SB_DITHERING_NOISE(sb,q->noise_idx); } run = 10; break; case 10: if (BITS_LEFT(length,gb) >= 1) { float f = 0.81; if (get_bits1(gb)) f = -f; f -= noise_samples[((sb + 1) * (j +5 * ch + 1)) & 127] * 9.0 / 40.0; samples[0] = f; } else { samples[0] = SB_DITHERING_NOISE(sb,q->noise_idx); } run = 1; break; case 16: if (BITS_LEFT(length,gb) >= 10) { if (zero_encoding) { for (k = 0; k < 5; k++) { if ((j + k) >= 128) break; samples[k] = (get_bits1(gb) == 0) ? 0 : dequant_1bit[joined_stereo][2 * get_bits1(gb)]; } } else { n = get_bits (gb, 8); for (k = 0; k < 5; k++) samples[k] = dequant_1bit[joined_stereo][random_dequant_index[n][k]]; } } else { for (k = 0; k < 5; k++) samples[k] = SB_DITHERING_NOISE(sb,q->noise_idx); } run = 5; break; case 24: if (BITS_LEFT(length,gb) >= 7) { n = get_bits(gb, 7); for (k = 0; k < 3; k++) samples[k] = (random_dequant_type24[n][k] - 2.0) * 0.5; } else { for (k = 0; k < 3; k++) samples[k] = SB_DITHERING_NOISE(sb,q->noise_idx); } run = 3; break; case 30: if (BITS_LEFT(length,gb) >= 4) samples[0] = type30_dequant[qdm2_get_vlc(gb, &vlc_tab_type30, 0, 1)]; else samples[0] = SB_DITHERING_NOISE(sb,q->noise_idx); run = 1; break; case 34: if (BITS_LEFT(length,gb) >= 7) { if (type34_first) { type34_div = (float)(1 << get_bits(gb, 2)); samples[0] = ((float)get_bits(gb, 5) - 16.0) / 15.0; type34_predictor = samples[0]; type34_first = 0; } else { samples[0] = type34_delta[qdm2_get_vlc(gb, &vlc_tab_type34, 0, 1)] / type34_div + type34_predictor; type34_predictor = samples[0]; } } else { samples[0] = SB_DITHERING_NOISE(sb,q->noise_idx); } run = 1; break; default: samples[0] = SB_DITHERING_NOISE(sb,q->noise_idx); run = 1; break; } if (joined_stereo) { float tmp[10][MPA_MAX_CHANNELS]; for (k = 0; k < run; k++) { tmp[k][0] = samples[k]; tmp[k][1] = (sign_bits[(j + k) / 8]) ? -samples[k] : samples[k]; } for (chs = 0; chs < q->nb_channels; chs++) for (k = 0; k < run; k++) if ((j + k) < 128) q->sb_samples[chs][j + k][sb] = q->tone_level[chs][sb][((j + k)/2)] * tmp[k][chs]; } else { for (k = 0; k < run; k++) if ((j + k) < 128) q->sb_samples[ch][j + k][sb] = q->tone_level[ch][sb][(j + k)/2] * samples[k]; } j += run; } } } }
{ "code": [], "line_no": [] }
static void FUNC_0 (QDM2Context *VAR_0, GetBitContext *VAR_1, int VAR_2, int VAR_3, int VAR_4) { int VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_11; int VAR_12, VAR_13, VAR_14; int VAR_15; float VAR_16 = 0; float VAR_17; float VAR_18[10], VAR_19[16]; if (VAR_2 == 0) { for (VAR_5=VAR_3; VAR_5 < VAR_4; VAR_5++) build_sb_samples_from_noise (VAR_0, VAR_5); return; } for (VAR_5 = VAR_3; VAR_5 < VAR_4; VAR_5++) { FIX_NOISE_IDX(VAR_0->noise_idx); VAR_11 = VAR_0->nb_channels; if (VAR_0->nb_channels <= 1 || VAR_5 < 12) VAR_12 = 0; else if (VAR_5 >= 24) VAR_12 = 1; else VAR_12 = (BITS_LEFT(VAR_2,VAR_1) >= 1) ? get_bits1 (VAR_1) : 0; if (VAR_12) { if (BITS_LEFT(VAR_2,VAR_1) >= 16) for (VAR_6 = 0; VAR_6 < 16; VAR_6++) VAR_19[VAR_6] = get_bits1 (VAR_1); for (VAR_6 = 0; VAR_6 < 64; VAR_6++) if (VAR_0->coding_method[1][VAR_5][VAR_6] > VAR_0->coding_method[0][VAR_5][VAR_6]) VAR_0->coding_method[0][VAR_5][VAR_6] = VAR_0->coding_method[1][VAR_5][VAR_6]; fix_coding_method_array(VAR_5, VAR_0->nb_channels, VAR_0->coding_method); VAR_11 = 1; } for (VAR_9 = 0; VAR_9 < VAR_11; VAR_9++) { VAR_13 = (BITS_LEFT(VAR_2,VAR_1) >= 1) ? get_bits1(VAR_1) : 0; VAR_17 = 0.0; VAR_15 = 1; for (VAR_6 = 0; VAR_6 < 128; ) { switch (VAR_0->coding_method[VAR_9][VAR_5][VAR_6 / 2]) { case 8: if (BITS_LEFT(VAR_2,VAR_1) >= 10) { if (VAR_13) { for (VAR_7 = 0; VAR_7 < 5; VAR_7++) { if ((VAR_6 + 2 * VAR_7) >= 128) break; VAR_18[2 * VAR_7] = get_bits1(VAR_1) ? dequant_1bit[VAR_12][2 * get_bits1(VAR_1)] : 0; } } else { VAR_8 = get_bits(VAR_1, 8); for (VAR_7 = 0; VAR_7 < 5; VAR_7++) VAR_18[2 * VAR_7] = dequant_1bit[VAR_12][random_dequant_index[VAR_8][VAR_7]]; } for (VAR_7 = 0; VAR_7 < 5; VAR_7++) VAR_18[2 * VAR_7 + 1] = SB_DITHERING_NOISE(VAR_5,VAR_0->noise_idx); } else { for (VAR_7 = 0; VAR_7 < 10; VAR_7++) VAR_18[VAR_7] = SB_DITHERING_NOISE(VAR_5,VAR_0->noise_idx); } VAR_10 = 10; break; case 10: if (BITS_LEFT(VAR_2,VAR_1) >= 1) { float VAR_20 = 0.81; if (get_bits1(VAR_1)) VAR_20 = -VAR_20; VAR_20 -= noise_samples[((VAR_5 + 1) * (VAR_6 +5 * VAR_9 + 1)) & 127] * 9.0 / 40.0; VAR_18[0] = VAR_20; } else { VAR_18[0] = SB_DITHERING_NOISE(VAR_5,VAR_0->noise_idx); } VAR_10 = 1; break; case 16: if (BITS_LEFT(VAR_2,VAR_1) >= 10) { if (VAR_13) { for (VAR_7 = 0; VAR_7 < 5; VAR_7++) { if ((VAR_6 + VAR_7) >= 128) break; VAR_18[VAR_7] = (get_bits1(VAR_1) == 0) ? 0 : dequant_1bit[VAR_12][2 * get_bits1(VAR_1)]; } } else { VAR_8 = get_bits (VAR_1, 8); for (VAR_7 = 0; VAR_7 < 5; VAR_7++) VAR_18[VAR_7] = dequant_1bit[VAR_12][random_dequant_index[VAR_8][VAR_7]]; } } else { for (VAR_7 = 0; VAR_7 < 5; VAR_7++) VAR_18[VAR_7] = SB_DITHERING_NOISE(VAR_5,VAR_0->noise_idx); } VAR_10 = 5; break; case 24: if (BITS_LEFT(VAR_2,VAR_1) >= 7) { VAR_8 = get_bits(VAR_1, 7); for (VAR_7 = 0; VAR_7 < 3; VAR_7++) VAR_18[VAR_7] = (random_dequant_type24[VAR_8][VAR_7] - 2.0) * 0.5; } else { for (VAR_7 = 0; VAR_7 < 3; VAR_7++) VAR_18[VAR_7] = SB_DITHERING_NOISE(VAR_5,VAR_0->noise_idx); } VAR_10 = 3; break; case 30: if (BITS_LEFT(VAR_2,VAR_1) >= 4) VAR_18[0] = type30_dequant[qdm2_get_vlc(VAR_1, &vlc_tab_type30, 0, 1)]; else VAR_18[0] = SB_DITHERING_NOISE(VAR_5,VAR_0->noise_idx); VAR_10 = 1; break; case 34: if (BITS_LEFT(VAR_2,VAR_1) >= 7) { if (VAR_15) { VAR_16 = (float)(1 << get_bits(VAR_1, 2)); VAR_18[0] = ((float)get_bits(VAR_1, 5) - 16.0) / 15.0; VAR_17 = VAR_18[0]; VAR_15 = 0; } else { VAR_18[0] = type34_delta[qdm2_get_vlc(VAR_1, &vlc_tab_type34, 0, 1)] / VAR_16 + VAR_17; VAR_17 = VAR_18[0]; } } else { VAR_18[0] = SB_DITHERING_NOISE(VAR_5,VAR_0->noise_idx); } VAR_10 = 1; break; default: VAR_18[0] = SB_DITHERING_NOISE(VAR_5,VAR_0->noise_idx); VAR_10 = 1; break; } if (VAR_12) { float VAR_21[10][MPA_MAX_CHANNELS]; for (VAR_7 = 0; VAR_7 < VAR_10; VAR_7++) { VAR_21[VAR_7][0] = VAR_18[VAR_7]; VAR_21[VAR_7][1] = (VAR_19[(VAR_6 + VAR_7) / 8]) ? -VAR_18[VAR_7] : VAR_18[VAR_7]; } for (VAR_14 = 0; VAR_14 < VAR_0->nb_channels; VAR_14++) for (VAR_7 = 0; VAR_7 < VAR_10; VAR_7++) if ((VAR_6 + VAR_7) < 128) VAR_0->sb_samples[VAR_14][VAR_6 + VAR_7][VAR_5] = VAR_0->tone_level[VAR_14][VAR_5][((VAR_6 + VAR_7)/2)] * VAR_21[VAR_7][VAR_14]; } else { for (VAR_7 = 0; VAR_7 < VAR_10; VAR_7++) if ((VAR_6 + VAR_7) < 128) VAR_0->sb_samples[VAR_9][VAR_6 + VAR_7][VAR_5] = VAR_0->tone_level[VAR_9][VAR_5][(VAR_6 + VAR_7)/2] * VAR_18[VAR_7]; } VAR_6 += VAR_10; } } } }
[ "static void FUNC_0 (QDM2Context *VAR_0, GetBitContext *VAR_1, int VAR_2, int VAR_3, int VAR_4)\n{", "int VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_11;", "int VAR_12, VAR_13, VAR_14;", "int VAR_15;", "float VAR_16 = 0;", "float VAR_17;", "float VAR_18[10], VAR_19[16];", "if (VAR_2 == 0) {", "for (VAR_5=VAR_3; VAR_5 < VAR_4; VAR_5++)", "build_sb_samples_from_noise (VAR_0, VAR_5);", "return;", "}", "for (VAR_5 = VAR_3; VAR_5 < VAR_4; VAR_5++) {", "FIX_NOISE_IDX(VAR_0->noise_idx);", "VAR_11 = VAR_0->nb_channels;", "if (VAR_0->nb_channels <= 1 || VAR_5 < 12)\nVAR_12 = 0;", "else if (VAR_5 >= 24)\nVAR_12 = 1;", "else\nVAR_12 = (BITS_LEFT(VAR_2,VAR_1) >= 1) ? get_bits1 (VAR_1) : 0;", "if (VAR_12) {", "if (BITS_LEFT(VAR_2,VAR_1) >= 16)\nfor (VAR_6 = 0; VAR_6 < 16; VAR_6++)", "VAR_19[VAR_6] = get_bits1 (VAR_1);", "for (VAR_6 = 0; VAR_6 < 64; VAR_6++)", "if (VAR_0->coding_method[1][VAR_5][VAR_6] > VAR_0->coding_method[0][VAR_5][VAR_6])\nVAR_0->coding_method[0][VAR_5][VAR_6] = VAR_0->coding_method[1][VAR_5][VAR_6];", "fix_coding_method_array(VAR_5, VAR_0->nb_channels, VAR_0->coding_method);", "VAR_11 = 1;", "}", "for (VAR_9 = 0; VAR_9 < VAR_11; VAR_9++) {", "VAR_13 = (BITS_LEFT(VAR_2,VAR_1) >= 1) ? get_bits1(VAR_1) : 0;", "VAR_17 = 0.0;", "VAR_15 = 1;", "for (VAR_6 = 0; VAR_6 < 128; ) {", "switch (VAR_0->coding_method[VAR_9][VAR_5][VAR_6 / 2]) {", "case 8:\nif (BITS_LEFT(VAR_2,VAR_1) >= 10) {", "if (VAR_13) {", "for (VAR_7 = 0; VAR_7 < 5; VAR_7++) {", "if ((VAR_6 + 2 * VAR_7) >= 128)\nbreak;", "VAR_18[2 * VAR_7] = get_bits1(VAR_1) ? dequant_1bit[VAR_12][2 * get_bits1(VAR_1)] : 0;", "}", "} else {", "VAR_8 = get_bits(VAR_1, 8);", "for (VAR_7 = 0; VAR_7 < 5; VAR_7++)", "VAR_18[2 * VAR_7] = dequant_1bit[VAR_12][random_dequant_index[VAR_8][VAR_7]];", "}", "for (VAR_7 = 0; VAR_7 < 5; VAR_7++)", "VAR_18[2 * VAR_7 + 1] = SB_DITHERING_NOISE(VAR_5,VAR_0->noise_idx);", "} else {", "for (VAR_7 = 0; VAR_7 < 10; VAR_7++)", "VAR_18[VAR_7] = SB_DITHERING_NOISE(VAR_5,VAR_0->noise_idx);", "}", "VAR_10 = 10;", "break;", "case 10:\nif (BITS_LEFT(VAR_2,VAR_1) >= 1) {", "float VAR_20 = 0.81;", "if (get_bits1(VAR_1))\nVAR_20 = -VAR_20;", "VAR_20 -= noise_samples[((VAR_5 + 1) * (VAR_6 +5 * VAR_9 + 1)) & 127] * 9.0 / 40.0;", "VAR_18[0] = VAR_20;", "} else {", "VAR_18[0] = SB_DITHERING_NOISE(VAR_5,VAR_0->noise_idx);", "}", "VAR_10 = 1;", "break;", "case 16:\nif (BITS_LEFT(VAR_2,VAR_1) >= 10) {", "if (VAR_13) {", "for (VAR_7 = 0; VAR_7 < 5; VAR_7++) {", "if ((VAR_6 + VAR_7) >= 128)\nbreak;", "VAR_18[VAR_7] = (get_bits1(VAR_1) == 0) ? 0 : dequant_1bit[VAR_12][2 * get_bits1(VAR_1)];", "}", "} else {", "VAR_8 = get_bits (VAR_1, 8);", "for (VAR_7 = 0; VAR_7 < 5; VAR_7++)", "VAR_18[VAR_7] = dequant_1bit[VAR_12][random_dequant_index[VAR_8][VAR_7]];", "}", "} else {", "for (VAR_7 = 0; VAR_7 < 5; VAR_7++)", "VAR_18[VAR_7] = SB_DITHERING_NOISE(VAR_5,VAR_0->noise_idx);", "}", "VAR_10 = 5;", "break;", "case 24:\nif (BITS_LEFT(VAR_2,VAR_1) >= 7) {", "VAR_8 = get_bits(VAR_1, 7);", "for (VAR_7 = 0; VAR_7 < 3; VAR_7++)", "VAR_18[VAR_7] = (random_dequant_type24[VAR_8][VAR_7] - 2.0) * 0.5;", "} else {", "for (VAR_7 = 0; VAR_7 < 3; VAR_7++)", "VAR_18[VAR_7] = SB_DITHERING_NOISE(VAR_5,VAR_0->noise_idx);", "}", "VAR_10 = 3;", "break;", "case 30:\nif (BITS_LEFT(VAR_2,VAR_1) >= 4)\nVAR_18[0] = type30_dequant[qdm2_get_vlc(VAR_1, &vlc_tab_type30, 0, 1)];", "else\nVAR_18[0] = SB_DITHERING_NOISE(VAR_5,VAR_0->noise_idx);", "VAR_10 = 1;", "break;", "case 34:\nif (BITS_LEFT(VAR_2,VAR_1) >= 7) {", "if (VAR_15) {", "VAR_16 = (float)(1 << get_bits(VAR_1, 2));", "VAR_18[0] = ((float)get_bits(VAR_1, 5) - 16.0) / 15.0;", "VAR_17 = VAR_18[0];", "VAR_15 = 0;", "} else {", "VAR_18[0] = type34_delta[qdm2_get_vlc(VAR_1, &vlc_tab_type34, 0, 1)] / VAR_16 + VAR_17;", "VAR_17 = VAR_18[0];", "}", "} else {", "VAR_18[0] = SB_DITHERING_NOISE(VAR_5,VAR_0->noise_idx);", "}", "VAR_10 = 1;", "break;", "default:\nVAR_18[0] = SB_DITHERING_NOISE(VAR_5,VAR_0->noise_idx);", "VAR_10 = 1;", "break;", "}", "if (VAR_12) {", "float VAR_21[10][MPA_MAX_CHANNELS];", "for (VAR_7 = 0; VAR_7 < VAR_10; VAR_7++) {", "VAR_21[VAR_7][0] = VAR_18[VAR_7];", "VAR_21[VAR_7][1] = (VAR_19[(VAR_6 + VAR_7) / 8]) ? -VAR_18[VAR_7] : VAR_18[VAR_7];", "}", "for (VAR_14 = 0; VAR_14 < VAR_0->nb_channels; VAR_14++)", "for (VAR_7 = 0; VAR_7 < VAR_10; VAR_7++)", "if ((VAR_6 + VAR_7) < 128)\nVAR_0->sb_samples[VAR_14][VAR_6 + VAR_7][VAR_5] = VAR_0->tone_level[VAR_14][VAR_5][((VAR_6 + VAR_7)/2)] * VAR_21[VAR_7][VAR_14];", "} else {", "for (VAR_7 = 0; VAR_7 < VAR_10; VAR_7++)", "if ((VAR_6 + VAR_7) < 128)\nVAR_0->sb_samples[VAR_9][VAR_6 + VAR_7][VAR_5] = VAR_0->tone_level[VAR_9][VAR_5][(VAR_6 + VAR_7)/2] * VAR_18[VAR_7];", "}", "VAR_6 += VAR_10;", "}", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 41 ], [ 45, 47 ], [ 49, 51 ], [ 53, 55 ], [ 59 ], [ 61, 63 ], [ 65 ], [ 69 ], [ 71, 73 ], [ 77 ], [ 79 ], [ 81 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 95 ], [ 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 ], [ 151, 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 171, 173 ], [ 175 ], [ 177 ], [ 179, 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 211, 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 235, 237, 239 ], [ 241, 243 ], [ 247 ], [ 249 ], [ 253, 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 287, 289 ], [ 291 ], [ 293 ], [ 295 ], [ 299 ], [ 301 ], [ 305 ], [ 307 ], [ 309 ], [ 311 ], [ 313 ], [ 315 ], [ 317, 319 ], [ 321 ], [ 323 ], [ 325, 327 ], [ 329 ], [ 333 ], [ 335 ], [ 337 ], [ 339 ], [ 341 ] ]
12,611
static void opt_target(const char *arg) { enum { PAL, NTSC, FILM, UNKNOWN } norm = UNKNOWN; static const char *const frame_rates[] = {"25", "30000/1001", "24000/1001"}; if(!strncmp(arg, "pal-", 4)) { norm = PAL; arg += 4; } else if(!strncmp(arg, "ntsc-", 5)) { norm = NTSC; arg += 5; } else if(!strncmp(arg, "film-", 5)) { norm = FILM; arg += 5; } else { int fr; /* Calculate FR via float to avoid int overflow */ fr = (int)(frame_rate.num * 1000.0 / frame_rate.den); if(fr == 25000) { norm = PAL; } else if((fr == 29970) || (fr == 23976)) { norm = NTSC; } else { /* Try to determine PAL/NTSC by peeking in the input files */ if(nb_input_files) { int i, j; for(j = 0; j < nb_input_files; j++) { for(i = 0; i < input_files[j]->nb_streams; i++) { AVCodecContext *c = input_files[j]->streams[i]->codec; if(c->codec_type != AVMEDIA_TYPE_VIDEO) continue; fr = c->time_base.den * 1000 / c->time_base.num; if(fr == 25000) { norm = PAL; break; } else if((fr == 29970) || (fr == 23976)) { norm = NTSC; break; } } if(norm != UNKNOWN) break; } } } if(verbose && norm != UNKNOWN) fprintf(stderr, "Assuming %s for target.\n", norm == PAL ? "PAL" : "NTSC"); } if(norm == UNKNOWN) { fprintf(stderr, "Could not determine norm (PAL/NTSC/NTSC-Film) for target.\n"); fprintf(stderr, "Please prefix target with \"pal-\", \"ntsc-\" or \"film-\",\n"); fprintf(stderr, "or set a framerate with \"-r xxx\".\n"); ffmpeg_exit(1); } if(!strcmp(arg, "vcd")) { opt_video_codec("mpeg1video"); opt_audio_codec("mp2"); opt_format("vcd"); opt_frame_size(norm == PAL ? "352x288" : "352x240"); opt_frame_rate(NULL, frame_rates[norm]); opt_default("g", norm == PAL ? "15" : "18"); opt_default("b", "1150000"); opt_default("maxrate", "1150000"); opt_default("minrate", "1150000"); opt_default("bufsize", "327680"); // 40*1024*8; opt_default("ab", "224000"); audio_sample_rate = 44100; audio_channels = 2; opt_default("packetsize", "2324"); opt_default("muxrate", "1411200"); // 2352 * 75 * 8; /* We have to offset the PTS, so that it is consistent with the SCR. SCR starts at 36000, but the first two packs contain only padding and the first pack from the other stream, respectively, may also have been written before. So the real data starts at SCR 36000+3*1200. */ mux_preload= (36000+3*1200) / 90000.0; //0.44 } else if(!strcmp(arg, "svcd")) { opt_video_codec("mpeg2video"); opt_audio_codec("mp2"); opt_format("svcd"); opt_frame_size(norm == PAL ? "480x576" : "480x480"); opt_frame_rate(NULL, frame_rates[norm]); opt_default("g", norm == PAL ? "15" : "18"); opt_default("b", "2040000"); opt_default("maxrate", "2516000"); opt_default("minrate", "0"); //1145000; opt_default("bufsize", "1835008"); //224*1024*8; opt_default("flags", "+scan_offset"); opt_default("ab", "224000"); audio_sample_rate = 44100; opt_default("packetsize", "2324"); } else if(!strcmp(arg, "dvd")) { opt_video_codec("mpeg2video"); opt_audio_codec("ac3"); opt_format("dvd"); opt_frame_size(norm == PAL ? "720x576" : "720x480"); opt_frame_rate(NULL, frame_rates[norm]); opt_default("g", norm == PAL ? "15" : "18"); opt_default("b", "6000000"); opt_default("maxrate", "9000000"); opt_default("minrate", "0"); //1500000; opt_default("bufsize", "1835008"); //224*1024*8; opt_default("packetsize", "2048"); // from www.mpucoder.com: DVD sectors contain 2048 bytes of data, this is also the size of one pack. opt_default("muxrate", "10080000"); // from mplex project: data_rate = 1260000. mux_rate = data_rate * 8 opt_default("ab", "448000"); audio_sample_rate = 48000; } else if(!strncmp(arg, "dv", 2)) { opt_format("dv"); opt_frame_size(norm == PAL ? "720x576" : "720x480"); opt_frame_pix_fmt(!strncmp(arg, "dv50", 4) ? "yuv422p" : (norm == PAL ? "yuv420p" : "yuv411p")); opt_frame_rate(NULL, frame_rates[norm]); audio_sample_rate = 48000; audio_channels = 2; } else { fprintf(stderr, "Unknown target: %s\n", arg); ffmpeg_exit(1); } }
false
FFmpeg
d1991f51f3298e91f9e4cca1f581b486fbd29ec3
static void opt_target(const char *arg) { enum { PAL, NTSC, FILM, UNKNOWN } norm = UNKNOWN; static const char *const frame_rates[] = {"25", "30000/1001", "24000/1001"}; if(!strncmp(arg, "pal-", 4)) { norm = PAL; arg += 4; } else if(!strncmp(arg, "ntsc-", 5)) { norm = NTSC; arg += 5; } else if(!strncmp(arg, "film-", 5)) { norm = FILM; arg += 5; } else { int fr; fr = (int)(frame_rate.num * 1000.0 / frame_rate.den); if(fr == 25000) { norm = PAL; } else if((fr == 29970) || (fr == 23976)) { norm = NTSC; } else { if(nb_input_files) { int i, j; for(j = 0; j < nb_input_files; j++) { for(i = 0; i < input_files[j]->nb_streams; i++) { AVCodecContext *c = input_files[j]->streams[i]->codec; if(c->codec_type != AVMEDIA_TYPE_VIDEO) continue; fr = c->time_base.den * 1000 / c->time_base.num; if(fr == 25000) { norm = PAL; break; } else if((fr == 29970) || (fr == 23976)) { norm = NTSC; break; } } if(norm != UNKNOWN) break; } } } if(verbose && norm != UNKNOWN) fprintf(stderr, "Assuming %s for target.\n", norm == PAL ? "PAL" : "NTSC"); } if(norm == UNKNOWN) { fprintf(stderr, "Could not determine norm (PAL/NTSC/NTSC-Film) for target.\n"); fprintf(stderr, "Please prefix target with \"pal-\", \"ntsc-\" or \"film-\",\n"); fprintf(stderr, "or set a framerate with \"-r xxx\".\n"); ffmpeg_exit(1); } if(!strcmp(arg, "vcd")) { opt_video_codec("mpeg1video"); opt_audio_codec("mp2"); opt_format("vcd"); opt_frame_size(norm == PAL ? "352x288" : "352x240"); opt_frame_rate(NULL, frame_rates[norm]); opt_default("g", norm == PAL ? "15" : "18"); opt_default("b", "1150000"); opt_default("maxrate", "1150000"); opt_default("minrate", "1150000"); opt_default("bufsize", "327680"); opt_default("ab", "224000"); audio_sample_rate = 44100; audio_channels = 2; opt_default("packetsize", "2324"); opt_default("muxrate", "1411200"); mux_preload= (36000+3*1200) / 90000.0; } else if(!strcmp(arg, "svcd")) { opt_video_codec("mpeg2video"); opt_audio_codec("mp2"); opt_format("svcd"); opt_frame_size(norm == PAL ? "480x576" : "480x480"); opt_frame_rate(NULL, frame_rates[norm]); opt_default("g", norm == PAL ? "15" : "18"); opt_default("b", "2040000"); opt_default("maxrate", "2516000"); opt_default("minrate", "0"); opt_default("bufsize", "1835008"); opt_default("flags", "+scan_offset"); opt_default("ab", "224000"); audio_sample_rate = 44100; opt_default("packetsize", "2324"); } else if(!strcmp(arg, "dvd")) { opt_video_codec("mpeg2video"); opt_audio_codec("ac3"); opt_format("dvd"); opt_frame_size(norm == PAL ? "720x576" : "720x480"); opt_frame_rate(NULL, frame_rates[norm]); opt_default("g", norm == PAL ? "15" : "18"); opt_default("b", "6000000"); opt_default("maxrate", "9000000"); opt_default("minrate", "0"); opt_default("bufsize", "1835008"); opt_default("packetsize", "2048"); opt_default("muxrate", "10080000"); opt_default("ab", "448000"); audio_sample_rate = 48000; } else if(!strncmp(arg, "dv", 2)) { opt_format("dv"); opt_frame_size(norm == PAL ? "720x576" : "720x480"); opt_frame_pix_fmt(!strncmp(arg, "dv50", 4) ? "yuv422p" : (norm == PAL ? "yuv420p" : "yuv411p")); opt_frame_rate(NULL, frame_rates[norm]); audio_sample_rate = 48000; audio_channels = 2; } else { fprintf(stderr, "Unknown target: %s\n", arg); ffmpeg_exit(1); } }
{ "code": [], "line_no": [] }
static void FUNC_0(const char *VAR_0) { enum { PAL, NTSC, FILM, UNKNOWN } VAR_1 = UNKNOWN; static const char *const VAR_2[] = {"25", "30000/1001", "24000/1001"}; if(!strncmp(VAR_0, "pal-", 4)) { VAR_1 = PAL; VAR_0 += 4; } else if(!strncmp(VAR_0, "ntsc-", 5)) { VAR_1 = NTSC; VAR_0 += 5; } else if(!strncmp(VAR_0, "film-", 5)) { VAR_1 = FILM; VAR_0 += 5; } else { int VAR_3; VAR_3 = (int)(frame_rate.num * 1000.0 / frame_rate.den); if(VAR_3 == 25000) { VAR_1 = PAL; } else if((VAR_3 == 29970) || (VAR_3 == 23976)) { VAR_1 = NTSC; } else { if(nb_input_files) { int VAR_4, VAR_5; for(VAR_5 = 0; VAR_5 < nb_input_files; VAR_5++) { for(VAR_4 = 0; VAR_4 < input_files[VAR_5]->nb_streams; VAR_4++) { AVCodecContext *c = input_files[VAR_5]->streams[VAR_4]->codec; if(c->codec_type != AVMEDIA_TYPE_VIDEO) continue; VAR_3 = c->time_base.den * 1000 / c->time_base.num; if(VAR_3 == 25000) { VAR_1 = PAL; break; } else if((VAR_3 == 29970) || (VAR_3 == 23976)) { VAR_1 = NTSC; break; } } if(VAR_1 != UNKNOWN) break; } } } if(verbose && VAR_1 != UNKNOWN) fprintf(stderr, "Assuming %s for target.\n", VAR_1 == PAL ? "PAL" : "NTSC"); } if(VAR_1 == UNKNOWN) { fprintf(stderr, "Could not determine VAR_1 (PAL/NTSC/NTSC-Film) for target.\n"); fprintf(stderr, "Please prefix target with \"pal-\", \"ntsc-\" or \"film-\",\n"); fprintf(stderr, "or set a framerate with \"-r xxx\".\n"); ffmpeg_exit(1); } if(!strcmp(VAR_0, "vcd")) { opt_video_codec("mpeg1video"); opt_audio_codec("mp2"); opt_format("vcd"); opt_frame_size(VAR_1 == PAL ? "352x288" : "352x240"); opt_frame_rate(NULL, VAR_2[VAR_1]); opt_default("g", VAR_1 == PAL ? "15" : "18"); opt_default("b", "1150000"); opt_default("maxrate", "1150000"); opt_default("minrate", "1150000"); opt_default("bufsize", "327680"); opt_default("ab", "224000"); audio_sample_rate = 44100; audio_channels = 2; opt_default("packetsize", "2324"); opt_default("muxrate", "1411200"); mux_preload= (36000+3*1200) / 90000.0; } else if(!strcmp(VAR_0, "svcd")) { opt_video_codec("mpeg2video"); opt_audio_codec("mp2"); opt_format("svcd"); opt_frame_size(VAR_1 == PAL ? "480x576" : "480x480"); opt_frame_rate(NULL, VAR_2[VAR_1]); opt_default("g", VAR_1 == PAL ? "15" : "18"); opt_default("b", "2040000"); opt_default("maxrate", "2516000"); opt_default("minrate", "0"); opt_default("bufsize", "1835008"); opt_default("flags", "+scan_offset"); opt_default("ab", "224000"); audio_sample_rate = 44100; opt_default("packetsize", "2324"); } else if(!strcmp(VAR_0, "dvd")) { opt_video_codec("mpeg2video"); opt_audio_codec("ac3"); opt_format("dvd"); opt_frame_size(VAR_1 == PAL ? "720x576" : "720x480"); opt_frame_rate(NULL, VAR_2[VAR_1]); opt_default("g", VAR_1 == PAL ? "15" : "18"); opt_default("b", "6000000"); opt_default("maxrate", "9000000"); opt_default("minrate", "0"); opt_default("bufsize", "1835008"); opt_default("packetsize", "2048"); opt_default("muxrate", "10080000"); opt_default("ab", "448000"); audio_sample_rate = 48000; } else if(!strncmp(VAR_0, "dv", 2)) { opt_format("dv"); opt_frame_size(VAR_1 == PAL ? "720x576" : "720x480"); opt_frame_pix_fmt(!strncmp(VAR_0, "dv50", 4) ? "yuv422p" : (VAR_1 == PAL ? "yuv420p" : "yuv411p")); opt_frame_rate(NULL, VAR_2[VAR_1]); audio_sample_rate = 48000; audio_channels = 2; } else { fprintf(stderr, "Unknown target: %s\n", VAR_0); ffmpeg_exit(1); } }
[ "static void FUNC_0(const char *VAR_0)\n{", "enum { PAL, NTSC, FILM, UNKNOWN } VAR_1 = UNKNOWN;", "static const char *const VAR_2[] = {\"25\", \"30000/1001\", \"24000/1001\"};", "if(!strncmp(VAR_0, \"pal-\", 4)) {", "VAR_1 = PAL;", "VAR_0 += 4;", "} else if(!strncmp(VAR_0, \"ntsc-\", 5)) {", "VAR_1 = NTSC;", "VAR_0 += 5;", "} else if(!strncmp(VAR_0, \"film-\", 5)) {", "VAR_1 = FILM;", "VAR_0 += 5;", "} else {", "int VAR_3;", "VAR_3 = (int)(frame_rate.num * 1000.0 / frame_rate.den);", "if(VAR_3 == 25000) {", "VAR_1 = PAL;", "} else if((VAR_3 == 29970) || (VAR_3 == 23976)) {", "VAR_1 = NTSC;", "} else {", "if(nb_input_files) {", "int VAR_4, VAR_5;", "for(VAR_5 = 0; VAR_5 < nb_input_files; VAR_5++) {", "for(VAR_4 = 0; VAR_4 < input_files[VAR_5]->nb_streams; VAR_4++) {", "AVCodecContext *c = input_files[VAR_5]->streams[VAR_4]->codec;", "if(c->codec_type != AVMEDIA_TYPE_VIDEO)\ncontinue;", "VAR_3 = c->time_base.den * 1000 / c->time_base.num;", "if(VAR_3 == 25000) {", "VAR_1 = PAL;", "break;", "} else if((VAR_3 == 29970) || (VAR_3 == 23976)) {", "VAR_1 = NTSC;", "break;", "}", "}", "if(VAR_1 != UNKNOWN)\nbreak;", "}", "}", "}", "if(verbose && VAR_1 != UNKNOWN)\nfprintf(stderr, \"Assuming %s for target.\\n\", VAR_1 == PAL ? \"PAL\" : \"NTSC\");", "}", "if(VAR_1 == UNKNOWN) {", "fprintf(stderr, \"Could not determine VAR_1 (PAL/NTSC/NTSC-Film) for target.\\n\");", "fprintf(stderr, \"Please prefix target with \\\"pal-\\\", \\\"ntsc-\\\" or \\\"film-\\\",\\n\");", "fprintf(stderr, \"or set a framerate with \\\"-r xxx\\\".\\n\");", "ffmpeg_exit(1);", "}", "if(!strcmp(VAR_0, \"vcd\")) {", "opt_video_codec(\"mpeg1video\");", "opt_audio_codec(\"mp2\");", "opt_format(\"vcd\");", "opt_frame_size(VAR_1 == PAL ? \"352x288\" : \"352x240\");", "opt_frame_rate(NULL, VAR_2[VAR_1]);", "opt_default(\"g\", VAR_1 == PAL ? \"15\" : \"18\");", "opt_default(\"b\", \"1150000\");", "opt_default(\"maxrate\", \"1150000\");", "opt_default(\"minrate\", \"1150000\");", "opt_default(\"bufsize\", \"327680\");", "opt_default(\"ab\", \"224000\");", "audio_sample_rate = 44100;", "audio_channels = 2;", "opt_default(\"packetsize\", \"2324\");", "opt_default(\"muxrate\", \"1411200\");", "mux_preload= (36000+3*1200) / 90000.0;", "} else if(!strcmp(VAR_0, \"svcd\")) {", "opt_video_codec(\"mpeg2video\");", "opt_audio_codec(\"mp2\");", "opt_format(\"svcd\");", "opt_frame_size(VAR_1 == PAL ? \"480x576\" : \"480x480\");", "opt_frame_rate(NULL, VAR_2[VAR_1]);", "opt_default(\"g\", VAR_1 == PAL ? \"15\" : \"18\");", "opt_default(\"b\", \"2040000\");", "opt_default(\"maxrate\", \"2516000\");", "opt_default(\"minrate\", \"0\");", "opt_default(\"bufsize\", \"1835008\");", "opt_default(\"flags\", \"+scan_offset\");", "opt_default(\"ab\", \"224000\");", "audio_sample_rate = 44100;", "opt_default(\"packetsize\", \"2324\");", "} else if(!strcmp(VAR_0, \"dvd\")) {", "opt_video_codec(\"mpeg2video\");", "opt_audio_codec(\"ac3\");", "opt_format(\"dvd\");", "opt_frame_size(VAR_1 == PAL ? \"720x576\" : \"720x480\");", "opt_frame_rate(NULL, VAR_2[VAR_1]);", "opt_default(\"g\", VAR_1 == PAL ? \"15\" : \"18\");", "opt_default(\"b\", \"6000000\");", "opt_default(\"maxrate\", \"9000000\");", "opt_default(\"minrate\", \"0\");", "opt_default(\"bufsize\", \"1835008\");", "opt_default(\"packetsize\", \"2048\");", "opt_default(\"muxrate\", \"10080000\");", "opt_default(\"ab\", \"448000\");", "audio_sample_rate = 48000;", "} else if(!strncmp(VAR_0, \"dv\", 2)) {", "opt_format(\"dv\");", "opt_frame_size(VAR_1 == PAL ? \"720x576\" : \"720x480\");", "opt_frame_pix_fmt(!strncmp(VAR_0, \"dv50\", 4) ? \"yuv422p\" :\n(VAR_1 == PAL ? \"yuv420p\" : \"yuv411p\"));", "opt_frame_rate(NULL, VAR_2[VAR_1]);", "audio_sample_rate = 48000;", "audio_channels = 2;", "} else {", "fprintf(stderr, \"Unknown target: %s\\n\", VAR_0);", "ffmpeg_exit(1);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59, 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81, 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91, 93 ], [ 95 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 113 ], [ 117 ], [ 119 ], [ 121 ], [ 125 ], [ 127 ], [ 129 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 143 ], [ 145 ], [ 147 ], [ 151 ], [ 153 ], [ 167 ], [ 169 ], [ 173 ], [ 175 ], [ 177 ], [ 181 ], [ 183 ], [ 185 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 203 ], [ 205 ], [ 209 ], [ 213 ], [ 217 ], [ 219 ], [ 221 ], [ 225 ], [ 227 ], [ 229 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 243 ], [ 245 ], [ 249 ], [ 251 ], [ 255 ], [ 259 ], [ 263 ], [ 265, 267 ], [ 269 ], [ 273 ], [ 275 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 287 ] ]
12,612
static int decode_init(AVCodecContext *avctx) { LclContext * const c = (LclContext *)avctx->priv_data; int basesize = avctx->width * avctx->height; int zret; // Zlib return code c->avctx = avctx; avctx->has_b_frames = 0; c->pic.data[0] = NULL; #ifdef CONFIG_ZLIB // Needed if zlib unused or init aborted before inflateInit memset(&(c->zstream), 0, sizeof(z_stream)); #endif if (avctx->extradata_size < 8) { av_log(avctx, AV_LOG_ERROR, "Extradata size too small.\n"); return 1; } /* Check codec type */ if (((avctx->codec_id == CODEC_ID_MSZH) && (*((char *)avctx->extradata + 7) != CODEC_MSZH)) || ((avctx->codec_id == CODEC_ID_ZLIB) && (*((char *)avctx->extradata + 7) != CODEC_ZLIB))) { av_log(avctx, AV_LOG_ERROR, "Codec id and codec type mismatch. This should not happen.\n"); } /* Detect image type */ switch (c->imgtype = *((char *)avctx->extradata + 4)) { case IMGTYPE_YUV111: c->decomp_size = basesize * 3; av_log(avctx, AV_LOG_INFO, "Image type is YUV 1:1:1.\n"); break; case IMGTYPE_YUV422: c->decomp_size = basesize * 2; av_log(avctx, AV_LOG_INFO, "Image type is YUV 4:2:2.\n"); break; case IMGTYPE_RGB24: c->decomp_size = basesize * 3; av_log(avctx, AV_LOG_INFO, "Image type is RGB 24.\n"); break; case IMGTYPE_YUV411: c->decomp_size = basesize / 2 * 3; av_log(avctx, AV_LOG_INFO, "Image type is YUV 4:1:1.\n"); break; case IMGTYPE_YUV211: c->decomp_size = basesize * 2; av_log(avctx, AV_LOG_INFO, "Image type is YUV 2:1:1.\n"); break; case IMGTYPE_YUV420: c->decomp_size = basesize / 2 * 3; av_log(avctx, AV_LOG_INFO, "Image type is YUV 4:2:0.\n"); break; default: av_log(avctx, AV_LOG_ERROR, "Unsupported image format %d.\n", c->imgtype); return 1; } /* Detect compression method */ c->compression = *((char *)avctx->extradata + 5); switch (avctx->codec_id) { case CODEC_ID_MSZH: switch (c->compression) { case COMP_MSZH: av_log(avctx, AV_LOG_INFO, "Compression enabled.\n"); break; case COMP_MSZH_NOCOMP: c->decomp_size = 0; av_log(avctx, AV_LOG_INFO, "No compression.\n"); break; default: av_log(avctx, AV_LOG_ERROR, "Unsupported compression format for MSZH (%d).\n", c->compression); return 1; } break; case CODEC_ID_ZLIB: #ifdef CONFIG_ZLIB switch (c->compression) { case COMP_ZLIB_HISPEED: av_log(avctx, AV_LOG_INFO, "High speed compression.\n"); break; case COMP_ZLIB_HICOMP: av_log(avctx, AV_LOG_INFO, "High compression.\n"); break; case COMP_ZLIB_NORMAL: av_log(avctx, AV_LOG_INFO, "Normal compression.\n"); break; default: if ((c->compression < Z_NO_COMPRESSION) || (c->compression > Z_BEST_COMPRESSION)) { av_log(avctx, AV_LOG_ERROR, "Unusupported compression level for ZLIB: (%d).\n", c->compression); return 1; } av_log(avctx, AV_LOG_INFO, "Compression level for ZLIB: (%d).\n", c->compression); } #else av_log(avctx, AV_LOG_ERROR, "Zlib support not compiled.\n"); return 1; #endif break; default: av_log(avctx, AV_LOG_ERROR, "BUG! Unknown codec in compression switch.\n"); return 1; } /* Allocate decompression buffer */ /* 4*8 max overflow space for mszh decomp algorithm */ if (c->decomp_size) { if ((c->decomp_buf = av_malloc(c->decomp_size+4*8)) == NULL) { av_log(avctx, AV_LOG_ERROR, "Can't allocate decompression buffer.\n"); return 1; } } /* Detect flags */ c->flags = *((char *)avctx->extradata + 6); if (c->flags & FLAG_MULTITHREAD) av_log(avctx, AV_LOG_INFO, "Multithread encoder flag set.\n"); if (c->flags & FLAG_NULLFRAME) av_log(avctx, AV_LOG_INFO, "Nullframe insertion flag set.\n"); if ((avctx->codec_id == CODEC_ID_ZLIB) && (c->flags & FLAG_PNGFILTER)) av_log(avctx, AV_LOG_INFO, "PNG filter flag set.\n"); if (c->flags & FLAGMASK_UNUSED) av_log(avctx, AV_LOG_ERROR, "Unknown flag set (%d).\n", c->flags); /* If needed init zlib */ if (avctx->codec_id == CODEC_ID_ZLIB) { #ifdef CONFIG_ZLIB c->zstream.zalloc = Z_NULL; c->zstream.zfree = Z_NULL; c->zstream.opaque = Z_NULL; zret = inflateInit(&(c->zstream)); if (zret != Z_OK) { av_log(avctx, AV_LOG_ERROR, "Inflate init error: %d\n", zret); return 1; } #else av_log(avctx, AV_LOG_ERROR, "Zlib support not compiled.\n"); return 1; #endif } avctx->pix_fmt = PIX_FMT_BGR24; return 0; }
true
FFmpeg
c31b81216619e6b3d986ce63c82357993e10e8e9
static int decode_init(AVCodecContext *avctx) { LclContext * const c = (LclContext *)avctx->priv_data; int basesize = avctx->width * avctx->height; int zret; c->avctx = avctx; avctx->has_b_frames = 0; c->pic.data[0] = NULL; #ifdef CONFIG_ZLIB memset(&(c->zstream), 0, sizeof(z_stream)); #endif if (avctx->extradata_size < 8) { av_log(avctx, AV_LOG_ERROR, "Extradata size too small.\n"); return 1; } if (((avctx->codec_id == CODEC_ID_MSZH) && (*((char *)avctx->extradata + 7) != CODEC_MSZH)) || ((avctx->codec_id == CODEC_ID_ZLIB) && (*((char *)avctx->extradata + 7) != CODEC_ZLIB))) { av_log(avctx, AV_LOG_ERROR, "Codec id and codec type mismatch. This should not happen.\n"); } switch (c->imgtype = *((char *)avctx->extradata + 4)) { case IMGTYPE_YUV111: c->decomp_size = basesize * 3; av_log(avctx, AV_LOG_INFO, "Image type is YUV 1:1:1.\n"); break; case IMGTYPE_YUV422: c->decomp_size = basesize * 2; av_log(avctx, AV_LOG_INFO, "Image type is YUV 4:2:2.\n"); break; case IMGTYPE_RGB24: c->decomp_size = basesize * 3; av_log(avctx, AV_LOG_INFO, "Image type is RGB 24.\n"); break; case IMGTYPE_YUV411: c->decomp_size = basesize / 2 * 3; av_log(avctx, AV_LOG_INFO, "Image type is YUV 4:1:1.\n"); break; case IMGTYPE_YUV211: c->decomp_size = basesize * 2; av_log(avctx, AV_LOG_INFO, "Image type is YUV 2:1:1.\n"); break; case IMGTYPE_YUV420: c->decomp_size = basesize / 2 * 3; av_log(avctx, AV_LOG_INFO, "Image type is YUV 4:2:0.\n"); break; default: av_log(avctx, AV_LOG_ERROR, "Unsupported image format %d.\n", c->imgtype); return 1; } c->compression = *((char *)avctx->extradata + 5); switch (avctx->codec_id) { case CODEC_ID_MSZH: switch (c->compression) { case COMP_MSZH: av_log(avctx, AV_LOG_INFO, "Compression enabled.\n"); break; case COMP_MSZH_NOCOMP: c->decomp_size = 0; av_log(avctx, AV_LOG_INFO, "No compression.\n"); break; default: av_log(avctx, AV_LOG_ERROR, "Unsupported compression format for MSZH (%d).\n", c->compression); return 1; } break; case CODEC_ID_ZLIB: #ifdef CONFIG_ZLIB switch (c->compression) { case COMP_ZLIB_HISPEED: av_log(avctx, AV_LOG_INFO, "High speed compression.\n"); break; case COMP_ZLIB_HICOMP: av_log(avctx, AV_LOG_INFO, "High compression.\n"); break; case COMP_ZLIB_NORMAL: av_log(avctx, AV_LOG_INFO, "Normal compression.\n"); break; default: if ((c->compression < Z_NO_COMPRESSION) || (c->compression > Z_BEST_COMPRESSION)) { av_log(avctx, AV_LOG_ERROR, "Unusupported compression level for ZLIB: (%d).\n", c->compression); return 1; } av_log(avctx, AV_LOG_INFO, "Compression level for ZLIB: (%d).\n", c->compression); } #else av_log(avctx, AV_LOG_ERROR, "Zlib support not compiled.\n"); return 1; #endif break; default: av_log(avctx, AV_LOG_ERROR, "BUG! Unknown codec in compression switch.\n"); return 1; } if (c->decomp_size) { if ((c->decomp_buf = av_malloc(c->decomp_size+4*8)) == NULL) { av_log(avctx, AV_LOG_ERROR, "Can't allocate decompression buffer.\n"); return 1; } } c->flags = *((char *)avctx->extradata + 6); if (c->flags & FLAG_MULTITHREAD) av_log(avctx, AV_LOG_INFO, "Multithread encoder flag set.\n"); if (c->flags & FLAG_NULLFRAME) av_log(avctx, AV_LOG_INFO, "Nullframe insertion flag set.\n"); if ((avctx->codec_id == CODEC_ID_ZLIB) && (c->flags & FLAG_PNGFILTER)) av_log(avctx, AV_LOG_INFO, "PNG filter flag set.\n"); if (c->flags & FLAGMASK_UNUSED) av_log(avctx, AV_LOG_ERROR, "Unknown flag set (%d).\n", c->flags); if (avctx->codec_id == CODEC_ID_ZLIB) { #ifdef CONFIG_ZLIB c->zstream.zalloc = Z_NULL; c->zstream.zfree = Z_NULL; c->zstream.opaque = Z_NULL; zret = inflateInit(&(c->zstream)); if (zret != Z_OK) { av_log(avctx, AV_LOG_ERROR, "Inflate init error: %d\n", zret); return 1; } #else av_log(avctx, AV_LOG_ERROR, "Zlib support not compiled.\n"); return 1; #endif } avctx->pix_fmt = PIX_FMT_BGR24; return 0; }
{ "code": [ " int basesize = avctx->width * avctx->height;", " if ((c->decomp_buf = av_malloc(c->decomp_size+4*8)) == NULL) {" ], "line_no": [ 7, 215 ] }
static int FUNC_0(AVCodecContext *VAR_0) { LclContext * const c = (LclContext *)VAR_0->priv_data; int VAR_1 = VAR_0->width * VAR_0->height; int VAR_2; c->VAR_0 = VAR_0; VAR_0->has_b_frames = 0; c->pic.data[0] = NULL; #ifdef CONFIG_ZLIB memset(&(c->zstream), 0, sizeof(z_stream)); #endif if (VAR_0->extradata_size < 8) { av_log(VAR_0, AV_LOG_ERROR, "Extradata size too small.\n"); return 1; } if (((VAR_0->codec_id == CODEC_ID_MSZH) && (*((char *)VAR_0->extradata + 7) != CODEC_MSZH)) || ((VAR_0->codec_id == CODEC_ID_ZLIB) && (*((char *)VAR_0->extradata + 7) != CODEC_ZLIB))) { av_log(VAR_0, AV_LOG_ERROR, "Codec id and codec type mismatch. This should not happen.\n"); } switch (c->imgtype = *((char *)VAR_0->extradata + 4)) { case IMGTYPE_YUV111: c->decomp_size = VAR_1 * 3; av_log(VAR_0, AV_LOG_INFO, "Image type is YUV 1:1:1.\n"); break; case IMGTYPE_YUV422: c->decomp_size = VAR_1 * 2; av_log(VAR_0, AV_LOG_INFO, "Image type is YUV 4:2:2.\n"); break; case IMGTYPE_RGB24: c->decomp_size = VAR_1 * 3; av_log(VAR_0, AV_LOG_INFO, "Image type is RGB 24.\n"); break; case IMGTYPE_YUV411: c->decomp_size = VAR_1 / 2 * 3; av_log(VAR_0, AV_LOG_INFO, "Image type is YUV 4:1:1.\n"); break; case IMGTYPE_YUV211: c->decomp_size = VAR_1 * 2; av_log(VAR_0, AV_LOG_INFO, "Image type is YUV 2:1:1.\n"); break; case IMGTYPE_YUV420: c->decomp_size = VAR_1 / 2 * 3; av_log(VAR_0, AV_LOG_INFO, "Image type is YUV 4:2:0.\n"); break; default: av_log(VAR_0, AV_LOG_ERROR, "Unsupported image format %d.\n", c->imgtype); return 1; } c->compression = *((char *)VAR_0->extradata + 5); switch (VAR_0->codec_id) { case CODEC_ID_MSZH: switch (c->compression) { case COMP_MSZH: av_log(VAR_0, AV_LOG_INFO, "Compression enabled.\n"); break; case COMP_MSZH_NOCOMP: c->decomp_size = 0; av_log(VAR_0, AV_LOG_INFO, "No compression.\n"); break; default: av_log(VAR_0, AV_LOG_ERROR, "Unsupported compression format for MSZH (%d).\n", c->compression); return 1; } break; case CODEC_ID_ZLIB: #ifdef CONFIG_ZLIB switch (c->compression) { case COMP_ZLIB_HISPEED: av_log(VAR_0, AV_LOG_INFO, "High speed compression.\n"); break; case COMP_ZLIB_HICOMP: av_log(VAR_0, AV_LOG_INFO, "High compression.\n"); break; case COMP_ZLIB_NORMAL: av_log(VAR_0, AV_LOG_INFO, "Normal compression.\n"); break; default: if ((c->compression < Z_NO_COMPRESSION) || (c->compression > Z_BEST_COMPRESSION)) { av_log(VAR_0, AV_LOG_ERROR, "Unusupported compression level for ZLIB: (%d).\n", c->compression); return 1; } av_log(VAR_0, AV_LOG_INFO, "Compression level for ZLIB: (%d).\n", c->compression); } #else av_log(VAR_0, AV_LOG_ERROR, "Zlib support not compiled.\n"); return 1; #endif break; default: av_log(VAR_0, AV_LOG_ERROR, "BUG! Unknown codec in compression switch.\n"); return 1; } if (c->decomp_size) { if ((c->decomp_buf = av_malloc(c->decomp_size+4*8)) == NULL) { av_log(VAR_0, AV_LOG_ERROR, "Can't allocate decompression buffer.\n"); return 1; } } c->flags = *((char *)VAR_0->extradata + 6); if (c->flags & FLAG_MULTITHREAD) av_log(VAR_0, AV_LOG_INFO, "Multithread encoder flag set.\n"); if (c->flags & FLAG_NULLFRAME) av_log(VAR_0, AV_LOG_INFO, "Nullframe insertion flag set.\n"); if ((VAR_0->codec_id == CODEC_ID_ZLIB) && (c->flags & FLAG_PNGFILTER)) av_log(VAR_0, AV_LOG_INFO, "PNG filter flag set.\n"); if (c->flags & FLAGMASK_UNUSED) av_log(VAR_0, AV_LOG_ERROR, "Unknown flag set (%d).\n", c->flags); if (VAR_0->codec_id == CODEC_ID_ZLIB) { #ifdef CONFIG_ZLIB c->zstream.zalloc = Z_NULL; c->zstream.zfree = Z_NULL; c->zstream.opaque = Z_NULL; VAR_2 = inflateInit(&(c->zstream)); if (VAR_2 != Z_OK) { av_log(VAR_0, AV_LOG_ERROR, "Inflate init error: %d\n", VAR_2); return 1; } #else av_log(VAR_0, AV_LOG_ERROR, "Zlib support not compiled.\n"); return 1; #endif } VAR_0->pix_fmt = PIX_FMT_BGR24; return 0; }
[ "static int FUNC_0(AVCodecContext *VAR_0)\n{", "LclContext * const c = (LclContext *)VAR_0->priv_data;", "int VAR_1 = VAR_0->width * VAR_0->height;", "int VAR_2;", "c->VAR_0 = VAR_0;", "VAR_0->has_b_frames = 0;", "c->pic.data[0] = NULL;", "#ifdef CONFIG_ZLIB\nmemset(&(c->zstream), 0, sizeof(z_stream));", "#endif\nif (VAR_0->extradata_size < 8) {", "av_log(VAR_0, AV_LOG_ERROR, \"Extradata size too small.\\n\");", "return 1;", "}", "if (((VAR_0->codec_id == CODEC_ID_MSZH) && (*((char *)VAR_0->extradata + 7) != CODEC_MSZH)) ||\n((VAR_0->codec_id == CODEC_ID_ZLIB) && (*((char *)VAR_0->extradata + 7) != CODEC_ZLIB))) {", "av_log(VAR_0, AV_LOG_ERROR, \"Codec id and codec type mismatch. This should not happen.\\n\");", "}", "switch (c->imgtype = *((char *)VAR_0->extradata + 4)) {", "case IMGTYPE_YUV111:\nc->decomp_size = VAR_1 * 3;", "av_log(VAR_0, AV_LOG_INFO, \"Image type is YUV 1:1:1.\\n\");", "break;", "case IMGTYPE_YUV422:\nc->decomp_size = VAR_1 * 2;", "av_log(VAR_0, AV_LOG_INFO, \"Image type is YUV 4:2:2.\\n\");", "break;", "case IMGTYPE_RGB24:\nc->decomp_size = VAR_1 * 3;", "av_log(VAR_0, AV_LOG_INFO, \"Image type is RGB 24.\\n\");", "break;", "case IMGTYPE_YUV411:\nc->decomp_size = VAR_1 / 2 * 3;", "av_log(VAR_0, AV_LOG_INFO, \"Image type is YUV 4:1:1.\\n\");", "break;", "case IMGTYPE_YUV211:\nc->decomp_size = VAR_1 * 2;", "av_log(VAR_0, AV_LOG_INFO, \"Image type is YUV 2:1:1.\\n\");", "break;", "case IMGTYPE_YUV420:\nc->decomp_size = VAR_1 / 2 * 3;", "av_log(VAR_0, AV_LOG_INFO, \"Image type is YUV 4:2:0.\\n\");", "break;", "default:\nav_log(VAR_0, AV_LOG_ERROR, \"Unsupported image format %d.\\n\", c->imgtype);", "return 1;", "}", "c->compression = *((char *)VAR_0->extradata + 5);", "switch (VAR_0->codec_id) {", "case CODEC_ID_MSZH:\nswitch (c->compression) {", "case COMP_MSZH:\nav_log(VAR_0, AV_LOG_INFO, \"Compression enabled.\\n\");", "break;", "case COMP_MSZH_NOCOMP:\nc->decomp_size = 0;", "av_log(VAR_0, AV_LOG_INFO, \"No compression.\\n\");", "break;", "default:\nav_log(VAR_0, AV_LOG_ERROR, \"Unsupported compression format for MSZH (%d).\\n\", c->compression);", "return 1;", "}", "break;", "case CODEC_ID_ZLIB:\n#ifdef CONFIG_ZLIB\nswitch (c->compression) {", "case COMP_ZLIB_HISPEED:\nav_log(VAR_0, AV_LOG_INFO, \"High speed compression.\\n\");", "break;", "case COMP_ZLIB_HICOMP:\nav_log(VAR_0, AV_LOG_INFO, \"High compression.\\n\");", "break;", "case COMP_ZLIB_NORMAL:\nav_log(VAR_0, AV_LOG_INFO, \"Normal compression.\\n\");", "break;", "default:\nif ((c->compression < Z_NO_COMPRESSION) || (c->compression > Z_BEST_COMPRESSION)) {", "av_log(VAR_0, AV_LOG_ERROR, \"Unusupported compression level for ZLIB: (%d).\\n\", c->compression);", "return 1;", "}", "av_log(VAR_0, AV_LOG_INFO, \"Compression level for ZLIB: (%d).\\n\", c->compression);", "}", "#else\nav_log(VAR_0, AV_LOG_ERROR, \"Zlib support not compiled.\\n\");", "return 1;", "#endif\nbreak;", "default:\nav_log(VAR_0, AV_LOG_ERROR, \"BUG! Unknown codec in compression switch.\\n\");", "return 1;", "}", "if (c->decomp_size) {", "if ((c->decomp_buf = av_malloc(c->decomp_size+4*8)) == NULL) {", "av_log(VAR_0, AV_LOG_ERROR, \"Can't allocate decompression buffer.\\n\");", "return 1;", "}", "}", "c->flags = *((char *)VAR_0->extradata + 6);", "if (c->flags & FLAG_MULTITHREAD)\nav_log(VAR_0, AV_LOG_INFO, \"Multithread encoder flag set.\\n\");", "if (c->flags & FLAG_NULLFRAME)\nav_log(VAR_0, AV_LOG_INFO, \"Nullframe insertion flag set.\\n\");", "if ((VAR_0->codec_id == CODEC_ID_ZLIB) && (c->flags & FLAG_PNGFILTER))\nav_log(VAR_0, AV_LOG_INFO, \"PNG filter flag set.\\n\");", "if (c->flags & FLAGMASK_UNUSED)\nav_log(VAR_0, AV_LOG_ERROR, \"Unknown flag set (%d).\\n\", c->flags);", "if (VAR_0->codec_id == CODEC_ID_ZLIB) {", "#ifdef CONFIG_ZLIB\nc->zstream.zalloc = Z_NULL;", "c->zstream.zfree = Z_NULL;", "c->zstream.opaque = Z_NULL;", "VAR_2 = inflateInit(&(c->zstream));", "if (VAR_2 != Z_OK) {", "av_log(VAR_0, AV_LOG_ERROR, \"Inflate init error: %d\\n\", VAR_2);", "return 1;", "}", "#else\nav_log(VAR_0, AV_LOG_ERROR, \"Zlib support not compiled.\\n\");", "return 1;", "#endif\n}", "VAR_0->pix_fmt = PIX_FMT_BGR24;", "return 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, 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 ], [ 13 ], [ 15 ], [ 19 ], [ 23, 27 ], [ 29, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 45, 47 ], [ 49 ], [ 51 ], [ 57 ], [ 59, 61 ], [ 63 ], [ 65 ], [ 67, 69 ], [ 71 ], [ 73 ], [ 75, 77 ], [ 79 ], [ 81 ], [ 83, 85 ], [ 87 ], [ 89 ], [ 91, 93 ], [ 95 ], [ 97 ], [ 99, 101 ], [ 103 ], [ 105 ], [ 107, 109 ], [ 111 ], [ 113 ], [ 119 ], [ 121 ], [ 123, 125 ], [ 127, 129 ], [ 131 ], [ 133, 135 ], [ 137 ], [ 139 ], [ 141, 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151, 153, 155 ], [ 157, 159 ], [ 161 ], [ 163, 165 ], [ 167 ], [ 169, 171 ], [ 173 ], [ 175, 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189, 191 ], [ 193 ], [ 195, 197 ], [ 199, 201 ], [ 203 ], [ 205 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 229 ], [ 231, 233 ], [ 235, 237 ], [ 239, 241 ], [ 243, 245 ], [ 251 ], [ 253, 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271, 273 ], [ 275 ], [ 277, 279 ], [ 283 ], [ 287 ], [ 289 ] ]
12,613
static void lsi_do_command(LSIState *s) { SCSIDevice *dev; uint8_t buf[16]; uint32_t id; int n; DPRINTF("Send command len=%d\n", s->dbc); if (s->dbc > 16) s->dbc = 16; pci_dma_read(PCI_DEVICE(s), s->dnad, buf, s->dbc); s->sfbr = buf[0]; s->command_complete = 0; id = (s->select_tag >> 8) & 0xf; dev = scsi_device_find(&s->bus, 0, id, s->current_lun); if (!dev) { lsi_bad_selection(s, id); return; } assert(s->current == NULL); s->current = g_malloc0(sizeof(lsi_request)); s->current->tag = s->select_tag; s->current->req = scsi_req_new(dev, s->current->tag, s->current_lun, buf, s->current); n = scsi_req_enqueue(s->current->req); if (n) { if (n > 0) { lsi_set_phase(s, PHASE_DI); } else if (n < 0) { lsi_set_phase(s, PHASE_DO); } scsi_req_continue(s->current->req); } if (!s->command_complete) { if (n) { /* Command did not complete immediately so disconnect. */ lsi_add_msg_byte(s, 2); /* SAVE DATA POINTER */ lsi_add_msg_byte(s, 4); /* DISCONNECT */ /* wait data */ lsi_set_phase(s, PHASE_MI); s->msg_action = 1; lsi_queue_command(s); } else { /* wait command complete */ lsi_set_phase(s, PHASE_DI); } } }
true
qemu
3c55fe2a13353b3ddf1db51c34ada23d161ee428
static void lsi_do_command(LSIState *s) { SCSIDevice *dev; uint8_t buf[16]; uint32_t id; int n; DPRINTF("Send command len=%d\n", s->dbc); if (s->dbc > 16) s->dbc = 16; pci_dma_read(PCI_DEVICE(s), s->dnad, buf, s->dbc); s->sfbr = buf[0]; s->command_complete = 0; id = (s->select_tag >> 8) & 0xf; dev = scsi_device_find(&s->bus, 0, id, s->current_lun); if (!dev) { lsi_bad_selection(s, id); return; } assert(s->current == NULL); s->current = g_malloc0(sizeof(lsi_request)); s->current->tag = s->select_tag; s->current->req = scsi_req_new(dev, s->current->tag, s->current_lun, buf, s->current); n = scsi_req_enqueue(s->current->req); if (n) { if (n > 0) { lsi_set_phase(s, PHASE_DI); } else if (n < 0) { lsi_set_phase(s, PHASE_DO); } scsi_req_continue(s->current->req); } if (!s->command_complete) { if (n) { lsi_add_msg_byte(s, 2); lsi_add_msg_byte(s, 4); lsi_set_phase(s, PHASE_MI); s->msg_action = 1; lsi_queue_command(s); } else { lsi_set_phase(s, PHASE_DI); } } }
{ "code": [ " s->current = g_malloc0(sizeof(lsi_request));" ], "line_no": [ 45 ] }
static void FUNC_0(LSIState *VAR_0) { SCSIDevice *dev; uint8_t buf[16]; uint32_t id; int VAR_1; DPRINTF("Send command len=%d\VAR_1", VAR_0->dbc); if (VAR_0->dbc > 16) VAR_0->dbc = 16; pci_dma_read(PCI_DEVICE(VAR_0), VAR_0->dnad, buf, VAR_0->dbc); VAR_0->sfbr = buf[0]; VAR_0->command_complete = 0; id = (VAR_0->select_tag >> 8) & 0xf; dev = scsi_device_find(&VAR_0->bus, 0, id, VAR_0->current_lun); if (!dev) { lsi_bad_selection(VAR_0, id); return; } assert(VAR_0->current == NULL); VAR_0->current = g_malloc0(sizeof(lsi_request)); VAR_0->current->tag = VAR_0->select_tag; VAR_0->current->req = scsi_req_new(dev, VAR_0->current->tag, VAR_0->current_lun, buf, VAR_0->current); VAR_1 = scsi_req_enqueue(VAR_0->current->req); if (VAR_1) { if (VAR_1 > 0) { lsi_set_phase(VAR_0, PHASE_DI); } else if (VAR_1 < 0) { lsi_set_phase(VAR_0, PHASE_DO); } scsi_req_continue(VAR_0->current->req); } if (!VAR_0->command_complete) { if (VAR_1) { lsi_add_msg_byte(VAR_0, 2); lsi_add_msg_byte(VAR_0, 4); lsi_set_phase(VAR_0, PHASE_MI); VAR_0->msg_action = 1; lsi_queue_command(VAR_0); } else { lsi_set_phase(VAR_0, PHASE_DI); } } }
[ "static void FUNC_0(LSIState *VAR_0)\n{", "SCSIDevice *dev;", "uint8_t buf[16];", "uint32_t id;", "int VAR_1;", "DPRINTF(\"Send command len=%d\\VAR_1\", VAR_0->dbc);", "if (VAR_0->dbc > 16)\nVAR_0->dbc = 16;", "pci_dma_read(PCI_DEVICE(VAR_0), VAR_0->dnad, buf, VAR_0->dbc);", "VAR_0->sfbr = buf[0];", "VAR_0->command_complete = 0;", "id = (VAR_0->select_tag >> 8) & 0xf;", "dev = scsi_device_find(&VAR_0->bus, 0, id, VAR_0->current_lun);", "if (!dev) {", "lsi_bad_selection(VAR_0, id);", "return;", "}", "assert(VAR_0->current == NULL);", "VAR_0->current = g_malloc0(sizeof(lsi_request));", "VAR_0->current->tag = VAR_0->select_tag;", "VAR_0->current->req = scsi_req_new(dev, VAR_0->current->tag, VAR_0->current_lun, buf,\nVAR_0->current);", "VAR_1 = scsi_req_enqueue(VAR_0->current->req);", "if (VAR_1) {", "if (VAR_1 > 0) {", "lsi_set_phase(VAR_0, PHASE_DI);", "} else if (VAR_1 < 0) {", "lsi_set_phase(VAR_0, PHASE_DO);", "}", "scsi_req_continue(VAR_0->current->req);", "}", "if (!VAR_0->command_complete) {", "if (VAR_1) {", "lsi_add_msg_byte(VAR_0, 2);", "lsi_add_msg_byte(VAR_0, 4);", "lsi_set_phase(VAR_0, PHASE_MI);", "VAR_0->msg_action = 1;", "lsi_queue_command(VAR_0);", "} else {", "lsi_set_phase(VAR_0, PHASE_DI);", "}", "}", "}" ]
[ 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17, 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49, 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ] ]
12,615
static void use_high_update_speed(WmallDecodeCtx *s, int ich) { int ilms, recent, icoef; s->update_speed[ich] = 16; for (ilms = s->cdlms_ttl[ich]; ilms >= 0; ilms--) { recent = s->cdlms[ich][ilms].recent; if (s->bV3RTM) { for (icoef = 0; icoef < s->cdlms[ich][ilms].order; icoef++) s->cdlms[ich][ilms].lms_updates[icoef + recent] *= 2; } else { for (icoef = 0; icoef < s->cdlms[ich][ilms].order; icoef++) s->cdlms[ich][ilms].lms_updates[icoef] *= 2; } } }
true
FFmpeg
6cf31ef263d36f6b89d9b64f15ca81cef4f24901
static void use_high_update_speed(WmallDecodeCtx *s, int ich) { int ilms, recent, icoef; s->update_speed[ich] = 16; for (ilms = s->cdlms_ttl[ich]; ilms >= 0; ilms--) { recent = s->cdlms[ich][ilms].recent; if (s->bV3RTM) { for (icoef = 0; icoef < s->cdlms[ich][ilms].order; icoef++) s->cdlms[ich][ilms].lms_updates[icoef + recent] *= 2; } else { for (icoef = 0; icoef < s->cdlms[ich][ilms].order; icoef++) s->cdlms[ich][ilms].lms_updates[icoef] *= 2; } } }
{ "code": [ " for (ilms = s->cdlms_ttl[ich]; ilms >= 0; ilms--) {", " for (ilms = s->cdlms_ttl[ich]; ilms >= 0; ilms--) {" ], "line_no": [ 9, 9 ] }
static void FUNC_0(WmallDecodeCtx *VAR_0, int VAR_1) { int VAR_2, VAR_3, VAR_4; VAR_0->update_speed[VAR_1] = 16; for (VAR_2 = VAR_0->cdlms_ttl[VAR_1]; VAR_2 >= 0; VAR_2--) { VAR_3 = VAR_0->cdlms[VAR_1][VAR_2].VAR_3; if (VAR_0->bV3RTM) { for (VAR_4 = 0; VAR_4 < VAR_0->cdlms[VAR_1][VAR_2].order; VAR_4++) VAR_0->cdlms[VAR_1][VAR_2].lms_updates[VAR_4 + VAR_3] *= 2; } else { for (VAR_4 = 0; VAR_4 < VAR_0->cdlms[VAR_1][VAR_2].order; VAR_4++) VAR_0->cdlms[VAR_1][VAR_2].lms_updates[VAR_4] *= 2; } } }
[ "static void FUNC_0(WmallDecodeCtx *VAR_0, int VAR_1)\n{", "int VAR_2, VAR_3, VAR_4;", "VAR_0->update_speed[VAR_1] = 16;", "for (VAR_2 = VAR_0->cdlms_ttl[VAR_1]; VAR_2 >= 0; VAR_2--) {", "VAR_3 = VAR_0->cdlms[VAR_1][VAR_2].VAR_3;", "if (VAR_0->bV3RTM) {", "for (VAR_4 = 0; VAR_4 < VAR_0->cdlms[VAR_1][VAR_2].order; VAR_4++)", "VAR_0->cdlms[VAR_1][VAR_2].lms_updates[VAR_4 + VAR_3] *= 2;", "} else {", "for (VAR_4 = 0; VAR_4 < VAR_0->cdlms[VAR_1][VAR_2].order; VAR_4++)", "VAR_0->cdlms[VAR_1][VAR_2].lms_updates[VAR_4] *= 2;", "}", "}", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ] ]
12,617
static void dump_json_image_check(ImageCheck *check, bool quiet) { Error *local_err = NULL; QString *str; QmpOutputVisitor *ov = qmp_output_visitor_new(); QObject *obj; visit_type_ImageCheck(qmp_output_get_visitor(ov), NULL, &check, &local_err); obj = qmp_output_get_qobject(ov); str = qobject_to_json_pretty(obj); assert(str != NULL); qprintf(quiet, "%s\n", qstring_get_str(str)); qobject_decref(obj); qmp_output_visitor_cleanup(ov); QDECREF(str); }
true
qemu
911ee36d411ee9b3540855642b53219b6a974992
static void dump_json_image_check(ImageCheck *check, bool quiet) { Error *local_err = NULL; QString *str; QmpOutputVisitor *ov = qmp_output_visitor_new(); QObject *obj; visit_type_ImageCheck(qmp_output_get_visitor(ov), NULL, &check, &local_err); obj = qmp_output_get_qobject(ov); str = qobject_to_json_pretty(obj); assert(str != NULL); qprintf(quiet, "%s\n", qstring_get_str(str)); qobject_decref(obj); qmp_output_visitor_cleanup(ov); QDECREF(str); }
{ "code": [ " Error *local_err = NULL;", " &local_err);", " Error *local_err = NULL;", " Error *local_err = NULL;" ], "line_no": [ 5, 15, 5, 5 ] }
static void FUNC_0(ImageCheck *VAR_0, bool VAR_1) { Error *local_err = NULL; QString *str; QmpOutputVisitor *ov = qmp_output_visitor_new(); QObject *obj; visit_type_ImageCheck(qmp_output_get_visitor(ov), NULL, &VAR_0, &local_err); obj = qmp_output_get_qobject(ov); str = qobject_to_json_pretty(obj); assert(str != NULL); qprintf(VAR_1, "%s\n", qstring_get_str(str)); qobject_decref(obj); qmp_output_visitor_cleanup(ov); QDECREF(str); }
[ "static void FUNC_0(ImageCheck *VAR_0, bool VAR_1)\n{", "Error *local_err = NULL;", "QString *str;", "QmpOutputVisitor *ov = qmp_output_visitor_new();", "QObject *obj;", "visit_type_ImageCheck(qmp_output_get_visitor(ov), NULL, &VAR_0,\n&local_err);", "obj = qmp_output_get_qobject(ov);", "str = qobject_to_json_pretty(obj);", "assert(str != NULL);", "qprintf(VAR_1, \"%s\\n\", qstring_get_str(str));", "qobject_decref(obj);", "qmp_output_visitor_cleanup(ov);", "QDECREF(str);", "}" ]
[ 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ] ]
12,618
static bool aux_bus_is_bridge(AUXBus *bus, DeviceState *dev) { return (dev == DEVICE(bus->bridge)); }
true
qemu
e0dadc1e9ef1f35208e5d2af9c7740c18a0b769f
static bool aux_bus_is_bridge(AUXBus *bus, DeviceState *dev) { return (dev == DEVICE(bus->bridge)); }
{ "code": [], "line_no": [] }
static bool FUNC_0(AUXBus *bus, DeviceState *dev) { return (dev == DEVICE(bus->bridge)); }
[ "static bool FUNC_0(AUXBus *bus, DeviceState *dev)\n{", "return (dev == DEVICE(bus->bridge));", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
12,619
void ff_estimate_b_frame_motion(MpegEncContext * s, int mb_x, int mb_y) { MotionEstContext * const c= &s->me; const int penalty_factor= c->mb_penalty_factor; int fmin, bmin, dmin, fbmin, bimin, fimin; int type=0; const int xy = mb_y*s->mb_stride + mb_x; init_ref(c, s->new_picture.f->data, s->last_picture.f->data, s->next_picture.f->data, 16 * mb_x, 16 * mb_y, 2); get_limits(s, 16*mb_x, 16*mb_y); c->skip=0; if (s->codec_id == AV_CODEC_ID_MPEG4 && s->next_picture.mbskip_table[xy]) { int score= direct_search(s, mb_x, mb_y); //FIXME just check 0,0 score= ((unsigned)(score*score + 128*256))>>16; c->mc_mb_var_sum_temp += score; s->current_picture.mc_mb_var[mb_y*s->mb_stride + mb_x] = score; //FIXME use SSE s->mb_type[mb_y*s->mb_stride + mb_x]= CANDIDATE_MB_TYPE_DIRECT0; return; } if (s->codec_id == AV_CODEC_ID_MPEG4) dmin= direct_search(s, mb_x, mb_y); else dmin= INT_MAX; //FIXME penalty stuff for non mpeg4 c->skip=0; fmin = estimate_motion_b(s, mb_x, mb_y, s->b_forw_mv_table, 0, s->f_code) + 3 * penalty_factor; c->skip=0; bmin = estimate_motion_b(s, mb_x, mb_y, s->b_back_mv_table, 2, s->b_code) + 2 * penalty_factor; ff_dlog(s, " %d %d ", s->b_forw_mv_table[xy][0], s->b_forw_mv_table[xy][1]); c->skip=0; fbmin= bidir_refine(s, mb_x, mb_y) + penalty_factor; ff_dlog(s, "%d %d %d %d\n", dmin, fmin, bmin, fbmin); if (s->avctx->flags & AV_CODEC_FLAG_INTERLACED_ME) { //FIXME mb type penalty c->skip=0; c->current_mv_penalty= c->mv_penalty[s->f_code] + MAX_MV; fimin= interlaced_search(s, 0, s->b_field_mv_table[0], s->b_field_select_table[0], s->b_forw_mv_table[xy][0], s->b_forw_mv_table[xy][1], 0); c->current_mv_penalty= c->mv_penalty[s->b_code] + MAX_MV; bimin= interlaced_search(s, 2, s->b_field_mv_table[1], s->b_field_select_table[1], s->b_back_mv_table[xy][0], s->b_back_mv_table[xy][1], 0); }else fimin= bimin= INT_MAX; { int score= fmin; type = CANDIDATE_MB_TYPE_FORWARD; if (dmin <= score){ score = dmin; type = CANDIDATE_MB_TYPE_DIRECT; } if(bmin<score){ score=bmin; type= CANDIDATE_MB_TYPE_BACKWARD; } if(fbmin<score){ score=fbmin; type= CANDIDATE_MB_TYPE_BIDIR; } if(fimin<score){ score=fimin; type= CANDIDATE_MB_TYPE_FORWARD_I; } if(bimin<score){ score=bimin; type= CANDIDATE_MB_TYPE_BACKWARD_I; } score= ((unsigned)(score*score + 128*256))>>16; c->mc_mb_var_sum_temp += score; s->current_picture.mc_mb_var[mb_y*s->mb_stride + mb_x] = score; //FIXME use SSE } if(c->avctx->mb_decision > FF_MB_DECISION_SIMPLE){ type= CANDIDATE_MB_TYPE_FORWARD | CANDIDATE_MB_TYPE_BACKWARD | CANDIDATE_MB_TYPE_BIDIR | CANDIDATE_MB_TYPE_DIRECT; if(fimin < INT_MAX) type |= CANDIDATE_MB_TYPE_FORWARD_I; if(bimin < INT_MAX) type |= CANDIDATE_MB_TYPE_BACKWARD_I; if(fimin < INT_MAX && bimin < INT_MAX){ type |= CANDIDATE_MB_TYPE_BIDIR_I; } //FIXME something smarter if(dmin>256*256*16) type&= ~CANDIDATE_MB_TYPE_DIRECT; //do not try direct mode if it is invalid for this MB if (s->codec_id == AV_CODEC_ID_MPEG4 && type&CANDIDATE_MB_TYPE_DIRECT && s->mpv_flags & FF_MPV_FLAG_MV0 && *(uint32_t*)s->b_direct_mv_table[xy]) type |= CANDIDATE_MB_TYPE_DIRECT0; } s->mb_type[mb_y*s->mb_stride + mb_x]= type; }
false
FFmpeg
5b4da8a38a5ed211df9504c85ce401c30af86b97
void ff_estimate_b_frame_motion(MpegEncContext * s, int mb_x, int mb_y) { MotionEstContext * const c= &s->me; const int penalty_factor= c->mb_penalty_factor; int fmin, bmin, dmin, fbmin, bimin, fimin; int type=0; const int xy = mb_y*s->mb_stride + mb_x; init_ref(c, s->new_picture.f->data, s->last_picture.f->data, s->next_picture.f->data, 16 * mb_x, 16 * mb_y, 2); get_limits(s, 16*mb_x, 16*mb_y); c->skip=0; if (s->codec_id == AV_CODEC_ID_MPEG4 && s->next_picture.mbskip_table[xy]) { int score= direct_search(s, mb_x, mb_y); score= ((unsigned)(score*score + 128*256))>>16; c->mc_mb_var_sum_temp += score; s->current_picture.mc_mb_var[mb_y*s->mb_stride + mb_x] = score; s->mb_type[mb_y*s->mb_stride + mb_x]= CANDIDATE_MB_TYPE_DIRECT0; return; } if (s->codec_id == AV_CODEC_ID_MPEG4) dmin= direct_search(s, mb_x, mb_y); else dmin= INT_MAX; c->skip=0; fmin = estimate_motion_b(s, mb_x, mb_y, s->b_forw_mv_table, 0, s->f_code) + 3 * penalty_factor; c->skip=0; bmin = estimate_motion_b(s, mb_x, mb_y, s->b_back_mv_table, 2, s->b_code) + 2 * penalty_factor; ff_dlog(s, " %d %d ", s->b_forw_mv_table[xy][0], s->b_forw_mv_table[xy][1]); c->skip=0; fbmin= bidir_refine(s, mb_x, mb_y) + penalty_factor; ff_dlog(s, "%d %d %d %d\n", dmin, fmin, bmin, fbmin); if (s->avctx->flags & AV_CODEC_FLAG_INTERLACED_ME) { c->skip=0; c->current_mv_penalty= c->mv_penalty[s->f_code] + MAX_MV; fimin= interlaced_search(s, 0, s->b_field_mv_table[0], s->b_field_select_table[0], s->b_forw_mv_table[xy][0], s->b_forw_mv_table[xy][1], 0); c->current_mv_penalty= c->mv_penalty[s->b_code] + MAX_MV; bimin= interlaced_search(s, 2, s->b_field_mv_table[1], s->b_field_select_table[1], s->b_back_mv_table[xy][0], s->b_back_mv_table[xy][1], 0); }else fimin= bimin= INT_MAX; { int score= fmin; type = CANDIDATE_MB_TYPE_FORWARD; if (dmin <= score){ score = dmin; type = CANDIDATE_MB_TYPE_DIRECT; } if(bmin<score){ score=bmin; type= CANDIDATE_MB_TYPE_BACKWARD; } if(fbmin<score){ score=fbmin; type= CANDIDATE_MB_TYPE_BIDIR; } if(fimin<score){ score=fimin; type= CANDIDATE_MB_TYPE_FORWARD_I; } if(bimin<score){ score=bimin; type= CANDIDATE_MB_TYPE_BACKWARD_I; } score= ((unsigned)(score*score + 128*256))>>16; c->mc_mb_var_sum_temp += score; s->current_picture.mc_mb_var[mb_y*s->mb_stride + mb_x] = score; } if(c->avctx->mb_decision > FF_MB_DECISION_SIMPLE){ type= CANDIDATE_MB_TYPE_FORWARD | CANDIDATE_MB_TYPE_BACKWARD | CANDIDATE_MB_TYPE_BIDIR | CANDIDATE_MB_TYPE_DIRECT; if(fimin < INT_MAX) type |= CANDIDATE_MB_TYPE_FORWARD_I; if(bimin < INT_MAX) type |= CANDIDATE_MB_TYPE_BACKWARD_I; if(fimin < INT_MAX && bimin < INT_MAX){ type |= CANDIDATE_MB_TYPE_BIDIR_I; } if(dmin>256*256*16) type&= ~CANDIDATE_MB_TYPE_DIRECT; if (s->codec_id == AV_CODEC_ID_MPEG4 && type&CANDIDATE_MB_TYPE_DIRECT && s->mpv_flags & FF_MPV_FLAG_MV0 && *(uint32_t*)s->b_direct_mv_table[xy]) type |= CANDIDATE_MB_TYPE_DIRECT0; } s->mb_type[mb_y*s->mb_stride + mb_x]= type; }
{ "code": [], "line_no": [] }
void FUNC_0(MpegEncContext * VAR_0, int VAR_1, int VAR_2) { MotionEstContext * const c= &VAR_0->me; const int VAR_3= c->mb_penalty_factor; int VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9; int VAR_10=0; const int VAR_11 = VAR_2*VAR_0->mb_stride + VAR_1; init_ref(c, VAR_0->new_picture.f->data, VAR_0->last_picture.f->data, VAR_0->next_picture.f->data, 16 * VAR_1, 16 * VAR_2, 2); get_limits(VAR_0, 16*VAR_1, 16*VAR_2); c->skip=0; if (VAR_0->codec_id == AV_CODEC_ID_MPEG4 && VAR_0->next_picture.mbskip_table[VAR_11]) { int VAR_13= direct_search(VAR_0, VAR_1, VAR_2); VAR_13= ((unsigned)(VAR_13*VAR_13 + 128*256))>>16; c->mc_mb_var_sum_temp += VAR_13; VAR_0->current_picture.mc_mb_var[VAR_2*VAR_0->mb_stride + VAR_1] = VAR_13; VAR_0->mb_type[VAR_2*VAR_0->mb_stride + VAR_1]= CANDIDATE_MB_TYPE_DIRECT0; return; } if (VAR_0->codec_id == AV_CODEC_ID_MPEG4) VAR_6= direct_search(VAR_0, VAR_1, VAR_2); else VAR_6= INT_MAX; c->skip=0; VAR_4 = estimate_motion_b(VAR_0, VAR_1, VAR_2, VAR_0->b_forw_mv_table, 0, VAR_0->f_code) + 3 * VAR_3; c->skip=0; VAR_5 = estimate_motion_b(VAR_0, VAR_1, VAR_2, VAR_0->b_back_mv_table, 2, VAR_0->b_code) + 2 * VAR_3; ff_dlog(VAR_0, " %d %d ", VAR_0->b_forw_mv_table[VAR_11][0], VAR_0->b_forw_mv_table[VAR_11][1]); c->skip=0; VAR_7= bidir_refine(VAR_0, VAR_1, VAR_2) + VAR_3; ff_dlog(VAR_0, "%d %d %d %d\n", VAR_6, VAR_4, VAR_5, VAR_7); if (VAR_0->avctx->flags & AV_CODEC_FLAG_INTERLACED_ME) { c->skip=0; c->current_mv_penalty= c->mv_penalty[VAR_0->f_code] + MAX_MV; VAR_9= interlaced_search(VAR_0, 0, VAR_0->b_field_mv_table[0], VAR_0->b_field_select_table[0], VAR_0->b_forw_mv_table[VAR_11][0], VAR_0->b_forw_mv_table[VAR_11][1], 0); c->current_mv_penalty= c->mv_penalty[VAR_0->b_code] + MAX_MV; VAR_8= interlaced_search(VAR_0, 2, VAR_0->b_field_mv_table[1], VAR_0->b_field_select_table[1], VAR_0->b_back_mv_table[VAR_11][0], VAR_0->b_back_mv_table[VAR_11][1], 0); }else VAR_9= VAR_8= INT_MAX; { int VAR_13= VAR_4; VAR_10 = CANDIDATE_MB_TYPE_FORWARD; if (VAR_6 <= VAR_13){ VAR_13 = VAR_6; VAR_10 = CANDIDATE_MB_TYPE_DIRECT; } if(VAR_5<VAR_13){ VAR_13=VAR_5; VAR_10= CANDIDATE_MB_TYPE_BACKWARD; } if(VAR_7<VAR_13){ VAR_13=VAR_7; VAR_10= CANDIDATE_MB_TYPE_BIDIR; } if(VAR_9<VAR_13){ VAR_13=VAR_9; VAR_10= CANDIDATE_MB_TYPE_FORWARD_I; } if(VAR_8<VAR_13){ VAR_13=VAR_8; VAR_10= CANDIDATE_MB_TYPE_BACKWARD_I; } VAR_13= ((unsigned)(VAR_13*VAR_13 + 128*256))>>16; c->mc_mb_var_sum_temp += VAR_13; VAR_0->current_picture.mc_mb_var[VAR_2*VAR_0->mb_stride + VAR_1] = VAR_13; } if(c->avctx->mb_decision > FF_MB_DECISION_SIMPLE){ VAR_10= CANDIDATE_MB_TYPE_FORWARD | CANDIDATE_MB_TYPE_BACKWARD | CANDIDATE_MB_TYPE_BIDIR | CANDIDATE_MB_TYPE_DIRECT; if(VAR_9 < INT_MAX) VAR_10 |= CANDIDATE_MB_TYPE_FORWARD_I; if(VAR_8 < INT_MAX) VAR_10 |= CANDIDATE_MB_TYPE_BACKWARD_I; if(VAR_9 < INT_MAX && VAR_8 < INT_MAX){ VAR_10 |= CANDIDATE_MB_TYPE_BIDIR_I; } if(VAR_6>256*256*16) VAR_10&= ~CANDIDATE_MB_TYPE_DIRECT; if (VAR_0->codec_id == AV_CODEC_ID_MPEG4 && VAR_10&CANDIDATE_MB_TYPE_DIRECT && VAR_0->mpv_flags & FF_MPV_FLAG_MV0 && *(uint32_t*)VAR_0->b_direct_mv_table[VAR_11]) VAR_10 |= CANDIDATE_MB_TYPE_DIRECT0; } VAR_0->mb_type[VAR_2*VAR_0->mb_stride + VAR_1]= VAR_10; }
[ "void FUNC_0(MpegEncContext * VAR_0,\nint VAR_1, int VAR_2)\n{", "MotionEstContext * const c= &VAR_0->me;", "const int VAR_3= c->mb_penalty_factor;", "int VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9;", "int VAR_10=0;", "const int VAR_11 = VAR_2*VAR_0->mb_stride + VAR_1;", "init_ref(c, VAR_0->new_picture.f->data, VAR_0->last_picture.f->data,\nVAR_0->next_picture.f->data, 16 * VAR_1, 16 * VAR_2, 2);", "get_limits(VAR_0, 16*VAR_1, 16*VAR_2);", "c->skip=0;", "if (VAR_0->codec_id == AV_CODEC_ID_MPEG4 && VAR_0->next_picture.mbskip_table[VAR_11]) {", "int VAR_13= direct_search(VAR_0, VAR_1, VAR_2);", "VAR_13= ((unsigned)(VAR_13*VAR_13 + 128*256))>>16;", "c->mc_mb_var_sum_temp += VAR_13;", "VAR_0->current_picture.mc_mb_var[VAR_2*VAR_0->mb_stride + VAR_1] = VAR_13;", "VAR_0->mb_type[VAR_2*VAR_0->mb_stride + VAR_1]= CANDIDATE_MB_TYPE_DIRECT0;", "return;", "}", "if (VAR_0->codec_id == AV_CODEC_ID_MPEG4)\nVAR_6= direct_search(VAR_0, VAR_1, VAR_2);", "else\nVAR_6= INT_MAX;", "c->skip=0;", "VAR_4 = estimate_motion_b(VAR_0, VAR_1, VAR_2, VAR_0->b_forw_mv_table, 0, VAR_0->f_code) +\n3 * VAR_3;", "c->skip=0;", "VAR_5 = estimate_motion_b(VAR_0, VAR_1, VAR_2, VAR_0->b_back_mv_table, 2, VAR_0->b_code) +\n2 * VAR_3;", "ff_dlog(VAR_0, \" %d %d \", VAR_0->b_forw_mv_table[VAR_11][0], VAR_0->b_forw_mv_table[VAR_11][1]);", "c->skip=0;", "VAR_7= bidir_refine(VAR_0, VAR_1, VAR_2) + VAR_3;", "ff_dlog(VAR_0, \"%d %d %d %d\\n\", VAR_6, VAR_4, VAR_5, VAR_7);", "if (VAR_0->avctx->flags & AV_CODEC_FLAG_INTERLACED_ME) {", "c->skip=0;", "c->current_mv_penalty= c->mv_penalty[VAR_0->f_code] + MAX_MV;", "VAR_9= interlaced_search(VAR_0, 0,\nVAR_0->b_field_mv_table[0], VAR_0->b_field_select_table[0],\nVAR_0->b_forw_mv_table[VAR_11][0], VAR_0->b_forw_mv_table[VAR_11][1], 0);", "c->current_mv_penalty= c->mv_penalty[VAR_0->b_code] + MAX_MV;", "VAR_8= interlaced_search(VAR_0, 2,\nVAR_0->b_field_mv_table[1], VAR_0->b_field_select_table[1],\nVAR_0->b_back_mv_table[VAR_11][0], VAR_0->b_back_mv_table[VAR_11][1], 0);", "}else", "VAR_9= VAR_8= INT_MAX;", "{", "int VAR_13= VAR_4;", "VAR_10 = CANDIDATE_MB_TYPE_FORWARD;", "if (VAR_6 <= VAR_13){", "VAR_13 = VAR_6;", "VAR_10 = CANDIDATE_MB_TYPE_DIRECT;", "}", "if(VAR_5<VAR_13){", "VAR_13=VAR_5;", "VAR_10= CANDIDATE_MB_TYPE_BACKWARD;", "}", "if(VAR_7<VAR_13){", "VAR_13=VAR_7;", "VAR_10= CANDIDATE_MB_TYPE_BIDIR;", "}", "if(VAR_9<VAR_13){", "VAR_13=VAR_9;", "VAR_10= CANDIDATE_MB_TYPE_FORWARD_I;", "}", "if(VAR_8<VAR_13){", "VAR_13=VAR_8;", "VAR_10= CANDIDATE_MB_TYPE_BACKWARD_I;", "}", "VAR_13= ((unsigned)(VAR_13*VAR_13 + 128*256))>>16;", "c->mc_mb_var_sum_temp += VAR_13;", "VAR_0->current_picture.mc_mb_var[VAR_2*VAR_0->mb_stride + VAR_1] = VAR_13;", "}", "if(c->avctx->mb_decision > FF_MB_DECISION_SIMPLE){", "VAR_10= CANDIDATE_MB_TYPE_FORWARD | CANDIDATE_MB_TYPE_BACKWARD | CANDIDATE_MB_TYPE_BIDIR | CANDIDATE_MB_TYPE_DIRECT;", "if(VAR_9 < INT_MAX)\nVAR_10 |= CANDIDATE_MB_TYPE_FORWARD_I;", "if(VAR_8 < INT_MAX)\nVAR_10 |= CANDIDATE_MB_TYPE_BACKWARD_I;", "if(VAR_9 < INT_MAX && VAR_8 < INT_MAX){", "VAR_10 |= CANDIDATE_MB_TYPE_BIDIR_I;", "}", "if(VAR_6>256*256*16) VAR_10&= ~CANDIDATE_MB_TYPE_DIRECT;", "if (VAR_0->codec_id == AV_CODEC_ID_MPEG4 && VAR_10&CANDIDATE_MB_TYPE_DIRECT &&\nVAR_0->mpv_flags & FF_MPV_FLAG_MV0 && *(uint32_t*)VAR_0->b_direct_mv_table[VAR_11])\nVAR_10 |= CANDIDATE_MB_TYPE_DIRECT0;", "}", "VAR_0->mb_type[VAR_2*VAR_0->mb_stride + VAR_1]= VAR_10;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17, 19 ], [ 23 ], [ 27 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 53, 55 ], [ 57, 59 ], [ 63 ], [ 65, 67 ], [ 71 ], [ 73, 75 ], [ 77 ], [ 81 ], [ 83 ], [ 85 ], [ 89 ], [ 93 ], [ 95 ], [ 97, 99, 101 ], [ 103 ], [ 105, 107, 109 ], [ 111 ], [ 113 ], [ 117 ], [ 119 ], [ 121 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 177 ], [ 179 ], [ 181, 183 ], [ 185, 187 ], [ 189 ], [ 191 ], [ 193 ], [ 197 ], [ 199, 201, 203 ], [ 205 ], [ 209 ], [ 211 ] ]
12,620
static inline int mpeg4_decode_dc(MpegEncContext * s, int n, int *dir_ptr) { int level, pred, code; uint16_t *dc_val; if (n < 4) code = get_vlc2(&s->gb, dc_lum.table, DC_VLC_BITS, 1); else code = get_vlc2(&s->gb, dc_chrom.table, DC_VLC_BITS, 1); if (code < 0 || code > 9 /* && s->nbit<9 */){ fprintf(stderr, "illegal dc vlc\n"); return -1; } if (code == 0) { level = 0; } else { level = get_xbits(&s->gb, code); if (code > 8){ if(get_bits1(&s->gb)==0){ /* marker */ if(s->error_resilience>=2){ fprintf(stderr, "dc marker bit missing\n"); return -1; } } } } pred = ff_mpeg4_pred_dc(s, n, &dc_val, dir_ptr); level += pred; if (level < 0){ if(s->error_resilience>=3){ fprintf(stderr, "dc<0 at %dx%d\n", s->mb_x, s->mb_y); return -1; } level = 0; } if (n < 4) { *dc_val = level * s->y_dc_scale; } else { *dc_val = level * s->c_dc_scale; } if(s->error_resilience>=3){ if(*dc_val > 2048 + s->y_dc_scale + s->c_dc_scale){ fprintf(stderr, "dc overflow at %dx%d\n", s->mb_x, s->mb_y); return -1; } } return level; }
false
FFmpeg
6d71b3820759235c02493ac73ef5949b653ad29b
static inline int mpeg4_decode_dc(MpegEncContext * s, int n, int *dir_ptr) { int level, pred, code; uint16_t *dc_val; if (n < 4) code = get_vlc2(&s->gb, dc_lum.table, DC_VLC_BITS, 1); else code = get_vlc2(&s->gb, dc_chrom.table, DC_VLC_BITS, 1); if (code < 0 || code > 9 ){ fprintf(stderr, "illegal dc vlc\n"); return -1; } if (code == 0) { level = 0; } else { level = get_xbits(&s->gb, code); if (code > 8){ if(get_bits1(&s->gb)==0){ if(s->error_resilience>=2){ fprintf(stderr, "dc marker bit missing\n"); return -1; } } } } pred = ff_mpeg4_pred_dc(s, n, &dc_val, dir_ptr); level += pred; if (level < 0){ if(s->error_resilience>=3){ fprintf(stderr, "dc<0 at %dx%d\n", s->mb_x, s->mb_y); return -1; } level = 0; } if (n < 4) { *dc_val = level * s->y_dc_scale; } else { *dc_val = level * s->c_dc_scale; } if(s->error_resilience>=3){ if(*dc_val > 2048 + s->y_dc_scale + s->c_dc_scale){ fprintf(stderr, "dc overflow at %dx%d\n", s->mb_x, s->mb_y); return -1; } } return level; }
{ "code": [], "line_no": [] }
static inline int FUNC_0(MpegEncContext * VAR_0, int VAR_1, int *VAR_2) { int VAR_3, VAR_4, VAR_5; uint16_t *dc_val; if (VAR_1 < 4) VAR_5 = get_vlc2(&VAR_0->gb, dc_lum.table, DC_VLC_BITS, 1); else VAR_5 = get_vlc2(&VAR_0->gb, dc_chrom.table, DC_VLC_BITS, 1); if (VAR_5 < 0 || VAR_5 > 9 ){ fprintf(stderr, "illegal dc vlc\VAR_1"); return -1; } if (VAR_5 == 0) { VAR_3 = 0; } else { VAR_3 = get_xbits(&VAR_0->gb, VAR_5); if (VAR_5 > 8){ if(get_bits1(&VAR_0->gb)==0){ if(VAR_0->error_resilience>=2){ fprintf(stderr, "dc marker bit missing\VAR_1"); return -1; } } } } VAR_4 = ff_mpeg4_pred_dc(VAR_0, VAR_1, &dc_val, VAR_2); VAR_3 += VAR_4; if (VAR_3 < 0){ if(VAR_0->error_resilience>=3){ fprintf(stderr, "dc<0 at %dx%d\VAR_1", VAR_0->mb_x, VAR_0->mb_y); return -1; } VAR_3 = 0; } if (VAR_1 < 4) { *dc_val = VAR_3 * VAR_0->y_dc_scale; } else { *dc_val = VAR_3 * VAR_0->c_dc_scale; } if(VAR_0->error_resilience>=3){ if(*dc_val > 2048 + VAR_0->y_dc_scale + VAR_0->c_dc_scale){ fprintf(stderr, "dc overflow at %dx%d\VAR_1", VAR_0->mb_x, VAR_0->mb_y); return -1; } } return VAR_3; }
[ "static inline int FUNC_0(MpegEncContext * VAR_0, int VAR_1, int *VAR_2)\n{", "int VAR_3, VAR_4, VAR_5;", "uint16_t *dc_val;", "if (VAR_1 < 4)\nVAR_5 = get_vlc2(&VAR_0->gb, dc_lum.table, DC_VLC_BITS, 1);", "else\nVAR_5 = get_vlc2(&VAR_0->gb, dc_chrom.table, DC_VLC_BITS, 1);", "if (VAR_5 < 0 || VAR_5 > 9 ){", "fprintf(stderr, \"illegal dc vlc\\VAR_1\");", "return -1;", "}", "if (VAR_5 == 0) {", "VAR_3 = 0;", "} else {", "VAR_3 = get_xbits(&VAR_0->gb, VAR_5);", "if (VAR_5 > 8){", "if(get_bits1(&VAR_0->gb)==0){", "if(VAR_0->error_resilience>=2){", "fprintf(stderr, \"dc marker bit missing\\VAR_1\");", "return -1;", "}", "}", "}", "}", "VAR_4 = ff_mpeg4_pred_dc(VAR_0, VAR_1, &dc_val, VAR_2);", "VAR_3 += VAR_4;", "if (VAR_3 < 0){", "if(VAR_0->error_resilience>=3){", "fprintf(stderr, \"dc<0 at %dx%d\\VAR_1\", VAR_0->mb_x, VAR_0->mb_y);", "return -1;", "}", "VAR_3 = 0;", "}", "if (VAR_1 < 4) {", "*dc_val = VAR_3 * VAR_0->y_dc_scale;", "} else {", "*dc_val = VAR_3 * VAR_0->c_dc_scale;", "}", "if(VAR_0->error_resilience>=3){", "if(*dc_val > 2048 + VAR_0->y_dc_scale + VAR_0->c_dc_scale){", "fprintf(stderr, \"dc overflow at %dx%d\\VAR_1\", VAR_0->mb_x, VAR_0->mb_y);", "return -1;", "}", "}", "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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11, 13 ], [ 15, 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ] ]
12,621
static void check_pred8x8(H264PredContext *h, uint8_t *buf0, uint8_t *buf1, int codec, int chroma_format, int bit_depth) { int pred_mode; for (pred_mode = 0; pred_mode < 11; pred_mode++) { if (check_pred_func(h->pred8x8[pred_mode], (chroma_format == 2) ? "8x16" : "8x8", pred8x8_modes[codec][pred_mode])) { randomize_buffers(); call_ref(src0, (ptrdiff_t)24*SIZEOF_PIXEL); call_new(src1, (ptrdiff_t)24*SIZEOF_PIXEL); if (memcmp(buf0, buf1, BUF_SIZE)) fail(); bench_new(src1, (ptrdiff_t)24*SIZEOF_PIXEL); } } }
false
FFmpeg
515b69f8f8e9a24cfaee95d8c1f63f265d8582fe
static void check_pred8x8(H264PredContext *h, uint8_t *buf0, uint8_t *buf1, int codec, int chroma_format, int bit_depth) { int pred_mode; for (pred_mode = 0; pred_mode < 11; pred_mode++) { if (check_pred_func(h->pred8x8[pred_mode], (chroma_format == 2) ? "8x16" : "8x8", pred8x8_modes[codec][pred_mode])) { randomize_buffers(); call_ref(src0, (ptrdiff_t)24*SIZEOF_PIXEL); call_new(src1, (ptrdiff_t)24*SIZEOF_PIXEL); if (memcmp(buf0, buf1, BUF_SIZE)) fail(); bench_new(src1, (ptrdiff_t)24*SIZEOF_PIXEL); } } }
{ "code": [], "line_no": [] }
static void FUNC_0(H264PredContext *VAR_0, uint8_t *VAR_1, uint8_t *VAR_2, int VAR_3, int VAR_4, int VAR_5) { int VAR_6; for (VAR_6 = 0; VAR_6 < 11; VAR_6++) { if (check_pred_func(VAR_0->pred8x8[VAR_6], (VAR_4 == 2) ? "8x16" : "8x8", pred8x8_modes[VAR_3][VAR_6])) { randomize_buffers(); call_ref(src0, (ptrdiff_t)24*SIZEOF_PIXEL); call_new(src1, (ptrdiff_t)24*SIZEOF_PIXEL); if (memcmp(VAR_1, VAR_2, BUF_SIZE)) fail(); bench_new(src1, (ptrdiff_t)24*SIZEOF_PIXEL); } } }
[ "static void FUNC_0(H264PredContext *VAR_0, uint8_t *VAR_1, uint8_t *VAR_2,\nint VAR_3, int VAR_4, int VAR_5)\n{", "int VAR_6;", "for (VAR_6 = 0; VAR_6 < 11; VAR_6++) {", "if (check_pred_func(VAR_0->pred8x8[VAR_6], (VAR_4 == 2) ? \"8x16\" : \"8x8\",\npred8x8_modes[VAR_3][VAR_6])) {", "randomize_buffers();", "call_ref(src0, (ptrdiff_t)24*SIZEOF_PIXEL);", "call_new(src1, (ptrdiff_t)24*SIZEOF_PIXEL);", "if (memcmp(VAR_1, VAR_2, BUF_SIZE))\nfail();", "bench_new(src1, (ptrdiff_t)24*SIZEOF_PIXEL);", "}", "}", "}" ]
[ 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 ] ]
12,622
int kvm_arch_remove_sw_breakpoint(CPUState *env, struct kvm_sw_breakpoint *bp) { uint8_t int3; if (cpu_memory_rw_debug(env, bp->pc, &int3, 1, 0) || int3 != 0xcc || cpu_memory_rw_debug(env, bp->pc, (uint8_t *)&bp->saved_insn, 1, 1)) return -EINVAL; return 0; }
false
qemu
b9bec74bcb16519a876ec21cd5277c526a9b512d
int kvm_arch_remove_sw_breakpoint(CPUState *env, struct kvm_sw_breakpoint *bp) { uint8_t int3; if (cpu_memory_rw_debug(env, bp->pc, &int3, 1, 0) || int3 != 0xcc || cpu_memory_rw_debug(env, bp->pc, (uint8_t *)&bp->saved_insn, 1, 1)) return -EINVAL; return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(CPUState *VAR_0, struct kvm_sw_breakpoint *VAR_1) { uint8_t int3; if (cpu_memory_rw_debug(VAR_0, VAR_1->pc, &int3, 1, 0) || int3 != 0xcc || cpu_memory_rw_debug(VAR_0, VAR_1->pc, (uint8_t *)&VAR_1->saved_insn, 1, 1)) return -EINVAL; return 0; }
[ "int FUNC_0(CPUState *VAR_0, struct kvm_sw_breakpoint *VAR_1)\n{", "uint8_t int3;", "if (cpu_memory_rw_debug(VAR_0, VAR_1->pc, &int3, 1, 0) || int3 != 0xcc ||\ncpu_memory_rw_debug(VAR_0, VAR_1->pc, (uint8_t *)&VAR_1->saved_insn, 1, 1))\nreturn -EINVAL;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11, 13 ], [ 15 ], [ 17 ] ]
12,623
static void rtas_nvram_fetch(sPAPREnvironment *spapr, uint32_t token, uint32_t nargs, target_ulong args, uint32_t nret, target_ulong rets) { sPAPRNVRAM *nvram = spapr->nvram; hwaddr offset, buffer, len; int alen; void *membuf; if ((nargs != 3) || (nret != 2)) { rtas_st(rets, 0, -3); return; } if (!nvram) { rtas_st(rets, 0, -1); rtas_st(rets, 1, 0); return; } offset = rtas_ld(args, 0); buffer = rtas_ld(args, 1); len = rtas_ld(args, 2); if (((offset + len) < offset) || ((offset + len) > nvram->size)) { rtas_st(rets, 0, -3); rtas_st(rets, 1, 0); return; } membuf = cpu_physical_memory_map(buffer, &len, 1); if (nvram->drive) { alen = bdrv_pread(nvram->drive, offset, membuf, len); } else { assert(nvram->buf); memcpy(membuf, nvram->buf + offset, len); alen = len; } cpu_physical_memory_unmap(membuf, len, 1, len); rtas_st(rets, 0, (alen < len) ? -1 : 0); rtas_st(rets, 1, (alen < 0) ? 0 : alen); }
false
qemu
210b580b106fa798149e28aa13c66b325a43204e
static void rtas_nvram_fetch(sPAPREnvironment *spapr, uint32_t token, uint32_t nargs, target_ulong args, uint32_t nret, target_ulong rets) { sPAPRNVRAM *nvram = spapr->nvram; hwaddr offset, buffer, len; int alen; void *membuf; if ((nargs != 3) || (nret != 2)) { rtas_st(rets, 0, -3); return; } if (!nvram) { rtas_st(rets, 0, -1); rtas_st(rets, 1, 0); return; } offset = rtas_ld(args, 0); buffer = rtas_ld(args, 1); len = rtas_ld(args, 2); if (((offset + len) < offset) || ((offset + len) > nvram->size)) { rtas_st(rets, 0, -3); rtas_st(rets, 1, 0); return; } membuf = cpu_physical_memory_map(buffer, &len, 1); if (nvram->drive) { alen = bdrv_pread(nvram->drive, offset, membuf, len); } else { assert(nvram->buf); memcpy(membuf, nvram->buf + offset, len); alen = len; } cpu_physical_memory_unmap(membuf, len, 1, len); rtas_st(rets, 0, (alen < len) ? -1 : 0); rtas_st(rets, 1, (alen < 0) ? 0 : alen); }
{ "code": [], "line_no": [] }
static void FUNC_0(sPAPREnvironment *VAR_0, uint32_t VAR_1, uint32_t VAR_2, target_ulong VAR_3, uint32_t VAR_4, target_ulong VAR_5) { sPAPRNVRAM *nvram = VAR_0->nvram; hwaddr offset, buffer, len; int VAR_6; void *VAR_7; if ((VAR_2 != 3) || (VAR_4 != 2)) { rtas_st(VAR_5, 0, -3); return; } if (!nvram) { rtas_st(VAR_5, 0, -1); rtas_st(VAR_5, 1, 0); return; } offset = rtas_ld(VAR_3, 0); buffer = rtas_ld(VAR_3, 1); len = rtas_ld(VAR_3, 2); if (((offset + len) < offset) || ((offset + len) > nvram->size)) { rtas_st(VAR_5, 0, -3); rtas_st(VAR_5, 1, 0); return; } VAR_7 = cpu_physical_memory_map(buffer, &len, 1); if (nvram->drive) { VAR_6 = bdrv_pread(nvram->drive, offset, VAR_7, len); } else { assert(nvram->buf); memcpy(VAR_7, nvram->buf + offset, len); VAR_6 = len; } cpu_physical_memory_unmap(VAR_7, len, 1, len); rtas_st(VAR_5, 0, (VAR_6 < len) ? -1 : 0); rtas_st(VAR_5, 1, (VAR_6 < 0) ? 0 : VAR_6); }
[ "static void FUNC_0(sPAPREnvironment *VAR_0,\nuint32_t VAR_1, uint32_t VAR_2,\ntarget_ulong VAR_3,\nuint32_t VAR_4, target_ulong VAR_5)\n{", "sPAPRNVRAM *nvram = VAR_0->nvram;", "hwaddr offset, buffer, len;", "int VAR_6;", "void *VAR_7;", "if ((VAR_2 != 3) || (VAR_4 != 2)) {", "rtas_st(VAR_5, 0, -3);", "return;", "}", "if (!nvram) {", "rtas_st(VAR_5, 0, -1);", "rtas_st(VAR_5, 1, 0);", "return;", "}", "offset = rtas_ld(VAR_3, 0);", "buffer = rtas_ld(VAR_3, 1);", "len = rtas_ld(VAR_3, 2);", "if (((offset + len) < offset)\n|| ((offset + len) > nvram->size)) {", "rtas_st(VAR_5, 0, -3);", "rtas_st(VAR_5, 1, 0);", "return;", "}", "VAR_7 = cpu_physical_memory_map(buffer, &len, 1);", "if (nvram->drive) {", "VAR_6 = bdrv_pread(nvram->drive, offset, VAR_7, len);", "} else {", "assert(nvram->buf);", "memcpy(VAR_7, nvram->buf + offset, len);", "VAR_6 = len;", "}", "cpu_physical_memory_unmap(VAR_7, len, 1, len);", "rtas_st(VAR_5, 0, (VAR_6 < len) ? -1 : 0);", "rtas_st(VAR_5, 1, (VAR_6 < 0) ? 0 : 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 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 51, 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 87 ], [ 89 ], [ 91 ] ]
12,625
int socket_connect(SocketAddressLegacy *addr, NonBlockingConnectHandler *callback, void *opaque, Error **errp) { int fd; switch (addr->type) { case SOCKET_ADDRESS_LEGACY_KIND_INET: fd = inet_connect_saddr(addr->u.inet.data, callback, opaque, errp); break; case SOCKET_ADDRESS_LEGACY_KIND_UNIX: fd = unix_connect_saddr(addr->u.q_unix.data, callback, opaque, errp); break; case SOCKET_ADDRESS_LEGACY_KIND_FD: fd = monitor_get_fd(cur_mon, addr->u.fd.data->str, errp); if (fd >= 0 && callback) { qemu_set_nonblock(fd); callback(fd, NULL, opaque); } break; case SOCKET_ADDRESS_LEGACY_KIND_VSOCK: fd = vsock_connect_saddr(addr->u.vsock.data, callback, opaque, errp); break; default: abort(); } return fd; }
false
qemu
bd269ebc82fbaa5fe7ce5bc7c1770ac8acecd884
int socket_connect(SocketAddressLegacy *addr, NonBlockingConnectHandler *callback, void *opaque, Error **errp) { int fd; switch (addr->type) { case SOCKET_ADDRESS_LEGACY_KIND_INET: fd = inet_connect_saddr(addr->u.inet.data, callback, opaque, errp); break; case SOCKET_ADDRESS_LEGACY_KIND_UNIX: fd = unix_connect_saddr(addr->u.q_unix.data, callback, opaque, errp); break; case SOCKET_ADDRESS_LEGACY_KIND_FD: fd = monitor_get_fd(cur_mon, addr->u.fd.data->str, errp); if (fd >= 0 && callback) { qemu_set_nonblock(fd); callback(fd, NULL, opaque); } break; case SOCKET_ADDRESS_LEGACY_KIND_VSOCK: fd = vsock_connect_saddr(addr->u.vsock.data, callback, opaque, errp); break; default: abort(); } return fd; }
{ "code": [], "line_no": [] }
int FUNC_0(SocketAddressLegacy *VAR_0, NonBlockingConnectHandler *VAR_1, void *VAR_2, Error **VAR_3) { int VAR_4; switch (VAR_0->type) { case SOCKET_ADDRESS_LEGACY_KIND_INET: VAR_4 = inet_connect_saddr(VAR_0->u.inet.data, VAR_1, VAR_2, VAR_3); break; case SOCKET_ADDRESS_LEGACY_KIND_UNIX: VAR_4 = unix_connect_saddr(VAR_0->u.q_unix.data, VAR_1, VAR_2, VAR_3); break; case SOCKET_ADDRESS_LEGACY_KIND_FD: VAR_4 = monitor_get_fd(cur_mon, VAR_0->u.VAR_4.data->str, VAR_3); if (VAR_4 >= 0 && VAR_1) { qemu_set_nonblock(VAR_4); VAR_1(VAR_4, NULL, VAR_2); } break; case SOCKET_ADDRESS_LEGACY_KIND_VSOCK: VAR_4 = vsock_connect_saddr(VAR_0->u.vsock.data, VAR_1, VAR_2, VAR_3); break; default: abort(); } return VAR_4; }
[ "int FUNC_0(SocketAddressLegacy *VAR_0, NonBlockingConnectHandler *VAR_1,\nvoid *VAR_2, Error **VAR_3)\n{", "int VAR_4;", "switch (VAR_0->type) {", "case SOCKET_ADDRESS_LEGACY_KIND_INET:\nVAR_4 = inet_connect_saddr(VAR_0->u.inet.data, VAR_1, VAR_2, VAR_3);", "break;", "case SOCKET_ADDRESS_LEGACY_KIND_UNIX:\nVAR_4 = unix_connect_saddr(VAR_0->u.q_unix.data, VAR_1, VAR_2, VAR_3);", "break;", "case SOCKET_ADDRESS_LEGACY_KIND_FD:\nVAR_4 = monitor_get_fd(cur_mon, VAR_0->u.VAR_4.data->str, VAR_3);", "if (VAR_4 >= 0 && VAR_1) {", "qemu_set_nonblock(VAR_4);", "VAR_1(VAR_4, NULL, VAR_2);", "}", "break;", "case SOCKET_ADDRESS_LEGACY_KIND_VSOCK:\nVAR_4 = vsock_connect_saddr(VAR_0->u.vsock.data, VAR_1, VAR_2, VAR_3);", "break;", "default:\nabort();", "}", "return VAR_4;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13, 15 ], [ 17 ], [ 21, 23 ], [ 25 ], [ 29, 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45, 47 ], [ 49 ], [ 53, 55 ], [ 57 ], [ 59 ], [ 61 ] ]
12,626
static void validate_numa_cpus(void) { int i; unsigned long *seen_cpus = bitmap_new(max_cpus); for (i = 0; i < nb_numa_nodes; i++) { if (bitmap_intersects(seen_cpus, numa_info[i].node_cpu, max_cpus)) { bitmap_and(seen_cpus, seen_cpus, numa_info[i].node_cpu, max_cpus); error_report("CPU(s) present in multiple NUMA nodes: %s", enumerate_cpus(seen_cpus, max_cpus)); g_free(seen_cpus); exit(EXIT_FAILURE); } bitmap_or(seen_cpus, seen_cpus, numa_info[i].node_cpu, max_cpus); } if (!bitmap_full(seen_cpus, max_cpus)) { char *msg; bitmap_complement(seen_cpus, seen_cpus, max_cpus); msg = enumerate_cpus(seen_cpus, max_cpus); error_report("warning: CPU(s) not present in any NUMA nodes: %s", msg); error_report("warning: All CPU(s) up to maxcpus should be described " "in NUMA config"); g_free(msg); } g_free(seen_cpus); }
false
qemu
ec78f8114bc4c133fc56fefa7f2af99725e42857
static void validate_numa_cpus(void) { int i; unsigned long *seen_cpus = bitmap_new(max_cpus); for (i = 0; i < nb_numa_nodes; i++) { if (bitmap_intersects(seen_cpus, numa_info[i].node_cpu, max_cpus)) { bitmap_and(seen_cpus, seen_cpus, numa_info[i].node_cpu, max_cpus); error_report("CPU(s) present in multiple NUMA nodes: %s", enumerate_cpus(seen_cpus, max_cpus)); g_free(seen_cpus); exit(EXIT_FAILURE); } bitmap_or(seen_cpus, seen_cpus, numa_info[i].node_cpu, max_cpus); } if (!bitmap_full(seen_cpus, max_cpus)) { char *msg; bitmap_complement(seen_cpus, seen_cpus, max_cpus); msg = enumerate_cpus(seen_cpus, max_cpus); error_report("warning: CPU(s) not present in any NUMA nodes: %s", msg); error_report("warning: All CPU(s) up to maxcpus should be described " "in NUMA config"); g_free(msg); } g_free(seen_cpus); }
{ "code": [], "line_no": [] }
static void FUNC_0(void) { int VAR_0; unsigned long *VAR_1 = bitmap_new(max_cpus); for (VAR_0 = 0; VAR_0 < nb_numa_nodes; VAR_0++) { if (bitmap_intersects(VAR_1, numa_info[VAR_0].node_cpu, max_cpus)) { bitmap_and(VAR_1, VAR_1, numa_info[VAR_0].node_cpu, max_cpus); error_report("CPU(s) present in multiple NUMA nodes: %s", enumerate_cpus(VAR_1, max_cpus)); g_free(VAR_1); exit(EXIT_FAILURE); } bitmap_or(VAR_1, VAR_1, numa_info[VAR_0].node_cpu, max_cpus); } if (!bitmap_full(VAR_1, max_cpus)) { char *VAR_2; bitmap_complement(VAR_1, VAR_1, max_cpus); VAR_2 = enumerate_cpus(VAR_1, max_cpus); error_report("warning: CPU(s) not present in any NUMA nodes: %s", VAR_2); error_report("warning: All CPU(s) up to maxcpus should be described " "in NUMA config"); g_free(VAR_2); } g_free(VAR_1); }
[ "static void FUNC_0(void)\n{", "int VAR_0;", "unsigned long *VAR_1 = bitmap_new(max_cpus);", "for (VAR_0 = 0; VAR_0 < nb_numa_nodes; VAR_0++) {", "if (bitmap_intersects(VAR_1, numa_info[VAR_0].node_cpu, max_cpus)) {", "bitmap_and(VAR_1, VAR_1,\nnuma_info[VAR_0].node_cpu, max_cpus);", "error_report(\"CPU(s) present in multiple NUMA nodes: %s\",\nenumerate_cpus(VAR_1, max_cpus));", "g_free(VAR_1);", "exit(EXIT_FAILURE);", "}", "bitmap_or(VAR_1, VAR_1,\nnuma_info[VAR_0].node_cpu, max_cpus);", "}", "if (!bitmap_full(VAR_1, max_cpus)) {", "char *VAR_2;", "bitmap_complement(VAR_1, VAR_1, max_cpus);", "VAR_2 = enumerate_cpus(VAR_1, max_cpus);", "error_report(\"warning: CPU(s) not present in any NUMA nodes: %s\", VAR_2);", "error_report(\"warning: All CPU(s) up to maxcpus should be described \"\n\"in NUMA config\");", "g_free(VAR_2);", "}", "g_free(VAR_1);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15, 17 ], [ 19, 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29, 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47, 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ] ]
12,627
void hmp_nbd_server_start(Monitor *mon, const QDict *qdict) { const char *uri = qdict_get_str(qdict, "uri"); bool writable = qdict_get_try_bool(qdict, "writable", false); bool all = qdict_get_try_bool(qdict, "all", false); Error *local_err = NULL; BlockInfoList *block_list, *info; SocketAddressLegacy *addr; if (writable && !all) { error_setg(&local_err, "-w only valid together with -a"); goto exit; } /* First check if the address is valid and start the server. */ addr = socket_parse(uri, &local_err); if (local_err != NULL) { goto exit; } qmp_nbd_server_start(addr, false, NULL, &local_err); qapi_free_SocketAddressLegacy(addr); if (local_err != NULL) { goto exit; } if (!all) { return; } /* Then try adding all block devices. If one fails, close all and * exit. */ block_list = qmp_query_block(NULL); for (info = block_list; info; info = info->next) { if (!info->value->has_inserted) { continue; } qmp_nbd_server_add(info->value->device, true, writable, &local_err); if (local_err != NULL) { qmp_nbd_server_stop(NULL); break; } } qapi_free_BlockInfoList(block_list); exit: hmp_handle_error(mon, &local_err); }
false
qemu
bd269ebc82fbaa5fe7ce5bc7c1770ac8acecd884
void hmp_nbd_server_start(Monitor *mon, const QDict *qdict) { const char *uri = qdict_get_str(qdict, "uri"); bool writable = qdict_get_try_bool(qdict, "writable", false); bool all = qdict_get_try_bool(qdict, "all", false); Error *local_err = NULL; BlockInfoList *block_list, *info; SocketAddressLegacy *addr; if (writable && !all) { error_setg(&local_err, "-w only valid together with -a"); goto exit; } addr = socket_parse(uri, &local_err); if (local_err != NULL) { goto exit; } qmp_nbd_server_start(addr, false, NULL, &local_err); qapi_free_SocketAddressLegacy(addr); if (local_err != NULL) { goto exit; } if (!all) { return; } block_list = qmp_query_block(NULL); for (info = block_list; info; info = info->next) { if (!info->value->has_inserted) { continue; } qmp_nbd_server_add(info->value->device, true, writable, &local_err); if (local_err != NULL) { qmp_nbd_server_stop(NULL); break; } } qapi_free_BlockInfoList(block_list); exit: hmp_handle_error(mon, &local_err); }
{ "code": [], "line_no": [] }
void FUNC_0(Monitor *VAR_0, const QDict *VAR_1) { const char *VAR_2 = qdict_get_str(VAR_1, "VAR_2"); bool writable = qdict_get_try_bool(VAR_1, "writable", false); bool all = qdict_get_try_bool(VAR_1, "all", false); Error *local_err = NULL; BlockInfoList *block_list, *info; SocketAddressLegacy *addr; if (writable && !all) { error_setg(&local_err, "-w only valid together with -a"); goto exit; } addr = socket_parse(VAR_2, &local_err); if (local_err != NULL) { goto exit; } qmp_nbd_server_start(addr, false, NULL, &local_err); qapi_free_SocketAddressLegacy(addr); if (local_err != NULL) { goto exit; } if (!all) { return; } block_list = qmp_query_block(NULL); for (info = block_list; info; info = info->next) { if (!info->value->has_inserted) { continue; } qmp_nbd_server_add(info->value->device, true, writable, &local_err); if (local_err != NULL) { qmp_nbd_server_stop(NULL); break; } } qapi_free_BlockInfoList(block_list); exit: hmp_handle_error(VAR_0, &local_err); }
[ "void FUNC_0(Monitor *VAR_0, const QDict *VAR_1)\n{", "const char *VAR_2 = qdict_get_str(VAR_1, \"VAR_2\");", "bool writable = qdict_get_try_bool(VAR_1, \"writable\", false);", "bool all = qdict_get_try_bool(VAR_1, \"all\", false);", "Error *local_err = NULL;", "BlockInfoList *block_list, *info;", "SocketAddressLegacy *addr;", "if (writable && !all) {", "error_setg(&local_err, \"-w only valid together with -a\");", "goto exit;", "}", "addr = socket_parse(VAR_2, &local_err);", "if (local_err != NULL) {", "goto exit;", "}", "qmp_nbd_server_start(addr, false, NULL, &local_err);", "qapi_free_SocketAddressLegacy(addr);", "if (local_err != NULL) {", "goto exit;", "}", "if (!all) {", "return;", "}", "block_list = qmp_query_block(NULL);", "for (info = block_list; info; info = info->next) {", "if (!info->value->has_inserted) {", "continue;", "}", "qmp_nbd_server_add(info->value->device, true, writable, &local_err);", "if (local_err != NULL) {", "qmp_nbd_server_stop(NULL);", "break;", "}", "}", "qapi_free_BlockInfoList(block_list);", "exit:\nhmp_handle_error(VAR_0, &local_err);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 97 ], [ 101, 103 ], [ 105 ] ]
12,629
static void RENAME(yuv2bgr24_2)(SwsContext *c, const uint16_t *buf0, const uint16_t *buf1, const uint16_t *ubuf0, const uint16_t *ubuf1, const uint16_t *vbuf0, const uint16_t *vbuf1, const uint16_t *abuf0, const uint16_t *abuf1, uint8_t *dest, int dstW, int yalpha, int uvalpha, int y) { //Note 8280 == DSTW_OFFSET but the preprocessor can't handle that there :( __asm__ volatile( "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" "mov %4, %%"REG_b" \n\t" "push %%"REG_BP" \n\t" YSCALEYUV2RGB(%%REGBP, %5) "pxor %%mm7, %%mm7 \n\t" WRITEBGR24(%%REGb, 8280(%5), %%REGBP) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "m" (dest), "a" (&c->redDither) ); }
false
FFmpeg
13a099799e89a76eb921ca452e1b04a7a28a9855
static void RENAME(yuv2bgr24_2)(SwsContext *c, const uint16_t *buf0, const uint16_t *buf1, const uint16_t *ubuf0, const uint16_t *ubuf1, const uint16_t *vbuf0, const uint16_t *vbuf1, const uint16_t *abuf0, const uint16_t *abuf1, uint8_t *dest, int dstW, int yalpha, int uvalpha, int y) { __asm__ volatile( "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" "mov %4, %%"REG_b" \n\t" "push %%"REG_BP" \n\t" YSCALEYUV2RGB(%%REGBP, %5) "pxor %%mm7, %%mm7 \n\t" WRITEBGR24(%%REGb, 8280(%5), %%REGBP) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "m" (dest), "a" (&c->redDither) ); }
{ "code": [], "line_no": [] }
static void FUNC_0(yuv2bgr24_2)(SwsContext *c, const uint16_t *buf0, const uint16_t *buf1, const uint16_t *ubuf0, const uint16_t *ubuf1, const uint16_t *vbuf0, const uint16_t *vbuf1, const uint16_t *abuf0, const uint16_t *abuf1, uint8_t *dest, int dstW, int yalpha, int uvalpha, int y) { __asm__ volatile( "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" "mov %4, %%"REG_b" \n\t" "push %%"REG_BP" \n\t" YSCALEYUV2RGB(%%REGBP, %5) "pxor %%mm7, %%mm7 \n\t" WRITEBGR24(%%REGb, 8280(%5), %%REGBP) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "m" (dest), "a" (&c->redDither) ); }
[ "static void FUNC_0(yuv2bgr24_2)(SwsContext *c, const uint16_t *buf0,\nconst uint16_t *buf1, const uint16_t *ubuf0,\nconst uint16_t *ubuf1, const uint16_t *vbuf0,\nconst uint16_t *vbuf1, const uint16_t *abuf0,\nconst uint16_t *abuf1, uint8_t *dest,\nint dstW, int yalpha, int uvalpha, int y)\n{", "__asm__ volatile(\n\"mov %%\"REG_b\", \"ESP_OFFSET\"(%5) \\n\\t\"\n\"mov %4, %%\"REG_b\" \\n\\t\"\n\"push %%\"REG_BP\" \\n\\t\"\nYSCALEYUV2RGB(%%REGBP, %5)\n\"pxor %%mm7, %%mm7 \\n\\t\"\nWRITEBGR24(%%REGb, 8280(%5), %%REGBP)\n\"pop %%\"REG_BP\" \\n\\t\"\n\"mov \"ESP_OFFSET\"(%5), %%\"REG_b\" \\n\\t\"\n:: \"c\" (buf0), \"d\" (buf1), \"S\" (ubuf0), \"D\" (ubuf1), \"m\" (dest),\n\"a\" (&c->redDither)\n);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11, 13 ], [ 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39 ], [ 41 ] ]
12,630
void cpu_dump_statistics (CPUState *env, FILE*f, int (*cpu_fprintf)(FILE *f, const char *fmt, ...), int flags) { #if defined(DO_PPC_STATISTICS) opc_handler_t **t1, **t2, **t3, *handler; int op1, op2, op3; t1 = env->opcodes; for (op1 = 0; op1 < 64; op1++) { handler = t1[op1]; if (is_indirect_opcode(handler)) { t2 = ind_table(handler); for (op2 = 0; op2 < 32; op2++) { handler = t2[op2]; if (is_indirect_opcode(handler)) { t3 = ind_table(handler); for (op3 = 0; op3 < 32; op3++) { handler = t3[op3]; if (handler->count == 0) continue; cpu_fprintf(f, "%02x %02x %02x (%02x %04d) %16s: " "%016" PRIx64 " %" PRId64 "\n", op1, op2, op3, op1, (op3 << 5) | op2, handler->oname, handler->count, handler->count); } } else { if (handler->count == 0) continue; cpu_fprintf(f, "%02x %02x (%02x %04d) %16s: " "%016" PRIx64 " %" PRId64 "\n", op1, op2, op1, op2, handler->oname, handler->count, handler->count); } } } else { if (handler->count == 0) continue; cpu_fprintf(f, "%02x (%02x ) %16s: %016" PRIx64 " %" PRId64 "\n", op1, op1, handler->oname, handler->count, handler->count); } } #endif }
false
qemu
9a78eead0c74333a394c0f7bbfc4423ac746fcd5
void cpu_dump_statistics (CPUState *env, FILE*f, int (*cpu_fprintf)(FILE *f, const char *fmt, ...), int flags) { #if defined(DO_PPC_STATISTICS) opc_handler_t **t1, **t2, **t3, *handler; int op1, op2, op3; t1 = env->opcodes; for (op1 = 0; op1 < 64; op1++) { handler = t1[op1]; if (is_indirect_opcode(handler)) { t2 = ind_table(handler); for (op2 = 0; op2 < 32; op2++) { handler = t2[op2]; if (is_indirect_opcode(handler)) { t3 = ind_table(handler); for (op3 = 0; op3 < 32; op3++) { handler = t3[op3]; if (handler->count == 0) continue; cpu_fprintf(f, "%02x %02x %02x (%02x %04d) %16s: " "%016" PRIx64 " %" PRId64 "\n", op1, op2, op3, op1, (op3 << 5) | op2, handler->oname, handler->count, handler->count); } } else { if (handler->count == 0) continue; cpu_fprintf(f, "%02x %02x (%02x %04d) %16s: " "%016" PRIx64 " %" PRId64 "\n", op1, op2, op1, op2, handler->oname, handler->count, handler->count); } } } else { if (handler->count == 0) continue; cpu_fprintf(f, "%02x (%02x ) %16s: %016" PRIx64 " %" PRId64 "\n", op1, op1, handler->oname, handler->count, handler->count); } } #endif }
{ "code": [], "line_no": [] }
void FUNC_0 (CPUState *VAR_0, FILE*VAR_3, int (*VAR_2)(FILE *VAR_3, const char *VAR_3, ...), int VAR_4) { #if defined(DO_PPC_STATISTICS) opc_handler_t **t1, **t2, **t3, *handler; int op1, op2, op3; t1 = VAR_0->opcodes; for (op1 = 0; op1 < 64; op1++) { handler = t1[op1]; if (is_indirect_opcode(handler)) { t2 = ind_table(handler); for (op2 = 0; op2 < 32; op2++) { handler = t2[op2]; if (is_indirect_opcode(handler)) { t3 = ind_table(handler); for (op3 = 0; op3 < 32; op3++) { handler = t3[op3]; if (handler->count == 0) continue; VAR_2(VAR_3, "%02x %02x %02x (%02x %04d) %16s: " "%016" PRIx64 " %" PRId64 "\n", op1, op2, op3, op1, (op3 << 5) | op2, handler->oname, handler->count, handler->count); } } else { if (handler->count == 0) continue; VAR_2(VAR_3, "%02x %02x (%02x %04d) %16s: " "%016" PRIx64 " %" PRId64 "\n", op1, op2, op1, op2, handler->oname, handler->count, handler->count); } } } else { if (handler->count == 0) continue; VAR_2(VAR_3, "%02x (%02x ) %16s: %016" PRIx64 " %" PRId64 "\n", op1, op1, handler->oname, handler->count, handler->count); } } #endif }
[ "void FUNC_0 (CPUState *VAR_0, FILE*VAR_3,\nint (*VAR_2)(FILE *VAR_3, const char *VAR_3, ...),\nint VAR_4)\n{", "#if defined(DO_PPC_STATISTICS)\nopc_handler_t **t1, **t2, **t3, *handler;", "int op1, op2, op3;", "t1 = VAR_0->opcodes;", "for (op1 = 0; op1 < 64; op1++) {", "handler = t1[op1];", "if (is_indirect_opcode(handler)) {", "t2 = ind_table(handler);", "for (op2 = 0; op2 < 32; op2++) {", "handler = t2[op2];", "if (is_indirect_opcode(handler)) {", "t3 = ind_table(handler);", "for (op3 = 0; op3 < 32; op3++) {", "handler = t3[op3];", "if (handler->count == 0)\ncontinue;", "VAR_2(VAR_3, \"%02x %02x %02x (%02x %04d) %16s: \"\n\"%016\" PRIx64 \" %\" PRId64 \"\\n\",\nop1, op2, op3, op1, (op3 << 5) | op2,\nhandler->oname,\nhandler->count, handler->count);", "}", "} else {", "if (handler->count == 0)\ncontinue;", "VAR_2(VAR_3, \"%02x %02x (%02x %04d) %16s: \"\n\"%016\" PRIx64 \" %\" PRId64 \"\\n\",\nop1, op2, op1, op2, handler->oname,\nhandler->count, handler->count);", "}", "}", "} else {", "if (handler->count == 0)\ncontinue;", "VAR_2(VAR_3, \"%02x (%02x ) %16s: %016\" PRIx64\n\" %\" PRId64 \"\\n\",\nop1, op1, handler->oname,\nhandler->count, handler->count);", "}", "}", "#endif\n}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9, 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39, 41 ], [ 43, 45, 47, 49, 51 ], [ 53 ], [ 55 ], [ 57, 59 ], [ 61, 63, 65, 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75, 77 ], [ 79, 81, 83, 85 ], [ 87 ], [ 89 ], [ 91, 93 ] ]
12,631
static Suite *qint_suite(void) { Suite *s; TCase *qint_public_tcase; s = suite_create("QInt test-suite"); qint_public_tcase = tcase_create("Public Interface"); suite_add_tcase(s, qint_public_tcase); tcase_add_test(qint_public_tcase, qint_from_int_test); tcase_add_test(qint_public_tcase, qint_destroy_test); tcase_add_test(qint_public_tcase, qint_from_int64_test); tcase_add_test(qint_public_tcase, qint_get_int_test); tcase_add_test(qint_public_tcase, qobject_to_qint_test); return s; }
false
qemu
65cdadd2e2de76f7db3bf6b7d8dd8c67abff9659
static Suite *qint_suite(void) { Suite *s; TCase *qint_public_tcase; s = suite_create("QInt test-suite"); qint_public_tcase = tcase_create("Public Interface"); suite_add_tcase(s, qint_public_tcase); tcase_add_test(qint_public_tcase, qint_from_int_test); tcase_add_test(qint_public_tcase, qint_destroy_test); tcase_add_test(qint_public_tcase, qint_from_int64_test); tcase_add_test(qint_public_tcase, qint_get_int_test); tcase_add_test(qint_public_tcase, qobject_to_qint_test); return s; }
{ "code": [], "line_no": [] }
static Suite *FUNC_0(void) { Suite *s; TCase *qint_public_tcase; s = suite_create("QInt test-suite"); qint_public_tcase = tcase_create("Public Interface"); suite_add_tcase(s, qint_public_tcase); tcase_add_test(qint_public_tcase, qint_from_int_test); tcase_add_test(qint_public_tcase, qint_destroy_test); tcase_add_test(qint_public_tcase, qint_from_int64_test); tcase_add_test(qint_public_tcase, qint_get_int_test); tcase_add_test(qint_public_tcase, qobject_to_qint_test); return s; }
[ "static Suite *FUNC_0(void)\n{", "Suite *s;", "TCase *qint_public_tcase;", "s = suite_create(\"QInt test-suite\");", "qint_public_tcase = tcase_create(\"Public Interface\");", "suite_add_tcase(s, qint_public_tcase);", "tcase_add_test(qint_public_tcase, qint_from_int_test);", "tcase_add_test(qint_public_tcase, qint_destroy_test);", "tcase_add_test(qint_public_tcase, qint_from_int64_test);", "tcase_add_test(qint_public_tcase, qint_get_int_test);", "tcase_add_test(qint_public_tcase, qobject_to_qint_test);", "return s;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ] ]
12,632
static void qmp_input_type_int64(Visitor *v, const char *name, int64_t *obj, Error **errp) { QmpInputVisitor *qiv = to_qiv(v); QObject *qobj = qmp_input_get_object(qiv, name, true, errp); QInt *qint; if (!qobj) { return; } qint = qobject_to_qint(qobj); if (!qint) { error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null", "integer"); return; } *obj = qint_get_int(qint); }
false
qemu
b3db211f3c80bb996a704d665fe275619f728bd4
static void qmp_input_type_int64(Visitor *v, const char *name, int64_t *obj, Error **errp) { QmpInputVisitor *qiv = to_qiv(v); QObject *qobj = qmp_input_get_object(qiv, name, true, errp); QInt *qint; if (!qobj) { return; } qint = qobject_to_qint(qobj); if (!qint) { error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null", "integer"); return; } *obj = qint_get_int(qint); }
{ "code": [], "line_no": [] }
static void FUNC_0(Visitor *VAR_0, const char *VAR_1, int64_t *VAR_2, Error **VAR_3) { QmpInputVisitor *qiv = to_qiv(VAR_0); QObject *qobj = qmp_input_get_object(qiv, VAR_1, true, VAR_3); QInt *qint; if (!qobj) { return; } qint = qobject_to_qint(qobj); if (!qint) { error_setg(VAR_3, QERR_INVALID_PARAMETER_TYPE, VAR_1 ? VAR_1 : "null", "integer"); return; } *VAR_2 = qint_get_int(qint); }
[ "static void FUNC_0(Visitor *VAR_0, const char *VAR_1, int64_t *VAR_2,\nError **VAR_3)\n{", "QmpInputVisitor *qiv = to_qiv(VAR_0);", "QObject *qobj = qmp_input_get_object(qiv, VAR_1, true, VAR_3);", "QInt *qint;", "if (!qobj) {", "return;", "}", "qint = qobject_to_qint(qobj);", "if (!qint) {", "error_setg(VAR_3, QERR_INVALID_PARAMETER_TYPE, VAR_1 ? VAR_1 : \"null\",\n\"integer\");", "return;", "}", "*VAR_2 = qint_get_int(qint);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ] ]
12,633
static gint ppc_cpu_compare_class_pvr_mask(gconstpointer a, gconstpointer b) { ObjectClass *oc = (ObjectClass *)a; uint32_t pvr = *(uint32_t *)b; PowerPCCPUClass *pcc = (PowerPCCPUClass *)a; gint ret; /* -cpu host does a PVR lookup during construction */ if (unlikely(strcmp(object_class_get_name(oc), TYPE_HOST_POWERPC_CPU) == 0)) { return -1; } if (!ppc_cpu_is_valid(pcc)) { return -1; } ret = (((pcc->pvr & pcc->pvr_mask) == (pvr & pcc->pvr_mask)) ? 0 : -1); return ret; }
false
qemu
03ae4133ab8675d4c67e6fdc8032de7c53a89514
static gint ppc_cpu_compare_class_pvr_mask(gconstpointer a, gconstpointer b) { ObjectClass *oc = (ObjectClass *)a; uint32_t pvr = *(uint32_t *)b; PowerPCCPUClass *pcc = (PowerPCCPUClass *)a; gint ret; if (unlikely(strcmp(object_class_get_name(oc), TYPE_HOST_POWERPC_CPU) == 0)) { return -1; } if (!ppc_cpu_is_valid(pcc)) { return -1; } ret = (((pcc->pvr & pcc->pvr_mask) == (pvr & pcc->pvr_mask)) ? 0 : -1); return ret; }
{ "code": [], "line_no": [] }
static gint FUNC_0(gconstpointer a, gconstpointer b) { ObjectClass *oc = (ObjectClass *)a; uint32_t pvr = *(uint32_t *)b; PowerPCCPUClass *pcc = (PowerPCCPUClass *)a; gint ret; if (unlikely(strcmp(object_class_get_name(oc), TYPE_HOST_POWERPC_CPU) == 0)) { return -1; } if (!ppc_cpu_is_valid(pcc)) { return -1; } ret = (((pcc->pvr & pcc->pvr_mask) == (pvr & pcc->pvr_mask)) ? 0 : -1); return ret; }
[ "static gint FUNC_0(gconstpointer a, gconstpointer b)\n{", "ObjectClass *oc = (ObjectClass *)a;", "uint32_t pvr = *(uint32_t *)b;", "PowerPCCPUClass *pcc = (PowerPCCPUClass *)a;", "gint ret;", "if (unlikely(strcmp(object_class_get_name(oc),\nTYPE_HOST_POWERPC_CPU) == 0)) {", "return -1;", "}", "if (!ppc_cpu_is_valid(pcc)) {", "return -1;", "}", "ret = (((pcc->pvr & pcc->pvr_mask) == (pvr & pcc->pvr_mask)) ? 0 : -1);", "return ret;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 17, 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 39 ], [ 41 ] ]
12,634
void cpu_resume_from_signal(CPUState *cpu, void *puc) { /* XXX: restore cpu registers saved in host registers */ cpu->exception_index = -1; siglongjmp(cpu->jmp_env, 1); }
false
qemu
6886b98036a8f8f5bce8b10756ce080084cef11b
void cpu_resume_from_signal(CPUState *cpu, void *puc) { cpu->exception_index = -1; siglongjmp(cpu->jmp_env, 1); }
{ "code": [], "line_no": [] }
void FUNC_0(CPUState *VAR_0, void *VAR_1) { VAR_0->exception_index = -1; siglongjmp(VAR_0->jmp_env, 1); }
[ "void FUNC_0(CPUState *VAR_0, void *VAR_1)\n{", "VAR_0->exception_index = -1;", "siglongjmp(VAR_0->jmp_env, 1);", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 9 ], [ 11 ], [ 13 ] ]
12,636
void bdrv_replace_in_backing_chain(BlockDriverState *old, BlockDriverState *new) { assert(!bdrv_requests_pending(old)); assert(!bdrv_requests_pending(new)); bdrv_ref(old); change_parent_backing_link(old, new); bdrv_unref(old); }
false
qemu
234ac1a9025bcfcc532449f72a97b3d4754d466c
void bdrv_replace_in_backing_chain(BlockDriverState *old, BlockDriverState *new) { assert(!bdrv_requests_pending(old)); assert(!bdrv_requests_pending(new)); bdrv_ref(old); change_parent_backing_link(old, new); bdrv_unref(old); }
{ "code": [], "line_no": [] }
void FUNC_0(BlockDriverState *VAR_0, BlockDriverState *VAR_1) { assert(!bdrv_requests_pending(VAR_0)); assert(!bdrv_requests_pending(VAR_1)); bdrv_ref(VAR_0); change_parent_backing_link(VAR_0, VAR_1); bdrv_unref(VAR_0); }
[ "void FUNC_0(BlockDriverState *VAR_0, BlockDriverState *VAR_1)\n{", "assert(!bdrv_requests_pending(VAR_0));", "assert(!bdrv_requests_pending(VAR_1));", "bdrv_ref(VAR_0);", "change_parent_backing_link(VAR_0, VAR_1);", "bdrv_unref(VAR_0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 15 ], [ 19 ], [ 21 ] ]
12,637
unsigned long virtio_load_direct(ulong rec_list1, ulong rec_list2, ulong subchan_id, void *load_addr) { u8 status; int sec = rec_list1; int sec_num = ((rec_list2 >> 32) & 0xffff) + 1; int sec_len = rec_list2 >> 48; ulong addr = (ulong)load_addr; if (sec_len != SECTOR_SIZE) { return -1; } sclp_print("."); status = virtio_read_many(sec, (void*)addr, sec_num); if (status) { virtio_panic("I/O Error"); } addr += sec_num * SECTOR_SIZE; return addr; }
false
qemu
abd696e4f74a9d30801c6ae2693efe4e5979c2f2
unsigned long virtio_load_direct(ulong rec_list1, ulong rec_list2, ulong subchan_id, void *load_addr) { u8 status; int sec = rec_list1; int sec_num = ((rec_list2 >> 32) & 0xffff) + 1; int sec_len = rec_list2 >> 48; ulong addr = (ulong)load_addr; if (sec_len != SECTOR_SIZE) { return -1; } sclp_print("."); status = virtio_read_many(sec, (void*)addr, sec_num); if (status) { virtio_panic("I/O Error"); } addr += sec_num * SECTOR_SIZE; return addr; }
{ "code": [], "line_no": [] }
unsigned long FUNC_0(ulong VAR_0, ulong VAR_1, ulong VAR_2, void *VAR_3) { u8 status; int VAR_4 = VAR_0; int VAR_5 = ((VAR_1 >> 32) & 0xffff) + 1; int VAR_6 = VAR_1 >> 48; ulong addr = (ulong)VAR_3; if (VAR_6 != SECTOR_SIZE) { return -1; } sclp_print("."); status = virtio_read_many(VAR_4, (void*)addr, VAR_5); if (status) { virtio_panic("I/O Error"); } addr += VAR_5 * SECTOR_SIZE; return addr; }
[ "unsigned long FUNC_0(ulong VAR_0, ulong VAR_1,\nulong VAR_2, void *VAR_3)\n{", "u8 status;", "int VAR_4 = VAR_0;", "int VAR_5 = ((VAR_1 >> 32) & 0xffff) + 1;", "int VAR_6 = VAR_1 >> 48;", "ulong addr = (ulong)VAR_3;", "if (VAR_6 != SECTOR_SIZE) {", "return -1;", "}", "sclp_print(\".\");", "status = virtio_read_many(VAR_4, (void*)addr, VAR_5);", "if (status) {", "virtio_panic(\"I/O Error\");", "}", "addr += VAR_5 * SECTOR_SIZE;", "return addr;", "}" ]
[ 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 ] ]
12,638
void xen_init_display(int domid) { struct XenDevice *xfb, *xin; struct XenFB *fb; struct XenInput *in; int i = 0; wait_more: i++; main_loop_wait(true); xfb = xen_be_find_xendev("vfb", domid, 0); xin = xen_be_find_xendev("vkbd", domid, 0); if (!xfb || !xin) { if (i < 256) { usleep(10000); goto wait_more; } xen_be_printf(NULL, 1, "displaystate setup failed\n"); return; } /* vfb */ fb = container_of(xfb, struct XenFB, c.xendev); fb->c.con = graphic_console_init(xenfb_update, xenfb_invalidate, NULL, NULL, fb); fb->have_console = 1; /* vkbd */ in = container_of(xin, struct XenInput, c.xendev); in->c.con = fb->c.con; /* retry ->init() */ xen_be_check_state(xin); xen_be_check_state(xfb); }
false
qemu
2c62f08ddbf3fa80dc7202eb9a2ea60ae44e2cc5
void xen_init_display(int domid) { struct XenDevice *xfb, *xin; struct XenFB *fb; struct XenInput *in; int i = 0; wait_more: i++; main_loop_wait(true); xfb = xen_be_find_xendev("vfb", domid, 0); xin = xen_be_find_xendev("vkbd", domid, 0); if (!xfb || !xin) { if (i < 256) { usleep(10000); goto wait_more; } xen_be_printf(NULL, 1, "displaystate setup failed\n"); return; } fb = container_of(xfb, struct XenFB, c.xendev); fb->c.con = graphic_console_init(xenfb_update, xenfb_invalidate, NULL, NULL, fb); fb->have_console = 1; in = container_of(xin, struct XenInput, c.xendev); in->c.con = fb->c.con; xen_be_check_state(xin); xen_be_check_state(xfb); }
{ "code": [], "line_no": [] }
void FUNC_0(int VAR_0) { struct XenDevice *VAR_1, *VAR_2; struct XenFB *VAR_3; struct XenInput *VAR_4; int VAR_5 = 0; wait_more: VAR_5++; main_loop_wait(true); VAR_1 = xen_be_find_xendev("vfb", VAR_0, 0); VAR_2 = xen_be_find_xendev("vkbd", VAR_0, 0); if (!VAR_1 || !VAR_2) { if (VAR_5 < 256) { usleep(10000); goto wait_more; } xen_be_printf(NULL, 1, "displaystate setup failed\n"); return; } VAR_3 = container_of(VAR_1, struct XenFB, c.xendev); VAR_3->c.con = graphic_console_init(xenfb_update, xenfb_invalidate, NULL, NULL, VAR_3); VAR_3->have_console = 1; VAR_4 = container_of(VAR_2, struct XenInput, c.xendev); VAR_4->c.con = VAR_3->c.con; xen_be_check_state(VAR_2); xen_be_check_state(VAR_1); }
[ "void FUNC_0(int VAR_0)\n{", "struct XenDevice *VAR_1, *VAR_2;", "struct XenFB *VAR_3;", "struct XenInput *VAR_4;", "int VAR_5 = 0;", "wait_more:\nVAR_5++;", "main_loop_wait(true);", "VAR_1 = xen_be_find_xendev(\"vfb\", VAR_0, 0);", "VAR_2 = xen_be_find_xendev(\"vkbd\", VAR_0, 0);", "if (!VAR_1 || !VAR_2) {", "if (VAR_5 < 256) {", "usleep(10000);", "goto wait_more;", "}", "xen_be_printf(NULL, 1, \"displaystate setup failed\\n\");", "return;", "}", "VAR_3 = container_of(VAR_1, struct XenFB, c.xendev);", "VAR_3->c.con = graphic_console_init(xenfb_update,\nxenfb_invalidate,\nNULL,\nNULL,\nVAR_3);", "VAR_3->have_console = 1;", "VAR_4 = container_of(VAR_2, struct XenInput, c.xendev);", "VAR_4->c.con = VAR_3->c.con;", "xen_be_check_state(VAR_2);", "xen_be_check_state(VAR_1);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15, 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 45 ], [ 47, 49, 51, 53, 55 ], [ 57 ], [ 63 ], [ 65 ], [ 71 ], [ 73 ], [ 75 ] ]
12,639
static int musicpal_lcd_init(SysBusDevice *dev) { musicpal_lcd_state *s = FROM_SYSBUS(musicpal_lcd_state, dev); s->brightness = 7; memory_region_init_io(&s->iomem, &musicpal_lcd_ops, s, "musicpal-lcd", MP_LCD_SIZE); sysbus_init_mmio(dev, &s->iomem); s->con = graphic_console_init(lcd_refresh, lcd_invalidate, NULL, NULL, s); qemu_console_resize(s->con, 128*3, 64*3); qdev_init_gpio_in(&dev->qdev, musicpal_lcd_gpio_brigthness_in, 3); return 0; }
false
qemu
2c62f08ddbf3fa80dc7202eb9a2ea60ae44e2cc5
static int musicpal_lcd_init(SysBusDevice *dev) { musicpal_lcd_state *s = FROM_SYSBUS(musicpal_lcd_state, dev); s->brightness = 7; memory_region_init_io(&s->iomem, &musicpal_lcd_ops, s, "musicpal-lcd", MP_LCD_SIZE); sysbus_init_mmio(dev, &s->iomem); s->con = graphic_console_init(lcd_refresh, lcd_invalidate, NULL, NULL, s); qemu_console_resize(s->con, 128*3, 64*3); qdev_init_gpio_in(&dev->qdev, musicpal_lcd_gpio_brigthness_in, 3); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(SysBusDevice *VAR_0) { musicpal_lcd_state *s = FROM_SYSBUS(musicpal_lcd_state, VAR_0); s->brightness = 7; memory_region_init_io(&s->iomem, &musicpal_lcd_ops, s, "musicpal-lcd", MP_LCD_SIZE); sysbus_init_mmio(VAR_0, &s->iomem); s->con = graphic_console_init(lcd_refresh, lcd_invalidate, NULL, NULL, s); qemu_console_resize(s->con, 128*3, 64*3); qdev_init_gpio_in(&VAR_0->qdev, musicpal_lcd_gpio_brigthness_in, 3); return 0; }
[ "static int FUNC_0(SysBusDevice *VAR_0)\n{", "musicpal_lcd_state *s = FROM_SYSBUS(musicpal_lcd_state, VAR_0);", "s->brightness = 7;", "memory_region_init_io(&s->iomem, &musicpal_lcd_ops, s,\n\"musicpal-lcd\", MP_LCD_SIZE);", "sysbus_init_mmio(VAR_0, &s->iomem);", "s->con = graphic_console_init(lcd_refresh, lcd_invalidate,\nNULL, NULL, s);", "qemu_console_resize(s->con, 128*3, 64*3);", "qdev_init_gpio_in(&VAR_0->qdev, musicpal_lcd_gpio_brigthness_in, 3);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 13, 15 ], [ 17 ], [ 21, 23 ], [ 25 ], [ 29 ], [ 33 ], [ 35 ] ]
12,640
static int mov_write_gmhd_tag(AVIOContext *pb) { avio_wb32(pb, 0x20); /* size */ ffio_wfourcc(pb, "gmhd"); avio_wb32(pb, 0x18); /* gmin size */ ffio_wfourcc(pb, "gmin");/* generic media info */ avio_wb32(pb, 0); /* version & flags */ avio_wb16(pb, 0x40); /* graphics mode = */ avio_wb16(pb, 0x8000); /* opColor (r?) */ avio_wb16(pb, 0x8000); /* opColor (g?) */ avio_wb16(pb, 0x8000); /* opColor (b?) */ avio_wb16(pb, 0); /* balance */ avio_wb16(pb, 0); /* reserved */ return 0x20; }
false
FFmpeg
ea60a11e8e2d818e8e56da4da3ff38e23a12bdff
static int mov_write_gmhd_tag(AVIOContext *pb) { avio_wb32(pb, 0x20); ffio_wfourcc(pb, "gmhd"); avio_wb32(pb, 0x18); ffio_wfourcc(pb, "gmin"); avio_wb32(pb, 0); avio_wb16(pb, 0x40); avio_wb16(pb, 0x8000); avio_wb16(pb, 0x8000); avio_wb16(pb, 0x8000); avio_wb16(pb, 0); avio_wb16(pb, 0); return 0x20; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVIOContext *VAR_0) { avio_wb32(VAR_0, 0x20); ffio_wfourcc(VAR_0, "gmhd"); avio_wb32(VAR_0, 0x18); ffio_wfourcc(VAR_0, "gmin"); avio_wb32(VAR_0, 0); avio_wb16(VAR_0, 0x40); avio_wb16(VAR_0, 0x8000); avio_wb16(VAR_0, 0x8000); avio_wb16(VAR_0, 0x8000); avio_wb16(VAR_0, 0); avio_wb16(VAR_0, 0); return 0x20; }
[ "static int FUNC_0(AVIOContext *VAR_0)\n{", "avio_wb32(VAR_0, 0x20);", "ffio_wfourcc(VAR_0, \"gmhd\");", "avio_wb32(VAR_0, 0x18);", "ffio_wfourcc(VAR_0, \"gmin\");", "avio_wb32(VAR_0, 0);", "avio_wb16(VAR_0, 0x40);", "avio_wb16(VAR_0, 0x8000);", "avio_wb16(VAR_0, 0x8000);", "avio_wb16(VAR_0, 0x8000);", "avio_wb16(VAR_0, 0);", "avio_wb16(VAR_0, 0);", "return 0x20;", "}" ]
[ 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 ] ]
12,641
int float64_le( float64 a, float64 b STATUS_PARAM ) { flag aSign, bSign; if ( ( ( extractFloat64Exp( a ) == 0x7FF ) && extractFloat64Frac( a ) ) || ( ( extractFloat64Exp( b ) == 0x7FF ) && extractFloat64Frac( b ) ) ) { float_raise( float_flag_invalid STATUS_VAR); return 0; } aSign = extractFloat64Sign( a ); bSign = extractFloat64Sign( b ); if ( aSign != bSign ) return aSign || ( (bits64) ( ( a | b )<<1 ) == 0 ); return ( a == b ) || ( aSign ^ ( a < b ) ); }
false
qemu
f090c9d4ad5812fb92843d6470a1111c15190c4c
int float64_le( float64 a, float64 b STATUS_PARAM ) { flag aSign, bSign; if ( ( ( extractFloat64Exp( a ) == 0x7FF ) && extractFloat64Frac( a ) ) || ( ( extractFloat64Exp( b ) == 0x7FF ) && extractFloat64Frac( b ) ) ) { float_raise( float_flag_invalid STATUS_VAR); return 0; } aSign = extractFloat64Sign( a ); bSign = extractFloat64Sign( b ); if ( aSign != bSign ) return aSign || ( (bits64) ( ( a | b )<<1 ) == 0 ); return ( a == b ) || ( aSign ^ ( a < b ) ); }
{ "code": [], "line_no": [] }
int FUNC_0( float64 VAR_0, float64 VAR_1 STATUS_PARAM ) { flag aSign, bSign; if ( ( ( extractFloat64Exp( VAR_0 ) == 0x7FF ) && extractFloat64Frac( VAR_0 ) ) || ( ( extractFloat64Exp( VAR_1 ) == 0x7FF ) && extractFloat64Frac( VAR_1 ) ) ) { float_raise( float_flag_invalid STATUS_VAR); return 0; } aSign = extractFloat64Sign( VAR_0 ); bSign = extractFloat64Sign( VAR_1 ); if ( aSign != bSign ) return aSign || ( (bits64) ( ( VAR_0 | VAR_1 )<<1 ) == 0 ); return ( VAR_0 == VAR_1 ) || ( aSign ^ ( VAR_0 < VAR_1 ) ); }
[ "int FUNC_0( float64 VAR_0, float64 VAR_1 STATUS_PARAM )\n{", "flag aSign, bSign;", "if ( ( ( extractFloat64Exp( VAR_0 ) == 0x7FF ) && extractFloat64Frac( VAR_0 ) )\n|| ( ( extractFloat64Exp( VAR_1 ) == 0x7FF ) && extractFloat64Frac( VAR_1 ) )\n) {", "float_raise( float_flag_invalid STATUS_VAR);", "return 0;", "}", "aSign = extractFloat64Sign( VAR_0 );", "bSign = extractFloat64Sign( VAR_1 );", "if ( aSign != bSign ) return aSign || ( (bits64) ( ( VAR_0 | VAR_1 )<<1 ) == 0 );", "return ( VAR_0 == VAR_1 ) || ( aSign ^ ( VAR_0 < VAR_1 ) );", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11, 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ] ]
12,643
static int usb_qdev_init(DeviceState *qdev, DeviceInfo *base) { USBDevice *dev = DO_UPCAST(USBDevice, qdev, qdev); USBDeviceInfo *info = DO_UPCAST(USBDeviceInfo, qdev, base); int rc; pstrcpy(dev->product_desc, sizeof(dev->product_desc), info->product_desc); dev->info = info; dev->auto_attach = 1; QLIST_INIT(&dev->strings); rc = dev->info->init(dev); if (rc == 0 && dev->auto_attach) rc = usb_device_attach(dev); return rc; }
false
qemu
891fb2cd4592b6fe76106a69e0ca40efbf82726a
static int usb_qdev_init(DeviceState *qdev, DeviceInfo *base) { USBDevice *dev = DO_UPCAST(USBDevice, qdev, qdev); USBDeviceInfo *info = DO_UPCAST(USBDeviceInfo, qdev, base); int rc; pstrcpy(dev->product_desc, sizeof(dev->product_desc), info->product_desc); dev->info = info; dev->auto_attach = 1; QLIST_INIT(&dev->strings); rc = dev->info->init(dev); if (rc == 0 && dev->auto_attach) rc = usb_device_attach(dev); return rc; }
{ "code": [], "line_no": [] }
static int FUNC_0(DeviceState *VAR_0, DeviceInfo *VAR_1) { USBDevice *dev = DO_UPCAST(USBDevice, VAR_0, VAR_0); USBDeviceInfo *info = DO_UPCAST(USBDeviceInfo, VAR_0, VAR_1); int VAR_2; pstrcpy(dev->product_desc, sizeof(dev->product_desc), info->product_desc); dev->info = info; dev->auto_attach = 1; QLIST_INIT(&dev->strings); VAR_2 = dev->info->init(dev); if (VAR_2 == 0 && dev->auto_attach) VAR_2 = usb_device_attach(dev); return VAR_2; }
[ "static int FUNC_0(DeviceState *VAR_0, DeviceInfo *VAR_1)\n{", "USBDevice *dev = DO_UPCAST(USBDevice, VAR_0, VAR_0);", "USBDeviceInfo *info = DO_UPCAST(USBDeviceInfo, VAR_0, VAR_1);", "int VAR_2;", "pstrcpy(dev->product_desc, sizeof(dev->product_desc), info->product_desc);", "dev->info = info;", "dev->auto_attach = 1;", "QLIST_INIT(&dev->strings);", "VAR_2 = dev->info->init(dev);", "if (VAR_2 == 0 && dev->auto_attach)\nVAR_2 = usb_device_attach(dev);", "return VAR_2;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 29 ] ]
12,644
static int64_t coroutine_fn bdrv_co_get_block_status(BlockDriverState *bs, int64_t sector_num, int nb_sectors, int *pnum) { int64_t length; int64_t n; int64_t ret, ret2; length = bdrv_getlength(bs); if (length < 0) { return length; } if (sector_num >= (length >> BDRV_SECTOR_BITS)) { *pnum = 0; return 0; } n = bs->total_sectors - sector_num; if (n < nb_sectors) { nb_sectors = n; } if (!bs->drv->bdrv_co_get_block_status) { *pnum = nb_sectors; ret = BDRV_BLOCK_DATA; if (bs->drv->protocol_name) { ret |= BDRV_BLOCK_OFFSET_VALID | (sector_num * BDRV_SECTOR_SIZE); } return ret; } ret = bs->drv->bdrv_co_get_block_status(bs, sector_num, nb_sectors, pnum); if (ret < 0) { *pnum = 0; return ret; } if (ret & BDRV_BLOCK_RAW) { assert(ret & BDRV_BLOCK_OFFSET_VALID); return bdrv_get_block_status(bs->file, ret >> BDRV_SECTOR_BITS, *pnum, pnum); } if (!(ret & BDRV_BLOCK_DATA)) { if (bdrv_has_zero_init(bs)) { ret |= BDRV_BLOCK_ZERO; } else if (bs->backing_hd) { BlockDriverState *bs2 = bs->backing_hd; int64_t length2 = bdrv_getlength(bs2); if (length2 >= 0 && sector_num >= (length2 >> BDRV_SECTOR_BITS)) { ret |= BDRV_BLOCK_ZERO; } } } if (bs->file && (ret & BDRV_BLOCK_DATA) && !(ret & BDRV_BLOCK_ZERO) && (ret & BDRV_BLOCK_OFFSET_VALID)) { ret2 = bdrv_co_get_block_status(bs->file, ret >> BDRV_SECTOR_BITS, *pnum, pnum); if (ret2 >= 0) { /* Ignore errors. This is just providing extra information, it * is useful but not necessary. */ ret |= (ret2 & BDRV_BLOCK_ZERO); } } return ret; }
false
qemu
c3d8688470a33feb0ea78c006b4399d50c13185e
static int64_t coroutine_fn bdrv_co_get_block_status(BlockDriverState *bs, int64_t sector_num, int nb_sectors, int *pnum) { int64_t length; int64_t n; int64_t ret, ret2; length = bdrv_getlength(bs); if (length < 0) { return length; } if (sector_num >= (length >> BDRV_SECTOR_BITS)) { *pnum = 0; return 0; } n = bs->total_sectors - sector_num; if (n < nb_sectors) { nb_sectors = n; } if (!bs->drv->bdrv_co_get_block_status) { *pnum = nb_sectors; ret = BDRV_BLOCK_DATA; if (bs->drv->protocol_name) { ret |= BDRV_BLOCK_OFFSET_VALID | (sector_num * BDRV_SECTOR_SIZE); } return ret; } ret = bs->drv->bdrv_co_get_block_status(bs, sector_num, nb_sectors, pnum); if (ret < 0) { *pnum = 0; return ret; } if (ret & BDRV_BLOCK_RAW) { assert(ret & BDRV_BLOCK_OFFSET_VALID); return bdrv_get_block_status(bs->file, ret >> BDRV_SECTOR_BITS, *pnum, pnum); } if (!(ret & BDRV_BLOCK_DATA)) { if (bdrv_has_zero_init(bs)) { ret |= BDRV_BLOCK_ZERO; } else if (bs->backing_hd) { BlockDriverState *bs2 = bs->backing_hd; int64_t length2 = bdrv_getlength(bs2); if (length2 >= 0 && sector_num >= (length2 >> BDRV_SECTOR_BITS)) { ret |= BDRV_BLOCK_ZERO; } } } if (bs->file && (ret & BDRV_BLOCK_DATA) && !(ret & BDRV_BLOCK_ZERO) && (ret & BDRV_BLOCK_OFFSET_VALID)) { ret2 = bdrv_co_get_block_status(bs->file, ret >> BDRV_SECTOR_BITS, *pnum, pnum); if (ret2 >= 0) { ret |= (ret2 & BDRV_BLOCK_ZERO); } } return ret; }
{ "code": [], "line_no": [] }
static int64_t VAR_0 bdrv_co_get_block_status(BlockDriverState *bs, int64_t sector_num, int nb_sectors, int *pnum) { int64_t length; int64_t n; int64_t ret, ret2; length = bdrv_getlength(bs); if (length < 0) { return length; } if (sector_num >= (length >> BDRV_SECTOR_BITS)) { *pnum = 0; return 0; } n = bs->total_sectors - sector_num; if (n < nb_sectors) { nb_sectors = n; } if (!bs->drv->bdrv_co_get_block_status) { *pnum = nb_sectors; ret = BDRV_BLOCK_DATA; if (bs->drv->protocol_name) { ret |= BDRV_BLOCK_OFFSET_VALID | (sector_num * BDRV_SECTOR_SIZE); } return ret; } ret = bs->drv->bdrv_co_get_block_status(bs, sector_num, nb_sectors, pnum); if (ret < 0) { *pnum = 0; return ret; } if (ret & BDRV_BLOCK_RAW) { assert(ret & BDRV_BLOCK_OFFSET_VALID); return bdrv_get_block_status(bs->file, ret >> BDRV_SECTOR_BITS, *pnum, pnum); } if (!(ret & BDRV_BLOCK_DATA)) { if (bdrv_has_zero_init(bs)) { ret |= BDRV_BLOCK_ZERO; } else if (bs->backing_hd) { BlockDriverState *bs2 = bs->backing_hd; int64_t length2 = bdrv_getlength(bs2); if (length2 >= 0 && sector_num >= (length2 >> BDRV_SECTOR_BITS)) { ret |= BDRV_BLOCK_ZERO; } } } if (bs->file && (ret & BDRV_BLOCK_DATA) && !(ret & BDRV_BLOCK_ZERO) && (ret & BDRV_BLOCK_OFFSET_VALID)) { ret2 = bdrv_co_get_block_status(bs->file, ret >> BDRV_SECTOR_BITS, *pnum, pnum); if (ret2 >= 0) { ret |= (ret2 & BDRV_BLOCK_ZERO); } } return ret; }
[ "static int64_t VAR_0 bdrv_co_get_block_status(BlockDriverState *bs,\nint64_t sector_num,\nint nb_sectors, int *pnum)\n{", "int64_t length;", "int64_t n;", "int64_t ret, ret2;", "length = bdrv_getlength(bs);", "if (length < 0) {", "return length;", "}", "if (sector_num >= (length >> BDRV_SECTOR_BITS)) {", "*pnum = 0;", "return 0;", "}", "n = bs->total_sectors - sector_num;", "if (n < nb_sectors) {", "nb_sectors = n;", "}", "if (!bs->drv->bdrv_co_get_block_status) {", "*pnum = nb_sectors;", "ret = BDRV_BLOCK_DATA;", "if (bs->drv->protocol_name) {", "ret |= BDRV_BLOCK_OFFSET_VALID | (sector_num * BDRV_SECTOR_SIZE);", "}", "return ret;", "}", "ret = bs->drv->bdrv_co_get_block_status(bs, sector_num, nb_sectors, pnum);", "if (ret < 0) {", "*pnum = 0;", "return ret;", "}", "if (ret & BDRV_BLOCK_RAW) {", "assert(ret & BDRV_BLOCK_OFFSET_VALID);", "return bdrv_get_block_status(bs->file, ret >> BDRV_SECTOR_BITS,\n*pnum, pnum);", "}", "if (!(ret & BDRV_BLOCK_DATA)) {", "if (bdrv_has_zero_init(bs)) {", "ret |= BDRV_BLOCK_ZERO;", "} else if (bs->backing_hd) {", "BlockDriverState *bs2 = bs->backing_hd;", "int64_t length2 = bdrv_getlength(bs2);", "if (length2 >= 0 && sector_num >= (length2 >> BDRV_SECTOR_BITS)) {", "ret |= BDRV_BLOCK_ZERO;", "}", "}", "}", "if (bs->file &&\n(ret & BDRV_BLOCK_DATA) && !(ret & BDRV_BLOCK_ZERO) &&\n(ret & BDRV_BLOCK_OFFSET_VALID)) {", "ret2 = bdrv_co_get_block_status(bs->file, ret >> BDRV_SECTOR_BITS,\n*pnum, pnum);", "if (ret2 >= 0) {", "ret |= (ret2 & BDRV_BLOCK_ZERO);", "}", "}", "return ret;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 79 ], [ 81, 83 ], [ 85 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 113, 115, 117 ], [ 119, 121 ], [ 123 ], [ 131 ], [ 133 ], [ 135 ], [ 139 ], [ 141 ] ]
12,646
void *qemu_try_blockalign(BlockDriverState *bs, size_t size) { size_t align = bdrv_opt_mem_align(bs); /* Ensure that NULL is never returned on success */ assert(align > 0); if (size == 0) { size = align; } return qemu_try_memalign(align, size); }
false
qemu
61007b316cd71ee7333ff7a0a749a8949527575f
void *qemu_try_blockalign(BlockDriverState *bs, size_t size) { size_t align = bdrv_opt_mem_align(bs); assert(align > 0); if (size == 0) { size = align; } return qemu_try_memalign(align, size); }
{ "code": [], "line_no": [] }
void *FUNC_0(BlockDriverState *VAR_0, size_t VAR_1) { size_t align = bdrv_opt_mem_align(VAR_0); assert(align > 0); if (VAR_1 == 0) { VAR_1 = align; } return qemu_try_memalign(align, VAR_1); }
[ "void *FUNC_0(BlockDriverState *VAR_0, size_t VAR_1)\n{", "size_t align = bdrv_opt_mem_align(VAR_0);", "assert(align > 0);", "if (VAR_1 == 0) {", "VAR_1 = align;", "}", "return qemu_try_memalign(align, VAR_1);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ] ]
12,647
float32 helper_fxtos(CPUSPARCState *env, int64_t src) { float32 ret; clear_float_exceptions(env); ret = int64_to_float32(src, &env->fp_status); check_ieee_exceptions(env); return ret; }
false
qemu
7385aed20db5d83979f683b9d0048674411e963c
float32 helper_fxtos(CPUSPARCState *env, int64_t src) { float32 ret; clear_float_exceptions(env); ret = int64_to_float32(src, &env->fp_status); check_ieee_exceptions(env); return ret; }
{ "code": [], "line_no": [] }
float32 FUNC_0(CPUSPARCState *env, int64_t src) { float32 ret; clear_float_exceptions(env); ret = int64_to_float32(src, &env->fp_status); check_ieee_exceptions(env); return ret; }
[ "float32 FUNC_0(CPUSPARCState *env, int64_t src)\n{", "float32 ret;", "clear_float_exceptions(env);", "ret = int64_to_float32(src, &env->fp_status);", "check_ieee_exceptions(env);", "return ret;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ] ]
12,649
VirtIOSCSIReq *virtio_scsi_pop_req_vring(VirtIOSCSI *s, VirtIOSCSIVring *vring) { VirtIOSCSIReq *req = virtio_scsi_init_req(s, NULL); int r; req->vring = vring; r = vring_pop((VirtIODevice *)s, &vring->vring, &req->elem); if (r < 0) { virtio_scsi_free_req(req); req = NULL; } return req; }
false
qemu
51b19ebe4320f3dcd93cea71235c1219318ddfd2
VirtIOSCSIReq *virtio_scsi_pop_req_vring(VirtIOSCSI *s, VirtIOSCSIVring *vring) { VirtIOSCSIReq *req = virtio_scsi_init_req(s, NULL); int r; req->vring = vring; r = vring_pop((VirtIODevice *)s, &vring->vring, &req->elem); if (r < 0) { virtio_scsi_free_req(req); req = NULL; } return req; }
{ "code": [], "line_no": [] }
VirtIOSCSIReq *FUNC_0(VirtIOSCSI *s, VirtIOSCSIVring *vring) { VirtIOSCSIReq *req = virtio_scsi_init_req(s, NULL); int VAR_0; req->vring = vring; VAR_0 = vring_pop((VirtIODevice *)s, &vring->vring, &req->elem); if (VAR_0 < 0) { virtio_scsi_free_req(req); req = NULL; } return req; }
[ "VirtIOSCSIReq *FUNC_0(VirtIOSCSI *s,\nVirtIOSCSIVring *vring)\n{", "VirtIOSCSIReq *req = virtio_scsi_init_req(s, NULL);", "int VAR_0;", "req->vring = vring;", "VAR_0 = vring_pop((VirtIODevice *)s, &vring->vring, &req->elem);", "if (VAR_0 < 0) {", "virtio_scsi_free_req(req);", "req = NULL;", "}", "return req;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ] ]
12,650
uint64_t helper_fctiwz (uint64_t arg) { CPU_DoubleU farg; farg.ll = arg; if (unlikely(float64_is_signaling_nan(farg.d))) { /* sNaN conversion */ farg.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXSNAN | POWERPC_EXCP_FP_VXCVI); } else if (unlikely(float64_is_nan(farg.d) || float64_is_infinity(farg.d))) { /* qNan / infinity conversion */ farg.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXCVI); } else { farg.ll = float64_to_int32_round_to_zero(farg.d, &env->fp_status); #if USE_PRECISE_EMULATION /* XXX: higher bits are not supposed to be significant. * to make tests easier, return the same as a real PowerPC 750 */ farg.ll |= 0xFFF80000ULL << 32; #endif } return farg.ll; }
false
qemu
185698715dfb18c82ad2a5dbc169908602d43e81
uint64_t helper_fctiwz (uint64_t arg) { CPU_DoubleU farg; farg.ll = arg; if (unlikely(float64_is_signaling_nan(farg.d))) { farg.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXSNAN | POWERPC_EXCP_FP_VXCVI); } else if (unlikely(float64_is_nan(farg.d) || float64_is_infinity(farg.d))) { farg.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXCVI); } else { farg.ll = float64_to_int32_round_to_zero(farg.d, &env->fp_status); #if USE_PRECISE_EMULATION farg.ll |= 0xFFF80000ULL << 32; #endif } return farg.ll; }
{ "code": [], "line_no": [] }
uint64_t FUNC_0 (uint64_t arg) { CPU_DoubleU farg; farg.ll = arg; if (unlikely(float64_is_signaling_nan(farg.d))) { farg.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXSNAN | POWERPC_EXCP_FP_VXCVI); } else if (unlikely(float64_is_nan(farg.d) || float64_is_infinity(farg.d))) { farg.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXCVI); } else { farg.ll = float64_to_int32_round_to_zero(farg.d, &env->fp_status); #if USE_PRECISE_EMULATION farg.ll |= 0xFFF80000ULL << 32; #endif } return farg.ll; }
[ "uint64_t FUNC_0 (uint64_t arg)\n{", "CPU_DoubleU farg;", "farg.ll = arg;", "if (unlikely(float64_is_signaling_nan(farg.d))) {", "farg.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXSNAN | POWERPC_EXCP_FP_VXCVI);", "} else if (unlikely(float64_is_nan(farg.d) || float64_is_infinity(farg.d))) {", "farg.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXCVI);", "} else {", "farg.ll = float64_to_int32_round_to_zero(farg.d, &env->fp_status);", "#if USE_PRECISE_EMULATION\nfarg.ll |= 0xFFF80000ULL << 32;", "#endif\n}", "return farg.ll;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27, 35 ], [ 37, 39 ], [ 41 ], [ 43 ] ]
12,652
void list_cpus(FILE *f, int (*cpu_fprintf)(FILE *f, const char *fmt, ...), const char *optarg) { /* XXX: implement xxx_cpu_list for targets that still miss it */ #if defined(cpu_list_id) cpu_list_id(f, cpu_fprintf, optarg); #elif defined(cpu_list) cpu_list(f, cpu_fprintf); /* deprecated */ #endif }
false
qemu
9a78eead0c74333a394c0f7bbfc4423ac746fcd5
void list_cpus(FILE *f, int (*cpu_fprintf)(FILE *f, const char *fmt, ...), const char *optarg) { #if defined(cpu_list_id) cpu_list_id(f, cpu_fprintf, optarg); #elif defined(cpu_list) cpu_list(f, cpu_fprintf); #endif }
{ "code": [], "line_no": [] }
void FUNC_0(FILE *VAR_2, int (*VAR_1)(FILE *VAR_2, const char *VAR_2, ...), const char *VAR_3) { #if defined(cpu_list_id) cpu_list_id(VAR_2, VAR_1, VAR_3); #elif defined(cpu_list) cpu_list(VAR_2, VAR_1); #endif }
[ "void FUNC_0(FILE *VAR_2, int (*VAR_1)(FILE *VAR_2, const char *VAR_2, ...),\nconst char *VAR_3)\n{", "#if defined(cpu_list_id)\ncpu_list_id(VAR_2, VAR_1, VAR_3);", "#elif defined(cpu_list)\ncpu_list(VAR_2, VAR_1);", "#endif\n}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 9, 11 ], [ 13, 15 ], [ 17, 19 ] ]
12,653
static void qmp_deserialize(void **native_out, void *datap, VisitorFunc visit, Error **errp) { QmpSerializeData *d = datap; QString *output_json; QObject *obj_orig, *obj; obj_orig = qmp_output_get_qobject(d->qov); output_json = qobject_to_json(obj_orig); obj = qobject_from_json(qstring_get_str(output_json)); QDECREF(output_json); d->qiv = qmp_input_visitor_new(obj, true); qobject_decref(obj_orig); qobject_decref(obj); visit(d->qiv, native_out, errp); }
false
qemu
3b098d56979d2f7fd707c5be85555d114353a28d
static void qmp_deserialize(void **native_out, void *datap, VisitorFunc visit, Error **errp) { QmpSerializeData *d = datap; QString *output_json; QObject *obj_orig, *obj; obj_orig = qmp_output_get_qobject(d->qov); output_json = qobject_to_json(obj_orig); obj = qobject_from_json(qstring_get_str(output_json)); QDECREF(output_json); d->qiv = qmp_input_visitor_new(obj, true); qobject_decref(obj_orig); qobject_decref(obj); visit(d->qiv, native_out, errp); }
{ "code": [], "line_no": [] }
static void FUNC_0(void **VAR_0, void *VAR_1, VisitorFunc VAR_2, Error **VAR_3) { QmpSerializeData *d = VAR_1; QString *output_json; QObject *obj_orig, *obj; obj_orig = qmp_output_get_qobject(d->qov); output_json = qobject_to_json(obj_orig); obj = qobject_from_json(qstring_get_str(output_json)); QDECREF(output_json); d->qiv = qmp_input_visitor_new(obj, true); qobject_decref(obj_orig); qobject_decref(obj); VAR_2(d->qiv, VAR_0, VAR_3); }
[ "static void FUNC_0(void **VAR_0, void *VAR_1,\nVisitorFunc VAR_2, Error **VAR_3)\n{", "QmpSerializeData *d = VAR_1;", "QString *output_json;", "QObject *obj_orig, *obj;", "obj_orig = qmp_output_get_qobject(d->qov);", "output_json = qobject_to_json(obj_orig);", "obj = qobject_from_json(qstring_get_str(output_json));", "QDECREF(output_json);", "d->qiv = qmp_input_visitor_new(obj, true);", "qobject_decref(obj_orig);", "qobject_decref(obj);", "VAR_2(d->qiv, VAR_0, VAR_3);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ] ]
12,654
static void scsi_read_complete(void * opaque, int ret) { SCSIGenericReq *r = (SCSIGenericReq *)opaque; SCSIDevice *s = r->req.dev; int len; r->req.aiocb = NULL; if (ret || r->req.io_canceled) { scsi_command_complete(r, ret); return; } len = r->io_header.dxfer_len - r->io_header.resid; DPRINTF("Data ready tag=0x%x len=%d\n", r->req.tag, len); r->len = -1; if (len == 0) { scsi_command_complete(r, 0); } else { /* Snoop READ CAPACITY output to set the blocksize. */ if (r->req.cmd.buf[0] == READ_CAPACITY_10 && (ldl_be_p(&r->buf[0]) != 0xffffffffU || s->max_lba == 0)) { s->blocksize = ldl_be_p(&r->buf[4]); s->max_lba = ldl_be_p(&r->buf[0]) & 0xffffffffULL; } else if (r->req.cmd.buf[0] == SERVICE_ACTION_IN_16 && (r->req.cmd.buf[1] & 31) == SAI_READ_CAPACITY_16) { s->blocksize = ldl_be_p(&r->buf[8]); s->max_lba = ldq_be_p(&r->buf[0]); } bdrv_set_guest_block_size(s->conf.bs, s->blocksize); scsi_req_data(&r->req, len); scsi_req_unref(&r->req); } }
false
qemu
4be746345f13e99e468c60acbd3a355e8183e3ce
static void scsi_read_complete(void * opaque, int ret) { SCSIGenericReq *r = (SCSIGenericReq *)opaque; SCSIDevice *s = r->req.dev; int len; r->req.aiocb = NULL; if (ret || r->req.io_canceled) { scsi_command_complete(r, ret); return; } len = r->io_header.dxfer_len - r->io_header.resid; DPRINTF("Data ready tag=0x%x len=%d\n", r->req.tag, len); r->len = -1; if (len == 0) { scsi_command_complete(r, 0); } else { if (r->req.cmd.buf[0] == READ_CAPACITY_10 && (ldl_be_p(&r->buf[0]) != 0xffffffffU || s->max_lba == 0)) { s->blocksize = ldl_be_p(&r->buf[4]); s->max_lba = ldl_be_p(&r->buf[0]) & 0xffffffffULL; } else if (r->req.cmd.buf[0] == SERVICE_ACTION_IN_16 && (r->req.cmd.buf[1] & 31) == SAI_READ_CAPACITY_16) { s->blocksize = ldl_be_p(&r->buf[8]); s->max_lba = ldq_be_p(&r->buf[0]); } bdrv_set_guest_block_size(s->conf.bs, s->blocksize); scsi_req_data(&r->req, len); scsi_req_unref(&r->req); } }
{ "code": [], "line_no": [] }
static void FUNC_0(void * VAR_0, int VAR_1) { SCSIGenericReq *r = (SCSIGenericReq *)VAR_0; SCSIDevice *s = r->req.dev; int VAR_2; r->req.aiocb = NULL; if (VAR_1 || r->req.io_canceled) { scsi_command_complete(r, VAR_1); return; } VAR_2 = r->io_header.dxfer_len - r->io_header.resid; DPRINTF("Data ready tag=0x%x VAR_2=%d\n", r->req.tag, VAR_2); r->VAR_2 = -1; if (VAR_2 == 0) { scsi_command_complete(r, 0); } else { if (r->req.cmd.buf[0] == READ_CAPACITY_10 && (ldl_be_p(&r->buf[0]) != 0xffffffffU || s->max_lba == 0)) { s->blocksize = ldl_be_p(&r->buf[4]); s->max_lba = ldl_be_p(&r->buf[0]) & 0xffffffffULL; } else if (r->req.cmd.buf[0] == SERVICE_ACTION_IN_16 && (r->req.cmd.buf[1] & 31) == SAI_READ_CAPACITY_16) { s->blocksize = ldl_be_p(&r->buf[8]); s->max_lba = ldq_be_p(&r->buf[0]); } bdrv_set_guest_block_size(s->conf.bs, s->blocksize); scsi_req_data(&r->req, VAR_2); scsi_req_unref(&r->req); } }
[ "static void FUNC_0(void * VAR_0, int VAR_1)\n{", "SCSIGenericReq *r = (SCSIGenericReq *)VAR_0;", "SCSIDevice *s = r->req.dev;", "int VAR_2;", "r->req.aiocb = NULL;", "if (VAR_1 || r->req.io_canceled) {", "scsi_command_complete(r, VAR_1);", "return;", "}", "VAR_2 = r->io_header.dxfer_len - r->io_header.resid;", "DPRINTF(\"Data ready tag=0x%x VAR_2=%d\\n\", r->req.tag, VAR_2);", "r->VAR_2 = -1;", "if (VAR_2 == 0) {", "scsi_command_complete(r, 0);", "} else {", "if (r->req.cmd.buf[0] == READ_CAPACITY_10 &&\n(ldl_be_p(&r->buf[0]) != 0xffffffffU || s->max_lba == 0)) {", "s->blocksize = ldl_be_p(&r->buf[4]);", "s->max_lba = ldl_be_p(&r->buf[0]) & 0xffffffffULL;", "} else if (r->req.cmd.buf[0] == SERVICE_ACTION_IN_16 &&", "(r->req.cmd.buf[1] & 31) == SAI_READ_CAPACITY_16) {", "s->blocksize = ldl_be_p(&r->buf[8]);", "s->max_lba = ldq_be_p(&r->buf[0]);", "}", "bdrv_set_guest_block_size(s->conf.bs, s->blocksize);", "scsi_req_data(&r->req, VAR_2);", "scsi_req_unref(&r->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, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ] ]
12,655
static void filter_mb( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr) { MpegEncContext * const s = &h->s; const int mb_xy= mb_x + mb_y*s->mb_stride; int linesize, uvlinesize; int dir; /* FIXME Implement deblocking filter for field MB */ if( h->sps.mb_aff ) { return; } linesize = s->linesize; uvlinesize = s->uvlinesize; /* dir : 0 -> vertical edge, 1 -> horizontal edge */ for( dir = 0; dir < 2; dir++ ) { int edge; const int mbm_xy = dir == 0 ? mb_xy -1 : mb_xy - s->mb_stride; int start = h->slice_table[mbm_xy] == 255 ? 1 : 0; if (h->deblocking_filter==2 && h->slice_table[mbm_xy] != h->slice_table[mb_xy]) start = 1; /* Calculate bS */ for( edge = start; edge < 4; edge++ ) { /* mbn_xy: neighbour macroblock (how that works for field ?) */ int mbn_xy = edge > 0 ? mb_xy : mbm_xy; int bS[4]; int qp; if( IS_INTRA( s->current_picture.mb_type[mb_xy] ) || IS_INTRA( s->current_picture.mb_type[mbn_xy] ) ) { bS[0] = bS[1] = bS[2] = bS[3] = ( edge == 0 ? 4 : 3 ); } else { int i; for( i = 0; i < 4; i++ ) { int x = dir == 0 ? edge : i; int y = dir == 0 ? i : edge; int b_idx= 8 + 4 + x + 8*y; int bn_idx= b_idx - (dir ? 8:1); if( h->non_zero_count_cache[b_idx] != 0 || h->non_zero_count_cache[bn_idx] != 0 ) { bS[i] = 2; } else if( h->slice_type == P_TYPE ) { if( h->ref_cache[0][b_idx] != h->ref_cache[0][bn_idx] || ABS( h->mv_cache[0][b_idx][0] - h->mv_cache[0][bn_idx][0] ) >= 4 || ABS( h->mv_cache[0][b_idx][1] - h->mv_cache[0][bn_idx][1] ) >= 4 ) bS[i] = 1; else bS[i] = 0; } else { /* FIXME Add support for B frame */ return; } } if(bS[0]+bS[1]+bS[2]+bS[3] == 0) continue; } /* Filter edge */ // Do not use s->qscale as luma quantiser because it has not the same // value in IPCM macroblocks. qp = ( s->current_picture.qscale_table[mb_xy] + s->current_picture.qscale_table[mbn_xy] + 1 ) >> 1; //tprintf("filter mb:%d/%d dir:%d edge:%d, QPy:%d, QPc:%d, QPcn:%d\n", mb_x, mb_y, dir, edge, qp, h->chroma_qp, s->current_picture.qscale_table[mbn_xy]); if( dir == 0 ) { filter_mb_edgev( h, &img_y[4*edge], linesize, bS, qp ); if( (edge&1) == 0 ) { int chroma_qp = ( h->chroma_qp + get_chroma_qp( h, s->current_picture.qscale_table[mbn_xy] ) + 1 ) >> 1; filter_mb_edgecv( h, &img_cb[2*edge], uvlinesize, bS, chroma_qp ); filter_mb_edgecv( h, &img_cr[2*edge], uvlinesize, bS, chroma_qp ); } } else { filter_mb_edgeh( h, &img_y[4*edge*linesize], linesize, bS, qp ); if( (edge&1) == 0 ) { int chroma_qp = ( h->chroma_qp + get_chroma_qp( h, s->current_picture.qscale_table[mbn_xy] ) + 1 ) >> 1; filter_mb_edgech( h, &img_cb[2*edge*uvlinesize], uvlinesize, bS, chroma_qp ); filter_mb_edgech( h, &img_cr[2*edge*uvlinesize], uvlinesize, bS, chroma_qp ); } } } } }
false
FFmpeg
19fe8b4100dfe0323e351e474c54293bb4ae576e
static void filter_mb( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr) { MpegEncContext * const s = &h->s; const int mb_xy= mb_x + mb_y*s->mb_stride; int linesize, uvlinesize; int dir; if( h->sps.mb_aff ) { return; } linesize = s->linesize; uvlinesize = s->uvlinesize; for( dir = 0; dir < 2; dir++ ) { int edge; const int mbm_xy = dir == 0 ? mb_xy -1 : mb_xy - s->mb_stride; int start = h->slice_table[mbm_xy] == 255 ? 1 : 0; if (h->deblocking_filter==2 && h->slice_table[mbm_xy] != h->slice_table[mb_xy]) start = 1; for( edge = start; edge < 4; edge++ ) { int mbn_xy = edge > 0 ? mb_xy : mbm_xy; int bS[4]; int qp; if( IS_INTRA( s->current_picture.mb_type[mb_xy] ) || IS_INTRA( s->current_picture.mb_type[mbn_xy] ) ) { bS[0] = bS[1] = bS[2] = bS[3] = ( edge == 0 ? 4 : 3 ); } else { int i; for( i = 0; i < 4; i++ ) { int x = dir == 0 ? edge : i; int y = dir == 0 ? i : edge; int b_idx= 8 + 4 + x + 8*y; int bn_idx= b_idx - (dir ? 8:1); if( h->non_zero_count_cache[b_idx] != 0 || h->non_zero_count_cache[bn_idx] != 0 ) { bS[i] = 2; } else if( h->slice_type == P_TYPE ) { if( h->ref_cache[0][b_idx] != h->ref_cache[0][bn_idx] || ABS( h->mv_cache[0][b_idx][0] - h->mv_cache[0][bn_idx][0] ) >= 4 || ABS( h->mv_cache[0][b_idx][1] - h->mv_cache[0][bn_idx][1] ) >= 4 ) bS[i] = 1; else bS[i] = 0; } else { return; } } if(bS[0]+bS[1]+bS[2]+bS[3] == 0) continue; } qp = ( s->current_picture.qscale_table[mb_xy] + s->current_picture.qscale_table[mbn_xy] + 1 ) >> 1; if( dir == 0 ) { filter_mb_edgev( h, &img_y[4*edge], linesize, bS, qp ); if( (edge&1) == 0 ) { int chroma_qp = ( h->chroma_qp + get_chroma_qp( h, s->current_picture.qscale_table[mbn_xy] ) + 1 ) >> 1; filter_mb_edgecv( h, &img_cb[2*edge], uvlinesize, bS, chroma_qp ); filter_mb_edgecv( h, &img_cr[2*edge], uvlinesize, bS, chroma_qp ); } } else { filter_mb_edgeh( h, &img_y[4*edge*linesize], linesize, bS, qp ); if( (edge&1) == 0 ) { int chroma_qp = ( h->chroma_qp + get_chroma_qp( h, s->current_picture.qscale_table[mbn_xy] ) + 1 ) >> 1; filter_mb_edgech( h, &img_cb[2*edge*uvlinesize], uvlinesize, bS, chroma_qp ); filter_mb_edgech( h, &img_cr[2*edge*uvlinesize], uvlinesize, bS, chroma_qp ); } } } } }
{ "code": [], "line_no": [] }
static void FUNC_0( H264Context *VAR_0, int VAR_1, int VAR_2, uint8_t *VAR_3, uint8_t *VAR_4, uint8_t *VAR_5) { MpegEncContext * const s = &VAR_0->s; const int VAR_6= VAR_1 + VAR_2*s->mb_stride; int VAR_7, VAR_8; int VAR_9; if( VAR_0->sps.mb_aff ) { return; } VAR_7 = s->VAR_7; VAR_8 = s->VAR_8; for( VAR_9 = 0; VAR_9 < 2; VAR_9++ ) { int VAR_10; const int VAR_11 = VAR_9 == 0 ? VAR_6 -1 : VAR_6 - s->mb_stride; int VAR_12 = VAR_0->slice_table[VAR_11] == 255 ? 1 : 0; if (VAR_0->deblocking_filter==2 && VAR_0->slice_table[VAR_11] != VAR_0->slice_table[VAR_6]) VAR_12 = 1; for( VAR_10 = VAR_12; VAR_10 < 4; VAR_10++ ) { int VAR_13 = VAR_10 > 0 ? VAR_6 : VAR_11; int VAR_14[4]; int VAR_15; if( IS_INTRA( s->current_picture.mb_type[VAR_6] ) || IS_INTRA( s->current_picture.mb_type[VAR_13] ) ) { VAR_14[0] = VAR_14[1] = VAR_14[2] = VAR_14[3] = ( VAR_10 == 0 ? 4 : 3 ); } else { int VAR_16; for( VAR_16 = 0; VAR_16 < 4; VAR_16++ ) { int VAR_17 = VAR_9 == 0 ? VAR_10 : VAR_16; int VAR_18 = VAR_9 == 0 ? VAR_16 : VAR_10; int VAR_19= 8 + 4 + VAR_17 + 8*VAR_18; int VAR_20= VAR_19 - (VAR_9 ? 8:1); if( VAR_0->non_zero_count_cache[VAR_19] != 0 || VAR_0->non_zero_count_cache[VAR_20] != 0 ) { VAR_14[VAR_16] = 2; } else if( VAR_0->slice_type == P_TYPE ) { if( VAR_0->ref_cache[0][VAR_19] != VAR_0->ref_cache[0][VAR_20] || ABS( VAR_0->mv_cache[0][VAR_19][0] - VAR_0->mv_cache[0][VAR_20][0] ) >= 4 || ABS( VAR_0->mv_cache[0][VAR_19][1] - VAR_0->mv_cache[0][VAR_20][1] ) >= 4 ) VAR_14[VAR_16] = 1; else VAR_14[VAR_16] = 0; } else { return; } } if(VAR_14[0]+VAR_14[1]+VAR_14[2]+VAR_14[3] == 0) continue; } VAR_15 = ( s->current_picture.qscale_table[VAR_6] + s->current_picture.qscale_table[VAR_13] + 1 ) >> 1; if( VAR_9 == 0 ) { filter_mb_edgev( VAR_0, &VAR_3[4*VAR_10], VAR_7, VAR_14, VAR_15 ); if( (VAR_10&1) == 0 ) { int VAR_22 = ( VAR_0->VAR_22 + get_chroma_qp( VAR_0, s->current_picture.qscale_table[VAR_13] ) + 1 ) >> 1; filter_mb_edgecv( VAR_0, &VAR_4[2*VAR_10], VAR_8, VAR_14, VAR_22 ); filter_mb_edgecv( VAR_0, &VAR_5[2*VAR_10], VAR_8, VAR_14, VAR_22 ); } } else { filter_mb_edgeh( VAR_0, &VAR_3[4*VAR_10*VAR_7], VAR_7, VAR_14, VAR_15 ); if( (VAR_10&1) == 0 ) { int VAR_22 = ( VAR_0->VAR_22 + get_chroma_qp( VAR_0, s->current_picture.qscale_table[VAR_13] ) + 1 ) >> 1; filter_mb_edgech( VAR_0, &VAR_4[2*VAR_10*VAR_8], VAR_8, VAR_14, VAR_22 ); filter_mb_edgech( VAR_0, &VAR_5[2*VAR_10*VAR_8], VAR_8, VAR_14, VAR_22 ); } } } } }
[ "static void FUNC_0( H264Context *VAR_0, int VAR_1, int VAR_2, uint8_t *VAR_3, uint8_t *VAR_4, uint8_t *VAR_5) {", "MpegEncContext * const s = &VAR_0->s;", "const int VAR_6= VAR_1 + VAR_2*s->mb_stride;", "int VAR_7, VAR_8;", "int VAR_9;", "if( VAR_0->sps.mb_aff ) {", "return;", "}", "VAR_7 = s->VAR_7;", "VAR_8 = s->VAR_8;", "for( VAR_9 = 0; VAR_9 < 2; VAR_9++ )", "{", "int VAR_10;", "const int VAR_11 = VAR_9 == 0 ? VAR_6 -1 : VAR_6 - s->mb_stride;", "int VAR_12 = VAR_0->slice_table[VAR_11] == 255 ? 1 : 0;", "if (VAR_0->deblocking_filter==2 && VAR_0->slice_table[VAR_11] != VAR_0->slice_table[VAR_6])\nVAR_12 = 1;", "for( VAR_10 = VAR_12; VAR_10 < 4; VAR_10++ ) {", "int VAR_13 = VAR_10 > 0 ? VAR_6 : VAR_11;", "int VAR_14[4];", "int VAR_15;", "if( IS_INTRA( s->current_picture.mb_type[VAR_6] ) ||\nIS_INTRA( s->current_picture.mb_type[VAR_13] ) ) {", "VAR_14[0] = VAR_14[1] = VAR_14[2] = VAR_14[3] = ( VAR_10 == 0 ? 4 : 3 );", "} else {", "int VAR_16;", "for( VAR_16 = 0; VAR_16 < 4; VAR_16++ ) {", "int VAR_17 = VAR_9 == 0 ? VAR_10 : VAR_16;", "int VAR_18 = VAR_9 == 0 ? VAR_16 : VAR_10;", "int VAR_19= 8 + 4 + VAR_17 + 8*VAR_18;", "int VAR_20= VAR_19 - (VAR_9 ? 8:1);", "if( VAR_0->non_zero_count_cache[VAR_19] != 0 ||\nVAR_0->non_zero_count_cache[VAR_20] != 0 ) {", "VAR_14[VAR_16] = 2;", "}", "else if( VAR_0->slice_type == P_TYPE ) {", "if( VAR_0->ref_cache[0][VAR_19] != VAR_0->ref_cache[0][VAR_20] ||\nABS( VAR_0->mv_cache[0][VAR_19][0] - VAR_0->mv_cache[0][VAR_20][0] ) >= 4 ||\nABS( VAR_0->mv_cache[0][VAR_19][1] - VAR_0->mv_cache[0][VAR_20][1] ) >= 4 )\nVAR_14[VAR_16] = 1;", "else\nVAR_14[VAR_16] = 0;", "} else {", "return;", "}", "}", "if(VAR_14[0]+VAR_14[1]+VAR_14[2]+VAR_14[3] == 0)\ncontinue;", "}", "VAR_15 = ( s->current_picture.qscale_table[VAR_6] + s->current_picture.qscale_table[VAR_13] + 1 ) >> 1;", "if( VAR_9 == 0 ) {", "filter_mb_edgev( VAR_0, &VAR_3[4*VAR_10], VAR_7, VAR_14, VAR_15 );", "if( (VAR_10&1) == 0 ) {", "int VAR_22 = ( VAR_0->VAR_22 +\nget_chroma_qp( VAR_0, s->current_picture.qscale_table[VAR_13] ) + 1 ) >> 1;", "filter_mb_edgecv( VAR_0, &VAR_4[2*VAR_10], VAR_8, VAR_14, VAR_22 );", "filter_mb_edgecv( VAR_0, &VAR_5[2*VAR_10], VAR_8, VAR_14, VAR_22 );", "}", "} else {", "filter_mb_edgeh( VAR_0, &VAR_3[4*VAR_10*VAR_7], VAR_7, VAR_14, VAR_15 );", "if( (VAR_10&1) == 0 ) {", "int VAR_22 = ( VAR_0->VAR_22 +\nget_chroma_qp( VAR_0, s->current_picture.qscale_table[VAR_13] ) + 1 ) >> 1;", "filter_mb_edgech( VAR_0, &VAR_4[2*VAR_10*VAR_8], VAR_8, VAR_14, VAR_22 );", "filter_mb_edgech( VAR_0, &VAR_5[2*VAR_10*VAR_8], VAR_8, VAR_14, VAR_22 );", "}", "}", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 9 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41, 43 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 61, 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 83, 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93, 95, 97, 99 ], [ 101, 103 ], [ 105 ], [ 109 ], [ 111 ], [ 113 ], [ 117, 119 ], [ 121 ], [ 131 ], [ 135 ], [ 137 ], [ 139 ], [ 141, 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157, 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ] ]
12,656
int ff_qsv_encode(AVCodecContext *avctx, QSVEncContext *q, AVPacket *pkt, const AVFrame *frame, int *got_packet) { int ret; ret = encode_frame(avctx, q, frame); if (ret < 0) return ret; if (!av_fifo_space(q->async_fifo) || (!frame && av_fifo_size(q->async_fifo))) { AVPacket new_pkt; mfxBitstream *bs; mfxSyncPoint sync; av_fifo_generic_read(q->async_fifo, &new_pkt, sizeof(new_pkt), NULL); av_fifo_generic_read(q->async_fifo, &sync, sizeof(sync), NULL); av_fifo_generic_read(q->async_fifo, &bs, sizeof(bs), NULL); do { ret = MFXVideoCORE_SyncOperation(q->session, sync, 1000); } while (ret == MFX_WRN_IN_EXECUTION); new_pkt.dts = av_rescale_q(bs->DecodeTimeStamp, (AVRational){1, 90000}, avctx->time_base); new_pkt.pts = av_rescale_q(bs->TimeStamp, (AVRational){1, 90000}, avctx->time_base); new_pkt.size = bs->DataLength; if (bs->FrameType & MFX_FRAMETYPE_IDR || bs->FrameType & MFX_FRAMETYPE_xIDR) new_pkt.flags |= AV_PKT_FLAG_KEY; #if FF_API_CODED_FRAME FF_DISABLE_DEPRECATION_WARNINGS if (bs->FrameType & MFX_FRAMETYPE_I || bs->FrameType & MFX_FRAMETYPE_xI) avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; else if (bs->FrameType & MFX_FRAMETYPE_P || bs->FrameType & MFX_FRAMETYPE_xP) avctx->coded_frame->pict_type = AV_PICTURE_TYPE_P; else if (bs->FrameType & MFX_FRAMETYPE_B || bs->FrameType & MFX_FRAMETYPE_xB) avctx->coded_frame->pict_type = AV_PICTURE_TYPE_B; FF_ENABLE_DEPRECATION_WARNINGS #endif av_freep(&bs); if (pkt->data) { if (pkt->size < new_pkt.size) { av_log(avctx, AV_LOG_ERROR, "Submitted buffer not large enough: %d < %d\n", pkt->size, new_pkt.size); av_packet_unref(&new_pkt); return AVERROR(EINVAL); } memcpy(pkt->data, new_pkt.data, new_pkt.size); pkt->size = new_pkt.size; ret = av_packet_copy_props(pkt, &new_pkt); av_packet_unref(&new_pkt); if (ret < 0) return ret; } else *pkt = new_pkt; *got_packet = 1; } return 0; }
false
FFmpeg
a1335149fd610b16459d9281b611282cac51c950
int ff_qsv_encode(AVCodecContext *avctx, QSVEncContext *q, AVPacket *pkt, const AVFrame *frame, int *got_packet) { int ret; ret = encode_frame(avctx, q, frame); if (ret < 0) return ret; if (!av_fifo_space(q->async_fifo) || (!frame && av_fifo_size(q->async_fifo))) { AVPacket new_pkt; mfxBitstream *bs; mfxSyncPoint sync; av_fifo_generic_read(q->async_fifo, &new_pkt, sizeof(new_pkt), NULL); av_fifo_generic_read(q->async_fifo, &sync, sizeof(sync), NULL); av_fifo_generic_read(q->async_fifo, &bs, sizeof(bs), NULL); do { ret = MFXVideoCORE_SyncOperation(q->session, sync, 1000); } while (ret == MFX_WRN_IN_EXECUTION); new_pkt.dts = av_rescale_q(bs->DecodeTimeStamp, (AVRational){1, 90000}, avctx->time_base); new_pkt.pts = av_rescale_q(bs->TimeStamp, (AVRational){1, 90000}, avctx->time_base); new_pkt.size = bs->DataLength; if (bs->FrameType & MFX_FRAMETYPE_IDR || bs->FrameType & MFX_FRAMETYPE_xIDR) new_pkt.flags |= AV_PKT_FLAG_KEY; #if FF_API_CODED_FRAME FF_DISABLE_DEPRECATION_WARNINGS if (bs->FrameType & MFX_FRAMETYPE_I || bs->FrameType & MFX_FRAMETYPE_xI) avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; else if (bs->FrameType & MFX_FRAMETYPE_P || bs->FrameType & MFX_FRAMETYPE_xP) avctx->coded_frame->pict_type = AV_PICTURE_TYPE_P; else if (bs->FrameType & MFX_FRAMETYPE_B || bs->FrameType & MFX_FRAMETYPE_xB) avctx->coded_frame->pict_type = AV_PICTURE_TYPE_B; FF_ENABLE_DEPRECATION_WARNINGS #endif av_freep(&bs); if (pkt->data) { if (pkt->size < new_pkt.size) { av_log(avctx, AV_LOG_ERROR, "Submitted buffer not large enough: %d < %d\n", pkt->size, new_pkt.size); av_packet_unref(&new_pkt); return AVERROR(EINVAL); } memcpy(pkt->data, new_pkt.data, new_pkt.size); pkt->size = new_pkt.size; ret = av_packet_copy_props(pkt, &new_pkt); av_packet_unref(&new_pkt); if (ret < 0) return ret; } else *pkt = new_pkt; *got_packet = 1; } return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(AVCodecContext *VAR_0, QSVEncContext *VAR_1, AVPacket *VAR_2, const AVFrame *VAR_3, int *VAR_4) { int VAR_5; VAR_5 = encode_frame(VAR_0, VAR_1, VAR_3); if (VAR_5 < 0) return VAR_5; if (!av_fifo_space(VAR_1->async_fifo) || (!VAR_3 && av_fifo_size(VAR_1->async_fifo))) { AVPacket new_pkt; mfxBitstream *bs; mfxSyncPoint sync; av_fifo_generic_read(VAR_1->async_fifo, &new_pkt, sizeof(new_pkt), NULL); av_fifo_generic_read(VAR_1->async_fifo, &sync, sizeof(sync), NULL); av_fifo_generic_read(VAR_1->async_fifo, &bs, sizeof(bs), NULL); do { VAR_5 = MFXVideoCORE_SyncOperation(VAR_1->session, sync, 1000); } while (VAR_5 == MFX_WRN_IN_EXECUTION); new_pkt.dts = av_rescale_q(bs->DecodeTimeStamp, (AVRational){1, 90000}, VAR_0->time_base); new_pkt.pts = av_rescale_q(bs->TimeStamp, (AVRational){1, 90000}, VAR_0->time_base); new_pkt.size = bs->DataLength; if (bs->FrameType & MFX_FRAMETYPE_IDR || bs->FrameType & MFX_FRAMETYPE_xIDR) new_pkt.flags |= AV_PKT_FLAG_KEY; #if FF_API_CODED_FRAME FF_DISABLE_DEPRECATION_WARNINGS if (bs->FrameType & MFX_FRAMETYPE_I || bs->FrameType & MFX_FRAMETYPE_xI) VAR_0->coded_frame->pict_type = AV_PICTURE_TYPE_I; else if (bs->FrameType & MFX_FRAMETYPE_P || bs->FrameType & MFX_FRAMETYPE_xP) VAR_0->coded_frame->pict_type = AV_PICTURE_TYPE_P; else if (bs->FrameType & MFX_FRAMETYPE_B || bs->FrameType & MFX_FRAMETYPE_xB) VAR_0->coded_frame->pict_type = AV_PICTURE_TYPE_B; FF_ENABLE_DEPRECATION_WARNINGS #endif av_freep(&bs); if (VAR_2->data) { if (VAR_2->size < new_pkt.size) { av_log(VAR_0, AV_LOG_ERROR, "Submitted buffer not large enough: %d < %d\n", VAR_2->size, new_pkt.size); av_packet_unref(&new_pkt); return AVERROR(EINVAL); } memcpy(VAR_2->data, new_pkt.data, new_pkt.size); VAR_2->size = new_pkt.size; VAR_5 = av_packet_copy_props(VAR_2, &new_pkt); av_packet_unref(&new_pkt); if (VAR_5 < 0) return VAR_5; } else *VAR_2 = new_pkt; *VAR_4 = 1; } return 0; }
[ "int FUNC_0(AVCodecContext *VAR_0, QSVEncContext *VAR_1,\nAVPacket *VAR_2, const AVFrame *VAR_3, int *VAR_4)\n{", "int VAR_5;", "VAR_5 = encode_frame(VAR_0, VAR_1, VAR_3);", "if (VAR_5 < 0)\nreturn VAR_5;", "if (!av_fifo_space(VAR_1->async_fifo) ||\n(!VAR_3 && av_fifo_size(VAR_1->async_fifo))) {", "AVPacket new_pkt;", "mfxBitstream *bs;", "mfxSyncPoint sync;", "av_fifo_generic_read(VAR_1->async_fifo, &new_pkt, sizeof(new_pkt), NULL);", "av_fifo_generic_read(VAR_1->async_fifo, &sync, sizeof(sync), NULL);", "av_fifo_generic_read(VAR_1->async_fifo, &bs, sizeof(bs), NULL);", "do {", "VAR_5 = MFXVideoCORE_SyncOperation(VAR_1->session, sync, 1000);", "} while (VAR_5 == MFX_WRN_IN_EXECUTION);", "new_pkt.dts = av_rescale_q(bs->DecodeTimeStamp, (AVRational){1, 90000}, VAR_0->time_base);", "new_pkt.pts = av_rescale_q(bs->TimeStamp, (AVRational){1, 90000}, VAR_0->time_base);", "new_pkt.size = bs->DataLength;", "if (bs->FrameType & MFX_FRAMETYPE_IDR ||\nbs->FrameType & MFX_FRAMETYPE_xIDR)\nnew_pkt.flags |= AV_PKT_FLAG_KEY;", "#if FF_API_CODED_FRAME\nFF_DISABLE_DEPRECATION_WARNINGS\nif (bs->FrameType & MFX_FRAMETYPE_I || bs->FrameType & MFX_FRAMETYPE_xI)\nVAR_0->coded_frame->pict_type = AV_PICTURE_TYPE_I;", "else if (bs->FrameType & MFX_FRAMETYPE_P || bs->FrameType & MFX_FRAMETYPE_xP)\nVAR_0->coded_frame->pict_type = AV_PICTURE_TYPE_P;", "else if (bs->FrameType & MFX_FRAMETYPE_B || bs->FrameType & MFX_FRAMETYPE_xB)\nVAR_0->coded_frame->pict_type = AV_PICTURE_TYPE_B;", "FF_ENABLE_DEPRECATION_WARNINGS\n#endif\nav_freep(&bs);", "if (VAR_2->data) {", "if (VAR_2->size < new_pkt.size) {", "av_log(VAR_0, AV_LOG_ERROR, \"Submitted buffer not large enough: %d < %d\\n\",\nVAR_2->size, new_pkt.size);", "av_packet_unref(&new_pkt);", "return AVERROR(EINVAL);", "}", "memcpy(VAR_2->data, new_pkt.data, new_pkt.size);", "VAR_2->size = new_pkt.size;", "VAR_5 = av_packet_copy_props(VAR_2, &new_pkt);", "av_packet_unref(&new_pkt);", "if (VAR_5 < 0)\nreturn VAR_5;", "} else", "*VAR_2 = new_pkt;", "*VAR_4 = 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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13, 15 ], [ 19, 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 55, 57, 59 ], [ 63, 65, 67, 69 ], [ 71, 73 ], [ 75, 77 ], [ 79, 81, 85 ], [ 89 ], [ 91 ], [ 93, 95 ], [ 97 ], [ 99 ], [ 101 ], [ 105 ], [ 107 ], [ 111 ], [ 113 ], [ 115, 117 ], [ 119 ], [ 121 ], [ 125 ], [ 127 ], [ 131 ], [ 133 ] ]
12,657
static int test_vector_dmul_scalar(AVFloatDSPContext *fdsp, AVFloatDSPContext *cdsp, const double *v1, double scale) { LOCAL_ALIGNED(32, double, cdst, [LEN]); LOCAL_ALIGNED(32, double, odst, [LEN]); int ret; cdsp->vector_dmul_scalar(cdst, v1, scale, LEN); fdsp->vector_dmul_scalar(odst, v1, scale, LEN); if (ret = compare_doubles(cdst, odst, LEN, DBL_EPSILON)) av_log(NULL, AV_LOG_ERROR, "vector_dmul_scalar failed\n"); return ret; }
false
FFmpeg
e53c9065ca08a9153ecc73a6a8940bcc6d667e58
static int test_vector_dmul_scalar(AVFloatDSPContext *fdsp, AVFloatDSPContext *cdsp, const double *v1, double scale) { LOCAL_ALIGNED(32, double, cdst, [LEN]); LOCAL_ALIGNED(32, double, odst, [LEN]); int ret; cdsp->vector_dmul_scalar(cdst, v1, scale, LEN); fdsp->vector_dmul_scalar(odst, v1, scale, LEN); if (ret = compare_doubles(cdst, odst, LEN, DBL_EPSILON)) av_log(NULL, AV_LOG_ERROR, "vector_dmul_scalar failed\n"); return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFloatDSPContext *VAR_0, AVFloatDSPContext *VAR_1, const double *VAR_2, double VAR_3) { LOCAL_ALIGNED(32, double, cdst, [LEN]); LOCAL_ALIGNED(32, double, odst, [LEN]); int VAR_4; VAR_1->vector_dmul_scalar(cdst, VAR_2, VAR_3, LEN); VAR_0->vector_dmul_scalar(odst, VAR_2, VAR_3, LEN); if (VAR_4 = compare_doubles(cdst, odst, LEN, DBL_EPSILON)) av_log(NULL, AV_LOG_ERROR, "vector_dmul_scalar failed\n"); return VAR_4; }
[ "static int FUNC_0(AVFloatDSPContext *VAR_0, AVFloatDSPContext *VAR_1,\nconst double *VAR_2, double VAR_3)\n{", "LOCAL_ALIGNED(32, double, cdst, [LEN]);", "LOCAL_ALIGNED(32, double, odst, [LEN]);", "int VAR_4;", "VAR_1->vector_dmul_scalar(cdst, VAR_2, VAR_3, LEN);", "VAR_0->vector_dmul_scalar(odst, VAR_2, VAR_3, LEN);", "if (VAR_4 = compare_doubles(cdst, odst, LEN, DBL_EPSILON))\nav_log(NULL, AV_LOG_ERROR, \"vector_dmul_scalar failed\\n\");", "return VAR_4;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 21, 23 ], [ 27 ], [ 29 ] ]
12,658
static int mpegps_read_pes_header(AVFormatContext *s, int64_t *ppos, int *pstart_code, int64_t *ppts, int64_t *pdts) { MpegDemuxContext *m = s->priv_data; int len, size, startcode, c, flags, header_len; int64_t pts, dts, last_pos; last_pos = -1; redo: /* next start code (should be immediately after) */ m->header_state = 0xff; size = MAX_SYNC_SIZE; startcode = find_next_start_code(&s->pb, &size, &m->header_state); //printf("startcode=%x pos=0x%"PRIx64"\n", startcode, url_ftell(&s->pb)); if (startcode < 0) return AVERROR_IO; if (startcode == PACK_START_CODE) goto redo; if (startcode == SYSTEM_HEADER_START_CODE) goto redo; if (startcode == PADDING_STREAM || startcode == PRIVATE_STREAM_2) { /* skip them */ len = get_be16(&s->pb); url_fskip(&s->pb, len); goto redo; } if (startcode == PROGRAM_STREAM_MAP) { mpegps_psm_parse(m, &s->pb); goto redo; } /* find matching stream */ if (!((startcode >= 0x1c0 && startcode <= 0x1df) || (startcode >= 0x1e0 && startcode <= 0x1ef) || (startcode == 0x1bd))) goto redo; if (ppos) { *ppos = url_ftell(&s->pb) - 4; } len = get_be16(&s->pb); pts = AV_NOPTS_VALUE; dts = AV_NOPTS_VALUE; /* stuffing */ for(;;) { if (len < 1) goto redo; c = get_byte(&s->pb); len--; /* XXX: for mpeg1, should test only bit 7 */ if (c != 0xff) break; } if ((c & 0xc0) == 0x40) { /* buffer scale & size */ if (len < 2) goto redo; get_byte(&s->pb); c = get_byte(&s->pb); len -= 2; } if ((c & 0xf0) == 0x20) { if (len < 4) goto redo; dts = pts = get_pts(&s->pb, c); len -= 4; } else if ((c & 0xf0) == 0x30) { if (len < 9) goto redo; pts = get_pts(&s->pb, c); dts = get_pts(&s->pb, -1); len -= 9; } else if ((c & 0xc0) == 0x80) { /* mpeg 2 PES */ #if 0 /* some streams have this field set for no apparent reason */ if ((c & 0x30) != 0) { /* Encrypted multiplex not handled */ goto redo; } #endif flags = get_byte(&s->pb); header_len = get_byte(&s->pb); len -= 2; if (header_len > len) goto redo; if ((flags & 0xc0) == 0x80) { dts = pts = get_pts(&s->pb, -1); if (header_len < 5) goto redo; header_len -= 5; len -= 5; } if ((flags & 0xc0) == 0xc0) { pts = get_pts(&s->pb, -1); dts = get_pts(&s->pb, -1); if (header_len < 10) goto redo; header_len -= 10; len -= 10; } len -= header_len; while (header_len > 0) { get_byte(&s->pb); header_len--; } } else if( c!= 0xf ) goto redo; if (startcode == PRIVATE_STREAM_1 && !m->psm_es_type[startcode & 0xff]) { if (len < 1) goto redo; startcode = get_byte(&s->pb); len--; if (startcode >= 0x80 && startcode <= 0xbf) { /* audio: skip header */ if (len < 3) goto redo; get_byte(&s->pb); get_byte(&s->pb); get_byte(&s->pb); len -= 3; } } if(dts != AV_NOPTS_VALUE && ppos){ int i; for(i=0; i<s->nb_streams; i++){ if(startcode == s->streams[i]->id) { av_add_index_entry(s->streams[i], *ppos, dts, 0, 0, AVINDEX_KEYFRAME /* FIXME keyframe? */); } } } *pstart_code = startcode; *ppts = pts; *pdts = dts; return len; }
false
FFmpeg
e56cfad04b73be35ea8dcb5fd5e8451f6924aff1
static int mpegps_read_pes_header(AVFormatContext *s, int64_t *ppos, int *pstart_code, int64_t *ppts, int64_t *pdts) { MpegDemuxContext *m = s->priv_data; int len, size, startcode, c, flags, header_len; int64_t pts, dts, last_pos; last_pos = -1; redo: m->header_state = 0xff; size = MAX_SYNC_SIZE; startcode = find_next_start_code(&s->pb, &size, &m->header_state); if (startcode < 0) return AVERROR_IO; if (startcode == PACK_START_CODE) goto redo; if (startcode == SYSTEM_HEADER_START_CODE) goto redo; if (startcode == PADDING_STREAM || startcode == PRIVATE_STREAM_2) { len = get_be16(&s->pb); url_fskip(&s->pb, len); goto redo; } if (startcode == PROGRAM_STREAM_MAP) { mpegps_psm_parse(m, &s->pb); goto redo; } if (!((startcode >= 0x1c0 && startcode <= 0x1df) || (startcode >= 0x1e0 && startcode <= 0x1ef) || (startcode == 0x1bd))) goto redo; if (ppos) { *ppos = url_ftell(&s->pb) - 4; } len = get_be16(&s->pb); pts = AV_NOPTS_VALUE; dts = AV_NOPTS_VALUE; for(;;) { if (len < 1) goto redo; c = get_byte(&s->pb); len--; if (c != 0xff) break; } if ((c & 0xc0) == 0x40) { if (len < 2) goto redo; get_byte(&s->pb); c = get_byte(&s->pb); len -= 2; } if ((c & 0xf0) == 0x20) { if (len < 4) goto redo; dts = pts = get_pts(&s->pb, c); len -= 4; } else if ((c & 0xf0) == 0x30) { if (len < 9) goto redo; pts = get_pts(&s->pb, c); dts = get_pts(&s->pb, -1); len -= 9; } else if ((c & 0xc0) == 0x80) { #if 0 if ((c & 0x30) != 0) { goto redo; } #endif flags = get_byte(&s->pb); header_len = get_byte(&s->pb); len -= 2; if (header_len > len) goto redo; if ((flags & 0xc0) == 0x80) { dts = pts = get_pts(&s->pb, -1); if (header_len < 5) goto redo; header_len -= 5; len -= 5; } if ((flags & 0xc0) == 0xc0) { pts = get_pts(&s->pb, -1); dts = get_pts(&s->pb, -1); if (header_len < 10) goto redo; header_len -= 10; len -= 10; } len -= header_len; while (header_len > 0) { get_byte(&s->pb); header_len--; } } else if( c!= 0xf ) goto redo; if (startcode == PRIVATE_STREAM_1 && !m->psm_es_type[startcode & 0xff]) { if (len < 1) goto redo; startcode = get_byte(&s->pb); len--; if (startcode >= 0x80 && startcode <= 0xbf) { if (len < 3) goto redo; get_byte(&s->pb); get_byte(&s->pb); get_byte(&s->pb); len -= 3; } } if(dts != AV_NOPTS_VALUE && ppos){ int i; for(i=0; i<s->nb_streams; i++){ if(startcode == s->streams[i]->id) { av_add_index_entry(s->streams[i], *ppos, dts, 0, 0, AVINDEX_KEYFRAME ); } } } *pstart_code = startcode; *ppts = pts; *pdts = dts; return len; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0, int64_t *VAR_1, int *VAR_2, int64_t *VAR_3, int64_t *VAR_4) { MpegDemuxContext *m = VAR_0->priv_data; int VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10; int64_t pts, dts, last_pos; last_pos = -1; redo: m->header_state = 0xff; VAR_6 = MAX_SYNC_SIZE; VAR_7 = find_next_start_code(&VAR_0->pb, &VAR_6, &m->header_state); if (VAR_7 < 0) return AVERROR_IO; if (VAR_7 == PACK_START_CODE) goto redo; if (VAR_7 == SYSTEM_HEADER_START_CODE) goto redo; if (VAR_7 == PADDING_STREAM || VAR_7 == PRIVATE_STREAM_2) { VAR_5 = get_be16(&VAR_0->pb); url_fskip(&VAR_0->pb, VAR_5); goto redo; } if (VAR_7 == PROGRAM_STREAM_MAP) { mpegps_psm_parse(m, &VAR_0->pb); goto redo; } if (!((VAR_7 >= 0x1c0 && VAR_7 <= 0x1df) || (VAR_7 >= 0x1e0 && VAR_7 <= 0x1ef) || (VAR_7 == 0x1bd))) goto redo; if (VAR_1) { *VAR_1 = url_ftell(&VAR_0->pb) - 4; } VAR_5 = get_be16(&VAR_0->pb); pts = AV_NOPTS_VALUE; dts = AV_NOPTS_VALUE; for(;;) { if (VAR_5 < 1) goto redo; VAR_8 = get_byte(&VAR_0->pb); VAR_5--; if (VAR_8 != 0xff) break; } if ((VAR_8 & 0xc0) == 0x40) { if (VAR_5 < 2) goto redo; get_byte(&VAR_0->pb); VAR_8 = get_byte(&VAR_0->pb); VAR_5 -= 2; } if ((VAR_8 & 0xf0) == 0x20) { if (VAR_5 < 4) goto redo; dts = pts = get_pts(&VAR_0->pb, VAR_8); VAR_5 -= 4; } else if ((VAR_8 & 0xf0) == 0x30) { if (VAR_5 < 9) goto redo; pts = get_pts(&VAR_0->pb, VAR_8); dts = get_pts(&VAR_0->pb, -1); VAR_5 -= 9; } else if ((VAR_8 & 0xc0) == 0x80) { #if 0 if ((VAR_8 & 0x30) != 0) { goto redo; } #endif VAR_9 = get_byte(&VAR_0->pb); VAR_10 = get_byte(&VAR_0->pb); VAR_5 -= 2; if (VAR_10 > VAR_5) goto redo; if ((VAR_9 & 0xc0) == 0x80) { dts = pts = get_pts(&VAR_0->pb, -1); if (VAR_10 < 5) goto redo; VAR_10 -= 5; VAR_5 -= 5; } if ((VAR_9 & 0xc0) == 0xc0) { pts = get_pts(&VAR_0->pb, -1); dts = get_pts(&VAR_0->pb, -1); if (VAR_10 < 10) goto redo; VAR_10 -= 10; VAR_5 -= 10; } VAR_5 -= VAR_10; while (VAR_10 > 0) { get_byte(&VAR_0->pb); VAR_10--; } } else if( VAR_8!= 0xf ) goto redo; if (VAR_7 == PRIVATE_STREAM_1 && !m->psm_es_type[VAR_7 & 0xff]) { if (VAR_5 < 1) goto redo; VAR_7 = get_byte(&VAR_0->pb); VAR_5--; if (VAR_7 >= 0x80 && VAR_7 <= 0xbf) { if (VAR_5 < 3) goto redo; get_byte(&VAR_0->pb); get_byte(&VAR_0->pb); get_byte(&VAR_0->pb); VAR_5 -= 3; } } if(dts != AV_NOPTS_VALUE && VAR_1){ int VAR_11; for(VAR_11=0; VAR_11<VAR_0->nb_streams; VAR_11++){ if(VAR_7 == VAR_0->streams[VAR_11]->id) { av_add_index_entry(VAR_0->streams[VAR_11], *VAR_1, dts, 0, 0, AVINDEX_KEYFRAME ); } } } *VAR_2 = VAR_7; *VAR_3 = pts; *VAR_4 = dts; return VAR_5; }
[ "static int FUNC_0(AVFormatContext *VAR_0,\nint64_t *VAR_1, int *VAR_2,\nint64_t *VAR_3, int64_t *VAR_4)\n{", "MpegDemuxContext *m = VAR_0->priv_data;", "int VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10;", "int64_t pts, dts, last_pos;", "last_pos = -1;", "redo:\nm->header_state = 0xff;", "VAR_6 = MAX_SYNC_SIZE;", "VAR_7 = find_next_start_code(&VAR_0->pb, &VAR_6, &m->header_state);", "if (VAR_7 < 0)\nreturn AVERROR_IO;", "if (VAR_7 == PACK_START_CODE)\ngoto redo;", "if (VAR_7 == SYSTEM_HEADER_START_CODE)\ngoto redo;", "if (VAR_7 == PADDING_STREAM ||\nVAR_7 == PRIVATE_STREAM_2) {", "VAR_5 = get_be16(&VAR_0->pb);", "url_fskip(&VAR_0->pb, VAR_5);", "goto redo;", "}", "if (VAR_7 == PROGRAM_STREAM_MAP) {", "mpegps_psm_parse(m, &VAR_0->pb);", "goto redo;", "}", "if (!((VAR_7 >= 0x1c0 && VAR_7 <= 0x1df) ||\n(VAR_7 >= 0x1e0 && VAR_7 <= 0x1ef) ||\n(VAR_7 == 0x1bd)))\ngoto redo;", "if (VAR_1) {", "*VAR_1 = url_ftell(&VAR_0->pb) - 4;", "}", "VAR_5 = get_be16(&VAR_0->pb);", "pts = AV_NOPTS_VALUE;", "dts = AV_NOPTS_VALUE;", "for(;;) {", "if (VAR_5 < 1)\ngoto redo;", "VAR_8 = get_byte(&VAR_0->pb);", "VAR_5--;", "if (VAR_8 != 0xff)\nbreak;", "}", "if ((VAR_8 & 0xc0) == 0x40) {", "if (VAR_5 < 2)\ngoto redo;", "get_byte(&VAR_0->pb);", "VAR_8 = get_byte(&VAR_0->pb);", "VAR_5 -= 2;", "}", "if ((VAR_8 & 0xf0) == 0x20) {", "if (VAR_5 < 4)\ngoto redo;", "dts = pts = get_pts(&VAR_0->pb, VAR_8);", "VAR_5 -= 4;", "} else if ((VAR_8 & 0xf0) == 0x30) {", "if (VAR_5 < 9)\ngoto redo;", "pts = get_pts(&VAR_0->pb, VAR_8);", "dts = get_pts(&VAR_0->pb, -1);", "VAR_5 -= 9;", "} else if ((VAR_8 & 0xc0) == 0x80) {", "#if 0\nif ((VAR_8 & 0x30) != 0) {", "goto redo;", "}", "#endif\nVAR_9 = get_byte(&VAR_0->pb);", "VAR_10 = get_byte(&VAR_0->pb);", "VAR_5 -= 2;", "if (VAR_10 > VAR_5)\ngoto redo;", "if ((VAR_9 & 0xc0) == 0x80) {", "dts = pts = get_pts(&VAR_0->pb, -1);", "if (VAR_10 < 5)\ngoto redo;", "VAR_10 -= 5;", "VAR_5 -= 5;", "} if ((VAR_9 & 0xc0) == 0xc0) {", "pts = get_pts(&VAR_0->pb, -1);", "dts = get_pts(&VAR_0->pb, -1);", "if (VAR_10 < 10)\ngoto redo;", "VAR_10 -= 10;", "VAR_5 -= 10;", "}", "VAR_5 -= VAR_10;", "while (VAR_10 > 0) {", "get_byte(&VAR_0->pb);", "VAR_10--;", "}", "}", "else if( VAR_8!= 0xf )\ngoto redo;", "if (VAR_7 == PRIVATE_STREAM_1 && !m->psm_es_type[VAR_7 & 0xff]) {", "if (VAR_5 < 1)\ngoto redo;", "VAR_7 = get_byte(&VAR_0->pb);", "VAR_5--;", "if (VAR_7 >= 0x80 && VAR_7 <= 0xbf) {", "if (VAR_5 < 3)\ngoto redo;", "get_byte(&VAR_0->pb);", "get_byte(&VAR_0->pb);", "get_byte(&VAR_0->pb);", "VAR_5 -= 3;", "}", "}", "if(dts != AV_NOPTS_VALUE && VAR_1){", "int VAR_11;", "for(VAR_11=0; VAR_11<VAR_0->nb_streams; VAR_11++){", "if(VAR_7 == VAR_0->streams[VAR_11]->id) {", "av_add_index_entry(VAR_0->streams[VAR_11], *VAR_1, dts, 0, 0, AVINDEX_KEYFRAME );", "}", "}", "}", "*VAR_2 = VAR_7;", "*VAR_3 = pts;", "*VAR_4 = dts;", "return VAR_5;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19, 23 ], [ 25 ], [ 27 ], [ 31, 33 ], [ 35, 37 ], [ 39, 41 ], [ 43, 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 69, 71, 73, 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 91 ], [ 93, 95 ], [ 97 ], [ 99 ], [ 103, 105 ], [ 107 ], [ 109 ], [ 113, 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127, 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137, 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 151, 153 ], [ 157 ], [ 159 ], [ 161, 163 ], [ 165 ], [ 167 ], [ 169, 171 ], [ 173 ], [ 175 ], [ 177, 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191, 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213, 215 ], [ 219 ], [ 221, 223 ], [ 225 ], [ 227 ], [ 229 ], [ 233, 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ] ]
12,659
static void decode_sigpass(Jpeg2000T1Context *t1, int width, int height, int bpno, int bandno, int vert_causal_ctx_csty_symbol) { int mask = 3 << (bpno - 1), y0, x, y; for (y0 = 0; y0 < height; y0 += 4) for (x = 0; x < width; x++) for (y = y0; y < height && y < y0 + 4; y++) { int flags_mask = -1; if (vert_causal_ctx_csty_symbol && y == y0 + 3) flags_mask &= ~(JPEG2000_T1_SIG_S | JPEG2000_T1_SIG_SW | JPEG2000_T1_SIG_SE | JPEG2000_T1_SGN_S); if ((t1->flags[y+1][x+1] & JPEG2000_T1_SIG_NB & flags_mask) && !(t1->flags[y+1][x+1] & (JPEG2000_T1_SIG | JPEG2000_T1_VIS))) { if (ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + ff_jpeg2000_getsigctxno(t1->flags[y+1][x+1] & flags_mask, bandno))) { int xorbit, ctxno = ff_jpeg2000_getsgnctxno(t1->flags[y+1][x+1] & flags_mask, &xorbit); if (t1->mqc.raw) t1->data[y][x] = ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + ctxno) ? -mask : mask; else t1->data[y][x] = (ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + ctxno) ^ xorbit) ? -mask : mask; ff_jpeg2000_set_significance(t1, x, y, t1->data[y][x] < 0); } t1->flags[y + 1][x + 1] |= JPEG2000_T1_VIS; } } }
false
FFmpeg
f1e173049ecc9de03817385ba8962d14cba779db
static void decode_sigpass(Jpeg2000T1Context *t1, int width, int height, int bpno, int bandno, int vert_causal_ctx_csty_symbol) { int mask = 3 << (bpno - 1), y0, x, y; for (y0 = 0; y0 < height; y0 += 4) for (x = 0; x < width; x++) for (y = y0; y < height && y < y0 + 4; y++) { int flags_mask = -1; if (vert_causal_ctx_csty_symbol && y == y0 + 3) flags_mask &= ~(JPEG2000_T1_SIG_S | JPEG2000_T1_SIG_SW | JPEG2000_T1_SIG_SE | JPEG2000_T1_SGN_S); if ((t1->flags[y+1][x+1] & JPEG2000_T1_SIG_NB & flags_mask) && !(t1->flags[y+1][x+1] & (JPEG2000_T1_SIG | JPEG2000_T1_VIS))) { if (ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + ff_jpeg2000_getsigctxno(t1->flags[y+1][x+1] & flags_mask, bandno))) { int xorbit, ctxno = ff_jpeg2000_getsgnctxno(t1->flags[y+1][x+1] & flags_mask, &xorbit); if (t1->mqc.raw) t1->data[y][x] = ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + ctxno) ? -mask : mask; else t1->data[y][x] = (ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + ctxno) ^ xorbit) ? -mask : mask; ff_jpeg2000_set_significance(t1, x, y, t1->data[y][x] < 0); } t1->flags[y + 1][x + 1] |= JPEG2000_T1_VIS; } } }
{ "code": [], "line_no": [] }
static void FUNC_0(Jpeg2000T1Context *VAR_0, int VAR_1, int VAR_2, int VAR_3, int VAR_4, int VAR_5) { int VAR_6 = 3 << (VAR_3 - 1), VAR_7, VAR_8, VAR_9; for (VAR_7 = 0; VAR_7 < VAR_2; VAR_7 += 4) for (VAR_8 = 0; VAR_8 < VAR_1; VAR_8++) for (VAR_9 = VAR_7; VAR_9 < VAR_2 && VAR_9 < VAR_7 + 4; VAR_9++) { int VAR_10 = -1; if (VAR_5 && VAR_9 == VAR_7 + 3) VAR_10 &= ~(JPEG2000_T1_SIG_S | JPEG2000_T1_SIG_SW | JPEG2000_T1_SIG_SE | JPEG2000_T1_SGN_S); if ((VAR_0->flags[VAR_9+1][VAR_8+1] & JPEG2000_T1_SIG_NB & VAR_10) && !(VAR_0->flags[VAR_9+1][VAR_8+1] & (JPEG2000_T1_SIG | JPEG2000_T1_VIS))) { if (ff_mqc_decode(&VAR_0->mqc, VAR_0->mqc.cx_states + ff_jpeg2000_getsigctxno(VAR_0->flags[VAR_9+1][VAR_8+1] & VAR_10, VAR_4))) { int VAR_11, VAR_12 = ff_jpeg2000_getsgnctxno(VAR_0->flags[VAR_9+1][VAR_8+1] & VAR_10, &VAR_11); if (VAR_0->mqc.raw) VAR_0->data[VAR_9][VAR_8] = ff_mqc_decode(&VAR_0->mqc, VAR_0->mqc.cx_states + VAR_12) ? -VAR_6 : VAR_6; else VAR_0->data[VAR_9][VAR_8] = (ff_mqc_decode(&VAR_0->mqc, VAR_0->mqc.cx_states + VAR_12) ^ VAR_11) ? -VAR_6 : VAR_6; ff_jpeg2000_set_significance(VAR_0, VAR_8, VAR_9, VAR_0->data[VAR_9][VAR_8] < 0); } VAR_0->flags[VAR_9 + 1][VAR_8 + 1] |= JPEG2000_T1_VIS; } } }
[ "static void FUNC_0(Jpeg2000T1Context *VAR_0, int VAR_1, int VAR_2,\nint VAR_3, int VAR_4,\nint VAR_5)\n{", "int VAR_6 = 3 << (VAR_3 - 1), VAR_7, VAR_8, VAR_9;", "for (VAR_7 = 0; VAR_7 < VAR_2; VAR_7 += 4)", "for (VAR_8 = 0; VAR_8 < VAR_1; VAR_8++)", "for (VAR_9 = VAR_7; VAR_9 < VAR_2 && VAR_9 < VAR_7 + 4; VAR_9++) {", "int VAR_10 = -1;", "if (VAR_5 && VAR_9 == VAR_7 + 3)\nVAR_10 &= ~(JPEG2000_T1_SIG_S | JPEG2000_T1_SIG_SW | JPEG2000_T1_SIG_SE | JPEG2000_T1_SGN_S);", "if ((VAR_0->flags[VAR_9+1][VAR_8+1] & JPEG2000_T1_SIG_NB & VAR_10)\n&& !(VAR_0->flags[VAR_9+1][VAR_8+1] & (JPEG2000_T1_SIG | JPEG2000_T1_VIS))) {", "if (ff_mqc_decode(&VAR_0->mqc, VAR_0->mqc.cx_states + ff_jpeg2000_getsigctxno(VAR_0->flags[VAR_9+1][VAR_8+1] & VAR_10, VAR_4))) {", "int VAR_11, VAR_12 = ff_jpeg2000_getsgnctxno(VAR_0->flags[VAR_9+1][VAR_8+1] & VAR_10, &VAR_11);", "if (VAR_0->mqc.raw)\nVAR_0->data[VAR_9][VAR_8] = ff_mqc_decode(&VAR_0->mqc, VAR_0->mqc.cx_states + VAR_12) ? -VAR_6 : VAR_6;", "else\nVAR_0->data[VAR_9][VAR_8] = (ff_mqc_decode(&VAR_0->mqc, VAR_0->mqc.cx_states + VAR_12) ^ VAR_11) ?\n-VAR_6 : VAR_6;", "ff_jpeg2000_set_significance(VAR_0, VAR_8, VAR_9,\nVAR_0->data[VAR_9][VAR_8] < 0);", "}", "VAR_0->flags[VAR_9 + 1][VAR_8 + 1] |= JPEG2000_T1_VIS;", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21, 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33, 35 ], [ 37, 39, 41 ], [ 45, 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ] ]
12,660
static AVPacket *add_to_pktbuf(AVPacketList **packet_buffer, AVPacket *pkt, AVPacketList **plast_pktl) { AVPacketList *pktl = av_mallocz(sizeof(AVPacketList)); if (!pktl) return NULL; if (*packet_buffer) (*plast_pktl)->next = pktl; else *packet_buffer = pktl; /* Add the packet in the buffered packet list. */ *plast_pktl = pktl; pktl->pkt = *pkt; return &pktl->pkt; }
false
FFmpeg
d584533cf38141172e20bae5436629ee17c8ce50
static AVPacket *add_to_pktbuf(AVPacketList **packet_buffer, AVPacket *pkt, AVPacketList **plast_pktl) { AVPacketList *pktl = av_mallocz(sizeof(AVPacketList)); if (!pktl) return NULL; if (*packet_buffer) (*plast_pktl)->next = pktl; else *packet_buffer = pktl; *plast_pktl = pktl; pktl->pkt = *pkt; return &pktl->pkt; }
{ "code": [], "line_no": [] }
static AVPacket *FUNC_0(AVPacketList **packet_buffer, AVPacket *pkt, AVPacketList **plast_pktl) { AVPacketList *pktl = av_mallocz(sizeof(AVPacketList)); if (!pktl) return NULL; if (*packet_buffer) (*plast_pktl)->next = pktl; else *packet_buffer = pktl; *plast_pktl = pktl; pktl->pkt = *pkt; return &pktl->pkt; }
[ "static AVPacket *FUNC_0(AVPacketList **packet_buffer, AVPacket *pkt,\nAVPacketList **plast_pktl)\n{", "AVPacketList *pktl = av_mallocz(sizeof(AVPacketList));", "if (!pktl)\nreturn NULL;", "if (*packet_buffer)\n(*plast_pktl)->next = pktl;", "else\n*packet_buffer = pktl;", "*plast_pktl = pktl;", "pktl->pkt = *pkt;", "return &pktl->pkt;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9, 11 ], [ 15, 17 ], [ 19, 21 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ] ]
12,661
static av_always_inline void h264_filter_mb_fast_internal(const H264Context *h, H264SliceContext *sl, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize, int pixel_shift) { int chroma = !(CONFIG_GRAY && (h->flags & AV_CODEC_FLAG_GRAY)); int chroma444 = CHROMA444(h); int chroma422 = CHROMA422(h); int mb_xy = sl->mb_xy; int left_type = sl->left_type[LTOP]; int top_type = sl->top_type; int qp_bd_offset = 6 * (h->sps.bit_depth_luma - 8); int a = 52 + sl->slice_alpha_c0_offset - qp_bd_offset; int b = 52 + sl->slice_beta_offset - qp_bd_offset; int mb_type = h->cur_pic.mb_type[mb_xy]; int qp = h->cur_pic.qscale_table[mb_xy]; int qp0 = h->cur_pic.qscale_table[mb_xy - 1]; int qp1 = h->cur_pic.qscale_table[sl->top_mb_xy]; int qpc = get_chroma_qp( h, 0, qp ); int qpc0 = get_chroma_qp( h, 0, qp0 ); int qpc1 = get_chroma_qp( h, 0, qp1 ); qp0 = (qp + qp0 + 1) >> 1; qp1 = (qp + qp1 + 1) >> 1; qpc0 = (qpc + qpc0 + 1) >> 1; qpc1 = (qpc + qpc1 + 1) >> 1; if( IS_INTRA(mb_type) ) { static const int16_t bS4[4] = {4,4,4,4}; static const int16_t bS3[4] = {3,3,3,3}; const int16_t *bSH = FIELD_PICTURE(h) ? bS3 : bS4; if(left_type) filter_mb_edgev( &img_y[4*0<<pixel_shift], linesize, bS4, qp0, a, b, h, 1); if( IS_8x8DCT(mb_type) ) { filter_mb_edgev( &img_y[4*2<<pixel_shift], linesize, bS3, qp, a, b, h, 0); if(top_type){ filter_mb_edgeh( &img_y[4*0*linesize], linesize, bSH, qp1, a, b, h, 1); } filter_mb_edgeh( &img_y[4*2*linesize], linesize, bS3, qp, a, b, h, 0); } else { filter_mb_edgev( &img_y[4*1<<pixel_shift], linesize, bS3, qp, a, b, h, 0); filter_mb_edgev( &img_y[4*2<<pixel_shift], linesize, bS3, qp, a, b, h, 0); filter_mb_edgev( &img_y[4*3<<pixel_shift], linesize, bS3, qp, a, b, h, 0); if(top_type){ filter_mb_edgeh( &img_y[4*0*linesize], linesize, bSH, qp1, a, b, h, 1); } filter_mb_edgeh( &img_y[4*1*linesize], linesize, bS3, qp, a, b, h, 0); filter_mb_edgeh( &img_y[4*2*linesize], linesize, bS3, qp, a, b, h, 0); filter_mb_edgeh( &img_y[4*3*linesize], linesize, bS3, qp, a, b, h, 0); } if(chroma){ if(chroma444){ if(left_type){ filter_mb_edgev( &img_cb[4*0<<pixel_shift], linesize, bS4, qpc0, a, b, h, 1); filter_mb_edgev( &img_cr[4*0<<pixel_shift], linesize, bS4, qpc0, a, b, h, 1); } if( IS_8x8DCT(mb_type) ) { filter_mb_edgev( &img_cb[4*2<<pixel_shift], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgev( &img_cr[4*2<<pixel_shift], linesize, bS3, qpc, a, b, h, 0); if(top_type){ filter_mb_edgeh( &img_cb[4*0*linesize], linesize, bSH, qpc1, a, b, h, 1 ); filter_mb_edgeh( &img_cr[4*0*linesize], linesize, bSH, qpc1, a, b, h, 1 ); } filter_mb_edgeh( &img_cb[4*2*linesize], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgeh( &img_cr[4*2*linesize], linesize, bS3, qpc, a, b, h, 0); } else { filter_mb_edgev( &img_cb[4*1<<pixel_shift], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgev( &img_cr[4*1<<pixel_shift], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgev( &img_cb[4*2<<pixel_shift], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgev( &img_cr[4*2<<pixel_shift], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgev( &img_cb[4*3<<pixel_shift], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgev( &img_cr[4*3<<pixel_shift], linesize, bS3, qpc, a, b, h, 0); if(top_type){ filter_mb_edgeh( &img_cb[4*0*linesize], linesize, bSH, qpc1, a, b, h, 1); filter_mb_edgeh( &img_cr[4*0*linesize], linesize, bSH, qpc1, a, b, h, 1); } filter_mb_edgeh( &img_cb[4*1*linesize], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgeh( &img_cr[4*1*linesize], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgeh( &img_cb[4*2*linesize], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgeh( &img_cr[4*2*linesize], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgeh( &img_cb[4*3*linesize], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgeh( &img_cr[4*3*linesize], linesize, bS3, qpc, a, b, h, 0); } }else if(chroma422){ if(left_type){ filter_mb_edgecv(&img_cb[2*0<<pixel_shift], uvlinesize, bS4, qpc0, a, b, h, 1); filter_mb_edgecv(&img_cr[2*0<<pixel_shift], uvlinesize, bS4, qpc0, a, b, h, 1); } filter_mb_edgecv(&img_cb[2*2<<pixel_shift], uvlinesize, bS3, qpc, a, b, h, 0); filter_mb_edgecv(&img_cr[2*2<<pixel_shift], uvlinesize, bS3, qpc, a, b, h, 0); if(top_type){ filter_mb_edgech(&img_cb[4*0*uvlinesize], uvlinesize, bSH, qpc1, a, b, h, 1); filter_mb_edgech(&img_cr[4*0*uvlinesize], uvlinesize, bSH, qpc1, a, b, h, 1); } filter_mb_edgech(&img_cb[4*1*uvlinesize], uvlinesize, bS3, qpc, a, b, h, 0); filter_mb_edgech(&img_cr[4*1*uvlinesize], uvlinesize, bS3, qpc, a, b, h, 0); filter_mb_edgech(&img_cb[4*2*uvlinesize], uvlinesize, bS3, qpc, a, b, h, 0); filter_mb_edgech(&img_cr[4*2*uvlinesize], uvlinesize, bS3, qpc, a, b, h, 0); filter_mb_edgech(&img_cb[4*3*uvlinesize], uvlinesize, bS3, qpc, a, b, h, 0); filter_mb_edgech(&img_cr[4*3*uvlinesize], uvlinesize, bS3, qpc, a, b, h, 0); }else{ if(left_type){ filter_mb_edgecv( &img_cb[2*0<<pixel_shift], uvlinesize, bS4, qpc0, a, b, h, 1); filter_mb_edgecv( &img_cr[2*0<<pixel_shift], uvlinesize, bS4, qpc0, a, b, h, 1); } filter_mb_edgecv( &img_cb[2*2<<pixel_shift], uvlinesize, bS3, qpc, a, b, h, 0); filter_mb_edgecv( &img_cr[2*2<<pixel_shift], uvlinesize, bS3, qpc, a, b, h, 0); if(top_type){ filter_mb_edgech( &img_cb[2*0*uvlinesize], uvlinesize, bSH, qpc1, a, b, h, 1); filter_mb_edgech( &img_cr[2*0*uvlinesize], uvlinesize, bSH, qpc1, a, b, h, 1); } filter_mb_edgech( &img_cb[2*2*uvlinesize], uvlinesize, bS3, qpc, a, b, h, 0); filter_mb_edgech( &img_cr[2*2*uvlinesize], uvlinesize, bS3, qpc, a, b, h, 0); } } return; } else { LOCAL_ALIGNED_8(int16_t, bS, [2], [4][4]); int edges; if( IS_8x8DCT(mb_type) && (sl->cbp&7) == 7 && !chroma444 ) { edges = 4; AV_WN64A(bS[0][0], 0x0002000200020002ULL); AV_WN64A(bS[0][2], 0x0002000200020002ULL); AV_WN64A(bS[1][0], 0x0002000200020002ULL); AV_WN64A(bS[1][2], 0x0002000200020002ULL); } else { int mask_edge1 = (3*(((5*mb_type)>>5)&1)) | (mb_type>>4); //(mb_type & (MB_TYPE_16x16 | MB_TYPE_8x16)) ? 3 : (mb_type & MB_TYPE_16x8) ? 1 : 0; int mask_edge0 = 3*((mask_edge1>>1) & ((5*left_type)>>5)&1); // (mb_type & (MB_TYPE_16x16 | MB_TYPE_8x16)) && (h->left_type[LTOP] & (MB_TYPE_16x16 | MB_TYPE_8x16)) ? 3 : 0; int step = 1+(mb_type>>24); //IS_8x8DCT(mb_type) ? 2 : 1; edges = 4 - 3*((mb_type>>3) & !(sl->cbp & 15)); //(mb_type & MB_TYPE_16x16) && !(h->cbp & 15) ? 1 : 4; h->h264dsp.h264_loop_filter_strength(bS, sl->non_zero_count_cache, sl->ref_cache, sl->mv_cache, sl->list_count==2, edges, step, mask_edge0, mask_edge1, FIELD_PICTURE(h)); } if( IS_INTRA(left_type) ) AV_WN64A(bS[0][0], 0x0004000400040004ULL); if( IS_INTRA(top_type) ) AV_WN64A(bS[1][0], FIELD_PICTURE(h) ? 0x0003000300030003ULL : 0x0004000400040004ULL); #define FILTER(hv,dir,edge,intra)\ if(AV_RN64A(bS[dir][edge])) { \ filter_mb_edge##hv( &img_y[4*edge*(dir?linesize:1<<pixel_shift)], linesize, bS[dir][edge], edge ? qp : qp##dir, a, b, h, intra );\ if(chroma){\ if(chroma444){\ filter_mb_edge##hv( &img_cb[4*edge*(dir?linesize:1<<pixel_shift)], linesize, bS[dir][edge], edge ? qpc : qpc##dir, a, b, h, intra );\ filter_mb_edge##hv( &img_cr[4*edge*(dir?linesize:1<<pixel_shift)], linesize, bS[dir][edge], edge ? qpc : qpc##dir, a, b, h, intra );\ } else if(!(edge&1)) {\ filter_mb_edgec##hv( &img_cb[2*edge*(dir?uvlinesize:1<<pixel_shift)], uvlinesize, bS[dir][edge], edge ? qpc : qpc##dir, a, b, h, intra );\ filter_mb_edgec##hv( &img_cr[2*edge*(dir?uvlinesize:1<<pixel_shift)], uvlinesize, bS[dir][edge], edge ? qpc : qpc##dir, a, b, h, intra );\ }\ }\ } if(left_type) FILTER(v,0,0,1); if( edges == 1 ) { if(top_type) FILTER(h,1,0,1); } else if( IS_8x8DCT(mb_type) ) { FILTER(v,0,2,0); if(top_type) FILTER(h,1,0,1); FILTER(h,1,2,0); } else { FILTER(v,0,1,0); FILTER(v,0,2,0); FILTER(v,0,3,0); if(top_type) FILTER(h,1,0,1); FILTER(h,1,1,0); FILTER(h,1,2,0); FILTER(h,1,3,0); } #undef FILTER } }
false
FFmpeg
3176217c60ca7828712985092d9102d331ea4f3d
static av_always_inline void h264_filter_mb_fast_internal(const H264Context *h, H264SliceContext *sl, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize, int pixel_shift) { int chroma = !(CONFIG_GRAY && (h->flags & AV_CODEC_FLAG_GRAY)); int chroma444 = CHROMA444(h); int chroma422 = CHROMA422(h); int mb_xy = sl->mb_xy; int left_type = sl->left_type[LTOP]; int top_type = sl->top_type; int qp_bd_offset = 6 * (h->sps.bit_depth_luma - 8); int a = 52 + sl->slice_alpha_c0_offset - qp_bd_offset; int b = 52 + sl->slice_beta_offset - qp_bd_offset; int mb_type = h->cur_pic.mb_type[mb_xy]; int qp = h->cur_pic.qscale_table[mb_xy]; int qp0 = h->cur_pic.qscale_table[mb_xy - 1]; int qp1 = h->cur_pic.qscale_table[sl->top_mb_xy]; int qpc = get_chroma_qp( h, 0, qp ); int qpc0 = get_chroma_qp( h, 0, qp0 ); int qpc1 = get_chroma_qp( h, 0, qp1 ); qp0 = (qp + qp0 + 1) >> 1; qp1 = (qp + qp1 + 1) >> 1; qpc0 = (qpc + qpc0 + 1) >> 1; qpc1 = (qpc + qpc1 + 1) >> 1; if( IS_INTRA(mb_type) ) { static const int16_t bS4[4] = {4,4,4,4}; static const int16_t bS3[4] = {3,3,3,3}; const int16_t *bSH = FIELD_PICTURE(h) ? bS3 : bS4; if(left_type) filter_mb_edgev( &img_y[4*0<<pixel_shift], linesize, bS4, qp0, a, b, h, 1); if( IS_8x8DCT(mb_type) ) { filter_mb_edgev( &img_y[4*2<<pixel_shift], linesize, bS3, qp, a, b, h, 0); if(top_type){ filter_mb_edgeh( &img_y[4*0*linesize], linesize, bSH, qp1, a, b, h, 1); } filter_mb_edgeh( &img_y[4*2*linesize], linesize, bS3, qp, a, b, h, 0); } else { filter_mb_edgev( &img_y[4*1<<pixel_shift], linesize, bS3, qp, a, b, h, 0); filter_mb_edgev( &img_y[4*2<<pixel_shift], linesize, bS3, qp, a, b, h, 0); filter_mb_edgev( &img_y[4*3<<pixel_shift], linesize, bS3, qp, a, b, h, 0); if(top_type){ filter_mb_edgeh( &img_y[4*0*linesize], linesize, bSH, qp1, a, b, h, 1); } filter_mb_edgeh( &img_y[4*1*linesize], linesize, bS3, qp, a, b, h, 0); filter_mb_edgeh( &img_y[4*2*linesize], linesize, bS3, qp, a, b, h, 0); filter_mb_edgeh( &img_y[4*3*linesize], linesize, bS3, qp, a, b, h, 0); } if(chroma){ if(chroma444){ if(left_type){ filter_mb_edgev( &img_cb[4*0<<pixel_shift], linesize, bS4, qpc0, a, b, h, 1); filter_mb_edgev( &img_cr[4*0<<pixel_shift], linesize, bS4, qpc0, a, b, h, 1); } if( IS_8x8DCT(mb_type) ) { filter_mb_edgev( &img_cb[4*2<<pixel_shift], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgev( &img_cr[4*2<<pixel_shift], linesize, bS3, qpc, a, b, h, 0); if(top_type){ filter_mb_edgeh( &img_cb[4*0*linesize], linesize, bSH, qpc1, a, b, h, 1 ); filter_mb_edgeh( &img_cr[4*0*linesize], linesize, bSH, qpc1, a, b, h, 1 ); } filter_mb_edgeh( &img_cb[4*2*linesize], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgeh( &img_cr[4*2*linesize], linesize, bS3, qpc, a, b, h, 0); } else { filter_mb_edgev( &img_cb[4*1<<pixel_shift], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgev( &img_cr[4*1<<pixel_shift], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgev( &img_cb[4*2<<pixel_shift], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgev( &img_cr[4*2<<pixel_shift], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgev( &img_cb[4*3<<pixel_shift], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgev( &img_cr[4*3<<pixel_shift], linesize, bS3, qpc, a, b, h, 0); if(top_type){ filter_mb_edgeh( &img_cb[4*0*linesize], linesize, bSH, qpc1, a, b, h, 1); filter_mb_edgeh( &img_cr[4*0*linesize], linesize, bSH, qpc1, a, b, h, 1); } filter_mb_edgeh( &img_cb[4*1*linesize], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgeh( &img_cr[4*1*linesize], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgeh( &img_cb[4*2*linesize], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgeh( &img_cr[4*2*linesize], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgeh( &img_cb[4*3*linesize], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgeh( &img_cr[4*3*linesize], linesize, bS3, qpc, a, b, h, 0); } }else if(chroma422){ if(left_type){ filter_mb_edgecv(&img_cb[2*0<<pixel_shift], uvlinesize, bS4, qpc0, a, b, h, 1); filter_mb_edgecv(&img_cr[2*0<<pixel_shift], uvlinesize, bS4, qpc0, a, b, h, 1); } filter_mb_edgecv(&img_cb[2*2<<pixel_shift], uvlinesize, bS3, qpc, a, b, h, 0); filter_mb_edgecv(&img_cr[2*2<<pixel_shift], uvlinesize, bS3, qpc, a, b, h, 0); if(top_type){ filter_mb_edgech(&img_cb[4*0*uvlinesize], uvlinesize, bSH, qpc1, a, b, h, 1); filter_mb_edgech(&img_cr[4*0*uvlinesize], uvlinesize, bSH, qpc1, a, b, h, 1); } filter_mb_edgech(&img_cb[4*1*uvlinesize], uvlinesize, bS3, qpc, a, b, h, 0); filter_mb_edgech(&img_cr[4*1*uvlinesize], uvlinesize, bS3, qpc, a, b, h, 0); filter_mb_edgech(&img_cb[4*2*uvlinesize], uvlinesize, bS3, qpc, a, b, h, 0); filter_mb_edgech(&img_cr[4*2*uvlinesize], uvlinesize, bS3, qpc, a, b, h, 0); filter_mb_edgech(&img_cb[4*3*uvlinesize], uvlinesize, bS3, qpc, a, b, h, 0); filter_mb_edgech(&img_cr[4*3*uvlinesize], uvlinesize, bS3, qpc, a, b, h, 0); }else{ if(left_type){ filter_mb_edgecv( &img_cb[2*0<<pixel_shift], uvlinesize, bS4, qpc0, a, b, h, 1); filter_mb_edgecv( &img_cr[2*0<<pixel_shift], uvlinesize, bS4, qpc0, a, b, h, 1); } filter_mb_edgecv( &img_cb[2*2<<pixel_shift], uvlinesize, bS3, qpc, a, b, h, 0); filter_mb_edgecv( &img_cr[2*2<<pixel_shift], uvlinesize, bS3, qpc, a, b, h, 0); if(top_type){ filter_mb_edgech( &img_cb[2*0*uvlinesize], uvlinesize, bSH, qpc1, a, b, h, 1); filter_mb_edgech( &img_cr[2*0*uvlinesize], uvlinesize, bSH, qpc1, a, b, h, 1); } filter_mb_edgech( &img_cb[2*2*uvlinesize], uvlinesize, bS3, qpc, a, b, h, 0); filter_mb_edgech( &img_cr[2*2*uvlinesize], uvlinesize, bS3, qpc, a, b, h, 0); } } return; } else { LOCAL_ALIGNED_8(int16_t, bS, [2], [4][4]); int edges; if( IS_8x8DCT(mb_type) && (sl->cbp&7) == 7 && !chroma444 ) { edges = 4; AV_WN64A(bS[0][0], 0x0002000200020002ULL); AV_WN64A(bS[0][2], 0x0002000200020002ULL); AV_WN64A(bS[1][0], 0x0002000200020002ULL); AV_WN64A(bS[1][2], 0x0002000200020002ULL); } else { int mask_edge1 = (3*(((5*mb_type)>>5)&1)) | (mb_type>>4); int mask_edge0 = 3*((mask_edge1>>1) & ((5*left_type)>>5)&1); int step = 1+(mb_type>>24); edges = 4 - 3*((mb_type>>3) & !(sl->cbp & 15)); h->h264dsp.h264_loop_filter_strength(bS, sl->non_zero_count_cache, sl->ref_cache, sl->mv_cache, sl->list_count==2, edges, step, mask_edge0, mask_edge1, FIELD_PICTURE(h)); } if( IS_INTRA(left_type) ) AV_WN64A(bS[0][0], 0x0004000400040004ULL); if( IS_INTRA(top_type) ) AV_WN64A(bS[1][0], FIELD_PICTURE(h) ? 0x0003000300030003ULL : 0x0004000400040004ULL); #define FILTER(hv,dir,edge,intra)\ if(AV_RN64A(bS[dir][edge])) { \ filter_mb_edge##hv( &img_y[4*edge*(dir?linesize:1<<pixel_shift)], linesize, bS[dir][edge], edge ? qp : qp##dir, a, b, h, intra );\ if(chroma){\ if(chroma444){\ filter_mb_edge##hv( &img_cb[4*edge*(dir?linesize:1<<pixel_shift)], linesize, bS[dir][edge], edge ? qpc : qpc##dir, a, b, h, intra );\ filter_mb_edge##hv( &img_cr[4*edge*(dir?linesize:1<<pixel_shift)], linesize, bS[dir][edge], edge ? qpc : qpc##dir, a, b, h, intra );\ } else if(!(edge&1)) {\ filter_mb_edgec##hv( &img_cb[2*edge*(dir?uvlinesize:1<<pixel_shift)], uvlinesize, bS[dir][edge], edge ? qpc : qpc##dir, a, b, h, intra );\ filter_mb_edgec##hv( &img_cr[2*edge*(dir?uvlinesize:1<<pixel_shift)], uvlinesize, bS[dir][edge], edge ? qpc : qpc##dir, a, b, h, intra );\ }\ }\ } if(left_type) FILTER(v,0,0,1); if( edges == 1 ) { if(top_type) FILTER(h,1,0,1); } else if( IS_8x8DCT(mb_type) ) { FILTER(v,0,2,0); if(top_type) FILTER(h,1,0,1); FILTER(h,1,2,0); } else { FILTER(v,0,1,0); FILTER(v,0,2,0); FILTER(v,0,3,0); if(top_type) FILTER(h,1,0,1); FILTER(h,1,1,0); FILTER(h,1,2,0); FILTER(h,1,3,0); } #undef FILTER } }
{ "code": [], "line_no": [] }
static av_always_inline void FUNC_0(const H264Context *h, H264SliceContext *sl, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize, int pixel_shift) { int VAR_0 = !(CONFIG_GRAY && (h->flags & AV_CODEC_FLAG_GRAY)); int VAR_1 = CHROMA444(h); int VAR_2 = CHROMA422(h); int VAR_3 = sl->VAR_3; int VAR_4 = sl->VAR_4[LTOP]; int VAR_5 = sl->VAR_5; int VAR_6 = 6 * (h->sps.bit_depth_luma - 8); int VAR_7 = 52 + sl->slice_alpha_c0_offset - VAR_6; int VAR_8 = 52 + sl->slice_beta_offset - VAR_6; int VAR_9 = h->cur_pic.VAR_9[VAR_3]; int VAR_10 = h->cur_pic.qscale_table[VAR_3]; int VAR_11 = h->cur_pic.qscale_table[VAR_3 - 1]; int VAR_12 = h->cur_pic.qscale_table[sl->top_mb_xy]; int VAR_13 = get_chroma_qp( h, 0, VAR_10 ); int VAR_14 = get_chroma_qp( h, 0, VAR_11 ); int VAR_15 = get_chroma_qp( h, 0, VAR_12 ); VAR_11 = (VAR_10 + VAR_11 + 1) >> 1; VAR_12 = (VAR_10 + VAR_12 + 1) >> 1; VAR_14 = (VAR_13 + VAR_14 + 1) >> 1; VAR_15 = (VAR_13 + VAR_15 + 1) >> 1; if( IS_INTRA(VAR_9) ) { static const int16_t VAR_16[4] = {4,4,4,4}; static const int16_t VAR_17[4] = {3,3,3,3}; const int16_t *VAR_18 = FIELD_PICTURE(h) ? VAR_17 : VAR_16; if(VAR_4) filter_mb_edgev( &img_y[4*0<<pixel_shift], linesize, VAR_16, VAR_11, VAR_7, VAR_8, h, 1); if( IS_8x8DCT(VAR_9) ) { filter_mb_edgev( &img_y[4*2<<pixel_shift], linesize, VAR_17, VAR_10, VAR_7, VAR_8, h, 0); if(VAR_5){ filter_mb_edgeh( &img_y[4*0*linesize], linesize, VAR_18, VAR_12, VAR_7, VAR_8, h, 1); } filter_mb_edgeh( &img_y[4*2*linesize], linesize, VAR_17, VAR_10, VAR_7, VAR_8, h, 0); } else { filter_mb_edgev( &img_y[4*1<<pixel_shift], linesize, VAR_17, VAR_10, VAR_7, VAR_8, h, 0); filter_mb_edgev( &img_y[4*2<<pixel_shift], linesize, VAR_17, VAR_10, VAR_7, VAR_8, h, 0); filter_mb_edgev( &img_y[4*3<<pixel_shift], linesize, VAR_17, VAR_10, VAR_7, VAR_8, h, 0); if(VAR_5){ filter_mb_edgeh( &img_y[4*0*linesize], linesize, VAR_18, VAR_12, VAR_7, VAR_8, h, 1); } filter_mb_edgeh( &img_y[4*1*linesize], linesize, VAR_17, VAR_10, VAR_7, VAR_8, h, 0); filter_mb_edgeh( &img_y[4*2*linesize], linesize, VAR_17, VAR_10, VAR_7, VAR_8, h, 0); filter_mb_edgeh( &img_y[4*3*linesize], linesize, VAR_17, VAR_10, VAR_7, VAR_8, h, 0); } if(VAR_0){ if(VAR_1){ if(VAR_4){ filter_mb_edgev( &img_cb[4*0<<pixel_shift], linesize, VAR_16, VAR_14, VAR_7, VAR_8, h, 1); filter_mb_edgev( &img_cr[4*0<<pixel_shift], linesize, VAR_16, VAR_14, VAR_7, VAR_8, h, 1); } if( IS_8x8DCT(VAR_9) ) { filter_mb_edgev( &img_cb[4*2<<pixel_shift], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0); filter_mb_edgev( &img_cr[4*2<<pixel_shift], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0); if(VAR_5){ filter_mb_edgeh( &img_cb[4*0*linesize], linesize, VAR_18, VAR_15, VAR_7, VAR_8, h, 1 ); filter_mb_edgeh( &img_cr[4*0*linesize], linesize, VAR_18, VAR_15, VAR_7, VAR_8, h, 1 ); } filter_mb_edgeh( &img_cb[4*2*linesize], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0); filter_mb_edgeh( &img_cr[4*2*linesize], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0); } else { filter_mb_edgev( &img_cb[4*1<<pixel_shift], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0); filter_mb_edgev( &img_cr[4*1<<pixel_shift], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0); filter_mb_edgev( &img_cb[4*2<<pixel_shift], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0); filter_mb_edgev( &img_cr[4*2<<pixel_shift], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0); filter_mb_edgev( &img_cb[4*3<<pixel_shift], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0); filter_mb_edgev( &img_cr[4*3<<pixel_shift], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0); if(VAR_5){ filter_mb_edgeh( &img_cb[4*0*linesize], linesize, VAR_18, VAR_15, VAR_7, VAR_8, h, 1); filter_mb_edgeh( &img_cr[4*0*linesize], linesize, VAR_18, VAR_15, VAR_7, VAR_8, h, 1); } filter_mb_edgeh( &img_cb[4*1*linesize], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0); filter_mb_edgeh( &img_cr[4*1*linesize], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0); filter_mb_edgeh( &img_cb[4*2*linesize], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0); filter_mb_edgeh( &img_cr[4*2*linesize], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0); filter_mb_edgeh( &img_cb[4*3*linesize], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0); filter_mb_edgeh( &img_cr[4*3*linesize], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0); } }else if(VAR_2){ if(VAR_4){ filter_mb_edgecv(&img_cb[2*0<<pixel_shift], uvlinesize, VAR_16, VAR_14, VAR_7, VAR_8, h, 1); filter_mb_edgecv(&img_cr[2*0<<pixel_shift], uvlinesize, VAR_16, VAR_14, VAR_7, VAR_8, h, 1); } filter_mb_edgecv(&img_cb[2*2<<pixel_shift], uvlinesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0); filter_mb_edgecv(&img_cr[2*2<<pixel_shift], uvlinesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0); if(VAR_5){ filter_mb_edgech(&img_cb[4*0*uvlinesize], uvlinesize, VAR_18, VAR_15, VAR_7, VAR_8, h, 1); filter_mb_edgech(&img_cr[4*0*uvlinesize], uvlinesize, VAR_18, VAR_15, VAR_7, VAR_8, h, 1); } filter_mb_edgech(&img_cb[4*1*uvlinesize], uvlinesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0); filter_mb_edgech(&img_cr[4*1*uvlinesize], uvlinesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0); filter_mb_edgech(&img_cb[4*2*uvlinesize], uvlinesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0); filter_mb_edgech(&img_cr[4*2*uvlinesize], uvlinesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0); filter_mb_edgech(&img_cb[4*3*uvlinesize], uvlinesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0); filter_mb_edgech(&img_cr[4*3*uvlinesize], uvlinesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0); }else{ if(VAR_4){ filter_mb_edgecv( &img_cb[2*0<<pixel_shift], uvlinesize, VAR_16, VAR_14, VAR_7, VAR_8, h, 1); filter_mb_edgecv( &img_cr[2*0<<pixel_shift], uvlinesize, VAR_16, VAR_14, VAR_7, VAR_8, h, 1); } filter_mb_edgecv( &img_cb[2*2<<pixel_shift], uvlinesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0); filter_mb_edgecv( &img_cr[2*2<<pixel_shift], uvlinesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0); if(VAR_5){ filter_mb_edgech( &img_cb[2*0*uvlinesize], uvlinesize, VAR_18, VAR_15, VAR_7, VAR_8, h, 1); filter_mb_edgech( &img_cr[2*0*uvlinesize], uvlinesize, VAR_18, VAR_15, VAR_7, VAR_8, h, 1); } filter_mb_edgech( &img_cb[2*2*uvlinesize], uvlinesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0); filter_mb_edgech( &img_cr[2*2*uvlinesize], uvlinesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0); } } return; } else { LOCAL_ALIGNED_8(int16_t, bS, [2], [4][4]); int VAR_19; if( IS_8x8DCT(VAR_9) && (sl->cbp&7) == 7 && !VAR_1 ) { VAR_19 = 4; AV_WN64A(bS[0][0], 0x0002000200020002ULL); AV_WN64A(bS[0][2], 0x0002000200020002ULL); AV_WN64A(bS[1][0], 0x0002000200020002ULL); AV_WN64A(bS[1][2], 0x0002000200020002ULL); } else { int VAR_20 = (3*(((5*VAR_9)>>5)&1)) | (VAR_9>>4); int VAR_21 = 3*((VAR_20>>1) & ((5*VAR_4)>>5)&1); int VAR_22 = 1+(VAR_9>>24); VAR_19 = 4 - 3*((VAR_9>>3) & !(sl->cbp & 15)); h->h264dsp.h264_loop_filter_strength(bS, sl->non_zero_count_cache, sl->ref_cache, sl->mv_cache, sl->list_count==2, VAR_19, VAR_22, VAR_21, VAR_20, FIELD_PICTURE(h)); } if( IS_INTRA(VAR_4) ) AV_WN64A(bS[0][0], 0x0004000400040004ULL); if( IS_INTRA(VAR_5) ) AV_WN64A(bS[1][0], FIELD_PICTURE(h) ? 0x0003000300030003ULL : 0x0004000400040004ULL); #define FILTER(hv,dir,edge,intra)\ if(AV_RN64A(bS[dir][edge])) { \ filter_mb_edge##hv( &img_y[4*edge*(dir?linesize:1<<pixel_shift)], linesize, bS[dir][edge], edge ? VAR_10 : VAR_10##dir, VAR_7, VAR_8, h, intra );\ if(VAR_0){\ if(VAR_1){\ filter_mb_edge##hv( &img_cb[4*edge*(dir?linesize:1<<pixel_shift)], linesize, bS[dir][edge], edge ? VAR_13 : VAR_13##dir, VAR_7, VAR_8, h, intra );\ filter_mb_edge##hv( &img_cr[4*edge*(dir?linesize:1<<pixel_shift)], linesize, bS[dir][edge], edge ? VAR_13 : VAR_13##dir, VAR_7, VAR_8, h, intra );\ } else if(!(edge&1)) {\ filter_mb_edgec##hv( &img_cb[2*edge*(dir?uvlinesize:1<<pixel_shift)], uvlinesize, bS[dir][edge], edge ? VAR_13 : VAR_13##dir, VAR_7, VAR_8, h, intra );\ filter_mb_edgec##hv( &img_cr[2*edge*(dir?uvlinesize:1<<pixel_shift)], uvlinesize, bS[dir][edge], edge ? VAR_13 : VAR_13##dir, VAR_7, VAR_8, h, intra );\ }\ }\ } if(VAR_4) FILTER(v,0,0,1); if( VAR_19 == 1 ) { if(VAR_5) FILTER(h,1,0,1); } else if( IS_8x8DCT(VAR_9) ) { FILTER(v,0,2,0); if(VAR_5) FILTER(h,1,0,1); FILTER(h,1,2,0); } else { FILTER(v,0,1,0); FILTER(v,0,2,0); FILTER(v,0,3,0); if(VAR_5) FILTER(h,1,0,1); FILTER(h,1,1,0); FILTER(h,1,2,0); FILTER(h,1,3,0); } #undef FILTER } }
[ "static av_always_inline void FUNC_0(const H264Context *h,\nH264SliceContext *sl,\nint mb_x, int mb_y,\nuint8_t *img_y,\nuint8_t *img_cb,\nuint8_t *img_cr,\nunsigned int linesize,\nunsigned int uvlinesize,\nint pixel_shift)\n{", "int VAR_0 = !(CONFIG_GRAY && (h->flags & AV_CODEC_FLAG_GRAY));", "int VAR_1 = CHROMA444(h);", "int VAR_2 = CHROMA422(h);", "int VAR_3 = sl->VAR_3;", "int VAR_4 = sl->VAR_4[LTOP];", "int VAR_5 = sl->VAR_5;", "int VAR_6 = 6 * (h->sps.bit_depth_luma - 8);", "int VAR_7 = 52 + sl->slice_alpha_c0_offset - VAR_6;", "int VAR_8 = 52 + sl->slice_beta_offset - VAR_6;", "int VAR_9 = h->cur_pic.VAR_9[VAR_3];", "int VAR_10 = h->cur_pic.qscale_table[VAR_3];", "int VAR_11 = h->cur_pic.qscale_table[VAR_3 - 1];", "int VAR_12 = h->cur_pic.qscale_table[sl->top_mb_xy];", "int VAR_13 = get_chroma_qp( h, 0, VAR_10 );", "int VAR_14 = get_chroma_qp( h, 0, VAR_11 );", "int VAR_15 = get_chroma_qp( h, 0, VAR_12 );", "VAR_11 = (VAR_10 + VAR_11 + 1) >> 1;", "VAR_12 = (VAR_10 + VAR_12 + 1) >> 1;", "VAR_14 = (VAR_13 + VAR_14 + 1) >> 1;", "VAR_15 = (VAR_13 + VAR_15 + 1) >> 1;", "if( IS_INTRA(VAR_9) ) {", "static const int16_t VAR_16[4] = {4,4,4,4};", "static const int16_t VAR_17[4] = {3,3,3,3};", "const int16_t *VAR_18 = FIELD_PICTURE(h) ? VAR_17 : VAR_16;", "if(VAR_4)\nfilter_mb_edgev( &img_y[4*0<<pixel_shift], linesize, VAR_16, VAR_11, VAR_7, VAR_8, h, 1);", "if( IS_8x8DCT(VAR_9) ) {", "filter_mb_edgev( &img_y[4*2<<pixel_shift], linesize, VAR_17, VAR_10, VAR_7, VAR_8, h, 0);", "if(VAR_5){", "filter_mb_edgeh( &img_y[4*0*linesize], linesize, VAR_18, VAR_12, VAR_7, VAR_8, h, 1);", "}", "filter_mb_edgeh( &img_y[4*2*linesize], linesize, VAR_17, VAR_10, VAR_7, VAR_8, h, 0);", "} else {", "filter_mb_edgev( &img_y[4*1<<pixel_shift], linesize, VAR_17, VAR_10, VAR_7, VAR_8, h, 0);", "filter_mb_edgev( &img_y[4*2<<pixel_shift], linesize, VAR_17, VAR_10, VAR_7, VAR_8, h, 0);", "filter_mb_edgev( &img_y[4*3<<pixel_shift], linesize, VAR_17, VAR_10, VAR_7, VAR_8, h, 0);", "if(VAR_5){", "filter_mb_edgeh( &img_y[4*0*linesize], linesize, VAR_18, VAR_12, VAR_7, VAR_8, h, 1);", "}", "filter_mb_edgeh( &img_y[4*1*linesize], linesize, VAR_17, VAR_10, VAR_7, VAR_8, h, 0);", "filter_mb_edgeh( &img_y[4*2*linesize], linesize, VAR_17, VAR_10, VAR_7, VAR_8, h, 0);", "filter_mb_edgeh( &img_y[4*3*linesize], linesize, VAR_17, VAR_10, VAR_7, VAR_8, h, 0);", "}", "if(VAR_0){", "if(VAR_1){", "if(VAR_4){", "filter_mb_edgev( &img_cb[4*0<<pixel_shift], linesize, VAR_16, VAR_14, VAR_7, VAR_8, h, 1);", "filter_mb_edgev( &img_cr[4*0<<pixel_shift], linesize, VAR_16, VAR_14, VAR_7, VAR_8, h, 1);", "}", "if( IS_8x8DCT(VAR_9) ) {", "filter_mb_edgev( &img_cb[4*2<<pixel_shift], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0);", "filter_mb_edgev( &img_cr[4*2<<pixel_shift], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0);", "if(VAR_5){", "filter_mb_edgeh( &img_cb[4*0*linesize], linesize, VAR_18, VAR_15, VAR_7, VAR_8, h, 1 );", "filter_mb_edgeh( &img_cr[4*0*linesize], linesize, VAR_18, VAR_15, VAR_7, VAR_8, h, 1 );", "}", "filter_mb_edgeh( &img_cb[4*2*linesize], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0);", "filter_mb_edgeh( &img_cr[4*2*linesize], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0);", "} else {", "filter_mb_edgev( &img_cb[4*1<<pixel_shift], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0);", "filter_mb_edgev( &img_cr[4*1<<pixel_shift], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0);", "filter_mb_edgev( &img_cb[4*2<<pixel_shift], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0);", "filter_mb_edgev( &img_cr[4*2<<pixel_shift], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0);", "filter_mb_edgev( &img_cb[4*3<<pixel_shift], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0);", "filter_mb_edgev( &img_cr[4*3<<pixel_shift], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0);", "if(VAR_5){", "filter_mb_edgeh( &img_cb[4*0*linesize], linesize, VAR_18, VAR_15, VAR_7, VAR_8, h, 1);", "filter_mb_edgeh( &img_cr[4*0*linesize], linesize, VAR_18, VAR_15, VAR_7, VAR_8, h, 1);", "}", "filter_mb_edgeh( &img_cb[4*1*linesize], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0);", "filter_mb_edgeh( &img_cr[4*1*linesize], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0);", "filter_mb_edgeh( &img_cb[4*2*linesize], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0);", "filter_mb_edgeh( &img_cr[4*2*linesize], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0);", "filter_mb_edgeh( &img_cb[4*3*linesize], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0);", "filter_mb_edgeh( &img_cr[4*3*linesize], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0);", "}", "}else if(VAR_2){", "if(VAR_4){", "filter_mb_edgecv(&img_cb[2*0<<pixel_shift], uvlinesize, VAR_16, VAR_14, VAR_7, VAR_8, h, 1);", "filter_mb_edgecv(&img_cr[2*0<<pixel_shift], uvlinesize, VAR_16, VAR_14, VAR_7, VAR_8, h, 1);", "}", "filter_mb_edgecv(&img_cb[2*2<<pixel_shift], uvlinesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0);", "filter_mb_edgecv(&img_cr[2*2<<pixel_shift], uvlinesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0);", "if(VAR_5){", "filter_mb_edgech(&img_cb[4*0*uvlinesize], uvlinesize, VAR_18, VAR_15, VAR_7, VAR_8, h, 1);", "filter_mb_edgech(&img_cr[4*0*uvlinesize], uvlinesize, VAR_18, VAR_15, VAR_7, VAR_8, h, 1);", "}", "filter_mb_edgech(&img_cb[4*1*uvlinesize], uvlinesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0);", "filter_mb_edgech(&img_cr[4*1*uvlinesize], uvlinesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0);", "filter_mb_edgech(&img_cb[4*2*uvlinesize], uvlinesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0);", "filter_mb_edgech(&img_cr[4*2*uvlinesize], uvlinesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0);", "filter_mb_edgech(&img_cb[4*3*uvlinesize], uvlinesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0);", "filter_mb_edgech(&img_cr[4*3*uvlinesize], uvlinesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0);", "}else{", "if(VAR_4){", "filter_mb_edgecv( &img_cb[2*0<<pixel_shift], uvlinesize, VAR_16, VAR_14, VAR_7, VAR_8, h, 1);", "filter_mb_edgecv( &img_cr[2*0<<pixel_shift], uvlinesize, VAR_16, VAR_14, VAR_7, VAR_8, h, 1);", "}", "filter_mb_edgecv( &img_cb[2*2<<pixel_shift], uvlinesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0);", "filter_mb_edgecv( &img_cr[2*2<<pixel_shift], uvlinesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0);", "if(VAR_5){", "filter_mb_edgech( &img_cb[2*0*uvlinesize], uvlinesize, VAR_18, VAR_15, VAR_7, VAR_8, h, 1);", "filter_mb_edgech( &img_cr[2*0*uvlinesize], uvlinesize, VAR_18, VAR_15, VAR_7, VAR_8, h, 1);", "}", "filter_mb_edgech( &img_cb[2*2*uvlinesize], uvlinesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0);", "filter_mb_edgech( &img_cr[2*2*uvlinesize], uvlinesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0);", "}", "}", "return;", "} else {", "LOCAL_ALIGNED_8(int16_t, bS, [2], [4][4]);", "int VAR_19;", "if( IS_8x8DCT(VAR_9) && (sl->cbp&7) == 7 && !VAR_1 ) {", "VAR_19 = 4;", "AV_WN64A(bS[0][0], 0x0002000200020002ULL);", "AV_WN64A(bS[0][2], 0x0002000200020002ULL);", "AV_WN64A(bS[1][0], 0x0002000200020002ULL);", "AV_WN64A(bS[1][2], 0x0002000200020002ULL);", "} else {", "int VAR_20 = (3*(((5*VAR_9)>>5)&1)) | (VAR_9>>4);", "int VAR_21 = 3*((VAR_20>>1) & ((5*VAR_4)>>5)&1);", "int VAR_22 = 1+(VAR_9>>24);", "VAR_19 = 4 - 3*((VAR_9>>3) & !(sl->cbp & 15));", "h->h264dsp.h264_loop_filter_strength(bS, sl->non_zero_count_cache, sl->ref_cache, sl->mv_cache,\nsl->list_count==2, VAR_19, VAR_22, VAR_21, VAR_20, FIELD_PICTURE(h));", "}", "if( IS_INTRA(VAR_4) )\nAV_WN64A(bS[0][0], 0x0004000400040004ULL);", "if( IS_INTRA(VAR_5) )\nAV_WN64A(bS[1][0], FIELD_PICTURE(h) ? 0x0003000300030003ULL : 0x0004000400040004ULL);", "#define FILTER(hv,dir,edge,intra)\\\nif(AV_RN64A(bS[dir][edge])) { \\", "filter_mb_edge##hv( &img_y[4*edge*(dir?linesize:1<<pixel_shift)], linesize, bS[dir][edge], edge ? VAR_10 : VAR_10##dir, VAR_7, VAR_8, h, intra );\\", "if(VAR_0){\\", "if(VAR_1){\\", "filter_mb_edge##hv( &img_cb[4*edge*(dir?linesize:1<<pixel_shift)], linesize, bS[dir][edge], edge ? VAR_13 : VAR_13##dir, VAR_7, VAR_8, h, intra );\\", "filter_mb_edge##hv( &img_cr[4*edge*(dir?linesize:1<<pixel_shift)], linesize, bS[dir][edge], edge ? VAR_13 : VAR_13##dir, VAR_7, VAR_8, h, intra );\\", "} else if(!(edge&1)) {\\", "filter_mb_edgec##hv( &img_cb[2*edge*(dir?uvlinesize:1<<pixel_shift)], uvlinesize, bS[dir][edge], edge ? VAR_13 : VAR_13##dir, VAR_7, VAR_8, h, intra );\\", "filter_mb_edgec##hv( &img_cr[2*edge*(dir?uvlinesize:1<<pixel_shift)], uvlinesize, bS[dir][edge], edge ? VAR_13 : VAR_13##dir, VAR_7, VAR_8, h, intra );\\", "}\\", "}\\", "}", "if(VAR_4)\nFILTER(v,0,0,1);", "if( VAR_19 == 1 ) {", "if(VAR_5)\nFILTER(h,1,0,1);", "} else if( IS_8x8DCT(VAR_9) ) {", "FILTER(v,0,2,0);", "if(VAR_5)\nFILTER(h,1,0,1);", "FILTER(h,1,2,0);", "} else {", "FILTER(v,0,1,0);", "FILTER(v,0,2,0);", "FILTER(v,0,3,0);", "if(VAR_5)\nFILTER(h,1,0,1);", "FILTER(h,1,1,0);", "FILTER(h,1,2,0);", "FILTER(h,1,3,0);", "}", "#undef FILTER\n}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77, 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275, 277 ], [ 279 ], [ 281, 283 ], [ 285, 287 ], [ 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, 359 ], [ 361 ] ]
12,662
static int asf_read_frame_header(AVFormatContext *s, AVIOContext *pb){ ASFContext *asf = s->priv_data; ASFStream *asfst; int rsize = 1; int num = avio_r8(pb); int i; int64_t ts0, ts1 av_unused; asf->packet_segments--; asf->packet_key_frame = num >> 7; asf->stream_index = asf->asfid2avid[num & 0x7f]; asfst = &asf->streams[num & 0x7f]; // sequence should be ignored! DO_2BITS(asf->packet_property >> 4, asf->packet_seq, 0); DO_2BITS(asf->packet_property >> 2, asf->packet_frag_offset, 0); DO_2BITS(asf->packet_property, asf->packet_replic_size, 0); av_dlog(asf, "key:%d stream:%d seq:%d offset:%d replic_size:%d\n", asf->packet_key_frame, asf->stream_index, asf->packet_seq, asf->packet_frag_offset, asf->packet_replic_size); if (rsize+asf->packet_replic_size > asf->packet_size_left) { av_log(s, AV_LOG_ERROR, "packet_replic_size %d is invalid\n", asf->packet_replic_size); return AVERROR_INVALIDDATA; } if (asf->packet_replic_size >= 8) { int64_t end = avio_tell(pb) + asf->packet_replic_size; AVRational aspect; asf->packet_obj_size = avio_rl32(pb); if(asf->packet_obj_size >= (1<<24) || asf->packet_obj_size <= 0){ av_log(s, AV_LOG_ERROR, "packet_obj_size invalid\n"); return AVERROR_INVALIDDATA; } asf->packet_frag_timestamp = avio_rl32(pb); // timestamp for (i=0; i<asfst->payload_ext_ct; i++) { ASFPayload *p = &asfst->payload[i]; int size = p->size; int64_t payend; if(size == 0xFFFF) size = avio_rl16(pb); payend = avio_tell(pb) + size; if (payend > end) { av_log(s, AV_LOG_ERROR, "too long payload\n"); break; } switch(p->type) { case 0x50: // duration = avio_rl16(pb); break; case 0x54: aspect.num = avio_r8(pb); aspect.den = avio_r8(pb); if (aspect.num > 0 && aspect.den > 0) { s->streams[asf->stream_index]->sample_aspect_ratio = aspect; } break; case 0x2A: avio_skip(pb, 8); ts0= avio_rl64(pb); ts1= avio_rl64(pb); if(ts0!= -1) asf->packet_frag_timestamp= ts0/10000; else asf->packet_frag_timestamp= AV_NOPTS_VALUE; break; case 0x5B: case 0xB7: case 0xCC: case 0xC0: case 0xA0: //unknown break; } avio_seek(pb, payend, SEEK_SET); } avio_seek(pb, end, SEEK_SET); rsize += asf->packet_replic_size; // FIXME - check validity } else if (asf->packet_replic_size==1){ // multipacket - frag_offset is beginning timestamp asf->packet_time_start = asf->packet_frag_offset; asf->packet_frag_offset = 0; asf->packet_frag_timestamp = asf->packet_timestamp; asf->packet_time_delta = avio_r8(pb); rsize++; }else if(asf->packet_replic_size!=0){ av_log(s, AV_LOG_ERROR, "unexpected packet_replic_size of %d\n", asf->packet_replic_size); return AVERROR_INVALIDDATA; } if (asf->packet_flags & 0x01) { DO_2BITS(asf->packet_segsizetype >> 6, asf->packet_frag_size, 0); // 0 is illegal if (rsize > asf->packet_size_left) { av_log(s, AV_LOG_ERROR, "packet_replic_size is invalid\n"); return AVERROR_INVALIDDATA; } else if(asf->packet_frag_size > asf->packet_size_left - rsize){ if (asf->packet_frag_size > asf->packet_size_left - rsize + asf->packet_padsize) { av_log(s, AV_LOG_ERROR, "packet_frag_size is invalid (%d-%d)\n", asf->packet_size_left, rsize); return AVERROR_INVALIDDATA; } else { int diff = asf->packet_frag_size - (asf->packet_size_left - rsize); asf->packet_size_left += diff; asf->packet_padsize -= diff; } } } else { asf->packet_frag_size = asf->packet_size_left - rsize; } if (asf->packet_replic_size == 1) { asf->packet_multi_size = asf->packet_frag_size; if (asf->packet_multi_size > asf->packet_size_left) return AVERROR_INVALIDDATA; } asf->packet_size_left -= rsize; return 0; }
false
FFmpeg
b7280cff9a7683395d7f899517b4aea8b52f12a4
static int asf_read_frame_header(AVFormatContext *s, AVIOContext *pb){ ASFContext *asf = s->priv_data; ASFStream *asfst; int rsize = 1; int num = avio_r8(pb); int i; int64_t ts0, ts1 av_unused; asf->packet_segments--; asf->packet_key_frame = num >> 7; asf->stream_index = asf->asfid2avid[num & 0x7f]; asfst = &asf->streams[num & 0x7f]; DO_2BITS(asf->packet_property >> 4, asf->packet_seq, 0); DO_2BITS(asf->packet_property >> 2, asf->packet_frag_offset, 0); DO_2BITS(asf->packet_property, asf->packet_replic_size, 0); av_dlog(asf, "key:%d stream:%d seq:%d offset:%d replic_size:%d\n", asf->packet_key_frame, asf->stream_index, asf->packet_seq, asf->packet_frag_offset, asf->packet_replic_size); if (rsize+asf->packet_replic_size > asf->packet_size_left) { av_log(s, AV_LOG_ERROR, "packet_replic_size %d is invalid\n", asf->packet_replic_size); return AVERROR_INVALIDDATA; } if (asf->packet_replic_size >= 8) { int64_t end = avio_tell(pb) + asf->packet_replic_size; AVRational aspect; asf->packet_obj_size = avio_rl32(pb); if(asf->packet_obj_size >= (1<<24) || asf->packet_obj_size <= 0){ av_log(s, AV_LOG_ERROR, "packet_obj_size invalid\n"); return AVERROR_INVALIDDATA; } asf->packet_frag_timestamp = avio_rl32(pb); for (i=0; i<asfst->payload_ext_ct; i++) { ASFPayload *p = &asfst->payload[i]; int size = p->size; int64_t payend; if(size == 0xFFFF) size = avio_rl16(pb); payend = avio_tell(pb) + size; if (payend > end) { av_log(s, AV_LOG_ERROR, "too long payload\n"); break; } switch(p->type) { case 0x50: break; case 0x54: aspect.num = avio_r8(pb); aspect.den = avio_r8(pb); if (aspect.num > 0 && aspect.den > 0) { s->streams[asf->stream_index]->sample_aspect_ratio = aspect; } break; case 0x2A: avio_skip(pb, 8); ts0= avio_rl64(pb); ts1= avio_rl64(pb); if(ts0!= -1) asf->packet_frag_timestamp= ts0/10000; else asf->packet_frag_timestamp= AV_NOPTS_VALUE; break; case 0x5B: case 0xB7: case 0xCC: case 0xC0: case 0xA0: break; } avio_seek(pb, payend, SEEK_SET); } avio_seek(pb, end, SEEK_SET); rsize += asf->packet_replic_size; } else if (asf->packet_replic_size==1){ asf->packet_time_start = asf->packet_frag_offset; asf->packet_frag_offset = 0; asf->packet_frag_timestamp = asf->packet_timestamp; asf->packet_time_delta = avio_r8(pb); rsize++; }else if(asf->packet_replic_size!=0){ av_log(s, AV_LOG_ERROR, "unexpected packet_replic_size of %d\n", asf->packet_replic_size); return AVERROR_INVALIDDATA; } if (asf->packet_flags & 0x01) { DO_2BITS(asf->packet_segsizetype >> 6, asf->packet_frag_size, 0); if (rsize > asf->packet_size_left) { av_log(s, AV_LOG_ERROR, "packet_replic_size is invalid\n"); return AVERROR_INVALIDDATA; } else if(asf->packet_frag_size > asf->packet_size_left - rsize){ if (asf->packet_frag_size > asf->packet_size_left - rsize + asf->packet_padsize) { av_log(s, AV_LOG_ERROR, "packet_frag_size is invalid (%d-%d)\n", asf->packet_size_left, rsize); return AVERROR_INVALIDDATA; } else { int diff = asf->packet_frag_size - (asf->packet_size_left - rsize); asf->packet_size_left += diff; asf->packet_padsize -= diff; } } } else { asf->packet_frag_size = asf->packet_size_left - rsize; } if (asf->packet_replic_size == 1) { asf->packet_multi_size = asf->packet_frag_size; if (asf->packet_multi_size > asf->packet_size_left) return AVERROR_INVALIDDATA; } asf->packet_size_left -= rsize; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0, AVIOContext *VAR_1){ ASFContext *asf = VAR_0->priv_data; ASFStream *asfst; int VAR_2 = 1; int VAR_3 = avio_r8(VAR_1); int VAR_4; int64_t ts0, ts1 av_unused; asf->packet_segments--; asf->packet_key_frame = VAR_3 >> 7; asf->stream_index = asf->asfid2avid[VAR_3 & 0x7f]; asfst = &asf->streams[VAR_3 & 0x7f]; DO_2BITS(asf->packet_property >> 4, asf->packet_seq, 0); DO_2BITS(asf->packet_property >> 2, asf->packet_frag_offset, 0); DO_2BITS(asf->packet_property, asf->packet_replic_size, 0); av_dlog(asf, "key:%d stream:%d seq:%d offset:%d replic_size:%d\n", asf->packet_key_frame, asf->stream_index, asf->packet_seq, asf->packet_frag_offset, asf->packet_replic_size); if (VAR_2+asf->packet_replic_size > asf->packet_size_left) { av_log(VAR_0, AV_LOG_ERROR, "packet_replic_size %d is invalid\n", asf->packet_replic_size); return AVERROR_INVALIDDATA; } if (asf->packet_replic_size >= 8) { int64_t end = avio_tell(VAR_1) + asf->packet_replic_size; AVRational aspect; asf->packet_obj_size = avio_rl32(VAR_1); if(asf->packet_obj_size >= (1<<24) || asf->packet_obj_size <= 0){ av_log(VAR_0, AV_LOG_ERROR, "packet_obj_size invalid\n"); return AVERROR_INVALIDDATA; } asf->packet_frag_timestamp = avio_rl32(VAR_1); for (VAR_4=0; VAR_4<asfst->payload_ext_ct; VAR_4++) { ASFPayload *p = &asfst->payload[VAR_4]; int size = p->size; int64_t payend; if(size == 0xFFFF) size = avio_rl16(VAR_1); payend = avio_tell(VAR_1) + size; if (payend > end) { av_log(VAR_0, AV_LOG_ERROR, "too long payload\n"); break; } switch(p->type) { case 0x50: break; case 0x54: aspect.VAR_3 = avio_r8(VAR_1); aspect.den = avio_r8(VAR_1); if (aspect.VAR_3 > 0 && aspect.den > 0) { VAR_0->streams[asf->stream_index]->sample_aspect_ratio = aspect; } break; case 0x2A: avio_skip(VAR_1, 8); ts0= avio_rl64(VAR_1); ts1= avio_rl64(VAR_1); if(ts0!= -1) asf->packet_frag_timestamp= ts0/10000; else asf->packet_frag_timestamp= AV_NOPTS_VALUE; break; case 0x5B: case 0xB7: case 0xCC: case 0xC0: case 0xA0: break; } avio_seek(VAR_1, payend, SEEK_SET); } avio_seek(VAR_1, end, SEEK_SET); VAR_2 += asf->packet_replic_size; } else if (asf->packet_replic_size==1){ asf->packet_time_start = asf->packet_frag_offset; asf->packet_frag_offset = 0; asf->packet_frag_timestamp = asf->packet_timestamp; asf->packet_time_delta = avio_r8(VAR_1); VAR_2++; }else if(asf->packet_replic_size!=0){ av_log(VAR_0, AV_LOG_ERROR, "unexpected packet_replic_size of %d\n", asf->packet_replic_size); return AVERROR_INVALIDDATA; } if (asf->packet_flags & 0x01) { DO_2BITS(asf->packet_segsizetype >> 6, asf->packet_frag_size, 0); if (VAR_2 > asf->packet_size_left) { av_log(VAR_0, AV_LOG_ERROR, "packet_replic_size is invalid\n"); return AVERROR_INVALIDDATA; } else if(asf->packet_frag_size > asf->packet_size_left - VAR_2){ if (asf->packet_frag_size > asf->packet_size_left - VAR_2 + asf->packet_padsize) { av_log(VAR_0, AV_LOG_ERROR, "packet_frag_size is invalid (%d-%d)\n", asf->packet_size_left, VAR_2); return AVERROR_INVALIDDATA; } else { int VAR_5 = asf->packet_frag_size - (asf->packet_size_left - VAR_2); asf->packet_size_left += VAR_5; asf->packet_padsize -= VAR_5; } } } else { asf->packet_frag_size = asf->packet_size_left - VAR_2; } if (asf->packet_replic_size == 1) { asf->packet_multi_size = asf->packet_frag_size; if (asf->packet_multi_size > asf->packet_size_left) return AVERROR_INVALIDDATA; } asf->packet_size_left -= VAR_2; return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0, AVIOContext *VAR_1){", "ASFContext *asf = VAR_0->priv_data;", "ASFStream *asfst;", "int VAR_2 = 1;", "int VAR_3 = avio_r8(VAR_1);", "int VAR_4;", "int64_t ts0, ts1 av_unused;", "asf->packet_segments--;", "asf->packet_key_frame = VAR_3 >> 7;", "asf->stream_index = asf->asfid2avid[VAR_3 & 0x7f];", "asfst = &asf->streams[VAR_3 & 0x7f];", "DO_2BITS(asf->packet_property >> 4, asf->packet_seq, 0);", "DO_2BITS(asf->packet_property >> 2, asf->packet_frag_offset, 0);", "DO_2BITS(asf->packet_property, asf->packet_replic_size, 0);", "av_dlog(asf, \"key:%d stream:%d seq:%d offset:%d replic_size:%d\\n\",\nasf->packet_key_frame, asf->stream_index, asf->packet_seq,\nasf->packet_frag_offset, asf->packet_replic_size);", "if (VAR_2+asf->packet_replic_size > asf->packet_size_left) {", "av_log(VAR_0, AV_LOG_ERROR, \"packet_replic_size %d is invalid\\n\", asf->packet_replic_size);", "return AVERROR_INVALIDDATA;", "}", "if (asf->packet_replic_size >= 8) {", "int64_t end = avio_tell(VAR_1) + asf->packet_replic_size;", "AVRational aspect;", "asf->packet_obj_size = avio_rl32(VAR_1);", "if(asf->packet_obj_size >= (1<<24) || asf->packet_obj_size <= 0){", "av_log(VAR_0, AV_LOG_ERROR, \"packet_obj_size invalid\\n\");", "return AVERROR_INVALIDDATA;", "}", "asf->packet_frag_timestamp = avio_rl32(VAR_1);", "for (VAR_4=0; VAR_4<asfst->payload_ext_ct; VAR_4++) {", "ASFPayload *p = &asfst->payload[VAR_4];", "int size = p->size;", "int64_t payend;", "if(size == 0xFFFF)\nsize = avio_rl16(VAR_1);", "payend = avio_tell(VAR_1) + size;", "if (payend > end) {", "av_log(VAR_0, AV_LOG_ERROR, \"too long payload\\n\");", "break;", "}", "switch(p->type) {", "case 0x50:\nbreak;", "case 0x54:\naspect.VAR_3 = avio_r8(VAR_1);", "aspect.den = avio_r8(VAR_1);", "if (aspect.VAR_3 > 0 && aspect.den > 0) {", "VAR_0->streams[asf->stream_index]->sample_aspect_ratio = aspect;", "}", "break;", "case 0x2A:\navio_skip(VAR_1, 8);", "ts0= avio_rl64(VAR_1);", "ts1= avio_rl64(VAR_1);", "if(ts0!= -1) asf->packet_frag_timestamp= ts0/10000;", "else asf->packet_frag_timestamp= AV_NOPTS_VALUE;", "break;", "case 0x5B:\ncase 0xB7:\ncase 0xCC:\ncase 0xC0:\ncase 0xA0:\nbreak;", "}", "avio_seek(VAR_1, payend, SEEK_SET);", "}", "avio_seek(VAR_1, end, SEEK_SET);", "VAR_2 += asf->packet_replic_size;", "} else if (asf->packet_replic_size==1){", "asf->packet_time_start = asf->packet_frag_offset;", "asf->packet_frag_offset = 0;", "asf->packet_frag_timestamp = asf->packet_timestamp;", "asf->packet_time_delta = avio_r8(VAR_1);", "VAR_2++;", "}else if(asf->packet_replic_size!=0){", "av_log(VAR_0, AV_LOG_ERROR, \"unexpected packet_replic_size of %d\\n\", asf->packet_replic_size);", "return AVERROR_INVALIDDATA;", "}", "if (asf->packet_flags & 0x01) {", "DO_2BITS(asf->packet_segsizetype >> 6, asf->packet_frag_size, 0);", "if (VAR_2 > asf->packet_size_left) {", "av_log(VAR_0, AV_LOG_ERROR, \"packet_replic_size is invalid\\n\");", "return AVERROR_INVALIDDATA;", "} else if(asf->packet_frag_size > asf->packet_size_left - VAR_2){", "if (asf->packet_frag_size > asf->packet_size_left - VAR_2 + asf->packet_padsize) {", "av_log(VAR_0, AV_LOG_ERROR, \"packet_frag_size is invalid (%d-%d)\\n\", asf->packet_size_left, VAR_2);", "return AVERROR_INVALIDDATA;", "} else {", "int VAR_5 = asf->packet_frag_size - (asf->packet_size_left - VAR_2);", "asf->packet_size_left += VAR_5;", "asf->packet_padsize -= VAR_5;", "}", "}", "} else {", "asf->packet_frag_size = asf->packet_size_left - VAR_2;", "}", "if (asf->packet_replic_size == 1) {", "asf->packet_multi_size = asf->packet_frag_size;", "if (asf->packet_multi_size > asf->packet_size_left)\nreturn AVERROR_INVALIDDATA;", "}", "asf->packet_size_left -= 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 31 ], [ 33, 35, 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75, 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91, 95 ], [ 97, 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111, 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125, 127, 129, 131, 133, 137 ], [ 139 ], [ 141 ], [ 143 ], [ 147 ], [ 149 ], [ 151 ], [ 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 ], [ 209 ], [ 211 ], [ 213 ], [ 215, 217 ], [ 219 ], [ 221 ], [ 225 ], [ 227 ] ]
12,665
void HELPER(set_r13_banked)(CPUState *env, uint32_t mode, uint32_t val) { env->banked_r13[bank_number(mode)] = val; }
false
qemu
39ea3d4eaf1ff300ee55946108394729bc053dfa
void HELPER(set_r13_banked)(CPUState *env, uint32_t mode, uint32_t val) { env->banked_r13[bank_number(mode)] = val; }
{ "code": [], "line_no": [] }
void FUNC_0(set_r13_banked)(CPUState *env, uint32_t mode, uint32_t val) { env->banked_r13[bank_number(mode)] = val; }
[ "void FUNC_0(set_r13_banked)(CPUState *env, uint32_t mode, uint32_t val)\n{", "env->banked_r13[bank_number(mode)] = val;", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
12,669
static int query_formats(AVFilterContext *ctx) { static const enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_GRAY8, AV_PIX_FMT_YUV410P, AV_PIX_FMT_YUV411P, AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV440P, AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ440P, AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUVJ411P, AV_PIX_FMT_YUVA444P, AV_PIX_FMT_YUVA422P, AV_PIX_FMT_YUVA420P, AV_PIX_FMT_NONE }; AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); if (!fmts_list) return AVERROR(ENOMEM); ff_set_common_formats(ctx, fmts_list); return 0; }
false
FFmpeg
a0560d0477549eaaa7d002e013bd8376e80873e4
static int query_formats(AVFilterContext *ctx) { static const enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_GRAY8, AV_PIX_FMT_YUV410P, AV_PIX_FMT_YUV411P, AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV440P, AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ440P, AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUVJ411P, AV_PIX_FMT_YUVA444P, AV_PIX_FMT_YUVA422P, AV_PIX_FMT_YUVA420P, AV_PIX_FMT_NONE }; AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); if (!fmts_list) return AVERROR(ENOMEM); ff_set_common_formats(ctx, fmts_list); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFilterContext *VAR_0) { static const enum AVPixelFormat VAR_1[] = { AV_PIX_FMT_GRAY8, AV_PIX_FMT_YUV410P, AV_PIX_FMT_YUV411P, AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV440P, AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ440P, AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUVJ411P, AV_PIX_FMT_YUVA444P, AV_PIX_FMT_YUVA422P, AV_PIX_FMT_YUVA420P, AV_PIX_FMT_NONE }; AVFilterFormats *fmts_list = ff_make_format_list(VAR_1); if (!fmts_list) return AVERROR(ENOMEM); ff_set_common_formats(VAR_0, fmts_list); return 0; }
[ "static int FUNC_0(AVFilterContext *VAR_0)\n{", "static const enum AVPixelFormat VAR_1[] = {", "AV_PIX_FMT_GRAY8,\nAV_PIX_FMT_YUV410P, AV_PIX_FMT_YUV411P,\nAV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P,\nAV_PIX_FMT_YUV440P, AV_PIX_FMT_YUV444P,\nAV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P,\nAV_PIX_FMT_YUVJ440P, AV_PIX_FMT_YUVJ444P,\nAV_PIX_FMT_YUVJ411P,\nAV_PIX_FMT_YUVA444P, AV_PIX_FMT_YUVA422P, AV_PIX_FMT_YUVA420P,\nAV_PIX_FMT_NONE\n};", "AVFilterFormats *fmts_list = ff_make_format_list(VAR_1);", "if (!fmts_list)\nreturn AVERROR(ENOMEM);", "ff_set_common_formats(VAR_0, fmts_list);", "return 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 ] ]
12,670
static void monitor_call_handler(Monitor *mon, const mon_cmd_t *cmd, const QDict *params) { QObject *data = NULL; cmd->mhandler.cmd_new(mon, params, &data); if (data) cmd->user_print(mon, data); qobject_decref(data); }
false
qemu
25b422eb4051b9b7473feea1ae848f1e3b4f799f
static void monitor_call_handler(Monitor *mon, const mon_cmd_t *cmd, const QDict *params) { QObject *data = NULL; cmd->mhandler.cmd_new(mon, params, &data); if (data) cmd->user_print(mon, data); qobject_decref(data); }
{ "code": [], "line_no": [] }
static void FUNC_0(Monitor *VAR_0, const mon_cmd_t *VAR_1, const QDict *VAR_2) { QObject *data = NULL; VAR_1->mhandler.cmd_new(VAR_0, VAR_2, &data); if (data) VAR_1->user_print(VAR_0, data); qobject_decref(data); }
[ "static void FUNC_0(Monitor *VAR_0, const mon_cmd_t *VAR_1,\nconst QDict *VAR_2)\n{", "QObject *data = NULL;", "VAR_1->mhandler.cmd_new(VAR_0, VAR_2, &data);", "if (data)\nVAR_1->user_print(VAR_0, data);", "qobject_decref(data);", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13, 15 ], [ 19 ], [ 21 ] ]
12,673
static void m5206_mbar_update(m5206_mbar_state *s) { int irq; int vector; int level; irq = m5206_find_pending_irq(s); if (irq) { int tmp; tmp = s->icr[irq]; level = (tmp >> 2) & 7; if (tmp & 0x80) { /* Autovector. */ vector = 24 + level; } else { switch (irq) { case 8: /* SWT */ vector = s->swivr; break; case 12: /* UART1 */ vector = s->uivr[0]; break; case 13: /* UART2 */ vector = s->uivr[1]; break; default: /* Unknown vector. */ fprintf(stderr, "Unhandled vector for IRQ %d\n", irq); vector = 0xf; break; } } } else { level = 0; vector = 0; } m68k_set_irq_level(s->cpu, level, vector); }
false
qemu
45876e913e169bf156a3fc36f21eb0adf6ec3671
static void m5206_mbar_update(m5206_mbar_state *s) { int irq; int vector; int level; irq = m5206_find_pending_irq(s); if (irq) { int tmp; tmp = s->icr[irq]; level = (tmp >> 2) & 7; if (tmp & 0x80) { vector = 24 + level; } else { switch (irq) { case 8: vector = s->swivr; break; case 12: vector = s->uivr[0]; break; case 13: vector = s->uivr[1]; break; default: fprintf(stderr, "Unhandled vector for IRQ %d\n", irq); vector = 0xf; break; } } } else { level = 0; vector = 0; } m68k_set_irq_level(s->cpu, level, vector); }
{ "code": [], "line_no": [] }
static void FUNC_0(m5206_mbar_state *VAR_0) { int VAR_1; int VAR_2; int VAR_3; VAR_1 = m5206_find_pending_irq(VAR_0); if (VAR_1) { int VAR_4; VAR_4 = VAR_0->icr[VAR_1]; VAR_3 = (VAR_4 >> 2) & 7; if (VAR_4 & 0x80) { VAR_2 = 24 + VAR_3; } else { switch (VAR_1) { case 8: VAR_2 = VAR_0->swivr; break; case 12: VAR_2 = VAR_0->uivr[0]; break; case 13: VAR_2 = VAR_0->uivr[1]; break; default: fprintf(stderr, "Unhandled VAR_2 for IRQ %d\n", VAR_1); VAR_2 = 0xf; break; } } } else { VAR_3 = 0; VAR_2 = 0; } m68k_set_irq_level(VAR_0->cpu, VAR_3, VAR_2); }
[ "static void FUNC_0(m5206_mbar_state *VAR_0)\n{", "int VAR_1;", "int VAR_2;", "int VAR_3;", "VAR_1 = m5206_find_pending_irq(VAR_0);", "if (VAR_1) {", "int VAR_4;", "VAR_4 = VAR_0->icr[VAR_1];", "VAR_3 = (VAR_4 >> 2) & 7;", "if (VAR_4 & 0x80) {", "VAR_2 = 24 + VAR_3;", "} else {", "switch (VAR_1) {", "case 8:\nVAR_2 = VAR_0->swivr;", "break;", "case 12:\nVAR_2 = VAR_0->uivr[0];", "break;", "case 13:\nVAR_2 = VAR_0->uivr[1];", "break;", "default:\nfprintf(stderr, \"Unhandled VAR_2 for IRQ %d\\n\", VAR_1);", "VAR_2 = 0xf;", "break;", "}", "}", "} else {", "VAR_3 = 0;", "VAR_2 = 0;", "}", "m68k_set_irq_level(VAR_0->cpu, VAR_3, 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45, 47 ], [ 49 ], [ 51, 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ] ]
12,675
aio_ctx_check(GSource *source) { AioContext *ctx = (AioContext *) source; QEMUBH *bh; atomic_and(&ctx->notify_me, ~1); aio_notify_accept(ctx); for (bh = ctx->first_bh; bh; bh = bh->next) { if (!bh->deleted && bh->scheduled) { return true; } } return aio_pending(ctx) || (timerlistgroup_deadline_ns(&ctx->tlg) == 0); }
false
qemu
5b8bb3595a2941e9408021f1080e60ce86d677d2
aio_ctx_check(GSource *source) { AioContext *ctx = (AioContext *) source; QEMUBH *bh; atomic_and(&ctx->notify_me, ~1); aio_notify_accept(ctx); for (bh = ctx->first_bh; bh; bh = bh->next) { if (!bh->deleted && bh->scheduled) { return true; } } return aio_pending(ctx) || (timerlistgroup_deadline_ns(&ctx->tlg) == 0); }
{ "code": [], "line_no": [] }
FUNC_0(GSource *VAR_0) { AioContext *ctx = (AioContext *) VAR_0; QEMUBH *bh; atomic_and(&ctx->notify_me, ~1); aio_notify_accept(ctx); for (bh = ctx->first_bh; bh; bh = bh->next) { if (!bh->deleted && bh->scheduled) { return true; } } return aio_pending(ctx) || (timerlistgroup_deadline_ns(&ctx->tlg) == 0); }
[ "FUNC_0(GSource *VAR_0)\n{", "AioContext *ctx = (AioContext *) VAR_0;", "QEMUBH *bh;", "atomic_and(&ctx->notify_me, ~1);", "aio_notify_accept(ctx);", "for (bh = ctx->first_bh; bh; bh = bh->next) {", "if (!bh->deleted && bh->scheduled) {", "return true;", "}", "}", "return aio_pending(ctx) || (timerlistgroup_deadline_ns(&ctx->tlg) == 0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ] ]
12,676
static bool vmxnet3_peer_has_vnet_hdr(VMXNET3State *s) { NetClientState *nc = qemu_get_queue(s->nic); if (qemu_peer_has_vnet_hdr(nc)) { return true; } VMW_WRPRN("Peer has no virtio extension. Task offloads will be emulated."); return false; }
false
qemu
d6085e3ace20bc9b0fa625d8d79b22668710e217
static bool vmxnet3_peer_has_vnet_hdr(VMXNET3State *s) { NetClientState *nc = qemu_get_queue(s->nic); if (qemu_peer_has_vnet_hdr(nc)) { return true; } VMW_WRPRN("Peer has no virtio extension. Task offloads will be emulated."); return false; }
{ "code": [], "line_no": [] }
static bool FUNC_0(VMXNET3State *s) { NetClientState *nc = qemu_get_queue(s->nic); if (qemu_peer_has_vnet_hdr(nc)) { return true; } VMW_WRPRN("Peer has no virtio extension. Task offloads will be emulated."); return false; }
[ "static bool FUNC_0(VMXNET3State *s)\n{", "NetClientState *nc = qemu_get_queue(s->nic);", "if (qemu_peer_has_vnet_hdr(nc)) {", "return true;", "}", "VMW_WRPRN(\"Peer has no virtio extension. Task offloads will be emulated.\");", "return false;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ] ]
12,677
static int get_cluster_offset(BlockDriverState *bs, VmdkExtent *extent, VmdkMetaData *m_data, uint64_t offset, bool allocate, uint64_t *cluster_offset, uint64_t skip_start_bytes, uint64_t skip_end_bytes) { unsigned int l1_index, l2_offset, l2_index; int min_index, i, j; uint32_t min_count, *l2_table; bool zeroed = false; int64_t ret; int64_t cluster_sector; if (m_data) { m_data->valid = 0; } if (extent->flat) { *cluster_offset = extent->flat_start_offset; return VMDK_OK; } offset -= (extent->end_sector - extent->sectors) * SECTOR_SIZE; l1_index = (offset >> 9) / extent->l1_entry_sectors; if (l1_index >= extent->l1_size) { return VMDK_ERROR; } l2_offset = extent->l1_table[l1_index]; if (!l2_offset) { return VMDK_UNALLOC; } for (i = 0; i < L2_CACHE_SIZE; i++) { if (l2_offset == extent->l2_cache_offsets[i]) { /* increment the hit count */ if (++extent->l2_cache_counts[i] == 0xffffffff) { for (j = 0; j < L2_CACHE_SIZE; j++) { extent->l2_cache_counts[j] >>= 1; } } l2_table = extent->l2_cache + (i * extent->l2_size); goto found; } } /* not found: load a new entry in the least used one */ min_index = 0; min_count = 0xffffffff; for (i = 0; i < L2_CACHE_SIZE; i++) { if (extent->l2_cache_counts[i] < min_count) { min_count = extent->l2_cache_counts[i]; min_index = i; } } l2_table = extent->l2_cache + (min_index * extent->l2_size); if (bdrv_pread(extent->file, (int64_t)l2_offset * 512, l2_table, extent->l2_size * sizeof(uint32_t) ) != extent->l2_size * sizeof(uint32_t)) { return VMDK_ERROR; } extent->l2_cache_offsets[min_index] = l2_offset; extent->l2_cache_counts[min_index] = 1; found: l2_index = ((offset >> 9) / extent->cluster_sectors) % extent->l2_size; cluster_sector = le32_to_cpu(l2_table[l2_index]); if (m_data) { m_data->valid = 1; m_data->l1_index = l1_index; m_data->l2_index = l2_index; m_data->l2_offset = l2_offset; m_data->l2_cache_entry = &l2_table[l2_index]; } if (extent->has_zero_grain && cluster_sector == VMDK_GTE_ZEROED) { zeroed = true; } if (!cluster_sector || zeroed) { if (!allocate) { return zeroed ? VMDK_ZEROED : VMDK_UNALLOC; } cluster_sector = extent->next_cluster_sector; extent->next_cluster_sector += extent->cluster_sectors; /* First of all we write grain itself, to avoid race condition * that may to corrupt the image. * This problem may occur because of insufficient space on host disk * or inappropriate VM shutdown. */ ret = get_whole_cluster(bs, extent, cluster_sector * BDRV_SECTOR_SIZE, offset, skip_start_bytes, skip_end_bytes); if (ret) { return ret; } } *cluster_offset = cluster_sector << BDRV_SECTOR_BITS; return VMDK_OK; }
false
qemu
524089bce43fd1cd3daaca979872451efa2cf7c6
static int get_cluster_offset(BlockDriverState *bs, VmdkExtent *extent, VmdkMetaData *m_data, uint64_t offset, bool allocate, uint64_t *cluster_offset, uint64_t skip_start_bytes, uint64_t skip_end_bytes) { unsigned int l1_index, l2_offset, l2_index; int min_index, i, j; uint32_t min_count, *l2_table; bool zeroed = false; int64_t ret; int64_t cluster_sector; if (m_data) { m_data->valid = 0; } if (extent->flat) { *cluster_offset = extent->flat_start_offset; return VMDK_OK; } offset -= (extent->end_sector - extent->sectors) * SECTOR_SIZE; l1_index = (offset >> 9) / extent->l1_entry_sectors; if (l1_index >= extent->l1_size) { return VMDK_ERROR; } l2_offset = extent->l1_table[l1_index]; if (!l2_offset) { return VMDK_UNALLOC; } for (i = 0; i < L2_CACHE_SIZE; i++) { if (l2_offset == extent->l2_cache_offsets[i]) { if (++extent->l2_cache_counts[i] == 0xffffffff) { for (j = 0; j < L2_CACHE_SIZE; j++) { extent->l2_cache_counts[j] >>= 1; } } l2_table = extent->l2_cache + (i * extent->l2_size); goto found; } } min_index = 0; min_count = 0xffffffff; for (i = 0; i < L2_CACHE_SIZE; i++) { if (extent->l2_cache_counts[i] < min_count) { min_count = extent->l2_cache_counts[i]; min_index = i; } } l2_table = extent->l2_cache + (min_index * extent->l2_size); if (bdrv_pread(extent->file, (int64_t)l2_offset * 512, l2_table, extent->l2_size * sizeof(uint32_t) ) != extent->l2_size * sizeof(uint32_t)) { return VMDK_ERROR; } extent->l2_cache_offsets[min_index] = l2_offset; extent->l2_cache_counts[min_index] = 1; found: l2_index = ((offset >> 9) / extent->cluster_sectors) % extent->l2_size; cluster_sector = le32_to_cpu(l2_table[l2_index]); if (m_data) { m_data->valid = 1; m_data->l1_index = l1_index; m_data->l2_index = l2_index; m_data->l2_offset = l2_offset; m_data->l2_cache_entry = &l2_table[l2_index]; } if (extent->has_zero_grain && cluster_sector == VMDK_GTE_ZEROED) { zeroed = true; } if (!cluster_sector || zeroed) { if (!allocate) { return zeroed ? VMDK_ZEROED : VMDK_UNALLOC; } cluster_sector = extent->next_cluster_sector; extent->next_cluster_sector += extent->cluster_sectors; ret = get_whole_cluster(bs, extent, cluster_sector * BDRV_SECTOR_SIZE, offset, skip_start_bytes, skip_end_bytes); if (ret) { return ret; } } *cluster_offset = cluster_sector << BDRV_SECTOR_BITS; return VMDK_OK; }
{ "code": [], "line_no": [] }
static int FUNC_0(BlockDriverState *VAR_0, VmdkExtent *VAR_1, VmdkMetaData *VAR_2, uint64_t VAR_3, bool VAR_4, uint64_t *VAR_5, uint64_t VAR_6, uint64_t VAR_7) { unsigned int VAR_8, VAR_9, VAR_10; int VAR_11, VAR_12, VAR_13; uint32_t min_count, *l2_table; bool zeroed = false; int64_t ret; int64_t cluster_sector; if (VAR_2) { VAR_2->valid = 0; } if (VAR_1->flat) { *VAR_5 = VAR_1->flat_start_offset; return VMDK_OK; } VAR_3 -= (VAR_1->end_sector - VAR_1->sectors) * SECTOR_SIZE; VAR_8 = (VAR_3 >> 9) / VAR_1->l1_entry_sectors; if (VAR_8 >= VAR_1->l1_size) { return VMDK_ERROR; } VAR_9 = VAR_1->l1_table[VAR_8]; if (!VAR_9) { return VMDK_UNALLOC; } for (VAR_12 = 0; VAR_12 < L2_CACHE_SIZE; VAR_12++) { if (VAR_9 == VAR_1->l2_cache_offsets[VAR_12]) { if (++VAR_1->l2_cache_counts[VAR_12] == 0xffffffff) { for (VAR_13 = 0; VAR_13 < L2_CACHE_SIZE; VAR_13++) { VAR_1->l2_cache_counts[VAR_13] >>= 1; } } l2_table = VAR_1->l2_cache + (VAR_12 * VAR_1->l2_size); goto found; } } VAR_11 = 0; min_count = 0xffffffff; for (VAR_12 = 0; VAR_12 < L2_CACHE_SIZE; VAR_12++) { if (VAR_1->l2_cache_counts[VAR_12] < min_count) { min_count = VAR_1->l2_cache_counts[VAR_12]; VAR_11 = VAR_12; } } l2_table = VAR_1->l2_cache + (VAR_11 * VAR_1->l2_size); if (bdrv_pread(VAR_1->file, (int64_t)VAR_9 * 512, l2_table, VAR_1->l2_size * sizeof(uint32_t) ) != VAR_1->l2_size * sizeof(uint32_t)) { return VMDK_ERROR; } VAR_1->l2_cache_offsets[VAR_11] = VAR_9; VAR_1->l2_cache_counts[VAR_11] = 1; found: VAR_10 = ((VAR_3 >> 9) / VAR_1->cluster_sectors) % VAR_1->l2_size; cluster_sector = le32_to_cpu(l2_table[VAR_10]); if (VAR_2) { VAR_2->valid = 1; VAR_2->VAR_8 = VAR_8; VAR_2->VAR_10 = VAR_10; VAR_2->VAR_9 = VAR_9; VAR_2->l2_cache_entry = &l2_table[VAR_10]; } if (VAR_1->has_zero_grain && cluster_sector == VMDK_GTE_ZEROED) { zeroed = true; } if (!cluster_sector || zeroed) { if (!VAR_4) { return zeroed ? VMDK_ZEROED : VMDK_UNALLOC; } cluster_sector = VAR_1->next_cluster_sector; VAR_1->next_cluster_sector += VAR_1->cluster_sectors; ret = get_whole_cluster(VAR_0, VAR_1, cluster_sector * BDRV_SECTOR_SIZE, VAR_3, VAR_6, VAR_7); if (ret) { return ret; } } *VAR_5 = cluster_sector << BDRV_SECTOR_BITS; return VMDK_OK; }
[ "static int FUNC_0(BlockDriverState *VAR_0,\nVmdkExtent *VAR_1,\nVmdkMetaData *VAR_2,\nuint64_t VAR_3,\nbool VAR_4,\nuint64_t *VAR_5,\nuint64_t VAR_6,\nuint64_t VAR_7)\n{", "unsigned int VAR_8, VAR_9, VAR_10;", "int VAR_11, VAR_12, VAR_13;", "uint32_t min_count, *l2_table;", "bool zeroed = false;", "int64_t ret;", "int64_t cluster_sector;", "if (VAR_2) {", "VAR_2->valid = 0;", "}", "if (VAR_1->flat) {", "*VAR_5 = VAR_1->flat_start_offset;", "return VMDK_OK;", "}", "VAR_3 -= (VAR_1->end_sector - VAR_1->sectors) * SECTOR_SIZE;", "VAR_8 = (VAR_3 >> 9) / VAR_1->l1_entry_sectors;", "if (VAR_8 >= VAR_1->l1_size) {", "return VMDK_ERROR;", "}", "VAR_9 = VAR_1->l1_table[VAR_8];", "if (!VAR_9) {", "return VMDK_UNALLOC;", "}", "for (VAR_12 = 0; VAR_12 < L2_CACHE_SIZE; VAR_12++) {", "if (VAR_9 == VAR_1->l2_cache_offsets[VAR_12]) {", "if (++VAR_1->l2_cache_counts[VAR_12] == 0xffffffff) {", "for (VAR_13 = 0; VAR_13 < L2_CACHE_SIZE; VAR_13++) {", "VAR_1->l2_cache_counts[VAR_13] >>= 1;", "}", "}", "l2_table = VAR_1->l2_cache + (VAR_12 * VAR_1->l2_size);", "goto found;", "}", "}", "VAR_11 = 0;", "min_count = 0xffffffff;", "for (VAR_12 = 0; VAR_12 < L2_CACHE_SIZE; VAR_12++) {", "if (VAR_1->l2_cache_counts[VAR_12] < min_count) {", "min_count = VAR_1->l2_cache_counts[VAR_12];", "VAR_11 = VAR_12;", "}", "}", "l2_table = VAR_1->l2_cache + (VAR_11 * VAR_1->l2_size);", "if (bdrv_pread(VAR_1->file,\n(int64_t)VAR_9 * 512,\nl2_table,\nVAR_1->l2_size * sizeof(uint32_t)\n) != VAR_1->l2_size * sizeof(uint32_t)) {", "return VMDK_ERROR;", "}", "VAR_1->l2_cache_offsets[VAR_11] = VAR_9;", "VAR_1->l2_cache_counts[VAR_11] = 1;", "found:\nVAR_10 = ((VAR_3 >> 9) / VAR_1->cluster_sectors) % VAR_1->l2_size;", "cluster_sector = le32_to_cpu(l2_table[VAR_10]);", "if (VAR_2) {", "VAR_2->valid = 1;", "VAR_2->VAR_8 = VAR_8;", "VAR_2->VAR_10 = VAR_10;", "VAR_2->VAR_9 = VAR_9;", "VAR_2->l2_cache_entry = &l2_table[VAR_10];", "}", "if (VAR_1->has_zero_grain && cluster_sector == VMDK_GTE_ZEROED) {", "zeroed = true;", "}", "if (!cluster_sector || zeroed) {", "if (!VAR_4) {", "return zeroed ? VMDK_ZEROED : VMDK_UNALLOC;", "}", "cluster_sector = VAR_1->next_cluster_sector;", "VAR_1->next_cluster_sector += VAR_1->cluster_sectors;", "ret = get_whole_cluster(VAR_0, VAR_1, cluster_sector * BDRV_SECTOR_SIZE,\nVAR_3, VAR_6, VAR_7);", "if (ret) {", "return ret;", "}", "}", "*VAR_5 = cluster_sector << BDRV_SECTOR_BITS;", "return VMDK_OK;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11, 13, 15, 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111, 113, 115, 117, 119 ], [ 121 ], [ 123 ], [ 127 ], [ 129 ], [ 131, 133 ], [ 135 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 171 ], [ 173 ], [ 187, 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ] ]
12,678
static void qxl_log_image(PCIQXLDevice *qxl, QXLPHYSICAL addr, int group_id) { QXLImage *image; QXLImageDescriptor *desc; image = qxl_phys2virt(qxl, addr, group_id); desc = &image->descriptor; fprintf(stderr, " (id %" PRIx64 " type %d flags %d width %d height %d", desc->id, desc->type, desc->flags, desc->width, desc->height); switch (desc->type) { case SPICE_IMAGE_TYPE_BITMAP: fprintf(stderr, ", fmt %d flags %d x %d y %d stride %d" " palette %" PRIx64 " data %" PRIx64, image->bitmap.format, image->bitmap.flags, image->bitmap.x, image->bitmap.y, image->bitmap.stride, image->bitmap.palette, image->bitmap.data); break; } fprintf(stderr, ")"); }
false
qemu
fae2afb10e3fdceab612c62a2b1e8b944ff578d9
static void qxl_log_image(PCIQXLDevice *qxl, QXLPHYSICAL addr, int group_id) { QXLImage *image; QXLImageDescriptor *desc; image = qxl_phys2virt(qxl, addr, group_id); desc = &image->descriptor; fprintf(stderr, " (id %" PRIx64 " type %d flags %d width %d height %d", desc->id, desc->type, desc->flags, desc->width, desc->height); switch (desc->type) { case SPICE_IMAGE_TYPE_BITMAP: fprintf(stderr, ", fmt %d flags %d x %d y %d stride %d" " palette %" PRIx64 " data %" PRIx64, image->bitmap.format, image->bitmap.flags, image->bitmap.x, image->bitmap.y, image->bitmap.stride, image->bitmap.palette, image->bitmap.data); break; } fprintf(stderr, ")"); }
{ "code": [], "line_no": [] }
static void FUNC_0(PCIQXLDevice *VAR_0, QXLPHYSICAL VAR_1, int VAR_2) { QXLImage *image; QXLImageDescriptor *desc; image = qxl_phys2virt(VAR_0, VAR_1, VAR_2); desc = &image->descriptor; fprintf(stderr, " (id %" PRIx64 " type %d flags %d width %d height %d", desc->id, desc->type, desc->flags, desc->width, desc->height); switch (desc->type) { case SPICE_IMAGE_TYPE_BITMAP: fprintf(stderr, ", fmt %d flags %d x %d y %d stride %d" " palette %" PRIx64 " data %" PRIx64, image->bitmap.format, image->bitmap.flags, image->bitmap.x, image->bitmap.y, image->bitmap.stride, image->bitmap.palette, image->bitmap.data); break; } fprintf(stderr, ")"); }
[ "static void FUNC_0(PCIQXLDevice *VAR_0, QXLPHYSICAL VAR_1, int VAR_2)\n{", "QXLImage *image;", "QXLImageDescriptor *desc;", "image = qxl_phys2virt(VAR_0, VAR_1, VAR_2);", "desc = &image->descriptor;", "fprintf(stderr, \" (id %\" PRIx64 \" type %d flags %d width %d height %d\",\ndesc->id, desc->type, desc->flags, desc->width, desc->height);", "switch (desc->type) {", "case SPICE_IMAGE_TYPE_BITMAP:\nfprintf(stderr, \", fmt %d flags %d x %d y %d stride %d\"\n\" palette %\" PRIx64 \" data %\" PRIx64,\nimage->bitmap.format, image->bitmap.flags,\nimage->bitmap.x, image->bitmap.y,\nimage->bitmap.stride,\nimage->bitmap.palette, image->bitmap.data);", "break;", "}", "fprintf(stderr, \")\");", "}" ]
[ 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 ] ]
12,679
static BOOTPClient *get_new_addr(struct in_addr *paddr) { BOOTPClient *bc; int i; for(i = 0; i < NB_ADDR; i++) { if (!bootp_clients[i].allocated) goto found; } return NULL; found: bc = &bootp_clients[i]; bc->allocated = 1; paddr->s_addr = htonl(ntohl(special_addr.s_addr) | (i + START_ADDR)); return bc; }
false
qemu
0928a95ffe91862938cee997c9e30602fa7884ab
static BOOTPClient *get_new_addr(struct in_addr *paddr) { BOOTPClient *bc; int i; for(i = 0; i < NB_ADDR; i++) { if (!bootp_clients[i].allocated) goto found; } return NULL; found: bc = &bootp_clients[i]; bc->allocated = 1; paddr->s_addr = htonl(ntohl(special_addr.s_addr) | (i + START_ADDR)); return bc; }
{ "code": [], "line_no": [] }
static BOOTPClient *FUNC_0(struct in_addr *paddr) { BOOTPClient *bc; int VAR_0; for(VAR_0 = 0; VAR_0 < NB_ADDR; VAR_0++) { if (!bootp_clients[VAR_0].allocated) goto found; } return NULL; found: bc = &bootp_clients[VAR_0]; bc->allocated = 1; paddr->s_addr = htonl(ntohl(special_addr.s_addr) | (VAR_0 + START_ADDR)); return bc; }
[ "static BOOTPClient *FUNC_0(struct in_addr *paddr)\n{", "BOOTPClient *bc;", "int VAR_0;", "for(VAR_0 = 0; VAR_0 < NB_ADDR; VAR_0++) {", "if (!bootp_clients[VAR_0].allocated)\ngoto found;", "}", "return NULL;", "found:\nbc = &bootp_clients[VAR_0];", "bc->allocated = 1;", "paddr->s_addr = htonl(ntohl(special_addr.s_addr) | (VAR_0 + START_ADDR));", "return bc;", "}" ]
[ 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 ] ]
12,681
static uint64_t cchip_read(void *opaque, hwaddr addr, unsigned size) { CPUState *cpu = current_cpu; TyphoonState *s = opaque; uint64_t ret = 0; if (addr & 4) { return s->latch_tmp; } switch (addr) { case 0x0000: /* CSC: Cchip System Configuration Register. */ /* All sorts of data here; probably the only thing relevant is PIP<14> Pchip 1 Present = 0. */ break; case 0x0040: /* MTR: Memory Timing Register. */ /* All sorts of stuff related to real DRAM. */ break; case 0x0080: /* MISC: Miscellaneous Register. */ ret = s->cchip.misc | (cpu->cpu_index & 3); break; case 0x00c0: /* MPD: Memory Presence Detect Register. */ break; case 0x0100: /* AAR0 */ case 0x0140: /* AAR1 */ case 0x0180: /* AAR2 */ case 0x01c0: /* AAR3 */ /* AAR: Array Address Register. */ /* All sorts of information about DRAM. */ break; case 0x0200: /* DIM0: Device Interrupt Mask Register, CPU0. */ ret = s->cchip.dim[0]; break; case 0x0240: /* DIM1: Device Interrupt Mask Register, CPU1. */ ret = s->cchip.dim[1]; break; case 0x0280: /* DIR0: Device Interrupt Request Register, CPU0. */ ret = s->cchip.dim[0] & s->cchip.drir; break; case 0x02c0: /* DIR1: Device Interrupt Request Register, CPU1. */ ret = s->cchip.dim[1] & s->cchip.drir; break; case 0x0300: /* DRIR: Device Raw Interrupt Request Register. */ ret = s->cchip.drir; break; case 0x0340: /* PRBEN: Probe Enable Register. */ break; case 0x0380: /* IIC0: Interval Ignore Count Register, CPU0. */ ret = s->cchip.iic[0]; break; case 0x03c0: /* IIC1: Interval Ignore Count Register, CPU1. */ ret = s->cchip.iic[1]; break; case 0x0400: /* MPR0 */ case 0x0440: /* MPR1 */ case 0x0480: /* MPR2 */ case 0x04c0: /* MPR3 */ /* MPR: Memory Programming Register. */ break; case 0x0580: /* TTR: TIGbus Timing Register. */ /* All sorts of stuff related to interrupt delivery timings. */ break; case 0x05c0: /* TDR: TIGbug Device Timing Register. */ break; case 0x0600: /* DIM2: Device Interrupt Mask Register, CPU2. */ ret = s->cchip.dim[2]; break; case 0x0640: /* DIM3: Device Interrupt Mask Register, CPU3. */ ret = s->cchip.dim[3]; break; case 0x0680: /* DIR2: Device Interrupt Request Register, CPU2. */ ret = s->cchip.dim[2] & s->cchip.drir; break; case 0x06c0: /* DIR3: Device Interrupt Request Register, CPU3. */ ret = s->cchip.dim[3] & s->cchip.drir; break; case 0x0700: /* IIC2: Interval Ignore Count Register, CPU2. */ ret = s->cchip.iic[2]; break; case 0x0740: /* IIC3: Interval Ignore Count Register, CPU3. */ ret = s->cchip.iic[3]; break; case 0x0780: /* PWR: Power Management Control. */ break; case 0x0c00: /* CMONCTLA */ case 0x0c40: /* CMONCTLB */ case 0x0c80: /* CMONCNT01 */ case 0x0cc0: /* CMONCNT23 */ break; default: cpu_unassigned_access(cpu, addr, false, false, 0, size); return -1; } s->latch_tmp = ret >> 32; return ret; }
false
qemu
678421650dc166cd6cb35bb2bc0baf1b481b40ca
static uint64_t cchip_read(void *opaque, hwaddr addr, unsigned size) { CPUState *cpu = current_cpu; TyphoonState *s = opaque; uint64_t ret = 0; if (addr & 4) { return s->latch_tmp; } switch (addr) { case 0x0000: break; case 0x0040: break; case 0x0080: ret = s->cchip.misc | (cpu->cpu_index & 3); break; case 0x00c0: break; case 0x0100: case 0x0140: case 0x0180: case 0x01c0: break; case 0x0200: ret = s->cchip.dim[0]; break; case 0x0240: ret = s->cchip.dim[1]; break; case 0x0280: ret = s->cchip.dim[0] & s->cchip.drir; break; case 0x02c0: ret = s->cchip.dim[1] & s->cchip.drir; break; case 0x0300: ret = s->cchip.drir; break; case 0x0340: break; case 0x0380: ret = s->cchip.iic[0]; break; case 0x03c0: ret = s->cchip.iic[1]; break; case 0x0400: case 0x0440: case 0x0480: case 0x04c0: break; case 0x0580: break; case 0x05c0: break; case 0x0600: ret = s->cchip.dim[2]; break; case 0x0640: ret = s->cchip.dim[3]; break; case 0x0680: ret = s->cchip.dim[2] & s->cchip.drir; break; case 0x06c0: ret = s->cchip.dim[3] & s->cchip.drir; break; case 0x0700: ret = s->cchip.iic[2]; break; case 0x0740: ret = s->cchip.iic[3]; break; case 0x0780: break; case 0x0c00: case 0x0c40: case 0x0c80: case 0x0cc0: break; default: cpu_unassigned_access(cpu, addr, false, false, 0, size); return -1; } s->latch_tmp = ret >> 32; return ret; }
{ "code": [], "line_no": [] }
static uint64_t FUNC_0(void *opaque, hwaddr addr, unsigned size) { CPUState *cpu = current_cpu; TyphoonState *s = opaque; uint64_t ret = 0; if (addr & 4) { return s->latch_tmp; } switch (addr) { case 0x0000: break; case 0x0040: break; case 0x0080: ret = s->cchip.misc | (cpu->cpu_index & 3); break; case 0x00c0: break; case 0x0100: case 0x0140: case 0x0180: case 0x01c0: break; case 0x0200: ret = s->cchip.dim[0]; break; case 0x0240: ret = s->cchip.dim[1]; break; case 0x0280: ret = s->cchip.dim[0] & s->cchip.drir; break; case 0x02c0: ret = s->cchip.dim[1] & s->cchip.drir; break; case 0x0300: ret = s->cchip.drir; break; case 0x0340: break; case 0x0380: ret = s->cchip.iic[0]; break; case 0x03c0: ret = s->cchip.iic[1]; break; case 0x0400: case 0x0440: case 0x0480: case 0x04c0: break; case 0x0580: break; case 0x05c0: break; case 0x0600: ret = s->cchip.dim[2]; break; case 0x0640: ret = s->cchip.dim[3]; break; case 0x0680: ret = s->cchip.dim[2] & s->cchip.drir; break; case 0x06c0: ret = s->cchip.dim[3] & s->cchip.drir; break; case 0x0700: ret = s->cchip.iic[2]; break; case 0x0740: ret = s->cchip.iic[3]; break; case 0x0780: break; case 0x0c00: case 0x0c40: case 0x0c80: case 0x0cc0: break; default: cpu_unassigned_access(cpu, addr, false, false, 0, size); return -1; } s->latch_tmp = ret >> 32; return ret; }
[ "static uint64_t FUNC_0(void *opaque, hwaddr addr, unsigned size)\n{", "CPUState *cpu = current_cpu;", "TyphoonState *s = opaque;", "uint64_t ret = 0;", "if (addr & 4) {", "return s->latch_tmp;", "}", "switch (addr) {", "case 0x0000:\nbreak;", "case 0x0040:\nbreak;", "case 0x0080:\nret = s->cchip.misc | (cpu->cpu_index & 3);", "break;", "case 0x00c0:\nbreak;", "case 0x0100:\ncase 0x0140:\ncase 0x0180:\ncase 0x01c0:\nbreak;", "case 0x0200:\nret = s->cchip.dim[0];", "break;", "case 0x0240:\nret = s->cchip.dim[1];", "break;", "case 0x0280:\nret = s->cchip.dim[0] & s->cchip.drir;", "break;", "case 0x02c0:\nret = s->cchip.dim[1] & s->cchip.drir;", "break;", "case 0x0300:\nret = s->cchip.drir;", "break;", "case 0x0340:\nbreak;", "case 0x0380:\nret = s->cchip.iic[0];", "break;", "case 0x03c0:\nret = s->cchip.iic[1];", "break;", "case 0x0400:\ncase 0x0440:\ncase 0x0480:\ncase 0x04c0:\nbreak;", "case 0x0580:\nbreak;", "case 0x05c0:\nbreak;", "case 0x0600:\nret = s->cchip.dim[2];", "break;", "case 0x0640:\nret = s->cchip.dim[3];", "break;", "case 0x0680:\nret = s->cchip.dim[2] & s->cchip.drir;", "break;", "case 0x06c0:\nret = s->cchip.dim[3] & s->cchip.drir;", "break;", "case 0x0700:\nret = s->cchip.iic[2];", "break;", "case 0x0740:\nret = s->cchip.iic[3];", "break;", "case 0x0780:\nbreak;", "case 0x0c00:\ncase 0x0c40:\ncase 0x0c80:\ncase 0x0cc0:\nbreak;", "default:\ncpu_unassigned_access(cpu, addr, false, false, 0, size);", "return -1;", "}", "s->latch_tmp = ret >> 32;", "return ret;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23, 31 ], [ 35, 41 ], [ 45, 49 ], [ 51 ], [ 55, 59 ], [ 63, 65, 67, 69, 75 ], [ 79, 83 ], [ 85 ], [ 87, 91 ], [ 93 ], [ 95, 99 ], [ 101 ], [ 103, 107 ], [ 109 ], [ 111, 115 ], [ 117 ], [ 121, 125 ], [ 129, 133 ], [ 135 ], [ 137, 141 ], [ 143 ], [ 147, 149, 151, 153, 157 ], [ 161, 167 ], [ 169, 173 ], [ 177, 181 ], [ 183 ], [ 185, 189 ], [ 191 ], [ 193, 197 ], [ 199 ], [ 201, 205 ], [ 207 ], [ 211, 215 ], [ 217 ], [ 219, 223 ], [ 225 ], [ 229, 233 ], [ 237, 239, 241, 243, 245 ], [ 249, 251 ], [ 253 ], [ 255 ], [ 259 ], [ 261 ], [ 263 ] ]
12,682
static int blk_init(struct XenDevice *xendev) { struct XenBlkDev *blkdev = container_of(xendev, struct XenBlkDev, xendev); int index, qflags, have_barriers, info = 0; char *h; /* read xenstore entries */ if (blkdev->params == NULL) { blkdev->params = xenstore_read_be_str(&blkdev->xendev, "params"); h = strchr(blkdev->params, ':'); if (h != NULL) { blkdev->fileproto = blkdev->params; blkdev->filename = h+1; *h = 0; } else { blkdev->fileproto = "<unset>"; blkdev->filename = blkdev->params; } } if (blkdev->mode == NULL) blkdev->mode = xenstore_read_be_str(&blkdev->xendev, "mode"); if (blkdev->type == NULL) blkdev->type = xenstore_read_be_str(&blkdev->xendev, "type"); if (blkdev->dev == NULL) blkdev->dev = xenstore_read_be_str(&blkdev->xendev, "dev"); if (blkdev->devtype == NULL) blkdev->devtype = xenstore_read_be_str(&blkdev->xendev, "device-type"); /* do we have all we need? */ if (blkdev->params == NULL || blkdev->mode == NULL || blkdev->type == NULL || blkdev->dev == NULL) return -1; /* read-only ? */ if (strcmp(blkdev->mode, "w") == 0) { qflags = BDRV_O_RDWR; } else { qflags = 0; info |= VDISK_READONLY; } /* cdrom ? */ if (blkdev->devtype && !strcmp(blkdev->devtype, "cdrom")) info |= VDISK_CDROM; /* init qemu block driver */ index = (blkdev->xendev.dev - 202 * 256) / 16; blkdev->dinfo = drive_get(IF_XEN, 0, index); if (!blkdev->dinfo) { /* setup via xenbus -> create new block driver instance */ xen_be_printf(&blkdev->xendev, 2, "create new bdrv (xenbus setup)\n"); blkdev->bs = bdrv_new(blkdev->dev); if (blkdev->bs) { if (bdrv_open(blkdev->bs, blkdev->filename, qflags, bdrv_find_whitelisted_format(blkdev->fileproto)) != 0) { bdrv_delete(blkdev->bs); blkdev->bs = NULL; } } if (!blkdev->bs) return -1; } else { /* setup via qemu cmdline -> already setup for us */ xen_be_printf(&blkdev->xendev, 2, "get configured bdrv (cmdline setup)\n"); blkdev->bs = blkdev->dinfo->bdrv; } blkdev->file_blk = BLOCK_SIZE; blkdev->file_size = bdrv_getlength(blkdev->bs); if (blkdev->file_size < 0) { xen_be_printf(&blkdev->xendev, 1, "bdrv_getlength: %d (%s) | drv %s\n", (int)blkdev->file_size, strerror(-blkdev->file_size), blkdev->bs->drv ? blkdev->bs->drv->format_name : "-"); blkdev->file_size = 0; } have_barriers = blkdev->bs->drv && blkdev->bs->drv->bdrv_flush ? 1 : 0; xen_be_printf(xendev, 1, "type \"%s\", fileproto \"%s\", filename \"%s\"," " size %" PRId64 " (%" PRId64 " MB)\n", blkdev->type, blkdev->fileproto, blkdev->filename, blkdev->file_size, blkdev->file_size >> 20); /* fill info */ xenstore_write_be_int(&blkdev->xendev, "feature-barrier", have_barriers); xenstore_write_be_int(&blkdev->xendev, "info", info); xenstore_write_be_int(&blkdev->xendev, "sector-size", blkdev->file_blk); xenstore_write_be_int(&blkdev->xendev, "sectors", blkdev->file_size / blkdev->file_blk); return 0; }
false
qemu
ad7171394f2fe3f9b5fe02f0c62496291a859a92
static int blk_init(struct XenDevice *xendev) { struct XenBlkDev *blkdev = container_of(xendev, struct XenBlkDev, xendev); int index, qflags, have_barriers, info = 0; char *h; if (blkdev->params == NULL) { blkdev->params = xenstore_read_be_str(&blkdev->xendev, "params"); h = strchr(blkdev->params, ':'); if (h != NULL) { blkdev->fileproto = blkdev->params; blkdev->filename = h+1; *h = 0; } else { blkdev->fileproto = "<unset>"; blkdev->filename = blkdev->params; } } if (blkdev->mode == NULL) blkdev->mode = xenstore_read_be_str(&blkdev->xendev, "mode"); if (blkdev->type == NULL) blkdev->type = xenstore_read_be_str(&blkdev->xendev, "type"); if (blkdev->dev == NULL) blkdev->dev = xenstore_read_be_str(&blkdev->xendev, "dev"); if (blkdev->devtype == NULL) blkdev->devtype = xenstore_read_be_str(&blkdev->xendev, "device-type"); if (blkdev->params == NULL || blkdev->mode == NULL || blkdev->type == NULL || blkdev->dev == NULL) return -1; if (strcmp(blkdev->mode, "w") == 0) { qflags = BDRV_O_RDWR; } else { qflags = 0; info |= VDISK_READONLY; } if (blkdev->devtype && !strcmp(blkdev->devtype, "cdrom")) info |= VDISK_CDROM; index = (blkdev->xendev.dev - 202 * 256) / 16; blkdev->dinfo = drive_get(IF_XEN, 0, index); if (!blkdev->dinfo) { xen_be_printf(&blkdev->xendev, 2, "create new bdrv (xenbus setup)\n"); blkdev->bs = bdrv_new(blkdev->dev); if (blkdev->bs) { if (bdrv_open(blkdev->bs, blkdev->filename, qflags, bdrv_find_whitelisted_format(blkdev->fileproto)) != 0) { bdrv_delete(blkdev->bs); blkdev->bs = NULL; } } if (!blkdev->bs) return -1; } else { xen_be_printf(&blkdev->xendev, 2, "get configured bdrv (cmdline setup)\n"); blkdev->bs = blkdev->dinfo->bdrv; } blkdev->file_blk = BLOCK_SIZE; blkdev->file_size = bdrv_getlength(blkdev->bs); if (blkdev->file_size < 0) { xen_be_printf(&blkdev->xendev, 1, "bdrv_getlength: %d (%s) | drv %s\n", (int)blkdev->file_size, strerror(-blkdev->file_size), blkdev->bs->drv ? blkdev->bs->drv->format_name : "-"); blkdev->file_size = 0; } have_barriers = blkdev->bs->drv && blkdev->bs->drv->bdrv_flush ? 1 : 0; xen_be_printf(xendev, 1, "type \"%s\", fileproto \"%s\", filename \"%s\"," " size %" PRId64 " (%" PRId64 " MB)\n", blkdev->type, blkdev->fileproto, blkdev->filename, blkdev->file_size, blkdev->file_size >> 20); xenstore_write_be_int(&blkdev->xendev, "feature-barrier", have_barriers); xenstore_write_be_int(&blkdev->xendev, "info", info); xenstore_write_be_int(&blkdev->xendev, "sector-size", blkdev->file_blk); xenstore_write_be_int(&blkdev->xendev, "sectors", blkdev->file_size / blkdev->file_blk); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(struct XenDevice *VAR_0) { struct XenBlkDev *VAR_1 = container_of(VAR_0, struct XenBlkDev, VAR_0); int VAR_2, VAR_3, VAR_4, VAR_5 = 0; char *VAR_6; if (VAR_1->params == NULL) { VAR_1->params = xenstore_read_be_str(&VAR_1->VAR_0, "params"); VAR_6 = strchr(VAR_1->params, ':'); if (VAR_6 != NULL) { VAR_1->fileproto = VAR_1->params; VAR_1->filename = VAR_6+1; *VAR_6 = 0; } else { VAR_1->fileproto = "<unset>"; VAR_1->filename = VAR_1->params; } } if (VAR_1->mode == NULL) VAR_1->mode = xenstore_read_be_str(&VAR_1->VAR_0, "mode"); if (VAR_1->type == NULL) VAR_1->type = xenstore_read_be_str(&VAR_1->VAR_0, "type"); if (VAR_1->dev == NULL) VAR_1->dev = xenstore_read_be_str(&VAR_1->VAR_0, "dev"); if (VAR_1->devtype == NULL) VAR_1->devtype = xenstore_read_be_str(&VAR_1->VAR_0, "device-type"); if (VAR_1->params == NULL || VAR_1->mode == NULL || VAR_1->type == NULL || VAR_1->dev == NULL) return -1; if (strcmp(VAR_1->mode, "w") == 0) { VAR_3 = BDRV_O_RDWR; } else { VAR_3 = 0; VAR_5 |= VDISK_READONLY; } if (VAR_1->devtype && !strcmp(VAR_1->devtype, "cdrom")) VAR_5 |= VDISK_CDROM; VAR_2 = (VAR_1->VAR_0.dev - 202 * 256) / 16; VAR_1->dinfo = drive_get(IF_XEN, 0, VAR_2); if (!VAR_1->dinfo) { xen_be_printf(&VAR_1->VAR_0, 2, "create new bdrv (xenbus setup)\n"); VAR_1->bs = bdrv_new(VAR_1->dev); if (VAR_1->bs) { if (bdrv_open(VAR_1->bs, VAR_1->filename, VAR_3, bdrv_find_whitelisted_format(VAR_1->fileproto)) != 0) { bdrv_delete(VAR_1->bs); VAR_1->bs = NULL; } } if (!VAR_1->bs) return -1; } else { xen_be_printf(&VAR_1->VAR_0, 2, "get configured bdrv (cmdline setup)\n"); VAR_1->bs = VAR_1->dinfo->bdrv; } VAR_1->file_blk = BLOCK_SIZE; VAR_1->file_size = bdrv_getlength(VAR_1->bs); if (VAR_1->file_size < 0) { xen_be_printf(&VAR_1->VAR_0, 1, "bdrv_getlength: %d (%s) | drv %s\n", (int)VAR_1->file_size, strerror(-VAR_1->file_size), VAR_1->bs->drv ? VAR_1->bs->drv->format_name : "-"); VAR_1->file_size = 0; } VAR_4 = VAR_1->bs->drv && VAR_1->bs->drv->bdrv_flush ? 1 : 0; xen_be_printf(VAR_0, 1, "type \"%s\", fileproto \"%s\", filename \"%s\"," " size %" PRId64 " (%" PRId64 " MB)\n", VAR_1->type, VAR_1->fileproto, VAR_1->filename, VAR_1->file_size, VAR_1->file_size >> 20); xenstore_write_be_int(&VAR_1->VAR_0, "feature-barrier", VAR_4); xenstore_write_be_int(&VAR_1->VAR_0, "VAR_5", VAR_5); xenstore_write_be_int(&VAR_1->VAR_0, "sector-size", VAR_1->file_blk); xenstore_write_be_int(&VAR_1->VAR_0, "sectors", VAR_1->file_size / VAR_1->file_blk); return 0; }
[ "static int FUNC_0(struct XenDevice *VAR_0)\n{", "struct XenBlkDev *VAR_1 = container_of(VAR_0, struct XenBlkDev, VAR_0);", "int VAR_2, VAR_3, VAR_4, VAR_5 = 0;", "char *VAR_6;", "if (VAR_1->params == NULL) {", "VAR_1->params = xenstore_read_be_str(&VAR_1->VAR_0, \"params\");", "VAR_6 = strchr(VAR_1->params, ':');", "if (VAR_6 != NULL) {", "VAR_1->fileproto = VAR_1->params;", "VAR_1->filename = VAR_6+1;", "*VAR_6 = 0;", "} else {", "VAR_1->fileproto = \"<unset>\";", "VAR_1->filename = VAR_1->params;", "}", "}", "if (VAR_1->mode == NULL)\nVAR_1->mode = xenstore_read_be_str(&VAR_1->VAR_0, \"mode\");", "if (VAR_1->type == NULL)\nVAR_1->type = xenstore_read_be_str(&VAR_1->VAR_0, \"type\");", "if (VAR_1->dev == NULL)\nVAR_1->dev = xenstore_read_be_str(&VAR_1->VAR_0, \"dev\");", "if (VAR_1->devtype == NULL)\nVAR_1->devtype = xenstore_read_be_str(&VAR_1->VAR_0, \"device-type\");", "if (VAR_1->params == NULL ||\nVAR_1->mode == NULL ||\nVAR_1->type == NULL ||\nVAR_1->dev == NULL)\nreturn -1;", "if (strcmp(VAR_1->mode, \"w\") == 0) {", "VAR_3 = BDRV_O_RDWR;", "} else {", "VAR_3 = 0;", "VAR_5 |= VDISK_READONLY;", "}", "if (VAR_1->devtype && !strcmp(VAR_1->devtype, \"cdrom\"))\nVAR_5 |= VDISK_CDROM;", "VAR_2 = (VAR_1->VAR_0.dev - 202 * 256) / 16;", "VAR_1->dinfo = drive_get(IF_XEN, 0, VAR_2);", "if (!VAR_1->dinfo) {", "xen_be_printf(&VAR_1->VAR_0, 2, \"create new bdrv (xenbus setup)\\n\");", "VAR_1->bs = bdrv_new(VAR_1->dev);", "if (VAR_1->bs) {", "if (bdrv_open(VAR_1->bs, VAR_1->filename, VAR_3,\nbdrv_find_whitelisted_format(VAR_1->fileproto))\n!= 0) {", "bdrv_delete(VAR_1->bs);", "VAR_1->bs = NULL;", "}", "}", "if (!VAR_1->bs)\nreturn -1;", "} else {", "xen_be_printf(&VAR_1->VAR_0, 2, \"get configured bdrv (cmdline setup)\\n\");", "VAR_1->bs = VAR_1->dinfo->bdrv;", "}", "VAR_1->file_blk = BLOCK_SIZE;", "VAR_1->file_size = bdrv_getlength(VAR_1->bs);", "if (VAR_1->file_size < 0) {", "xen_be_printf(&VAR_1->VAR_0, 1, \"bdrv_getlength: %d (%s) | drv %s\\n\",\n(int)VAR_1->file_size, strerror(-VAR_1->file_size),\nVAR_1->bs->drv ? VAR_1->bs->drv->format_name : \"-\");", "VAR_1->file_size = 0;", "}", "VAR_4 = VAR_1->bs->drv && VAR_1->bs->drv->bdrv_flush ? 1 : 0;", "xen_be_printf(VAR_0, 1, \"type \\\"%s\\\", fileproto \\\"%s\\\", filename \\\"%s\\\",\"\n\" size %\" PRId64 \" (%\" PRId64 \" MB)\\n\",\nVAR_1->type, VAR_1->fileproto, VAR_1->filename,\nVAR_1->file_size, VAR_1->file_size >> 20);", "xenstore_write_be_int(&VAR_1->VAR_0, \"feature-barrier\", VAR_4);", "xenstore_write_be_int(&VAR_1->VAR_0, \"VAR_5\", VAR_5);", "xenstore_write_be_int(&VAR_1->VAR_0, \"sector-size\", VAR_1->file_blk);", "xenstore_write_be_int(&VAR_1->VAR_0, \"sectors\",\nVAR_1->file_size / VAR_1->file_blk);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39, 41 ], [ 43, 45 ], [ 47, 49 ], [ 51, 53 ], [ 59, 61, 63, 65, 67 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 89, 91 ], [ 97 ], [ 99 ], [ 101 ], [ 105 ], [ 107 ], [ 109 ], [ 111, 113, 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125, 127 ], [ 129 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145, 147, 149 ], [ 151 ], [ 153 ], [ 155 ], [ 159, 161, 163, 165 ], [ 171 ], [ 173 ], [ 175 ], [ 177, 179 ], [ 181 ], [ 183 ] ]
12,683
static void register_subpage(AddressSpaceDispatch *d, MemoryRegionSection *section) { subpage_t *subpage; hwaddr base = section->offset_within_address_space & TARGET_PAGE_MASK; MemoryRegionSection *existing = phys_page_find(d->phys_map, base, next_map.nodes, next_map.sections); MemoryRegionSection subsection = { .offset_within_address_space = base, .size = int128_make64(TARGET_PAGE_SIZE), }; hwaddr start, end; assert(existing->mr->subpage || existing->mr == &io_mem_unassigned); if (!(existing->mr->subpage)) { subpage = subpage_init(d->as, base); subsection.mr = &subpage->iomem; phys_page_set(d, base >> TARGET_PAGE_BITS, 1, phys_section_add(&subsection)); } else { subpage = container_of(existing->mr, subpage_t, iomem); } start = section->offset_within_address_space & ~TARGET_PAGE_MASK; end = start + int128_get64(section->size) - 1; subpage_register(subpage, start, end, phys_section_add(section)); }
false
qemu
53cb28cbfea038f8ad50132dc8a684e638c7d48b
static void register_subpage(AddressSpaceDispatch *d, MemoryRegionSection *section) { subpage_t *subpage; hwaddr base = section->offset_within_address_space & TARGET_PAGE_MASK; MemoryRegionSection *existing = phys_page_find(d->phys_map, base, next_map.nodes, next_map.sections); MemoryRegionSection subsection = { .offset_within_address_space = base, .size = int128_make64(TARGET_PAGE_SIZE), }; hwaddr start, end; assert(existing->mr->subpage || existing->mr == &io_mem_unassigned); if (!(existing->mr->subpage)) { subpage = subpage_init(d->as, base); subsection.mr = &subpage->iomem; phys_page_set(d, base >> TARGET_PAGE_BITS, 1, phys_section_add(&subsection)); } else { subpage = container_of(existing->mr, subpage_t, iomem); } start = section->offset_within_address_space & ~TARGET_PAGE_MASK; end = start + int128_get64(section->size) - 1; subpage_register(subpage, start, end, phys_section_add(section)); }
{ "code": [], "line_no": [] }
static void FUNC_0(AddressSpaceDispatch *VAR_0, MemoryRegionSection *VAR_1) { subpage_t *subpage; hwaddr base = VAR_1->offset_within_address_space & TARGET_PAGE_MASK; MemoryRegionSection *existing = phys_page_find(VAR_0->phys_map, base, next_map.nodes, next_map.sections); MemoryRegionSection subsection = { .offset_within_address_space = base, .size = int128_make64(TARGET_PAGE_SIZE), }; hwaddr start, end; assert(existing->mr->subpage || existing->mr == &io_mem_unassigned); if (!(existing->mr->subpage)) { subpage = subpage_init(VAR_0->as, base); subsection.mr = &subpage->iomem; phys_page_set(VAR_0, base >> TARGET_PAGE_BITS, 1, phys_section_add(&subsection)); } else { subpage = container_of(existing->mr, subpage_t, iomem); } start = VAR_1->offset_within_address_space & ~TARGET_PAGE_MASK; end = start + int128_get64(VAR_1->size) - 1; subpage_register(subpage, start, end, phys_section_add(VAR_1)); }
[ "static void FUNC_0(AddressSpaceDispatch *VAR_0, MemoryRegionSection *VAR_1)\n{", "subpage_t *subpage;", "hwaddr base = VAR_1->offset_within_address_space\n& TARGET_PAGE_MASK;", "MemoryRegionSection *existing = phys_page_find(VAR_0->phys_map, base,\nnext_map.nodes, next_map.sections);", "MemoryRegionSection subsection = {", ".offset_within_address_space = base,\n.size = int128_make64(TARGET_PAGE_SIZE),\n};", "hwaddr start, end;", "assert(existing->mr->subpage || existing->mr == &io_mem_unassigned);", "if (!(existing->mr->subpage)) {", "subpage = subpage_init(VAR_0->as, base);", "subsection.mr = &subpage->iomem;", "phys_page_set(VAR_0, base >> TARGET_PAGE_BITS, 1,\nphys_section_add(&subsection));", "} else {", "subpage = container_of(existing->mr, subpage_t, iomem);", "}", "start = VAR_1->offset_within_address_space & ~TARGET_PAGE_MASK;", "end = start + int128_get64(VAR_1->size) - 1;", "subpage_register(subpage, start, end, phys_section_add(VAR_1));", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 11, 13 ], [ 15 ], [ 17, 19, 21 ], [ 23 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37, 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ] ]
12,684
static void smbios_encode_uuid(struct smbios_uuid *uuid, const uint8_t *buf) { memcpy(uuid, buf, 16); if (smbios_uuid_encoded) { uuid->time_low = bswap32(uuid->time_low); uuid->time_mid = bswap16(uuid->time_mid); uuid->time_hi_and_version = bswap16(uuid->time_hi_and_version); } }
false
qemu
9c5ce8db2e5c2769ed2fd3d91928dd1853b5ce7c
static void smbios_encode_uuid(struct smbios_uuid *uuid, const uint8_t *buf) { memcpy(uuid, buf, 16); if (smbios_uuid_encoded) { uuid->time_low = bswap32(uuid->time_low); uuid->time_mid = bswap16(uuid->time_mid); uuid->time_hi_and_version = bswap16(uuid->time_hi_and_version); } }
{ "code": [], "line_no": [] }
static void FUNC_0(struct smbios_uuid *VAR_0, const uint8_t *VAR_1) { memcpy(VAR_0, VAR_1, 16); if (smbios_uuid_encoded) { VAR_0->time_low = bswap32(VAR_0->time_low); VAR_0->time_mid = bswap16(VAR_0->time_mid); VAR_0->time_hi_and_version = bswap16(VAR_0->time_hi_and_version); } }
[ "static void FUNC_0(struct smbios_uuid *VAR_0, const uint8_t *VAR_1)\n{", "memcpy(VAR_0, VAR_1, 16);", "if (smbios_uuid_encoded) {", "VAR_0->time_low = bswap32(VAR_0->time_low);", "VAR_0->time_mid = bswap16(VAR_0->time_mid);", "VAR_0->time_hi_and_version = bswap16(VAR_0->time_hi_and_version);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ] ]
12,687
static gboolean qemu_chr_be_generic_open_bh(gpointer opaque) { CharDriverState *s = opaque; qemu_chr_be_event(s, CHR_EVENT_OPENED); s->idle_tag = 0; return FALSE; }
false
qemu
bd5c51ee6c4f1c79cae5ad2516d711a27b4ea8ec
static gboolean qemu_chr_be_generic_open_bh(gpointer opaque) { CharDriverState *s = opaque; qemu_chr_be_event(s, CHR_EVENT_OPENED); s->idle_tag = 0; return FALSE; }
{ "code": [], "line_no": [] }
static gboolean FUNC_0(gpointer opaque) { CharDriverState *s = opaque; qemu_chr_be_event(s, CHR_EVENT_OPENED); s->idle_tag = 0; return FALSE; }
[ "static gboolean FUNC_0(gpointer opaque)\n{", "CharDriverState *s = opaque;", "qemu_chr_be_event(s, CHR_EVENT_OPENED);", "s->idle_tag = 0;", "return FALSE;", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ] ]
12,688
static void smc91c111_receive(void *opaque, const uint8_t *buf, size_t size) { smc91c111_state *s = (smc91c111_state *)opaque; int status; int packetsize; uint32_t crc; int packetnum; uint8_t *p; if ((s->rcr & RCR_RXEN) == 0 || (s->rcr & RCR_SOFT_RST)) return; /* Short packets are padded with zeros. Receiving a packet < 64 bytes long is considered an error condition. */ if (size < 64) packetsize = 64; else packetsize = (size & ~1); packetsize += 6; crc = (s->rcr & RCR_STRIP_CRC) == 0; if (crc) packetsize += 4; /* TODO: Flag overrun and receive errors. */ if (packetsize > 2048) return; packetnum = smc91c111_allocate_packet(s); if (packetnum == 0x80) return; s->rx_fifo[s->rx_fifo_len++] = packetnum; p = &s->data[packetnum][0]; /* ??? Multicast packets? */ status = 0; if (size > 1518) status |= RS_TOOLONG; if (size & 1) status |= RS_ODDFRAME; *(p++) = status & 0xff; *(p++) = status >> 8; *(p++) = packetsize & 0xff; *(p++) = packetsize >> 8; memcpy(p, buf, size & ~1); p += (size & ~1); /* Pad short packets. */ if (size < 64) { int pad; if (size & 1) *(p++) = buf[size - 1]; pad = 64 - size; memset(p, 0, pad); p += pad; size = 64; } /* It's not clear if the CRC should go before or after the last byte in odd sized packets. Linux disables the CRC, so that's no help. The pictures in the documentation show the CRC aligned on a 16-bit boundary before the last odd byte, so that's what we do. */ if (crc) { crc = crc32(~0, buf, size); *(p++) = crc & 0xff; crc >>= 8; *(p++) = crc & 0xff; crc >>= 8; *(p++) = crc & 0xff; crc >>= 8; *(p++) = crc & 0xff; crc >>= 8; } if (size & 1) { *(p++) = buf[size - 1]; *(p++) = 0x60; } else { *(p++) = 0; *(p++) = 0x40; } /* TODO: Raise early RX interrupt? */ s->int_level |= INT_RCV; smc91c111_update(s); }
false
qemu
e3f5ec2b5e92706e3b807059f79b1fb5d936e567
static void smc91c111_receive(void *opaque, const uint8_t *buf, size_t size) { smc91c111_state *s = (smc91c111_state *)opaque; int status; int packetsize; uint32_t crc; int packetnum; uint8_t *p; if ((s->rcr & RCR_RXEN) == 0 || (s->rcr & RCR_SOFT_RST)) return; if (size < 64) packetsize = 64; else packetsize = (size & ~1); packetsize += 6; crc = (s->rcr & RCR_STRIP_CRC) == 0; if (crc) packetsize += 4; if (packetsize > 2048) return; packetnum = smc91c111_allocate_packet(s); if (packetnum == 0x80) return; s->rx_fifo[s->rx_fifo_len++] = packetnum; p = &s->data[packetnum][0]; status = 0; if (size > 1518) status |= RS_TOOLONG; if (size & 1) status |= RS_ODDFRAME; *(p++) = status & 0xff; *(p++) = status >> 8; *(p++) = packetsize & 0xff; *(p++) = packetsize >> 8; memcpy(p, buf, size & ~1); p += (size & ~1); if (size < 64) { int pad; if (size & 1) *(p++) = buf[size - 1]; pad = 64 - size; memset(p, 0, pad); p += pad; size = 64; } if (crc) { crc = crc32(~0, buf, size); *(p++) = crc & 0xff; crc >>= 8; *(p++) = crc & 0xff; crc >>= 8; *(p++) = crc & 0xff; crc >>= 8; *(p++) = crc & 0xff; crc >>= 8; } if (size & 1) { *(p++) = buf[size - 1]; *(p++) = 0x60; } else { *(p++) = 0; *(p++) = 0x40; } s->int_level |= INT_RCV; smc91c111_update(s); }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, const uint8_t *VAR_1, size_t VAR_2) { smc91c111_state *s = (smc91c111_state *)VAR_0; int VAR_3; int VAR_4; uint32_t crc; int VAR_5; uint8_t *p; if ((s->rcr & RCR_RXEN) == 0 || (s->rcr & RCR_SOFT_RST)) return; if (VAR_2 < 64) VAR_4 = 64; else VAR_4 = (VAR_2 & ~1); VAR_4 += 6; crc = (s->rcr & RCR_STRIP_CRC) == 0; if (crc) VAR_4 += 4; if (VAR_4 > 2048) return; VAR_5 = smc91c111_allocate_packet(s); if (VAR_5 == 0x80) return; s->rx_fifo[s->rx_fifo_len++] = VAR_5; p = &s->data[VAR_5][0]; VAR_3 = 0; if (VAR_2 > 1518) VAR_3 |= RS_TOOLONG; if (VAR_2 & 1) VAR_3 |= RS_ODDFRAME; *(p++) = VAR_3 & 0xff; *(p++) = VAR_3 >> 8; *(p++) = VAR_4 & 0xff; *(p++) = VAR_4 >> 8; memcpy(p, VAR_1, VAR_2 & ~1); p += (VAR_2 & ~1); if (VAR_2 < 64) { int VAR_6; if (VAR_2 & 1) *(p++) = VAR_1[VAR_2 - 1]; VAR_6 = 64 - VAR_2; memset(p, 0, VAR_6); p += VAR_6; VAR_2 = 64; } if (crc) { crc = crc32(~0, VAR_1, VAR_2); *(p++) = crc & 0xff; crc >>= 8; *(p++) = crc & 0xff; crc >>= 8; *(p++) = crc & 0xff; crc >>= 8; *(p++) = crc & 0xff; crc >>= 8; } if (VAR_2 & 1) { *(p++) = VAR_1[VAR_2 - 1]; *(p++) = 0x60; } else { *(p++) = 0; *(p++) = 0x40; } s->int_level |= INT_RCV; smc91c111_update(s); }
[ "static void FUNC_0(void *VAR_0, const uint8_t *VAR_1, size_t VAR_2)\n{", "smc91c111_state *s = (smc91c111_state *)VAR_0;", "int VAR_3;", "int VAR_4;", "uint32_t crc;", "int VAR_5;", "uint8_t *p;", "if ((s->rcr & RCR_RXEN) == 0 || (s->rcr & RCR_SOFT_RST))\nreturn;", "if (VAR_2 < 64)\nVAR_4 = 64;", "else\nVAR_4 = (VAR_2 & ~1);", "VAR_4 += 6;", "crc = (s->rcr & RCR_STRIP_CRC) == 0;", "if (crc)\nVAR_4 += 4;", "if (VAR_4 > 2048)\nreturn;", "VAR_5 = smc91c111_allocate_packet(s);", "if (VAR_5 == 0x80)\nreturn;", "s->rx_fifo[s->rx_fifo_len++] = VAR_5;", "p = &s->data[VAR_5][0];", "VAR_3 = 0;", "if (VAR_2 > 1518)\nVAR_3 |= RS_TOOLONG;", "if (VAR_2 & 1)\nVAR_3 |= RS_ODDFRAME;", "*(p++) = VAR_3 & 0xff;", "*(p++) = VAR_3 >> 8;", "*(p++) = VAR_4 & 0xff;", "*(p++) = VAR_4 >> 8;", "memcpy(p, VAR_1, VAR_2 & ~1);", "p += (VAR_2 & ~1);", "if (VAR_2 < 64) {", "int VAR_6;", "if (VAR_2 & 1)\n*(p++) = VAR_1[VAR_2 - 1];", "VAR_6 = 64 - VAR_2;", "memset(p, 0, VAR_6);", "p += VAR_6;", "VAR_2 = 64;", "}", "if (crc) {", "crc = crc32(~0, VAR_1, VAR_2);", "*(p++) = crc & 0xff; crc >>= 8;", "*(p++) = crc & 0xff; crc >>= 8;", "*(p++) = crc & 0xff; crc >>= 8;", "*(p++) = crc & 0xff; crc >>= 8;", "}", "if (VAR_2 & 1) {", "*(p++) = VAR_1[VAR_2 - 1];", "*(p++) = 0x60;", "} else {", "*(p++) = 0;", "*(p++) = 0x40;", "}", "s->int_level |= INT_RCV;", "smc91c111_update(s);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 27, 29 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 39, 41 ], [ 45, 47 ], [ 49 ], [ 51, 53 ], [ 55 ], [ 59 ], [ 63 ], [ 65, 67 ], [ 69, 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 87 ], [ 89 ], [ 93, 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 145 ], [ 147 ], [ 149 ] ]
12,689
void acpi_add_table(GArray *table_offsets, GArray *table_data) { uint32_t offset = cpu_to_le32(table_data->len); g_array_append_val(table_offsets, offset); }
false
qemu
4678124bb9bfb49e93b83f95c4d2feeb443ea38b
void acpi_add_table(GArray *table_offsets, GArray *table_data) { uint32_t offset = cpu_to_le32(table_data->len); g_array_append_val(table_offsets, offset); }
{ "code": [], "line_no": [] }
void FUNC_0(GArray *VAR_0, GArray *VAR_1) { uint32_t offset = cpu_to_le32(VAR_1->len); g_array_append_val(VAR_0, offset); }
[ "void FUNC_0(GArray *VAR_0, GArray *VAR_1)\n{", "uint32_t offset = cpu_to_le32(VAR_1->len);", "g_array_append_val(VAR_0, offset);", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
12,690
int cpu_is_bsp(CPUState *env) { return env->cpuid_apic_id == 0; }
false
qemu
6cb2996cef5e273ef370e690e84b5e1403f5c391
int cpu_is_bsp(CPUState *env) { return env->cpuid_apic_id == 0; }
{ "code": [], "line_no": [] }
int FUNC_0(CPUState *VAR_0) { return VAR_0->cpuid_apic_id == 0; }
[ "int FUNC_0(CPUState *VAR_0)\n{", "return VAR_0->cpuid_apic_id == 0;", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
12,691
static int mov_read_default(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) { int64_t total_size = 0; MOV_atom_t a; int i; int err = 0; a.offset = atom.offset; if (atom.size < 0) atom.size = INT64_MAX; while(((total_size + 8) < atom.size) && !url_feof(pb) && !err) { a.size = atom.size; a.type=0L; if(atom.size >= 8) { a.size = get_be32(pb); a.type = get_le32(pb); } total_size += 8; a.offset += 8; dprintf(c->fc, "type: %08x %.4s sz: %"PRIx64" %"PRIx64" %"PRIx64"\n", a.type, (char*)&a.type, a.size, atom.size, total_size); if (a.size == 1) { /* 64 bit extended size */ a.size = get_be64(pb) - 8; a.offset += 8; total_size += 8; } if (a.size == 0) { a.size = atom.size - total_size; if (a.size <= 8) break; } a.size -= 8; if(a.size < 0 || a.size > atom.size - total_size) break; for (i = 0; c->parse_table[i].type != 0L && c->parse_table[i].type != a.type; i++) /* empty */; if (c->parse_table[i].type == 0) { /* skip leaf atoms data */ url_fskip(pb, a.size); } else { offset_t start_pos = url_ftell(pb); int64_t left; err = (c->parse_table[i].func)(c, pb, a); left = a.size - url_ftell(pb) + start_pos; if (left > 0) /* skip garbage at atom end */ url_fskip(pb, left); } a.offset += a.size; total_size += a.size; } if (!err && total_size < atom.size && atom.size < 0x7ffff) { url_fskip(pb, atom.size - total_size); } return err; }
false
FFmpeg
8622613d9f74e0ce5e248905f3f554d26f6d6c06
static int mov_read_default(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) { int64_t total_size = 0; MOV_atom_t a; int i; int err = 0; a.offset = atom.offset; if (atom.size < 0) atom.size = INT64_MAX; while(((total_size + 8) < atom.size) && !url_feof(pb) && !err) { a.size = atom.size; a.type=0L; if(atom.size >= 8) { a.size = get_be32(pb); a.type = get_le32(pb); } total_size += 8; a.offset += 8; dprintf(c->fc, "type: %08x %.4s sz: %"PRIx64" %"PRIx64" %"PRIx64"\n", a.type, (char*)&a.type, a.size, atom.size, total_size); if (a.size == 1) { a.size = get_be64(pb) - 8; a.offset += 8; total_size += 8; } if (a.size == 0) { a.size = atom.size - total_size; if (a.size <= 8) break; } a.size -= 8; if(a.size < 0 || a.size > atom.size - total_size) break; for (i = 0; c->parse_table[i].type != 0L && c->parse_table[i].type != a.type; i++) ; if (c->parse_table[i].type == 0) { url_fskip(pb, a.size); } else { offset_t start_pos = url_ftell(pb); int64_t left; err = (c->parse_table[i].func)(c, pb, a); left = a.size - url_ftell(pb) + start_pos; if (left > 0) url_fskip(pb, left); } a.offset += a.size; total_size += a.size; } if (!err && total_size < atom.size && atom.size < 0x7ffff) { url_fskip(pb, atom.size - total_size); } return err; }
{ "code": [], "line_no": [] }
static int FUNC_0(MOVContext *VAR_0, ByteIOContext *VAR_1, MOV_atom_t VAR_2) { int64_t total_size = 0; MOV_atom_t a; int VAR_3; int VAR_4 = 0; a.offset = VAR_2.offset; if (VAR_2.size < 0) VAR_2.size = INT64_MAX; while(((total_size + 8) < VAR_2.size) && !url_feof(VAR_1) && !VAR_4) { a.size = VAR_2.size; a.type=0L; if(VAR_2.size >= 8) { a.size = get_be32(VAR_1); a.type = get_le32(VAR_1); } total_size += 8; a.offset += 8; dprintf(VAR_0->fc, "type: %08x %.4s sz: %"PRIx64" %"PRIx64" %"PRIx64"\n", a.type, (char*)&a.type, a.size, VAR_2.size, total_size); if (a.size == 1) { a.size = get_be64(VAR_1) - 8; a.offset += 8; total_size += 8; } if (a.size == 0) { a.size = VAR_2.size - total_size; if (a.size <= 8) break; } a.size -= 8; if(a.size < 0 || a.size > VAR_2.size - total_size) break; for (VAR_3 = 0; VAR_0->parse_table[VAR_3].type != 0L && VAR_0->parse_table[VAR_3].type != a.type; VAR_3++) ; if (VAR_0->parse_table[VAR_3].type == 0) { url_fskip(VAR_1, a.size); } else { offset_t start_pos = url_ftell(VAR_1); int64_t left; VAR_4 = (VAR_0->parse_table[VAR_3].func)(VAR_0, VAR_1, a); left = a.size - url_ftell(VAR_1) + start_pos; if (left > 0) url_fskip(VAR_1, left); } a.offset += a.size; total_size += a.size; } if (!VAR_4 && total_size < VAR_2.size && VAR_2.size < 0x7ffff) { url_fskip(VAR_1, VAR_2.size - total_size); } return VAR_4; }
[ "static int FUNC_0(MOVContext *VAR_0, ByteIOContext *VAR_1, MOV_atom_t VAR_2)\n{", "int64_t total_size = 0;", "MOV_atom_t a;", "int VAR_3;", "int VAR_4 = 0;", "a.offset = VAR_2.offset;", "if (VAR_2.size < 0)\nVAR_2.size = INT64_MAX;", "while(((total_size + 8) < VAR_2.size) && !url_feof(VAR_1) && !VAR_4) {", "a.size = VAR_2.size;", "a.type=0L;", "if(VAR_2.size >= 8) {", "a.size = get_be32(VAR_1);", "a.type = get_le32(VAR_1);", "}", "total_size += 8;", "a.offset += 8;", "dprintf(VAR_0->fc, \"type: %08x %.4s sz: %\"PRIx64\" %\"PRIx64\" %\"PRIx64\"\\n\", a.type, (char*)&a.type, a.size, VAR_2.size, total_size);", "if (a.size == 1) {", "a.size = get_be64(VAR_1) - 8;", "a.offset += 8;", "total_size += 8;", "}", "if (a.size == 0) {", "a.size = VAR_2.size - total_size;", "if (a.size <= 8)\nbreak;", "}", "a.size -= 8;", "if(a.size < 0 || a.size > VAR_2.size - total_size)\nbreak;", "for (VAR_3 = 0; VAR_0->parse_table[VAR_3].type != 0L", "&& VAR_0->parse_table[VAR_3].type != a.type; VAR_3++)", ";", "if (VAR_0->parse_table[VAR_3].type == 0) {", "url_fskip(VAR_1, a.size);", "} else {", "offset_t start_pos = url_ftell(VAR_1);", "int64_t left;", "VAR_4 = (VAR_0->parse_table[VAR_3].func)(VAR_0, VAR_1, a);", "left = a.size - url_ftell(VAR_1) + start_pos;", "if (left > 0)\nurl_fskip(VAR_1, left);", "}", "a.offset += a.size;", "total_size += a.size;", "}", "if (!VAR_4 && total_size < VAR_2.size && VAR_2.size < 0x7ffff) {", "url_fskip(VAR_1, VAR_2.size - total_size);", "}", "return VAR_4;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 19, 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57, 59 ], [ 61 ], [ 63 ], [ 65, 67 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93, 95 ], [ 97 ], [ 101 ], [ 103 ], [ 105 ], [ 109 ], [ 111 ], [ 113 ], [ 117 ], [ 119 ] ]
12,692
static int hyperv_handle_properties(CPUState *cs) { X86CPU *cpu = X86_CPU(cs); CPUX86State *env = &cpu->env; if (cpu->hyperv_relaxed_timing) { env->features[FEAT_HYPERV_EAX] |= HV_X64_MSR_HYPERCALL_AVAILABLE; } if (cpu->hyperv_vapic) { env->features[FEAT_HYPERV_EAX] |= HV_X64_MSR_HYPERCALL_AVAILABLE; env->features[FEAT_HYPERV_EAX] |= HV_X64_MSR_APIC_ACCESS_AVAILABLE; } if (cpu->hyperv_time && kvm_check_extension(cs->kvm_state, KVM_CAP_HYPERV_TIME) > 0) { env->features[FEAT_HYPERV_EAX] |= HV_X64_MSR_HYPERCALL_AVAILABLE; env->features[FEAT_HYPERV_EAX] |= HV_X64_MSR_TIME_REF_COUNT_AVAILABLE; env->features[FEAT_HYPERV_EAX] |= 0x200; has_msr_hv_tsc = true; } if (cpu->hyperv_crash && has_msr_hv_crash) { env->features[FEAT_HYPERV_EDX] |= HV_X64_GUEST_CRASH_MSR_AVAILABLE; } env->features[FEAT_HYPERV_EDX] |= HV_X64_CPU_DYNAMIC_PARTITIONING_AVAILABLE; if (cpu->hyperv_reset && has_msr_hv_reset) { env->features[FEAT_HYPERV_EAX] |= HV_X64_MSR_RESET_AVAILABLE; } if (cpu->hyperv_vpindex && has_msr_hv_vpindex) { env->features[FEAT_HYPERV_EAX] |= HV_X64_MSR_VP_INDEX_AVAILABLE; } if (cpu->hyperv_runtime && has_msr_hv_runtime) { env->features[FEAT_HYPERV_EAX] |= HV_X64_MSR_VP_RUNTIME_AVAILABLE; } if (cpu->hyperv_synic) { int sint; if (!has_msr_hv_synic || kvm_vcpu_enable_cap(cs, KVM_CAP_HYPERV_SYNIC, 0)) { fprintf(stderr, "Hyper-V SynIC is not supported by kernel\n"); return -ENOSYS; } env->features[FEAT_HYPERV_EAX] |= HV_X64_MSR_SYNIC_AVAILABLE; env->msr_hv_synic_version = HV_SYNIC_VERSION_1; for (sint = 0; sint < ARRAY_SIZE(env->msr_hv_synic_sint); sint++) { env->msr_hv_synic_sint[sint] = HV_SYNIC_SINT_MASKED; } } if (cpu->hyperv_stimer) { if (!has_msr_hv_stimer) { fprintf(stderr, "Hyper-V timers aren't supported by kernel\n"); return -ENOSYS; } env->features[FEAT_HYPERV_EAX] |= HV_X64_MSR_SYNTIMER_AVAILABLE; } return 0; }
false
qemu
3ddcd2edc8ca708ccd808a78424b9aadebd4f7c4
static int hyperv_handle_properties(CPUState *cs) { X86CPU *cpu = X86_CPU(cs); CPUX86State *env = &cpu->env; if (cpu->hyperv_relaxed_timing) { env->features[FEAT_HYPERV_EAX] |= HV_X64_MSR_HYPERCALL_AVAILABLE; } if (cpu->hyperv_vapic) { env->features[FEAT_HYPERV_EAX] |= HV_X64_MSR_HYPERCALL_AVAILABLE; env->features[FEAT_HYPERV_EAX] |= HV_X64_MSR_APIC_ACCESS_AVAILABLE; } if (cpu->hyperv_time && kvm_check_extension(cs->kvm_state, KVM_CAP_HYPERV_TIME) > 0) { env->features[FEAT_HYPERV_EAX] |= HV_X64_MSR_HYPERCALL_AVAILABLE; env->features[FEAT_HYPERV_EAX] |= HV_X64_MSR_TIME_REF_COUNT_AVAILABLE; env->features[FEAT_HYPERV_EAX] |= 0x200; has_msr_hv_tsc = true; } if (cpu->hyperv_crash && has_msr_hv_crash) { env->features[FEAT_HYPERV_EDX] |= HV_X64_GUEST_CRASH_MSR_AVAILABLE; } env->features[FEAT_HYPERV_EDX] |= HV_X64_CPU_DYNAMIC_PARTITIONING_AVAILABLE; if (cpu->hyperv_reset && has_msr_hv_reset) { env->features[FEAT_HYPERV_EAX] |= HV_X64_MSR_RESET_AVAILABLE; } if (cpu->hyperv_vpindex && has_msr_hv_vpindex) { env->features[FEAT_HYPERV_EAX] |= HV_X64_MSR_VP_INDEX_AVAILABLE; } if (cpu->hyperv_runtime && has_msr_hv_runtime) { env->features[FEAT_HYPERV_EAX] |= HV_X64_MSR_VP_RUNTIME_AVAILABLE; } if (cpu->hyperv_synic) { int sint; if (!has_msr_hv_synic || kvm_vcpu_enable_cap(cs, KVM_CAP_HYPERV_SYNIC, 0)) { fprintf(stderr, "Hyper-V SynIC is not supported by kernel\n"); return -ENOSYS; } env->features[FEAT_HYPERV_EAX] |= HV_X64_MSR_SYNIC_AVAILABLE; env->msr_hv_synic_version = HV_SYNIC_VERSION_1; for (sint = 0; sint < ARRAY_SIZE(env->msr_hv_synic_sint); sint++) { env->msr_hv_synic_sint[sint] = HV_SYNIC_SINT_MASKED; } } if (cpu->hyperv_stimer) { if (!has_msr_hv_stimer) { fprintf(stderr, "Hyper-V timers aren't supported by kernel\n"); return -ENOSYS; } env->features[FEAT_HYPERV_EAX] |= HV_X64_MSR_SYNTIMER_AVAILABLE; } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(CPUState *VAR_0) { X86CPU *cpu = X86_CPU(VAR_0); CPUX86State *env = &cpu->env; if (cpu->hyperv_relaxed_timing) { env->features[FEAT_HYPERV_EAX] |= HV_X64_MSR_HYPERCALL_AVAILABLE; } if (cpu->hyperv_vapic) { env->features[FEAT_HYPERV_EAX] |= HV_X64_MSR_HYPERCALL_AVAILABLE; env->features[FEAT_HYPERV_EAX] |= HV_X64_MSR_APIC_ACCESS_AVAILABLE; } if (cpu->hyperv_time && kvm_check_extension(VAR_0->kvm_state, KVM_CAP_HYPERV_TIME) > 0) { env->features[FEAT_HYPERV_EAX] |= HV_X64_MSR_HYPERCALL_AVAILABLE; env->features[FEAT_HYPERV_EAX] |= HV_X64_MSR_TIME_REF_COUNT_AVAILABLE; env->features[FEAT_HYPERV_EAX] |= 0x200; has_msr_hv_tsc = true; } if (cpu->hyperv_crash && has_msr_hv_crash) { env->features[FEAT_HYPERV_EDX] |= HV_X64_GUEST_CRASH_MSR_AVAILABLE; } env->features[FEAT_HYPERV_EDX] |= HV_X64_CPU_DYNAMIC_PARTITIONING_AVAILABLE; if (cpu->hyperv_reset && has_msr_hv_reset) { env->features[FEAT_HYPERV_EAX] |= HV_X64_MSR_RESET_AVAILABLE; } if (cpu->hyperv_vpindex && has_msr_hv_vpindex) { env->features[FEAT_HYPERV_EAX] |= HV_X64_MSR_VP_INDEX_AVAILABLE; } if (cpu->hyperv_runtime && has_msr_hv_runtime) { env->features[FEAT_HYPERV_EAX] |= HV_X64_MSR_VP_RUNTIME_AVAILABLE; } if (cpu->hyperv_synic) { int VAR_1; if (!has_msr_hv_synic || kvm_vcpu_enable_cap(VAR_0, KVM_CAP_HYPERV_SYNIC, 0)) { fprintf(stderr, "Hyper-V SynIC is not supported by kernel\n"); return -ENOSYS; } env->features[FEAT_HYPERV_EAX] |= HV_X64_MSR_SYNIC_AVAILABLE; env->msr_hv_synic_version = HV_SYNIC_VERSION_1; for (VAR_1 = 0; VAR_1 < ARRAY_SIZE(env->msr_hv_synic_sint); VAR_1++) { env->msr_hv_synic_sint[VAR_1] = HV_SYNIC_SINT_MASKED; } } if (cpu->hyperv_stimer) { if (!has_msr_hv_stimer) { fprintf(stderr, "Hyper-V timers aren't supported by kernel\n"); return -ENOSYS; } env->features[FEAT_HYPERV_EAX] |= HV_X64_MSR_SYNTIMER_AVAILABLE; } return 0; }
[ "static int FUNC_0(CPUState *VAR_0)\n{", "X86CPU *cpu = X86_CPU(VAR_0);", "CPUX86State *env = &cpu->env;", "if (cpu->hyperv_relaxed_timing) {", "env->features[FEAT_HYPERV_EAX] |= HV_X64_MSR_HYPERCALL_AVAILABLE;", "}", "if (cpu->hyperv_vapic) {", "env->features[FEAT_HYPERV_EAX] |= HV_X64_MSR_HYPERCALL_AVAILABLE;", "env->features[FEAT_HYPERV_EAX] |= HV_X64_MSR_APIC_ACCESS_AVAILABLE;", "}", "if (cpu->hyperv_time &&\nkvm_check_extension(VAR_0->kvm_state, KVM_CAP_HYPERV_TIME) > 0) {", "env->features[FEAT_HYPERV_EAX] |= HV_X64_MSR_HYPERCALL_AVAILABLE;", "env->features[FEAT_HYPERV_EAX] |= HV_X64_MSR_TIME_REF_COUNT_AVAILABLE;", "env->features[FEAT_HYPERV_EAX] |= 0x200;", "has_msr_hv_tsc = true;", "}", "if (cpu->hyperv_crash && has_msr_hv_crash) {", "env->features[FEAT_HYPERV_EDX] |= HV_X64_GUEST_CRASH_MSR_AVAILABLE;", "}", "env->features[FEAT_HYPERV_EDX] |= HV_X64_CPU_DYNAMIC_PARTITIONING_AVAILABLE;", "if (cpu->hyperv_reset && has_msr_hv_reset) {", "env->features[FEAT_HYPERV_EAX] |= HV_X64_MSR_RESET_AVAILABLE;", "}", "if (cpu->hyperv_vpindex && has_msr_hv_vpindex) {", "env->features[FEAT_HYPERV_EAX] |= HV_X64_MSR_VP_INDEX_AVAILABLE;", "}", "if (cpu->hyperv_runtime && has_msr_hv_runtime) {", "env->features[FEAT_HYPERV_EAX] |= HV_X64_MSR_VP_RUNTIME_AVAILABLE;", "}", "if (cpu->hyperv_synic) {", "int VAR_1;", "if (!has_msr_hv_synic ||\nkvm_vcpu_enable_cap(VAR_0, KVM_CAP_HYPERV_SYNIC, 0)) {", "fprintf(stderr, \"Hyper-V SynIC is not supported by kernel\\n\");", "return -ENOSYS;", "}", "env->features[FEAT_HYPERV_EAX] |= HV_X64_MSR_SYNIC_AVAILABLE;", "env->msr_hv_synic_version = HV_SYNIC_VERSION_1;", "for (VAR_1 = 0; VAR_1 < ARRAY_SIZE(env->msr_hv_synic_sint); VAR_1++) {", "env->msr_hv_synic_sint[VAR_1] = HV_SYNIC_SINT_MASKED;", "}", "}", "if (cpu->hyperv_stimer) {", "if (!has_msr_hv_stimer) {", "fprintf(stderr, \"Hyper-V timers aren't supported by kernel\\n\");", "return -ENOSYS;", "}", "env->features[FEAT_HYPERV_EAX] |= HV_X64_MSR_SYNTIMER_AVAILABLE;", "}", "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 ]
[ [ 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 ], [ 71, 73 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ] ]
12,693
static void network_to_compress(RDMACompress *comp) { comp->value = ntohl(comp->value); comp->block_idx = ntohl(comp->block_idx); comp->offset = ntohll(comp->offset); comp->length = ntohll(comp->length); }
true
qemu
60fe637bf0e4d7989e21e50f52526444765c63b4
static void network_to_compress(RDMACompress *comp) { comp->value = ntohl(comp->value); comp->block_idx = ntohl(comp->block_idx); comp->offset = ntohll(comp->offset); comp->length = ntohll(comp->length); }
{ "code": [], "line_no": [] }
static void FUNC_0(RDMACompress *VAR_0) { VAR_0->value = ntohl(VAR_0->value); VAR_0->block_idx = ntohl(VAR_0->block_idx); VAR_0->offset = ntohll(VAR_0->offset); VAR_0->length = ntohll(VAR_0->length); }
[ "static void FUNC_0(RDMACompress *VAR_0)\n{", "VAR_0->value = ntohl(VAR_0->value);", "VAR_0->block_idx = ntohl(VAR_0->block_idx);", "VAR_0->offset = ntohll(VAR_0->offset);", "VAR_0->length = ntohll(VAR_0->length);", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ] ]
12,694
void spapr_drc_attach(sPAPRDRConnector *drc, DeviceState *d, void *fdt, int fdt_start_offset, Error **errp) { trace_spapr_drc_attach(spapr_drc_index(drc)); if (drc->isolation_state != SPAPR_DR_ISOLATION_STATE_ISOLATED) { error_setg(errp, "an attached device is still awaiting release"); return; } if (spapr_drc_type(drc) == SPAPR_DR_CONNECTOR_TYPE_PCI) { g_assert(drc->allocation_state == SPAPR_DR_ALLOCATION_STATE_USABLE); } g_assert(fdt); drc->dev = d; drc->fdt = fdt; drc->fdt_start_offset = fdt_start_offset; if (spapr_drc_type(drc) != SPAPR_DR_CONNECTOR_TYPE_PCI) { drc->awaiting_allocation = true; } object_property_add_link(OBJECT(drc), "device", object_get_typename(OBJECT(drc->dev)), (Object **)(&drc->dev), NULL, 0, NULL); }
true
qemu
82a93a1d307064f35c363f79b04b0a0149ac53d9
void spapr_drc_attach(sPAPRDRConnector *drc, DeviceState *d, void *fdt, int fdt_start_offset, Error **errp) { trace_spapr_drc_attach(spapr_drc_index(drc)); if (drc->isolation_state != SPAPR_DR_ISOLATION_STATE_ISOLATED) { error_setg(errp, "an attached device is still awaiting release"); return; } if (spapr_drc_type(drc) == SPAPR_DR_CONNECTOR_TYPE_PCI) { g_assert(drc->allocation_state == SPAPR_DR_ALLOCATION_STATE_USABLE); } g_assert(fdt); drc->dev = d; drc->fdt = fdt; drc->fdt_start_offset = fdt_start_offset; if (spapr_drc_type(drc) != SPAPR_DR_CONNECTOR_TYPE_PCI) { drc->awaiting_allocation = true; } object_property_add_link(OBJECT(drc), "device", object_get_typename(OBJECT(drc->dev)), (Object **)(&drc->dev), NULL, 0, NULL); }
{ "code": [ " if (spapr_drc_type(drc) != SPAPR_DR_CONNECTOR_TYPE_PCI) {", " drc->awaiting_allocation = true;" ], "line_no": [ 37, 39 ] }
void FUNC_0(sPAPRDRConnector *VAR_0, DeviceState *VAR_1, void *VAR_2, int VAR_3, Error **VAR_4) { trace_spapr_drc_attach(spapr_drc_index(VAR_0)); if (VAR_0->isolation_state != SPAPR_DR_ISOLATION_STATE_ISOLATED) { error_setg(VAR_4, "an attached device is still awaiting release"); return; } if (spapr_drc_type(VAR_0) == SPAPR_DR_CONNECTOR_TYPE_PCI) { g_assert(VAR_0->allocation_state == SPAPR_DR_ALLOCATION_STATE_USABLE); } g_assert(VAR_2); VAR_0->dev = VAR_1; VAR_0->VAR_2 = VAR_2; VAR_0->VAR_3 = VAR_3; if (spapr_drc_type(VAR_0) != SPAPR_DR_CONNECTOR_TYPE_PCI) { VAR_0->awaiting_allocation = true; } object_property_add_link(OBJECT(VAR_0), "device", object_get_typename(OBJECT(VAR_0->dev)), (Object **)(&VAR_0->dev), NULL, 0, NULL); }
[ "void FUNC_0(sPAPRDRConnector *VAR_0, DeviceState *VAR_1, void *VAR_2,\nint VAR_3, Error **VAR_4)\n{", "trace_spapr_drc_attach(spapr_drc_index(VAR_0));", "if (VAR_0->isolation_state != SPAPR_DR_ISOLATION_STATE_ISOLATED) {", "error_setg(VAR_4, \"an attached device is still awaiting release\");", "return;", "}", "if (spapr_drc_type(VAR_0) == SPAPR_DR_CONNECTOR_TYPE_PCI) {", "g_assert(VAR_0->allocation_state == SPAPR_DR_ALLOCATION_STATE_USABLE);", "}", "g_assert(VAR_2);", "VAR_0->dev = VAR_1;", "VAR_0->VAR_2 = VAR_2;", "VAR_0->VAR_3 = VAR_3;", "if (spapr_drc_type(VAR_0) != SPAPR_DR_CONNECTOR_TYPE_PCI) {", "VAR_0->awaiting_allocation = true;", "}", "object_property_add_link(OBJECT(VAR_0), \"device\",\nobject_get_typename(OBJECT(VAR_0->dev)),\n(Object **)(&VAR_0->dev),\nNULL, 0, NULL);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 45, 47, 49, 51 ], [ 53 ] ]
12,695
int avfilter_graph_queue_command(AVFilterGraph *graph, const char *target, const char *command, const char *arg, int flags, double ts) { int i; if(!graph) return 0; for (i = 0; i < graph->nb_filters; i++) { AVFilterContext *filter = graph->filters[i]; if(filter && (!strcmp(target, "all") || !strcmp(target, filter->name) || !strcmp(target, filter->filter->name))){ AVFilterCommand **queue = &filter->command_queue, *next; while (*queue && (*queue)->time <= ts) queue = &(*queue)->next; next = *queue; *queue = av_mallocz(sizeof(AVFilterCommand)); (*queue)->command = av_strdup(command); (*queue)->arg = av_strdup(arg); (*queue)->time = ts; (*queue)->flags = flags; (*queue)->next = next; if(flags & AVFILTER_CMD_FLAG_ONE) return 0; } } return 0; }
true
FFmpeg
55d53cb59380bebea79ae8f99d4e119b2b006629
int avfilter_graph_queue_command(AVFilterGraph *graph, const char *target, const char *command, const char *arg, int flags, double ts) { int i; if(!graph) return 0; for (i = 0; i < graph->nb_filters; i++) { AVFilterContext *filter = graph->filters[i]; if(filter && (!strcmp(target, "all") || !strcmp(target, filter->name) || !strcmp(target, filter->filter->name))){ AVFilterCommand **queue = &filter->command_queue, *next; while (*queue && (*queue)->time <= ts) queue = &(*queue)->next; next = *queue; *queue = av_mallocz(sizeof(AVFilterCommand)); (*queue)->command = av_strdup(command); (*queue)->arg = av_strdup(arg); (*queue)->time = ts; (*queue)->flags = flags; (*queue)->next = next; if(flags & AVFILTER_CMD_FLAG_ONE) return 0; } } return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(AVFilterGraph *VAR_0, const char *VAR_1, const char *VAR_2, const char *VAR_3, int VAR_4, double VAR_5) { int VAR_6; if(!VAR_0) return 0; for (VAR_6 = 0; VAR_6 < VAR_0->nb_filters; VAR_6++) { AVFilterContext *filter = VAR_0->filters[VAR_6]; if(filter && (!strcmp(VAR_1, "all") || !strcmp(VAR_1, filter->name) || !strcmp(VAR_1, filter->filter->name))){ AVFilterCommand **queue = &filter->command_queue, *next; while (*queue && (*queue)->time <= VAR_5) queue = &(*queue)->next; next = *queue; *queue = av_mallocz(sizeof(AVFilterCommand)); (*queue)->VAR_2 = av_strdup(VAR_2); (*queue)->VAR_3 = av_strdup(VAR_3); (*queue)->time = VAR_5; (*queue)->VAR_4 = VAR_4; (*queue)->next = next; if(VAR_4 & AVFILTER_CMD_FLAG_ONE) return 0; } } return 0; }
[ "int FUNC_0(AVFilterGraph *VAR_0, const char *VAR_1, const char *VAR_2, const char *VAR_3, int VAR_4, double VAR_5)\n{", "int VAR_6;", "if(!VAR_0)\nreturn 0;", "for (VAR_6 = 0; VAR_6 < VAR_0->nb_filters; VAR_6++) {", "AVFilterContext *filter = VAR_0->filters[VAR_6];", "if(filter && (!strcmp(VAR_1, \"all\") || !strcmp(VAR_1, filter->name) || !strcmp(VAR_1, filter->filter->name))){", "AVFilterCommand **queue = &filter->command_queue, *next;", "while (*queue && (*queue)->time <= VAR_5)\nqueue = &(*queue)->next;", "next = *queue;", "*queue = av_mallocz(sizeof(AVFilterCommand));", "(*queue)->VAR_2 = av_strdup(VAR_2);", "(*queue)->VAR_3 = av_strdup(VAR_3);", "(*queue)->time = VAR_5;", "(*queue)->VAR_4 = VAR_4;", "(*queue)->next = next;", "if(VAR_4 & AVFILTER_CMD_FLAG_ONE)\nreturn 0;", "}", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2 ], [ 3 ], [ 4, 5 ], [ 6 ], [ 7 ], [ 8 ], [ 9 ], [ 10, 11 ], [ 12 ], [ 13 ], [ 14 ], [ 15 ], [ 16 ], [ 17 ], [ 18 ], [ 19, 20 ], [ 21 ], [ 22 ], [ 23 ], [ 24 ] ]
12,696
static av_cold int hevc_decode_init(AVCodecContext *avctx) { HEVCContext *s = avctx->priv_data; int ret; avctx->internal->allocate_progress = 1; ret = hevc_init_context(avctx); if (ret < 0) return ret; s->enable_parallel_tiles = 0; s->sei.picture_timing.picture_struct = 0; s->eos = 1; atomic_init(&s->wpp_err, 0); if(avctx->active_thread_type & FF_THREAD_SLICE) s->threads_number = avctx->thread_count; else s->threads_number = 1; if (avctx->extradata_size > 0 && avctx->extradata) { ret = hevc_decode_extradata(s, avctx->extradata, avctx->extradata_size); if (ret < 0) { hevc_decode_free(avctx); return ret; } } if((avctx->active_thread_type & FF_THREAD_FRAME) && avctx->thread_count > 1) s->threads_type = FF_THREAD_FRAME; else s->threads_type = FF_THREAD_SLICE; return 0; }
true
FFmpeg
c8cfbc6629c1fe5755b59a3bcfd95ad08b843a07
static av_cold int hevc_decode_init(AVCodecContext *avctx) { HEVCContext *s = avctx->priv_data; int ret; avctx->internal->allocate_progress = 1; ret = hevc_init_context(avctx); if (ret < 0) return ret; s->enable_parallel_tiles = 0; s->sei.picture_timing.picture_struct = 0; s->eos = 1; atomic_init(&s->wpp_err, 0); if(avctx->active_thread_type & FF_THREAD_SLICE) s->threads_number = avctx->thread_count; else s->threads_number = 1; if (avctx->extradata_size > 0 && avctx->extradata) { ret = hevc_decode_extradata(s, avctx->extradata, avctx->extradata_size); if (ret < 0) { hevc_decode_free(avctx); return ret; } } if((avctx->active_thread_type & FF_THREAD_FRAME) && avctx->thread_count > 1) s->threads_type = FF_THREAD_FRAME; else s->threads_type = FF_THREAD_SLICE; return 0; }
{ "code": [ " ret = hevc_decode_extradata(s, avctx->extradata, avctx->extradata_size);" ], "line_no": [ 47 ] }
static av_cold int FUNC_0(AVCodecContext *avctx) { HEVCContext *s = avctx->priv_data; int VAR_0; avctx->internal->allocate_progress = 1; VAR_0 = hevc_init_context(avctx); if (VAR_0 < 0) return VAR_0; s->enable_parallel_tiles = 0; s->sei.picture_timing.picture_struct = 0; s->eos = 1; atomic_init(&s->wpp_err, 0); if(avctx->active_thread_type & FF_THREAD_SLICE) s->threads_number = avctx->thread_count; else s->threads_number = 1; if (avctx->extradata_size > 0 && avctx->extradata) { VAR_0 = hevc_decode_extradata(s, avctx->extradata, avctx->extradata_size); if (VAR_0 < 0) { hevc_decode_free(avctx); return VAR_0; } } if((avctx->active_thread_type & FF_THREAD_FRAME) && avctx->thread_count > 1) s->threads_type = FF_THREAD_FRAME; else s->threads_type = FF_THREAD_SLICE; return 0; }
[ "static av_cold int FUNC_0(AVCodecContext *avctx)\n{", "HEVCContext *s = avctx->priv_data;", "int VAR_0;", "avctx->internal->allocate_progress = 1;", "VAR_0 = hevc_init_context(avctx);", "if (VAR_0 < 0)\nreturn VAR_0;", "s->enable_parallel_tiles = 0;", "s->sei.picture_timing.picture_struct = 0;", "s->eos = 1;", "atomic_init(&s->wpp_err, 0);", "if(avctx->active_thread_type & FF_THREAD_SLICE)\ns->threads_number = avctx->thread_count;", "else\ns->threads_number = 1;", "if (avctx->extradata_size > 0 && avctx->extradata) {", "VAR_0 = hevc_decode_extradata(s, avctx->extradata, avctx->extradata_size);", "if (VAR_0 < 0) {", "hevc_decode_free(avctx);", "return VAR_0;", "}", "}", "if((avctx->active_thread_type & FF_THREAD_FRAME) && avctx->thread_count > 1)\ns->threads_type = FF_THREAD_FRAME;", "else\ns->threads_type = FF_THREAD_SLICE;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 15 ], [ 17, 19 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 35, 37 ], [ 39, 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61, 63 ], [ 65, 67 ], [ 71 ], [ 73 ] ]
12,697
void dsputil_init_armv4l(DSPContext* c, AVCodecContext *avctx) { const int idct_algo= avctx->idct_algo; ff_put_pixels_clamped = c->put_pixels_clamped; ff_add_pixels_clamped = c->add_pixels_clamped; if(idct_algo==FF_IDCT_ARM){ if(idct_algo==FF_IDCT_AUTO || idct_algo==FF_IDCT_ARM){ c->idct_put= j_rev_dct_ARM_put; c->idct_add= j_rev_dct_ARM_add; c->idct = j_rev_dct_ARM; c->idct_permutation_type= FF_LIBMPEG2_IDCT_PERM;/* FF_NO_IDCT_PERM */ } else if (idct_algo==FF_IDCT_SIMPLEARM){ c->idct_put= simple_idct_ARM_put; c->idct_add= simple_idct_ARM_add; c->idct = simple_idct_ARM; } }
true
FFmpeg
6ad1fa5a49320c101a62d24aa0e7df14c10d7612
void dsputil_init_armv4l(DSPContext* c, AVCodecContext *avctx) { const int idct_algo= avctx->idct_algo; ff_put_pixels_clamped = c->put_pixels_clamped; ff_add_pixels_clamped = c->add_pixels_clamped; if(idct_algo==FF_IDCT_ARM){ if(idct_algo==FF_IDCT_AUTO || idct_algo==FF_IDCT_ARM){ c->idct_put= j_rev_dct_ARM_put; c->idct_add= j_rev_dct_ARM_add; c->idct = j_rev_dct_ARM; c->idct_permutation_type= FF_LIBMPEG2_IDCT_PERM; } else if (idct_algo==FF_IDCT_SIMPLEARM){ c->idct_put= simple_idct_ARM_put; c->idct_add= simple_idct_ARM_add; c->idct = simple_idct_ARM; } }
{ "code": [], "line_no": [] }
void FUNC_0(DSPContext* VAR_0, AVCodecContext *VAR_1) { const int VAR_2= VAR_1->VAR_2; ff_put_pixels_clamped = VAR_0->put_pixels_clamped; ff_add_pixels_clamped = VAR_0->add_pixels_clamped; if(VAR_2==FF_IDCT_ARM){ if(VAR_2==FF_IDCT_AUTO || VAR_2==FF_IDCT_ARM){ VAR_0->idct_put= j_rev_dct_ARM_put; VAR_0->idct_add= j_rev_dct_ARM_add; VAR_0->idct = j_rev_dct_ARM; VAR_0->idct_permutation_type= FF_LIBMPEG2_IDCT_PERM; } else if (VAR_2==FF_IDCT_SIMPLEARM){ VAR_0->idct_put= simple_idct_ARM_put; VAR_0->idct_add= simple_idct_ARM_add; VAR_0->idct = simple_idct_ARM; } }
[ "void FUNC_0(DSPContext* VAR_0, AVCodecContext *VAR_1)\n{", "const int VAR_2= VAR_1->VAR_2;", "ff_put_pixels_clamped = VAR_0->put_pixels_clamped;", "ff_add_pixels_clamped = VAR_0->add_pixels_clamped;", "if(VAR_2==FF_IDCT_ARM){", "if(VAR_2==FF_IDCT_AUTO || VAR_2==FF_IDCT_ARM){", "VAR_0->idct_put= j_rev_dct_ARM_put;", "VAR_0->idct_add= j_rev_dct_ARM_add;", "VAR_0->idct = j_rev_dct_ARM;", "VAR_0->idct_permutation_type= FF_LIBMPEG2_IDCT_PERM;", "} else if (VAR_2==FF_IDCT_SIMPLEARM){", "VAR_0->idct_put= simple_idct_ARM_put;", "VAR_0->idct_add= simple_idct_ARM_add;", "VAR_0->idct = simple_idct_ARM;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2 ], [ 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ], [ 8 ], [ 9 ], [ 10 ], [ 11 ], [ 12 ], [ 13 ], [ 14 ], [ 15 ], [ 16 ], [ 17 ] ]
12,698
static void test_qemu_strtoull_underflow(void) { const char *str = "-99999999999999999999999999999999999999999999"; char f = 'X'; const char *endptr = &f; uint64_t res = 999; int err; err = qemu_strtoull(str, &endptr, 0, &res); g_assert_cmpint(err, ==, -ERANGE); g_assert_cmpint(res, ==, -1); g_assert(endptr == str + strlen(str)); }
false
qemu
bc7c08a2c375acb7ae4d433054415588b176d34c
static void test_qemu_strtoull_underflow(void) { const char *str = "-99999999999999999999999999999999999999999999"; char f = 'X'; const char *endptr = &f; uint64_t res = 999; int err; err = qemu_strtoull(str, &endptr, 0, &res); g_assert_cmpint(err, ==, -ERANGE); g_assert_cmpint(res, ==, -1); g_assert(endptr == str + strlen(str)); }
{ "code": [], "line_no": [] }
static void FUNC_0(void) { const char *VAR_0 = "-99999999999999999999999999999999999999999999"; char VAR_1 = 'X'; const char *VAR_2 = &VAR_1; uint64_t res = 999; int VAR_3; VAR_3 = qemu_strtoull(VAR_0, &VAR_2, 0, &res); g_assert_cmpint(VAR_3, ==, -ERANGE); g_assert_cmpint(res, ==, -1); g_assert(VAR_2 == VAR_0 + strlen(VAR_0)); }
[ "static void FUNC_0(void)\n{", "const char *VAR_0 = \"-99999999999999999999999999999999999999999999\";", "char VAR_1 = 'X';", "const char *VAR_2 = &VAR_1;", "uint64_t res = 999;", "int VAR_3;", "VAR_3 = qemu_strtoull(VAR_0, &VAR_2, 0, &res);", "g_assert_cmpint(VAR_3, ==, -ERANGE);", "g_assert_cmpint(res, ==, -1);", "g_assert(VAR_2 == VAR_0 + strlen(VAR_0));", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ] ]
12,699
static int vtd_remap_irq_get(IntelIOMMUState *iommu, uint16_t index, VTDIrq *irq) { VTD_IRTE irte = {}; int ret = 0; ret = vtd_irte_get(iommu, index, &irte); if (ret) { return ret; } irq->trigger_mode = irte.trigger_mode; irq->vector = irte.vector; irq->delivery_mode = irte.delivery_mode; irq->dest = le32_to_cpu(irte.dest_id); if (!iommu->intr_eime) { #define VTD_IR_APIC_DEST_MASK (0xff00ULL) #define VTD_IR_APIC_DEST_SHIFT (8) irq->dest = (irq->dest & VTD_IR_APIC_DEST_MASK) >> VTD_IR_APIC_DEST_SHIFT; } irq->dest_mode = irte.dest_mode; irq->redir_hint = irte.redir_hint; VTD_DPRINTF(IR, "remapping interrupt index %d: trig:%u,vec:%u," "deliver:%u,dest:%u,dest_mode:%u", index, irq->trigger_mode, irq->vector, irq->delivery_mode, irq->dest, irq->dest_mode); return 0; }
false
qemu
ede9c94acf6cd1968de4188c0228b714ab871a86
static int vtd_remap_irq_get(IntelIOMMUState *iommu, uint16_t index, VTDIrq *irq) { VTD_IRTE irte = {}; int ret = 0; ret = vtd_irte_get(iommu, index, &irte); if (ret) { return ret; } irq->trigger_mode = irte.trigger_mode; irq->vector = irte.vector; irq->delivery_mode = irte.delivery_mode; irq->dest = le32_to_cpu(irte.dest_id); if (!iommu->intr_eime) { #define VTD_IR_APIC_DEST_MASK (0xff00ULL) #define VTD_IR_APIC_DEST_SHIFT (8) irq->dest = (irq->dest & VTD_IR_APIC_DEST_MASK) >> VTD_IR_APIC_DEST_SHIFT; } irq->dest_mode = irte.dest_mode; irq->redir_hint = irte.redir_hint; VTD_DPRINTF(IR, "remapping interrupt index %d: trig:%u,vec:%u," "deliver:%u,dest:%u,dest_mode:%u", index, irq->trigger_mode, irq->vector, irq->delivery_mode, irq->dest, irq->dest_mode); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(IntelIOMMUState *VAR_0, uint16_t VAR_1, VTDIrq *VAR_2) { VTD_IRTE irte = {}; int VAR_3 = 0; VAR_3 = vtd_irte_get(VAR_0, VAR_1, &irte); if (VAR_3) { return VAR_3; } VAR_2->trigger_mode = irte.trigger_mode; VAR_2->vector = irte.vector; VAR_2->delivery_mode = irte.delivery_mode; VAR_2->dest = le32_to_cpu(irte.dest_id); if (!VAR_0->intr_eime) { #define VTD_IR_APIC_DEST_MASK (0xff00ULL) #define VTD_IR_APIC_DEST_SHIFT (8) VAR_2->dest = (VAR_2->dest & VTD_IR_APIC_DEST_MASK) >> VTD_IR_APIC_DEST_SHIFT; } VAR_2->dest_mode = irte.dest_mode; VAR_2->redir_hint = irte.redir_hint; VTD_DPRINTF(IR, "remapping interrupt VAR_1 %d: trig:%u,vec:%u," "deliver:%u,dest:%u,dest_mode:%u", VAR_1, VAR_2->trigger_mode, VAR_2->vector, VAR_2->delivery_mode, VAR_2->dest, VAR_2->dest_mode); return 0; }
[ "static int FUNC_0(IntelIOMMUState *VAR_0, uint16_t VAR_1, VTDIrq *VAR_2)\n{", "VTD_IRTE irte = {};", "int VAR_3 = 0;", "VAR_3 = vtd_irte_get(VAR_0, VAR_1, &irte);", "if (VAR_3) {", "return VAR_3;", "}", "VAR_2->trigger_mode = irte.trigger_mode;", "VAR_2->vector = irte.vector;", "VAR_2->delivery_mode = irte.delivery_mode;", "VAR_2->dest = le32_to_cpu(irte.dest_id);", "if (!VAR_0->intr_eime) {", "#define VTD_IR_APIC_DEST_MASK (0xff00ULL)\n#define VTD_IR_APIC_DEST_SHIFT (8)\nVAR_2->dest = (VAR_2->dest & VTD_IR_APIC_DEST_MASK) >>\nVTD_IR_APIC_DEST_SHIFT;", "}", "VAR_2->dest_mode = irte.dest_mode;", "VAR_2->redir_hint = irte.redir_hint;", "VTD_DPRINTF(IR, \"remapping interrupt VAR_1 %d: trig:%u,vec:%u,\"\n\"deliver:%u,dest:%u,dest_mode:%u\", VAR_1,\nVAR_2->trigger_mode, VAR_2->vector, VAR_2->delivery_mode,\nVAR_2->dest, VAR_2->dest_mode);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31, 33, 35, 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47, 49, 51, 53 ], [ 57 ], [ 59 ] ]
12,700
static void nvdimm_build_ssdt(GSList *device_list, GArray *table_offsets, GArray *table_data, GArray *linker) { Aml *ssdt, *sb_scope, *dev; acpi_add_table(table_offsets, table_data); ssdt = init_aml_allocator(); acpi_data_push(ssdt->buf, sizeof(AcpiTableHeader)); sb_scope = aml_scope("\\_SB"); dev = aml_device("NVDR"); /* * ACPI 6.0: 9.20 NVDIMM Devices: * * The ACPI Name Space device uses _HID of ACPI0012 to identify the root * NVDIMM interface device. Platform firmware is required to contain one * such device in _SB scope if NVDIMMs support is exposed by platform to * OSPM. * For each NVDIMM present or intended to be supported by platform, * platform firmware also exposes an ACPI Namespace Device under the * root device. */ aml_append(dev, aml_name_decl("_HID", aml_string("ACPI0012"))); nvdimm_build_common_dsm(dev); nvdimm_build_device_dsm(dev); nvdimm_build_nvdimm_devices(device_list, dev); aml_append(sb_scope, dev); aml_append(ssdt, sb_scope); /* copy AML table into ACPI tables blob and patch header there */ g_array_append_vals(table_data, ssdt->buf->data, ssdt->buf->len); build_header(linker, table_data, (void *)(table_data->data + table_data->len - ssdt->buf->len), "SSDT", ssdt->buf->len, 1, "NVDIMM"); free_aml_allocator(); }
false
qemu
37ad223c515da2fe9f1c679768cb5ccaa42e57e1
static void nvdimm_build_ssdt(GSList *device_list, GArray *table_offsets, GArray *table_data, GArray *linker) { Aml *ssdt, *sb_scope, *dev; acpi_add_table(table_offsets, table_data); ssdt = init_aml_allocator(); acpi_data_push(ssdt->buf, sizeof(AcpiTableHeader)); sb_scope = aml_scope("\\_SB"); dev = aml_device("NVDR"); aml_append(dev, aml_name_decl("_HID", aml_string("ACPI0012"))); nvdimm_build_common_dsm(dev); nvdimm_build_device_dsm(dev); nvdimm_build_nvdimm_devices(device_list, dev); aml_append(sb_scope, dev); aml_append(ssdt, sb_scope); g_array_append_vals(table_data, ssdt->buf->data, ssdt->buf->len); build_header(linker, table_data, (void *)(table_data->data + table_data->len - ssdt->buf->len), "SSDT", ssdt->buf->len, 1, "NVDIMM"); free_aml_allocator(); }
{ "code": [], "line_no": [] }
static void FUNC_0(GSList *VAR_0, GArray *VAR_1, GArray *VAR_2, GArray *VAR_3) { Aml *ssdt, *sb_scope, *dev; acpi_add_table(VAR_1, VAR_2); ssdt = init_aml_allocator(); acpi_data_push(ssdt->buf, sizeof(AcpiTableHeader)); sb_scope = aml_scope("\\_SB"); dev = aml_device("NVDR"); aml_append(dev, aml_name_decl("_HID", aml_string("ACPI0012"))); nvdimm_build_common_dsm(dev); nvdimm_build_device_dsm(dev); nvdimm_build_nvdimm_devices(VAR_0, dev); aml_append(sb_scope, dev); aml_append(ssdt, sb_scope); g_array_append_vals(VAR_2, ssdt->buf->data, ssdt->buf->len); build_header(VAR_3, VAR_2, (void *)(VAR_2->data + VAR_2->len - ssdt->buf->len), "SSDT", ssdt->buf->len, 1, "NVDIMM"); free_aml_allocator(); }
[ "static void FUNC_0(GSList *VAR_0, GArray *VAR_1,\nGArray *VAR_2, GArray *VAR_3)\n{", "Aml *ssdt, *sb_scope, *dev;", "acpi_add_table(VAR_1, VAR_2);", "ssdt = init_aml_allocator();", "acpi_data_push(ssdt->buf, sizeof(AcpiTableHeader));", "sb_scope = aml_scope(\"\\\\_SB\");", "dev = aml_device(\"NVDR\");", "aml_append(dev, aml_name_decl(\"_HID\", aml_string(\"ACPI0012\")));", "nvdimm_build_common_dsm(dev);", "nvdimm_build_device_dsm(dev);", "nvdimm_build_nvdimm_devices(VAR_0, dev);", "aml_append(sb_scope, dev);", "aml_append(ssdt, sb_scope);", "g_array_append_vals(VAR_2, ssdt->buf->data, ssdt->buf->len);", "build_header(VAR_3, VAR_2,\n(void *)(VAR_2->data + VAR_2->len - ssdt->buf->len),\n\"SSDT\", ssdt->buf->len, 1, \"NVDIMM\");", "free_aml_allocator();", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 15 ], [ 17 ], [ 21 ], [ 25 ], [ 51 ], [ 55 ], [ 57 ], [ 61 ], [ 65 ], [ 69 ], [ 73 ], [ 75, 77, 79 ], [ 81 ], [ 83 ] ]
12,703
static void nvdimm_build_structure_dcr(GArray *structures, DeviceState *dev) { NvdimmNfitControlRegion *nfit_dcr; int slot = object_property_get_int(OBJECT(dev), PC_DIMM_SLOT_PROP, NULL); uint32_t sn = nvdimm_slot_to_sn(slot); nfit_dcr = acpi_data_push(structures, sizeof(*nfit_dcr)); nfit_dcr->type = cpu_to_le16(4 /* NVDIMM Control Region Structure */); nfit_dcr->length = cpu_to_le16(sizeof(*nfit_dcr)); nfit_dcr->dcr_index = cpu_to_le16(nvdimm_slot_to_dcr_index(slot)); /* vendor: Intel. */ nfit_dcr->vendor_id = cpu_to_le16(0x8086); nfit_dcr->device_id = cpu_to_le16(1); /* The _DSM method is following Intel's DSM specification. */ nfit_dcr->revision_id = cpu_to_le16(1 /* Current Revision supported in ACPI 6.0 is 1. */); nfit_dcr->serial_number = cpu_to_le32(sn); nfit_dcr->fic = cpu_to_le16(0x201 /* Format Interface Code. See Chapter 2: NVDIMM Device Specific Method (DSM) in DSM Spec Rev1.*/); }
false
qemu
20fdef58a0daa8da21438b79663f7ada2c59ebbc
static void nvdimm_build_structure_dcr(GArray *structures, DeviceState *dev) { NvdimmNfitControlRegion *nfit_dcr; int slot = object_property_get_int(OBJECT(dev), PC_DIMM_SLOT_PROP, NULL); uint32_t sn = nvdimm_slot_to_sn(slot); nfit_dcr = acpi_data_push(structures, sizeof(*nfit_dcr)); nfit_dcr->type = cpu_to_le16(4 ); nfit_dcr->length = cpu_to_le16(sizeof(*nfit_dcr)); nfit_dcr->dcr_index = cpu_to_le16(nvdimm_slot_to_dcr_index(slot)); nfit_dcr->vendor_id = cpu_to_le16(0x8086); nfit_dcr->device_id = cpu_to_le16(1); nfit_dcr->revision_id = cpu_to_le16(1 ); nfit_dcr->serial_number = cpu_to_le32(sn); nfit_dcr->fic = cpu_to_le16(0x201 ); }
{ "code": [], "line_no": [] }
static void FUNC_0(GArray *VAR_0, DeviceState *VAR_1) { NvdimmNfitControlRegion *nfit_dcr; int VAR_2 = object_property_get_int(OBJECT(VAR_1), PC_DIMM_SLOT_PROP, NULL); uint32_t sn = nvdimm_slot_to_sn(VAR_2); nfit_dcr = acpi_data_push(VAR_0, sizeof(*nfit_dcr)); nfit_dcr->type = cpu_to_le16(4 ); nfit_dcr->length = cpu_to_le16(sizeof(*nfit_dcr)); nfit_dcr->dcr_index = cpu_to_le16(nvdimm_slot_to_dcr_index(VAR_2)); nfit_dcr->vendor_id = cpu_to_le16(0x8086); nfit_dcr->device_id = cpu_to_le16(1); nfit_dcr->revision_id = cpu_to_le16(1 ); nfit_dcr->serial_number = cpu_to_le32(sn); nfit_dcr->fic = cpu_to_le16(0x201 ); }
[ "static void FUNC_0(GArray *VAR_0, DeviceState *VAR_1)\n{", "NvdimmNfitControlRegion *nfit_dcr;", "int VAR_2 = object_property_get_int(OBJECT(VAR_1), PC_DIMM_SLOT_PROP,\nNULL);", "uint32_t sn = nvdimm_slot_to_sn(VAR_2);", "nfit_dcr = acpi_data_push(VAR_0, sizeof(*nfit_dcr));", "nfit_dcr->type = cpu_to_le16(4 );", "nfit_dcr->length = cpu_to_le16(sizeof(*nfit_dcr));", "nfit_dcr->dcr_index = cpu_to_le16(nvdimm_slot_to_dcr_index(VAR_2));", "nfit_dcr->vendor_id = cpu_to_le16(0x8086);", "nfit_dcr->device_id = cpu_to_le16(1);", "nfit_dcr->revision_id = cpu_to_le16(1\n);", "nfit_dcr->serial_number = cpu_to_le32(sn);", "nfit_dcr->fic = cpu_to_le16(0x201\n);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 11 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 29 ], [ 31 ], [ 37, 39 ], [ 41 ], [ 43, 47 ], [ 49 ] ]
12,705
static void nam_writew (void *opaque, uint32_t addr, uint32_t val) { PCIAC97LinkState *d = opaque; AC97LinkState *s = &d->ac97; uint32_t index = addr - s->base[0]; s->cas = 0; switch (index) { case AC97_Reset: mixer_reset (s); break; case AC97_Powerdown_Ctrl_Stat: val &= ~0xf; val |= mixer_load (s, index) & 0xf; mixer_store (s, index, val); break; #ifdef USE_MIXER case AC97_Master_Volume_Mute: set_volume (s, index, AUD_MIXER_VOLUME, val); break; case AC97_PCM_Out_Volume_Mute: set_volume (s, index, AUD_MIXER_PCM, val); break; case AC97_Line_In_Volume_Mute: set_volume (s, index, AUD_MIXER_LINE_IN, val); break; case AC97_Record_Select: record_select (s, val); break; #endif case AC97_Vendor_ID1: case AC97_Vendor_ID2: dolog ("Attempt to write vendor ID to %#x\n", val); break; case AC97_Extended_Audio_ID: dolog ("Attempt to write extended audio ID to %#x\n", val); break; case AC97_Extended_Audio_Ctrl_Stat: if (!(val & EACS_VRA)) { mixer_store (s, AC97_PCM_Front_DAC_Rate, 0xbb80); mixer_store (s, AC97_PCM_LR_ADC_Rate, 0xbb80); open_voice (s, PI_INDEX, 48000); open_voice (s, PO_INDEX, 48000); } if (!(val & EACS_VRM)) { mixer_store (s, AC97_MIC_ADC_Rate, 0xbb80); open_voice (s, MC_INDEX, 48000); } dolog ("Setting extended audio control to %#x\n", val); mixer_store (s, AC97_Extended_Audio_Ctrl_Stat, val); break; case AC97_PCM_Front_DAC_Rate: if (mixer_load (s, AC97_Extended_Audio_Ctrl_Stat) & EACS_VRA) { mixer_store (s, index, val); dolog ("Set front DAC rate to %d\n", val); open_voice (s, PO_INDEX, val); } else { dolog ("Attempt to set front DAC rate to %d, " "but VRA is not set\n", val); } break; case AC97_MIC_ADC_Rate: if (mixer_load (s, AC97_Extended_Audio_Ctrl_Stat) & EACS_VRM) { mixer_store (s, index, val); dolog ("Set MIC ADC rate to %d\n", val); open_voice (s, MC_INDEX, val); } else { dolog ("Attempt to set MIC ADC rate to %d, " "but VRM is not set\n", val); } break; case AC97_PCM_LR_ADC_Rate: if (mixer_load (s, AC97_Extended_Audio_Ctrl_Stat) & EACS_VRA) { mixer_store (s, index, val); dolog ("Set front LR ADC rate to %d\n", val); open_voice (s, PI_INDEX, val); } else { dolog ("Attempt to set LR ADC rate to %d, but VRA is not set\n", val); } break; default: dolog ("U nam writew %#x <- %#x\n", addr, val); mixer_store (s, index, val); break; } }
false
qemu
10ee2aaa417d8d8978cdb2bbed55ebb152df5f6b
static void nam_writew (void *opaque, uint32_t addr, uint32_t val) { PCIAC97LinkState *d = opaque; AC97LinkState *s = &d->ac97; uint32_t index = addr - s->base[0]; s->cas = 0; switch (index) { case AC97_Reset: mixer_reset (s); break; case AC97_Powerdown_Ctrl_Stat: val &= ~0xf; val |= mixer_load (s, index) & 0xf; mixer_store (s, index, val); break; #ifdef USE_MIXER case AC97_Master_Volume_Mute: set_volume (s, index, AUD_MIXER_VOLUME, val); break; case AC97_PCM_Out_Volume_Mute: set_volume (s, index, AUD_MIXER_PCM, val); break; case AC97_Line_In_Volume_Mute: set_volume (s, index, AUD_MIXER_LINE_IN, val); break; case AC97_Record_Select: record_select (s, val); break; #endif case AC97_Vendor_ID1: case AC97_Vendor_ID2: dolog ("Attempt to write vendor ID to %#x\n", val); break; case AC97_Extended_Audio_ID: dolog ("Attempt to write extended audio ID to %#x\n", val); break; case AC97_Extended_Audio_Ctrl_Stat: if (!(val & EACS_VRA)) { mixer_store (s, AC97_PCM_Front_DAC_Rate, 0xbb80); mixer_store (s, AC97_PCM_LR_ADC_Rate, 0xbb80); open_voice (s, PI_INDEX, 48000); open_voice (s, PO_INDEX, 48000); } if (!(val & EACS_VRM)) { mixer_store (s, AC97_MIC_ADC_Rate, 0xbb80); open_voice (s, MC_INDEX, 48000); } dolog ("Setting extended audio control to %#x\n", val); mixer_store (s, AC97_Extended_Audio_Ctrl_Stat, val); break; case AC97_PCM_Front_DAC_Rate: if (mixer_load (s, AC97_Extended_Audio_Ctrl_Stat) & EACS_VRA) { mixer_store (s, index, val); dolog ("Set front DAC rate to %d\n", val); open_voice (s, PO_INDEX, val); } else { dolog ("Attempt to set front DAC rate to %d, " "but VRA is not set\n", val); } break; case AC97_MIC_ADC_Rate: if (mixer_load (s, AC97_Extended_Audio_Ctrl_Stat) & EACS_VRM) { mixer_store (s, index, val); dolog ("Set MIC ADC rate to %d\n", val); open_voice (s, MC_INDEX, val); } else { dolog ("Attempt to set MIC ADC rate to %d, " "but VRM is not set\n", val); } break; case AC97_PCM_LR_ADC_Rate: if (mixer_load (s, AC97_Extended_Audio_Ctrl_Stat) & EACS_VRA) { mixer_store (s, index, val); dolog ("Set front LR ADC rate to %d\n", val); open_voice (s, PI_INDEX, val); } else { dolog ("Attempt to set LR ADC rate to %d, but VRA is not set\n", val); } break; default: dolog ("U nam writew %#x <- %#x\n", addr, val); mixer_store (s, index, val); break; } }
{ "code": [], "line_no": [] }
static void FUNC_0 (void *VAR_0, uint32_t VAR_1, uint32_t VAR_2) { PCIAC97LinkState *d = VAR_0; AC97LinkState *s = &d->ac97; uint32_t index = VAR_1 - s->base[0]; s->cas = 0; switch (index) { case AC97_Reset: mixer_reset (s); break; case AC97_Powerdown_Ctrl_Stat: VAR_2 &= ~0xf; VAR_2 |= mixer_load (s, index) & 0xf; mixer_store (s, index, VAR_2); break; #ifdef USE_MIXER case AC97_Master_Volume_Mute: set_volume (s, index, AUD_MIXER_VOLUME, VAR_2); break; case AC97_PCM_Out_Volume_Mute: set_volume (s, index, AUD_MIXER_PCM, VAR_2); break; case AC97_Line_In_Volume_Mute: set_volume (s, index, AUD_MIXER_LINE_IN, VAR_2); break; case AC97_Record_Select: record_select (s, VAR_2); break; #endif case AC97_Vendor_ID1: case AC97_Vendor_ID2: dolog ("Attempt to write vendor ID to %#x\n", VAR_2); break; case AC97_Extended_Audio_ID: dolog ("Attempt to write extended audio ID to %#x\n", VAR_2); break; case AC97_Extended_Audio_Ctrl_Stat: if (!(VAR_2 & EACS_VRA)) { mixer_store (s, AC97_PCM_Front_DAC_Rate, 0xbb80); mixer_store (s, AC97_PCM_LR_ADC_Rate, 0xbb80); open_voice (s, PI_INDEX, 48000); open_voice (s, PO_INDEX, 48000); } if (!(VAR_2 & EACS_VRM)) { mixer_store (s, AC97_MIC_ADC_Rate, 0xbb80); open_voice (s, MC_INDEX, 48000); } dolog ("Setting extended audio control to %#x\n", VAR_2); mixer_store (s, AC97_Extended_Audio_Ctrl_Stat, VAR_2); break; case AC97_PCM_Front_DAC_Rate: if (mixer_load (s, AC97_Extended_Audio_Ctrl_Stat) & EACS_VRA) { mixer_store (s, index, VAR_2); dolog ("Set front DAC rate to %d\n", VAR_2); open_voice (s, PO_INDEX, VAR_2); } else { dolog ("Attempt to set front DAC rate to %d, " "but VRA is not set\n", VAR_2); } break; case AC97_MIC_ADC_Rate: if (mixer_load (s, AC97_Extended_Audio_Ctrl_Stat) & EACS_VRM) { mixer_store (s, index, VAR_2); dolog ("Set MIC ADC rate to %d\n", VAR_2); open_voice (s, MC_INDEX, VAR_2); } else { dolog ("Attempt to set MIC ADC rate to %d, " "but VRM is not set\n", VAR_2); } break; case AC97_PCM_LR_ADC_Rate: if (mixer_load (s, AC97_Extended_Audio_Ctrl_Stat) & EACS_VRA) { mixer_store (s, index, VAR_2); dolog ("Set front LR ADC rate to %d\n", VAR_2); open_voice (s, PI_INDEX, VAR_2); } else { dolog ("Attempt to set LR ADC rate to %d, but VRA is not set\n", VAR_2); } break; default: dolog ("U nam writew %#x <- %#x\n", VAR_1, VAR_2); mixer_store (s, index, VAR_2); break; } }
[ "static void FUNC_0 (void *VAR_0, uint32_t VAR_1, uint32_t VAR_2)\n{", "PCIAC97LinkState *d = VAR_0;", "AC97LinkState *s = &d->ac97;", "uint32_t index = VAR_1 - s->base[0];", "s->cas = 0;", "switch (index) {", "case AC97_Reset:\nmixer_reset (s);", "break;", "case AC97_Powerdown_Ctrl_Stat:\nVAR_2 &= ~0xf;", "VAR_2 |= mixer_load (s, index) & 0xf;", "mixer_store (s, index, VAR_2);", "break;", "#ifdef USE_MIXER\ncase AC97_Master_Volume_Mute:\nset_volume (s, index, AUD_MIXER_VOLUME, VAR_2);", "break;", "case AC97_PCM_Out_Volume_Mute:\nset_volume (s, index, AUD_MIXER_PCM, VAR_2);", "break;", "case AC97_Line_In_Volume_Mute:\nset_volume (s, index, AUD_MIXER_LINE_IN, VAR_2);", "break;", "case AC97_Record_Select:\nrecord_select (s, VAR_2);", "break;", "#endif\ncase AC97_Vendor_ID1:\ncase AC97_Vendor_ID2:\ndolog (\"Attempt to write vendor ID to %#x\\n\", VAR_2);", "break;", "case AC97_Extended_Audio_ID:\ndolog (\"Attempt to write extended audio ID to %#x\\n\", VAR_2);", "break;", "case AC97_Extended_Audio_Ctrl_Stat:\nif (!(VAR_2 & EACS_VRA)) {", "mixer_store (s, AC97_PCM_Front_DAC_Rate, 0xbb80);", "mixer_store (s, AC97_PCM_LR_ADC_Rate, 0xbb80);", "open_voice (s, PI_INDEX, 48000);", "open_voice (s, PO_INDEX, 48000);", "}", "if (!(VAR_2 & EACS_VRM)) {", "mixer_store (s, AC97_MIC_ADC_Rate, 0xbb80);", "open_voice (s, MC_INDEX, 48000);", "}", "dolog (\"Setting extended audio control to %#x\\n\", VAR_2);", "mixer_store (s, AC97_Extended_Audio_Ctrl_Stat, VAR_2);", "break;", "case AC97_PCM_Front_DAC_Rate:\nif (mixer_load (s, AC97_Extended_Audio_Ctrl_Stat) & EACS_VRA) {", "mixer_store (s, index, VAR_2);", "dolog (\"Set front DAC rate to %d\\n\", VAR_2);", "open_voice (s, PO_INDEX, VAR_2);", "}", "else {", "dolog (\"Attempt to set front DAC rate to %d, \"\n\"but VRA is not set\\n\",\nVAR_2);", "}", "break;", "case AC97_MIC_ADC_Rate:\nif (mixer_load (s, AC97_Extended_Audio_Ctrl_Stat) & EACS_VRM) {", "mixer_store (s, index, VAR_2);", "dolog (\"Set MIC ADC rate to %d\\n\", VAR_2);", "open_voice (s, MC_INDEX, VAR_2);", "}", "else {", "dolog (\"Attempt to set MIC ADC rate to %d, \"\n\"but VRM is not set\\n\",\nVAR_2);", "}", "break;", "case AC97_PCM_LR_ADC_Rate:\nif (mixer_load (s, AC97_Extended_Audio_Ctrl_Stat) & EACS_VRA) {", "mixer_store (s, index, VAR_2);", "dolog (\"Set front LR ADC rate to %d\\n\", VAR_2);", "open_voice (s, PI_INDEX, VAR_2);", "}", "else {", "dolog (\"Attempt to set LR ADC rate to %d, but VRA is not set\\n\",\nVAR_2);", "}", "break;", "default:\ndolog (\"U nam writew %#x <- %#x\\n\", VAR_1, VAR_2);", "mixer_store (s, index, VAR_2);", "break;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15, 17 ], [ 19 ], [ 21, 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31, 33, 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45, 47 ], [ 49 ], [ 51, 53 ], [ 55 ], [ 57, 59, 61, 63 ], [ 65 ], [ 67, 69 ], [ 71 ], [ 73, 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101, 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115, 117, 119 ], [ 121 ], [ 123 ], [ 125, 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139, 141, 143 ], [ 145 ], [ 147 ], [ 149, 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163, 165 ], [ 167 ], [ 169 ], [ 171, 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ] ]
12,706
pvscsi_cleanup_msi(PVSCSIState *s) { PCIDevice *d = PCI_DEVICE(s); if (s->msi_used) { msi_uninit(d); } }
false
qemu
269fe4c3ab0cf29329317eb868f8ec90ac761b41
pvscsi_cleanup_msi(PVSCSIState *s) { PCIDevice *d = PCI_DEVICE(s); if (s->msi_used) { msi_uninit(d); } }
{ "code": [], "line_no": [] }
FUNC_0(PVSCSIState *VAR_0) { PCIDevice *d = PCI_DEVICE(VAR_0); if (VAR_0->msi_used) { msi_uninit(d); } }
[ "FUNC_0(PVSCSIState *VAR_0)\n{", "PCIDevice *d = PCI_DEVICE(VAR_0);", "if (VAR_0->msi_used) {", "msi_uninit(d);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ] ]
12,707
static void exponents_from_scale_factors(MPADecodeContext *s, GranuleDef *g, int16_t *exponents) { const uint8_t *bstab, *pretab; int len, i, j, k, l, v0, shift, gain, gains[3]; int16_t *exp_ptr; exp_ptr = exponents; gain = g->global_gain - 210; shift = g->scalefac_scale + 1; bstab = band_size_long[s->sample_rate_index]; pretab = mpa_pretab[g->preflag]; for(i=0;i<g->long_end;i++) { v0 = gain - ((g->scale_factors[i] + pretab[i]) << shift); len = bstab[i]; for(j=len;j>0;j--) *exp_ptr++ = v0; } if (g->short_start < 13) { bstab = band_size_short[s->sample_rate_index]; gains[0] = gain - (g->subblock_gain[0] << 3); gains[1] = gain - (g->subblock_gain[1] << 3); gains[2] = gain - (g->subblock_gain[2] << 3); k = g->long_end; for(i=g->short_start;i<13;i++) { len = bstab[i]; for(l=0;l<3;l++) { v0 = gains[l] - (g->scale_factors[k++] << shift); for(j=len;j>0;j--) *exp_ptr++ = v0; } } } }
false
FFmpeg
bc2d2757bb532fa260c373adb00f4e47766e3449
static void exponents_from_scale_factors(MPADecodeContext *s, GranuleDef *g, int16_t *exponents) { const uint8_t *bstab, *pretab; int len, i, j, k, l, v0, shift, gain, gains[3]; int16_t *exp_ptr; exp_ptr = exponents; gain = g->global_gain - 210; shift = g->scalefac_scale + 1; bstab = band_size_long[s->sample_rate_index]; pretab = mpa_pretab[g->preflag]; for(i=0;i<g->long_end;i++) { v0 = gain - ((g->scale_factors[i] + pretab[i]) << shift); len = bstab[i]; for(j=len;j>0;j--) *exp_ptr++ = v0; } if (g->short_start < 13) { bstab = band_size_short[s->sample_rate_index]; gains[0] = gain - (g->subblock_gain[0] << 3); gains[1] = gain - (g->subblock_gain[1] << 3); gains[2] = gain - (g->subblock_gain[2] << 3); k = g->long_end; for(i=g->short_start;i<13;i++) { len = bstab[i]; for(l=0;l<3;l++) { v0 = gains[l] - (g->scale_factors[k++] << shift); for(j=len;j>0;j--) *exp_ptr++ = v0; } } } }
{ "code": [], "line_no": [] }
static void FUNC_0(MPADecodeContext *VAR_0, GranuleDef *VAR_1, int16_t *VAR_2) { const uint8_t *VAR_3, *pretab; int VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_11, VAR_12[3]; int16_t *exp_ptr; exp_ptr = VAR_2; VAR_11 = VAR_1->global_gain - 210; VAR_10 = VAR_1->scalefac_scale + 1; VAR_3 = band_size_long[VAR_0->sample_rate_index]; pretab = mpa_pretab[VAR_1->preflag]; for(VAR_5=0;VAR_5<VAR_1->long_end;VAR_5++) { VAR_9 = VAR_11 - ((VAR_1->scale_factors[VAR_5] + pretab[VAR_5]) << VAR_10); VAR_4 = VAR_3[VAR_5]; for(VAR_6=VAR_4;VAR_6>0;VAR_6--) *exp_ptr++ = VAR_9; } if (VAR_1->short_start < 13) { VAR_3 = band_size_short[VAR_0->sample_rate_index]; VAR_12[0] = VAR_11 - (VAR_1->subblock_gain[0] << 3); VAR_12[1] = VAR_11 - (VAR_1->subblock_gain[1] << 3); VAR_12[2] = VAR_11 - (VAR_1->subblock_gain[2] << 3); VAR_7 = VAR_1->long_end; for(VAR_5=VAR_1->short_start;VAR_5<13;VAR_5++) { VAR_4 = VAR_3[VAR_5]; for(VAR_8=0;VAR_8<3;VAR_8++) { VAR_9 = VAR_12[VAR_8] - (VAR_1->scale_factors[VAR_7++] << VAR_10); for(VAR_6=VAR_4;VAR_6>0;VAR_6--) *exp_ptr++ = VAR_9; } } } }
[ "static void FUNC_0(MPADecodeContext *VAR_0,\nGranuleDef *VAR_1,\nint16_t *VAR_2)\n{", "const uint8_t *VAR_3, *pretab;", "int VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_11, VAR_12[3];", "int16_t *exp_ptr;", "exp_ptr = VAR_2;", "VAR_11 = VAR_1->global_gain - 210;", "VAR_10 = VAR_1->scalefac_scale + 1;", "VAR_3 = band_size_long[VAR_0->sample_rate_index];", "pretab = mpa_pretab[VAR_1->preflag];", "for(VAR_5=0;VAR_5<VAR_1->long_end;VAR_5++) {", "VAR_9 = VAR_11 - ((VAR_1->scale_factors[VAR_5] + pretab[VAR_5]) << VAR_10);", "VAR_4 = VAR_3[VAR_5];", "for(VAR_6=VAR_4;VAR_6>0;VAR_6--)", "*exp_ptr++ = VAR_9;", "}", "if (VAR_1->short_start < 13) {", "VAR_3 = band_size_short[VAR_0->sample_rate_index];", "VAR_12[0] = VAR_11 - (VAR_1->subblock_gain[0] << 3);", "VAR_12[1] = VAR_11 - (VAR_1->subblock_gain[1] << 3);", "VAR_12[2] = VAR_11 - (VAR_1->subblock_gain[2] << 3);", "VAR_7 = VAR_1->long_end;", "for(VAR_5=VAR_1->short_start;VAR_5<13;VAR_5++) {", "VAR_4 = VAR_3[VAR_5];", "for(VAR_8=0;VAR_8<3;VAR_8++) {", "VAR_9 = VAR_12[VAR_8] - (VAR_1->scale_factors[VAR_7++] << VAR_10);", "for(VAR_6=VAR_4;VAR_6>0;VAR_6--)", "*exp_ptr++ = VAR_9;", "}", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 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 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ] ]
12,708
static always_inline void check_cp1_3d(CPUState *env, DisasContext *ctx) { if (unlikely(!(env->fpu->fcr0 & (1 << FCR0_3D)))) generate_exception(ctx, EXCP_RI); }
false
qemu
7385ac0ba2456159a52b9b2cbb5f6c71921d0c23
static always_inline void check_cp1_3d(CPUState *env, DisasContext *ctx) { if (unlikely(!(env->fpu->fcr0 & (1 << FCR0_3D)))) generate_exception(ctx, EXCP_RI); }
{ "code": [], "line_no": [] }
static always_inline void FUNC_0(CPUState *env, DisasContext *ctx) { if (unlikely(!(env->fpu->fcr0 & (1 << FCR0_3D)))) generate_exception(ctx, EXCP_RI); }
[ "static always_inline void FUNC_0(CPUState *env, DisasContext *ctx)\n{", "if (unlikely(!(env->fpu->fcr0 & (1 << FCR0_3D))))\ngenerate_exception(ctx, EXCP_RI);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9 ] ]
12,709
static bool linked_bp_matches(ARMCPU *cpu, int lbn) { CPUARMState *env = &cpu->env; uint64_t bcr = env->cp15.dbgbcr[lbn]; int brps = extract32(cpu->dbgdidr, 24, 4); int ctx_cmps = extract32(cpu->dbgdidr, 20, 4); int bt; uint32_t contextidr; /* Links to unimplemented or non-context aware breakpoints are * CONSTRAINED UNPREDICTABLE: either behave as if disabled, or * as if linked to an UNKNOWN context-aware breakpoint (in which * case DBGWCR<n>_EL1.LBN must indicate that breakpoint). * We choose the former. */ if (lbn > brps || lbn < (brps - ctx_cmps)) { return false; } bcr = env->cp15.dbgbcr[lbn]; if (extract64(bcr, 0, 1) == 0) { /* Linked breakpoint disabled : generate no events */ return false; } bt = extract64(bcr, 20, 4); /* We match the whole register even if this is AArch32 using the * short descriptor format (in which case it holds both PROCID and ASID), * since we don't implement the optional v7 context ID masking. */ contextidr = extract64(env->cp15.contextidr_el1, 0, 32); switch (bt) { case 3: /* linked context ID match */ if (arm_current_el(env) > 1) { /* Context matches never fire in EL2 or (AArch64) EL3 */ return false; } return (contextidr == extract64(env->cp15.dbgbvr[lbn], 0, 32)); case 5: /* linked address mismatch (reserved in AArch64) */ case 9: /* linked VMID match (reserved if no EL2) */ case 11: /* linked context ID and VMID match (reserved if no EL2) */ default: /* Links to Unlinked context breakpoints must generate no * events; we choose to do the same for reserved values too. */ return false; } return false; }
false
qemu
54bf36ed351c526cde0c853079f9ff1ab7e2ff89
static bool linked_bp_matches(ARMCPU *cpu, int lbn) { CPUARMState *env = &cpu->env; uint64_t bcr = env->cp15.dbgbcr[lbn]; int brps = extract32(cpu->dbgdidr, 24, 4); int ctx_cmps = extract32(cpu->dbgdidr, 20, 4); int bt; uint32_t contextidr; if (lbn > brps || lbn < (brps - ctx_cmps)) { return false; } bcr = env->cp15.dbgbcr[lbn]; if (extract64(bcr, 0, 1) == 0) { return false; } bt = extract64(bcr, 20, 4); contextidr = extract64(env->cp15.contextidr_el1, 0, 32); switch (bt) { case 3: if (arm_current_el(env) > 1) { return false; } return (contextidr == extract64(env->cp15.dbgbvr[lbn], 0, 32)); case 5: case 9: case 11: default: return false; } return false; }
{ "code": [], "line_no": [] }
static bool FUNC_0(ARMCPU *cpu, int lbn) { CPUARMState *env = &cpu->env; uint64_t bcr = env->cp15.dbgbcr[lbn]; int VAR_0 = extract32(cpu->dbgdidr, 24, 4); int VAR_1 = extract32(cpu->dbgdidr, 20, 4); int VAR_2; uint32_t contextidr; if (lbn > VAR_0 || lbn < (VAR_0 - VAR_1)) { return false; } bcr = env->cp15.dbgbcr[lbn]; if (extract64(bcr, 0, 1) == 0) { return false; } VAR_2 = extract64(bcr, 20, 4); contextidr = extract64(env->cp15.contextidr_el1, 0, 32); switch (VAR_2) { case 3: if (arm_current_el(env) > 1) { return false; } return (contextidr == extract64(env->cp15.dbgbvr[lbn], 0, 32)); case 5: case 9: case 11: default: return false; } return false; }
[ "static bool FUNC_0(ARMCPU *cpu, int lbn)\n{", "CPUARMState *env = &cpu->env;", "uint64_t bcr = env->cp15.dbgbcr[lbn];", "int VAR_0 = extract32(cpu->dbgdidr, 24, 4);", "int VAR_1 = extract32(cpu->dbgdidr, 20, 4);", "int VAR_2;", "uint32_t contextidr;", "if (lbn > VAR_0 || lbn < (VAR_0 - VAR_1)) {", "return false;", "}", "bcr = env->cp15.dbgbcr[lbn];", "if (extract64(bcr, 0, 1) == 0) {", "return false;", "}", "VAR_2 = extract64(bcr, 20, 4);", "contextidr = extract64(env->cp15.contextidr_el1, 0, 32);", "switch (VAR_2) {", "case 3:\nif (arm_current_el(env) > 1) {", "return false;", "}", "return (contextidr == extract64(env->cp15.dbgbvr[lbn], 0, 32));", "case 5:\ncase 9:\ncase 11:\ndefault:\nreturn false;", "}", "return false;", "}" ]
[ 0, 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 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 43 ], [ 47 ], [ 49 ], [ 53 ], [ 65 ], [ 69 ], [ 71, 73 ], [ 77 ], [ 79 ], [ 81 ], [ 83, 85, 87, 89, 97 ], [ 99 ], [ 103 ], [ 105 ] ]
12,711
static int vnc_display_disable_login(DisplayState *ds) { VncDisplay *vs = vnc_display; if (!vs) { return -1; } if (vs->password) { g_free(vs->password); } vs->password = NULL; if (vs->auth == VNC_AUTH_NONE) { vs->auth = VNC_AUTH_VNC; } return 0; }
false
qemu
cf864569cd9134ee503ad9eb6be2881001c0ed80
static int vnc_display_disable_login(DisplayState *ds) { VncDisplay *vs = vnc_display; if (!vs) { return -1; } if (vs->password) { g_free(vs->password); } vs->password = NULL; if (vs->auth == VNC_AUTH_NONE) { vs->auth = VNC_AUTH_VNC; } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(DisplayState *VAR_0) { VncDisplay *vs = vnc_display; if (!vs) { return -1; } if (vs->password) { g_free(vs->password); } vs->password = NULL; if (vs->auth == VNC_AUTH_NONE) { vs->auth = VNC_AUTH_VNC; } return 0; }
[ "static int FUNC_0(DisplayState *VAR_0)\n{", "VncDisplay *vs = vnc_display;", "if (!vs) {", "return -1;", "}", "if (vs->password) {", "g_free(vs->password);", "}", "vs->password = NULL;", "if (vs->auth == VNC_AUTH_NONE) {", "vs->auth = VNC_AUTH_VNC;", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ] ]
12,712
int scsi_build_sense(uint8_t *in_buf, int in_len, uint8_t *buf, int len, bool fixed) { bool fixed_in; SCSISense sense; if (!fixed && len < 8) { return 0; } if (in_len == 0) { sense.key = NO_SENSE; sense.asc = 0; sense.ascq = 0; } else { fixed_in = (in_buf[0] & 2) == 0; if (fixed == fixed_in) { memcpy(buf, in_buf, MIN(len, in_len)); return MIN(len, in_len); } if (fixed_in) { sense.key = in_buf[2]; sense.asc = in_buf[12]; sense.ascq = in_buf[13]; } else { sense.key = in_buf[1]; sense.asc = in_buf[2]; sense.ascq = in_buf[3]; } } memset(buf, 0, len); if (fixed) { /* Return fixed format sense buffer */ buf[0] = 0xf0; buf[2] = sense.key; buf[7] = 10; buf[12] = sense.asc; buf[13] = sense.ascq; return MIN(len, 18); } else { /* Return descriptor format sense buffer */ buf[0] = 0x72; buf[1] = sense.key; buf[2] = sense.asc; buf[3] = sense.ascq; return 8; } }
false
qemu
77e4743c94d2a926623e280913e05ad6c840791e
int scsi_build_sense(uint8_t *in_buf, int in_len, uint8_t *buf, int len, bool fixed) { bool fixed_in; SCSISense sense; if (!fixed && len < 8) { return 0; } if (in_len == 0) { sense.key = NO_SENSE; sense.asc = 0; sense.ascq = 0; } else { fixed_in = (in_buf[0] & 2) == 0; if (fixed == fixed_in) { memcpy(buf, in_buf, MIN(len, in_len)); return MIN(len, in_len); } if (fixed_in) { sense.key = in_buf[2]; sense.asc = in_buf[12]; sense.ascq = in_buf[13]; } else { sense.key = in_buf[1]; sense.asc = in_buf[2]; sense.ascq = in_buf[3]; } } memset(buf, 0, len); if (fixed) { buf[0] = 0xf0; buf[2] = sense.key; buf[7] = 10; buf[12] = sense.asc; buf[13] = sense.ascq; return MIN(len, 18); } else { buf[0] = 0x72; buf[1] = sense.key; buf[2] = sense.asc; buf[3] = sense.ascq; return 8; } }
{ "code": [], "line_no": [] }
int FUNC_0(uint8_t *VAR_0, int VAR_1, uint8_t *VAR_2, int VAR_3, bool VAR_4) { bool fixed_in; SCSISense sense; if (!VAR_4 && VAR_3 < 8) { return 0; } if (VAR_1 == 0) { sense.key = NO_SENSE; sense.asc = 0; sense.ascq = 0; } else { fixed_in = (VAR_0[0] & 2) == 0; if (VAR_4 == fixed_in) { memcpy(VAR_2, VAR_0, MIN(VAR_3, VAR_1)); return MIN(VAR_3, VAR_1); } if (fixed_in) { sense.key = VAR_0[2]; sense.asc = VAR_0[12]; sense.ascq = VAR_0[13]; } else { sense.key = VAR_0[1]; sense.asc = VAR_0[2]; sense.ascq = VAR_0[3]; } } memset(VAR_2, 0, VAR_3); if (VAR_4) { VAR_2[0] = 0xf0; VAR_2[2] = sense.key; VAR_2[7] = 10; VAR_2[12] = sense.asc; VAR_2[13] = sense.ascq; return MIN(VAR_3, 18); } else { VAR_2[0] = 0x72; VAR_2[1] = sense.key; VAR_2[2] = sense.asc; VAR_2[3] = sense.ascq; return 8; } }
[ "int FUNC_0(uint8_t *VAR_0, int VAR_1,\nuint8_t *VAR_2, int VAR_3, bool VAR_4)\n{", "bool fixed_in;", "SCSISense sense;", "if (!VAR_4 && VAR_3 < 8) {", "return 0;", "}", "if (VAR_1 == 0) {", "sense.key = NO_SENSE;", "sense.asc = 0;", "sense.ascq = 0;", "} else {", "fixed_in = (VAR_0[0] & 2) == 0;", "if (VAR_4 == fixed_in) {", "memcpy(VAR_2, VAR_0, MIN(VAR_3, VAR_1));", "return MIN(VAR_3, VAR_1);", "}", "if (fixed_in) {", "sense.key = VAR_0[2];", "sense.asc = VAR_0[12];", "sense.ascq = VAR_0[13];", "} else {", "sense.key = VAR_0[1];", "sense.asc = VAR_0[2];", "sense.ascq = VAR_0[3];", "}", "}", "memset(VAR_2, 0, VAR_3);", "if (VAR_4) {", "VAR_2[0] = 0xf0;", "VAR_2[2] = sense.key;", "VAR_2[7] = 10;", "VAR_2[12] = sense.asc;", "VAR_2[13] = sense.ascq;", "return MIN(VAR_3, 18);", "} else {", "VAR_2[0] = 0x72;", "VAR_2[1] = sense.key;", "VAR_2[2] = sense.asc;", "VAR_2[3] = sense.ascq;", "return 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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ] ]
12,713
static int compare_sectors(const uint8_t *buf1, const uint8_t *buf2, int n, int *pnum) { bool res; int i; if (n <= 0) { *pnum = 0; return 0; } res = !!memcmp(buf1, buf2, 512); for(i = 1; i < n; i++) { buf1 += 512; buf2 += 512; if (!!memcmp(buf1, buf2, 512) != res) { break; } } *pnum = i; return res; }
false
qemu
dc61cd3b144151024a247a109f360d2e2cab0f81
static int compare_sectors(const uint8_t *buf1, const uint8_t *buf2, int n, int *pnum) { bool res; int i; if (n <= 0) { *pnum = 0; return 0; } res = !!memcmp(buf1, buf2, 512); for(i = 1; i < n; i++) { buf1 += 512; buf2 += 512; if (!!memcmp(buf1, buf2, 512) != res) { break; } } *pnum = i; return res; }
{ "code": [], "line_no": [] }
static int FUNC_0(const uint8_t *VAR_0, const uint8_t *VAR_1, int VAR_2, int *VAR_3) { bool res; int VAR_4; if (VAR_2 <= 0) { *VAR_3 = 0; return 0; } res = !!memcmp(VAR_0, VAR_1, 512); for(VAR_4 = 1; VAR_4 < VAR_2; VAR_4++) { VAR_0 += 512; VAR_1 += 512; if (!!memcmp(VAR_0, VAR_1, 512) != res) { break; } } *VAR_3 = VAR_4; return res; }
[ "static int FUNC_0(const uint8_t *VAR_0, const uint8_t *VAR_1, int VAR_2,\nint *VAR_3)\n{", "bool res;", "int VAR_4;", "if (VAR_2 <= 0) {", "*VAR_3 = 0;", "return 0;", "}", "res = !!memcmp(VAR_0, VAR_1, 512);", "for(VAR_4 = 1; VAR_4 < VAR_2; VAR_4++) {", "VAR_0 += 512;", "VAR_1 += 512;", "if (!!memcmp(VAR_0, VAR_1, 512) != res) {", "break;", "}", "}", "*VAR_3 = VAR_4;", "return res;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ] ]
12,714
static void coroutine_fn bdrv_get_block_status_above_co_entry(void *opaque) { BdrvCoGetBlockStatusData *data = opaque; data->ret = bdrv_co_get_block_status_above(data->bs, data->base, data->sector_num, data->nb_sectors, data->pnum); data->done = true; }
false
qemu
67a0fd2a9bca204d2b39f910a97c7137636a0715
static void coroutine_fn bdrv_get_block_status_above_co_entry(void *opaque) { BdrvCoGetBlockStatusData *data = opaque; data->ret = bdrv_co_get_block_status_above(data->bs, data->base, data->sector_num, data->nb_sectors, data->pnum); data->done = true; }
{ "code": [], "line_no": [] }
static void VAR_0 bdrv_get_block_status_above_co_entry(void *opaque) { BdrvCoGetBlockStatusData *data = opaque; data->ret = bdrv_co_get_block_status_above(data->bs, data->base, data->sector_num, data->nb_sectors, data->pnum); data->done = true; }
[ "static void VAR_0 bdrv_get_block_status_above_co_entry(void *opaque)\n{", "BdrvCoGetBlockStatusData *data = opaque;", "data->ret = bdrv_co_get_block_status_above(data->bs, data->base,\ndata->sector_num,\ndata->nb_sectors,\ndata->pnum);", "data->done = true;", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11, 13, 15 ], [ 17 ], [ 19 ] ]
12,715
static inline int target_rt_restore_ucontext(CPUM68KState *env, struct target_ucontext *uc, int *pd0) { int temp; target_greg_t *gregs = uc->tuc_mcontext.gregs; __get_user(temp, &uc->tuc_mcontext.version); if (temp != TARGET_MCONTEXT_VERSION) goto badframe; /* restore passed registers */ __get_user(env->dregs[0], &gregs[0]); __get_user(env->dregs[1], &gregs[1]); __get_user(env->dregs[2], &gregs[2]); __get_user(env->dregs[3], &gregs[3]); __get_user(env->dregs[4], &gregs[4]); __get_user(env->dregs[5], &gregs[5]); __get_user(env->dregs[6], &gregs[6]); __get_user(env->dregs[7], &gregs[7]); __get_user(env->aregs[0], &gregs[8]); __get_user(env->aregs[1], &gregs[9]); __get_user(env->aregs[2], &gregs[10]); __get_user(env->aregs[3], &gregs[11]); __get_user(env->aregs[4], &gregs[12]); __get_user(env->aregs[5], &gregs[13]); __get_user(env->aregs[6], &gregs[14]); __get_user(env->aregs[7], &gregs[15]); __get_user(env->pc, &gregs[16]); __get_user(temp, &gregs[17]); env->sr = (env->sr & 0xff00) | (temp & 0xff); *pd0 = env->dregs[0]; return 0; badframe: return 1; }
false
qemu
7ccb84a91618eda626b12ce83d62cfe678cfc58f
static inline int target_rt_restore_ucontext(CPUM68KState *env, struct target_ucontext *uc, int *pd0) { int temp; target_greg_t *gregs = uc->tuc_mcontext.gregs; __get_user(temp, &uc->tuc_mcontext.version); if (temp != TARGET_MCONTEXT_VERSION) goto badframe; __get_user(env->dregs[0], &gregs[0]); __get_user(env->dregs[1], &gregs[1]); __get_user(env->dregs[2], &gregs[2]); __get_user(env->dregs[3], &gregs[3]); __get_user(env->dregs[4], &gregs[4]); __get_user(env->dregs[5], &gregs[5]); __get_user(env->dregs[6], &gregs[6]); __get_user(env->dregs[7], &gregs[7]); __get_user(env->aregs[0], &gregs[8]); __get_user(env->aregs[1], &gregs[9]); __get_user(env->aregs[2], &gregs[10]); __get_user(env->aregs[3], &gregs[11]); __get_user(env->aregs[4], &gregs[12]); __get_user(env->aregs[5], &gregs[13]); __get_user(env->aregs[6], &gregs[14]); __get_user(env->aregs[7], &gregs[15]); __get_user(env->pc, &gregs[16]); __get_user(temp, &gregs[17]); env->sr = (env->sr & 0xff00) | (temp & 0xff); *pd0 = env->dregs[0]; return 0; badframe: return 1; }
{ "code": [], "line_no": [] }
static inline int FUNC_0(CPUM68KState *VAR_0, struct target_ucontext *VAR_1, int *VAR_2) { int VAR_3; target_greg_t *gregs = VAR_1->tuc_mcontext.gregs; __get_user(VAR_3, &VAR_1->tuc_mcontext.version); if (VAR_3 != TARGET_MCONTEXT_VERSION) goto badframe; __get_user(VAR_0->dregs[0], &gregs[0]); __get_user(VAR_0->dregs[1], &gregs[1]); __get_user(VAR_0->dregs[2], &gregs[2]); __get_user(VAR_0->dregs[3], &gregs[3]); __get_user(VAR_0->dregs[4], &gregs[4]); __get_user(VAR_0->dregs[5], &gregs[5]); __get_user(VAR_0->dregs[6], &gregs[6]); __get_user(VAR_0->dregs[7], &gregs[7]); __get_user(VAR_0->aregs[0], &gregs[8]); __get_user(VAR_0->aregs[1], &gregs[9]); __get_user(VAR_0->aregs[2], &gregs[10]); __get_user(VAR_0->aregs[3], &gregs[11]); __get_user(VAR_0->aregs[4], &gregs[12]); __get_user(VAR_0->aregs[5], &gregs[13]); __get_user(VAR_0->aregs[6], &gregs[14]); __get_user(VAR_0->aregs[7], &gregs[15]); __get_user(VAR_0->pc, &gregs[16]); __get_user(VAR_3, &gregs[17]); VAR_0->sr = (VAR_0->sr & 0xff00) | (VAR_3 & 0xff); *VAR_2 = VAR_0->dregs[0]; return 0; badframe: return 1; }
[ "static inline int FUNC_0(CPUM68KState *VAR_0,\nstruct target_ucontext *VAR_1,\nint *VAR_2)\n{", "int VAR_3;", "target_greg_t *gregs = VAR_1->tuc_mcontext.gregs;", "__get_user(VAR_3, &VAR_1->tuc_mcontext.version);", "if (VAR_3 != TARGET_MCONTEXT_VERSION)\ngoto badframe;", "__get_user(VAR_0->dregs[0], &gregs[0]);", "__get_user(VAR_0->dregs[1], &gregs[1]);", "__get_user(VAR_0->dregs[2], &gregs[2]);", "__get_user(VAR_0->dregs[3], &gregs[3]);", "__get_user(VAR_0->dregs[4], &gregs[4]);", "__get_user(VAR_0->dregs[5], &gregs[5]);", "__get_user(VAR_0->dregs[6], &gregs[6]);", "__get_user(VAR_0->dregs[7], &gregs[7]);", "__get_user(VAR_0->aregs[0], &gregs[8]);", "__get_user(VAR_0->aregs[1], &gregs[9]);", "__get_user(VAR_0->aregs[2], &gregs[10]);", "__get_user(VAR_0->aregs[3], &gregs[11]);", "__get_user(VAR_0->aregs[4], &gregs[12]);", "__get_user(VAR_0->aregs[5], &gregs[13]);", "__get_user(VAR_0->aregs[6], &gregs[14]);", "__get_user(VAR_0->aregs[7], &gregs[15]);", "__get_user(VAR_0->pc, &gregs[16]);", "__get_user(VAR_3, &gregs[17]);", "VAR_0->sr = (VAR_0->sr & 0xff00) | (VAR_3 & 0xff);", "*VAR_2 = VAR_0->dregs[0];", "return 0;", "badframe:\nreturn 1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17, 19 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 71, 73 ], [ 75 ] ]
12,716
void memory_region_init_ram_ptr(MemoryRegion *mr, const char *name, uint64_t size, void *ptr) { memory_region_init(mr, name, size); mr->ram = true; mr->terminates = true; mr->destructor = memory_region_destructor_ram_from_ptr; mr->ram_addr = qemu_ram_alloc_from_ptr(size, ptr, mr); mr->backend_registered = true; }
false
qemu
26a83ad0e793465b74a8b06a65f2f6fdc5615413
void memory_region_init_ram_ptr(MemoryRegion *mr, const char *name, uint64_t size, void *ptr) { memory_region_init(mr, name, size); mr->ram = true; mr->terminates = true; mr->destructor = memory_region_destructor_ram_from_ptr; mr->ram_addr = qemu_ram_alloc_from_ptr(size, ptr, mr); mr->backend_registered = true; }
{ "code": [], "line_no": [] }
void FUNC_0(MemoryRegion *VAR_0, const char *VAR_1, uint64_t VAR_2, void *VAR_3) { memory_region_init(VAR_0, VAR_1, VAR_2); VAR_0->ram = true; VAR_0->terminates = true; VAR_0->destructor = memory_region_destructor_ram_from_ptr; VAR_0->ram_addr = qemu_ram_alloc_from_ptr(VAR_2, VAR_3, VAR_0); VAR_0->backend_registered = true; }
[ "void FUNC_0(MemoryRegion *VAR_0,\nconst char *VAR_1,\nuint64_t VAR_2,\nvoid *VAR_3)\n{", "memory_region_init(VAR_0, VAR_1, VAR_2);", "VAR_0->ram = true;", "VAR_0->terminates = true;", "VAR_0->destructor = memory_region_destructor_ram_from_ptr;", "VAR_0->ram_addr = qemu_ram_alloc_from_ptr(VAR_2, VAR_3, VAR_0);", "VAR_0->backend_registered = true;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ] ]