id
int32
0
27.3k
func
stringlengths
26
142k
target
bool
2 classes
project
stringclasses
2 values
commit_id
stringlengths
40
40
func_clean
stringlengths
26
131k
vul_lines
dict
normalized_func
stringlengths
24
132k
lines
sequencelengths
1
2.8k
label
sequencelengths
1
2.8k
line_no
sequencelengths
1
2.8k
2,314
static void handle_arg_log_filename(const char *arg) { qemu_set_log_filename(arg); }
true
qemu
daa76aa416b1e18ab1fac650ff53d966d8f21f68
static void handle_arg_log_filename(const char *arg) { qemu_set_log_filename(arg); }
{ "code": [ " qemu_set_log_filename(arg);" ], "line_no": [ 5 ] }
static void FUNC_0(const char *VAR_0) { qemu_set_log_filename(VAR_0); }
[ "static void FUNC_0(const char *VAR_0)\n{", "qemu_set_log_filename(VAR_0);", "}" ]
[ 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
2,315
static int32_t scsi_target_send_command(SCSIRequest *req, uint8_t *buf) { SCSITargetReq *r = DO_UPCAST(SCSITargetReq, req, req); switch (buf[0]) { case REPORT_LUNS: if (!scsi_target_emulate_report_luns(r)) { goto illegal_request; } break; case INQUIRY: if (!scsi_target_emulate_inquiry(r)) { goto illegal_request; } break; case REQUEST_SENSE: r->len = scsi_device_get_sense(r->req.dev, r->buf, MIN(req->cmd.xfer, sizeof r->buf), (req->cmd.buf[1] & 1) == 0); if (r->req.dev->sense_is_ua) { scsi_device_unit_attention_reported(req->dev); r->req.dev->sense_len = 0; r->req.dev->sense_is_ua = false; } break; default: scsi_req_build_sense(req, SENSE_CODE(LUN_NOT_SUPPORTED)); scsi_req_complete(req, CHECK_CONDITION); return 0; illegal_request: scsi_req_build_sense(req, SENSE_CODE(INVALID_FIELD)); scsi_req_complete(req, CHECK_CONDITION); return 0; } if (!r->len) { scsi_req_complete(req, GOOD); } return r->len; }
true
qemu
846424350b292f16b732b573273a5c1f195cd7a3
static int32_t scsi_target_send_command(SCSIRequest *req, uint8_t *buf) { SCSITargetReq *r = DO_UPCAST(SCSITargetReq, req, req); switch (buf[0]) { case REPORT_LUNS: if (!scsi_target_emulate_report_luns(r)) { goto illegal_request; } break; case INQUIRY: if (!scsi_target_emulate_inquiry(r)) { goto illegal_request; } break; case REQUEST_SENSE: r->len = scsi_device_get_sense(r->req.dev, r->buf, MIN(req->cmd.xfer, sizeof r->buf), (req->cmd.buf[1] & 1) == 0); if (r->req.dev->sense_is_ua) { scsi_device_unit_attention_reported(req->dev); r->req.dev->sense_len = 0; r->req.dev->sense_is_ua = false; } break; default: scsi_req_build_sense(req, SENSE_CODE(LUN_NOT_SUPPORTED)); scsi_req_complete(req, CHECK_CONDITION); return 0; illegal_request: scsi_req_build_sense(req, SENSE_CODE(INVALID_FIELD)); scsi_req_complete(req, CHECK_CONDITION); return 0; } if (!r->len) { scsi_req_complete(req, GOOD); } return r->len; }
{ "code": [ " MIN(req->cmd.xfer, sizeof r->buf)," ], "line_no": [ 35 ] }
static int32_t FUNC_0(SCSIRequest *req, uint8_t *buf) { SCSITargetReq *r = DO_UPCAST(SCSITargetReq, req, req); switch (buf[0]) { case REPORT_LUNS: if (!scsi_target_emulate_report_luns(r)) { goto illegal_request; } break; case INQUIRY: if (!scsi_target_emulate_inquiry(r)) { goto illegal_request; } break; case REQUEST_SENSE: r->len = scsi_device_get_sense(r->req.dev, r->buf, MIN(req->cmd.xfer, sizeof r->buf), (req->cmd.buf[1] & 1) == 0); if (r->req.dev->sense_is_ua) { scsi_device_unit_attention_reported(req->dev); r->req.dev->sense_len = 0; r->req.dev->sense_is_ua = false; } break; default: scsi_req_build_sense(req, SENSE_CODE(LUN_NOT_SUPPORTED)); scsi_req_complete(req, CHECK_CONDITION); return 0; illegal_request: scsi_req_build_sense(req, SENSE_CODE(INVALID_FIELD)); scsi_req_complete(req, CHECK_CONDITION); return 0; } if (!r->len) { scsi_req_complete(req, GOOD); } return r->len; }
[ "static int32_t FUNC_0(SCSIRequest *req, uint8_t *buf)\n{", "SCSITargetReq *r = DO_UPCAST(SCSITargetReq, req, req);", "switch (buf[0]) {", "case REPORT_LUNS:\nif (!scsi_target_emulate_report_luns(r)) {", "goto illegal_request;", "}", "break;", "case INQUIRY:\nif (!scsi_target_emulate_inquiry(r)) {", "goto illegal_request;", "}", "break;", "case REQUEST_SENSE:\nr->len = scsi_device_get_sense(r->req.dev, r->buf,\nMIN(req->cmd.xfer, sizeof r->buf),\n(req->cmd.buf[1] & 1) == 0);", "if (r->req.dev->sense_is_ua) {", "scsi_device_unit_attention_reported(req->dev);", "r->req.dev->sense_len = 0;", "r->req.dev->sense_is_ua = false;", "}", "break;", "default:\nscsi_req_build_sense(req, SENSE_CODE(LUN_NOT_SUPPORTED));", "scsi_req_complete(req, CHECK_CONDITION);", "return 0;", "illegal_request:\nscsi_req_build_sense(req, SENSE_CODE(INVALID_FIELD));", "scsi_req_complete(req, CHECK_CONDITION);", "return 0;", "}", "if (!r->len) {", "scsi_req_complete(req, GOOD);", "}", "return r->len;", "}" ]
[ 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 ], [ 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 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ] ]
2,316
static int CUDAAPI cuvid_handle_video_sequence(void *opaque, CUVIDEOFORMAT* format) { AVCodecContext *avctx = opaque; CuvidContext *ctx = avctx->priv_data; AVHWFramesContext *hwframe_ctx = (AVHWFramesContext*)ctx->hwframe->data; CUVIDDECODECREATEINFO cuinfo; av_log(avctx, AV_LOG_TRACE, "pfnSequenceCallback\n"); ctx->internal_error = 0; avctx->width = format->display_area.right; avctx->height = format->display_area.bottom; ff_set_sar(avctx, av_div_q( (AVRational){ format->display_aspect_ratio.x, format->display_aspect_ratio.y }, (AVRational){ avctx->width, avctx->height })); if (!format->progressive_sequence) avctx->flags |= AV_CODEC_FLAG_INTERLACED_DCT; else avctx->flags &= ~AV_CODEC_FLAG_INTERLACED_DCT; if (format->video_signal_description.video_full_range_flag) avctx->color_range = AVCOL_RANGE_JPEG; else avctx->color_range = AVCOL_RANGE_MPEG; avctx->color_primaries = format->video_signal_description.color_primaries; avctx->color_trc = format->video_signal_description.transfer_characteristics; avctx->colorspace = format->video_signal_description.matrix_coefficients; if (format->bitrate) avctx->bit_rate = format->bitrate; if (format->frame_rate.numerator && format->frame_rate.denominator) { avctx->framerate.num = format->frame_rate.numerator; avctx->framerate.den = format->frame_rate.denominator; if (ctx->cudecoder && avctx->coded_width == format->coded_width && avctx->coded_height == format->coded_height && ctx->chroma_format == format->chroma_format && ctx->codec_type == format->codec) return 1; if (ctx->cudecoder) { av_log(avctx, AV_LOG_ERROR, "re-initializing decoder is not supported\n"); if (hwframe_ctx->pool && !ctx->ever_flushed) { av_log(avctx, AV_LOG_ERROR, "AVHWFramesContext is already initialized\n"); avctx->coded_width = format->coded_width; avctx->coded_height = format->coded_height; ctx->chroma_format = format->chroma_format; memset(&cuinfo, 0, sizeof(cuinfo)); cuinfo.CodecType = ctx->codec_type = format->codec; cuinfo.ChromaFormat = format->chroma_format; cuinfo.OutputFormat = cudaVideoSurfaceFormat_NV12; cuinfo.ulWidth = avctx->coded_width; cuinfo.ulHeight = avctx->coded_height; cuinfo.ulTargetWidth = cuinfo.ulWidth; cuinfo.ulTargetHeight = cuinfo.ulHeight; cuinfo.target_rect.left = 0; cuinfo.target_rect.top = 0; cuinfo.target_rect.right = cuinfo.ulWidth; cuinfo.target_rect.bottom = cuinfo.ulHeight; cuinfo.ulNumDecodeSurfaces = MAX_FRAME_COUNT; cuinfo.ulNumOutputSurfaces = 1; cuinfo.ulCreationFlags = cudaVideoCreate_PreferCUVID; cuinfo.DeinterlaceMode = cudaVideoDeinterlaceMode_Weave; ctx->internal_error = CHECK_CU(cuvidCreateDecoder(&ctx->cudecoder, &cuinfo)); if (ctx->internal_error < 0) if (!hwframe_ctx->pool) { hwframe_ctx->format = AV_PIX_FMT_CUDA; hwframe_ctx->sw_format = AV_PIX_FMT_NV12; hwframe_ctx->width = FFALIGN(avctx->coded_width, 32); hwframe_ctx->height = FFALIGN(avctx->coded_height, 32); if ((ctx->internal_error = av_hwframe_ctx_init(ctx->hwframe)) < 0) { av_log(avctx, AV_LOG_ERROR, "av_hwframe_ctx_init failed\n"); return 1;
true
FFmpeg
ee88dcb2b0fefb42b0761ddb105c71daf604d791
static int CUDAAPI cuvid_handle_video_sequence(void *opaque, CUVIDEOFORMAT* format) { AVCodecContext *avctx = opaque; CuvidContext *ctx = avctx->priv_data; AVHWFramesContext *hwframe_ctx = (AVHWFramesContext*)ctx->hwframe->data; CUVIDDECODECREATEINFO cuinfo; av_log(avctx, AV_LOG_TRACE, "pfnSequenceCallback\n"); ctx->internal_error = 0; avctx->width = format->display_area.right; avctx->height = format->display_area.bottom; ff_set_sar(avctx, av_div_q( (AVRational){ format->display_aspect_ratio.x, format->display_aspect_ratio.y }, (AVRational){ avctx->width, avctx->height })); if (!format->progressive_sequence) avctx->flags |= AV_CODEC_FLAG_INTERLACED_DCT; else avctx->flags &= ~AV_CODEC_FLAG_INTERLACED_DCT; if (format->video_signal_description.video_full_range_flag) avctx->color_range = AVCOL_RANGE_JPEG; else avctx->color_range = AVCOL_RANGE_MPEG; avctx->color_primaries = format->video_signal_description.color_primaries; avctx->color_trc = format->video_signal_description.transfer_characteristics; avctx->colorspace = format->video_signal_description.matrix_coefficients; if (format->bitrate) avctx->bit_rate = format->bitrate; if (format->frame_rate.numerator && format->frame_rate.denominator) { avctx->framerate.num = format->frame_rate.numerator; avctx->framerate.den = format->frame_rate.denominator; if (ctx->cudecoder && avctx->coded_width == format->coded_width && avctx->coded_height == format->coded_height && ctx->chroma_format == format->chroma_format && ctx->codec_type == format->codec) return 1; if (ctx->cudecoder) { av_log(avctx, AV_LOG_ERROR, "re-initializing decoder is not supported\n"); if (hwframe_ctx->pool && !ctx->ever_flushed) { av_log(avctx, AV_LOG_ERROR, "AVHWFramesContext is already initialized\n"); avctx->coded_width = format->coded_width; avctx->coded_height = format->coded_height; ctx->chroma_format = format->chroma_format; memset(&cuinfo, 0, sizeof(cuinfo)); cuinfo.CodecType = ctx->codec_type = format->codec; cuinfo.ChromaFormat = format->chroma_format; cuinfo.OutputFormat = cudaVideoSurfaceFormat_NV12; cuinfo.ulWidth = avctx->coded_width; cuinfo.ulHeight = avctx->coded_height; cuinfo.ulTargetWidth = cuinfo.ulWidth; cuinfo.ulTargetHeight = cuinfo.ulHeight; cuinfo.target_rect.left = 0; cuinfo.target_rect.top = 0; cuinfo.target_rect.right = cuinfo.ulWidth; cuinfo.target_rect.bottom = cuinfo.ulHeight; cuinfo.ulNumDecodeSurfaces = MAX_FRAME_COUNT; cuinfo.ulNumOutputSurfaces = 1; cuinfo.ulCreationFlags = cudaVideoCreate_PreferCUVID; cuinfo.DeinterlaceMode = cudaVideoDeinterlaceMode_Weave; ctx->internal_error = CHECK_CU(cuvidCreateDecoder(&ctx->cudecoder, &cuinfo)); if (ctx->internal_error < 0) if (!hwframe_ctx->pool) { hwframe_ctx->format = AV_PIX_FMT_CUDA; hwframe_ctx->sw_format = AV_PIX_FMT_NV12; hwframe_ctx->width = FFALIGN(avctx->coded_width, 32); hwframe_ctx->height = FFALIGN(avctx->coded_height, 32); if ((ctx->internal_error = av_hwframe_ctx_init(ctx->hwframe)) < 0) { av_log(avctx, AV_LOG_ERROR, "av_hwframe_ctx_init failed\n"); return 1;
{ "code": [], "line_no": [] }
static int VAR_0 cuvid_handle_video_sequence(void *opaque, CUVIDEOFORMAT* format) { AVCodecContext *avctx = opaque; CuvidContext *ctx = avctx->priv_data; AVHWFramesContext *hwframe_ctx = (AVHWFramesContext*)ctx->hwframe->data; CUVIDDECODECREATEINFO cuinfo; av_log(avctx, AV_LOG_TRACE, "pfnSequenceCallback\n"); ctx->internal_error = 0; avctx->width = format->display_area.right; avctx->height = format->display_area.bottom; ff_set_sar(avctx, av_div_q( (AVRational){ format->display_aspect_ratio.x, format->display_aspect_ratio.y }, (AVRational){ avctx->width, avctx->height })); if (!format->progressive_sequence) avctx->flags |= AV_CODEC_FLAG_INTERLACED_DCT; else avctx->flags &= ~AV_CODEC_FLAG_INTERLACED_DCT; if (format->video_signal_description.video_full_range_flag) avctx->color_range = AVCOL_RANGE_JPEG; else avctx->color_range = AVCOL_RANGE_MPEG; avctx->color_primaries = format->video_signal_description.color_primaries; avctx->color_trc = format->video_signal_description.transfer_characteristics; avctx->colorspace = format->video_signal_description.matrix_coefficients; if (format->bitrate) avctx->bit_rate = format->bitrate; if (format->frame_rate.numerator && format->frame_rate.denominator) { avctx->framerate.num = format->frame_rate.numerator; avctx->framerate.den = format->frame_rate.denominator; if (ctx->cudecoder && avctx->coded_width == format->coded_width && avctx->coded_height == format->coded_height && ctx->chroma_format == format->chroma_format && ctx->codec_type == format->codec) return 1; if (ctx->cudecoder) { av_log(avctx, AV_LOG_ERROR, "re-initializing decoder is not supported\n"); if (hwframe_ctx->pool && !ctx->ever_flushed) { av_log(avctx, AV_LOG_ERROR, "AVHWFramesContext is already initialized\n"); avctx->coded_width = format->coded_width; avctx->coded_height = format->coded_height; ctx->chroma_format = format->chroma_format; memset(&cuinfo, 0, sizeof(cuinfo)); cuinfo.CodecType = ctx->codec_type = format->codec; cuinfo.ChromaFormat = format->chroma_format; cuinfo.OutputFormat = cudaVideoSurfaceFormat_NV12; cuinfo.ulWidth = avctx->coded_width; cuinfo.ulHeight = avctx->coded_height; cuinfo.ulTargetWidth = cuinfo.ulWidth; cuinfo.ulTargetHeight = cuinfo.ulHeight; cuinfo.target_rect.left = 0; cuinfo.target_rect.top = 0; cuinfo.target_rect.right = cuinfo.ulWidth; cuinfo.target_rect.bottom = cuinfo.ulHeight; cuinfo.ulNumDecodeSurfaces = MAX_FRAME_COUNT; cuinfo.ulNumOutputSurfaces = 1; cuinfo.ulCreationFlags = cudaVideoCreate_PreferCUVID; cuinfo.DeinterlaceMode = cudaVideoDeinterlaceMode_Weave; ctx->internal_error = CHECK_CU(cuvidCreateDecoder(&ctx->cudecoder, &cuinfo)); if (ctx->internal_error < 0) if (!hwframe_ctx->pool) { hwframe_ctx->format = AV_PIX_FMT_CUDA; hwframe_ctx->sw_format = AV_PIX_FMT_NV12; hwframe_ctx->width = FFALIGN(avctx->coded_width, 32); hwframe_ctx->height = FFALIGN(avctx->coded_height, 32); if ((ctx->internal_error = av_hwframe_ctx_init(ctx->hwframe)) < 0) { av_log(avctx, AV_LOG_ERROR, "av_hwframe_ctx_init failed\n"); return 1;
[ "static int VAR_0 cuvid_handle_video_sequence(void *opaque, CUVIDEOFORMAT* format)\n{", "AVCodecContext *avctx = opaque;", "CuvidContext *ctx = avctx->priv_data;", "AVHWFramesContext *hwframe_ctx = (AVHWFramesContext*)ctx->hwframe->data;", "CUVIDDECODECREATEINFO cuinfo;", "av_log(avctx, AV_LOG_TRACE, \"pfnSequenceCallback\\n\");", "ctx->internal_error = 0;", "avctx->width = format->display_area.right;", "avctx->height = format->display_area.bottom;", "ff_set_sar(avctx, av_div_q(\n(AVRational){ format->display_aspect_ratio.x, format->display_aspect_ratio.y },", "(AVRational){ avctx->width, avctx->height }));", "if (!format->progressive_sequence)\navctx->flags |= AV_CODEC_FLAG_INTERLACED_DCT;", "else\navctx->flags &= ~AV_CODEC_FLAG_INTERLACED_DCT;", "if (format->video_signal_description.video_full_range_flag)\navctx->color_range = AVCOL_RANGE_JPEG;", "else\navctx->color_range = AVCOL_RANGE_MPEG;", "avctx->color_primaries = format->video_signal_description.color_primaries;", "avctx->color_trc = format->video_signal_description.transfer_characteristics;", "avctx->colorspace = format->video_signal_description.matrix_coefficients;", "if (format->bitrate)\navctx->bit_rate = format->bitrate;", "if (format->frame_rate.numerator && format->frame_rate.denominator) {", "avctx->framerate.num = format->frame_rate.numerator;", "avctx->framerate.den = format->frame_rate.denominator;", "if (ctx->cudecoder\n&& avctx->coded_width == format->coded_width\n&& avctx->coded_height == format->coded_height\n&& ctx->chroma_format == format->chroma_format\n&& ctx->codec_type == format->codec)\nreturn 1;", "if (ctx->cudecoder) {", "av_log(avctx, AV_LOG_ERROR, \"re-initializing decoder is not supported\\n\");", "if (hwframe_ctx->pool && !ctx->ever_flushed) {", "av_log(avctx, AV_LOG_ERROR, \"AVHWFramesContext is already initialized\\n\");", "avctx->coded_width = format->coded_width;", "avctx->coded_height = format->coded_height;", "ctx->chroma_format = format->chroma_format;", "memset(&cuinfo, 0, sizeof(cuinfo));", "cuinfo.CodecType = ctx->codec_type = format->codec;", "cuinfo.ChromaFormat = format->chroma_format;", "cuinfo.OutputFormat = cudaVideoSurfaceFormat_NV12;", "cuinfo.ulWidth = avctx->coded_width;", "cuinfo.ulHeight = avctx->coded_height;", "cuinfo.ulTargetWidth = cuinfo.ulWidth;", "cuinfo.ulTargetHeight = cuinfo.ulHeight;", "cuinfo.target_rect.left = 0;", "cuinfo.target_rect.top = 0;", "cuinfo.target_rect.right = cuinfo.ulWidth;", "cuinfo.target_rect.bottom = cuinfo.ulHeight;", "cuinfo.ulNumDecodeSurfaces = MAX_FRAME_COUNT;", "cuinfo.ulNumOutputSurfaces = 1;", "cuinfo.ulCreationFlags = cudaVideoCreate_PreferCUVID;", "cuinfo.DeinterlaceMode = cudaVideoDeinterlaceMode_Weave;", "ctx->internal_error = CHECK_CU(cuvidCreateDecoder(&ctx->cudecoder, &cuinfo));", "if (ctx->internal_error < 0)\nif (!hwframe_ctx->pool) {", "hwframe_ctx->format = AV_PIX_FMT_CUDA;", "hwframe_ctx->sw_format = AV_PIX_FMT_NV12;", "hwframe_ctx->width = FFALIGN(avctx->coded_width, 32);", "hwframe_ctx->height = FFALIGN(avctx->coded_height, 32);", "if ((ctx->internal_error = av_hwframe_ctx_init(ctx->hwframe)) < 0) {", "av_log(avctx, AV_LOG_ERROR, \"av_hwframe_ctx_init failed\\n\");", "return 1;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ] ]
2,317
static void test_leak_bucket(void) { throttle_config_init(&cfg); bkt = cfg.buckets[THROTTLE_BPS_TOTAL]; /* set initial value */ bkt.avg = 150; bkt.max = 15; bkt.level = 1.5; /* leak an op work of time */ throttle_leak_bucket(&bkt, NANOSECONDS_PER_SECOND / 150); g_assert(bkt.avg == 150); g_assert(bkt.max == 15); g_assert(double_cmp(bkt.level, 0.5)); /* leak again emptying the bucket */ throttle_leak_bucket(&bkt, NANOSECONDS_PER_SECOND / 150); g_assert(bkt.avg == 150); g_assert(bkt.max == 15); g_assert(double_cmp(bkt.level, 0)); /* check that the bucket level won't go lower */ throttle_leak_bucket(&bkt, NANOSECONDS_PER_SECOND / 150); g_assert(bkt.avg == 150); g_assert(bkt.max == 15); g_assert(double_cmp(bkt.level, 0)); }
true
qemu
eb8a1a1cbda15d776d6d505f14f61c7852f6a51a
static void test_leak_bucket(void) { throttle_config_init(&cfg); bkt = cfg.buckets[THROTTLE_BPS_TOTAL]; bkt.avg = 150; bkt.max = 15; bkt.level = 1.5; throttle_leak_bucket(&bkt, NANOSECONDS_PER_SECOND / 150); g_assert(bkt.avg == 150); g_assert(bkt.max == 15); g_assert(double_cmp(bkt.level, 0.5)); throttle_leak_bucket(&bkt, NANOSECONDS_PER_SECOND / 150); g_assert(bkt.avg == 150); g_assert(bkt.max == 15); g_assert(double_cmp(bkt.level, 0)); throttle_leak_bucket(&bkt, NANOSECONDS_PER_SECOND / 150); g_assert(bkt.avg == 150); g_assert(bkt.max == 15); g_assert(double_cmp(bkt.level, 0)); }
{ "code": [], "line_no": [] }
static void FUNC_0(void) { throttle_config_init(&cfg); bkt = cfg.buckets[THROTTLE_BPS_TOTAL]; bkt.avg = 150; bkt.max = 15; bkt.level = 1.5; throttle_leak_bucket(&bkt, NANOSECONDS_PER_SECOND / 150); g_assert(bkt.avg == 150); g_assert(bkt.max == 15); g_assert(double_cmp(bkt.level, 0.5)); throttle_leak_bucket(&bkt, NANOSECONDS_PER_SECOND / 150); g_assert(bkt.avg == 150); g_assert(bkt.max == 15); g_assert(double_cmp(bkt.level, 0)); throttle_leak_bucket(&bkt, NANOSECONDS_PER_SECOND / 150); g_assert(bkt.avg == 150); g_assert(bkt.max == 15); g_assert(double_cmp(bkt.level, 0)); }
[ "static void FUNC_0(void)\n{", "throttle_config_init(&cfg);", "bkt = cfg.buckets[THROTTLE_BPS_TOTAL];", "bkt.avg = 150;", "bkt.max = 15;", "bkt.level = 1.5;", "throttle_leak_bucket(&bkt, NANOSECONDS_PER_SECOND / 150);", "g_assert(bkt.avg == 150);", "g_assert(bkt.max == 15);", "g_assert(double_cmp(bkt.level, 0.5));", "throttle_leak_bucket(&bkt, NANOSECONDS_PER_SECOND / 150);", "g_assert(bkt.avg == 150);", "g_assert(bkt.max == 15);", "g_assert(double_cmp(bkt.level, 0));", "throttle_leak_bucket(&bkt, NANOSECONDS_PER_SECOND / 150);", "g_assert(bkt.avg == 150);", "g_assert(bkt.max == 15);", "g_assert(double_cmp(bkt.level, 0));", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2 ], [ 3 ], [ 4 ], [ 6 ], [ 7 ], [ 8 ], [ 10 ], [ 11 ], [ 12 ], [ 13 ], [ 15 ], [ 16 ], [ 17 ], [ 18 ], [ 20 ], [ 21 ], [ 22 ], [ 23 ], [ 24 ] ]
2,318
static BlockAIOCB *blkverify_aio_readv(BlockDriverState *bs, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, BlockCompletionFunc *cb, void *opaque) { BDRVBlkverifyState *s = bs->opaque; BlkverifyAIOCB *acb = blkverify_aio_get(bs, false, sector_num, qiov, nb_sectors, cb, opaque); acb->verify = blkverify_verify_readv; acb->buf = qemu_blockalign(bs->file->bs, qiov->size); qemu_iovec_init(&acb->raw_qiov, acb->qiov->niov); qemu_iovec_clone(&acb->raw_qiov, qiov, acb->buf); bdrv_aio_readv(s->test_file, sector_num, qiov, nb_sectors, blkverify_aio_cb, acb); bdrv_aio_readv(bs->file, sector_num, &acb->raw_qiov, nb_sectors, blkverify_aio_cb, acb); return &acb->common; }
true
qemu
44b6789299a8acca3f25331bc411055cafc7bb06
static BlockAIOCB *blkverify_aio_readv(BlockDriverState *bs, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, BlockCompletionFunc *cb, void *opaque) { BDRVBlkverifyState *s = bs->opaque; BlkverifyAIOCB *acb = blkverify_aio_get(bs, false, sector_num, qiov, nb_sectors, cb, opaque); acb->verify = blkverify_verify_readv; acb->buf = qemu_blockalign(bs->file->bs, qiov->size); qemu_iovec_init(&acb->raw_qiov, acb->qiov->niov); qemu_iovec_clone(&acb->raw_qiov, qiov, acb->buf); bdrv_aio_readv(s->test_file, sector_num, qiov, nb_sectors, blkverify_aio_cb, acb); bdrv_aio_readv(bs->file, sector_num, &acb->raw_qiov, nb_sectors, blkverify_aio_cb, acb); return &acb->common; }
{ "code": [ "static BlockAIOCB *blkverify_aio_readv(BlockDriverState *bs,", " int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,", " BlockCompletionFunc *cb, void *opaque)", " BDRVBlkverifyState *s = bs->opaque;", " BlkverifyAIOCB *acb = blkverify_aio_get(bs, false, sector_num, qiov,", " nb_sectors, cb, opaque);", " acb->verify = blkverify_verify_readv;", " acb->buf = qemu_blockalign(bs->file->bs, qiov->size);", " qemu_iovec_init(&acb->raw_qiov, acb->qiov->niov);", " qemu_iovec_clone(&acb->raw_qiov, qiov, acb->buf);", " bdrv_aio_readv(s->test_file, sector_num, qiov, nb_sectors,", " blkverify_aio_cb, acb);", " bdrv_aio_readv(bs->file, sector_num, &acb->raw_qiov, nb_sectors,", " blkverify_aio_cb, acb);", " return &acb->common;", " int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,", " BlockCompletionFunc *cb, void *opaque)", " BDRVBlkverifyState *s = bs->opaque;", " nb_sectors, cb, opaque);", " return &acb->common;" ], "line_no": [ 1, 3, 5, 9, 11, 13, 17, 19, 21, 23, 27, 29, 31, 29, 35, 3, 5, 9, 13, 35 ] }
static BlockAIOCB *FUNC_0(BlockDriverState *bs, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, BlockCompletionFunc *cb, void *opaque) { BDRVBlkverifyState *s = bs->opaque; BlkverifyAIOCB *acb = blkverify_aio_get(bs, false, sector_num, qiov, nb_sectors, cb, opaque); acb->verify = blkverify_verify_readv; acb->buf = qemu_blockalign(bs->file->bs, qiov->size); qemu_iovec_init(&acb->raw_qiov, acb->qiov->niov); qemu_iovec_clone(&acb->raw_qiov, qiov, acb->buf); bdrv_aio_readv(s->test_file, sector_num, qiov, nb_sectors, blkverify_aio_cb, acb); bdrv_aio_readv(bs->file, sector_num, &acb->raw_qiov, nb_sectors, blkverify_aio_cb, acb); return &acb->common; }
[ "static BlockAIOCB *FUNC_0(BlockDriverState *bs,\nint64_t sector_num, QEMUIOVector *qiov, int nb_sectors,\nBlockCompletionFunc *cb, void *opaque)\n{", "BDRVBlkverifyState *s = bs->opaque;", "BlkverifyAIOCB *acb = blkverify_aio_get(bs, false, sector_num, qiov,\nnb_sectors, cb, opaque);", "acb->verify = blkverify_verify_readv;", "acb->buf = qemu_blockalign(bs->file->bs, qiov->size);", "qemu_iovec_init(&acb->raw_qiov, acb->qiov->niov);", "qemu_iovec_clone(&acb->raw_qiov, qiov, acb->buf);", "bdrv_aio_readv(s->test_file, sector_num, qiov, nb_sectors,\nblkverify_aio_cb, acb);", "bdrv_aio_readv(bs->file, sector_num, &acb->raw_qiov, nb_sectors,\nblkverify_aio_cb, acb);", "return &acb->common;", "}" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11, 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27, 29 ], [ 31, 33 ], [ 35 ], [ 37 ] ]
2,319
void ff_put_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size) { const DCTELEM *p; uint8_t *pix; /* read the pixels */ p = block; pix = pixels; /* unrolled loop */ __asm__ volatile ( "movq %3, %%mm0 \n\t" "movq 8%3, %%mm1 \n\t" "movq 16%3, %%mm2 \n\t" "movq 24%3, %%mm3 \n\t" "movq 32%3, %%mm4 \n\t" "movq 40%3, %%mm5 \n\t" "movq 48%3, %%mm6 \n\t" "movq 56%3, %%mm7 \n\t" "packuswb %%mm1, %%mm0 \n\t" "packuswb %%mm3, %%mm2 \n\t" "packuswb %%mm5, %%mm4 \n\t" "packuswb %%mm7, %%mm6 \n\t" "movq %%mm0, (%0) \n\t" "movq %%mm2, (%0, %1) \n\t" "movq %%mm4, (%0, %1, 2) \n\t" "movq %%mm6, (%0, %2) \n\t" :: "r"(pix), "r"((x86_reg)line_size), "r"((x86_reg)line_size * 3), "m"(*p) : "memory"); pix += line_size * 4; p += 32; // if here would be an exact copy of the code above // compiler would generate some very strange code // thus using "r" __asm__ volatile ( "movq (%3), %%mm0 \n\t" "movq 8(%3), %%mm1 \n\t" "movq 16(%3), %%mm2 \n\t" "movq 24(%3), %%mm3 \n\t" "movq 32(%3), %%mm4 \n\t" "movq 40(%3), %%mm5 \n\t" "movq 48(%3), %%mm6 \n\t" "movq 56(%3), %%mm7 \n\t" "packuswb %%mm1, %%mm0 \n\t" "packuswb %%mm3, %%mm2 \n\t" "packuswb %%mm5, %%mm4 \n\t" "packuswb %%mm7, %%mm6 \n\t" "movq %%mm0, (%0) \n\t" "movq %%mm2, (%0, %1) \n\t" "movq %%mm4, (%0, %1, 2) \n\t" "movq %%mm6, (%0, %2) \n\t" :: "r"(pix), "r"((x86_reg)line_size), "r"((x86_reg)line_size * 3), "r"(p) : "memory"); }
true
FFmpeg
845e92fd6abf749a960354becdc5a9bc498f1f96
void ff_put_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size) { const DCTELEM *p; uint8_t *pix; p = block; pix = pixels; __asm__ volatile ( "movq %3, %%mm0 \n\t" "movq 8%3, %%mm1 \n\t" "movq 16%3, %%mm2 \n\t" "movq 24%3, %%mm3 \n\t" "movq 32%3, %%mm4 \n\t" "movq 40%3, %%mm5 \n\t" "movq 48%3, %%mm6 \n\t" "movq 56%3, %%mm7 \n\t" "packuswb %%mm1, %%mm0 \n\t" "packuswb %%mm3, %%mm2 \n\t" "packuswb %%mm5, %%mm4 \n\t" "packuswb %%mm7, %%mm6 \n\t" "movq %%mm0, (%0) \n\t" "movq %%mm2, (%0, %1) \n\t" "movq %%mm4, (%0, %1, 2) \n\t" "movq %%mm6, (%0, %2) \n\t" :: "r"(pix), "r"((x86_reg)line_size), "r"((x86_reg)line_size * 3), "m"(*p) : "memory"); pix += line_size * 4; p += 32; __asm__ volatile ( "movq (%3), %%mm0 \n\t" "movq 8(%3), %%mm1 \n\t" "movq 16(%3), %%mm2 \n\t" "movq 24(%3), %%mm3 \n\t" "movq 32(%3), %%mm4 \n\t" "movq 40(%3), %%mm5 \n\t" "movq 48(%3), %%mm6 \n\t" "movq 56(%3), %%mm7 \n\t" "packuswb %%mm1, %%mm0 \n\t" "packuswb %%mm3, %%mm2 \n\t" "packuswb %%mm5, %%mm4 \n\t" "packuswb %%mm7, %%mm6 \n\t" "movq %%mm0, (%0) \n\t" "movq %%mm2, (%0, %1) \n\t" "movq %%mm4, (%0, %1, 2) \n\t" "movq %%mm6, (%0, %2) \n\t" :: "r"(pix), "r"((x86_reg)line_size), "r"((x86_reg)line_size * 3), "r"(p) : "memory"); }
{ "code": [ " \"movq %3, %%mm0 \\n\\t\"", " \"movq 8%3, %%mm1 \\n\\t\"", " \"movq 16%3, %%mm2 \\n\\t\"", " \"movq 24%3, %%mm3 \\n\\t\"", " \"movq 32%3, %%mm4 \\n\\t\"", " \"movq 40%3, %%mm5 \\n\\t\"", " \"movq 48%3, %%mm6 \\n\\t\"", " \"movq 56%3, %%mm7 \\n\\t\"", " \"m\"(*p)" ], "line_no": [ 23, 25, 27, 29, 31, 33, 35, 37, 57 ] }
void FUNC_0(const DCTELEM *VAR_0, uint8_t *VAR_1, int VAR_2) { const DCTELEM *VAR_3; uint8_t *pix; VAR_3 = VAR_0; pix = VAR_1; __asm__ volatile ( "movq %3, %%mm0 \n\t" "movq 8%3, %%mm1 \n\t" "movq 16%3, %%mm2 \n\t" "movq 24%3, %%mm3 \n\t" "movq 32%3, %%mm4 \n\t" "movq 40%3, %%mm5 \n\t" "movq 48%3, %%mm6 \n\t" "movq 56%3, %%mm7 \n\t" "packuswb %%mm1, %%mm0 \n\t" "packuswb %%mm3, %%mm2 \n\t" "packuswb %%mm5, %%mm4 \n\t" "packuswb %%mm7, %%mm6 \n\t" "movq %%mm0, (%0) \n\t" "movq %%mm2, (%0, %1) \n\t" "movq %%mm4, (%0, %1, 2) \n\t" "movq %%mm6, (%0, %2) \n\t" :: "r"(pix), "r"((x86_reg)VAR_2), "r"((x86_reg)VAR_2 * 3), "m"(*VAR_3) : "memory"); pix += VAR_2 * 4; VAR_3 += 32; __asm__ volatile ( "movq (%3), %%mm0 \n\t" "movq 8(%3), %%mm1 \n\t" "movq 16(%3), %%mm2 \n\t" "movq 24(%3), %%mm3 \n\t" "movq 32(%3), %%mm4 \n\t" "movq 40(%3), %%mm5 \n\t" "movq 48(%3), %%mm6 \n\t" "movq 56(%3), %%mm7 \n\t" "packuswb %%mm1, %%mm0 \n\t" "packuswb %%mm3, %%mm2 \n\t" "packuswb %%mm5, %%mm4 \n\t" "packuswb %%mm7, %%mm6 \n\t" "movq %%mm0, (%0) \n\t" "movq %%mm2, (%0, %1) \n\t" "movq %%mm4, (%0, %1, 2) \n\t" "movq %%mm6, (%0, %2) \n\t" :: "r"(pix), "r"((x86_reg)VAR_2), "r"((x86_reg)VAR_2 * 3), "r"(VAR_3) : "memory"); }
[ "void FUNC_0(const DCTELEM *VAR_0, uint8_t *VAR_1,\nint VAR_2)\n{", "const DCTELEM *VAR_3;", "uint8_t *pix;", "VAR_3 = VAR_0;", "pix = VAR_1;", "__asm__ volatile (\n\"movq %3, %%mm0 \\n\\t\"\n\"movq 8%3, %%mm1 \\n\\t\"\n\"movq 16%3, %%mm2 \\n\\t\"\n\"movq 24%3, %%mm3 \\n\\t\"\n\"movq 32%3, %%mm4 \\n\\t\"\n\"movq 40%3, %%mm5 \\n\\t\"\n\"movq 48%3, %%mm6 \\n\\t\"\n\"movq 56%3, %%mm7 \\n\\t\"\n\"packuswb %%mm1, %%mm0 \\n\\t\"\n\"packuswb %%mm3, %%mm2 \\n\\t\"\n\"packuswb %%mm5, %%mm4 \\n\\t\"\n\"packuswb %%mm7, %%mm6 \\n\\t\"\n\"movq %%mm0, (%0) \\n\\t\"\n\"movq %%mm2, (%0, %1) \\n\\t\"\n\"movq %%mm4, (%0, %1, 2) \\n\\t\"\n\"movq %%mm6, (%0, %2) \\n\\t\"\n:: \"r\"(pix), \"r\"((x86_reg)VAR_2), \"r\"((x86_reg)VAR_2 * 3),\n\"m\"(*VAR_3)\n: \"memory\");", "pix += VAR_2 * 4;", "VAR_3 += 32;", "__asm__ volatile (\n\"movq (%3), %%mm0 \\n\\t\"\n\"movq 8(%3), %%mm1 \\n\\t\"\n\"movq 16(%3), %%mm2 \\n\\t\"\n\"movq 24(%3), %%mm3 \\n\\t\"\n\"movq 32(%3), %%mm4 \\n\\t\"\n\"movq 40(%3), %%mm5 \\n\\t\"\n\"movq 48(%3), %%mm6 \\n\\t\"\n\"movq 56(%3), %%mm7 \\n\\t\"\n\"packuswb %%mm1, %%mm0 \\n\\t\"\n\"packuswb %%mm3, %%mm2 \\n\\t\"\n\"packuswb %%mm5, %%mm4 \\n\\t\"\n\"packuswb %%mm7, %%mm6 \\n\\t\"\n\"movq %%mm0, (%0) \\n\\t\"\n\"movq %%mm2, (%0, %1) \\n\\t\"\n\"movq %%mm4, (%0, %1, 2) \\n\\t\"\n\"movq %%mm6, (%0, %2) \\n\\t\"\n:: \"r\"(pix), \"r\"((x86_reg)VAR_2), \"r\"((x86_reg)VAR_2 * 3), \"r\"(VAR_3)\n: \"memory\");", "}" ]
[ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 15 ], [ 17 ], [ 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59 ], [ 61 ], [ 63 ], [ 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, 99, 101, 103, 105, 107, 109 ], [ 111 ] ]
2,320
static target_ulong h_enter(CPUPPCState *env, sPAPREnvironment *spapr, target_ulong opcode, target_ulong *args) { target_ulong flags = args[0]; target_ulong pte_index = args[1]; target_ulong pteh = args[2]; target_ulong ptel = args[3]; target_ulong page_shift = 12; target_ulong raddr; target_ulong i; uint8_t *hpte; /* only handle 4k and 16M pages for now */ if (pteh & HPTE_V_LARGE) { #if 0 /* We don't support 64k pages yet */ if ((ptel & 0xf000) == 0x1000) { /* 64k page */ } else #endif if ((ptel & 0xff000) == 0) { /* 16M page */ page_shift = 24; /* lowest AVA bit must be 0 for 16M pages */ if (pteh & 0x80) { return H_PARAMETER; } } else { return H_PARAMETER; } } raddr = (ptel & HPTE_R_RPN) & ~((1ULL << page_shift) - 1); if (raddr < spapr->ram_limit) { /* Regular RAM - should have WIMG=0010 */ if ((ptel & HPTE_R_WIMG) != HPTE_R_M) { return H_PARAMETER; } } else { /* Looks like an IO address */ /* FIXME: What WIMG combinations could be sensible for IO? * For now we allow WIMG=010x, but are there others? */ /* FIXME: Should we check against registered IO addresses? */ if ((ptel & (HPTE_R_W | HPTE_R_I | HPTE_R_M)) != HPTE_R_I) { return H_PARAMETER; } } pteh &= ~0x60ULL; if ((pte_index * HASH_PTE_SIZE_64) & ~env->htab_mask) { return H_PARAMETER; } if (likely((flags & H_EXACT) == 0)) { pte_index &= ~7ULL; hpte = env->external_htab + (pte_index * HASH_PTE_SIZE_64); for (i = 0; ; ++i) { if (i == 8) { return H_PTEG_FULL; } if (((ldq_p(hpte) & HPTE_V_VALID) == 0) && lock_hpte(hpte, HPTE_V_HVLOCK | HPTE_V_VALID)) { break; } hpte += HASH_PTE_SIZE_64; } } else { i = 0; hpte = env->external_htab + (pte_index * HASH_PTE_SIZE_64); if (!lock_hpte(hpte, HPTE_V_HVLOCK | HPTE_V_VALID)) { return H_PTEG_FULL; } } stq_p(hpte + (HASH_PTE_SIZE_64/2), ptel); /* eieio(); FIXME: need some sort of barrier for smp? */ stq_p(hpte, pteh); assert(!(ldq_p(hpte) & HPTE_V_HVLOCK)); args[0] = pte_index + i; return H_SUCCESS; }
true
qemu
35f9304d925a5423c51bd2c83a81fa3cc2b6e680
static target_ulong h_enter(CPUPPCState *env, sPAPREnvironment *spapr, target_ulong opcode, target_ulong *args) { target_ulong flags = args[0]; target_ulong pte_index = args[1]; target_ulong pteh = args[2]; target_ulong ptel = args[3]; target_ulong page_shift = 12; target_ulong raddr; target_ulong i; uint8_t *hpte; if (pteh & HPTE_V_LARGE) { #if 0 if ((ptel & 0xf000) == 0x1000) { } else #endif if ((ptel & 0xff000) == 0) { page_shift = 24; if (pteh & 0x80) { return H_PARAMETER; } } else { return H_PARAMETER; } } raddr = (ptel & HPTE_R_RPN) & ~((1ULL << page_shift) - 1); if (raddr < spapr->ram_limit) { if ((ptel & HPTE_R_WIMG) != HPTE_R_M) { return H_PARAMETER; } } else { if ((ptel & (HPTE_R_W | HPTE_R_I | HPTE_R_M)) != HPTE_R_I) { return H_PARAMETER; } } pteh &= ~0x60ULL; if ((pte_index * HASH_PTE_SIZE_64) & ~env->htab_mask) { return H_PARAMETER; } if (likely((flags & H_EXACT) == 0)) { pte_index &= ~7ULL; hpte = env->external_htab + (pte_index * HASH_PTE_SIZE_64); for (i = 0; ; ++i) { if (i == 8) { return H_PTEG_FULL; } if (((ldq_p(hpte) & HPTE_V_VALID) == 0) && lock_hpte(hpte, HPTE_V_HVLOCK | HPTE_V_VALID)) { break; } hpte += HASH_PTE_SIZE_64; } } else { i = 0; hpte = env->external_htab + (pte_index * HASH_PTE_SIZE_64); if (!lock_hpte(hpte, HPTE_V_HVLOCK | HPTE_V_VALID)) { return H_PTEG_FULL; } } stq_p(hpte + (HASH_PTE_SIZE_64/2), ptel); stq_p(hpte, pteh); assert(!(ldq_p(hpte) & HPTE_V_HVLOCK)); args[0] = pte_index + i; return H_SUCCESS; }
{ "code": [ " if (((ldq_p(hpte) & HPTE_V_VALID) == 0) &&", " lock_hpte(hpte, HPTE_V_HVLOCK | HPTE_V_VALID)) {", " if (!lock_hpte(hpte, HPTE_V_HVLOCK | HPTE_V_VALID)) {", " assert(!(ldq_p(hpte) & HPTE_V_HVLOCK));", " assert(!(ldq_p(hpte) & HPTE_V_HVLOCK));", " assert(!(ldq_p(hpte) & HPTE_V_HVLOCK));" ], "line_no": [ 121, 123, 139, 155, 155, 155 ] }
static target_ulong FUNC_0(CPUPPCState *env, sPAPREnvironment *spapr, target_ulong opcode, target_ulong *args) { target_ulong flags = args[0]; target_ulong pte_index = args[1]; target_ulong pteh = args[2]; target_ulong ptel = args[3]; target_ulong page_shift = 12; target_ulong raddr; target_ulong i; uint8_t *hpte; if (pteh & HPTE_V_LARGE) { #if 0 if ((ptel & 0xf000) == 0x1000) { } else #endif if ((ptel & 0xff000) == 0) { page_shift = 24; if (pteh & 0x80) { return H_PARAMETER; } } else { return H_PARAMETER; } } raddr = (ptel & HPTE_R_RPN) & ~((1ULL << page_shift) - 1); if (raddr < spapr->ram_limit) { if ((ptel & HPTE_R_WIMG) != HPTE_R_M) { return H_PARAMETER; } } else { if ((ptel & (HPTE_R_W | HPTE_R_I | HPTE_R_M)) != HPTE_R_I) { return H_PARAMETER; } } pteh &= ~0x60ULL; if ((pte_index * HASH_PTE_SIZE_64) & ~env->htab_mask) { return H_PARAMETER; } if (likely((flags & H_EXACT) == 0)) { pte_index &= ~7ULL; hpte = env->external_htab + (pte_index * HASH_PTE_SIZE_64); for (i = 0; ; ++i) { if (i == 8) { return H_PTEG_FULL; } if (((ldq_p(hpte) & HPTE_V_VALID) == 0) && lock_hpte(hpte, HPTE_V_HVLOCK | HPTE_V_VALID)) { break; } hpte += HASH_PTE_SIZE_64; } } else { i = 0; hpte = env->external_htab + (pte_index * HASH_PTE_SIZE_64); if (!lock_hpte(hpte, HPTE_V_HVLOCK | HPTE_V_VALID)) { return H_PTEG_FULL; } } stq_p(hpte + (HASH_PTE_SIZE_64/2), ptel); stq_p(hpte, pteh); assert(!(ldq_p(hpte) & HPTE_V_HVLOCK)); args[0] = pte_index + i; return H_SUCCESS; }
[ "static target_ulong FUNC_0(CPUPPCState *env, sPAPREnvironment *spapr,\ntarget_ulong opcode, target_ulong *args)\n{", "target_ulong flags = args[0];", "target_ulong pte_index = args[1];", "target_ulong pteh = args[2];", "target_ulong ptel = args[3];", "target_ulong page_shift = 12;", "target_ulong raddr;", "target_ulong i;", "uint8_t *hpte;", "if (pteh & HPTE_V_LARGE) {", "#if 0\nif ((ptel & 0xf000) == 0x1000) {", "} else", "#endif\nif ((ptel & 0xff000) == 0) {", "page_shift = 24;", "if (pteh & 0x80) {", "return H_PARAMETER;", "}", "} else {", "return H_PARAMETER;", "}", "}", "raddr = (ptel & HPTE_R_RPN) & ~((1ULL << page_shift) - 1);", "if (raddr < spapr->ram_limit) {", "if ((ptel & HPTE_R_WIMG) != HPTE_R_M) {", "return H_PARAMETER;", "}", "} else {", "if ((ptel & (HPTE_R_W | HPTE_R_I | HPTE_R_M)) != HPTE_R_I) {", "return H_PARAMETER;", "}", "}", "pteh &= ~0x60ULL;", "if ((pte_index * HASH_PTE_SIZE_64) & ~env->htab_mask) {", "return H_PARAMETER;", "}", "if (likely((flags & H_EXACT) == 0)) {", "pte_index &= ~7ULL;", "hpte = env->external_htab + (pte_index * HASH_PTE_SIZE_64);", "for (i = 0; ; ++i) {", "if (i == 8) {", "return H_PTEG_FULL;", "}", "if (((ldq_p(hpte) & HPTE_V_VALID) == 0) &&\nlock_hpte(hpte, HPTE_V_HVLOCK | HPTE_V_VALID)) {", "break;", "}", "hpte += HASH_PTE_SIZE_64;", "}", "} else {", "i = 0;", "hpte = env->external_htab + (pte_index * HASH_PTE_SIZE_64);", "if (!lock_hpte(hpte, HPTE_V_HVLOCK | HPTE_V_VALID)) {", "return H_PTEG_FULL;", "}", "}", "stq_p(hpte + (HASH_PTE_SIZE_64/2), ptel);", "stq_p(hpte, pteh);", "assert(!(ldq_p(hpte) & HPTE_V_HVLOCK));", "args[0] = pte_index + i;", "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, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 27 ], [ 29, 31 ], [ 35 ], [ 37, 39 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 97 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121, 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 151 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ] ]
2,321
static void exynos4210_gic_init(Object *obj) { DeviceState *dev = DEVICE(obj); Exynos4210GicState *s = EXYNOS4210_GIC(obj); SysBusDevice *sbd = SYS_BUS_DEVICE(obj); uint32_t i; const char cpu_prefix[] = "exynos4210-gic-alias_cpu"; const char dist_prefix[] = "exynos4210-gic-alias_dist"; char cpu_alias_name[sizeof(cpu_prefix) + 3]; char dist_alias_name[sizeof(cpu_prefix) + 3]; SysBusDevice *busdev; s->gic = qdev_create(NULL, "arm_gic"); qdev_prop_set_uint32(s->gic, "num-cpu", s->num_cpu); qdev_prop_set_uint32(s->gic, "num-irq", EXYNOS4210_GIC_NIRQ); qdev_init_nofail(s->gic); busdev = SYS_BUS_DEVICE(s->gic); /* Pass through outbound IRQ lines from the GIC */ sysbus_pass_irq(sbd, busdev); /* Pass through inbound GPIO lines to the GIC */ qdev_init_gpio_in(dev, exynos4210_gic_set_irq, EXYNOS4210_GIC_NIRQ - 32); memory_region_init(&s->cpu_container, obj, "exynos4210-cpu-container", EXYNOS4210_EXT_GIC_CPU_REGION_SIZE); memory_region_init(&s->dist_container, obj, "exynos4210-dist-container", EXYNOS4210_EXT_GIC_DIST_REGION_SIZE); for (i = 0; i < s->num_cpu; i++) { /* Map CPU interface per SMP Core */ sprintf(cpu_alias_name, "%s%x", cpu_prefix, i); memory_region_init_alias(&s->cpu_alias[i], obj, cpu_alias_name, sysbus_mmio_get_region(busdev, 1), 0, EXYNOS4210_GIC_CPU_REGION_SIZE); memory_region_add_subregion(&s->cpu_container, EXYNOS4210_EXT_GIC_CPU_GET_OFFSET(i), &s->cpu_alias[i]); /* Map Distributor per SMP Core */ sprintf(dist_alias_name, "%s%x", dist_prefix, i); memory_region_init_alias(&s->dist_alias[i], obj, dist_alias_name, sysbus_mmio_get_region(busdev, 0), 0, EXYNOS4210_GIC_DIST_REGION_SIZE); memory_region_add_subregion(&s->dist_container, EXYNOS4210_EXT_GIC_DIST_GET_OFFSET(i), &s->dist_alias[i]); } sysbus_init_mmio(sbd, &s->cpu_container); sysbus_init_mmio(sbd, &s->dist_container); }
true
qemu
ee78356eba8df05043bac392c263450db5e7eed6
static void exynos4210_gic_init(Object *obj) { DeviceState *dev = DEVICE(obj); Exynos4210GicState *s = EXYNOS4210_GIC(obj); SysBusDevice *sbd = SYS_BUS_DEVICE(obj); uint32_t i; const char cpu_prefix[] = "exynos4210-gic-alias_cpu"; const char dist_prefix[] = "exynos4210-gic-alias_dist"; char cpu_alias_name[sizeof(cpu_prefix) + 3]; char dist_alias_name[sizeof(cpu_prefix) + 3]; SysBusDevice *busdev; s->gic = qdev_create(NULL, "arm_gic"); qdev_prop_set_uint32(s->gic, "num-cpu", s->num_cpu); qdev_prop_set_uint32(s->gic, "num-irq", EXYNOS4210_GIC_NIRQ); qdev_init_nofail(s->gic); busdev = SYS_BUS_DEVICE(s->gic); sysbus_pass_irq(sbd, busdev); qdev_init_gpio_in(dev, exynos4210_gic_set_irq, EXYNOS4210_GIC_NIRQ - 32); memory_region_init(&s->cpu_container, obj, "exynos4210-cpu-container", EXYNOS4210_EXT_GIC_CPU_REGION_SIZE); memory_region_init(&s->dist_container, obj, "exynos4210-dist-container", EXYNOS4210_EXT_GIC_DIST_REGION_SIZE); for (i = 0; i < s->num_cpu; i++) { sprintf(cpu_alias_name, "%s%x", cpu_prefix, i); memory_region_init_alias(&s->cpu_alias[i], obj, cpu_alias_name, sysbus_mmio_get_region(busdev, 1), 0, EXYNOS4210_GIC_CPU_REGION_SIZE); memory_region_add_subregion(&s->cpu_container, EXYNOS4210_EXT_GIC_CPU_GET_OFFSET(i), &s->cpu_alias[i]); sprintf(dist_alias_name, "%s%x", dist_prefix, i); memory_region_init_alias(&s->dist_alias[i], obj, dist_alias_name, sysbus_mmio_get_region(busdev, 0), 0, EXYNOS4210_GIC_DIST_REGION_SIZE); memory_region_add_subregion(&s->dist_container, EXYNOS4210_EXT_GIC_DIST_GET_OFFSET(i), &s->dist_alias[i]); } sysbus_init_mmio(sbd, &s->cpu_container); sysbus_init_mmio(sbd, &s->dist_container); }
{ "code": [ " uint32_t i;", " SysBusDevice *busdev;", " busdev = SYS_BUS_DEVICE(s->gic);", " sysbus_pass_irq(sbd, busdev);", " sysbus_mmio_get_region(busdev, 1),", " sysbus_mmio_get_region(busdev, 0)," ], "line_no": [ 11, 21, 33, 39, 71, 91 ] }
static void FUNC_0(Object *VAR_0) { DeviceState *dev = DEVICE(VAR_0); Exynos4210GicState *s = EXYNOS4210_GIC(VAR_0); SysBusDevice *sbd = SYS_BUS_DEVICE(VAR_0); uint32_t i; const char VAR_1[] = "exynos4210-gic-alias_cpu"; const char VAR_2[] = "exynos4210-gic-alias_dist"; char VAR_3[sizeof(VAR_1) + 3]; char VAR_4[sizeof(VAR_1) + 3]; SysBusDevice *busdev; s->gic = qdev_create(NULL, "arm_gic"); qdev_prop_set_uint32(s->gic, "num-cpu", s->num_cpu); qdev_prop_set_uint32(s->gic, "num-irq", EXYNOS4210_GIC_NIRQ); qdev_init_nofail(s->gic); busdev = SYS_BUS_DEVICE(s->gic); sysbus_pass_irq(sbd, busdev); qdev_init_gpio_in(dev, exynos4210_gic_set_irq, EXYNOS4210_GIC_NIRQ - 32); memory_region_init(&s->cpu_container, VAR_0, "exynos4210-cpu-container", EXYNOS4210_EXT_GIC_CPU_REGION_SIZE); memory_region_init(&s->dist_container, VAR_0, "exynos4210-dist-container", EXYNOS4210_EXT_GIC_DIST_REGION_SIZE); for (i = 0; i < s->num_cpu; i++) { sprintf(VAR_3, "%s%x", VAR_1, i); memory_region_init_alias(&s->cpu_alias[i], VAR_0, VAR_3, sysbus_mmio_get_region(busdev, 1), 0, EXYNOS4210_GIC_CPU_REGION_SIZE); memory_region_add_subregion(&s->cpu_container, EXYNOS4210_EXT_GIC_CPU_GET_OFFSET(i), &s->cpu_alias[i]); sprintf(VAR_4, "%s%x", VAR_2, i); memory_region_init_alias(&s->dist_alias[i], VAR_0, VAR_4, sysbus_mmio_get_region(busdev, 0), 0, EXYNOS4210_GIC_DIST_REGION_SIZE); memory_region_add_subregion(&s->dist_container, EXYNOS4210_EXT_GIC_DIST_GET_OFFSET(i), &s->dist_alias[i]); } sysbus_init_mmio(sbd, &s->cpu_container); sysbus_init_mmio(sbd, &s->dist_container); }
[ "static void FUNC_0(Object *VAR_0)\n{", "DeviceState *dev = DEVICE(VAR_0);", "Exynos4210GicState *s = EXYNOS4210_GIC(VAR_0);", "SysBusDevice *sbd = SYS_BUS_DEVICE(VAR_0);", "uint32_t i;", "const char VAR_1[] = \"exynos4210-gic-alias_cpu\";", "const char VAR_2[] = \"exynos4210-gic-alias_dist\";", "char VAR_3[sizeof(VAR_1) + 3];", "char VAR_4[sizeof(VAR_1) + 3];", "SysBusDevice *busdev;", "s->gic = qdev_create(NULL, \"arm_gic\");", "qdev_prop_set_uint32(s->gic, \"num-cpu\", s->num_cpu);", "qdev_prop_set_uint32(s->gic, \"num-irq\", EXYNOS4210_GIC_NIRQ);", "qdev_init_nofail(s->gic);", "busdev = SYS_BUS_DEVICE(s->gic);", "sysbus_pass_irq(sbd, busdev);", "qdev_init_gpio_in(dev, exynos4210_gic_set_irq,\nEXYNOS4210_GIC_NIRQ - 32);", "memory_region_init(&s->cpu_container, VAR_0, \"exynos4210-cpu-container\",\nEXYNOS4210_EXT_GIC_CPU_REGION_SIZE);", "memory_region_init(&s->dist_container, VAR_0, \"exynos4210-dist-container\",\nEXYNOS4210_EXT_GIC_DIST_REGION_SIZE);", "for (i = 0; i < s->num_cpu; i++) {", "sprintf(VAR_3, \"%s%x\", VAR_1, i);", "memory_region_init_alias(&s->cpu_alias[i], VAR_0,\nVAR_3,\nsysbus_mmio_get_region(busdev, 1),\n0,\nEXYNOS4210_GIC_CPU_REGION_SIZE);", "memory_region_add_subregion(&s->cpu_container,\nEXYNOS4210_EXT_GIC_CPU_GET_OFFSET(i), &s->cpu_alias[i]);", "sprintf(VAR_4, \"%s%x\", VAR_2, i);", "memory_region_init_alias(&s->dist_alias[i], VAR_0,\nVAR_4,\nsysbus_mmio_get_region(busdev, 0),\n0,\nEXYNOS4210_GIC_DIST_REGION_SIZE);", "memory_region_add_subregion(&s->dist_container,\nEXYNOS4210_EXT_GIC_DIST_GET_OFFSET(i), &s->dist_alias[i]);", "}", "sysbus_init_mmio(sbd, &s->cpu_container);", "sysbus_init_mmio(sbd, &s->dist_container);", "}" ]
[ 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 39 ], [ 45, 47 ], [ 51, 53 ], [ 55, 57 ], [ 61 ], [ 65 ], [ 67, 69, 71, 73, 75 ], [ 77, 79 ], [ 85 ], [ 87, 89, 91, 93, 95 ], [ 97, 99 ], [ 101 ], [ 105 ], [ 107 ], [ 109 ] ]
2,322
static av_cold void compute_alpha_vlcs(void) { uint16_t run_code[129], level_code[256]; uint8_t run_bits[129], level_bits[256]; int run, level; for (run = 0; run < 128; run++) { if (!run) { /* 0 -> 0. */ run_code[run] = 0; run_bits[run] = 1; } else if (run <= 4) { /* 10xx -> xx plus 1. */ run_code[run] = ((run - 1) << 2) | 1; run_bits[run] = 4; } else { /* 111xxxxxxx -> xxxxxxxx. */ run_code[run] = (run << 3) | 7; run_bits[run] = 10; } } /* 110 -> EOB. */ run_code[128] = 3; run_bits[128] = 3; INIT_LE_VLC_STATIC(&ff_dc_alpha_run_vlc_le, ALPHA_VLC_BITS, 129, run_bits, 1, 1, run_code, 2, 2, 160); for (level = 0; level < 256; level++) { int8_t signed_level = (int8_t)level; int abs_signed_level = abs(signed_level); int sign = (signed_level < 0) ? 1 : 0; if (abs_signed_level == 1) { /* 1s -> -1 or +1 (depending on sign bit). */ level_code[level] = (sign << 1) | 1; level_bits[level] = 2; } else if (abs_signed_level >= 2 && abs_signed_level <= 5) { /* 01sxx -> xx plus 2 (2..5 or -2..-5, depending on sign bit). */ level_code[level] = ((abs_signed_level - 2) << 3) | (sign << 2) | 2; level_bits[level] = 5; } else { /* * 00xxxxxxxx -> xxxxxxxx, in two's complement. 0 is technically an * illegal code (that would be encoded by increasing run), but it * doesn't hurt and simplifies indexing. */ level_code[level] = level << 2; level_bits[level] = 10; } } INIT_LE_VLC_STATIC(&ff_dc_alpha_level_vlc_le, ALPHA_VLC_BITS, 256, level_bits, 1, 1, level_code, 2, 2, 288); }
true
FFmpeg
08b098169be079c4f124a351fda6764fbcd10e79
static av_cold void compute_alpha_vlcs(void) { uint16_t run_code[129], level_code[256]; uint8_t run_bits[129], level_bits[256]; int run, level; for (run = 0; run < 128; run++) { if (!run) { run_code[run] = 0; run_bits[run] = 1; } else if (run <= 4) { run_code[run] = ((run - 1) << 2) | 1; run_bits[run] = 4; } else { run_code[run] = (run << 3) | 7; run_bits[run] = 10; } } run_code[128] = 3; run_bits[128] = 3; INIT_LE_VLC_STATIC(&ff_dc_alpha_run_vlc_le, ALPHA_VLC_BITS, 129, run_bits, 1, 1, run_code, 2, 2, 160); for (level = 0; level < 256; level++) { int8_t signed_level = (int8_t)level; int abs_signed_level = abs(signed_level); int sign = (signed_level < 0) ? 1 : 0; if (abs_signed_level == 1) { level_code[level] = (sign << 1) | 1; level_bits[level] = 2; } else if (abs_signed_level >= 2 && abs_signed_level <= 5) { level_code[level] = ((abs_signed_level - 2) << 3) | (sign << 2) | 2; level_bits[level] = 5; } else { level_code[level] = level << 2; level_bits[level] = 10; } } INIT_LE_VLC_STATIC(&ff_dc_alpha_level_vlc_le, ALPHA_VLC_BITS, 256, level_bits, 1, 1, level_code, 2, 2, 288); }
{ "code": [ " uint16_t run_code[129], level_code[256];", " uint8_t run_bits[129], level_bits[256];", " int run, level;", " for (run = 0; run < 128; run++) {", " if (!run) {", " run_code[run] = 0;", " run_bits[run] = 1;", " } else if (run <= 4) {", " run_code[run] = ((run - 1) << 2) | 1;", " run_bits[run] = 4;", " } else {", " run_code[run] = (run << 3) | 7;", " run_bits[run] = 10;", " run_code[128] = 3;", " run_bits[128] = 3;", " INIT_LE_VLC_STATIC(&ff_dc_alpha_run_vlc_le, ALPHA_VLC_BITS, 129,", " run_bits, 1, 1,", " run_code, 2, 2, 160);", " for (level = 0; level < 256; level++) {", " int8_t signed_level = (int8_t)level;", " int abs_signed_level = abs(signed_level);", " int sign = (signed_level < 0) ? 1 : 0;", " if (abs_signed_level == 1) {", " level_code[level] = (sign << 1) | 1;", " level_bits[level] = 2;", " } else if (abs_signed_level >= 2 && abs_signed_level <= 5) {", " level_code[level] = ((abs_signed_level - 2) << 3) | (sign << 2) | 2;", " level_bits[level] = 5;", " } else {", " level_code[level] = level << 2;", " level_bits[level] = 10;", " INIT_LE_VLC_STATIC(&ff_dc_alpha_level_vlc_le, ALPHA_VLC_BITS, 256,", " level_bits, 1, 1,", " level_code, 2, 2, 288);" ], "line_no": [ 5, 7, 9, 13, 15, 19, 21, 23, 27, 29, 31, 35, 37, 47, 49, 53, 55, 57, 61, 63, 65, 67, 71, 75, 77, 79, 83, 85, 31, 99, 101, 109, 111, 113 ] }
static av_cold void FUNC_0(void) { uint16_t run_code[129], level_code[256]; uint8_t run_bits[129], level_bits[256]; int VAR_0, VAR_1; for (VAR_0 = 0; VAR_0 < 128; VAR_0++) { if (!VAR_0) { run_code[VAR_0] = 0; run_bits[VAR_0] = 1; } else if (VAR_0 <= 4) { run_code[VAR_0] = ((VAR_0 - 1) << 2) | 1; run_bits[VAR_0] = 4; } else { run_code[VAR_0] = (VAR_0 << 3) | 7; run_bits[VAR_0] = 10; } } run_code[128] = 3; run_bits[128] = 3; INIT_LE_VLC_STATIC(&ff_dc_alpha_run_vlc_le, ALPHA_VLC_BITS, 129, run_bits, 1, 1, run_code, 2, 2, 160); for (VAR_1 = 0; VAR_1 < 256; VAR_1++) { int8_t signed_level = (int8_t)VAR_1; int VAR_2 = abs(signed_level); int VAR_3 = (signed_level < 0) ? 1 : 0; if (VAR_2 == 1) { level_code[VAR_1] = (VAR_3 << 1) | 1; level_bits[VAR_1] = 2; } else if (VAR_2 >= 2 && VAR_2 <= 5) { level_code[VAR_1] = ((VAR_2 - 2) << 3) | (VAR_3 << 2) | 2; level_bits[VAR_1] = 5; } else { level_code[VAR_1] = VAR_1 << 2; level_bits[VAR_1] = 10; } } INIT_LE_VLC_STATIC(&ff_dc_alpha_level_vlc_le, ALPHA_VLC_BITS, 256, level_bits, 1, 1, level_code, 2, 2, 288); }
[ "static av_cold void FUNC_0(void)\n{", "uint16_t run_code[129], level_code[256];", "uint8_t run_bits[129], level_bits[256];", "int VAR_0, VAR_1;", "for (VAR_0 = 0; VAR_0 < 128; VAR_0++) {", "if (!VAR_0) {", "run_code[VAR_0] = 0;", "run_bits[VAR_0] = 1;", "} else if (VAR_0 <= 4) {", "run_code[VAR_0] = ((VAR_0 - 1) << 2) | 1;", "run_bits[VAR_0] = 4;", "} else {", "run_code[VAR_0] = (VAR_0 << 3) | 7;", "run_bits[VAR_0] = 10;", "}", "}", "run_code[128] = 3;", "run_bits[128] = 3;", "INIT_LE_VLC_STATIC(&ff_dc_alpha_run_vlc_le, ALPHA_VLC_BITS, 129,\nrun_bits, 1, 1,\nrun_code, 2, 2, 160);", "for (VAR_1 = 0; VAR_1 < 256; VAR_1++) {", "int8_t signed_level = (int8_t)VAR_1;", "int VAR_2 = abs(signed_level);", "int VAR_3 = (signed_level < 0) ? 1 : 0;", "if (VAR_2 == 1) {", "level_code[VAR_1] = (VAR_3 << 1) | 1;", "level_bits[VAR_1] = 2;", "} else if (VAR_2 >= 2 && VAR_2 <= 5) {", "level_code[VAR_1] = ((VAR_2 - 2) << 3) | (VAR_3 << 2) | 2;", "level_bits[VAR_1] = 5;", "} else {", "level_code[VAR_1] = VAR_1 << 2;", "level_bits[VAR_1] = 10;", "}", "}", "INIT_LE_VLC_STATIC(&ff_dc_alpha_level_vlc_le, ALPHA_VLC_BITS, 256,\nlevel_bits, 1, 1,\nlevel_code, 2, 2, 288);", "}" ]
[ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 47 ], [ 49 ], [ 53, 55, 57 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 85 ], [ 87 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 109, 111, 113 ], [ 115 ] ]
2,323
static void pci_info_device(PCIBus *bus, PCIDevice *d) { Monitor *mon = cur_mon; int i, class; PCIIORegion *r; const pci_class_desc *desc; monitor_printf(mon, " Bus %2d, device %3d, function %d:\n", pci_bus_num(d->bus), PCI_SLOT(d->devfn), PCI_FUNC(d->devfn)); class = pci_get_word(d->config + PCI_CLASS_DEVICE); monitor_printf(mon, " "); desc = pci_class_descriptions; while (desc->desc && class != desc->class) desc++; if (desc->desc) { monitor_printf(mon, "%s", desc->desc); } else { monitor_printf(mon, "Class %04x", class); } monitor_printf(mon, ": PCI device %04x:%04x\n", pci_get_word(d->config + PCI_VENDOR_ID), pci_get_word(d->config + PCI_DEVICE_ID)); if (d->config[PCI_INTERRUPT_PIN] != 0) { monitor_printf(mon, " IRQ %d.\n", d->config[PCI_INTERRUPT_LINE]); } if (class == 0x0604) { uint64_t base; uint64_t limit; monitor_printf(mon, " BUS %d.\n", d->config[0x19]); monitor_printf(mon, " secondary bus %d.\n", d->config[PCI_SECONDARY_BUS]); monitor_printf(mon, " subordinate bus %d.\n", d->config[PCI_SUBORDINATE_BUS]); base = pci_bridge_get_base(d, PCI_BASE_ADDRESS_SPACE_IO); limit = pci_bridge_get_limit(d, PCI_BASE_ADDRESS_SPACE_IO); monitor_printf(mon, " IO range [0x%04"PRIx64", 0x%04"PRIx64"]\n", base, limit); base = pci_bridge_get_base(d, PCI_BASE_ADDRESS_SPACE_MEMORY); limit= pci_config_get_memory_base(d, PCI_BASE_ADDRESS_SPACE_MEMORY); monitor_printf(mon, " memory range [0x%08"PRIx64", 0x%08"PRIx64"]\n", base, limit); base = pci_bridge_get_base(d, PCI_BASE_ADDRESS_SPACE_MEMORY | PCI_BASE_ADDRESS_MEM_PREFETCH); limit = pci_bridge_get_limit(d, PCI_BASE_ADDRESS_SPACE_MEMORY | PCI_BASE_ADDRESS_MEM_PREFETCH); monitor_printf(mon, " prefetchable memory range " "[0x%08"PRIx64", 0x%08"PRIx64"]\n", base, limit); } for(i = 0;i < PCI_NUM_REGIONS; i++) { r = &d->io_regions[i]; if (r->size != 0) { monitor_printf(mon, " BAR%d: ", i); if (r->type & PCI_BASE_ADDRESS_SPACE_IO) { monitor_printf(mon, "I/O at 0x%04"FMT_PCIBUS " [0x%04"FMT_PCIBUS"].\n", r->addr, r->addr + r->size - 1); } else { const char *type = r->type & PCI_BASE_ADDRESS_MEM_TYPE_64 ? "64 bit" : "32 bit"; const char *prefetch = r->type & PCI_BASE_ADDRESS_MEM_PREFETCH ? " prefetchable" : ""; monitor_printf(mon, "%s%s memory at 0x%08"FMT_PCIBUS " [0x%08"FMT_PCIBUS"].\n", type, prefetch, r->addr, r->addr + r->size - 1); } } } monitor_printf(mon, " id \"%s\"\n", d->qdev.id ? d->qdev.id : ""); if (class == 0x0604 && d->config[0x19] != 0) { pci_for_each_device(bus, d->config[0x19], pci_info_device); } }
true
qemu
f88d7509b444ffa289e5054b34bc6f4800f6b76d
static void pci_info_device(PCIBus *bus, PCIDevice *d) { Monitor *mon = cur_mon; int i, class; PCIIORegion *r; const pci_class_desc *desc; monitor_printf(mon, " Bus %2d, device %3d, function %d:\n", pci_bus_num(d->bus), PCI_SLOT(d->devfn), PCI_FUNC(d->devfn)); class = pci_get_word(d->config + PCI_CLASS_DEVICE); monitor_printf(mon, " "); desc = pci_class_descriptions; while (desc->desc && class != desc->class) desc++; if (desc->desc) { monitor_printf(mon, "%s", desc->desc); } else { monitor_printf(mon, "Class %04x", class); } monitor_printf(mon, ": PCI device %04x:%04x\n", pci_get_word(d->config + PCI_VENDOR_ID), pci_get_word(d->config + PCI_DEVICE_ID)); if (d->config[PCI_INTERRUPT_PIN] != 0) { monitor_printf(mon, " IRQ %d.\n", d->config[PCI_INTERRUPT_LINE]); } if (class == 0x0604) { uint64_t base; uint64_t limit; monitor_printf(mon, " BUS %d.\n", d->config[0x19]); monitor_printf(mon, " secondary bus %d.\n", d->config[PCI_SECONDARY_BUS]); monitor_printf(mon, " subordinate bus %d.\n", d->config[PCI_SUBORDINATE_BUS]); base = pci_bridge_get_base(d, PCI_BASE_ADDRESS_SPACE_IO); limit = pci_bridge_get_limit(d, PCI_BASE_ADDRESS_SPACE_IO); monitor_printf(mon, " IO range [0x%04"PRIx64", 0x%04"PRIx64"]\n", base, limit); base = pci_bridge_get_base(d, PCI_BASE_ADDRESS_SPACE_MEMORY); limit= pci_config_get_memory_base(d, PCI_BASE_ADDRESS_SPACE_MEMORY); monitor_printf(mon, " memory range [0x%08"PRIx64", 0x%08"PRIx64"]\n", base, limit); base = pci_bridge_get_base(d, PCI_BASE_ADDRESS_SPACE_MEMORY | PCI_BASE_ADDRESS_MEM_PREFETCH); limit = pci_bridge_get_limit(d, PCI_BASE_ADDRESS_SPACE_MEMORY | PCI_BASE_ADDRESS_MEM_PREFETCH); monitor_printf(mon, " prefetchable memory range " "[0x%08"PRIx64", 0x%08"PRIx64"]\n", base, limit); } for(i = 0;i < PCI_NUM_REGIONS; i++) { r = &d->io_regions[i]; if (r->size != 0) { monitor_printf(mon, " BAR%d: ", i); if (r->type & PCI_BASE_ADDRESS_SPACE_IO) { monitor_printf(mon, "I/O at 0x%04"FMT_PCIBUS " [0x%04"FMT_PCIBUS"].\n", r->addr, r->addr + r->size - 1); } else { const char *type = r->type & PCI_BASE_ADDRESS_MEM_TYPE_64 ? "64 bit" : "32 bit"; const char *prefetch = r->type & PCI_BASE_ADDRESS_MEM_PREFETCH ? " prefetchable" : ""; monitor_printf(mon, "%s%s memory at 0x%08"FMT_PCIBUS " [0x%08"FMT_PCIBUS"].\n", type, prefetch, r->addr, r->addr + r->size - 1); } } } monitor_printf(mon, " id \"%s\"\n", d->qdev.id ? d->qdev.id : ""); if (class == 0x0604 && d->config[0x19] != 0) { pci_for_each_device(bus, d->config[0x19], pci_info_device); } }
{ "code": [ " limit= pci_config_get_memory_base(d, PCI_BASE_ADDRESS_SPACE_MEMORY);" ], "line_no": [ 89 ] }
static void FUNC_0(PCIBus *VAR_0, PCIDevice *VAR_1) { Monitor *mon = cur_mon; int VAR_2, VAR_3; PCIIORegion *r; const pci_class_desc *VAR_4; monitor_printf(mon, " Bus %2d, device %3d, function %VAR_1:\n", pci_bus_num(VAR_1->VAR_0), PCI_SLOT(VAR_1->devfn), PCI_FUNC(VAR_1->devfn)); VAR_3 = pci_get_word(VAR_1->config + PCI_CLASS_DEVICE); monitor_printf(mon, " "); VAR_4 = pci_class_descriptions; while (VAR_4->VAR_4 && VAR_3 != VAR_4->VAR_3) VAR_4++; if (VAR_4->VAR_4) { monitor_printf(mon, "%s", VAR_4->VAR_4); } else { monitor_printf(mon, "Class %04x", VAR_3); } monitor_printf(mon, ": PCI device %04x:%04x\n", pci_get_word(VAR_1->config + PCI_VENDOR_ID), pci_get_word(VAR_1->config + PCI_DEVICE_ID)); if (VAR_1->config[PCI_INTERRUPT_PIN] != 0) { monitor_printf(mon, " IRQ %VAR_1.\n", VAR_1->config[PCI_INTERRUPT_LINE]); } if (VAR_3 == 0x0604) { uint64_t base; uint64_t limit; monitor_printf(mon, " BUS %VAR_1.\n", VAR_1->config[0x19]); monitor_printf(mon, " secondary VAR_0 %VAR_1.\n", VAR_1->config[PCI_SECONDARY_BUS]); monitor_printf(mon, " subordinate VAR_0 %VAR_1.\n", VAR_1->config[PCI_SUBORDINATE_BUS]); base = pci_bridge_get_base(VAR_1, PCI_BASE_ADDRESS_SPACE_IO); limit = pci_bridge_get_limit(VAR_1, PCI_BASE_ADDRESS_SPACE_IO); monitor_printf(mon, " IO range [0x%04"PRIx64", 0x%04"PRIx64"]\n", base, limit); base = pci_bridge_get_base(VAR_1, PCI_BASE_ADDRESS_SPACE_MEMORY); limit= pci_config_get_memory_base(VAR_1, PCI_BASE_ADDRESS_SPACE_MEMORY); monitor_printf(mon, " memory range [0x%08"PRIx64", 0x%08"PRIx64"]\n", base, limit); base = pci_bridge_get_base(VAR_1, PCI_BASE_ADDRESS_SPACE_MEMORY | PCI_BASE_ADDRESS_MEM_PREFETCH); limit = pci_bridge_get_limit(VAR_1, PCI_BASE_ADDRESS_SPACE_MEMORY | PCI_BASE_ADDRESS_MEM_PREFETCH); monitor_printf(mon, " prefetchable memory range " "[0x%08"PRIx64", 0x%08"PRIx64"]\n", base, limit); } for(VAR_2 = 0;VAR_2 < PCI_NUM_REGIONS; VAR_2++) { r = &VAR_1->io_regions[VAR_2]; if (r->size != 0) { monitor_printf(mon, " BAR%VAR_1: ", VAR_2); if (r->type & PCI_BASE_ADDRESS_SPACE_IO) { monitor_printf(mon, "I/O at 0x%04"FMT_PCIBUS " [0x%04"FMT_PCIBUS"].\n", r->addr, r->addr + r->size - 1); } else { const char *type = r->type & PCI_BASE_ADDRESS_MEM_TYPE_64 ? "64 bit" : "32 bit"; const char *prefetch = r->type & PCI_BASE_ADDRESS_MEM_PREFETCH ? " prefetchable" : ""; monitor_printf(mon, "%s%s memory at 0x%08"FMT_PCIBUS " [0x%08"FMT_PCIBUS"].\n", type, prefetch, r->addr, r->addr + r->size - 1); } } } monitor_printf(mon, " id \"%s\"\n", VAR_1->qdev.id ? VAR_1->qdev.id : ""); if (VAR_3 == 0x0604 && VAR_1->config[0x19] != 0) { pci_for_each_device(VAR_0, VAR_1->config[0x19], FUNC_0); } }
[ "static void FUNC_0(PCIBus *VAR_0, PCIDevice *VAR_1)\n{", "Monitor *mon = cur_mon;", "int VAR_2, VAR_3;", "PCIIORegion *r;", "const pci_class_desc *VAR_4;", "monitor_printf(mon, \" Bus %2d, device %3d, function %VAR_1:\\n\",\npci_bus_num(VAR_1->VAR_0),\nPCI_SLOT(VAR_1->devfn), PCI_FUNC(VAR_1->devfn));", "VAR_3 = pci_get_word(VAR_1->config + PCI_CLASS_DEVICE);", "monitor_printf(mon, \" \");", "VAR_4 = pci_class_descriptions;", "while (VAR_4->VAR_4 && VAR_3 != VAR_4->VAR_3)\nVAR_4++;", "if (VAR_4->VAR_4) {", "monitor_printf(mon, \"%s\", VAR_4->VAR_4);", "} else {", "monitor_printf(mon, \"Class %04x\", VAR_3);", "}", "monitor_printf(mon, \": PCI device %04x:%04x\\n\",\npci_get_word(VAR_1->config + PCI_VENDOR_ID),\npci_get_word(VAR_1->config + PCI_DEVICE_ID));", "if (VAR_1->config[PCI_INTERRUPT_PIN] != 0) {", "monitor_printf(mon, \" IRQ %VAR_1.\\n\",\nVAR_1->config[PCI_INTERRUPT_LINE]);", "}", "if (VAR_3 == 0x0604) {", "uint64_t base;", "uint64_t limit;", "monitor_printf(mon, \" BUS %VAR_1.\\n\", VAR_1->config[0x19]);", "monitor_printf(mon, \" secondary VAR_0 %VAR_1.\\n\",\nVAR_1->config[PCI_SECONDARY_BUS]);", "monitor_printf(mon, \" subordinate VAR_0 %VAR_1.\\n\",\nVAR_1->config[PCI_SUBORDINATE_BUS]);", "base = pci_bridge_get_base(VAR_1, PCI_BASE_ADDRESS_SPACE_IO);", "limit = pci_bridge_get_limit(VAR_1, PCI_BASE_ADDRESS_SPACE_IO);", "monitor_printf(mon, \" IO range [0x%04\"PRIx64\", 0x%04\"PRIx64\"]\\n\",\nbase, limit);", "base = pci_bridge_get_base(VAR_1, PCI_BASE_ADDRESS_SPACE_MEMORY);", "limit= pci_config_get_memory_base(VAR_1, PCI_BASE_ADDRESS_SPACE_MEMORY);", "monitor_printf(mon,\n\" memory range [0x%08\"PRIx64\", 0x%08\"PRIx64\"]\\n\",\nbase, limit);", "base = pci_bridge_get_base(VAR_1, PCI_BASE_ADDRESS_SPACE_MEMORY |\nPCI_BASE_ADDRESS_MEM_PREFETCH);", "limit = pci_bridge_get_limit(VAR_1, PCI_BASE_ADDRESS_SPACE_MEMORY |\nPCI_BASE_ADDRESS_MEM_PREFETCH);", "monitor_printf(mon, \" prefetchable memory range \"\n\"[0x%08\"PRIx64\", 0x%08\"PRIx64\"]\\n\", base, limit);", "}", "for(VAR_2 = 0;VAR_2 < PCI_NUM_REGIONS; VAR_2++) {", "r = &VAR_1->io_regions[VAR_2];", "if (r->size != 0) {", "monitor_printf(mon, \" BAR%VAR_1: \", VAR_2);", "if (r->type & PCI_BASE_ADDRESS_SPACE_IO) {", "monitor_printf(mon, \"I/O at 0x%04\"FMT_PCIBUS\n\" [0x%04\"FMT_PCIBUS\"].\\n\",\nr->addr, r->addr + r->size - 1);", "} else {", "const char *type = r->type & PCI_BASE_ADDRESS_MEM_TYPE_64 ?\n\"64 bit\" : \"32 bit\";", "const char *prefetch =\nr->type & PCI_BASE_ADDRESS_MEM_PREFETCH ?\n\" prefetchable\" : \"\";", "monitor_printf(mon, \"%s%s memory at 0x%08\"FMT_PCIBUS\n\" [0x%08\"FMT_PCIBUS\"].\\n\",\ntype, prefetch,\nr->addr, r->addr + r->size - 1);", "}", "}", "}", "monitor_printf(mon, \" id \\\"%s\\\"\\n\", VAR_1->qdev.id ? VAR_1->qdev.id : \"\");", "if (VAR_3 == 0x0604 && VAR_1->config[0x19] != 0) {", "pci_for_each_device(VAR_0, VAR_1->config[0x19], FUNC_0);", "}", "}" ]
[ 0, 0, 0, 0, 0, 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15, 17, 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41, 43, 45 ], [ 49 ], [ 51, 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67, 69 ], [ 71, 73 ], [ 77 ], [ 79 ], [ 81, 83 ], [ 87 ], [ 89 ], [ 91, 93, 95 ], [ 99, 101 ], [ 103, 105 ], [ 107, 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123, 125, 127 ], [ 129 ], [ 131, 133 ], [ 135, 137, 139 ], [ 143, 145, 147, 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ] ]
2,324
int av_write_frame(AVFormatContext *s, AVPacket *pkt) { int ret; compute_pkt_fields2(s->streams[pkt->stream_index], pkt); truncate_ts(s->streams[pkt->stream_index], pkt); ret= s->oformat->write_packet(s, pkt); if(!ret) ret= url_ferror(&s->pb); return ret; }
true
FFmpeg
5edea431d0616737e5a5f58cefc07ba5b2e0875f
int av_write_frame(AVFormatContext *s, AVPacket *pkt) { int ret; compute_pkt_fields2(s->streams[pkt->stream_index], pkt); truncate_ts(s->streams[pkt->stream_index], pkt); ret= s->oformat->write_packet(s, pkt); if(!ret) ret= url_ferror(&s->pb); return ret; }
{ "code": [ " compute_pkt_fields2(s->streams[pkt->stream_index], pkt);" ], "line_no": [ 9 ] }
int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1) { int VAR_2; compute_pkt_fields2(VAR_0->streams[VAR_1->stream_index], VAR_1); truncate_ts(VAR_0->streams[VAR_1->stream_index], VAR_1); VAR_2= VAR_0->oformat->write_packet(VAR_0, VAR_1); if(!VAR_2) VAR_2= url_ferror(&VAR_0->pb); return VAR_2; }
[ "int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1)\n{", "int VAR_2;", "compute_pkt_fields2(VAR_0->streams[VAR_1->stream_index], VAR_1);", "truncate_ts(VAR_0->streams[VAR_1->stream_index], VAR_1);", "VAR_2= VAR_0->oformat->write_packet(VAR_0, VAR_1);", "if(!VAR_2)\nVAR_2= url_ferror(&VAR_0->pb);", "return VAR_2;", "}" ]
[ 0, 0, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 13 ], [ 17 ], [ 19, 21 ], [ 23 ], [ 25 ] ]
2,327
static void revert_cdlms(WmallDecodeCtx *s, int tile_size) { int icoef, ich; int32_t pred, channel_coeff; int ilms, num_lms; for (ich = 0; ich < s->num_channels; ich++) { if (!s->is_channel_coded[ich]) continue; for (icoef = 0; icoef < tile_size; icoef++) { num_lms = s->cdlms_ttl[ich]; channel_coeff = s->channel_residues[ich][icoef]; if (icoef == s->transient_pos[ich]) { s->transient[ich] = 1; use_high_update_speed(s, ich); } for (ilms = num_lms; ilms >= 0; ilms--) { pred = lms_predict(s, ich, ilms); channel_coeff += pred; lms_update(s, ich, ilms, channel_coeff, pred); } if (s->transient[ich]) { --s->channel[ich].transient_counter; if(!s->channel[ich].transient_counter) use_normal_update_speed(s, ich); } s->channel_coeffs[ich][icoef] = channel_coeff; } } }
true
FFmpeg
6cf31ef263d36f6b89d9b64f15ca81cef4f24901
static void revert_cdlms(WmallDecodeCtx *s, int tile_size) { int icoef, ich; int32_t pred, channel_coeff; int ilms, num_lms; for (ich = 0; ich < s->num_channels; ich++) { if (!s->is_channel_coded[ich]) continue; for (icoef = 0; icoef < tile_size; icoef++) { num_lms = s->cdlms_ttl[ich]; channel_coeff = s->channel_residues[ich][icoef]; if (icoef == s->transient_pos[ich]) { s->transient[ich] = 1; use_high_update_speed(s, ich); } for (ilms = num_lms; ilms >= 0; ilms--) { pred = lms_predict(s, ich, ilms); channel_coeff += pred; lms_update(s, ich, ilms, channel_coeff, pred); } if (s->transient[ich]) { --s->channel[ich].transient_counter; if(!s->channel[ich].transient_counter) use_normal_update_speed(s, ich); } s->channel_coeffs[ich][icoef] = channel_coeff; } } }
{ "code": [ " for (ilms = num_lms; ilms >= 0; ilms--) {" ], "line_no": [ 33 ] }
static void FUNC_0(WmallDecodeCtx *VAR_0, int VAR_1) { int VAR_2, VAR_3; int32_t pred, channel_coeff; int VAR_4, VAR_5; for (VAR_3 = 0; VAR_3 < VAR_0->num_channels; VAR_3++) { if (!VAR_0->is_channel_coded[VAR_3]) continue; for (VAR_2 = 0; VAR_2 < VAR_1; VAR_2++) { VAR_5 = VAR_0->cdlms_ttl[VAR_3]; channel_coeff = VAR_0->channel_residues[VAR_3][VAR_2]; if (VAR_2 == VAR_0->transient_pos[VAR_3]) { VAR_0->transient[VAR_3] = 1; use_high_update_speed(VAR_0, VAR_3); } for (VAR_4 = VAR_5; VAR_4 >= 0; VAR_4--) { pred = lms_predict(VAR_0, VAR_3, VAR_4); channel_coeff += pred; lms_update(VAR_0, VAR_3, VAR_4, channel_coeff, pred); } if (VAR_0->transient[VAR_3]) { --VAR_0->channel[VAR_3].transient_counter; if(!VAR_0->channel[VAR_3].transient_counter) use_normal_update_speed(VAR_0, VAR_3); } VAR_0->channel_coeffs[VAR_3][VAR_2] = channel_coeff; } } }
[ "static void FUNC_0(WmallDecodeCtx *VAR_0, int VAR_1)\n{", "int VAR_2, VAR_3;", "int32_t pred, channel_coeff;", "int VAR_4, VAR_5;", "for (VAR_3 = 0; VAR_3 < VAR_0->num_channels; VAR_3++) {", "if (!VAR_0->is_channel_coded[VAR_3])\ncontinue;", "for (VAR_2 = 0; VAR_2 < VAR_1; VAR_2++) {", "VAR_5 = VAR_0->cdlms_ttl[VAR_3];", "channel_coeff = VAR_0->channel_residues[VAR_3][VAR_2];", "if (VAR_2 == VAR_0->transient_pos[VAR_3]) {", "VAR_0->transient[VAR_3] = 1;", "use_high_update_speed(VAR_0, VAR_3);", "}", "for (VAR_4 = VAR_5; VAR_4 >= 0; VAR_4--) {", "pred = lms_predict(VAR_0, VAR_3, VAR_4);", "channel_coeff += pred;", "lms_update(VAR_0, VAR_3, VAR_4, channel_coeff, pred);", "}", "if (VAR_0->transient[VAR_3]) {", "--VAR_0->channel[VAR_3].transient_counter;", "if(!VAR_0->channel[VAR_3].transient_counter)\nuse_normal_update_speed(VAR_0, VAR_3);", "}", "VAR_0->channel_coeffs[VAR_3][VAR_2] = channel_coeff;", "}", "}", "}" ]
[ 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 ], [ 13 ], [ 15, 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47, 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ] ]
2,331
static void decode_mb_b(AVSContext *h, enum cavs_mb mb_type) { int block; enum cavs_sub_mb sub_type[4]; int flags; ff_cavs_init_mb(h); /* reset all MVs */ h->mv[MV_FWD_X0] = ff_cavs_dir_mv; set_mvs(&h->mv[MV_FWD_X0], BLK_16X16); h->mv[MV_BWD_X0] = ff_cavs_dir_mv; set_mvs(&h->mv[MV_BWD_X0], BLK_16X16); switch(mb_type) { case B_SKIP: case B_DIRECT: if(!h->col_type_base[h->mbidx]) { /* intra MB at co-location, do in-plane prediction */ ff_cavs_mv(h, MV_FWD_X0, MV_FWD_C2, MV_PRED_BSKIP, BLK_16X16, 1); ff_cavs_mv(h, MV_BWD_X0, MV_BWD_C2, MV_PRED_BSKIP, BLK_16X16, 0); } else /* direct prediction from co-located P MB, block-wise */ for(block=0;block<4;block++) mv_pred_direct(h,&h->mv[mv_scan[block]], &h->col_mv[h->mbidx*4 + block]); break; case B_FWD_16X16: ff_cavs_mv(h, MV_FWD_X0, MV_FWD_C2, MV_PRED_MEDIAN, BLK_16X16, 1); break; case B_SYM_16X16: ff_cavs_mv(h, MV_FWD_X0, MV_FWD_C2, MV_PRED_MEDIAN, BLK_16X16, 1); mv_pred_sym(h, &h->mv[MV_FWD_X0], BLK_16X16); break; case B_BWD_16X16: ff_cavs_mv(h, MV_BWD_X0, MV_BWD_C2, MV_PRED_MEDIAN, BLK_16X16, 0); break; case B_8X8: for(block=0;block<4;block++) sub_type[block] = get_bits(&h->s.gb,2); for(block=0;block<4;block++) { switch(sub_type[block]) { case B_SUB_DIRECT: if(!h->col_type_base[h->mbidx]) { /* intra MB at co-location, do in-plane prediction */ ff_cavs_mv(h, mv_scan[block], mv_scan[block]-3, MV_PRED_BSKIP, BLK_8X8, 1); ff_cavs_mv(h, mv_scan[block]+MV_BWD_OFFS, mv_scan[block]-3+MV_BWD_OFFS, MV_PRED_BSKIP, BLK_8X8, 0); } else mv_pred_direct(h,&h->mv[mv_scan[block]], &h->col_mv[h->mbidx*4 + block]); break; case B_SUB_FWD: ff_cavs_mv(h, mv_scan[block], mv_scan[block]-3, MV_PRED_MEDIAN, BLK_8X8, 1); break; case B_SUB_SYM: ff_cavs_mv(h, mv_scan[block], mv_scan[block]-3, MV_PRED_MEDIAN, BLK_8X8, 1); mv_pred_sym(h, &h->mv[mv_scan[block]], BLK_8X8); break; } } for(block=0;block<4;block++) { if(sub_type[block] == B_SUB_BWD) ff_cavs_mv(h, mv_scan[block]+MV_BWD_OFFS, mv_scan[block]+MV_BWD_OFFS-3, MV_PRED_MEDIAN, BLK_8X8, 0); } break; default: av_assert2((mb_type > B_SYM_16X16) && (mb_type < B_8X8)); flags = ff_cavs_partition_flags[mb_type]; if(mb_type & 1) { /* 16x8 macroblock types */ if(flags & FWD0) ff_cavs_mv(h, MV_FWD_X0, MV_FWD_C2, MV_PRED_TOP, BLK_16X8, 1); if(flags & SYM0) mv_pred_sym(h, &h->mv[MV_FWD_X0], BLK_16X8); if(flags & FWD1) ff_cavs_mv(h, MV_FWD_X2, MV_FWD_A1, MV_PRED_LEFT, BLK_16X8, 1); if(flags & SYM1) mv_pred_sym(h, &h->mv[MV_FWD_X2], BLK_16X8); if(flags & BWD0) ff_cavs_mv(h, MV_BWD_X0, MV_BWD_C2, MV_PRED_TOP, BLK_16X8, 0); if(flags & BWD1) ff_cavs_mv(h, MV_BWD_X2, MV_BWD_A1, MV_PRED_LEFT, BLK_16X8, 0); } else { /* 8x16 macroblock types */ if(flags & FWD0) ff_cavs_mv(h, MV_FWD_X0, MV_FWD_B3, MV_PRED_LEFT, BLK_8X16, 1); if(flags & SYM0) mv_pred_sym(h, &h->mv[MV_FWD_X0], BLK_8X16); if(flags & FWD1) ff_cavs_mv(h,MV_FWD_X1,MV_FWD_C2,MV_PRED_TOPRIGHT,BLK_8X16,1); if(flags & SYM1) mv_pred_sym(h, &h->mv[MV_FWD_X1], BLK_8X16); if(flags & BWD0) ff_cavs_mv(h, MV_BWD_X0, MV_BWD_B3, MV_PRED_LEFT, BLK_8X16, 0); if(flags & BWD1) ff_cavs_mv(h,MV_BWD_X1,MV_BWD_C2,MV_PRED_TOPRIGHT,BLK_8X16,0); } } ff_cavs_inter(h, mb_type); set_intra_mode_default(h); if(mb_type != B_SKIP) decode_residual_inter(h); ff_cavs_filter(h,mb_type); }
true
FFmpeg
7ea5dbcb83a502d8152d5c64d32f9a16e7e907c7
static void decode_mb_b(AVSContext *h, enum cavs_mb mb_type) { int block; enum cavs_sub_mb sub_type[4]; int flags; ff_cavs_init_mb(h); h->mv[MV_FWD_X0] = ff_cavs_dir_mv; set_mvs(&h->mv[MV_FWD_X0], BLK_16X16); h->mv[MV_BWD_X0] = ff_cavs_dir_mv; set_mvs(&h->mv[MV_BWD_X0], BLK_16X16); switch(mb_type) { case B_SKIP: case B_DIRECT: if(!h->col_type_base[h->mbidx]) { ff_cavs_mv(h, MV_FWD_X0, MV_FWD_C2, MV_PRED_BSKIP, BLK_16X16, 1); ff_cavs_mv(h, MV_BWD_X0, MV_BWD_C2, MV_PRED_BSKIP, BLK_16X16, 0); } else for(block=0;block<4;block++) mv_pred_direct(h,&h->mv[mv_scan[block]], &h->col_mv[h->mbidx*4 + block]); break; case B_FWD_16X16: ff_cavs_mv(h, MV_FWD_X0, MV_FWD_C2, MV_PRED_MEDIAN, BLK_16X16, 1); break; case B_SYM_16X16: ff_cavs_mv(h, MV_FWD_X0, MV_FWD_C2, MV_PRED_MEDIAN, BLK_16X16, 1); mv_pred_sym(h, &h->mv[MV_FWD_X0], BLK_16X16); break; case B_BWD_16X16: ff_cavs_mv(h, MV_BWD_X0, MV_BWD_C2, MV_PRED_MEDIAN, BLK_16X16, 0); break; case B_8X8: for(block=0;block<4;block++) sub_type[block] = get_bits(&h->s.gb,2); for(block=0;block<4;block++) { switch(sub_type[block]) { case B_SUB_DIRECT: if(!h->col_type_base[h->mbidx]) { ff_cavs_mv(h, mv_scan[block], mv_scan[block]-3, MV_PRED_BSKIP, BLK_8X8, 1); ff_cavs_mv(h, mv_scan[block]+MV_BWD_OFFS, mv_scan[block]-3+MV_BWD_OFFS, MV_PRED_BSKIP, BLK_8X8, 0); } else mv_pred_direct(h,&h->mv[mv_scan[block]], &h->col_mv[h->mbidx*4 + block]); break; case B_SUB_FWD: ff_cavs_mv(h, mv_scan[block], mv_scan[block]-3, MV_PRED_MEDIAN, BLK_8X8, 1); break; case B_SUB_SYM: ff_cavs_mv(h, mv_scan[block], mv_scan[block]-3, MV_PRED_MEDIAN, BLK_8X8, 1); mv_pred_sym(h, &h->mv[mv_scan[block]], BLK_8X8); break; } } for(block=0;block<4;block++) { if(sub_type[block] == B_SUB_BWD) ff_cavs_mv(h, mv_scan[block]+MV_BWD_OFFS, mv_scan[block]+MV_BWD_OFFS-3, MV_PRED_MEDIAN, BLK_8X8, 0); } break; default: av_assert2((mb_type > B_SYM_16X16) && (mb_type < B_8X8)); flags = ff_cavs_partition_flags[mb_type]; if(mb_type & 1) { if(flags & FWD0) ff_cavs_mv(h, MV_FWD_X0, MV_FWD_C2, MV_PRED_TOP, BLK_16X8, 1); if(flags & SYM0) mv_pred_sym(h, &h->mv[MV_FWD_X0], BLK_16X8); if(flags & FWD1) ff_cavs_mv(h, MV_FWD_X2, MV_FWD_A1, MV_PRED_LEFT, BLK_16X8, 1); if(flags & SYM1) mv_pred_sym(h, &h->mv[MV_FWD_X2], BLK_16X8); if(flags & BWD0) ff_cavs_mv(h, MV_BWD_X0, MV_BWD_C2, MV_PRED_TOP, BLK_16X8, 0); if(flags & BWD1) ff_cavs_mv(h, MV_BWD_X2, MV_BWD_A1, MV_PRED_LEFT, BLK_16X8, 0); } else { if(flags & FWD0) ff_cavs_mv(h, MV_FWD_X0, MV_FWD_B3, MV_PRED_LEFT, BLK_8X16, 1); if(flags & SYM0) mv_pred_sym(h, &h->mv[MV_FWD_X0], BLK_8X16); if(flags & FWD1) ff_cavs_mv(h,MV_FWD_X1,MV_FWD_C2,MV_PRED_TOPRIGHT,BLK_8X16,1); if(flags & SYM1) mv_pred_sym(h, &h->mv[MV_FWD_X1], BLK_8X16); if(flags & BWD0) ff_cavs_mv(h, MV_BWD_X0, MV_BWD_B3, MV_PRED_LEFT, BLK_8X16, 0); if(flags & BWD1) ff_cavs_mv(h,MV_BWD_X1,MV_BWD_C2,MV_PRED_TOPRIGHT,BLK_8X16,0); } } ff_cavs_inter(h, mb_type); set_intra_mode_default(h); if(mb_type != B_SKIP) decode_residual_inter(h); ff_cavs_filter(h,mb_type); }
{ "code": [ " av_assert2((mb_type > B_SYM_16X16) && (mb_type < B_8X8));" ], "line_no": [ 143 ] }
static void FUNC_0(AVSContext *VAR_0, enum cavs_mb VAR_1) { int VAR_2; enum cavs_sub_mb VAR_3[4]; int VAR_4; ff_cavs_init_mb(VAR_0); VAR_0->mv[MV_FWD_X0] = ff_cavs_dir_mv; set_mvs(&VAR_0->mv[MV_FWD_X0], BLK_16X16); VAR_0->mv[MV_BWD_X0] = ff_cavs_dir_mv; set_mvs(&VAR_0->mv[MV_BWD_X0], BLK_16X16); switch(VAR_1) { case B_SKIP: case B_DIRECT: if(!VAR_0->col_type_base[VAR_0->mbidx]) { ff_cavs_mv(VAR_0, MV_FWD_X0, MV_FWD_C2, MV_PRED_BSKIP, BLK_16X16, 1); ff_cavs_mv(VAR_0, MV_BWD_X0, MV_BWD_C2, MV_PRED_BSKIP, BLK_16X16, 0); } else for(VAR_2=0;VAR_2<4;VAR_2++) mv_pred_direct(VAR_0,&VAR_0->mv[mv_scan[VAR_2]], &VAR_0->col_mv[VAR_0->mbidx*4 + VAR_2]); break; case B_FWD_16X16: ff_cavs_mv(VAR_0, MV_FWD_X0, MV_FWD_C2, MV_PRED_MEDIAN, BLK_16X16, 1); break; case B_SYM_16X16: ff_cavs_mv(VAR_0, MV_FWD_X0, MV_FWD_C2, MV_PRED_MEDIAN, BLK_16X16, 1); mv_pred_sym(VAR_0, &VAR_0->mv[MV_FWD_X0], BLK_16X16); break; case B_BWD_16X16: ff_cavs_mv(VAR_0, MV_BWD_X0, MV_BWD_C2, MV_PRED_MEDIAN, BLK_16X16, 0); break; case B_8X8: for(VAR_2=0;VAR_2<4;VAR_2++) VAR_3[VAR_2] = get_bits(&VAR_0->s.gb,2); for(VAR_2=0;VAR_2<4;VAR_2++) { switch(VAR_3[VAR_2]) { case B_SUB_DIRECT: if(!VAR_0->col_type_base[VAR_0->mbidx]) { ff_cavs_mv(VAR_0, mv_scan[VAR_2], mv_scan[VAR_2]-3, MV_PRED_BSKIP, BLK_8X8, 1); ff_cavs_mv(VAR_0, mv_scan[VAR_2]+MV_BWD_OFFS, mv_scan[VAR_2]-3+MV_BWD_OFFS, MV_PRED_BSKIP, BLK_8X8, 0); } else mv_pred_direct(VAR_0,&VAR_0->mv[mv_scan[VAR_2]], &VAR_0->col_mv[VAR_0->mbidx*4 + VAR_2]); break; case B_SUB_FWD: ff_cavs_mv(VAR_0, mv_scan[VAR_2], mv_scan[VAR_2]-3, MV_PRED_MEDIAN, BLK_8X8, 1); break; case B_SUB_SYM: ff_cavs_mv(VAR_0, mv_scan[VAR_2], mv_scan[VAR_2]-3, MV_PRED_MEDIAN, BLK_8X8, 1); mv_pred_sym(VAR_0, &VAR_0->mv[mv_scan[VAR_2]], BLK_8X8); break; } } for(VAR_2=0;VAR_2<4;VAR_2++) { if(VAR_3[VAR_2] == B_SUB_BWD) ff_cavs_mv(VAR_0, mv_scan[VAR_2]+MV_BWD_OFFS, mv_scan[VAR_2]+MV_BWD_OFFS-3, MV_PRED_MEDIAN, BLK_8X8, 0); } break; default: av_assert2((VAR_1 > B_SYM_16X16) && (VAR_1 < B_8X8)); VAR_4 = ff_cavs_partition_flags[VAR_1]; if(VAR_1 & 1) { if(VAR_4 & FWD0) ff_cavs_mv(VAR_0, MV_FWD_X0, MV_FWD_C2, MV_PRED_TOP, BLK_16X8, 1); if(VAR_4 & SYM0) mv_pred_sym(VAR_0, &VAR_0->mv[MV_FWD_X0], BLK_16X8); if(VAR_4 & FWD1) ff_cavs_mv(VAR_0, MV_FWD_X2, MV_FWD_A1, MV_PRED_LEFT, BLK_16X8, 1); if(VAR_4 & SYM1) mv_pred_sym(VAR_0, &VAR_0->mv[MV_FWD_X2], BLK_16X8); if(VAR_4 & BWD0) ff_cavs_mv(VAR_0, MV_BWD_X0, MV_BWD_C2, MV_PRED_TOP, BLK_16X8, 0); if(VAR_4 & BWD1) ff_cavs_mv(VAR_0, MV_BWD_X2, MV_BWD_A1, MV_PRED_LEFT, BLK_16X8, 0); } else { if(VAR_4 & FWD0) ff_cavs_mv(VAR_0, MV_FWD_X0, MV_FWD_B3, MV_PRED_LEFT, BLK_8X16, 1); if(VAR_4 & SYM0) mv_pred_sym(VAR_0, &VAR_0->mv[MV_FWD_X0], BLK_8X16); if(VAR_4 & FWD1) ff_cavs_mv(VAR_0,MV_FWD_X1,MV_FWD_C2,MV_PRED_TOPRIGHT,BLK_8X16,1); if(VAR_4 & SYM1) mv_pred_sym(VAR_0, &VAR_0->mv[MV_FWD_X1], BLK_8X16); if(VAR_4 & BWD0) ff_cavs_mv(VAR_0, MV_BWD_X0, MV_BWD_B3, MV_PRED_LEFT, BLK_8X16, 0); if(VAR_4 & BWD1) ff_cavs_mv(VAR_0,MV_BWD_X1,MV_BWD_C2,MV_PRED_TOPRIGHT,BLK_8X16,0); } } ff_cavs_inter(VAR_0, VAR_1); set_intra_mode_default(VAR_0); if(VAR_1 != B_SKIP) decode_residual_inter(VAR_0); ff_cavs_filter(VAR_0,VAR_1); }
[ "static void FUNC_0(AVSContext *VAR_0, enum cavs_mb VAR_1) {", "int VAR_2;", "enum cavs_sub_mb VAR_3[4];", "int VAR_4;", "ff_cavs_init_mb(VAR_0);", "VAR_0->mv[MV_FWD_X0] = ff_cavs_dir_mv;", "set_mvs(&VAR_0->mv[MV_FWD_X0], BLK_16X16);", "VAR_0->mv[MV_BWD_X0] = ff_cavs_dir_mv;", "set_mvs(&VAR_0->mv[MV_BWD_X0], BLK_16X16);", "switch(VAR_1) {", "case B_SKIP:\ncase B_DIRECT:\nif(!VAR_0->col_type_base[VAR_0->mbidx]) {", "ff_cavs_mv(VAR_0, MV_FWD_X0, MV_FWD_C2, MV_PRED_BSKIP, BLK_16X16, 1);", "ff_cavs_mv(VAR_0, MV_BWD_X0, MV_BWD_C2, MV_PRED_BSKIP, BLK_16X16, 0);", "} else", "for(VAR_2=0;VAR_2<4;VAR_2++)", "mv_pred_direct(VAR_0,&VAR_0->mv[mv_scan[VAR_2]],\n&VAR_0->col_mv[VAR_0->mbidx*4 + VAR_2]);", "break;", "case B_FWD_16X16:\nff_cavs_mv(VAR_0, MV_FWD_X0, MV_FWD_C2, MV_PRED_MEDIAN, BLK_16X16, 1);", "break;", "case B_SYM_16X16:\nff_cavs_mv(VAR_0, MV_FWD_X0, MV_FWD_C2, MV_PRED_MEDIAN, BLK_16X16, 1);", "mv_pred_sym(VAR_0, &VAR_0->mv[MV_FWD_X0], BLK_16X16);", "break;", "case B_BWD_16X16:\nff_cavs_mv(VAR_0, MV_BWD_X0, MV_BWD_C2, MV_PRED_MEDIAN, BLK_16X16, 0);", "break;", "case B_8X8:\nfor(VAR_2=0;VAR_2<4;VAR_2++)", "VAR_3[VAR_2] = get_bits(&VAR_0->s.gb,2);", "for(VAR_2=0;VAR_2<4;VAR_2++) {", "switch(VAR_3[VAR_2]) {", "case B_SUB_DIRECT:\nif(!VAR_0->col_type_base[VAR_0->mbidx]) {", "ff_cavs_mv(VAR_0, mv_scan[VAR_2], mv_scan[VAR_2]-3,\nMV_PRED_BSKIP, BLK_8X8, 1);", "ff_cavs_mv(VAR_0, mv_scan[VAR_2]+MV_BWD_OFFS,\nmv_scan[VAR_2]-3+MV_BWD_OFFS,\nMV_PRED_BSKIP, BLK_8X8, 0);", "} else", "mv_pred_direct(VAR_0,&VAR_0->mv[mv_scan[VAR_2]],\n&VAR_0->col_mv[VAR_0->mbidx*4 + VAR_2]);", "break;", "case B_SUB_FWD:\nff_cavs_mv(VAR_0, mv_scan[VAR_2], mv_scan[VAR_2]-3,\nMV_PRED_MEDIAN, BLK_8X8, 1);", "break;", "case B_SUB_SYM:\nff_cavs_mv(VAR_0, mv_scan[VAR_2], mv_scan[VAR_2]-3,\nMV_PRED_MEDIAN, BLK_8X8, 1);", "mv_pred_sym(VAR_0, &VAR_0->mv[mv_scan[VAR_2]], BLK_8X8);", "break;", "}", "}", "for(VAR_2=0;VAR_2<4;VAR_2++) {", "if(VAR_3[VAR_2] == B_SUB_BWD)\nff_cavs_mv(VAR_0, mv_scan[VAR_2]+MV_BWD_OFFS,\nmv_scan[VAR_2]+MV_BWD_OFFS-3,\nMV_PRED_MEDIAN, BLK_8X8, 0);", "}", "break;", "default:\nav_assert2((VAR_1 > B_SYM_16X16) && (VAR_1 < B_8X8));", "VAR_4 = ff_cavs_partition_flags[VAR_1];", "if(VAR_1 & 1) {", "if(VAR_4 & FWD0)\nff_cavs_mv(VAR_0, MV_FWD_X0, MV_FWD_C2, MV_PRED_TOP, BLK_16X8, 1);", "if(VAR_4 & SYM0)\nmv_pred_sym(VAR_0, &VAR_0->mv[MV_FWD_X0], BLK_16X8);", "if(VAR_4 & FWD1)\nff_cavs_mv(VAR_0, MV_FWD_X2, MV_FWD_A1, MV_PRED_LEFT, BLK_16X8, 1);", "if(VAR_4 & SYM1)\nmv_pred_sym(VAR_0, &VAR_0->mv[MV_FWD_X2], BLK_16X8);", "if(VAR_4 & BWD0)\nff_cavs_mv(VAR_0, MV_BWD_X0, MV_BWD_C2, MV_PRED_TOP, BLK_16X8, 0);", "if(VAR_4 & BWD1)\nff_cavs_mv(VAR_0, MV_BWD_X2, MV_BWD_A1, MV_PRED_LEFT, BLK_16X8, 0);", "} else {", "if(VAR_4 & FWD0)\nff_cavs_mv(VAR_0, MV_FWD_X0, MV_FWD_B3, MV_PRED_LEFT, BLK_8X16, 1);", "if(VAR_4 & SYM0)\nmv_pred_sym(VAR_0, &VAR_0->mv[MV_FWD_X0], BLK_8X16);", "if(VAR_4 & FWD1)\nff_cavs_mv(VAR_0,MV_FWD_X1,MV_FWD_C2,MV_PRED_TOPRIGHT,BLK_8X16,1);", "if(VAR_4 & SYM1)\nmv_pred_sym(VAR_0, &VAR_0->mv[MV_FWD_X1], BLK_8X16);", "if(VAR_4 & BWD0)\nff_cavs_mv(VAR_0, MV_BWD_X0, MV_BWD_B3, MV_PRED_LEFT, BLK_8X16, 0);", "if(VAR_4 & BWD1)\nff_cavs_mv(VAR_0,MV_BWD_X1,MV_BWD_C2,MV_PRED_TOPRIGHT,BLK_8X16,0);", "}", "}", "ff_cavs_inter(VAR_0, VAR_1);", "set_intra_mode_default(VAR_0);", "if(VAR_1 != B_SKIP)\ndecode_residual_inter(VAR_0);", "ff_cavs_filter(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, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 11 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27, 29, 31 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45, 47 ], [ 49 ], [ 51, 53 ], [ 55 ], [ 57, 59 ], [ 61 ], [ 63 ], [ 65, 67 ], [ 69 ], [ 71, 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81, 83 ], [ 87, 89 ], [ 91, 93, 95 ], [ 97 ], [ 99, 101 ], [ 103 ], [ 105, 107, 109 ], [ 111 ], [ 113, 115, 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129, 131, 133, 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 ] ]
2,332
static int transcode_audio(InputStream *ist, AVPacket *pkt, int *got_output) { AVFrame *decoded_frame; AVCodecContext *avctx = ist->st->codec; int bps = av_get_bytes_per_sample(ist->st->codec->sample_fmt); int i, ret; if (!ist->decoded_frame && !(ist->decoded_frame = avcodec_alloc_frame())) return AVERROR(ENOMEM); else avcodec_get_frame_defaults(ist->decoded_frame); decoded_frame = ist->decoded_frame; ret = avcodec_decode_audio4(avctx, decoded_frame, got_output, pkt); if (ret < 0) { return ret; } if (!*got_output) { /* no audio frame */ return ret; } /* if the decoder provides a pts, use it instead of the last packet pts. the decoder could be delaying output by a packet or more. */ if (decoded_frame->pts != AV_NOPTS_VALUE) ist->next_dts = decoded_frame->pts; /* increment next_dts to use for the case where the input stream does not have timestamps or there are multiple frames in the packet */ ist->next_dts += ((int64_t)AV_TIME_BASE * decoded_frame->nb_samples) / avctx->sample_rate; // preprocess audio (volume) if (audio_volume != 256) { int decoded_data_size = decoded_frame->nb_samples * avctx->channels * bps; void *samples = decoded_frame->data[0]; switch (avctx->sample_fmt) { case AV_SAMPLE_FMT_U8: { uint8_t *volp = samples; for (i = 0; i < (decoded_data_size / sizeof(*volp)); i++) { int v = (((*volp - 128) * audio_volume + 128) >> 8) + 128; *volp++ = av_clip_uint8(v); } break; } case AV_SAMPLE_FMT_S16: { int16_t *volp = samples; for (i = 0; i < (decoded_data_size / sizeof(*volp)); i++) { int v = ((*volp) * audio_volume + 128) >> 8; *volp++ = av_clip_int16(v); } break; } case AV_SAMPLE_FMT_S32: { int32_t *volp = samples; for (i = 0; i < (decoded_data_size / sizeof(*volp)); i++) { int64_t v = (((int64_t)*volp * audio_volume + 128) >> 8); *volp++ = av_clipl_int32(v); } break; } case AV_SAMPLE_FMT_FLT: { float *volp = samples; float scale = audio_volume / 256.f; for (i = 0; i < (decoded_data_size / sizeof(*volp)); i++) { *volp++ *= scale; } break; } case AV_SAMPLE_FMT_DBL: { double *volp = samples; double scale = audio_volume / 256.; for (i = 0; i < (decoded_data_size / sizeof(*volp)); i++) { *volp++ *= scale; } break; } default: av_log(NULL, AV_LOG_FATAL, "Audio volume adjustment on sample format %s is not supported.\n", av_get_sample_fmt_name(ist->st->codec->sample_fmt)); exit_program(1); } } rate_emu_sleep(ist); for (i = 0; i < nb_output_streams; i++) { OutputStream *ost = output_streams[i]; if (!check_output_constraints(ist, ost) || !ost->encoding_needed) continue; do_audio_out(output_files[ost->file_index]->ctx, ost, ist, decoded_frame); } return ret; }
true
FFmpeg
369cb092ecbbaff20bb0a2a1d60536c3bc04a8f0
static int transcode_audio(InputStream *ist, AVPacket *pkt, int *got_output) { AVFrame *decoded_frame; AVCodecContext *avctx = ist->st->codec; int bps = av_get_bytes_per_sample(ist->st->codec->sample_fmt); int i, ret; if (!ist->decoded_frame && !(ist->decoded_frame = avcodec_alloc_frame())) return AVERROR(ENOMEM); else avcodec_get_frame_defaults(ist->decoded_frame); decoded_frame = ist->decoded_frame; ret = avcodec_decode_audio4(avctx, decoded_frame, got_output, pkt); if (ret < 0) { return ret; } if (!*got_output) { return ret; } if (decoded_frame->pts != AV_NOPTS_VALUE) ist->next_dts = decoded_frame->pts; ist->next_dts += ((int64_t)AV_TIME_BASE * decoded_frame->nb_samples) / avctx->sample_rate; if (audio_volume != 256) { int decoded_data_size = decoded_frame->nb_samples * avctx->channels * bps; void *samples = decoded_frame->data[0]; switch (avctx->sample_fmt) { case AV_SAMPLE_FMT_U8: { uint8_t *volp = samples; for (i = 0; i < (decoded_data_size / sizeof(*volp)); i++) { int v = (((*volp - 128) * audio_volume + 128) >> 8) + 128; *volp++ = av_clip_uint8(v); } break; } case AV_SAMPLE_FMT_S16: { int16_t *volp = samples; for (i = 0; i < (decoded_data_size / sizeof(*volp)); i++) { int v = ((*volp) * audio_volume + 128) >> 8; *volp++ = av_clip_int16(v); } break; } case AV_SAMPLE_FMT_S32: { int32_t *volp = samples; for (i = 0; i < (decoded_data_size / sizeof(*volp)); i++) { int64_t v = (((int64_t)*volp * audio_volume + 128) >> 8); *volp++ = av_clipl_int32(v); } break; } case AV_SAMPLE_FMT_FLT: { float *volp = samples; float scale = audio_volume / 256.f; for (i = 0; i < (decoded_data_size / sizeof(*volp)); i++) { *volp++ *= scale; } break; } case AV_SAMPLE_FMT_DBL: { double *volp = samples; double scale = audio_volume / 256.; for (i = 0; i < (decoded_data_size / sizeof(*volp)); i++) { *volp++ *= scale; } break; } default: av_log(NULL, AV_LOG_FATAL, "Audio volume adjustment on sample format %s is not supported.\n", av_get_sample_fmt_name(ist->st->codec->sample_fmt)); exit_program(1); } } rate_emu_sleep(ist); for (i = 0; i < nb_output_streams; i++) { OutputStream *ost = output_streams[i]; if (!check_output_constraints(ist, ost) || !ost->encoding_needed) continue; do_audio_out(output_files[ost->file_index]->ctx, ost, ist, decoded_frame); } return ret; }
{ "code": [ " exit_program(1);", " exit_program(1);", " exit_program(1);", " return AVERROR(ENOMEM);", " exit_program(1);", " int i, ret;", " ist->next_dts += ((int64_t)AV_TIME_BASE * decoded_frame->nb_samples) /", " avctx->sample_rate;", " for (i = 0; i < nb_output_streams; i++) {", " OutputStream *ost = output_streams[i];", " if (!check_output_constraints(ist, ost) || !ost->encoding_needed)", " continue;", " do_audio_out(output_files[ost->file_index]->ctx, ost, ist, decoded_frame);" ], "line_no": [ 175, 175, 175, 17, 175, 11, 61, 63, 187, 189, 193, 195, 197 ] }
static int FUNC_0(InputStream *VAR_0, AVPacket *VAR_1, int *VAR_2) { AVFrame *decoded_frame; AVCodecContext *avctx = VAR_0->st->codec; int VAR_3 = av_get_bytes_per_sample(VAR_0->st->codec->sample_fmt); int VAR_4, VAR_5; if (!VAR_0->decoded_frame && !(VAR_0->decoded_frame = avcodec_alloc_frame())) return AVERROR(ENOMEM); else avcodec_get_frame_defaults(VAR_0->decoded_frame); decoded_frame = VAR_0->decoded_frame; VAR_5 = avcodec_decode_audio4(avctx, decoded_frame, VAR_2, VAR_1); if (VAR_5 < 0) { return VAR_5; } if (!*VAR_2) { return VAR_5; } if (decoded_frame->pts != AV_NOPTS_VALUE) VAR_0->next_dts = decoded_frame->pts; VAR_0->next_dts += ((int64_t)AV_TIME_BASE * decoded_frame->nb_samples) / avctx->sample_rate; if (audio_volume != 256) { int VAR_6 = decoded_frame->nb_samples * avctx->channels * VAR_3; void *VAR_7 = decoded_frame->data[0]; switch (avctx->sample_fmt) { case AV_SAMPLE_FMT_U8: { uint8_t *VAR_10 = VAR_7; for (VAR_4 = 0; VAR_4 < (VAR_6 / sizeof(*VAR_10)); VAR_4++) { int v = (((*VAR_10 - 128) * audio_volume + 128) >> 8) + 128; *VAR_10++ = av_clip_uint8(v); } break; } case AV_SAMPLE_FMT_S16: { int16_t *VAR_10 = VAR_7; for (VAR_4 = 0; VAR_4 < (VAR_6 / sizeof(*VAR_10)); VAR_4++) { int v = ((*VAR_10) * audio_volume + 128) >> 8; *VAR_10++ = av_clip_int16(v); } break; } case AV_SAMPLE_FMT_S32: { int32_t *VAR_10 = VAR_7; for (VAR_4 = 0; VAR_4 < (VAR_6 / sizeof(*VAR_10)); VAR_4++) { int64_t v = (((int64_t)*VAR_10 * audio_volume + 128) >> 8); *VAR_10++ = av_clipl_int32(v); } break; } case AV_SAMPLE_FMT_FLT: { float *VAR_10 = VAR_7; float VAR_10 = audio_volume / 256.f; for (VAR_4 = 0; VAR_4 < (VAR_6 / sizeof(*VAR_10)); VAR_4++) { *VAR_10++ *= VAR_10; } break; } case AV_SAMPLE_FMT_DBL: { double *VAR_10 = VAR_7; double VAR_10 = audio_volume / 256.; for (VAR_4 = 0; VAR_4 < (VAR_6 / sizeof(*VAR_10)); VAR_4++) { *VAR_10++ *= VAR_10; } break; } default: av_log(NULL, AV_LOG_FATAL, "Audio volume adjustment on sample format %s is not supported.\n", av_get_sample_fmt_name(VAR_0->st->codec->sample_fmt)); exit_program(1); } } rate_emu_sleep(VAR_0); for (VAR_4 = 0; VAR_4 < nb_output_streams; VAR_4++) { OutputStream *ost = output_streams[VAR_4]; if (!check_output_constraints(VAR_0, ost) || !ost->encoding_needed) continue; do_audio_out(output_files[ost->file_index]->ctx, ost, VAR_0, decoded_frame); } return VAR_5; }
[ "static int FUNC_0(InputStream *VAR_0, AVPacket *VAR_1, int *VAR_2)\n{", "AVFrame *decoded_frame;", "AVCodecContext *avctx = VAR_0->st->codec;", "int VAR_3 = av_get_bytes_per_sample(VAR_0->st->codec->sample_fmt);", "int VAR_4, VAR_5;", "if (!VAR_0->decoded_frame && !(VAR_0->decoded_frame = avcodec_alloc_frame()))\nreturn AVERROR(ENOMEM);", "else\navcodec_get_frame_defaults(VAR_0->decoded_frame);", "decoded_frame = VAR_0->decoded_frame;", "VAR_5 = avcodec_decode_audio4(avctx, decoded_frame, VAR_2, VAR_1);", "if (VAR_5 < 0) {", "return VAR_5;", "}", "if (!*VAR_2) {", "return VAR_5;", "}", "if (decoded_frame->pts != AV_NOPTS_VALUE)\nVAR_0->next_dts = decoded_frame->pts;", "VAR_0->next_dts += ((int64_t)AV_TIME_BASE * decoded_frame->nb_samples) /\navctx->sample_rate;", "if (audio_volume != 256) {", "int VAR_6 = decoded_frame->nb_samples * avctx->channels * VAR_3;", "void *VAR_7 = decoded_frame->data[0];", "switch (avctx->sample_fmt) {", "case AV_SAMPLE_FMT_U8:\n{", "uint8_t *VAR_10 = VAR_7;", "for (VAR_4 = 0; VAR_4 < (VAR_6 / sizeof(*VAR_10)); VAR_4++) {", "int v = (((*VAR_10 - 128) * audio_volume + 128) >> 8) + 128;", "*VAR_10++ = av_clip_uint8(v);", "}", "break;", "}", "case AV_SAMPLE_FMT_S16:\n{", "int16_t *VAR_10 = VAR_7;", "for (VAR_4 = 0; VAR_4 < (VAR_6 / sizeof(*VAR_10)); VAR_4++) {", "int v = ((*VAR_10) * audio_volume + 128) >> 8;", "*VAR_10++ = av_clip_int16(v);", "}", "break;", "}", "case AV_SAMPLE_FMT_S32:\n{", "int32_t *VAR_10 = VAR_7;", "for (VAR_4 = 0; VAR_4 < (VAR_6 / sizeof(*VAR_10)); VAR_4++) {", "int64_t v = (((int64_t)*VAR_10 * audio_volume + 128) >> 8);", "*VAR_10++ = av_clipl_int32(v);", "}", "break;", "}", "case AV_SAMPLE_FMT_FLT:\n{", "float *VAR_10 = VAR_7;", "float VAR_10 = audio_volume / 256.f;", "for (VAR_4 = 0; VAR_4 < (VAR_6 / sizeof(*VAR_10)); VAR_4++) {", "*VAR_10++ *= VAR_10;", "}", "break;", "}", "case AV_SAMPLE_FMT_DBL:\n{", "double *VAR_10 = VAR_7;", "double VAR_10 = audio_volume / 256.;", "for (VAR_4 = 0; VAR_4 < (VAR_6 / sizeof(*VAR_10)); VAR_4++) {", "*VAR_10++ *= VAR_10;", "}", "break;", "}", "default:\nav_log(NULL, AV_LOG_FATAL,\n\"Audio volume adjustment on sample format %s is not supported.\\n\",\nav_get_sample_fmt_name(VAR_0->st->codec->sample_fmt));", "exit_program(1);", "}", "}", "rate_emu_sleep(VAR_0);", "for (VAR_4 = 0; VAR_4 < nb_output_streams; VAR_4++) {", "OutputStream *ost = output_streams[VAR_4];", "if (!check_output_constraints(VAR_0, ost) || !ost->encoding_needed)\ncontinue;", "do_audio_out(output_files[ost->file_index]->ctx, ost, VAR_0, decoded_frame);", "}", "return VAR_5;", "}" ]
[ 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15, 17 ], [ 19, 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 41 ], [ 43 ], [ 51, 53 ], [ 61, 63 ], [ 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 ], [ 183 ], [ 187 ], [ 189 ], [ 193, 195 ], [ 197 ], [ 199 ], [ 203 ], [ 205 ] ]
2,333
static inline void store_cpu_offset(TCGv var, int offset) { tcg_gen_st_i32(var, cpu_env, offset); dead_tmp(var); }
true
qemu
7d1b0095bff7157e856d1d0e6c4295641ced2752
static inline void store_cpu_offset(TCGv var, int offset) { tcg_gen_st_i32(var, cpu_env, offset); dead_tmp(var); }
{ "code": [ " dead_tmp(var);", " dead_tmp(var);", " dead_tmp(var);", " dead_tmp(var);", " dead_tmp(var);" ], "line_no": [ 7, 7, 7, 7, 7 ] }
static inline void FUNC_0(TCGv VAR_0, int VAR_1) { tcg_gen_st_i32(VAR_0, cpu_env, VAR_1); dead_tmp(VAR_0); }
[ "static inline void FUNC_0(TCGv VAR_0, int VAR_1)\n{", "tcg_gen_st_i32(VAR_0, cpu_env, VAR_1);", "dead_tmp(VAR_0);", "}" ]
[ 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
2,337
static void test_cipher_speed(const void *opaque) { QCryptoCipher *cipher; Error *err = NULL; double total = 0.0; size_t chunk_size = (size_t)opaque; uint8_t *key = NULL, *iv = NULL; uint8_t *plaintext = NULL, *ciphertext = NULL; size_t nkey = qcrypto_cipher_get_key_len(QCRYPTO_CIPHER_ALG_AES_128); size_t niv = qcrypto_cipher_get_iv_len(QCRYPTO_CIPHER_ALG_AES_128, QCRYPTO_CIPHER_MODE_CBC); key = g_new0(uint8_t, nkey); memset(key, g_test_rand_int(), nkey); iv = g_new0(uint8_t, niv); memset(iv, g_test_rand_int(), niv); ciphertext = g_new0(uint8_t, chunk_size); plaintext = g_new0(uint8_t, chunk_size); memset(plaintext, g_test_rand_int(), chunk_size); cipher = qcrypto_cipher_new(QCRYPTO_CIPHER_ALG_AES_128, QCRYPTO_CIPHER_MODE_CBC, key, nkey, &err); g_assert(cipher != NULL); g_assert(qcrypto_cipher_setiv(cipher, iv, niv, &err) == 0); g_test_timer_start(); do { g_assert(qcrypto_cipher_encrypt(cipher, plaintext, ciphertext, chunk_size, &err) == 0); total += chunk_size; } while (g_test_timer_elapsed() < 5.0); total /= 1024 * 1024; /* to MB */ g_print("cbc(aes128): "); g_print("Testing chunk_size %ld bytes ", chunk_size); g_print("done: %.2f MB in %.2f secs: ", total, g_test_timer_last()); g_print("%.2f MB/sec\n", total / g_test_timer_last()); qcrypto_cipher_free(cipher); g_free(plaintext); g_free(ciphertext); g_free(iv); g_free(key); }
true
qemu
8c0a6dc96cd14c48da4a61fe35431f36d6e6e467
static void test_cipher_speed(const void *opaque) { QCryptoCipher *cipher; Error *err = NULL; double total = 0.0; size_t chunk_size = (size_t)opaque; uint8_t *key = NULL, *iv = NULL; uint8_t *plaintext = NULL, *ciphertext = NULL; size_t nkey = qcrypto_cipher_get_key_len(QCRYPTO_CIPHER_ALG_AES_128); size_t niv = qcrypto_cipher_get_iv_len(QCRYPTO_CIPHER_ALG_AES_128, QCRYPTO_CIPHER_MODE_CBC); key = g_new0(uint8_t, nkey); memset(key, g_test_rand_int(), nkey); iv = g_new0(uint8_t, niv); memset(iv, g_test_rand_int(), niv); ciphertext = g_new0(uint8_t, chunk_size); plaintext = g_new0(uint8_t, chunk_size); memset(plaintext, g_test_rand_int(), chunk_size); cipher = qcrypto_cipher_new(QCRYPTO_CIPHER_ALG_AES_128, QCRYPTO_CIPHER_MODE_CBC, key, nkey, &err); g_assert(cipher != NULL); g_assert(qcrypto_cipher_setiv(cipher, iv, niv, &err) == 0); g_test_timer_start(); do { g_assert(qcrypto_cipher_encrypt(cipher, plaintext, ciphertext, chunk_size, &err) == 0); total += chunk_size; } while (g_test_timer_elapsed() < 5.0); total /= 1024 * 1024; g_print("cbc(aes128): "); g_print("Testing chunk_size %ld bytes ", chunk_size); g_print("done: %.2f MB in %.2f secs: ", total, g_test_timer_last()); g_print("%.2f MB/sec\n", total / g_test_timer_last()); qcrypto_cipher_free(cipher); g_free(plaintext); g_free(ciphertext); g_free(iv); g_free(key); }
{ "code": [ " g_print(\"Testing chunk_size %ld bytes \", chunk_size);", " g_print(\"Testing chunk_size %ld bytes \", chunk_size);", " g_print(\"Testing chunk_size %ld bytes \", chunk_size);" ], "line_no": [ 91, 91, 91 ] }
static void FUNC_0(const void *VAR_0) { QCryptoCipher *cipher; Error *err = NULL; double VAR_1 = 0.0; size_t chunk_size = (size_t)VAR_0; uint8_t *key = NULL, *iv = NULL; uint8_t *plaintext = NULL, *ciphertext = NULL; size_t nkey = qcrypto_cipher_get_key_len(QCRYPTO_CIPHER_ALG_AES_128); size_t niv = qcrypto_cipher_get_iv_len(QCRYPTO_CIPHER_ALG_AES_128, QCRYPTO_CIPHER_MODE_CBC); key = g_new0(uint8_t, nkey); memset(key, g_test_rand_int(), nkey); iv = g_new0(uint8_t, niv); memset(iv, g_test_rand_int(), niv); ciphertext = g_new0(uint8_t, chunk_size); plaintext = g_new0(uint8_t, chunk_size); memset(plaintext, g_test_rand_int(), chunk_size); cipher = qcrypto_cipher_new(QCRYPTO_CIPHER_ALG_AES_128, QCRYPTO_CIPHER_MODE_CBC, key, nkey, &err); g_assert(cipher != NULL); g_assert(qcrypto_cipher_setiv(cipher, iv, niv, &err) == 0); g_test_timer_start(); do { g_assert(qcrypto_cipher_encrypt(cipher, plaintext, ciphertext, chunk_size, &err) == 0); VAR_1 += chunk_size; } while (g_test_timer_elapsed() < 5.0); VAR_1 /= 1024 * 1024; g_print("cbc(aes128): "); g_print("Testing chunk_size %ld bytes ", chunk_size); g_print("done: %.2f MB in %.2f secs: ", VAR_1, g_test_timer_last()); g_print("%.2f MB/sec\n", VAR_1 / g_test_timer_last()); qcrypto_cipher_free(cipher); g_free(plaintext); g_free(ciphertext); g_free(iv); g_free(key); }
[ "static void FUNC_0(const void *VAR_0)\n{", "QCryptoCipher *cipher;", "Error *err = NULL;", "double VAR_1 = 0.0;", "size_t chunk_size = (size_t)VAR_0;", "uint8_t *key = NULL, *iv = NULL;", "uint8_t *plaintext = NULL, *ciphertext = NULL;", "size_t nkey = qcrypto_cipher_get_key_len(QCRYPTO_CIPHER_ALG_AES_128);", "size_t niv = qcrypto_cipher_get_iv_len(QCRYPTO_CIPHER_ALG_AES_128,\nQCRYPTO_CIPHER_MODE_CBC);", "key = g_new0(uint8_t, nkey);", "memset(key, g_test_rand_int(), nkey);", "iv = g_new0(uint8_t, niv);", "memset(iv, g_test_rand_int(), niv);", "ciphertext = g_new0(uint8_t, chunk_size);", "plaintext = g_new0(uint8_t, chunk_size);", "memset(plaintext, g_test_rand_int(), chunk_size);", "cipher = qcrypto_cipher_new(QCRYPTO_CIPHER_ALG_AES_128,\nQCRYPTO_CIPHER_MODE_CBC,\nkey, nkey, &err);", "g_assert(cipher != NULL);", "g_assert(qcrypto_cipher_setiv(cipher,\niv, niv,\n&err) == 0);", "g_test_timer_start();", "do {", "g_assert(qcrypto_cipher_encrypt(cipher,\nplaintext,\nciphertext,\nchunk_size,\n&err) == 0);", "VAR_1 += chunk_size;", "} while (g_test_timer_elapsed() < 5.0);", "VAR_1 /= 1024 * 1024;", "g_print(\"cbc(aes128): \");", "g_print(\"Testing chunk_size %ld bytes \", chunk_size);", "g_print(\"done: %.2f MB in %.2f secs: \", VAR_1, g_test_timer_last());", "g_print(\"%.2f MB/sec\\n\", VAR_1 / g_test_timer_last());", "qcrypto_cipher_free(cipher);", "g_free(plaintext);", "g_free(ciphertext);", "g_free(iv);", "g_free(key);", "}" ]
[ 0, 0, 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19, 21 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 37 ], [ 41 ], [ 43 ], [ 47, 49, 51 ], [ 53 ], [ 57, 59, 61 ], [ 65 ], [ 67 ], [ 69, 71, 73, 75, 77 ], [ 79 ], [ 81 ], [ 85 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ] ]
2,338
static void s390_init(ram_addr_t my_ram_size, const char *boot_device, const char *kernel_filename, const char *kernel_cmdline, const char *initrd_filename, const char *cpu_model) { CPUState *env = NULL; MemoryRegion *sysmem = get_system_memory(); MemoryRegion *ram = g_new(MemoryRegion, 1); ram_addr_t kernel_size = 0; ram_addr_t initrd_offset; ram_addr_t initrd_size = 0; int shift = 0; uint8_t *storage_keys; void *virtio_region; target_phys_addr_t virtio_region_len; target_phys_addr_t virtio_region_start; int i; /* s390x ram size detection needs a 16bit multiplier + an increment. So guests > 64GB can be specified in 2MB steps etc. */ while ((my_ram_size >> (20 + shift)) > 65535) { shift++; } my_ram_size = my_ram_size >> (20 + shift) << (20 + shift); /* lets propagate the changed ram size into the global variable. */ ram_size = my_ram_size; /* get a BUS */ s390_bus = s390_virtio_bus_init(&my_ram_size); /* allocate RAM */ memory_region_init_ram(ram, NULL, "s390.ram", my_ram_size); memory_region_add_subregion(sysmem, 0, ram); /* allocate storage keys */ storage_keys = g_malloc0(my_ram_size / TARGET_PAGE_SIZE); /* init CPUs */ if (cpu_model == NULL) { cpu_model = "host"; } ipi_states = g_malloc(sizeof(CPUState *) * smp_cpus); for (i = 0; i < smp_cpus; i++) { CPUState *tmp_env; tmp_env = cpu_init(cpu_model); if (!env) { env = tmp_env; } ipi_states[i] = tmp_env; tmp_env->halted = 1; tmp_env->exception_index = EXCP_HLT; tmp_env->storage_keys = storage_keys; } /* One CPU has to run */ s390_add_running_cpu(env); if (kernel_filename) { kernel_size = load_image(kernel_filename, qemu_get_ram_ptr(0)); if (lduw_be_phys(KERN_IMAGE_START) != 0x0dd0) { fprintf(stderr, "Specified image is not an s390 boot image\n"); exit(1); } env->psw.addr = KERN_IMAGE_START; env->psw.mask = 0x0000000180000000ULL; } else { ram_addr_t bios_size = 0; char *bios_filename; /* Load zipl bootloader */ if (bios_name == NULL) { bios_name = ZIPL_FILENAME; } bios_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); bios_size = load_image(bios_filename, qemu_get_ram_ptr(ZIPL_LOAD_ADDR)); g_free(bios_filename); if ((long)bios_size < 0) { hw_error("could not load bootloader '%s'\n", bios_name); } if (bios_size > 4096) { hw_error("stage1 bootloader is > 4k\n"); } env->psw.addr = ZIPL_START; env->psw.mask = 0x0000000180000000ULL; } if (initrd_filename) { initrd_offset = INITRD_START; while (kernel_size + 0x100000 > initrd_offset) { initrd_offset += 0x100000; } initrd_size = load_image(initrd_filename, qemu_get_ram_ptr(initrd_offset)); stq_be_phys(INITRD_PARM_START, initrd_offset); stq_be_phys(INITRD_PARM_SIZE, initrd_size); } if (kernel_cmdline) { cpu_physical_memory_write(KERN_PARM_AREA, kernel_cmdline, strlen(kernel_cmdline) + 1); } /* Create VirtIO network adapters */ for(i = 0; i < nb_nics; i++) { NICInfo *nd = &nd_table[i]; DeviceState *dev; if (!nd->model) { nd->model = g_strdup("virtio"); } if (strcmp(nd->model, "virtio")) { fprintf(stderr, "S390 only supports VirtIO nics\n"); exit(1); } dev = qdev_create((BusState *)s390_bus, "virtio-net-s390"); qdev_set_nic_properties(dev, nd); qdev_init_nofail(dev); } /* Create VirtIO disk drives */ for(i = 0; i < MAX_BLK_DEVS; i++) { DriveInfo *dinfo; DeviceState *dev; dinfo = drive_get(IF_IDE, 0, i); if (!dinfo) { continue; } dev = qdev_create((BusState *)s390_bus, "virtio-blk-s390"); qdev_prop_set_drive_nofail(dev, "drive", dinfo->bdrv); qdev_init_nofail(dev); } }
true
qemu
326384d5b6dcea69ca44695ee807f8b50234ab71
static void s390_init(ram_addr_t my_ram_size, const char *boot_device, const char *kernel_filename, const char *kernel_cmdline, const char *initrd_filename, const char *cpu_model) { CPUState *env = NULL; MemoryRegion *sysmem = get_system_memory(); MemoryRegion *ram = g_new(MemoryRegion, 1); ram_addr_t kernel_size = 0; ram_addr_t initrd_offset; ram_addr_t initrd_size = 0; int shift = 0; uint8_t *storage_keys; void *virtio_region; target_phys_addr_t virtio_region_len; target_phys_addr_t virtio_region_start; int i; while ((my_ram_size >> (20 + shift)) > 65535) { shift++; } my_ram_size = my_ram_size >> (20 + shift) << (20 + shift); ram_size = my_ram_size; s390_bus = s390_virtio_bus_init(&my_ram_size); memory_region_init_ram(ram, NULL, "s390.ram", my_ram_size); memory_region_add_subregion(sysmem, 0, ram); storage_keys = g_malloc0(my_ram_size / TARGET_PAGE_SIZE); if (cpu_model == NULL) { cpu_model = "host"; } ipi_states = g_malloc(sizeof(CPUState *) * smp_cpus); for (i = 0; i < smp_cpus; i++) { CPUState *tmp_env; tmp_env = cpu_init(cpu_model); if (!env) { env = tmp_env; } ipi_states[i] = tmp_env; tmp_env->halted = 1; tmp_env->exception_index = EXCP_HLT; tmp_env->storage_keys = storage_keys; } s390_add_running_cpu(env); if (kernel_filename) { kernel_size = load_image(kernel_filename, qemu_get_ram_ptr(0)); if (lduw_be_phys(KERN_IMAGE_START) != 0x0dd0) { fprintf(stderr, "Specified image is not an s390 boot image\n"); exit(1); } env->psw.addr = KERN_IMAGE_START; env->psw.mask = 0x0000000180000000ULL; } else { ram_addr_t bios_size = 0; char *bios_filename; if (bios_name == NULL) { bios_name = ZIPL_FILENAME; } bios_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); bios_size = load_image(bios_filename, qemu_get_ram_ptr(ZIPL_LOAD_ADDR)); g_free(bios_filename); if ((long)bios_size < 0) { hw_error("could not load bootloader '%s'\n", bios_name); } if (bios_size > 4096) { hw_error("stage1 bootloader is > 4k\n"); } env->psw.addr = ZIPL_START; env->psw.mask = 0x0000000180000000ULL; } if (initrd_filename) { initrd_offset = INITRD_START; while (kernel_size + 0x100000 > initrd_offset) { initrd_offset += 0x100000; } initrd_size = load_image(initrd_filename, qemu_get_ram_ptr(initrd_offset)); stq_be_phys(INITRD_PARM_START, initrd_offset); stq_be_phys(INITRD_PARM_SIZE, initrd_size); } if (kernel_cmdline) { cpu_physical_memory_write(KERN_PARM_AREA, kernel_cmdline, strlen(kernel_cmdline) + 1); } for(i = 0; i < nb_nics; i++) { NICInfo *nd = &nd_table[i]; DeviceState *dev; if (!nd->model) { nd->model = g_strdup("virtio"); } if (strcmp(nd->model, "virtio")) { fprintf(stderr, "S390 only supports VirtIO nics\n"); exit(1); } dev = qdev_create((BusState *)s390_bus, "virtio-net-s390"); qdev_set_nic_properties(dev, nd); qdev_init_nofail(dev); } for(i = 0; i < MAX_BLK_DEVS; i++) { DriveInfo *dinfo; DeviceState *dev; dinfo = drive_get(IF_IDE, 0, i); if (!dinfo) { continue; } dev = qdev_create((BusState *)s390_bus, "virtio-blk-s390"); qdev_prop_set_drive_nofail(dev, "drive", dinfo->bdrv); qdev_init_nofail(dev); } }
{ "code": [], "line_no": [] }
static void FUNC_0(ram_addr_t VAR_0, const char *VAR_1, const char *VAR_2, const char *VAR_3, const char *VAR_4, const char *VAR_5) { CPUState *env = NULL; MemoryRegion *sysmem = get_system_memory(); MemoryRegion *ram = g_new(MemoryRegion, 1); ram_addr_t kernel_size = 0; ram_addr_t initrd_offset; ram_addr_t initrd_size = 0; int VAR_6 = 0; uint8_t *storage_keys; void *VAR_7; target_phys_addr_t virtio_region_len; target_phys_addr_t virtio_region_start; int VAR_8; while ((VAR_0 >> (20 + VAR_6)) > 65535) { VAR_6++; } VAR_0 = VAR_0 >> (20 + VAR_6) << (20 + VAR_6); ram_size = VAR_0; s390_bus = s390_virtio_bus_init(&VAR_0); memory_region_init_ram(ram, NULL, "s390.ram", VAR_0); memory_region_add_subregion(sysmem, 0, ram); storage_keys = g_malloc0(VAR_0 / TARGET_PAGE_SIZE); if (VAR_5 == NULL) { VAR_5 = "host"; } ipi_states = g_malloc(sizeof(CPUState *) * smp_cpus); for (VAR_8 = 0; VAR_8 < smp_cpus; VAR_8++) { CPUState *tmp_env; tmp_env = cpu_init(VAR_5); if (!env) { env = tmp_env; } ipi_states[VAR_8] = tmp_env; tmp_env->halted = 1; tmp_env->exception_index = EXCP_HLT; tmp_env->storage_keys = storage_keys; } s390_add_running_cpu(env); if (VAR_2) { kernel_size = load_image(VAR_2, qemu_get_ram_ptr(0)); if (lduw_be_phys(KERN_IMAGE_START) != 0x0dd0) { fprintf(stderr, "Specified image is not an s390 boot image\n"); exit(1); } env->psw.addr = KERN_IMAGE_START; env->psw.mask = 0x0000000180000000ULL; } else { ram_addr_t bios_size = 0; char *VAR_9; if (bios_name == NULL) { bios_name = ZIPL_FILENAME; } VAR_9 = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); bios_size = load_image(VAR_9, qemu_get_ram_ptr(ZIPL_LOAD_ADDR)); g_free(VAR_9); if ((long)bios_size < 0) { hw_error("could not load bootloader '%s'\n", bios_name); } if (bios_size > 4096) { hw_error("stage1 bootloader is > 4k\n"); } env->psw.addr = ZIPL_START; env->psw.mask = 0x0000000180000000ULL; } if (VAR_4) { initrd_offset = INITRD_START; while (kernel_size + 0x100000 > initrd_offset) { initrd_offset += 0x100000; } initrd_size = load_image(VAR_4, qemu_get_ram_ptr(initrd_offset)); stq_be_phys(INITRD_PARM_START, initrd_offset); stq_be_phys(INITRD_PARM_SIZE, initrd_size); } if (VAR_3) { cpu_physical_memory_write(KERN_PARM_AREA, VAR_3, strlen(VAR_3) + 1); } for(VAR_8 = 0; VAR_8 < nb_nics; VAR_8++) { NICInfo *nd = &nd_table[VAR_8]; DeviceState *dev; if (!nd->model) { nd->model = g_strdup("virtio"); } if (strcmp(nd->model, "virtio")) { fprintf(stderr, "S390 only supports VirtIO nics\n"); exit(1); } dev = qdev_create((BusState *)s390_bus, "virtio-net-s390"); qdev_set_nic_properties(dev, nd); qdev_init_nofail(dev); } for(VAR_8 = 0; VAR_8 < MAX_BLK_DEVS; VAR_8++) { DriveInfo *dinfo; DeviceState *dev; dinfo = drive_get(IF_IDE, 0, VAR_8); if (!dinfo) { continue; } dev = qdev_create((BusState *)s390_bus, "virtio-blk-s390"); qdev_prop_set_drive_nofail(dev, "drive", dinfo->bdrv); qdev_init_nofail(dev); } }
[ "static void FUNC_0(ram_addr_t VAR_0,\nconst char *VAR_1,\nconst char *VAR_2,\nconst char *VAR_3,\nconst char *VAR_4,\nconst char *VAR_5)\n{", "CPUState *env = NULL;", "MemoryRegion *sysmem = get_system_memory();", "MemoryRegion *ram = g_new(MemoryRegion, 1);", "ram_addr_t kernel_size = 0;", "ram_addr_t initrd_offset;", "ram_addr_t initrd_size = 0;", "int VAR_6 = 0;", "uint8_t *storage_keys;", "void *VAR_7;", "target_phys_addr_t virtio_region_len;", "target_phys_addr_t virtio_region_start;", "int VAR_8;", "while ((VAR_0 >> (20 + VAR_6)) > 65535) {", "VAR_6++;", "}", "VAR_0 = VAR_0 >> (20 + VAR_6) << (20 + VAR_6);", "ram_size = VAR_0;", "s390_bus = s390_virtio_bus_init(&VAR_0);", "memory_region_init_ram(ram, NULL, \"s390.ram\", VAR_0);", "memory_region_add_subregion(sysmem, 0, ram);", "storage_keys = g_malloc0(VAR_0 / TARGET_PAGE_SIZE);", "if (VAR_5 == NULL) {", "VAR_5 = \"host\";", "}", "ipi_states = g_malloc(sizeof(CPUState *) * smp_cpus);", "for (VAR_8 = 0; VAR_8 < smp_cpus; VAR_8++) {", "CPUState *tmp_env;", "tmp_env = cpu_init(VAR_5);", "if (!env) {", "env = tmp_env;", "}", "ipi_states[VAR_8] = tmp_env;", "tmp_env->halted = 1;", "tmp_env->exception_index = EXCP_HLT;", "tmp_env->storage_keys = storage_keys;", "}", "s390_add_running_cpu(env);", "if (VAR_2) {", "kernel_size = load_image(VAR_2, qemu_get_ram_ptr(0));", "if (lduw_be_phys(KERN_IMAGE_START) != 0x0dd0) {", "fprintf(stderr, \"Specified image is not an s390 boot image\\n\");", "exit(1);", "}", "env->psw.addr = KERN_IMAGE_START;", "env->psw.mask = 0x0000000180000000ULL;", "} else {", "ram_addr_t bios_size = 0;", "char *VAR_9;", "if (bios_name == NULL) {", "bios_name = ZIPL_FILENAME;", "}", "VAR_9 = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);", "bios_size = load_image(VAR_9, qemu_get_ram_ptr(ZIPL_LOAD_ADDR));", "g_free(VAR_9);", "if ((long)bios_size < 0) {", "hw_error(\"could not load bootloader '%s'\\n\", bios_name);", "}", "if (bios_size > 4096) {", "hw_error(\"stage1 bootloader is > 4k\\n\");", "}", "env->psw.addr = ZIPL_START;", "env->psw.mask = 0x0000000180000000ULL;", "}", "if (VAR_4) {", "initrd_offset = INITRD_START;", "while (kernel_size + 0x100000 > initrd_offset) {", "initrd_offset += 0x100000;", "}", "initrd_size = load_image(VAR_4, qemu_get_ram_ptr(initrd_offset));", "stq_be_phys(INITRD_PARM_START, initrd_offset);", "stq_be_phys(INITRD_PARM_SIZE, initrd_size);", "}", "if (VAR_3) {", "cpu_physical_memory_write(KERN_PARM_AREA, VAR_3,\nstrlen(VAR_3) + 1);", "}", "for(VAR_8 = 0; VAR_8 < nb_nics; VAR_8++) {", "NICInfo *nd = &nd_table[VAR_8];", "DeviceState *dev;", "if (!nd->model) {", "nd->model = g_strdup(\"virtio\");", "}", "if (strcmp(nd->model, \"virtio\")) {", "fprintf(stderr, \"S390 only supports VirtIO nics\\n\");", "exit(1);", "}", "dev = qdev_create((BusState *)s390_bus, \"virtio-net-s390\");", "qdev_set_nic_properties(dev, nd);", "qdev_init_nofail(dev);", "}", "for(VAR_8 = 0; VAR_8 < MAX_BLK_DEVS; VAR_8++) {", "DriveInfo *dinfo;", "DeviceState *dev;", "dinfo = drive_get(IF_IDE, 0, VAR_8);", "if (!dinfo) {", "continue;", "}", "dev = qdev_create((BusState *)s390_bus, \"virtio-blk-s390\");", "qdev_prop_set_drive_nofail(dev, \"drive\", dinfo->bdrv);", "qdev_init_nofail(dev);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 22 ], [ 23 ], [ 24 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 32 ], [ 34 ], [ 36 ], [ 37 ], [ 38 ], [ 39 ], [ 40 ], [ 41 ], [ 42 ], [ 43 ], [ 44 ], [ 45 ], [ 46 ], [ 47 ], [ 48 ], [ 49 ], [ 50 ], [ 52 ], [ 53 ], [ 54 ], [ 55 ], [ 56 ], [ 57 ], [ 58 ], [ 59 ], [ 60 ], [ 61 ], [ 62 ], [ 63 ], [ 65 ], [ 66 ], [ 67 ], [ 68 ], [ 69 ], [ 70 ], [ 71 ], [ 72 ], [ 73 ], [ 74 ], [ 75 ], [ 76 ], [ 77 ], [ 78 ], [ 79 ], [ 80 ], [ 81 ], [ 82 ], [ 83 ], [ 84 ], [ 85 ], [ 86 ], [ 87 ], [ 88 ], [ 89 ], [ 90, 91 ], [ 92 ], [ 94 ], [ 95 ], [ 96 ], [ 97 ], [ 98 ], [ 99 ], [ 100 ], [ 101 ], [ 102 ], [ 103 ], [ 104 ], [ 105 ], [ 106 ], [ 107 ], [ 109 ], [ 110 ], [ 111 ], [ 112 ], [ 113 ], [ 114 ], [ 115 ], [ 116 ], [ 117 ], [ 118 ], [ 119 ], [ 120 ] ]
2,339
void host_to_target_siginfo(target_siginfo_t *tinfo, const siginfo_t *info) { host_to_target_siginfo_noswap(tinfo, info); tswap_siginfo(tinfo, tinfo); }
true
qemu
55d72a7eb32858d50ba0777cfde2027d007010b2
void host_to_target_siginfo(target_siginfo_t *tinfo, const siginfo_t *info) { host_to_target_siginfo_noswap(tinfo, info); tswap_siginfo(tinfo, tinfo); }
{ "code": [ " host_to_target_siginfo_noswap(tinfo, info);", " tswap_siginfo(tinfo, tinfo);" ], "line_no": [ 5, 7 ] }
void FUNC_0(target_siginfo_t *VAR_0, const siginfo_t *VAR_1) { host_to_target_siginfo_noswap(VAR_0, VAR_1); tswap_siginfo(VAR_0, VAR_0); }
[ "void FUNC_0(target_siginfo_t *VAR_0, const siginfo_t *VAR_1)\n{", "host_to_target_siginfo_noswap(VAR_0, VAR_1);", "tswap_siginfo(VAR_0, VAR_0);", "}" ]
[ 0, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
2,340
static void ioapic_common_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); dc->realize = ioapic_common_realize; dc->vmsd = &vmstate_ioapic_common; dc->no_user = 1; }
true
qemu
efec3dd631d94160288392721a5f9c39e50fb2bc
static void ioapic_common_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); dc->realize = ioapic_common_realize; dc->vmsd = &vmstate_ioapic_common; dc->no_user = 1; }
{ "code": [ " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;" ], "line_no": [ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13 ] }
static void FUNC_0(ObjectClass *VAR_0, void *VAR_1) { DeviceClass *dc = DEVICE_CLASS(VAR_0); dc->realize = ioapic_common_realize; dc->vmsd = &vmstate_ioapic_common; dc->no_user = 1; }
[ "static void FUNC_0(ObjectClass *VAR_0, void *VAR_1)\n{", "DeviceClass *dc = DEVICE_CLASS(VAR_0);", "dc->realize = ioapic_common_realize;", "dc->vmsd = &vmstate_ioapic_common;", "dc->no_user = 1;", "}" ]
[ 0, 0, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ] ]
2,341
uint64_t helper_cmpbge(uint64_t op1, uint64_t op2) { #if defined(__SSE2__) uint64_t r; /* The cmpbge instruction is heavily used in the implementation of every string function on Alpha. We can do much better than either the default loop below, or even an unrolled version by using the native vector support. */ { typedef uint64_t Q __attribute__((vector_size(16))); typedef uint8_t B __attribute__((vector_size(16))); Q q1 = (Q){ op1, 0 }; Q q2 = (Q){ op2, 0 }; q1 = (Q)((B)q1 >= (B)q2); r = q1[0]; } /* Select only one bit from each byte. */ r &= 0x0101010101010101; /* Collect the bits into the bottom byte. */ /* .......A.......B.......C.......D.......E.......F.......G.......H */ r |= r >> (8 - 1); /* .......A......AB......BC......CD......DE......EF......FG......GH */ r |= r >> (16 - 2); /* .......A......AB.....ABC....ABCD....BCDE....CDEF....DEFG....EFGH */ r |= r >> (32 - 4); /* .......A......AB.....ABC....ABCD...ABCDE..ABCDEF.ABCDEFGABCDEFGH */ /* Return only the low 8 bits. */ return r & 0xff; #else uint8_t opa, opb, res; int i; res = 0; for (i = 0; i < 8; i++) { opa = op1 >> (i * 8); opb = op2 >> (i * 8); if (opa >= opb) { res |= 1 << i; } } return res; #endif }
true
qemu
f5790c3bc81702c98c7ddadedb274758cff8cbe7
uint64_t helper_cmpbge(uint64_t op1, uint64_t op2) { #if defined(__SSE2__) uint64_t r; { typedef uint64_t Q __attribute__((vector_size(16))); typedef uint8_t B __attribute__((vector_size(16))); Q q1 = (Q){ op1, 0 }; Q q2 = (Q){ op2, 0 }; q1 = (Q)((B)q1 >= (B)q2); r = q1[0]; } r &= 0x0101010101010101; r |= r >> (8 - 1); r |= r >> (16 - 2); r |= r >> (32 - 4); return r & 0xff; #else uint8_t opa, opb, res; int i; res = 0; for (i = 0; i < 8; i++) { opa = op1 >> (i * 8); opb = op2 >> (i * 8); if (opa >= opb) { res |= 1 << i; } } return res; #endif }
{ "code": [ "#if defined(__SSE2__)", " uint64_t r;", " typedef uint64_t Q __attribute__((vector_size(16)));", " typedef uint8_t B __attribute__((vector_size(16)));", " Q q1 = (Q){ op1, 0 };", " Q q2 = (Q){ op2, 0 };", " q1 = (Q)((B)q1 >= (B)q2);", " r = q1[0];", " r &= 0x0101010101010101;", " r |= r >> (8 - 1);", " r |= r >> (16 - 2);", " r |= r >> (32 - 4);", " return r & 0xff;", "#else", "#endif" ], "line_no": [ 5, 7, 21, 23, 27, 29, 33, 37, 45, 53, 59, 65, 73, 75, 101 ] }
uint64_t FUNC_0(uint64_t op1, uint64_t op2) { #if defined(__SSE2__) uint64_t r; { typedef uint64_t Q __attribute__((vector_size(16))); typedef uint8_t B __attribute__((vector_size(16))); Q VAR_0 = (Q){ op1, 0 }; Q VAR_1 = (Q){ op2, 0 }; VAR_0 = (Q)((B)VAR_0 >= (B)VAR_1); r = VAR_0[0]; } r &= 0x0101010101010101; r |= r >> (8 - 1); r |= r >> (16 - 2); r |= r >> (32 - 4); return r & 0xff; #else uint8_t opa, opb, res; int i; res = 0; for (i = 0; i < 8; i++) { opa = op1 >> (i * 8); opb = op2 >> (i * 8); if (opa >= opb) { res |= 1 << i; } } return res; #endif }
[ "uint64_t FUNC_0(uint64_t op1, uint64_t op2)\n{", "#if defined(__SSE2__)\nuint64_t r;", "{", "typedef uint64_t Q __attribute__((vector_size(16)));", "typedef uint8_t B __attribute__((vector_size(16)));", "Q VAR_0 = (Q){ op1, 0 };", "Q VAR_1 = (Q){ op2, 0 };", "VAR_0 = (Q)((B)VAR_0 >= (B)VAR_1);", "r = VAR_0[0];", "}", "r &= 0x0101010101010101;", "r |= r >> (8 - 1);", "r |= r >> (16 - 2);", "r |= r >> (32 - 4);", "return r & 0xff;", "#else\nuint8_t opa, opb, res;", "int i;", "res = 0;", "for (i = 0; i < 8; i++) {", "opa = op1 >> (i * 8);", "opb = op2 >> (i * 8);", "if (opa >= opb) {", "res |= 1 << i;", "}", "}", "return res;", "#endif\n}" ]
[ 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 ]
[ [ 1, 3 ], [ 5, 7 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 33 ], [ 37 ], [ 39 ], [ 45 ], [ 53 ], [ 59 ], [ 65 ], [ 73 ], [ 75, 77 ], [ 79 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101, 103 ] ]
2,342
int nbd_client_co_pwrite_zeroes(BlockDriverState *bs, int64_t offset, int bytes, BdrvRequestFlags flags) { NBDClientSession *client = nbd_get_client_session(bs); NBDRequest request = { .type = NBD_CMD_WRITE_ZEROES, .from = offset, .len = bytes, }; if (!(client->info.flags & NBD_FLAG_SEND_WRITE_ZEROES)) { return -ENOTSUP; } if (flags & BDRV_REQ_FUA) { assert(client->info.flags & NBD_FLAG_SEND_FUA); request.flags |= NBD_CMD_FLAG_FUA; } if (!(flags & BDRV_REQ_MAY_UNMAP)) { request.flags |= NBD_CMD_FLAG_NO_HOLE; } return nbd_co_request(bs, &request, NULL); }
true
qemu
1104d83c726d2b20f9cec7b99ab3570a2fdbd46d
int nbd_client_co_pwrite_zeroes(BlockDriverState *bs, int64_t offset, int bytes, BdrvRequestFlags flags) { NBDClientSession *client = nbd_get_client_session(bs); NBDRequest request = { .type = NBD_CMD_WRITE_ZEROES, .from = offset, .len = bytes, }; if (!(client->info.flags & NBD_FLAG_SEND_WRITE_ZEROES)) { return -ENOTSUP; } if (flags & BDRV_REQ_FUA) { assert(client->info.flags & NBD_FLAG_SEND_FUA); request.flags |= NBD_CMD_FLAG_FUA; } if (!(flags & BDRV_REQ_MAY_UNMAP)) { request.flags |= NBD_CMD_FLAG_NO_HOLE; } return nbd_co_request(bs, &request, NULL); }
{ "code": [], "line_no": [] }
int FUNC_0(BlockDriverState *VAR_0, int64_t VAR_1, int VAR_2, BdrvRequestFlags VAR_3) { NBDClientSession *client = nbd_get_client_session(VAR_0); NBDRequest request = { .type = NBD_CMD_WRITE_ZEROES, .from = VAR_1, .len = VAR_2, }; if (!(client->info.VAR_3 & NBD_FLAG_SEND_WRITE_ZEROES)) { return -ENOTSUP; } if (VAR_3 & BDRV_REQ_FUA) { assert(client->info.VAR_3 & NBD_FLAG_SEND_FUA); request.VAR_3 |= NBD_CMD_FLAG_FUA; } if (!(VAR_3 & BDRV_REQ_MAY_UNMAP)) { request.VAR_3 |= NBD_CMD_FLAG_NO_HOLE; } return nbd_co_request(VAR_0, &request, NULL); }
[ "int FUNC_0(BlockDriverState *VAR_0, int64_t VAR_1,\nint VAR_2, BdrvRequestFlags VAR_3)\n{", "NBDClientSession *client = nbd_get_client_session(VAR_0);", "NBDRequest request = {", ".type = NBD_CMD_WRITE_ZEROES,\n.from = VAR_1,\n.len = VAR_2,\n};", "if (!(client->info.VAR_3 & NBD_FLAG_SEND_WRITE_ZEROES)) {", "return -ENOTSUP;", "}", "if (VAR_3 & BDRV_REQ_FUA) {", "assert(client->info.VAR_3 & NBD_FLAG_SEND_FUA);", "request.VAR_3 |= NBD_CMD_FLAG_FUA;", "}", "if (!(VAR_3 & BDRV_REQ_MAY_UNMAP)) {", "request.VAR_3 |= NBD_CMD_FLAG_NO_HOLE;", "}", "return nbd_co_request(VAR_0, &request, NULL);", "}" ]
[ 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 ], [ 22 ], [ 24 ], [ 26 ], [ 30 ], [ 32 ], [ 34 ], [ 36 ], [ 38 ], [ 40 ], [ 42 ], [ 46 ], [ 48 ] ]
2,343
static uint32_t get_cmd(ESPState *s, uint8_t *buf) { uint32_t dmalen; int target; dmalen = s->rregs[ESP_TCLO] | (s->rregs[ESP_TCMID] << 8); target = s->wregs[ESP_WBUSID] & 7; DPRINTF("get_cmd: len %d target %d\n", dmalen, target); if (s->dma) { s->dma_memory_read(s->dma_opaque, buf, dmalen); } else { buf[0] = 0; memcpy(&buf[1], s->ti_buf, dmalen); dmalen++; } s->ti_size = 0; s->ti_rptr = 0; s->ti_wptr = 0; if (s->current_dev) { /* Started a new command before the old one finished. Cancel it. */ s->current_dev->cancel_io(s->current_dev, 0); s->async_len = 0; } if (target >= ESP_MAX_DEVS || !s->scsi_dev[target]) { // No such drive s->rregs[ESP_RSTAT] = 0; s->rregs[ESP_RINTR] = INTR_DC; s->rregs[ESP_RSEQ] = SEQ_0; esp_raise_irq(s); return 0; } s->current_dev = s->scsi_dev[target]; return dmalen; }
true
qemu
8dea1dd406189dae6108104faf27f397835ae871
static uint32_t get_cmd(ESPState *s, uint8_t *buf) { uint32_t dmalen; int target; dmalen = s->rregs[ESP_TCLO] | (s->rregs[ESP_TCMID] << 8); target = s->wregs[ESP_WBUSID] & 7; DPRINTF("get_cmd: len %d target %d\n", dmalen, target); if (s->dma) { s->dma_memory_read(s->dma_opaque, buf, dmalen); } else { buf[0] = 0; memcpy(&buf[1], s->ti_buf, dmalen); dmalen++; } s->ti_size = 0; s->ti_rptr = 0; s->ti_wptr = 0; if (s->current_dev) { s->current_dev->cancel_io(s->current_dev, 0); s->async_len = 0; } if (target >= ESP_MAX_DEVS || !s->scsi_dev[target]) { s->rregs[ESP_RSTAT] = 0; s->rregs[ESP_RINTR] = INTR_DC; s->rregs[ESP_RSEQ] = SEQ_0; esp_raise_irq(s); return 0; } s->current_dev = s->scsi_dev[target]; return dmalen; }
{ "code": [ " target = s->wregs[ESP_WBUSID] & 7;" ], "line_no": [ 13 ] }
static uint32_t FUNC_0(ESPState *s, uint8_t *buf) { uint32_t dmalen; int VAR_0; dmalen = s->rregs[ESP_TCLO] | (s->rregs[ESP_TCMID] << 8); VAR_0 = s->wregs[ESP_WBUSID] & 7; DPRINTF("FUNC_0: len %d VAR_0 %d\n", dmalen, VAR_0); if (s->dma) { s->dma_memory_read(s->dma_opaque, buf, dmalen); } else { buf[0] = 0; memcpy(&buf[1], s->ti_buf, dmalen); dmalen++; } s->ti_size = 0; s->ti_rptr = 0; s->ti_wptr = 0; if (s->current_dev) { s->current_dev->cancel_io(s->current_dev, 0); s->async_len = 0; } if (VAR_0 >= ESP_MAX_DEVS || !s->scsi_dev[VAR_0]) { s->rregs[ESP_RSTAT] = 0; s->rregs[ESP_RINTR] = INTR_DC; s->rregs[ESP_RSEQ] = SEQ_0; esp_raise_irq(s); return 0; } s->current_dev = s->scsi_dev[VAR_0]; return dmalen; }
[ "static uint32_t FUNC_0(ESPState *s, uint8_t *buf)\n{", "uint32_t dmalen;", "int VAR_0;", "dmalen = s->rregs[ESP_TCLO] | (s->rregs[ESP_TCMID] << 8);", "VAR_0 = s->wregs[ESP_WBUSID] & 7;", "DPRINTF(\"FUNC_0: len %d VAR_0 %d\\n\", dmalen, VAR_0);", "if (s->dma) {", "s->dma_memory_read(s->dma_opaque, buf, dmalen);", "} else {", "buf[0] = 0;", "memcpy(&buf[1], s->ti_buf, dmalen);", "dmalen++;", "}", "s->ti_size = 0;", "s->ti_rptr = 0;", "s->ti_wptr = 0;", "if (s->current_dev) {", "s->current_dev->cancel_io(s->current_dev, 0);", "s->async_len = 0;", "}", "if (VAR_0 >= ESP_MAX_DEVS || !s->scsi_dev[VAR_0]) {", "s->rregs[ESP_RSTAT] = 0;", "s->rregs[ESP_RINTR] = INTR_DC;", "s->rregs[ESP_RSEQ] = SEQ_0;", "esp_raise_irq(s);", "return 0;", "}", "s->current_dev = s->scsi_dev[VAR_0];", "return dmalen;", "}" ]
[ 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ] ]
2,344
static int opt_preset(const char *opt, const char *arg) { FILE *f=NULL; char tmp[1000], tmp2[1000], line[1000]; int i; const char *base[3]= { getenv("HOME"), "/usr/local/share", "/usr/share", }; for(i=!base[0]; i<3 && !f; i++){ snprintf(tmp, sizeof(tmp), "%s/%sffmpeg/%s.ffpreset", base[i], i ? "" : ".", arg); f= fopen(tmp, "r"); if(!f){ char *codec_name= *opt == 'v' ? video_codec_name : *opt == 'a' ? audio_codec_name : subtitle_codec_name; snprintf(tmp, sizeof(tmp), "%s/%sffmpeg/%s-%s.ffpreset", base[i], i ? "" : ".", codec_name, arg); f= fopen(tmp, "r"); } } if(!f && ((arg[0]=='.' && arg[1]=='/') || arg[0]=='/')){ f= fopen(arg, "r"); } if(!f){ fprintf(stderr, "Preset file not found\n"); av_exit(1); } while(!feof(f)){ int e= fscanf(f, "%999[^\n]\n", line) - 1; if(line[0] == '#' && !e) continue; e|= sscanf(line, "%999[^=]=%999[^\n]\n", tmp, tmp2) - 2; if(e){ fprintf(stderr, "Preset file invalid\n"); av_exit(1); } if(!strcmp(tmp, "acodec")){ opt_audio_codec(tmp2); }else if(!strcmp(tmp, "vcodec")){ opt_video_codec(tmp2); }else if(!strcmp(tmp, "scodec")){ opt_subtitle_codec(tmp2); }else opt_default(tmp, tmp2); } fclose(f); return 0; }
true
FFmpeg
3ddb448d0a31f63004b1e7aab1dc113e4b29a6fa
static int opt_preset(const char *opt, const char *arg) { FILE *f=NULL; char tmp[1000], tmp2[1000], line[1000]; int i; const char *base[3]= { getenv("HOME"), "/usr/local/share", "/usr/share", }; for(i=!base[0]; i<3 && !f; i++){ snprintf(tmp, sizeof(tmp), "%s/%sffmpeg/%s.ffpreset", base[i], i ? "" : ".", arg); f= fopen(tmp, "r"); if(!f){ char *codec_name= *opt == 'v' ? video_codec_name : *opt == 'a' ? audio_codec_name : subtitle_codec_name; snprintf(tmp, sizeof(tmp), "%s/%sffmpeg/%s-%s.ffpreset", base[i], i ? "" : ".", codec_name, arg); f= fopen(tmp, "r"); } } if(!f && ((arg[0]=='.' && arg[1]=='/') || arg[0]=='/')){ f= fopen(arg, "r"); } if(!f){ fprintf(stderr, "Preset file not found\n"); av_exit(1); } while(!feof(f)){ int e= fscanf(f, "%999[^\n]\n", line) - 1; if(line[0] == '#' && !e) continue; e|= sscanf(line, "%999[^=]=%999[^\n]\n", tmp, tmp2) - 2; if(e){ fprintf(stderr, "Preset file invalid\n"); av_exit(1); } if(!strcmp(tmp, "acodec")){ opt_audio_codec(tmp2); }else if(!strcmp(tmp, "vcodec")){ opt_video_codec(tmp2); }else if(!strcmp(tmp, "scodec")){ opt_subtitle_codec(tmp2); }else opt_default(tmp, tmp2); } fclose(f); return 0; }
{ "code": [ " if(!f && ((arg[0]=='.' && arg[1]=='/') || arg[0]=='/')){" ], "line_no": [ 43 ] }
static int FUNC_0(const char *VAR_0, const char *VAR_1) { FILE *f=NULL; char VAR_2[1000], VAR_3[1000], VAR_4[1000]; int VAR_5; const char *VAR_6[3]= { getenv("HOME"), "/usr/local/share", "/usr/share", }; for(VAR_5=!VAR_6[0]; VAR_5<3 && !f; VAR_5++){ snprintf(VAR_2, sizeof(VAR_2), "%s/%sffmpeg/%s.ffpreset", VAR_6[VAR_5], VAR_5 ? "" : ".", VAR_1); f= fopen(VAR_2, "r"); if(!f){ char *codec_name= *VAR_0 == 'v' ? video_codec_name : *VAR_0 == 'a' ? audio_codec_name : subtitle_codec_name; snprintf(VAR_2, sizeof(VAR_2), "%s/%sffmpeg/%s-%s.ffpreset", VAR_6[VAR_5], VAR_5 ? "" : ".", codec_name, VAR_1); f= fopen(VAR_2, "r"); } } if(!f && ((VAR_1[0]=='.' && VAR_1[1]=='/') || VAR_1[0]=='/')){ f= fopen(VAR_1, "r"); } if(!f){ fprintf(stderr, "Preset file not found\n"); av_exit(1); } while(!feof(f)){ int VAR_7= fscanf(f, "%999[^\n]\n", VAR_4) - 1; if(VAR_4[0] == '#' && !VAR_7) continue; VAR_7|= sscanf(VAR_4, "%999[^=]=%999[^\n]\n", VAR_2, VAR_3) - 2; if(VAR_7){ fprintf(stderr, "Preset file invalid\n"); av_exit(1); } if(!strcmp(VAR_2, "acodec")){ opt_audio_codec(VAR_3); }else if(!strcmp(VAR_2, "vcodec")){ opt_video_codec(VAR_3); }else if(!strcmp(VAR_2, "scodec")){ opt_subtitle_codec(VAR_3); }else opt_default(VAR_2, VAR_3); } fclose(f); return 0; }
[ "static int FUNC_0(const char *VAR_0, const char *VAR_1)\n{", "FILE *f=NULL;", "char VAR_2[1000], VAR_3[1000], VAR_4[1000];", "int VAR_5;", "const char *VAR_6[3]= { getenv(\"HOME\"),", "\"/usr/local/share\",\n\"/usr/share\",\n};", "for(VAR_5=!VAR_6[0]; VAR_5<3 && !f; VAR_5++){", "snprintf(VAR_2, sizeof(VAR_2), \"%s/%sffmpeg/%s.ffpreset\", VAR_6[VAR_5], VAR_5 ? \"\" : \".\", VAR_1);", "f= fopen(VAR_2, \"r\");", "if(!f){", "char *codec_name= *VAR_0 == 'v' ? video_codec_name :\n*VAR_0 == 'a' ? audio_codec_name :\nsubtitle_codec_name;", "snprintf(VAR_2, sizeof(VAR_2), \"%s/%sffmpeg/%s-%s.ffpreset\", VAR_6[VAR_5], VAR_5 ? \"\" : \".\", codec_name, VAR_1);", "f= fopen(VAR_2, \"r\");", "}", "}", "if(!f && ((VAR_1[0]=='.' && VAR_1[1]=='/') || VAR_1[0]=='/')){", "f= fopen(VAR_1, \"r\");", "}", "if(!f){", "fprintf(stderr, \"Preset file not found\\n\");", "av_exit(1);", "}", "while(!feof(f)){", "int VAR_7= fscanf(f, \"%999[^\\n]\\n\", VAR_4) - 1;", "if(VAR_4[0] == '#' && !VAR_7)\ncontinue;", "VAR_7|= sscanf(VAR_4, \"%999[^=]=%999[^\\n]\\n\", VAR_2, VAR_3) - 2;", "if(VAR_7){", "fprintf(stderr, \"Preset file invalid\\n\");", "av_exit(1);", "}", "if(!strcmp(VAR_2, \"acodec\")){", "opt_audio_codec(VAR_3);", "}else if(!strcmp(VAR_2, \"vcodec\")){", "opt_video_codec(VAR_3);", "}else if(!strcmp(VAR_2, \"scodec\")){", "opt_subtitle_codec(VAR_3);", "}else", "opt_default(VAR_2, VAR_3);", "}", "fclose(f);", "return 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13, 15, 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29, 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 65, 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99 ], [ 103 ], [ 105 ] ]
2,345
static USBDevice *usb_msd_init(USBBus *bus, const char *filename) { static int nr=0; char id[8]; QemuOpts *opts; DriveInfo *dinfo; USBDevice *dev; const char *p1; char fmt[32]; /* parse -usbdevice disk: syntax into drive opts */ snprintf(id, sizeof(id), "usb%d", nr++); opts = qemu_opts_create(qemu_find_opts("drive"), id, 0); p1 = strchr(filename, ':'); if (p1++) { const char *p2; if (strstart(filename, "format=", &p2)) { int len = MIN(p1 - p2, sizeof(fmt)); pstrcpy(fmt, len, p2); qemu_opt_set(opts, "format", fmt); } else if (*filename != ':') { printf("unrecognized USB mass-storage option %s\n", filename); return NULL; } filename = p1; } if (!*filename) { printf("block device specification needed\n"); return NULL; } qemu_opt_set(opts, "file", filename); qemu_opt_set(opts, "if", "none"); /* create host drive */ dinfo = drive_init(opts, 0); if (!dinfo) { qemu_opts_del(opts); return NULL; } /* create guest device */ dev = usb_create(bus, "usb-storage"); if (!dev) { return NULL; } if (qdev_prop_set_drive(&dev->qdev, "drive", dinfo->bdrv) < 0) { qdev_free(&dev->qdev); return NULL; } if (qdev_init(&dev->qdev) < 0) return NULL; return dev; }
true
qemu
8be7e7e4c72c048b90e3482557954a24bba43ba7
static USBDevice *usb_msd_init(USBBus *bus, const char *filename) { static int nr=0; char id[8]; QemuOpts *opts; DriveInfo *dinfo; USBDevice *dev; const char *p1; char fmt[32]; snprintf(id, sizeof(id), "usb%d", nr++); opts = qemu_opts_create(qemu_find_opts("drive"), id, 0); p1 = strchr(filename, ':'); if (p1++) { const char *p2; if (strstart(filename, "format=", &p2)) { int len = MIN(p1 - p2, sizeof(fmt)); pstrcpy(fmt, len, p2); qemu_opt_set(opts, "format", fmt); } else if (*filename != ':') { printf("unrecognized USB mass-storage option %s\n", filename); return NULL; } filename = p1; } if (!*filename) { printf("block device specification needed\n"); return NULL; } qemu_opt_set(opts, "file", filename); qemu_opt_set(opts, "if", "none"); dinfo = drive_init(opts, 0); if (!dinfo) { qemu_opts_del(opts); return NULL; } dev = usb_create(bus, "usb-storage"); if (!dev) { return NULL; } if (qdev_prop_set_drive(&dev->qdev, "drive", dinfo->bdrv) < 0) { qdev_free(&dev->qdev); return NULL; } if (qdev_init(&dev->qdev) < 0) return NULL; return dev; }
{ "code": [ " opts = qemu_opts_create(qemu_find_opts(\"drive\"), id, 0);" ], "line_no": [ 25 ] }
static USBDevice *FUNC_0(USBBus *bus, const char *filename) { static int VAR_0=0; char VAR_1[8]; QemuOpts *opts; DriveInfo *dinfo; USBDevice *dev; const char *VAR_2; char VAR_3[32]; snprintf(VAR_1, sizeof(VAR_1), "usb%d", VAR_0++); opts = qemu_opts_create(qemu_find_opts("drive"), VAR_1, 0); VAR_2 = strchr(filename, ':'); if (VAR_2++) { const char *VAR_4; if (strstart(filename, "format=", &VAR_4)) { int VAR_5 = MIN(VAR_2 - VAR_4, sizeof(VAR_3)); pstrcpy(VAR_3, VAR_5, VAR_4); qemu_opt_set(opts, "format", VAR_3); } else if (*filename != ':') { printf("unrecognized USB mass-storage option %s\n", filename); return NULL; } filename = VAR_2; } if (!*filename) { printf("block device specification needed\n"); return NULL; } qemu_opt_set(opts, "file", filename); qemu_opt_set(opts, "if", "none"); dinfo = drive_init(opts, 0); if (!dinfo) { qemu_opts_del(opts); return NULL; } dev = usb_create(bus, "usb-storage"); if (!dev) { return NULL; } if (qdev_prop_set_drive(&dev->qdev, "drive", dinfo->bdrv) < 0) { qdev_free(&dev->qdev); return NULL; } if (qdev_init(&dev->qdev) < 0) return NULL; return dev; }
[ "static USBDevice *FUNC_0(USBBus *bus, const char *filename)\n{", "static int VAR_0=0;", "char VAR_1[8];", "QemuOpts *opts;", "DriveInfo *dinfo;", "USBDevice *dev;", "const char *VAR_2;", "char VAR_3[32];", "snprintf(VAR_1, sizeof(VAR_1), \"usb%d\", VAR_0++);", "opts = qemu_opts_create(qemu_find_opts(\"drive\"), VAR_1, 0);", "VAR_2 = strchr(filename, ':');", "if (VAR_2++) {", "const char *VAR_4;", "if (strstart(filename, \"format=\", &VAR_4)) {", "int VAR_5 = MIN(VAR_2 - VAR_4, sizeof(VAR_3));", "pstrcpy(VAR_3, VAR_5, VAR_4);", "qemu_opt_set(opts, \"format\", VAR_3);", "} else if (*filename != ':') {", "printf(\"unrecognized USB mass-storage option %s\\n\", filename);", "return NULL;", "}", "filename = VAR_2;", "}", "if (!*filename) {", "printf(\"block device specification needed\\n\");", "return NULL;", "}", "qemu_opt_set(opts, \"file\", filename);", "qemu_opt_set(opts, \"if\", \"none\");", "dinfo = drive_init(opts, 0);", "if (!dinfo) {", "qemu_opts_del(opts);", "return NULL;", "}", "dev = usb_create(bus, \"usb-storage\");", "if (!dev) {", "return NULL;", "}", "if (qdev_prop_set_drive(&dev->qdev, \"drive\", dinfo->bdrv) < 0) {", "qdev_free(&dev->qdev);", "return NULL;", "}", "if (qdev_init(&dev->qdev) < 0)\nreturn NULL;", "return dev;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103, 105 ], [ 109 ], [ 111 ] ]
2,346
static void codebook_trellis_rate(AACEncContext *s, SingleChannelElement *sce, int win, int group_len, const float lambda) { BandCodingPath path[120][12]; int w, swb, cb, start, size; int i, j; const int max_sfb = sce->ics.max_sfb; const int run_bits = sce->ics.num_windows == 1 ? 5 : 3; const int run_esc = (1 << run_bits) - 1; int idx, ppos, count; int stackrun[120], stackcb[120], stack_len; float next_minbits = INFINITY; int next_mincb = 0; abs_pow34_v(s->scoefs, sce->coeffs, 1024); start = win*128; for (cb = 0; cb < 12; cb++) { path[0][cb].cost = run_bits+4; path[0][cb].prev_idx = -1; path[0][cb].run = 0; } for (swb = 0; swb < max_sfb; swb++) { size = sce->ics.swb_sizes[swb]; if (sce->zeroes[win*16 + swb]) { float cost_stay_here = path[swb][0].cost; float cost_get_here = next_minbits + run_bits + 4; if ( run_value_bits[sce->ics.num_windows == 8][path[swb][0].run] != run_value_bits[sce->ics.num_windows == 8][path[swb][0].run+1]) cost_stay_here += run_bits; if (cost_get_here < cost_stay_here) { path[swb+1][0].prev_idx = next_mincb; path[swb+1][0].cost = cost_get_here; path[swb+1][0].run = 1; } else { path[swb+1][0].prev_idx = 0; path[swb+1][0].cost = cost_stay_here; path[swb+1][0].run = path[swb][0].run + 1; } next_minbits = path[swb+1][0].cost; next_mincb = 0; for (cb = 1; cb < 12; cb++) { path[swb+1][cb].cost = 61450; path[swb+1][cb].prev_idx = -1; path[swb+1][cb].run = 0; } } else { float minbits = next_minbits; int mincb = next_mincb; int startcb = sce->band_type[win*16+swb]; next_minbits = INFINITY; next_mincb = 0; for (cb = 0; cb < startcb; cb++) { path[swb+1][cb].cost = 61450; path[swb+1][cb].prev_idx = -1; path[swb+1][cb].run = 0; } for (cb = startcb; cb < 12; cb++) { float cost_stay_here, cost_get_here; float bits = 0.0f; for (w = 0; w < group_len; w++) { bits += quantize_band_cost(s, sce->coeffs + start + w*128, s->scoefs + start + w*128, size, sce->sf_idx[(win+w)*16+swb], cb, 0, INFINITY, NULL); } cost_stay_here = path[swb][cb].cost + bits; cost_get_here = minbits + bits + run_bits + 4; if ( run_value_bits[sce->ics.num_windows == 8][path[swb][cb].run] != run_value_bits[sce->ics.num_windows == 8][path[swb][cb].run+1]) cost_stay_here += run_bits; if (cost_get_here < cost_stay_here) { path[swb+1][cb].prev_idx = mincb; path[swb+1][cb].cost = cost_get_here; path[swb+1][cb].run = 1; } else { path[swb+1][cb].prev_idx = cb; path[swb+1][cb].cost = cost_stay_here; path[swb+1][cb].run = path[swb][cb].run + 1; } if (path[swb+1][cb].cost < next_minbits) { next_minbits = path[swb+1][cb].cost; next_mincb = cb; } } } start += sce->ics.swb_sizes[swb]; } //convert resulting path from backward-linked list stack_len = 0; idx = 0; for (cb = 1; cb < 12; cb++) if (path[max_sfb][cb].cost < path[max_sfb][idx].cost) idx = cb; ppos = max_sfb; while (ppos > 0) { av_assert1(idx >= 0); cb = idx; stackrun[stack_len] = path[ppos][cb].run; stackcb [stack_len] = cb; idx = path[ppos-path[ppos][cb].run+1][cb].prev_idx; ppos -= path[ppos][cb].run; stack_len++; } //perform actual band info encoding start = 0; for (i = stack_len - 1; i >= 0; i--) { put_bits(&s->pb, 4, stackcb[i]); count = stackrun[i]; memset(sce->zeroes + win*16 + start, !stackcb[i], count); //XXX: memset when band_type is also uint8_t for (j = 0; j < count; j++) { sce->band_type[win*16 + start] = stackcb[i]; start++; } while (count >= run_esc) { put_bits(&s->pb, run_bits, run_esc); count -= run_esc; } put_bits(&s->pb, run_bits, count); } }
true
FFmpeg
c5d4f87e81111427c0952278ec247fa8ab1e6e52
static void codebook_trellis_rate(AACEncContext *s, SingleChannelElement *sce, int win, int group_len, const float lambda) { BandCodingPath path[120][12]; int w, swb, cb, start, size; int i, j; const int max_sfb = sce->ics.max_sfb; const int run_bits = sce->ics.num_windows == 1 ? 5 : 3; const int run_esc = (1 << run_bits) - 1; int idx, ppos, count; int stackrun[120], stackcb[120], stack_len; float next_minbits = INFINITY; int next_mincb = 0; abs_pow34_v(s->scoefs, sce->coeffs, 1024); start = win*128; for (cb = 0; cb < 12; cb++) { path[0][cb].cost = run_bits+4; path[0][cb].prev_idx = -1; path[0][cb].run = 0; } for (swb = 0; swb < max_sfb; swb++) { size = sce->ics.swb_sizes[swb]; if (sce->zeroes[win*16 + swb]) { float cost_stay_here = path[swb][0].cost; float cost_get_here = next_minbits + run_bits + 4; if ( run_value_bits[sce->ics.num_windows == 8][path[swb][0].run] != run_value_bits[sce->ics.num_windows == 8][path[swb][0].run+1]) cost_stay_here += run_bits; if (cost_get_here < cost_stay_here) { path[swb+1][0].prev_idx = next_mincb; path[swb+1][0].cost = cost_get_here; path[swb+1][0].run = 1; } else { path[swb+1][0].prev_idx = 0; path[swb+1][0].cost = cost_stay_here; path[swb+1][0].run = path[swb][0].run + 1; } next_minbits = path[swb+1][0].cost; next_mincb = 0; for (cb = 1; cb < 12; cb++) { path[swb+1][cb].cost = 61450; path[swb+1][cb].prev_idx = -1; path[swb+1][cb].run = 0; } } else { float minbits = next_minbits; int mincb = next_mincb; int startcb = sce->band_type[win*16+swb]; next_minbits = INFINITY; next_mincb = 0; for (cb = 0; cb < startcb; cb++) { path[swb+1][cb].cost = 61450; path[swb+1][cb].prev_idx = -1; path[swb+1][cb].run = 0; } for (cb = startcb; cb < 12; cb++) { float cost_stay_here, cost_get_here; float bits = 0.0f; for (w = 0; w < group_len; w++) { bits += quantize_band_cost(s, sce->coeffs + start + w*128, s->scoefs + start + w*128, size, sce->sf_idx[(win+w)*16+swb], cb, 0, INFINITY, NULL); } cost_stay_here = path[swb][cb].cost + bits; cost_get_here = minbits + bits + run_bits + 4; if ( run_value_bits[sce->ics.num_windows == 8][path[swb][cb].run] != run_value_bits[sce->ics.num_windows == 8][path[swb][cb].run+1]) cost_stay_here += run_bits; if (cost_get_here < cost_stay_here) { path[swb+1][cb].prev_idx = mincb; path[swb+1][cb].cost = cost_get_here; path[swb+1][cb].run = 1; } else { path[swb+1][cb].prev_idx = cb; path[swb+1][cb].cost = cost_stay_here; path[swb+1][cb].run = path[swb][cb].run + 1; } if (path[swb+1][cb].cost < next_minbits) { next_minbits = path[swb+1][cb].cost; next_mincb = cb; } } } start += sce->ics.swb_sizes[swb]; } stack_len = 0; idx = 0; for (cb = 1; cb < 12; cb++) if (path[max_sfb][cb].cost < path[max_sfb][idx].cost) idx = cb; ppos = max_sfb; while (ppos > 0) { av_assert1(idx >= 0); cb = idx; stackrun[stack_len] = path[ppos][cb].run; stackcb [stack_len] = cb; idx = path[ppos-path[ppos][cb].run+1][cb].prev_idx; ppos -= path[ppos][cb].run; stack_len++; } start = 0; for (i = stack_len - 1; i >= 0; i--) { put_bits(&s->pb, 4, stackcb[i]); count = stackrun[i]; memset(sce->zeroes + win*16 + start, !stackcb[i], count); for (j = 0; j < count; j++) { sce->band_type[win*16 + start] = stackcb[i]; start++; } while (count >= run_esc) { put_bits(&s->pb, run_bits, run_esc); count -= run_esc; } put_bits(&s->pb, run_bits, count); } }
{ "code": [ " BandCodingPath path[120][12];", " for (cb = 0; cb < 12; cb++) {", " for (cb = 1; cb < 12; cb++)", " put_bits(&s->pb, 4, stackcb[i]);", " memset(sce->zeroes + win*16 + start, !stackcb[i], count);", " sce->band_type[win*16 + start] = stackcb[i];", " BandCodingPath path[120][12];", " for (cb = 0; cb < 12; cb++) {", " for (cb = 1; cb < 12; cb++) {", " for (cb = startcb; cb < 12; cb++) {", " sce->sf_idx[(win+w)*16+swb], cb,", " for (cb = 1; cb < 12; cb++)", " put_bits(&s->pb, 4, stackcb[i]);", " memset(sce->zeroes + win*16 + start, !stackcb[i], count);", " sce->band_type[win*16 + start] = stackcb[i];" ], "line_no": [ 7, 33, 183, 215, 219, 225, 7, 33, 81, 113, 125, 183, 215, 219, 225 ] }
static void FUNC_0(AACEncContext *VAR_0, SingleChannelElement *VAR_1, int VAR_2, int VAR_3, const float VAR_4) { BandCodingPath path[120][12]; int VAR_5, VAR_6, VAR_7, VAR_8, VAR_9; int VAR_10, VAR_11; const int VAR_12 = VAR_1->ics.VAR_12; const int VAR_13 = VAR_1->ics.num_windows == 1 ? 5 : 3; const int VAR_14 = (1 << VAR_13) - 1; int VAR_15, VAR_16, VAR_17; int VAR_18[120], VAR_19[120], VAR_20; float VAR_21 = INFINITY; int VAR_22 = 0; abs_pow34_v(VAR_0->scoefs, VAR_1->coeffs, 1024); VAR_8 = VAR_2*128; for (VAR_7 = 0; VAR_7 < 12; VAR_7++) { path[0][VAR_7].cost = VAR_13+4; path[0][VAR_7].prev_idx = -1; path[0][VAR_7].run = 0; } for (VAR_6 = 0; VAR_6 < VAR_12; VAR_6++) { VAR_9 = VAR_1->ics.swb_sizes[VAR_6]; if (VAR_1->zeroes[VAR_2*16 + VAR_6]) { float VAR_28 = path[VAR_6][0].cost; float VAR_28 = VAR_21 + VAR_13 + 4; if ( run_value_bits[VAR_1->ics.num_windows == 8][path[VAR_6][0].run] != run_value_bits[VAR_1->ics.num_windows == 8][path[VAR_6][0].run+1]) VAR_28 += VAR_13; if (VAR_28 < VAR_28) { path[VAR_6+1][0].prev_idx = VAR_22; path[VAR_6+1][0].cost = VAR_28; path[VAR_6+1][0].run = 1; } else { path[VAR_6+1][0].prev_idx = 0; path[VAR_6+1][0].cost = VAR_28; path[VAR_6+1][0].run = path[VAR_6][0].run + 1; } VAR_21 = path[VAR_6+1][0].cost; VAR_22 = 0; for (VAR_7 = 1; VAR_7 < 12; VAR_7++) { path[VAR_6+1][VAR_7].cost = 61450; path[VAR_6+1][VAR_7].prev_idx = -1; path[VAR_6+1][VAR_7].run = 0; } } else { float VAR_25 = VAR_21; int VAR_26 = VAR_22; int VAR_27 = VAR_1->band_type[VAR_2*16+VAR_6]; VAR_21 = INFINITY; VAR_22 = 0; for (VAR_7 = 0; VAR_7 < VAR_27; VAR_7++) { path[VAR_6+1][VAR_7].cost = 61450; path[VAR_6+1][VAR_7].prev_idx = -1; path[VAR_6+1][VAR_7].run = 0; } for (VAR_7 = VAR_27; VAR_7 < 12; VAR_7++) { float VAR_28, VAR_28; float VAR_28 = 0.0f; for (VAR_5 = 0; VAR_5 < VAR_3; VAR_5++) { VAR_28 += quantize_band_cost(VAR_0, VAR_1->coeffs + VAR_8 + VAR_5*128, VAR_0->scoefs + VAR_8 + VAR_5*128, VAR_9, VAR_1->sf_idx[(VAR_2+VAR_5)*16+VAR_6], VAR_7, 0, INFINITY, NULL); } VAR_28 = path[VAR_6][VAR_7].cost + VAR_28; VAR_28 = VAR_25 + VAR_28 + VAR_13 + 4; if ( run_value_bits[VAR_1->ics.num_windows == 8][path[VAR_6][VAR_7].run] != run_value_bits[VAR_1->ics.num_windows == 8][path[VAR_6][VAR_7].run+1]) VAR_28 += VAR_13; if (VAR_28 < VAR_28) { path[VAR_6+1][VAR_7].prev_idx = VAR_26; path[VAR_6+1][VAR_7].cost = VAR_28; path[VAR_6+1][VAR_7].run = 1; } else { path[VAR_6+1][VAR_7].prev_idx = VAR_7; path[VAR_6+1][VAR_7].cost = VAR_28; path[VAR_6+1][VAR_7].run = path[VAR_6][VAR_7].run + 1; } if (path[VAR_6+1][VAR_7].cost < VAR_21) { VAR_21 = path[VAR_6+1][VAR_7].cost; VAR_22 = VAR_7; } } } VAR_8 += VAR_1->ics.swb_sizes[VAR_6]; } VAR_20 = 0; VAR_15 = 0; for (VAR_7 = 1; VAR_7 < 12; VAR_7++) if (path[VAR_12][VAR_7].cost < path[VAR_12][VAR_15].cost) VAR_15 = VAR_7; VAR_16 = VAR_12; while (VAR_16 > 0) { av_assert1(VAR_15 >= 0); VAR_7 = VAR_15; VAR_18[VAR_20] = path[VAR_16][VAR_7].run; VAR_19 [VAR_20] = VAR_7; VAR_15 = path[VAR_16-path[VAR_16][VAR_7].run+1][VAR_7].prev_idx; VAR_16 -= path[VAR_16][VAR_7].run; VAR_20++; } VAR_8 = 0; for (VAR_10 = VAR_20 - 1; VAR_10 >= 0; VAR_10--) { put_bits(&VAR_0->pb, 4, VAR_19[VAR_10]); VAR_17 = VAR_18[VAR_10]; memset(VAR_1->zeroes + VAR_2*16 + VAR_8, !VAR_19[VAR_10], VAR_17); for (VAR_11 = 0; VAR_11 < VAR_17; VAR_11++) { VAR_1->band_type[VAR_2*16 + VAR_8] = VAR_19[VAR_10]; VAR_8++; } while (VAR_17 >= VAR_14) { put_bits(&VAR_0->pb, VAR_13, VAR_14); VAR_17 -= VAR_14; } put_bits(&VAR_0->pb, VAR_13, VAR_17); } }
[ "static void FUNC_0(AACEncContext *VAR_0, SingleChannelElement *VAR_1,\nint VAR_2, int VAR_3, const float VAR_4)\n{", "BandCodingPath path[120][12];", "int VAR_5, VAR_6, VAR_7, VAR_8, VAR_9;", "int VAR_10, VAR_11;", "const int VAR_12 = VAR_1->ics.VAR_12;", "const int VAR_13 = VAR_1->ics.num_windows == 1 ? 5 : 3;", "const int VAR_14 = (1 << VAR_13) - 1;", "int VAR_15, VAR_16, VAR_17;", "int VAR_18[120], VAR_19[120], VAR_20;", "float VAR_21 = INFINITY;", "int VAR_22 = 0;", "abs_pow34_v(VAR_0->scoefs, VAR_1->coeffs, 1024);", "VAR_8 = VAR_2*128;", "for (VAR_7 = 0; VAR_7 < 12; VAR_7++) {", "path[0][VAR_7].cost = VAR_13+4;", "path[0][VAR_7].prev_idx = -1;", "path[0][VAR_7].run = 0;", "}", "for (VAR_6 = 0; VAR_6 < VAR_12; VAR_6++) {", "VAR_9 = VAR_1->ics.swb_sizes[VAR_6];", "if (VAR_1->zeroes[VAR_2*16 + VAR_6]) {", "float VAR_28 = path[VAR_6][0].cost;", "float VAR_28 = VAR_21 + VAR_13 + 4;", "if ( run_value_bits[VAR_1->ics.num_windows == 8][path[VAR_6][0].run]\n!= run_value_bits[VAR_1->ics.num_windows == 8][path[VAR_6][0].run+1])\nVAR_28 += VAR_13;", "if (VAR_28 < VAR_28) {", "path[VAR_6+1][0].prev_idx = VAR_22;", "path[VAR_6+1][0].cost = VAR_28;", "path[VAR_6+1][0].run = 1;", "} else {", "path[VAR_6+1][0].prev_idx = 0;", "path[VAR_6+1][0].cost = VAR_28;", "path[VAR_6+1][0].run = path[VAR_6][0].run + 1;", "}", "VAR_21 = path[VAR_6+1][0].cost;", "VAR_22 = 0;", "for (VAR_7 = 1; VAR_7 < 12; VAR_7++) {", "path[VAR_6+1][VAR_7].cost = 61450;", "path[VAR_6+1][VAR_7].prev_idx = -1;", "path[VAR_6+1][VAR_7].run = 0;", "}", "} else {", "float VAR_25 = VAR_21;", "int VAR_26 = VAR_22;", "int VAR_27 = VAR_1->band_type[VAR_2*16+VAR_6];", "VAR_21 = INFINITY;", "VAR_22 = 0;", "for (VAR_7 = 0; VAR_7 < VAR_27; VAR_7++) {", "path[VAR_6+1][VAR_7].cost = 61450;", "path[VAR_6+1][VAR_7].prev_idx = -1;", "path[VAR_6+1][VAR_7].run = 0;", "}", "for (VAR_7 = VAR_27; VAR_7 < 12; VAR_7++) {", "float VAR_28, VAR_28;", "float VAR_28 = 0.0f;", "for (VAR_5 = 0; VAR_5 < VAR_3; VAR_5++) {", "VAR_28 += quantize_band_cost(VAR_0, VAR_1->coeffs + VAR_8 + VAR_5*128,\nVAR_0->scoefs + VAR_8 + VAR_5*128, VAR_9,\nVAR_1->sf_idx[(VAR_2+VAR_5)*16+VAR_6], VAR_7,\n0, INFINITY, NULL);", "}", "VAR_28 = path[VAR_6][VAR_7].cost + VAR_28;", "VAR_28 = VAR_25 + VAR_28 + VAR_13 + 4;", "if ( run_value_bits[VAR_1->ics.num_windows == 8][path[VAR_6][VAR_7].run]\n!= run_value_bits[VAR_1->ics.num_windows == 8][path[VAR_6][VAR_7].run+1])\nVAR_28 += VAR_13;", "if (VAR_28 < VAR_28) {", "path[VAR_6+1][VAR_7].prev_idx = VAR_26;", "path[VAR_6+1][VAR_7].cost = VAR_28;", "path[VAR_6+1][VAR_7].run = 1;", "} else {", "path[VAR_6+1][VAR_7].prev_idx = VAR_7;", "path[VAR_6+1][VAR_7].cost = VAR_28;", "path[VAR_6+1][VAR_7].run = path[VAR_6][VAR_7].run + 1;", "}", "if (path[VAR_6+1][VAR_7].cost < VAR_21) {", "VAR_21 = path[VAR_6+1][VAR_7].cost;", "VAR_22 = VAR_7;", "}", "}", "}", "VAR_8 += VAR_1->ics.swb_sizes[VAR_6];", "}", "VAR_20 = 0;", "VAR_15 = 0;", "for (VAR_7 = 1; VAR_7 < 12; VAR_7++)", "if (path[VAR_12][VAR_7].cost < path[VAR_12][VAR_15].cost)\nVAR_15 = VAR_7;", "VAR_16 = VAR_12;", "while (VAR_16 > 0) {", "av_assert1(VAR_15 >= 0);", "VAR_7 = VAR_15;", "VAR_18[VAR_20] = path[VAR_16][VAR_7].run;", "VAR_19 [VAR_20] = VAR_7;", "VAR_15 = path[VAR_16-path[VAR_16][VAR_7].run+1][VAR_7].prev_idx;", "VAR_16 -= path[VAR_16][VAR_7].run;", "VAR_20++;", "}", "VAR_8 = 0;", "for (VAR_10 = VAR_20 - 1; VAR_10 >= 0; VAR_10--) {", "put_bits(&VAR_0->pb, 4, VAR_19[VAR_10]);", "VAR_17 = VAR_18[VAR_10];", "memset(VAR_1->zeroes + VAR_2*16 + VAR_8, !VAR_19[VAR_10], VAR_17);", "for (VAR_11 = 0; VAR_11 < VAR_17; VAR_11++) {", "VAR_1->band_type[VAR_2*16 + VAR_8] = VAR_19[VAR_10];", "VAR_8++;", "}", "while (VAR_17 >= VAR_14) {", "put_bits(&VAR_0->pb, VAR_13, VAR_14);", "VAR_17 -= VAR_14;", "}", "put_bits(&VAR_0->pb, VAR_13, VAR_17);", "}", "}" ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53, 55, 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 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 ], [ 179 ], [ 181 ], [ 183 ], [ 185, 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ] ]
2,347
av_cold void ff_mlpdsp_init_arm(MLPDSPContext *c) { int cpu_flags = av_get_cpu_flags(); if (have_armv5te(cpu_flags)) { c->mlp_filter_channel = ff_mlp_filter_channel_arm; } }
true
FFmpeg
89135716fd4c2963e01e0155547c47bf709f1aa3
av_cold void ff_mlpdsp_init_arm(MLPDSPContext *c) { int cpu_flags = av_get_cpu_flags(); if (have_armv5te(cpu_flags)) { c->mlp_filter_channel = ff_mlp_filter_channel_arm; } }
{ "code": [], "line_no": [] }
av_cold void FUNC_0(MLPDSPContext *c) { int VAR_0 = av_get_cpu_flags(); if (have_armv5te(VAR_0)) { c->mlp_filter_channel = ff_mlp_filter_channel_arm; } }
[ "av_cold void FUNC_0(MLPDSPContext *c)\n{", "int VAR_0 = av_get_cpu_flags();", "if (have_armv5te(VAR_0)) {", "c->mlp_filter_channel = ff_mlp_filter_channel_arm;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 14 ], [ 16 ] ]
2,351
void slirp_pollfds_poll(GArray *pollfds, int select_error) { Slirp *slirp; struct socket *so, *so_next; int ret; if (QTAILQ_EMPTY(&slirp_instances)) { return; } curtime = qemu_clock_get_ms(QEMU_CLOCK_REALTIME); QTAILQ_FOREACH(slirp, &slirp_instances, entry) { /* * See if anything has timed out */ if (slirp->time_fasttimo && ((curtime - slirp->time_fasttimo) >= TIMEOUT_FAST)) { tcp_fasttimo(slirp); slirp->time_fasttimo = 0; } if (slirp->do_slowtimo && ((curtime - slirp->last_slowtimo) >= TIMEOUT_SLOW)) { ip_slowtimo(slirp); tcp_slowtimo(slirp); slirp->last_slowtimo = curtime; } /* * Check sockets */ if (!select_error) { /* * Check TCP sockets */ for (so = slirp->tcb.so_next; so != &slirp->tcb; so = so_next) { int revents; so_next = so->so_next; revents = 0; if (so->pollfds_idx != -1) { revents = g_array_index(pollfds, GPollFD, so->pollfds_idx).revents; } if (so->so_state & SS_NOFDREF || so->s == -1) { continue; } /* * Check for URG data * This will soread as well, so no need to * test for G_IO_IN below if this succeeds */ if (revents & G_IO_PRI) { sorecvoob(so); } /* * Check sockets for reading */ else if (revents & (G_IO_IN | G_IO_HUP | G_IO_ERR)) { /* * Check for incoming connections */ if (so->so_state & SS_FACCEPTCONN) { tcp_connect(so); continue; } /* else */ ret = soread(so); /* Output it if we read something */ if (ret > 0) { tcp_output(sototcpcb(so)); } } /* * Check sockets for writing */ if (!(so->so_state & SS_NOFDREF) && (revents & (G_IO_OUT | G_IO_ERR))) { /* * Check for non-blocking, still-connecting sockets */ if (so->so_state & SS_ISFCONNECTING) { /* Connected */ so->so_state &= ~SS_ISFCONNECTING; ret = send(so->s, (const void *) &ret, 0, 0); if (ret < 0) { /* XXXXX Must fix, zero bytes is a NOP */ if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINPROGRESS || errno == ENOTCONN) { continue; } /* else failed */ so->so_state &= SS_PERSISTENT_MASK; so->so_state |= SS_NOFDREF; } /* else so->so_state &= ~SS_ISFCONNECTING; */ /* * Continue tcp_input */ tcp_input((struct mbuf *)NULL, sizeof(struct ip), so, so->so_ffamily); /* continue; */ } else { ret = sowrite(so); } /* * XXXXX If we wrote something (a lot), there * could be a need for a window update. * In the worst case, the remote will send * a window probe to get things going again */ } /* * Probe a still-connecting, non-blocking socket * to check if it's still alive */ #ifdef PROBE_CONN if (so->so_state & SS_ISFCONNECTING) { ret = qemu_recv(so->s, &ret, 0, 0); if (ret < 0) { /* XXX */ if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINPROGRESS || errno == ENOTCONN) { continue; /* Still connecting, continue */ } /* else failed */ so->so_state &= SS_PERSISTENT_MASK; so->so_state |= SS_NOFDREF; /* tcp_input will take care of it */ } else { ret = send(so->s, &ret, 0, 0); if (ret < 0) { /* XXX */ if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINPROGRESS || errno == ENOTCONN) { continue; } /* else failed */ so->so_state &= SS_PERSISTENT_MASK; so->so_state |= SS_NOFDREF; } else { so->so_state &= ~SS_ISFCONNECTING; } } tcp_input((struct mbuf *)NULL, sizeof(struct ip), so, so->so_ffamily); } /* SS_ISFCONNECTING */ #endif } /* * Now UDP sockets. * Incoming packets are sent straight away, they're not buffered. * Incoming UDP data isn't buffered either. */ for (so = slirp->udb.so_next; so != &slirp->udb; so = so_next) { int revents; so_next = so->so_next; revents = 0; if (so->pollfds_idx != -1) { revents = g_array_index(pollfds, GPollFD, so->pollfds_idx).revents; } if (so->s != -1 && (revents & (G_IO_IN | G_IO_HUP | G_IO_ERR))) { sorecvfrom(so); } } /* * Check incoming ICMP relies. */ for (so = slirp->icmp.so_next; so != &slirp->icmp; so = so_next) { int revents; so_next = so->so_next; revents = 0; if (so->pollfds_idx != -1) { revents = g_array_index(pollfds, GPollFD, so->pollfds_idx).revents; } if (so->s != -1 && (revents & (G_IO_IN | G_IO_HUP | G_IO_ERR))) { icmp_receive(so); } } } if_start(slirp); } }
true
qemu
bfb1ac14029ee72b19296109fba880c0551755d5
void slirp_pollfds_poll(GArray *pollfds, int select_error) { Slirp *slirp; struct socket *so, *so_next; int ret; if (QTAILQ_EMPTY(&slirp_instances)) { return; } curtime = qemu_clock_get_ms(QEMU_CLOCK_REALTIME); QTAILQ_FOREACH(slirp, &slirp_instances, entry) { if (slirp->time_fasttimo && ((curtime - slirp->time_fasttimo) >= TIMEOUT_FAST)) { tcp_fasttimo(slirp); slirp->time_fasttimo = 0; } if (slirp->do_slowtimo && ((curtime - slirp->last_slowtimo) >= TIMEOUT_SLOW)) { ip_slowtimo(slirp); tcp_slowtimo(slirp); slirp->last_slowtimo = curtime; } if (!select_error) { for (so = slirp->tcb.so_next; so != &slirp->tcb; so = so_next) { int revents; so_next = so->so_next; revents = 0; if (so->pollfds_idx != -1) { revents = g_array_index(pollfds, GPollFD, so->pollfds_idx).revents; } if (so->so_state & SS_NOFDREF || so->s == -1) { continue; } if (revents & G_IO_PRI) { sorecvoob(so); } else if (revents & (G_IO_IN | G_IO_HUP | G_IO_ERR)) { if (so->so_state & SS_FACCEPTCONN) { tcp_connect(so); continue; } ret = soread(so); if (ret > 0) { tcp_output(sototcpcb(so)); } } if (!(so->so_state & SS_NOFDREF) && (revents & (G_IO_OUT | G_IO_ERR))) { if (so->so_state & SS_ISFCONNECTING) { so->so_state &= ~SS_ISFCONNECTING; ret = send(so->s, (const void *) &ret, 0, 0); if (ret < 0) { if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINPROGRESS || errno == ENOTCONN) { continue; } so->so_state &= SS_PERSISTENT_MASK; so->so_state |= SS_NOFDREF; } tcp_input((struct mbuf *)NULL, sizeof(struct ip), so, so->so_ffamily); } else { ret = sowrite(so); } } #ifdef PROBE_CONN if (so->so_state & SS_ISFCONNECTING) { ret = qemu_recv(so->s, &ret, 0, 0); if (ret < 0) { if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINPROGRESS || errno == ENOTCONN) { continue; } so->so_state &= SS_PERSISTENT_MASK; so->so_state |= SS_NOFDREF; } else { ret = send(so->s, &ret, 0, 0); if (ret < 0) { if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINPROGRESS || errno == ENOTCONN) { continue; } so->so_state &= SS_PERSISTENT_MASK; so->so_state |= SS_NOFDREF; } else { so->so_state &= ~SS_ISFCONNECTING; } } tcp_input((struct mbuf *)NULL, sizeof(struct ip), so, so->so_ffamily); } #endif } for (so = slirp->udb.so_next; so != &slirp->udb; so = so_next) { int revents; so_next = so->so_next; revents = 0; if (so->pollfds_idx != -1) { revents = g_array_index(pollfds, GPollFD, so->pollfds_idx).revents; } if (so->s != -1 && (revents & (G_IO_IN | G_IO_HUP | G_IO_ERR))) { sorecvfrom(so); } } for (so = slirp->icmp.so_next; so != &slirp->icmp; so = so_next) { int revents; so_next = so->so_next; revents = 0; if (so->pollfds_idx != -1) { revents = g_array_index(pollfds, GPollFD, so->pollfds_idx).revents; } if (so->s != -1 && (revents & (G_IO_IN | G_IO_HUP | G_IO_ERR))) { icmp_receive(so); } } } if_start(slirp); } }
{ "code": [ " sorecvoob(so);" ], "line_no": [ 115 ] }
void FUNC_0(GArray *VAR_0, int VAR_1) { Slirp *slirp; struct socket *VAR_2, *VAR_3; int VAR_4; if (QTAILQ_EMPTY(&slirp_instances)) { return; } curtime = qemu_clock_get_ms(QEMU_CLOCK_REALTIME); QTAILQ_FOREACH(slirp, &slirp_instances, entry) { if (slirp->time_fasttimo && ((curtime - slirp->time_fasttimo) >= TIMEOUT_FAST)) { tcp_fasttimo(slirp); slirp->time_fasttimo = 0; } if (slirp->do_slowtimo && ((curtime - slirp->last_slowtimo) >= TIMEOUT_SLOW)) { ip_slowtimo(slirp); tcp_slowtimo(slirp); slirp->last_slowtimo = curtime; } if (!VAR_1) { for (VAR_2 = slirp->tcb.VAR_3; VAR_2 != &slirp->tcb; VAR_2 = VAR_3) { int revents; VAR_3 = VAR_2->VAR_3; revents = 0; if (VAR_2->pollfds_idx != -1) { revents = g_array_index(VAR_0, GPollFD, VAR_2->pollfds_idx).revents; } if (VAR_2->so_state & SS_NOFDREF || VAR_2->s == -1) { continue; } if (revents & G_IO_PRI) { sorecvoob(VAR_2); } else if (revents & (G_IO_IN | G_IO_HUP | G_IO_ERR)) { if (VAR_2->so_state & SS_FACCEPTCONN) { tcp_connect(VAR_2); continue; } VAR_4 = soread(VAR_2); if (VAR_4 > 0) { tcp_output(sototcpcb(VAR_2)); } } if (!(VAR_2->so_state & SS_NOFDREF) && (revents & (G_IO_OUT | G_IO_ERR))) { if (VAR_2->so_state & SS_ISFCONNECTING) { VAR_2->so_state &= ~SS_ISFCONNECTING; VAR_4 = send(VAR_2->s, (const void *) &VAR_4, 0, 0); if (VAR_4 < 0) { if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINPROGRESS || errno == ENOTCONN) { continue; } VAR_2->so_state &= SS_PERSISTENT_MASK; VAR_2->so_state |= SS_NOFDREF; } tcp_input((struct mbuf *)NULL, sizeof(struct ip), VAR_2, VAR_2->so_ffamily); } else { VAR_4 = sowrite(VAR_2); } } #ifdef PROBE_CONN if (VAR_2->so_state & SS_ISFCONNECTING) { VAR_4 = qemu_recv(VAR_2->s, &VAR_4, 0, 0); if (VAR_4 < 0) { if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINPROGRESS || errno == ENOTCONN) { continue; } VAR_2->so_state &= SS_PERSISTENT_MASK; VAR_2->so_state |= SS_NOFDREF; } else { VAR_4 = send(VAR_2->s, &VAR_4, 0, 0); if (VAR_4 < 0) { if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINPROGRESS || errno == ENOTCONN) { continue; } VAR_2->so_state &= SS_PERSISTENT_MASK; VAR_2->so_state |= SS_NOFDREF; } else { VAR_2->so_state &= ~SS_ISFCONNECTING; } } tcp_input((struct mbuf *)NULL, sizeof(struct ip), VAR_2, VAR_2->so_ffamily); } #endif } for (VAR_2 = slirp->udb.VAR_3; VAR_2 != &slirp->udb; VAR_2 = VAR_3) { int revents; VAR_3 = VAR_2->VAR_3; revents = 0; if (VAR_2->pollfds_idx != -1) { revents = g_array_index(VAR_0, GPollFD, VAR_2->pollfds_idx).revents; } if (VAR_2->s != -1 && (revents & (G_IO_IN | G_IO_HUP | G_IO_ERR))) { sorecvfrom(VAR_2); } } for (VAR_2 = slirp->icmp.VAR_3; VAR_2 != &slirp->icmp; VAR_2 = VAR_3) { int revents; VAR_3 = VAR_2->VAR_3; revents = 0; if (VAR_2->pollfds_idx != -1) { revents = g_array_index(VAR_0, GPollFD, VAR_2->pollfds_idx).revents; } if (VAR_2->s != -1 && (revents & (G_IO_IN | G_IO_HUP | G_IO_ERR))) { icmp_receive(VAR_2); } } } if_start(slirp); } }
[ "void FUNC_0(GArray *VAR_0, int VAR_1)\n{", "Slirp *slirp;", "struct socket *VAR_2, *VAR_3;", "int VAR_4;", "if (QTAILQ_EMPTY(&slirp_instances)) {", "return;", "}", "curtime = qemu_clock_get_ms(QEMU_CLOCK_REALTIME);", "QTAILQ_FOREACH(slirp, &slirp_instances, entry) {", "if (slirp->time_fasttimo &&\n((curtime - slirp->time_fasttimo) >= TIMEOUT_FAST)) {", "tcp_fasttimo(slirp);", "slirp->time_fasttimo = 0;", "}", "if (slirp->do_slowtimo &&\n((curtime - slirp->last_slowtimo) >= TIMEOUT_SLOW)) {", "ip_slowtimo(slirp);", "tcp_slowtimo(slirp);", "slirp->last_slowtimo = curtime;", "}", "if (!VAR_1) {", "for (VAR_2 = slirp->tcb.VAR_3; VAR_2 != &slirp->tcb;", "VAR_2 = VAR_3) {", "int revents;", "VAR_3 = VAR_2->VAR_3;", "revents = 0;", "if (VAR_2->pollfds_idx != -1) {", "revents = g_array_index(VAR_0, GPollFD,\nVAR_2->pollfds_idx).revents;", "}", "if (VAR_2->so_state & SS_NOFDREF || VAR_2->s == -1) {", "continue;", "}", "if (revents & G_IO_PRI) {", "sorecvoob(VAR_2);", "}", "else if (revents & (G_IO_IN | G_IO_HUP | G_IO_ERR)) {", "if (VAR_2->so_state & SS_FACCEPTCONN) {", "tcp_connect(VAR_2);", "continue;", "}", "VAR_4 = soread(VAR_2);", "if (VAR_4 > 0) {", "tcp_output(sototcpcb(VAR_2));", "}", "}", "if (!(VAR_2->so_state & SS_NOFDREF) &&\n(revents & (G_IO_OUT | G_IO_ERR))) {", "if (VAR_2->so_state & SS_ISFCONNECTING) {", "VAR_2->so_state &= ~SS_ISFCONNECTING;", "VAR_4 = send(VAR_2->s, (const void *) &VAR_4, 0, 0);", "if (VAR_4 < 0) {", "if (errno == EAGAIN || errno == EWOULDBLOCK ||\nerrno == EINPROGRESS || errno == ENOTCONN) {", "continue;", "}", "VAR_2->so_state &= SS_PERSISTENT_MASK;", "VAR_2->so_state |= SS_NOFDREF;", "}", "tcp_input((struct mbuf *)NULL, sizeof(struct ip), VAR_2,\nVAR_2->so_ffamily);", "} else {", "VAR_4 = sowrite(VAR_2);", "}", "}", "#ifdef PROBE_CONN\nif (VAR_2->so_state & SS_ISFCONNECTING) {", "VAR_4 = qemu_recv(VAR_2->s, &VAR_4, 0, 0);", "if (VAR_4 < 0) {", "if (errno == EAGAIN || errno == EWOULDBLOCK ||\nerrno == EINPROGRESS || errno == ENOTCONN) {", "continue;", "}", "VAR_2->so_state &= SS_PERSISTENT_MASK;", "VAR_2->so_state |= SS_NOFDREF;", "} else {", "VAR_4 = send(VAR_2->s, &VAR_4, 0, 0);", "if (VAR_4 < 0) {", "if (errno == EAGAIN || errno == EWOULDBLOCK ||\nerrno == EINPROGRESS || errno == ENOTCONN) {", "continue;", "}", "VAR_2->so_state &= SS_PERSISTENT_MASK;", "VAR_2->so_state |= SS_NOFDREF;", "} else {", "VAR_2->so_state &= ~SS_ISFCONNECTING;", "}", "}", "tcp_input((struct mbuf *)NULL, sizeof(struct ip), VAR_2,\nVAR_2->so_ffamily);", "}", "#endif\n}", "for (VAR_2 = slirp->udb.VAR_3; VAR_2 != &slirp->udb;", "VAR_2 = VAR_3) {", "int revents;", "VAR_3 = VAR_2->VAR_3;", "revents = 0;", "if (VAR_2->pollfds_idx != -1) {", "revents = g_array_index(VAR_0, GPollFD,\nVAR_2->pollfds_idx).revents;", "}", "if (VAR_2->s != -1 &&\n(revents & (G_IO_IN | G_IO_HUP | G_IO_ERR))) {", "sorecvfrom(VAR_2);", "}", "}", "for (VAR_2 = slirp->icmp.VAR_3; VAR_2 != &slirp->icmp;", "VAR_2 = VAR_3) {", "int revents;", "VAR_3 = VAR_2->VAR_3;", "revents = 0;", "if (VAR_2->pollfds_idx != -1) {", "revents = g_array_index(VAR_0, GPollFD,\nVAR_2->pollfds_idx).revents;", "}", "if (VAR_2->s != -1 &&\n(revents & (G_IO_IN | G_IO_HUP | G_IO_ERR))) {", "icmp_receive(VAR_2);", "}", "}", "}", "if_start(slirp);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 25 ], [ 33, 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 63 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 83 ], [ 85 ], [ 87, 89 ], [ 91 ], [ 95 ], [ 97 ], [ 99 ], [ 113 ], [ 115 ], [ 117 ], [ 125 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 163, 165 ], [ 173 ], [ 177 ], [ 181 ], [ 183 ], [ 187, 189 ], [ 191 ], [ 193 ], [ 199 ], [ 201 ], [ 203 ], [ 215, 217 ], [ 221 ], [ 223 ], [ 225 ], [ 239 ], [ 251, 253 ], [ 255 ], [ 259 ], [ 263, 265 ], [ 267 ], [ 269 ], [ 275 ], [ 277 ], [ 283 ], [ 285 ], [ 287 ], [ 291, 293 ], [ 295 ], [ 297 ], [ 301 ], [ 303 ], [ 305 ], [ 307 ], [ 309 ], [ 313 ], [ 315, 317 ], [ 319 ], [ 321, 323 ], [ 337 ], [ 339 ], [ 341 ], [ 345 ], [ 349 ], [ 351 ], [ 353, 355 ], [ 357 ], [ 361, 363 ], [ 365 ], [ 367 ], [ 369 ], [ 379 ], [ 381 ], [ 383 ], [ 387 ], [ 391 ], [ 393 ], [ 395, 397 ], [ 399 ], [ 403, 405 ], [ 407 ], [ 409 ], [ 411 ], [ 413 ], [ 417 ], [ 419 ], [ 421 ] ]
2,353
SwsFunc yuv2rgb_init_mlib(SwsContext *c) { switch(c->dstFormat){ case PIX_FMT_RGB24: return mlib_YUV2RGB420_24; case PIX_FMT_BGR32: return mlib_YUV2ARGB420_32; case PIX_FMT_RGB32: return mlib_YUV2ABGR420_32; default: return NULL; } }
true
FFmpeg
428098165de4c3edfe42c1b7f00627d287015863
SwsFunc yuv2rgb_init_mlib(SwsContext *c) { switch(c->dstFormat){ case PIX_FMT_RGB24: return mlib_YUV2RGB420_24; case PIX_FMT_BGR32: return mlib_YUV2ARGB420_32; case PIX_FMT_RGB32: return mlib_YUV2ABGR420_32; default: return NULL; } }
{ "code": [ "\tswitch(c->dstFormat){", "\tswitch(c->dstFormat){", "\tswitch(c->dstFormat){", "\tcase PIX_FMT_RGB24: return mlib_YUV2RGB420_24;", "\tcase PIX_FMT_BGR32: return mlib_YUV2ARGB420_32;", "\tcase PIX_FMT_RGB32: return mlib_YUV2ABGR420_32;", "\tdefault: return NULL;" ], "line_no": [ 5, 5, 5, 7, 9, 11, 13 ] }
SwsFunc FUNC_0(SwsContext *c) { switch(c->dstFormat){ case PIX_FMT_RGB24: return mlib_YUV2RGB420_24; case PIX_FMT_BGR32: return mlib_YUV2ARGB420_32; case PIX_FMT_RGB32: return mlib_YUV2ABGR420_32; default: return NULL; } }
[ "SwsFunc FUNC_0(SwsContext *c)\n{", "switch(c->dstFormat){", "case PIX_FMT_RGB24: return mlib_YUV2RGB420_24;", "case PIX_FMT_BGR32: return mlib_YUV2ARGB420_32;", "case PIX_FMT_RGB32: return mlib_YUV2ABGR420_32;", "default: return NULL;", "}", "}" ]
[ 0, 1, 1, 1, 1, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ] ]
2,354
int ffio_ensure_seekback(AVIOContext *s, int64_t buf_size) { uint8_t *buffer; int max_buffer_size = s->max_packet_size ? s->max_packet_size : IO_BUFFER_SIZE; int filled = s->buf_end - s->buffer; ptrdiff_t checksum_ptr_offset = s->checksum_ptr ? s->checksum_ptr - s->buffer : -1; buf_size += s->buf_ptr - s->buffer + max_buffer_size; if (buf_size < filled || s->seekable || !s->read_packet) return 0; av_assert0(!s->write_flag); buffer = av_malloc(buf_size); if (!buffer) return AVERROR(ENOMEM); memcpy(buffer, s->buffer, filled); av_free(s->buffer); s->buf_ptr = buffer + (s->buf_ptr - s->buffer); s->buf_end = buffer + (s->buf_end - s->buffer); s->buffer = buffer; s->buffer_size = buf_size; return 0; }
true
FFmpeg
dc87758775e2ce8be84e4fe598e12416e83d2845
int ffio_ensure_seekback(AVIOContext *s, int64_t buf_size) { uint8_t *buffer; int max_buffer_size = s->max_packet_size ? s->max_packet_size : IO_BUFFER_SIZE; int filled = s->buf_end - s->buffer; ptrdiff_t checksum_ptr_offset = s->checksum_ptr ? s->checksum_ptr - s->buffer : -1; buf_size += s->buf_ptr - s->buffer + max_buffer_size; if (buf_size < filled || s->seekable || !s->read_packet) return 0; av_assert0(!s->write_flag); buffer = av_malloc(buf_size); if (!buffer) return AVERROR(ENOMEM); memcpy(buffer, s->buffer, filled); av_free(s->buffer); s->buf_ptr = buffer + (s->buf_ptr - s->buffer); s->buf_end = buffer + (s->buf_end - s->buffer); s->buffer = buffer; s->buffer_size = buf_size; return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(AVIOContext *VAR_0, int64_t VAR_1) { uint8_t *buffer; int VAR_2 = VAR_0->max_packet_size ? VAR_0->max_packet_size : IO_BUFFER_SIZE; int VAR_3 = VAR_0->buf_end - VAR_0->buffer; ptrdiff_t checksum_ptr_offset = VAR_0->checksum_ptr ? VAR_0->checksum_ptr - VAR_0->buffer : -1; VAR_1 += VAR_0->buf_ptr - VAR_0->buffer + VAR_2; if (VAR_1 < VAR_3 || VAR_0->seekable || !VAR_0->read_packet) return 0; av_assert0(!VAR_0->write_flag); buffer = av_malloc(VAR_1); if (!buffer) return AVERROR(ENOMEM); memcpy(buffer, VAR_0->buffer, VAR_3); av_free(VAR_0->buffer); VAR_0->buf_ptr = buffer + (VAR_0->buf_ptr - VAR_0->buffer); VAR_0->buf_end = buffer + (VAR_0->buf_end - VAR_0->buffer); VAR_0->buffer = buffer; VAR_0->buffer_size = VAR_1; return 0; }
[ "int FUNC_0(AVIOContext *VAR_0, int64_t VAR_1)\n{", "uint8_t *buffer;", "int VAR_2 = VAR_0->max_packet_size ?\nVAR_0->max_packet_size : IO_BUFFER_SIZE;", "int VAR_3 = VAR_0->buf_end - VAR_0->buffer;", "ptrdiff_t checksum_ptr_offset = VAR_0->checksum_ptr ? VAR_0->checksum_ptr - VAR_0->buffer : -1;", "VAR_1 += VAR_0->buf_ptr - VAR_0->buffer + VAR_2;", "if (VAR_1 < VAR_3 || VAR_0->seekable || !VAR_0->read_packet)\nreturn 0;", "av_assert0(!VAR_0->write_flag);", "buffer = av_malloc(VAR_1);", "if (!buffer)\nreturn AVERROR(ENOMEM);", "memcpy(buffer, VAR_0->buffer, VAR_3);", "av_free(VAR_0->buffer);", "VAR_0->buf_ptr = buffer + (VAR_0->buf_ptr - VAR_0->buffer);", "VAR_0->buf_end = buffer + (VAR_0->buf_end - VAR_0->buffer);", "VAR_0->buffer = buffer;", "VAR_0->buffer_size = VAR_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 ], [ 11 ], [ 13 ], [ 17 ], [ 21, 23 ], [ 25 ], [ 29 ], [ 31, 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ] ]
2,355
static void raise_mmu_exception(CPUMIPSState *env, target_ulong address, int rw, int tlb_error) { CPUState *cs = CPU(mips_env_get_cpu(env)); int exception = 0, error_code = 0; if (rw == MMU_INST_FETCH) { error_code |= EXCP_INST_NOTAVAIL; } switch (tlb_error) { default: case TLBRET_BADADDR: /* Reference to kernel address from user mode or supervisor mode */ /* Reference to supervisor address from user mode */ if (rw == MMU_DATA_STORE) { exception = EXCP_AdES; } else { exception = EXCP_AdEL; } break; case TLBRET_NOMATCH: /* No TLB match for a mapped address */ if (rw == MMU_DATA_STORE) { exception = EXCP_TLBS; } else { exception = EXCP_TLBL; } error_code |= EXCP_TLB_NOMATCH; break; case TLBRET_INVALID: /* TLB match with no valid bit */ if (rw == MMU_DATA_STORE) { exception = EXCP_TLBS; } else { exception = EXCP_TLBL; } break; case TLBRET_DIRTY: /* TLB match but 'D' bit is cleared */ exception = EXCP_LTLBL; break; case TLBRET_XI: /* Execute-Inhibit Exception */ if (env->CP0_PageGrain & (1 << CP0PG_IEC)) { exception = EXCP_TLBXI; } else { exception = EXCP_TLBL; } break; case TLBRET_RI: /* Read-Inhibit Exception */ if (env->CP0_PageGrain & (1 << CP0PG_IEC)) { exception = EXCP_TLBRI; } else { exception = EXCP_TLBL; } break; } /* Raise exception */ env->CP0_BadVAddr = address; env->CP0_Context = (env->CP0_Context & ~0x007fffff) | ((address >> 9) & 0x007ffff0); env->CP0_EntryHi = (env->CP0_EntryHi & env->CP0_EntryHi_ASID_mask) | (address & (TARGET_PAGE_MASK << 1)); #if defined(TARGET_MIPS64) env->CP0_EntryHi &= env->SEGMask; env->CP0_XContext = /* PTEBase */ (env->CP0_XContext & ((~0ULL) << (env->SEGBITS - 7))) | /* R */ (extract64(address, 62, 2) << (env->SEGBITS - 9)) | /* BadVPN2 */ (extract64(address, 13, env->SEGBITS - 13) << 4); #endif cs->exception_index = exception; env->error_code = error_code; }
true
qemu
701074a6fc7470d0ed54e4a4bcd4d491ad8da22e
static void raise_mmu_exception(CPUMIPSState *env, target_ulong address, int rw, int tlb_error) { CPUState *cs = CPU(mips_env_get_cpu(env)); int exception = 0, error_code = 0; if (rw == MMU_INST_FETCH) { error_code |= EXCP_INST_NOTAVAIL; } switch (tlb_error) { default: case TLBRET_BADADDR: if (rw == MMU_DATA_STORE) { exception = EXCP_AdES; } else { exception = EXCP_AdEL; } break; case TLBRET_NOMATCH: if (rw == MMU_DATA_STORE) { exception = EXCP_TLBS; } else { exception = EXCP_TLBL; } error_code |= EXCP_TLB_NOMATCH; break; case TLBRET_INVALID: if (rw == MMU_DATA_STORE) { exception = EXCP_TLBS; } else { exception = EXCP_TLBL; } break; case TLBRET_DIRTY: exception = EXCP_LTLBL; break; case TLBRET_XI: if (env->CP0_PageGrain & (1 << CP0PG_IEC)) { exception = EXCP_TLBXI; } else { exception = EXCP_TLBL; } break; case TLBRET_RI: if (env->CP0_PageGrain & (1 << CP0PG_IEC)) { exception = EXCP_TLBRI; } else { exception = EXCP_TLBL; } break; } env->CP0_BadVAddr = address; env->CP0_Context = (env->CP0_Context & ~0x007fffff) | ((address >> 9) & 0x007ffff0); env->CP0_EntryHi = (env->CP0_EntryHi & env->CP0_EntryHi_ASID_mask) | (address & (TARGET_PAGE_MASK << 1)); #if defined(TARGET_MIPS64) env->CP0_EntryHi &= env->SEGMask; env->CP0_XContext = (env->CP0_XContext & ((~0ULL) << (env->SEGBITS - 7))) | (extract64(address, 62, 2) << (env->SEGBITS - 9)) | (extract64(address, 13, env->SEGBITS - 13) << 4); #endif cs->exception_index = exception; env->error_code = error_code; }
{ "code": [], "line_no": [] }
static void FUNC_0(CPUMIPSState *VAR_0, target_ulong VAR_1, int VAR_2, int VAR_3) { CPUState *cs = CPU(mips_env_get_cpu(VAR_0)); int VAR_4 = 0, VAR_5 = 0; if (VAR_2 == MMU_INST_FETCH) { VAR_5 |= EXCP_INST_NOTAVAIL; } switch (VAR_3) { default: case TLBRET_BADADDR: if (VAR_2 == MMU_DATA_STORE) { VAR_4 = EXCP_AdES; } else { VAR_4 = EXCP_AdEL; } break; case TLBRET_NOMATCH: if (VAR_2 == MMU_DATA_STORE) { VAR_4 = EXCP_TLBS; } else { VAR_4 = EXCP_TLBL; } VAR_5 |= EXCP_TLB_NOMATCH; break; case TLBRET_INVALID: if (VAR_2 == MMU_DATA_STORE) { VAR_4 = EXCP_TLBS; } else { VAR_4 = EXCP_TLBL; } break; case TLBRET_DIRTY: VAR_4 = EXCP_LTLBL; break; case TLBRET_XI: if (VAR_0->CP0_PageGrain & (1 << CP0PG_IEC)) { VAR_4 = EXCP_TLBXI; } else { VAR_4 = EXCP_TLBL; } break; case TLBRET_RI: if (VAR_0->CP0_PageGrain & (1 << CP0PG_IEC)) { VAR_4 = EXCP_TLBRI; } else { VAR_4 = EXCP_TLBL; } break; } VAR_0->CP0_BadVAddr = VAR_1; VAR_0->CP0_Context = (VAR_0->CP0_Context & ~0x007fffff) | ((VAR_1 >> 9) & 0x007ffff0); VAR_0->CP0_EntryHi = (VAR_0->CP0_EntryHi & VAR_0->CP0_EntryHi_ASID_mask) | (VAR_1 & (TARGET_PAGE_MASK << 1)); #if defined(TARGET_MIPS64) VAR_0->CP0_EntryHi &= VAR_0->SEGMask; VAR_0->CP0_XContext = (VAR_0->CP0_XContext & ((~0ULL) << (VAR_0->SEGBITS - 7))) | (extract64(VAR_1, 62, 2) << (VAR_0->SEGBITS - 9)) | (extract64(VAR_1, 13, VAR_0->SEGBITS - 13) << 4); #endif cs->exception_index = VAR_4; VAR_0->VAR_5 = VAR_5; }
[ "static void FUNC_0(CPUMIPSState *VAR_0, target_ulong VAR_1,\nint VAR_2, int VAR_3)\n{", "CPUState *cs = CPU(mips_env_get_cpu(VAR_0));", "int VAR_4 = 0, VAR_5 = 0;", "if (VAR_2 == MMU_INST_FETCH) {", "VAR_5 |= EXCP_INST_NOTAVAIL;", "}", "switch (VAR_3) {", "default:\ncase TLBRET_BADADDR:\nif (VAR_2 == MMU_DATA_STORE) {", "VAR_4 = EXCP_AdES;", "} else {", "VAR_4 = EXCP_AdEL;", "}", "break;", "case TLBRET_NOMATCH:\nif (VAR_2 == MMU_DATA_STORE) {", "VAR_4 = EXCP_TLBS;", "} else {", "VAR_4 = EXCP_TLBL;", "}", "VAR_5 |= EXCP_TLB_NOMATCH;", "break;", "case TLBRET_INVALID:\nif (VAR_2 == MMU_DATA_STORE) {", "VAR_4 = EXCP_TLBS;", "} else {", "VAR_4 = EXCP_TLBL;", "}", "break;", "case TLBRET_DIRTY:\nVAR_4 = EXCP_LTLBL;", "break;", "case TLBRET_XI:\nif (VAR_0->CP0_PageGrain & (1 << CP0PG_IEC)) {", "VAR_4 = EXCP_TLBXI;", "} else {", "VAR_4 = EXCP_TLBL;", "}", "break;", "case TLBRET_RI:\nif (VAR_0->CP0_PageGrain & (1 << CP0PG_IEC)) {", "VAR_4 = EXCP_TLBRI;", "} else {", "VAR_4 = EXCP_TLBL;", "}", "break;", "}", "VAR_0->CP0_BadVAddr = VAR_1;", "VAR_0->CP0_Context = (VAR_0->CP0_Context & ~0x007fffff) |\n((VAR_1 >> 9) & 0x007ffff0);", "VAR_0->CP0_EntryHi = (VAR_0->CP0_EntryHi & VAR_0->CP0_EntryHi_ASID_mask) |\n(VAR_1 & (TARGET_PAGE_MASK << 1));", "#if defined(TARGET_MIPS64)\nVAR_0->CP0_EntryHi &= VAR_0->SEGMask;", "VAR_0->CP0_XContext =\n(VAR_0->CP0_XContext & ((~0ULL) << (VAR_0->SEGBITS - 7))) |\n(extract64(VAR_1, 62, 2) << (VAR_0->SEGBITS - 9)) |\n(extract64(VAR_1, 13, VAR_0->SEGBITS - 13) << 4);", "#endif\ncs->exception_index = VAR_4;", "VAR_0->VAR_5 = VAR_5;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23, 25, 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43, 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61, 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77, 81 ], [ 83 ], [ 85, 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101, 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 121 ], [ 123, 125 ], [ 127, 130 ], [ 132, 134 ], [ 136, 138, 140, 142 ], [ 144, 146 ], [ 148 ], [ 150 ] ]
2,356
static int decode_frame(WmallDecodeCtx *s) { GetBitContext* gb = &s->gb; int more_frames = 0; int len = 0; int i; /** check for potential output buffer overflow */ if (s->num_channels * s->samples_per_frame > s->samples_end - s->samples) { /** return an error if no frame could be decoded at all */ av_log(s->avctx, AV_LOG_ERROR, "not enough space for the output samples\n"); s->packet_loss = 1; return 0; } /** get frame length */ if (s->len_prefix) len = get_bits(gb, s->log2_frame_size); /** decode tile information */ if (decode_tilehdr(s)) { s->packet_loss = 1; return 0; } /** read drc info */ if (s->dynamic_range_compression) { s->drc_gain = get_bits(gb, 8); } /** no idea what these are for, might be the number of samples that need to be skipped at the beginning or end of a stream */ if (get_bits1(gb)) { int skip; /** usually true for the first frame */ if (get_bits1(gb)) { skip = get_bits(gb, av_log2(s->samples_per_frame * 2)); dprintf(s->avctx, "start skip: %i\n", skip); } /** sometimes true for the last frame */ if (get_bits1(gb)) { skip = get_bits(gb, av_log2(s->samples_per_frame * 2)); dprintf(s->avctx, "end skip: %i\n", skip); } } /** reset subframe states */ s->parsed_all_subframes = 0; for (i = 0; i < s->num_channels; i++) { s->channel[i].decoded_samples = 0; s->channel[i].cur_subframe = 0; s->channel[i].reuse_sf = 0; } /** decode all subframes */ while (!s->parsed_all_subframes) { if (decode_subframe(s) < 0) { s->packet_loss = 1; return 0; } } dprintf(s->avctx, "Frame done\n"); if (s->skip_frame) { s->skip_frame = 0; } else s->samples += s->num_channels * s->samples_per_frame; if (s->len_prefix) { if (len != (get_bits_count(gb) - s->frame_offset) + 2) { /** FIXME: not sure if this is always an error */ av_log(s->avctx, AV_LOG_ERROR, "frame[%i] would have to skip %i bits\n", s->frame_num, len - (get_bits_count(gb) - s->frame_offset) - 1); s->packet_loss = 1; return 0; } /** skip the rest of the frame data */ skip_bits_long(gb, len - (get_bits_count(gb) - s->frame_offset) - 1); } else { /* while (get_bits_count(gb) < s->num_saved_bits && get_bits1(gb) == 0) { dprintf(s->avctx, "skip1\n"); } */ } /** decode trailer bit */ more_frames = get_bits1(gb); ++s->frame_num; return more_frames; }
true
FFmpeg
dae7ff04160901a30a35af05f2f149b289c4f0b1
static int decode_frame(WmallDecodeCtx *s) { GetBitContext* gb = &s->gb; int more_frames = 0; int len = 0; int i; if (s->num_channels * s->samples_per_frame > s->samples_end - s->samples) { av_log(s->avctx, AV_LOG_ERROR, "not enough space for the output samples\n"); s->packet_loss = 1; return 0; } if (s->len_prefix) len = get_bits(gb, s->log2_frame_size); if (decode_tilehdr(s)) { s->packet_loss = 1; return 0; } if (s->dynamic_range_compression) { s->drc_gain = get_bits(gb, 8); } if (get_bits1(gb)) { int skip; if (get_bits1(gb)) { skip = get_bits(gb, av_log2(s->samples_per_frame * 2)); dprintf(s->avctx, "start skip: %i\n", skip); } if (get_bits1(gb)) { skip = get_bits(gb, av_log2(s->samples_per_frame * 2)); dprintf(s->avctx, "end skip: %i\n", skip); } } s->parsed_all_subframes = 0; for (i = 0; i < s->num_channels; i++) { s->channel[i].decoded_samples = 0; s->channel[i].cur_subframe = 0; s->channel[i].reuse_sf = 0; } while (!s->parsed_all_subframes) { if (decode_subframe(s) < 0) { s->packet_loss = 1; return 0; } } dprintf(s->avctx, "Frame done\n"); if (s->skip_frame) { s->skip_frame = 0; } else s->samples += s->num_channels * s->samples_per_frame; if (s->len_prefix) { if (len != (get_bits_count(gb) - s->frame_offset) + 2) { av_log(s->avctx, AV_LOG_ERROR, "frame[%i] would have to skip %i bits\n", s->frame_num, len - (get_bits_count(gb) - s->frame_offset) - 1); s->packet_loss = 1; return 0; } skip_bits_long(gb, len - (get_bits_count(gb) - s->frame_offset) - 1); } else { } more_frames = get_bits1(gb); ++s->frame_num; return more_frames; }
{ "code": [], "line_no": [] }
static int FUNC_0(WmallDecodeCtx *VAR_0) { GetBitContext* gb = &VAR_0->gb; int VAR_1 = 0; int VAR_2 = 0; int VAR_3; if (VAR_0->num_channels * VAR_0->samples_per_frame > VAR_0->samples_end - VAR_0->samples) { av_log(VAR_0->avctx, AV_LOG_ERROR, "not enough space for the output samples\n"); VAR_0->packet_loss = 1; return 0; } if (VAR_0->len_prefix) VAR_2 = get_bits(gb, VAR_0->log2_frame_size); if (decode_tilehdr(VAR_0)) { VAR_0->packet_loss = 1; return 0; } if (VAR_0->dynamic_range_compression) { VAR_0->drc_gain = get_bits(gb, 8); } if (get_bits1(gb)) { int VAR_4; if (get_bits1(gb)) { VAR_4 = get_bits(gb, av_log2(VAR_0->samples_per_frame * 2)); dprintf(VAR_0->avctx, "start VAR_4: %VAR_3\n", VAR_4); } if (get_bits1(gb)) { VAR_4 = get_bits(gb, av_log2(VAR_0->samples_per_frame * 2)); dprintf(VAR_0->avctx, "end VAR_4: %VAR_3\n", VAR_4); } } VAR_0->parsed_all_subframes = 0; for (VAR_3 = 0; VAR_3 < VAR_0->num_channels; VAR_3++) { VAR_0->channel[VAR_3].decoded_samples = 0; VAR_0->channel[VAR_3].cur_subframe = 0; VAR_0->channel[VAR_3].reuse_sf = 0; } while (!VAR_0->parsed_all_subframes) { if (decode_subframe(VAR_0) < 0) { VAR_0->packet_loss = 1; return 0; } } dprintf(VAR_0->avctx, "Frame done\n"); if (VAR_0->skip_frame) { VAR_0->skip_frame = 0; } else VAR_0->samples += VAR_0->num_channels * VAR_0->samples_per_frame; if (VAR_0->len_prefix) { if (VAR_2 != (get_bits_count(gb) - VAR_0->frame_offset) + 2) { av_log(VAR_0->avctx, AV_LOG_ERROR, "frame[%VAR_3] would have to VAR_4 %VAR_3 bits\n", VAR_0->frame_num, VAR_2 - (get_bits_count(gb) - VAR_0->frame_offset) - 1); VAR_0->packet_loss = 1; return 0; } skip_bits_long(gb, VAR_2 - (get_bits_count(gb) - VAR_0->frame_offset) - 1); } else { } VAR_1 = get_bits1(gb); ++VAR_0->frame_num; return VAR_1; }
[ "static int FUNC_0(WmallDecodeCtx *VAR_0)\n{", "GetBitContext* gb = &VAR_0->gb;", "int VAR_1 = 0;", "int VAR_2 = 0;", "int VAR_3;", "if (VAR_0->num_channels * VAR_0->samples_per_frame > VAR_0->samples_end - VAR_0->samples) {", "av_log(VAR_0->avctx, AV_LOG_ERROR,\n\"not enough space for the output samples\\n\");", "VAR_0->packet_loss = 1;", "return 0;", "}", "if (VAR_0->len_prefix)\nVAR_2 = get_bits(gb, VAR_0->log2_frame_size);", "if (decode_tilehdr(VAR_0)) {", "VAR_0->packet_loss = 1;", "return 0;", "}", "if (VAR_0->dynamic_range_compression) {", "VAR_0->drc_gain = get_bits(gb, 8);", "}", "if (get_bits1(gb)) {", "int VAR_4;", "if (get_bits1(gb)) {", "VAR_4 = get_bits(gb, av_log2(VAR_0->samples_per_frame * 2));", "dprintf(VAR_0->avctx, \"start VAR_4: %VAR_3\\n\", VAR_4);", "}", "if (get_bits1(gb)) {", "VAR_4 = get_bits(gb, av_log2(VAR_0->samples_per_frame * 2));", "dprintf(VAR_0->avctx, \"end VAR_4: %VAR_3\\n\", VAR_4);", "}", "}", "VAR_0->parsed_all_subframes = 0;", "for (VAR_3 = 0; VAR_3 < VAR_0->num_channels; VAR_3++) {", "VAR_0->channel[VAR_3].decoded_samples = 0;", "VAR_0->channel[VAR_3].cur_subframe = 0;", "VAR_0->channel[VAR_3].reuse_sf = 0;", "}", "while (!VAR_0->parsed_all_subframes) {", "if (decode_subframe(VAR_0) < 0) {", "VAR_0->packet_loss = 1;", "return 0;", "}", "}", "dprintf(VAR_0->avctx, \"Frame done\\n\");", "if (VAR_0->skip_frame) {", "VAR_0->skip_frame = 0;", "} else", "VAR_0->samples += VAR_0->num_channels * VAR_0->samples_per_frame;", "if (VAR_0->len_prefix) {", "if (VAR_2 != (get_bits_count(gb) - VAR_0->frame_offset) + 2) {", "av_log(VAR_0->avctx, AV_LOG_ERROR,\n\"frame[%VAR_3] would have to VAR_4 %VAR_3 bits\\n\", VAR_0->frame_num,\nVAR_2 - (get_bits_count(gb) - VAR_0->frame_offset) - 1);", "VAR_0->packet_loss = 1;", "return 0;", "}", "skip_bits_long(gb, VAR_2 - (get_bits_count(gb) - VAR_0->frame_offset) - 1);", "} else {", "}", "VAR_1 = get_bits1(gb);", "++VAR_0->frame_num;", "return VAR_1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 17 ], [ 21, 23 ], [ 25 ], [ 27 ], [ 29 ], [ 35, 37 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 55 ], [ 57 ], [ 59 ], [ 67 ], [ 69 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 97 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 133 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 147 ], [ 149 ], [ 153, 155, 157 ], [ 159 ], [ 161 ], [ 163 ], [ 169 ], [ 171 ], [ 183 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ] ]
2,357
static void rv34_idct_dc_add_c(uint8_t *dst, int stride, int dc) { const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; int i, j; cm += (13*13*dc + 0x200) >> 10; for (i = 0; i < 4; i++) { for (j = 0; j < 4; j++) dst[j] = cm[ dst[j] ]; dst += stride; } }
true
FFmpeg
3ab9a2a5577d445252724af4067d2a7c8a378efa
static void rv34_idct_dc_add_c(uint8_t *dst, int stride, int dc) { const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; int i, j; cm += (13*13*dc + 0x200) >> 10; for (i = 0; i < 4; i++) { for (j = 0; j < 4; j++) dst[j] = cm[ dst[j] ]; dst += stride; } }
{ "code": [ "static void rv34_idct_dc_add_c(uint8_t *dst, int stride, int dc)" ], "line_no": [ 1 ] }
static void FUNC_0(uint8_t *VAR_0, int VAR_1, int VAR_2) { const uint8_t *VAR_3 = ff_cropTbl + MAX_NEG_CROP; int VAR_4, VAR_5; VAR_3 += (13*13*VAR_2 + 0x200) >> 10; for (VAR_4 = 0; VAR_4 < 4; VAR_4++) { for (VAR_5 = 0; VAR_5 < 4; VAR_5++) VAR_0[VAR_5] = VAR_3[ VAR_0[VAR_5] ]; VAR_0 += VAR_1; } }
[ "static void FUNC_0(uint8_t *VAR_0, int VAR_1, int VAR_2)\n{", "const uint8_t *VAR_3 = ff_cropTbl + MAX_NEG_CROP;", "int VAR_4, VAR_5;", "VAR_3 += (13*13*VAR_2 + 0x200) >> 10;", "for (VAR_4 = 0; VAR_4 < 4; VAR_4++)", "{", "for (VAR_5 = 0; VAR_5 < 4; VAR_5++)", "VAR_0[VAR_5] = VAR_3[ VAR_0[VAR_5] ];", "VAR_0 += VAR_1;", "}", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ] ]
2,359
static void monitor_event(void *opaque, int event) { Monitor *mon = opaque; switch (event) { case CHR_EVENT_MUX_IN: qemu_mutex_lock(&mon->out_lock); mon->mux_out = 0; qemu_mutex_unlock(&mon->out_lock); if (mon->reset_seen) { monitor_resume(mon); monitor_flush(mon); } else { mon->suspend_cnt = 0; } break; case CHR_EVENT_MUX_OUT: if (mon->reset_seen) { if (mon->suspend_cnt == 0) { monitor_printf(mon, "\n"); } monitor_flush(mon); monitor_suspend(mon); } else { mon->suspend_cnt++; } qemu_mutex_lock(&mon->out_lock); mon->mux_out = 1; qemu_mutex_unlock(&mon->out_lock); break; case CHR_EVENT_OPENED: monitor_printf(mon, "QEMU %s monitor - type 'help' for more " "information\n", QEMU_VERSION); if (!mon->mux_out) { readline_show_prompt(mon->rs); } mon->reset_seen = 1; mon_refcount++; break; case CHR_EVENT_CLOSED: mon_refcount--; monitor_fdsets_cleanup(); break; } }
true
qemu
e5554e2015f8fb452135f7b1ce1976536266379c
static void monitor_event(void *opaque, int event) { Monitor *mon = opaque; switch (event) { case CHR_EVENT_MUX_IN: qemu_mutex_lock(&mon->out_lock); mon->mux_out = 0; qemu_mutex_unlock(&mon->out_lock); if (mon->reset_seen) { monitor_resume(mon); monitor_flush(mon); } else { mon->suspend_cnt = 0; } break; case CHR_EVENT_MUX_OUT: if (mon->reset_seen) { if (mon->suspend_cnt == 0) { monitor_printf(mon, "\n"); } monitor_flush(mon); monitor_suspend(mon); } else { mon->suspend_cnt++; } qemu_mutex_lock(&mon->out_lock); mon->mux_out = 1; qemu_mutex_unlock(&mon->out_lock); break; case CHR_EVENT_OPENED: monitor_printf(mon, "QEMU %s monitor - type 'help' for more " "information\n", QEMU_VERSION); if (!mon->mux_out) { readline_show_prompt(mon->rs); } mon->reset_seen = 1; mon_refcount++; break; case CHR_EVENT_CLOSED: mon_refcount--; monitor_fdsets_cleanup(); break; } }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, int VAR_1) { Monitor *mon = VAR_0; switch (VAR_1) { case CHR_EVENT_MUX_IN: qemu_mutex_lock(&mon->out_lock); mon->mux_out = 0; qemu_mutex_unlock(&mon->out_lock); if (mon->reset_seen) { monitor_resume(mon); monitor_flush(mon); } else { mon->suspend_cnt = 0; } break; case CHR_EVENT_MUX_OUT: if (mon->reset_seen) { if (mon->suspend_cnt == 0) { monitor_printf(mon, "\n"); } monitor_flush(mon); monitor_suspend(mon); } else { mon->suspend_cnt++; } qemu_mutex_lock(&mon->out_lock); mon->mux_out = 1; qemu_mutex_unlock(&mon->out_lock); break; case CHR_EVENT_OPENED: monitor_printf(mon, "QEMU %s monitor - type 'help' for more " "information\n", QEMU_VERSION); if (!mon->mux_out) { readline_show_prompt(mon->rs); } mon->reset_seen = 1; mon_refcount++; break; case CHR_EVENT_CLOSED: mon_refcount--; monitor_fdsets_cleanup(); break; } }
[ "static void FUNC_0(void *VAR_0, int VAR_1)\n{", "Monitor *mon = VAR_0;", "switch (VAR_1) {", "case CHR_EVENT_MUX_IN:\nqemu_mutex_lock(&mon->out_lock);", "mon->mux_out = 0;", "qemu_mutex_unlock(&mon->out_lock);", "if (mon->reset_seen) {", "monitor_resume(mon);", "monitor_flush(mon);", "} else {", "mon->suspend_cnt = 0;", "}", "break;", "case CHR_EVENT_MUX_OUT:\nif (mon->reset_seen) {", "if (mon->suspend_cnt == 0) {", "monitor_printf(mon, \"\\n\");", "}", "monitor_flush(mon);", "monitor_suspend(mon);", "} else {", "mon->suspend_cnt++;", "}", "qemu_mutex_lock(&mon->out_lock);", "mon->mux_out = 1;", "qemu_mutex_unlock(&mon->out_lock);", "break;", "case CHR_EVENT_OPENED:\nmonitor_printf(mon, \"QEMU %s monitor - type 'help' for more \"\n\"information\\n\", QEMU_VERSION);", "if (!mon->mux_out) {", "readline_show_prompt(mon->rs);", "}", "mon->reset_seen = 1;", "mon_refcount++;", "break;", "case CHR_EVENT_CLOSED:\nmon_refcount--;", "monitor_fdsets_cleanup();", "break;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11, 13 ], [ 15 ], [ 17 ], [ 19 ], [ 22 ], [ 24 ], [ 26 ], [ 28 ], [ 30 ], [ 32 ], [ 36, 38 ], [ 40 ], [ 42 ], [ 44 ], [ 46 ], [ 48 ], [ 50 ], [ 52 ], [ 54 ], [ 56 ], [ 58 ], [ 60 ], [ 62 ], [ 66, 68, 70 ], [ 72 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 87, 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ] ]
2,360
static ExitStatus gen_mtpr(DisasContext *ctx, TCGv vb, int regno) { TCGv tmp; int data; switch (regno) { case 255: /* TBIA */ gen_helper_tbia(cpu_env); break; case 254: /* TBIS */ gen_helper_tbis(cpu_env, vb); break; case 253: /* WAIT */ tmp = tcg_const_i64(1); tcg_gen_st32_i64(tmp, cpu_env, -offsetof(AlphaCPU, env) + offsetof(CPUState, halted)); return gen_excp(ctx, EXCP_HALTED, 0); case 252: /* HALT */ gen_helper_halt(vb); return EXIT_PC_STALE; case 251: /* ALARM */ gen_helper_set_alarm(cpu_env, vb); break; case 7: /* PALBR */ tcg_gen_st_i64(vb, cpu_env, offsetof(CPUAlphaState, palbr)); /* Changing the PAL base register implies un-chaining all of the TBs that ended with a CALL_PAL. Since the base register usually only changes during boot, flushing everything works well. */ gen_helper_tb_flush(cpu_env); return EXIT_PC_STALE; case 32 ... 39: /* Accessing the "non-shadow" general registers. */ regno = regno == 39 ? 25 : regno - 32 + 8; tcg_gen_mov_i64(cpu_std_ir[regno], vb); break; case 0: /* PS */ st_flag_byte(vb, ENV_FLAG_PS_SHIFT); break; case 1: /* FEN */ st_flag_byte(vb, ENV_FLAG_FEN_SHIFT); break; default: /* The basic registers are data only, and unknown registers are read-zero, write-ignore. */ data = cpu_pr_data(regno); if (data != 0) { if (data & PR_LONG) { tcg_gen_st32_i64(vb, cpu_env, data & ~PR_LONG); } else { tcg_gen_st_i64(vb, cpu_env, data); } } break; } return NO_EXIT; }
true
qemu
a4535b8e3ef2b41e0e7d42293db912d44ad812f0
static ExitStatus gen_mtpr(DisasContext *ctx, TCGv vb, int regno) { TCGv tmp; int data; switch (regno) { case 255: gen_helper_tbia(cpu_env); break; case 254: gen_helper_tbis(cpu_env, vb); break; case 253: tmp = tcg_const_i64(1); tcg_gen_st32_i64(tmp, cpu_env, -offsetof(AlphaCPU, env) + offsetof(CPUState, halted)); return gen_excp(ctx, EXCP_HALTED, 0); case 252: gen_helper_halt(vb); return EXIT_PC_STALE; case 251: gen_helper_set_alarm(cpu_env, vb); break; case 7: tcg_gen_st_i64(vb, cpu_env, offsetof(CPUAlphaState, palbr)); gen_helper_tb_flush(cpu_env); return EXIT_PC_STALE; case 32 ... 39: regno = regno == 39 ? 25 : regno - 32 + 8; tcg_gen_mov_i64(cpu_std_ir[regno], vb); break; case 0: st_flag_byte(vb, ENV_FLAG_PS_SHIFT); break; case 1: st_flag_byte(vb, ENV_FLAG_FEN_SHIFT); break; default: data = cpu_pr_data(regno); if (data != 0) { if (data & PR_LONG) { tcg_gen_st32_i64(vb, cpu_env, data & ~PR_LONG); } else { tcg_gen_st_i64(vb, cpu_env, data); } } break; } return NO_EXIT; }
{ "code": [ " TCGv tmp;", " tmp = tcg_const_i64(1);", " tcg_gen_st32_i64(tmp, cpu_env, -offsetof(AlphaCPU, env) +", " offsetof(CPUState, halted));" ], "line_no": [ 5, 37, 39, 41 ] }
static ExitStatus FUNC_0(DisasContext *ctx, TCGv vb, int regno) { TCGv tmp; int VAR_0; switch (regno) { case 255: gen_helper_tbia(cpu_env); break; case 254: gen_helper_tbis(cpu_env, vb); break; case 253: tmp = tcg_const_i64(1); tcg_gen_st32_i64(tmp, cpu_env, -offsetof(AlphaCPU, env) + offsetof(CPUState, halted)); return gen_excp(ctx, EXCP_HALTED, 0); case 252: gen_helper_halt(vb); return EXIT_PC_STALE; case 251: gen_helper_set_alarm(cpu_env, vb); break; case 7: tcg_gen_st_i64(vb, cpu_env, offsetof(CPUAlphaState, palbr)); gen_helper_tb_flush(cpu_env); return EXIT_PC_STALE; case 32 ... 39: regno = regno == 39 ? 25 : regno - 32 + 8; tcg_gen_mov_i64(cpu_std_ir[regno], vb); break; case 0: st_flag_byte(vb, ENV_FLAG_PS_SHIFT); break; case 1: st_flag_byte(vb, ENV_FLAG_FEN_SHIFT); break; default: VAR_0 = cpu_pr_data(regno); if (VAR_0 != 0) { if (VAR_0 & PR_LONG) { tcg_gen_st32_i64(vb, cpu_env, VAR_0 & ~PR_LONG); } else { tcg_gen_st_i64(vb, cpu_env, VAR_0); } } break; } return NO_EXIT; }
[ "static ExitStatus FUNC_0(DisasContext *ctx, TCGv vb, int regno)\n{", "TCGv tmp;", "int VAR_0;", "switch (regno) {", "case 255:\ngen_helper_tbia(cpu_env);", "break;", "case 254:\ngen_helper_tbis(cpu_env, vb);", "break;", "case 253:\ntmp = tcg_const_i64(1);", "tcg_gen_st32_i64(tmp, cpu_env, -offsetof(AlphaCPU, env) +\noffsetof(CPUState, halted));", "return gen_excp(ctx, EXCP_HALTED, 0);", "case 252:\ngen_helper_halt(vb);", "return EXIT_PC_STALE;", "case 251:\ngen_helper_set_alarm(cpu_env, vb);", "break;", "case 7:\ntcg_gen_st_i64(vb, cpu_env, offsetof(CPUAlphaState, palbr));", "gen_helper_tb_flush(cpu_env);", "return EXIT_PC_STALE;", "case 32 ... 39:\nregno = regno == 39 ? 25 : regno - 32 + 8;", "tcg_gen_mov_i64(cpu_std_ir[regno], vb);", "break;", "case 0:\nst_flag_byte(vb, ENV_FLAG_PS_SHIFT);", "break;", "case 1:\nst_flag_byte(vb, ENV_FLAG_FEN_SHIFT);", "break;", "default:\nVAR_0 = cpu_pr_data(regno);", "if (VAR_0 != 0) {", "if (VAR_0 & PR_LONG) {", "tcg_gen_st32_i64(vb, cpu_env, VAR_0 & ~PR_LONG);", "} else {", "tcg_gen_st_i64(vb, cpu_env, VAR_0);", "}", "}", "break;", "}", "return NO_EXIT;", "}" ]
[ 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13, 17 ], [ 19 ], [ 23, 27 ], [ 29 ], [ 33, 37 ], [ 39, 41 ], [ 43 ], [ 47, 51 ], [ 53 ], [ 57, 61 ], [ 63 ], [ 67, 71 ], [ 79 ], [ 81 ], [ 85, 89 ], [ 91 ], [ 93 ], [ 97, 99 ], [ 101 ], [ 103, 105 ], [ 107 ], [ 111, 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 139 ], [ 141 ] ]
2,361
static bool key_is_missing(const BlockInfo *bdev) { return (bdev->inserted && bdev->inserted->encryption_key_missing); }
true
qemu
788cf9f8c8cbda53843e060540f3e91a060eb744
static bool key_is_missing(const BlockInfo *bdev) { return (bdev->inserted && bdev->inserted->encryption_key_missing); }
{ "code": [ "static bool key_is_missing(const BlockInfo *bdev)", " return (bdev->inserted && bdev->inserted->encryption_key_missing);" ], "line_no": [ 1, 5 ] }
static bool FUNC_0(const BlockInfo *bdev) { return (bdev->inserted && bdev->inserted->encryption_key_missing); }
[ "static bool FUNC_0(const BlockInfo *bdev)\n{", "return (bdev->inserted && bdev->inserted->encryption_key_missing);", "}" ]
[ 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
2,362
static int64_t ivshmem_recv_msg(IVShmemState *s, int *pfd, Error **errp) { int64_t msg; int n, ret; n = 0; do { ret = qemu_chr_fe_read_all(&s->server_chr, (uint8_t *)&msg + n, sizeof(msg) - n); if (ret < 0) { if (ret == -EINTR) { continue; } error_setg_errno(errp, -ret, "read from server failed"); return INT64_MIN; } n += ret; } while (n < sizeof(msg)); *pfd = qemu_chr_fe_get_msgfd(&s->server_chr); return msg; }
true
qemu
51af0ec9fa7269f0c69aa50a1a24748b4edc4b44
static int64_t ivshmem_recv_msg(IVShmemState *s, int *pfd, Error **errp) { int64_t msg; int n, ret; n = 0; do { ret = qemu_chr_fe_read_all(&s->server_chr, (uint8_t *)&msg + n, sizeof(msg) - n); if (ret < 0) { if (ret == -EINTR) { continue; } error_setg_errno(errp, -ret, "read from server failed"); return INT64_MIN; } n += ret; } while (n < sizeof(msg)); *pfd = qemu_chr_fe_get_msgfd(&s->server_chr); return msg; }
{ "code": [ " return msg;" ], "line_no": [ 41 ] }
static int64_t FUNC_0(IVShmemState *s, int *pfd, Error **errp) { int64_t msg; int VAR_0, VAR_1; VAR_0 = 0; do { VAR_1 = qemu_chr_fe_read_all(&s->server_chr, (uint8_t *)&msg + VAR_0, sizeof(msg) - VAR_0); if (VAR_1 < 0) { if (VAR_1 == -EINTR) { continue; } error_setg_errno(errp, -VAR_1, "read from server failed"); return INT64_MIN; } VAR_0 += VAR_1; } while (VAR_0 < sizeof(msg)); *pfd = qemu_chr_fe_get_msgfd(&s->server_chr); return msg; }
[ "static int64_t FUNC_0(IVShmemState *s, int *pfd, Error **errp)\n{", "int64_t msg;", "int VAR_0, VAR_1;", "VAR_0 = 0;", "do {", "VAR_1 = qemu_chr_fe_read_all(&s->server_chr, (uint8_t *)&msg + VAR_0,\nsizeof(msg) - VAR_0);", "if (VAR_1 < 0) {", "if (VAR_1 == -EINTR) {", "continue;", "}", "error_setg_errno(errp, -VAR_1, \"read from server failed\");", "return INT64_MIN;", "}", "VAR_0 += VAR_1;", "} while (VAR_0 < sizeof(msg));", "*pfd = qemu_chr_fe_get_msgfd(&s->server_chr);", "return msg;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15, 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ] ]
2,363
static USBDevice *usb_bt_init(USBBus *bus, const char *cmdline) { USBDevice *dev; struct USBBtState *s; HCIInfo *hci; const char *name = "usb-bt-dongle"; if (*cmdline) { hci = hci_init(cmdline); } else { hci = bt_new_hci(qemu_find_bt_vlan(0)); } if (!hci) return NULL; dev = usb_create(bus, name); s = DO_UPCAST(struct USBBtState, dev, dev); s->hci = hci; if (qdev_init(&dev->qdev) < 0) { error_report("Failed to initialize USB device '%s'", name); return NULL; } return dev; }
true
qemu
3bc36a401e0f33e63a4d2c58b646ddf78efb567c
static USBDevice *usb_bt_init(USBBus *bus, const char *cmdline) { USBDevice *dev; struct USBBtState *s; HCIInfo *hci; const char *name = "usb-bt-dongle"; if (*cmdline) { hci = hci_init(cmdline); } else { hci = bt_new_hci(qemu_find_bt_vlan(0)); } if (!hci) return NULL; dev = usb_create(bus, name); s = DO_UPCAST(struct USBBtState, dev, dev); s->hci = hci; if (qdev_init(&dev->qdev) < 0) { error_report("Failed to initialize USB device '%s'", name); return NULL; } return dev; }
{ "code": [ " if (qdev_init(&dev->qdev) < 0) {", " error_report(\"Failed to initialize USB device '%s'\", name);", " return NULL;", " return NULL;" ], "line_no": [ 37, 39, 27, 27 ] }
static USBDevice *FUNC_0(USBBus *bus, const char *cmdline) { USBDevice *dev; struct USBBtState *VAR_0; HCIInfo *hci; const char *VAR_1 = "usb-bt-dongle"; if (*cmdline) { hci = hci_init(cmdline); } else { hci = bt_new_hci(qemu_find_bt_vlan(0)); } if (!hci) return NULL; dev = usb_create(bus, VAR_1); VAR_0 = DO_UPCAST(struct USBBtState, dev, dev); VAR_0->hci = hci; if (qdev_init(&dev->qdev) < 0) { error_report("Failed to initialize USB device '%VAR_0'", VAR_1); return NULL; } return dev; }
[ "static USBDevice *FUNC_0(USBBus *bus, const char *cmdline)\n{", "USBDevice *dev;", "struct USBBtState *VAR_0;", "HCIInfo *hci;", "const char *VAR_1 = \"usb-bt-dongle\";", "if (*cmdline) {", "hci = hci_init(cmdline);", "} else {", "hci = bt_new_hci(qemu_find_bt_vlan(0));", "}", "if (!hci)\nreturn NULL;", "dev = usb_create(bus, VAR_1);", "VAR_0 = DO_UPCAST(struct USBBtState, dev, dev);", "VAR_0->hci = hci;", "if (qdev_init(&dev->qdev) < 0) {", "error_report(\"Failed to initialize USB device '%VAR_0'\", VAR_1);", "return NULL;", "}", "return dev;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25, 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ] ]
2,364
static void pre_process_video_frame(InputStream *ist, AVPicture *picture, void **bufp) { AVCodecContext *dec; AVPicture *picture2; AVPicture picture_tmp; uint8_t *buf = 0; dec = ist->st->codec; /* deinterlace : must be done before any resize */ if (FF_API_DEINTERLACE && do_deinterlace) { int size; /* create temporary picture */ size = avpicture_get_size(dec->pix_fmt, dec->width, dec->height); if (size < 0) return; buf = av_malloc(size); if (!buf) return; picture2 = &picture_tmp; avpicture_fill(picture2, buf, dec->pix_fmt, dec->width, dec->height); if (avpicture_deinterlace(picture2, picture, dec->pix_fmt, dec->width, dec->height) < 0) { /* if error, do not deinterlace */ av_log(NULL, AV_LOG_WARNING, "Deinterlacing failed\n"); av_free(buf); buf = NULL; picture2 = picture; } } else { picture2 = picture; } if (picture != picture2) *picture = *picture2; *bufp = buf; }
false
FFmpeg
4257b804e2354db07e66ebfd966d7d13f49c7895
static void pre_process_video_frame(InputStream *ist, AVPicture *picture, void **bufp) { AVCodecContext *dec; AVPicture *picture2; AVPicture picture_tmp; uint8_t *buf = 0; dec = ist->st->codec; if (FF_API_DEINTERLACE && do_deinterlace) { int size; size = avpicture_get_size(dec->pix_fmt, dec->width, dec->height); if (size < 0) return; buf = av_malloc(size); if (!buf) return; picture2 = &picture_tmp; avpicture_fill(picture2, buf, dec->pix_fmt, dec->width, dec->height); if (avpicture_deinterlace(picture2, picture, dec->pix_fmt, dec->width, dec->height) < 0) { av_log(NULL, AV_LOG_WARNING, "Deinterlacing failed\n"); av_free(buf); buf = NULL; picture2 = picture; } } else { picture2 = picture; } if (picture != picture2) *picture = *picture2; *bufp = buf; }
{ "code": [], "line_no": [] }
static void FUNC_0(InputStream *VAR_0, AVPicture *VAR_1, void **VAR_2) { AVCodecContext *dec; AVPicture *picture2; AVPicture picture_tmp; uint8_t *buf = 0; dec = VAR_0->st->codec; if (FF_API_DEINTERLACE && do_deinterlace) { int VAR_3; VAR_3 = avpicture_get_size(dec->pix_fmt, dec->width, dec->height); if (VAR_3 < 0) return; buf = av_malloc(VAR_3); if (!buf) return; picture2 = &picture_tmp; avpicture_fill(picture2, buf, dec->pix_fmt, dec->width, dec->height); if (avpicture_deinterlace(picture2, VAR_1, dec->pix_fmt, dec->width, dec->height) < 0) { av_log(NULL, AV_LOG_WARNING, "Deinterlacing failed\n"); av_free(buf); buf = NULL; picture2 = VAR_1; } } else { picture2 = VAR_1; } if (VAR_1 != picture2) *VAR_1 = *picture2; *VAR_2 = buf; }
[ "static void FUNC_0(InputStream *VAR_0, AVPicture *VAR_1, void **VAR_2)\n{", "AVCodecContext *dec;", "AVPicture *picture2;", "AVPicture picture_tmp;", "uint8_t *buf = 0;", "dec = VAR_0->st->codec;", "if (FF_API_DEINTERLACE && do_deinterlace) {", "int VAR_3;", "VAR_3 = avpicture_get_size(dec->pix_fmt, dec->width, dec->height);", "if (VAR_3 < 0)\nreturn;", "buf = av_malloc(VAR_3);", "if (!buf)\nreturn;", "picture2 = &picture_tmp;", "avpicture_fill(picture2, buf, dec->pix_fmt, dec->width, dec->height);", "if (avpicture_deinterlace(picture2, VAR_1,\ndec->pix_fmt, dec->width, dec->height) < 0) {", "av_log(NULL, AV_LOG_WARNING, \"Deinterlacing failed\\n\");", "av_free(buf);", "buf = NULL;", "picture2 = VAR_1;", "}", "} else {", "picture2 = VAR_1;", "}", "if (VAR_1 != picture2)\n*VAR_1 = *picture2;", "*VAR_2 = buf;", "}" ]
[ 0, 0, 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 ], [ 21 ], [ 23 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 37, 39 ], [ 43 ], [ 45 ], [ 49, 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 73, 75 ], [ 77 ], [ 79 ] ]
2,366
static int vc1_decode_p_mb_intfi(VC1Context *v) { MpegEncContext *s = &v->s; GetBitContext *gb = &s->gb; int i; int mb_pos = s->mb_x + s->mb_y * s->mb_stride; int cbp = 0; /* cbp decoding stuff */ int mqdiff, mquant; /* MB quantization */ int ttmb = v->ttfrm; /* MB Transform type */ int mb_has_coeffs = 1; /* last_flag */ int dmv_x, dmv_y; /* Differential MV components */ int val; /* temp values */ int first_block = 1; int dst_idx, off; int pred_flag = 0; int block_cbp = 0, pat, block_tt = 0; int idx_mbmode = 0; mquant = v->pq; /* Lossy initialization */ idx_mbmode = get_vlc2(gb, v->mbmode_vlc->table, VC1_IF_MBMODE_VLC_BITS, 2); if (idx_mbmode <= 1) { // intra MB v->is_intra[s->mb_x] = 0x3f; // Set the bitfield to all 1. s->mb_intra = 1; s->current_picture.motion_val[1][s->block_index[0] + v->blocks_off][0] = 0; s->current_picture.motion_val[1][s->block_index[0] + v->blocks_off][1] = 0; s->current_picture.mb_type[mb_pos + v->mb_off] = MB_TYPE_INTRA; GET_MQUANT(); s->current_picture.qscale_table[mb_pos] = mquant; /* Set DC scale - y and c use the same (not sure if necessary here) */ s->y_dc_scale = s->y_dc_scale_table[mquant]; s->c_dc_scale = s->c_dc_scale_table[mquant]; v->s.ac_pred = v->acpred_plane[mb_pos] = get_bits1(gb); mb_has_coeffs = idx_mbmode & 1; if (mb_has_coeffs) cbp = 1 + get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_ICBPCY_VLC_BITS, 2); dst_idx = 0; for (i = 0; i < 6; i++) { v->a_avail = v->c_avail = 0; v->mb_type[0][s->block_index[i]] = 1; s->dc_val[0][s->block_index[i]] = 0; dst_idx += i >> 2; val = ((cbp >> (5 - i)) & 1); if (i == 2 || i == 3 || !s->first_slice_line) v->a_avail = v->mb_type[0][s->block_index[i] - s->block_wrap[i]]; if (i == 1 || i == 3 || s->mb_x) v->c_avail = v->mb_type[0][s->block_index[i] - 1]; vc1_decode_intra_block(v, s->block[i], i, val, mquant, (i & 4) ? v->codingset2 : v->codingset); if ((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue; v->vc1dsp.vc1_inv_trans_8x8(s->block[i]); off = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize); s->idsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, (i & 4) ? s->uvlinesize : s->linesize); // TODO: loop filter } } else { s->mb_intra = v->is_intra[s->mb_x] = 0; s->current_picture.mb_type[mb_pos + v->mb_off] = MB_TYPE_16x16; for (i = 0; i < 6; i++) v->mb_type[0][s->block_index[i]] = 0; if (idx_mbmode <= 5) { // 1-MV dmv_x = dmv_y = pred_flag = 0; if (idx_mbmode & 1) { get_mvdata_interlaced(v, &dmv_x, &dmv_y, &pred_flag); } ff_vc1_pred_mv(v, 0, dmv_x, dmv_y, 1, v->range_x, v->range_y, v->mb_type[0], pred_flag, 0); ff_vc1_mc_1mv(v, 0); mb_has_coeffs = !(idx_mbmode & 2); } else { // 4-MV v->fourmvbp = get_vlc2(gb, v->fourmvbp_vlc->table, VC1_4MV_BLOCK_PATTERN_VLC_BITS, 1); for (i = 0; i < 6; i++) { if (i < 4) { dmv_x = dmv_y = pred_flag = 0; val = ((v->fourmvbp >> (3 - i)) & 1); if (val) { get_mvdata_interlaced(v, &dmv_x, &dmv_y, &pred_flag); } ff_vc1_pred_mv(v, i, dmv_x, dmv_y, 0, v->range_x, v->range_y, v->mb_type[0], pred_flag, 0); ff_vc1_mc_4mv_luma(v, i, 0, 0); } else if (i == 4) ff_vc1_mc_4mv_chroma(v, 0); } mb_has_coeffs = idx_mbmode & 1; } if (mb_has_coeffs) cbp = 1 + get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2); if (cbp) { GET_MQUANT(); } s->current_picture.qscale_table[mb_pos] = mquant; if (!v->ttmbf && cbp) { ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index].table, VC1_TTMB_VLC_BITS, 2); } dst_idx = 0; for (i = 0; i < 6; i++) { s->dc_val[0][s->block_index[i]] = 0; dst_idx += i >> 2; val = ((cbp >> (5 - i)) & 1); off = (i & 4) ? 0 : (i & 1) * 8 + (i & 2) * 4 * s->linesize; if (val) { pat = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block, s->dest[dst_idx] + off, (i & 4) ? s->uvlinesize : s->linesize, (i & 4) && (s->flags & CODEC_FLAG_GRAY), &block_tt); block_cbp |= pat << (i << 2); if (!v->ttmbf && ttmb < 8) ttmb = -1; first_block = 0; } } } if (s->mb_x == s->mb_width - 1) memmove(v->is_intra_base, v->is_intra, sizeof(v->is_intra_base[0]) * s->mb_stride); return 0; }
false
FFmpeg
f6b195cfb9712ae5032881d5dd8c4effb26be0fb
static int vc1_decode_p_mb_intfi(VC1Context *v) { MpegEncContext *s = &v->s; GetBitContext *gb = &s->gb; int i; int mb_pos = s->mb_x + s->mb_y * s->mb_stride; int cbp = 0; int mqdiff, mquant; int ttmb = v->ttfrm; int mb_has_coeffs = 1; int dmv_x, dmv_y; int val; int first_block = 1; int dst_idx, off; int pred_flag = 0; int block_cbp = 0, pat, block_tt = 0; int idx_mbmode = 0; mquant = v->pq; idx_mbmode = get_vlc2(gb, v->mbmode_vlc->table, VC1_IF_MBMODE_VLC_BITS, 2); if (idx_mbmode <= 1) { v->is_intra[s->mb_x] = 0x3f; s->mb_intra = 1; s->current_picture.motion_val[1][s->block_index[0] + v->blocks_off][0] = 0; s->current_picture.motion_val[1][s->block_index[0] + v->blocks_off][1] = 0; s->current_picture.mb_type[mb_pos + v->mb_off] = MB_TYPE_INTRA; GET_MQUANT(); s->current_picture.qscale_table[mb_pos] = mquant; s->y_dc_scale = s->y_dc_scale_table[mquant]; s->c_dc_scale = s->c_dc_scale_table[mquant]; v->s.ac_pred = v->acpred_plane[mb_pos] = get_bits1(gb); mb_has_coeffs = idx_mbmode & 1; if (mb_has_coeffs) cbp = 1 + get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_ICBPCY_VLC_BITS, 2); dst_idx = 0; for (i = 0; i < 6; i++) { v->a_avail = v->c_avail = 0; v->mb_type[0][s->block_index[i]] = 1; s->dc_val[0][s->block_index[i]] = 0; dst_idx += i >> 2; val = ((cbp >> (5 - i)) & 1); if (i == 2 || i == 3 || !s->first_slice_line) v->a_avail = v->mb_type[0][s->block_index[i] - s->block_wrap[i]]; if (i == 1 || i == 3 || s->mb_x) v->c_avail = v->mb_type[0][s->block_index[i] - 1]; vc1_decode_intra_block(v, s->block[i], i, val, mquant, (i & 4) ? v->codingset2 : v->codingset); if ((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue; v->vc1dsp.vc1_inv_trans_8x8(s->block[i]); off = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize); s->idsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, (i & 4) ? s->uvlinesize : s->linesize); } } else { s->mb_intra = v->is_intra[s->mb_x] = 0; s->current_picture.mb_type[mb_pos + v->mb_off] = MB_TYPE_16x16; for (i = 0; i < 6; i++) v->mb_type[0][s->block_index[i]] = 0; if (idx_mbmode <= 5) { dmv_x = dmv_y = pred_flag = 0; if (idx_mbmode & 1) { get_mvdata_interlaced(v, &dmv_x, &dmv_y, &pred_flag); } ff_vc1_pred_mv(v, 0, dmv_x, dmv_y, 1, v->range_x, v->range_y, v->mb_type[0], pred_flag, 0); ff_vc1_mc_1mv(v, 0); mb_has_coeffs = !(idx_mbmode & 2); } else { v->fourmvbp = get_vlc2(gb, v->fourmvbp_vlc->table, VC1_4MV_BLOCK_PATTERN_VLC_BITS, 1); for (i = 0; i < 6; i++) { if (i < 4) { dmv_x = dmv_y = pred_flag = 0; val = ((v->fourmvbp >> (3 - i)) & 1); if (val) { get_mvdata_interlaced(v, &dmv_x, &dmv_y, &pred_flag); } ff_vc1_pred_mv(v, i, dmv_x, dmv_y, 0, v->range_x, v->range_y, v->mb_type[0], pred_flag, 0); ff_vc1_mc_4mv_luma(v, i, 0, 0); } else if (i == 4) ff_vc1_mc_4mv_chroma(v, 0); } mb_has_coeffs = idx_mbmode & 1; } if (mb_has_coeffs) cbp = 1 + get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2); if (cbp) { GET_MQUANT(); } s->current_picture.qscale_table[mb_pos] = mquant; if (!v->ttmbf && cbp) { ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index].table, VC1_TTMB_VLC_BITS, 2); } dst_idx = 0; for (i = 0; i < 6; i++) { s->dc_val[0][s->block_index[i]] = 0; dst_idx += i >> 2; val = ((cbp >> (5 - i)) & 1); off = (i & 4) ? 0 : (i & 1) * 8 + (i & 2) * 4 * s->linesize; if (val) { pat = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block, s->dest[dst_idx] + off, (i & 4) ? s->uvlinesize : s->linesize, (i & 4) && (s->flags & CODEC_FLAG_GRAY), &block_tt); block_cbp |= pat << (i << 2); if (!v->ttmbf && ttmb < 8) ttmb = -1; first_block = 0; } } } if (s->mb_x == s->mb_width - 1) memmove(v->is_intra_base, v->is_intra, sizeof(v->is_intra_base[0]) * s->mb_stride); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(VC1Context *VAR_0) { MpegEncContext *s = &VAR_0->s; GetBitContext *gb = &s->gb; int VAR_1; int VAR_2 = s->mb_x + s->mb_y * s->mb_stride; int VAR_3 = 0; int VAR_4, VAR_5; int VAR_6 = VAR_0->ttfrm; int VAR_7 = 1; int VAR_8, VAR_9; int VAR_10; int VAR_11 = 1; int VAR_12, VAR_13; int VAR_14 = 0; int VAR_15 = 0, VAR_16, VAR_17 = 0; int VAR_18 = 0; VAR_5 = VAR_0->pq; VAR_18 = get_vlc2(gb, VAR_0->mbmode_vlc->table, VC1_IF_MBMODE_VLC_BITS, 2); if (VAR_18 <= 1) { VAR_0->is_intra[s->mb_x] = 0x3f; s->mb_intra = 1; s->current_picture.motion_val[1][s->block_index[0] + VAR_0->blocks_off][0] = 0; s->current_picture.motion_val[1][s->block_index[0] + VAR_0->blocks_off][1] = 0; s->current_picture.mb_type[VAR_2 + VAR_0->mb_off] = MB_TYPE_INTRA; GET_MQUANT(); s->current_picture.qscale_table[VAR_2] = VAR_5; s->y_dc_scale = s->y_dc_scale_table[VAR_5]; s->c_dc_scale = s->c_dc_scale_table[VAR_5]; VAR_0->s.ac_pred = VAR_0->acpred_plane[VAR_2] = get_bits1(gb); VAR_7 = VAR_18 & 1; if (VAR_7) VAR_3 = 1 + get_vlc2(&VAR_0->s.gb, VAR_0->cbpcy_vlc->table, VC1_ICBPCY_VLC_BITS, 2); VAR_12 = 0; for (VAR_1 = 0; VAR_1 < 6; VAR_1++) { VAR_0->a_avail = VAR_0->c_avail = 0; VAR_0->mb_type[0][s->block_index[VAR_1]] = 1; s->dc_val[0][s->block_index[VAR_1]] = 0; VAR_12 += VAR_1 >> 2; VAR_10 = ((VAR_3 >> (5 - VAR_1)) & 1); if (VAR_1 == 2 || VAR_1 == 3 || !s->first_slice_line) VAR_0->a_avail = VAR_0->mb_type[0][s->block_index[VAR_1] - s->block_wrap[VAR_1]]; if (VAR_1 == 1 || VAR_1 == 3 || s->mb_x) VAR_0->c_avail = VAR_0->mb_type[0][s->block_index[VAR_1] - 1]; vc1_decode_intra_block(VAR_0, s->block[VAR_1], VAR_1, VAR_10, VAR_5, (VAR_1 & 4) ? VAR_0->codingset2 : VAR_0->codingset); if ((VAR_1>3) && (s->flags & CODEC_FLAG_GRAY)) continue; VAR_0->vc1dsp.vc1_inv_trans_8x8(s->block[VAR_1]); VAR_13 = (VAR_1 & 4) ? 0 : ((VAR_1 & 1) * 8 + (VAR_1 & 2) * 4 * s->linesize); s->idsp.put_signed_pixels_clamped(s->block[VAR_1], s->dest[VAR_12] + VAR_13, (VAR_1 & 4) ? s->uvlinesize : s->linesize); } } else { s->mb_intra = VAR_0->is_intra[s->mb_x] = 0; s->current_picture.mb_type[VAR_2 + VAR_0->mb_off] = MB_TYPE_16x16; for (VAR_1 = 0; VAR_1 < 6; VAR_1++) VAR_0->mb_type[0][s->block_index[VAR_1]] = 0; if (VAR_18 <= 5) { VAR_8 = VAR_9 = VAR_14 = 0; if (VAR_18 & 1) { get_mvdata_interlaced(VAR_0, &VAR_8, &VAR_9, &VAR_14); } ff_vc1_pred_mv(VAR_0, 0, VAR_8, VAR_9, 1, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0], VAR_14, 0); ff_vc1_mc_1mv(VAR_0, 0); VAR_7 = !(VAR_18 & 2); } else { VAR_0->fourmvbp = get_vlc2(gb, VAR_0->fourmvbp_vlc->table, VC1_4MV_BLOCK_PATTERN_VLC_BITS, 1); for (VAR_1 = 0; VAR_1 < 6; VAR_1++) { if (VAR_1 < 4) { VAR_8 = VAR_9 = VAR_14 = 0; VAR_10 = ((VAR_0->fourmvbp >> (3 - VAR_1)) & 1); if (VAR_10) { get_mvdata_interlaced(VAR_0, &VAR_8, &VAR_9, &VAR_14); } ff_vc1_pred_mv(VAR_0, VAR_1, VAR_8, VAR_9, 0, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0], VAR_14, 0); ff_vc1_mc_4mv_luma(VAR_0, VAR_1, 0, 0); } else if (VAR_1 == 4) ff_vc1_mc_4mv_chroma(VAR_0, 0); } VAR_7 = VAR_18 & 1; } if (VAR_7) VAR_3 = 1 + get_vlc2(&VAR_0->s.gb, VAR_0->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2); if (VAR_3) { GET_MQUANT(); } s->current_picture.qscale_table[VAR_2] = VAR_5; if (!VAR_0->ttmbf && VAR_3) { VAR_6 = get_vlc2(gb, ff_vc1_ttmb_vlc[VAR_0->tt_index].table, VC1_TTMB_VLC_BITS, 2); } VAR_12 = 0; for (VAR_1 = 0; VAR_1 < 6; VAR_1++) { s->dc_val[0][s->block_index[VAR_1]] = 0; VAR_12 += VAR_1 >> 2; VAR_10 = ((VAR_3 >> (5 - VAR_1)) & 1); VAR_13 = (VAR_1 & 4) ? 0 : (VAR_1 & 1) * 8 + (VAR_1 & 2) * 4 * s->linesize; if (VAR_10) { VAR_16 = vc1_decode_p_block(VAR_0, s->block[VAR_1], VAR_1, VAR_5, VAR_6, VAR_11, s->dest[VAR_12] + VAR_13, (VAR_1 & 4) ? s->uvlinesize : s->linesize, (VAR_1 & 4) && (s->flags & CODEC_FLAG_GRAY), &VAR_17); VAR_15 |= VAR_16 << (VAR_1 << 2); if (!VAR_0->ttmbf && VAR_6 < 8) VAR_6 = -1; VAR_11 = 0; } } } if (s->mb_x == s->mb_width - 1) memmove(VAR_0->is_intra_base, VAR_0->is_intra, sizeof(VAR_0->is_intra_base[0]) * s->mb_stride); return 0; }
[ "static int FUNC_0(VC1Context *VAR_0)\n{", "MpegEncContext *s = &VAR_0->s;", "GetBitContext *gb = &s->gb;", "int VAR_1;", "int VAR_2 = s->mb_x + s->mb_y * s->mb_stride;", "int VAR_3 = 0;", "int VAR_4, VAR_5;", "int VAR_6 = VAR_0->ttfrm;", "int VAR_7 = 1;", "int VAR_8, VAR_9;", "int VAR_10;", "int VAR_11 = 1;", "int VAR_12, VAR_13;", "int VAR_14 = 0;", "int VAR_15 = 0, VAR_16, VAR_17 = 0;", "int VAR_18 = 0;", "VAR_5 = VAR_0->pq;", "VAR_18 = get_vlc2(gb, VAR_0->mbmode_vlc->table, VC1_IF_MBMODE_VLC_BITS, 2);", "if (VAR_18 <= 1) {", "VAR_0->is_intra[s->mb_x] = 0x3f;", "s->mb_intra = 1;", "s->current_picture.motion_val[1][s->block_index[0] + VAR_0->blocks_off][0] = 0;", "s->current_picture.motion_val[1][s->block_index[0] + VAR_0->blocks_off][1] = 0;", "s->current_picture.mb_type[VAR_2 + VAR_0->mb_off] = MB_TYPE_INTRA;", "GET_MQUANT();", "s->current_picture.qscale_table[VAR_2] = VAR_5;", "s->y_dc_scale = s->y_dc_scale_table[VAR_5];", "s->c_dc_scale = s->c_dc_scale_table[VAR_5];", "VAR_0->s.ac_pred = VAR_0->acpred_plane[VAR_2] = get_bits1(gb);", "VAR_7 = VAR_18 & 1;", "if (VAR_7)\nVAR_3 = 1 + get_vlc2(&VAR_0->s.gb, VAR_0->cbpcy_vlc->table, VC1_ICBPCY_VLC_BITS, 2);", "VAR_12 = 0;", "for (VAR_1 = 0; VAR_1 < 6; VAR_1++) {", "VAR_0->a_avail = VAR_0->c_avail = 0;", "VAR_0->mb_type[0][s->block_index[VAR_1]] = 1;", "s->dc_val[0][s->block_index[VAR_1]] = 0;", "VAR_12 += VAR_1 >> 2;", "VAR_10 = ((VAR_3 >> (5 - VAR_1)) & 1);", "if (VAR_1 == 2 || VAR_1 == 3 || !s->first_slice_line)\nVAR_0->a_avail = VAR_0->mb_type[0][s->block_index[VAR_1] - s->block_wrap[VAR_1]];", "if (VAR_1 == 1 || VAR_1 == 3 || s->mb_x)\nVAR_0->c_avail = VAR_0->mb_type[0][s->block_index[VAR_1] - 1];", "vc1_decode_intra_block(VAR_0, s->block[VAR_1], VAR_1, VAR_10, VAR_5,\n(VAR_1 & 4) ? VAR_0->codingset2 : VAR_0->codingset);", "if ((VAR_1>3) && (s->flags & CODEC_FLAG_GRAY))\ncontinue;", "VAR_0->vc1dsp.vc1_inv_trans_8x8(s->block[VAR_1]);", "VAR_13 = (VAR_1 & 4) ? 0 : ((VAR_1 & 1) * 8 + (VAR_1 & 2) * 4 * s->linesize);", "s->idsp.put_signed_pixels_clamped(s->block[VAR_1],\ns->dest[VAR_12] + VAR_13,\n(VAR_1 & 4) ? s->uvlinesize\n: s->linesize);", "}", "} else {", "s->mb_intra = VAR_0->is_intra[s->mb_x] = 0;", "s->current_picture.mb_type[VAR_2 + VAR_0->mb_off] = MB_TYPE_16x16;", "for (VAR_1 = 0; VAR_1 < 6; VAR_1++) VAR_0->mb_type[0][s->block_index[VAR_1]] = 0;", "if (VAR_18 <= 5) {", "VAR_8 = VAR_9 = VAR_14 = 0;", "if (VAR_18 & 1) {", "get_mvdata_interlaced(VAR_0, &VAR_8, &VAR_9, &VAR_14);", "}", "ff_vc1_pred_mv(VAR_0, 0, VAR_8, VAR_9, 1, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0], VAR_14, 0);", "ff_vc1_mc_1mv(VAR_0, 0);", "VAR_7 = !(VAR_18 & 2);", "} else {", "VAR_0->fourmvbp = get_vlc2(gb, VAR_0->fourmvbp_vlc->table, VC1_4MV_BLOCK_PATTERN_VLC_BITS, 1);", "for (VAR_1 = 0; VAR_1 < 6; VAR_1++) {", "if (VAR_1 < 4) {", "VAR_8 = VAR_9 = VAR_14 = 0;", "VAR_10 = ((VAR_0->fourmvbp >> (3 - VAR_1)) & 1);", "if (VAR_10) {", "get_mvdata_interlaced(VAR_0, &VAR_8, &VAR_9, &VAR_14);", "}", "ff_vc1_pred_mv(VAR_0, VAR_1, VAR_8, VAR_9, 0, VAR_0->range_x, VAR_0->range_y, VAR_0->mb_type[0], VAR_14, 0);", "ff_vc1_mc_4mv_luma(VAR_0, VAR_1, 0, 0);", "} else if (VAR_1 == 4)", "ff_vc1_mc_4mv_chroma(VAR_0, 0);", "}", "VAR_7 = VAR_18 & 1;", "}", "if (VAR_7)\nVAR_3 = 1 + get_vlc2(&VAR_0->s.gb, VAR_0->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2);", "if (VAR_3) {", "GET_MQUANT();", "}", "s->current_picture.qscale_table[VAR_2] = VAR_5;", "if (!VAR_0->ttmbf && VAR_3) {", "VAR_6 = get_vlc2(gb, ff_vc1_ttmb_vlc[VAR_0->tt_index].table, VC1_TTMB_VLC_BITS, 2);", "}", "VAR_12 = 0;", "for (VAR_1 = 0; VAR_1 < 6; VAR_1++) {", "s->dc_val[0][s->block_index[VAR_1]] = 0;", "VAR_12 += VAR_1 >> 2;", "VAR_10 = ((VAR_3 >> (5 - VAR_1)) & 1);", "VAR_13 = (VAR_1 & 4) ? 0 : (VAR_1 & 1) * 8 + (VAR_1 & 2) * 4 * s->linesize;", "if (VAR_10) {", "VAR_16 = vc1_decode_p_block(VAR_0, s->block[VAR_1], VAR_1, VAR_5, VAR_6,\nVAR_11, s->dest[VAR_12] + VAR_13,\n(VAR_1 & 4) ? s->uvlinesize : s->linesize,\n(VAR_1 & 4) && (s->flags & CODEC_FLAG_GRAY),\n&VAR_17);", "VAR_15 |= VAR_16 << (VAR_1 << 2);", "if (!VAR_0->ttmbf && VAR_6 < 8) VAR_6 = -1;", "VAR_11 = 0;", "}", "}", "}", "if (s->mb_x == s->mb_width - 1)\nmemmove(VAR_0->is_intra_base, VAR_0->is_intra, sizeof(VAR_0->is_intra_base[0]) * s->mb_stride);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71, 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89, 91 ], [ 93, 95 ], [ 99, 101 ], [ 103, 105 ], [ 107 ], [ 109 ], [ 111, 113, 115, 117 ], [ 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 ] ]
2,368
static bool virtio_scsi_data_plane_handle_ctrl(VirtIODevice *vdev, VirtQueue *vq) { VirtIOSCSI *s = VIRTIO_SCSI(vdev); assert(s->ctx && s->dataplane_started); return virtio_scsi_handle_ctrl_vq(s, vq); }
true
qemu
71407786054cad26de7ef66718b2a57a4bcb49b5
static bool virtio_scsi_data_plane_handle_ctrl(VirtIODevice *vdev, VirtQueue *vq) { VirtIOSCSI *s = VIRTIO_SCSI(vdev); assert(s->ctx && s->dataplane_started); return virtio_scsi_handle_ctrl_vq(s, vq); }
{ "code": [ " return virtio_scsi_handle_ctrl_vq(s, vq);" ], "line_no": [ 13 ] }
static bool FUNC_0(VirtIODevice *vdev, VirtQueue *vq) { VirtIOSCSI *s = VIRTIO_SCSI(vdev); assert(s->ctx && s->dataplane_started); return virtio_scsi_handle_ctrl_vq(s, vq); }
[ "static bool FUNC_0(VirtIODevice *vdev,\nVirtQueue *vq)\n{", "VirtIOSCSI *s = VIRTIO_SCSI(vdev);", "assert(s->ctx && s->dataplane_started);", "return virtio_scsi_handle_ctrl_vq(s, vq);", "}" ]
[ 0, 0, 0, 1, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ] ]
2,369
static void start_tcg_kick_timer(void) { if (!tcg_kick_vcpu_timer && CPU_NEXT(first_cpu)) { tcg_kick_vcpu_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, kick_tcg_thread, NULL); timer_mod(tcg_kick_vcpu_timer, qemu_tcg_next_kick()); } }
true
qemu
372579427a5040a26dfee78464b50e2bdf27ef26
static void start_tcg_kick_timer(void) { if (!tcg_kick_vcpu_timer && CPU_NEXT(first_cpu)) { tcg_kick_vcpu_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, kick_tcg_thread, NULL); timer_mod(tcg_kick_vcpu_timer, qemu_tcg_next_kick()); } }
{ "code": [ " if (!tcg_kick_vcpu_timer && CPU_NEXT(first_cpu)) {" ], "line_no": [ 5 ] }
static void FUNC_0(void) { if (!tcg_kick_vcpu_timer && CPU_NEXT(first_cpu)) { tcg_kick_vcpu_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, kick_tcg_thread, NULL); timer_mod(tcg_kick_vcpu_timer, qemu_tcg_next_kick()); } }
[ "static void FUNC_0(void)\n{", "if (!tcg_kick_vcpu_timer && CPU_NEXT(first_cpu)) {", "tcg_kick_vcpu_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL,\nkick_tcg_thread, NULL);", "timer_mod(tcg_kick_vcpu_timer, qemu_tcg_next_kick());", "}", "}" ]
[ 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 11 ], [ 13 ], [ 15 ] ]
2,370
static void rtc_periodic_timer(void *opaque) { RTCState *s = opaque; rtc_timer_update(s, s->next_periodic_time); #ifdef TARGET_I386 if ((s->cmos_data[RTC_REG_C] & 0xc0) && rtc_td_hack) { s->irq_coalesced++; return; } #endif if (s->cmos_data[RTC_REG_B] & REG_B_PIE) { s->cmos_data[RTC_REG_C] |= 0xc0; rtc_irq_raise(s->irq); } if (s->cmos_data[RTC_REG_B] & REG_B_SQWE) { /* Not square wave at all but we don't want 2048Hz interrupts! Must be seen as a pulse. */ qemu_irq_raise(s->sqw_irq); } }
true
qemu
93b665693dd4afd32c89b0d5ee2b407b26a7a3bc
static void rtc_periodic_timer(void *opaque) { RTCState *s = opaque; rtc_timer_update(s, s->next_periodic_time); #ifdef TARGET_I386 if ((s->cmos_data[RTC_REG_C] & 0xc0) && rtc_td_hack) { s->irq_coalesced++; return; } #endif if (s->cmos_data[RTC_REG_B] & REG_B_PIE) { s->cmos_data[RTC_REG_C] |= 0xc0; rtc_irq_raise(s->irq); } if (s->cmos_data[RTC_REG_B] & REG_B_SQWE) { qemu_irq_raise(s->sqw_irq); } }
{ "code": [ "#ifdef TARGET_I386", " if ((s->cmos_data[RTC_REG_C] & 0xc0) && rtc_td_hack) {", " s->irq_coalesced++;", "#endif", "#ifdef TARGET_I386", "#endif" ], "line_no": [ 11, 13, 15, 21, 11, 21 ] }
static void FUNC_0(void *VAR_0) { RTCState *s = VAR_0; rtc_timer_update(s, s->next_periodic_time); #ifdef TARGET_I386 if ((s->cmos_data[RTC_REG_C] & 0xc0) && rtc_td_hack) { s->irq_coalesced++; return; } #endif if (s->cmos_data[RTC_REG_B] & REG_B_PIE) { s->cmos_data[RTC_REG_C] |= 0xc0; rtc_irq_raise(s->irq); } if (s->cmos_data[RTC_REG_B] & REG_B_SQWE) { qemu_irq_raise(s->sqw_irq); } }
[ "static void FUNC_0(void *VAR_0)\n{", "RTCState *s = VAR_0;", "rtc_timer_update(s, s->next_periodic_time);", "#ifdef TARGET_I386\nif ((s->cmos_data[RTC_REG_C] & 0xc0) && rtc_td_hack) {", "s->irq_coalesced++;", "return;", "}", "#endif\nif (s->cmos_data[RTC_REG_B] & REG_B_PIE) {", "s->cmos_data[RTC_REG_C] |= 0xc0;", "rtc_irq_raise(s->irq);", "}", "if (s->cmos_data[RTC_REG_B] & REG_B_SQWE) {", "qemu_irq_raise(s->sqw_irq);", "}", "}" ]
[ 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11, 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21, 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 37 ], [ 39 ], [ 41 ] ]
2,371
void do_m68k_semihosting(CPUM68KState *env, int nr) { uint32_t args; void *p; void *q; uint32_t len; uint32_t result; args = env->dregs[1]; switch (nr) { case HOSTED_EXIT: gdb_exit(env, env->dregs[0]); exit(env->dregs[0]); case HOSTED_OPEN: if (use_gdb_syscalls()) { gdb_do_syscall(m68k_semi_cb, "open,%s,%x,%x", ARG(0), (int)ARG(1), ARG(2), ARG(3)); return; } else { if (!(p = lock_user_string(ARG(0)))) { /* FIXME - check error code? */ result = -1; } else { result = open(p, translate_openflags(ARG(2)), ARG(3)); unlock_user(p, ARG(0), 0); } } break; case HOSTED_CLOSE: { /* Ignore attempts to close stdin/out/err. */ int fd = ARG(0); if (fd > 2) { if (use_gdb_syscalls()) { gdb_do_syscall(m68k_semi_cb, "close,%x", ARG(0)); return; } else { result = close(fd); } } else { result = 0; } break; } case HOSTED_READ: len = ARG(2); if (use_gdb_syscalls()) { gdb_do_syscall(m68k_semi_cb, "read,%x,%x,%x", ARG(0), ARG(1), len); return; } else { if (!(p = lock_user(VERIFY_WRITE, ARG(1), len, 0))) { /* FIXME - check error code? */ result = -1; } else { result = read(ARG(0), p, len); unlock_user(p, ARG(1), len); } } break; case HOSTED_WRITE: len = ARG(2); if (use_gdb_syscalls()) { gdb_do_syscall(m68k_semi_cb, "write,%x,%x,%x", ARG(0), ARG(1), len); return; } else { if (!(p = lock_user(VERIFY_READ, ARG(1), len, 1))) { /* FIXME - check error code? */ result = -1; } else { result = write(ARG(0), p, len); unlock_user(p, ARG(0), 0); } } break; case HOSTED_LSEEK: { uint64_t off; off = (uint32_t)ARG(2) | ((uint64_t)ARG(1) << 32); if (use_gdb_syscalls()) { m68k_semi_is_fseek = 1; gdb_do_syscall(m68k_semi_cb, "fseek,%x,%lx,%x", ARG(0), off, ARG(3)); } else { off = lseek(ARG(0), off, ARG(3)); /* FIXME - handle put_user() failure */ put_user_u32(off >> 32, args); put_user_u32(off, args + 4); put_user_u32(errno, args + 8); } return; } case HOSTED_RENAME: if (use_gdb_syscalls()) { gdb_do_syscall(m68k_semi_cb, "rename,%s,%s", ARG(0), (int)ARG(1), ARG(2), (int)ARG(3)); return; } else { p = lock_user_string(ARG(0)); q = lock_user_string(ARG(2)); if (!p || !q) { /* FIXME - check error code? */ result = -1; } else { result = rename(p, q); } unlock_user(p, ARG(0), 0); unlock_user(q, ARG(2), 0); } break; case HOSTED_UNLINK: if (use_gdb_syscalls()) { gdb_do_syscall(m68k_semi_cb, "unlink,%s", ARG(0), (int)ARG(1)); return; } else { if (!(p = lock_user_string(ARG(0)))) { /* FIXME - check error code? */ result = -1; } else { result = unlink(p); unlock_user(p, ARG(0), 0); } } break; case HOSTED_STAT: if (use_gdb_syscalls()) { gdb_do_syscall(m68k_semi_cb, "stat,%s,%x", ARG(0), (int)ARG(1), ARG(2)); return; } else { struct stat s; if (!(p = lock_user_string(ARG(0)))) { /* FIXME - check error code? */ result = -1; } else { result = stat(p, &s); unlock_user(p, ARG(0), 0); } if (result == 0) { translate_stat(env, ARG(2), &s); } } break; case HOSTED_FSTAT: if (use_gdb_syscalls()) { gdb_do_syscall(m68k_semi_cb, "fstat,%x,%x", ARG(0), ARG(1)); return; } else { struct stat s; result = fstat(ARG(0), &s); if (result == 0) { translate_stat(env, ARG(1), &s); } } break; case HOSTED_GETTIMEOFDAY: if (use_gdb_syscalls()) { gdb_do_syscall(m68k_semi_cb, "gettimeofday,%x,%x", ARG(0), ARG(1)); return; } else { qemu_timeval tv; struct gdb_timeval *p; result = qemu_gettimeofday(&tv); if (result != 0) { if (!(p = lock_user(VERIFY_WRITE, ARG(0), sizeof(struct gdb_timeval), 0))) { /* FIXME - check error code? */ result = -1; } else { p->tv_sec = cpu_to_be32(tv.tv_sec); p->tv_usec = cpu_to_be64(tv.tv_usec); unlock_user(p, ARG(0), sizeof(struct gdb_timeval)); } } } break; case HOSTED_ISATTY: if (use_gdb_syscalls()) { gdb_do_syscall(m68k_semi_cb, "isatty,%x", ARG(0)); return; } else { result = isatty(ARG(0)); } break; case HOSTED_SYSTEM: if (use_gdb_syscalls()) { gdb_do_syscall(m68k_semi_cb, "system,%s", ARG(0), (int)ARG(1)); return; } else { if (!(p = lock_user_string(ARG(0)))) { /* FIXME - check error code? */ result = -1; } else { result = system(p); unlock_user(p, ARG(0), 0); } } break; case HOSTED_INIT_SIM: #if defined(CONFIG_USER_ONLY) { TaskState *ts = env->opaque; /* Allocate the heap using sbrk. */ if (!ts->heap_limit) { long ret; uint32_t size; uint32_t base; base = do_brk(0); size = SEMIHOSTING_HEAP_SIZE; /* Try a big heap, and reduce the size if that fails. */ for (;;) { ret = do_brk(base + size); if (ret != -1) break; size >>= 1; } ts->heap_limit = base + size; } /* This call may happen before we have writable memory, so return values directly in registers. */ env->dregs[1] = ts->heap_limit; env->aregs[7] = ts->stack_base; } #else /* FIXME: This is wrong for boards where RAM does not start at address zero. */ env->dregs[1] = ram_size; env->aregs[7] = ram_size; #endif return; default: cpu_abort(env, "Unsupported semihosting syscall %d\n", nr); result = 0; } /* FIXME - handle put_user() failure */ put_user_u32(result, args); put_user_u32(errno, args + 4); }
true
qemu
5382a012e8ce7cf5ea612d291286be827574c181
void do_m68k_semihosting(CPUM68KState *env, int nr) { uint32_t args; void *p; void *q; uint32_t len; uint32_t result; args = env->dregs[1]; switch (nr) { case HOSTED_EXIT: gdb_exit(env, env->dregs[0]); exit(env->dregs[0]); case HOSTED_OPEN: if (use_gdb_syscalls()) { gdb_do_syscall(m68k_semi_cb, "open,%s,%x,%x", ARG(0), (int)ARG(1), ARG(2), ARG(3)); return; } else { if (!(p = lock_user_string(ARG(0)))) { result = -1; } else { result = open(p, translate_openflags(ARG(2)), ARG(3)); unlock_user(p, ARG(0), 0); } } break; case HOSTED_CLOSE: { int fd = ARG(0); if (fd > 2) { if (use_gdb_syscalls()) { gdb_do_syscall(m68k_semi_cb, "close,%x", ARG(0)); return; } else { result = close(fd); } } else { result = 0; } break; } case HOSTED_READ: len = ARG(2); if (use_gdb_syscalls()) { gdb_do_syscall(m68k_semi_cb, "read,%x,%x,%x", ARG(0), ARG(1), len); return; } else { if (!(p = lock_user(VERIFY_WRITE, ARG(1), len, 0))) { result = -1; } else { result = read(ARG(0), p, len); unlock_user(p, ARG(1), len); } } break; case HOSTED_WRITE: len = ARG(2); if (use_gdb_syscalls()) { gdb_do_syscall(m68k_semi_cb, "write,%x,%x,%x", ARG(0), ARG(1), len); return; } else { if (!(p = lock_user(VERIFY_READ, ARG(1), len, 1))) { result = -1; } else { result = write(ARG(0), p, len); unlock_user(p, ARG(0), 0); } } break; case HOSTED_LSEEK: { uint64_t off; off = (uint32_t)ARG(2) | ((uint64_t)ARG(1) << 32); if (use_gdb_syscalls()) { m68k_semi_is_fseek = 1; gdb_do_syscall(m68k_semi_cb, "fseek,%x,%lx,%x", ARG(0), off, ARG(3)); } else { off = lseek(ARG(0), off, ARG(3)); put_user_u32(off >> 32, args); put_user_u32(off, args + 4); put_user_u32(errno, args + 8); } return; } case HOSTED_RENAME: if (use_gdb_syscalls()) { gdb_do_syscall(m68k_semi_cb, "rename,%s,%s", ARG(0), (int)ARG(1), ARG(2), (int)ARG(3)); return; } else { p = lock_user_string(ARG(0)); q = lock_user_string(ARG(2)); if (!p || !q) { result = -1; } else { result = rename(p, q); } unlock_user(p, ARG(0), 0); unlock_user(q, ARG(2), 0); } break; case HOSTED_UNLINK: if (use_gdb_syscalls()) { gdb_do_syscall(m68k_semi_cb, "unlink,%s", ARG(0), (int)ARG(1)); return; } else { if (!(p = lock_user_string(ARG(0)))) { result = -1; } else { result = unlink(p); unlock_user(p, ARG(0), 0); } } break; case HOSTED_STAT: if (use_gdb_syscalls()) { gdb_do_syscall(m68k_semi_cb, "stat,%s,%x", ARG(0), (int)ARG(1), ARG(2)); return; } else { struct stat s; if (!(p = lock_user_string(ARG(0)))) { result = -1; } else { result = stat(p, &s); unlock_user(p, ARG(0), 0); } if (result == 0) { translate_stat(env, ARG(2), &s); } } break; case HOSTED_FSTAT: if (use_gdb_syscalls()) { gdb_do_syscall(m68k_semi_cb, "fstat,%x,%x", ARG(0), ARG(1)); return; } else { struct stat s; result = fstat(ARG(0), &s); if (result == 0) { translate_stat(env, ARG(1), &s); } } break; case HOSTED_GETTIMEOFDAY: if (use_gdb_syscalls()) { gdb_do_syscall(m68k_semi_cb, "gettimeofday,%x,%x", ARG(0), ARG(1)); return; } else { qemu_timeval tv; struct gdb_timeval *p; result = qemu_gettimeofday(&tv); if (result != 0) { if (!(p = lock_user(VERIFY_WRITE, ARG(0), sizeof(struct gdb_timeval), 0))) { result = -1; } else { p->tv_sec = cpu_to_be32(tv.tv_sec); p->tv_usec = cpu_to_be64(tv.tv_usec); unlock_user(p, ARG(0), sizeof(struct gdb_timeval)); } } } break; case HOSTED_ISATTY: if (use_gdb_syscalls()) { gdb_do_syscall(m68k_semi_cb, "isatty,%x", ARG(0)); return; } else { result = isatty(ARG(0)); } break; case HOSTED_SYSTEM: if (use_gdb_syscalls()) { gdb_do_syscall(m68k_semi_cb, "system,%s", ARG(0), (int)ARG(1)); return; } else { if (!(p = lock_user_string(ARG(0)))) { result = -1; } else { result = system(p); unlock_user(p, ARG(0), 0); } } break; case HOSTED_INIT_SIM: #if defined(CONFIG_USER_ONLY) { TaskState *ts = env->opaque; if (!ts->heap_limit) { long ret; uint32_t size; uint32_t base; base = do_brk(0); size = SEMIHOSTING_HEAP_SIZE; for (;;) { ret = do_brk(base + size); if (ret != -1) break; size >>= 1; } ts->heap_limit = base + size; } env->dregs[1] = ts->heap_limit; env->aregs[7] = ts->stack_base; } #else env->dregs[1] = ram_size; env->aregs[7] = ram_size; #endif return; default: cpu_abort(env, "Unsupported semihosting syscall %d\n", nr); result = 0; } put_user_u32(result, args); put_user_u32(errno, args + 4); }
{ "code": [ " long ret;", " if (ret != -1)" ], "line_no": [ 419, 437 ] }
void FUNC_0(CPUM68KState *VAR_0, int VAR_1) { uint32_t args; void *VAR_6; void *VAR_3; uint32_t len; uint32_t result; args = VAR_0->dregs[1]; switch (VAR_1) { case HOSTED_EXIT: gdb_exit(VAR_0, VAR_0->dregs[0]); exit(VAR_0->dregs[0]); case HOSTED_OPEN: if (use_gdb_syscalls()) { gdb_do_syscall(m68k_semi_cb, "open,%VAR_6,%x,%x", ARG(0), (int)ARG(1), ARG(2), ARG(3)); return; } else { if (!(VAR_6 = lock_user_string(ARG(0)))) { result = -1; } else { result = open(VAR_6, translate_openflags(ARG(2)), ARG(3)); unlock_user(VAR_6, ARG(0), 0); } } break; case HOSTED_CLOSE: { int VAR_4 = ARG(0); if (VAR_4 > 2) { if (use_gdb_syscalls()) { gdb_do_syscall(m68k_semi_cb, "close,%x", ARG(0)); return; } else { result = close(VAR_4); } } else { result = 0; } break; } case HOSTED_READ: len = ARG(2); if (use_gdb_syscalls()) { gdb_do_syscall(m68k_semi_cb, "read,%x,%x,%x", ARG(0), ARG(1), len); return; } else { if (!(VAR_6 = lock_user(VERIFY_WRITE, ARG(1), len, 0))) { result = -1; } else { result = read(ARG(0), VAR_6, len); unlock_user(VAR_6, ARG(1), len); } } break; case HOSTED_WRITE: len = ARG(2); if (use_gdb_syscalls()) { gdb_do_syscall(m68k_semi_cb, "write,%x,%x,%x", ARG(0), ARG(1), len); return; } else { if (!(VAR_6 = lock_user(VERIFY_READ, ARG(1), len, 1))) { result = -1; } else { result = write(ARG(0), VAR_6, len); unlock_user(VAR_6, ARG(0), 0); } } break; case HOSTED_LSEEK: { uint64_t off; off = (uint32_t)ARG(2) | ((uint64_t)ARG(1) << 32); if (use_gdb_syscalls()) { m68k_semi_is_fseek = 1; gdb_do_syscall(m68k_semi_cb, "fseek,%x,%lx,%x", ARG(0), off, ARG(3)); } else { off = lseek(ARG(0), off, ARG(3)); put_user_u32(off >> 32, args); put_user_u32(off, args + 4); put_user_u32(errno, args + 8); } return; } case HOSTED_RENAME: if (use_gdb_syscalls()) { gdb_do_syscall(m68k_semi_cb, "rename,%VAR_6,%VAR_6", ARG(0), (int)ARG(1), ARG(2), (int)ARG(3)); return; } else { VAR_6 = lock_user_string(ARG(0)); VAR_3 = lock_user_string(ARG(2)); if (!VAR_6 || !VAR_3) { result = -1; } else { result = rename(VAR_6, VAR_3); } unlock_user(VAR_6, ARG(0), 0); unlock_user(VAR_3, ARG(2), 0); } break; case HOSTED_UNLINK: if (use_gdb_syscalls()) { gdb_do_syscall(m68k_semi_cb, "unlink,%VAR_6", ARG(0), (int)ARG(1)); return; } else { if (!(VAR_6 = lock_user_string(ARG(0)))) { result = -1; } else { result = unlink(VAR_6); unlock_user(VAR_6, ARG(0), 0); } } break; case HOSTED_STAT: if (use_gdb_syscalls()) { gdb_do_syscall(m68k_semi_cb, "stat,%VAR_6,%x", ARG(0), (int)ARG(1), ARG(2)); return; } else { struct stat VAR_6; if (!(VAR_6 = lock_user_string(ARG(0)))) { result = -1; } else { result = stat(VAR_6, &VAR_6); unlock_user(VAR_6, ARG(0), 0); } if (result == 0) { translate_stat(VAR_0, ARG(2), &VAR_6); } } break; case HOSTED_FSTAT: if (use_gdb_syscalls()) { gdb_do_syscall(m68k_semi_cb, "fstat,%x,%x", ARG(0), ARG(1)); return; } else { struct stat VAR_6; result = fstat(ARG(0), &VAR_6); if (result == 0) { translate_stat(VAR_0, ARG(1), &VAR_6); } } break; case HOSTED_GETTIMEOFDAY: if (use_gdb_syscalls()) { gdb_do_syscall(m68k_semi_cb, "gettimeofday,%x,%x", ARG(0), ARG(1)); return; } else { qemu_timeval tv; struct gdb_timeval *VAR_6; result = qemu_gettimeofday(&tv); if (result != 0) { if (!(VAR_6 = lock_user(VERIFY_WRITE, ARG(0), sizeof(struct gdb_timeval), 0))) { result = -1; } else { VAR_6->tv_sec = cpu_to_be32(tv.tv_sec); VAR_6->tv_usec = cpu_to_be64(tv.tv_usec); unlock_user(VAR_6, ARG(0), sizeof(struct gdb_timeval)); } } } break; case HOSTED_ISATTY: if (use_gdb_syscalls()) { gdb_do_syscall(m68k_semi_cb, "isatty,%x", ARG(0)); return; } else { result = isatty(ARG(0)); } break; case HOSTED_SYSTEM: if (use_gdb_syscalls()) { gdb_do_syscall(m68k_semi_cb, "system,%VAR_6", ARG(0), (int)ARG(1)); return; } else { if (!(VAR_6 = lock_user_string(ARG(0)))) { result = -1; } else { result = system(VAR_6); unlock_user(VAR_6, ARG(0), 0); } } break; case HOSTED_INIT_SIM: #if defined(CONFIG_USER_ONLY) { TaskState *ts = VAR_0->opaque; if (!ts->heap_limit) { long ret; uint32_t size; uint32_t base; base = do_brk(0); size = SEMIHOSTING_HEAP_SIZE; for (;;) { ret = do_brk(base + size); if (ret != -1) break; size >>= 1; } ts->heap_limit = base + size; } VAR_0->dregs[1] = ts->heap_limit; VAR_0->aregs[7] = ts->stack_base; } #else VAR_0->dregs[1] = ram_size; VAR_0->aregs[7] = ram_size; #endif return; default: cpu_abort(VAR_0, "Unsupported semihosting syscall %d\n", VAR_1); result = 0; } put_user_u32(result, args); put_user_u32(errno, args + 4); }
[ "void FUNC_0(CPUM68KState *VAR_0, int VAR_1)\n{", "uint32_t args;", "void *VAR_6;", "void *VAR_3;", "uint32_t len;", "uint32_t result;", "args = VAR_0->dregs[1];", "switch (VAR_1) {", "case HOSTED_EXIT:\ngdb_exit(VAR_0, VAR_0->dregs[0]);", "exit(VAR_0->dregs[0]);", "case HOSTED_OPEN:\nif (use_gdb_syscalls()) {", "gdb_do_syscall(m68k_semi_cb, \"open,%VAR_6,%x,%x\", ARG(0), (int)ARG(1),\nARG(2), ARG(3));", "return;", "} else {", "if (!(VAR_6 = lock_user_string(ARG(0)))) {", "result = -1;", "} else {", "result = open(VAR_6, translate_openflags(ARG(2)), ARG(3));", "unlock_user(VAR_6, ARG(0), 0);", "}", "}", "break;", "case HOSTED_CLOSE:\n{", "int VAR_4 = ARG(0);", "if (VAR_4 > 2) {", "if (use_gdb_syscalls()) {", "gdb_do_syscall(m68k_semi_cb, \"close,%x\", ARG(0));", "return;", "} else {", "result = close(VAR_4);", "}", "} else {", "result = 0;", "}", "break;", "}", "case HOSTED_READ:\nlen = ARG(2);", "if (use_gdb_syscalls()) {", "gdb_do_syscall(m68k_semi_cb, \"read,%x,%x,%x\",\nARG(0), ARG(1), len);", "return;", "} else {", "if (!(VAR_6 = lock_user(VERIFY_WRITE, ARG(1), len, 0))) {", "result = -1;", "} else {", "result = read(ARG(0), VAR_6, len);", "unlock_user(VAR_6, ARG(1), len);", "}", "}", "break;", "case HOSTED_WRITE:\nlen = ARG(2);", "if (use_gdb_syscalls()) {", "gdb_do_syscall(m68k_semi_cb, \"write,%x,%x,%x\",\nARG(0), ARG(1), len);", "return;", "} else {", "if (!(VAR_6 = lock_user(VERIFY_READ, ARG(1), len, 1))) {", "result = -1;", "} else {", "result = write(ARG(0), VAR_6, len);", "unlock_user(VAR_6, ARG(0), 0);", "}", "}", "break;", "case HOSTED_LSEEK:\n{", "uint64_t off;", "off = (uint32_t)ARG(2) | ((uint64_t)ARG(1) << 32);", "if (use_gdb_syscalls()) {", "m68k_semi_is_fseek = 1;", "gdb_do_syscall(m68k_semi_cb, \"fseek,%x,%lx,%x\",\nARG(0), off, ARG(3));", "} else {", "off = lseek(ARG(0), off, ARG(3));", "put_user_u32(off >> 32, args);", "put_user_u32(off, args + 4);", "put_user_u32(errno, args + 8);", "}", "return;", "}", "case HOSTED_RENAME:\nif (use_gdb_syscalls()) {", "gdb_do_syscall(m68k_semi_cb, \"rename,%VAR_6,%VAR_6\",\nARG(0), (int)ARG(1), ARG(2), (int)ARG(3));", "return;", "} else {", "VAR_6 = lock_user_string(ARG(0));", "VAR_3 = lock_user_string(ARG(2));", "if (!VAR_6 || !VAR_3) {", "result = -1;", "} else {", "result = rename(VAR_6, VAR_3);", "}", "unlock_user(VAR_6, ARG(0), 0);", "unlock_user(VAR_3, ARG(2), 0);", "}", "break;", "case HOSTED_UNLINK:\nif (use_gdb_syscalls()) {", "gdb_do_syscall(m68k_semi_cb, \"unlink,%VAR_6\",\nARG(0), (int)ARG(1));", "return;", "} else {", "if (!(VAR_6 = lock_user_string(ARG(0)))) {", "result = -1;", "} else {", "result = unlink(VAR_6);", "unlock_user(VAR_6, ARG(0), 0);", "}", "}", "break;", "case HOSTED_STAT:\nif (use_gdb_syscalls()) {", "gdb_do_syscall(m68k_semi_cb, \"stat,%VAR_6,%x\",\nARG(0), (int)ARG(1), ARG(2));", "return;", "} else {", "struct stat VAR_6;", "if (!(VAR_6 = lock_user_string(ARG(0)))) {", "result = -1;", "} else {", "result = stat(VAR_6, &VAR_6);", "unlock_user(VAR_6, ARG(0), 0);", "}", "if (result == 0) {", "translate_stat(VAR_0, ARG(2), &VAR_6);", "}", "}", "break;", "case HOSTED_FSTAT:\nif (use_gdb_syscalls()) {", "gdb_do_syscall(m68k_semi_cb, \"fstat,%x,%x\",\nARG(0), ARG(1));", "return;", "} else {", "struct stat VAR_6;", "result = fstat(ARG(0), &VAR_6);", "if (result == 0) {", "translate_stat(VAR_0, ARG(1), &VAR_6);", "}", "}", "break;", "case HOSTED_GETTIMEOFDAY:\nif (use_gdb_syscalls()) {", "gdb_do_syscall(m68k_semi_cb, \"gettimeofday,%x,%x\",\nARG(0), ARG(1));", "return;", "} else {", "qemu_timeval tv;", "struct gdb_timeval *VAR_6;", "result = qemu_gettimeofday(&tv);", "if (result != 0) {", "if (!(VAR_6 = lock_user(VERIFY_WRITE,\nARG(0), sizeof(struct gdb_timeval), 0))) {", "result = -1;", "} else {", "VAR_6->tv_sec = cpu_to_be32(tv.tv_sec);", "VAR_6->tv_usec = cpu_to_be64(tv.tv_usec);", "unlock_user(VAR_6, ARG(0), sizeof(struct gdb_timeval));", "}", "}", "}", "break;", "case HOSTED_ISATTY:\nif (use_gdb_syscalls()) {", "gdb_do_syscall(m68k_semi_cb, \"isatty,%x\", ARG(0));", "return;", "} else {", "result = isatty(ARG(0));", "}", "break;", "case HOSTED_SYSTEM:\nif (use_gdb_syscalls()) {", "gdb_do_syscall(m68k_semi_cb, \"system,%VAR_6\",\nARG(0), (int)ARG(1));", "return;", "} else {", "if (!(VAR_6 = lock_user_string(ARG(0)))) {", "result = -1;", "} else {", "result = system(VAR_6);", "unlock_user(VAR_6, ARG(0), 0);", "}", "}", "break;", "case HOSTED_INIT_SIM:\n#if defined(CONFIG_USER_ONLY)\n{", "TaskState *ts = VAR_0->opaque;", "if (!ts->heap_limit) {", "long ret;", "uint32_t size;", "uint32_t base;", "base = do_brk(0);", "size = SEMIHOSTING_HEAP_SIZE;", "for (;;) {", "ret = do_brk(base + size);", "if (ret != -1)\nbreak;", "size >>= 1;", "}", "ts->heap_limit = base + size;", "}", "VAR_0->dregs[1] = ts->heap_limit;", "VAR_0->aregs[7] = ts->stack_base;", "}", "#else\nVAR_0->dregs[1] = ram_size;", "VAR_0->aregs[7] = ram_size;", "#endif\nreturn;", "default:\ncpu_abort(VAR_0, \"Unsupported semihosting syscall %d\\n\", VAR_1);", "result = 0;", "}", "put_user_u32(result, args);", "put_user_u32(errno, args + 4);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 1, 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 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57, 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89, 91 ], [ 93 ], [ 95, 97 ], [ 99 ], [ 101 ], [ 103 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121, 123 ], [ 125 ], [ 127, 129 ], [ 131 ], [ 133 ], [ 135 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153, 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165, 167 ], [ 169 ], [ 171 ], [ 175 ], [ 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 ], [ 249 ], [ 251 ], [ 253, 255 ], [ 257, 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 271 ], [ 273 ], [ 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ], [ 291, 293 ], [ 295, 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305 ], [ 307 ], [ 309 ], [ 311 ], [ 313 ], [ 315 ], [ 317, 319 ], [ 321, 323 ], [ 325 ], [ 327 ], [ 329 ], [ 331 ], [ 333 ], [ 335 ], [ 337, 339 ], [ 343 ], [ 345 ], [ 347 ], [ 349 ], [ 351 ], [ 353 ], [ 355 ], [ 357 ], [ 359 ], [ 361, 363 ], [ 365 ], [ 367 ], [ 369 ], [ 371 ], [ 373 ], [ 375 ], [ 377, 379 ], [ 381, 383 ], [ 385 ], [ 387 ], [ 389 ], [ 393 ], [ 395 ], [ 397 ], [ 399 ], [ 401 ], [ 403 ], [ 405 ], [ 407, 409, 411 ], [ 413 ], [ 417 ], [ 419 ], [ 421 ], [ 423 ], [ 427 ], [ 429 ], [ 433 ], [ 435 ], [ 437, 439 ], [ 441 ], [ 443 ], [ 445 ], [ 447 ], [ 453 ], [ 455 ], [ 457 ], [ 459, 465 ], [ 467 ], [ 469, 471 ], [ 473, 475 ], [ 477 ], [ 479 ], [ 483 ], [ 485 ], [ 487 ] ]
2,372
static uint8_t get_tlm(Jpeg2000DecoderContext *s, int n) { uint8_t Stlm, ST, SP, tile_tlm, i; bytestream_get_byte(&s->buf); /* Ztlm: skipped */ Stlm = bytestream_get_byte(&s->buf); // too complex ? ST = ((Stlm >> 4) & 0x01) + ((Stlm >> 4) & 0x02); ST = (Stlm >> 4) & 0x03; // TODO: Manage case of ST = 0b11 --> raise error SP = (Stlm >> 6) & 0x01; tile_tlm = (n - 4) / ((SP + 1) * 2 + ST); for (i = 0; i < tile_tlm; i++) { switch (ST) { case 0: break; case 1: bytestream_get_byte(&s->buf); break; case 2: bytestream_get_be16(&s->buf); break; case 3: bytestream_get_be32(&s->buf); break; } if (SP == 0) { bytestream_get_be16(&s->buf); } else { bytestream_get_be32(&s->buf); } } return 0; }
true
FFmpeg
1a3598aae768465a8efc8475b6df5a8261bc62fc
static uint8_t get_tlm(Jpeg2000DecoderContext *s, int n) { uint8_t Stlm, ST, SP, tile_tlm, i; bytestream_get_byte(&s->buf); Stlm = bytestream_get_byte(&s->buf); ST = (Stlm >> 4) & 0x03; SP = (Stlm >> 6) & 0x01; tile_tlm = (n - 4) / ((SP + 1) * 2 + ST); for (i = 0; i < tile_tlm; i++) { switch (ST) { case 0: break; case 1: bytestream_get_byte(&s->buf); break; case 2: bytestream_get_be16(&s->buf); break; case 3: bytestream_get_be32(&s->buf); break; } if (SP == 0) { bytestream_get_be16(&s->buf); } else { bytestream_get_be32(&s->buf); } } return 0; }
{ "code": [ " Stlm = bytestream_get_byte(&s->buf);", " bytestream_get_byte(&s->buf);", " bytestream_get_be16(&s->buf);", " bytestream_get_be32(&s->buf);", " bytestream_get_be16(&s->buf);", " bytestream_get_be32(&s->buf);" ], "line_no": [ 9, 33, 39, 45, 39, 45 ] }
static uint8_t FUNC_0(Jpeg2000DecoderContext *s, int n) { uint8_t Stlm, ST, SP, tile_tlm, i; bytestream_get_byte(&s->buf); Stlm = bytestream_get_byte(&s->buf); ST = (Stlm >> 4) & 0x03; SP = (Stlm >> 6) & 0x01; tile_tlm = (n - 4) / ((SP + 1) * 2 + ST); for (i = 0; i < tile_tlm; i++) { switch (ST) { case 0: break; case 1: bytestream_get_byte(&s->buf); break; case 2: bytestream_get_be16(&s->buf); break; case 3: bytestream_get_be32(&s->buf); break; } if (SP == 0) { bytestream_get_be16(&s->buf); } else { bytestream_get_be32(&s->buf); } } return 0; }
[ "static uint8_t FUNC_0(Jpeg2000DecoderContext *s, int n)\n{", "uint8_t Stlm, ST, SP, tile_tlm, i;", "bytestream_get_byte(&s->buf);", "Stlm = bytestream_get_byte(&s->buf);", "ST = (Stlm >> 4) & 0x03;", "SP = (Stlm >> 6) & 0x01;", "tile_tlm = (n - 4) / ((SP + 1) * 2 + ST);", "for (i = 0; i < tile_tlm; i++) {", "switch (ST) {", "case 0:\nbreak;", "case 1:\nbytestream_get_byte(&s->buf);", "break;", "case 2:\nbytestream_get_be16(&s->buf);", "break;", "case 3:\nbytestream_get_be32(&s->buf);", "break;", "}", "if (SP == 0) {", "bytestream_get_be16(&s->buf);", "} else {", "bytestream_get_be32(&s->buf);", "}", "}", "return 0;", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 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 ] ]
2,373
static int decode_seq_header(AVSContext *h) { MpegEncContext *s = &h->s; int frame_rate_code; int width, height; h->profile = get_bits(&s->gb,8); h->level = get_bits(&s->gb,8); skip_bits1(&s->gb); //progressive sequence width = get_bits(&s->gb,14); height = get_bits(&s->gb,14); if ((s->width || s->height) && (s->width != width || s->height != height)) { av_log_missing_feature(s, "Width/height changing in CAVS is", 0); return -1; s->width = width; s->height = height; skip_bits(&s->gb,2); //chroma format skip_bits(&s->gb,3); //sample_precision h->aspect_ratio = get_bits(&s->gb,4); frame_rate_code = get_bits(&s->gb,4); skip_bits(&s->gb,18);//bit_rate_lower skip_bits1(&s->gb); //marker_bit skip_bits(&s->gb,12);//bit_rate_upper s->low_delay = get_bits1(&s->gb); h->mb_width = (s->width + 15) >> 4; h->mb_height = (s->height + 15) >> 4; h->s.avctx->time_base.den = avpriv_frame_rate_tab[frame_rate_code].num; h->s.avctx->time_base.num = avpriv_frame_rate_tab[frame_rate_code].den; h->s.avctx->width = s->width; h->s.avctx->height = s->height; if(!h->top_qp) ff_cavs_init_top_lines(h); return 0;
true
FFmpeg
f9505923a344a56c3ff36925adb7f0c3c9a3996c
static int decode_seq_header(AVSContext *h) { MpegEncContext *s = &h->s; int frame_rate_code; int width, height; h->profile = get_bits(&s->gb,8); h->level = get_bits(&s->gb,8); skip_bits1(&s->gb); width = get_bits(&s->gb,14); height = get_bits(&s->gb,14); if ((s->width || s->height) && (s->width != width || s->height != height)) { av_log_missing_feature(s, "Width/height changing in CAVS is", 0); return -1; s->width = width; s->height = height; skip_bits(&s->gb,2); skip_bits(&s->gb,3); h->aspect_ratio = get_bits(&s->gb,4); frame_rate_code = get_bits(&s->gb,4); skip_bits(&s->gb,18); skip_bits1(&s->gb); skip_bits(&s->gb,12); s->low_delay = get_bits1(&s->gb); h->mb_width = (s->width + 15) >> 4; h->mb_height = (s->height + 15) >> 4; h->s.avctx->time_base.den = avpriv_frame_rate_tab[frame_rate_code].num; h->s.avctx->time_base.num = avpriv_frame_rate_tab[frame_rate_code].den; h->s.avctx->width = s->width; h->s.avctx->height = s->height; if(!h->top_qp) ff_cavs_init_top_lines(h); return 0;
{ "code": [], "line_no": [] }
static int FUNC_0(AVSContext *VAR_0) { MpegEncContext *s = &VAR_0->s; int VAR_1; int VAR_2, VAR_3; VAR_0->profile = get_bits(&s->gb,8); VAR_0->level = get_bits(&s->gb,8); skip_bits1(&s->gb); VAR_2 = get_bits(&s->gb,14); VAR_3 = get_bits(&s->gb,14); if ((s->VAR_2 || s->VAR_3) && (s->VAR_2 != VAR_2 || s->VAR_3 != VAR_3)) { av_log_missing_feature(s, "Width/VAR_3 changing in CAVS is", 0); return -1; s->VAR_2 = VAR_2; s->VAR_3 = VAR_3; skip_bits(&s->gb,2); skip_bits(&s->gb,3); VAR_0->aspect_ratio = get_bits(&s->gb,4); VAR_1 = get_bits(&s->gb,4); skip_bits(&s->gb,18); skip_bits1(&s->gb); skip_bits(&s->gb,12); s->low_delay = get_bits1(&s->gb); VAR_0->mb_width = (s->VAR_2 + 15) >> 4; VAR_0->mb_height = (s->VAR_3 + 15) >> 4; VAR_0->s.avctx->time_base.den = avpriv_frame_rate_tab[VAR_1].num; VAR_0->s.avctx->time_base.num = avpriv_frame_rate_tab[VAR_1].den; VAR_0->s.avctx->VAR_2 = s->VAR_2; VAR_0->s.avctx->VAR_3 = s->VAR_3; if(!VAR_0->top_qp) ff_cavs_init_top_lines(VAR_0); return 0;
[ "static int FUNC_0(AVSContext *VAR_0) {", "MpegEncContext *s = &VAR_0->s;", "int VAR_1;", "int VAR_2, VAR_3;", "VAR_0->profile = get_bits(&s->gb,8);", "VAR_0->level = get_bits(&s->gb,8);", "skip_bits1(&s->gb);", "VAR_2 = get_bits(&s->gb,14);", "VAR_3 = get_bits(&s->gb,14);", "if ((s->VAR_2 || s->VAR_3) && (s->VAR_2 != VAR_2 || s->VAR_3 != VAR_3)) {", "av_log_missing_feature(s, \"Width/VAR_3 changing in CAVS is\", 0);", "return -1;", "s->VAR_2 = VAR_2;", "s->VAR_3 = VAR_3;", "skip_bits(&s->gb,2);", "skip_bits(&s->gb,3);", "VAR_0->aspect_ratio = get_bits(&s->gb,4);", "VAR_1 = get_bits(&s->gb,4);", "skip_bits(&s->gb,18);", "skip_bits1(&s->gb);", "skip_bits(&s->gb,12);", "s->low_delay = get_bits1(&s->gb);", "VAR_0->mb_width = (s->VAR_2 + 15) >> 4;", "VAR_0->mb_height = (s->VAR_3 + 15) >> 4;", "VAR_0->s.avctx->time_base.den = avpriv_frame_rate_tab[VAR_1].num;", "VAR_0->s.avctx->time_base.num = avpriv_frame_rate_tab[VAR_1].den;", "VAR_0->s.avctx->VAR_2 = s->VAR_2;", "VAR_0->s.avctx->VAR_3 = s->VAR_3;", "if(!VAR_0->top_qp)\nff_cavs_init_top_lines(VAR_0);", "return 0;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 32 ], [ 34 ], [ 36 ], [ 38 ], [ 40 ], [ 42 ], [ 44 ], [ 46 ], [ 48 ], [ 50 ], [ 52 ], [ 54 ], [ 56 ], [ 58 ], [ 60 ], [ 62 ], [ 64, 66 ], [ 68 ] ]
2,374
static int qemu_chr_open_win_pipe(QemuOpts *opts, CharDriverState **_chr) { const char *filename = qemu_opt_get(opts, "path"); CharDriverState *chr; WinCharState *s; chr = g_malloc0(sizeof(CharDriverState)); s = g_malloc0(sizeof(WinCharState)); chr->opaque = s; chr->chr_write = win_chr_write; chr->chr_close = win_chr_close; if (win_chr_pipe_init(chr, filename) < 0) { g_free(s); g_free(chr); return -EIO; } qemu_chr_generic_open(chr); *_chr = chr; return 0; }
true
qemu
1f51470d044852592922f91000e741c381582cdc
static int qemu_chr_open_win_pipe(QemuOpts *opts, CharDriverState **_chr) { const char *filename = qemu_opt_get(opts, "path"); CharDriverState *chr; WinCharState *s; chr = g_malloc0(sizeof(CharDriverState)); s = g_malloc0(sizeof(WinCharState)); chr->opaque = s; chr->chr_write = win_chr_write; chr->chr_close = win_chr_close; if (win_chr_pipe_init(chr, filename) < 0) { g_free(s); g_free(chr); return -EIO; } qemu_chr_generic_open(chr); *_chr = chr; return 0; }
{ "code": [ " *_chr = chr;", " return 0;", " *_chr = chr;", " return 0;", " *_chr = chr;", " return 0;", " return 0;", " return 0;", " return 0;", " *_chr = chr;", " return 0;", " *_chr = chr;", " return 0;", " *_chr = chr;", " return 0;", " *_chr = chr;", " return 0;", " *_chr = chr;", " return 0;", " return -EIO;", " *_chr = chr;", " return 0;", "static int qemu_chr_open_win_pipe(QemuOpts *opts, CharDriverState **_chr)", " return -EIO;", " *_chr = chr;", " return 0;", " return 0;", " return -EIO;", " return -EIO;", " *_chr = chr;", " return 0;", " *_chr = chr;", " return 0;", " *_chr = chr;", " return 0;", " *_chr = chr;", " return 0;" ], "line_no": [ 39, 41, 39, 41, 39, 41, 41, 41, 41, 39, 41, 39, 41, 39, 41, 39, 41, 39, 41, 31, 39, 41, 1, 31, 39, 41, 41, 31, 31, 39, 41, 39, 41, 39, 41, 39, 41 ] }
static int FUNC_0(QemuOpts *VAR_0, CharDriverState **VAR_1) { const char *VAR_2 = qemu_opt_get(VAR_0, "path"); CharDriverState *chr; WinCharState *s; chr = g_malloc0(sizeof(CharDriverState)); s = g_malloc0(sizeof(WinCharState)); chr->opaque = s; chr->chr_write = win_chr_write; chr->chr_close = win_chr_close; if (win_chr_pipe_init(chr, VAR_2) < 0) { g_free(s); g_free(chr); return -EIO; } qemu_chr_generic_open(chr); *VAR_1 = chr; return 0; }
[ "static int FUNC_0(QemuOpts *VAR_0, CharDriverState **VAR_1)\n{", "const char *VAR_2 = qemu_opt_get(VAR_0, \"path\");", "CharDriverState *chr;", "WinCharState *s;", "chr = g_malloc0(sizeof(CharDriverState));", "s = g_malloc0(sizeof(WinCharState));", "chr->opaque = s;", "chr->chr_write = win_chr_write;", "chr->chr_close = win_chr_close;", "if (win_chr_pipe_init(chr, VAR_2) < 0) {", "g_free(s);", "g_free(chr);", "return -EIO;", "}", "qemu_chr_generic_open(chr);", "*VAR_1 = chr;", "return 0;", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ] ]
2,375
SnapshotInfo *qmp_blockdev_snapshot_delete_internal_sync(const char *device, bool has_id, const char *id, bool has_name, const char *name, Error **errp) { BlockDriverState *bs = bdrv_find(device); QEMUSnapshotInfo sn; Error *local_err = NULL; SnapshotInfo *info = NULL; int ret; if (!bs) { error_set(errp, QERR_DEVICE_NOT_FOUND, device); return NULL; } if (!has_id) { id = NULL; } if (!has_name) { name = NULL; } if (!id && !name) { error_setg(errp, "Name or id must be provided"); return NULL; } ret = bdrv_snapshot_find_by_id_and_name(bs, id, name, &sn, &local_err); if (local_err) { error_propagate(errp, local_err); return NULL; } if (!ret) { error_setg(errp, "Snapshot with id '%s' and name '%s' does not exist on " "device '%s'", STR_OR_NULL(id), STR_OR_NULL(name), device); return NULL; } bdrv_snapshot_delete(bs, id, name, &local_err); if (local_err) { error_propagate(errp, local_err); return NULL; } info = g_malloc0(sizeof(SnapshotInfo)); info->id = g_strdup(sn.id_str); info->name = g_strdup(sn.name); info->date_nsec = sn.date_nsec; info->date_sec = sn.date_sec; info->vm_state_size = sn.vm_state_size; info->vm_clock_nsec = sn.vm_clock_nsec % 1000000000; info->vm_clock_sec = sn.vm_clock_nsec / 1000000000; return info; }
true
qemu
5839e53bbc0fec56021d758aab7610df421ed8c8
SnapshotInfo *qmp_blockdev_snapshot_delete_internal_sync(const char *device, bool has_id, const char *id, bool has_name, const char *name, Error **errp) { BlockDriverState *bs = bdrv_find(device); QEMUSnapshotInfo sn; Error *local_err = NULL; SnapshotInfo *info = NULL; int ret; if (!bs) { error_set(errp, QERR_DEVICE_NOT_FOUND, device); return NULL; } if (!has_id) { id = NULL; } if (!has_name) { name = NULL; } if (!id && !name) { error_setg(errp, "Name or id must be provided"); return NULL; } ret = bdrv_snapshot_find_by_id_and_name(bs, id, name, &sn, &local_err); if (local_err) { error_propagate(errp, local_err); return NULL; } if (!ret) { error_setg(errp, "Snapshot with id '%s' and name '%s' does not exist on " "device '%s'", STR_OR_NULL(id), STR_OR_NULL(name), device); return NULL; } bdrv_snapshot_delete(bs, id, name, &local_err); if (local_err) { error_propagate(errp, local_err); return NULL; } info = g_malloc0(sizeof(SnapshotInfo)); info->id = g_strdup(sn.id_str); info->name = g_strdup(sn.name); info->date_nsec = sn.date_nsec; info->date_sec = sn.date_sec; info->vm_state_size = sn.vm_state_size; info->vm_clock_nsec = sn.vm_clock_nsec % 1000000000; info->vm_clock_sec = sn.vm_clock_nsec / 1000000000; return info; }
{ "code": [ " info = g_malloc0(sizeof(SnapshotInfo));" ], "line_no": [ 101 ] }
SnapshotInfo *FUNC_0(const char *device, bool has_id, const char *id, bool has_name, const char *name, Error **errp) { BlockDriverState *bs = bdrv_find(device); QEMUSnapshotInfo sn; Error *local_err = NULL; SnapshotInfo *info = NULL; int VAR_0; if (!bs) { error_set(errp, QERR_DEVICE_NOT_FOUND, device); return NULL; } if (!has_id) { id = NULL; } if (!has_name) { name = NULL; } if (!id && !name) { error_setg(errp, "Name or id must be provided"); return NULL; } VAR_0 = bdrv_snapshot_find_by_id_and_name(bs, id, name, &sn, &local_err); if (local_err) { error_propagate(errp, local_err); return NULL; } if (!VAR_0) { error_setg(errp, "Snapshot with id '%s' and name '%s' does not exist on " "device '%s'", STR_OR_NULL(id), STR_OR_NULL(name), device); return NULL; } bdrv_snapshot_delete(bs, id, name, &local_err); if (local_err) { error_propagate(errp, local_err); return NULL; } info = g_malloc0(sizeof(SnapshotInfo)); info->id = g_strdup(sn.id_str); info->name = g_strdup(sn.name); info->date_nsec = sn.date_nsec; info->date_sec = sn.date_sec; info->vm_state_size = sn.vm_state_size; info->vm_clock_nsec = sn.vm_clock_nsec % 1000000000; info->vm_clock_sec = sn.vm_clock_nsec / 1000000000; return info; }
[ "SnapshotInfo *FUNC_0(const char *device,\nbool has_id,\nconst char *id,\nbool has_name,\nconst char *name,\nError **errp)\n{", "BlockDriverState *bs = bdrv_find(device);", "QEMUSnapshotInfo sn;", "Error *local_err = NULL;", "SnapshotInfo *info = NULL;", "int VAR_0;", "if (!bs) {", "error_set(errp, QERR_DEVICE_NOT_FOUND, device);", "return NULL;", "}", "if (!has_id) {", "id = NULL;", "}", "if (!has_name) {", "name = NULL;", "}", "if (!id && !name) {", "error_setg(errp, \"Name or id must be provided\");", "return NULL;", "}", "VAR_0 = bdrv_snapshot_find_by_id_and_name(bs, id, name, &sn, &local_err);", "if (local_err) {", "error_propagate(errp, local_err);", "return NULL;", "}", "if (!VAR_0) {", "error_setg(errp,\n\"Snapshot with id '%s' and name '%s' does not exist on \"\n\"device '%s'\",\nSTR_OR_NULL(id), STR_OR_NULL(name), device);", "return NULL;", "}", "bdrv_snapshot_delete(bs, id, name, &local_err);", "if (local_err) {", "error_propagate(errp, local_err);", "return NULL;", "}", "info = g_malloc0(sizeof(SnapshotInfo));", "info->id = g_strdup(sn.id_str);", "info->name = g_strdup(sn.name);", "info->date_nsec = sn.date_nsec;", "info->date_sec = sn.date_sec;", "info->vm_state_size = sn.vm_state_size;", "info->vm_clock_nsec = sn.vm_clock_nsec % 1000000000;", "info->vm_clock_sec = sn.vm_clock_nsec / 1000000000;", "return info;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 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 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75, 77, 79, 81 ], [ 83 ], [ 85 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 119 ], [ 121 ] ]
2,377
static int proxy_socket(const char *path, uid_t uid, gid_t gid) { int sock, client; struct sockaddr_un proxy, qemu; socklen_t size; /* requested socket already exists, refuse to start */ if (!access(path, F_OK)) { do_log(LOG_CRIT, "socket already exists\n"); return -1; } sock = socket(AF_UNIX, SOCK_STREAM, 0); if (sock < 0) { do_perror("socket"); return -1; } /* mask other part of mode bits */ umask(7); proxy.sun_family = AF_UNIX; strcpy(proxy.sun_path, path); if (bind(sock, (struct sockaddr *)&proxy, sizeof(struct sockaddr_un)) < 0) { do_perror("bind"); goto error; } if (chown(proxy.sun_path, uid, gid) < 0) { do_perror("chown"); goto error; } if (listen(sock, 1) < 0) { do_perror("listen"); goto error; } size = sizeof(qemu); client = accept(sock, (struct sockaddr *)&qemu, &size); if (client < 0) { do_perror("accept"); goto error; } close(sock); return client; error: close(sock); return -1; }
true
qemu
25ee9a7fa3f4e09fde48bb184447ff5651ed5fd8
static int proxy_socket(const char *path, uid_t uid, gid_t gid) { int sock, client; struct sockaddr_un proxy, qemu; socklen_t size; if (!access(path, F_OK)) { do_log(LOG_CRIT, "socket already exists\n"); return -1; } sock = socket(AF_UNIX, SOCK_STREAM, 0); if (sock < 0) { do_perror("socket"); return -1; } umask(7); proxy.sun_family = AF_UNIX; strcpy(proxy.sun_path, path); if (bind(sock, (struct sockaddr *)&proxy, sizeof(struct sockaddr_un)) < 0) { do_perror("bind"); goto error; } if (chown(proxy.sun_path, uid, gid) < 0) { do_perror("chown"); goto error; } if (listen(sock, 1) < 0) { do_perror("listen"); goto error; } size = sizeof(qemu); client = accept(sock, (struct sockaddr *)&qemu, &size); if (client < 0) { do_perror("accept"); goto error; } close(sock); return client; error: close(sock); return -1; }
{ "code": [], "line_no": [] }
static int FUNC_0(const char *VAR_0, uid_t VAR_1, gid_t VAR_2) { int VAR_3, VAR_4; struct sockaddr_un VAR_5, VAR_6; socklen_t size; if (!access(VAR_0, F_OK)) { do_log(LOG_CRIT, "socket already exists\n"); return -1; } VAR_3 = socket(AF_UNIX, SOCK_STREAM, 0); if (VAR_3 < 0) { do_perror("socket"); return -1; } umask(7); VAR_5.sun_family = AF_UNIX; strcpy(VAR_5.sun_path, VAR_0); if (bind(VAR_3, (struct sockaddr *)&VAR_5, sizeof(struct sockaddr_un)) < 0) { do_perror("bind"); goto error; } if (chown(VAR_5.sun_path, VAR_1, VAR_2) < 0) { do_perror("chown"); goto error; } if (listen(VAR_3, 1) < 0) { do_perror("listen"); goto error; } size = sizeof(VAR_6); VAR_4 = accept(VAR_3, (struct sockaddr *)&VAR_6, &size); if (VAR_4 < 0) { do_perror("accept"); goto error; } close(VAR_3); return VAR_4; error: close(VAR_3); return -1; }
[ "static int FUNC_0(const char *VAR_0, uid_t VAR_1, gid_t VAR_2)\n{", "int VAR_3, VAR_4;", "struct sockaddr_un VAR_5, VAR_6;", "socklen_t size;", "if (!access(VAR_0, F_OK)) {", "do_log(LOG_CRIT, \"socket already exists\\n\");", "return -1;", "}", "VAR_3 = socket(AF_UNIX, SOCK_STREAM, 0);", "if (VAR_3 < 0) {", "do_perror(\"socket\");", "return -1;", "}", "umask(7);", "VAR_5.sun_family = AF_UNIX;", "strcpy(VAR_5.sun_path, VAR_0);", "if (bind(VAR_3, (struct sockaddr *)&VAR_5,\nsizeof(struct sockaddr_un)) < 0) {", "do_perror(\"bind\");", "goto error;", "}", "if (chown(VAR_5.sun_path, VAR_1, VAR_2) < 0) {", "do_perror(\"chown\");", "goto error;", "}", "if (listen(VAR_3, 1) < 0) {", "do_perror(\"listen\");", "goto error;", "}", "size = sizeof(VAR_6);", "VAR_4 = accept(VAR_3, (struct sockaddr *)&VAR_6, &size);", "if (VAR_4 < 0) {", "do_perror(\"accept\");", "goto error;", "}", "close(VAR_3);", "return VAR_4;", "error:\nclose(VAR_3);", "return -1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 26 ], [ 28 ], [ 30 ], [ 32 ], [ 34 ], [ 40 ], [ 44 ], [ 46 ], [ 48, 50 ], [ 52 ], [ 54 ], [ 56 ], [ 58 ], [ 60 ], [ 62 ], [ 64 ], [ 66 ], [ 68 ], [ 70 ], [ 72 ], [ 76 ], [ 78 ], [ 80 ], [ 82 ], [ 84 ], [ 86 ], [ 88 ], [ 90 ], [ 94, 96 ], [ 98 ], [ 100 ] ]
2,378
void *qemu_ram_mmap(int fd, size_t size, size_t align, bool shared) { /* * Note: this always allocates at least one extra page of virtual address * space, even if size is already aligned. */ size_t total = size + align; void *ptr = mmap(0, total, PROT_NONE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); size_t offset = QEMU_ALIGN_UP((uintptr_t)ptr, align) - (uintptr_t)ptr; void *ptr1; if (ptr == MAP_FAILED) { return NULL; } /* Make sure align is a power of 2 */ assert(!(align & (align - 1))); /* Always align to host page size */ assert(align >= getpagesize()); ptr1 = mmap(ptr + offset, size, PROT_READ | PROT_WRITE, MAP_FIXED | (fd == -1 ? MAP_ANONYMOUS : 0) | (shared ? MAP_SHARED : MAP_PRIVATE), fd, 0); if (ptr1 == MAP_FAILED) { munmap(ptr, total); return NULL; } ptr += offset; total -= offset; if (offset > 0) { munmap(ptr - offset, offset); } /* * Leave a single PROT_NONE page allocated after the RAM block, to serve as * a guard page guarding against potential buffer overflows. */ if (total > size + getpagesize()) { munmap(ptr + size + getpagesize(), total - size - getpagesize()); } return ptr; }
true
qemu
9d4ec9370a36f8a564e1ba05519328c0bd60da13
void *qemu_ram_mmap(int fd, size_t size, size_t align, bool shared) { size_t total = size + align; void *ptr = mmap(0, total, PROT_NONE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); size_t offset = QEMU_ALIGN_UP((uintptr_t)ptr, align) - (uintptr_t)ptr; void *ptr1; if (ptr == MAP_FAILED) { return NULL; } assert(!(align & (align - 1))); assert(align >= getpagesize()); ptr1 = mmap(ptr + offset, size, PROT_READ | PROT_WRITE, MAP_FIXED | (fd == -1 ? MAP_ANONYMOUS : 0) | (shared ? MAP_SHARED : MAP_PRIVATE), fd, 0); if (ptr1 == MAP_FAILED) { munmap(ptr, total); return NULL; } ptr += offset; total -= offset; if (offset > 0) { munmap(ptr - offset, offset); } if (total > size + getpagesize()) { munmap(ptr + size + getpagesize(), total - size - getpagesize()); } return ptr; }
{ "code": [ " return NULL;", " return NULL;" ], "line_no": [ 25, 25 ] }
void *FUNC_0(int VAR_0, size_t VAR_1, size_t VAR_2, bool VAR_3) { size_t total = VAR_1 + VAR_2; void *VAR_4 = mmap(0, total, PROT_NONE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); size_t offset = QEMU_ALIGN_UP((uintptr_t)VAR_4, VAR_2) - (uintptr_t)VAR_4; void *VAR_5; if (VAR_4 == MAP_FAILED) { return NULL; } assert(!(VAR_2 & (VAR_2 - 1))); assert(VAR_2 >= getpagesize()); VAR_5 = mmap(VAR_4 + offset, VAR_1, PROT_READ | PROT_WRITE, MAP_FIXED | (VAR_0 == -1 ? MAP_ANONYMOUS : 0) | (VAR_3 ? MAP_SHARED : MAP_PRIVATE), VAR_0, 0); if (VAR_5 == MAP_FAILED) { munmap(VAR_4, total); return NULL; } VAR_4 += offset; total -= offset; if (offset > 0) { munmap(VAR_4 - offset, offset); } if (total > VAR_1 + getpagesize()) { munmap(VAR_4 + VAR_1 + getpagesize(), total - VAR_1 - getpagesize()); } return VAR_4; }
[ "void *FUNC_0(int VAR_0, size_t VAR_1, size_t VAR_2, bool VAR_3)\n{", "size_t total = VAR_1 + VAR_2;", "void *VAR_4 = mmap(0, total, PROT_NONE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);", "size_t offset = QEMU_ALIGN_UP((uintptr_t)VAR_4, VAR_2) - (uintptr_t)VAR_4;", "void *VAR_5;", "if (VAR_4 == MAP_FAILED) {", "return NULL;", "}", "assert(!(VAR_2 & (VAR_2 - 1)));", "assert(VAR_2 >= getpagesize());", "VAR_5 = mmap(VAR_4 + offset, VAR_1, PROT_READ | PROT_WRITE,\nMAP_FIXED |\n(VAR_0 == -1 ? MAP_ANONYMOUS : 0) |\n(VAR_3 ? MAP_SHARED : MAP_PRIVATE),\nVAR_0, 0);", "if (VAR_5 == MAP_FAILED) {", "munmap(VAR_4, total);", "return NULL;", "}", "VAR_4 += offset;", "total -= offset;", "if (offset > 0) {", "munmap(VAR_4 - offset, offset);", "}", "if (total > VAR_1 + getpagesize()) {", "munmap(VAR_4 + VAR_1 + getpagesize(), total - VAR_1 - getpagesize());", "}", "return VAR_4;", "}" ]
[ 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 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 33 ], [ 37 ], [ 41, 43, 45, 47, 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ], [ 71 ], [ 83 ], [ 85 ], [ 87 ], [ 91 ], [ 93 ] ]
2,379
start_list(Visitor *v, const char *name, Error **errp) { StringInputVisitor *siv = to_siv(v); parse_str(siv, errp); siv->cur_range = g_list_first(siv->ranges); if (siv->cur_range) { Range *r = siv->cur_range->data; if (r) { siv->cur = r->begin; } } }
true
qemu
74f24cb6306d065045d0e2215a7d10533fa59c57
start_list(Visitor *v, const char *name, Error **errp) { StringInputVisitor *siv = to_siv(v); parse_str(siv, errp); siv->cur_range = g_list_first(siv->ranges); if (siv->cur_range) { Range *r = siv->cur_range->data; if (r) { siv->cur = r->begin; } } }
{ "code": [ " parse_str(siv, errp);", " parse_str(siv, errp);" ], "line_no": [ 9, 9 ] }
FUNC_0(Visitor *VAR_0, const char *VAR_1, Error **VAR_2) { StringInputVisitor *siv = to_siv(VAR_0); parse_str(siv, VAR_2); siv->cur_range = g_list_first(siv->ranges); if (siv->cur_range) { Range *r = siv->cur_range->data; if (r) { siv->cur = r->begin; } } }
[ "FUNC_0(Visitor *VAR_0, const char *VAR_1, Error **VAR_2)\n{", "StringInputVisitor *siv = to_siv(VAR_0);", "parse_str(siv, VAR_2);", "siv->cur_range = g_list_first(siv->ranges);", "if (siv->cur_range) {", "Range *r = siv->cur_range->data;", "if (r) {", "siv->cur = r->begin;", "}", "}", "}" ]
[ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ] ]
2,380
void fw_cfg_add_i16(FWCfgState *s, uint16_t key, uint16_t value) { uint16_t *copy; copy = g_malloc(sizeof(value)); *copy = cpu_to_le16(value); fw_cfg_add_bytes(s, key, (uint8_t *)copy, sizeof(value)); }
true
qemu
089da572b956ef0f8f5b8d5917358e07892a77c2
void fw_cfg_add_i16(FWCfgState *s, uint16_t key, uint16_t value) { uint16_t *copy; copy = g_malloc(sizeof(value)); *copy = cpu_to_le16(value); fw_cfg_add_bytes(s, key, (uint8_t *)copy, sizeof(value)); }
{ "code": [ " fw_cfg_add_bytes(s, key, (uint8_t *)copy, sizeof(value));", " fw_cfg_add_bytes(s, key, (uint8_t *)copy, sizeof(value));", " fw_cfg_add_bytes(s, key, (uint8_t *)copy, sizeof(value));" ], "line_no": [ 13, 13, 13 ] }
void FUNC_0(FWCfgState *VAR_0, uint16_t VAR_1, uint16_t VAR_2) { uint16_t *copy; copy = g_malloc(sizeof(VAR_2)); *copy = cpu_to_le16(VAR_2); fw_cfg_add_bytes(VAR_0, VAR_1, (uint8_t *)copy, sizeof(VAR_2)); }
[ "void FUNC_0(FWCfgState *VAR_0, uint16_t VAR_1, uint16_t VAR_2)\n{", "uint16_t *copy;", "copy = g_malloc(sizeof(VAR_2));", "*copy = cpu_to_le16(VAR_2);", "fw_cfg_add_bytes(VAR_0, VAR_1, (uint8_t *)copy, sizeof(VAR_2));", "}" ]
[ 0, 0, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ] ]
2,381
void FUNC(ff_emulated_edge_mc)(uint8_t *buf, const uint8_t *src, ptrdiff_t linesize_arg, int block_w, int block_h, int src_x, int src_y, int w, int h) { int x, y; int start_y, start_x, end_y, end_x; emuedge_linesize_type linesize = linesize_arg; if (!w || !h) return; if (src_y >= h) { src -= src_y * linesize; src += (h - 1) * linesize; src_y = h - 1; } else if (src_y <= -block_h) { src -= src_y * linesize; src += (1 - block_h) * linesize; src_y = 1 - block_h; } if (src_x >= w) { src += (w - 1 - src_x) * sizeof(pixel); src_x = w - 1; } else if (src_x <= -block_w) { src += (1 - block_w - src_x) * sizeof(pixel); src_x = 1 - block_w; } start_y = FFMAX(0, -src_y); start_x = FFMAX(0, -src_x); end_y = FFMIN(block_h, h-src_y); end_x = FFMIN(block_w, w-src_x); av_assert2(start_y < end_y && block_h); av_assert2(start_x < end_x && block_w); w = end_x - start_x; src += start_y * linesize + start_x * sizeof(pixel); buf += start_x * sizeof(pixel); // top for (y = 0; y < start_y; y++) { memcpy(buf, src, w * sizeof(pixel)); buf += linesize; } // copy existing part for (; y < end_y; y++) { memcpy(buf, src, w * sizeof(pixel)); src += linesize; buf += linesize; } // bottom src -= linesize; for (; y < block_h; y++) { memcpy(buf, src, w * sizeof(pixel)); buf += linesize; } buf -= block_h * linesize + start_x * sizeof(pixel); while (block_h--) { pixel *bufp = (pixel *) buf; // left for(x = 0; x < start_x; x++) { bufp[x] = bufp[start_x]; } // right for (x = end_x; x < block_w; x++) { bufp[x] = bufp[end_x - 1]; } buf += linesize; } }
true
FFmpeg
c341f734e5f9d6af4a8fdcceb6f5d12de6395c76
void FUNC(ff_emulated_edge_mc)(uint8_t *buf, const uint8_t *src, ptrdiff_t linesize_arg, int block_w, int block_h, int src_x, int src_y, int w, int h) { int x, y; int start_y, start_x, end_y, end_x; emuedge_linesize_type linesize = linesize_arg; if (!w || !h) return; if (src_y >= h) { src -= src_y * linesize; src += (h - 1) * linesize; src_y = h - 1; } else if (src_y <= -block_h) { src -= src_y * linesize; src += (1 - block_h) * linesize; src_y = 1 - block_h; } if (src_x >= w) { src += (w - 1 - src_x) * sizeof(pixel); src_x = w - 1; } else if (src_x <= -block_w) { src += (1 - block_w - src_x) * sizeof(pixel); src_x = 1 - block_w; } start_y = FFMAX(0, -src_y); start_x = FFMAX(0, -src_x); end_y = FFMIN(block_h, h-src_y); end_x = FFMIN(block_w, w-src_x); av_assert2(start_y < end_y && block_h); av_assert2(start_x < end_x && block_w); w = end_x - start_x; src += start_y * linesize + start_x * sizeof(pixel); buf += start_x * sizeof(pixel); for (y = 0; y < start_y; y++) { memcpy(buf, src, w * sizeof(pixel)); buf += linesize; } for (; y < end_y; y++) { memcpy(buf, src, w * sizeof(pixel)); src += linesize; buf += linesize; } src -= linesize; for (; y < block_h; y++) { memcpy(buf, src, w * sizeof(pixel)); buf += linesize; } buf -= block_h * linesize + start_x * sizeof(pixel); while (block_h--) { pixel *bufp = (pixel *) buf; for(x = 0; x < start_x; x++) { bufp[x] = bufp[start_x]; } for (x = end_x; x < block_w; x++) { bufp[x] = bufp[end_x - 1]; } buf += linesize; } }
{ "code": [ " ptrdiff_t linesize_arg,", " emuedge_linesize_type linesize = linesize_arg;", " emuedge_linesize_type linesize = linesize_arg;" ], "line_no": [ 3, 15, 15 ] }
void FUNC_0(ff_emulated_edge_mc)(uint8_t *buf, const uint8_t *src, ptrdiff_t linesize_arg, int block_w, int block_h, int src_x, int src_y, int w, int h) { int VAR_0, VAR_1; int VAR_2, VAR_3, VAR_4, VAR_5; emuedge_linesize_type linesize = linesize_arg; if (!w || !h) return; if (src_y >= h) { src -= src_y * linesize; src += (h - 1) * linesize; src_y = h - 1; } else if (src_y <= -block_h) { src -= src_y * linesize; src += (1 - block_h) * linesize; src_y = 1 - block_h; } if (src_x >= w) { src += (w - 1 - src_x) * sizeof(pixel); src_x = w - 1; } else if (src_x <= -block_w) { src += (1 - block_w - src_x) * sizeof(pixel); src_x = 1 - block_w; } VAR_2 = FFMAX(0, -src_y); VAR_3 = FFMAX(0, -src_x); VAR_4 = FFMIN(block_h, h-src_y); VAR_5 = FFMIN(block_w, w-src_x); av_assert2(VAR_2 < VAR_4 && block_h); av_assert2(VAR_3 < VAR_5 && block_w); w = VAR_5 - VAR_3; src += VAR_2 * linesize + VAR_3 * sizeof(pixel); buf += VAR_3 * sizeof(pixel); for (VAR_1 = 0; VAR_1 < VAR_2; VAR_1++) { memcpy(buf, src, w * sizeof(pixel)); buf += linesize; } for (; VAR_1 < VAR_4; VAR_1++) { memcpy(buf, src, w * sizeof(pixel)); src += linesize; buf += linesize; } src -= linesize; for (; VAR_1 < block_h; VAR_1++) { memcpy(buf, src, w * sizeof(pixel)); buf += linesize; } buf -= block_h * linesize + VAR_3 * sizeof(pixel); while (block_h--) { pixel *bufp = (pixel *) buf; for(VAR_0 = 0; VAR_0 < VAR_3; VAR_0++) { bufp[VAR_0] = bufp[VAR_3]; } for (VAR_0 = VAR_5; VAR_0 < block_w; VAR_0++) { bufp[VAR_0] = bufp[VAR_5 - 1]; } buf += linesize; } }
[ "void FUNC_0(ff_emulated_edge_mc)(uint8_t *buf, const uint8_t *src,\nptrdiff_t linesize_arg,\nint block_w, int block_h,\nint src_x, int src_y, int w, int h)\n{", "int VAR_0, VAR_1;", "int VAR_2, VAR_3, VAR_4, VAR_5;", "emuedge_linesize_type linesize = linesize_arg;", "if (!w || !h)\nreturn;", "if (src_y >= h) {", "src -= src_y * linesize;", "src += (h - 1) * linesize;", "src_y = h - 1;", "} else if (src_y <= -block_h) {", "src -= src_y * linesize;", "src += (1 - block_h) * linesize;", "src_y = 1 - block_h;", "}", "if (src_x >= w) {", "src += (w - 1 - src_x) * sizeof(pixel);", "src_x = w - 1;", "} else if (src_x <= -block_w) {", "src += (1 - block_w - src_x) * sizeof(pixel);", "src_x = 1 - block_w;", "}", "VAR_2 = FFMAX(0, -src_y);", "VAR_3 = FFMAX(0, -src_x);", "VAR_4 = FFMIN(block_h, h-src_y);", "VAR_5 = FFMIN(block_w, w-src_x);", "av_assert2(VAR_2 < VAR_4 && block_h);", "av_assert2(VAR_3 < VAR_5 && block_w);", "w = VAR_5 - VAR_3;", "src += VAR_2 * linesize + VAR_3 * sizeof(pixel);", "buf += VAR_3 * sizeof(pixel);", "for (VAR_1 = 0; VAR_1 < VAR_2; VAR_1++) {", "memcpy(buf, src, w * sizeof(pixel));", "buf += linesize;", "}", "for (; VAR_1 < VAR_4; VAR_1++) {", "memcpy(buf, src, w * sizeof(pixel));", "src += linesize;", "buf += linesize;", "}", "src -= linesize;", "for (; VAR_1 < block_h; VAR_1++) {", "memcpy(buf, src, w * sizeof(pixel));", "buf += linesize;", "}", "buf -= block_h * linesize + VAR_3 * sizeof(pixel);", "while (block_h--) {", "pixel *bufp = (pixel *) buf;", "for(VAR_0 = 0; VAR_0 < VAR_3; VAR_0++) {", "bufp[VAR_0] = bufp[VAR_3];", "}", "for (VAR_0 = VAR_5; VAR_0 < block_w; VAR_0++) {", "bufp[VAR_0] = bufp[VAR_5 - 1];", "}", "buf += linesize;", "}", "}" ]
[ 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19, 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 73 ], [ 75 ], [ 77 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 121 ], [ 123 ], [ 125 ], [ 131 ], [ 133 ], [ 135 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ] ]
2,382
static int draw_glyphs(DrawTextContext *s, AVFrame *frame, int width, int height, const uint8_t rgbcolor[4], const uint8_t yuvcolor[4], int x, int y) { char *text = HAVE_LOCALTIME_R ? s->expanded_text : s->text; uint32_t code = 0; int i; uint8_t *p; Glyph *glyph = NULL; for (i = 0, p = text; *p; i++) { Glyph dummy = { 0 }; GET_UTF8(code, *p++, continue;); /* skip new line chars, just go to new line */ if (code == '\n' || code == '\r' || code == '\t') continue; dummy.code = code; glyph = av_tree_find(s->glyphs, &dummy, (void *)glyph_cmp, NULL); if (glyph->bitmap.pixel_mode != FT_PIXEL_MODE_MONO && glyph->bitmap.pixel_mode != FT_PIXEL_MODE_GRAY) return AVERROR(EINVAL); if (s->is_packed_rgb) { draw_glyph_rgb(frame, &glyph->bitmap, s->positions[i].x+x, s->positions[i].y+y, width, height, s->pixel_step[0], rgbcolor, s->rgba_map, s->alpha); } else { draw_glyph_yuv(frame, &glyph->bitmap, s->positions[i].x+x, s->positions[i].y+y, width, height, yuvcolor, s->hsub, s->vsub, s->alpha); } } return 0; }
false
FFmpeg
fe026ba960790a004adfcff33f44f96b05538e5c
static int draw_glyphs(DrawTextContext *s, AVFrame *frame, int width, int height, const uint8_t rgbcolor[4], const uint8_t yuvcolor[4], int x, int y) { char *text = HAVE_LOCALTIME_R ? s->expanded_text : s->text; uint32_t code = 0; int i; uint8_t *p; Glyph *glyph = NULL; for (i = 0, p = text; *p; i++) { Glyph dummy = { 0 }; GET_UTF8(code, *p++, continue;); if (code == '\n' || code == '\r' || code == '\t') continue; dummy.code = code; glyph = av_tree_find(s->glyphs, &dummy, (void *)glyph_cmp, NULL); if (glyph->bitmap.pixel_mode != FT_PIXEL_MODE_MONO && glyph->bitmap.pixel_mode != FT_PIXEL_MODE_GRAY) return AVERROR(EINVAL); if (s->is_packed_rgb) { draw_glyph_rgb(frame, &glyph->bitmap, s->positions[i].x+x, s->positions[i].y+y, width, height, s->pixel_step[0], rgbcolor, s->rgba_map, s->alpha); } else { draw_glyph_yuv(frame, &glyph->bitmap, s->positions[i].x+x, s->positions[i].y+y, width, height, yuvcolor, s->hsub, s->vsub, s->alpha); } } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(DrawTextContext *VAR_0, AVFrame *VAR_1, int VAR_2, int VAR_3, const uint8_t VAR_4[4], const uint8_t VAR_5[4], int VAR_6, int VAR_7) { char *VAR_8 = HAVE_LOCALTIME_R ? VAR_0->expanded_text : VAR_0->VAR_8; uint32_t code = 0; int VAR_9; uint8_t *p; Glyph *glyph = NULL; for (VAR_9 = 0, p = VAR_8; *p; VAR_9++) { Glyph dummy = { 0 }; GET_UTF8(code, *p++, continue;); if (code == '\n' || code == '\r' || code == '\t') continue; dummy.code = code; glyph = av_tree_find(VAR_0->glyphs, &dummy, (void *)glyph_cmp, NULL); if (glyph->bitmap.pixel_mode != FT_PIXEL_MODE_MONO && glyph->bitmap.pixel_mode != FT_PIXEL_MODE_GRAY) return AVERROR(EINVAL); if (VAR_0->is_packed_rgb) { draw_glyph_rgb(VAR_1, &glyph->bitmap, VAR_0->positions[VAR_9].VAR_6+VAR_6, VAR_0->positions[VAR_9].VAR_7+VAR_7, VAR_2, VAR_3, VAR_0->pixel_step[0], VAR_4, VAR_0->rgba_map, VAR_0->alpha); } else { draw_glyph_yuv(VAR_1, &glyph->bitmap, VAR_0->positions[VAR_9].VAR_6+VAR_6, VAR_0->positions[VAR_9].VAR_7+VAR_7, VAR_2, VAR_3, VAR_5, VAR_0->hsub, VAR_0->vsub, VAR_0->alpha); } } return 0; }
[ "static int FUNC_0(DrawTextContext *VAR_0, AVFrame *VAR_1,\nint VAR_2, int VAR_3,\nconst uint8_t VAR_4[4], const uint8_t VAR_5[4],\nint VAR_6, int VAR_7)\n{", "char *VAR_8 = HAVE_LOCALTIME_R ? VAR_0->expanded_text : VAR_0->VAR_8;", "uint32_t code = 0;", "int VAR_9;", "uint8_t *p;", "Glyph *glyph = NULL;", "for (VAR_9 = 0, p = VAR_8; *p; VAR_9++) {", "Glyph dummy = { 0 };", "GET_UTF8(code, *p++, continue;);", "if (code == '\\n' || code == '\\r' || code == '\\t')\ncontinue;", "dummy.code = code;", "glyph = av_tree_find(VAR_0->glyphs, &dummy, (void *)glyph_cmp, NULL);", "if (glyph->bitmap.pixel_mode != FT_PIXEL_MODE_MONO &&\nglyph->bitmap.pixel_mode != FT_PIXEL_MODE_GRAY)\nreturn AVERROR(EINVAL);", "if (VAR_0->is_packed_rgb) {", "draw_glyph_rgb(VAR_1, &glyph->bitmap,\nVAR_0->positions[VAR_9].VAR_6+VAR_6, VAR_0->positions[VAR_9].VAR_7+VAR_7, VAR_2, VAR_3,\nVAR_0->pixel_step[0], VAR_4, VAR_0->rgba_map, VAR_0->alpha);", "} else {", "draw_glyph_yuv(VAR_1, &glyph->bitmap,\nVAR_0->positions[VAR_9].VAR_6+VAR_6, VAR_0->positions[VAR_9].VAR_7+VAR_7, VAR_2, VAR_3,\nVAR_5, VAR_0->hsub, VAR_0->vsub, VAR_0->alpha);", "}", "}", "return 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 ], [ 33, 35 ], [ 39 ], [ 41 ], [ 45, 47, 49 ], [ 53 ], [ 55, 57, 59 ], [ 61 ], [ 63, 65, 67 ], [ 69 ], [ 71 ], [ 75 ], [ 77 ] ]
2,383
static void test_lifecycle(void) { Coroutine *coroutine; bool done = false; /* Create, enter, and return from coroutine */ coroutine = qemu_coroutine_create(set_and_exit); qemu_coroutine_enter(coroutine, &done); g_assert(done); /* expect done to be true (first time) */ /* Repeat to check that no state affects this test */ done = false; coroutine = qemu_coroutine_create(set_and_exit); qemu_coroutine_enter(coroutine, &done); g_assert(done); /* expect done to be true (second time) */ }
true
qemu
0b8b8753e4d94901627b3e86431230f2319215c4
static void test_lifecycle(void) { Coroutine *coroutine; bool done = false; coroutine = qemu_coroutine_create(set_and_exit); qemu_coroutine_enter(coroutine, &done); g_assert(done); done = false; coroutine = qemu_coroutine_create(set_and_exit); qemu_coroutine_enter(coroutine, &done); g_assert(done); }
{ "code": [ " coroutine = qemu_coroutine_create(set_and_exit);", " qemu_coroutine_enter(coroutine, &done);", " coroutine = qemu_coroutine_create(set_and_exit);", " qemu_coroutine_enter(coroutine, &done);" ], "line_no": [ 13, 15, 13, 15 ] }
static void FUNC_0(void) { Coroutine *coroutine; bool done = false; coroutine = qemu_coroutine_create(set_and_exit); qemu_coroutine_enter(coroutine, &done); g_assert(done); done = false; coroutine = qemu_coroutine_create(set_and_exit); qemu_coroutine_enter(coroutine, &done); g_assert(done); }
[ "static void FUNC_0(void)\n{", "Coroutine *coroutine;", "bool done = false;", "coroutine = qemu_coroutine_create(set_and_exit);", "qemu_coroutine_enter(coroutine, &done);", "g_assert(done);", "done = false;", "coroutine = qemu_coroutine_create(set_and_exit);", "qemu_coroutine_enter(coroutine, &done);", "g_assert(done);", "}" ]
[ 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 13 ], [ 15 ], [ 17 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ] ]
2,384
static void decode_pitch_lag_low(int *lag_int, int *lag_frac, int pitch_index, uint8_t *base_lag_int, int subframe, enum Mode mode) { if (subframe == 0 || (subframe == 2 && mode != MODE_6k60)) { if (pitch_index < 116) { *lag_int = (pitch_index + 69) >> 1; *lag_frac = (pitch_index - (*lag_int << 1) + 68) << 1; } else { *lag_int = pitch_index - 24; *lag_frac = 0; } // XXX: same problem as before *base_lag_int = av_clip(*lag_int - 8 - (*lag_frac < 0), AMRWB_P_DELAY_MIN, AMRWB_P_DELAY_MAX - 15); } else { *lag_int = (pitch_index + 1) >> 1; *lag_frac = (pitch_index - (*lag_int << 1)) << 1; *lag_int += *base_lag_int; } }
true
FFmpeg
6bd79ba59f46a8b3133f28faae53b75540469803
static void decode_pitch_lag_low(int *lag_int, int *lag_frac, int pitch_index, uint8_t *base_lag_int, int subframe, enum Mode mode) { if (subframe == 0 || (subframe == 2 && mode != MODE_6k60)) { if (pitch_index < 116) { *lag_int = (pitch_index + 69) >> 1; *lag_frac = (pitch_index - (*lag_int << 1) + 68) << 1; } else { *lag_int = pitch_index - 24; *lag_frac = 0; } *base_lag_int = av_clip(*lag_int - 8 - (*lag_frac < 0), AMRWB_P_DELAY_MIN, AMRWB_P_DELAY_MAX - 15); } else { *lag_int = (pitch_index + 1) >> 1; *lag_frac = (pitch_index - (*lag_int << 1)) << 1; *lag_int += *base_lag_int; } }
{ "code": [ " *lag_frac = (pitch_index - (*lag_int << 1) + 68) << 1;", " *lag_frac = (pitch_index - (*lag_int << 1)) << 1;" ], "line_no": [ 13, 33 ] }
static void FUNC_0(int *VAR_0, int *VAR_1, int VAR_2, uint8_t *VAR_3, int VAR_4, enum Mode VAR_5) { if (VAR_4 == 0 || (VAR_4 == 2 && VAR_5 != MODE_6k60)) { if (VAR_2 < 116) { *VAR_0 = (VAR_2 + 69) >> 1; *VAR_1 = (VAR_2 - (*VAR_0 << 1) + 68) << 1; } else { *VAR_0 = VAR_2 - 24; *VAR_1 = 0; } *VAR_3 = av_clip(*VAR_0 - 8 - (*VAR_1 < 0), AMRWB_P_DELAY_MIN, AMRWB_P_DELAY_MAX - 15); } else { *VAR_0 = (VAR_2 + 1) >> 1; *VAR_1 = (VAR_2 - (*VAR_0 << 1)) << 1; *VAR_0 += *VAR_3; } }
[ "static void FUNC_0(int *VAR_0, int *VAR_1, int VAR_2,\nuint8_t *VAR_3, int VAR_4, enum Mode VAR_5)\n{", "if (VAR_4 == 0 || (VAR_4 == 2 && VAR_5 != MODE_6k60)) {", "if (VAR_2 < 116) {", "*VAR_0 = (VAR_2 + 69) >> 1;", "*VAR_1 = (VAR_2 - (*VAR_0 << 1) + 68) << 1;", "} else {", "*VAR_0 = VAR_2 - 24;", "*VAR_1 = 0;", "}", "*VAR_3 = av_clip(*VAR_0 - 8 - (*VAR_1 < 0),\nAMRWB_P_DELAY_MIN, AMRWB_P_DELAY_MAX - 15);", "} else {", "*VAR_0 = (VAR_2 + 1) >> 1;", "*VAR_1 = (VAR_2 - (*VAR_0 << 1)) << 1;", "*VAR_0 += *VAR_3;", "}", "}" ]
[ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ] ]
2,386
void qpci_io_writel(QPCIDevice *dev, void *data, uint32_t value) { uintptr_t addr = (uintptr_t)data; if (addr < QPCI_PIO_LIMIT) { dev->bus->pio_writel(dev->bus, addr, value); } else { value = cpu_to_le32(value); dev->bus->memwrite(dev->bus, addr, &value, sizeof(value)); } }
true
qemu
b4ba67d9a702507793c2724e56f98e9b0f7be02b
void qpci_io_writel(QPCIDevice *dev, void *data, uint32_t value) { uintptr_t addr = (uintptr_t)data; if (addr < QPCI_PIO_LIMIT) { dev->bus->pio_writel(dev->bus, addr, value); } else { value = cpu_to_le32(value); dev->bus->memwrite(dev->bus, addr, &value, sizeof(value)); } }
{ "code": [ " uintptr_t addr = (uintptr_t)data;", " if (addr < QPCI_PIO_LIMIT) {", " uintptr_t addr = (uintptr_t)data;", " if (addr < QPCI_PIO_LIMIT) {", " uintptr_t addr = (uintptr_t)data;", " if (addr < QPCI_PIO_LIMIT) {", " uintptr_t addr = (uintptr_t)data;", " if (addr < QPCI_PIO_LIMIT) {", " uintptr_t addr = (uintptr_t)data;", " if (addr < QPCI_PIO_LIMIT) {", " dev->bus->memwrite(dev->bus, addr, &value, sizeof(value));", " uintptr_t addr = (uintptr_t)data;", " if (addr < QPCI_PIO_LIMIT) {", " dev->bus->memwrite(dev->bus, addr, &value, sizeof(value));", "void qpci_io_writel(QPCIDevice *dev, void *data, uint32_t value)", " uintptr_t addr = (uintptr_t)data;", " if (addr < QPCI_PIO_LIMIT) {", " dev->bus->pio_writel(dev->bus, addr, value);", " dev->bus->memwrite(dev->bus, addr, &value, sizeof(value));", " uintptr_t addr = (uintptr_t)data;", " if (addr < QPCI_PIO_LIMIT) {", " dev->bus->memwrite(dev->bus, addr, &value, sizeof(value));", " uintptr_t addr = (uintptr_t)data;", " uintptr_t addr = (uintptr_t)data;" ], "line_no": [ 5, 9, 5, 9, 5, 9, 5, 9, 5, 9, 17, 5, 9, 17, 1, 5, 9, 11, 17, 5, 9, 17, 5, 5 ] }
void FUNC_0(QPCIDevice *VAR_0, void *VAR_1, uint32_t VAR_2) { uintptr_t addr = (uintptr_t)VAR_1; if (addr < QPCI_PIO_LIMIT) { VAR_0->bus->pio_writel(VAR_0->bus, addr, VAR_2); } else { VAR_2 = cpu_to_le32(VAR_2); VAR_0->bus->memwrite(VAR_0->bus, addr, &VAR_2, sizeof(VAR_2)); } }
[ "void FUNC_0(QPCIDevice *VAR_0, void *VAR_1, uint32_t VAR_2)\n{", "uintptr_t addr = (uintptr_t)VAR_1;", "if (addr < QPCI_PIO_LIMIT) {", "VAR_0->bus->pio_writel(VAR_0->bus, addr, VAR_2);", "} else {", "VAR_2 = cpu_to_le32(VAR_2);", "VAR_0->bus->memwrite(VAR_0->bus, addr, &VAR_2, sizeof(VAR_2));", "}", "}" ]
[ 1, 1, 1, 1, 0, 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
2,387
void do_store_xer (void) { xer_so = (T0 >> XER_SO) & 0x01; xer_ov = (T0 >> XER_OV) & 0x01; xer_ca = (T0 >> XER_CA) & 0x01; xer_cmp = (T0 >> XER_CMP) & 0xFF; xer_bc = (T0 >> XER_BC) & 0x3F; }
true
qemu
d9bce9d99f4656ae0b0127f7472db9067b8f84ab
void do_store_xer (void) { xer_so = (T0 >> XER_SO) & 0x01; xer_ov = (T0 >> XER_OV) & 0x01; xer_ca = (T0 >> XER_CA) & 0x01; xer_cmp = (T0 >> XER_CMP) & 0xFF; xer_bc = (T0 >> XER_BC) & 0x3F; }
{ "code": [ " xer_bc = (T0 >> XER_BC) & 0x3F;" ], "line_no": [ 13 ] }
void FUNC_0 (void) { xer_so = (T0 >> XER_SO) & 0x01; xer_ov = (T0 >> XER_OV) & 0x01; xer_ca = (T0 >> XER_CA) & 0x01; xer_cmp = (T0 >> XER_CMP) & 0xFF; xer_bc = (T0 >> XER_BC) & 0x3F; }
[ "void FUNC_0 (void)\n{", "xer_so = (T0 >> XER_SO) & 0x01;", "xer_ov = (T0 >> XER_OV) & 0x01;", "xer_ca = (T0 >> XER_CA) & 0x01;", "xer_cmp = (T0 >> XER_CMP) & 0xFF;", "xer_bc = (T0 >> XER_BC) & 0x3F;", "}" ]
[ 0, 0, 0, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ] ]
2,388
int ffurl_open(URLContext **puc, const char *filename, int flags, const AVIOInterruptCB *int_cb, AVDictionary **options) { int ret = ffurl_alloc(puc, filename, flags, int_cb); if (ret < 0) return ret; if (options && (*puc)->prot->priv_data_class && (ret = av_opt_set_dict((*puc)->priv_data, options)) < 0) goto fail; if ((ret = av_opt_set_dict(*puc, options)) < 0) goto fail; ret = ffurl_connect(*puc, options); if (!ret) return 0; fail: ffurl_close(*puc); *puc = NULL; return ret; }
false
FFmpeg
1dba8371d93cf1c83bcd5c432d921905206a60f3
int ffurl_open(URLContext **puc, const char *filename, int flags, const AVIOInterruptCB *int_cb, AVDictionary **options) { int ret = ffurl_alloc(puc, filename, flags, int_cb); if (ret < 0) return ret; if (options && (*puc)->prot->priv_data_class && (ret = av_opt_set_dict((*puc)->priv_data, options)) < 0) goto fail; if ((ret = av_opt_set_dict(*puc, options)) < 0) goto fail; ret = ffurl_connect(*puc, options); if (!ret) return 0; fail: ffurl_close(*puc); *puc = NULL; return ret; }
{ "code": [], "line_no": [] }
int FUNC_0(URLContext **VAR_0, const char *VAR_1, int VAR_2, const AVIOInterruptCB *VAR_3, AVDictionary **VAR_4) { int VAR_5 = ffurl_alloc(VAR_0, VAR_1, VAR_2, VAR_3); if (VAR_5 < 0) return VAR_5; if (VAR_4 && (*VAR_0)->prot->priv_data_class && (VAR_5 = av_opt_set_dict((*VAR_0)->priv_data, VAR_4)) < 0) goto fail; if ((VAR_5 = av_opt_set_dict(*VAR_0, VAR_4)) < 0) goto fail; VAR_5 = ffurl_connect(*VAR_0, VAR_4); if (!VAR_5) return 0; fail: ffurl_close(*VAR_0); *VAR_0 = NULL; return VAR_5; }
[ "int FUNC_0(URLContext **VAR_0, const char *VAR_1, int VAR_2,\nconst AVIOInterruptCB *VAR_3, AVDictionary **VAR_4)\n{", "int VAR_5 = ffurl_alloc(VAR_0, VAR_1, VAR_2, VAR_3);", "if (VAR_5 < 0)\nreturn VAR_5;", "if (VAR_4 && (*VAR_0)->prot->priv_data_class &&\n(VAR_5 = av_opt_set_dict((*VAR_0)->priv_data, VAR_4)) < 0)\ngoto fail;", "if ((VAR_5 = av_opt_set_dict(*VAR_0, VAR_4)) < 0)\ngoto fail;", "VAR_5 = ffurl_connect(*VAR_0, VAR_4);", "if (!VAR_5)\nreturn 0;", "fail:\nffurl_close(*VAR_0);", "*VAR_0 = NULL;", "return VAR_5;", "}" ]
[ 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 ] ]
2,389
static int mpeg4_decode_video_packet_header(MpegEncContext *s) { int mb_num_bits= av_log2(s->mb_num - 1) + 1; int header_extension=0, mb_num, len; /* is there enough space left for a video packet + header */ if( get_bits_count(&s->gb) > s->gb.size*8-20) return -1; for(len=0; len<32; len++){ if(get_bits1(&s->gb)) break; } if(len!=ff_mpeg4_get_video_packet_prefix_length(s)){ printf("marker does not match f_code\n"); return -1; } if(s->shape != RECT_SHAPE){ header_extension= get_bits1(&s->gb); //FIXME more stuff here } mb_num= get_bits(&s->gb, mb_num_bits); if(mb_num>=s->mb_num){ fprintf(stderr, "illegal mb_num in video packet (%d %d) \n", mb_num, s->mb_num); return -1; } s->mb_x= mb_num % s->mb_width; s->mb_y= mb_num / s->mb_width; if(s->shape != BIN_ONLY_SHAPE){ int qscale= get_bits(&s->gb, s->quant_precision); if(qscale) s->qscale= qscale; } if(s->shape == RECT_SHAPE){ header_extension= get_bits1(&s->gb); } if(header_extension){ int time_increment; int time_incr=0; while (get_bits1(&s->gb) != 0) time_incr++; check_marker(&s->gb, "before time_increment in video packed header"); time_increment= get_bits(&s->gb, s->time_increment_bits); check_marker(&s->gb, "before vop_coding_type in video packed header"); skip_bits(&s->gb, 2); /* vop coding type */ //FIXME not rect stuff here if(s->shape != BIN_ONLY_SHAPE){ skip_bits(&s->gb, 3); /* intra dc vlc threshold */ //FIXME dont just ignore everything if(s->pict_type == S_TYPE && s->vol_sprite_usage==GMC_SPRITE){ mpeg4_decode_sprite_trajectory(s); fprintf(stderr, "untested\n"); } //FIXME reduced res stuff here if (s->pict_type != I_TYPE) { int f_code = get_bits(&s->gb, 3); /* fcode_for */ if(f_code==0){ printf("Error, video packet header damaged (f_code=0)\n"); } } if (s->pict_type == B_TYPE) { int b_code = get_bits(&s->gb, 3); if(b_code==0){ printf("Error, video packet header damaged (b_code=0)\n"); } } } } //FIXME new-pred stuff //printf("parse ok %d %d %d %d\n", mb_num, s->mb_x + s->mb_y*s->mb_width, get_bits_count(gb), get_bits_count(&s->gb)); return 0; }
false
FFmpeg
68f593b48433842f3407586679fe07f3e5199ab9
static int mpeg4_decode_video_packet_header(MpegEncContext *s) { int mb_num_bits= av_log2(s->mb_num - 1) + 1; int header_extension=0, mb_num, len; if( get_bits_count(&s->gb) > s->gb.size*8-20) return -1; for(len=0; len<32; len++){ if(get_bits1(&s->gb)) break; } if(len!=ff_mpeg4_get_video_packet_prefix_length(s)){ printf("marker does not match f_code\n"); return -1; } if(s->shape != RECT_SHAPE){ header_extension= get_bits1(&s->gb); } mb_num= get_bits(&s->gb, mb_num_bits); if(mb_num>=s->mb_num){ fprintf(stderr, "illegal mb_num in video packet (%d %d) \n", mb_num, s->mb_num); return -1; } s->mb_x= mb_num % s->mb_width; s->mb_y= mb_num / s->mb_width; if(s->shape != BIN_ONLY_SHAPE){ int qscale= get_bits(&s->gb, s->quant_precision); if(qscale) s->qscale= qscale; } if(s->shape == RECT_SHAPE){ header_extension= get_bits1(&s->gb); } if(header_extension){ int time_increment; int time_incr=0; while (get_bits1(&s->gb) != 0) time_incr++; check_marker(&s->gb, "before time_increment in video packed header"); time_increment= get_bits(&s->gb, s->time_increment_bits); check_marker(&s->gb, "before vop_coding_type in video packed header"); skip_bits(&s->gb, 2); if(s->shape != BIN_ONLY_SHAPE){ skip_bits(&s->gb, 3); if(s->pict_type == S_TYPE && s->vol_sprite_usage==GMC_SPRITE){ mpeg4_decode_sprite_trajectory(s); fprintf(stderr, "untested\n"); } if (s->pict_type != I_TYPE) { int f_code = get_bits(&s->gb, 3); if(f_code==0){ printf("Error, video packet header damaged (f_code=0)\n"); } } if (s->pict_type == B_TYPE) { int b_code = get_bits(&s->gb, 3); if(b_code==0){ printf("Error, video packet header damaged (b_code=0)\n"); } } } } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(MpegEncContext *VAR_0) { int VAR_1= av_log2(VAR_0->VAR_3 - 1) + 1; int VAR_2=0, VAR_3, VAR_4; if( get_bits_count(&VAR_0->gb) > VAR_0->gb.size*8-20) return -1; for(VAR_4=0; VAR_4<32; VAR_4++){ if(get_bits1(&VAR_0->gb)) break; } if(VAR_4!=ff_mpeg4_get_video_packet_prefix_length(VAR_0)){ printf("marker does not match VAR_8\n"); return -1; } if(VAR_0->shape != RECT_SHAPE){ VAR_2= get_bits1(&VAR_0->gb); } VAR_3= get_bits(&VAR_0->gb, VAR_1); if(VAR_3>=VAR_0->VAR_3){ fprintf(stderr, "illegal VAR_3 in video packet (%d %d) \n", VAR_3, VAR_0->VAR_3); return -1; } VAR_0->mb_x= VAR_3 % VAR_0->mb_width; VAR_0->mb_y= VAR_3 / VAR_0->mb_width; if(VAR_0->shape != BIN_ONLY_SHAPE){ int VAR_5= get_bits(&VAR_0->gb, VAR_0->quant_precision); if(VAR_5) VAR_0->VAR_5= VAR_5; } if(VAR_0->shape == RECT_SHAPE){ VAR_2= get_bits1(&VAR_0->gb); } if(VAR_2){ int VAR_6; int VAR_7=0; while (get_bits1(&VAR_0->gb) != 0) VAR_7++; check_marker(&VAR_0->gb, "before VAR_6 in video packed header"); VAR_6= get_bits(&VAR_0->gb, VAR_0->time_increment_bits); check_marker(&VAR_0->gb, "before vop_coding_type in video packed header"); skip_bits(&VAR_0->gb, 2); if(VAR_0->shape != BIN_ONLY_SHAPE){ skip_bits(&VAR_0->gb, 3); if(VAR_0->pict_type == S_TYPE && VAR_0->vol_sprite_usage==GMC_SPRITE){ mpeg4_decode_sprite_trajectory(VAR_0); fprintf(stderr, "untested\n"); } if (VAR_0->pict_type != I_TYPE) { int VAR_8 = get_bits(&VAR_0->gb, 3); if(VAR_8==0){ printf("Error, video packet header damaged (VAR_8=0)\n"); } } if (VAR_0->pict_type == B_TYPE) { int VAR_9 = get_bits(&VAR_0->gb, 3); if(VAR_9==0){ printf("Error, video packet header damaged (VAR_9=0)\n"); } } } } return 0; }
[ "static int FUNC_0(MpegEncContext *VAR_0)\n{", "int VAR_1= av_log2(VAR_0->VAR_3 - 1) + 1;", "int VAR_2=0, VAR_3, VAR_4;", "if( get_bits_count(&VAR_0->gb) > VAR_0->gb.size*8-20) return -1;", "for(VAR_4=0; VAR_4<32; VAR_4++){", "if(get_bits1(&VAR_0->gb)) break;", "}", "if(VAR_4!=ff_mpeg4_get_video_packet_prefix_length(VAR_0)){", "printf(\"marker does not match VAR_8\\n\");", "return -1;", "}", "if(VAR_0->shape != RECT_SHAPE){", "VAR_2= get_bits1(&VAR_0->gb);", "}", "VAR_3= get_bits(&VAR_0->gb, VAR_1);", "if(VAR_3>=VAR_0->VAR_3){", "fprintf(stderr, \"illegal VAR_3 in video packet (%d %d) \\n\", VAR_3, VAR_0->VAR_3);", "return -1;", "}", "VAR_0->mb_x= VAR_3 % VAR_0->mb_width;", "VAR_0->mb_y= VAR_3 / VAR_0->mb_width;", "if(VAR_0->shape != BIN_ONLY_SHAPE){", "int VAR_5= get_bits(&VAR_0->gb, VAR_0->quant_precision);", "if(VAR_5)\nVAR_0->VAR_5= VAR_5;", "}", "if(VAR_0->shape == RECT_SHAPE){", "VAR_2= get_bits1(&VAR_0->gb);", "}", "if(VAR_2){", "int VAR_6;", "int VAR_7=0;", "while (get_bits1(&VAR_0->gb) != 0)\nVAR_7++;", "check_marker(&VAR_0->gb, \"before VAR_6 in video packed header\");", "VAR_6= get_bits(&VAR_0->gb, VAR_0->time_increment_bits);", "check_marker(&VAR_0->gb, \"before vop_coding_type in video packed header\");", "skip_bits(&VAR_0->gb, 2);", "if(VAR_0->shape != BIN_ONLY_SHAPE){", "skip_bits(&VAR_0->gb, 3);", "if(VAR_0->pict_type == S_TYPE && VAR_0->vol_sprite_usage==GMC_SPRITE){", "mpeg4_decode_sprite_trajectory(VAR_0);", "fprintf(stderr, \"untested\\n\");", "}", "if (VAR_0->pict_type != I_TYPE) {", "int VAR_8 = get_bits(&VAR_0->gb, 3);", "if(VAR_8==0){", "printf(\"Error, video packet header damaged (VAR_8=0)\\n\");", "}", "}", "if (VAR_0->pict_type == B_TYPE) {", "int VAR_9 = get_bits(&VAR_0->gb, 3);", "if(VAR_9==0){", "printf(\"Error, video packet header damaged (VAR_9=0)\\n\");", "}", "}", "}", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 65, 67 ], [ 69 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 87, 89 ], [ 93 ], [ 95 ], [ 97 ], [ 101 ], [ 107 ], [ 109 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 163 ], [ 165 ] ]
2,390
int avfilter_link(AVFilterContext *src, unsigned srcpad, AVFilterContext *dst, unsigned dstpad) { AVFilterLink *link; if (src->nb_outputs <= srcpad || dst->nb_inputs <= dstpad || src->outputs[srcpad] || dst->inputs[dstpad]) return -1; if (src->output_pads[srcpad].type != dst->input_pads[dstpad].type) { av_log(src, AV_LOG_ERROR, "Media type mismatch between the '%s' filter output pad %d and the '%s' filter input pad %d\n", src->name, srcpad, dst->name, dstpad); return AVERROR(EINVAL); } src->outputs[srcpad] = dst-> inputs[dstpad] = link = av_mallocz(sizeof(AVFilterLink)); link->src = src; link->dst = dst; link->srcpad = &src->output_pads[srcpad]; link->dstpad = &dst->input_pads[dstpad]; link->type = src->output_pads[srcpad].type; assert(AV_PIX_FMT_NONE == -1 && AV_SAMPLE_FMT_NONE == -1); link->format = -1; return 0; }
false
FFmpeg
7e2b15c094bb41ede9ce2a208982a20e4dfa26a6
int avfilter_link(AVFilterContext *src, unsigned srcpad, AVFilterContext *dst, unsigned dstpad) { AVFilterLink *link; if (src->nb_outputs <= srcpad || dst->nb_inputs <= dstpad || src->outputs[srcpad] || dst->inputs[dstpad]) return -1; if (src->output_pads[srcpad].type != dst->input_pads[dstpad].type) { av_log(src, AV_LOG_ERROR, "Media type mismatch between the '%s' filter output pad %d and the '%s' filter input pad %d\n", src->name, srcpad, dst->name, dstpad); return AVERROR(EINVAL); } src->outputs[srcpad] = dst-> inputs[dstpad] = link = av_mallocz(sizeof(AVFilterLink)); link->src = src; link->dst = dst; link->srcpad = &src->output_pads[srcpad]; link->dstpad = &dst->input_pads[dstpad]; link->type = src->output_pads[srcpad].type; assert(AV_PIX_FMT_NONE == -1 && AV_SAMPLE_FMT_NONE == -1); link->format = -1; return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(AVFilterContext *VAR_0, unsigned VAR_1, AVFilterContext *VAR_2, unsigned VAR_3) { AVFilterLink *link; if (VAR_0->nb_outputs <= VAR_1 || VAR_2->nb_inputs <= VAR_3 || VAR_0->outputs[VAR_1] || VAR_2->inputs[VAR_3]) return -1; if (VAR_0->output_pads[VAR_1].type != VAR_2->input_pads[VAR_3].type) { av_log(VAR_0, AV_LOG_ERROR, "Media type mismatch between the '%s' filter output pad %d and the '%s' filter input pad %d\n", VAR_0->name, VAR_1, VAR_2->name, VAR_3); return AVERROR(EINVAL); } VAR_0->outputs[VAR_1] = VAR_2-> inputs[VAR_3] = link = av_mallocz(sizeof(AVFilterLink)); link->VAR_0 = VAR_0; link->VAR_2 = VAR_2; link->VAR_1 = &VAR_0->output_pads[VAR_1]; link->VAR_3 = &VAR_2->input_pads[VAR_3]; link->type = VAR_0->output_pads[VAR_1].type; assert(AV_PIX_FMT_NONE == -1 && AV_SAMPLE_FMT_NONE == -1); link->format = -1; return 0; }
[ "int FUNC_0(AVFilterContext *VAR_0, unsigned VAR_1,\nAVFilterContext *VAR_2, unsigned VAR_3)\n{", "AVFilterLink *link;", "if (VAR_0->nb_outputs <= VAR_1 || VAR_2->nb_inputs <= VAR_3 ||\nVAR_0->outputs[VAR_1] || VAR_2->inputs[VAR_3])\nreturn -1;", "if (VAR_0->output_pads[VAR_1].type != VAR_2->input_pads[VAR_3].type) {", "av_log(VAR_0, AV_LOG_ERROR,\n\"Media type mismatch between the '%s' filter output pad %d and the '%s' filter input pad %d\\n\",\nVAR_0->name, VAR_1, VAR_2->name, VAR_3);", "return AVERROR(EINVAL);", "}", "VAR_0->outputs[VAR_1] =\nVAR_2-> inputs[VAR_3] = link = av_mallocz(sizeof(AVFilterLink));", "link->VAR_0 = VAR_0;", "link->VAR_2 = VAR_2;", "link->VAR_1 = &VAR_0->output_pads[VAR_1];", "link->VAR_3 = &VAR_2->input_pads[VAR_3];", "link->type = VAR_0->output_pads[VAR_1].type;", "assert(AV_PIX_FMT_NONE == -1 && AV_SAMPLE_FMT_NONE == -1);", "link->format = -1;", "return 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 ], [ 33, 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ] ]
2,391
static void usage(void) { printf("Escape an input string, adopting the av_get_token() escaping logic\n"); printf("usage: ffescape [OPTIONS]\n"); printf("\n" "Options:\n" "-e echo each input line on output\n" "-h print this help\n" "-i INFILE set INFILE as input file, stdin if omitted\n" "-l LEVEL set the number of escaping levels, 1 if omitted\n" "-m ESCAPE_MODE select escape mode between 'full', 'lazy', 'quote', default is 'lazy'\n" "-o OUTFILE set OUTFILE as output file, stdout if omitted\n" "-p PROMPT set output prompt, is '=> ' by default\n" "-s SPECIAL_CHARS set the list of special characters\n"); }
false
FFmpeg
9767ec6b865c35f68cb6642fefeacc009f17e638
static void usage(void) { printf("Escape an input string, adopting the av_get_token() escaping logic\n"); printf("usage: ffescape [OPTIONS]\n"); printf("\n" "Options:\n" "-e echo each input line on output\n" "-h print this help\n" "-i INFILE set INFILE as input file, stdin if omitted\n" "-l LEVEL set the number of escaping levels, 1 if omitted\n" "-m ESCAPE_MODE select escape mode between 'full', 'lazy', 'quote', default is 'lazy'\n" "-o OUTFILE set OUTFILE as output file, stdout if omitted\n" "-p PROMPT set output prompt, is '=> ' by default\n" "-s SPECIAL_CHARS set the list of special characters\n"); }
{ "code": [], "line_no": [] }
static void FUNC_0(void) { printf("Escape an input string, adopting the av_get_token() escaping logic\n"); printf("FUNC_0: ffescape [OPTIONS]\n"); printf("\n" "Options:\n" "-e echo each input line on output\n" "-h print this help\n" "-i INFILE set INFILE as input file, stdin if omitted\n" "-l LEVEL set the number of escaping levels, 1 if omitted\n" "-m ESCAPE_MODE select escape mode between 'full', 'lazy', 'quote', default is 'lazy'\n" "-o OUTFILE set OUTFILE as output file, stdout if omitted\n" "-p PROMPT set output prompt, is '=> ' by default\n" "-s SPECIAL_CHARS set the list of special characters\n"); }
[ "static void FUNC_0(void)\n{", "printf(\"Escape an input string, adopting the av_get_token() escaping logic\\n\");", "printf(\"FUNC_0: ffescape [OPTIONS]\\n\");", "printf(\"\\n\"\n\"Options:\\n\"\n\"-e echo each input line on output\\n\"\n\"-h print this help\\n\"\n\"-i INFILE set INFILE as input file, stdin if omitted\\n\"\n\"-l LEVEL set the number of escaping levels, 1 if omitted\\n\"\n\"-m ESCAPE_MODE select escape mode between 'full', 'lazy', 'quote', default is 'lazy'\\n\"\n\"-o OUTFILE set OUTFILE as output file, stdout if omitted\\n\"\n\"-p PROMPT set output prompt, is '=> ' by default\\n\"\n\"-s SPECIAL_CHARS set the list of special characters\\n\");", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9, 11, 13, 15, 17, 19, 21, 23, 25, 27 ], [ 29 ] ]
2,392
static inline void mpeg_motion(MpegEncContext *s, UINT8 *dest_y, UINT8 *dest_cb, UINT8 *dest_cr, int dest_offset, UINT8 **ref_picture, int src_offset, int field_based, op_pixels_func *pix_op, int motion_x, int motion_y, int h) { UINT8 *ptr; int dxy, offset, mx, my, src_x, src_y, height, linesize; if(s->quarter_sample) { motion_x>>=1; motion_y>>=1; } dxy = ((motion_y & 1) << 1) | (motion_x & 1); src_x = s->mb_x * 16 + (motion_x >> 1); src_y = s->mb_y * (16 >> field_based) + (motion_y >> 1); /* WARNING: do no forget half pels */ height = s->height >> field_based; src_x = clip(src_x, -16, s->width); if (src_x == s->width) dxy &= ~1; src_y = clip(src_y, -16, height); if (src_y == height) dxy &= ~2; linesize = s->linesize << field_based; ptr = ref_picture[0] + (src_y * linesize) + (src_x) + src_offset; dest_y += dest_offset; pix_op[dxy](dest_y, ptr, linesize, h); pix_op[dxy](dest_y + 8, ptr + 8, linesize, h); if (s->out_format == FMT_H263) { dxy = 0; if ((motion_x & 3) != 0) dxy |= 1; if ((motion_y & 3) != 0) dxy |= 2; mx = motion_x >> 2; my = motion_y >> 2; } else { mx = motion_x / 2; my = motion_y / 2; dxy = ((my & 1) << 1) | (mx & 1); mx >>= 1; my >>= 1; } src_x = s->mb_x * 8 + mx; src_y = s->mb_y * (8 >> field_based) + my; src_x = clip(src_x, -8, s->width >> 1); if (src_x == (s->width >> 1)) dxy &= ~1; src_y = clip(src_y, -8, height >> 1); if (src_y == (height >> 1)) dxy &= ~2; offset = (src_y * (linesize >> 1)) + src_x + (src_offset >> 1); ptr = ref_picture[1] + offset; pix_op[dxy](dest_cb + (dest_offset >> 1), ptr, linesize >> 1, h >> 1); ptr = ref_picture[2] + offset; pix_op[dxy](dest_cr + (dest_offset >> 1), ptr, linesize >> 1, h >> 1); }
false
FFmpeg
7f2fe444a39bca733d390b6608801c5f002bfd31
static inline void mpeg_motion(MpegEncContext *s, UINT8 *dest_y, UINT8 *dest_cb, UINT8 *dest_cr, int dest_offset, UINT8 **ref_picture, int src_offset, int field_based, op_pixels_func *pix_op, int motion_x, int motion_y, int h) { UINT8 *ptr; int dxy, offset, mx, my, src_x, src_y, height, linesize; if(s->quarter_sample) { motion_x>>=1; motion_y>>=1; } dxy = ((motion_y & 1) << 1) | (motion_x & 1); src_x = s->mb_x * 16 + (motion_x >> 1); src_y = s->mb_y * (16 >> field_based) + (motion_y >> 1); height = s->height >> field_based; src_x = clip(src_x, -16, s->width); if (src_x == s->width) dxy &= ~1; src_y = clip(src_y, -16, height); if (src_y == height) dxy &= ~2; linesize = s->linesize << field_based; ptr = ref_picture[0] + (src_y * linesize) + (src_x) + src_offset; dest_y += dest_offset; pix_op[dxy](dest_y, ptr, linesize, h); pix_op[dxy](dest_y + 8, ptr + 8, linesize, h); if (s->out_format == FMT_H263) { dxy = 0; if ((motion_x & 3) != 0) dxy |= 1; if ((motion_y & 3) != 0) dxy |= 2; mx = motion_x >> 2; my = motion_y >> 2; } else { mx = motion_x / 2; my = motion_y / 2; dxy = ((my & 1) << 1) | (mx & 1); mx >>= 1; my >>= 1; } src_x = s->mb_x * 8 + mx; src_y = s->mb_y * (8 >> field_based) + my; src_x = clip(src_x, -8, s->width >> 1); if (src_x == (s->width >> 1)) dxy &= ~1; src_y = clip(src_y, -8, height >> 1); if (src_y == (height >> 1)) dxy &= ~2; offset = (src_y * (linesize >> 1)) + src_x + (src_offset >> 1); ptr = ref_picture[1] + offset; pix_op[dxy](dest_cb + (dest_offset >> 1), ptr, linesize >> 1, h >> 1); ptr = ref_picture[2] + offset; pix_op[dxy](dest_cr + (dest_offset >> 1), ptr, linesize >> 1, h >> 1); }
{ "code": [], "line_no": [] }
static inline void FUNC_0(MpegEncContext *VAR_0, UINT8 *VAR_1, UINT8 *VAR_2, UINT8 *VAR_3, int VAR_4, UINT8 **VAR_5, int VAR_6, int VAR_7, op_pixels_func *VAR_8, int VAR_9, int VAR_10, int VAR_11) { UINT8 *ptr; int VAR_12, VAR_13, VAR_14, VAR_15, VAR_16, VAR_17, VAR_18, VAR_19; if(VAR_0->quarter_sample) { VAR_9>>=1; VAR_10>>=1; } VAR_12 = ((VAR_10 & 1) << 1) | (VAR_9 & 1); VAR_16 = VAR_0->mb_x * 16 + (VAR_9 >> 1); VAR_17 = VAR_0->mb_y * (16 >> VAR_7) + (VAR_10 >> 1); VAR_18 = VAR_0->VAR_18 >> VAR_7; VAR_16 = clip(VAR_16, -16, VAR_0->width); if (VAR_16 == VAR_0->width) VAR_12 &= ~1; VAR_17 = clip(VAR_17, -16, VAR_18); if (VAR_17 == VAR_18) VAR_12 &= ~2; VAR_19 = VAR_0->VAR_19 << VAR_7; ptr = VAR_5[0] + (VAR_17 * VAR_19) + (VAR_16) + VAR_6; VAR_1 += VAR_4; VAR_8[VAR_12](VAR_1, ptr, VAR_19, VAR_11); VAR_8[VAR_12](VAR_1 + 8, ptr + 8, VAR_19, VAR_11); if (VAR_0->out_format == FMT_H263) { VAR_12 = 0; if ((VAR_9 & 3) != 0) VAR_12 |= 1; if ((VAR_10 & 3) != 0) VAR_12 |= 2; VAR_14 = VAR_9 >> 2; VAR_15 = VAR_10 >> 2; } else { VAR_14 = VAR_9 / 2; VAR_15 = VAR_10 / 2; VAR_12 = ((VAR_15 & 1) << 1) | (VAR_14 & 1); VAR_14 >>= 1; VAR_15 >>= 1; } VAR_16 = VAR_0->mb_x * 8 + VAR_14; VAR_17 = VAR_0->mb_y * (8 >> VAR_7) + VAR_15; VAR_16 = clip(VAR_16, -8, VAR_0->width >> 1); if (VAR_16 == (VAR_0->width >> 1)) VAR_12 &= ~1; VAR_17 = clip(VAR_17, -8, VAR_18 >> 1); if (VAR_17 == (VAR_18 >> 1)) VAR_12 &= ~2; VAR_13 = (VAR_17 * (VAR_19 >> 1)) + VAR_16 + (VAR_6 >> 1); ptr = VAR_5[1] + VAR_13; VAR_8[VAR_12](VAR_2 + (VAR_4 >> 1), ptr, VAR_19 >> 1, VAR_11 >> 1); ptr = VAR_5[2] + VAR_13; VAR_8[VAR_12](VAR_3 + (VAR_4 >> 1), ptr, VAR_19 >> 1, VAR_11 >> 1); }
[ "static inline void FUNC_0(MpegEncContext *VAR_0,\nUINT8 *VAR_1, UINT8 *VAR_2, UINT8 *VAR_3,\nint VAR_4,\nUINT8 **VAR_5, int VAR_6,\nint VAR_7, op_pixels_func *VAR_8,\nint VAR_9, int VAR_10, int VAR_11)\n{", "UINT8 *ptr;", "int VAR_12, VAR_13, VAR_14, VAR_15, VAR_16, VAR_17, VAR_18, VAR_19;", "if(VAR_0->quarter_sample)\n{", "VAR_9>>=1;", "VAR_10>>=1;", "}", "VAR_12 = ((VAR_10 & 1) << 1) | (VAR_9 & 1);", "VAR_16 = VAR_0->mb_x * 16 + (VAR_9 >> 1);", "VAR_17 = VAR_0->mb_y * (16 >> VAR_7) + (VAR_10 >> 1);", "VAR_18 = VAR_0->VAR_18 >> VAR_7;", "VAR_16 = clip(VAR_16, -16, VAR_0->width);", "if (VAR_16 == VAR_0->width)\nVAR_12 &= ~1;", "VAR_17 = clip(VAR_17, -16, VAR_18);", "if (VAR_17 == VAR_18)\nVAR_12 &= ~2;", "VAR_19 = VAR_0->VAR_19 << VAR_7;", "ptr = VAR_5[0] + (VAR_17 * VAR_19) + (VAR_16) + VAR_6;", "VAR_1 += VAR_4;", "VAR_8[VAR_12](VAR_1, ptr, VAR_19, VAR_11);", "VAR_8[VAR_12](VAR_1 + 8, ptr + 8, VAR_19, VAR_11);", "if (VAR_0->out_format == FMT_H263) {", "VAR_12 = 0;", "if ((VAR_9 & 3) != 0)\nVAR_12 |= 1;", "if ((VAR_10 & 3) != 0)\nVAR_12 |= 2;", "VAR_14 = VAR_9 >> 2;", "VAR_15 = VAR_10 >> 2;", "} else {", "VAR_14 = VAR_9 / 2;", "VAR_15 = VAR_10 / 2;", "VAR_12 = ((VAR_15 & 1) << 1) | (VAR_14 & 1);", "VAR_14 >>= 1;", "VAR_15 >>= 1;", "}", "VAR_16 = VAR_0->mb_x * 8 + VAR_14;", "VAR_17 = VAR_0->mb_y * (8 >> VAR_7) + VAR_15;", "VAR_16 = clip(VAR_16, -8, VAR_0->width >> 1);", "if (VAR_16 == (VAR_0->width >> 1))\nVAR_12 &= ~1;", "VAR_17 = clip(VAR_17, -8, VAR_18 >> 1);", "if (VAR_17 == (VAR_18 >> 1))\nVAR_12 &= ~2;", "VAR_13 = (VAR_17 * (VAR_19 >> 1)) + VAR_16 + (VAR_6 >> 1);", "ptr = VAR_5[1] + VAR_13;", "VAR_8[VAR_12](VAR_2 + (VAR_4 >> 1), ptr, VAR_19 >> 1, VAR_11 >> 1);", "ptr = VAR_5[2] + VAR_13;", "VAR_8[VAR_12](VAR_3 + (VAR_4 >> 1), ptr, VAR_19 >> 1, VAR_11 >> 1);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11, 13 ], [ 15 ], [ 17 ], [ 19, 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 41 ], [ 43 ], [ 45, 47 ], [ 49 ], [ 51, 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ], [ 71, 73 ], [ 75, 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99 ], [ 101 ], [ 103 ], [ 105, 107 ], [ 109 ], [ 111, 113 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ] ]
2,393
av_cold void ff_audio_convert_init_x86(AudioConvert *ac) { int cpu_flags = av_get_cpu_flags(); if (EXTERNAL_MMX(cpu_flags)) { ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S32, 0, 1, 8, "MMX", ff_conv_s32_to_s16_mmx); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP, 6, 1, 4, "MMX", ff_conv_fltp_to_flt_6ch_mmx); } if (EXTERNAL_SSE(cpu_flags)) { ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLTP, 6, 1, 2, "SSE", ff_conv_fltp_to_s16_6ch_sse); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP, 2, 16, 8, "SSE", ff_conv_fltp_to_flt_2ch_sse); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_FLT, 2, 16, 4, "SSE", ff_conv_flt_to_fltp_2ch_sse); } if (EXTERNAL_SSE2(cpu_flags)) { if (!(cpu_flags & AV_CPU_FLAG_SSE2SLOW)) { ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S32, 0, 16, 16, "SSE2", ff_conv_s32_to_s16_sse2); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16P, 6, 16, 8, "SSE2", ff_conv_s16p_to_s16_6ch_sse2); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLTP, 6, 16, 4, "SSE2", ff_conv_fltp_to_s16_6ch_sse2); } else { ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16P, 6, 1, 4, "SSE2SLOW", ff_conv_s16p_to_s16_6ch_sse2slow); } ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S16, 0, 16, 8, "SSE2", ff_conv_s16_to_s32_sse2); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16, 0, 16, 8, "SSE2", ff_conv_s16_to_flt_sse2); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S32, 0, 16, 8, "SSE2", ff_conv_s32_to_flt_sse2); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLT, 0, 16, 16, "SSE2", ff_conv_flt_to_s16_sse2); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_FLT, 0, 16, 16, "SSE2", ff_conv_flt_to_s32_sse2); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16P, 2, 16, 16, "SSE2", ff_conv_s16p_to_s16_2ch_sse2); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16P, 2, 16, 8, "SSE2", ff_conv_s16p_to_flt_2ch_sse2); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16P, 6, 16, 4, "SSE2", ff_conv_s16p_to_flt_6ch_sse2); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLTP, 2, 16, 4, "SSE2", ff_conv_fltp_to_s16_2ch_sse2); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S16, 2, 16, 8, "SSE2", ff_conv_s16_to_s16p_2ch_sse2); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S16, 6, 16, 4, "SSE2", ff_conv_s16_to_s16p_6ch_sse2); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_S16, 2, 16, 8, "SSE2", ff_conv_s16_to_fltp_2ch_sse2); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_S16, 6, 16, 4, "SSE2", ff_conv_s16_to_fltp_6ch_sse2); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_FLT, 2, 16, 8, "SSE2", ff_conv_flt_to_s16p_2ch_sse2); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_FLT, 6, 16, 4, "SSE2", ff_conv_flt_to_s16p_6ch_sse2); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_FLT, 6, 16, 4, "SSE2", ff_conv_flt_to_fltp_6ch_sse2); } if (EXTERNAL_SSSE3(cpu_flags)) { ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16P, 6, 16, 4, "SSSE3", ff_conv_s16p_to_flt_6ch_ssse3); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLTP, 2, 16, 4, "SSSE3", ff_conv_fltp_to_s16_2ch_ssse3); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S16, 2, 16, 8, "SSSE3", ff_conv_s16_to_s16p_2ch_ssse3); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S16, 6, 16, 4, "SSSE3", ff_conv_s16_to_s16p_6ch_ssse3); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_S16, 6, 16, 4, "SSSE3", ff_conv_s16_to_fltp_6ch_ssse3); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_FLT, 6, 16, 4, "SSSE3", ff_conv_flt_to_s16p_6ch_ssse3); } if (EXTERNAL_SSE4(cpu_flags)) { ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16, 0, 16, 8, "SSE4", ff_conv_s16_to_flt_sse4); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP, 6, 16, 4, "SSE4", ff_conv_fltp_to_flt_6ch_sse4); } if (EXTERNAL_AVX(cpu_flags)) { ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S32, 0, 32, 16, "AVX", ff_conv_s32_to_flt_avx); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_FLT, 0, 32, 32, "AVX", ff_conv_flt_to_s32_avx); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16P, 2, 16, 16, "AVX", ff_conv_s16p_to_s16_2ch_avx); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16P, 6, 16, 8, "AVX", ff_conv_s16p_to_s16_6ch_avx); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16P, 2, 16, 8, "AVX", ff_conv_s16p_to_flt_2ch_avx); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16P, 6, 16, 4, "AVX", ff_conv_s16p_to_flt_6ch_avx); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLTP, 6, 16, 4, "AVX", ff_conv_fltp_to_s16_6ch_avx); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP, 6, 16, 4, "AVX", ff_conv_fltp_to_flt_6ch_avx); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S16, 2, 16, 8, "AVX", ff_conv_s16_to_s16p_2ch_avx); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S16, 6, 16, 4, "AVX", ff_conv_s16_to_s16p_6ch_avx); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_S16, 2, 16, 8, "AVX", ff_conv_s16_to_fltp_2ch_avx); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_S16, 6, 16, 4, "AVX", ff_conv_s16_to_fltp_6ch_avx); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_FLT, 2, 16, 8, "AVX", ff_conv_flt_to_s16p_2ch_avx); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_FLT, 6, 16, 4, "AVX", ff_conv_flt_to_s16p_6ch_avx); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_FLT, 2, 16, 4, "AVX", ff_conv_flt_to_fltp_2ch_avx); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_FLT, 6, 16, 4, "AVX", ff_conv_flt_to_fltp_6ch_avx); } }
false
FFmpeg
d68c05380cebf563915412182643a8be04ef890b
av_cold void ff_audio_convert_init_x86(AudioConvert *ac) { int cpu_flags = av_get_cpu_flags(); if (EXTERNAL_MMX(cpu_flags)) { ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S32, 0, 1, 8, "MMX", ff_conv_s32_to_s16_mmx); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP, 6, 1, 4, "MMX", ff_conv_fltp_to_flt_6ch_mmx); } if (EXTERNAL_SSE(cpu_flags)) { ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLTP, 6, 1, 2, "SSE", ff_conv_fltp_to_s16_6ch_sse); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP, 2, 16, 8, "SSE", ff_conv_fltp_to_flt_2ch_sse); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_FLT, 2, 16, 4, "SSE", ff_conv_flt_to_fltp_2ch_sse); } if (EXTERNAL_SSE2(cpu_flags)) { if (!(cpu_flags & AV_CPU_FLAG_SSE2SLOW)) { ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S32, 0, 16, 16, "SSE2", ff_conv_s32_to_s16_sse2); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16P, 6, 16, 8, "SSE2", ff_conv_s16p_to_s16_6ch_sse2); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLTP, 6, 16, 4, "SSE2", ff_conv_fltp_to_s16_6ch_sse2); } else { ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16P, 6, 1, 4, "SSE2SLOW", ff_conv_s16p_to_s16_6ch_sse2slow); } ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S16, 0, 16, 8, "SSE2", ff_conv_s16_to_s32_sse2); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16, 0, 16, 8, "SSE2", ff_conv_s16_to_flt_sse2); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S32, 0, 16, 8, "SSE2", ff_conv_s32_to_flt_sse2); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLT, 0, 16, 16, "SSE2", ff_conv_flt_to_s16_sse2); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_FLT, 0, 16, 16, "SSE2", ff_conv_flt_to_s32_sse2); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16P, 2, 16, 16, "SSE2", ff_conv_s16p_to_s16_2ch_sse2); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16P, 2, 16, 8, "SSE2", ff_conv_s16p_to_flt_2ch_sse2); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16P, 6, 16, 4, "SSE2", ff_conv_s16p_to_flt_6ch_sse2); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLTP, 2, 16, 4, "SSE2", ff_conv_fltp_to_s16_2ch_sse2); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S16, 2, 16, 8, "SSE2", ff_conv_s16_to_s16p_2ch_sse2); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S16, 6, 16, 4, "SSE2", ff_conv_s16_to_s16p_6ch_sse2); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_S16, 2, 16, 8, "SSE2", ff_conv_s16_to_fltp_2ch_sse2); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_S16, 6, 16, 4, "SSE2", ff_conv_s16_to_fltp_6ch_sse2); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_FLT, 2, 16, 8, "SSE2", ff_conv_flt_to_s16p_2ch_sse2); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_FLT, 6, 16, 4, "SSE2", ff_conv_flt_to_s16p_6ch_sse2); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_FLT, 6, 16, 4, "SSE2", ff_conv_flt_to_fltp_6ch_sse2); } if (EXTERNAL_SSSE3(cpu_flags)) { ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16P, 6, 16, 4, "SSSE3", ff_conv_s16p_to_flt_6ch_ssse3); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLTP, 2, 16, 4, "SSSE3", ff_conv_fltp_to_s16_2ch_ssse3); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S16, 2, 16, 8, "SSSE3", ff_conv_s16_to_s16p_2ch_ssse3); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S16, 6, 16, 4, "SSSE3", ff_conv_s16_to_s16p_6ch_ssse3); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_S16, 6, 16, 4, "SSSE3", ff_conv_s16_to_fltp_6ch_ssse3); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_FLT, 6, 16, 4, "SSSE3", ff_conv_flt_to_s16p_6ch_ssse3); } if (EXTERNAL_SSE4(cpu_flags)) { ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16, 0, 16, 8, "SSE4", ff_conv_s16_to_flt_sse4); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP, 6, 16, 4, "SSE4", ff_conv_fltp_to_flt_6ch_sse4); } if (EXTERNAL_AVX(cpu_flags)) { ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S32, 0, 32, 16, "AVX", ff_conv_s32_to_flt_avx); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_FLT, 0, 32, 32, "AVX", ff_conv_flt_to_s32_avx); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16P, 2, 16, 16, "AVX", ff_conv_s16p_to_s16_2ch_avx); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16P, 6, 16, 8, "AVX", ff_conv_s16p_to_s16_6ch_avx); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16P, 2, 16, 8, "AVX", ff_conv_s16p_to_flt_2ch_avx); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16P, 6, 16, 4, "AVX", ff_conv_s16p_to_flt_6ch_avx); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLTP, 6, 16, 4, "AVX", ff_conv_fltp_to_s16_6ch_avx); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP, 6, 16, 4, "AVX", ff_conv_fltp_to_flt_6ch_avx); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S16, 2, 16, 8, "AVX", ff_conv_s16_to_s16p_2ch_avx); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S16, 6, 16, 4, "AVX", ff_conv_s16_to_s16p_6ch_avx); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_S16, 2, 16, 8, "AVX", ff_conv_s16_to_fltp_2ch_avx); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_S16, 6, 16, 4, "AVX", ff_conv_s16_to_fltp_6ch_avx); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_FLT, 2, 16, 8, "AVX", ff_conv_flt_to_s16p_2ch_avx); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_FLT, 6, 16, 4, "AVX", ff_conv_flt_to_s16p_6ch_avx); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_FLT, 2, 16, 4, "AVX", ff_conv_flt_to_fltp_2ch_avx); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_FLT, 6, 16, 4, "AVX", ff_conv_flt_to_fltp_6ch_avx); } }
{ "code": [], "line_no": [] }
av_cold void FUNC_0(AudioConvert *ac) { int VAR_0 = av_get_cpu_flags(); if (EXTERNAL_MMX(VAR_0)) { ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S32, 0, 1, 8, "MMX", ff_conv_s32_to_s16_mmx); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP, 6, 1, 4, "MMX", ff_conv_fltp_to_flt_6ch_mmx); } if (EXTERNAL_SSE(VAR_0)) { ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLTP, 6, 1, 2, "SSE", ff_conv_fltp_to_s16_6ch_sse); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP, 2, 16, 8, "SSE", ff_conv_fltp_to_flt_2ch_sse); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_FLT, 2, 16, 4, "SSE", ff_conv_flt_to_fltp_2ch_sse); } if (EXTERNAL_SSE2(VAR_0)) { if (!(VAR_0 & AV_CPU_FLAG_SSE2SLOW)) { ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S32, 0, 16, 16, "SSE2", ff_conv_s32_to_s16_sse2); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16P, 6, 16, 8, "SSE2", ff_conv_s16p_to_s16_6ch_sse2); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLTP, 6, 16, 4, "SSE2", ff_conv_fltp_to_s16_6ch_sse2); } else { ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16P, 6, 1, 4, "SSE2SLOW", ff_conv_s16p_to_s16_6ch_sse2slow); } ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S16, 0, 16, 8, "SSE2", ff_conv_s16_to_s32_sse2); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16, 0, 16, 8, "SSE2", ff_conv_s16_to_flt_sse2); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S32, 0, 16, 8, "SSE2", ff_conv_s32_to_flt_sse2); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLT, 0, 16, 16, "SSE2", ff_conv_flt_to_s16_sse2); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_FLT, 0, 16, 16, "SSE2", ff_conv_flt_to_s32_sse2); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16P, 2, 16, 16, "SSE2", ff_conv_s16p_to_s16_2ch_sse2); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16P, 2, 16, 8, "SSE2", ff_conv_s16p_to_flt_2ch_sse2); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16P, 6, 16, 4, "SSE2", ff_conv_s16p_to_flt_6ch_sse2); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLTP, 2, 16, 4, "SSE2", ff_conv_fltp_to_s16_2ch_sse2); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S16, 2, 16, 8, "SSE2", ff_conv_s16_to_s16p_2ch_sse2); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S16, 6, 16, 4, "SSE2", ff_conv_s16_to_s16p_6ch_sse2); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_S16, 2, 16, 8, "SSE2", ff_conv_s16_to_fltp_2ch_sse2); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_S16, 6, 16, 4, "SSE2", ff_conv_s16_to_fltp_6ch_sse2); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_FLT, 2, 16, 8, "SSE2", ff_conv_flt_to_s16p_2ch_sse2); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_FLT, 6, 16, 4, "SSE2", ff_conv_flt_to_s16p_6ch_sse2); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_FLT, 6, 16, 4, "SSE2", ff_conv_flt_to_fltp_6ch_sse2); } if (EXTERNAL_SSSE3(VAR_0)) { ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16P, 6, 16, 4, "SSSE3", ff_conv_s16p_to_flt_6ch_ssse3); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLTP, 2, 16, 4, "SSSE3", ff_conv_fltp_to_s16_2ch_ssse3); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S16, 2, 16, 8, "SSSE3", ff_conv_s16_to_s16p_2ch_ssse3); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S16, 6, 16, 4, "SSSE3", ff_conv_s16_to_s16p_6ch_ssse3); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_S16, 6, 16, 4, "SSSE3", ff_conv_s16_to_fltp_6ch_ssse3); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_FLT, 6, 16, 4, "SSSE3", ff_conv_flt_to_s16p_6ch_ssse3); } if (EXTERNAL_SSE4(VAR_0)) { ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16, 0, 16, 8, "SSE4", ff_conv_s16_to_flt_sse4); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP, 6, 16, 4, "SSE4", ff_conv_fltp_to_flt_6ch_sse4); } if (EXTERNAL_AVX(VAR_0)) { ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S32, 0, 32, 16, "AVX", ff_conv_s32_to_flt_avx); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_FLT, 0, 32, 32, "AVX", ff_conv_flt_to_s32_avx); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16P, 2, 16, 16, "AVX", ff_conv_s16p_to_s16_2ch_avx); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16P, 6, 16, 8, "AVX", ff_conv_s16p_to_s16_6ch_avx); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16P, 2, 16, 8, "AVX", ff_conv_s16p_to_flt_2ch_avx); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16P, 6, 16, 4, "AVX", ff_conv_s16p_to_flt_6ch_avx); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLTP, 6, 16, 4, "AVX", ff_conv_fltp_to_s16_6ch_avx); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP, 6, 16, 4, "AVX", ff_conv_fltp_to_flt_6ch_avx); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S16, 2, 16, 8, "AVX", ff_conv_s16_to_s16p_2ch_avx); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S16, 6, 16, 4, "AVX", ff_conv_s16_to_s16p_6ch_avx); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_S16, 2, 16, 8, "AVX", ff_conv_s16_to_fltp_2ch_avx); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_S16, 6, 16, 4, "AVX", ff_conv_s16_to_fltp_6ch_avx); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_FLT, 2, 16, 8, "AVX", ff_conv_flt_to_s16p_2ch_avx); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_FLT, 6, 16, 4, "AVX", ff_conv_flt_to_s16p_6ch_avx); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_FLT, 2, 16, 4, "AVX", ff_conv_flt_to_fltp_2ch_avx); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_FLT, 6, 16, 4, "AVX", ff_conv_flt_to_fltp_6ch_avx); } }
[ "av_cold void FUNC_0(AudioConvert *ac)\n{", "int VAR_0 = av_get_cpu_flags();", "if (EXTERNAL_MMX(VAR_0)) {", "ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S32,\n0, 1, 8, \"MMX\", ff_conv_s32_to_s16_mmx);", "ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP,\n6, 1, 4, \"MMX\", ff_conv_fltp_to_flt_6ch_mmx);", "}", "if (EXTERNAL_SSE(VAR_0)) {", "ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLTP,\n6, 1, 2, \"SSE\", ff_conv_fltp_to_s16_6ch_sse);", "ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP,\n2, 16, 8, \"SSE\", ff_conv_fltp_to_flt_2ch_sse);", "ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_FLT,\n2, 16, 4, \"SSE\", ff_conv_flt_to_fltp_2ch_sse);", "}", "if (EXTERNAL_SSE2(VAR_0)) {", "if (!(VAR_0 & AV_CPU_FLAG_SSE2SLOW)) {", "ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S32,\n0, 16, 16, \"SSE2\", ff_conv_s32_to_s16_sse2);", "ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16P,\n6, 16, 8, \"SSE2\", ff_conv_s16p_to_s16_6ch_sse2);", "ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLTP,\n6, 16, 4, \"SSE2\", ff_conv_fltp_to_s16_6ch_sse2);", "} else {", "ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16P,\n6, 1, 4, \"SSE2SLOW\", ff_conv_s16p_to_s16_6ch_sse2slow);", "}", "ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S16,\n0, 16, 8, \"SSE2\", ff_conv_s16_to_s32_sse2);", "ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16,\n0, 16, 8, \"SSE2\", ff_conv_s16_to_flt_sse2);", "ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S32,\n0, 16, 8, \"SSE2\", ff_conv_s32_to_flt_sse2);", "ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLT,\n0, 16, 16, \"SSE2\", ff_conv_flt_to_s16_sse2);", "ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_FLT,\n0, 16, 16, \"SSE2\", ff_conv_flt_to_s32_sse2);", "ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16P,\n2, 16, 16, \"SSE2\", ff_conv_s16p_to_s16_2ch_sse2);", "ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16P,\n2, 16, 8, \"SSE2\", ff_conv_s16p_to_flt_2ch_sse2);", "ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16P,\n6, 16, 4, \"SSE2\", ff_conv_s16p_to_flt_6ch_sse2);", "ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLTP,\n2, 16, 4, \"SSE2\", ff_conv_fltp_to_s16_2ch_sse2);", "ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S16,\n2, 16, 8, \"SSE2\", ff_conv_s16_to_s16p_2ch_sse2);", "ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S16,\n6, 16, 4, \"SSE2\", ff_conv_s16_to_s16p_6ch_sse2);", "ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_S16,\n2, 16, 8, \"SSE2\", ff_conv_s16_to_fltp_2ch_sse2);", "ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_S16,\n6, 16, 4, \"SSE2\", ff_conv_s16_to_fltp_6ch_sse2);", "ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_FLT,\n2, 16, 8, \"SSE2\", ff_conv_flt_to_s16p_2ch_sse2);", "ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_FLT,\n6, 16, 4, \"SSE2\", ff_conv_flt_to_s16p_6ch_sse2);", "ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_FLT,\n6, 16, 4, \"SSE2\", ff_conv_flt_to_fltp_6ch_sse2);", "}", "if (EXTERNAL_SSSE3(VAR_0)) {", "ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16P,\n6, 16, 4, \"SSSE3\", ff_conv_s16p_to_flt_6ch_ssse3);", "ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLTP,\n2, 16, 4, \"SSSE3\", ff_conv_fltp_to_s16_2ch_ssse3);", "ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S16,\n2, 16, 8, \"SSSE3\", ff_conv_s16_to_s16p_2ch_ssse3);", "ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S16,\n6, 16, 4, \"SSSE3\", ff_conv_s16_to_s16p_6ch_ssse3);", "ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_S16,\n6, 16, 4, \"SSSE3\", ff_conv_s16_to_fltp_6ch_ssse3);", "ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_FLT,\n6, 16, 4, \"SSSE3\", ff_conv_flt_to_s16p_6ch_ssse3);", "}", "if (EXTERNAL_SSE4(VAR_0)) {", "ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16,\n0, 16, 8, \"SSE4\", ff_conv_s16_to_flt_sse4);", "ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP,\n6, 16, 4, \"SSE4\", ff_conv_fltp_to_flt_6ch_sse4);", "}", "if (EXTERNAL_AVX(VAR_0)) {", "ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S32,\n0, 32, 16, \"AVX\", ff_conv_s32_to_flt_avx);", "ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_FLT,\n0, 32, 32, \"AVX\", ff_conv_flt_to_s32_avx);", "ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16P,\n2, 16, 16, \"AVX\", ff_conv_s16p_to_s16_2ch_avx);", "ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16P,\n6, 16, 8, \"AVX\", ff_conv_s16p_to_s16_6ch_avx);", "ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16P,\n2, 16, 8, \"AVX\", ff_conv_s16p_to_flt_2ch_avx);", "ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16P,\n6, 16, 4, \"AVX\", ff_conv_s16p_to_flt_6ch_avx);", "ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLTP,\n6, 16, 4, \"AVX\", ff_conv_fltp_to_s16_6ch_avx);", "ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP,\n6, 16, 4, \"AVX\", ff_conv_fltp_to_flt_6ch_avx);", "ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S16,\n2, 16, 8, \"AVX\", ff_conv_s16_to_s16p_2ch_avx);", "ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S16,\n6, 16, 4, \"AVX\", ff_conv_s16_to_s16p_6ch_avx);", "ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_S16,\n2, 16, 8, \"AVX\", ff_conv_s16_to_fltp_2ch_avx);", "ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_S16,\n6, 16, 4, \"AVX\", ff_conv_s16_to_fltp_6ch_avx);", "ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_FLT,\n2, 16, 8, \"AVX\", ff_conv_flt_to_s16p_2ch_avx);", "ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_FLT,\n6, 16, 4, \"AVX\", ff_conv_flt_to_s16p_6ch_avx);", "ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_FLT,\n2, 16, 4, \"AVX\", ff_conv_flt_to_fltp_2ch_avx);", "ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_FLT,\n6, 16, 4, \"AVX\", ff_conv_flt_to_fltp_6ch_avx);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11, 13 ], [ 15, 17 ], [ 19 ], [ 21 ], [ 23, 25 ], [ 27, 29 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41, 43 ], [ 45, 47 ], [ 49, 51 ], [ 53 ], [ 55, 57 ], [ 59 ], [ 61, 63 ], [ 65, 67 ], [ 69, 71 ], [ 73, 75 ], [ 77, 79 ], [ 81, 83 ], [ 85, 87 ], [ 89, 91 ], [ 93, 95 ], [ 97, 99 ], [ 101, 103 ], [ 105, 107 ], [ 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 ] ]
2,394
static void virtio_pci_config_write(void *opaque, hwaddr addr, uint64_t val, unsigned size) { VirtIOPCIProxy *proxy = opaque; uint32_t config = VIRTIO_PCI_CONFIG(&proxy->pci_dev); VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus); if (addr < config) { virtio_ioport_write(proxy, addr, val); return; } addr -= config; /* * Virtio-PCI is odd. Ioports are LE but config space is target native * endian. */ switch (size) { case 1: virtio_config_writeb(vdev, addr, val); break; case 2: if (virtio_is_big_endian()) { val = bswap16(val); } virtio_config_writew(vdev, addr, val); break; case 4: if (virtio_is_big_endian()) { val = bswap32(val); } virtio_config_writel(vdev, addr, val); break; } }
true
qemu
616a655219a92ae7cf5d6a7862e6489c6282009e
static void virtio_pci_config_write(void *opaque, hwaddr addr, uint64_t val, unsigned size) { VirtIOPCIProxy *proxy = opaque; uint32_t config = VIRTIO_PCI_CONFIG(&proxy->pci_dev); VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus); if (addr < config) { virtio_ioport_write(proxy, addr, val); return; } addr -= config; switch (size) { case 1: virtio_config_writeb(vdev, addr, val); break; case 2: if (virtio_is_big_endian()) { val = bswap16(val); } virtio_config_writew(vdev, addr, val); break; case 4: if (virtio_is_big_endian()) { val = bswap32(val); } virtio_config_writel(vdev, addr, val); break; } }
{ "code": [ " if (virtio_is_big_endian()) {", " if (virtio_is_big_endian()) {", " if (virtio_is_big_endian()) {", " if (virtio_is_big_endian()) {" ], "line_no": [ 41, 41, 41, 41 ] }
static void FUNC_0(void *VAR_0, hwaddr VAR_1, uint64_t VAR_2, unsigned VAR_3) { VirtIOPCIProxy *proxy = VAR_0; uint32_t config = VIRTIO_PCI_CONFIG(&proxy->pci_dev); VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus); if (VAR_1 < config) { virtio_ioport_write(proxy, VAR_1, VAR_2); return; } VAR_1 -= config; switch (VAR_3) { case 1: virtio_config_writeb(vdev, VAR_1, VAR_2); break; case 2: if (virtio_is_big_endian()) { VAR_2 = bswap16(VAR_2); } virtio_config_writew(vdev, VAR_1, VAR_2); break; case 4: if (virtio_is_big_endian()) { VAR_2 = bswap32(VAR_2); } virtio_config_writel(vdev, VAR_1, VAR_2); break; } }
[ "static void FUNC_0(void *VAR_0, hwaddr VAR_1,\nuint64_t VAR_2, unsigned VAR_3)\n{", "VirtIOPCIProxy *proxy = VAR_0;", "uint32_t config = VIRTIO_PCI_CONFIG(&proxy->pci_dev);", "VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus);", "if (VAR_1 < config) {", "virtio_ioport_write(proxy, VAR_1, VAR_2);", "return;", "}", "VAR_1 -= config;", "switch (VAR_3) {", "case 1:\nvirtio_config_writeb(vdev, VAR_1, VAR_2);", "break;", "case 2:\nif (virtio_is_big_endian()) {", "VAR_2 = bswap16(VAR_2);", "}", "virtio_config_writew(vdev, VAR_1, VAR_2);", "break;", "case 4:\nif (virtio_is_big_endian()) {", "VAR_2 = bswap32(VAR_2);", "}", "virtio_config_writel(vdev, VAR_1, VAR_2);", "break;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51, 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ] ]
2,396
void *qpci_iomap(QPCIDevice *dev, int barno, uint64_t *sizeptr) { QPCIBus *bus = dev->bus; static const int bar_reg_map[] = { PCI_BASE_ADDRESS_0, PCI_BASE_ADDRESS_1, PCI_BASE_ADDRESS_2, PCI_BASE_ADDRESS_3, PCI_BASE_ADDRESS_4, PCI_BASE_ADDRESS_5, }; int bar_reg; uint32_t addr, size; uint32_t io_type; uint64_t loc; g_assert(barno >= 0 && barno <= 5); bar_reg = bar_reg_map[barno]; qpci_config_writel(dev, bar_reg, 0xFFFFFFFF); addr = qpci_config_readl(dev, bar_reg); io_type = addr & PCI_BASE_ADDRESS_SPACE; if (io_type == PCI_BASE_ADDRESS_SPACE_IO) { addr &= PCI_BASE_ADDRESS_IO_MASK; } else { addr &= PCI_BASE_ADDRESS_MEM_MASK; } g_assert(addr); /* Must have *some* size bits */ size = 1U << ctz32(addr); if (sizeptr) { *sizeptr = size; } if (io_type == PCI_BASE_ADDRESS_SPACE_IO) { loc = QEMU_ALIGN_UP(bus->pio_alloc_ptr, size); g_assert(loc >= bus->pio_alloc_ptr); g_assert(loc + size <= QPCI_PIO_LIMIT); /* Keep PIO below 64kiB */ bus->pio_alloc_ptr = loc + size; qpci_config_writel(dev, bar_reg, loc | PCI_BASE_ADDRESS_SPACE_IO); } else { loc = QEMU_ALIGN_UP(bus->mmio_alloc_ptr, size); /* Check for space */ g_assert(loc >= bus->mmio_alloc_ptr); g_assert(loc + size <= bus->mmio_limit); bus->mmio_alloc_ptr = loc + size; qpci_config_writel(dev, bar_reg, loc); } return (void *)(uintptr_t)loc; }
true
qemu
b4ba67d9a702507793c2724e56f98e9b0f7be02b
void *qpci_iomap(QPCIDevice *dev, int barno, uint64_t *sizeptr) { QPCIBus *bus = dev->bus; static const int bar_reg_map[] = { PCI_BASE_ADDRESS_0, PCI_BASE_ADDRESS_1, PCI_BASE_ADDRESS_2, PCI_BASE_ADDRESS_3, PCI_BASE_ADDRESS_4, PCI_BASE_ADDRESS_5, }; int bar_reg; uint32_t addr, size; uint32_t io_type; uint64_t loc; g_assert(barno >= 0 && barno <= 5); bar_reg = bar_reg_map[barno]; qpci_config_writel(dev, bar_reg, 0xFFFFFFFF); addr = qpci_config_readl(dev, bar_reg); io_type = addr & PCI_BASE_ADDRESS_SPACE; if (io_type == PCI_BASE_ADDRESS_SPACE_IO) { addr &= PCI_BASE_ADDRESS_IO_MASK; } else { addr &= PCI_BASE_ADDRESS_MEM_MASK; } g_assert(addr); size = 1U << ctz32(addr); if (sizeptr) { *sizeptr = size; } if (io_type == PCI_BASE_ADDRESS_SPACE_IO) { loc = QEMU_ALIGN_UP(bus->pio_alloc_ptr, size); g_assert(loc >= bus->pio_alloc_ptr); g_assert(loc + size <= QPCI_PIO_LIMIT); bus->pio_alloc_ptr = loc + size; qpci_config_writel(dev, bar_reg, loc | PCI_BASE_ADDRESS_SPACE_IO); } else { loc = QEMU_ALIGN_UP(bus->mmio_alloc_ptr, size); g_assert(loc >= bus->mmio_alloc_ptr); g_assert(loc + size <= bus->mmio_limit); bus->mmio_alloc_ptr = loc + size; qpci_config_writel(dev, bar_reg, loc); } return (void *)(uintptr_t)loc; }
{ "code": [ "void *qpci_iomap(QPCIDevice *dev, int barno, uint64_t *sizeptr)", " return (void *)(uintptr_t)loc;" ], "line_no": [ 1, 107 ] }
void *FUNC_0(QPCIDevice *VAR_0, int VAR_1, uint64_t *VAR_2) { QPCIBus *bus = VAR_0->bus; static const int VAR_3[] = { PCI_BASE_ADDRESS_0, PCI_BASE_ADDRESS_1, PCI_BASE_ADDRESS_2, PCI_BASE_ADDRESS_3, PCI_BASE_ADDRESS_4, PCI_BASE_ADDRESS_5, }; int VAR_4; uint32_t addr, size; uint32_t io_type; uint64_t loc; g_assert(VAR_1 >= 0 && VAR_1 <= 5); VAR_4 = VAR_3[VAR_1]; qpci_config_writel(VAR_0, VAR_4, 0xFFFFFFFF); addr = qpci_config_readl(VAR_0, VAR_4); io_type = addr & PCI_BASE_ADDRESS_SPACE; if (io_type == PCI_BASE_ADDRESS_SPACE_IO) { addr &= PCI_BASE_ADDRESS_IO_MASK; } else { addr &= PCI_BASE_ADDRESS_MEM_MASK; } g_assert(addr); size = 1U << ctz32(addr); if (VAR_2) { *VAR_2 = size; } if (io_type == PCI_BASE_ADDRESS_SPACE_IO) { loc = QEMU_ALIGN_UP(bus->pio_alloc_ptr, size); g_assert(loc >= bus->pio_alloc_ptr); g_assert(loc + size <= QPCI_PIO_LIMIT); bus->pio_alloc_ptr = loc + size; qpci_config_writel(VAR_0, VAR_4, loc | PCI_BASE_ADDRESS_SPACE_IO); } else { loc = QEMU_ALIGN_UP(bus->mmio_alloc_ptr, size); g_assert(loc >= bus->mmio_alloc_ptr); g_assert(loc + size <= bus->mmio_limit); bus->mmio_alloc_ptr = loc + size; qpci_config_writel(VAR_0, VAR_4, loc); } return (void *)(uintptr_t)loc; }
[ "void *FUNC_0(QPCIDevice *VAR_0, int VAR_1, uint64_t *VAR_2)\n{", "QPCIBus *bus = VAR_0->bus;", "static const int VAR_3[] = {", "PCI_BASE_ADDRESS_0, PCI_BASE_ADDRESS_1, PCI_BASE_ADDRESS_2,\nPCI_BASE_ADDRESS_3, PCI_BASE_ADDRESS_4, PCI_BASE_ADDRESS_5,\n};", "int VAR_4;", "uint32_t addr, size;", "uint32_t io_type;", "uint64_t loc;", "g_assert(VAR_1 >= 0 && VAR_1 <= 5);", "VAR_4 = VAR_3[VAR_1];", "qpci_config_writel(VAR_0, VAR_4, 0xFFFFFFFF);", "addr = qpci_config_readl(VAR_0, VAR_4);", "io_type = addr & PCI_BASE_ADDRESS_SPACE;", "if (io_type == PCI_BASE_ADDRESS_SPACE_IO) {", "addr &= PCI_BASE_ADDRESS_IO_MASK;", "} else {", "addr &= PCI_BASE_ADDRESS_MEM_MASK;", "}", "g_assert(addr);", "size = 1U << ctz32(addr);", "if (VAR_2) {", "*VAR_2 = size;", "}", "if (io_type == PCI_BASE_ADDRESS_SPACE_IO) {", "loc = QEMU_ALIGN_UP(bus->pio_alloc_ptr, size);", "g_assert(loc >= bus->pio_alloc_ptr);", "g_assert(loc + size <= QPCI_PIO_LIMIT);", "bus->pio_alloc_ptr = loc + size;", "qpci_config_writel(VAR_0, VAR_4, loc | PCI_BASE_ADDRESS_SPACE_IO);", "} else {", "loc = QEMU_ALIGN_UP(bus->mmio_alloc_ptr, size);", "g_assert(loc >= bus->mmio_alloc_ptr);", "g_assert(loc + size <= bus->mmio_limit);", "bus->mmio_alloc_ptr = loc + size;", "qpci_config_writel(VAR_0, VAR_4, loc);", "}", "return (void *)(uintptr_t)loc;", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9, 11, 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 77 ], [ 81 ], [ 83 ], [ 85 ], [ 91 ], [ 93 ], [ 97 ], [ 101 ], [ 103 ], [ 107 ], [ 109 ] ]
2,397
int ff_jpegls_decode_picture(MJpegDecodeContext *s, int near, int point_transform, int ilv) { int i, t = 0; uint8_t *zero, *last, *cur; JLSState *state; int off = 0, stride = 1, width, shift, ret = 0; zero = av_mallocz(s->picture_ptr->linesize[0]); if (!zero) return AVERROR(ENOMEM); last = zero; cur = s->picture_ptr->data[0]; state = av_mallocz(sizeof(JLSState)); if (!state) { av_free(zero); return AVERROR(ENOMEM); /* initialize JPEG-LS state from JPEG parameters */ state->near = near; state->bpp = (s->bits < 2) ? 2 : s->bits; state->maxval = s->maxval; state->T1 = s->t1; state->T2 = s->t2; state->T3 = s->t3; state->reset = s->reset; ff_jpegls_reset_coding_parameters(state, 0); ff_jpegls_init_state(state); if (s->bits <= 8) shift = point_transform + (8 - s->bits); else shift = point_transform + (16 - s->bits); if (s->avctx->debug & FF_DEBUG_PICT_INFO) { av_log(s->avctx, AV_LOG_DEBUG, "JPEG-LS params: %ix%i NEAR=%i MV=%i T(%i,%i,%i) " "RESET=%i, LIMIT=%i, qbpp=%i, RANGE=%i\n", s->width, s->height, state->near, state->maxval, state->T1, state->T2, state->T3, state->reset, state->limit, state->qbpp, state->range); av_log(s->avctx, AV_LOG_DEBUG, "JPEG params: ILV=%i Pt=%i BPP=%i, scan = %i\n", ilv, point_transform, s->bits, s->cur_scan); if (ilv == 0) { /* separate planes */ if (s->cur_scan > s->nb_components) { stride = (s->nb_components > 1) ? 3 : 1; off = av_clip(s->cur_scan - 1, 0, stride - 1); width = s->width * stride; cur += off; for (i = 0; i < s->height; i++) { if (s->bits <= 8) { ls_decode_line(state, s, last, cur, t, width, stride, off, 8); t = last[0]; } else { ls_decode_line(state, s, last, cur, t, width, stride, off, 16); t = *((uint16_t *)last); last = cur; cur += s->picture_ptr->linesize[0]; if (s->restart_interval && !--s->restart_count) { align_get_bits(&s->gb); skip_bits(&s->gb, 16); /* skip RSTn */ } else if (ilv == 1) { /* line interleaving */ int j; int Rc[3] = { 0, 0, 0 }; stride = (s->nb_components > 1) ? 3 : 1; memset(cur, 0, s->picture_ptr->linesize[0]); width = s->width * stride; for (i = 0; i < s->height; i++) { for (j = 0; j < stride; j++) { ls_decode_line(state, s, last + j, cur + j, Rc[j], width, stride, j, 8); Rc[j] = last[j]; if (s->restart_interval && !--s->restart_count) { align_get_bits(&s->gb); skip_bits(&s->gb, 16); /* skip RSTn */ last = cur; cur += s->picture_ptr->linesize[0]; } else if (ilv == 2) { /* sample interleaving */ avpriv_report_missing_feature(s->avctx, "Sample interleaved images"); ret = AVERROR_PATCHWELCOME; if (s->xfrm && s->nb_components == 3) { int x, w; w = s->width * s->nb_components; if (s->bits <= 8) { uint8_t *src = s->picture_ptr->data[0]; for (i = 0; i < s->height; i++) { switch(s->xfrm) { case 1: for (x = off; x < w; x += 3) { src[x ] += src[x+1] + 128; src[x+2] += src[x+1] + 128; break; case 2: for (x = off; x < w; x += 3) { src[x ] += src[x+1] + 128; src[x+2] += ((src[x ] + src[x+1])>>1) + 128; break; case 3: for (x = off; x < w; x += 3) { int g = src[x+0] - ((src[x+2]+src[x+1])>>2) + 64; src[x+0] = src[x+2] + g + 128; src[x+2] = src[x+1] + g + 128; src[x+1] = g; break; case 4: for (x = off; x < w; x += 3) { int r = src[x+0] - (( 359 * (src[x+2]-128) + 490) >> 8); int g = src[x+0] - (( 88 * (src[x+1]-128) - 183 * (src[x+2]-128) + 30) >> 8); int b = src[x+0] + ((454 * (src[x+1]-128) + 574) >> 8); src[x+0] = av_clip_uint8(r); src[x+1] = av_clip_uint8(g); src[x+2] = av_clip_uint8(b); break; src += s->picture_ptr->linesize[0]; }else avpriv_report_missing_feature(s->avctx, "16bit xfrm"); if (shift) { /* we need to do point transform or normalize samples */ int x, w; w = s->width * s->nb_components; if (s->bits <= 8) { uint8_t *src = s->picture_ptr->data[0]; for (i = 0; i < s->height; i++) { for (x = off; x < w; x += stride) src[x] <<= shift; src += s->picture_ptr->linesize[0]; } else { uint16_t *src = (uint16_t *)s->picture_ptr->data[0]; for (i = 0; i < s->height; i++) { for (x = 0; x < w; x++) src[x] <<= shift; src += s->picture_ptr->linesize[0] / 2; end: av_free(state); av_free(zero); return ret;
true
FFmpeg
e98dfeb27c2a82673d7f1782705f6694ec9062ca
int ff_jpegls_decode_picture(MJpegDecodeContext *s, int near, int point_transform, int ilv) { int i, t = 0; uint8_t *zero, *last, *cur; JLSState *state; int off = 0, stride = 1, width, shift, ret = 0; zero = av_mallocz(s->picture_ptr->linesize[0]); if (!zero) return AVERROR(ENOMEM); last = zero; cur = s->picture_ptr->data[0]; state = av_mallocz(sizeof(JLSState)); if (!state) { av_free(zero); return AVERROR(ENOMEM); state->near = near; state->bpp = (s->bits < 2) ? 2 : s->bits; state->maxval = s->maxval; state->T1 = s->t1; state->T2 = s->t2; state->T3 = s->t3; state->reset = s->reset; ff_jpegls_reset_coding_parameters(state, 0); ff_jpegls_init_state(state); if (s->bits <= 8) shift = point_transform + (8 - s->bits); else shift = point_transform + (16 - s->bits); if (s->avctx->debug & FF_DEBUG_PICT_INFO) { av_log(s->avctx, AV_LOG_DEBUG, "JPEG-LS params: %ix%i NEAR=%i MV=%i T(%i,%i,%i) " "RESET=%i, LIMIT=%i, qbpp=%i, RANGE=%i\n", s->width, s->height, state->near, state->maxval, state->T1, state->T2, state->T3, state->reset, state->limit, state->qbpp, state->range); av_log(s->avctx, AV_LOG_DEBUG, "JPEG params: ILV=%i Pt=%i BPP=%i, scan = %i\n", ilv, point_transform, s->bits, s->cur_scan); if (ilv == 0) { if (s->cur_scan > s->nb_components) { stride = (s->nb_components > 1) ? 3 : 1; off = av_clip(s->cur_scan - 1, 0, stride - 1); width = s->width * stride; cur += off; for (i = 0; i < s->height; i++) { if (s->bits <= 8) { ls_decode_line(state, s, last, cur, t, width, stride, off, 8); t = last[0]; } else { ls_decode_line(state, s, last, cur, t, width, stride, off, 16); t = *((uint16_t *)last); last = cur; cur += s->picture_ptr->linesize[0]; if (s->restart_interval && !--s->restart_count) { align_get_bits(&s->gb); skip_bits(&s->gb, 16); } else if (ilv == 1) { int j; int Rc[3] = { 0, 0, 0 }; stride = (s->nb_components > 1) ? 3 : 1; memset(cur, 0, s->picture_ptr->linesize[0]); width = s->width * stride; for (i = 0; i < s->height; i++) { for (j = 0; j < stride; j++) { ls_decode_line(state, s, last + j, cur + j, Rc[j], width, stride, j, 8); Rc[j] = last[j]; if (s->restart_interval && !--s->restart_count) { align_get_bits(&s->gb); skip_bits(&s->gb, 16); last = cur; cur += s->picture_ptr->linesize[0]; } else if (ilv == 2) { avpriv_report_missing_feature(s->avctx, "Sample interleaved images"); ret = AVERROR_PATCHWELCOME; if (s->xfrm && s->nb_components == 3) { int x, w; w = s->width * s->nb_components; if (s->bits <= 8) { uint8_t *src = s->picture_ptr->data[0]; for (i = 0; i < s->height; i++) { switch(s->xfrm) { case 1: for (x = off; x < w; x += 3) { src[x ] += src[x+1] + 128; src[x+2] += src[x+1] + 128; break; case 2: for (x = off; x < w; x += 3) { src[x ] += src[x+1] + 128; src[x+2] += ((src[x ] + src[x+1])>>1) + 128; break; case 3: for (x = off; x < w; x += 3) { int g = src[x+0] - ((src[x+2]+src[x+1])>>2) + 64; src[x+0] = src[x+2] + g + 128; src[x+2] = src[x+1] + g + 128; src[x+1] = g; break; case 4: for (x = off; x < w; x += 3) { int r = src[x+0] - (( 359 * (src[x+2]-128) + 490) >> 8); int g = src[x+0] - (( 88 * (src[x+1]-128) - 183 * (src[x+2]-128) + 30) >> 8); int b = src[x+0] + ((454 * (src[x+1]-128) + 574) >> 8); src[x+0] = av_clip_uint8(r); src[x+1] = av_clip_uint8(g); src[x+2] = av_clip_uint8(b); break; src += s->picture_ptr->linesize[0]; }else avpriv_report_missing_feature(s->avctx, "16bit xfrm"); if (shift) { int x, w; w = s->width * s->nb_components; if (s->bits <= 8) { uint8_t *src = s->picture_ptr->data[0]; for (i = 0; i < s->height; i++) { for (x = off; x < w; x += stride) src[x] <<= shift; src += s->picture_ptr->linesize[0]; } else { uint16_t *src = (uint16_t *)s->picture_ptr->data[0]; for (i = 0; i < s->height; i++) { for (x = 0; x < w; x++) src[x] <<= shift; src += s->picture_ptr->linesize[0] / 2; end: av_free(state); av_free(zero); return ret;
{ "code": [], "line_no": [] }
int FUNC_0(MJpegDecodeContext *VAR_0, int VAR_1, int VAR_2, int VAR_3) { int VAR_4, VAR_5 = 0; uint8_t *zero, *last, *cur; JLSState *state; int VAR_6 = 0, VAR_7 = 1, VAR_8, VAR_9, VAR_10 = 0; zero = av_mallocz(VAR_0->picture_ptr->linesize[0]); if (!zero) return AVERROR(ENOMEM); last = zero; cur = VAR_0->picture_ptr->data[0]; state = av_mallocz(sizeof(JLSState)); if (!state) { av_free(zero); return AVERROR(ENOMEM); state->VAR_1 = VAR_1; state->bpp = (VAR_0->bits < 2) ? 2 : VAR_0->bits; state->maxval = VAR_0->maxval; state->T1 = VAR_0->t1; state->T2 = VAR_0->t2; state->T3 = VAR_0->t3; state->reset = VAR_0->reset; ff_jpegls_reset_coding_parameters(state, 0); ff_jpegls_init_state(state); if (VAR_0->bits <= 8) VAR_9 = VAR_2 + (8 - VAR_0->bits); else VAR_9 = VAR_2 + (16 - VAR_0->bits); if (VAR_0->avctx->debug & FF_DEBUG_PICT_INFO) { av_log(VAR_0->avctx, AV_LOG_DEBUG, "JPEG-LS params: %ix%VAR_4 NEAR=%VAR_4 MV=%VAR_4 T(%VAR_4,%VAR_4,%VAR_4) " "RESET=%VAR_4, LIMIT=%VAR_4, qbpp=%VAR_4, RANGE=%VAR_4\n", VAR_0->VAR_8, VAR_0->height, state->VAR_1, state->maxval, state->T1, state->T2, state->T3, state->reset, state->limit, state->qbpp, state->range); av_log(VAR_0->avctx, AV_LOG_DEBUG, "JPEG params: ILV=%VAR_4 Pt=%VAR_4 BPP=%VAR_4, scan = %VAR_4\n", VAR_3, VAR_2, VAR_0->bits, VAR_0->cur_scan); if (VAR_3 == 0) { if (VAR_0->cur_scan > VAR_0->nb_components) { VAR_7 = (VAR_0->nb_components > 1) ? 3 : 1; VAR_6 = av_clip(VAR_0->cur_scan - 1, 0, VAR_7 - 1); VAR_8 = VAR_0->VAR_8 * VAR_7; cur += VAR_6; for (VAR_4 = 0; VAR_4 < VAR_0->height; VAR_4++) { if (VAR_0->bits <= 8) { ls_decode_line(state, VAR_0, last, cur, VAR_5, VAR_8, VAR_7, VAR_6, 8); VAR_5 = last[0]; } else { ls_decode_line(state, VAR_0, last, cur, VAR_5, VAR_8, VAR_7, VAR_6, 16); VAR_5 = *((uint16_t *)last); last = cur; cur += VAR_0->picture_ptr->linesize[0]; if (VAR_0->restart_interval && !--VAR_0->restart_count) { align_get_bits(&VAR_0->gb); skip_bits(&VAR_0->gb, 16); } else if (VAR_3 == 1) { int j; int Rc[3] = { 0, 0, 0 }; VAR_7 = (VAR_0->nb_components > 1) ? 3 : 1; memset(cur, 0, VAR_0->picture_ptr->linesize[0]); VAR_8 = VAR_0->VAR_8 * VAR_7; for (VAR_4 = 0; VAR_4 < VAR_0->height; VAR_4++) { for (j = 0; j < VAR_7; j++) { ls_decode_line(state, VAR_0, last + j, cur + j, Rc[j], VAR_8, VAR_7, j, 8); Rc[j] = last[j]; if (VAR_0->restart_interval && !--VAR_0->restart_count) { align_get_bits(&VAR_0->gb); skip_bits(&VAR_0->gb, 16); last = cur; cur += VAR_0->picture_ptr->linesize[0]; } else if (VAR_3 == 2) { avpriv_report_missing_feature(VAR_0->avctx, "Sample interleaved images"); VAR_10 = AVERROR_PATCHWELCOME; if (VAR_0->xfrm && VAR_0->nb_components == 3) { int x, w; w = VAR_0->VAR_8 * VAR_0->nb_components; if (VAR_0->bits <= 8) { uint8_t *src = VAR_0->picture_ptr->data[0]; for (VAR_4 = 0; VAR_4 < VAR_0->height; VAR_4++) { switch(VAR_0->xfrm) { case 1: for (x = VAR_6; x < w; x += 3) { src[x ] += src[x+1] + 128; src[x+2] += src[x+1] + 128; break; case 2: for (x = VAR_6; x < w; x += 3) { src[x ] += src[x+1] + 128; src[x+2] += ((src[x ] + src[x+1])>>1) + 128; break; case 3: for (x = VAR_6; x < w; x += 3) { int g = src[x+0] - ((src[x+2]+src[x+1])>>2) + 64; src[x+0] = src[x+2] + g + 128; src[x+2] = src[x+1] + g + 128; src[x+1] = g; break; case 4: for (x = VAR_6; x < w; x += 3) { int r = src[x+0] - (( 359 * (src[x+2]-128) + 490) >> 8); int g = src[x+0] - (( 88 * (src[x+1]-128) - 183 * (src[x+2]-128) + 30) >> 8); int b = src[x+0] + ((454 * (src[x+1]-128) + 574) >> 8); src[x+0] = av_clip_uint8(r); src[x+1] = av_clip_uint8(g); src[x+2] = av_clip_uint8(b); break; src += VAR_0->picture_ptr->linesize[0]; }else avpriv_report_missing_feature(VAR_0->avctx, "16bit xfrm"); if (VAR_9) { int x, w; w = VAR_0->VAR_8 * VAR_0->nb_components; if (VAR_0->bits <= 8) { uint8_t *src = VAR_0->picture_ptr->data[0]; for (VAR_4 = 0; VAR_4 < VAR_0->height; VAR_4++) { for (x = VAR_6; x < w; x += VAR_7) src[x] <<= VAR_9; src += VAR_0->picture_ptr->linesize[0]; } else { uint16_t *src = (uint16_t *)VAR_0->picture_ptr->data[0]; for (VAR_4 = 0; VAR_4 < VAR_0->height; VAR_4++) { for (x = 0; x < w; x++) src[x] <<= VAR_9; src += VAR_0->picture_ptr->linesize[0] / 2; end: av_free(state); av_free(zero); return VAR_10;
[ "int FUNC_0(MJpegDecodeContext *VAR_0, int VAR_1,\nint VAR_2, int VAR_3)\n{", "int VAR_4, VAR_5 = 0;", "uint8_t *zero, *last, *cur;", "JLSState *state;", "int VAR_6 = 0, VAR_7 = 1, VAR_8, VAR_9, VAR_10 = 0;", "zero = av_mallocz(VAR_0->picture_ptr->linesize[0]);", "if (!zero)\nreturn AVERROR(ENOMEM);", "last = zero;", "cur = VAR_0->picture_ptr->data[0];", "state = av_mallocz(sizeof(JLSState));", "if (!state) {", "av_free(zero);", "return AVERROR(ENOMEM);", "state->VAR_1 = VAR_1;", "state->bpp = (VAR_0->bits < 2) ? 2 : VAR_0->bits;", "state->maxval = VAR_0->maxval;", "state->T1 = VAR_0->t1;", "state->T2 = VAR_0->t2;", "state->T3 = VAR_0->t3;", "state->reset = VAR_0->reset;", "ff_jpegls_reset_coding_parameters(state, 0);", "ff_jpegls_init_state(state);", "if (VAR_0->bits <= 8)\nVAR_9 = VAR_2 + (8 - VAR_0->bits);", "else\nVAR_9 = VAR_2 + (16 - VAR_0->bits);", "if (VAR_0->avctx->debug & FF_DEBUG_PICT_INFO) {", "av_log(VAR_0->avctx, AV_LOG_DEBUG,\n\"JPEG-LS params: %ix%VAR_4 NEAR=%VAR_4 MV=%VAR_4 T(%VAR_4,%VAR_4,%VAR_4) \"\n\"RESET=%VAR_4, LIMIT=%VAR_4, qbpp=%VAR_4, RANGE=%VAR_4\\n\",\nVAR_0->VAR_8, VAR_0->height, state->VAR_1, state->maxval,\nstate->T1, state->T2, state->T3,\nstate->reset, state->limit, state->qbpp, state->range);", "av_log(VAR_0->avctx, AV_LOG_DEBUG, \"JPEG params: ILV=%VAR_4 Pt=%VAR_4 BPP=%VAR_4, scan = %VAR_4\\n\",\nVAR_3, VAR_2, VAR_0->bits, VAR_0->cur_scan);", "if (VAR_3 == 0) {", "if (VAR_0->cur_scan > VAR_0->nb_components) {", "VAR_7 = (VAR_0->nb_components > 1) ? 3 : 1;", "VAR_6 = av_clip(VAR_0->cur_scan - 1, 0, VAR_7 - 1);", "VAR_8 = VAR_0->VAR_8 * VAR_7;", "cur += VAR_6;", "for (VAR_4 = 0; VAR_4 < VAR_0->height; VAR_4++) {", "if (VAR_0->bits <= 8) {", "ls_decode_line(state, VAR_0, last, cur, VAR_5, VAR_8, VAR_7, VAR_6, 8);", "VAR_5 = last[0];", "} else {", "ls_decode_line(state, VAR_0, last, cur, VAR_5, VAR_8, VAR_7, VAR_6, 16);", "VAR_5 = *((uint16_t *)last);", "last = cur;", "cur += VAR_0->picture_ptr->linesize[0];", "if (VAR_0->restart_interval && !--VAR_0->restart_count) {", "align_get_bits(&VAR_0->gb);", "skip_bits(&VAR_0->gb, 16);", "} else if (VAR_3 == 1) {", "int j;", "int Rc[3] = { 0, 0, 0 };", "VAR_7 = (VAR_0->nb_components > 1) ? 3 : 1;", "memset(cur, 0, VAR_0->picture_ptr->linesize[0]);", "VAR_8 = VAR_0->VAR_8 * VAR_7;", "for (VAR_4 = 0; VAR_4 < VAR_0->height; VAR_4++) {", "for (j = 0; j < VAR_7; j++) {", "ls_decode_line(state, VAR_0, last + j, cur + j,\nRc[j], VAR_8, VAR_7, j, 8);", "Rc[j] = last[j];", "if (VAR_0->restart_interval && !--VAR_0->restart_count) {", "align_get_bits(&VAR_0->gb);", "skip_bits(&VAR_0->gb, 16);", "last = cur;", "cur += VAR_0->picture_ptr->linesize[0];", "} else if (VAR_3 == 2) {", "avpriv_report_missing_feature(VAR_0->avctx, \"Sample interleaved images\");", "VAR_10 = AVERROR_PATCHWELCOME;", "if (VAR_0->xfrm && VAR_0->nb_components == 3) {", "int x, w;", "w = VAR_0->VAR_8 * VAR_0->nb_components;", "if (VAR_0->bits <= 8) {", "uint8_t *src = VAR_0->picture_ptr->data[0];", "for (VAR_4 = 0; VAR_4 < VAR_0->height; VAR_4++) {", "switch(VAR_0->xfrm) {", "case 1:\nfor (x = VAR_6; x < w; x += 3) {", "src[x ] += src[x+1] + 128;", "src[x+2] += src[x+1] + 128;", "break;", "case 2:\nfor (x = VAR_6; x < w; x += 3) {", "src[x ] += src[x+1] + 128;", "src[x+2] += ((src[x ] + src[x+1])>>1) + 128;", "break;", "case 3:\nfor (x = VAR_6; x < w; x += 3) {", "int g = src[x+0] - ((src[x+2]+src[x+1])>>2) + 64;", "src[x+0] = src[x+2] + g + 128;", "src[x+2] = src[x+1] + g + 128;", "src[x+1] = g;", "break;", "case 4:\nfor (x = VAR_6; x < w; x += 3) {", "int r = src[x+0] - (( 359 * (src[x+2]-128) + 490) >> 8);", "int g = src[x+0] - (( 88 * (src[x+1]-128) - 183 * (src[x+2]-128) + 30) >> 8);", "int b = src[x+0] + ((454 * (src[x+1]-128) + 574) >> 8);", "src[x+0] = av_clip_uint8(r);", "src[x+1] = av_clip_uint8(g);", "src[x+2] = av_clip_uint8(b);", "break;", "src += VAR_0->picture_ptr->linesize[0];", "}else", "avpriv_report_missing_feature(VAR_0->avctx, \"16bit xfrm\");", "if (VAR_9) {", "int x, w;", "w = VAR_0->VAR_8 * VAR_0->nb_components;", "if (VAR_0->bits <= 8) {", "uint8_t *src = VAR_0->picture_ptr->data[0];", "for (VAR_4 = 0; VAR_4 < VAR_0->height; VAR_4++) {", "for (x = VAR_6; x < w; x += VAR_7)", "src[x] <<= VAR_9;", "src += VAR_0->picture_ptr->linesize[0];", "} else {", "uint16_t *src = (uint16_t *)VAR_0->picture_ptr->data[0];", "for (VAR_4 = 0; VAR_4 < VAR_0->height; VAR_4++) {", "for (x = 0; x < w; x++)", "src[x] <<= VAR_9;", "src += VAR_0->picture_ptr->linesize[0] / 2;", "end:\nav_free(state);", "av_free(zero);", "return VAR_10;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2, 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ], [ 8 ], [ 9, 10 ], [ 11 ], [ 12 ], [ 13 ], [ 14 ], [ 15 ], [ 16 ], [ 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 ], [ 79 ], [ 80 ], [ 81 ], [ 82 ], [ 83 ], [ 84, 85 ], [ 86 ], [ 87 ], [ 88 ], [ 89, 90 ], [ 91 ], [ 92 ], [ 93 ], [ 94, 95 ], [ 96 ], [ 97 ], [ 98 ], [ 99 ], [ 100 ], [ 101, 102 ], [ 103 ], [ 104 ], [ 105 ], [ 106 ], [ 107 ], [ 108 ], [ 109 ], [ 110 ], [ 111 ], [ 112 ], [ 113 ], [ 114 ], [ 115 ], [ 116 ], [ 117 ], [ 118 ], [ 119 ], [ 120 ], [ 121 ], [ 122 ], [ 123 ], [ 124 ], [ 125 ], [ 126 ], [ 127 ], [ 128, 129 ], [ 130 ], [ 131 ] ]
2,398
void FUNCC(ff_h264_chroma_dc_dequant_idct)(int16_t *_block, int qmul){ const int stride= 16*2; const int xStride= 16; int a,b,c,d,e; dctcoef *block = (dctcoef*)_block; a= block[stride*0 + xStride*0]; b= block[stride*0 + xStride*1]; c= block[stride*1 + xStride*0]; d= block[stride*1 + xStride*1]; e= a-b; a= a+b; b= c-d; c= c+d; block[stride*0 + xStride*0]= ((a+c)*qmul) >> 7; block[stride*0 + xStride*1]= ((e+b)*qmul) >> 7; block[stride*1 + xStride*0]= ((a-c)*qmul) >> 7; block[stride*1 + xStride*1]= ((e-b)*qmul) >> 7; }
true
FFmpeg
2898bc522da6adebda5cbbd9036defe22e3b9bcf
void FUNCC(ff_h264_chroma_dc_dequant_idct)(int16_t *_block, int qmul){ const int stride= 16*2; const int xStride= 16; int a,b,c,d,e; dctcoef *block = (dctcoef*)_block; a= block[stride*0 + xStride*0]; b= block[stride*0 + xStride*1]; c= block[stride*1 + xStride*0]; d= block[stride*1 + xStride*1]; e= a-b; a= a+b; b= c-d; c= c+d; block[stride*0 + xStride*0]= ((a+c)*qmul) >> 7; block[stride*0 + xStride*1]= ((e+b)*qmul) >> 7; block[stride*1 + xStride*0]= ((a-c)*qmul) >> 7; block[stride*1 + xStride*1]= ((e-b)*qmul) >> 7; }
{ "code": [ " int a,b,c,d,e;", " block[stride*0 + xStride*0]= ((a+c)*qmul) >> 7;", " block[stride*0 + xStride*1]= ((e+b)*qmul) >> 7;", " block[stride*1 + xStride*0]= ((a-c)*qmul) >> 7;", " block[stride*1 + xStride*1]= ((e-b)*qmul) >> 7;" ], "line_no": [ 7, 33, 35, 37, 39 ] }
void FUNC_0(ff_h264_chroma_dc_dequant_idct)(int16_t *_block, int qmul){ const int VAR_0= 16*2; const int VAR_1= 16; int VAR_2,VAR_3,VAR_4,VAR_5,VAR_6; dctcoef *block = (dctcoef*)_block; VAR_2= block[VAR_0*0 + VAR_1*0]; VAR_3= block[VAR_0*0 + VAR_1*1]; VAR_4= block[VAR_0*1 + VAR_1*0]; VAR_5= block[VAR_0*1 + VAR_1*1]; VAR_6= VAR_2-VAR_3; VAR_2= VAR_2+VAR_3; VAR_3= VAR_4-VAR_5; VAR_4= VAR_4+VAR_5; block[VAR_0*0 + VAR_1*0]= ((VAR_2+VAR_4)*qmul) >> 7; block[VAR_0*0 + VAR_1*1]= ((VAR_6+VAR_3)*qmul) >> 7; block[VAR_0*1 + VAR_1*0]= ((VAR_2-VAR_4)*qmul) >> 7; block[VAR_0*1 + VAR_1*1]= ((VAR_6-VAR_3)*qmul) >> 7; }
[ "void FUNC_0(ff_h264_chroma_dc_dequant_idct)(int16_t *_block, int qmul){", "const int VAR_0= 16*2;", "const int VAR_1= 16;", "int VAR_2,VAR_3,VAR_4,VAR_5,VAR_6;", "dctcoef *block = (dctcoef*)_block;", "VAR_2= block[VAR_0*0 + VAR_1*0];", "VAR_3= block[VAR_0*0 + VAR_1*1];", "VAR_4= block[VAR_0*1 + VAR_1*0];", "VAR_5= block[VAR_0*1 + VAR_1*1];", "VAR_6= VAR_2-VAR_3;", "VAR_2= VAR_2+VAR_3;", "VAR_3= VAR_4-VAR_5;", "VAR_4= VAR_4+VAR_5;", "block[VAR_0*0 + VAR_1*0]= ((VAR_2+VAR_4)*qmul) >> 7;", "block[VAR_0*0 + VAR_1*1]= ((VAR_6+VAR_3)*qmul) >> 7;", "block[VAR_0*1 + VAR_1*0]= ((VAR_2-VAR_4)*qmul) >> 7;", "block[VAR_0*1 + VAR_1*1]= ((VAR_6-VAR_3)*qmul) >> 7;", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ] ]
2,401
static inline int mpeg2_decode_block_intra(MpegEncContext *s, int16_t *block, int n) { int level, dc, diff, i, j, run; int component; RLTable *rl; uint8_t *const scantable = s->intra_scantable.permutated; const uint16_t *quant_matrix; const int qscale = s->qscale; int mismatch; /* DC coefficient */ if (n < 4) { quant_matrix = s->intra_matrix; component = 0; } else { quant_matrix = s->chroma_intra_matrix; component = (n & 1) + 1; } diff = decode_dc(&s->gb, component); if (diff >= 0xffff) return AVERROR_INVALIDDATA; dc = s->last_dc[component]; dc += diff; s->last_dc[component] = dc; block[0] = dc << (3 - s->intra_dc_precision); ff_tlog(s->avctx, "dc=%d\n", block[0]); mismatch = block[0] ^ 1; i = 0; if (s->intra_vlc_format) rl = &ff_rl_mpeg2; else rl = &ff_rl_mpeg1; { OPEN_READER(re, &s->gb); /* now quantify & encode AC coefficients */ for (;;) { UPDATE_CACHE(re, &s->gb); GET_RL_VLC(level, run, re, &s->gb, rl->rl_vlc[0], TEX_VLC_BITS, 2, 0); if (level == 127) { break; } else if (level != 0) { i += run; if (i > MAX_INDEX) break; j = scantable[i]; level = (level * qscale * quant_matrix[j]) >> 4; level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1); LAST_SKIP_BITS(re, &s->gb, 1); } else { /* escape */ run = SHOW_UBITS(re, &s->gb, 6) + 1; LAST_SKIP_BITS(re, &s->gb, 6); UPDATE_CACHE(re, &s->gb); level = SHOW_SBITS(re, &s->gb, 12); SKIP_BITS(re, &s->gb, 12); i += run; if (i > MAX_INDEX) break; j = scantable[i]; if (level < 0) { level = (-level * qscale * quant_matrix[j]) >> 4; level = -level; } else { level = (level * qscale * quant_matrix[j]) >> 4; } } mismatch ^= level; block[j] = level; } CLOSE_READER(re, &s->gb); } block[63] ^= mismatch & 1; check_scantable_index(s, i); s->block_last_index[n] = i; return 0; }
true
FFmpeg
d757ddbaab8f03b3664788e620314b70ac791319
static inline int mpeg2_decode_block_intra(MpegEncContext *s, int16_t *block, int n) { int level, dc, diff, i, j, run; int component; RLTable *rl; uint8_t *const scantable = s->intra_scantable.permutated; const uint16_t *quant_matrix; const int qscale = s->qscale; int mismatch; if (n < 4) { quant_matrix = s->intra_matrix; component = 0; } else { quant_matrix = s->chroma_intra_matrix; component = (n & 1) + 1; } diff = decode_dc(&s->gb, component); if (diff >= 0xffff) return AVERROR_INVALIDDATA; dc = s->last_dc[component]; dc += diff; s->last_dc[component] = dc; block[0] = dc << (3 - s->intra_dc_precision); ff_tlog(s->avctx, "dc=%d\n", block[0]); mismatch = block[0] ^ 1; i = 0; if (s->intra_vlc_format) rl = &ff_rl_mpeg2; else rl = &ff_rl_mpeg1; { OPEN_READER(re, &s->gb); for (;;) { UPDATE_CACHE(re, &s->gb); GET_RL_VLC(level, run, re, &s->gb, rl->rl_vlc[0], TEX_VLC_BITS, 2, 0); if (level == 127) { break; } else if (level != 0) { i += run; if (i > MAX_INDEX) break; j = scantable[i]; level = (level * qscale * quant_matrix[j]) >> 4; level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1); LAST_SKIP_BITS(re, &s->gb, 1); } else { run = SHOW_UBITS(re, &s->gb, 6) + 1; LAST_SKIP_BITS(re, &s->gb, 6); UPDATE_CACHE(re, &s->gb); level = SHOW_SBITS(re, &s->gb, 12); SKIP_BITS(re, &s->gb, 12); i += run; if (i > MAX_INDEX) break; j = scantable[i]; if (level < 0) { level = (-level * qscale * quant_matrix[j]) >> 4; level = -level; } else { level = (level * qscale * quant_matrix[j]) >> 4; } } mismatch ^= level; block[j] = level; } CLOSE_READER(re, &s->gb); } block[63] ^= mismatch & 1; check_scantable_index(s, i); s->block_last_index[n] = i; return 0; }
{ "code": [ " block[0] = dc << (3 - s->intra_dc_precision);" ], "line_no": [ 51 ] }
static inline int FUNC_0(MpegEncContext *VAR_0, int16_t *VAR_1, int VAR_2) { int VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8; int VAR_9; RLTable *rl; uint8_t *const scantable = VAR_0->intra_scantable.permutated; const uint16_t *VAR_10; const int VAR_11 = VAR_0->VAR_11; int VAR_12; if (VAR_2 < 4) { VAR_10 = VAR_0->intra_matrix; VAR_9 = 0; } else { VAR_10 = VAR_0->chroma_intra_matrix; VAR_9 = (VAR_2 & 1) + 1; } VAR_5 = decode_dc(&VAR_0->gb, VAR_9); if (VAR_5 >= 0xffff) return AVERROR_INVALIDDATA; VAR_4 = VAR_0->last_dc[VAR_9]; VAR_4 += VAR_5; VAR_0->last_dc[VAR_9] = VAR_4; VAR_1[0] = VAR_4 << (3 - VAR_0->intra_dc_precision); ff_tlog(VAR_0->avctx, "VAR_4=%d\VAR_2", VAR_1[0]); VAR_12 = VAR_1[0] ^ 1; VAR_6 = 0; if (VAR_0->intra_vlc_format) rl = &ff_rl_mpeg2; else rl = &ff_rl_mpeg1; { OPEN_READER(re, &VAR_0->gb); for (;;) { UPDATE_CACHE(re, &VAR_0->gb); GET_RL_VLC(VAR_3, VAR_8, re, &VAR_0->gb, rl->rl_vlc[0], TEX_VLC_BITS, 2, 0); if (VAR_3 == 127) { break; } else if (VAR_3 != 0) { VAR_6 += VAR_8; if (VAR_6 > MAX_INDEX) break; VAR_7 = scantable[VAR_6]; VAR_3 = (VAR_3 * VAR_11 * VAR_10[VAR_7]) >> 4; VAR_3 = (VAR_3 ^ SHOW_SBITS(re, &VAR_0->gb, 1)) - SHOW_SBITS(re, &VAR_0->gb, 1); LAST_SKIP_BITS(re, &VAR_0->gb, 1); } else { VAR_8 = SHOW_UBITS(re, &VAR_0->gb, 6) + 1; LAST_SKIP_BITS(re, &VAR_0->gb, 6); UPDATE_CACHE(re, &VAR_0->gb); VAR_3 = SHOW_SBITS(re, &VAR_0->gb, 12); SKIP_BITS(re, &VAR_0->gb, 12); VAR_6 += VAR_8; if (VAR_6 > MAX_INDEX) break; VAR_7 = scantable[VAR_6]; if (VAR_3 < 0) { VAR_3 = (-VAR_3 * VAR_11 * VAR_10[VAR_7]) >> 4; VAR_3 = -VAR_3; } else { VAR_3 = (VAR_3 * VAR_11 * VAR_10[VAR_7]) >> 4; } } VAR_12 ^= VAR_3; VAR_1[VAR_7] = VAR_3; } CLOSE_READER(re, &VAR_0->gb); } VAR_1[63] ^= VAR_12 & 1; check_scantable_index(VAR_0, VAR_6); VAR_0->block_last_index[VAR_2] = VAR_6; return 0; }
[ "static inline int FUNC_0(MpegEncContext *VAR_0,\nint16_t *VAR_1, int VAR_2)\n{", "int VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8;", "int VAR_9;", "RLTable *rl;", "uint8_t *const scantable = VAR_0->intra_scantable.permutated;", "const uint16_t *VAR_10;", "const int VAR_11 = VAR_0->VAR_11;", "int VAR_12;", "if (VAR_2 < 4) {", "VAR_10 = VAR_0->intra_matrix;", "VAR_9 = 0;", "} else {", "VAR_10 = VAR_0->chroma_intra_matrix;", "VAR_9 = (VAR_2 & 1) + 1;", "}", "VAR_5 = decode_dc(&VAR_0->gb, VAR_9);", "if (VAR_5 >= 0xffff)\nreturn AVERROR_INVALIDDATA;", "VAR_4 = VAR_0->last_dc[VAR_9];", "VAR_4 += VAR_5;", "VAR_0->last_dc[VAR_9] = VAR_4;", "VAR_1[0] = VAR_4 << (3 - VAR_0->intra_dc_precision);", "ff_tlog(VAR_0->avctx, \"VAR_4=%d\\VAR_2\", VAR_1[0]);", "VAR_12 = VAR_1[0] ^ 1;", "VAR_6 = 0;", "if (VAR_0->intra_vlc_format)\nrl = &ff_rl_mpeg2;", "else\nrl = &ff_rl_mpeg1;", "{", "OPEN_READER(re, &VAR_0->gb);", "for (;;) {", "UPDATE_CACHE(re, &VAR_0->gb);", "GET_RL_VLC(VAR_3, VAR_8, re, &VAR_0->gb, rl->rl_vlc[0],\nTEX_VLC_BITS, 2, 0);", "if (VAR_3 == 127) {", "break;", "} else if (VAR_3 != 0) {", "VAR_6 += VAR_8;", "if (VAR_6 > MAX_INDEX)\nbreak;", "VAR_7 = scantable[VAR_6];", "VAR_3 = (VAR_3 * VAR_11 * VAR_10[VAR_7]) >> 4;", "VAR_3 = (VAR_3 ^ SHOW_SBITS(re, &VAR_0->gb, 1)) -\nSHOW_SBITS(re, &VAR_0->gb, 1);", "LAST_SKIP_BITS(re, &VAR_0->gb, 1);", "} else {", "VAR_8 = SHOW_UBITS(re, &VAR_0->gb, 6) + 1;", "LAST_SKIP_BITS(re, &VAR_0->gb, 6);", "UPDATE_CACHE(re, &VAR_0->gb);", "VAR_3 = SHOW_SBITS(re, &VAR_0->gb, 12);", "SKIP_BITS(re, &VAR_0->gb, 12);", "VAR_6 += VAR_8;", "if (VAR_6 > MAX_INDEX)\nbreak;", "VAR_7 = scantable[VAR_6];", "if (VAR_3 < 0) {", "VAR_3 = (-VAR_3 * VAR_11 * VAR_10[VAR_7]) >> 4;", "VAR_3 = -VAR_3;", "} else {", "VAR_3 = (VAR_3 * VAR_11 * VAR_10[VAR_7]) >> 4;", "}", "}", "VAR_12 ^= VAR_3;", "VAR_1[VAR_7] = VAR_3;", "}", "CLOSE_READER(re, &VAR_0->gb);", "}", "VAR_1[63] ^= VAR_12 & 1;", "check_scantable_index(VAR_0, VAR_6);", "VAR_0->block_last_index[VAR_2] = VAR_6;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41, 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59, 61 ], [ 63, 65 ], [ 69 ], [ 71 ], [ 75 ], [ 77 ], [ 79, 81 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93, 95 ], [ 97 ], [ 99 ], [ 101, 103 ], [ 105 ], [ 107 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123, 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 159 ], [ 163 ], [ 165 ], [ 167 ] ]
2,402
static void vc1_draw_sprites(VC1Context *v, SpriteData* sd) { int i, plane, row, sprite; int sr_cache[2][2] = { { -1, -1 }, { -1, -1 } }; uint8_t* src_h[2][2]; int xoff[2], xadv[2], yoff[2], yadv[2], alpha; int ysub[2]; MpegEncContext *s = &v->s; for (i = 0; i < 2; i++) { xoff[i] = av_clip(sd->coefs[i][2], 0, v->sprite_width-1 << 16); xadv[i] = sd->coefs[i][0]; if (xadv[i] != 1<<16 || (v->sprite_width << 16) - (v->output_width << 16) - xoff[i]) xadv[i] = av_clip(xadv[i], 0, ((v->sprite_width<<16) - xoff[i] - 1) / v->output_width); yoff[i] = av_clip(sd->coefs[i][5], 0, v->sprite_height-1 << 16); yadv[i] = av_clip(sd->coefs[i][4], 0, ((v->sprite_height << 16) - yoff[i]) / v->output_height); } alpha = av_clip(sd->coefs[1][6], 0, (1<<16) - 1); for (plane = 0; plane < (s->flags&CODEC_FLAG_GRAY ? 1 : 3); plane++) { int width = v->output_width>>!!plane; for (row = 0; row < v->output_height>>!!plane; row++) { uint8_t *dst = v->sprite_output_frame.data[plane] + v->sprite_output_frame.linesize[plane] * row; for (sprite = 0; sprite <= v->two_sprites; sprite++) { uint8_t *iplane = s->current_picture.f.data[plane]; int iline = s->current_picture.f.linesize[plane]; int ycoord = yoff[sprite] + yadv[sprite] * row; int yline = ycoord >> 16; ysub[sprite] = ycoord & 0xFFFF; if (sprite) { iplane = s->last_picture.f.data[plane]; iline = s->last_picture.f.linesize[plane]; } if (!(xoff[sprite] & 0xFFFF) && xadv[sprite] == 1 << 16) { src_h[sprite][0] = iplane + (xoff[sprite] >> 16) + yline * iline; if (ysub[sprite]) src_h[sprite][1] = iplane + (xoff[sprite] >> 16) + (yline + 1) * iline; } else { if (sr_cache[sprite][0] != yline) { if (sr_cache[sprite][1] == yline) { FFSWAP(uint8_t*, v->sr_rows[sprite][0], v->sr_rows[sprite][1]); FFSWAP(int, sr_cache[sprite][0], sr_cache[sprite][1]); } else { v->vc1dsp.sprite_h(v->sr_rows[sprite][0], iplane + yline * iline, xoff[sprite], xadv[sprite], width); sr_cache[sprite][0] = yline; } } if (ysub[sprite] && sr_cache[sprite][1] != yline + 1) { v->vc1dsp.sprite_h(v->sr_rows[sprite][1], iplane + (yline + 1) * iline, xoff[sprite], xadv[sprite], width); sr_cache[sprite][1] = yline + 1; } src_h[sprite][0] = v->sr_rows[sprite][0]; src_h[sprite][1] = v->sr_rows[sprite][1]; } } if (!v->two_sprites) { if (ysub[0]) { v->vc1dsp.sprite_v_single(dst, src_h[0][0], src_h[0][1], ysub[0], width); } else { memcpy(dst, src_h[0][0], width); } } else { if (ysub[0] && ysub[1]) { v->vc1dsp.sprite_v_double_twoscale(dst, src_h[0][0], src_h[0][1], ysub[0], src_h[1][0], src_h[1][1], ysub[1], alpha, width); } else if (ysub[0]) { v->vc1dsp.sprite_v_double_onescale(dst, src_h[0][0], src_h[0][1], ysub[0], src_h[1][0], alpha, width); } else if (ysub[1]) { v->vc1dsp.sprite_v_double_onescale(dst, src_h[1][0], src_h[1][1], ysub[1], src_h[0][0], (1<<16)-1-alpha, width); } else { v->vc1dsp.sprite_v_double_noscale(dst, src_h[0][0], src_h[1][0], alpha, width); } } } if (!plane) { for (i = 0; i < 2; i++) { xoff[i] >>= 1; yoff[i] >>= 1; } } } }
true
FFmpeg
2bf369b60c7d56dd73887a0156c37676d0fa7e29
static void vc1_draw_sprites(VC1Context *v, SpriteData* sd) { int i, plane, row, sprite; int sr_cache[2][2] = { { -1, -1 }, { -1, -1 } }; uint8_t* src_h[2][2]; int xoff[2], xadv[2], yoff[2], yadv[2], alpha; int ysub[2]; MpegEncContext *s = &v->s; for (i = 0; i < 2; i++) { xoff[i] = av_clip(sd->coefs[i][2], 0, v->sprite_width-1 << 16); xadv[i] = sd->coefs[i][0]; if (xadv[i] != 1<<16 || (v->sprite_width << 16) - (v->output_width << 16) - xoff[i]) xadv[i] = av_clip(xadv[i], 0, ((v->sprite_width<<16) - xoff[i] - 1) / v->output_width); yoff[i] = av_clip(sd->coefs[i][5], 0, v->sprite_height-1 << 16); yadv[i] = av_clip(sd->coefs[i][4], 0, ((v->sprite_height << 16) - yoff[i]) / v->output_height); } alpha = av_clip(sd->coefs[1][6], 0, (1<<16) - 1); for (plane = 0; plane < (s->flags&CODEC_FLAG_GRAY ? 1 : 3); plane++) { int width = v->output_width>>!!plane; for (row = 0; row < v->output_height>>!!plane; row++) { uint8_t *dst = v->sprite_output_frame.data[plane] + v->sprite_output_frame.linesize[plane] * row; for (sprite = 0; sprite <= v->two_sprites; sprite++) { uint8_t *iplane = s->current_picture.f.data[plane]; int iline = s->current_picture.f.linesize[plane]; int ycoord = yoff[sprite] + yadv[sprite] * row; int yline = ycoord >> 16; ysub[sprite] = ycoord & 0xFFFF; if (sprite) { iplane = s->last_picture.f.data[plane]; iline = s->last_picture.f.linesize[plane]; } if (!(xoff[sprite] & 0xFFFF) && xadv[sprite] == 1 << 16) { src_h[sprite][0] = iplane + (xoff[sprite] >> 16) + yline * iline; if (ysub[sprite]) src_h[sprite][1] = iplane + (xoff[sprite] >> 16) + (yline + 1) * iline; } else { if (sr_cache[sprite][0] != yline) { if (sr_cache[sprite][1] == yline) { FFSWAP(uint8_t*, v->sr_rows[sprite][0], v->sr_rows[sprite][1]); FFSWAP(int, sr_cache[sprite][0], sr_cache[sprite][1]); } else { v->vc1dsp.sprite_h(v->sr_rows[sprite][0], iplane + yline * iline, xoff[sprite], xadv[sprite], width); sr_cache[sprite][0] = yline; } } if (ysub[sprite] && sr_cache[sprite][1] != yline + 1) { v->vc1dsp.sprite_h(v->sr_rows[sprite][1], iplane + (yline + 1) * iline, xoff[sprite], xadv[sprite], width); sr_cache[sprite][1] = yline + 1; } src_h[sprite][0] = v->sr_rows[sprite][0]; src_h[sprite][1] = v->sr_rows[sprite][1]; } } if (!v->two_sprites) { if (ysub[0]) { v->vc1dsp.sprite_v_single(dst, src_h[0][0], src_h[0][1], ysub[0], width); } else { memcpy(dst, src_h[0][0], width); } } else { if (ysub[0] && ysub[1]) { v->vc1dsp.sprite_v_double_twoscale(dst, src_h[0][0], src_h[0][1], ysub[0], src_h[1][0], src_h[1][1], ysub[1], alpha, width); } else if (ysub[0]) { v->vc1dsp.sprite_v_double_onescale(dst, src_h[0][0], src_h[0][1], ysub[0], src_h[1][0], alpha, width); } else if (ysub[1]) { v->vc1dsp.sprite_v_double_onescale(dst, src_h[1][0], src_h[1][1], ysub[1], src_h[0][0], (1<<16)-1-alpha, width); } else { v->vc1dsp.sprite_v_double_noscale(dst, src_h[0][0], src_h[1][0], alpha, width); } } } if (!plane) { for (i = 0; i < 2; i++) { xoff[i] >>= 1; yoff[i] >>= 1; } } } }
{ "code": [ " src_h[sprite][1] = iplane + (xoff[sprite] >> 16) + (yline + 1) * iline;", " v->vc1dsp.sprite_h(v->sr_rows[sprite][1], iplane + (yline + 1) * iline, xoff[sprite], xadv[sprite], width);" ], "line_no": [ 81, 105 ] }
static void FUNC_0(VC1Context *VAR_0, SpriteData* VAR_1) { int VAR_2, VAR_3, VAR_4, VAR_5; int VAR_6[2][2] = { { -1, -1 }, { -1, -1 } }; uint8_t* src_h[2][2]; int VAR_7[2], VAR_8[2], VAR_9[2], VAR_10[2], VAR_11; int VAR_12[2]; MpegEncContext *s = &VAR_0->s; for (VAR_2 = 0; VAR_2 < 2; VAR_2++) { VAR_7[VAR_2] = av_clip(VAR_1->coefs[VAR_2][2], 0, VAR_0->sprite_width-1 << 16); VAR_8[VAR_2] = VAR_1->coefs[VAR_2][0]; if (VAR_8[VAR_2] != 1<<16 || (VAR_0->sprite_width << 16) - (VAR_0->output_width << 16) - VAR_7[VAR_2]) VAR_8[VAR_2] = av_clip(VAR_8[VAR_2], 0, ((VAR_0->sprite_width<<16) - VAR_7[VAR_2] - 1) / VAR_0->output_width); VAR_9[VAR_2] = av_clip(VAR_1->coefs[VAR_2][5], 0, VAR_0->sprite_height-1 << 16); VAR_10[VAR_2] = av_clip(VAR_1->coefs[VAR_2][4], 0, ((VAR_0->sprite_height << 16) - VAR_9[VAR_2]) / VAR_0->output_height); } VAR_11 = av_clip(VAR_1->coefs[1][6], 0, (1<<16) - 1); for (VAR_3 = 0; VAR_3 < (s->flags&CODEC_FLAG_GRAY ? 1 : 3); VAR_3++) { int width = VAR_0->output_width>>!!VAR_3; for (VAR_4 = 0; VAR_4 < VAR_0->output_height>>!!VAR_3; VAR_4++) { uint8_t *dst = VAR_0->sprite_output_frame.data[VAR_3] + VAR_0->sprite_output_frame.linesize[VAR_3] * VAR_4; for (VAR_5 = 0; VAR_5 <= VAR_0->two_sprites; VAR_5++) { uint8_t *iplane = s->current_picture.f.data[VAR_3]; int iline = s->current_picture.f.linesize[VAR_3]; int ycoord = VAR_9[VAR_5] + VAR_10[VAR_5] * VAR_4; int yline = ycoord >> 16; VAR_12[VAR_5] = ycoord & 0xFFFF; if (VAR_5) { iplane = s->last_picture.f.data[VAR_3]; iline = s->last_picture.f.linesize[VAR_3]; } if (!(VAR_7[VAR_5] & 0xFFFF) && VAR_8[VAR_5] == 1 << 16) { src_h[VAR_5][0] = iplane + (VAR_7[VAR_5] >> 16) + yline * iline; if (VAR_12[VAR_5]) src_h[VAR_5][1] = iplane + (VAR_7[VAR_5] >> 16) + (yline + 1) * iline; } else { if (VAR_6[VAR_5][0] != yline) { if (VAR_6[VAR_5][1] == yline) { FFSWAP(uint8_t*, VAR_0->sr_rows[VAR_5][0], VAR_0->sr_rows[VAR_5][1]); FFSWAP(int, VAR_6[VAR_5][0], VAR_6[VAR_5][1]); } else { VAR_0->vc1dsp.sprite_h(VAR_0->sr_rows[VAR_5][0], iplane + yline * iline, VAR_7[VAR_5], VAR_8[VAR_5], width); VAR_6[VAR_5][0] = yline; } } if (VAR_12[VAR_5] && VAR_6[VAR_5][1] != yline + 1) { VAR_0->vc1dsp.sprite_h(VAR_0->sr_rows[VAR_5][1], iplane + (yline + 1) * iline, VAR_7[VAR_5], VAR_8[VAR_5], width); VAR_6[VAR_5][1] = yline + 1; } src_h[VAR_5][0] = VAR_0->sr_rows[VAR_5][0]; src_h[VAR_5][1] = VAR_0->sr_rows[VAR_5][1]; } } if (!VAR_0->two_sprites) { if (VAR_12[0]) { VAR_0->vc1dsp.sprite_v_single(dst, src_h[0][0], src_h[0][1], VAR_12[0], width); } else { memcpy(dst, src_h[0][0], width); } } else { if (VAR_12[0] && VAR_12[1]) { VAR_0->vc1dsp.sprite_v_double_twoscale(dst, src_h[0][0], src_h[0][1], VAR_12[0], src_h[1][0], src_h[1][1], VAR_12[1], VAR_11, width); } else if (VAR_12[0]) { VAR_0->vc1dsp.sprite_v_double_onescale(dst, src_h[0][0], src_h[0][1], VAR_12[0], src_h[1][0], VAR_11, width); } else if (VAR_12[1]) { VAR_0->vc1dsp.sprite_v_double_onescale(dst, src_h[1][0], src_h[1][1], VAR_12[1], src_h[0][0], (1<<16)-1-VAR_11, width); } else { VAR_0->vc1dsp.sprite_v_double_noscale(dst, src_h[0][0], src_h[1][0], VAR_11, width); } } } if (!VAR_3) { for (VAR_2 = 0; VAR_2 < 2; VAR_2++) { VAR_7[VAR_2] >>= 1; VAR_9[VAR_2] >>= 1; } } } }
[ "static void FUNC_0(VC1Context *VAR_0, SpriteData* VAR_1)\n{", "int VAR_2, VAR_3, VAR_4, VAR_5;", "int VAR_6[2][2] = { { -1, -1 }, { -1, -1 } };", "uint8_t* src_h[2][2];", "int VAR_7[2], VAR_8[2], VAR_9[2], VAR_10[2], VAR_11;", "int VAR_12[2];", "MpegEncContext *s = &VAR_0->s;", "for (VAR_2 = 0; VAR_2 < 2; VAR_2++) {", "VAR_7[VAR_2] = av_clip(VAR_1->coefs[VAR_2][2], 0, VAR_0->sprite_width-1 << 16);", "VAR_8[VAR_2] = VAR_1->coefs[VAR_2][0];", "if (VAR_8[VAR_2] != 1<<16 || (VAR_0->sprite_width << 16) - (VAR_0->output_width << 16) - VAR_7[VAR_2])\nVAR_8[VAR_2] = av_clip(VAR_8[VAR_2], 0, ((VAR_0->sprite_width<<16) - VAR_7[VAR_2] - 1) / VAR_0->output_width);", "VAR_9[VAR_2] = av_clip(VAR_1->coefs[VAR_2][5], 0, VAR_0->sprite_height-1 << 16);", "VAR_10[VAR_2] = av_clip(VAR_1->coefs[VAR_2][4], 0, ((VAR_0->sprite_height << 16) - VAR_9[VAR_2]) / VAR_0->output_height);", "}", "VAR_11 = av_clip(VAR_1->coefs[1][6], 0, (1<<16) - 1);", "for (VAR_3 = 0; VAR_3 < (s->flags&CODEC_FLAG_GRAY ? 1 : 3); VAR_3++) {", "int width = VAR_0->output_width>>!!VAR_3;", "for (VAR_4 = 0; VAR_4 < VAR_0->output_height>>!!VAR_3; VAR_4++) {", "uint8_t *dst = VAR_0->sprite_output_frame.data[VAR_3] +\nVAR_0->sprite_output_frame.linesize[VAR_3] * VAR_4;", "for (VAR_5 = 0; VAR_5 <= VAR_0->two_sprites; VAR_5++) {", "uint8_t *iplane = s->current_picture.f.data[VAR_3];", "int iline = s->current_picture.f.linesize[VAR_3];", "int ycoord = VAR_9[VAR_5] + VAR_10[VAR_5] * VAR_4;", "int yline = ycoord >> 16;", "VAR_12[VAR_5] = ycoord & 0xFFFF;", "if (VAR_5) {", "iplane = s->last_picture.f.data[VAR_3];", "iline = s->last_picture.f.linesize[VAR_3];", "}", "if (!(VAR_7[VAR_5] & 0xFFFF) && VAR_8[VAR_5] == 1 << 16) {", "src_h[VAR_5][0] = iplane + (VAR_7[VAR_5] >> 16) + yline * iline;", "if (VAR_12[VAR_5])\nsrc_h[VAR_5][1] = iplane + (VAR_7[VAR_5] >> 16) + (yline + 1) * iline;", "} else {", "if (VAR_6[VAR_5][0] != yline) {", "if (VAR_6[VAR_5][1] == yline) {", "FFSWAP(uint8_t*, VAR_0->sr_rows[VAR_5][0], VAR_0->sr_rows[VAR_5][1]);", "FFSWAP(int, VAR_6[VAR_5][0], VAR_6[VAR_5][1]);", "} else {", "VAR_0->vc1dsp.sprite_h(VAR_0->sr_rows[VAR_5][0], iplane + yline * iline, VAR_7[VAR_5], VAR_8[VAR_5], width);", "VAR_6[VAR_5][0] = yline;", "}", "}", "if (VAR_12[VAR_5] && VAR_6[VAR_5][1] != yline + 1) {", "VAR_0->vc1dsp.sprite_h(VAR_0->sr_rows[VAR_5][1], iplane + (yline + 1) * iline, VAR_7[VAR_5], VAR_8[VAR_5], width);", "VAR_6[VAR_5][1] = yline + 1;", "}", "src_h[VAR_5][0] = VAR_0->sr_rows[VAR_5][0];", "src_h[VAR_5][1] = VAR_0->sr_rows[VAR_5][1];", "}", "}", "if (!VAR_0->two_sprites) {", "if (VAR_12[0]) {", "VAR_0->vc1dsp.sprite_v_single(dst, src_h[0][0], src_h[0][1], VAR_12[0], width);", "} else {", "memcpy(dst, src_h[0][0], width);", "}", "} else {", "if (VAR_12[0] && VAR_12[1]) {", "VAR_0->vc1dsp.sprite_v_double_twoscale(dst, src_h[0][0], src_h[0][1], VAR_12[0],\nsrc_h[1][0], src_h[1][1], VAR_12[1], VAR_11, width);", "} else if (VAR_12[0]) {", "VAR_0->vc1dsp.sprite_v_double_onescale(dst, src_h[0][0], src_h[0][1], VAR_12[0],\nsrc_h[1][0], VAR_11, width);", "} else if (VAR_12[1]) {", "VAR_0->vc1dsp.sprite_v_double_onescale(dst, src_h[1][0], src_h[1][1], VAR_12[1],\nsrc_h[0][0], (1<<16)-1-VAR_11, width);", "} else {", "VAR_0->vc1dsp.sprite_v_double_noscale(dst, src_h[0][0], src_h[1][0], VAR_11, width);", "}", "}", "}", "if (!VAR_3) {", "for (VAR_2 = 0; VAR_2 < 2; VAR_2++) {", "VAR_7[VAR_2] >>= 1;", "VAR_9[VAR_2] >>= 1;", "}", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 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 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 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 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137, 139 ], [ 141 ], [ 143, 145 ], [ 147 ], [ 149, 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 179 ], [ 181 ] ]
2,403
static int vhdx_log_flush(BlockDriverState *bs, BDRVVHDXState *s, VHDXLogSequence *logs) { int ret = 0; int i; uint32_t cnt, sectors_read; uint64_t new_file_size; void *data = NULL; VHDXLogDescEntries *desc_entries = NULL; VHDXLogEntryHeader hdr_tmp = { 0 }; cnt = logs->count; data = qemu_blockalign(bs, VHDX_LOG_SECTOR_SIZE); ret = vhdx_user_visible_write(bs, s); if (ret < 0) { goto exit; } /* each iteration represents one log sequence, which may span multiple * sectors */ while (cnt--) { ret = vhdx_log_peek_hdr(bs, &logs->log, &hdr_tmp); if (ret < 0) { goto exit; } /* if the log shows a FlushedFileOffset larger than our current file * size, then that means the file has been truncated / corrupted, and * we must refused to open it / use it */ if (hdr_tmp.flushed_file_offset > bdrv_getlength(bs->file->bs)) { ret = -EINVAL; goto exit; } ret = vhdx_log_read_desc(bs, s, &logs->log, &desc_entries, true); if (ret < 0) { goto exit; } for (i = 0; i < desc_entries->hdr.descriptor_count; i++) { if (desc_entries->desc[i].signature == VHDX_LOG_DESC_SIGNATURE) { /* data sector, so read a sector to flush */ ret = vhdx_log_read_sectors(bs, &logs->log, &sectors_read, data, 1, false); if (ret < 0) { goto exit; } if (sectors_read != 1) { ret = -EINVAL; goto exit; } vhdx_log_data_le_import(data); } ret = vhdx_log_flush_desc(bs, &desc_entries->desc[i], data); if (ret < 0) { goto exit; } } if (bdrv_getlength(bs->file->bs) < desc_entries->hdr.last_file_offset) { new_file_size = desc_entries->hdr.last_file_offset; if (new_file_size % (1024*1024)) { /* round up to nearest 1MB boundary */ new_file_size = ((new_file_size >> 20) + 1) << 20; bdrv_truncate(bs->file, new_file_size, PREALLOC_MODE_OFF, NULL); } } qemu_vfree(desc_entries); desc_entries = NULL; } bdrv_flush(bs); /* once the log is fully flushed, indicate that we have an empty log * now. This also sets the log guid to 0, to indicate an empty log */ vhdx_log_reset(bs, s); exit: qemu_vfree(data); qemu_vfree(desc_entries); return ret; }
true
qemu
3f910692c287e1c611c00e763ebeb95ed0e017f8
static int vhdx_log_flush(BlockDriverState *bs, BDRVVHDXState *s, VHDXLogSequence *logs) { int ret = 0; int i; uint32_t cnt, sectors_read; uint64_t new_file_size; void *data = NULL; VHDXLogDescEntries *desc_entries = NULL; VHDXLogEntryHeader hdr_tmp = { 0 }; cnt = logs->count; data = qemu_blockalign(bs, VHDX_LOG_SECTOR_SIZE); ret = vhdx_user_visible_write(bs, s); if (ret < 0) { goto exit; } while (cnt--) { ret = vhdx_log_peek_hdr(bs, &logs->log, &hdr_tmp); if (ret < 0) { goto exit; } if (hdr_tmp.flushed_file_offset > bdrv_getlength(bs->file->bs)) { ret = -EINVAL; goto exit; } ret = vhdx_log_read_desc(bs, s, &logs->log, &desc_entries, true); if (ret < 0) { goto exit; } for (i = 0; i < desc_entries->hdr.descriptor_count; i++) { if (desc_entries->desc[i].signature == VHDX_LOG_DESC_SIGNATURE) { ret = vhdx_log_read_sectors(bs, &logs->log, &sectors_read, data, 1, false); if (ret < 0) { goto exit; } if (sectors_read != 1) { ret = -EINVAL; goto exit; } vhdx_log_data_le_import(data); } ret = vhdx_log_flush_desc(bs, &desc_entries->desc[i], data); if (ret < 0) { goto exit; } } if (bdrv_getlength(bs->file->bs) < desc_entries->hdr.last_file_offset) { new_file_size = desc_entries->hdr.last_file_offset; if (new_file_size % (1024*1024)) { new_file_size = ((new_file_size >> 20) + 1) << 20; bdrv_truncate(bs->file, new_file_size, PREALLOC_MODE_OFF, NULL); } } qemu_vfree(desc_entries); desc_entries = NULL; } bdrv_flush(bs); vhdx_log_reset(bs, s); exit: qemu_vfree(data); qemu_vfree(desc_entries); return ret; }
{ "code": [ " if (hdr_tmp.flushed_file_offset > bdrv_getlength(bs->file->bs)) {", " if (bdrv_getlength(bs->file->bs) < desc_entries->hdr.last_file_offset) {" ], "line_no": [ 61, 121 ] }
static int FUNC_0(BlockDriverState *VAR_0, BDRVVHDXState *VAR_1, VHDXLogSequence *VAR_2) { int VAR_3 = 0; int VAR_4; uint32_t cnt, sectors_read; uint64_t new_file_size; void *VAR_5 = NULL; VHDXLogDescEntries *desc_entries = NULL; VHDXLogEntryHeader hdr_tmp = { 0 }; cnt = VAR_2->count; VAR_5 = qemu_blockalign(VAR_0, VHDX_LOG_SECTOR_SIZE); VAR_3 = vhdx_user_visible_write(VAR_0, VAR_1); if (VAR_3 < 0) { goto exit; } while (cnt--) { VAR_3 = vhdx_log_peek_hdr(VAR_0, &VAR_2->log, &hdr_tmp); if (VAR_3 < 0) { goto exit; } if (hdr_tmp.flushed_file_offset > bdrv_getlength(VAR_0->file->VAR_0)) { VAR_3 = -EINVAL; goto exit; } VAR_3 = vhdx_log_read_desc(VAR_0, VAR_1, &VAR_2->log, &desc_entries, true); if (VAR_3 < 0) { goto exit; } for (VAR_4 = 0; VAR_4 < desc_entries->hdr.descriptor_count; VAR_4++) { if (desc_entries->desc[VAR_4].signature == VHDX_LOG_DESC_SIGNATURE) { VAR_3 = vhdx_log_read_sectors(VAR_0, &VAR_2->log, &sectors_read, VAR_5, 1, false); if (VAR_3 < 0) { goto exit; } if (sectors_read != 1) { VAR_3 = -EINVAL; goto exit; } vhdx_log_data_le_import(VAR_5); } VAR_3 = vhdx_log_flush_desc(VAR_0, &desc_entries->desc[VAR_4], VAR_5); if (VAR_3 < 0) { goto exit; } } if (bdrv_getlength(VAR_0->file->VAR_0) < desc_entries->hdr.last_file_offset) { new_file_size = desc_entries->hdr.last_file_offset; if (new_file_size % (1024*1024)) { new_file_size = ((new_file_size >> 20) + 1) << 20; bdrv_truncate(VAR_0->file, new_file_size, PREALLOC_MODE_OFF, NULL); } } qemu_vfree(desc_entries); desc_entries = NULL; } bdrv_flush(VAR_0); vhdx_log_reset(VAR_0, VAR_1); exit: qemu_vfree(VAR_5); qemu_vfree(desc_entries); return VAR_3; }
[ "static int FUNC_0(BlockDriverState *VAR_0, BDRVVHDXState *VAR_1,\nVHDXLogSequence *VAR_2)\n{", "int VAR_3 = 0;", "int VAR_4;", "uint32_t cnt, sectors_read;", "uint64_t new_file_size;", "void *VAR_5 = NULL;", "VHDXLogDescEntries *desc_entries = NULL;", "VHDXLogEntryHeader hdr_tmp = { 0 };", "cnt = VAR_2->count;", "VAR_5 = qemu_blockalign(VAR_0, VHDX_LOG_SECTOR_SIZE);", "VAR_3 = vhdx_user_visible_write(VAR_0, VAR_1);", "if (VAR_3 < 0) {", "goto exit;", "}", "while (cnt--) {", "VAR_3 = vhdx_log_peek_hdr(VAR_0, &VAR_2->log, &hdr_tmp);", "if (VAR_3 < 0) {", "goto exit;", "}", "if (hdr_tmp.flushed_file_offset > bdrv_getlength(VAR_0->file->VAR_0)) {", "VAR_3 = -EINVAL;", "goto exit;", "}", "VAR_3 = vhdx_log_read_desc(VAR_0, VAR_1, &VAR_2->log, &desc_entries, true);", "if (VAR_3 < 0) {", "goto exit;", "}", "for (VAR_4 = 0; VAR_4 < desc_entries->hdr.descriptor_count; VAR_4++) {", "if (desc_entries->desc[VAR_4].signature == VHDX_LOG_DESC_SIGNATURE) {", "VAR_3 = vhdx_log_read_sectors(VAR_0, &VAR_2->log, &sectors_read,\nVAR_5, 1, false);", "if (VAR_3 < 0) {", "goto exit;", "}", "if (sectors_read != 1) {", "VAR_3 = -EINVAL;", "goto exit;", "}", "vhdx_log_data_le_import(VAR_5);", "}", "VAR_3 = vhdx_log_flush_desc(VAR_0, &desc_entries->desc[VAR_4], VAR_5);", "if (VAR_3 < 0) {", "goto exit;", "}", "}", "if (bdrv_getlength(VAR_0->file->VAR_0) < desc_entries->hdr.last_file_offset) {", "new_file_size = desc_entries->hdr.last_file_offset;", "if (new_file_size % (1024*1024)) {", "new_file_size = ((new_file_size >> 20) + 1) << 20;", "bdrv_truncate(VAR_0->file, new_file_size, PREALLOC_MODE_OFF, NULL);", "}", "}", "qemu_vfree(desc_entries);", "desc_entries = NULL;", "}", "bdrv_flush(VAR_0);", "vhdx_log_reset(VAR_0, VAR_1);", "exit:\nqemu_vfree(VAR_5);", "qemu_vfree(desc_entries);", "return VAR_3;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 83 ], [ 87, 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 145 ], [ 151 ], [ 155, 157 ], [ 159 ], [ 161 ], [ 163 ] ]
2,404
static void unterminated_array(void) { QObject *obj = qobject_from_json("[32", NULL); g_assert(obj == NULL); }
true
qemu
aec4b054ea36c53c8b887da99f20010133b84378
static void unterminated_array(void) { QObject *obj = qobject_from_json("[32", NULL); g_assert(obj == NULL); }
{ "code": [ " QObject *obj = qobject_from_json(\"[32\", NULL);" ], "line_no": [ 5 ] }
static void FUNC_0(void) { QObject *obj = qobject_from_json("[32", NULL); g_assert(obj == NULL); }
[ "static void FUNC_0(void)\n{", "QObject *obj = qobject_from_json(\"[32\", NULL);", "g_assert(obj == NULL);", "}" ]
[ 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
2,405
static av_cold int xan_decode_init(AVCodecContext *avctx) { XanContext *s = avctx->priv_data; s->avctx = avctx; s->frame_size = 0; if ((avctx->codec->id == CODEC_ID_XAN_WC3) && (s->avctx->palctrl == NULL)) { av_log(avctx, AV_LOG_ERROR, "palette expected\n"); return AVERROR(EINVAL); } avctx->pix_fmt = PIX_FMT_PAL8; s->buffer1_size = avctx->width * avctx->height; s->buffer1 = av_malloc(s->buffer1_size); if (!s->buffer1) return AVERROR(ENOMEM); s->buffer2_size = avctx->width * avctx->height; s->buffer2 = av_malloc(s->buffer2_size + 130); if (!s->buffer2) { av_freep(&s->buffer1); return AVERROR(ENOMEM); } return 0; }
true
FFmpeg
24ae353dfbe61019a86093a9c5cd15476aabef49
static av_cold int xan_decode_init(AVCodecContext *avctx) { XanContext *s = avctx->priv_data; s->avctx = avctx; s->frame_size = 0; if ((avctx->codec->id == CODEC_ID_XAN_WC3) && (s->avctx->palctrl == NULL)) { av_log(avctx, AV_LOG_ERROR, "palette expected\n"); return AVERROR(EINVAL); } avctx->pix_fmt = PIX_FMT_PAL8; s->buffer1_size = avctx->width * avctx->height; s->buffer1 = av_malloc(s->buffer1_size); if (!s->buffer1) return AVERROR(ENOMEM); s->buffer2_size = avctx->width * avctx->height; s->buffer2 = av_malloc(s->buffer2_size + 130); if (!s->buffer2) { av_freep(&s->buffer1); return AVERROR(ENOMEM); } return 0; }
{ "code": [ " if ((avctx->codec->id == CODEC_ID_XAN_WC3) &&", " (s->avctx->palctrl == NULL)) {", " av_log(avctx, AV_LOG_ERROR, \"palette expected\\n\");", " return AVERROR(EINVAL);" ], "line_no": [ 15, 17, 19, 21 ] }
static av_cold int FUNC_0(AVCodecContext *avctx) { XanContext *s = avctx->priv_data; s->avctx = avctx; s->frame_size = 0; if ((avctx->codec->id == CODEC_ID_XAN_WC3) && (s->avctx->palctrl == NULL)) { av_log(avctx, AV_LOG_ERROR, "palette expected\n"); return AVERROR(EINVAL); } avctx->pix_fmt = PIX_FMT_PAL8; s->buffer1_size = avctx->width * avctx->height; s->buffer1 = av_malloc(s->buffer1_size); if (!s->buffer1) return AVERROR(ENOMEM); s->buffer2_size = avctx->width * avctx->height; s->buffer2 = av_malloc(s->buffer2_size + 130); if (!s->buffer2) { av_freep(&s->buffer1); return AVERROR(ENOMEM); } return 0; }
[ "static av_cold int FUNC_0(AVCodecContext *avctx)\n{", "XanContext *s = avctx->priv_data;", "s->avctx = avctx;", "s->frame_size = 0;", "if ((avctx->codec->id == CODEC_ID_XAN_WC3) &&\n(s->avctx->palctrl == NULL)) {", "av_log(avctx, AV_LOG_ERROR, \"palette expected\\n\");", "return AVERROR(EINVAL);", "}", "avctx->pix_fmt = PIX_FMT_PAL8;", "s->buffer1_size = avctx->width * avctx->height;", "s->buffer1 = av_malloc(s->buffer1_size);", "if (!s->buffer1)\nreturn AVERROR(ENOMEM);", "s->buffer2_size = avctx->width * avctx->height;", "s->buffer2 = av_malloc(s->buffer2_size + 130);", "if (!s->buffer2) {", "av_freep(&s->buffer1);", "return AVERROR(ENOMEM);", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 15, 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 31 ], [ 33 ], [ 35, 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ] ]
2,406
static void init_uni_ac_vlc(RLTable *rl, uint8_t *uni_ac_vlc_len){ int i; for(i=0; i<128; i++){ int level= i-64; int run; for(run=0; run<64; run++){ int len, bits, code; int alevel= FFABS(level); int sign= (level>>31)&1; if (alevel > rl->max_level[0][run]) code= 111; /*rl->n*/ else code= rl->index_run[0][run] + alevel - 1; if (code < 111 /* rl->n */) { /* store the vlc & sign at once */ len= rl->table_vlc[code][1]+1; bits= (rl->table_vlc[code][0]<<1) + sign; } else { len= rl->table_vlc[111/*rl->n*/][1]+6; bits= rl->table_vlc[111/*rl->n*/][0]<<6; bits|= run; if (alevel < 128) { bits<<=8; len+=8; bits|= level & 0xff; } else { bits<<=16; len+=16; bits|= level & 0xff; if (level < 0) { bits|= 0x8001 + level + 255; } else { bits|= level & 0xffff; } } } uni_ac_vlc_len [UNI_AC_ENC_INDEX(run, i)]= len; } } }
true
FFmpeg
7c5dfc174be59afa671a98ec85fe208c528ab64f
static void init_uni_ac_vlc(RLTable *rl, uint8_t *uni_ac_vlc_len){ int i; for(i=0; i<128; i++){ int level= i-64; int run; for(run=0; run<64; run++){ int len, bits, code; int alevel= FFABS(level); int sign= (level>>31)&1; if (alevel > rl->max_level[0][run]) code= 111; else code= rl->index_run[0][run] + alevel - 1; if (code < 111 ) { len= rl->table_vlc[code][1]+1; bits= (rl->table_vlc[code][0]<<1) + sign; } else { len= rl->table_vlc[111][1]+6; bits= rl->table_vlc[111][0]<<6; bits|= run; if (alevel < 128) { bits<<=8; len+=8; bits|= level & 0xff; } else { bits<<=16; len+=16; bits|= level & 0xff; if (level < 0) { bits|= 0x8001 + level + 255; } else { bits|= level & 0xffff; } } } uni_ac_vlc_len [UNI_AC_ENC_INDEX(run, i)]= len; } } }
{ "code": [], "line_no": [] }
static void FUNC_0(RLTable *VAR_0, uint8_t *VAR_1){ int VAR_2; for(VAR_2=0; VAR_2<128; VAR_2++){ int VAR_3= VAR_2-64; int VAR_4; for(VAR_4=0; VAR_4<64; VAR_4++){ int VAR_5, VAR_6, VAR_7; int VAR_8= FFABS(VAR_3); int VAR_9= (VAR_3>>31)&1; if (VAR_8 > VAR_0->max_level[0][VAR_4]) VAR_7= 111; else VAR_7= VAR_0->index_run[0][VAR_4] + VAR_8 - 1; if (VAR_7 < 111 ) { VAR_5= VAR_0->table_vlc[VAR_7][1]+1; VAR_6= (VAR_0->table_vlc[VAR_7][0]<<1) + VAR_9; } else { VAR_5= VAR_0->table_vlc[111][1]+6; VAR_6= VAR_0->table_vlc[111][0]<<6; VAR_6|= VAR_4; if (VAR_8 < 128) { VAR_6<<=8; VAR_5+=8; VAR_6|= VAR_3 & 0xff; } else { VAR_6<<=16; VAR_5+=16; VAR_6|= VAR_3 & 0xff; if (VAR_3 < 0) { VAR_6|= 0x8001 + VAR_3 + 255; } else { VAR_6|= VAR_3 & 0xffff; } } } VAR_1 [UNI_AC_ENC_INDEX(VAR_4, VAR_2)]= VAR_5; } } }
[ "static void FUNC_0(RLTable *VAR_0, uint8_t *VAR_1){", "int VAR_2;", "for(VAR_2=0; VAR_2<128; VAR_2++){", "int VAR_3= VAR_2-64;", "int VAR_4;", "for(VAR_4=0; VAR_4<64; VAR_4++){", "int VAR_5, VAR_6, VAR_7;", "int VAR_8= FFABS(VAR_3);", "int VAR_9= (VAR_3>>31)&1;", "if (VAR_8 > VAR_0->max_level[0][VAR_4])\nVAR_7= 111;", "else\nVAR_7= VAR_0->index_run[0][VAR_4] + VAR_8 - 1;", "if (VAR_7 < 111 ) {", "VAR_5= VAR_0->table_vlc[VAR_7][1]+1;", "VAR_6= (VAR_0->table_vlc[VAR_7][0]<<1) + VAR_9;", "} else {", "VAR_5= VAR_0->table_vlc[111][1]+6;", "VAR_6= VAR_0->table_vlc[111][0]<<6;", "VAR_6|= VAR_4;", "if (VAR_8 < 128) {", "VAR_6<<=8; VAR_5+=8;", "VAR_6|= VAR_3 & 0xff;", "} else {", "VAR_6<<=16; VAR_5+=16;", "VAR_6|= VAR_3 & 0xff;", "if (VAR_3 < 0) {", "VAR_6|= 0x8001 + VAR_3 + 255;", "} else {", "VAR_6|= VAR_3 & 0xffff;", "}", "}", "}", "VAR_1 [UNI_AC_ENC_INDEX(VAR_4, VAR_2)]= 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 ]
[ [ 1 ], [ 3 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 27, 29 ], [ 31, 33 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ] ]
2,407
int virtqueue_pop(VirtQueue *vq, VirtQueueElement *elem) { unsigned int i, head, max; target_phys_addr_t desc_pa = vq->vring.desc; if (!virtqueue_num_heads(vq, vq->last_avail_idx)) return 0; /* When we start there are none of either input nor output. */ elem->out_num = elem->in_num = 0; max = vq->vring.num; i = head = virtqueue_get_head(vq, vq->last_avail_idx++); if (vq->vdev->guest_features & (1 << VIRTIO_RING_F_EVENT_IDX)) { vring_avail_event(vq, vring_avail_idx(vq)); if (vring_desc_flags(desc_pa, i) & VRING_DESC_F_INDIRECT) { if (vring_desc_len(desc_pa, i) % sizeof(VRingDesc)) { error_report("Invalid size for indirect buffer table"); /* loop over the indirect descriptor table */ max = vring_desc_len(desc_pa, i) / sizeof(VRingDesc); desc_pa = vring_desc_addr(desc_pa, i); i = 0; /* Collect all the descriptors */ do { struct iovec *sg; if (vring_desc_flags(desc_pa, i) & VRING_DESC_F_WRITE) { elem->in_addr[elem->in_num] = vring_desc_addr(desc_pa, i); sg = &elem->in_sg[elem->in_num++]; } else { elem->out_addr[elem->out_num] = vring_desc_addr(desc_pa, i); sg = &elem->out_sg[elem->out_num++]; sg->iov_len = vring_desc_len(desc_pa, i); /* If we've got too many, that implies a descriptor loop. */ if ((elem->in_num + elem->out_num) > max) { error_report("Looped descriptor"); } while ((i = virtqueue_next_desc(desc_pa, i, max)) != max); /* Now map what we have collected */ virtqueue_map_sg(elem->in_sg, elem->in_addr, elem->in_num, 1); virtqueue_map_sg(elem->out_sg, elem->out_addr, elem->out_num, 0); elem->index = head; vq->inuse++; trace_virtqueue_pop(vq, elem, elem->in_num, elem->out_num); return elem->in_num + elem->out_num;
true
qemu
c8eac1cfa1e9104a658b4614ada758861b8d823a
int virtqueue_pop(VirtQueue *vq, VirtQueueElement *elem) { unsigned int i, head, max; target_phys_addr_t desc_pa = vq->vring.desc; if (!virtqueue_num_heads(vq, vq->last_avail_idx)) return 0; elem->out_num = elem->in_num = 0; max = vq->vring.num; i = head = virtqueue_get_head(vq, vq->last_avail_idx++); if (vq->vdev->guest_features & (1 << VIRTIO_RING_F_EVENT_IDX)) { vring_avail_event(vq, vring_avail_idx(vq)); if (vring_desc_flags(desc_pa, i) & VRING_DESC_F_INDIRECT) { if (vring_desc_len(desc_pa, i) % sizeof(VRingDesc)) { error_report("Invalid size for indirect buffer table"); max = vring_desc_len(desc_pa, i) / sizeof(VRingDesc); desc_pa = vring_desc_addr(desc_pa, i); i = 0; do { struct iovec *sg; if (vring_desc_flags(desc_pa, i) & VRING_DESC_F_WRITE) { elem->in_addr[elem->in_num] = vring_desc_addr(desc_pa, i); sg = &elem->in_sg[elem->in_num++]; } else { elem->out_addr[elem->out_num] = vring_desc_addr(desc_pa, i); sg = &elem->out_sg[elem->out_num++]; sg->iov_len = vring_desc_len(desc_pa, i); if ((elem->in_num + elem->out_num) > max) { error_report("Looped descriptor"); } while ((i = virtqueue_next_desc(desc_pa, i, max)) != max); virtqueue_map_sg(elem->in_sg, elem->in_addr, elem->in_num, 1); virtqueue_map_sg(elem->out_sg, elem->out_addr, elem->out_num, 0); elem->index = head; vq->inuse++; trace_virtqueue_pop(vq, elem, elem->in_num, elem->out_num); return elem->in_num + elem->out_num;
{ "code": [], "line_no": [] }
int FUNC_0(VirtQueue *VAR_0, VirtQueueElement *VAR_1) { unsigned int VAR_2, VAR_3, VAR_4; target_phys_addr_t desc_pa = VAR_0->vring.desc; if (!virtqueue_num_heads(VAR_0, VAR_0->last_avail_idx)) return 0; VAR_1->out_num = VAR_1->in_num = 0; VAR_4 = VAR_0->vring.num; VAR_2 = VAR_3 = virtqueue_get_head(VAR_0, VAR_0->last_avail_idx++); if (VAR_0->vdev->guest_features & (1 << VIRTIO_RING_F_EVENT_IDX)) { vring_avail_event(VAR_0, vring_avail_idx(VAR_0)); if (vring_desc_flags(desc_pa, VAR_2) & VRING_DESC_F_INDIRECT) { if (vring_desc_len(desc_pa, VAR_2) % sizeof(VRingDesc)) { error_report("Invalid size for indirect buffer table"); VAR_4 = vring_desc_len(desc_pa, VAR_2) / sizeof(VRingDesc); desc_pa = vring_desc_addr(desc_pa, VAR_2); VAR_2 = 0; do { struct iovec *sg; if (vring_desc_flags(desc_pa, VAR_2) & VRING_DESC_F_WRITE) { VAR_1->in_addr[VAR_1->in_num] = vring_desc_addr(desc_pa, VAR_2); sg = &VAR_1->in_sg[VAR_1->in_num++]; } else { VAR_1->out_addr[VAR_1->out_num] = vring_desc_addr(desc_pa, VAR_2); sg = &VAR_1->out_sg[VAR_1->out_num++]; sg->iov_len = vring_desc_len(desc_pa, VAR_2); if ((VAR_1->in_num + VAR_1->out_num) > VAR_4) { error_report("Looped descriptor"); } while ((VAR_2 = virtqueue_next_desc(desc_pa, VAR_2, VAR_4)) != VAR_4); virtqueue_map_sg(VAR_1->in_sg, VAR_1->in_addr, VAR_1->in_num, 1); virtqueue_map_sg(VAR_1->out_sg, VAR_1->out_addr, VAR_1->out_num, 0); VAR_1->index = VAR_3; VAR_0->inuse++; trace_virtqueue_pop(VAR_0, VAR_1, VAR_1->in_num, VAR_1->out_num); return VAR_1->in_num + VAR_1->out_num;
[ "int FUNC_0(VirtQueue *VAR_0, VirtQueueElement *VAR_1)\n{", "unsigned int VAR_2, VAR_3, VAR_4;", "target_phys_addr_t desc_pa = VAR_0->vring.desc;", "if (!virtqueue_num_heads(VAR_0, VAR_0->last_avail_idx))\nreturn 0;", "VAR_1->out_num = VAR_1->in_num = 0;", "VAR_4 = VAR_0->vring.num;", "VAR_2 = VAR_3 = virtqueue_get_head(VAR_0, VAR_0->last_avail_idx++);", "if (VAR_0->vdev->guest_features & (1 << VIRTIO_RING_F_EVENT_IDX)) {", "vring_avail_event(VAR_0, vring_avail_idx(VAR_0));", "if (vring_desc_flags(desc_pa, VAR_2) & VRING_DESC_F_INDIRECT) {", "if (vring_desc_len(desc_pa, VAR_2) % sizeof(VRingDesc)) {", "error_report(\"Invalid size for indirect buffer table\");", "VAR_4 = vring_desc_len(desc_pa, VAR_2) / sizeof(VRingDesc);", "desc_pa = vring_desc_addr(desc_pa, VAR_2);", "VAR_2 = 0;", "do {", "struct iovec *sg;", "if (vring_desc_flags(desc_pa, VAR_2) & VRING_DESC_F_WRITE) {", "VAR_1->in_addr[VAR_1->in_num] = vring_desc_addr(desc_pa, VAR_2);", "sg = &VAR_1->in_sg[VAR_1->in_num++];", "} else {", "VAR_1->out_addr[VAR_1->out_num] = vring_desc_addr(desc_pa, VAR_2);", "sg = &VAR_1->out_sg[VAR_1->out_num++];", "sg->iov_len = vring_desc_len(desc_pa, VAR_2);", "if ((VAR_1->in_num + VAR_1->out_num) > VAR_4) {", "error_report(\"Looped descriptor\");", "} while ((VAR_2 = virtqueue_next_desc(desc_pa, VAR_2, VAR_4)) != VAR_4);", "virtqueue_map_sg(VAR_1->in_sg, VAR_1->in_addr, VAR_1->in_num, 1);", "virtqueue_map_sg(VAR_1->out_sg, VAR_1->out_addr, VAR_1->out_num, 0);", "VAR_1->index = VAR_3;", "VAR_0->inuse++;", "trace_virtqueue_pop(VAR_0, VAR_1, VAR_1->in_num, VAR_1->out_num);", "return VAR_1->in_num + VAR_1->out_num;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11, 13 ], [ 19 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 36 ], [ 38 ], [ 40 ], [ 48 ], [ 50 ], [ 52 ], [ 59 ], [ 61 ], [ 65 ], [ 71 ], [ 73 ], [ 75 ], [ 81 ], [ 83 ], [ 88 ], [ 94 ], [ 96 ], [ 100 ], [ 106 ], [ 108 ], [ 112 ], [ 116 ], [ 120 ], [ 122 ] ]
2,408
void qemu_ram_remap(ram_addr_t addr, ram_addr_t length) { RAMBlock *block; ram_addr_t offset; int flags; void *area, *vaddr; QLIST_FOREACH(block, &ram_list.blocks, next) { offset = addr - block->offset; if (offset < block->length) { vaddr = block->host + offset; if (block->flags & RAM_PREALLOC_MASK) { ; } else { flags = MAP_FIXED; munmap(vaddr, length); if (mem_path) { #if defined(__linux__) && !defined(TARGET_S390X) if (block->fd) { #ifdef MAP_POPULATE flags |= mem_prealloc ? MAP_POPULATE | MAP_SHARED : MAP_PRIVATE; flags |= MAP_PRIVATE; #endif area = mmap(vaddr, length, PROT_READ | PROT_WRITE, flags, block->fd, offset); } else { flags |= MAP_PRIVATE | MAP_ANONYMOUS; area = mmap(vaddr, length, PROT_READ | PROT_WRITE, flags, -1, 0); } #endif } else { #if defined(TARGET_S390X) && defined(CONFIG_KVM) flags |= MAP_SHARED | MAP_ANONYMOUS; area = mmap(vaddr, length, PROT_EXEC|PROT_READ|PROT_WRITE, flags, -1, 0); flags |= MAP_PRIVATE | MAP_ANONYMOUS; area = mmap(vaddr, length, PROT_READ | PROT_WRITE, flags, -1, 0); #endif } if (area != vaddr) { fprintf(stderr, "Could not remap addr: %lx@%lx\n", length, addr); exit(1); } qemu_madvise(vaddr, length, QEMU_MADV_MERGEABLE); } return; } } }
true
qemu
fd28aa132362320f9f3a30b23f634bb14dee528e
void qemu_ram_remap(ram_addr_t addr, ram_addr_t length) { RAMBlock *block; ram_addr_t offset; int flags; void *area, *vaddr; QLIST_FOREACH(block, &ram_list.blocks, next) { offset = addr - block->offset; if (offset < block->length) { vaddr = block->host + offset; if (block->flags & RAM_PREALLOC_MASK) { ; } else { flags = MAP_FIXED; munmap(vaddr, length); if (mem_path) { #if defined(__linux__) && !defined(TARGET_S390X) if (block->fd) { #ifdef MAP_POPULATE flags |= mem_prealloc ? MAP_POPULATE | MAP_SHARED : MAP_PRIVATE; flags |= MAP_PRIVATE; #endif area = mmap(vaddr, length, PROT_READ | PROT_WRITE, flags, block->fd, offset); } else { flags |= MAP_PRIVATE | MAP_ANONYMOUS; area = mmap(vaddr, length, PROT_READ | PROT_WRITE, flags, -1, 0); } #endif } else { #if defined(TARGET_S390X) && defined(CONFIG_KVM) flags |= MAP_SHARED | MAP_ANONYMOUS; area = mmap(vaddr, length, PROT_EXEC|PROT_READ|PROT_WRITE, flags, -1, 0); flags |= MAP_PRIVATE | MAP_ANONYMOUS; area = mmap(vaddr, length, PROT_READ | PROT_WRITE, flags, -1, 0); #endif } if (area != vaddr) { fprintf(stderr, "Could not remap addr: %lx@%lx\n", length, addr); exit(1); } qemu_madvise(vaddr, length, QEMU_MADV_MERGEABLE); } return; } } }
{ "code": [], "line_no": [] }
void FUNC_0(ram_addr_t VAR_0, ram_addr_t VAR_1) { RAMBlock *block; ram_addr_t offset; int VAR_2; void *VAR_3, *VAR_4; QLIST_FOREACH(block, &ram_list.blocks, next) { offset = VAR_0 - block->offset; if (offset < block->VAR_1) { VAR_4 = block->host + offset; if (block->VAR_2 & RAM_PREALLOC_MASK) { ; } else { VAR_2 = MAP_FIXED; munmap(VAR_4, VAR_1); if (mem_path) { #if defined(__linux__) && !defined(TARGET_S390X) if (block->fd) { #ifdef MAP_POPULATE VAR_2 |= mem_prealloc ? MAP_POPULATE | MAP_SHARED : MAP_PRIVATE; VAR_2 |= MAP_PRIVATE; #endif VAR_3 = mmap(VAR_4, VAR_1, PROT_READ | PROT_WRITE, VAR_2, block->fd, offset); } else { VAR_2 |= MAP_PRIVATE | MAP_ANONYMOUS; VAR_3 = mmap(VAR_4, VAR_1, PROT_READ | PROT_WRITE, VAR_2, -1, 0); } #endif } else { #if defined(TARGET_S390X) && defined(CONFIG_KVM) VAR_2 |= MAP_SHARED | MAP_ANONYMOUS; VAR_3 = mmap(VAR_4, VAR_1, PROT_EXEC|PROT_READ|PROT_WRITE, VAR_2, -1, 0); VAR_2 |= MAP_PRIVATE | MAP_ANONYMOUS; VAR_3 = mmap(VAR_4, VAR_1, PROT_READ | PROT_WRITE, VAR_2, -1, 0); #endif } if (VAR_3 != VAR_4) { fprintf(stderr, "Could not remap VAR_0: %lx@%lx\n", VAR_1, VAR_0); exit(1); } qemu_madvise(VAR_4, VAR_1, QEMU_MADV_MERGEABLE); } return; } } }
[ "void FUNC_0(ram_addr_t VAR_0, ram_addr_t VAR_1)\n{", "RAMBlock *block;", "ram_addr_t offset;", "int VAR_2;", "void *VAR_3, *VAR_4;", "QLIST_FOREACH(block, &ram_list.blocks, next) {", "offset = VAR_0 - block->offset;", "if (offset < block->VAR_1) {", "VAR_4 = block->host + offset;", "if (block->VAR_2 & RAM_PREALLOC_MASK) {", ";", "} else {", "VAR_2 = MAP_FIXED;", "munmap(VAR_4, VAR_1);", "if (mem_path) {", "#if defined(__linux__) && !defined(TARGET_S390X)\nif (block->fd) {", "#ifdef MAP_POPULATE\nVAR_2 |= mem_prealloc ? MAP_POPULATE | MAP_SHARED :\nMAP_PRIVATE;", "VAR_2 |= MAP_PRIVATE;", "#endif\nVAR_3 = mmap(VAR_4, VAR_1, PROT_READ | PROT_WRITE,\nVAR_2, block->fd, offset);", "} else {", "VAR_2 |= MAP_PRIVATE | MAP_ANONYMOUS;", "VAR_3 = mmap(VAR_4, VAR_1, PROT_READ | PROT_WRITE,\nVAR_2, -1, 0);", "}", "#endif\n} else {", "#if defined(TARGET_S390X) && defined(CONFIG_KVM)\nVAR_2 |= MAP_SHARED | MAP_ANONYMOUS;", "VAR_3 = mmap(VAR_4, VAR_1, PROT_EXEC|PROT_READ|PROT_WRITE,\nVAR_2, -1, 0);", "VAR_2 |= MAP_PRIVATE | MAP_ANONYMOUS;", "VAR_3 = mmap(VAR_4, VAR_1, PROT_READ | PROT_WRITE,\nVAR_2, -1, 0);", "#endif\n}", "if (VAR_3 != VAR_4) {", "fprintf(stderr, \"Could not remap VAR_0: %lx@%lx\\n\",\nVAR_1, VAR_0);", "exit(1);", "}", "qemu_madvise(VAR_4, VAR_1, QEMU_MADV_MERGEABLE);", "}", "return;", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35, 37 ], [ 39, 41, 43 ], [ 46 ], [ 48, 50, 52 ], [ 54 ], [ 56 ], [ 58, 60 ], [ 62 ], [ 66, 68 ], [ 70, 72 ], [ 74, 76 ], [ 79 ], [ 81, 83 ], [ 85, 87 ], [ 89 ], [ 91, 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ] ]
2,409
static void pnv_chip_power8_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); PnvChipClass *k = PNV_CHIP_CLASS(klass); k->cpu_model = "POWER8"; k->chip_type = PNV_CHIP_POWER8; k->chip_cfam_id = 0x220ea04980000000ull; /* P8 Venice DD2.0 */ k->cores_mask = POWER8_CORE_MASK; k->core_pir = pnv_chip_core_pir_p8; dc->desc = "PowerNV Chip POWER8"; }
true
qemu
967b75230b9720ea2b3ae49f38f8287026125f9f
static void pnv_chip_power8_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); PnvChipClass *k = PNV_CHIP_CLASS(klass); k->cpu_model = "POWER8"; k->chip_type = PNV_CHIP_POWER8; k->chip_cfam_id = 0x220ea04980000000ull; k->cores_mask = POWER8_CORE_MASK; k->core_pir = pnv_chip_core_pir_p8; dc->desc = "PowerNV Chip POWER8"; }
{ "code": [], "line_no": [] }
static void FUNC_0(ObjectClass *VAR_0, void *VAR_1) { DeviceClass *dc = DEVICE_CLASS(VAR_0); PnvChipClass *k = PNV_CHIP_CLASS(VAR_0); k->cpu_model = "POWER8"; k->chip_type = PNV_CHIP_POWER8; k->chip_cfam_id = 0x220ea04980000000ull; k->cores_mask = POWER8_CORE_MASK; k->core_pir = pnv_chip_core_pir_p8; dc->desc = "PowerNV Chip POWER8"; }
[ "static void FUNC_0(ObjectClass *VAR_0, void *VAR_1)\n{", "DeviceClass *dc = DEVICE_CLASS(VAR_0);", "PnvChipClass *k = PNV_CHIP_CLASS(VAR_0);", "k->cpu_model = \"POWER8\";", "k->chip_type = PNV_CHIP_POWER8;", "k->chip_cfam_id = 0x220ea04980000000ull;", "k->cores_mask = POWER8_CORE_MASK;", "k->core_pir = pnv_chip_core_pir_p8;", "dc->desc = \"PowerNV Chip POWER8\";", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 22 ], [ 24 ] ]
2,410
static void multiwrite_user_cb(MultiwriteCB *mcb) { int i; for (i = 0; i < mcb->num_callbacks; i++) { mcb->callbacks[i].cb(mcb->callbacks[i].opaque, mcb->error); qemu_free(mcb->callbacks[i].free_qiov); qemu_free(mcb->callbacks[i].free_buf); } }
true
qemu
f8a83245d9ec685bc6aa6173d6765fe03e20688f
static void multiwrite_user_cb(MultiwriteCB *mcb) { int i; for (i = 0; i < mcb->num_callbacks; i++) { mcb->callbacks[i].cb(mcb->callbacks[i].opaque, mcb->error); qemu_free(mcb->callbacks[i].free_qiov); qemu_free(mcb->callbacks[i].free_buf); } }
{ "code": [ " qemu_free(mcb->callbacks[i].free_buf);" ], "line_no": [ 15 ] }
static void FUNC_0(MultiwriteCB *VAR_0) { int VAR_1; for (VAR_1 = 0; VAR_1 < VAR_0->num_callbacks; VAR_1++) { VAR_0->callbacks[VAR_1].cb(VAR_0->callbacks[VAR_1].opaque, VAR_0->error); qemu_free(VAR_0->callbacks[VAR_1].free_qiov); qemu_free(VAR_0->callbacks[VAR_1].free_buf); } }
[ "static void FUNC_0(MultiwriteCB *VAR_0)\n{", "int VAR_1;", "for (VAR_1 = 0; VAR_1 < VAR_0->num_callbacks; VAR_1++) {", "VAR_0->callbacks[VAR_1].cb(VAR_0->callbacks[VAR_1].opaque, VAR_0->error);", "qemu_free(VAR_0->callbacks[VAR_1].free_qiov);", "qemu_free(VAR_0->callbacks[VAR_1].free_buf);", "}", "}" ]
[ 0, 0, 0, 0, 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ] ]
2,412
static void pflash_cfi02_realize(DeviceState *dev, Error **errp) { pflash_t *pfl = CFI_PFLASH02(dev); uint32_t chip_len; int ret; Error *local_err = NULL; chip_len = pfl->sector_len * pfl->nb_blocs; /* XXX: to be fixed */ #if 0 if (total_len != (8 * 1024 * 1024) && total_len != (16 * 1024 * 1024) && total_len != (32 * 1024 * 1024) && total_len != (64 * 1024 * 1024)) return NULL; #endif memory_region_init_rom_device(&pfl->orig_mem, OBJECT(pfl), pfl->be ? &pflash_cfi02_ops_be : &pflash_cfi02_ops_le, pfl, pfl->name, chip_len, &local_err); if (local_err) { error_propagate(errp, local_err); vmstate_register_ram(&pfl->orig_mem, DEVICE(pfl)); pfl->storage = memory_region_get_ram_ptr(&pfl->orig_mem); pfl->chip_len = chip_len; if (pfl->blk) { /* read the initial flash content */ ret = blk_pread(pfl->blk, 0, pfl->storage, chip_len); if (ret < 0) { vmstate_unregister_ram(&pfl->orig_mem, DEVICE(pfl)); error_setg(errp, "failed to read the initial flash content"); pflash_setup_mappings(pfl); pfl->rom_mode = 1; sysbus_init_mmio(SYS_BUS_DEVICE(dev), &pfl->mem); if (pfl->blk) { pfl->ro = blk_is_read_only(pfl->blk); } else { pfl->ro = 0; pfl->timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, pflash_timer, pfl); pfl->wcycle = 0; pfl->cmd = 0; pfl->status = 0; /* Hardcoded CFI table (mostly from SG29 Spansion flash) */ pfl->cfi_len = 0x52; /* Standard "QRY" string */ pfl->cfi_table[0x10] = 'Q'; pfl->cfi_table[0x11] = 'R'; pfl->cfi_table[0x12] = 'Y'; /* Command set (AMD/Fujitsu) */ pfl->cfi_table[0x13] = 0x02; pfl->cfi_table[0x14] = 0x00; /* Primary extended table address */ pfl->cfi_table[0x15] = 0x31; pfl->cfi_table[0x16] = 0x00; /* Alternate command set (none) */ pfl->cfi_table[0x17] = 0x00; pfl->cfi_table[0x18] = 0x00; /* Alternate extended table (none) */ pfl->cfi_table[0x19] = 0x00; pfl->cfi_table[0x1A] = 0x00; /* Vcc min */ pfl->cfi_table[0x1B] = 0x27; /* Vcc max */ pfl->cfi_table[0x1C] = 0x36; /* Vpp min (no Vpp pin) */ pfl->cfi_table[0x1D] = 0x00; /* Vpp max (no Vpp pin) */ pfl->cfi_table[0x1E] = 0x00; /* Reserved */ pfl->cfi_table[0x1F] = 0x07; /* Timeout for min size buffer write (NA) */ pfl->cfi_table[0x20] = 0x00; /* Typical timeout for block erase (512 ms) */ pfl->cfi_table[0x21] = 0x09; /* Typical timeout for full chip erase (4096 ms) */ pfl->cfi_table[0x22] = 0x0C; /* Reserved */ pfl->cfi_table[0x23] = 0x01; /* Max timeout for buffer write (NA) */ pfl->cfi_table[0x24] = 0x00; /* Max timeout for block erase */ pfl->cfi_table[0x25] = 0x0A; /* Max timeout for chip erase */ pfl->cfi_table[0x26] = 0x0D; /* Device size */ pfl->cfi_table[0x27] = ctz32(chip_len); /* Flash device interface (8 & 16 bits) */ pfl->cfi_table[0x28] = 0x02; pfl->cfi_table[0x29] = 0x00; /* Max number of bytes in multi-bytes write */ /* XXX: disable buffered write as it's not supported */ // pfl->cfi_table[0x2A] = 0x05; pfl->cfi_table[0x2A] = 0x00; pfl->cfi_table[0x2B] = 0x00; /* Number of erase block regions (uniform) */ pfl->cfi_table[0x2C] = 0x01; /* Erase block region 1 */ pfl->cfi_table[0x2D] = pfl->nb_blocs - 1; pfl->cfi_table[0x2E] = (pfl->nb_blocs - 1) >> 8; pfl->cfi_table[0x2F] = pfl->sector_len >> 8; pfl->cfi_table[0x30] = pfl->sector_len >> 16; /* Extended */ pfl->cfi_table[0x31] = 'P'; pfl->cfi_table[0x32] = 'R'; pfl->cfi_table[0x33] = 'I'; pfl->cfi_table[0x34] = '1'; pfl->cfi_table[0x35] = '0'; pfl->cfi_table[0x36] = 0x00; pfl->cfi_table[0x37] = 0x00; pfl->cfi_table[0x38] = 0x00; pfl->cfi_table[0x39] = 0x00; pfl->cfi_table[0x3a] = 0x00; pfl->cfi_table[0x3b] = 0x00; pfl->cfi_table[0x3c] = 0x00;
true
qemu
8929fc3a55f33a103adddf9cfd010bcf2b255c7d
static void pflash_cfi02_realize(DeviceState *dev, Error **errp) { pflash_t *pfl = CFI_PFLASH02(dev); uint32_t chip_len; int ret; Error *local_err = NULL; chip_len = pfl->sector_len * pfl->nb_blocs; #if 0 if (total_len != (8 * 1024 * 1024) && total_len != (16 * 1024 * 1024) && total_len != (32 * 1024 * 1024) && total_len != (64 * 1024 * 1024)) return NULL; #endif memory_region_init_rom_device(&pfl->orig_mem, OBJECT(pfl), pfl->be ? &pflash_cfi02_ops_be : &pflash_cfi02_ops_le, pfl, pfl->name, chip_len, &local_err); if (local_err) { error_propagate(errp, local_err); vmstate_register_ram(&pfl->orig_mem, DEVICE(pfl)); pfl->storage = memory_region_get_ram_ptr(&pfl->orig_mem); pfl->chip_len = chip_len; if (pfl->blk) { ret = blk_pread(pfl->blk, 0, pfl->storage, chip_len); if (ret < 0) { vmstate_unregister_ram(&pfl->orig_mem, DEVICE(pfl)); error_setg(errp, "failed to read the initial flash content"); pflash_setup_mappings(pfl); pfl->rom_mode = 1; sysbus_init_mmio(SYS_BUS_DEVICE(dev), &pfl->mem); if (pfl->blk) { pfl->ro = blk_is_read_only(pfl->blk); } else { pfl->ro = 0; pfl->timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, pflash_timer, pfl); pfl->wcycle = 0; pfl->cmd = 0; pfl->status = 0; pfl->cfi_len = 0x52; pfl->cfi_table[0x10] = 'Q'; pfl->cfi_table[0x11] = 'R'; pfl->cfi_table[0x12] = 'Y'; pfl->cfi_table[0x13] = 0x02; pfl->cfi_table[0x14] = 0x00; pfl->cfi_table[0x15] = 0x31; pfl->cfi_table[0x16] = 0x00; pfl->cfi_table[0x17] = 0x00; pfl->cfi_table[0x18] = 0x00; pfl->cfi_table[0x19] = 0x00; pfl->cfi_table[0x1A] = 0x00; pfl->cfi_table[0x1B] = 0x27; pfl->cfi_table[0x1C] = 0x36; pfl->cfi_table[0x1D] = 0x00; pfl->cfi_table[0x1E] = 0x00; pfl->cfi_table[0x1F] = 0x07; pfl->cfi_table[0x20] = 0x00; pfl->cfi_table[0x21] = 0x09; pfl->cfi_table[0x22] = 0x0C; pfl->cfi_table[0x23] = 0x01; pfl->cfi_table[0x24] = 0x00; pfl->cfi_table[0x25] = 0x0A; pfl->cfi_table[0x26] = 0x0D; pfl->cfi_table[0x27] = ctz32(chip_len); pfl->cfi_table[0x28] = 0x02; pfl->cfi_table[0x29] = 0x00; pfl->cfi_table[0x2A] = 0x00; pfl->cfi_table[0x2B] = 0x00; pfl->cfi_table[0x2C] = 0x01; pfl->cfi_table[0x2D] = pfl->nb_blocs - 1; pfl->cfi_table[0x2E] = (pfl->nb_blocs - 1) >> 8; pfl->cfi_table[0x2F] = pfl->sector_len >> 8; pfl->cfi_table[0x30] = pfl->sector_len >> 16; pfl->cfi_table[0x31] = 'P'; pfl->cfi_table[0x32] = 'R'; pfl->cfi_table[0x33] = 'I'; pfl->cfi_table[0x34] = '1'; pfl->cfi_table[0x35] = '0'; pfl->cfi_table[0x36] = 0x00; pfl->cfi_table[0x37] = 0x00; pfl->cfi_table[0x38] = 0x00; pfl->cfi_table[0x39] = 0x00; pfl->cfi_table[0x3a] = 0x00; pfl->cfi_table[0x3b] = 0x00; pfl->cfi_table[0x3c] = 0x00;
{ "code": [], "line_no": [] }
static void FUNC_0(DeviceState *VAR_0, Error **VAR_1) { pflash_t *pfl = CFI_PFLASH02(VAR_0); uint32_t chip_len; int VAR_2; Error *local_err = NULL; chip_len = pfl->sector_len * pfl->nb_blocs; #if 0 if (total_len != (8 * 1024 * 1024) && total_len != (16 * 1024 * 1024) && total_len != (32 * 1024 * 1024) && total_len != (64 * 1024 * 1024)) return NULL; #endif memory_region_init_rom_device(&pfl->orig_mem, OBJECT(pfl), pfl->be ? &pflash_cfi02_ops_be : &pflash_cfi02_ops_le, pfl, pfl->name, chip_len, &local_err); if (local_err) { error_propagate(VAR_1, local_err); vmstate_register_ram(&pfl->orig_mem, DEVICE(pfl)); pfl->storage = memory_region_get_ram_ptr(&pfl->orig_mem); pfl->chip_len = chip_len; if (pfl->blk) { VAR_2 = blk_pread(pfl->blk, 0, pfl->storage, chip_len); if (VAR_2 < 0) { vmstate_unregister_ram(&pfl->orig_mem, DEVICE(pfl)); error_setg(VAR_1, "failed to read the initial flash content"); pflash_setup_mappings(pfl); pfl->rom_mode = 1; sysbus_init_mmio(SYS_BUS_DEVICE(VAR_0), &pfl->mem); if (pfl->blk) { pfl->ro = blk_is_read_only(pfl->blk); } else { pfl->ro = 0; pfl->timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, pflash_timer, pfl); pfl->wcycle = 0; pfl->cmd = 0; pfl->status = 0; pfl->cfi_len = 0x52; pfl->cfi_table[0x10] = 'Q'; pfl->cfi_table[0x11] = 'R'; pfl->cfi_table[0x12] = 'Y'; pfl->cfi_table[0x13] = 0x02; pfl->cfi_table[0x14] = 0x00; pfl->cfi_table[0x15] = 0x31; pfl->cfi_table[0x16] = 0x00; pfl->cfi_table[0x17] = 0x00; pfl->cfi_table[0x18] = 0x00; pfl->cfi_table[0x19] = 0x00; pfl->cfi_table[0x1A] = 0x00; pfl->cfi_table[0x1B] = 0x27; pfl->cfi_table[0x1C] = 0x36; pfl->cfi_table[0x1D] = 0x00; pfl->cfi_table[0x1E] = 0x00; pfl->cfi_table[0x1F] = 0x07; pfl->cfi_table[0x20] = 0x00; pfl->cfi_table[0x21] = 0x09; pfl->cfi_table[0x22] = 0x0C; pfl->cfi_table[0x23] = 0x01; pfl->cfi_table[0x24] = 0x00; pfl->cfi_table[0x25] = 0x0A; pfl->cfi_table[0x26] = 0x0D; pfl->cfi_table[0x27] = ctz32(chip_len); pfl->cfi_table[0x28] = 0x02; pfl->cfi_table[0x29] = 0x00; pfl->cfi_table[0x2A] = 0x00; pfl->cfi_table[0x2B] = 0x00; pfl->cfi_table[0x2C] = 0x01; pfl->cfi_table[0x2D] = pfl->nb_blocs - 1; pfl->cfi_table[0x2E] = (pfl->nb_blocs - 1) >> 8; pfl->cfi_table[0x2F] = pfl->sector_len >> 8; pfl->cfi_table[0x30] = pfl->sector_len >> 16; pfl->cfi_table[0x31] = 'P'; pfl->cfi_table[0x32] = 'R'; pfl->cfi_table[0x33] = 'I'; pfl->cfi_table[0x34] = '1'; pfl->cfi_table[0x35] = '0'; pfl->cfi_table[0x36] = 0x00; pfl->cfi_table[0x37] = 0x00; pfl->cfi_table[0x38] = 0x00; pfl->cfi_table[0x39] = 0x00; pfl->cfi_table[0x3a] = 0x00; pfl->cfi_table[0x3b] = 0x00; pfl->cfi_table[0x3c] = 0x00;
[ "static void FUNC_0(DeviceState *VAR_0, Error **VAR_1)\n{", "pflash_t *pfl = CFI_PFLASH02(VAR_0);", "uint32_t chip_len;", "int VAR_2;", "Error *local_err = NULL;", "chip_len = pfl->sector_len * pfl->nb_blocs;", "#if 0\nif (total_len != (8 * 1024 * 1024) && total_len != (16 * 1024 * 1024) &&\ntotal_len != (32 * 1024 * 1024) && total_len != (64 * 1024 * 1024))\nreturn NULL;", "#endif\nmemory_region_init_rom_device(&pfl->orig_mem, OBJECT(pfl), pfl->be ?\n&pflash_cfi02_ops_be : &pflash_cfi02_ops_le,\npfl, pfl->name, chip_len, &local_err);", "if (local_err) {", "error_propagate(VAR_1, local_err);", "vmstate_register_ram(&pfl->orig_mem, DEVICE(pfl));", "pfl->storage = memory_region_get_ram_ptr(&pfl->orig_mem);", "pfl->chip_len = chip_len;", "if (pfl->blk) {", "VAR_2 = blk_pread(pfl->blk, 0, pfl->storage, chip_len);", "if (VAR_2 < 0) {", "vmstate_unregister_ram(&pfl->orig_mem, DEVICE(pfl));", "error_setg(VAR_1, \"failed to read the initial flash content\");", "pflash_setup_mappings(pfl);", "pfl->rom_mode = 1;", "sysbus_init_mmio(SYS_BUS_DEVICE(VAR_0), &pfl->mem);", "if (pfl->blk) {", "pfl->ro = blk_is_read_only(pfl->blk);", "} else {", "pfl->ro = 0;", "pfl->timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, pflash_timer, pfl);", "pfl->wcycle = 0;", "pfl->cmd = 0;", "pfl->status = 0;", "pfl->cfi_len = 0x52;", "pfl->cfi_table[0x10] = 'Q';", "pfl->cfi_table[0x11] = 'R';", "pfl->cfi_table[0x12] = 'Y';", "pfl->cfi_table[0x13] = 0x02;", "pfl->cfi_table[0x14] = 0x00;", "pfl->cfi_table[0x15] = 0x31;", "pfl->cfi_table[0x16] = 0x00;", "pfl->cfi_table[0x17] = 0x00;", "pfl->cfi_table[0x18] = 0x00;", "pfl->cfi_table[0x19] = 0x00;", "pfl->cfi_table[0x1A] = 0x00;", "pfl->cfi_table[0x1B] = 0x27;", "pfl->cfi_table[0x1C] = 0x36;", "pfl->cfi_table[0x1D] = 0x00;", "pfl->cfi_table[0x1E] = 0x00;", "pfl->cfi_table[0x1F] = 0x07;", "pfl->cfi_table[0x20] = 0x00;", "pfl->cfi_table[0x21] = 0x09;", "pfl->cfi_table[0x22] = 0x0C;", "pfl->cfi_table[0x23] = 0x01;", "pfl->cfi_table[0x24] = 0x00;", "pfl->cfi_table[0x25] = 0x0A;", "pfl->cfi_table[0x26] = 0x0D;", "pfl->cfi_table[0x27] = ctz32(chip_len);", "pfl->cfi_table[0x28] = 0x02;", "pfl->cfi_table[0x29] = 0x00;", "pfl->cfi_table[0x2A] = 0x00;", "pfl->cfi_table[0x2B] = 0x00;", "pfl->cfi_table[0x2C] = 0x01;", "pfl->cfi_table[0x2D] = pfl->nb_blocs - 1;", "pfl->cfi_table[0x2E] = (pfl->nb_blocs - 1) >> 8;", "pfl->cfi_table[0x2F] = pfl->sector_len >> 8;", "pfl->cfi_table[0x30] = pfl->sector_len >> 16;", "pfl->cfi_table[0x31] = 'P';", "pfl->cfi_table[0x32] = 'R';", "pfl->cfi_table[0x33] = 'I';", "pfl->cfi_table[0x34] = '1';", "pfl->cfi_table[0x35] = '0';", "pfl->cfi_table[0x36] = 0x00;", "pfl->cfi_table[0x37] = 0x00;", "pfl->cfi_table[0x38] = 0x00;", "pfl->cfi_table[0x39] = 0x00;", "pfl->cfi_table[0x3a] = 0x00;", "pfl->cfi_table[0x3b] = 0x00;", "pfl->cfi_table[0x3c] = 0x00;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 9, 10, 11, 12 ], [ 13, 14, 15, 16 ], [ 17 ], [ 18 ], [ 19 ], [ 20 ], [ 21 ], [ 22 ], [ 24 ], [ 25 ], [ 26 ], [ 27 ], [ 28 ], [ 29 ], [ 30 ], [ 31 ], [ 32 ], [ 33 ], [ 34 ], [ 35 ], [ 36 ], [ 37 ], [ 38 ], [ 40 ], [ 42 ], [ 43 ], [ 44 ], [ 46 ], [ 47 ], [ 49 ], [ 50 ], [ 52 ], [ 53 ], [ 55 ], [ 56 ], [ 58 ], [ 60 ], [ 62 ], [ 64 ], [ 66 ], [ 68 ], [ 70 ], [ 72 ], [ 74 ], [ 76 ], [ 78 ], [ 80 ], [ 82 ], [ 84 ], [ 85 ], [ 89 ], [ 90 ], [ 92 ], [ 94 ], [ 95 ], [ 96 ], [ 97 ], [ 99 ], [ 100 ], [ 101 ], [ 102 ], [ 103 ], [ 104 ], [ 105 ], [ 106 ], [ 107 ], [ 108 ], [ 109 ], [ 110 ] ]
2,413
float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run) { float q; int qmin, qmax; float br_compensation; double diff; double short_term_q; double fps; int picture_number = s->picture_number; int64_t wanted_bits; RateControlContext *rcc = &s->rc_context; AVCodecContext *a = s->avctx; RateControlEntry local_rce, *rce; double bits; double rate_factor; int var; const int pict_type = s->pict_type; Picture * const pic = &s->current_picture; emms_c(); #if CONFIG_LIBXVID if ((s->flags & CODEC_FLAG_PASS2) && s->avctx->rc_strategy == FF_RC_STRATEGY_XVID) return ff_xvid_rate_estimate_qscale(s, dry_run); #endif get_qminmax(&qmin, &qmax, s, pict_type); fps = get_fps(s->avctx); /* update predictors */ if (picture_number > 2 && !dry_run) { const int last_var = s->last_pict_type == AV_PICTURE_TYPE_I ? rcc->last_mb_var_sum : rcc->last_mc_mb_var_sum; av_assert1(s->frame_bits >= s->stuffing_bits); update_predictor(&rcc->pred[s->last_pict_type], rcc->last_qscale, sqrt(last_var), s->frame_bits - s->stuffing_bits); } if (s->flags & CODEC_FLAG_PASS2) { assert(picture_number >= 0); if (picture_number >= rcc->num_entries) { av_log(s, AV_LOG_ERROR, "Input is longer than 2-pass log file\n"); return -1; } rce = &rcc->entry[picture_number]; wanted_bits = rce->expected_bits; } else { Picture *dts_pic; rce = &local_rce; /* FIXME add a dts field to AVFrame and ensure it is set and use it * here instead of reordering but the reordering is simpler for now * until H.264 B-pyramid must be handled. */ if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) dts_pic = s->current_picture_ptr; else dts_pic = s->last_picture_ptr; if (!dts_pic || dts_pic->f.pts == AV_NOPTS_VALUE) wanted_bits = (uint64_t)(s->bit_rate * (double)picture_number / fps); else wanted_bits = (uint64_t)(s->bit_rate * (double)dts_pic->f.pts / fps); } diff = s->total_bits - wanted_bits; br_compensation = (a->bit_rate_tolerance - diff) / a->bit_rate_tolerance; if (br_compensation <= 0.0) br_compensation = 0.001; var = pict_type == AV_PICTURE_TYPE_I ? pic->mb_var_sum : pic->mc_mb_var_sum; short_term_q = 0; /* avoid warning */ if (s->flags & CODEC_FLAG_PASS2) { if (pict_type != AV_PICTURE_TYPE_I) assert(pict_type == rce->new_pict_type); q = rce->new_qscale / br_compensation; av_dlog(s, "%f %f %f last:%d var:%d type:%d//\n", q, rce->new_qscale, br_compensation, s->frame_bits, var, pict_type); } else { rce->pict_type = rce->new_pict_type = pict_type; rce->mc_mb_var_sum = pic->mc_mb_var_sum; rce->mb_var_sum = pic->mb_var_sum; rce->qscale = FF_QP2LAMBDA * 2; rce->f_code = s->f_code; rce->b_code = s->b_code; rce->misc_bits = 1; bits = predict_size(&rcc->pred[pict_type], rce->qscale, sqrt(var)); if (pict_type == AV_PICTURE_TYPE_I) { rce->i_count = s->mb_num; rce->i_tex_bits = bits; rce->p_tex_bits = 0; rce->mv_bits = 0; } else { rce->i_count = 0; // FIXME we do know this approx rce->i_tex_bits = 0; rce->p_tex_bits = bits * 0.9; rce->mv_bits = bits * 0.1; } rcc->i_cplx_sum[pict_type] += rce->i_tex_bits * rce->qscale; rcc->p_cplx_sum[pict_type] += rce->p_tex_bits * rce->qscale; rcc->mv_bits_sum[pict_type] += rce->mv_bits; rcc->frame_count[pict_type]++; bits = rce->i_tex_bits + rce->p_tex_bits; rate_factor = rcc->pass1_wanted_bits / rcc->pass1_rc_eq_output_sum * br_compensation; q = get_qscale(s, rce, rate_factor, picture_number); if (q < 0) return -1; assert(q > 0.0); q = get_diff_limited_q(s, rce, q); assert(q > 0.0); // FIXME type dependent blur like in 2-pass if (pict_type == AV_PICTURE_TYPE_P || s->intra_only) { rcc->short_term_qsum *= a->qblur; rcc->short_term_qcount *= a->qblur; rcc->short_term_qsum += q; rcc->short_term_qcount++; q = short_term_q = rcc->short_term_qsum / rcc->short_term_qcount; } assert(q > 0.0); q = modify_qscale(s, rce, q, picture_number); rcc->pass1_wanted_bits += s->bit_rate / fps; assert(q > 0.0); } if (s->avctx->debug & FF_DEBUG_RC) { av_log(s->avctx, AV_LOG_DEBUG, "%c qp:%d<%2.1f<%d %d want:%d total:%d comp:%f st_q:%2.2f " "size:%d var:%"PRId64"/%"PRId64" br:%d fps:%d\n", av_get_picture_type_char(pict_type), qmin, q, qmax, picture_number, (int)wanted_bits / 1000, (int)s->total_bits / 1000, br_compensation, short_term_q, s->frame_bits, pic->mb_var_sum, pic->mc_mb_var_sum, s->bit_rate / 1000, (int)fps); } if (q < qmin) q = qmin; else if (q > qmax) q = qmax; if (s->adaptive_quant) adaptive_quantization(s, q); else q = (int)(q + 0.5); if (!dry_run) { rcc->last_qscale = q; rcc->last_mc_mb_var_sum = pic->mc_mb_var_sum; rcc->last_mb_var_sum = pic->mb_var_sum; } return q; }
true
FFmpeg
b4356c9cc28197bb8da626ece08d4a062b62afc8
float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run) { float q; int qmin, qmax; float br_compensation; double diff; double short_term_q; double fps; int picture_number = s->picture_number; int64_t wanted_bits; RateControlContext *rcc = &s->rc_context; AVCodecContext *a = s->avctx; RateControlEntry local_rce, *rce; double bits; double rate_factor; int var; const int pict_type = s->pict_type; Picture * const pic = &s->current_picture; emms_c(); #if CONFIG_LIBXVID if ((s->flags & CODEC_FLAG_PASS2) && s->avctx->rc_strategy == FF_RC_STRATEGY_XVID) return ff_xvid_rate_estimate_qscale(s, dry_run); #endif get_qminmax(&qmin, &qmax, s, pict_type); fps = get_fps(s->avctx); if (picture_number > 2 && !dry_run) { const int last_var = s->last_pict_type == AV_PICTURE_TYPE_I ? rcc->last_mb_var_sum : rcc->last_mc_mb_var_sum; av_assert1(s->frame_bits >= s->stuffing_bits); update_predictor(&rcc->pred[s->last_pict_type], rcc->last_qscale, sqrt(last_var), s->frame_bits - s->stuffing_bits); } if (s->flags & CODEC_FLAG_PASS2) { assert(picture_number >= 0); if (picture_number >= rcc->num_entries) { av_log(s, AV_LOG_ERROR, "Input is longer than 2-pass log file\n"); return -1; } rce = &rcc->entry[picture_number]; wanted_bits = rce->expected_bits; } else { Picture *dts_pic; rce = &local_rce; if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) dts_pic = s->current_picture_ptr; else dts_pic = s->last_picture_ptr; if (!dts_pic || dts_pic->f.pts == AV_NOPTS_VALUE) wanted_bits = (uint64_t)(s->bit_rate * (double)picture_number / fps); else wanted_bits = (uint64_t)(s->bit_rate * (double)dts_pic->f.pts / fps); } diff = s->total_bits - wanted_bits; br_compensation = (a->bit_rate_tolerance - diff) / a->bit_rate_tolerance; if (br_compensation <= 0.0) br_compensation = 0.001; var = pict_type == AV_PICTURE_TYPE_I ? pic->mb_var_sum : pic->mc_mb_var_sum; short_term_q = 0; if (s->flags & CODEC_FLAG_PASS2) { if (pict_type != AV_PICTURE_TYPE_I) assert(pict_type == rce->new_pict_type); q = rce->new_qscale / br_compensation; av_dlog(s, "%f %f %f last:%d var:%d type:%d br_compensation, s->frame_bits, var, pict_type); } else { rce->pict_type = rce->new_pict_type = pict_type; rce->mc_mb_var_sum = pic->mc_mb_var_sum; rce->mb_var_sum = pic->mb_var_sum; rce->qscale = FF_QP2LAMBDA * 2; rce->f_code = s->f_code; rce->b_code = s->b_code; rce->misc_bits = 1; bits = predict_size(&rcc->pred[pict_type], rce->qscale, sqrt(var)); if (pict_type == AV_PICTURE_TYPE_I) { rce->i_count = s->mb_num; rce->i_tex_bits = bits; rce->p_tex_bits = 0; rce->mv_bits = 0; } else { rce->i_count = 0; rce->i_tex_bits = 0; rce->p_tex_bits = bits * 0.9; rce->mv_bits = bits * 0.1; } rcc->i_cplx_sum[pict_type] += rce->i_tex_bits * rce->qscale; rcc->p_cplx_sum[pict_type] += rce->p_tex_bits * rce->qscale; rcc->mv_bits_sum[pict_type] += rce->mv_bits; rcc->frame_count[pict_type]++; bits = rce->i_tex_bits + rce->p_tex_bits; rate_factor = rcc->pass1_wanted_bits / rcc->pass1_rc_eq_output_sum * br_compensation; q = get_qscale(s, rce, rate_factor, picture_number); if (q < 0) return -1; assert(q > 0.0); q = get_diff_limited_q(s, rce, q); assert(q > 0.0); if (pict_type == AV_PICTURE_TYPE_P || s->intra_only) { rcc->short_term_qsum *= a->qblur; rcc->short_term_qcount *= a->qblur; rcc->short_term_qsum += q; rcc->short_term_qcount++; q = short_term_q = rcc->short_term_qsum / rcc->short_term_qcount; } assert(q > 0.0); q = modify_qscale(s, rce, q, picture_number); rcc->pass1_wanted_bits += s->bit_rate / fps; assert(q > 0.0); } if (s->avctx->debug & FF_DEBUG_RC) { av_log(s->avctx, AV_LOG_DEBUG, "%c qp:%d<%2.1f<%d %d want:%d total:%d comp:%f st_q:%2.2f " "size:%d var:%"PRId64"/%"PRId64" br:%d fps:%d\n", av_get_picture_type_char(pict_type), qmin, q, qmax, picture_number, (int)wanted_bits / 1000, (int)s->total_bits / 1000, br_compensation, short_term_q, s->frame_bits, pic->mb_var_sum, pic->mc_mb_var_sum, s->bit_rate / 1000, (int)fps); } if (q < qmin) q = qmin; else if (q > qmax) q = qmax; if (s->adaptive_quant) adaptive_quantization(s, q); else q = (int)(q + 0.5); if (!dry_run) { rcc->last_qscale = q; rcc->last_mc_mb_var_sum = pic->mc_mb_var_sum; rcc->last_mb_var_sum = pic->mb_var_sum; } return q; }
{ "code": [ " int var;", " const int last_var = s->last_pict_type == AV_PICTURE_TYPE_I ? rcc->last_mb_var_sum", " : rcc->last_mc_mb_var_sum;" ], "line_no": [ 31, 63, 65 ] }
float FUNC_0(MpegEncContext *VAR_0, int VAR_1) { float VAR_2; int VAR_3, VAR_4; float VAR_5; double VAR_6; double VAR_7; double VAR_8; int VAR_9 = VAR_0->VAR_9; int64_t wanted_bits; RateControlContext *rcc = &VAR_0->rc_context; AVCodecContext *a = VAR_0->avctx; RateControlEntry local_rce, *rce; double VAR_10; double VAR_11; int VAR_12; const int VAR_13 = VAR_0->VAR_13; Picture * const pic = &VAR_0->current_picture; emms_c(); #if CONFIG_LIBXVID if ((VAR_0->flags & CODEC_FLAG_PASS2) && VAR_0->avctx->rc_strategy == FF_RC_STRATEGY_XVID) return ff_xvid_rate_estimate_qscale(VAR_0, VAR_1); #endif get_qminmax(&VAR_3, &VAR_4, VAR_0, VAR_13); VAR_8 = get_fps(VAR_0->avctx); if (VAR_9 > 2 && !VAR_1) { const int VAR_14 = VAR_0->last_pict_type == AV_PICTURE_TYPE_I ? rcc->last_mb_var_sum : rcc->last_mc_mb_var_sum; av_assert1(VAR_0->frame_bits >= VAR_0->stuffing_bits); update_predictor(&rcc->pred[VAR_0->last_pict_type], rcc->last_qscale, sqrt(VAR_14), VAR_0->frame_bits - VAR_0->stuffing_bits); } if (VAR_0->flags & CODEC_FLAG_PASS2) { assert(VAR_9 >= 0); if (VAR_9 >= rcc->num_entries) { av_log(VAR_0, AV_LOG_ERROR, "Input is longer than 2-pass log file\n"); return -1; } rce = &rcc->entry[VAR_9]; wanted_bits = rce->expected_bits; } else { Picture *dts_pic; rce = &local_rce; if (VAR_0->VAR_13 == AV_PICTURE_TYPE_B || VAR_0->low_delay) dts_pic = VAR_0->current_picture_ptr; else dts_pic = VAR_0->last_picture_ptr; if (!dts_pic || dts_pic->f.pts == AV_NOPTS_VALUE) wanted_bits = (uint64_t)(VAR_0->bit_rate * (double)VAR_9 / VAR_8); else wanted_bits = (uint64_t)(VAR_0->bit_rate * (double)dts_pic->f.pts / VAR_8); } VAR_6 = VAR_0->total_bits - wanted_bits; VAR_5 = (a->bit_rate_tolerance - VAR_6) / a->bit_rate_tolerance; if (VAR_5 <= 0.0) VAR_5 = 0.001; VAR_12 = VAR_13 == AV_PICTURE_TYPE_I ? pic->mb_var_sum : pic->mc_mb_var_sum; VAR_7 = 0; if (VAR_0->flags & CODEC_FLAG_PASS2) { if (VAR_13 != AV_PICTURE_TYPE_I) assert(VAR_13 == rce->new_pict_type); VAR_2 = rce->new_qscale / VAR_5; av_dlog(VAR_0, "%f %f %f last:%d VAR_12:%d type:%d VAR_5, VAR_0->frame_bits, VAR_12, VAR_13); } else { rce->VAR_13 = rce->new_pict_type = VAR_13; rce->mc_mb_var_sum = pic->mc_mb_var_sum; rce->mb_var_sum = pic->mb_var_sum; rce->qscale = FF_QP2LAMBDA * 2; rce->f_code = VAR_0->f_code; rce->b_code = VAR_0->b_code; rce->misc_bits = 1; VAR_10 = predict_size(&rcc->pred[VAR_13], rce->qscale, sqrt(VAR_12)); if (VAR_13 == AV_PICTURE_TYPE_I) { rce->i_count = VAR_0->mb_num; rce->i_tex_bits = VAR_10; rce->p_tex_bits = 0; rce->mv_bits = 0; } else { rce->i_count = 0; rce->i_tex_bits = 0; rce->p_tex_bits = VAR_10 * 0.9; rce->mv_bits = VAR_10 * 0.1; } rcc->i_cplx_sum[VAR_13] += rce->i_tex_bits * rce->qscale; rcc->p_cplx_sum[VAR_13] += rce->p_tex_bits * rce->qscale; rcc->mv_bits_sum[VAR_13] += rce->mv_bits; rcc->frame_count[VAR_13]++; VAR_10 = rce->i_tex_bits + rce->p_tex_bits; VAR_11 = rcc->pass1_wanted_bits / rcc->pass1_rc_eq_output_sum * VAR_5; VAR_2 = get_qscale(VAR_0, rce, VAR_11, VAR_9); if (VAR_2 < 0) return -1; assert(VAR_2 > 0.0); VAR_2 = get_diff_limited_q(VAR_0, rce, VAR_2); assert(VAR_2 > 0.0); if (VAR_13 == AV_PICTURE_TYPE_P || VAR_0->intra_only) { rcc->short_term_qsum *= a->qblur; rcc->short_term_qcount *= a->qblur; rcc->short_term_qsum += VAR_2; rcc->short_term_qcount++; VAR_2 = VAR_7 = rcc->short_term_qsum / rcc->short_term_qcount; } assert(VAR_2 > 0.0); VAR_2 = modify_qscale(VAR_0, rce, VAR_2, VAR_9); rcc->pass1_wanted_bits += VAR_0->bit_rate / VAR_8; assert(VAR_2 > 0.0); } if (VAR_0->avctx->debug & FF_DEBUG_RC) { av_log(VAR_0->avctx, AV_LOG_DEBUG, "%c qp:%d<%2.1f<%d %d want:%d total:%d comp:%f st_q:%2.2f " "size:%d VAR_12:%"PRId64"/%"PRId64" br:%d VAR_8:%d\n", av_get_picture_type_char(VAR_13), VAR_3, VAR_2, VAR_4, VAR_9, (int)wanted_bits / 1000, (int)VAR_0->total_bits / 1000, VAR_5, VAR_7, VAR_0->frame_bits, pic->mb_var_sum, pic->mc_mb_var_sum, VAR_0->bit_rate / 1000, (int)VAR_8); } if (VAR_2 < VAR_3) VAR_2 = VAR_3; else if (VAR_2 > VAR_4) VAR_2 = VAR_4; if (VAR_0->adaptive_quant) adaptive_quantization(VAR_0, VAR_2); else VAR_2 = (int)(VAR_2 + 0.5); if (!VAR_1) { rcc->last_qscale = VAR_2; rcc->last_mc_mb_var_sum = pic->mc_mb_var_sum; rcc->last_mb_var_sum = pic->mb_var_sum; } return VAR_2; }
[ "float FUNC_0(MpegEncContext *VAR_0, int VAR_1)\n{", "float VAR_2;", "int VAR_3, VAR_4;", "float VAR_5;", "double VAR_6;", "double VAR_7;", "double VAR_8;", "int VAR_9 = VAR_0->VAR_9;", "int64_t wanted_bits;", "RateControlContext *rcc = &VAR_0->rc_context;", "AVCodecContext *a = VAR_0->avctx;", "RateControlEntry local_rce, *rce;", "double VAR_10;", "double VAR_11;", "int VAR_12;", "const int VAR_13 = VAR_0->VAR_13;", "Picture * const pic = &VAR_0->current_picture;", "emms_c();", "#if CONFIG_LIBXVID\nif ((VAR_0->flags & CODEC_FLAG_PASS2) &&\nVAR_0->avctx->rc_strategy == FF_RC_STRATEGY_XVID)\nreturn ff_xvid_rate_estimate_qscale(VAR_0, VAR_1);", "#endif\nget_qminmax(&VAR_3, &VAR_4, VAR_0, VAR_13);", "VAR_8 = get_fps(VAR_0->avctx);", "if (VAR_9 > 2 && !VAR_1) {", "const int VAR_14 = VAR_0->last_pict_type == AV_PICTURE_TYPE_I ? rcc->last_mb_var_sum\n: rcc->last_mc_mb_var_sum;", "av_assert1(VAR_0->frame_bits >= VAR_0->stuffing_bits);", "update_predictor(&rcc->pred[VAR_0->last_pict_type],\nrcc->last_qscale,\nsqrt(VAR_14),\nVAR_0->frame_bits - VAR_0->stuffing_bits);", "}", "if (VAR_0->flags & CODEC_FLAG_PASS2) {", "assert(VAR_9 >= 0);", "if (VAR_9 >= rcc->num_entries) {", "av_log(VAR_0, AV_LOG_ERROR, \"Input is longer than 2-pass log file\\n\");", "return -1;", "}", "rce = &rcc->entry[VAR_9];", "wanted_bits = rce->expected_bits;", "} else {", "Picture *dts_pic;", "rce = &local_rce;", "if (VAR_0->VAR_13 == AV_PICTURE_TYPE_B || VAR_0->low_delay)\ndts_pic = VAR_0->current_picture_ptr;", "else\ndts_pic = VAR_0->last_picture_ptr;", "if (!dts_pic || dts_pic->f.pts == AV_NOPTS_VALUE)\nwanted_bits = (uint64_t)(VAR_0->bit_rate * (double)VAR_9 / VAR_8);", "else\nwanted_bits = (uint64_t)(VAR_0->bit_rate * (double)dts_pic->f.pts / VAR_8);", "}", "VAR_6 = VAR_0->total_bits - wanted_bits;", "VAR_5 = (a->bit_rate_tolerance - VAR_6) / a->bit_rate_tolerance;", "if (VAR_5 <= 0.0)\nVAR_5 = 0.001;", "VAR_12 = VAR_13 == AV_PICTURE_TYPE_I ? pic->mb_var_sum : pic->mc_mb_var_sum;", "VAR_7 = 0;", "if (VAR_0->flags & CODEC_FLAG_PASS2) {", "if (VAR_13 != AV_PICTURE_TYPE_I)\nassert(VAR_13 == rce->new_pict_type);", "VAR_2 = rce->new_qscale / VAR_5;", "av_dlog(VAR_0, \"%f %f %f last:%d VAR_12:%d type:%d\nVAR_5, VAR_0->frame_bits, VAR_12, VAR_13);", "} else {", "rce->VAR_13 =\nrce->new_pict_type = VAR_13;", "rce->mc_mb_var_sum = pic->mc_mb_var_sum;", "rce->mb_var_sum = pic->mb_var_sum;", "rce->qscale = FF_QP2LAMBDA * 2;", "rce->f_code = VAR_0->f_code;", "rce->b_code = VAR_0->b_code;", "rce->misc_bits = 1;", "VAR_10 = predict_size(&rcc->pred[VAR_13], rce->qscale, sqrt(VAR_12));", "if (VAR_13 == AV_PICTURE_TYPE_I) {", "rce->i_count = VAR_0->mb_num;", "rce->i_tex_bits = VAR_10;", "rce->p_tex_bits = 0;", "rce->mv_bits = 0;", "} else {", "rce->i_count = 0;", "rce->i_tex_bits = 0;", "rce->p_tex_bits = VAR_10 * 0.9;", "rce->mv_bits = VAR_10 * 0.1;", "}", "rcc->i_cplx_sum[VAR_13] += rce->i_tex_bits * rce->qscale;", "rcc->p_cplx_sum[VAR_13] += rce->p_tex_bits * rce->qscale;", "rcc->mv_bits_sum[VAR_13] += rce->mv_bits;", "rcc->frame_count[VAR_13]++;", "VAR_10 = rce->i_tex_bits + rce->p_tex_bits;", "VAR_11 = rcc->pass1_wanted_bits /\nrcc->pass1_rc_eq_output_sum * VAR_5;", "VAR_2 = get_qscale(VAR_0, rce, VAR_11, VAR_9);", "if (VAR_2 < 0)\nreturn -1;", "assert(VAR_2 > 0.0);", "VAR_2 = get_diff_limited_q(VAR_0, rce, VAR_2);", "assert(VAR_2 > 0.0);", "if (VAR_13 == AV_PICTURE_TYPE_P || VAR_0->intra_only) {", "rcc->short_term_qsum *= a->qblur;", "rcc->short_term_qcount *= a->qblur;", "rcc->short_term_qsum += VAR_2;", "rcc->short_term_qcount++;", "VAR_2 = VAR_7 = rcc->short_term_qsum / rcc->short_term_qcount;", "}", "assert(VAR_2 > 0.0);", "VAR_2 = modify_qscale(VAR_0, rce, VAR_2, VAR_9);", "rcc->pass1_wanted_bits += VAR_0->bit_rate / VAR_8;", "assert(VAR_2 > 0.0);", "}", "if (VAR_0->avctx->debug & FF_DEBUG_RC) {", "av_log(VAR_0->avctx, AV_LOG_DEBUG,\n\"%c qp:%d<%2.1f<%d %d want:%d total:%d comp:%f st_q:%2.2f \"\n\"size:%d VAR_12:%\"PRId64\"/%\"PRId64\" br:%d VAR_8:%d\\n\",\nav_get_picture_type_char(VAR_13),\nVAR_3, VAR_2, VAR_4, VAR_9,\n(int)wanted_bits / 1000, (int)VAR_0->total_bits / 1000,\nVAR_5, VAR_7, VAR_0->frame_bits,\npic->mb_var_sum, pic->mc_mb_var_sum,\nVAR_0->bit_rate / 1000, (int)VAR_8);", "}", "if (VAR_2 < VAR_3)\nVAR_2 = VAR_3;", "else if (VAR_2 > VAR_4)\nVAR_2 = VAR_4;", "if (VAR_0->adaptive_quant)\nadaptive_quantization(VAR_0, VAR_2);", "else\nVAR_2 = (int)(VAR_2 + 0.5);", "if (!VAR_1) {", "rcc->last_qscale = VAR_2;", "rcc->last_mc_mb_var_sum = pic->mc_mb_var_sum;", "rcc->last_mb_var_sum = pic->mb_var_sum;", "}", "return VAR_2;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 41, 43, 45, 47 ], [ 49, 53 ], [ 57 ], [ 61 ], [ 63, 65 ], [ 67 ], [ 69, 71, 73, 75 ], [ 77 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 111, 113 ], [ 115, 117 ], [ 121, 123 ], [ 125, 127 ], [ 129 ], [ 133 ], [ 135 ], [ 137, 139 ], [ 143 ], [ 147 ], [ 149 ], [ 151, 153 ], [ 157 ], [ 159, 161 ], [ 163 ], [ 165, 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 217 ], [ 219, 221 ], [ 225 ], [ 227, 229 ], [ 233 ], [ 235 ], [ 237 ], [ 243 ], [ 245 ], [ 247 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 263 ], [ 267 ], [ 271 ], [ 273 ], [ 277 ], [ 279, 281, 283, 285, 287, 289, 291, 293, 295 ], [ 297 ], [ 301, 303 ], [ 305, 307 ], [ 311, 313 ], [ 315, 317 ], [ 321 ], [ 323 ], [ 325 ], [ 327 ], [ 329 ], [ 331 ], [ 333 ] ]
2,416
static void pred_spatial_direct_motion(H264Context * const h, int *mb_type){ MpegEncContext * const s = &h->s; int b8_stride = 2; int b4_stride = h->b_stride; int mb_xy = h->mb_xy, mb_y = s->mb_y; int mb_type_col[2]; const int16_t (*l1mv0)[2], (*l1mv1)[2]; const int8_t *l1ref0, *l1ref1; const int is_b8x8 = IS_8X8(*mb_type); unsigned int sub_mb_type= MB_TYPE_L0L1; int i8, i4; int ref[2]; int mv[2]; int list; assert(h->ref_list[1][0].f.reference & 3); await_reference_mb_row(h, &h->ref_list[1][0], s->mb_y + !!IS_INTERLACED(*mb_type)); #define MB_TYPE_16x16_OR_INTRA (MB_TYPE_16x16|MB_TYPE_INTRA4x4|MB_TYPE_INTRA16x16|MB_TYPE_INTRA_PCM) /* ref = min(neighbors) */ for(list=0; list<2; list++){ int left_ref = h->ref_cache[list][scan8[0] - 1]; int top_ref = h->ref_cache[list][scan8[0] - 8]; int refc = h->ref_cache[list][scan8[0] - 8 + 4]; const int16_t *C= h->mv_cache[list][ scan8[0] - 8 + 4]; if(refc == PART_NOT_AVAILABLE){ refc = h->ref_cache[list][scan8[0] - 8 - 1]; C = h-> mv_cache[list][scan8[0] - 8 - 1]; ref[list] = FFMIN3((unsigned)left_ref, (unsigned)top_ref, (unsigned)refc); if(ref[list] >= 0){ //this is just pred_motion() but with the cases removed that cannot happen for direct blocks const int16_t * const A= h->mv_cache[list][ scan8[0] - 1 ]; const int16_t * const B= h->mv_cache[list][ scan8[0] - 8 ]; int match_count= (left_ref==ref[list]) + (top_ref==ref[list]) + (refc==ref[list]); if(match_count > 1){ //most common mv[list]= pack16to32(mid_pred(A[0], B[0], C[0]), mid_pred(A[1], B[1], C[1]) ); }else { assert(match_count==1); if(left_ref==ref[list]){ mv[list]= AV_RN32A(A); }else if(top_ref==ref[list]){ mv[list]= AV_RN32A(B); }else{ mv[list]= AV_RN32A(C); }else{ int mask= ~(MB_TYPE_L0 << (2*list)); mv[list] = 0; ref[list] = -1; if(!is_b8x8) *mb_type &= mask; sub_mb_type &= mask; if(ref[0] < 0 && ref[1] < 0){ ref[0] = ref[1] = 0; if(!is_b8x8) *mb_type |= MB_TYPE_L0L1; sub_mb_type |= MB_TYPE_L0L1; if(!(is_b8x8|mv[0]|mv[1])){ fill_rectangle(&h->ref_cache[0][scan8[0]], 4, 4, 8, (uint8_t)ref[0], 1); fill_rectangle(&h->ref_cache[1][scan8[0]], 4, 4, 8, (uint8_t)ref[1], 1); fill_rectangle(&h->mv_cache[0][scan8[0]], 4, 4, 8, 0, 4); fill_rectangle(&h->mv_cache[1][scan8[0]], 4, 4, 8, 0, 4); *mb_type= (*mb_type & ~(MB_TYPE_8x8|MB_TYPE_16x8|MB_TYPE_8x16|MB_TYPE_P1L0|MB_TYPE_P1L1))|MB_TYPE_16x16|MB_TYPE_DIRECT2; return; if (IS_INTERLACED(h->ref_list[1][0].f.mb_type[mb_xy])) { // AFL/AFR/FR/FL -> AFL/FL if (!IS_INTERLACED(*mb_type)) { // AFR/FR -> AFL/FL mb_y = (s->mb_y&~1) + h->col_parity; mb_xy= s->mb_x + ((s->mb_y&~1) + h->col_parity)*s->mb_stride; b8_stride = 0; }else{ mb_y += h->col_fieldoff; mb_xy += s->mb_stride*h->col_fieldoff; // non zero for FL -> FL & differ parity goto single_col; }else{ // AFL/AFR/FR/FL -> AFR/FR if(IS_INTERLACED(*mb_type)){ // AFL /FL -> AFR/FR mb_y = s->mb_y&~1; mb_xy= s->mb_x + (s->mb_y&~1)*s->mb_stride; mb_type_col[0] = h->ref_list[1][0].f.mb_type[mb_xy]; mb_type_col[1] = h->ref_list[1][0].f.mb_type[mb_xy + s->mb_stride]; b8_stride = 2+4*s->mb_stride; b4_stride *= 6; sub_mb_type |= MB_TYPE_16x16|MB_TYPE_DIRECT2; /* B_SUB_8x8 */ if( (mb_type_col[0] & MB_TYPE_16x16_OR_INTRA) && (mb_type_col[1] & MB_TYPE_16x16_OR_INTRA) && !is_b8x8){ *mb_type |= MB_TYPE_16x8 |MB_TYPE_DIRECT2; /* B_16x8 */ }else{ *mb_type |= MB_TYPE_8x8; }else{ // AFR/FR -> AFR/FR single_col: mb_type_col[0] = mb_type_col[1] = h->ref_list[1][0].f.mb_type[mb_xy]; sub_mb_type |= MB_TYPE_16x16|MB_TYPE_DIRECT2; /* B_SUB_8x8 */ if(!is_b8x8 && (mb_type_col[0] & MB_TYPE_16x16_OR_INTRA)){ *mb_type |= MB_TYPE_16x16|MB_TYPE_DIRECT2; /* B_16x16 */ }else if(!is_b8x8 && (mb_type_col[0] & (MB_TYPE_16x8|MB_TYPE_8x16))){ *mb_type |= MB_TYPE_DIRECT2 | (mb_type_col[0] & (MB_TYPE_16x8|MB_TYPE_8x16)); }else{ if(!h->sps.direct_8x8_inference_flag){ /* FIXME save sub mb types from previous frames (or derive from MVs) * so we know exactly what block size to use */ sub_mb_type += (MB_TYPE_8x8-MB_TYPE_16x16); /* B_SUB_4x4 */ *mb_type |= MB_TYPE_8x8; await_reference_mb_row(h, &h->ref_list[1][0], mb_y); l1mv0 = &h->ref_list[1][0].f.motion_val[0][h->mb2b_xy [mb_xy]]; l1mv1 = &h->ref_list[1][0].f.motion_val[1][h->mb2b_xy [mb_xy]]; l1ref0 = &h->ref_list[1][0].f.ref_index [0][4 * mb_xy]; l1ref1 = &h->ref_list[1][0].f.ref_index [1][4 * mb_xy]; if(!b8_stride){ if(s->mb_y&1){ l1ref0 += 2; l1ref1 += 2; l1mv0 += 2*b4_stride; l1mv1 += 2*b4_stride; if(IS_INTERLACED(*mb_type) != IS_INTERLACED(mb_type_col[0])){ int n=0; for(i8=0; i8<4; i8++){ int x8 = i8&1; int y8 = i8>>1; int xy8 = x8+y8*b8_stride; int xy4 = 3*x8+y8*b4_stride; int a,b; if(is_b8x8 && !IS_DIRECT(h->sub_mb_type[i8])) continue; h->sub_mb_type[i8] = sub_mb_type; fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, (uint8_t)ref[0], 1); fill_rectangle(&h->ref_cache[1][scan8[i8*4]], 2, 2, 8, (uint8_t)ref[1], 1); if(!IS_INTRA(mb_type_col[y8]) && !h->ref_list[1][0].long_ref && ( (l1ref0[xy8] == 0 && FFABS(l1mv0[xy4][0]) <= 1 && FFABS(l1mv0[xy4][1]) <= 1) || (l1ref0[xy8] < 0 && l1ref1[xy8] == 0 && FFABS(l1mv1[xy4][0]) <= 1 && FFABS(l1mv1[xy4][1]) <= 1))){ a=b=0; if(ref[0] > 0) a= mv[0]; if(ref[1] > 0) b= mv[1]; n++; }else{ a= mv[0]; b= mv[1]; fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, a, 4); fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, b, 4); if(!is_b8x8 && !(n&3)) *mb_type= (*mb_type & ~(MB_TYPE_8x8|MB_TYPE_16x8|MB_TYPE_8x16|MB_TYPE_P1L0|MB_TYPE_P1L1))|MB_TYPE_16x16|MB_TYPE_DIRECT2; }else if(IS_16X16(*mb_type)){ int a,b; fill_rectangle(&h->ref_cache[0][scan8[0]], 4, 4, 8, (uint8_t)ref[0], 1); fill_rectangle(&h->ref_cache[1][scan8[0]], 4, 4, 8, (uint8_t)ref[1], 1); if(!IS_INTRA(mb_type_col[0]) && !h->ref_list[1][0].long_ref && ( (l1ref0[0] == 0 && FFABS(l1mv0[0][0]) <= 1 && FFABS(l1mv0[0][1]) <= 1) || (l1ref0[0] < 0 && l1ref1[0] == 0 && FFABS(l1mv1[0][0]) <= 1 && FFABS(l1mv1[0][1]) <= 1 && h->x264_build>33U))){ a=b=0; if(ref[0] > 0) a= mv[0]; if(ref[1] > 0) b= mv[1]; }else{ a= mv[0]; b= mv[1]; fill_rectangle(&h->mv_cache[0][scan8[0]], 4, 4, 8, a, 4); fill_rectangle(&h->mv_cache[1][scan8[0]], 4, 4, 8, b, 4); }else{ int n=0; for(i8=0; i8<4; i8++){ const int x8 = i8&1; const int y8 = i8>>1; if(is_b8x8 && !IS_DIRECT(h->sub_mb_type[i8])) continue; h->sub_mb_type[i8] = sub_mb_type; fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, mv[0], 4); fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, mv[1], 4); fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, (uint8_t)ref[0], 1); fill_rectangle(&h->ref_cache[1][scan8[i8*4]], 2, 2, 8, (uint8_t)ref[1], 1); assert(b8_stride==2); /* col_zero_flag */ if(!IS_INTRA(mb_type_col[0]) && !h->ref_list[1][0].long_ref && ( l1ref0[i8] == 0 || (l1ref0[i8] < 0 && l1ref1[i8] == 0 && h->x264_build>33U))){ const int16_t (*l1mv)[2]= l1ref0[i8] == 0 ? l1mv0 : l1mv1; if(IS_SUB_8X8(sub_mb_type)){ const int16_t *mv_col = l1mv[x8*3 + y8*3*b4_stride]; if(FFABS(mv_col[0]) <= 1 && FFABS(mv_col[1]) <= 1){ if(ref[0] == 0) fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, 0, 4); if(ref[1] == 0) fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, 0, 4); n+=4; }else{ int m=0; for(i4=0; i4<4; i4++){ const int16_t *mv_col = l1mv[x8*2 + (i4&1) + (y8*2 + (i4>>1))*b4_stride]; if(FFABS(mv_col[0]) <= 1 && FFABS(mv_col[1]) <= 1){ if(ref[0] == 0) AV_ZERO32(h->mv_cache[0][scan8[i8*4+i4]]); if(ref[1] == 0) AV_ZERO32(h->mv_cache[1][scan8[i8*4+i4]]); m++; if(!(m&3)) h->sub_mb_type[i8]+= MB_TYPE_16x16 - MB_TYPE_8x8; n+=m; if(!is_b8x8 && !(n&15)) *mb_type= (*mb_type & ~(MB_TYPE_8x8|MB_TYPE_16x8|MB_TYPE_8x16|MB_TYPE_P1L0|MB_TYPE_P1L1))|MB_TYPE_16x16|MB_TYPE_DIRECT2;
true
FFmpeg
758ec111538ccd487686e8677aa754ee4d82beaa
static void pred_spatial_direct_motion(H264Context * const h, int *mb_type){ MpegEncContext * const s = &h->s; int b8_stride = 2; int b4_stride = h->b_stride; int mb_xy = h->mb_xy, mb_y = s->mb_y; int mb_type_col[2]; const int16_t (*l1mv0)[2], (*l1mv1)[2]; const int8_t *l1ref0, *l1ref1; const int is_b8x8 = IS_8X8(*mb_type); unsigned int sub_mb_type= MB_TYPE_L0L1; int i8, i4; int ref[2]; int mv[2]; int list; assert(h->ref_list[1][0].f.reference & 3); await_reference_mb_row(h, &h->ref_list[1][0], s->mb_y + !!IS_INTERLACED(*mb_type)); #define MB_TYPE_16x16_OR_INTRA (MB_TYPE_16x16|MB_TYPE_INTRA4x4|MB_TYPE_INTRA16x16|MB_TYPE_INTRA_PCM) for(list=0; list<2; list++){ int left_ref = h->ref_cache[list][scan8[0] - 1]; int top_ref = h->ref_cache[list][scan8[0] - 8]; int refc = h->ref_cache[list][scan8[0] - 8 + 4]; const int16_t *C= h->mv_cache[list][ scan8[0] - 8 + 4]; if(refc == PART_NOT_AVAILABLE){ refc = h->ref_cache[list][scan8[0] - 8 - 1]; C = h-> mv_cache[list][scan8[0] - 8 - 1]; ref[list] = FFMIN3((unsigned)left_ref, (unsigned)top_ref, (unsigned)refc); if(ref[list] >= 0){ const int16_t * const A= h->mv_cache[list][ scan8[0] - 1 ]; const int16_t * const B= h->mv_cache[list][ scan8[0] - 8 ]; int match_count= (left_ref==ref[list]) + (top_ref==ref[list]) + (refc==ref[list]); if(match_count > 1){ mv[list]= pack16to32(mid_pred(A[0], B[0], C[0]), mid_pred(A[1], B[1], C[1]) ); }else { assert(match_count==1); if(left_ref==ref[list]){ mv[list]= AV_RN32A(A); }else if(top_ref==ref[list]){ mv[list]= AV_RN32A(B); }else{ mv[list]= AV_RN32A(C); }else{ int mask= ~(MB_TYPE_L0 << (2*list)); mv[list] = 0; ref[list] = -1; if(!is_b8x8) *mb_type &= mask; sub_mb_type &= mask; if(ref[0] < 0 && ref[1] < 0){ ref[0] = ref[1] = 0; if(!is_b8x8) *mb_type |= MB_TYPE_L0L1; sub_mb_type |= MB_TYPE_L0L1; if(!(is_b8x8|mv[0]|mv[1])){ fill_rectangle(&h->ref_cache[0][scan8[0]], 4, 4, 8, (uint8_t)ref[0], 1); fill_rectangle(&h->ref_cache[1][scan8[0]], 4, 4, 8, (uint8_t)ref[1], 1); fill_rectangle(&h->mv_cache[0][scan8[0]], 4, 4, 8, 0, 4); fill_rectangle(&h->mv_cache[1][scan8[0]], 4, 4, 8, 0, 4); *mb_type= (*mb_type & ~(MB_TYPE_8x8|MB_TYPE_16x8|MB_TYPE_8x16|MB_TYPE_P1L0|MB_TYPE_P1L1))|MB_TYPE_16x16|MB_TYPE_DIRECT2; return; if (IS_INTERLACED(h->ref_list[1][0].f.mb_type[mb_xy])) { if (!IS_INTERLACED(*mb_type)) { mb_y = (s->mb_y&~1) + h->col_parity; mb_xy= s->mb_x + ((s->mb_y&~1) + h->col_parity)*s->mb_stride; b8_stride = 0; }else{ mb_y += h->col_fieldoff; mb_xy += s->mb_stride*h->col_fieldoff; goto single_col; }else{ if(IS_INTERLACED(*mb_type)){ mb_y = s->mb_y&~1; mb_xy= s->mb_x + (s->mb_y&~1)*s->mb_stride; mb_type_col[0] = h->ref_list[1][0].f.mb_type[mb_xy]; mb_type_col[1] = h->ref_list[1][0].f.mb_type[mb_xy + s->mb_stride]; b8_stride = 2+4*s->mb_stride; b4_stride *= 6; sub_mb_type |= MB_TYPE_16x16|MB_TYPE_DIRECT2; if( (mb_type_col[0] & MB_TYPE_16x16_OR_INTRA) && (mb_type_col[1] & MB_TYPE_16x16_OR_INTRA) && !is_b8x8){ *mb_type |= MB_TYPE_16x8 |MB_TYPE_DIRECT2; }else{ *mb_type |= MB_TYPE_8x8; }else{ single_col: mb_type_col[0] = mb_type_col[1] = h->ref_list[1][0].f.mb_type[mb_xy]; sub_mb_type |= MB_TYPE_16x16|MB_TYPE_DIRECT2; if(!is_b8x8 && (mb_type_col[0] & MB_TYPE_16x16_OR_INTRA)){ *mb_type |= MB_TYPE_16x16|MB_TYPE_DIRECT2; }else if(!is_b8x8 && (mb_type_col[0] & (MB_TYPE_16x8|MB_TYPE_8x16))){ *mb_type |= MB_TYPE_DIRECT2 | (mb_type_col[0] & (MB_TYPE_16x8|MB_TYPE_8x16)); }else{ if(!h->sps.direct_8x8_inference_flag){ sub_mb_type += (MB_TYPE_8x8-MB_TYPE_16x16); *mb_type |= MB_TYPE_8x8; await_reference_mb_row(h, &h->ref_list[1][0], mb_y); l1mv0 = &h->ref_list[1][0].f.motion_val[0][h->mb2b_xy [mb_xy]]; l1mv1 = &h->ref_list[1][0].f.motion_val[1][h->mb2b_xy [mb_xy]]; l1ref0 = &h->ref_list[1][0].f.ref_index [0][4 * mb_xy]; l1ref1 = &h->ref_list[1][0].f.ref_index [1][4 * mb_xy]; if(!b8_stride){ if(s->mb_y&1){ l1ref0 += 2; l1ref1 += 2; l1mv0 += 2*b4_stride; l1mv1 += 2*b4_stride; if(IS_INTERLACED(*mb_type) != IS_INTERLACED(mb_type_col[0])){ int n=0; for(i8=0; i8<4; i8++){ int x8 = i8&1; int y8 = i8>>1; int xy8 = x8+y8*b8_stride; int xy4 = 3*x8+y8*b4_stride; int a,b; if(is_b8x8 && !IS_DIRECT(h->sub_mb_type[i8])) continue; h->sub_mb_type[i8] = sub_mb_type; fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, (uint8_t)ref[0], 1); fill_rectangle(&h->ref_cache[1][scan8[i8*4]], 2, 2, 8, (uint8_t)ref[1], 1); if(!IS_INTRA(mb_type_col[y8]) && !h->ref_list[1][0].long_ref && ( (l1ref0[xy8] == 0 && FFABS(l1mv0[xy4][0]) <= 1 && FFABS(l1mv0[xy4][1]) <= 1) || (l1ref0[xy8] < 0 && l1ref1[xy8] == 0 && FFABS(l1mv1[xy4][0]) <= 1 && FFABS(l1mv1[xy4][1]) <= 1))){ a=b=0; if(ref[0] > 0) a= mv[0]; if(ref[1] > 0) b= mv[1]; n++; }else{ a= mv[0]; b= mv[1]; fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, a, 4); fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, b, 4); if(!is_b8x8 && !(n&3)) *mb_type= (*mb_type & ~(MB_TYPE_8x8|MB_TYPE_16x8|MB_TYPE_8x16|MB_TYPE_P1L0|MB_TYPE_P1L1))|MB_TYPE_16x16|MB_TYPE_DIRECT2; }else if(IS_16X16(*mb_type)){ int a,b; fill_rectangle(&h->ref_cache[0][scan8[0]], 4, 4, 8, (uint8_t)ref[0], 1); fill_rectangle(&h->ref_cache[1][scan8[0]], 4, 4, 8, (uint8_t)ref[1], 1); if(!IS_INTRA(mb_type_col[0]) && !h->ref_list[1][0].long_ref && ( (l1ref0[0] == 0 && FFABS(l1mv0[0][0]) <= 1 && FFABS(l1mv0[0][1]) <= 1) || (l1ref0[0] < 0 && l1ref1[0] == 0 && FFABS(l1mv1[0][0]) <= 1 && FFABS(l1mv1[0][1]) <= 1 && h->x264_build>33U))){ a=b=0; if(ref[0] > 0) a= mv[0]; if(ref[1] > 0) b= mv[1]; }else{ a= mv[0]; b= mv[1]; fill_rectangle(&h->mv_cache[0][scan8[0]], 4, 4, 8, a, 4); fill_rectangle(&h->mv_cache[1][scan8[0]], 4, 4, 8, b, 4); }else{ int n=0; for(i8=0; i8<4; i8++){ const int x8 = i8&1; const int y8 = i8>>1; if(is_b8x8 && !IS_DIRECT(h->sub_mb_type[i8])) continue; h->sub_mb_type[i8] = sub_mb_type; fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, mv[0], 4); fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, mv[1], 4); fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, (uint8_t)ref[0], 1); fill_rectangle(&h->ref_cache[1][scan8[i8*4]], 2, 2, 8, (uint8_t)ref[1], 1); assert(b8_stride==2); if(!IS_INTRA(mb_type_col[0]) && !h->ref_list[1][0].long_ref && ( l1ref0[i8] == 0 || (l1ref0[i8] < 0 && l1ref1[i8] == 0 && h->x264_build>33U))){ const int16_t (*l1mv)[2]= l1ref0[i8] == 0 ? l1mv0 : l1mv1; if(IS_SUB_8X8(sub_mb_type)){ const int16_t *mv_col = l1mv[x8*3 + y8*3*b4_stride]; if(FFABS(mv_col[0]) <= 1 && FFABS(mv_col[1]) <= 1){ if(ref[0] == 0) fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, 0, 4); if(ref[1] == 0) fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, 0, 4); n+=4; }else{ int m=0; for(i4=0; i4<4; i4++){ const int16_t *mv_col = l1mv[x8*2 + (i4&1) + (y8*2 + (i4>>1))*b4_stride]; if(FFABS(mv_col[0]) <= 1 && FFABS(mv_col[1]) <= 1){ if(ref[0] == 0) AV_ZERO32(h->mv_cache[0][scan8[i8*4+i4]]); if(ref[1] == 0) AV_ZERO32(h->mv_cache[1][scan8[i8*4+i4]]); m++; if(!(m&3)) h->sub_mb_type[i8]+= MB_TYPE_16x16 - MB_TYPE_8x8; n+=m; if(!is_b8x8 && !(n&15)) *mb_type= (*mb_type & ~(MB_TYPE_8x8|MB_TYPE_16x8|MB_TYPE_8x16|MB_TYPE_P1L0|MB_TYPE_P1L1))|MB_TYPE_16x16|MB_TYPE_DIRECT2;
{ "code": [], "line_no": [] }
static void FUNC_0(H264Context * const VAR_0, int *VAR_1){ MpegEncContext * const s = &VAR_0->s; int VAR_2 = 2; int VAR_3 = VAR_0->b_stride; int VAR_4 = VAR_0->VAR_4, VAR_5 = s->VAR_5; int VAR_6[2]; const FUNC_1 (*l1mv0)[2], (*l1mv1)[2]; const int8_t *VAR_7, *l1ref1; const int VAR_8 = IS_8X8(*VAR_1); unsigned int VAR_9= MB_TYPE_L0L1; int VAR_10, VAR_11; int VAR_12[2]; int VAR_13[2]; int VAR_14; assert(VAR_0->ref_list[1][0].f.reference & 3); await_reference_mb_row(VAR_0, &VAR_0->ref_list[1][0], s->VAR_5 + !!IS_INTERLACED(*VAR_1)); #define MB_TYPE_16x16_OR_INTRA (MB_TYPE_16x16|MB_TYPE_INTRA4x4|MB_TYPE_INTRA16x16|MB_TYPE_INTRA_PCM) for(VAR_14=0; VAR_14<2; VAR_14++){ int VAR_15 = VAR_0->ref_cache[VAR_14][scan8[0] - 1]; int VAR_16 = VAR_0->ref_cache[VAR_14][scan8[0] - 8]; int VAR_17 = VAR_0->ref_cache[VAR_14][scan8[0] - 8 + 4]; const FUNC_1 *VAR_18= VAR_0->mv_cache[VAR_14][ scan8[0] - 8 + 4]; if(VAR_17 == PART_NOT_AVAILABLE){ VAR_17 = VAR_0->ref_cache[VAR_14][scan8[0] - 8 - 1]; VAR_18 = VAR_0-> mv_cache[VAR_14][scan8[0] - 8 - 1]; VAR_12[VAR_14] = FFMIN3((unsigned)VAR_15, (unsigned)VAR_16, (unsigned)VAR_17); if(VAR_12[VAR_14] >= 0){ const FUNC_1 * const VAR_19= VAR_0->mv_cache[VAR_14][ scan8[0] - 1 ]; const FUNC_1 * const VAR_20= VAR_0->mv_cache[VAR_14][ scan8[0] - 8 ]; int VAR_21= (VAR_15==VAR_12[VAR_14]) + (VAR_16==VAR_12[VAR_14]) + (VAR_17==VAR_12[VAR_14]); if(VAR_21 > 1){ VAR_13[VAR_14]= pack16to32(mid_pred(VAR_19[0], VAR_20[0], VAR_18[0]), mid_pred(VAR_19[1], VAR_20[1], VAR_18[1]) ); }else { assert(VAR_21==1); if(VAR_15==VAR_12[VAR_14]){ VAR_13[VAR_14]= AV_RN32A(VAR_19); }else if(VAR_16==VAR_12[VAR_14]){ VAR_13[VAR_14]= AV_RN32A(VAR_20); }else{ VAR_13[VAR_14]= AV_RN32A(VAR_18); }else{ int mask= ~(MB_TYPE_L0 << (2*VAR_14)); VAR_13[VAR_14] = 0; VAR_12[VAR_14] = -1; if(!VAR_8) *VAR_1 &= mask; VAR_9 &= mask; if(VAR_12[0] < 0 && VAR_12[1] < 0){ VAR_12[0] = VAR_12[1] = 0; if(!VAR_8) *VAR_1 |= MB_TYPE_L0L1; VAR_9 |= MB_TYPE_L0L1; if(!(VAR_8|VAR_13[0]|VAR_13[1])){ fill_rectangle(&VAR_0->ref_cache[0][scan8[0]], 4, 4, 8, (uint8_t)VAR_12[0], 1); fill_rectangle(&VAR_0->ref_cache[1][scan8[0]], 4, 4, 8, (uint8_t)VAR_12[1], 1); fill_rectangle(&VAR_0->mv_cache[0][scan8[0]], 4, 4, 8, 0, 4); fill_rectangle(&VAR_0->mv_cache[1][scan8[0]], 4, 4, 8, 0, 4); *VAR_1= (*VAR_1 & ~(MB_TYPE_8x8|MB_TYPE_16x8|MB_TYPE_8x16|MB_TYPE_P1L0|MB_TYPE_P1L1))|MB_TYPE_16x16|MB_TYPE_DIRECT2; return; if (IS_INTERLACED(VAR_0->ref_list[1][0].f.VAR_1[VAR_4])) { if (!IS_INTERLACED(*VAR_1)) { VAR_5 = (s->VAR_5&~1) + VAR_0->col_parity; VAR_4= s->mb_x + ((s->VAR_5&~1) + VAR_0->col_parity)*s->mb_stride; VAR_2 = 0; }else{ VAR_5 += VAR_0->col_fieldoff; VAR_4 += s->mb_stride*VAR_0->col_fieldoff; goto single_col; }else{ if(IS_INTERLACED(*VAR_1)){ VAR_5 = s->VAR_5&~1; VAR_4= s->mb_x + (s->VAR_5&~1)*s->mb_stride; VAR_6[0] = VAR_0->ref_list[1][0].f.VAR_1[VAR_4]; VAR_6[1] = VAR_0->ref_list[1][0].f.VAR_1[VAR_4 + s->mb_stride]; VAR_2 = 2+4*s->mb_stride; VAR_3 *= 6; VAR_9 |= MB_TYPE_16x16|MB_TYPE_DIRECT2; if( (VAR_6[0] & MB_TYPE_16x16_OR_INTRA) && (VAR_6[1] & MB_TYPE_16x16_OR_INTRA) && !VAR_8){ *VAR_1 |= MB_TYPE_16x8 |MB_TYPE_DIRECT2; }else{ *VAR_1 |= MB_TYPE_8x8; }else{ single_col: VAR_6[0] = VAR_6[1] = VAR_0->ref_list[1][0].f.VAR_1[VAR_4]; VAR_9 |= MB_TYPE_16x16|MB_TYPE_DIRECT2; if(!VAR_8 && (VAR_6[0] & MB_TYPE_16x16_OR_INTRA)){ *VAR_1 |= MB_TYPE_16x16|MB_TYPE_DIRECT2; }else if(!VAR_8 && (VAR_6[0] & (MB_TYPE_16x8|MB_TYPE_8x16))){ *VAR_1 |= MB_TYPE_DIRECT2 | (VAR_6[0] & (MB_TYPE_16x8|MB_TYPE_8x16)); }else{ if(!VAR_0->sps.direct_8x8_inference_flag){ VAR_9 += (MB_TYPE_8x8-MB_TYPE_16x16); *VAR_1 |= MB_TYPE_8x8; await_reference_mb_row(VAR_0, &VAR_0->ref_list[1][0], VAR_5); l1mv0 = &VAR_0->ref_list[1][0].f.motion_val[0][VAR_0->mb2b_xy [VAR_4]]; l1mv1 = &VAR_0->ref_list[1][0].f.motion_val[1][VAR_0->mb2b_xy [VAR_4]]; VAR_7 = &VAR_0->ref_list[1][0].f.ref_index [0][4 * VAR_4]; l1ref1 = &VAR_0->ref_list[1][0].f.ref_index [1][4 * VAR_4]; if(!VAR_2){ if(s->VAR_5&1){ VAR_7 += 2; l1ref1 += 2; l1mv0 += 2*VAR_3; l1mv1 += 2*VAR_3; if(IS_INTERLACED(*VAR_1) != IS_INTERLACED(VAR_6[0])){ int n=0; for(VAR_10=0; VAR_10<4; VAR_10++){ int x8 = VAR_10&1; int y8 = VAR_10>>1; int xy8 = x8+y8*VAR_2; int xy4 = 3*x8+y8*VAR_3; int a,b; if(VAR_8 && !IS_DIRECT(VAR_0->VAR_9[VAR_10])) continue; VAR_0->VAR_9[VAR_10] = VAR_9; fill_rectangle(&VAR_0->ref_cache[0][scan8[VAR_10*4]], 2, 2, 8, (uint8_t)VAR_12[0], 1); fill_rectangle(&VAR_0->ref_cache[1][scan8[VAR_10*4]], 2, 2, 8, (uint8_t)VAR_12[1], 1); if(!IS_INTRA(VAR_6[y8]) && !VAR_0->ref_list[1][0].long_ref && ( (VAR_7[xy8] == 0 && FFABS(l1mv0[xy4][0]) <= 1 && FFABS(l1mv0[xy4][1]) <= 1) || (VAR_7[xy8] < 0 && l1ref1[xy8] == 0 && FFABS(l1mv1[xy4][0]) <= 1 && FFABS(l1mv1[xy4][1]) <= 1))){ a=b=0; if(VAR_12[0] > 0) a= VAR_13[0]; if(VAR_12[1] > 0) b= VAR_13[1]; n++; }else{ a= VAR_13[0]; b= VAR_13[1]; fill_rectangle(&VAR_0->mv_cache[0][scan8[VAR_10*4]], 2, 2, 8, a, 4); fill_rectangle(&VAR_0->mv_cache[1][scan8[VAR_10*4]], 2, 2, 8, b, 4); if(!VAR_8 && !(n&3)) *VAR_1= (*VAR_1 & ~(MB_TYPE_8x8|MB_TYPE_16x8|MB_TYPE_8x16|MB_TYPE_P1L0|MB_TYPE_P1L1))|MB_TYPE_16x16|MB_TYPE_DIRECT2; }else if(IS_16X16(*VAR_1)){ int a,b; fill_rectangle(&VAR_0->ref_cache[0][scan8[0]], 4, 4, 8, (uint8_t)VAR_12[0], 1); fill_rectangle(&VAR_0->ref_cache[1][scan8[0]], 4, 4, 8, (uint8_t)VAR_12[1], 1); if(!IS_INTRA(VAR_6[0]) && !VAR_0->ref_list[1][0].long_ref && ( (VAR_7[0] == 0 && FFABS(l1mv0[0][0]) <= 1 && FFABS(l1mv0[0][1]) <= 1) || (VAR_7[0] < 0 && l1ref1[0] == 0 && FFABS(l1mv1[0][0]) <= 1 && FFABS(l1mv1[0][1]) <= 1 && VAR_0->x264_build>33U))){ a=b=0; if(VAR_12[0] > 0) a= VAR_13[0]; if(VAR_12[1] > 0) b= VAR_13[1]; }else{ a= VAR_13[0]; b= VAR_13[1]; fill_rectangle(&VAR_0->mv_cache[0][scan8[0]], 4, 4, 8, a, 4); fill_rectangle(&VAR_0->mv_cache[1][scan8[0]], 4, 4, 8, b, 4); }else{ int n=0; for(VAR_10=0; VAR_10<4; VAR_10++){ const int x8 = VAR_10&1; const int y8 = VAR_10>>1; if(VAR_8 && !IS_DIRECT(VAR_0->VAR_9[VAR_10])) continue; VAR_0->VAR_9[VAR_10] = VAR_9; fill_rectangle(&VAR_0->mv_cache[0][scan8[VAR_10*4]], 2, 2, 8, VAR_13[0], 4); fill_rectangle(&VAR_0->mv_cache[1][scan8[VAR_10*4]], 2, 2, 8, VAR_13[1], 4); fill_rectangle(&VAR_0->ref_cache[0][scan8[VAR_10*4]], 2, 2, 8, (uint8_t)VAR_12[0], 1); fill_rectangle(&VAR_0->ref_cache[1][scan8[VAR_10*4]], 2, 2, 8, (uint8_t)VAR_12[1], 1); assert(VAR_2==2); if(!IS_INTRA(VAR_6[0]) && !VAR_0->ref_list[1][0].long_ref && ( VAR_7[VAR_10] == 0 || (VAR_7[VAR_10] < 0 && l1ref1[VAR_10] == 0 && VAR_0->x264_build>33U))){ const FUNC_1 (*l1mv)[2]= VAR_7[VAR_10] == 0 ? l1mv0 : l1mv1; if(IS_SUB_8X8(VAR_9)){ const FUNC_1 *mv_col = l1mv[x8*3 + y8*3*VAR_3]; if(FFABS(mv_col[0]) <= 1 && FFABS(mv_col[1]) <= 1){ if(VAR_12[0] == 0) fill_rectangle(&VAR_0->mv_cache[0][scan8[VAR_10*4]], 2, 2, 8, 0, 4); if(VAR_12[1] == 0) fill_rectangle(&VAR_0->mv_cache[1][scan8[VAR_10*4]], 2, 2, 8, 0, 4); n+=4; }else{ int m=0; for(VAR_11=0; VAR_11<4; VAR_11++){ const FUNC_1 *mv_col = l1mv[x8*2 + (VAR_11&1) + (y8*2 + (VAR_11>>1))*VAR_3]; if(FFABS(mv_col[0]) <= 1 && FFABS(mv_col[1]) <= 1){ if(VAR_12[0] == 0) AV_ZERO32(VAR_0->mv_cache[0][scan8[VAR_10*4+VAR_11]]); if(VAR_12[1] == 0) AV_ZERO32(VAR_0->mv_cache[1][scan8[VAR_10*4+VAR_11]]); m++; if(!(m&3)) VAR_0->VAR_9[VAR_10]+= MB_TYPE_16x16 - MB_TYPE_8x8; n+=m; if(!VAR_8 && !(n&15)) *VAR_1= (*VAR_1 & ~(MB_TYPE_8x8|MB_TYPE_16x8|MB_TYPE_8x16|MB_TYPE_P1L0|MB_TYPE_P1L1))|MB_TYPE_16x16|MB_TYPE_DIRECT2;
[ "static void FUNC_0(H264Context * const VAR_0, int *VAR_1){", "MpegEncContext * const s = &VAR_0->s;", "int VAR_2 = 2;", "int VAR_3 = VAR_0->b_stride;", "int VAR_4 = VAR_0->VAR_4, VAR_5 = s->VAR_5;", "int VAR_6[2];", "const FUNC_1 (*l1mv0)[2], (*l1mv1)[2];", "const int8_t *VAR_7, *l1ref1;", "const int VAR_8 = IS_8X8(*VAR_1);", "unsigned int VAR_9= MB_TYPE_L0L1;", "int VAR_10, VAR_11;", "int VAR_12[2];", "int VAR_13[2];", "int VAR_14;", "assert(VAR_0->ref_list[1][0].f.reference & 3);", "await_reference_mb_row(VAR_0, &VAR_0->ref_list[1][0], s->VAR_5 + !!IS_INTERLACED(*VAR_1));", "#define MB_TYPE_16x16_OR_INTRA (MB_TYPE_16x16|MB_TYPE_INTRA4x4|MB_TYPE_INTRA16x16|MB_TYPE_INTRA_PCM)\nfor(VAR_14=0; VAR_14<2; VAR_14++){", "int VAR_15 = VAR_0->ref_cache[VAR_14][scan8[0] - 1];", "int VAR_16 = VAR_0->ref_cache[VAR_14][scan8[0] - 8];", "int VAR_17 = VAR_0->ref_cache[VAR_14][scan8[0] - 8 + 4];", "const FUNC_1 *VAR_18= VAR_0->mv_cache[VAR_14][ scan8[0] - 8 + 4];", "if(VAR_17 == PART_NOT_AVAILABLE){", "VAR_17 = VAR_0->ref_cache[VAR_14][scan8[0] - 8 - 1];", "VAR_18 = VAR_0-> mv_cache[VAR_14][scan8[0] - 8 - 1];", "VAR_12[VAR_14] = FFMIN3((unsigned)VAR_15, (unsigned)VAR_16, (unsigned)VAR_17);", "if(VAR_12[VAR_14] >= 0){", "const FUNC_1 * const VAR_19= VAR_0->mv_cache[VAR_14][ scan8[0] - 1 ];", "const FUNC_1 * const VAR_20= VAR_0->mv_cache[VAR_14][ scan8[0] - 8 ];", "int VAR_21= (VAR_15==VAR_12[VAR_14]) + (VAR_16==VAR_12[VAR_14]) + (VAR_17==VAR_12[VAR_14]);", "if(VAR_21 > 1){", "VAR_13[VAR_14]= pack16to32(mid_pred(VAR_19[0], VAR_20[0], VAR_18[0]),\nmid_pred(VAR_19[1], VAR_20[1], VAR_18[1]) );", "}else {", "assert(VAR_21==1);", "if(VAR_15==VAR_12[VAR_14]){", "VAR_13[VAR_14]= AV_RN32A(VAR_19);", "}else if(VAR_16==VAR_12[VAR_14]){", "VAR_13[VAR_14]= AV_RN32A(VAR_20);", "}else{", "VAR_13[VAR_14]= AV_RN32A(VAR_18);", "}else{", "int mask= ~(MB_TYPE_L0 << (2*VAR_14));", "VAR_13[VAR_14] = 0;", "VAR_12[VAR_14] = -1;", "if(!VAR_8)\n*VAR_1 &= mask;", "VAR_9 &= mask;", "if(VAR_12[0] < 0 && VAR_12[1] < 0){", "VAR_12[0] = VAR_12[1] = 0;", "if(!VAR_8)\n*VAR_1 |= MB_TYPE_L0L1;", "VAR_9 |= MB_TYPE_L0L1;", "if(!(VAR_8|VAR_13[0]|VAR_13[1])){", "fill_rectangle(&VAR_0->ref_cache[0][scan8[0]], 4, 4, 8, (uint8_t)VAR_12[0], 1);", "fill_rectangle(&VAR_0->ref_cache[1][scan8[0]], 4, 4, 8, (uint8_t)VAR_12[1], 1);", "fill_rectangle(&VAR_0->mv_cache[0][scan8[0]], 4, 4, 8, 0, 4);", "fill_rectangle(&VAR_0->mv_cache[1][scan8[0]], 4, 4, 8, 0, 4);", "*VAR_1= (*VAR_1 & ~(MB_TYPE_8x8|MB_TYPE_16x8|MB_TYPE_8x16|MB_TYPE_P1L0|MB_TYPE_P1L1))|MB_TYPE_16x16|MB_TYPE_DIRECT2;", "return;", "if (IS_INTERLACED(VAR_0->ref_list[1][0].f.VAR_1[VAR_4])) {", "if (!IS_INTERLACED(*VAR_1)) {", "VAR_5 = (s->VAR_5&~1) + VAR_0->col_parity;", "VAR_4= s->mb_x + ((s->VAR_5&~1) + VAR_0->col_parity)*s->mb_stride;", "VAR_2 = 0;", "}else{", "VAR_5 += VAR_0->col_fieldoff;", "VAR_4 += s->mb_stride*VAR_0->col_fieldoff;", "goto single_col;", "}else{", "if(IS_INTERLACED(*VAR_1)){", "VAR_5 = s->VAR_5&~1;", "VAR_4= s->mb_x + (s->VAR_5&~1)*s->mb_stride;", "VAR_6[0] = VAR_0->ref_list[1][0].f.VAR_1[VAR_4];", "VAR_6[1] = VAR_0->ref_list[1][0].f.VAR_1[VAR_4 + s->mb_stride];", "VAR_2 = 2+4*s->mb_stride;", "VAR_3 *= 6;", "VAR_9 |= MB_TYPE_16x16|MB_TYPE_DIRECT2;", "if( (VAR_6[0] & MB_TYPE_16x16_OR_INTRA)\n&& (VAR_6[1] & MB_TYPE_16x16_OR_INTRA)\n&& !VAR_8){", "*VAR_1 |= MB_TYPE_16x8 |MB_TYPE_DIRECT2;", "}else{", "*VAR_1 |= MB_TYPE_8x8;", "}else{", "single_col:\nVAR_6[0] =\nVAR_6[1] = VAR_0->ref_list[1][0].f.VAR_1[VAR_4];", "VAR_9 |= MB_TYPE_16x16|MB_TYPE_DIRECT2;", "if(!VAR_8 && (VAR_6[0] & MB_TYPE_16x16_OR_INTRA)){", "*VAR_1 |= MB_TYPE_16x16|MB_TYPE_DIRECT2;", "}else if(!VAR_8 && (VAR_6[0] & (MB_TYPE_16x8|MB_TYPE_8x16))){", "*VAR_1 |= MB_TYPE_DIRECT2 | (VAR_6[0] & (MB_TYPE_16x8|MB_TYPE_8x16));", "}else{", "if(!VAR_0->sps.direct_8x8_inference_flag){", "VAR_9 += (MB_TYPE_8x8-MB_TYPE_16x16);", "*VAR_1 |= MB_TYPE_8x8;", "await_reference_mb_row(VAR_0, &VAR_0->ref_list[1][0], VAR_5);", "l1mv0 = &VAR_0->ref_list[1][0].f.motion_val[0][VAR_0->mb2b_xy [VAR_4]];", "l1mv1 = &VAR_0->ref_list[1][0].f.motion_val[1][VAR_0->mb2b_xy [VAR_4]];", "VAR_7 = &VAR_0->ref_list[1][0].f.ref_index [0][4 * VAR_4];", "l1ref1 = &VAR_0->ref_list[1][0].f.ref_index [1][4 * VAR_4];", "if(!VAR_2){", "if(s->VAR_5&1){", "VAR_7 += 2;", "l1ref1 += 2;", "l1mv0 += 2*VAR_3;", "l1mv1 += 2*VAR_3;", "if(IS_INTERLACED(*VAR_1) != IS_INTERLACED(VAR_6[0])){", "int n=0;", "for(VAR_10=0; VAR_10<4; VAR_10++){", "int x8 = VAR_10&1;", "int y8 = VAR_10>>1;", "int xy8 = x8+y8*VAR_2;", "int xy4 = 3*x8+y8*VAR_3;", "int a,b;", "if(VAR_8 && !IS_DIRECT(VAR_0->VAR_9[VAR_10]))\ncontinue;", "VAR_0->VAR_9[VAR_10] = VAR_9;", "fill_rectangle(&VAR_0->ref_cache[0][scan8[VAR_10*4]], 2, 2, 8, (uint8_t)VAR_12[0], 1);", "fill_rectangle(&VAR_0->ref_cache[1][scan8[VAR_10*4]], 2, 2, 8, (uint8_t)VAR_12[1], 1);", "if(!IS_INTRA(VAR_6[y8]) && !VAR_0->ref_list[1][0].long_ref\n&& ( (VAR_7[xy8] == 0 && FFABS(l1mv0[xy4][0]) <= 1 && FFABS(l1mv0[xy4][1]) <= 1)\n|| (VAR_7[xy8] < 0 && l1ref1[xy8] == 0 && FFABS(l1mv1[xy4][0]) <= 1 && FFABS(l1mv1[xy4][1]) <= 1))){", "a=b=0;", "if(VAR_12[0] > 0)\na= VAR_13[0];", "if(VAR_12[1] > 0)\nb= VAR_13[1];", "n++;", "}else{", "a= VAR_13[0];", "b= VAR_13[1];", "fill_rectangle(&VAR_0->mv_cache[0][scan8[VAR_10*4]], 2, 2, 8, a, 4);", "fill_rectangle(&VAR_0->mv_cache[1][scan8[VAR_10*4]], 2, 2, 8, b, 4);", "if(!VAR_8 && !(n&3))\n*VAR_1= (*VAR_1 & ~(MB_TYPE_8x8|MB_TYPE_16x8|MB_TYPE_8x16|MB_TYPE_P1L0|MB_TYPE_P1L1))|MB_TYPE_16x16|MB_TYPE_DIRECT2;", "}else if(IS_16X16(*VAR_1)){", "int a,b;", "fill_rectangle(&VAR_0->ref_cache[0][scan8[0]], 4, 4, 8, (uint8_t)VAR_12[0], 1);", "fill_rectangle(&VAR_0->ref_cache[1][scan8[0]], 4, 4, 8, (uint8_t)VAR_12[1], 1);", "if(!IS_INTRA(VAR_6[0]) && !VAR_0->ref_list[1][0].long_ref\n&& ( (VAR_7[0] == 0 && FFABS(l1mv0[0][0]) <= 1 && FFABS(l1mv0[0][1]) <= 1)\n|| (VAR_7[0] < 0 && l1ref1[0] == 0 && FFABS(l1mv1[0][0]) <= 1 && FFABS(l1mv1[0][1]) <= 1\n&& VAR_0->x264_build>33U))){", "a=b=0;", "if(VAR_12[0] > 0)\na= VAR_13[0];", "if(VAR_12[1] > 0)\nb= VAR_13[1];", "}else{", "a= VAR_13[0];", "b= VAR_13[1];", "fill_rectangle(&VAR_0->mv_cache[0][scan8[0]], 4, 4, 8, a, 4);", "fill_rectangle(&VAR_0->mv_cache[1][scan8[0]], 4, 4, 8, b, 4);", "}else{", "int n=0;", "for(VAR_10=0; VAR_10<4; VAR_10++){", "const int x8 = VAR_10&1;", "const int y8 = VAR_10>>1;", "if(VAR_8 && !IS_DIRECT(VAR_0->VAR_9[VAR_10]))\ncontinue;", "VAR_0->VAR_9[VAR_10] = VAR_9;", "fill_rectangle(&VAR_0->mv_cache[0][scan8[VAR_10*4]], 2, 2, 8, VAR_13[0], 4);", "fill_rectangle(&VAR_0->mv_cache[1][scan8[VAR_10*4]], 2, 2, 8, VAR_13[1], 4);", "fill_rectangle(&VAR_0->ref_cache[0][scan8[VAR_10*4]], 2, 2, 8, (uint8_t)VAR_12[0], 1);", "fill_rectangle(&VAR_0->ref_cache[1][scan8[VAR_10*4]], 2, 2, 8, (uint8_t)VAR_12[1], 1);", "assert(VAR_2==2);", "if(!IS_INTRA(VAR_6[0]) && !VAR_0->ref_list[1][0].long_ref && ( VAR_7[VAR_10] == 0\n|| (VAR_7[VAR_10] < 0 && l1ref1[VAR_10] == 0\n&& VAR_0->x264_build>33U))){", "const FUNC_1 (*l1mv)[2]= VAR_7[VAR_10] == 0 ? l1mv0 : l1mv1;", "if(IS_SUB_8X8(VAR_9)){", "const FUNC_1 *mv_col = l1mv[x8*3 + y8*3*VAR_3];", "if(FFABS(mv_col[0]) <= 1 && FFABS(mv_col[1]) <= 1){", "if(VAR_12[0] == 0)\nfill_rectangle(&VAR_0->mv_cache[0][scan8[VAR_10*4]], 2, 2, 8, 0, 4);", "if(VAR_12[1] == 0)\nfill_rectangle(&VAR_0->mv_cache[1][scan8[VAR_10*4]], 2, 2, 8, 0, 4);", "n+=4;", "}else{", "int m=0;", "for(VAR_11=0; VAR_11<4; VAR_11++){", "const FUNC_1 *mv_col = l1mv[x8*2 + (VAR_11&1) + (y8*2 + (VAR_11>>1))*VAR_3];", "if(FFABS(mv_col[0]) <= 1 && FFABS(mv_col[1]) <= 1){", "if(VAR_12[0] == 0)\nAV_ZERO32(VAR_0->mv_cache[0][scan8[VAR_10*4+VAR_11]]);", "if(VAR_12[1] == 0)\nAV_ZERO32(VAR_0->mv_cache[1][scan8[VAR_10*4+VAR_11]]);", "m++;", "if(!(m&3))\nVAR_0->VAR_9[VAR_10]+= MB_TYPE_16x16 - MB_TYPE_8x8;", "n+=m;", "if(!VAR_8 && !(n&15))\n*VAR_1= (*VAR_1 & ~(MB_TYPE_8x8|MB_TYPE_16x8|MB_TYPE_8x16|MB_TYPE_P1L0|MB_TYPE_P1L1))|MB_TYPE_16x16|MB_TYPE_DIRECT2;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 35 ], [ 39, 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 64 ], [ 66 ], [ 70 ], [ 72 ], [ 76 ], [ 78 ], [ 80, 82 ], [ 84 ], [ 86 ], [ 88 ], [ 90 ], [ 92 ], [ 94 ], [ 96 ], [ 98 ], [ 102 ], [ 104 ], [ 106 ], [ 108 ], [ 110, 112 ], [ 114 ], [ 118 ], [ 120 ], [ 122, 124 ], [ 126 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 148 ], [ 150 ], [ 152 ], [ 154 ], [ 156 ], [ 158 ], [ 160 ], [ 162 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 189 ], [ 191, 193, 195 ], [ 197 ], [ 199 ], [ 201 ], [ 204 ], [ 206, 208, 210 ], [ 214 ], [ 216 ], [ 218 ], [ 220 ], [ 222 ], [ 224 ], [ 226 ], [ 232 ], [ 235 ], [ 242 ], [ 246 ], [ 248 ], [ 250 ], [ 252 ], [ 254 ], [ 256 ], [ 258 ], [ 260 ], [ 262 ], [ 264 ], [ 272 ], [ 274 ], [ 276 ], [ 278 ], [ 280 ], [ 282 ], [ 284 ], [ 286 ], [ 290, 292 ], [ 294 ], [ 298 ], [ 300 ], [ 302, 304, 306 ], [ 308 ], [ 310, 312 ], [ 314, 316 ], [ 318 ], [ 320 ], [ 322 ], [ 324 ], [ 327 ], [ 329 ], [ 332, 334 ], [ 336 ], [ 338 ], [ 342 ], [ 344 ], [ 346, 348, 350, 352 ], [ 354 ], [ 356, 358 ], [ 360, 362 ], [ 364 ], [ 366 ], [ 368 ], [ 371 ], [ 373 ], [ 375 ], [ 377 ], [ 379 ], [ 381 ], [ 383 ], [ 387, 389 ], [ 391 ], [ 395 ], [ 397 ], [ 399 ], [ 401 ], [ 405 ], [ 409, 411, 413 ], [ 415 ], [ 417 ], [ 419 ], [ 421 ], [ 423, 425 ], [ 427, 429 ], [ 431 ], [ 434 ], [ 436 ], [ 438 ], [ 440 ], [ 442 ], [ 444, 446 ], [ 448, 450 ], [ 452 ], [ 456, 458 ], [ 460 ], [ 465, 467 ] ]
2,417
int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags) { if(min_ts > ts || max_ts < ts) return -1; if (s->iformat->read_seek2) { int ret; ff_read_frame_flush(s); if (stream_index == -1 && s->nb_streams == 1) { AVRational time_base = s->streams[0]->time_base; ts = av_rescale_q(ts, AV_TIME_BASE_Q, time_base); min_ts = av_rescale_rnd(min_ts, time_base.den, time_base.num * (int64_t)AV_TIME_BASE, AV_ROUND_UP); max_ts = av_rescale_rnd(max_ts, time_base.den, time_base.num * (int64_t)AV_TIME_BASE, AV_ROUND_DOWN); } ret = s->iformat->read_seek2(s, stream_index, min_ts, ts, max_ts, flags); if (ret >= 0) avformat_queue_attached_pictures(s); return ret; } if(s->iformat->read_timestamp){ //try to seek via read_timestamp() } //Fallback to old API if new is not implemented but old is //Note the old has somewhat different semantics if (s->iformat->read_seek || 1) { int dir = (ts - (uint64_t)min_ts > (uint64_t)max_ts - ts ? AVSEEK_FLAG_BACKWARD : 0); int ret = av_seek_frame(s, stream_index, ts, flags | dir); if (ret<0 && ts != min_ts && max_ts != ts) { ret = av_seek_frame(s, stream_index, dir ? max_ts : min_ts, flags | dir); if (ret >= 0) ret = av_seek_frame(s, stream_index, ts, flags | (dir^AVSEEK_FLAG_BACKWARD)); } return ret; } // try some generic seek like seek_frame_generic() but with new ts semantics }
true
FFmpeg
98db90589651474366a32e14e3ad062ef3ca6707
int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags) { if(min_ts > ts || max_ts < ts) return -1; if (s->iformat->read_seek2) { int ret; ff_read_frame_flush(s); if (stream_index == -1 && s->nb_streams == 1) { AVRational time_base = s->streams[0]->time_base; ts = av_rescale_q(ts, AV_TIME_BASE_Q, time_base); min_ts = av_rescale_rnd(min_ts, time_base.den, time_base.num * (int64_t)AV_TIME_BASE, AV_ROUND_UP); max_ts = av_rescale_rnd(max_ts, time_base.den, time_base.num * (int64_t)AV_TIME_BASE, AV_ROUND_DOWN); } ret = s->iformat->read_seek2(s, stream_index, min_ts, ts, max_ts, flags); if (ret >= 0) avformat_queue_attached_pictures(s); return ret; } if(s->iformat->read_timestamp){ } if (s->iformat->read_seek || 1) { int dir = (ts - (uint64_t)min_ts > (uint64_t)max_ts - ts ? AVSEEK_FLAG_BACKWARD : 0); int ret = av_seek_frame(s, stream_index, ts, flags | dir); if (ret<0 && ts != min_ts && max_ts != ts) { ret = av_seek_frame(s, stream_index, dir ? max_ts : min_ts, flags | dir); if (ret >= 0) ret = av_seek_frame(s, stream_index, ts, flags | (dir^AVSEEK_FLAG_BACKWARD)); } return ret; } }
{ "code": [ " AV_ROUND_UP);", " AV_ROUND_DOWN);" ], "line_no": [ 29, 35 ] }
int FUNC_0(AVFormatContext *VAR_0, int VAR_1, int64_t VAR_2, int64_t VAR_3, int64_t VAR_4, int VAR_5) { if(VAR_2 > VAR_3 || VAR_4 < VAR_3) return -1; if (VAR_0->iformat->read_seek2) { int VAR_8; ff_read_frame_flush(VAR_0); if (VAR_1 == -1 && VAR_0->nb_streams == 1) { AVRational time_base = VAR_0->streams[0]->time_base; VAR_3 = av_rescale_q(VAR_3, AV_TIME_BASE_Q, time_base); VAR_2 = av_rescale_rnd(VAR_2, time_base.den, time_base.num * (int64_t)AV_TIME_BASE, AV_ROUND_UP); VAR_4 = av_rescale_rnd(VAR_4, time_base.den, time_base.num * (int64_t)AV_TIME_BASE, AV_ROUND_DOWN); } VAR_8 = VAR_0->iformat->read_seek2(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5); if (VAR_8 >= 0) avformat_queue_attached_pictures(VAR_0); return VAR_8; } if(VAR_0->iformat->read_timestamp){ } if (VAR_0->iformat->read_seek || 1) { int VAR_7 = (VAR_3 - (uint64_t)VAR_2 > (uint64_t)VAR_4 - VAR_3 ? AVSEEK_FLAG_BACKWARD : 0); int VAR_8 = av_seek_frame(VAR_0, VAR_1, VAR_3, VAR_5 | VAR_7); if (VAR_8<0 && VAR_3 != VAR_2 && VAR_4 != VAR_3) { VAR_8 = av_seek_frame(VAR_0, VAR_1, VAR_7 ? VAR_4 : VAR_2, VAR_5 | VAR_7); if (VAR_8 >= 0) VAR_8 = av_seek_frame(VAR_0, VAR_1, VAR_3, VAR_5 | (VAR_7^AVSEEK_FLAG_BACKWARD)); } return VAR_8; } }
[ "int FUNC_0(AVFormatContext *VAR_0, int VAR_1, int64_t VAR_2, int64_t VAR_3, int64_t VAR_4, int VAR_5)\n{", "if(VAR_2 > VAR_3 || VAR_4 < VAR_3)\nreturn -1;", "if (VAR_0->iformat->read_seek2) {", "int VAR_8;", "ff_read_frame_flush(VAR_0);", "if (VAR_1 == -1 && VAR_0->nb_streams == 1) {", "AVRational time_base = VAR_0->streams[0]->time_base;", "VAR_3 = av_rescale_q(VAR_3, AV_TIME_BASE_Q, time_base);", "VAR_2 = av_rescale_rnd(VAR_2, time_base.den,\ntime_base.num * (int64_t)AV_TIME_BASE,\nAV_ROUND_UP);", "VAR_4 = av_rescale_rnd(VAR_4, time_base.den,\ntime_base.num * (int64_t)AV_TIME_BASE,\nAV_ROUND_DOWN);", "}", "VAR_8 = VAR_0->iformat->read_seek2(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5);", "if (VAR_8 >= 0)\navformat_queue_attached_pictures(VAR_0);", "return VAR_8;", "}", "if(VAR_0->iformat->read_timestamp){", "}", "if (VAR_0->iformat->read_seek || 1) {", "int VAR_7 = (VAR_3 - (uint64_t)VAR_2 > (uint64_t)VAR_4 - VAR_3 ? AVSEEK_FLAG_BACKWARD : 0);", "int VAR_8 = av_seek_frame(VAR_0, VAR_1, VAR_3, VAR_5 | VAR_7);", "if (VAR_8<0 && VAR_3 != VAR_2 && VAR_4 != VAR_3) {", "VAR_8 = av_seek_frame(VAR_0, VAR_1, VAR_7 ? VAR_4 : VAR_2, VAR_5 | VAR_7);", "if (VAR_8 >= 0)\nVAR_8 = av_seek_frame(VAR_0, VAR_1, VAR_3, VAR_5 | (VAR_7^AVSEEK_FLAG_BACKWARD));", "}", "return VAR_8;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25, 27, 29 ], [ 31, 33, 35 ], [ 37 ], [ 41 ], [ 45, 47 ], [ 49 ], [ 51 ], [ 55 ], [ 59 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77, 79 ], [ 81 ], [ 83 ], [ 85 ], [ 91 ] ]
2,418
static inline void render_line_unrolled(intptr_t x, uint8_t y, int x1, intptr_t sy, int ady, int adx, float *buf) { int err = -adx; x -= x1 - 1; buf += x1 - 1; while (++x < 0) { err += ady; if (err >= 0) { err += ady - adx; y += sy; buf[x++] = ff_vorbis_floor1_inverse_db_table[y]; } buf[x] = ff_vorbis_floor1_inverse_db_table[y]; } if (x <= 0) { if (err + ady >= 0) y += sy; buf[x] = ff_vorbis_floor1_inverse_db_table[y]; } }
true
FFmpeg
24947d4988012f1f0fd467c83418615adc11c3e8
static inline void render_line_unrolled(intptr_t x, uint8_t y, int x1, intptr_t sy, int ady, int adx, float *buf) { int err = -adx; x -= x1 - 1; buf += x1 - 1; while (++x < 0) { err += ady; if (err >= 0) { err += ady - adx; y += sy; buf[x++] = ff_vorbis_floor1_inverse_db_table[y]; } buf[x] = ff_vorbis_floor1_inverse_db_table[y]; } if (x <= 0) { if (err + ady >= 0) y += sy; buf[x] = ff_vorbis_floor1_inverse_db_table[y]; } }
{ "code": [ "static inline void render_line_unrolled(intptr_t x, uint8_t y, int x1,", " buf[x++] = ff_vorbis_floor1_inverse_db_table[y];", " buf[x] = ff_vorbis_floor1_inverse_db_table[y];", " buf[x] = ff_vorbis_floor1_inverse_db_table[y];" ], "line_no": [ 1, 25, 29, 29 ] }
static inline void FUNC_0(intptr_t VAR_0, uint8_t VAR_1, int VAR_2, intptr_t VAR_3, int VAR_4, int VAR_5, float *VAR_6) { int VAR_7 = -VAR_5; VAR_0 -= VAR_2 - 1; VAR_6 += VAR_2 - 1; while (++VAR_0 < 0) { VAR_7 += VAR_4; if (VAR_7 >= 0) { VAR_7 += VAR_4 - VAR_5; VAR_1 += VAR_3; VAR_6[VAR_0++] = ff_vorbis_floor1_inverse_db_table[VAR_1]; } VAR_6[VAR_0] = ff_vorbis_floor1_inverse_db_table[VAR_1]; } if (VAR_0 <= 0) { if (VAR_7 + VAR_4 >= 0) VAR_1 += VAR_3; VAR_6[VAR_0] = ff_vorbis_floor1_inverse_db_table[VAR_1]; } }
[ "static inline void FUNC_0(intptr_t VAR_0, uint8_t VAR_1, int VAR_2,\nintptr_t VAR_3, int VAR_4, int VAR_5,\nfloat *VAR_6)\n{", "int VAR_7 = -VAR_5;", "VAR_0 -= VAR_2 - 1;", "VAR_6 += VAR_2 - 1;", "while (++VAR_0 < 0) {", "VAR_7 += VAR_4;", "if (VAR_7 >= 0) {", "VAR_7 += VAR_4 - VAR_5;", "VAR_1 += VAR_3;", "VAR_6[VAR_0++] = ff_vorbis_floor1_inverse_db_table[VAR_1];", "}", "VAR_6[VAR_0] = ff_vorbis_floor1_inverse_db_table[VAR_1];", "}", "if (VAR_0 <= 0) {", "if (VAR_7 + VAR_4 >= 0)\nVAR_1 += VAR_3;", "VAR_6[VAR_0] = ff_vorbis_floor1_inverse_db_table[VAR_1];", "}", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 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 ] ]
2,419
iscsi_connect_cb(struct iscsi_context *iscsi, int status, void *command_data, void *opaque) { struct IscsiTask *itask = opaque; struct scsi_task *task; if (status != 0) { itask->status = 1; itask->complete = 1; return; } task = iscsi_inquiry_task(iscsi, itask->iscsilun->lun, 0, 0, 36, iscsi_inquiry_cb, opaque); if (task == NULL) { error_report("iSCSI: failed to send inquiry command."); itask->status = 1; itask->complete = 1; return; } }
true
qemu
e829b0bb054ed3389e5b22dad61875e51674e629
iscsi_connect_cb(struct iscsi_context *iscsi, int status, void *command_data, void *opaque) { struct IscsiTask *itask = opaque; struct scsi_task *task; if (status != 0) { itask->status = 1; itask->complete = 1; return; } task = iscsi_inquiry_task(iscsi, itask->iscsilun->lun, 0, 0, 36, iscsi_inquiry_cb, opaque); if (task == NULL) { error_report("iSCSI: failed to send inquiry command."); itask->status = 1; itask->complete = 1; return; } }
{ "code": [ " struct IscsiTask *itask = opaque;", " if (status != 0) {", " itask->status = 1;", " itask->complete = 1;", " itask->status = 1;", " itask->complete = 1;", " struct IscsiTask *itask = opaque;", " if (status != 0) {", " itask->status = 1;", " itask->complete = 1;", " itask->status = 1;", " itask->complete = 1;", " void *opaque)", " struct IscsiTask *itask = opaque;", " if (status != 0) {", " itask->status = 1;", " itask->complete = 1;", " itask->status = 1;", " itask->complete = 1;", " itask->complete = 1;", "iscsi_connect_cb(struct iscsi_context *iscsi, int status, void *command_data,", " void *opaque)", " struct IscsiTask *itask = opaque;", " struct scsi_task *task;", " if (status != 0) {", " itask->status = 1;", " itask->complete = 1;", " task = iscsi_inquiry_task(iscsi, itask->iscsilun->lun,", " 0, 0, 36,", " iscsi_inquiry_cb, opaque);", " if (task == NULL) {", " error_report(\"iSCSI: failed to send inquiry command.\");", " itask->status = 1;", " itask->complete = 1;" ], "line_no": [ 7, 13, 15, 17, 15, 17, 7, 13, 15, 17, 15, 17, 3, 7, 13, 15, 17, 15, 17, 17, 1, 3, 7, 9, 13, 15, 17, 25, 27, 29, 31, 33, 15, 17 ] }
FUNC_0(struct iscsi_context *VAR_0, int VAR_1, void *VAR_2, void *VAR_3) { struct IscsiTask *VAR_4 = VAR_3; struct scsi_task *VAR_5; if (VAR_1 != 0) { VAR_4->VAR_1 = 1; VAR_4->complete = 1; return; } VAR_5 = iscsi_inquiry_task(VAR_0, VAR_4->iscsilun->lun, 0, 0, 36, iscsi_inquiry_cb, VAR_3); if (VAR_5 == NULL) { error_report("iSCSI: failed to send inquiry command."); VAR_4->VAR_1 = 1; VAR_4->complete = 1; return; } }
[ "FUNC_0(struct iscsi_context *VAR_0, int VAR_1, void *VAR_2,\nvoid *VAR_3)\n{", "struct IscsiTask *VAR_4 = VAR_3;", "struct scsi_task *VAR_5;", "if (VAR_1 != 0) {", "VAR_4->VAR_1 = 1;", "VAR_4->complete = 1;", "return;", "}", "VAR_5 = iscsi_inquiry_task(VAR_0, VAR_4->iscsilun->lun,\n0, 0, 36,\niscsi_inquiry_cb, VAR_3);", "if (VAR_5 == NULL) {", "error_report(\"iSCSI: failed to send inquiry command.\");", "VAR_4->VAR_1 = 1;", "VAR_4->complete = 1;", "return;", "}", "}" ]
[ 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25, 27, 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ] ]
2,420
static inline void s_zero(int cur_diff, struct G722Band *band) { int s_zero = 0; #define ACCUM(k, x, d) do { \ int tmp = x; \ band->zero_mem[k] = ((band->zero_mem[k] * 255) >> 8) + \ d*((band->diff_mem[k]^cur_diff) < 0 ? -128 : 128); \ band->diff_mem[k] = tmp; \ s_zero += (tmp * band->zero_mem[k]) >> 15; \ } while (0) if (cur_diff) { ACCUM(5, band->diff_mem[4], 1); ACCUM(4, band->diff_mem[3], 1); ACCUM(3, band->diff_mem[2], 1); ACCUM(2, band->diff_mem[1], 1); ACCUM(1, band->diff_mem[0], 1); ACCUM(0, cur_diff << 1, 1); } else { ACCUM(5, band->diff_mem[4], 0); ACCUM(4, band->diff_mem[3], 0); ACCUM(3, band->diff_mem[2], 0); ACCUM(2, band->diff_mem[1], 0); ACCUM(1, band->diff_mem[0], 0); ACCUM(0, cur_diff << 1, 0); } #undef ACCUM band->s_zero = s_zero; }
true
FFmpeg
f55df62998681c7702f008ce7c12a00b15e33f53
static inline void s_zero(int cur_diff, struct G722Band *band) { int s_zero = 0; #define ACCUM(k, x, d) do { \ int tmp = x; \ band->zero_mem[k] = ((band->zero_mem[k] * 255) >> 8) + \ d*((band->diff_mem[k]^cur_diff) < 0 ? -128 : 128); \ band->diff_mem[k] = tmp; \ s_zero += (tmp * band->zero_mem[k]) >> 15; \ } while (0) if (cur_diff) { ACCUM(5, band->diff_mem[4], 1); ACCUM(4, band->diff_mem[3], 1); ACCUM(3, band->diff_mem[2], 1); ACCUM(2, band->diff_mem[1], 1); ACCUM(1, band->diff_mem[0], 1); ACCUM(0, cur_diff << 1, 1); } else { ACCUM(5, band->diff_mem[4], 0); ACCUM(4, band->diff_mem[3], 0); ACCUM(3, band->diff_mem[2], 0); ACCUM(2, band->diff_mem[1], 0); ACCUM(1, band->diff_mem[0], 0); ACCUM(0, cur_diff << 1, 0); } #undef ACCUM band->s_zero = s_zero; }
{ "code": [ " ACCUM(0, cur_diff << 1, 1);", " ACCUM(0, cur_diff << 1, 0);" ], "line_no": [ 35, 49 ] }
static inline void VAR_2(int VAR_0, struct G722Band *VAR_1) { int VAR_2 = 0; #define ACCUM(k, x, d) do { \ int VAR_3 = x; \ VAR_1->zero_mem[k] = ((VAR_1->zero_mem[k] * 255) >> 8) + \ d*((VAR_1->diff_mem[k]^VAR_0) < 0 ? -128 : 128); \ VAR_1->diff_mem[k] = VAR_3; \ VAR_2 += (VAR_3 * VAR_1->zero_mem[k]) >> 15; \ } while (0) if (VAR_0) { ACCUM(5, VAR_1->diff_mem[4], 1); ACCUM(4, VAR_1->diff_mem[3], 1); ACCUM(3, VAR_1->diff_mem[2], 1); ACCUM(2, VAR_1->diff_mem[1], 1); ACCUM(1, VAR_1->diff_mem[0], 1); ACCUM(0, VAR_0 << 1, 1); } else { ACCUM(5, VAR_1->diff_mem[4], 0); ACCUM(4, VAR_1->diff_mem[3], 0); ACCUM(3, VAR_1->diff_mem[2], 0); ACCUM(2, VAR_1->diff_mem[1], 0); ACCUM(1, VAR_1->diff_mem[0], 0); ACCUM(0, VAR_0 << 1, 0); } #undef ACCUM VAR_1->VAR_2 = VAR_2; }
[ "static inline void VAR_2(int VAR_0, struct G722Band *VAR_1)\n{", "int VAR_2 = 0;", "#define ACCUM(k, x, d) do { \\", "int VAR_3 = x; \\", "VAR_1->zero_mem[k] = ((VAR_1->zero_mem[k] * 255) >> 8) + \\\nd*((VAR_1->diff_mem[k]^VAR_0) < 0 ? -128 : 128); \\", "VAR_1->diff_mem[k] = VAR_3; \\", "VAR_2 += (VAR_3 * VAR_1->zero_mem[k]) >> 15; \\", "} while (0)", "if (VAR_0) {", "ACCUM(5, VAR_1->diff_mem[4], 1);", "ACCUM(4, VAR_1->diff_mem[3], 1);", "ACCUM(3, VAR_1->diff_mem[2], 1);", "ACCUM(2, VAR_1->diff_mem[1], 1);", "ACCUM(1, VAR_1->diff_mem[0], 1);", "ACCUM(0, VAR_0 << 1, 1);", "} else {", "ACCUM(5, VAR_1->diff_mem[4], 0);", "ACCUM(4, VAR_1->diff_mem[3], 0);", "ACCUM(3, VAR_1->diff_mem[2], 0);", "ACCUM(2, VAR_1->diff_mem[1], 0);", "ACCUM(1, VAR_1->diff_mem[0], 0);", "ACCUM(0, VAR_0 << 1, 0);", "}", "#undef ACCUM\nVAR_1->VAR_2 = VAR_2;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53, 55 ], [ 57 ] ]
2,421
static uint32_t qvirtio_pci_get_features(QVirtioDevice *d) { QVirtioPCIDevice *dev = (QVirtioPCIDevice *)d; return qpci_io_readl(dev->pdev, dev->addr + VIRTIO_PCI_HOST_FEATURES); }
true
qemu
b4ba67d9a702507793c2724e56f98e9b0f7be02b
static uint32_t qvirtio_pci_get_features(QVirtioDevice *d) { QVirtioPCIDevice *dev = (QVirtioPCIDevice *)d; return qpci_io_readl(dev->pdev, dev->addr + VIRTIO_PCI_HOST_FEATURES); }
{ "code": [ " return qpci_io_readl(dev->pdev, dev->addr + VIRTIO_PCI_HOST_FEATURES);" ], "line_no": [ 7 ] }
static uint32_t FUNC_0(QVirtioDevice *d) { QVirtioPCIDevice *dev = (QVirtioPCIDevice *)d; return qpci_io_readl(dev->pdev, dev->addr + VIRTIO_PCI_HOST_FEATURES); }
[ "static uint32_t FUNC_0(QVirtioDevice *d)\n{", "QVirtioPCIDevice *dev = (QVirtioPCIDevice *)d;", "return qpci_io_readl(dev->pdev, dev->addr + VIRTIO_PCI_HOST_FEATURES);", "}" ]
[ 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
2,422
static av_cold int decode_init(AVCodecContext * avctx) { KmvcContext *const c = avctx->priv_data; int i; c->avctx = avctx; if (avctx->width > 320 || avctx->height > 200) { av_log(avctx, AV_LOG_ERROR, "KMVC supports frames <= 320x200\n"); return -1; } c->frm0 = av_mallocz(320 * 200); c->frm1 = av_mallocz(320 * 200); c->cur = c->frm0; c->prev = c->frm1; for (i = 0; i < 256; i++) { c->pal[i] = 0xFF << 24 | i * 0x10101; } if (avctx->extradata_size < 12) { av_log(avctx, AV_LOG_WARNING, "Extradata missing, decoding may not work properly...\n"); c->palsize = 127; } else { c->palsize = AV_RL16(avctx->extradata + 10); if (c->palsize >= (unsigned)MAX_PALSIZE) { c->palsize = 127; av_log(avctx, AV_LOG_ERROR, "KMVC palette too large\n"); return AVERROR_INVALIDDATA; } } if (avctx->extradata_size == 1036) { // palette in extradata uint8_t *src = avctx->extradata + 12; for (i = 0; i < 256; i++) { c->pal[i] = AV_RL32(src); src += 4; } c->setpal = 1; } avcodec_get_frame_defaults(&c->pic); avctx->pix_fmt = AV_PIX_FMT_PAL8; return 0; }
true
FFmpeg
b12d92efd6c0d48665383a9baecc13e7ebbd8a22
static av_cold int decode_init(AVCodecContext * avctx) { KmvcContext *const c = avctx->priv_data; int i; c->avctx = avctx; if (avctx->width > 320 || avctx->height > 200) { av_log(avctx, AV_LOG_ERROR, "KMVC supports frames <= 320x200\n"); return -1; } c->frm0 = av_mallocz(320 * 200); c->frm1 = av_mallocz(320 * 200); c->cur = c->frm0; c->prev = c->frm1; for (i = 0; i < 256; i++) { c->pal[i] = 0xFF << 24 | i * 0x10101; } if (avctx->extradata_size < 12) { av_log(avctx, AV_LOG_WARNING, "Extradata missing, decoding may not work properly...\n"); c->palsize = 127; } else { c->palsize = AV_RL16(avctx->extradata + 10); if (c->palsize >= (unsigned)MAX_PALSIZE) { c->palsize = 127; av_log(avctx, AV_LOG_ERROR, "KMVC palette too large\n"); return AVERROR_INVALIDDATA; } } if (avctx->extradata_size == 1036) { uint8_t *src = avctx->extradata + 12; for (i = 0; i < 256; i++) { c->pal[i] = AV_RL32(src); src += 4; } c->setpal = 1; } avcodec_get_frame_defaults(&c->pic); avctx->pix_fmt = AV_PIX_FMT_PAL8; return 0; }
{ "code": [ " c->pal[i] = 0xFF << 24 | i * 0x10101;" ], "line_no": [ 37 ] }
static av_cold int FUNC_0(AVCodecContext * avctx) { KmvcContext *const c = avctx->priv_data; int VAR_0; c->avctx = avctx; if (avctx->width > 320 || avctx->height > 200) { av_log(avctx, AV_LOG_ERROR, "KMVC supports frames <= 320x200\n"); return -1; } c->frm0 = av_mallocz(320 * 200); c->frm1 = av_mallocz(320 * 200); c->cur = c->frm0; c->prev = c->frm1; for (VAR_0 = 0; VAR_0 < 256; VAR_0++) { c->pal[VAR_0] = 0xFF << 24 | VAR_0 * 0x10101; } if (avctx->extradata_size < 12) { av_log(avctx, AV_LOG_WARNING, "Extradata missing, decoding may not work properly...\n"); c->palsize = 127; } else { c->palsize = AV_RL16(avctx->extradata + 10); if (c->palsize >= (unsigned)MAX_PALSIZE) { c->palsize = 127; av_log(avctx, AV_LOG_ERROR, "KMVC palette too large\n"); return AVERROR_INVALIDDATA; } } if (avctx->extradata_size == 1036) { uint8_t *src = avctx->extradata + 12; for (VAR_0 = 0; VAR_0 < 256; VAR_0++) { c->pal[VAR_0] = AV_RL32(src); src += 4; } c->setpal = 1; } avcodec_get_frame_defaults(&c->pic); avctx->pix_fmt = AV_PIX_FMT_PAL8; return 0; }
[ "static av_cold int FUNC_0(AVCodecContext * avctx)\n{", "KmvcContext *const c = avctx->priv_data;", "int VAR_0;", "c->avctx = avctx;", "if (avctx->width > 320 || avctx->height > 200) {", "av_log(avctx, AV_LOG_ERROR, \"KMVC supports frames <= 320x200\\n\");", "return -1;", "}", "c->frm0 = av_mallocz(320 * 200);", "c->frm1 = av_mallocz(320 * 200);", "c->cur = c->frm0;", "c->prev = c->frm1;", "for (VAR_0 = 0; VAR_0 < 256; VAR_0++) {", "c->pal[VAR_0] = 0xFF << 24 | VAR_0 * 0x10101;", "}", "if (avctx->extradata_size < 12) {", "av_log(avctx, AV_LOG_WARNING,\n\"Extradata missing, decoding may not work properly...\\n\");", "c->palsize = 127;", "} else {", "c->palsize = AV_RL16(avctx->extradata + 10);", "if (c->palsize >= (unsigned)MAX_PALSIZE) {", "c->palsize = 127;", "av_log(avctx, AV_LOG_ERROR, \"KMVC palette too large\\n\");", "return AVERROR_INVALIDDATA;", "}", "}", "if (avctx->extradata_size == 1036) {", "uint8_t *src = avctx->extradata + 12;", "for (VAR_0 = 0; VAR_0 < 256; VAR_0++) {", "c->pal[VAR_0] = AV_RL32(src);", "src += 4;", "}", "c->setpal = 1;", "}", "avcodec_get_frame_defaults(&c->pic);", "avctx->pix_fmt = AV_PIX_FMT_PAL8;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45, 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 87 ], [ 89 ], [ 93 ], [ 95 ] ]
2,423
static uint8_t lag_calc_zero_run(int8_t x) { return (x << 1) ^ (x >> 7); }
true
FFmpeg
ddb2dd7edbccc5596d8e3c039133be8444cb1d02
static uint8_t lag_calc_zero_run(int8_t x) { return (x << 1) ^ (x >> 7); }
{ "code": [ " return (x << 1) ^ (x >> 7);" ], "line_no": [ 5 ] }
static uint8_t FUNC_0(int8_t x) { return (x << 1) ^ (x >> 7); }
[ "static uint8_t FUNC_0(int8_t x)\n{", "return (x << 1) ^ (x >> 7);", "}" ]
[ 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
2,425
static void patch_reloc(uint8_t *code_ptr, int type, intptr_t value, intptr_t addend) { value += addend; switch(type) { case R_386_PC32: value -= (uintptr_t)code_ptr; if (value != (int32_t)value) { tcg_abort(); } *(uint32_t *)code_ptr = value; break; case R_386_PC8: value -= (uintptr_t)code_ptr; if (value != (int8_t)value) { tcg_abort(); } *(uint8_t *)code_ptr = value; break; default: tcg_abort(); } }
true
qemu
5c53bb812152c3d7919cadfd47c210b181bf89ac
static void patch_reloc(uint8_t *code_ptr, int type, intptr_t value, intptr_t addend) { value += addend; switch(type) { case R_386_PC32: value -= (uintptr_t)code_ptr; if (value != (int32_t)value) { tcg_abort(); } *(uint32_t *)code_ptr = value; break; case R_386_PC8: value -= (uintptr_t)code_ptr; if (value != (int8_t)value) { tcg_abort(); } *(uint8_t *)code_ptr = value; break; default: tcg_abort(); } }
{ "code": [ " *(uint32_t *)code_ptr = value;", " *(uint8_t *)code_ptr = value;" ], "line_no": [ 21, 35 ] }
static void FUNC_0(uint8_t *VAR_0, int VAR_1, intptr_t VAR_2, intptr_t VAR_3) { VAR_2 += VAR_3; switch(VAR_1) { case R_386_PC32: VAR_2 -= (uintptr_t)VAR_0; if (VAR_2 != (int32_t)VAR_2) { tcg_abort(); } *(uint32_t *)VAR_0 = VAR_2; break; case R_386_PC8: VAR_2 -= (uintptr_t)VAR_0; if (VAR_2 != (int8_t)VAR_2) { tcg_abort(); } *(uint8_t *)VAR_0 = VAR_2; break; default: tcg_abort(); } }
[ "static void FUNC_0(uint8_t *VAR_0, int VAR_1,\nintptr_t VAR_2, intptr_t VAR_3)\n{", "VAR_2 += VAR_3;", "switch(VAR_1) {", "case R_386_PC32:\nVAR_2 -= (uintptr_t)VAR_0;", "if (VAR_2 != (int32_t)VAR_2) {", "tcg_abort();", "}", "*(uint32_t *)VAR_0 = VAR_2;", "break;", "case R_386_PC8:\nVAR_2 -= (uintptr_t)VAR_0;", "if (VAR_2 != (int8_t)VAR_2) {", "tcg_abort();", "}", "*(uint8_t *)VAR_0 = VAR_2;", "break;", "default:\ntcg_abort();", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 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 ] ]
2,426
static int nut_write_trailer(AVFormatContext *s) { NUTContext *nut = s->priv_data; ByteIOContext *bc = &s->pb; update_packetheader(nut, bc, 0); #if 0 int i; /* WRITE INDEX */ for (i = 0; s->nb_streams; i++) { put_be64(bc, INDEX_STARTCODE); put_packetheader(nut, bc, 64); put_v(bc, s->streams[i]->id); put_v(bc, ...); put_be32(bc, 0); /* FIXME: checksum */ update_packetheader(nut, bc, 0); } #endif put_flush_packet(bc); av_freep(&nut->stream); return 0; }
false
FFmpeg
ee9f36a88eb3e2706ea659acb0ca80c414fa5d8a
static int nut_write_trailer(AVFormatContext *s) { NUTContext *nut = s->priv_data; ByteIOContext *bc = &s->pb; update_packetheader(nut, bc, 0); #if 0 int i; for (i = 0; s->nb_streams; i++) { put_be64(bc, INDEX_STARTCODE); put_packetheader(nut, bc, 64); put_v(bc, s->streams[i]->id); put_v(bc, ...); put_be32(bc, 0); update_packetheader(nut, bc, 0); } #endif put_flush_packet(bc); av_freep(&nut->stream); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0) { NUTContext *nut = VAR_0->priv_data; ByteIOContext *bc = &VAR_0->pb; update_packetheader(nut, bc, 0); #if 0 int i; for (i = 0; VAR_0->nb_streams; i++) { put_be64(bc, INDEX_STARTCODE); put_packetheader(nut, bc, 64); put_v(bc, VAR_0->streams[i]->id); put_v(bc, ...); put_be32(bc, 0); update_packetheader(nut, bc, 0); } #endif put_flush_packet(bc); av_freep(&nut->stream); return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0)\n{", "NUTContext *nut = VAR_0->priv_data;", "ByteIOContext *bc = &VAR_0->pb;", "update_packetheader(nut, bc, 0);", "#if 0\nint i;", "for (i = 0; VAR_0->nb_streams; i++)", "{", "put_be64(bc, INDEX_STARTCODE);", "put_packetheader(nut, bc, 64);", "put_v(bc, VAR_0->streams[i]->id);", "put_v(bc, ...);", "put_be32(bc, 0);", "update_packetheader(nut, bc, 0);", "}", "#endif\nput_flush_packet(bc);", "av_freep(&nut->stream);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 15, 17 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43, 47 ], [ 51 ], [ 55 ], [ 57 ] ]
2,427
static void noise(uint8_t *dst, const uint8_t *src, int dst_linesize, int src_linesize, int width, int start, int end, NoiseContext *n, int comp) { FilterParams *p = &n->param[comp]; int8_t *noise = p->noise; const int flags = p->flags; AVLFG *lfg = &p->lfg; int shift, y; if (!noise) { if (dst != src) av_image_copy_plane(dst, dst_linesize, src, src_linesize, width, end - start); return; } for (y = start; y < end; y++) { if (flags & NOISE_TEMPORAL) shift = av_lfg_get(lfg) & (MAX_SHIFT - 1); else shift = n->rand_shift[y]; if (flags & NOISE_AVERAGED) { n->line_noise_avg(dst, src, width, p->prev_shift[y]); p->prev_shift[y][shift & 3] = noise + shift; } else { n->line_noise(dst, src, noise, width, shift); } dst += dst_linesize; src += src_linesize; } }
false
FFmpeg
f8f42f48218138d37956407ebf10227eb86d4a2d
static void noise(uint8_t *dst, const uint8_t *src, int dst_linesize, int src_linesize, int width, int start, int end, NoiseContext *n, int comp) { FilterParams *p = &n->param[comp]; int8_t *noise = p->noise; const int flags = p->flags; AVLFG *lfg = &p->lfg; int shift, y; if (!noise) { if (dst != src) av_image_copy_plane(dst, dst_linesize, src, src_linesize, width, end - start); return; } for (y = start; y < end; y++) { if (flags & NOISE_TEMPORAL) shift = av_lfg_get(lfg) & (MAX_SHIFT - 1); else shift = n->rand_shift[y]; if (flags & NOISE_AVERAGED) { n->line_noise_avg(dst, src, width, p->prev_shift[y]); p->prev_shift[y][shift & 3] = noise + shift; } else { n->line_noise(dst, src, noise, width, shift); } dst += dst_linesize; src += src_linesize; } }
{ "code": [], "line_no": [] }
static void FUNC_0(uint8_t *VAR_0, const uint8_t *VAR_1, int VAR_2, int VAR_3, int VAR_4, int VAR_5, int VAR_6, NoiseContext *VAR_7, int VAR_8) { FilterParams *p = &VAR_7->param[VAR_8]; int8_t *FUNC_0 = p->FUNC_0; const int VAR_9 = p->VAR_9; AVLFG *lfg = &p->lfg; int VAR_10, VAR_11; if (!FUNC_0) { if (VAR_0 != VAR_1) av_image_copy_plane(VAR_0, VAR_2, VAR_1, VAR_3, VAR_4, VAR_6 - VAR_5); return; } for (VAR_11 = VAR_5; VAR_11 < VAR_6; VAR_11++) { if (VAR_9 & NOISE_TEMPORAL) VAR_10 = av_lfg_get(lfg) & (MAX_SHIFT - 1); else VAR_10 = VAR_7->rand_shift[VAR_11]; if (VAR_9 & NOISE_AVERAGED) { VAR_7->line_noise_avg(VAR_0, VAR_1, VAR_4, p->prev_shift[VAR_11]); p->prev_shift[VAR_11][VAR_10 & 3] = FUNC_0 + VAR_10; } else { VAR_7->line_noise(VAR_0, VAR_1, FUNC_0, VAR_4, VAR_10); } VAR_0 += VAR_2; VAR_1 += VAR_3; } }
[ "static void FUNC_0(uint8_t *VAR_0, const uint8_t *VAR_1,\nint VAR_2, int VAR_3,\nint VAR_4, int VAR_5, int VAR_6, NoiseContext *VAR_7, int VAR_8)\n{", "FilterParams *p = &VAR_7->param[VAR_8];", "int8_t *FUNC_0 = p->FUNC_0;", "const int VAR_9 = p->VAR_9;", "AVLFG *lfg = &p->lfg;", "int VAR_10, VAR_11;", "if (!FUNC_0) {", "if (VAR_0 != VAR_1)\nav_image_copy_plane(VAR_0, VAR_2, VAR_1, VAR_3, VAR_4, VAR_6 - VAR_5);", "return;", "}", "for (VAR_11 = VAR_5; VAR_11 < VAR_6; VAR_11++) {", "if (VAR_9 & NOISE_TEMPORAL)\nVAR_10 = av_lfg_get(lfg) & (MAX_SHIFT - 1);", "else\nVAR_10 = VAR_7->rand_shift[VAR_11];", "if (VAR_9 & NOISE_AVERAGED) {", "VAR_7->line_noise_avg(VAR_0, VAR_1, VAR_4, p->prev_shift[VAR_11]);", "p->prev_shift[VAR_11][VAR_10 & 3] = FUNC_0 + VAR_10;", "} else {", "VAR_7->line_noise(VAR_0, VAR_1, FUNC_0, VAR_4, VAR_10);", "}", "VAR_0 += VAR_2;", "VAR_1 += 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 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35, 37 ], [ 39, 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ] ]
2,428
void ff_generate_sliding_window_mmcos(H264Context *h) { MpegEncContext * const s = &h->s; assert(h->long_ref_count + h->short_ref_count <= h->sps.ref_frame_count); h->mmco_index= 0; if(h->short_ref_count && h->long_ref_count + h->short_ref_count == h->sps.ref_frame_count && !(FIELD_PICTURE && !s->first_field && s->current_picture_ptr->reference)) { h->mmco[0].opcode= MMCO_SHORT2UNUSED; h->mmco[0].short_pic_num= h->short_ref[ h->short_ref_count - 1 ]->frame_num; h->mmco_index= 1; if (FIELD_PICTURE) { h->mmco[0].short_pic_num *= 2; h->mmco[1].opcode= MMCO_SHORT2UNUSED; h->mmco[1].short_pic_num= h->mmco[0].short_pic_num + 1; h->mmco_index= 2; } } }
false
FFmpeg
7ac85f4be840361d55db302ac476ced28297a061
void ff_generate_sliding_window_mmcos(H264Context *h) { MpegEncContext * const s = &h->s; assert(h->long_ref_count + h->short_ref_count <= h->sps.ref_frame_count); h->mmco_index= 0; if(h->short_ref_count && h->long_ref_count + h->short_ref_count == h->sps.ref_frame_count && !(FIELD_PICTURE && !s->first_field && s->current_picture_ptr->reference)) { h->mmco[0].opcode= MMCO_SHORT2UNUSED; h->mmco[0].short_pic_num= h->short_ref[ h->short_ref_count - 1 ]->frame_num; h->mmco_index= 1; if (FIELD_PICTURE) { h->mmco[0].short_pic_num *= 2; h->mmco[1].opcode= MMCO_SHORT2UNUSED; h->mmco[1].short_pic_num= h->mmco[0].short_pic_num + 1; h->mmco_index= 2; } } }
{ "code": [], "line_no": [] }
void FUNC_0(H264Context *VAR_0) { MpegEncContext * const s = &VAR_0->s; assert(VAR_0->long_ref_count + VAR_0->short_ref_count <= VAR_0->sps.ref_frame_count); VAR_0->mmco_index= 0; if(VAR_0->short_ref_count && VAR_0->long_ref_count + VAR_0->short_ref_count == VAR_0->sps.ref_frame_count && !(FIELD_PICTURE && !s->first_field && s->current_picture_ptr->reference)) { VAR_0->mmco[0].opcode= MMCO_SHORT2UNUSED; VAR_0->mmco[0].short_pic_num= VAR_0->short_ref[ VAR_0->short_ref_count - 1 ]->frame_num; VAR_0->mmco_index= 1; if (FIELD_PICTURE) { VAR_0->mmco[0].short_pic_num *= 2; VAR_0->mmco[1].opcode= MMCO_SHORT2UNUSED; VAR_0->mmco[1].short_pic_num= VAR_0->mmco[0].short_pic_num + 1; VAR_0->mmco_index= 2; } } }
[ "void FUNC_0(H264Context *VAR_0) {", "MpegEncContext * const s = &VAR_0->s;", "assert(VAR_0->long_ref_count + VAR_0->short_ref_count <= VAR_0->sps.ref_frame_count);", "VAR_0->mmco_index= 0;", "if(VAR_0->short_ref_count && VAR_0->long_ref_count + VAR_0->short_ref_count == VAR_0->sps.ref_frame_count &&\n!(FIELD_PICTURE && !s->first_field && s->current_picture_ptr->reference)) {", "VAR_0->mmco[0].opcode= MMCO_SHORT2UNUSED;", "VAR_0->mmco[0].short_pic_num= VAR_0->short_ref[ VAR_0->short_ref_count - 1 ]->frame_num;", "VAR_0->mmco_index= 1;", "if (FIELD_PICTURE) {", "VAR_0->mmco[0].short_pic_num *= 2;", "VAR_0->mmco[1].opcode= MMCO_SHORT2UNUSED;", "VAR_0->mmco[1].short_pic_num= VAR_0->mmco[0].short_pic_num + 1;", "VAR_0->mmco_index= 2;", "}", "}", "}" ]
[ 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 ] ]
2,430
static av_cold int X264_init(AVCodecContext *avctx) { X264Context *x4 = avctx->priv_data; AVCPBProperties *cpb_props; #if CONFIG_LIBX262_ENCODER if (avctx->codec_id == AV_CODEC_ID_MPEG2VIDEO) { x4->params.b_mpeg2 = 1; x264_param_default_mpeg2(&x4->params); } else #else x264_param_default(&x4->params); #endif x4->params.b_deblocking_filter = avctx->flags & AV_CODEC_FLAG_LOOP_FILTER; if (x4->preset || x4->tune) if (x264_param_default_preset(&x4->params, x4->preset, x4->tune) < 0) { av_log(avctx, AV_LOG_ERROR, "Error setting preset/tune %s/%s.\n", x4->preset, x4->tune); return AVERROR(EINVAL); } if (avctx->level > 0) x4->params.i_level_idc = avctx->level; x4->params.pf_log = X264_log; x4->params.p_log_private = avctx; x4->params.i_log_level = X264_LOG_DEBUG; x4->params.i_csp = convert_pix_fmt(avctx->pix_fmt); if (avctx->bit_rate) { x4->params.rc.i_bitrate = avctx->bit_rate / 1000; x4->params.rc.i_rc_method = X264_RC_ABR; } x4->params.rc.i_vbv_buffer_size = avctx->rc_buffer_size / 1000; x4->params.rc.i_vbv_max_bitrate = avctx->rc_max_rate / 1000; x4->params.rc.b_stat_write = avctx->flags & AV_CODEC_FLAG_PASS1; if (avctx->flags & AV_CODEC_FLAG_PASS2) { x4->params.rc.b_stat_read = 1; } else { if (x4->crf >= 0) { x4->params.rc.i_rc_method = X264_RC_CRF; x4->params.rc.f_rf_constant = x4->crf; } else if (x4->cqp >= 0) { x4->params.rc.i_rc_method = X264_RC_CQP; x4->params.rc.i_qp_constant = x4->cqp; } if (x4->crf_max >= 0) x4->params.rc.f_rf_constant_max = x4->crf_max; } if (avctx->rc_buffer_size && avctx->rc_initial_buffer_occupancy > 0 && (avctx->rc_initial_buffer_occupancy <= avctx->rc_buffer_size)) { x4->params.rc.f_vbv_buffer_init = (float)avctx->rc_initial_buffer_occupancy / avctx->rc_buffer_size; } if (avctx->i_quant_factor > 0) x4->params.rc.f_ip_factor = 1 / fabs(avctx->i_quant_factor); x4->params.rc.f_pb_factor = avctx->b_quant_factor; x4->params.analyse.i_chroma_qp_offset = avctx->chromaoffset; if (avctx->gop_size >= 0) x4->params.i_keyint_max = avctx->gop_size; if (avctx->max_b_frames >= 0) x4->params.i_bframe = avctx->max_b_frames; if (avctx->scenechange_threshold >= 0) x4->params.i_scenecut_threshold = avctx->scenechange_threshold; if (avctx->qmin >= 0) x4->params.rc.i_qp_min = avctx->qmin; if (avctx->qmax >= 0) x4->params.rc.i_qp_max = avctx->qmax; if (avctx->max_qdiff >= 0) x4->params.rc.i_qp_step = avctx->max_qdiff; if (avctx->qblur >= 0) x4->params.rc.f_qblur = avctx->qblur; /* temporally blur quants */ if (avctx->qcompress >= 0) x4->params.rc.f_qcompress = avctx->qcompress; /* 0.0 => cbr, 1.0 => constant qp */ if (avctx->refs >= 0) x4->params.i_frame_reference = avctx->refs; if (avctx->trellis >= 0) x4->params.analyse.i_trellis = avctx->trellis; if (avctx->me_range >= 0) x4->params.analyse.i_me_range = avctx->me_range; if (avctx->noise_reduction >= 0) x4->params.analyse.i_noise_reduction = avctx->noise_reduction; if (avctx->me_subpel_quality >= 0) x4->params.analyse.i_subpel_refine = avctx->me_subpel_quality; if (avctx->b_frame_strategy >= 0) x4->params.i_bframe_adaptive = avctx->b_frame_strategy; if (avctx->keyint_min >= 0) x4->params.i_keyint_min = avctx->keyint_min; #if FF_API_CODER_TYPE FF_DISABLE_DEPRECATION_WARNINGS if (avctx->coder_type >= 0) x4->coder = avctx->coder_type == FF_CODER_TYPE_AC; FF_ENABLE_DEPRECATION_WARNINGS #endif if (avctx->me_cmp >= 0) x4->params.analyse.b_chroma_me = avctx->me_cmp & FF_CMP_CHROMA; if (x4->aq_mode >= 0) x4->params.rc.i_aq_mode = x4->aq_mode; if (x4->aq_strength >= 0) x4->params.rc.f_aq_strength = x4->aq_strength; PARSE_X264_OPT("psy-rd", psy_rd); PARSE_X264_OPT("deblock", deblock); PARSE_X264_OPT("partitions", partitions); PARSE_X264_OPT("stats", stats); if (x4->psy >= 0) x4->params.analyse.b_psy = x4->psy; if (x4->rc_lookahead >= 0) x4->params.rc.i_lookahead = x4->rc_lookahead; if (x4->weightp >= 0) x4->params.analyse.i_weighted_pred = x4->weightp; if (x4->weightb >= 0) x4->params.analyse.b_weighted_bipred = x4->weightb; if (x4->cplxblur >= 0) x4->params.rc.f_complexity_blur = x4->cplxblur; if (x4->ssim >= 0) x4->params.analyse.b_ssim = x4->ssim; if (x4->intra_refresh >= 0) x4->params.b_intra_refresh = x4->intra_refresh; if (x4->bluray_compat >= 0) { x4->params.b_bluray_compat = x4->bluray_compat; x4->params.b_vfr_input = 0; } if (x4->b_bias != INT_MIN) x4->params.i_bframe_bias = x4->b_bias; if (x4->b_pyramid >= 0) x4->params.i_bframe_pyramid = x4->b_pyramid; if (x4->mixed_refs >= 0) x4->params.analyse.b_mixed_references = x4->mixed_refs; if (x4->dct8x8 >= 0) x4->params.analyse.b_transform_8x8 = x4->dct8x8; if (x4->fast_pskip >= 0) x4->params.analyse.b_fast_pskip = x4->fast_pskip; if (x4->aud >= 0) x4->params.b_aud = x4->aud; if (x4->mbtree >= 0) x4->params.rc.b_mb_tree = x4->mbtree; if (x4->direct_pred >= 0) x4->params.analyse.i_direct_mv_pred = x4->direct_pred; if (x4->slice_max_size >= 0) x4->params.i_slice_max_size = x4->slice_max_size; if (x4->fastfirstpass) x264_param_apply_fastfirstpass(&x4->params); if (x4->nal_hrd >= 0) x4->params.i_nal_hrd = x4->nal_hrd; if (x4->motion_est >= 0) { x4->params.analyse.i_me_method = x4->motion_est; #if FF_API_MOTION_EST FF_DISABLE_DEPRECATION_WARNINGS } else { if (avctx->me_method == ME_EPZS) x4->params.analyse.i_me_method = X264_ME_DIA; else if (avctx->me_method == ME_HEX) x4->params.analyse.i_me_method = X264_ME_HEX; else if (avctx->me_method == ME_UMH) x4->params.analyse.i_me_method = X264_ME_UMH; else if (avctx->me_method == ME_FULL) x4->params.analyse.i_me_method = X264_ME_ESA; else if (avctx->me_method == ME_TESA) x4->params.analyse.i_me_method = X264_ME_TESA; FF_ENABLE_DEPRECATION_WARNINGS #endif } if (x4->coder >= 0) x4->params.b_cabac = x4->coder; if (x4->profile) if (x264_param_apply_profile(&x4->params, x4->profile) < 0) { av_log(avctx, AV_LOG_ERROR, "Error setting profile %s.\n", x4->profile); return AVERROR(EINVAL); } x4->params.i_width = avctx->width; x4->params.i_height = avctx->height; x4->params.vui.i_sar_width = avctx->sample_aspect_ratio.num; x4->params.vui.i_sar_height = avctx->sample_aspect_ratio.den; x4->params.i_fps_num = x4->params.i_timebase_den = avctx->time_base.den; x4->params.i_fps_den = x4->params.i_timebase_num = avctx->time_base.num; x4->params.analyse.b_psnr = avctx->flags & AV_CODEC_FLAG_PSNR; x4->params.i_threads = avctx->thread_count; if (avctx->thread_type) x4->params.b_sliced_threads = avctx->thread_type == FF_THREAD_SLICE; x4->params.b_interlaced = avctx->flags & AV_CODEC_FLAG_INTERLACED_DCT; x4->params.b_open_gop = !(avctx->flags & AV_CODEC_FLAG_CLOSED_GOP); x4->params.i_slice_count = avctx->slices; x4->params.vui.b_fullrange = avctx->pix_fmt == AV_PIX_FMT_YUVJ420P || avctx->pix_fmt == AV_PIX_FMT_YUVJ422P || avctx->pix_fmt == AV_PIX_FMT_YUVJ444P || avctx->color_range == AVCOL_RANGE_JPEG; // x264 validates the values internally x4->params.vui.i_colorprim = avctx->color_primaries; x4->params.vui.i_transfer = avctx->color_trc; x4->params.vui.i_colmatrix = avctx->colorspace; if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) x4->params.b_repeat_headers = 0; if (x4->x264_params) { AVDictionary *dict = NULL; AVDictionaryEntry *en = NULL; if (!av_dict_parse_string(&dict, x4->x264_params, "=", ":", 0)) { while ((en = av_dict_get(dict, "", en, AV_DICT_IGNORE_SUFFIX))) { if (x264_param_parse(&x4->params, en->key, en->value) < 0) av_log(avctx, AV_LOG_WARNING, "Error parsing option '%s = %s'.\n", en->key, en->value); } av_dict_free(&dict); } } // update AVCodecContext with x264 parameters avctx->has_b_frames = x4->params.i_bframe ? x4->params.i_bframe_pyramid ? 2 : 1 : 0; if (avctx->max_b_frames < 0) avctx->max_b_frames = 0; avctx->bit_rate = x4->params.rc.i_bitrate*1000; x4->enc = x264_encoder_open(&x4->params); if (!x4->enc) return AVERROR_UNKNOWN; if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) { x264_nal_t *nal; uint8_t *p; int nnal, s, i; s = x264_encoder_headers(x4->enc, &nal, &nnal); avctx->extradata = p = av_mallocz(s + AV_INPUT_BUFFER_PADDING_SIZE); if (!p) return AVERROR(ENOMEM); for (i = 0; i < nnal; i++) { /* Don't put the SEI in extradata. */ if (nal[i].i_type == NAL_SEI) { av_log(avctx, AV_LOG_INFO, "%s\n", nal[i].p_payload+25); x4->sei_size = nal[i].i_payload; x4->sei = av_malloc(x4->sei_size); if (!x4->sei) return AVERROR(ENOMEM); memcpy(x4->sei, nal[i].p_payload, nal[i].i_payload); continue; } memcpy(p, nal[i].p_payload, nal[i].i_payload); p += nal[i].i_payload; } avctx->extradata_size = p - avctx->extradata; } cpb_props = ff_add_cpb_side_data(avctx); if (!cpb_props) return AVERROR(ENOMEM); cpb_props->buffer_size = x4->params.rc.i_vbv_buffer_size * 1000; cpb_props->max_bitrate = x4->params.rc.i_vbv_max_bitrate * 1000; cpb_props->avg_bitrate = x4->params.rc.i_bitrate * 1000; return 0; }
false
FFmpeg
0e6c8532215790bbe560a9eea4f3cc82bb55cf92
static av_cold int X264_init(AVCodecContext *avctx) { X264Context *x4 = avctx->priv_data; AVCPBProperties *cpb_props; #if CONFIG_LIBX262_ENCODER if (avctx->codec_id == AV_CODEC_ID_MPEG2VIDEO) { x4->params.b_mpeg2 = 1; x264_param_default_mpeg2(&x4->params); } else #else x264_param_default(&x4->params); #endif x4->params.b_deblocking_filter = avctx->flags & AV_CODEC_FLAG_LOOP_FILTER; if (x4->preset || x4->tune) if (x264_param_default_preset(&x4->params, x4->preset, x4->tune) < 0) { av_log(avctx, AV_LOG_ERROR, "Error setting preset/tune %s/%s.\n", x4->preset, x4->tune); return AVERROR(EINVAL); } if (avctx->level > 0) x4->params.i_level_idc = avctx->level; x4->params.pf_log = X264_log; x4->params.p_log_private = avctx; x4->params.i_log_level = X264_LOG_DEBUG; x4->params.i_csp = convert_pix_fmt(avctx->pix_fmt); if (avctx->bit_rate) { x4->params.rc.i_bitrate = avctx->bit_rate / 1000; x4->params.rc.i_rc_method = X264_RC_ABR; } x4->params.rc.i_vbv_buffer_size = avctx->rc_buffer_size / 1000; x4->params.rc.i_vbv_max_bitrate = avctx->rc_max_rate / 1000; x4->params.rc.b_stat_write = avctx->flags & AV_CODEC_FLAG_PASS1; if (avctx->flags & AV_CODEC_FLAG_PASS2) { x4->params.rc.b_stat_read = 1; } else { if (x4->crf >= 0) { x4->params.rc.i_rc_method = X264_RC_CRF; x4->params.rc.f_rf_constant = x4->crf; } else if (x4->cqp >= 0) { x4->params.rc.i_rc_method = X264_RC_CQP; x4->params.rc.i_qp_constant = x4->cqp; } if (x4->crf_max >= 0) x4->params.rc.f_rf_constant_max = x4->crf_max; } if (avctx->rc_buffer_size && avctx->rc_initial_buffer_occupancy > 0 && (avctx->rc_initial_buffer_occupancy <= avctx->rc_buffer_size)) { x4->params.rc.f_vbv_buffer_init = (float)avctx->rc_initial_buffer_occupancy / avctx->rc_buffer_size; } if (avctx->i_quant_factor > 0) x4->params.rc.f_ip_factor = 1 / fabs(avctx->i_quant_factor); x4->params.rc.f_pb_factor = avctx->b_quant_factor; x4->params.analyse.i_chroma_qp_offset = avctx->chromaoffset; if (avctx->gop_size >= 0) x4->params.i_keyint_max = avctx->gop_size; if (avctx->max_b_frames >= 0) x4->params.i_bframe = avctx->max_b_frames; if (avctx->scenechange_threshold >= 0) x4->params.i_scenecut_threshold = avctx->scenechange_threshold; if (avctx->qmin >= 0) x4->params.rc.i_qp_min = avctx->qmin; if (avctx->qmax >= 0) x4->params.rc.i_qp_max = avctx->qmax; if (avctx->max_qdiff >= 0) x4->params.rc.i_qp_step = avctx->max_qdiff; if (avctx->qblur >= 0) x4->params.rc.f_qblur = avctx->qblur; if (avctx->qcompress >= 0) x4->params.rc.f_qcompress = avctx->qcompress; if (avctx->refs >= 0) x4->params.i_frame_reference = avctx->refs; if (avctx->trellis >= 0) x4->params.analyse.i_trellis = avctx->trellis; if (avctx->me_range >= 0) x4->params.analyse.i_me_range = avctx->me_range; if (avctx->noise_reduction >= 0) x4->params.analyse.i_noise_reduction = avctx->noise_reduction; if (avctx->me_subpel_quality >= 0) x4->params.analyse.i_subpel_refine = avctx->me_subpel_quality; if (avctx->b_frame_strategy >= 0) x4->params.i_bframe_adaptive = avctx->b_frame_strategy; if (avctx->keyint_min >= 0) x4->params.i_keyint_min = avctx->keyint_min; #if FF_API_CODER_TYPE FF_DISABLE_DEPRECATION_WARNINGS if (avctx->coder_type >= 0) x4->coder = avctx->coder_type == FF_CODER_TYPE_AC; FF_ENABLE_DEPRECATION_WARNINGS #endif if (avctx->me_cmp >= 0) x4->params.analyse.b_chroma_me = avctx->me_cmp & FF_CMP_CHROMA; if (x4->aq_mode >= 0) x4->params.rc.i_aq_mode = x4->aq_mode; if (x4->aq_strength >= 0) x4->params.rc.f_aq_strength = x4->aq_strength; PARSE_X264_OPT("psy-rd", psy_rd); PARSE_X264_OPT("deblock", deblock); PARSE_X264_OPT("partitions", partitions); PARSE_X264_OPT("stats", stats); if (x4->psy >= 0) x4->params.analyse.b_psy = x4->psy; if (x4->rc_lookahead >= 0) x4->params.rc.i_lookahead = x4->rc_lookahead; if (x4->weightp >= 0) x4->params.analyse.i_weighted_pred = x4->weightp; if (x4->weightb >= 0) x4->params.analyse.b_weighted_bipred = x4->weightb; if (x4->cplxblur >= 0) x4->params.rc.f_complexity_blur = x4->cplxblur; if (x4->ssim >= 0) x4->params.analyse.b_ssim = x4->ssim; if (x4->intra_refresh >= 0) x4->params.b_intra_refresh = x4->intra_refresh; if (x4->bluray_compat >= 0) { x4->params.b_bluray_compat = x4->bluray_compat; x4->params.b_vfr_input = 0; } if (x4->b_bias != INT_MIN) x4->params.i_bframe_bias = x4->b_bias; if (x4->b_pyramid >= 0) x4->params.i_bframe_pyramid = x4->b_pyramid; if (x4->mixed_refs >= 0) x4->params.analyse.b_mixed_references = x4->mixed_refs; if (x4->dct8x8 >= 0) x4->params.analyse.b_transform_8x8 = x4->dct8x8; if (x4->fast_pskip >= 0) x4->params.analyse.b_fast_pskip = x4->fast_pskip; if (x4->aud >= 0) x4->params.b_aud = x4->aud; if (x4->mbtree >= 0) x4->params.rc.b_mb_tree = x4->mbtree; if (x4->direct_pred >= 0) x4->params.analyse.i_direct_mv_pred = x4->direct_pred; if (x4->slice_max_size >= 0) x4->params.i_slice_max_size = x4->slice_max_size; if (x4->fastfirstpass) x264_param_apply_fastfirstpass(&x4->params); if (x4->nal_hrd >= 0) x4->params.i_nal_hrd = x4->nal_hrd; if (x4->motion_est >= 0) { x4->params.analyse.i_me_method = x4->motion_est; #if FF_API_MOTION_EST FF_DISABLE_DEPRECATION_WARNINGS } else { if (avctx->me_method == ME_EPZS) x4->params.analyse.i_me_method = X264_ME_DIA; else if (avctx->me_method == ME_HEX) x4->params.analyse.i_me_method = X264_ME_HEX; else if (avctx->me_method == ME_UMH) x4->params.analyse.i_me_method = X264_ME_UMH; else if (avctx->me_method == ME_FULL) x4->params.analyse.i_me_method = X264_ME_ESA; else if (avctx->me_method == ME_TESA) x4->params.analyse.i_me_method = X264_ME_TESA; FF_ENABLE_DEPRECATION_WARNINGS #endif } if (x4->coder >= 0) x4->params.b_cabac = x4->coder; if (x4->profile) if (x264_param_apply_profile(&x4->params, x4->profile) < 0) { av_log(avctx, AV_LOG_ERROR, "Error setting profile %s.\n", x4->profile); return AVERROR(EINVAL); } x4->params.i_width = avctx->width; x4->params.i_height = avctx->height; x4->params.vui.i_sar_width = avctx->sample_aspect_ratio.num; x4->params.vui.i_sar_height = avctx->sample_aspect_ratio.den; x4->params.i_fps_num = x4->params.i_timebase_den = avctx->time_base.den; x4->params.i_fps_den = x4->params.i_timebase_num = avctx->time_base.num; x4->params.analyse.b_psnr = avctx->flags & AV_CODEC_FLAG_PSNR; x4->params.i_threads = avctx->thread_count; if (avctx->thread_type) x4->params.b_sliced_threads = avctx->thread_type == FF_THREAD_SLICE; x4->params.b_interlaced = avctx->flags & AV_CODEC_FLAG_INTERLACED_DCT; x4->params.b_open_gop = !(avctx->flags & AV_CODEC_FLAG_CLOSED_GOP); x4->params.i_slice_count = avctx->slices; x4->params.vui.b_fullrange = avctx->pix_fmt == AV_PIX_FMT_YUVJ420P || avctx->pix_fmt == AV_PIX_FMT_YUVJ422P || avctx->pix_fmt == AV_PIX_FMT_YUVJ444P || avctx->color_range == AVCOL_RANGE_JPEG; x4->params.vui.i_colorprim = avctx->color_primaries; x4->params.vui.i_transfer = avctx->color_trc; x4->params.vui.i_colmatrix = avctx->colorspace; if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) x4->params.b_repeat_headers = 0; if (x4->x264_params) { AVDictionary *dict = NULL; AVDictionaryEntry *en = NULL; if (!av_dict_parse_string(&dict, x4->x264_params, "=", ":", 0)) { while ((en = av_dict_get(dict, "", en, AV_DICT_IGNORE_SUFFIX))) { if (x264_param_parse(&x4->params, en->key, en->value) < 0) av_log(avctx, AV_LOG_WARNING, "Error parsing option '%s = %s'.\n", en->key, en->value); } av_dict_free(&dict); } } avctx->has_b_frames = x4->params.i_bframe ? x4->params.i_bframe_pyramid ? 2 : 1 : 0; if (avctx->max_b_frames < 0) avctx->max_b_frames = 0; avctx->bit_rate = x4->params.rc.i_bitrate*1000; x4->enc = x264_encoder_open(&x4->params); if (!x4->enc) return AVERROR_UNKNOWN; if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) { x264_nal_t *nal; uint8_t *p; int nnal, s, i; s = x264_encoder_headers(x4->enc, &nal, &nnal); avctx->extradata = p = av_mallocz(s + AV_INPUT_BUFFER_PADDING_SIZE); if (!p) return AVERROR(ENOMEM); for (i = 0; i < nnal; i++) { if (nal[i].i_type == NAL_SEI) { av_log(avctx, AV_LOG_INFO, "%s\n", nal[i].p_payload+25); x4->sei_size = nal[i].i_payload; x4->sei = av_malloc(x4->sei_size); if (!x4->sei) return AVERROR(ENOMEM); memcpy(x4->sei, nal[i].p_payload, nal[i].i_payload); continue; } memcpy(p, nal[i].p_payload, nal[i].i_payload); p += nal[i].i_payload; } avctx->extradata_size = p - avctx->extradata; } cpb_props = ff_add_cpb_side_data(avctx); if (!cpb_props) return AVERROR(ENOMEM); cpb_props->buffer_size = x4->params.rc.i_vbv_buffer_size * 1000; cpb_props->max_bitrate = x4->params.rc.i_vbv_max_bitrate * 1000; cpb_props->avg_bitrate = x4->params.rc.i_bitrate * 1000; return 0; }
{ "code": [], "line_no": [] }
static av_cold int FUNC_0(AVCodecContext *avctx) { X264Context *x4 = avctx->priv_data; AVCPBProperties *cpb_props; #if CONFIG_LIBX262_ENCODER if (avctx->codec_id == AV_CODEC_ID_MPEG2VIDEO) { x4->params.b_mpeg2 = 1; x264_param_default_mpeg2(&x4->params); } else #else x264_param_default(&x4->params); #endif x4->params.b_deblocking_filter = avctx->flags & AV_CODEC_FLAG_LOOP_FILTER; if (x4->preset || x4->tune) if (x264_param_default_preset(&x4->params, x4->preset, x4->tune) < 0) { av_log(avctx, AV_LOG_ERROR, "Error setting preset/tune %VAR_1/%VAR_1.\n", x4->preset, x4->tune); return AVERROR(EINVAL); } if (avctx->level > 0) x4->params.i_level_idc = avctx->level; x4->params.pf_log = X264_log; x4->params.p_log_private = avctx; x4->params.i_log_level = X264_LOG_DEBUG; x4->params.i_csp = convert_pix_fmt(avctx->pix_fmt); if (avctx->bit_rate) { x4->params.rc.i_bitrate = avctx->bit_rate / 1000; x4->params.rc.i_rc_method = X264_RC_ABR; } x4->params.rc.i_vbv_buffer_size = avctx->rc_buffer_size / 1000; x4->params.rc.i_vbv_max_bitrate = avctx->rc_max_rate / 1000; x4->params.rc.b_stat_write = avctx->flags & AV_CODEC_FLAG_PASS1; if (avctx->flags & AV_CODEC_FLAG_PASS2) { x4->params.rc.b_stat_read = 1; } else { if (x4->crf >= 0) { x4->params.rc.i_rc_method = X264_RC_CRF; x4->params.rc.f_rf_constant = x4->crf; } else if (x4->cqp >= 0) { x4->params.rc.i_rc_method = X264_RC_CQP; x4->params.rc.i_qp_constant = x4->cqp; } if (x4->crf_max >= 0) x4->params.rc.f_rf_constant_max = x4->crf_max; } if (avctx->rc_buffer_size && avctx->rc_initial_buffer_occupancy > 0 && (avctx->rc_initial_buffer_occupancy <= avctx->rc_buffer_size)) { x4->params.rc.f_vbv_buffer_init = (float)avctx->rc_initial_buffer_occupancy / avctx->rc_buffer_size; } if (avctx->i_quant_factor > 0) x4->params.rc.f_ip_factor = 1 / fabs(avctx->i_quant_factor); x4->params.rc.f_pb_factor = avctx->b_quant_factor; x4->params.analyse.i_chroma_qp_offset = avctx->chromaoffset; if (avctx->gop_size >= 0) x4->params.i_keyint_max = avctx->gop_size; if (avctx->max_b_frames >= 0) x4->params.i_bframe = avctx->max_b_frames; if (avctx->scenechange_threshold >= 0) x4->params.i_scenecut_threshold = avctx->scenechange_threshold; if (avctx->qmin >= 0) x4->params.rc.i_qp_min = avctx->qmin; if (avctx->qmax >= 0) x4->params.rc.i_qp_max = avctx->qmax; if (avctx->max_qdiff >= 0) x4->params.rc.i_qp_step = avctx->max_qdiff; if (avctx->qblur >= 0) x4->params.rc.f_qblur = avctx->qblur; if (avctx->qcompress >= 0) x4->params.rc.f_qcompress = avctx->qcompress; if (avctx->refs >= 0) x4->params.i_frame_reference = avctx->refs; if (avctx->trellis >= 0) x4->params.analyse.i_trellis = avctx->trellis; if (avctx->me_range >= 0) x4->params.analyse.i_me_range = avctx->me_range; if (avctx->noise_reduction >= 0) x4->params.analyse.i_noise_reduction = avctx->noise_reduction; if (avctx->me_subpel_quality >= 0) x4->params.analyse.i_subpel_refine = avctx->me_subpel_quality; if (avctx->b_frame_strategy >= 0) x4->params.i_bframe_adaptive = avctx->b_frame_strategy; if (avctx->keyint_min >= 0) x4->params.i_keyint_min = avctx->keyint_min; #if FF_API_CODER_TYPE FF_DISABLE_DEPRECATION_WARNINGS if (avctx->coder_type >= 0) x4->coder = avctx->coder_type == FF_CODER_TYPE_AC; FF_ENABLE_DEPRECATION_WARNINGS #endif if (avctx->me_cmp >= 0) x4->params.analyse.b_chroma_me = avctx->me_cmp & FF_CMP_CHROMA; if (x4->aq_mode >= 0) x4->params.rc.i_aq_mode = x4->aq_mode; if (x4->aq_strength >= 0) x4->params.rc.f_aq_strength = x4->aq_strength; PARSE_X264_OPT("psy-rd", psy_rd); PARSE_X264_OPT("deblock", deblock); PARSE_X264_OPT("partitions", partitions); PARSE_X264_OPT("stats", stats); if (x4->psy >= 0) x4->params.analyse.b_psy = x4->psy; if (x4->rc_lookahead >= 0) x4->params.rc.i_lookahead = x4->rc_lookahead; if (x4->weightp >= 0) x4->params.analyse.i_weighted_pred = x4->weightp; if (x4->weightb >= 0) x4->params.analyse.b_weighted_bipred = x4->weightb; if (x4->cplxblur >= 0) x4->params.rc.f_complexity_blur = x4->cplxblur; if (x4->ssim >= 0) x4->params.analyse.b_ssim = x4->ssim; if (x4->intra_refresh >= 0) x4->params.b_intra_refresh = x4->intra_refresh; if (x4->bluray_compat >= 0) { x4->params.b_bluray_compat = x4->bluray_compat; x4->params.b_vfr_input = 0; } if (x4->b_bias != INT_MIN) x4->params.i_bframe_bias = x4->b_bias; if (x4->b_pyramid >= 0) x4->params.i_bframe_pyramid = x4->b_pyramid; if (x4->mixed_refs >= 0) x4->params.analyse.b_mixed_references = x4->mixed_refs; if (x4->dct8x8 >= 0) x4->params.analyse.b_transform_8x8 = x4->dct8x8; if (x4->fast_pskip >= 0) x4->params.analyse.b_fast_pskip = x4->fast_pskip; if (x4->aud >= 0) x4->params.b_aud = x4->aud; if (x4->mbtree >= 0) x4->params.rc.b_mb_tree = x4->mbtree; if (x4->direct_pred >= 0) x4->params.analyse.i_direct_mv_pred = x4->direct_pred; if (x4->slice_max_size >= 0) x4->params.i_slice_max_size = x4->slice_max_size; if (x4->fastfirstpass) x264_param_apply_fastfirstpass(&x4->params); if (x4->nal_hrd >= 0) x4->params.i_nal_hrd = x4->nal_hrd; if (x4->motion_est >= 0) { x4->params.analyse.i_me_method = x4->motion_est; #if FF_API_MOTION_EST FF_DISABLE_DEPRECATION_WARNINGS } else { if (avctx->me_method == ME_EPZS) x4->params.analyse.i_me_method = X264_ME_DIA; else if (avctx->me_method == ME_HEX) x4->params.analyse.i_me_method = X264_ME_HEX; else if (avctx->me_method == ME_UMH) x4->params.analyse.i_me_method = X264_ME_UMH; else if (avctx->me_method == ME_FULL) x4->params.analyse.i_me_method = X264_ME_ESA; else if (avctx->me_method == ME_TESA) x4->params.analyse.i_me_method = X264_ME_TESA; FF_ENABLE_DEPRECATION_WARNINGS #endif } if (x4->coder >= 0) x4->params.b_cabac = x4->coder; if (x4->profile) if (x264_param_apply_profile(&x4->params, x4->profile) < 0) { av_log(avctx, AV_LOG_ERROR, "Error setting profile %VAR_1.\n", x4->profile); return AVERROR(EINVAL); } x4->params.i_width = avctx->width; x4->params.i_height = avctx->height; x4->params.vui.i_sar_width = avctx->sample_aspect_ratio.num; x4->params.vui.i_sar_height = avctx->sample_aspect_ratio.den; x4->params.i_fps_num = x4->params.i_timebase_den = avctx->time_base.den; x4->params.i_fps_den = x4->params.i_timebase_num = avctx->time_base.num; x4->params.analyse.b_psnr = avctx->flags & AV_CODEC_FLAG_PSNR; x4->params.i_threads = avctx->thread_count; if (avctx->thread_type) x4->params.b_sliced_threads = avctx->thread_type == FF_THREAD_SLICE; x4->params.b_interlaced = avctx->flags & AV_CODEC_FLAG_INTERLACED_DCT; x4->params.b_open_gop = !(avctx->flags & AV_CODEC_FLAG_CLOSED_GOP); x4->params.i_slice_count = avctx->slices; x4->params.vui.b_fullrange = avctx->pix_fmt == AV_PIX_FMT_YUVJ420P || avctx->pix_fmt == AV_PIX_FMT_YUVJ422P || avctx->pix_fmt == AV_PIX_FMT_YUVJ444P || avctx->color_range == AVCOL_RANGE_JPEG; x4->params.vui.i_colorprim = avctx->color_primaries; x4->params.vui.i_transfer = avctx->color_trc; x4->params.vui.i_colmatrix = avctx->colorspace; if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) x4->params.b_repeat_headers = 0; if (x4->x264_params) { AVDictionary *dict = NULL; AVDictionaryEntry *en = NULL; if (!av_dict_parse_string(&dict, x4->x264_params, "=", ":", 0)) { while ((en = av_dict_get(dict, "", en, AV_DICT_IGNORE_SUFFIX))) { if (x264_param_parse(&x4->params, en->key, en->value) < 0) av_log(avctx, AV_LOG_WARNING, "Error parsing option '%VAR_1 = %VAR_1'.\n", en->key, en->value); } av_dict_free(&dict); } } avctx->has_b_frames = x4->params.i_bframe ? x4->params.i_bframe_pyramid ? 2 : 1 : 0; if (avctx->max_b_frames < 0) avctx->max_b_frames = 0; avctx->bit_rate = x4->params.rc.i_bitrate*1000; x4->enc = x264_encoder_open(&x4->params); if (!x4->enc) return AVERROR_UNKNOWN; if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) { x264_nal_t *nal; uint8_t *p; int VAR_0, VAR_1, VAR_2; VAR_1 = x264_encoder_headers(x4->enc, &nal, &VAR_0); avctx->extradata = p = av_mallocz(VAR_1 + AV_INPUT_BUFFER_PADDING_SIZE); if (!p) return AVERROR(ENOMEM); for (VAR_2 = 0; VAR_2 < VAR_0; VAR_2++) { if (nal[VAR_2].i_type == NAL_SEI) { av_log(avctx, AV_LOG_INFO, "%VAR_1\n", nal[VAR_2].p_payload+25); x4->sei_size = nal[VAR_2].i_payload; x4->sei = av_malloc(x4->sei_size); if (!x4->sei) return AVERROR(ENOMEM); memcpy(x4->sei, nal[VAR_2].p_payload, nal[VAR_2].i_payload); continue; } memcpy(p, nal[VAR_2].p_payload, nal[VAR_2].i_payload); p += nal[VAR_2].i_payload; } avctx->extradata_size = p - avctx->extradata; } cpb_props = ff_add_cpb_side_data(avctx); if (!cpb_props) return AVERROR(ENOMEM); cpb_props->buffer_size = x4->params.rc.i_vbv_buffer_size * 1000; cpb_props->max_bitrate = x4->params.rc.i_vbv_max_bitrate * 1000; cpb_props->avg_bitrate = x4->params.rc.i_bitrate * 1000; return 0; }
[ "static av_cold int FUNC_0(AVCodecContext *avctx)\n{", "X264Context *x4 = avctx->priv_data;", "AVCPBProperties *cpb_props;", "#if CONFIG_LIBX262_ENCODER\nif (avctx->codec_id == AV_CODEC_ID_MPEG2VIDEO) {", "x4->params.b_mpeg2 = 1;", "x264_param_default_mpeg2(&x4->params);", "} else", "#else\nx264_param_default(&x4->params);", "#endif\nx4->params.b_deblocking_filter = avctx->flags & AV_CODEC_FLAG_LOOP_FILTER;", "if (x4->preset || x4->tune)\nif (x264_param_default_preset(&x4->params, x4->preset, x4->tune) < 0) {", "av_log(avctx, AV_LOG_ERROR, \"Error setting preset/tune %VAR_1/%VAR_1.\\n\", x4->preset, x4->tune);", "return AVERROR(EINVAL);", "}", "if (avctx->level > 0)\nx4->params.i_level_idc = avctx->level;", "x4->params.pf_log = X264_log;", "x4->params.p_log_private = avctx;", "x4->params.i_log_level = X264_LOG_DEBUG;", "x4->params.i_csp = convert_pix_fmt(avctx->pix_fmt);", "if (avctx->bit_rate) {", "x4->params.rc.i_bitrate = avctx->bit_rate / 1000;", "x4->params.rc.i_rc_method = X264_RC_ABR;", "}", "x4->params.rc.i_vbv_buffer_size = avctx->rc_buffer_size / 1000;", "x4->params.rc.i_vbv_max_bitrate = avctx->rc_max_rate / 1000;", "x4->params.rc.b_stat_write = avctx->flags & AV_CODEC_FLAG_PASS1;", "if (avctx->flags & AV_CODEC_FLAG_PASS2) {", "x4->params.rc.b_stat_read = 1;", "} else {", "if (x4->crf >= 0) {", "x4->params.rc.i_rc_method = X264_RC_CRF;", "x4->params.rc.f_rf_constant = x4->crf;", "} else if (x4->cqp >= 0) {", "x4->params.rc.i_rc_method = X264_RC_CQP;", "x4->params.rc.i_qp_constant = x4->cqp;", "}", "if (x4->crf_max >= 0)\nx4->params.rc.f_rf_constant_max = x4->crf_max;", "}", "if (avctx->rc_buffer_size && avctx->rc_initial_buffer_occupancy > 0 &&\n(avctx->rc_initial_buffer_occupancy <= avctx->rc_buffer_size)) {", "x4->params.rc.f_vbv_buffer_init =\n(float)avctx->rc_initial_buffer_occupancy / avctx->rc_buffer_size;", "}", "if (avctx->i_quant_factor > 0)\nx4->params.rc.f_ip_factor = 1 / fabs(avctx->i_quant_factor);", "x4->params.rc.f_pb_factor = avctx->b_quant_factor;", "x4->params.analyse.i_chroma_qp_offset = avctx->chromaoffset;", "if (avctx->gop_size >= 0)\nx4->params.i_keyint_max = avctx->gop_size;", "if (avctx->max_b_frames >= 0)\nx4->params.i_bframe = avctx->max_b_frames;", "if (avctx->scenechange_threshold >= 0)\nx4->params.i_scenecut_threshold = avctx->scenechange_threshold;", "if (avctx->qmin >= 0)\nx4->params.rc.i_qp_min = avctx->qmin;", "if (avctx->qmax >= 0)\nx4->params.rc.i_qp_max = avctx->qmax;", "if (avctx->max_qdiff >= 0)\nx4->params.rc.i_qp_step = avctx->max_qdiff;", "if (avctx->qblur >= 0)\nx4->params.rc.f_qblur = avctx->qblur;", "if (avctx->qcompress >= 0)\nx4->params.rc.f_qcompress = avctx->qcompress;", "if (avctx->refs >= 0)\nx4->params.i_frame_reference = avctx->refs;", "if (avctx->trellis >= 0)\nx4->params.analyse.i_trellis = avctx->trellis;", "if (avctx->me_range >= 0)\nx4->params.analyse.i_me_range = avctx->me_range;", "if (avctx->noise_reduction >= 0)\nx4->params.analyse.i_noise_reduction = avctx->noise_reduction;", "if (avctx->me_subpel_quality >= 0)\nx4->params.analyse.i_subpel_refine = avctx->me_subpel_quality;", "if (avctx->b_frame_strategy >= 0)\nx4->params.i_bframe_adaptive = avctx->b_frame_strategy;", "if (avctx->keyint_min >= 0)\nx4->params.i_keyint_min = avctx->keyint_min;", "#if FF_API_CODER_TYPE\nFF_DISABLE_DEPRECATION_WARNINGS\nif (avctx->coder_type >= 0)\nx4->coder = avctx->coder_type == FF_CODER_TYPE_AC;", "FF_ENABLE_DEPRECATION_WARNINGS\n#endif\nif (avctx->me_cmp >= 0)\nx4->params.analyse.b_chroma_me = avctx->me_cmp & FF_CMP_CHROMA;", "if (x4->aq_mode >= 0)\nx4->params.rc.i_aq_mode = x4->aq_mode;", "if (x4->aq_strength >= 0)\nx4->params.rc.f_aq_strength = x4->aq_strength;", "PARSE_X264_OPT(\"psy-rd\", psy_rd);", "PARSE_X264_OPT(\"deblock\", deblock);", "PARSE_X264_OPT(\"partitions\", partitions);", "PARSE_X264_OPT(\"stats\", stats);", "if (x4->psy >= 0)\nx4->params.analyse.b_psy = x4->psy;", "if (x4->rc_lookahead >= 0)\nx4->params.rc.i_lookahead = x4->rc_lookahead;", "if (x4->weightp >= 0)\nx4->params.analyse.i_weighted_pred = x4->weightp;", "if (x4->weightb >= 0)\nx4->params.analyse.b_weighted_bipred = x4->weightb;", "if (x4->cplxblur >= 0)\nx4->params.rc.f_complexity_blur = x4->cplxblur;", "if (x4->ssim >= 0)\nx4->params.analyse.b_ssim = x4->ssim;", "if (x4->intra_refresh >= 0)\nx4->params.b_intra_refresh = x4->intra_refresh;", "if (x4->bluray_compat >= 0) {", "x4->params.b_bluray_compat = x4->bluray_compat;", "x4->params.b_vfr_input = 0;", "}", "if (x4->b_bias != INT_MIN)\nx4->params.i_bframe_bias = x4->b_bias;", "if (x4->b_pyramid >= 0)\nx4->params.i_bframe_pyramid = x4->b_pyramid;", "if (x4->mixed_refs >= 0)\nx4->params.analyse.b_mixed_references = x4->mixed_refs;", "if (x4->dct8x8 >= 0)\nx4->params.analyse.b_transform_8x8 = x4->dct8x8;", "if (x4->fast_pskip >= 0)\nx4->params.analyse.b_fast_pskip = x4->fast_pskip;", "if (x4->aud >= 0)\nx4->params.b_aud = x4->aud;", "if (x4->mbtree >= 0)\nx4->params.rc.b_mb_tree = x4->mbtree;", "if (x4->direct_pred >= 0)\nx4->params.analyse.i_direct_mv_pred = x4->direct_pred;", "if (x4->slice_max_size >= 0)\nx4->params.i_slice_max_size = x4->slice_max_size;", "if (x4->fastfirstpass)\nx264_param_apply_fastfirstpass(&x4->params);", "if (x4->nal_hrd >= 0)\nx4->params.i_nal_hrd = x4->nal_hrd;", "if (x4->motion_est >= 0) {", "x4->params.analyse.i_me_method = x4->motion_est;", "#if FF_API_MOTION_EST\nFF_DISABLE_DEPRECATION_WARNINGS\n} else {", "if (avctx->me_method == ME_EPZS)\nx4->params.analyse.i_me_method = X264_ME_DIA;", "else if (avctx->me_method == ME_HEX)\nx4->params.analyse.i_me_method = X264_ME_HEX;", "else if (avctx->me_method == ME_UMH)\nx4->params.analyse.i_me_method = X264_ME_UMH;", "else if (avctx->me_method == ME_FULL)\nx4->params.analyse.i_me_method = X264_ME_ESA;", "else if (avctx->me_method == ME_TESA)\nx4->params.analyse.i_me_method = X264_ME_TESA;", "FF_ENABLE_DEPRECATION_WARNINGS\n#endif\n}", "if (x4->coder >= 0)\nx4->params.b_cabac = x4->coder;", "if (x4->profile)\nif (x264_param_apply_profile(&x4->params, x4->profile) < 0) {", "av_log(avctx, AV_LOG_ERROR, \"Error setting profile %VAR_1.\\n\", x4->profile);", "return AVERROR(EINVAL);", "}", "x4->params.i_width = avctx->width;", "x4->params.i_height = avctx->height;", "x4->params.vui.i_sar_width = avctx->sample_aspect_ratio.num;", "x4->params.vui.i_sar_height = avctx->sample_aspect_ratio.den;", "x4->params.i_fps_num = x4->params.i_timebase_den = avctx->time_base.den;", "x4->params.i_fps_den = x4->params.i_timebase_num = avctx->time_base.num;", "x4->params.analyse.b_psnr = avctx->flags & AV_CODEC_FLAG_PSNR;", "x4->params.i_threads = avctx->thread_count;", "if (avctx->thread_type)\nx4->params.b_sliced_threads = avctx->thread_type == FF_THREAD_SLICE;", "x4->params.b_interlaced = avctx->flags & AV_CODEC_FLAG_INTERLACED_DCT;", "x4->params.b_open_gop = !(avctx->flags & AV_CODEC_FLAG_CLOSED_GOP);", "x4->params.i_slice_count = avctx->slices;", "x4->params.vui.b_fullrange = avctx->pix_fmt == AV_PIX_FMT_YUVJ420P ||\navctx->pix_fmt == AV_PIX_FMT_YUVJ422P ||\navctx->pix_fmt == AV_PIX_FMT_YUVJ444P ||\navctx->color_range == AVCOL_RANGE_JPEG;", "x4->params.vui.i_colorprim = avctx->color_primaries;", "x4->params.vui.i_transfer = avctx->color_trc;", "x4->params.vui.i_colmatrix = avctx->colorspace;", "if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER)\nx4->params.b_repeat_headers = 0;", "if (x4->x264_params) {", "AVDictionary *dict = NULL;", "AVDictionaryEntry *en = NULL;", "if (!av_dict_parse_string(&dict, x4->x264_params, \"=\", \":\", 0)) {", "while ((en = av_dict_get(dict, \"\", en, AV_DICT_IGNORE_SUFFIX))) {", "if (x264_param_parse(&x4->params, en->key, en->value) < 0)\nav_log(avctx, AV_LOG_WARNING,\n\"Error parsing option '%VAR_1 = %VAR_1'.\\n\",\nen->key, en->value);", "}", "av_dict_free(&dict);", "}", "}", "avctx->has_b_frames = x4->params.i_bframe ?\nx4->params.i_bframe_pyramid ? 2 : 1 : 0;", "if (avctx->max_b_frames < 0)\navctx->max_b_frames = 0;", "avctx->bit_rate = x4->params.rc.i_bitrate*1000;", "x4->enc = x264_encoder_open(&x4->params);", "if (!x4->enc)\nreturn AVERROR_UNKNOWN;", "if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) {", "x264_nal_t *nal;", "uint8_t *p;", "int VAR_0, VAR_1, VAR_2;", "VAR_1 = x264_encoder_headers(x4->enc, &nal, &VAR_0);", "avctx->extradata = p = av_mallocz(VAR_1 + AV_INPUT_BUFFER_PADDING_SIZE);", "if (!p)\nreturn AVERROR(ENOMEM);", "for (VAR_2 = 0; VAR_2 < VAR_0; VAR_2++) {", "if (nal[VAR_2].i_type == NAL_SEI) {", "av_log(avctx, AV_LOG_INFO, \"%VAR_1\\n\", nal[VAR_2].p_payload+25);", "x4->sei_size = nal[VAR_2].i_payload;", "x4->sei = av_malloc(x4->sei_size);", "if (!x4->sei)\nreturn AVERROR(ENOMEM);", "memcpy(x4->sei, nal[VAR_2].p_payload, nal[VAR_2].i_payload);", "continue;", "}", "memcpy(p, nal[VAR_2].p_payload, nal[VAR_2].i_payload);", "p += nal[VAR_2].i_payload;", "}", "avctx->extradata_size = p - avctx->extradata;", "}", "cpb_props = ff_add_cpb_side_data(avctx);", "if (!cpb_props)\nreturn AVERROR(ENOMEM);", "cpb_props->buffer_size = x4->params.rc.i_vbv_buffer_size * 1000;", "cpb_props->max_bitrate = x4->params.rc.i_vbv_max_bitrate * 1000;", "cpb_props->avg_bitrate = x4->params.rc.i_bitrate * 1000;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11, 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21, 23 ], [ 25, 29 ], [ 33, 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45, 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 97, 99 ], [ 101 ], [ 105, 107 ], [ 109, 111 ], [ 113 ], [ 117, 119 ], [ 121 ], [ 123 ], [ 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 ], [ 205, 207 ], [ 209, 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221, 223 ], [ 225, 227 ], [ 229, 231 ], [ 233, 235 ], [ 237, 239 ], [ 243, 245 ], [ 247, 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259, 261 ], [ 263, 265 ], [ 267, 269 ], [ 271, 273 ], [ 275, 277 ], [ 279, 281 ], [ 283, 285 ], [ 287, 289 ], [ 293, 295 ], [ 299, 301 ], [ 305, 307 ], [ 311 ], [ 313 ], [ 315, 317, 319 ], [ 321, 323 ], [ 325, 327 ], [ 329, 331 ], [ 333, 335 ], [ 337, 339 ], [ 341, 343, 345 ], [ 349, 351 ], [ 355, 357 ], [ 359 ], [ 361 ], [ 363 ], [ 367 ], [ 369 ], [ 371 ], [ 373 ], [ 375 ], [ 377 ], [ 381 ], [ 385 ], [ 387, 389 ], [ 393 ], [ 397 ], [ 401 ], [ 405, 407, 409, 411 ], [ 417 ], [ 419 ], [ 421 ], [ 425, 427 ], [ 431 ], [ 433 ], [ 435 ], [ 439 ], [ 441 ], [ 443, 445, 447, 449 ], [ 451 ], [ 455 ], [ 457 ], [ 459 ], [ 465, 467 ], [ 469, 471 ], [ 475 ], [ 479 ], [ 481, 483 ], [ 487 ], [ 489 ], [ 491 ], [ 493 ], [ 497 ], [ 499 ], [ 501, 503 ], [ 507 ], [ 511 ], [ 513 ], [ 515 ], [ 517 ], [ 519, 521 ], [ 523 ], [ 525 ], [ 527 ], [ 529 ], [ 531 ], [ 533 ], [ 535 ], [ 537 ], [ 541 ], [ 543, 545 ], [ 547 ], [ 549 ], [ 551 ], [ 555 ], [ 557 ] ]
2,432
static void blend_image_rgba_pm(AVFilterContext *ctx, AVFrame *dst, const AVFrame *src, int x, int y) { blend_image_packed_rgb(ctx, dst, src, 1, x, y, 1); }
false
FFmpeg
6260ab60a80fd8baebf79f9ce9299b0db72333b5
static void blend_image_rgba_pm(AVFilterContext *ctx, AVFrame *dst, const AVFrame *src, int x, int y) { blend_image_packed_rgb(ctx, dst, src, 1, x, y, 1); }
{ "code": [], "line_no": [] }
static void FUNC_0(AVFilterContext *VAR_0, AVFrame *VAR_1, const AVFrame *VAR_2, int VAR_3, int VAR_4) { blend_image_packed_rgb(VAR_0, VAR_1, VAR_2, 1, VAR_3, VAR_4, 1); }
[ "static void FUNC_0(AVFilterContext *VAR_0, AVFrame *VAR_1, const AVFrame *VAR_2, int VAR_3, int VAR_4)\n{", "blend_image_packed_rgb(VAR_0, VAR_1, VAR_2, 1, VAR_3, VAR_4, 1);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
2,433
int ff_h264_frame_start(H264Context *h) { Picture *pic; int i, ret; const int pixel_shift = h->pixel_shift; int c[4] = { 1<<(h->sps.bit_depth_luma-1), 1<<(h->sps.bit_depth_chroma-1), 1<<(h->sps.bit_depth_chroma-1), -1 }; if (!ff_thread_can_start_frame(h->avctx)) { av_log(h->avctx, AV_LOG_ERROR, "Attempt to start a frame outside SETUP state\n"); return -1; } release_unused_pictures(h, 1); h->cur_pic_ptr = NULL; i = find_unused_picture(h); if (i < 0) { av_log(h->avctx, AV_LOG_ERROR, "no frame buffer available\n"); return i; } pic = &h->DPB[i]; pic->f.reference = h->droppable ? 0 : h->picture_structure; pic->f.coded_picture_number = h->coded_picture_number++; pic->field_picture = h->picture_structure != PICT_FRAME; /* * Zero key_frame here; IDR markings per slice in frame or fields are ORed * in later. * See decode_nal_units(). */ pic->f.key_frame = 0; pic->sync = 0; pic->mmco_reset = 0; if ((ret = alloc_picture(h, pic)) < 0) return ret; if(!h->sync && !h->avctx->hwaccel && !(h->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU)) avpriv_color_frame(&pic->f, c); h->cur_pic_ptr = pic; h->cur_pic = *h->cur_pic_ptr; h->cur_pic.f.extended_data = h->cur_pic.f.data; ff_er_frame_start(&h->er); assert(h->linesize && h->uvlinesize); for (i = 0; i < 16; i++) { h->block_offset[i] = (4 * ((scan8[i] - scan8[0]) & 7) << pixel_shift) + 4 * h->linesize * ((scan8[i] - scan8[0]) >> 3); h->block_offset[48 + i] = (4 * ((scan8[i] - scan8[0]) & 7) << pixel_shift) + 8 * h->linesize * ((scan8[i] - scan8[0]) >> 3); } for (i = 0; i < 16; i++) { h->block_offset[16 + i] = h->block_offset[32 + i] = (4 * ((scan8[i] - scan8[0]) & 7) << pixel_shift) + 4 * h->uvlinesize * ((scan8[i] - scan8[0]) >> 3); h->block_offset[48 + 16 + i] = h->block_offset[48 + 32 + i] = (4 * ((scan8[i] - scan8[0]) & 7) << pixel_shift) + 8 * h->uvlinesize * ((scan8[i] - scan8[0]) >> 3); } /* can't be in alloc_tables because linesize isn't known there. * FIXME: redo bipred weight to not require extra buffer? */ for (i = 0; i < h->slice_context_count; i++) if (h->thread_context[i]) { ret = alloc_scratch_buffers(h->thread_context[i], h->linesize); if (ret < 0) return ret; } /* Some macroblocks can be accessed before they're available in case * of lost slices, MBAFF or threading. */ memset(h->slice_table, -1, (h->mb_height * h->mb_stride - 1) * sizeof(*h->slice_table)); // s->decode = (h->flags & CODEC_FLAG_PSNR) || !s->encoding || // h->cur_pic.f.reference /* || h->contains_intra */ || 1; /* We mark the current picture as non-reference after allocating it, so * that if we break out due to an error it can be released automatically * in the next ff_MPV_frame_start(). * SVQ3 as well as most other codecs have only last/next/current and thus * get released even with set reference, besides SVQ3 and others do not * mark frames as reference later "naturally". */ if (h->avctx->codec_id != AV_CODEC_ID_SVQ3) h->cur_pic_ptr->f.reference = 0; h->cur_pic_ptr->field_poc[0] = h->cur_pic_ptr->field_poc[1] = INT_MAX; h->next_output_pic = NULL; assert(h->cur_pic_ptr->long_ref == 0); return 0; }
false
FFmpeg
039f55c80333a9db0e64e5c975b0820bff01c5e2
int ff_h264_frame_start(H264Context *h) { Picture *pic; int i, ret; const int pixel_shift = h->pixel_shift; int c[4] = { 1<<(h->sps.bit_depth_luma-1), 1<<(h->sps.bit_depth_chroma-1), 1<<(h->sps.bit_depth_chroma-1), -1 }; if (!ff_thread_can_start_frame(h->avctx)) { av_log(h->avctx, AV_LOG_ERROR, "Attempt to start a frame outside SETUP state\n"); return -1; } release_unused_pictures(h, 1); h->cur_pic_ptr = NULL; i = find_unused_picture(h); if (i < 0) { av_log(h->avctx, AV_LOG_ERROR, "no frame buffer available\n"); return i; } pic = &h->DPB[i]; pic->f.reference = h->droppable ? 0 : h->picture_structure; pic->f.coded_picture_number = h->coded_picture_number++; pic->field_picture = h->picture_structure != PICT_FRAME; pic->f.key_frame = 0; pic->sync = 0; pic->mmco_reset = 0; if ((ret = alloc_picture(h, pic)) < 0) return ret; if(!h->sync && !h->avctx->hwaccel && !(h->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU)) avpriv_color_frame(&pic->f, c); h->cur_pic_ptr = pic; h->cur_pic = *h->cur_pic_ptr; h->cur_pic.f.extended_data = h->cur_pic.f.data; ff_er_frame_start(&h->er); assert(h->linesize && h->uvlinesize); for (i = 0; i < 16; i++) { h->block_offset[i] = (4 * ((scan8[i] - scan8[0]) & 7) << pixel_shift) + 4 * h->linesize * ((scan8[i] - scan8[0]) >> 3); h->block_offset[48 + i] = (4 * ((scan8[i] - scan8[0]) & 7) << pixel_shift) + 8 * h->linesize * ((scan8[i] - scan8[0]) >> 3); } for (i = 0; i < 16; i++) { h->block_offset[16 + i] = h->block_offset[32 + i] = (4 * ((scan8[i] - scan8[0]) & 7) << pixel_shift) + 4 * h->uvlinesize * ((scan8[i] - scan8[0]) >> 3); h->block_offset[48 + 16 + i] = h->block_offset[48 + 32 + i] = (4 * ((scan8[i] - scan8[0]) & 7) << pixel_shift) + 8 * h->uvlinesize * ((scan8[i] - scan8[0]) >> 3); } for (i = 0; i < h->slice_context_count; i++) if (h->thread_context[i]) { ret = alloc_scratch_buffers(h->thread_context[i], h->linesize); if (ret < 0) return ret; } memset(h->slice_table, -1, (h->mb_height * h->mb_stride - 1) * sizeof(*h->slice_table)); if (h->avctx->codec_id != AV_CODEC_ID_SVQ3) h->cur_pic_ptr->f.reference = 0; h->cur_pic_ptr->field_poc[0] = h->cur_pic_ptr->field_poc[1] = INT_MAX; h->next_output_pic = NULL; assert(h->cur_pic_ptr->long_ref == 0); return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(H264Context *VAR_0) { Picture *pic; int VAR_1, VAR_2; const int VAR_3 = VAR_0->VAR_3; int VAR_4[4] = { 1<<(VAR_0->sps.bit_depth_luma-1), 1<<(VAR_0->sps.bit_depth_chroma-1), 1<<(VAR_0->sps.bit_depth_chroma-1), -1 }; if (!ff_thread_can_start_frame(VAR_0->avctx)) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Attempt to start a frame outside SETUP state\n"); return -1; } release_unused_pictures(VAR_0, 1); VAR_0->cur_pic_ptr = NULL; VAR_1 = find_unused_picture(VAR_0); if (VAR_1 < 0) { av_log(VAR_0->avctx, AV_LOG_ERROR, "no frame buffer available\n"); return VAR_1; } pic = &VAR_0->DPB[VAR_1]; pic->f.reference = VAR_0->droppable ? 0 : VAR_0->picture_structure; pic->f.coded_picture_number = VAR_0->coded_picture_number++; pic->field_picture = VAR_0->picture_structure != PICT_FRAME; pic->f.key_frame = 0; pic->sync = 0; pic->mmco_reset = 0; if ((VAR_2 = alloc_picture(VAR_0, pic)) < 0) return VAR_2; if(!VAR_0->sync && !VAR_0->avctx->hwaccel && !(VAR_0->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU)) avpriv_color_frame(&pic->f, VAR_4); VAR_0->cur_pic_ptr = pic; VAR_0->cur_pic = *VAR_0->cur_pic_ptr; VAR_0->cur_pic.f.extended_data = VAR_0->cur_pic.f.data; ff_er_frame_start(&VAR_0->er); assert(VAR_0->linesize && VAR_0->uvlinesize); for (VAR_1 = 0; VAR_1 < 16; VAR_1++) { VAR_0->block_offset[VAR_1] = (4 * ((scan8[VAR_1] - scan8[0]) & 7) << VAR_3) + 4 * VAR_0->linesize * ((scan8[VAR_1] - scan8[0]) >> 3); VAR_0->block_offset[48 + VAR_1] = (4 * ((scan8[VAR_1] - scan8[0]) & 7) << VAR_3) + 8 * VAR_0->linesize * ((scan8[VAR_1] - scan8[0]) >> 3); } for (VAR_1 = 0; VAR_1 < 16; VAR_1++) { VAR_0->block_offset[16 + VAR_1] = VAR_0->block_offset[32 + VAR_1] = (4 * ((scan8[VAR_1] - scan8[0]) & 7) << VAR_3) + 4 * VAR_0->uvlinesize * ((scan8[VAR_1] - scan8[0]) >> 3); VAR_0->block_offset[48 + 16 + VAR_1] = VAR_0->block_offset[48 + 32 + VAR_1] = (4 * ((scan8[VAR_1] - scan8[0]) & 7) << VAR_3) + 8 * VAR_0->uvlinesize * ((scan8[VAR_1] - scan8[0]) >> 3); } for (VAR_1 = 0; VAR_1 < VAR_0->slice_context_count; VAR_1++) if (VAR_0->thread_context[VAR_1]) { VAR_2 = alloc_scratch_buffers(VAR_0->thread_context[VAR_1], VAR_0->linesize); if (VAR_2 < 0) return VAR_2; } memset(VAR_0->slice_table, -1, (VAR_0->mb_height * VAR_0->mb_stride - 1) * sizeof(*VAR_0->slice_table)); if (VAR_0->avctx->codec_id != AV_CODEC_ID_SVQ3) VAR_0->cur_pic_ptr->f.reference = 0; VAR_0->cur_pic_ptr->field_poc[0] = VAR_0->cur_pic_ptr->field_poc[1] = INT_MAX; VAR_0->next_output_pic = NULL; assert(VAR_0->cur_pic_ptr->long_ref == 0); return 0; }
[ "int FUNC_0(H264Context *VAR_0)\n{", "Picture *pic;", "int VAR_1, VAR_2;", "const int VAR_3 = VAR_0->VAR_3;", "int VAR_4[4] = {", "1<<(VAR_0->sps.bit_depth_luma-1),\n1<<(VAR_0->sps.bit_depth_chroma-1),\n1<<(VAR_0->sps.bit_depth_chroma-1),\n-1\n};", "if (!ff_thread_can_start_frame(VAR_0->avctx)) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Attempt to start a frame outside SETUP state\\n\");", "return -1;", "}", "release_unused_pictures(VAR_0, 1);", "VAR_0->cur_pic_ptr = NULL;", "VAR_1 = find_unused_picture(VAR_0);", "if (VAR_1 < 0) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"no frame buffer available\\n\");", "return VAR_1;", "}", "pic = &VAR_0->DPB[VAR_1];", "pic->f.reference = VAR_0->droppable ? 0 : VAR_0->picture_structure;", "pic->f.coded_picture_number = VAR_0->coded_picture_number++;", "pic->field_picture = VAR_0->picture_structure != PICT_FRAME;", "pic->f.key_frame = 0;", "pic->sync = 0;", "pic->mmco_reset = 0;", "if ((VAR_2 = alloc_picture(VAR_0, pic)) < 0)\nreturn VAR_2;", "if(!VAR_0->sync && !VAR_0->avctx->hwaccel &&\n!(VAR_0->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU))\navpriv_color_frame(&pic->f, VAR_4);", "VAR_0->cur_pic_ptr = pic;", "VAR_0->cur_pic = *VAR_0->cur_pic_ptr;", "VAR_0->cur_pic.f.extended_data = VAR_0->cur_pic.f.data;", "ff_er_frame_start(&VAR_0->er);", "assert(VAR_0->linesize && VAR_0->uvlinesize);", "for (VAR_1 = 0; VAR_1 < 16; VAR_1++) {", "VAR_0->block_offset[VAR_1] = (4 * ((scan8[VAR_1] - scan8[0]) & 7) << VAR_3) + 4 * VAR_0->linesize * ((scan8[VAR_1] - scan8[0]) >> 3);", "VAR_0->block_offset[48 + VAR_1] = (4 * ((scan8[VAR_1] - scan8[0]) & 7) << VAR_3) + 8 * VAR_0->linesize * ((scan8[VAR_1] - scan8[0]) >> 3);", "}", "for (VAR_1 = 0; VAR_1 < 16; VAR_1++) {", "VAR_0->block_offset[16 + VAR_1] =\nVAR_0->block_offset[32 + VAR_1] = (4 * ((scan8[VAR_1] - scan8[0]) & 7) << VAR_3) + 4 * VAR_0->uvlinesize * ((scan8[VAR_1] - scan8[0]) >> 3);", "VAR_0->block_offset[48 + 16 + VAR_1] =\nVAR_0->block_offset[48 + 32 + VAR_1] = (4 * ((scan8[VAR_1] - scan8[0]) & 7) << VAR_3) + 8 * VAR_0->uvlinesize * ((scan8[VAR_1] - scan8[0]) >> 3);", "}", "for (VAR_1 = 0; VAR_1 < VAR_0->slice_context_count; VAR_1++)", "if (VAR_0->thread_context[VAR_1]) {", "VAR_2 = alloc_scratch_buffers(VAR_0->thread_context[VAR_1], VAR_0->linesize);", "if (VAR_2 < 0)\nreturn VAR_2;", "}", "memset(VAR_0->slice_table, -1,\n(VAR_0->mb_height * VAR_0->mb_stride - 1) * sizeof(*VAR_0->slice_table));", "if (VAR_0->avctx->codec_id != AV_CODEC_ID_SVQ3)\nVAR_0->cur_pic_ptr->f.reference = 0;", "VAR_0->cur_pic_ptr->field_poc[0] = VAR_0->cur_pic_ptr->field_poc[1] = INT_MAX;", "VAR_0->next_output_pic = NULL;", "assert(VAR_0->cur_pic_ptr->long_ref == 0);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13, 15, 17, 19, 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 73 ], [ 75 ], [ 77 ], [ 81, 83 ], [ 85, 87, 89 ], [ 93 ], [ 95 ], [ 97 ], [ 101 ], [ 105 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119, 121 ], [ 123, 125 ], [ 127 ], [ 135 ], [ 137 ], [ 139 ], [ 141, 143 ], [ 145 ], [ 153, 155 ], [ 177, 179 ], [ 183 ], [ 187 ], [ 191 ], [ 195 ], [ 197 ] ]
2,434
static int probe(AVProbeData *p) { if (p->buf_size < 13) return 0; if (p->buf[0] == 0x01 && p->buf[1] == 0x00 && p->buf[4] == 0x01 + p->buf[2] && p->buf[8] == p->buf[4] + p->buf[6] && p->buf[12] == p->buf[8] + p->buf[10]) return AVPROBE_SCORE_MAX; return 0; }
false
FFmpeg
87e8788680e16c51f6048af26f3f7830c35207a5
static int probe(AVProbeData *p) { if (p->buf_size < 13) return 0; if (p->buf[0] == 0x01 && p->buf[1] == 0x00 && p->buf[4] == 0x01 + p->buf[2] && p->buf[8] == p->buf[4] + p->buf[6] && p->buf[12] == p->buf[8] + p->buf[10]) return AVPROBE_SCORE_MAX; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVProbeData *VAR_0) { if (VAR_0->buf_size < 13) return 0; if (VAR_0->buf[0] == 0x01 && VAR_0->buf[1] == 0x00 && VAR_0->buf[4] == 0x01 + VAR_0->buf[2] && VAR_0->buf[8] == VAR_0->buf[4] + VAR_0->buf[6] && VAR_0->buf[12] == VAR_0->buf[8] + VAR_0->buf[10]) return AVPROBE_SCORE_MAX; return 0; }
[ "static int FUNC_0(AVProbeData *VAR_0)\n{", "if (VAR_0->buf_size < 13)\nreturn 0;", "if (VAR_0->buf[0] == 0x01 && VAR_0->buf[1] == 0x00 &&\nVAR_0->buf[4] == 0x01 + VAR_0->buf[2] &&\nVAR_0->buf[8] == VAR_0->buf[4] + VAR_0->buf[6] &&\nVAR_0->buf[12] == VAR_0->buf[8] + VAR_0->buf[10])\nreturn AVPROBE_SCORE_MAX;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 11, 13, 15, 17, 19 ], [ 23 ], [ 25 ] ]
2,435
void ff_weight_h264_pixels8_8_msa(uint8_t *src, int stride, int height, int log2_denom, int weight_src, int offset) { avc_wgt_8width_msa(src, stride, height, log2_denom, weight_src, offset); }
false
FFmpeg
bcd7bf7eeb09a395cc01698842d1b8be9af483fc
void ff_weight_h264_pixels8_8_msa(uint8_t *src, int stride, int height, int log2_denom, int weight_src, int offset) { avc_wgt_8width_msa(src, stride, height, log2_denom, weight_src, offset); }
{ "code": [], "line_no": [] }
void FUNC_0(uint8_t *VAR_0, int VAR_1, int VAR_2, int VAR_3, int VAR_4, int VAR_5) { avc_wgt_8width_msa(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5); }
[ "void FUNC_0(uint8_t *VAR_0, int VAR_1,\nint VAR_2, int VAR_3,\nint VAR_4, int VAR_5)\n{", "avc_wgt_8width_msa(VAR_0, VAR_1,\nVAR_2, VAR_3, VAR_4, VAR_5);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9, 11 ], [ 13 ] ]
2,436
void ff_fetch_timestamp(AVCodecParserContext *s, int off, int remove){ int i; s->dts= s->pts= AV_NOPTS_VALUE; s->offset= 0; for(i = 0; i < AV_PARSER_PTS_NB; i++) { if ( s->next_frame_offset + off >= s->cur_frame_offset[i] &&(s-> frame_offset < s->cur_frame_offset[i] || !s->frame_offset) //check is disabled becausue mpeg-ts doesnt send complete PES packets && /*s->next_frame_offset + off <*/ s->cur_frame_end[i]){ s->dts= s->cur_frame_dts[i]; s->pts= s->cur_frame_pts[i]; s->offset = s->next_frame_offset - s->cur_frame_offset[i]; if(remove) s->cur_frame_offset[i]= INT64_MAX; } } }
false
FFmpeg
a4c7a5ea27050a28625eabf1ba98cfef9ac6620d
void ff_fetch_timestamp(AVCodecParserContext *s, int off, int remove){ int i; s->dts= s->pts= AV_NOPTS_VALUE; s->offset= 0; for(i = 0; i < AV_PARSER_PTS_NB; i++) { if ( s->next_frame_offset + off >= s->cur_frame_offset[i] &&(s-> frame_offset < s->cur_frame_offset[i] || !s->frame_offset) && s->cur_frame_end[i]){ s->dts= s->cur_frame_dts[i]; s->pts= s->cur_frame_pts[i]; s->offset = s->next_frame_offset - s->cur_frame_offset[i]; if(remove) s->cur_frame_offset[i]= INT64_MAX; } } }
{ "code": [], "line_no": [] }
void FUNC_0(AVCodecParserContext *VAR_0, int VAR_1, int VAR_2){ int VAR_3; VAR_0->dts= VAR_0->pts= AV_NOPTS_VALUE; VAR_0->offset= 0; for(VAR_3 = 0; VAR_3 < AV_PARSER_PTS_NB; VAR_3++) { if ( VAR_0->next_frame_offset + VAR_1 >= VAR_0->cur_frame_offset[VAR_3] &&(VAR_0-> frame_offset < VAR_0->cur_frame_offset[VAR_3] || !VAR_0->frame_offset) && VAR_0->cur_frame_end[VAR_3]){ VAR_0->dts= VAR_0->cur_frame_dts[VAR_3]; VAR_0->pts= VAR_0->cur_frame_pts[VAR_3]; VAR_0->offset = VAR_0->next_frame_offset - VAR_0->cur_frame_offset[VAR_3]; if(VAR_2) VAR_0->cur_frame_offset[VAR_3]= INT64_MAX; } } }
[ "void FUNC_0(AVCodecParserContext *VAR_0, int VAR_1, int VAR_2){", "int VAR_3;", "VAR_0->dts= VAR_0->pts= AV_NOPTS_VALUE;", "VAR_0->offset= 0;", "for(VAR_3 = 0; VAR_3 < AV_PARSER_PTS_NB; VAR_3++) {", "if ( VAR_0->next_frame_offset + VAR_1 >= VAR_0->cur_frame_offset[VAR_3]\n&&(VAR_0-> frame_offset < VAR_0->cur_frame_offset[VAR_3] || !VAR_0->frame_offset)\n&& VAR_0->cur_frame_end[VAR_3]){", "VAR_0->dts= VAR_0->cur_frame_dts[VAR_3];", "VAR_0->pts= VAR_0->cur_frame_pts[VAR_3];", "VAR_0->offset = VAR_0->next_frame_offset - VAR_0->cur_frame_offset[VAR_3];", "if(VAR_2)\nVAR_0->cur_frame_offset[VAR_3]= INT64_MAX;", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 7 ], [ 9 ], [ 11 ], [ 13, 15, 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 33 ], [ 35 ] ]
2,437
static void new_video_stream(AVFormatContext *oc) { AVStream *st; AVCodecContext *video_enc; enum CodecID codec_id; st = av_new_stream(oc, oc->nb_streams); if (!st) { fprintf(stderr, "Could not alloc stream\n"); av_exit(1); } avcodec_get_context_defaults2(st->codec, AVMEDIA_TYPE_VIDEO); bitstream_filters[nb_output_files][oc->nb_streams - 1]= video_bitstream_filters; video_bitstream_filters= NULL; avcodec_thread_init(st->codec, thread_count); video_enc = st->codec; if(video_codec_tag) video_enc->codec_tag= video_codec_tag; if( (video_global_header&1) || (video_global_header==0 && (oc->oformat->flags & AVFMT_GLOBALHEADER))){ video_enc->flags |= CODEC_FLAG_GLOBAL_HEADER; avcodec_opts[AVMEDIA_TYPE_VIDEO]->flags|= CODEC_FLAG_GLOBAL_HEADER; } if(video_global_header&2){ video_enc->flags2 |= CODEC_FLAG2_LOCAL_HEADER; avcodec_opts[AVMEDIA_TYPE_VIDEO]->flags2|= CODEC_FLAG2_LOCAL_HEADER; } if (video_stream_copy) { st->stream_copy = 1; video_enc->codec_type = AVMEDIA_TYPE_VIDEO; video_enc->sample_aspect_ratio = st->sample_aspect_ratio = av_d2q(frame_aspect_ratio*frame_height/frame_width, 255); } else { const char *p; int i; AVCodec *codec; AVRational fps= frame_rate.num ? frame_rate : (AVRational){25,1}; if (video_codec_name) { codec_id = find_codec_or_die(video_codec_name, AVMEDIA_TYPE_VIDEO, 1); codec = avcodec_find_encoder_by_name(video_codec_name); output_codecs[nb_ocodecs] = codec; } else { codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, AVMEDIA_TYPE_VIDEO); codec = avcodec_find_encoder(codec_id); } video_enc->codec_id = codec_id; set_context_opts(video_enc, avcodec_opts[AVMEDIA_TYPE_VIDEO], AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM); if (codec && codec->supported_framerates && !force_fps) fps = codec->supported_framerates[av_find_nearest_q_idx(fps, codec->supported_framerates)]; video_enc->time_base.den = fps.num; video_enc->time_base.num = fps.den; video_enc->width = frame_width + frame_padright + frame_padleft; video_enc->height = frame_height + frame_padtop + frame_padbottom; video_enc->sample_aspect_ratio = av_d2q(frame_aspect_ratio*video_enc->height/video_enc->width, 255); video_enc->pix_fmt = frame_pix_fmt; st->sample_aspect_ratio = video_enc->sample_aspect_ratio; choose_pixel_fmt(st, codec); if (intra_only) video_enc->gop_size = 0; if (video_qscale || same_quality) { video_enc->flags |= CODEC_FLAG_QSCALE; video_enc->global_quality= st->quality = FF_QP2LAMBDA * video_qscale; } if(intra_matrix) video_enc->intra_matrix = intra_matrix; if(inter_matrix) video_enc->inter_matrix = inter_matrix; p= video_rc_override_string; for(i=0; p; i++){ int start, end, q; int e=sscanf(p, "%d,%d,%d", &start, &end, &q); if(e!=3){ fprintf(stderr, "error parsing rc_override\n"); av_exit(1); } video_enc->rc_override= av_realloc(video_enc->rc_override, sizeof(RcOverride)*(i+1)); video_enc->rc_override[i].start_frame= start; video_enc->rc_override[i].end_frame = end; if(q>0){ video_enc->rc_override[i].qscale= q; video_enc->rc_override[i].quality_factor= 1.0; } else{ video_enc->rc_override[i].qscale= 0; video_enc->rc_override[i].quality_factor= -q/100.0; } p= strchr(p, '/'); if(p) p++; } video_enc->rc_override_count=i; if (!video_enc->rc_initial_buffer_occupancy) video_enc->rc_initial_buffer_occupancy = video_enc->rc_buffer_size*3/4; video_enc->me_threshold= me_threshold; video_enc->intra_dc_precision= intra_dc_precision - 8; if (do_psnr) video_enc->flags|= CODEC_FLAG_PSNR; /* two pass mode */ if (do_pass) { if (do_pass == 1) { video_enc->flags |= CODEC_FLAG_PASS1; } else { video_enc->flags |= CODEC_FLAG_PASS2; } } } nb_ocodecs++; if (video_language) { av_metadata_set2(&st->metadata, "language", video_language, 0); av_freep(&video_language); } /* reset some key parameters */ video_disable = 0; av_freep(&video_codec_name); video_stream_copy = 0; frame_pix_fmt = PIX_FMT_NONE; }
false
FFmpeg
0c22311b56e66115675c4a96e4c78547886a4171
static void new_video_stream(AVFormatContext *oc) { AVStream *st; AVCodecContext *video_enc; enum CodecID codec_id; st = av_new_stream(oc, oc->nb_streams); if (!st) { fprintf(stderr, "Could not alloc stream\n"); av_exit(1); } avcodec_get_context_defaults2(st->codec, AVMEDIA_TYPE_VIDEO); bitstream_filters[nb_output_files][oc->nb_streams - 1]= video_bitstream_filters; video_bitstream_filters= NULL; avcodec_thread_init(st->codec, thread_count); video_enc = st->codec; if(video_codec_tag) video_enc->codec_tag= video_codec_tag; if( (video_global_header&1) || (video_global_header==0 && (oc->oformat->flags & AVFMT_GLOBALHEADER))){ video_enc->flags |= CODEC_FLAG_GLOBAL_HEADER; avcodec_opts[AVMEDIA_TYPE_VIDEO]->flags|= CODEC_FLAG_GLOBAL_HEADER; } if(video_global_header&2){ video_enc->flags2 |= CODEC_FLAG2_LOCAL_HEADER; avcodec_opts[AVMEDIA_TYPE_VIDEO]->flags2|= CODEC_FLAG2_LOCAL_HEADER; } if (video_stream_copy) { st->stream_copy = 1; video_enc->codec_type = AVMEDIA_TYPE_VIDEO; video_enc->sample_aspect_ratio = st->sample_aspect_ratio = av_d2q(frame_aspect_ratio*frame_height/frame_width, 255); } else { const char *p; int i; AVCodec *codec; AVRational fps= frame_rate.num ? frame_rate : (AVRational){25,1}; if (video_codec_name) { codec_id = find_codec_or_die(video_codec_name, AVMEDIA_TYPE_VIDEO, 1); codec = avcodec_find_encoder_by_name(video_codec_name); output_codecs[nb_ocodecs] = codec; } else { codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, AVMEDIA_TYPE_VIDEO); codec = avcodec_find_encoder(codec_id); } video_enc->codec_id = codec_id; set_context_opts(video_enc, avcodec_opts[AVMEDIA_TYPE_VIDEO], AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM); if (codec && codec->supported_framerates && !force_fps) fps = codec->supported_framerates[av_find_nearest_q_idx(fps, codec->supported_framerates)]; video_enc->time_base.den = fps.num; video_enc->time_base.num = fps.den; video_enc->width = frame_width + frame_padright + frame_padleft; video_enc->height = frame_height + frame_padtop + frame_padbottom; video_enc->sample_aspect_ratio = av_d2q(frame_aspect_ratio*video_enc->height/video_enc->width, 255); video_enc->pix_fmt = frame_pix_fmt; st->sample_aspect_ratio = video_enc->sample_aspect_ratio; choose_pixel_fmt(st, codec); if (intra_only) video_enc->gop_size = 0; if (video_qscale || same_quality) { video_enc->flags |= CODEC_FLAG_QSCALE; video_enc->global_quality= st->quality = FF_QP2LAMBDA * video_qscale; } if(intra_matrix) video_enc->intra_matrix = intra_matrix; if(inter_matrix) video_enc->inter_matrix = inter_matrix; p= video_rc_override_string; for(i=0; p; i++){ int start, end, q; int e=sscanf(p, "%d,%d,%d", &start, &end, &q); if(e!=3){ fprintf(stderr, "error parsing rc_override\n"); av_exit(1); } video_enc->rc_override= av_realloc(video_enc->rc_override, sizeof(RcOverride)*(i+1)); video_enc->rc_override[i].start_frame= start; video_enc->rc_override[i].end_frame = end; if(q>0){ video_enc->rc_override[i].qscale= q; video_enc->rc_override[i].quality_factor= 1.0; } else{ video_enc->rc_override[i].qscale= 0; video_enc->rc_override[i].quality_factor= -q/100.0; } p= strchr(p, '/'); if(p) p++; } video_enc->rc_override_count=i; if (!video_enc->rc_initial_buffer_occupancy) video_enc->rc_initial_buffer_occupancy = video_enc->rc_buffer_size*3/4; video_enc->me_threshold= me_threshold; video_enc->intra_dc_precision= intra_dc_precision - 8; if (do_psnr) video_enc->flags|= CODEC_FLAG_PSNR; if (do_pass) { if (do_pass == 1) { video_enc->flags |= CODEC_FLAG_PASS1; } else { video_enc->flags |= CODEC_FLAG_PASS2; } } } nb_ocodecs++; if (video_language) { av_metadata_set2(&st->metadata, "language", video_language, 0); av_freep(&video_language); } video_disable = 0; av_freep(&video_codec_name); video_stream_copy = 0; frame_pix_fmt = PIX_FMT_NONE; }
{ "code": [], "line_no": [] }
static void FUNC_0(AVFormatContext *VAR_0) { AVStream *st; AVCodecContext *video_enc; enum CodecID VAR_1; st = av_new_stream(VAR_0, VAR_0->nb_streams); if (!st) { fprintf(stderr, "Could not alloc stream\n"); av_exit(1); } avcodec_get_context_defaults2(st->codec, AVMEDIA_TYPE_VIDEO); bitstream_filters[nb_output_files][VAR_0->nb_streams - 1]= video_bitstream_filters; video_bitstream_filters= NULL; avcodec_thread_init(st->codec, thread_count); video_enc = st->codec; if(video_codec_tag) video_enc->codec_tag= video_codec_tag; if( (video_global_header&1) || (video_global_header==0 && (VAR_0->oformat->flags & AVFMT_GLOBALHEADER))){ video_enc->flags |= CODEC_FLAG_GLOBAL_HEADER; avcodec_opts[AVMEDIA_TYPE_VIDEO]->flags|= CODEC_FLAG_GLOBAL_HEADER; } if(video_global_header&2){ video_enc->flags2 |= CODEC_FLAG2_LOCAL_HEADER; avcodec_opts[AVMEDIA_TYPE_VIDEO]->flags2|= CODEC_FLAG2_LOCAL_HEADER; } if (video_stream_copy) { st->stream_copy = 1; video_enc->codec_type = AVMEDIA_TYPE_VIDEO; video_enc->sample_aspect_ratio = st->sample_aspect_ratio = av_d2q(frame_aspect_ratio*frame_height/frame_width, 255); } else { const char *VAR_2; int VAR_3; AVCodec *codec; AVRational fps= frame_rate.num ? frame_rate : (AVRational){25,1}; if (video_codec_name) { VAR_1 = find_codec_or_die(video_codec_name, AVMEDIA_TYPE_VIDEO, 1); codec = avcodec_find_encoder_by_name(video_codec_name); output_codecs[nb_ocodecs] = codec; } else { VAR_1 = av_guess_codec(VAR_0->oformat, NULL, VAR_0->filename, NULL, AVMEDIA_TYPE_VIDEO); codec = avcodec_find_encoder(VAR_1); } video_enc->VAR_1 = VAR_1; set_context_opts(video_enc, avcodec_opts[AVMEDIA_TYPE_VIDEO], AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM); if (codec && codec->supported_framerates && !force_fps) fps = codec->supported_framerates[av_find_nearest_q_idx(fps, codec->supported_framerates)]; video_enc->time_base.den = fps.num; video_enc->time_base.num = fps.den; video_enc->width = frame_width + frame_padright + frame_padleft; video_enc->height = frame_height + frame_padtop + frame_padbottom; video_enc->sample_aspect_ratio = av_d2q(frame_aspect_ratio*video_enc->height/video_enc->width, 255); video_enc->pix_fmt = frame_pix_fmt; st->sample_aspect_ratio = video_enc->sample_aspect_ratio; choose_pixel_fmt(st, codec); if (intra_only) video_enc->gop_size = 0; if (video_qscale || same_quality) { video_enc->flags |= CODEC_FLAG_QSCALE; video_enc->global_quality= st->quality = FF_QP2LAMBDA * video_qscale; } if(intra_matrix) video_enc->intra_matrix = intra_matrix; if(inter_matrix) video_enc->inter_matrix = inter_matrix; VAR_2= video_rc_override_string; for(VAR_3=0; VAR_2; VAR_3++){ int VAR_4, VAR_5, VAR_6; int VAR_7=sscanf(VAR_2, "%d,%d,%d", &VAR_4, &VAR_5, &VAR_6); if(VAR_7!=3){ fprintf(stderr, "error parsing rc_override\n"); av_exit(1); } video_enc->rc_override= av_realloc(video_enc->rc_override, sizeof(RcOverride)*(VAR_3+1)); video_enc->rc_override[VAR_3].start_frame= VAR_4; video_enc->rc_override[VAR_3].end_frame = VAR_5; if(VAR_6>0){ video_enc->rc_override[VAR_3].qscale= VAR_6; video_enc->rc_override[VAR_3].quality_factor= 1.0; } else{ video_enc->rc_override[VAR_3].qscale= 0; video_enc->rc_override[VAR_3].quality_factor= -VAR_6/100.0; } VAR_2= strchr(VAR_2, '/'); if(VAR_2) VAR_2++; } video_enc->rc_override_count=VAR_3; if (!video_enc->rc_initial_buffer_occupancy) video_enc->rc_initial_buffer_occupancy = video_enc->rc_buffer_size*3/4; video_enc->me_threshold= me_threshold; video_enc->intra_dc_precision= intra_dc_precision - 8; if (do_psnr) video_enc->flags|= CODEC_FLAG_PSNR; if (do_pass) { if (do_pass == 1) { video_enc->flags |= CODEC_FLAG_PASS1; } else { video_enc->flags |= CODEC_FLAG_PASS2; } } } nb_ocodecs++; if (video_language) { av_metadata_set2(&st->metadata, "language", video_language, 0); av_freep(&video_language); } video_disable = 0; av_freep(&video_codec_name); video_stream_copy = 0; frame_pix_fmt = PIX_FMT_NONE; }
[ "static void FUNC_0(AVFormatContext *VAR_0)\n{", "AVStream *st;", "AVCodecContext *video_enc;", "enum CodecID VAR_1;", "st = av_new_stream(VAR_0, VAR_0->nb_streams);", "if (!st) {", "fprintf(stderr, \"Could not alloc stream\\n\");", "av_exit(1);", "}", "avcodec_get_context_defaults2(st->codec, AVMEDIA_TYPE_VIDEO);", "bitstream_filters[nb_output_files][VAR_0->nb_streams - 1]= video_bitstream_filters;", "video_bitstream_filters= NULL;", "avcodec_thread_init(st->codec, thread_count);", "video_enc = st->codec;", "if(video_codec_tag)\nvideo_enc->codec_tag= video_codec_tag;", "if( (video_global_header&1)\n|| (video_global_header==0 && (VAR_0->oformat->flags & AVFMT_GLOBALHEADER))){", "video_enc->flags |= CODEC_FLAG_GLOBAL_HEADER;", "avcodec_opts[AVMEDIA_TYPE_VIDEO]->flags|= CODEC_FLAG_GLOBAL_HEADER;", "}", "if(video_global_header&2){", "video_enc->flags2 |= CODEC_FLAG2_LOCAL_HEADER;", "avcodec_opts[AVMEDIA_TYPE_VIDEO]->flags2|= CODEC_FLAG2_LOCAL_HEADER;", "}", "if (video_stream_copy) {", "st->stream_copy = 1;", "video_enc->codec_type = AVMEDIA_TYPE_VIDEO;", "video_enc->sample_aspect_ratio =\nst->sample_aspect_ratio = av_d2q(frame_aspect_ratio*frame_height/frame_width, 255);", "} else {", "const char *VAR_2;", "int VAR_3;", "AVCodec *codec;", "AVRational fps= frame_rate.num ? frame_rate : (AVRational){25,1};", "if (video_codec_name) {", "VAR_1 = find_codec_or_die(video_codec_name, AVMEDIA_TYPE_VIDEO, 1);", "codec = avcodec_find_encoder_by_name(video_codec_name);", "output_codecs[nb_ocodecs] = codec;", "} else {", "VAR_1 = av_guess_codec(VAR_0->oformat, NULL, VAR_0->filename, NULL, AVMEDIA_TYPE_VIDEO);", "codec = avcodec_find_encoder(VAR_1);", "}", "video_enc->VAR_1 = VAR_1;", "set_context_opts(video_enc, avcodec_opts[AVMEDIA_TYPE_VIDEO], AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM);", "if (codec && codec->supported_framerates && !force_fps)\nfps = codec->supported_framerates[av_find_nearest_q_idx(fps, codec->supported_framerates)];", "video_enc->time_base.den = fps.num;", "video_enc->time_base.num = fps.den;", "video_enc->width = frame_width + frame_padright + frame_padleft;", "video_enc->height = frame_height + frame_padtop + frame_padbottom;", "video_enc->sample_aspect_ratio = av_d2q(frame_aspect_ratio*video_enc->height/video_enc->width, 255);", "video_enc->pix_fmt = frame_pix_fmt;", "st->sample_aspect_ratio = video_enc->sample_aspect_ratio;", "choose_pixel_fmt(st, codec);", "if (intra_only)\nvideo_enc->gop_size = 0;", "if (video_qscale || same_quality) {", "video_enc->flags |= CODEC_FLAG_QSCALE;", "video_enc->global_quality=\nst->quality = FF_QP2LAMBDA * video_qscale;", "}", "if(intra_matrix)\nvideo_enc->intra_matrix = intra_matrix;", "if(inter_matrix)\nvideo_enc->inter_matrix = inter_matrix;", "VAR_2= video_rc_override_string;", "for(VAR_3=0; VAR_2; VAR_3++){", "int VAR_4, VAR_5, VAR_6;", "int VAR_7=sscanf(VAR_2, \"%d,%d,%d\", &VAR_4, &VAR_5, &VAR_6);", "if(VAR_7!=3){", "fprintf(stderr, \"error parsing rc_override\\n\");", "av_exit(1);", "}", "video_enc->rc_override=\nav_realloc(video_enc->rc_override,\nsizeof(RcOverride)*(VAR_3+1));", "video_enc->rc_override[VAR_3].start_frame= VAR_4;", "video_enc->rc_override[VAR_3].end_frame = VAR_5;", "if(VAR_6>0){", "video_enc->rc_override[VAR_3].qscale= VAR_6;", "video_enc->rc_override[VAR_3].quality_factor= 1.0;", "}", "else{", "video_enc->rc_override[VAR_3].qscale= 0;", "video_enc->rc_override[VAR_3].quality_factor= -VAR_6/100.0;", "}", "VAR_2= strchr(VAR_2, '/');", "if(VAR_2) VAR_2++;", "}", "video_enc->rc_override_count=VAR_3;", "if (!video_enc->rc_initial_buffer_occupancy)\nvideo_enc->rc_initial_buffer_occupancy = video_enc->rc_buffer_size*3/4;", "video_enc->me_threshold= me_threshold;", "video_enc->intra_dc_precision= intra_dc_precision - 8;", "if (do_psnr)\nvideo_enc->flags|= CODEC_FLAG_PSNR;", "if (do_pass) {", "if (do_pass == 1) {", "video_enc->flags |= CODEC_FLAG_PASS1;", "} else {", "video_enc->flags |= CODEC_FLAG_PASS2;", "}", "}", "}", "nb_ocodecs++;", "if (video_language) {", "av_metadata_set2(&st->metadata, \"language\", video_language, 0);", "av_freep(&video_language);", "}", "video_disable = 0;", "av_freep(&video_codec_name);", "video_stream_copy = 0;", "frame_pix_fmt = PIX_FMT_NONE;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 35 ], [ 39, 41 ], [ 45, 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ], [ 71, 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 105 ], [ 109 ], [ 113, 115 ], [ 117 ], [ 119 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 135 ], [ 139, 141 ], [ 143 ], [ 145 ], [ 147, 149 ], [ 151 ], [ 155, 157 ], [ 159, 161 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181, 183, 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215, 217 ], [ 219 ], [ 221 ], [ 225, 227 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ] ]
2,438
static int opt_debug(void *optctx, const char *opt, const char *arg) { av_log_set_level(99); debug = parse_number_or_die(opt, arg, OPT_INT64, 0, INT_MAX); return 0; }
false
FFmpeg
e5c32d6da7836c7c9bb8393cb4de7e0997a4363b
static int opt_debug(void *optctx, const char *opt, const char *arg) { av_log_set_level(99); debug = parse_number_or_die(opt, arg, OPT_INT64, 0, INT_MAX); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(void *VAR_0, const char *VAR_1, const char *VAR_2) { av_log_set_level(99); debug = parse_number_or_die(VAR_1, VAR_2, OPT_INT64, 0, INT_MAX); return 0; }
[ "static int FUNC_0(void *VAR_0, const char *VAR_1, const char *VAR_2)\n{", "av_log_set_level(99);", "debug = parse_number_or_die(VAR_1, VAR_2, OPT_INT64, 0, INT_MAX);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ] ]
2,439
static int pulse_set_volume(PulseData *s, double volume) { pa_operation *op; pa_cvolume cvol; pa_volume_t vol; const pa_sample_spec *ss = pa_stream_get_sample_spec(s->stream); vol = pa_sw_volume_multiply(lround(volume * PA_VOLUME_NORM), s->base_volume); pa_cvolume_set(&cvol, ss->channels, PA_VOLUME_NORM); pa_sw_cvolume_multiply_scalar(&cvol, &cvol, vol); pa_threaded_mainloop_lock(s->mainloop); op = pa_context_set_sink_input_volume(s->ctx, pa_stream_get_index(s->stream), &cvol, pulse_context_result, s); return pulse_finish_context_operation(s, op, "pa_context_set_sink_input_volume"); }
false
FFmpeg
879b4a9d3ec89f587f9442fd4c7f1f36d5bd39c3
static int pulse_set_volume(PulseData *s, double volume) { pa_operation *op; pa_cvolume cvol; pa_volume_t vol; const pa_sample_spec *ss = pa_stream_get_sample_spec(s->stream); vol = pa_sw_volume_multiply(lround(volume * PA_VOLUME_NORM), s->base_volume); pa_cvolume_set(&cvol, ss->channels, PA_VOLUME_NORM); pa_sw_cvolume_multiply_scalar(&cvol, &cvol, vol); pa_threaded_mainloop_lock(s->mainloop); op = pa_context_set_sink_input_volume(s->ctx, pa_stream_get_index(s->stream), &cvol, pulse_context_result, s); return pulse_finish_context_operation(s, op, "pa_context_set_sink_input_volume"); }
{ "code": [], "line_no": [] }
static int FUNC_0(PulseData *VAR_0, double VAR_1) { pa_operation *op; pa_cvolume cvol; pa_volume_t vol; const pa_sample_spec *VAR_2 = pa_stream_get_sample_spec(VAR_0->stream); vol = pa_sw_volume_multiply(lround(VAR_1 * PA_VOLUME_NORM), VAR_0->base_volume); pa_cvolume_set(&cvol, VAR_2->channels, PA_VOLUME_NORM); pa_sw_cvolume_multiply_scalar(&cvol, &cvol, vol); pa_threaded_mainloop_lock(VAR_0->mainloop); op = pa_context_set_sink_input_volume(VAR_0->ctx, pa_stream_get_index(VAR_0->stream), &cvol, pulse_context_result, VAR_0); return pulse_finish_context_operation(VAR_0, op, "pa_context_set_sink_input_volume"); }
[ "static int FUNC_0(PulseData *VAR_0, double VAR_1)\n{", "pa_operation *op;", "pa_cvolume cvol;", "pa_volume_t vol;", "const pa_sample_spec *VAR_2 = pa_stream_get_sample_spec(VAR_0->stream);", "vol = pa_sw_volume_multiply(lround(VAR_1 * PA_VOLUME_NORM), VAR_0->base_volume);", "pa_cvolume_set(&cvol, VAR_2->channels, PA_VOLUME_NORM);", "pa_sw_cvolume_multiply_scalar(&cvol, &cvol, vol);", "pa_threaded_mainloop_lock(VAR_0->mainloop);", "op = pa_context_set_sink_input_volume(VAR_0->ctx, pa_stream_get_index(VAR_0->stream),\n&cvol, pulse_context_result, VAR_0);", "return pulse_finish_context_operation(VAR_0, op, \"pa_context_set_sink_input_volume\");", "}" ]
[ 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 ] ]