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
11,950
static int coroutine_fn nfs_co_readv(BlockDriverState *bs, int64_t sector_num, int nb_sectors, QEMUIOVector *iov) { NFSClient *client = bs->opaque; NFSRPC task; nfs_co_init_task(client, &task); task.iov = iov; if (nfs_pread_async(client->context, client->fh, sector_num * BDRV_SECTOR_SIZE, nb_sectors * BDRV_SECTOR_SIZE, nfs_co_generic_cb, &task) != 0) { return -ENOMEM; } while (!task.complete) { nfs_set_events(client); qemu_coroutine_yield(); } if (task.ret < 0) { return task.ret; } /* zero pad short reads */ if (task.ret < iov->size) { qemu_iovec_memset(iov, task.ret, 0, iov->size - task.ret); } return 0; }
false
qemu
aa92d6c4609e174fc6884e4b7b87367fac33cbe9
static int coroutine_fn nfs_co_readv(BlockDriverState *bs, int64_t sector_num, int nb_sectors, QEMUIOVector *iov) { NFSClient *client = bs->opaque; NFSRPC task; nfs_co_init_task(client, &task); task.iov = iov; if (nfs_pread_async(client->context, client->fh, sector_num * BDRV_SECTOR_SIZE, nb_sectors * BDRV_SECTOR_SIZE, nfs_co_generic_cb, &task) != 0) { return -ENOMEM; } while (!task.complete) { nfs_set_events(client); qemu_coroutine_yield(); } if (task.ret < 0) { return task.ret; } if (task.ret < iov->size) { qemu_iovec_memset(iov, task.ret, 0, iov->size - task.ret); } return 0; }
{ "code": [], "line_no": [] }
static int VAR_0 nfs_co_readv(BlockDriverState *bs, int64_t sector_num, int nb_sectors, QEMUIOVector *iov) { NFSClient *client = bs->opaque; NFSRPC task; nfs_co_init_task(client, &task); task.iov = iov; if (nfs_pread_async(client->context, client->fh, sector_num * BDRV_SECTOR_SIZE, nb_sectors * BDRV_SECTOR_SIZE, nfs_co_generic_cb, &task) != 0) { return -ENOMEM; } while (!task.complete) { nfs_set_events(client); qemu_coroutine_yield(); } if (task.ret < 0) { return task.ret; } if (task.ret < iov->size) { qemu_iovec_memset(iov, task.ret, 0, iov->size - task.ret); } return 0; }
[ "static int VAR_0 nfs_co_readv(BlockDriverState *bs,\nint64_t sector_num, int nb_sectors,\nQEMUIOVector *iov)\n{", "NFSClient *client = bs->opaque;", "NFSRPC task;", "nfs_co_init_task(client, &task);", "task.iov = iov;", "if (nfs_pread_async(client->context, client->fh,\nsector_num * BDRV_SECTOR_SIZE,\nnb_sectors * BDRV_SECTOR_SIZE,\nnfs_co_generic_cb, &task) != 0) {", "return -ENOMEM;", "}", "while (!task.complete) {", "nfs_set_events(client);", "qemu_coroutine_yield();", "}", "if (task.ret < 0) {", "return task.ret;", "}", "if (task.ret < iov->size) {", "qemu_iovec_memset(iov, task.ret, 0, iov->size - task.ret);", "}", "return 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 ], [ 45 ], [ 47 ], [ 49 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ] ]
11,951
int scsi_req_parse(SCSIRequest *req, uint8_t *buf) { int rc; if (req->dev->type == TYPE_TAPE) { rc = scsi_req_stream_length(&req->cmd, req->dev, buf); } else { rc = scsi_req_length(&req->cmd, req->dev, buf); } if (rc != 0) return rc; assert(buf == req->cmd.buf); scsi_cmd_xfer_mode(&req->cmd); req->cmd.lba = scsi_cmd_lba(&req->cmd); trace_scsi_req_parsed(req->dev->id, req->lun, req->tag, buf[0], req->cmd.mode, req->cmd.xfer); if (req->cmd.lba != -1) { trace_scsi_req_parsed_lba(req->dev->id, req->lun, req->tag, buf[0], req->cmd.lba); } return 0; }
false
qemu
afa46c468acc18914c2773538f1b088c507766ee
int scsi_req_parse(SCSIRequest *req, uint8_t *buf) { int rc; if (req->dev->type == TYPE_TAPE) { rc = scsi_req_stream_length(&req->cmd, req->dev, buf); } else { rc = scsi_req_length(&req->cmd, req->dev, buf); } if (rc != 0) return rc; assert(buf == req->cmd.buf); scsi_cmd_xfer_mode(&req->cmd); req->cmd.lba = scsi_cmd_lba(&req->cmd); trace_scsi_req_parsed(req->dev->id, req->lun, req->tag, buf[0], req->cmd.mode, req->cmd.xfer); if (req->cmd.lba != -1) { trace_scsi_req_parsed_lba(req->dev->id, req->lun, req->tag, buf[0], req->cmd.lba); } return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(SCSIRequest *VAR_0, uint8_t *VAR_1) { int VAR_2; if (VAR_0->dev->type == TYPE_TAPE) { VAR_2 = scsi_req_stream_length(&VAR_0->cmd, VAR_0->dev, VAR_1); } else { VAR_2 = scsi_req_length(&VAR_0->cmd, VAR_0->dev, VAR_1); } if (VAR_2 != 0) return VAR_2; assert(VAR_1 == VAR_0->cmd.VAR_1); scsi_cmd_xfer_mode(&VAR_0->cmd); VAR_0->cmd.lba = scsi_cmd_lba(&VAR_0->cmd); trace_scsi_req_parsed(VAR_0->dev->id, VAR_0->lun, VAR_0->tag, VAR_1[0], VAR_0->cmd.mode, VAR_0->cmd.xfer); if (VAR_0->cmd.lba != -1) { trace_scsi_req_parsed_lba(VAR_0->dev->id, VAR_0->lun, VAR_0->tag, VAR_1[0], VAR_0->cmd.lba); } return 0; }
[ "int FUNC_0(SCSIRequest *VAR_0, uint8_t *VAR_1)\n{", "int VAR_2;", "if (VAR_0->dev->type == TYPE_TAPE) {", "VAR_2 = scsi_req_stream_length(&VAR_0->cmd, VAR_0->dev, VAR_1);", "} else {", "VAR_2 = scsi_req_length(&VAR_0->cmd, VAR_0->dev, VAR_1);", "}", "if (VAR_2 != 0)\nreturn VAR_2;", "assert(VAR_1 == VAR_0->cmd.VAR_1);", "scsi_cmd_xfer_mode(&VAR_0->cmd);", "VAR_0->cmd.lba = scsi_cmd_lba(&VAR_0->cmd);", "trace_scsi_req_parsed(VAR_0->dev->id, VAR_0->lun, VAR_0->tag, VAR_1[0],\nVAR_0->cmd.mode, VAR_0->cmd.xfer);", "if (VAR_0->cmd.lba != -1) {", "trace_scsi_req_parsed_lba(VAR_0->dev->id, VAR_0->lun, VAR_0->tag, VAR_1[0],\nVAR_0->cmd.lba);", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19, 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 37, 39 ], [ 41 ], [ 43 ], [ 45 ] ]
11,952
void virtqueue_map_sg(struct iovec *sg, hwaddr *addr, size_t num_sg, int is_write) { unsigned int i; hwaddr len; if (num_sg >= VIRTQUEUE_MAX_SIZE) { error_report("virtio: map attempt out of bounds: %zd > %d", num_sg, VIRTQUEUE_MAX_SIZE); exit(1); } for (i = 0; i < num_sg; i++) { len = sg[i].iov_len; sg[i].iov_base = cpu_physical_memory_map(addr[i], &len, is_write); if (sg[i].iov_base == NULL || len != sg[i].iov_len) { error_report("virtio: trying to map MMIO memory"); exit(1); } } }
false
qemu
937251408051e0489f78e4db3c92e045b147b38b
void virtqueue_map_sg(struct iovec *sg, hwaddr *addr, size_t num_sg, int is_write) { unsigned int i; hwaddr len; if (num_sg >= VIRTQUEUE_MAX_SIZE) { error_report("virtio: map attempt out of bounds: %zd > %d", num_sg, VIRTQUEUE_MAX_SIZE); exit(1); } for (i = 0; i < num_sg; i++) { len = sg[i].iov_len; sg[i].iov_base = cpu_physical_memory_map(addr[i], &len, is_write); if (sg[i].iov_base == NULL || len != sg[i].iov_len) { error_report("virtio: trying to map MMIO memory"); exit(1); } } }
{ "code": [], "line_no": [] }
void FUNC_0(struct iovec *VAR_0, hwaddr *VAR_1, size_t VAR_2, int VAR_3) { unsigned int VAR_4; hwaddr len; if (VAR_2 >= VIRTQUEUE_MAX_SIZE) { error_report("virtio: map attempt out of bounds: %zd > %d", VAR_2, VIRTQUEUE_MAX_SIZE); exit(1); } for (VAR_4 = 0; VAR_4 < VAR_2; VAR_4++) { len = VAR_0[VAR_4].iov_len; VAR_0[VAR_4].iov_base = cpu_physical_memory_map(VAR_1[VAR_4], &len, VAR_3); if (VAR_0[VAR_4].iov_base == NULL || len != VAR_0[VAR_4].iov_len) { error_report("virtio: trying to map MMIO memory"); exit(1); } } }
[ "void FUNC_0(struct iovec *VAR_0, hwaddr *VAR_1,\nsize_t VAR_2, int VAR_3)\n{", "unsigned int VAR_4;", "hwaddr len;", "if (VAR_2 >= VIRTQUEUE_MAX_SIZE) {", "error_report(\"virtio: map attempt out of bounds: %zd > %d\",\nVAR_2, VIRTQUEUE_MAX_SIZE);", "exit(1);", "}", "for (VAR_4 = 0; VAR_4 < VAR_2; VAR_4++) {", "len = VAR_0[VAR_4].iov_len;", "VAR_0[VAR_4].iov_base = cpu_physical_memory_map(VAR_1[VAR_4], &len, VAR_3);", "if (VAR_0[VAR_4].iov_base == NULL || len != VAR_0[VAR_4].iov_len) {", "error_report(\"virtio: trying to map MMIO memory\");", "exit(1);", "}", "}", "}" ]
[ 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 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ] ]
11,953
static inline void gen_op_fcmpeq(int fccno) { switch (fccno) { case 0: gen_helper_fcmpeq(cpu_env); break; case 1: gen_helper_fcmpeq_fcc1(cpu_env); break; case 2: gen_helper_fcmpeq_fcc2(cpu_env); break; case 3: gen_helper_fcmpeq_fcc3(cpu_env); break; } }
false
qemu
7385aed20db5d83979f683b9d0048674411e963c
static inline void gen_op_fcmpeq(int fccno) { switch (fccno) { case 0: gen_helper_fcmpeq(cpu_env); break; case 1: gen_helper_fcmpeq_fcc1(cpu_env); break; case 2: gen_helper_fcmpeq_fcc2(cpu_env); break; case 3: gen_helper_fcmpeq_fcc3(cpu_env); break; } }
{ "code": [], "line_no": [] }
static inline void FUNC_0(int VAR_0) { switch (VAR_0) { case 0: gen_helper_fcmpeq(cpu_env); break; case 1: gen_helper_fcmpeq_fcc1(cpu_env); break; case 2: gen_helper_fcmpeq_fcc2(cpu_env); break; case 3: gen_helper_fcmpeq_fcc3(cpu_env); break; } }
[ "static inline void FUNC_0(int VAR_0)\n{", "switch (VAR_0) {", "case 0:\ngen_helper_fcmpeq(cpu_env);", "break;", "case 1:\ngen_helper_fcmpeq_fcc1(cpu_env);", "break;", "case 2:\ngen_helper_fcmpeq_fcc2(cpu_env);", "break;", "case 3:\ngen_helper_fcmpeq_fcc3(cpu_env);", "break;", "}", "}" ]
[ 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 ] ]
11,954
static bool pc_machine_get_vmport(Object *obj, Error **errp) { PCMachineState *pcms = PC_MACHINE(obj); return pcms->vmport; }
false
qemu
d1048bef9df0aacde9a54bf9b5b97a6e10950d8c
static bool pc_machine_get_vmport(Object *obj, Error **errp) { PCMachineState *pcms = PC_MACHINE(obj); return pcms->vmport; }
{ "code": [], "line_no": [] }
static bool FUNC_0(Object *obj, Error **errp) { PCMachineState *pcms = PC_MACHINE(obj); return pcms->vmport; }
[ "static bool FUNC_0(Object *obj, Error **errp)\n{", "PCMachineState *pcms = PC_MACHINE(obj);", "return pcms->vmport;", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ] ]
11,956
pvscsi_convert_sglist(PVSCSIRequest *r) { int chunk_size; uint64_t data_length = r->req.dataLen; PVSCSISGState sg = r->sg; while (data_length) { while (!sg.resid) { pvscsi_get_next_sg_elem(&sg); trace_pvscsi_convert_sglist(r->req.context, r->sg.dataAddr, r->sg.resid); } assert(data_length > 0); chunk_size = MIN((unsigned) data_length, sg.resid); if (chunk_size) { qemu_sglist_add(&r->sgl, sg.dataAddr, chunk_size); } sg.dataAddr += chunk_size; data_length -= chunk_size; sg.resid -= chunk_size; } }
false
qemu
49adc5d3f8c6bb75e55ebfeab109c5c37dea65e8
pvscsi_convert_sglist(PVSCSIRequest *r) { int chunk_size; uint64_t data_length = r->req.dataLen; PVSCSISGState sg = r->sg; while (data_length) { while (!sg.resid) { pvscsi_get_next_sg_elem(&sg); trace_pvscsi_convert_sglist(r->req.context, r->sg.dataAddr, r->sg.resid); } assert(data_length > 0); chunk_size = MIN((unsigned) data_length, sg.resid); if (chunk_size) { qemu_sglist_add(&r->sgl, sg.dataAddr, chunk_size); } sg.dataAddr += chunk_size; data_length -= chunk_size; sg.resid -= chunk_size; } }
{ "code": [], "line_no": [] }
FUNC_0(PVSCSIRequest *VAR_0) { int VAR_1; uint64_t data_length = VAR_0->req.dataLen; PVSCSISGState sg = VAR_0->sg; while (data_length) { while (!sg.resid) { pvscsi_get_next_sg_elem(&sg); trace_pvscsi_convert_sglist(VAR_0->req.context, VAR_0->sg.dataAddr, VAR_0->sg.resid); } assert(data_length > 0); VAR_1 = MIN((unsigned) data_length, sg.resid); if (VAR_1) { qemu_sglist_add(&VAR_0->sgl, sg.dataAddr, VAR_1); } sg.dataAddr += VAR_1; data_length -= VAR_1; sg.resid -= VAR_1; } }
[ "FUNC_0(PVSCSIRequest *VAR_0)\n{", "int VAR_1;", "uint64_t data_length = VAR_0->req.dataLen;", "PVSCSISGState sg = VAR_0->sg;", "while (data_length) {", "while (!sg.resid) {", "pvscsi_get_next_sg_elem(&sg);", "trace_pvscsi_convert_sglist(VAR_0->req.context, VAR_0->sg.dataAddr,\nVAR_0->sg.resid);", "}", "assert(data_length > 0);", "VAR_1 = MIN((unsigned) data_length, sg.resid);", "if (VAR_1) {", "qemu_sglist_add(&VAR_0->sgl, sg.dataAddr, VAR_1);", "}", "sg.dataAddr += VAR_1;", "data_length -= VAR_1;", "sg.resid -= 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 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ] ]
11,959
static void av_estimate_timings_from_pts(AVFormatContext *ic) { AVPacket pkt1, *pkt = &pkt1; AVStream *st; int read_size, i, ret; int64_t start_time, end_time, end_time1; int64_t filesize, offset, duration; /* we read the first packets to get the first PTS (not fully accurate, but it is enough now) */ url_fseek(&ic->pb, 0, SEEK_SET); read_size = 0; for(;;) { if (read_size >= DURATION_MAX_READ_SIZE) break; /* if all info is available, we can stop */ for(i = 0;i < ic->nb_streams; i++) { st = ic->streams[i]; if (st->start_time == AV_NOPTS_VALUE) break; } if (i == ic->nb_streams) break; ret = av_read_packet(ic, pkt); if (ret != 0) break; read_size += pkt->size; st = ic->streams[pkt->stream_index]; if (pkt->pts != AV_NOPTS_VALUE) { if (st->start_time == AV_NOPTS_VALUE) st->start_time = (int64_t)((double)pkt->pts * ic->pts_num * (double)AV_TIME_BASE / ic->pts_den); } av_free_packet(pkt); } /* we compute the minimum start_time and use it as default */ start_time = MAXINT64; for(i = 0; i < ic->nb_streams; i++) { st = ic->streams[i]; if (st->start_time != AV_NOPTS_VALUE && st->start_time < start_time) start_time = st->start_time; } fprintf(stderr, "start=%lld\n", start_time); if (start_time != MAXINT64) ic->start_time = start_time; /* estimate the end time (duration) */ /* XXX: may need to support wrapping */ filesize = ic->file_size; offset = filesize - DURATION_MAX_READ_SIZE; if (offset < 0) offset = 0; /* flush packet queue */ flush_packet_queue(ic); url_fseek(&ic->pb, offset, SEEK_SET); read_size = 0; for(;;) { if (read_size >= DURATION_MAX_READ_SIZE) break; /* if all info is available, we can stop */ for(i = 0;i < ic->nb_streams; i++) { st = ic->streams[i]; if (st->duration == AV_NOPTS_VALUE) break; } if (i == ic->nb_streams) break; ret = av_read_packet(ic, pkt); if (ret != 0) break; read_size += pkt->size; st = ic->streams[pkt->stream_index]; if (pkt->pts != AV_NOPTS_VALUE) { end_time = (int64_t)((double)pkt->pts * ic->pts_num * (double)AV_TIME_BASE / ic->pts_den); duration = end_time - st->start_time; if (duration > 0) { if (st->duration == AV_NOPTS_VALUE || st->duration < duration) st->duration = duration; } } av_free_packet(pkt); } /* estimate total duration */ end_time = MININT64; for(i = 0;i < ic->nb_streams; i++) { st = ic->streams[i]; if (st->duration != AV_NOPTS_VALUE) { end_time1 = st->start_time + st->duration; if (end_time1 > end_time) end_time = end_time1; } } /* update start_time (new stream may have been created, so we do it at the end */ if (ic->start_time != AV_NOPTS_VALUE) { for(i = 0; i < ic->nb_streams; i++) { st = ic->streams[i]; if (st->start_time == AV_NOPTS_VALUE) st->start_time = ic->start_time; } } if (end_time != MININT64) { /* put dummy values for duration if needed */ for(i = 0;i < ic->nb_streams; i++) { st = ic->streams[i]; if (st->duration == AV_NOPTS_VALUE && st->start_time != AV_NOPTS_VALUE) st->duration = end_time - st->start_time; } ic->duration = end_time - ic->start_time; } url_fseek(&ic->pb, 0, SEEK_SET); }
false
FFmpeg
22b37f5d3200cfe4c15eded883663cf0612093c1
static void av_estimate_timings_from_pts(AVFormatContext *ic) { AVPacket pkt1, *pkt = &pkt1; AVStream *st; int read_size, i, ret; int64_t start_time, end_time, end_time1; int64_t filesize, offset, duration; url_fseek(&ic->pb, 0, SEEK_SET); read_size = 0; for(;;) { if (read_size >= DURATION_MAX_READ_SIZE) break; for(i = 0;i < ic->nb_streams; i++) { st = ic->streams[i]; if (st->start_time == AV_NOPTS_VALUE) break; } if (i == ic->nb_streams) break; ret = av_read_packet(ic, pkt); if (ret != 0) break; read_size += pkt->size; st = ic->streams[pkt->stream_index]; if (pkt->pts != AV_NOPTS_VALUE) { if (st->start_time == AV_NOPTS_VALUE) st->start_time = (int64_t)((double)pkt->pts * ic->pts_num * (double)AV_TIME_BASE / ic->pts_den); } av_free_packet(pkt); } start_time = MAXINT64; for(i = 0; i < ic->nb_streams; i++) { st = ic->streams[i]; if (st->start_time != AV_NOPTS_VALUE && st->start_time < start_time) start_time = st->start_time; } fprintf(stderr, "start=%lld\n", start_time); if (start_time != MAXINT64) ic->start_time = start_time; filesize = ic->file_size; offset = filesize - DURATION_MAX_READ_SIZE; if (offset < 0) offset = 0; flush_packet_queue(ic); url_fseek(&ic->pb, offset, SEEK_SET); read_size = 0; for(;;) { if (read_size >= DURATION_MAX_READ_SIZE) break; for(i = 0;i < ic->nb_streams; i++) { st = ic->streams[i]; if (st->duration == AV_NOPTS_VALUE) break; } if (i == ic->nb_streams) break; ret = av_read_packet(ic, pkt); if (ret != 0) break; read_size += pkt->size; st = ic->streams[pkt->stream_index]; if (pkt->pts != AV_NOPTS_VALUE) { end_time = (int64_t)((double)pkt->pts * ic->pts_num * (double)AV_TIME_BASE / ic->pts_den); duration = end_time - st->start_time; if (duration > 0) { if (st->duration == AV_NOPTS_VALUE || st->duration < duration) st->duration = duration; } } av_free_packet(pkt); } end_time = MININT64; for(i = 0;i < ic->nb_streams; i++) { st = ic->streams[i]; if (st->duration != AV_NOPTS_VALUE) { end_time1 = st->start_time + st->duration; if (end_time1 > end_time) end_time = end_time1; } } if (ic->start_time != AV_NOPTS_VALUE) { for(i = 0; i < ic->nb_streams; i++) { st = ic->streams[i]; if (st->start_time == AV_NOPTS_VALUE) st->start_time = ic->start_time; } } if (end_time != MININT64) { for(i = 0;i < ic->nb_streams; i++) { st = ic->streams[i]; if (st->duration == AV_NOPTS_VALUE && st->start_time != AV_NOPTS_VALUE) st->duration = end_time - st->start_time; } ic->duration = end_time - ic->start_time; } url_fseek(&ic->pb, 0, SEEK_SET); }
{ "code": [], "line_no": [] }
static void FUNC_0(AVFormatContext *VAR_0) { AVPacket pkt1, *pkt = &pkt1; AVStream *st; int VAR_1, VAR_2, VAR_3; int64_t start_time, end_time, end_time1; int64_t filesize, offset, duration; url_fseek(&VAR_0->pb, 0, SEEK_SET); VAR_1 = 0; for(;;) { if (VAR_1 >= DURATION_MAX_READ_SIZE) break; for(VAR_2 = 0;VAR_2 < VAR_0->nb_streams; VAR_2++) { st = VAR_0->streams[VAR_2]; if (st->start_time == AV_NOPTS_VALUE) break; } if (VAR_2 == VAR_0->nb_streams) break; VAR_3 = av_read_packet(VAR_0, pkt); if (VAR_3 != 0) break; VAR_1 += pkt->size; st = VAR_0->streams[pkt->stream_index]; if (pkt->pts != AV_NOPTS_VALUE) { if (st->start_time == AV_NOPTS_VALUE) st->start_time = (int64_t)((double)pkt->pts * VAR_0->pts_num * (double)AV_TIME_BASE / VAR_0->pts_den); } av_free_packet(pkt); } start_time = MAXINT64; for(VAR_2 = 0; VAR_2 < VAR_0->nb_streams; VAR_2++) { st = VAR_0->streams[VAR_2]; if (st->start_time != AV_NOPTS_VALUE && st->start_time < start_time) start_time = st->start_time; } fprintf(stderr, "start=%lld\n", start_time); if (start_time != MAXINT64) VAR_0->start_time = start_time; filesize = VAR_0->file_size; offset = filesize - DURATION_MAX_READ_SIZE; if (offset < 0) offset = 0; flush_packet_queue(VAR_0); url_fseek(&VAR_0->pb, offset, SEEK_SET); VAR_1 = 0; for(;;) { if (VAR_1 >= DURATION_MAX_READ_SIZE) break; for(VAR_2 = 0;VAR_2 < VAR_0->nb_streams; VAR_2++) { st = VAR_0->streams[VAR_2]; if (st->duration == AV_NOPTS_VALUE) break; } if (VAR_2 == VAR_0->nb_streams) break; VAR_3 = av_read_packet(VAR_0, pkt); if (VAR_3 != 0) break; VAR_1 += pkt->size; st = VAR_0->streams[pkt->stream_index]; if (pkt->pts != AV_NOPTS_VALUE) { end_time = (int64_t)((double)pkt->pts * VAR_0->pts_num * (double)AV_TIME_BASE / VAR_0->pts_den); duration = end_time - st->start_time; if (duration > 0) { if (st->duration == AV_NOPTS_VALUE || st->duration < duration) st->duration = duration; } } av_free_packet(pkt); } end_time = MININT64; for(VAR_2 = 0;VAR_2 < VAR_0->nb_streams; VAR_2++) { st = VAR_0->streams[VAR_2]; if (st->duration != AV_NOPTS_VALUE) { end_time1 = st->start_time + st->duration; if (end_time1 > end_time) end_time = end_time1; } } if (VAR_0->start_time != AV_NOPTS_VALUE) { for(VAR_2 = 0; VAR_2 < VAR_0->nb_streams; VAR_2++) { st = VAR_0->streams[VAR_2]; if (st->start_time == AV_NOPTS_VALUE) st->start_time = VAR_0->start_time; } } if (end_time != MININT64) { for(VAR_2 = 0;VAR_2 < VAR_0->nb_streams; VAR_2++) { st = VAR_0->streams[VAR_2]; if (st->duration == AV_NOPTS_VALUE && st->start_time != AV_NOPTS_VALUE) st->duration = end_time - st->start_time; } VAR_0->duration = end_time - VAR_0->start_time; } url_fseek(&VAR_0->pb, 0, SEEK_SET); }
[ "static void FUNC_0(AVFormatContext *VAR_0)\n{", "AVPacket pkt1, *pkt = &pkt1;", "AVStream *st;", "int VAR_1, VAR_2, VAR_3;", "int64_t start_time, end_time, end_time1;", "int64_t filesize, offset, duration;", "url_fseek(&VAR_0->pb, 0, SEEK_SET);", "VAR_1 = 0;", "for(;;) {", "if (VAR_1 >= DURATION_MAX_READ_SIZE)\nbreak;", "for(VAR_2 = 0;VAR_2 < VAR_0->nb_streams; VAR_2++) {", "st = VAR_0->streams[VAR_2];", "if (st->start_time == AV_NOPTS_VALUE)\nbreak;", "}", "if (VAR_2 == VAR_0->nb_streams)\nbreak;", "VAR_3 = av_read_packet(VAR_0, pkt);", "if (VAR_3 != 0)\nbreak;", "VAR_1 += pkt->size;", "st = VAR_0->streams[pkt->stream_index];", "if (pkt->pts != AV_NOPTS_VALUE) {", "if (st->start_time == AV_NOPTS_VALUE)\nst->start_time = (int64_t)((double)pkt->pts * VAR_0->pts_num * (double)AV_TIME_BASE / VAR_0->pts_den);", "}", "av_free_packet(pkt);", "}", "start_time = MAXINT64;", "for(VAR_2 = 0; VAR_2 < VAR_0->nb_streams; VAR_2++) {", "st = VAR_0->streams[VAR_2];", "if (st->start_time != AV_NOPTS_VALUE &&\nst->start_time < start_time)\nstart_time = st->start_time;", "}", "fprintf(stderr, \"start=%lld\\n\", start_time);", "if (start_time != MAXINT64)\nVAR_0->start_time = start_time;", "filesize = VAR_0->file_size;", "offset = filesize - DURATION_MAX_READ_SIZE;", "if (offset < 0)\noffset = 0;", "flush_packet_queue(VAR_0);", "url_fseek(&VAR_0->pb, offset, SEEK_SET);", "VAR_1 = 0;", "for(;;) {", "if (VAR_1 >= DURATION_MAX_READ_SIZE)\nbreak;", "for(VAR_2 = 0;VAR_2 < VAR_0->nb_streams; VAR_2++) {", "st = VAR_0->streams[VAR_2];", "if (st->duration == AV_NOPTS_VALUE)\nbreak;", "}", "if (VAR_2 == VAR_0->nb_streams)\nbreak;", "VAR_3 = av_read_packet(VAR_0, pkt);", "if (VAR_3 != 0)\nbreak;", "VAR_1 += pkt->size;", "st = VAR_0->streams[pkt->stream_index];", "if (pkt->pts != AV_NOPTS_VALUE) {", "end_time = (int64_t)((double)pkt->pts * VAR_0->pts_num * (double)AV_TIME_BASE / VAR_0->pts_den);", "duration = end_time - st->start_time;", "if (duration > 0) {", "if (st->duration == AV_NOPTS_VALUE ||\nst->duration < duration)\nst->duration = duration;", "}", "}", "av_free_packet(pkt);", "}", "end_time = MININT64;", "for(VAR_2 = 0;VAR_2 < VAR_0->nb_streams; VAR_2++) {", "st = VAR_0->streams[VAR_2];", "if (st->duration != AV_NOPTS_VALUE) {", "end_time1 = st->start_time + st->duration;", "if (end_time1 > end_time)\nend_time = end_time1;", "}", "}", "if (VAR_0->start_time != AV_NOPTS_VALUE) {", "for(VAR_2 = 0; VAR_2 < VAR_0->nb_streams; VAR_2++) {", "st = VAR_0->streams[VAR_2];", "if (st->start_time == AV_NOPTS_VALUE)\nst->start_time = VAR_0->start_time;", "}", "}", "if (end_time != MININT64) {", "for(VAR_2 = 0;VAR_2 < VAR_0->nb_streams; VAR_2++) {", "st = VAR_0->streams[VAR_2];", "if (st->duration == AV_NOPTS_VALUE &&\nst->start_time != AV_NOPTS_VALUE)\nst->duration = end_time - st->start_time;", "}", "VAR_0->duration = end_time - VAR_0->start_time;", "}", "url_fseek(&VAR_0->pb, 0, SEEK_SET);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 21 ], [ 23 ], [ 25 ], [ 27, 29 ], [ 33 ], [ 35 ], [ 37, 39 ], [ 41 ], [ 43, 45 ], [ 49 ], [ 51, 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61, 63 ], [ 65 ], [ 67 ], [ 69 ], [ 75 ], [ 77 ], [ 79 ], [ 81, 83, 85 ], [ 87 ], [ 89 ], [ 91, 93 ], [ 101 ], [ 103 ], [ 105, 107 ], [ 113 ], [ 117 ], [ 119 ], [ 121 ], [ 123, 125 ], [ 129 ], [ 131 ], [ 133, 135 ], [ 137 ], [ 139, 141 ], [ 145 ], [ 147, 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163, 165, 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191, 193 ], [ 195 ], [ 197 ], [ 205 ], [ 207 ], [ 209 ], [ 211, 213 ], [ 215 ], [ 217 ], [ 221 ], [ 225 ], [ 227 ], [ 229, 231, 233 ], [ 235 ], [ 237 ], [ 239 ], [ 243 ], [ 245 ] ]
11,960
bool qemu_clock_run_all_timers(void) { bool progress = false; QEMUClockType type; for (type = 0; type < QEMU_CLOCK_MAX; type++) { progress |= qemu_clock_run_timers(type); } return progress; }
false
qemu
c2b38b277a7882a592f4f2ec955084b2b756daaa
bool qemu_clock_run_all_timers(void) { bool progress = false; QEMUClockType type; for (type = 0; type < QEMU_CLOCK_MAX; type++) { progress |= qemu_clock_run_timers(type); } return progress; }
{ "code": [], "line_no": [] }
bool FUNC_0(void) { bool progress = false; QEMUClockType type; for (type = 0; type < QEMU_CLOCK_MAX; type++) { progress |= qemu_clock_run_timers(type); } return progress; }
[ "bool FUNC_0(void)\n{", "bool progress = false;", "QEMUClockType type;", "for (type = 0; type < QEMU_CLOCK_MAX; type++) {", "progress |= qemu_clock_run_timers(type);", "}", "return progress;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ] ]
11,961
static int put_uint64_as_uint32(QEMUFile *f, void *pv, size_t size, VMStateField *field, QJSON *vmdesc) { uint64_t *v = pv; qemu_put_be32(f, *v); return 0; }
false
qemu
08b277ac46da8b02e50cec455eca7cb2d12ffcf0
static int put_uint64_as_uint32(QEMUFile *f, void *pv, size_t size, VMStateField *field, QJSON *vmdesc) { uint64_t *v = pv; qemu_put_be32(f, *v); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(QEMUFile *VAR_0, void *VAR_1, size_t VAR_2, VMStateField *VAR_3, QJSON *VAR_4) { uint64_t *v = VAR_1; qemu_put_be32(VAR_0, *v); return 0; }
[ "static int FUNC_0(QEMUFile *VAR_0, void *VAR_1, size_t VAR_2,\nVMStateField *VAR_3, QJSON *VAR_4)\n{", "uint64_t *v = VAR_1;", "qemu_put_be32(VAR_0, *v);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ] ]
11,962
static void scsi_dma_restart_bh(void *opaque) { SCSIDevice *s = opaque; SCSIRequest *req, *next; qemu_bh_delete(s->bh); s->bh = NULL; QTAILQ_FOREACH_SAFE(req, &s->requests, next, next) { scsi_req_ref(req); if (req->retry) { req->retry = false; switch (req->cmd.mode) { case SCSI_XFER_FROM_DEV: case SCSI_XFER_TO_DEV: scsi_req_continue(req); break; case SCSI_XFER_NONE: assert(!req->sg); scsi_req_dequeue(req); scsi_req_enqueue(req); break; } } scsi_req_unref(req); } }
false
qemu
d581eb7ca4b58649ade5fb7570ecf6b4b9a41879
static void scsi_dma_restart_bh(void *opaque) { SCSIDevice *s = opaque; SCSIRequest *req, *next; qemu_bh_delete(s->bh); s->bh = NULL; QTAILQ_FOREACH_SAFE(req, &s->requests, next, next) { scsi_req_ref(req); if (req->retry) { req->retry = false; switch (req->cmd.mode) { case SCSI_XFER_FROM_DEV: case SCSI_XFER_TO_DEV: scsi_req_continue(req); break; case SCSI_XFER_NONE: assert(!req->sg); scsi_req_dequeue(req); scsi_req_enqueue(req); break; } } scsi_req_unref(req); } }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0) { SCSIDevice *s = VAR_0; SCSIRequest *req, *next; qemu_bh_delete(s->bh); s->bh = NULL; QTAILQ_FOREACH_SAFE(req, &s->requests, next, next) { scsi_req_ref(req); if (req->retry) { req->retry = false; switch (req->cmd.mode) { case SCSI_XFER_FROM_DEV: case SCSI_XFER_TO_DEV: scsi_req_continue(req); break; case SCSI_XFER_NONE: assert(!req->sg); scsi_req_dequeue(req); scsi_req_enqueue(req); break; } } scsi_req_unref(req); } }
[ "static void FUNC_0(void *VAR_0)\n{", "SCSIDevice *s = VAR_0;", "SCSIRequest *req, *next;", "qemu_bh_delete(s->bh);", "s->bh = NULL;", "QTAILQ_FOREACH_SAFE(req, &s->requests, next, next) {", "scsi_req_ref(req);", "if (req->retry) {", "req->retry = false;", "switch (req->cmd.mode) {", "case SCSI_XFER_FROM_DEV:\ncase SCSI_XFER_TO_DEV:\nscsi_req_continue(req);", "break;", "case SCSI_XFER_NONE:\nassert(!req->sg);", "scsi_req_dequeue(req);", "scsi_req_enqueue(req);", "break;", "}", "}", "scsi_req_unref(req);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27, 29, 31 ], [ 33 ], [ 35, 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ] ]
11,964
static uint64_t get_guest_rtc_ns(RTCState *s) { uint64_t guest_rtc; uint64_t guest_clock = qemu_clock_get_ns(rtc_clock); guest_rtc = s->base_rtc * NANOSECONDS_PER_SECOND + guest_clock - s->last_update + s->offset; return guest_rtc; }
false
qemu
9be385980d37e8f4fd33f605f5fb1c3d144170a8
static uint64_t get_guest_rtc_ns(RTCState *s) { uint64_t guest_rtc; uint64_t guest_clock = qemu_clock_get_ns(rtc_clock); guest_rtc = s->base_rtc * NANOSECONDS_PER_SECOND + guest_clock - s->last_update + s->offset; return guest_rtc; }
{ "code": [], "line_no": [] }
static uint64_t FUNC_0(RTCState *s) { uint64_t guest_rtc; uint64_t guest_clock = qemu_clock_get_ns(rtc_clock); guest_rtc = s->base_rtc * NANOSECONDS_PER_SECOND + guest_clock - s->last_update + s->offset; return guest_rtc; }
[ "static uint64_t FUNC_0(RTCState *s)\n{", "uint64_t guest_rtc;", "uint64_t guest_clock = qemu_clock_get_ns(rtc_clock);", "guest_rtc = s->base_rtc * NANOSECONDS_PER_SECOND +\nguest_clock - s->last_update + s->offset;", "return guest_rtc;", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11, 13 ], [ 15 ], [ 17 ] ]
11,966
static void openpic_reset(DeviceState *d) { OpenPICState *opp = FROM_SYSBUS(typeof (*opp), sysbus_from_qdev(d)); int i; opp->glbc = GLBC_RESET; /* Initialise controller registers */ opp->frep = ((opp->nb_irqs -1) << FREP_NIRQ_SHIFT) | ((opp->nb_cpus -1) << FREP_NCPU_SHIFT) | (opp->vid << FREP_VID_SHIFT); opp->pint = 0; opp->spve = -1 & opp->spve_mask; opp->tifr = opp->tifr_reset; /* Initialise IRQ sources */ for (i = 0; i < opp->max_irq; i++) { opp->src[i].ipvp = opp->ipvp_reset; opp->src[i].ide = opp->ide_reset; } /* Initialise IRQ destinations */ for (i = 0; i < MAX_CPU; i++) { opp->dst[i].pctp = 15; opp->dst[i].pcsr = 0x00000000; memset(&opp->dst[i].raised, 0, sizeof(IRQ_queue_t)); opp->dst[i].raised.next = -1; memset(&opp->dst[i].servicing, 0, sizeof(IRQ_queue_t)); opp->dst[i].servicing.next = -1; } /* Initialise timers */ for (i = 0; i < MAX_TMR; i++) { opp->timers[i].ticc = 0; opp->timers[i].tibc = TIBC_CI; } /* Go out of RESET state */ opp->glbc = 0; }
false
qemu
c975330ec4f5674f2899331f914c04ecba6edf26
static void openpic_reset(DeviceState *d) { OpenPICState *opp = FROM_SYSBUS(typeof (*opp), sysbus_from_qdev(d)); int i; opp->glbc = GLBC_RESET; opp->frep = ((opp->nb_irqs -1) << FREP_NIRQ_SHIFT) | ((opp->nb_cpus -1) << FREP_NCPU_SHIFT) | (opp->vid << FREP_VID_SHIFT); opp->pint = 0; opp->spve = -1 & opp->spve_mask; opp->tifr = opp->tifr_reset; for (i = 0; i < opp->max_irq; i++) { opp->src[i].ipvp = opp->ipvp_reset; opp->src[i].ide = opp->ide_reset; } for (i = 0; i < MAX_CPU; i++) { opp->dst[i].pctp = 15; opp->dst[i].pcsr = 0x00000000; memset(&opp->dst[i].raised, 0, sizeof(IRQ_queue_t)); opp->dst[i].raised.next = -1; memset(&opp->dst[i].servicing, 0, sizeof(IRQ_queue_t)); opp->dst[i].servicing.next = -1; } for (i = 0; i < MAX_TMR; i++) { opp->timers[i].ticc = 0; opp->timers[i].tibc = TIBC_CI; } opp->glbc = 0; }
{ "code": [], "line_no": [] }
static void FUNC_0(DeviceState *VAR_0) { OpenPICState *opp = FROM_SYSBUS(typeof (*opp), sysbus_from_qdev(VAR_0)); int VAR_1; opp->glbc = GLBC_RESET; opp->frep = ((opp->nb_irqs -1) << FREP_NIRQ_SHIFT) | ((opp->nb_cpus -1) << FREP_NCPU_SHIFT) | (opp->vid << FREP_VID_SHIFT); opp->pint = 0; opp->spve = -1 & opp->spve_mask; opp->tifr = opp->tifr_reset; for (VAR_1 = 0; VAR_1 < opp->max_irq; VAR_1++) { opp->src[VAR_1].ipvp = opp->ipvp_reset; opp->src[VAR_1].ide = opp->ide_reset; } for (VAR_1 = 0; VAR_1 < MAX_CPU; VAR_1++) { opp->dst[VAR_1].pctp = 15; opp->dst[VAR_1].pcsr = 0x00000000; memset(&opp->dst[VAR_1].raised, 0, sizeof(IRQ_queue_t)); opp->dst[VAR_1].raised.next = -1; memset(&opp->dst[VAR_1].servicing, 0, sizeof(IRQ_queue_t)); opp->dst[VAR_1].servicing.next = -1; } for (VAR_1 = 0; VAR_1 < MAX_TMR; VAR_1++) { opp->timers[VAR_1].ticc = 0; opp->timers[VAR_1].tibc = TIBC_CI; } opp->glbc = 0; }
[ "static void FUNC_0(DeviceState *VAR_0)\n{", "OpenPICState *opp = FROM_SYSBUS(typeof (*opp), sysbus_from_qdev(VAR_0));", "int VAR_1;", "opp->glbc = GLBC_RESET;", "opp->frep = ((opp->nb_irqs -1) << FREP_NIRQ_SHIFT) |\n((opp->nb_cpus -1) << FREP_NCPU_SHIFT) |\n(opp->vid << FREP_VID_SHIFT);", "opp->pint = 0;", "opp->spve = -1 & opp->spve_mask;", "opp->tifr = opp->tifr_reset;", "for (VAR_1 = 0; VAR_1 < opp->max_irq; VAR_1++) {", "opp->src[VAR_1].ipvp = opp->ipvp_reset;", "opp->src[VAR_1].ide = opp->ide_reset;", "}", "for (VAR_1 = 0; VAR_1 < MAX_CPU; VAR_1++) {", "opp->dst[VAR_1].pctp = 15;", "opp->dst[VAR_1].pcsr = 0x00000000;", "memset(&opp->dst[VAR_1].raised, 0, sizeof(IRQ_queue_t));", "opp->dst[VAR_1].raised.next = -1;", "memset(&opp->dst[VAR_1].servicing, 0, sizeof(IRQ_queue_t));", "opp->dst[VAR_1].servicing.next = -1;", "}", "for (VAR_1 = 0; VAR_1 < MAX_TMR; VAR_1++) {", "opp->timers[VAR_1].ticc = 0;", "opp->timers[VAR_1].tibc = TIBC_CI;", "}", "opp->glbc = 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 15, 17, 19 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ] ]
11,967
static inline int handle_cpu_signal(unsigned long pc, unsigned long address, int is_write, sigset_t *old_set, void *puc) { TranslationBlock *tb; int ret; if (cpu_single_env) env = cpu_single_env; /* XXX: find a correct solution for multithread */ #if defined(DEBUG_SIGNAL) printf("qemu: SIGSEGV pc=0x%08lx address=%08lx w=%d oldset=0x%08lx\n", pc, address, is_write, *(unsigned long *)old_set); #endif /* XXX: locking issue */ if (is_write && page_unprotect(h2g(address), pc, puc)) { return 1; } /* see if it is an MMU fault */ ret = cpu_mb_handle_mmu_fault(env, address, is_write, MMU_USER_IDX, 0); if (ret < 0) return 0; /* not an MMU fault */ if (ret == 0) return 1; /* the MMU fault was handled without causing real CPU fault */ /* now we have a real cpu fault */ tb = tb_find_pc(pc); if (tb) { /* the PC is inside the translated code. It means that we have a virtual CPU fault */ cpu_restore_state(tb, env, pc, puc); } if (ret == 1) { #if 0 printf("PF exception: PC=0x" TARGET_FMT_lx " error=0x%x %p\n", env->PC, env->error_code, tb); #endif /* we restore the process signal mask as the sigreturn should do it (XXX: use sigsetjmp) */ sigprocmask(SIG_SETMASK, old_set, NULL); cpu_loop_exit(); } else { /* activate soft MMU for this block */ cpu_resume_from_signal(env, puc); } /* never comes here */ return 1; }
false
qemu
0b5c1ce8467384327b80a55218d3e57f48985990
static inline int handle_cpu_signal(unsigned long pc, unsigned long address, int is_write, sigset_t *old_set, void *puc) { TranslationBlock *tb; int ret; if (cpu_single_env) env = cpu_single_env; #if defined(DEBUG_SIGNAL) printf("qemu: SIGSEGV pc=0x%08lx address=%08lx w=%d oldset=0x%08lx\n", pc, address, is_write, *(unsigned long *)old_set); #endif if (is_write && page_unprotect(h2g(address), pc, puc)) { return 1; } ret = cpu_mb_handle_mmu_fault(env, address, is_write, MMU_USER_IDX, 0); if (ret < 0) return 0; if (ret == 0) return 1; tb = tb_find_pc(pc); if (tb) { cpu_restore_state(tb, env, pc, puc); } if (ret == 1) { #if 0 printf("PF exception: PC=0x" TARGET_FMT_lx " error=0x%x %p\n", env->PC, env->error_code, tb); #endif sigprocmask(SIG_SETMASK, old_set, NULL); cpu_loop_exit(); } else { cpu_resume_from_signal(env, puc); } return 1; }
{ "code": [], "line_no": [] }
static inline int FUNC_0(unsigned long VAR_0, unsigned long VAR_1, int VAR_2, sigset_t *VAR_3, void *VAR_4) { TranslationBlock *tb; int VAR_5; if (cpu_single_env) env = cpu_single_env; #if defined(DEBUG_SIGNAL) printf("qemu: SIGSEGV VAR_0=0x%08lx VAR_1=%08lx w=%d oldset=0x%08lx\n", VAR_0, VAR_1, VAR_2, *(unsigned long *)VAR_3); #endif if (VAR_2 && page_unprotect(h2g(VAR_1), VAR_0, VAR_4)) { return 1; } VAR_5 = cpu_mb_handle_mmu_fault(env, VAR_1, VAR_2, MMU_USER_IDX, 0); if (VAR_5 < 0) return 0; if (VAR_5 == 0) return 1; tb = tb_find_pc(VAR_0); if (tb) { cpu_restore_state(tb, env, VAR_0, VAR_4); } if (VAR_5 == 1) { #if 0 printf("PF exception: PC=0x" TARGET_FMT_lx " error=0x%x %p\n", env->PC, env->error_code, tb); #endif sigprocmask(SIG_SETMASK, VAR_3, NULL); cpu_loop_exit(); } else { cpu_resume_from_signal(env, VAR_4); } return 1; }
[ "static inline int FUNC_0(unsigned long VAR_0, unsigned long VAR_1,\nint VAR_2, sigset_t *VAR_3,\nvoid *VAR_4)\n{", "TranslationBlock *tb;", "int VAR_5;", "if (cpu_single_env)\nenv = cpu_single_env;", "#if defined(DEBUG_SIGNAL)\nprintf(\"qemu: SIGSEGV VAR_0=0x%08lx VAR_1=%08lx w=%d oldset=0x%08lx\\n\",\nVAR_0, VAR_1, VAR_2, *(unsigned long *)VAR_3);", "#endif\nif (VAR_2 && page_unprotect(h2g(VAR_1), VAR_0, VAR_4)) {", "return 1;", "}", "VAR_5 = cpu_mb_handle_mmu_fault(env, VAR_1, VAR_2, MMU_USER_IDX, 0);", "if (VAR_5 < 0)\nreturn 0;", "if (VAR_5 == 0)\nreturn 1;", "tb = tb_find_pc(VAR_0);", "if (tb) {", "cpu_restore_state(tb, env, VAR_0, VAR_4);", "}", "if (VAR_5 == 1) {", "#if 0\nprintf(\"PF exception: PC=0x\" TARGET_FMT_lx \" error=0x%x %p\\n\",\nenv->PC, env->error_code, tb);", "#endif\nsigprocmask(SIG_SETMASK, VAR_3, NULL);", "cpu_loop_exit();", "} else {", "cpu_resume_from_signal(env, VAR_4);", "}", "return 1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 15, 17 ], [ 19, 21, 23 ], [ 25, 29 ], [ 31 ], [ 33 ], [ 39 ], [ 41, 43 ], [ 45, 47 ], [ 53 ], [ 55 ], [ 61 ], [ 63 ], [ 65 ], [ 67, 69, 71 ], [ 73, 79 ], [ 81 ], [ 83 ], [ 87 ], [ 89 ], [ 93 ], [ 95 ] ]
11,970
static int scan_mmco_reset(AVCodecParserContext *s, GetBitContext *gb) { H264PredWeightTable pwt; int slice_type_nos = s->pict_type & 3; H264ParseContext *p = s->priv_data; H264Context *h = &p->h; int list_count, ref_count[2]; if (h->pps.redundant_pic_cnt_present) get_ue_golomb(gb); // redundant_pic_count if (slice_type_nos == AV_PICTURE_TYPE_B) get_bits1(gb); // direct_spatial_mv_pred if (ff_h264_parse_ref_count(&list_count, ref_count, gb, &h->pps, slice_type_nos, h->picture_structure) < 0) return AVERROR_INVALIDDATA; if (slice_type_nos != AV_PICTURE_TYPE_I) { int list; for (list = 0; list < list_count; list++) { if (get_bits1(gb)) { int index; for (index = 0; ; index++) { unsigned int reordering_of_pic_nums_idc = get_ue_golomb_31(gb); if (reordering_of_pic_nums_idc < 3) get_ue_golomb(gb); else if (reordering_of_pic_nums_idc > 3) { av_log(h->avctx, AV_LOG_ERROR, "illegal reordering_of_pic_nums_idc %d\n", reordering_of_pic_nums_idc); return AVERROR_INVALIDDATA; } else break; if (index >= ref_count[list]) { av_log(h->avctx, AV_LOG_ERROR, "reference count %d overflow\n", index); return AVERROR_INVALIDDATA; } } } } } if ((h->pps.weighted_pred && slice_type_nos == AV_PICTURE_TYPE_P) || (h->pps.weighted_bipred_idc == 1 && slice_type_nos == AV_PICTURE_TYPE_B)) ff_h264_pred_weight_table(gb, &h->sps, ref_count, slice_type_nos, &pwt); if (get_bits1(gb)) { // adaptive_ref_pic_marking_mode_flag int i; for (i = 0; i < MAX_MMCO_COUNT; i++) { MMCOOpcode opcode = get_ue_golomb_31(gb); if (opcode > (unsigned) MMCO_LONG) { av_log(h->avctx, AV_LOG_ERROR, "illegal memory management control operation %d\n", opcode); return AVERROR_INVALIDDATA; } if (opcode == MMCO_END) return 0; else if (opcode == MMCO_RESET) return 1; if (opcode == MMCO_SHORT2UNUSED || opcode == MMCO_SHORT2LONG) get_ue_golomb(gb); if (opcode == MMCO_SHORT2LONG || opcode == MMCO_LONG2UNUSED || opcode == MMCO_LONG || opcode == MMCO_SET_MAX_LONG) get_ue_golomb_31(gb); } } return 0; }
false
FFmpeg
3176217c60ca7828712985092d9102d331ea4f3d
static int scan_mmco_reset(AVCodecParserContext *s, GetBitContext *gb) { H264PredWeightTable pwt; int slice_type_nos = s->pict_type & 3; H264ParseContext *p = s->priv_data; H264Context *h = &p->h; int list_count, ref_count[2]; if (h->pps.redundant_pic_cnt_present) get_ue_golomb(gb); if (slice_type_nos == AV_PICTURE_TYPE_B) get_bits1(gb); if (ff_h264_parse_ref_count(&list_count, ref_count, gb, &h->pps, slice_type_nos, h->picture_structure) < 0) return AVERROR_INVALIDDATA; if (slice_type_nos != AV_PICTURE_TYPE_I) { int list; for (list = 0; list < list_count; list++) { if (get_bits1(gb)) { int index; for (index = 0; ; index++) { unsigned int reordering_of_pic_nums_idc = get_ue_golomb_31(gb); if (reordering_of_pic_nums_idc < 3) get_ue_golomb(gb); else if (reordering_of_pic_nums_idc > 3) { av_log(h->avctx, AV_LOG_ERROR, "illegal reordering_of_pic_nums_idc %d\n", reordering_of_pic_nums_idc); return AVERROR_INVALIDDATA; } else break; if (index >= ref_count[list]) { av_log(h->avctx, AV_LOG_ERROR, "reference count %d overflow\n", index); return AVERROR_INVALIDDATA; } } } } } if ((h->pps.weighted_pred && slice_type_nos == AV_PICTURE_TYPE_P) || (h->pps.weighted_bipred_idc == 1 && slice_type_nos == AV_PICTURE_TYPE_B)) ff_h264_pred_weight_table(gb, &h->sps, ref_count, slice_type_nos, &pwt); if (get_bits1(gb)) { int i; for (i = 0; i < MAX_MMCO_COUNT; i++) { MMCOOpcode opcode = get_ue_golomb_31(gb); if (opcode > (unsigned) MMCO_LONG) { av_log(h->avctx, AV_LOG_ERROR, "illegal memory management control operation %d\n", opcode); return AVERROR_INVALIDDATA; } if (opcode == MMCO_END) return 0; else if (opcode == MMCO_RESET) return 1; if (opcode == MMCO_SHORT2UNUSED || opcode == MMCO_SHORT2LONG) get_ue_golomb(gb); if (opcode == MMCO_SHORT2LONG || opcode == MMCO_LONG2UNUSED || opcode == MMCO_LONG || opcode == MMCO_SET_MAX_LONG) get_ue_golomb_31(gb); } } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecParserContext *VAR_0, GetBitContext *VAR_1) { H264PredWeightTable pwt; int VAR_2 = VAR_0->pict_type & 3; H264ParseContext *p = VAR_0->priv_data; H264Context *h = &p->h; int VAR_3, VAR_4[2]; if (h->pps.redundant_pic_cnt_present) get_ue_golomb(VAR_1); if (VAR_2 == AV_PICTURE_TYPE_B) get_bits1(VAR_1); if (ff_h264_parse_ref_count(&VAR_3, VAR_4, VAR_1, &h->pps, VAR_2, h->picture_structure) < 0) return AVERROR_INVALIDDATA; if (VAR_2 != AV_PICTURE_TYPE_I) { int VAR_5; for (VAR_5 = 0; VAR_5 < VAR_3; VAR_5++) { if (get_bits1(VAR_1)) { int VAR_6; for (VAR_6 = 0; ; VAR_6++) { unsigned int VAR_7 = get_ue_golomb_31(VAR_1); if (VAR_7 < 3) get_ue_golomb(VAR_1); else if (VAR_7 > 3) { av_log(h->avctx, AV_LOG_ERROR, "illegal VAR_7 %d\n", VAR_7); return AVERROR_INVALIDDATA; } else break; if (VAR_6 >= VAR_4[VAR_5]) { av_log(h->avctx, AV_LOG_ERROR, "reference count %d overflow\n", VAR_6); return AVERROR_INVALIDDATA; } } } } } if ((h->pps.weighted_pred && VAR_2 == AV_PICTURE_TYPE_P) || (h->pps.weighted_bipred_idc == 1 && VAR_2 == AV_PICTURE_TYPE_B)) ff_h264_pred_weight_table(VAR_1, &h->sps, VAR_4, VAR_2, &pwt); if (get_bits1(VAR_1)) { int VAR_8; for (VAR_8 = 0; VAR_8 < MAX_MMCO_COUNT; VAR_8++) { MMCOOpcode opcode = get_ue_golomb_31(VAR_1); if (opcode > (unsigned) MMCO_LONG) { av_log(h->avctx, AV_LOG_ERROR, "illegal memory management control operation %d\n", opcode); return AVERROR_INVALIDDATA; } if (opcode == MMCO_END) return 0; else if (opcode == MMCO_RESET) return 1; if (opcode == MMCO_SHORT2UNUSED || opcode == MMCO_SHORT2LONG) get_ue_golomb(VAR_1); if (opcode == MMCO_SHORT2LONG || opcode == MMCO_LONG2UNUSED || opcode == MMCO_LONG || opcode == MMCO_SET_MAX_LONG) get_ue_golomb_31(VAR_1); } } return 0; }
[ "static int FUNC_0(AVCodecParserContext *VAR_0, GetBitContext *VAR_1)\n{", "H264PredWeightTable pwt;", "int VAR_2 = VAR_0->pict_type & 3;", "H264ParseContext *p = VAR_0->priv_data;", "H264Context *h = &p->h;", "int VAR_3, VAR_4[2];", "if (h->pps.redundant_pic_cnt_present)\nget_ue_golomb(VAR_1);", "if (VAR_2 == AV_PICTURE_TYPE_B)\nget_bits1(VAR_1);", "if (ff_h264_parse_ref_count(&VAR_3, VAR_4, VAR_1, &h->pps,\nVAR_2, h->picture_structure) < 0)\nreturn AVERROR_INVALIDDATA;", "if (VAR_2 != AV_PICTURE_TYPE_I) {", "int VAR_5;", "for (VAR_5 = 0; VAR_5 < VAR_3; VAR_5++) {", "if (get_bits1(VAR_1)) {", "int VAR_6;", "for (VAR_6 = 0; ; VAR_6++) {", "unsigned int VAR_7 = get_ue_golomb_31(VAR_1);", "if (VAR_7 < 3)\nget_ue_golomb(VAR_1);", "else if (VAR_7 > 3) {", "av_log(h->avctx, AV_LOG_ERROR,\n\"illegal VAR_7 %d\\n\",\nVAR_7);", "return AVERROR_INVALIDDATA;", "} else", "break;", "if (VAR_6 >= VAR_4[VAR_5]) {", "av_log(h->avctx, AV_LOG_ERROR,\n\"reference count %d overflow\\n\", VAR_6);", "return AVERROR_INVALIDDATA;", "}", "}", "}", "}", "}", "if ((h->pps.weighted_pred && VAR_2 == AV_PICTURE_TYPE_P) ||\n(h->pps.weighted_bipred_idc == 1 && VAR_2 == AV_PICTURE_TYPE_B))\nff_h264_pred_weight_table(VAR_1, &h->sps, VAR_4, VAR_2,\n&pwt);", "if (get_bits1(VAR_1)) {", "int VAR_8;", "for (VAR_8 = 0; VAR_8 < MAX_MMCO_COUNT; VAR_8++) {", "MMCOOpcode opcode = get_ue_golomb_31(VAR_1);", "if (opcode > (unsigned) MMCO_LONG) {", "av_log(h->avctx, AV_LOG_ERROR,\n\"illegal memory management control operation %d\\n\",\nopcode);", "return AVERROR_INVALIDDATA;", "}", "if (opcode == MMCO_END)\nreturn 0;", "else if (opcode == MMCO_RESET)\nreturn 1;", "if (opcode == MMCO_SHORT2UNUSED || opcode == MMCO_SHORT2LONG)\nget_ue_golomb(VAR_1);", "if (opcode == MMCO_SHORT2LONG || opcode == MMCO_LONG2UNUSED ||\nopcode == MMCO_LONG || opcode == MMCO_SET_MAX_LONG)\nget_ue_golomb_31(VAR_1);", "}", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 19, 21 ], [ 25, 27 ], [ 31, 33, 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55, 57 ], [ 59 ], [ 61, 63, 65 ], [ 67 ], [ 69 ], [ 71 ], [ 75 ], [ 77, 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 95, 97, 99, 101 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115, 117, 119 ], [ 121 ], [ 123 ], [ 125, 127 ], [ 129, 131 ], [ 135, 137 ], [ 139, 141, 143 ], [ 145 ], [ 147 ], [ 151 ], [ 153 ] ]
11,971
void helper_memalign(uint32_t addr, uint32_t dr, uint32_t wr, uint32_t size) { uint32_t mask; switch (size) { case 4: mask = 3; break; case 2: mask = 1; break; default: case 1: mask = 0; break; } if (addr & mask) { qemu_log("unaligned access addr=%x size=%d, wr=%d\n", addr, size, wr); if (!(env->sregs[SR_MSR] & MSR_EE)) { return; } env->sregs[SR_ESR] = ESR_EC_UNALIGNED_DATA | (wr << 10) \ | (dr & 31) << 5; if (size == 4) { env->sregs[SR_ESR] |= 1 << 11; } helper_raise_exception(EXCP_HW_EXCP); } }
false
qemu
3aa80988430f41847e1b78d165440ac03503b6d0
void helper_memalign(uint32_t addr, uint32_t dr, uint32_t wr, uint32_t size) { uint32_t mask; switch (size) { case 4: mask = 3; break; case 2: mask = 1; break; default: case 1: mask = 0; break; } if (addr & mask) { qemu_log("unaligned access addr=%x size=%d, wr=%d\n", addr, size, wr); if (!(env->sregs[SR_MSR] & MSR_EE)) { return; } env->sregs[SR_ESR] = ESR_EC_UNALIGNED_DATA | (wr << 10) \ | (dr & 31) << 5; if (size == 4) { env->sregs[SR_ESR] |= 1 << 11; } helper_raise_exception(EXCP_HW_EXCP); } }
{ "code": [], "line_no": [] }
void FUNC_0(uint32_t VAR_0, uint32_t VAR_1, uint32_t VAR_2, uint32_t VAR_3) { uint32_t mask; switch (VAR_3) { case 4: mask = 3; break; case 2: mask = 1; break; default: case 1: mask = 0; break; } if (VAR_0 & mask) { qemu_log("unaligned access VAR_0=%x VAR_3=%d, VAR_2=%d\n", VAR_0, VAR_3, VAR_2); if (!(env->sregs[SR_MSR] & MSR_EE)) { return; } env->sregs[SR_ESR] = ESR_EC_UNALIGNED_DATA | (VAR_2 << 10) \ | (VAR_1 & 31) << 5; if (VAR_3 == 4) { env->sregs[SR_ESR] |= 1 << 11; } helper_raise_exception(EXCP_HW_EXCP); } }
[ "void FUNC_0(uint32_t VAR_0, uint32_t VAR_1, uint32_t VAR_2, uint32_t VAR_3)\n{", "uint32_t mask;", "switch (VAR_3) {", "case 4: mask = 3; break;", "case 2: mask = 1; break;", "default:\ncase 1: mask = 0; break;", "}", "if (VAR_0 & mask) {", "qemu_log(\"unaligned access VAR_0=%x VAR_3=%d, VAR_2=%d\\n\",\nVAR_0, VAR_3, VAR_2);", "if (!(env->sregs[SR_MSR] & MSR_EE)) {", "return;", "}", "env->sregs[SR_ESR] = ESR_EC_UNALIGNED_DATA | (VAR_2 << 10) \\\n| (VAR_1 & 31) << 5;", "if (VAR_3 == 4) {", "env->sregs[SR_ESR] |= 1 << 11;", "}", "helper_raise_exception(EXCP_HW_EXCP);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15, 17 ], [ 19 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37, 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ] ]
11,972
static inline bool bdrv_req_is_aligned(BlockDriverState *bs, int64_t offset, size_t bytes) { int64_t align = bdrv_get_align(bs); return !(offset & (align - 1) || (bytes & (align - 1))); }
false
qemu
61007b316cd71ee7333ff7a0a749a8949527575f
static inline bool bdrv_req_is_aligned(BlockDriverState *bs, int64_t offset, size_t bytes) { int64_t align = bdrv_get_align(bs); return !(offset & (align - 1) || (bytes & (align - 1))); }
{ "code": [], "line_no": [] }
static inline bool FUNC_0(BlockDriverState *bs, int64_t offset, size_t bytes) { int64_t align = bdrv_get_align(bs); return !(offset & (align - 1) || (bytes & (align - 1))); }
[ "static inline bool FUNC_0(BlockDriverState *bs,\nint64_t offset, size_t bytes)\n{", "int64_t align = bdrv_get_align(bs);", "return !(offset & (align - 1) || (bytes & (align - 1)));", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ] ]
11,973
static inline int tcg_gen_code_common(TCGContext *s, uint8_t *gen_code_buf, long search_pc) { int opc, op_index, macro_op_index; const TCGOpDef *def; unsigned int dead_iargs; const TCGArg *args; #ifdef DEBUG_DISAS if (unlikely(loglevel & CPU_LOG_TB_OP)) { fprintf(logfile, "OP:\n"); tcg_dump_ops(s, logfile); fprintf(logfile, "\n"); } #endif tcg_liveness_analysis(s); #ifdef DEBUG_DISAS if (unlikely(loglevel & CPU_LOG_TB_OP_OPT)) { fprintf(logfile, "OP after la:\n"); tcg_dump_ops(s, logfile); fprintf(logfile, "\n"); } #endif tcg_reg_alloc_start(s); s->code_buf = gen_code_buf; s->code_ptr = gen_code_buf; macro_op_index = -1; args = gen_opparam_buf; op_index = 0; for(;;) { opc = gen_opc_buf[op_index]; #ifdef CONFIG_PROFILER dyngen_table_op_count[opc]++; #endif def = &tcg_op_defs[opc]; #if 0 printf("%s: %d %d %d\n", def->name, def->nb_oargs, def->nb_iargs, def->nb_cargs); // dump_regs(s); #endif switch(opc) { case INDEX_op_mov_i32: #if TCG_TARGET_REG_BITS == 64 case INDEX_op_mov_i64: #endif dead_iargs = s->op_dead_iargs[op_index]; tcg_reg_alloc_mov(s, def, args, dead_iargs); break; case INDEX_op_nop: case INDEX_op_nop1: case INDEX_op_nop2: case INDEX_op_nop3: break; case INDEX_op_nopn: args += args[0]; goto next; case INDEX_op_discard: { TCGTemp *ts; ts = &s->temps[args[0]]; /* mark the temporary as dead */ if (ts->val_type != TEMP_VAL_CONST && !ts->fixed_reg) { if (ts->val_type == TEMP_VAL_REG) s->reg_to_temp[ts->reg] = -1; ts->val_type = TEMP_VAL_DEAD; } } break; case INDEX_op_macro_goto: macro_op_index = op_index; /* only used for exceptions */ op_index = args[0] - 1; args = gen_opparam_buf + args[1]; goto next; case INDEX_op_macro_end: macro_op_index = -1; /* only used for exceptions */ op_index = args[0] - 1; args = gen_opparam_buf + args[1]; goto next; case INDEX_op_macro_start: /* must never happen here */ tcg_abort(); case INDEX_op_set_label: tcg_reg_alloc_bb_end(s); tcg_out_label(s, args[0], (long)s->code_ptr); break; case INDEX_op_call: dead_iargs = s->op_dead_iargs[op_index]; args += tcg_reg_alloc_call(s, def, opc, args, dead_iargs); goto next; case INDEX_op_end: goto the_end; #ifndef CONFIG_NO_DYNGEN_OP case 0 ... INDEX_op_end - 1: /* legacy dyngen ops */ #ifdef CONFIG_PROFILER { extern int64_t dyngen_old_op_count; dyngen_old_op_count++; } #endif tcg_reg_alloc_bb_end(s); if (search_pc >= 0) { s->code_ptr += def->copy_size; args += def->nb_args; } else { args = dyngen_op(s, opc, args); } goto next; #endif default: /* Note: in order to speed up the code, it would be much faster to have specialized register allocator functions for some common argument patterns */ dead_iargs = s->op_dead_iargs[op_index]; tcg_reg_alloc_op(s, def, opc, args, dead_iargs); break; } args += def->nb_args; next: ; if (search_pc >= 0 && search_pc < s->code_ptr - gen_code_buf) { if (macro_op_index >= 0) return macro_op_index; else return op_index; } op_index++; #ifndef NDEBUG check_regs(s); #endif } the_end: return -1; }
false
qemu
bf6247fb7639bc3492e769791f6569d65860029b
static inline int tcg_gen_code_common(TCGContext *s, uint8_t *gen_code_buf, long search_pc) { int opc, op_index, macro_op_index; const TCGOpDef *def; unsigned int dead_iargs; const TCGArg *args; #ifdef DEBUG_DISAS if (unlikely(loglevel & CPU_LOG_TB_OP)) { fprintf(logfile, "OP:\n"); tcg_dump_ops(s, logfile); fprintf(logfile, "\n"); } #endif tcg_liveness_analysis(s); #ifdef DEBUG_DISAS if (unlikely(loglevel & CPU_LOG_TB_OP_OPT)) { fprintf(logfile, "OP after la:\n"); tcg_dump_ops(s, logfile); fprintf(logfile, "\n"); } #endif tcg_reg_alloc_start(s); s->code_buf = gen_code_buf; s->code_ptr = gen_code_buf; macro_op_index = -1; args = gen_opparam_buf; op_index = 0; for(;;) { opc = gen_opc_buf[op_index]; #ifdef CONFIG_PROFILER dyngen_table_op_count[opc]++; #endif def = &tcg_op_defs[opc]; #if 0 printf("%s: %d %d %d\n", def->name, def->nb_oargs, def->nb_iargs, def->nb_cargs); #endif switch(opc) { case INDEX_op_mov_i32: #if TCG_TARGET_REG_BITS == 64 case INDEX_op_mov_i64: #endif dead_iargs = s->op_dead_iargs[op_index]; tcg_reg_alloc_mov(s, def, args, dead_iargs); break; case INDEX_op_nop: case INDEX_op_nop1: case INDEX_op_nop2: case INDEX_op_nop3: break; case INDEX_op_nopn: args += args[0]; goto next; case INDEX_op_discard: { TCGTemp *ts; ts = &s->temps[args[0]]; if (ts->val_type != TEMP_VAL_CONST && !ts->fixed_reg) { if (ts->val_type == TEMP_VAL_REG) s->reg_to_temp[ts->reg] = -1; ts->val_type = TEMP_VAL_DEAD; } } break; case INDEX_op_macro_goto: macro_op_index = op_index; op_index = args[0] - 1; args = gen_opparam_buf + args[1]; goto next; case INDEX_op_macro_end: macro_op_index = -1; op_index = args[0] - 1; args = gen_opparam_buf + args[1]; goto next; case INDEX_op_macro_start: tcg_abort(); case INDEX_op_set_label: tcg_reg_alloc_bb_end(s); tcg_out_label(s, args[0], (long)s->code_ptr); break; case INDEX_op_call: dead_iargs = s->op_dead_iargs[op_index]; args += tcg_reg_alloc_call(s, def, opc, args, dead_iargs); goto next; case INDEX_op_end: goto the_end; #ifndef CONFIG_NO_DYNGEN_OP case 0 ... INDEX_op_end - 1: #ifdef CONFIG_PROFILER { extern int64_t dyngen_old_op_count; dyngen_old_op_count++; } #endif tcg_reg_alloc_bb_end(s); if (search_pc >= 0) { s->code_ptr += def->copy_size; args += def->nb_args; } else { args = dyngen_op(s, opc, args); } goto next; #endif default: dead_iargs = s->op_dead_iargs[op_index]; tcg_reg_alloc_op(s, def, opc, args, dead_iargs); break; } args += def->nb_args; next: ; if (search_pc >= 0 && search_pc < s->code_ptr - gen_code_buf) { if (macro_op_index >= 0) return macro_op_index; else return op_index; } op_index++; #ifndef NDEBUG check_regs(s); #endif } the_end: return -1; }
{ "code": [], "line_no": [] }
static inline int FUNC_0(TCGContext *VAR_0, uint8_t *VAR_1, long VAR_2) { int VAR_3, VAR_4, VAR_5; const TCGOpDef *VAR_6; unsigned int VAR_7; const TCGArg *VAR_8; #ifdef DEBUG_DISAS if (unlikely(loglevel & CPU_LOG_TB_OP)) { fprintf(logfile, "OP:\n"); tcg_dump_ops(VAR_0, logfile); fprintf(logfile, "\n"); } #endif tcg_liveness_analysis(VAR_0); #ifdef DEBUG_DISAS if (unlikely(loglevel & CPU_LOG_TB_OP_OPT)) { fprintf(logfile, "OP after la:\n"); tcg_dump_ops(VAR_0, logfile); fprintf(logfile, "\n"); } #endif tcg_reg_alloc_start(VAR_0); VAR_0->code_buf = VAR_1; VAR_0->code_ptr = VAR_1; VAR_5 = -1; VAR_8 = gen_opparam_buf; VAR_4 = 0; for(;;) { VAR_3 = gen_opc_buf[VAR_4]; #ifdef CONFIG_PROFILER dyngen_table_op_count[VAR_3]++; #endif VAR_6 = &tcg_op_defs[VAR_3]; #if 0 printf("%VAR_0: %d %d %d\n", VAR_6->name, VAR_6->nb_oargs, VAR_6->nb_iargs, VAR_6->nb_cargs); #endif switch(VAR_3) { case INDEX_op_mov_i32: #if TCG_TARGET_REG_BITS == 64 case INDEX_op_mov_i64: #endif VAR_7 = VAR_0->op_dead_iargs[VAR_4]; tcg_reg_alloc_mov(VAR_0, VAR_6, VAR_8, VAR_7); break; case INDEX_op_nop: case INDEX_op_nop1: case INDEX_op_nop2: case INDEX_op_nop3: break; case INDEX_op_nopn: VAR_8 += VAR_8[0]; goto next; case INDEX_op_discard: { TCGTemp *ts; ts = &VAR_0->temps[VAR_8[0]]; if (ts->val_type != TEMP_VAL_CONST && !ts->fixed_reg) { if (ts->val_type == TEMP_VAL_REG) VAR_0->reg_to_temp[ts->reg] = -1; ts->val_type = TEMP_VAL_DEAD; } } break; case INDEX_op_macro_goto: VAR_5 = VAR_4; VAR_4 = VAR_8[0] - 1; VAR_8 = gen_opparam_buf + VAR_8[1]; goto next; case INDEX_op_macro_end: VAR_5 = -1; VAR_4 = VAR_8[0] - 1; VAR_8 = gen_opparam_buf + VAR_8[1]; goto next; case INDEX_op_macro_start: tcg_abort(); case INDEX_op_set_label: tcg_reg_alloc_bb_end(VAR_0); tcg_out_label(VAR_0, VAR_8[0], (long)VAR_0->code_ptr); break; case INDEX_op_call: VAR_7 = VAR_0->op_dead_iargs[VAR_4]; VAR_8 += tcg_reg_alloc_call(VAR_0, VAR_6, VAR_3, VAR_8, VAR_7); goto next; case INDEX_op_end: goto the_end; #ifndef CONFIG_NO_DYNGEN_OP case 0 ... INDEX_op_end - 1: #ifdef CONFIG_PROFILER { extern int64_t dyngen_old_op_count; dyngen_old_op_count++; } #endif tcg_reg_alloc_bb_end(VAR_0); if (VAR_2 >= 0) { VAR_0->code_ptr += VAR_6->copy_size; VAR_8 += VAR_6->nb_args; } else { VAR_8 = dyngen_op(VAR_0, VAR_3, VAR_8); } goto next; #endif default: VAR_7 = VAR_0->op_dead_iargs[VAR_4]; tcg_reg_alloc_op(VAR_0, VAR_6, VAR_3, VAR_8, VAR_7); break; } VAR_8 += VAR_6->nb_args; next: ; if (VAR_2 >= 0 && VAR_2 < VAR_0->code_ptr - VAR_1) { if (VAR_5 >= 0) return VAR_5; else return VAR_4; } VAR_4++; #ifndef NDEBUG check_regs(VAR_0); #endif } the_end: return -1; }
[ "static inline int FUNC_0(TCGContext *VAR_0, uint8_t *VAR_1,\nlong VAR_2)\n{", "int VAR_3, VAR_4, VAR_5;", "const TCGOpDef *VAR_6;", "unsigned int VAR_7;", "const TCGArg *VAR_8;", "#ifdef DEBUG_DISAS\nif (unlikely(loglevel & CPU_LOG_TB_OP)) {", "fprintf(logfile, \"OP:\\n\");", "tcg_dump_ops(VAR_0, logfile);", "fprintf(logfile, \"\\n\");", "}", "#endif\ntcg_liveness_analysis(VAR_0);", "#ifdef DEBUG_DISAS\nif (unlikely(loglevel & CPU_LOG_TB_OP_OPT)) {", "fprintf(logfile, \"OP after la:\\n\");", "tcg_dump_ops(VAR_0, logfile);", "fprintf(logfile, \"\\n\");", "}", "#endif\ntcg_reg_alloc_start(VAR_0);", "VAR_0->code_buf = VAR_1;", "VAR_0->code_ptr = VAR_1;", "VAR_5 = -1;", "VAR_8 = gen_opparam_buf;", "VAR_4 = 0;", "for(;;) {", "VAR_3 = gen_opc_buf[VAR_4];", "#ifdef CONFIG_PROFILER\ndyngen_table_op_count[VAR_3]++;", "#endif\nVAR_6 = &tcg_op_defs[VAR_3];", "#if 0\nprintf(\"%VAR_0: %d %d %d\\n\", VAR_6->name,\nVAR_6->nb_oargs, VAR_6->nb_iargs, VAR_6->nb_cargs);", "#endif\nswitch(VAR_3) {", "case INDEX_op_mov_i32:\n#if TCG_TARGET_REG_BITS == 64\ncase INDEX_op_mov_i64:\n#endif\nVAR_7 = VAR_0->op_dead_iargs[VAR_4];", "tcg_reg_alloc_mov(VAR_0, VAR_6, VAR_8, VAR_7);", "break;", "case INDEX_op_nop:\ncase INDEX_op_nop1:\ncase INDEX_op_nop2:\ncase INDEX_op_nop3:\nbreak;", "case INDEX_op_nopn:\nVAR_8 += VAR_8[0];", "goto next;", "case INDEX_op_discard:\n{", "TCGTemp *ts;", "ts = &VAR_0->temps[VAR_8[0]];", "if (ts->val_type != TEMP_VAL_CONST && !ts->fixed_reg) {", "if (ts->val_type == TEMP_VAL_REG)\nVAR_0->reg_to_temp[ts->reg] = -1;", "ts->val_type = TEMP_VAL_DEAD;", "}", "}", "break;", "case INDEX_op_macro_goto:\nVAR_5 = VAR_4;", "VAR_4 = VAR_8[0] - 1;", "VAR_8 = gen_opparam_buf + VAR_8[1];", "goto next;", "case INDEX_op_macro_end:\nVAR_5 = -1;", "VAR_4 = VAR_8[0] - 1;", "VAR_8 = gen_opparam_buf + VAR_8[1];", "goto next;", "case INDEX_op_macro_start:\ntcg_abort();", "case INDEX_op_set_label:\ntcg_reg_alloc_bb_end(VAR_0);", "tcg_out_label(VAR_0, VAR_8[0], (long)VAR_0->code_ptr);", "break;", "case INDEX_op_call:\nVAR_7 = VAR_0->op_dead_iargs[VAR_4];", "VAR_8 += tcg_reg_alloc_call(VAR_0, VAR_6, VAR_3, VAR_8, VAR_7);", "goto next;", "case INDEX_op_end:\ngoto the_end;", "#ifndef CONFIG_NO_DYNGEN_OP\ncase 0 ... INDEX_op_end - 1:\n#ifdef CONFIG_PROFILER\n{", "extern int64_t dyngen_old_op_count;", "dyngen_old_op_count++;", "}", "#endif\ntcg_reg_alloc_bb_end(VAR_0);", "if (VAR_2 >= 0) {", "VAR_0->code_ptr += VAR_6->copy_size;", "VAR_8 += VAR_6->nb_args;", "} else {", "VAR_8 = dyngen_op(VAR_0, VAR_3, VAR_8);", "}", "goto next;", "#endif\ndefault:\nVAR_7 = VAR_0->op_dead_iargs[VAR_4];", "tcg_reg_alloc_op(VAR_0, VAR_6, VAR_3, VAR_8, VAR_7);", "break;", "}", "VAR_8 += VAR_6->nb_args;", "next: ;", "if (VAR_2 >= 0 && VAR_2 < VAR_0->code_ptr - VAR_1) {", "if (VAR_5 >= 0)\nreturn VAR_5;", "else\nreturn VAR_4;", "}", "VAR_4++;", "#ifndef NDEBUG\ncheck_regs(VAR_0);", "#endif\n}", "the_end:\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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 33 ], [ 37, 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49, 53 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75, 77 ], [ 79, 81 ], [ 83, 85, 87 ], [ 91, 93 ], [ 95, 97, 99, 101, 103 ], [ 105 ], [ 107 ], [ 109, 111, 113, 115, 117 ], [ 119, 121 ], [ 123 ], [ 125, 127 ], [ 129 ], [ 131 ], [ 135 ], [ 137, 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149, 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159, 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169, 173 ], [ 175, 177 ], [ 179 ], [ 181 ], [ 183, 185 ], [ 187 ], [ 189 ], [ 191, 193 ], [ 197, 199, 203, 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213, 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231, 233, 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255, 257 ], [ 259, 261 ], [ 263 ], [ 265 ], [ 267, 269 ], [ 271, 273 ], [ 275, 277 ], [ 279 ] ]
11,974
static uint32_t set_isolation_state(sPAPRDRConnector *drc, sPAPRDRIsolationState state) { trace_spapr_drc_set_isolation_state(spapr_drc_index(drc), state); /* if the guest is configuring a device attached to this DRC, we * should reset the configuration state at this point since it may * no longer be reliable (guest released device and needs to start * over, or unplug occurred so the FDT is no longer valid) */ if (state == SPAPR_DR_ISOLATION_STATE_ISOLATED) { g_free(drc->ccs); drc->ccs = NULL; } if (state == SPAPR_DR_ISOLATION_STATE_UNISOLATED) { /* cannot unisolate a non-existent resource, and, or resources * which are in an 'UNUSABLE' allocation state. (PAPR 2.7, 13.5.3.5) */ if (!drc->dev || drc->allocation_state == SPAPR_DR_ALLOCATION_STATE_UNUSABLE) { return RTAS_OUT_NO_SUCH_INDICATOR; } } /* * Fail any requests to ISOLATE the LMB DRC if this LMB doesn't * belong to a DIMM device that is marked for removal. * * Currently the guest userspace tool drmgr that drives the memory * hotplug/unplug will just try to remove a set of 'removable' LMBs * in response to a hot unplug request that is based on drc-count. * If the LMB being removed doesn't belong to a DIMM device that is * actually being unplugged, fail the isolation request here. */ if (spapr_drc_type(drc) == SPAPR_DR_CONNECTOR_TYPE_LMB) { if ((state == SPAPR_DR_ISOLATION_STATE_ISOLATED) && !drc->awaiting_release) { return RTAS_OUT_HW_ERROR; } } drc->isolation_state = state; if (drc->isolation_state == SPAPR_DR_ISOLATION_STATE_ISOLATED) { /* if we're awaiting release, but still in an unconfigured state, * it's likely the guest is still in the process of configuring * the device and is transitioning the devices to an ISOLATED * state as a part of that process. so we only complete the * removal when this transition happens for a device in a * configured state, as suggested by the state diagram from * PAPR+ 2.7, 13.4 */ if (drc->awaiting_release) { uint32_t drc_index = spapr_drc_index(drc); if (drc->configured) { trace_spapr_drc_set_isolation_state_finalizing(drc_index); spapr_drc_detach(drc, DEVICE(drc->dev), NULL); } else { trace_spapr_drc_set_isolation_state_deferring(drc_index); } } drc->configured = false; } return RTAS_OUT_SUCCESS; }
false
qemu
0dfabd39d523fc3f6f0f8c441f41c013cc429b52
static uint32_t set_isolation_state(sPAPRDRConnector *drc, sPAPRDRIsolationState state) { trace_spapr_drc_set_isolation_state(spapr_drc_index(drc), state); if (state == SPAPR_DR_ISOLATION_STATE_ISOLATED) { g_free(drc->ccs); drc->ccs = NULL; } if (state == SPAPR_DR_ISOLATION_STATE_UNISOLATED) { if (!drc->dev || drc->allocation_state == SPAPR_DR_ALLOCATION_STATE_UNUSABLE) { return RTAS_OUT_NO_SUCH_INDICATOR; } } if (spapr_drc_type(drc) == SPAPR_DR_CONNECTOR_TYPE_LMB) { if ((state == SPAPR_DR_ISOLATION_STATE_ISOLATED) && !drc->awaiting_release) { return RTAS_OUT_HW_ERROR; } } drc->isolation_state = state; if (drc->isolation_state == SPAPR_DR_ISOLATION_STATE_ISOLATED) { if (drc->awaiting_release) { uint32_t drc_index = spapr_drc_index(drc); if (drc->configured) { trace_spapr_drc_set_isolation_state_finalizing(drc_index); spapr_drc_detach(drc, DEVICE(drc->dev), NULL); } else { trace_spapr_drc_set_isolation_state_deferring(drc_index); } } drc->configured = false; } return RTAS_OUT_SUCCESS; }
{ "code": [], "line_no": [] }
static uint32_t FUNC_0(sPAPRDRConnector *drc, sPAPRDRIsolationState state) { trace_spapr_drc_set_isolation_state(spapr_drc_index(drc), state); if (state == SPAPR_DR_ISOLATION_STATE_ISOLATED) { g_free(drc->ccs); drc->ccs = NULL; } if (state == SPAPR_DR_ISOLATION_STATE_UNISOLATED) { if (!drc->dev || drc->allocation_state == SPAPR_DR_ALLOCATION_STATE_UNUSABLE) { return RTAS_OUT_NO_SUCH_INDICATOR; } } if (spapr_drc_type(drc) == SPAPR_DR_CONNECTOR_TYPE_LMB) { if ((state == SPAPR_DR_ISOLATION_STATE_ISOLATED) && !drc->awaiting_release) { return RTAS_OUT_HW_ERROR; } } drc->isolation_state = state; if (drc->isolation_state == SPAPR_DR_ISOLATION_STATE_ISOLATED) { if (drc->awaiting_release) { uint32_t drc_index = spapr_drc_index(drc); if (drc->configured) { trace_spapr_drc_set_isolation_state_finalizing(drc_index); spapr_drc_detach(drc, DEVICE(drc->dev), NULL); } else { trace_spapr_drc_set_isolation_state_deferring(drc_index); } } drc->configured = false; } return RTAS_OUT_SUCCESS; }
[ "static uint32_t FUNC_0(sPAPRDRConnector *drc,\nsPAPRDRIsolationState state)\n{", "trace_spapr_drc_set_isolation_state(spapr_drc_index(drc), state);", "if (state == SPAPR_DR_ISOLATION_STATE_ISOLATED) {", "g_free(drc->ccs);", "drc->ccs = NULL;", "}", "if (state == SPAPR_DR_ISOLATION_STATE_UNISOLATED) {", "if (!drc->dev ||\ndrc->allocation_state == SPAPR_DR_ALLOCATION_STATE_UNUSABLE) {", "return RTAS_OUT_NO_SUCH_INDICATOR;", "}", "}", "if (spapr_drc_type(drc) == SPAPR_DR_CONNECTOR_TYPE_LMB) {", "if ((state == SPAPR_DR_ISOLATION_STATE_ISOLATED) &&\n!drc->awaiting_release) {", "return RTAS_OUT_HW_ERROR;", "}", "}", "drc->isolation_state = state;", "if (drc->isolation_state == SPAPR_DR_ISOLATION_STATE_ISOLATED) {", "if (drc->awaiting_release) {", "uint32_t drc_index = spapr_drc_index(drc);", "if (drc->configured) {", "trace_spapr_drc_set_isolation_state_finalizing(drc_index);", "spapr_drc_detach(drc, DEVICE(drc->dev), NULL);", "} else {", "trace_spapr_drc_set_isolation_state_deferring(drc_index);", "}", "}", "drc->configured = false;", "}", "return RTAS_OUT_SUCCESS;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 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 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 71 ], [ 73, 75 ], [ 77 ], [ 79 ], [ 81 ], [ 85 ], [ 89 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 131 ], [ 133 ] ]
11,976
static void vnc_listen_read(void *opaque) { VncDisplay *vs = opaque; struct sockaddr_in addr; socklen_t addrlen = sizeof(addr); /* Catch-up */ vga_hw_update(); int csock = accept(vs->lsock, (struct sockaddr *)&addr, &addrlen); if (csock != -1) { vnc_connect(vs, csock); } }
true
qemu
40ff6d7e8dceca227e7f8a3e8e0d58b2c66d19b4
static void vnc_listen_read(void *opaque) { VncDisplay *vs = opaque; struct sockaddr_in addr; socklen_t addrlen = sizeof(addr); vga_hw_update(); int csock = accept(vs->lsock, (struct sockaddr *)&addr, &addrlen); if (csock != -1) { vnc_connect(vs, csock); } }
{ "code": [ " int csock = accept(vs->lsock, (struct sockaddr *)&addr, &addrlen);" ], "line_no": [ 19 ] }
static void FUNC_0(void *VAR_0) { VncDisplay *vs = VAR_0; struct sockaddr_in VAR_1; socklen_t addrlen = sizeof(VAR_1); vga_hw_update(); int VAR_2 = accept(vs->lsock, (struct sockaddr *)&VAR_1, &addrlen); if (VAR_2 != -1) { vnc_connect(vs, VAR_2); } }
[ "static void FUNC_0(void *VAR_0)\n{", "VncDisplay *vs = VAR_0;", "struct sockaddr_in VAR_1;", "socklen_t addrlen = sizeof(VAR_1);", "vga_hw_update();", "int VAR_2 = accept(vs->lsock, (struct sockaddr *)&VAR_1, &addrlen);", "if (VAR_2 != -1) {", "vnc_connect(vs, VAR_2);", "}", "}" ]
[ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ] ]
11,977
static av_cold int qdm2_decode_init(AVCodecContext *avctx) { QDM2Context *s = avctx->priv_data; uint8_t *extradata; int extradata_size; int tmp_val, tmp, size; /* extradata parsing Structure: wave { frma (QDM2) QDCA QDCP } 32 size (including this field) 32 tag (=frma) 32 type (=QDM2 or QDMC) 32 size (including this field, in bytes) 32 tag (=QDCA) // maybe mandatory parameters 32 unknown (=1) 32 channels (=2) 32 samplerate (=44100) 32 bitrate (=96000) 32 block size (=4096) 32 frame size (=256) (for one channel) 32 packet size (=1300) 32 size (including this field, in bytes) 32 tag (=QDCP) // maybe some tuneable parameters 32 float1 (=1.0) 32 zero ? 32 float2 (=1.0) 32 float3 (=1.0) 32 unknown (27) 32 unknown (8) 32 zero ? */ if (!avctx->extradata || (avctx->extradata_size < 48)) { av_log(avctx, AV_LOG_ERROR, "extradata missing or truncated\n"); return -1; } extradata = avctx->extradata; extradata_size = avctx->extradata_size; while (extradata_size > 7) { if (!memcmp(extradata, "frmaQDM", 7)) break; extradata++; extradata_size--; } if (extradata_size < 12) { av_log(avctx, AV_LOG_ERROR, "not enough extradata (%i)\n", extradata_size); return -1; } if (memcmp(extradata, "frmaQDM", 7)) { av_log(avctx, AV_LOG_ERROR, "invalid headers, QDM? not found\n"); return -1; } if (extradata[7] == 'C') { // s->is_qdmc = 1; av_log(avctx, AV_LOG_ERROR, "stream is QDMC version 1, which is not supported\n"); return -1; } extradata += 8; extradata_size -= 8; size = AV_RB32(extradata); if(size > extradata_size){ av_log(avctx, AV_LOG_ERROR, "extradata size too small, %i < %i\n", extradata_size, size); return -1; } extradata += 4; av_log(avctx, AV_LOG_DEBUG, "size: %d\n", size); if (AV_RB32(extradata) != MKBETAG('Q','D','C','A')) { av_log(avctx, AV_LOG_ERROR, "invalid extradata, expecting QDCA\n"); return -1; } extradata += 8; avctx->channels = s->nb_channels = s->channels = AV_RB32(extradata); extradata += 4; if (s->channels > MPA_MAX_CHANNELS) return AVERROR_INVALIDDATA; avctx->sample_rate = AV_RB32(extradata); extradata += 4; avctx->bit_rate = AV_RB32(extradata); extradata += 4; s->group_size = AV_RB32(extradata); extradata += 4; s->fft_size = AV_RB32(extradata); extradata += 4; s->checksum_size = AV_RB32(extradata); if (s->checksum_size >= 1U << 28) { av_log(avctx, AV_LOG_ERROR, "data block size too large (%u)\n", s->checksum_size); return AVERROR_INVALIDDATA; } s->fft_order = av_log2(s->fft_size) + 1; s->fft_frame_size = 2 * s->fft_size; // complex has two floats // something like max decodable tones s->group_order = av_log2(s->group_size) + 1; s->frame_size = s->group_size / 16; // 16 iterations per super block if (s->frame_size > QDM2_MAX_FRAME_SIZE) return AVERROR_INVALIDDATA; s->sub_sampling = s->fft_order - 7; s->frequency_range = 255 / (1 << (2 - s->sub_sampling)); switch ((s->sub_sampling * 2 + s->channels - 1)) { case 0: tmp = 40; break; case 1: tmp = 48; break; case 2: tmp = 56; break; case 3: tmp = 72; break; case 4: tmp = 80; break; case 5: tmp = 100;break; default: tmp=s->sub_sampling; break; } tmp_val = 0; if ((tmp * 1000) < avctx->bit_rate) tmp_val = 1; if ((tmp * 1440) < avctx->bit_rate) tmp_val = 2; if ((tmp * 1760) < avctx->bit_rate) tmp_val = 3; if ((tmp * 2240) < avctx->bit_rate) tmp_val = 4; s->cm_table_select = tmp_val; if (s->sub_sampling == 0) tmp = 7999; else tmp = ((-(s->sub_sampling -1)) & 8000) + 20000; /* 0: 7999 -> 0 1: 20000 -> 2 2: 28000 -> 2 */ if (tmp < 8000) s->coeff_per_sb_select = 0; else if (tmp <= 16000) s->coeff_per_sb_select = 1; else s->coeff_per_sb_select = 2; // Fail on unknown fft order if ((s->fft_order < 7) || (s->fft_order > 9)) { av_log(avctx, AV_LOG_ERROR, "Unknown FFT order (%d), contact the developers!\n", s->fft_order); return -1; } ff_rdft_init(&s->rdft_ctx, s->fft_order, IDFT_C2R); ff_mpadsp_init(&s->mpadsp); qdm2_init(s); avctx->sample_fmt = AV_SAMPLE_FMT_S16; avcodec_get_frame_defaults(&s->frame); avctx->coded_frame = &s->frame; // dump_context(s); return 0; }
false
FFmpeg
f5be7958e313f3f62505ea7f90007800e8e1dcb5
static av_cold int qdm2_decode_init(AVCodecContext *avctx) { QDM2Context *s = avctx->priv_data; uint8_t *extradata; int extradata_size; int tmp_val, tmp, size; if (!avctx->extradata || (avctx->extradata_size < 48)) { av_log(avctx, AV_LOG_ERROR, "extradata missing or truncated\n"); return -1; } extradata = avctx->extradata; extradata_size = avctx->extradata_size; while (extradata_size > 7) { if (!memcmp(extradata, "frmaQDM", 7)) break; extradata++; extradata_size--; } if (extradata_size < 12) { av_log(avctx, AV_LOG_ERROR, "not enough extradata (%i)\n", extradata_size); return -1; } if (memcmp(extradata, "frmaQDM", 7)) { av_log(avctx, AV_LOG_ERROR, "invalid headers, QDM? not found\n"); return -1; } if (extradata[7] == 'C') { av_log(avctx, AV_LOG_ERROR, "stream is QDMC version 1, which is not supported\n"); return -1; } extradata += 8; extradata_size -= 8; size = AV_RB32(extradata); if(size > extradata_size){ av_log(avctx, AV_LOG_ERROR, "extradata size too small, %i < %i\n", extradata_size, size); return -1; } extradata += 4; av_log(avctx, AV_LOG_DEBUG, "size: %d\n", size); if (AV_RB32(extradata) != MKBETAG('Q','D','C','A')) { av_log(avctx, AV_LOG_ERROR, "invalid extradata, expecting QDCA\n"); return -1; } extradata += 8; avctx->channels = s->nb_channels = s->channels = AV_RB32(extradata); extradata += 4; if (s->channels > MPA_MAX_CHANNELS) return AVERROR_INVALIDDATA; avctx->sample_rate = AV_RB32(extradata); extradata += 4; avctx->bit_rate = AV_RB32(extradata); extradata += 4; s->group_size = AV_RB32(extradata); extradata += 4; s->fft_size = AV_RB32(extradata); extradata += 4; s->checksum_size = AV_RB32(extradata); if (s->checksum_size >= 1U << 28) { av_log(avctx, AV_LOG_ERROR, "data block size too large (%u)\n", s->checksum_size); return AVERROR_INVALIDDATA; } s->fft_order = av_log2(s->fft_size) + 1; s->fft_frame_size = 2 * s->fft_size; s->group_order = av_log2(s->group_size) + 1; s->frame_size = s->group_size / 16; if (s->frame_size > QDM2_MAX_FRAME_SIZE) return AVERROR_INVALIDDATA; s->sub_sampling = s->fft_order - 7; s->frequency_range = 255 / (1 << (2 - s->sub_sampling)); switch ((s->sub_sampling * 2 + s->channels - 1)) { case 0: tmp = 40; break; case 1: tmp = 48; break; case 2: tmp = 56; break; case 3: tmp = 72; break; case 4: tmp = 80; break; case 5: tmp = 100;break; default: tmp=s->sub_sampling; break; } tmp_val = 0; if ((tmp * 1000) < avctx->bit_rate) tmp_val = 1; if ((tmp * 1440) < avctx->bit_rate) tmp_val = 2; if ((tmp * 1760) < avctx->bit_rate) tmp_val = 3; if ((tmp * 2240) < avctx->bit_rate) tmp_val = 4; s->cm_table_select = tmp_val; if (s->sub_sampling == 0) tmp = 7999; else tmp = ((-(s->sub_sampling -1)) & 8000) + 20000; if (tmp < 8000) s->coeff_per_sb_select = 0; else if (tmp <= 16000) s->coeff_per_sb_select = 1; else s->coeff_per_sb_select = 2; if ((s->fft_order < 7) || (s->fft_order > 9)) { av_log(avctx, AV_LOG_ERROR, "Unknown FFT order (%d), contact the developers!\n", s->fft_order); return -1; } ff_rdft_init(&s->rdft_ctx, s->fft_order, IDFT_C2R); ff_mpadsp_init(&s->mpadsp); qdm2_init(s); avctx->sample_fmt = AV_SAMPLE_FMT_S16; avcodec_get_frame_defaults(&s->frame); avctx->coded_frame = &s->frame; return 0; }
{ "code": [], "line_no": [] }
static av_cold int FUNC_0(AVCodecContext *avctx) { QDM2Context *s = avctx->priv_data; uint8_t *extradata; int VAR_0; int VAR_1, VAR_2, VAR_3; if (!avctx->extradata || (avctx->VAR_0 < 48)) { av_log(avctx, AV_LOG_ERROR, "extradata missing or truncated\n"); return -1; } extradata = avctx->extradata; VAR_0 = avctx->VAR_0; while (VAR_0 > 7) { if (!memcmp(extradata, "frmaQDM", 7)) break; extradata++; VAR_0--; } if (VAR_0 < 12) { av_log(avctx, AV_LOG_ERROR, "not enough extradata (%i)\n", VAR_0); return -1; } if (memcmp(extradata, "frmaQDM", 7)) { av_log(avctx, AV_LOG_ERROR, "invalid headers, QDM? not found\n"); return -1; } if (extradata[7] == 'C') { av_log(avctx, AV_LOG_ERROR, "stream is QDMC version 1, which is not supported\n"); return -1; } extradata += 8; VAR_0 -= 8; VAR_3 = AV_RB32(extradata); if(VAR_3 > VAR_0){ av_log(avctx, AV_LOG_ERROR, "extradata VAR_3 too small, %i < %i\n", VAR_0, VAR_3); return -1; } extradata += 4; av_log(avctx, AV_LOG_DEBUG, "VAR_3: %d\n", VAR_3); if (AV_RB32(extradata) != MKBETAG('Q','D','C','A')) { av_log(avctx, AV_LOG_ERROR, "invalid extradata, expecting QDCA\n"); return -1; } extradata += 8; avctx->channels = s->nb_channels = s->channels = AV_RB32(extradata); extradata += 4; if (s->channels > MPA_MAX_CHANNELS) return AVERROR_INVALIDDATA; avctx->sample_rate = AV_RB32(extradata); extradata += 4; avctx->bit_rate = AV_RB32(extradata); extradata += 4; s->group_size = AV_RB32(extradata); extradata += 4; s->fft_size = AV_RB32(extradata); extradata += 4; s->checksum_size = AV_RB32(extradata); if (s->checksum_size >= 1U << 28) { av_log(avctx, AV_LOG_ERROR, "data block VAR_3 too large (%u)\n", s->checksum_size); return AVERROR_INVALIDDATA; } s->fft_order = av_log2(s->fft_size) + 1; s->fft_frame_size = 2 * s->fft_size; s->group_order = av_log2(s->group_size) + 1; s->frame_size = s->group_size / 16; if (s->frame_size > QDM2_MAX_FRAME_SIZE) return AVERROR_INVALIDDATA; s->sub_sampling = s->fft_order - 7; s->frequency_range = 255 / (1 << (2 - s->sub_sampling)); switch ((s->sub_sampling * 2 + s->channels - 1)) { case 0: VAR_2 = 40; break; case 1: VAR_2 = 48; break; case 2: VAR_2 = 56; break; case 3: VAR_2 = 72; break; case 4: VAR_2 = 80; break; case 5: VAR_2 = 100;break; default: VAR_2=s->sub_sampling; break; } VAR_1 = 0; if ((VAR_2 * 1000) < avctx->bit_rate) VAR_1 = 1; if ((VAR_2 * 1440) < avctx->bit_rate) VAR_1 = 2; if ((VAR_2 * 1760) < avctx->bit_rate) VAR_1 = 3; if ((VAR_2 * 2240) < avctx->bit_rate) VAR_1 = 4; s->cm_table_select = VAR_1; if (s->sub_sampling == 0) VAR_2 = 7999; else VAR_2 = ((-(s->sub_sampling -1)) & 8000) + 20000; if (VAR_2 < 8000) s->coeff_per_sb_select = 0; else if (VAR_2 <= 16000) s->coeff_per_sb_select = 1; else s->coeff_per_sb_select = 2; if ((s->fft_order < 7) || (s->fft_order > 9)) { av_log(avctx, AV_LOG_ERROR, "Unknown FFT order (%d), contact the developers!\n", s->fft_order); return -1; } ff_rdft_init(&s->rdft_ctx, s->fft_order, IDFT_C2R); ff_mpadsp_init(&s->mpadsp); qdm2_init(s); avctx->sample_fmt = AV_SAMPLE_FMT_S16; avcodec_get_frame_defaults(&s->frame); avctx->coded_frame = &s->frame; return 0; }
[ "static av_cold int FUNC_0(AVCodecContext *avctx)\n{", "QDM2Context *s = avctx->priv_data;", "uint8_t *extradata;", "int VAR_0;", "int VAR_1, VAR_2, VAR_3;", "if (!avctx->extradata || (avctx->VAR_0 < 48)) {", "av_log(avctx, AV_LOG_ERROR, \"extradata missing or truncated\\n\");", "return -1;", "}", "extradata = avctx->extradata;", "VAR_0 = avctx->VAR_0;", "while (VAR_0 > 7) {", "if (!memcmp(extradata, \"frmaQDM\", 7))\nbreak;", "extradata++;", "VAR_0--;", "}", "if (VAR_0 < 12) {", "av_log(avctx, AV_LOG_ERROR, \"not enough extradata (%i)\\n\",\nVAR_0);", "return -1;", "}", "if (memcmp(extradata, \"frmaQDM\", 7)) {", "av_log(avctx, AV_LOG_ERROR, \"invalid headers, QDM? not found\\n\");", "return -1;", "}", "if (extradata[7] == 'C') {", "av_log(avctx, AV_LOG_ERROR, \"stream is QDMC version 1, which is not supported\\n\");", "return -1;", "}", "extradata += 8;", "VAR_0 -= 8;", "VAR_3 = AV_RB32(extradata);", "if(VAR_3 > VAR_0){", "av_log(avctx, AV_LOG_ERROR, \"extradata VAR_3 too small, %i < %i\\n\",\nVAR_0, VAR_3);", "return -1;", "}", "extradata += 4;", "av_log(avctx, AV_LOG_DEBUG, \"VAR_3: %d\\n\", VAR_3);", "if (AV_RB32(extradata) != MKBETAG('Q','D','C','A')) {", "av_log(avctx, AV_LOG_ERROR, \"invalid extradata, expecting QDCA\\n\");", "return -1;", "}", "extradata += 8;", "avctx->channels = s->nb_channels = s->channels = AV_RB32(extradata);", "extradata += 4;", "if (s->channels > MPA_MAX_CHANNELS)\nreturn AVERROR_INVALIDDATA;", "avctx->sample_rate = AV_RB32(extradata);", "extradata += 4;", "avctx->bit_rate = AV_RB32(extradata);", "extradata += 4;", "s->group_size = AV_RB32(extradata);", "extradata += 4;", "s->fft_size = AV_RB32(extradata);", "extradata += 4;", "s->checksum_size = AV_RB32(extradata);", "if (s->checksum_size >= 1U << 28) {", "av_log(avctx, AV_LOG_ERROR, \"data block VAR_3 too large (%u)\\n\", s->checksum_size);", "return AVERROR_INVALIDDATA;", "}", "s->fft_order = av_log2(s->fft_size) + 1;", "s->fft_frame_size = 2 * s->fft_size;", "s->group_order = av_log2(s->group_size) + 1;", "s->frame_size = s->group_size / 16;", "if (s->frame_size > QDM2_MAX_FRAME_SIZE)\nreturn AVERROR_INVALIDDATA;", "s->sub_sampling = s->fft_order - 7;", "s->frequency_range = 255 / (1 << (2 - s->sub_sampling));", "switch ((s->sub_sampling * 2 + s->channels - 1)) {", "case 0: VAR_2 = 40; break;", "case 1: VAR_2 = 48; break;", "case 2: VAR_2 = 56; break;", "case 3: VAR_2 = 72; break;", "case 4: VAR_2 = 80; break;", "case 5: VAR_2 = 100;break;", "default: VAR_2=s->sub_sampling; break;", "}", "VAR_1 = 0;", "if ((VAR_2 * 1000) < avctx->bit_rate) VAR_1 = 1;", "if ((VAR_2 * 1440) < avctx->bit_rate) VAR_1 = 2;", "if ((VAR_2 * 1760) < avctx->bit_rate) VAR_1 = 3;", "if ((VAR_2 * 2240) < avctx->bit_rate) VAR_1 = 4;", "s->cm_table_select = VAR_1;", "if (s->sub_sampling == 0)\nVAR_2 = 7999;", "else\nVAR_2 = ((-(s->sub_sampling -1)) & 8000) + 20000;", "if (VAR_2 < 8000)\ns->coeff_per_sb_select = 0;", "else if (VAR_2 <= 16000)\ns->coeff_per_sb_select = 1;", "else\ns->coeff_per_sb_select = 2;", "if ((s->fft_order < 7) || (s->fft_order > 9)) {", "av_log(avctx, AV_LOG_ERROR, \"Unknown FFT order (%d), contact the developers!\\n\", s->fft_order);", "return -1;", "}", "ff_rdft_init(&s->rdft_ctx, s->fft_order, IDFT_C2R);", "ff_mpadsp_init(&s->mpadsp);", "qdm2_init(s);", "avctx->sample_fmt = AV_SAMPLE_FMT_S16;", "avcodec_get_frame_defaults(&s->frame);", "avctx->coded_frame = &s->frame;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 93 ], [ 95 ], [ 99 ], [ 101, 103 ], [ 105 ], [ 107 ], [ 109 ], [ 113 ], [ 115, 117 ], [ 119 ], [ 121 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 135 ], [ 139 ], [ 141 ], [ 143 ], [ 147 ], [ 149 ], [ 153 ], [ 157 ], [ 159, 161 ], [ 163 ], [ 165 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 183 ], [ 187 ], [ 189 ], [ 191, 193 ], [ 197 ], [ 199 ], [ 203 ], [ 205 ], [ 209 ], [ 211 ], [ 215 ], [ 217 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 233 ], [ 235 ], [ 241 ], [ 243 ], [ 245, 247 ], [ 251 ], [ 253 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 289, 291 ], [ 293, 295 ], [ 307, 309 ], [ 311, 313 ], [ 315, 317 ], [ 323 ], [ 325 ], [ 327 ], [ 329 ], [ 333 ], [ 335 ], [ 339 ], [ 343 ], [ 347 ], [ 349 ], [ 355 ], [ 357 ] ]
11,982
void MPV_frame_end(MpegEncContext *s) { /* draw edge for correct motion prediction if outside */ if (s->pict_type != B_TYPE && !s->intra_only) { if(s->avctx==NULL || s->avctx->codec->id!=CODEC_ID_MPEG4 || s->divx_version==500){ draw_edges(s->current_picture[0], s->linesize, s->mb_width*16, s->mb_height*16, EDGE_WIDTH); draw_edges(s->current_picture[1], s->linesize/2, s->mb_width*8, s->mb_height*8, EDGE_WIDTH/2); draw_edges(s->current_picture[2], s->linesize/2, s->mb_width*8, s->mb_height*8, EDGE_WIDTH/2); }else{ /* mpeg4? / opendivx / xvid */ draw_edges(s->current_picture[0], s->linesize, s->width, s->height, EDGE_WIDTH); draw_edges(s->current_picture[1], s->linesize/2, s->width/2, s->height/2, EDGE_WIDTH/2); draw_edges(s->current_picture[2], s->linesize/2, s->width/2, s->height/2, EDGE_WIDTH/2); } } emms_c(); if(s->pict_type!=B_TYPE){ s->last_non_b_pict_type= s->pict_type; s->last_non_b_qscale= s->qscale; s->last_non_b_mc_mb_var= s->mc_mb_var; s->num_available_buffers++; if(s->num_available_buffers>2) s->num_available_buffers= 2; } }
false
FFmpeg
7f2fe444a39bca733d390b6608801c5f002bfd31
void MPV_frame_end(MpegEncContext *s) { if (s->pict_type != B_TYPE && !s->intra_only) { if(s->avctx==NULL || s->avctx->codec->id!=CODEC_ID_MPEG4 || s->divx_version==500){ draw_edges(s->current_picture[0], s->linesize, s->mb_width*16, s->mb_height*16, EDGE_WIDTH); draw_edges(s->current_picture[1], s->linesize/2, s->mb_width*8, s->mb_height*8, EDGE_WIDTH/2); draw_edges(s->current_picture[2], s->linesize/2, s->mb_width*8, s->mb_height*8, EDGE_WIDTH/2); }else{ draw_edges(s->current_picture[0], s->linesize, s->width, s->height, EDGE_WIDTH); draw_edges(s->current_picture[1], s->linesize/2, s->width/2, s->height/2, EDGE_WIDTH/2); draw_edges(s->current_picture[2], s->linesize/2, s->width/2, s->height/2, EDGE_WIDTH/2); } } emms_c(); if(s->pict_type!=B_TYPE){ s->last_non_b_pict_type= s->pict_type; s->last_non_b_qscale= s->qscale; s->last_non_b_mc_mb_var= s->mc_mb_var; s->num_available_buffers++; if(s->num_available_buffers>2) s->num_available_buffers= 2; } }
{ "code": [], "line_no": [] }
void FUNC_0(MpegEncContext *VAR_0) { if (VAR_0->pict_type != B_TYPE && !VAR_0->intra_only) { if(VAR_0->avctx==NULL || VAR_0->avctx->codec->id!=CODEC_ID_MPEG4 || VAR_0->divx_version==500){ draw_edges(VAR_0->current_picture[0], VAR_0->linesize, VAR_0->mb_width*16, VAR_0->mb_height*16, EDGE_WIDTH); draw_edges(VAR_0->current_picture[1], VAR_0->linesize/2, VAR_0->mb_width*8, VAR_0->mb_height*8, EDGE_WIDTH/2); draw_edges(VAR_0->current_picture[2], VAR_0->linesize/2, VAR_0->mb_width*8, VAR_0->mb_height*8, EDGE_WIDTH/2); }else{ draw_edges(VAR_0->current_picture[0], VAR_0->linesize, VAR_0->width, VAR_0->height, EDGE_WIDTH); draw_edges(VAR_0->current_picture[1], VAR_0->linesize/2, VAR_0->width/2, VAR_0->height/2, EDGE_WIDTH/2); draw_edges(VAR_0->current_picture[2], VAR_0->linesize/2, VAR_0->width/2, VAR_0->height/2, EDGE_WIDTH/2); } } emms_c(); if(VAR_0->pict_type!=B_TYPE){ VAR_0->last_non_b_pict_type= VAR_0->pict_type; VAR_0->last_non_b_qscale= VAR_0->qscale; VAR_0->last_non_b_mc_mb_var= VAR_0->mc_mb_var; VAR_0->num_available_buffers++; if(VAR_0->num_available_buffers>2) VAR_0->num_available_buffers= 2; } }
[ "void FUNC_0(MpegEncContext *VAR_0)\n{", "if (VAR_0->pict_type != B_TYPE && !VAR_0->intra_only) {", "if(VAR_0->avctx==NULL || VAR_0->avctx->codec->id!=CODEC_ID_MPEG4 || VAR_0->divx_version==500){", "draw_edges(VAR_0->current_picture[0], VAR_0->linesize, VAR_0->mb_width*16, VAR_0->mb_height*16, EDGE_WIDTH);", "draw_edges(VAR_0->current_picture[1], VAR_0->linesize/2, VAR_0->mb_width*8, VAR_0->mb_height*8, EDGE_WIDTH/2);", "draw_edges(VAR_0->current_picture[2], VAR_0->linesize/2, VAR_0->mb_width*8, VAR_0->mb_height*8, EDGE_WIDTH/2);", "}else{", "draw_edges(VAR_0->current_picture[0], VAR_0->linesize, VAR_0->width, VAR_0->height, EDGE_WIDTH);", "draw_edges(VAR_0->current_picture[1], VAR_0->linesize/2, VAR_0->width/2, VAR_0->height/2, EDGE_WIDTH/2);", "draw_edges(VAR_0->current_picture[2], VAR_0->linesize/2, VAR_0->width/2, VAR_0->height/2, EDGE_WIDTH/2);", "}", "}", "emms_c();", "if(VAR_0->pict_type!=B_TYPE){", "VAR_0->last_non_b_pict_type= VAR_0->pict_type;", "VAR_0->last_non_b_qscale= VAR_0->qscale;", "VAR_0->last_non_b_mc_mb_var= VAR_0->mc_mb_var;", "VAR_0->num_available_buffers++;", "if(VAR_0->num_available_buffers>2) VAR_0->num_available_buffers= 2;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ] ]
11,986
void qmp_memchar_write(const char *device, int64_t size, const char *data, bool has_format, enum DataFormat format, Error **errp) { CharDriverState *chr; guchar *write_data; int ret; gsize write_count; chr = qemu_chr_find(device); if (!chr) { error_set(errp, QERR_DEVICE_NOT_FOUND, device); return; } if (qemu_is_chr(chr, "memory")) { error_setg(errp,"%s is not memory char device", device); return; } write_count = (gsize)size; if (has_format && (format == DATA_FORMAT_BASE64)) { write_data = g_base64_decode(data, &write_count); } else { write_data = (uint8_t *)data; } ret = cirmem_chr_write(chr, write_data, write_count); if (ret < 0) { error_setg(errp, "Failed to write to device %s", device); return; } }
true
qemu
82e59a676c01b3df3b53998d428d0a64a55f2439
void qmp_memchar_write(const char *device, int64_t size, const char *data, bool has_format, enum DataFormat format, Error **errp) { CharDriverState *chr; guchar *write_data; int ret; gsize write_count; chr = qemu_chr_find(device); if (!chr) { error_set(errp, QERR_DEVICE_NOT_FOUND, device); return; } if (qemu_is_chr(chr, "memory")) { error_setg(errp,"%s is not memory char device", device); return; } write_count = (gsize)size; if (has_format && (format == DATA_FORMAT_BASE64)) { write_data = g_base64_decode(data, &write_count); } else { write_data = (uint8_t *)data; } ret = cirmem_chr_write(chr, write_data, write_count); if (ret < 0) { error_setg(errp, "Failed to write to device %s", device); return; } }
{ "code": [ "void qmp_memchar_write(const char *device, int64_t size,", " const char *data, bool has_format,", " enum DataFormat format,", " write_count = (gsize)size;" ], "line_no": [ 1, 3, 5, 43 ] }
void FUNC_0(const char *VAR_0, int64_t VAR_1, const char *VAR_2, bool VAR_3, enum DataFormat VAR_4, Error **VAR_5) { CharDriverState *chr; guchar *write_data; int VAR_6; gsize write_count; chr = qemu_chr_find(VAR_0); if (!chr) { error_set(VAR_5, QERR_DEVICE_NOT_FOUND, VAR_0); return; } if (qemu_is_chr(chr, "memory")) { error_setg(VAR_5,"%s is not memory char VAR_0", VAR_0); return; } write_count = (gsize)VAR_1; if (VAR_3 && (VAR_4 == DATA_FORMAT_BASE64)) { write_data = g_base64_decode(VAR_2, &write_count); } else { write_data = (uint8_t *)VAR_2; } VAR_6 = cirmem_chr_write(chr, write_data, write_count); if (VAR_6 < 0) { error_setg(VAR_5, "Failed to write to VAR_0 %s", VAR_0); return; } }
[ "void FUNC_0(const char *VAR_0, int64_t VAR_1,\nconst char *VAR_2, bool VAR_3,\nenum DataFormat VAR_4,\nError **VAR_5)\n{", "CharDriverState *chr;", "guchar *write_data;", "int VAR_6;", "gsize write_count;", "chr = qemu_chr_find(VAR_0);", "if (!chr) {", "error_set(VAR_5, QERR_DEVICE_NOT_FOUND, VAR_0);", "return;", "}", "if (qemu_is_chr(chr, \"memory\")) {", "error_setg(VAR_5,\"%s is not memory char VAR_0\", VAR_0);", "return;", "}", "write_count = (gsize)VAR_1;", "if (VAR_3 && (VAR_4 == DATA_FORMAT_BASE64)) {", "write_data = g_base64_decode(VAR_2, &write_count);", "} else {", "write_data = (uint8_t *)VAR_2;", "}", "VAR_6 = cirmem_chr_write(chr, write_data, write_count);", "if (VAR_6 < 0) {", "error_setg(VAR_5, \"Failed to write to VAR_0 %s\", VAR_0);", "return;", "}", "}" ]
[ 1, 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 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ] ]
11,987
kern_return_t GetBSDPath( io_iterator_t mediaIterator, char *bsdPath, CFIndex maxPathSize ) { io_object_t nextMedia; kern_return_t kernResult = KERN_FAILURE; *bsdPath = '\0'; nextMedia = IOIteratorNext( mediaIterator ); if ( nextMedia ) { CFTypeRef bsdPathAsCFString; bsdPathAsCFString = IORegistryEntryCreateCFProperty( nextMedia, CFSTR( kIOBSDNameKey ), kCFAllocatorDefault, 0 ); if ( bsdPathAsCFString ) { size_t devPathLength; strcpy( bsdPath, _PATH_DEV ); strcat( bsdPath, "r" ); devPathLength = strlen( bsdPath ); if ( CFStringGetCString( bsdPathAsCFString, bsdPath + devPathLength, maxPathSize - devPathLength, kCFStringEncodingASCII ) ) { kernResult = KERN_SUCCESS; } CFRelease( bsdPathAsCFString ); } IOObjectRelease( nextMedia ); } return kernResult; }
true
qemu
98caa5bc0083ed4fe4833addd3078b56ce2f6cfa
kern_return_t GetBSDPath( io_iterator_t mediaIterator, char *bsdPath, CFIndex maxPathSize ) { io_object_t nextMedia; kern_return_t kernResult = KERN_FAILURE; *bsdPath = '\0'; nextMedia = IOIteratorNext( mediaIterator ); if ( nextMedia ) { CFTypeRef bsdPathAsCFString; bsdPathAsCFString = IORegistryEntryCreateCFProperty( nextMedia, CFSTR( kIOBSDNameKey ), kCFAllocatorDefault, 0 ); if ( bsdPathAsCFString ) { size_t devPathLength; strcpy( bsdPath, _PATH_DEV ); strcat( bsdPath, "r" ); devPathLength = strlen( bsdPath ); if ( CFStringGetCString( bsdPathAsCFString, bsdPath + devPathLength, maxPathSize - devPathLength, kCFStringEncodingASCII ) ) { kernResult = KERN_SUCCESS; } CFRelease( bsdPathAsCFString ); } IOObjectRelease( nextMedia ); } return kernResult; }
{ "code": [ "kern_return_t GetBSDPath( io_iterator_t mediaIterator, char *bsdPath, CFIndex maxPathSize )", " strcat( bsdPath, \"r\" );" ], "line_no": [ 1, 27 ] }
kern_return_t FUNC_0( io_iterator_t mediaIterator, char *bsdPath, CFIndex maxPathSize ) { io_object_t nextMedia; kern_return_t kernResult = KERN_FAILURE; *bsdPath = '\0'; nextMedia = IOIteratorNext( mediaIterator ); if ( nextMedia ) { CFTypeRef bsdPathAsCFString; bsdPathAsCFString = IORegistryEntryCreateCFProperty( nextMedia, CFSTR( kIOBSDNameKey ), kCFAllocatorDefault, 0 ); if ( bsdPathAsCFString ) { size_t devPathLength; strcpy( bsdPath, _PATH_DEV ); strcat( bsdPath, "r" ); devPathLength = strlen( bsdPath ); if ( CFStringGetCString( bsdPathAsCFString, bsdPath + devPathLength, maxPathSize - devPathLength, kCFStringEncodingASCII ) ) { kernResult = KERN_SUCCESS; } CFRelease( bsdPathAsCFString ); } IOObjectRelease( nextMedia ); } return kernResult; }
[ "kern_return_t FUNC_0( io_iterator_t mediaIterator, char *bsdPath, CFIndex maxPathSize )\n{", "io_object_t nextMedia;", "kern_return_t kernResult = KERN_FAILURE;", "*bsdPath = '\\0';", "nextMedia = IOIteratorNext( mediaIterator );", "if ( nextMedia )\n{", "CFTypeRef bsdPathAsCFString;", "bsdPathAsCFString = IORegistryEntryCreateCFProperty( nextMedia, CFSTR( kIOBSDNameKey ), kCFAllocatorDefault, 0 );", "if ( bsdPathAsCFString ) {", "size_t devPathLength;", "strcpy( bsdPath, _PATH_DEV );", "strcat( bsdPath, \"r\" );", "devPathLength = strlen( bsdPath );", "if ( CFStringGetCString( bsdPathAsCFString, bsdPath + devPathLength, maxPathSize - devPathLength, kCFStringEncodingASCII ) ) {", "kernResult = KERN_SUCCESS;", "}", "CFRelease( bsdPathAsCFString );", "}", "IOObjectRelease( nextMedia );", "}", "return kernResult;", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ] ]
11,989
static void host_x86_cpu_class_init(ObjectClass *oc, void *data) { DeviceClass *dc = DEVICE_CLASS(oc); X86CPUClass *xcc = X86_CPU_CLASS(oc); uint32_t eax = 0, ebx = 0, ecx = 0, edx = 0; xcc->kvm_required = true; host_cpuid(0x0, 0, &eax, &ebx, &ecx, &edx); x86_cpu_vendor_words2str(host_cpudef.vendor, ebx, edx, ecx); host_cpuid(0x1, 0, &eax, &ebx, &ecx, &edx); host_cpudef.family = ((eax >> 8) & 0x0F) + ((eax >> 20) & 0xFF); host_cpudef.model = ((eax >> 4) & 0x0F) | ((eax & 0xF0000) >> 12); host_cpudef.stepping = eax & 0x0F; cpu_x86_fill_model_id(host_cpudef.model_id); xcc->cpu_def = &host_cpudef; host_cpudef.cache_info_passthrough = true; /* level, xlevel, xlevel2, and the feature words are initialized on * instance_init, because they require KVM to be initialized. */ dc->props = host_x86_cpu_properties; }
true
qemu
4c315c27661502a0813b129e41c0bf640c34a8d6
static void host_x86_cpu_class_init(ObjectClass *oc, void *data) { DeviceClass *dc = DEVICE_CLASS(oc); X86CPUClass *xcc = X86_CPU_CLASS(oc); uint32_t eax = 0, ebx = 0, ecx = 0, edx = 0; xcc->kvm_required = true; host_cpuid(0x0, 0, &eax, &ebx, &ecx, &edx); x86_cpu_vendor_words2str(host_cpudef.vendor, ebx, edx, ecx); host_cpuid(0x1, 0, &eax, &ebx, &ecx, &edx); host_cpudef.family = ((eax >> 8) & 0x0F) + ((eax >> 20) & 0xFF); host_cpudef.model = ((eax >> 4) & 0x0F) | ((eax & 0xF0000) >> 12); host_cpudef.stepping = eax & 0x0F; cpu_x86_fill_model_id(host_cpudef.model_id); xcc->cpu_def = &host_cpudef; host_cpudef.cache_info_passthrough = true; dc->props = host_x86_cpu_properties; }
{ "code": [], "line_no": [] }
static void FUNC_0(ObjectClass *VAR_0, void *VAR_1) { DeviceClass *dc = DEVICE_CLASS(VAR_0); X86CPUClass *xcc = X86_CPU_CLASS(VAR_0); uint32_t eax = 0, ebx = 0, ecx = 0, edx = 0; xcc->kvm_required = true; host_cpuid(0x0, 0, &eax, &ebx, &ecx, &edx); x86_cpu_vendor_words2str(host_cpudef.vendor, ebx, edx, ecx); host_cpuid(0x1, 0, &eax, &ebx, &ecx, &edx); host_cpudef.family = ((eax >> 8) & 0x0F) + ((eax >> 20) & 0xFF); host_cpudef.model = ((eax >> 4) & 0x0F) | ((eax & 0xF0000) >> 12); host_cpudef.stepping = eax & 0x0F; cpu_x86_fill_model_id(host_cpudef.model_id); xcc->cpu_def = &host_cpudef; host_cpudef.cache_info_passthrough = true; dc->props = host_x86_cpu_properties; }
[ "static void FUNC_0(ObjectClass *VAR_0, void *VAR_1)\n{", "DeviceClass *dc = DEVICE_CLASS(VAR_0);", "X86CPUClass *xcc = X86_CPU_CLASS(VAR_0);", "uint32_t eax = 0, ebx = 0, ecx = 0, edx = 0;", "xcc->kvm_required = true;", "host_cpuid(0x0, 0, &eax, &ebx, &ecx, &edx);", "x86_cpu_vendor_words2str(host_cpudef.vendor, ebx, edx, ecx);", "host_cpuid(0x1, 0, &eax, &ebx, &ecx, &edx);", "host_cpudef.family = ((eax >> 8) & 0x0F) + ((eax >> 20) & 0xFF);", "host_cpudef.model = ((eax >> 4) & 0x0F) | ((eax & 0xF0000) >> 12);", "host_cpudef.stepping = eax & 0x0F;", "cpu_x86_fill_model_id(host_cpudef.model_id);", "xcc->cpu_def = &host_cpudef;", "host_cpudef.cache_info_passthrough = true;", "dc->props = host_x86_cpu_properties;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 37 ], [ 39 ], [ 51 ], [ 55 ] ]
11,990
int ff_http_do_new_request(URLContext *h, const char *uri) { HTTPContext *s = h->priv_data; AVDictionary *options = NULL; int ret; ret = http_shutdown(h, h->flags); if (ret < 0) return ret; s->end_chunked_post = 0; s->chunkend = 0; s->off = 0; s->icy_data_read = 0; av_free(s->location); s->location = av_strdup(uri); if (!s->location) return AVERROR(ENOMEM); ret = http_open_cnx(h, &options); av_dict_free(&options); return ret;
true
FFmpeg
28358e466d4f4bc54f8137e0597057f33100b236
int ff_http_do_new_request(URLContext *h, const char *uri) { HTTPContext *s = h->priv_data; AVDictionary *options = NULL; int ret; ret = http_shutdown(h, h->flags); if (ret < 0) return ret; s->end_chunked_post = 0; s->chunkend = 0; s->off = 0; s->icy_data_read = 0; av_free(s->location); s->location = av_strdup(uri); if (!s->location) return AVERROR(ENOMEM); ret = http_open_cnx(h, &options); av_dict_free(&options); return ret;
{ "code": [], "line_no": [] }
int FUNC_0(URLContext *VAR_0, const char *VAR_1) { HTTPContext *s = VAR_0->priv_data; AVDictionary *options = NULL; int VAR_2; VAR_2 = http_shutdown(VAR_0, VAR_0->flags); if (VAR_2 < 0) return VAR_2; s->end_chunked_post = 0; s->chunkend = 0; s->off = 0; s->icy_data_read = 0; av_free(s->location); s->location = av_strdup(VAR_1); if (!s->location) return AVERROR(ENOMEM); VAR_2 = http_open_cnx(VAR_0, &options); av_dict_free(&options); return VAR_2;
[ "int FUNC_0(URLContext *VAR_0, const char *VAR_1)\n{", "HTTPContext *s = VAR_0->priv_data;", "AVDictionary *options = NULL;", "int VAR_2;", "VAR_2 = http_shutdown(VAR_0, VAR_0->flags);", "if (VAR_2 < 0)\nreturn VAR_2;", "s->end_chunked_post = 0;", "s->chunkend = 0;", "s->off = 0;", "s->icy_data_read = 0;", "av_free(s->location);", "s->location = av_strdup(VAR_1);", "if (!s->location)\nreturn AVERROR(ENOMEM);", "VAR_2 = http_open_cnx(VAR_0, &options);", "av_dict_free(&options);", "return VAR_2;" ]
[ 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 ] ]
11,991
uint_fast16_t float32_to_uint16_round_to_zero(float32 a STATUS_PARAM) { int64_t v; uint_fast16_t res; v = float32_to_int64_round_to_zero(a STATUS_VAR); if (v < 0) { res = 0; float_raise( float_flag_invalid STATUS_VAR); } else if (v > 0xffff) { res = 0xffff; float_raise( float_flag_invalid STATUS_VAR); } else { res = v; } return res; }
true
qemu
34e1c27bc3094ffe484d9855e07ad104bddf579f
uint_fast16_t float32_to_uint16_round_to_zero(float32 a STATUS_PARAM) { int64_t v; uint_fast16_t res; v = float32_to_int64_round_to_zero(a STATUS_VAR); if (v < 0) { res = 0; float_raise( float_flag_invalid STATUS_VAR); } else if (v > 0xffff) { res = 0xffff; float_raise( float_flag_invalid STATUS_VAR); } else { res = v; } return res; }
{ "code": [ " float_raise( float_flag_invalid STATUS_VAR);", " float_raise( float_flag_invalid STATUS_VAR);", " res = v;", " float_raise( float_flag_invalid STATUS_VAR);", " float_raise( float_flag_invalid STATUS_VAR);", " res = v;", " float_raise( float_flag_invalid STATUS_VAR);", " float_raise( float_flag_invalid STATUS_VAR);", " res = v;", " float_raise( float_flag_invalid STATUS_VAR);", " float_raise( float_flag_invalid STATUS_VAR);", " res = v;" ], "line_no": [ 17, 17, 27, 17, 17, 27, 17, 17, 27, 17, 17, 27 ] }
uint_fast16_t FUNC_0(float32 a STATUS_PARAM) { int64_t v; uint_fast16_t res; v = float32_to_int64_round_to_zero(a STATUS_VAR); if (v < 0) { res = 0; float_raise( float_flag_invalid STATUS_VAR); } else if (v > 0xffff) { res = 0xffff; float_raise( float_flag_invalid STATUS_VAR); } else { res = v; } return res; }
[ "uint_fast16_t FUNC_0(float32 a STATUS_PARAM)\n{", "int64_t v;", "uint_fast16_t res;", "v = float32_to_int64_round_to_zero(a STATUS_VAR);", "if (v < 0) {", "res = 0;", "float_raise( float_flag_invalid STATUS_VAR);", "} else if (v > 0xffff) {", "res = 0xffff;", "float_raise( float_flag_invalid STATUS_VAR);", "} else {", "res = v;", "}", "return res;", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ] ]
11,992
static int hda_codec_dev_init(DeviceState *qdev, DeviceInfo *base) { HDACodecBus *bus = DO_UPCAST(HDACodecBus, qbus, qdev->parent_bus); HDACodecDevice *dev = DO_UPCAST(HDACodecDevice, qdev, qdev); HDACodecDeviceInfo *info = DO_UPCAST(HDACodecDeviceInfo, qdev, base); dev->info = info; if (dev->cad == -1) { dev->cad = bus->next_cad; } if (dev->cad > 15) return -1; bus->next_cad = dev->cad + 1; return info->init(dev); }
true
qemu
acc086837e49b44f15eff6007bb1726844df7aec
static int hda_codec_dev_init(DeviceState *qdev, DeviceInfo *base) { HDACodecBus *bus = DO_UPCAST(HDACodecBus, qbus, qdev->parent_bus); HDACodecDevice *dev = DO_UPCAST(HDACodecDevice, qdev, qdev); HDACodecDeviceInfo *info = DO_UPCAST(HDACodecDeviceInfo, qdev, base); dev->info = info; if (dev->cad == -1) { dev->cad = bus->next_cad; } if (dev->cad > 15) return -1; bus->next_cad = dev->cad + 1; return info->init(dev); }
{ "code": [ " if (dev->cad > 15)" ], "line_no": [ 21 ] }
static int FUNC_0(DeviceState *VAR_0, DeviceInfo *VAR_1) { HDACodecBus *bus = DO_UPCAST(HDACodecBus, qbus, VAR_0->parent_bus); HDACodecDevice *dev = DO_UPCAST(HDACodecDevice, VAR_0, VAR_0); HDACodecDeviceInfo *info = DO_UPCAST(HDACodecDeviceInfo, VAR_0, VAR_1); dev->info = info; if (dev->cad == -1) { dev->cad = bus->next_cad; } if (dev->cad > 15) return -1; bus->next_cad = dev->cad + 1; return info->init(dev); }
[ "static int FUNC_0(DeviceState *VAR_0, DeviceInfo *VAR_1)\n{", "HDACodecBus *bus = DO_UPCAST(HDACodecBus, qbus, VAR_0->parent_bus);", "HDACodecDevice *dev = DO_UPCAST(HDACodecDevice, VAR_0, VAR_0);", "HDACodecDeviceInfo *info = DO_UPCAST(HDACodecDeviceInfo, VAR_0, VAR_1);", "dev->info = info;", "if (dev->cad == -1) {", "dev->cad = bus->next_cad;", "}", "if (dev->cad > 15)\nreturn -1;", "bus->next_cad = dev->cad + 1;", "return info->init(dev);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21, 23 ], [ 25 ], [ 27 ], [ 29 ] ]
11,993
static void setup_frame_v1(int usig, struct target_sigaction *ka, target_sigset_t *set, CPUARMState *regs) { struct sigframe_v1 *frame; abi_ulong frame_addr = get_sigframe(ka, regs, sizeof(*frame)); int i; if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 0)) return; setup_sigcontext(&frame->sc, regs, set->sig[0]); for(i = 1; i < TARGET_NSIG_WORDS; i++) { if (__put_user(set->sig[i], &frame->extramask[i - 1])) goto end; } setup_return(regs, ka, &frame->retcode, frame_addr, usig, frame_addr + offsetof(struct sigframe_v1, retcode)); end: unlock_user_struct(frame, frame_addr, 1); }
true
qemu
0188fadb7fe460d8c4c743372b1f7b25773e183e
static void setup_frame_v1(int usig, struct target_sigaction *ka, target_sigset_t *set, CPUARMState *regs) { struct sigframe_v1 *frame; abi_ulong frame_addr = get_sigframe(ka, regs, sizeof(*frame)); int i; if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 0)) return; setup_sigcontext(&frame->sc, regs, set->sig[0]); for(i = 1; i < TARGET_NSIG_WORDS; i++) { if (__put_user(set->sig[i], &frame->extramask[i - 1])) goto end; } setup_return(regs, ka, &frame->retcode, frame_addr, usig, frame_addr + offsetof(struct sigframe_v1, retcode)); end: unlock_user_struct(frame, frame_addr, 1); }
{ "code": [ "\tunlock_user_struct(frame, frame_addr, 1);", " for(i = 1; i < TARGET_NSIG_WORDS; i++) {", " if (__put_user(set->sig[i], &frame->extramask[i - 1]))", " goto end;", "end:", " goto end;", "end:", "\tunlock_user_struct(frame, frame_addr, 1);" ], "line_no": [ 43, 25, 27, 29, 41, 29, 41, 43 ] }
static void FUNC_0(int VAR_0, struct target_sigaction *VAR_1, target_sigset_t *VAR_2, CPUARMState *VAR_3) { struct sigframe_v1 *VAR_4; abi_ulong frame_addr = get_sigframe(VAR_1, VAR_3, sizeof(*VAR_4)); int VAR_5; if (!lock_user_struct(VERIFY_WRITE, VAR_4, frame_addr, 0)) return; setup_sigcontext(&VAR_4->sc, VAR_3, VAR_2->sig[0]); for(VAR_5 = 1; VAR_5 < TARGET_NSIG_WORDS; VAR_5++) { if (__put_user(VAR_2->sig[VAR_5], &VAR_4->extramask[VAR_5 - 1])) goto end; } setup_return(VAR_3, VAR_1, &VAR_4->retcode, frame_addr, VAR_0, frame_addr + offsetof(struct sigframe_v1, retcode)); end: unlock_user_struct(VAR_4, frame_addr, 1); }
[ "static void FUNC_0(int VAR_0, struct target_sigaction *VAR_1,\ntarget_sigset_t *VAR_2, CPUARMState *VAR_3)\n{", "struct sigframe_v1 *VAR_4;", "abi_ulong frame_addr = get_sigframe(VAR_1, VAR_3, sizeof(*VAR_4));", "int VAR_5;", "if (!lock_user_struct(VERIFY_WRITE, VAR_4, frame_addr, 0))\nreturn;", "setup_sigcontext(&VAR_4->sc, VAR_3, VAR_2->sig[0]);", "for(VAR_5 = 1; VAR_5 < TARGET_NSIG_WORDS; VAR_5++) {", "if (__put_user(VAR_2->sig[VAR_5], &VAR_4->extramask[VAR_5 - 1]))\ngoto end;", "}", "setup_return(VAR_3, VAR_1, &VAR_4->retcode, frame_addr, VAR_0,\nframe_addr + offsetof(struct sigframe_v1, retcode));", "end:\nunlock_user_struct(VAR_4, frame_addr, 1);", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15, 17 ], [ 21 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 35, 37 ], [ 41, 43 ], [ 45 ] ]
11,994
qcrypto_tls_creds_x509_init(Object *obj) { object_property_add_bool(obj, "loaded", qcrypto_tls_creds_x509_prop_get_loaded, qcrypto_tls_creds_x509_prop_set_loaded, }
true
qemu
9a2fd4347c40321f5cbb4ab4220e759fcbf87d03
qcrypto_tls_creds_x509_init(Object *obj) { object_property_add_bool(obj, "loaded", qcrypto_tls_creds_x509_prop_get_loaded, qcrypto_tls_creds_x509_prop_set_loaded, }
{ "code": [], "line_no": [] }
FUNC_0(Object *VAR_0) { object_property_add_bool(VAR_0, "loaded", qcrypto_tls_creds_x509_prop_get_loaded, qcrypto_tls_creds_x509_prop_set_loaded, }
[ "FUNC_0(Object *VAR_0)\n{", "object_property_add_bool(VAR_0, \"loaded\",\nqcrypto_tls_creds_x509_prop_get_loaded,\nqcrypto_tls_creds_x509_prop_set_loaded,\n}" ]
[ 0, 0 ]
[ [ 1, 2 ], [ 3, 4, 5, 6 ] ]
11,995
int qcow2_alloc_cluster_offset(BlockDriverState *bs, uint64_t offset, int n_start, int n_end, int *num, uint64_t *host_offset, QCowL2Meta **m) { BDRVQcowState *s = bs->opaque; uint64_t start, remaining; uint64_t cluster_offset; uint64_t cur_bytes; int ret; trace_qcow2_alloc_clusters_offset(qemu_coroutine_self(), offset, n_start, n_end); assert(n_start * BDRV_SECTOR_SIZE == offset_into_cluster(s, offset)); offset = start_of_cluster(s, offset); again: start = offset + (n_start << BDRV_SECTOR_BITS); remaining = (n_end - n_start) << BDRV_SECTOR_BITS; cluster_offset = 0; *host_offset = 0; while (true) { /* * Now start gathering as many contiguous clusters as possible: * * 1. Check for overlaps with in-flight allocations * * a) Overlap not in the first cluster -> shorten this request and * let the caller handle the rest in its next loop iteration. * * b) Real overlaps of two requests. Yield and restart the search * for contiguous clusters (the situation could have changed * while we were sleeping) * * c) TODO: Request starts in the same cluster as the in-flight * allocation ends. Shorten the COW of the in-fight allocation, * set cluster_offset to write to the same cluster and set up * the right synchronisation between the in-flight request and * the new one. */ cur_bytes = remaining; ret = handle_dependencies(bs, start, &cur_bytes); if (ret == -EAGAIN) { goto again; } else if (ret < 0) { return ret; } else { /* handle_dependencies() may have decreased cur_bytes (shortened * the allocations below) so that the next dependency is processed * correctly during the next loop iteration. */ } /* * 2. Count contiguous COPIED clusters. */ ret = handle_copied(bs, start, &cluster_offset, &cur_bytes, m); if (ret < 0) { return ret; } else if (ret) { if (!*host_offset) { *host_offset = start_of_cluster(s, cluster_offset); } start += cur_bytes; remaining -= cur_bytes; cluster_offset += cur_bytes; cur_bytes = remaining; } else if (cur_bytes == 0) { break; } /* If there is something left to allocate, do that now */ if (remaining == 0) { break; } /* * 3. If the request still hasn't completed, allocate new clusters, * considering any cluster_offset of steps 1c or 2. */ ret = handle_alloc(bs, start, &cluster_offset, &cur_bytes, m); if (ret < 0) { return ret; } else if (ret) { if (!*host_offset) { *host_offset = start_of_cluster(s, cluster_offset); } start += cur_bytes; remaining -= cur_bytes; cluster_offset += cur_bytes; break; } else { assert(cur_bytes == 0); break; } } *num = (n_end - n_start) - (remaining >> BDRV_SECTOR_BITS); assert(*num > 0); assert(*host_offset != 0); return 0; }
true
qemu
ecdd5333ab9ed3f2b848066aaaef02c027b25e36
int qcow2_alloc_cluster_offset(BlockDriverState *bs, uint64_t offset, int n_start, int n_end, int *num, uint64_t *host_offset, QCowL2Meta **m) { BDRVQcowState *s = bs->opaque; uint64_t start, remaining; uint64_t cluster_offset; uint64_t cur_bytes; int ret; trace_qcow2_alloc_clusters_offset(qemu_coroutine_self(), offset, n_start, n_end); assert(n_start * BDRV_SECTOR_SIZE == offset_into_cluster(s, offset)); offset = start_of_cluster(s, offset); again: start = offset + (n_start << BDRV_SECTOR_BITS); remaining = (n_end - n_start) << BDRV_SECTOR_BITS; cluster_offset = 0; *host_offset = 0; while (true) { cur_bytes = remaining; ret = handle_dependencies(bs, start, &cur_bytes); if (ret == -EAGAIN) { goto again; } else if (ret < 0) { return ret; } else { } ret = handle_copied(bs, start, &cluster_offset, &cur_bytes, m); if (ret < 0) { return ret; } else if (ret) { if (!*host_offset) { *host_offset = start_of_cluster(s, cluster_offset); } start += cur_bytes; remaining -= cur_bytes; cluster_offset += cur_bytes; cur_bytes = remaining; } else if (cur_bytes == 0) { break; } if (remaining == 0) { break; } ret = handle_alloc(bs, start, &cluster_offset, &cur_bytes, m); if (ret < 0) { return ret; } else if (ret) { if (!*host_offset) { *host_offset = start_of_cluster(s, cluster_offset); } start += cur_bytes; remaining -= cur_bytes; cluster_offset += cur_bytes; break; } else { assert(cur_bytes == 0); break; } } *num = (n_end - n_start) - (remaining >> BDRV_SECTOR_BITS); assert(*num > 0); assert(*host_offset != 0); return 0; }
{ "code": [ " cur_bytes = remaining;", " ret = handle_dependencies(bs, start, &cur_bytes);", " if (!*host_offset) {", " *host_offset = start_of_cluster(s, cluster_offset);", " start += cur_bytes;", " remaining -= cur_bytes;", " cluster_offset += cur_bytes;", " cur_bytes = remaining;", " if (remaining == 0) {", " break;", " if (!*host_offset) {", " *host_offset = start_of_cluster(s, cluster_offset);", " start += cur_bytes;", " remaining -= cur_bytes;", " cluster_offset += cur_bytes;", " break;" ], "line_no": [ 81, 83, 119, 121, 127, 129, 131, 135, 147, 139, 119, 121, 127, 129, 131, 139 ] }
int FUNC_0(BlockDriverState *VAR_0, uint64_t VAR_1, int VAR_2, int VAR_3, int *VAR_4, uint64_t *VAR_5, QCowL2Meta **VAR_6) { BDRVQcowState *s = VAR_0->opaque; uint64_t start, remaining; uint64_t cluster_offset; uint64_t cur_bytes; int VAR_7; trace_qcow2_alloc_clusters_offset(qemu_coroutine_self(), VAR_1, VAR_2, VAR_3); assert(VAR_2 * BDRV_SECTOR_SIZE == offset_into_cluster(s, VAR_1)); VAR_1 = start_of_cluster(s, VAR_1); again: start = VAR_1 + (VAR_2 << BDRV_SECTOR_BITS); remaining = (VAR_3 - VAR_2) << BDRV_SECTOR_BITS; cluster_offset = 0; *VAR_5 = 0; while (true) { cur_bytes = remaining; VAR_7 = handle_dependencies(VAR_0, start, &cur_bytes); if (VAR_7 == -EAGAIN) { goto again; } else if (VAR_7 < 0) { return VAR_7; } else { } VAR_7 = handle_copied(VAR_0, start, &cluster_offset, &cur_bytes, VAR_6); if (VAR_7 < 0) { return VAR_7; } else if (VAR_7) { if (!*VAR_5) { *VAR_5 = start_of_cluster(s, cluster_offset); } start += cur_bytes; remaining -= cur_bytes; cluster_offset += cur_bytes; cur_bytes = remaining; } else if (cur_bytes == 0) { break; } if (remaining == 0) { break; } VAR_7 = handle_alloc(VAR_0, start, &cluster_offset, &cur_bytes, VAR_6); if (VAR_7 < 0) { return VAR_7; } else if (VAR_7) { if (!*VAR_5) { *VAR_5 = start_of_cluster(s, cluster_offset); } start += cur_bytes; remaining -= cur_bytes; cluster_offset += cur_bytes; break; } else { assert(cur_bytes == 0); break; } } *VAR_4 = (VAR_3 - VAR_2) - (remaining >> BDRV_SECTOR_BITS); assert(*VAR_4 > 0); assert(*VAR_5 != 0); return 0; }
[ "int FUNC_0(BlockDriverState *VAR_0, uint64_t VAR_1,\nint VAR_2, int VAR_3, int *VAR_4, uint64_t *VAR_5, QCowL2Meta **VAR_6)\n{", "BDRVQcowState *s = VAR_0->opaque;", "uint64_t start, remaining;", "uint64_t cluster_offset;", "uint64_t cur_bytes;", "int VAR_7;", "trace_qcow2_alloc_clusters_offset(qemu_coroutine_self(), VAR_1,\nVAR_2, VAR_3);", "assert(VAR_2 * BDRV_SECTOR_SIZE == offset_into_cluster(s, VAR_1));", "VAR_1 = start_of_cluster(s, VAR_1);", "again:\nstart = VAR_1 + (VAR_2 << BDRV_SECTOR_BITS);", "remaining = (VAR_3 - VAR_2) << BDRV_SECTOR_BITS;", "cluster_offset = 0;", "*VAR_5 = 0;", "while (true) {", "cur_bytes = remaining;", "VAR_7 = handle_dependencies(VAR_0, start, &cur_bytes);", "if (VAR_7 == -EAGAIN) {", "goto again;", "} else if (VAR_7 < 0) {", "return VAR_7;", "} else {", "}", "VAR_7 = handle_copied(VAR_0, start, &cluster_offset, &cur_bytes, VAR_6);", "if (VAR_7 < 0) {", "return VAR_7;", "} else if (VAR_7) {", "if (!*VAR_5) {", "*VAR_5 = start_of_cluster(s, cluster_offset);", "}", "start += cur_bytes;", "remaining -= cur_bytes;", "cluster_offset += cur_bytes;", "cur_bytes = remaining;", "} else if (cur_bytes == 0) {", "break;", "}", "if (remaining == 0) {", "break;", "}", "VAR_7 = handle_alloc(VAR_0, start, &cluster_offset, &cur_bytes, VAR_6);", "if (VAR_7 < 0) {", "return VAR_7;", "} else if (VAR_7) {", "if (!*VAR_5) {", "*VAR_5 = start_of_cluster(s, cluster_offset);", "}", "start += cur_bytes;", "remaining -= cur_bytes;", "cluster_offset += cur_bytes;", "break;", "} else {", "assert(cur_bytes == 0);", "break;", "}", "}", "*VAR_4 = (VAR_3 - VAR_2) - (remaining >> BDRV_SECTOR_BITS);", "assert(*VAR_4 > 0);", "assert(*VAR_5 != 0);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19, 21 ], [ 25 ], [ 27 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 101 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 127 ], [ 129 ], [ 131 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 147 ], [ 149 ], [ 151 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 179 ], [ 181 ], [ 183 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 201 ], [ 203 ], [ 205 ], [ 209 ], [ 211 ] ]
11,996
static int thread_get_buffer_internal(AVCodecContext *avctx, ThreadFrame *f, int flags) { PerThreadContext *p = avctx->thread_opaque; int err; f->owner = avctx; ff_init_buffer_info(avctx, f->f); if (!(avctx->active_thread_type & FF_THREAD_FRAME)) return ff_get_buffer(avctx, f->f, flags); if (p->state != STATE_SETTING_UP && (avctx->codec->update_thread_context || (!avctx->thread_safe_callbacks && avctx->get_buffer != avcodec_default_get_buffer))) { av_log(avctx, AV_LOG_ERROR, "get_buffer() cannot be called after ff_thread_finish_setup()\n"); return -1; } if (avctx->internal->allocate_progress) { int *progress; f->progress = av_buffer_alloc(2 * sizeof(int)); if (!f->progress) { return AVERROR(ENOMEM); } progress = (int*)f->progress->data; progress[0] = progress[1] = -1; } pthread_mutex_lock(&p->parent->buffer_mutex); if (avctx->thread_safe_callbacks || ( #if FF_API_GET_BUFFER !avctx->get_buffer && #endif avctx->get_buffer2 == avcodec_default_get_buffer2)) { err = ff_get_buffer(avctx, f->f, flags); } else { pthread_mutex_lock(&p->progress_mutex); p->requested_frame = f->f; p->requested_flags = flags; p->state = STATE_GET_BUFFER; pthread_cond_broadcast(&p->progress_cond); while (p->state != STATE_SETTING_UP) pthread_cond_wait(&p->progress_cond, &p->progress_mutex); err = p->result; pthread_mutex_unlock(&p->progress_mutex); if (!avctx->codec->update_thread_context) ff_thread_finish_setup(avctx); } if (err) av_buffer_unref(&f->progress); pthread_mutex_unlock(&p->parent->buffer_mutex); return err; }
false
FFmpeg
97f8c6e14753b94c1f6a96fe354a125bbfdea2cb
static int thread_get_buffer_internal(AVCodecContext *avctx, ThreadFrame *f, int flags) { PerThreadContext *p = avctx->thread_opaque; int err; f->owner = avctx; ff_init_buffer_info(avctx, f->f); if (!(avctx->active_thread_type & FF_THREAD_FRAME)) return ff_get_buffer(avctx, f->f, flags); if (p->state != STATE_SETTING_UP && (avctx->codec->update_thread_context || (!avctx->thread_safe_callbacks && avctx->get_buffer != avcodec_default_get_buffer))) { av_log(avctx, AV_LOG_ERROR, "get_buffer() cannot be called after ff_thread_finish_setup()\n"); return -1; } if (avctx->internal->allocate_progress) { int *progress; f->progress = av_buffer_alloc(2 * sizeof(int)); if (!f->progress) { return AVERROR(ENOMEM); } progress = (int*)f->progress->data; progress[0] = progress[1] = -1; } pthread_mutex_lock(&p->parent->buffer_mutex); if (avctx->thread_safe_callbacks || ( #if FF_API_GET_BUFFER !avctx->get_buffer && #endif avctx->get_buffer2 == avcodec_default_get_buffer2)) { err = ff_get_buffer(avctx, f->f, flags); } else { pthread_mutex_lock(&p->progress_mutex); p->requested_frame = f->f; p->requested_flags = flags; p->state = STATE_GET_BUFFER; pthread_cond_broadcast(&p->progress_cond); while (p->state != STATE_SETTING_UP) pthread_cond_wait(&p->progress_cond, &p->progress_mutex); err = p->result; pthread_mutex_unlock(&p->progress_mutex); if (!avctx->codec->update_thread_context) ff_thread_finish_setup(avctx); } if (err) av_buffer_unref(&f->progress); pthread_mutex_unlock(&p->parent->buffer_mutex); return err; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, ThreadFrame *VAR_1, int VAR_2) { PerThreadContext *p = VAR_0->thread_opaque; int VAR_3; VAR_1->owner = VAR_0; ff_init_buffer_info(VAR_0, VAR_1->VAR_1); if (!(VAR_0->active_thread_type & FF_THREAD_FRAME)) return ff_get_buffer(VAR_0, VAR_1->VAR_1, VAR_2); if (p->state != STATE_SETTING_UP && (VAR_0->codec->update_thread_context || (!VAR_0->thread_safe_callbacks && VAR_0->get_buffer != avcodec_default_get_buffer))) { av_log(VAR_0, AV_LOG_ERROR, "get_buffer() cannot be called after ff_thread_finish_setup()\n"); return -1; } if (VAR_0->internal->allocate_progress) { int *VAR_4; VAR_1->VAR_4 = av_buffer_alloc(2 * sizeof(int)); if (!VAR_1->VAR_4) { return AVERROR(ENOMEM); } VAR_4 = (int*)VAR_1->VAR_4->data; VAR_4[0] = VAR_4[1] = -1; } pthread_mutex_lock(&p->parent->buffer_mutex); if (VAR_0->thread_safe_callbacks || ( #if FF_API_GET_BUFFER !VAR_0->get_buffer && #endif VAR_0->get_buffer2 == avcodec_default_get_buffer2)) { VAR_3 = ff_get_buffer(VAR_0, VAR_1->VAR_1, VAR_2); } else { pthread_mutex_lock(&p->progress_mutex); p->requested_frame = VAR_1->VAR_1; p->requested_flags = VAR_2; p->state = STATE_GET_BUFFER; pthread_cond_broadcast(&p->progress_cond); while (p->state != STATE_SETTING_UP) pthread_cond_wait(&p->progress_cond, &p->progress_mutex); VAR_3 = p->result; pthread_mutex_unlock(&p->progress_mutex); if (!VAR_0->codec->update_thread_context) ff_thread_finish_setup(VAR_0); } if (VAR_3) av_buffer_unref(&VAR_1->VAR_4); pthread_mutex_unlock(&p->parent->buffer_mutex); return VAR_3; }
[ "static int FUNC_0(AVCodecContext *VAR_0, ThreadFrame *VAR_1, int VAR_2)\n{", "PerThreadContext *p = VAR_0->thread_opaque;", "int VAR_3;", "VAR_1->owner = VAR_0;", "ff_init_buffer_info(VAR_0, VAR_1->VAR_1);", "if (!(VAR_0->active_thread_type & FF_THREAD_FRAME))\nreturn ff_get_buffer(VAR_0, VAR_1->VAR_1, VAR_2);", "if (p->state != STATE_SETTING_UP &&\n(VAR_0->codec->update_thread_context || (!VAR_0->thread_safe_callbacks &&\nVAR_0->get_buffer != avcodec_default_get_buffer))) {", "av_log(VAR_0, AV_LOG_ERROR, \"get_buffer() cannot be called after ff_thread_finish_setup()\\n\");", "return -1;", "}", "if (VAR_0->internal->allocate_progress) {", "int *VAR_4;", "VAR_1->VAR_4 = av_buffer_alloc(2 * sizeof(int));", "if (!VAR_1->VAR_4) {", "return AVERROR(ENOMEM);", "}", "VAR_4 = (int*)VAR_1->VAR_4->data;", "VAR_4[0] = VAR_4[1] = -1;", "}", "pthread_mutex_lock(&p->parent->buffer_mutex);", "if (VAR_0->thread_safe_callbacks || (\n#if FF_API_GET_BUFFER\n!VAR_0->get_buffer &&\n#endif\nVAR_0->get_buffer2 == avcodec_default_get_buffer2)) {", "VAR_3 = ff_get_buffer(VAR_0, VAR_1->VAR_1, VAR_2);", "} else {", "pthread_mutex_lock(&p->progress_mutex);", "p->requested_frame = VAR_1->VAR_1;", "p->requested_flags = VAR_2;", "p->state = STATE_GET_BUFFER;", "pthread_cond_broadcast(&p->progress_cond);", "while (p->state != STATE_SETTING_UP)\npthread_cond_wait(&p->progress_cond, &p->progress_mutex);", "VAR_3 = p->result;", "pthread_mutex_unlock(&p->progress_mutex);", "if (!VAR_0->codec->update_thread_context)\nff_thread_finish_setup(VAR_0);", "}", "if (VAR_3)\nav_buffer_unref(&VAR_1->VAR_4);", "pthread_mutex_unlock(&p->parent->buffer_mutex);", "return VAR_3;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 15 ], [ 19, 21 ], [ 25, 27, 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 61 ], [ 65, 67, 69, 71, 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 91, 93 ], [ 97 ], [ 101 ], [ 105, 107 ], [ 109 ], [ 113, 115 ], [ 119 ], [ 123 ], [ 125 ] ]
11,997
static void xio3130_downstream_realize(PCIDevice *d, Error **errp) { PCIEPort *p = PCIE_PORT(d); PCIESlot *s = PCIE_SLOT(d); int rc; pci_bridge_initfn(d, TYPE_PCIE_BUS); pcie_port_init_reg(d); rc = msi_init(d, XIO3130_MSI_OFFSET, XIO3130_MSI_NR_VECTOR, XIO3130_MSI_SUPPORTED_FLAGS & PCI_MSI_FLAGS_64BIT, XIO3130_MSI_SUPPORTED_FLAGS & PCI_MSI_FLAGS_MASKBIT, errp); if (rc < 0) { assert(rc == -ENOTSUP); goto err_bridge; } rc = pci_bridge_ssvid_init(d, XIO3130_SSVID_OFFSET, XIO3130_SSVID_SVID, XIO3130_SSVID_SSID, errp); if (rc < 0) { goto err_bridge; } rc = pcie_cap_init(d, XIO3130_EXP_OFFSET, PCI_EXP_TYPE_DOWNSTREAM, p->port, errp); if (rc < 0) { goto err_msi; } pcie_cap_flr_init(d); pcie_cap_deverr_init(d); pcie_cap_slot_init(d, s->slot); pcie_cap_arifwd_init(d); pcie_chassis_create(s->chassis); rc = pcie_chassis_add_slot(s); if (rc < 0) { goto err_pcie_cap; } rc = pcie_aer_init(d, PCI_ERR_VER, XIO3130_AER_OFFSET, PCI_ERR_SIZEOF, errp); if (rc < 0) { goto err; } return; err: pcie_chassis_del_slot(s); err_pcie_cap: pcie_cap_exit(d); err_msi: msi_uninit(d); err_bridge: pci_bridge_exitfn(d); }
true
qemu
8b3d26342c4aa171e759e6392fe3b742759d4963
static void xio3130_downstream_realize(PCIDevice *d, Error **errp) { PCIEPort *p = PCIE_PORT(d); PCIESlot *s = PCIE_SLOT(d); int rc; pci_bridge_initfn(d, TYPE_PCIE_BUS); pcie_port_init_reg(d); rc = msi_init(d, XIO3130_MSI_OFFSET, XIO3130_MSI_NR_VECTOR, XIO3130_MSI_SUPPORTED_FLAGS & PCI_MSI_FLAGS_64BIT, XIO3130_MSI_SUPPORTED_FLAGS & PCI_MSI_FLAGS_MASKBIT, errp); if (rc < 0) { assert(rc == -ENOTSUP); goto err_bridge; } rc = pci_bridge_ssvid_init(d, XIO3130_SSVID_OFFSET, XIO3130_SSVID_SVID, XIO3130_SSVID_SSID, errp); if (rc < 0) { goto err_bridge; } rc = pcie_cap_init(d, XIO3130_EXP_OFFSET, PCI_EXP_TYPE_DOWNSTREAM, p->port, errp); if (rc < 0) { goto err_msi; } pcie_cap_flr_init(d); pcie_cap_deverr_init(d); pcie_cap_slot_init(d, s->slot); pcie_cap_arifwd_init(d); pcie_chassis_create(s->chassis); rc = pcie_chassis_add_slot(s); if (rc < 0) { goto err_pcie_cap; } rc = pcie_aer_init(d, PCI_ERR_VER, XIO3130_AER_OFFSET, PCI_ERR_SIZEOF, errp); if (rc < 0) { goto err; } return; err: pcie_chassis_del_slot(s); err_pcie_cap: pcie_cap_exit(d); err_msi: msi_uninit(d); err_bridge: pci_bridge_exitfn(d); }
{ "code": [], "line_no": [] }
static void FUNC_0(PCIDevice *VAR_0, Error **VAR_1) { PCIEPort *p = PCIE_PORT(VAR_0); PCIESlot *s = PCIE_SLOT(VAR_0); int VAR_2; pci_bridge_initfn(VAR_0, TYPE_PCIE_BUS); pcie_port_init_reg(VAR_0); VAR_2 = msi_init(VAR_0, XIO3130_MSI_OFFSET, XIO3130_MSI_NR_VECTOR, XIO3130_MSI_SUPPORTED_FLAGS & PCI_MSI_FLAGS_64BIT, XIO3130_MSI_SUPPORTED_FLAGS & PCI_MSI_FLAGS_MASKBIT, VAR_1); if (VAR_2 < 0) { assert(VAR_2 == -ENOTSUP); goto err_bridge; } VAR_2 = pci_bridge_ssvid_init(VAR_0, XIO3130_SSVID_OFFSET, XIO3130_SSVID_SVID, XIO3130_SSVID_SSID, VAR_1); if (VAR_2 < 0) { goto err_bridge; } VAR_2 = pcie_cap_init(VAR_0, XIO3130_EXP_OFFSET, PCI_EXP_TYPE_DOWNSTREAM, p->port, VAR_1); if (VAR_2 < 0) { goto err_msi; } pcie_cap_flr_init(VAR_0); pcie_cap_deverr_init(VAR_0); pcie_cap_slot_init(VAR_0, s->slot); pcie_cap_arifwd_init(VAR_0); pcie_chassis_create(s->chassis); VAR_2 = pcie_chassis_add_slot(s); if (VAR_2 < 0) { goto err_pcie_cap; } VAR_2 = pcie_aer_init(VAR_0, PCI_ERR_VER, XIO3130_AER_OFFSET, PCI_ERR_SIZEOF, VAR_1); if (VAR_2 < 0) { goto err; } return; err: pcie_chassis_del_slot(s); err_pcie_cap: pcie_cap_exit(VAR_0); err_msi: msi_uninit(VAR_0); err_bridge: pci_bridge_exitfn(VAR_0); }
[ "static void FUNC_0(PCIDevice *VAR_0, Error **VAR_1)\n{", "PCIEPort *p = PCIE_PORT(VAR_0);", "PCIESlot *s = PCIE_SLOT(VAR_0);", "int VAR_2;", "pci_bridge_initfn(VAR_0, TYPE_PCIE_BUS);", "pcie_port_init_reg(VAR_0);", "VAR_2 = msi_init(VAR_0, XIO3130_MSI_OFFSET, XIO3130_MSI_NR_VECTOR,\nXIO3130_MSI_SUPPORTED_FLAGS & PCI_MSI_FLAGS_64BIT,\nXIO3130_MSI_SUPPORTED_FLAGS & PCI_MSI_FLAGS_MASKBIT,\nVAR_1);", "if (VAR_2 < 0) {", "assert(VAR_2 == -ENOTSUP);", "goto err_bridge;", "}", "VAR_2 = pci_bridge_ssvid_init(VAR_0, XIO3130_SSVID_OFFSET,\nXIO3130_SSVID_SVID, XIO3130_SSVID_SSID,\nVAR_1);", "if (VAR_2 < 0) {", "goto err_bridge;", "}", "VAR_2 = pcie_cap_init(VAR_0, XIO3130_EXP_OFFSET, PCI_EXP_TYPE_DOWNSTREAM,\np->port, VAR_1);", "if (VAR_2 < 0) {", "goto err_msi;", "}", "pcie_cap_flr_init(VAR_0);", "pcie_cap_deverr_init(VAR_0);", "pcie_cap_slot_init(VAR_0, s->slot);", "pcie_cap_arifwd_init(VAR_0);", "pcie_chassis_create(s->chassis);", "VAR_2 = pcie_chassis_add_slot(s);", "if (VAR_2 < 0) {", "goto err_pcie_cap;", "}", "VAR_2 = pcie_aer_init(VAR_0, PCI_ERR_VER, XIO3130_AER_OFFSET,\nPCI_ERR_SIZEOF, VAR_1);", "if (VAR_2 < 0) {", "goto err;", "}", "return;", "err:\npcie_chassis_del_slot(s);", "err_pcie_cap:\npcie_cap_exit(VAR_0);", "err_msi:\nmsi_uninit(VAR_0);", "err_bridge:\npci_bridge_exitfn(VAR_0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 19, 21, 23, 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37, 39, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51, 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 78 ], [ 80 ], [ 84, 86 ], [ 88 ], [ 90 ], [ 92 ], [ 96 ], [ 100, 102 ], [ 104, 106 ], [ 108, 110 ], [ 112, 114 ], [ 116 ] ]
11,999
static int qcow_write(BlockDriverState *bs, int64_t sector_num, const uint8_t *buf, int nb_sectors) { BDRVQcowState *s = bs->opaque; int ret, index_in_cluster, n; uint64_t cluster_offset; int n_end; while (nb_sectors > 0) { index_in_cluster = sector_num & (s->cluster_sectors - 1); n_end = index_in_cluster + nb_sectors; if (s->crypt_method && n_end > QCOW_MAX_CRYPT_CLUSTERS * s->cluster_sectors) n_end = QCOW_MAX_CRYPT_CLUSTERS * s->cluster_sectors; cluster_offset = alloc_cluster_offset(bs, sector_num << 9, index_in_cluster, n_end, &n); if (!cluster_offset) return -1; if (s->crypt_method) { encrypt_sectors(s, sector_num, s->cluster_data, buf, n, 1, &s->aes_encrypt_key); ret = bdrv_pwrite(s->hd, cluster_offset + index_in_cluster * 512, s->cluster_data, n * 512); } else { ret = bdrv_pwrite(s->hd, cluster_offset + index_in_cluster * 512, buf, n * 512); } if (ret != n * 512) return -1; nb_sectors -= n; sector_num += n; buf += n * 512; } s->cluster_cache_offset = -1; /* disable compressed cache */ return 0; }
true
qemu
e976c6a1e40ad74d616a186d3b48b0ad8f5eb970
static int qcow_write(BlockDriverState *bs, int64_t sector_num, const uint8_t *buf, int nb_sectors) { BDRVQcowState *s = bs->opaque; int ret, index_in_cluster, n; uint64_t cluster_offset; int n_end; while (nb_sectors > 0) { index_in_cluster = sector_num & (s->cluster_sectors - 1); n_end = index_in_cluster + nb_sectors; if (s->crypt_method && n_end > QCOW_MAX_CRYPT_CLUSTERS * s->cluster_sectors) n_end = QCOW_MAX_CRYPT_CLUSTERS * s->cluster_sectors; cluster_offset = alloc_cluster_offset(bs, sector_num << 9, index_in_cluster, n_end, &n); if (!cluster_offset) return -1; if (s->crypt_method) { encrypt_sectors(s, sector_num, s->cluster_data, buf, n, 1, &s->aes_encrypt_key); ret = bdrv_pwrite(s->hd, cluster_offset + index_in_cluster * 512, s->cluster_data, n * 512); } else { ret = bdrv_pwrite(s->hd, cluster_offset + index_in_cluster * 512, buf, n * 512); } if (ret != n * 512) return -1; nb_sectors -= n; sector_num += n; buf += n * 512; } s->cluster_cache_offset = -1; return 0; }
{ "code": [ " n_end, &n);", " if (ret != n * 512)", " uint64_t cluster_offset;" ], "line_no": [ 33, 55, 11 ] }
static int FUNC_0(BlockDriverState *VAR_0, int64_t VAR_1, const uint8_t *VAR_2, int VAR_3) { BDRVQcowState *s = VAR_0->opaque; int VAR_4, VAR_5, VAR_6; uint64_t cluster_offset; int VAR_7; while (VAR_3 > 0) { VAR_5 = VAR_1 & (s->cluster_sectors - 1); VAR_7 = VAR_5 + VAR_3; if (s->crypt_method && VAR_7 > QCOW_MAX_CRYPT_CLUSTERS * s->cluster_sectors) VAR_7 = QCOW_MAX_CRYPT_CLUSTERS * s->cluster_sectors; cluster_offset = alloc_cluster_offset(VAR_0, VAR_1 << 9, VAR_5, VAR_7, &VAR_6); if (!cluster_offset) return -1; if (s->crypt_method) { encrypt_sectors(s, VAR_1, s->cluster_data, VAR_2, VAR_6, 1, &s->aes_encrypt_key); VAR_4 = bdrv_pwrite(s->hd, cluster_offset + VAR_5 * 512, s->cluster_data, VAR_6 * 512); } else { VAR_4 = bdrv_pwrite(s->hd, cluster_offset + VAR_5 * 512, VAR_2, VAR_6 * 512); } if (VAR_4 != VAR_6 * 512) return -1; VAR_3 -= VAR_6; VAR_1 += VAR_6; VAR_2 += VAR_6 * 512; } s->cluster_cache_offset = -1; return 0; }
[ "static int FUNC_0(BlockDriverState *VAR_0, int64_t VAR_1,\nconst uint8_t *VAR_2, int VAR_3)\n{", "BDRVQcowState *s = VAR_0->opaque;", "int VAR_4, VAR_5, VAR_6;", "uint64_t cluster_offset;", "int VAR_7;", "while (VAR_3 > 0) {", "VAR_5 = VAR_1 & (s->cluster_sectors - 1);", "VAR_7 = VAR_5 + VAR_3;", "if (s->crypt_method &&\nVAR_7 > QCOW_MAX_CRYPT_CLUSTERS * s->cluster_sectors)\nVAR_7 = QCOW_MAX_CRYPT_CLUSTERS * s->cluster_sectors;", "cluster_offset = alloc_cluster_offset(VAR_0, VAR_1 << 9,\nVAR_5,\nVAR_7, &VAR_6);", "if (!cluster_offset)\nreturn -1;", "if (s->crypt_method) {", "encrypt_sectors(s, VAR_1, s->cluster_data, VAR_2, VAR_6, 1,\n&s->aes_encrypt_key);", "VAR_4 = bdrv_pwrite(s->hd, cluster_offset + VAR_5 * 512,\ns->cluster_data, VAR_6 * 512);", "} else {", "VAR_4 = bdrv_pwrite(s->hd, cluster_offset + VAR_5 * 512, VAR_2, VAR_6 * 512);", "}", "if (VAR_4 != VAR_6 * 512)\nreturn -1;", "VAR_3 -= VAR_6;", "VAR_1 += VAR_6;", "VAR_2 += VAR_6 * 512;", "}", "s->cluster_cache_offset = -1;", "return 0;", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 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 ] ]
12,000
static void vnc_dpy_resize(DisplayState *ds) { int size_changed; VncState *vs = ds->opaque; vs->old_data = qemu_realloc(vs->old_data, ds_get_linesize(ds) * ds_get_height(ds)); if (vs->old_data == NULL) { fprintf(stderr, "vnc: memory allocation failed\n"); exit(1); } if (ds_get_bytes_per_pixel(ds) != vs->depth) console_color_init(ds); vnc_colordepth(ds); size_changed = ds_get_width(ds) != vs->width || ds_get_height(ds) != vs->height; if (size_changed) { vs->width = ds_get_width(ds); vs->height = ds_get_height(ds); if (vs->csock != -1 && vs->has_resize) { vnc_write_u8(vs, 0); /* msg id */ vnc_write_u8(vs, 0); vnc_write_u16(vs, 1); /* number of rects */ vnc_framebuffer_update(vs, 0, 0, ds_get_width(ds), ds_get_height(ds), -223); vnc_flush(vs); } } memset(vs->dirty_row, 0xFF, sizeof(vs->dirty_row)); memset(vs->old_data, 42, ds_get_linesize(vs->ds) * ds_get_height(vs->ds)); }
true
qemu
6cec5487990bf3f1f22b3fcb871978255e92ae0d
static void vnc_dpy_resize(DisplayState *ds) { int size_changed; VncState *vs = ds->opaque; vs->old_data = qemu_realloc(vs->old_data, ds_get_linesize(ds) * ds_get_height(ds)); if (vs->old_data == NULL) { fprintf(stderr, "vnc: memory allocation failed\n"); exit(1); } if (ds_get_bytes_per_pixel(ds) != vs->depth) console_color_init(ds); vnc_colordepth(ds); size_changed = ds_get_width(ds) != vs->width || ds_get_height(ds) != vs->height; if (size_changed) { vs->width = ds_get_width(ds); vs->height = ds_get_height(ds); if (vs->csock != -1 && vs->has_resize) { vnc_write_u8(vs, 0); vnc_write_u8(vs, 0); vnc_write_u16(vs, 1); vnc_framebuffer_update(vs, 0, 0, ds_get_width(ds), ds_get_height(ds), -223); vnc_flush(vs); } } memset(vs->dirty_row, 0xFF, sizeof(vs->dirty_row)); memset(vs->old_data, 42, ds_get_linesize(vs->ds) * ds_get_height(vs->ds)); }
{ "code": [ " if (ds_get_bytes_per_pixel(ds) != vs->depth)", " size_changed = ds_get_width(ds) != vs->width || ds_get_height(ds) != vs->height;", " vs->width = ds_get_width(ds);", " vs->height = ds_get_height(ds);" ], "line_no": [ 25, 31, 35, 37 ] }
static void FUNC_0(DisplayState *VAR_0) { int VAR_1; VncState *vs = VAR_0->opaque; vs->old_data = qemu_realloc(vs->old_data, ds_get_linesize(VAR_0) * ds_get_height(VAR_0)); if (vs->old_data == NULL) { fprintf(stderr, "vnc: memory allocation failed\n"); exit(1); } if (ds_get_bytes_per_pixel(VAR_0) != vs->depth) console_color_init(VAR_0); vnc_colordepth(VAR_0); VAR_1 = ds_get_width(VAR_0) != vs->width || ds_get_height(VAR_0) != vs->height; if (VAR_1) { vs->width = ds_get_width(VAR_0); vs->height = ds_get_height(VAR_0); if (vs->csock != -1 && vs->has_resize) { vnc_write_u8(vs, 0); vnc_write_u8(vs, 0); vnc_write_u16(vs, 1); vnc_framebuffer_update(vs, 0, 0, ds_get_width(VAR_0), ds_get_height(VAR_0), -223); vnc_flush(vs); } } memset(vs->dirty_row, 0xFF, sizeof(vs->dirty_row)); memset(vs->old_data, 42, ds_get_linesize(vs->VAR_0) * ds_get_height(vs->VAR_0)); }
[ "static void FUNC_0(DisplayState *VAR_0)\n{", "int VAR_1;", "VncState *vs = VAR_0->opaque;", "vs->old_data = qemu_realloc(vs->old_data, ds_get_linesize(VAR_0) * ds_get_height(VAR_0));", "if (vs->old_data == NULL) {", "fprintf(stderr, \"vnc: memory allocation failed\\n\");", "exit(1);", "}", "if (ds_get_bytes_per_pixel(VAR_0) != vs->depth)\nconsole_color_init(VAR_0);", "vnc_colordepth(VAR_0);", "VAR_1 = ds_get_width(VAR_0) != vs->width || ds_get_height(VAR_0) != vs->height;", "if (VAR_1) {", "vs->width = ds_get_width(VAR_0);", "vs->height = ds_get_height(VAR_0);", "if (vs->csock != -1 && vs->has_resize) {", "vnc_write_u8(vs, 0);", "vnc_write_u8(vs, 0);", "vnc_write_u16(vs, 1);", "vnc_framebuffer_update(vs, 0, 0, ds_get_width(VAR_0), ds_get_height(VAR_0), -223);", "vnc_flush(vs);", "}", "}", "memset(vs->dirty_row, 0xFF, sizeof(vs->dirty_row));", "memset(vs->old_data, 42, ds_get_linesize(vs->VAR_0) * ds_get_height(vs->VAR_0));", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ] ]
12,001
static inline int cris_bound_b(int v, int b) { int r = v; asm ("bound.b\t%1, %0\n" : "+r" (r) : "ri" (b)); return r; }
true
qemu
21ce148c7ec71ee32834061355a5ecfd1a11f90f
static inline int cris_bound_b(int v, int b) { int r = v; asm ("bound.b\t%1, %0\n" : "+r" (r) : "ri" (b)); return r; }
{ "code": [ "static inline int cris_bound_b(int v, int b)" ], "line_no": [ 1 ] }
static inline int FUNC_0(int VAR_0, int VAR_1) { int VAR_2 = VAR_0; asm ("bound.VAR_1\t%1, %0\n" : "+VAR_2" (VAR_2) : "ri" (VAR_1)); return VAR_2; }
[ "static inline int FUNC_0(int VAR_0, int VAR_1)\n{", "int VAR_2 = VAR_0;", "asm (\"bound.VAR_1\\t%1, %0\\n\" : \"+VAR_2\" (VAR_2) : \"ri\" (VAR_1));", "return VAR_2;", "}" ]
[ 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ] ]
12,002
static int virtio_ccw_hcall_notify(const uint64_t *args) { uint64_t subch_id = args[0]; uint64_t queue = args[1]; SubchDev *sch; int cssid, ssid, schid, m; if (ioinst_disassemble_sch_ident(subch_id, &m, &cssid, &ssid, &schid)) { sch = css_find_subch(m, cssid, ssid, schid); if (!sch || !css_subch_visible(sch)) { virtio_queue_notify(virtio_ccw_get_vdev(sch), queue); return 0;
true
qemu
b57ed9bf075e33cdd2f9eb545ff555301dd57221
static int virtio_ccw_hcall_notify(const uint64_t *args) { uint64_t subch_id = args[0]; uint64_t queue = args[1]; SubchDev *sch; int cssid, ssid, schid, m; if (ioinst_disassemble_sch_ident(subch_id, &m, &cssid, &ssid, &schid)) { sch = css_find_subch(m, cssid, ssid, schid); if (!sch || !css_subch_visible(sch)) { virtio_queue_notify(virtio_ccw_get_vdev(sch), queue); return 0;
{ "code": [], "line_no": [] }
static int FUNC_0(const uint64_t *VAR_0) { uint64_t subch_id = VAR_0[0]; uint64_t queue = VAR_0[1]; SubchDev *sch; int VAR_1, VAR_2, VAR_3, VAR_4; if (ioinst_disassemble_sch_ident(subch_id, &VAR_4, &VAR_1, &VAR_2, &VAR_3)) { sch = css_find_subch(VAR_4, VAR_1, VAR_2, VAR_3); if (!sch || !css_subch_visible(sch)) { virtio_queue_notify(virtio_ccw_get_vdev(sch), queue); return 0;
[ "static int FUNC_0(const uint64_t *VAR_0)\n{", "uint64_t subch_id = VAR_0[0];", "uint64_t queue = VAR_0[1];", "SubchDev *sch;", "int VAR_1, VAR_2, VAR_3, VAR_4;", "if (ioinst_disassemble_sch_ident(subch_id, &VAR_4, &VAR_1, &VAR_2, &VAR_3)) {", "sch = css_find_subch(VAR_4, VAR_1, VAR_2, VAR_3);", "if (!sch || !css_subch_visible(sch)) {", "virtio_queue_notify(virtio_ccw_get_vdev(sch), queue);", "return 0;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 19 ], [ 21 ], [ 28 ], [ 30 ] ]
12,003
static int dirac_decode_frame_internal(DiracContext *s) { DWTContext d; int y, i, comp, dsty; int ret; if (s->low_delay) { /* [DIRAC_STD] 13.5.1 low_delay_transform_data() */ for (comp = 0; comp < 3; comp++) { Plane *p = &s->plane[comp]; memset(p->idwt_buf, 0, p->idwt_stride * p->idwt_height * sizeof(IDWTELEM)); } if (!s->zero_res) { if ((ret = decode_lowdelay(s)) < 0) return ret; } } for (comp = 0; comp < 3; comp++) { Plane *p = &s->plane[comp]; uint8_t *frame = s->current_picture->avframe->data[comp]; /* FIXME: small resolutions */ for (i = 0; i < 4; i++) s->edge_emu_buffer[i] = s->edge_emu_buffer_base + i*FFALIGN(p->width, 16); if (!s->zero_res && !s->low_delay) { memset(p->idwt_buf, 0, p->idwt_stride * p->idwt_height * sizeof(IDWTELEM)); decode_component(s, comp); /* [DIRAC_STD] 13.4.1 core_transform_data() */ } ret = ff_spatial_idwt_init2(&d, p->idwt_buf, p->idwt_width, p->idwt_height, p->idwt_stride, s->wavelet_idx+2, s->wavelet_depth, p->idwt_tmp); if (ret < 0) return ret; if (!s->num_refs) { /* intra */ for (y = 0; y < p->height; y += 16) { ff_spatial_idwt_slice2(&d, y+16); /* decode */ s->diracdsp.put_signed_rect_clamped(frame + y*p->stride, p->stride, p->idwt_buf + y*p->idwt_stride, p->idwt_stride, p->width, 16); } } else { /* inter */ int rowheight = p->ybsep*p->stride; select_dsp_funcs(s, p->width, p->height, p->xblen, p->yblen); for (i = 0; i < s->num_refs; i++) interpolate_refplane(s, s->ref_pics[i], comp, p->width, p->height); memset(s->mctmp, 0, 4*p->yoffset*p->stride); dsty = -p->yoffset; for (y = 0; y < s->blheight; y++) { int h = 0, start = FFMAX(dsty, 0); uint16_t *mctmp = s->mctmp + y*rowheight; DiracBlock *blocks = s->blmotion + y*s->blwidth; init_obmc_weights(s, p, y); if (y == s->blheight-1 || start+p->ybsep > p->height) h = p->height - start; else h = p->ybsep - (start - dsty); if (h < 0) break; memset(mctmp+2*p->yoffset*p->stride, 0, 2*rowheight); mc_row(s, blocks, mctmp, comp, dsty); mctmp += (start - dsty)*p->stride + p->xoffset; ff_spatial_idwt_slice2(&d, start + h); /* decode */ s->diracdsp.add_rect_clamped(frame + start*p->stride, mctmp, p->stride, p->idwt_buf + start*p->idwt_stride, p->idwt_stride, p->width, h); dsty += p->ybsep; } } } return 0; }
true
FFmpeg
1c5b712c0a643a039d6f34269b4102de313a050a
static int dirac_decode_frame_internal(DiracContext *s) { DWTContext d; int y, i, comp, dsty; int ret; if (s->low_delay) { for (comp = 0; comp < 3; comp++) { Plane *p = &s->plane[comp]; memset(p->idwt_buf, 0, p->idwt_stride * p->idwt_height * sizeof(IDWTELEM)); } if (!s->zero_res) { if ((ret = decode_lowdelay(s)) < 0) return ret; } } for (comp = 0; comp < 3; comp++) { Plane *p = &s->plane[comp]; uint8_t *frame = s->current_picture->avframe->data[comp]; for (i = 0; i < 4; i++) s->edge_emu_buffer[i] = s->edge_emu_buffer_base + i*FFALIGN(p->width, 16); if (!s->zero_res && !s->low_delay) { memset(p->idwt_buf, 0, p->idwt_stride * p->idwt_height * sizeof(IDWTELEM)); decode_component(s, comp); } ret = ff_spatial_idwt_init2(&d, p->idwt_buf, p->idwt_width, p->idwt_height, p->idwt_stride, s->wavelet_idx+2, s->wavelet_depth, p->idwt_tmp); if (ret < 0) return ret; if (!s->num_refs) { for (y = 0; y < p->height; y += 16) { ff_spatial_idwt_slice2(&d, y+16); s->diracdsp.put_signed_rect_clamped(frame + y*p->stride, p->stride, p->idwt_buf + y*p->idwt_stride, p->idwt_stride, p->width, 16); } } else { int rowheight = p->ybsep*p->stride; select_dsp_funcs(s, p->width, p->height, p->xblen, p->yblen); for (i = 0; i < s->num_refs; i++) interpolate_refplane(s, s->ref_pics[i], comp, p->width, p->height); memset(s->mctmp, 0, 4*p->yoffset*p->stride); dsty = -p->yoffset; for (y = 0; y < s->blheight; y++) { int h = 0, start = FFMAX(dsty, 0); uint16_t *mctmp = s->mctmp + y*rowheight; DiracBlock *blocks = s->blmotion + y*s->blwidth; init_obmc_weights(s, p, y); if (y == s->blheight-1 || start+p->ybsep > p->height) h = p->height - start; else h = p->ybsep - (start - dsty); if (h < 0) break; memset(mctmp+2*p->yoffset*p->stride, 0, 2*rowheight); mc_row(s, blocks, mctmp, comp, dsty); mctmp += (start - dsty)*p->stride + p->xoffset; ff_spatial_idwt_slice2(&d, start + h); s->diracdsp.add_rect_clamped(frame + start*p->stride, mctmp, p->stride, p->idwt_buf + start*p->idwt_stride, p->idwt_stride, p->width, h); dsty += p->ybsep; } } } return 0; }
{ "code": [ " for (i = 0; i < s->num_refs; i++)", " interpolate_refplane(s, s->ref_pics[i], comp, p->width, p->height);" ], "line_no": [ 95, 97 ] }
static int FUNC_0(DiracContext *VAR_0) { DWTContext d; int VAR_1, VAR_2, VAR_3, VAR_4; int VAR_5; if (VAR_0->low_delay) { for (VAR_3 = 0; VAR_3 < 3; VAR_3++) { Plane *p = &VAR_0->plane[VAR_3]; memset(p->idwt_buf, 0, p->idwt_stride * p->idwt_height * sizeof(IDWTELEM)); } if (!VAR_0->zero_res) { if ((VAR_5 = decode_lowdelay(VAR_0)) < 0) return VAR_5; } } for (VAR_3 = 0; VAR_3 < 3; VAR_3++) { Plane *p = &VAR_0->plane[VAR_3]; uint8_t *frame = VAR_0->current_picture->avframe->data[VAR_3]; for (VAR_2 = 0; VAR_2 < 4; VAR_2++) VAR_0->edge_emu_buffer[VAR_2] = VAR_0->edge_emu_buffer_base + VAR_2*FFALIGN(p->width, 16); if (!VAR_0->zero_res && !VAR_0->low_delay) { memset(p->idwt_buf, 0, p->idwt_stride * p->idwt_height * sizeof(IDWTELEM)); decode_component(VAR_0, VAR_3); } VAR_5 = ff_spatial_idwt_init2(&d, p->idwt_buf, p->idwt_width, p->idwt_height, p->idwt_stride, VAR_0->wavelet_idx+2, VAR_0->wavelet_depth, p->idwt_tmp); if (VAR_5 < 0) return VAR_5; if (!VAR_0->num_refs) { for (VAR_1 = 0; VAR_1 < p->height; VAR_1 += 16) { ff_spatial_idwt_slice2(&d, VAR_1+16); VAR_0->diracdsp.put_signed_rect_clamped(frame + VAR_1*p->stride, p->stride, p->idwt_buf + VAR_1*p->idwt_stride, p->idwt_stride, p->width, 16); } } else { int VAR_6 = p->ybsep*p->stride; select_dsp_funcs(VAR_0, p->width, p->height, p->xblen, p->yblen); for (VAR_2 = 0; VAR_2 < VAR_0->num_refs; VAR_2++) interpolate_refplane(VAR_0, VAR_0->ref_pics[VAR_2], VAR_3, p->width, p->height); memset(VAR_0->mctmp, 0, 4*p->yoffset*p->stride); VAR_4 = -p->yoffset; for (VAR_1 = 0; VAR_1 < VAR_0->blheight; VAR_1++) { int h = 0, start = FFMAX(VAR_4, 0); uint16_t *mctmp = VAR_0->mctmp + VAR_1*VAR_6; DiracBlock *blocks = VAR_0->blmotion + VAR_1*VAR_0->blwidth; init_obmc_weights(VAR_0, p, VAR_1); if (VAR_1 == VAR_0->blheight-1 || start+p->ybsep > p->height) h = p->height - start; else h = p->ybsep - (start - VAR_4); if (h < 0) break; memset(mctmp+2*p->yoffset*p->stride, 0, 2*VAR_6); mc_row(VAR_0, blocks, mctmp, VAR_3, VAR_4); mctmp += (start - VAR_4)*p->stride + p->xoffset; ff_spatial_idwt_slice2(&d, start + h); VAR_0->diracdsp.add_rect_clamped(frame + start*p->stride, mctmp, p->stride, p->idwt_buf + start*p->idwt_stride, p->idwt_stride, p->width, h); VAR_4 += p->ybsep; } } } return 0; }
[ "static int FUNC_0(DiracContext *VAR_0)\n{", "DWTContext d;", "int VAR_1, VAR_2, VAR_3, VAR_4;", "int VAR_5;", "if (VAR_0->low_delay) {", "for (VAR_3 = 0; VAR_3 < 3; VAR_3++) {", "Plane *p = &VAR_0->plane[VAR_3];", "memset(p->idwt_buf, 0, p->idwt_stride * p->idwt_height * sizeof(IDWTELEM));", "}", "if (!VAR_0->zero_res) {", "if ((VAR_5 = decode_lowdelay(VAR_0)) < 0)\nreturn VAR_5;", "}", "}", "for (VAR_3 = 0; VAR_3 < 3; VAR_3++) {", "Plane *p = &VAR_0->plane[VAR_3];", "uint8_t *frame = VAR_0->current_picture->avframe->data[VAR_3];", "for (VAR_2 = 0; VAR_2 < 4; VAR_2++)", "VAR_0->edge_emu_buffer[VAR_2] = VAR_0->edge_emu_buffer_base + VAR_2*FFALIGN(p->width, 16);", "if (!VAR_0->zero_res && !VAR_0->low_delay)\n{", "memset(p->idwt_buf, 0, p->idwt_stride * p->idwt_height * sizeof(IDWTELEM));", "decode_component(VAR_0, VAR_3);", "}", "VAR_5 = ff_spatial_idwt_init2(&d, p->idwt_buf, p->idwt_width, p->idwt_height, p->idwt_stride,\nVAR_0->wavelet_idx+2, VAR_0->wavelet_depth, p->idwt_tmp);", "if (VAR_5 < 0)\nreturn VAR_5;", "if (!VAR_0->num_refs) {", "for (VAR_1 = 0; VAR_1 < p->height; VAR_1 += 16) {", "ff_spatial_idwt_slice2(&d, VAR_1+16);", "VAR_0->diracdsp.put_signed_rect_clamped(frame + VAR_1*p->stride, p->stride,\np->idwt_buf + VAR_1*p->idwt_stride, p->idwt_stride, p->width, 16);", "}", "} else {", "int VAR_6 = p->ybsep*p->stride;", "select_dsp_funcs(VAR_0, p->width, p->height, p->xblen, p->yblen);", "for (VAR_2 = 0; VAR_2 < VAR_0->num_refs; VAR_2++)", "interpolate_refplane(VAR_0, VAR_0->ref_pics[VAR_2], VAR_3, p->width, p->height);", "memset(VAR_0->mctmp, 0, 4*p->yoffset*p->stride);", "VAR_4 = -p->yoffset;", "for (VAR_1 = 0; VAR_1 < VAR_0->blheight; VAR_1++) {", "int h = 0,\nstart = FFMAX(VAR_4, 0);", "uint16_t *mctmp = VAR_0->mctmp + VAR_1*VAR_6;", "DiracBlock *blocks = VAR_0->blmotion + VAR_1*VAR_0->blwidth;", "init_obmc_weights(VAR_0, p, VAR_1);", "if (VAR_1 == VAR_0->blheight-1 || start+p->ybsep > p->height)\nh = p->height - start;", "else\nh = p->ybsep - (start - VAR_4);", "if (h < 0)\nbreak;", "memset(mctmp+2*p->yoffset*p->stride, 0, 2*VAR_6);", "mc_row(VAR_0, blocks, mctmp, VAR_3, VAR_4);", "mctmp += (start - VAR_4)*p->stride + p->xoffset;", "ff_spatial_idwt_slice2(&d, start + h);", "VAR_0->diracdsp.add_rect_clamped(frame + start*p->stride, mctmp, p->stride,\np->idwt_buf + start*p->idwt_stride, p->idwt_stride, p->width, h);", "VAR_4 += p->ybsep;", "}", "}", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 47 ], [ 49 ], [ 53, 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63, 65 ], [ 67, 69 ], [ 73 ], [ 75 ], [ 77 ], [ 79, 81 ], [ 83 ], [ 85 ], [ 87 ], [ 91 ], [ 95 ], [ 97 ], [ 101 ], [ 105 ], [ 107 ], [ 109, 111 ], [ 113 ], [ 115 ], [ 119 ], [ 123, 125 ], [ 127, 129 ], [ 131, 133 ], [ 137 ], [ 139 ], [ 143 ], [ 145 ], [ 147, 149 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 165 ], [ 167 ] ]
12,005
static int mov_read_seek(AVFormatContext *s, int stream_index, int64_t sample_time, int flags) { MOVContext* mov = (MOVContext *) s->priv_data; MOVStreamContext* sc; int32_t i, a, b, m; int64_t start_time; int32_t seek_sample, sample; int32_t duration; int32_t count; int32_t chunk; int32_t left_in_chunk; int64_t chunk_file_offset; int64_t sample_file_offset; int32_t first_chunk_sample; int32_t sample_to_chunk_idx; int sample_to_time_index; long sample_to_time_sample = 0; uint64_t sample_to_time_time = 0; int mov_idx; // Find the corresponding mov stream for (mov_idx = 0; mov_idx < mov->total_streams; mov_idx++) if (mov->streams[mov_idx]->ffindex == stream_index) break; if (mov_idx == mov->total_streams) { av_log(s, AV_LOG_ERROR, "mov: requested stream was not found in mov streams (idx=%i)\n", stream_index); return -1; } sc = mov->streams[mov_idx]; sample_time *= s->streams[stream_index]->time_base.num; // Step 1. Find the edit that contains the requested time (elst) if (sc->edit_count && 0) { // FIXME should handle edit list av_log(s, AV_LOG_ERROR, "mov: does not handle seeking in files that contain edit list (c:%d)\n", sc->edit_count); return -1; } // Step 2. Find the corresponding sample using the Time-to-sample atom (stts) */ dprintf("Searching for time %li in stream #%i (time_scale=%i)\n", (long)sample_time, mov_idx, sc->time_scale); start_time = 0; // FIXME use elst atom sample = 1; // sample are 0 based in table for (i = 0; i < sc->stts_count; i++) { count = sc->stts_data[i].count; duration = sc->stts_data[i].duration; if ((start_time + count*duration) > sample_time) { sample_to_time_time = start_time; sample_to_time_index = i; sample_to_time_sample = sample; sample += (sample_time - start_time) / duration; break; } sample += count; start_time += count * duration; } sample_to_time_time = start_time; sample_to_time_index = i; /* NOTE: despite what qt doc say, the dt value (Display Time in qt vocabulary) computed with the stts atom is a decoding time stamp (dts) not a presentation time stamp. And as usual dts != pts for stream with b frames */ dprintf("Found time %li at sample #%u\n", (long)sample_time, sample); if (sample > sc->sample_count) { av_log(s, AV_LOG_ERROR, "mov: sample pos is too high, unable to seek (req. sample=%i, sample count=%ld)\n", sample, sc->sample_count); return -1; } // Step 3. Find the prior sync. sample using the Sync sample atom (stss) if (sc->keyframes) { a = 0; b = sc->keyframe_count - 1; while (a < b) { m = (a + b + 1) >> 1; if (sc->keyframes[m] > sample) { b = m - 1; } else { a = m; } } // for low latency prob: always use the previous keyframe, just uncomment the next line // if (a) a--; seek_sample = sc->keyframes[a]; } else seek_sample = sample; // else all samples are key frames dprintf("Found nearest keyframe at sample #%i \n", seek_sample); // Step 4. Find the chunk of the sample using the Sample-to-chunk-atom (stsc) for (first_chunk_sample = 1, i = 0; i < (sc->sample_to_chunk_sz - 1); i++) { b = (sc->sample_to_chunk[i + 1].first - sc->sample_to_chunk[i].first) * sc->sample_to_chunk[i].count; if (seek_sample >= first_chunk_sample && seek_sample < (first_chunk_sample + b)) break; first_chunk_sample += b; } chunk = sc->sample_to_chunk[i].first + (seek_sample - first_chunk_sample) / sc->sample_to_chunk[i].count; left_in_chunk = sc->sample_to_chunk[i].count - (seek_sample - first_chunk_sample) % sc->sample_to_chunk[i].count; first_chunk_sample += ((seek_sample - first_chunk_sample) / sc->sample_to_chunk[i].count) * sc->sample_to_chunk[i].count; sample_to_chunk_idx = i; dprintf("Sample was found in chunk #%i at sample offset %i (idx %i)\n", chunk, seek_sample - first_chunk_sample, sample_to_chunk_idx); // Step 5. Find the offset of the chunk using the chunk offset atom if (!sc->chunk_offsets) { av_log(s, AV_LOG_ERROR, "mov: no chunk offset atom, unable to seek\n"); return -1; } if (chunk > sc->chunk_count) { av_log(s, AV_LOG_ERROR, "mov: chunk offset atom too short, unable to seek (req. chunk=%i, chunk count=%li)\n", chunk, sc->chunk_count); return -1; } chunk_file_offset = sc->chunk_offsets[chunk - 1]; dprintf("Chunk file offset is #%"PRIu64"\n", chunk_file_offset); // Step 6. Find the byte offset within the chunk using the sample size atom sample_file_offset = chunk_file_offset; if (sc->sample_size) sample_file_offset += (seek_sample - first_chunk_sample) * sc->sample_size; else { for (i = 0; i < (seek_sample - first_chunk_sample); i++) { sample_file_offset += sc->sample_sizes[first_chunk_sample + i - 1]; } } dprintf("Sample file offset is #%"PRIu64"\n", sample_file_offset); // Step 6. Update the parser mov->partial = sc; mov->next_chunk_offset = sample_file_offset; // Update current stream state sc->current_sample = seek_sample - 1; // zero based sc->left_in_chunk = left_in_chunk; sc->next_chunk = chunk; // +1 -1 (zero based) sc->sample_to_chunk_index = sample_to_chunk_idx; // Update other streams for (i = 0; i<mov->total_streams; i++) { MOVStreamContext *msc; if (i == mov_idx) continue; // Find the nearest 'next' chunk msc = mov->streams[i]; a = 0; b = msc->chunk_count - 1; while (a < b) { m = (a + b + 1) >> 1; if (msc->chunk_offsets[m] > chunk_file_offset) { b = m - 1; } else { a = m; } } msc->next_chunk = a; if (msc->chunk_offsets[a] < chunk_file_offset && a < (msc->chunk_count-1)) msc->next_chunk ++; dprintf("Nearest next chunk for stream #%i is #%li @%"PRId64"\n", i, msc->next_chunk+1, msc->chunk_offsets[msc->next_chunk]); // Compute sample count and index in the sample_to_chunk table (what a pity) msc->sample_to_chunk_index = 0; msc->current_sample = 0; for(; msc->sample_to_chunk_index < (msc->sample_to_chunk_sz - 1) && msc->sample_to_chunk[msc->sample_to_chunk_index + 1].first <= (1 + msc->next_chunk); msc->sample_to_chunk_index++) { msc->current_sample += (msc->sample_to_chunk[msc->sample_to_chunk_index + 1].first - msc->sample_to_chunk[msc->sample_to_chunk_index].first) \ * msc->sample_to_chunk[msc->sample_to_chunk_index].count; } msc->current_sample += (msc->next_chunk - (msc->sample_to_chunk[msc->sample_to_chunk_index].first - 1)) * sc->sample_to_chunk[msc->sample_to_chunk_index].count; msc->left_in_chunk = msc->sample_to_chunk[msc->sample_to_chunk_index].count - 1; // Find corresponding position in stts (used later to compute dts) sample = 0; start_time = 0; for (msc->sample_to_time_index = 0; msc->sample_to_time_index < msc->stts_count; msc->sample_to_time_index++) { count = msc->stts_data[msc->sample_to_time_index].count; duration = msc->stts_data[msc->sample_to_time_index].duration; if ((sample + count - 1) > msc->current_sample) { msc->sample_to_time_time = start_time; msc->sample_to_time_sample = sample; break; } sample += count; start_time += count * duration; } sample = 0; for (msc->sample_to_ctime_index = 0; msc->sample_to_ctime_index < msc->ctts_count; msc->sample_to_ctime_index++) { count = msc->ctts_data[msc->sample_to_ctime_index].count; duration = msc->ctts_data[msc->sample_to_ctime_index].duration; if ((sample + count - 1) > msc->current_sample) { msc->sample_to_ctime_sample = sample; break; } sample += count; } dprintf("Next Sample for stream #%i is #%li @%li\n", i, msc->current_sample + 1, msc->sample_to_chunk_index + 1); } return 0; }
false
FFmpeg
c7e63546dc38616eb04a2d463170b3c247556149
static int mov_read_seek(AVFormatContext *s, int stream_index, int64_t sample_time, int flags) { MOVContext* mov = (MOVContext *) s->priv_data; MOVStreamContext* sc; int32_t i, a, b, m; int64_t start_time; int32_t seek_sample, sample; int32_t duration; int32_t count; int32_t chunk; int32_t left_in_chunk; int64_t chunk_file_offset; int64_t sample_file_offset; int32_t first_chunk_sample; int32_t sample_to_chunk_idx; int sample_to_time_index; long sample_to_time_sample = 0; uint64_t sample_to_time_time = 0; int mov_idx; for (mov_idx = 0; mov_idx < mov->total_streams; mov_idx++) if (mov->streams[mov_idx]->ffindex == stream_index) break; if (mov_idx == mov->total_streams) { av_log(s, AV_LOG_ERROR, "mov: requested stream was not found in mov streams (idx=%i)\n", stream_index); return -1; } sc = mov->streams[mov_idx]; sample_time *= s->streams[stream_index]->time_base.num; if (sc->edit_count && 0) { av_log(s, AV_LOG_ERROR, "mov: does not handle seeking in files that contain edit list (c:%d)\n", sc->edit_count); return -1; } dprintf("Searching for time %li in stream #%i (time_scale=%i)\n", (long)sample_time, mov_idx, sc->time_scale); start_time = 0; sample = 1; for (i = 0; i < sc->stts_count; i++) { count = sc->stts_data[i].count; duration = sc->stts_data[i].duration; if ((start_time + count*duration) > sample_time) { sample_to_time_time = start_time; sample_to_time_index = i; sample_to_time_sample = sample; sample += (sample_time - start_time) / duration; break; } sample += count; start_time += count * duration; } sample_to_time_time = start_time; sample_to_time_index = i; dprintf("Found time %li at sample #%u\n", (long)sample_time, sample); if (sample > sc->sample_count) { av_log(s, AV_LOG_ERROR, "mov: sample pos is too high, unable to seek (req. sample=%i, sample count=%ld)\n", sample, sc->sample_count); return -1; } if (sc->keyframes) { a = 0; b = sc->keyframe_count - 1; while (a < b) { m = (a + b + 1) >> 1; if (sc->keyframes[m] > sample) { b = m - 1; } else { a = m; } } seek_sample = sc->keyframes[a]; } else seek_sample = sample; dprintf("Found nearest keyframe at sample #%i \n", seek_sample); for (first_chunk_sample = 1, i = 0; i < (sc->sample_to_chunk_sz - 1); i++) { b = (sc->sample_to_chunk[i + 1].first - sc->sample_to_chunk[i].first) * sc->sample_to_chunk[i].count; if (seek_sample >= first_chunk_sample && seek_sample < (first_chunk_sample + b)) break; first_chunk_sample += b; } chunk = sc->sample_to_chunk[i].first + (seek_sample - first_chunk_sample) / sc->sample_to_chunk[i].count; left_in_chunk = sc->sample_to_chunk[i].count - (seek_sample - first_chunk_sample) % sc->sample_to_chunk[i].count; first_chunk_sample += ((seek_sample - first_chunk_sample) / sc->sample_to_chunk[i].count) * sc->sample_to_chunk[i].count; sample_to_chunk_idx = i; dprintf("Sample was found in chunk #%i at sample offset %i (idx %i)\n", chunk, seek_sample - first_chunk_sample, sample_to_chunk_idx); if (!sc->chunk_offsets) { av_log(s, AV_LOG_ERROR, "mov: no chunk offset atom, unable to seek\n"); return -1; } if (chunk > sc->chunk_count) { av_log(s, AV_LOG_ERROR, "mov: chunk offset atom too short, unable to seek (req. chunk=%i, chunk count=%li)\n", chunk, sc->chunk_count); return -1; } chunk_file_offset = sc->chunk_offsets[chunk - 1]; dprintf("Chunk file offset is #%"PRIu64"\n", chunk_file_offset); sample_file_offset = chunk_file_offset; if (sc->sample_size) sample_file_offset += (seek_sample - first_chunk_sample) * sc->sample_size; else { for (i = 0; i < (seek_sample - first_chunk_sample); i++) { sample_file_offset += sc->sample_sizes[first_chunk_sample + i - 1]; } } dprintf("Sample file offset is #%"PRIu64"\n", sample_file_offset); mov->partial = sc; mov->next_chunk_offset = sample_file_offset; sc->current_sample = seek_sample - 1; sc->left_in_chunk = left_in_chunk; sc->next_chunk = chunk; sc->sample_to_chunk_index = sample_to_chunk_idx; for (i = 0; i<mov->total_streams; i++) { MOVStreamContext *msc; if (i == mov_idx) continue; msc = mov->streams[i]; a = 0; b = msc->chunk_count - 1; while (a < b) { m = (a + b + 1) >> 1; if (msc->chunk_offsets[m] > chunk_file_offset) { b = m - 1; } else { a = m; } } msc->next_chunk = a; if (msc->chunk_offsets[a] < chunk_file_offset && a < (msc->chunk_count-1)) msc->next_chunk ++; dprintf("Nearest next chunk for stream #%i is #%li @%"PRId64"\n", i, msc->next_chunk+1, msc->chunk_offsets[msc->next_chunk]); msc->sample_to_chunk_index = 0; msc->current_sample = 0; for(; msc->sample_to_chunk_index < (msc->sample_to_chunk_sz - 1) && msc->sample_to_chunk[msc->sample_to_chunk_index + 1].first <= (1 + msc->next_chunk); msc->sample_to_chunk_index++) { msc->current_sample += (msc->sample_to_chunk[msc->sample_to_chunk_index + 1].first - msc->sample_to_chunk[msc->sample_to_chunk_index].first) \ * msc->sample_to_chunk[msc->sample_to_chunk_index].count; } msc->current_sample += (msc->next_chunk - (msc->sample_to_chunk[msc->sample_to_chunk_index].first - 1)) * sc->sample_to_chunk[msc->sample_to_chunk_index].count; msc->left_in_chunk = msc->sample_to_chunk[msc->sample_to_chunk_index].count - 1; sample = 0; start_time = 0; for (msc->sample_to_time_index = 0; msc->sample_to_time_index < msc->stts_count; msc->sample_to_time_index++) { count = msc->stts_data[msc->sample_to_time_index].count; duration = msc->stts_data[msc->sample_to_time_index].duration; if ((sample + count - 1) > msc->current_sample) { msc->sample_to_time_time = start_time; msc->sample_to_time_sample = sample; break; } sample += count; start_time += count * duration; } sample = 0; for (msc->sample_to_ctime_index = 0; msc->sample_to_ctime_index < msc->ctts_count; msc->sample_to_ctime_index++) { count = msc->ctts_data[msc->sample_to_ctime_index].count; duration = msc->ctts_data[msc->sample_to_ctime_index].duration; if ((sample + count - 1) > msc->current_sample) { msc->sample_to_ctime_sample = sample; break; } sample += count; } dprintf("Next Sample for stream #%i is #%li @%li\n", i, msc->current_sample + 1, msc->sample_to_chunk_index + 1); } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0, int VAR_1, int64_t VAR_2, int VAR_3) { MOVContext* mov = (MOVContext *) VAR_0->priv_data; MOVStreamContext* sc; int32_t i, a, b, m; int64_t start_time; int32_t seek_sample, sample; int32_t duration; int32_t count; int32_t chunk; int32_t left_in_chunk; int64_t chunk_file_offset; int64_t sample_file_offset; int32_t first_chunk_sample; int32_t sample_to_chunk_idx; int VAR_4; long VAR_5 = 0; uint64_t sample_to_time_time = 0; int VAR_6; for (VAR_6 = 0; VAR_6 < mov->total_streams; VAR_6++) if (mov->streams[VAR_6]->ffindex == VAR_1) break; if (VAR_6 == mov->total_streams) { av_log(VAR_0, AV_LOG_ERROR, "mov: requested stream was not found in mov streams (idx=%i)\n", VAR_1); return -1; } sc = mov->streams[VAR_6]; VAR_2 *= VAR_0->streams[VAR_1]->time_base.num; if (sc->edit_count && 0) { av_log(VAR_0, AV_LOG_ERROR, "mov: does not handle seeking in files that contain edit list (c:%d)\n", sc->edit_count); return -1; } dprintf("Searching for time %li in stream #%i (time_scale=%i)\n", (long)VAR_2, VAR_6, sc->time_scale); start_time = 0; sample = 1; for (i = 0; i < sc->stts_count; i++) { count = sc->stts_data[i].count; duration = sc->stts_data[i].duration; if ((start_time + count*duration) > VAR_2) { sample_to_time_time = start_time; VAR_4 = i; VAR_5 = sample; sample += (VAR_2 - start_time) / duration; break; } sample += count; start_time += count * duration; } sample_to_time_time = start_time; VAR_4 = i; dprintf("Found time %li at sample #%u\n", (long)VAR_2, sample); if (sample > sc->sample_count) { av_log(VAR_0, AV_LOG_ERROR, "mov: sample pos is too high, unable to seek (req. sample=%i, sample count=%ld)\n", sample, sc->sample_count); return -1; } if (sc->keyframes) { a = 0; b = sc->keyframe_count - 1; while (a < b) { m = (a + b + 1) >> 1; if (sc->keyframes[m] > sample) { b = m - 1; } else { a = m; } } seek_sample = sc->keyframes[a]; } else seek_sample = sample; dprintf("Found nearest keyframe at sample #%i \n", seek_sample); for (first_chunk_sample = 1, i = 0; i < (sc->sample_to_chunk_sz - 1); i++) { b = (sc->sample_to_chunk[i + 1].first - sc->sample_to_chunk[i].first) * sc->sample_to_chunk[i].count; if (seek_sample >= first_chunk_sample && seek_sample < (first_chunk_sample + b)) break; first_chunk_sample += b; } chunk = sc->sample_to_chunk[i].first + (seek_sample - first_chunk_sample) / sc->sample_to_chunk[i].count; left_in_chunk = sc->sample_to_chunk[i].count - (seek_sample - first_chunk_sample) % sc->sample_to_chunk[i].count; first_chunk_sample += ((seek_sample - first_chunk_sample) / sc->sample_to_chunk[i].count) * sc->sample_to_chunk[i].count; sample_to_chunk_idx = i; dprintf("Sample was found in chunk #%i at sample offset %i (idx %i)\n", chunk, seek_sample - first_chunk_sample, sample_to_chunk_idx); if (!sc->chunk_offsets) { av_log(VAR_0, AV_LOG_ERROR, "mov: no chunk offset atom, unable to seek\n"); return -1; } if (chunk > sc->chunk_count) { av_log(VAR_0, AV_LOG_ERROR, "mov: chunk offset atom too short, unable to seek (req. chunk=%i, chunk count=%li)\n", chunk, sc->chunk_count); return -1; } chunk_file_offset = sc->chunk_offsets[chunk - 1]; dprintf("Chunk file offset is #%"PRIu64"\n", chunk_file_offset); sample_file_offset = chunk_file_offset; if (sc->sample_size) sample_file_offset += (seek_sample - first_chunk_sample) * sc->sample_size; else { for (i = 0; i < (seek_sample - first_chunk_sample); i++) { sample_file_offset += sc->sample_sizes[first_chunk_sample + i - 1]; } } dprintf("Sample file offset is #%"PRIu64"\n", sample_file_offset); mov->partial = sc; mov->next_chunk_offset = sample_file_offset; sc->current_sample = seek_sample - 1; sc->left_in_chunk = left_in_chunk; sc->next_chunk = chunk; sc->sample_to_chunk_index = sample_to_chunk_idx; for (i = 0; i<mov->total_streams; i++) { MOVStreamContext *msc; if (i == VAR_6) continue; msc = mov->streams[i]; a = 0; b = msc->chunk_count - 1; while (a < b) { m = (a + b + 1) >> 1; if (msc->chunk_offsets[m] > chunk_file_offset) { b = m - 1; } else { a = m; } } msc->next_chunk = a; if (msc->chunk_offsets[a] < chunk_file_offset && a < (msc->chunk_count-1)) msc->next_chunk ++; dprintf("Nearest next chunk for stream #%i is #%li @%"PRId64"\n", i, msc->next_chunk+1, msc->chunk_offsets[msc->next_chunk]); msc->sample_to_chunk_index = 0; msc->current_sample = 0; for(; msc->sample_to_chunk_index < (msc->sample_to_chunk_sz - 1) && msc->sample_to_chunk[msc->sample_to_chunk_index + 1].first <= (1 + msc->next_chunk); msc->sample_to_chunk_index++) { msc->current_sample += (msc->sample_to_chunk[msc->sample_to_chunk_index + 1].first - msc->sample_to_chunk[msc->sample_to_chunk_index].first) \ * msc->sample_to_chunk[msc->sample_to_chunk_index].count; } msc->current_sample += (msc->next_chunk - (msc->sample_to_chunk[msc->sample_to_chunk_index].first - 1)) * sc->sample_to_chunk[msc->sample_to_chunk_index].count; msc->left_in_chunk = msc->sample_to_chunk[msc->sample_to_chunk_index].count - 1; sample = 0; start_time = 0; for (msc->VAR_4 = 0; msc->VAR_4 < msc->stts_count; msc->VAR_4++) { count = msc->stts_data[msc->VAR_4].count; duration = msc->stts_data[msc->VAR_4].duration; if ((sample + count - 1) > msc->current_sample) { msc->sample_to_time_time = start_time; msc->VAR_5 = sample; break; } sample += count; start_time += count * duration; } sample = 0; for (msc->sample_to_ctime_index = 0; msc->sample_to_ctime_index < msc->ctts_count; msc->sample_to_ctime_index++) { count = msc->ctts_data[msc->sample_to_ctime_index].count; duration = msc->ctts_data[msc->sample_to_ctime_index].duration; if ((sample + count - 1) > msc->current_sample) { msc->sample_to_ctime_sample = sample; break; } sample += count; } dprintf("Next Sample for stream #%i is #%li @%li\n", i, msc->current_sample + 1, msc->sample_to_chunk_index + 1); } return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0, int VAR_1, int64_t VAR_2, int VAR_3)\n{", "MOVContext* mov = (MOVContext *) VAR_0->priv_data;", "MOVStreamContext* sc;", "int32_t i, a, b, m;", "int64_t start_time;", "int32_t seek_sample, sample;", "int32_t duration;", "int32_t count;", "int32_t chunk;", "int32_t left_in_chunk;", "int64_t chunk_file_offset;", "int64_t sample_file_offset;", "int32_t first_chunk_sample;", "int32_t sample_to_chunk_idx;", "int VAR_4;", "long VAR_5 = 0;", "uint64_t sample_to_time_time = 0;", "int VAR_6;", "for (VAR_6 = 0; VAR_6 < mov->total_streams; VAR_6++)", "if (mov->streams[VAR_6]->ffindex == VAR_1)\nbreak;", "if (VAR_6 == mov->total_streams) {", "av_log(VAR_0, AV_LOG_ERROR, \"mov: requested stream was not found in mov streams (idx=%i)\\n\", VAR_1);", "return -1;", "}", "sc = mov->streams[VAR_6];", "VAR_2 *= VAR_0->streams[VAR_1]->time_base.num;", "if (sc->edit_count && 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"mov: does not handle seeking in files that contain edit list (c:%d)\\n\", sc->edit_count);", "return -1;", "}", "dprintf(\"Searching for time %li in stream #%i (time_scale=%i)\\n\", (long)VAR_2, VAR_6, sc->time_scale);", "start_time = 0;", "sample = 1;", "for (i = 0; i < sc->stts_count; i++) {", "count = sc->stts_data[i].count;", "duration = sc->stts_data[i].duration;", "if ((start_time + count*duration) > VAR_2) {", "sample_to_time_time = start_time;", "VAR_4 = i;", "VAR_5 = sample;", "sample += (VAR_2 - start_time) / duration;", "break;", "}", "sample += count;", "start_time += count * duration;", "}", "sample_to_time_time = start_time;", "VAR_4 = i;", "dprintf(\"Found time %li at sample #%u\\n\", (long)VAR_2, sample);", "if (sample > sc->sample_count) {", "av_log(VAR_0, AV_LOG_ERROR, \"mov: sample pos is too high, unable to seek (req. sample=%i, sample count=%ld)\\n\", sample, sc->sample_count);", "return -1;", "}", "if (sc->keyframes) {", "a = 0;", "b = sc->keyframe_count - 1;", "while (a < b) {", "m = (a + b + 1) >> 1;", "if (sc->keyframes[m] > sample) {", "b = m - 1;", "} else {", "a = m;", "}", "}", "seek_sample = sc->keyframes[a];", "}", "else\nseek_sample = sample;", "dprintf(\"Found nearest keyframe at sample #%i \\n\", seek_sample);", "for (first_chunk_sample = 1, i = 0; i < (sc->sample_to_chunk_sz - 1); i++) {", "b = (sc->sample_to_chunk[i + 1].first - sc->sample_to_chunk[i].first) * sc->sample_to_chunk[i].count;", "if (seek_sample >= first_chunk_sample && seek_sample < (first_chunk_sample + b))\nbreak;", "first_chunk_sample += b;", "}", "chunk = sc->sample_to_chunk[i].first + (seek_sample - first_chunk_sample) / sc->sample_to_chunk[i].count;", "left_in_chunk = sc->sample_to_chunk[i].count - (seek_sample - first_chunk_sample) % sc->sample_to_chunk[i].count;", "first_chunk_sample += ((seek_sample - first_chunk_sample) / sc->sample_to_chunk[i].count) * sc->sample_to_chunk[i].count;", "sample_to_chunk_idx = i;", "dprintf(\"Sample was found in chunk #%i at sample offset %i (idx %i)\\n\", chunk, seek_sample - first_chunk_sample, sample_to_chunk_idx);", "if (!sc->chunk_offsets) {", "av_log(VAR_0, AV_LOG_ERROR, \"mov: no chunk offset atom, unable to seek\\n\");", "return -1;", "}", "if (chunk > sc->chunk_count) {", "av_log(VAR_0, AV_LOG_ERROR, \"mov: chunk offset atom too short, unable to seek (req. chunk=%i, chunk count=%li)\\n\", chunk, sc->chunk_count);", "return -1;", "}", "chunk_file_offset = sc->chunk_offsets[chunk - 1];", "dprintf(\"Chunk file offset is #%\"PRIu64\"\\n\", chunk_file_offset);", "sample_file_offset = chunk_file_offset;", "if (sc->sample_size)\nsample_file_offset += (seek_sample - first_chunk_sample) * sc->sample_size;", "else {", "for (i = 0; i < (seek_sample - first_chunk_sample); i++) {", "sample_file_offset += sc->sample_sizes[first_chunk_sample + i - 1];", "}", "}", "dprintf(\"Sample file offset is #%\"PRIu64\"\\n\", sample_file_offset);", "mov->partial = sc;", "mov->next_chunk_offset = sample_file_offset;", "sc->current_sample = seek_sample - 1;", "sc->left_in_chunk = left_in_chunk;", "sc->next_chunk = chunk;", "sc->sample_to_chunk_index = sample_to_chunk_idx;", "for (i = 0; i<mov->total_streams; i++) {", "MOVStreamContext *msc;", "if (i == VAR_6) continue;", "msc = mov->streams[i];", "a = 0;", "b = msc->chunk_count - 1;", "while (a < b) {", "m = (a + b + 1) >> 1;", "if (msc->chunk_offsets[m] > chunk_file_offset) {", "b = m - 1;", "} else {", "a = m;", "}", "}", "msc->next_chunk = a;", "if (msc->chunk_offsets[a] < chunk_file_offset && a < (msc->chunk_count-1))\nmsc->next_chunk ++;", "dprintf(\"Nearest next chunk for stream #%i is #%li @%\"PRId64\"\\n\", i, msc->next_chunk+1, msc->chunk_offsets[msc->next_chunk]);", "msc->sample_to_chunk_index = 0;", "msc->current_sample = 0;", "for(; msc->sample_to_chunk_index < (msc->sample_to_chunk_sz - 1)", "&& msc->sample_to_chunk[msc->sample_to_chunk_index + 1].first <= (1 + msc->next_chunk); msc->sample_to_chunk_index++) {", "msc->current_sample += (msc->sample_to_chunk[msc->sample_to_chunk_index + 1].first - msc->sample_to_chunk[msc->sample_to_chunk_index].first) \\\n* msc->sample_to_chunk[msc->sample_to_chunk_index].count;", "}", "msc->current_sample += (msc->next_chunk - (msc->sample_to_chunk[msc->sample_to_chunk_index].first - 1)) * sc->sample_to_chunk[msc->sample_to_chunk_index].count;", "msc->left_in_chunk = msc->sample_to_chunk[msc->sample_to_chunk_index].count - 1;", "sample = 0;", "start_time = 0;", "for (msc->VAR_4 = 0; msc->VAR_4 < msc->stts_count; msc->VAR_4++) {", "count = msc->stts_data[msc->VAR_4].count;", "duration = msc->stts_data[msc->VAR_4].duration;", "if ((sample + count - 1) > msc->current_sample) {", "msc->sample_to_time_time = start_time;", "msc->VAR_5 = sample;", "break;", "}", "sample += count;", "start_time += count * duration;", "}", "sample = 0;", "for (msc->sample_to_ctime_index = 0; msc->sample_to_ctime_index < msc->ctts_count; msc->sample_to_ctime_index++) {", "count = msc->ctts_data[msc->sample_to_ctime_index].count;", "duration = msc->ctts_data[msc->sample_to_ctime_index].duration;", "if ((sample + count - 1) > msc->current_sample) {", "msc->sample_to_ctime_sample = sample;", "break;", "}", "sample += count;", "}", "dprintf(\"Next Sample for stream #%i is #%li @%li\\n\", i, msc->current_sample + 1, msc->sample_to_chunk_index + 1);", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 43 ], [ 45, 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 81 ], [ 83 ], [ 85 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 165 ], [ 167 ], [ 169, 171 ], [ 173 ], [ 179 ], [ 181 ], [ 183, 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 229 ], [ 231, 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 251 ], [ 253 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 269 ], [ 271 ], [ 273 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ], [ 291 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 301, 303 ], [ 305 ], [ 311 ], [ 313 ], [ 315 ], [ 317 ], [ 319, 321 ], [ 323 ], [ 325 ], [ 327 ], [ 331 ], [ 333 ], [ 335 ], [ 337 ], [ 339 ], [ 341 ], [ 343 ], [ 345 ], [ 347 ], [ 349 ], [ 351 ], [ 353 ], [ 355 ], [ 357 ], [ 359 ], [ 361 ], [ 363 ], [ 365 ], [ 367 ], [ 369 ], [ 371 ], [ 373 ], [ 375 ], [ 377 ], [ 379 ], [ 381 ], [ 383 ] ]
12,007
static always_inline int dv_rl2vlc_size(int run, int l) { int level = (l ^ (l >> 8)) - (l >> 8); int size; if (run < DV_VLC_MAP_RUN_SIZE && level < DV_VLC_MAP_LEV_SIZE) { size = dv_vlc_map[run][level].size; } else { size = (level < DV_VLC_MAP_LEV_SIZE) ? dv_vlc_map[0][level].size : 16; if (run) { size += (run < 16) ? dv_vlc_map[run-1][0].size : 13; } } return size; }
false
FFmpeg
c619ff6daf93a8f3c03decf2d3345d2474c3db91
static always_inline int dv_rl2vlc_size(int run, int l) { int level = (l ^ (l >> 8)) - (l >> 8); int size; if (run < DV_VLC_MAP_RUN_SIZE && level < DV_VLC_MAP_LEV_SIZE) { size = dv_vlc_map[run][level].size; } else { size = (level < DV_VLC_MAP_LEV_SIZE) ? dv_vlc_map[0][level].size : 16; if (run) { size += (run < 16) ? dv_vlc_map[run-1][0].size : 13; } } return size; }
{ "code": [], "line_no": [] }
static always_inline int FUNC_0(int run, int l) { int VAR_0 = (l ^ (l >> 8)) - (l >> 8); int VAR_1; if (run < DV_VLC_MAP_RUN_SIZE && VAR_0 < DV_VLC_MAP_LEV_SIZE) { VAR_1 = dv_vlc_map[run][VAR_0].VAR_1; } else { VAR_1 = (VAR_0 < DV_VLC_MAP_LEV_SIZE) ? dv_vlc_map[0][VAR_0].VAR_1 : 16; if (run) { VAR_1 += (run < 16) ? dv_vlc_map[run-1][0].VAR_1 : 13; } } return VAR_1; }
[ "static always_inline int FUNC_0(int run, int l)\n{", "int VAR_0 = (l ^ (l >> 8)) - (l >> 8);", "int VAR_1;", "if (run < DV_VLC_MAP_RUN_SIZE && VAR_0 < DV_VLC_MAP_LEV_SIZE) {", "VAR_1 = dv_vlc_map[run][VAR_0].VAR_1;", "}", "else {", "VAR_1 = (VAR_0 < DV_VLC_MAP_LEV_SIZE) ? dv_vlc_map[0][VAR_0].VAR_1 : 16;", "if (run) {", "VAR_1 += (run < 16) ? dv_vlc_map[run-1][0].VAR_1 : 13;", "}", "}", "return VAR_1;", "}" ]
[ 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 ] ]
12,008
static int dxtory_decode_v2_444(AVCodecContext *avctx, AVFrame *pic, const uint8_t *src, int src_size) { GetByteContext gb; GetBitContext gb2; int nslices, slice, slice_height; uint32_t off, slice_size; uint8_t *Y, *U, *V; int ret; bytestream2_init(&gb, src, src_size); nslices = bytestream2_get_le16(&gb); off = FFALIGN(nslices * 4 + 2, 16); if (src_size < off) { av_log(avctx, AV_LOG_ERROR, "no slice data\n"); return AVERROR_INVALIDDATA; } if (!nslices || avctx->height % nslices) { avpriv_request_sample(avctx, "%d slices for %dx%d", nslices, avctx->width, avctx->height); return AVERROR_PATCHWELCOME; } slice_height = avctx->height / nslices; avctx->pix_fmt = AV_PIX_FMT_YUV444P; if ((ret = ff_get_buffer(avctx, pic, 0)) < 0) return ret; Y = pic->data[0]; U = pic->data[1]; V = pic->data[2]; for (slice = 0; slice < nslices; slice++) { slice_size = bytestream2_get_le32(&gb); ret = check_slice_size(avctx, src, src_size, slice_size, off); if (ret < 0) return ret; init_get_bits(&gb2, src + off + 16, (slice_size - 16) * 8); dx2_decode_slice_444(&gb2, avctx->width, slice_height, Y, U, V, pic->linesize[0], pic->linesize[1], pic->linesize[2]); Y += pic->linesize[0] * slice_height; U += pic->linesize[1] * slice_height; V += pic->linesize[2] * slice_height; off += slice_size; } return 0; }
false
FFmpeg
a7e6fbd90e62d3320b1e26d8209fc0f55ee5b0be
static int dxtory_decode_v2_444(AVCodecContext *avctx, AVFrame *pic, const uint8_t *src, int src_size) { GetByteContext gb; GetBitContext gb2; int nslices, slice, slice_height; uint32_t off, slice_size; uint8_t *Y, *U, *V; int ret; bytestream2_init(&gb, src, src_size); nslices = bytestream2_get_le16(&gb); off = FFALIGN(nslices * 4 + 2, 16); if (src_size < off) { av_log(avctx, AV_LOG_ERROR, "no slice data\n"); return AVERROR_INVALIDDATA; } if (!nslices || avctx->height % nslices) { avpriv_request_sample(avctx, "%d slices for %dx%d", nslices, avctx->width, avctx->height); return AVERROR_PATCHWELCOME; } slice_height = avctx->height / nslices; avctx->pix_fmt = AV_PIX_FMT_YUV444P; if ((ret = ff_get_buffer(avctx, pic, 0)) < 0) return ret; Y = pic->data[0]; U = pic->data[1]; V = pic->data[2]; for (slice = 0; slice < nslices; slice++) { slice_size = bytestream2_get_le32(&gb); ret = check_slice_size(avctx, src, src_size, slice_size, off); if (ret < 0) return ret; init_get_bits(&gb2, src + off + 16, (slice_size - 16) * 8); dx2_decode_slice_444(&gb2, avctx->width, slice_height, Y, U, V, pic->linesize[0], pic->linesize[1], pic->linesize[2]); Y += pic->linesize[0] * slice_height; U += pic->linesize[1] * slice_height; V += pic->linesize[2] * slice_height; off += slice_size; } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, AVFrame *VAR_1, const uint8_t *VAR_2, int VAR_3) { GetByteContext gb; GetBitContext gb2; int VAR_4, VAR_5, VAR_6; uint32_t off, slice_size; uint8_t *Y, *U, *V; int VAR_7; bytestream2_init(&gb, VAR_2, VAR_3); VAR_4 = bytestream2_get_le16(&gb); off = FFALIGN(VAR_4 * 4 + 2, 16); if (VAR_3 < off) { av_log(VAR_0, AV_LOG_ERROR, "no VAR_5 data\n"); return AVERROR_INVALIDDATA; } if (!VAR_4 || VAR_0->height % VAR_4) { avpriv_request_sample(VAR_0, "%d slices for %dx%d", VAR_4, VAR_0->width, VAR_0->height); return AVERROR_PATCHWELCOME; } VAR_6 = VAR_0->height / VAR_4; VAR_0->pix_fmt = AV_PIX_FMT_YUV444P; if ((VAR_7 = ff_get_buffer(VAR_0, VAR_1, 0)) < 0) return VAR_7; Y = VAR_1->data[0]; U = VAR_1->data[1]; V = VAR_1->data[2]; for (VAR_5 = 0; VAR_5 < VAR_4; VAR_5++) { slice_size = bytestream2_get_le32(&gb); VAR_7 = check_slice_size(VAR_0, VAR_2, VAR_3, slice_size, off); if (VAR_7 < 0) return VAR_7; init_get_bits(&gb2, VAR_2 + off + 16, (slice_size - 16) * 8); dx2_decode_slice_444(&gb2, VAR_0->width, VAR_6, Y, U, V, VAR_1->linesize[0], VAR_1->linesize[1], VAR_1->linesize[2]); Y += VAR_1->linesize[0] * VAR_6; U += VAR_1->linesize[1] * VAR_6; V += VAR_1->linesize[2] * VAR_6; off += slice_size; } return 0; }
[ "static int FUNC_0(AVCodecContext *VAR_0, AVFrame *VAR_1,\nconst uint8_t *VAR_2, int VAR_3)\n{", "GetByteContext gb;", "GetBitContext gb2;", "int VAR_4, VAR_5, VAR_6;", "uint32_t off, slice_size;", "uint8_t *Y, *U, *V;", "int VAR_7;", "bytestream2_init(&gb, VAR_2, VAR_3);", "VAR_4 = bytestream2_get_le16(&gb);", "off = FFALIGN(VAR_4 * 4 + 2, 16);", "if (VAR_3 < off) {", "av_log(VAR_0, AV_LOG_ERROR, \"no VAR_5 data\\n\");", "return AVERROR_INVALIDDATA;", "}", "if (!VAR_4 || VAR_0->height % VAR_4) {", "avpriv_request_sample(VAR_0, \"%d slices for %dx%d\", VAR_4,\nVAR_0->width, VAR_0->height);", "return AVERROR_PATCHWELCOME;", "}", "VAR_6 = VAR_0->height / VAR_4;", "VAR_0->pix_fmt = AV_PIX_FMT_YUV444P;", "if ((VAR_7 = ff_get_buffer(VAR_0, VAR_1, 0)) < 0)\nreturn VAR_7;", "Y = VAR_1->data[0];", "U = VAR_1->data[1];", "V = VAR_1->data[2];", "for (VAR_5 = 0; VAR_5 < VAR_4; VAR_5++) {", "slice_size = bytestream2_get_le32(&gb);", "VAR_7 = check_slice_size(VAR_0, VAR_2, VAR_3, slice_size, off);", "if (VAR_7 < 0)\nreturn VAR_7;", "init_get_bits(&gb2, VAR_2 + off + 16, (slice_size - 16) * 8);", "dx2_decode_slice_444(&gb2, VAR_0->width, VAR_6, Y, U, V,\nVAR_1->linesize[0], VAR_1->linesize[1],\nVAR_1->linesize[2]);", "Y += VAR_1->linesize[0] * VAR_6;", "U += VAR_1->linesize[1] * VAR_6;", "V += VAR_1->linesize[2] * VAR_6;", "off += slice_size;", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 49 ], [ 53 ], [ 55, 57 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ], [ 75 ], [ 77, 79 ], [ 83 ], [ 85, 87, 89 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 105 ], [ 107 ] ]
12,009
int ff_nvenc_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet) { NVENCSTATUS nv_status; CUresult cu_res; CUcontext dummy; NvencSurface *tmpoutsurf, *inSurf; int res; NvencContext *ctx = avctx->priv_data; NvencDynLoadFunctions *dl_fn = &ctx->nvenc_dload_funcs; NV_ENCODE_API_FUNCTION_LIST *p_nvenc = &dl_fn->nvenc_funcs; NV_ENC_PIC_PARAMS pic_params = { 0 }; pic_params.version = NV_ENC_PIC_PARAMS_VER; if (frame) { inSurf = get_free_frame(ctx); if (!inSurf) { av_log(avctx, AV_LOG_ERROR, "No free surfaces\n"); return AVERROR_BUG; } cu_res = dl_fn->cuda_dl->cuCtxPushCurrent(ctx->cu_context); if (cu_res != CUDA_SUCCESS) { av_log(avctx, AV_LOG_ERROR, "cuCtxPushCurrent failed\n"); return AVERROR_EXTERNAL; } res = nvenc_upload_frame(avctx, frame, inSurf); cu_res = dl_fn->cuda_dl->cuCtxPopCurrent(&dummy); if (cu_res != CUDA_SUCCESS) { av_log(avctx, AV_LOG_ERROR, "cuCtxPopCurrent failed\n"); return AVERROR_EXTERNAL; } if (res) { inSurf->lockCount = 0; return res; } pic_params.inputBuffer = inSurf->input_surface; pic_params.bufferFmt = inSurf->format; pic_params.inputWidth = avctx->width; pic_params.inputHeight = avctx->height; pic_params.inputPitch = inSurf->pitch; pic_params.outputBitstream = inSurf->output_surface; if (avctx->flags & AV_CODEC_FLAG_INTERLACED_DCT) { if (frame->top_field_first) pic_params.pictureStruct = NV_ENC_PIC_STRUCT_FIELD_TOP_BOTTOM; else pic_params.pictureStruct = NV_ENC_PIC_STRUCT_FIELD_BOTTOM_TOP; } else { pic_params.pictureStruct = NV_ENC_PIC_STRUCT_FRAME; } if (ctx->forced_idr >= 0 && frame->pict_type == AV_PICTURE_TYPE_I) { pic_params.encodePicFlags = ctx->forced_idr ? NV_ENC_PIC_FLAG_FORCEIDR : NV_ENC_PIC_FLAG_FORCEINTRA; } else { pic_params.encodePicFlags = 0; } pic_params.inputTimeStamp = frame->pts; nvenc_codec_specific_pic_params(avctx, &pic_params); } else { pic_params.encodePicFlags = NV_ENC_PIC_FLAG_EOS; } cu_res = dl_fn->cuda_dl->cuCtxPushCurrent(ctx->cu_context); if (cu_res != CUDA_SUCCESS) { av_log(avctx, AV_LOG_ERROR, "cuCtxPushCurrent failed\n"); return AVERROR_EXTERNAL; } nv_status = p_nvenc->nvEncEncodePicture(ctx->nvencoder, &pic_params); cu_res = dl_fn->cuda_dl->cuCtxPopCurrent(&dummy); if (cu_res != CUDA_SUCCESS) { av_log(avctx, AV_LOG_ERROR, "cuCtxPopCurrent failed\n"); return AVERROR_EXTERNAL; } if (nv_status != NV_ENC_SUCCESS && nv_status != NV_ENC_ERR_NEED_MORE_INPUT) return nvenc_print_error(avctx, nv_status, "EncodePicture failed!"); if (frame) { av_fifo_generic_write(ctx->output_surface_queue, &inSurf, sizeof(inSurf), NULL); timestamp_queue_enqueue(ctx->timestamp_list, frame->pts); if (ctx->initial_pts[0] == AV_NOPTS_VALUE) ctx->initial_pts[0] = frame->pts; else if (ctx->initial_pts[1] == AV_NOPTS_VALUE) ctx->initial_pts[1] = frame->pts; } /* all the pending buffers are now ready for output */ if (nv_status == NV_ENC_SUCCESS) { while (av_fifo_size(ctx->output_surface_queue) > 0) { av_fifo_generic_read(ctx->output_surface_queue, &tmpoutsurf, sizeof(tmpoutsurf), NULL); av_fifo_generic_write(ctx->output_surface_ready_queue, &tmpoutsurf, sizeof(tmpoutsurf), NULL); } } if (output_ready(avctx, !frame)) { av_fifo_generic_read(ctx->output_surface_ready_queue, &tmpoutsurf, sizeof(tmpoutsurf), NULL); res = process_output_surface(avctx, pkt, tmpoutsurf); if (res) return res; av_assert0(tmpoutsurf->lockCount); tmpoutsurf->lockCount--; *got_packet = 1; } else { *got_packet = 0; } return 0; }
false
FFmpeg
8de3458a07376b0a96772e586b6dba5e93432f52
int ff_nvenc_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet) { NVENCSTATUS nv_status; CUresult cu_res; CUcontext dummy; NvencSurface *tmpoutsurf, *inSurf; int res; NvencContext *ctx = avctx->priv_data; NvencDynLoadFunctions *dl_fn = &ctx->nvenc_dload_funcs; NV_ENCODE_API_FUNCTION_LIST *p_nvenc = &dl_fn->nvenc_funcs; NV_ENC_PIC_PARAMS pic_params = { 0 }; pic_params.version = NV_ENC_PIC_PARAMS_VER; if (frame) { inSurf = get_free_frame(ctx); if (!inSurf) { av_log(avctx, AV_LOG_ERROR, "No free surfaces\n"); return AVERROR_BUG; } cu_res = dl_fn->cuda_dl->cuCtxPushCurrent(ctx->cu_context); if (cu_res != CUDA_SUCCESS) { av_log(avctx, AV_LOG_ERROR, "cuCtxPushCurrent failed\n"); return AVERROR_EXTERNAL; } res = nvenc_upload_frame(avctx, frame, inSurf); cu_res = dl_fn->cuda_dl->cuCtxPopCurrent(&dummy); if (cu_res != CUDA_SUCCESS) { av_log(avctx, AV_LOG_ERROR, "cuCtxPopCurrent failed\n"); return AVERROR_EXTERNAL; } if (res) { inSurf->lockCount = 0; return res; } pic_params.inputBuffer = inSurf->input_surface; pic_params.bufferFmt = inSurf->format; pic_params.inputWidth = avctx->width; pic_params.inputHeight = avctx->height; pic_params.inputPitch = inSurf->pitch; pic_params.outputBitstream = inSurf->output_surface; if (avctx->flags & AV_CODEC_FLAG_INTERLACED_DCT) { if (frame->top_field_first) pic_params.pictureStruct = NV_ENC_PIC_STRUCT_FIELD_TOP_BOTTOM; else pic_params.pictureStruct = NV_ENC_PIC_STRUCT_FIELD_BOTTOM_TOP; } else { pic_params.pictureStruct = NV_ENC_PIC_STRUCT_FRAME; } if (ctx->forced_idr >= 0 && frame->pict_type == AV_PICTURE_TYPE_I) { pic_params.encodePicFlags = ctx->forced_idr ? NV_ENC_PIC_FLAG_FORCEIDR : NV_ENC_PIC_FLAG_FORCEINTRA; } else { pic_params.encodePicFlags = 0; } pic_params.inputTimeStamp = frame->pts; nvenc_codec_specific_pic_params(avctx, &pic_params); } else { pic_params.encodePicFlags = NV_ENC_PIC_FLAG_EOS; } cu_res = dl_fn->cuda_dl->cuCtxPushCurrent(ctx->cu_context); if (cu_res != CUDA_SUCCESS) { av_log(avctx, AV_LOG_ERROR, "cuCtxPushCurrent failed\n"); return AVERROR_EXTERNAL; } nv_status = p_nvenc->nvEncEncodePicture(ctx->nvencoder, &pic_params); cu_res = dl_fn->cuda_dl->cuCtxPopCurrent(&dummy); if (cu_res != CUDA_SUCCESS) { av_log(avctx, AV_LOG_ERROR, "cuCtxPopCurrent failed\n"); return AVERROR_EXTERNAL; } if (nv_status != NV_ENC_SUCCESS && nv_status != NV_ENC_ERR_NEED_MORE_INPUT) return nvenc_print_error(avctx, nv_status, "EncodePicture failed!"); if (frame) { av_fifo_generic_write(ctx->output_surface_queue, &inSurf, sizeof(inSurf), NULL); timestamp_queue_enqueue(ctx->timestamp_list, frame->pts); if (ctx->initial_pts[0] == AV_NOPTS_VALUE) ctx->initial_pts[0] = frame->pts; else if (ctx->initial_pts[1] == AV_NOPTS_VALUE) ctx->initial_pts[1] = frame->pts; } if (nv_status == NV_ENC_SUCCESS) { while (av_fifo_size(ctx->output_surface_queue) > 0) { av_fifo_generic_read(ctx->output_surface_queue, &tmpoutsurf, sizeof(tmpoutsurf), NULL); av_fifo_generic_write(ctx->output_surface_ready_queue, &tmpoutsurf, sizeof(tmpoutsurf), NULL); } } if (output_ready(avctx, !frame)) { av_fifo_generic_read(ctx->output_surface_ready_queue, &tmpoutsurf, sizeof(tmpoutsurf), NULL); res = process_output_surface(avctx, pkt, tmpoutsurf); if (res) return res; av_assert0(tmpoutsurf->lockCount); tmpoutsurf->lockCount--; *got_packet = 1; } else { *got_packet = 0; } return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(AVCodecContext *VAR_0, AVPacket *VAR_1, const AVFrame *VAR_2, int *VAR_3) { NVENCSTATUS nv_status; CUresult cu_res; CUcontext dummy; NvencSurface *tmpoutsurf, *inSurf; int VAR_4; NvencContext *ctx = VAR_0->priv_data; NvencDynLoadFunctions *dl_fn = &ctx->nvenc_dload_funcs; NV_ENCODE_API_FUNCTION_LIST *p_nvenc = &dl_fn->nvenc_funcs; NV_ENC_PIC_PARAMS pic_params = { 0 }; pic_params.version = NV_ENC_PIC_PARAMS_VER; if (VAR_2) { inSurf = get_free_frame(ctx); if (!inSurf) { av_log(VAR_0, AV_LOG_ERROR, "No free surfaces\n"); return AVERROR_BUG; } cu_res = dl_fn->cuda_dl->cuCtxPushCurrent(ctx->cu_context); if (cu_res != CUDA_SUCCESS) { av_log(VAR_0, AV_LOG_ERROR, "cuCtxPushCurrent failed\n"); return AVERROR_EXTERNAL; } VAR_4 = nvenc_upload_frame(VAR_0, VAR_2, inSurf); cu_res = dl_fn->cuda_dl->cuCtxPopCurrent(&dummy); if (cu_res != CUDA_SUCCESS) { av_log(VAR_0, AV_LOG_ERROR, "cuCtxPopCurrent failed\n"); return AVERROR_EXTERNAL; } if (VAR_4) { inSurf->lockCount = 0; return VAR_4; } pic_params.inputBuffer = inSurf->input_surface; pic_params.bufferFmt = inSurf->format; pic_params.inputWidth = VAR_0->width; pic_params.inputHeight = VAR_0->height; pic_params.inputPitch = inSurf->pitch; pic_params.outputBitstream = inSurf->output_surface; if (VAR_0->flags & AV_CODEC_FLAG_INTERLACED_DCT) { if (VAR_2->top_field_first) pic_params.pictureStruct = NV_ENC_PIC_STRUCT_FIELD_TOP_BOTTOM; else pic_params.pictureStruct = NV_ENC_PIC_STRUCT_FIELD_BOTTOM_TOP; } else { pic_params.pictureStruct = NV_ENC_PIC_STRUCT_FRAME; } if (ctx->forced_idr >= 0 && VAR_2->pict_type == AV_PICTURE_TYPE_I) { pic_params.encodePicFlags = ctx->forced_idr ? NV_ENC_PIC_FLAG_FORCEIDR : NV_ENC_PIC_FLAG_FORCEINTRA; } else { pic_params.encodePicFlags = 0; } pic_params.inputTimeStamp = VAR_2->pts; nvenc_codec_specific_pic_params(VAR_0, &pic_params); } else { pic_params.encodePicFlags = NV_ENC_PIC_FLAG_EOS; } cu_res = dl_fn->cuda_dl->cuCtxPushCurrent(ctx->cu_context); if (cu_res != CUDA_SUCCESS) { av_log(VAR_0, AV_LOG_ERROR, "cuCtxPushCurrent failed\n"); return AVERROR_EXTERNAL; } nv_status = p_nvenc->nvEncEncodePicture(ctx->nvencoder, &pic_params); cu_res = dl_fn->cuda_dl->cuCtxPopCurrent(&dummy); if (cu_res != CUDA_SUCCESS) { av_log(VAR_0, AV_LOG_ERROR, "cuCtxPopCurrent failed\n"); return AVERROR_EXTERNAL; } if (nv_status != NV_ENC_SUCCESS && nv_status != NV_ENC_ERR_NEED_MORE_INPUT) return nvenc_print_error(VAR_0, nv_status, "EncodePicture failed!"); if (VAR_2) { av_fifo_generic_write(ctx->output_surface_queue, &inSurf, sizeof(inSurf), NULL); timestamp_queue_enqueue(ctx->timestamp_list, VAR_2->pts); if (ctx->initial_pts[0] == AV_NOPTS_VALUE) ctx->initial_pts[0] = VAR_2->pts; else if (ctx->initial_pts[1] == AV_NOPTS_VALUE) ctx->initial_pts[1] = VAR_2->pts; } if (nv_status == NV_ENC_SUCCESS) { while (av_fifo_size(ctx->output_surface_queue) > 0) { av_fifo_generic_read(ctx->output_surface_queue, &tmpoutsurf, sizeof(tmpoutsurf), NULL); av_fifo_generic_write(ctx->output_surface_ready_queue, &tmpoutsurf, sizeof(tmpoutsurf), NULL); } } if (output_ready(VAR_0, !VAR_2)) { av_fifo_generic_read(ctx->output_surface_ready_queue, &tmpoutsurf, sizeof(tmpoutsurf), NULL); VAR_4 = process_output_surface(VAR_0, VAR_1, tmpoutsurf); if (VAR_4) return VAR_4; av_assert0(tmpoutsurf->lockCount); tmpoutsurf->lockCount--; *VAR_3 = 1; } else { *VAR_3 = 0; } return 0; }
[ "int FUNC_0(AVCodecContext *VAR_0, AVPacket *VAR_1,\nconst AVFrame *VAR_2, int *VAR_3)\n{", "NVENCSTATUS nv_status;", "CUresult cu_res;", "CUcontext dummy;", "NvencSurface *tmpoutsurf, *inSurf;", "int VAR_4;", "NvencContext *ctx = VAR_0->priv_data;", "NvencDynLoadFunctions *dl_fn = &ctx->nvenc_dload_funcs;", "NV_ENCODE_API_FUNCTION_LIST *p_nvenc = &dl_fn->nvenc_funcs;", "NV_ENC_PIC_PARAMS pic_params = { 0 };", "pic_params.version = NV_ENC_PIC_PARAMS_VER;", "if (VAR_2) {", "inSurf = get_free_frame(ctx);", "if (!inSurf) {", "av_log(VAR_0, AV_LOG_ERROR, \"No free surfaces\\n\");", "return AVERROR_BUG;", "}", "cu_res = dl_fn->cuda_dl->cuCtxPushCurrent(ctx->cu_context);", "if (cu_res != CUDA_SUCCESS) {", "av_log(VAR_0, AV_LOG_ERROR, \"cuCtxPushCurrent failed\\n\");", "return AVERROR_EXTERNAL;", "}", "VAR_4 = nvenc_upload_frame(VAR_0, VAR_2, inSurf);", "cu_res = dl_fn->cuda_dl->cuCtxPopCurrent(&dummy);", "if (cu_res != CUDA_SUCCESS) {", "av_log(VAR_0, AV_LOG_ERROR, \"cuCtxPopCurrent failed\\n\");", "return AVERROR_EXTERNAL;", "}", "if (VAR_4) {", "inSurf->lockCount = 0;", "return VAR_4;", "}", "pic_params.inputBuffer = inSurf->input_surface;", "pic_params.bufferFmt = inSurf->format;", "pic_params.inputWidth = VAR_0->width;", "pic_params.inputHeight = VAR_0->height;", "pic_params.inputPitch = inSurf->pitch;", "pic_params.outputBitstream = inSurf->output_surface;", "if (VAR_0->flags & AV_CODEC_FLAG_INTERLACED_DCT) {", "if (VAR_2->top_field_first)\npic_params.pictureStruct = NV_ENC_PIC_STRUCT_FIELD_TOP_BOTTOM;", "else\npic_params.pictureStruct = NV_ENC_PIC_STRUCT_FIELD_BOTTOM_TOP;", "} else {", "pic_params.pictureStruct = NV_ENC_PIC_STRUCT_FRAME;", "}", "if (ctx->forced_idr >= 0 && VAR_2->pict_type == AV_PICTURE_TYPE_I) {", "pic_params.encodePicFlags =\nctx->forced_idr ? NV_ENC_PIC_FLAG_FORCEIDR : NV_ENC_PIC_FLAG_FORCEINTRA;", "} else {", "pic_params.encodePicFlags = 0;", "}", "pic_params.inputTimeStamp = VAR_2->pts;", "nvenc_codec_specific_pic_params(VAR_0, &pic_params);", "} else {", "pic_params.encodePicFlags = NV_ENC_PIC_FLAG_EOS;", "}", "cu_res = dl_fn->cuda_dl->cuCtxPushCurrent(ctx->cu_context);", "if (cu_res != CUDA_SUCCESS) {", "av_log(VAR_0, AV_LOG_ERROR, \"cuCtxPushCurrent failed\\n\");", "return AVERROR_EXTERNAL;", "}", "nv_status = p_nvenc->nvEncEncodePicture(ctx->nvencoder, &pic_params);", "cu_res = dl_fn->cuda_dl->cuCtxPopCurrent(&dummy);", "if (cu_res != CUDA_SUCCESS) {", "av_log(VAR_0, AV_LOG_ERROR, \"cuCtxPopCurrent failed\\n\");", "return AVERROR_EXTERNAL;", "}", "if (nv_status != NV_ENC_SUCCESS &&\nnv_status != NV_ENC_ERR_NEED_MORE_INPUT)\nreturn nvenc_print_error(VAR_0, nv_status, \"EncodePicture failed!\");", "if (VAR_2) {", "av_fifo_generic_write(ctx->output_surface_queue, &inSurf, sizeof(inSurf), NULL);", "timestamp_queue_enqueue(ctx->timestamp_list, VAR_2->pts);", "if (ctx->initial_pts[0] == AV_NOPTS_VALUE)\nctx->initial_pts[0] = VAR_2->pts;", "else if (ctx->initial_pts[1] == AV_NOPTS_VALUE)\nctx->initial_pts[1] = VAR_2->pts;", "}", "if (nv_status == NV_ENC_SUCCESS) {", "while (av_fifo_size(ctx->output_surface_queue) > 0) {", "av_fifo_generic_read(ctx->output_surface_queue, &tmpoutsurf, sizeof(tmpoutsurf), NULL);", "av_fifo_generic_write(ctx->output_surface_ready_queue, &tmpoutsurf, sizeof(tmpoutsurf), NULL);", "}", "}", "if (output_ready(VAR_0, !VAR_2)) {", "av_fifo_generic_read(ctx->output_surface_ready_queue, &tmpoutsurf, sizeof(tmpoutsurf), NULL);", "VAR_4 = process_output_surface(VAR_0, VAR_1, tmpoutsurf);", "if (VAR_4)\nreturn VAR_4;", "av_assert0(tmpoutsurf->lockCount);", "tmpoutsurf->lockCount--;", "*VAR_3 = 1;", "} else {", "*VAR_3 = 0;", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99 ], [ 101, 103 ], [ 105, 107 ], [ 109 ], [ 111 ], [ 113 ], [ 117 ], [ 119, 121 ], [ 123 ], [ 125 ], [ 127 ], [ 131 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 157 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 173, 175, 177 ], [ 181 ], [ 183 ], [ 185 ], [ 189, 191 ], [ 193, 195 ], [ 197 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 217 ], [ 219 ], [ 223 ], [ 227, 229 ], [ 233 ], [ 235 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 249 ], [ 251 ] ]
12,010
static int get_cox(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c) { uint8_t byte; if (s->buf_end - s->buf < 5) return AVERROR(EINVAL); c->nreslevels = bytestream_get_byte(&s->buf) + 1; // num of resolution levels - 1 /* compute number of resolution levels to decode */ if (c->nreslevels < s->reduction_factor) c->nreslevels2decode = 1; else c->nreslevels2decode = c->nreslevels - s->reduction_factor; c->log2_cblk_width = bytestream_get_byte(&s->buf) + 2; // cblk width c->log2_cblk_height = bytestream_get_byte(&s->buf) + 2; // cblk height c->cblk_style = bytestream_get_byte(&s->buf); if (c->cblk_style != 0) { // cblk style av_log(s->avctx, AV_LOG_ERROR, "no extra cblk styles supported\n"); return -1; } c->transform = bytestream_get_byte(&s->buf); // DWT transformation type /* set integer 9/7 DWT in case of BITEXACT flag */ if ((s->avctx->flags & CODEC_FLAG_BITEXACT) && (c->transform == FF_DWT97)) c->transform = FF_DWT97_INT; if (c->csty & JPEG2000_CSTY_PREC) { int i; for (i = 0; i < c->nreslevels; i++) { byte = bytestream_get_byte(&s->buf); c->log2_prec_widths[i] = byte & 0x0F; // precinct PPx c->log2_prec_heights[i] = (byte >> 4) & 0x0F; // precinct PPy } } return 0; }
false
FFmpeg
5650e331a733711b809bc27f968500f0f5530126
static int get_cox(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c) { uint8_t byte; if (s->buf_end - s->buf < 5) return AVERROR(EINVAL); c->nreslevels = bytestream_get_byte(&s->buf) + 1; if (c->nreslevels < s->reduction_factor) c->nreslevels2decode = 1; else c->nreslevels2decode = c->nreslevels - s->reduction_factor; c->log2_cblk_width = bytestream_get_byte(&s->buf) + 2; c->log2_cblk_height = bytestream_get_byte(&s->buf) + 2; c->cblk_style = bytestream_get_byte(&s->buf); if (c->cblk_style != 0) { av_log(s->avctx, AV_LOG_ERROR, "no extra cblk styles supported\n"); return -1; } c->transform = bytestream_get_byte(&s->buf); if ((s->avctx->flags & CODEC_FLAG_BITEXACT) && (c->transform == FF_DWT97)) c->transform = FF_DWT97_INT; if (c->csty & JPEG2000_CSTY_PREC) { int i; for (i = 0; i < c->nreslevels; i++) { byte = bytestream_get_byte(&s->buf); c->log2_prec_widths[i] = byte & 0x0F; c->log2_prec_heights[i] = (byte >> 4) & 0x0F; } } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(Jpeg2000DecoderContext *VAR_0, Jpeg2000CodingStyle *VAR_1) { uint8_t byte; if (VAR_0->buf_end - VAR_0->buf < 5) return AVERROR(EINVAL); VAR_1->nreslevels = bytestream_get_byte(&VAR_0->buf) + 1; if (VAR_1->nreslevels < VAR_0->reduction_factor) VAR_1->nreslevels2decode = 1; else VAR_1->nreslevels2decode = VAR_1->nreslevels - VAR_0->reduction_factor; VAR_1->log2_cblk_width = bytestream_get_byte(&VAR_0->buf) + 2; VAR_1->log2_cblk_height = bytestream_get_byte(&VAR_0->buf) + 2; VAR_1->cblk_style = bytestream_get_byte(&VAR_0->buf); if (VAR_1->cblk_style != 0) { av_log(VAR_0->avctx, AV_LOG_ERROR, "no extra cblk styles supported\n"); return -1; } VAR_1->transform = bytestream_get_byte(&VAR_0->buf); if ((VAR_0->avctx->flags & CODEC_FLAG_BITEXACT) && (VAR_1->transform == FF_DWT97)) VAR_1->transform = FF_DWT97_INT; if (VAR_1->csty & JPEG2000_CSTY_PREC) { int VAR_2; for (VAR_2 = 0; VAR_2 < VAR_1->nreslevels; VAR_2++) { byte = bytestream_get_byte(&VAR_0->buf); VAR_1->log2_prec_widths[VAR_2] = byte & 0x0F; VAR_1->log2_prec_heights[VAR_2] = (byte >> 4) & 0x0F; } } return 0; }
[ "static int FUNC_0(Jpeg2000DecoderContext *VAR_0, Jpeg2000CodingStyle *VAR_1)\n{", "uint8_t byte;", "if (VAR_0->buf_end - VAR_0->buf < 5)\nreturn AVERROR(EINVAL);", "VAR_1->nreslevels = bytestream_get_byte(&VAR_0->buf) + 1;", "if (VAR_1->nreslevels < VAR_0->reduction_factor)\nVAR_1->nreslevels2decode = 1;", "else\nVAR_1->nreslevels2decode = VAR_1->nreslevels - VAR_0->reduction_factor;", "VAR_1->log2_cblk_width = bytestream_get_byte(&VAR_0->buf) + 2;", "VAR_1->log2_cblk_height = bytestream_get_byte(&VAR_0->buf) + 2;", "VAR_1->cblk_style = bytestream_get_byte(&VAR_0->buf);", "if (VAR_1->cblk_style != 0) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"no extra cblk styles supported\\n\");", "return -1;", "}", "VAR_1->transform = bytestream_get_byte(&VAR_0->buf);", "if ((VAR_0->avctx->flags & CODEC_FLAG_BITEXACT) && (VAR_1->transform == FF_DWT97))\nVAR_1->transform = FF_DWT97_INT;", "if (VAR_1->csty & JPEG2000_CSTY_PREC) {", "int VAR_2;", "for (VAR_2 = 0; VAR_2 < VAR_1->nreslevels; VAR_2++) {", "byte = bytestream_get_byte(&VAR_0->buf);", "VAR_1->log2_prec_widths[VAR_2] = byte & 0x0F;", "VAR_1->log2_prec_heights[VAR_2] = (byte >> 4) & 0x0F;", "}", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11 ], [ 13 ], [ 19, 21 ], [ 23, 25 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49, 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ] ]
12,011
static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref) { AVFilterContext *ctx = inlink->dst; TInterlaceContext *tinterlace = ctx->priv; if (tinterlace->cur) avfilter_unref_buffer(tinterlace->cur); tinterlace->cur = tinterlace->next; tinterlace->next = picref; }
false
FFmpeg
18c6bd098baba1ace8fea946e4bc0c60098f49d4
static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref) { AVFilterContext *ctx = inlink->dst; TInterlaceContext *tinterlace = ctx->priv; if (tinterlace->cur) avfilter_unref_buffer(tinterlace->cur); tinterlace->cur = tinterlace->next; tinterlace->next = picref; }
{ "code": [], "line_no": [] }
static void FUNC_0(AVFilterLink *VAR_0, AVFilterBufferRef *VAR_1) { AVFilterContext *ctx = VAR_0->dst; TInterlaceContext *tinterlace = ctx->priv; if (tinterlace->cur) avfilter_unref_buffer(tinterlace->cur); tinterlace->cur = tinterlace->next; tinterlace->next = VAR_1; }
[ "static void FUNC_0(AVFilterLink *VAR_0, AVFilterBufferRef *VAR_1)\n{", "AVFilterContext *ctx = VAR_0->dst;", "TInterlaceContext *tinterlace = ctx->priv;", "if (tinterlace->cur)\navfilter_unref_buffer(tinterlace->cur);", "tinterlace->cur = tinterlace->next;", "tinterlace->next = VAR_1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11, 13 ], [ 15 ], [ 17 ], [ 19 ] ]
12,012
static int mov_read_trun(MOVContext *c, ByteIOContext *pb, MOVAtom atom) { MOVFragment *frag = &c->fragment; AVStream *st = NULL; MOVStreamContext *sc; uint64_t offset; int64_t dts; int data_offset = 0; unsigned entries, first_sample_flags = frag->flags; int flags, distance, i; for (i = 0; i < c->fc->nb_streams; i++) { if (c->fc->streams[i]->id == frag->track_id) { st = c->fc->streams[i]; break; } } if (!st) { av_log(c->fc, AV_LOG_ERROR, "could not find corresponding track id %d\n", frag->track_id); return -1; } sc = st->priv_data; if (sc->pseudo_stream_id+1 != frag->stsd_id) return 0; get_byte(pb); /* version */ flags = get_be24(pb); entries = get_be32(pb); dprintf(c->fc, "flags 0x%x entries %d\n", flags, entries); if (flags & 0x001) data_offset = get_be32(pb); if (flags & 0x004) first_sample_flags = get_be32(pb); if (flags & 0x800) { MOVStts *ctts_data; if ((uint64_t)entries+sc->ctts_count >= UINT_MAX/sizeof(*sc->ctts_data)) return -1; ctts_data = av_realloc(sc->ctts_data, (entries+sc->ctts_count)*sizeof(*sc->ctts_data)); if (!ctts_data) return AVERROR(ENOMEM); sc->ctts_data = ctts_data; } dts = st->duration; offset = frag->base_data_offset + data_offset; distance = 0; dprintf(c->fc, "first sample flags 0x%x\n", first_sample_flags); for (i = 0; i < entries; i++) { unsigned sample_size = frag->size; int sample_flags = i ? frag->flags : first_sample_flags; unsigned sample_duration = frag->duration; int keyframe; if (flags & 0x100) sample_duration = get_be32(pb); if (flags & 0x200) sample_size = get_be32(pb); if (flags & 0x400) sample_flags = get_be32(pb); if (flags & 0x800) { sc->ctts_data[sc->ctts_count].count = 1; sc->ctts_data[sc->ctts_count].duration = get_be32(pb); sc->ctts_count++; } if ((keyframe = st->codec->codec_type == CODEC_TYPE_AUDIO || (flags & 0x004 && !i && !sample_flags) || sample_flags & 0x2000000)) distance = 0; av_add_index_entry(st, offset, dts, sample_size, distance, keyframe ? AVINDEX_KEYFRAME : 0); dprintf(c->fc, "AVIndex stream %d, sample %d, offset %"PRIx64", dts %"PRId64", " "size %d, distance %d, keyframe %d\n", st->index, sc->sample_count+i, offset, dts, sample_size, distance, keyframe); distance++; assert(sample_duration % sc->time_rate == 0); dts += sample_duration / sc->time_rate; offset += sample_size; } frag->moof_offset = offset; sc->sample_count = st->nb_index_entries; st->duration = dts; return 0; }
false
FFmpeg
f0f2218dce194ff50d1fe7ed39011595660143ad
static int mov_read_trun(MOVContext *c, ByteIOContext *pb, MOVAtom atom) { MOVFragment *frag = &c->fragment; AVStream *st = NULL; MOVStreamContext *sc; uint64_t offset; int64_t dts; int data_offset = 0; unsigned entries, first_sample_flags = frag->flags; int flags, distance, i; for (i = 0; i < c->fc->nb_streams; i++) { if (c->fc->streams[i]->id == frag->track_id) { st = c->fc->streams[i]; break; } } if (!st) { av_log(c->fc, AV_LOG_ERROR, "could not find corresponding track id %d\n", frag->track_id); return -1; } sc = st->priv_data; if (sc->pseudo_stream_id+1 != frag->stsd_id) return 0; get_byte(pb); flags = get_be24(pb); entries = get_be32(pb); dprintf(c->fc, "flags 0x%x entries %d\n", flags, entries); if (flags & 0x001) data_offset = get_be32(pb); if (flags & 0x004) first_sample_flags = get_be32(pb); if (flags & 0x800) { MOVStts *ctts_data; if ((uint64_t)entries+sc->ctts_count >= UINT_MAX/sizeof(*sc->ctts_data)) return -1; ctts_data = av_realloc(sc->ctts_data, (entries+sc->ctts_count)*sizeof(*sc->ctts_data)); if (!ctts_data) return AVERROR(ENOMEM); sc->ctts_data = ctts_data; } dts = st->duration; offset = frag->base_data_offset + data_offset; distance = 0; dprintf(c->fc, "first sample flags 0x%x\n", first_sample_flags); for (i = 0; i < entries; i++) { unsigned sample_size = frag->size; int sample_flags = i ? frag->flags : first_sample_flags; unsigned sample_duration = frag->duration; int keyframe; if (flags & 0x100) sample_duration = get_be32(pb); if (flags & 0x200) sample_size = get_be32(pb); if (flags & 0x400) sample_flags = get_be32(pb); if (flags & 0x800) { sc->ctts_data[sc->ctts_count].count = 1; sc->ctts_data[sc->ctts_count].duration = get_be32(pb); sc->ctts_count++; } if ((keyframe = st->codec->codec_type == CODEC_TYPE_AUDIO || (flags & 0x004 && !i && !sample_flags) || sample_flags & 0x2000000)) distance = 0; av_add_index_entry(st, offset, dts, sample_size, distance, keyframe ? AVINDEX_KEYFRAME : 0); dprintf(c->fc, "AVIndex stream %d, sample %d, offset %"PRIx64", dts %"PRId64", " "size %d, distance %d, keyframe %d\n", st->index, sc->sample_count+i, offset, dts, sample_size, distance, keyframe); distance++; assert(sample_duration % sc->time_rate == 0); dts += sample_duration / sc->time_rate; offset += sample_size; } frag->moof_offset = offset; sc->sample_count = st->nb_index_entries; st->duration = dts; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(MOVContext *VAR_0, ByteIOContext *VAR_1, MOVAtom VAR_2) { MOVFragment *frag = &VAR_0->fragment; AVStream *st = NULL; MOVStreamContext *sc; uint64_t offset; int64_t dts; int VAR_3 = 0; unsigned VAR_4, VAR_5 = frag->VAR_6; int VAR_6, VAR_7, VAR_8; for (VAR_8 = 0; VAR_8 < VAR_0->fc->nb_streams; VAR_8++) { if (VAR_0->fc->streams[VAR_8]->id == frag->track_id) { st = VAR_0->fc->streams[VAR_8]; break; } } if (!st) { av_log(VAR_0->fc, AV_LOG_ERROR, "could not find corresponding track id %d\n", frag->track_id); return -1; } sc = st->priv_data; if (sc->pseudo_stream_id+1 != frag->stsd_id) return 0; get_byte(VAR_1); VAR_6 = get_be24(VAR_1); VAR_4 = get_be32(VAR_1); dprintf(VAR_0->fc, "VAR_6 0x%x VAR_4 %d\n", VAR_6, VAR_4); if (VAR_6 & 0x001) VAR_3 = get_be32(VAR_1); if (VAR_6 & 0x004) VAR_5 = get_be32(VAR_1); if (VAR_6 & 0x800) { MOVStts *ctts_data; if ((uint64_t)VAR_4+sc->ctts_count >= UINT_MAX/sizeof(*sc->ctts_data)) return -1; ctts_data = av_realloc(sc->ctts_data, (VAR_4+sc->ctts_count)*sizeof(*sc->ctts_data)); if (!ctts_data) return AVERROR(ENOMEM); sc->ctts_data = ctts_data; } dts = st->duration; offset = frag->base_data_offset + VAR_3; VAR_7 = 0; dprintf(VAR_0->fc, "first sample VAR_6 0x%x\n", VAR_5); for (VAR_8 = 0; VAR_8 < VAR_4; VAR_8++) { unsigned VAR_9 = frag->size; int VAR_10 = VAR_8 ? frag->VAR_6 : VAR_5; unsigned VAR_11 = frag->duration; int VAR_12; if (VAR_6 & 0x100) VAR_11 = get_be32(VAR_1); if (VAR_6 & 0x200) VAR_9 = get_be32(VAR_1); if (VAR_6 & 0x400) VAR_10 = get_be32(VAR_1); if (VAR_6 & 0x800) { sc->ctts_data[sc->ctts_count].count = 1; sc->ctts_data[sc->ctts_count].duration = get_be32(VAR_1); sc->ctts_count++; } if ((VAR_12 = st->codec->codec_type == CODEC_TYPE_AUDIO || (VAR_6 & 0x004 && !VAR_8 && !VAR_10) || VAR_10 & 0x2000000)) VAR_7 = 0; av_add_index_entry(st, offset, dts, VAR_9, VAR_7, VAR_12 ? AVINDEX_KEYFRAME : 0); dprintf(VAR_0->fc, "AVIndex stream %d, sample %d, offset %"PRIx64", dts %"PRId64", " "size %d, VAR_7 %d, VAR_12 %d\n", st->index, sc->sample_count+VAR_8, offset, dts, VAR_9, VAR_7, VAR_12); VAR_7++; assert(VAR_11 % sc->time_rate == 0); dts += VAR_11 / sc->time_rate; offset += VAR_9; } frag->moof_offset = offset; sc->sample_count = st->nb_index_entries; st->duration = dts; return 0; }
[ "static int FUNC_0(MOVContext *VAR_0, ByteIOContext *VAR_1, MOVAtom VAR_2)\n{", "MOVFragment *frag = &VAR_0->fragment;", "AVStream *st = NULL;", "MOVStreamContext *sc;", "uint64_t offset;", "int64_t dts;", "int VAR_3 = 0;", "unsigned VAR_4, VAR_5 = frag->VAR_6;", "int VAR_6, VAR_7, VAR_8;", "for (VAR_8 = 0; VAR_8 < VAR_0->fc->nb_streams; VAR_8++) {", "if (VAR_0->fc->streams[VAR_8]->id == frag->track_id) {", "st = VAR_0->fc->streams[VAR_8];", "break;", "}", "}", "if (!st) {", "av_log(VAR_0->fc, AV_LOG_ERROR, \"could not find corresponding track id %d\\n\", frag->track_id);", "return -1;", "}", "sc = st->priv_data;", "if (sc->pseudo_stream_id+1 != frag->stsd_id)\nreturn 0;", "get_byte(VAR_1);", "VAR_6 = get_be24(VAR_1);", "VAR_4 = get_be32(VAR_1);", "dprintf(VAR_0->fc, \"VAR_6 0x%x VAR_4 %d\\n\", VAR_6, VAR_4);", "if (VAR_6 & 0x001) VAR_3 = get_be32(VAR_1);", "if (VAR_6 & 0x004) VAR_5 = get_be32(VAR_1);", "if (VAR_6 & 0x800) {", "MOVStts *ctts_data;", "if ((uint64_t)VAR_4+sc->ctts_count >= UINT_MAX/sizeof(*sc->ctts_data))\nreturn -1;", "ctts_data = av_realloc(sc->ctts_data,\n(VAR_4+sc->ctts_count)*sizeof(*sc->ctts_data));", "if (!ctts_data)\nreturn AVERROR(ENOMEM);", "sc->ctts_data = ctts_data;", "}", "dts = st->duration;", "offset = frag->base_data_offset + VAR_3;", "VAR_7 = 0;", "dprintf(VAR_0->fc, \"first sample VAR_6 0x%x\\n\", VAR_5);", "for (VAR_8 = 0; VAR_8 < VAR_4; VAR_8++) {", "unsigned VAR_9 = frag->size;", "int VAR_10 = VAR_8 ? frag->VAR_6 : VAR_5;", "unsigned VAR_11 = frag->duration;", "int VAR_12;", "if (VAR_6 & 0x100) VAR_11 = get_be32(VAR_1);", "if (VAR_6 & 0x200) VAR_9 = get_be32(VAR_1);", "if (VAR_6 & 0x400) VAR_10 = get_be32(VAR_1);", "if (VAR_6 & 0x800) {", "sc->ctts_data[sc->ctts_count].count = 1;", "sc->ctts_data[sc->ctts_count].duration = get_be32(VAR_1);", "sc->ctts_count++;", "}", "if ((VAR_12 = st->codec->codec_type == CODEC_TYPE_AUDIO ||\n(VAR_6 & 0x004 && !VAR_8 && !VAR_10) || VAR_10 & 0x2000000))\nVAR_7 = 0;", "av_add_index_entry(st, offset, dts, VAR_9, VAR_7,\nVAR_12 ? AVINDEX_KEYFRAME : 0);", "dprintf(VAR_0->fc, \"AVIndex stream %d, sample %d, offset %\"PRIx64\", dts %\"PRId64\", \"\n\"size %d, VAR_7 %d, VAR_12 %d\\n\", st->index, sc->sample_count+VAR_8,\noffset, dts, VAR_9, VAR_7, VAR_12);", "VAR_7++;", "assert(VAR_11 % sc->time_rate == 0);", "dts += VAR_11 / sc->time_rate;", "offset += VAR_9;", "}", "frag->moof_offset = offset;", "sc->sample_count = st->nb_index_entries;", "st->duration = dts;", "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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45, 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65, 67 ], [ 69, 71 ], [ 73, 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 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 ] ]
12,013
void dsputil_init_ppc(DSPContext* c, AVCodecContext *avctx) { // Common optimizations whether Altivec is available or not switch (check_dcbzl_effect()) { case 32: c->clear_blocks = clear_blocks_dcbz32_ppc; break; case 128: c->clear_blocks = clear_blocks_dcbz128_ppc; break; default: break; } #if HAVE_ALTIVEC if (has_altivec()) { mm_flags |= MM_ALTIVEC; // Altivec specific optimisations c->pix_abs16x16_x2 = pix_abs16x16_x2_altivec; c->pix_abs16x16_y2 = pix_abs16x16_y2_altivec; c->pix_abs16x16_xy2 = pix_abs16x16_xy2_altivec; c->pix_abs16x16 = pix_abs16x16_altivec; c->pix_abs8x8 = pix_abs8x8_altivec; c->sad[0]= sad16x16_altivec; c->sad[1]= sad8x8_altivec; c->pix_norm1 = pix_norm1_altivec; c->sse[1]= sse8_altivec; c->sse[0]= sse16_altivec; c->pix_sum = pix_sum_altivec; c->diff_pixels = diff_pixels_altivec; c->get_pixels = get_pixels_altivec; // next one disabled as it's untested. #if 0 c->add_bytes= add_bytes_altivec; #endif /* 0 */ c->put_pixels_tab[0][0] = put_pixels16_altivec; c->avg_pixels_tab[0][0] = avg_pixels16_altivec; // next one disabled as it's untested. #if 0 c->avg_pixels_tab[1][0] = avg_pixels8_altivec; #endif /* 0 */ c->put_pixels_tab[1][3] = put_pixels8_xy2_altivec; c->put_no_rnd_pixels_tab[1][3] = put_no_rnd_pixels8_xy2_altivec; c->put_pixels_tab[0][3] = put_pixels16_xy2_altivec; c->put_no_rnd_pixels_tab[0][3] = put_no_rnd_pixels16_xy2_altivec; c->gmc1 = gmc1_altivec; if ((avctx->idct_algo == FF_IDCT_AUTO) || (avctx->idct_algo == FF_IDCT_ALTIVEC)) { c->idct_put = idct_put_altivec; c->idct_add = idct_add_altivec; #ifndef ALTIVEC_USE_REFERENCE_C_CODE c->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM; #else /* ALTIVEC_USE_REFERENCE_C_CODE */ c->idct_permutation_type = FF_NO_IDCT_PERM; #endif /* ALTIVEC_USE_REFERENCE_C_CODE */ } #ifdef POWERPC_TBL_PERFORMANCE_REPORT { int i; for (i = 0 ; i < powerpc_perf_total ; i++) { perfdata[i][powerpc_data_min] = 0xFFFFFFFFFFFFFFFF; perfdata[i][powerpc_data_max] = 0x0000000000000000; perfdata[i][powerpc_data_sum] = 0x0000000000000000; perfdata[i][powerpc_data_num] = 0x0000000000000000; #ifdef POWERPC_PERF_USE_PMC perfdata_pmc2[i][powerpc_data_min] = 0xFFFFFFFFFFFFFFFF; perfdata_pmc2[i][powerpc_data_max] = 0x0000000000000000; perfdata_pmc2[i][powerpc_data_sum] = 0x0000000000000000; perfdata_pmc2[i][powerpc_data_num] = 0x0000000000000000; perfdata_pmc3[i][powerpc_data_min] = 0xFFFFFFFFFFFFFFFF; perfdata_pmc3[i][powerpc_data_max] = 0x0000000000000000; perfdata_pmc3[i][powerpc_data_sum] = 0x0000000000000000; perfdata_pmc3[i][powerpc_data_num] = 0x0000000000000000; #endif /* POWERPC_PERF_USE_PMC */ } } #endif /* POWERPC_TBL_PERFORMANCE_REPORT */ } else #endif /* HAVE_ALTIVEC */ { // Non-AltiVec PPC optimisations // ... pending ... } }
false
FFmpeg
e45a2872fafe631c14aee9f79d0963d68c4fc1fd
void dsputil_init_ppc(DSPContext* c, AVCodecContext *avctx) { switch (check_dcbzl_effect()) { case 32: c->clear_blocks = clear_blocks_dcbz32_ppc; break; case 128: c->clear_blocks = clear_blocks_dcbz128_ppc; break; default: break; } #if HAVE_ALTIVEC if (has_altivec()) { mm_flags |= MM_ALTIVEC; c->pix_abs16x16_x2 = pix_abs16x16_x2_altivec; c->pix_abs16x16_y2 = pix_abs16x16_y2_altivec; c->pix_abs16x16_xy2 = pix_abs16x16_xy2_altivec; c->pix_abs16x16 = pix_abs16x16_altivec; c->pix_abs8x8 = pix_abs8x8_altivec; c->sad[0]= sad16x16_altivec; c->sad[1]= sad8x8_altivec; c->pix_norm1 = pix_norm1_altivec; c->sse[1]= sse8_altivec; c->sse[0]= sse16_altivec; c->pix_sum = pix_sum_altivec; c->diff_pixels = diff_pixels_altivec; c->get_pixels = get_pixels_altivec; #if 0 c->add_bytes= add_bytes_altivec; #endif c->put_pixels_tab[0][0] = put_pixels16_altivec; c->avg_pixels_tab[0][0] = avg_pixels16_altivec; #if 0 c->avg_pixels_tab[1][0] = avg_pixels8_altivec; #endif c->put_pixels_tab[1][3] = put_pixels8_xy2_altivec; c->put_no_rnd_pixels_tab[1][3] = put_no_rnd_pixels8_xy2_altivec; c->put_pixels_tab[0][3] = put_pixels16_xy2_altivec; c->put_no_rnd_pixels_tab[0][3] = put_no_rnd_pixels16_xy2_altivec; c->gmc1 = gmc1_altivec; if ((avctx->idct_algo == FF_IDCT_AUTO) || (avctx->idct_algo == FF_IDCT_ALTIVEC)) { c->idct_put = idct_put_altivec; c->idct_add = idct_add_altivec; #ifndef ALTIVEC_USE_REFERENCE_C_CODE c->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM; #else c->idct_permutation_type = FF_NO_IDCT_PERM; #endif } #ifdef POWERPC_TBL_PERFORMANCE_REPORT { int i; for (i = 0 ; i < powerpc_perf_total ; i++) { perfdata[i][powerpc_data_min] = 0xFFFFFFFFFFFFFFFF; perfdata[i][powerpc_data_max] = 0x0000000000000000; perfdata[i][powerpc_data_sum] = 0x0000000000000000; perfdata[i][powerpc_data_num] = 0x0000000000000000; #ifdef POWERPC_PERF_USE_PMC perfdata_pmc2[i][powerpc_data_min] = 0xFFFFFFFFFFFFFFFF; perfdata_pmc2[i][powerpc_data_max] = 0x0000000000000000; perfdata_pmc2[i][powerpc_data_sum] = 0x0000000000000000; perfdata_pmc2[i][powerpc_data_num] = 0x0000000000000000; perfdata_pmc3[i][powerpc_data_min] = 0xFFFFFFFFFFFFFFFF; perfdata_pmc3[i][powerpc_data_max] = 0x0000000000000000; perfdata_pmc3[i][powerpc_data_sum] = 0x0000000000000000; perfdata_pmc3[i][powerpc_data_num] = 0x0000000000000000; #endif } } #endif } else #endif { } }
{ "code": [], "line_no": [] }
void FUNC_0(DSPContext* VAR_0, AVCodecContext *VAR_1) { switch (check_dcbzl_effect()) { case 32: VAR_0->clear_blocks = clear_blocks_dcbz32_ppc; break; case 128: VAR_0->clear_blocks = clear_blocks_dcbz128_ppc; break; default: break; } #if HAVE_ALTIVEC if (has_altivec()) { mm_flags |= MM_ALTIVEC; VAR_0->pix_abs16x16_x2 = pix_abs16x16_x2_altivec; VAR_0->pix_abs16x16_y2 = pix_abs16x16_y2_altivec; VAR_0->pix_abs16x16_xy2 = pix_abs16x16_xy2_altivec; VAR_0->pix_abs16x16 = pix_abs16x16_altivec; VAR_0->pix_abs8x8 = pix_abs8x8_altivec; VAR_0->sad[0]= sad16x16_altivec; VAR_0->sad[1]= sad8x8_altivec; VAR_0->pix_norm1 = pix_norm1_altivec; VAR_0->sse[1]= sse8_altivec; VAR_0->sse[0]= sse16_altivec; VAR_0->pix_sum = pix_sum_altivec; VAR_0->diff_pixels = diff_pixels_altivec; VAR_0->get_pixels = get_pixels_altivec; #if 0 VAR_0->add_bytes= add_bytes_altivec; #endif VAR_0->put_pixels_tab[0][0] = put_pixels16_altivec; VAR_0->avg_pixels_tab[0][0] = avg_pixels16_altivec; #if 0 VAR_0->avg_pixels_tab[1][0] = avg_pixels8_altivec; #endif VAR_0->put_pixels_tab[1][3] = put_pixels8_xy2_altivec; VAR_0->put_no_rnd_pixels_tab[1][3] = put_no_rnd_pixels8_xy2_altivec; VAR_0->put_pixels_tab[0][3] = put_pixels16_xy2_altivec; VAR_0->put_no_rnd_pixels_tab[0][3] = put_no_rnd_pixels16_xy2_altivec; VAR_0->gmc1 = gmc1_altivec; if ((VAR_1->idct_algo == FF_IDCT_AUTO) || (VAR_1->idct_algo == FF_IDCT_ALTIVEC)) { VAR_0->idct_put = idct_put_altivec; VAR_0->idct_add = idct_add_altivec; #ifndef ALTIVEC_USE_REFERENCE_C_CODE VAR_0->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM; #else VAR_0->idct_permutation_type = FF_NO_IDCT_PERM; #endif } #ifdef POWERPC_TBL_PERFORMANCE_REPORT { int i; for (i = 0 ; i < powerpc_perf_total ; i++) { perfdata[i][powerpc_data_min] = 0xFFFFFFFFFFFFFFFF; perfdata[i][powerpc_data_max] = 0x0000000000000000; perfdata[i][powerpc_data_sum] = 0x0000000000000000; perfdata[i][powerpc_data_num] = 0x0000000000000000; #ifdef POWERPC_PERF_USE_PMC perfdata_pmc2[i][powerpc_data_min] = 0xFFFFFFFFFFFFFFFF; perfdata_pmc2[i][powerpc_data_max] = 0x0000000000000000; perfdata_pmc2[i][powerpc_data_sum] = 0x0000000000000000; perfdata_pmc2[i][powerpc_data_num] = 0x0000000000000000; perfdata_pmc3[i][powerpc_data_min] = 0xFFFFFFFFFFFFFFFF; perfdata_pmc3[i][powerpc_data_max] = 0x0000000000000000; perfdata_pmc3[i][powerpc_data_sum] = 0x0000000000000000; perfdata_pmc3[i][powerpc_data_num] = 0x0000000000000000; #endif } } #endif } else #endif { } }
[ "void FUNC_0(DSPContext* VAR_0, AVCodecContext *VAR_1)\n{", "switch (check_dcbzl_effect()) {", "case 32:\nVAR_0->clear_blocks = clear_blocks_dcbz32_ppc;", "break;", "case 128:\nVAR_0->clear_blocks = clear_blocks_dcbz128_ppc;", "break;", "default:\nbreak;", "}", "#if HAVE_ALTIVEC\nif (has_altivec()) {", "mm_flags |= MM_ALTIVEC;", "VAR_0->pix_abs16x16_x2 = pix_abs16x16_x2_altivec;", "VAR_0->pix_abs16x16_y2 = pix_abs16x16_y2_altivec;", "VAR_0->pix_abs16x16_xy2 = pix_abs16x16_xy2_altivec;", "VAR_0->pix_abs16x16 = pix_abs16x16_altivec;", "VAR_0->pix_abs8x8 = pix_abs8x8_altivec;", "VAR_0->sad[0]= sad16x16_altivec;", "VAR_0->sad[1]= sad8x8_altivec;", "VAR_0->pix_norm1 = pix_norm1_altivec;", "VAR_0->sse[1]= sse8_altivec;", "VAR_0->sse[0]= sse16_altivec;", "VAR_0->pix_sum = pix_sum_altivec;", "VAR_0->diff_pixels = diff_pixels_altivec;", "VAR_0->get_pixels = get_pixels_altivec;", "#if 0\nVAR_0->add_bytes= add_bytes_altivec;", "#endif\nVAR_0->put_pixels_tab[0][0] = put_pixels16_altivec;", "VAR_0->avg_pixels_tab[0][0] = avg_pixels16_altivec;", "#if 0\nVAR_0->avg_pixels_tab[1][0] = avg_pixels8_altivec;", "#endif\nVAR_0->put_pixels_tab[1][3] = put_pixels8_xy2_altivec;", "VAR_0->put_no_rnd_pixels_tab[1][3] = put_no_rnd_pixels8_xy2_altivec;", "VAR_0->put_pixels_tab[0][3] = put_pixels16_xy2_altivec;", "VAR_0->put_no_rnd_pixels_tab[0][3] = put_no_rnd_pixels16_xy2_altivec;", "VAR_0->gmc1 = gmc1_altivec;", "if ((VAR_1->idct_algo == FF_IDCT_AUTO) ||\n(VAR_1->idct_algo == FF_IDCT_ALTIVEC))\n{", "VAR_0->idct_put = idct_put_altivec;", "VAR_0->idct_add = idct_add_altivec;", "#ifndef ALTIVEC_USE_REFERENCE_C_CODE\nVAR_0->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM;", "#else\nVAR_0->idct_permutation_type = FF_NO_IDCT_PERM;", "#endif\n}", "#ifdef POWERPC_TBL_PERFORMANCE_REPORT\n{", "int i;", "for (i = 0 ; i < powerpc_perf_total ; i++)", "{", "perfdata[i][powerpc_data_min] = 0xFFFFFFFFFFFFFFFF;", "perfdata[i][powerpc_data_max] = 0x0000000000000000;", "perfdata[i][powerpc_data_sum] = 0x0000000000000000;", "perfdata[i][powerpc_data_num] = 0x0000000000000000;", "#ifdef POWERPC_PERF_USE_PMC\nperfdata_pmc2[i][powerpc_data_min] = 0xFFFFFFFFFFFFFFFF;", "perfdata_pmc2[i][powerpc_data_max] = 0x0000000000000000;", "perfdata_pmc2[i][powerpc_data_sum] = 0x0000000000000000;", "perfdata_pmc2[i][powerpc_data_num] = 0x0000000000000000;", "perfdata_pmc3[i][powerpc_data_min] = 0xFFFFFFFFFFFFFFFF;", "perfdata_pmc3[i][powerpc_data_max] = 0x0000000000000000;", "perfdata_pmc3[i][powerpc_data_sum] = 0x0000000000000000;", "perfdata_pmc3[i][powerpc_data_num] = 0x0000000000000000;", "#endif\n}", "}", "#endif\n} else", "#endif\n{", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 9 ], [ 11, 13 ], [ 15 ], [ 17, 19 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 31, 33 ], [ 35 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69, 71 ], [ 73, 75 ], [ 77 ], [ 81, 83 ], [ 85, 87 ], [ 89 ], [ 91 ], [ 93 ], [ 97 ], [ 101, 103, 105 ], [ 107 ], [ 109 ], [ 111, 113 ], [ 115, 117 ], [ 119, 121 ], [ 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 ], [ 181 ], [ 183 ] ]
12,014
static inline void RENAME(rgb24tobgr15)(const uint8_t *src, uint8_t *dst, long src_size) { const uint8_t *s = src; const uint8_t *end; #if COMPILE_TEMPLATE_MMX const uint8_t *mm_end; #endif uint16_t *d = (uint16_t *)dst; end = s + src_size; #if COMPILE_TEMPLATE_MMX __asm__ volatile(PREFETCH" %0"::"m"(*src):"memory"); __asm__ volatile( "movq %0, %%mm7 \n\t" "movq %1, %%mm6 \n\t" ::"m"(red_15mask),"m"(green_15mask)); mm_end = end - 11; while (s < mm_end) { __asm__ volatile( PREFETCH" 32%1 \n\t" "movd %1, %%mm0 \n\t" "movd 3%1, %%mm3 \n\t" "punpckldq 6%1, %%mm0 \n\t" "punpckldq 9%1, %%mm3 \n\t" "movq %%mm0, %%mm1 \n\t" "movq %%mm0, %%mm2 \n\t" "movq %%mm3, %%mm4 \n\t" "movq %%mm3, %%mm5 \n\t" "psrlq $3, %%mm0 \n\t" "psrlq $3, %%mm3 \n\t" "pand %2, %%mm0 \n\t" "pand %2, %%mm3 \n\t" "psrlq $6, %%mm1 \n\t" "psrlq $6, %%mm4 \n\t" "pand %%mm6, %%mm1 \n\t" "pand %%mm6, %%mm4 \n\t" "psrlq $9, %%mm2 \n\t" "psrlq $9, %%mm5 \n\t" "pand %%mm7, %%mm2 \n\t" "pand %%mm7, %%mm5 \n\t" "por %%mm1, %%mm0 \n\t" "por %%mm4, %%mm3 \n\t" "por %%mm2, %%mm0 \n\t" "por %%mm5, %%mm3 \n\t" "psllq $16, %%mm3 \n\t" "por %%mm3, %%mm0 \n\t" MOVNTQ" %%mm0, %0 \n\t" :"=m"(*d):"m"(*s),"m"(blue_15mask):"memory"); d += 4; s += 12; } __asm__ volatile(SFENCE:::"memory"); __asm__ volatile(EMMS:::"memory"); #endif while (s < end) { const int b = *s++; const int g = *s++; const int r = *s++; *d++ = (b>>3) | ((g&0xF8)<<2) | ((r&0xF8)<<7); } }
false
FFmpeg
d1adad3cca407f493c3637e20ecd4f7124e69212
static inline void RENAME(rgb24tobgr15)(const uint8_t *src, uint8_t *dst, long src_size) { const uint8_t *s = src; const uint8_t *end; #if COMPILE_TEMPLATE_MMX const uint8_t *mm_end; #endif uint16_t *d = (uint16_t *)dst; end = s + src_size; #if COMPILE_TEMPLATE_MMX __asm__ volatile(PREFETCH" %0"::"m"(*src):"memory"); __asm__ volatile( "movq %0, %%mm7 \n\t" "movq %1, %%mm6 \n\t" ::"m"(red_15mask),"m"(green_15mask)); mm_end = end - 11; while (s < mm_end) { __asm__ volatile( PREFETCH" 32%1 \n\t" "movd %1, %%mm0 \n\t" "movd 3%1, %%mm3 \n\t" "punpckldq 6%1, %%mm0 \n\t" "punpckldq 9%1, %%mm3 \n\t" "movq %%mm0, %%mm1 \n\t" "movq %%mm0, %%mm2 \n\t" "movq %%mm3, %%mm4 \n\t" "movq %%mm3, %%mm5 \n\t" "psrlq $3, %%mm0 \n\t" "psrlq $3, %%mm3 \n\t" "pand %2, %%mm0 \n\t" "pand %2, %%mm3 \n\t" "psrlq $6, %%mm1 \n\t" "psrlq $6, %%mm4 \n\t" "pand %%mm6, %%mm1 \n\t" "pand %%mm6, %%mm4 \n\t" "psrlq $9, %%mm2 \n\t" "psrlq $9, %%mm5 \n\t" "pand %%mm7, %%mm2 \n\t" "pand %%mm7, %%mm5 \n\t" "por %%mm1, %%mm0 \n\t" "por %%mm4, %%mm3 \n\t" "por %%mm2, %%mm0 \n\t" "por %%mm5, %%mm3 \n\t" "psllq $16, %%mm3 \n\t" "por %%mm3, %%mm0 \n\t" MOVNTQ" %%mm0, %0 \n\t" :"=m"(*d):"m"(*s),"m"(blue_15mask):"memory"); d += 4; s += 12; } __asm__ volatile(SFENCE:::"memory"); __asm__ volatile(EMMS:::"memory"); #endif while (s < end) { const int b = *s++; const int g = *s++; const int r = *s++; *d++ = (b>>3) | ((g&0xF8)<<2) | ((r&0xF8)<<7); } }
{ "code": [], "line_no": [] }
static inline void FUNC_0(rgb24tobgr15)(const uint8_t *src, uint8_t *dst, long src_size) { const uint8_t *VAR_0 = src; const uint8_t *VAR_1; #if COMPILE_TEMPLATE_MMX const uint8_t *mm_end; #endif uint16_t *d = (uint16_t *)dst; VAR_1 = VAR_0 + src_size; #if COMPILE_TEMPLATE_MMX __asm__ volatile(PREFETCH" %0"::"m"(*src):"memory"); __asm__ volatile( "movq %0, %%mm7 \n\t" "movq %1, %%mm6 \n\t" ::"m"(red_15mask),"m"(green_15mask)); mm_end = VAR_1 - 11; while (VAR_0 < mm_end) { __asm__ volatile( PREFETCH" 32%1 \n\t" "movd %1, %%mm0 \n\t" "movd 3%1, %%mm3 \n\t" "punpckldq 6%1, %%mm0 \n\t" "punpckldq 9%1, %%mm3 \n\t" "movq %%mm0, %%mm1 \n\t" "movq %%mm0, %%mm2 \n\t" "movq %%mm3, %%mm4 \n\t" "movq %%mm3, %%mm5 \n\t" "psrlq $3, %%mm0 \n\t" "psrlq $3, %%mm3 \n\t" "pand %2, %%mm0 \n\t" "pand %2, %%mm3 \n\t" "psrlq $6, %%mm1 \n\t" "psrlq $6, %%mm4 \n\t" "pand %%mm6, %%mm1 \n\t" "pand %%mm6, %%mm4 \n\t" "psrlq $9, %%mm2 \n\t" "psrlq $9, %%mm5 \n\t" "pand %%mm7, %%mm2 \n\t" "pand %%mm7, %%mm5 \n\t" "por %%mm1, %%mm0 \n\t" "por %%mm4, %%mm3 \n\t" "por %%mm2, %%mm0 \n\t" "por %%mm5, %%mm3 \n\t" "psllq $16, %%mm3 \n\t" "por %%mm3, %%mm0 \n\t" MOVNTQ" %%mm0, %0 \n\t" :"=m"(*d):"m"(*VAR_0),"m"(blue_15mask):"memory"); d += 4; VAR_0 += 12; } __asm__ volatile(SFENCE:::"memory"); __asm__ volatile(EMMS:::"memory"); #endif while (VAR_0 < VAR_1) { const int VAR_2 = *VAR_0++; const int VAR_3 = *VAR_0++; const int VAR_4 = *VAR_0++; *d++ = (VAR_2>>3) | ((VAR_3&0xF8)<<2) | ((VAR_4&0xF8)<<7); } }
[ "static inline void FUNC_0(rgb24tobgr15)(const uint8_t *src, uint8_t *dst, long src_size)\n{", "const uint8_t *VAR_0 = src;", "const uint8_t *VAR_1;", "#if COMPILE_TEMPLATE_MMX\nconst uint8_t *mm_end;", "#endif\nuint16_t *d = (uint16_t *)dst;", "VAR_1 = VAR_0 + src_size;", "#if COMPILE_TEMPLATE_MMX\n__asm__ volatile(PREFETCH\" %0\"::\"m\"(*src):\"memory\");", "__asm__ volatile(\n\"movq %0, %%mm7 \\n\\t\"\n\"movq %1, %%mm6 \\n\\t\"\n::\"m\"(red_15mask),\"m\"(green_15mask));", "mm_end = VAR_1 - 11;", "while (VAR_0 < mm_end) {", "__asm__ volatile(\nPREFETCH\" 32%1 \\n\\t\"\n\"movd %1, %%mm0 \\n\\t\"\n\"movd 3%1, %%mm3 \\n\\t\"\n\"punpckldq 6%1, %%mm0 \\n\\t\"\n\"punpckldq 9%1, %%mm3 \\n\\t\"\n\"movq %%mm0, %%mm1 \\n\\t\"\n\"movq %%mm0, %%mm2 \\n\\t\"\n\"movq %%mm3, %%mm4 \\n\\t\"\n\"movq %%mm3, %%mm5 \\n\\t\"\n\"psrlq $3, %%mm0 \\n\\t\"\n\"psrlq $3, %%mm3 \\n\\t\"\n\"pand %2, %%mm0 \\n\\t\"\n\"pand %2, %%mm3 \\n\\t\"\n\"psrlq $6, %%mm1 \\n\\t\"\n\"psrlq $6, %%mm4 \\n\\t\"\n\"pand %%mm6, %%mm1 \\n\\t\"\n\"pand %%mm6, %%mm4 \\n\\t\"\n\"psrlq $9, %%mm2 \\n\\t\"\n\"psrlq $9, %%mm5 \\n\\t\"\n\"pand %%mm7, %%mm2 \\n\\t\"\n\"pand %%mm7, %%mm5 \\n\\t\"\n\"por %%mm1, %%mm0 \\n\\t\"\n\"por %%mm4, %%mm3 \\n\\t\"\n\"por %%mm2, %%mm0 \\n\\t\"\n\"por %%mm5, %%mm3 \\n\\t\"\n\"psllq $16, %%mm3 \\n\\t\"\n\"por %%mm3, %%mm0 \\n\\t\"\nMOVNTQ\" %%mm0, %0 \\n\\t\"\n:\"=m\"(*d):\"m\"(*VAR_0),\"m\"(blue_15mask):\"memory\");", "d += 4;", "VAR_0 += 12;", "}", "__asm__ volatile(SFENCE:::\"memory\");", "__asm__ volatile(EMMS:::\"memory\");", "#endif\nwhile (VAR_0 < VAR_1) {", "const int VAR_2 = *VAR_0++;", "const int VAR_3 = *VAR_0++;", "const int VAR_4 = *VAR_0++;", "*d++ = (VAR_2>>3) | ((VAR_3&0xF8)<<2) | ((VAR_4&0xF8)<<7);", "}", "}" ]
[ 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 ] ]
12,015
static double compute_target_delay(double delay, VideoState *is) { double sync_threshold, diff; /* update delay to follow master synchronisation source */ if (get_master_sync_type(is) != AV_SYNC_VIDEO_MASTER) { /* if video is slave, we try to correct big delays by duplicating or deleting a frame */ diff = get_video_clock(is) - get_master_clock(is); /* skip or repeat frame. We take into account the delay to compute the threshold. I still don't know if it is the best guess */ sync_threshold = FFMAX(AV_SYNC_THRESHOLD, delay); if (fabs(diff) < AV_NOSYNC_THRESHOLD) { if (diff <= -sync_threshold) delay = 0; else if (diff >= sync_threshold) delay = 2 * delay; } } av_dlog(NULL, "video: delay=%0.3f A-V=%f\n", delay, -diff); return delay; }
false
FFmpeg
26c208cf0ff59efd7786528884a64d35fc42e9bf
static double compute_target_delay(double delay, VideoState *is) { double sync_threshold, diff; if (get_master_sync_type(is) != AV_SYNC_VIDEO_MASTER) { diff = get_video_clock(is) - get_master_clock(is); sync_threshold = FFMAX(AV_SYNC_THRESHOLD, delay); if (fabs(diff) < AV_NOSYNC_THRESHOLD) { if (diff <= -sync_threshold) delay = 0; else if (diff >= sync_threshold) delay = 2 * delay; } } av_dlog(NULL, "video: delay=%0.3f A-V=%f\n", delay, -diff); return delay; }
{ "code": [], "line_no": [] }
static double FUNC_0(double VAR_0, VideoState *VAR_1) { double VAR_2, VAR_3; if (get_master_sync_type(VAR_1) != AV_SYNC_VIDEO_MASTER) { VAR_3 = get_video_clock(VAR_1) - get_master_clock(VAR_1); VAR_2 = FFMAX(AV_SYNC_THRESHOLD, VAR_0); if (fabs(VAR_3) < AV_NOSYNC_THRESHOLD) { if (VAR_3 <= -VAR_2) VAR_0 = 0; else if (VAR_3 >= VAR_2) VAR_0 = 2 * VAR_0; } } av_dlog(NULL, "video: VAR_0=%0.3f A-V=%f\n", VAR_0, -VAR_3); return VAR_0; }
[ "static double FUNC_0(double VAR_0, VideoState *VAR_1)\n{", "double VAR_2, VAR_3;", "if (get_master_sync_type(VAR_1) != AV_SYNC_VIDEO_MASTER) {", "VAR_3 = get_video_clock(VAR_1) - get_master_clock(VAR_1);", "VAR_2 = FFMAX(AV_SYNC_THRESHOLD, VAR_0);", "if (fabs(VAR_3) < AV_NOSYNC_THRESHOLD) {", "if (VAR_3 <= -VAR_2)\nVAR_0 = 0;", "else if (VAR_3 >= VAR_2)\nVAR_0 = 2 * VAR_0;", "}", "}", "av_dlog(NULL, \"video: VAR_0=%0.3f A-V=%f\\n\",\nVAR_0, -VAR_3);", "return VAR_0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 11 ], [ 17 ], [ 27 ], [ 29 ], [ 31, 33 ], [ 35, 37 ], [ 39 ], [ 41 ], [ 45, 47 ], [ 51 ], [ 53 ] ]
12,016
static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, enum AVMediaType type) { OutputStream *ost; AVStream *st = avformat_new_stream(oc, NULL); int idx = oc->nb_streams - 1, ret = 0; int64_t max_frames = INT64_MAX; char *bsf = NULL, *next, *codec_tag = NULL; AVBitStreamFilterContext *bsfc, *bsfc_prev = NULL; double qscale = -1; char *buf = NULL, *arg = NULL, *preset = NULL; AVIOContext *s = NULL; if (!st) { av_log(NULL, AV_LOG_FATAL, "Could not alloc stream.\n"); exit_program(1); } if (oc->nb_streams - 1 < o->nb_streamid_map) st->id = o->streamid_map[oc->nb_streams - 1]; output_streams = grow_array(output_streams, sizeof(*output_streams), &nb_output_streams, nb_output_streams + 1); ost = &output_streams[nb_output_streams - 1]; ost->file_index = nb_output_files; ost->index = idx; ost->st = st; st->codec->codec_type = type; ost->enc = choose_codec(o, oc, st, type); if (ost->enc) { ost->opts = filter_codec_opts(codec_opts, ost->enc->id, oc, st); } avcodec_get_context_defaults3(st->codec, ost->enc); st->codec->codec_type = type; // XXX hack, avcodec_get_context_defaults2() sets type to unknown for stream copy MATCH_PER_STREAM_OPT(presets, str, preset, oc, st); if (preset && (!(ret = get_preset_file_2(preset, ost->enc->name, &s)))) { do { buf = get_line(s); if (!buf[0] || buf[0] == '#') { av_free(buf); continue; } if (!(arg = strchr(buf, '='))) { av_log(NULL, AV_LOG_FATAL, "Invalid line found in the preset file.\n"); exit_program(1); } *arg++ = 0; av_dict_set(&ost->opts, buf, arg, AV_DICT_DONT_OVERWRITE); av_free(buf); } while (!s->eof_reached); avio_close(s); } if (ret) { av_log(NULL, AV_LOG_FATAL, "Preset %s specified for stream %d:%d, but could not be opened.\n", preset, ost->file_index, ost->index); exit_program(1); } MATCH_PER_STREAM_OPT(max_frames, i64, max_frames, oc, st); ost->max_frames = max_frames; MATCH_PER_STREAM_OPT(bitstream_filters, str, bsf, oc, st); while (bsf) { if (next = strchr(bsf, ',')) *next++ = 0; if (!(bsfc = av_bitstream_filter_init(bsf))) { av_log(NULL, AV_LOG_FATAL, "Unknown bitstream filter %s\n", bsf); exit_program(1); } if (bsfc_prev) bsfc_prev->next = bsfc; else ost->bitstream_filters = bsfc; bsfc_prev = bsfc; bsf = next; } MATCH_PER_STREAM_OPT(codec_tags, str, codec_tag, oc, st); if (codec_tag) { uint32_t tag = strtol(codec_tag, &next, 0); if (*next) tag = AV_RL32(codec_tag); st->codec->codec_tag = tag; } MATCH_PER_STREAM_OPT(qscale, dbl, qscale, oc, st); if (qscale >= 0 || same_quant) { st->codec->flags |= CODEC_FLAG_QSCALE; st->codec->global_quality = FF_QP2LAMBDA * qscale; } if (oc->oformat->flags & AVFMT_GLOBALHEADER) st->codec->flags |= CODEC_FLAG_GLOBAL_HEADER; av_opt_get_int(sws_opts, "sws_flags", 0, &ost->sws_flags); return ost; }
false
FFmpeg
1b648c7cdbee335c642bd2c05fe624fc195b85e6
static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, enum AVMediaType type) { OutputStream *ost; AVStream *st = avformat_new_stream(oc, NULL); int idx = oc->nb_streams - 1, ret = 0; int64_t max_frames = INT64_MAX; char *bsf = NULL, *next, *codec_tag = NULL; AVBitStreamFilterContext *bsfc, *bsfc_prev = NULL; double qscale = -1; char *buf = NULL, *arg = NULL, *preset = NULL; AVIOContext *s = NULL; if (!st) { av_log(NULL, AV_LOG_FATAL, "Could not alloc stream.\n"); exit_program(1); } if (oc->nb_streams - 1 < o->nb_streamid_map) st->id = o->streamid_map[oc->nb_streams - 1]; output_streams = grow_array(output_streams, sizeof(*output_streams), &nb_output_streams, nb_output_streams + 1); ost = &output_streams[nb_output_streams - 1]; ost->file_index = nb_output_files; ost->index = idx; ost->st = st; st->codec->codec_type = type; ost->enc = choose_codec(o, oc, st, type); if (ost->enc) { ost->opts = filter_codec_opts(codec_opts, ost->enc->id, oc, st); } avcodec_get_context_defaults3(st->codec, ost->enc); st->codec->codec_type = type; MATCH_PER_STREAM_OPT(presets, str, preset, oc, st); if (preset && (!(ret = get_preset_file_2(preset, ost->enc->name, &s)))) { do { buf = get_line(s); if (!buf[0] || buf[0] == '#') { av_free(buf); continue; } if (!(arg = strchr(buf, '='))) { av_log(NULL, AV_LOG_FATAL, "Invalid line found in the preset file.\n"); exit_program(1); } *arg++ = 0; av_dict_set(&ost->opts, buf, arg, AV_DICT_DONT_OVERWRITE); av_free(buf); } while (!s->eof_reached); avio_close(s); } if (ret) { av_log(NULL, AV_LOG_FATAL, "Preset %s specified for stream %d:%d, but could not be opened.\n", preset, ost->file_index, ost->index); exit_program(1); } MATCH_PER_STREAM_OPT(max_frames, i64, max_frames, oc, st); ost->max_frames = max_frames; MATCH_PER_STREAM_OPT(bitstream_filters, str, bsf, oc, st); while (bsf) { if (next = strchr(bsf, ',')) *next++ = 0; if (!(bsfc = av_bitstream_filter_init(bsf))) { av_log(NULL, AV_LOG_FATAL, "Unknown bitstream filter %s\n", bsf); exit_program(1); } if (bsfc_prev) bsfc_prev->next = bsfc; else ost->bitstream_filters = bsfc; bsfc_prev = bsfc; bsf = next; } MATCH_PER_STREAM_OPT(codec_tags, str, codec_tag, oc, st); if (codec_tag) { uint32_t tag = strtol(codec_tag, &next, 0); if (*next) tag = AV_RL32(codec_tag); st->codec->codec_tag = tag; } MATCH_PER_STREAM_OPT(qscale, dbl, qscale, oc, st); if (qscale >= 0 || same_quant) { st->codec->flags |= CODEC_FLAG_QSCALE; st->codec->global_quality = FF_QP2LAMBDA * qscale; } if (oc->oformat->flags & AVFMT_GLOBALHEADER) st->codec->flags |= CODEC_FLAG_GLOBAL_HEADER; av_opt_get_int(sws_opts, "sws_flags", 0, &ost->sws_flags); return ost; }
{ "code": [], "line_no": [] }
static OutputStream *FUNC_0(OptionsContext *o, AVFormatContext *oc, enum AVMediaType type) { OutputStream *ost; AVStream *st = avformat_new_stream(oc, NULL); int VAR_0 = oc->nb_streams - 1, VAR_1 = 0; int64_t max_frames = INT64_MAX; char *VAR_2 = NULL, *VAR_3, *VAR_4 = NULL; AVBitStreamFilterContext *bsfc, *bsfc_prev = NULL; double VAR_5 = -1; char *VAR_6 = NULL, *VAR_7 = NULL, *VAR_8 = NULL; AVIOContext *s = NULL; if (!st) { av_log(NULL, AV_LOG_FATAL, "Could not alloc stream.\n"); exit_program(1); } if (oc->nb_streams - 1 < o->nb_streamid_map) st->id = o->streamid_map[oc->nb_streams - 1]; output_streams = grow_array(output_streams, sizeof(*output_streams), &nb_output_streams, nb_output_streams + 1); ost = &output_streams[nb_output_streams - 1]; ost->file_index = nb_output_files; ost->index = VAR_0; ost->st = st; st->codec->codec_type = type; ost->enc = choose_codec(o, oc, st, type); if (ost->enc) { ost->opts = filter_codec_opts(codec_opts, ost->enc->id, oc, st); } avcodec_get_context_defaults3(st->codec, ost->enc); st->codec->codec_type = type; MATCH_PER_STREAM_OPT(presets, str, VAR_8, oc, st); if (VAR_8 && (!(VAR_1 = get_preset_file_2(VAR_8, ost->enc->name, &s)))) { do { VAR_6 = get_line(s); if (!VAR_6[0] || VAR_6[0] == '#') { av_free(VAR_6); continue; } if (!(VAR_7 = strchr(VAR_6, '='))) { av_log(NULL, AV_LOG_FATAL, "Invalid line found in the VAR_8 file.\n"); exit_program(1); } *VAR_7++ = 0; av_dict_set(&ost->opts, VAR_6, VAR_7, AV_DICT_DONT_OVERWRITE); av_free(VAR_6); } while (!s->eof_reached); avio_close(s); } if (VAR_1) { av_log(NULL, AV_LOG_FATAL, "Preset %s specified for stream %d:%d, but could not be opened.\n", VAR_8, ost->file_index, ost->index); exit_program(1); } MATCH_PER_STREAM_OPT(max_frames, i64, max_frames, oc, st); ost->max_frames = max_frames; MATCH_PER_STREAM_OPT(bitstream_filters, str, VAR_2, oc, st); while (VAR_2) { if (VAR_3 = strchr(VAR_2, ',')) *VAR_3++ = 0; if (!(bsfc = av_bitstream_filter_init(VAR_2))) { av_log(NULL, AV_LOG_FATAL, "Unknown bitstream filter %s\n", VAR_2); exit_program(1); } if (bsfc_prev) bsfc_prev->VAR_3 = bsfc; else ost->bitstream_filters = bsfc; bsfc_prev = bsfc; VAR_2 = VAR_3; } MATCH_PER_STREAM_OPT(codec_tags, str, VAR_4, oc, st); if (VAR_4) { uint32_t tag = strtol(VAR_4, &VAR_3, 0); if (*VAR_3) tag = AV_RL32(VAR_4); st->codec->VAR_4 = tag; } MATCH_PER_STREAM_OPT(VAR_5, dbl, VAR_5, oc, st); if (VAR_5 >= 0 || same_quant) { st->codec->flags |= CODEC_FLAG_QSCALE; st->codec->global_quality = FF_QP2LAMBDA * VAR_5; } if (oc->oformat->flags & AVFMT_GLOBALHEADER) st->codec->flags |= CODEC_FLAG_GLOBAL_HEADER; av_opt_get_int(sws_opts, "sws_flags", 0, &ost->sws_flags); return ost; }
[ "static OutputStream *FUNC_0(OptionsContext *o, AVFormatContext *oc, enum AVMediaType type)\n{", "OutputStream *ost;", "AVStream *st = avformat_new_stream(oc, NULL);", "int VAR_0 = oc->nb_streams - 1, VAR_1 = 0;", "int64_t max_frames = INT64_MAX;", "char *VAR_2 = NULL, *VAR_3, *VAR_4 = NULL;", "AVBitStreamFilterContext *bsfc, *bsfc_prev = NULL;", "double VAR_5 = -1;", "char *VAR_6 = NULL, *VAR_7 = NULL, *VAR_8 = NULL;", "AVIOContext *s = NULL;", "if (!st) {", "av_log(NULL, AV_LOG_FATAL, \"Could not alloc stream.\\n\");", "exit_program(1);", "}", "if (oc->nb_streams - 1 < o->nb_streamid_map)\nst->id = o->streamid_map[oc->nb_streams - 1];", "output_streams = grow_array(output_streams, sizeof(*output_streams), &nb_output_streams,\nnb_output_streams + 1);", "ost = &output_streams[nb_output_streams - 1];", "ost->file_index = nb_output_files;", "ost->index = VAR_0;", "ost->st = st;", "st->codec->codec_type = type;", "ost->enc = choose_codec(o, oc, st, type);", "if (ost->enc) {", "ost->opts = filter_codec_opts(codec_opts, ost->enc->id, oc, st);", "}", "avcodec_get_context_defaults3(st->codec, ost->enc);", "st->codec->codec_type = type;", "MATCH_PER_STREAM_OPT(presets, str, VAR_8, oc, st);", "if (VAR_8 && (!(VAR_1 = get_preset_file_2(VAR_8, ost->enc->name, &s)))) {", "do {", "VAR_6 = get_line(s);", "if (!VAR_6[0] || VAR_6[0] == '#') {", "av_free(VAR_6);", "continue;", "}", "if (!(VAR_7 = strchr(VAR_6, '='))) {", "av_log(NULL, AV_LOG_FATAL, \"Invalid line found in the VAR_8 file.\\n\");", "exit_program(1);", "}", "*VAR_7++ = 0;", "av_dict_set(&ost->opts, VAR_6, VAR_7, AV_DICT_DONT_OVERWRITE);", "av_free(VAR_6);", "} while (!s->eof_reached);", "avio_close(s);", "}", "if (VAR_1) {", "av_log(NULL, AV_LOG_FATAL,\n\"Preset %s specified for stream %d:%d, but could not be opened.\\n\",\nVAR_8, ost->file_index, ost->index);", "exit_program(1);", "}", "MATCH_PER_STREAM_OPT(max_frames, i64, max_frames, oc, st);", "ost->max_frames = max_frames;", "MATCH_PER_STREAM_OPT(bitstream_filters, str, VAR_2, oc, st);", "while (VAR_2) {", "if (VAR_3 = strchr(VAR_2, ','))\n*VAR_3++ = 0;", "if (!(bsfc = av_bitstream_filter_init(VAR_2))) {", "av_log(NULL, AV_LOG_FATAL, \"Unknown bitstream filter %s\\n\", VAR_2);", "exit_program(1);", "}", "if (bsfc_prev)\nbsfc_prev->VAR_3 = bsfc;", "else\nost->bitstream_filters = bsfc;", "bsfc_prev = bsfc;", "VAR_2 = VAR_3;", "}", "MATCH_PER_STREAM_OPT(codec_tags, str, VAR_4, oc, st);", "if (VAR_4) {", "uint32_t tag = strtol(VAR_4, &VAR_3, 0);", "if (*VAR_3)\ntag = AV_RL32(VAR_4);", "st->codec->VAR_4 = tag;", "}", "MATCH_PER_STREAM_OPT(VAR_5, dbl, VAR_5, oc, st);", "if (VAR_5 >= 0 || same_quant) {", "st->codec->flags |= CODEC_FLAG_QSCALE;", "st->codec->global_quality = FF_QP2LAMBDA * VAR_5;", "}", "if (oc->oformat->flags & AVFMT_GLOBALHEADER)\nst->codec->flags |= CODEC_FLAG_GLOBAL_HEADER;", "av_opt_get_int(sws_opts, \"sws_flags\", 0, &ost->sws_flags);", "return ost;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35, 37 ], [ 41, 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109, 111, 113 ], [ 115 ], [ 117 ], [ 121 ], [ 123 ], [ 127 ], [ 129 ], [ 131, 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143, 145 ], [ 147, 149 ], [ 153 ], [ 155 ], [ 157 ], [ 161 ], [ 163 ], [ 165 ], [ 167, 169 ], [ 171 ], [ 173 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 189, 191 ], [ 195 ], [ 197 ], [ 199 ] ]
12,017
static unsigned int dec_lz_r(DisasContext *dc) { TCGv t0; DIS(fprintf (logfile, "lz $r%u, $r%u\n", dc->op1, dc->op2)); cris_cc_mask(dc, CC_MASK_NZ); t0 = tcg_temp_new(TCG_TYPE_TL); dec_prep_alu_r(dc, dc->op1, dc->op2, 4, 0, cpu_R[dc->op2], t0); cris_alu(dc, CC_OP_LZ, cpu_R[dc->op2], cpu_R[dc->op2], t0, 4); tcg_temp_free(t0); return 2; }
false
qemu
a7812ae412311d7d47f8aa85656faadac9d64b56
static unsigned int dec_lz_r(DisasContext *dc) { TCGv t0; DIS(fprintf (logfile, "lz $r%u, $r%u\n", dc->op1, dc->op2)); cris_cc_mask(dc, CC_MASK_NZ); t0 = tcg_temp_new(TCG_TYPE_TL); dec_prep_alu_r(dc, dc->op1, dc->op2, 4, 0, cpu_R[dc->op2], t0); cris_alu(dc, CC_OP_LZ, cpu_R[dc->op2], cpu_R[dc->op2], t0, 4); tcg_temp_free(t0); return 2; }
{ "code": [], "line_no": [] }
static unsigned int FUNC_0(DisasContext *VAR_0) { TCGv t0; DIS(fprintf (logfile, "lz $r%u, $r%u\n", VAR_0->op1, VAR_0->op2)); cris_cc_mask(VAR_0, CC_MASK_NZ); t0 = tcg_temp_new(TCG_TYPE_TL); dec_prep_alu_r(VAR_0, VAR_0->op1, VAR_0->op2, 4, 0, cpu_R[VAR_0->op2], t0); cris_alu(VAR_0, CC_OP_LZ, cpu_R[VAR_0->op2], cpu_R[VAR_0->op2], t0, 4); tcg_temp_free(t0); return 2; }
[ "static unsigned int FUNC_0(DisasContext *VAR_0)\n{", "TCGv t0;", "DIS(fprintf (logfile, \"lz $r%u, $r%u\\n\",\nVAR_0->op1, VAR_0->op2));", "cris_cc_mask(VAR_0, CC_MASK_NZ);", "t0 = tcg_temp_new(TCG_TYPE_TL);", "dec_prep_alu_r(VAR_0, VAR_0->op1, VAR_0->op2, 4, 0, cpu_R[VAR_0->op2], t0);", "cris_alu(VAR_0, CC_OP_LZ, cpu_R[VAR_0->op2], cpu_R[VAR_0->op2], t0, 4);", "tcg_temp_free(t0);", "return 2;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ] ]
12,018
int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, enum PixelFormat pix_fmt, int padtop, int padbottom, int padleft, int padright, int *color) { uint8_t *optr; int y_shift; int x_shift; int yheight; int i, y; if (pix_fmt < 0 || pix_fmt >= PIX_FMT_NB || !is_yuv_planar(&pix_fmt_info[pix_fmt])) return -1; for (i = 0; i < 3; i++) { x_shift = i ? av_pix_fmt_descriptors[pix_fmt].log2_chroma_w : 0; y_shift = i ? av_pix_fmt_descriptors[pix_fmt].log2_chroma_h : 0; if (padtop || padleft) { memset(dst->data[i], color[i], dst->linesize[i] * (padtop >> y_shift) + (padleft >> x_shift)); } if (padleft || padright) { optr = dst->data[i] + dst->linesize[i] * (padtop >> y_shift) + (dst->linesize[i] - (padright >> x_shift)); yheight = (height - 1 - (padtop + padbottom)) >> y_shift; for (y = 0; y < yheight; y++) { memset(optr, color[i], (padleft + padright) >> x_shift); optr += dst->linesize[i]; } } if (src) { /* first line */ uint8_t *iptr = src->data[i]; optr = dst->data[i] + dst->linesize[i] * (padtop >> y_shift) + (padleft >> x_shift); memcpy(optr, iptr, (width - padleft - padright) >> x_shift); iptr += src->linesize[i]; optr = dst->data[i] + dst->linesize[i] * (padtop >> y_shift) + (dst->linesize[i] - (padright >> x_shift)); yheight = (height - 1 - (padtop + padbottom)) >> y_shift; for (y = 0; y < yheight; y++) { memset(optr, color[i], (padleft + padright) >> x_shift); memcpy(optr + ((padleft + padright) >> x_shift), iptr, (width - padleft - padright) >> x_shift); iptr += src->linesize[i]; optr += dst->linesize[i]; } } if (padbottom || padright) { optr = dst->data[i] + dst->linesize[i] * ((height - padbottom) >> y_shift) - (padright >> x_shift); memset(optr, color[i],dst->linesize[i] * (padbottom >> y_shift) + (padright >> x_shift)); } } return 0; }
false
FFmpeg
d7e14c0d103a2c9cca6c50568e09b40d6f48ea19
int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, enum PixelFormat pix_fmt, int padtop, int padbottom, int padleft, int padright, int *color) { uint8_t *optr; int y_shift; int x_shift; int yheight; int i, y; if (pix_fmt < 0 || pix_fmt >= PIX_FMT_NB || !is_yuv_planar(&pix_fmt_info[pix_fmt])) return -1; for (i = 0; i < 3; i++) { x_shift = i ? av_pix_fmt_descriptors[pix_fmt].log2_chroma_w : 0; y_shift = i ? av_pix_fmt_descriptors[pix_fmt].log2_chroma_h : 0; if (padtop || padleft) { memset(dst->data[i], color[i], dst->linesize[i] * (padtop >> y_shift) + (padleft >> x_shift)); } if (padleft || padright) { optr = dst->data[i] + dst->linesize[i] * (padtop >> y_shift) + (dst->linesize[i] - (padright >> x_shift)); yheight = (height - 1 - (padtop + padbottom)) >> y_shift; for (y = 0; y < yheight; y++) { memset(optr, color[i], (padleft + padright) >> x_shift); optr += dst->linesize[i]; } } if (src) { uint8_t *iptr = src->data[i]; optr = dst->data[i] + dst->linesize[i] * (padtop >> y_shift) + (padleft >> x_shift); memcpy(optr, iptr, (width - padleft - padright) >> x_shift); iptr += src->linesize[i]; optr = dst->data[i] + dst->linesize[i] * (padtop >> y_shift) + (dst->linesize[i] - (padright >> x_shift)); yheight = (height - 1 - (padtop + padbottom)) >> y_shift; for (y = 0; y < yheight; y++) { memset(optr, color[i], (padleft + padright) >> x_shift); memcpy(optr + ((padleft + padright) >> x_shift), iptr, (width - padleft - padright) >> x_shift); iptr += src->linesize[i]; optr += dst->linesize[i]; } } if (padbottom || padright) { optr = dst->data[i] + dst->linesize[i] * ((height - padbottom) >> y_shift) - (padright >> x_shift); memset(optr, color[i],dst->linesize[i] * (padbottom >> y_shift) + (padright >> x_shift)); } } return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(AVPicture *VAR_0, const AVPicture *VAR_1, int VAR_2, int VAR_3, enum PixelFormat VAR_4, int VAR_5, int VAR_6, int VAR_7, int VAR_8, int *VAR_9) { uint8_t *optr; int VAR_10; int VAR_11; int VAR_12; int VAR_13, VAR_14; if (VAR_4 < 0 || VAR_4 >= PIX_FMT_NB || !is_yuv_planar(&pix_fmt_info[VAR_4])) return -1; for (VAR_13 = 0; VAR_13 < 3; VAR_13++) { VAR_11 = VAR_13 ? av_pix_fmt_descriptors[VAR_4].log2_chroma_w : 0; VAR_10 = VAR_13 ? av_pix_fmt_descriptors[VAR_4].log2_chroma_h : 0; if (VAR_5 || VAR_7) { memset(VAR_0->data[VAR_13], VAR_9[VAR_13], VAR_0->linesize[VAR_13] * (VAR_5 >> VAR_10) + (VAR_7 >> VAR_11)); } if (VAR_7 || VAR_8) { optr = VAR_0->data[VAR_13] + VAR_0->linesize[VAR_13] * (VAR_5 >> VAR_10) + (VAR_0->linesize[VAR_13] - (VAR_8 >> VAR_11)); VAR_12 = (VAR_2 - 1 - (VAR_5 + VAR_6)) >> VAR_10; for (VAR_14 = 0; VAR_14 < VAR_12; VAR_14++) { memset(optr, VAR_9[VAR_13], (VAR_7 + VAR_8) >> VAR_11); optr += VAR_0->linesize[VAR_13]; } } if (VAR_1) { uint8_t *iptr = VAR_1->data[VAR_13]; optr = VAR_0->data[VAR_13] + VAR_0->linesize[VAR_13] * (VAR_5 >> VAR_10) + (VAR_7 >> VAR_11); memcpy(optr, iptr, (VAR_3 - VAR_7 - VAR_8) >> VAR_11); iptr += VAR_1->linesize[VAR_13]; optr = VAR_0->data[VAR_13] + VAR_0->linesize[VAR_13] * (VAR_5 >> VAR_10) + (VAR_0->linesize[VAR_13] - (VAR_8 >> VAR_11)); VAR_12 = (VAR_2 - 1 - (VAR_5 + VAR_6)) >> VAR_10; for (VAR_14 = 0; VAR_14 < VAR_12; VAR_14++) { memset(optr, VAR_9[VAR_13], (VAR_7 + VAR_8) >> VAR_11); memcpy(optr + ((VAR_7 + VAR_8) >> VAR_11), iptr, (VAR_3 - VAR_7 - VAR_8) >> VAR_11); iptr += VAR_1->linesize[VAR_13]; optr += VAR_0->linesize[VAR_13]; } } if (VAR_6 || VAR_8) { optr = VAR_0->data[VAR_13] + VAR_0->linesize[VAR_13] * ((VAR_2 - VAR_6) >> VAR_10) - (VAR_8 >> VAR_11); memset(optr, VAR_9[VAR_13],VAR_0->linesize[VAR_13] * (VAR_6 >> VAR_10) + (VAR_8 >> VAR_11)); } } return 0; }
[ "int FUNC_0(AVPicture *VAR_0, const AVPicture *VAR_1, int VAR_2, int VAR_3,\nenum PixelFormat VAR_4, int VAR_5, int VAR_6, int VAR_7, int VAR_8,\nint *VAR_9)\n{", "uint8_t *optr;", "int VAR_10;", "int VAR_11;", "int VAR_12;", "int VAR_13, VAR_14;", "if (VAR_4 < 0 || VAR_4 >= PIX_FMT_NB ||\n!is_yuv_planar(&pix_fmt_info[VAR_4])) return -1;", "for (VAR_13 = 0; VAR_13 < 3; VAR_13++) {", "VAR_11 = VAR_13 ? av_pix_fmt_descriptors[VAR_4].log2_chroma_w : 0;", "VAR_10 = VAR_13 ? av_pix_fmt_descriptors[VAR_4].log2_chroma_h : 0;", "if (VAR_5 || VAR_7) {", "memset(VAR_0->data[VAR_13], VAR_9[VAR_13],\nVAR_0->linesize[VAR_13] * (VAR_5 >> VAR_10) + (VAR_7 >> VAR_11));", "}", "if (VAR_7 || VAR_8) {", "optr = VAR_0->data[VAR_13] + VAR_0->linesize[VAR_13] * (VAR_5 >> VAR_10) +\n(VAR_0->linesize[VAR_13] - (VAR_8 >> VAR_11));", "VAR_12 = (VAR_2 - 1 - (VAR_5 + VAR_6)) >> VAR_10;", "for (VAR_14 = 0; VAR_14 < VAR_12; VAR_14++) {", "memset(optr, VAR_9[VAR_13], (VAR_7 + VAR_8) >> VAR_11);", "optr += VAR_0->linesize[VAR_13];", "}", "}", "if (VAR_1) {", "uint8_t *iptr = VAR_1->data[VAR_13];", "optr = VAR_0->data[VAR_13] + VAR_0->linesize[VAR_13] * (VAR_5 >> VAR_10) +\n(VAR_7 >> VAR_11);", "memcpy(optr, iptr, (VAR_3 - VAR_7 - VAR_8) >> VAR_11);", "iptr += VAR_1->linesize[VAR_13];", "optr = VAR_0->data[VAR_13] + VAR_0->linesize[VAR_13] * (VAR_5 >> VAR_10) +\n(VAR_0->linesize[VAR_13] - (VAR_8 >> VAR_11));", "VAR_12 = (VAR_2 - 1 - (VAR_5 + VAR_6)) >> VAR_10;", "for (VAR_14 = 0; VAR_14 < VAR_12; VAR_14++) {", "memset(optr, VAR_9[VAR_13], (VAR_7 + VAR_8) >> VAR_11);", "memcpy(optr + ((VAR_7 + VAR_8) >> VAR_11), iptr,\n(VAR_3 - VAR_7 - VAR_8) >> VAR_11);", "iptr += VAR_1->linesize[VAR_13];", "optr += VAR_0->linesize[VAR_13];", "}", "}", "if (VAR_6 || VAR_8) {", "optr = VAR_0->data[VAR_13] + VAR_0->linesize[VAR_13] *\n((VAR_2 - VAR_6) >> VAR_10) - (VAR_8 >> VAR_11);", "memset(optr, VAR_9[VAR_13],VAR_0->linesize[VAR_13] *\n(VAR_6 >> VAR_10) + (VAR_8 >> VAR_11));", "}", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21, 23 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37, 39 ], [ 41 ], [ 45 ], [ 47, 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 69, 71 ], [ 73 ], [ 75 ], [ 77, 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87, 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 101 ], [ 103, 105 ], [ 107, 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ] ]
12,019
void ppc_hash64_stop_access(uint64_t token) { if (kvmppc_kern_htab) { kvmppc_hash64_free_pteg(token); } }
false
qemu
c18ad9a54b75495ce61e8b28d353f8eec51768fc
void ppc_hash64_stop_access(uint64_t token) { if (kvmppc_kern_htab) { kvmppc_hash64_free_pteg(token); } }
{ "code": [], "line_no": [] }
void FUNC_0(uint64_t VAR_0) { if (kvmppc_kern_htab) { kvmppc_hash64_free_pteg(VAR_0); } }
[ "void FUNC_0(uint64_t VAR_0)\n{", "if (kvmppc_kern_htab) {", "kvmppc_hash64_free_pteg(VAR_0);", "}", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ] ]
12,020
void helper_sysret(CPUX86State *env, int dflag) { int cpl, selector; if (!(env->efer & MSR_EFER_SCE)) { raise_exception_err(env, EXCP06_ILLOP, 0); } cpl = env->hflags & HF_CPL_MASK; if (!(env->cr[0] & CR0_PE_MASK) || cpl != 0) { raise_exception_err(env, EXCP0D_GPF, 0); } selector = (env->star >> 48) & 0xffff; if (env->hflags & HF_LMA_MASK) { cpu_load_eflags(env, (uint32_t)(env->regs[11]), TF_MASK | AC_MASK | ID_MASK | IF_MASK | IOPL_MASK | VM_MASK | RF_MASK | NT_MASK); if (dflag == 2) { cpu_x86_load_seg_cache(env, R_CS, (selector + 16) | 3, 0, 0xffffffff, DESC_G_MASK | DESC_P_MASK | DESC_S_MASK | (3 << DESC_DPL_SHIFT) | DESC_CS_MASK | DESC_R_MASK | DESC_A_MASK | DESC_L_MASK); env->eip = env->regs[R_ECX]; } else { cpu_x86_load_seg_cache(env, R_CS, selector | 3, 0, 0xffffffff, DESC_G_MASK | DESC_B_MASK | DESC_P_MASK | DESC_S_MASK | (3 << DESC_DPL_SHIFT) | DESC_CS_MASK | DESC_R_MASK | DESC_A_MASK); env->eip = (uint32_t)env->regs[R_ECX]; } cpu_x86_load_seg_cache(env, R_SS, selector + 8, 0, 0xffffffff, DESC_G_MASK | DESC_B_MASK | DESC_P_MASK | DESC_S_MASK | (3 << DESC_DPL_SHIFT) | DESC_W_MASK | DESC_A_MASK); cpu_x86_set_cpl(env, 3); } else { env->eflags |= IF_MASK; cpu_x86_load_seg_cache(env, R_CS, selector | 3, 0, 0xffffffff, DESC_G_MASK | DESC_B_MASK | DESC_P_MASK | DESC_S_MASK | (3 << DESC_DPL_SHIFT) | DESC_CS_MASK | DESC_R_MASK | DESC_A_MASK); env->eip = (uint32_t)env->regs[R_ECX]; cpu_x86_load_seg_cache(env, R_SS, selector + 8, 0, 0xffffffff, DESC_G_MASK | DESC_B_MASK | DESC_P_MASK | DESC_S_MASK | (3 << DESC_DPL_SHIFT) | DESC_W_MASK | DESC_A_MASK); cpu_x86_set_cpl(env, 3); } }
false
qemu
7848c8d19f8556666df25044bbd5d8b29439c368
void helper_sysret(CPUX86State *env, int dflag) { int cpl, selector; if (!(env->efer & MSR_EFER_SCE)) { raise_exception_err(env, EXCP06_ILLOP, 0); } cpl = env->hflags & HF_CPL_MASK; if (!(env->cr[0] & CR0_PE_MASK) || cpl != 0) { raise_exception_err(env, EXCP0D_GPF, 0); } selector = (env->star >> 48) & 0xffff; if (env->hflags & HF_LMA_MASK) { cpu_load_eflags(env, (uint32_t)(env->regs[11]), TF_MASK | AC_MASK | ID_MASK | IF_MASK | IOPL_MASK | VM_MASK | RF_MASK | NT_MASK); if (dflag == 2) { cpu_x86_load_seg_cache(env, R_CS, (selector + 16) | 3, 0, 0xffffffff, DESC_G_MASK | DESC_P_MASK | DESC_S_MASK | (3 << DESC_DPL_SHIFT) | DESC_CS_MASK | DESC_R_MASK | DESC_A_MASK | DESC_L_MASK); env->eip = env->regs[R_ECX]; } else { cpu_x86_load_seg_cache(env, R_CS, selector | 3, 0, 0xffffffff, DESC_G_MASK | DESC_B_MASK | DESC_P_MASK | DESC_S_MASK | (3 << DESC_DPL_SHIFT) | DESC_CS_MASK | DESC_R_MASK | DESC_A_MASK); env->eip = (uint32_t)env->regs[R_ECX]; } cpu_x86_load_seg_cache(env, R_SS, selector + 8, 0, 0xffffffff, DESC_G_MASK | DESC_B_MASK | DESC_P_MASK | DESC_S_MASK | (3 << DESC_DPL_SHIFT) | DESC_W_MASK | DESC_A_MASK); cpu_x86_set_cpl(env, 3); } else { env->eflags |= IF_MASK; cpu_x86_load_seg_cache(env, R_CS, selector | 3, 0, 0xffffffff, DESC_G_MASK | DESC_B_MASK | DESC_P_MASK | DESC_S_MASK | (3 << DESC_DPL_SHIFT) | DESC_CS_MASK | DESC_R_MASK | DESC_A_MASK); env->eip = (uint32_t)env->regs[R_ECX]; cpu_x86_load_seg_cache(env, R_SS, selector + 8, 0, 0xffffffff, DESC_G_MASK | DESC_B_MASK | DESC_P_MASK | DESC_S_MASK | (3 << DESC_DPL_SHIFT) | DESC_W_MASK | DESC_A_MASK); cpu_x86_set_cpl(env, 3); } }
{ "code": [], "line_no": [] }
void FUNC_0(CPUX86State *VAR_0, int VAR_1) { int VAR_2, VAR_3; if (!(VAR_0->efer & MSR_EFER_SCE)) { raise_exception_err(VAR_0, EXCP06_ILLOP, 0); } VAR_2 = VAR_0->hflags & HF_CPL_MASK; if (!(VAR_0->cr[0] & CR0_PE_MASK) || VAR_2 != 0) { raise_exception_err(VAR_0, EXCP0D_GPF, 0); } VAR_3 = (VAR_0->star >> 48) & 0xffff; if (VAR_0->hflags & HF_LMA_MASK) { cpu_load_eflags(VAR_0, (uint32_t)(VAR_0->regs[11]), TF_MASK | AC_MASK | ID_MASK | IF_MASK | IOPL_MASK | VM_MASK | RF_MASK | NT_MASK); if (VAR_1 == 2) { cpu_x86_load_seg_cache(VAR_0, R_CS, (VAR_3 + 16) | 3, 0, 0xffffffff, DESC_G_MASK | DESC_P_MASK | DESC_S_MASK | (3 << DESC_DPL_SHIFT) | DESC_CS_MASK | DESC_R_MASK | DESC_A_MASK | DESC_L_MASK); VAR_0->eip = VAR_0->regs[R_ECX]; } else { cpu_x86_load_seg_cache(VAR_0, R_CS, VAR_3 | 3, 0, 0xffffffff, DESC_G_MASK | DESC_B_MASK | DESC_P_MASK | DESC_S_MASK | (3 << DESC_DPL_SHIFT) | DESC_CS_MASK | DESC_R_MASK | DESC_A_MASK); VAR_0->eip = (uint32_t)VAR_0->regs[R_ECX]; } cpu_x86_load_seg_cache(VAR_0, R_SS, VAR_3 + 8, 0, 0xffffffff, DESC_G_MASK | DESC_B_MASK | DESC_P_MASK | DESC_S_MASK | (3 << DESC_DPL_SHIFT) | DESC_W_MASK | DESC_A_MASK); cpu_x86_set_cpl(VAR_0, 3); } else { VAR_0->eflags |= IF_MASK; cpu_x86_load_seg_cache(VAR_0, R_CS, VAR_3 | 3, 0, 0xffffffff, DESC_G_MASK | DESC_B_MASK | DESC_P_MASK | DESC_S_MASK | (3 << DESC_DPL_SHIFT) | DESC_CS_MASK | DESC_R_MASK | DESC_A_MASK); VAR_0->eip = (uint32_t)VAR_0->regs[R_ECX]; cpu_x86_load_seg_cache(VAR_0, R_SS, VAR_3 + 8, 0, 0xffffffff, DESC_G_MASK | DESC_B_MASK | DESC_P_MASK | DESC_S_MASK | (3 << DESC_DPL_SHIFT) | DESC_W_MASK | DESC_A_MASK); cpu_x86_set_cpl(VAR_0, 3); } }
[ "void FUNC_0(CPUX86State *VAR_0, int VAR_1)\n{", "int VAR_2, VAR_3;", "if (!(VAR_0->efer & MSR_EFER_SCE)) {", "raise_exception_err(VAR_0, EXCP06_ILLOP, 0);", "}", "VAR_2 = VAR_0->hflags & HF_CPL_MASK;", "if (!(VAR_0->cr[0] & CR0_PE_MASK) || VAR_2 != 0) {", "raise_exception_err(VAR_0, EXCP0D_GPF, 0);", "}", "VAR_3 = (VAR_0->star >> 48) & 0xffff;", "if (VAR_0->hflags & HF_LMA_MASK) {", "cpu_load_eflags(VAR_0, (uint32_t)(VAR_0->regs[11]), TF_MASK | AC_MASK\n| ID_MASK | IF_MASK | IOPL_MASK | VM_MASK | RF_MASK |\nNT_MASK);", "if (VAR_1 == 2) {", "cpu_x86_load_seg_cache(VAR_0, R_CS, (VAR_3 + 16) | 3,\n0, 0xffffffff,\nDESC_G_MASK | DESC_P_MASK |\nDESC_S_MASK | (3 << DESC_DPL_SHIFT) |\nDESC_CS_MASK | DESC_R_MASK | DESC_A_MASK |\nDESC_L_MASK);", "VAR_0->eip = VAR_0->regs[R_ECX];", "} else {", "cpu_x86_load_seg_cache(VAR_0, R_CS, VAR_3 | 3,\n0, 0xffffffff,\nDESC_G_MASK | DESC_B_MASK | DESC_P_MASK |\nDESC_S_MASK | (3 << DESC_DPL_SHIFT) |\nDESC_CS_MASK | DESC_R_MASK | DESC_A_MASK);", "VAR_0->eip = (uint32_t)VAR_0->regs[R_ECX];", "}", "cpu_x86_load_seg_cache(VAR_0, R_SS, VAR_3 + 8,\n0, 0xffffffff,\nDESC_G_MASK | DESC_B_MASK | DESC_P_MASK |\nDESC_S_MASK | (3 << DESC_DPL_SHIFT) |\nDESC_W_MASK | DESC_A_MASK);", "cpu_x86_set_cpl(VAR_0, 3);", "} else {", "VAR_0->eflags |= IF_MASK;", "cpu_x86_load_seg_cache(VAR_0, R_CS, VAR_3 | 3,\n0, 0xffffffff,\nDESC_G_MASK | DESC_B_MASK | DESC_P_MASK |\nDESC_S_MASK | (3 << DESC_DPL_SHIFT) |\nDESC_CS_MASK | DESC_R_MASK | DESC_A_MASK);", "VAR_0->eip = (uint32_t)VAR_0->regs[R_ECX];", "cpu_x86_load_seg_cache(VAR_0, R_SS, VAR_3 + 8,\n0, 0xffffffff,\nDESC_G_MASK | DESC_B_MASK | DESC_P_MASK |\nDESC_S_MASK | (3 << DESC_DPL_SHIFT) |\nDESC_W_MASK | DESC_A_MASK);", "cpu_x86_set_cpl(VAR_0, 3);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 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 ] ]
12,021
static int handle_sigp(S390CPU *cpu, struct kvm_run *run, uint8_t ipa1) { CPUS390XState *env = &cpu->env; uint8_t order_code; uint16_t cpu_addr; int r = -1; S390CPU *target_cpu; cpu_synchronize_state(CPU(cpu)); /* get order code */ order_code = decode_basedisp_rs(env, run->s390_sieic.ipb) & SIGP_ORDER_MASK; cpu_addr = env->regs[ipa1 & 0x0f]; target_cpu = s390_cpu_addr2state(cpu_addr); if (target_cpu == NULL) { goto out; } switch (order_code) { case SIGP_START: r = kvm_s390_cpu_start(target_cpu); break; case SIGP_RESTART: r = kvm_s390_cpu_restart(target_cpu); break; case SIGP_SET_ARCH: /* make the caller panic */ return -1; case SIGP_INITIAL_CPU_RESET: r = s390_cpu_initial_reset(target_cpu); break; default: fprintf(stderr, "KVM: unknown SIGP: 0x%x\n", order_code); break; } out: setcc(cpu, r ? 3 : 0); return 0; }
false
qemu
3796f0e1cda41eacf4fc915e7edaf54f2279466c
static int handle_sigp(S390CPU *cpu, struct kvm_run *run, uint8_t ipa1) { CPUS390XState *env = &cpu->env; uint8_t order_code; uint16_t cpu_addr; int r = -1; S390CPU *target_cpu; cpu_synchronize_state(CPU(cpu)); order_code = decode_basedisp_rs(env, run->s390_sieic.ipb) & SIGP_ORDER_MASK; cpu_addr = env->regs[ipa1 & 0x0f]; target_cpu = s390_cpu_addr2state(cpu_addr); if (target_cpu == NULL) { goto out; } switch (order_code) { case SIGP_START: r = kvm_s390_cpu_start(target_cpu); break; case SIGP_RESTART: r = kvm_s390_cpu_restart(target_cpu); break; case SIGP_SET_ARCH: return -1; case SIGP_INITIAL_CPU_RESET: r = s390_cpu_initial_reset(target_cpu); break; default: fprintf(stderr, "KVM: unknown SIGP: 0x%x\n", order_code); break; } out: setcc(cpu, r ? 3 : 0); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(S390CPU *VAR_0, struct kvm_run *VAR_1, uint8_t VAR_2) { CPUS390XState *env = &VAR_0->env; uint8_t order_code; uint16_t cpu_addr; int VAR_3 = -1; S390CPU *target_cpu; cpu_synchronize_state(CPU(VAR_0)); order_code = decode_basedisp_rs(env, VAR_1->s390_sieic.ipb) & SIGP_ORDER_MASK; cpu_addr = env->regs[VAR_2 & 0x0f]; target_cpu = s390_cpu_addr2state(cpu_addr); if (target_cpu == NULL) { goto out; } switch (order_code) { case SIGP_START: VAR_3 = kvm_s390_cpu_start(target_cpu); break; case SIGP_RESTART: VAR_3 = kvm_s390_cpu_restart(target_cpu); break; case SIGP_SET_ARCH: return -1; case SIGP_INITIAL_CPU_RESET: VAR_3 = s390_cpu_initial_reset(target_cpu); break; default: fprintf(stderr, "KVM: unknown SIGP: 0x%x\n", order_code); break; } out: setcc(VAR_0, VAR_3 ? 3 : 0); return 0; }
[ "static int FUNC_0(S390CPU *VAR_0, struct kvm_run *VAR_1, uint8_t VAR_2)\n{", "CPUS390XState *env = &VAR_0->env;", "uint8_t order_code;", "uint16_t cpu_addr;", "int VAR_3 = -1;", "S390CPU *target_cpu;", "cpu_synchronize_state(CPU(VAR_0));", "order_code = decode_basedisp_rs(env, VAR_1->s390_sieic.ipb) & SIGP_ORDER_MASK;", "cpu_addr = env->regs[VAR_2 & 0x0f];", "target_cpu = s390_cpu_addr2state(cpu_addr);", "if (target_cpu == NULL) {", "goto out;", "}", "switch (order_code) {", "case SIGP_START:\nVAR_3 = kvm_s390_cpu_start(target_cpu);", "break;", "case SIGP_RESTART:\nVAR_3 = kvm_s390_cpu_restart(target_cpu);", "break;", "case SIGP_SET_ARCH:\nreturn -1;", "case SIGP_INITIAL_CPU_RESET:\nVAR_3 = s390_cpu_initial_reset(target_cpu);", "break;", "default:\nfprintf(stderr, \"KVM: unknown SIGP: 0x%x\\n\", order_code);", "break;", "}", "out:\nsetcc(VAR_0, VAR_3 ? 3 : 0);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41, 43 ], [ 45 ], [ 47, 49 ], [ 51 ], [ 53, 57 ], [ 59, 61 ], [ 63 ], [ 65, 67 ], [ 69 ], [ 71 ], [ 75, 77 ], [ 79 ], [ 81 ] ]
12,022
static void dump_ops(const uint16_t *opc_buf) { const uint16_t *opc_ptr; int c; opc_ptr = opc_buf; for(;;) { c = *opc_ptr++; fprintf(logfile, "0x%04x: %s\n", opc_ptr - opc_buf - 1, op_str[c]); if (c == INDEX_op_end) break; } }
false
qemu
9c605cb13547a5faa5cb1092e3e44ac8b0d0b841
static void dump_ops(const uint16_t *opc_buf) { const uint16_t *opc_ptr; int c; opc_ptr = opc_buf; for(;;) { c = *opc_ptr++; fprintf(logfile, "0x%04x: %s\n", opc_ptr - opc_buf - 1, op_str[c]); if (c == INDEX_op_end) break; } }
{ "code": [], "line_no": [] }
static void FUNC_0(const uint16_t *VAR_0) { const uint16_t *VAR_1; int VAR_2; VAR_1 = VAR_0; for(;;) { VAR_2 = *VAR_1++; fprintf(logfile, "0x%04x: %s\n", VAR_1 - VAR_0 - 1, op_str[VAR_2]); if (VAR_2 == INDEX_op_end) break; } }
[ "static void FUNC_0(const uint16_t *VAR_0)\n{", "const uint16_t *VAR_1;", "int VAR_2;", "VAR_1 = VAR_0;", "for(;;) {", "VAR_2 = *VAR_1++;", "fprintf(logfile, \"0x%04x: %s\\n\", VAR_1 - VAR_0 - 1, op_str[VAR_2]);", "if (VAR_2 == INDEX_op_end)\nbreak;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17, 19 ], [ 21 ], [ 23 ] ]
12,024
static int tap_set_sndbuf(TAPState *s, const char *sndbuf_str) { int sndbuf = TAP_DEFAULT_SNDBUF; if (sndbuf_str) { sndbuf = atoi(sndbuf_str); } if (!sndbuf) { sndbuf = INT_MAX; } if (ioctl(s->fd, TUNSETSNDBUF, &sndbuf) == -1 && sndbuf_str) { qemu_error("TUNSETSNDBUF ioctl failed: %s\n", strerror(errno)); return -1; } return 0; }
false
qemu
8a1c5235510da01a200693fe3cfd87acd2dc1fca
static int tap_set_sndbuf(TAPState *s, const char *sndbuf_str) { int sndbuf = TAP_DEFAULT_SNDBUF; if (sndbuf_str) { sndbuf = atoi(sndbuf_str); } if (!sndbuf) { sndbuf = INT_MAX; } if (ioctl(s->fd, TUNSETSNDBUF, &sndbuf) == -1 && sndbuf_str) { qemu_error("TUNSETSNDBUF ioctl failed: %s\n", strerror(errno)); return -1; } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(TAPState *VAR_0, const char *VAR_1) { int VAR_2 = TAP_DEFAULT_SNDBUF; if (VAR_1) { VAR_2 = atoi(VAR_1); } if (!VAR_2) { VAR_2 = INT_MAX; } if (ioctl(VAR_0->fd, TUNSETSNDBUF, &VAR_2) == -1 && VAR_1) { qemu_error("TUNSETSNDBUF ioctl failed: %VAR_0\n", strerror(errno)); return -1; } return 0; }
[ "static int FUNC_0(TAPState *VAR_0, const char *VAR_1)\n{", "int VAR_2 = TAP_DEFAULT_SNDBUF;", "if (VAR_1) {", "VAR_2 = atoi(VAR_1);", "}", "if (!VAR_2) {", "VAR_2 = INT_MAX;", "}", "if (ioctl(VAR_0->fd, TUNSETSNDBUF, &VAR_2) == -1 && VAR_1) {", "qemu_error(\"TUNSETSNDBUF ioctl failed: %VAR_0\\n\", strerror(errno));", "return -1;", "}", "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 ], [ 33 ], [ 35 ] ]
12,025
static void virtex_init(MachineState *machine) { ram_addr_t ram_size = machine->ram_size; const char *cpu_model = machine->cpu_model; const char *kernel_filename = machine->kernel_filename; const char *kernel_cmdline = machine->kernel_cmdline; hwaddr initrd_base = 0; int initrd_size = 0; MemoryRegion *address_space_mem = get_system_memory(); DeviceState *dev; PowerPCCPU *cpu; CPUPPCState *env; hwaddr ram_base = 0; DriveInfo *dinfo; MemoryRegion *phys_ram = g_new(MemoryRegion, 1); qemu_irq irq[32], *cpu_irq; int kernel_size; int i; /* init CPUs */ if (cpu_model == NULL) { cpu_model = "440-Xilinx"; } cpu = ppc440_init_xilinx(&ram_size, 1, cpu_model, 400000000); env = &cpu->env; qemu_register_reset(main_cpu_reset, cpu); memory_region_allocate_system_memory(phys_ram, NULL, "ram", ram_size); memory_region_add_subregion(address_space_mem, ram_base, phys_ram); dinfo = drive_get(IF_PFLASH, 0, 0); pflash_cfi01_register(PFLASH_BASEADDR, NULL, "virtex.flash", FLASH_SIZE, dinfo ? blk_bs(blk_by_legacy_dinfo(dinfo)) : NULL, (64 * 1024), FLASH_SIZE >> 16, 1, 0x89, 0x18, 0x0000, 0x0, 1); cpu_irq = (qemu_irq *) &env->irq_inputs[PPC40x_INPUT_INT]; dev = qdev_create(NULL, "xlnx.xps-intc"); qdev_prop_set_uint32(dev, "kind-of-intr", 0); qdev_init_nofail(dev); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, INTC_BASEADDR); sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, cpu_irq[0]); for (i = 0; i < 32; i++) { irq[i] = qdev_get_gpio_in(dev, i); } serial_mm_init(address_space_mem, UART16550_BASEADDR, 2, irq[UART16550_IRQ], 115200, serial_hds[0], DEVICE_LITTLE_ENDIAN); /* 2 timers at irq 2 @ 62 Mhz. */ dev = qdev_create(NULL, "xlnx.xps-timer"); qdev_prop_set_uint32(dev, "one-timer-only", 0); qdev_prop_set_uint32(dev, "clock-frequency", 62 * 1000000); qdev_init_nofail(dev); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, TIMER_BASEADDR); sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, irq[TIMER_IRQ]); if (kernel_filename) { uint64_t entry, low, high; hwaddr boot_offset; /* Boots a kernel elf binary. */ kernel_size = load_elf(kernel_filename, NULL, NULL, &entry, &low, &high, 1, ELF_MACHINE, 0); boot_info.bootstrap_pc = entry & 0x00ffffff; if (kernel_size < 0) { boot_offset = 0x1200000; /* If we failed loading ELF's try a raw image. */ kernel_size = load_image_targphys(kernel_filename, boot_offset, ram_size); boot_info.bootstrap_pc = boot_offset; high = boot_info.bootstrap_pc + kernel_size + 8192; } boot_info.ima_size = kernel_size; /* Load initrd. */ if (machine->initrd_filename) { initrd_base = high = ROUND_UP(high, 4); initrd_size = load_image_targphys(machine->initrd_filename, high, ram_size - high); if (initrd_size < 0) { error_report("couldn't load ram disk '%s'", machine->initrd_filename); exit(1); } high = ROUND_UP(high + initrd_size, 4); } /* Provide a device-tree. */ boot_info.fdt = high + (8192 * 2); boot_info.fdt &= ~8191; xilinx_load_device_tree(boot_info.fdt, ram_size, initrd_base, initrd_size, kernel_cmdline); } env->load_info = &boot_info; }
false
qemu
4be746345f13e99e468c60acbd3a355e8183e3ce
static void virtex_init(MachineState *machine) { ram_addr_t ram_size = machine->ram_size; const char *cpu_model = machine->cpu_model; const char *kernel_filename = machine->kernel_filename; const char *kernel_cmdline = machine->kernel_cmdline; hwaddr initrd_base = 0; int initrd_size = 0; MemoryRegion *address_space_mem = get_system_memory(); DeviceState *dev; PowerPCCPU *cpu; CPUPPCState *env; hwaddr ram_base = 0; DriveInfo *dinfo; MemoryRegion *phys_ram = g_new(MemoryRegion, 1); qemu_irq irq[32], *cpu_irq; int kernel_size; int i; if (cpu_model == NULL) { cpu_model = "440-Xilinx"; } cpu = ppc440_init_xilinx(&ram_size, 1, cpu_model, 400000000); env = &cpu->env; qemu_register_reset(main_cpu_reset, cpu); memory_region_allocate_system_memory(phys_ram, NULL, "ram", ram_size); memory_region_add_subregion(address_space_mem, ram_base, phys_ram); dinfo = drive_get(IF_PFLASH, 0, 0); pflash_cfi01_register(PFLASH_BASEADDR, NULL, "virtex.flash", FLASH_SIZE, dinfo ? blk_bs(blk_by_legacy_dinfo(dinfo)) : NULL, (64 * 1024), FLASH_SIZE >> 16, 1, 0x89, 0x18, 0x0000, 0x0, 1); cpu_irq = (qemu_irq *) &env->irq_inputs[PPC40x_INPUT_INT]; dev = qdev_create(NULL, "xlnx.xps-intc"); qdev_prop_set_uint32(dev, "kind-of-intr", 0); qdev_init_nofail(dev); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, INTC_BASEADDR); sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, cpu_irq[0]); for (i = 0; i < 32; i++) { irq[i] = qdev_get_gpio_in(dev, i); } serial_mm_init(address_space_mem, UART16550_BASEADDR, 2, irq[UART16550_IRQ], 115200, serial_hds[0], DEVICE_LITTLE_ENDIAN); dev = qdev_create(NULL, "xlnx.xps-timer"); qdev_prop_set_uint32(dev, "one-timer-only", 0); qdev_prop_set_uint32(dev, "clock-frequency", 62 * 1000000); qdev_init_nofail(dev); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, TIMER_BASEADDR); sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, irq[TIMER_IRQ]); if (kernel_filename) { uint64_t entry, low, high; hwaddr boot_offset; kernel_size = load_elf(kernel_filename, NULL, NULL, &entry, &low, &high, 1, ELF_MACHINE, 0); boot_info.bootstrap_pc = entry & 0x00ffffff; if (kernel_size < 0) { boot_offset = 0x1200000; kernel_size = load_image_targphys(kernel_filename, boot_offset, ram_size); boot_info.bootstrap_pc = boot_offset; high = boot_info.bootstrap_pc + kernel_size + 8192; } boot_info.ima_size = kernel_size; if (machine->initrd_filename) { initrd_base = high = ROUND_UP(high, 4); initrd_size = load_image_targphys(machine->initrd_filename, high, ram_size - high); if (initrd_size < 0) { error_report("couldn't load ram disk '%s'", machine->initrd_filename); exit(1); } high = ROUND_UP(high + initrd_size, 4); } boot_info.fdt = high + (8192 * 2); boot_info.fdt &= ~8191; xilinx_load_device_tree(boot_info.fdt, ram_size, initrd_base, initrd_size, kernel_cmdline); } env->load_info = &boot_info; }
{ "code": [], "line_no": [] }
static void FUNC_0(MachineState *VAR_0) { ram_addr_t ram_size = VAR_0->ram_size; const char *VAR_1 = VAR_0->VAR_1; const char *VAR_2 = VAR_0->VAR_2; const char *VAR_3 = VAR_0->VAR_3; hwaddr initrd_base = 0; int VAR_4 = 0; MemoryRegion *address_space_mem = get_system_memory(); DeviceState *dev; PowerPCCPU *cpu; CPUPPCState *env; hwaddr ram_base = 0; DriveInfo *dinfo; MemoryRegion *phys_ram = g_new(MemoryRegion, 1); qemu_irq irq[32], *cpu_irq; int VAR_5; int VAR_6; if (VAR_1 == NULL) { VAR_1 = "440-Xilinx"; } cpu = ppc440_init_xilinx(&ram_size, 1, VAR_1, 400000000); env = &cpu->env; qemu_register_reset(main_cpu_reset, cpu); memory_region_allocate_system_memory(phys_ram, NULL, "ram", ram_size); memory_region_add_subregion(address_space_mem, ram_base, phys_ram); dinfo = drive_get(IF_PFLASH, 0, 0); pflash_cfi01_register(PFLASH_BASEADDR, NULL, "virtex.flash", FLASH_SIZE, dinfo ? blk_bs(blk_by_legacy_dinfo(dinfo)) : NULL, (64 * 1024), FLASH_SIZE >> 16, 1, 0x89, 0x18, 0x0000, 0x0, 1); cpu_irq = (qemu_irq *) &env->irq_inputs[PPC40x_INPUT_INT]; dev = qdev_create(NULL, "xlnx.xps-intc"); qdev_prop_set_uint32(dev, "kind-of-intr", 0); qdev_init_nofail(dev); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, INTC_BASEADDR); sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, cpu_irq[0]); for (VAR_6 = 0; VAR_6 < 32; VAR_6++) { irq[VAR_6] = qdev_get_gpio_in(dev, VAR_6); } serial_mm_init(address_space_mem, UART16550_BASEADDR, 2, irq[UART16550_IRQ], 115200, serial_hds[0], DEVICE_LITTLE_ENDIAN); dev = qdev_create(NULL, "xlnx.xps-timer"); qdev_prop_set_uint32(dev, "one-timer-only", 0); qdev_prop_set_uint32(dev, "clock-frequency", 62 * 1000000); qdev_init_nofail(dev); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, TIMER_BASEADDR); sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, irq[TIMER_IRQ]); if (VAR_2) { uint64_t entry, low, high; hwaddr boot_offset; VAR_5 = load_elf(VAR_2, NULL, NULL, &entry, &low, &high, 1, ELF_MACHINE, 0); boot_info.bootstrap_pc = entry & 0x00ffffff; if (VAR_5 < 0) { boot_offset = 0x1200000; VAR_5 = load_image_targphys(VAR_2, boot_offset, ram_size); boot_info.bootstrap_pc = boot_offset; high = boot_info.bootstrap_pc + VAR_5 + 8192; } boot_info.ima_size = VAR_5; if (VAR_0->initrd_filename) { initrd_base = high = ROUND_UP(high, 4); VAR_4 = load_image_targphys(VAR_0->initrd_filename, high, ram_size - high); if (VAR_4 < 0) { error_report("couldn't load ram disk '%s'", VAR_0->initrd_filename); exit(1); } high = ROUND_UP(high + VAR_4, 4); } boot_info.fdt = high + (8192 * 2); boot_info.fdt &= ~8191; xilinx_load_device_tree(boot_info.fdt, ram_size, initrd_base, VAR_4, VAR_3); } env->load_info = &boot_info; }
[ "static void FUNC_0(MachineState *VAR_0)\n{", "ram_addr_t ram_size = VAR_0->ram_size;", "const char *VAR_1 = VAR_0->VAR_1;", "const char *VAR_2 = VAR_0->VAR_2;", "const char *VAR_3 = VAR_0->VAR_3;", "hwaddr initrd_base = 0;", "int VAR_4 = 0;", "MemoryRegion *address_space_mem = get_system_memory();", "DeviceState *dev;", "PowerPCCPU *cpu;", "CPUPPCState *env;", "hwaddr ram_base = 0;", "DriveInfo *dinfo;", "MemoryRegion *phys_ram = g_new(MemoryRegion, 1);", "qemu_irq irq[32], *cpu_irq;", "int VAR_5;", "int VAR_6;", "if (VAR_1 == NULL) {", "VAR_1 = \"440-Xilinx\";", "}", "cpu = ppc440_init_xilinx(&ram_size, 1, VAR_1, 400000000);", "env = &cpu->env;", "qemu_register_reset(main_cpu_reset, cpu);", "memory_region_allocate_system_memory(phys_ram, NULL, \"ram\", ram_size);", "memory_region_add_subregion(address_space_mem, ram_base, phys_ram);", "dinfo = drive_get(IF_PFLASH, 0, 0);", "pflash_cfi01_register(PFLASH_BASEADDR, NULL, \"virtex.flash\", FLASH_SIZE,\ndinfo ? blk_bs(blk_by_legacy_dinfo(dinfo)) : NULL,\n(64 * 1024), FLASH_SIZE >> 16,\n1, 0x89, 0x18, 0x0000, 0x0, 1);", "cpu_irq = (qemu_irq *) &env->irq_inputs[PPC40x_INPUT_INT];", "dev = qdev_create(NULL, \"xlnx.xps-intc\");", "qdev_prop_set_uint32(dev, \"kind-of-intr\", 0);", "qdev_init_nofail(dev);", "sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, INTC_BASEADDR);", "sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, cpu_irq[0]);", "for (VAR_6 = 0; VAR_6 < 32; VAR_6++) {", "irq[VAR_6] = qdev_get_gpio_in(dev, VAR_6);", "}", "serial_mm_init(address_space_mem, UART16550_BASEADDR, 2, irq[UART16550_IRQ],\n115200, serial_hds[0], DEVICE_LITTLE_ENDIAN);", "dev = qdev_create(NULL, \"xlnx.xps-timer\");", "qdev_prop_set_uint32(dev, \"one-timer-only\", 0);", "qdev_prop_set_uint32(dev, \"clock-frequency\", 62 * 1000000);", "qdev_init_nofail(dev);", "sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, TIMER_BASEADDR);", "sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, irq[TIMER_IRQ]);", "if (VAR_2) {", "uint64_t entry, low, high;", "hwaddr boot_offset;", "VAR_5 = load_elf(VAR_2, NULL, NULL,\n&entry, &low, &high, 1, ELF_MACHINE, 0);", "boot_info.bootstrap_pc = entry & 0x00ffffff;", "if (VAR_5 < 0) {", "boot_offset = 0x1200000;", "VAR_5 = load_image_targphys(VAR_2,\nboot_offset,\nram_size);", "boot_info.bootstrap_pc = boot_offset;", "high = boot_info.bootstrap_pc + VAR_5 + 8192;", "}", "boot_info.ima_size = VAR_5;", "if (VAR_0->initrd_filename) {", "initrd_base = high = ROUND_UP(high, 4);", "VAR_4 = load_image_targphys(VAR_0->initrd_filename,\nhigh, ram_size - high);", "if (VAR_4 < 0) {", "error_report(\"couldn't load ram disk '%s'\",\nVAR_0->initrd_filename);", "exit(1);", "}", "high = ROUND_UP(high + VAR_4, 4);", "}", "boot_info.fdt = high + (8192 * 2);", "boot_info.fdt &= ~8191;", "xilinx_load_device_tree(boot_info.fdt, ram_size,\ninitrd_base, VAR_4,\nVAR_3);", "}", "env->load_info = &boot_info;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 63 ], [ 65, 67, 69, 71 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 95, 97 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 117 ], [ 119 ], [ 121 ], [ 127, 129 ], [ 131 ], [ 135 ], [ 137 ], [ 141, 143, 145 ], [ 147 ], [ 149 ], [ 151 ], [ 155 ], [ 161 ], [ 163 ], [ 165, 167 ], [ 171 ], [ 173, 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 189 ], [ 191 ], [ 195, 197, 199 ], [ 201 ], [ 203 ], [ 205 ] ]
12,027
static void pxa2xx_i2c_write(void *opaque, hwaddr addr, uint64_t value64, unsigned size) { PXA2xxI2CState *s = (PXA2xxI2CState *) opaque; uint32_t value = value64; int ack; addr -= s->offset; switch (addr) { case ICR: s->control = value & 0xfff7; if ((value & (1 << 3)) && (value & (1 << 6))) { /* TB and IUE */ /* TODO: slave mode */ if (value & (1 << 0)) { /* START condition */ if (s->data & 1) s->status |= 1 << 0; /* set RWM */ else s->status &= ~(1 << 0); /* clear RWM */ ack = !i2c_start_transfer(s->bus, s->data >> 1, s->data & 1); } else { if (s->status & (1 << 0)) { /* RWM */ s->data = i2c_recv(s->bus); if (value & (1 << 2)) /* ACKNAK */ i2c_nack(s->bus); ack = 1; } else ack = !i2c_send(s->bus, s->data); } if (value & (1 << 1)) /* STOP condition */ i2c_end_transfer(s->bus); if (ack) { if (value & (1 << 0)) /* START condition */ s->status |= 1 << 6; /* set ITE */ else if (s->status & (1 << 0)) /* RWM */ s->status |= 1 << 7; /* set IRF */ else s->status |= 1 << 6; /* set ITE */ s->status &= ~(1 << 1); /* clear ACKNAK */ } else { s->status |= 1 << 6; /* set ITE */ s->status |= 1 << 10; /* set BED */ s->status |= 1 << 1; /* set ACKNAK */ } } if (!(value & (1 << 3)) && (value & (1 << 6))) /* !TB and IUE */ if (value & (1 << 4)) /* MA */ i2c_end_transfer(s->bus); pxa2xx_i2c_update(s); break; case ISR: s->status &= ~(value & 0x07f0); pxa2xx_i2c_update(s); break; case ISAR: i2c_set_slave_address(I2C_SLAVE(s->slave), value & 0x7f); break; case IDBR: s->data = value & 0xff; break; default: printf("%s: Bad register " REG_FMT "\n", __FUNCTION__, addr); } }
false
qemu
a89f364ae8740dfc31b321eed9ee454e996dc3c1
static void pxa2xx_i2c_write(void *opaque, hwaddr addr, uint64_t value64, unsigned size) { PXA2xxI2CState *s = (PXA2xxI2CState *) opaque; uint32_t value = value64; int ack; addr -= s->offset; switch (addr) { case ICR: s->control = value & 0xfff7; if ((value & (1 << 3)) && (value & (1 << 6))) { if (value & (1 << 0)) { if (s->data & 1) s->status |= 1 << 0; else s->status &= ~(1 << 0); ack = !i2c_start_transfer(s->bus, s->data >> 1, s->data & 1); } else { if (s->status & (1 << 0)) { s->data = i2c_recv(s->bus); if (value & (1 << 2)) i2c_nack(s->bus); ack = 1; } else ack = !i2c_send(s->bus, s->data); } if (value & (1 << 1)) i2c_end_transfer(s->bus); if (ack) { if (value & (1 << 0)) s->status |= 1 << 6; else if (s->status & (1 << 0)) s->status |= 1 << 7; else s->status |= 1 << 6; s->status &= ~(1 << 1); } else { s->status |= 1 << 6; s->status |= 1 << 10; s->status |= 1 << 1; } } if (!(value & (1 << 3)) && (value & (1 << 6))) if (value & (1 << 4)) i2c_end_transfer(s->bus); pxa2xx_i2c_update(s); break; case ISR: s->status &= ~(value & 0x07f0); pxa2xx_i2c_update(s); break; case ISAR: i2c_set_slave_address(I2C_SLAVE(s->slave), value & 0x7f); break; case IDBR: s->data = value & 0xff; break; default: printf("%s: Bad register " REG_FMT "\n", __FUNCTION__, addr); } }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, hwaddr VAR_1, uint64_t VAR_2, unsigned VAR_3) { PXA2xxI2CState *s = (PXA2xxI2CState *) VAR_0; uint32_t value = VAR_2; int VAR_4; VAR_1 -= s->offset; switch (VAR_1) { case ICR: s->control = value & 0xfff7; if ((value & (1 << 3)) && (value & (1 << 6))) { if (value & (1 << 0)) { if (s->data & 1) s->status |= 1 << 0; else s->status &= ~(1 << 0); VAR_4 = !i2c_start_transfer(s->bus, s->data >> 1, s->data & 1); } else { if (s->status & (1 << 0)) { s->data = i2c_recv(s->bus); if (value & (1 << 2)) i2c_nack(s->bus); VAR_4 = 1; } else VAR_4 = !i2c_send(s->bus, s->data); } if (value & (1 << 1)) i2c_end_transfer(s->bus); if (VAR_4) { if (value & (1 << 0)) s->status |= 1 << 6; else if (s->status & (1 << 0)) s->status |= 1 << 7; else s->status |= 1 << 6; s->status &= ~(1 << 1); } else { s->status |= 1 << 6; s->status |= 1 << 10; s->status |= 1 << 1; } } if (!(value & (1 << 3)) && (value & (1 << 6))) if (value & (1 << 4)) i2c_end_transfer(s->bus); pxa2xx_i2c_update(s); break; case ISR: s->status &= ~(value & 0x07f0); pxa2xx_i2c_update(s); break; case ISAR: i2c_set_slave_address(I2C_SLAVE(s->slave), value & 0x7f); break; case IDBR: s->data = value & 0xff; break; default: printf("%s: Bad register " REG_FMT "\n", __FUNCTION__, VAR_1); } }
[ "static void FUNC_0(void *VAR_0, hwaddr VAR_1,\nuint64_t VAR_2, unsigned VAR_3)\n{", "PXA2xxI2CState *s = (PXA2xxI2CState *) VAR_0;", "uint32_t value = VAR_2;", "int VAR_4;", "VAR_1 -= s->offset;", "switch (VAR_1) {", "case ICR:\ns->control = value & 0xfff7;", "if ((value & (1 << 3)) && (value & (1 << 6))) {", "if (value & (1 << 0)) {", "if (s->data & 1)\ns->status |= 1 << 0;", "else\ns->status &= ~(1 << 0);", "VAR_4 = !i2c_start_transfer(s->bus, s->data >> 1, s->data & 1);", "} else {", "if (s->status & (1 << 0)) {", "s->data = i2c_recv(s->bus);", "if (value & (1 << 2))\ni2c_nack(s->bus);", "VAR_4 = 1;", "} else", "VAR_4 = !i2c_send(s->bus, s->data);", "}", "if (value & (1 << 1))\ni2c_end_transfer(s->bus);", "if (VAR_4) {", "if (value & (1 << 0))\ns->status |= 1 << 6;", "else\nif (s->status & (1 << 0))\ns->status |= 1 << 7;", "else\ns->status |= 1 << 6;", "s->status &= ~(1 << 1);", "} else {", "s->status |= 1 << 6;", "s->status |= 1 << 10;", "s->status |= 1 << 1;", "}", "}", "if (!(value & (1 << 3)) && (value & (1 << 6)))\nif (value & (1 << 4))\ni2c_end_transfer(s->bus);", "pxa2xx_i2c_update(s);", "break;", "case ISR:\ns->status &= ~(value & 0x07f0);", "pxa2xx_i2c_update(s);", "break;", "case ISAR:\ni2c_set_slave_address(I2C_SLAVE(s->slave), value & 0x7f);", "break;", "case IDBR:\ns->data = value & 0xff;", "break;", "default:\nprintf(\"%s: Bad register \" REG_FMT \"\\n\", __FUNCTION__, VAR_1);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19, 21 ], [ 23 ], [ 27 ], [ 29, 31 ], [ 33, 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45, 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59, 61 ], [ 65 ], [ 67, 69 ], [ 71, 73, 75 ], [ 77, 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95, 97, 99 ], [ 101 ], [ 103 ], [ 107, 109 ], [ 111 ], [ 113 ], [ 117, 119 ], [ 121 ], [ 125, 127 ], [ 129 ], [ 133, 135 ], [ 137 ], [ 139 ] ]
12,028
static void ptimer_trigger(ptimer_state *s) { if (s->bh) { qemu_bh_schedule(s->bh); } }
false
qemu
8a354bd935a800dd2d98ac8f30707e2912c80ae6
static void ptimer_trigger(ptimer_state *s) { if (s->bh) { qemu_bh_schedule(s->bh); } }
{ "code": [], "line_no": [] }
static void FUNC_0(ptimer_state *VAR_0) { if (VAR_0->bh) { qemu_bh_schedule(VAR_0->bh); } }
[ "static void FUNC_0(ptimer_state *VAR_0)\n{", "if (VAR_0->bh) {", "qemu_bh_schedule(VAR_0->bh);", "}", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ] ]
12,029
static int prepare_input_packet(AVFormatContext *s, AVPacket *pkt) { int ret; ret = check_packet(s, pkt); if (ret < 0) return ret; #if !FF_API_COMPUTE_PKT_FIELDS2 /* sanitize the timestamps */ if (!(s->oformat->flags & AVFMT_NOTIMESTAMPS)) { AVStream *st = s->streams[pkt->stream_index]; /* when there is no reordering (so dts is equal to pts), but * only one of them is set, set the other as well */ if (!st->internal->reorder) { if (pkt->pts == AV_NOPTS_VALUE && pkt->dts != AV_NOPTS_VALUE) pkt->pts = pkt->dts; if (pkt->dts == AV_NOPTS_VALUE && pkt->pts != AV_NOPTS_VALUE) pkt->dts = pkt->pts; } /* check that the timestamps are set */ if (pkt->pts == AV_NOPTS_VALUE || pkt->dts == AV_NOPTS_VALUE) { av_log(s, AV_LOG_ERROR, "Timestamps are unset in a packet for stream %d\n", st->index); return AVERROR(EINVAL); } /* check that the dts are increasing (or at least non-decreasing, * if the format allows it */ if (st->cur_dts != AV_NOPTS_VALUE && ((!(s->oformat->flags & AVFMT_TS_NONSTRICT) && st->cur_dts >= pkt->dts) || st->cur_dts > pkt->dts)) { av_log(s, AV_LOG_ERROR, "Application provided invalid, non monotonically increasing " "dts to muxer in stream %d: %" PRId64 " >= %" PRId64 "\n", st->index, st->cur_dts, pkt->dts); return AVERROR(EINVAL); } if (pkt->pts < pkt->dts) { av_log(s, AV_LOG_ERROR, "pts %" PRId64 " < dts %" PRId64 " in stream %d\n", pkt->pts, pkt->dts, st->index); return AVERROR(EINVAL); } } #endif return 0; }
false
FFmpeg
11de006babf735aafa3462d43dd2c02bb6ac6e2f
static int prepare_input_packet(AVFormatContext *s, AVPacket *pkt) { int ret; ret = check_packet(s, pkt); if (ret < 0) return ret; #if !FF_API_COMPUTE_PKT_FIELDS2 if (!(s->oformat->flags & AVFMT_NOTIMESTAMPS)) { AVStream *st = s->streams[pkt->stream_index]; if (!st->internal->reorder) { if (pkt->pts == AV_NOPTS_VALUE && pkt->dts != AV_NOPTS_VALUE) pkt->pts = pkt->dts; if (pkt->dts == AV_NOPTS_VALUE && pkt->pts != AV_NOPTS_VALUE) pkt->dts = pkt->pts; } if (pkt->pts == AV_NOPTS_VALUE || pkt->dts == AV_NOPTS_VALUE) { av_log(s, AV_LOG_ERROR, "Timestamps are unset in a packet for stream %d\n", st->index); return AVERROR(EINVAL); } if (st->cur_dts != AV_NOPTS_VALUE && ((!(s->oformat->flags & AVFMT_TS_NONSTRICT) && st->cur_dts >= pkt->dts) || st->cur_dts > pkt->dts)) { av_log(s, AV_LOG_ERROR, "Application provided invalid, non monotonically increasing " "dts to muxer in stream %d: %" PRId64 " >= %" PRId64 "\n", st->index, st->cur_dts, pkt->dts); return AVERROR(EINVAL); } if (pkt->pts < pkt->dts) { av_log(s, AV_LOG_ERROR, "pts %" PRId64 " < dts %" PRId64 " in stream %d\n", pkt->pts, pkt->dts, st->index); return AVERROR(EINVAL); } } #endif return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1) { int VAR_2; VAR_2 = check_packet(VAR_0, VAR_1); if (VAR_2 < 0) return VAR_2; #if !FF_API_COMPUTE_PKT_FIELDS2 if (!(VAR_0->oformat->flags & AVFMT_NOTIMESTAMPS)) { AVStream *st = VAR_0->streams[VAR_1->stream_index]; if (!st->internal->reorder) { if (VAR_1->pts == AV_NOPTS_VALUE && VAR_1->dts != AV_NOPTS_VALUE) VAR_1->pts = VAR_1->dts; if (VAR_1->dts == AV_NOPTS_VALUE && VAR_1->pts != AV_NOPTS_VALUE) VAR_1->dts = VAR_1->pts; } if (VAR_1->pts == AV_NOPTS_VALUE || VAR_1->dts == AV_NOPTS_VALUE) { av_log(VAR_0, AV_LOG_ERROR, "Timestamps are unset in a packet for stream %d\n", st->index); return AVERROR(EINVAL); } if (st->cur_dts != AV_NOPTS_VALUE && ((!(VAR_0->oformat->flags & AVFMT_TS_NONSTRICT) && st->cur_dts >= VAR_1->dts) || st->cur_dts > VAR_1->dts)) { av_log(VAR_0, AV_LOG_ERROR, "Application provided invalid, non monotonically increasing " "dts to muxer in stream %d: %" PRId64 " >= %" PRId64 "\n", st->index, st->cur_dts, VAR_1->dts); return AVERROR(EINVAL); } if (VAR_1->pts < VAR_1->dts) { av_log(VAR_0, AV_LOG_ERROR, "pts %" PRId64 " < dts %" PRId64 " in stream %d\n", VAR_1->pts, VAR_1->dts, st->index); return AVERROR(EINVAL); } } #endif return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1)\n{", "int VAR_2;", "VAR_2 = check_packet(VAR_0, VAR_1);", "if (VAR_2 < 0)\nreturn VAR_2;", "#if !FF_API_COMPUTE_PKT_FIELDS2\nif (!(VAR_0->oformat->flags & AVFMT_NOTIMESTAMPS)) {", "AVStream *st = VAR_0->streams[VAR_1->stream_index];", "if (!st->internal->reorder) {", "if (VAR_1->pts == AV_NOPTS_VALUE && VAR_1->dts != AV_NOPTS_VALUE)\nVAR_1->pts = VAR_1->dts;", "if (VAR_1->dts == AV_NOPTS_VALUE && VAR_1->pts != AV_NOPTS_VALUE)\nVAR_1->dts = VAR_1->pts;", "}", "if (VAR_1->pts == AV_NOPTS_VALUE || VAR_1->dts == AV_NOPTS_VALUE) {", "av_log(VAR_0, AV_LOG_ERROR,\n\"Timestamps are unset in a packet for stream %d\\n\", st->index);", "return AVERROR(EINVAL);", "}", "if (st->cur_dts != AV_NOPTS_VALUE &&\n((!(VAR_0->oformat->flags & AVFMT_TS_NONSTRICT) && st->cur_dts >= VAR_1->dts) ||\nst->cur_dts > VAR_1->dts)) {", "av_log(VAR_0, AV_LOG_ERROR,\n\"Application provided invalid, non monotonically increasing \"\n\"dts to muxer in stream %d: %\" PRId64 \" >= %\" PRId64 \"\\n\",\nst->index, st->cur_dts, VAR_1->dts);", "return AVERROR(EINVAL);", "}", "if (VAR_1->pts < VAR_1->dts) {", "av_log(VAR_0, AV_LOG_ERROR, \"pts %\" PRId64 \" < dts %\" PRId64 \" in stream %d\\n\",\nVAR_1->pts, VAR_1->dts, st->index);", "return AVERROR(EINVAL);", "}", "}", "#endif\nreturn 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11, 13 ], [ 17, 21 ], [ 23 ], [ 31 ], [ 33, 35 ], [ 37, 39 ], [ 41 ], [ 47 ], [ 49, 51 ], [ 53 ], [ 55 ], [ 63, 65, 67 ], [ 69, 71, 73, 75 ], [ 77 ], [ 79 ], [ 83 ], [ 85, 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95, 99 ], [ 101 ] ]
12,031
build_tpm2(GArray *table_data, GArray *linker) { Acpi20TPM2 *tpm2_ptr; tpm2_ptr = acpi_data_push(table_data, sizeof *tpm2_ptr); tpm2_ptr->platform_class = cpu_to_le16(TPM2_ACPI_CLASS_CLIENT); tpm2_ptr->control_area_address = cpu_to_le64(0); tpm2_ptr->start_method = cpu_to_le32(TPM2_START_METHOD_MMIO); build_header(linker, table_data, (void *)tpm2_ptr, "TPM2", sizeof(*tpm2_ptr), 4, NULL); }
false
qemu
37ad223c515da2fe9f1c679768cb5ccaa42e57e1
build_tpm2(GArray *table_data, GArray *linker) { Acpi20TPM2 *tpm2_ptr; tpm2_ptr = acpi_data_push(table_data, sizeof *tpm2_ptr); tpm2_ptr->platform_class = cpu_to_le16(TPM2_ACPI_CLASS_CLIENT); tpm2_ptr->control_area_address = cpu_to_le64(0); tpm2_ptr->start_method = cpu_to_le32(TPM2_START_METHOD_MMIO); build_header(linker, table_data, (void *)tpm2_ptr, "TPM2", sizeof(*tpm2_ptr), 4, NULL); }
{ "code": [], "line_no": [] }
FUNC_0(GArray *VAR_0, GArray *VAR_1) { Acpi20TPM2 *tpm2_ptr; tpm2_ptr = acpi_data_push(VAR_0, sizeof *tpm2_ptr); tpm2_ptr->platform_class = cpu_to_le16(TPM2_ACPI_CLASS_CLIENT); tpm2_ptr->control_area_address = cpu_to_le64(0); tpm2_ptr->start_method = cpu_to_le32(TPM2_START_METHOD_MMIO); build_header(VAR_1, VAR_0, (void *)tpm2_ptr, "TPM2", sizeof(*tpm2_ptr), 4, NULL); }
[ "FUNC_0(GArray *VAR_0, GArray *VAR_1)\n{", "Acpi20TPM2 *tpm2_ptr;", "tpm2_ptr = acpi_data_push(VAR_0, sizeof *tpm2_ptr);", "tpm2_ptr->platform_class = cpu_to_le16(TPM2_ACPI_CLASS_CLIENT);", "tpm2_ptr->control_area_address = cpu_to_le64(0);", "tpm2_ptr->start_method = cpu_to_le32(TPM2_START_METHOD_MMIO);", "build_header(VAR_1, VAR_0,\n(void *)tpm2_ptr, \"TPM2\", sizeof(*tpm2_ptr), 4, NULL);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 21, 23 ], [ 25 ] ]
12,032
static int proxy_statfs(FsContext *s, V9fsPath *fs_path, struct statfs *stbuf) { int retval; retval = v9fs_request(s->private, T_STATFS, stbuf, "s", fs_path); if (retval < 0) { errno = -retval; return -1; } return retval; }
false
qemu
494a8ebe713055d3946183f4b395f85a18b43e9e
static int proxy_statfs(FsContext *s, V9fsPath *fs_path, struct statfs *stbuf) { int retval; retval = v9fs_request(s->private, T_STATFS, stbuf, "s", fs_path); if (retval < 0) { errno = -retval; return -1; } return retval; }
{ "code": [], "line_no": [] }
static int FUNC_0(FsContext *VAR_0, V9fsPath *VAR_1, struct statfs *VAR_2) { int VAR_3; VAR_3 = v9fs_request(VAR_0->private, T_STATFS, VAR_2, "VAR_0", VAR_1); if (VAR_3 < 0) { errno = -VAR_3; return -1; } return VAR_3; }
[ "static int FUNC_0(FsContext *VAR_0, V9fsPath *VAR_1, struct statfs *VAR_2)\n{", "int VAR_3;", "VAR_3 = v9fs_request(VAR_0->private, T_STATFS, VAR_2, \"VAR_0\", VAR_1);", "if (VAR_3 < 0) {", "errno = -VAR_3;", "return -1;", "}", "return VAR_3;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ] ]
12,033
BusState *qbus_create(BusType type, size_t size, DeviceState *parent, const char *name) { BusState *bus; bus = qemu_mallocz(size); bus->type = type; bus->parent = parent; bus->name = qemu_strdup(name); LIST_INIT(&bus->children); if (parent) { LIST_INSERT_HEAD(&parent->child_bus, bus, sibling); } return bus; }
false
qemu
10c4c98ab7dc18169b37b76f6ea5e60ebe65222b
BusState *qbus_create(BusType type, size_t size, DeviceState *parent, const char *name) { BusState *bus; bus = qemu_mallocz(size); bus->type = type; bus->parent = parent; bus->name = qemu_strdup(name); LIST_INIT(&bus->children); if (parent) { LIST_INSERT_HEAD(&parent->child_bus, bus, sibling); } return bus; }
{ "code": [], "line_no": [] }
BusState *FUNC_0(BusType type, size_t size, DeviceState *parent, const char *name) { BusState *bus; bus = qemu_mallocz(size); bus->type = type; bus->parent = parent; bus->name = qemu_strdup(name); LIST_INIT(&bus->children); if (parent) { LIST_INSERT_HEAD(&parent->child_bus, bus, sibling); } return bus; }
[ "BusState *FUNC_0(BusType type, size_t size,\nDeviceState *parent, const char *name)\n{", "BusState *bus;", "bus = qemu_mallocz(size);", "bus->type = type;", "bus->parent = parent;", "bus->name = qemu_strdup(name);", "LIST_INIT(&bus->children);", "if (parent) {", "LIST_INSERT_HEAD(&parent->child_bus, bus, sibling);", "}", "return bus;", "}" ]
[ 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 ] ]
12,034
static void update_sr (AC97LinkState *s, AC97BusMasterRegs *r, uint32_t new_sr) { int event = 0; int level = 0; uint32_t new_mask = new_sr & SR_INT_MASK; uint32_t old_mask = r->sr & SR_INT_MASK; uint32_t masks[] = {GS_PIINT, GS_POINT, GS_MINT}; if (new_mask ^ old_mask) { /** @todo is IRQ deasserted when only one of status bits is cleared? */ if (!new_mask) { event = 1; level = 0; } else { if ((new_mask & SR_LVBCI) && (r->cr & CR_LVBIE)) { event = 1; level = 1; } if ((new_mask & SR_BCIS) && (r->cr & CR_IOCE)) { event = 1; level = 1; } } } r->sr = new_sr; dolog ("IOC%d LVB%d sr=%#x event=%d level=%d\n", r->sr & SR_BCIS, r->sr & SR_LVBCI, r->sr, event, level); if (!event) return; if (level) { s->glob_sta |= masks[r - s->bm_regs]; dolog ("set irq level=1\n"); qemu_set_irq (s->pci_dev->irq[0], 1); } else { s->glob_sta &= ~masks[r - s->bm_regs]; dolog ("set irq level=0\n"); qemu_set_irq (s->pci_dev->irq[0], 0); } }
false
qemu
10ee2aaa417d8d8978cdb2bbed55ebb152df5f6b
static void update_sr (AC97LinkState *s, AC97BusMasterRegs *r, uint32_t new_sr) { int event = 0; int level = 0; uint32_t new_mask = new_sr & SR_INT_MASK; uint32_t old_mask = r->sr & SR_INT_MASK; uint32_t masks[] = {GS_PIINT, GS_POINT, GS_MINT}; if (new_mask ^ old_mask) { if (!new_mask) { event = 1; level = 0; } else { if ((new_mask & SR_LVBCI) && (r->cr & CR_LVBIE)) { event = 1; level = 1; } if ((new_mask & SR_BCIS) && (r->cr & CR_IOCE)) { event = 1; level = 1; } } } r->sr = new_sr; dolog ("IOC%d LVB%d sr=%#x event=%d level=%d\n", r->sr & SR_BCIS, r->sr & SR_LVBCI, r->sr, event, level); if (!event) return; if (level) { s->glob_sta |= masks[r - s->bm_regs]; dolog ("set irq level=1\n"); qemu_set_irq (s->pci_dev->irq[0], 1); } else { s->glob_sta &= ~masks[r - s->bm_regs]; dolog ("set irq level=0\n"); qemu_set_irq (s->pci_dev->irq[0], 0); } }
{ "code": [], "line_no": [] }
static void FUNC_0 (AC97LinkState *VAR_0, AC97BusMasterRegs *VAR_1, uint32_t VAR_2) { int VAR_3 = 0; int VAR_4 = 0; uint32_t new_mask = VAR_2 & SR_INT_MASK; uint32_t old_mask = VAR_1->sr & SR_INT_MASK; uint32_t masks[] = {GS_PIINT, GS_POINT, GS_MINT}; if (new_mask ^ old_mask) { if (!new_mask) { VAR_3 = 1; VAR_4 = 0; } else { if ((new_mask & SR_LVBCI) && (VAR_1->cr & CR_LVBIE)) { VAR_3 = 1; VAR_4 = 1; } if ((new_mask & SR_BCIS) && (VAR_1->cr & CR_IOCE)) { VAR_3 = 1; VAR_4 = 1; } } } VAR_1->sr = VAR_2; dolog ("IOC%d LVB%d sr=%#x VAR_3=%d VAR_4=%d\n", VAR_1->sr & SR_BCIS, VAR_1->sr & SR_LVBCI, VAR_1->sr, VAR_3, VAR_4); if (!VAR_3) return; if (VAR_4) { VAR_0->glob_sta |= masks[VAR_1 - VAR_0->bm_regs]; dolog ("set irq VAR_4=1\n"); qemu_set_irq (VAR_0->pci_dev->irq[0], 1); } else { VAR_0->glob_sta &= ~masks[VAR_1 - VAR_0->bm_regs]; dolog ("set irq VAR_4=0\n"); qemu_set_irq (VAR_0->pci_dev->irq[0], 0); } }
[ "static void FUNC_0 (AC97LinkState *VAR_0, AC97BusMasterRegs *VAR_1, uint32_t VAR_2)\n{", "int VAR_3 = 0;", "int VAR_4 = 0;", "uint32_t new_mask = VAR_2 & SR_INT_MASK;", "uint32_t old_mask = VAR_1->sr & SR_INT_MASK;", "uint32_t masks[] = {GS_PIINT, GS_POINT, GS_MINT};", "if (new_mask ^ old_mask) {", "if (!new_mask) {", "VAR_3 = 1;", "VAR_4 = 0;", "}", "else {", "if ((new_mask & SR_LVBCI) && (VAR_1->cr & CR_LVBIE)) {", "VAR_3 = 1;", "VAR_4 = 1;", "}", "if ((new_mask & SR_BCIS) && (VAR_1->cr & CR_IOCE)) {", "VAR_3 = 1;", "VAR_4 = 1;", "}", "}", "}", "VAR_1->sr = VAR_2;", "dolog (\"IOC%d LVB%d sr=%#x VAR_3=%d VAR_4=%d\\n\",\nVAR_1->sr & SR_BCIS, VAR_1->sr & SR_LVBCI,\nVAR_1->sr,\nVAR_3, VAR_4);", "if (!VAR_3)\nreturn;", "if (VAR_4) {", "VAR_0->glob_sta |= masks[VAR_1 - VAR_0->bm_regs];", "dolog (\"set irq VAR_4=1\\n\");", "qemu_set_irq (VAR_0->pci_dev->irq[0], 1);", "}", "else {", "VAR_0->glob_sta &= ~masks[VAR_1 - VAR_0->bm_regs];", "dolog (\"set irq VAR_4=0\\n\");", "qemu_set_irq (VAR_0->pci_dev->irq[0], 0);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 57, 59, 61, 63 ], [ 67, 69 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ] ]
12,035
static unsigned int dec_subu_r(DisasContext *dc) { TCGv t0; int size = memsize_z(dc); DIS(fprintf (logfile, "subu.%c $r%u, $r%u\n", memsize_char(size), dc->op1, dc->op2)); cris_cc_mask(dc, CC_MASK_NZVC); t0 = tcg_temp_new(TCG_TYPE_TL); /* Size can only be qi or hi. */ t_gen_zext(t0, cpu_R[dc->op1], size); cris_alu(dc, CC_OP_SUB, cpu_R[dc->op2], cpu_R[dc->op2], t0, 4); tcg_temp_free(t0); return 2; }
false
qemu
a7812ae412311d7d47f8aa85656faadac9d64b56
static unsigned int dec_subu_r(DisasContext *dc) { TCGv t0; int size = memsize_z(dc); DIS(fprintf (logfile, "subu.%c $r%u, $r%u\n", memsize_char(size), dc->op1, dc->op2)); cris_cc_mask(dc, CC_MASK_NZVC); t0 = tcg_temp_new(TCG_TYPE_TL); t_gen_zext(t0, cpu_R[dc->op1], size); cris_alu(dc, CC_OP_SUB, cpu_R[dc->op2], cpu_R[dc->op2], t0, 4); tcg_temp_free(t0); return 2; }
{ "code": [], "line_no": [] }
static unsigned int FUNC_0(DisasContext *VAR_0) { TCGv t0; int VAR_1 = memsize_z(VAR_0); DIS(fprintf (logfile, "subu.%c $r%u, $r%u\n", memsize_char(VAR_1), VAR_0->op1, VAR_0->op2)); cris_cc_mask(VAR_0, CC_MASK_NZVC); t0 = tcg_temp_new(TCG_TYPE_TL); t_gen_zext(t0, cpu_R[VAR_0->op1], VAR_1); cris_alu(VAR_0, CC_OP_SUB, cpu_R[VAR_0->op2], cpu_R[VAR_0->op2], t0, 4); tcg_temp_free(t0); return 2; }
[ "static unsigned int FUNC_0(DisasContext *VAR_0)\n{", "TCGv t0;", "int VAR_1 = memsize_z(VAR_0);", "DIS(fprintf (logfile, \"subu.%c $r%u, $r%u\\n\",\nmemsize_char(VAR_1),\nVAR_0->op1, VAR_0->op2));", "cris_cc_mask(VAR_0, CC_MASK_NZVC);", "t0 = tcg_temp_new(TCG_TYPE_TL);", "t_gen_zext(t0, cpu_R[VAR_0->op1], VAR_1);", "cris_alu(VAR_0, CC_OP_SUB,\ncpu_R[VAR_0->op2], cpu_R[VAR_0->op2], t0, 4);", "tcg_temp_free(t0);", "return 2;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9, 11, 13 ], [ 17 ], [ 19 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33 ] ]
12,037
bool cpu_physical_memory_is_io(hwaddr phys_addr) { MemoryRegionSection *section; section = phys_page_find(address_space_memory.dispatch, phys_addr >> TARGET_PAGE_BITS); return !(memory_region_is_ram(section->mr) || memory_region_is_romd(section->mr)); }
false
qemu
149f54b53b7666a3facd45e86eece60ce7d3b114
bool cpu_physical_memory_is_io(hwaddr phys_addr) { MemoryRegionSection *section; section = phys_page_find(address_space_memory.dispatch, phys_addr >> TARGET_PAGE_BITS); return !(memory_region_is_ram(section->mr) || memory_region_is_romd(section->mr)); }
{ "code": [], "line_no": [] }
bool FUNC_0(hwaddr phys_addr) { MemoryRegionSection *section; section = phys_page_find(address_space_memory.dispatch, phys_addr >> TARGET_PAGE_BITS); return !(memory_region_is_ram(section->mr) || memory_region_is_romd(section->mr)); }
[ "bool FUNC_0(hwaddr phys_addr)\n{", "MemoryRegionSection *section;", "section = phys_page_find(address_space_memory.dispatch,\nphys_addr >> TARGET_PAGE_BITS);", "return !(memory_region_is_ram(section->mr) ||\nmemory_region_is_romd(section->mr));", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11 ], [ 15, 17 ], [ 19 ] ]
12,039
int kvm_cpu_exec(CPUState *env) { struct kvm_run *run = env->kvm_run; int ret; DPRINTF("kvm_cpu_exec()\n"); if (kvm_arch_process_irqchip_events(env)) { env->exit_request = 0; env->exception_index = EXCP_HLT; return 0; } do { if (env->kvm_vcpu_dirty) { kvm_arch_put_registers(env, KVM_PUT_RUNTIME_STATE); env->kvm_vcpu_dirty = 0; } kvm_arch_pre_run(env, run); if (env->exit_request) { DPRINTF("interrupt exit requested\n"); /* * KVM requires us to reenter the kernel after IO exits to complete * instruction emulation. This self-signal will ensure that we * leave ASAP again. */ qemu_cpu_kick_self(); } cpu_single_env = NULL; qemu_mutex_unlock_iothread(); ret = kvm_vcpu_ioctl(env, KVM_RUN, 0); qemu_mutex_lock_iothread(); cpu_single_env = env; kvm_arch_post_run(env, run); kvm_flush_coalesced_mmio_buffer(); if (ret == -EINTR || ret == -EAGAIN) { cpu_exit(env); DPRINTF("io window exit\n"); ret = 0; break; } if (ret < 0) { DPRINTF("kvm run failed %s\n", strerror(-ret)); abort(); } ret = 0; /* exit loop */ switch (run->exit_reason) { case KVM_EXIT_IO: DPRINTF("handle_io\n"); kvm_handle_io(run->io.port, (uint8_t *)run + run->io.data_offset, run->io.direction, run->io.size, run->io.count); ret = 1; break; case KVM_EXIT_MMIO: DPRINTF("handle_mmio\n"); cpu_physical_memory_rw(run->mmio.phys_addr, run->mmio.data, run->mmio.len, run->mmio.is_write); ret = 1; break; case KVM_EXIT_IRQ_WINDOW_OPEN: DPRINTF("irq_window_open\n"); break; case KVM_EXIT_SHUTDOWN: DPRINTF("shutdown\n"); qemu_system_reset_request(); ret = 1; break; case KVM_EXIT_UNKNOWN: fprintf(stderr, "KVM: unknown exit, hardware reason %" PRIx64 "\n", (uint64_t)run->hw.hardware_exit_reason); ret = -1; break; #ifdef KVM_CAP_INTERNAL_ERROR_DATA case KVM_EXIT_INTERNAL_ERROR: ret = kvm_handle_internal_error(env, run); break; #endif case KVM_EXIT_DEBUG: DPRINTF("kvm_exit_debug\n"); #ifdef KVM_CAP_SET_GUEST_DEBUG if (kvm_arch_debug(&run->debug.arch)) { env->exception_index = EXCP_DEBUG; return 0; } /* re-enter, this exception was guest-internal */ ret = 1; #endif /* KVM_CAP_SET_GUEST_DEBUG */ break; default: DPRINTF("kvm_arch_handle_exit\n"); ret = kvm_arch_handle_exit(env, run); break; } } while (ret > 0); if (ret < 0) { cpu_dump_state(env, stderr, fprintf, CPU_DUMP_CODE); vm_stop(0); env->exit_request = 1; } if (env->exit_request) { env->exit_request = 0; env->exception_index = EXCP_INTERRUPT; } return ret; }
false
qemu
cdea50ede1b8a2efe989fafc57260053b180219f
int kvm_cpu_exec(CPUState *env) { struct kvm_run *run = env->kvm_run; int ret; DPRINTF("kvm_cpu_exec()\n"); if (kvm_arch_process_irqchip_events(env)) { env->exit_request = 0; env->exception_index = EXCP_HLT; return 0; } do { if (env->kvm_vcpu_dirty) { kvm_arch_put_registers(env, KVM_PUT_RUNTIME_STATE); env->kvm_vcpu_dirty = 0; } kvm_arch_pre_run(env, run); if (env->exit_request) { DPRINTF("interrupt exit requested\n"); qemu_cpu_kick_self(); } cpu_single_env = NULL; qemu_mutex_unlock_iothread(); ret = kvm_vcpu_ioctl(env, KVM_RUN, 0); qemu_mutex_lock_iothread(); cpu_single_env = env; kvm_arch_post_run(env, run); kvm_flush_coalesced_mmio_buffer(); if (ret == -EINTR || ret == -EAGAIN) { cpu_exit(env); DPRINTF("io window exit\n"); ret = 0; break; } if (ret < 0) { DPRINTF("kvm run failed %s\n", strerror(-ret)); abort(); } ret = 0; switch (run->exit_reason) { case KVM_EXIT_IO: DPRINTF("handle_io\n"); kvm_handle_io(run->io.port, (uint8_t *)run + run->io.data_offset, run->io.direction, run->io.size, run->io.count); ret = 1; break; case KVM_EXIT_MMIO: DPRINTF("handle_mmio\n"); cpu_physical_memory_rw(run->mmio.phys_addr, run->mmio.data, run->mmio.len, run->mmio.is_write); ret = 1; break; case KVM_EXIT_IRQ_WINDOW_OPEN: DPRINTF("irq_window_open\n"); break; case KVM_EXIT_SHUTDOWN: DPRINTF("shutdown\n"); qemu_system_reset_request(); ret = 1; break; case KVM_EXIT_UNKNOWN: fprintf(stderr, "KVM: unknown exit, hardware reason %" PRIx64 "\n", (uint64_t)run->hw.hardware_exit_reason); ret = -1; break; #ifdef KVM_CAP_INTERNAL_ERROR_DATA case KVM_EXIT_INTERNAL_ERROR: ret = kvm_handle_internal_error(env, run); break; #endif case KVM_EXIT_DEBUG: DPRINTF("kvm_exit_debug\n"); #ifdef KVM_CAP_SET_GUEST_DEBUG if (kvm_arch_debug(&run->debug.arch)) { env->exception_index = EXCP_DEBUG; return 0; } ret = 1; #endif break; default: DPRINTF("kvm_arch_handle_exit\n"); ret = kvm_arch_handle_exit(env, run); break; } } while (ret > 0); if (ret < 0) { cpu_dump_state(env, stderr, fprintf, CPU_DUMP_CODE); vm_stop(0); env->exit_request = 1; } if (env->exit_request) { env->exit_request = 0; env->exception_index = EXCP_INTERRUPT; } return ret; }
{ "code": [], "line_no": [] }
int FUNC_0(CPUState *VAR_0) { struct kvm_run *VAR_1 = VAR_0->kvm_run; int VAR_2; DPRINTF("FUNC_0()\n"); if (kvm_arch_process_irqchip_events(VAR_0)) { VAR_0->exit_request = 0; VAR_0->exception_index = EXCP_HLT; return 0; } do { if (VAR_0->kvm_vcpu_dirty) { kvm_arch_put_registers(VAR_0, KVM_PUT_RUNTIME_STATE); VAR_0->kvm_vcpu_dirty = 0; } kvm_arch_pre_run(VAR_0, VAR_1); if (VAR_0->exit_request) { DPRINTF("interrupt exit requested\n"); qemu_cpu_kick_self(); } cpu_single_env = NULL; qemu_mutex_unlock_iothread(); VAR_2 = kvm_vcpu_ioctl(VAR_0, KVM_RUN, 0); qemu_mutex_lock_iothread(); cpu_single_env = VAR_0; kvm_arch_post_run(VAR_0, VAR_1); kvm_flush_coalesced_mmio_buffer(); if (VAR_2 == -EINTR || VAR_2 == -EAGAIN) { cpu_exit(VAR_0); DPRINTF("io window exit\n"); VAR_2 = 0; break; } if (VAR_2 < 0) { DPRINTF("kvm VAR_1 failed %s\n", strerror(-VAR_2)); abort(); } VAR_2 = 0; switch (VAR_1->exit_reason) { case KVM_EXIT_IO: DPRINTF("handle_io\n"); kvm_handle_io(VAR_1->io.port, (uint8_t *)VAR_1 + VAR_1->io.data_offset, VAR_1->io.direction, VAR_1->io.size, VAR_1->io.count); VAR_2 = 1; break; case KVM_EXIT_MMIO: DPRINTF("handle_mmio\n"); cpu_physical_memory_rw(VAR_1->mmio.phys_addr, VAR_1->mmio.data, VAR_1->mmio.len, VAR_1->mmio.is_write); VAR_2 = 1; break; case KVM_EXIT_IRQ_WINDOW_OPEN: DPRINTF("irq_window_open\n"); break; case KVM_EXIT_SHUTDOWN: DPRINTF("shutdown\n"); qemu_system_reset_request(); VAR_2 = 1; break; case KVM_EXIT_UNKNOWN: fprintf(stderr, "KVM: unknown exit, hardware reason %" PRIx64 "\n", (uint64_t)VAR_1->hw.hardware_exit_reason); VAR_2 = -1; break; #ifdef KVM_CAP_INTERNAL_ERROR_DATA case KVM_EXIT_INTERNAL_ERROR: VAR_2 = kvm_handle_internal_error(VAR_0, VAR_1); break; #endif case KVM_EXIT_DEBUG: DPRINTF("kvm_exit_debug\n"); #ifdef KVM_CAP_SET_GUEST_DEBUG if (kvm_arch_debug(&VAR_1->debug.arch)) { VAR_0->exception_index = EXCP_DEBUG; return 0; } VAR_2 = 1; #endif break; default: DPRINTF("kvm_arch_handle_exit\n"); VAR_2 = kvm_arch_handle_exit(VAR_0, VAR_1); break; } } while (VAR_2 > 0); if (VAR_2 < 0) { cpu_dump_state(VAR_0, stderr, fprintf, CPU_DUMP_CODE); vm_stop(0); VAR_0->exit_request = 1; } if (VAR_0->exit_request) { VAR_0->exit_request = 0; VAR_0->exception_index = EXCP_INTERRUPT; } return VAR_2; }
[ "int FUNC_0(CPUState *VAR_0)\n{", "struct kvm_run *VAR_1 = VAR_0->kvm_run;", "int VAR_2;", "DPRINTF(\"FUNC_0()\\n\");", "if (kvm_arch_process_irqchip_events(VAR_0)) {", "VAR_0->exit_request = 0;", "VAR_0->exception_index = EXCP_HLT;", "return 0;", "}", "do {", "if (VAR_0->kvm_vcpu_dirty) {", "kvm_arch_put_registers(VAR_0, KVM_PUT_RUNTIME_STATE);", "VAR_0->kvm_vcpu_dirty = 0;", "}", "kvm_arch_pre_run(VAR_0, VAR_1);", "if (VAR_0->exit_request) {", "DPRINTF(\"interrupt exit requested\\n\");", "qemu_cpu_kick_self();", "}", "cpu_single_env = NULL;", "qemu_mutex_unlock_iothread();", "VAR_2 = kvm_vcpu_ioctl(VAR_0, KVM_RUN, 0);", "qemu_mutex_lock_iothread();", "cpu_single_env = VAR_0;", "kvm_arch_post_run(VAR_0, VAR_1);", "kvm_flush_coalesced_mmio_buffer();", "if (VAR_2 == -EINTR || VAR_2 == -EAGAIN) {", "cpu_exit(VAR_0);", "DPRINTF(\"io window exit\\n\");", "VAR_2 = 0;", "break;", "}", "if (VAR_2 < 0) {", "DPRINTF(\"kvm VAR_1 failed %s\\n\", strerror(-VAR_2));", "abort();", "}", "VAR_2 = 0;", "switch (VAR_1->exit_reason) {", "case KVM_EXIT_IO:\nDPRINTF(\"handle_io\\n\");", "kvm_handle_io(VAR_1->io.port,\n(uint8_t *)VAR_1 + VAR_1->io.data_offset,\nVAR_1->io.direction,\nVAR_1->io.size,\nVAR_1->io.count);", "VAR_2 = 1;", "break;", "case KVM_EXIT_MMIO:\nDPRINTF(\"handle_mmio\\n\");", "cpu_physical_memory_rw(VAR_1->mmio.phys_addr,\nVAR_1->mmio.data,\nVAR_1->mmio.len,\nVAR_1->mmio.is_write);", "VAR_2 = 1;", "break;", "case KVM_EXIT_IRQ_WINDOW_OPEN:\nDPRINTF(\"irq_window_open\\n\");", "break;", "case KVM_EXIT_SHUTDOWN:\nDPRINTF(\"shutdown\\n\");", "qemu_system_reset_request();", "VAR_2 = 1;", "break;", "case KVM_EXIT_UNKNOWN:\nfprintf(stderr, \"KVM: unknown exit, hardware reason %\" PRIx64 \"\\n\",\n(uint64_t)VAR_1->hw.hardware_exit_reason);", "VAR_2 = -1;", "break;", "#ifdef KVM_CAP_INTERNAL_ERROR_DATA\ncase KVM_EXIT_INTERNAL_ERROR:\nVAR_2 = kvm_handle_internal_error(VAR_0, VAR_1);", "break;", "#endif\ncase KVM_EXIT_DEBUG:\nDPRINTF(\"kvm_exit_debug\\n\");", "#ifdef KVM_CAP_SET_GUEST_DEBUG\nif (kvm_arch_debug(&VAR_1->debug.arch)) {", "VAR_0->exception_index = EXCP_DEBUG;", "return 0;", "}", "VAR_2 = 1;", "#endif\nbreak;", "default:\nDPRINTF(\"kvm_arch_handle_exit\\n\");", "VAR_2 = kvm_arch_handle_exit(VAR_0, VAR_1);", "break;", "}", "} while (VAR_2 > 0);", "if (VAR_2 < 0) {", "cpu_dump_state(VAR_0, stderr, fprintf, CPU_DUMP_CODE);", "vm_stop(0);", "VAR_0->exit_request = 1;", "}", "if (VAR_0->exit_request) {", "VAR_0->exit_request = 0;", "VAR_0->exception_index = EXCP_INTERRUPT;", "}", "return VAR_2;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 105 ], [ 107 ], [ 109, 111 ], [ 113, 115, 117, 119, 121 ], [ 123 ], [ 125 ], [ 127, 129 ], [ 131, 133, 135, 137 ], [ 139 ], [ 141 ], [ 143, 145 ], [ 147 ], [ 149, 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159, 161, 163 ], [ 165 ], [ 167 ], [ 169, 171, 173 ], [ 175 ], [ 177, 179, 181 ], [ 183, 185 ], [ 187 ], [ 189 ], [ 191 ], [ 195 ], [ 197, 199 ], [ 201, 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 235 ], [ 237 ] ]
12,040
static void rtsp_send_cmd(AVFormatContext *s, const char *cmd, RTSPHeader *reply, unsigned char **content_ptr) { RTSPState *rt = s->priv_data; char buf[4096], buf1[1024], *q; unsigned char ch; const char *p; int content_length, line_count; unsigned char *content = NULL; memset(reply, 0, sizeof(RTSPHeader)); rt->seq++; pstrcpy(buf, sizeof(buf), cmd); snprintf(buf1, sizeof(buf1), "CSeq: %d\r\n", rt->seq); pstrcat(buf, sizeof(buf), buf1); if (rt->session_id[0] != '\0' && !strstr(cmd, "\nIf-Match:")) { snprintf(buf1, sizeof(buf1), "Session: %s\r\n", rt->session_id); pstrcat(buf, sizeof(buf), buf1); } pstrcat(buf, sizeof(buf), "\r\n"); #ifdef DEBUG printf("Sending:\n%s--\n", buf); #endif url_write(rt->rtsp_hd, buf, strlen(buf)); /* parse reply (XXX: use buffers) */ line_count = 0; rt->last_reply[0] = '\0'; for(;;) { q = buf; for(;;) { if (url_read(rt->rtsp_hd, &ch, 1) == 0) break; if (ch == '\n') break; if (ch != '\r') { if ((q - buf) < sizeof(buf) - 1) *q++ = ch; } } *q = '\0'; #ifdef DEBUG printf("line='%s'\n", buf); #endif /* test if last line */ if (buf[0] == '\0') break; p = buf; if (line_count == 0) { /* get reply code */ get_word(buf1, sizeof(buf1), &p); get_word(buf1, sizeof(buf1), &p); reply->status_code = atoi(buf1); } else { rtsp_parse_line(reply, p); pstrcat(rt->last_reply, sizeof(rt->last_reply), p); pstrcat(rt->last_reply, sizeof(rt->last_reply), "\n"); } line_count++; } if (rt->session_id[0] == '\0' && reply->session_id[0] != '\0') pstrcpy(rt->session_id, sizeof(rt->session_id), reply->session_id); content_length = reply->content_length; if (content_length > 0) { /* leave some room for a trailing '\0' (useful for simple parsing) */ content = av_malloc(content_length + 1); url_read(rt->rtsp_hd, content, content_length); content[content_length] = '\0'; } if (content_ptr) *content_ptr = content; }
false
FFmpeg
b7b8fc340632d15cb3b26a57915ebea84f37d03e
static void rtsp_send_cmd(AVFormatContext *s, const char *cmd, RTSPHeader *reply, unsigned char **content_ptr) { RTSPState *rt = s->priv_data; char buf[4096], buf1[1024], *q; unsigned char ch; const char *p; int content_length, line_count; unsigned char *content = NULL; memset(reply, 0, sizeof(RTSPHeader)); rt->seq++; pstrcpy(buf, sizeof(buf), cmd); snprintf(buf1, sizeof(buf1), "CSeq: %d\r\n", rt->seq); pstrcat(buf, sizeof(buf), buf1); if (rt->session_id[0] != '\0' && !strstr(cmd, "\nIf-Match:")) { snprintf(buf1, sizeof(buf1), "Session: %s\r\n", rt->session_id); pstrcat(buf, sizeof(buf), buf1); } pstrcat(buf, sizeof(buf), "\r\n"); #ifdef DEBUG printf("Sending:\n%s--\n", buf); #endif url_write(rt->rtsp_hd, buf, strlen(buf)); line_count = 0; rt->last_reply[0] = '\0'; for(;;) { q = buf; for(;;) { if (url_read(rt->rtsp_hd, &ch, 1) == 0) break; if (ch == '\n') break; if (ch != '\r') { if ((q - buf) < sizeof(buf) - 1) *q++ = ch; } } *q = '\0'; #ifdef DEBUG printf("line='%s'\n", buf); #endif if (buf[0] == '\0') break; p = buf; if (line_count == 0) { get_word(buf1, sizeof(buf1), &p); get_word(buf1, sizeof(buf1), &p); reply->status_code = atoi(buf1); } else { rtsp_parse_line(reply, p); pstrcat(rt->last_reply, sizeof(rt->last_reply), p); pstrcat(rt->last_reply, sizeof(rt->last_reply), "\n"); } line_count++; } if (rt->session_id[0] == '\0' && reply->session_id[0] != '\0') pstrcpy(rt->session_id, sizeof(rt->session_id), reply->session_id); content_length = reply->content_length; if (content_length > 0) { content = av_malloc(content_length + 1); url_read(rt->rtsp_hd, content, content_length); content[content_length] = '\0'; } if (content_ptr) *content_ptr = content; }
{ "code": [], "line_no": [] }
static void FUNC_0(AVFormatContext *VAR_0, const char *VAR_1, RTSPHeader *VAR_2, unsigned char **VAR_3) { RTSPState *rt = VAR_0->priv_data; char VAR_4[4096], VAR_5[1024], *VAR_6; unsigned char VAR_7; const char *VAR_8; int VAR_9, VAR_10; unsigned char *VAR_11 = NULL; memset(VAR_2, 0, sizeof(RTSPHeader)); rt->seq++; pstrcpy(VAR_4, sizeof(VAR_4), VAR_1); snprintf(VAR_5, sizeof(VAR_5), "CSeq: %d\r\n", rt->seq); pstrcat(VAR_4, sizeof(VAR_4), VAR_5); if (rt->session_id[0] != '\0' && !strstr(VAR_1, "\nIf-Match:")) { snprintf(VAR_5, sizeof(VAR_5), "Session: %VAR_0\r\n", rt->session_id); pstrcat(VAR_4, sizeof(VAR_4), VAR_5); } pstrcat(VAR_4, sizeof(VAR_4), "\r\n"); #ifdef DEBUG printf("Sending:\n%VAR_0--\n", VAR_4); #endif url_write(rt->rtsp_hd, VAR_4, strlen(VAR_4)); VAR_10 = 0; rt->last_reply[0] = '\0'; for(;;) { VAR_6 = VAR_4; for(;;) { if (url_read(rt->rtsp_hd, &VAR_7, 1) == 0) break; if (VAR_7 == '\n') break; if (VAR_7 != '\r') { if ((VAR_6 - VAR_4) < sizeof(VAR_4) - 1) *VAR_6++ = VAR_7; } } *VAR_6 = '\0'; #ifdef DEBUG printf("line='%VAR_0'\n", VAR_4); #endif if (VAR_4[0] == '\0') break; VAR_8 = VAR_4; if (VAR_10 == 0) { get_word(VAR_5, sizeof(VAR_5), &VAR_8); get_word(VAR_5, sizeof(VAR_5), &VAR_8); VAR_2->status_code = atoi(VAR_5); } else { rtsp_parse_line(VAR_2, VAR_8); pstrcat(rt->last_reply, sizeof(rt->last_reply), VAR_8); pstrcat(rt->last_reply, sizeof(rt->last_reply), "\n"); } VAR_10++; } if (rt->session_id[0] == '\0' && VAR_2->session_id[0] != '\0') pstrcpy(rt->session_id, sizeof(rt->session_id), VAR_2->session_id); VAR_9 = VAR_2->VAR_9; if (VAR_9 > 0) { VAR_11 = av_malloc(VAR_9 + 1); url_read(rt->rtsp_hd, VAR_11, VAR_9); VAR_11[VAR_9] = '\0'; } if (VAR_3) *VAR_3 = VAR_11; }
[ "static void FUNC_0(AVFormatContext *VAR_0,\nconst char *VAR_1, RTSPHeader *VAR_2,\nunsigned char **VAR_3)\n{", "RTSPState *rt = VAR_0->priv_data;", "char VAR_4[4096], VAR_5[1024], *VAR_6;", "unsigned char VAR_7;", "const char *VAR_8;", "int VAR_9, VAR_10;", "unsigned char *VAR_11 = NULL;", "memset(VAR_2, 0, sizeof(RTSPHeader));", "rt->seq++;", "pstrcpy(VAR_4, sizeof(VAR_4), VAR_1);", "snprintf(VAR_5, sizeof(VAR_5), \"CSeq: %d\\r\\n\", rt->seq);", "pstrcat(VAR_4, sizeof(VAR_4), VAR_5);", "if (rt->session_id[0] != '\\0' && !strstr(VAR_1, \"\\nIf-Match:\")) {", "snprintf(VAR_5, sizeof(VAR_5), \"Session: %VAR_0\\r\\n\", rt->session_id);", "pstrcat(VAR_4, sizeof(VAR_4), VAR_5);", "}", "pstrcat(VAR_4, sizeof(VAR_4), \"\\r\\n\");", "#ifdef DEBUG\nprintf(\"Sending:\\n%VAR_0--\\n\", VAR_4);", "#endif\nurl_write(rt->rtsp_hd, VAR_4, strlen(VAR_4));", "VAR_10 = 0;", "rt->last_reply[0] = '\\0';", "for(;;) {", "VAR_6 = VAR_4;", "for(;;) {", "if (url_read(rt->rtsp_hd, &VAR_7, 1) == 0)\nbreak;", "if (VAR_7 == '\\n')\nbreak;", "if (VAR_7 != '\\r') {", "if ((VAR_6 - VAR_4) < sizeof(VAR_4) - 1)\n*VAR_6++ = VAR_7;", "}", "}", "*VAR_6 = '\\0';", "#ifdef DEBUG\nprintf(\"line='%VAR_0'\\n\", VAR_4);", "#endif\nif (VAR_4[0] == '\\0')\nbreak;", "VAR_8 = VAR_4;", "if (VAR_10 == 0) {", "get_word(VAR_5, sizeof(VAR_5), &VAR_8);", "get_word(VAR_5, sizeof(VAR_5), &VAR_8);", "VAR_2->status_code = atoi(VAR_5);", "} else {", "rtsp_parse_line(VAR_2, VAR_8);", "pstrcat(rt->last_reply, sizeof(rt->last_reply), VAR_8);", "pstrcat(rt->last_reply, sizeof(rt->last_reply), \"\\n\");", "}", "VAR_10++;", "}", "if (rt->session_id[0] == '\\0' && VAR_2->session_id[0] != '\\0')\npstrcpy(rt->session_id, sizeof(rt->session_id), VAR_2->session_id);", "VAR_9 = VAR_2->VAR_9;", "if (VAR_9 > 0) {", "VAR_11 = av_malloc(VAR_9 + 1);", "url_read(rt->rtsp_hd, VAR_11, VAR_9);", "VAR_11[VAR_9] = '\\0';", "}", "if (VAR_3)\n*VAR_3 = VAR_11;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45, 47 ], [ 49, 51 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67, 69 ], [ 71, 73 ], [ 75 ], [ 77, 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87, 89 ], [ 91, 95, 97 ], [ 99 ], [ 101 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 127, 129 ], [ 133 ], [ 135 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147, 149 ], [ 151 ] ]
12,042
static void hb_regs_write(void *opaque, target_phys_addr_t offset, uint64_t value, unsigned size) { uint32_t *regs = opaque; if (offset == 0xf00) { if (value == 1 || value == 2) { qemu_system_reset_request(); } else if (value == 3) { qemu_system_shutdown_request(); } } regs[offset/4] = value; }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static void hb_regs_write(void *opaque, target_phys_addr_t offset, uint64_t value, unsigned size) { uint32_t *regs = opaque; if (offset == 0xf00) { if (value == 1 || value == 2) { qemu_system_reset_request(); } else if (value == 3) { qemu_system_shutdown_request(); } } regs[offset/4] = value; }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1, uint64_t VAR_2, unsigned VAR_3) { uint32_t *regs = VAR_0; if (VAR_1 == 0xf00) { if (VAR_2 == 1 || VAR_2 == 2) { qemu_system_reset_request(); } else if (VAR_2 == 3) { qemu_system_shutdown_request(); } } regs[VAR_1/4] = VAR_2; }
[ "static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1,\nuint64_t VAR_2, unsigned VAR_3)\n{", "uint32_t *regs = VAR_0;", "if (VAR_1 == 0xf00) {", "if (VAR_2 == 1 || VAR_2 == 2) {", "qemu_system_reset_request();", "} else if (VAR_2 == 3) {", "qemu_system_shutdown_request();", "}", "}", "regs[VAR_1/4] = VAR_2;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ] ]
12,043
static int print_size(DeviceState *dev, Property *prop, char *dest, size_t len) { uint64_t *ptr = qdev_get_prop_ptr(dev, prop); char suffixes[] = {'T', 'G', 'M', 'K', 'B'}; int i = 0; uint64_t div; for (div = 1ULL << 40; !(*ptr / div) ; div >>= 10) { i++; } return snprintf(dest, len, "%0.03f%c", (double)*ptr/div, suffixes[i]); }
false
qemu
1197cbb9eda1dc82e2fa1815ca62bc3de158353e
static int print_size(DeviceState *dev, Property *prop, char *dest, size_t len) { uint64_t *ptr = qdev_get_prop_ptr(dev, prop); char suffixes[] = {'T', 'G', 'M', 'K', 'B'}; int i = 0; uint64_t div; for (div = 1ULL << 40; !(*ptr / div) ; div >>= 10) { i++; } return snprintf(dest, len, "%0.03f%c", (double)*ptr/div, suffixes[i]); }
{ "code": [], "line_no": [] }
static int FUNC_0(DeviceState *VAR_0, Property *VAR_1, char *VAR_2, size_t VAR_3) { uint64_t *ptr = qdev_get_prop_ptr(VAR_0, VAR_1); char VAR_4[] = {'T', 'G', 'M', 'K', 'B'}; int VAR_5 = 0; uint64_t div; for (div = 1ULL << 40; !(*ptr / div) ; div >>= 10) { VAR_5++; } return snprintf(VAR_2, VAR_3, "%0.03f%c", (double)*ptr/div, VAR_4[VAR_5]); }
[ "static int FUNC_0(DeviceState *VAR_0, Property *VAR_1, char *VAR_2, size_t VAR_3)\n{", "uint64_t *ptr = qdev_get_prop_ptr(VAR_0, VAR_1);", "char VAR_4[] = {'T', 'G', 'M', 'K', 'B'};", "int VAR_5 = 0;", "uint64_t div;", "for (div = 1ULL << 40; !(*ptr / div) ; div >>= 10) {", "VAR_5++;", "}", "return snprintf(VAR_2, VAR_3, \"%0.03f%c\", (double)*ptr/div, VAR_4[VAR_5]);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ] ]
12,044
float64 HELPER(sub_cmp_f64)(CPUState *env, float64 a, float64 b) { /* ??? This may incorrectly raise exceptions. */ /* ??? Should flush denormals to zero. */ float64 res; res = float64_sub(a, b, &env->fp_status); if (float64_is_nan(res)) { /* +/-inf compares equal against itself, but sub returns nan. */ if (!float64_is_nan(a) && !float64_is_nan(b)) { res = float64_zero; if (float64_lt_quiet(a, res, &env->fp_status)) res = float64_chs(res); } } return res; }
false
qemu
185698715dfb18c82ad2a5dbc169908602d43e81
float64 HELPER(sub_cmp_f64)(CPUState *env, float64 a, float64 b) { float64 res; res = float64_sub(a, b, &env->fp_status); if (float64_is_nan(res)) { if (!float64_is_nan(a) && !float64_is_nan(b)) { res = float64_zero; if (float64_lt_quiet(a, res, &env->fp_status)) res = float64_chs(res); } } return res; }
{ "code": [], "line_no": [] }
float64 FUNC_0(sub_cmp_f64)(CPUState *env, float64 a, float64 b) { float64 res; res = float64_sub(a, b, &env->fp_status); if (float64_is_nan(res)) { if (!float64_is_nan(a) && !float64_is_nan(b)) { res = float64_zero; if (float64_lt_quiet(a, res, &env->fp_status)) res = float64_chs(res); } } return res; }
[ "float64 FUNC_0(sub_cmp_f64)(CPUState *env, float64 a, float64 b)\n{", "float64 res;", "res = float64_sub(a, b, &env->fp_status);", "if (float64_is_nan(res)) {", "if (!float64_is_nan(a)\n&& !float64_is_nan(b)) {", "res = float64_zero;", "if (float64_lt_quiet(a, res, &env->fp_status))\nres = float64_chs(res);", "}", "}", "return res;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 9 ], [ 11 ], [ 13 ], [ 17, 19 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ] ]
12,045
static void trim_aio_cancel(BlockAIOCB *acb) { TrimAIOCB *iocb = container_of(acb, TrimAIOCB, common); /* Exit the loop so ide_issue_trim_cb will not continue */ iocb->j = iocb->qiov->niov - 1; iocb->i = (iocb->qiov->iov[iocb->j].iov_len / 8) - 1; iocb->ret = -ECANCELED; if (iocb->aiocb) { bdrv_aio_cancel_async(iocb->aiocb); iocb->aiocb = NULL; } }
false
qemu
4be746345f13e99e468c60acbd3a355e8183e3ce
static void trim_aio_cancel(BlockAIOCB *acb) { TrimAIOCB *iocb = container_of(acb, TrimAIOCB, common); iocb->j = iocb->qiov->niov - 1; iocb->i = (iocb->qiov->iov[iocb->j].iov_len / 8) - 1; iocb->ret = -ECANCELED; if (iocb->aiocb) { bdrv_aio_cancel_async(iocb->aiocb); iocb->aiocb = NULL; } }
{ "code": [], "line_no": [] }
static void FUNC_0(BlockAIOCB *VAR_0) { TrimAIOCB *iocb = container_of(VAR_0, TrimAIOCB, common); iocb->j = iocb->qiov->niov - 1; iocb->i = (iocb->qiov->iov[iocb->j].iov_len / 8) - 1; iocb->ret = -ECANCELED; if (iocb->aiocb) { bdrv_aio_cancel_async(iocb->aiocb); iocb->aiocb = NULL; } }
[ "static void FUNC_0(BlockAIOCB *VAR_0)\n{", "TrimAIOCB *iocb = container_of(VAR_0, TrimAIOCB, common);", "iocb->j = iocb->qiov->niov - 1;", "iocb->i = (iocb->qiov->iov[iocb->j].iov_len / 8) - 1;", "iocb->ret = -ECANCELED;", "if (iocb->aiocb) {", "bdrv_aio_cancel_async(iocb->aiocb);", "iocb->aiocb = NULL;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 11 ], [ 13 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ] ]
12,046
static uint64_t cadence_ttc_read(void *opaque, target_phys_addr_t offset, unsigned size) { uint32_t ret = cadence_ttc_read_imp(opaque, offset); DB_PRINT("addr: %08x data: %08x\n", offset, ret); return ret; }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static uint64_t cadence_ttc_read(void *opaque, target_phys_addr_t offset, unsigned size) { uint32_t ret = cadence_ttc_read_imp(opaque, offset); DB_PRINT("addr: %08x data: %08x\n", offset, ret); return ret; }
{ "code": [], "line_no": [] }
static uint64_t FUNC_0(void *opaque, target_phys_addr_t offset, unsigned size) { uint32_t ret = cadence_ttc_read_imp(opaque, offset); DB_PRINT("addr: %08x data: %08x\n", offset, ret); return ret; }
[ "static uint64_t FUNC_0(void *opaque, target_phys_addr_t offset,\nunsigned size)\n{", "uint32_t ret = cadence_ttc_read_imp(opaque, offset);", "DB_PRINT(\"addr: %08x data: %08x\\n\", offset, ret);", "return ret;", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ] ]
12,047
static void scsi_do_read(void *opaque, int ret) { SCSIDiskReq *r = opaque; SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev); uint32_t n; if (r->req.aiocb != NULL) { r->req.aiocb = NULL; bdrv_acct_done(s->qdev.conf.bs, &r->acct); } if (ret < 0) { if (scsi_handle_rw_error(r, -ret)) { goto done; } } if (r->req.io_canceled) { return; } /* The request is used as the AIO opaque value, so add a ref. */ scsi_req_ref(&r->req); if (r->req.sg) { dma_acct_start(s->qdev.conf.bs, &r->acct, r->req.sg, BDRV_ACCT_READ); r->req.resid -= r->req.sg->size; r->req.aiocb = dma_bdrv_read(s->qdev.conf.bs, r->req.sg, r->sector, scsi_dma_complete, r); } else { n = scsi_init_iovec(r, SCSI_DMA_BUF_SIZE); bdrv_acct_start(s->qdev.conf.bs, &r->acct, n * BDRV_SECTOR_SIZE, BDRV_ACCT_READ); r->req.aiocb = bdrv_aio_readv(s->qdev.conf.bs, r->sector, &r->qiov, n, scsi_read_complete, r); } done: if (!r->req.io_canceled) { scsi_req_unref(&r->req); } }
false
qemu
0c92e0e6b64c9061f7365a2712b9055ea35b52f9
static void scsi_do_read(void *opaque, int ret) { SCSIDiskReq *r = opaque; SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev); uint32_t n; if (r->req.aiocb != NULL) { r->req.aiocb = NULL; bdrv_acct_done(s->qdev.conf.bs, &r->acct); } if (ret < 0) { if (scsi_handle_rw_error(r, -ret)) { goto done; } } if (r->req.io_canceled) { return; } scsi_req_ref(&r->req); if (r->req.sg) { dma_acct_start(s->qdev.conf.bs, &r->acct, r->req.sg, BDRV_ACCT_READ); r->req.resid -= r->req.sg->size; r->req.aiocb = dma_bdrv_read(s->qdev.conf.bs, r->req.sg, r->sector, scsi_dma_complete, r); } else { n = scsi_init_iovec(r, SCSI_DMA_BUF_SIZE); bdrv_acct_start(s->qdev.conf.bs, &r->acct, n * BDRV_SECTOR_SIZE, BDRV_ACCT_READ); r->req.aiocb = bdrv_aio_readv(s->qdev.conf.bs, r->sector, &r->qiov, n, scsi_read_complete, r); } done: if (!r->req.io_canceled) { scsi_req_unref(&r->req); } }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, int VAR_1) { SCSIDiskReq *r = VAR_0; SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev); uint32_t n; if (r->req.aiocb != NULL) { r->req.aiocb = NULL; bdrv_acct_done(s->qdev.conf.bs, &r->acct); } if (VAR_1 < 0) { if (scsi_handle_rw_error(r, -VAR_1)) { goto done; } } if (r->req.io_canceled) { return; } scsi_req_ref(&r->req); if (r->req.sg) { dma_acct_start(s->qdev.conf.bs, &r->acct, r->req.sg, BDRV_ACCT_READ); r->req.resid -= r->req.sg->size; r->req.aiocb = dma_bdrv_read(s->qdev.conf.bs, r->req.sg, r->sector, scsi_dma_complete, r); } else { n = scsi_init_iovec(r, SCSI_DMA_BUF_SIZE); bdrv_acct_start(s->qdev.conf.bs, &r->acct, n * BDRV_SECTOR_SIZE, BDRV_ACCT_READ); r->req.aiocb = bdrv_aio_readv(s->qdev.conf.bs, r->sector, &r->qiov, n, scsi_read_complete, r); } done: if (!r->req.io_canceled) { scsi_req_unref(&r->req); } }
[ "static void FUNC_0(void *VAR_0, int VAR_1)\n{", "SCSIDiskReq *r = VAR_0;", "SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev);", "uint32_t n;", "if (r->req.aiocb != NULL) {", "r->req.aiocb = NULL;", "bdrv_acct_done(s->qdev.conf.bs, &r->acct);", "}", "if (VAR_1 < 0) {", "if (scsi_handle_rw_error(r, -VAR_1)) {", "goto done;", "}", "}", "if (r->req.io_canceled) {", "return;", "}", "scsi_req_ref(&r->req);", "if (r->req.sg) {", "dma_acct_start(s->qdev.conf.bs, &r->acct, r->req.sg, BDRV_ACCT_READ);", "r->req.resid -= r->req.sg->size;", "r->req.aiocb = dma_bdrv_read(s->qdev.conf.bs, r->req.sg, r->sector,\nscsi_dma_complete, r);", "} else {", "n = scsi_init_iovec(r, SCSI_DMA_BUF_SIZE);", "bdrv_acct_start(s->qdev.conf.bs, &r->acct, n * BDRV_SECTOR_SIZE, BDRV_ACCT_READ);", "r->req.aiocb = bdrv_aio_readv(s->qdev.conf.bs, r->sector, &r->qiov, n,\nscsi_read_complete, r);", "}", "done:\nif (!r->req.io_canceled) {", "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, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55, 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65, 67 ], [ 69 ], [ 73, 75 ], [ 77 ], [ 79 ], [ 81 ] ]
12,048
void *etraxfs_dmac_init(CPUState *env, target_phys_addr_t base, int nr_channels) { struct fs_dma_ctrl *ctrl = NULL; int i; ctrl = qemu_mallocz(sizeof *ctrl); if (!ctrl) return NULL; ctrl->base = base; ctrl->env = env; ctrl->nr_channels = nr_channels; ctrl->channels = qemu_mallocz(sizeof ctrl->channels[0] * nr_channels); if (!ctrl->channels) goto err; for (i = 0; i < nr_channels; i++) { ctrl->channels[i].regmap = cpu_register_io_memory(0, dma_read, dma_write, ctrl); cpu_register_physical_memory (base + i * 0x2000, sizeof ctrl->channels[i].regs, ctrl->channels[i].regmap); } /* Hax, we only support one DMA controller at a time. */ etraxfs_dmac = ctrl; return ctrl; err: qemu_free(ctrl->channels); qemu_free(ctrl); return NULL; }
false
qemu
492c30af2567a59413c064f88eb81e1691865195
void *etraxfs_dmac_init(CPUState *env, target_phys_addr_t base, int nr_channels) { struct fs_dma_ctrl *ctrl = NULL; int i; ctrl = qemu_mallocz(sizeof *ctrl); if (!ctrl) return NULL; ctrl->base = base; ctrl->env = env; ctrl->nr_channels = nr_channels; ctrl->channels = qemu_mallocz(sizeof ctrl->channels[0] * nr_channels); if (!ctrl->channels) goto err; for (i = 0; i < nr_channels; i++) { ctrl->channels[i].regmap = cpu_register_io_memory(0, dma_read, dma_write, ctrl); cpu_register_physical_memory (base + i * 0x2000, sizeof ctrl->channels[i].regs, ctrl->channels[i].regmap); } etraxfs_dmac = ctrl; return ctrl; err: qemu_free(ctrl->channels); qemu_free(ctrl); return NULL; }
{ "code": [], "line_no": [] }
void *FUNC_0(CPUState *VAR_0, target_phys_addr_t VAR_1, int VAR_2) { struct fs_dma_ctrl *VAR_3 = NULL; int VAR_4; VAR_3 = qemu_mallocz(sizeof *VAR_3); if (!VAR_3) return NULL; VAR_3->VAR_1 = VAR_1; VAR_3->VAR_0 = VAR_0; VAR_3->VAR_2 = VAR_2; VAR_3->channels = qemu_mallocz(sizeof VAR_3->channels[0] * VAR_2); if (!VAR_3->channels) goto err; for (VAR_4 = 0; VAR_4 < VAR_2; VAR_4++) { VAR_3->channels[VAR_4].regmap = cpu_register_io_memory(0, dma_read, dma_write, VAR_3); cpu_register_physical_memory (VAR_1 + VAR_4 * 0x2000, sizeof VAR_3->channels[VAR_4].regs, VAR_3->channels[VAR_4].regmap); } etraxfs_dmac = VAR_3; return VAR_3; err: qemu_free(VAR_3->channels); qemu_free(VAR_3); return NULL; }
[ "void *FUNC_0(CPUState *VAR_0,\ntarget_phys_addr_t VAR_1, int VAR_2)\n{", "struct fs_dma_ctrl *VAR_3 = NULL;", "int VAR_4;", "VAR_3 = qemu_mallocz(sizeof *VAR_3);", "if (!VAR_3)\nreturn NULL;", "VAR_3->VAR_1 = VAR_1;", "VAR_3->VAR_0 = VAR_0;", "VAR_3->VAR_2 = VAR_2;", "VAR_3->channels = qemu_mallocz(sizeof VAR_3->channels[0] * VAR_2);", "if (!VAR_3->channels)\ngoto err;", "for (VAR_4 = 0; VAR_4 < VAR_2; VAR_4++)", "{", "VAR_3->channels[VAR_4].regmap = cpu_register_io_memory(0,\ndma_read,\ndma_write,\nVAR_3);", "cpu_register_physical_memory (VAR_1 + VAR_4 * 0x2000,\nsizeof VAR_3->channels[VAR_4].regs,\nVAR_3->channels[VAR_4].regmap);", "}", "etraxfs_dmac = VAR_3;", "return VAR_3;", "err:\nqemu_free(VAR_3->channels);", "qemu_free(VAR_3);", "return NULL;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15, 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29, 31 ], [ 35 ], [ 37 ], [ 39, 41, 43, 45 ], [ 47, 49, 51 ], [ 53 ], [ 59 ], [ 61 ], [ 63, 65 ], [ 67 ], [ 69 ], [ 71 ] ]
12,050
void lm4549_write(lm4549_state *s, target_phys_addr_t offset, uint32_t value) { uint16_t *regfile = s->regfile; assert(offset < 128); DPRINTF("write [0x%02x] = 0x%04x\n", offset, value); switch (offset) { case LM4549_Reset: lm4549_reset(s); break; case LM4549_PCM_Front_DAC_Rate: regfile[LM4549_PCM_Front_DAC_Rate] = value; DPRINTF("DAC rate change = %i\n", value); /* Re-open a voice with the new sample rate */ struct audsettings as; as.freq = value; as.nchannels = 2; as.fmt = AUD_FMT_S16; as.endianness = 0; s->voice = AUD_open_out( &s->card, s->voice, "lm4549.out", s, lm4549_audio_out_callback, &as ); break; case LM4549_Powerdown_Ctrl_Stat: value &= ~0xf; value |= regfile[LM4549_Powerdown_Ctrl_Stat] & 0xf; regfile[LM4549_Powerdown_Ctrl_Stat] = value; break; case LM4549_Ext_Audio_ID: case LM4549_Vendor_ID1: case LM4549_Vendor_ID2: DPRINTF("Write to read-only register 0x%x\n", (int)offset); break; default: /* Store the new value */ regfile[offset] = value; break; } }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
void lm4549_write(lm4549_state *s, target_phys_addr_t offset, uint32_t value) { uint16_t *regfile = s->regfile; assert(offset < 128); DPRINTF("write [0x%02x] = 0x%04x\n", offset, value); switch (offset) { case LM4549_Reset: lm4549_reset(s); break; case LM4549_PCM_Front_DAC_Rate: regfile[LM4549_PCM_Front_DAC_Rate] = value; DPRINTF("DAC rate change = %i\n", value); struct audsettings as; as.freq = value; as.nchannels = 2; as.fmt = AUD_FMT_S16; as.endianness = 0; s->voice = AUD_open_out( &s->card, s->voice, "lm4549.out", s, lm4549_audio_out_callback, &as ); break; case LM4549_Powerdown_Ctrl_Stat: value &= ~0xf; value |= regfile[LM4549_Powerdown_Ctrl_Stat] & 0xf; regfile[LM4549_Powerdown_Ctrl_Stat] = value; break; case LM4549_Ext_Audio_ID: case LM4549_Vendor_ID1: case LM4549_Vendor_ID2: DPRINTF("Write to read-only register 0x%x\n", (int)offset); break; default: regfile[offset] = value; break; } }
{ "code": [], "line_no": [] }
void FUNC_0(lm4549_state *VAR_0, target_phys_addr_t VAR_1, uint32_t VAR_2) { uint16_t *regfile = VAR_0->regfile; assert(VAR_1 < 128); DPRINTF("write [0x%02x] = 0x%04x\n", VAR_1, VAR_2); switch (VAR_1) { case LM4549_Reset: lm4549_reset(VAR_0); break; case LM4549_PCM_Front_DAC_Rate: regfile[LM4549_PCM_Front_DAC_Rate] = VAR_2; DPRINTF("DAC rate change = %i\n", VAR_2); struct audsettings VAR_3; VAR_3.freq = VAR_2; VAR_3.nchannels = 2; VAR_3.fmt = AUD_FMT_S16; VAR_3.endianness = 0; VAR_0->voice = AUD_open_out( &VAR_0->card, VAR_0->voice, "lm4549.out", VAR_0, lm4549_audio_out_callback, &VAR_3 ); break; case LM4549_Powerdown_Ctrl_Stat: VAR_2 &= ~0xf; VAR_2 |= regfile[LM4549_Powerdown_Ctrl_Stat] & 0xf; regfile[LM4549_Powerdown_Ctrl_Stat] = VAR_2; break; case LM4549_Ext_Audio_ID: case LM4549_Vendor_ID1: case LM4549_Vendor_ID2: DPRINTF("Write to read-only register 0x%x\n", (int)VAR_1); break; default: regfile[VAR_1] = VAR_2; break; } }
[ "void FUNC_0(lm4549_state *VAR_0,\ntarget_phys_addr_t VAR_1, uint32_t VAR_2)\n{", "uint16_t *regfile = VAR_0->regfile;", "assert(VAR_1 < 128);", "DPRINTF(\"write [0x%02x] = 0x%04x\\n\", VAR_1, VAR_2);", "switch (VAR_1) {", "case LM4549_Reset:\nlm4549_reset(VAR_0);", "break;", "case LM4549_PCM_Front_DAC_Rate:\nregfile[LM4549_PCM_Front_DAC_Rate] = VAR_2;", "DPRINTF(\"DAC rate change = %i\\n\", VAR_2);", "struct audsettings VAR_3;", "VAR_3.freq = VAR_2;", "VAR_3.nchannels = 2;", "VAR_3.fmt = AUD_FMT_S16;", "VAR_3.endianness = 0;", "VAR_0->voice = AUD_open_out(\n&VAR_0->card,\nVAR_0->voice,\n\"lm4549.out\",\nVAR_0,\nlm4549_audio_out_callback,\n&VAR_3\n);", "break;", "case LM4549_Powerdown_Ctrl_Stat:\nVAR_2 &= ~0xf;", "VAR_2 |= regfile[LM4549_Powerdown_Ctrl_Stat] & 0xf;", "regfile[LM4549_Powerdown_Ctrl_Stat] = VAR_2;", "break;", "case LM4549_Ext_Audio_ID:\ncase LM4549_Vendor_ID1:\ncase LM4549_Vendor_ID2:\nDPRINTF(\"Write to read-only register 0x%x\\n\", (int)VAR_1);", "break;", "default:\nregfile[VAR_1] = 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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13 ], [ 17 ], [ 19, 21 ], [ 23 ], [ 27, 29 ], [ 31 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49, 51, 53, 55, 57, 59, 61, 63 ], [ 65 ], [ 69, 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81, 83, 85, 87 ], [ 89 ], [ 93, 97 ], [ 99 ], [ 101 ], [ 103 ] ]
12,051
static void gmc1_motion(MpegEncContext *s, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, uint8_t **ref_picture) { uint8_t *ptr; int offset, src_x, src_y, linesize, uvlinesize; int motion_x, motion_y; int emu=0; motion_x= s->sprite_offset[0][0]; motion_y= s->sprite_offset[0][1]; src_x = s->mb_x * 16 + (motion_x >> (s->sprite_warping_accuracy+1)); src_y = s->mb_y * 16 + (motion_y >> (s->sprite_warping_accuracy+1)); motion_x<<=(3-s->sprite_warping_accuracy); motion_y<<=(3-s->sprite_warping_accuracy); src_x = av_clip(src_x, -16, s->width); if (src_x == s->width) motion_x =0; src_y = av_clip(src_y, -16, s->height); if (src_y == s->height) motion_y =0; linesize = s->linesize; uvlinesize = s->uvlinesize; ptr = ref_picture[0] + (src_y * linesize) + src_x; if(s->flags&CODEC_FLAG_EMU_EDGE){ if( (unsigned)src_x >= FFMAX(s->h_edge_pos - 17, 0) || (unsigned)src_y >= FFMAX(s->v_edge_pos - 17, 0)){ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr, linesize, 17, 17, src_x, src_y, s->h_edge_pos, s->v_edge_pos); ptr= s->edge_emu_buffer; } } if((motion_x|motion_y)&7){ s->dsp.gmc1(dest_y , ptr , linesize, 16, motion_x&15, motion_y&15, 128 - s->no_rounding); s->dsp.gmc1(dest_y+8, ptr+8, linesize, 16, motion_x&15, motion_y&15, 128 - s->no_rounding); }else{ int dxy; dxy= ((motion_x>>3)&1) | ((motion_y>>2)&2); if (s->no_rounding){ s->hdsp.put_no_rnd_pixels_tab[0][dxy](dest_y, ptr, linesize, 16); }else{ s->hdsp.put_pixels_tab [0][dxy](dest_y, ptr, linesize, 16); } } if(CONFIG_GRAY && s->flags&CODEC_FLAG_GRAY) return; motion_x= s->sprite_offset[1][0]; motion_y= s->sprite_offset[1][1]; src_x = s->mb_x * 8 + (motion_x >> (s->sprite_warping_accuracy+1)); src_y = s->mb_y * 8 + (motion_y >> (s->sprite_warping_accuracy+1)); motion_x<<=(3-s->sprite_warping_accuracy); motion_y<<=(3-s->sprite_warping_accuracy); src_x = av_clip(src_x, -8, s->width>>1); if (src_x == s->width>>1) motion_x =0; src_y = av_clip(src_y, -8, s->height>>1); if (src_y == s->height>>1) motion_y =0; offset = (src_y * uvlinesize) + src_x; ptr = ref_picture[1] + offset; if(s->flags&CODEC_FLAG_EMU_EDGE){ if( (unsigned)src_x >= FFMAX((s->h_edge_pos>>1) - 9, 0) || (unsigned)src_y >= FFMAX((s->v_edge_pos>>1) - 9, 0)){ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr, uvlinesize, 9, 9, src_x, src_y, s->h_edge_pos>>1, s->v_edge_pos>>1); ptr= s->edge_emu_buffer; emu=1; } } s->dsp.gmc1(dest_cb, ptr, uvlinesize, 8, motion_x&15, motion_y&15, 128 - s->no_rounding); ptr = ref_picture[2] + offset; if(emu){ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr, uvlinesize, 9, 9, src_x, src_y, s->h_edge_pos>>1, s->v_edge_pos>>1); ptr= s->edge_emu_buffer; } s->dsp.gmc1(dest_cr, ptr, uvlinesize, 8, motion_x&15, motion_y&15, 128 - s->no_rounding); return; }
false
FFmpeg
3969b4b861ce8152e3195e8f8c3437abd273b90a
static void gmc1_motion(MpegEncContext *s, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, uint8_t **ref_picture) { uint8_t *ptr; int offset, src_x, src_y, linesize, uvlinesize; int motion_x, motion_y; int emu=0; motion_x= s->sprite_offset[0][0]; motion_y= s->sprite_offset[0][1]; src_x = s->mb_x * 16 + (motion_x >> (s->sprite_warping_accuracy+1)); src_y = s->mb_y * 16 + (motion_y >> (s->sprite_warping_accuracy+1)); motion_x<<=(3-s->sprite_warping_accuracy); motion_y<<=(3-s->sprite_warping_accuracy); src_x = av_clip(src_x, -16, s->width); if (src_x == s->width) motion_x =0; src_y = av_clip(src_y, -16, s->height); if (src_y == s->height) motion_y =0; linesize = s->linesize; uvlinesize = s->uvlinesize; ptr = ref_picture[0] + (src_y * linesize) + src_x; if(s->flags&CODEC_FLAG_EMU_EDGE){ if( (unsigned)src_x >= FFMAX(s->h_edge_pos - 17, 0) || (unsigned)src_y >= FFMAX(s->v_edge_pos - 17, 0)){ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr, linesize, 17, 17, src_x, src_y, s->h_edge_pos, s->v_edge_pos); ptr= s->edge_emu_buffer; } } if((motion_x|motion_y)&7){ s->dsp.gmc1(dest_y , ptr , linesize, 16, motion_x&15, motion_y&15, 128 - s->no_rounding); s->dsp.gmc1(dest_y+8, ptr+8, linesize, 16, motion_x&15, motion_y&15, 128 - s->no_rounding); }else{ int dxy; dxy= ((motion_x>>3)&1) | ((motion_y>>2)&2); if (s->no_rounding){ s->hdsp.put_no_rnd_pixels_tab[0][dxy](dest_y, ptr, linesize, 16); }else{ s->hdsp.put_pixels_tab [0][dxy](dest_y, ptr, linesize, 16); } } if(CONFIG_GRAY && s->flags&CODEC_FLAG_GRAY) return; motion_x= s->sprite_offset[1][0]; motion_y= s->sprite_offset[1][1]; src_x = s->mb_x * 8 + (motion_x >> (s->sprite_warping_accuracy+1)); src_y = s->mb_y * 8 + (motion_y >> (s->sprite_warping_accuracy+1)); motion_x<<=(3-s->sprite_warping_accuracy); motion_y<<=(3-s->sprite_warping_accuracy); src_x = av_clip(src_x, -8, s->width>>1); if (src_x == s->width>>1) motion_x =0; src_y = av_clip(src_y, -8, s->height>>1); if (src_y == s->height>>1) motion_y =0; offset = (src_y * uvlinesize) + src_x; ptr = ref_picture[1] + offset; if(s->flags&CODEC_FLAG_EMU_EDGE){ if( (unsigned)src_x >= FFMAX((s->h_edge_pos>>1) - 9, 0) || (unsigned)src_y >= FFMAX((s->v_edge_pos>>1) - 9, 0)){ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr, uvlinesize, 9, 9, src_x, src_y, s->h_edge_pos>>1, s->v_edge_pos>>1); ptr= s->edge_emu_buffer; emu=1; } } s->dsp.gmc1(dest_cb, ptr, uvlinesize, 8, motion_x&15, motion_y&15, 128 - s->no_rounding); ptr = ref_picture[2] + offset; if(emu){ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr, uvlinesize, 9, 9, src_x, src_y, s->h_edge_pos>>1, s->v_edge_pos>>1); ptr= s->edge_emu_buffer; } s->dsp.gmc1(dest_cr, ptr, uvlinesize, 8, motion_x&15, motion_y&15, 128 - s->no_rounding); return; }
{ "code": [], "line_no": [] }
static void FUNC_0(MpegEncContext *VAR_0, uint8_t *VAR_1, uint8_t *VAR_2, uint8_t *VAR_3, uint8_t **VAR_4) { uint8_t *ptr; int VAR_5, VAR_6, VAR_7, VAR_8, VAR_9; int VAR_10, VAR_11; int VAR_12=0; VAR_10= VAR_0->sprite_offset[0][0]; VAR_11= VAR_0->sprite_offset[0][1]; VAR_6 = VAR_0->mb_x * 16 + (VAR_10 >> (VAR_0->sprite_warping_accuracy+1)); VAR_7 = VAR_0->mb_y * 16 + (VAR_11 >> (VAR_0->sprite_warping_accuracy+1)); VAR_10<<=(3-VAR_0->sprite_warping_accuracy); VAR_11<<=(3-VAR_0->sprite_warping_accuracy); VAR_6 = av_clip(VAR_6, -16, VAR_0->width); if (VAR_6 == VAR_0->width) VAR_10 =0; VAR_7 = av_clip(VAR_7, -16, VAR_0->height); if (VAR_7 == VAR_0->height) VAR_11 =0; VAR_8 = VAR_0->VAR_8; VAR_9 = VAR_0->VAR_9; ptr = VAR_4[0] + (VAR_7 * VAR_8) + VAR_6; if(VAR_0->flags&CODEC_FLAG_EMU_EDGE){ if( (unsigned)VAR_6 >= FFMAX(VAR_0->h_edge_pos - 17, 0) || (unsigned)VAR_7 >= FFMAX(VAR_0->v_edge_pos - 17, 0)){ VAR_0->vdsp.emulated_edge_mc(VAR_0->edge_emu_buffer, ptr, VAR_8, 17, 17, VAR_6, VAR_7, VAR_0->h_edge_pos, VAR_0->v_edge_pos); ptr= VAR_0->edge_emu_buffer; } } if((VAR_10|VAR_11)&7){ VAR_0->dsp.gmc1(VAR_1 , ptr , VAR_8, 16, VAR_10&15, VAR_11&15, 128 - VAR_0->no_rounding); VAR_0->dsp.gmc1(VAR_1+8, ptr+8, VAR_8, 16, VAR_10&15, VAR_11&15, 128 - VAR_0->no_rounding); }else{ int VAR_13; VAR_13= ((VAR_10>>3)&1) | ((VAR_11>>2)&2); if (VAR_0->no_rounding){ VAR_0->hdsp.put_no_rnd_pixels_tab[0][VAR_13](VAR_1, ptr, VAR_8, 16); }else{ VAR_0->hdsp.put_pixels_tab [0][VAR_13](VAR_1, ptr, VAR_8, 16); } } if(CONFIG_GRAY && VAR_0->flags&CODEC_FLAG_GRAY) return; VAR_10= VAR_0->sprite_offset[1][0]; VAR_11= VAR_0->sprite_offset[1][1]; VAR_6 = VAR_0->mb_x * 8 + (VAR_10 >> (VAR_0->sprite_warping_accuracy+1)); VAR_7 = VAR_0->mb_y * 8 + (VAR_11 >> (VAR_0->sprite_warping_accuracy+1)); VAR_10<<=(3-VAR_0->sprite_warping_accuracy); VAR_11<<=(3-VAR_0->sprite_warping_accuracy); VAR_6 = av_clip(VAR_6, -8, VAR_0->width>>1); if (VAR_6 == VAR_0->width>>1) VAR_10 =0; VAR_7 = av_clip(VAR_7, -8, VAR_0->height>>1); if (VAR_7 == VAR_0->height>>1) VAR_11 =0; VAR_5 = (VAR_7 * VAR_9) + VAR_6; ptr = VAR_4[1] + VAR_5; if(VAR_0->flags&CODEC_FLAG_EMU_EDGE){ if( (unsigned)VAR_6 >= FFMAX((VAR_0->h_edge_pos>>1) - 9, 0) || (unsigned)VAR_7 >= FFMAX((VAR_0->v_edge_pos>>1) - 9, 0)){ VAR_0->vdsp.emulated_edge_mc(VAR_0->edge_emu_buffer, ptr, VAR_9, 9, 9, VAR_6, VAR_7, VAR_0->h_edge_pos>>1, VAR_0->v_edge_pos>>1); ptr= VAR_0->edge_emu_buffer; VAR_12=1; } } VAR_0->dsp.gmc1(VAR_2, ptr, VAR_9, 8, VAR_10&15, VAR_11&15, 128 - VAR_0->no_rounding); ptr = VAR_4[2] + VAR_5; if(VAR_12){ VAR_0->vdsp.emulated_edge_mc(VAR_0->edge_emu_buffer, ptr, VAR_9, 9, 9, VAR_6, VAR_7, VAR_0->h_edge_pos>>1, VAR_0->v_edge_pos>>1); ptr= VAR_0->edge_emu_buffer; } VAR_0->dsp.gmc1(VAR_3, ptr, VAR_9, 8, VAR_10&15, VAR_11&15, 128 - VAR_0->no_rounding); return; }
[ "static void FUNC_0(MpegEncContext *VAR_0,\nuint8_t *VAR_1, uint8_t *VAR_2, uint8_t *VAR_3,\nuint8_t **VAR_4)\n{", "uint8_t *ptr;", "int VAR_5, VAR_6, VAR_7, VAR_8, VAR_9;", "int VAR_10, VAR_11;", "int VAR_12=0;", "VAR_10= VAR_0->sprite_offset[0][0];", "VAR_11= VAR_0->sprite_offset[0][1];", "VAR_6 = VAR_0->mb_x * 16 + (VAR_10 >> (VAR_0->sprite_warping_accuracy+1));", "VAR_7 = VAR_0->mb_y * 16 + (VAR_11 >> (VAR_0->sprite_warping_accuracy+1));", "VAR_10<<=(3-VAR_0->sprite_warping_accuracy);", "VAR_11<<=(3-VAR_0->sprite_warping_accuracy);", "VAR_6 = av_clip(VAR_6, -16, VAR_0->width);", "if (VAR_6 == VAR_0->width)\nVAR_10 =0;", "VAR_7 = av_clip(VAR_7, -16, VAR_0->height);", "if (VAR_7 == VAR_0->height)\nVAR_11 =0;", "VAR_8 = VAR_0->VAR_8;", "VAR_9 = VAR_0->VAR_9;", "ptr = VAR_4[0] + (VAR_7 * VAR_8) + VAR_6;", "if(VAR_0->flags&CODEC_FLAG_EMU_EDGE){", "if( (unsigned)VAR_6 >= FFMAX(VAR_0->h_edge_pos - 17, 0)\n|| (unsigned)VAR_7 >= FFMAX(VAR_0->v_edge_pos - 17, 0)){", "VAR_0->vdsp.emulated_edge_mc(VAR_0->edge_emu_buffer, ptr, VAR_8, 17, 17, VAR_6, VAR_7, VAR_0->h_edge_pos, VAR_0->v_edge_pos);", "ptr= VAR_0->edge_emu_buffer;", "}", "}", "if((VAR_10|VAR_11)&7){", "VAR_0->dsp.gmc1(VAR_1 , ptr , VAR_8, 16, VAR_10&15, VAR_11&15, 128 - VAR_0->no_rounding);", "VAR_0->dsp.gmc1(VAR_1+8, ptr+8, VAR_8, 16, VAR_10&15, VAR_11&15, 128 - VAR_0->no_rounding);", "}else{", "int VAR_13;", "VAR_13= ((VAR_10>>3)&1) | ((VAR_11>>2)&2);", "if (VAR_0->no_rounding){", "VAR_0->hdsp.put_no_rnd_pixels_tab[0][VAR_13](VAR_1, ptr, VAR_8, 16);", "}else{", "VAR_0->hdsp.put_pixels_tab [0][VAR_13](VAR_1, ptr, VAR_8, 16);", "}", "}", "if(CONFIG_GRAY && VAR_0->flags&CODEC_FLAG_GRAY) return;", "VAR_10= VAR_0->sprite_offset[1][0];", "VAR_11= VAR_0->sprite_offset[1][1];", "VAR_6 = VAR_0->mb_x * 8 + (VAR_10 >> (VAR_0->sprite_warping_accuracy+1));", "VAR_7 = VAR_0->mb_y * 8 + (VAR_11 >> (VAR_0->sprite_warping_accuracy+1));", "VAR_10<<=(3-VAR_0->sprite_warping_accuracy);", "VAR_11<<=(3-VAR_0->sprite_warping_accuracy);", "VAR_6 = av_clip(VAR_6, -8, VAR_0->width>>1);", "if (VAR_6 == VAR_0->width>>1)\nVAR_10 =0;", "VAR_7 = av_clip(VAR_7, -8, VAR_0->height>>1);", "if (VAR_7 == VAR_0->height>>1)\nVAR_11 =0;", "VAR_5 = (VAR_7 * VAR_9) + VAR_6;", "ptr = VAR_4[1] + VAR_5;", "if(VAR_0->flags&CODEC_FLAG_EMU_EDGE){", "if( (unsigned)VAR_6 >= FFMAX((VAR_0->h_edge_pos>>1) - 9, 0)\n|| (unsigned)VAR_7 >= FFMAX((VAR_0->v_edge_pos>>1) - 9, 0)){", "VAR_0->vdsp.emulated_edge_mc(VAR_0->edge_emu_buffer, ptr, VAR_9, 9, 9, VAR_6, VAR_7, VAR_0->h_edge_pos>>1, VAR_0->v_edge_pos>>1);", "ptr= VAR_0->edge_emu_buffer;", "VAR_12=1;", "}", "}", "VAR_0->dsp.gmc1(VAR_2, ptr, VAR_9, 8, VAR_10&15, VAR_11&15, 128 - VAR_0->no_rounding);", "ptr = VAR_4[2] + VAR_5;", "if(VAR_12){", "VAR_0->vdsp.emulated_edge_mc(VAR_0->edge_emu_buffer, ptr, VAR_9, 9, 9, VAR_6, VAR_7, VAR_0->h_edge_pos>>1, VAR_0->v_edge_pos>>1);", "ptr= VAR_0->edge_emu_buffer;", "}", "VAR_0->dsp.gmc1(VAR_3, ptr, VAR_9, 8, VAR_10&15, VAR_11&15, 128 - VAR_0->no_rounding);", "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 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 39, 41 ], [ 45 ], [ 47 ], [ 51 ], [ 55 ], [ 57, 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117, 119 ], [ 121 ], [ 123, 125 ], [ 129 ], [ 131 ], [ 133 ], [ 135, 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 167 ], [ 169 ] ]
12,052
static void mpcore_scu_write(void *opaque, target_phys_addr_t offset, uint64_t value, unsigned size) { mpcore_priv_state *s = (mpcore_priv_state *)opaque; /* SCU */ switch (offset) { case 0: /* Control register. */ s->scu_control = value & 1; break; case 0x0c: /* Invalidate all. */ /* This is a no-op as cache is not emulated. */ break; default: hw_error("mpcore_priv_read: Bad offset %x\n", (int)offset); } }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static void mpcore_scu_write(void *opaque, target_phys_addr_t offset, uint64_t value, unsigned size) { mpcore_priv_state *s = (mpcore_priv_state *)opaque; switch (offset) { case 0: s->scu_control = value & 1; break; case 0x0c: break; default: hw_error("mpcore_priv_read: Bad offset %x\n", (int)offset); } }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1, uint64_t VAR_2, unsigned VAR_3) { mpcore_priv_state *s = (mpcore_priv_state *)VAR_0; switch (VAR_1) { case 0: s->scu_control = VAR_2 & 1; break; case 0x0c: break; default: hw_error("mpcore_priv_read: Bad VAR_1 %x\n", (int)VAR_1); } }
[ "static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1,\nuint64_t VAR_2, unsigned VAR_3)\n{", "mpcore_priv_state *s = (mpcore_priv_state *)VAR_0;", "switch (VAR_1) {", "case 0:\ns->scu_control = VAR_2 & 1;", "break;", "case 0x0c:\nbreak;", "default:\nhw_error(\"mpcore_priv_read: Bad VAR_1 %x\\n\", (int)VAR_1);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13, 15 ], [ 17 ], [ 19, 23 ], [ 25, 27 ], [ 29 ], [ 31 ] ]
12,054
static void gen_imull(TCGv a, TCGv b) { TCGv tmp1 = tcg_temp_new(TCG_TYPE_I64); TCGv tmp2 = tcg_temp_new(TCG_TYPE_I64); tcg_gen_ext_i32_i64(tmp1, a); tcg_gen_ext_i32_i64(tmp2, b); tcg_gen_mul_i64(tmp1, tmp1, tmp2); tcg_gen_trunc_i64_i32(a, tmp1); tcg_gen_shri_i64(tmp1, tmp1, 32); tcg_gen_trunc_i64_i32(b, tmp1); }
false
qemu
a7812ae412311d7d47f8aa85656faadac9d64b56
static void gen_imull(TCGv a, TCGv b) { TCGv tmp1 = tcg_temp_new(TCG_TYPE_I64); TCGv tmp2 = tcg_temp_new(TCG_TYPE_I64); tcg_gen_ext_i32_i64(tmp1, a); tcg_gen_ext_i32_i64(tmp2, b); tcg_gen_mul_i64(tmp1, tmp1, tmp2); tcg_gen_trunc_i64_i32(a, tmp1); tcg_gen_shri_i64(tmp1, tmp1, 32); tcg_gen_trunc_i64_i32(b, tmp1); }
{ "code": [], "line_no": [] }
static void FUNC_0(TCGv VAR_0, TCGv VAR_1) { TCGv tmp1 = tcg_temp_new(TCG_TYPE_I64); TCGv tmp2 = tcg_temp_new(TCG_TYPE_I64); tcg_gen_ext_i32_i64(tmp1, VAR_0); tcg_gen_ext_i32_i64(tmp2, VAR_1); tcg_gen_mul_i64(tmp1, tmp1, tmp2); tcg_gen_trunc_i64_i32(VAR_0, tmp1); tcg_gen_shri_i64(tmp1, tmp1, 32); tcg_gen_trunc_i64_i32(VAR_1, tmp1); }
[ "static void FUNC_0(TCGv VAR_0, TCGv VAR_1)\n{", "TCGv tmp1 = tcg_temp_new(TCG_TYPE_I64);", "TCGv tmp2 = tcg_temp_new(TCG_TYPE_I64);", "tcg_gen_ext_i32_i64(tmp1, VAR_0);", "tcg_gen_ext_i32_i64(tmp2, VAR_1);", "tcg_gen_mul_i64(tmp1, tmp1, tmp2);", "tcg_gen_trunc_i64_i32(VAR_0, tmp1);", "tcg_gen_shri_i64(tmp1, tmp1, 32);", "tcg_gen_trunc_i64_i32(VAR_1, tmp1);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ] ]
12,057
void ppc40x_chip_reset (CPUState *env) { target_ulong dbsr; printf("Reset PowerPC chip\n"); cpu_ppc_reset(env); /* XXX: TODO reset all internal peripherals */ dbsr = env->spr[SPR_40x_DBSR]; dbsr &= ~0x00000300; dbsr |= 0x00000200; env->spr[SPR_40x_DBSR] = dbsr; cpu_loop_exit(); }
true
qemu
ef397e88e96d4a798bd190bcd0c43865c3725ae2
void ppc40x_chip_reset (CPUState *env) { target_ulong dbsr; printf("Reset PowerPC chip\n"); cpu_ppc_reset(env); dbsr = env->spr[SPR_40x_DBSR]; dbsr &= ~0x00000300; dbsr |= 0x00000200; env->spr[SPR_40x_DBSR] = dbsr; cpu_loop_exit(); }
{ "code": [ " cpu_loop_exit();", " cpu_loop_exit();" ], "line_no": [ 23, 23 ] }
void FUNC_0 (CPUState *VAR_0) { target_ulong dbsr; printf("Reset PowerPC chip\n"); cpu_ppc_reset(VAR_0); dbsr = VAR_0->spr[SPR_40x_DBSR]; dbsr &= ~0x00000300; dbsr |= 0x00000200; VAR_0->spr[SPR_40x_DBSR] = dbsr; cpu_loop_exit(); }
[ "void FUNC_0 (CPUState *VAR_0)\n{", "target_ulong dbsr;", "printf(\"Reset PowerPC chip\\n\");", "cpu_ppc_reset(VAR_0);", "dbsr = VAR_0->spr[SPR_40x_DBSR];", "dbsr &= ~0x00000300;", "dbsr |= 0x00000200;", "VAR_0->spr[SPR_40x_DBSR] = dbsr;", "cpu_loop_exit();", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ] ]
12,058
static int thread_get_buffer_internal(AVCodecContext *avctx, ThreadFrame *f, int flags) { PerThreadContext *p = avctx->internal->thread_ctx; int err; f->owner = avctx; ff_init_buffer_info(avctx, f->f); if (!(avctx->active_thread_type & FF_THREAD_FRAME)) return ff_get_buffer(avctx, f->f, flags); if (atomic_load(&p->state) != STATE_SETTING_UP && (avctx->codec->update_thread_context || !THREAD_SAFE_CALLBACKS(avctx))) { av_log(avctx, AV_LOG_ERROR, "get_buffer() cannot be called after ff_thread_finish_setup()\n"); return -1; } if (avctx->internal->allocate_progress) { atomic_int *progress; f->progress = av_buffer_alloc(2 * sizeof(*progress)); if (!f->progress) { return AVERROR(ENOMEM); } progress = (atomic_int*)f->progress->data; atomic_init(&progress[0], -1); atomic_init(&progress[1], -1); } pthread_mutex_lock(&p->parent->buffer_mutex); if (avctx->thread_safe_callbacks || avctx->get_buffer2 == avcodec_default_get_buffer2) { err = ff_get_buffer(avctx, f->f, flags); } else { pthread_mutex_lock(&p->progress_mutex); p->requested_frame = f->f; p->requested_flags = flags; atomic_store_explicit(&p->state, STATE_GET_BUFFER, memory_order_release); pthread_cond_broadcast(&p->progress_cond); while (atomic_load(&p->state) != STATE_SETTING_UP) pthread_cond_wait(&p->progress_cond, &p->progress_mutex); err = p->result; pthread_mutex_unlock(&p->progress_mutex); } if (!THREAD_SAFE_CALLBACKS(avctx) && !avctx->codec->update_thread_context) ff_thread_finish_setup(avctx); if (err) av_buffer_unref(&f->progress); pthread_mutex_unlock(&p->parent->buffer_mutex); return err; }
true
FFmpeg
083300bea935d125b83f60d7030f78a7ffb0f3df
static int thread_get_buffer_internal(AVCodecContext *avctx, ThreadFrame *f, int flags) { PerThreadContext *p = avctx->internal->thread_ctx; int err; f->owner = avctx; ff_init_buffer_info(avctx, f->f); if (!(avctx->active_thread_type & FF_THREAD_FRAME)) return ff_get_buffer(avctx, f->f, flags); if (atomic_load(&p->state) != STATE_SETTING_UP && (avctx->codec->update_thread_context || !THREAD_SAFE_CALLBACKS(avctx))) { av_log(avctx, AV_LOG_ERROR, "get_buffer() cannot be called after ff_thread_finish_setup()\n"); return -1; } if (avctx->internal->allocate_progress) { atomic_int *progress; f->progress = av_buffer_alloc(2 * sizeof(*progress)); if (!f->progress) { return AVERROR(ENOMEM); } progress = (atomic_int*)f->progress->data; atomic_init(&progress[0], -1); atomic_init(&progress[1], -1); } pthread_mutex_lock(&p->parent->buffer_mutex); if (avctx->thread_safe_callbacks || avctx->get_buffer2 == avcodec_default_get_buffer2) { err = ff_get_buffer(avctx, f->f, flags); } else { pthread_mutex_lock(&p->progress_mutex); p->requested_frame = f->f; p->requested_flags = flags; atomic_store_explicit(&p->state, STATE_GET_BUFFER, memory_order_release); pthread_cond_broadcast(&p->progress_cond); while (atomic_load(&p->state) != STATE_SETTING_UP) pthread_cond_wait(&p->progress_cond, &p->progress_mutex); err = p->result; pthread_mutex_unlock(&p->progress_mutex); } if (!THREAD_SAFE_CALLBACKS(avctx) && !avctx->codec->update_thread_context) ff_thread_finish_setup(avctx); if (err) av_buffer_unref(&f->progress); pthread_mutex_unlock(&p->parent->buffer_mutex); return err; }
{ "code": [ " f->owner = avctx;", " f->owner = avctx;" ], "line_no": [ 11, 11 ] }
static int FUNC_0(AVCodecContext *VAR_0, ThreadFrame *VAR_1, int VAR_2) { PerThreadContext *p = VAR_0->internal->thread_ctx; int VAR_3; VAR_1->owner = VAR_0; ff_init_buffer_info(VAR_0, VAR_1->VAR_1); if (!(VAR_0->active_thread_type & FF_THREAD_FRAME)) return ff_get_buffer(VAR_0, VAR_1->VAR_1, VAR_2); if (atomic_load(&p->state) != STATE_SETTING_UP && (VAR_0->codec->update_thread_context || !THREAD_SAFE_CALLBACKS(VAR_0))) { av_log(VAR_0, AV_LOG_ERROR, "get_buffer() cannot be called after ff_thread_finish_setup()\n"); return -1; } if (VAR_0->internal->allocate_progress) { atomic_int *progress; VAR_1->progress = av_buffer_alloc(2 * sizeof(*progress)); if (!VAR_1->progress) { return AVERROR(ENOMEM); } progress = (atomic_int*)VAR_1->progress->data; atomic_init(&progress[0], -1); atomic_init(&progress[1], -1); } pthread_mutex_lock(&p->parent->buffer_mutex); if (VAR_0->thread_safe_callbacks || VAR_0->get_buffer2 == avcodec_default_get_buffer2) { VAR_3 = ff_get_buffer(VAR_0, VAR_1->VAR_1, VAR_2); } else { pthread_mutex_lock(&p->progress_mutex); p->requested_frame = VAR_1->VAR_1; p->requested_flags = VAR_2; atomic_store_explicit(&p->state, STATE_GET_BUFFER, memory_order_release); pthread_cond_broadcast(&p->progress_cond); while (atomic_load(&p->state) != STATE_SETTING_UP) pthread_cond_wait(&p->progress_cond, &p->progress_mutex); VAR_3 = p->result; pthread_mutex_unlock(&p->progress_mutex); } if (!THREAD_SAFE_CALLBACKS(VAR_0) && !VAR_0->codec->update_thread_context) ff_thread_finish_setup(VAR_0); if (VAR_3) av_buffer_unref(&VAR_1->progress); pthread_mutex_unlock(&p->parent->buffer_mutex); return VAR_3; }
[ "static int FUNC_0(AVCodecContext *VAR_0, ThreadFrame *VAR_1, int VAR_2)\n{", "PerThreadContext *p = VAR_0->internal->thread_ctx;", "int VAR_3;", "VAR_1->owner = VAR_0;", "ff_init_buffer_info(VAR_0, VAR_1->VAR_1);", "if (!(VAR_0->active_thread_type & FF_THREAD_FRAME))\nreturn ff_get_buffer(VAR_0, VAR_1->VAR_1, VAR_2);", "if (atomic_load(&p->state) != STATE_SETTING_UP &&\n(VAR_0->codec->update_thread_context || !THREAD_SAFE_CALLBACKS(VAR_0))) {", "av_log(VAR_0, AV_LOG_ERROR, \"get_buffer() cannot be called after ff_thread_finish_setup()\\n\");", "return -1;", "}", "if (VAR_0->internal->allocate_progress) {", "atomic_int *progress;", "VAR_1->progress = av_buffer_alloc(2 * sizeof(*progress));", "if (!VAR_1->progress) {", "return AVERROR(ENOMEM);", "}", "progress = (atomic_int*)VAR_1->progress->data;", "atomic_init(&progress[0], -1);", "atomic_init(&progress[1], -1);", "}", "pthread_mutex_lock(&p->parent->buffer_mutex);", "if (VAR_0->thread_safe_callbacks ||\nVAR_0->get_buffer2 == avcodec_default_get_buffer2) {", "VAR_3 = ff_get_buffer(VAR_0, VAR_1->VAR_1, VAR_2);", "} else {", "pthread_mutex_lock(&p->progress_mutex);", "p->requested_frame = VAR_1->VAR_1;", "p->requested_flags = VAR_2;", "atomic_store_explicit(&p->state, STATE_GET_BUFFER, memory_order_release);", "pthread_cond_broadcast(&p->progress_cond);", "while (atomic_load(&p->state) != STATE_SETTING_UP)\npthread_cond_wait(&p->progress_cond, &p->progress_mutex);", "VAR_3 = p->result;", "pthread_mutex_unlock(&p->progress_mutex);", "}", "if (!THREAD_SAFE_CALLBACKS(VAR_0) && !VAR_0->codec->update_thread_context)\nff_thread_finish_setup(VAR_0);", "if (VAR_3)\nav_buffer_unref(&VAR_1->progress);", "pthread_mutex_unlock(&p->parent->buffer_mutex);", "return VAR_3;", "}" ]
[ 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 15 ], [ 19, 21 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63, 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 83, 85 ], [ 89 ], [ 93 ], [ 97 ], [ 99, 101 ], [ 103, 105 ], [ 109 ], [ 113 ], [ 115 ] ]
12,059
static void gen_spr_power5p_lpar(CPUPPCState *env) { #if !defined(CONFIG_USER_ONLY) /* Logical partitionning */ spr_register_kvm(env, SPR_LPCR, "LPCR", &spr_read_generic, &spr_write_lpcr, KVM_REG_PPC_LPCR, LPCR_LPES0 | LPCR_LPES1); #endif }
true
qemu
4b236b621bf090509c4a0be372edfd31d13b289a
static void gen_spr_power5p_lpar(CPUPPCState *env) { #if !defined(CONFIG_USER_ONLY) spr_register_kvm(env, SPR_LPCR, "LPCR", &spr_read_generic, &spr_write_lpcr, KVM_REG_PPC_LPCR, LPCR_LPES0 | LPCR_LPES1); #endif }
{ "code": [], "line_no": [] }
static void FUNC_0(CPUPPCState *VAR_0) { #if !defined(CONFIG_USER_ONLY) spr_register_kvm(VAR_0, SPR_LPCR, "LPCR", &spr_read_generic, &spr_write_lpcr, KVM_REG_PPC_LPCR, LPCR_LPES0 | LPCR_LPES1); #endif }
[ "static void FUNC_0(CPUPPCState *VAR_0)\n{", "#if !defined(CONFIG_USER_ONLY)\nspr_register_kvm(VAR_0, SPR_LPCR, \"LPCR\",\n&spr_read_generic, &spr_write_lpcr,\nKVM_REG_PPC_LPCR, LPCR_LPES0 | LPCR_LPES1);", "#endif\n}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 9, 12, 14 ], [ 20, 22 ] ]
12,060
int inet_connect_opts(QemuOpts *opts, bool block, bool *in_progress, Error **errp) { struct addrinfo *res, *e; int sock = -1; res = inet_parse_connect_opts(opts, errp); if (!res) { return -1; } if (in_progress) { *in_progress = false; } for (e = res; e != NULL; e = e->ai_next) { sock = inet_connect_addr(e, block, in_progress); if (sock >= 0) { break; } } if (sock < 0) { error_set(errp, QERR_SOCKET_CONNECT_FAILED); } freeaddrinfo(res); return sock; }
true
qemu
233aa5c2d1cf4655ffe335025a68cf5454f87dad
int inet_connect_opts(QemuOpts *opts, bool block, bool *in_progress, Error **errp) { struct addrinfo *res, *e; int sock = -1; res = inet_parse_connect_opts(opts, errp); if (!res) { return -1; } if (in_progress) { *in_progress = false; } for (e = res; e != NULL; e = e->ai_next) { sock = inet_connect_addr(e, block, in_progress); if (sock >= 0) { break; } } if (sock < 0) { error_set(errp, QERR_SOCKET_CONNECT_FAILED); } freeaddrinfo(res); return sock; }
{ "code": [ " if (in_progress) {", " if (in_progress) {", " *in_progress = false;", "int inet_connect_opts(QemuOpts *opts, bool block, bool *in_progress,", " Error **errp)", " if (in_progress) {", " *in_progress = false;", " sock = inet_connect_addr(e, block, in_progress);", " if (sock >= 0) {", "int inet_connect_opts(QemuOpts *opts, bool block, bool *in_progress," ], "line_no": [ 23, 23, 25, 1, 3, 23, 25, 33, 35, 1 ] }
int FUNC_0(QemuOpts *VAR_0, bool VAR_1, bool *VAR_2, Error **VAR_3) { struct addrinfo *VAR_4, *VAR_5; int VAR_6 = -1; VAR_4 = inet_parse_connect_opts(VAR_0, VAR_3); if (!VAR_4) { return -1; } if (VAR_2) { *VAR_2 = false; } for (VAR_5 = VAR_4; VAR_5 != NULL; VAR_5 = VAR_5->ai_next) { VAR_6 = inet_connect_addr(VAR_5, VAR_1, VAR_2); if (VAR_6 >= 0) { break; } } if (VAR_6 < 0) { error_set(VAR_3, QERR_SOCKET_CONNECT_FAILED); } freeaddrinfo(VAR_4); return VAR_6; }
[ "int FUNC_0(QemuOpts *VAR_0, bool VAR_1, bool *VAR_2,\nError **VAR_3)\n{", "struct addrinfo *VAR_4, *VAR_5;", "int VAR_6 = -1;", "VAR_4 = inet_parse_connect_opts(VAR_0, VAR_3);", "if (!VAR_4) {", "return -1;", "}", "if (VAR_2) {", "*VAR_2 = false;", "}", "for (VAR_5 = VAR_4; VAR_5 != NULL; VAR_5 = VAR_5->ai_next) {", "VAR_6 = inet_connect_addr(VAR_5, VAR_1, VAR_2);", "if (VAR_6 >= 0) {", "break;", "}", "}", "if (VAR_6 < 0) {", "error_set(VAR_3, QERR_SOCKET_CONNECT_FAILED);", "}", "freeaddrinfo(VAR_4);", "return VAR_6;", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ] ]
12,061
static void via_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); k->init = vt82c686b_initfn; k->config_write = vt82c686b_write_config; k->vendor_id = PCI_VENDOR_ID_VIA; k->device_id = PCI_DEVICE_ID_VIA_ISA_BRIDGE; k->class_id = PCI_CLASS_BRIDGE_ISA; k->revision = 0x40; dc->desc = "ISA bridge"; dc->no_user = 1; dc->vmsd = &vmstate_via; }
true
qemu
efec3dd631d94160288392721a5f9c39e50fb2bc
static void via_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); k->init = vt82c686b_initfn; k->config_write = vt82c686b_write_config; k->vendor_id = PCI_VENDOR_ID_VIA; k->device_id = PCI_DEVICE_ID_VIA_ISA_BRIDGE; k->class_id = PCI_CLASS_BRIDGE_ISA; k->revision = 0x40; dc->desc = "ISA bridge"; dc->no_user = 1; dc->vmsd = &vmstate_via; }
{ "code": [ " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;" ], "line_no": [ 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25 ] }
static void FUNC_0(ObjectClass *VAR_0, void *VAR_1) { DeviceClass *dc = DEVICE_CLASS(VAR_0); PCIDeviceClass *k = PCI_DEVICE_CLASS(VAR_0); k->init = vt82c686b_initfn; k->config_write = vt82c686b_write_config; k->vendor_id = PCI_VENDOR_ID_VIA; k->device_id = PCI_DEVICE_ID_VIA_ISA_BRIDGE; k->class_id = PCI_CLASS_BRIDGE_ISA; k->revision = 0x40; dc->desc = "ISA bridge"; dc->no_user = 1; dc->vmsd = &vmstate_via; }
[ "static void FUNC_0(ObjectClass *VAR_0, void *VAR_1)\n{", "DeviceClass *dc = DEVICE_CLASS(VAR_0);", "PCIDeviceClass *k = PCI_DEVICE_CLASS(VAR_0);", "k->init = vt82c686b_initfn;", "k->config_write = vt82c686b_write_config;", "k->vendor_id = PCI_VENDOR_ID_VIA;", "k->device_id = PCI_DEVICE_ID_VIA_ISA_BRIDGE;", "k->class_id = PCI_CLASS_BRIDGE_ISA;", "k->revision = 0x40;", "dc->desc = \"ISA bridge\";", "dc->no_user = 1;", "dc->vmsd = &vmstate_via;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ] ]
12,062
static int vhost_user_reset_device(struct vhost_dev *dev) { VhostUserMsg msg = { .request = VHOST_USER_RESET_OWNER, .flags = VHOST_USER_VERSION, }; vhost_user_write(dev, &msg, NULL, 0); return 0; }
true
qemu
c4843a45e3d4f3698b214275ab5e78cdb6a3d212
static int vhost_user_reset_device(struct vhost_dev *dev) { VhostUserMsg msg = { .request = VHOST_USER_RESET_OWNER, .flags = VHOST_USER_VERSION, }; vhost_user_write(dev, &msg, NULL, 0); return 0; }
{ "code": [ " vhost_user_write(dev, &msg, NULL, 0);", " vhost_user_write(dev, &msg, NULL, 0);", " vhost_user_write(dev, &msg, NULL, 0);", " vhost_user_write(dev, &msg, NULL, 0);", " vhost_user_write(dev, &msg, NULL, 0);", " vhost_user_write(dev, &msg, NULL, 0);", " vhost_user_write(dev, &msg, NULL, 0);" ], "line_no": [ 15, 15, 15, 15, 15, 15, 15 ] }
static int FUNC_0(struct vhost_dev *VAR_0) { VhostUserMsg msg = { .request = VHOST_USER_RESET_OWNER, .flags = VHOST_USER_VERSION, }; vhost_user_write(VAR_0, &msg, NULL, 0); return 0; }
[ "static int FUNC_0(struct vhost_dev *VAR_0)\n{", "VhostUserMsg msg = {", ".request = VHOST_USER_RESET_OWNER,\n.flags = VHOST_USER_VERSION,\n};", "vhost_user_write(VAR_0, &msg, NULL, 0);", "return 0;", "}" ]
[ 0, 0, 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9, 11 ], [ 15 ], [ 19 ], [ 21 ] ]
12,063
static int vp5_parse_header(VP56Context *s, const uint8_t *buf, int buf_size, int *golden_frame) { VP56RangeCoder *c = &s->c; int rows, cols; ff_vp56_init_range_decoder(&s->c, buf, buf_size); s->framep[VP56_FRAME_CURRENT]->key_frame = !vp56_rac_get(c); vp56_rac_get(c); ff_vp56_init_dequant(s, vp56_rac_gets(c, 6)); if (s->framep[VP56_FRAME_CURRENT]->key_frame) { vp56_rac_gets(c, 8); if(vp56_rac_gets(c, 5) > 5) vp56_rac_gets(c, 2); if (vp56_rac_get(c)) { av_log(s->avctx, AV_LOG_ERROR, "interlacing not supported\n"); rows = vp56_rac_gets(c, 8); /* number of stored macroblock rows */ cols = vp56_rac_gets(c, 8); /* number of stored macroblock cols */ vp56_rac_gets(c, 8); /* number of displayed macroblock rows */ vp56_rac_gets(c, 8); /* number of displayed macroblock cols */ vp56_rac_gets(c, 2); if (!s->macroblocks || /* first frame */ 16*cols != s->avctx->coded_width || 16*rows != s->avctx->coded_height) { avcodec_set_dimensions(s->avctx, 16*cols, 16*rows); return 2; } else if (!s->macroblocks) return 1;
true
FFmpeg
8bc396fc0e8769a056375c1c211f389ce0e3ecc5
static int vp5_parse_header(VP56Context *s, const uint8_t *buf, int buf_size, int *golden_frame) { VP56RangeCoder *c = &s->c; int rows, cols; ff_vp56_init_range_decoder(&s->c, buf, buf_size); s->framep[VP56_FRAME_CURRENT]->key_frame = !vp56_rac_get(c); vp56_rac_get(c); ff_vp56_init_dequant(s, vp56_rac_gets(c, 6)); if (s->framep[VP56_FRAME_CURRENT]->key_frame) { vp56_rac_gets(c, 8); if(vp56_rac_gets(c, 5) > 5) vp56_rac_gets(c, 2); if (vp56_rac_get(c)) { av_log(s->avctx, AV_LOG_ERROR, "interlacing not supported\n"); rows = vp56_rac_gets(c, 8); cols = vp56_rac_gets(c, 8); vp56_rac_gets(c, 8); vp56_rac_gets(c, 8); vp56_rac_gets(c, 2); if (!s->macroblocks || 16*cols != s->avctx->coded_width || 16*rows != s->avctx->coded_height) { avcodec_set_dimensions(s->avctx, 16*cols, 16*rows); return 2; } else if (!s->macroblocks) return 1;
{ "code": [], "line_no": [] }
static int FUNC_0(VP56Context *VAR_0, const uint8_t *VAR_1, int VAR_2, int *VAR_3) { VP56RangeCoder *c = &VAR_0->c; int VAR_4, VAR_5; ff_vp56_init_range_decoder(&VAR_0->c, VAR_1, VAR_2); VAR_0->framep[VP56_FRAME_CURRENT]->key_frame = !vp56_rac_get(c); vp56_rac_get(c); ff_vp56_init_dequant(VAR_0, vp56_rac_gets(c, 6)); if (VAR_0->framep[VP56_FRAME_CURRENT]->key_frame) { vp56_rac_gets(c, 8); if(vp56_rac_gets(c, 5) > 5) vp56_rac_gets(c, 2); if (vp56_rac_get(c)) { av_log(VAR_0->avctx, AV_LOG_ERROR, "interlacing not supported\n"); VAR_4 = vp56_rac_gets(c, 8); VAR_5 = vp56_rac_gets(c, 8); vp56_rac_gets(c, 8); vp56_rac_gets(c, 8); vp56_rac_gets(c, 2); if (!VAR_0->macroblocks || 16*VAR_5 != VAR_0->avctx->coded_width || 16*VAR_4 != VAR_0->avctx->coded_height) { avcodec_set_dimensions(VAR_0->avctx, 16*VAR_5, 16*VAR_4); return 2; } else if (!VAR_0->macroblocks) return 1;
[ "static int FUNC_0(VP56Context *VAR_0, const uint8_t *VAR_1, int VAR_2,\nint *VAR_3)\n{", "VP56RangeCoder *c = &VAR_0->c;", "int VAR_4, VAR_5;", "ff_vp56_init_range_decoder(&VAR_0->c, VAR_1, VAR_2);", "VAR_0->framep[VP56_FRAME_CURRENT]->key_frame = !vp56_rac_get(c);", "vp56_rac_get(c);", "ff_vp56_init_dequant(VAR_0, vp56_rac_gets(c, 6));", "if (VAR_0->framep[VP56_FRAME_CURRENT]->key_frame)\n{", "vp56_rac_gets(c, 8);", "if(vp56_rac_gets(c, 5) > 5)\nvp56_rac_gets(c, 2);", "if (vp56_rac_get(c)) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"interlacing not supported\\n\");", "VAR_4 = vp56_rac_gets(c, 8);", "VAR_5 = vp56_rac_gets(c, 8);", "vp56_rac_gets(c, 8);", "vp56_rac_gets(c, 8);", "vp56_rac_gets(c, 2);", "if (!VAR_0->macroblocks ||\n16*VAR_5 != VAR_0->avctx->coded_width ||\n16*VAR_4 != VAR_0->avctx->coded_height) {", "avcodec_set_dimensions(VAR_0->avctx, 16*VAR_5, 16*VAR_4);", "return 2;", "} else if (!VAR_0->macroblocks)", "return 1;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21, 23 ], [ 25 ], [ 27, 30 ], [ 32 ], [ 34 ], [ 38 ], [ 40 ], [ 47 ], [ 49 ], [ 51 ], [ 53, 55, 57 ], [ 59 ], [ 61 ], [ 64 ], [ 67 ] ]
12,064
static void spapr_finalize_fdt(sPAPRMachineState *spapr, hwaddr fdt_addr, hwaddr rtas_addr, hwaddr rtas_size) { MachineState *machine = MACHINE(qdev_get_machine()); sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(machine); const char *boot_device = machine->boot_order; int ret, i; size_t cb = 0; char *bootlist; void *fdt; sPAPRPHBState *phb; fdt = g_malloc(FDT_MAX_SIZE); /* open out the base tree into a temp buffer for the final tweaks */ _FDT((fdt_open_into(spapr->fdt_skel, fdt, FDT_MAX_SIZE))); ret = spapr_populate_memory(spapr, fdt); if (ret < 0) { fprintf(stderr, "couldn't setup memory nodes in fdt\n"); exit(1); } ret = spapr_populate_vdevice(spapr->vio_bus, fdt); if (ret < 0) { fprintf(stderr, "couldn't setup vio devices in fdt\n"); exit(1); } if (object_resolve_path_type("", TYPE_SPAPR_RNG, NULL)) { ret = spapr_rng_populate_dt(fdt); if (ret < 0) { fprintf(stderr, "could not set up rng device in the fdt\n"); exit(1); } } QLIST_FOREACH(phb, &spapr->phbs, list) { ret = spapr_populate_pci_dt(phb, PHANDLE_XICP, fdt); if (ret < 0) { error_report("couldn't setup PCI devices in fdt"); exit(1); } } /* RTAS */ ret = spapr_rtas_device_tree_setup(fdt, rtas_addr, rtas_size); if (ret < 0) { fprintf(stderr, "Couldn't set up RTAS device tree properties\n"); } /* cpus */ spapr_populate_cpus_dt_node(fdt, spapr); bootlist = get_boot_devices_list(&cb, true); if (cb && bootlist) { int offset = fdt_path_offset(fdt, "/chosen"); if (offset < 0) { exit(1); } for (i = 0; i < cb; i++) { if (bootlist[i] == '\n') { bootlist[i] = ' '; } } ret = fdt_setprop_string(fdt, offset, "qemu,boot-list", bootlist); } if (boot_device && strlen(boot_device)) { int offset = fdt_path_offset(fdt, "/chosen"); if (offset < 0) { exit(1); } fdt_setprop_string(fdt, offset, "qemu,boot-device", boot_device); } if (!spapr->has_graphics) { spapr_populate_chosen_stdout(fdt, spapr->vio_bus); } if (smc->dr_lmb_enabled) { _FDT(spapr_drc_populate_dt(fdt, 0, NULL, SPAPR_DR_CONNECTOR_TYPE_LMB)); } if (smc->dr_cpu_enabled) { int offset = fdt_path_offset(fdt, "/cpus"); ret = spapr_drc_populate_dt(fdt, offset, NULL, SPAPR_DR_CONNECTOR_TYPE_CPU); if (ret < 0) { error_report("Couldn't set up CPU DR device tree properties"); exit(1); } } _FDT((fdt_pack(fdt))); if (fdt_totalsize(fdt) > FDT_MAX_SIZE) { error_report("FDT too big ! 0x%x bytes (max is 0x%x)", fdt_totalsize(fdt), FDT_MAX_SIZE); exit(1); } qemu_fdt_dumpdtb(fdt, fdt_totalsize(fdt)); cpu_physical_memory_write(fdt_addr, fdt, fdt_totalsize(fdt)); g_free(bootlist); g_free(fdt); }
true
qemu
3c0c47e3464f3c54bd3f1cc6d4da2cbf7465e295
static void spapr_finalize_fdt(sPAPRMachineState *spapr, hwaddr fdt_addr, hwaddr rtas_addr, hwaddr rtas_size) { MachineState *machine = MACHINE(qdev_get_machine()); sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(machine); const char *boot_device = machine->boot_order; int ret, i; size_t cb = 0; char *bootlist; void *fdt; sPAPRPHBState *phb; fdt = g_malloc(FDT_MAX_SIZE); _FDT((fdt_open_into(spapr->fdt_skel, fdt, FDT_MAX_SIZE))); ret = spapr_populate_memory(spapr, fdt); if (ret < 0) { fprintf(stderr, "couldn't setup memory nodes in fdt\n"); exit(1); } ret = spapr_populate_vdevice(spapr->vio_bus, fdt); if (ret < 0) { fprintf(stderr, "couldn't setup vio devices in fdt\n"); exit(1); } if (object_resolve_path_type("", TYPE_SPAPR_RNG, NULL)) { ret = spapr_rng_populate_dt(fdt); if (ret < 0) { fprintf(stderr, "could not set up rng device in the fdt\n"); exit(1); } } QLIST_FOREACH(phb, &spapr->phbs, list) { ret = spapr_populate_pci_dt(phb, PHANDLE_XICP, fdt); if (ret < 0) { error_report("couldn't setup PCI devices in fdt"); exit(1); } } ret = spapr_rtas_device_tree_setup(fdt, rtas_addr, rtas_size); if (ret < 0) { fprintf(stderr, "Couldn't set up RTAS device tree properties\n"); } spapr_populate_cpus_dt_node(fdt, spapr); bootlist = get_boot_devices_list(&cb, true); if (cb && bootlist) { int offset = fdt_path_offset(fdt, "/chosen"); if (offset < 0) { exit(1); } for (i = 0; i < cb; i++) { if (bootlist[i] == '\n') { bootlist[i] = ' '; } } ret = fdt_setprop_string(fdt, offset, "qemu,boot-list", bootlist); } if (boot_device && strlen(boot_device)) { int offset = fdt_path_offset(fdt, "/chosen"); if (offset < 0) { exit(1); } fdt_setprop_string(fdt, offset, "qemu,boot-device", boot_device); } if (!spapr->has_graphics) { spapr_populate_chosen_stdout(fdt, spapr->vio_bus); } if (smc->dr_lmb_enabled) { _FDT(spapr_drc_populate_dt(fdt, 0, NULL, SPAPR_DR_CONNECTOR_TYPE_LMB)); } if (smc->dr_cpu_enabled) { int offset = fdt_path_offset(fdt, "/cpus"); ret = spapr_drc_populate_dt(fdt, offset, NULL, SPAPR_DR_CONNECTOR_TYPE_CPU); if (ret < 0) { error_report("Couldn't set up CPU DR device tree properties"); exit(1); } } _FDT((fdt_pack(fdt))); if (fdt_totalsize(fdt) > FDT_MAX_SIZE) { error_report("FDT too big ! 0x%x bytes (max is 0x%x)", fdt_totalsize(fdt), FDT_MAX_SIZE); exit(1); } qemu_fdt_dumpdtb(fdt, fdt_totalsize(fdt)); cpu_physical_memory_write(fdt_addr, fdt, fdt_totalsize(fdt)); g_free(bootlist); g_free(fdt); }
{ "code": [ " if (smc->dr_cpu_enabled) {", " if (smc->dr_cpu_enabled) {", " if (smc->dr_cpu_enabled) {", " sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(machine);", " if (smc->dr_cpu_enabled) {" ], "line_no": [ 177, 177, 177, 13, 177 ] }
static void FUNC_0(sPAPRMachineState *VAR_0, hwaddr VAR_1, hwaddr VAR_2, hwaddr VAR_3) { MachineState *machine = MACHINE(qdev_get_machine()); sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(machine); const char *VAR_4 = machine->boot_order; int VAR_5, VAR_6; size_t cb = 0; char *VAR_7; void *VAR_8; sPAPRPHBState *phb; VAR_8 = g_malloc(FDT_MAX_SIZE); _FDT((fdt_open_into(VAR_0->fdt_skel, VAR_8, FDT_MAX_SIZE))); VAR_5 = spapr_populate_memory(VAR_0, VAR_8); if (VAR_5 < 0) { fprintf(stderr, "couldn't setup memory nodes in VAR_8\n"); exit(1); } VAR_5 = spapr_populate_vdevice(VAR_0->vio_bus, VAR_8); if (VAR_5 < 0) { fprintf(stderr, "couldn't setup vio devices in VAR_8\n"); exit(1); } if (object_resolve_path_type("", TYPE_SPAPR_RNG, NULL)) { VAR_5 = spapr_rng_populate_dt(VAR_8); if (VAR_5 < 0) { fprintf(stderr, "could not set up rng device in the VAR_8\n"); exit(1); } } QLIST_FOREACH(phb, &VAR_0->phbs, list) { VAR_5 = spapr_populate_pci_dt(phb, PHANDLE_XICP, VAR_8); if (VAR_5 < 0) { error_report("couldn't setup PCI devices in VAR_8"); exit(1); } } VAR_5 = spapr_rtas_device_tree_setup(VAR_8, VAR_2, VAR_3); if (VAR_5 < 0) { fprintf(stderr, "Couldn't set up RTAS device tree properties\n"); } spapr_populate_cpus_dt_node(VAR_8, VAR_0); VAR_7 = get_boot_devices_list(&cb, true); if (cb && VAR_7) { int VAR_10 = fdt_path_offset(VAR_8, "/chosen"); if (VAR_10 < 0) { exit(1); } for (VAR_6 = 0; VAR_6 < cb; VAR_6++) { if (VAR_7[VAR_6] == '\n') { VAR_7[VAR_6] = ' '; } } VAR_5 = fdt_setprop_string(VAR_8, VAR_10, "qemu,boot-list", VAR_7); } if (VAR_4 && strlen(VAR_4)) { int VAR_10 = fdt_path_offset(VAR_8, "/chosen"); if (VAR_10 < 0) { exit(1); } fdt_setprop_string(VAR_8, VAR_10, "qemu,boot-device", VAR_4); } if (!VAR_0->has_graphics) { spapr_populate_chosen_stdout(VAR_8, VAR_0->vio_bus); } if (smc->dr_lmb_enabled) { _FDT(spapr_drc_populate_dt(VAR_8, 0, NULL, SPAPR_DR_CONNECTOR_TYPE_LMB)); } if (smc->dr_cpu_enabled) { int VAR_10 = fdt_path_offset(VAR_8, "/cpus"); VAR_5 = spapr_drc_populate_dt(VAR_8, VAR_10, NULL, SPAPR_DR_CONNECTOR_TYPE_CPU); if (VAR_5 < 0) { error_report("Couldn't set up CPU DR device tree properties"); exit(1); } } _FDT((fdt_pack(VAR_8))); if (fdt_totalsize(VAR_8) > FDT_MAX_SIZE) { error_report("FDT too big ! 0x%x bytes (max is 0x%x)", fdt_totalsize(VAR_8), FDT_MAX_SIZE); exit(1); } qemu_fdt_dumpdtb(VAR_8, fdt_totalsize(VAR_8)); cpu_physical_memory_write(VAR_1, VAR_8, fdt_totalsize(VAR_8)); g_free(VAR_7); g_free(VAR_8); }
[ "static void FUNC_0(sPAPRMachineState *VAR_0,\nhwaddr VAR_1,\nhwaddr VAR_2,\nhwaddr VAR_3)\n{", "MachineState *machine = MACHINE(qdev_get_machine());", "sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(machine);", "const char *VAR_4 = machine->boot_order;", "int VAR_5, VAR_6;", "size_t cb = 0;", "char *VAR_7;", "void *VAR_8;", "sPAPRPHBState *phb;", "VAR_8 = g_malloc(FDT_MAX_SIZE);", "_FDT((fdt_open_into(VAR_0->fdt_skel, VAR_8, FDT_MAX_SIZE)));", "VAR_5 = spapr_populate_memory(VAR_0, VAR_8);", "if (VAR_5 < 0) {", "fprintf(stderr, \"couldn't setup memory nodes in VAR_8\\n\");", "exit(1);", "}", "VAR_5 = spapr_populate_vdevice(VAR_0->vio_bus, VAR_8);", "if (VAR_5 < 0) {", "fprintf(stderr, \"couldn't setup vio devices in VAR_8\\n\");", "exit(1);", "}", "if (object_resolve_path_type(\"\", TYPE_SPAPR_RNG, NULL)) {", "VAR_5 = spapr_rng_populate_dt(VAR_8);", "if (VAR_5 < 0) {", "fprintf(stderr, \"could not set up rng device in the VAR_8\\n\");", "exit(1);", "}", "}", "QLIST_FOREACH(phb, &VAR_0->phbs, list) {", "VAR_5 = spapr_populate_pci_dt(phb, PHANDLE_XICP, VAR_8);", "if (VAR_5 < 0) {", "error_report(\"couldn't setup PCI devices in VAR_8\");", "exit(1);", "}", "}", "VAR_5 = spapr_rtas_device_tree_setup(VAR_8, VAR_2, VAR_3);", "if (VAR_5 < 0) {", "fprintf(stderr, \"Couldn't set up RTAS device tree properties\\n\");", "}", "spapr_populate_cpus_dt_node(VAR_8, VAR_0);", "VAR_7 = get_boot_devices_list(&cb, true);", "if (cb && VAR_7) {", "int VAR_10 = fdt_path_offset(VAR_8, \"/chosen\");", "if (VAR_10 < 0) {", "exit(1);", "}", "for (VAR_6 = 0; VAR_6 < cb; VAR_6++) {", "if (VAR_7[VAR_6] == '\\n') {", "VAR_7[VAR_6] = ' ';", "}", "}", "VAR_5 = fdt_setprop_string(VAR_8, VAR_10, \"qemu,boot-list\", VAR_7);", "}", "if (VAR_4 && strlen(VAR_4)) {", "int VAR_10 = fdt_path_offset(VAR_8, \"/chosen\");", "if (VAR_10 < 0) {", "exit(1);", "}", "fdt_setprop_string(VAR_8, VAR_10, \"qemu,boot-device\", VAR_4);", "}", "if (!VAR_0->has_graphics) {", "spapr_populate_chosen_stdout(VAR_8, VAR_0->vio_bus);", "}", "if (smc->dr_lmb_enabled) {", "_FDT(spapr_drc_populate_dt(VAR_8, 0, NULL, SPAPR_DR_CONNECTOR_TYPE_LMB));", "}", "if (smc->dr_cpu_enabled) {", "int VAR_10 = fdt_path_offset(VAR_8, \"/cpus\");", "VAR_5 = spapr_drc_populate_dt(VAR_8, VAR_10, NULL,\nSPAPR_DR_CONNECTOR_TYPE_CPU);", "if (VAR_5 < 0) {", "error_report(\"Couldn't set up CPU DR device tree properties\");", "exit(1);", "}", "}", "_FDT((fdt_pack(VAR_8)));", "if (fdt_totalsize(VAR_8) > FDT_MAX_SIZE) {", "error_report(\"FDT too big ! 0x%x bytes (max is 0x%x)\",\nfdt_totalsize(VAR_8), FDT_MAX_SIZE);", "exit(1);", "}", "qemu_fdt_dumpdtb(VAR_8, fdt_totalsize(VAR_8));", "cpu_physical_memory_write(VAR_1, VAR_8, fdt_totalsize(VAR_8));", "g_free(VAR_7);", "g_free(VAR_8);", "}" ]
[ 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, 1, 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 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 109 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 135 ], [ 137 ], [ 139 ], [ 143 ], [ 145 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 161 ], [ 163 ], [ 165 ], [ 169 ], [ 171 ], [ 173 ], [ 177 ], [ 179 ], [ 181, 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 197 ], [ 201 ], [ 203, 205 ], [ 207 ], [ 209 ], [ 213 ], [ 215 ], [ 219 ], [ 221 ], [ 223 ] ]
12,065
static av_cold int avs_decode_init(AVCodecContext * avctx) { avctx->pix_fmt = PIX_FMT_PAL8; return 0; }
true
FFmpeg
85f477935cd6b34e6ec2716b20e15ce748277a89
static av_cold int avs_decode_init(AVCodecContext * avctx) { avctx->pix_fmt = PIX_FMT_PAL8; return 0; }
{ "code": [], "line_no": [] }
static av_cold int FUNC_0(AVCodecContext * avctx) { avctx->pix_fmt = PIX_FMT_PAL8; return 0; }
[ "static av_cold int FUNC_0(AVCodecContext * avctx)\n{", "avctx->pix_fmt = PIX_FMT_PAL8;", "return 0;", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 8 ], [ 10 ] ]
12,066
CharDriverState *qemu_chr_alloc(ChardevCommon *backend, Error **errp) { CharDriverState *chr = g_malloc0(sizeof(CharDriverState)); qemu_mutex_init(&chr->chr_write_lock); chr->mux_idx = -1; if (backend->has_logfile) { int flags = O_WRONLY | O_CREAT; if (backend->has_logappend && backend->logappend) { flags |= O_APPEND; } else { flags |= O_TRUNC; } chr->logfd = qemu_open(backend->logfile, flags, 0666); if (chr->logfd < 0) { error_setg_errno(errp, errno, "Unable to open logfile %s", backend->logfile); g_free(chr); return NULL; } } else { chr->logfd = -1; } return chr; }
true
qemu
692d88b4085559f1254d0e04d64a849ce8ab5932
CharDriverState *qemu_chr_alloc(ChardevCommon *backend, Error **errp) { CharDriverState *chr = g_malloc0(sizeof(CharDriverState)); qemu_mutex_init(&chr->chr_write_lock); chr->mux_idx = -1; if (backend->has_logfile) { int flags = O_WRONLY | O_CREAT; if (backend->has_logappend && backend->logappend) { flags |= O_APPEND; } else { flags |= O_TRUNC; } chr->logfd = qemu_open(backend->logfile, flags, 0666); if (chr->logfd < 0) { error_setg_errno(errp, errno, "Unable to open logfile %s", backend->logfile); g_free(chr); return NULL; } } else { chr->logfd = -1; } return chr; }
{ "code": [ " chr->mux_idx = -1;" ], "line_no": [ 11 ] }
CharDriverState *FUNC_0(ChardevCommon *backend, Error **errp) { CharDriverState *chr = g_malloc0(sizeof(CharDriverState)); qemu_mutex_init(&chr->chr_write_lock); chr->mux_idx = -1; if (backend->has_logfile) { int VAR_0 = O_WRONLY | O_CREAT; if (backend->has_logappend && backend->logappend) { VAR_0 |= O_APPEND; } else { VAR_0 |= O_TRUNC; } chr->logfd = qemu_open(backend->logfile, VAR_0, 0666); if (chr->logfd < 0) { error_setg_errno(errp, errno, "Unable to open logfile %s", backend->logfile); g_free(chr); return NULL; } } else { chr->logfd = -1; } return chr; }
[ "CharDriverState *FUNC_0(ChardevCommon *backend, Error **errp)\n{", "CharDriverState *chr = g_malloc0(sizeof(CharDriverState));", "qemu_mutex_init(&chr->chr_write_lock);", "chr->mux_idx = -1;", "if (backend->has_logfile) {", "int VAR_0 = O_WRONLY | O_CREAT;", "if (backend->has_logappend &&\nbackend->logappend) {", "VAR_0 |= O_APPEND;", "} else {", "VAR_0 |= O_TRUNC;", "}", "chr->logfd = qemu_open(backend->logfile, VAR_0, 0666);", "if (chr->logfd < 0) {", "error_setg_errno(errp, errno,\n\"Unable to open logfile %s\",\nbackend->logfile);", "g_free(chr);", "return NULL;", "}", "} else {", "chr->logfd = -1;", "}", "return chr;", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17, 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33, 35, 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ] ]
12,067
static int read_block(ALSDecContext *ctx, ALSBlockData *bd) { GetBitContext *gb = &ctx->gb; *bd->shift_lsbs = 0; // read block type flag and read the samples accordingly if (get_bits1(gb)) { if (read_var_block_data(ctx, bd)) return -1; } else { read_const_block_data(ctx, bd); } return 0; }
true
FFmpeg
ca488ad480360dfafcb5766f7bfbb567a0638979
static int read_block(ALSDecContext *ctx, ALSBlockData *bd) { GetBitContext *gb = &ctx->gb; *bd->shift_lsbs = 0; if (get_bits1(gb)) { if (read_var_block_data(ctx, bd)) return -1; } else { read_const_block_data(ctx, bd); } return 0; }
{ "code": [ " return -1;", " return -1;", " if (read_var_block_data(ctx, bd))", " return -1;", " return 0;", " return -1;", " return -1;", " return -1;" ], "line_no": [ 17, 17, 15, 17, 27, 17, 17, 17 ] }
static int FUNC_0(ALSDecContext *VAR_0, ALSBlockData *VAR_1) { GetBitContext *gb = &VAR_0->gb; *VAR_1->shift_lsbs = 0; if (get_bits1(gb)) { if (read_var_block_data(VAR_0, VAR_1)) return -1; } else { read_const_block_data(VAR_0, VAR_1); } return 0; }
[ "static int FUNC_0(ALSDecContext *VAR_0, ALSBlockData *VAR_1)\n{", "GetBitContext *gb = &VAR_0->gb;", "*VAR_1->shift_lsbs = 0;", "if (get_bits1(gb)) {", "if (read_var_block_data(VAR_0, VAR_1))\nreturn -1;", "} else {", "read_const_block_data(VAR_0, VAR_1);", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 1, 0, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 13 ], [ 15, 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ] ]
12,069
static bool get_phys_addr(CPUARMState *env, target_ulong address, int access_type, ARMMMUIdx mmu_idx, hwaddr *phys_ptr, MemTxAttrs *attrs, int *prot, target_ulong *page_size, uint32_t *fsr, ARMMMUFaultInfo *fi) { if (mmu_idx == ARMMMUIdx_S12NSE0 || mmu_idx == ARMMMUIdx_S12NSE1) { /* Call ourselves recursively to do the stage 1 and then stage 2 * translations. */ if (arm_feature(env, ARM_FEATURE_EL2)) { hwaddr ipa; int s2_prot; int ret; ret = get_phys_addr(env, address, access_type, stage_1_mmu_idx(mmu_idx), &ipa, attrs, prot, page_size, fsr, fi); /* If S1 fails or S2 is disabled, return early. */ if (ret || regime_translation_disabled(env, ARMMMUIdx_S2NS)) { *phys_ptr = ipa; return ret; } /* S1 is done. Now do S2 translation. */ ret = get_phys_addr_lpae(env, ipa, access_type, ARMMMUIdx_S2NS, phys_ptr, attrs, &s2_prot, page_size, fsr, fi); fi->s2addr = ipa; /* Combine the S1 and S2 perms. */ *prot &= s2_prot; return ret; } else { /* * For non-EL2 CPUs a stage1+stage2 translation is just stage 1. */ mmu_idx = stage_1_mmu_idx(mmu_idx); } } /* The page table entries may downgrade secure to non-secure, but * cannot upgrade an non-secure translation regime's attributes * to secure. */ attrs->secure = regime_is_secure(env, mmu_idx); attrs->user = regime_is_user(env, mmu_idx); /* Fast Context Switch Extension. This doesn't exist at all in v8. * In v7 and earlier it affects all stage 1 translations. */ if (address < 0x02000000 && mmu_idx != ARMMMUIdx_S2NS && !arm_feature(env, ARM_FEATURE_V8)) { if (regime_el(env, mmu_idx) == 3) { address += env->cp15.fcseidr_s; } else { address += env->cp15.fcseidr_ns; } } /* pmsav7 has special handling for when MPU is disabled so call it before * the common MMU/MPU disabled check below. */ if (arm_feature(env, ARM_FEATURE_PMSA) && arm_feature(env, ARM_FEATURE_V7)) { bool ret; *page_size = TARGET_PAGE_SIZE; ret = get_phys_addr_pmsav7(env, address, access_type, mmu_idx, phys_ptr, prot, fsr); qemu_log_mask(CPU_LOG_MMU, "PMSAv7 MPU lookup for %s at 0x%08" PRIx32 " mmu_idx %u -> %s (prot %c%c%c)\n", access_type == 1 ? "reading" : (access_type == 2 ? "writing" : "execute"), (uint32_t)address, mmu_idx, ret ? "Miss" : "Hit", *prot & PAGE_READ ? 'r' : '-', *prot & PAGE_WRITE ? 'w' : '-', *prot & PAGE_EXEC ? 'x' : '-'); return ret; } if (regime_translation_disabled(env, mmu_idx)) { /* MMU/MPU disabled. */ *phys_ptr = address; *prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC; *page_size = TARGET_PAGE_SIZE; return 0; } if (arm_feature(env, ARM_FEATURE_PMSA)) { /* Pre-v7 MPU */ *page_size = TARGET_PAGE_SIZE; return get_phys_addr_pmsav5(env, address, access_type, mmu_idx, phys_ptr, prot, fsr); } if (regime_using_lpae_format(env, mmu_idx)) { return get_phys_addr_lpae(env, address, access_type, mmu_idx, phys_ptr, attrs, prot, page_size, fsr, fi); } else if (regime_sctlr(env, mmu_idx) & SCTLR_XP) { return get_phys_addr_v6(env, address, access_type, mmu_idx, phys_ptr, attrs, prot, page_size, fsr, fi); } else { return get_phys_addr_v5(env, address, access_type, mmu_idx, phys_ptr, prot, page_size, fsr, fi); } }
true
qemu
709e4407add7acacc593cb6cdac026558c9a8fb6
static bool get_phys_addr(CPUARMState *env, target_ulong address, int access_type, ARMMMUIdx mmu_idx, hwaddr *phys_ptr, MemTxAttrs *attrs, int *prot, target_ulong *page_size, uint32_t *fsr, ARMMMUFaultInfo *fi) { if (mmu_idx == ARMMMUIdx_S12NSE0 || mmu_idx == ARMMMUIdx_S12NSE1) { if (arm_feature(env, ARM_FEATURE_EL2)) { hwaddr ipa; int s2_prot; int ret; ret = get_phys_addr(env, address, access_type, stage_1_mmu_idx(mmu_idx), &ipa, attrs, prot, page_size, fsr, fi); if (ret || regime_translation_disabled(env, ARMMMUIdx_S2NS)) { *phys_ptr = ipa; return ret; } ret = get_phys_addr_lpae(env, ipa, access_type, ARMMMUIdx_S2NS, phys_ptr, attrs, &s2_prot, page_size, fsr, fi); fi->s2addr = ipa; *prot &= s2_prot; return ret; } else { mmu_idx = stage_1_mmu_idx(mmu_idx); } } attrs->secure = regime_is_secure(env, mmu_idx); attrs->user = regime_is_user(env, mmu_idx); if (address < 0x02000000 && mmu_idx != ARMMMUIdx_S2NS && !arm_feature(env, ARM_FEATURE_V8)) { if (regime_el(env, mmu_idx) == 3) { address += env->cp15.fcseidr_s; } else { address += env->cp15.fcseidr_ns; } } if (arm_feature(env, ARM_FEATURE_PMSA) && arm_feature(env, ARM_FEATURE_V7)) { bool ret; *page_size = TARGET_PAGE_SIZE; ret = get_phys_addr_pmsav7(env, address, access_type, mmu_idx, phys_ptr, prot, fsr); qemu_log_mask(CPU_LOG_MMU, "PMSAv7 MPU lookup for %s at 0x%08" PRIx32 " mmu_idx %u -> %s (prot %c%c%c)\n", access_type == 1 ? "reading" : (access_type == 2 ? "writing" : "execute"), (uint32_t)address, mmu_idx, ret ? "Miss" : "Hit", *prot & PAGE_READ ? 'r' : '-', *prot & PAGE_WRITE ? 'w' : '-', *prot & PAGE_EXEC ? 'x' : '-'); return ret; } if (regime_translation_disabled(env, mmu_idx)) { *phys_ptr = address; *prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC; *page_size = TARGET_PAGE_SIZE; return 0; } if (arm_feature(env, ARM_FEATURE_PMSA)) { *page_size = TARGET_PAGE_SIZE; return get_phys_addr_pmsav5(env, address, access_type, mmu_idx, phys_ptr, prot, fsr); } if (regime_using_lpae_format(env, mmu_idx)) { return get_phys_addr_lpae(env, address, access_type, mmu_idx, phys_ptr, attrs, prot, page_size, fsr, fi); } else if (regime_sctlr(env, mmu_idx) & SCTLR_XP) { return get_phys_addr_v6(env, address, access_type, mmu_idx, phys_ptr, attrs, prot, page_size, fsr, fi); } else { return get_phys_addr_v5(env, address, access_type, mmu_idx, phys_ptr, prot, page_size, fsr, fi); } }
{ "code": [ " access_type == 1 ? \"reading\" :", " (access_type == 2 ? \"writing\" : \"execute\")," ], "line_no": [ 143, 145 ] }
static bool FUNC_0(CPUARMState *env, target_ulong address, int access_type, ARMMMUIdx mmu_idx, hwaddr *phys_ptr, MemTxAttrs *attrs, int *prot, target_ulong *page_size, uint32_t *fsr, ARMMMUFaultInfo *fi) { if (mmu_idx == ARMMMUIdx_S12NSE0 || mmu_idx == ARMMMUIdx_S12NSE1) { if (arm_feature(env, ARM_FEATURE_EL2)) { hwaddr ipa; int VAR_0; int VAR_1; VAR_1 = FUNC_0(env, address, access_type, stage_1_mmu_idx(mmu_idx), &ipa, attrs, prot, page_size, fsr, fi); if (VAR_1 || regime_translation_disabled(env, ARMMMUIdx_S2NS)) { *phys_ptr = ipa; return VAR_1; } VAR_1 = get_phys_addr_lpae(env, ipa, access_type, ARMMMUIdx_S2NS, phys_ptr, attrs, &VAR_0, page_size, fsr, fi); fi->s2addr = ipa; *prot &= VAR_0; return VAR_1; } else { mmu_idx = stage_1_mmu_idx(mmu_idx); } } attrs->secure = regime_is_secure(env, mmu_idx); attrs->user = regime_is_user(env, mmu_idx); if (address < 0x02000000 && mmu_idx != ARMMMUIdx_S2NS && !arm_feature(env, ARM_FEATURE_V8)) { if (regime_el(env, mmu_idx) == 3) { address += env->cp15.fcseidr_s; } else { address += env->cp15.fcseidr_ns; } } if (arm_feature(env, ARM_FEATURE_PMSA) && arm_feature(env, ARM_FEATURE_V7)) { bool VAR_1; *page_size = TARGET_PAGE_SIZE; VAR_1 = get_phys_addr_pmsav7(env, address, access_type, mmu_idx, phys_ptr, prot, fsr); qemu_log_mask(CPU_LOG_MMU, "PMSAv7 MPU lookup for %s at 0x%08" PRIx32 " mmu_idx %u -> %s (prot %c%c%c)\n", access_type == 1 ? "reading" : (access_type == 2 ? "writing" : "execute"), (uint32_t)address, mmu_idx, VAR_1 ? "Miss" : "Hit", *prot & PAGE_READ ? 'r' : '-', *prot & PAGE_WRITE ? 'w' : '-', *prot & PAGE_EXEC ? 'x' : '-'); return VAR_1; } if (regime_translation_disabled(env, mmu_idx)) { *phys_ptr = address; *prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC; *page_size = TARGET_PAGE_SIZE; return 0; } if (arm_feature(env, ARM_FEATURE_PMSA)) { *page_size = TARGET_PAGE_SIZE; return get_phys_addr_pmsav5(env, address, access_type, mmu_idx, phys_ptr, prot, fsr); } if (regime_using_lpae_format(env, mmu_idx)) { return get_phys_addr_lpae(env, address, access_type, mmu_idx, phys_ptr, attrs, prot, page_size, fsr, fi); } else if (regime_sctlr(env, mmu_idx) & SCTLR_XP) { return get_phys_addr_v6(env, address, access_type, mmu_idx, phys_ptr, attrs, prot, page_size, fsr, fi); } else { return get_phys_addr_v5(env, address, access_type, mmu_idx, phys_ptr, prot, page_size, fsr, fi); } }
[ "static bool FUNC_0(CPUARMState *env, target_ulong address,\nint access_type, ARMMMUIdx mmu_idx,\nhwaddr *phys_ptr, MemTxAttrs *attrs, int *prot,\ntarget_ulong *page_size, uint32_t *fsr,\nARMMMUFaultInfo *fi)\n{", "if (mmu_idx == ARMMMUIdx_S12NSE0 || mmu_idx == ARMMMUIdx_S12NSE1) {", "if (arm_feature(env, ARM_FEATURE_EL2)) {", "hwaddr ipa;", "int VAR_0;", "int VAR_1;", "VAR_1 = FUNC_0(env, address, access_type,\nstage_1_mmu_idx(mmu_idx), &ipa, attrs,\nprot, page_size, fsr, fi);", "if (VAR_1 || regime_translation_disabled(env, ARMMMUIdx_S2NS)) {", "*phys_ptr = ipa;", "return VAR_1;", "}", "VAR_1 = get_phys_addr_lpae(env, ipa, access_type, ARMMMUIdx_S2NS,\nphys_ptr, attrs, &VAR_0,\npage_size, fsr, fi);", "fi->s2addr = ipa;", "*prot &= VAR_0;", "return VAR_1;", "} else {", "mmu_idx = stage_1_mmu_idx(mmu_idx);", "}", "}", "attrs->secure = regime_is_secure(env, mmu_idx);", "attrs->user = regime_is_user(env, mmu_idx);", "if (address < 0x02000000 && mmu_idx != ARMMMUIdx_S2NS\n&& !arm_feature(env, ARM_FEATURE_V8)) {", "if (regime_el(env, mmu_idx) == 3) {", "address += env->cp15.fcseidr_s;", "} else {", "address += env->cp15.fcseidr_ns;", "}", "}", "if (arm_feature(env, ARM_FEATURE_PMSA) &&\narm_feature(env, ARM_FEATURE_V7)) {", "bool VAR_1;", "*page_size = TARGET_PAGE_SIZE;", "VAR_1 = get_phys_addr_pmsav7(env, address, access_type, mmu_idx,\nphys_ptr, prot, fsr);", "qemu_log_mask(CPU_LOG_MMU, \"PMSAv7 MPU lookup for %s at 0x%08\" PRIx32\n\" mmu_idx %u -> %s (prot %c%c%c)\\n\",\naccess_type == 1 ? \"reading\" :\n(access_type == 2 ? \"writing\" : \"execute\"),\n(uint32_t)address, mmu_idx,\nVAR_1 ? \"Miss\" : \"Hit\",\n*prot & PAGE_READ ? 'r' : '-',\n*prot & PAGE_WRITE ? 'w' : '-',\n*prot & PAGE_EXEC ? 'x' : '-');", "return VAR_1;", "}", "if (regime_translation_disabled(env, mmu_idx)) {", "*phys_ptr = address;", "*prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC;", "*page_size = TARGET_PAGE_SIZE;", "return 0;", "}", "if (arm_feature(env, ARM_FEATURE_PMSA)) {", "*page_size = TARGET_PAGE_SIZE;", "return get_phys_addr_pmsav5(env, address, access_type, mmu_idx,\nphys_ptr, prot, fsr);", "}", "if (regime_using_lpae_format(env, mmu_idx)) {", "return get_phys_addr_lpae(env, address, access_type, mmu_idx, phys_ptr,\nattrs, prot, page_size, fsr, fi);", "} else if (regime_sctlr(env, mmu_idx) & SCTLR_XP) {", "return get_phys_addr_v6(env, address, access_type, mmu_idx, phys_ptr,\nattrs, prot, page_size, fsr, fi);", "} else {", "return get_phys_addr_v5(env, address, access_type, mmu_idx, phys_ptr,\nprot, page_size, fsr, fi);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 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 ]
[ [ 1, 3, 5, 7, 9, 11 ], [ 13 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31, 33, 35 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 53, 55, 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 75 ], [ 77 ], [ 79 ], [ 91 ], [ 93 ], [ 103, 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 127, 129 ], [ 131 ], [ 133 ], [ 135, 137 ], [ 139, 141, 143, 145, 147, 149, 151, 153, 155 ], [ 159 ], [ 161 ], [ 165 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 181 ], [ 185 ], [ 187, 189 ], [ 191 ], [ 195 ], [ 197, 199 ], [ 201 ], [ 203, 205 ], [ 207 ], [ 209, 211 ], [ 213 ], [ 215 ] ]
12,070
bool qpci_msix_masked(QPCIDevice *dev, uint16_t entry) { uint8_t addr; uint16_t val; void *vector_addr = dev->msix_table + (entry * PCI_MSIX_ENTRY_SIZE); g_assert(dev->msix_enabled); addr = qpci_find_capability(dev, PCI_CAP_ID_MSIX); g_assert_cmphex(addr, !=, 0); val = qpci_config_readw(dev, addr + PCI_MSIX_FLAGS); if (val & PCI_MSIX_FLAGS_MASKALL) { return true; } else { return (qpci_io_readl(dev, vector_addr + PCI_MSIX_ENTRY_VECTOR_CTRL) & PCI_MSIX_ENTRY_CTRL_MASKBIT) != 0; } }
true
qemu
b4ba67d9a702507793c2724e56f98e9b0f7be02b
bool qpci_msix_masked(QPCIDevice *dev, uint16_t entry) { uint8_t addr; uint16_t val; void *vector_addr = dev->msix_table + (entry * PCI_MSIX_ENTRY_SIZE); g_assert(dev->msix_enabled); addr = qpci_find_capability(dev, PCI_CAP_ID_MSIX); g_assert_cmphex(addr, !=, 0); val = qpci_config_readw(dev, addr + PCI_MSIX_FLAGS); if (val & PCI_MSIX_FLAGS_MASKALL) { return true; } else { return (qpci_io_readl(dev, vector_addr + PCI_MSIX_ENTRY_VECTOR_CTRL) & PCI_MSIX_ENTRY_CTRL_MASKBIT) != 0; } }
{ "code": [ " void *vector_addr = dev->msix_table + (entry * PCI_MSIX_ENTRY_SIZE);", " return (qpci_io_readl(dev, vector_addr + PCI_MSIX_ENTRY_VECTOR_CTRL)", " & PCI_MSIX_ENTRY_CTRL_MASKBIT) != 0;" ], "line_no": [ 9, 29, 31 ] }
bool FUNC_0(QPCIDevice *dev, uint16_t entry) { uint8_t addr; uint16_t val; void *VAR_0 = dev->msix_table + (entry * PCI_MSIX_ENTRY_SIZE); g_assert(dev->msix_enabled); addr = qpci_find_capability(dev, PCI_CAP_ID_MSIX); g_assert_cmphex(addr, !=, 0); val = qpci_config_readw(dev, addr + PCI_MSIX_FLAGS); if (val & PCI_MSIX_FLAGS_MASKALL) { return true; } else { return (qpci_io_readl(dev, VAR_0 + PCI_MSIX_ENTRY_VECTOR_CTRL) & PCI_MSIX_ENTRY_CTRL_MASKBIT) != 0; } }
[ "bool FUNC_0(QPCIDevice *dev, uint16_t entry)\n{", "uint8_t addr;", "uint16_t val;", "void *VAR_0 = dev->msix_table + (entry * PCI_MSIX_ENTRY_SIZE);", "g_assert(dev->msix_enabled);", "addr = qpci_find_capability(dev, PCI_CAP_ID_MSIX);", "g_assert_cmphex(addr, !=, 0);", "val = qpci_config_readw(dev, addr + PCI_MSIX_FLAGS);", "if (val & PCI_MSIX_FLAGS_MASKALL) {", "return true;", "} else {", "return (qpci_io_readl(dev, VAR_0 + PCI_MSIX_ENTRY_VECTOR_CTRL)\n& PCI_MSIX_ENTRY_CTRL_MASKBIT) != 0;", "}", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29, 31 ], [ 33 ], [ 35 ] ]
12,071
static MegasasCmd *megasas_enqueue_frame(MegasasState *s, hwaddr frame, uint64_t context, int count) { PCIDevice *pcid = PCI_DEVICE(s); MegasasCmd *cmd = NULL; int frame_size = MFI_FRAME_SIZE * 16; hwaddr frame_size_p = frame_size; cmd = megasas_next_frame(s, frame); /* All frames busy */ if (!cmd) { return NULL; } if (!cmd->pa) { cmd->pa = frame; /* Map all possible frames */ cmd->frame = pci_dma_map(pcid, frame, &frame_size_p, 0); if (frame_size_p != frame_size) { trace_megasas_qf_map_failed(cmd->index, (unsigned long)frame); if (cmd->frame) { pci_dma_unmap(pcid, cmd->frame, frame_size_p, 0, 0); cmd->frame = NULL; cmd->pa = 0; } s->event_count++; return NULL; } cmd->pa_size = frame_size_p; cmd->context = context; if (!megasas_use_queue64(s)) { cmd->context &= (uint64_t)0xFFFFFFFF; } } cmd->count = count; s->busy++; if (s->consumer_pa) { s->reply_queue_tail = ldl_le_phys(&address_space_memory, s->consumer_pa); } trace_megasas_qf_enqueue(cmd->index, cmd->count, cmd->context, s->reply_queue_head, s->reply_queue_tail, s->busy); return cmd; }
true
qemu
6df5718bd3ec56225c44cf96440c723c1b611b87
static MegasasCmd *megasas_enqueue_frame(MegasasState *s, hwaddr frame, uint64_t context, int count) { PCIDevice *pcid = PCI_DEVICE(s); MegasasCmd *cmd = NULL; int frame_size = MFI_FRAME_SIZE * 16; hwaddr frame_size_p = frame_size; cmd = megasas_next_frame(s, frame); if (!cmd) { return NULL; } if (!cmd->pa) { cmd->pa = frame; cmd->frame = pci_dma_map(pcid, frame, &frame_size_p, 0); if (frame_size_p != frame_size) { trace_megasas_qf_map_failed(cmd->index, (unsigned long)frame); if (cmd->frame) { pci_dma_unmap(pcid, cmd->frame, frame_size_p, 0, 0); cmd->frame = NULL; cmd->pa = 0; } s->event_count++; return NULL; } cmd->pa_size = frame_size_p; cmd->context = context; if (!megasas_use_queue64(s)) { cmd->context &= (uint64_t)0xFFFFFFFF; } } cmd->count = count; s->busy++; if (s->consumer_pa) { s->reply_queue_tail = ldl_le_phys(&address_space_memory, s->consumer_pa); } trace_megasas_qf_enqueue(cmd->index, cmd->count, cmd->context, s->reply_queue_head, s->reply_queue_tail, s->busy); return cmd; }
{ "code": [ " MegasasCmd *cmd = NULL;", " if (!cmd) {", " return cmd;", " cmd = megasas_next_frame(s, frame);", " if (!cmd) {", " if (!cmd->pa) {", " cmd->pa = frame;", " cmd->frame = pci_dma_map(pcid, frame, &frame_size_p, 0);", " if (frame_size_p != frame_size) {", " trace_megasas_qf_map_failed(cmd->index, (unsigned long)frame);", " if (cmd->frame) {", " pci_dma_unmap(pcid, cmd->frame, frame_size_p, 0, 0);", " cmd->frame = NULL;", " cmd->pa = 0;", " s->event_count++;", " return NULL;", " cmd->pa_size = frame_size_p;", " cmd->context = context;", " if (!megasas_use_queue64(s)) {", " cmd->context &= (uint64_t)0xFFFFFFFF;", " PCIDevice *pcid = PCI_DEVICE(s);" ], "line_no": [ 9, 21, 87, 17, 21, 27, 29, 33, 35, 37, 39, 41, 43, 45, 49, 51, 55, 57, 59, 61, 7 ] }
static MegasasCmd *FUNC_0(MegasasState *s, hwaddr frame, uint64_t context, int count) { PCIDevice *pcid = PCI_DEVICE(s); MegasasCmd *cmd = NULL; int VAR_0 = MFI_FRAME_SIZE * 16; hwaddr frame_size_p = VAR_0; cmd = megasas_next_frame(s, frame); if (!cmd) { return NULL; } if (!cmd->pa) { cmd->pa = frame; cmd->frame = pci_dma_map(pcid, frame, &frame_size_p, 0); if (frame_size_p != VAR_0) { trace_megasas_qf_map_failed(cmd->index, (unsigned long)frame); if (cmd->frame) { pci_dma_unmap(pcid, cmd->frame, frame_size_p, 0, 0); cmd->frame = NULL; cmd->pa = 0; } s->event_count++; return NULL; } cmd->pa_size = frame_size_p; cmd->context = context; if (!megasas_use_queue64(s)) { cmd->context &= (uint64_t)0xFFFFFFFF; } } cmd->count = count; s->busy++; if (s->consumer_pa) { s->reply_queue_tail = ldl_le_phys(&address_space_memory, s->consumer_pa); } trace_megasas_qf_enqueue(cmd->index, cmd->count, cmd->context, s->reply_queue_head, s->reply_queue_tail, s->busy); return cmd; }
[ "static MegasasCmd *FUNC_0(MegasasState *s,\nhwaddr frame, uint64_t context, int count)\n{", "PCIDevice *pcid = PCI_DEVICE(s);", "MegasasCmd *cmd = NULL;", "int VAR_0 = MFI_FRAME_SIZE * 16;", "hwaddr frame_size_p = VAR_0;", "cmd = megasas_next_frame(s, frame);", "if (!cmd) {", "return NULL;", "}", "if (!cmd->pa) {", "cmd->pa = frame;", "cmd->frame = pci_dma_map(pcid, frame, &frame_size_p, 0);", "if (frame_size_p != VAR_0) {", "trace_megasas_qf_map_failed(cmd->index, (unsigned long)frame);", "if (cmd->frame) {", "pci_dma_unmap(pcid, cmd->frame, frame_size_p, 0, 0);", "cmd->frame = NULL;", "cmd->pa = 0;", "}", "s->event_count++;", "return NULL;", "}", "cmd->pa_size = frame_size_p;", "cmd->context = context;", "if (!megasas_use_queue64(s)) {", "cmd->context &= (uint64_t)0xFFFFFFFF;", "}", "}", "cmd->count = count;", "s->busy++;", "if (s->consumer_pa) {", "s->reply_queue_tail = ldl_le_phys(&address_space_memory,\ns->consumer_pa);", "}", "trace_megasas_qf_enqueue(cmd->index, cmd->count, cmd->context,\ns->reply_queue_head, s->reply_queue_tail, s->busy);", "return cmd;", "}" ]
[ 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 73 ], [ 75, 77 ], [ 79 ], [ 81, 83 ], [ 87 ], [ 89 ] ]
12,072
static int img_commit(int argc, char **argv) { int c, ret, flags; const char *filename, *fmt, *cache, *base; BlockBackend *blk; BlockDriverState *bs, *base_bs; BlockJob *job; bool progress = false, quiet = false, drop = false; bool writethrough; Error *local_err = NULL; CommonBlockJobCBInfo cbi; bool image_opts = false; AioContext *aio_context; fmt = NULL; cache = BDRV_DEFAULT_CACHE; base = NULL; for(;;) { static const struct option long_options[] = { {"help", no_argument, 0, 'h'}, {"object", required_argument, 0, OPTION_OBJECT}, {"image-opts", no_argument, 0, OPTION_IMAGE_OPTS}, {0, 0, 0, 0} }; c = getopt_long(argc, argv, "f:ht:b:dpq", long_options, NULL); if (c == -1) { break; } switch(c) { case '?': case 'h': help(); break; case 'f': fmt = optarg; break; case 't': cache = optarg; break; case 'b': base = optarg; /* -b implies -d */ drop = true; break; case 'd': drop = true; break; case 'p': progress = true; break; case 'q': quiet = true; break; case OPTION_OBJECT: { QemuOpts *opts; opts = qemu_opts_parse_noisily(&qemu_object_opts, optarg, true); if (!opts) { return 1; } } break; case OPTION_IMAGE_OPTS: image_opts = true; break; } } /* Progress is not shown in Quiet mode */ if (quiet) { progress = false; } if (optind != argc - 1) { error_exit("Expecting one image file name"); } filename = argv[optind++]; if (qemu_opts_foreach(&qemu_object_opts, user_creatable_add_opts_foreach, NULL, NULL)) { return 1; } flags = BDRV_O_RDWR | BDRV_O_UNMAP; ret = bdrv_parse_cache_mode(cache, &flags, &writethrough); if (ret < 0) { error_report("Invalid cache option: %s", cache); return 1; } blk = img_open(image_opts, filename, fmt, flags, writethrough, quiet); if (!blk) { return 1; } bs = blk_bs(blk); qemu_progress_init(progress, 1.f); qemu_progress_print(0.f, 100); if (base) { base_bs = bdrv_find_backing_image(bs, base); if (!base_bs) { error_setg(&local_err, "Did not find '%s' in the backing chain of '%s'", base, filename); goto done; } } else { /* This is different from QMP, which by default uses the deepest file in * the backing chain (i.e., the very base); however, the traditional * behavior of qemu-img commit is using the immediate backing file. */ base_bs = backing_bs(bs); if (!base_bs) { error_setg(&local_err, "Image does not have a backing file"); goto done; } } cbi = (CommonBlockJobCBInfo){ .errp = &local_err, .bs = bs, }; aio_context = bdrv_get_aio_context(bs); aio_context_acquire(aio_context); commit_active_start("commit", bs, base_bs, BLOCK_JOB_DEFAULT, 0, BLOCKDEV_ON_ERROR_REPORT, NULL, common_block_job_cb, &cbi, &local_err, false); aio_context_release(aio_context); if (local_err) { goto done; } /* When the block job completes, the BlockBackend reference will point to * the old backing file. In order to avoid that the top image is already * deleted, so we can still empty it afterwards, increment the reference * counter here preemptively. */ if (!drop) { bdrv_ref(bs); } job = block_job_get("commit"); run_block_job(job, &local_err); if (local_err) { goto unref_backing; } if (!drop && bs->drv->bdrv_make_empty) { ret = bs->drv->bdrv_make_empty(bs); if (ret) { error_setg_errno(&local_err, -ret, "Could not empty %s", filename); goto unref_backing; } } unref_backing: if (!drop) { bdrv_unref(bs); } done: qemu_progress_end(); blk_unref(blk); if (local_err) { error_report_err(local_err); return 1; } qprintf(quiet, "Image committed.\n"); return 0; }
true
qemu
c919297379e9980c2bcc4d2053addbc1fd6d762b
static int img_commit(int argc, char **argv) { int c, ret, flags; const char *filename, *fmt, *cache, *base; BlockBackend *blk; BlockDriverState *bs, *base_bs; BlockJob *job; bool progress = false, quiet = false, drop = false; bool writethrough; Error *local_err = NULL; CommonBlockJobCBInfo cbi; bool image_opts = false; AioContext *aio_context; fmt = NULL; cache = BDRV_DEFAULT_CACHE; base = NULL; for(;;) { static const struct option long_options[] = { {"help", no_argument, 0, 'h'}, {"object", required_argument, 0, OPTION_OBJECT}, {"image-opts", no_argument, 0, OPTION_IMAGE_OPTS}, {0, 0, 0, 0} }; c = getopt_long(argc, argv, "f:ht:b:dpq", long_options, NULL); if (c == -1) { break; } switch(c) { case '?': case 'h': help(); break; case 'f': fmt = optarg; break; case 't': cache = optarg; break; case 'b': base = optarg; drop = true; break; case 'd': drop = true; break; case 'p': progress = true; break; case 'q': quiet = true; break; case OPTION_OBJECT: { QemuOpts *opts; opts = qemu_opts_parse_noisily(&qemu_object_opts, optarg, true); if (!opts) { return 1; } } break; case OPTION_IMAGE_OPTS: image_opts = true; break; } } if (quiet) { progress = false; } if (optind != argc - 1) { error_exit("Expecting one image file name"); } filename = argv[optind++]; if (qemu_opts_foreach(&qemu_object_opts, user_creatable_add_opts_foreach, NULL, NULL)) { return 1; } flags = BDRV_O_RDWR | BDRV_O_UNMAP; ret = bdrv_parse_cache_mode(cache, &flags, &writethrough); if (ret < 0) { error_report("Invalid cache option: %s", cache); return 1; } blk = img_open(image_opts, filename, fmt, flags, writethrough, quiet); if (!blk) { return 1; } bs = blk_bs(blk); qemu_progress_init(progress, 1.f); qemu_progress_print(0.f, 100); if (base) { base_bs = bdrv_find_backing_image(bs, base); if (!base_bs) { error_setg(&local_err, "Did not find '%s' in the backing chain of '%s'", base, filename); goto done; } } else { base_bs = backing_bs(bs); if (!base_bs) { error_setg(&local_err, "Image does not have a backing file"); goto done; } } cbi = (CommonBlockJobCBInfo){ .errp = &local_err, .bs = bs, }; aio_context = bdrv_get_aio_context(bs); aio_context_acquire(aio_context); commit_active_start("commit", bs, base_bs, BLOCK_JOB_DEFAULT, 0, BLOCKDEV_ON_ERROR_REPORT, NULL, common_block_job_cb, &cbi, &local_err, false); aio_context_release(aio_context); if (local_err) { goto done; } if (!drop) { bdrv_ref(bs); } job = block_job_get("commit"); run_block_job(job, &local_err); if (local_err) { goto unref_backing; } if (!drop && bs->drv->bdrv_make_empty) { ret = bs->drv->bdrv_make_empty(bs); if (ret) { error_setg_errno(&local_err, -ret, "Could not empty %s", filename); goto unref_backing; } } unref_backing: if (!drop) { bdrv_unref(bs); } done: qemu_progress_end(); blk_unref(blk); if (local_err) { error_report_err(local_err); return 1; } qprintf(quiet, "Image committed.\n"); return 0; }
{ "code": [ " c = getopt_long(argc, argv, \"f:ht:b:dpq\",", " case 'h':", " case 'h':", " case 'h':" ], "line_no": [ 49, 63, 63, 63 ] }
static int FUNC_0(int VAR_0, char **VAR_1) { int VAR_2, VAR_3, VAR_4; const char *VAR_5, *VAR_6, *VAR_7, *VAR_8; BlockBackend *blk; BlockDriverState *bs, *base_bs; BlockJob *job; bool progress = false, quiet = false, drop = false; bool writethrough; Error *local_err = NULL; CommonBlockJobCBInfo cbi; bool image_opts = false; AioContext *aio_context; VAR_6 = NULL; VAR_7 = BDRV_DEFAULT_CACHE; VAR_8 = NULL; for(;;) { static const struct option VAR_9[] = { {"help", no_argument, 0, 'h'}, {"object", required_argument, 0, OPTION_OBJECT}, {"image-opts", no_argument, 0, OPTION_IMAGE_OPTS}, {0, 0, 0, 0} }; VAR_2 = getopt_long(VAR_0, VAR_1, "f:ht:b:dpq", VAR_9, NULL); if (VAR_2 == -1) { break; } switch(VAR_2) { case '?': case 'h': help(); break; case 'f': VAR_6 = optarg; break; case 't': VAR_7 = optarg; break; case 'b': VAR_8 = optarg; drop = true; break; case 'd': drop = true; break; case 'p': progress = true; break; case 'q': quiet = true; break; case OPTION_OBJECT: { QemuOpts *opts; opts = qemu_opts_parse_noisily(&qemu_object_opts, optarg, true); if (!opts) { return 1; } } break; case OPTION_IMAGE_OPTS: image_opts = true; break; } } if (quiet) { progress = false; } if (optind != VAR_0 - 1) { error_exit("Expecting one image file name"); } VAR_5 = VAR_1[optind++]; if (qemu_opts_foreach(&qemu_object_opts, user_creatable_add_opts_foreach, NULL, NULL)) { return 1; } VAR_4 = BDRV_O_RDWR | BDRV_O_UNMAP; VAR_3 = bdrv_parse_cache_mode(VAR_7, &VAR_4, &writethrough); if (VAR_3 < 0) { error_report("Invalid VAR_7 option: %s", VAR_7); return 1; } blk = img_open(image_opts, VAR_5, VAR_6, VAR_4, writethrough, quiet); if (!blk) { return 1; } bs = blk_bs(blk); qemu_progress_init(progress, 1.f); qemu_progress_print(0.f, 100); if (VAR_8) { base_bs = bdrv_find_backing_image(bs, VAR_8); if (!base_bs) { error_setg(&local_err, "Did not find '%s' in the backing chain of '%s'", VAR_8, VAR_5); goto done; } } else { base_bs = backing_bs(bs); if (!base_bs) { error_setg(&local_err, "Image does not have a backing file"); goto done; } } cbi = (CommonBlockJobCBInfo){ .errp = &local_err, .bs = bs, }; aio_context = bdrv_get_aio_context(bs); aio_context_acquire(aio_context); commit_active_start("commit", bs, base_bs, BLOCK_JOB_DEFAULT, 0, BLOCKDEV_ON_ERROR_REPORT, NULL, common_block_job_cb, &cbi, &local_err, false); aio_context_release(aio_context); if (local_err) { goto done; } if (!drop) { bdrv_ref(bs); } job = block_job_get("commit"); run_block_job(job, &local_err); if (local_err) { goto unref_backing; } if (!drop && bs->drv->bdrv_make_empty) { VAR_3 = bs->drv->bdrv_make_empty(bs); if (VAR_3) { error_setg_errno(&local_err, -VAR_3, "Could not empty %s", VAR_5); goto unref_backing; } } unref_backing: if (!drop) { bdrv_unref(bs); } done: qemu_progress_end(); blk_unref(blk); if (local_err) { error_report_err(local_err); return 1; } qprintf(quiet, "Image committed.\n"); return 0; }
[ "static int FUNC_0(int VAR_0, char **VAR_1)\n{", "int VAR_2, VAR_3, VAR_4;", "const char *VAR_5, *VAR_6, *VAR_7, *VAR_8;", "BlockBackend *blk;", "BlockDriverState *bs, *base_bs;", "BlockJob *job;", "bool progress = false, quiet = false, drop = false;", "bool writethrough;", "Error *local_err = NULL;", "CommonBlockJobCBInfo cbi;", "bool image_opts = false;", "AioContext *aio_context;", "VAR_6 = NULL;", "VAR_7 = BDRV_DEFAULT_CACHE;", "VAR_8 = NULL;", "for(;;) {", "static const struct option VAR_9[] = {", "{\"help\", no_argument, 0, 'h'},", "{\"object\", required_argument, 0, OPTION_OBJECT},", "{\"image-opts\", no_argument, 0, OPTION_IMAGE_OPTS},", "{0, 0, 0, 0}", "};", "VAR_2 = getopt_long(VAR_0, VAR_1, \"f:ht:b:dpq\",\nVAR_9, NULL);", "if (VAR_2 == -1) {", "break;", "}", "switch(VAR_2) {", "case '?':\ncase 'h':\nhelp();", "break;", "case 'f':\nVAR_6 = optarg;", "break;", "case 't':\nVAR_7 = optarg;", "break;", "case 'b':\nVAR_8 = optarg;", "drop = true;", "break;", "case 'd':\ndrop = true;", "break;", "case 'p':\nprogress = true;", "break;", "case 'q':\nquiet = true;", "break;", "case OPTION_OBJECT: {", "QemuOpts *opts;", "opts = qemu_opts_parse_noisily(&qemu_object_opts,\noptarg, true);", "if (!opts) {", "return 1;", "}", "} break;", "case OPTION_IMAGE_OPTS:\nimage_opts = true;", "break;", "}", "}", "if (quiet) {", "progress = false;", "}", "if (optind != VAR_0 - 1) {", "error_exit(\"Expecting one image file name\");", "}", "VAR_5 = VAR_1[optind++];", "if (qemu_opts_foreach(&qemu_object_opts,\nuser_creatable_add_opts_foreach,\nNULL, NULL)) {", "return 1;", "}", "VAR_4 = BDRV_O_RDWR | BDRV_O_UNMAP;", "VAR_3 = bdrv_parse_cache_mode(VAR_7, &VAR_4, &writethrough);", "if (VAR_3 < 0) {", "error_report(\"Invalid VAR_7 option: %s\", VAR_7);", "return 1;", "}", "blk = img_open(image_opts, VAR_5, VAR_6, VAR_4, writethrough, quiet);", "if (!blk) {", "return 1;", "}", "bs = blk_bs(blk);", "qemu_progress_init(progress, 1.f);", "qemu_progress_print(0.f, 100);", "if (VAR_8) {", "base_bs = bdrv_find_backing_image(bs, VAR_8);", "if (!base_bs) {", "error_setg(&local_err,\n\"Did not find '%s' in the backing chain of '%s'\",\nVAR_8, VAR_5);", "goto done;", "}", "} else {", "base_bs = backing_bs(bs);", "if (!base_bs) {", "error_setg(&local_err, \"Image does not have a backing file\");", "goto done;", "}", "}", "cbi = (CommonBlockJobCBInfo){", ".errp = &local_err,\n.bs = bs,\n};", "aio_context = bdrv_get_aio_context(bs);", "aio_context_acquire(aio_context);", "commit_active_start(\"commit\", bs, base_bs, BLOCK_JOB_DEFAULT, 0,\nBLOCKDEV_ON_ERROR_REPORT, NULL, common_block_job_cb,\n&cbi, &local_err, false);", "aio_context_release(aio_context);", "if (local_err) {", "goto done;", "}", "if (!drop) {", "bdrv_ref(bs);", "}", "job = block_job_get(\"commit\");", "run_block_job(job, &local_err);", "if (local_err) {", "goto unref_backing;", "}", "if (!drop && bs->drv->bdrv_make_empty) {", "VAR_3 = bs->drv->bdrv_make_empty(bs);", "if (VAR_3) {", "error_setg_errno(&local_err, -VAR_3, \"Could not empty %s\",\nVAR_5);", "goto unref_backing;", "}", "}", "unref_backing:\nif (!drop) {", "bdrv_unref(bs);", "}", "done:\nqemu_progress_end();", "blk_unref(blk);", "if (local_err) {", "error_report_err(local_err);", "return 1;", "}", "qprintf(quiet, \"Image committed.\\n\");", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 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 ], [ 87 ], [ 89 ], [ 91, 93 ], [ 95 ], [ 97, 99 ], [ 101 ], [ 103, 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113, 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125, 127 ], [ 129 ], [ 131 ], [ 133 ], [ 139 ], [ 141 ], [ 143 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 157, 159, 161 ], [ 163 ], [ 165 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 195 ], [ 197 ], [ 201 ], [ 203 ], [ 205 ], [ 207, 209, 211 ], [ 213 ], [ 215 ], [ 217 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 239 ], [ 241, 243, 245 ], [ 249 ], [ 251 ], [ 253, 255, 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 277 ], [ 279 ], [ 281 ], [ 285 ], [ 287 ], [ 289 ], [ 291 ], [ 293 ], [ 297 ], [ 299 ], [ 301 ], [ 303, 305 ], [ 307 ], [ 309 ], [ 311 ], [ 315, 317 ], [ 319 ], [ 321 ], [ 325, 327 ], [ 331 ], [ 335 ], [ 337 ], [ 339 ], [ 341 ], [ 345 ], [ 347 ], [ 349 ] ]
12,073
static int encode_superframe(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr) { WMACodecContext *s = avctx->priv_data; int i, total_gain, ret, error; s->block_len_bits= s->frame_len_bits; //required by non variable block len s->block_len = 1 << s->block_len_bits; apply_window_and_mdct(avctx, frame); if (s->ms_stereo) { float a, b; int i; for(i = 0; i < s->block_len; i++) { a = s->coefs[0][i]*0.5; b = s->coefs[1][i]*0.5; s->coefs[0][i] = a + b; s->coefs[1][i] = a - b; if ((ret = ff_alloc_packet2(avctx, avpkt, 2 * MAX_CODED_SUPERFRAME_SIZE)) < 0) return ret; total_gain= 128; for(i=64; i; i>>=1){ error = encode_frame(s, s->coefs, avpkt->data, avpkt->size, total_gain - i); if(error<=0) total_gain-= i; while(total_gain <= 128 && error > 0) error = encode_frame(s, s->coefs, avpkt->data, avpkt->size, total_gain++); av_assert0((put_bits_count(&s->pb) & 7) == 0); i= avctx->block_align - (put_bits_count(&s->pb)+7)/8; av_assert0(i>=0); while(i--) put_bits(&s->pb, 8, 'N'); flush_put_bits(&s->pb); av_assert0(put_bits_ptr(&s->pb) - s->pb.buf == avctx->block_align); if (frame->pts != AV_NOPTS_VALUE) avpkt->pts = frame->pts - ff_samples_to_time_base(avctx, avctx->delay); avpkt->size = avctx->block_align; *got_packet_ptr = 1; return 0;
true
FFmpeg
dccaad3bcdc5762141527cb7db7c87f34517f097
static int encode_superframe(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr) { WMACodecContext *s = avctx->priv_data; int i, total_gain, ret, error; s->block_len_bits= s->frame_len_bits; s->block_len = 1 << s->block_len_bits; apply_window_and_mdct(avctx, frame); if (s->ms_stereo) { float a, b; int i; for(i = 0; i < s->block_len; i++) { a = s->coefs[0][i]*0.5; b = s->coefs[1][i]*0.5; s->coefs[0][i] = a + b; s->coefs[1][i] = a - b; if ((ret = ff_alloc_packet2(avctx, avpkt, 2 * MAX_CODED_SUPERFRAME_SIZE)) < 0) return ret; total_gain= 128; for(i=64; i; i>>=1){ error = encode_frame(s, s->coefs, avpkt->data, avpkt->size, total_gain - i); if(error<=0) total_gain-= i; while(total_gain <= 128 && error > 0) error = encode_frame(s, s->coefs, avpkt->data, avpkt->size, total_gain++); av_assert0((put_bits_count(&s->pb) & 7) == 0); i= avctx->block_align - (put_bits_count(&s->pb)+7)/8; av_assert0(i>=0); while(i--) put_bits(&s->pb, 8, 'N'); flush_put_bits(&s->pb); av_assert0(put_bits_ptr(&s->pb) - s->pb.buf == avctx->block_align); if (frame->pts != AV_NOPTS_VALUE) avpkt->pts = frame->pts - ff_samples_to_time_base(avctx, avctx->delay); avpkt->size = avctx->block_align; *got_packet_ptr = 1; return 0;
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, AVPacket *VAR_1, const AVFrame *VAR_2, int *VAR_3) { WMACodecContext *s = VAR_0->priv_data; int VAR_10, VAR_5, VAR_6, VAR_7; s->block_len_bits= s->frame_len_bits; s->block_len = 1 << s->block_len_bits; apply_window_and_mdct(VAR_0, VAR_2); if (s->ms_stereo) { float VAR_8, VAR_9; int VAR_10; for(VAR_10 = 0; VAR_10 < s->block_len; VAR_10++) { VAR_8 = s->coefs[0][VAR_10]*0.5; VAR_9 = s->coefs[1][VAR_10]*0.5; s->coefs[0][VAR_10] = VAR_8 + VAR_9; s->coefs[1][VAR_10] = VAR_8 - VAR_9; if ((VAR_6 = ff_alloc_packet2(VAR_0, VAR_1, 2 * MAX_CODED_SUPERFRAME_SIZE)) < 0) return VAR_6; VAR_5= 128; for(VAR_10=64; VAR_10; VAR_10>>=1){ VAR_7 = encode_frame(s, s->coefs, VAR_1->data, VAR_1->size, VAR_5 - VAR_10); if(VAR_7<=0) VAR_5-= VAR_10; while(VAR_5 <= 128 && VAR_7 > 0) VAR_7 = encode_frame(s, s->coefs, VAR_1->data, VAR_1->size, VAR_5++); av_assert0((put_bits_count(&s->pb) & 7) == 0); VAR_10= VAR_0->block_align - (put_bits_count(&s->pb)+7)/8; av_assert0(VAR_10>=0); while(VAR_10--) put_bits(&s->pb, 8, 'N'); flush_put_bits(&s->pb); av_assert0(put_bits_ptr(&s->pb) - s->pb.buf == VAR_0->block_align); if (VAR_2->pts != AV_NOPTS_VALUE) VAR_1->pts = VAR_2->pts - ff_samples_to_time_base(VAR_0, VAR_0->delay); VAR_1->size = VAR_0->block_align; *VAR_3 = 1; return 0;
[ "static int FUNC_0(AVCodecContext *VAR_0, AVPacket *VAR_1,\nconst AVFrame *VAR_2, int *VAR_3)\n{", "WMACodecContext *s = VAR_0->priv_data;", "int VAR_10, VAR_5, VAR_6, VAR_7;", "s->block_len_bits= s->frame_len_bits;", "s->block_len = 1 << s->block_len_bits;", "apply_window_and_mdct(VAR_0, VAR_2);", "if (s->ms_stereo) {", "float VAR_8, VAR_9;", "int VAR_10;", "for(VAR_10 = 0; VAR_10 < s->block_len; VAR_10++) {", "VAR_8 = s->coefs[0][VAR_10]*0.5;", "VAR_9 = s->coefs[1][VAR_10]*0.5;", "s->coefs[0][VAR_10] = VAR_8 + VAR_9;", "s->coefs[1][VAR_10] = VAR_8 - VAR_9;", "if ((VAR_6 = ff_alloc_packet2(VAR_0, VAR_1, 2 * MAX_CODED_SUPERFRAME_SIZE)) < 0)\nreturn VAR_6;", "VAR_5= 128;", "for(VAR_10=64; VAR_10; VAR_10>>=1){", "VAR_7 = encode_frame(s, s->coefs, VAR_1->data, VAR_1->size,\nVAR_5 - VAR_10);", "if(VAR_7<=0)\nVAR_5-= VAR_10;", "while(VAR_5 <= 128 && VAR_7 > 0)\nVAR_7 = encode_frame(s, s->coefs, VAR_1->data, VAR_1->size, VAR_5++);", "av_assert0((put_bits_count(&s->pb) & 7) == 0);", "VAR_10= VAR_0->block_align - (put_bits_count(&s->pb)+7)/8;", "av_assert0(VAR_10>=0);", "while(VAR_10--)\nput_bits(&s->pb, 8, 'N');", "flush_put_bits(&s->pb);", "av_assert0(put_bits_ptr(&s->pb) - s->pb.buf == VAR_0->block_align);", "if (VAR_2->pts != AV_NOPTS_VALUE)\nVAR_1->pts = VAR_2->pts - ff_samples_to_time_base(VAR_0, VAR_0->delay);", "VAR_1->size = VAR_0->block_align;", "*VAR_3 = 1;", "return 0;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 45, 47 ], [ 51 ], [ 53 ], [ 55, 57 ], [ 59, 61 ], [ 66, 68 ], [ 75 ], [ 77 ], [ 79 ], [ 81, 83 ], [ 87 ], [ 89 ], [ 93, 95 ], [ 99 ], [ 101 ], [ 103 ] ]
12,074
static int ftp_passive_mode(FTPContext *s) { char *res = NULL, *start, *end; int i; const char *command = "PASV\r\n"; const int pasv_codes[] = {227, 501, 0}; /* 501 is incorrect code */ if (ftp_send_command(s, command, pasv_codes, &res) != 227 || !res) goto fail; start = NULL; for (i = 0; i < strlen(res); ++i) { if (res[i] == '(') { start = res + i + 1; } else if (res[i] == ')') { end = res + i; break; } } if (!start || !end) goto fail; *end = '\0'; /* skip ip */ if (!av_strtok(start, ",", &end)) goto fail; if (!av_strtok(end, ",", &end)) goto fail; if (!av_strtok(end, ",", &end)) goto fail; if (!av_strtok(end, ",", &end)) goto fail; /* parse port number */ start = av_strtok(end, ",", &end); if (!start) goto fail; s->server_data_port = atoi(start) * 256; start = av_strtok(end, ",", &end); if (!start) goto fail; s->server_data_port += atoi(start); av_dlog(s, "Server data port: %d\n", s->server_data_port); av_free(res); return 0; fail: av_free(res); s->server_data_port = -1; return AVERROR(EIO); }
true
FFmpeg
7faafe606fb25e3c8b3091ea0565b01622c87dd2
static int ftp_passive_mode(FTPContext *s) { char *res = NULL, *start, *end; int i; const char *command = "PASV\r\n"; const int pasv_codes[] = {227, 501, 0}; if (ftp_send_command(s, command, pasv_codes, &res) != 227 || !res) goto fail; start = NULL; for (i = 0; i < strlen(res); ++i) { if (res[i] == '(') { start = res + i + 1; } else if (res[i] == ')') { end = res + i; break; } } if (!start || !end) goto fail; *end = '\0'; if (!av_strtok(start, ",", &end)) goto fail; if (!av_strtok(end, ",", &end)) goto fail; if (!av_strtok(end, ",", &end)) goto fail; if (!av_strtok(end, ",", &end)) goto fail; start = av_strtok(end, ",", &end); if (!start) goto fail; s->server_data_port = atoi(start) * 256; start = av_strtok(end, ",", &end); if (!start) goto fail; s->server_data_port += atoi(start); av_dlog(s, "Server data port: %d\n", s->server_data_port); av_free(res); return 0; fail: av_free(res); s->server_data_port = -1; return AVERROR(EIO); }
{ "code": [ " char *res = NULL, *start, *end;", " start = NULL;", " for (i = 0; i < strlen(res); ++i) {" ], "line_no": [ 5, 21, 23 ] }
static int FUNC_0(FTPContext *VAR_0) { char *VAR_1 = NULL, *VAR_2, *VAR_3; int VAR_4; const char *VAR_5 = "PASV\r\n"; const int VAR_6[] = {227, 501, 0}; if (ftp_send_command(VAR_0, VAR_5, VAR_6, &VAR_1) != 227 || !VAR_1) goto fail; VAR_2 = NULL; for (VAR_4 = 0; VAR_4 < strlen(VAR_1); ++VAR_4) { if (VAR_1[VAR_4] == '(') { VAR_2 = VAR_1 + VAR_4 + 1; } else if (VAR_1[VAR_4] == ')') { VAR_3 = VAR_1 + VAR_4; break; } } if (!VAR_2 || !VAR_3) goto fail; *VAR_3 = '\0'; if (!av_strtok(VAR_2, ",", &VAR_3)) goto fail; if (!av_strtok(VAR_3, ",", &VAR_3)) goto fail; if (!av_strtok(VAR_3, ",", &VAR_3)) goto fail; if (!av_strtok(VAR_3, ",", &VAR_3)) goto fail; VAR_2 = av_strtok(VAR_3, ",", &VAR_3); if (!VAR_2) goto fail; VAR_0->server_data_port = atoi(VAR_2) * 256; VAR_2 = av_strtok(VAR_3, ",", &VAR_3); if (!VAR_2) goto fail; VAR_0->server_data_port += atoi(VAR_2); av_dlog(VAR_0, "Server data port: %d\n", VAR_0->server_data_port); av_free(VAR_1); return 0; fail: av_free(VAR_1); VAR_0->server_data_port = -1; return AVERROR(EIO); }
[ "static int FUNC_0(FTPContext *VAR_0)\n{", "char *VAR_1 = NULL, *VAR_2, *VAR_3;", "int VAR_4;", "const char *VAR_5 = \"PASV\\r\\n\";", "const int VAR_6[] = {227, 501, 0};", "if (ftp_send_command(VAR_0, VAR_5, VAR_6, &VAR_1) != 227 || !VAR_1)\ngoto fail;", "VAR_2 = NULL;", "for (VAR_4 = 0; VAR_4 < strlen(VAR_1); ++VAR_4) {", "if (VAR_1[VAR_4] == '(') {", "VAR_2 = VAR_1 + VAR_4 + 1;", "} else if (VAR_1[VAR_4] == ')') {", "VAR_3 = VAR_1 + VAR_4;", "break;", "}", "}", "if (!VAR_2 || !VAR_3)\ngoto fail;", "*VAR_3 = '\\0';", "if (!av_strtok(VAR_2, \",\", &VAR_3)) goto fail;", "if (!av_strtok(VAR_3, \",\", &VAR_3)) goto fail;", "if (!av_strtok(VAR_3, \",\", &VAR_3)) goto fail;", "if (!av_strtok(VAR_3, \",\", &VAR_3)) goto fail;", "VAR_2 = av_strtok(VAR_3, \",\", &VAR_3);", "if (!VAR_2) goto fail;", "VAR_0->server_data_port = atoi(VAR_2) * 256;", "VAR_2 = av_strtok(VAR_3, \",\", &VAR_3);", "if (!VAR_2) goto fail;", "VAR_0->server_data_port += atoi(VAR_2);", "av_dlog(VAR_0, \"Server data port: %d\\n\", VAR_0->server_data_port);", "av_free(VAR_1);", "return 0;", "fail:\nav_free(VAR_1);", "VAR_0->server_data_port = -1;", "return AVERROR(EIO);", "}" ]
[ 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15, 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39, 41 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 79 ], [ 83, 85 ], [ 87 ], [ 89 ], [ 91 ] ]
12,076
static int wavpack_decode_block(AVCodecContext *avctx, int block_no, void *data, int *data_size, const uint8_t *buf, int buf_size) { WavpackContext *wc = avctx->priv_data; WavpackFrameContext *s; void *samples = data; int samplecount; int got_terms = 0, got_weights = 0, got_samples = 0, got_entropy = 0, got_bs = 0, got_float = 0; int got_hybrid = 0; const uint8_t* orig_buf = buf; const uint8_t* buf_end = buf + buf_size; int i, j, id, size, ssize, weights, t; int bpp, chan, chmask; if (buf_size == 0){ *data_size = 0; return 0; } if(block_no >= wc->fdec_num && wv_alloc_frame_context(wc) < 0){ av_log(avctx, AV_LOG_ERROR, "Error creating frame decode context\n"); return -1; } s = wc->fdec[block_no]; if(!s){ av_log(avctx, AV_LOG_ERROR, "Context for block %d is not present\n", block_no); return -1; } if(!s->samples_left){ memset(s->decorr, 0, MAX_TERMS * sizeof(Decorr)); memset(s->ch, 0, sizeof(s->ch)); s->extra_bits = 0; s->and = s->or = s->shift = 0; s->got_extra_bits = 0; } if(!wc->mkv_mode){ s->samples = AV_RL32(buf); buf += 4; if(!s->samples){ *data_size = 0; return 0; } }else{ s->samples = wc->samples; } s->frame_flags = AV_RL32(buf); buf += 4; if(s->frame_flags&0x80){ bpp = sizeof(float); avctx->sample_fmt = AV_SAMPLE_FMT_FLT; } else if((s->frame_flags&0x03) <= 1){ bpp = 2; avctx->sample_fmt = AV_SAMPLE_FMT_S16; } else { bpp = 4; avctx->sample_fmt = AV_SAMPLE_FMT_S32; } samples = (uint8_t*)samples + bpp * wc->ch_offset; s->stereo = !(s->frame_flags & WV_MONO); s->stereo_in = (s->frame_flags & WV_FALSE_STEREO) ? 0 : s->stereo; s->joint = s->frame_flags & WV_JOINT_STEREO; s->hybrid = s->frame_flags & WV_HYBRID_MODE; s->hybrid_bitrate = s->frame_flags & WV_HYBRID_BITRATE; s->post_shift = 8 * (bpp-1-(s->frame_flags&0x03)) + ((s->frame_flags >> 13) & 0x1f); s->CRC = AV_RL32(buf); buf += 4; if(wc->mkv_mode) buf += 4; //skip block size; wc->ch_offset += 1 + s->stereo; s->max_samples = *data_size / (bpp * avctx->channels); s->max_samples = FFMIN(s->max_samples, s->samples); if(s->samples_left > 0){ s->max_samples = FFMIN(s->max_samples, s->samples_left); buf = buf_end; } // parse metadata blocks while(buf < buf_end){ id = *buf++; size = *buf++; if(id & WP_IDF_LONG) { size |= (*buf++) << 8; size |= (*buf++) << 16; } size <<= 1; // size is specified in words ssize = size; if(id & WP_IDF_ODD) size--; if(size < 0){ av_log(avctx, AV_LOG_ERROR, "Got incorrect block %02X with size %i\n", id, size); break; } if(buf + ssize > buf_end){ av_log(avctx, AV_LOG_ERROR, "Block size %i is out of bounds\n", size); break; } if(id & WP_IDF_IGNORE){ buf += ssize; continue; } switch(id & WP_IDF_MASK){ case WP_ID_DECTERMS: s->terms = size; if(s->terms > MAX_TERMS){ av_log(avctx, AV_LOG_ERROR, "Too many decorrelation terms\n"); buf += ssize; continue; } for(i = 0; i < s->terms; i++) { s->decorr[s->terms - i - 1].value = (*buf & 0x1F) - 5; s->decorr[s->terms - i - 1].delta = *buf >> 5; buf++; } got_terms = 1; break; case WP_ID_DECWEIGHTS: if(!got_terms){ av_log(avctx, AV_LOG_ERROR, "No decorrelation terms met\n"); continue; } weights = size >> s->stereo_in; if(weights > MAX_TERMS || weights > s->terms){ av_log(avctx, AV_LOG_ERROR, "Too many decorrelation weights\n"); buf += ssize; continue; } for(i = 0; i < weights; i++) { t = (int8_t)(*buf++); s->decorr[s->terms - i - 1].weightA = t << 3; if(s->decorr[s->terms - i - 1].weightA > 0) s->decorr[s->terms - i - 1].weightA += (s->decorr[s->terms - i - 1].weightA + 64) >> 7; if(s->stereo_in){ t = (int8_t)(*buf++); s->decorr[s->terms - i - 1].weightB = t << 3; if(s->decorr[s->terms - i - 1].weightB > 0) s->decorr[s->terms - i - 1].weightB += (s->decorr[s->terms - i - 1].weightB + 64) >> 7; } } got_weights = 1; break; case WP_ID_DECSAMPLES: if(!got_terms){ av_log(avctx, AV_LOG_ERROR, "No decorrelation terms met\n"); continue; } t = 0; for(i = s->terms - 1; (i >= 0) && (t < size); i--) { if(s->decorr[i].value > 8){ s->decorr[i].samplesA[0] = wp_exp2(AV_RL16(buf)); buf += 2; s->decorr[i].samplesA[1] = wp_exp2(AV_RL16(buf)); buf += 2; if(s->stereo_in){ s->decorr[i].samplesB[0] = wp_exp2(AV_RL16(buf)); buf += 2; s->decorr[i].samplesB[1] = wp_exp2(AV_RL16(buf)); buf += 2; t += 4; } t += 4; }else if(s->decorr[i].value < 0){ s->decorr[i].samplesA[0] = wp_exp2(AV_RL16(buf)); buf += 2; s->decorr[i].samplesB[0] = wp_exp2(AV_RL16(buf)); buf += 2; t += 4; }else{ for(j = 0; j < s->decorr[i].value; j++){ s->decorr[i].samplesA[j] = wp_exp2(AV_RL16(buf)); buf += 2; if(s->stereo_in){ s->decorr[i].samplesB[j] = wp_exp2(AV_RL16(buf)); buf += 2; } } t += s->decorr[i].value * 2 * (s->stereo_in + 1); } } got_samples = 1; break; case WP_ID_ENTROPY: if(size != 6 * (s->stereo_in + 1)){ av_log(avctx, AV_LOG_ERROR, "Entropy vars size should be %i, got %i", 6 * (s->stereo_in + 1), size); buf += ssize; continue; } for(j = 0; j <= s->stereo_in; j++){ for(i = 0; i < 3; i++){ s->ch[j].median[i] = wp_exp2(AV_RL16(buf)); buf += 2; } } got_entropy = 1; break; case WP_ID_HYBRID: if(s->hybrid_bitrate){ for(i = 0; i <= s->stereo_in; i++){ s->ch[i].slow_level = wp_exp2(AV_RL16(buf)); buf += 2; size -= 2; } } for(i = 0; i < (s->stereo_in + 1); i++){ s->ch[i].bitrate_acc = AV_RL16(buf) << 16; buf += 2; size -= 2; } if(size > 0){ for(i = 0; i < (s->stereo_in + 1); i++){ s->ch[i].bitrate_delta = wp_exp2((int16_t)AV_RL16(buf)); buf += 2; } }else{ for(i = 0; i < (s->stereo_in + 1); i++) s->ch[i].bitrate_delta = 0; } got_hybrid = 1; break; case WP_ID_INT32INFO: if(size != 4){ av_log(avctx, AV_LOG_ERROR, "Invalid INT32INFO, size = %i, sent_bits = %i\n", size, *buf); buf += ssize; continue; } if(buf[0]) s->extra_bits = buf[0]; else if(buf[1]) s->shift = buf[1]; else if(buf[2]){ s->and = s->or = 1; s->shift = buf[2]; }else if(buf[3]){ s->and = 1; s->shift = buf[3]; } buf += 4; break; case WP_ID_FLOATINFO: if(size != 4){ av_log(avctx, AV_LOG_ERROR, "Invalid FLOATINFO, size = %i\n", size); buf += ssize; continue; } s->float_flag = buf[0]; s->float_shift = buf[1]; s->float_max_exp = buf[2]; buf += 4; got_float = 1; break; case WP_ID_DATA: s->sc.offset = buf - orig_buf; s->sc.size = size * 8; init_get_bits(&s->gb, buf, size * 8); s->data_size = size * 8; buf += size; got_bs = 1; break; case WP_ID_EXTRABITS: if(size <= 4){ av_log(avctx, AV_LOG_ERROR, "Invalid EXTRABITS, size = %i\n", size); buf += size; continue; } s->extra_sc.offset = buf - orig_buf; s->extra_sc.size = size * 8; init_get_bits(&s->gb_extra_bits, buf, size * 8); s->crc_extra_bits = get_bits_long(&s->gb_extra_bits, 32); buf += size; s->got_extra_bits = 1; break; case WP_ID_CHANINFO: if(size <= 1){ av_log(avctx, AV_LOG_ERROR, "Insufficient channel information\n"); return -1; } chan = *buf++; switch(size - 2){ case 0: chmask = *buf; break; case 1: chmask = AV_RL16(buf); break; case 2: chmask = AV_RL24(buf); break; case 3: chmask = AV_RL32(buf); break; case 5: chan |= (buf[1] & 0xF) << 8; chmask = AV_RL24(buf + 2); break; default: av_log(avctx, AV_LOG_ERROR, "Invalid channel info size %d\n", size); chan = avctx->channels; chmask = avctx->channel_layout; } if(chan != avctx->channels){ av_log(avctx, AV_LOG_ERROR, "Block reports total %d channels, decoder believes it's %d channels\n", chan, avctx->channels); return -1; } if(!avctx->channel_layout) avctx->channel_layout = chmask; buf += size - 1; break; default: buf += size; } if(id & WP_IDF_ODD) buf++; } if(!s->samples_left){ if(!got_terms){ av_log(avctx, AV_LOG_ERROR, "No block with decorrelation terms\n"); return -1; } if(!got_weights){ av_log(avctx, AV_LOG_ERROR, "No block with decorrelation weights\n"); return -1; } if(!got_samples){ av_log(avctx, AV_LOG_ERROR, "No block with decorrelation samples\n"); return -1; } if(!got_entropy){ av_log(avctx, AV_LOG_ERROR, "No block with entropy info\n"); return -1; } if(s->hybrid && !got_hybrid){ av_log(avctx, AV_LOG_ERROR, "Hybrid config not found\n"); return -1; } if(!got_bs){ av_log(avctx, AV_LOG_ERROR, "Packed samples not found\n"); return -1; } if(!got_float && avctx->sample_fmt == AV_SAMPLE_FMT_FLT){ av_log(avctx, AV_LOG_ERROR, "Float information not found\n"); return -1; } if(s->got_extra_bits && avctx->sample_fmt != AV_SAMPLE_FMT_FLT){ const int size = get_bits_left(&s->gb_extra_bits); const int wanted = s->samples * s->extra_bits << s->stereo_in; if(size < wanted){ av_log(avctx, AV_LOG_ERROR, "Too small EXTRABITS\n"); s->got_extra_bits = 0; } } s->samples_left = s->samples; }else{ init_get_bits(&s->gb, orig_buf + s->sc.offset, s->sc.size); skip_bits_long(&s->gb, s->sc.bits_used); if(s->got_extra_bits){ init_get_bits(&s->gb_extra_bits, orig_buf + s->extra_sc.offset, s->extra_sc.size); skip_bits_long(&s->gb_extra_bits, s->extra_sc.bits_used); } } if(s->stereo_in){ if(avctx->sample_fmt == AV_SAMPLE_FMT_S16) samplecount = wv_unpack_stereo(s, &s->gb, samples, AV_SAMPLE_FMT_S16); else if(avctx->sample_fmt == AV_SAMPLE_FMT_S32) samplecount = wv_unpack_stereo(s, &s->gb, samples, AV_SAMPLE_FMT_S32); else samplecount = wv_unpack_stereo(s, &s->gb, samples, AV_SAMPLE_FMT_FLT); samplecount >>= 1; }else{ const int channel_stride = avctx->channels; if(avctx->sample_fmt == AV_SAMPLE_FMT_S16) samplecount = wv_unpack_mono(s, &s->gb, samples, AV_SAMPLE_FMT_S16); else if(avctx->sample_fmt == AV_SAMPLE_FMT_S32) samplecount = wv_unpack_mono(s, &s->gb, samples, AV_SAMPLE_FMT_S32); else samplecount = wv_unpack_mono(s, &s->gb, samples, AV_SAMPLE_FMT_FLT); if(s->stereo && avctx->sample_fmt == AV_SAMPLE_FMT_S16){ int16_t *dst = (int16_t*)samples + 1; int16_t *src = (int16_t*)samples; int cnt = samplecount; while(cnt--){ *dst = *src; src += channel_stride; dst += channel_stride; } }else if(s->stereo && avctx->sample_fmt == AV_SAMPLE_FMT_S32){ int32_t *dst = (int32_t*)samples + 1; int32_t *src = (int32_t*)samples; int cnt = samplecount; while(cnt--){ *dst = *src; src += channel_stride; dst += channel_stride; } }else if(s->stereo){ float *dst = (float*)samples + 1; float *src = (float*)samples; int cnt = samplecount; while(cnt--){ *dst = *src; src += channel_stride; dst += channel_stride; } } } wc->samples_left = s->samples_left; return samplecount * bpp; }
true
FFmpeg
0aedab03405849962b469277afe047aa2c61a87f
static int wavpack_decode_block(AVCodecContext *avctx, int block_no, void *data, int *data_size, const uint8_t *buf, int buf_size) { WavpackContext *wc = avctx->priv_data; WavpackFrameContext *s; void *samples = data; int samplecount; int got_terms = 0, got_weights = 0, got_samples = 0, got_entropy = 0, got_bs = 0, got_float = 0; int got_hybrid = 0; const uint8_t* orig_buf = buf; const uint8_t* buf_end = buf + buf_size; int i, j, id, size, ssize, weights, t; int bpp, chan, chmask; if (buf_size == 0){ *data_size = 0; return 0; } if(block_no >= wc->fdec_num && wv_alloc_frame_context(wc) < 0){ av_log(avctx, AV_LOG_ERROR, "Error creating frame decode context\n"); return -1; } s = wc->fdec[block_no]; if(!s){ av_log(avctx, AV_LOG_ERROR, "Context for block %d is not present\n", block_no); return -1; } if(!s->samples_left){ memset(s->decorr, 0, MAX_TERMS * sizeof(Decorr)); memset(s->ch, 0, sizeof(s->ch)); s->extra_bits = 0; s->and = s->or = s->shift = 0; s->got_extra_bits = 0; } if(!wc->mkv_mode){ s->samples = AV_RL32(buf); buf += 4; if(!s->samples){ *data_size = 0; return 0; } }else{ s->samples = wc->samples; } s->frame_flags = AV_RL32(buf); buf += 4; if(s->frame_flags&0x80){ bpp = sizeof(float); avctx->sample_fmt = AV_SAMPLE_FMT_FLT; } else if((s->frame_flags&0x03) <= 1){ bpp = 2; avctx->sample_fmt = AV_SAMPLE_FMT_S16; } else { bpp = 4; avctx->sample_fmt = AV_SAMPLE_FMT_S32; } samples = (uint8_t*)samples + bpp * wc->ch_offset; s->stereo = !(s->frame_flags & WV_MONO); s->stereo_in = (s->frame_flags & WV_FALSE_STEREO) ? 0 : s->stereo; s->joint = s->frame_flags & WV_JOINT_STEREO; s->hybrid = s->frame_flags & WV_HYBRID_MODE; s->hybrid_bitrate = s->frame_flags & WV_HYBRID_BITRATE; s->post_shift = 8 * (bpp-1-(s->frame_flags&0x03)) + ((s->frame_flags >> 13) & 0x1f); s->CRC = AV_RL32(buf); buf += 4; if(wc->mkv_mode) buf += 4; wc->ch_offset += 1 + s->stereo; s->max_samples = *data_size / (bpp * avctx->channels); s->max_samples = FFMIN(s->max_samples, s->samples); if(s->samples_left > 0){ s->max_samples = FFMIN(s->max_samples, s->samples_left); buf = buf_end; } while(buf < buf_end){ id = *buf++; size = *buf++; if(id & WP_IDF_LONG) { size |= (*buf++) << 8; size |= (*buf++) << 16; } size <<= 1; ssize = size; if(id & WP_IDF_ODD) size--; if(size < 0){ av_log(avctx, AV_LOG_ERROR, "Got incorrect block %02X with size %i\n", id, size); break; } if(buf + ssize > buf_end){ av_log(avctx, AV_LOG_ERROR, "Block size %i is out of bounds\n", size); break; } if(id & WP_IDF_IGNORE){ buf += ssize; continue; } switch(id & WP_IDF_MASK){ case WP_ID_DECTERMS: s->terms = size; if(s->terms > MAX_TERMS){ av_log(avctx, AV_LOG_ERROR, "Too many decorrelation terms\n"); buf += ssize; continue; } for(i = 0; i < s->terms; i++) { s->decorr[s->terms - i - 1].value = (*buf & 0x1F) - 5; s->decorr[s->terms - i - 1].delta = *buf >> 5; buf++; } got_terms = 1; break; case WP_ID_DECWEIGHTS: if(!got_terms){ av_log(avctx, AV_LOG_ERROR, "No decorrelation terms met\n"); continue; } weights = size >> s->stereo_in; if(weights > MAX_TERMS || weights > s->terms){ av_log(avctx, AV_LOG_ERROR, "Too many decorrelation weights\n"); buf += ssize; continue; } for(i = 0; i < weights; i++) { t = (int8_t)(*buf++); s->decorr[s->terms - i - 1].weightA = t << 3; if(s->decorr[s->terms - i - 1].weightA > 0) s->decorr[s->terms - i - 1].weightA += (s->decorr[s->terms - i - 1].weightA + 64) >> 7; if(s->stereo_in){ t = (int8_t)(*buf++); s->decorr[s->terms - i - 1].weightB = t << 3; if(s->decorr[s->terms - i - 1].weightB > 0) s->decorr[s->terms - i - 1].weightB += (s->decorr[s->terms - i - 1].weightB + 64) >> 7; } } got_weights = 1; break; case WP_ID_DECSAMPLES: if(!got_terms){ av_log(avctx, AV_LOG_ERROR, "No decorrelation terms met\n"); continue; } t = 0; for(i = s->terms - 1; (i >= 0) && (t < size); i--) { if(s->decorr[i].value > 8){ s->decorr[i].samplesA[0] = wp_exp2(AV_RL16(buf)); buf += 2; s->decorr[i].samplesA[1] = wp_exp2(AV_RL16(buf)); buf += 2; if(s->stereo_in){ s->decorr[i].samplesB[0] = wp_exp2(AV_RL16(buf)); buf += 2; s->decorr[i].samplesB[1] = wp_exp2(AV_RL16(buf)); buf += 2; t += 4; } t += 4; }else if(s->decorr[i].value < 0){ s->decorr[i].samplesA[0] = wp_exp2(AV_RL16(buf)); buf += 2; s->decorr[i].samplesB[0] = wp_exp2(AV_RL16(buf)); buf += 2; t += 4; }else{ for(j = 0; j < s->decorr[i].value; j++){ s->decorr[i].samplesA[j] = wp_exp2(AV_RL16(buf)); buf += 2; if(s->stereo_in){ s->decorr[i].samplesB[j] = wp_exp2(AV_RL16(buf)); buf += 2; } } t += s->decorr[i].value * 2 * (s->stereo_in + 1); } } got_samples = 1; break; case WP_ID_ENTROPY: if(size != 6 * (s->stereo_in + 1)){ av_log(avctx, AV_LOG_ERROR, "Entropy vars size should be %i, got %i", 6 * (s->stereo_in + 1), size); buf += ssize; continue; } for(j = 0; j <= s->stereo_in; j++){ for(i = 0; i < 3; i++){ s->ch[j].median[i] = wp_exp2(AV_RL16(buf)); buf += 2; } } got_entropy = 1; break; case WP_ID_HYBRID: if(s->hybrid_bitrate){ for(i = 0; i <= s->stereo_in; i++){ s->ch[i].slow_level = wp_exp2(AV_RL16(buf)); buf += 2; size -= 2; } } for(i = 0; i < (s->stereo_in + 1); i++){ s->ch[i].bitrate_acc = AV_RL16(buf) << 16; buf += 2; size -= 2; } if(size > 0){ for(i = 0; i < (s->stereo_in + 1); i++){ s->ch[i].bitrate_delta = wp_exp2((int16_t)AV_RL16(buf)); buf += 2; } }else{ for(i = 0; i < (s->stereo_in + 1); i++) s->ch[i].bitrate_delta = 0; } got_hybrid = 1; break; case WP_ID_INT32INFO: if(size != 4){ av_log(avctx, AV_LOG_ERROR, "Invalid INT32INFO, size = %i, sent_bits = %i\n", size, *buf); buf += ssize; continue; } if(buf[0]) s->extra_bits = buf[0]; else if(buf[1]) s->shift = buf[1]; else if(buf[2]){ s->and = s->or = 1; s->shift = buf[2]; }else if(buf[3]){ s->and = 1; s->shift = buf[3]; } buf += 4; break; case WP_ID_FLOATINFO: if(size != 4){ av_log(avctx, AV_LOG_ERROR, "Invalid FLOATINFO, size = %i\n", size); buf += ssize; continue; } s->float_flag = buf[0]; s->float_shift = buf[1]; s->float_max_exp = buf[2]; buf += 4; got_float = 1; break; case WP_ID_DATA: s->sc.offset = buf - orig_buf; s->sc.size = size * 8; init_get_bits(&s->gb, buf, size * 8); s->data_size = size * 8; buf += size; got_bs = 1; break; case WP_ID_EXTRABITS: if(size <= 4){ av_log(avctx, AV_LOG_ERROR, "Invalid EXTRABITS, size = %i\n", size); buf += size; continue; } s->extra_sc.offset = buf - orig_buf; s->extra_sc.size = size * 8; init_get_bits(&s->gb_extra_bits, buf, size * 8); s->crc_extra_bits = get_bits_long(&s->gb_extra_bits, 32); buf += size; s->got_extra_bits = 1; break; case WP_ID_CHANINFO: if(size <= 1){ av_log(avctx, AV_LOG_ERROR, "Insufficient channel information\n"); return -1; } chan = *buf++; switch(size - 2){ case 0: chmask = *buf; break; case 1: chmask = AV_RL16(buf); break; case 2: chmask = AV_RL24(buf); break; case 3: chmask = AV_RL32(buf); break; case 5: chan |= (buf[1] & 0xF) << 8; chmask = AV_RL24(buf + 2); break; default: av_log(avctx, AV_LOG_ERROR, "Invalid channel info size %d\n", size); chan = avctx->channels; chmask = avctx->channel_layout; } if(chan != avctx->channels){ av_log(avctx, AV_LOG_ERROR, "Block reports total %d channels, decoder believes it's %d channels\n", chan, avctx->channels); return -1; } if(!avctx->channel_layout) avctx->channel_layout = chmask; buf += size - 1; break; default: buf += size; } if(id & WP_IDF_ODD) buf++; } if(!s->samples_left){ if(!got_terms){ av_log(avctx, AV_LOG_ERROR, "No block with decorrelation terms\n"); return -1; } if(!got_weights){ av_log(avctx, AV_LOG_ERROR, "No block with decorrelation weights\n"); return -1; } if(!got_samples){ av_log(avctx, AV_LOG_ERROR, "No block with decorrelation samples\n"); return -1; } if(!got_entropy){ av_log(avctx, AV_LOG_ERROR, "No block with entropy info\n"); return -1; } if(s->hybrid && !got_hybrid){ av_log(avctx, AV_LOG_ERROR, "Hybrid config not found\n"); return -1; } if(!got_bs){ av_log(avctx, AV_LOG_ERROR, "Packed samples not found\n"); return -1; } if(!got_float && avctx->sample_fmt == AV_SAMPLE_FMT_FLT){ av_log(avctx, AV_LOG_ERROR, "Float information not found\n"); return -1; } if(s->got_extra_bits && avctx->sample_fmt != AV_SAMPLE_FMT_FLT){ const int size = get_bits_left(&s->gb_extra_bits); const int wanted = s->samples * s->extra_bits << s->stereo_in; if(size < wanted){ av_log(avctx, AV_LOG_ERROR, "Too small EXTRABITS\n"); s->got_extra_bits = 0; } } s->samples_left = s->samples; }else{ init_get_bits(&s->gb, orig_buf + s->sc.offset, s->sc.size); skip_bits_long(&s->gb, s->sc.bits_used); if(s->got_extra_bits){ init_get_bits(&s->gb_extra_bits, orig_buf + s->extra_sc.offset, s->extra_sc.size); skip_bits_long(&s->gb_extra_bits, s->extra_sc.bits_used); } } if(s->stereo_in){ if(avctx->sample_fmt == AV_SAMPLE_FMT_S16) samplecount = wv_unpack_stereo(s, &s->gb, samples, AV_SAMPLE_FMT_S16); else if(avctx->sample_fmt == AV_SAMPLE_FMT_S32) samplecount = wv_unpack_stereo(s, &s->gb, samples, AV_SAMPLE_FMT_S32); else samplecount = wv_unpack_stereo(s, &s->gb, samples, AV_SAMPLE_FMT_FLT); samplecount >>= 1; }else{ const int channel_stride = avctx->channels; if(avctx->sample_fmt == AV_SAMPLE_FMT_S16) samplecount = wv_unpack_mono(s, &s->gb, samples, AV_SAMPLE_FMT_S16); else if(avctx->sample_fmt == AV_SAMPLE_FMT_S32) samplecount = wv_unpack_mono(s, &s->gb, samples, AV_SAMPLE_FMT_S32); else samplecount = wv_unpack_mono(s, &s->gb, samples, AV_SAMPLE_FMT_FLT); if(s->stereo && avctx->sample_fmt == AV_SAMPLE_FMT_S16){ int16_t *dst = (int16_t*)samples + 1; int16_t *src = (int16_t*)samples; int cnt = samplecount; while(cnt--){ *dst = *src; src += channel_stride; dst += channel_stride; } }else if(s->stereo && avctx->sample_fmt == AV_SAMPLE_FMT_S32){ int32_t *dst = (int32_t*)samples + 1; int32_t *src = (int32_t*)samples; int cnt = samplecount; while(cnt--){ *dst = *src; src += channel_stride; dst += channel_stride; } }else if(s->stereo){ float *dst = (float*)samples + 1; float *src = (float*)samples; int cnt = samplecount; while(cnt--){ *dst = *src; src += channel_stride; dst += channel_stride; } } } wc->samples_left = s->samples_left; return samplecount * bpp; }
{ "code": [ " while(cnt--){", " while(cnt--){", " while(cnt--){" ], "line_no": [ 755, 755, 755 ] }
static int FUNC_0(AVCodecContext *VAR_0, int VAR_1, void *VAR_2, int *VAR_3, const uint8_t *VAR_4, int VAR_5) { WavpackContext *wc = VAR_0->priv_data; WavpackFrameContext *s; void *VAR_6 = VAR_2; int VAR_7; int VAR_8 = 0, VAR_9 = 0, VAR_10 = 0, VAR_11 = 0, VAR_12 = 0, VAR_13 = 0; int VAR_14 = 0; const uint8_t* VAR_15 = VAR_4; const uint8_t* VAR_16 = VAR_4 + VAR_5; int VAR_17, VAR_18, VAR_19, VAR_27, VAR_21, VAR_22, VAR_23; int VAR_24, VAR_25, VAR_26; if (VAR_5 == 0){ *VAR_3 = 0; return 0; } if(VAR_1 >= wc->fdec_num && wv_alloc_frame_context(wc) < 0){ av_log(VAR_0, AV_LOG_ERROR, "Error creating frame decode context\n"); return -1; } s = wc->fdec[VAR_1]; if(!s){ av_log(VAR_0, AV_LOG_ERROR, "Context for block %d is not present\n", VAR_1); return -1; } if(!s->samples_left){ memset(s->decorr, 0, MAX_TERMS * sizeof(Decorr)); memset(s->ch, 0, sizeof(s->ch)); s->extra_bits = 0; s->and = s->or = s->shift = 0; s->got_extra_bits = 0; } if(!wc->mkv_mode){ s->VAR_6 = AV_RL32(VAR_4); VAR_4 += 4; if(!s->VAR_6){ *VAR_3 = 0; return 0; } }else{ s->VAR_6 = wc->VAR_6; } s->frame_flags = AV_RL32(VAR_4); VAR_4 += 4; if(s->frame_flags&0x80){ VAR_24 = sizeof(float); VAR_0->sample_fmt = AV_SAMPLE_FMT_FLT; } else if((s->frame_flags&0x03) <= 1){ VAR_24 = 2; VAR_0->sample_fmt = AV_SAMPLE_FMT_S16; } else { VAR_24 = 4; VAR_0->sample_fmt = AV_SAMPLE_FMT_S32; } VAR_6 = (uint8_t*)VAR_6 + VAR_24 * wc->ch_offset; s->stereo = !(s->frame_flags & WV_MONO); s->stereo_in = (s->frame_flags & WV_FALSE_STEREO) ? 0 : s->stereo; s->joint = s->frame_flags & WV_JOINT_STEREO; s->hybrid = s->frame_flags & WV_HYBRID_MODE; s->hybrid_bitrate = s->frame_flags & WV_HYBRID_BITRATE; s->post_shift = 8 * (VAR_24-1-(s->frame_flags&0x03)) + ((s->frame_flags >> 13) & 0x1f); s->CRC = AV_RL32(VAR_4); VAR_4 += 4; if(wc->mkv_mode) VAR_4 += 4; wc->ch_offset += 1 + s->stereo; s->max_samples = *VAR_3 / (VAR_24 * VAR_0->channels); s->max_samples = FFMIN(s->max_samples, s->VAR_6); if(s->samples_left > 0){ s->max_samples = FFMIN(s->max_samples, s->samples_left); VAR_4 = VAR_16; } while(VAR_4 < VAR_16){ VAR_19 = *VAR_4++; VAR_27 = *VAR_4++; if(VAR_19 & WP_IDF_LONG) { VAR_27 |= (*VAR_4++) << 8; VAR_27 |= (*VAR_4++) << 16; } VAR_27 <<= 1; VAR_21 = VAR_27; if(VAR_19 & WP_IDF_ODD) VAR_27--; if(VAR_27 < 0){ av_log(VAR_0, AV_LOG_ERROR, "Got incorrect block %02X with VAR_27 %VAR_17\n", VAR_19, VAR_27); break; } if(VAR_4 + VAR_21 > VAR_16){ av_log(VAR_0, AV_LOG_ERROR, "Block VAR_27 %VAR_17 is out of bounds\n", VAR_27); break; } if(VAR_19 & WP_IDF_IGNORE){ VAR_4 += VAR_21; continue; } switch(VAR_19 & WP_IDF_MASK){ case WP_ID_DECTERMS: s->terms = VAR_27; if(s->terms > MAX_TERMS){ av_log(VAR_0, AV_LOG_ERROR, "Too many decorrelation terms\n"); VAR_4 += VAR_21; continue; } for(VAR_17 = 0; VAR_17 < s->terms; VAR_17++) { s->decorr[s->terms - VAR_17 - 1].value = (*VAR_4 & 0x1F) - 5; s->decorr[s->terms - VAR_17 - 1].delta = *VAR_4 >> 5; VAR_4++; } VAR_8 = 1; break; case WP_ID_DECWEIGHTS: if(!VAR_8){ av_log(VAR_0, AV_LOG_ERROR, "No decorrelation terms met\n"); continue; } VAR_22 = VAR_27 >> s->stereo_in; if(VAR_22 > MAX_TERMS || VAR_22 > s->terms){ av_log(VAR_0, AV_LOG_ERROR, "Too many decorrelation VAR_22\n"); VAR_4 += VAR_21; continue; } for(VAR_17 = 0; VAR_17 < VAR_22; VAR_17++) { VAR_23 = (int8_t)(*VAR_4++); s->decorr[s->terms - VAR_17 - 1].weightA = VAR_23 << 3; if(s->decorr[s->terms - VAR_17 - 1].weightA > 0) s->decorr[s->terms - VAR_17 - 1].weightA += (s->decorr[s->terms - VAR_17 - 1].weightA + 64) >> 7; if(s->stereo_in){ VAR_23 = (int8_t)(*VAR_4++); s->decorr[s->terms - VAR_17 - 1].weightB = VAR_23 << 3; if(s->decorr[s->terms - VAR_17 - 1].weightB > 0) s->decorr[s->terms - VAR_17 - 1].weightB += (s->decorr[s->terms - VAR_17 - 1].weightB + 64) >> 7; } } VAR_9 = 1; break; case WP_ID_DECSAMPLES: if(!VAR_8){ av_log(VAR_0, AV_LOG_ERROR, "No decorrelation terms met\n"); continue; } VAR_23 = 0; for(VAR_17 = s->terms - 1; (VAR_17 >= 0) && (VAR_23 < VAR_27); VAR_17--) { if(s->decorr[VAR_17].value > 8){ s->decorr[VAR_17].samplesA[0] = wp_exp2(AV_RL16(VAR_4)); VAR_4 += 2; s->decorr[VAR_17].samplesA[1] = wp_exp2(AV_RL16(VAR_4)); VAR_4 += 2; if(s->stereo_in){ s->decorr[VAR_17].samplesB[0] = wp_exp2(AV_RL16(VAR_4)); VAR_4 += 2; s->decorr[VAR_17].samplesB[1] = wp_exp2(AV_RL16(VAR_4)); VAR_4 += 2; VAR_23 += 4; } VAR_23 += 4; }else if(s->decorr[VAR_17].value < 0){ s->decorr[VAR_17].samplesA[0] = wp_exp2(AV_RL16(VAR_4)); VAR_4 += 2; s->decorr[VAR_17].samplesB[0] = wp_exp2(AV_RL16(VAR_4)); VAR_4 += 2; VAR_23 += 4; }else{ for(VAR_18 = 0; VAR_18 < s->decorr[VAR_17].value; VAR_18++){ s->decorr[VAR_17].samplesA[VAR_18] = wp_exp2(AV_RL16(VAR_4)); VAR_4 += 2; if(s->stereo_in){ s->decorr[VAR_17].samplesB[VAR_18] = wp_exp2(AV_RL16(VAR_4)); VAR_4 += 2; } } VAR_23 += s->decorr[VAR_17].value * 2 * (s->stereo_in + 1); } } VAR_10 = 1; break; case WP_ID_ENTROPY: if(VAR_27 != 6 * (s->stereo_in + 1)){ av_log(VAR_0, AV_LOG_ERROR, "Entropy vars VAR_27 should be %VAR_17, got %VAR_17", 6 * (s->stereo_in + 1), VAR_27); VAR_4 += VAR_21; continue; } for(VAR_18 = 0; VAR_18 <= s->stereo_in; VAR_18++){ for(VAR_17 = 0; VAR_17 < 3; VAR_17++){ s->ch[VAR_18].median[VAR_17] = wp_exp2(AV_RL16(VAR_4)); VAR_4 += 2; } } VAR_11 = 1; break; case WP_ID_HYBRID: if(s->hybrid_bitrate){ for(VAR_17 = 0; VAR_17 <= s->stereo_in; VAR_17++){ s->ch[VAR_17].slow_level = wp_exp2(AV_RL16(VAR_4)); VAR_4 += 2; VAR_27 -= 2; } } for(VAR_17 = 0; VAR_17 < (s->stereo_in + 1); VAR_17++){ s->ch[VAR_17].bitrate_acc = AV_RL16(VAR_4) << 16; VAR_4 += 2; VAR_27 -= 2; } if(VAR_27 > 0){ for(VAR_17 = 0; VAR_17 < (s->stereo_in + 1); VAR_17++){ s->ch[VAR_17].bitrate_delta = wp_exp2((int16_t)AV_RL16(VAR_4)); VAR_4 += 2; } }else{ for(VAR_17 = 0; VAR_17 < (s->stereo_in + 1); VAR_17++) s->ch[VAR_17].bitrate_delta = 0; } VAR_14 = 1; break; case WP_ID_INT32INFO: if(VAR_27 != 4){ av_log(VAR_0, AV_LOG_ERROR, "Invalid INT32INFO, VAR_27 = %VAR_17, sent_bits = %VAR_17\n", VAR_27, *VAR_4); VAR_4 += VAR_21; continue; } if(VAR_4[0]) s->extra_bits = VAR_4[0]; else if(VAR_4[1]) s->shift = VAR_4[1]; else if(VAR_4[2]){ s->and = s->or = 1; s->shift = VAR_4[2]; }else if(VAR_4[3]){ s->and = 1; s->shift = VAR_4[3]; } VAR_4 += 4; break; case WP_ID_FLOATINFO: if(VAR_27 != 4){ av_log(VAR_0, AV_LOG_ERROR, "Invalid FLOATINFO, VAR_27 = %VAR_17\n", VAR_27); VAR_4 += VAR_21; continue; } s->float_flag = VAR_4[0]; s->float_shift = VAR_4[1]; s->float_max_exp = VAR_4[2]; VAR_4 += 4; VAR_13 = 1; break; case WP_ID_DATA: s->sc.offset = VAR_4 - VAR_15; s->sc.VAR_27 = VAR_27 * 8; init_get_bits(&s->gb, VAR_4, VAR_27 * 8); s->VAR_3 = VAR_27 * 8; VAR_4 += VAR_27; VAR_12 = 1; break; case WP_ID_EXTRABITS: if(VAR_27 <= 4){ av_log(VAR_0, AV_LOG_ERROR, "Invalid EXTRABITS, VAR_27 = %VAR_17\n", VAR_27); VAR_4 += VAR_27; continue; } s->extra_sc.offset = VAR_4 - VAR_15; s->extra_sc.VAR_27 = VAR_27 * 8; init_get_bits(&s->gb_extra_bits, VAR_4, VAR_27 * 8); s->crc_extra_bits = get_bits_long(&s->gb_extra_bits, 32); VAR_4 += VAR_27; s->got_extra_bits = 1; break; case WP_ID_CHANINFO: if(VAR_27 <= 1){ av_log(VAR_0, AV_LOG_ERROR, "Insufficient channel information\n"); return -1; } VAR_25 = *VAR_4++; switch(VAR_27 - 2){ case 0: VAR_26 = *VAR_4; break; case 1: VAR_26 = AV_RL16(VAR_4); break; case 2: VAR_26 = AV_RL24(VAR_4); break; case 3: VAR_26 = AV_RL32(VAR_4); break; case 5: VAR_25 |= (VAR_4[1] & 0xF) << 8; VAR_26 = AV_RL24(VAR_4 + 2); break; default: av_log(VAR_0, AV_LOG_ERROR, "Invalid channel info VAR_27 %d\n", VAR_27); VAR_25 = VAR_0->channels; VAR_26 = VAR_0->channel_layout; } if(VAR_25 != VAR_0->channels){ av_log(VAR_0, AV_LOG_ERROR, "Block reports total %d channels, decoder believes it's %d channels\n", VAR_25, VAR_0->channels); return -1; } if(!VAR_0->channel_layout) VAR_0->channel_layout = VAR_26; VAR_4 += VAR_27 - 1; break; default: VAR_4 += VAR_27; } if(VAR_19 & WP_IDF_ODD) VAR_4++; } if(!s->samples_left){ if(!VAR_8){ av_log(VAR_0, AV_LOG_ERROR, "No block with decorrelation terms\n"); return -1; } if(!VAR_9){ av_log(VAR_0, AV_LOG_ERROR, "No block with decorrelation VAR_22\n"); return -1; } if(!VAR_10){ av_log(VAR_0, AV_LOG_ERROR, "No block with decorrelation VAR_6\n"); return -1; } if(!VAR_11){ av_log(VAR_0, AV_LOG_ERROR, "No block with entropy info\n"); return -1; } if(s->hybrid && !VAR_14){ av_log(VAR_0, AV_LOG_ERROR, "Hybrid config not found\n"); return -1; } if(!VAR_12){ av_log(VAR_0, AV_LOG_ERROR, "Packed VAR_6 not found\n"); return -1; } if(!VAR_13 && VAR_0->sample_fmt == AV_SAMPLE_FMT_FLT){ av_log(VAR_0, AV_LOG_ERROR, "Float information not found\n"); return -1; } if(s->got_extra_bits && VAR_0->sample_fmt != AV_SAMPLE_FMT_FLT){ const int VAR_27 = get_bits_left(&s->gb_extra_bits); const int VAR_27 = s->VAR_6 * s->extra_bits << s->stereo_in; if(VAR_27 < VAR_27){ av_log(VAR_0, AV_LOG_ERROR, "Too small EXTRABITS\n"); s->got_extra_bits = 0; } } s->samples_left = s->VAR_6; }else{ init_get_bits(&s->gb, VAR_15 + s->sc.offset, s->sc.VAR_27); skip_bits_long(&s->gb, s->sc.bits_used); if(s->got_extra_bits){ init_get_bits(&s->gb_extra_bits, VAR_15 + s->extra_sc.offset, s->extra_sc.VAR_27); skip_bits_long(&s->gb_extra_bits, s->extra_sc.bits_used); } } if(s->stereo_in){ if(VAR_0->sample_fmt == AV_SAMPLE_FMT_S16) VAR_7 = wv_unpack_stereo(s, &s->gb, VAR_6, AV_SAMPLE_FMT_S16); else if(VAR_0->sample_fmt == AV_SAMPLE_FMT_S32) VAR_7 = wv_unpack_stereo(s, &s->gb, VAR_6, AV_SAMPLE_FMT_S32); else VAR_7 = wv_unpack_stereo(s, &s->gb, VAR_6, AV_SAMPLE_FMT_FLT); VAR_7 >>= 1; }else{ const int VAR_28 = VAR_0->channels; if(VAR_0->sample_fmt == AV_SAMPLE_FMT_S16) VAR_7 = wv_unpack_mono(s, &s->gb, VAR_6, AV_SAMPLE_FMT_S16); else if(VAR_0->sample_fmt == AV_SAMPLE_FMT_S32) VAR_7 = wv_unpack_mono(s, &s->gb, VAR_6, AV_SAMPLE_FMT_S32); else VAR_7 = wv_unpack_mono(s, &s->gb, VAR_6, AV_SAMPLE_FMT_FLT); if(s->stereo && VAR_0->sample_fmt == AV_SAMPLE_FMT_S16){ int16_t *VAR_30 = (int16_t*)VAR_6 + 1; int16_t *VAR_31 = (int16_t*)VAR_6; int VAR_32 = VAR_7; while(VAR_32--){ *VAR_30 = *VAR_31; VAR_31 += VAR_28; VAR_30 += VAR_28; } }else if(s->stereo && VAR_0->sample_fmt == AV_SAMPLE_FMT_S32){ int32_t *VAR_30 = (int32_t*)VAR_6 + 1; int32_t *VAR_31 = (int32_t*)VAR_6; int VAR_32 = VAR_7; while(VAR_32--){ *VAR_30 = *VAR_31; VAR_31 += VAR_28; VAR_30 += VAR_28; } }else if(s->stereo){ float *VAR_30 = (float*)VAR_6 + 1; float *VAR_31 = (float*)VAR_6; int VAR_32 = VAR_7; while(VAR_32--){ *VAR_30 = *VAR_31; VAR_31 += VAR_28; VAR_30 += VAR_28; } } } wc->samples_left = s->samples_left; return VAR_7 * VAR_24; }
[ "static int FUNC_0(AVCodecContext *VAR_0, int VAR_1,\nvoid *VAR_2, int *VAR_3,\nconst uint8_t *VAR_4, int VAR_5)\n{", "WavpackContext *wc = VAR_0->priv_data;", "WavpackFrameContext *s;", "void *VAR_6 = VAR_2;", "int VAR_7;", "int VAR_8 = 0, VAR_9 = 0, VAR_10 = 0, VAR_11 = 0, VAR_12 = 0, VAR_13 = 0;", "int VAR_14 = 0;", "const uint8_t* VAR_15 = VAR_4;", "const uint8_t* VAR_16 = VAR_4 + VAR_5;", "int VAR_17, VAR_18, VAR_19, VAR_27, VAR_21, VAR_22, VAR_23;", "int VAR_24, VAR_25, VAR_26;", "if (VAR_5 == 0){", "*VAR_3 = 0;", "return 0;", "}", "if(VAR_1 >= wc->fdec_num && wv_alloc_frame_context(wc) < 0){", "av_log(VAR_0, AV_LOG_ERROR, \"Error creating frame decode context\\n\");", "return -1;", "}", "s = wc->fdec[VAR_1];", "if(!s){", "av_log(VAR_0, AV_LOG_ERROR, \"Context for block %d is not present\\n\", VAR_1);", "return -1;", "}", "if(!s->samples_left){", "memset(s->decorr, 0, MAX_TERMS * sizeof(Decorr));", "memset(s->ch, 0, sizeof(s->ch));", "s->extra_bits = 0;", "s->and = s->or = s->shift = 0;", "s->got_extra_bits = 0;", "}", "if(!wc->mkv_mode){", "s->VAR_6 = AV_RL32(VAR_4); VAR_4 += 4;", "if(!s->VAR_6){", "*VAR_3 = 0;", "return 0;", "}", "}else{", "s->VAR_6 = wc->VAR_6;", "}", "s->frame_flags = AV_RL32(VAR_4); VAR_4 += 4;", "if(s->frame_flags&0x80){", "VAR_24 = sizeof(float);", "VAR_0->sample_fmt = AV_SAMPLE_FMT_FLT;", "} else if((s->frame_flags&0x03) <= 1){", "VAR_24 = 2;", "VAR_0->sample_fmt = AV_SAMPLE_FMT_S16;", "} else {", "VAR_24 = 4;", "VAR_0->sample_fmt = AV_SAMPLE_FMT_S32;", "}", "VAR_6 = (uint8_t*)VAR_6 + VAR_24 * wc->ch_offset;", "s->stereo = !(s->frame_flags & WV_MONO);", "s->stereo_in = (s->frame_flags & WV_FALSE_STEREO) ? 0 : s->stereo;", "s->joint = s->frame_flags & WV_JOINT_STEREO;", "s->hybrid = s->frame_flags & WV_HYBRID_MODE;", "s->hybrid_bitrate = s->frame_flags & WV_HYBRID_BITRATE;", "s->post_shift = 8 * (VAR_24-1-(s->frame_flags&0x03)) + ((s->frame_flags >> 13) & 0x1f);", "s->CRC = AV_RL32(VAR_4); VAR_4 += 4;", "if(wc->mkv_mode)\nVAR_4 += 4;", "wc->ch_offset += 1 + s->stereo;", "s->max_samples = *VAR_3 / (VAR_24 * VAR_0->channels);", "s->max_samples = FFMIN(s->max_samples, s->VAR_6);", "if(s->samples_left > 0){", "s->max_samples = FFMIN(s->max_samples, s->samples_left);", "VAR_4 = VAR_16;", "}", "while(VAR_4 < VAR_16){", "VAR_19 = *VAR_4++;", "VAR_27 = *VAR_4++;", "if(VAR_19 & WP_IDF_LONG) {", "VAR_27 |= (*VAR_4++) << 8;", "VAR_27 |= (*VAR_4++) << 16;", "}", "VAR_27 <<= 1;", "VAR_21 = VAR_27;", "if(VAR_19 & WP_IDF_ODD) VAR_27--;", "if(VAR_27 < 0){", "av_log(VAR_0, AV_LOG_ERROR, \"Got incorrect block %02X with VAR_27 %VAR_17\\n\", VAR_19, VAR_27);", "break;", "}", "if(VAR_4 + VAR_21 > VAR_16){", "av_log(VAR_0, AV_LOG_ERROR, \"Block VAR_27 %VAR_17 is out of bounds\\n\", VAR_27);", "break;", "}", "if(VAR_19 & WP_IDF_IGNORE){", "VAR_4 += VAR_21;", "continue;", "}", "switch(VAR_19 & WP_IDF_MASK){", "case WP_ID_DECTERMS:\ns->terms = VAR_27;", "if(s->terms > MAX_TERMS){", "av_log(VAR_0, AV_LOG_ERROR, \"Too many decorrelation terms\\n\");", "VAR_4 += VAR_21;", "continue;", "}", "for(VAR_17 = 0; VAR_17 < s->terms; VAR_17++) {", "s->decorr[s->terms - VAR_17 - 1].value = (*VAR_4 & 0x1F) - 5;", "s->decorr[s->terms - VAR_17 - 1].delta = *VAR_4 >> 5;", "VAR_4++;", "}", "VAR_8 = 1;", "break;", "case WP_ID_DECWEIGHTS:\nif(!VAR_8){", "av_log(VAR_0, AV_LOG_ERROR, \"No decorrelation terms met\\n\");", "continue;", "}", "VAR_22 = VAR_27 >> s->stereo_in;", "if(VAR_22 > MAX_TERMS || VAR_22 > s->terms){", "av_log(VAR_0, AV_LOG_ERROR, \"Too many decorrelation VAR_22\\n\");", "VAR_4 += VAR_21;", "continue;", "}", "for(VAR_17 = 0; VAR_17 < VAR_22; VAR_17++) {", "VAR_23 = (int8_t)(*VAR_4++);", "s->decorr[s->terms - VAR_17 - 1].weightA = VAR_23 << 3;", "if(s->decorr[s->terms - VAR_17 - 1].weightA > 0)\ns->decorr[s->terms - VAR_17 - 1].weightA += (s->decorr[s->terms - VAR_17 - 1].weightA + 64) >> 7;", "if(s->stereo_in){", "VAR_23 = (int8_t)(*VAR_4++);", "s->decorr[s->terms - VAR_17 - 1].weightB = VAR_23 << 3;", "if(s->decorr[s->terms - VAR_17 - 1].weightB > 0)\ns->decorr[s->terms - VAR_17 - 1].weightB += (s->decorr[s->terms - VAR_17 - 1].weightB + 64) >> 7;", "}", "}", "VAR_9 = 1;", "break;", "case WP_ID_DECSAMPLES:\nif(!VAR_8){", "av_log(VAR_0, AV_LOG_ERROR, \"No decorrelation terms met\\n\");", "continue;", "}", "VAR_23 = 0;", "for(VAR_17 = s->terms - 1; (VAR_17 >= 0) && (VAR_23 < VAR_27); VAR_17--) {", "if(s->decorr[VAR_17].value > 8){", "s->decorr[VAR_17].samplesA[0] = wp_exp2(AV_RL16(VAR_4)); VAR_4 += 2;", "s->decorr[VAR_17].samplesA[1] = wp_exp2(AV_RL16(VAR_4)); VAR_4 += 2;", "if(s->stereo_in){", "s->decorr[VAR_17].samplesB[0] = wp_exp2(AV_RL16(VAR_4)); VAR_4 += 2;", "s->decorr[VAR_17].samplesB[1] = wp_exp2(AV_RL16(VAR_4)); VAR_4 += 2;", "VAR_23 += 4;", "}", "VAR_23 += 4;", "}else if(s->decorr[VAR_17].value < 0){", "s->decorr[VAR_17].samplesA[0] = wp_exp2(AV_RL16(VAR_4)); VAR_4 += 2;", "s->decorr[VAR_17].samplesB[0] = wp_exp2(AV_RL16(VAR_4)); VAR_4 += 2;", "VAR_23 += 4;", "}else{", "for(VAR_18 = 0; VAR_18 < s->decorr[VAR_17].value; VAR_18++){", "s->decorr[VAR_17].samplesA[VAR_18] = wp_exp2(AV_RL16(VAR_4)); VAR_4 += 2;", "if(s->stereo_in){", "s->decorr[VAR_17].samplesB[VAR_18] = wp_exp2(AV_RL16(VAR_4)); VAR_4 += 2;", "}", "}", "VAR_23 += s->decorr[VAR_17].value * 2 * (s->stereo_in + 1);", "}", "}", "VAR_10 = 1;", "break;", "case WP_ID_ENTROPY:\nif(VAR_27 != 6 * (s->stereo_in + 1)){", "av_log(VAR_0, AV_LOG_ERROR, \"Entropy vars VAR_27 should be %VAR_17, got %VAR_17\", 6 * (s->stereo_in + 1), VAR_27);", "VAR_4 += VAR_21;", "continue;", "}", "for(VAR_18 = 0; VAR_18 <= s->stereo_in; VAR_18++){", "for(VAR_17 = 0; VAR_17 < 3; VAR_17++){", "s->ch[VAR_18].median[VAR_17] = wp_exp2(AV_RL16(VAR_4));", "VAR_4 += 2;", "}", "}", "VAR_11 = 1;", "break;", "case WP_ID_HYBRID:\nif(s->hybrid_bitrate){", "for(VAR_17 = 0; VAR_17 <= s->stereo_in; VAR_17++){", "s->ch[VAR_17].slow_level = wp_exp2(AV_RL16(VAR_4));", "VAR_4 += 2;", "VAR_27 -= 2;", "}", "}", "for(VAR_17 = 0; VAR_17 < (s->stereo_in + 1); VAR_17++){", "s->ch[VAR_17].bitrate_acc = AV_RL16(VAR_4) << 16;", "VAR_4 += 2;", "VAR_27 -= 2;", "}", "if(VAR_27 > 0){", "for(VAR_17 = 0; VAR_17 < (s->stereo_in + 1); VAR_17++){", "s->ch[VAR_17].bitrate_delta = wp_exp2((int16_t)AV_RL16(VAR_4));", "VAR_4 += 2;", "}", "}else{", "for(VAR_17 = 0; VAR_17 < (s->stereo_in + 1); VAR_17++)", "s->ch[VAR_17].bitrate_delta = 0;", "}", "VAR_14 = 1;", "break;", "case WP_ID_INT32INFO:\nif(VAR_27 != 4){", "av_log(VAR_0, AV_LOG_ERROR, \"Invalid INT32INFO, VAR_27 = %VAR_17, sent_bits = %VAR_17\\n\", VAR_27, *VAR_4);", "VAR_4 += VAR_21;", "continue;", "}", "if(VAR_4[0])\ns->extra_bits = VAR_4[0];", "else if(VAR_4[1])\ns->shift = VAR_4[1];", "else if(VAR_4[2]){", "s->and = s->or = 1;", "s->shift = VAR_4[2];", "}else if(VAR_4[3]){", "s->and = 1;", "s->shift = VAR_4[3];", "}", "VAR_4 += 4;", "break;", "case WP_ID_FLOATINFO:\nif(VAR_27 != 4){", "av_log(VAR_0, AV_LOG_ERROR, \"Invalid FLOATINFO, VAR_27 = %VAR_17\\n\", VAR_27);", "VAR_4 += VAR_21;", "continue;", "}", "s->float_flag = VAR_4[0];", "s->float_shift = VAR_4[1];", "s->float_max_exp = VAR_4[2];", "VAR_4 += 4;", "VAR_13 = 1;", "break;", "case WP_ID_DATA:\ns->sc.offset = VAR_4 - VAR_15;", "s->sc.VAR_27 = VAR_27 * 8;", "init_get_bits(&s->gb, VAR_4, VAR_27 * 8);", "s->VAR_3 = VAR_27 * 8;", "VAR_4 += VAR_27;", "VAR_12 = 1;", "break;", "case WP_ID_EXTRABITS:\nif(VAR_27 <= 4){", "av_log(VAR_0, AV_LOG_ERROR, \"Invalid EXTRABITS, VAR_27 = %VAR_17\\n\", VAR_27);", "VAR_4 += VAR_27;", "continue;", "}", "s->extra_sc.offset = VAR_4 - VAR_15;", "s->extra_sc.VAR_27 = VAR_27 * 8;", "init_get_bits(&s->gb_extra_bits, VAR_4, VAR_27 * 8);", "s->crc_extra_bits = get_bits_long(&s->gb_extra_bits, 32);", "VAR_4 += VAR_27;", "s->got_extra_bits = 1;", "break;", "case WP_ID_CHANINFO:\nif(VAR_27 <= 1){", "av_log(VAR_0, AV_LOG_ERROR, \"Insufficient channel information\\n\");", "return -1;", "}", "VAR_25 = *VAR_4++;", "switch(VAR_27 - 2){", "case 0:\nVAR_26 = *VAR_4;", "break;", "case 1:\nVAR_26 = AV_RL16(VAR_4);", "break;", "case 2:\nVAR_26 = AV_RL24(VAR_4);", "break;", "case 3:\nVAR_26 = AV_RL32(VAR_4);", "break;", "case 5:\nVAR_25 |= (VAR_4[1] & 0xF) << 8;", "VAR_26 = AV_RL24(VAR_4 + 2);", "break;", "default:\nav_log(VAR_0, AV_LOG_ERROR, \"Invalid channel info VAR_27 %d\\n\", VAR_27);", "VAR_25 = VAR_0->channels;", "VAR_26 = VAR_0->channel_layout;", "}", "if(VAR_25 != VAR_0->channels){", "av_log(VAR_0, AV_LOG_ERROR, \"Block reports total %d channels, decoder believes it's %d channels\\n\",\nVAR_25, VAR_0->channels);", "return -1;", "}", "if(!VAR_0->channel_layout)\nVAR_0->channel_layout = VAR_26;", "VAR_4 += VAR_27 - 1;", "break;", "default:\nVAR_4 += VAR_27;", "}", "if(VAR_19 & WP_IDF_ODD) VAR_4++;", "}", "if(!s->samples_left){", "if(!VAR_8){", "av_log(VAR_0, AV_LOG_ERROR, \"No block with decorrelation terms\\n\");", "return -1;", "}", "if(!VAR_9){", "av_log(VAR_0, AV_LOG_ERROR, \"No block with decorrelation VAR_22\\n\");", "return -1;", "}", "if(!VAR_10){", "av_log(VAR_0, AV_LOG_ERROR, \"No block with decorrelation VAR_6\\n\");", "return -1;", "}", "if(!VAR_11){", "av_log(VAR_0, AV_LOG_ERROR, \"No block with entropy info\\n\");", "return -1;", "}", "if(s->hybrid && !VAR_14){", "av_log(VAR_0, AV_LOG_ERROR, \"Hybrid config not found\\n\");", "return -1;", "}", "if(!VAR_12){", "av_log(VAR_0, AV_LOG_ERROR, \"Packed VAR_6 not found\\n\");", "return -1;", "}", "if(!VAR_13 && VAR_0->sample_fmt == AV_SAMPLE_FMT_FLT){", "av_log(VAR_0, AV_LOG_ERROR, \"Float information not found\\n\");", "return -1;", "}", "if(s->got_extra_bits && VAR_0->sample_fmt != AV_SAMPLE_FMT_FLT){", "const int VAR_27 = get_bits_left(&s->gb_extra_bits);", "const int VAR_27 = s->VAR_6 * s->extra_bits << s->stereo_in;", "if(VAR_27 < VAR_27){", "av_log(VAR_0, AV_LOG_ERROR, \"Too small EXTRABITS\\n\");", "s->got_extra_bits = 0;", "}", "}", "s->samples_left = s->VAR_6;", "}else{", "init_get_bits(&s->gb, VAR_15 + s->sc.offset, s->sc.VAR_27);", "skip_bits_long(&s->gb, s->sc.bits_used);", "if(s->got_extra_bits){", "init_get_bits(&s->gb_extra_bits, VAR_15 + s->extra_sc.offset,\ns->extra_sc.VAR_27);", "skip_bits_long(&s->gb_extra_bits, s->extra_sc.bits_used);", "}", "}", "if(s->stereo_in){", "if(VAR_0->sample_fmt == AV_SAMPLE_FMT_S16)\nVAR_7 = wv_unpack_stereo(s, &s->gb, VAR_6, AV_SAMPLE_FMT_S16);", "else if(VAR_0->sample_fmt == AV_SAMPLE_FMT_S32)\nVAR_7 = wv_unpack_stereo(s, &s->gb, VAR_6, AV_SAMPLE_FMT_S32);", "else\nVAR_7 = wv_unpack_stereo(s, &s->gb, VAR_6, AV_SAMPLE_FMT_FLT);", "VAR_7 >>= 1;", "}else{", "const int VAR_28 = VAR_0->channels;", "if(VAR_0->sample_fmt == AV_SAMPLE_FMT_S16)\nVAR_7 = wv_unpack_mono(s, &s->gb, VAR_6, AV_SAMPLE_FMT_S16);", "else if(VAR_0->sample_fmt == AV_SAMPLE_FMT_S32)\nVAR_7 = wv_unpack_mono(s, &s->gb, VAR_6, AV_SAMPLE_FMT_S32);", "else\nVAR_7 = wv_unpack_mono(s, &s->gb, VAR_6, AV_SAMPLE_FMT_FLT);", "if(s->stereo && VAR_0->sample_fmt == AV_SAMPLE_FMT_S16){", "int16_t *VAR_30 = (int16_t*)VAR_6 + 1;", "int16_t *VAR_31 = (int16_t*)VAR_6;", "int VAR_32 = VAR_7;", "while(VAR_32--){", "*VAR_30 = *VAR_31;", "VAR_31 += VAR_28;", "VAR_30 += VAR_28;", "}", "}else if(s->stereo && VAR_0->sample_fmt == AV_SAMPLE_FMT_S32){", "int32_t *VAR_30 = (int32_t*)VAR_6 + 1;", "int32_t *VAR_31 = (int32_t*)VAR_6;", "int VAR_32 = VAR_7;", "while(VAR_32--){", "*VAR_30 = *VAR_31;", "VAR_31 += VAR_28;", "VAR_30 += VAR_28;", "}", "}else if(s->stereo){", "float *VAR_30 = (float*)VAR_6 + 1;", "float *VAR_31 = (float*)VAR_6;", "int VAR_32 = VAR_7;", "while(VAR_32--){", "*VAR_30 = *VAR_31;", "VAR_31 += VAR_28;", "VAR_30 += VAR_28;", "}", "}", "}", "wc->samples_left = s->samples_left;", "return VAR_7 * VAR_24;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137, 139 ], [ 143 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 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, 289 ], [ 291 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305 ], [ 307 ], [ 309 ], [ 311 ], [ 313 ], [ 315 ], [ 317 ], [ 319 ], [ 321 ], [ 323 ], [ 325 ], [ 327 ], [ 329 ], [ 331 ], [ 333 ], [ 335 ], [ 337 ], [ 339 ], [ 341 ], [ 343 ], [ 345 ], [ 347 ], [ 349 ], [ 351, 353 ], [ 355 ], [ 357 ], [ 359 ], [ 361 ], [ 363 ], [ 365 ], [ 367 ], [ 369 ], [ 371 ], [ 373 ], [ 375 ], [ 377 ], [ 379, 381 ], [ 383 ], [ 385 ], [ 387 ], [ 389 ], [ 391 ], [ 393 ], [ 395 ], [ 397 ], [ 399 ], [ 401 ], [ 403 ], [ 405 ], [ 407 ], [ 409 ], [ 411 ], [ 413 ], [ 415 ], [ 417 ], [ 419 ], [ 421 ], [ 423 ], [ 425 ], [ 427, 429 ], [ 431 ], [ 433 ], [ 435 ], [ 437 ], [ 439, 441 ], [ 443, 445 ], [ 447 ], [ 449 ], [ 451 ], [ 453 ], [ 455 ], [ 457 ], [ 459 ], [ 461 ], [ 463 ], [ 465, 467 ], [ 469 ], [ 471 ], [ 473 ], [ 475 ], [ 477 ], [ 479 ], [ 481 ], [ 483 ], [ 485 ], [ 487 ], [ 489, 491 ], [ 493 ], [ 495 ], [ 497 ], [ 499 ], [ 501 ], [ 503 ], [ 505, 507 ], [ 509 ], [ 511 ], [ 513 ], [ 515 ], [ 517 ], [ 519 ], [ 521 ], [ 523 ], [ 525 ], [ 527 ], [ 529 ], [ 531, 533 ], [ 535 ], [ 537 ], [ 539 ], [ 541 ], [ 543 ], [ 545, 547 ], [ 549 ], [ 551, 553 ], [ 555 ], [ 557, 559 ], [ 561 ], [ 563, 565 ], [ 567 ], [ 569, 571 ], [ 573 ], [ 575 ], [ 577, 579 ], [ 581 ], [ 583 ], [ 585 ], [ 587 ], [ 589, 591 ], [ 593 ], [ 595 ], [ 597, 599 ], [ 601 ], [ 603 ], [ 605, 607 ], [ 609 ], [ 611 ], [ 613 ], [ 615 ], [ 617 ], [ 619 ], [ 621 ], [ 623 ], [ 625 ], [ 627 ], [ 629 ], [ 631 ], [ 633 ], [ 635 ], [ 637 ], [ 639 ], [ 641 ], [ 643 ], [ 645 ], [ 647 ], [ 649 ], [ 651 ], [ 653 ], [ 655 ], [ 657 ], [ 659 ], [ 661 ], [ 663 ], [ 665 ], [ 667 ], [ 669 ], [ 671 ], [ 673 ], [ 675 ], [ 677 ], [ 679 ], [ 681 ], [ 683 ], [ 685 ], [ 687 ], [ 689 ], [ 691 ], [ 693 ], [ 695 ], [ 697 ], [ 699, 701 ], [ 703 ], [ 705 ], [ 707 ], [ 711 ], [ 713, 715 ], [ 717, 719 ], [ 721, 723 ], [ 725 ], [ 727 ], [ 729 ], [ 733, 735 ], [ 737, 739 ], [ 741, 743 ], [ 747 ], [ 749 ], [ 751 ], [ 753 ], [ 755 ], [ 757 ], [ 759 ], [ 761 ], [ 763 ], [ 765 ], [ 767 ], [ 769 ], [ 771 ], [ 773 ], [ 775 ], [ 777 ], [ 779 ], [ 781 ], [ 783 ], [ 785 ], [ 787 ], [ 789 ], [ 791 ], [ 793 ], [ 795 ], [ 797 ], [ 799 ], [ 801 ], [ 803 ], [ 807 ], [ 811 ], [ 813 ] ]
12,077
void qemu_send_packet(VLANClientState *vc, const uint8_t *buf, int size) { VLANState *vlan = vc->vlan; VLANPacket *packet; if (vc->link_down) return; #ifdef DEBUG_NET printf("vlan %d send:\n", vlan->id); hex_dump(stdout, buf, size); #endif if (vlan->delivering) { packet = qemu_malloc(sizeof(VLANPacket) + size); packet->next = vlan->send_queue; packet->sender = vc; packet->size = size; memcpy(packet->data, buf, size); vlan->send_queue = packet; } else { vlan->delivering = 1; qemu_deliver_packet(vc, buf, size); while ((packet = vlan->send_queue) != NULL) { qemu_deliver_packet(packet->sender, packet->data, packet->size); vlan->send_queue = packet->next; qemu_free(packet); } vlan->delivering = 0; } }
true
qemu
c27ff60871aff588a35e51d1a90faed410993e55
void qemu_send_packet(VLANClientState *vc, const uint8_t *buf, int size) { VLANState *vlan = vc->vlan; VLANPacket *packet; if (vc->link_down) return; #ifdef DEBUG_NET printf("vlan %d send:\n", vlan->id); hex_dump(stdout, buf, size); #endif if (vlan->delivering) { packet = qemu_malloc(sizeof(VLANPacket) + size); packet->next = vlan->send_queue; packet->sender = vc; packet->size = size; memcpy(packet->data, buf, size); vlan->send_queue = packet; } else { vlan->delivering = 1; qemu_deliver_packet(vc, buf, size); while ((packet = vlan->send_queue) != NULL) { qemu_deliver_packet(packet->sender, packet->data, packet->size); vlan->send_queue = packet->next; qemu_free(packet); } vlan->delivering = 0; } }
{ "code": [ " qemu_deliver_packet(packet->sender, packet->data, packet->size);" ], "line_no": [ 47 ] }
void FUNC_0(VLANClientState *VAR_0, const uint8_t *VAR_1, int VAR_2) { VLANState *vlan = VAR_0->vlan; VLANPacket *packet; if (VAR_0->link_down) return; #ifdef DEBUG_NET printf("vlan %d send:\n", vlan->id); hex_dump(stdout, VAR_1, VAR_2); #endif if (vlan->delivering) { packet = qemu_malloc(sizeof(VLANPacket) + VAR_2); packet->next = vlan->send_queue; packet->sender = VAR_0; packet->VAR_2 = VAR_2; memcpy(packet->data, VAR_1, VAR_2); vlan->send_queue = packet; } else { vlan->delivering = 1; qemu_deliver_packet(VAR_0, VAR_1, VAR_2); while ((packet = vlan->send_queue) != NULL) { qemu_deliver_packet(packet->sender, packet->data, packet->VAR_2); vlan->send_queue = packet->next; qemu_free(packet); } vlan->delivering = 0; } }
[ "void FUNC_0(VLANClientState *VAR_0, const uint8_t *VAR_1, int VAR_2)\n{", "VLANState *vlan = VAR_0->vlan;", "VLANPacket *packet;", "if (VAR_0->link_down)\nreturn;", "#ifdef DEBUG_NET\nprintf(\"vlan %d send:\\n\", vlan->id);", "hex_dump(stdout, VAR_1, VAR_2);", "#endif\nif (vlan->delivering) {", "packet = qemu_malloc(sizeof(VLANPacket) + VAR_2);", "packet->next = vlan->send_queue;", "packet->sender = VAR_0;", "packet->VAR_2 = VAR_2;", "memcpy(packet->data, VAR_1, VAR_2);", "vlan->send_queue = packet;", "} else {", "vlan->delivering = 1;", "qemu_deliver_packet(VAR_0, VAR_1, VAR_2);", "while ((packet = vlan->send_queue) != NULL) {", "qemu_deliver_packet(packet->sender, packet->data, packet->VAR_2);", "vlan->send_queue = packet->next;", "qemu_free(packet);", "}", "vlan->delivering = 0;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11, 13 ], [ 17, 19 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ] ]
12,078
static void test_bmdma_one_sector_short_prdt(void) { QPCIDevice *dev; void *bmdma_base, *ide_base; uint8_t status; /* Read 2 sectors but only give 1 sector in PRDT */ PrdtEntry prdt[] = { { .addr = 0, .size = cpu_to_le32(0x200 | PRDT_EOT), }, }; dev = get_pci_device(&bmdma_base, &ide_base); /* Normal request */ status = send_dma_request(CMD_READ_DMA, 0, 2, prdt, ARRAY_SIZE(prdt), NULL); g_assert_cmphex(status, ==, 0); assert_bit_clear(qpci_io_readb(dev, ide_base + reg_status), DF | ERR); /* Abort the request before it completes */ status = send_dma_request(CMD_READ_DMA | CMDF_ABORT, 0, 2, prdt, ARRAY_SIZE(prdt), NULL); g_assert_cmphex(status, ==, 0); assert_bit_clear(qpci_io_readb(dev, ide_base + reg_status), DF | ERR); }
true
qemu
b4ba67d9a702507793c2724e56f98e9b0f7be02b
static void test_bmdma_one_sector_short_prdt(void) { QPCIDevice *dev; void *bmdma_base, *ide_base; uint8_t status; PrdtEntry prdt[] = { { .addr = 0, .size = cpu_to_le32(0x200 | PRDT_EOT), }, }; dev = get_pci_device(&bmdma_base, &ide_base); status = send_dma_request(CMD_READ_DMA, 0, 2, prdt, ARRAY_SIZE(prdt), NULL); g_assert_cmphex(status, ==, 0); assert_bit_clear(qpci_io_readb(dev, ide_base + reg_status), DF | ERR); status = send_dma_request(CMD_READ_DMA | CMDF_ABORT, 0, 2, prdt, ARRAY_SIZE(prdt), NULL); g_assert_cmphex(status, ==, 0); assert_bit_clear(qpci_io_readb(dev, ide_base + reg_status), DF | ERR); }
{ "code": [ " dev = get_pci_device(&bmdma_base, &ide_base);", " void *bmdma_base, *ide_base;", " dev = get_pci_device(&bmdma_base, &ide_base);", " assert_bit_clear(qpci_io_readb(dev, ide_base + reg_status), DF | ERR);", " assert_bit_clear(qpci_io_readb(dev, ide_base + reg_status), DF | ERR);", " assert_bit_clear(qpci_io_readb(dev, ide_base + reg_status), DF | ERR);", " assert_bit_clear(qpci_io_readb(dev, ide_base + reg_status), DF | ERR);", " void *bmdma_base, *ide_base;", " dev = get_pci_device(&bmdma_base, &ide_base);", " assert_bit_clear(qpci_io_readb(dev, ide_base + reg_status), DF | ERR);", " assert_bit_clear(qpci_io_readb(dev, ide_base + reg_status), DF | ERR);", " void *bmdma_base, *ide_base;", " dev = get_pci_device(&bmdma_base, &ide_base);", " assert_bit_clear(qpci_io_readb(dev, ide_base + reg_status), DF | ERR);", " assert_bit_clear(qpci_io_readb(dev, ide_base + reg_status), DF | ERR);", " void *bmdma_base, *ide_base;", " dev = get_pci_device(&bmdma_base, &ide_base);", " assert_bit_clear(qpci_io_readb(dev, ide_base + reg_status), DF | ERR);", " assert_bit_clear(qpci_io_readb(dev, ide_base + reg_status), DF | ERR);", " void *bmdma_base, *ide_base;", " dev = get_pci_device(&bmdma_base, &ide_base);", " assert_bit_clear(qpci_io_readb(dev, ide_base + reg_status), DF | ERR);", " void *bmdma_base, *ide_base;", " dev = get_pci_device(&bmdma_base, &ide_base);", " void *bmdma_base, *ide_base;", " dev = get_pci_device(&bmdma_base, &ide_base);", " assert_bit_clear(qpci_io_readb(dev, ide_base + reg_status), DF | ERR);", " void *bmdma_base, *ide_base;", " dev = get_pci_device(&bmdma_base, &ide_base);", " void *bmdma_base, *ide_base;", " dev = get_pci_device(&bmdma_base, &ide_base);", " void *bmdma_base, *ide_base;", " dev = get_pci_device(&bmdma_base, &ide_base);", " void *bmdma_base, *ide_base;", " dev = get_pci_device(&bmdma_base, &ide_base);", " void *bmdma_base, *ide_base;", " dev = get_pci_device(&bmdma_base, &ide_base);" ], "line_no": [ 29, 7, 29, 41, 41, 41, 41, 7, 29, 41, 41, 7, 29, 41, 41, 7, 29, 41, 41, 7, 29, 41, 7, 29, 7, 29, 41, 7, 29, 7, 29, 7, 29, 7, 29, 7, 29 ] }
static void FUNC_0(void) { QPCIDevice *dev; void *VAR_0, *VAR_1; uint8_t status; PrdtEntry prdt[] = { { .addr = 0, .size = cpu_to_le32(0x200 | PRDT_EOT), }, }; dev = get_pci_device(&VAR_0, &VAR_1); status = send_dma_request(CMD_READ_DMA, 0, 2, prdt, ARRAY_SIZE(prdt), NULL); g_assert_cmphex(status, ==, 0); assert_bit_clear(qpci_io_readb(dev, VAR_1 + reg_status), DF | ERR); status = send_dma_request(CMD_READ_DMA | CMDF_ABORT, 0, 2, prdt, ARRAY_SIZE(prdt), NULL); g_assert_cmphex(status, ==, 0); assert_bit_clear(qpci_io_readb(dev, VAR_1 + reg_status), DF | ERR); }
[ "static void FUNC_0(void)\n{", "QPCIDevice *dev;", "void *VAR_0, *VAR_1;", "uint8_t status;", "PrdtEntry prdt[] = {", "{", ".addr = 0,\n.size = cpu_to_le32(0x200 | PRDT_EOT),\n},", "};", "dev = get_pci_device(&VAR_0, &VAR_1);", "status = send_dma_request(CMD_READ_DMA, 0, 2,\nprdt, ARRAY_SIZE(prdt), NULL);", "g_assert_cmphex(status, ==, 0);", "assert_bit_clear(qpci_io_readb(dev, VAR_1 + reg_status), DF | ERR);", "status = send_dma_request(CMD_READ_DMA | CMDF_ABORT, 0, 2,\nprdt, ARRAY_SIZE(prdt), NULL);", "g_assert_cmphex(status, ==, 0);", "assert_bit_clear(qpci_io_readb(dev, VAR_1 + reg_status), DF | ERR);", "}" ]
[ 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 15 ], [ 17 ], [ 19, 21, 23 ], [ 25 ], [ 29 ], [ 35, 37 ], [ 39 ], [ 41 ], [ 47, 49 ], [ 51 ], [ 53 ], [ 55 ] ]
12,080
static uint32_t regtype_to_ss(uint8_t type) { if (type & PCI_BASE_ADDRESS_MEM_TYPE_64) { return 3; } if (type == PCI_BASE_ADDRESS_SPACE_IO) { return 1; } return 2; }
true
qemu
4d8d5467cd6e324fb49ae97b9d5dcee3973d9a19
static uint32_t regtype_to_ss(uint8_t type) { if (type & PCI_BASE_ADDRESS_MEM_TYPE_64) { return 3; } if (type == PCI_BASE_ADDRESS_SPACE_IO) { return 1; } return 2; }
{ "code": [ "static uint32_t regtype_to_ss(uint8_t type)", " if (type & PCI_BASE_ADDRESS_MEM_TYPE_64) {", " return 3;", " if (type == PCI_BASE_ADDRESS_SPACE_IO) {", " return 1;", " return 2;" ], "line_no": [ 1, 5, 7, 11, 13, 17 ] }
static uint32_t FUNC_0(uint8_t type) { if (type & PCI_BASE_ADDRESS_MEM_TYPE_64) { return 3; } if (type == PCI_BASE_ADDRESS_SPACE_IO) { return 1; } return 2; }
[ "static uint32_t FUNC_0(uint8_t type)\n{", "if (type & PCI_BASE_ADDRESS_MEM_TYPE_64) {", "return 3;", "}", "if (type == PCI_BASE_ADDRESS_SPACE_IO) {", "return 1;", "}", "return 2;", "}" ]
[ 1, 1, 1, 0, 1, 1, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ] ]
12,081
static int swf_read_header(AVFormatContext *s, AVFormatParameters *ap) { ByteIOContext *pb = &s->pb; int nbits, len, frame_rate, tag, v; AVStream *st; if ((get_be32(pb) & 0xffffff00) != MKBETAG('F', 'W', 'S', 0)) return -EIO; get_le32(pb); /* skip rectangle size */ nbits = get_byte(pb) >> 3; len = (4 * nbits - 3 + 7) / 8; url_fskip(pb, len); frame_rate = get_le16(pb); get_le16(pb); /* frame count */ for(;;) { tag = get_swf_tag(pb, &len); if (tag < 0) { fprintf(stderr, "No streaming found in SWF\n"); return -EIO; } if (tag == TAG_STREAMHEAD) { /* streaming found */ get_byte(pb); v = get_byte(pb); get_le16(pb); if (len!=4) url_fskip(pb,len-4); /* if mp3 streaming found, OK */ if ((v & 0x20) != 0) { st = av_new_stream(s, 0); if (!st) return -ENOMEM; if (v & 0x01) st->codec.channels = 2; else st->codec.channels = 1; switch((v>> 2) & 0x03) { case 1: st->codec.sample_rate = 11025; break; case 2: st->codec.sample_rate = 22050; break; case 3: st->codec.sample_rate = 44100; break; default: av_free(st); return -EIO; } st->codec.codec_type = CODEC_TYPE_AUDIO; st->codec.codec_id = CODEC_ID_MP2; break; } } else { url_fskip(pb, len); } } return 0; }
true
FFmpeg
747a0554ea8ad09404c1f5b80239ebd8d71b291e
static int swf_read_header(AVFormatContext *s, AVFormatParameters *ap) { ByteIOContext *pb = &s->pb; int nbits, len, frame_rate, tag, v; AVStream *st; if ((get_be32(pb) & 0xffffff00) != MKBETAG('F', 'W', 'S', 0)) return -EIO; get_le32(pb); nbits = get_byte(pb) >> 3; len = (4 * nbits - 3 + 7) / 8; url_fskip(pb, len); frame_rate = get_le16(pb); get_le16(pb); for(;;) { tag = get_swf_tag(pb, &len); if (tag < 0) { fprintf(stderr, "No streaming found in SWF\n"); return -EIO; } if (tag == TAG_STREAMHEAD) { get_byte(pb); v = get_byte(pb); get_le16(pb); if (len!=4) url_fskip(pb,len-4); if ((v & 0x20) != 0) { st = av_new_stream(s, 0); if (!st) return -ENOMEM; if (v & 0x01) st->codec.channels = 2; else st->codec.channels = 1; switch((v>> 2) & 0x03) { case 1: st->codec.sample_rate = 11025; break; case 2: st->codec.sample_rate = 22050; break; case 3: st->codec.sample_rate = 44100; break; default: av_free(st); return -EIO; } st->codec.codec_type = CODEC_TYPE_AUDIO; st->codec.codec_id = CODEC_ID_MP2; break; } } else { url_fskip(pb, len); } } return 0; }
{ "code": [ " ByteIOContext *pb = &s->pb;", " AVStream *st;", " fprintf(stderr, \"No streaming found in SWF\\n\");", " if (tag == TAG_STREAMHEAD) {", " get_le16(pb);", " st = av_new_stream(s, 0);", " if (!st)", " st->codec.channels = 2;", " st->codec.channels = 1;", " st->codec.sample_rate = 11025;", " st->codec.sample_rate = 22050;", " st->codec.sample_rate = 44100;", " av_free(st);", " st->codec.codec_type = CODEC_TYPE_AUDIO;", " st->codec.codec_id = CODEC_ID_MP2;", " break;" ], "line_no": [ 5, 9, 39, 45, 53, 63, 65, 73, 77, 85, 91, 97, 103, 109, 111, 113 ] }
static int FUNC_0(AVFormatContext *VAR_0, AVFormatParameters *VAR_1) { ByteIOContext *pb = &VAR_0->pb; int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6; AVStream *st; if ((get_be32(pb) & 0xffffff00) != MKBETAG('F', 'W', 'S', 0)) return -EIO; get_le32(pb); VAR_2 = get_byte(pb) >> 3; VAR_3 = (4 * VAR_2 - 3 + 7) / 8; url_fskip(pb, VAR_3); VAR_4 = get_le16(pb); get_le16(pb); for(;;) { VAR_5 = get_swf_tag(pb, &VAR_3); if (VAR_5 < 0) { fprintf(stderr, "No streaming found in SWF\n"); return -EIO; } if (VAR_5 == TAG_STREAMHEAD) { get_byte(pb); VAR_6 = get_byte(pb); get_le16(pb); if (VAR_3!=4) url_fskip(pb,VAR_3-4); if ((VAR_6 & 0x20) != 0) { st = av_new_stream(VAR_0, 0); if (!st) return -ENOMEM; if (VAR_6 & 0x01) st->codec.channels = 2; else st->codec.channels = 1; switch((VAR_6>> 2) & 0x03) { case 1: st->codec.sample_rate = 11025; break; case 2: st->codec.sample_rate = 22050; break; case 3: st->codec.sample_rate = 44100; break; default: av_free(st); return -EIO; } st->codec.codec_type = CODEC_TYPE_AUDIO; st->codec.codec_id = CODEC_ID_MP2; break; } } else { url_fskip(pb, VAR_3); } } return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0, AVFormatParameters *VAR_1)\n{", "ByteIOContext *pb = &VAR_0->pb;", "int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6;", "AVStream *st;", "if ((get_be32(pb) & 0xffffff00) != MKBETAG('F', 'W', 'S', 0))\nreturn -EIO;", "get_le32(pb);", "VAR_2 = get_byte(pb) >> 3;", "VAR_3 = (4 * VAR_2 - 3 + 7) / 8;", "url_fskip(pb, VAR_3);", "VAR_4 = get_le16(pb);", "get_le16(pb);", "for(;;) {", "VAR_5 = get_swf_tag(pb, &VAR_3);", "if (VAR_5 < 0) {", "fprintf(stderr, \"No streaming found in SWF\\n\");", "return -EIO;", "}", "if (VAR_5 == TAG_STREAMHEAD) {", "get_byte(pb);", "VAR_6 = get_byte(pb);", "get_le16(pb);", "if (VAR_3!=4)\nurl_fskip(pb,VAR_3-4);", "if ((VAR_6 & 0x20) != 0) {", "st = av_new_stream(VAR_0, 0);", "if (!st)\nreturn -ENOMEM;", "if (VAR_6 & 0x01)\nst->codec.channels = 2;", "else\nst->codec.channels = 1;", "switch((VAR_6>> 2) & 0x03) {", "case 1:\nst->codec.sample_rate = 11025;", "break;", "case 2:\nst->codec.sample_rate = 22050;", "break;", "case 3:\nst->codec.sample_rate = 44100;", "break;", "default:\nav_free(st);", "return -EIO;", "}", "st->codec.codec_type = CODEC_TYPE_AUDIO;", "st->codec.codec_id = CODEC_ID_MP2;", "break;", "}", "} else {", "url_fskip(pb, VAR_3);", "}", "}", "return 0;", "}" ]
[ 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13, 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55, 57 ], [ 61 ], [ 63 ], [ 65, 67 ], [ 71, 73 ], [ 75, 77 ], [ 81 ], [ 83, 85 ], [ 87 ], [ 89, 91 ], [ 93 ], [ 95, 97 ], [ 99 ], [ 101, 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 127 ], [ 129 ] ]