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
14,937
static void qemu_laio_process_completion(struct qemu_laiocb *laiocb) { int ret; ret = laiocb->ret; if (ret != -ECANCELED) { if (ret == laiocb->nbytes) { ret = 0; } else if (ret >= 0) { /* Short reads mean EOF, pad with zeros. */ if (laiocb->is_read) { qemu_iovec_memset(laiocb->qiov, ret, 0, laiocb->qiov->size - ret); } else { ret = -ENOSPC; } } } laiocb->ret = ret; if (laiocb->co) { qemu_coroutine_enter(laiocb->co); } else { laiocb->common.cb(laiocb->common.opaque, ret); qemu_aio_unref(laiocb); } }
false
qemu
0ed93d84edabc7656f5c998ae1a346fe8b94ca54
static void qemu_laio_process_completion(struct qemu_laiocb *laiocb) { int ret; ret = laiocb->ret; if (ret != -ECANCELED) { if (ret == laiocb->nbytes) { ret = 0; } else if (ret >= 0) { if (laiocb->is_read) { qemu_iovec_memset(laiocb->qiov, ret, 0, laiocb->qiov->size - ret); } else { ret = -ENOSPC; } } } laiocb->ret = ret; if (laiocb->co) { qemu_coroutine_enter(laiocb->co); } else { laiocb->common.cb(laiocb->common.opaque, ret); qemu_aio_unref(laiocb); } }
{ "code": [], "line_no": [] }
static void FUNC_0(struct qemu_laiocb *VAR_0) { int VAR_1; VAR_1 = VAR_0->VAR_1; if (VAR_1 != -ECANCELED) { if (VAR_1 == VAR_0->nbytes) { VAR_1 = 0; } else if (VAR_1 >= 0) { if (VAR_0->is_read) { qemu_iovec_memset(VAR_0->qiov, VAR_1, 0, VAR_0->qiov->size - VAR_1); } else { VAR_1 = -ENOSPC; } } } VAR_0->VAR_1 = VAR_1; if (VAR_0->co) { qemu_coroutine_enter(VAR_0->co); } else { VAR_0->common.cb(VAR_0->common.opaque, VAR_1); qemu_aio_unref(VAR_0); } }
[ "static void FUNC_0(struct qemu_laiocb *VAR_0)\n{", "int VAR_1;", "VAR_1 = VAR_0->VAR_1;", "if (VAR_1 != -ECANCELED) {", "if (VAR_1 == VAR_0->nbytes) {", "VAR_1 = 0;", "} else if (VAR_1 >= 0) {", "if (VAR_0->is_read) {", "qemu_iovec_memset(VAR_0->qiov, VAR_1, 0,\nVAR_0->qiov->size - VAR_1);", "} else {", "VAR_1 = -ENOSPC;", "}", "}", "}", "VAR_0->VAR_1 = VAR_1;", "if (VAR_0->co) {", "qemu_coroutine_enter(VAR_0->co);", "} else {", "VAR_0->common.cb(VAR_0->common.opaque, VAR_1);", "qemu_aio_unref(VAR_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 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ] ]
14,938
static void aio_epoll_disable(AioContext *ctx) { ctx->epoll_available = false; if (!ctx->epoll_enabled) { return; } ctx->epoll_enabled = false; close(ctx->epollfd); }
false
qemu
c2b38b277a7882a592f4f2ec955084b2b756daaa
static void aio_epoll_disable(AioContext *ctx) { ctx->epoll_available = false; if (!ctx->epoll_enabled) { return; } ctx->epoll_enabled = false; close(ctx->epollfd); }
{ "code": [], "line_no": [] }
static void FUNC_0(AioContext *VAR_0) { VAR_0->epoll_available = false; if (!VAR_0->epoll_enabled) { return; } VAR_0->epoll_enabled = false; close(VAR_0->epollfd); }
[ "static void FUNC_0(AioContext *VAR_0)\n{", "VAR_0->epoll_available = false;", "if (!VAR_0->epoll_enabled) {", "return;", "}", "VAR_0->epoll_enabled = false;", "close(VAR_0->epollfd);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ] ]
14,940
static void pc_machine_initfn(Object *obj) { PCMachineState *pcms = PC_MACHINE(obj); object_property_add(obj, PC_MACHINE_MEMHP_REGION_SIZE, "int", pc_machine_get_hotplug_memory_region_size, NULL, NULL, NULL, &error_abort); pcms->max_ram_below_4g = 0xe0000000; /* 3.5G */ object_property_add(obj, PC_MACHINE_MAX_RAM_BELOW_4G, "size", pc_machine_get_max_ram_below_4g, pc_machine_set_max_ram_below_4g, NULL, NULL, &error_abort); object_property_set_description(obj, PC_MACHINE_MAX_RAM_BELOW_4G, "Maximum ram below the 4G boundary (32bit boundary)", &error_abort); pcms->smm = ON_OFF_AUTO_AUTO; object_property_add(obj, PC_MACHINE_SMM, "OnOffAuto", pc_machine_get_smm, pc_machine_set_smm, NULL, NULL, &error_abort); object_property_set_description(obj, PC_MACHINE_SMM, "Enable SMM (pc & q35)", &error_abort); pcms->vmport = ON_OFF_AUTO_AUTO; object_property_add(obj, PC_MACHINE_VMPORT, "OnOffAuto", pc_machine_get_vmport, pc_machine_set_vmport, NULL, NULL, &error_abort); object_property_set_description(obj, PC_MACHINE_VMPORT, "Enable vmport (pc & q35)", &error_abort); /* nvdimm is disabled on default. */ pcms->acpi_nvdimm_state.is_enabled = false; object_property_add_bool(obj, PC_MACHINE_NVDIMM, pc_machine_get_nvdimm, pc_machine_set_nvdimm, &error_abort); }
false
qemu
5ec7d09818881b87052c41259e5cb781683977d2
static void pc_machine_initfn(Object *obj) { PCMachineState *pcms = PC_MACHINE(obj); object_property_add(obj, PC_MACHINE_MEMHP_REGION_SIZE, "int", pc_machine_get_hotplug_memory_region_size, NULL, NULL, NULL, &error_abort); pcms->max_ram_below_4g = 0xe0000000; object_property_add(obj, PC_MACHINE_MAX_RAM_BELOW_4G, "size", pc_machine_get_max_ram_below_4g, pc_machine_set_max_ram_below_4g, NULL, NULL, &error_abort); object_property_set_description(obj, PC_MACHINE_MAX_RAM_BELOW_4G, "Maximum ram below the 4G boundary (32bit boundary)", &error_abort); pcms->smm = ON_OFF_AUTO_AUTO; object_property_add(obj, PC_MACHINE_SMM, "OnOffAuto", pc_machine_get_smm, pc_machine_set_smm, NULL, NULL, &error_abort); object_property_set_description(obj, PC_MACHINE_SMM, "Enable SMM (pc & q35)", &error_abort); pcms->vmport = ON_OFF_AUTO_AUTO; object_property_add(obj, PC_MACHINE_VMPORT, "OnOffAuto", pc_machine_get_vmport, pc_machine_set_vmport, NULL, NULL, &error_abort); object_property_set_description(obj, PC_MACHINE_VMPORT, "Enable vmport (pc & q35)", &error_abort); pcms->acpi_nvdimm_state.is_enabled = false; object_property_add_bool(obj, PC_MACHINE_NVDIMM, pc_machine_get_nvdimm, pc_machine_set_nvdimm, &error_abort); }
{ "code": [], "line_no": [] }
static void FUNC_0(Object *VAR_0) { PCMachineState *pcms = PC_MACHINE(VAR_0); object_property_add(VAR_0, PC_MACHINE_MEMHP_REGION_SIZE, "int", pc_machine_get_hotplug_memory_region_size, NULL, NULL, NULL, &error_abort); pcms->max_ram_below_4g = 0xe0000000; object_property_add(VAR_0, PC_MACHINE_MAX_RAM_BELOW_4G, "size", pc_machine_get_max_ram_below_4g, pc_machine_set_max_ram_below_4g, NULL, NULL, &error_abort); object_property_set_description(VAR_0, PC_MACHINE_MAX_RAM_BELOW_4G, "Maximum ram below the 4G boundary (32bit boundary)", &error_abort); pcms->smm = ON_OFF_AUTO_AUTO; object_property_add(VAR_0, PC_MACHINE_SMM, "OnOffAuto", pc_machine_get_smm, pc_machine_set_smm, NULL, NULL, &error_abort); object_property_set_description(VAR_0, PC_MACHINE_SMM, "Enable SMM (pc & q35)", &error_abort); pcms->vmport = ON_OFF_AUTO_AUTO; object_property_add(VAR_0, PC_MACHINE_VMPORT, "OnOffAuto", pc_machine_get_vmport, pc_machine_set_vmport, NULL, NULL, &error_abort); object_property_set_description(VAR_0, PC_MACHINE_VMPORT, "Enable vmport (pc & q35)", &error_abort); pcms->acpi_nvdimm_state.is_enabled = false; object_property_add_bool(VAR_0, PC_MACHINE_NVDIMM, pc_machine_get_nvdimm, pc_machine_set_nvdimm, &error_abort); }
[ "static void FUNC_0(Object *VAR_0)\n{", "PCMachineState *pcms = PC_MACHINE(VAR_0);", "object_property_add(VAR_0, PC_MACHINE_MEMHP_REGION_SIZE, \"int\",\npc_machine_get_hotplug_memory_region_size,\nNULL, NULL, NULL, &error_abort);", "pcms->max_ram_below_4g = 0xe0000000;", "object_property_add(VAR_0, PC_MACHINE_MAX_RAM_BELOW_4G, \"size\",\npc_machine_get_max_ram_below_4g,\npc_machine_set_max_ram_below_4g,\nNULL, NULL, &error_abort);", "object_property_set_description(VAR_0, PC_MACHINE_MAX_RAM_BELOW_4G,\n\"Maximum ram below the 4G boundary (32bit boundary)\",\n&error_abort);", "pcms->smm = ON_OFF_AUTO_AUTO;", "object_property_add(VAR_0, PC_MACHINE_SMM, \"OnOffAuto\",\npc_machine_get_smm,\npc_machine_set_smm,\nNULL, NULL, &error_abort);", "object_property_set_description(VAR_0, PC_MACHINE_SMM,\n\"Enable SMM (pc & q35)\",\n&error_abort);", "pcms->vmport = ON_OFF_AUTO_AUTO;", "object_property_add(VAR_0, PC_MACHINE_VMPORT, \"OnOffAuto\",\npc_machine_get_vmport,\npc_machine_set_vmport,\nNULL, NULL, &error_abort);", "object_property_set_description(VAR_0, PC_MACHINE_VMPORT,\n\"Enable vmport (pc & q35)\",\n&error_abort);", "pcms->acpi_nvdimm_state.is_enabled = false;", "object_property_add_bool(VAR_0, PC_MACHINE_NVDIMM, pc_machine_get_nvdimm,\npc_machine_set_nvdimm, &error_abort);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11, 13 ], [ 17 ], [ 19, 21, 23, 25 ], [ 27, 29, 31 ], [ 35 ], [ 37, 39, 41, 43 ], [ 45, 47, 49 ], [ 53 ], [ 55, 57, 59, 61 ], [ 63, 65, 67 ], [ 73 ], [ 75, 77 ], [ 79 ] ]
14,941
static unsigned int dec_move_rs(DisasContext *dc) { DIS(fprintf (logfile, "move $r%u, $s%u\n", dc->op1, dc->op2)); cris_cc_mask(dc, 0); tcg_gen_helper_0_2(helper_movl_sreg_reg, tcg_const_tl(dc->op2), tcg_const_tl(dc->op1)); return 2; }
false
qemu
a7812ae412311d7d47f8aa85656faadac9d64b56
static unsigned int dec_move_rs(DisasContext *dc) { DIS(fprintf (logfile, "move $r%u, $s%u\n", dc->op1, dc->op2)); cris_cc_mask(dc, 0); tcg_gen_helper_0_2(helper_movl_sreg_reg, tcg_const_tl(dc->op2), tcg_const_tl(dc->op1)); return 2; }
{ "code": [], "line_no": [] }
static unsigned int FUNC_0(DisasContext *VAR_0) { DIS(fprintf (logfile, "move $r%u, $s%u\n", VAR_0->op1, VAR_0->op2)); cris_cc_mask(VAR_0, 0); tcg_gen_helper_0_2(helper_movl_sreg_reg, tcg_const_tl(VAR_0->op2), tcg_const_tl(VAR_0->op1)); return 2; }
[ "static unsigned int FUNC_0(DisasContext *VAR_0)\n{", "DIS(fprintf (logfile, \"move $r%u, $s%u\\n\", VAR_0->op1, VAR_0->op2));", "cris_cc_mask(VAR_0, 0);", "tcg_gen_helper_0_2(helper_movl_sreg_reg,\ntcg_const_tl(VAR_0->op2), tcg_const_tl(VAR_0->op1));", "return 2;", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9, 11 ], [ 13 ], [ 15 ] ]
14,944
int ff_qsv_encode(AVCodecContext *avctx, QSVEncContext *q, AVPacket *pkt, const AVFrame *frame, int *got_packet) { mfxBitstream bs = { { { 0 } } }; mfxFrameSurface1 *surf = NULL; mfxSyncPoint sync = NULL; int ret; if (frame) { ret = submit_frame(q, frame, &surf); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, "Error submitting the frame for encoding.\n"); return ret; } } ret = ff_alloc_packet(pkt, q->packet_size); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, "Error allocating the output packet\n"); return ret; } bs.Data = pkt->data; bs.MaxLength = pkt->size; do { ret = MFXVideoENCODE_EncodeFrameAsync(q->session, NULL, surf, &bs, &sync); if (ret == MFX_WRN_DEVICE_BUSY) av_usleep(1); } while (ret > 0); if (ret < 0) return (ret == MFX_ERR_MORE_DATA) ? 0 : ff_qsv_error(ret); if (ret == MFX_WRN_INCOMPATIBLE_VIDEO_PARAM && frame->interlaced_frame) print_interlace_msg(avctx, q); if (sync) { MFXVideoCORE_SyncOperation(q->session, sync, 60000); if (bs.FrameType & MFX_FRAMETYPE_I || bs.FrameType & MFX_FRAMETYPE_xI) avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; else if (bs.FrameType & MFX_FRAMETYPE_P || bs.FrameType & MFX_FRAMETYPE_xP) avctx->coded_frame->pict_type = AV_PICTURE_TYPE_P; else if (bs.FrameType & MFX_FRAMETYPE_B || bs.FrameType & MFX_FRAMETYPE_xB) avctx->coded_frame->pict_type = AV_PICTURE_TYPE_B; pkt->dts = av_rescale_q(bs.DecodeTimeStamp, (AVRational){1, 90000}, avctx->time_base); pkt->pts = av_rescale_q(bs.TimeStamp, (AVRational){1, 90000}, avctx->time_base); pkt->size = bs.DataLength; if (bs.FrameType & MFX_FRAMETYPE_IDR || bs.FrameType & MFX_FRAMETYPE_xIDR) pkt->flags |= AV_PKT_FLAG_KEY; *got_packet = 1; } return 0; }
true
FFmpeg
b409748bc4412fa2d8e642585c4e5ab8a4d136cb
int ff_qsv_encode(AVCodecContext *avctx, QSVEncContext *q, AVPacket *pkt, const AVFrame *frame, int *got_packet) { mfxBitstream bs = { { { 0 } } }; mfxFrameSurface1 *surf = NULL; mfxSyncPoint sync = NULL; int ret; if (frame) { ret = submit_frame(q, frame, &surf); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, "Error submitting the frame for encoding.\n"); return ret; } } ret = ff_alloc_packet(pkt, q->packet_size); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, "Error allocating the output packet\n"); return ret; } bs.Data = pkt->data; bs.MaxLength = pkt->size; do { ret = MFXVideoENCODE_EncodeFrameAsync(q->session, NULL, surf, &bs, &sync); if (ret == MFX_WRN_DEVICE_BUSY) av_usleep(1); } while (ret > 0); if (ret < 0) return (ret == MFX_ERR_MORE_DATA) ? 0 : ff_qsv_error(ret); if (ret == MFX_WRN_INCOMPATIBLE_VIDEO_PARAM && frame->interlaced_frame) print_interlace_msg(avctx, q); if (sync) { MFXVideoCORE_SyncOperation(q->session, sync, 60000); if (bs.FrameType & MFX_FRAMETYPE_I || bs.FrameType & MFX_FRAMETYPE_xI) avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; else if (bs.FrameType & MFX_FRAMETYPE_P || bs.FrameType & MFX_FRAMETYPE_xP) avctx->coded_frame->pict_type = AV_PICTURE_TYPE_P; else if (bs.FrameType & MFX_FRAMETYPE_B || bs.FrameType & MFX_FRAMETYPE_xB) avctx->coded_frame->pict_type = AV_PICTURE_TYPE_B; pkt->dts = av_rescale_q(bs.DecodeTimeStamp, (AVRational){1, 90000}, avctx->time_base); pkt->pts = av_rescale_q(bs.TimeStamp, (AVRational){1, 90000}, avctx->time_base); pkt->size = bs.DataLength; if (bs.FrameType & MFX_FRAMETYPE_IDR || bs.FrameType & MFX_FRAMETYPE_xIDR) pkt->flags |= AV_PKT_FLAG_KEY; *got_packet = 1; } return 0; }
{ "code": [ " if (ret == MFX_WRN_DEVICE_BUSY)", " } while (ret > 0);" ], "line_no": [ 55, 59 ] }
int FUNC_0(AVCodecContext *VAR_0, QSVEncContext *VAR_1, AVPacket *VAR_2, const AVFrame *VAR_3, int *VAR_4) { mfxBitstream bs = { { { 0 } } }; mfxFrameSurface1 *surf = NULL; mfxSyncPoint sync = NULL; int VAR_5; if (VAR_3) { VAR_5 = submit_frame(VAR_1, VAR_3, &surf); if (VAR_5 < 0) { av_log(VAR_0, AV_LOG_ERROR, "Error submitting the VAR_3 for encoding.\n"); return VAR_5; } } VAR_5 = ff_alloc_packet(VAR_2, VAR_1->packet_size); if (VAR_5 < 0) { av_log(VAR_0, AV_LOG_ERROR, "Error allocating the output packet\n"); return VAR_5; } bs.Data = VAR_2->data; bs.MaxLength = VAR_2->size; do { VAR_5 = MFXVideoENCODE_EncodeFrameAsync(VAR_1->session, NULL, surf, &bs, &sync); if (VAR_5 == MFX_WRN_DEVICE_BUSY) av_usleep(1); } while (VAR_5 > 0); if (VAR_5 < 0) return (VAR_5 == MFX_ERR_MORE_DATA) ? 0 : ff_qsv_error(VAR_5); if (VAR_5 == MFX_WRN_INCOMPATIBLE_VIDEO_PARAM && VAR_3->interlaced_frame) print_interlace_msg(VAR_0, VAR_1); if (sync) { MFXVideoCORE_SyncOperation(VAR_1->session, sync, 60000); if (bs.FrameType & MFX_FRAMETYPE_I || bs.FrameType & MFX_FRAMETYPE_xI) VAR_0->coded_frame->pict_type = AV_PICTURE_TYPE_I; else if (bs.FrameType & MFX_FRAMETYPE_P || bs.FrameType & MFX_FRAMETYPE_xP) VAR_0->coded_frame->pict_type = AV_PICTURE_TYPE_P; else if (bs.FrameType & MFX_FRAMETYPE_B || bs.FrameType & MFX_FRAMETYPE_xB) VAR_0->coded_frame->pict_type = AV_PICTURE_TYPE_B; VAR_2->dts = av_rescale_q(bs.DecodeTimeStamp, (AVRational){1, 90000}, VAR_0->time_base); VAR_2->pts = av_rescale_q(bs.TimeStamp, (AVRational){1, 90000}, VAR_0->time_base); VAR_2->size = bs.DataLength; if (bs.FrameType & MFX_FRAMETYPE_IDR || bs.FrameType & MFX_FRAMETYPE_xIDR) VAR_2->flags |= AV_PKT_FLAG_KEY; *VAR_4 = 1; } return 0; }
[ "int FUNC_0(AVCodecContext *VAR_0, QSVEncContext *VAR_1,\nAVPacket *VAR_2, const AVFrame *VAR_3, int *VAR_4)\n{", "mfxBitstream bs = { { { 0 } } };", "mfxFrameSurface1 *surf = NULL;", "mfxSyncPoint sync = NULL;", "int VAR_5;", "if (VAR_3) {", "VAR_5 = submit_frame(VAR_1, VAR_3, &surf);", "if (VAR_5 < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"Error submitting the VAR_3 for encoding.\\n\");", "return VAR_5;", "}", "}", "VAR_5 = ff_alloc_packet(VAR_2, VAR_1->packet_size);", "if (VAR_5 < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"Error allocating the output packet\\n\");", "return VAR_5;", "}", "bs.Data = VAR_2->data;", "bs.MaxLength = VAR_2->size;", "do {", "VAR_5 = MFXVideoENCODE_EncodeFrameAsync(VAR_1->session, NULL, surf, &bs, &sync);", "if (VAR_5 == MFX_WRN_DEVICE_BUSY)\nav_usleep(1);", "} while (VAR_5 > 0);", "if (VAR_5 < 0)\nreturn (VAR_5 == MFX_ERR_MORE_DATA) ? 0 : ff_qsv_error(VAR_5);", "if (VAR_5 == MFX_WRN_INCOMPATIBLE_VIDEO_PARAM && VAR_3->interlaced_frame)\nprint_interlace_msg(VAR_0, VAR_1);", "if (sync) {", "MFXVideoCORE_SyncOperation(VAR_1->session, sync, 60000);", "if (bs.FrameType & MFX_FRAMETYPE_I || bs.FrameType & MFX_FRAMETYPE_xI)\nVAR_0->coded_frame->pict_type = AV_PICTURE_TYPE_I;", "else if (bs.FrameType & MFX_FRAMETYPE_P || bs.FrameType & MFX_FRAMETYPE_xP)\nVAR_0->coded_frame->pict_type = AV_PICTURE_TYPE_P;", "else if (bs.FrameType & MFX_FRAMETYPE_B || bs.FrameType & MFX_FRAMETYPE_xB)\nVAR_0->coded_frame->pict_type = AV_PICTURE_TYPE_B;", "VAR_2->dts = av_rescale_q(bs.DecodeTimeStamp, (AVRational){1, 90000}, VAR_0->time_base);", "VAR_2->pts = av_rescale_q(bs.TimeStamp, (AVRational){1, 90000}, VAR_0->time_base);", "VAR_2->size = bs.DataLength;", "if (bs.FrameType & MFX_FRAMETYPE_IDR ||\nbs.FrameType & MFX_FRAMETYPE_xIDR)\nVAR_2->flags |= AV_PKT_FLAG_KEY;", "*VAR_4 = 1;", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55, 57 ], [ 59 ], [ 63, 65 ], [ 69, 71 ], [ 75 ], [ 77 ], [ 81, 83 ], [ 85, 87 ], [ 89, 91 ], [ 95 ], [ 97 ], [ 99 ], [ 103, 105, 107 ], [ 111 ], [ 113 ], [ 117 ], [ 119 ] ]
14,945
static void nvram_writeb (void *opaque, target_phys_addr_t addr, uint32_t value) { ds1225y_t *NVRAM = opaque; int64_t pos; pos = addr - NVRAM->mem_base; if (ds1225y_set_to_mode(NVRAM, writemode, "wb")) { qemu_fseek(NVRAM->file, pos, SEEK_SET); qemu_put_byte(NVRAM->file, (int)value); } }
true
qemu
30aa5c0d303c334c646e9db1ebadda0c0db8b13f
static void nvram_writeb (void *opaque, target_phys_addr_t addr, uint32_t value) { ds1225y_t *NVRAM = opaque; int64_t pos; pos = addr - NVRAM->mem_base; if (ds1225y_set_to_mode(NVRAM, writemode, "wb")) { qemu_fseek(NVRAM->file, pos, SEEK_SET); qemu_put_byte(NVRAM->file, (int)value); } }
{ "code": [ " ds1225y_t *NVRAM = opaque;\r", " int64_t pos;\r", " pos = addr - NVRAM->mem_base;\r", "static void nvram_writeb (void *opaque, target_phys_addr_t addr, uint32_t value)\r", " ds1225y_t *NVRAM = opaque;\r", " int64_t pos;\r", " pos = addr - NVRAM->mem_base;\r", " if (ds1225y_set_to_mode(NVRAM, writemode, \"wb\"))\r", " qemu_fseek(NVRAM->file, pos, SEEK_SET);\r", " qemu_put_byte(NVRAM->file, (int)value);\r" ], "line_no": [ 5, 7, 11, 1, 5, 7, 11, 13, 17, 19 ] }
static void FUNC_0 (void *VAR_0, target_phys_addr_t VAR_1, uint32_t VAR_2) { ds1225y_t *NVRAM = VAR_0; int64_t pos; pos = VAR_1 - NVRAM->mem_base; if (ds1225y_set_to_mode(NVRAM, writemode, "wb")) { qemu_fseek(NVRAM->file, pos, SEEK_SET); qemu_put_byte(NVRAM->file, (int)VAR_2); } }
[ "static void FUNC_0 (void *VAR_0, target_phys_addr_t VAR_1, uint32_t VAR_2)\n{", "ds1225y_t *NVRAM = VAR_0;", "int64_t pos;", "pos = VAR_1 - NVRAM->mem_base;", "if (ds1225y_set_to_mode(NVRAM, writemode, \"wb\"))\n{", "qemu_fseek(NVRAM->file, pos, SEEK_SET);", "qemu_put_byte(NVRAM->file, (int)VAR_2);", "}", "}" ]
[ 1, 1, 1, 1, 1, 1, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ] ]
14,946
static av_cold int xvid_encode_close(AVCodecContext *avctx) { struct xvid_context *x = avctx->priv_data; xvid_encore(x->encoder_handle, XVID_ENC_DESTROY, NULL, NULL); if( avctx->extradata != NULL ) av_free(avctx->extradata); if( x->twopassbuffer != NULL ) { av_free(x->twopassbuffer); av_free(x->old_twopassbuffer); } if( x->twopassfile != NULL ) av_free(x->twopassfile); if( x->intra_matrix != NULL ) av_free(x->intra_matrix); if( x->inter_matrix != NULL ) av_free(x->inter_matrix); return 0; }
true
FFmpeg
e644db613a8fe008c996ca642800f8ccd90e613f
static av_cold int xvid_encode_close(AVCodecContext *avctx) { struct xvid_context *x = avctx->priv_data; xvid_encore(x->encoder_handle, XVID_ENC_DESTROY, NULL, NULL); if( avctx->extradata != NULL ) av_free(avctx->extradata); if( x->twopassbuffer != NULL ) { av_free(x->twopassbuffer); av_free(x->old_twopassbuffer); } if( x->twopassfile != NULL ) av_free(x->twopassfile); if( x->intra_matrix != NULL ) av_free(x->intra_matrix); if( x->inter_matrix != NULL ) av_free(x->inter_matrix); return 0; }
{ "code": [ " av_free(avctx->extradata);" ], "line_no": [ 13 ] }
static av_cold int FUNC_0(AVCodecContext *avctx) { struct xvid_context *VAR_0 = avctx->priv_data; xvid_encore(VAR_0->encoder_handle, XVID_ENC_DESTROY, NULL, NULL); if( avctx->extradata != NULL ) av_free(avctx->extradata); if( VAR_0->twopassbuffer != NULL ) { av_free(VAR_0->twopassbuffer); av_free(VAR_0->old_twopassbuffer); } if( VAR_0->twopassfile != NULL ) av_free(VAR_0->twopassfile); if( VAR_0->intra_matrix != NULL ) av_free(VAR_0->intra_matrix); if( VAR_0->inter_matrix != NULL ) av_free(VAR_0->inter_matrix); return 0; }
[ "static av_cold int FUNC_0(AVCodecContext *avctx) {", "struct xvid_context *VAR_0 = avctx->priv_data;", "xvid_encore(VAR_0->encoder_handle, XVID_ENC_DESTROY, NULL, NULL);", "if( avctx->extradata != NULL )\nav_free(avctx->extradata);", "if( VAR_0->twopassbuffer != NULL ) {", "av_free(VAR_0->twopassbuffer);", "av_free(VAR_0->old_twopassbuffer);", "}", "if( VAR_0->twopassfile != NULL )\nav_free(VAR_0->twopassfile);", "if( VAR_0->intra_matrix != NULL )\nav_free(VAR_0->intra_matrix);", "if( VAR_0->inter_matrix != NULL )\nav_free(VAR_0->inter_matrix);", "return 0;", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 7 ], [ 11, 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23, 25 ], [ 27, 29 ], [ 31, 33 ], [ 37 ], [ 39 ] ]
14,948
int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options) { int ret = 0; AVDictionary *tmp = NULL; if (avcodec_is_open(avctx)) return 0; if ((!codec && !avctx->codec)) { av_log(avctx, AV_LOG_ERROR, "No codec provided to avcodec_open2()\n"); return AVERROR(EINVAL); } if ((codec && avctx->codec && codec != avctx->codec)) { av_log(avctx, AV_LOG_ERROR, "This AVCodecContext was allocated for %s, " "but %s passed to avcodec_open2()\n", avctx->codec->name, codec->name); return AVERROR(EINVAL); } if (!codec) codec = avctx->codec; if (avctx->extradata_size < 0 || avctx->extradata_size >= FF_MAX_EXTRADATA_SIZE) return AVERROR(EINVAL); if (options) av_dict_copy(&tmp, *options, 0); ret = ff_lock_avcodec(avctx); if (ret < 0) return ret; avctx->internal = av_mallocz(sizeof(AVCodecInternal)); if (!avctx->internal) { ret = AVERROR(ENOMEM); goto end; } avctx->internal->pool = av_mallocz(sizeof(*avctx->internal->pool)); if (!avctx->internal->pool) { ret = AVERROR(ENOMEM); goto free_and_end; } if (codec->priv_data_size > 0) { if (!avctx->priv_data) { avctx->priv_data = av_mallocz(codec->priv_data_size); if (!avctx->priv_data) { ret = AVERROR(ENOMEM); goto end; } if (codec->priv_class) { *(const AVClass **)avctx->priv_data = codec->priv_class; av_opt_set_defaults(avctx->priv_data); } } if (codec->priv_class && (ret = av_opt_set_dict(avctx->priv_data, &tmp)) < 0) goto free_and_end; } else { avctx->priv_data = NULL; } if ((ret = av_opt_set_dict(avctx, &tmp)) < 0) goto free_and_end; //We only call avcodec_set_dimensions() for non h264 codecs so as not to overwrite previously setup dimensions if (!( avctx->coded_width && avctx->coded_height && avctx->width && avctx->height && avctx->codec_id == AV_CODEC_ID_H264)){ if (avctx->coded_width && avctx->coded_height) avcodec_set_dimensions(avctx, avctx->coded_width, avctx->coded_height); else if (avctx->width && avctx->height) avcodec_set_dimensions(avctx, avctx->width, avctx->height); } if ((avctx->coded_width || avctx->coded_height || avctx->width || avctx->height) && ( av_image_check_size(avctx->coded_width, avctx->coded_height, 0, avctx) < 0 || av_image_check_size(avctx->width, avctx->height, 0, avctx) < 0)) { av_log(avctx, AV_LOG_WARNING, "Ignoring invalid width/height values\n"); avcodec_set_dimensions(avctx, 0, 0); } /* if the decoder init function was already called previously, * free the already allocated subtitle_header before overwriting it */ if (av_codec_is_decoder(codec)) av_freep(&avctx->subtitle_header); if (avctx->channels > FF_SANE_NB_CHANNELS) { ret = AVERROR(EINVAL); goto free_and_end; } avctx->codec = codec; if ((avctx->codec_type == AVMEDIA_TYPE_UNKNOWN || avctx->codec_type == codec->type) && avctx->codec_id == AV_CODEC_ID_NONE) { avctx->codec_type = codec->type; avctx->codec_id = codec->id; } if (avctx->codec_id != codec->id || (avctx->codec_type != codec->type && avctx->codec_type != AVMEDIA_TYPE_ATTACHMENT)) { av_log(avctx, AV_LOG_ERROR, "Codec type or id mismatches\n"); ret = AVERROR(EINVAL); goto free_and_end; } avctx->frame_number = 0; avctx->codec_descriptor = avcodec_descriptor_get(avctx->codec_id); if (avctx->codec->capabilities & CODEC_CAP_EXPERIMENTAL && avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) { const char *codec_string = av_codec_is_encoder(codec) ? "encoder" : "decoder"; AVCodec *codec2; av_log(NULL, AV_LOG_ERROR, "The %s '%s' is experimental but experimental codecs are not enabled, " "add '-strict %d' if you want to use it.\n", codec_string, codec->name, FF_COMPLIANCE_EXPERIMENTAL); codec2 = av_codec_is_encoder(codec) ? avcodec_find_encoder(codec->id) : avcodec_find_decoder(codec->id); if (!(codec2->capabilities & CODEC_CAP_EXPERIMENTAL)) av_log(NULL, AV_LOG_ERROR, "Alternatively use the non experimental %s '%s'.\n", codec_string, codec2->name); ret = AVERROR_EXPERIMENTAL; goto free_and_end; } if (avctx->codec_type == AVMEDIA_TYPE_AUDIO && (!avctx->time_base.num || !avctx->time_base.den)) { avctx->time_base.num = 1; avctx->time_base.den = avctx->sample_rate; } if (!HAVE_THREADS) av_log(avctx, AV_LOG_WARNING, "Warning: not compiled with thread support, using thread emulation\n"); if (HAVE_THREADS) { ff_unlock_avcodec(); //we will instanciate a few encoders thus kick the counter to prevent false detection of a problem ret = ff_frame_thread_encoder_init(avctx, options ? *options : NULL); ff_lock_avcodec(avctx); if (ret < 0) goto free_and_end; } if (HAVE_THREADS && !avctx->thread_opaque && !(avctx->internal->frame_thread_encoder && (avctx->active_thread_type&FF_THREAD_FRAME))) { ret = ff_thread_init(avctx); if (ret < 0) { goto free_and_end; } } if (!HAVE_THREADS && !(codec->capabilities & CODEC_CAP_AUTO_THREADS)) avctx->thread_count = 1; if (avctx->codec->max_lowres < avctx->lowres || avctx->lowres < 0) { av_log(avctx, AV_LOG_ERROR, "The maximum value for lowres supported by the decoder is %d\n", avctx->codec->max_lowres); ret = AVERROR(EINVAL); goto free_and_end; } if (av_codec_is_encoder(avctx->codec)) { int i; if (avctx->codec->sample_fmts) { for (i = 0; avctx->codec->sample_fmts[i] != AV_SAMPLE_FMT_NONE; i++) { if (avctx->sample_fmt == avctx->codec->sample_fmts[i]) break; if (avctx->channels == 1 && av_get_planar_sample_fmt(avctx->sample_fmt) == av_get_planar_sample_fmt(avctx->codec->sample_fmts[i])) { avctx->sample_fmt = avctx->codec->sample_fmts[i]; break; } } if (avctx->codec->sample_fmts[i] == AV_SAMPLE_FMT_NONE) { char buf[128]; snprintf(buf, sizeof(buf), "%d", avctx->sample_fmt); av_log(avctx, AV_LOG_ERROR, "Specified sample format %s is invalid or not supported\n", (char *)av_x_if_null(av_get_sample_fmt_name(avctx->sample_fmt), buf)); ret = AVERROR(EINVAL); goto free_and_end; } } if (avctx->codec->pix_fmts) { for (i = 0; avctx->codec->pix_fmts[i] != AV_PIX_FMT_NONE; i++) if (avctx->pix_fmt == avctx->codec->pix_fmts[i]) break; if (avctx->codec->pix_fmts[i] == AV_PIX_FMT_NONE && !((avctx->codec_id == AV_CODEC_ID_MJPEG || avctx->codec_id == AV_CODEC_ID_LJPEG) && avctx->strict_std_compliance <= FF_COMPLIANCE_UNOFFICIAL)) { char buf[128]; snprintf(buf, sizeof(buf), "%d", avctx->pix_fmt); av_log(avctx, AV_LOG_ERROR, "Specified pixel format %s is invalid or not supported\n", (char *)av_x_if_null(av_get_pix_fmt_name(avctx->pix_fmt), buf)); ret = AVERROR(EINVAL); goto free_and_end; } } if (avctx->codec->supported_samplerates) { for (i = 0; avctx->codec->supported_samplerates[i] != 0; i++) if (avctx->sample_rate == avctx->codec->supported_samplerates[i]) break; if (avctx->codec->supported_samplerates[i] == 0) { av_log(avctx, AV_LOG_ERROR, "Specified sample rate %d is not supported\n", avctx->sample_rate); ret = AVERROR(EINVAL); goto free_and_end; } } if (avctx->codec->channel_layouts) { if (!avctx->channel_layout) { av_log(avctx, AV_LOG_WARNING, "Channel layout not specified\n"); } else { for (i = 0; avctx->codec->channel_layouts[i] != 0; i++) if (avctx->channel_layout == avctx->codec->channel_layouts[i]) break; if (avctx->codec->channel_layouts[i] == 0) { char buf[512]; av_get_channel_layout_string(buf, sizeof(buf), -1, avctx->channel_layout); av_log(avctx, AV_LOG_ERROR, "Specified channel layout '%s' is not supported\n", buf); ret = AVERROR(EINVAL); goto free_and_end; } } } if (avctx->channel_layout && avctx->channels) { int channels = av_get_channel_layout_nb_channels(avctx->channel_layout); if (channels != avctx->channels) { char buf[512]; av_get_channel_layout_string(buf, sizeof(buf), -1, avctx->channel_layout); av_log(avctx, AV_LOG_ERROR, "Channel layout '%s' with %d channels does not match number of specified channels %d\n", buf, channels, avctx->channels); ret = AVERROR(EINVAL); goto free_and_end; } } else if (avctx->channel_layout) { avctx->channels = av_get_channel_layout_nb_channels(avctx->channel_layout); } if(avctx->codec_type == AVMEDIA_TYPE_VIDEO && avctx->codec_id != AV_CODEC_ID_PNG // For mplayer ) { if (avctx->width <= 0 || avctx->height <= 0) { av_log(avctx, AV_LOG_ERROR, "dimensions not set\n"); ret = AVERROR(EINVAL); goto free_and_end; } } if ( (avctx->codec_type == AVMEDIA_TYPE_VIDEO || avctx->codec_type == AVMEDIA_TYPE_AUDIO) && avctx->bit_rate>0 && avctx->bit_rate<1000) { av_log(avctx, AV_LOG_WARNING, "Bitrate %d is extremely low, maybe you mean %dk\n", avctx->bit_rate, avctx->bit_rate); } if (!avctx->rc_initial_buffer_occupancy) avctx->rc_initial_buffer_occupancy = avctx->rc_buffer_size * 3 / 4; } avctx->pts_correction_num_faulty_pts = avctx->pts_correction_num_faulty_dts = 0; avctx->pts_correction_last_pts = avctx->pts_correction_last_dts = INT64_MIN; if ( avctx->codec->init && (!(avctx->active_thread_type&FF_THREAD_FRAME) || avctx->internal->frame_thread_encoder)) { ret = avctx->codec->init(avctx); if (ret < 0) { goto free_and_end; } } ret=0; if (av_codec_is_decoder(avctx->codec)) { if (!avctx->bit_rate) avctx->bit_rate = get_bit_rate(avctx); /* validate channel layout from the decoder */ if (avctx->channel_layout) { int channels = av_get_channel_layout_nb_channels(avctx->channel_layout); if (!avctx->channels) avctx->channels = channels; else if (channels != avctx->channels) { char buf[512]; av_get_channel_layout_string(buf, sizeof(buf), -1, avctx->channel_layout); av_log(avctx, AV_LOG_WARNING, "Channel layout '%s' with %d channels does not match specified number of channels %d: " "ignoring specified channel layout\n", buf, channels, avctx->channels); avctx->channel_layout = 0; } } if (avctx->channels && avctx->channels < 0 || avctx->channels > FF_SANE_NB_CHANNELS) { ret = AVERROR(EINVAL); goto free_and_end; } if (avctx->sub_charenc) { if (avctx->codec_type != AVMEDIA_TYPE_SUBTITLE) { av_log(avctx, AV_LOG_ERROR, "Character encoding is only " "supported with subtitles codecs\n"); ret = AVERROR(EINVAL); goto free_and_end; } else if (avctx->codec_descriptor->props & AV_CODEC_PROP_BITMAP_SUB) { av_log(avctx, AV_LOG_WARNING, "Codec '%s' is bitmap-based, " "subtitles character encoding will be ignored\n", avctx->codec_descriptor->name); avctx->sub_charenc_mode = FF_SUB_CHARENC_MODE_DO_NOTHING; } else { /* input character encoding is set for a text based subtitle * codec at this point */ if (avctx->sub_charenc_mode == FF_SUB_CHARENC_MODE_AUTOMATIC) avctx->sub_charenc_mode = FF_SUB_CHARENC_MODE_PRE_DECODER; if (avctx->sub_charenc_mode == FF_SUB_CHARENC_MODE_PRE_DECODER) { #if CONFIG_ICONV iconv_t cd = iconv_open("UTF-8", avctx->sub_charenc); if (cd == (iconv_t)-1) { av_log(avctx, AV_LOG_ERROR, "Unable to open iconv context " "with input character encoding \"%s\"\n", avctx->sub_charenc); ret = AVERROR(errno); goto free_and_end; } iconv_close(cd); #else av_log(avctx, AV_LOG_ERROR, "Character encoding subtitles " "conversion needs a libavcodec built with iconv support " "for this codec\n"); ret = AVERROR(ENOSYS); goto free_and_end; #endif } } } } end: ff_unlock_avcodec(); if (options) { av_dict_free(options); *options = tmp; } return ret; free_and_end: av_dict_free(&tmp); av_freep(&avctx->priv_data); if (avctx->internal) av_freep(&avctx->internal->pool); av_freep(&avctx->internal); avctx->codec = NULL; goto end; }
false
FFmpeg
b76d853697a8b558e597ed4a6fc5a088b6c602c7
int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options) { int ret = 0; AVDictionary *tmp = NULL; if (avcodec_is_open(avctx)) return 0; if ((!codec && !avctx->codec)) { av_log(avctx, AV_LOG_ERROR, "No codec provided to avcodec_open2()\n"); return AVERROR(EINVAL); } if ((codec && avctx->codec && codec != avctx->codec)) { av_log(avctx, AV_LOG_ERROR, "This AVCodecContext was allocated for %s, " "but %s passed to avcodec_open2()\n", avctx->codec->name, codec->name); return AVERROR(EINVAL); } if (!codec) codec = avctx->codec; if (avctx->extradata_size < 0 || avctx->extradata_size >= FF_MAX_EXTRADATA_SIZE) return AVERROR(EINVAL); if (options) av_dict_copy(&tmp, *options, 0); ret = ff_lock_avcodec(avctx); if (ret < 0) return ret; avctx->internal = av_mallocz(sizeof(AVCodecInternal)); if (!avctx->internal) { ret = AVERROR(ENOMEM); goto end; } avctx->internal->pool = av_mallocz(sizeof(*avctx->internal->pool)); if (!avctx->internal->pool) { ret = AVERROR(ENOMEM); goto free_and_end; } if (codec->priv_data_size > 0) { if (!avctx->priv_data) { avctx->priv_data = av_mallocz(codec->priv_data_size); if (!avctx->priv_data) { ret = AVERROR(ENOMEM); goto end; } if (codec->priv_class) { *(const AVClass **)avctx->priv_data = codec->priv_class; av_opt_set_defaults(avctx->priv_data); } } if (codec->priv_class && (ret = av_opt_set_dict(avctx->priv_data, &tmp)) < 0) goto free_and_end; } else { avctx->priv_data = NULL; } if ((ret = av_opt_set_dict(avctx, &tmp)) < 0) goto free_and_end; if (!( avctx->coded_width && avctx->coded_height && avctx->width && avctx->height && avctx->codec_id == AV_CODEC_ID_H264)){ if (avctx->coded_width && avctx->coded_height) avcodec_set_dimensions(avctx, avctx->coded_width, avctx->coded_height); else if (avctx->width && avctx->height) avcodec_set_dimensions(avctx, avctx->width, avctx->height); } if ((avctx->coded_width || avctx->coded_height || avctx->width || avctx->height) && ( av_image_check_size(avctx->coded_width, avctx->coded_height, 0, avctx) < 0 || av_image_check_size(avctx->width, avctx->height, 0, avctx) < 0)) { av_log(avctx, AV_LOG_WARNING, "Ignoring invalid width/height values\n"); avcodec_set_dimensions(avctx, 0, 0); } if (av_codec_is_decoder(codec)) av_freep(&avctx->subtitle_header); if (avctx->channels > FF_SANE_NB_CHANNELS) { ret = AVERROR(EINVAL); goto free_and_end; } avctx->codec = codec; if ((avctx->codec_type == AVMEDIA_TYPE_UNKNOWN || avctx->codec_type == codec->type) && avctx->codec_id == AV_CODEC_ID_NONE) { avctx->codec_type = codec->type; avctx->codec_id = codec->id; } if (avctx->codec_id != codec->id || (avctx->codec_type != codec->type && avctx->codec_type != AVMEDIA_TYPE_ATTACHMENT)) { av_log(avctx, AV_LOG_ERROR, "Codec type or id mismatches\n"); ret = AVERROR(EINVAL); goto free_and_end; } avctx->frame_number = 0; avctx->codec_descriptor = avcodec_descriptor_get(avctx->codec_id); if (avctx->codec->capabilities & CODEC_CAP_EXPERIMENTAL && avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) { const char *codec_string = av_codec_is_encoder(codec) ? "encoder" : "decoder"; AVCodec *codec2; av_log(NULL, AV_LOG_ERROR, "The %s '%s' is experimental but experimental codecs are not enabled, " "add '-strict %d' if you want to use it.\n", codec_string, codec->name, FF_COMPLIANCE_EXPERIMENTAL); codec2 = av_codec_is_encoder(codec) ? avcodec_find_encoder(codec->id) : avcodec_find_decoder(codec->id); if (!(codec2->capabilities & CODEC_CAP_EXPERIMENTAL)) av_log(NULL, AV_LOG_ERROR, "Alternatively use the non experimental %s '%s'.\n", codec_string, codec2->name); ret = AVERROR_EXPERIMENTAL; goto free_and_end; } if (avctx->codec_type == AVMEDIA_TYPE_AUDIO && (!avctx->time_base.num || !avctx->time_base.den)) { avctx->time_base.num = 1; avctx->time_base.den = avctx->sample_rate; } if (!HAVE_THREADS) av_log(avctx, AV_LOG_WARNING, "Warning: not compiled with thread support, using thread emulation\n"); if (HAVE_THREADS) { ff_unlock_avcodec(); ret = ff_frame_thread_encoder_init(avctx, options ? *options : NULL); ff_lock_avcodec(avctx); if (ret < 0) goto free_and_end; } if (HAVE_THREADS && !avctx->thread_opaque && !(avctx->internal->frame_thread_encoder && (avctx->active_thread_type&FF_THREAD_FRAME))) { ret = ff_thread_init(avctx); if (ret < 0) { goto free_and_end; } } if (!HAVE_THREADS && !(codec->capabilities & CODEC_CAP_AUTO_THREADS)) avctx->thread_count = 1; if (avctx->codec->max_lowres < avctx->lowres || avctx->lowres < 0) { av_log(avctx, AV_LOG_ERROR, "The maximum value for lowres supported by the decoder is %d\n", avctx->codec->max_lowres); ret = AVERROR(EINVAL); goto free_and_end; } if (av_codec_is_encoder(avctx->codec)) { int i; if (avctx->codec->sample_fmts) { for (i = 0; avctx->codec->sample_fmts[i] != AV_SAMPLE_FMT_NONE; i++) { if (avctx->sample_fmt == avctx->codec->sample_fmts[i]) break; if (avctx->channels == 1 && av_get_planar_sample_fmt(avctx->sample_fmt) == av_get_planar_sample_fmt(avctx->codec->sample_fmts[i])) { avctx->sample_fmt = avctx->codec->sample_fmts[i]; break; } } if (avctx->codec->sample_fmts[i] == AV_SAMPLE_FMT_NONE) { char buf[128]; snprintf(buf, sizeof(buf), "%d", avctx->sample_fmt); av_log(avctx, AV_LOG_ERROR, "Specified sample format %s is invalid or not supported\n", (char *)av_x_if_null(av_get_sample_fmt_name(avctx->sample_fmt), buf)); ret = AVERROR(EINVAL); goto free_and_end; } } if (avctx->codec->pix_fmts) { for (i = 0; avctx->codec->pix_fmts[i] != AV_PIX_FMT_NONE; i++) if (avctx->pix_fmt == avctx->codec->pix_fmts[i]) break; if (avctx->codec->pix_fmts[i] == AV_PIX_FMT_NONE && !((avctx->codec_id == AV_CODEC_ID_MJPEG || avctx->codec_id == AV_CODEC_ID_LJPEG) && avctx->strict_std_compliance <= FF_COMPLIANCE_UNOFFICIAL)) { char buf[128]; snprintf(buf, sizeof(buf), "%d", avctx->pix_fmt); av_log(avctx, AV_LOG_ERROR, "Specified pixel format %s is invalid or not supported\n", (char *)av_x_if_null(av_get_pix_fmt_name(avctx->pix_fmt), buf)); ret = AVERROR(EINVAL); goto free_and_end; } } if (avctx->codec->supported_samplerates) { for (i = 0; avctx->codec->supported_samplerates[i] != 0; i++) if (avctx->sample_rate == avctx->codec->supported_samplerates[i]) break; if (avctx->codec->supported_samplerates[i] == 0) { av_log(avctx, AV_LOG_ERROR, "Specified sample rate %d is not supported\n", avctx->sample_rate); ret = AVERROR(EINVAL); goto free_and_end; } } if (avctx->codec->channel_layouts) { if (!avctx->channel_layout) { av_log(avctx, AV_LOG_WARNING, "Channel layout not specified\n"); } else { for (i = 0; avctx->codec->channel_layouts[i] != 0; i++) if (avctx->channel_layout == avctx->codec->channel_layouts[i]) break; if (avctx->codec->channel_layouts[i] == 0) { char buf[512]; av_get_channel_layout_string(buf, sizeof(buf), -1, avctx->channel_layout); av_log(avctx, AV_LOG_ERROR, "Specified channel layout '%s' is not supported\n", buf); ret = AVERROR(EINVAL); goto free_and_end; } } } if (avctx->channel_layout && avctx->channels) { int channels = av_get_channel_layout_nb_channels(avctx->channel_layout); if (channels != avctx->channels) { char buf[512]; av_get_channel_layout_string(buf, sizeof(buf), -1, avctx->channel_layout); av_log(avctx, AV_LOG_ERROR, "Channel layout '%s' with %d channels does not match number of specified channels %d\n", buf, channels, avctx->channels); ret = AVERROR(EINVAL); goto free_and_end; } } else if (avctx->channel_layout) { avctx->channels = av_get_channel_layout_nb_channels(avctx->channel_layout); } if(avctx->codec_type == AVMEDIA_TYPE_VIDEO && avctx->codec_id != AV_CODEC_ID_PNG ) { if (avctx->width <= 0 || avctx->height <= 0) { av_log(avctx, AV_LOG_ERROR, "dimensions not set\n"); ret = AVERROR(EINVAL); goto free_and_end; } } if ( (avctx->codec_type == AVMEDIA_TYPE_VIDEO || avctx->codec_type == AVMEDIA_TYPE_AUDIO) && avctx->bit_rate>0 && avctx->bit_rate<1000) { av_log(avctx, AV_LOG_WARNING, "Bitrate %d is extremely low, maybe you mean %dk\n", avctx->bit_rate, avctx->bit_rate); } if (!avctx->rc_initial_buffer_occupancy) avctx->rc_initial_buffer_occupancy = avctx->rc_buffer_size * 3 / 4; } avctx->pts_correction_num_faulty_pts = avctx->pts_correction_num_faulty_dts = 0; avctx->pts_correction_last_pts = avctx->pts_correction_last_dts = INT64_MIN; if ( avctx->codec->init && (!(avctx->active_thread_type&FF_THREAD_FRAME) || avctx->internal->frame_thread_encoder)) { ret = avctx->codec->init(avctx); if (ret < 0) { goto free_and_end; } } ret=0; if (av_codec_is_decoder(avctx->codec)) { if (!avctx->bit_rate) avctx->bit_rate = get_bit_rate(avctx); if (avctx->channel_layout) { int channels = av_get_channel_layout_nb_channels(avctx->channel_layout); if (!avctx->channels) avctx->channels = channels; else if (channels != avctx->channels) { char buf[512]; av_get_channel_layout_string(buf, sizeof(buf), -1, avctx->channel_layout); av_log(avctx, AV_LOG_WARNING, "Channel layout '%s' with %d channels does not match specified number of channels %d: " "ignoring specified channel layout\n", buf, channels, avctx->channels); avctx->channel_layout = 0; } } if (avctx->channels && avctx->channels < 0 || avctx->channels > FF_SANE_NB_CHANNELS) { ret = AVERROR(EINVAL); goto free_and_end; } if (avctx->sub_charenc) { if (avctx->codec_type != AVMEDIA_TYPE_SUBTITLE) { av_log(avctx, AV_LOG_ERROR, "Character encoding is only " "supported with subtitles codecs\n"); ret = AVERROR(EINVAL); goto free_and_end; } else if (avctx->codec_descriptor->props & AV_CODEC_PROP_BITMAP_SUB) { av_log(avctx, AV_LOG_WARNING, "Codec '%s' is bitmap-based, " "subtitles character encoding will be ignored\n", avctx->codec_descriptor->name); avctx->sub_charenc_mode = FF_SUB_CHARENC_MODE_DO_NOTHING; } else { if (avctx->sub_charenc_mode == FF_SUB_CHARENC_MODE_AUTOMATIC) avctx->sub_charenc_mode = FF_SUB_CHARENC_MODE_PRE_DECODER; if (avctx->sub_charenc_mode == FF_SUB_CHARENC_MODE_PRE_DECODER) { #if CONFIG_ICONV iconv_t cd = iconv_open("UTF-8", avctx->sub_charenc); if (cd == (iconv_t)-1) { av_log(avctx, AV_LOG_ERROR, "Unable to open iconv context " "with input character encoding \"%s\"\n", avctx->sub_charenc); ret = AVERROR(errno); goto free_and_end; } iconv_close(cd); #else av_log(avctx, AV_LOG_ERROR, "Character encoding subtitles " "conversion needs a libavcodec built with iconv support " "for this codec\n"); ret = AVERROR(ENOSYS); goto free_and_end; #endif } } } } end: ff_unlock_avcodec(); if (options) { av_dict_free(options); *options = tmp; } return ret; free_and_end: av_dict_free(&tmp); av_freep(&avctx->priv_data); if (avctx->internal) av_freep(&avctx->internal->pool); av_freep(&avctx->internal); avctx->codec = NULL; goto end; }
{ "code": [], "line_no": [] }
int VAR_0 avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options) { int ret = 0; AVDictionary *tmp = NULL; if (avcodec_is_open(avctx)) return 0; if ((!codec && !avctx->codec)) { av_log(avctx, AV_LOG_ERROR, "No codec provided to avcodec_open2()\n"); return AVERROR(EINVAL); } if ((codec && avctx->codec && codec != avctx->codec)) { av_log(avctx, AV_LOG_ERROR, "This AVCodecContext was allocated for %s, " "but %s passed to avcodec_open2()\n", avctx->codec->name, codec->name); return AVERROR(EINVAL); } if (!codec) codec = avctx->codec; if (avctx->extradata_size < 0 || avctx->extradata_size >= FF_MAX_EXTRADATA_SIZE) return AVERROR(EINVAL); if (options) av_dict_copy(&tmp, *options, 0); ret = ff_lock_avcodec(avctx); if (ret < 0) return ret; avctx->internal = av_mallocz(sizeof(AVCodecInternal)); if (!avctx->internal) { ret = AVERROR(ENOMEM); goto end; } avctx->internal->pool = av_mallocz(sizeof(*avctx->internal->pool)); if (!avctx->internal->pool) { ret = AVERROR(ENOMEM); goto free_and_end; } if (codec->priv_data_size > 0) { if (!avctx->priv_data) { avctx->priv_data = av_mallocz(codec->priv_data_size); if (!avctx->priv_data) { ret = AVERROR(ENOMEM); goto end; } if (codec->priv_class) { *(const AVClass **)avctx->priv_data = codec->priv_class; av_opt_set_defaults(avctx->priv_data); } } if (codec->priv_class && (ret = av_opt_set_dict(avctx->priv_data, &tmp)) < 0) goto free_and_end; } else { avctx->priv_data = NULL; } if ((ret = av_opt_set_dict(avctx, &tmp)) < 0) goto free_and_end; if (!( avctx->coded_width && avctx->coded_height && avctx->width && avctx->height && avctx->codec_id == AV_CODEC_ID_H264)){ if (avctx->coded_width && avctx->coded_height) avcodec_set_dimensions(avctx, avctx->coded_width, avctx->coded_height); else if (avctx->width && avctx->height) avcodec_set_dimensions(avctx, avctx->width, avctx->height); } if ((avctx->coded_width || avctx->coded_height || avctx->width || avctx->height) && ( av_image_check_size(avctx->coded_width, avctx->coded_height, 0, avctx) < 0 || av_image_check_size(avctx->width, avctx->height, 0, avctx) < 0)) { av_log(avctx, AV_LOG_WARNING, "Ignoring invalid width/height values\n"); avcodec_set_dimensions(avctx, 0, 0); } if (av_codec_is_decoder(codec)) av_freep(&avctx->subtitle_header); if (avctx->channels > FF_SANE_NB_CHANNELS) { ret = AVERROR(EINVAL); goto free_and_end; } avctx->codec = codec; if ((avctx->codec_type == AVMEDIA_TYPE_UNKNOWN || avctx->codec_type == codec->type) && avctx->codec_id == AV_CODEC_ID_NONE) { avctx->codec_type = codec->type; avctx->codec_id = codec->id; } if (avctx->codec_id != codec->id || (avctx->codec_type != codec->type && avctx->codec_type != AVMEDIA_TYPE_ATTACHMENT)) { av_log(avctx, AV_LOG_ERROR, "Codec type or id mismatches\n"); ret = AVERROR(EINVAL); goto free_and_end; } avctx->frame_number = 0; avctx->codec_descriptor = avcodec_descriptor_get(avctx->codec_id); if (avctx->codec->capabilities & CODEC_CAP_EXPERIMENTAL && avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) { const char *codec_string = av_codec_is_encoder(codec) ? "encoder" : "decoder"; AVCodec *codec2; av_log(NULL, AV_LOG_ERROR, "The %s '%s' is experimental but experimental codecs are not enabled, " "add '-strict %d' if you want to use it.\n", codec_string, codec->name, FF_COMPLIANCE_EXPERIMENTAL); codec2 = av_codec_is_encoder(codec) ? avcodec_find_encoder(codec->id) : avcodec_find_decoder(codec->id); if (!(codec2->capabilities & CODEC_CAP_EXPERIMENTAL)) av_log(NULL, AV_LOG_ERROR, "Alternatively use the non experimental %s '%s'.\n", codec_string, codec2->name); ret = AVERROR_EXPERIMENTAL; goto free_and_end; } if (avctx->codec_type == AVMEDIA_TYPE_AUDIO && (!avctx->time_base.num || !avctx->time_base.den)) { avctx->time_base.num = 1; avctx->time_base.den = avctx->sample_rate; } if (!HAVE_THREADS) av_log(avctx, AV_LOG_WARNING, "Warning: not compiled with thread support, using thread emulation\n"); if (HAVE_THREADS) { ff_unlock_avcodec(); ret = ff_frame_thread_encoder_init(avctx, options ? *options : NULL); ff_lock_avcodec(avctx); if (ret < 0) goto free_and_end; } if (HAVE_THREADS && !avctx->thread_opaque && !(avctx->internal->frame_thread_encoder && (avctx->active_thread_type&FF_THREAD_FRAME))) { ret = ff_thread_init(avctx); if (ret < 0) { goto free_and_end; } } if (!HAVE_THREADS && !(codec->capabilities & CODEC_CAP_AUTO_THREADS)) avctx->thread_count = 1; if (avctx->codec->max_lowres < avctx->lowres || avctx->lowres < 0) { av_log(avctx, AV_LOG_ERROR, "The maximum value for lowres supported by the decoder is %d\n", avctx->codec->max_lowres); ret = AVERROR(EINVAL); goto free_and_end; } if (av_codec_is_encoder(avctx->codec)) { int i; if (avctx->codec->sample_fmts) { for (i = 0; avctx->codec->sample_fmts[i] != AV_SAMPLE_FMT_NONE; i++) { if (avctx->sample_fmt == avctx->codec->sample_fmts[i]) break; if (avctx->channels == 1 && av_get_planar_sample_fmt(avctx->sample_fmt) == av_get_planar_sample_fmt(avctx->codec->sample_fmts[i])) { avctx->sample_fmt = avctx->codec->sample_fmts[i]; break; } } if (avctx->codec->sample_fmts[i] == AV_SAMPLE_FMT_NONE) { char buf[128]; snprintf(buf, sizeof(buf), "%d", avctx->sample_fmt); av_log(avctx, AV_LOG_ERROR, "Specified sample format %s is invalid or not supported\n", (char *)av_x_if_null(av_get_sample_fmt_name(avctx->sample_fmt), buf)); ret = AVERROR(EINVAL); goto free_and_end; } } if (avctx->codec->pix_fmts) { for (i = 0; avctx->codec->pix_fmts[i] != AV_PIX_FMT_NONE; i++) if (avctx->pix_fmt == avctx->codec->pix_fmts[i]) break; if (avctx->codec->pix_fmts[i] == AV_PIX_FMT_NONE && !((avctx->codec_id == AV_CODEC_ID_MJPEG || avctx->codec_id == AV_CODEC_ID_LJPEG) && avctx->strict_std_compliance <= FF_COMPLIANCE_UNOFFICIAL)) { char buf[128]; snprintf(buf, sizeof(buf), "%d", avctx->pix_fmt); av_log(avctx, AV_LOG_ERROR, "Specified pixel format %s is invalid or not supported\n", (char *)av_x_if_null(av_get_pix_fmt_name(avctx->pix_fmt), buf)); ret = AVERROR(EINVAL); goto free_and_end; } } if (avctx->codec->supported_samplerates) { for (i = 0; avctx->codec->supported_samplerates[i] != 0; i++) if (avctx->sample_rate == avctx->codec->supported_samplerates[i]) break; if (avctx->codec->supported_samplerates[i] == 0) { av_log(avctx, AV_LOG_ERROR, "Specified sample rate %d is not supported\n", avctx->sample_rate); ret = AVERROR(EINVAL); goto free_and_end; } } if (avctx->codec->channel_layouts) { if (!avctx->channel_layout) { av_log(avctx, AV_LOG_WARNING, "Channel layout not specified\n"); } else { for (i = 0; avctx->codec->channel_layouts[i] != 0; i++) if (avctx->channel_layout == avctx->codec->channel_layouts[i]) break; if (avctx->codec->channel_layouts[i] == 0) { char buf[512]; av_get_channel_layout_string(buf, sizeof(buf), -1, avctx->channel_layout); av_log(avctx, AV_LOG_ERROR, "Specified channel layout '%s' is not supported\n", buf); ret = AVERROR(EINVAL); goto free_and_end; } } } if (avctx->channel_layout && avctx->channels) { int channels = av_get_channel_layout_nb_channels(avctx->channel_layout); if (channels != avctx->channels) { char buf[512]; av_get_channel_layout_string(buf, sizeof(buf), -1, avctx->channel_layout); av_log(avctx, AV_LOG_ERROR, "Channel layout '%s' with %d channels does not match number of specified channels %d\n", buf, channels, avctx->channels); ret = AVERROR(EINVAL); goto free_and_end; } } else if (avctx->channel_layout) { avctx->channels = av_get_channel_layout_nb_channels(avctx->channel_layout); } if(avctx->codec_type == AVMEDIA_TYPE_VIDEO && avctx->codec_id != AV_CODEC_ID_PNG ) { if (avctx->width <= 0 || avctx->height <= 0) { av_log(avctx, AV_LOG_ERROR, "dimensions not set\n"); ret = AVERROR(EINVAL); goto free_and_end; } } if ( (avctx->codec_type == AVMEDIA_TYPE_VIDEO || avctx->codec_type == AVMEDIA_TYPE_AUDIO) && avctx->bit_rate>0 && avctx->bit_rate<1000) { av_log(avctx, AV_LOG_WARNING, "Bitrate %d is extremely low, maybe you mean %dk\n", avctx->bit_rate, avctx->bit_rate); } if (!avctx->rc_initial_buffer_occupancy) avctx->rc_initial_buffer_occupancy = avctx->rc_buffer_size * 3 / 4; } avctx->pts_correction_num_faulty_pts = avctx->pts_correction_num_faulty_dts = 0; avctx->pts_correction_last_pts = avctx->pts_correction_last_dts = INT64_MIN; if ( avctx->codec->init && (!(avctx->active_thread_type&FF_THREAD_FRAME) || avctx->internal->frame_thread_encoder)) { ret = avctx->codec->init(avctx); if (ret < 0) { goto free_and_end; } } ret=0; if (av_codec_is_decoder(avctx->codec)) { if (!avctx->bit_rate) avctx->bit_rate = get_bit_rate(avctx); if (avctx->channel_layout) { int channels = av_get_channel_layout_nb_channels(avctx->channel_layout); if (!avctx->channels) avctx->channels = channels; else if (channels != avctx->channels) { char buf[512]; av_get_channel_layout_string(buf, sizeof(buf), -1, avctx->channel_layout); av_log(avctx, AV_LOG_WARNING, "Channel layout '%s' with %d channels does not match specified number of channels %d: " "ignoring specified channel layout\n", buf, channels, avctx->channels); avctx->channel_layout = 0; } } if (avctx->channels && avctx->channels < 0 || avctx->channels > FF_SANE_NB_CHANNELS) { ret = AVERROR(EINVAL); goto free_and_end; } if (avctx->sub_charenc) { if (avctx->codec_type != AVMEDIA_TYPE_SUBTITLE) { av_log(avctx, AV_LOG_ERROR, "Character encoding is only " "supported with subtitles codecs\n"); ret = AVERROR(EINVAL); goto free_and_end; } else if (avctx->codec_descriptor->props & AV_CODEC_PROP_BITMAP_SUB) { av_log(avctx, AV_LOG_WARNING, "Codec '%s' is bitmap-based, " "subtitles character encoding will be ignored\n", avctx->codec_descriptor->name); avctx->sub_charenc_mode = FF_SUB_CHARENC_MODE_DO_NOTHING; } else { if (avctx->sub_charenc_mode == FF_SUB_CHARENC_MODE_AUTOMATIC) avctx->sub_charenc_mode = FF_SUB_CHARENC_MODE_PRE_DECODER; if (avctx->sub_charenc_mode == FF_SUB_CHARENC_MODE_PRE_DECODER) { #if CONFIG_ICONV iconv_t cd = iconv_open("UTF-8", avctx->sub_charenc); if (cd == (iconv_t)-1) { av_log(avctx, AV_LOG_ERROR, "Unable to open iconv context " "with input character encoding \"%s\"\n", avctx->sub_charenc); ret = AVERROR(errno); goto free_and_end; } iconv_close(cd); #else av_log(avctx, AV_LOG_ERROR, "Character encoding subtitles " "conversion needs a libavcodec built with iconv support " "for this codec\n"); ret = AVERROR(ENOSYS); goto free_and_end; #endif } } } } end: ff_unlock_avcodec(); if (options) { av_dict_free(options); *options = tmp; } return ret; free_and_end: av_dict_free(&tmp); av_freep(&avctx->priv_data); if (avctx->internal) av_freep(&avctx->internal->pool); av_freep(&avctx->internal); avctx->codec = NULL; goto end; }
[ "int VAR_0 avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options)\n{", "int ret = 0;", "AVDictionary *tmp = NULL;", "if (avcodec_is_open(avctx))\nreturn 0;", "if ((!codec && !avctx->codec)) {", "av_log(avctx, AV_LOG_ERROR, \"No codec provided to avcodec_open2()\\n\");", "return AVERROR(EINVAL);", "}", "if ((codec && avctx->codec && codec != avctx->codec)) {", "av_log(avctx, AV_LOG_ERROR, \"This AVCodecContext was allocated for %s, \"\n\"but %s passed to avcodec_open2()\\n\", avctx->codec->name, codec->name);", "return AVERROR(EINVAL);", "}", "if (!codec)\ncodec = avctx->codec;", "if (avctx->extradata_size < 0 || avctx->extradata_size >= FF_MAX_EXTRADATA_SIZE)\nreturn AVERROR(EINVAL);", "if (options)\nav_dict_copy(&tmp, *options, 0);", "ret = ff_lock_avcodec(avctx);", "if (ret < 0)\nreturn ret;", "avctx->internal = av_mallocz(sizeof(AVCodecInternal));", "if (!avctx->internal) {", "ret = AVERROR(ENOMEM);", "goto end;", "}", "avctx->internal->pool = av_mallocz(sizeof(*avctx->internal->pool));", "if (!avctx->internal->pool) {", "ret = AVERROR(ENOMEM);", "goto free_and_end;", "}", "if (codec->priv_data_size > 0) {", "if (!avctx->priv_data) {", "avctx->priv_data = av_mallocz(codec->priv_data_size);", "if (!avctx->priv_data) {", "ret = AVERROR(ENOMEM);", "goto end;", "}", "if (codec->priv_class) {", "*(const AVClass **)avctx->priv_data = codec->priv_class;", "av_opt_set_defaults(avctx->priv_data);", "}", "}", "if (codec->priv_class && (ret = av_opt_set_dict(avctx->priv_data, &tmp)) < 0)\ngoto free_and_end;", "} else {", "avctx->priv_data = NULL;", "}", "if ((ret = av_opt_set_dict(avctx, &tmp)) < 0)\ngoto free_and_end;", "if (!( avctx->coded_width && avctx->coded_height && avctx->width && avctx->height && avctx->codec_id == AV_CODEC_ID_H264)){", "if (avctx->coded_width && avctx->coded_height)\navcodec_set_dimensions(avctx, avctx->coded_width, avctx->coded_height);", "else if (avctx->width && avctx->height)\navcodec_set_dimensions(avctx, avctx->width, avctx->height);", "}", "if ((avctx->coded_width || avctx->coded_height || avctx->width || avctx->height)\n&& ( av_image_check_size(avctx->coded_width, avctx->coded_height, 0, avctx) < 0\n|| av_image_check_size(avctx->width, avctx->height, 0, avctx) < 0)) {", "av_log(avctx, AV_LOG_WARNING, \"Ignoring invalid width/height values\\n\");", "avcodec_set_dimensions(avctx, 0, 0);", "}", "if (av_codec_is_decoder(codec))\nav_freep(&avctx->subtitle_header);", "if (avctx->channels > FF_SANE_NB_CHANNELS) {", "ret = AVERROR(EINVAL);", "goto free_and_end;", "}", "avctx->codec = codec;", "if ((avctx->codec_type == AVMEDIA_TYPE_UNKNOWN || avctx->codec_type == codec->type) &&\navctx->codec_id == AV_CODEC_ID_NONE) {", "avctx->codec_type = codec->type;", "avctx->codec_id = codec->id;", "}", "if (avctx->codec_id != codec->id || (avctx->codec_type != codec->type\n&& avctx->codec_type != AVMEDIA_TYPE_ATTACHMENT)) {", "av_log(avctx, AV_LOG_ERROR, \"Codec type or id mismatches\\n\");", "ret = AVERROR(EINVAL);", "goto free_and_end;", "}", "avctx->frame_number = 0;", "avctx->codec_descriptor = avcodec_descriptor_get(avctx->codec_id);", "if (avctx->codec->capabilities & CODEC_CAP_EXPERIMENTAL &&\navctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) {", "const char *codec_string = av_codec_is_encoder(codec) ? \"encoder\" : \"decoder\";", "AVCodec *codec2;", "av_log(NULL, AV_LOG_ERROR,\n\"The %s '%s' is experimental but experimental codecs are not enabled, \"\n\"add '-strict %d' if you want to use it.\\n\",\ncodec_string, codec->name, FF_COMPLIANCE_EXPERIMENTAL);", "codec2 = av_codec_is_encoder(codec) ? avcodec_find_encoder(codec->id) : avcodec_find_decoder(codec->id);", "if (!(codec2->capabilities & CODEC_CAP_EXPERIMENTAL))\nav_log(NULL, AV_LOG_ERROR, \"Alternatively use the non experimental %s '%s'.\\n\",\ncodec_string, codec2->name);", "ret = AVERROR_EXPERIMENTAL;", "goto free_and_end;", "}", "if (avctx->codec_type == AVMEDIA_TYPE_AUDIO &&\n(!avctx->time_base.num || !avctx->time_base.den)) {", "avctx->time_base.num = 1;", "avctx->time_base.den = avctx->sample_rate;", "}", "if (!HAVE_THREADS)\nav_log(avctx, AV_LOG_WARNING, \"Warning: not compiled with thread support, using thread emulation\\n\");", "if (HAVE_THREADS) {", "ff_unlock_avcodec();", "ret = ff_frame_thread_encoder_init(avctx, options ? *options : NULL);", "ff_lock_avcodec(avctx);", "if (ret < 0)\ngoto free_and_end;", "}", "if (HAVE_THREADS && !avctx->thread_opaque\n&& !(avctx->internal->frame_thread_encoder && (avctx->active_thread_type&FF_THREAD_FRAME))) {", "ret = ff_thread_init(avctx);", "if (ret < 0) {", "goto free_and_end;", "}", "}", "if (!HAVE_THREADS && !(codec->capabilities & CODEC_CAP_AUTO_THREADS))\navctx->thread_count = 1;", "if (avctx->codec->max_lowres < avctx->lowres || avctx->lowres < 0) {", "av_log(avctx, AV_LOG_ERROR, \"The maximum value for lowres supported by the decoder is %d\\n\",\navctx->codec->max_lowres);", "ret = AVERROR(EINVAL);", "goto free_and_end;", "}", "if (av_codec_is_encoder(avctx->codec)) {", "int i;", "if (avctx->codec->sample_fmts) {", "for (i = 0; avctx->codec->sample_fmts[i] != AV_SAMPLE_FMT_NONE; i++) {", "if (avctx->sample_fmt == avctx->codec->sample_fmts[i])\nbreak;", "if (avctx->channels == 1 &&\nav_get_planar_sample_fmt(avctx->sample_fmt) ==\nav_get_planar_sample_fmt(avctx->codec->sample_fmts[i])) {", "avctx->sample_fmt = avctx->codec->sample_fmts[i];", "break;", "}", "}", "if (avctx->codec->sample_fmts[i] == AV_SAMPLE_FMT_NONE) {", "char buf[128];", "snprintf(buf, sizeof(buf), \"%d\", avctx->sample_fmt);", "av_log(avctx, AV_LOG_ERROR, \"Specified sample format %s is invalid or not supported\\n\",\n(char *)av_x_if_null(av_get_sample_fmt_name(avctx->sample_fmt), buf));", "ret = AVERROR(EINVAL);", "goto free_and_end;", "}", "}", "if (avctx->codec->pix_fmts) {", "for (i = 0; avctx->codec->pix_fmts[i] != AV_PIX_FMT_NONE; i++)", "if (avctx->pix_fmt == avctx->codec->pix_fmts[i])\nbreak;", "if (avctx->codec->pix_fmts[i] == AV_PIX_FMT_NONE\n&& !((avctx->codec_id == AV_CODEC_ID_MJPEG || avctx->codec_id == AV_CODEC_ID_LJPEG)\n&& avctx->strict_std_compliance <= FF_COMPLIANCE_UNOFFICIAL)) {", "char buf[128];", "snprintf(buf, sizeof(buf), \"%d\", avctx->pix_fmt);", "av_log(avctx, AV_LOG_ERROR, \"Specified pixel format %s is invalid or not supported\\n\",\n(char *)av_x_if_null(av_get_pix_fmt_name(avctx->pix_fmt), buf));", "ret = AVERROR(EINVAL);", "goto free_and_end;", "}", "}", "if (avctx->codec->supported_samplerates) {", "for (i = 0; avctx->codec->supported_samplerates[i] != 0; i++)", "if (avctx->sample_rate == avctx->codec->supported_samplerates[i])\nbreak;", "if (avctx->codec->supported_samplerates[i] == 0) {", "av_log(avctx, AV_LOG_ERROR, \"Specified sample rate %d is not supported\\n\",\navctx->sample_rate);", "ret = AVERROR(EINVAL);", "goto free_and_end;", "}", "}", "if (avctx->codec->channel_layouts) {", "if (!avctx->channel_layout) {", "av_log(avctx, AV_LOG_WARNING, \"Channel layout not specified\\n\");", "} else {", "for (i = 0; avctx->codec->channel_layouts[i] != 0; i++)", "if (avctx->channel_layout == avctx->codec->channel_layouts[i])\nbreak;", "if (avctx->codec->channel_layouts[i] == 0) {", "char buf[512];", "av_get_channel_layout_string(buf, sizeof(buf), -1, avctx->channel_layout);", "av_log(avctx, AV_LOG_ERROR, \"Specified channel layout '%s' is not supported\\n\", buf);", "ret = AVERROR(EINVAL);", "goto free_and_end;", "}", "}", "}", "if (avctx->channel_layout && avctx->channels) {", "int channels = av_get_channel_layout_nb_channels(avctx->channel_layout);", "if (channels != avctx->channels) {", "char buf[512];", "av_get_channel_layout_string(buf, sizeof(buf), -1, avctx->channel_layout);", "av_log(avctx, AV_LOG_ERROR,\n\"Channel layout '%s' with %d channels does not match number of specified channels %d\\n\",\nbuf, channels, avctx->channels);", "ret = AVERROR(EINVAL);", "goto free_and_end;", "}", "} else if (avctx->channel_layout) {", "avctx->channels = av_get_channel_layout_nb_channels(avctx->channel_layout);", "}", "if(avctx->codec_type == AVMEDIA_TYPE_VIDEO &&\navctx->codec_id != AV_CODEC_ID_PNG\n) {", "if (avctx->width <= 0 || avctx->height <= 0) {", "av_log(avctx, AV_LOG_ERROR, \"dimensions not set\\n\");", "ret = AVERROR(EINVAL);", "goto free_and_end;", "}", "}", "if ( (avctx->codec_type == AVMEDIA_TYPE_VIDEO || avctx->codec_type == AVMEDIA_TYPE_AUDIO)\n&& avctx->bit_rate>0 && avctx->bit_rate<1000) {", "av_log(avctx, AV_LOG_WARNING, \"Bitrate %d is extremely low, maybe you mean %dk\\n\", avctx->bit_rate, avctx->bit_rate);", "}", "if (!avctx->rc_initial_buffer_occupancy)\navctx->rc_initial_buffer_occupancy = avctx->rc_buffer_size * 3 / 4;", "}", "avctx->pts_correction_num_faulty_pts =\navctx->pts_correction_num_faulty_dts = 0;", "avctx->pts_correction_last_pts =\navctx->pts_correction_last_dts = INT64_MIN;", "if ( avctx->codec->init && (!(avctx->active_thread_type&FF_THREAD_FRAME)\n|| avctx->internal->frame_thread_encoder)) {", "ret = avctx->codec->init(avctx);", "if (ret < 0) {", "goto free_and_end;", "}", "}", "ret=0;", "if (av_codec_is_decoder(avctx->codec)) {", "if (!avctx->bit_rate)\navctx->bit_rate = get_bit_rate(avctx);", "if (avctx->channel_layout) {", "int channels = av_get_channel_layout_nb_channels(avctx->channel_layout);", "if (!avctx->channels)\navctx->channels = channels;", "else if (channels != avctx->channels) {", "char buf[512];", "av_get_channel_layout_string(buf, sizeof(buf), -1, avctx->channel_layout);", "av_log(avctx, AV_LOG_WARNING,\n\"Channel layout '%s' with %d channels does not match specified number of channels %d: \"\n\"ignoring specified channel layout\\n\",\nbuf, channels, avctx->channels);", "avctx->channel_layout = 0;", "}", "}", "if (avctx->channels && avctx->channels < 0 ||\navctx->channels > FF_SANE_NB_CHANNELS) {", "ret = AVERROR(EINVAL);", "goto free_and_end;", "}", "if (avctx->sub_charenc) {", "if (avctx->codec_type != AVMEDIA_TYPE_SUBTITLE) {", "av_log(avctx, AV_LOG_ERROR, \"Character encoding is only \"\n\"supported with subtitles codecs\\n\");", "ret = AVERROR(EINVAL);", "goto free_and_end;", "} else if (avctx->codec_descriptor->props & AV_CODEC_PROP_BITMAP_SUB) {", "av_log(avctx, AV_LOG_WARNING, \"Codec '%s' is bitmap-based, \"\n\"subtitles character encoding will be ignored\\n\",\navctx->codec_descriptor->name);", "avctx->sub_charenc_mode = FF_SUB_CHARENC_MODE_DO_NOTHING;", "} else {", "if (avctx->sub_charenc_mode == FF_SUB_CHARENC_MODE_AUTOMATIC)\navctx->sub_charenc_mode = FF_SUB_CHARENC_MODE_PRE_DECODER;", "if (avctx->sub_charenc_mode == FF_SUB_CHARENC_MODE_PRE_DECODER) {", "#if CONFIG_ICONV\niconv_t cd = iconv_open(\"UTF-8\", avctx->sub_charenc);", "if (cd == (iconv_t)-1) {", "av_log(avctx, AV_LOG_ERROR, \"Unable to open iconv context \"\n\"with input character encoding \\\"%s\\\"\\n\", avctx->sub_charenc);", "ret = AVERROR(errno);", "goto free_and_end;", "}", "iconv_close(cd);", "#else\nav_log(avctx, AV_LOG_ERROR, \"Character encoding subtitles \"\n\"conversion needs a libavcodec built with iconv support \"\n\"for this codec\\n\");", "ret = AVERROR(ENOSYS);", "goto free_and_end;", "#endif\n}", "}", "}", "}", "end:\nff_unlock_avcodec();", "if (options) {", "av_dict_free(options);", "*options = tmp;", "}", "return ret;", "free_and_end:\nav_dict_free(&tmp);", "av_freep(&avctx->priv_data);", "if (avctx->internal)\nav_freep(&avctx->internal->pool);", "av_freep(&avctx->internal);", "avctx->codec = NULL;", "goto end;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 33 ], [ 35, 37 ], [ 41, 43 ], [ 47, 49 ], [ 53 ], [ 55, 57 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109, 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119, 121 ], [ 127 ], [ 131, 133 ], [ 135, 137 ], [ 139 ], [ 143, 145, 147 ], [ 149 ], [ 151 ], [ 153 ], [ 161, 163 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 177 ], [ 179, 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189, 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 207, 209 ], [ 211 ], [ 213 ], [ 215, 217, 219, 221 ], [ 223 ], [ 225, 227, 229 ], [ 231 ], [ 233 ], [ 235 ], [ 239, 241 ], [ 243 ], [ 245 ], [ 247 ], [ 251, 253 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265, 267 ], [ 269 ], [ 273, 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 287, 289 ], [ 293 ], [ 295, 297 ], [ 299 ], [ 301 ], [ 303 ], [ 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 ], [ 491, 493 ], [ 495 ], [ 499, 501 ], [ 503, 505 ], [ 509, 511 ], [ 513 ], [ 515 ], [ 517 ], [ 519 ], [ 521 ], [ 525 ], [ 529 ], [ 531, 533 ], [ 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 ], [ 603, 605 ], [ 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 ], [ 665 ], [ 667, 669 ], [ 671 ], [ 673, 675 ], [ 677 ], [ 679 ], [ 681 ], [ 683 ] ]
14,949
unsigned long av_adler32_update(unsigned long adler, const uint8_t * buf, unsigned int len) { unsigned long s1 = adler & 0xffff; unsigned long s2 = adler >> 16; while (len > 0) { #if CONFIG_SMALL while (len > 4 && s2 < (1U << 31)) { DO4(buf); len -= 4; } #else while (len > 16 && s2 < (1U << 31)) { DO16(buf); len -= 16; } #endif DO1(buf); len--; s1 %= BASE; s2 %= BASE; } return (s2 << 16) | s1; }
false
FFmpeg
7f8027b76f1bdce7452d02513fc179cca20d8867
unsigned long av_adler32_update(unsigned long adler, const uint8_t * buf, unsigned int len) { unsigned long s1 = adler & 0xffff; unsigned long s2 = adler >> 16; while (len > 0) { #if CONFIG_SMALL while (len > 4 && s2 < (1U << 31)) { DO4(buf); len -= 4; } #else while (len > 16 && s2 < (1U << 31)) { DO16(buf); len -= 16; } #endif DO1(buf); len--; s1 %= BASE; s2 %= BASE; } return (s2 << 16) | s1; }
{ "code": [], "line_no": [] }
unsigned long FUNC_0(unsigned long VAR_0, const uint8_t * VAR_1, unsigned int VAR_2) { unsigned long VAR_3 = VAR_0 & 0xffff; unsigned long VAR_4 = VAR_0 >> 16; while (VAR_2 > 0) { #if CONFIG_SMALL while (VAR_2 > 4 && VAR_4 < (1U << 31)) { DO4(VAR_1); VAR_2 -= 4; } #else while (VAR_2 > 16 && VAR_4 < (1U << 31)) { DO16(VAR_1); VAR_2 -= 16; } #endif DO1(VAR_1); VAR_2--; VAR_3 %= BASE; VAR_4 %= BASE; } return (VAR_4 << 16) | VAR_3; }
[ "unsigned long FUNC_0(unsigned long VAR_0, const uint8_t * VAR_1,\nunsigned int VAR_2)\n{", "unsigned long VAR_3 = VAR_0 & 0xffff;", "unsigned long VAR_4 = VAR_0 >> 16;", "while (VAR_2 > 0) {", "#if CONFIG_SMALL\nwhile (VAR_2 > 4 && VAR_4 < (1U << 31)) {", "DO4(VAR_1);", "VAR_2 -= 4;", "}", "#else\nwhile (VAR_2 > 16 && VAR_4 < (1U << 31)) {", "DO16(VAR_1);", "VAR_2 -= 16;", "}", "#endif\nDO1(VAR_1); VAR_2--;", "VAR_3 %= BASE;", "VAR_4 %= BASE;", "}", "return (VAR_4 << 16) | VAR_3;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15, 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35, 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ] ]
14,950
static int mpc_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags) { AVStream *st = s->streams[stream_index]; MPCContext *c = s->priv_data; AVPacket pkt1, *pkt = &pkt1; int ret; int index = av_index_search_timestamp(st, timestamp - DELAY_FRAMES, flags); uint32_t lastframe; /* if found, seek there */ if (index >= 0){ c->curframe = st->index_entries[index].pos; return 0; } /* if timestamp is out of bounds, return error */ if(timestamp < 0 || timestamp >= c->fcount) return -1; timestamp -= DELAY_FRAMES; /* seek to the furthest known position and read packets until we reach desired position */ lastframe = c->curframe; if(c->frames_noted) c->curframe = c->frames_noted - 1; while(c->curframe < timestamp){ ret = av_read_frame(s, pkt); if (ret < 0){ c->curframe = lastframe; return ret; } av_free_packet(pkt); } return 0; }
false
FFmpeg
a503afb11f80facc0fa12b733c5c58989950b108
static int mpc_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags) { AVStream *st = s->streams[stream_index]; MPCContext *c = s->priv_data; AVPacket pkt1, *pkt = &pkt1; int ret; int index = av_index_search_timestamp(st, timestamp - DELAY_FRAMES, flags); uint32_t lastframe; if (index >= 0){ c->curframe = st->index_entries[index].pos; return 0; } if(timestamp < 0 || timestamp >= c->fcount) return -1; timestamp -= DELAY_FRAMES; lastframe = c->curframe; if(c->frames_noted) c->curframe = c->frames_noted - 1; while(c->curframe < timestamp){ ret = av_read_frame(s, pkt); if (ret < 0){ c->curframe = lastframe; return ret; } av_free_packet(pkt); } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0, int VAR_1, int64_t VAR_2, int VAR_3) { AVStream *st = VAR_0->streams[VAR_1]; MPCContext *c = VAR_0->priv_data; AVPacket pkt1, *pkt = &pkt1; int VAR_4; int VAR_5 = av_index_search_timestamp(st, VAR_2 - DELAY_FRAMES, VAR_3); uint32_t lastframe; if (VAR_5 >= 0){ c->curframe = st->index_entries[VAR_5].pos; return 0; } if(VAR_2 < 0 || VAR_2 >= c->fcount) return -1; VAR_2 -= DELAY_FRAMES; lastframe = c->curframe; if(c->frames_noted) c->curframe = c->frames_noted - 1; while(c->curframe < VAR_2){ VAR_4 = av_read_frame(VAR_0, pkt); if (VAR_4 < 0){ c->curframe = lastframe; return VAR_4; } av_free_packet(pkt); } return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0, int VAR_1, int64_t VAR_2, int VAR_3)\n{", "AVStream *st = VAR_0->streams[VAR_1];", "MPCContext *c = VAR_0->priv_data;", "AVPacket pkt1, *pkt = &pkt1;", "int VAR_4;", "int VAR_5 = av_index_search_timestamp(st, VAR_2 - DELAY_FRAMES, VAR_3);", "uint32_t lastframe;", "if (VAR_5 >= 0){", "c->curframe = st->index_entries[VAR_5].pos;", "return 0;", "}", "if(VAR_2 < 0 || VAR_2 >= c->fcount)\nreturn -1;", "VAR_2 -= DELAY_FRAMES;", "lastframe = c->curframe;", "if(c->frames_noted) c->curframe = c->frames_noted - 1;", "while(c->curframe < VAR_2){", "VAR_4 = av_read_frame(VAR_0, pkt);", "if (VAR_4 < 0){", "c->curframe = lastframe;", "return VAR_4;", "}", "av_free_packet(pkt);", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31, 33 ], [ 35 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ] ]
14,952
av_cold void ff_gradfun_init_x86(GradFunContext *gf) { int cpu_flags = av_get_cpu_flags(); if (HAVE_MMX2 && cpu_flags & AV_CPU_FLAG_MMX2) gf->filter_line = gradfun_filter_line_mmx2; if (HAVE_SSSE3 && cpu_flags & AV_CPU_FLAG_SSSE3) gf->filter_line = gradfun_filter_line_ssse3; if (HAVE_SSE && cpu_flags & AV_CPU_FLAG_SSE2) gf->blur_line = gradfun_blur_line_sse2; }
false
FFmpeg
fb93e61e2b7baa44ff991bc0ce96291490a0188e
av_cold void ff_gradfun_init_x86(GradFunContext *gf) { int cpu_flags = av_get_cpu_flags(); if (HAVE_MMX2 && cpu_flags & AV_CPU_FLAG_MMX2) gf->filter_line = gradfun_filter_line_mmx2; if (HAVE_SSSE3 && cpu_flags & AV_CPU_FLAG_SSSE3) gf->filter_line = gradfun_filter_line_ssse3; if (HAVE_SSE && cpu_flags & AV_CPU_FLAG_SSE2) gf->blur_line = gradfun_blur_line_sse2; }
{ "code": [], "line_no": [] }
av_cold void FUNC_0(GradFunContext *gf) { int VAR_0 = av_get_cpu_flags(); if (HAVE_MMX2 && VAR_0 & AV_CPU_FLAG_MMX2) gf->filter_line = gradfun_filter_line_mmx2; if (HAVE_SSSE3 && VAR_0 & AV_CPU_FLAG_SSSE3) gf->filter_line = gradfun_filter_line_ssse3; if (HAVE_SSE && VAR_0 & AV_CPU_FLAG_SSE2) gf->blur_line = gradfun_blur_line_sse2; }
[ "av_cold void FUNC_0(GradFunContext *gf)\n{", "int VAR_0 = av_get_cpu_flags();", "if (HAVE_MMX2 && VAR_0 & AV_CPU_FLAG_MMX2)\ngf->filter_line = gradfun_filter_line_mmx2;", "if (HAVE_SSSE3 && VAR_0 & AV_CPU_FLAG_SSSE3)\ngf->filter_line = gradfun_filter_line_ssse3;", "if (HAVE_SSE && VAR_0 & AV_CPU_FLAG_SSE2)\ngf->blur_line = gradfun_blur_line_sse2;", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11 ], [ 13, 15 ], [ 17, 19 ], [ 21 ] ]
14,953
static int ioreq_map(struct ioreq *ioreq) { int gnt = ioreq->blkdev->xendev.gnttabdev; int i; if (ioreq->v.niov == 0) { return 0; } if (batch_maps) { ioreq->pages = xc_gnttab_map_grant_refs (gnt, ioreq->v.niov, ioreq->domids, ioreq->refs, ioreq->prot); if (ioreq->pages == NULL) { xen_be_printf(&ioreq->blkdev->xendev, 0, "can't map %d grant refs (%s, %d maps)\n", ioreq->v.niov, strerror(errno), ioreq->blkdev->cnt_map); return -1; } for (i = 0; i < ioreq->v.niov; i++) { ioreq->v.iov[i].iov_base = ioreq->pages + i * XC_PAGE_SIZE + (uintptr_t)ioreq->v.iov[i].iov_base; } ioreq->blkdev->cnt_map += ioreq->v.niov; } else { for (i = 0; i < ioreq->v.niov; i++) { ioreq->page[i] = xc_gnttab_map_grant_ref (gnt, ioreq->domids[i], ioreq->refs[i], ioreq->prot); if (ioreq->page[i] == NULL) { xen_be_printf(&ioreq->blkdev->xendev, 0, "can't map grant ref %d (%s, %d maps)\n", ioreq->refs[i], strerror(errno), ioreq->blkdev->cnt_map); ioreq_unmap(ioreq); return -1; } ioreq->v.iov[i].iov_base = ioreq->page[i] + (uintptr_t)ioreq->v.iov[i].iov_base; ioreq->blkdev->cnt_map++; } } return 0; }
false
qemu
d5b93ddfefe63d5869a8eb97ea3474867d3b105b
static int ioreq_map(struct ioreq *ioreq) { int gnt = ioreq->blkdev->xendev.gnttabdev; int i; if (ioreq->v.niov == 0) { return 0; } if (batch_maps) { ioreq->pages = xc_gnttab_map_grant_refs (gnt, ioreq->v.niov, ioreq->domids, ioreq->refs, ioreq->prot); if (ioreq->pages == NULL) { xen_be_printf(&ioreq->blkdev->xendev, 0, "can't map %d grant refs (%s, %d maps)\n", ioreq->v.niov, strerror(errno), ioreq->blkdev->cnt_map); return -1; } for (i = 0; i < ioreq->v.niov; i++) { ioreq->v.iov[i].iov_base = ioreq->pages + i * XC_PAGE_SIZE + (uintptr_t)ioreq->v.iov[i].iov_base; } ioreq->blkdev->cnt_map += ioreq->v.niov; } else { for (i = 0; i < ioreq->v.niov; i++) { ioreq->page[i] = xc_gnttab_map_grant_ref (gnt, ioreq->domids[i], ioreq->refs[i], ioreq->prot); if (ioreq->page[i] == NULL) { xen_be_printf(&ioreq->blkdev->xendev, 0, "can't map grant ref %d (%s, %d maps)\n", ioreq->refs[i], strerror(errno), ioreq->blkdev->cnt_map); ioreq_unmap(ioreq); return -1; } ioreq->v.iov[i].iov_base = ioreq->page[i] + (uintptr_t)ioreq->v.iov[i].iov_base; ioreq->blkdev->cnt_map++; } } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(struct VAR_0 *VAR_0) { int VAR_1 = VAR_0->blkdev->xendev.gnttabdev; int VAR_2; if (VAR_0->v.niov == 0) { return 0; } if (batch_maps) { VAR_0->pages = xc_gnttab_map_grant_refs (VAR_1, VAR_0->v.niov, VAR_0->domids, VAR_0->refs, VAR_0->prot); if (VAR_0->pages == NULL) { xen_be_printf(&VAR_0->blkdev->xendev, 0, "can't map %d grant refs (%s, %d maps)\n", VAR_0->v.niov, strerror(errno), VAR_0->blkdev->cnt_map); return -1; } for (VAR_2 = 0; VAR_2 < VAR_0->v.niov; VAR_2++) { VAR_0->v.iov[VAR_2].iov_base = VAR_0->pages + VAR_2 * XC_PAGE_SIZE + (uintptr_t)VAR_0->v.iov[VAR_2].iov_base; } VAR_0->blkdev->cnt_map += VAR_0->v.niov; } else { for (VAR_2 = 0; VAR_2 < VAR_0->v.niov; VAR_2++) { VAR_0->page[VAR_2] = xc_gnttab_map_grant_ref (VAR_1, VAR_0->domids[VAR_2], VAR_0->refs[VAR_2], VAR_0->prot); if (VAR_0->page[VAR_2] == NULL) { xen_be_printf(&VAR_0->blkdev->xendev, 0, "can't map grant ref %d (%s, %d maps)\n", VAR_0->refs[VAR_2], strerror(errno), VAR_0->blkdev->cnt_map); ioreq_unmap(VAR_0); return -1; } VAR_0->v.iov[VAR_2].iov_base = VAR_0->page[VAR_2] + (uintptr_t)VAR_0->v.iov[VAR_2].iov_base; VAR_0->blkdev->cnt_map++; } } return 0; }
[ "static int FUNC_0(struct VAR_0 *VAR_0)\n{", "int VAR_1 = VAR_0->blkdev->xendev.gnttabdev;", "int VAR_2;", "if (VAR_0->v.niov == 0) {", "return 0;", "}", "if (batch_maps) {", "VAR_0->pages = xc_gnttab_map_grant_refs\n(VAR_1, VAR_0->v.niov, VAR_0->domids, VAR_0->refs, VAR_0->prot);", "if (VAR_0->pages == NULL) {", "xen_be_printf(&VAR_0->blkdev->xendev, 0,\n\"can't map %d grant refs (%s, %d maps)\\n\",\nVAR_0->v.niov, strerror(errno), VAR_0->blkdev->cnt_map);", "return -1;", "}", "for (VAR_2 = 0; VAR_2 < VAR_0->v.niov; VAR_2++) {", "VAR_0->v.iov[VAR_2].iov_base = VAR_0->pages + VAR_2 * XC_PAGE_SIZE +\n(uintptr_t)VAR_0->v.iov[VAR_2].iov_base;", "}", "VAR_0->blkdev->cnt_map += VAR_0->v.niov;", "} else {", "for (VAR_2 = 0; VAR_2 < VAR_0->v.niov; VAR_2++) {", "VAR_0->page[VAR_2] = xc_gnttab_map_grant_ref\n(VAR_1, VAR_0->domids[VAR_2], VAR_0->refs[VAR_2], VAR_0->prot);", "if (VAR_0->page[VAR_2] == NULL) {", "xen_be_printf(&VAR_0->blkdev->xendev, 0,\n\"can't map grant ref %d (%s, %d maps)\\n\",\nVAR_0->refs[VAR_2], strerror(errno), VAR_0->blkdev->cnt_map);", "ioreq_unmap(VAR_0);", "return -1;", "}", "VAR_0->v.iov[VAR_2].iov_base = VAR_0->page[VAR_2] + (uintptr_t)VAR_0->v.iov[VAR_2].iov_base;", "VAR_0->blkdev->cnt_map++;", "}", "}", "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 ], [ 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 ] ]
14,954
static CharDriverState *qemu_chr_open_ringbuf(ChardevRingbuf *opts, Error **errp) { CharDriverState *chr; RingBufCharDriver *d; chr = g_malloc0(sizeof(CharDriverState)); d = g_malloc(sizeof(*d)); d->size = opts->has_size ? opts->size : 65536; /* The size must be power of 2 */ if (d->size & (d->size - 1)) { error_setg(errp, "size of ringbuf chardev must be power of two"); goto fail; } d->prod = 0; d->cons = 0; d->cbuf = g_malloc0(d->size); chr->opaque = d; chr->chr_write = ringbuf_chr_write; chr->chr_close = ringbuf_chr_close; return chr; fail: g_free(d); g_free(chr); return NULL; }
false
qemu
db39fcf1f690b02d612e2bfc00980700887abe03
static CharDriverState *qemu_chr_open_ringbuf(ChardevRingbuf *opts, Error **errp) { CharDriverState *chr; RingBufCharDriver *d; chr = g_malloc0(sizeof(CharDriverState)); d = g_malloc(sizeof(*d)); d->size = opts->has_size ? opts->size : 65536; if (d->size & (d->size - 1)) { error_setg(errp, "size of ringbuf chardev must be power of two"); goto fail; } d->prod = 0; d->cons = 0; d->cbuf = g_malloc0(d->size); chr->opaque = d; chr->chr_write = ringbuf_chr_write; chr->chr_close = ringbuf_chr_close; return chr; fail: g_free(d); g_free(chr); return NULL; }
{ "code": [], "line_no": [] }
static CharDriverState *FUNC_0(ChardevRingbuf *opts, Error **errp) { CharDriverState *chr; RingBufCharDriver *d; chr = g_malloc0(sizeof(CharDriverState)); d = g_malloc(sizeof(*d)); d->size = opts->has_size ? opts->size : 65536; if (d->size & (d->size - 1)) { error_setg(errp, "size of ringbuf chardev must be power of two"); goto fail; } d->prod = 0; d->cons = 0; d->cbuf = g_malloc0(d->size); chr->opaque = d; chr->chr_write = ringbuf_chr_write; chr->chr_close = ringbuf_chr_close; return chr; fail: g_free(d); g_free(chr); return NULL; }
[ "static CharDriverState *FUNC_0(ChardevRingbuf *opts,\nError **errp)\n{", "CharDriverState *chr;", "RingBufCharDriver *d;", "chr = g_malloc0(sizeof(CharDriverState));", "d = g_malloc(sizeof(*d));", "d->size = opts->has_size ? opts->size : 65536;", "if (d->size & (d->size - 1)) {", "error_setg(errp, \"size of ringbuf chardev must be power of two\");", "goto fail;", "}", "d->prod = 0;", "d->cons = 0;", "d->cbuf = g_malloc0(d->size);", "chr->opaque = d;", "chr->chr_write = ringbuf_chr_write;", "chr->chr_close = ringbuf_chr_close;", "return chr;", "fail:\ng_free(d);", "g_free(chr);", "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 ], [ 19 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 55, 57 ], [ 59 ], [ 61 ], [ 63 ] ]
14,955
static void mcf_fec_write(void *opaque, hwaddr addr, uint64_t value, unsigned size) { mcf_fec_state *s = (mcf_fec_state *)opaque; switch (addr & 0x3ff) { case 0x004: s->eir &= ~value; break; case 0x008: s->eimr = value; break; case 0x010: /* RDAR */ if ((s->ecr & FEC_EN) && !s->rx_enabled) { DPRINTF("RX enable\n"); mcf_fec_enable_rx(s); } break; case 0x014: /* TDAR */ if (s->ecr & FEC_EN) { mcf_fec_do_tx(s); } break; case 0x024: s->ecr = value; if (value & FEC_RESET) { DPRINTF("Reset\n"); mcf_fec_reset(s); } if ((s->ecr & FEC_EN) == 0) { s->rx_enabled = 0; } break; case 0x040: s->mmfr = value; s->eir |= FEC_INT_MII; break; case 0x044: s->mscr = value & 0xfe; break; case 0x064: /* TODO: Implement MIB. */ break; case 0x084: s->rcr = value & 0x07ff003f; /* TODO: Implement LOOP mode. */ break; case 0x0c4: /* TCR */ /* We transmit immediately, so raise GRA immediately. */ s->tcr = value; if (value & 1) s->eir |= FEC_INT_GRA; break; case 0x0e4: /* PALR */ s->conf.macaddr.a[0] = value >> 24; s->conf.macaddr.a[1] = value >> 16; s->conf.macaddr.a[2] = value >> 8; s->conf.macaddr.a[3] = value; break; case 0x0e8: /* PAUR */ s->conf.macaddr.a[4] = value >> 24; s->conf.macaddr.a[5] = value >> 16; break; case 0x0ec: /* OPD */ break; case 0x118: case 0x11c: case 0x120: case 0x124: /* TODO: implement MAC hash filtering. */ break; case 0x144: s->tfwr = value & 3; break; case 0x14c: /* FRBR writes ignored. */ break; case 0x150: s->rfsr = (value & 0x3fc) | 0x400; break; case 0x180: s->erdsr = value & ~3; s->rx_descriptor = s->erdsr; break; case 0x184: s->etdsr = value & ~3; s->tx_descriptor = s->etdsr; break; case 0x188: s->emrbr = value & 0x7f0; break; default: hw_error("mcf_fec_write Bad address 0x%x\n", (int)addr); } mcf_fec_update(s); }
false
qemu
77d54985b85a0cb760330ec2bd92505e0a2a97a9
static void mcf_fec_write(void *opaque, hwaddr addr, uint64_t value, unsigned size) { mcf_fec_state *s = (mcf_fec_state *)opaque; switch (addr & 0x3ff) { case 0x004: s->eir &= ~value; break; case 0x008: s->eimr = value; break; case 0x010: if ((s->ecr & FEC_EN) && !s->rx_enabled) { DPRINTF("RX enable\n"); mcf_fec_enable_rx(s); } break; case 0x014: if (s->ecr & FEC_EN) { mcf_fec_do_tx(s); } break; case 0x024: s->ecr = value; if (value & FEC_RESET) { DPRINTF("Reset\n"); mcf_fec_reset(s); } if ((s->ecr & FEC_EN) == 0) { s->rx_enabled = 0; } break; case 0x040: s->mmfr = value; s->eir |= FEC_INT_MII; break; case 0x044: s->mscr = value & 0xfe; break; case 0x064: break; case 0x084: s->rcr = value & 0x07ff003f; break; case 0x0c4: s->tcr = value; if (value & 1) s->eir |= FEC_INT_GRA; break; case 0x0e4: s->conf.macaddr.a[0] = value >> 24; s->conf.macaddr.a[1] = value >> 16; s->conf.macaddr.a[2] = value >> 8; s->conf.macaddr.a[3] = value; break; case 0x0e8: s->conf.macaddr.a[4] = value >> 24; s->conf.macaddr.a[5] = value >> 16; break; case 0x0ec: break; case 0x118: case 0x11c: case 0x120: case 0x124: break; case 0x144: s->tfwr = value & 3; break; case 0x14c: break; case 0x150: s->rfsr = (value & 0x3fc) | 0x400; break; case 0x180: s->erdsr = value & ~3; s->rx_descriptor = s->erdsr; break; case 0x184: s->etdsr = value & ~3; s->tx_descriptor = s->etdsr; break; case 0x188: s->emrbr = value & 0x7f0; break; default: hw_error("mcf_fec_write Bad address 0x%x\n", (int)addr); } mcf_fec_update(s); }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, hwaddr VAR_1, uint64_t VAR_2, unsigned VAR_3) { mcf_fec_state *s = (mcf_fec_state *)VAR_0; switch (VAR_1 & 0x3ff) { case 0x004: s->eir &= ~VAR_2; break; case 0x008: s->eimr = VAR_2; break; case 0x010: if ((s->ecr & FEC_EN) && !s->rx_enabled) { DPRINTF("RX enable\n"); mcf_fec_enable_rx(s); } break; case 0x014: if (s->ecr & FEC_EN) { mcf_fec_do_tx(s); } break; case 0x024: s->ecr = VAR_2; if (VAR_2 & FEC_RESET) { DPRINTF("Reset\n"); mcf_fec_reset(s); } if ((s->ecr & FEC_EN) == 0) { s->rx_enabled = 0; } break; case 0x040: s->mmfr = VAR_2; s->eir |= FEC_INT_MII; break; case 0x044: s->mscr = VAR_2 & 0xfe; break; case 0x064: break; case 0x084: s->rcr = VAR_2 & 0x07ff003f; break; case 0x0c4: s->tcr = VAR_2; if (VAR_2 & 1) s->eir |= FEC_INT_GRA; break; case 0x0e4: s->conf.macaddr.a[0] = VAR_2 >> 24; s->conf.macaddr.a[1] = VAR_2 >> 16; s->conf.macaddr.a[2] = VAR_2 >> 8; s->conf.macaddr.a[3] = VAR_2; break; case 0x0e8: s->conf.macaddr.a[4] = VAR_2 >> 24; s->conf.macaddr.a[5] = VAR_2 >> 16; break; case 0x0ec: break; case 0x118: case 0x11c: case 0x120: case 0x124: break; case 0x144: s->tfwr = VAR_2 & 3; break; case 0x14c: break; case 0x150: s->rfsr = (VAR_2 & 0x3fc) | 0x400; break; case 0x180: s->erdsr = VAR_2 & ~3; s->rx_descriptor = s->erdsr; break; case 0x184: s->etdsr = VAR_2 & ~3; s->tx_descriptor = s->etdsr; break; case 0x188: s->emrbr = VAR_2 & 0x7f0; break; default: hw_error("FUNC_0 Bad address 0x%x\n", (int)VAR_1); } mcf_fec_update(s); }
[ "static void FUNC_0(void *VAR_0, hwaddr VAR_1,\nuint64_t VAR_2, unsigned VAR_3)\n{", "mcf_fec_state *s = (mcf_fec_state *)VAR_0;", "switch (VAR_1 & 0x3ff) {", "case 0x004:\ns->eir &= ~VAR_2;", "break;", "case 0x008:\ns->eimr = VAR_2;", "break;", "case 0x010:\nif ((s->ecr & FEC_EN) && !s->rx_enabled) {", "DPRINTF(\"RX enable\\n\");", "mcf_fec_enable_rx(s);", "}", "break;", "case 0x014:\nif (s->ecr & FEC_EN) {", "mcf_fec_do_tx(s);", "}", "break;", "case 0x024:\ns->ecr = VAR_2;", "if (VAR_2 & FEC_RESET) {", "DPRINTF(\"Reset\\n\");", "mcf_fec_reset(s);", "}", "if ((s->ecr & FEC_EN) == 0) {", "s->rx_enabled = 0;", "}", "break;", "case 0x040:\ns->mmfr = VAR_2;", "s->eir |= FEC_INT_MII;", "break;", "case 0x044:\ns->mscr = VAR_2 & 0xfe;", "break;", "case 0x064:\nbreak;", "case 0x084:\ns->rcr = VAR_2 & 0x07ff003f;", "break;", "case 0x0c4:\ns->tcr = VAR_2;", "if (VAR_2 & 1)\ns->eir |= FEC_INT_GRA;", "break;", "case 0x0e4:\ns->conf.macaddr.a[0] = VAR_2 >> 24;", "s->conf.macaddr.a[1] = VAR_2 >> 16;", "s->conf.macaddr.a[2] = VAR_2 >> 8;", "s->conf.macaddr.a[3] = VAR_2;", "break;", "case 0x0e8:\ns->conf.macaddr.a[4] = VAR_2 >> 24;", "s->conf.macaddr.a[5] = VAR_2 >> 16;", "break;", "case 0x0ec:\nbreak;", "case 0x118:\ncase 0x11c:\ncase 0x120:\ncase 0x124:\nbreak;", "case 0x144:\ns->tfwr = VAR_2 & 3;", "break;", "case 0x14c:\nbreak;", "case 0x150:\ns->rfsr = (VAR_2 & 0x3fc) | 0x400;", "break;", "case 0x180:\ns->erdsr = VAR_2 & ~3;", "s->rx_descriptor = s->erdsr;", "break;", "case 0x184:\ns->etdsr = VAR_2 & ~3;", "s->tx_descriptor = s->etdsr;", "break;", "case 0x188:\ns->emrbr = VAR_2 & 0x7f0;", "break;", "default:\nhw_error(\"FUNC_0 Bad address 0x%x\\n\", (int)VAR_1);", "}", "mcf_fec_update(s);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 83 ], [ 85, 87 ], [ 91 ], [ 93, 97 ], [ 99, 101 ], [ 103 ], [ 105, 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117, 119 ], [ 121 ], [ 123 ], [ 125, 129 ], [ 131, 133, 135, 137, 141 ], [ 143, 145 ], [ 147 ], [ 149, 153 ], [ 155, 157 ], [ 159 ], [ 161, 163 ], [ 165 ], [ 167 ], [ 169, 171 ], [ 173 ], [ 175 ], [ 177, 179 ], [ 181 ], [ 183, 185 ], [ 187 ], [ 189 ], [ 191 ] ]
14,956
static int vmdk_open_vmdk4(BlockDriverState *bs, BlockDriverState *file, int flags) { int ret; uint32_t magic; uint32_t l1_size, l1_entry_sectors; VMDK4Header header; VmdkExtent *extent; int64_t l1_backup_offset = 0; ret = bdrv_pread(file, sizeof(magic), &header, sizeof(header)); if (ret < 0) { return ret; } if (header.capacity == 0) { uint64_t desc_offset = le64_to_cpu(header.desc_offset); if (desc_offset) { return vmdk_open_desc_file(bs, flags, desc_offset << 9); } } if (le64_to_cpu(header.gd_offset) == VMDK4_GD_AT_END) { /* * The footer takes precedence over the header, so read it in. The * footer starts at offset -1024 from the end: One sector for the * footer, and another one for the end-of-stream marker. */ struct { struct { uint64_t val; uint32_t size; uint32_t type; uint8_t pad[512 - 16]; } QEMU_PACKED footer_marker; uint32_t magic; VMDK4Header header; uint8_t pad[512 - 4 - sizeof(VMDK4Header)]; struct { uint64_t val; uint32_t size; uint32_t type; uint8_t pad[512 - 16]; } QEMU_PACKED eos_marker; } QEMU_PACKED footer; ret = bdrv_pread(file, bs->file->total_sectors * 512 - 1536, &footer, sizeof(footer)); if (ret < 0) { return ret; } /* Some sanity checks for the footer */ if (be32_to_cpu(footer.magic) != VMDK4_MAGIC || le32_to_cpu(footer.footer_marker.size) != 0 || le32_to_cpu(footer.footer_marker.type) != MARKER_FOOTER || le64_to_cpu(footer.eos_marker.val) != 0 || le32_to_cpu(footer.eos_marker.size) != 0 || le32_to_cpu(footer.eos_marker.type) != MARKER_END_OF_STREAM) { return -EINVAL; } header = footer.header; } if (le32_to_cpu(header.version) >= 3) { char buf[64]; snprintf(buf, sizeof(buf), "VMDK version %d", le32_to_cpu(header.version)); qerror_report(QERR_UNKNOWN_BLOCK_FORMAT_FEATURE, bs->device_name, "vmdk", buf); return -ENOTSUP; } l1_entry_sectors = le32_to_cpu(header.num_gtes_per_gte) * le64_to_cpu(header.granularity); if (l1_entry_sectors == 0) { return -EINVAL; } l1_size = (le64_to_cpu(header.capacity) + l1_entry_sectors - 1) / l1_entry_sectors; if (le32_to_cpu(header.flags) & VMDK4_FLAG_RGD) { l1_backup_offset = le64_to_cpu(header.rgd_offset) << 9; } extent = vmdk_add_extent(bs, file, false, le64_to_cpu(header.capacity), le64_to_cpu(header.gd_offset) << 9, l1_backup_offset, l1_size, le32_to_cpu(header.num_gtes_per_gte), le64_to_cpu(header.granularity)); extent->compressed = le16_to_cpu(header.compressAlgorithm) == VMDK4_COMPRESSION_DEFLATE; extent->has_marker = le32_to_cpu(header.flags) & VMDK4_FLAG_MARKER; extent->version = le32_to_cpu(header.version); extent->has_zero_grain = le32_to_cpu(header.flags) & VMDK4_FLAG_ZERO_GRAIN; ret = vmdk_init_tables(bs, extent); if (ret) { /* free extent allocated by vmdk_add_extent */ vmdk_free_last_extent(bs); } return ret; }
false
qemu
8aa1331c09a9b899f48d97f097bb49b7d458be1c
static int vmdk_open_vmdk4(BlockDriverState *bs, BlockDriverState *file, int flags) { int ret; uint32_t magic; uint32_t l1_size, l1_entry_sectors; VMDK4Header header; VmdkExtent *extent; int64_t l1_backup_offset = 0; ret = bdrv_pread(file, sizeof(magic), &header, sizeof(header)); if (ret < 0) { return ret; } if (header.capacity == 0) { uint64_t desc_offset = le64_to_cpu(header.desc_offset); if (desc_offset) { return vmdk_open_desc_file(bs, flags, desc_offset << 9); } } if (le64_to_cpu(header.gd_offset) == VMDK4_GD_AT_END) { struct { struct { uint64_t val; uint32_t size; uint32_t type; uint8_t pad[512 - 16]; } QEMU_PACKED footer_marker; uint32_t magic; VMDK4Header header; uint8_t pad[512 - 4 - sizeof(VMDK4Header)]; struct { uint64_t val; uint32_t size; uint32_t type; uint8_t pad[512 - 16]; } QEMU_PACKED eos_marker; } QEMU_PACKED footer; ret = bdrv_pread(file, bs->file->total_sectors * 512 - 1536, &footer, sizeof(footer)); if (ret < 0) { return ret; } if (be32_to_cpu(footer.magic) != VMDK4_MAGIC || le32_to_cpu(footer.footer_marker.size) != 0 || le32_to_cpu(footer.footer_marker.type) != MARKER_FOOTER || le64_to_cpu(footer.eos_marker.val) != 0 || le32_to_cpu(footer.eos_marker.size) != 0 || le32_to_cpu(footer.eos_marker.type) != MARKER_END_OF_STREAM) { return -EINVAL; } header = footer.header; } if (le32_to_cpu(header.version) >= 3) { char buf[64]; snprintf(buf, sizeof(buf), "VMDK version %d", le32_to_cpu(header.version)); qerror_report(QERR_UNKNOWN_BLOCK_FORMAT_FEATURE, bs->device_name, "vmdk", buf); return -ENOTSUP; } l1_entry_sectors = le32_to_cpu(header.num_gtes_per_gte) * le64_to_cpu(header.granularity); if (l1_entry_sectors == 0) { return -EINVAL; } l1_size = (le64_to_cpu(header.capacity) + l1_entry_sectors - 1) / l1_entry_sectors; if (le32_to_cpu(header.flags) & VMDK4_FLAG_RGD) { l1_backup_offset = le64_to_cpu(header.rgd_offset) << 9; } extent = vmdk_add_extent(bs, file, false, le64_to_cpu(header.capacity), le64_to_cpu(header.gd_offset) << 9, l1_backup_offset, l1_size, le32_to_cpu(header.num_gtes_per_gte), le64_to_cpu(header.granularity)); extent->compressed = le16_to_cpu(header.compressAlgorithm) == VMDK4_COMPRESSION_DEFLATE; extent->has_marker = le32_to_cpu(header.flags) & VMDK4_FLAG_MARKER; extent->version = le32_to_cpu(header.version); extent->has_zero_grain = le32_to_cpu(header.flags) & VMDK4_FLAG_ZERO_GRAIN; ret = vmdk_init_tables(bs, extent); if (ret) { vmdk_free_last_extent(bs); } return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(BlockDriverState *VAR_0, BlockDriverState *VAR_1, int VAR_2) { int VAR_3; uint32_t magic; uint32_t l1_size, l1_entry_sectors; VMDK4Header header; VmdkExtent *extent; int64_t l1_backup_offset = 0; VAR_3 = bdrv_pread(VAR_1, sizeof(magic), &header, sizeof(header)); if (VAR_3 < 0) { return VAR_3; } if (header.capacity == 0) { uint64_t desc_offset = le64_to_cpu(header.desc_offset); if (desc_offset) { return vmdk_open_desc_file(VAR_0, VAR_2, desc_offset << 9); } } if (le64_to_cpu(header.gd_offset) == VMDK4_GD_AT_END) { struct { struct { uint64_t val; uint32_t size; uint32_t type; uint8_t pad[512 - 16]; } QEMU_PACKED footer_marker; uint32_t magic; VMDK4Header header; uint8_t pad[512 - 4 - sizeof(VMDK4Header)]; struct { uint64_t val; uint32_t size; uint32_t type; uint8_t pad[512 - 16]; } QEMU_PACKED eos_marker; } QEMU_PACKED VAR_4; VAR_3 = bdrv_pread(VAR_1, VAR_0->VAR_1->total_sectors * 512 - 1536, &VAR_4, sizeof(VAR_4)); if (VAR_3 < 0) { return VAR_3; } if (be32_to_cpu(VAR_4.magic) != VMDK4_MAGIC || le32_to_cpu(VAR_4.footer_marker.size) != 0 || le32_to_cpu(VAR_4.footer_marker.type) != MARKER_FOOTER || le64_to_cpu(VAR_4.eos_marker.val) != 0 || le32_to_cpu(VAR_4.eos_marker.size) != 0 || le32_to_cpu(VAR_4.eos_marker.type) != MARKER_END_OF_STREAM) { return -EINVAL; } header = VAR_4.header; } if (le32_to_cpu(header.version) >= 3) { char VAR_5[64]; snprintf(VAR_5, sizeof(VAR_5), "VMDK version %d", le32_to_cpu(header.version)); qerror_report(QERR_UNKNOWN_BLOCK_FORMAT_FEATURE, VAR_0->device_name, "vmdk", VAR_5); return -ENOTSUP; } l1_entry_sectors = le32_to_cpu(header.num_gtes_per_gte) * le64_to_cpu(header.granularity); if (l1_entry_sectors == 0) { return -EINVAL; } l1_size = (le64_to_cpu(header.capacity) + l1_entry_sectors - 1) / l1_entry_sectors; if (le32_to_cpu(header.VAR_2) & VMDK4_FLAG_RGD) { l1_backup_offset = le64_to_cpu(header.rgd_offset) << 9; } extent = vmdk_add_extent(VAR_0, VAR_1, false, le64_to_cpu(header.capacity), le64_to_cpu(header.gd_offset) << 9, l1_backup_offset, l1_size, le32_to_cpu(header.num_gtes_per_gte), le64_to_cpu(header.granularity)); extent->compressed = le16_to_cpu(header.compressAlgorithm) == VMDK4_COMPRESSION_DEFLATE; extent->has_marker = le32_to_cpu(header.VAR_2) & VMDK4_FLAG_MARKER; extent->version = le32_to_cpu(header.version); extent->has_zero_grain = le32_to_cpu(header.VAR_2) & VMDK4_FLAG_ZERO_GRAIN; VAR_3 = vmdk_init_tables(VAR_0, extent); if (VAR_3) { vmdk_free_last_extent(VAR_0); } return VAR_3; }
[ "static int FUNC_0(BlockDriverState *VAR_0,\nBlockDriverState *VAR_1,\nint VAR_2)\n{", "int VAR_3;", "uint32_t magic;", "uint32_t l1_size, l1_entry_sectors;", "VMDK4Header header;", "VmdkExtent *extent;", "int64_t l1_backup_offset = 0;", "VAR_3 = bdrv_pread(VAR_1, sizeof(magic), &header, sizeof(header));", "if (VAR_3 < 0) {", "return VAR_3;", "}", "if (header.capacity == 0) {", "uint64_t desc_offset = le64_to_cpu(header.desc_offset);", "if (desc_offset) {", "return vmdk_open_desc_file(VAR_0, VAR_2, desc_offset << 9);", "}", "}", "if (le64_to_cpu(header.gd_offset) == VMDK4_GD_AT_END) {", "struct {", "struct {", "uint64_t val;", "uint32_t size;", "uint32_t type;", "uint8_t pad[512 - 16];", "} QEMU_PACKED footer_marker;", "uint32_t magic;", "VMDK4Header header;", "uint8_t pad[512 - 4 - sizeof(VMDK4Header)];", "struct {", "uint64_t val;", "uint32_t size;", "uint32_t type;", "uint8_t pad[512 - 16];", "} QEMU_PACKED eos_marker;", "} QEMU_PACKED VAR_4;", "VAR_3 = bdrv_pread(VAR_1,\nVAR_0->VAR_1->total_sectors * 512 - 1536,\n&VAR_4, sizeof(VAR_4));", "if (VAR_3 < 0) {", "return VAR_3;", "}", "if (be32_to_cpu(VAR_4.magic) != VMDK4_MAGIC ||\nle32_to_cpu(VAR_4.footer_marker.size) != 0 ||\nle32_to_cpu(VAR_4.footer_marker.type) != MARKER_FOOTER ||\nle64_to_cpu(VAR_4.eos_marker.val) != 0 ||\nle32_to_cpu(VAR_4.eos_marker.size) != 0 ||\nle32_to_cpu(VAR_4.eos_marker.type) != MARKER_END_OF_STREAM)\n{", "return -EINVAL;", "}", "header = VAR_4.header;", "}", "if (le32_to_cpu(header.version) >= 3) {", "char VAR_5[64];", "snprintf(VAR_5, sizeof(VAR_5), \"VMDK version %d\",\nle32_to_cpu(header.version));", "qerror_report(QERR_UNKNOWN_BLOCK_FORMAT_FEATURE,\nVAR_0->device_name, \"vmdk\", VAR_5);", "return -ENOTSUP;", "}", "l1_entry_sectors = le32_to_cpu(header.num_gtes_per_gte)\n* le64_to_cpu(header.granularity);", "if (l1_entry_sectors == 0) {", "return -EINVAL;", "}", "l1_size = (le64_to_cpu(header.capacity) + l1_entry_sectors - 1)\n/ l1_entry_sectors;", "if (le32_to_cpu(header.VAR_2) & VMDK4_FLAG_RGD) {", "l1_backup_offset = le64_to_cpu(header.rgd_offset) << 9;", "}", "extent = vmdk_add_extent(VAR_0, VAR_1, false,\nle64_to_cpu(header.capacity),\nle64_to_cpu(header.gd_offset) << 9,\nl1_backup_offset,\nl1_size,\nle32_to_cpu(header.num_gtes_per_gte),\nle64_to_cpu(header.granularity));", "extent->compressed =\nle16_to_cpu(header.compressAlgorithm) == VMDK4_COMPRESSION_DEFLATE;", "extent->has_marker = le32_to_cpu(header.VAR_2) & VMDK4_FLAG_MARKER;", "extent->version = le32_to_cpu(header.version);", "extent->has_zero_grain = le32_to_cpu(header.VAR_2) & VMDK4_FLAG_ZERO_GRAIN;", "VAR_3 = vmdk_init_tables(VAR_0, extent);", "if (VAR_3) {", "vmdk_free_last_extent(VAR_0);", "}", "return VAR_3;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 97, 99, 101 ], [ 103 ], [ 105 ], [ 107 ], [ 113, 115, 117, 119, 121, 123, 125 ], [ 127 ], [ 129 ], [ 133 ], [ 135 ], [ 139 ], [ 141 ], [ 143, 145 ], [ 147, 149 ], [ 151 ], [ 153 ], [ 157, 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167, 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177, 179, 181, 183, 185, 187, 189 ], [ 191, 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ] ]
14,957
int bdrv_write_zeroes(BlockDriverState *bs, int64_t sector_num, int nb_sectors, BdrvRequestFlags flags) { return bdrv_rw_co(bs, sector_num, NULL, nb_sectors, true, BDRV_REQ_ZERO_WRITE | flags); }
false
qemu
61007b316cd71ee7333ff7a0a749a8949527575f
int bdrv_write_zeroes(BlockDriverState *bs, int64_t sector_num, int nb_sectors, BdrvRequestFlags flags) { return bdrv_rw_co(bs, sector_num, NULL, nb_sectors, true, BDRV_REQ_ZERO_WRITE | flags); }
{ "code": [], "line_no": [] }
int FUNC_0(BlockDriverState *VAR_0, int64_t VAR_1, int VAR_2, BdrvRequestFlags VAR_3) { return bdrv_rw_co(VAR_0, VAR_1, NULL, VAR_2, true, BDRV_REQ_ZERO_WRITE | VAR_3); }
[ "int FUNC_0(BlockDriverState *VAR_0, int64_t VAR_1,\nint VAR_2, BdrvRequestFlags VAR_3)\n{", "return bdrv_rw_co(VAR_0, VAR_1, NULL, VAR_2, true,\nBDRV_REQ_ZERO_WRITE | VAR_3);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7, 9 ], [ 11 ] ]
14,959
static char *usb_get_fw_dev_path(DeviceState *qdev) { USBDevice *dev = DO_UPCAST(USBDevice, qdev, qdev); char *fw_path, *in; int pos = 0; long nr; fw_path = qemu_malloc(32 + strlen(dev->port->path) * 6); in = dev->port->path; while (true) { nr = strtol(in, &in, 10); if (in[0] == '.') { /* some hub between root port and device */ pos += sprintf(fw_path + pos, "hub@%ld/", nr); in++; } else { /* the device itself */ pos += sprintf(fw_path + pos, "%s@%ld", qdev_fw_name(qdev), nr); break; } } return fw_path; }
false
qemu
ea87e95f8fda609fa665c2abd33c30ae65e6fae2
static char *usb_get_fw_dev_path(DeviceState *qdev) { USBDevice *dev = DO_UPCAST(USBDevice, qdev, qdev); char *fw_path, *in; int pos = 0; long nr; fw_path = qemu_malloc(32 + strlen(dev->port->path) * 6); in = dev->port->path; while (true) { nr = strtol(in, &in, 10); if (in[0] == '.') { pos += sprintf(fw_path + pos, "hub@%ld/", nr); in++; } else { pos += sprintf(fw_path + pos, "%s@%ld", qdev_fw_name(qdev), nr); break; } } return fw_path; }
{ "code": [], "line_no": [] }
static char *FUNC_0(DeviceState *VAR_0) { USBDevice *dev = DO_UPCAST(USBDevice, VAR_0, VAR_0); char *VAR_1, *VAR_2; int VAR_3 = 0; long VAR_4; VAR_1 = qemu_malloc(32 + strlen(dev->port->path) * 6); VAR_2 = dev->port->path; while (true) { VAR_4 = strtol(VAR_2, &VAR_2, 10); if (VAR_2[0] == '.') { VAR_3 += sprintf(VAR_1 + VAR_3, "hub@%ld/", VAR_4); VAR_2++; } else { VAR_3 += sprintf(VAR_1 + VAR_3, "%s@%ld", qdev_fw_name(VAR_0), VAR_4); break; } } return VAR_1; }
[ "static char *FUNC_0(DeviceState *VAR_0)\n{", "USBDevice *dev = DO_UPCAST(USBDevice, VAR_0, VAR_0);", "char *VAR_1, *VAR_2;", "int VAR_3 = 0;", "long VAR_4;", "VAR_1 = qemu_malloc(32 + strlen(dev->port->path) * 6);", "VAR_2 = dev->port->path;", "while (true) {", "VAR_4 = strtol(VAR_2, &VAR_2, 10);", "if (VAR_2[0] == '.') {", "VAR_3 += sprintf(VAR_1 + VAR_3, \"hub@%ld/\", VAR_4);", "VAR_2++;", "} else {", "VAR_3 += sprintf(VAR_1 + VAR_3, \"%s@%ld\", qdev_fw_name(VAR_0), VAR_4);", "break;", "}", "}", "return 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 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ] ]
14,960
static void arm_sysctl_write(void *opaque, target_phys_addr_t offset, uint64_t val, unsigned size) { arm_sysctl_state *s = (arm_sysctl_state *)opaque; switch (offset) { case 0x08: /* LED */ s->leds = val; case 0x0c: /* OSC0 */ case 0x10: /* OSC1 */ case 0x14: /* OSC2 */ case 0x18: /* OSC3 */ case 0x1c: /* OSC4 */ /* ??? */ break; case 0x20: /* LOCK */ if (val == LOCK_VALUE) s->lockval = val; else s->lockval = val & 0x7fff; break; case 0x28: /* CFGDATA1 */ /* ??? Need to implement this. */ s->cfgdata1 = val; break; case 0x2c: /* CFGDATA2 */ /* ??? Need to implement this. */ s->cfgdata2 = val; break; case 0x30: /* FLAGSSET */ s->flags |= val; break; case 0x34: /* FLAGSCLR */ s->flags &= ~val; break; case 0x38: /* NVFLAGSSET */ s->nvflags |= val; break; case 0x3c: /* NVFLAGSCLR */ s->nvflags &= ~val; break; case 0x40: /* RESETCTL */ switch (board_id(s)) { case BOARD_ID_PB926: if (s->lockval == LOCK_VALUE) { s->resetlevel = val; if (val & 0x100) { qemu_system_reset_request(); } } break; case BOARD_ID_PBX: case BOARD_ID_PBA8: if (s->lockval == LOCK_VALUE) { s->resetlevel = val; if (val & 0x04) { qemu_system_reset_request(); } } break; case BOARD_ID_VEXPRESS: case BOARD_ID_EB: default: /* reserved: RAZ/WI */ break; } break; case 0x44: /* PCICTL */ /* nothing to do. */ break; case 0x4c: /* FLASH */ break; case 0x50: /* CLCD */ switch (board_id(s)) { case BOARD_ID_PB926: /* On 926 bits 13:8 are R/O, bits 1:0 control * the mux that defines how to interpret the PL110 * graphics format, and other bits are r/w but we * don't implement them to do anything. */ s->sys_clcd &= 0x3f00; s->sys_clcd |= val & ~0x3f00; qemu_set_irq(s->pl110_mux_ctrl, val & 3); break; case BOARD_ID_EB: /* The EB is the same except that there is no mux since * the EB has a PL111. */ s->sys_clcd &= 0x3f00; s->sys_clcd |= val & ~0x3f00; break; case BOARD_ID_PBA8: case BOARD_ID_PBX: /* On PBA8 and PBX bit 7 is r/w and all other bits * are either r/o or RAZ/WI. */ s->sys_clcd &= (1 << 7); s->sys_clcd |= val & ~(1 << 7); break; case BOARD_ID_VEXPRESS: default: /* On VExpress this register is unimplemented and will RAZ/WI */ break; } case 0x54: /* CLCDSER */ case 0x64: /* DMAPSR0 */ case 0x68: /* DMAPSR1 */ case 0x6c: /* DMAPSR2 */ case 0x70: /* IOSEL */ case 0x74: /* PLDCTL */ case 0x80: /* BUSID */ case 0x84: /* PROCID0 */ case 0x88: /* PROCID1 */ case 0x8c: /* OSCRESET0 */ case 0x90: /* OSCRESET1 */ case 0x94: /* OSCRESET2 */ case 0x98: /* OSCRESET3 */ case 0x9c: /* OSCRESET4 */ break; case 0xa0: /* SYS_CFGDATA */ if (board_id(s) != BOARD_ID_VEXPRESS) { goto bad_reg; } s->sys_cfgdata = val; return; case 0xa4: /* SYS_CFGCTRL */ if (board_id(s) != BOARD_ID_VEXPRESS) { goto bad_reg; } s->sys_cfgctrl = val & ~(3 << 18); s->sys_cfgstat = 1; /* complete */ switch (s->sys_cfgctrl) { case 0xc0800000: /* SYS_CFG_SHUTDOWN to motherboard */ qemu_system_shutdown_request(); break; case 0xc0900000: /* SYS_CFG_REBOOT to motherboard */ qemu_system_reset_request(); break; default: s->sys_cfgstat |= 2; /* error */ } return; case 0xa8: /* SYS_CFGSTAT */ if (board_id(s) != BOARD_ID_VEXPRESS) { goto bad_reg; } s->sys_cfgstat = val & 3; return; default: bad_reg: printf ("arm_sysctl_write: Bad register offset 0x%x\n", (int)offset); return; } }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static void arm_sysctl_write(void *opaque, target_phys_addr_t offset, uint64_t val, unsigned size) { arm_sysctl_state *s = (arm_sysctl_state *)opaque; switch (offset) { case 0x08: s->leds = val; case 0x0c: case 0x10: case 0x14: case 0x18: case 0x1c: break; case 0x20: if (val == LOCK_VALUE) s->lockval = val; else s->lockval = val & 0x7fff; break; case 0x28: s->cfgdata1 = val; break; case 0x2c: s->cfgdata2 = val; break; case 0x30: s->flags |= val; break; case 0x34: s->flags &= ~val; break; case 0x38: s->nvflags |= val; break; case 0x3c: s->nvflags &= ~val; break; case 0x40: switch (board_id(s)) { case BOARD_ID_PB926: if (s->lockval == LOCK_VALUE) { s->resetlevel = val; if (val & 0x100) { qemu_system_reset_request(); } } break; case BOARD_ID_PBX: case BOARD_ID_PBA8: if (s->lockval == LOCK_VALUE) { s->resetlevel = val; if (val & 0x04) { qemu_system_reset_request(); } } break; case BOARD_ID_VEXPRESS: case BOARD_ID_EB: default: break; } break; case 0x44: break; case 0x4c: break; case 0x50: switch (board_id(s)) { case BOARD_ID_PB926: s->sys_clcd &= 0x3f00; s->sys_clcd |= val & ~0x3f00; qemu_set_irq(s->pl110_mux_ctrl, val & 3); break; case BOARD_ID_EB: s->sys_clcd &= 0x3f00; s->sys_clcd |= val & ~0x3f00; break; case BOARD_ID_PBA8: case BOARD_ID_PBX: s->sys_clcd &= (1 << 7); s->sys_clcd |= val & ~(1 << 7); break; case BOARD_ID_VEXPRESS: default: break; } case 0x54: case 0x64: case 0x68: case 0x6c: case 0x70: case 0x74: case 0x80: case 0x84: case 0x88: case 0x8c: case 0x90: case 0x94: case 0x98: case 0x9c: break; case 0xa0: if (board_id(s) != BOARD_ID_VEXPRESS) { goto bad_reg; } s->sys_cfgdata = val; return; case 0xa4: if (board_id(s) != BOARD_ID_VEXPRESS) { goto bad_reg; } s->sys_cfgctrl = val & ~(3 << 18); s->sys_cfgstat = 1; switch (s->sys_cfgctrl) { case 0xc0800000: qemu_system_shutdown_request(); break; case 0xc0900000: qemu_system_reset_request(); break; default: s->sys_cfgstat |= 2; } return; case 0xa8: if (board_id(s) != BOARD_ID_VEXPRESS) { goto bad_reg; } s->sys_cfgstat = val & 3; return; default: bad_reg: printf ("arm_sysctl_write: Bad register offset 0x%x\n", (int)offset); return; } }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1, uint64_t VAR_2, unsigned VAR_3) { arm_sysctl_state *s = (arm_sysctl_state *)VAR_0; switch (VAR_1) { case 0x08: s->leds = VAR_2; case 0x0c: case 0x10: case 0x14: case 0x18: case 0x1c: break; case 0x20: if (VAR_2 == LOCK_VALUE) s->lockval = VAR_2; else s->lockval = VAR_2 & 0x7fff; break; case 0x28: s->cfgdata1 = VAR_2; break; case 0x2c: s->cfgdata2 = VAR_2; break; case 0x30: s->flags |= VAR_2; break; case 0x34: s->flags &= ~VAR_2; break; case 0x38: s->nvflags |= VAR_2; break; case 0x3c: s->nvflags &= ~VAR_2; break; case 0x40: switch (board_id(s)) { case BOARD_ID_PB926: if (s->lockval == LOCK_VALUE) { s->resetlevel = VAR_2; if (VAR_2 & 0x100) { qemu_system_reset_request(); } } break; case BOARD_ID_PBX: case BOARD_ID_PBA8: if (s->lockval == LOCK_VALUE) { s->resetlevel = VAR_2; if (VAR_2 & 0x04) { qemu_system_reset_request(); } } break; case BOARD_ID_VEXPRESS: case BOARD_ID_EB: default: break; } break; case 0x44: break; case 0x4c: break; case 0x50: switch (board_id(s)) { case BOARD_ID_PB926: s->sys_clcd &= 0x3f00; s->sys_clcd |= VAR_2 & ~0x3f00; qemu_set_irq(s->pl110_mux_ctrl, VAR_2 & 3); break; case BOARD_ID_EB: s->sys_clcd &= 0x3f00; s->sys_clcd |= VAR_2 & ~0x3f00; break; case BOARD_ID_PBA8: case BOARD_ID_PBX: s->sys_clcd &= (1 << 7); s->sys_clcd |= VAR_2 & ~(1 << 7); break; case BOARD_ID_VEXPRESS: default: break; } case 0x54: case 0x64: case 0x68: case 0x6c: case 0x70: case 0x74: case 0x80: case 0x84: case 0x88: case 0x8c: case 0x90: case 0x94: case 0x98: case 0x9c: break; case 0xa0: if (board_id(s) != BOARD_ID_VEXPRESS) { goto bad_reg; } s->sys_cfgdata = VAR_2; return; case 0xa4: if (board_id(s) != BOARD_ID_VEXPRESS) { goto bad_reg; } s->sys_cfgctrl = VAR_2 & ~(3 << 18); s->sys_cfgstat = 1; switch (s->sys_cfgctrl) { case 0xc0800000: qemu_system_shutdown_request(); break; case 0xc0900000: qemu_system_reset_request(); break; default: s->sys_cfgstat |= 2; } return; case 0xa8: if (board_id(s) != BOARD_ID_VEXPRESS) { goto bad_reg; } s->sys_cfgstat = VAR_2 & 3; return; default: bad_reg: printf ("FUNC_0: Bad register VAR_1 0x%x\n", (int)VAR_1); return; } }
[ "static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1,\nuint64_t VAR_2, unsigned VAR_3)\n{", "arm_sysctl_state *s = (arm_sysctl_state *)VAR_0;", "switch (VAR_1) {", "case 0x08:\ns->leds = VAR_2;", "case 0x0c:\ncase 0x10:\ncase 0x14:\ncase 0x18:\ncase 0x1c:\nbreak;", "case 0x20:\nif (VAR_2 == LOCK_VALUE)\ns->lockval = VAR_2;", "else\ns->lockval = VAR_2 & 0x7fff;", "break;", "case 0x28:\ns->cfgdata1 = VAR_2;", "break;", "case 0x2c:\ns->cfgdata2 = VAR_2;", "break;", "case 0x30:\ns->flags |= VAR_2;", "break;", "case 0x34:\ns->flags &= ~VAR_2;", "break;", "case 0x38:\ns->nvflags |= VAR_2;", "break;", "case 0x3c:\ns->nvflags &= ~VAR_2;", "break;", "case 0x40:\nswitch (board_id(s)) {", "case BOARD_ID_PB926:\nif (s->lockval == LOCK_VALUE) {", "s->resetlevel = VAR_2;", "if (VAR_2 & 0x100) {", "qemu_system_reset_request();", "}", "}", "break;", "case BOARD_ID_PBX:\ncase BOARD_ID_PBA8:\nif (s->lockval == LOCK_VALUE) {", "s->resetlevel = VAR_2;", "if (VAR_2 & 0x04) {", "qemu_system_reset_request();", "}", "}", "break;", "case BOARD_ID_VEXPRESS:\ncase BOARD_ID_EB:\ndefault:\nbreak;", "}", "break;", "case 0x44:\nbreak;", "case 0x4c:\nbreak;", "case 0x50:\nswitch (board_id(s)) {", "case BOARD_ID_PB926:\ns->sys_clcd &= 0x3f00;", "s->sys_clcd |= VAR_2 & ~0x3f00;", "qemu_set_irq(s->pl110_mux_ctrl, VAR_2 & 3);", "break;", "case BOARD_ID_EB:\ns->sys_clcd &= 0x3f00;", "s->sys_clcd |= VAR_2 & ~0x3f00;", "break;", "case BOARD_ID_PBA8:\ncase BOARD_ID_PBX:\ns->sys_clcd &= (1 << 7);", "s->sys_clcd |= VAR_2 & ~(1 << 7);", "break;", "case BOARD_ID_VEXPRESS:\ndefault:\nbreak;", "}", "case 0x54:\ncase 0x64:\ncase 0x68:\ncase 0x6c:\ncase 0x70:\ncase 0x74:\ncase 0x80:\ncase 0x84:\ncase 0x88:\ncase 0x8c:\ncase 0x90:\ncase 0x94:\ncase 0x98:\ncase 0x9c:\nbreak;", "case 0xa0:\nif (board_id(s) != BOARD_ID_VEXPRESS) {", "goto bad_reg;", "}", "s->sys_cfgdata = VAR_2;", "return;", "case 0xa4:\nif (board_id(s) != BOARD_ID_VEXPRESS) {", "goto bad_reg;", "}", "s->sys_cfgctrl = VAR_2 & ~(3 << 18);", "s->sys_cfgstat = 1;", "switch (s->sys_cfgctrl) {", "case 0xc0800000:\nqemu_system_shutdown_request();", "break;", "case 0xc0900000:\nqemu_system_reset_request();", "break;", "default:\ns->sys_cfgstat |= 2;", "}", "return;", "case 0xa8:\nif (board_id(s) != BOARD_ID_VEXPRESS) {", "goto bad_reg;", "}", "s->sys_cfgstat = VAR_2 & 3;", "return;", "default:\nbad_reg:\nprintf (\"FUNC_0: Bad register VAR_1 0x%x\\n\", (int)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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13, 15 ], [ 17, 19, 21, 23, 25, 29 ], [ 31, 33, 35 ], [ 37, 39 ], [ 41 ], [ 43, 47 ], [ 49 ], [ 51, 55 ], [ 57 ], [ 59, 61 ], [ 63 ], [ 65, 67 ], [ 69 ], [ 71, 73 ], [ 75 ], [ 77, 79 ], [ 81 ], [ 83, 85 ], [ 87, 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103, 105, 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121, 123, 125, 129 ], [ 131 ], [ 133 ], [ 135, 139 ], [ 141, 143 ], [ 145, 147 ], [ 149, 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169, 177 ], [ 179 ], [ 181 ], [ 183, 185, 193 ], [ 195 ], [ 197 ], [ 199, 201, 205 ], [ 207 ], [ 209, 211, 213, 215, 217, 219, 221, 223, 225, 227, 229, 231, 233, 235, 237 ], [ 239, 241 ], [ 243 ], [ 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 ] ]
14,961
uint32_t HELPER(msa)(CPUS390XState *env, uint32_t r1, uint32_t r2, uint32_t r3, uint32_t type) { const uintptr_t ra = GETPC(); const uint8_t mod = env->regs[0] & 0x80ULL; const uint8_t fc = env->regs[0] & 0x7fULL; CPUState *cs = CPU(s390_env_get_cpu(env)); uint8_t subfunc[16] = { 0 }; uint64_t param_addr; int i; switch (type) { case S390_FEAT_TYPE_KMAC: case S390_FEAT_TYPE_KIMD: case S390_FEAT_TYPE_KLMD: case S390_FEAT_TYPE_PCKMO: case S390_FEAT_TYPE_PCC: if (mod) { cpu_restore_state(cs, ra); program_interrupt(env, PGM_SPECIFICATION, 4); return 0; } break; } s390_get_feat_block(type, subfunc); if (!test_be_bit(fc, subfunc)) { cpu_restore_state(cs, ra); program_interrupt(env, PGM_SPECIFICATION, 4); return 0; } switch (fc) { case 0: /* query subfunction */ for (i = 0; i < 16; i++) { param_addr = wrap_address(env, env->regs[1] + i); cpu_stb_data_ra(env, param_addr, subfunc[i], ra); } break; default: /* we don't implement any other subfunction yet */ g_assert_not_reached(); } return 0; }
false
qemu
8d2f850a5ab7579a852f23b28273940a47dfd7ff
uint32_t HELPER(msa)(CPUS390XState *env, uint32_t r1, uint32_t r2, uint32_t r3, uint32_t type) { const uintptr_t ra = GETPC(); const uint8_t mod = env->regs[0] & 0x80ULL; const uint8_t fc = env->regs[0] & 0x7fULL; CPUState *cs = CPU(s390_env_get_cpu(env)); uint8_t subfunc[16] = { 0 }; uint64_t param_addr; int i; switch (type) { case S390_FEAT_TYPE_KMAC: case S390_FEAT_TYPE_KIMD: case S390_FEAT_TYPE_KLMD: case S390_FEAT_TYPE_PCKMO: case S390_FEAT_TYPE_PCC: if (mod) { cpu_restore_state(cs, ra); program_interrupt(env, PGM_SPECIFICATION, 4); return 0; } break; } s390_get_feat_block(type, subfunc); if (!test_be_bit(fc, subfunc)) { cpu_restore_state(cs, ra); program_interrupt(env, PGM_SPECIFICATION, 4); return 0; } switch (fc) { case 0: for (i = 0; i < 16; i++) { param_addr = wrap_address(env, env->regs[1] + i); cpu_stb_data_ra(env, param_addr, subfunc[i], ra); } break; default: g_assert_not_reached(); } return 0; }
{ "code": [], "line_no": [] }
uint32_t FUNC_0(msa)(CPUS390XState *env, uint32_t r1, uint32_t r2, uint32_t r3, uint32_t type) { const uintptr_t VAR_0 = GETPC(); const uint8_t VAR_1 = env->regs[0] & 0x80ULL; const uint8_t VAR_2 = env->regs[0] & 0x7fULL; CPUState *cs = CPU(s390_env_get_cpu(env)); uint8_t subfunc[16] = { 0 }; uint64_t param_addr; int VAR_3; switch (type) { case S390_FEAT_TYPE_KMAC: case S390_FEAT_TYPE_KIMD: case S390_FEAT_TYPE_KLMD: case S390_FEAT_TYPE_PCKMO: case S390_FEAT_TYPE_PCC: if (VAR_1) { cpu_restore_state(cs, VAR_0); program_interrupt(env, PGM_SPECIFICATION, 4); return 0; } break; } s390_get_feat_block(type, subfunc); if (!test_be_bit(VAR_2, subfunc)) { cpu_restore_state(cs, VAR_0); program_interrupt(env, PGM_SPECIFICATION, 4); return 0; } switch (VAR_2) { case 0: for (VAR_3 = 0; VAR_3 < 16; VAR_3++) { param_addr = wrap_address(env, env->regs[1] + VAR_3); cpu_stb_data_ra(env, param_addr, subfunc[VAR_3], VAR_0); } break; default: g_assert_not_reached(); } return 0; }
[ "uint32_t FUNC_0(msa)(CPUS390XState *env, uint32_t r1, uint32_t r2, uint32_t r3,\nuint32_t type)\n{", "const uintptr_t VAR_0 = GETPC();", "const uint8_t VAR_1 = env->regs[0] & 0x80ULL;", "const uint8_t VAR_2 = env->regs[0] & 0x7fULL;", "CPUState *cs = CPU(s390_env_get_cpu(env));", "uint8_t subfunc[16] = { 0 };", "uint64_t param_addr;", "int VAR_3;", "switch (type) {", "case S390_FEAT_TYPE_KMAC:\ncase S390_FEAT_TYPE_KIMD:\ncase S390_FEAT_TYPE_KLMD:\ncase S390_FEAT_TYPE_PCKMO:\ncase S390_FEAT_TYPE_PCC:\nif (VAR_1) {", "cpu_restore_state(cs, VAR_0);", "program_interrupt(env, PGM_SPECIFICATION, 4);", "return 0;", "}", "break;", "}", "s390_get_feat_block(type, subfunc);", "if (!test_be_bit(VAR_2, subfunc)) {", "cpu_restore_state(cs, VAR_0);", "program_interrupt(env, PGM_SPECIFICATION, 4);", "return 0;", "}", "switch (VAR_2) {", "case 0:\nfor (VAR_3 = 0; VAR_3 < 16; VAR_3++) {", "param_addr = wrap_address(env, env->regs[1] + VAR_3);", "cpu_stb_data_ra(env, param_addr, subfunc[VAR_3], VAR_0);", "}", "break;", "default:\ng_assert_not_reached();", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25, 27, 29, 31, 33, 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67, 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79, 83 ], [ 85 ], [ 89 ], [ 91 ] ]
14,964
void usb_desc_attach(USBDevice *dev) { const USBDesc *desc = usb_device_get_usb_desc(dev); assert(desc != NULL); if (desc->super && (dev->port->speedmask & USB_SPEED_MASK_SUPER)) { dev->speed = USB_SPEED_SUPER; } else if (desc->high && (dev->port->speedmask & USB_SPEED_MASK_HIGH)) { dev->speed = USB_SPEED_HIGH; } else if (desc->full && (dev->port->speedmask & USB_SPEED_MASK_FULL)) { dev->speed = USB_SPEED_FULL; } else { return; } usb_desc_setdefaults(dev); }
false
qemu
b791c3b38c7969cb9f4acda8229e19fd865a1c08
void usb_desc_attach(USBDevice *dev) { const USBDesc *desc = usb_device_get_usb_desc(dev); assert(desc != NULL); if (desc->super && (dev->port->speedmask & USB_SPEED_MASK_SUPER)) { dev->speed = USB_SPEED_SUPER; } else if (desc->high && (dev->port->speedmask & USB_SPEED_MASK_HIGH)) { dev->speed = USB_SPEED_HIGH; } else if (desc->full && (dev->port->speedmask & USB_SPEED_MASK_FULL)) { dev->speed = USB_SPEED_FULL; } else { return; } usb_desc_setdefaults(dev); }
{ "code": [], "line_no": [] }
void FUNC_0(USBDevice *VAR_0) { const USBDesc *VAR_1 = usb_device_get_usb_desc(VAR_0); assert(VAR_1 != NULL); if (VAR_1->super && (VAR_0->port->speedmask & USB_SPEED_MASK_SUPER)) { VAR_0->speed = USB_SPEED_SUPER; } else if (VAR_1->high && (VAR_0->port->speedmask & USB_SPEED_MASK_HIGH)) { VAR_0->speed = USB_SPEED_HIGH; } else if (VAR_1->full && (VAR_0->port->speedmask & USB_SPEED_MASK_FULL)) { VAR_0->speed = USB_SPEED_FULL; } else { return; } usb_desc_setdefaults(VAR_0); }
[ "void FUNC_0(USBDevice *VAR_0)\n{", "const USBDesc *VAR_1 = usb_device_get_usb_desc(VAR_0);", "assert(VAR_1 != NULL);", "if (VAR_1->super && (VAR_0->port->speedmask & USB_SPEED_MASK_SUPER)) {", "VAR_0->speed = USB_SPEED_SUPER;", "} else if (VAR_1->high && (VAR_0->port->speedmask & USB_SPEED_MASK_HIGH)) {", "VAR_0->speed = USB_SPEED_HIGH;", "} else if (VAR_1->full && (VAR_0->port->speedmask & USB_SPEED_MASK_FULL)) {", "VAR_0->speed = USB_SPEED_FULL;", "} else {", "return;", "}", "usb_desc_setdefaults(VAR_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 ] ]
14,966
void register_displaychangelistener(DisplayChangeListener *dcl) { static DisplaySurface *dummy; QemuConsole *con; trace_displaychangelistener_register(dcl, dcl->ops->dpy_name); dcl->ds = get_alloc_displaystate(); QLIST_INSERT_HEAD(&dcl->ds->listeners, dcl, next); gui_setup_refresh(dcl->ds); if (dcl->con) { dcl->con->dcls++; con = dcl->con; } else { con = active_console; } if (dcl->ops->dpy_gfx_switch) { if (con) { dcl->ops->dpy_gfx_switch(dcl, con->surface); } else { if (!dummy) { dummy = qemu_create_dummy_surface(); } dcl->ops->dpy_gfx_switch(dcl, dummy); } } }
false
qemu
521a580d2352ad30086babcabb91e6338e47cf62
void register_displaychangelistener(DisplayChangeListener *dcl) { static DisplaySurface *dummy; QemuConsole *con; trace_displaychangelistener_register(dcl, dcl->ops->dpy_name); dcl->ds = get_alloc_displaystate(); QLIST_INSERT_HEAD(&dcl->ds->listeners, dcl, next); gui_setup_refresh(dcl->ds); if (dcl->con) { dcl->con->dcls++; con = dcl->con; } else { con = active_console; } if (dcl->ops->dpy_gfx_switch) { if (con) { dcl->ops->dpy_gfx_switch(dcl, con->surface); } else { if (!dummy) { dummy = qemu_create_dummy_surface(); } dcl->ops->dpy_gfx_switch(dcl, dummy); } } }
{ "code": [], "line_no": [] }
void FUNC_0(DisplayChangeListener *VAR_0) { static DisplaySurface *VAR_1; QemuConsole *con; trace_displaychangelistener_register(VAR_0, VAR_0->ops->dpy_name); VAR_0->ds = get_alloc_displaystate(); QLIST_INSERT_HEAD(&VAR_0->ds->listeners, VAR_0, next); gui_setup_refresh(VAR_0->ds); if (VAR_0->con) { VAR_0->con->dcls++; con = VAR_0->con; } else { con = active_console; } if (VAR_0->ops->dpy_gfx_switch) { if (con) { VAR_0->ops->dpy_gfx_switch(VAR_0, con->surface); } else { if (!VAR_1) { VAR_1 = qemu_create_dummy_surface(); } VAR_0->ops->dpy_gfx_switch(VAR_0, VAR_1); } } }
[ "void FUNC_0(DisplayChangeListener *VAR_0)\n{", "static DisplaySurface *VAR_1;", "QemuConsole *con;", "trace_displaychangelistener_register(VAR_0, VAR_0->ops->dpy_name);", "VAR_0->ds = get_alloc_displaystate();", "QLIST_INSERT_HEAD(&VAR_0->ds->listeners, VAR_0, next);", "gui_setup_refresh(VAR_0->ds);", "if (VAR_0->con) {", "VAR_0->con->dcls++;", "con = VAR_0->con;", "} else {", "con = active_console;", "}", "if (VAR_0->ops->dpy_gfx_switch) {", "if (con) {", "VAR_0->ops->dpy_gfx_switch(VAR_0, con->surface);", "} else {", "if (!VAR_1) {", "VAR_1 = qemu_create_dummy_surface();", "}", "VAR_0->ops->dpy_gfx_switch(VAR_0, 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ] ]
14,967
void bdrv_set_io_limits(BlockDriverState *bs, ThrottleConfig *cfg) { int i; throttle_config(&bs->throttle_state, cfg); for (i = 0; i < 2; i++) { qemu_co_enter_next(&bs->throttled_reqs[i]); } }
false
qemu
61007b316cd71ee7333ff7a0a749a8949527575f
void bdrv_set_io_limits(BlockDriverState *bs, ThrottleConfig *cfg) { int i; throttle_config(&bs->throttle_state, cfg); for (i = 0; i < 2; i++) { qemu_co_enter_next(&bs->throttled_reqs[i]); } }
{ "code": [], "line_no": [] }
void FUNC_0(BlockDriverState *VAR_0, ThrottleConfig *VAR_1) { int VAR_2; throttle_config(&VAR_0->throttle_state, VAR_1); for (VAR_2 = 0; VAR_2 < 2; VAR_2++) { qemu_co_enter_next(&VAR_0->throttled_reqs[VAR_2]); } }
[ "void FUNC_0(BlockDriverState *VAR_0,\nThrottleConfig *VAR_1)\n{", "int VAR_2;", "throttle_config(&VAR_0->throttle_state, VAR_1);", "for (VAR_2 = 0; VAR_2 < 2; VAR_2++) {", "qemu_co_enter_next(&VAR_0->throttled_reqs[VAR_2]);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
14,969
void s390_init_cpus(MachineState *machine) { int i; gchar *name; if (machine->cpu_model == NULL) { machine->cpu_model = "host"; } cpu_states = g_malloc0(sizeof(S390CPU *) * max_cpus); for (i = 0; i < max_cpus; i++) { name = g_strdup_printf("cpu[%i]", i); object_property_add_link(OBJECT(machine), name, TYPE_S390_CPU, (Object **) &cpu_states[i], object_property_allow_set_link, OBJ_PROP_LINK_UNREF_ON_RELEASE, &error_abort); g_free(name); } for (i = 0; i < smp_cpus; i++) { cpu_s390x_init(machine->cpu_model); } }
false
qemu
96b1a8bb55f1aeb72a943d1001841ff8b0687059
void s390_init_cpus(MachineState *machine) { int i; gchar *name; if (machine->cpu_model == NULL) { machine->cpu_model = "host"; } cpu_states = g_malloc0(sizeof(S390CPU *) * max_cpus); for (i = 0; i < max_cpus; i++) { name = g_strdup_printf("cpu[%i]", i); object_property_add_link(OBJECT(machine), name, TYPE_S390_CPU, (Object **) &cpu_states[i], object_property_allow_set_link, OBJ_PROP_LINK_UNREF_ON_RELEASE, &error_abort); g_free(name); } for (i = 0; i < smp_cpus; i++) { cpu_s390x_init(machine->cpu_model); } }
{ "code": [], "line_no": [] }
void FUNC_0(MachineState *VAR_0) { int VAR_1; gchar *name; if (VAR_0->cpu_model == NULL) { VAR_0->cpu_model = "host"; } cpu_states = g_malloc0(sizeof(S390CPU *) * max_cpus); for (VAR_1 = 0; VAR_1 < max_cpus; VAR_1++) { name = g_strdup_printf("cpu[%VAR_1]", VAR_1); object_property_add_link(OBJECT(VAR_0), name, TYPE_S390_CPU, (Object **) &cpu_states[VAR_1], object_property_allow_set_link, OBJ_PROP_LINK_UNREF_ON_RELEASE, &error_abort); g_free(name); } for (VAR_1 = 0; VAR_1 < smp_cpus; VAR_1++) { cpu_s390x_init(VAR_0->cpu_model); } }
[ "void FUNC_0(MachineState *VAR_0)\n{", "int VAR_1;", "gchar *name;", "if (VAR_0->cpu_model == NULL) {", "VAR_0->cpu_model = \"host\";", "}", "cpu_states = g_malloc0(sizeof(S390CPU *) * max_cpus);", "for (VAR_1 = 0; VAR_1 < max_cpus; VAR_1++) {", "name = g_strdup_printf(\"cpu[%VAR_1]\", VAR_1);", "object_property_add_link(OBJECT(VAR_0), name, TYPE_S390_CPU,\n(Object **) &cpu_states[VAR_1],\nobject_property_allow_set_link,\nOBJ_PROP_LINK_UNREF_ON_RELEASE,\n&error_abort);", "g_free(name);", "}", "for (VAR_1 = 0; VAR_1 < smp_cpus; VAR_1++) {", "cpu_s390x_init(VAR_0->cpu_model);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 23 ], [ 25 ], [ 27, 29, 31, 33, 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ] ]
14,970
static int qemu_rbd_create(const char *filename, QEMUOptionParameter *options) { int64_t bytes = 0; int64_t objsize; int obj_order = 0; char pool[RBD_MAX_POOL_NAME_SIZE]; char name[RBD_MAX_IMAGE_NAME_SIZE]; char snap_buf[RBD_MAX_SNAP_NAME_SIZE]; char conf[RBD_MAX_CONF_SIZE]; rados_t cluster; rados_ioctx_t io_ctx; int ret; if (qemu_rbd_parsename(filename, pool, sizeof(pool), snap_buf, sizeof(snap_buf), name, sizeof(name), conf, sizeof(conf)) < 0) { return -EINVAL; } /* Read out options */ while (options && options->name) { if (!strcmp(options->name, BLOCK_OPT_SIZE)) { bytes = options->value.n; } else if (!strcmp(options->name, BLOCK_OPT_CLUSTER_SIZE)) { if (options->value.n) { objsize = options->value.n; if ((objsize - 1) & objsize) { /* not a power of 2? */ error_report("obj size needs to be power of 2"); return -EINVAL; } if (objsize < 4096) { error_report("obj size too small"); return -EINVAL; } obj_order = ffs(objsize) - 1; } } options++; } if (rados_create(&cluster, NULL) < 0) { error_report("error initializing"); return -EIO; } if (strstr(conf, "conf=") == NULL) { if (rados_conf_read_file(cluster, NULL) < 0) { error_report("error reading config file"); rados_shutdown(cluster); return -EIO; } } if (conf[0] != '\0' && qemu_rbd_set_conf(cluster, conf) < 0) { error_report("error setting config options"); rados_shutdown(cluster); return -EIO; } if (rados_connect(cluster) < 0) { error_report("error connecting"); rados_shutdown(cluster); return -EIO; } if (rados_ioctx_create(cluster, pool, &io_ctx) < 0) { error_report("error opening pool %s", pool); rados_shutdown(cluster); return -EIO; } ret = rbd_create(io_ctx, name, bytes, &obj_order); rados_ioctx_destroy(io_ctx); rados_shutdown(cluster); return ret; }
false
qemu
7c7e9df0232a1ce5c411f0f348038d2e72097ae1
static int qemu_rbd_create(const char *filename, QEMUOptionParameter *options) { int64_t bytes = 0; int64_t objsize; int obj_order = 0; char pool[RBD_MAX_POOL_NAME_SIZE]; char name[RBD_MAX_IMAGE_NAME_SIZE]; char snap_buf[RBD_MAX_SNAP_NAME_SIZE]; char conf[RBD_MAX_CONF_SIZE]; rados_t cluster; rados_ioctx_t io_ctx; int ret; if (qemu_rbd_parsename(filename, pool, sizeof(pool), snap_buf, sizeof(snap_buf), name, sizeof(name), conf, sizeof(conf)) < 0) { return -EINVAL; } while (options && options->name) { if (!strcmp(options->name, BLOCK_OPT_SIZE)) { bytes = options->value.n; } else if (!strcmp(options->name, BLOCK_OPT_CLUSTER_SIZE)) { if (options->value.n) { objsize = options->value.n; if ((objsize - 1) & objsize) { error_report("obj size needs to be power of 2"); return -EINVAL; } if (objsize < 4096) { error_report("obj size too small"); return -EINVAL; } obj_order = ffs(objsize) - 1; } } options++; } if (rados_create(&cluster, NULL) < 0) { error_report("error initializing"); return -EIO; } if (strstr(conf, "conf=") == NULL) { if (rados_conf_read_file(cluster, NULL) < 0) { error_report("error reading config file"); rados_shutdown(cluster); return -EIO; } } if (conf[0] != '\0' && qemu_rbd_set_conf(cluster, conf) < 0) { error_report("error setting config options"); rados_shutdown(cluster); return -EIO; } if (rados_connect(cluster) < 0) { error_report("error connecting"); rados_shutdown(cluster); return -EIO; } if (rados_ioctx_create(cluster, pool, &io_ctx) < 0) { error_report("error opening pool %s", pool); rados_shutdown(cluster); return -EIO; } ret = rbd_create(io_ctx, name, bytes, &obj_order); rados_ioctx_destroy(io_ctx); rados_shutdown(cluster); return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(const char *VAR_0, QEMUOptionParameter *VAR_1) { int64_t bytes = 0; int64_t objsize; int VAR_2 = 0; char VAR_3[RBD_MAX_POOL_NAME_SIZE]; char VAR_4[RBD_MAX_IMAGE_NAME_SIZE]; char VAR_5[RBD_MAX_SNAP_NAME_SIZE]; char VAR_6[RBD_MAX_CONF_SIZE]; rados_t cluster; rados_ioctx_t io_ctx; int VAR_7; if (qemu_rbd_parsename(VAR_0, VAR_3, sizeof(VAR_3), VAR_5, sizeof(VAR_5), VAR_4, sizeof(VAR_4), VAR_6, sizeof(VAR_6)) < 0) { return -EINVAL; } while (VAR_1 && VAR_1->VAR_4) { if (!strcmp(VAR_1->VAR_4, BLOCK_OPT_SIZE)) { bytes = VAR_1->value.n; } else if (!strcmp(VAR_1->VAR_4, BLOCK_OPT_CLUSTER_SIZE)) { if (VAR_1->value.n) { objsize = VAR_1->value.n; if ((objsize - 1) & objsize) { error_report("obj size needs to be power of 2"); return -EINVAL; } if (objsize < 4096) { error_report("obj size too small"); return -EINVAL; } VAR_2 = ffs(objsize) - 1; } } VAR_1++; } if (rados_create(&cluster, NULL) < 0) { error_report("error initializing"); return -EIO; } if (strstr(VAR_6, "VAR_6=") == NULL) { if (rados_conf_read_file(cluster, NULL) < 0) { error_report("error reading config file"); rados_shutdown(cluster); return -EIO; } } if (VAR_6[0] != '\0' && qemu_rbd_set_conf(cluster, VAR_6) < 0) { error_report("error setting config VAR_1"); rados_shutdown(cluster); return -EIO; } if (rados_connect(cluster) < 0) { error_report("error connecting"); rados_shutdown(cluster); return -EIO; } if (rados_ioctx_create(cluster, VAR_3, &io_ctx) < 0) { error_report("error opening VAR_3 %s", VAR_3); rados_shutdown(cluster); return -EIO; } VAR_7 = rbd_create(io_ctx, VAR_4, bytes, &VAR_2); rados_ioctx_destroy(io_ctx); rados_shutdown(cluster); return VAR_7; }
[ "static int FUNC_0(const char *VAR_0, QEMUOptionParameter *VAR_1)\n{", "int64_t bytes = 0;", "int64_t objsize;", "int VAR_2 = 0;", "char VAR_3[RBD_MAX_POOL_NAME_SIZE];", "char VAR_4[RBD_MAX_IMAGE_NAME_SIZE];", "char VAR_5[RBD_MAX_SNAP_NAME_SIZE];", "char VAR_6[RBD_MAX_CONF_SIZE];", "rados_t cluster;", "rados_ioctx_t io_ctx;", "int VAR_7;", "if (qemu_rbd_parsename(VAR_0, VAR_3, sizeof(VAR_3),\nVAR_5, sizeof(VAR_5),\nVAR_4, sizeof(VAR_4),\nVAR_6, sizeof(VAR_6)) < 0) {", "return -EINVAL;", "}", "while (VAR_1 && VAR_1->VAR_4) {", "if (!strcmp(VAR_1->VAR_4, BLOCK_OPT_SIZE)) {", "bytes = VAR_1->value.n;", "} else if (!strcmp(VAR_1->VAR_4, BLOCK_OPT_CLUSTER_SIZE)) {", "if (VAR_1->value.n) {", "objsize = VAR_1->value.n;", "if ((objsize - 1) & objsize) {", "error_report(\"obj size needs to be power of 2\");", "return -EINVAL;", "}", "if (objsize < 4096) {", "error_report(\"obj size too small\");", "return -EINVAL;", "}", "VAR_2 = ffs(objsize) - 1;", "}", "}", "VAR_1++;", "}", "if (rados_create(&cluster, NULL) < 0) {", "error_report(\"error initializing\");", "return -EIO;", "}", "if (strstr(VAR_6, \"VAR_6=\") == NULL) {", "if (rados_conf_read_file(cluster, NULL) < 0) {", "error_report(\"error reading config file\");", "rados_shutdown(cluster);", "return -EIO;", "}", "}", "if (VAR_6[0] != '\\0' &&\nqemu_rbd_set_conf(cluster, VAR_6) < 0) {", "error_report(\"error setting config VAR_1\");", "rados_shutdown(cluster);", "return -EIO;", "}", "if (rados_connect(cluster) < 0) {", "error_report(\"error connecting\");", "rados_shutdown(cluster);", "return -EIO;", "}", "if (rados_ioctx_create(cluster, VAR_3, &io_ctx) < 0) {", "error_report(\"error opening VAR_3 %s\", VAR_3);", "rados_shutdown(cluster);", "return -EIO;", "}", "VAR_7 = rbd_create(io_ctx, VAR_4, bytes, &VAR_2);", "rados_ioctx_destroy(io_ctx);", "rados_shutdown(cluster);", "return VAR_7;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27, 29, 31, 33 ], [ 35 ], [ 37 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 109, 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 147 ], [ 149 ], [ 151 ], [ 155 ], [ 157 ] ]
14,972
static void init_proc_401x2 (CPUPPCState *env) { }
false
qemu
e1833e1f96456fd8fc17463246fe0b2050e68efb
static void init_proc_401x2 (CPUPPCState *env) { }
{ "code": [], "line_no": [] }
static void FUNC_0 (CPUPPCState *VAR_0) { }
[ "static void FUNC_0 (CPUPPCState *VAR_0)\n{", "}" ]
[ 0, 0 ]
[ [ 1, 3 ], [ 5 ] ]
14,973
static int check_pow_970FX (CPUPPCState *env) { if (env->spr[SPR_HID0] & 0x00600000) return 1; return 0; }
false
qemu
90618f4f4d1e7b5b9fe40834646adac1e21d1b07
static int check_pow_970FX (CPUPPCState *env) { if (env->spr[SPR_HID0] & 0x00600000) return 1; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0 (CPUPPCState *VAR_0) { if (VAR_0->spr[SPR_HID0] & 0x00600000) return 1; return 0; }
[ "static int FUNC_0 (CPUPPCState *VAR_0)\n{", "if (VAR_0->spr[SPR_HID0] & 0x00600000)\nreturn 1;", "return 0;", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 11 ], [ 13 ] ]
14,974
int ff_listen_bind(int fd, const struct sockaddr *addr, socklen_t addrlen, int timeout) { int ret; int reuse = 1; struct pollfd lp = { fd, POLLIN, 0 }; setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &reuse, sizeof(reuse)); ret = bind(fd, addr, addrlen); if (ret) return ff_neterrno(); ret = listen(fd, 1); if (ret) return ff_neterrno(); ret = poll(&lp, 1, timeout >= 0 ? timeout : -1); if (ret <= 0) return AVERROR(ETIMEDOUT); ret = accept(fd, NULL, NULL); if (ret < 0) return ff_neterrno(); closesocket(fd); ff_socket_nonblock(ret, 1); return ret; }
false
FFmpeg
9835abb6d63fb07613994ae90e72fef758149408
int ff_listen_bind(int fd, const struct sockaddr *addr, socklen_t addrlen, int timeout) { int ret; int reuse = 1; struct pollfd lp = { fd, POLLIN, 0 }; setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &reuse, sizeof(reuse)); ret = bind(fd, addr, addrlen); if (ret) return ff_neterrno(); ret = listen(fd, 1); if (ret) return ff_neterrno(); ret = poll(&lp, 1, timeout >= 0 ? timeout : -1); if (ret <= 0) return AVERROR(ETIMEDOUT); ret = accept(fd, NULL, NULL); if (ret < 0) return ff_neterrno(); closesocket(fd); ff_socket_nonblock(ret, 1); return ret; }
{ "code": [], "line_no": [] }
int FUNC_0(int VAR_0, const struct sockaddr *VAR_1, socklen_t VAR_2, int VAR_3) { int VAR_4; int VAR_5 = 1; struct pollfd VAR_6 = { VAR_0, POLLIN, 0 }; setsockopt(VAR_0, SOL_SOCKET, SO_REUSEADDR, &VAR_5, sizeof(VAR_5)); VAR_4 = bind(VAR_0, VAR_1, VAR_2); if (VAR_4) return ff_neterrno(); VAR_4 = listen(VAR_0, 1); if (VAR_4) return ff_neterrno(); VAR_4 = poll(&VAR_6, 1, VAR_3 >= 0 ? VAR_3 : -1); if (VAR_4 <= 0) return AVERROR(ETIMEDOUT); VAR_4 = accept(VAR_0, NULL, NULL); if (VAR_4 < 0) return ff_neterrno(); closesocket(VAR_0); ff_socket_nonblock(VAR_4, 1); return VAR_4; }
[ "int FUNC_0(int VAR_0, const struct sockaddr *VAR_1,\nsocklen_t VAR_2, int VAR_3)\n{", "int VAR_4;", "int VAR_5 = 1;", "struct pollfd VAR_6 = { VAR_0, POLLIN, 0 };", "setsockopt(VAR_0, SOL_SOCKET, SO_REUSEADDR, &VAR_5, sizeof(VAR_5));", "VAR_4 = bind(VAR_0, VAR_1, VAR_2);", "if (VAR_4)\nreturn ff_neterrno();", "VAR_4 = listen(VAR_0, 1);", "if (VAR_4)\nreturn ff_neterrno();", "VAR_4 = poll(&VAR_6, 1, VAR_3 >= 0 ? VAR_3 : -1);", "if (VAR_4 <= 0)\nreturn AVERROR(ETIMEDOUT);", "VAR_4 = accept(VAR_0, NULL, NULL);", "if (VAR_4 < 0)\nreturn ff_neterrno();", "closesocket(VAR_0);", "ff_socket_nonblock(VAR_4, 1);", "return VAR_4;", "}" ]
[ 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 ], [ 31 ], [ 33, 35 ], [ 39 ], [ 41, 43 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ] ]
14,975
void qmp_x_blockdev_insert_medium(const char *device, const char *node_name, Error **errp) { BlockDriverState *bs; bs = bdrv_find_node(node_name); if (!bs) { error_setg(errp, "Node '%s' not found", node_name); return; } if (bs->blk) { error_setg(errp, "Node '%s' is already in use by '%s'", node_name, blk_name(bs->blk)); return; } qmp_blockdev_insert_anon_medium(device, bs, errp); }
false
qemu
1f0c461b82d5ec2664ca0cfc9548f80da87a8f8a
void qmp_x_blockdev_insert_medium(const char *device, const char *node_name, Error **errp) { BlockDriverState *bs; bs = bdrv_find_node(node_name); if (!bs) { error_setg(errp, "Node '%s' not found", node_name); return; } if (bs->blk) { error_setg(errp, "Node '%s' is already in use by '%s'", node_name, blk_name(bs->blk)); return; } qmp_blockdev_insert_anon_medium(device, bs, errp); }
{ "code": [], "line_no": [] }
void FUNC_0(const char *VAR_0, const char *VAR_1, Error **VAR_2) { BlockDriverState *bs; bs = bdrv_find_node(VAR_1); if (!bs) { error_setg(VAR_2, "Node '%s' not found", VAR_1); return; } if (bs->blk) { error_setg(VAR_2, "Node '%s' is already in use by '%s'", VAR_1, blk_name(bs->blk)); return; } qmp_blockdev_insert_anon_medium(VAR_0, bs, VAR_2); }
[ "void FUNC_0(const char *VAR_0, const char *VAR_1,\nError **VAR_2)\n{", "BlockDriverState *bs;", "bs = bdrv_find_node(VAR_1);", "if (!bs) {", "error_setg(VAR_2, \"Node '%s' not found\", VAR_1);", "return;", "}", "if (bs->blk) {", "error_setg(VAR_2, \"Node '%s' is already in use by '%s'\", VAR_1,\nblk_name(bs->blk));", "return;", "}", "qmp_blockdev_insert_anon_medium(VAR_0, bs, VAR_2);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ] ]
14,977
int bdrv_pwritev(BlockDriverState *bs, int64_t offset, QEMUIOVector *qiov) { int ret; ret = bdrv_prwv_co(bs, offset, qiov, true, 0); if (ret < 0) { return ret; } return qiov->size; }
false
qemu
61007b316cd71ee7333ff7a0a749a8949527575f
int bdrv_pwritev(BlockDriverState *bs, int64_t offset, QEMUIOVector *qiov) { int ret; ret = bdrv_prwv_co(bs, offset, qiov, true, 0); if (ret < 0) { return ret; } return qiov->size; }
{ "code": [], "line_no": [] }
int FUNC_0(BlockDriverState *VAR_0, int64_t VAR_1, QEMUIOVector *VAR_2) { int VAR_3; VAR_3 = bdrv_prwv_co(VAR_0, VAR_1, VAR_2, true, 0); if (VAR_3 < 0) { return VAR_3; } return VAR_2->size; }
[ "int FUNC_0(BlockDriverState *VAR_0, int64_t VAR_1, QEMUIOVector *VAR_2)\n{", "int VAR_3;", "VAR_3 = bdrv_prwv_co(VAR_0, VAR_1, VAR_2, true, 0);", "if (VAR_3 < 0) {", "return VAR_3;", "}", "return VAR_2->size;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ] ]
14,978
void qemu_input_event_send(QemuConsole *src, InputEvent *evt) { QemuInputHandlerState *s; if (!runstate_is_running() && !runstate_check(RUN_STATE_SUSPENDED)) { return; } qemu_input_event_trace(src, evt); /* pre processing */ if (graphic_rotate && (evt->type == INPUT_EVENT_KIND_ABS)) { qemu_input_transform_abs_rotate(evt); } /* send event */ s = qemu_input_find_handler(1 << evt->type, src); if (!s) { return; } s->handler->event(s->dev, src, evt); s->events++; }
false
qemu
ee312992a323530ea2cda8680f3a34746c72db8f
void qemu_input_event_send(QemuConsole *src, InputEvent *evt) { QemuInputHandlerState *s; if (!runstate_is_running() && !runstate_check(RUN_STATE_SUSPENDED)) { return; } qemu_input_event_trace(src, evt); if (graphic_rotate && (evt->type == INPUT_EVENT_KIND_ABS)) { qemu_input_transform_abs_rotate(evt); } s = qemu_input_find_handler(1 << evt->type, src); if (!s) { return; } s->handler->event(s->dev, src, evt); s->events++; }
{ "code": [], "line_no": [] }
void FUNC_0(QemuConsole *VAR_0, InputEvent *VAR_1) { QemuInputHandlerState *s; if (!runstate_is_running() && !runstate_check(RUN_STATE_SUSPENDED)) { return; } qemu_input_event_trace(VAR_0, VAR_1); if (graphic_rotate && (VAR_1->type == INPUT_EVENT_KIND_ABS)) { qemu_input_transform_abs_rotate(VAR_1); } s = qemu_input_find_handler(1 << VAR_1->type, VAR_0); if (!s) { return; } s->handler->event(s->dev, VAR_0, VAR_1); s->events++; }
[ "void FUNC_0(QemuConsole *VAR_0, InputEvent *VAR_1)\n{", "QemuInputHandlerState *s;", "if (!runstate_is_running() && !runstate_check(RUN_STATE_SUSPENDED)) {", "return;", "}", "qemu_input_event_trace(VAR_0, VAR_1);", "if (graphic_rotate && (VAR_1->type == INPUT_EVENT_KIND_ABS)) {", "qemu_input_transform_abs_rotate(VAR_1);", "}", "s = qemu_input_find_handler(1 << VAR_1->type, VAR_0);", "if (!s) {", "return;", "}", "s->handler->event(s->dev, VAR_0, VAR_1);", "s->events++;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 23 ], [ 25 ], [ 27 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ] ]
14,979
static void omap_wd_timer_write(void *opaque, target_phys_addr_t addr, uint64_t value, unsigned size) { struct omap_watchdog_timer_s *s = (struct omap_watchdog_timer_s *) opaque; if (size != 2) { return omap_badwidth_write16(opaque, addr, value); } switch (addr) { case 0x00: /* CNTL_TIMER */ omap_timer_sync(&s->timer); s->timer.ptv = (value >> 9) & 7; s->timer.ar = (value >> 8) & 1; s->timer.st = (value >> 7) & 1; s->free = (value >> 1) & 1; omap_timer_update(&s->timer); break; case 0x04: /* LOAD_TIMER */ s->timer.reset_val = value & 0xffff; break; case 0x08: /* TIMER_MODE */ if (!s->mode && ((value >> 15) & 1)) omap_clk_get(s->timer.clk); s->mode |= (value >> 15) & 1; if (s->last_wr == 0xf5) { if ((value & 0xff) == 0xa0) { if (s->mode) { s->mode = 0; omap_clk_put(s->timer.clk); } } else { /* XXX: on T|E hardware somehow this has no effect, * on Zire 71 it works as specified. */ s->reset = 1; qemu_system_reset_request(); } } s->last_wr = value & 0xff; break; default: OMAP_BAD_REG(addr); } }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static void omap_wd_timer_write(void *opaque, target_phys_addr_t addr, uint64_t value, unsigned size) { struct omap_watchdog_timer_s *s = (struct omap_watchdog_timer_s *) opaque; if (size != 2) { return omap_badwidth_write16(opaque, addr, value); } switch (addr) { case 0x00: omap_timer_sync(&s->timer); s->timer.ptv = (value >> 9) & 7; s->timer.ar = (value >> 8) & 1; s->timer.st = (value >> 7) & 1; s->free = (value >> 1) & 1; omap_timer_update(&s->timer); break; case 0x04: s->timer.reset_val = value & 0xffff; break; case 0x08: if (!s->mode && ((value >> 15) & 1)) omap_clk_get(s->timer.clk); s->mode |= (value >> 15) & 1; if (s->last_wr == 0xf5) { if ((value & 0xff) == 0xa0) { if (s->mode) { s->mode = 0; omap_clk_put(s->timer.clk); } } else { s->reset = 1; qemu_system_reset_request(); } } s->last_wr = value & 0xff; break; default: OMAP_BAD_REG(addr); } }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1, uint64_t VAR_2, unsigned VAR_3) { struct omap_watchdog_timer_s *VAR_4 = (struct omap_watchdog_timer_s *) VAR_0; if (VAR_3 != 2) { return omap_badwidth_write16(VAR_0, VAR_1, VAR_2); } switch (VAR_1) { case 0x00: omap_timer_sync(&VAR_4->timer); VAR_4->timer.ptv = (VAR_2 >> 9) & 7; VAR_4->timer.ar = (VAR_2 >> 8) & 1; VAR_4->timer.st = (VAR_2 >> 7) & 1; VAR_4->free = (VAR_2 >> 1) & 1; omap_timer_update(&VAR_4->timer); break; case 0x04: VAR_4->timer.reset_val = VAR_2 & 0xffff; break; case 0x08: if (!VAR_4->mode && ((VAR_2 >> 15) & 1)) omap_clk_get(VAR_4->timer.clk); VAR_4->mode |= (VAR_2 >> 15) & 1; if (VAR_4->last_wr == 0xf5) { if ((VAR_2 & 0xff) == 0xa0) { if (VAR_4->mode) { VAR_4->mode = 0; omap_clk_put(VAR_4->timer.clk); } } else { VAR_4->reset = 1; qemu_system_reset_request(); } } VAR_4->last_wr = VAR_2 & 0xff; break; default: OMAP_BAD_REG(VAR_1); } }
[ "static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1,\nuint64_t VAR_2, unsigned VAR_3)\n{", "struct omap_watchdog_timer_s *VAR_4 = (struct omap_watchdog_timer_s *) VAR_0;", "if (VAR_3 != 2) {", "return omap_badwidth_write16(VAR_0, VAR_1, VAR_2);", "}", "switch (VAR_1) {", "case 0x00:\nomap_timer_sync(&VAR_4->timer);", "VAR_4->timer.ptv = (VAR_2 >> 9) & 7;", "VAR_4->timer.ar = (VAR_2 >> 8) & 1;", "VAR_4->timer.st = (VAR_2 >> 7) & 1;", "VAR_4->free = (VAR_2 >> 1) & 1;", "omap_timer_update(&VAR_4->timer);", "break;", "case 0x04:\nVAR_4->timer.reset_val = VAR_2 & 0xffff;", "break;", "case 0x08:\nif (!VAR_4->mode && ((VAR_2 >> 15) & 1))\nomap_clk_get(VAR_4->timer.clk);", "VAR_4->mode |= (VAR_2 >> 15) & 1;", "if (VAR_4->last_wr == 0xf5) {", "if ((VAR_2 & 0xff) == 0xa0) {", "if (VAR_4->mode) {", "VAR_4->mode = 0;", "omap_clk_put(VAR_4->timer.clk);", "}", "} else {", "VAR_4->reset = 1;", "qemu_system_reset_request();", "}", "}", "VAR_4->last_wr = VAR_2 & 0xff;", "break;", "default:\nOMAP_BAD_REG(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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21, 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39, 41 ], [ 43 ], [ 47, 49, 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 87, 89 ], [ 91 ], [ 93 ] ]
14,981
static void nested_struct_compare(UserDefNested *udnp1, UserDefNested *udnp2) { g_assert(udnp1); g_assert(udnp2); g_assert_cmpstr(udnp1->string0, ==, udnp2->string0); g_assert_cmpstr(udnp1->dict1.string1, ==, udnp2->dict1.string1); g_assert_cmpint(udnp1->dict1.dict2.userdef1->base->integer, ==, udnp2->dict1.dict2.userdef1->base->integer); g_assert_cmpstr(udnp1->dict1.dict2.userdef1->string, ==, udnp2->dict1.dict2.userdef1->string); g_assert_cmpstr(udnp1->dict1.dict2.string2, ==, udnp2->dict1.dict2.string2); g_assert(udnp1->dict1.has_dict3 == udnp2->dict1.has_dict3); g_assert_cmpint(udnp1->dict1.dict3.userdef2->base->integer, ==, udnp2->dict1.dict3.userdef2->base->integer); g_assert_cmpstr(udnp1->dict1.dict3.userdef2->string, ==, udnp2->dict1.dict3.userdef2->string); g_assert_cmpstr(udnp1->dict1.dict3.string3, ==, udnp2->dict1.dict3.string3); }
false
qemu
b6fcf32d9b851a83dedcb609091236b97cc4a985
static void nested_struct_compare(UserDefNested *udnp1, UserDefNested *udnp2) { g_assert(udnp1); g_assert(udnp2); g_assert_cmpstr(udnp1->string0, ==, udnp2->string0); g_assert_cmpstr(udnp1->dict1.string1, ==, udnp2->dict1.string1); g_assert_cmpint(udnp1->dict1.dict2.userdef1->base->integer, ==, udnp2->dict1.dict2.userdef1->base->integer); g_assert_cmpstr(udnp1->dict1.dict2.userdef1->string, ==, udnp2->dict1.dict2.userdef1->string); g_assert_cmpstr(udnp1->dict1.dict2.string2, ==, udnp2->dict1.dict2.string2); g_assert(udnp1->dict1.has_dict3 == udnp2->dict1.has_dict3); g_assert_cmpint(udnp1->dict1.dict3.userdef2->base->integer, ==, udnp2->dict1.dict3.userdef2->base->integer); g_assert_cmpstr(udnp1->dict1.dict3.userdef2->string, ==, udnp2->dict1.dict3.userdef2->string); g_assert_cmpstr(udnp1->dict1.dict3.string3, ==, udnp2->dict1.dict3.string3); }
{ "code": [], "line_no": [] }
static void FUNC_0(UserDefNested *VAR_0, UserDefNested *VAR_1) { g_assert(VAR_0); g_assert(VAR_1); g_assert_cmpstr(VAR_0->string0, ==, VAR_1->string0); g_assert_cmpstr(VAR_0->dict1.string1, ==, VAR_1->dict1.string1); g_assert_cmpint(VAR_0->dict1.dict2.userdef1->base->integer, ==, VAR_1->dict1.dict2.userdef1->base->integer); g_assert_cmpstr(VAR_0->dict1.dict2.userdef1->string, ==, VAR_1->dict1.dict2.userdef1->string); g_assert_cmpstr(VAR_0->dict1.dict2.string2, ==, VAR_1->dict1.dict2.string2); g_assert(VAR_0->dict1.has_dict3 == VAR_1->dict1.has_dict3); g_assert_cmpint(VAR_0->dict1.dict3.userdef2->base->integer, ==, VAR_1->dict1.dict3.userdef2->base->integer); g_assert_cmpstr(VAR_0->dict1.dict3.userdef2->string, ==, VAR_1->dict1.dict3.userdef2->string); g_assert_cmpstr(VAR_0->dict1.dict3.string3, ==, VAR_1->dict1.dict3.string3); }
[ "static void FUNC_0(UserDefNested *VAR_0, UserDefNested *VAR_1)\n{", "g_assert(VAR_0);", "g_assert(VAR_1);", "g_assert_cmpstr(VAR_0->string0, ==, VAR_1->string0);", "g_assert_cmpstr(VAR_0->dict1.string1, ==, VAR_1->dict1.string1);", "g_assert_cmpint(VAR_0->dict1.dict2.userdef1->base->integer, ==,\nVAR_1->dict1.dict2.userdef1->base->integer);", "g_assert_cmpstr(VAR_0->dict1.dict2.userdef1->string, ==,\nVAR_1->dict1.dict2.userdef1->string);", "g_assert_cmpstr(VAR_0->dict1.dict2.string2, ==, VAR_1->dict1.dict2.string2);", "g_assert(VAR_0->dict1.has_dict3 == VAR_1->dict1.has_dict3);", "g_assert_cmpint(VAR_0->dict1.dict3.userdef2->base->integer, ==,\nVAR_1->dict1.dict3.userdef2->base->integer);", "g_assert_cmpstr(VAR_0->dict1.dict3.userdef2->string, ==,\nVAR_1->dict1.dict3.userdef2->string);", "g_assert_cmpstr(VAR_0->dict1.dict3.string3, ==, VAR_1->dict1.dict3.string3);", "}" ]
[ 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 ] ]
14,983
static void s390_cpu_realizefn(DeviceState *dev, Error **errp) { CPUState *cs = CPU(dev); S390CPUClass *scc = S390_CPU_GET_CLASS(dev); S390CPU *cpu = S390_CPU(dev); CPUS390XState *env = &cpu->env; Error *err = NULL; cpu_exec_init(cs, &err); if (err != NULL) { error_propagate(errp, err); return; } #if !defined(CONFIG_USER_ONLY) qemu_register_reset(s390_cpu_machine_reset_cb, cpu); #endif env->cpu_num = scc->next_cpu_id++; s390_cpu_gdb_init(cs); qemu_init_vcpu(cs); #if !defined(CONFIG_USER_ONLY) run_on_cpu(cs, s390_do_cpu_full_reset, cs); #else cpu_reset(cs); #endif scc->parent_realize(dev, errp); }
false
qemu
96b1a8bb55f1aeb72a943d1001841ff8b0687059
static void s390_cpu_realizefn(DeviceState *dev, Error **errp) { CPUState *cs = CPU(dev); S390CPUClass *scc = S390_CPU_GET_CLASS(dev); S390CPU *cpu = S390_CPU(dev); CPUS390XState *env = &cpu->env; Error *err = NULL; cpu_exec_init(cs, &err); if (err != NULL) { error_propagate(errp, err); return; } #if !defined(CONFIG_USER_ONLY) qemu_register_reset(s390_cpu_machine_reset_cb, cpu); #endif env->cpu_num = scc->next_cpu_id++; s390_cpu_gdb_init(cs); qemu_init_vcpu(cs); #if !defined(CONFIG_USER_ONLY) run_on_cpu(cs, s390_do_cpu_full_reset, cs); #else cpu_reset(cs); #endif scc->parent_realize(dev, errp); }
{ "code": [], "line_no": [] }
static void FUNC_0(DeviceState *VAR_0, Error **VAR_1) { CPUState *cs = CPU(VAR_0); S390CPUClass *scc = S390_CPU_GET_CLASS(VAR_0); S390CPU *cpu = S390_CPU(VAR_0); CPUS390XState *env = &cpu->env; Error *err = NULL; cpu_exec_init(cs, &err); if (err != NULL) { error_propagate(VAR_1, err); return; } #if !defined(CONFIG_USER_ONLY) qemu_register_reset(s390_cpu_machine_reset_cb, cpu); #endif env->cpu_num = scc->next_cpu_id++; s390_cpu_gdb_init(cs); qemu_init_vcpu(cs); #if !defined(CONFIG_USER_ONLY) run_on_cpu(cs, s390_do_cpu_full_reset, cs); #else cpu_reset(cs); #endif scc->parent_realize(VAR_0, VAR_1); }
[ "static void FUNC_0(DeviceState *VAR_0, Error **VAR_1)\n{", "CPUState *cs = CPU(VAR_0);", "S390CPUClass *scc = S390_CPU_GET_CLASS(VAR_0);", "S390CPU *cpu = S390_CPU(VAR_0);", "CPUS390XState *env = &cpu->env;", "Error *err = NULL;", "cpu_exec_init(cs, &err);", "if (err != NULL) {", "error_propagate(VAR_1, err);", "return;", "}", "#if !defined(CONFIG_USER_ONLY)\nqemu_register_reset(s390_cpu_machine_reset_cb, cpu);", "#endif\nenv->cpu_num = scc->next_cpu_id++;", "s390_cpu_gdb_init(cs);", "qemu_init_vcpu(cs);", "#if !defined(CONFIG_USER_ONLY)\nrun_on_cpu(cs, s390_do_cpu_full_reset, cs);", "#else\ncpu_reset(cs);", "#endif\nscc->parent_realize(VAR_0, 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 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29, 31 ], [ 33, 35 ], [ 37 ], [ 39 ], [ 41, 43 ], [ 45, 47 ], [ 49, 53 ], [ 55 ] ]
14,984
static uint64_t musicpal_lcd_read(void *opaque, target_phys_addr_t offset, unsigned size) { musicpal_lcd_state *s = opaque; switch (offset) { case MP_LCD_IRQCTRL: return s->irqctrl; default: return 0; } }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static uint64_t musicpal_lcd_read(void *opaque, target_phys_addr_t offset, unsigned size) { musicpal_lcd_state *s = opaque; switch (offset) { case MP_LCD_IRQCTRL: return s->irqctrl; default: return 0; } }
{ "code": [], "line_no": [] }
static uint64_t FUNC_0(void *opaque, target_phys_addr_t offset, unsigned size) { musicpal_lcd_state *s = opaque; switch (offset) { case MP_LCD_IRQCTRL: return s->irqctrl; default: return 0; } }
[ "static uint64_t FUNC_0(void *opaque, target_phys_addr_t offset,\nunsigned size)\n{", "musicpal_lcd_state *s = opaque;", "switch (offset) {", "case MP_LCD_IRQCTRL:\nreturn s->irqctrl;", "default:\nreturn 0;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13, 15 ], [ 19, 21 ], [ 23 ], [ 25 ] ]
14,986
static void cmd_seek(IDEState *s, uint8_t* buf) { unsigned int lba; uint64_t total_sectors = s->nb_sectors >> 2; if (total_sectors == 0) { ide_atapi_cmd_error(s, SENSE_NOT_READY, ASC_MEDIUM_NOT_PRESENT); return; } lba = ube32_to_cpu(buf + 2); if (lba >= total_sectors) { ide_atapi_cmd_error(s, SENSE_ILLEGAL_REQUEST, ASC_LOGICAL_BLOCK_OOR); return; } ide_atapi_cmd_ok(s); }
false
qemu
7a2c4b82340d621bff462672b29c88d2020d68c1
static void cmd_seek(IDEState *s, uint8_t* buf) { unsigned int lba; uint64_t total_sectors = s->nb_sectors >> 2; if (total_sectors == 0) { ide_atapi_cmd_error(s, SENSE_NOT_READY, ASC_MEDIUM_NOT_PRESENT); return; } lba = ube32_to_cpu(buf + 2); if (lba >= total_sectors) { ide_atapi_cmd_error(s, SENSE_ILLEGAL_REQUEST, ASC_LOGICAL_BLOCK_OOR); return; } ide_atapi_cmd_ok(s); }
{ "code": [], "line_no": [] }
static void FUNC_0(IDEState *VAR_0, uint8_t* VAR_1) { unsigned int VAR_2; uint64_t total_sectors = VAR_0->nb_sectors >> 2; if (total_sectors == 0) { ide_atapi_cmd_error(VAR_0, SENSE_NOT_READY, ASC_MEDIUM_NOT_PRESENT); return; } VAR_2 = ube32_to_cpu(VAR_1 + 2); if (VAR_2 >= total_sectors) { ide_atapi_cmd_error(VAR_0, SENSE_ILLEGAL_REQUEST, ASC_LOGICAL_BLOCK_OOR); return; } ide_atapi_cmd_ok(VAR_0); }
[ "static void FUNC_0(IDEState *VAR_0, uint8_t* VAR_1)\n{", "unsigned int VAR_2;", "uint64_t total_sectors = VAR_0->nb_sectors >> 2;", "if (total_sectors == 0) {", "ide_atapi_cmd_error(VAR_0, SENSE_NOT_READY, ASC_MEDIUM_NOT_PRESENT);", "return;", "}", "VAR_2 = ube32_to_cpu(VAR_1 + 2);", "if (VAR_2 >= total_sectors) {", "ide_atapi_cmd_error(VAR_0, SENSE_ILLEGAL_REQUEST, ASC_LOGICAL_BLOCK_OOR);", "return;", "}", "ide_atapi_cmd_ok(VAR_0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ] ]
14,987
static void test_visitor_in_alternate(TestInputVisitorData *data, const void *unused) { Visitor *v; Error *err = NULL; UserDefAlternate *tmp; WrapAlternate *wrap; v = visitor_input_test_init(data, "42"); visit_type_UserDefAlternate(v, NULL, &tmp, &error_abort); g_assert_cmpint(tmp->type, ==, QTYPE_QINT); g_assert_cmpint(tmp->u.i, ==, 42); qapi_free_UserDefAlternate(tmp); v = visitor_input_test_init(data, "'string'"); visit_type_UserDefAlternate(v, NULL, &tmp, &error_abort); g_assert_cmpint(tmp->type, ==, QTYPE_QSTRING); g_assert_cmpstr(tmp->u.s, ==, "string"); qapi_free_UserDefAlternate(tmp); v = visitor_input_test_init(data, "{'integer':1, 'string':'str', " "'enum1':'value1', 'boolean':true}"); visit_type_UserDefAlternate(v, NULL, &tmp, &error_abort); g_assert_cmpint(tmp->type, ==, QTYPE_QDICT); g_assert_cmpint(tmp->u.udfu->integer, ==, 1); g_assert_cmpstr(tmp->u.udfu->string, ==, "str"); g_assert_cmpint(tmp->u.udfu->enum1, ==, ENUM_ONE_VALUE1); g_assert_cmpint(tmp->u.udfu->u.value1->boolean, ==, true); g_assert_cmpint(tmp->u.udfu->u.value1->has_a_b, ==, false); qapi_free_UserDefAlternate(tmp); v = visitor_input_test_init(data, "false"); visit_type_UserDefAlternate(v, NULL, &tmp, &err); error_free_or_abort(&err); qapi_free_UserDefAlternate(tmp); v = visitor_input_test_init(data, "{ 'alt': 42 }"); visit_type_WrapAlternate(v, NULL, &wrap, &error_abort); g_assert_cmpint(wrap->alt->type, ==, QTYPE_QINT); g_assert_cmpint(wrap->alt->u.i, ==, 42); qapi_free_WrapAlternate(wrap); v = visitor_input_test_init(data, "{ 'alt': 'string' }"); visit_type_WrapAlternate(v, NULL, &wrap, &error_abort); g_assert_cmpint(wrap->alt->type, ==, QTYPE_QSTRING); g_assert_cmpstr(wrap->alt->u.s, ==, "string"); qapi_free_WrapAlternate(wrap); v = visitor_input_test_init(data, "{ 'alt': {'integer':1, 'string':'str', " "'enum1':'value1', 'boolean':true} }"); visit_type_WrapAlternate(v, NULL, &wrap, &error_abort); g_assert_cmpint(wrap->alt->type, ==, QTYPE_QDICT); g_assert_cmpint(wrap->alt->u.udfu->integer, ==, 1); g_assert_cmpstr(wrap->alt->u.udfu->string, ==, "str"); g_assert_cmpint(wrap->alt->u.udfu->enum1, ==, ENUM_ONE_VALUE1); g_assert_cmpint(wrap->alt->u.udfu->u.value1->boolean, ==, true); g_assert_cmpint(wrap->alt->u.udfu->u.value1->has_a_b, ==, false); qapi_free_WrapAlternate(wrap); }
false
qemu
becceedc4d9bc1435099c90a0514945a89844d3a
static void test_visitor_in_alternate(TestInputVisitorData *data, const void *unused) { Visitor *v; Error *err = NULL; UserDefAlternate *tmp; WrapAlternate *wrap; v = visitor_input_test_init(data, "42"); visit_type_UserDefAlternate(v, NULL, &tmp, &error_abort); g_assert_cmpint(tmp->type, ==, QTYPE_QINT); g_assert_cmpint(tmp->u.i, ==, 42); qapi_free_UserDefAlternate(tmp); v = visitor_input_test_init(data, "'string'"); visit_type_UserDefAlternate(v, NULL, &tmp, &error_abort); g_assert_cmpint(tmp->type, ==, QTYPE_QSTRING); g_assert_cmpstr(tmp->u.s, ==, "string"); qapi_free_UserDefAlternate(tmp); v = visitor_input_test_init(data, "{'integer':1, 'string':'str', " "'enum1':'value1', 'boolean':true}"); visit_type_UserDefAlternate(v, NULL, &tmp, &error_abort); g_assert_cmpint(tmp->type, ==, QTYPE_QDICT); g_assert_cmpint(tmp->u.udfu->integer, ==, 1); g_assert_cmpstr(tmp->u.udfu->string, ==, "str"); g_assert_cmpint(tmp->u.udfu->enum1, ==, ENUM_ONE_VALUE1); g_assert_cmpint(tmp->u.udfu->u.value1->boolean, ==, true); g_assert_cmpint(tmp->u.udfu->u.value1->has_a_b, ==, false); qapi_free_UserDefAlternate(tmp); v = visitor_input_test_init(data, "false"); visit_type_UserDefAlternate(v, NULL, &tmp, &err); error_free_or_abort(&err); qapi_free_UserDefAlternate(tmp); v = visitor_input_test_init(data, "{ 'alt': 42 }"); visit_type_WrapAlternate(v, NULL, &wrap, &error_abort); g_assert_cmpint(wrap->alt->type, ==, QTYPE_QINT); g_assert_cmpint(wrap->alt->u.i, ==, 42); qapi_free_WrapAlternate(wrap); v = visitor_input_test_init(data, "{ 'alt': 'string' }"); visit_type_WrapAlternate(v, NULL, &wrap, &error_abort); g_assert_cmpint(wrap->alt->type, ==, QTYPE_QSTRING); g_assert_cmpstr(wrap->alt->u.s, ==, "string"); qapi_free_WrapAlternate(wrap); v = visitor_input_test_init(data, "{ 'alt': {'integer':1, 'string':'str', " "'enum1':'value1', 'boolean':true} }"); visit_type_WrapAlternate(v, NULL, &wrap, &error_abort); g_assert_cmpint(wrap->alt->type, ==, QTYPE_QDICT); g_assert_cmpint(wrap->alt->u.udfu->integer, ==, 1); g_assert_cmpstr(wrap->alt->u.udfu->string, ==, "str"); g_assert_cmpint(wrap->alt->u.udfu->enum1, ==, ENUM_ONE_VALUE1); g_assert_cmpint(wrap->alt->u.udfu->u.value1->boolean, ==, true); g_assert_cmpint(wrap->alt->u.udfu->u.value1->has_a_b, ==, false); qapi_free_WrapAlternate(wrap); }
{ "code": [], "line_no": [] }
static void FUNC_0(TestInputVisitorData *VAR_0, const void *VAR_1) { Visitor *v; Error *err = NULL; UserDefAlternate *tmp; WrapAlternate *wrap; v = visitor_input_test_init(VAR_0, "42"); visit_type_UserDefAlternate(v, NULL, &tmp, &error_abort); g_assert_cmpint(tmp->type, ==, QTYPE_QINT); g_assert_cmpint(tmp->u.i, ==, 42); qapi_free_UserDefAlternate(tmp); v = visitor_input_test_init(VAR_0, "'string'"); visit_type_UserDefAlternate(v, NULL, &tmp, &error_abort); g_assert_cmpint(tmp->type, ==, QTYPE_QSTRING); g_assert_cmpstr(tmp->u.s, ==, "string"); qapi_free_UserDefAlternate(tmp); v = visitor_input_test_init(VAR_0, "{'integer':1, 'string':'str', " "'enum1':'value1', 'boolean':true}"); visit_type_UserDefAlternate(v, NULL, &tmp, &error_abort); g_assert_cmpint(tmp->type, ==, QTYPE_QDICT); g_assert_cmpint(tmp->u.udfu->integer, ==, 1); g_assert_cmpstr(tmp->u.udfu->string, ==, "str"); g_assert_cmpint(tmp->u.udfu->enum1, ==, ENUM_ONE_VALUE1); g_assert_cmpint(tmp->u.udfu->u.value1->boolean, ==, true); g_assert_cmpint(tmp->u.udfu->u.value1->has_a_b, ==, false); qapi_free_UserDefAlternate(tmp); v = visitor_input_test_init(VAR_0, "false"); visit_type_UserDefAlternate(v, NULL, &tmp, &err); error_free_or_abort(&err); qapi_free_UserDefAlternate(tmp); v = visitor_input_test_init(VAR_0, "{ 'alt': 42 }"); visit_type_WrapAlternate(v, NULL, &wrap, &error_abort); g_assert_cmpint(wrap->alt->type, ==, QTYPE_QINT); g_assert_cmpint(wrap->alt->u.i, ==, 42); qapi_free_WrapAlternate(wrap); v = visitor_input_test_init(VAR_0, "{ 'alt': 'string' }"); visit_type_WrapAlternate(v, NULL, &wrap, &error_abort); g_assert_cmpint(wrap->alt->type, ==, QTYPE_QSTRING); g_assert_cmpstr(wrap->alt->u.s, ==, "string"); qapi_free_WrapAlternate(wrap); v = visitor_input_test_init(VAR_0, "{ 'alt': {'integer':1, 'string':'str', " "'enum1':'value1', 'boolean':true} }"); visit_type_WrapAlternate(v, NULL, &wrap, &error_abort); g_assert_cmpint(wrap->alt->type, ==, QTYPE_QDICT); g_assert_cmpint(wrap->alt->u.udfu->integer, ==, 1); g_assert_cmpstr(wrap->alt->u.udfu->string, ==, "str"); g_assert_cmpint(wrap->alt->u.udfu->enum1, ==, ENUM_ONE_VALUE1); g_assert_cmpint(wrap->alt->u.udfu->u.value1->boolean, ==, true); g_assert_cmpint(wrap->alt->u.udfu->u.value1->has_a_b, ==, false); qapi_free_WrapAlternate(wrap); }
[ "static void FUNC_0(TestInputVisitorData *VAR_0,\nconst void *VAR_1)\n{", "Visitor *v;", "Error *err = NULL;", "UserDefAlternate *tmp;", "WrapAlternate *wrap;", "v = visitor_input_test_init(VAR_0, \"42\");", "visit_type_UserDefAlternate(v, NULL, &tmp, &error_abort);", "g_assert_cmpint(tmp->type, ==, QTYPE_QINT);", "g_assert_cmpint(tmp->u.i, ==, 42);", "qapi_free_UserDefAlternate(tmp);", "v = visitor_input_test_init(VAR_0, \"'string'\");", "visit_type_UserDefAlternate(v, NULL, &tmp, &error_abort);", "g_assert_cmpint(tmp->type, ==, QTYPE_QSTRING);", "g_assert_cmpstr(tmp->u.s, ==, \"string\");", "qapi_free_UserDefAlternate(tmp);", "v = visitor_input_test_init(VAR_0, \"{'integer':1, 'string':'str', \"", "\"'enum1':'value1', 'boolean':true}\");", "visit_type_UserDefAlternate(v, NULL, &tmp, &error_abort);", "g_assert_cmpint(tmp->type, ==, QTYPE_QDICT);", "g_assert_cmpint(tmp->u.udfu->integer, ==, 1);", "g_assert_cmpstr(tmp->u.udfu->string, ==, \"str\");", "g_assert_cmpint(tmp->u.udfu->enum1, ==, ENUM_ONE_VALUE1);", "g_assert_cmpint(tmp->u.udfu->u.value1->boolean, ==, true);", "g_assert_cmpint(tmp->u.udfu->u.value1->has_a_b, ==, false);", "qapi_free_UserDefAlternate(tmp);", "v = visitor_input_test_init(VAR_0, \"false\");", "visit_type_UserDefAlternate(v, NULL, &tmp, &err);", "error_free_or_abort(&err);", "qapi_free_UserDefAlternate(tmp);", "v = visitor_input_test_init(VAR_0, \"{ 'alt': 42 }\");", "visit_type_WrapAlternate(v, NULL, &wrap, &error_abort);", "g_assert_cmpint(wrap->alt->type, ==, QTYPE_QINT);", "g_assert_cmpint(wrap->alt->u.i, ==, 42);", "qapi_free_WrapAlternate(wrap);", "v = visitor_input_test_init(VAR_0, \"{ 'alt': 'string' }\");", "visit_type_WrapAlternate(v, NULL, &wrap, &error_abort);", "g_assert_cmpint(wrap->alt->type, ==, QTYPE_QSTRING);", "g_assert_cmpstr(wrap->alt->u.s, ==, \"string\");", "qapi_free_WrapAlternate(wrap);", "v = visitor_input_test_init(VAR_0, \"{ 'alt': {'integer':1, 'string':'str', \"", "\"'enum1':'value1', 'boolean':true} }\");", "visit_type_WrapAlternate(v, NULL, &wrap, &error_abort);", "g_assert_cmpint(wrap->alt->type, ==, QTYPE_QDICT);", "g_assert_cmpint(wrap->alt->u.udfu->integer, ==, 1);", "g_assert_cmpstr(wrap->alt->u.udfu->string, ==, \"str\");", "g_assert_cmpint(wrap->alt->u.udfu->enum1, ==, ENUM_ONE_VALUE1);", "g_assert_cmpint(wrap->alt->u.udfu->u.value1->boolean, ==, true);", "g_assert_cmpint(wrap->alt->u.udfu->u.value1->has_a_b, ==, false);", "qapi_free_WrapAlternate(wrap);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ] ]
14,989
static int hls_read_header(AVFormatContext *s) { void *u = (s->flags & AVFMT_FLAG_CUSTOM_IO) ? NULL : s->pb; HLSContext *c = s->priv_data; int ret = 0, i; int highest_cur_seq_no = 0; c->ctx = s; c->interrupt_callback = &s->interrupt_callback; c->strict_std_compliance = s->strict_std_compliance; c->first_packet = 1; c->first_timestamp = AV_NOPTS_VALUE; c->cur_timestamp = AV_NOPTS_VALUE; if (u) { // get the previous user agent & set back to null if string size is zero update_options(&c->user_agent, "user-agent", u); // get the previous cookies & set back to null if string size is zero update_options(&c->cookies, "cookies", u); // get the previous headers & set back to null if string size is zero update_options(&c->headers, "headers", u); // get the previous http proxt & set back to null if string size is zero update_options(&c->http_proxy, "http_proxy", u); } if ((ret = parse_playlist(c, s->filename, NULL, s->pb)) < 0) goto fail; if ((ret = save_avio_options(s)) < 0) goto fail; /* Some HLS servers don't like being sent the range header */ av_dict_set(&c->avio_opts, "seekable", "0", 0); if (c->n_variants == 0) { av_log(NULL, AV_LOG_WARNING, "Empty playlist\n"); ret = AVERROR_EOF; goto fail; } /* If the playlist only contained playlists (Master Playlist), * parse each individual playlist. */ if (c->n_playlists > 1 || c->playlists[0]->n_segments == 0) { for (i = 0; i < c->n_playlists; i++) { struct playlist *pls = c->playlists[i]; if ((ret = parse_playlist(c, pls->url, pls, NULL)) < 0) goto fail; } } if (c->variants[0]->playlists[0]->n_segments == 0) { av_log(NULL, AV_LOG_WARNING, "Empty playlist\n"); ret = AVERROR_EOF; goto fail; } /* If this isn't a live stream, calculate the total duration of the * stream. */ if (c->variants[0]->playlists[0]->finished) { int64_t duration = 0; for (i = 0; i < c->variants[0]->playlists[0]->n_segments; i++) duration += c->variants[0]->playlists[0]->segments[i]->duration; s->duration = duration; } /* Associate renditions with variants */ for (i = 0; i < c->n_variants; i++) { struct variant *var = c->variants[i]; if (var->audio_group[0]) add_renditions_to_variant(c, var, AVMEDIA_TYPE_AUDIO, var->audio_group); if (var->video_group[0]) add_renditions_to_variant(c, var, AVMEDIA_TYPE_VIDEO, var->video_group); if (var->subtitles_group[0]) add_renditions_to_variant(c, var, AVMEDIA_TYPE_SUBTITLE, var->subtitles_group); } /* Create a program for each variant */ for (i = 0; i < c->n_variants; i++) { struct variant *v = c->variants[i]; AVProgram *program; program = av_new_program(s, i); if (!program) goto fail; av_dict_set_int(&program->metadata, "variant_bitrate", v->bandwidth, 0); } /* Select the starting segments */ for (i = 0; i < c->n_playlists; i++) { struct playlist *pls = c->playlists[i]; if (pls->n_segments == 0) continue; pls->cur_seq_no = select_cur_seq_no(c, pls); highest_cur_seq_no = FFMAX(highest_cur_seq_no, pls->cur_seq_no); } /* Open the demuxer for each playlist */ for (i = 0; i < c->n_playlists; i++) { struct playlist *pls = c->playlists[i]; AVInputFormat *in_fmt = NULL; if (!(pls->ctx = avformat_alloc_context())) { ret = AVERROR(ENOMEM); goto fail; } if (pls->n_segments == 0) continue; pls->index = i; pls->needed = 1; pls->parent = s; /* * If this is a live stream and this playlist looks like it is one segment * behind, try to sync it up so that every substream starts at the same * time position (so e.g. avformat_find_stream_info() will see packets from * all active streams within the first few seconds). This is not very generic, * though, as the sequence numbers are technically independent. */ if (!pls->finished && pls->cur_seq_no == highest_cur_seq_no - 1 && highest_cur_seq_no < pls->start_seq_no + pls->n_segments) { pls->cur_seq_no = highest_cur_seq_no; } pls->read_buffer = av_malloc(INITIAL_BUFFER_SIZE); if (!pls->read_buffer){ ret = AVERROR(ENOMEM); avformat_free_context(pls->ctx); pls->ctx = NULL; goto fail; } ffio_init_context(&pls->pb, pls->read_buffer, INITIAL_BUFFER_SIZE, 0, pls, read_data, NULL, NULL); pls->pb.seekable = 0; ret = av_probe_input_buffer(&pls->pb, &in_fmt, pls->segments[0]->url, NULL, 0, 0); if (ret < 0) { /* Free the ctx - it isn't initialized properly at this point, * so avformat_close_input shouldn't be called. If * avformat_open_input fails below, it frees and zeros the * context, so it doesn't need any special treatment like this. */ av_log(s, AV_LOG_ERROR, "Error when loading first segment '%s'\n", pls->segments[0]->url); avformat_free_context(pls->ctx); pls->ctx = NULL; goto fail; } pls->ctx->pb = &pls->pb; pls->ctx->io_open = nested_io_open; if ((ret = ff_copy_whiteblacklists(pls->ctx, s)) < 0) goto fail; ret = avformat_open_input(&pls->ctx, pls->segments[0]->url, in_fmt, NULL); if (ret < 0) goto fail; if (pls->id3_deferred_extra && pls->ctx->nb_streams == 1) { ff_id3v2_parse_apic(pls->ctx, &pls->id3_deferred_extra); avformat_queue_attached_pictures(pls->ctx); ff_id3v2_free_extra_meta(&pls->id3_deferred_extra); pls->id3_deferred_extra = NULL; } pls->ctx->ctx_flags &= ~AVFMTCTX_NOHEADER; ret = avformat_find_stream_info(pls->ctx, NULL); if (ret < 0) goto fail; if (pls->is_id3_timestamped == -1) av_log(s, AV_LOG_WARNING, "No expected HTTP requests have been made\n"); /* Create new AVStreams for each stream in this playlist */ ret = update_streams_from_subdemuxer(s, pls); if (ret < 0) goto fail; add_metadata_from_renditions(s, pls, AVMEDIA_TYPE_AUDIO); add_metadata_from_renditions(s, pls, AVMEDIA_TYPE_VIDEO); add_metadata_from_renditions(s, pls, AVMEDIA_TYPE_SUBTITLE); } return 0; fail: free_playlist_list(c); free_variant_list(c); free_rendition_list(c); return ret; }
false
FFmpeg
04964ac311abe670fb3b60290a330f2067544b13
static int hls_read_header(AVFormatContext *s) { void *u = (s->flags & AVFMT_FLAG_CUSTOM_IO) ? NULL : s->pb; HLSContext *c = s->priv_data; int ret = 0, i; int highest_cur_seq_no = 0; c->ctx = s; c->interrupt_callback = &s->interrupt_callback; c->strict_std_compliance = s->strict_std_compliance; c->first_packet = 1; c->first_timestamp = AV_NOPTS_VALUE; c->cur_timestamp = AV_NOPTS_VALUE; if (u) { update_options(&c->user_agent, "user-agent", u); update_options(&c->cookies, "cookies", u); update_options(&c->headers, "headers", u); update_options(&c->http_proxy, "http_proxy", u); } if ((ret = parse_playlist(c, s->filename, NULL, s->pb)) < 0) goto fail; if ((ret = save_avio_options(s)) < 0) goto fail; av_dict_set(&c->avio_opts, "seekable", "0", 0); if (c->n_variants == 0) { av_log(NULL, AV_LOG_WARNING, "Empty playlist\n"); ret = AVERROR_EOF; goto fail; } if (c->n_playlists > 1 || c->playlists[0]->n_segments == 0) { for (i = 0; i < c->n_playlists; i++) { struct playlist *pls = c->playlists[i]; if ((ret = parse_playlist(c, pls->url, pls, NULL)) < 0) goto fail; } } if (c->variants[0]->playlists[0]->n_segments == 0) { av_log(NULL, AV_LOG_WARNING, "Empty playlist\n"); ret = AVERROR_EOF; goto fail; } if (c->variants[0]->playlists[0]->finished) { int64_t duration = 0; for (i = 0; i < c->variants[0]->playlists[0]->n_segments; i++) duration += c->variants[0]->playlists[0]->segments[i]->duration; s->duration = duration; } for (i = 0; i < c->n_variants; i++) { struct variant *var = c->variants[i]; if (var->audio_group[0]) add_renditions_to_variant(c, var, AVMEDIA_TYPE_AUDIO, var->audio_group); if (var->video_group[0]) add_renditions_to_variant(c, var, AVMEDIA_TYPE_VIDEO, var->video_group); if (var->subtitles_group[0]) add_renditions_to_variant(c, var, AVMEDIA_TYPE_SUBTITLE, var->subtitles_group); } for (i = 0; i < c->n_variants; i++) { struct variant *v = c->variants[i]; AVProgram *program; program = av_new_program(s, i); if (!program) goto fail; av_dict_set_int(&program->metadata, "variant_bitrate", v->bandwidth, 0); } for (i = 0; i < c->n_playlists; i++) { struct playlist *pls = c->playlists[i]; if (pls->n_segments == 0) continue; pls->cur_seq_no = select_cur_seq_no(c, pls); highest_cur_seq_no = FFMAX(highest_cur_seq_no, pls->cur_seq_no); } for (i = 0; i < c->n_playlists; i++) { struct playlist *pls = c->playlists[i]; AVInputFormat *in_fmt = NULL; if (!(pls->ctx = avformat_alloc_context())) { ret = AVERROR(ENOMEM); goto fail; } if (pls->n_segments == 0) continue; pls->index = i; pls->needed = 1; pls->parent = s; if (!pls->finished && pls->cur_seq_no == highest_cur_seq_no - 1 && highest_cur_seq_no < pls->start_seq_no + pls->n_segments) { pls->cur_seq_no = highest_cur_seq_no; } pls->read_buffer = av_malloc(INITIAL_BUFFER_SIZE); if (!pls->read_buffer){ ret = AVERROR(ENOMEM); avformat_free_context(pls->ctx); pls->ctx = NULL; goto fail; } ffio_init_context(&pls->pb, pls->read_buffer, INITIAL_BUFFER_SIZE, 0, pls, read_data, NULL, NULL); pls->pb.seekable = 0; ret = av_probe_input_buffer(&pls->pb, &in_fmt, pls->segments[0]->url, NULL, 0, 0); if (ret < 0) { av_log(s, AV_LOG_ERROR, "Error when loading first segment '%s'\n", pls->segments[0]->url); avformat_free_context(pls->ctx); pls->ctx = NULL; goto fail; } pls->ctx->pb = &pls->pb; pls->ctx->io_open = nested_io_open; if ((ret = ff_copy_whiteblacklists(pls->ctx, s)) < 0) goto fail; ret = avformat_open_input(&pls->ctx, pls->segments[0]->url, in_fmt, NULL); if (ret < 0) goto fail; if (pls->id3_deferred_extra && pls->ctx->nb_streams == 1) { ff_id3v2_parse_apic(pls->ctx, &pls->id3_deferred_extra); avformat_queue_attached_pictures(pls->ctx); ff_id3v2_free_extra_meta(&pls->id3_deferred_extra); pls->id3_deferred_extra = NULL; } pls->ctx->ctx_flags &= ~AVFMTCTX_NOHEADER; ret = avformat_find_stream_info(pls->ctx, NULL); if (ret < 0) goto fail; if (pls->is_id3_timestamped == -1) av_log(s, AV_LOG_WARNING, "No expected HTTP requests have been made\n"); ret = update_streams_from_subdemuxer(s, pls); if (ret < 0) goto fail; add_metadata_from_renditions(s, pls, AVMEDIA_TYPE_AUDIO); add_metadata_from_renditions(s, pls, AVMEDIA_TYPE_VIDEO); add_metadata_from_renditions(s, pls, AVMEDIA_TYPE_SUBTITLE); } return 0; fail: free_playlist_list(c); free_variant_list(c); free_rendition_list(c); return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0) { void *VAR_1 = (VAR_0->flags & AVFMT_FLAG_CUSTOM_IO) ? NULL : VAR_0->pb; HLSContext *c = VAR_0->priv_data; int VAR_2 = 0, VAR_3; int VAR_4 = 0; c->ctx = VAR_0; c->interrupt_callback = &VAR_0->interrupt_callback; c->strict_std_compliance = VAR_0->strict_std_compliance; c->first_packet = 1; c->first_timestamp = AV_NOPTS_VALUE; c->cur_timestamp = AV_NOPTS_VALUE; if (VAR_1) { update_options(&c->user_agent, "user-agent", VAR_1); update_options(&c->cookies, "cookies", VAR_1); update_options(&c->headers, "headers", VAR_1); update_options(&c->http_proxy, "http_proxy", VAR_1); } if ((VAR_2 = parse_playlist(c, VAR_0->filename, NULL, VAR_0->pb)) < 0) goto fail; if ((VAR_2 = save_avio_options(VAR_0)) < 0) goto fail; av_dict_set(&c->avio_opts, "seekable", "0", 0); if (c->n_variants == 0) { av_log(NULL, AV_LOG_WARNING, "Empty playlist\n"); VAR_2 = AVERROR_EOF; goto fail; } if (c->n_playlists > 1 || c->playlists[0]->n_segments == 0) { for (VAR_3 = 0; VAR_3 < c->n_playlists; VAR_3++) { struct playlist *pls = c->playlists[VAR_3]; if ((VAR_2 = parse_playlist(c, pls->url, pls, NULL)) < 0) goto fail; } } if (c->variants[0]->playlists[0]->n_segments == 0) { av_log(NULL, AV_LOG_WARNING, "Empty playlist\n"); VAR_2 = AVERROR_EOF; goto fail; } if (c->variants[0]->playlists[0]->finished) { int64_t duration = 0; for (VAR_3 = 0; VAR_3 < c->variants[0]->playlists[0]->n_segments; VAR_3++) duration += c->variants[0]->playlists[0]->segments[VAR_3]->duration; VAR_0->duration = duration; } for (VAR_3 = 0; VAR_3 < c->n_variants; VAR_3++) { struct variant *var = c->variants[VAR_3]; if (var->audio_group[0]) add_renditions_to_variant(c, var, AVMEDIA_TYPE_AUDIO, var->audio_group); if (var->video_group[0]) add_renditions_to_variant(c, var, AVMEDIA_TYPE_VIDEO, var->video_group); if (var->subtitles_group[0]) add_renditions_to_variant(c, var, AVMEDIA_TYPE_SUBTITLE, var->subtitles_group); } for (VAR_3 = 0; VAR_3 < c->n_variants; VAR_3++) { struct variant *v = c->variants[VAR_3]; AVProgram *program; program = av_new_program(VAR_0, VAR_3); if (!program) goto fail; av_dict_set_int(&program->metadata, "variant_bitrate", v->bandwidth, 0); } for (VAR_3 = 0; VAR_3 < c->n_playlists; VAR_3++) { struct playlist *pls = c->playlists[VAR_3]; if (pls->n_segments == 0) continue; pls->cur_seq_no = select_cur_seq_no(c, pls); VAR_4 = FFMAX(VAR_4, pls->cur_seq_no); } for (VAR_3 = 0; VAR_3 < c->n_playlists; VAR_3++) { struct playlist *pls = c->playlists[VAR_3]; AVInputFormat *in_fmt = NULL; if (!(pls->ctx = avformat_alloc_context())) { VAR_2 = AVERROR(ENOMEM); goto fail; } if (pls->n_segments == 0) continue; pls->index = VAR_3; pls->needed = 1; pls->parent = VAR_0; if (!pls->finished && pls->cur_seq_no == VAR_4 - 1 && VAR_4 < pls->start_seq_no + pls->n_segments) { pls->cur_seq_no = VAR_4; } pls->read_buffer = av_malloc(INITIAL_BUFFER_SIZE); if (!pls->read_buffer){ VAR_2 = AVERROR(ENOMEM); avformat_free_context(pls->ctx); pls->ctx = NULL; goto fail; } ffio_init_context(&pls->pb, pls->read_buffer, INITIAL_BUFFER_SIZE, 0, pls, read_data, NULL, NULL); pls->pb.seekable = 0; VAR_2 = av_probe_input_buffer(&pls->pb, &in_fmt, pls->segments[0]->url, NULL, 0, 0); if (VAR_2 < 0) { av_log(VAR_0, AV_LOG_ERROR, "Error when loading first segment '%VAR_0'\n", pls->segments[0]->url); avformat_free_context(pls->ctx); pls->ctx = NULL; goto fail; } pls->ctx->pb = &pls->pb; pls->ctx->io_open = nested_io_open; if ((VAR_2 = ff_copy_whiteblacklists(pls->ctx, VAR_0)) < 0) goto fail; VAR_2 = avformat_open_input(&pls->ctx, pls->segments[0]->url, in_fmt, NULL); if (VAR_2 < 0) goto fail; if (pls->id3_deferred_extra && pls->ctx->nb_streams == 1) { ff_id3v2_parse_apic(pls->ctx, &pls->id3_deferred_extra); avformat_queue_attached_pictures(pls->ctx); ff_id3v2_free_extra_meta(&pls->id3_deferred_extra); pls->id3_deferred_extra = NULL; } pls->ctx->ctx_flags &= ~AVFMTCTX_NOHEADER; VAR_2 = avformat_find_stream_info(pls->ctx, NULL); if (VAR_2 < 0) goto fail; if (pls->is_id3_timestamped == -1) av_log(VAR_0, AV_LOG_WARNING, "No expected HTTP requests have been made\n"); VAR_2 = update_streams_from_subdemuxer(VAR_0, pls); if (VAR_2 < 0) goto fail; add_metadata_from_renditions(VAR_0, pls, AVMEDIA_TYPE_AUDIO); add_metadata_from_renditions(VAR_0, pls, AVMEDIA_TYPE_VIDEO); add_metadata_from_renditions(VAR_0, pls, AVMEDIA_TYPE_SUBTITLE); } return 0; fail: free_playlist_list(c); free_variant_list(c); free_rendition_list(c); return VAR_2; }
[ "static int FUNC_0(AVFormatContext *VAR_0)\n{", "void *VAR_1 = (VAR_0->flags & AVFMT_FLAG_CUSTOM_IO) ? NULL : VAR_0->pb;", "HLSContext *c = VAR_0->priv_data;", "int VAR_2 = 0, VAR_3;", "int VAR_4 = 0;", "c->ctx = VAR_0;", "c->interrupt_callback = &VAR_0->interrupt_callback;", "c->strict_std_compliance = VAR_0->strict_std_compliance;", "c->first_packet = 1;", "c->first_timestamp = AV_NOPTS_VALUE;", "c->cur_timestamp = AV_NOPTS_VALUE;", "if (VAR_1) {", "update_options(&c->user_agent, \"user-agent\", VAR_1);", "update_options(&c->cookies, \"cookies\", VAR_1);", "update_options(&c->headers, \"headers\", VAR_1);", "update_options(&c->http_proxy, \"http_proxy\", VAR_1);", "}", "if ((VAR_2 = parse_playlist(c, VAR_0->filename, NULL, VAR_0->pb)) < 0)\ngoto fail;", "if ((VAR_2 = save_avio_options(VAR_0)) < 0)\ngoto fail;", "av_dict_set(&c->avio_opts, \"seekable\", \"0\", 0);", "if (c->n_variants == 0) {", "av_log(NULL, AV_LOG_WARNING, \"Empty playlist\\n\");", "VAR_2 = AVERROR_EOF;", "goto fail;", "}", "if (c->n_playlists > 1 || c->playlists[0]->n_segments == 0) {", "for (VAR_3 = 0; VAR_3 < c->n_playlists; VAR_3++) {", "struct playlist *pls = c->playlists[VAR_3];", "if ((VAR_2 = parse_playlist(c, pls->url, pls, NULL)) < 0)\ngoto fail;", "}", "}", "if (c->variants[0]->playlists[0]->n_segments == 0) {", "av_log(NULL, AV_LOG_WARNING, \"Empty playlist\\n\");", "VAR_2 = AVERROR_EOF;", "goto fail;", "}", "if (c->variants[0]->playlists[0]->finished) {", "int64_t duration = 0;", "for (VAR_3 = 0; VAR_3 < c->variants[0]->playlists[0]->n_segments; VAR_3++)", "duration += c->variants[0]->playlists[0]->segments[VAR_3]->duration;", "VAR_0->duration = duration;", "}", "for (VAR_3 = 0; VAR_3 < c->n_variants; VAR_3++) {", "struct variant *var = c->variants[VAR_3];", "if (var->audio_group[0])\nadd_renditions_to_variant(c, var, AVMEDIA_TYPE_AUDIO, var->audio_group);", "if (var->video_group[0])\nadd_renditions_to_variant(c, var, AVMEDIA_TYPE_VIDEO, var->video_group);", "if (var->subtitles_group[0])\nadd_renditions_to_variant(c, var, AVMEDIA_TYPE_SUBTITLE, var->subtitles_group);", "}", "for (VAR_3 = 0; VAR_3 < c->n_variants; VAR_3++) {", "struct variant *v = c->variants[VAR_3];", "AVProgram *program;", "program = av_new_program(VAR_0, VAR_3);", "if (!program)\ngoto fail;", "av_dict_set_int(&program->metadata, \"variant_bitrate\", v->bandwidth, 0);", "}", "for (VAR_3 = 0; VAR_3 < c->n_playlists; VAR_3++) {", "struct playlist *pls = c->playlists[VAR_3];", "if (pls->n_segments == 0)\ncontinue;", "pls->cur_seq_no = select_cur_seq_no(c, pls);", "VAR_4 = FFMAX(VAR_4, pls->cur_seq_no);", "}", "for (VAR_3 = 0; VAR_3 < c->n_playlists; VAR_3++) {", "struct playlist *pls = c->playlists[VAR_3];", "AVInputFormat *in_fmt = NULL;", "if (!(pls->ctx = avformat_alloc_context())) {", "VAR_2 = AVERROR(ENOMEM);", "goto fail;", "}", "if (pls->n_segments == 0)\ncontinue;", "pls->index = VAR_3;", "pls->needed = 1;", "pls->parent = VAR_0;", "if (!pls->finished && pls->cur_seq_no == VAR_4 - 1 &&\nVAR_4 < pls->start_seq_no + pls->n_segments) {", "pls->cur_seq_no = VAR_4;", "}", "pls->read_buffer = av_malloc(INITIAL_BUFFER_SIZE);", "if (!pls->read_buffer){", "VAR_2 = AVERROR(ENOMEM);", "avformat_free_context(pls->ctx);", "pls->ctx = NULL;", "goto fail;", "}", "ffio_init_context(&pls->pb, pls->read_buffer, INITIAL_BUFFER_SIZE, 0, pls,\nread_data, NULL, NULL);", "pls->pb.seekable = 0;", "VAR_2 = av_probe_input_buffer(&pls->pb, &in_fmt, pls->segments[0]->url,\nNULL, 0, 0);", "if (VAR_2 < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"Error when loading first segment '%VAR_0'\\n\", pls->segments[0]->url);", "avformat_free_context(pls->ctx);", "pls->ctx = NULL;", "goto fail;", "}", "pls->ctx->pb = &pls->pb;", "pls->ctx->io_open = nested_io_open;", "if ((VAR_2 = ff_copy_whiteblacklists(pls->ctx, VAR_0)) < 0)\ngoto fail;", "VAR_2 = avformat_open_input(&pls->ctx, pls->segments[0]->url, in_fmt, NULL);", "if (VAR_2 < 0)\ngoto fail;", "if (pls->id3_deferred_extra && pls->ctx->nb_streams == 1) {", "ff_id3v2_parse_apic(pls->ctx, &pls->id3_deferred_extra);", "avformat_queue_attached_pictures(pls->ctx);", "ff_id3v2_free_extra_meta(&pls->id3_deferred_extra);", "pls->id3_deferred_extra = NULL;", "}", "pls->ctx->ctx_flags &= ~AVFMTCTX_NOHEADER;", "VAR_2 = avformat_find_stream_info(pls->ctx, NULL);", "if (VAR_2 < 0)\ngoto fail;", "if (pls->is_id3_timestamped == -1)\nav_log(VAR_0, AV_LOG_WARNING, \"No expected HTTP requests have been made\\n\");", "VAR_2 = update_streams_from_subdemuxer(VAR_0, pls);", "if (VAR_2 < 0)\ngoto fail;", "add_metadata_from_renditions(VAR_0, pls, AVMEDIA_TYPE_AUDIO);", "add_metadata_from_renditions(VAR_0, pls, AVMEDIA_TYPE_VIDEO);", "add_metadata_from_renditions(VAR_0, pls, AVMEDIA_TYPE_SUBTITLE);", "}", "return 0;", "fail:\nfree_playlist_list(c);", "free_variant_list(c);", "free_rendition_list(c);", "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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 35 ], [ 41 ], [ 47 ], [ 53 ], [ 55 ], [ 59, 61 ], [ 65, 67 ], [ 73 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 91 ], [ 93 ], [ 95 ], [ 97, 99 ], [ 101 ], [ 103 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 139 ], [ 141 ], [ 145, 147 ], [ 149, 151 ], [ 153, 155 ], [ 157 ], [ 163 ], [ 165 ], [ 167 ], [ 171 ], [ 173, 175 ], [ 177 ], [ 179 ], [ 185 ], [ 187 ], [ 191, 193 ], [ 197 ], [ 199 ], [ 201 ], [ 207 ], [ 209 ], [ 211 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 225, 227 ], [ 231 ], [ 233 ], [ 235 ], [ 253, 255 ], [ 257 ], [ 259 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277, 279 ], [ 281 ], [ 283, 285 ], [ 287 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305 ], [ 307 ], [ 309 ], [ 313, 315 ], [ 319 ], [ 321, 323 ], [ 327 ], [ 329 ], [ 331 ], [ 333 ], [ 335 ], [ 337 ], [ 341 ], [ 343 ], [ 345, 347 ], [ 351, 353 ], [ 359 ], [ 361, 363 ], [ 367 ], [ 369 ], [ 371 ], [ 373 ], [ 377 ], [ 379, 381 ], [ 383 ], [ 385 ], [ 387 ], [ 389 ] ]
14,990
void spapr_register_hypercall(target_ulong opcode, spapr_hcall_fn fn) { spapr_hcall_fn old_fn; assert(opcode <= MAX_HCALL_OPCODE); assert((opcode & 0x3) == 0); old_fn = hypercall_table[opcode / 4]; assert(!old_fn || (fn == old_fn)); hypercall_table[opcode / 4] = fn; }
true
qemu
39ac8455106af1ed669b8e10223420cf1ac5b190
void spapr_register_hypercall(target_ulong opcode, spapr_hcall_fn fn) { spapr_hcall_fn old_fn; assert(opcode <= MAX_HCALL_OPCODE); assert((opcode & 0x3) == 0); old_fn = hypercall_table[opcode / 4]; assert(!old_fn || (fn == old_fn)); hypercall_table[opcode / 4] = fn; }
{ "code": [ " spapr_hcall_fn old_fn;", " assert(opcode <= MAX_HCALL_OPCODE);", " assert((opcode & 0x3) == 0);", " old_fn = hypercall_table[opcode / 4];", " assert(!old_fn || (fn == old_fn));", " hypercall_table[opcode / 4] = fn;" ], "line_no": [ 5, 9, 11, 15, 19, 23 ] }
void FUNC_0(target_ulong VAR_0, spapr_hcall_fn VAR_1) { spapr_hcall_fn old_fn; assert(VAR_0 <= MAX_HCALL_OPCODE); assert((VAR_0 & 0x3) == 0); old_fn = hypercall_table[VAR_0 / 4]; assert(!old_fn || (VAR_1 == old_fn)); hypercall_table[VAR_0 / 4] = VAR_1; }
[ "void FUNC_0(target_ulong VAR_0, spapr_hcall_fn VAR_1)\n{", "spapr_hcall_fn old_fn;", "assert(VAR_0 <= MAX_HCALL_OPCODE);", "assert((VAR_0 & 0x3) == 0);", "old_fn = hypercall_table[VAR_0 / 4];", "assert(!old_fn || (VAR_1 == old_fn));", "hypercall_table[VAR_0 / 4] = VAR_1;", "}" ]
[ 0, 1, 1, 1, 1, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 15 ], [ 19 ], [ 23 ], [ 25 ] ]
14,991
static av_cold int init_subtitles(AVFilterContext *ctx, const char *args) { int ret, sid; AVFormatContext *fmt = NULL; AVCodecContext *dec_ctx = NULL; AVCodec *dec = NULL; AVStream *st; AVPacket pkt; AssContext *ass = ctx->priv; /* Init libass */ ret = init(ctx, args, &subtitles_class); if (ret < 0) return ret; ass->track = ass_new_track(ass->library); if (!ass->track) { av_log(ctx, AV_LOG_ERROR, "Could not create a libass track\n"); return AVERROR(EINVAL); } /* Open subtitles file */ ret = avformat_open_input(&fmt, ass->filename, NULL, NULL); if (ret < 0) { av_log(ctx, AV_LOG_ERROR, "Unable to open %s\n", ass->filename); goto end; } ret = avformat_find_stream_info(fmt, NULL); if (ret < 0) goto end; /* Locate subtitles stream */ ret = av_find_best_stream(fmt, AVMEDIA_TYPE_SUBTITLE, -1, -1, NULL, 0); if (ret < 0) { av_log(ctx, AV_LOG_ERROR, "Unable to locate subtitle stream in %s\n", ass->filename); goto end; } sid = ret; st = fmt->streams[sid]; /* Open decoder */ dec_ctx = st->codec; dec = avcodec_find_decoder(dec_ctx->codec_id); if (!dec) { av_log(ctx, AV_LOG_ERROR, "Failed to find subtitle codec %s\n", avcodec_get_name(dec_ctx->codec_id)); return AVERROR(EINVAL); } ret = avcodec_open2(dec_ctx, dec, NULL); if (ret < 0) goto end; /* Decode subtitles and push them into the renderer (libass) */ if (dec_ctx->subtitle_header) ass_process_codec_private(ass->track, dec_ctx->subtitle_header, dec_ctx->subtitle_header_size); av_init_packet(&pkt); pkt.data = NULL; pkt.size = 0; while (av_read_frame(fmt, &pkt) >= 0) { int i, got_subtitle; AVSubtitle sub; if (pkt.stream_index == sid) { ret = avcodec_decode_subtitle2(dec_ctx, &sub, &got_subtitle, &pkt); if (ret < 0 || !got_subtitle) break; for (i = 0; i < sub.num_rects; i++) { char *ass_line = sub.rects[i]->ass; if (!ass_line) break; ass_process_data(ass->track, ass_line, strlen(ass_line)); } } av_free_packet(&pkt); avsubtitle_free(&sub); } end: if (fmt) avformat_close_input(&fmt); if (dec_ctx) avcodec_close(dec_ctx); return ret; }
true
FFmpeg
ab5497df1556a2099038cdf7bde5e40608c6796e
static av_cold int init_subtitles(AVFilterContext *ctx, const char *args) { int ret, sid; AVFormatContext *fmt = NULL; AVCodecContext *dec_ctx = NULL; AVCodec *dec = NULL; AVStream *st; AVPacket pkt; AssContext *ass = ctx->priv; ret = init(ctx, args, &subtitles_class); if (ret < 0) return ret; ass->track = ass_new_track(ass->library); if (!ass->track) { av_log(ctx, AV_LOG_ERROR, "Could not create a libass track\n"); return AVERROR(EINVAL); } ret = avformat_open_input(&fmt, ass->filename, NULL, NULL); if (ret < 0) { av_log(ctx, AV_LOG_ERROR, "Unable to open %s\n", ass->filename); goto end; } ret = avformat_find_stream_info(fmt, NULL); if (ret < 0) goto end; ret = av_find_best_stream(fmt, AVMEDIA_TYPE_SUBTITLE, -1, -1, NULL, 0); if (ret < 0) { av_log(ctx, AV_LOG_ERROR, "Unable to locate subtitle stream in %s\n", ass->filename); goto end; } sid = ret; st = fmt->streams[sid]; dec_ctx = st->codec; dec = avcodec_find_decoder(dec_ctx->codec_id); if (!dec) { av_log(ctx, AV_LOG_ERROR, "Failed to find subtitle codec %s\n", avcodec_get_name(dec_ctx->codec_id)); return AVERROR(EINVAL); } ret = avcodec_open2(dec_ctx, dec, NULL); if (ret < 0) goto end; if (dec_ctx->subtitle_header) ass_process_codec_private(ass->track, dec_ctx->subtitle_header, dec_ctx->subtitle_header_size); av_init_packet(&pkt); pkt.data = NULL; pkt.size = 0; while (av_read_frame(fmt, &pkt) >= 0) { int i, got_subtitle; AVSubtitle sub; if (pkt.stream_index == sid) { ret = avcodec_decode_subtitle2(dec_ctx, &sub, &got_subtitle, &pkt); if (ret < 0 || !got_subtitle) break; for (i = 0; i < sub.num_rects; i++) { char *ass_line = sub.rects[i]->ass; if (!ass_line) break; ass_process_data(ass->track, ass_line, strlen(ass_line)); } } av_free_packet(&pkt); avsubtitle_free(&sub); } end: if (fmt) avformat_close_input(&fmt); if (dec_ctx) avcodec_close(dec_ctx); return ret; }
{ "code": [ " if (fmt)", " avformat_close_input(&fmt);" ], "line_no": [ 161, 163 ] }
static av_cold int FUNC_0(AVFilterContext *ctx, const char *args) { int VAR_0, VAR_1; AVFormatContext *fmt = NULL; AVCodecContext *dec_ctx = NULL; AVCodec *dec = NULL; AVStream *st; AVPacket pkt; AssContext *ass = ctx->priv; VAR_0 = init(ctx, args, &subtitles_class); if (VAR_0 < 0) return VAR_0; ass->track = ass_new_track(ass->library); if (!ass->track) { av_log(ctx, AV_LOG_ERROR, "Could not create a libass track\n"); return AVERROR(EINVAL); } VAR_0 = avformat_open_input(&fmt, ass->filename, NULL, NULL); if (VAR_0 < 0) { av_log(ctx, AV_LOG_ERROR, "Unable to open %s\n", ass->filename); goto end; } VAR_0 = avformat_find_stream_info(fmt, NULL); if (VAR_0 < 0) goto end; VAR_0 = av_find_best_stream(fmt, AVMEDIA_TYPE_SUBTITLE, -1, -1, NULL, 0); if (VAR_0 < 0) { av_log(ctx, AV_LOG_ERROR, "Unable to locate subtitle stream in %s\n", ass->filename); goto end; } VAR_1 = VAR_0; st = fmt->streams[VAR_1]; dec_ctx = st->codec; dec = avcodec_find_decoder(dec_ctx->codec_id); if (!dec) { av_log(ctx, AV_LOG_ERROR, "Failed to find subtitle codec %s\n", avcodec_get_name(dec_ctx->codec_id)); return AVERROR(EINVAL); } VAR_0 = avcodec_open2(dec_ctx, dec, NULL); if (VAR_0 < 0) goto end; if (dec_ctx->subtitle_header) ass_process_codec_private(ass->track, dec_ctx->subtitle_header, dec_ctx->subtitle_header_size); av_init_packet(&pkt); pkt.data = NULL; pkt.size = 0; while (av_read_frame(fmt, &pkt) >= 0) { int VAR_2, VAR_3; AVSubtitle sub; if (pkt.stream_index == VAR_1) { VAR_0 = avcodec_decode_subtitle2(dec_ctx, &sub, &VAR_3, &pkt); if (VAR_0 < 0 || !VAR_3) break; for (VAR_2 = 0; VAR_2 < sub.num_rects; VAR_2++) { char *ass_line = sub.rects[VAR_2]->ass; if (!ass_line) break; ass_process_data(ass->track, ass_line, strlen(ass_line)); } } av_free_packet(&pkt); avsubtitle_free(&sub); } end: if (fmt) avformat_close_input(&fmt); if (dec_ctx) avcodec_close(dec_ctx); return VAR_0; }
[ "static av_cold int FUNC_0(AVFilterContext *ctx, const char *args)\n{", "int VAR_0, VAR_1;", "AVFormatContext *fmt = NULL;", "AVCodecContext *dec_ctx = NULL;", "AVCodec *dec = NULL;", "AVStream *st;", "AVPacket pkt;", "AssContext *ass = ctx->priv;", "VAR_0 = init(ctx, args, &subtitles_class);", "if (VAR_0 < 0)\nreturn VAR_0;", "ass->track = ass_new_track(ass->library);", "if (!ass->track) {", "av_log(ctx, AV_LOG_ERROR, \"Could not create a libass track\\n\");", "return AVERROR(EINVAL);", "}", "VAR_0 = avformat_open_input(&fmt, ass->filename, NULL, NULL);", "if (VAR_0 < 0) {", "av_log(ctx, AV_LOG_ERROR, \"Unable to open %s\\n\", ass->filename);", "goto end;", "}", "VAR_0 = avformat_find_stream_info(fmt, NULL);", "if (VAR_0 < 0)\ngoto end;", "VAR_0 = av_find_best_stream(fmt, AVMEDIA_TYPE_SUBTITLE, -1, -1, NULL, 0);", "if (VAR_0 < 0) {", "av_log(ctx, AV_LOG_ERROR, \"Unable to locate subtitle stream in %s\\n\",\nass->filename);", "goto end;", "}", "VAR_1 = VAR_0;", "st = fmt->streams[VAR_1];", "dec_ctx = st->codec;", "dec = avcodec_find_decoder(dec_ctx->codec_id);", "if (!dec) {", "av_log(ctx, AV_LOG_ERROR, \"Failed to find subtitle codec %s\\n\",\navcodec_get_name(dec_ctx->codec_id));", "return AVERROR(EINVAL);", "}", "VAR_0 = avcodec_open2(dec_ctx, dec, NULL);", "if (VAR_0 < 0)\ngoto end;", "if (dec_ctx->subtitle_header)\nass_process_codec_private(ass->track,\ndec_ctx->subtitle_header,\ndec_ctx->subtitle_header_size);", "av_init_packet(&pkt);", "pkt.data = NULL;", "pkt.size = 0;", "while (av_read_frame(fmt, &pkt) >= 0) {", "int VAR_2, VAR_3;", "AVSubtitle sub;", "if (pkt.stream_index == VAR_1) {", "VAR_0 = avcodec_decode_subtitle2(dec_ctx, &sub, &VAR_3, &pkt);", "if (VAR_0 < 0 || !VAR_3)\nbreak;", "for (VAR_2 = 0; VAR_2 < sub.num_rects; VAR_2++) {", "char *ass_line = sub.rects[VAR_2]->ass;", "if (!ass_line)\nbreak;", "ass_process_data(ass->track, ass_line, strlen(ass_line));", "}", "}", "av_free_packet(&pkt);", "avsubtitle_free(&sub);", "}", "end:\nif (fmt)\navformat_close_input(&fmt);", "if (dec_ctx)\navcodec_close(dec_ctx);", "return 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55, 57 ], [ 63 ], [ 65 ], [ 67, 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 83 ], [ 85 ], [ 87 ], [ 89, 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99, 101 ], [ 107, 109, 111, 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 129 ], [ 131 ], [ 133, 135 ], [ 137 ], [ 139 ], [ 141, 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 159, 161, 163 ], [ 165, 167 ], [ 169 ], [ 171 ] ]
14,992
static void start_ahci_device(AHCIQState *ahci) { /* Map AHCI's ABAR (BAR5) */ ahci->hba_base = qpci_iomap(ahci->dev, 5, &ahci->barsize); /* turns on pci.cmd.iose, pci.cmd.mse and pci.cmd.bme */ qpci_device_enable(ahci->dev); }
true
qemu
9a75b0a037e3a8030992244353f17b62f6daf2ab
static void start_ahci_device(AHCIQState *ahci) { ahci->hba_base = qpci_iomap(ahci->dev, 5, &ahci->barsize); qpci_device_enable(ahci->dev); }
{ "code": [ "static void start_ahci_device(AHCIQState *ahci)", " ahci->hba_base = qpci_iomap(ahci->dev, 5, &ahci->barsize);", " qpci_device_enable(ahci->dev);" ], "line_no": [ 1, 7, 13 ] }
static void FUNC_0(AHCIQState *VAR_0) { VAR_0->hba_base = qpci_iomap(VAR_0->dev, 5, &VAR_0->barsize); qpci_device_enable(VAR_0->dev); }
[ "static void FUNC_0(AHCIQState *VAR_0)\n{", "VAR_0->hba_base = qpci_iomap(VAR_0->dev, 5, &VAR_0->barsize);", "qpci_device_enable(VAR_0->dev);", "}" ]
[ 1, 1, 1, 0 ]
[ [ 1, 3 ], [ 7 ], [ 13 ], [ 15 ] ]
14,993
static void rv30_loop_filter(RV34DecContext *r, int row) { MpegEncContext *s = &r->s; int mb_pos, mb_x; int i, j, k; uint8_t *Y, *C; int loc_lim, cur_lim, left_lim = 0, top_lim = 0; mb_pos = row * s->mb_stride; for(mb_x = 0; mb_x < s->mb_width; mb_x++, mb_pos++){ int mbtype = s->current_picture_ptr->mb_type[mb_pos]; if(IS_INTRA(mbtype) || IS_SEPARATE_DC(mbtype)) r->deblock_coefs[mb_pos] = 0xFFFF; if(IS_INTRA(mbtype)) r->cbp_chroma[mb_pos] = 0xFF; } /* all vertical edges are filtered first * and horizontal edges are filtered on the next iteration */ mb_pos = row * s->mb_stride; for(mb_x = 0; mb_x < s->mb_width; mb_x++, mb_pos++){ cur_lim = rv30_loop_filt_lim[s->current_picture_ptr->qscale_table[mb_pos]]; if(mb_x) left_lim = rv30_loop_filt_lim[s->current_picture_ptr->qscale_table[mb_pos - 1]]; for(j = 0; j < 16; j += 4){ Y = s->current_picture_ptr->f.data[0] + mb_x*16 + (row*16 + j) * s->linesize + 4 * !mb_x; for(i = !mb_x; i < 4; i++, Y += 4){ int ij = i + j; loc_lim = 0; if(r->deblock_coefs[mb_pos] & (1 << ij)) loc_lim = cur_lim; else if(!i && r->deblock_coefs[mb_pos - 1] & (1 << (ij + 3))) loc_lim = left_lim; else if( i && r->deblock_coefs[mb_pos] & (1 << (ij - 1))) loc_lim = cur_lim; if(loc_lim) rv30_weak_loop_filter(Y, 1, s->linesize, loc_lim); } } for(k = 0; k < 2; k++){ int cur_cbp, left_cbp = 0; cur_cbp = (r->cbp_chroma[mb_pos] >> (k*4)) & 0xF; if(mb_x) left_cbp = (r->cbp_chroma[mb_pos - 1] >> (k*4)) & 0xF; for(j = 0; j < 8; j += 4){ C = s->current_picture_ptr->f.data[k + 1] + mb_x*8 + (row*8 + j) * s->uvlinesize + 4 * !mb_x; for(i = !mb_x; i < 2; i++, C += 4){ int ij = i + (j >> 1); loc_lim = 0; if (cur_cbp & (1 << ij)) loc_lim = cur_lim; else if(!i && left_cbp & (1 << (ij + 1))) loc_lim = left_lim; else if( i && cur_cbp & (1 << (ij - 1))) loc_lim = cur_lim; if(loc_lim) rv30_weak_loop_filter(C, 1, s->uvlinesize, loc_lim); } } } } mb_pos = row * s->mb_stride; for(mb_x = 0; mb_x < s->mb_width; mb_x++, mb_pos++){ cur_lim = rv30_loop_filt_lim[s->current_picture_ptr->qscale_table[mb_pos]]; if(row) top_lim = rv30_loop_filt_lim[s->current_picture_ptr->qscale_table[mb_pos - s->mb_stride]]; for(j = 4*!row; j < 16; j += 4){ Y = s->current_picture_ptr->f.data[0] + mb_x*16 + (row*16 + j) * s->linesize; for(i = 0; i < 4; i++, Y += 4){ int ij = i + j; loc_lim = 0; if(r->deblock_coefs[mb_pos] & (1 << ij)) loc_lim = cur_lim; else if(!j && r->deblock_coefs[mb_pos - s->mb_stride] & (1 << (ij + 12))) loc_lim = top_lim; else if( j && r->deblock_coefs[mb_pos] & (1 << (ij - 4))) loc_lim = cur_lim; if(loc_lim) rv30_weak_loop_filter(Y, s->linesize, 1, loc_lim); } } for(k = 0; k < 2; k++){ int cur_cbp, top_cbp = 0; cur_cbp = (r->cbp_chroma[mb_pos] >> (k*4)) & 0xF; if(row) top_cbp = (r->cbp_chroma[mb_pos - s->mb_stride] >> (k*4)) & 0xF; for(j = 4*!row; j < 8; j += 4){ C = s->current_picture_ptr->f.data[k+1] + mb_x*8 + (row*8 + j) * s->uvlinesize; for(i = 0; i < 2; i++, C += 4){ int ij = i + (j >> 1); loc_lim = 0; if (r->cbp_chroma[mb_pos] & (1 << ij)) loc_lim = cur_lim; else if(!j && top_cbp & (1 << (ij + 2))) loc_lim = top_lim; else if( j && cur_cbp & (1 << (ij - 2))) loc_lim = cur_lim; if(loc_lim) rv30_weak_loop_filter(C, s->uvlinesize, 1, loc_lim); } } } } }
true
FFmpeg
f6774f905fb3cfdc319523ac640be30b14c1bc55
static void rv30_loop_filter(RV34DecContext *r, int row) { MpegEncContext *s = &r->s; int mb_pos, mb_x; int i, j, k; uint8_t *Y, *C; int loc_lim, cur_lim, left_lim = 0, top_lim = 0; mb_pos = row * s->mb_stride; for(mb_x = 0; mb_x < s->mb_width; mb_x++, mb_pos++){ int mbtype = s->current_picture_ptr->mb_type[mb_pos]; if(IS_INTRA(mbtype) || IS_SEPARATE_DC(mbtype)) r->deblock_coefs[mb_pos] = 0xFFFF; if(IS_INTRA(mbtype)) r->cbp_chroma[mb_pos] = 0xFF; } mb_pos = row * s->mb_stride; for(mb_x = 0; mb_x < s->mb_width; mb_x++, mb_pos++){ cur_lim = rv30_loop_filt_lim[s->current_picture_ptr->qscale_table[mb_pos]]; if(mb_x) left_lim = rv30_loop_filt_lim[s->current_picture_ptr->qscale_table[mb_pos - 1]]; for(j = 0; j < 16; j += 4){ Y = s->current_picture_ptr->f.data[0] + mb_x*16 + (row*16 + j) * s->linesize + 4 * !mb_x; for(i = !mb_x; i < 4; i++, Y += 4){ int ij = i + j; loc_lim = 0; if(r->deblock_coefs[mb_pos] & (1 << ij)) loc_lim = cur_lim; else if(!i && r->deblock_coefs[mb_pos - 1] & (1 << (ij + 3))) loc_lim = left_lim; else if( i && r->deblock_coefs[mb_pos] & (1 << (ij - 1))) loc_lim = cur_lim; if(loc_lim) rv30_weak_loop_filter(Y, 1, s->linesize, loc_lim); } } for(k = 0; k < 2; k++){ int cur_cbp, left_cbp = 0; cur_cbp = (r->cbp_chroma[mb_pos] >> (k*4)) & 0xF; if(mb_x) left_cbp = (r->cbp_chroma[mb_pos - 1] >> (k*4)) & 0xF; for(j = 0; j < 8; j += 4){ C = s->current_picture_ptr->f.data[k + 1] + mb_x*8 + (row*8 + j) * s->uvlinesize + 4 * !mb_x; for(i = !mb_x; i < 2; i++, C += 4){ int ij = i + (j >> 1); loc_lim = 0; if (cur_cbp & (1 << ij)) loc_lim = cur_lim; else if(!i && left_cbp & (1 << (ij + 1))) loc_lim = left_lim; else if( i && cur_cbp & (1 << (ij - 1))) loc_lim = cur_lim; if(loc_lim) rv30_weak_loop_filter(C, 1, s->uvlinesize, loc_lim); } } } } mb_pos = row * s->mb_stride; for(mb_x = 0; mb_x < s->mb_width; mb_x++, mb_pos++){ cur_lim = rv30_loop_filt_lim[s->current_picture_ptr->qscale_table[mb_pos]]; if(row) top_lim = rv30_loop_filt_lim[s->current_picture_ptr->qscale_table[mb_pos - s->mb_stride]]; for(j = 4*!row; j < 16; j += 4){ Y = s->current_picture_ptr->f.data[0] + mb_x*16 + (row*16 + j) * s->linesize; for(i = 0; i < 4; i++, Y += 4){ int ij = i + j; loc_lim = 0; if(r->deblock_coefs[mb_pos] & (1 << ij)) loc_lim = cur_lim; else if(!j && r->deblock_coefs[mb_pos - s->mb_stride] & (1 << (ij + 12))) loc_lim = top_lim; else if( j && r->deblock_coefs[mb_pos] & (1 << (ij - 4))) loc_lim = cur_lim; if(loc_lim) rv30_weak_loop_filter(Y, s->linesize, 1, loc_lim); } } for(k = 0; k < 2; k++){ int cur_cbp, top_cbp = 0; cur_cbp = (r->cbp_chroma[mb_pos] >> (k*4)) & 0xF; if(row) top_cbp = (r->cbp_chroma[mb_pos - s->mb_stride] >> (k*4)) & 0xF; for(j = 4*!row; j < 8; j += 4){ C = s->current_picture_ptr->f.data[k+1] + mb_x*8 + (row*8 + j) * s->uvlinesize; for(i = 0; i < 2; i++, C += 4){ int ij = i + (j >> 1); loc_lim = 0; if (r->cbp_chroma[mb_pos] & (1 << ij)) loc_lim = cur_lim; else if(!j && top_cbp & (1 << (ij + 2))) loc_lim = top_lim; else if( j && cur_cbp & (1 << (ij - 2))) loc_lim = cur_lim; if(loc_lim) rv30_weak_loop_filter(C, s->uvlinesize, 1, loc_lim); } } } } }
{ "code": [ " Y = s->current_picture_ptr->f.data[0] + mb_x*16 + (row*16 + j) * s->linesize + 4 * !mb_x;", " C = s->current_picture_ptr->f.data[k + 1] + mb_x*8 + (row*8 + j) * s->uvlinesize + 4 * !mb_x;", " Y = s->current_picture_ptr->f.data[0] + mb_x*16 + (row*16 + j) * s->linesize;", " C = s->current_picture_ptr->f.data[k+1] + mb_x*8 + (row*8 + j) * s->uvlinesize;", " Y = s->current_picture_ptr->f.data[0] + mb_x*16 + (row*16 + j) * s->linesize;" ], "line_no": [ 53, 93, 137, 177, 137 ] }
static void FUNC_0(RV34DecContext *VAR_0, int VAR_1) { MpegEncContext *s = &VAR_0->s; int VAR_2, VAR_3; int VAR_4, VAR_5, VAR_6; uint8_t *Y, *C; int VAR_7, VAR_8, VAR_9 = 0, VAR_10 = 0; VAR_2 = VAR_1 * s->mb_stride; for(VAR_3 = 0; VAR_3 < s->mb_width; VAR_3++, VAR_2++){ int mbtype = s->current_picture_ptr->mb_type[VAR_2]; if(IS_INTRA(mbtype) || IS_SEPARATE_DC(mbtype)) VAR_0->deblock_coefs[VAR_2] = 0xFFFF; if(IS_INTRA(mbtype)) VAR_0->cbp_chroma[VAR_2] = 0xFF; } VAR_2 = VAR_1 * s->mb_stride; for(VAR_3 = 0; VAR_3 < s->mb_width; VAR_3++, VAR_2++){ VAR_8 = rv30_loop_filt_lim[s->current_picture_ptr->qscale_table[VAR_2]]; if(VAR_3) VAR_9 = rv30_loop_filt_lim[s->current_picture_ptr->qscale_table[VAR_2 - 1]]; for(VAR_5 = 0; VAR_5 < 16; VAR_5 += 4){ Y = s->current_picture_ptr->f.data[0] + VAR_3*16 + (VAR_1*16 + VAR_5) * s->linesize + 4 * !VAR_3; for(VAR_4 = !VAR_3; VAR_4 < 4; VAR_4++, Y += 4){ int ij = VAR_4 + VAR_5; VAR_7 = 0; if(VAR_0->deblock_coefs[VAR_2] & (1 << ij)) VAR_7 = VAR_8; else if(!VAR_4 && VAR_0->deblock_coefs[VAR_2 - 1] & (1 << (ij + 3))) VAR_7 = VAR_9; else if( VAR_4 && VAR_0->deblock_coefs[VAR_2] & (1 << (ij - 1))) VAR_7 = VAR_8; if(VAR_7) rv30_weak_loop_filter(Y, 1, s->linesize, VAR_7); } } for(VAR_6 = 0; VAR_6 < 2; VAR_6++){ int cur_cbp, left_cbp = 0; cur_cbp = (VAR_0->cbp_chroma[VAR_2] >> (VAR_6*4)) & 0xF; if(VAR_3) left_cbp = (VAR_0->cbp_chroma[VAR_2 - 1] >> (VAR_6*4)) & 0xF; for(VAR_5 = 0; VAR_5 < 8; VAR_5 += 4){ C = s->current_picture_ptr->f.data[VAR_6 + 1] + VAR_3*8 + (VAR_1*8 + VAR_5) * s->uvlinesize + 4 * !VAR_3; for(VAR_4 = !VAR_3; VAR_4 < 2; VAR_4++, C += 4){ int ij = VAR_4 + (VAR_5 >> 1); VAR_7 = 0; if (cur_cbp & (1 << ij)) VAR_7 = VAR_8; else if(!VAR_4 && left_cbp & (1 << (ij + 1))) VAR_7 = VAR_9; else if( VAR_4 && cur_cbp & (1 << (ij - 1))) VAR_7 = VAR_8; if(VAR_7) rv30_weak_loop_filter(C, 1, s->uvlinesize, VAR_7); } } } } VAR_2 = VAR_1 * s->mb_stride; for(VAR_3 = 0; VAR_3 < s->mb_width; VAR_3++, VAR_2++){ VAR_8 = rv30_loop_filt_lim[s->current_picture_ptr->qscale_table[VAR_2]]; if(VAR_1) VAR_10 = rv30_loop_filt_lim[s->current_picture_ptr->qscale_table[VAR_2 - s->mb_stride]]; for(VAR_5 = 4*!VAR_1; VAR_5 < 16; VAR_5 += 4){ Y = s->current_picture_ptr->f.data[0] + VAR_3*16 + (VAR_1*16 + VAR_5) * s->linesize; for(VAR_4 = 0; VAR_4 < 4; VAR_4++, Y += 4){ int ij = VAR_4 + VAR_5; VAR_7 = 0; if(VAR_0->deblock_coefs[VAR_2] & (1 << ij)) VAR_7 = VAR_8; else if(!VAR_5 && VAR_0->deblock_coefs[VAR_2 - s->mb_stride] & (1 << (ij + 12))) VAR_7 = VAR_10; else if( VAR_5 && VAR_0->deblock_coefs[VAR_2] & (1 << (ij - 4))) VAR_7 = VAR_8; if(VAR_7) rv30_weak_loop_filter(Y, s->linesize, 1, VAR_7); } } for(VAR_6 = 0; VAR_6 < 2; VAR_6++){ int cur_cbp, top_cbp = 0; cur_cbp = (VAR_0->cbp_chroma[VAR_2] >> (VAR_6*4)) & 0xF; if(VAR_1) top_cbp = (VAR_0->cbp_chroma[VAR_2 - s->mb_stride] >> (VAR_6*4)) & 0xF; for(VAR_5 = 4*!VAR_1; VAR_5 < 8; VAR_5 += 4){ C = s->current_picture_ptr->f.data[VAR_6+1] + VAR_3*8 + (VAR_1*8 + VAR_5) * s->uvlinesize; for(VAR_4 = 0; VAR_4 < 2; VAR_4++, C += 4){ int ij = VAR_4 + (VAR_5 >> 1); VAR_7 = 0; if (VAR_0->cbp_chroma[VAR_2] & (1 << ij)) VAR_7 = VAR_8; else if(!VAR_5 && top_cbp & (1 << (ij + 2))) VAR_7 = VAR_10; else if( VAR_5 && cur_cbp & (1 << (ij - 2))) VAR_7 = VAR_8; if(VAR_7) rv30_weak_loop_filter(C, s->uvlinesize, 1, VAR_7); } } } } }
[ "static void FUNC_0(RV34DecContext *VAR_0, int VAR_1)\n{", "MpegEncContext *s = &VAR_0->s;", "int VAR_2, VAR_3;", "int VAR_4, VAR_5, VAR_6;", "uint8_t *Y, *C;", "int VAR_7, VAR_8, VAR_9 = 0, VAR_10 = 0;", "VAR_2 = VAR_1 * s->mb_stride;", "for(VAR_3 = 0; VAR_3 < s->mb_width; VAR_3++, VAR_2++){", "int mbtype = s->current_picture_ptr->mb_type[VAR_2];", "if(IS_INTRA(mbtype) || IS_SEPARATE_DC(mbtype))\nVAR_0->deblock_coefs[VAR_2] = 0xFFFF;", "if(IS_INTRA(mbtype))\nVAR_0->cbp_chroma[VAR_2] = 0xFF;", "}", "VAR_2 = VAR_1 * s->mb_stride;", "for(VAR_3 = 0; VAR_3 < s->mb_width; VAR_3++, VAR_2++){", "VAR_8 = rv30_loop_filt_lim[s->current_picture_ptr->qscale_table[VAR_2]];", "if(VAR_3)\nVAR_9 = rv30_loop_filt_lim[s->current_picture_ptr->qscale_table[VAR_2 - 1]];", "for(VAR_5 = 0; VAR_5 < 16; VAR_5 += 4){", "Y = s->current_picture_ptr->f.data[0] + VAR_3*16 + (VAR_1*16 + VAR_5) * s->linesize + 4 * !VAR_3;", "for(VAR_4 = !VAR_3; VAR_4 < 4; VAR_4++, Y += 4){", "int ij = VAR_4 + VAR_5;", "VAR_7 = 0;", "if(VAR_0->deblock_coefs[VAR_2] & (1 << ij))\nVAR_7 = VAR_8;", "else if(!VAR_4 && VAR_0->deblock_coefs[VAR_2 - 1] & (1 << (ij + 3)))\nVAR_7 = VAR_9;", "else if( VAR_4 && VAR_0->deblock_coefs[VAR_2] & (1 << (ij - 1)))\nVAR_7 = VAR_8;", "if(VAR_7)\nrv30_weak_loop_filter(Y, 1, s->linesize, VAR_7);", "}", "}", "for(VAR_6 = 0; VAR_6 < 2; VAR_6++){", "int cur_cbp, left_cbp = 0;", "cur_cbp = (VAR_0->cbp_chroma[VAR_2] >> (VAR_6*4)) & 0xF;", "if(VAR_3)\nleft_cbp = (VAR_0->cbp_chroma[VAR_2 - 1] >> (VAR_6*4)) & 0xF;", "for(VAR_5 = 0; VAR_5 < 8; VAR_5 += 4){", "C = s->current_picture_ptr->f.data[VAR_6 + 1] + VAR_3*8 + (VAR_1*8 + VAR_5) * s->uvlinesize + 4 * !VAR_3;", "for(VAR_4 = !VAR_3; VAR_4 < 2; VAR_4++, C += 4){", "int ij = VAR_4 + (VAR_5 >> 1);", "VAR_7 = 0;", "if (cur_cbp & (1 << ij))\nVAR_7 = VAR_8;", "else if(!VAR_4 && left_cbp & (1 << (ij + 1)))\nVAR_7 = VAR_9;", "else if( VAR_4 && cur_cbp & (1 << (ij - 1)))\nVAR_7 = VAR_8;", "if(VAR_7)\nrv30_weak_loop_filter(C, 1, s->uvlinesize, VAR_7);", "}", "}", "}", "}", "VAR_2 = VAR_1 * s->mb_stride;", "for(VAR_3 = 0; VAR_3 < s->mb_width; VAR_3++, VAR_2++){", "VAR_8 = rv30_loop_filt_lim[s->current_picture_ptr->qscale_table[VAR_2]];", "if(VAR_1)\nVAR_10 = rv30_loop_filt_lim[s->current_picture_ptr->qscale_table[VAR_2 - s->mb_stride]];", "for(VAR_5 = 4*!VAR_1; VAR_5 < 16; VAR_5 += 4){", "Y = s->current_picture_ptr->f.data[0] + VAR_3*16 + (VAR_1*16 + VAR_5) * s->linesize;", "for(VAR_4 = 0; VAR_4 < 4; VAR_4++, Y += 4){", "int ij = VAR_4 + VAR_5;", "VAR_7 = 0;", "if(VAR_0->deblock_coefs[VAR_2] & (1 << ij))\nVAR_7 = VAR_8;", "else if(!VAR_5 && VAR_0->deblock_coefs[VAR_2 - s->mb_stride] & (1 << (ij + 12)))\nVAR_7 = VAR_10;", "else if( VAR_5 && VAR_0->deblock_coefs[VAR_2] & (1 << (ij - 4)))\nVAR_7 = VAR_8;", "if(VAR_7)\nrv30_weak_loop_filter(Y, s->linesize, 1, VAR_7);", "}", "}", "for(VAR_6 = 0; VAR_6 < 2; VAR_6++){", "int cur_cbp, top_cbp = 0;", "cur_cbp = (VAR_0->cbp_chroma[VAR_2] >> (VAR_6*4)) & 0xF;", "if(VAR_1)\ntop_cbp = (VAR_0->cbp_chroma[VAR_2 - s->mb_stride] >> (VAR_6*4)) & 0xF;", "for(VAR_5 = 4*!VAR_1; VAR_5 < 8; VAR_5 += 4){", "C = s->current_picture_ptr->f.data[VAR_6+1] + VAR_3*8 + (VAR_1*8 + VAR_5) * s->uvlinesize;", "for(VAR_4 = 0; VAR_4 < 2; VAR_4++, C += 4){", "int ij = VAR_4 + (VAR_5 >> 1);", "VAR_7 = 0;", "if (VAR_0->cbp_chroma[VAR_2] & (1 << ij))\nVAR_7 = VAR_8;", "else if(!VAR_5 && top_cbp & (1 << (ij + 2)))\nVAR_7 = VAR_10;", "else if( VAR_5 && cur_cbp & (1 << (ij - 2)))\nVAR_7 = VAR_8;", "if(VAR_7)\nrv30_weak_loop_filter(C, s->uvlinesize, 1, VAR_7);", "}", "}", "}", "}", "}" ]
[ 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, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23, 25 ], [ 27, 29 ], [ 31 ], [ 41 ], [ 43 ], [ 45 ], [ 47, 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61, 63 ], [ 65, 67 ], [ 69, 71 ], [ 73, 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87, 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101, 103 ], [ 105, 107 ], [ 109, 111 ], [ 113, 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131, 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145, 147 ], [ 149, 151 ], [ 153, 155 ], [ 157, 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171, 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185, 187 ], [ 189, 191 ], [ 193, 195 ], [ 197, 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ] ]
14,994
static void alac_linear_predictor(AlacEncodeContext *s, int ch) { int i; LPCContext lpc = s->lpc[ch]; if(lpc.lpc_order == 31) { s->predictor_buf[0] = s->sample_buf[ch][0]; for(i=1; i<s->avctx->frame_size; i++) s->predictor_buf[i] = s->sample_buf[ch][i] - s->sample_buf[ch][i-1]; return; } // generalised linear predictor if(lpc.lpc_order > 0) { int32_t *samples = s->sample_buf[ch]; int32_t *residual = s->predictor_buf; // generate warm-up samples residual[0] = samples[0]; for(i=1;i<=lpc.lpc_order;i++) residual[i] = samples[i] - samples[i-1]; // perform lpc on remaining samples for(i = lpc.lpc_order + 1; i < s->avctx->frame_size; i++) { int sum = 1 << (lpc.lpc_quant - 1), res_val, j; for (j = 0; j < lpc.lpc_order; j++) { sum += (samples[lpc.lpc_order-j] - samples[0]) * lpc.lpc_coeff[j]; } sum >>= lpc.lpc_quant; sum += samples[0]; residual[i] = samples[lpc.lpc_order+1] - sum; res_val = residual[i]; if(res_val) { int index = lpc.lpc_order - 1; int neg = (res_val < 0); while(index >= 0 && (neg ? (res_val < 0):(res_val > 0))) { int val = samples[0] - samples[lpc.lpc_order - index]; int sign = (val ? FFSIGN(val) : 0); if(neg) sign*=-1; lpc.lpc_coeff[index] -= sign; val *= sign; res_val -= ((val >> lpc.lpc_quant) * (lpc.lpc_order - index)); index--; } } samples++; } } }
true
FFmpeg
3d5e1bfb20d3489d7bb2fa26196e02086e06f2b8
static void alac_linear_predictor(AlacEncodeContext *s, int ch) { int i; LPCContext lpc = s->lpc[ch]; if(lpc.lpc_order == 31) { s->predictor_buf[0] = s->sample_buf[ch][0]; for(i=1; i<s->avctx->frame_size; i++) s->predictor_buf[i] = s->sample_buf[ch][i] - s->sample_buf[ch][i-1]; return; } if(lpc.lpc_order > 0) { int32_t *samples = s->sample_buf[ch]; int32_t *residual = s->predictor_buf; residual[0] = samples[0]; for(i=1;i<=lpc.lpc_order;i++) residual[i] = samples[i] - samples[i-1]; for(i = lpc.lpc_order + 1; i < s->avctx->frame_size; i++) { int sum = 1 << (lpc.lpc_quant - 1), res_val, j; for (j = 0; j < lpc.lpc_order; j++) { sum += (samples[lpc.lpc_order-j] - samples[0]) * lpc.lpc_coeff[j]; } sum >>= lpc.lpc_quant; sum += samples[0]; residual[i] = samples[lpc.lpc_order+1] - sum; res_val = residual[i]; if(res_val) { int index = lpc.lpc_order - 1; int neg = (res_val < 0); while(index >= 0 && (neg ? (res_val < 0):(res_val > 0))) { int val = samples[0] - samples[lpc.lpc_order - index]; int sign = (val ? FFSIGN(val) : 0); if(neg) sign*=-1; lpc.lpc_coeff[index] -= sign; val *= sign; res_val -= ((val >> lpc.lpc_quant) * (lpc.lpc_order - index)); index--; } } samples++; } } }
{ "code": [ " residual[i] = samples[lpc.lpc_order+1] - sum;" ], "line_no": [ 73 ] }
static void FUNC_0(AlacEncodeContext *VAR_0, int VAR_1) { int VAR_2; LPCContext lpc = VAR_0->lpc[VAR_1]; if(lpc.lpc_order == 31) { VAR_0->predictor_buf[0] = VAR_0->sample_buf[VAR_1][0]; for(VAR_2=1; VAR_2<VAR_0->avctx->frame_size; VAR_2++) VAR_0->predictor_buf[VAR_2] = VAR_0->sample_buf[VAR_1][VAR_2] - VAR_0->sample_buf[VAR_1][VAR_2-1]; return; } if(lpc.lpc_order > 0) { int32_t *samples = VAR_0->sample_buf[VAR_1]; int32_t *residual = VAR_0->predictor_buf; residual[0] = samples[0]; for(VAR_2=1;VAR_2<=lpc.lpc_order;VAR_2++) residual[VAR_2] = samples[VAR_2] - samples[VAR_2-1]; for(VAR_2 = lpc.lpc_order + 1; VAR_2 < VAR_0->avctx->frame_size; VAR_2++) { int sum = 1 << (lpc.lpc_quant - 1), res_val, j; for (j = 0; j < lpc.lpc_order; j++) { sum += (samples[lpc.lpc_order-j] - samples[0]) * lpc.lpc_coeff[j]; } sum >>= lpc.lpc_quant; sum += samples[0]; residual[VAR_2] = samples[lpc.lpc_order+1] - sum; res_val = residual[VAR_2]; if(res_val) { int index = lpc.lpc_order - 1; int neg = (res_val < 0); while(index >= 0 && (neg ? (res_val < 0):(res_val > 0))) { int val = samples[0] - samples[lpc.lpc_order - index]; int sign = (val ? FFSIGN(val) : 0); if(neg) sign*=-1; lpc.lpc_coeff[index] -= sign; val *= sign; res_val -= ((val >> lpc.lpc_quant) * (lpc.lpc_order - index)); index--; } } samples++; } } }
[ "static void FUNC_0(AlacEncodeContext *VAR_0, int VAR_1)\n{", "int VAR_2;", "LPCContext lpc = VAR_0->lpc[VAR_1];", "if(lpc.lpc_order == 31) {", "VAR_0->predictor_buf[0] = VAR_0->sample_buf[VAR_1][0];", "for(VAR_2=1; VAR_2<VAR_0->avctx->frame_size; VAR_2++)", "VAR_0->predictor_buf[VAR_2] = VAR_0->sample_buf[VAR_1][VAR_2] - VAR_0->sample_buf[VAR_1][VAR_2-1];", "return;", "}", "if(lpc.lpc_order > 0) {", "int32_t *samples = VAR_0->sample_buf[VAR_1];", "int32_t *residual = VAR_0->predictor_buf;", "residual[0] = samples[0];", "for(VAR_2=1;VAR_2<=lpc.lpc_order;VAR_2++)", "residual[VAR_2] = samples[VAR_2] - samples[VAR_2-1];", "for(VAR_2 = lpc.lpc_order + 1; VAR_2 < VAR_0->avctx->frame_size; VAR_2++) {", "int sum = 1 << (lpc.lpc_quant - 1), res_val, j;", "for (j = 0; j < lpc.lpc_order; j++) {", "sum += (samples[lpc.lpc_order-j] - samples[0]) *\nlpc.lpc_coeff[j];", "}", "sum >>= lpc.lpc_quant;", "sum += samples[0];", "residual[VAR_2] = samples[lpc.lpc_order+1] - sum;", "res_val = residual[VAR_2];", "if(res_val) {", "int index = lpc.lpc_order - 1;", "int neg = (res_val < 0);", "while(index >= 0 && (neg ? (res_val < 0):(res_val > 0))) {", "int val = samples[0] - samples[lpc.lpc_order - index];", "int sign = (val ? FFSIGN(val) : 0);", "if(neg)\nsign*=-1;", "lpc.lpc_coeff[index] -= sign;", "val *= sign;", "res_val -= ((val >> lpc.lpc_quant) *\n(lpc.lpc_order - index));", "index--;", "}", "}", "samples++;", "}", "}", "}" ]
[ 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 33 ], [ 35 ], [ 37 ], [ 43 ], [ 45 ], [ 47 ], [ 53 ], [ 55 ], [ 59 ], [ 61, 63 ], [ 65 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ], [ 83 ], [ 87 ], [ 89 ], [ 91 ], [ 95, 97 ], [ 101 ], [ 103 ], [ 105, 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ] ]
14,995
static void decode_opc_special3(CPUMIPSState *env, DisasContext *ctx) { int rs, rt, rd, sa; uint32_t op1, op2; rs = (ctx->opcode >> 21) & 0x1f; rt = (ctx->opcode >> 16) & 0x1f; rd = (ctx->opcode >> 11) & 0x1f; sa = (ctx->opcode >> 6) & 0x1f; op1 = MASK_SPECIAL3(ctx->opcode); case OPC_EXT: case OPC_INS: check_insn(ctx, ISA_MIPS32R2); gen_bitops(ctx, op1, rt, rs, sa, rd); break; case OPC_BSHFL: op2 = MASK_BSHFL(ctx->opcode); switch (op2) { case OPC_ALIGN ... OPC_ALIGN_END: case OPC_BITSWAP: check_insn(ctx, ISA_MIPS32R6); decode_opc_special3_r6(env, ctx); break; default: check_insn(ctx, ISA_MIPS32R2); gen_bshfl(ctx, op2, rt, rd); break; break; #if defined(TARGET_MIPS64) case OPC_DEXTM ... OPC_DEXT: case OPC_DINSM ... OPC_DINS: check_insn(ctx, ISA_MIPS64R2); check_mips_64(ctx); gen_bitops(ctx, op1, rt, rs, sa, rd); break; case OPC_DBSHFL: op2 = MASK_DBSHFL(ctx->opcode); switch (op2) { case OPC_DALIGN ... OPC_DALIGN_END: case OPC_DBITSWAP: check_insn(ctx, ISA_MIPS32R6); decode_opc_special3_r6(env, ctx); break; default: check_insn(ctx, ISA_MIPS64R2); check_mips_64(ctx); op2 = MASK_DBSHFL(ctx->opcode); gen_bshfl(ctx, op2, rt, rd); break; break; #endif case OPC_RDHWR: gen_rdhwr(ctx, rt, rd, extract32(ctx->opcode, 6, 3)); break; case OPC_FORK: check_insn(ctx, ASE_MT); { TCGv t0 = tcg_temp_new(); TCGv t1 = tcg_temp_new(); gen_load_gpr(t0, rt); gen_load_gpr(t1, rs); gen_helper_fork(t0, t1); tcg_temp_free(t0); tcg_temp_free(t1); break; case OPC_YIELD: check_insn(ctx, ASE_MT); { TCGv t0 = tcg_temp_new(); gen_load_gpr(t0, rs); gen_helper_yield(t0, cpu_env, t0); gen_store_gpr(t0, rd); tcg_temp_free(t0); break; default: if (ctx->insn_flags & ISA_MIPS32R6) { decode_opc_special3_r6(env, ctx); } else { decode_opc_special3_legacy(env, ctx);
true
qemu
7696414729b2d0f870c80ad1dd637d854bc78847
static void decode_opc_special3(CPUMIPSState *env, DisasContext *ctx) { int rs, rt, rd, sa; uint32_t op1, op2; rs = (ctx->opcode >> 21) & 0x1f; rt = (ctx->opcode >> 16) & 0x1f; rd = (ctx->opcode >> 11) & 0x1f; sa = (ctx->opcode >> 6) & 0x1f; op1 = MASK_SPECIAL3(ctx->opcode); case OPC_EXT: case OPC_INS: check_insn(ctx, ISA_MIPS32R2); gen_bitops(ctx, op1, rt, rs, sa, rd); break; case OPC_BSHFL: op2 = MASK_BSHFL(ctx->opcode); switch (op2) { case OPC_ALIGN ... OPC_ALIGN_END: case OPC_BITSWAP: check_insn(ctx, ISA_MIPS32R6); decode_opc_special3_r6(env, ctx); break; default: check_insn(ctx, ISA_MIPS32R2); gen_bshfl(ctx, op2, rt, rd); break; break; #if defined(TARGET_MIPS64) case OPC_DEXTM ... OPC_DEXT: case OPC_DINSM ... OPC_DINS: check_insn(ctx, ISA_MIPS64R2); check_mips_64(ctx); gen_bitops(ctx, op1, rt, rs, sa, rd); break; case OPC_DBSHFL: op2 = MASK_DBSHFL(ctx->opcode); switch (op2) { case OPC_DALIGN ... OPC_DALIGN_END: case OPC_DBITSWAP: check_insn(ctx, ISA_MIPS32R6); decode_opc_special3_r6(env, ctx); break; default: check_insn(ctx, ISA_MIPS64R2); check_mips_64(ctx); op2 = MASK_DBSHFL(ctx->opcode); gen_bshfl(ctx, op2, rt, rd); break; break; #endif case OPC_RDHWR: gen_rdhwr(ctx, rt, rd, extract32(ctx->opcode, 6, 3)); break; case OPC_FORK: check_insn(ctx, ASE_MT); { TCGv t0 = tcg_temp_new(); TCGv t1 = tcg_temp_new(); gen_load_gpr(t0, rt); gen_load_gpr(t1, rs); gen_helper_fork(t0, t1); tcg_temp_free(t0); tcg_temp_free(t1); break; case OPC_YIELD: check_insn(ctx, ASE_MT); { TCGv t0 = tcg_temp_new(); gen_load_gpr(t0, rs); gen_helper_yield(t0, cpu_env, t0); gen_store_gpr(t0, rd); tcg_temp_free(t0); break; default: if (ctx->insn_flags & ISA_MIPS32R6) { decode_opc_special3_r6(env, ctx); } else { decode_opc_special3_legacy(env, ctx);
{ "code": [], "line_no": [] }
static void FUNC_0(CPUMIPSState *VAR_0, DisasContext *VAR_1) { int VAR_2, VAR_3, VAR_4, VAR_5; uint32_t op1, op2; VAR_2 = (VAR_1->opcode >> 21) & 0x1f; VAR_3 = (VAR_1->opcode >> 16) & 0x1f; VAR_4 = (VAR_1->opcode >> 11) & 0x1f; VAR_5 = (VAR_1->opcode >> 6) & 0x1f; op1 = MASK_SPECIAL3(VAR_1->opcode); case OPC_EXT: case OPC_INS: check_insn(VAR_1, ISA_MIPS32R2); gen_bitops(VAR_1, op1, VAR_3, VAR_2, VAR_5, VAR_4); break; case OPC_BSHFL: op2 = MASK_BSHFL(VAR_1->opcode); switch (op2) { case OPC_ALIGN ... OPC_ALIGN_END: case OPC_BITSWAP: check_insn(VAR_1, ISA_MIPS32R6); decode_opc_special3_r6(VAR_0, VAR_1); break; default: check_insn(VAR_1, ISA_MIPS32R2); gen_bshfl(VAR_1, op2, VAR_3, VAR_4); break; break; #if defined(TARGET_MIPS64) case OPC_DEXTM ... OPC_DEXT: case OPC_DINSM ... OPC_DINS: check_insn(VAR_1, ISA_MIPS64R2); check_mips_64(VAR_1); gen_bitops(VAR_1, op1, VAR_3, VAR_2, VAR_5, VAR_4); break; case OPC_DBSHFL: op2 = MASK_DBSHFL(VAR_1->opcode); switch (op2) { case OPC_DALIGN ... OPC_DALIGN_END: case OPC_DBITSWAP: check_insn(VAR_1, ISA_MIPS32R6); decode_opc_special3_r6(VAR_0, VAR_1); break; default: check_insn(VAR_1, ISA_MIPS64R2); check_mips_64(VAR_1); op2 = MASK_DBSHFL(VAR_1->opcode); gen_bshfl(VAR_1, op2, VAR_3, VAR_4); break; break; #endif case OPC_RDHWR: gen_rdhwr(VAR_1, VAR_3, VAR_4, extract32(VAR_1->opcode, 6, 3)); break; case OPC_FORK: check_insn(VAR_1, ASE_MT); { TCGv t0 = tcg_temp_new(); TCGv t1 = tcg_temp_new(); gen_load_gpr(t0, VAR_3); gen_load_gpr(t1, VAR_2); gen_helper_fork(t0, t1); tcg_temp_free(t0); tcg_temp_free(t1); break; case OPC_YIELD: check_insn(VAR_1, ASE_MT); { TCGv t0 = tcg_temp_new(); gen_load_gpr(t0, VAR_2); gen_helper_yield(t0, cpu_env, t0); gen_store_gpr(t0, VAR_4); tcg_temp_free(t0); break; default: if (VAR_1->insn_flags & ISA_MIPS32R6) { decode_opc_special3_r6(VAR_0, VAR_1); } else { decode_opc_special3_legacy(VAR_0, VAR_1);
[ "static void FUNC_0(CPUMIPSState *VAR_0, DisasContext *VAR_1)\n{", "int VAR_2, VAR_3, VAR_4, VAR_5;", "uint32_t op1, op2;", "VAR_2 = (VAR_1->opcode >> 21) & 0x1f;", "VAR_3 = (VAR_1->opcode >> 16) & 0x1f;", "VAR_4 = (VAR_1->opcode >> 11) & 0x1f;", "VAR_5 = (VAR_1->opcode >> 6) & 0x1f;", "op1 = MASK_SPECIAL3(VAR_1->opcode);", "case OPC_EXT:\ncase OPC_INS:\ncheck_insn(VAR_1, ISA_MIPS32R2);", "gen_bitops(VAR_1, op1, VAR_3, VAR_2, VAR_5, VAR_4);", "break;", "case OPC_BSHFL:\nop2 = MASK_BSHFL(VAR_1->opcode);", "switch (op2) {", "case OPC_ALIGN ... OPC_ALIGN_END:\ncase OPC_BITSWAP:\ncheck_insn(VAR_1, ISA_MIPS32R6);", "decode_opc_special3_r6(VAR_0, VAR_1);", "break;", "default:\ncheck_insn(VAR_1, ISA_MIPS32R2);", "gen_bshfl(VAR_1, op2, VAR_3, VAR_4);", "break;", "break;", "#if defined(TARGET_MIPS64)\ncase OPC_DEXTM ... OPC_DEXT:\ncase OPC_DINSM ... OPC_DINS:\ncheck_insn(VAR_1, ISA_MIPS64R2);", "check_mips_64(VAR_1);", "gen_bitops(VAR_1, op1, VAR_3, VAR_2, VAR_5, VAR_4);", "break;", "case OPC_DBSHFL:\nop2 = MASK_DBSHFL(VAR_1->opcode);", "switch (op2) {", "case OPC_DALIGN ... OPC_DALIGN_END:\ncase OPC_DBITSWAP:\ncheck_insn(VAR_1, ISA_MIPS32R6);", "decode_opc_special3_r6(VAR_0, VAR_1);", "break;", "default:\ncheck_insn(VAR_1, ISA_MIPS64R2);", "check_mips_64(VAR_1);", "op2 = MASK_DBSHFL(VAR_1->opcode);", "gen_bshfl(VAR_1, op2, VAR_3, VAR_4);", "break;", "break;", "#endif\ncase OPC_RDHWR:\ngen_rdhwr(VAR_1, VAR_3, VAR_4, extract32(VAR_1->opcode, 6, 3));", "break;", "case OPC_FORK:\ncheck_insn(VAR_1, ASE_MT);", "{", "TCGv t0 = tcg_temp_new();", "TCGv t1 = tcg_temp_new();", "gen_load_gpr(t0, VAR_3);", "gen_load_gpr(t1, VAR_2);", "gen_helper_fork(t0, t1);", "tcg_temp_free(t0);", "tcg_temp_free(t1);", "break;", "case OPC_YIELD:\ncheck_insn(VAR_1, ASE_MT);", "{", "TCGv t0 = tcg_temp_new();", "gen_load_gpr(t0, VAR_2);", "gen_helper_yield(t0, cpu_env, t0);", "gen_store_gpr(t0, VAR_4);", "tcg_temp_free(t0);", "break;", "default:\nif (VAR_1->insn_flags & ISA_MIPS32R6) {", "decode_opc_special3_r6(VAR_0, VAR_1);", "} else {", "decode_opc_special3_legacy(VAR_0, VAR_1);" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2 ], [ 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ], [ 8 ], [ 9 ], [ 10, 11, 12 ], [ 13 ], [ 14 ], [ 15, 16 ], [ 17 ], [ 18, 19, 20 ], [ 21 ], [ 22 ], [ 23, 24 ], [ 25 ], [ 26 ], [ 27 ], [ 28, 29, 30, 31 ], [ 32 ], [ 33 ], [ 34 ], [ 35, 36 ], [ 37 ], [ 38, 39, 40 ], [ 41 ], [ 42 ], [ 43, 44 ], [ 45 ], [ 46 ], [ 47 ], [ 48 ], [ 49 ], [ 50, 51, 52 ], [ 53 ], [ 54, 55 ], [ 56 ], [ 57 ], [ 58 ], [ 59 ], [ 60 ], [ 61 ], [ 62 ], [ 63 ], [ 64 ], [ 65, 66 ], [ 67 ], [ 68 ], [ 69 ], [ 70 ], [ 71 ], [ 72 ], [ 73 ], [ 74, 75 ], [ 76 ], [ 77 ], [ 78 ] ]
14,996
static int parse_psfile(AVFilterContext *ctx, const char *fname) { CurvesContext *curves = ctx->priv; uint8_t *buf; size_t size; int i, ret, av_unused(version), nb_curves; AVBPrint ptstr; static const int comp_ids[] = {3, 0, 1, 2}; av_bprint_init(&ptstr, 0, AV_BPRINT_SIZE_AUTOMATIC); ret = av_file_map(fname, &buf, &size, 0, NULL); if (ret < 0) return ret; #define READ16(dst) do { \ if (size < 2) \ return AVERROR_INVALIDDATA; \ dst = AV_RB16(buf); \ buf += 2; \ size -= 2; \ } while (0) READ16(version); READ16(nb_curves); for (i = 0; i < FFMIN(nb_curves, FF_ARRAY_ELEMS(comp_ids)); i++) { int nb_points, n; av_bprint_clear(&ptstr); READ16(nb_points); for (n = 0; n < nb_points; n++) { int y, x; READ16(y); READ16(x); av_bprintf(&ptstr, "%f/%f ", x / 255., y / 255.); } if (*ptstr.str) { char **pts = &curves->comp_points_str[comp_ids[i]]; if (!*pts) { *pts = av_strdup(ptstr.str); av_log(ctx, AV_LOG_DEBUG, "curves %d (intid=%d) [%d points]: [%s]\n", i, comp_ids[i], nb_points, *pts); if (!*pts) { ret = AVERROR(ENOMEM); goto end; } } } } end: av_bprint_finalize(&ptstr, NULL); av_file_unmap(buf, size); return ret; }
true
FFmpeg
b2cfd1fde7a2643be9978ec8da58c184a5d9a140
static int parse_psfile(AVFilterContext *ctx, const char *fname) { CurvesContext *curves = ctx->priv; uint8_t *buf; size_t size; int i, ret, av_unused(version), nb_curves; AVBPrint ptstr; static const int comp_ids[] = {3, 0, 1, 2}; av_bprint_init(&ptstr, 0, AV_BPRINT_SIZE_AUTOMATIC); ret = av_file_map(fname, &buf, &size, 0, NULL); if (ret < 0) return ret; #define READ16(dst) do { \ if (size < 2) \ return AVERROR_INVALIDDATA; \ dst = AV_RB16(buf); \ buf += 2; \ size -= 2; \ } while (0) READ16(version); READ16(nb_curves); for (i = 0; i < FFMIN(nb_curves, FF_ARRAY_ELEMS(comp_ids)); i++) { int nb_points, n; av_bprint_clear(&ptstr); READ16(nb_points); for (n = 0; n < nb_points; n++) { int y, x; READ16(y); READ16(x); av_bprintf(&ptstr, "%f/%f ", x / 255., y / 255.); } if (*ptstr.str) { char **pts = &curves->comp_points_str[comp_ids[i]]; if (!*pts) { *pts = av_strdup(ptstr.str); av_log(ctx, AV_LOG_DEBUG, "curves %d (intid=%d) [%d points]: [%s]\n", i, comp_ids[i], nb_points, *pts); if (!*pts) { ret = AVERROR(ENOMEM); goto end; } } } } end: av_bprint_finalize(&ptstr, NULL); av_file_unmap(buf, size); return ret; }
{ "code": [ " if (size < 2) \\", " return AVERROR_INVALIDDATA; \\" ], "line_no": [ 33, 35 ] }
static int FUNC_0(AVFilterContext *VAR_0, const char *VAR_1) { CurvesContext *curves = VAR_0->priv; uint8_t *buf; size_t size; int VAR_2, VAR_3, FUNC_1(version), nb_curves; AVBPrint ptstr; static const int VAR_4[] = {3, 0, 1, 2}; av_bprint_init(&ptstr, 0, AV_BPRINT_SIZE_AUTOMATIC); VAR_3 = av_file_map(VAR_1, &buf, &size, 0, NULL); if (VAR_3 < 0) return VAR_3; #define READ16(dst) do { \ if (size < 2) \ return AVERROR_INVALIDDATA; \ dst = AV_RB16(buf); \ buf += 2; \ size -= 2; \ } while (0) READ16(version); READ16(nb_curves); for (VAR_2 = 0; VAR_2 < FFMIN(nb_curves, FF_ARRAY_ELEMS(VAR_4)); VAR_2++) { int nb_points, n; av_bprint_clear(&ptstr); READ16(nb_points); for (n = 0; n < nb_points; n++) { int y, x; READ16(y); READ16(x); av_bprintf(&ptstr, "%f/%f ", x / 255., y / 255.); } if (*ptstr.str) { char **pts = &curves->comp_points_str[VAR_4[VAR_2]]; if (!*pts) { *pts = av_strdup(ptstr.str); av_log(VAR_0, AV_LOG_DEBUG, "curves %d (intid=%d) [%d points]: [%s]\n", VAR_2, VAR_4[VAR_2], nb_points, *pts); if (!*pts) { VAR_3 = AVERROR(ENOMEM); goto end; } } } } end: av_bprint_finalize(&ptstr, NULL); av_file_unmap(buf, size); return VAR_3; }
[ "static int FUNC_0(AVFilterContext *VAR_0, const char *VAR_1)\n{", "CurvesContext *curves = VAR_0->priv;", "uint8_t *buf;", "size_t size;", "int VAR_2, VAR_3, FUNC_1(version), nb_curves;", "AVBPrint ptstr;", "static const int VAR_4[] = {3, 0, 1, 2};", "av_bprint_init(&ptstr, 0, AV_BPRINT_SIZE_AUTOMATIC);", "VAR_3 = av_file_map(VAR_1, &buf, &size, 0, NULL);", "if (VAR_3 < 0)\nreturn VAR_3;", "#define READ16(dst) do { \\", "if (size < 2) \\\nreturn AVERROR_INVALIDDATA; \\", "dst = AV_RB16(buf); \\", "buf += 2; \\", "size -= 2; \\", "} while (0)", "READ16(version);", "READ16(nb_curves);", "for (VAR_2 = 0; VAR_2 < FFMIN(nb_curves, FF_ARRAY_ELEMS(VAR_4)); VAR_2++) {", "int nb_points, n;", "av_bprint_clear(&ptstr);", "READ16(nb_points);", "for (n = 0; n < nb_points; n++) {", "int y, x;", "READ16(y);", "READ16(x);", "av_bprintf(&ptstr, \"%f/%f \", x / 255., y / 255.);", "}", "if (*ptstr.str) {", "char **pts = &curves->comp_points_str[VAR_4[VAR_2]];", "if (!*pts) {", "*pts = av_strdup(ptstr.str);", "av_log(VAR_0, AV_LOG_DEBUG, \"curves %d (intid=%d) [%d points]: [%s]\\n\",\nVAR_2, VAR_4[VAR_2], nb_points, *pts);", "if (!*pts) {", "VAR_3 = AVERROR(ENOMEM);", "goto end;", "}", "}", "}", "}", "end:\nav_bprint_finalize(&ptstr, NULL);", "av_file_unmap(buf, size);", "return VAR_3;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 23 ], [ 25, 27 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79, 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97, 99 ], [ 101 ], [ 103 ], [ 105 ] ]
14,997
static int svq3_decode_slice_header(AVCodecContext *avctx) { SVQ3Context *svq3 = avctx->priv_data; H264Context *h = &svq3->h; MpegEncContext *s = &h->s; const int mb_xy = h->mb_xy; int i, header; header = get_bits(&s->gb, 8); if (((header & 0x9F) != 1 && (header & 0x9F) != 2) || (header & 0x60) == 0) { /* TODO: what? */ av_log(avctx, AV_LOG_ERROR, "unsupported slice header (%02X)\n", header); return -1; } else { int length = header >> 5 & 3; svq3->next_slice_index = get_bits_count(&s->gb) + 8 * show_bits(&s->gb, 8 * length) + 8 * length; if (svq3->next_slice_index > s->gb.size_in_bits) { av_log(avctx, AV_LOG_ERROR, "slice after bitstream end\n"); return -1; } s->gb.size_in_bits = svq3->next_slice_index - 8 * (length - 1); skip_bits(&s->gb, 8); if (svq3->watermark_key) { uint32_t header = AV_RL32(&s->gb.buffer[(get_bits_count(&s->gb) >> 3) + 1]); AV_WL32(&s->gb.buffer[(get_bits_count(&s->gb) >> 3) + 1], header ^ svq3->watermark_key); } if (length > 0) { memcpy((uint8_t *) &s->gb.buffer[get_bits_count(&s->gb) >> 3], &s->gb.buffer[s->gb.size_in_bits >> 3], length - 1); } skip_bits_long(&s->gb, 0); } if ((i = svq3_get_ue_golomb(&s->gb)) == INVALID_VLC || i >= 3) { av_log(h->s.avctx, AV_LOG_ERROR, "illegal slice type %d \n", i); return -1; } h->slice_type = golomb_to_pict_type[i]; if ((header & 0x9F) == 2) { i = (s->mb_num < 64) ? 6 : (1 + av_log2(s->mb_num - 1)); s->mb_skip_run = get_bits(&s->gb, i) - (s->mb_y * s->mb_width + s->mb_x); } else { skip_bits1(&s->gb); s->mb_skip_run = 0; } h->slice_num = get_bits(&s->gb, 8); s->qscale = get_bits(&s->gb, 5); s->adaptive_quant = get_bits1(&s->gb); /* unknown fields */ skip_bits1(&s->gb); if (svq3->unknown_flag) skip_bits1(&s->gb); skip_bits1(&s->gb); skip_bits(&s->gb, 2); while (get_bits1(&s->gb)) skip_bits(&s->gb, 8); /* reset intra predictors and invalidate motion vector references */ if (s->mb_x > 0) { memset(h->intra4x4_pred_mode + h->mb2br_xy[mb_xy - 1] + 3, -1, 4 * sizeof(int8_t)); memset(h->intra4x4_pred_mode + h->mb2br_xy[mb_xy - s->mb_x], -1, 8 * sizeof(int8_t) * s->mb_x); } if (s->mb_y > 0) { memset(h->intra4x4_pred_mode + h->mb2br_xy[mb_xy - s->mb_stride], -1, 8 * sizeof(int8_t) * (s->mb_width - s->mb_x)); if (s->mb_x > 0) h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - s->mb_stride - 1] + 3] = -1; } return 0; }
true
FFmpeg
9a2e79116d6235c53d8e9663a8d30d1950d7431a
static int svq3_decode_slice_header(AVCodecContext *avctx) { SVQ3Context *svq3 = avctx->priv_data; H264Context *h = &svq3->h; MpegEncContext *s = &h->s; const int mb_xy = h->mb_xy; int i, header; header = get_bits(&s->gb, 8); if (((header & 0x9F) != 1 && (header & 0x9F) != 2) || (header & 0x60) == 0) { av_log(avctx, AV_LOG_ERROR, "unsupported slice header (%02X)\n", header); return -1; } else { int length = header >> 5 & 3; svq3->next_slice_index = get_bits_count(&s->gb) + 8 * show_bits(&s->gb, 8 * length) + 8 * length; if (svq3->next_slice_index > s->gb.size_in_bits) { av_log(avctx, AV_LOG_ERROR, "slice after bitstream end\n"); return -1; } s->gb.size_in_bits = svq3->next_slice_index - 8 * (length - 1); skip_bits(&s->gb, 8); if (svq3->watermark_key) { uint32_t header = AV_RL32(&s->gb.buffer[(get_bits_count(&s->gb) >> 3) + 1]); AV_WL32(&s->gb.buffer[(get_bits_count(&s->gb) >> 3) + 1], header ^ svq3->watermark_key); } if (length > 0) { memcpy((uint8_t *) &s->gb.buffer[get_bits_count(&s->gb) >> 3], &s->gb.buffer[s->gb.size_in_bits >> 3], length - 1); } skip_bits_long(&s->gb, 0); } if ((i = svq3_get_ue_golomb(&s->gb)) == INVALID_VLC || i >= 3) { av_log(h->s.avctx, AV_LOG_ERROR, "illegal slice type %d \n", i); return -1; } h->slice_type = golomb_to_pict_type[i]; if ((header & 0x9F) == 2) { i = (s->mb_num < 64) ? 6 : (1 + av_log2(s->mb_num - 1)); s->mb_skip_run = get_bits(&s->gb, i) - (s->mb_y * s->mb_width + s->mb_x); } else { skip_bits1(&s->gb); s->mb_skip_run = 0; } h->slice_num = get_bits(&s->gb, 8); s->qscale = get_bits(&s->gb, 5); s->adaptive_quant = get_bits1(&s->gb); skip_bits1(&s->gb); if (svq3->unknown_flag) skip_bits1(&s->gb); skip_bits1(&s->gb); skip_bits(&s->gb, 2); while (get_bits1(&s->gb)) skip_bits(&s->gb, 8); if (s->mb_x > 0) { memset(h->intra4x4_pred_mode + h->mb2br_xy[mb_xy - 1] + 3, -1, 4 * sizeof(int8_t)); memset(h->intra4x4_pred_mode + h->mb2br_xy[mb_xy - s->mb_x], -1, 8 * sizeof(int8_t) * s->mb_x); } if (s->mb_y > 0) { memset(h->intra4x4_pred_mode + h->mb2br_xy[mb_xy - s->mb_stride], -1, 8 * sizeof(int8_t) * (s->mb_width - s->mb_x)); if (s->mb_x > 0) h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - s->mb_stride - 1] + 3] = -1; } return 0; }
{ "code": [ " if ((i = svq3_get_ue_golomb(&s->gb)) == INVALID_VLC || i >= 3) {" ], "line_no": [ 83 ] }
static int FUNC_0(AVCodecContext *VAR_0) { SVQ3Context *svq3 = VAR_0->priv_data; H264Context *h = &svq3->h; MpegEncContext *s = &h->s; const int VAR_1 = h->VAR_1; int VAR_2, VAR_3; VAR_3 = get_bits(&s->gb, 8); if (((VAR_3 & 0x9F) != 1 && (VAR_3 & 0x9F) != 2) || (VAR_3 & 0x60) == 0) { av_log(VAR_0, AV_LOG_ERROR, "unsupported slice VAR_3 (%02X)\n", VAR_3); return -1; } else { int VAR_4 = VAR_3 >> 5 & 3; svq3->next_slice_index = get_bits_count(&s->gb) + 8 * show_bits(&s->gb, 8 * VAR_4) + 8 * VAR_4; if (svq3->next_slice_index > s->gb.size_in_bits) { av_log(VAR_0, AV_LOG_ERROR, "slice after bitstream end\n"); return -1; } s->gb.size_in_bits = svq3->next_slice_index - 8 * (VAR_4 - 1); skip_bits(&s->gb, 8); if (svq3->watermark_key) { uint32_t VAR_3 = AV_RL32(&s->gb.buffer[(get_bits_count(&s->gb) >> 3) + 1]); AV_WL32(&s->gb.buffer[(get_bits_count(&s->gb) >> 3) + 1], VAR_3 ^ svq3->watermark_key); } if (VAR_4 > 0) { memcpy((uint8_t *) &s->gb.buffer[get_bits_count(&s->gb) >> 3], &s->gb.buffer[s->gb.size_in_bits >> 3], VAR_4 - 1); } skip_bits_long(&s->gb, 0); } if ((VAR_2 = svq3_get_ue_golomb(&s->gb)) == INVALID_VLC || VAR_2 >= 3) { av_log(h->s.VAR_0, AV_LOG_ERROR, "illegal slice type %d \n", VAR_2); return -1; } h->slice_type = golomb_to_pict_type[VAR_2]; if ((VAR_3 & 0x9F) == 2) { VAR_2 = (s->mb_num < 64) ? 6 : (1 + av_log2(s->mb_num - 1)); s->mb_skip_run = get_bits(&s->gb, VAR_2) - (s->mb_y * s->mb_width + s->mb_x); } else { skip_bits1(&s->gb); s->mb_skip_run = 0; } h->slice_num = get_bits(&s->gb, 8); s->qscale = get_bits(&s->gb, 5); s->adaptive_quant = get_bits1(&s->gb); skip_bits1(&s->gb); if (svq3->unknown_flag) skip_bits1(&s->gb); skip_bits1(&s->gb); skip_bits(&s->gb, 2); while (get_bits1(&s->gb)) skip_bits(&s->gb, 8); if (s->mb_x > 0) { memset(h->intra4x4_pred_mode + h->mb2br_xy[VAR_1 - 1] + 3, -1, 4 * sizeof(int8_t)); memset(h->intra4x4_pred_mode + h->mb2br_xy[VAR_1 - s->mb_x], -1, 8 * sizeof(int8_t) * s->mb_x); } if (s->mb_y > 0) { memset(h->intra4x4_pred_mode + h->mb2br_xy[VAR_1 - s->mb_stride], -1, 8 * sizeof(int8_t) * (s->mb_width - s->mb_x)); if (s->mb_x > 0) h->intra4x4_pred_mode[h->mb2br_xy[VAR_1 - s->mb_stride - 1] + 3] = -1; } return 0; }
[ "static int FUNC_0(AVCodecContext *VAR_0)\n{", "SVQ3Context *svq3 = VAR_0->priv_data;", "H264Context *h = &svq3->h;", "MpegEncContext *s = &h->s;", "const int VAR_1 = h->VAR_1;", "int VAR_2, VAR_3;", "VAR_3 = get_bits(&s->gb, 8);", "if (((VAR_3 & 0x9F) != 1 && (VAR_3 & 0x9F) != 2) || (VAR_3 & 0x60) == 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"unsupported slice VAR_3 (%02X)\\n\", VAR_3);", "return -1;", "} else {", "int VAR_4 = VAR_3 >> 5 & 3;", "svq3->next_slice_index = get_bits_count(&s->gb) +\n8 * show_bits(&s->gb, 8 * VAR_4) +\n8 * VAR_4;", "if (svq3->next_slice_index > s->gb.size_in_bits) {", "av_log(VAR_0, AV_LOG_ERROR, \"slice after bitstream end\\n\");", "return -1;", "}", "s->gb.size_in_bits = svq3->next_slice_index - 8 * (VAR_4 - 1);", "skip_bits(&s->gb, 8);", "if (svq3->watermark_key) {", "uint32_t VAR_3 = AV_RL32(&s->gb.buffer[(get_bits_count(&s->gb) >> 3) + 1]);", "AV_WL32(&s->gb.buffer[(get_bits_count(&s->gb) >> 3) + 1],\nVAR_3 ^ svq3->watermark_key);", "}", "if (VAR_4 > 0) {", "memcpy((uint8_t *) &s->gb.buffer[get_bits_count(&s->gb) >> 3],\n&s->gb.buffer[s->gb.size_in_bits >> 3], VAR_4 - 1);", "}", "skip_bits_long(&s->gb, 0);", "}", "if ((VAR_2 = svq3_get_ue_golomb(&s->gb)) == INVALID_VLC || VAR_2 >= 3) {", "av_log(h->s.VAR_0, AV_LOG_ERROR, \"illegal slice type %d \\n\", VAR_2);", "return -1;", "}", "h->slice_type = golomb_to_pict_type[VAR_2];", "if ((VAR_3 & 0x9F) == 2) {", "VAR_2 = (s->mb_num < 64) ? 6 : (1 + av_log2(s->mb_num - 1));", "s->mb_skip_run = get_bits(&s->gb, VAR_2) -\n(s->mb_y * s->mb_width + s->mb_x);", "} else {", "skip_bits1(&s->gb);", "s->mb_skip_run = 0;", "}", "h->slice_num = get_bits(&s->gb, 8);", "s->qscale = get_bits(&s->gb, 5);", "s->adaptive_quant = get_bits1(&s->gb);", "skip_bits1(&s->gb);", "if (svq3->unknown_flag)\nskip_bits1(&s->gb);", "skip_bits1(&s->gb);", "skip_bits(&s->gb, 2);", "while (get_bits1(&s->gb))\nskip_bits(&s->gb, 8);", "if (s->mb_x > 0) {", "memset(h->intra4x4_pred_mode + h->mb2br_xy[VAR_1 - 1] + 3,\n-1, 4 * sizeof(int8_t));", "memset(h->intra4x4_pred_mode + h->mb2br_xy[VAR_1 - s->mb_x],\n-1, 8 * sizeof(int8_t) * s->mb_x);", "}", "if (s->mb_y > 0) {", "memset(h->intra4x4_pred_mode + h->mb2br_xy[VAR_1 - s->mb_stride],\n-1, 8 * sizeof(int8_t) * (s->mb_width - s->mb_x));", "if (s->mb_x > 0)\nh->intra4x4_pred_mode[h->mb2br_xy[VAR_1 - s->mb_stride - 1] + 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, 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35, 37, 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63, 65 ], [ 67 ], [ 69 ], [ 71, 73 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 93 ], [ 97 ], [ 99 ], [ 101, 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 115 ], [ 117 ], [ 119 ], [ 125 ], [ 129, 131 ], [ 135 ], [ 137 ], [ 141, 143 ], [ 149 ], [ 151, 153 ], [ 155, 157 ], [ 159 ], [ 161 ], [ 163, 165 ], [ 169, 171 ], [ 173 ], [ 177 ], [ 179 ] ]
14,998
static int blk_send_response_one(struct ioreq *ioreq) { struct XenBlkDev *blkdev = ioreq->blkdev; int send_notify = 0; int have_requests = 0; blkif_response_t resp; void *dst; resp.id = ioreq->req.id; resp.operation = ioreq->req.operation; resp.status = ioreq->status; /* Place on the response ring for the relevant domain. */ switch (blkdev->protocol) { case BLKIF_PROTOCOL_NATIVE: dst = RING_GET_RESPONSE(&blkdev->rings.native, blkdev->rings.native.rsp_prod_pvt); break; case BLKIF_PROTOCOL_X86_32: dst = RING_GET_RESPONSE(&blkdev->rings.x86_32_part, blkdev->rings.x86_32_part.rsp_prod_pvt); break; case BLKIF_PROTOCOL_X86_64: dst = RING_GET_RESPONSE(&blkdev->rings.x86_64_part, blkdev->rings.x86_64_part.rsp_prod_pvt); break; default: dst = NULL; } memcpy(dst, &resp, sizeof(resp)); blkdev->rings.common.rsp_prod_pvt++; RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(&blkdev->rings.common, send_notify); if (blkdev->rings.common.rsp_prod_pvt == blkdev->rings.common.req_cons) { /* * Tail check for pending requests. Allows frontend to avoid * notifications if requests are already in flight (lower * overheads and promotes batching). */ RING_FINAL_CHECK_FOR_REQUESTS(&blkdev->rings.common, have_requests); } else if (RING_HAS_UNCONSUMED_REQUESTS(&blkdev->rings.common)) { have_requests = 1; } if (have_requests) { blkdev->more_work++; } return send_notify; }
true
qemu
8cced121436a3298e5866dbfaec91cd475ad59cf
static int blk_send_response_one(struct ioreq *ioreq) { struct XenBlkDev *blkdev = ioreq->blkdev; int send_notify = 0; int have_requests = 0; blkif_response_t resp; void *dst; resp.id = ioreq->req.id; resp.operation = ioreq->req.operation; resp.status = ioreq->status; switch (blkdev->protocol) { case BLKIF_PROTOCOL_NATIVE: dst = RING_GET_RESPONSE(&blkdev->rings.native, blkdev->rings.native.rsp_prod_pvt); break; case BLKIF_PROTOCOL_X86_32: dst = RING_GET_RESPONSE(&blkdev->rings.x86_32_part, blkdev->rings.x86_32_part.rsp_prod_pvt); break; case BLKIF_PROTOCOL_X86_64: dst = RING_GET_RESPONSE(&blkdev->rings.x86_64_part, blkdev->rings.x86_64_part.rsp_prod_pvt); break; default: dst = NULL; } memcpy(dst, &resp, sizeof(resp)); blkdev->rings.common.rsp_prod_pvt++; RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(&blkdev->rings.common, send_notify); if (blkdev->rings.common.rsp_prod_pvt == blkdev->rings.common.req_cons) { RING_FINAL_CHECK_FOR_REQUESTS(&blkdev->rings.common, have_requests); } else if (RING_HAS_UNCONSUMED_REQUESTS(&blkdev->rings.common)) { have_requests = 1; } if (have_requests) { blkdev->more_work++; } return send_notify; }
{ "code": [], "line_no": [] }
static int FUNC_0(struct VAR_0 *VAR_0) { struct XenBlkDev *VAR_1 = VAR_0->VAR_1; int VAR_2 = 0; int VAR_3 = 0; blkif_response_t resp; void *VAR_4; resp.id = VAR_0->req.id; resp.operation = VAR_0->req.operation; resp.status = VAR_0->status; switch (VAR_1->protocol) { case BLKIF_PROTOCOL_NATIVE: VAR_4 = RING_GET_RESPONSE(&VAR_1->rings.native, VAR_1->rings.native.rsp_prod_pvt); break; case BLKIF_PROTOCOL_X86_32: VAR_4 = RING_GET_RESPONSE(&VAR_1->rings.x86_32_part, VAR_1->rings.x86_32_part.rsp_prod_pvt); break; case BLKIF_PROTOCOL_X86_64: VAR_4 = RING_GET_RESPONSE(&VAR_1->rings.x86_64_part, VAR_1->rings.x86_64_part.rsp_prod_pvt); break; default: VAR_4 = NULL; } memcpy(VAR_4, &resp, sizeof(resp)); VAR_1->rings.common.rsp_prod_pvt++; RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(&VAR_1->rings.common, VAR_2); if (VAR_1->rings.common.rsp_prod_pvt == VAR_1->rings.common.req_cons) { RING_FINAL_CHECK_FOR_REQUESTS(&VAR_1->rings.common, VAR_3); } else if (RING_HAS_UNCONSUMED_REQUESTS(&VAR_1->rings.common)) { VAR_3 = 1; } if (VAR_3) { VAR_1->more_work++; } return VAR_2; }
[ "static int FUNC_0(struct VAR_0 *VAR_0)\n{", "struct XenBlkDev *VAR_1 = VAR_0->VAR_1;", "int VAR_2 = 0;", "int VAR_3 = 0;", "blkif_response_t resp;", "void *VAR_4;", "resp.id = VAR_0->req.id;", "resp.operation = VAR_0->req.operation;", "resp.status = VAR_0->status;", "switch (VAR_1->protocol) {", "case BLKIF_PROTOCOL_NATIVE:\nVAR_4 = RING_GET_RESPONSE(&VAR_1->rings.native, VAR_1->rings.native.rsp_prod_pvt);", "break;", "case BLKIF_PROTOCOL_X86_32:\nVAR_4 = RING_GET_RESPONSE(&VAR_1->rings.x86_32_part,\nVAR_1->rings.x86_32_part.rsp_prod_pvt);", "break;", "case BLKIF_PROTOCOL_X86_64:\nVAR_4 = RING_GET_RESPONSE(&VAR_1->rings.x86_64_part,\nVAR_1->rings.x86_64_part.rsp_prod_pvt);", "break;", "default:\nVAR_4 = NULL;", "}", "memcpy(VAR_4, &resp, sizeof(resp));", "VAR_1->rings.common.rsp_prod_pvt++;", "RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(&VAR_1->rings.common, VAR_2);", "if (VAR_1->rings.common.rsp_prod_pvt == VAR_1->rings.common.req_cons) {", "RING_FINAL_CHECK_FOR_REQUESTS(&VAR_1->rings.common, VAR_3);", "} else if (RING_HAS_UNCONSUMED_REQUESTS(&VAR_1->rings.common)) {", "VAR_3 = 1;", "}", "if (VAR_3) {", "VAR_1->more_work++;", "}", "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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 27 ], [ 29, 31 ], [ 33 ], [ 35, 37, 39 ], [ 41 ], [ 43, 45, 47 ], [ 49 ], [ 51, 53 ], [ 56 ], [ 58 ], [ 60 ], [ 64 ], [ 66 ], [ 78 ], [ 80 ], [ 82 ], [ 84 ], [ 88 ], [ 90 ], [ 92 ], [ 94 ], [ 96 ] ]
14,999
void s390_ipl_prepare_cpu(S390CPU *cpu) { S390IPLState *ipl = get_ipl_device(); cpu->env.psw.addr = ipl->start_addr; cpu->env.psw.mask = IPL_PSW_MASK; if (!ipl->kernel || ipl->iplb_valid) { cpu->env.psw.addr = ipl->bios_start_addr; if (!ipl->iplb_valid) { ipl->iplb_valid = s390_gen_initial_iplb(ipl); } } if (ipl->netboot) { if (load_netboot_image(&err) < 0) { error_report_err(err); vm_stop(RUN_STATE_INTERNAL_ERROR); } ipl->iplb.ccw.netboot_start_addr = ipl->start_addr; } }
true
qemu
f38b5b7fc4e27724afc72b91efa2bc82f84bb25e
void s390_ipl_prepare_cpu(S390CPU *cpu) { S390IPLState *ipl = get_ipl_device(); cpu->env.psw.addr = ipl->start_addr; cpu->env.psw.mask = IPL_PSW_MASK; if (!ipl->kernel || ipl->iplb_valid) { cpu->env.psw.addr = ipl->bios_start_addr; if (!ipl->iplb_valid) { ipl->iplb_valid = s390_gen_initial_iplb(ipl); } } if (ipl->netboot) { if (load_netboot_image(&err) < 0) { error_report_err(err); vm_stop(RUN_STATE_INTERNAL_ERROR); } ipl->iplb.ccw.netboot_start_addr = ipl->start_addr; } }
{ "code": [], "line_no": [] }
void FUNC_0(S390CPU *VAR_0) { S390IPLState *ipl = get_ipl_device(); VAR_0->env.psw.addr = ipl->start_addr; VAR_0->env.psw.mask = IPL_PSW_MASK; if (!ipl->kernel || ipl->iplb_valid) { VAR_0->env.psw.addr = ipl->bios_start_addr; if (!ipl->iplb_valid) { ipl->iplb_valid = s390_gen_initial_iplb(ipl); } } if (ipl->netboot) { if (load_netboot_image(&err) < 0) { error_report_err(err); vm_stop(RUN_STATE_INTERNAL_ERROR); } ipl->iplb.ccw.netboot_start_addr = ipl->start_addr; } }
[ "void FUNC_0(S390CPU *VAR_0)\n{", "S390IPLState *ipl = get_ipl_device();", "VAR_0->env.psw.addr = ipl->start_addr;", "VAR_0->env.psw.mask = IPL_PSW_MASK;", "if (!ipl->kernel || ipl->iplb_valid) {", "VAR_0->env.psw.addr = ipl->bios_start_addr;", "if (!ipl->iplb_valid) {", "ipl->iplb_valid = s390_gen_initial_iplb(ipl);", "}", "}", "if (ipl->netboot) {", "if (load_netboot_image(&err) < 0) {", "error_report_err(err);", "vm_stop(RUN_STATE_INTERNAL_ERROR);", "}", "ipl->iplb.ccw.netboot_start_addr = ipl->start_addr;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 10 ], [ 12 ], [ 16 ], [ 18 ], [ 20 ], [ 22 ], [ 24 ], [ 26 ], [ 28 ], [ 30 ], [ 32 ], [ 34 ], [ 36 ], [ 38 ], [ 40 ], [ 42 ] ]
15,003
static void rtas_ibm_os_term(PowerPCCPU *cpu, sPAPRMachineState *spapr, uint32_t token, uint32_t nargs, target_ulong args, uint32_t nret, target_ulong rets) { target_ulong ret = 0; qapi_event_send_guest_panicked(GUEST_PANIC_ACTION_PAUSE, &error_abort); rtas_st(rets, 0, ret); }
true
qemu
c86f106b857dd8922e29ec746a8dd47e8a15ebbd
static void rtas_ibm_os_term(PowerPCCPU *cpu, sPAPRMachineState *spapr, uint32_t token, uint32_t nargs, target_ulong args, uint32_t nret, target_ulong rets) { target_ulong ret = 0; qapi_event_send_guest_panicked(GUEST_PANIC_ACTION_PAUSE, &error_abort); rtas_st(rets, 0, ret); }
{ "code": [ " qapi_event_send_guest_panicked(GUEST_PANIC_ACTION_PAUSE, &error_abort);", " qapi_event_send_guest_panicked(GUEST_PANIC_ACTION_PAUSE, &error_abort);" ], "line_no": [ 17, 17 ] }
static void FUNC_0(PowerPCCPU *VAR_0, sPAPRMachineState *VAR_1, uint32_t VAR_2, uint32_t VAR_3, target_ulong VAR_4, uint32_t VAR_5, target_ulong VAR_6) { target_ulong ret = 0; qapi_event_send_guest_panicked(GUEST_PANIC_ACTION_PAUSE, &error_abort); rtas_st(VAR_6, 0, ret); }
[ "static void FUNC_0(PowerPCCPU *VAR_0,\nsPAPRMachineState *VAR_1,\nuint32_t VAR_2, uint32_t VAR_3,\ntarget_ulong VAR_4,\nuint32_t VAR_5, target_ulong VAR_6)\n{", "target_ulong ret = 0;", "qapi_event_send_guest_panicked(GUEST_PANIC_ACTION_PAUSE, &error_abort);", "rtas_st(VAR_6, 0, ret);", "}" ]
[ 0, 0, 1, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11 ], [ 13 ], [ 17 ], [ 21 ], [ 23 ] ]
15,004
int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt, const char *filename, void *logctx, unsigned int offset, unsigned int max_probe_size) { AVProbeData pd = { filename ? filename : "", NULL, -offset }; unsigned char *buf = NULL; int ret = 0, probe_size; if (!max_probe_size) { max_probe_size = PROBE_BUF_MAX; } else if (max_probe_size > PROBE_BUF_MAX) { max_probe_size = PROBE_BUF_MAX; } else if (max_probe_size < PROBE_BUF_MIN) { return AVERROR(EINVAL); } if (offset >= max_probe_size) { return AVERROR(EINVAL); } for(probe_size= PROBE_BUF_MIN; probe_size<=max_probe_size && !*fmt; probe_size = FFMIN(probe_size<<1, FFMAX(max_probe_size, probe_size+1))) { int score = probe_size < max_probe_size ? AVPROBE_SCORE_RETRY : 0; int buf_offset = (probe_size == PROBE_BUF_MIN) ? 0 : probe_size>>1; void *buftmp; if (probe_size < offset) { continue; } /* read probe data */ buftmp = av_realloc(buf, probe_size + AVPROBE_PADDING_SIZE); if(!buftmp){ av_free(buf); return AVERROR(ENOMEM); } buf=buftmp; if ((ret = avio_read(pb, buf + buf_offset, probe_size - buf_offset)) < 0) { /* fail if error was not end of file, otherwise, lower score */ if (ret != AVERROR_EOF) { av_free(buf); return ret; } score = 0; ret = 0; /* error was end of file, nothing read */ } pd.buf_size += ret; pd.buf = &buf[offset]; memset(pd.buf + pd.buf_size, 0, AVPROBE_PADDING_SIZE); /* guess file format */ *fmt = av_probe_input_format2(&pd, 1, &score); if(*fmt){ if(score <= AVPROBE_SCORE_RETRY){ //this can only be true in the last iteration av_log(logctx, AV_LOG_WARNING, "Format %s detected only with low score of %d, misdetection possible!\n", (*fmt)->name, score); }else av_log(logctx, AV_LOG_DEBUG, "Format %s probed with size=%d and score=%d\n", (*fmt)->name, probe_size, score); } } if (!*fmt) { av_free(buf); return AVERROR_INVALIDDATA; } /* rewind. reuse probe buffer to avoid seeking */ if ((ret = ffio_rewind_with_probe_data(pb, buf, pd.buf_size)) < 0) av_free(buf); return ret; }
true
FFmpeg
120b38b966b92a50dd36542190d35daba6730eb3
int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt, const char *filename, void *logctx, unsigned int offset, unsigned int max_probe_size) { AVProbeData pd = { filename ? filename : "", NULL, -offset }; unsigned char *buf = NULL; int ret = 0, probe_size; if (!max_probe_size) { max_probe_size = PROBE_BUF_MAX; } else if (max_probe_size > PROBE_BUF_MAX) { max_probe_size = PROBE_BUF_MAX; } else if (max_probe_size < PROBE_BUF_MIN) { return AVERROR(EINVAL); } if (offset >= max_probe_size) { return AVERROR(EINVAL); } for(probe_size= PROBE_BUF_MIN; probe_size<=max_probe_size && !*fmt; probe_size = FFMIN(probe_size<<1, FFMAX(max_probe_size, probe_size+1))) { int score = probe_size < max_probe_size ? AVPROBE_SCORE_RETRY : 0; int buf_offset = (probe_size == PROBE_BUF_MIN) ? 0 : probe_size>>1; void *buftmp; if (probe_size < offset) { continue; } buftmp = av_realloc(buf, probe_size + AVPROBE_PADDING_SIZE); if(!buftmp){ av_free(buf); return AVERROR(ENOMEM); } buf=buftmp; if ((ret = avio_read(pb, buf + buf_offset, probe_size - buf_offset)) < 0) { if (ret != AVERROR_EOF) { av_free(buf); return ret; } score = 0; ret = 0; } pd.buf_size += ret; pd.buf = &buf[offset]; memset(pd.buf + pd.buf_size, 0, AVPROBE_PADDING_SIZE); *fmt = av_probe_input_format2(&pd, 1, &score); if(*fmt){ if(score <= AVPROBE_SCORE_RETRY){ av_log(logctx, AV_LOG_WARNING, "Format %s detected only with low score of %d, misdetection possible!\n", (*fmt)->name, score); }else av_log(logctx, AV_LOG_DEBUG, "Format %s probed with size=%d and score=%d\n", (*fmt)->name, probe_size, score); } } if (!*fmt) { av_free(buf); return AVERROR_INVALIDDATA; } if ((ret = ffio_rewind_with_probe_data(pb, buf, pd.buf_size)) < 0) av_free(buf); return ret; }
{ "code": [ " if ((ret = ffio_rewind_with_probe_data(pb, buf, pd.buf_size)) < 0)", " av_free(buf);" ], "line_no": [ 135, 125 ] }
int FUNC_0(AVIOContext *VAR_0, AVInputFormat **VAR_1, const char *VAR_2, void *VAR_3, unsigned int VAR_4, unsigned int VAR_5) { AVProbeData pd = { VAR_2 ? VAR_2 : "", NULL, -VAR_4 }; unsigned char *VAR_6 = NULL; int VAR_7 = 0, VAR_8; if (!VAR_5) { VAR_5 = PROBE_BUF_MAX; } else if (VAR_5 > PROBE_BUF_MAX) { VAR_5 = PROBE_BUF_MAX; } else if (VAR_5 < PROBE_BUF_MIN) { return AVERROR(EINVAL); } if (VAR_4 >= VAR_5) { return AVERROR(EINVAL); } for(VAR_8= PROBE_BUF_MIN; VAR_8<=VAR_5 && !*VAR_1; VAR_8 = FFMIN(VAR_8<<1, FFMAX(VAR_5, VAR_8+1))) { int score = VAR_8 < VAR_5 ? AVPROBE_SCORE_RETRY : 0; int buf_offset = (VAR_8 == PROBE_BUF_MIN) ? 0 : VAR_8>>1; void *buftmp; if (VAR_8 < VAR_4) { continue; } buftmp = av_realloc(VAR_6, VAR_8 + AVPROBE_PADDING_SIZE); if(!buftmp){ av_free(VAR_6); return AVERROR(ENOMEM); } VAR_6=buftmp; if ((VAR_7 = avio_read(VAR_0, VAR_6 + buf_offset, VAR_8 - buf_offset)) < 0) { if (VAR_7 != AVERROR_EOF) { av_free(VAR_6); return VAR_7; } score = 0; VAR_7 = 0; } pd.buf_size += VAR_7; pd.VAR_6 = &VAR_6[VAR_4]; memset(pd.VAR_6 + pd.buf_size, 0, AVPROBE_PADDING_SIZE); *VAR_1 = av_probe_input_format2(&pd, 1, &score); if(*VAR_1){ if(score <= AVPROBE_SCORE_RETRY){ av_log(VAR_3, AV_LOG_WARNING, "Format %s detected only with low score of %d, misdetection possible!\n", (*VAR_1)->name, score); }else av_log(VAR_3, AV_LOG_DEBUG, "Format %s probed with size=%d and score=%d\n", (*VAR_1)->name, VAR_8, score); } } if (!*VAR_1) { av_free(VAR_6); return AVERROR_INVALIDDATA; } if ((VAR_7 = ffio_rewind_with_probe_data(VAR_0, VAR_6, pd.buf_size)) < 0) av_free(VAR_6); return VAR_7; }
[ "int FUNC_0(AVIOContext *VAR_0, AVInputFormat **VAR_1,\nconst char *VAR_2, void *VAR_3,\nunsigned int VAR_4, unsigned int VAR_5)\n{", "AVProbeData pd = { VAR_2 ? VAR_2 : \"\", NULL, -VAR_4 };", "unsigned char *VAR_6 = NULL;", "int VAR_7 = 0, VAR_8;", "if (!VAR_5) {", "VAR_5 = PROBE_BUF_MAX;", "} else if (VAR_5 > PROBE_BUF_MAX) {", "VAR_5 = PROBE_BUF_MAX;", "} else if (VAR_5 < PROBE_BUF_MIN) {", "return AVERROR(EINVAL);", "}", "if (VAR_4 >= VAR_5) {", "return AVERROR(EINVAL);", "}", "for(VAR_8= PROBE_BUF_MIN; VAR_8<=VAR_5 && !*VAR_1;", "VAR_8 = FFMIN(VAR_8<<1, FFMAX(VAR_5, VAR_8+1))) {", "int score = VAR_8 < VAR_5 ? AVPROBE_SCORE_RETRY : 0;", "int buf_offset = (VAR_8 == PROBE_BUF_MIN) ? 0 : VAR_8>>1;", "void *buftmp;", "if (VAR_8 < VAR_4) {", "continue;", "}", "buftmp = av_realloc(VAR_6, VAR_8 + AVPROBE_PADDING_SIZE);", "if(!buftmp){", "av_free(VAR_6);", "return AVERROR(ENOMEM);", "}", "VAR_6=buftmp;", "if ((VAR_7 = avio_read(VAR_0, VAR_6 + buf_offset, VAR_8 - buf_offset)) < 0) {", "if (VAR_7 != AVERROR_EOF) {", "av_free(VAR_6);", "return VAR_7;", "}", "score = 0;", "VAR_7 = 0;", "}", "pd.buf_size += VAR_7;", "pd.VAR_6 = &VAR_6[VAR_4];", "memset(pd.VAR_6 + pd.buf_size, 0, AVPROBE_PADDING_SIZE);", "*VAR_1 = av_probe_input_format2(&pd, 1, &score);", "if(*VAR_1){", "if(score <= AVPROBE_SCORE_RETRY){", "av_log(VAR_3, AV_LOG_WARNING, \"Format %s detected only with low score of %d, misdetection possible!\\n\", (*VAR_1)->name, score);", "}else", "av_log(VAR_3, AV_LOG_DEBUG, \"Format %s probed with size=%d and score=%d\\n\", (*VAR_1)->name, VAR_8, score);", "}", "}", "if (!*VAR_1) {", "av_free(VAR_6);", "return AVERROR_INVALIDDATA;", "}", "if ((VAR_7 = ffio_rewind_with_probe_data(VAR_0, VAR_6, pd.buf_size)) < 0)\nav_free(VAR_6);", "return VAR_7;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 135, 137 ], [ 141 ], [ 143 ] ]
15,005
static int mov_read_stsz(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; MOVStreamContext *sc; unsigned int i, entries, sample_size, field_size, num_bytes; GetBitContext gb; unsigned char* buf; if (c->fc->nb_streams < 1) return 0; st = c->fc->streams[c->fc->nb_streams-1]; sc = st->priv_data; avio_r8(pb); /* version */ avio_rb24(pb); /* flags */ if (atom.type == MKTAG('s','t','s','z')) { sample_size = avio_rb32(pb); if (!sc->sample_size) /* do not overwrite value computed in stsd */ sc->sample_size = sample_size; field_size = 32; } else { sample_size = 0; avio_rb24(pb); /* reserved */ field_size = avio_r8(pb); } entries = avio_rb32(pb); av_log(c->fc, AV_LOG_TRACE, "sample_size = %d sample_count = %d\n", sc->sample_size, entries); sc->sample_count = entries; if (sample_size) return 0; if (field_size != 4 && field_size != 8 && field_size != 16 && field_size != 32) { av_log(c->fc, AV_LOG_ERROR, "Invalid sample field size %d\n", field_size); return AVERROR_INVALIDDATA; } if (!entries) return 0; if (entries >= UINT_MAX / sizeof(int) || entries >= (UINT_MAX - 4) / field_size) return AVERROR_INVALIDDATA; sc->sample_sizes = av_malloc(entries * sizeof(int)); if (!sc->sample_sizes) return AVERROR(ENOMEM); num_bytes = (entries*field_size+4)>>3; buf = av_malloc(num_bytes+FF_INPUT_BUFFER_PADDING_SIZE); if (!buf) { av_freep(&sc->sample_sizes); return AVERROR(ENOMEM); } if (avio_read(pb, buf, num_bytes) < num_bytes) { av_freep(&sc->sample_sizes); av_free(buf); return AVERROR_INVALIDDATA; } init_get_bits(&gb, buf, 8*num_bytes); for (i = 0; i < entries && !pb->eof_reached; i++) { sc->sample_sizes[i] = get_bits_long(&gb, field_size); sc->data_size += sc->sample_sizes[i]; } sc->sample_count = i; av_free(buf); if (pb->eof_reached) return AVERROR_EOF; return 0; }
true
FFmpeg
5c720657c23afd798ae0db7c7362eb859a89ab3d
static int mov_read_stsz(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; MOVStreamContext *sc; unsigned int i, entries, sample_size, field_size, num_bytes; GetBitContext gb; unsigned char* buf; if (c->fc->nb_streams < 1) return 0; st = c->fc->streams[c->fc->nb_streams-1]; sc = st->priv_data; avio_r8(pb); avio_rb24(pb); if (atom.type == MKTAG('s','t','s','z')) { sample_size = avio_rb32(pb); if (!sc->sample_size) sc->sample_size = sample_size; field_size = 32; } else { sample_size = 0; avio_rb24(pb); field_size = avio_r8(pb); } entries = avio_rb32(pb); av_log(c->fc, AV_LOG_TRACE, "sample_size = %d sample_count = %d\n", sc->sample_size, entries); sc->sample_count = entries; if (sample_size) return 0; if (field_size != 4 && field_size != 8 && field_size != 16 && field_size != 32) { av_log(c->fc, AV_LOG_ERROR, "Invalid sample field size %d\n", field_size); return AVERROR_INVALIDDATA; } if (!entries) return 0; if (entries >= UINT_MAX / sizeof(int) || entries >= (UINT_MAX - 4) / field_size) return AVERROR_INVALIDDATA; sc->sample_sizes = av_malloc(entries * sizeof(int)); if (!sc->sample_sizes) return AVERROR(ENOMEM); num_bytes = (entries*field_size+4)>>3; buf = av_malloc(num_bytes+FF_INPUT_BUFFER_PADDING_SIZE); if (!buf) { av_freep(&sc->sample_sizes); return AVERROR(ENOMEM); } if (avio_read(pb, buf, num_bytes) < num_bytes) { av_freep(&sc->sample_sizes); av_free(buf); return AVERROR_INVALIDDATA; } init_get_bits(&gb, buf, 8*num_bytes); for (i = 0; i < entries && !pb->eof_reached; i++) { sc->sample_sizes[i] = get_bits_long(&gb, field_size); sc->data_size += sc->sample_sizes[i]; } sc->sample_count = i; av_free(buf); if (pb->eof_reached) return AVERROR_EOF; return 0; }
{ "code": [ " if (avio_read(pb, buf, num_bytes) < num_bytes) {", " return AVERROR_INVALIDDATA;" ], "line_no": [ 111, 73 ] }
static int FUNC_0(MOVContext *VAR_0, AVIOContext *VAR_1, MOVAtom VAR_2) { AVStream *st; MOVStreamContext *sc; unsigned int VAR_3, VAR_4, VAR_5, VAR_6, VAR_7; GetBitContext gb; unsigned char* VAR_8; if (VAR_0->fc->nb_streams < 1) return 0; st = VAR_0->fc->streams[VAR_0->fc->nb_streams-1]; sc = st->priv_data; avio_r8(VAR_1); avio_rb24(VAR_1); if (VAR_2.type == MKTAG('s','t','s','z')) { VAR_5 = avio_rb32(VAR_1); if (!sc->VAR_5) sc->VAR_5 = VAR_5; VAR_6 = 32; } else { VAR_5 = 0; avio_rb24(VAR_1); VAR_6 = avio_r8(VAR_1); } VAR_4 = avio_rb32(VAR_1); av_log(VAR_0->fc, AV_LOG_TRACE, "VAR_5 = %d sample_count = %d\n", sc->VAR_5, VAR_4); sc->sample_count = VAR_4; if (VAR_5) return 0; if (VAR_6 != 4 && VAR_6 != 8 && VAR_6 != 16 && VAR_6 != 32) { av_log(VAR_0->fc, AV_LOG_ERROR, "Invalid sample field size %d\n", VAR_6); return AVERROR_INVALIDDATA; } if (!VAR_4) return 0; if (VAR_4 >= UINT_MAX / sizeof(int) || VAR_4 >= (UINT_MAX - 4) / VAR_6) return AVERROR_INVALIDDATA; sc->sample_sizes = av_malloc(VAR_4 * sizeof(int)); if (!sc->sample_sizes) return AVERROR(ENOMEM); VAR_7 = (VAR_4*VAR_6+4)>>3; VAR_8 = av_malloc(VAR_7+FF_INPUT_BUFFER_PADDING_SIZE); if (!VAR_8) { av_freep(&sc->sample_sizes); return AVERROR(ENOMEM); } if (avio_read(VAR_1, VAR_8, VAR_7) < VAR_7) { av_freep(&sc->sample_sizes); av_free(VAR_8); return AVERROR_INVALIDDATA; } init_get_bits(&gb, VAR_8, 8*VAR_7); for (VAR_3 = 0; VAR_3 < VAR_4 && !VAR_1->eof_reached; VAR_3++) { sc->sample_sizes[VAR_3] = get_bits_long(&gb, VAR_6); sc->data_size += sc->sample_sizes[VAR_3]; } sc->sample_count = VAR_3; av_free(VAR_8); if (VAR_1->eof_reached) return AVERROR_EOF; return 0; }
[ "static int FUNC_0(MOVContext *VAR_0, AVIOContext *VAR_1, MOVAtom VAR_2)\n{", "AVStream *st;", "MOVStreamContext *sc;", "unsigned int VAR_3, VAR_4, VAR_5, VAR_6, VAR_7;", "GetBitContext gb;", "unsigned char* VAR_8;", "if (VAR_0->fc->nb_streams < 1)\nreturn 0;", "st = VAR_0->fc->streams[VAR_0->fc->nb_streams-1];", "sc = st->priv_data;", "avio_r8(VAR_1);", "avio_rb24(VAR_1);", "if (VAR_2.type == MKTAG('s','t','s','z')) {", "VAR_5 = avio_rb32(VAR_1);", "if (!sc->VAR_5)\nsc->VAR_5 = VAR_5;", "VAR_6 = 32;", "} else {", "VAR_5 = 0;", "avio_rb24(VAR_1);", "VAR_6 = avio_r8(VAR_1);", "}", "VAR_4 = avio_rb32(VAR_1);", "av_log(VAR_0->fc, AV_LOG_TRACE, \"VAR_5 = %d sample_count = %d\\n\", sc->VAR_5, VAR_4);", "sc->sample_count = VAR_4;", "if (VAR_5)\nreturn 0;", "if (VAR_6 != 4 && VAR_6 != 8 && VAR_6 != 16 && VAR_6 != 32) {", "av_log(VAR_0->fc, AV_LOG_ERROR, \"Invalid sample field size %d\\n\", VAR_6);", "return AVERROR_INVALIDDATA;", "}", "if (!VAR_4)\nreturn 0;", "if (VAR_4 >= UINT_MAX / sizeof(int) || VAR_4 >= (UINT_MAX - 4) / VAR_6)\nreturn AVERROR_INVALIDDATA;", "sc->sample_sizes = av_malloc(VAR_4 * sizeof(int));", "if (!sc->sample_sizes)\nreturn AVERROR(ENOMEM);", "VAR_7 = (VAR_4*VAR_6+4)>>3;", "VAR_8 = av_malloc(VAR_7+FF_INPUT_BUFFER_PADDING_SIZE);", "if (!VAR_8) {", "av_freep(&sc->sample_sizes);", "return AVERROR(ENOMEM);", "}", "if (avio_read(VAR_1, VAR_8, VAR_7) < VAR_7) {", "av_freep(&sc->sample_sizes);", "av_free(VAR_8);", "return AVERROR_INVALIDDATA;", "}", "init_get_bits(&gb, VAR_8, 8*VAR_7);", "for (VAR_3 = 0; VAR_3 < VAR_4 && !VAR_1->eof_reached; VAR_3++) {", "sc->sample_sizes[VAR_3] = get_bits_long(&gb, VAR_6);", "sc->data_size += sc->sample_sizes[VAR_3];", "}", "sc->sample_count = VAR_3;", "av_free(VAR_8);", "if (VAR_1->eof_reached)\nreturn AVERROR_EOF;", "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, 1, 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17, 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37, 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 61 ], [ 63, 65 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79, 81 ], [ 83, 85 ], [ 87 ], [ 89, 91 ], [ 95 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 123 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 137 ], [ 141 ], [ 145, 147 ], [ 151 ], [ 153 ] ]
15,006
static inline void writer_print_string(WriterContext *wctx, const char *key, const char *val, int opt) { const struct section *section = wctx->section[wctx->level]; if (opt && !(wctx->writer->flags & WRITER_FLAG_DISPLAY_OPTIONAL_FIELDS)) return; if (section->show_all_entries || av_dict_get(section->entries_to_show, key, NULL, 0)) { wctx->writer->print_string(wctx, key, val); wctx->nb_item[wctx->level]++; } }
false
FFmpeg
e87190f5d20d380608f792ceb14d0def1d80e24b
static inline void writer_print_string(WriterContext *wctx, const char *key, const char *val, int opt) { const struct section *section = wctx->section[wctx->level]; if (opt && !(wctx->writer->flags & WRITER_FLAG_DISPLAY_OPTIONAL_FIELDS)) return; if (section->show_all_entries || av_dict_get(section->entries_to_show, key, NULL, 0)) { wctx->writer->print_string(wctx, key, val); wctx->nb_item[wctx->level]++; } }
{ "code": [], "line_no": [] }
static inline void FUNC_0(WriterContext *VAR_0, const char *VAR_1, const char *VAR_2, int VAR_3) { const struct VAR_4 *VAR_4 = VAR_0->VAR_4[VAR_0->level]; if (VAR_3 && !(VAR_0->writer->flags & WRITER_FLAG_DISPLAY_OPTIONAL_FIELDS)) return; if (VAR_4->show_all_entries || av_dict_get(VAR_4->entries_to_show, VAR_1, NULL, 0)) { VAR_0->writer->print_string(VAR_0, VAR_1, VAR_2); VAR_0->nb_item[VAR_0->level]++; } }
[ "static inline void FUNC_0(WriterContext *VAR_0,\nconst char *VAR_1, const char *VAR_2, int VAR_3)\n{", "const struct VAR_4 *VAR_4 = VAR_0->VAR_4[VAR_0->level];", "if (VAR_3 && !(VAR_0->writer->flags & WRITER_FLAG_DISPLAY_OPTIONAL_FIELDS))\nreturn;", "if (VAR_4->show_all_entries || av_dict_get(VAR_4->entries_to_show, VAR_1, NULL, 0)) {", "VAR_0->writer->print_string(VAR_0, VAR_1, VAR_2);", "VAR_0->nb_item[VAR_0->level]++;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11, 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ] ]
15,007
static int verify_expr(AVExpr *e) { if (!e) return 0; switch (e->type) { case e_value: case e_const: return 1; case e_func0: case e_func1: case e_squish: case e_ld: case e_gauss: case e_isnan: case e_floor: case e_ceil: case e_trunc: case e_sqrt: case e_not: case e_random: return verify_expr(e->param[0]) && !e->param[2]; case e_taylor: return verify_expr(e->param[0]) && verify_expr(e->param[1]) && (!e->param[2] || verify_expr(e->param[2])); default: return verify_expr(e->param[0]) && verify_expr(e->param[1]) && !e->param[2]; } }
false
FFmpeg
8c5ee45d13b7a0d14ff75b7db72d5400b7750571
static int verify_expr(AVExpr *e) { if (!e) return 0; switch (e->type) { case e_value: case e_const: return 1; case e_func0: case e_func1: case e_squish: case e_ld: case e_gauss: case e_isnan: case e_floor: case e_ceil: case e_trunc: case e_sqrt: case e_not: case e_random: return verify_expr(e->param[0]) && !e->param[2]; case e_taylor: return verify_expr(e->param[0]) && verify_expr(e->param[1]) && (!e->param[2] || verify_expr(e->param[2])); default: return verify_expr(e->param[0]) && verify_expr(e->param[1]) && !e->param[2]; } }
{ "code": [], "line_no": [] }
static int FUNC_0(AVExpr *VAR_0) { if (!VAR_0) return 0; switch (VAR_0->type) { case e_value: case e_const: return 1; case e_func0: case e_func1: case e_squish: case e_ld: case e_gauss: case e_isnan: case e_floor: case e_ceil: case e_trunc: case e_sqrt: case e_not: case e_random: return FUNC_0(VAR_0->param[0]) && !VAR_0->param[2]; case e_taylor: return FUNC_0(VAR_0->param[0]) && FUNC_0(VAR_0->param[1]) && (!VAR_0->param[2] || FUNC_0(VAR_0->param[2])); default: return FUNC_0(VAR_0->param[0]) && FUNC_0(VAR_0->param[1]) && !VAR_0->param[2]; } }
[ "static int FUNC_0(AVExpr *VAR_0)\n{", "if (!VAR_0) return 0;", "switch (VAR_0->type) {", "case e_value:\ncase e_const: return 1;", "case e_func0:\ncase e_func1:\ncase e_squish:\ncase e_ld:\ncase e_gauss:\ncase e_isnan:\ncase e_floor:\ncase e_ceil:\ncase e_trunc:\ncase e_sqrt:\ncase e_not:\ncase e_random:\nreturn FUNC_0(VAR_0->param[0]) && !VAR_0->param[2];", "case e_taylor:\nreturn FUNC_0(VAR_0->param[0]) && FUNC_0(VAR_0->param[1])\n&& (!VAR_0->param[2] || FUNC_0(VAR_0->param[2]));", "default: return FUNC_0(VAR_0->param[0]) && FUNC_0(VAR_0->param[1]) && !VAR_0->param[2];", "}", "}" ]
[ 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 ] ]
15,008
void ff_put_h264_qpel4_mc10_msa(uint8_t *dst, const uint8_t *src, ptrdiff_t stride) { avc_luma_hz_qrt_4w_msa(src - 2, stride, dst, stride, 4, 0); }
false
FFmpeg
b5da07d4340a8e8e40dcd1900977a76ff31fbb84
void ff_put_h264_qpel4_mc10_msa(uint8_t *dst, const uint8_t *src, ptrdiff_t stride) { avc_luma_hz_qrt_4w_msa(src - 2, stride, dst, stride, 4, 0); }
{ "code": [], "line_no": [] }
void FUNC_0(uint8_t *VAR_0, const uint8_t *VAR_1, ptrdiff_t VAR_2) { avc_luma_hz_qrt_4w_msa(VAR_1 - 2, VAR_2, VAR_0, VAR_2, 4, 0); }
[ "void FUNC_0(uint8_t *VAR_0, const uint8_t *VAR_1,\nptrdiff_t VAR_2)\n{", "avc_luma_hz_qrt_4w_msa(VAR_1 - 2, VAR_2, VAR_0, VAR_2, 4, 0);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ] ]
15,009
static int mov_read_stco(MOVContext *c, ByteIOContext *pb, MOVAtom atom) { AVStream *st = c->fc->streams[c->fc->nb_streams-1]; MOVStreamContext *sc = st->priv_data; unsigned int i, entries; get_byte(pb); /* version */ get_be24(pb); /* flags */ entries = get_be32(pb); if(entries >= UINT_MAX/sizeof(int64_t)) return -1; sc->chunk_offsets = av_malloc(entries * sizeof(int64_t)); if (!sc->chunk_offsets) return AVERROR(ENOMEM); sc->chunk_count = entries; if (atom.type == MKTAG('s','t','c','o')) for(i=0; i<entries; i++) sc->chunk_offsets[i] = get_be32(pb); else if (atom.type == MKTAG('c','o','6','4')) for(i=0; i<entries; i++) sc->chunk_offsets[i] = get_be64(pb); else return -1; return 0; }
false
FFmpeg
6a63ff19b6a7fe3bc32c7fb4a62fca8f65786432
static int mov_read_stco(MOVContext *c, ByteIOContext *pb, MOVAtom atom) { AVStream *st = c->fc->streams[c->fc->nb_streams-1]; MOVStreamContext *sc = st->priv_data; unsigned int i, entries; get_byte(pb); get_be24(pb); entries = get_be32(pb); if(entries >= UINT_MAX/sizeof(int64_t)) return -1; sc->chunk_offsets = av_malloc(entries * sizeof(int64_t)); if (!sc->chunk_offsets) return AVERROR(ENOMEM); sc->chunk_count = entries; if (atom.type == MKTAG('s','t','c','o')) for(i=0; i<entries; i++) sc->chunk_offsets[i] = get_be32(pb); else if (atom.type == MKTAG('c','o','6','4')) for(i=0; i<entries; i++) sc->chunk_offsets[i] = get_be64(pb); else return -1; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(MOVContext *VAR_0, ByteIOContext *VAR_1, MOVAtom VAR_2) { AVStream *st = VAR_0->fc->streams[VAR_0->fc->nb_streams-1]; MOVStreamContext *sc = st->priv_data; unsigned int VAR_3, VAR_4; get_byte(VAR_1); get_be24(VAR_1); VAR_4 = get_be32(VAR_1); if(VAR_4 >= UINT_MAX/sizeof(int64_t)) return -1; sc->chunk_offsets = av_malloc(VAR_4 * sizeof(int64_t)); if (!sc->chunk_offsets) return AVERROR(ENOMEM); sc->chunk_count = VAR_4; if (VAR_2.type == MKTAG('s','t','VAR_0','o')) for(VAR_3=0; VAR_3<VAR_4; VAR_3++) sc->chunk_offsets[VAR_3] = get_be32(VAR_1); else if (VAR_2.type == MKTAG('VAR_0','o','6','4')) for(VAR_3=0; VAR_3<VAR_4; VAR_3++) sc->chunk_offsets[VAR_3] = get_be64(VAR_1); else return -1; return 0; }
[ "static int FUNC_0(MOVContext *VAR_0, ByteIOContext *VAR_1, MOVAtom VAR_2)\n{", "AVStream *st = VAR_0->fc->streams[VAR_0->fc->nb_streams-1];", "MOVStreamContext *sc = st->priv_data;", "unsigned int VAR_3, VAR_4;", "get_byte(VAR_1);", "get_be24(VAR_1);", "VAR_4 = get_be32(VAR_1);", "if(VAR_4 >= UINT_MAX/sizeof(int64_t))\nreturn -1;", "sc->chunk_offsets = av_malloc(VAR_4 * sizeof(int64_t));", "if (!sc->chunk_offsets)\nreturn AVERROR(ENOMEM);", "sc->chunk_count = VAR_4;", "if (VAR_2.type == MKTAG('s','t','VAR_0','o'))\nfor(VAR_3=0; VAR_3<VAR_4; VAR_3++)", "sc->chunk_offsets[VAR_3] = get_be32(VAR_1);", "else if (VAR_2.type == MKTAG('VAR_0','o','6','4'))\nfor(VAR_3=0; VAR_3<VAR_4; VAR_3++)", "sc->chunk_offsets[VAR_3] = get_be64(VAR_1);", "else\nreturn -1;", "return 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 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 39, 41 ], [ 43 ], [ 45, 47 ], [ 49 ], [ 51, 53 ], [ 57 ], [ 59 ] ]
15,010
void ff_acelp_lspd2lpc(const double *lsp, float *lpc) { double pa[6], qa[6]; int i; lsp2polyf(lsp, pa, 5); lsp2polyf(lsp + 1, qa, 5); for (i=4; i>=0; i--) { double paf = pa[i+1] + pa[i]; double qaf = qa[i+1] - qa[i]; lpc[i ] = 0.5*(paf+qaf); lpc[9-i] = 0.5*(paf-qaf); } }
false
FFmpeg
33ae681f5ca9fa9aae82081dd6a6edbe2509f983
void ff_acelp_lspd2lpc(const double *lsp, float *lpc) { double pa[6], qa[6]; int i; lsp2polyf(lsp, pa, 5); lsp2polyf(lsp + 1, qa, 5); for (i=4; i>=0; i--) { double paf = pa[i+1] + pa[i]; double qaf = qa[i+1] - qa[i]; lpc[i ] = 0.5*(paf+qaf); lpc[9-i] = 0.5*(paf-qaf); } }
{ "code": [], "line_no": [] }
void FUNC_0(const double *VAR_0, float *VAR_1) { double VAR_2[6], VAR_3[6]; int VAR_4; lsp2polyf(VAR_0, VAR_2, 5); lsp2polyf(VAR_0 + 1, VAR_3, 5); for (VAR_4=4; VAR_4>=0; VAR_4--) { double VAR_5 = VAR_2[VAR_4+1] + VAR_2[VAR_4]; double VAR_6 = VAR_3[VAR_4+1] - VAR_3[VAR_4]; VAR_1[VAR_4 ] = 0.5*(VAR_5+VAR_6); VAR_1[9-VAR_4] = 0.5*(VAR_5-VAR_6); } }
[ "void FUNC_0(const double *VAR_0, float *VAR_1)\n{", "double VAR_2[6], VAR_3[6];", "int VAR_4;", "lsp2polyf(VAR_0, VAR_2, 5);", "lsp2polyf(VAR_0 + 1, VAR_3, 5);", "for (VAR_4=4; VAR_4>=0; VAR_4--)", "{", "double VAR_5 = VAR_2[VAR_4+1] + VAR_2[VAR_4];", "double VAR_6 = VAR_3[VAR_4+1] - VAR_3[VAR_4];", "VAR_1[VAR_4 ] = 0.5*(VAR_5+VAR_6);", "VAR_1[9-VAR_4] = 0.5*(VAR_5-VAR_6);", "}", "}" ]
[ 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 ], [ 33 ] ]
15,011
void ff_put_h264_qpel8_mc33_msa(uint8_t *dst, const uint8_t *src, ptrdiff_t stride) { avc_luma_hv_qrt_8w_msa(src + stride - 2, src - (stride * 2) + sizeof(uint8_t), stride, dst, stride, 8); }
false
FFmpeg
2aab7c2dfaca4386c38e5d565cd2bf73096bcc86
void ff_put_h264_qpel8_mc33_msa(uint8_t *dst, const uint8_t *src, ptrdiff_t stride) { avc_luma_hv_qrt_8w_msa(src + stride - 2, src - (stride * 2) + sizeof(uint8_t), stride, dst, stride, 8); }
{ "code": [], "line_no": [] }
void FUNC_0(uint8_t *VAR_0, const uint8_t *VAR_1, ptrdiff_t VAR_2) { avc_luma_hv_qrt_8w_msa(VAR_1 + VAR_2 - 2, VAR_1 - (VAR_2 * 2) + sizeof(uint8_t), VAR_2, VAR_0, VAR_2, 8); }
[ "void FUNC_0(uint8_t *VAR_0, const uint8_t *VAR_1,\nptrdiff_t VAR_2)\n{", "avc_luma_hv_qrt_8w_msa(VAR_1 + VAR_2 - 2,\nVAR_1 - (VAR_2 * 2) +\nsizeof(uint8_t), VAR_2, VAR_0, VAR_2, 8);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7, 9, 11 ], [ 13 ] ]
15,012
static void gen_load_store_alignment(DisasContext *dc, int shift, TCGv_i32 addr, bool no_hw_alignment) { if (!option_enabled(dc, XTENSA_OPTION_UNALIGNED_EXCEPTION)) { tcg_gen_andi_i32(addr, addr, ~0 << shift); } else if (option_enabled(dc, XTENSA_OPTION_HW_ALIGNMENT) && no_hw_alignment) { int label = gen_new_label(); TCGv_i32 tmp = tcg_temp_new_i32(); tcg_gen_andi_i32(tmp, addr, ~(~0 << shift)); tcg_gen_brcondi_i32(TCG_COND_EQ, tmp, 0, label); gen_exception_cause_vaddr(dc, LOAD_STORE_ALIGNMENT_CAUSE, addr); gen_set_label(label); tcg_temp_free(tmp); } }
false
qemu
42a268c241183877192c376d03bd9b6d527407c7
static void gen_load_store_alignment(DisasContext *dc, int shift, TCGv_i32 addr, bool no_hw_alignment) { if (!option_enabled(dc, XTENSA_OPTION_UNALIGNED_EXCEPTION)) { tcg_gen_andi_i32(addr, addr, ~0 << shift); } else if (option_enabled(dc, XTENSA_OPTION_HW_ALIGNMENT) && no_hw_alignment) { int label = gen_new_label(); TCGv_i32 tmp = tcg_temp_new_i32(); tcg_gen_andi_i32(tmp, addr, ~(~0 << shift)); tcg_gen_brcondi_i32(TCG_COND_EQ, tmp, 0, label); gen_exception_cause_vaddr(dc, LOAD_STORE_ALIGNMENT_CAUSE, addr); gen_set_label(label); tcg_temp_free(tmp); } }
{ "code": [], "line_no": [] }
static void FUNC_0(DisasContext *VAR_0, int VAR_1, TCGv_i32 VAR_2, bool VAR_3) { if (!option_enabled(VAR_0, XTENSA_OPTION_UNALIGNED_EXCEPTION)) { tcg_gen_andi_i32(VAR_2, VAR_2, ~0 << VAR_1); } else if (option_enabled(VAR_0, XTENSA_OPTION_HW_ALIGNMENT) && VAR_3) { int VAR_4 = gen_new_label(); TCGv_i32 tmp = tcg_temp_new_i32(); tcg_gen_andi_i32(tmp, VAR_2, ~(~0 << VAR_1)); tcg_gen_brcondi_i32(TCG_COND_EQ, tmp, 0, VAR_4); gen_exception_cause_vaddr(VAR_0, LOAD_STORE_ALIGNMENT_CAUSE, VAR_2); gen_set_label(VAR_4); tcg_temp_free(tmp); } }
[ "static void FUNC_0(DisasContext *VAR_0, int VAR_1,\nTCGv_i32 VAR_2, bool VAR_3)\n{", "if (!option_enabled(VAR_0, XTENSA_OPTION_UNALIGNED_EXCEPTION)) {", "tcg_gen_andi_i32(VAR_2, VAR_2, ~0 << VAR_1);", "} else if (option_enabled(VAR_0, XTENSA_OPTION_HW_ALIGNMENT) &&", "VAR_3) {", "int VAR_4 = gen_new_label();", "TCGv_i32 tmp = tcg_temp_new_i32();", "tcg_gen_andi_i32(tmp, VAR_2, ~(~0 << VAR_1));", "tcg_gen_brcondi_i32(TCG_COND_EQ, tmp, 0, VAR_4);", "gen_exception_cause_vaddr(VAR_0, LOAD_STORE_ALIGNMENT_CAUSE, VAR_2);", "gen_set_label(VAR_4);", "tcg_temp_free(tmp);", "}", "}" ]
[ 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 ] ]
15,013
DISAS_INSN(cas2w) { uint16_t ext1, ext2; TCGv addr1, addr2; TCGv regs; /* cas2 Dc1:Dc2,Du1:Du2,(Rn1):(Rn2) */ ext1 = read_im16(env, s); if (ext1 & 0x8000) { /* Address Register */ addr1 = AREG(ext1, 12); } else { /* Data Register */ addr1 = DREG(ext1, 12); } ext2 = read_im16(env, s); if (ext2 & 0x8000) { /* Address Register */ addr2 = AREG(ext2, 12); } else { /* Data Register */ addr2 = DREG(ext2, 12); } /* if (R1) == Dc1 && (R2) == Dc2 then * (R1) = Du1 * (R2) = Du2 * else * Dc1 = (R1) * Dc2 = (R2) */ regs = tcg_const_i32(REG(ext2, 6) | (REG(ext1, 6) << 3) | (REG(ext2, 0) << 6) | (REG(ext1, 0) << 9)); gen_helper_cas2w(cpu_env, regs, addr1, addr2); tcg_temp_free(regs); /* Note that cas2w also assigned to env->cc_op. */ s->cc_op = CC_OP_CMPW; s->cc_op_synced = 1; }
false
qemu
f0ddf11b23260f0af84fb529486a8f9ba2d19401
DISAS_INSN(cas2w) { uint16_t ext1, ext2; TCGv addr1, addr2; TCGv regs; ext1 = read_im16(env, s); if (ext1 & 0x8000) { addr1 = AREG(ext1, 12); } else { addr1 = DREG(ext1, 12); } ext2 = read_im16(env, s); if (ext2 & 0x8000) { addr2 = AREG(ext2, 12); } else { addr2 = DREG(ext2, 12); } regs = tcg_const_i32(REG(ext2, 6) | (REG(ext1, 6) << 3) | (REG(ext2, 0) << 6) | (REG(ext1, 0) << 9)); gen_helper_cas2w(cpu_env, regs, addr1, addr2); tcg_temp_free(regs); s->cc_op = CC_OP_CMPW; s->cc_op_synced = 1; }
{ "code": [], "line_no": [] }
FUNC_0(VAR_0) { uint16_t ext1, ext2; TCGv addr1, addr2; TCGv regs; ext1 = read_im16(env, s); if (ext1 & 0x8000) { addr1 = AREG(ext1, 12); } else { addr1 = DREG(ext1, 12); } ext2 = read_im16(env, s); if (ext2 & 0x8000) { addr2 = AREG(ext2, 12); } else { addr2 = DREG(ext2, 12); } regs = tcg_const_i32(REG(ext2, 6) | (REG(ext1, 6) << 3) | (REG(ext2, 0) << 6) | (REG(ext1, 0) << 9)); gen_helper_cas2w(cpu_env, regs, addr1, addr2); tcg_temp_free(regs); s->cc_op = CC_OP_CMPW; s->cc_op_synced = 1; }
[ "FUNC_0(VAR_0)\n{", "uint16_t ext1, ext2;", "TCGv addr1, addr2;", "TCGv regs;", "ext1 = read_im16(env, s);", "if (ext1 & 0x8000) {", "addr1 = AREG(ext1, 12);", "} else {", "addr1 = DREG(ext1, 12);", "}", "ext2 = read_im16(env, s);", "if (ext2 & 0x8000) {", "addr2 = AREG(ext2, 12);", "} else {", "addr2 = DREG(ext2, 12);", "}", "regs = tcg_const_i32(REG(ext2, 6) |\n(REG(ext1, 6) << 3) |\n(REG(ext2, 0) << 6) |\n(REG(ext1, 0) << 9));", "gen_helper_cas2w(cpu_env, regs, addr1, addr2);", "tcg_temp_free(regs);", "s->cc_op = CC_OP_CMPW;", "s->cc_op_synced = 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 ], [ 17 ], [ 21 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 71, 73, 75, 77 ], [ 79 ], [ 81 ], [ 87 ], [ 89 ], [ 91 ] ]
15,014
bool timerlist_run_timers(QEMUTimerList *timer_list) { QEMUTimer *ts; int64_t current_time; bool progress = false; QEMUTimerCB *cb; void *opaque; if (!atomic_read(&timer_list->active_timers)) { return false; } qemu_event_reset(&timer_list->timers_done_ev); if (!timer_list->clock->enabled) { goto out; } switch (timer_list->clock->type) { case QEMU_CLOCK_REALTIME: break; default: case QEMU_CLOCK_VIRTUAL: if (!replay_checkpoint(CHECKPOINT_CLOCK_VIRTUAL)) { goto out; } break; case QEMU_CLOCK_HOST: if (!replay_checkpoint(CHECKPOINT_CLOCK_HOST)) { goto out; } break; case QEMU_CLOCK_VIRTUAL_RT: if (!replay_checkpoint(CHECKPOINT_CLOCK_VIRTUAL_RT)) { goto out; } break; } current_time = qemu_clock_get_ns(timer_list->clock->type); for(;;) { qemu_mutex_lock(&timer_list->active_timers_lock); ts = timer_list->active_timers; if (!timer_expired_ns(ts, current_time)) { qemu_mutex_unlock(&timer_list->active_timers_lock); break; } /* remove timer from the list before calling the callback */ timer_list->active_timers = ts->next; ts->next = NULL; ts->expire_time = -1; cb = ts->cb; opaque = ts->opaque; qemu_mutex_unlock(&timer_list->active_timers_lock); /* run the callback (the timer list can be modified) */ cb(opaque); progress = true; } out: qemu_event_set(&timer_list->timers_done_ev); return progress; }
false
qemu
c2b38b277a7882a592f4f2ec955084b2b756daaa
bool timerlist_run_timers(QEMUTimerList *timer_list) { QEMUTimer *ts; int64_t current_time; bool progress = false; QEMUTimerCB *cb; void *opaque; if (!atomic_read(&timer_list->active_timers)) { return false; } qemu_event_reset(&timer_list->timers_done_ev); if (!timer_list->clock->enabled) { goto out; } switch (timer_list->clock->type) { case QEMU_CLOCK_REALTIME: break; default: case QEMU_CLOCK_VIRTUAL: if (!replay_checkpoint(CHECKPOINT_CLOCK_VIRTUAL)) { goto out; } break; case QEMU_CLOCK_HOST: if (!replay_checkpoint(CHECKPOINT_CLOCK_HOST)) { goto out; } break; case QEMU_CLOCK_VIRTUAL_RT: if (!replay_checkpoint(CHECKPOINT_CLOCK_VIRTUAL_RT)) { goto out; } break; } current_time = qemu_clock_get_ns(timer_list->clock->type); for(;;) { qemu_mutex_lock(&timer_list->active_timers_lock); ts = timer_list->active_timers; if (!timer_expired_ns(ts, current_time)) { qemu_mutex_unlock(&timer_list->active_timers_lock); break; } timer_list->active_timers = ts->next; ts->next = NULL; ts->expire_time = -1; cb = ts->cb; opaque = ts->opaque; qemu_mutex_unlock(&timer_list->active_timers_lock); cb(opaque); progress = true; } out: qemu_event_set(&timer_list->timers_done_ev); return progress; }
{ "code": [], "line_no": [] }
bool FUNC_0(QEMUTimerList *timer_list) { QEMUTimer *ts; int64_t current_time; bool progress = false; QEMUTimerCB *cb; void *VAR_0; if (!atomic_read(&timer_list->active_timers)) { return false; } qemu_event_reset(&timer_list->timers_done_ev); if (!timer_list->clock->enabled) { goto out; } switch (timer_list->clock->type) { case QEMU_CLOCK_REALTIME: break; default: case QEMU_CLOCK_VIRTUAL: if (!replay_checkpoint(CHECKPOINT_CLOCK_VIRTUAL)) { goto out; } break; case QEMU_CLOCK_HOST: if (!replay_checkpoint(CHECKPOINT_CLOCK_HOST)) { goto out; } break; case QEMU_CLOCK_VIRTUAL_RT: if (!replay_checkpoint(CHECKPOINT_CLOCK_VIRTUAL_RT)) { goto out; } break; } current_time = qemu_clock_get_ns(timer_list->clock->type); for(;;) { qemu_mutex_lock(&timer_list->active_timers_lock); ts = timer_list->active_timers; if (!timer_expired_ns(ts, current_time)) { qemu_mutex_unlock(&timer_list->active_timers_lock); break; } timer_list->active_timers = ts->next; ts->next = NULL; ts->expire_time = -1; cb = ts->cb; VAR_0 = ts->VAR_0; qemu_mutex_unlock(&timer_list->active_timers_lock); cb(VAR_0); progress = true; } out: qemu_event_set(&timer_list->timers_done_ev); return progress; }
[ "bool FUNC_0(QEMUTimerList *timer_list)\n{", "QEMUTimer *ts;", "int64_t current_time;", "bool progress = false;", "QEMUTimerCB *cb;", "void *VAR_0;", "if (!atomic_read(&timer_list->active_timers)) {", "return false;", "}", "qemu_event_reset(&timer_list->timers_done_ev);", "if (!timer_list->clock->enabled) {", "goto out;", "}", "switch (timer_list->clock->type) {", "case QEMU_CLOCK_REALTIME:\nbreak;", "default:\ncase QEMU_CLOCK_VIRTUAL:\nif (!replay_checkpoint(CHECKPOINT_CLOCK_VIRTUAL)) {", "goto out;", "}", "break;", "case QEMU_CLOCK_HOST:\nif (!replay_checkpoint(CHECKPOINT_CLOCK_HOST)) {", "goto out;", "}", "break;", "case QEMU_CLOCK_VIRTUAL_RT:\nif (!replay_checkpoint(CHECKPOINT_CLOCK_VIRTUAL_RT)) {", "goto out;", "}", "break;", "}", "current_time = qemu_clock_get_ns(timer_list->clock->type);", "for(;;) {", "qemu_mutex_lock(&timer_list->active_timers_lock);", "ts = timer_list->active_timers;", "if (!timer_expired_ns(ts, current_time)) {", "qemu_mutex_unlock(&timer_list->active_timers_lock);", "break;", "}", "timer_list->active_timers = ts->next;", "ts->next = NULL;", "ts->expire_time = -1;", "cb = ts->cb;", "VAR_0 = ts->VAR_0;", "qemu_mutex_unlock(&timer_list->active_timers_lock);", "cb(VAR_0);", "progress = true;", "}", "out:\nqemu_event_set(&timer_list->timers_done_ev);", "return progress;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37, 39 ], [ 41, 43, 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53, 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63, 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 113 ], [ 115 ], [ 117 ], [ 121, 123 ], [ 125 ], [ 127 ] ]
15,015
static int qemu_rdma_broken_ipv6_kernel(Error **errp, struct ibv_context *verbs) { struct ibv_port_attr port_attr; /* This bug only exists in linux, to our knowledge. */ #ifdef CONFIG_LINUX /* * Verbs are only NULL if management has bound to '[::]'. * * Let's iterate through all the devices and see if there any pure IB * devices (non-ethernet). * * If not, then we can safely proceed with the migration. * Otherwise, there are no guarantees until the bug is fixed in linux. */ if (!verbs) { int num_devices, x; struct ibv_device ** dev_list = ibv_get_device_list(&num_devices); bool roce_found = false; bool ib_found = false; for (x = 0; x < num_devices; x++) { verbs = ibv_open_device(dev_list[x]); if (ibv_query_port(verbs, 1, &port_attr)) { ibv_close_device(verbs); ERROR(errp, "Could not query initial IB port"); return -EINVAL; } if (port_attr.link_layer == IBV_LINK_LAYER_INFINIBAND) { ib_found = true; } else if (port_attr.link_layer == IBV_LINK_LAYER_ETHERNET) { roce_found = true; } ibv_close_device(verbs); } if (roce_found) { if (ib_found) { fprintf(stderr, "WARN: migrations may fail:" " IPv6 over RoCE / iWARP in linux" " is broken. But since you appear to have a" " mixed RoCE / IB environment, be sure to only" " migrate over the IB fabric until the kernel " " fixes the bug.\n"); } else { ERROR(errp, "You only have RoCE / iWARP devices in your systems" " and your management software has specified '[::]'" ", but IPv6 over RoCE / iWARP is not supported in Linux."); return -ENONET; } } return 0; } /* * If we have a verbs context, that means that some other than '[::]' was * used by the management software for binding. In which case we can actually * warn the user about a potential broken kernel; */ /* IB ports start with 1, not 0 */ if (ibv_query_port(verbs, 1, &port_attr)) { ERROR(errp, "Could not query initial IB port"); return -EINVAL; } if (port_attr.link_layer == IBV_LINK_LAYER_ETHERNET) { ERROR(errp, "Linux kernel's RoCE / iWARP does not support IPv6 " "(but patches on linux-rdma in progress)"); return -ENONET; } #endif return 0; }
false
qemu
02942db7982541716131ca486ca0d59eae107553
static int qemu_rdma_broken_ipv6_kernel(Error **errp, struct ibv_context *verbs) { struct ibv_port_attr port_attr; #ifdef CONFIG_LINUX if (!verbs) { int num_devices, x; struct ibv_device ** dev_list = ibv_get_device_list(&num_devices); bool roce_found = false; bool ib_found = false; for (x = 0; x < num_devices; x++) { verbs = ibv_open_device(dev_list[x]); if (ibv_query_port(verbs, 1, &port_attr)) { ibv_close_device(verbs); ERROR(errp, "Could not query initial IB port"); return -EINVAL; } if (port_attr.link_layer == IBV_LINK_LAYER_INFINIBAND) { ib_found = true; } else if (port_attr.link_layer == IBV_LINK_LAYER_ETHERNET) { roce_found = true; } ibv_close_device(verbs); } if (roce_found) { if (ib_found) { fprintf(stderr, "WARN: migrations may fail:" " IPv6 over RoCE / iWARP in linux" " is broken. But since you appear to have a" " mixed RoCE / IB environment, be sure to only" " migrate over the IB fabric until the kernel " " fixes the bug.\n"); } else { ERROR(errp, "You only have RoCE / iWARP devices in your systems" " and your management software has specified '[::]'" ", but IPv6 over RoCE / iWARP is not supported in Linux."); return -ENONET; } } return 0; } if (ibv_query_port(verbs, 1, &port_attr)) { ERROR(errp, "Could not query initial IB port"); return -EINVAL; } if (port_attr.link_layer == IBV_LINK_LAYER_ETHERNET) { ERROR(errp, "Linux kernel's RoCE / iWARP does not support IPv6 " "(but patches on linux-rdma in progress)"); return -ENONET; } #endif return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(Error **VAR_0, struct ibv_context *VAR_1) { struct ibv_port_attr VAR_2; #ifdef CONFIG_LINUX if (!VAR_1) { int num_devices, x; struct ibv_device ** dev_list = ibv_get_device_list(&num_devices); bool roce_found = false; bool ib_found = false; for (x = 0; x < num_devices; x++) { VAR_1 = ibv_open_device(dev_list[x]); if (ibv_query_port(VAR_1, 1, &VAR_2)) { ibv_close_device(VAR_1); ERROR(VAR_0, "Could not query initial IB port"); return -EINVAL; } if (VAR_2.link_layer == IBV_LINK_LAYER_INFINIBAND) { ib_found = true; } else if (VAR_2.link_layer == IBV_LINK_LAYER_ETHERNET) { roce_found = true; } ibv_close_device(VAR_1); } if (roce_found) { if (ib_found) { fprintf(stderr, "WARN: migrations may fail:" " IPv6 over RoCE / iWARP in linux" " is broken. But since you appear to have a" " mixed RoCE / IB environment, be sure to only" " migrate over the IB fabric until the kernel " " fixes the bug.\n"); } else { ERROR(VAR_0, "You only have RoCE / iWARP devices in your systems" " and your management software has specified '[::]'" ", but IPv6 over RoCE / iWARP is not supported in Linux."); return -ENONET; } } return 0; } if (ibv_query_port(VAR_1, 1, &VAR_2)) { ERROR(VAR_0, "Could not query initial IB port"); return -EINVAL; } if (VAR_2.link_layer == IBV_LINK_LAYER_ETHERNET) { ERROR(VAR_0, "Linux kernel's RoCE / iWARP does not support IPv6 " "(but patches on linux-rdma in progress)"); return -ENONET; } #endif return 0; }
[ "static int FUNC_0(Error **VAR_0, struct ibv_context *VAR_1)\n{", "struct ibv_port_attr VAR_2;", "#ifdef CONFIG_LINUX\nif (!VAR_1) {", "int num_devices, x;", "struct ibv_device ** dev_list = ibv_get_device_list(&num_devices);", "bool roce_found = false;", "bool ib_found = false;", "for (x = 0; x < num_devices; x++) {", "VAR_1 = ibv_open_device(dev_list[x]);", "if (ibv_query_port(VAR_1, 1, &VAR_2)) {", "ibv_close_device(VAR_1);", "ERROR(VAR_0, \"Could not query initial IB port\");", "return -EINVAL;", "}", "if (VAR_2.link_layer == IBV_LINK_LAYER_INFINIBAND) {", "ib_found = true;", "} else if (VAR_2.link_layer == IBV_LINK_LAYER_ETHERNET) {", "roce_found = true;", "}", "ibv_close_device(VAR_1);", "}", "if (roce_found) {", "if (ib_found) {", "fprintf(stderr, \"WARN: migrations may fail:\"\n\" IPv6 over RoCE / iWARP in linux\"\n\" is broken. But since you appear to have a\"\n\" mixed RoCE / IB environment, be sure to only\"\n\" migrate over the IB fabric until the kernel \"\n\" fixes the bug.\\n\");", "} else {", "ERROR(VAR_0, \"You only have RoCE / iWARP devices in your systems\"\n\" and your management software has specified '[::]'\"\n\", but IPv6 over RoCE / iWARP is not supported in Linux.\");", "return -ENONET;", "}", "}", "return 0;", "}", "if (ibv_query_port(VAR_1, 1, &VAR_2)) {", "ERROR(VAR_0, \"Could not query initial IB port\");", "return -EINVAL;", "}", "if (VAR_2.link_layer == IBV_LINK_LAYER_ETHERNET) {", "ERROR(VAR_0, \"Linux kernel's RoCE / iWARP does not support IPv6 \"\n\"(but patches on linux-rdma in progress)\");", "return -ENONET;", "}", "#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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 11, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 75 ], [ 79 ], [ 83 ], [ 85 ], [ 87, 89, 91, 93, 95, 97 ], [ 99 ], [ 101, 103, 105 ], [ 107 ], [ 109 ], [ 111 ], [ 115 ], [ 117 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 145 ], [ 147, 149 ], [ 151 ], [ 153 ], [ 157, 161 ], [ 163 ] ]
15,017
static void slavio_set_irq(void *opaque, int irq, int level) { SLAVIO_INTCTLState *s = opaque; DPRINTF("Set cpu %d irq %d level %d\n", s->target_cpu, irq, level); if (irq < 32) { uint32_t mask = 1 << irq; uint32_t pil = s->intbit_to_level[irq]; if (pil > 0) { if (level) { s->intregm_pending |= mask; s->intreg_pending[s->target_cpu] |= 1 << pil; slavio_check_interrupts(s); } else { s->intregm_pending &= ~mask; s->intreg_pending[s->target_cpu] &= ~(1 << pil); } } } }
false
qemu
b3a2319792ad5c0f0f8c3d2f4d02b95fd7efbc69
static void slavio_set_irq(void *opaque, int irq, int level) { SLAVIO_INTCTLState *s = opaque; DPRINTF("Set cpu %d irq %d level %d\n", s->target_cpu, irq, level); if (irq < 32) { uint32_t mask = 1 << irq; uint32_t pil = s->intbit_to_level[irq]; if (pil > 0) { if (level) { s->intregm_pending |= mask; s->intreg_pending[s->target_cpu] |= 1 << pil; slavio_check_interrupts(s); } else { s->intregm_pending &= ~mask; s->intreg_pending[s->target_cpu] &= ~(1 << pil); } } } }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, int VAR_1, int VAR_2) { SLAVIO_INTCTLState *s = VAR_0; DPRINTF("Set cpu %d VAR_1 %d VAR_2 %d\n", s->target_cpu, VAR_1, VAR_2); if (VAR_1 < 32) { uint32_t mask = 1 << VAR_1; uint32_t pil = s->intbit_to_level[VAR_1]; if (pil > 0) { if (VAR_2) { s->intregm_pending |= mask; s->intreg_pending[s->target_cpu] |= 1 << pil; slavio_check_interrupts(s); } else { s->intregm_pending &= ~mask; s->intreg_pending[s->target_cpu] &= ~(1 << pil); } } } }
[ "static void FUNC_0(void *VAR_0, int VAR_1, int VAR_2)\n{", "SLAVIO_INTCTLState *s = VAR_0;", "DPRINTF(\"Set cpu %d VAR_1 %d VAR_2 %d\\n\", s->target_cpu, VAR_1, VAR_2);", "if (VAR_1 < 32) {", "uint32_t mask = 1 << VAR_1;", "uint32_t pil = s->intbit_to_level[VAR_1];", "if (pil > 0) {", "if (VAR_2) {", "s->intregm_pending |= mask;", "s->intreg_pending[s->target_cpu] |= 1 << pil;", "slavio_check_interrupts(s);", "}", "else {", "s->intregm_pending &= ~mask;", "s->intreg_pending[s->target_cpu] &= ~(1 << pil);", "}", "}", "}", "}" ]
[ 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 ] ]
15,018
int css_register_io_adapter(CssIoAdapterType type, uint8_t isc, bool swap, bool maskable, uint32_t *id) { IoAdapter *adapter; bool found = false; int ret; S390FLICState *fs = s390_get_flic(); S390FLICStateClass *fsc = S390_FLIC_COMMON_GET_CLASS(fs); *id = 0; QTAILQ_FOREACH(adapter, &channel_subsys.io_adapters, sibling) { if ((adapter->type == type) && (adapter->isc == isc)) { *id = adapter->id; found = true; ret = 0; break; } if (adapter->id >= *id) { *id = adapter->id + 1; } } if (found) { goto out; } adapter = g_new0(IoAdapter, 1); ret = fsc->register_io_adapter(fs, *id, isc, swap, maskable); if (ret == 0) { adapter->id = *id; adapter->isc = isc; adapter->type = type; QTAILQ_INSERT_TAIL(&channel_subsys.io_adapters, adapter, sibling); } else { g_free(adapter); fprintf(stderr, "Unexpected error %d when registering adapter %d\n", ret, *id); } out: return ret; }
false
qemu
dde522bbc5feb2862afb243bb49c590fe65dce66
int css_register_io_adapter(CssIoAdapterType type, uint8_t isc, bool swap, bool maskable, uint32_t *id) { IoAdapter *adapter; bool found = false; int ret; S390FLICState *fs = s390_get_flic(); S390FLICStateClass *fsc = S390_FLIC_COMMON_GET_CLASS(fs); *id = 0; QTAILQ_FOREACH(adapter, &channel_subsys.io_adapters, sibling) { if ((adapter->type == type) && (adapter->isc == isc)) { *id = adapter->id; found = true; ret = 0; break; } if (adapter->id >= *id) { *id = adapter->id + 1; } } if (found) { goto out; } adapter = g_new0(IoAdapter, 1); ret = fsc->register_io_adapter(fs, *id, isc, swap, maskable); if (ret == 0) { adapter->id = *id; adapter->isc = isc; adapter->type = type; QTAILQ_INSERT_TAIL(&channel_subsys.io_adapters, adapter, sibling); } else { g_free(adapter); fprintf(stderr, "Unexpected error %d when registering adapter %d\n", ret, *id); } out: return ret; }
{ "code": [], "line_no": [] }
int FUNC_0(CssIoAdapterType VAR_0, uint8_t VAR_1, bool VAR_2, bool VAR_3, uint32_t *VAR_4) { IoAdapter *adapter; bool found = false; int VAR_5; S390FLICState *fs = s390_get_flic(); S390FLICStateClass *fsc = S390_FLIC_COMMON_GET_CLASS(fs); *VAR_4 = 0; QTAILQ_FOREACH(adapter, &channel_subsys.io_adapters, sibling) { if ((adapter->VAR_0 == VAR_0) && (adapter->VAR_1 == VAR_1)) { *VAR_4 = adapter->VAR_4; found = true; VAR_5 = 0; break; } if (adapter->VAR_4 >= *VAR_4) { *VAR_4 = adapter->VAR_4 + 1; } } if (found) { goto out; } adapter = g_new0(IoAdapter, 1); VAR_5 = fsc->register_io_adapter(fs, *VAR_4, VAR_1, VAR_2, VAR_3); if (VAR_5 == 0) { adapter->VAR_4 = *VAR_4; adapter->VAR_1 = VAR_1; adapter->VAR_0 = VAR_0; QTAILQ_INSERT_TAIL(&channel_subsys.io_adapters, adapter, sibling); } else { g_free(adapter); fprintf(stderr, "Unexpected error %d when registering adapter %d\n", VAR_5, *VAR_4); } out: return VAR_5; }
[ "int FUNC_0(CssIoAdapterType VAR_0, uint8_t VAR_1, bool VAR_2,\nbool VAR_3, uint32_t *VAR_4)\n{", "IoAdapter *adapter;", "bool found = false;", "int VAR_5;", "S390FLICState *fs = s390_get_flic();", "S390FLICStateClass *fsc = S390_FLIC_COMMON_GET_CLASS(fs);", "*VAR_4 = 0;", "QTAILQ_FOREACH(adapter, &channel_subsys.io_adapters, sibling) {", "if ((adapter->VAR_0 == VAR_0) && (adapter->VAR_1 == VAR_1)) {", "*VAR_4 = adapter->VAR_4;", "found = true;", "VAR_5 = 0;", "break;", "}", "if (adapter->VAR_4 >= *VAR_4) {", "*VAR_4 = adapter->VAR_4 + 1;", "}", "}", "if (found) {", "goto out;", "}", "adapter = g_new0(IoAdapter, 1);", "VAR_5 = fsc->register_io_adapter(fs, *VAR_4, VAR_1, VAR_2, VAR_3);", "if (VAR_5 == 0) {", "adapter->VAR_4 = *VAR_4;", "adapter->VAR_1 = VAR_1;", "adapter->VAR_0 = VAR_0;", "QTAILQ_INSERT_TAIL(&channel_subsys.io_adapters, adapter, sibling);", "} else {", "g_free(adapter);", "fprintf(stderr, \"Unexpected error %d when registering adapter %d\\n\",\nVAR_5, *VAR_4);", "}", "out:\nreturn VAR_5;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67, 69 ], [ 71 ], [ 73, 75 ], [ 77 ] ]
15,019
static int ppce500_load_device_tree(CPUPPCState *env, QEMUMachineInitArgs *args, PPCE500Params *params, hwaddr addr, hwaddr initrd_base, hwaddr initrd_size) { int ret = -1; uint64_t mem_reg_property[] = { 0, cpu_to_be64(args->ram_size) }; int fdt_size; void *fdt; uint8_t hypercall[16]; uint32_t clock_freq = 400000000; uint32_t tb_freq = 400000000; int i; char compatible_sb[] = "fsl,mpc8544-immr\0simple-bus"; char soc[128]; char mpic[128]; uint32_t mpic_ph; uint32_t msi_ph; char gutil[128]; char pci[128]; char msi[128]; uint32_t *pci_map = NULL; int len; uint32_t pci_ranges[14] = { 0x2000000, 0x0, 0xc0000000, 0x0, 0xc0000000, 0x0, 0x20000000, 0x1000000, 0x0, 0x0, 0x0, 0xe1000000, 0x0, 0x10000, }; QemuOpts *machine_opts = qemu_get_machine_opts(); const char *dtb_file = qemu_opt_get(machine_opts, "dtb"); const char *toplevel_compat = qemu_opt_get(machine_opts, "dt_compatible"); if (dtb_file) { char *filename; filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, dtb_file); if (!filename) { goto out; } fdt = load_device_tree(filename, &fdt_size); if (!fdt) { goto out; } goto done; } fdt = create_device_tree(&fdt_size); if (fdt == NULL) { goto out; } /* Manipulate device tree in memory. */ qemu_devtree_setprop_cell(fdt, "/", "#address-cells", 2); qemu_devtree_setprop_cell(fdt, "/", "#size-cells", 2); qemu_devtree_add_subnode(fdt, "/memory"); qemu_devtree_setprop_string(fdt, "/memory", "device_type", "memory"); qemu_devtree_setprop(fdt, "/memory", "reg", mem_reg_property, sizeof(mem_reg_property)); qemu_devtree_add_subnode(fdt, "/chosen"); if (initrd_size) { ret = qemu_devtree_setprop_cell(fdt, "/chosen", "linux,initrd-start", initrd_base); if (ret < 0) { fprintf(stderr, "couldn't set /chosen/linux,initrd-start\n"); } ret = qemu_devtree_setprop_cell(fdt, "/chosen", "linux,initrd-end", (initrd_base + initrd_size)); if (ret < 0) { fprintf(stderr, "couldn't set /chosen/linux,initrd-end\n"); } } ret = qemu_devtree_setprop_string(fdt, "/chosen", "bootargs", args->kernel_cmdline); if (ret < 0) fprintf(stderr, "couldn't set /chosen/bootargs\n"); if (kvm_enabled()) { /* Read out host's frequencies */ clock_freq = kvmppc_get_clockfreq(); tb_freq = kvmppc_get_tbfreq(); /* indicate KVM hypercall interface */ qemu_devtree_add_subnode(fdt, "/hypervisor"); qemu_devtree_setprop_string(fdt, "/hypervisor", "compatible", "linux,kvm"); kvmppc_get_hypercall(env, hypercall, sizeof(hypercall)); qemu_devtree_setprop(fdt, "/hypervisor", "hcall-instructions", hypercall, sizeof(hypercall)); /* if KVM supports the idle hcall, set property indicating this */ if (kvmppc_get_hasidle(env)) { qemu_devtree_setprop(fdt, "/hypervisor", "has-idle", NULL, 0); } } /* Create CPU nodes */ qemu_devtree_add_subnode(fdt, "/cpus"); qemu_devtree_setprop_cell(fdt, "/cpus", "#address-cells", 1); qemu_devtree_setprop_cell(fdt, "/cpus", "#size-cells", 0); /* We need to generate the cpu nodes in reverse order, so Linux can pick the first node as boot node and be happy */ for (i = smp_cpus - 1; i >= 0; i--) { CPUState *cpu; char cpu_name[128]; uint64_t cpu_release_addr = MPC8544_SPIN_BASE + (i * 0x20); cpu = qemu_get_cpu(i); if (cpu == NULL) { continue; } env = cpu->env_ptr; snprintf(cpu_name, sizeof(cpu_name), "/cpus/PowerPC,8544@%x", cpu->cpu_index); qemu_devtree_add_subnode(fdt, cpu_name); qemu_devtree_setprop_cell(fdt, cpu_name, "clock-frequency", clock_freq); qemu_devtree_setprop_cell(fdt, cpu_name, "timebase-frequency", tb_freq); qemu_devtree_setprop_string(fdt, cpu_name, "device_type", "cpu"); qemu_devtree_setprop_cell(fdt, cpu_name, "reg", cpu->cpu_index); qemu_devtree_setprop_cell(fdt, cpu_name, "d-cache-line-size", env->dcache_line_size); qemu_devtree_setprop_cell(fdt, cpu_name, "i-cache-line-size", env->icache_line_size); qemu_devtree_setprop_cell(fdt, cpu_name, "d-cache-size", 0x8000); qemu_devtree_setprop_cell(fdt, cpu_name, "i-cache-size", 0x8000); qemu_devtree_setprop_cell(fdt, cpu_name, "bus-frequency", 0); if (cpu->cpu_index) { qemu_devtree_setprop_string(fdt, cpu_name, "status", "disabled"); qemu_devtree_setprop_string(fdt, cpu_name, "enable-method", "spin-table"); qemu_devtree_setprop_u64(fdt, cpu_name, "cpu-release-addr", cpu_release_addr); } else { qemu_devtree_setprop_string(fdt, cpu_name, "status", "okay"); } } qemu_devtree_add_subnode(fdt, "/aliases"); /* XXX These should go into their respective devices' code */ snprintf(soc, sizeof(soc), "/soc@%llx", MPC8544_CCSRBAR_BASE); qemu_devtree_add_subnode(fdt, soc); qemu_devtree_setprop_string(fdt, soc, "device_type", "soc"); qemu_devtree_setprop(fdt, soc, "compatible", compatible_sb, sizeof(compatible_sb)); qemu_devtree_setprop_cell(fdt, soc, "#address-cells", 1); qemu_devtree_setprop_cell(fdt, soc, "#size-cells", 1); qemu_devtree_setprop_cells(fdt, soc, "ranges", 0x0, MPC8544_CCSRBAR_BASE >> 32, MPC8544_CCSRBAR_BASE, MPC8544_CCSRBAR_SIZE); /* XXX should contain a reasonable value */ qemu_devtree_setprop_cell(fdt, soc, "bus-frequency", 0); snprintf(mpic, sizeof(mpic), "%s/pic@%llx", soc, MPC8544_MPIC_REGS_OFFSET); qemu_devtree_add_subnode(fdt, mpic); qemu_devtree_setprop_string(fdt, mpic, "device_type", "open-pic"); qemu_devtree_setprop_string(fdt, mpic, "compatible", "fsl,mpic"); qemu_devtree_setprop_cells(fdt, mpic, "reg", MPC8544_MPIC_REGS_OFFSET, 0x40000); qemu_devtree_setprop_cell(fdt, mpic, "#address-cells", 0); qemu_devtree_setprop_cell(fdt, mpic, "#interrupt-cells", 2); mpic_ph = qemu_devtree_alloc_phandle(fdt); qemu_devtree_setprop_cell(fdt, mpic, "phandle", mpic_ph); qemu_devtree_setprop_cell(fdt, mpic, "linux,phandle", mpic_ph); qemu_devtree_setprop(fdt, mpic, "interrupt-controller", NULL, 0); /* * We have to generate ser1 first, because Linux takes the first * device it finds in the dt as serial output device. And we generate * devices in reverse order to the dt. */ dt_serial_create(fdt, MPC8544_SERIAL1_REGS_OFFSET, soc, mpic, "serial1", 1, false); dt_serial_create(fdt, MPC8544_SERIAL0_REGS_OFFSET, soc, mpic, "serial0", 0, true); snprintf(gutil, sizeof(gutil), "%s/global-utilities@%llx", soc, MPC8544_UTIL_OFFSET); qemu_devtree_add_subnode(fdt, gutil); qemu_devtree_setprop_string(fdt, gutil, "compatible", "fsl,mpc8544-guts"); qemu_devtree_setprop_cells(fdt, gutil, "reg", MPC8544_UTIL_OFFSET, 0x1000); qemu_devtree_setprop(fdt, gutil, "fsl,has-rstcr", NULL, 0); snprintf(msi, sizeof(msi), "/%s/msi@%llx", soc, MPC8544_MSI_REGS_OFFSET); qemu_devtree_add_subnode(fdt, msi); qemu_devtree_setprop_string(fdt, msi, "compatible", "fsl,mpic-msi"); qemu_devtree_setprop_cells(fdt, msi, "reg", MPC8544_MSI_REGS_OFFSET, 0x200); msi_ph = qemu_devtree_alloc_phandle(fdt); qemu_devtree_setprop_cells(fdt, msi, "msi-available-ranges", 0x0, 0x100); qemu_devtree_setprop_phandle(fdt, msi, "interrupt-parent", mpic); qemu_devtree_setprop_cells(fdt, msi, "interrupts", 0xe0, 0x0, 0xe1, 0x0, 0xe2, 0x0, 0xe3, 0x0, 0xe4, 0x0, 0xe5, 0x0, 0xe6, 0x0, 0xe7, 0x0); qemu_devtree_setprop_cell(fdt, msi, "phandle", msi_ph); qemu_devtree_setprop_cell(fdt, msi, "linux,phandle", msi_ph); snprintf(pci, sizeof(pci), "/pci@%llx", MPC8544_PCI_REGS_BASE); qemu_devtree_add_subnode(fdt, pci); qemu_devtree_setprop_cell(fdt, pci, "cell-index", 0); qemu_devtree_setprop_string(fdt, pci, "compatible", "fsl,mpc8540-pci"); qemu_devtree_setprop_string(fdt, pci, "device_type", "pci"); qemu_devtree_setprop_cells(fdt, pci, "interrupt-map-mask", 0xf800, 0x0, 0x0, 0x7); pci_map = pci_map_create(fdt, qemu_devtree_get_phandle(fdt, mpic), params->pci_first_slot, params->pci_nr_slots, &len); qemu_devtree_setprop(fdt, pci, "interrupt-map", pci_map, len); qemu_devtree_setprop_phandle(fdt, pci, "interrupt-parent", mpic); qemu_devtree_setprop_cells(fdt, pci, "interrupts", 24, 2); qemu_devtree_setprop_cells(fdt, pci, "bus-range", 0, 255); for (i = 0; i < 14; i++) { pci_ranges[i] = cpu_to_be32(pci_ranges[i]); } qemu_devtree_setprop_cell(fdt, pci, "fsl,msi", msi_ph); qemu_devtree_setprop(fdt, pci, "ranges", pci_ranges, sizeof(pci_ranges)); qemu_devtree_setprop_cells(fdt, pci, "reg", MPC8544_PCI_REGS_BASE >> 32, MPC8544_PCI_REGS_BASE, 0, 0x1000); qemu_devtree_setprop_cell(fdt, pci, "clock-frequency", 66666666); qemu_devtree_setprop_cell(fdt, pci, "#interrupt-cells", 1); qemu_devtree_setprop_cell(fdt, pci, "#size-cells", 2); qemu_devtree_setprop_cell(fdt, pci, "#address-cells", 3); qemu_devtree_setprop_string(fdt, "/aliases", "pci0", pci); params->fixup_devtree(params, fdt); if (toplevel_compat) { qemu_devtree_setprop(fdt, "/", "compatible", toplevel_compat, strlen(toplevel_compat) + 1); } done: qemu_devtree_dumpdtb(fdt, fdt_size); ret = rom_add_blob_fixed(BINARY_DEVICE_TREE_FILE, fdt, fdt_size, addr); if (ret < 0) { goto out; } g_free(fdt); ret = fdt_size; out: g_free(pci_map); return ret; }
false
qemu
28290f37e20cda27574f15be9e9499493e3d0fe8
static int ppce500_load_device_tree(CPUPPCState *env, QEMUMachineInitArgs *args, PPCE500Params *params, hwaddr addr, hwaddr initrd_base, hwaddr initrd_size) { int ret = -1; uint64_t mem_reg_property[] = { 0, cpu_to_be64(args->ram_size) }; int fdt_size; void *fdt; uint8_t hypercall[16]; uint32_t clock_freq = 400000000; uint32_t tb_freq = 400000000; int i; char compatible_sb[] = "fsl,mpc8544-immr\0simple-bus"; char soc[128]; char mpic[128]; uint32_t mpic_ph; uint32_t msi_ph; char gutil[128]; char pci[128]; char msi[128]; uint32_t *pci_map = NULL; int len; uint32_t pci_ranges[14] = { 0x2000000, 0x0, 0xc0000000, 0x0, 0xc0000000, 0x0, 0x20000000, 0x1000000, 0x0, 0x0, 0x0, 0xe1000000, 0x0, 0x10000, }; QemuOpts *machine_opts = qemu_get_machine_opts(); const char *dtb_file = qemu_opt_get(machine_opts, "dtb"); const char *toplevel_compat = qemu_opt_get(machine_opts, "dt_compatible"); if (dtb_file) { char *filename; filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, dtb_file); if (!filename) { goto out; } fdt = load_device_tree(filename, &fdt_size); if (!fdt) { goto out; } goto done; } fdt = create_device_tree(&fdt_size); if (fdt == NULL) { goto out; } qemu_devtree_setprop_cell(fdt, "/", "#address-cells", 2); qemu_devtree_setprop_cell(fdt, "/", "#size-cells", 2); qemu_devtree_add_subnode(fdt, "/memory"); qemu_devtree_setprop_string(fdt, "/memory", "device_type", "memory"); qemu_devtree_setprop(fdt, "/memory", "reg", mem_reg_property, sizeof(mem_reg_property)); qemu_devtree_add_subnode(fdt, "/chosen"); if (initrd_size) { ret = qemu_devtree_setprop_cell(fdt, "/chosen", "linux,initrd-start", initrd_base); if (ret < 0) { fprintf(stderr, "couldn't set /chosen/linux,initrd-start\n"); } ret = qemu_devtree_setprop_cell(fdt, "/chosen", "linux,initrd-end", (initrd_base + initrd_size)); if (ret < 0) { fprintf(stderr, "couldn't set /chosen/linux,initrd-end\n"); } } ret = qemu_devtree_setprop_string(fdt, "/chosen", "bootargs", args->kernel_cmdline); if (ret < 0) fprintf(stderr, "couldn't set /chosen/bootargs\n"); if (kvm_enabled()) { clock_freq = kvmppc_get_clockfreq(); tb_freq = kvmppc_get_tbfreq(); qemu_devtree_add_subnode(fdt, "/hypervisor"); qemu_devtree_setprop_string(fdt, "/hypervisor", "compatible", "linux,kvm"); kvmppc_get_hypercall(env, hypercall, sizeof(hypercall)); qemu_devtree_setprop(fdt, "/hypervisor", "hcall-instructions", hypercall, sizeof(hypercall)); if (kvmppc_get_hasidle(env)) { qemu_devtree_setprop(fdt, "/hypervisor", "has-idle", NULL, 0); } } qemu_devtree_add_subnode(fdt, "/cpus"); qemu_devtree_setprop_cell(fdt, "/cpus", "#address-cells", 1); qemu_devtree_setprop_cell(fdt, "/cpus", "#size-cells", 0); for (i = smp_cpus - 1; i >= 0; i--) { CPUState *cpu; char cpu_name[128]; uint64_t cpu_release_addr = MPC8544_SPIN_BASE + (i * 0x20); cpu = qemu_get_cpu(i); if (cpu == NULL) { continue; } env = cpu->env_ptr; snprintf(cpu_name, sizeof(cpu_name), "/cpus/PowerPC,8544@%x", cpu->cpu_index); qemu_devtree_add_subnode(fdt, cpu_name); qemu_devtree_setprop_cell(fdt, cpu_name, "clock-frequency", clock_freq); qemu_devtree_setprop_cell(fdt, cpu_name, "timebase-frequency", tb_freq); qemu_devtree_setprop_string(fdt, cpu_name, "device_type", "cpu"); qemu_devtree_setprop_cell(fdt, cpu_name, "reg", cpu->cpu_index); qemu_devtree_setprop_cell(fdt, cpu_name, "d-cache-line-size", env->dcache_line_size); qemu_devtree_setprop_cell(fdt, cpu_name, "i-cache-line-size", env->icache_line_size); qemu_devtree_setprop_cell(fdt, cpu_name, "d-cache-size", 0x8000); qemu_devtree_setprop_cell(fdt, cpu_name, "i-cache-size", 0x8000); qemu_devtree_setprop_cell(fdt, cpu_name, "bus-frequency", 0); if (cpu->cpu_index) { qemu_devtree_setprop_string(fdt, cpu_name, "status", "disabled"); qemu_devtree_setprop_string(fdt, cpu_name, "enable-method", "spin-table"); qemu_devtree_setprop_u64(fdt, cpu_name, "cpu-release-addr", cpu_release_addr); } else { qemu_devtree_setprop_string(fdt, cpu_name, "status", "okay"); } } qemu_devtree_add_subnode(fdt, "/aliases"); snprintf(soc, sizeof(soc), "/soc@%llx", MPC8544_CCSRBAR_BASE); qemu_devtree_add_subnode(fdt, soc); qemu_devtree_setprop_string(fdt, soc, "device_type", "soc"); qemu_devtree_setprop(fdt, soc, "compatible", compatible_sb, sizeof(compatible_sb)); qemu_devtree_setprop_cell(fdt, soc, "#address-cells", 1); qemu_devtree_setprop_cell(fdt, soc, "#size-cells", 1); qemu_devtree_setprop_cells(fdt, soc, "ranges", 0x0, MPC8544_CCSRBAR_BASE >> 32, MPC8544_CCSRBAR_BASE, MPC8544_CCSRBAR_SIZE); qemu_devtree_setprop_cell(fdt, soc, "bus-frequency", 0); snprintf(mpic, sizeof(mpic), "%s/pic@%llx", soc, MPC8544_MPIC_REGS_OFFSET); qemu_devtree_add_subnode(fdt, mpic); qemu_devtree_setprop_string(fdt, mpic, "device_type", "open-pic"); qemu_devtree_setprop_string(fdt, mpic, "compatible", "fsl,mpic"); qemu_devtree_setprop_cells(fdt, mpic, "reg", MPC8544_MPIC_REGS_OFFSET, 0x40000); qemu_devtree_setprop_cell(fdt, mpic, "#address-cells", 0); qemu_devtree_setprop_cell(fdt, mpic, "#interrupt-cells", 2); mpic_ph = qemu_devtree_alloc_phandle(fdt); qemu_devtree_setprop_cell(fdt, mpic, "phandle", mpic_ph); qemu_devtree_setprop_cell(fdt, mpic, "linux,phandle", mpic_ph); qemu_devtree_setprop(fdt, mpic, "interrupt-controller", NULL, 0); dt_serial_create(fdt, MPC8544_SERIAL1_REGS_OFFSET, soc, mpic, "serial1", 1, false); dt_serial_create(fdt, MPC8544_SERIAL0_REGS_OFFSET, soc, mpic, "serial0", 0, true); snprintf(gutil, sizeof(gutil), "%s/global-utilities@%llx", soc, MPC8544_UTIL_OFFSET); qemu_devtree_add_subnode(fdt, gutil); qemu_devtree_setprop_string(fdt, gutil, "compatible", "fsl,mpc8544-guts"); qemu_devtree_setprop_cells(fdt, gutil, "reg", MPC8544_UTIL_OFFSET, 0x1000); qemu_devtree_setprop(fdt, gutil, "fsl,has-rstcr", NULL, 0); snprintf(msi, sizeof(msi), "/%s/msi@%llx", soc, MPC8544_MSI_REGS_OFFSET); qemu_devtree_add_subnode(fdt, msi); qemu_devtree_setprop_string(fdt, msi, "compatible", "fsl,mpic-msi"); qemu_devtree_setprop_cells(fdt, msi, "reg", MPC8544_MSI_REGS_OFFSET, 0x200); msi_ph = qemu_devtree_alloc_phandle(fdt); qemu_devtree_setprop_cells(fdt, msi, "msi-available-ranges", 0x0, 0x100); qemu_devtree_setprop_phandle(fdt, msi, "interrupt-parent", mpic); qemu_devtree_setprop_cells(fdt, msi, "interrupts", 0xe0, 0x0, 0xe1, 0x0, 0xe2, 0x0, 0xe3, 0x0, 0xe4, 0x0, 0xe5, 0x0, 0xe6, 0x0, 0xe7, 0x0); qemu_devtree_setprop_cell(fdt, msi, "phandle", msi_ph); qemu_devtree_setprop_cell(fdt, msi, "linux,phandle", msi_ph); snprintf(pci, sizeof(pci), "/pci@%llx", MPC8544_PCI_REGS_BASE); qemu_devtree_add_subnode(fdt, pci); qemu_devtree_setprop_cell(fdt, pci, "cell-index", 0); qemu_devtree_setprop_string(fdt, pci, "compatible", "fsl,mpc8540-pci"); qemu_devtree_setprop_string(fdt, pci, "device_type", "pci"); qemu_devtree_setprop_cells(fdt, pci, "interrupt-map-mask", 0xf800, 0x0, 0x0, 0x7); pci_map = pci_map_create(fdt, qemu_devtree_get_phandle(fdt, mpic), params->pci_first_slot, params->pci_nr_slots, &len); qemu_devtree_setprop(fdt, pci, "interrupt-map", pci_map, len); qemu_devtree_setprop_phandle(fdt, pci, "interrupt-parent", mpic); qemu_devtree_setprop_cells(fdt, pci, "interrupts", 24, 2); qemu_devtree_setprop_cells(fdt, pci, "bus-range", 0, 255); for (i = 0; i < 14; i++) { pci_ranges[i] = cpu_to_be32(pci_ranges[i]); } qemu_devtree_setprop_cell(fdt, pci, "fsl,msi", msi_ph); qemu_devtree_setprop(fdt, pci, "ranges", pci_ranges, sizeof(pci_ranges)); qemu_devtree_setprop_cells(fdt, pci, "reg", MPC8544_PCI_REGS_BASE >> 32, MPC8544_PCI_REGS_BASE, 0, 0x1000); qemu_devtree_setprop_cell(fdt, pci, "clock-frequency", 66666666); qemu_devtree_setprop_cell(fdt, pci, "#interrupt-cells", 1); qemu_devtree_setprop_cell(fdt, pci, "#size-cells", 2); qemu_devtree_setprop_cell(fdt, pci, "#address-cells", 3); qemu_devtree_setprop_string(fdt, "/aliases", "pci0", pci); params->fixup_devtree(params, fdt); if (toplevel_compat) { qemu_devtree_setprop(fdt, "/", "compatible", toplevel_compat, strlen(toplevel_compat) + 1); } done: qemu_devtree_dumpdtb(fdt, fdt_size); ret = rom_add_blob_fixed(BINARY_DEVICE_TREE_FILE, fdt, fdt_size, addr); if (ret < 0) { goto out; } g_free(fdt); ret = fdt_size; out: g_free(pci_map); return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(CPUPPCState *VAR_0, QEMUMachineInitArgs *VAR_1, PPCE500Params *VAR_2, hwaddr VAR_3, hwaddr VAR_4, hwaddr VAR_5) { int VAR_6 = -1; uint64_t mem_reg_property[] = { 0, cpu_to_be64(VAR_1->ram_size) }; int VAR_7; void *VAR_8; uint8_t hypercall[16]; uint32_t clock_freq = 400000000; uint32_t tb_freq = 400000000; int VAR_9; char VAR_10[] = "fsl,mpc8544-immr\0simple-bus"; char VAR_11[128]; char VAR_12[128]; uint32_t mpic_ph; uint32_t msi_ph; char VAR_13[128]; char VAR_14[128]; char VAR_15[128]; uint32_t *pci_map = NULL; int VAR_16; uint32_t pci_ranges[14] = { 0x2000000, 0x0, 0xc0000000, 0x0, 0xc0000000, 0x0, 0x20000000, 0x1000000, 0x0, 0x0, 0x0, 0xe1000000, 0x0, 0x10000, }; QemuOpts *machine_opts = qemu_get_machine_opts(); const char *VAR_17 = qemu_opt_get(machine_opts, "dtb"); const char *VAR_18 = qemu_opt_get(machine_opts, "dt_compatible"); if (VAR_17) { char *VAR_19; VAR_19 = qemu_find_file(QEMU_FILE_TYPE_BIOS, VAR_17); if (!VAR_19) { goto out; } VAR_8 = load_device_tree(VAR_19, &VAR_7); if (!VAR_8) { goto out; } goto done; } VAR_8 = create_device_tree(&VAR_7); if (VAR_8 == NULL) { goto out; } qemu_devtree_setprop_cell(VAR_8, "/", "#address-cells", 2); qemu_devtree_setprop_cell(VAR_8, "/", "#size-cells", 2); qemu_devtree_add_subnode(VAR_8, "/memory"); qemu_devtree_setprop_string(VAR_8, "/memory", "device_type", "memory"); qemu_devtree_setprop(VAR_8, "/memory", "reg", mem_reg_property, sizeof(mem_reg_property)); qemu_devtree_add_subnode(VAR_8, "/chosen"); if (VAR_5) { VAR_6 = qemu_devtree_setprop_cell(VAR_8, "/chosen", "linux,initrd-start", VAR_4); if (VAR_6 < 0) { fprintf(stderr, "couldn't set /chosen/linux,initrd-start\n"); } VAR_6 = qemu_devtree_setprop_cell(VAR_8, "/chosen", "linux,initrd-end", (VAR_4 + VAR_5)); if (VAR_6 < 0) { fprintf(stderr, "couldn't set /chosen/linux,initrd-end\n"); } } VAR_6 = qemu_devtree_setprop_string(VAR_8, "/chosen", "bootargs", VAR_1->kernel_cmdline); if (VAR_6 < 0) fprintf(stderr, "couldn't set /chosen/bootargs\n"); if (kvm_enabled()) { clock_freq = kvmppc_get_clockfreq(); tb_freq = kvmppc_get_tbfreq(); qemu_devtree_add_subnode(VAR_8, "/hypervisor"); qemu_devtree_setprop_string(VAR_8, "/hypervisor", "compatible", "linux,kvm"); kvmppc_get_hypercall(VAR_0, hypercall, sizeof(hypercall)); qemu_devtree_setprop(VAR_8, "/hypervisor", "hcall-instructions", hypercall, sizeof(hypercall)); if (kvmppc_get_hasidle(VAR_0)) { qemu_devtree_setprop(VAR_8, "/hypervisor", "has-idle", NULL, 0); } } qemu_devtree_add_subnode(VAR_8, "/cpus"); qemu_devtree_setprop_cell(VAR_8, "/cpus", "#address-cells", 1); qemu_devtree_setprop_cell(VAR_8, "/cpus", "#size-cells", 0); for (VAR_9 = smp_cpus - 1; VAR_9 >= 0; VAR_9--) { CPUState *cpu; char VAR_20[128]; uint64_t cpu_release_addr = MPC8544_SPIN_BASE + (VAR_9 * 0x20); cpu = qemu_get_cpu(VAR_9); if (cpu == NULL) { continue; } VAR_0 = cpu->env_ptr; snprintf(VAR_20, sizeof(VAR_20), "/cpus/PowerPC,8544@%x", cpu->cpu_index); qemu_devtree_add_subnode(VAR_8, VAR_20); qemu_devtree_setprop_cell(VAR_8, VAR_20, "clock-frequency", clock_freq); qemu_devtree_setprop_cell(VAR_8, VAR_20, "timebase-frequency", tb_freq); qemu_devtree_setprop_string(VAR_8, VAR_20, "device_type", "cpu"); qemu_devtree_setprop_cell(VAR_8, VAR_20, "reg", cpu->cpu_index); qemu_devtree_setprop_cell(VAR_8, VAR_20, "d-cache-line-size", VAR_0->dcache_line_size); qemu_devtree_setprop_cell(VAR_8, VAR_20, "VAR_9-cache-line-size", VAR_0->icache_line_size); qemu_devtree_setprop_cell(VAR_8, VAR_20, "d-cache-size", 0x8000); qemu_devtree_setprop_cell(VAR_8, VAR_20, "VAR_9-cache-size", 0x8000); qemu_devtree_setprop_cell(VAR_8, VAR_20, "bus-frequency", 0); if (cpu->cpu_index) { qemu_devtree_setprop_string(VAR_8, VAR_20, "status", "disabled"); qemu_devtree_setprop_string(VAR_8, VAR_20, "enable-method", "spin-table"); qemu_devtree_setprop_u64(VAR_8, VAR_20, "cpu-release-VAR_3", cpu_release_addr); } else { qemu_devtree_setprop_string(VAR_8, VAR_20, "status", "okay"); } } qemu_devtree_add_subnode(VAR_8, "/aliases"); snprintf(VAR_11, sizeof(VAR_11), "/VAR_11@%llx", MPC8544_CCSRBAR_BASE); qemu_devtree_add_subnode(VAR_8, VAR_11); qemu_devtree_setprop_string(VAR_8, VAR_11, "device_type", "VAR_11"); qemu_devtree_setprop(VAR_8, VAR_11, "compatible", VAR_10, sizeof(VAR_10)); qemu_devtree_setprop_cell(VAR_8, VAR_11, "#address-cells", 1); qemu_devtree_setprop_cell(VAR_8, VAR_11, "#size-cells", 1); qemu_devtree_setprop_cells(VAR_8, VAR_11, "ranges", 0x0, MPC8544_CCSRBAR_BASE >> 32, MPC8544_CCSRBAR_BASE, MPC8544_CCSRBAR_SIZE); qemu_devtree_setprop_cell(VAR_8, VAR_11, "bus-frequency", 0); snprintf(VAR_12, sizeof(VAR_12), "%s/pic@%llx", VAR_11, MPC8544_MPIC_REGS_OFFSET); qemu_devtree_add_subnode(VAR_8, VAR_12); qemu_devtree_setprop_string(VAR_8, VAR_12, "device_type", "open-pic"); qemu_devtree_setprop_string(VAR_8, VAR_12, "compatible", "fsl,VAR_12"); qemu_devtree_setprop_cells(VAR_8, VAR_12, "reg", MPC8544_MPIC_REGS_OFFSET, 0x40000); qemu_devtree_setprop_cell(VAR_8, VAR_12, "#address-cells", 0); qemu_devtree_setprop_cell(VAR_8, VAR_12, "#interrupt-cells", 2); mpic_ph = qemu_devtree_alloc_phandle(VAR_8); qemu_devtree_setprop_cell(VAR_8, VAR_12, "phandle", mpic_ph); qemu_devtree_setprop_cell(VAR_8, VAR_12, "linux,phandle", mpic_ph); qemu_devtree_setprop(VAR_8, VAR_12, "interrupt-controller", NULL, 0); dt_serial_create(VAR_8, MPC8544_SERIAL1_REGS_OFFSET, VAR_11, VAR_12, "serial1", 1, false); dt_serial_create(VAR_8, MPC8544_SERIAL0_REGS_OFFSET, VAR_11, VAR_12, "serial0", 0, true); snprintf(VAR_13, sizeof(VAR_13), "%s/global-utilities@%llx", VAR_11, MPC8544_UTIL_OFFSET); qemu_devtree_add_subnode(VAR_8, VAR_13); qemu_devtree_setprop_string(VAR_8, VAR_13, "compatible", "fsl,mpc8544-guts"); qemu_devtree_setprop_cells(VAR_8, VAR_13, "reg", MPC8544_UTIL_OFFSET, 0x1000); qemu_devtree_setprop(VAR_8, VAR_13, "fsl,has-rstcr", NULL, 0); snprintf(VAR_15, sizeof(VAR_15), "/%s/VAR_15@%llx", VAR_11, MPC8544_MSI_REGS_OFFSET); qemu_devtree_add_subnode(VAR_8, VAR_15); qemu_devtree_setprop_string(VAR_8, VAR_15, "compatible", "fsl,VAR_12-VAR_15"); qemu_devtree_setprop_cells(VAR_8, VAR_15, "reg", MPC8544_MSI_REGS_OFFSET, 0x200); msi_ph = qemu_devtree_alloc_phandle(VAR_8); qemu_devtree_setprop_cells(VAR_8, VAR_15, "VAR_15-available-ranges", 0x0, 0x100); qemu_devtree_setprop_phandle(VAR_8, VAR_15, "interrupt-parent", VAR_12); qemu_devtree_setprop_cells(VAR_8, VAR_15, "interrupts", 0xe0, 0x0, 0xe1, 0x0, 0xe2, 0x0, 0xe3, 0x0, 0xe4, 0x0, 0xe5, 0x0, 0xe6, 0x0, 0xe7, 0x0); qemu_devtree_setprop_cell(VAR_8, VAR_15, "phandle", msi_ph); qemu_devtree_setprop_cell(VAR_8, VAR_15, "linux,phandle", msi_ph); snprintf(VAR_14, sizeof(VAR_14), "/VAR_14@%llx", MPC8544_PCI_REGS_BASE); qemu_devtree_add_subnode(VAR_8, VAR_14); qemu_devtree_setprop_cell(VAR_8, VAR_14, "cell-index", 0); qemu_devtree_setprop_string(VAR_8, VAR_14, "compatible", "fsl,mpc8540-VAR_14"); qemu_devtree_setprop_string(VAR_8, VAR_14, "device_type", "VAR_14"); qemu_devtree_setprop_cells(VAR_8, VAR_14, "interrupt-map-mask", 0xf800, 0x0, 0x0, 0x7); pci_map = pci_map_create(VAR_8, qemu_devtree_get_phandle(VAR_8, VAR_12), VAR_2->pci_first_slot, VAR_2->pci_nr_slots, &VAR_16); qemu_devtree_setprop(VAR_8, VAR_14, "interrupt-map", pci_map, VAR_16); qemu_devtree_setprop_phandle(VAR_8, VAR_14, "interrupt-parent", VAR_12); qemu_devtree_setprop_cells(VAR_8, VAR_14, "interrupts", 24, 2); qemu_devtree_setprop_cells(VAR_8, VAR_14, "bus-range", 0, 255); for (VAR_9 = 0; VAR_9 < 14; VAR_9++) { pci_ranges[VAR_9] = cpu_to_be32(pci_ranges[VAR_9]); } qemu_devtree_setprop_cell(VAR_8, VAR_14, "fsl,VAR_15", msi_ph); qemu_devtree_setprop(VAR_8, VAR_14, "ranges", pci_ranges, sizeof(pci_ranges)); qemu_devtree_setprop_cells(VAR_8, VAR_14, "reg", MPC8544_PCI_REGS_BASE >> 32, MPC8544_PCI_REGS_BASE, 0, 0x1000); qemu_devtree_setprop_cell(VAR_8, VAR_14, "clock-frequency", 66666666); qemu_devtree_setprop_cell(VAR_8, VAR_14, "#interrupt-cells", 1); qemu_devtree_setprop_cell(VAR_8, VAR_14, "#size-cells", 2); qemu_devtree_setprop_cell(VAR_8, VAR_14, "#address-cells", 3); qemu_devtree_setprop_string(VAR_8, "/aliases", "pci0", VAR_14); VAR_2->fixup_devtree(VAR_2, VAR_8); if (VAR_18) { qemu_devtree_setprop(VAR_8, "/", "compatible", VAR_18, strlen(VAR_18) + 1); } done: qemu_devtree_dumpdtb(VAR_8, VAR_7); VAR_6 = rom_add_blob_fixed(BINARY_DEVICE_TREE_FILE, VAR_8, VAR_7, VAR_3); if (VAR_6 < 0) { goto out; } g_free(VAR_8); VAR_6 = VAR_7; out: g_free(pci_map); return VAR_6; }
[ "static int FUNC_0(CPUPPCState *VAR_0,\nQEMUMachineInitArgs *VAR_1,\nPPCE500Params *VAR_2,\nhwaddr VAR_3,\nhwaddr VAR_4,\nhwaddr VAR_5)\n{", "int VAR_6 = -1;", "uint64_t mem_reg_property[] = { 0, cpu_to_be64(VAR_1->ram_size) };", "int VAR_7;", "void *VAR_8;", "uint8_t hypercall[16];", "uint32_t clock_freq = 400000000;", "uint32_t tb_freq = 400000000;", "int VAR_9;", "char VAR_10[] = \"fsl,mpc8544-immr\\0simple-bus\";", "char VAR_11[128];", "char VAR_12[128];", "uint32_t mpic_ph;", "uint32_t msi_ph;", "char VAR_13[128];", "char VAR_14[128];", "char VAR_15[128];", "uint32_t *pci_map = NULL;", "int VAR_16;", "uint32_t pci_ranges[14] =\n{", "0x2000000, 0x0, 0xc0000000,\n0x0, 0xc0000000,\n0x0, 0x20000000,\n0x1000000, 0x0, 0x0,\n0x0, 0xe1000000,\n0x0, 0x10000,\n};", "QemuOpts *machine_opts = qemu_get_machine_opts();", "const char *VAR_17 = qemu_opt_get(machine_opts, \"dtb\");", "const char *VAR_18 = qemu_opt_get(machine_opts, \"dt_compatible\");", "if (VAR_17) {", "char *VAR_19;", "VAR_19 = qemu_find_file(QEMU_FILE_TYPE_BIOS, VAR_17);", "if (!VAR_19) {", "goto out;", "}", "VAR_8 = load_device_tree(VAR_19, &VAR_7);", "if (!VAR_8) {", "goto out;", "}", "goto done;", "}", "VAR_8 = create_device_tree(&VAR_7);", "if (VAR_8 == NULL) {", "goto out;", "}", "qemu_devtree_setprop_cell(VAR_8, \"/\", \"#address-cells\", 2);", "qemu_devtree_setprop_cell(VAR_8, \"/\", \"#size-cells\", 2);", "qemu_devtree_add_subnode(VAR_8, \"/memory\");", "qemu_devtree_setprop_string(VAR_8, \"/memory\", \"device_type\", \"memory\");", "qemu_devtree_setprop(VAR_8, \"/memory\", \"reg\", mem_reg_property,\nsizeof(mem_reg_property));", "qemu_devtree_add_subnode(VAR_8, \"/chosen\");", "if (VAR_5) {", "VAR_6 = qemu_devtree_setprop_cell(VAR_8, \"/chosen\", \"linux,initrd-start\",\nVAR_4);", "if (VAR_6 < 0) {", "fprintf(stderr, \"couldn't set /chosen/linux,initrd-start\\n\");", "}", "VAR_6 = qemu_devtree_setprop_cell(VAR_8, \"/chosen\", \"linux,initrd-end\",\n(VAR_4 + VAR_5));", "if (VAR_6 < 0) {", "fprintf(stderr, \"couldn't set /chosen/linux,initrd-end\\n\");", "}", "}", "VAR_6 = qemu_devtree_setprop_string(VAR_8, \"/chosen\", \"bootargs\",\nVAR_1->kernel_cmdline);", "if (VAR_6 < 0)\nfprintf(stderr, \"couldn't set /chosen/bootargs\\n\");", "if (kvm_enabled()) {", "clock_freq = kvmppc_get_clockfreq();", "tb_freq = kvmppc_get_tbfreq();", "qemu_devtree_add_subnode(VAR_8, \"/hypervisor\");", "qemu_devtree_setprop_string(VAR_8, \"/hypervisor\", \"compatible\",\n\"linux,kvm\");", "kvmppc_get_hypercall(VAR_0, hypercall, sizeof(hypercall));", "qemu_devtree_setprop(VAR_8, \"/hypervisor\", \"hcall-instructions\",\nhypercall, sizeof(hypercall));", "if (kvmppc_get_hasidle(VAR_0)) {", "qemu_devtree_setprop(VAR_8, \"/hypervisor\", \"has-idle\", NULL, 0);", "}", "}", "qemu_devtree_add_subnode(VAR_8, \"/cpus\");", "qemu_devtree_setprop_cell(VAR_8, \"/cpus\", \"#address-cells\", 1);", "qemu_devtree_setprop_cell(VAR_8, \"/cpus\", \"#size-cells\", 0);", "for (VAR_9 = smp_cpus - 1; VAR_9 >= 0; VAR_9--) {", "CPUState *cpu;", "char VAR_20[128];", "uint64_t cpu_release_addr = MPC8544_SPIN_BASE + (VAR_9 * 0x20);", "cpu = qemu_get_cpu(VAR_9);", "if (cpu == NULL) {", "continue;", "}", "VAR_0 = cpu->env_ptr;", "snprintf(VAR_20, sizeof(VAR_20), \"/cpus/PowerPC,8544@%x\",\ncpu->cpu_index);", "qemu_devtree_add_subnode(VAR_8, VAR_20);", "qemu_devtree_setprop_cell(VAR_8, VAR_20, \"clock-frequency\", clock_freq);", "qemu_devtree_setprop_cell(VAR_8, VAR_20, \"timebase-frequency\", tb_freq);", "qemu_devtree_setprop_string(VAR_8, VAR_20, \"device_type\", \"cpu\");", "qemu_devtree_setprop_cell(VAR_8, VAR_20, \"reg\", cpu->cpu_index);", "qemu_devtree_setprop_cell(VAR_8, VAR_20, \"d-cache-line-size\",\nVAR_0->dcache_line_size);", "qemu_devtree_setprop_cell(VAR_8, VAR_20, \"VAR_9-cache-line-size\",\nVAR_0->icache_line_size);", "qemu_devtree_setprop_cell(VAR_8, VAR_20, \"d-cache-size\", 0x8000);", "qemu_devtree_setprop_cell(VAR_8, VAR_20, \"VAR_9-cache-size\", 0x8000);", "qemu_devtree_setprop_cell(VAR_8, VAR_20, \"bus-frequency\", 0);", "if (cpu->cpu_index) {", "qemu_devtree_setprop_string(VAR_8, VAR_20, \"status\", \"disabled\");", "qemu_devtree_setprop_string(VAR_8, VAR_20, \"enable-method\", \"spin-table\");", "qemu_devtree_setprop_u64(VAR_8, VAR_20, \"cpu-release-VAR_3\",\ncpu_release_addr);", "} else {", "qemu_devtree_setprop_string(VAR_8, VAR_20, \"status\", \"okay\");", "}", "}", "qemu_devtree_add_subnode(VAR_8, \"/aliases\");", "snprintf(VAR_11, sizeof(VAR_11), \"/VAR_11@%llx\", MPC8544_CCSRBAR_BASE);", "qemu_devtree_add_subnode(VAR_8, VAR_11);", "qemu_devtree_setprop_string(VAR_8, VAR_11, \"device_type\", \"VAR_11\");", "qemu_devtree_setprop(VAR_8, VAR_11, \"compatible\", VAR_10,\nsizeof(VAR_10));", "qemu_devtree_setprop_cell(VAR_8, VAR_11, \"#address-cells\", 1);", "qemu_devtree_setprop_cell(VAR_8, VAR_11, \"#size-cells\", 1);", "qemu_devtree_setprop_cells(VAR_8, VAR_11, \"ranges\", 0x0,\nMPC8544_CCSRBAR_BASE >> 32, MPC8544_CCSRBAR_BASE,\nMPC8544_CCSRBAR_SIZE);", "qemu_devtree_setprop_cell(VAR_8, VAR_11, \"bus-frequency\", 0);", "snprintf(VAR_12, sizeof(VAR_12), \"%s/pic@%llx\", VAR_11, MPC8544_MPIC_REGS_OFFSET);", "qemu_devtree_add_subnode(VAR_8, VAR_12);", "qemu_devtree_setprop_string(VAR_8, VAR_12, \"device_type\", \"open-pic\");", "qemu_devtree_setprop_string(VAR_8, VAR_12, \"compatible\", \"fsl,VAR_12\");", "qemu_devtree_setprop_cells(VAR_8, VAR_12, \"reg\", MPC8544_MPIC_REGS_OFFSET,\n0x40000);", "qemu_devtree_setprop_cell(VAR_8, VAR_12, \"#address-cells\", 0);", "qemu_devtree_setprop_cell(VAR_8, VAR_12, \"#interrupt-cells\", 2);", "mpic_ph = qemu_devtree_alloc_phandle(VAR_8);", "qemu_devtree_setprop_cell(VAR_8, VAR_12, \"phandle\", mpic_ph);", "qemu_devtree_setprop_cell(VAR_8, VAR_12, \"linux,phandle\", mpic_ph);", "qemu_devtree_setprop(VAR_8, VAR_12, \"interrupt-controller\", NULL, 0);", "dt_serial_create(VAR_8, MPC8544_SERIAL1_REGS_OFFSET,\nVAR_11, VAR_12, \"serial1\", 1, false);", "dt_serial_create(VAR_8, MPC8544_SERIAL0_REGS_OFFSET,\nVAR_11, VAR_12, \"serial0\", 0, true);", "snprintf(VAR_13, sizeof(VAR_13), \"%s/global-utilities@%llx\", VAR_11,\nMPC8544_UTIL_OFFSET);", "qemu_devtree_add_subnode(VAR_8, VAR_13);", "qemu_devtree_setprop_string(VAR_8, VAR_13, \"compatible\", \"fsl,mpc8544-guts\");", "qemu_devtree_setprop_cells(VAR_8, VAR_13, \"reg\", MPC8544_UTIL_OFFSET, 0x1000);", "qemu_devtree_setprop(VAR_8, VAR_13, \"fsl,has-rstcr\", NULL, 0);", "snprintf(VAR_15, sizeof(VAR_15), \"/%s/VAR_15@%llx\", VAR_11, MPC8544_MSI_REGS_OFFSET);", "qemu_devtree_add_subnode(VAR_8, VAR_15);", "qemu_devtree_setprop_string(VAR_8, VAR_15, \"compatible\", \"fsl,VAR_12-VAR_15\");", "qemu_devtree_setprop_cells(VAR_8, VAR_15, \"reg\", MPC8544_MSI_REGS_OFFSET, 0x200);", "msi_ph = qemu_devtree_alloc_phandle(VAR_8);", "qemu_devtree_setprop_cells(VAR_8, VAR_15, \"VAR_15-available-ranges\", 0x0, 0x100);", "qemu_devtree_setprop_phandle(VAR_8, VAR_15, \"interrupt-parent\", VAR_12);", "qemu_devtree_setprop_cells(VAR_8, VAR_15, \"interrupts\",\n0xe0, 0x0,\n0xe1, 0x0,\n0xe2, 0x0,\n0xe3, 0x0,\n0xe4, 0x0,\n0xe5, 0x0,\n0xe6, 0x0,\n0xe7, 0x0);", "qemu_devtree_setprop_cell(VAR_8, VAR_15, \"phandle\", msi_ph);", "qemu_devtree_setprop_cell(VAR_8, VAR_15, \"linux,phandle\", msi_ph);", "snprintf(VAR_14, sizeof(VAR_14), \"/VAR_14@%llx\", MPC8544_PCI_REGS_BASE);", "qemu_devtree_add_subnode(VAR_8, VAR_14);", "qemu_devtree_setprop_cell(VAR_8, VAR_14, \"cell-index\", 0);", "qemu_devtree_setprop_string(VAR_8, VAR_14, \"compatible\", \"fsl,mpc8540-VAR_14\");", "qemu_devtree_setprop_string(VAR_8, VAR_14, \"device_type\", \"VAR_14\");", "qemu_devtree_setprop_cells(VAR_8, VAR_14, \"interrupt-map-mask\", 0xf800, 0x0,\n0x0, 0x7);", "pci_map = pci_map_create(VAR_8, qemu_devtree_get_phandle(VAR_8, VAR_12),\nVAR_2->pci_first_slot, VAR_2->pci_nr_slots,\n&VAR_16);", "qemu_devtree_setprop(VAR_8, VAR_14, \"interrupt-map\", pci_map, VAR_16);", "qemu_devtree_setprop_phandle(VAR_8, VAR_14, \"interrupt-parent\", VAR_12);", "qemu_devtree_setprop_cells(VAR_8, VAR_14, \"interrupts\", 24, 2);", "qemu_devtree_setprop_cells(VAR_8, VAR_14, \"bus-range\", 0, 255);", "for (VAR_9 = 0; VAR_9 < 14; VAR_9++) {", "pci_ranges[VAR_9] = cpu_to_be32(pci_ranges[VAR_9]);", "}", "qemu_devtree_setprop_cell(VAR_8, VAR_14, \"fsl,VAR_15\", msi_ph);", "qemu_devtree_setprop(VAR_8, VAR_14, \"ranges\", pci_ranges, sizeof(pci_ranges));", "qemu_devtree_setprop_cells(VAR_8, VAR_14, \"reg\", MPC8544_PCI_REGS_BASE >> 32,\nMPC8544_PCI_REGS_BASE, 0, 0x1000);", "qemu_devtree_setprop_cell(VAR_8, VAR_14, \"clock-frequency\", 66666666);", "qemu_devtree_setprop_cell(VAR_8, VAR_14, \"#interrupt-cells\", 1);", "qemu_devtree_setprop_cell(VAR_8, VAR_14, \"#size-cells\", 2);", "qemu_devtree_setprop_cell(VAR_8, VAR_14, \"#address-cells\", 3);", "qemu_devtree_setprop_string(VAR_8, \"/aliases\", \"pci0\", VAR_14);", "VAR_2->fixup_devtree(VAR_2, VAR_8);", "if (VAR_18) {", "qemu_devtree_setprop(VAR_8, \"/\", \"compatible\", VAR_18,\nstrlen(VAR_18) + 1);", "}", "done:\nqemu_devtree_dumpdtb(VAR_8, VAR_7);", "VAR_6 = rom_add_blob_fixed(BINARY_DEVICE_TREE_FILE, VAR_8, VAR_7, VAR_3);", "if (VAR_6 < 0) {", "goto out;", "}", "g_free(VAR_8);", "VAR_6 = VAR_7;", "out:\ng_free(pci_map);", "return VAR_6;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11, 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51, 53 ], [ 55, 57, 59, 63, 65, 67, 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 119 ], [ 121 ], [ 125 ], [ 127 ], [ 129, 131 ], [ 135 ], [ 137 ], [ 139, 141 ], [ 143 ], [ 145 ], [ 147 ], [ 151, 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 165, 167 ], [ 169, 171 ], [ 175 ], [ 179 ], [ 181 ], [ 187 ], [ 189, 191 ], [ 193 ], [ 195, 197 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 213 ], [ 215 ], [ 217 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 247, 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261, 263 ], [ 265, 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277 ], [ 279 ], [ 281, 283 ], [ 285 ], [ 287 ], [ 289 ], [ 291 ], [ 295 ], [ 299 ], [ 301 ], [ 303 ], [ 305, 307 ], [ 309 ], [ 311 ], [ 313, 315, 317 ], [ 321 ], [ 325 ], [ 327 ], [ 329 ], [ 331 ], [ 333, 335 ], [ 337 ], [ 339 ], [ 341 ], [ 343 ], [ 345 ], [ 347 ], [ 361, 363 ], [ 365, 367 ], [ 371, 373 ], [ 375 ], [ 377 ], [ 379 ], [ 381 ], [ 385 ], [ 387 ], [ 389 ], [ 391 ], [ 393 ], [ 395 ], [ 397 ], [ 399, 401, 403, 405, 407, 409, 411, 413, 415 ], [ 417 ], [ 419 ], [ 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 ], [ 477 ], [ 481 ], [ 483, 485 ], [ 487 ], [ 491, 493 ], [ 495 ], [ 497 ], [ 499 ], [ 501 ], [ 503 ], [ 505 ], [ 509, 511 ], [ 515 ], [ 517 ] ]
15,020
static void acpi_get_pci_holes(Range *hole, Range *hole64) { Object *pci_host; pci_host = acpi_get_i386_pci_host(); g_assert(pci_host); hole->begin = object_property_get_int(pci_host, PCI_HOST_PROP_PCI_HOLE_START, NULL); hole->end = object_property_get_int(pci_host, PCI_HOST_PROP_PCI_HOLE_END, NULL); hole64->begin = object_property_get_int(pci_host, PCI_HOST_PROP_PCI_HOLE64_START, NULL); hole64->end = object_property_get_int(pci_host, PCI_HOST_PROP_PCI_HOLE64_END, NULL); }
false
qemu
a0efbf16604770b9d805bcf210ec29942321134f
static void acpi_get_pci_holes(Range *hole, Range *hole64) { Object *pci_host; pci_host = acpi_get_i386_pci_host(); g_assert(pci_host); hole->begin = object_property_get_int(pci_host, PCI_HOST_PROP_PCI_HOLE_START, NULL); hole->end = object_property_get_int(pci_host, PCI_HOST_PROP_PCI_HOLE_END, NULL); hole64->begin = object_property_get_int(pci_host, PCI_HOST_PROP_PCI_HOLE64_START, NULL); hole64->end = object_property_get_int(pci_host, PCI_HOST_PROP_PCI_HOLE64_END, NULL); }
{ "code": [], "line_no": [] }
static void FUNC_0(Range *VAR_0, Range *VAR_1) { Object *pci_host; pci_host = acpi_get_i386_pci_host(); g_assert(pci_host); VAR_0->begin = object_property_get_int(pci_host, PCI_HOST_PROP_PCI_HOLE_START, NULL); VAR_0->end = object_property_get_int(pci_host, PCI_HOST_PROP_PCI_HOLE_END, NULL); VAR_1->begin = object_property_get_int(pci_host, PCI_HOST_PROP_PCI_HOLE64_START, NULL); VAR_1->end = object_property_get_int(pci_host, PCI_HOST_PROP_PCI_HOLE64_END, NULL); }
[ "static void FUNC_0(Range *VAR_0, Range *VAR_1)\n{", "Object *pci_host;", "pci_host = acpi_get_i386_pci_host();", "g_assert(pci_host);", "VAR_0->begin = object_property_get_int(pci_host,\nPCI_HOST_PROP_PCI_HOLE_START,\nNULL);", "VAR_0->end = object_property_get_int(pci_host,\nPCI_HOST_PROP_PCI_HOLE_END,\nNULL);", "VAR_1->begin = object_property_get_int(pci_host,\nPCI_HOST_PROP_PCI_HOLE64_START,\nNULL);", "VAR_1->end = object_property_get_int(pci_host,\nPCI_HOST_PROP_PCI_HOLE64_END,\nNULL);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 15, 17, 19 ], [ 21, 23, 25 ], [ 27, 29, 31 ], [ 33, 35, 37 ], [ 39 ] ]
15,021
static void colo_compare_complete(UserCreatable *uc, Error **errp) { CompareState *s = COLO_COMPARE(uc); Chardev *chr; char thread_name[64]; static int compare_id; if (!s->pri_indev || !s->sec_indev || !s->outdev) { error_setg(errp, "colo compare needs 'primary_in' ," "'secondary_in','outdev' property set"); return; } else if (!strcmp(s->pri_indev, s->outdev) || !strcmp(s->sec_indev, s->outdev) || !strcmp(s->pri_indev, s->sec_indev)) { error_setg(errp, "'indev' and 'outdev' could not be same " "for compare module"); return; } if (find_and_check_chardev(&chr, s->pri_indev, errp) || !qemu_chr_fe_init(&s->chr_pri_in, chr, errp)) { return; } if (find_and_check_chardev(&chr, s->sec_indev, errp) || !qemu_chr_fe_init(&s->chr_sec_in, chr, errp)) { return; } if (find_and_check_chardev(&chr, s->outdev, errp) || !qemu_chr_fe_init(&s->chr_out, chr, errp)) { return; } net_socket_rs_init(&s->pri_rs, compare_pri_rs_finalize, s->vnet_hdr); net_socket_rs_init(&s->sec_rs, compare_sec_rs_finalize, s->vnet_hdr); g_queue_init(&s->conn_list); s->connection_track_table = g_hash_table_new_full(connection_key_hash, connection_key_equal, g_free, connection_destroy); sprintf(thread_name, "colo-compare %d", compare_id); qemu_thread_create(&s->thread, thread_name, colo_compare_thread, s, QEMU_THREAD_JOINABLE); compare_id++; return; }
false
qemu
dd321ecfc2e82e6f9578b986060b1aa3f036bd98
static void colo_compare_complete(UserCreatable *uc, Error **errp) { CompareState *s = COLO_COMPARE(uc); Chardev *chr; char thread_name[64]; static int compare_id; if (!s->pri_indev || !s->sec_indev || !s->outdev) { error_setg(errp, "colo compare needs 'primary_in' ," "'secondary_in','outdev' property set"); return; } else if (!strcmp(s->pri_indev, s->outdev) || !strcmp(s->sec_indev, s->outdev) || !strcmp(s->pri_indev, s->sec_indev)) { error_setg(errp, "'indev' and 'outdev' could not be same " "for compare module"); return; } if (find_and_check_chardev(&chr, s->pri_indev, errp) || !qemu_chr_fe_init(&s->chr_pri_in, chr, errp)) { return; } if (find_and_check_chardev(&chr, s->sec_indev, errp) || !qemu_chr_fe_init(&s->chr_sec_in, chr, errp)) { return; } if (find_and_check_chardev(&chr, s->outdev, errp) || !qemu_chr_fe_init(&s->chr_out, chr, errp)) { return; } net_socket_rs_init(&s->pri_rs, compare_pri_rs_finalize, s->vnet_hdr); net_socket_rs_init(&s->sec_rs, compare_sec_rs_finalize, s->vnet_hdr); g_queue_init(&s->conn_list); s->connection_track_table = g_hash_table_new_full(connection_key_hash, connection_key_equal, g_free, connection_destroy); sprintf(thread_name, "colo-compare %d", compare_id); qemu_thread_create(&s->thread, thread_name, colo_compare_thread, s, QEMU_THREAD_JOINABLE); compare_id++; return; }
{ "code": [], "line_no": [] }
static void FUNC_0(UserCreatable *VAR_0, Error **VAR_1) { CompareState *s = COLO_COMPARE(VAR_0); Chardev *chr; char VAR_2[64]; static int VAR_3; if (!s->pri_indev || !s->sec_indev || !s->outdev) { error_setg(VAR_1, "colo compare needs 'primary_in' ," "'secondary_in','outdev' property set"); return; } else if (!strcmp(s->pri_indev, s->outdev) || !strcmp(s->sec_indev, s->outdev) || !strcmp(s->pri_indev, s->sec_indev)) { error_setg(VAR_1, "'indev' and 'outdev' could not be same " "for compare module"); return; } if (find_and_check_chardev(&chr, s->pri_indev, VAR_1) || !qemu_chr_fe_init(&s->chr_pri_in, chr, VAR_1)) { return; } if (find_and_check_chardev(&chr, s->sec_indev, VAR_1) || !qemu_chr_fe_init(&s->chr_sec_in, chr, VAR_1)) { return; } if (find_and_check_chardev(&chr, s->outdev, VAR_1) || !qemu_chr_fe_init(&s->chr_out, chr, VAR_1)) { return; } net_socket_rs_init(&s->pri_rs, compare_pri_rs_finalize, s->vnet_hdr); net_socket_rs_init(&s->sec_rs, compare_sec_rs_finalize, s->vnet_hdr); g_queue_init(&s->conn_list); s->connection_track_table = g_hash_table_new_full(connection_key_hash, connection_key_equal, g_free, connection_destroy); sprintf(VAR_2, "colo-compare %d", VAR_3); qemu_thread_create(&s->thread, VAR_2, colo_compare_thread, s, QEMU_THREAD_JOINABLE); VAR_3++; return; }
[ "static void FUNC_0(UserCreatable *VAR_0, Error **VAR_1)\n{", "CompareState *s = COLO_COMPARE(VAR_0);", "Chardev *chr;", "char VAR_2[64];", "static int VAR_3;", "if (!s->pri_indev || !s->sec_indev || !s->outdev) {", "error_setg(VAR_1, \"colo compare needs 'primary_in' ,\"\n\"'secondary_in','outdev' property set\");", "return;", "} else if (!strcmp(s->pri_indev, s->outdev) ||", "!strcmp(s->sec_indev, s->outdev) ||\n!strcmp(s->pri_indev, s->sec_indev)) {", "error_setg(VAR_1, \"'indev' and 'outdev' could not be same \"\n\"for compare module\");", "return;", "}", "if (find_and_check_chardev(&chr, s->pri_indev, VAR_1) ||\n!qemu_chr_fe_init(&s->chr_pri_in, chr, VAR_1)) {", "return;", "}", "if (find_and_check_chardev(&chr, s->sec_indev, VAR_1) ||\n!qemu_chr_fe_init(&s->chr_sec_in, chr, VAR_1)) {", "return;", "}", "if (find_and_check_chardev(&chr, s->outdev, VAR_1) ||\n!qemu_chr_fe_init(&s->chr_out, chr, VAR_1)) {", "return;", "}", "net_socket_rs_init(&s->pri_rs, compare_pri_rs_finalize, s->vnet_hdr);", "net_socket_rs_init(&s->sec_rs, compare_sec_rs_finalize, s->vnet_hdr);", "g_queue_init(&s->conn_list);", "s->connection_track_table = g_hash_table_new_full(connection_key_hash,\nconnection_key_equal,\ng_free,\nconnection_destroy);", "sprintf(VAR_2, \"colo-compare %d\", VAR_3);", "qemu_thread_create(&s->thread, VAR_2,\ncolo_compare_thread, s,\nQEMU_THREAD_JOINABLE);", "VAR_3++;", "return;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17, 19 ], [ 21 ], [ 23 ], [ 25, 27 ], [ 29, 31 ], [ 33 ], [ 35 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 49, 51 ], [ 53 ], [ 55 ], [ 59, 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ], [ 75 ], [ 79, 81, 83, 85 ], [ 89 ], [ 91, 93, 95 ], [ 97 ], [ 101 ], [ 103 ] ]
15,024
ram_addr_t qemu_ram_alloc_from_ptr(ram_addr_t size, void *host, MemoryRegion *mr) { RAMBlock *new_block; size = TARGET_PAGE_ALIGN(size); new_block = g_malloc0(sizeof(*new_block)); new_block->mr = mr; new_block->offset = find_ram_offset(size); if (host) { new_block->host = host; new_block->flags |= RAM_PREALLOC_MASK; } else { if (mem_path) { #if defined (__linux__) && !defined(TARGET_S390X) new_block->host = file_ram_alloc(new_block, size, mem_path); if (!new_block->host) { new_block->host = qemu_vmalloc(size); qemu_madvise(new_block->host, size, QEMU_MADV_MERGEABLE); } #else fprintf(stderr, "-mem-path option unsupported\n"); exit(1); #endif } else { #if defined(TARGET_S390X) && defined(CONFIG_KVM) /* S390 KVM requires the topmost vma of the RAM to be smaller than an system defined value, which is at least 256GB. Larger systems have larger values. We put the guest between the end of data segment (system break) and this value. We use 32GB as a base to have enough room for the system break to grow. */ new_block->host = mmap((void*)0x800000000, size, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS | MAP_FIXED, -1, 0); if (new_block->host == MAP_FAILED) { fprintf(stderr, "Allocating RAM failed\n"); abort(); } #else if (xen_enabled()) { xen_ram_alloc(new_block->offset, size, mr); } else { new_block->host = qemu_vmalloc(size); } #endif qemu_madvise(new_block->host, size, QEMU_MADV_MERGEABLE); } } new_block->length = size; QLIST_INSERT_HEAD(&ram_list.blocks, new_block, next); ram_list.phys_dirty = g_realloc(ram_list.phys_dirty, last_ram_offset() >> TARGET_PAGE_BITS); cpu_physical_memory_set_dirty_range(new_block->offset, size, 0xff); if (kvm_enabled()) kvm_setup_guest_memory(new_block->host, size); return new_block->offset; }
false
qemu
fdec9918578ec38738ecf250fa2c2656a44796b5
ram_addr_t qemu_ram_alloc_from_ptr(ram_addr_t size, void *host, MemoryRegion *mr) { RAMBlock *new_block; size = TARGET_PAGE_ALIGN(size); new_block = g_malloc0(sizeof(*new_block)); new_block->mr = mr; new_block->offset = find_ram_offset(size); if (host) { new_block->host = host; new_block->flags |= RAM_PREALLOC_MASK; } else { if (mem_path) { #if defined (__linux__) && !defined(TARGET_S390X) new_block->host = file_ram_alloc(new_block, size, mem_path); if (!new_block->host) { new_block->host = qemu_vmalloc(size); qemu_madvise(new_block->host, size, QEMU_MADV_MERGEABLE); } #else fprintf(stderr, "-mem-path option unsupported\n"); exit(1); #endif } else { #if defined(TARGET_S390X) && defined(CONFIG_KVM) new_block->host = mmap((void*)0x800000000, size, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS | MAP_FIXED, -1, 0); if (new_block->host == MAP_FAILED) { fprintf(stderr, "Allocating RAM failed\n"); abort(); } #else if (xen_enabled()) { xen_ram_alloc(new_block->offset, size, mr); } else { new_block->host = qemu_vmalloc(size); } #endif qemu_madvise(new_block->host, size, QEMU_MADV_MERGEABLE); } } new_block->length = size; QLIST_INSERT_HEAD(&ram_list.blocks, new_block, next); ram_list.phys_dirty = g_realloc(ram_list.phys_dirty, last_ram_offset() >> TARGET_PAGE_BITS); cpu_physical_memory_set_dirty_range(new_block->offset, size, 0xff); if (kvm_enabled()) kvm_setup_guest_memory(new_block->host, size); return new_block->offset; }
{ "code": [], "line_no": [] }
ram_addr_t FUNC_0(ram_addr_t size, void *host, MemoryRegion *mr) { RAMBlock *new_block; size = TARGET_PAGE_ALIGN(size); new_block = g_malloc0(sizeof(*new_block)); new_block->mr = mr; new_block->offset = find_ram_offset(size); if (host) { new_block->host = host; new_block->flags |= RAM_PREALLOC_MASK; } else { if (mem_path) { #if defined (__linux__) && !defined(TARGET_S390X) new_block->host = file_ram_alloc(new_block, size, mem_path); if (!new_block->host) { new_block->host = qemu_vmalloc(size); qemu_madvise(new_block->host, size, QEMU_MADV_MERGEABLE); } #else fprintf(stderr, "-mem-path option unsupported\n"); exit(1); #endif } else { #if defined(TARGET_S390X) && defined(CONFIG_KVM) new_block->host = mmap((void*)0x800000000, size, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS | MAP_FIXED, -1, 0); if (new_block->host == MAP_FAILED) { fprintf(stderr, "Allocating RAM failed\n"); abort(); } #else if (xen_enabled()) { xen_ram_alloc(new_block->offset, size, mr); } else { new_block->host = qemu_vmalloc(size); } #endif qemu_madvise(new_block->host, size, QEMU_MADV_MERGEABLE); } } new_block->length = size; QLIST_INSERT_HEAD(&ram_list.blocks, new_block, next); ram_list.phys_dirty = g_realloc(ram_list.phys_dirty, last_ram_offset() >> TARGET_PAGE_BITS); cpu_physical_memory_set_dirty_range(new_block->offset, size, 0xff); if (kvm_enabled()) kvm_setup_guest_memory(new_block->host, size); return new_block->offset; }
[ "ram_addr_t FUNC_0(ram_addr_t size, void *host,\nMemoryRegion *mr)\n{", "RAMBlock *new_block;", "size = TARGET_PAGE_ALIGN(size);", "new_block = g_malloc0(sizeof(*new_block));", "new_block->mr = mr;", "new_block->offset = find_ram_offset(size);", "if (host) {", "new_block->host = host;", "new_block->flags |= RAM_PREALLOC_MASK;", "} else {", "if (mem_path) {", "#if defined (__linux__) && !defined(TARGET_S390X)\nnew_block->host = file_ram_alloc(new_block, size, mem_path);", "if (!new_block->host) {", "new_block->host = qemu_vmalloc(size);", "qemu_madvise(new_block->host, size, QEMU_MADV_MERGEABLE);", "}", "#else\nfprintf(stderr, \"-mem-path option unsupported\\n\");", "exit(1);", "#endif\n} else {", "#if defined(TARGET_S390X) && defined(CONFIG_KVM)\nnew_block->host = mmap((void*)0x800000000, size,\nPROT_EXEC|PROT_READ|PROT_WRITE,\nMAP_SHARED | MAP_ANONYMOUS | MAP_FIXED, -1, 0);", "if (new_block->host == MAP_FAILED) {", "fprintf(stderr, \"Allocating RAM failed\\n\");", "abort();", "}", "#else\nif (xen_enabled()) {", "xen_ram_alloc(new_block->offset, size, mr);", "} else {", "new_block->host = qemu_vmalloc(size);", "}", "#endif\nqemu_madvise(new_block->host, size, QEMU_MADV_MERGEABLE);", "}", "}", "new_block->length = size;", "QLIST_INSERT_HEAD(&ram_list.blocks, new_block, next);", "ram_list.phys_dirty = g_realloc(ram_list.phys_dirty,\nlast_ram_offset() >> TARGET_PAGE_BITS);", "cpu_physical_memory_set_dirty_range(new_block->offset, size, 0xff);", "if (kvm_enabled())\nkvm_setup_guest_memory(new_block->host, size);", "return new_block->offset;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 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, 65, 67, 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79, 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91, 93 ], [ 95 ], [ 97 ], [ 99 ], [ 103 ], [ 107, 109 ], [ 111 ], [ 115, 117 ], [ 121 ], [ 123 ] ]
15,025
static void x86_iommu_realize(DeviceState *dev, Error **errp) { X86IOMMUState *x86_iommu = X86_IOMMU_DEVICE(dev); X86IOMMUClass *x86_class = X86_IOMMU_GET_CLASS(dev); MachineState *ms = MACHINE(qdev_get_machine()); MachineClass *mc = MACHINE_GET_CLASS(ms); PCMachineState *pcms = PC_MACHINE(object_dynamic_cast(OBJECT(ms), TYPE_PC_MACHINE)); QLIST_INIT(&x86_iommu->iec_notifiers); if (!pcms) { error_setg(errp, "Machine-type '%s' not supported by IOMMU", mc->name); return; } if (x86_class->realize) { x86_class->realize(dev, errp); } x86_iommu_set_default(X86_IOMMU_DEVICE(dev)); }
false
qemu
a0c167a18470831e359f0538c3cf67907808f13e
static void x86_iommu_realize(DeviceState *dev, Error **errp) { X86IOMMUState *x86_iommu = X86_IOMMU_DEVICE(dev); X86IOMMUClass *x86_class = X86_IOMMU_GET_CLASS(dev); MachineState *ms = MACHINE(qdev_get_machine()); MachineClass *mc = MACHINE_GET_CLASS(ms); PCMachineState *pcms = PC_MACHINE(object_dynamic_cast(OBJECT(ms), TYPE_PC_MACHINE)); QLIST_INIT(&x86_iommu->iec_notifiers); if (!pcms) { error_setg(errp, "Machine-type '%s' not supported by IOMMU", mc->name); return; } if (x86_class->realize) { x86_class->realize(dev, errp); } x86_iommu_set_default(X86_IOMMU_DEVICE(dev)); }
{ "code": [], "line_no": [] }
static void FUNC_0(DeviceState *VAR_0, Error **VAR_1) { X86IOMMUState *x86_iommu = X86_IOMMU_DEVICE(VAR_0); X86IOMMUClass *x86_class = X86_IOMMU_GET_CLASS(VAR_0); MachineState *ms = MACHINE(qdev_get_machine()); MachineClass *mc = MACHINE_GET_CLASS(ms); PCMachineState *pcms = PC_MACHINE(object_dynamic_cast(OBJECT(ms), TYPE_PC_MACHINE)); QLIST_INIT(&x86_iommu->iec_notifiers); if (!pcms) { error_setg(VAR_1, "Machine-type '%s' not supported by IOMMU", mc->name); return; } if (x86_class->realize) { x86_class->realize(VAR_0, VAR_1); } x86_iommu_set_default(X86_IOMMU_DEVICE(VAR_0)); }
[ "static void FUNC_0(DeviceState *VAR_0, Error **VAR_1)\n{", "X86IOMMUState *x86_iommu = X86_IOMMU_DEVICE(VAR_0);", "X86IOMMUClass *x86_class = X86_IOMMU_GET_CLASS(VAR_0);", "MachineState *ms = MACHINE(qdev_get_machine());", "MachineClass *mc = MACHINE_GET_CLASS(ms);", "PCMachineState *pcms =\nPC_MACHINE(object_dynamic_cast(OBJECT(ms), TYPE_PC_MACHINE));", "QLIST_INIT(&x86_iommu->iec_notifiers);", "if (!pcms) {", "error_setg(VAR_1, \"Machine-type '%s' not supported by IOMMU\",\nmc->name);", "return;", "}", "if (x86_class->realize) {", "x86_class->realize(VAR_0, VAR_1);", "}", "x86_iommu_set_default(X86_IOMMU_DEVICE(VAR_0));", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13, 15 ], [ 17 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ] ]
15,028
static uint64_t cs_read (void *opaque, target_phys_addr_t addr, unsigned size) { CSState *s = opaque; uint32_t saddr, iaddr, ret; saddr = addr; iaddr = ~0U; switch (saddr) { case Index_Address: ret = s->regs[saddr] & ~0x80; break; case Index_Data: if (!(s->dregs[MODE_And_ID] & MODE2)) iaddr = s->regs[Index_Address] & 0x0f; else iaddr = s->regs[Index_Address] & 0x1f; ret = s->dregs[iaddr]; if (iaddr == Error_Status_And_Initialization) { /* keep SEAL happy */ if (s->aci_counter) { ret |= 1 << 5; s->aci_counter -= 1; } } break; default: ret = s->regs[saddr]; break; } dolog ("read %d:%d -> %d\n", saddr, iaddr, ret); return ret; }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static uint64_t cs_read (void *opaque, target_phys_addr_t addr, unsigned size) { CSState *s = opaque; uint32_t saddr, iaddr, ret; saddr = addr; iaddr = ~0U; switch (saddr) { case Index_Address: ret = s->regs[saddr] & ~0x80; break; case Index_Data: if (!(s->dregs[MODE_And_ID] & MODE2)) iaddr = s->regs[Index_Address] & 0x0f; else iaddr = s->regs[Index_Address] & 0x1f; ret = s->dregs[iaddr]; if (iaddr == Error_Status_And_Initialization) { if (s->aci_counter) { ret |= 1 << 5; s->aci_counter -= 1; } } break; default: ret = s->regs[saddr]; break; } dolog ("read %d:%d -> %d\n", saddr, iaddr, ret); return ret; }
{ "code": [], "line_no": [] }
static uint64_t FUNC_0 (void *opaque, target_phys_addr_t addr, unsigned size) { CSState *s = opaque; uint32_t saddr, iaddr, ret; saddr = addr; iaddr = ~0U; switch (saddr) { case Index_Address: ret = s->regs[saddr] & ~0x80; break; case Index_Data: if (!(s->dregs[MODE_And_ID] & MODE2)) iaddr = s->regs[Index_Address] & 0x0f; else iaddr = s->regs[Index_Address] & 0x1f; ret = s->dregs[iaddr]; if (iaddr == Error_Status_And_Initialization) { if (s->aci_counter) { ret |= 1 << 5; s->aci_counter -= 1; } } break; default: ret = s->regs[saddr]; break; } dolog ("read %d:%d -> %d\n", saddr, iaddr, ret); return ret; }
[ "static uint64_t FUNC_0 (void *opaque, target_phys_addr_t addr, unsigned size)\n{", "CSState *s = opaque;", "uint32_t saddr, iaddr, ret;", "saddr = addr;", "iaddr = ~0U;", "switch (saddr) {", "case Index_Address:\nret = s->regs[saddr] & ~0x80;", "break;", "case Index_Data:\nif (!(s->dregs[MODE_And_ID] & MODE2))\niaddr = s->regs[Index_Address] & 0x0f;", "else\niaddr = s->regs[Index_Address] & 0x1f;", "ret = s->dregs[iaddr];", "if (iaddr == Error_Status_And_Initialization) {", "if (s->aci_counter) {", "ret |= 1 << 5;", "s->aci_counter -= 1;", "}", "}", "break;", "default:\nret = s->regs[saddr];", "break;", "}", "dolog (\"read %d:%d -> %d\\n\", saddr, iaddr, ret);", "return ret;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 17 ], [ 19, 21 ], [ 23 ], [ 27, 29, 31 ], [ 33, 35 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59, 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ] ]
15,029
static int mmu_translate_region(CPUS390XState *env, target_ulong vaddr, uint64_t asc, uint64_t entry, int level, target_ulong *raddr, int *flags, int rw) { CPUState *cs = CPU(s390_env_get_cpu(env)); uint64_t origin, offs, new_entry; const int pchks[4] = { PGM_SEGMENT_TRANS, PGM_REG_THIRD_TRANS, PGM_REG_SEC_TRANS, PGM_REG_FIRST_TRANS }; PTE_DPRINTF("%s: 0x%" PRIx64 "\n", __func__, entry); origin = entry & _REGION_ENTRY_ORIGIN; offs = (vaddr >> (17 + 11 * level / 4)) & 0x3ff8; new_entry = ldq_phys(cs->as, origin + offs); PTE_DPRINTF("%s: 0x%" PRIx64 " + 0x%" PRIx64 " => 0x%016" PRIx64 "\n", __func__, origin, offs, new_entry); if ((new_entry & _REGION_ENTRY_INV) != 0) { /* XXX different regions have different faults */ DPRINTF("%s: invalid region\n", __func__); trigger_page_fault(env, vaddr, PGM_SEGMENT_TRANS, asc, rw); return -1; } if ((new_entry & _REGION_ENTRY_TYPE_MASK) != level) { trigger_page_fault(env, vaddr, PGM_TRANS_SPEC, asc, rw); return -1; } /* XXX region protection flags */ /* *flags &= ~PAGE_WRITE */ if (level == _ASCE_TYPE_SEGMENT) { return mmu_translate_segment(env, vaddr, asc, new_entry, raddr, flags, rw); } /* Check region table offset and length */ offs = (vaddr >> (28 + 11 * (level - 4) / 4)) & 3; if (offs < ((new_entry & _REGION_ENTRY_TF) >> 6) || offs > (new_entry & _REGION_ENTRY_LENGTH)) { DPRINTF("%s: invalid offset or len (%lx)\n", __func__, new_entry); trigger_page_fault(env, vaddr, pchks[level / 4 - 1], asc, rw); return -1; } /* yet another region */ return mmu_translate_region(env, vaddr, asc, new_entry, level - 4, raddr, flags, rw); }
false
qemu
e3e09d87c6e69c2da684d5aacabe3124ebcb6f8e
static int mmu_translate_region(CPUS390XState *env, target_ulong vaddr, uint64_t asc, uint64_t entry, int level, target_ulong *raddr, int *flags, int rw) { CPUState *cs = CPU(s390_env_get_cpu(env)); uint64_t origin, offs, new_entry; const int pchks[4] = { PGM_SEGMENT_TRANS, PGM_REG_THIRD_TRANS, PGM_REG_SEC_TRANS, PGM_REG_FIRST_TRANS }; PTE_DPRINTF("%s: 0x%" PRIx64 "\n", __func__, entry); origin = entry & _REGION_ENTRY_ORIGIN; offs = (vaddr >> (17 + 11 * level / 4)) & 0x3ff8; new_entry = ldq_phys(cs->as, origin + offs); PTE_DPRINTF("%s: 0x%" PRIx64 " + 0x%" PRIx64 " => 0x%016" PRIx64 "\n", __func__, origin, offs, new_entry); if ((new_entry & _REGION_ENTRY_INV) != 0) { DPRINTF("%s: invalid region\n", __func__); trigger_page_fault(env, vaddr, PGM_SEGMENT_TRANS, asc, rw); return -1; } if ((new_entry & _REGION_ENTRY_TYPE_MASK) != level) { trigger_page_fault(env, vaddr, PGM_TRANS_SPEC, asc, rw); return -1; } if (level == _ASCE_TYPE_SEGMENT) { return mmu_translate_segment(env, vaddr, asc, new_entry, raddr, flags, rw); } offs = (vaddr >> (28 + 11 * (level - 4) / 4)) & 3; if (offs < ((new_entry & _REGION_ENTRY_TF) >> 6) || offs > (new_entry & _REGION_ENTRY_LENGTH)) { DPRINTF("%s: invalid offset or len (%lx)\n", __func__, new_entry); trigger_page_fault(env, vaddr, pchks[level / 4 - 1], asc, rw); return -1; } return mmu_translate_region(env, vaddr, asc, new_entry, level - 4, raddr, flags, rw); }
{ "code": [], "line_no": [] }
static int FUNC_0(CPUS390XState *VAR_0, target_ulong VAR_1, uint64_t VAR_2, uint64_t VAR_3, int VAR_4, target_ulong *VAR_5, int *VAR_6, int VAR_7) { CPUState *cs = CPU(s390_env_get_cpu(VAR_0)); uint64_t origin, offs, new_entry; const int VAR_8[4] = { PGM_SEGMENT_TRANS, PGM_REG_THIRD_TRANS, PGM_REG_SEC_TRANS, PGM_REG_FIRST_TRANS }; PTE_DPRINTF("%s: 0x%" PRIx64 "\n", __func__, VAR_3); origin = VAR_3 & _REGION_ENTRY_ORIGIN; offs = (VAR_1 >> (17 + 11 * VAR_4 / 4)) & 0x3ff8; new_entry = ldq_phys(cs->as, origin + offs); PTE_DPRINTF("%s: 0x%" PRIx64 " + 0x%" PRIx64 " => 0x%016" PRIx64 "\n", __func__, origin, offs, new_entry); if ((new_entry & _REGION_ENTRY_INV) != 0) { DPRINTF("%s: invalid region\n", __func__); trigger_page_fault(VAR_0, VAR_1, PGM_SEGMENT_TRANS, VAR_2, VAR_7); return -1; } if ((new_entry & _REGION_ENTRY_TYPE_MASK) != VAR_4) { trigger_page_fault(VAR_0, VAR_1, PGM_TRANS_SPEC, VAR_2, VAR_7); return -1; } if (VAR_4 == _ASCE_TYPE_SEGMENT) { return mmu_translate_segment(VAR_0, VAR_1, VAR_2, new_entry, VAR_5, VAR_6, VAR_7); } offs = (VAR_1 >> (28 + 11 * (VAR_4 - 4) / 4)) & 3; if (offs < ((new_entry & _REGION_ENTRY_TF) >> 6) || offs > (new_entry & _REGION_ENTRY_LENGTH)) { DPRINTF("%s: invalid offset or len (%lx)\n", __func__, new_entry); trigger_page_fault(VAR_0, VAR_1, VAR_8[VAR_4 / 4 - 1], VAR_2, VAR_7); return -1; } return FUNC_0(VAR_0, VAR_1, VAR_2, new_entry, VAR_4 - 4, VAR_5, VAR_6, VAR_7); }
[ "static int FUNC_0(CPUS390XState *VAR_0, target_ulong VAR_1,\nuint64_t VAR_2, uint64_t VAR_3, int VAR_4,\ntarget_ulong *VAR_5, int *VAR_6, int VAR_7)\n{", "CPUState *cs = CPU(s390_env_get_cpu(VAR_0));", "uint64_t origin, offs, new_entry;", "const int VAR_8[4] = {", "PGM_SEGMENT_TRANS, PGM_REG_THIRD_TRANS,\nPGM_REG_SEC_TRANS, PGM_REG_FIRST_TRANS\n};", "PTE_DPRINTF(\"%s: 0x%\" PRIx64 \"\\n\", __func__, VAR_3);", "origin = VAR_3 & _REGION_ENTRY_ORIGIN;", "offs = (VAR_1 >> (17 + 11 * VAR_4 / 4)) & 0x3ff8;", "new_entry = ldq_phys(cs->as, origin + offs);", "PTE_DPRINTF(\"%s: 0x%\" PRIx64 \" + 0x%\" PRIx64 \" => 0x%016\" PRIx64 \"\\n\",\n__func__, origin, offs, new_entry);", "if ((new_entry & _REGION_ENTRY_INV) != 0) {", "DPRINTF(\"%s: invalid region\\n\", __func__);", "trigger_page_fault(VAR_0, VAR_1, PGM_SEGMENT_TRANS, VAR_2, VAR_7);", "return -1;", "}", "if ((new_entry & _REGION_ENTRY_TYPE_MASK) != VAR_4) {", "trigger_page_fault(VAR_0, VAR_1, PGM_TRANS_SPEC, VAR_2, VAR_7);", "return -1;", "}", "if (VAR_4 == _ASCE_TYPE_SEGMENT) {", "return mmu_translate_segment(VAR_0, VAR_1, VAR_2, new_entry, VAR_5, VAR_6,\nVAR_7);", "}", "offs = (VAR_1 >> (28 + 11 * (VAR_4 - 4) / 4)) & 3;", "if (offs < ((new_entry & _REGION_ENTRY_TF) >> 6)\n|| offs > (new_entry & _REGION_ENTRY_LENGTH)) {", "DPRINTF(\"%s: invalid offset or len (%lx)\\n\", __func__, new_entry);", "trigger_page_fault(VAR_0, VAR_1, VAR_8[VAR_4 / 4 - 1], VAR_2, VAR_7);", "return -1;", "}", "return FUNC_0(VAR_0, VAR_1, VAR_2, new_entry, VAR_4 - 4,\nVAR_5, VAR_6, VAR_7);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15, 17, 19 ], [ 23 ], [ 27 ], [ 29 ], [ 33 ], [ 35, 37 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 71 ], [ 73, 75 ], [ 77 ], [ 83 ], [ 85, 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 101, 103 ], [ 105 ] ]
15,030
static void sunkbd_handle_event(DeviceState *dev, QemuConsole *src, InputEvent *evt) { ChannelState *s = (ChannelState *)dev; int qcode, keycode; InputKeyEvent *key; assert(evt->type == INPUT_EVENT_KIND_KEY); key = evt->u.key; qcode = qemu_input_key_value_to_qcode(key->key); trace_escc_sunkbd_event_in(qcode, QKeyCode_lookup[qcode], key->down); if (qcode == Q_KEY_CODE_CAPS_LOCK) { if (key->down) { s->caps_lock_mode ^= 1; if (s->caps_lock_mode == 2) { return; /* Drop second press */ } } else { s->caps_lock_mode ^= 2; if (s->caps_lock_mode == 3) { return; /* Drop first release */ } } } if (qcode == Q_KEY_CODE_NUM_LOCK) { if (key->down) { s->num_lock_mode ^= 1; if (s->num_lock_mode == 2) { return; /* Drop second press */ } } else { s->num_lock_mode ^= 2; if (s->num_lock_mode == 3) { return; /* Drop first release */ } } } keycode = qcode_to_keycode[qcode]; if (!key->down) { keycode |= 0x80; } trace_escc_sunkbd_event_out(keycode); put_queue(s, keycode); }
false
qemu
32bafa8fdd098d52fbf1102d5a5e48d29398c0aa
static void sunkbd_handle_event(DeviceState *dev, QemuConsole *src, InputEvent *evt) { ChannelState *s = (ChannelState *)dev; int qcode, keycode; InputKeyEvent *key; assert(evt->type == INPUT_EVENT_KIND_KEY); key = evt->u.key; qcode = qemu_input_key_value_to_qcode(key->key); trace_escc_sunkbd_event_in(qcode, QKeyCode_lookup[qcode], key->down); if (qcode == Q_KEY_CODE_CAPS_LOCK) { if (key->down) { s->caps_lock_mode ^= 1; if (s->caps_lock_mode == 2) { return; } } else { s->caps_lock_mode ^= 2; if (s->caps_lock_mode == 3) { return; } } } if (qcode == Q_KEY_CODE_NUM_LOCK) { if (key->down) { s->num_lock_mode ^= 1; if (s->num_lock_mode == 2) { return; } } else { s->num_lock_mode ^= 2; if (s->num_lock_mode == 3) { return; } } } keycode = qcode_to_keycode[qcode]; if (!key->down) { keycode |= 0x80; } trace_escc_sunkbd_event_out(keycode); put_queue(s, keycode); }
{ "code": [], "line_no": [] }
static void FUNC_0(DeviceState *VAR_0, QemuConsole *VAR_1, InputEvent *VAR_2) { ChannelState *s = (ChannelState *)VAR_0; int VAR_3, VAR_4; InputKeyEvent *key; assert(VAR_2->type == INPUT_EVENT_KIND_KEY); key = VAR_2->u.key; VAR_3 = qemu_input_key_value_to_qcode(key->key); trace_escc_sunkbd_event_in(VAR_3, QKeyCode_lookup[VAR_3], key->down); if (VAR_3 == Q_KEY_CODE_CAPS_LOCK) { if (key->down) { s->caps_lock_mode ^= 1; if (s->caps_lock_mode == 2) { return; } } else { s->caps_lock_mode ^= 2; if (s->caps_lock_mode == 3) { return; } } } if (VAR_3 == Q_KEY_CODE_NUM_LOCK) { if (key->down) { s->num_lock_mode ^= 1; if (s->num_lock_mode == 2) { return; } } else { s->num_lock_mode ^= 2; if (s->num_lock_mode == 3) { return; } } } VAR_4 = qcode_to_keycode[VAR_3]; if (!key->down) { VAR_4 |= 0x80; } trace_escc_sunkbd_event_out(VAR_4); put_queue(s, VAR_4); }
[ "static void FUNC_0(DeviceState *VAR_0, QemuConsole *VAR_1,\nInputEvent *VAR_2)\n{", "ChannelState *s = (ChannelState *)VAR_0;", "int VAR_3, VAR_4;", "InputKeyEvent *key;", "assert(VAR_2->type == INPUT_EVENT_KIND_KEY);", "key = VAR_2->u.key;", "VAR_3 = qemu_input_key_value_to_qcode(key->key);", "trace_escc_sunkbd_event_in(VAR_3, QKeyCode_lookup[VAR_3],\nkey->down);", "if (VAR_3 == Q_KEY_CODE_CAPS_LOCK) {", "if (key->down) {", "s->caps_lock_mode ^= 1;", "if (s->caps_lock_mode == 2) {", "return;", "}", "} else {", "s->caps_lock_mode ^= 2;", "if (s->caps_lock_mode == 3) {", "return;", "}", "}", "}", "if (VAR_3 == Q_KEY_CODE_NUM_LOCK) {", "if (key->down) {", "s->num_lock_mode ^= 1;", "if (s->num_lock_mode == 2) {", "return;", "}", "} else {", "s->num_lock_mode ^= 2;", "if (s->num_lock_mode == 3) {", "return;", "}", "}", "}", "VAR_4 = qcode_to_keycode[VAR_3];", "if (!key->down) {", "VAR_4 |= 0x80;", "}", "trace_escc_sunkbd_event_out(VAR_4);", "put_queue(s, VAR_4);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21, 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ] ]
15,031
static void fmod_write_sample (HWVoiceOut *hw, uint8_t *dst, int dst_len) { int src_len1 = dst_len; int src_len2 = 0; int pos = hw->rpos + dst_len; st_sample_t *src1 = hw->mix_buf + hw->rpos; st_sample_t *src2 = NULL; if (pos > hw->samples) { src_len1 = hw->samples - hw->rpos; src2 = hw->mix_buf; src_len2 = dst_len - src_len1; pos = src_len2; } if (src_len1) { hw->clip (dst, src1, src_len1); } if (src_len2) { dst = advance (dst, src_len1 << hw->info.shift); hw->clip (dst, src2, src_len2); } hw->rpos = pos % hw->samples; }
false
qemu
1ea879e5580f63414693655fcf0328559cdce138
static void fmod_write_sample (HWVoiceOut *hw, uint8_t *dst, int dst_len) { int src_len1 = dst_len; int src_len2 = 0; int pos = hw->rpos + dst_len; st_sample_t *src1 = hw->mix_buf + hw->rpos; st_sample_t *src2 = NULL; if (pos > hw->samples) { src_len1 = hw->samples - hw->rpos; src2 = hw->mix_buf; src_len2 = dst_len - src_len1; pos = src_len2; } if (src_len1) { hw->clip (dst, src1, src_len1); } if (src_len2) { dst = advance (dst, src_len1 << hw->info.shift); hw->clip (dst, src2, src_len2); } hw->rpos = pos % hw->samples; }
{ "code": [], "line_no": [] }
static void FUNC_0 (HWVoiceOut *VAR_0, uint8_t *VAR_1, int VAR_2) { int VAR_3 = VAR_2; int VAR_4 = 0; int VAR_5 = VAR_0->rpos + VAR_2; st_sample_t *src1 = VAR_0->mix_buf + VAR_0->rpos; st_sample_t *src2 = NULL; if (VAR_5 > VAR_0->samples) { VAR_3 = VAR_0->samples - VAR_0->rpos; src2 = VAR_0->mix_buf; VAR_4 = VAR_2 - VAR_3; VAR_5 = VAR_4; } if (VAR_3) { VAR_0->clip (VAR_1, src1, VAR_3); } if (VAR_4) { VAR_1 = advance (VAR_1, VAR_3 << VAR_0->info.shift); VAR_0->clip (VAR_1, src2, VAR_4); } VAR_0->rpos = VAR_5 % VAR_0->samples; }
[ "static void FUNC_0 (HWVoiceOut *VAR_0, uint8_t *VAR_1, int VAR_2)\n{", "int VAR_3 = VAR_2;", "int VAR_4 = 0;", "int VAR_5 = VAR_0->rpos + VAR_2;", "st_sample_t *src1 = VAR_0->mix_buf + VAR_0->rpos;", "st_sample_t *src2 = NULL;", "if (VAR_5 > VAR_0->samples) {", "VAR_3 = VAR_0->samples - VAR_0->rpos;", "src2 = VAR_0->mix_buf;", "VAR_4 = VAR_2 - VAR_3;", "VAR_5 = VAR_4;", "}", "if (VAR_3) {", "VAR_0->clip (VAR_1, src1, VAR_3);", "}", "if (VAR_4) {", "VAR_1 = advance (VAR_1, VAR_3 << VAR_0->info.shift);", "VAR_0->clip (VAR_1, src2, VAR_4);", "}", "VAR_0->rpos = VAR_5 % VAR_0->samples;", "}" ]
[ 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 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ] ]
15,032
static void dealloc_helper(void *native_in, VisitorFunc visit, Error **errp) { QapiDeallocVisitor *qdv = qapi_dealloc_visitor_new(); visit(qapi_dealloc_get_visitor(qdv), &native_in, errp); qapi_dealloc_visitor_cleanup(qdv); }
false
qemu
2c0ef9f411ae6081efa9eca5b3eab2dbeee45a6c
static void dealloc_helper(void *native_in, VisitorFunc visit, Error **errp) { QapiDeallocVisitor *qdv = qapi_dealloc_visitor_new(); visit(qapi_dealloc_get_visitor(qdv), &native_in, errp); qapi_dealloc_visitor_cleanup(qdv); }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, VisitorFunc VAR_1, Error **VAR_2) { QapiDeallocVisitor *qdv = qapi_dealloc_visitor_new(); VAR_1(qapi_dealloc_get_visitor(qdv), &VAR_0, VAR_2); qapi_dealloc_visitor_cleanup(qdv); }
[ "static void FUNC_0(void *VAR_0, VisitorFunc VAR_1, Error **VAR_2)\n{", "QapiDeallocVisitor *qdv = qapi_dealloc_visitor_new();", "VAR_1(qapi_dealloc_get_visitor(qdv), &VAR_0, VAR_2);", "qapi_dealloc_visitor_cleanup(qdv);", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 13 ], [ 15 ] ]
15,033
static void deinterlace_bottom_field_inplace(uint8_t *src1, int src_wrap, int width, int height) { uint8_t *src_m1, *src_0, *src_p1, *src_p2; int y; uint8_t *buf; buf = av_malloc(width); src_m1 = src1; memcpy(buf,src_m1,width); src_0=&src_m1[src_wrap]; src_p1=&src_0[src_wrap]; src_p2=&src_p1[src_wrap]; for(y=0;y<(height-2);y+=2) { deinterlace_line_inplace(buf,src_m1,src_0,src_p1,src_p2,width); src_m1 = src_p1; src_0 = src_p2; src_p1 += 2*src_wrap; src_p2 += 2*src_wrap; } /* do last line */ deinterlace_line_inplace(buf,src_m1,src_0,src_0,src_0,width); av_free(buf); }
false
FFmpeg
210461c0a83a5625560fa1d92229200dc7fb869b
static void deinterlace_bottom_field_inplace(uint8_t *src1, int src_wrap, int width, int height) { uint8_t *src_m1, *src_0, *src_p1, *src_p2; int y; uint8_t *buf; buf = av_malloc(width); src_m1 = src1; memcpy(buf,src_m1,width); src_0=&src_m1[src_wrap]; src_p1=&src_0[src_wrap]; src_p2=&src_p1[src_wrap]; for(y=0;y<(height-2);y+=2) { deinterlace_line_inplace(buf,src_m1,src_0,src_p1,src_p2,width); src_m1 = src_p1; src_0 = src_p2; src_p1 += 2*src_wrap; src_p2 += 2*src_wrap; } deinterlace_line_inplace(buf,src_m1,src_0,src_0,src_0,width); av_free(buf); }
{ "code": [], "line_no": [] }
static void FUNC_0(uint8_t *VAR_0, int VAR_1, int VAR_2, int VAR_3) { uint8_t *src_m1, *src_0, *src_p1, *src_p2; int VAR_4; uint8_t *buf; buf = av_malloc(VAR_2); src_m1 = VAR_0; memcpy(buf,src_m1,VAR_2); src_0=&src_m1[VAR_1]; src_p1=&src_0[VAR_1]; src_p2=&src_p1[VAR_1]; for(VAR_4=0;VAR_4<(VAR_3-2);VAR_4+=2) { deinterlace_line_inplace(buf,src_m1,src_0,src_p1,src_p2,VAR_2); src_m1 = src_p1; src_0 = src_p2; src_p1 += 2*VAR_1; src_p2 += 2*VAR_1; } deinterlace_line_inplace(buf,src_m1,src_0,src_0,src_0,VAR_2); av_free(buf); }
[ "static void FUNC_0(uint8_t *VAR_0, int VAR_1,\nint VAR_2, int VAR_3)\n{", "uint8_t *src_m1, *src_0, *src_p1, *src_p2;", "int VAR_4;", "uint8_t *buf;", "buf = av_malloc(VAR_2);", "src_m1 = VAR_0;", "memcpy(buf,src_m1,VAR_2);", "src_0=&src_m1[VAR_1];", "src_p1=&src_0[VAR_1];", "src_p2=&src_p1[VAR_1];", "for(VAR_4=0;VAR_4<(VAR_3-2);VAR_4+=2) {", "deinterlace_line_inplace(buf,src_m1,src_0,src_p1,src_p2,VAR_2);", "src_m1 = src_p1;", "src_0 = src_p2;", "src_p1 += 2*VAR_1;", "src_p2 += 2*VAR_1;", "}", "deinterlace_line_inplace(buf,src_m1,src_0,src_0,src_0,VAR_2);", "av_free(buf);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ] ]
15,034
bool net_tx_pkt_parse(struct NetTxPkt *pkt) { return net_tx_pkt_parse_headers(pkt) && net_tx_pkt_rebuild_payload(pkt); }
false
qemu
eb700029c7836798046191d62d595363d92c84d4
bool net_tx_pkt_parse(struct NetTxPkt *pkt) { return net_tx_pkt_parse_headers(pkt) && net_tx_pkt_rebuild_payload(pkt); }
{ "code": [], "line_no": [] }
bool FUNC_0(struct NetTxPkt *pkt) { return net_tx_pkt_parse_headers(pkt) && net_tx_pkt_rebuild_payload(pkt); }
[ "bool FUNC_0(struct NetTxPkt *pkt)\n{", "return net_tx_pkt_parse_headers(pkt) &&\nnet_tx_pkt_rebuild_payload(pkt);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9 ] ]
15,035
CPUState *ppc405ep_init (target_phys_addr_t ram_bases[2], target_phys_addr_t ram_sizes[2], uint32_t sysclk, qemu_irq **picp, int do_init) { clk_setup_t clk_setup[PPC405EP_CLK_NB], tlb_clk_setup; qemu_irq dma_irqs[4], gpt_irqs[5], mal_irqs[4]; CPUState *env; qemu_irq *pic, *irqs; memset(clk_setup, 0, sizeof(clk_setup)); /* init CPUs */ env = ppc4xx_init("405ep", &clk_setup[PPC405EP_CPU_CLK], &tlb_clk_setup, sysclk); clk_setup[PPC405EP_CPU_CLK].cb = tlb_clk_setup.cb; clk_setup[PPC405EP_CPU_CLK].opaque = tlb_clk_setup.opaque; /* Internal devices init */ /* Memory mapped devices registers */ /* PLB arbitrer */ ppc4xx_plb_init(env); /* PLB to OPB bridge */ ppc4xx_pob_init(env); /* OBP arbitrer */ ppc4xx_opba_init(0xef600600); /* Universal interrupt controller */ irqs = g_malloc0(sizeof(qemu_irq) * PPCUIC_OUTPUT_NB); irqs[PPCUIC_OUTPUT_INT] = ((qemu_irq *)env->irq_inputs)[PPC40x_INPUT_INT]; irqs[PPCUIC_OUTPUT_CINT] = ((qemu_irq *)env->irq_inputs)[PPC40x_INPUT_CINT]; pic = ppcuic_init(env, irqs, 0x0C0, 0, 1); *picp = pic; /* SDRAM controller */ /* XXX 405EP has no ECC interrupt */ ppc4xx_sdram_init(env, pic[17], 2, ram_bases, ram_sizes, do_init); /* External bus controller */ ppc405_ebc_init(env); /* DMA controller */ dma_irqs[0] = pic[5]; dma_irqs[1] = pic[6]; dma_irqs[2] = pic[7]; dma_irqs[3] = pic[8]; ppc405_dma_init(env, dma_irqs); /* IIC controller */ ppc405_i2c_init(0xef600500, pic[2]); /* GPIO */ ppc405_gpio_init(0xef600700); /* Serial ports */ if (serial_hds[0] != NULL) { serial_mm_init(0xef600300, 0, pic[0], PPC_SERIAL_MM_BAUDBASE, serial_hds[0], 1, 1); } if (serial_hds[1] != NULL) { serial_mm_init(0xef600400, 0, pic[1], PPC_SERIAL_MM_BAUDBASE, serial_hds[1], 1, 1); } /* OCM */ ppc405_ocm_init(env); /* GPT */ gpt_irqs[0] = pic[19]; gpt_irqs[1] = pic[20]; gpt_irqs[2] = pic[21]; gpt_irqs[3] = pic[22]; gpt_irqs[4] = pic[23]; ppc4xx_gpt_init(0xef600000, gpt_irqs); /* PCI */ /* Uses pic[3], pic[16], pic[18] */ /* MAL */ mal_irqs[0] = pic[11]; mal_irqs[1] = pic[12]; mal_irqs[2] = pic[13]; mal_irqs[3] = pic[14]; ppc405_mal_init(env, mal_irqs); /* Ethernet */ /* Uses pic[9], pic[15], pic[17] */ /* CPU control */ ppc405ep_cpc_init(env, clk_setup, sysclk); return env; }
false
qemu
b6dcbe086c77ec683f5ff0b693593cda1d61f3a1
CPUState *ppc405ep_init (target_phys_addr_t ram_bases[2], target_phys_addr_t ram_sizes[2], uint32_t sysclk, qemu_irq **picp, int do_init) { clk_setup_t clk_setup[PPC405EP_CLK_NB], tlb_clk_setup; qemu_irq dma_irqs[4], gpt_irqs[5], mal_irqs[4]; CPUState *env; qemu_irq *pic, *irqs; memset(clk_setup, 0, sizeof(clk_setup)); env = ppc4xx_init("405ep", &clk_setup[PPC405EP_CPU_CLK], &tlb_clk_setup, sysclk); clk_setup[PPC405EP_CPU_CLK].cb = tlb_clk_setup.cb; clk_setup[PPC405EP_CPU_CLK].opaque = tlb_clk_setup.opaque; ppc4xx_plb_init(env); ppc4xx_pob_init(env); ppc4xx_opba_init(0xef600600); irqs = g_malloc0(sizeof(qemu_irq) * PPCUIC_OUTPUT_NB); irqs[PPCUIC_OUTPUT_INT] = ((qemu_irq *)env->irq_inputs)[PPC40x_INPUT_INT]; irqs[PPCUIC_OUTPUT_CINT] = ((qemu_irq *)env->irq_inputs)[PPC40x_INPUT_CINT]; pic = ppcuic_init(env, irqs, 0x0C0, 0, 1); *picp = pic; ppc4xx_sdram_init(env, pic[17], 2, ram_bases, ram_sizes, do_init); ppc405_ebc_init(env); dma_irqs[0] = pic[5]; dma_irqs[1] = pic[6]; dma_irqs[2] = pic[7]; dma_irqs[3] = pic[8]; ppc405_dma_init(env, dma_irqs); ppc405_i2c_init(0xef600500, pic[2]); ppc405_gpio_init(0xef600700); if (serial_hds[0] != NULL) { serial_mm_init(0xef600300, 0, pic[0], PPC_SERIAL_MM_BAUDBASE, serial_hds[0], 1, 1); } if (serial_hds[1] != NULL) { serial_mm_init(0xef600400, 0, pic[1], PPC_SERIAL_MM_BAUDBASE, serial_hds[1], 1, 1); } ppc405_ocm_init(env); gpt_irqs[0] = pic[19]; gpt_irqs[1] = pic[20]; gpt_irqs[2] = pic[21]; gpt_irqs[3] = pic[22]; gpt_irqs[4] = pic[23]; ppc4xx_gpt_init(0xef600000, gpt_irqs); mal_irqs[0] = pic[11]; mal_irqs[1] = pic[12]; mal_irqs[2] = pic[13]; mal_irqs[3] = pic[14]; ppc405_mal_init(env, mal_irqs); ppc405ep_cpc_init(env, clk_setup, sysclk); return env; }
{ "code": [], "line_no": [] }
CPUState *FUNC_0 (target_phys_addr_t ram_bases[2], target_phys_addr_t ram_sizes[2], uint32_t sysclk, qemu_irq **picp, int do_init) { clk_setup_t clk_setup[PPC405EP_CLK_NB], tlb_clk_setup; qemu_irq dma_irqs[4], gpt_irqs[5], mal_irqs[4]; CPUState *env; qemu_irq *pic, *irqs; memset(clk_setup, 0, sizeof(clk_setup)); env = ppc4xx_init("405ep", &clk_setup[PPC405EP_CPU_CLK], &tlb_clk_setup, sysclk); clk_setup[PPC405EP_CPU_CLK].cb = tlb_clk_setup.cb; clk_setup[PPC405EP_CPU_CLK].opaque = tlb_clk_setup.opaque; ppc4xx_plb_init(env); ppc4xx_pob_init(env); ppc4xx_opba_init(0xef600600); irqs = g_malloc0(sizeof(qemu_irq) * PPCUIC_OUTPUT_NB); irqs[PPCUIC_OUTPUT_INT] = ((qemu_irq *)env->irq_inputs)[PPC40x_INPUT_INT]; irqs[PPCUIC_OUTPUT_CINT] = ((qemu_irq *)env->irq_inputs)[PPC40x_INPUT_CINT]; pic = ppcuic_init(env, irqs, 0x0C0, 0, 1); *picp = pic; ppc4xx_sdram_init(env, pic[17], 2, ram_bases, ram_sizes, do_init); ppc405_ebc_init(env); dma_irqs[0] = pic[5]; dma_irqs[1] = pic[6]; dma_irqs[2] = pic[7]; dma_irqs[3] = pic[8]; ppc405_dma_init(env, dma_irqs); ppc405_i2c_init(0xef600500, pic[2]); ppc405_gpio_init(0xef600700); if (serial_hds[0] != NULL) { serial_mm_init(0xef600300, 0, pic[0], PPC_SERIAL_MM_BAUDBASE, serial_hds[0], 1, 1); } if (serial_hds[1] != NULL) { serial_mm_init(0xef600400, 0, pic[1], PPC_SERIAL_MM_BAUDBASE, serial_hds[1], 1, 1); } ppc405_ocm_init(env); gpt_irqs[0] = pic[19]; gpt_irqs[1] = pic[20]; gpt_irqs[2] = pic[21]; gpt_irqs[3] = pic[22]; gpt_irqs[4] = pic[23]; ppc4xx_gpt_init(0xef600000, gpt_irqs); mal_irqs[0] = pic[11]; mal_irqs[1] = pic[12]; mal_irqs[2] = pic[13]; mal_irqs[3] = pic[14]; ppc405_mal_init(env, mal_irqs); ppc405ep_cpc_init(env, clk_setup, sysclk); return env; }
[ "CPUState *FUNC_0 (target_phys_addr_t ram_bases[2],\ntarget_phys_addr_t ram_sizes[2],\nuint32_t sysclk, qemu_irq **picp,\nint do_init)\n{", "clk_setup_t clk_setup[PPC405EP_CLK_NB], tlb_clk_setup;", "qemu_irq dma_irqs[4], gpt_irqs[5], mal_irqs[4];", "CPUState *env;", "qemu_irq *pic, *irqs;", "memset(clk_setup, 0, sizeof(clk_setup));", "env = ppc4xx_init(\"405ep\", &clk_setup[PPC405EP_CPU_CLK],\n&tlb_clk_setup, sysclk);", "clk_setup[PPC405EP_CPU_CLK].cb = tlb_clk_setup.cb;", "clk_setup[PPC405EP_CPU_CLK].opaque = tlb_clk_setup.opaque;", "ppc4xx_plb_init(env);", "ppc4xx_pob_init(env);", "ppc4xx_opba_init(0xef600600);", "irqs = g_malloc0(sizeof(qemu_irq) * PPCUIC_OUTPUT_NB);", "irqs[PPCUIC_OUTPUT_INT] =\n((qemu_irq *)env->irq_inputs)[PPC40x_INPUT_INT];", "irqs[PPCUIC_OUTPUT_CINT] =\n((qemu_irq *)env->irq_inputs)[PPC40x_INPUT_CINT];", "pic = ppcuic_init(env, irqs, 0x0C0, 0, 1);", "*picp = pic;", "ppc4xx_sdram_init(env, pic[17], 2, ram_bases, ram_sizes, do_init);", "ppc405_ebc_init(env);", "dma_irqs[0] = pic[5];", "dma_irqs[1] = pic[6];", "dma_irqs[2] = pic[7];", "dma_irqs[3] = pic[8];", "ppc405_dma_init(env, dma_irqs);", "ppc405_i2c_init(0xef600500, pic[2]);", "ppc405_gpio_init(0xef600700);", "if (serial_hds[0] != NULL) {", "serial_mm_init(0xef600300, 0, pic[0], PPC_SERIAL_MM_BAUDBASE,\nserial_hds[0], 1, 1);", "}", "if (serial_hds[1] != NULL) {", "serial_mm_init(0xef600400, 0, pic[1], PPC_SERIAL_MM_BAUDBASE,\nserial_hds[1], 1, 1);", "}", "ppc405_ocm_init(env);", "gpt_irqs[0] = pic[19];", "gpt_irqs[1] = pic[20];", "gpt_irqs[2] = pic[21];", "gpt_irqs[3] = pic[22];", "gpt_irqs[4] = pic[23];", "ppc4xx_gpt_init(0xef600000, gpt_irqs);", "mal_irqs[0] = pic[11];", "mal_irqs[1] = pic[12];", "mal_irqs[2] = pic[13];", "mal_irqs[3] = pic[14];", "ppc405_mal_init(env, mal_irqs);", "ppc405ep_cpc_init(env, clk_setup, sysclk);", "return env;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 39 ], [ 43 ], [ 47 ], [ 51 ], [ 53, 55 ], [ 57, 59 ], [ 61 ], [ 63 ], [ 69 ], [ 73 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 89 ], [ 93 ], [ 97 ], [ 99, 101 ], [ 103 ], [ 105 ], [ 107, 109 ], [ 111 ], [ 115 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 153 ], [ 157 ], [ 159 ] ]
15,036
void address_space_sync_dirty_bitmap(AddressSpace *as) { FlatView *view; FlatRange *fr; view = as->current_map; FOR_EACH_FLAT_RANGE(fr, view) { MEMORY_LISTENER_UPDATE_REGION(fr, as, Forward, log_sync); } }
false
qemu
856d72454f03aea26fd61c728762ef9cd1d71512
void address_space_sync_dirty_bitmap(AddressSpace *as) { FlatView *view; FlatRange *fr; view = as->current_map; FOR_EACH_FLAT_RANGE(fr, view) { MEMORY_LISTENER_UPDATE_REGION(fr, as, Forward, log_sync); } }
{ "code": [], "line_no": [] }
void FUNC_0(AddressSpace *VAR_0) { FlatView *view; FlatRange *fr; view = VAR_0->current_map; FOR_EACH_FLAT_RANGE(fr, view) { MEMORY_LISTENER_UPDATE_REGION(fr, VAR_0, Forward, log_sync); } }
[ "void FUNC_0(AddressSpace *VAR_0)\n{", "FlatView *view;", "FlatRange *fr;", "view = VAR_0->current_map;", "FOR_EACH_FLAT_RANGE(fr, view) {", "MEMORY_LISTENER_UPDATE_REGION(fr, VAR_0, Forward, log_sync);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ] ]
15,037
static uint32_t nam_readb (void *opaque, uint32_t addr) { PCIAC97LinkState *d = opaque; AC97LinkState *s = &d->ac97; dolog ("U nam readb %#x\n", addr); s->cas = 0; return ~0U; }
false
qemu
10ee2aaa417d8d8978cdb2bbed55ebb152df5f6b
static uint32_t nam_readb (void *opaque, uint32_t addr) { PCIAC97LinkState *d = opaque; AC97LinkState *s = &d->ac97; dolog ("U nam readb %#x\n", addr); s->cas = 0; return ~0U; }
{ "code": [], "line_no": [] }
static uint32_t FUNC_0 (void *opaque, uint32_t addr) { PCIAC97LinkState *d = opaque; AC97LinkState *s = &d->ac97; dolog ("U nam readb %#x\n", addr); s->cas = 0; return ~0U; }
[ "static uint32_t FUNC_0 (void *opaque, uint32_t addr)\n{", "PCIAC97LinkState *d = opaque;", "AC97LinkState *s = &d->ac97;", "dolog (\"U nam readb %#x\\n\", addr);", "s->cas = 0;", "return ~0U;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ] ]
15,038
static target_ulong h_client_architecture_support(PowerPCCPU *cpu, sPAPRMachineState *spapr, target_ulong opcode, target_ulong *args) { /* Working address in data buffer */ target_ulong addr = ppc64_phys_to_real(args[0]); target_ulong ov_table; uint32_t cas_pvr; sPAPROptionVector *ov1_guest, *ov5_guest, *ov5_cas_old, *ov5_updates; bool guest_radix; Error *local_err = NULL; bool raw_mode_supported = false; cas_pvr = cas_check_pvr(spapr, cpu, &addr, &raw_mode_supported, &local_err); if (local_err) { error_report_err(local_err); return H_HARDWARE; } /* Update CPUs */ if (cpu->compat_pvr != cas_pvr) { ppc_set_compat_all(cas_pvr, &local_err); if (local_err) { /* We fail to set compat mode (likely because running with KVM PR), * but maybe we can fallback to raw mode if the guest supports it. */ if (!raw_mode_supported) { error_report_err(local_err); return H_HARDWARE; } local_err = NULL; } } /* For the future use: here @ov_table points to the first option vector */ ov_table = addr; ov1_guest = spapr_ovec_parse_vector(ov_table, 1); ov5_guest = spapr_ovec_parse_vector(ov_table, 5); if (spapr_ovec_test(ov5_guest, OV5_MMU_BOTH)) { error_report("guest requested hash and radix MMU, which is invalid."); exit(EXIT_FAILURE); } /* The radix/hash bit in byte 24 requires special handling: */ guest_radix = spapr_ovec_test(ov5_guest, OV5_MMU_RADIX_300); spapr_ovec_clear(ov5_guest, OV5_MMU_RADIX_300); /* * HPT resizing is a bit of a special case, because when enabled * we assume an HPT guest will support it until it says it * doesn't, instead of assuming it won't support it until it says * it does. Strictly speaking that approach could break for * guests which don't make a CAS call, but those are so old we * don't care about them. Without that assumption we'd have to * make at least a temporary allocation of an HPT sized for max * memory, which could be impossibly difficult under KVM HV if * maxram is large. */ if (!guest_radix && !spapr_ovec_test(ov5_guest, OV5_HPT_RESIZE)) { int maxshift = spapr_hpt_shift_for_ramsize(MACHINE(spapr)->maxram_size); if (spapr->resize_hpt == SPAPR_RESIZE_HPT_REQUIRED) { error_report( "h_client_architecture_support: Guest doesn't support HPT resizing, but resize-hpt=required"); exit(1); } if (spapr->htab_shift < maxshift) { /* Guest doesn't know about HPT resizing, so we * pre-emptively resize for the maximum permitted RAM. At * the point this is called, nothing should have been * entered into the existing HPT */ spapr_reallocate_hpt(spapr, maxshift, &error_fatal); if (kvm_enabled()) { /* For KVM PR, update the HPT pointer */ target_ulong sdr1 = (target_ulong)(uintptr_t)spapr->htab | (spapr->htab_shift - 18); kvmppc_update_sdr1(sdr1); } } } /* NOTE: there are actually a number of ov5 bits where input from the * guest is always zero, and the platform/QEMU enables them independently * of guest input. To model these properly we'd want some sort of mask, * but since they only currently apply to memory migration as defined * by LoPAPR 1.1, 14.5.4.8, which QEMU doesn't implement, we don't need * to worry about this for now. */ ov5_cas_old = spapr_ovec_clone(spapr->ov5_cas); /* also clear the radix/hash bit from the current ov5_cas bits to * be in sync with the newly ov5 bits. Else the radix bit will be * seen as being removed and this will generate a reset loop */ spapr_ovec_clear(ov5_cas_old, OV5_MMU_RADIX_300); /* full range of negotiated ov5 capabilities */ spapr_ovec_intersect(spapr->ov5_cas, spapr->ov5, ov5_guest); spapr_ovec_cleanup(ov5_guest); /* capabilities that have been added since CAS-generated guest reset. * if capabilities have since been removed, generate another reset */ ov5_updates = spapr_ovec_new(); spapr->cas_reboot = spapr_ovec_diff(ov5_updates, ov5_cas_old, spapr->ov5_cas); /* Now that processing is finished, set the radix/hash bit for the * guest if it requested a valid mode; otherwise terminate the boot. */ if (guest_radix) { if (kvm_enabled() && !kvmppc_has_cap_mmu_radix()) { error_report("Guest requested unavailable MMU mode (radix)."); exit(EXIT_FAILURE); } spapr_ovec_set(spapr->ov5_cas, OV5_MMU_RADIX_300); } else { if (kvm_enabled() && kvmppc_has_cap_mmu_radix() && !kvmppc_has_cap_mmu_hash_v3()) { error_report("Guest requested unavailable MMU mode (hash)."); exit(EXIT_FAILURE); } } spapr->cas_legacy_guest_workaround = !spapr_ovec_test(ov1_guest, OV1_PPC_3_00); if (!spapr->cas_reboot) { spapr->cas_reboot = (spapr_h_cas_compose_response(spapr, args[1], args[2], ov5_updates) != 0); } spapr_ovec_cleanup(ov5_updates); if (spapr->cas_reboot) { qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET); } else { /* If ppc_spapr_reset() did not set up a HPT but one is necessary * (because the guest isn't going to use radix) then set it up here. */ if ((spapr->patb_entry & PATBE1_GR) && !guest_radix) { /* legacy hash or new hash: */ spapr_setup_hpt_and_vrma(spapr); } } return H_SUCCESS; }
false
qemu
1ec26c757d5996468afcc0dced4fad04139574b3
static target_ulong h_client_architecture_support(PowerPCCPU *cpu, sPAPRMachineState *spapr, target_ulong opcode, target_ulong *args) { target_ulong addr = ppc64_phys_to_real(args[0]); target_ulong ov_table; uint32_t cas_pvr; sPAPROptionVector *ov1_guest, *ov5_guest, *ov5_cas_old, *ov5_updates; bool guest_radix; Error *local_err = NULL; bool raw_mode_supported = false; cas_pvr = cas_check_pvr(spapr, cpu, &addr, &raw_mode_supported, &local_err); if (local_err) { error_report_err(local_err); return H_HARDWARE; } if (cpu->compat_pvr != cas_pvr) { ppc_set_compat_all(cas_pvr, &local_err); if (local_err) { if (!raw_mode_supported) { error_report_err(local_err); return H_HARDWARE; } local_err = NULL; } } ov_table = addr; ov1_guest = spapr_ovec_parse_vector(ov_table, 1); ov5_guest = spapr_ovec_parse_vector(ov_table, 5); if (spapr_ovec_test(ov5_guest, OV5_MMU_BOTH)) { error_report("guest requested hash and radix MMU, which is invalid."); exit(EXIT_FAILURE); } guest_radix = spapr_ovec_test(ov5_guest, OV5_MMU_RADIX_300); spapr_ovec_clear(ov5_guest, OV5_MMU_RADIX_300); if (!guest_radix && !spapr_ovec_test(ov5_guest, OV5_HPT_RESIZE)) { int maxshift = spapr_hpt_shift_for_ramsize(MACHINE(spapr)->maxram_size); if (spapr->resize_hpt == SPAPR_RESIZE_HPT_REQUIRED) { error_report( "h_client_architecture_support: Guest doesn't support HPT resizing, but resize-hpt=required"); exit(1); } if (spapr->htab_shift < maxshift) { spapr_reallocate_hpt(spapr, maxshift, &error_fatal); if (kvm_enabled()) { target_ulong sdr1 = (target_ulong)(uintptr_t)spapr->htab | (spapr->htab_shift - 18); kvmppc_update_sdr1(sdr1); } } } ov5_cas_old = spapr_ovec_clone(spapr->ov5_cas); spapr_ovec_clear(ov5_cas_old, OV5_MMU_RADIX_300); spapr_ovec_intersect(spapr->ov5_cas, spapr->ov5, ov5_guest); spapr_ovec_cleanup(ov5_guest); ov5_updates = spapr_ovec_new(); spapr->cas_reboot = spapr_ovec_diff(ov5_updates, ov5_cas_old, spapr->ov5_cas); if (guest_radix) { if (kvm_enabled() && !kvmppc_has_cap_mmu_radix()) { error_report("Guest requested unavailable MMU mode (radix)."); exit(EXIT_FAILURE); } spapr_ovec_set(spapr->ov5_cas, OV5_MMU_RADIX_300); } else { if (kvm_enabled() && kvmppc_has_cap_mmu_radix() && !kvmppc_has_cap_mmu_hash_v3()) { error_report("Guest requested unavailable MMU mode (hash)."); exit(EXIT_FAILURE); } } spapr->cas_legacy_guest_workaround = !spapr_ovec_test(ov1_guest, OV1_PPC_3_00); if (!spapr->cas_reboot) { spapr->cas_reboot = (spapr_h_cas_compose_response(spapr, args[1], args[2], ov5_updates) != 0); } spapr_ovec_cleanup(ov5_updates); if (spapr->cas_reboot) { qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET); } else { if ((spapr->patb_entry & PATBE1_GR) && !guest_radix) { spapr_setup_hpt_and_vrma(spapr); } } return H_SUCCESS; }
{ "code": [], "line_no": [] }
static target_ulong FUNC_0(PowerPCCPU *cpu, sPAPRMachineState *spapr, target_ulong opcode, target_ulong *args) { target_ulong addr = ppc64_phys_to_real(args[0]); target_ulong ov_table; uint32_t cas_pvr; sPAPROptionVector *ov1_guest, *ov5_guest, *ov5_cas_old, *ov5_updates; bool guest_radix; Error *local_err = NULL; bool raw_mode_supported = false; cas_pvr = cas_check_pvr(spapr, cpu, &addr, &raw_mode_supported, &local_err); if (local_err) { error_report_err(local_err); return H_HARDWARE; } if (cpu->compat_pvr != cas_pvr) { ppc_set_compat_all(cas_pvr, &local_err); if (local_err) { if (!raw_mode_supported) { error_report_err(local_err); return H_HARDWARE; } local_err = NULL; } } ov_table = addr; ov1_guest = spapr_ovec_parse_vector(ov_table, 1); ov5_guest = spapr_ovec_parse_vector(ov_table, 5); if (spapr_ovec_test(ov5_guest, OV5_MMU_BOTH)) { error_report("guest requested hash and radix MMU, which is invalid."); exit(EXIT_FAILURE); } guest_radix = spapr_ovec_test(ov5_guest, OV5_MMU_RADIX_300); spapr_ovec_clear(ov5_guest, OV5_MMU_RADIX_300); if (!guest_radix && !spapr_ovec_test(ov5_guest, OV5_HPT_RESIZE)) { int VAR_0 = spapr_hpt_shift_for_ramsize(MACHINE(spapr)->maxram_size); if (spapr->resize_hpt == SPAPR_RESIZE_HPT_REQUIRED) { error_report( "FUNC_0: Guest doesn't support HPT resizing, but resize-hpt=required"); exit(1); } if (spapr->htab_shift < VAR_0) { spapr_reallocate_hpt(spapr, VAR_0, &error_fatal); if (kvm_enabled()) { target_ulong sdr1 = (target_ulong)(uintptr_t)spapr->htab | (spapr->htab_shift - 18); kvmppc_update_sdr1(sdr1); } } } ov5_cas_old = spapr_ovec_clone(spapr->ov5_cas); spapr_ovec_clear(ov5_cas_old, OV5_MMU_RADIX_300); spapr_ovec_intersect(spapr->ov5_cas, spapr->ov5, ov5_guest); spapr_ovec_cleanup(ov5_guest); ov5_updates = spapr_ovec_new(); spapr->cas_reboot = spapr_ovec_diff(ov5_updates, ov5_cas_old, spapr->ov5_cas); if (guest_radix) { if (kvm_enabled() && !kvmppc_has_cap_mmu_radix()) { error_report("Guest requested unavailable MMU mode (radix)."); exit(EXIT_FAILURE); } spapr_ovec_set(spapr->ov5_cas, OV5_MMU_RADIX_300); } else { if (kvm_enabled() && kvmppc_has_cap_mmu_radix() && !kvmppc_has_cap_mmu_hash_v3()) { error_report("Guest requested unavailable MMU mode (hash)."); exit(EXIT_FAILURE); } } spapr->cas_legacy_guest_workaround = !spapr_ovec_test(ov1_guest, OV1_PPC_3_00); if (!spapr->cas_reboot) { spapr->cas_reboot = (spapr_h_cas_compose_response(spapr, args[1], args[2], ov5_updates) != 0); } spapr_ovec_cleanup(ov5_updates); if (spapr->cas_reboot) { qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET); } else { if ((spapr->patb_entry & PATBE1_GR) && !guest_radix) { spapr_setup_hpt_and_vrma(spapr); } } return H_SUCCESS; }
[ "static target_ulong FUNC_0(PowerPCCPU *cpu,\nsPAPRMachineState *spapr,\ntarget_ulong opcode,\ntarget_ulong *args)\n{", "target_ulong addr = ppc64_phys_to_real(args[0]);", "target_ulong ov_table;", "uint32_t cas_pvr;", "sPAPROptionVector *ov1_guest, *ov5_guest, *ov5_cas_old, *ov5_updates;", "bool guest_radix;", "Error *local_err = NULL;", "bool raw_mode_supported = false;", "cas_pvr = cas_check_pvr(spapr, cpu, &addr, &raw_mode_supported, &local_err);", "if (local_err) {", "error_report_err(local_err);", "return H_HARDWARE;", "}", "if (cpu->compat_pvr != cas_pvr) {", "ppc_set_compat_all(cas_pvr, &local_err);", "if (local_err) {", "if (!raw_mode_supported) {", "error_report_err(local_err);", "return H_HARDWARE;", "}", "local_err = NULL;", "}", "}", "ov_table = addr;", "ov1_guest = spapr_ovec_parse_vector(ov_table, 1);", "ov5_guest = spapr_ovec_parse_vector(ov_table, 5);", "if (spapr_ovec_test(ov5_guest, OV5_MMU_BOTH)) {", "error_report(\"guest requested hash and radix MMU, which is invalid.\");", "exit(EXIT_FAILURE);", "}", "guest_radix = spapr_ovec_test(ov5_guest, OV5_MMU_RADIX_300);", "spapr_ovec_clear(ov5_guest, OV5_MMU_RADIX_300);", "if (!guest_radix && !spapr_ovec_test(ov5_guest, OV5_HPT_RESIZE)) {", "int VAR_0 = spapr_hpt_shift_for_ramsize(MACHINE(spapr)->maxram_size);", "if (spapr->resize_hpt == SPAPR_RESIZE_HPT_REQUIRED) {", "error_report(\n\"FUNC_0: Guest doesn't support HPT resizing, but resize-hpt=required\");", "exit(1);", "}", "if (spapr->htab_shift < VAR_0) {", "spapr_reallocate_hpt(spapr, VAR_0, &error_fatal);", "if (kvm_enabled()) {", "target_ulong sdr1 = (target_ulong)(uintptr_t)spapr->htab\n| (spapr->htab_shift - 18);", "kvmppc_update_sdr1(sdr1);", "}", "}", "}", "ov5_cas_old = spapr_ovec_clone(spapr->ov5_cas);", "spapr_ovec_clear(ov5_cas_old, OV5_MMU_RADIX_300);", "spapr_ovec_intersect(spapr->ov5_cas, spapr->ov5, ov5_guest);", "spapr_ovec_cleanup(ov5_guest);", "ov5_updates = spapr_ovec_new();", "spapr->cas_reboot = spapr_ovec_diff(ov5_updates,\nov5_cas_old, spapr->ov5_cas);", "if (guest_radix) {", "if (kvm_enabled() && !kvmppc_has_cap_mmu_radix()) {", "error_report(\"Guest requested unavailable MMU mode (radix).\");", "exit(EXIT_FAILURE);", "}", "spapr_ovec_set(spapr->ov5_cas, OV5_MMU_RADIX_300);", "} else {", "if (kvm_enabled() && kvmppc_has_cap_mmu_radix()\n&& !kvmppc_has_cap_mmu_hash_v3()) {", "error_report(\"Guest requested unavailable MMU mode (hash).\");", "exit(EXIT_FAILURE);", "}", "}", "spapr->cas_legacy_guest_workaround = !spapr_ovec_test(ov1_guest,\nOV1_PPC_3_00);", "if (!spapr->cas_reboot) {", "spapr->cas_reboot =\n(spapr_h_cas_compose_response(spapr, args[1], args[2],\nov5_updates) != 0);", "}", "spapr_ovec_cleanup(ov5_updates);", "if (spapr->cas_reboot) {", "qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);", "} else {", "if ((spapr->patb_entry & PATBE1_GR) && !guest_radix) {", "spapr_setup_hpt_and_vrma(spapr);", "}", "}", "return H_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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 43 ], [ 45 ], [ 47 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 73 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 91 ], [ 93 ], [ 119 ], [ 121 ], [ 125 ], [ 127, 129 ], [ 131 ], [ 133 ], [ 137 ], [ 147 ], [ 149 ], [ 153, 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 181 ], [ 193 ], [ 199 ], [ 201 ], [ 209 ], [ 211, 213 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233, 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245, 247 ], [ 249 ], [ 251, 253, 255 ], [ 257 ], [ 259 ], [ 263 ], [ 265 ], [ 267 ], [ 273 ], [ 277 ], [ 279 ], [ 281 ], [ 285 ], [ 287 ] ]
15,039
static int mode_sense_page(SCSIDiskState *s, int page, uint8_t **p_outbuf, int page_control) { static const int mode_sense_valid[0x3f] = { [MODE_PAGE_HD_GEOMETRY] = (1 << TYPE_DISK), [MODE_PAGE_FLEXIBLE_DISK_GEOMETRY] = (1 << TYPE_DISK), [MODE_PAGE_CACHING] = (1 << TYPE_DISK) | (1 << TYPE_ROM), [MODE_PAGE_CAPABILITIES] = (1 << TYPE_ROM), }; BlockDriverState *bdrv = s->bs; int cylinders, heads, secs; uint8_t *p = *p_outbuf; if ((mode_sense_valid[page] & (1 << s->qdev.type)) == 0) { return -1; } p[0] = page; /* * If Changeable Values are requested, a mask denoting those mode parameters * that are changeable shall be returned. As we currently don't support * parameter changes via MODE_SELECT all bits are returned set to zero. * The buffer was already menset to zero by the caller of this function. */ switch (page) { case MODE_PAGE_HD_GEOMETRY: p[1] = 0x16; if (page_control == 1) { /* Changeable Values */ break; } /* if a geometry hint is available, use it */ bdrv_get_geometry_hint(bdrv, &cylinders, &heads, &secs); p[2] = (cylinders >> 16) & 0xff; p[3] = (cylinders >> 8) & 0xff; p[4] = cylinders & 0xff; p[5] = heads & 0xff; /* Write precomp start cylinder, disabled */ p[6] = (cylinders >> 16) & 0xff; p[7] = (cylinders >> 8) & 0xff; p[8] = cylinders & 0xff; /* Reduced current start cylinder, disabled */ p[9] = (cylinders >> 16) & 0xff; p[10] = (cylinders >> 8) & 0xff; p[11] = cylinders & 0xff; /* Device step rate [ns], 200ns */ p[12] = 0; p[13] = 200; /* Landing zone cylinder */ p[14] = 0xff; p[15] = 0xff; p[16] = 0xff; /* Medium rotation rate [rpm], 5400 rpm */ p[20] = (5400 >> 8) & 0xff; p[21] = 5400 & 0xff; break; case MODE_PAGE_FLEXIBLE_DISK_GEOMETRY: p[1] = 0x1e; if (page_control == 1) { /* Changeable Values */ break; } /* Transfer rate [kbit/s], 5Mbit/s */ p[2] = 5000 >> 8; p[3] = 5000 & 0xff; /* if a geometry hint is available, use it */ bdrv_get_geometry_hint(bdrv, &cylinders, &heads, &secs); p[4] = heads & 0xff; p[5] = secs & 0xff; p[6] = s->cluster_size * 2; p[8] = (cylinders >> 8) & 0xff; p[9] = cylinders & 0xff; /* Write precomp start cylinder, disabled */ p[10] = (cylinders >> 8) & 0xff; p[11] = cylinders & 0xff; /* Reduced current start cylinder, disabled */ p[12] = (cylinders >> 8) & 0xff; p[13] = cylinders & 0xff; /* Device step rate [100us], 100us */ p[14] = 0; p[15] = 1; /* Device step pulse width [us], 1us */ p[16] = 1; /* Device head settle delay [100us], 100us */ p[17] = 0; p[18] = 1; /* Motor on delay [0.1s], 0.1s */ p[19] = 1; /* Motor off delay [0.1s], 0.1s */ p[20] = 1; /* Medium rotation rate [rpm], 5400 rpm */ p[28] = (5400 >> 8) & 0xff; p[29] = 5400 & 0xff; break; case MODE_PAGE_CACHING: p[0] = 8; p[1] = 0x12; if (page_control == 1) { /* Changeable Values */ break; } if (bdrv_enable_write_cache(s->bs)) { p[2] = 4; /* WCE */ } break; case MODE_PAGE_CAPABILITIES: p[1] = 0x14; if (page_control == 1) { /* Changeable Values */ break; } p[2] = 3; // CD-R & CD-RW read p[3] = 0; // Writing not supported p[4] = 0x7f; /* Audio, composite, digital out, mode 2 form 1&2, multi session */ p[5] = 0xff; /* CD DA, DA accurate, RW supported, RW corrected, C2 errors, ISRC, UPC, Bar code */ p[6] = 0x2d | (s->tray_locked ? 2 : 0); /* Locking supported, jumper present, eject, tray */ p[7] = 0; /* no volume & mute control, no changer */ p[8] = (50 * 176) >> 8; // 50x read speed p[9] = (50 * 176) & 0xff; p[10] = 0 >> 8; // No volume p[11] = 0 & 0xff; p[12] = 2048 >> 8; // 2M buffer p[13] = 2048 & 0xff; p[14] = (16 * 176) >> 8; // 16x read speed current p[15] = (16 * 176) & 0xff; p[18] = (16 * 176) >> 8; // 16x write speed p[19] = (16 * 176) & 0xff; p[20] = (16 * 176) >> 8; // 16x write speed current p[21] = (16 * 176) & 0xff; break; default: return -1; } *p_outbuf += p[1] + 2; return p[1] + 2; }
false
qemu
a07c7dcd6f33b668747148ac28c0e147f958aa18
static int mode_sense_page(SCSIDiskState *s, int page, uint8_t **p_outbuf, int page_control) { static const int mode_sense_valid[0x3f] = { [MODE_PAGE_HD_GEOMETRY] = (1 << TYPE_DISK), [MODE_PAGE_FLEXIBLE_DISK_GEOMETRY] = (1 << TYPE_DISK), [MODE_PAGE_CACHING] = (1 << TYPE_DISK) | (1 << TYPE_ROM), [MODE_PAGE_CAPABILITIES] = (1 << TYPE_ROM), }; BlockDriverState *bdrv = s->bs; int cylinders, heads, secs; uint8_t *p = *p_outbuf; if ((mode_sense_valid[page] & (1 << s->qdev.type)) == 0) { return -1; } p[0] = page; switch (page) { case MODE_PAGE_HD_GEOMETRY: p[1] = 0x16; if (page_control == 1) { break; } bdrv_get_geometry_hint(bdrv, &cylinders, &heads, &secs); p[2] = (cylinders >> 16) & 0xff; p[3] = (cylinders >> 8) & 0xff; p[4] = cylinders & 0xff; p[5] = heads & 0xff; p[6] = (cylinders >> 16) & 0xff; p[7] = (cylinders >> 8) & 0xff; p[8] = cylinders & 0xff; p[9] = (cylinders >> 16) & 0xff; p[10] = (cylinders >> 8) & 0xff; p[11] = cylinders & 0xff; p[12] = 0; p[13] = 200; p[14] = 0xff; p[15] = 0xff; p[16] = 0xff; p[20] = (5400 >> 8) & 0xff; p[21] = 5400 & 0xff; break; case MODE_PAGE_FLEXIBLE_DISK_GEOMETRY: p[1] = 0x1e; if (page_control == 1) { break; } p[2] = 5000 >> 8; p[3] = 5000 & 0xff; bdrv_get_geometry_hint(bdrv, &cylinders, &heads, &secs); p[4] = heads & 0xff; p[5] = secs & 0xff; p[6] = s->cluster_size * 2; p[8] = (cylinders >> 8) & 0xff; p[9] = cylinders & 0xff; p[10] = (cylinders >> 8) & 0xff; p[11] = cylinders & 0xff; p[12] = (cylinders >> 8) & 0xff; p[13] = cylinders & 0xff; p[14] = 0; p[15] = 1; p[16] = 1; p[17] = 0; p[18] = 1; p[19] = 1; p[20] = 1; p[28] = (5400 >> 8) & 0xff; p[29] = 5400 & 0xff; break; case MODE_PAGE_CACHING: p[0] = 8; p[1] = 0x12; if (page_control == 1) { break; } if (bdrv_enable_write_cache(s->bs)) { p[2] = 4; } break; case MODE_PAGE_CAPABILITIES: p[1] = 0x14; if (page_control == 1) { break; } p[2] = 3; p[3] = 0; p[4] = 0x7f; p[5] = 0xff; p[6] = 0x2d | (s->tray_locked ? 2 : 0); p[7] = 0; p[8] = (50 * 176) >> 8; p[9] = (50 * 176) & 0xff; p[10] = 0 >> 8; p[11] = 0 & 0xff; p[12] = 2048 >> 8; p[13] = 2048 & 0xff; p[14] = (16 * 176) >> 8; p[15] = (16 * 176) & 0xff; p[18] = (16 * 176) >> 8; p[19] = (16 * 176) & 0xff; p[20] = (16 * 176) >> 8; current p[21] = (16 * 176) & 0xff; break; default: return -1; } *p_outbuf += p[1] + 2; return p[1] + 2; }
{ "code": [], "line_no": [] }
static int FUNC_0(SCSIDiskState *VAR_0, int VAR_1, uint8_t **VAR_2, int VAR_3) { static const int VAR_4[0x3f] = { [MODE_PAGE_HD_GEOMETRY] = (1 << TYPE_DISK), [MODE_PAGE_FLEXIBLE_DISK_GEOMETRY] = (1 << TYPE_DISK), [MODE_PAGE_CACHING] = (1 << TYPE_DISK) | (1 << TYPE_ROM), [MODE_PAGE_CAPABILITIES] = (1 << TYPE_ROM), }; BlockDriverState *bdrv = VAR_0->bs; int VAR_5, VAR_6, VAR_7; uint8_t *p = *VAR_2; if ((VAR_4[VAR_1] & (1 << VAR_0->qdev.type)) == 0) { return -1; } p[0] = VAR_1; switch (VAR_1) { case MODE_PAGE_HD_GEOMETRY: p[1] = 0x16; if (VAR_3 == 1) { break; } bdrv_get_geometry_hint(bdrv, &VAR_5, &VAR_6, &VAR_7); p[2] = (VAR_5 >> 16) & 0xff; p[3] = (VAR_5 >> 8) & 0xff; p[4] = VAR_5 & 0xff; p[5] = VAR_6 & 0xff; p[6] = (VAR_5 >> 16) & 0xff; p[7] = (VAR_5 >> 8) & 0xff; p[8] = VAR_5 & 0xff; p[9] = (VAR_5 >> 16) & 0xff; p[10] = (VAR_5 >> 8) & 0xff; p[11] = VAR_5 & 0xff; p[12] = 0; p[13] = 200; p[14] = 0xff; p[15] = 0xff; p[16] = 0xff; p[20] = (5400 >> 8) & 0xff; p[21] = 5400 & 0xff; break; case MODE_PAGE_FLEXIBLE_DISK_GEOMETRY: p[1] = 0x1e; if (VAR_3 == 1) { break; } p[2] = 5000 >> 8; p[3] = 5000 & 0xff; bdrv_get_geometry_hint(bdrv, &VAR_5, &VAR_6, &VAR_7); p[4] = VAR_6 & 0xff; p[5] = VAR_7 & 0xff; p[6] = VAR_0->cluster_size * 2; p[8] = (VAR_5 >> 8) & 0xff; p[9] = VAR_5 & 0xff; p[10] = (VAR_5 >> 8) & 0xff; p[11] = VAR_5 & 0xff; p[12] = (VAR_5 >> 8) & 0xff; p[13] = VAR_5 & 0xff; p[14] = 0; p[15] = 1; p[16] = 1; p[17] = 0; p[18] = 1; p[19] = 1; p[20] = 1; p[28] = (5400 >> 8) & 0xff; p[29] = 5400 & 0xff; break; case MODE_PAGE_CACHING: p[0] = 8; p[1] = 0x12; if (VAR_3 == 1) { break; } if (bdrv_enable_write_cache(VAR_0->bs)) { p[2] = 4; } break; case MODE_PAGE_CAPABILITIES: p[1] = 0x14; if (VAR_3 == 1) { break; } p[2] = 3; p[3] = 0; p[4] = 0x7f; p[5] = 0xff; p[6] = 0x2d | (VAR_0->tray_locked ? 2 : 0); p[7] = 0; p[8] = (50 * 176) >> 8; p[9] = (50 * 176) & 0xff; p[10] = 0 >> 8; p[11] = 0 & 0xff; p[12] = 2048 >> 8; p[13] = 2048 & 0xff; p[14] = (16 * 176) >> 8; p[15] = (16 * 176) & 0xff; p[18] = (16 * 176) >> 8; p[19] = (16 * 176) & 0xff; p[20] = (16 * 176) >> 8; current p[21] = (16 * 176) & 0xff; break; default: return -1; } *VAR_2 += p[1] + 2; return p[1] + 2; }
[ "static int FUNC_0(SCSIDiskState *VAR_0, int VAR_1, uint8_t **VAR_2,\nint VAR_3)\n{", "static const int VAR_4[0x3f] = {", "[MODE_PAGE_HD_GEOMETRY] = (1 << TYPE_DISK),\n[MODE_PAGE_FLEXIBLE_DISK_GEOMETRY] = (1 << TYPE_DISK),\n[MODE_PAGE_CACHING] = (1 << TYPE_DISK) | (1 << TYPE_ROM),\n[MODE_PAGE_CAPABILITIES] = (1 << TYPE_ROM),\n};", "BlockDriverState *bdrv = VAR_0->bs;", "int VAR_5, VAR_6, VAR_7;", "uint8_t *p = *VAR_2;", "if ((VAR_4[VAR_1] & (1 << VAR_0->qdev.type)) == 0) {", "return -1;", "}", "p[0] = VAR_1;", "switch (VAR_1) {", "case MODE_PAGE_HD_GEOMETRY:\np[1] = 0x16;", "if (VAR_3 == 1) {", "break;", "}", "bdrv_get_geometry_hint(bdrv, &VAR_5, &VAR_6, &VAR_7);", "p[2] = (VAR_5 >> 16) & 0xff;", "p[3] = (VAR_5 >> 8) & 0xff;", "p[4] = VAR_5 & 0xff;", "p[5] = VAR_6 & 0xff;", "p[6] = (VAR_5 >> 16) & 0xff;", "p[7] = (VAR_5 >> 8) & 0xff;", "p[8] = VAR_5 & 0xff;", "p[9] = (VAR_5 >> 16) & 0xff;", "p[10] = (VAR_5 >> 8) & 0xff;", "p[11] = VAR_5 & 0xff;", "p[12] = 0;", "p[13] = 200;", "p[14] = 0xff;", "p[15] = 0xff;", "p[16] = 0xff;", "p[20] = (5400 >> 8) & 0xff;", "p[21] = 5400 & 0xff;", "break;", "case MODE_PAGE_FLEXIBLE_DISK_GEOMETRY:\np[1] = 0x1e;", "if (VAR_3 == 1) {", "break;", "}", "p[2] = 5000 >> 8;", "p[3] = 5000 & 0xff;", "bdrv_get_geometry_hint(bdrv, &VAR_5, &VAR_6, &VAR_7);", "p[4] = VAR_6 & 0xff;", "p[5] = VAR_7 & 0xff;", "p[6] = VAR_0->cluster_size * 2;", "p[8] = (VAR_5 >> 8) & 0xff;", "p[9] = VAR_5 & 0xff;", "p[10] = (VAR_5 >> 8) & 0xff;", "p[11] = VAR_5 & 0xff;", "p[12] = (VAR_5 >> 8) & 0xff;", "p[13] = VAR_5 & 0xff;", "p[14] = 0;", "p[15] = 1;", "p[16] = 1;", "p[17] = 0;", "p[18] = 1;", "p[19] = 1;", "p[20] = 1;", "p[28] = (5400 >> 8) & 0xff;", "p[29] = 5400 & 0xff;", "break;", "case MODE_PAGE_CACHING:\np[0] = 8;", "p[1] = 0x12;", "if (VAR_3 == 1) {", "break;", "}", "if (bdrv_enable_write_cache(VAR_0->bs)) {", "p[2] = 4;", "}", "break;", "case MODE_PAGE_CAPABILITIES:\np[1] = 0x14;", "if (VAR_3 == 1) {", "break;", "}", "p[2] = 3;", "p[3] = 0;", "p[4] = 0x7f;", "p[5] = 0xff;", "p[6] = 0x2d | (VAR_0->tray_locked ? 2 : 0);", "p[7] = 0;", "p[8] = (50 * 176) >> 8;", "p[9] = (50 * 176) & 0xff;", "p[10] = 0 >> 8;", "p[11] = 0 & 0xff;", "p[12] = 2048 >> 8;", "p[13] = 2048 & 0xff;", "p[14] = (16 * 176) >> 8;", "p[15] = (16 * 176) & 0xff;", "p[18] = (16 * 176) >> 8;", "p[19] = (16 * 176) & 0xff;", "p[20] = (16 * 176) >> 8; current", "p[21] = (16 * 176) & 0xff;", "break;", "default:\nreturn -1;", "}", "*VAR_2 += p[1] + 2;", "return p[1] + 2;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9, 11, 13, 15, 17 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 53 ], [ 55, 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ], [ 83 ], [ 87 ], [ 89 ], [ 91 ], [ 95 ], [ 97 ], [ 101 ], [ 103 ], [ 105 ], [ 109 ], [ 111 ], [ 113 ], [ 117, 119 ], [ 121 ], [ 123 ], [ 125 ], [ 129 ], [ 131 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 149 ], [ 151 ], [ 155 ], [ 157 ], [ 161 ], [ 163 ], [ 167 ], [ 171 ], [ 173 ], [ 177 ], [ 181 ], [ 185 ], [ 187 ], [ 189 ], [ 193, 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 215, 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 233 ], [ 239 ], [ 243 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 275, 277 ], [ 279 ], [ 283 ], [ 285 ], [ 287 ] ]
15,040
int cpu_get_memory_mapping(MemoryMappingList *list, CPUArchState *env) { if (!(env->cr[0] & CR0_PG_MASK)) { /* paging is disabled */ return 0; } if (env->cr[4] & CR4_PAE_MASK) { #ifdef TARGET_X86_64 if (env->hflags & HF_LMA_MASK) { target_phys_addr_t pml4e_addr; pml4e_addr = (env->cr[3] & ~0xfff) & env->a20_mask; walk_pml4e(list, pml4e_addr, env->a20_mask); } else #endif { target_phys_addr_t pdpe_addr; pdpe_addr = (env->cr[3] & ~0x1f) & env->a20_mask; walk_pdpe2(list, pdpe_addr, env->a20_mask); } } else { target_phys_addr_t pde_addr; bool pse; pde_addr = (env->cr[3] & ~0xfff) & env->a20_mask; pse = !!(env->cr[4] & CR4_PSE_MASK); walk_pde2(list, pde_addr, env->a20_mask, pse); } return 0; }
false
qemu
31a2207a8e1c39bcf88e527ac62f4e12316920a4
int cpu_get_memory_mapping(MemoryMappingList *list, CPUArchState *env) { if (!(env->cr[0] & CR0_PG_MASK)) { return 0; } if (env->cr[4] & CR4_PAE_MASK) { #ifdef TARGET_X86_64 if (env->hflags & HF_LMA_MASK) { target_phys_addr_t pml4e_addr; pml4e_addr = (env->cr[3] & ~0xfff) & env->a20_mask; walk_pml4e(list, pml4e_addr, env->a20_mask); } else #endif { target_phys_addr_t pdpe_addr; pdpe_addr = (env->cr[3] & ~0x1f) & env->a20_mask; walk_pdpe2(list, pdpe_addr, env->a20_mask); } } else { target_phys_addr_t pde_addr; bool pse; pde_addr = (env->cr[3] & ~0xfff) & env->a20_mask; pse = !!(env->cr[4] & CR4_PSE_MASK); walk_pde2(list, pde_addr, env->a20_mask, pse); } return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(MemoryMappingList *VAR_0, CPUArchState *VAR_1) { if (!(VAR_1->cr[0] & CR0_PG_MASK)) { return 0; } if (VAR_1->cr[4] & CR4_PAE_MASK) { #ifdef TARGET_X86_64 if (VAR_1->hflags & HF_LMA_MASK) { target_phys_addr_t pml4e_addr; pml4e_addr = (VAR_1->cr[3] & ~0xfff) & VAR_1->a20_mask; walk_pml4e(VAR_0, pml4e_addr, VAR_1->a20_mask); } else #endif { target_phys_addr_t pdpe_addr; pdpe_addr = (VAR_1->cr[3] & ~0x1f) & VAR_1->a20_mask; walk_pdpe2(VAR_0, pdpe_addr, VAR_1->a20_mask); } } else { target_phys_addr_t pde_addr; bool pse; pde_addr = (VAR_1->cr[3] & ~0xfff) & VAR_1->a20_mask; pse = !!(VAR_1->cr[4] & CR4_PSE_MASK); walk_pde2(VAR_0, pde_addr, VAR_1->a20_mask, pse); } return 0; }
[ "int FUNC_0(MemoryMappingList *VAR_0, CPUArchState *VAR_1)\n{", "if (!(VAR_1->cr[0] & CR0_PG_MASK)) {", "return 0;", "}", "if (VAR_1->cr[4] & CR4_PAE_MASK) {", "#ifdef TARGET_X86_64\nif (VAR_1->hflags & HF_LMA_MASK) {", "target_phys_addr_t pml4e_addr;", "pml4e_addr = (VAR_1->cr[3] & ~0xfff) & VAR_1->a20_mask;", "walk_pml4e(VAR_0, pml4e_addr, VAR_1->a20_mask);", "} else", "#endif\n{", "target_phys_addr_t pdpe_addr;", "pdpe_addr = (VAR_1->cr[3] & ~0x1f) & VAR_1->a20_mask;", "walk_pdpe2(VAR_0, pdpe_addr, VAR_1->a20_mask);", "}", "} else {", "target_phys_addr_t pde_addr;", "bool pse;", "pde_addr = (VAR_1->cr[3] & ~0xfff) & VAR_1->a20_mask;", "pse = !!(VAR_1->cr[4] & CR4_PSE_MASK);", "walk_pde2(VAR_0, pde_addr, VAR_1->a20_mask, pse);", "}", "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 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 15 ], [ 17, 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ] ]
15,042
void ff_h264_filter_mb_fast( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize) { MpegEncContext * const s = &h->s; int mb_xy; int mb_type, left_type, top_type; int qp, qp0, qp1, qpc, qpc0, qpc1, qp_thresh; int chroma = !(CONFIG_GRAY && (s->flags&CODEC_FLAG_GRAY)); int chroma444 = CHROMA444; mb_xy = h->mb_xy; if(!h->h264dsp.h264_loop_filter_strength || h->pps.chroma_qp_diff) { ff_h264_filter_mb(h, mb_x, mb_y, img_y, img_cb, img_cr, linesize, uvlinesize); return; } assert(!FRAME_MBAFF); left_type= h->left_type[LTOP]; top_type= h->top_type; mb_type = s->current_picture.mb_type[mb_xy]; qp = s->current_picture.qscale_table[mb_xy]; qp0 = s->current_picture.qscale_table[mb_xy-1]; qp1 = s->current_picture.qscale_table[h->top_mb_xy]; qpc = get_chroma_qp( h, 0, qp ); qpc0 = get_chroma_qp( h, 0, qp0 ); qpc1 = get_chroma_qp( h, 0, qp1 ); qp0 = (qp + qp0 + 1) >> 1; qp1 = (qp + qp1 + 1) >> 1; qpc0 = (qpc + qpc0 + 1) >> 1; qpc1 = (qpc + qpc1 + 1) >> 1; qp_thresh = 15+52 - h->slice_alpha_c0_offset; if(qp <= qp_thresh && qp0 <= qp_thresh && qp1 <= qp_thresh && qpc <= qp_thresh && qpc0 <= qp_thresh && qpc1 <= qp_thresh) return; if( IS_INTRA(mb_type) ) { int16_t bS4[4] = {4,4,4,4}; int16_t bS3[4] = {3,3,3,3}; int16_t *bSH = FIELD_PICTURE ? bS3 : bS4; if(left_type) filter_mb_edgev( &img_y[4*0], linesize, bS4, qp0, h); if( IS_8x8DCT(mb_type) ) { filter_mb_edgev( &img_y[4*2], linesize, bS3, qp, h); if(top_type){ filter_mb_edgeh( &img_y[4*0*linesize], linesize, bSH, qp1, h); } filter_mb_edgeh( &img_y[4*2*linesize], linesize, bS3, qp, h); } else { filter_mb_edgev( &img_y[4*1], linesize, bS3, qp, h); filter_mb_edgev( &img_y[4*2], linesize, bS3, qp, h); filter_mb_edgev( &img_y[4*3], linesize, bS3, qp, h); if(top_type){ filter_mb_edgeh( &img_y[4*0*linesize], linesize, bSH, qp1, h); } filter_mb_edgeh( &img_y[4*1*linesize], linesize, bS3, qp, h); filter_mb_edgeh( &img_y[4*2*linesize], linesize, bS3, qp, h); filter_mb_edgeh( &img_y[4*3*linesize], linesize, bS3, qp, h); } if(chroma){ if(chroma444){ if(left_type){ filter_mb_edgev( &img_cb[4*0], linesize, bS4, qpc0, h); filter_mb_edgev( &img_cr[4*0], linesize, bS4, qpc0, h); } if( IS_8x8DCT(mb_type) ) { filter_mb_edgev( &img_cb[4*2], linesize, bS3, qpc, h); filter_mb_edgev( &img_cr[4*2], linesize, bS3, qpc, h); if(top_type){ filter_mb_edgeh( &img_cb[4*0*linesize], linesize, bSH, qpc1, h); filter_mb_edgeh( &img_cr[4*0*linesize], linesize, bSH, qpc1, h); } filter_mb_edgeh( &img_cb[4*2*linesize], linesize, bS3, qpc, h); filter_mb_edgeh( &img_cr[4*2*linesize], linesize, bS3, qpc, h); } else { filter_mb_edgev( &img_cb[4*1], linesize, bS3, qpc, h); filter_mb_edgev( &img_cr[4*1], linesize, bS3, qpc, h); filter_mb_edgev( &img_cb[4*2], linesize, bS3, qpc, h); filter_mb_edgev( &img_cr[4*2], linesize, bS3, qpc, h); filter_mb_edgev( &img_cb[4*3], linesize, bS3, qpc, h); filter_mb_edgev( &img_cr[4*3], linesize, bS3, qpc, h); if(top_type){ filter_mb_edgeh( &img_cb[4*0*linesize], linesize, bSH, qpc1, h); filter_mb_edgeh( &img_cr[4*0*linesize], linesize, bSH, qpc1, h); } filter_mb_edgeh( &img_cb[4*1*linesize], linesize, bS3, qpc, h); filter_mb_edgeh( &img_cr[4*1*linesize], linesize, bS3, qpc, h); filter_mb_edgeh( &img_cb[4*2*linesize], linesize, bS3, qpc, h); filter_mb_edgeh( &img_cr[4*2*linesize], linesize, bS3, qpc, h); filter_mb_edgeh( &img_cb[4*3*linesize], linesize, bS3, qpc, h); filter_mb_edgeh( &img_cr[4*3*linesize], linesize, bS3, qpc, h); } }else{ if(left_type){ filter_mb_edgecv( &img_cb[2*0], uvlinesize, bS4, qpc0, h); filter_mb_edgecv( &img_cr[2*0], uvlinesize, bS4, qpc0, h); } filter_mb_edgecv( &img_cb[2*2], uvlinesize, bS3, qpc, h); filter_mb_edgecv( &img_cr[2*2], uvlinesize, bS3, qpc, h); if(top_type){ filter_mb_edgech( &img_cb[2*0*uvlinesize], uvlinesize, bSH, qpc1, h); filter_mb_edgech( &img_cr[2*0*uvlinesize], uvlinesize, bSH, qpc1, h); } filter_mb_edgech( &img_cb[2*2*uvlinesize], uvlinesize, bS3, qpc, h); filter_mb_edgech( &img_cr[2*2*uvlinesize], uvlinesize, bS3, qpc, h); } } return; } else { LOCAL_ALIGNED_8(int16_t, bS, [2], [4][4]); int edges; if( IS_8x8DCT(mb_type) && (h->cbp&7) == 7 ) { edges = 4; AV_WN64A(bS[0][0], 0x0002000200020002ULL); AV_WN64A(bS[0][2], 0x0002000200020002ULL); AV_WN64A(bS[1][0], 0x0002000200020002ULL); AV_WN64A(bS[1][2], 0x0002000200020002ULL); } else { int mask_edge1 = (3*(((5*mb_type)>>5)&1)) | (mb_type>>4); //(mb_type & (MB_TYPE_16x16 | MB_TYPE_8x16)) ? 3 : (mb_type & MB_TYPE_16x8) ? 1 : 0; int mask_edge0 = 3*((mask_edge1>>1) & ((5*left_type)>>5)&1); // (mb_type & (MB_TYPE_16x16 | MB_TYPE_8x16)) && (h->left_type[LTOP] & (MB_TYPE_16x16 | MB_TYPE_8x16)) ? 3 : 0; int step = 1+(mb_type>>24); //IS_8x8DCT(mb_type) ? 2 : 1; edges = 4 - 3*((mb_type>>3) & !(h->cbp & 15)); //(mb_type & MB_TYPE_16x16) && !(h->cbp & 15) ? 1 : 4; h->h264dsp.h264_loop_filter_strength( bS, h->non_zero_count_cache, h->ref_cache, h->mv_cache, h->list_count==2, edges, step, mask_edge0, mask_edge1, FIELD_PICTURE); } if( IS_INTRA(left_type) ) AV_WN64A(bS[0][0], 0x0004000400040004ULL); if( IS_INTRA(top_type) ) AV_WN64A(bS[1][0], FIELD_PICTURE ? 0x0003000300030003ULL : 0x0004000400040004ULL); #define FILTER(hv,dir,edge)\ if(AV_RN64A(bS[dir][edge])) { \ filter_mb_edge##hv( &img_y[4*edge*(dir?linesize:1)], linesize, bS[dir][edge], edge ? qp : qp##dir, h );\ if(chroma){\ if(chroma444){\ filter_mb_edge##hv( &img_cb[4*edge*(dir?linesize:1)], linesize, bS[dir][edge], edge ? qpc : qpc##dir, h );\ filter_mb_edge##hv( &img_cr[4*edge*(dir?linesize:1)], linesize, bS[dir][edge], edge ? qpc : qpc##dir, h );\ } else if(!(edge&1)) {\ filter_mb_edgec##hv( &img_cb[2*edge*(dir?uvlinesize:1)], uvlinesize, bS[dir][edge], edge ? qpc : qpc##dir, h );\ filter_mb_edgec##hv( &img_cr[2*edge*(dir?uvlinesize:1)], uvlinesize, bS[dir][edge], edge ? qpc : qpc##dir, h );\ }\ }\ } if(left_type) FILTER(v,0,0); if( edges == 1 ) { if(top_type) FILTER(h,1,0); } else if( IS_8x8DCT(mb_type) ) { FILTER(v,0,2); if(top_type) FILTER(h,1,0); FILTER(h,1,2); } else { FILTER(v,0,1); FILTER(v,0,2); FILTER(v,0,3); if(top_type) FILTER(h,1,0); FILTER(h,1,1); FILTER(h,1,2); FILTER(h,1,3); } #undef FILTER } }
false
FFmpeg
a625e13208ad0ebf1554aa73c9bf41452520f176
void ff_h264_filter_mb_fast( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize) { MpegEncContext * const s = &h->s; int mb_xy; int mb_type, left_type, top_type; int qp, qp0, qp1, qpc, qpc0, qpc1, qp_thresh; int chroma = !(CONFIG_GRAY && (s->flags&CODEC_FLAG_GRAY)); int chroma444 = CHROMA444; mb_xy = h->mb_xy; if(!h->h264dsp.h264_loop_filter_strength || h->pps.chroma_qp_diff) { ff_h264_filter_mb(h, mb_x, mb_y, img_y, img_cb, img_cr, linesize, uvlinesize); return; } assert(!FRAME_MBAFF); left_type= h->left_type[LTOP]; top_type= h->top_type; mb_type = s->current_picture.mb_type[mb_xy]; qp = s->current_picture.qscale_table[mb_xy]; qp0 = s->current_picture.qscale_table[mb_xy-1]; qp1 = s->current_picture.qscale_table[h->top_mb_xy]; qpc = get_chroma_qp( h, 0, qp ); qpc0 = get_chroma_qp( h, 0, qp0 ); qpc1 = get_chroma_qp( h, 0, qp1 ); qp0 = (qp + qp0 + 1) >> 1; qp1 = (qp + qp1 + 1) >> 1; qpc0 = (qpc + qpc0 + 1) >> 1; qpc1 = (qpc + qpc1 + 1) >> 1; qp_thresh = 15+52 - h->slice_alpha_c0_offset; if(qp <= qp_thresh && qp0 <= qp_thresh && qp1 <= qp_thresh && qpc <= qp_thresh && qpc0 <= qp_thresh && qpc1 <= qp_thresh) return; if( IS_INTRA(mb_type) ) { int16_t bS4[4] = {4,4,4,4}; int16_t bS3[4] = {3,3,3,3}; int16_t *bSH = FIELD_PICTURE ? bS3 : bS4; if(left_type) filter_mb_edgev( &img_y[4*0], linesize, bS4, qp0, h); if( IS_8x8DCT(mb_type) ) { filter_mb_edgev( &img_y[4*2], linesize, bS3, qp, h); if(top_type){ filter_mb_edgeh( &img_y[4*0*linesize], linesize, bSH, qp1, h); } filter_mb_edgeh( &img_y[4*2*linesize], linesize, bS3, qp, h); } else { filter_mb_edgev( &img_y[4*1], linesize, bS3, qp, h); filter_mb_edgev( &img_y[4*2], linesize, bS3, qp, h); filter_mb_edgev( &img_y[4*3], linesize, bS3, qp, h); if(top_type){ filter_mb_edgeh( &img_y[4*0*linesize], linesize, bSH, qp1, h); } filter_mb_edgeh( &img_y[4*1*linesize], linesize, bS3, qp, h); filter_mb_edgeh( &img_y[4*2*linesize], linesize, bS3, qp, h); filter_mb_edgeh( &img_y[4*3*linesize], linesize, bS3, qp, h); } if(chroma){ if(chroma444){ if(left_type){ filter_mb_edgev( &img_cb[4*0], linesize, bS4, qpc0, h); filter_mb_edgev( &img_cr[4*0], linesize, bS4, qpc0, h); } if( IS_8x8DCT(mb_type) ) { filter_mb_edgev( &img_cb[4*2], linesize, bS3, qpc, h); filter_mb_edgev( &img_cr[4*2], linesize, bS3, qpc, h); if(top_type){ filter_mb_edgeh( &img_cb[4*0*linesize], linesize, bSH, qpc1, h); filter_mb_edgeh( &img_cr[4*0*linesize], linesize, bSH, qpc1, h); } filter_mb_edgeh( &img_cb[4*2*linesize], linesize, bS3, qpc, h); filter_mb_edgeh( &img_cr[4*2*linesize], linesize, bS3, qpc, h); } else { filter_mb_edgev( &img_cb[4*1], linesize, bS3, qpc, h); filter_mb_edgev( &img_cr[4*1], linesize, bS3, qpc, h); filter_mb_edgev( &img_cb[4*2], linesize, bS3, qpc, h); filter_mb_edgev( &img_cr[4*2], linesize, bS3, qpc, h); filter_mb_edgev( &img_cb[4*3], linesize, bS3, qpc, h); filter_mb_edgev( &img_cr[4*3], linesize, bS3, qpc, h); if(top_type){ filter_mb_edgeh( &img_cb[4*0*linesize], linesize, bSH, qpc1, h); filter_mb_edgeh( &img_cr[4*0*linesize], linesize, bSH, qpc1, h); } filter_mb_edgeh( &img_cb[4*1*linesize], linesize, bS3, qpc, h); filter_mb_edgeh( &img_cr[4*1*linesize], linesize, bS3, qpc, h); filter_mb_edgeh( &img_cb[4*2*linesize], linesize, bS3, qpc, h); filter_mb_edgeh( &img_cr[4*2*linesize], linesize, bS3, qpc, h); filter_mb_edgeh( &img_cb[4*3*linesize], linesize, bS3, qpc, h); filter_mb_edgeh( &img_cr[4*3*linesize], linesize, bS3, qpc, h); } }else{ if(left_type){ filter_mb_edgecv( &img_cb[2*0], uvlinesize, bS4, qpc0, h); filter_mb_edgecv( &img_cr[2*0], uvlinesize, bS4, qpc0, h); } filter_mb_edgecv( &img_cb[2*2], uvlinesize, bS3, qpc, h); filter_mb_edgecv( &img_cr[2*2], uvlinesize, bS3, qpc, h); if(top_type){ filter_mb_edgech( &img_cb[2*0*uvlinesize], uvlinesize, bSH, qpc1, h); filter_mb_edgech( &img_cr[2*0*uvlinesize], uvlinesize, bSH, qpc1, h); } filter_mb_edgech( &img_cb[2*2*uvlinesize], uvlinesize, bS3, qpc, h); filter_mb_edgech( &img_cr[2*2*uvlinesize], uvlinesize, bS3, qpc, h); } } return; } else { LOCAL_ALIGNED_8(int16_t, bS, [2], [4][4]); int edges; if( IS_8x8DCT(mb_type) && (h->cbp&7) == 7 ) { edges = 4; AV_WN64A(bS[0][0], 0x0002000200020002ULL); AV_WN64A(bS[0][2], 0x0002000200020002ULL); AV_WN64A(bS[1][0], 0x0002000200020002ULL); AV_WN64A(bS[1][2], 0x0002000200020002ULL); } else { int mask_edge1 = (3*(((5*mb_type)>>5)&1)) | (mb_type>>4); int mask_edge0 = 3*((mask_edge1>>1) & ((5*left_type)>>5)&1); int step = 1+(mb_type>>24); edges = 4 - 3*((mb_type>>3) & !(h->cbp & 15)); h->h264dsp.h264_loop_filter_strength( bS, h->non_zero_count_cache, h->ref_cache, h->mv_cache, h->list_count==2, edges, step, mask_edge0, mask_edge1, FIELD_PICTURE); } if( IS_INTRA(left_type) ) AV_WN64A(bS[0][0], 0x0004000400040004ULL); if( IS_INTRA(top_type) ) AV_WN64A(bS[1][0], FIELD_PICTURE ? 0x0003000300030003ULL : 0x0004000400040004ULL); #define FILTER(hv,dir,edge)\ if(AV_RN64A(bS[dir][edge])) { \ filter_mb_edge##hv( &img_y[4*edge*(dir?linesize:1)], linesize, bS[dir][edge], edge ? qp : qp##dir, h );\ if(chroma){\ if(chroma444){\ filter_mb_edge##hv( &img_cb[4*edge*(dir?linesize:1)], linesize, bS[dir][edge], edge ? qpc : qpc##dir, h );\ filter_mb_edge##hv( &img_cr[4*edge*(dir?linesize:1)], linesize, bS[dir][edge], edge ? qpc : qpc##dir, h );\ } else if(!(edge&1)) {\ filter_mb_edgec##hv( &img_cb[2*edge*(dir?uvlinesize:1)], uvlinesize, bS[dir][edge], edge ? qpc : qpc##dir, h );\ filter_mb_edgec##hv( &img_cr[2*edge*(dir?uvlinesize:1)], uvlinesize, bS[dir][edge], edge ? qpc : qpc##dir, h );\ }\ }\ } if(left_type) FILTER(v,0,0); if( edges == 1 ) { if(top_type) FILTER(h,1,0); } else if( IS_8x8DCT(mb_type) ) { FILTER(v,0,2); if(top_type) FILTER(h,1,0); FILTER(h,1,2); } else { FILTER(v,0,1); FILTER(v,0,2); FILTER(v,0,3); if(top_type) FILTER(h,1,0); FILTER(h,1,1); FILTER(h,1,2); FILTER(h,1,3); } #undef FILTER } }
{ "code": [], "line_no": [] }
void FUNC_0( H264Context *VAR_0, int VAR_1, int VAR_2, uint8_t *VAR_3, uint8_t *VAR_4, uint8_t *VAR_5, unsigned int VAR_6, unsigned int VAR_7) { MpegEncContext * const s = &VAR_0->s; int VAR_8; int VAR_9, VAR_10, VAR_11; int VAR_12, VAR_13, VAR_14, VAR_15, VAR_16, VAR_17, VAR_18; int VAR_19 = !(CONFIG_GRAY && (s->flags&CODEC_FLAG_GRAY)); int VAR_20 = CHROMA444; VAR_8 = VAR_0->VAR_8; if(!VAR_0->h264dsp.h264_loop_filter_strength || VAR_0->pps.chroma_qp_diff) { ff_h264_filter_mb(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7); return; } assert(!FRAME_MBAFF); VAR_10= VAR_0->VAR_10[LTOP]; VAR_11= VAR_0->VAR_11; VAR_9 = s->current_picture.VAR_9[VAR_8]; VAR_12 = s->current_picture.qscale_table[VAR_8]; VAR_13 = s->current_picture.qscale_table[VAR_8-1]; VAR_14 = s->current_picture.qscale_table[VAR_0->top_mb_xy]; VAR_15 = get_chroma_qp( VAR_0, 0, VAR_12 ); VAR_16 = get_chroma_qp( VAR_0, 0, VAR_13 ); VAR_17 = get_chroma_qp( VAR_0, 0, VAR_14 ); VAR_13 = (VAR_12 + VAR_13 + 1) >> 1; VAR_14 = (VAR_12 + VAR_14 + 1) >> 1; VAR_16 = (VAR_15 + VAR_16 + 1) >> 1; VAR_17 = (VAR_15 + VAR_17 + 1) >> 1; VAR_18 = 15+52 - VAR_0->slice_alpha_c0_offset; if(VAR_12 <= VAR_18 && VAR_13 <= VAR_18 && VAR_14 <= VAR_18 && VAR_15 <= VAR_18 && VAR_16 <= VAR_18 && VAR_17 <= VAR_18) return; if( IS_INTRA(VAR_9) ) { int16_t bS4[4] = {4,4,4,4}; int16_t bS3[4] = {3,3,3,3}; int16_t *bSH = FIELD_PICTURE ? bS3 : bS4; if(VAR_10) filter_mb_edgev( &VAR_3[4*0], VAR_6, bS4, VAR_13, VAR_0); if( IS_8x8DCT(VAR_9) ) { filter_mb_edgev( &VAR_3[4*2], VAR_6, bS3, VAR_12, VAR_0); if(VAR_11){ filter_mb_edgeh( &VAR_3[4*0*VAR_6], VAR_6, bSH, VAR_14, VAR_0); } filter_mb_edgeh( &VAR_3[4*2*VAR_6], VAR_6, bS3, VAR_12, VAR_0); } else { filter_mb_edgev( &VAR_3[4*1], VAR_6, bS3, VAR_12, VAR_0); filter_mb_edgev( &VAR_3[4*2], VAR_6, bS3, VAR_12, VAR_0); filter_mb_edgev( &VAR_3[4*3], VAR_6, bS3, VAR_12, VAR_0); if(VAR_11){ filter_mb_edgeh( &VAR_3[4*0*VAR_6], VAR_6, bSH, VAR_14, VAR_0); } filter_mb_edgeh( &VAR_3[4*1*VAR_6], VAR_6, bS3, VAR_12, VAR_0); filter_mb_edgeh( &VAR_3[4*2*VAR_6], VAR_6, bS3, VAR_12, VAR_0); filter_mb_edgeh( &VAR_3[4*3*VAR_6], VAR_6, bS3, VAR_12, VAR_0); } if(VAR_19){ if(VAR_20){ if(VAR_10){ filter_mb_edgev( &VAR_4[4*0], VAR_6, bS4, VAR_16, VAR_0); filter_mb_edgev( &VAR_5[4*0], VAR_6, bS4, VAR_16, VAR_0); } if( IS_8x8DCT(VAR_9) ) { filter_mb_edgev( &VAR_4[4*2], VAR_6, bS3, VAR_15, VAR_0); filter_mb_edgev( &VAR_5[4*2], VAR_6, bS3, VAR_15, VAR_0); if(VAR_11){ filter_mb_edgeh( &VAR_4[4*0*VAR_6], VAR_6, bSH, VAR_17, VAR_0); filter_mb_edgeh( &VAR_5[4*0*VAR_6], VAR_6, bSH, VAR_17, VAR_0); } filter_mb_edgeh( &VAR_4[4*2*VAR_6], VAR_6, bS3, VAR_15, VAR_0); filter_mb_edgeh( &VAR_5[4*2*VAR_6], VAR_6, bS3, VAR_15, VAR_0); } else { filter_mb_edgev( &VAR_4[4*1], VAR_6, bS3, VAR_15, VAR_0); filter_mb_edgev( &VAR_5[4*1], VAR_6, bS3, VAR_15, VAR_0); filter_mb_edgev( &VAR_4[4*2], VAR_6, bS3, VAR_15, VAR_0); filter_mb_edgev( &VAR_5[4*2], VAR_6, bS3, VAR_15, VAR_0); filter_mb_edgev( &VAR_4[4*3], VAR_6, bS3, VAR_15, VAR_0); filter_mb_edgev( &VAR_5[4*3], VAR_6, bS3, VAR_15, VAR_0); if(VAR_11){ filter_mb_edgeh( &VAR_4[4*0*VAR_6], VAR_6, bSH, VAR_17, VAR_0); filter_mb_edgeh( &VAR_5[4*0*VAR_6], VAR_6, bSH, VAR_17, VAR_0); } filter_mb_edgeh( &VAR_4[4*1*VAR_6], VAR_6, bS3, VAR_15, VAR_0); filter_mb_edgeh( &VAR_5[4*1*VAR_6], VAR_6, bS3, VAR_15, VAR_0); filter_mb_edgeh( &VAR_4[4*2*VAR_6], VAR_6, bS3, VAR_15, VAR_0); filter_mb_edgeh( &VAR_5[4*2*VAR_6], VAR_6, bS3, VAR_15, VAR_0); filter_mb_edgeh( &VAR_4[4*3*VAR_6], VAR_6, bS3, VAR_15, VAR_0); filter_mb_edgeh( &VAR_5[4*3*VAR_6], VAR_6, bS3, VAR_15, VAR_0); } }else{ if(VAR_10){ filter_mb_edgecv( &VAR_4[2*0], VAR_7, bS4, VAR_16, VAR_0); filter_mb_edgecv( &VAR_5[2*0], VAR_7, bS4, VAR_16, VAR_0); } filter_mb_edgecv( &VAR_4[2*2], VAR_7, bS3, VAR_15, VAR_0); filter_mb_edgecv( &VAR_5[2*2], VAR_7, bS3, VAR_15, VAR_0); if(VAR_11){ filter_mb_edgech( &VAR_4[2*0*VAR_7], VAR_7, bSH, VAR_17, VAR_0); filter_mb_edgech( &VAR_5[2*0*VAR_7], VAR_7, bSH, VAR_17, VAR_0); } filter_mb_edgech( &VAR_4[2*2*VAR_7], VAR_7, bS3, VAR_15, VAR_0); filter_mb_edgech( &VAR_5[2*2*VAR_7], VAR_7, bS3, VAR_15, VAR_0); } } return; } else { LOCAL_ALIGNED_8(int16_t, bS, [2], [4][4]); int VAR_21; if( IS_8x8DCT(VAR_9) && (VAR_0->cbp&7) == 7 ) { VAR_21 = 4; AV_WN64A(bS[0][0], 0x0002000200020002ULL); AV_WN64A(bS[0][2], 0x0002000200020002ULL); AV_WN64A(bS[1][0], 0x0002000200020002ULL); AV_WN64A(bS[1][2], 0x0002000200020002ULL); } else { int VAR_22 = (3*(((5*VAR_9)>>5)&1)) | (VAR_9>>4); int VAR_23 = 3*((VAR_22>>1) & ((5*VAR_10)>>5)&1); int VAR_24 = 1+(VAR_9>>24); VAR_21 = 4 - 3*((VAR_9>>3) & !(VAR_0->cbp & 15)); VAR_0->h264dsp.h264_loop_filter_strength( bS, VAR_0->non_zero_count_cache, VAR_0->ref_cache, VAR_0->mv_cache, VAR_0->list_count==2, VAR_21, VAR_24, VAR_23, VAR_22, FIELD_PICTURE); } if( IS_INTRA(VAR_10) ) AV_WN64A(bS[0][0], 0x0004000400040004ULL); if( IS_INTRA(VAR_11) ) AV_WN64A(bS[1][0], FIELD_PICTURE ? 0x0003000300030003ULL : 0x0004000400040004ULL); #define FILTER(hv,dir,edge)\ if(AV_RN64A(bS[dir][edge])) { \ filter_mb_edge##hv( &VAR_3[4*edge*(dir?VAR_6:1)], VAR_6, bS[dir][edge], edge ? VAR_12 : VAR_12##dir, VAR_0 );\ if(VAR_19){\ if(VAR_20){\ filter_mb_edge##hv( &VAR_4[4*edge*(dir?VAR_6:1)], VAR_6, bS[dir][edge], edge ? VAR_15 : VAR_15##dir, VAR_0 );\ filter_mb_edge##hv( &VAR_5[4*edge*(dir?VAR_6:1)], VAR_6, bS[dir][edge], edge ? VAR_15 : VAR_15##dir, VAR_0 );\ } else if(!(edge&1)) {\ filter_mb_edgec##hv( &VAR_4[2*edge*(dir?VAR_7:1)], VAR_7, bS[dir][edge], edge ? VAR_15 : VAR_15##dir, VAR_0 );\ filter_mb_edgec##hv( &VAR_5[2*edge*(dir?VAR_7:1)], VAR_7, bS[dir][edge], edge ? VAR_15 : VAR_15##dir, VAR_0 );\ }\ }\ } if(VAR_10) FILTER(v,0,0); if( VAR_21 == 1 ) { if(VAR_11) FILTER(VAR_0,1,0); } else if( IS_8x8DCT(VAR_9) ) { FILTER(v,0,2); if(VAR_11) FILTER(VAR_0,1,0); FILTER(VAR_0,1,2); } else { FILTER(v,0,1); FILTER(v,0,2); FILTER(v,0,3); if(VAR_11) FILTER(VAR_0,1,0); FILTER(VAR_0,1,1); FILTER(VAR_0,1,2); FILTER(VAR_0,1,3); } #undef FILTER } }
[ "void FUNC_0( H264Context *VAR_0, int VAR_1, int VAR_2, uint8_t *VAR_3, uint8_t *VAR_4, uint8_t *VAR_5, unsigned int VAR_6, unsigned int VAR_7) {", "MpegEncContext * const s = &VAR_0->s;", "int VAR_8;", "int VAR_9, VAR_10, VAR_11;", "int VAR_12, VAR_13, VAR_14, VAR_15, VAR_16, VAR_17, VAR_18;", "int VAR_19 = !(CONFIG_GRAY && (s->flags&CODEC_FLAG_GRAY));", "int VAR_20 = CHROMA444;", "VAR_8 = VAR_0->VAR_8;", "if(!VAR_0->h264dsp.h264_loop_filter_strength || VAR_0->pps.chroma_qp_diff) {", "ff_h264_filter_mb(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7);", "return;", "}", "assert(!FRAME_MBAFF);", "VAR_10= VAR_0->VAR_10[LTOP];", "VAR_11= VAR_0->VAR_11;", "VAR_9 = s->current_picture.VAR_9[VAR_8];", "VAR_12 = s->current_picture.qscale_table[VAR_8];", "VAR_13 = s->current_picture.qscale_table[VAR_8-1];", "VAR_14 = s->current_picture.qscale_table[VAR_0->top_mb_xy];", "VAR_15 = get_chroma_qp( VAR_0, 0, VAR_12 );", "VAR_16 = get_chroma_qp( VAR_0, 0, VAR_13 );", "VAR_17 = get_chroma_qp( VAR_0, 0, VAR_14 );", "VAR_13 = (VAR_12 + VAR_13 + 1) >> 1;", "VAR_14 = (VAR_12 + VAR_14 + 1) >> 1;", "VAR_16 = (VAR_15 + VAR_16 + 1) >> 1;", "VAR_17 = (VAR_15 + VAR_17 + 1) >> 1;", "VAR_18 = 15+52 - VAR_0->slice_alpha_c0_offset;", "if(VAR_12 <= VAR_18 && VAR_13 <= VAR_18 && VAR_14 <= VAR_18 &&\nVAR_15 <= VAR_18 && VAR_16 <= VAR_18 && VAR_17 <= VAR_18)\nreturn;", "if( IS_INTRA(VAR_9) ) {", "int16_t bS4[4] = {4,4,4,4};", "int16_t bS3[4] = {3,3,3,3};", "int16_t *bSH = FIELD_PICTURE ? bS3 : bS4;", "if(VAR_10)\nfilter_mb_edgev( &VAR_3[4*0], VAR_6, bS4, VAR_13, VAR_0);", "if( IS_8x8DCT(VAR_9) ) {", "filter_mb_edgev( &VAR_3[4*2], VAR_6, bS3, VAR_12, VAR_0);", "if(VAR_11){", "filter_mb_edgeh( &VAR_3[4*0*VAR_6], VAR_6, bSH, VAR_14, VAR_0);", "}", "filter_mb_edgeh( &VAR_3[4*2*VAR_6], VAR_6, bS3, VAR_12, VAR_0);", "} else {", "filter_mb_edgev( &VAR_3[4*1], VAR_6, bS3, VAR_12, VAR_0);", "filter_mb_edgev( &VAR_3[4*2], VAR_6, bS3, VAR_12, VAR_0);", "filter_mb_edgev( &VAR_3[4*3], VAR_6, bS3, VAR_12, VAR_0);", "if(VAR_11){", "filter_mb_edgeh( &VAR_3[4*0*VAR_6], VAR_6, bSH, VAR_14, VAR_0);", "}", "filter_mb_edgeh( &VAR_3[4*1*VAR_6], VAR_6, bS3, VAR_12, VAR_0);", "filter_mb_edgeh( &VAR_3[4*2*VAR_6], VAR_6, bS3, VAR_12, VAR_0);", "filter_mb_edgeh( &VAR_3[4*3*VAR_6], VAR_6, bS3, VAR_12, VAR_0);", "}", "if(VAR_19){", "if(VAR_20){", "if(VAR_10){", "filter_mb_edgev( &VAR_4[4*0], VAR_6, bS4, VAR_16, VAR_0);", "filter_mb_edgev( &VAR_5[4*0], VAR_6, bS4, VAR_16, VAR_0);", "}", "if( IS_8x8DCT(VAR_9) ) {", "filter_mb_edgev( &VAR_4[4*2], VAR_6, bS3, VAR_15, VAR_0);", "filter_mb_edgev( &VAR_5[4*2], VAR_6, bS3, VAR_15, VAR_0);", "if(VAR_11){", "filter_mb_edgeh( &VAR_4[4*0*VAR_6], VAR_6, bSH, VAR_17, VAR_0);", "filter_mb_edgeh( &VAR_5[4*0*VAR_6], VAR_6, bSH, VAR_17, VAR_0);", "}", "filter_mb_edgeh( &VAR_4[4*2*VAR_6], VAR_6, bS3, VAR_15, VAR_0);", "filter_mb_edgeh( &VAR_5[4*2*VAR_6], VAR_6, bS3, VAR_15, VAR_0);", "} else {", "filter_mb_edgev( &VAR_4[4*1], VAR_6, bS3, VAR_15, VAR_0);", "filter_mb_edgev( &VAR_5[4*1], VAR_6, bS3, VAR_15, VAR_0);", "filter_mb_edgev( &VAR_4[4*2], VAR_6, bS3, VAR_15, VAR_0);", "filter_mb_edgev( &VAR_5[4*2], VAR_6, bS3, VAR_15, VAR_0);", "filter_mb_edgev( &VAR_4[4*3], VAR_6, bS3, VAR_15, VAR_0);", "filter_mb_edgev( &VAR_5[4*3], VAR_6, bS3, VAR_15, VAR_0);", "if(VAR_11){", "filter_mb_edgeh( &VAR_4[4*0*VAR_6], VAR_6, bSH, VAR_17, VAR_0);", "filter_mb_edgeh( &VAR_5[4*0*VAR_6], VAR_6, bSH, VAR_17, VAR_0);", "}", "filter_mb_edgeh( &VAR_4[4*1*VAR_6], VAR_6, bS3, VAR_15, VAR_0);", "filter_mb_edgeh( &VAR_5[4*1*VAR_6], VAR_6, bS3, VAR_15, VAR_0);", "filter_mb_edgeh( &VAR_4[4*2*VAR_6], VAR_6, bS3, VAR_15, VAR_0);", "filter_mb_edgeh( &VAR_5[4*2*VAR_6], VAR_6, bS3, VAR_15, VAR_0);", "filter_mb_edgeh( &VAR_4[4*3*VAR_6], VAR_6, bS3, VAR_15, VAR_0);", "filter_mb_edgeh( &VAR_5[4*3*VAR_6], VAR_6, bS3, VAR_15, VAR_0);", "}", "}else{", "if(VAR_10){", "filter_mb_edgecv( &VAR_4[2*0], VAR_7, bS4, VAR_16, VAR_0);", "filter_mb_edgecv( &VAR_5[2*0], VAR_7, bS4, VAR_16, VAR_0);", "}", "filter_mb_edgecv( &VAR_4[2*2], VAR_7, bS3, VAR_15, VAR_0);", "filter_mb_edgecv( &VAR_5[2*2], VAR_7, bS3, VAR_15, VAR_0);", "if(VAR_11){", "filter_mb_edgech( &VAR_4[2*0*VAR_7], VAR_7, bSH, VAR_17, VAR_0);", "filter_mb_edgech( &VAR_5[2*0*VAR_7], VAR_7, bSH, VAR_17, VAR_0);", "}", "filter_mb_edgech( &VAR_4[2*2*VAR_7], VAR_7, bS3, VAR_15, VAR_0);", "filter_mb_edgech( &VAR_5[2*2*VAR_7], VAR_7, bS3, VAR_15, VAR_0);", "}", "}", "return;", "} else {", "LOCAL_ALIGNED_8(int16_t, bS, [2], [4][4]);", "int VAR_21;", "if( IS_8x8DCT(VAR_9) && (VAR_0->cbp&7) == 7 ) {", "VAR_21 = 4;", "AV_WN64A(bS[0][0], 0x0002000200020002ULL);", "AV_WN64A(bS[0][2], 0x0002000200020002ULL);", "AV_WN64A(bS[1][0], 0x0002000200020002ULL);", "AV_WN64A(bS[1][2], 0x0002000200020002ULL);", "} else {", "int VAR_22 = (3*(((5*VAR_9)>>5)&1)) | (VAR_9>>4);", "int VAR_23 = 3*((VAR_22>>1) & ((5*VAR_10)>>5)&1);", "int VAR_24 = 1+(VAR_9>>24);", "VAR_21 = 4 - 3*((VAR_9>>3) & !(VAR_0->cbp & 15));", "VAR_0->h264dsp.h264_loop_filter_strength( bS, VAR_0->non_zero_count_cache, VAR_0->ref_cache, VAR_0->mv_cache,\nVAR_0->list_count==2, VAR_21, VAR_24, VAR_23, VAR_22, FIELD_PICTURE);", "}", "if( IS_INTRA(VAR_10) )\nAV_WN64A(bS[0][0], 0x0004000400040004ULL);", "if( IS_INTRA(VAR_11) )\nAV_WN64A(bS[1][0], FIELD_PICTURE ? 0x0003000300030003ULL : 0x0004000400040004ULL);", "#define FILTER(hv,dir,edge)\\\nif(AV_RN64A(bS[dir][edge])) { \\", "filter_mb_edge##hv( &VAR_3[4*edge*(dir?VAR_6:1)], VAR_6, bS[dir][edge], edge ? VAR_12 : VAR_12##dir, VAR_0 );\\", "if(VAR_19){\\", "if(VAR_20){\\", "filter_mb_edge##hv( &VAR_4[4*edge*(dir?VAR_6:1)], VAR_6, bS[dir][edge], edge ? VAR_15 : VAR_15##dir, VAR_0 );\\", "filter_mb_edge##hv( &VAR_5[4*edge*(dir?VAR_6:1)], VAR_6, bS[dir][edge], edge ? VAR_15 : VAR_15##dir, VAR_0 );\\", "} else if(!(edge&1)) {\\", "filter_mb_edgec##hv( &VAR_4[2*edge*(dir?VAR_7:1)], VAR_7, bS[dir][edge], edge ? VAR_15 : VAR_15##dir, VAR_0 );\\", "filter_mb_edgec##hv( &VAR_5[2*edge*(dir?VAR_7:1)], VAR_7, bS[dir][edge], edge ? VAR_15 : VAR_15##dir, VAR_0 );\\", "}\\", "}\\", "}", "if(VAR_10)\nFILTER(v,0,0);", "if( VAR_21 == 1 ) {", "if(VAR_11)\nFILTER(VAR_0,1,0);", "} else if( IS_8x8DCT(VAR_9) ) {", "FILTER(v,0,2);", "if(VAR_11)\nFILTER(VAR_0,1,0);", "FILTER(VAR_0,1,2);", "} else {", "FILTER(v,0,1);", "FILTER(v,0,2);", "FILTER(v,0,3);", "if(VAR_11)\nFILTER(VAR_0,1,0);", "FILTER(VAR_0,1,1);", "FILTER(VAR_0,1,2);", "FILTER(VAR_0,1,3);", "}", "#undef FILTER\n}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61, 63, 65 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77, 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241, 243 ], [ 245 ], [ 247, 249 ], [ 251, 253 ], [ 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 ] ]
15,043
static inline void downmix_2f_1r_to_mono(float *samples) { int i; for (i = 0; i < 256; i++) { samples[i] += (samples[i + 256] + samples[i + 512]); samples[i + 256] = samples[i + 512] = 0; } }
false
FFmpeg
0058584580b87feb47898e60e4b80c7f425882ad
static inline void downmix_2f_1r_to_mono(float *samples) { int i; for (i = 0; i < 256; i++) { samples[i] += (samples[i + 256] + samples[i + 512]); samples[i + 256] = samples[i + 512] = 0; } }
{ "code": [], "line_no": [] }
static inline void FUNC_0(float *VAR_0) { int VAR_1; for (VAR_1 = 0; VAR_1 < 256; VAR_1++) { VAR_0[VAR_1] += (VAR_0[VAR_1 + 256] + VAR_0[VAR_1 + 512]); VAR_0[VAR_1 + 256] = VAR_0[VAR_1 + 512] = 0; } }
[ "static inline void FUNC_0(float *VAR_0)\n{", "int VAR_1;", "for (VAR_1 = 0; VAR_1 < 256; VAR_1++) {", "VAR_0[VAR_1] += (VAR_0[VAR_1 + 256] + VAR_0[VAR_1 + 512]);", "VAR_0[VAR_1 + 256] = VAR_0[VAR_1 + 512] = 0;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ] ]
15,044
static void do_bit_allocation1(AC3DecodeContext *ctx, int chnl) { ac3_audio_block *ab = &ctx->audio_block; int sdecay, fdecay, sgain, dbknee, floor; int lowcomp = 0, fgain = 0, snroffset = 0, fastleak = 0, slowleak = 0; int psd[256], bndpsd[50], excite[50], mask[50], delta; int start = 0, end = 0, bin = 0, i = 0, j = 0, k = 0, lastbin = 0, bndstrt = 0; int bndend = 0, begin = 0, deltnseg = 0, band = 0, seg = 0, address = 0; int fscod = ctx->sync_info.fscod; uint8_t *exps, *deltoffst = 0, *deltlen = 0, *deltba = 0; uint8_t *baps; int do_delta = 0; /* initialization */ sdecay = sdecaytab[ab->sdcycod]; fdecay = fdecaytab[ab->fdcycod]; sgain = sgaintab[ab->sgaincod]; dbknee = dbkneetab[ab->dbpbcod]; floor = floortab[ab->floorcod]; if (chnl == 5) { start = ab->cplstrtmant; end = ab->cplendmant; fgain = fgaintab[ab->cplfgaincod]; snroffset = (((ab->csnroffst - 15) << 4) + ab->cplfsnroffst) << 2; fastleak = (ab->cplfleak << 8) + 768; slowleak = (ab->cplsleak << 8) + 768; exps = ab->dcplexps; baps = ab->cplbap; if (ab->cpldeltbae == AC3_DBASTR_NEW || ab->cpldeltbae == AC3_DBASTR_REUSE) { do_delta = 1; deltnseg = ab->cpldeltnseg; deltoffst = ab->cpldeltoffst; deltlen = ab->cpldeltlen; deltba = ab->cpldeltba; } } else if (chnl == 6) { start = 0; end = 7; lowcomp = 0; fastleak = 0; slowleak = 0; fgain = fgaintab[ab->lfefgaincod]; snroffset = (((ab->csnroffst - 15) << 4) + ab->lfefsnroffst) << 2; exps = ab->dlfeexps; baps = ab->lfebap; } else { start = 0; end = ab->endmant[chnl]; lowcomp = 0; fastleak = 0; slowleak = 0; fgain = fgaintab[ab->fgaincod[chnl]]; snroffset = (((ab->csnroffst - 15) << 4) + ab->fsnroffst[chnl]) << 2; exps = ab->dexps[chnl]; baps = ab->bap[chnl]; if (ab->deltbae[chnl] == AC3_DBASTR_NEW || ab->deltbae[chnl] == AC3_DBASTR_REUSE) { do_delta = 1; deltnseg = ab->deltnseg[chnl]; deltoffst = ab->deltoffst[chnl]; deltlen = ab->deltlen[chnl]; deltba = ab->deltba[chnl]; } } for (bin = start; bin < end; bin++) /* exponent mapping into psd */ psd[bin] = (3072 - ((int)(exps[bin]) << 7)); /* psd integration */ j = start; k = masktab[start]; do { lastbin = FFMIN(bndtab[k] + bndsz[k], end); bndpsd[k] = psd[j]; j++; for (i = j; i < lastbin; i++) { bndpsd[k] = logadd(bndpsd[k], psd[j]); j++; } k++; } while (end > lastbin); /* compute the excite function */ bndstrt = masktab[start]; bndend = masktab[end - 1] + 1; if (bndstrt == 0) { lowcomp = calc_lowcomp(lowcomp, bndpsd[0], bndpsd[1], 0); excite[0] = bndpsd[0] - fgain - lowcomp; lowcomp = calc_lowcomp(lowcomp, bndpsd[1], bndpsd[2], 1); excite[1] = bndpsd[1] - fgain - lowcomp; begin = 7; for (bin = 2; bin < 7; bin++) { if (bndend != 7 || bin != 6) lowcomp = calc_lowcomp(lowcomp, bndpsd[bin], bndpsd[bin + 1], bin); fastleak = bndpsd[bin] - fgain; slowleak = bndpsd[bin] - sgain; excite[bin] = fastleak - lowcomp; if (bndend != 7 || bin != 6) if (bndpsd[bin] <= bndpsd[bin + 1]) { begin = bin + 1; break; } } for (bin = begin; bin < FFMIN(bndend, 22); bin++) { if (bndend != 7 || bin != 6) lowcomp = calc_lowcomp(lowcomp, bndpsd[bin], bndpsd[bin + 1], bin); fastleak -= fdecay; fastleak = FFMAX(fastleak, bndpsd[bin] - fgain); slowleak -= sdecay; slowleak = FFMAX(slowleak, bndpsd[bin] - sgain); excite[bin] = FFMAX(fastleak - lowcomp, slowleak); } begin = 22; } else { begin = bndstrt; } for (bin = begin; bin < bndend; bin++) { fastleak -= fdecay; fastleak = FFMAX(fastleak, bndpsd[bin] - fgain); slowleak -= sdecay; slowleak = FFMAX(slowleak, bndpsd[bin] - sgain); excite[bin] = FFMAX(fastleak, slowleak); } /* compute the masking curve */ for (bin = bndstrt; bin < bndend; bin++) { if (bndpsd[bin] < dbknee) excite[bin] += ((dbknee - bndpsd[bin]) >> 2); mask[bin] = FFMAX(excite[bin], hth[bin][fscod]); } /* apply the delta bit allocation */ if (do_delta) { band = 0; for (seg = 0; seg < deltnseg + 1; seg++) { band += (int)(deltoffst[seg]); if ((int)(deltba[seg]) >= 4) delta = ((int)(deltba[seg]) - 3) << 7; else delta = ((int)(deltba[seg]) - 4) << 7; for (k = 0; k < (int)(deltlen[seg]); k++) { mask[band] += delta; band++; } } } /*compute the bit allocation */ i = start; j = masktab[start]; do { lastbin = FFMIN(bndtab[j] + bndsz[j], end); mask[j] -= snroffset; mask[j] -= floor; if (mask[j] < 0) mask[j] = 0; mask[j] &= 0x1fe0; mask[j] += floor; for (k = i; k < lastbin; k++) { address = (psd[i] - mask[j]) >> 5; address = FFMIN(63, FFMAX(0, address)); baps[i] = baptab[address]; i++; } j++; } while (end > lastbin); }
false
FFmpeg
486637af8ef29ec215e0e0b7ecd3b5470f0e04e5
static void do_bit_allocation1(AC3DecodeContext *ctx, int chnl) { ac3_audio_block *ab = &ctx->audio_block; int sdecay, fdecay, sgain, dbknee, floor; int lowcomp = 0, fgain = 0, snroffset = 0, fastleak = 0, slowleak = 0; int psd[256], bndpsd[50], excite[50], mask[50], delta; int start = 0, end = 0, bin = 0, i = 0, j = 0, k = 0, lastbin = 0, bndstrt = 0; int bndend = 0, begin = 0, deltnseg = 0, band = 0, seg = 0, address = 0; int fscod = ctx->sync_info.fscod; uint8_t *exps, *deltoffst = 0, *deltlen = 0, *deltba = 0; uint8_t *baps; int do_delta = 0; sdecay = sdecaytab[ab->sdcycod]; fdecay = fdecaytab[ab->fdcycod]; sgain = sgaintab[ab->sgaincod]; dbknee = dbkneetab[ab->dbpbcod]; floor = floortab[ab->floorcod]; if (chnl == 5) { start = ab->cplstrtmant; end = ab->cplendmant; fgain = fgaintab[ab->cplfgaincod]; snroffset = (((ab->csnroffst - 15) << 4) + ab->cplfsnroffst) << 2; fastleak = (ab->cplfleak << 8) + 768; slowleak = (ab->cplsleak << 8) + 768; exps = ab->dcplexps; baps = ab->cplbap; if (ab->cpldeltbae == AC3_DBASTR_NEW || ab->cpldeltbae == AC3_DBASTR_REUSE) { do_delta = 1; deltnseg = ab->cpldeltnseg; deltoffst = ab->cpldeltoffst; deltlen = ab->cpldeltlen; deltba = ab->cpldeltba; } } else if (chnl == 6) { start = 0; end = 7; lowcomp = 0; fastleak = 0; slowleak = 0; fgain = fgaintab[ab->lfefgaincod]; snroffset = (((ab->csnroffst - 15) << 4) + ab->lfefsnroffst) << 2; exps = ab->dlfeexps; baps = ab->lfebap; } else { start = 0; end = ab->endmant[chnl]; lowcomp = 0; fastleak = 0; slowleak = 0; fgain = fgaintab[ab->fgaincod[chnl]]; snroffset = (((ab->csnroffst - 15) << 4) + ab->fsnroffst[chnl]) << 2; exps = ab->dexps[chnl]; baps = ab->bap[chnl]; if (ab->deltbae[chnl] == AC3_DBASTR_NEW || ab->deltbae[chnl] == AC3_DBASTR_REUSE) { do_delta = 1; deltnseg = ab->deltnseg[chnl]; deltoffst = ab->deltoffst[chnl]; deltlen = ab->deltlen[chnl]; deltba = ab->deltba[chnl]; } } for (bin = start; bin < end; bin++) psd[bin] = (3072 - ((int)(exps[bin]) << 7)); j = start; k = masktab[start]; do { lastbin = FFMIN(bndtab[k] + bndsz[k], end); bndpsd[k] = psd[j]; j++; for (i = j; i < lastbin; i++) { bndpsd[k] = logadd(bndpsd[k], psd[j]); j++; } k++; } while (end > lastbin); bndstrt = masktab[start]; bndend = masktab[end - 1] + 1; if (bndstrt == 0) { lowcomp = calc_lowcomp(lowcomp, bndpsd[0], bndpsd[1], 0); excite[0] = bndpsd[0] - fgain - lowcomp; lowcomp = calc_lowcomp(lowcomp, bndpsd[1], bndpsd[2], 1); excite[1] = bndpsd[1] - fgain - lowcomp; begin = 7; for (bin = 2; bin < 7; bin++) { if (bndend != 7 || bin != 6) lowcomp = calc_lowcomp(lowcomp, bndpsd[bin], bndpsd[bin + 1], bin); fastleak = bndpsd[bin] - fgain; slowleak = bndpsd[bin] - sgain; excite[bin] = fastleak - lowcomp; if (bndend != 7 || bin != 6) if (bndpsd[bin] <= bndpsd[bin + 1]) { begin = bin + 1; break; } } for (bin = begin; bin < FFMIN(bndend, 22); bin++) { if (bndend != 7 || bin != 6) lowcomp = calc_lowcomp(lowcomp, bndpsd[bin], bndpsd[bin + 1], bin); fastleak -= fdecay; fastleak = FFMAX(fastleak, bndpsd[bin] - fgain); slowleak -= sdecay; slowleak = FFMAX(slowleak, bndpsd[bin] - sgain); excite[bin] = FFMAX(fastleak - lowcomp, slowleak); } begin = 22; } else { begin = bndstrt; } for (bin = begin; bin < bndend; bin++) { fastleak -= fdecay; fastleak = FFMAX(fastleak, bndpsd[bin] - fgain); slowleak -= sdecay; slowleak = FFMAX(slowleak, bndpsd[bin] - sgain); excite[bin] = FFMAX(fastleak, slowleak); } for (bin = bndstrt; bin < bndend; bin++) { if (bndpsd[bin] < dbknee) excite[bin] += ((dbknee - bndpsd[bin]) >> 2); mask[bin] = FFMAX(excite[bin], hth[bin][fscod]); } if (do_delta) { band = 0; for (seg = 0; seg < deltnseg + 1; seg++) { band += (int)(deltoffst[seg]); if ((int)(deltba[seg]) >= 4) delta = ((int)(deltba[seg]) - 3) << 7; else delta = ((int)(deltba[seg]) - 4) << 7; for (k = 0; k < (int)(deltlen[seg]); k++) { mask[band] += delta; band++; } } } i = start; j = masktab[start]; do { lastbin = FFMIN(bndtab[j] + bndsz[j], end); mask[j] -= snroffset; mask[j] -= floor; if (mask[j] < 0) mask[j] = 0; mask[j] &= 0x1fe0; mask[j] += floor; for (k = i; k < lastbin; k++) { address = (psd[i] - mask[j]) >> 5; address = FFMIN(63, FFMAX(0, address)); baps[i] = baptab[address]; i++; } j++; } while (end > lastbin); }
{ "code": [], "line_no": [] }
static void FUNC_0(AC3DecodeContext *VAR_0, int VAR_1) { ac3_audio_block *ab = &VAR_0->audio_block; int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6; int VAR_7 = 0, VAR_8 = 0, VAR_9 = 0, VAR_10 = 0, VAR_11 = 0; int VAR_12[256], VAR_13[50], VAR_14[50], VAR_15[50], VAR_16; int VAR_17 = 0, VAR_18 = 0, VAR_19 = 0, VAR_20 = 0, VAR_21 = 0, VAR_22 = 0, VAR_23 = 0, VAR_24 = 0; int VAR_25 = 0, VAR_26 = 0, VAR_27 = 0, VAR_28 = 0, VAR_29 = 0, VAR_30 = 0; int VAR_31 = VAR_0->sync_info.VAR_31; uint8_t *exps, *deltoffst = 0, *deltlen = 0, *deltba = 0; uint8_t *baps; int VAR_32 = 0; VAR_2 = sdecaytab[ab->sdcycod]; VAR_3 = fdecaytab[ab->fdcycod]; VAR_4 = sgaintab[ab->sgaincod]; VAR_5 = dbkneetab[ab->dbpbcod]; VAR_6 = floortab[ab->floorcod]; if (VAR_1 == 5) { VAR_17 = ab->cplstrtmant; VAR_18 = ab->cplendmant; VAR_8 = fgaintab[ab->cplfgaincod]; VAR_9 = (((ab->csnroffst - 15) << 4) + ab->cplfsnroffst) << 2; VAR_10 = (ab->cplfleak << 8) + 768; VAR_11 = (ab->cplsleak << 8) + 768; exps = ab->dcplexps; baps = ab->cplbap; if (ab->cpldeltbae == AC3_DBASTR_NEW || ab->cpldeltbae == AC3_DBASTR_REUSE) { VAR_32 = 1; VAR_27 = ab->cpldeltnseg; deltoffst = ab->cpldeltoffst; deltlen = ab->cpldeltlen; deltba = ab->cpldeltba; } } else if (VAR_1 == 6) { VAR_17 = 0; VAR_18 = 7; VAR_7 = 0; VAR_10 = 0; VAR_11 = 0; VAR_8 = fgaintab[ab->lfefgaincod]; VAR_9 = (((ab->csnroffst - 15) << 4) + ab->lfefsnroffst) << 2; exps = ab->dlfeexps; baps = ab->lfebap; } else { VAR_17 = 0; VAR_18 = ab->endmant[VAR_1]; VAR_7 = 0; VAR_10 = 0; VAR_11 = 0; VAR_8 = fgaintab[ab->fgaincod[VAR_1]]; VAR_9 = (((ab->csnroffst - 15) << 4) + ab->fsnroffst[VAR_1]) << 2; exps = ab->dexps[VAR_1]; baps = ab->bap[VAR_1]; if (ab->deltbae[VAR_1] == AC3_DBASTR_NEW || ab->deltbae[VAR_1] == AC3_DBASTR_REUSE) { VAR_32 = 1; VAR_27 = ab->VAR_27[VAR_1]; deltoffst = ab->deltoffst[VAR_1]; deltlen = ab->deltlen[VAR_1]; deltba = ab->deltba[VAR_1]; } } for (VAR_19 = VAR_17; VAR_19 < VAR_18; VAR_19++) VAR_12[VAR_19] = (3072 - ((int)(exps[VAR_19]) << 7)); VAR_21 = VAR_17; VAR_22 = masktab[VAR_17]; do { VAR_23 = FFMIN(bndtab[VAR_22] + bndsz[VAR_22], VAR_18); VAR_13[VAR_22] = VAR_12[VAR_21]; VAR_21++; for (VAR_20 = VAR_21; VAR_20 < VAR_23; VAR_20++) { VAR_13[VAR_22] = logadd(VAR_13[VAR_22], VAR_12[VAR_21]); VAR_21++; } VAR_22++; } while (VAR_18 > VAR_23); VAR_24 = masktab[VAR_17]; VAR_25 = masktab[VAR_18 - 1] + 1; if (VAR_24 == 0) { VAR_7 = calc_lowcomp(VAR_7, VAR_13[0], VAR_13[1], 0); VAR_14[0] = VAR_13[0] - VAR_8 - VAR_7; VAR_7 = calc_lowcomp(VAR_7, VAR_13[1], VAR_13[2], 1); VAR_14[1] = VAR_13[1] - VAR_8 - VAR_7; VAR_26 = 7; for (VAR_19 = 2; VAR_19 < 7; VAR_19++) { if (VAR_25 != 7 || VAR_19 != 6) VAR_7 = calc_lowcomp(VAR_7, VAR_13[VAR_19], VAR_13[VAR_19 + 1], VAR_19); VAR_10 = VAR_13[VAR_19] - VAR_8; VAR_11 = VAR_13[VAR_19] - VAR_4; VAR_14[VAR_19] = VAR_10 - VAR_7; if (VAR_25 != 7 || VAR_19 != 6) if (VAR_13[VAR_19] <= VAR_13[VAR_19 + 1]) { VAR_26 = VAR_19 + 1; break; } } for (VAR_19 = VAR_26; VAR_19 < FFMIN(VAR_25, 22); VAR_19++) { if (VAR_25 != 7 || VAR_19 != 6) VAR_7 = calc_lowcomp(VAR_7, VAR_13[VAR_19], VAR_13[VAR_19 + 1], VAR_19); VAR_10 -= VAR_3; VAR_10 = FFMAX(VAR_10, VAR_13[VAR_19] - VAR_8); VAR_11 -= VAR_2; VAR_11 = FFMAX(VAR_11, VAR_13[VAR_19] - VAR_4); VAR_14[VAR_19] = FFMAX(VAR_10 - VAR_7, VAR_11); } VAR_26 = 22; } else { VAR_26 = VAR_24; } for (VAR_19 = VAR_26; VAR_19 < VAR_25; VAR_19++) { VAR_10 -= VAR_3; VAR_10 = FFMAX(VAR_10, VAR_13[VAR_19] - VAR_8); VAR_11 -= VAR_2; VAR_11 = FFMAX(VAR_11, VAR_13[VAR_19] - VAR_4); VAR_14[VAR_19] = FFMAX(VAR_10, VAR_11); } for (VAR_19 = VAR_24; VAR_19 < VAR_25; VAR_19++) { if (VAR_13[VAR_19] < VAR_5) VAR_14[VAR_19] += ((VAR_5 - VAR_13[VAR_19]) >> 2); VAR_15[VAR_19] = FFMAX(VAR_14[VAR_19], hth[VAR_19][VAR_31]); } if (VAR_32) { VAR_28 = 0; for (VAR_29 = 0; VAR_29 < VAR_27 + 1; VAR_29++) { VAR_28 += (int)(deltoffst[VAR_29]); if ((int)(deltba[VAR_29]) >= 4) VAR_16 = ((int)(deltba[VAR_29]) - 3) << 7; else VAR_16 = ((int)(deltba[VAR_29]) - 4) << 7; for (VAR_22 = 0; VAR_22 < (int)(deltlen[VAR_29]); VAR_22++) { VAR_15[VAR_28] += VAR_16; VAR_28++; } } } VAR_20 = VAR_17; VAR_21 = masktab[VAR_17]; do { VAR_23 = FFMIN(bndtab[VAR_21] + bndsz[VAR_21], VAR_18); VAR_15[VAR_21] -= VAR_9; VAR_15[VAR_21] -= VAR_6; if (VAR_15[VAR_21] < 0) VAR_15[VAR_21] = 0; VAR_15[VAR_21] &= 0x1fe0; VAR_15[VAR_21] += VAR_6; for (VAR_22 = VAR_20; VAR_22 < VAR_23; VAR_22++) { VAR_30 = (VAR_12[VAR_20] - VAR_15[VAR_21]) >> 5; VAR_30 = FFMIN(63, FFMAX(0, VAR_30)); baps[VAR_20] = baptab[VAR_30]; VAR_20++; } VAR_21++; } while (VAR_18 > VAR_23); }
[ "static void FUNC_0(AC3DecodeContext *VAR_0, int VAR_1)\n{", "ac3_audio_block *ab = &VAR_0->audio_block;", "int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6;", "int VAR_7 = 0, VAR_8 = 0, VAR_9 = 0, VAR_10 = 0, VAR_11 = 0;", "int VAR_12[256], VAR_13[50], VAR_14[50], VAR_15[50], VAR_16;", "int VAR_17 = 0, VAR_18 = 0, VAR_19 = 0, VAR_20 = 0, VAR_21 = 0, VAR_22 = 0, VAR_23 = 0, VAR_24 = 0;", "int VAR_25 = 0, VAR_26 = 0, VAR_27 = 0, VAR_28 = 0, VAR_29 = 0, VAR_30 = 0;", "int VAR_31 = VAR_0->sync_info.VAR_31;", "uint8_t *exps, *deltoffst = 0, *deltlen = 0, *deltba = 0;", "uint8_t *baps;", "int VAR_32 = 0;", "VAR_2 = sdecaytab[ab->sdcycod];", "VAR_3 = fdecaytab[ab->fdcycod];", "VAR_4 = sgaintab[ab->sgaincod];", "VAR_5 = dbkneetab[ab->dbpbcod];", "VAR_6 = floortab[ab->floorcod];", "if (VAR_1 == 5) {", "VAR_17 = ab->cplstrtmant;", "VAR_18 = ab->cplendmant;", "VAR_8 = fgaintab[ab->cplfgaincod];", "VAR_9 = (((ab->csnroffst - 15) << 4) + ab->cplfsnroffst) << 2;", "VAR_10 = (ab->cplfleak << 8) + 768;", "VAR_11 = (ab->cplsleak << 8) + 768;", "exps = ab->dcplexps;", "baps = ab->cplbap;", "if (ab->cpldeltbae == AC3_DBASTR_NEW || ab->cpldeltbae == AC3_DBASTR_REUSE) {", "VAR_32 = 1;", "VAR_27 = ab->cpldeltnseg;", "deltoffst = ab->cpldeltoffst;", "deltlen = ab->cpldeltlen;", "deltba = ab->cpldeltba;", "}", "}", "else if (VAR_1 == 6) {", "VAR_17 = 0;", "VAR_18 = 7;", "VAR_7 = 0;", "VAR_10 = 0;", "VAR_11 = 0;", "VAR_8 = fgaintab[ab->lfefgaincod];", "VAR_9 = (((ab->csnroffst - 15) << 4) + ab->lfefsnroffst) << 2;", "exps = ab->dlfeexps;", "baps = ab->lfebap;", "}", "else {", "VAR_17 = 0;", "VAR_18 = ab->endmant[VAR_1];", "VAR_7 = 0;", "VAR_10 = 0;", "VAR_11 = 0;", "VAR_8 = fgaintab[ab->fgaincod[VAR_1]];", "VAR_9 = (((ab->csnroffst - 15) << 4) + ab->fsnroffst[VAR_1]) << 2;", "exps = ab->dexps[VAR_1];", "baps = ab->bap[VAR_1];", "if (ab->deltbae[VAR_1] == AC3_DBASTR_NEW || ab->deltbae[VAR_1] == AC3_DBASTR_REUSE) {", "VAR_32 = 1;", "VAR_27 = ab->VAR_27[VAR_1];", "deltoffst = ab->deltoffst[VAR_1];", "deltlen = ab->deltlen[VAR_1];", "deltba = ab->deltba[VAR_1];", "}", "}", "for (VAR_19 = VAR_17; VAR_19 < VAR_18; VAR_19++)", "VAR_12[VAR_19] = (3072 - ((int)(exps[VAR_19]) << 7));", "VAR_21 = VAR_17;", "VAR_22 = masktab[VAR_17];", "do {", "VAR_23 = FFMIN(bndtab[VAR_22] + bndsz[VAR_22], VAR_18);", "VAR_13[VAR_22] = VAR_12[VAR_21];", "VAR_21++;", "for (VAR_20 = VAR_21; VAR_20 < VAR_23; VAR_20++) {", "VAR_13[VAR_22] = logadd(VAR_13[VAR_22], VAR_12[VAR_21]);", "VAR_21++;", "}", "VAR_22++;", "} while (VAR_18 > VAR_23);", "VAR_24 = masktab[VAR_17];", "VAR_25 = masktab[VAR_18 - 1] + 1;", "if (VAR_24 == 0) {", "VAR_7 = calc_lowcomp(VAR_7, VAR_13[0], VAR_13[1], 0);", "VAR_14[0] = VAR_13[0] - VAR_8 - VAR_7;", "VAR_7 = calc_lowcomp(VAR_7, VAR_13[1], VAR_13[2], 1);", "VAR_14[1] = VAR_13[1] - VAR_8 - VAR_7;", "VAR_26 = 7;", "for (VAR_19 = 2; VAR_19 < 7; VAR_19++) {", "if (VAR_25 != 7 || VAR_19 != 6)\nVAR_7 = calc_lowcomp(VAR_7, VAR_13[VAR_19], VAR_13[VAR_19 + 1], VAR_19);", "VAR_10 = VAR_13[VAR_19] - VAR_8;", "VAR_11 = VAR_13[VAR_19] - VAR_4;", "VAR_14[VAR_19] = VAR_10 - VAR_7;", "if (VAR_25 != 7 || VAR_19 != 6)\nif (VAR_13[VAR_19] <= VAR_13[VAR_19 + 1]) {", "VAR_26 = VAR_19 + 1;", "break;", "}", "}", "for (VAR_19 = VAR_26; VAR_19 < FFMIN(VAR_25, 22); VAR_19++) {", "if (VAR_25 != 7 || VAR_19 != 6)\nVAR_7 = calc_lowcomp(VAR_7, VAR_13[VAR_19], VAR_13[VAR_19 + 1], VAR_19);", "VAR_10 -= VAR_3;", "VAR_10 = FFMAX(VAR_10, VAR_13[VAR_19] - VAR_8);", "VAR_11 -= VAR_2;", "VAR_11 = FFMAX(VAR_11, VAR_13[VAR_19] - VAR_4);", "VAR_14[VAR_19] = FFMAX(VAR_10 - VAR_7, VAR_11);", "}", "VAR_26 = 22;", "}", "else {", "VAR_26 = VAR_24;", "}", "for (VAR_19 = VAR_26; VAR_19 < VAR_25; VAR_19++) {", "VAR_10 -= VAR_3;", "VAR_10 = FFMAX(VAR_10, VAR_13[VAR_19] - VAR_8);", "VAR_11 -= VAR_2;", "VAR_11 = FFMAX(VAR_11, VAR_13[VAR_19] - VAR_4);", "VAR_14[VAR_19] = FFMAX(VAR_10, VAR_11);", "}", "for (VAR_19 = VAR_24; VAR_19 < VAR_25; VAR_19++) {", "if (VAR_13[VAR_19] < VAR_5)\nVAR_14[VAR_19] += ((VAR_5 - VAR_13[VAR_19]) >> 2);", "VAR_15[VAR_19] = FFMAX(VAR_14[VAR_19], hth[VAR_19][VAR_31]);", "}", "if (VAR_32) {", "VAR_28 = 0;", "for (VAR_29 = 0; VAR_29 < VAR_27 + 1; VAR_29++) {", "VAR_28 += (int)(deltoffst[VAR_29]);", "if ((int)(deltba[VAR_29]) >= 4)\nVAR_16 = ((int)(deltba[VAR_29]) - 3) << 7;", "else\nVAR_16 = ((int)(deltba[VAR_29]) - 4) << 7;", "for (VAR_22 = 0; VAR_22 < (int)(deltlen[VAR_29]); VAR_22++) {", "VAR_15[VAR_28] += VAR_16;", "VAR_28++;", "}", "}", "}", "VAR_20 = VAR_17;", "VAR_21 = masktab[VAR_17];", "do {", "VAR_23 = FFMIN(bndtab[VAR_21] + bndsz[VAR_21], VAR_18);", "VAR_15[VAR_21] -= VAR_9;", "VAR_15[VAR_21] -= VAR_6;", "if (VAR_15[VAR_21] < 0)\nVAR_15[VAR_21] = 0;", "VAR_15[VAR_21] &= 0x1fe0;", "VAR_15[VAR_21] += VAR_6;", "for (VAR_22 = VAR_20; VAR_22 < VAR_23; VAR_22++) {", "VAR_30 = (VAR_12[VAR_20] - VAR_15[VAR_21]) >> 5;", "VAR_30 = FFMIN(63, FFMAX(0, VAR_30));", "baps[VAR_20] = baptab[VAR_30];", "VAR_20++;", "}", "VAR_21++;", "} while (VAR_18 > VAR_23);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 135 ], [ 137 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 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 ], [ 257 ], [ 259, 261 ], [ 263 ], [ 265 ], [ 271 ], [ 273 ], [ 275 ], [ 277 ], [ 279, 281 ], [ 283, 285 ], [ 287 ], [ 289 ], [ 291 ], [ 293 ], [ 295 ], [ 297 ], [ 303 ], [ 305 ], [ 307 ], [ 309 ], [ 311 ], [ 313 ], [ 315, 317 ], [ 319 ], [ 321 ], [ 323 ], [ 325 ], [ 327 ], [ 329 ], [ 331 ], [ 333 ], [ 335 ], [ 337 ], [ 339 ] ]
15,045
static int add_shorts_metadata(int count, const char *name, const char *sep, TiffContext *s) { char *ap; int i; int16_t *sp; if (bytestream2_get_bytes_left(&s->gb) < count * sizeof(int16_t)) return -1; sp = av_malloc(count * sizeof(int16_t)); if (!sp) return AVERROR(ENOMEM); for (i = 0; i < count; i++) sp[i] = tget_short(&s->gb, s->le); ap = shorts2str(sp, count, sep); av_freep(&sp); if (!ap) return AVERROR(ENOMEM); av_dict_set(&s->picture.metadata, name, ap, AV_DICT_DONT_STRDUP_VAL); return 0; }
false
FFmpeg
292850b634240045805e3c2001aed6f046034e93
static int add_shorts_metadata(int count, const char *name, const char *sep, TiffContext *s) { char *ap; int i; int16_t *sp; if (bytestream2_get_bytes_left(&s->gb) < count * sizeof(int16_t)) return -1; sp = av_malloc(count * sizeof(int16_t)); if (!sp) return AVERROR(ENOMEM); for (i = 0; i < count; i++) sp[i] = tget_short(&s->gb, s->le); ap = shorts2str(sp, count, sep); av_freep(&sp); if (!ap) return AVERROR(ENOMEM); av_dict_set(&s->picture.metadata, name, ap, AV_DICT_DONT_STRDUP_VAL); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(int VAR_0, const char *VAR_1, const char *VAR_2, TiffContext *VAR_3) { char *VAR_4; int VAR_5; int16_t *sp; if (bytestream2_get_bytes_left(&VAR_3->gb) < VAR_0 * sizeof(int16_t)) return -1; sp = av_malloc(VAR_0 * sizeof(int16_t)); if (!sp) return AVERROR(ENOMEM); for (VAR_5 = 0; VAR_5 < VAR_0; VAR_5++) sp[VAR_5] = tget_short(&VAR_3->gb, VAR_3->le); VAR_4 = shorts2str(sp, VAR_0, VAR_2); av_freep(&sp); if (!VAR_4) return AVERROR(ENOMEM); av_dict_set(&VAR_3->picture.metadata, VAR_1, VAR_4, AV_DICT_DONT_STRDUP_VAL); return 0; }
[ "static int FUNC_0(int VAR_0, const char *VAR_1,\nconst char *VAR_2, TiffContext *VAR_3)\n{", "char *VAR_4;", "int VAR_5;", "int16_t *sp;", "if (bytestream2_get_bytes_left(&VAR_3->gb) < VAR_0 * sizeof(int16_t))\nreturn -1;", "sp = av_malloc(VAR_0 * sizeof(int16_t));", "if (!sp)\nreturn AVERROR(ENOMEM);", "for (VAR_5 = 0; VAR_5 < VAR_0; VAR_5++)", "sp[VAR_5] = tget_short(&VAR_3->gb, VAR_3->le);", "VAR_4 = shorts2str(sp, VAR_0, VAR_2);", "av_freep(&sp);", "if (!VAR_4)\nreturn AVERROR(ENOMEM);", "av_dict_set(&VAR_3->picture.metadata, VAR_1, VAR_4, AV_DICT_DONT_STRDUP_VAL);", "return 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 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37, 39 ], [ 41 ], [ 43 ], [ 45 ] ]
15,046
int av_open_input_file(AVFormatContext **ic_ptr, const char *filename, AVInputFormat *fmt, int buf_size, AVFormatParameters *ap) { int err; AVProbeData probe_data, *pd = &probe_data; ByteIOContext *pb = NULL; void *logctx= ap && ap->prealloced_context ? *ic_ptr : NULL; pd->filename = ""; if (filename) pd->filename = filename; pd->buf = NULL; pd->buf_size = 0; if (!fmt) { /* guess format if no file can be opened */ fmt = av_probe_input_format(pd, 0); } /* Do not open file if the format does not need it. XXX: specific hack needed to handle RTSP/TCP */ if (!fmt || !(fmt->flags & AVFMT_NOFILE)) { /* if no file needed do not try to open one */ if ((err=url_fopen(&pb, filename, URL_RDONLY)) < 0) { goto fail; } if (buf_size > 0) { url_setbufsize(pb, buf_size); } if ((err = ff_probe_input_buffer(&pb, &fmt, filename, logctx, 0, 0)) < 0) { goto fail; } } /* if still no format found, error */ if (!fmt) { err = AVERROR_NOFMT; goto fail; } /* check filename in case an image number is expected */ if (fmt->flags & AVFMT_NEEDNUMBER) { if (!av_filename_number_test(filename)) { err = AVERROR_NUMEXPECTED; goto fail; } } err = av_open_input_stream(ic_ptr, pb, filename, fmt, ap); if (err) goto fail; return 0; fail: av_freep(&pd->buf); if (pb) url_fclose(pb); if (ap && ap->prealloced_context) av_free(*ic_ptr); *ic_ptr = NULL; return err; }
false
FFmpeg
2928b83c7581ef3d66108684a2e6f07f5d049b50
int av_open_input_file(AVFormatContext **ic_ptr, const char *filename, AVInputFormat *fmt, int buf_size, AVFormatParameters *ap) { int err; AVProbeData probe_data, *pd = &probe_data; ByteIOContext *pb = NULL; void *logctx= ap && ap->prealloced_context ? *ic_ptr : NULL; pd->filename = ""; if (filename) pd->filename = filename; pd->buf = NULL; pd->buf_size = 0; if (!fmt) { fmt = av_probe_input_format(pd, 0); } if (!fmt || !(fmt->flags & AVFMT_NOFILE)) { if ((err=url_fopen(&pb, filename, URL_RDONLY)) < 0) { goto fail; } if (buf_size > 0) { url_setbufsize(pb, buf_size); } if ((err = ff_probe_input_buffer(&pb, &fmt, filename, logctx, 0, 0)) < 0) { goto fail; } } if (!fmt) { err = AVERROR_NOFMT; goto fail; } if (fmt->flags & AVFMT_NEEDNUMBER) { if (!av_filename_number_test(filename)) { err = AVERROR_NUMEXPECTED; goto fail; } } err = av_open_input_stream(ic_ptr, pb, filename, fmt, ap); if (err) goto fail; return 0; fail: av_freep(&pd->buf); if (pb) url_fclose(pb); if (ap && ap->prealloced_context) av_free(*ic_ptr); *ic_ptr = NULL; return err; }
{ "code": [], "line_no": [] }
int FUNC_0(AVFormatContext **VAR_0, const char *VAR_1, AVInputFormat *VAR_2, int VAR_3, AVFormatParameters *VAR_4) { int VAR_5; AVProbeData probe_data, *pd = &probe_data; ByteIOContext *pb = NULL; void *VAR_6= VAR_4 && VAR_4->prealloced_context ? *VAR_0 : NULL; pd->VAR_1 = ""; if (VAR_1) pd->VAR_1 = VAR_1; pd->buf = NULL; pd->VAR_3 = 0; if (!VAR_2) { VAR_2 = av_probe_input_format(pd, 0); } if (!VAR_2 || !(VAR_2->flags & AVFMT_NOFILE)) { if ((VAR_5=url_fopen(&pb, VAR_1, URL_RDONLY)) < 0) { goto fail; } if (VAR_3 > 0) { url_setbufsize(pb, VAR_3); } if ((VAR_5 = ff_probe_input_buffer(&pb, &VAR_2, VAR_1, VAR_6, 0, 0)) < 0) { goto fail; } } if (!VAR_2) { VAR_5 = AVERROR_NOFMT; goto fail; } if (VAR_2->flags & AVFMT_NEEDNUMBER) { if (!av_filename_number_test(VAR_1)) { VAR_5 = AVERROR_NUMEXPECTED; goto fail; } } VAR_5 = av_open_input_stream(VAR_0, pb, VAR_1, VAR_2, VAR_4); if (VAR_5) goto fail; return 0; fail: av_freep(&pd->buf); if (pb) url_fclose(pb); if (VAR_4 && VAR_4->prealloced_context) av_free(*VAR_0); *VAR_0 = NULL; return VAR_5; }
[ "int FUNC_0(AVFormatContext **VAR_0, const char *VAR_1,\nAVInputFormat *VAR_2,\nint VAR_3,\nAVFormatParameters *VAR_4)\n{", "int VAR_5;", "AVProbeData probe_data, *pd = &probe_data;", "ByteIOContext *pb = NULL;", "void *VAR_6= VAR_4 && VAR_4->prealloced_context ? *VAR_0 : NULL;", "pd->VAR_1 = \"\";", "if (VAR_1)\npd->VAR_1 = VAR_1;", "pd->buf = NULL;", "pd->VAR_3 = 0;", "if (!VAR_2) {", "VAR_2 = av_probe_input_format(pd, 0);", "}", "if (!VAR_2 || !(VAR_2->flags & AVFMT_NOFILE)) {", "if ((VAR_5=url_fopen(&pb, VAR_1, URL_RDONLY)) < 0) {", "goto fail;", "}", "if (VAR_3 > 0) {", "url_setbufsize(pb, VAR_3);", "}", "if ((VAR_5 = ff_probe_input_buffer(&pb, &VAR_2, VAR_1, VAR_6, 0, 0)) < 0) {", "goto fail;", "}", "}", "if (!VAR_2) {", "VAR_5 = AVERROR_NOFMT;", "goto fail;", "}", "if (VAR_2->flags & AVFMT_NEEDNUMBER) {", "if (!av_filename_number_test(VAR_1)) {", "VAR_5 = AVERROR_NUMEXPECTED;", "goto fail;", "}", "}", "VAR_5 = av_open_input_stream(VAR_0, pb, VAR_1, VAR_2, VAR_4);", "if (VAR_5)\ngoto fail;", "return 0;", "fail:\nav_freep(&pd->buf);", "if (pb)\nurl_fclose(pb);", "if (VAR_4 && VAR_4->prealloced_context)\nav_free(*VAR_0);", "*VAR_0 = NULL;", "return VAR_5;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 29 ], [ 33 ], [ 37 ], [ 39 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101, 103 ], [ 105 ], [ 107, 109 ], [ 111, 113 ], [ 115, 117 ], [ 119 ], [ 121 ], [ 125 ] ]
15,047
static int amr_probe(AVProbeData *p) { //Only check for "#!AMR" which could be amr-wb, amr-nb. //This will also trigger multichannel files: "#!AMR_MC1.0\n" and //"#!AMR-WB_MC1.0\n" (not supported) if (p->buf_size < 5) return 0; if(memcmp(p->buf,AMR_header,5)==0) return AVPROBE_SCORE_MAX; else return 0; }
false
FFmpeg
87e8788680e16c51f6048af26f3f7830c35207a5
static int amr_probe(AVProbeData *p) { if (p->buf_size < 5) return 0; if(memcmp(p->buf,AMR_header,5)==0) return AVPROBE_SCORE_MAX; else return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVProbeData *VAR_0) { if (VAR_0->buf_size < 5) return 0; if(memcmp(VAR_0->buf,AMR_header,5)==0) return AVPROBE_SCORE_MAX; else return 0; }
[ "static int FUNC_0(AVProbeData *VAR_0)\n{", "if (VAR_0->buf_size < 5)\nreturn 0;", "if(memcmp(VAR_0->buf,AMR_header,5)==0)\nreturn AVPROBE_SCORE_MAX;", "else\nreturn 0;", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 13, 15 ], [ 17, 19 ], [ 21, 23 ], [ 25 ] ]
15,048
static int http_read_stream(URLContext *h, uint8_t *buf, int size) { HTTPContext *s = h->priv_data; int err, new_location, read_ret; int64_t seek_ret; int reconnect_delay = 0; if (!s->hd) return AVERROR_EOF; if (s->end_chunked_post && !s->end_header) { err = http_read_header(h, &new_location); if (err < 0) return err; } #if CONFIG_ZLIB if (s->compressed) return http_buf_read_compressed(h, buf, size); #endif /* CONFIG_ZLIB */ read_ret = http_buf_read(h, buf, size); while ((read_ret < 0 && s->reconnect && (!h->is_streamed || s->reconnect_streamed) && s->filesize > 0 && s->off < s->filesize) || (read_ret == AVERROR_EOF && s->reconnect_at_eof && (!h->is_streamed || s->reconnect_streamed))) { uint64_t target = h->is_streamed ? 0 : s->off; if (read_ret == AVERROR_EXIT) return read_ret; if (reconnect_delay > s->reconnect_delay_max) return AVERROR(EIO); av_log(h, AV_LOG_WARNING, "Will reconnect at %"PRIu64" in %d second(s), error=%s.\n", s->off, reconnect_delay, av_err2str(read_ret)); err = ff_network_sleep_interruptible(1000U*1000*reconnect_delay, &h->interrupt_callback); if (err != AVERROR(ETIMEDOUT)) return err; reconnect_delay = 1 + 2*reconnect_delay; seek_ret = http_seek_internal(h, target, SEEK_SET, 1); if (seek_ret >= 0 && seek_ret != target) { av_log(h, AV_LOG_ERROR, "Failed to reconnect at %"PRIu64".\n", target); return read_ret; } read_ret = http_buf_read(h, buf, size); } return read_ret; }
false
FFmpeg
43e1ccfea186080b1c4cb4cd1e59ac1a3c3dc446
static int http_read_stream(URLContext *h, uint8_t *buf, int size) { HTTPContext *s = h->priv_data; int err, new_location, read_ret; int64_t seek_ret; int reconnect_delay = 0; if (!s->hd) return AVERROR_EOF; if (s->end_chunked_post && !s->end_header) { err = http_read_header(h, &new_location); if (err < 0) return err; } #if CONFIG_ZLIB if (s->compressed) return http_buf_read_compressed(h, buf, size); #endif read_ret = http_buf_read(h, buf, size); while ((read_ret < 0 && s->reconnect && (!h->is_streamed || s->reconnect_streamed) && s->filesize > 0 && s->off < s->filesize) || (read_ret == AVERROR_EOF && s->reconnect_at_eof && (!h->is_streamed || s->reconnect_streamed))) { uint64_t target = h->is_streamed ? 0 : s->off; if (read_ret == AVERROR_EXIT) return read_ret; if (reconnect_delay > s->reconnect_delay_max) return AVERROR(EIO); av_log(h, AV_LOG_WARNING, "Will reconnect at %"PRIu64" in %d second(s), error=%s.\n", s->off, reconnect_delay, av_err2str(read_ret)); err = ff_network_sleep_interruptible(1000U*1000*reconnect_delay, &h->interrupt_callback); if (err != AVERROR(ETIMEDOUT)) return err; reconnect_delay = 1 + 2*reconnect_delay; seek_ret = http_seek_internal(h, target, SEEK_SET, 1); if (seek_ret >= 0 && seek_ret != target) { av_log(h, AV_LOG_ERROR, "Failed to reconnect at %"PRIu64".\n", target); return read_ret; } read_ret = http_buf_read(h, buf, size); } return read_ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(URLContext *VAR_0, uint8_t *VAR_1, int VAR_2) { HTTPContext *s = VAR_0->priv_data; int VAR_3, VAR_4, VAR_5; int64_t seek_ret; int VAR_6 = 0; if (!s->hd) return AVERROR_EOF; if (s->end_chunked_post && !s->end_header) { VAR_3 = http_read_header(VAR_0, &VAR_4); if (VAR_3 < 0) return VAR_3; } #if CONFIG_ZLIB if (s->compressed) return http_buf_read_compressed(VAR_0, VAR_1, VAR_2); #endif VAR_5 = http_buf_read(VAR_0, VAR_1, VAR_2); while ((VAR_5 < 0 && s->reconnect && (!VAR_0->is_streamed || s->reconnect_streamed) && s->filesize > 0 && s->off < s->filesize) || (VAR_5 == AVERROR_EOF && s->reconnect_at_eof && (!VAR_0->is_streamed || s->reconnect_streamed))) { uint64_t target = VAR_0->is_streamed ? 0 : s->off; if (VAR_5 == AVERROR_EXIT) return VAR_5; if (VAR_6 > s->reconnect_delay_max) return AVERROR(EIO); av_log(VAR_0, AV_LOG_WARNING, "Will reconnect at %"PRIu64" in %d second(s), error=%s.\n", s->off, VAR_6, av_err2str(VAR_5)); VAR_3 = ff_network_sleep_interruptible(1000U*1000*VAR_6, &VAR_0->interrupt_callback); if (VAR_3 != AVERROR(ETIMEDOUT)) return VAR_3; VAR_6 = 1 + 2*VAR_6; seek_ret = http_seek_internal(VAR_0, target, SEEK_SET, 1); if (seek_ret >= 0 && seek_ret != target) { av_log(VAR_0, AV_LOG_ERROR, "Failed to reconnect at %"PRIu64".\n", target); return VAR_5; } VAR_5 = http_buf_read(VAR_0, VAR_1, VAR_2); } return VAR_5; }
[ "static int FUNC_0(URLContext *VAR_0, uint8_t *VAR_1, int VAR_2)\n{", "HTTPContext *s = VAR_0->priv_data;", "int VAR_3, VAR_4, VAR_5;", "int64_t seek_ret;", "int VAR_6 = 0;", "if (!s->hd)\nreturn AVERROR_EOF;", "if (s->end_chunked_post && !s->end_header) {", "VAR_3 = http_read_header(VAR_0, &VAR_4);", "if (VAR_3 < 0)\nreturn VAR_3;", "}", "#if CONFIG_ZLIB\nif (s->compressed)\nreturn http_buf_read_compressed(VAR_0, VAR_1, VAR_2);", "#endif\nVAR_5 = http_buf_read(VAR_0, VAR_1, VAR_2);", "while ((VAR_5 < 0 && s->reconnect && (!VAR_0->is_streamed || s->reconnect_streamed) && s->filesize > 0 && s->off < s->filesize)\n|| (VAR_5 == AVERROR_EOF && s->reconnect_at_eof && (!VAR_0->is_streamed || s->reconnect_streamed))) {", "uint64_t target = VAR_0->is_streamed ? 0 : s->off;", "if (VAR_5 == AVERROR_EXIT)\nreturn VAR_5;", "if (VAR_6 > s->reconnect_delay_max)\nreturn AVERROR(EIO);", "av_log(VAR_0, AV_LOG_WARNING, \"Will reconnect at %\"PRIu64\" in %d second(s), error=%s.\\n\", s->off, VAR_6, av_err2str(VAR_5));", "VAR_3 = ff_network_sleep_interruptible(1000U*1000*VAR_6, &VAR_0->interrupt_callback);", "if (VAR_3 != AVERROR(ETIMEDOUT))\nreturn VAR_3;", "VAR_6 = 1 + 2*VAR_6;", "seek_ret = http_seek_internal(VAR_0, target, SEEK_SET, 1);", "if (seek_ret >= 0 && seek_ret != target) {", "av_log(VAR_0, AV_LOG_ERROR, \"Failed to reconnect at %\"PRIu64\".\\n\", target);", "return VAR_5;", "}", "VAR_5 = http_buf_read(VAR_0, VAR_1, VAR_2);", "}", "return VAR_5;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15, 17 ], [ 21 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 33, 35, 37 ], [ 39, 41 ], [ 43, 45 ], [ 47 ], [ 51, 53 ], [ 57, 59 ], [ 63 ], [ 65 ], [ 67, 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 85 ], [ 87 ], [ 91 ], [ 93 ] ]
15,049
static int yuv4_probe(AVProbeData *pd) { /* check file header */ if (pd->buf_size <= sizeof(Y4M_MAGIC)) return 0; if (strncmp(pd->buf, Y4M_MAGIC, sizeof(Y4M_MAGIC)-1)==0) return AVPROBE_SCORE_MAX; else return 0; }
false
FFmpeg
87e8788680e16c51f6048af26f3f7830c35207a5
static int yuv4_probe(AVProbeData *pd) { if (pd->buf_size <= sizeof(Y4M_MAGIC)) return 0; if (strncmp(pd->buf, Y4M_MAGIC, sizeof(Y4M_MAGIC)-1)==0) return AVPROBE_SCORE_MAX; else return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVProbeData *VAR_0) { if (VAR_0->buf_size <= sizeof(Y4M_MAGIC)) return 0; if (strncmp(VAR_0->buf, Y4M_MAGIC, sizeof(Y4M_MAGIC)-1)==0) return AVPROBE_SCORE_MAX; else return 0; }
[ "static int FUNC_0(AVProbeData *VAR_0)\n{", "if (VAR_0->buf_size <= sizeof(Y4M_MAGIC))\nreturn 0;", "if (strncmp(VAR_0->buf, Y4M_MAGIC, sizeof(Y4M_MAGIC)-1)==0)\nreturn AVPROBE_SCORE_MAX;", "else\nreturn 0;", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 7, 9 ], [ 11, 13 ], [ 15, 17 ], [ 19 ] ]
15,050
static rwpipe *rwpipe_open( int argc, char *argv[] ) { rwpipe *this = av_mallocz( sizeof( rwpipe ) ); if ( this != NULL ) { int input[ 2 ]; int output[ 2 ]; pipe( input ); pipe( output ); this->pid = fork(); if ( this->pid == 0 ) { #define COMMAND_SIZE 10240 char *command = av_mallocz( COMMAND_SIZE ); int i; strcpy( command, "" ); for ( i = 0; i < argc; i ++ ) { av_strlcat( command, argv[ i ], COMMAND_SIZE ); av_strlcat( command, " ", COMMAND_SIZE ); } dup2( output[ 0 ], STDIN_FILENO ); dup2( input[ 1 ], STDOUT_FILENO ); close( input[ 0 ] ); close( input[ 1 ] ); close( output[ 0 ] ); close( output[ 1 ] ); execl("/bin/sh", "sh", "-c", command, (char*)NULL ); _exit( 255 ); } else { close( input[ 1 ] ); close( output[ 0 ] ); this->reader = fdopen( input[ 0 ], "r" ); this->writer = fdopen( output[ 1 ], "w" ); } } return this; }
false
FFmpeg
7e10145976866fc6227d3ccc697a7c9fee862a77
static rwpipe *rwpipe_open( int argc, char *argv[] ) { rwpipe *this = av_mallocz( sizeof( rwpipe ) ); if ( this != NULL ) { int input[ 2 ]; int output[ 2 ]; pipe( input ); pipe( output ); this->pid = fork(); if ( this->pid == 0 ) { #define COMMAND_SIZE 10240 char *command = av_mallocz( COMMAND_SIZE ); int i; strcpy( command, "" ); for ( i = 0; i < argc; i ++ ) { av_strlcat( command, argv[ i ], COMMAND_SIZE ); av_strlcat( command, " ", COMMAND_SIZE ); } dup2( output[ 0 ], STDIN_FILENO ); dup2( input[ 1 ], STDOUT_FILENO ); close( input[ 0 ] ); close( input[ 1 ] ); close( output[ 0 ] ); close( output[ 1 ] ); execl("/bin/sh", "sh", "-c", command, (char*)NULL ); _exit( 255 ); } else { close( input[ 1 ] ); close( output[ 0 ] ); this->reader = fdopen( input[ 0 ], "r" ); this->writer = fdopen( output[ 1 ], "w" ); } } return this; }
{ "code": [], "line_no": [] }
static rwpipe *FUNC_0( int argc, char *argv[] ) { rwpipe *this = av_mallocz( sizeof( rwpipe ) ); if ( this != NULL ) { int VAR_0[ 2 ]; int VAR_1[ 2 ]; pipe( VAR_0 ); pipe( VAR_1 ); this->pid = fork(); if ( this->pid == 0 ) { #define COMMAND_SIZE 10240 char *VAR_2 = av_mallocz( COMMAND_SIZE ); int VAR_3; strcpy( VAR_2, "" ); for ( VAR_3 = 0; VAR_3 < argc; VAR_3 ++ ) { av_strlcat( VAR_2, argv[ VAR_3 ], COMMAND_SIZE ); av_strlcat( VAR_2, " ", COMMAND_SIZE ); } dup2( VAR_1[ 0 ], STDIN_FILENO ); dup2( VAR_0[ 1 ], STDOUT_FILENO ); close( VAR_0[ 0 ] ); close( VAR_0[ 1 ] ); close( VAR_1[ 0 ] ); close( VAR_1[ 1 ] ); execl("/bin/sh", "sh", "-c", VAR_2, (char*)NULL ); _exit( 255 ); } else { close( VAR_0[ 1 ] ); close( VAR_1[ 0 ] ); this->reader = fdopen( VAR_0[ 0 ], "r" ); this->writer = fdopen( VAR_1[ 1 ], "w" ); } } return this; }
[ "static rwpipe *FUNC_0( int argc, char *argv[] )\n{", "rwpipe *this = av_mallocz( sizeof( rwpipe ) );", "if ( this != NULL )\n{", "int VAR_0[ 2 ];", "int VAR_1[ 2 ];", "pipe( VAR_0 );", "pipe( VAR_1 );", "this->pid = fork();", "if ( this->pid == 0 )\n{", "#define COMMAND_SIZE 10240\nchar *VAR_2 = av_mallocz( COMMAND_SIZE );", "int VAR_3;", "strcpy( VAR_2, \"\" );", "for ( VAR_3 = 0; VAR_3 < argc; VAR_3 ++ )", "{", "av_strlcat( VAR_2, argv[ VAR_3 ], COMMAND_SIZE );", "av_strlcat( VAR_2, \" \", COMMAND_SIZE );", "}", "dup2( VAR_1[ 0 ], STDIN_FILENO );", "dup2( VAR_0[ 1 ], STDOUT_FILENO );", "close( VAR_0[ 0 ] );", "close( VAR_0[ 1 ] );", "close( VAR_1[ 0 ] );", "close( VAR_1[ 1 ] );", "execl(\"/bin/sh\", \"sh\", \"-c\", VAR_2, (char*)NULL );", "_exit( 255 );", "}", "else\n{", "close( VAR_0[ 1 ] );", "close( VAR_1[ 0 ] );", "this->reader = fdopen( VAR_0[ 0 ], \"r\" );", "this->writer = fdopen( VAR_1[ 1 ], \"w\" );", "}", "}", "return this;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 25 ], [ 29, 31 ], [ 33, 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77, 79 ], [ 81 ], [ 83 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 97 ], [ 99 ] ]
15,052
static int validate_codec_tag(AVFormatContext *s, AVStream *st) { const AVCodecTag *avctag; int n; enum AVCodecID id = AV_CODEC_ID_NONE; unsigned int tag = 0; /** * Check that tag + id is in the table * If neither is in the table -> OK * If tag is in the table with another id -> FAIL * If id is in the table with another tag -> FAIL unless strict < normal */ for (n = 0; s->oformat->codec_tag[n]; n++) { avctag = s->oformat->codec_tag[n]; while (avctag->id != AV_CODEC_ID_NONE) { if (avpriv_toupper4(avctag->tag) == avpriv_toupper4(st->codec->codec_tag)) { id = avctag->id; if (id == st->codec->codec_id) return 1; } if (avctag->id == st->codec->codec_id) tag = avctag->tag; avctag++; } } if (id != AV_CODEC_ID_NONE) return 0; if (tag && (st->codec->strict_std_compliance >= FF_COMPLIANCE_NORMAL)) return 0; return 1; }
false
FFmpeg
e9a26dc5bf66e106dbe3b81b2d59367f7e971e5c
static int validate_codec_tag(AVFormatContext *s, AVStream *st) { const AVCodecTag *avctag; int n; enum AVCodecID id = AV_CODEC_ID_NONE; unsigned int tag = 0; for (n = 0; s->oformat->codec_tag[n]; n++) { avctag = s->oformat->codec_tag[n]; while (avctag->id != AV_CODEC_ID_NONE) { if (avpriv_toupper4(avctag->tag) == avpriv_toupper4(st->codec->codec_tag)) { id = avctag->id; if (id == st->codec->codec_id) return 1; } if (avctag->id == st->codec->codec_id) tag = avctag->tag; avctag++; } } if (id != AV_CODEC_ID_NONE) return 0; if (tag && (st->codec->strict_std_compliance >= FF_COMPLIANCE_NORMAL)) return 0; return 1; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0, AVStream *VAR_1) { const AVCodecTag *VAR_2; int VAR_3; enum AVCodecID VAR_4 = AV_CODEC_ID_NONE; unsigned int VAR_5 = 0; for (VAR_3 = 0; VAR_0->oformat->codec_tag[VAR_3]; VAR_3++) { VAR_2 = VAR_0->oformat->codec_tag[VAR_3]; while (VAR_2->VAR_4 != AV_CODEC_ID_NONE) { if (avpriv_toupper4(VAR_2->VAR_5) == avpriv_toupper4(VAR_1->codec->codec_tag)) { VAR_4 = VAR_2->VAR_4; if (VAR_4 == VAR_1->codec->codec_id) return 1; } if (VAR_2->VAR_4 == VAR_1->codec->codec_id) VAR_5 = VAR_2->VAR_5; VAR_2++; } } if (VAR_4 != AV_CODEC_ID_NONE) return 0; if (VAR_5 && (VAR_1->codec->strict_std_compliance >= FF_COMPLIANCE_NORMAL)) return 0; return 1; }
[ "static int FUNC_0(AVFormatContext *VAR_0, AVStream *VAR_1)\n{", "const AVCodecTag *VAR_2;", "int VAR_3;", "enum AVCodecID VAR_4 = AV_CODEC_ID_NONE;", "unsigned int VAR_5 = 0;", "for (VAR_3 = 0; VAR_0->oformat->codec_tag[VAR_3]; VAR_3++) {", "VAR_2 = VAR_0->oformat->codec_tag[VAR_3];", "while (VAR_2->VAR_4 != AV_CODEC_ID_NONE) {", "if (avpriv_toupper4(VAR_2->VAR_5) == avpriv_toupper4(VAR_1->codec->codec_tag)) {", "VAR_4 = VAR_2->VAR_4;", "if (VAR_4 == VAR_1->codec->codec_id)\nreturn 1;", "}", "if (VAR_2->VAR_4 == VAR_1->codec->codec_id)\nVAR_5 = VAR_2->VAR_5;", "VAR_2++;", "}", "}", "if (VAR_4 != AV_CODEC_ID_NONE)\nreturn 0;", "if (VAR_5 && (VAR_1->codec->strict_std_compliance >= FF_COMPLIANCE_NORMAL))\nreturn 0;", "return 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 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37, 39 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53, 55 ], [ 57, 59 ], [ 61 ], [ 63 ] ]
15,053
int coroutine_fn bdrv_co_preadv(BdrvChild *child, int64_t offset, unsigned int bytes, QEMUIOVector *qiov, BdrvRequestFlags flags) { BlockDriverState *bs = child->bs; BlockDriver *drv = bs->drv; BdrvTrackedRequest req; uint64_t align = bs->bl.request_alignment; uint8_t *head_buf = NULL; uint8_t *tail_buf = NULL; QEMUIOVector local_qiov; bool use_local_qiov = false; int ret; if (!drv) { return -ENOMEDIUM; } ret = bdrv_check_byte_request(bs, offset, bytes); if (ret < 0) { return ret; } bdrv_inc_in_flight(bs); /* Don't do copy-on-read if we read data before write operation */ if (bs->copy_on_read && !(flags & BDRV_REQ_NO_SERIALISING)) { flags |= BDRV_REQ_COPY_ON_READ; } /* Align read if necessary by padding qiov */ if (offset & (align - 1)) { head_buf = qemu_blockalign(bs, align); qemu_iovec_init(&local_qiov, qiov->niov + 2); qemu_iovec_add(&local_qiov, head_buf, offset & (align - 1)); qemu_iovec_concat(&local_qiov, qiov, 0, qiov->size); use_local_qiov = true; bytes += offset & (align - 1); offset = offset & ~(align - 1); } if ((offset + bytes) & (align - 1)) { if (!use_local_qiov) { qemu_iovec_init(&local_qiov, qiov->niov + 1); qemu_iovec_concat(&local_qiov, qiov, 0, qiov->size); use_local_qiov = true; } tail_buf = qemu_blockalign(bs, align); qemu_iovec_add(&local_qiov, tail_buf, align - ((offset + bytes) & (align - 1))); bytes = ROUND_UP(bytes, align); } tracked_request_begin(&req, bs, offset, bytes, BDRV_TRACKED_READ); ret = bdrv_aligned_preadv(bs, &req, offset, bytes, align, use_local_qiov ? &local_qiov : qiov, flags); tracked_request_end(&req); bdrv_dec_in_flight(bs); if (use_local_qiov) { qemu_iovec_destroy(&local_qiov); qemu_vfree(head_buf); qemu_vfree(tail_buf); } return ret; }
false
qemu
85c97ca7a10b93216bc95052e9dabe3a4bb8736a
int coroutine_fn bdrv_co_preadv(BdrvChild *child, int64_t offset, unsigned int bytes, QEMUIOVector *qiov, BdrvRequestFlags flags) { BlockDriverState *bs = child->bs; BlockDriver *drv = bs->drv; BdrvTrackedRequest req; uint64_t align = bs->bl.request_alignment; uint8_t *head_buf = NULL; uint8_t *tail_buf = NULL; QEMUIOVector local_qiov; bool use_local_qiov = false; int ret; if (!drv) { return -ENOMEDIUM; } ret = bdrv_check_byte_request(bs, offset, bytes); if (ret < 0) { return ret; } bdrv_inc_in_flight(bs); if (bs->copy_on_read && !(flags & BDRV_REQ_NO_SERIALISING)) { flags |= BDRV_REQ_COPY_ON_READ; } if (offset & (align - 1)) { head_buf = qemu_blockalign(bs, align); qemu_iovec_init(&local_qiov, qiov->niov + 2); qemu_iovec_add(&local_qiov, head_buf, offset & (align - 1)); qemu_iovec_concat(&local_qiov, qiov, 0, qiov->size); use_local_qiov = true; bytes += offset & (align - 1); offset = offset & ~(align - 1); } if ((offset + bytes) & (align - 1)) { if (!use_local_qiov) { qemu_iovec_init(&local_qiov, qiov->niov + 1); qemu_iovec_concat(&local_qiov, qiov, 0, qiov->size); use_local_qiov = true; } tail_buf = qemu_blockalign(bs, align); qemu_iovec_add(&local_qiov, tail_buf, align - ((offset + bytes) & (align - 1))); bytes = ROUND_UP(bytes, align); } tracked_request_begin(&req, bs, offset, bytes, BDRV_TRACKED_READ); ret = bdrv_aligned_preadv(bs, &req, offset, bytes, align, use_local_qiov ? &local_qiov : qiov, flags); tracked_request_end(&req); bdrv_dec_in_flight(bs); if (use_local_qiov) { qemu_iovec_destroy(&local_qiov); qemu_vfree(head_buf); qemu_vfree(tail_buf); } return ret; }
{ "code": [], "line_no": [] }
int VAR_0 bdrv_co_preadv(BdrvChild *child, int64_t offset, unsigned int bytes, QEMUIOVector *qiov, BdrvRequestFlags flags) { BlockDriverState *bs = child->bs; BlockDriver *drv = bs->drv; BdrvTrackedRequest req; uint64_t align = bs->bl.request_alignment; uint8_t *head_buf = NULL; uint8_t *tail_buf = NULL; QEMUIOVector local_qiov; bool use_local_qiov = false; int ret; if (!drv) { return -ENOMEDIUM; } ret = bdrv_check_byte_request(bs, offset, bytes); if (ret < 0) { return ret; } bdrv_inc_in_flight(bs); if (bs->copy_on_read && !(flags & BDRV_REQ_NO_SERIALISING)) { flags |= BDRV_REQ_COPY_ON_READ; } if (offset & (align - 1)) { head_buf = qemu_blockalign(bs, align); qemu_iovec_init(&local_qiov, qiov->niov + 2); qemu_iovec_add(&local_qiov, head_buf, offset & (align - 1)); qemu_iovec_concat(&local_qiov, qiov, 0, qiov->size); use_local_qiov = true; bytes += offset & (align - 1); offset = offset & ~(align - 1); } if ((offset + bytes) & (align - 1)) { if (!use_local_qiov) { qemu_iovec_init(&local_qiov, qiov->niov + 1); qemu_iovec_concat(&local_qiov, qiov, 0, qiov->size); use_local_qiov = true; } tail_buf = qemu_blockalign(bs, align); qemu_iovec_add(&local_qiov, tail_buf, align - ((offset + bytes) & (align - 1))); bytes = ROUND_UP(bytes, align); } tracked_request_begin(&req, bs, offset, bytes, BDRV_TRACKED_READ); ret = bdrv_aligned_preadv(bs, &req, offset, bytes, align, use_local_qiov ? &local_qiov : qiov, flags); tracked_request_end(&req); bdrv_dec_in_flight(bs); if (use_local_qiov) { qemu_iovec_destroy(&local_qiov); qemu_vfree(head_buf); qemu_vfree(tail_buf); } return ret; }
[ "int VAR_0 bdrv_co_preadv(BdrvChild *child,\nint64_t offset, unsigned int bytes, QEMUIOVector *qiov,\nBdrvRequestFlags flags)\n{", "BlockDriverState *bs = child->bs;", "BlockDriver *drv = bs->drv;", "BdrvTrackedRequest req;", "uint64_t align = bs->bl.request_alignment;", "uint8_t *head_buf = NULL;", "uint8_t *tail_buf = NULL;", "QEMUIOVector local_qiov;", "bool use_local_qiov = false;", "int ret;", "if (!drv) {", "return -ENOMEDIUM;", "}", "ret = bdrv_check_byte_request(bs, offset, bytes);", "if (ret < 0) {", "return ret;", "}", "bdrv_inc_in_flight(bs);", "if (bs->copy_on_read && !(flags & BDRV_REQ_NO_SERIALISING)) {", "flags |= BDRV_REQ_COPY_ON_READ;", "}", "if (offset & (align - 1)) {", "head_buf = qemu_blockalign(bs, align);", "qemu_iovec_init(&local_qiov, qiov->niov + 2);", "qemu_iovec_add(&local_qiov, head_buf, offset & (align - 1));", "qemu_iovec_concat(&local_qiov, qiov, 0, qiov->size);", "use_local_qiov = true;", "bytes += offset & (align - 1);", "offset = offset & ~(align - 1);", "}", "if ((offset + bytes) & (align - 1)) {", "if (!use_local_qiov) {", "qemu_iovec_init(&local_qiov, qiov->niov + 1);", "qemu_iovec_concat(&local_qiov, qiov, 0, qiov->size);", "use_local_qiov = true;", "}", "tail_buf = qemu_blockalign(bs, align);", "qemu_iovec_add(&local_qiov, tail_buf,\nalign - ((offset + bytes) & (align - 1)));", "bytes = ROUND_UP(bytes, align);", "}", "tracked_request_begin(&req, bs, offset, bytes, BDRV_TRACKED_READ);", "ret = bdrv_aligned_preadv(bs, &req, offset, bytes, align,\nuse_local_qiov ? &local_qiov : qiov,\nflags);", "tracked_request_end(&req);", "bdrv_dec_in_flight(bs);", "if (use_local_qiov) {", "qemu_iovec_destroy(&local_qiov);", "qemu_vfree(head_buf);", "qemu_vfree(tail_buf);", "}", "return ret;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 55 ], [ 57 ], [ 59 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ], [ 83 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101, 103 ], [ 107 ], [ 109 ], [ 113 ], [ 115, 117, 119 ], [ 121 ], [ 123 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 139 ], [ 141 ] ]
15,054
static coroutine_fn int qcow2_co_flush_to_os(BlockDriverState *bs) { BDRVQcow2State *s = bs->opaque; int ret; qemu_co_mutex_lock(&s->lock); ret = qcow2_cache_flush(bs, s->l2_table_cache); if (ret < 0) { qemu_co_mutex_unlock(&s->lock); return ret; } if (qcow2_need_accurate_refcounts(s)) { ret = qcow2_cache_flush(bs, s->refcount_block_cache); if (ret < 0) { qemu_co_mutex_unlock(&s->lock); return ret; } } qemu_co_mutex_unlock(&s->lock); return 0; }
false
qemu
f3c3b87dae44ac6c82246ceb3953793951800a9a
static coroutine_fn int qcow2_co_flush_to_os(BlockDriverState *bs) { BDRVQcow2State *s = bs->opaque; int ret; qemu_co_mutex_lock(&s->lock); ret = qcow2_cache_flush(bs, s->l2_table_cache); if (ret < 0) { qemu_co_mutex_unlock(&s->lock); return ret; } if (qcow2_need_accurate_refcounts(s)) { ret = qcow2_cache_flush(bs, s->refcount_block_cache); if (ret < 0) { qemu_co_mutex_unlock(&s->lock); return ret; } } qemu_co_mutex_unlock(&s->lock); return 0; }
{ "code": [], "line_no": [] }
static coroutine_fn int FUNC_0(BlockDriverState *bs) { BDRVQcow2State *s = bs->opaque; int VAR_0; qemu_co_mutex_lock(&s->lock); VAR_0 = qcow2_cache_flush(bs, s->l2_table_cache); if (VAR_0 < 0) { qemu_co_mutex_unlock(&s->lock); return VAR_0; } if (qcow2_need_accurate_refcounts(s)) { VAR_0 = qcow2_cache_flush(bs, s->refcount_block_cache); if (VAR_0 < 0) { qemu_co_mutex_unlock(&s->lock); return VAR_0; } } qemu_co_mutex_unlock(&s->lock); return 0; }
[ "static coroutine_fn int FUNC_0(BlockDriverState *bs)\n{", "BDRVQcow2State *s = bs->opaque;", "int VAR_0;", "qemu_co_mutex_lock(&s->lock);", "VAR_0 = qcow2_cache_flush(bs, s->l2_table_cache);", "if (VAR_0 < 0) {", "qemu_co_mutex_unlock(&s->lock);", "return VAR_0;", "}", "if (qcow2_need_accurate_refcounts(s)) {", "VAR_0 = qcow2_cache_flush(bs, s->refcount_block_cache);", "if (VAR_0 < 0) {", "qemu_co_mutex_unlock(&s->lock);", "return VAR_0;", "}", "}", "qemu_co_mutex_unlock(&s->lock);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ] ]
15,056
static void test_submit_many(void) { WorkerTestData data[100]; int i; /* Start more work items than there will be threads. */ for (i = 0; i < 100; i++) { data[i].n = 0; data[i].ret = -EINPROGRESS; thread_pool_submit_aio(worker_cb, &data[i], done_cb, &data[i]); } active = 100; while (active > 0) { qemu_aio_wait(); } for (i = 0; i < 100; i++) { g_assert_cmpint(data[i].n, ==, 1); g_assert_cmpint(data[i].ret, ==, 0); } }
false
qemu
c4d9d19645a484298a67e9021060bc7c2b081d0f
static void test_submit_many(void) { WorkerTestData data[100]; int i; for (i = 0; i < 100; i++) { data[i].n = 0; data[i].ret = -EINPROGRESS; thread_pool_submit_aio(worker_cb, &data[i], done_cb, &data[i]); } active = 100; while (active > 0) { qemu_aio_wait(); } for (i = 0; i < 100; i++) { g_assert_cmpint(data[i].n, ==, 1); g_assert_cmpint(data[i].ret, ==, 0); } }
{ "code": [], "line_no": [] }
static void FUNC_0(void) { WorkerTestData data[100]; int VAR_0; for (VAR_0 = 0; VAR_0 < 100; VAR_0++) { data[VAR_0].n = 0; data[VAR_0].ret = -EINPROGRESS; thread_pool_submit_aio(worker_cb, &data[VAR_0], done_cb, &data[VAR_0]); } active = 100; while (active > 0) { qemu_aio_wait(); } for (VAR_0 = 0; VAR_0 < 100; VAR_0++) { g_assert_cmpint(data[VAR_0].n, ==, 1); g_assert_cmpint(data[VAR_0].ret, ==, 0); } }
[ "static void FUNC_0(void)\n{", "WorkerTestData data[100];", "int VAR_0;", "for (VAR_0 = 0; VAR_0 < 100; VAR_0++) {", "data[VAR_0].n = 0;", "data[VAR_0].ret = -EINPROGRESS;", "thread_pool_submit_aio(worker_cb, &data[VAR_0], done_cb, &data[VAR_0]);", "}", "active = 100;", "while (active > 0) {", "qemu_aio_wait();", "}", "for (VAR_0 = 0; VAR_0 < 100; VAR_0++) {", "g_assert_cmpint(data[VAR_0].n, ==, 1);", "g_assert_cmpint(data[VAR_0].ret, ==, 0);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ] ]
15,057
static inline void gen_op_jnz_ecx(TCGMemOp size, int label1) { tcg_gen_mov_tl(cpu_tmp0, cpu_regs[R_ECX]); gen_extu(size, cpu_tmp0); tcg_gen_brcondi_tl(TCG_COND_NE, cpu_tmp0, 0, label1); }
false
qemu
42a268c241183877192c376d03bd9b6d527407c7
static inline void gen_op_jnz_ecx(TCGMemOp size, int label1) { tcg_gen_mov_tl(cpu_tmp0, cpu_regs[R_ECX]); gen_extu(size, cpu_tmp0); tcg_gen_brcondi_tl(TCG_COND_NE, cpu_tmp0, 0, label1); }
{ "code": [], "line_no": [] }
static inline void FUNC_0(TCGMemOp VAR_0, int VAR_1) { tcg_gen_mov_tl(cpu_tmp0, cpu_regs[R_ECX]); gen_extu(VAR_0, cpu_tmp0); tcg_gen_brcondi_tl(TCG_COND_NE, cpu_tmp0, 0, VAR_1); }
[ "static inline void FUNC_0(TCGMemOp VAR_0, int VAR_1)\n{", "tcg_gen_mov_tl(cpu_tmp0, cpu_regs[R_ECX]);", "gen_extu(VAR_0, cpu_tmp0);", "tcg_gen_brcondi_tl(TCG_COND_NE, cpu_tmp0, 0, VAR_1);", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ] ]
15,058
static int local_opendir(FsContext *ctx, V9fsPath *fs_path, V9fsFidOpenState *fs) { char buffer[PATH_MAX]; char *path = fs_path->data; fs->dir = opendir(rpath(ctx, path, buffer)); if (!fs->dir) { return -1; } return 0; }
false
qemu
4fa4ce7107c6ec432f185307158c5df91ce54308
static int local_opendir(FsContext *ctx, V9fsPath *fs_path, V9fsFidOpenState *fs) { char buffer[PATH_MAX]; char *path = fs_path->data; fs->dir = opendir(rpath(ctx, path, buffer)); if (!fs->dir) { return -1; } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(FsContext *VAR_0, V9fsPath *VAR_1, V9fsFidOpenState *VAR_2) { char VAR_3[PATH_MAX]; char *VAR_4 = VAR_1->data; VAR_2->dir = opendir(rpath(VAR_0, VAR_4, VAR_3)); if (!VAR_2->dir) { return -1; } return 0; }
[ "static int FUNC_0(FsContext *VAR_0,\nV9fsPath *VAR_1, V9fsFidOpenState *VAR_2)\n{", "char VAR_3[PATH_MAX];", "char *VAR_4 = VAR_1->data;", "VAR_2->dir = opendir(rpath(VAR_0, VAR_4, VAR_3));", "if (!VAR_2->dir) {", "return -1;", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ] ]
15,060
void cpu_outw(CPUState *env, pio_addr_t addr, uint16_t val) { LOG_IOPORT("outw: %04"FMT_pioaddr" %04"PRIx16"\n", addr, val); ioport_write(1, addr, val); #ifdef CONFIG_KQEMU if (env) env->last_io_time = cpu_get_time_fast(); #endif }
false
qemu
4a1418e07bdcfaa3177739e04707ecaec75d89e1
void cpu_outw(CPUState *env, pio_addr_t addr, uint16_t val) { LOG_IOPORT("outw: %04"FMT_pioaddr" %04"PRIx16"\n", addr, val); ioport_write(1, addr, val); #ifdef CONFIG_KQEMU if (env) env->last_io_time = cpu_get_time_fast(); #endif }
{ "code": [], "line_no": [] }
void FUNC_0(CPUState *VAR_0, pio_addr_t VAR_1, uint16_t VAR_2) { LOG_IOPORT("outw: %04"FMT_pioaddr" %04"PRIx16"\n", VAR_1, VAR_2); ioport_write(1, VAR_1, VAR_2); #ifdef CONFIG_KQEMU if (VAR_0) VAR_0->last_io_time = cpu_get_time_fast(); #endif }
[ "void FUNC_0(CPUState *VAR_0, pio_addr_t VAR_1, uint16_t VAR_2)\n{", "LOG_IOPORT(\"outw: %04\"FMT_pioaddr\" %04\"PRIx16\"\\n\", VAR_1, VAR_2);", "ioport_write(1, VAR_1, VAR_2);", "#ifdef CONFIG_KQEMU\nif (VAR_0)\nVAR_0->last_io_time = cpu_get_time_fast();", "#endif\n}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9, 11, 13 ], [ 15, 17 ] ]
15,062
static void virtio_blk_device_realize(DeviceState *dev, Error **errp) { VirtIODevice *vdev = VIRTIO_DEVICE(dev); VirtIOBlock *s = VIRTIO_BLK(dev); VirtIOBlkConf *conf = &s->conf; Error *err = NULL; static int virtio_blk_id; if (!conf->conf.bs) { error_setg(errp, "drive property not set"); return; } if (!bdrv_is_inserted(conf->conf.bs)) { error_setg(errp, "Device needs media, but drive is empty"); return; } blkconf_serial(&conf->conf, &conf->serial); s->original_wce = bdrv_enable_write_cache(conf->conf.bs); blkconf_geometry(&conf->conf, NULL, 65535, 255, 255, &err); if (err) { error_propagate(errp, err); return; } virtio_init(vdev, "virtio-blk", VIRTIO_ID_BLOCK, sizeof(struct virtio_blk_config)); s->bs = conf->conf.bs; s->rq = NULL; s->sector_mask = (s->conf.conf.logical_block_size / BDRV_SECTOR_SIZE) - 1; s->vq = virtio_add_queue(vdev, 128, virtio_blk_handle_output); s->complete_request = virtio_blk_complete_request; virtio_blk_data_plane_create(vdev, conf, &s->dataplane, &err); if (err != NULL) { error_propagate(errp, err); virtio_cleanup(vdev); return; } s->migration_state_notifier.notify = virtio_blk_migration_state_changed; add_migration_state_change_notifier(&s->migration_state_notifier); s->change = qemu_add_vm_change_state_handler(virtio_blk_dma_restart_cb, s); register_savevm(dev, "virtio-blk", virtio_blk_id++, 2, virtio_blk_save, virtio_blk_load, s); bdrv_set_dev_ops(s->bs, &virtio_block_ops, s); bdrv_set_guest_block_size(s->bs, s->conf.conf.logical_block_size); bdrv_iostatus_enable(s->bs); }
false
qemu
4be746345f13e99e468c60acbd3a355e8183e3ce
static void virtio_blk_device_realize(DeviceState *dev, Error **errp) { VirtIODevice *vdev = VIRTIO_DEVICE(dev); VirtIOBlock *s = VIRTIO_BLK(dev); VirtIOBlkConf *conf = &s->conf; Error *err = NULL; static int virtio_blk_id; if (!conf->conf.bs) { error_setg(errp, "drive property not set"); return; } if (!bdrv_is_inserted(conf->conf.bs)) { error_setg(errp, "Device needs media, but drive is empty"); return; } blkconf_serial(&conf->conf, &conf->serial); s->original_wce = bdrv_enable_write_cache(conf->conf.bs); blkconf_geometry(&conf->conf, NULL, 65535, 255, 255, &err); if (err) { error_propagate(errp, err); return; } virtio_init(vdev, "virtio-blk", VIRTIO_ID_BLOCK, sizeof(struct virtio_blk_config)); s->bs = conf->conf.bs; s->rq = NULL; s->sector_mask = (s->conf.conf.logical_block_size / BDRV_SECTOR_SIZE) - 1; s->vq = virtio_add_queue(vdev, 128, virtio_blk_handle_output); s->complete_request = virtio_blk_complete_request; virtio_blk_data_plane_create(vdev, conf, &s->dataplane, &err); if (err != NULL) { error_propagate(errp, err); virtio_cleanup(vdev); return; } s->migration_state_notifier.notify = virtio_blk_migration_state_changed; add_migration_state_change_notifier(&s->migration_state_notifier); s->change = qemu_add_vm_change_state_handler(virtio_blk_dma_restart_cb, s); register_savevm(dev, "virtio-blk", virtio_blk_id++, 2, virtio_blk_save, virtio_blk_load, s); bdrv_set_dev_ops(s->bs, &virtio_block_ops, s); bdrv_set_guest_block_size(s->bs, s->conf.conf.logical_block_size); bdrv_iostatus_enable(s->bs); }
{ "code": [], "line_no": [] }
static void FUNC_0(DeviceState *VAR_0, Error **VAR_1) { VirtIODevice *vdev = VIRTIO_DEVICE(VAR_0); VirtIOBlock *s = VIRTIO_BLK(VAR_0); VirtIOBlkConf *conf = &s->conf; Error *err = NULL; static int VAR_2; if (!conf->conf.bs) { error_setg(VAR_1, "drive property not set"); return; } if (!bdrv_is_inserted(conf->conf.bs)) { error_setg(VAR_1, "Device needs media, but drive is empty"); return; } blkconf_serial(&conf->conf, &conf->serial); s->original_wce = bdrv_enable_write_cache(conf->conf.bs); blkconf_geometry(&conf->conf, NULL, 65535, 255, 255, &err); if (err) { error_propagate(VAR_1, err); return; } virtio_init(vdev, "virtio-blk", VIRTIO_ID_BLOCK, sizeof(struct virtio_blk_config)); s->bs = conf->conf.bs; s->rq = NULL; s->sector_mask = (s->conf.conf.logical_block_size / BDRV_SECTOR_SIZE) - 1; s->vq = virtio_add_queue(vdev, 128, virtio_blk_handle_output); s->complete_request = virtio_blk_complete_request; virtio_blk_data_plane_create(vdev, conf, &s->dataplane, &err); if (err != NULL) { error_propagate(VAR_1, err); virtio_cleanup(vdev); return; } s->migration_state_notifier.notify = virtio_blk_migration_state_changed; add_migration_state_change_notifier(&s->migration_state_notifier); s->change = qemu_add_vm_change_state_handler(virtio_blk_dma_restart_cb, s); register_savevm(VAR_0, "virtio-blk", VAR_2++, 2, virtio_blk_save, virtio_blk_load, s); bdrv_set_dev_ops(s->bs, &virtio_block_ops, s); bdrv_set_guest_block_size(s->bs, s->conf.conf.logical_block_size); bdrv_iostatus_enable(s->bs); }
[ "static void FUNC_0(DeviceState *VAR_0, Error **VAR_1)\n{", "VirtIODevice *vdev = VIRTIO_DEVICE(VAR_0);", "VirtIOBlock *s = VIRTIO_BLK(VAR_0);", "VirtIOBlkConf *conf = &s->conf;", "Error *err = NULL;", "static int VAR_2;", "if (!conf->conf.bs) {", "error_setg(VAR_1, \"drive property not set\");", "return;", "}", "if (!bdrv_is_inserted(conf->conf.bs)) {", "error_setg(VAR_1, \"Device needs media, but drive is empty\");", "return;", "}", "blkconf_serial(&conf->conf, &conf->serial);", "s->original_wce = bdrv_enable_write_cache(conf->conf.bs);", "blkconf_geometry(&conf->conf, NULL, 65535, 255, 255, &err);", "if (err) {", "error_propagate(VAR_1, err);", "return;", "}", "virtio_init(vdev, \"virtio-blk\", VIRTIO_ID_BLOCK,\nsizeof(struct virtio_blk_config));", "s->bs = conf->conf.bs;", "s->rq = NULL;", "s->sector_mask = (s->conf.conf.logical_block_size / BDRV_SECTOR_SIZE) - 1;", "s->vq = virtio_add_queue(vdev, 128, virtio_blk_handle_output);", "s->complete_request = virtio_blk_complete_request;", "virtio_blk_data_plane_create(vdev, conf, &s->dataplane, &err);", "if (err != NULL) {", "error_propagate(VAR_1, err);", "virtio_cleanup(vdev);", "return;", "}", "s->migration_state_notifier.notify = virtio_blk_migration_state_changed;", "add_migration_state_change_notifier(&s->migration_state_notifier);", "s->change = qemu_add_vm_change_state_handler(virtio_blk_dma_restart_cb, s);", "register_savevm(VAR_0, \"virtio-blk\", VAR_2++, 2,\nvirtio_blk_save, virtio_blk_load, s);", "bdrv_set_dev_ops(s->bs, &virtio_block_ops, s);", "bdrv_set_guest_block_size(s->bs, s->conf.conf.logical_block_size);", "bdrv_iostatus_enable(s->bs);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51, 53 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 87 ], [ 89, 91 ], [ 93 ], [ 95 ], [ 99 ], [ 101 ] ]
15,063
yuv2gray16_2_c_template(SwsContext *c, const uint16_t *buf0, const uint16_t *buf1, const uint16_t *ubuf0, const uint16_t *ubuf1, const uint16_t *vbuf0, const uint16_t *vbuf1, const uint16_t *abuf0, const uint16_t *abuf1, uint8_t *dest, int dstW, int yalpha, int uvalpha, int y, enum PixelFormat target) { int yalpha1 = 4095 - yalpha; \ int i; for (i = 0; i < (dstW >> 1); i++) { const int i2 = 2 * i; int Y1 = (buf0[i2 ] * yalpha1 + buf1[i2 ] * yalpha) >> 11; int Y2 = (buf0[i2+1] * yalpha1 + buf1[i2+1] * yalpha) >> 11; output_pixel(&dest[2 * i2 + 0], Y1); output_pixel(&dest[2 * i2 + 2], Y2); } }
false
FFmpeg
13a099799e89a76eb921ca452e1b04a7a28a9855
yuv2gray16_2_c_template(SwsContext *c, const uint16_t *buf0, const uint16_t *buf1, const uint16_t *ubuf0, const uint16_t *ubuf1, const uint16_t *vbuf0, const uint16_t *vbuf1, const uint16_t *abuf0, const uint16_t *abuf1, uint8_t *dest, int dstW, int yalpha, int uvalpha, int y, enum PixelFormat target) { int yalpha1 = 4095 - yalpha; \ int i; for (i = 0; i < (dstW >> 1); i++) { const int i2 = 2 * i; int Y1 = (buf0[i2 ] * yalpha1 + buf1[i2 ] * yalpha) >> 11; int Y2 = (buf0[i2+1] * yalpha1 + buf1[i2+1] * yalpha) >> 11; output_pixel(&dest[2 * i2 + 0], Y1); output_pixel(&dest[2 * i2 + 2], Y2); } }
{ "code": [], "line_no": [] }
FUNC_0(SwsContext *VAR_0, const uint16_t *VAR_1, const uint16_t *VAR_2, const uint16_t *VAR_3, const uint16_t *VAR_4, const uint16_t *VAR_5, const uint16_t *VAR_6, const uint16_t *VAR_7, const uint16_t *VAR_8, uint8_t *VAR_9, int VAR_10, int VAR_11, int VAR_12, int VAR_13, enum PixelFormat VAR_14) { int VAR_15 = 4095 - VAR_11; \ int VAR_16; for (VAR_16 = 0; VAR_16 < (VAR_10 >> 1); VAR_16++) { const int VAR_17 = 2 * VAR_16; int VAR_18 = (VAR_1[VAR_17 ] * VAR_15 + VAR_2[VAR_17 ] * VAR_11) >> 11; int VAR_19 = (VAR_1[VAR_17+1] * VAR_15 + VAR_2[VAR_17+1] * VAR_11) >> 11; output_pixel(&VAR_9[2 * VAR_17 + 0], VAR_18); output_pixel(&VAR_9[2 * VAR_17 + 2], VAR_19); } }
[ "FUNC_0(SwsContext *VAR_0, const uint16_t *VAR_1,\nconst uint16_t *VAR_2, const uint16_t *VAR_3,\nconst uint16_t *VAR_4, const uint16_t *VAR_5,\nconst uint16_t *VAR_6, const uint16_t *VAR_7,\nconst uint16_t *VAR_8, uint8_t *VAR_9, int VAR_10,\nint VAR_11, int VAR_12, int VAR_13,\nenum PixelFormat VAR_14)\n{", "int VAR_15 = 4095 - VAR_11; \\", "int VAR_16;", "for (VAR_16 = 0; VAR_16 < (VAR_10 >> 1); VAR_16++) {", "const int VAR_17 = 2 * VAR_16;", "int VAR_18 = (VAR_1[VAR_17 ] * VAR_15 + VAR_2[VAR_17 ] * VAR_11) >> 11;", "int VAR_19 = (VAR_1[VAR_17+1] * VAR_15 + VAR_2[VAR_17+1] * VAR_11) >> 11;", "output_pixel(&VAR_9[2 * VAR_17 + 0], VAR_18);", "output_pixel(&VAR_9[2 * VAR_17 + 2], VAR_19);", "}", "}" ]
[ 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 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ] ]
15,064
dma_winvalid (void *opaque, target_phys_addr_t addr, uint32_t value) { hw_error("Unsupported short waccess. reg=" TARGET_FMT_plx "\n", addr); }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
dma_winvalid (void *opaque, target_phys_addr_t addr, uint32_t value) { hw_error("Unsupported short waccess. reg=" TARGET_FMT_plx "\n", addr); }
{ "code": [], "line_no": [] }
FUNC_0 (void *VAR_0, target_phys_addr_t VAR_1, uint32_t VAR_2) { hw_error("Unsupported short waccess. reg=" TARGET_FMT_plx "\n", VAR_1); }
[ "FUNC_0 (void *VAR_0, target_phys_addr_t VAR_1, uint32_t VAR_2)\n{", "hw_error(\"Unsupported short waccess. reg=\" TARGET_FMT_plx \"\\n\", VAR_1);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
15,065
set_interrupt_cause(E1000State *s, int index, uint32_t val) { if (val) val |= E1000_ICR_INT_ASSERTED; s->mac_reg[ICR] = val; s->mac_reg[ICS] = val; qemu_set_irq(s->dev.irq[0], (s->mac_reg[IMS] & s->mac_reg[ICR]) != 0); }
false
qemu
f1219091edd20e3b92544025c2b6dd5e4d98b61b
set_interrupt_cause(E1000State *s, int index, uint32_t val) { if (val) val |= E1000_ICR_INT_ASSERTED; s->mac_reg[ICR] = val; s->mac_reg[ICS] = val; qemu_set_irq(s->dev.irq[0], (s->mac_reg[IMS] & s->mac_reg[ICR]) != 0); }
{ "code": [], "line_no": [] }
FUNC_0(E1000State *VAR_0, int VAR_1, uint32_t VAR_2) { if (VAR_2) VAR_2 |= E1000_ICR_INT_ASSERTED; VAR_0->mac_reg[ICR] = VAR_2; VAR_0->mac_reg[ICS] = VAR_2; qemu_set_irq(VAR_0->dev.irq[0], (VAR_0->mac_reg[IMS] & VAR_0->mac_reg[ICR]) != 0); }
[ "FUNC_0(E1000State *VAR_0, int VAR_1, uint32_t VAR_2)\n{", "if (VAR_2)\nVAR_2 |= E1000_ICR_INT_ASSERTED;", "VAR_0->mac_reg[ICR] = VAR_2;", "VAR_0->mac_reg[ICS] = VAR_2;", "qemu_set_irq(VAR_0->dev.irq[0], (VAR_0->mac_reg[IMS] & VAR_0->mac_reg[ICR]) != 0);", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ] ]