id
int32
0
27.3k
func
stringlengths
26
142k
target
bool
2 classes
project
stringclasses
2 values
commit_id
stringlengths
40
40
func_clean
stringlengths
26
131k
vul_lines
dict
normalized_func
stringlengths
24
132k
lines
listlengths
1
2.8k
label
listlengths
1
2.8k
line_no
listlengths
1
2.8k
6,582
static int test_vector_fmul_reverse(AVFloatDSPContext *fdsp, AVFloatDSPContext *cdsp, const float *v1, const float *v2) { LOCAL_ALIGNED(32, float, cdst, [LEN]); LOCAL_ALIGNED(32, float, odst, [LEN]); int ret; cdsp->vector_fmul_reverse(cdst, v1, v2, LEN); fdsp->vector_fmul_reverse(odst, v1, v2, LEN); if (ret = compare_floats(cdst, odst, LEN, FLT_EPSILON)) av_log(NULL, AV_LOG_ERROR, "vector_fmul_reverse failed\n"); return ret; }
false
FFmpeg
e53c9065ca08a9153ecc73a6a8940bcc6d667e58
static int test_vector_fmul_reverse(AVFloatDSPContext *fdsp, AVFloatDSPContext *cdsp, const float *v1, const float *v2) { LOCAL_ALIGNED(32, float, cdst, [LEN]); LOCAL_ALIGNED(32, float, odst, [LEN]); int ret; cdsp->vector_fmul_reverse(cdst, v1, v2, LEN); fdsp->vector_fmul_reverse(odst, v1, v2, LEN); if (ret = compare_floats(cdst, odst, LEN, FLT_EPSILON)) av_log(NULL, AV_LOG_ERROR, "vector_fmul_reverse failed\n"); return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFloatDSPContext *VAR_0, AVFloatDSPContext *VAR_1, const float *VAR_2, const float *VAR_3) { LOCAL_ALIGNED(32, float, cdst, [LEN]); LOCAL_ALIGNED(32, float, odst, [LEN]); int VAR_4; VAR_1->vector_fmul_reverse(cdst, VAR_2, VAR_3, LEN); VAR_0->vector_fmul_reverse(odst, VAR_2, VAR_3, LEN); if (VAR_4 = compare_floats(cdst, odst, LEN, FLT_EPSILON)) av_log(NULL, AV_LOG_ERROR, "vector_fmul_reverse failed\n"); return VAR_4; }
[ "static int FUNC_0(AVFloatDSPContext *VAR_0, AVFloatDSPContext *VAR_1,\nconst float *VAR_2, const float *VAR_3)\n{", "LOCAL_ALIGNED(32, float, cdst, [LEN]);", "LOCAL_ALIGNED(32, float, odst, [LEN]);", "int VAR_4;", "VAR_1->vector_fmul_reverse(cdst, VAR_2, VAR_3, LEN);", "VAR_0->vector_fmul_reverse(odst, VAR_2, VAR_3, LEN);", "if (VAR_4 = compare_floats(cdst, odst, LEN, FLT_EPSILON))\nav_log(NULL, AV_LOG_ERROR, \"vector_fmul_reverse failed\\n\");", "return VAR_4;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 21, 23 ], [ 27 ], [ 29 ] ]
6,583
static int ipvideo_decode_block_opcode_0x3(IpvideoContext *s) { unsigned char B; int x, y; /* copy 8x8 block from current frame from an up/left block */ /* need 1 more byte for motion */ CHECK_STREAM_PTR(1); B = *s->stream_ptr++; if (B < 56) { x = -(8 + (B % 7)); y = -(B / 7); } else { x = -(-14 + ((B - 56) % 29)); y = -( 8 + ((B - 56) / 29)); } debug_interplay (" motion byte = %d, (x, y) = (%d, %d)\n", B, x, y); return copy_from(s, &s->current_frame, x, y); }
false
FFmpeg
80ca19f766aea8f4724aac1b3faa772d25163c8a
static int ipvideo_decode_block_opcode_0x3(IpvideoContext *s) { unsigned char B; int x, y; CHECK_STREAM_PTR(1); B = *s->stream_ptr++; if (B < 56) { x = -(8 + (B % 7)); y = -(B / 7); } else { x = -(-14 + ((B - 56) % 29)); y = -( 8 + ((B - 56) / 29)); } debug_interplay (" motion byte = %d, (x, y) = (%d, %d)\n", B, x, y); return copy_from(s, &s->current_frame, x, y); }
{ "code": [], "line_no": [] }
static int FUNC_0(IpvideoContext *VAR_0) { unsigned char VAR_1; int VAR_2, VAR_3; CHECK_STREAM_PTR(1); VAR_1 = *VAR_0->stream_ptr++; if (VAR_1 < 56) { VAR_2 = -(8 + (VAR_1 % 7)); VAR_3 = -(VAR_1 / 7); } else { VAR_2 = -(-14 + ((VAR_1 - 56) % 29)); VAR_3 = -( 8 + ((VAR_1 - 56) / 29)); } debug_interplay (" motion byte = %d, (VAR_2, VAR_3) = (%d, %d)\n", VAR_1, VAR_2, VAR_3); return copy_from(VAR_0, &VAR_0->current_frame, VAR_2, VAR_3); }
[ "static int FUNC_0(IpvideoContext *VAR_0)\n{", "unsigned char VAR_1;", "int VAR_2, VAR_3;", "CHECK_STREAM_PTR(1);", "VAR_1 = *VAR_0->stream_ptr++;", "if (VAR_1 < 56) {", "VAR_2 = -(8 + (VAR_1 % 7));", "VAR_3 = -(VAR_1 / 7);", "} else {", "VAR_2 = -(-14 + ((VAR_1 - 56) % 29));", "VAR_3 = -( 8 + ((VAR_1 - 56) / 29));", "}", "debug_interplay (\" motion byte = %d, (VAR_2, VAR_3) = (%d, %d)\\n\", VAR_1, VAR_2, VAR_3);", "return copy_from(VAR_0, &VAR_0->current_frame, VAR_2, VAR_3);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ] ]
6,584
static int set_params(AVFilterContext *ctx, const char *params) { Frei0rContext *s = ctx->priv; int i; if (!params) return 0; for (i = 0; i < s->plugin_info.num_params; i++) { f0r_param_info_t info; char *param; int ret; s->get_param_info(&info, i); if (*params) { if (!(param = av_get_token(&params, "|"))) return AVERROR(ENOMEM); params++; /* skip ':' */ ret = set_param(ctx, info, i, param); av_free(param); if (ret < 0) return ret; } av_log(ctx, AV_LOG_VERBOSE, "idx:%d name:'%s' type:%s explanation:'%s' ", i, info.name, info.type == F0R_PARAM_BOOL ? "bool" : info.type == F0R_PARAM_DOUBLE ? "double" : info.type == F0R_PARAM_COLOR ? "color" : info.type == F0R_PARAM_POSITION ? "position" : info.type == F0R_PARAM_STRING ? "string" : "unknown", info.explanation); #ifdef DEBUG av_log(ctx, AV_LOG_DEBUG, "value:"); switch (info.type) { void *v; double d; char s[128]; f0r_param_color_t col; f0r_param_position_t pos; case F0R_PARAM_BOOL: v = &d; s->get_param_value(s->instance, v, i); av_log(ctx, AV_LOG_DEBUG, "%s", d >= 0.5 && d <= 1.0 ? "y" : "n"); break; case F0R_PARAM_DOUBLE: v = &d; s->get_param_value(s->instance, v, i); av_log(ctx, AV_LOG_DEBUG, "%f", d); break; case F0R_PARAM_COLOR: v = &col; s->get_param_value(s->instance, v, i); av_log(ctx, AV_LOG_DEBUG, "%f/%f/%f", col.r, col.g, col.b); break; case F0R_PARAM_POSITION: v = &pos; s->get_param_value(s->instance, v, i); av_log(ctx, AV_LOG_DEBUG, "%f/%f", pos.x, pos.y); break; default: /* F0R_PARAM_STRING */ v = s; s->get_param_value(s->instance, v, i); av_log(ctx, AV_LOG_DEBUG, "'%s'\n", s); break; } #endif av_log(ctx, AV_LOG_VERBOSE, "\n"); } return 0; }
false
FFmpeg
02a6ee51685eb74f7a878dd49553ecc1f8da9fb2
static int set_params(AVFilterContext *ctx, const char *params) { Frei0rContext *s = ctx->priv; int i; if (!params) return 0; for (i = 0; i < s->plugin_info.num_params; i++) { f0r_param_info_t info; char *param; int ret; s->get_param_info(&info, i); if (*params) { if (!(param = av_get_token(&params, "|"))) return AVERROR(ENOMEM); params++; ret = set_param(ctx, info, i, param); av_free(param); if (ret < 0) return ret; } av_log(ctx, AV_LOG_VERBOSE, "idx:%d name:'%s' type:%s explanation:'%s' ", i, info.name, info.type == F0R_PARAM_BOOL ? "bool" : info.type == F0R_PARAM_DOUBLE ? "double" : info.type == F0R_PARAM_COLOR ? "color" : info.type == F0R_PARAM_POSITION ? "position" : info.type == F0R_PARAM_STRING ? "string" : "unknown", info.explanation); #ifdef DEBUG av_log(ctx, AV_LOG_DEBUG, "value:"); switch (info.type) { void *v; double d; char s[128]; f0r_param_color_t col; f0r_param_position_t pos; case F0R_PARAM_BOOL: v = &d; s->get_param_value(s->instance, v, i); av_log(ctx, AV_LOG_DEBUG, "%s", d >= 0.5 && d <= 1.0 ? "y" : "n"); break; case F0R_PARAM_DOUBLE: v = &d; s->get_param_value(s->instance, v, i); av_log(ctx, AV_LOG_DEBUG, "%f", d); break; case F0R_PARAM_COLOR: v = &col; s->get_param_value(s->instance, v, i); av_log(ctx, AV_LOG_DEBUG, "%f/%f/%f", col.r, col.g, col.b); break; case F0R_PARAM_POSITION: v = &pos; s->get_param_value(s->instance, v, i); av_log(ctx, AV_LOG_DEBUG, "%f/%f", pos.x, pos.y); break; default: v = s; s->get_param_value(s->instance, v, i); av_log(ctx, AV_LOG_DEBUG, "'%s'\n", s); break; } #endif av_log(ctx, AV_LOG_VERBOSE, "\n"); } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFilterContext *VAR_0, const char *VAR_1) { Frei0rContext *s = VAR_0->priv; int VAR_2; if (!VAR_1) return 0; for (VAR_2 = 0; VAR_2 < s->plugin_info.num_params; VAR_2++) { f0r_param_info_t info; char *param; int ret; s->get_param_info(&info, VAR_2); if (*VAR_1) { if (!(param = av_get_token(&VAR_1, "|"))) return AVERROR(ENOMEM); VAR_1++; ret = set_param(VAR_0, info, VAR_2, param); av_free(param); if (ret < 0) return ret; } av_log(VAR_0, AV_LOG_VERBOSE, "idx:%d name:'%s' type:%s explanation:'%s' ", VAR_2, info.name, info.type == F0R_PARAM_BOOL ? "bool" : info.type == F0R_PARAM_DOUBLE ? "double" : info.type == F0R_PARAM_COLOR ? "color" : info.type == F0R_PARAM_POSITION ? "position" : info.type == F0R_PARAM_STRING ? "string" : "unknown", info.explanation); #ifdef DEBUG av_log(VAR_0, AV_LOG_DEBUG, "value:"); switch (info.type) { void *v; double d; char s[128]; f0r_param_color_t col; f0r_param_position_t pos; case F0R_PARAM_BOOL: v = &d; s->get_param_value(s->instance, v, VAR_2); av_log(VAR_0, AV_LOG_DEBUG, "%s", d >= 0.5 && d <= 1.0 ? "y" : "n"); break; case F0R_PARAM_DOUBLE: v = &d; s->get_param_value(s->instance, v, VAR_2); av_log(VAR_0, AV_LOG_DEBUG, "%f", d); break; case F0R_PARAM_COLOR: v = &col; s->get_param_value(s->instance, v, VAR_2); av_log(VAR_0, AV_LOG_DEBUG, "%f/%f/%f", col.r, col.g, col.b); break; case F0R_PARAM_POSITION: v = &pos; s->get_param_value(s->instance, v, VAR_2); av_log(VAR_0, AV_LOG_DEBUG, "%f/%f", pos.x, pos.y); break; default: v = s; s->get_param_value(s->instance, v, VAR_2); av_log(VAR_0, AV_LOG_DEBUG, "'%s'\n", s); break; } #endif av_log(VAR_0, AV_LOG_VERBOSE, "\n"); } return 0; }
[ "static int FUNC_0(AVFilterContext *VAR_0, const char *VAR_1)\n{", "Frei0rContext *s = VAR_0->priv;", "int VAR_2;", "if (!VAR_1)\nreturn 0;", "for (VAR_2 = 0; VAR_2 < s->plugin_info.num_params; VAR_2++) {", "f0r_param_info_t info;", "char *param;", "int ret;", "s->get_param_info(&info, VAR_2);", "if (*VAR_1) {", "if (!(param = av_get_token(&VAR_1, \"|\")))\nreturn AVERROR(ENOMEM);", "VAR_1++;", "ret = set_param(VAR_0, info, VAR_2, param);", "av_free(param);", "if (ret < 0)\nreturn ret;", "}", "av_log(VAR_0, AV_LOG_VERBOSE,\n\"idx:%d name:'%s' type:%s explanation:'%s' \",\nVAR_2, info.name,\ninfo.type == F0R_PARAM_BOOL ? \"bool\" :\ninfo.type == F0R_PARAM_DOUBLE ? \"double\" :\ninfo.type == F0R_PARAM_COLOR ? \"color\" :\ninfo.type == F0R_PARAM_POSITION ? \"position\" :\ninfo.type == F0R_PARAM_STRING ? \"string\" : \"unknown\",\ninfo.explanation);", "#ifdef DEBUG\nav_log(VAR_0, AV_LOG_DEBUG, \"value:\");", "switch (info.type) {", "void *v;", "double d;", "char s[128];", "f0r_param_color_t col;", "f0r_param_position_t pos;", "case F0R_PARAM_BOOL:\nv = &d;", "s->get_param_value(s->instance, v, VAR_2);", "av_log(VAR_0, AV_LOG_DEBUG, \"%s\", d >= 0.5 && d <= 1.0 ? \"y\" : \"n\");", "break;", "case F0R_PARAM_DOUBLE:\nv = &d;", "s->get_param_value(s->instance, v, VAR_2);", "av_log(VAR_0, AV_LOG_DEBUG, \"%f\", d);", "break;", "case F0R_PARAM_COLOR:\nv = &col;", "s->get_param_value(s->instance, v, VAR_2);", "av_log(VAR_0, AV_LOG_DEBUG, \"%f/%f/%f\", col.r, col.g, col.b);", "break;", "case F0R_PARAM_POSITION:\nv = &pos;", "s->get_param_value(s->instance, v, VAR_2);", "av_log(VAR_0, AV_LOG_DEBUG, \"%f/%f\", pos.x, pos.y);", "break;", "default:\nv = s;", "s->get_param_value(s->instance, v, VAR_2);", "av_log(VAR_0, AV_LOG_DEBUG, \"'%s'\\n\", s);", "break;", "}", "#endif\nav_log(VAR_0, AV_LOG_VERBOSE, \"\\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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11, 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 51, 53, 55, 57, 59, 61, 63, 65, 67 ], [ 71, 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 89, 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99, 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109, 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119, 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129, 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141, 143 ], [ 145 ], [ 149 ], [ 151 ] ]
6,585
static int ipvideo_decode_block_opcode_0xE(IpvideoContext *s) { int y; unsigned char pix; /* 1-color encoding: the whole block is 1 solid color */ CHECK_STREAM_PTR(1); pix = *s->stream_ptr++; for (y = 0; y < 8; y++) { memset(s->pixel_ptr, pix, 8); s->pixel_ptr += s->stride; } /* report success */ return 0; }
false
FFmpeg
80ca19f766aea8f4724aac1b3faa772d25163c8a
static int ipvideo_decode_block_opcode_0xE(IpvideoContext *s) { int y; unsigned char pix; CHECK_STREAM_PTR(1); pix = *s->stream_ptr++; for (y = 0; y < 8; y++) { memset(s->pixel_ptr, pix, 8); s->pixel_ptr += s->stride; } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(IpvideoContext *VAR_0) { int VAR_1; unsigned char VAR_2; CHECK_STREAM_PTR(1); VAR_2 = *VAR_0->stream_ptr++; for (VAR_1 = 0; VAR_1 < 8; VAR_1++) { memset(VAR_0->pixel_ptr, VAR_2, 8); VAR_0->pixel_ptr += VAR_0->stride; } return 0; }
[ "static int FUNC_0(IpvideoContext *VAR_0)\n{", "int VAR_1;", "unsigned char VAR_2;", "CHECK_STREAM_PTR(1);", "VAR_2 = *VAR_0->stream_ptr++;", "for (VAR_1 = 0; VAR_1 < 8; VAR_1++) {", "memset(VAR_0->pixel_ptr, VAR_2, 8);", "VAR_0->pixel_ptr += VAR_0->stride;", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 31 ], [ 33 ] ]
6,586
static int ra144_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr) { static const uint8_t sizes[LPC_ORDER] = {64, 32, 32, 16, 16, 8, 8, 8, 8, 4}; static const uint8_t bit_sizes[LPC_ORDER] = {6, 5, 5, 4, 4, 3, 3, 3, 3, 2}; RA144Context *ractx = avctx->priv_data; PutBitContext pb; int32_t lpc_data[NBLOCKS * BLOCKSIZE]; int32_t lpc_coefs[LPC_ORDER][MAX_LPC_ORDER]; int shift[LPC_ORDER]; int16_t block_coefs[NBLOCKS][LPC_ORDER]; int lpc_refl[LPC_ORDER]; /**< reflection coefficients of the frame */ unsigned int refl_rms[NBLOCKS]; /**< RMS of the reflection coefficients */ const int16_t *samples = frame ? (const int16_t *)frame->data[0] : NULL; int energy = 0; int i, idx, ret; if (ractx->last_frame) return 0; if ((ret = ff_alloc_packet2(avctx, avpkt, FRAMESIZE))) return ret; /** * Since the LPC coefficients are calculated on a frame centered over the * fourth subframe, to encode a given frame, data from the next frame is * needed. In each call to this function, the previous frame (whose data are * saved in the encoder context) is encoded, and data from the current frame * are saved in the encoder context to be used in the next function call. */ for (i = 0; i < (2 * BLOCKSIZE + BLOCKSIZE / 2); i++) { lpc_data[i] = ractx->curr_block[BLOCKSIZE + BLOCKSIZE / 2 + i]; energy += (lpc_data[i] * lpc_data[i]) >> 4; } if (frame) { int j; for (j = 0; j < frame->nb_samples && i < NBLOCKS * BLOCKSIZE; i++, j++) { lpc_data[i] = samples[j] >> 2; energy += (lpc_data[i] * lpc_data[i]) >> 4; } } if (i < NBLOCKS * BLOCKSIZE) memset(&lpc_data[i], 0, (NBLOCKS * BLOCKSIZE - i) * sizeof(*lpc_data)); energy = ff_energy_tab[quantize(ff_t_sqrt(energy >> 5) >> 10, ff_energy_tab, 32)]; ff_lpc_calc_coefs(&ractx->lpc_ctx, lpc_data, NBLOCKS * BLOCKSIZE, LPC_ORDER, LPC_ORDER, 16, lpc_coefs, shift, FF_LPC_TYPE_LEVINSON, 0, ORDER_METHOD_EST, 12, 0); for (i = 0; i < LPC_ORDER; i++) block_coefs[NBLOCKS - 1][i] = -(lpc_coefs[LPC_ORDER - 1][i] << (12 - shift[LPC_ORDER - 1])); /** * TODO: apply perceptual weighting of the input speech through bandwidth * expansion of the LPC filter. */ if (ff_eval_refl(lpc_refl, block_coefs[NBLOCKS - 1], avctx)) { /** * The filter is unstable: use the coefficients of the previous frame. */ ff_int_to_int16(block_coefs[NBLOCKS - 1], ractx->lpc_coef[1]); if (ff_eval_refl(lpc_refl, block_coefs[NBLOCKS - 1], avctx)) { /* the filter is still unstable. set reflection coeffs to zero. */ memset(lpc_refl, 0, sizeof(lpc_refl)); } } init_put_bits(&pb, avpkt->data, avpkt->size); for (i = 0; i < LPC_ORDER; i++) { idx = quantize(lpc_refl[i], ff_lpc_refl_cb[i], sizes[i]); put_bits(&pb, bit_sizes[i], idx); lpc_refl[i] = ff_lpc_refl_cb[i][idx]; } ractx->lpc_refl_rms[0] = ff_rms(lpc_refl); ff_eval_coefs(ractx->lpc_coef[0], lpc_refl); refl_rms[0] = ff_interp(ractx, block_coefs[0], 1, 1, ractx->old_energy); refl_rms[1] = ff_interp(ractx, block_coefs[1], 2, energy <= ractx->old_energy, ff_t_sqrt(energy * ractx->old_energy) >> 12); refl_rms[2] = ff_interp(ractx, block_coefs[2], 3, 0, energy); refl_rms[3] = ff_rescale_rms(ractx->lpc_refl_rms[0], energy); ff_int_to_int16(block_coefs[NBLOCKS - 1], ractx->lpc_coef[0]); put_bits(&pb, 5, quantize(energy, ff_energy_tab, 32)); for (i = 0; i < NBLOCKS; i++) ra144_encode_subblock(ractx, ractx->curr_block + i * BLOCKSIZE, block_coefs[i], refl_rms[i], &pb); flush_put_bits(&pb); ractx->old_energy = energy; ractx->lpc_refl_rms[1] = ractx->lpc_refl_rms[0]; FFSWAP(unsigned int *, ractx->lpc_coef[0], ractx->lpc_coef[1]); /* copy input samples to current block for processing in next call */ i = 0; if (frame) { for (; i < frame->nb_samples; i++) ractx->curr_block[i] = samples[i] >> 2; if ((ret = ff_af_queue_add(&ractx->afq, frame)) < 0) return ret; } else ractx->last_frame = 1; memset(&ractx->curr_block[i], 0, (NBLOCKS * BLOCKSIZE - i) * sizeof(*ractx->curr_block)); /* Get the next frame pts/duration */ ff_af_queue_remove(&ractx->afq, avctx->frame_size, &avpkt->pts, &avpkt->duration); avpkt->size = FRAMESIZE; *got_packet_ptr = 1; return 0; }
false
FFmpeg
bcaf64b605442e1622d16da89d4ec0e7730b8a8c
static int ra144_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr) { static const uint8_t sizes[LPC_ORDER] = {64, 32, 32, 16, 16, 8, 8, 8, 8, 4}; static const uint8_t bit_sizes[LPC_ORDER] = {6, 5, 5, 4, 4, 3, 3, 3, 3, 2}; RA144Context *ractx = avctx->priv_data; PutBitContext pb; int32_t lpc_data[NBLOCKS * BLOCKSIZE]; int32_t lpc_coefs[LPC_ORDER][MAX_LPC_ORDER]; int shift[LPC_ORDER]; int16_t block_coefs[NBLOCKS][LPC_ORDER]; int lpc_refl[LPC_ORDER]; unsigned int refl_rms[NBLOCKS]; const int16_t *samples = frame ? (const int16_t *)frame->data[0] : NULL; int energy = 0; int i, idx, ret; if (ractx->last_frame) return 0; if ((ret = ff_alloc_packet2(avctx, avpkt, FRAMESIZE))) return ret; for (i = 0; i < (2 * BLOCKSIZE + BLOCKSIZE / 2); i++) { lpc_data[i] = ractx->curr_block[BLOCKSIZE + BLOCKSIZE / 2 + i]; energy += (lpc_data[i] * lpc_data[i]) >> 4; } if (frame) { int j; for (j = 0; j < frame->nb_samples && i < NBLOCKS * BLOCKSIZE; i++, j++) { lpc_data[i] = samples[j] >> 2; energy += (lpc_data[i] * lpc_data[i]) >> 4; } } if (i < NBLOCKS * BLOCKSIZE) memset(&lpc_data[i], 0, (NBLOCKS * BLOCKSIZE - i) * sizeof(*lpc_data)); energy = ff_energy_tab[quantize(ff_t_sqrt(energy >> 5) >> 10, ff_energy_tab, 32)]; ff_lpc_calc_coefs(&ractx->lpc_ctx, lpc_data, NBLOCKS * BLOCKSIZE, LPC_ORDER, LPC_ORDER, 16, lpc_coefs, shift, FF_LPC_TYPE_LEVINSON, 0, ORDER_METHOD_EST, 12, 0); for (i = 0; i < LPC_ORDER; i++) block_coefs[NBLOCKS - 1][i] = -(lpc_coefs[LPC_ORDER - 1][i] << (12 - shift[LPC_ORDER - 1])); if (ff_eval_refl(lpc_refl, block_coefs[NBLOCKS - 1], avctx)) { ff_int_to_int16(block_coefs[NBLOCKS - 1], ractx->lpc_coef[1]); if (ff_eval_refl(lpc_refl, block_coefs[NBLOCKS - 1], avctx)) { memset(lpc_refl, 0, sizeof(lpc_refl)); } } init_put_bits(&pb, avpkt->data, avpkt->size); for (i = 0; i < LPC_ORDER; i++) { idx = quantize(lpc_refl[i], ff_lpc_refl_cb[i], sizes[i]); put_bits(&pb, bit_sizes[i], idx); lpc_refl[i] = ff_lpc_refl_cb[i][idx]; } ractx->lpc_refl_rms[0] = ff_rms(lpc_refl); ff_eval_coefs(ractx->lpc_coef[0], lpc_refl); refl_rms[0] = ff_interp(ractx, block_coefs[0], 1, 1, ractx->old_energy); refl_rms[1] = ff_interp(ractx, block_coefs[1], 2, energy <= ractx->old_energy, ff_t_sqrt(energy * ractx->old_energy) >> 12); refl_rms[2] = ff_interp(ractx, block_coefs[2], 3, 0, energy); refl_rms[3] = ff_rescale_rms(ractx->lpc_refl_rms[0], energy); ff_int_to_int16(block_coefs[NBLOCKS - 1], ractx->lpc_coef[0]); put_bits(&pb, 5, quantize(energy, ff_energy_tab, 32)); for (i = 0; i < NBLOCKS; i++) ra144_encode_subblock(ractx, ractx->curr_block + i * BLOCKSIZE, block_coefs[i], refl_rms[i], &pb); flush_put_bits(&pb); ractx->old_energy = energy; ractx->lpc_refl_rms[1] = ractx->lpc_refl_rms[0]; FFSWAP(unsigned int *, ractx->lpc_coef[0], ractx->lpc_coef[1]); i = 0; if (frame) { for (; i < frame->nb_samples; i++) ractx->curr_block[i] = samples[i] >> 2; if ((ret = ff_af_queue_add(&ractx->afq, frame)) < 0) return ret; } else ractx->last_frame = 1; memset(&ractx->curr_block[i], 0, (NBLOCKS * BLOCKSIZE - i) * sizeof(*ractx->curr_block)); ff_af_queue_remove(&ractx->afq, avctx->frame_size, &avpkt->pts, &avpkt->duration); avpkt->size = FRAMESIZE; *got_packet_ptr = 1; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, AVPacket *VAR_1, const AVFrame *VAR_2, int *VAR_3) { static const uint8_t VAR_4[LPC_ORDER] = {64, 32, 32, 16, 16, 8, 8, 8, 8, 4}; static const uint8_t VAR_5[LPC_ORDER] = {6, 5, 5, 4, 4, 3, 3, 3, 3, 2}; RA144Context *ractx = VAR_0->priv_data; PutBitContext pb; int32_t lpc_data[NBLOCKS * BLOCKSIZE]; int32_t lpc_coefs[LPC_ORDER][MAX_LPC_ORDER]; int VAR_6[LPC_ORDER]; int16_t block_coefs[NBLOCKS][LPC_ORDER]; int VAR_7[LPC_ORDER]; unsigned int VAR_8[NBLOCKS]; const int16_t *VAR_9 = VAR_2 ? (const int16_t *)VAR_2->data[0] : NULL; int VAR_10 = 0; int VAR_11, VAR_12, VAR_13; if (ractx->last_frame) return 0; if ((VAR_13 = ff_alloc_packet2(VAR_0, VAR_1, FRAMESIZE))) return VAR_13; for (VAR_11 = 0; VAR_11 < (2 * BLOCKSIZE + BLOCKSIZE / 2); VAR_11++) { lpc_data[VAR_11] = ractx->curr_block[BLOCKSIZE + BLOCKSIZE / 2 + VAR_11]; VAR_10 += (lpc_data[VAR_11] * lpc_data[VAR_11]) >> 4; } if (VAR_2) { int VAR_14; for (VAR_14 = 0; VAR_14 < VAR_2->nb_samples && VAR_11 < NBLOCKS * BLOCKSIZE; VAR_11++, VAR_14++) { lpc_data[VAR_11] = VAR_9[VAR_14] >> 2; VAR_10 += (lpc_data[VAR_11] * lpc_data[VAR_11]) >> 4; } } if (VAR_11 < NBLOCKS * BLOCKSIZE) memset(&lpc_data[VAR_11], 0, (NBLOCKS * BLOCKSIZE - VAR_11) * sizeof(*lpc_data)); VAR_10 = ff_energy_tab[quantize(ff_t_sqrt(VAR_10 >> 5) >> 10, ff_energy_tab, 32)]; ff_lpc_calc_coefs(&ractx->lpc_ctx, lpc_data, NBLOCKS * BLOCKSIZE, LPC_ORDER, LPC_ORDER, 16, lpc_coefs, VAR_6, FF_LPC_TYPE_LEVINSON, 0, ORDER_METHOD_EST, 12, 0); for (VAR_11 = 0; VAR_11 < LPC_ORDER; VAR_11++) block_coefs[NBLOCKS - 1][VAR_11] = -(lpc_coefs[LPC_ORDER - 1][VAR_11] << (12 - VAR_6[LPC_ORDER - 1])); if (ff_eval_refl(VAR_7, block_coefs[NBLOCKS - 1], VAR_0)) { ff_int_to_int16(block_coefs[NBLOCKS - 1], ractx->lpc_coef[1]); if (ff_eval_refl(VAR_7, block_coefs[NBLOCKS - 1], VAR_0)) { memset(VAR_7, 0, sizeof(VAR_7)); } } init_put_bits(&pb, VAR_1->data, VAR_1->size); for (VAR_11 = 0; VAR_11 < LPC_ORDER; VAR_11++) { VAR_12 = quantize(VAR_7[VAR_11], ff_lpc_refl_cb[VAR_11], VAR_4[VAR_11]); put_bits(&pb, VAR_5[VAR_11], VAR_12); VAR_7[VAR_11] = ff_lpc_refl_cb[VAR_11][VAR_12]; } ractx->lpc_refl_rms[0] = ff_rms(VAR_7); ff_eval_coefs(ractx->lpc_coef[0], VAR_7); VAR_8[0] = ff_interp(ractx, block_coefs[0], 1, 1, ractx->old_energy); VAR_8[1] = ff_interp(ractx, block_coefs[1], 2, VAR_10 <= ractx->old_energy, ff_t_sqrt(VAR_10 * ractx->old_energy) >> 12); VAR_8[2] = ff_interp(ractx, block_coefs[2], 3, 0, VAR_10); VAR_8[3] = ff_rescale_rms(ractx->lpc_refl_rms[0], VAR_10); ff_int_to_int16(block_coefs[NBLOCKS - 1], ractx->lpc_coef[0]); put_bits(&pb, 5, quantize(VAR_10, ff_energy_tab, 32)); for (VAR_11 = 0; VAR_11 < NBLOCKS; VAR_11++) ra144_encode_subblock(ractx, ractx->curr_block + VAR_11 * BLOCKSIZE, block_coefs[VAR_11], VAR_8[VAR_11], &pb); flush_put_bits(&pb); ractx->old_energy = VAR_10; ractx->lpc_refl_rms[1] = ractx->lpc_refl_rms[0]; FFSWAP(unsigned int *, ractx->lpc_coef[0], ractx->lpc_coef[1]); VAR_11 = 0; if (VAR_2) { for (; VAR_11 < VAR_2->nb_samples; VAR_11++) ractx->curr_block[VAR_11] = VAR_9[VAR_11] >> 2; if ((VAR_13 = ff_af_queue_add(&ractx->afq, VAR_2)) < 0) return VAR_13; } else ractx->last_frame = 1; memset(&ractx->curr_block[VAR_11], 0, (NBLOCKS * BLOCKSIZE - VAR_11) * sizeof(*ractx->curr_block)); ff_af_queue_remove(&ractx->afq, VAR_0->frame_size, &VAR_1->pts, &VAR_1->duration); VAR_1->size = FRAMESIZE; *VAR_3 = 1; return 0; }
[ "static int FUNC_0(AVCodecContext *VAR_0, AVPacket *VAR_1,\nconst AVFrame *VAR_2, int *VAR_3)\n{", "static const uint8_t VAR_4[LPC_ORDER] = {64, 32, 32, 16, 16, 8, 8, 8, 8, 4};", "static const uint8_t VAR_5[LPC_ORDER] = {6, 5, 5, 4, 4, 3, 3, 3, 3, 2};", "RA144Context *ractx = VAR_0->priv_data;", "PutBitContext pb;", "int32_t lpc_data[NBLOCKS * BLOCKSIZE];", "int32_t lpc_coefs[LPC_ORDER][MAX_LPC_ORDER];", "int VAR_6[LPC_ORDER];", "int16_t block_coefs[NBLOCKS][LPC_ORDER];", "int VAR_7[LPC_ORDER];", "unsigned int VAR_8[NBLOCKS];", "const int16_t *VAR_9 = VAR_2 ? (const int16_t *)VAR_2->data[0] : NULL;", "int VAR_10 = 0;", "int VAR_11, VAR_12, VAR_13;", "if (ractx->last_frame)\nreturn 0;", "if ((VAR_13 = ff_alloc_packet2(VAR_0, VAR_1, FRAMESIZE)))\nreturn VAR_13;", "for (VAR_11 = 0; VAR_11 < (2 * BLOCKSIZE + BLOCKSIZE / 2); VAR_11++) {", "lpc_data[VAR_11] = ractx->curr_block[BLOCKSIZE + BLOCKSIZE / 2 + VAR_11];", "VAR_10 += (lpc_data[VAR_11] * lpc_data[VAR_11]) >> 4;", "}", "if (VAR_2) {", "int VAR_14;", "for (VAR_14 = 0; VAR_14 < VAR_2->nb_samples && VAR_11 < NBLOCKS * BLOCKSIZE; VAR_11++, VAR_14++) {", "lpc_data[VAR_11] = VAR_9[VAR_14] >> 2;", "VAR_10 += (lpc_data[VAR_11] * lpc_data[VAR_11]) >> 4;", "}", "}", "if (VAR_11 < NBLOCKS * BLOCKSIZE)\nmemset(&lpc_data[VAR_11], 0, (NBLOCKS * BLOCKSIZE - VAR_11) * sizeof(*lpc_data));", "VAR_10 = ff_energy_tab[quantize(ff_t_sqrt(VAR_10 >> 5) >> 10, ff_energy_tab,\n32)];", "ff_lpc_calc_coefs(&ractx->lpc_ctx, lpc_data, NBLOCKS * BLOCKSIZE, LPC_ORDER,\nLPC_ORDER, 16, lpc_coefs, VAR_6, FF_LPC_TYPE_LEVINSON,\n0, ORDER_METHOD_EST, 12, 0);", "for (VAR_11 = 0; VAR_11 < LPC_ORDER; VAR_11++)", "block_coefs[NBLOCKS - 1][VAR_11] = -(lpc_coefs[LPC_ORDER - 1][VAR_11] <<\n(12 - VAR_6[LPC_ORDER - 1]));", "if (ff_eval_refl(VAR_7, block_coefs[NBLOCKS - 1], VAR_0)) {", "ff_int_to_int16(block_coefs[NBLOCKS - 1], ractx->lpc_coef[1]);", "if (ff_eval_refl(VAR_7, block_coefs[NBLOCKS - 1], VAR_0)) {", "memset(VAR_7, 0, sizeof(VAR_7));", "}", "}", "init_put_bits(&pb, VAR_1->data, VAR_1->size);", "for (VAR_11 = 0; VAR_11 < LPC_ORDER; VAR_11++) {", "VAR_12 = quantize(VAR_7[VAR_11], ff_lpc_refl_cb[VAR_11], VAR_4[VAR_11]);", "put_bits(&pb, VAR_5[VAR_11], VAR_12);", "VAR_7[VAR_11] = ff_lpc_refl_cb[VAR_11][VAR_12];", "}", "ractx->lpc_refl_rms[0] = ff_rms(VAR_7);", "ff_eval_coefs(ractx->lpc_coef[0], VAR_7);", "VAR_8[0] = ff_interp(ractx, block_coefs[0], 1, 1, ractx->old_energy);", "VAR_8[1] = ff_interp(ractx, block_coefs[1], 2,\nVAR_10 <= ractx->old_energy,\nff_t_sqrt(VAR_10 * ractx->old_energy) >> 12);", "VAR_8[2] = ff_interp(ractx, block_coefs[2], 3, 0, VAR_10);", "VAR_8[3] = ff_rescale_rms(ractx->lpc_refl_rms[0], VAR_10);", "ff_int_to_int16(block_coefs[NBLOCKS - 1], ractx->lpc_coef[0]);", "put_bits(&pb, 5, quantize(VAR_10, ff_energy_tab, 32));", "for (VAR_11 = 0; VAR_11 < NBLOCKS; VAR_11++)", "ra144_encode_subblock(ractx, ractx->curr_block + VAR_11 * BLOCKSIZE,\nblock_coefs[VAR_11], VAR_8[VAR_11], &pb);", "flush_put_bits(&pb);", "ractx->old_energy = VAR_10;", "ractx->lpc_refl_rms[1] = ractx->lpc_refl_rms[0];", "FFSWAP(unsigned int *, ractx->lpc_coef[0], ractx->lpc_coef[1]);", "VAR_11 = 0;", "if (VAR_2) {", "for (; VAR_11 < VAR_2->nb_samples; VAR_11++)", "ractx->curr_block[VAR_11] = VAR_9[VAR_11] >> 2;", "if ((VAR_13 = ff_af_queue_add(&ractx->afq, VAR_2)) < 0)\nreturn VAR_13;", "} else", "ractx->last_frame = 1;", "memset(&ractx->curr_block[VAR_11], 0,\n(NBLOCKS * BLOCKSIZE - VAR_11) * sizeof(*ractx->curr_block));", "ff_af_queue_remove(&ractx->afq, VAR_0->frame_size, &VAR_1->pts,\n&VAR_1->duration);", "VAR_1->size = FRAMESIZE;", "*VAR_3 = 1;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 35, 37 ], [ 41, 43 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83, 85 ], [ 87, 89 ], [ 93, 95, 97 ], [ 99 ], [ 101, 103 ], [ 117 ], [ 125 ], [ 127 ], [ 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 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 197, 199 ], [ 201 ], [ 203 ], [ 205, 207 ], [ 213, 215 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ] ]
6,587
static off_t read_uint32(int fd, int64_t offset) { uint32_t buffer; if (pread(fd, &buffer, 4, offset) < 4) return 0; return be32_to_cpu(buffer); }
false
qemu
64a31d5c3d73396a88563d7a504654edc85aa854
static off_t read_uint32(int fd, int64_t offset) { uint32_t buffer; if (pread(fd, &buffer, 4, offset) < 4) return 0; return be32_to_cpu(buffer); }
{ "code": [], "line_no": [] }
static off_t FUNC_0(int fd, int64_t offset) { uint32_t buffer; if (pread(fd, &buffer, 4, offset) < 4) return 0; return be32_to_cpu(buffer); }
[ "static off_t FUNC_0(int fd, int64_t offset)\n{", "uint32_t buffer;", "if (pread(fd, &buffer, 4, offset) < 4)\nreturn 0;", "return be32_to_cpu(buffer);", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 11 ], [ 13 ] ]
6,588
static int tosa_dac_send(I2CSlave *i2c, uint8_t data) { TosaDACState *s = TOSA_DAC(i2c); s->buf[s->len] = data; if (s->len ++ > 2) { #ifdef VERBOSE fprintf(stderr, "%s: message too long (%i bytes)\n", __FUNCTION__, s->len); #endif return 1; } if (s->len == 2) { fprintf(stderr, "dac: channel %d value 0x%02x\n", s->buf[0], s->buf[1]); } return 0; }
false
qemu
a89f364ae8740dfc31b321eed9ee454e996dc3c1
static int tosa_dac_send(I2CSlave *i2c, uint8_t data) { TosaDACState *s = TOSA_DAC(i2c); s->buf[s->len] = data; if (s->len ++ > 2) { #ifdef VERBOSE fprintf(stderr, "%s: message too long (%i bytes)\n", __FUNCTION__, s->len); #endif return 1; } if (s->len == 2) { fprintf(stderr, "dac: channel %d value 0x%02x\n", s->buf[0], s->buf[1]); } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(I2CSlave *VAR_0, uint8_t VAR_1) { TosaDACState *s = TOSA_DAC(VAR_0); s->buf[s->len] = VAR_1; if (s->len ++ > 2) { #ifdef VERBOSE fprintf(stderr, "%s: message too long (%i bytes)\n", __FUNCTION__, s->len); #endif return 1; } if (s->len == 2) { fprintf(stderr, "dac: channel %d value 0x%02x\n", s->buf[0], s->buf[1]); } return 0; }
[ "static int FUNC_0(I2CSlave *VAR_0, uint8_t VAR_1)\n{", "TosaDACState *s = TOSA_DAC(VAR_0);", "s->buf[s->len] = VAR_1;", "if (s->len ++ > 2) {", "#ifdef VERBOSE\nfprintf(stderr, \"%s: message too long (%i bytes)\\n\", __FUNCTION__, s->len);", "#endif\nreturn 1;", "}", "if (s->len == 2) {", "fprintf(stderr, \"dac: channel %d value 0x%02x\\n\",\ns->buf[0], s->buf[1]);", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13, 15 ], [ 17, 19 ], [ 21 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 35 ], [ 37 ] ]
6,589
static void socket_start_incoming_migration(SocketAddress *saddr, Error **errp) { QIOChannelSocket *listen_ioc = qio_channel_socket_new(); qio_channel_set_name(QIO_CHANNEL(listen_ioc), "migration-socket-listener"); if (qio_channel_socket_listen_sync(listen_ioc, saddr, errp) < 0) { object_unref(OBJECT(listen_ioc)); qapi_free_SocketAddress(saddr); return; } qio_channel_add_watch(QIO_CHANNEL(listen_ioc), G_IO_IN, socket_accept_incoming_migration, listen_ioc, (GDestroyNotify)object_unref); qapi_free_SocketAddress(saddr); }
false
qemu
dfd100f242370886bb6732f70f1f7cbd8eb9fedc
static void socket_start_incoming_migration(SocketAddress *saddr, Error **errp) { QIOChannelSocket *listen_ioc = qio_channel_socket_new(); qio_channel_set_name(QIO_CHANNEL(listen_ioc), "migration-socket-listener"); if (qio_channel_socket_listen_sync(listen_ioc, saddr, errp) < 0) { object_unref(OBJECT(listen_ioc)); qapi_free_SocketAddress(saddr); return; } qio_channel_add_watch(QIO_CHANNEL(listen_ioc), G_IO_IN, socket_accept_incoming_migration, listen_ioc, (GDestroyNotify)object_unref); qapi_free_SocketAddress(saddr); }
{ "code": [], "line_no": [] }
static void FUNC_0(SocketAddress *VAR_0, Error **VAR_1) { QIOChannelSocket *listen_ioc = qio_channel_socket_new(); qio_channel_set_name(QIO_CHANNEL(listen_ioc), "migration-socket-listener"); if (qio_channel_socket_listen_sync(listen_ioc, VAR_0, VAR_1) < 0) { object_unref(OBJECT(listen_ioc)); qapi_free_SocketAddress(VAR_0); return; } qio_channel_add_watch(QIO_CHANNEL(listen_ioc), G_IO_IN, socket_accept_incoming_migration, listen_ioc, (GDestroyNotify)object_unref); qapi_free_SocketAddress(VAR_0); }
[ "static void FUNC_0(SocketAddress *VAR_0,\nError **VAR_1)\n{", "QIOChannelSocket *listen_ioc = qio_channel_socket_new();", "qio_channel_set_name(QIO_CHANNEL(listen_ioc),\n\"migration-socket-listener\");", "if (qio_channel_socket_listen_sync(listen_ioc, VAR_0, VAR_1) < 0) {", "object_unref(OBJECT(listen_ioc));", "qapi_free_SocketAddress(VAR_0);", "return;", "}", "qio_channel_add_watch(QIO_CHANNEL(listen_ioc),\nG_IO_IN,\nsocket_accept_incoming_migration,\nlisten_ioc,\n(GDestroyNotify)object_unref);", "qapi_free_SocketAddress(VAR_0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11, 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29, 31, 33, 35, 37 ], [ 39 ], [ 41 ] ]
6,590
static void mpc8544ds_init(ram_addr_t ram_size, const char *boot_device, const char *kernel_filename, const char *kernel_cmdline, const char *initrd_filename, const char *cpu_model) { PCIBus *pci_bus; CPUState *env; uint64_t elf_entry; uint64_t elf_lowaddr; target_phys_addr_t entry=0; target_phys_addr_t loadaddr=UIMAGE_LOAD_BASE; target_long kernel_size=0; target_ulong dt_base=DTB_LOAD_BASE; target_ulong initrd_base=INITRD_LOAD_BASE; target_long initrd_size=0; void *fdt; int i=0; unsigned int pci_irq_nrs[4] = {1, 2, 3, 4}; qemu_irq *irqs, *mpic, *pci_irqs; SerialState * serial[2]; /* Setup CPU */ env = cpu_ppc_init("e500v2_v30"); if (!env) { fprintf(stderr, "Unable to initialize CPU!\n"); exit(1); } /* Fixup Memory size on a alignment boundary */ ram_size &= ~(RAM_SIZES_ALIGN - 1); /* Register Memory */ cpu_register_physical_memory(0, ram_size, qemu_ram_alloc(ram_size)); /* MPIC */ irqs = qemu_mallocz(sizeof(qemu_irq) * OPENPIC_OUTPUT_NB); irqs[OPENPIC_OUTPUT_INT] = ((qemu_irq *)env->irq_inputs)[PPCE500_INPUT_INT]; irqs[OPENPIC_OUTPUT_CINT] = ((qemu_irq *)env->irq_inputs)[PPCE500_INPUT_CINT]; mpic = mpic_init(MPC8544_MPIC_REGS_BASE, 1, &irqs, NULL); /* Serial */ if (serial_hds[0]) serial[0] = serial_mm_init(MPC8544_SERIAL0_REGS_BASE, 0, mpic[12+26], 399193, serial_hds[0], 1); if (serial_hds[1]) serial[0] = serial_mm_init(MPC8544_SERIAL1_REGS_BASE, 0, mpic[12+26], 399193, serial_hds[0], 1); /* PCI */ pci_irqs = qemu_malloc(sizeof(qemu_irq) * 4); pci_irqs[0] = mpic[pci_irq_nrs[0]]; pci_irqs[1] = mpic[pci_irq_nrs[1]]; pci_irqs[2] = mpic[pci_irq_nrs[2]]; pci_irqs[3] = mpic[pci_irq_nrs[3]]; pci_bus = ppce500_pci_init(pci_irqs, MPC8544_PCI_REGS_BASE); if (!pci_bus) printf("couldn't create PCI controller!\n"); isa_mmio_init(MPC8544_PCI_IO, MPC8544_PCI_IOLEN); if (pci_bus) { /* Register network interfaces. */ for (i = 0; i < nb_nics; i++) { pci_nic_init_nofail(&nd_table[i], "virtio", NULL); } } /* Load kernel. */ if (kernel_filename) { kernel_size = load_uimage(kernel_filename, &entry, &loadaddr, NULL); if (kernel_size < 0) { kernel_size = load_elf(kernel_filename, 0, &elf_entry, &elf_lowaddr, NULL, 1, ELF_MACHINE, 0); entry = elf_entry; loadaddr = elf_lowaddr; } /* XXX try again as binary */ if (kernel_size < 0) { fprintf(stderr, "qemu: could not load kernel '%s'\n", kernel_filename); exit(1); } } /* Load initrd. */ if (initrd_filename) { initrd_size = load_image_targphys(initrd_filename, initrd_base, ram_size - initrd_base); if (initrd_size < 0) { fprintf(stderr, "qemu: could not load initial ram disk '%s'\n", initrd_filename); exit(1); } } /* If we're loading a kernel directly, we must load the device tree too. */ if (kernel_filename) { fdt = mpc8544_load_device_tree(dt_base, ram_size, initrd_base, initrd_size, kernel_cmdline); if (fdt == NULL) { fprintf(stderr, "couldn't load device tree\n"); exit(1); } cpu_synchronize_state(env); /* Set initial guest state. */ env->gpr[1] = (16<<20) - 8; env->gpr[3] = dt_base; env->nip = entry; /* XXX we currently depend on KVM to create some initial TLB entries. */ } if (kvm_enabled()) kvmppc_init(); return; }
false
qemu
04088adbe0c5adca66adb6022723362ad90ed0fc
static void mpc8544ds_init(ram_addr_t ram_size, const char *boot_device, const char *kernel_filename, const char *kernel_cmdline, const char *initrd_filename, const char *cpu_model) { PCIBus *pci_bus; CPUState *env; uint64_t elf_entry; uint64_t elf_lowaddr; target_phys_addr_t entry=0; target_phys_addr_t loadaddr=UIMAGE_LOAD_BASE; target_long kernel_size=0; target_ulong dt_base=DTB_LOAD_BASE; target_ulong initrd_base=INITRD_LOAD_BASE; target_long initrd_size=0; void *fdt; int i=0; unsigned int pci_irq_nrs[4] = {1, 2, 3, 4}; qemu_irq *irqs, *mpic, *pci_irqs; SerialState * serial[2]; env = cpu_ppc_init("e500v2_v30"); if (!env) { fprintf(stderr, "Unable to initialize CPU!\n"); exit(1); } ram_size &= ~(RAM_SIZES_ALIGN - 1); cpu_register_physical_memory(0, ram_size, qemu_ram_alloc(ram_size)); irqs = qemu_mallocz(sizeof(qemu_irq) * OPENPIC_OUTPUT_NB); irqs[OPENPIC_OUTPUT_INT] = ((qemu_irq *)env->irq_inputs)[PPCE500_INPUT_INT]; irqs[OPENPIC_OUTPUT_CINT] = ((qemu_irq *)env->irq_inputs)[PPCE500_INPUT_CINT]; mpic = mpic_init(MPC8544_MPIC_REGS_BASE, 1, &irqs, NULL); if (serial_hds[0]) serial[0] = serial_mm_init(MPC8544_SERIAL0_REGS_BASE, 0, mpic[12+26], 399193, serial_hds[0], 1); if (serial_hds[1]) serial[0] = serial_mm_init(MPC8544_SERIAL1_REGS_BASE, 0, mpic[12+26], 399193, serial_hds[0], 1); pci_irqs = qemu_malloc(sizeof(qemu_irq) * 4); pci_irqs[0] = mpic[pci_irq_nrs[0]]; pci_irqs[1] = mpic[pci_irq_nrs[1]]; pci_irqs[2] = mpic[pci_irq_nrs[2]]; pci_irqs[3] = mpic[pci_irq_nrs[3]]; pci_bus = ppce500_pci_init(pci_irqs, MPC8544_PCI_REGS_BASE); if (!pci_bus) printf("couldn't create PCI controller!\n"); isa_mmio_init(MPC8544_PCI_IO, MPC8544_PCI_IOLEN); if (pci_bus) { for (i = 0; i < nb_nics; i++) { pci_nic_init_nofail(&nd_table[i], "virtio", NULL); } } if (kernel_filename) { kernel_size = load_uimage(kernel_filename, &entry, &loadaddr, NULL); if (kernel_size < 0) { kernel_size = load_elf(kernel_filename, 0, &elf_entry, &elf_lowaddr, NULL, 1, ELF_MACHINE, 0); entry = elf_entry; loadaddr = elf_lowaddr; } if (kernel_size < 0) { fprintf(stderr, "qemu: could not load kernel '%s'\n", kernel_filename); exit(1); } } if (initrd_filename) { initrd_size = load_image_targphys(initrd_filename, initrd_base, ram_size - initrd_base); if (initrd_size < 0) { fprintf(stderr, "qemu: could not load initial ram disk '%s'\n", initrd_filename); exit(1); } } if (kernel_filename) { fdt = mpc8544_load_device_tree(dt_base, ram_size, initrd_base, initrd_size, kernel_cmdline); if (fdt == NULL) { fprintf(stderr, "couldn't load device tree\n"); exit(1); } cpu_synchronize_state(env); env->gpr[1] = (16<<20) - 8; env->gpr[3] = dt_base; env->nip = entry; } if (kvm_enabled()) kvmppc_init(); return; }
{ "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) { PCIBus *pci_bus; CPUState *env; uint64_t elf_entry; uint64_t elf_lowaddr; target_phys_addr_t entry=0; target_phys_addr_t loadaddr=UIMAGE_LOAD_BASE; target_long kernel_size=0; target_ulong dt_base=DTB_LOAD_BASE; target_ulong initrd_base=INITRD_LOAD_BASE; target_long initrd_size=0; void *VAR_6; int VAR_7=0; unsigned int VAR_8[4] = {1, 2, 3, 4}; qemu_irq *irqs, *mpic, *pci_irqs; SerialState * serial[2]; env = cpu_ppc_init("e500v2_v30"); if (!env) { fprintf(stderr, "Unable to initialize CPU!\n"); exit(1); } VAR_0 &= ~(RAM_SIZES_ALIGN - 1); cpu_register_physical_memory(0, VAR_0, qemu_ram_alloc(VAR_0)); irqs = qemu_mallocz(sizeof(qemu_irq) * OPENPIC_OUTPUT_NB); irqs[OPENPIC_OUTPUT_INT] = ((qemu_irq *)env->irq_inputs)[PPCE500_INPUT_INT]; irqs[OPENPIC_OUTPUT_CINT] = ((qemu_irq *)env->irq_inputs)[PPCE500_INPUT_CINT]; mpic = mpic_init(MPC8544_MPIC_REGS_BASE, 1, &irqs, NULL); if (serial_hds[0]) serial[0] = serial_mm_init(MPC8544_SERIAL0_REGS_BASE, 0, mpic[12+26], 399193, serial_hds[0], 1); if (serial_hds[1]) serial[0] = serial_mm_init(MPC8544_SERIAL1_REGS_BASE, 0, mpic[12+26], 399193, serial_hds[0], 1); pci_irqs = qemu_malloc(sizeof(qemu_irq) * 4); pci_irqs[0] = mpic[VAR_8[0]]; pci_irqs[1] = mpic[VAR_8[1]]; pci_irqs[2] = mpic[VAR_8[2]]; pci_irqs[3] = mpic[VAR_8[3]]; pci_bus = ppce500_pci_init(pci_irqs, MPC8544_PCI_REGS_BASE); if (!pci_bus) printf("couldn't create PCI controller!\n"); isa_mmio_init(MPC8544_PCI_IO, MPC8544_PCI_IOLEN); if (pci_bus) { for (VAR_7 = 0; VAR_7 < nb_nics; VAR_7++) { pci_nic_init_nofail(&nd_table[VAR_7], "virtio", NULL); } } if (VAR_2) { kernel_size = load_uimage(VAR_2, &entry, &loadaddr, NULL); if (kernel_size < 0) { kernel_size = load_elf(VAR_2, 0, &elf_entry, &elf_lowaddr, NULL, 1, ELF_MACHINE, 0); entry = elf_entry; loadaddr = elf_lowaddr; } if (kernel_size < 0) { fprintf(stderr, "qemu: could not load kernel '%s'\n", VAR_2); exit(1); } } if (VAR_4) { initrd_size = load_image_targphys(VAR_4, initrd_base, VAR_0 - initrd_base); if (initrd_size < 0) { fprintf(stderr, "qemu: could not load initial ram disk '%s'\n", VAR_4); exit(1); } } if (VAR_2) { VAR_6 = mpc8544_load_device_tree(dt_base, VAR_0, initrd_base, initrd_size, VAR_3); if (VAR_6 == NULL) { fprintf(stderr, "couldn't load device tree\n"); exit(1); } cpu_synchronize_state(env); env->gpr[1] = (16<<20) - 8; env->gpr[3] = dt_base; env->nip = entry; } if (kvm_enabled()) kvmppc_init(); return; }
[ "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{", "PCIBus *pci_bus;", "CPUState *env;", "uint64_t elf_entry;", "uint64_t elf_lowaddr;", "target_phys_addr_t entry=0;", "target_phys_addr_t loadaddr=UIMAGE_LOAD_BASE;", "target_long kernel_size=0;", "target_ulong dt_base=DTB_LOAD_BASE;", "target_ulong initrd_base=INITRD_LOAD_BASE;", "target_long initrd_size=0;", "void *VAR_6;", "int VAR_7=0;", "unsigned int VAR_8[4] = {1, 2, 3, 4};", "qemu_irq *irqs, *mpic, *pci_irqs;", "SerialState * serial[2];", "env = cpu_ppc_init(\"e500v2_v30\");", "if (!env) {", "fprintf(stderr, \"Unable to initialize CPU!\\n\");", "exit(1);", "}", "VAR_0 &= ~(RAM_SIZES_ALIGN - 1);", "cpu_register_physical_memory(0, VAR_0, qemu_ram_alloc(VAR_0));", "irqs = qemu_mallocz(sizeof(qemu_irq) * OPENPIC_OUTPUT_NB);", "irqs[OPENPIC_OUTPUT_INT] = ((qemu_irq *)env->irq_inputs)[PPCE500_INPUT_INT];", "irqs[OPENPIC_OUTPUT_CINT] = ((qemu_irq *)env->irq_inputs)[PPCE500_INPUT_CINT];", "mpic = mpic_init(MPC8544_MPIC_REGS_BASE, 1, &irqs, NULL);", "if (serial_hds[0])\nserial[0] = serial_mm_init(MPC8544_SERIAL0_REGS_BASE,\n0, mpic[12+26], 399193,\nserial_hds[0], 1);", "if (serial_hds[1])\nserial[0] = serial_mm_init(MPC8544_SERIAL1_REGS_BASE,\n0, mpic[12+26], 399193,\nserial_hds[0], 1);", "pci_irqs = qemu_malloc(sizeof(qemu_irq) * 4);", "pci_irqs[0] = mpic[VAR_8[0]];", "pci_irqs[1] = mpic[VAR_8[1]];", "pci_irqs[2] = mpic[VAR_8[2]];", "pci_irqs[3] = mpic[VAR_8[3]];", "pci_bus = ppce500_pci_init(pci_irqs, MPC8544_PCI_REGS_BASE);", "if (!pci_bus)\nprintf(\"couldn't create PCI controller!\\n\");", "isa_mmio_init(MPC8544_PCI_IO, MPC8544_PCI_IOLEN);", "if (pci_bus) {", "for (VAR_7 = 0; VAR_7 < nb_nics; VAR_7++) {", "pci_nic_init_nofail(&nd_table[VAR_7], \"virtio\", NULL);", "}", "}", "if (VAR_2) {", "kernel_size = load_uimage(VAR_2, &entry, &loadaddr, NULL);", "if (kernel_size < 0) {", "kernel_size = load_elf(VAR_2, 0, &elf_entry, &elf_lowaddr,\nNULL, 1, ELF_MACHINE, 0);", "entry = elf_entry;", "loadaddr = elf_lowaddr;", "}", "if (kernel_size < 0) {", "fprintf(stderr, \"qemu: could not load kernel '%s'\\n\",\nVAR_2);", "exit(1);", "}", "}", "if (VAR_4) {", "initrd_size = load_image_targphys(VAR_4, initrd_base,\nVAR_0 - initrd_base);", "if (initrd_size < 0) {", "fprintf(stderr, \"qemu: could not load initial ram disk '%s'\\n\",\nVAR_4);", "exit(1);", "}", "}", "if (VAR_2) {", "VAR_6 = mpc8544_load_device_tree(dt_base, VAR_0,\ninitrd_base, initrd_size, VAR_3);", "if (VAR_6 == NULL) {", "fprintf(stderr, \"couldn't load device tree\\n\");", "exit(1);", "}", "cpu_synchronize_state(env);", "env->gpr[1] = (16<<20) - 8;", "env->gpr[3] = dt_base;", "env->nip = entry;", "}", "if (kvm_enabled())\nkvmppc_init();", "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 ]
[ [ 1, 3, 5, 7, 9, 11, 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 63 ], [ 69 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 87, 89, 91, 93 ], [ 97, 99, 101, 103 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121, 123 ], [ 127 ], [ 131 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 147 ], [ 149 ], [ 151 ], [ 153, 155 ], [ 157 ], [ 159 ], [ 161 ], [ 165 ], [ 167, 169 ], [ 171 ], [ 173 ], [ 175 ], [ 181 ], [ 183, 185 ], [ 189 ], [ 191, 193 ], [ 195 ], [ 197 ], [ 199 ], [ 205 ], [ 207, 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 221 ], [ 227 ], [ 229 ], [ 231 ], [ 235 ], [ 239, 241 ], [ 245 ], [ 247 ] ]
6,591
static void test_visitor_out_native_list_bool(TestOutputVisitorData *data, const void *unused) { test_native_list(data, unused, USER_DEF_NATIVE_LIST_UNION_KIND_BOOLEAN); }
false
qemu
b3db211f3c80bb996a704d665fe275619f728bd4
static void test_visitor_out_native_list_bool(TestOutputVisitorData *data, const void *unused) { test_native_list(data, unused, USER_DEF_NATIVE_LIST_UNION_KIND_BOOLEAN); }
{ "code": [], "line_no": [] }
static void FUNC_0(TestOutputVisitorData *VAR_0, const void *VAR_1) { test_native_list(VAR_0, VAR_1, USER_DEF_NATIVE_LIST_UNION_KIND_BOOLEAN); }
[ "static void FUNC_0(TestOutputVisitorData *VAR_0,\nconst void *VAR_1)\n{", "test_native_list(VAR_0, VAR_1, USER_DEF_NATIVE_LIST_UNION_KIND_BOOLEAN);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ] ]
6,592
static int virtio_blk_load_device(VirtIODevice *vdev, QEMUFile *f, int version_id) { VirtIOBlock *s = VIRTIO_BLK(vdev); while (qemu_get_sbyte(f)) { unsigned nvqs = s->conf.num_queues; unsigned vq_idx = 0; VirtIOBlockReq *req; if (nvqs > 1) { vq_idx = qemu_get_be32(f); if (vq_idx >= nvqs) { error_report("Invalid virtqueue index in request list: %#x", vq_idx); return -EINVAL; } } req = qemu_get_virtqueue_element(f, sizeof(VirtIOBlockReq)); virtio_blk_init_request(s, virtio_get_queue(vdev, vq_idx), req); req->next = s->rq; s->rq = req; } return 0; }
false
qemu
8607f5c3072caeebbe0217df28651fffd3a79fd9
static int virtio_blk_load_device(VirtIODevice *vdev, QEMUFile *f, int version_id) { VirtIOBlock *s = VIRTIO_BLK(vdev); while (qemu_get_sbyte(f)) { unsigned nvqs = s->conf.num_queues; unsigned vq_idx = 0; VirtIOBlockReq *req; if (nvqs > 1) { vq_idx = qemu_get_be32(f); if (vq_idx >= nvqs) { error_report("Invalid virtqueue index in request list: %#x", vq_idx); return -EINVAL; } } req = qemu_get_virtqueue_element(f, sizeof(VirtIOBlockReq)); virtio_blk_init_request(s, virtio_get_queue(vdev, vq_idx), req); req->next = s->rq; s->rq = req; } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(VirtIODevice *VAR_0, QEMUFile *VAR_1, int VAR_2) { VirtIOBlock *s = VIRTIO_BLK(VAR_0); while (qemu_get_sbyte(VAR_1)) { unsigned VAR_3 = s->conf.num_queues; unsigned VAR_4 = 0; VirtIOBlockReq *req; if (VAR_3 > 1) { VAR_4 = qemu_get_be32(VAR_1); if (VAR_4 >= VAR_3) { error_report("Invalid virtqueue index in request list: %#x", VAR_4); return -EINVAL; } } req = qemu_get_virtqueue_element(VAR_1, sizeof(VirtIOBlockReq)); virtio_blk_init_request(s, virtio_get_queue(VAR_0, VAR_4), req); req->next = s->rq; s->rq = req; } return 0; }
[ "static int FUNC_0(VirtIODevice *VAR_0, QEMUFile *VAR_1,\nint VAR_2)\n{", "VirtIOBlock *s = VIRTIO_BLK(VAR_0);", "while (qemu_get_sbyte(VAR_1)) {", "unsigned VAR_3 = s->conf.num_queues;", "unsigned VAR_4 = 0;", "VirtIOBlockReq *req;", "if (VAR_3 > 1) {", "VAR_4 = qemu_get_be32(VAR_1);", "if (VAR_4 >= VAR_3) {", "error_report(\"Invalid virtqueue index in request list: %#x\",\nVAR_4);", "return -EINVAL;", "}", "}", "req = qemu_get_virtqueue_element(VAR_1, sizeof(VirtIOBlockReq));", "virtio_blk_init_request(s, virtio_get_queue(VAR_0, VAR_4), req);", "req->next = s->rq;", "s->rq = req;", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 27 ], [ 29, 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ] ]
6,593
void pci_device_hot_add(Monitor *mon, const QDict *qdict, QObject **ret_data) { PCIDevice *dev = NULL; const char *pci_addr = qdict_get_str(qdict, "pci_addr"); const char *type = qdict_get_str(qdict, "type"); const char *opts = qdict_get_try_str(qdict, "opts"); /* strip legacy tag */ if (!strncmp(pci_addr, "pci_addr=", 9)) { pci_addr += 9; } if (!opts) { opts = ""; } if (!strcmp(pci_addr, "auto")) pci_addr = NULL; if (strcmp(type, "nic") == 0) dev = qemu_pci_hot_add_nic(mon, pci_addr, opts); else if (strcmp(type, "storage") == 0) dev = qemu_pci_hot_add_storage(mon, pci_addr, opts); else monitor_printf(mon, "invalid type: %s\n", type); if (dev) { *ret_data = qobject_from_jsonf("{ 'domain': 0, 'bus': %d, 'slot': %d, " "'function': %d }", pci_bus_num(dev->bus), PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn)); assert(*ret_data != NULL); } else monitor_printf(mon, "failed to add %s\n", opts); }
false
qemu
ba14414174b72fa231997243a9650feaa520d054
void pci_device_hot_add(Monitor *mon, const QDict *qdict, QObject **ret_data) { PCIDevice *dev = NULL; const char *pci_addr = qdict_get_str(qdict, "pci_addr"); const char *type = qdict_get_str(qdict, "type"); const char *opts = qdict_get_try_str(qdict, "opts"); if (!strncmp(pci_addr, "pci_addr=", 9)) { pci_addr += 9; } if (!opts) { opts = ""; } if (!strcmp(pci_addr, "auto")) pci_addr = NULL; if (strcmp(type, "nic") == 0) dev = qemu_pci_hot_add_nic(mon, pci_addr, opts); else if (strcmp(type, "storage") == 0) dev = qemu_pci_hot_add_storage(mon, pci_addr, opts); else monitor_printf(mon, "invalid type: %s\n", type); if (dev) { *ret_data = qobject_from_jsonf("{ 'domain': 0, 'bus': %d, 'slot': %d, " "'function': %d }", pci_bus_num(dev->bus), PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn)); assert(*ret_data != NULL); } else monitor_printf(mon, "failed to add %s\n", opts); }
{ "code": [], "line_no": [] }
void FUNC_0(Monitor *VAR_0, const QDict *VAR_1, QObject **VAR_2) { PCIDevice *dev = NULL; const char *VAR_3 = qdict_get_str(VAR_1, "VAR_3"); const char *VAR_4 = qdict_get_str(VAR_1, "VAR_4"); const char *VAR_5 = qdict_get_try_str(VAR_1, "VAR_5"); if (!strncmp(VAR_3, "VAR_3=", 9)) { VAR_3 += 9; } if (!VAR_5) { VAR_5 = ""; } if (!strcmp(VAR_3, "auto")) VAR_3 = NULL; if (strcmp(VAR_4, "nic") == 0) dev = qemu_pci_hot_add_nic(VAR_0, VAR_3, VAR_5); else if (strcmp(VAR_4, "storage") == 0) dev = qemu_pci_hot_add_storage(VAR_0, VAR_3, VAR_5); else monitor_printf(VAR_0, "invalid VAR_4: %s\n", VAR_4); if (dev) { *VAR_2 = qobject_from_jsonf("{ 'domain': 0, 'bus': %d, 'slot': %d, " "'function': %d }", pci_bus_num(dev->bus), PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn)); assert(*VAR_2 != NULL); } else monitor_printf(VAR_0, "failed to add %s\n", VAR_5); }
[ "void FUNC_0(Monitor *VAR_0, const QDict *VAR_1, QObject **VAR_2)\n{", "PCIDevice *dev = NULL;", "const char *VAR_3 = qdict_get_str(VAR_1, \"VAR_3\");", "const char *VAR_4 = qdict_get_str(VAR_1, \"VAR_4\");", "const char *VAR_5 = qdict_get_try_str(VAR_1, \"VAR_5\");", "if (!strncmp(VAR_3, \"VAR_3=\", 9)) {", "VAR_3 += 9;", "}", "if (!VAR_5) {", "VAR_5 = \"\";", "}", "if (!strcmp(VAR_3, \"auto\"))\nVAR_3 = NULL;", "if (strcmp(VAR_4, \"nic\") == 0)\ndev = qemu_pci_hot_add_nic(VAR_0, VAR_3, VAR_5);", "else if (strcmp(VAR_4, \"storage\") == 0)\ndev = qemu_pci_hot_add_storage(VAR_0, VAR_3, VAR_5);", "else\nmonitor_printf(VAR_0, \"invalid VAR_4: %s\\n\", VAR_4);", "if (dev) {", "*VAR_2 =\nqobject_from_jsonf(\"{ 'domain': 0, 'bus': %d, 'slot': %d, \"", "\"'function': %d }\", pci_bus_num(dev->bus),", "PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn));", "assert(*VAR_2 != NULL);", "} else", "monitor_printf(VAR_0, \"failed to add %s\\n\", 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 33, 35 ], [ 39, 41 ], [ 43, 45 ], [ 47, 49 ], [ 53 ], [ 55, 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ] ]
6,596
static int tta_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; TTAContext *s = avctx->priv_data; int i, ret; int cur_chan = 0, framelen = s->frame_length; int32_t *p; if (avctx->err_recognition & AV_EF_CRCCHECK) { if (buf_size < 4 || tta_check_crc(s, buf, buf_size - 4)) return AVERROR_INVALIDDATA; } init_get_bits(&s->gb, buf, buf_size*8); // FIXME: seeking s->total_frames--; if (!s->total_frames && s->last_frame_length) framelen = s->last_frame_length; /* get output buffer */ s->frame.nb_samples = framelen; if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } // decode directly to output buffer for 24-bit sample format if (s->bps == 3) s->decode_buffer = (int32_t *)s->frame.data[0]; // init per channel states for (i = 0; i < s->channels; i++) { s->ch_ctx[i].predictor = 0; ttafilter_init(&s->ch_ctx[i].filter, ttafilter_configs[s->bps-1]); rice_init(&s->ch_ctx[i].rice, 10, 10); } for (p = s->decode_buffer; p < s->decode_buffer + (framelen * s->channels); p++) { int32_t *predictor = &s->ch_ctx[cur_chan].predictor; TTAFilter *filter = &s->ch_ctx[cur_chan].filter; TTARice *rice = &s->ch_ctx[cur_chan].rice; uint32_t unary, depth, k; int32_t value; unary = tta_get_unary(&s->gb); if (unary == 0) { depth = 0; k = rice->k0; } else { depth = 1; k = rice->k1; unary--; } if (get_bits_left(&s->gb) < k) { ret = AVERROR_INVALIDDATA; goto error; } if (k) { if (k > MIN_CACHE_BITS) { ret = AVERROR_INVALIDDATA; goto error; } value = (unary << k) + get_bits(&s->gb, k); } else value = unary; // FIXME: copy paste from original switch (depth) { case 1: rice->sum1 += value - (rice->sum1 >> 4); if (rice->k1 > 0 && rice->sum1 < shift_16[rice->k1]) rice->k1--; else if(rice->sum1 > shift_16[rice->k1 + 1]) rice->k1++; value += shift_1[rice->k0]; default: rice->sum0 += value - (rice->sum0 >> 4); if (rice->k0 > 0 && rice->sum0 < shift_16[rice->k0]) rice->k0--; else if(rice->sum0 > shift_16[rice->k0 + 1]) rice->k0++; } // extract coded value *p = 1 + ((value >> 1) ^ ((value & 1) - 1)); // run hybrid filter ttafilter_process(filter, p); // fixed order prediction #define PRED(x, k) (int32_t)((((uint64_t)x << k) - x) >> k) switch (s->bps) { case 1: *p += PRED(*predictor, 4); break; case 2: case 3: *p += PRED(*predictor, 5); break; case 4: *p += *predictor; break; } *predictor = *p; // flip channels if (cur_chan < (s->channels-1)) cur_chan++; else { // decorrelate in case of multiple channels if (s->channels > 1) { int32_t *r = p - 1; for (*p += *r / 2; r > p - s->channels; r--) *r = *(r + 1) - *r; } cur_chan = 0; } } if (get_bits_left(&s->gb) < 32) { ret = AVERROR_INVALIDDATA; goto error; } skip_bits_long(&s->gb, 32); // frame crc // convert to output buffer if (s->bps == 2) { int16_t *samples = (int16_t *)s->frame.data[0]; for (p = s->decode_buffer; p < s->decode_buffer + (framelen * s->channels); p++) *samples++ = *p; } else { // shift samples for 24-bit sample format int32_t *samples = (int32_t *)s->frame.data[0]; for (i = 0; i < framelen * s->channels; i++) *samples++ <<= 8; // reset decode buffer s->decode_buffer = NULL; } *got_frame_ptr = 1; *(AVFrame *)data = s->frame; return buf_size; error: // reset decode buffer if (s->bps == 3) s->decode_buffer = NULL; return ret; }
false
FFmpeg
5778299c7ed3f82c624589bd35c82f597a8e0b64
static int tta_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; TTAContext *s = avctx->priv_data; int i, ret; int cur_chan = 0, framelen = s->frame_length; int32_t *p; if (avctx->err_recognition & AV_EF_CRCCHECK) { if (buf_size < 4 || tta_check_crc(s, buf, buf_size - 4)) return AVERROR_INVALIDDATA; } init_get_bits(&s->gb, buf, buf_size*8); s->total_frames--; if (!s->total_frames && s->last_frame_length) framelen = s->last_frame_length; s->frame.nb_samples = framelen; if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } if (s->bps == 3) s->decode_buffer = (int32_t *)s->frame.data[0]; for (i = 0; i < s->channels; i++) { s->ch_ctx[i].predictor = 0; ttafilter_init(&s->ch_ctx[i].filter, ttafilter_configs[s->bps-1]); rice_init(&s->ch_ctx[i].rice, 10, 10); } for (p = s->decode_buffer; p < s->decode_buffer + (framelen * s->channels); p++) { int32_t *predictor = &s->ch_ctx[cur_chan].predictor; TTAFilter *filter = &s->ch_ctx[cur_chan].filter; TTARice *rice = &s->ch_ctx[cur_chan].rice; uint32_t unary, depth, k; int32_t value; unary = tta_get_unary(&s->gb); if (unary == 0) { depth = 0; k = rice->k0; } else { depth = 1; k = rice->k1; unary--; } if (get_bits_left(&s->gb) < k) { ret = AVERROR_INVALIDDATA; goto error; } if (k) { if (k > MIN_CACHE_BITS) { ret = AVERROR_INVALIDDATA; goto error; } value = (unary << k) + get_bits(&s->gb, k); } else value = unary; switch (depth) { case 1: rice->sum1 += value - (rice->sum1 >> 4); if (rice->k1 > 0 && rice->sum1 < shift_16[rice->k1]) rice->k1--; else if(rice->sum1 > shift_16[rice->k1 + 1]) rice->k1++; value += shift_1[rice->k0]; default: rice->sum0 += value - (rice->sum0 >> 4); if (rice->k0 > 0 && rice->sum0 < shift_16[rice->k0]) rice->k0--; else if(rice->sum0 > shift_16[rice->k0 + 1]) rice->k0++; } *p = 1 + ((value >> 1) ^ ((value & 1) - 1)); ttafilter_process(filter, p); #define PRED(x, k) (int32_t)((((uint64_t)x << k) - x) >> k) switch (s->bps) { case 1: *p += PRED(*predictor, 4); break; case 2: case 3: *p += PRED(*predictor, 5); break; case 4: *p += *predictor; break; } *predictor = *p; if (cur_chan < (s->channels-1)) cur_chan++; else { if (s->channels > 1) { int32_t *r = p - 1; for (*p += *r / 2; r > p - s->channels; r--) *r = *(r + 1) - *r; } cur_chan = 0; } } if (get_bits_left(&s->gb) < 32) { ret = AVERROR_INVALIDDATA; goto error; } skip_bits_long(&s->gb, 32); if (s->bps == 2) { int16_t *samples = (int16_t *)s->frame.data[0]; for (p = s->decode_buffer; p < s->decode_buffer + (framelen * s->channels); p++) *samples++ = *p; } else { int32_t *samples = (int32_t *)s->frame.data[0]; for (i = 0; i < framelen * s->channels; i++) *samples++ <<= 8; s->decode_buffer = NULL; } *got_frame_ptr = 1; *(AVFrame *)data = s->frame; return buf_size; error: if (s->bps == 3) s->decode_buffer = NULL; return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3) { const uint8_t *VAR_4 = VAR_3->VAR_1; int VAR_5 = VAR_3->size; TTAContext *s = VAR_0->priv_data; int VAR_6, VAR_7; int VAR_8 = 0, VAR_9 = s->frame_length; int32_t *p; if (VAR_0->err_recognition & AV_EF_CRCCHECK) { if (VAR_5 < 4 || tta_check_crc(s, VAR_4, VAR_5 - 4)) return AVERROR_INVALIDDATA; } init_get_bits(&s->gb, VAR_4, VAR_5*8); s->total_frames--; if (!s->total_frames && s->last_frame_length) VAR_9 = s->last_frame_length; s->frame.nb_samples = VAR_9; if ((VAR_7 = ff_get_buffer(VAR_0, &s->frame)) < 0) { av_log(VAR_0, AV_LOG_ERROR, "get_buffer() failed\n"); return VAR_7; } if (s->bps == 3) s->decode_buffer = (int32_t *)s->frame.VAR_1[0]; for (VAR_6 = 0; VAR_6 < s->channels; VAR_6++) { s->ch_ctx[VAR_6].predictor = 0; ttafilter_init(&s->ch_ctx[VAR_6].filter, ttafilter_configs[s->bps-1]); rice_init(&s->ch_ctx[VAR_6].rice, 10, 10); } for (p = s->decode_buffer; p < s->decode_buffer + (VAR_9 * s->channels); p++) { int32_t *predictor = &s->ch_ctx[VAR_8].predictor; TTAFilter *filter = &s->ch_ctx[VAR_8].filter; TTARice *rice = &s->ch_ctx[VAR_8].rice; uint32_t unary, depth, k; int32_t value; unary = tta_get_unary(&s->gb); if (unary == 0) { depth = 0; k = rice->k0; } else { depth = 1; k = rice->k1; unary--; } if (get_bits_left(&s->gb) < k) { VAR_7 = AVERROR_INVALIDDATA; goto error; } if (k) { if (k > MIN_CACHE_BITS) { VAR_7 = AVERROR_INVALIDDATA; goto error; } value = (unary << k) + get_bits(&s->gb, k); } else value = unary; switch (depth) { case 1: rice->sum1 += value - (rice->sum1 >> 4); if (rice->k1 > 0 && rice->sum1 < shift_16[rice->k1]) rice->k1--; else if(rice->sum1 > shift_16[rice->k1 + 1]) rice->k1++; value += shift_1[rice->k0]; default: rice->sum0 += value - (rice->sum0 >> 4); if (rice->k0 > 0 && rice->sum0 < shift_16[rice->k0]) rice->k0--; else if(rice->sum0 > shift_16[rice->k0 + 1]) rice->k0++; } *p = 1 + ((value >> 1) ^ ((value & 1) - 1)); ttafilter_process(filter, p); #define PRED(x, k) (int32_t)((((uint64_t)x << k) - x) >> k) switch (s->bps) { case 1: *p += PRED(*predictor, 4); break; case 2: case 3: *p += PRED(*predictor, 5); break; case 4: *p += *predictor; break; } *predictor = *p; if (VAR_8 < (s->channels-1)) VAR_8++; else { if (s->channels > 1) { int32_t *r = p - 1; for (*p += *r / 2; r > p - s->channels; r--) *r = *(r + 1) - *r; } VAR_8 = 0; } } if (get_bits_left(&s->gb) < 32) { VAR_7 = AVERROR_INVALIDDATA; goto error; } skip_bits_long(&s->gb, 32); if (s->bps == 2) { int16_t *samples = (int16_t *)s->frame.VAR_1[0]; for (p = s->decode_buffer; p < s->decode_buffer + (VAR_9 * s->channels); p++) *samples++ = *p; } else { int32_t *samples = (int32_t *)s->frame.VAR_1[0]; for (VAR_6 = 0; VAR_6 < VAR_9 * s->channels; VAR_6++) *samples++ <<= 8; s->decode_buffer = NULL; } *VAR_2 = 1; *(AVFrame *)VAR_1 = s->frame; return VAR_5; error: if (s->bps == 3) s->decode_buffer = NULL; return VAR_7; }
[ "static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1,\nint *VAR_2, AVPacket *VAR_3)\n{", "const uint8_t *VAR_4 = VAR_3->VAR_1;", "int VAR_5 = VAR_3->size;", "TTAContext *s = VAR_0->priv_data;", "int VAR_6, VAR_7;", "int VAR_8 = 0, VAR_9 = s->frame_length;", "int32_t *p;", "if (VAR_0->err_recognition & AV_EF_CRCCHECK) {", "if (VAR_5 < 4 || tta_check_crc(s, VAR_4, VAR_5 - 4))\nreturn AVERROR_INVALIDDATA;", "}", "init_get_bits(&s->gb, VAR_4, VAR_5*8);", "s->total_frames--;", "if (!s->total_frames && s->last_frame_length)\nVAR_9 = s->last_frame_length;", "s->frame.nb_samples = VAR_9;", "if ((VAR_7 = ff_get_buffer(VAR_0, &s->frame)) < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"get_buffer() failed\\n\");", "return VAR_7;", "}", "if (s->bps == 3)\ns->decode_buffer = (int32_t *)s->frame.VAR_1[0];", "for (VAR_6 = 0; VAR_6 < s->channels; VAR_6++) {", "s->ch_ctx[VAR_6].predictor = 0;", "ttafilter_init(&s->ch_ctx[VAR_6].filter, ttafilter_configs[s->bps-1]);", "rice_init(&s->ch_ctx[VAR_6].rice, 10, 10);", "}", "for (p = s->decode_buffer; p < s->decode_buffer + (VAR_9 * s->channels); p++) {", "int32_t *predictor = &s->ch_ctx[VAR_8].predictor;", "TTAFilter *filter = &s->ch_ctx[VAR_8].filter;", "TTARice *rice = &s->ch_ctx[VAR_8].rice;", "uint32_t unary, depth, k;", "int32_t value;", "unary = tta_get_unary(&s->gb);", "if (unary == 0) {", "depth = 0;", "k = rice->k0;", "} else {", "depth = 1;", "k = rice->k1;", "unary--;", "}", "if (get_bits_left(&s->gb) < k) {", "VAR_7 = AVERROR_INVALIDDATA;", "goto error;", "}", "if (k) {", "if (k > MIN_CACHE_BITS) {", "VAR_7 = AVERROR_INVALIDDATA;", "goto error;", "}", "value = (unary << k) + get_bits(&s->gb, k);", "} else", "value = unary;", "switch (depth) {", "case 1:\nrice->sum1 += value - (rice->sum1 >> 4);", "if (rice->k1 > 0 && rice->sum1 < shift_16[rice->k1])\nrice->k1--;", "else if(rice->sum1 > shift_16[rice->k1 + 1])\nrice->k1++;", "value += shift_1[rice->k0];", "default:\nrice->sum0 += value - (rice->sum0 >> 4);", "if (rice->k0 > 0 && rice->sum0 < shift_16[rice->k0])\nrice->k0--;", "else if(rice->sum0 > shift_16[rice->k0 + 1])\nrice->k0++;", "}", "*p = 1 + ((value >> 1) ^ ((value & 1) - 1));", "ttafilter_process(filter, p);", "#define PRED(x, k) (int32_t)((((uint64_t)x << k) - x) >> k)\nswitch (s->bps) {", "case 1: *p += PRED(*predictor, 4); break;", "case 2:\ncase 3: *p += PRED(*predictor, 5); break;", "case 4: *p += *predictor; break;", "}", "*predictor = *p;", "if (VAR_8 < (s->channels-1))\nVAR_8++;", "else {", "if (s->channels > 1) {", "int32_t *r = p - 1;", "for (*p += *r / 2; r > p - s->channels; r--)", "*r = *(r + 1) - *r;", "}", "VAR_8 = 0;", "}", "}", "if (get_bits_left(&s->gb) < 32) {", "VAR_7 = AVERROR_INVALIDDATA;", "goto error;", "}", "skip_bits_long(&s->gb, 32);", "if (s->bps == 2) {", "int16_t *samples = (int16_t *)s->frame.VAR_1[0];", "for (p = s->decode_buffer; p < s->decode_buffer + (VAR_9 * s->channels); p++)", "*samples++ = *p;", "} else {", "int32_t *samples = (int32_t *)s->frame.VAR_1[0];", "for (VAR_6 = 0; VAR_6 < VAR_9 * s->channels; VAR_6++)", "*samples++ <<= 8;", "s->decode_buffer = NULL;", "}", "*VAR_2 = 1;", "*(AVFrame *)VAR_1 = s->frame;", "return VAR_5;", "error:\nif (s->bps == 3)\ns->decode_buffer = NULL;", "return VAR_7;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 31 ], [ 37 ], [ 39, 41 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 61, 63 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 95 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 147 ], [ 149, 151 ], [ 153, 155 ], [ 157, 159 ], [ 161 ], [ 163, 165 ], [ 167, 169 ], [ 171, 173 ], [ 175 ], [ 181 ], [ 187 ], [ 193, 195 ], [ 197 ], [ 199, 201 ], [ 203 ], [ 205 ], [ 207 ], [ 213, 215 ], [ 217 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 265 ], [ 267 ], [ 269 ], [ 273 ], [ 275 ], [ 279 ], [ 281 ], [ 285 ], [ 287, 291, 293 ], [ 295 ], [ 297 ] ]
6,597
static bool pmsav7_use_background_region(ARMCPU *cpu, ARMMMUIdx mmu_idx, bool is_user) { /* Return true if we should use the default memory map as a * "background" region if there are no hits against any MPU regions. */ CPUARMState *env = &cpu->env; if (is_user) { return false; } if (arm_feature(env, ARM_FEATURE_M)) { return env->v7m.mpu_ctrl & R_V7M_MPU_CTRL_PRIVDEFENA_MASK; } else { return regime_sctlr(env, mmu_idx) & SCTLR_BR; } }
false
qemu
ecf5e8eae8b0b5fa41f00b53d67747b42fd1b8b9
static bool pmsav7_use_background_region(ARMCPU *cpu, ARMMMUIdx mmu_idx, bool is_user) { CPUARMState *env = &cpu->env; if (is_user) { return false; } if (arm_feature(env, ARM_FEATURE_M)) { return env->v7m.mpu_ctrl & R_V7M_MPU_CTRL_PRIVDEFENA_MASK; } else { return regime_sctlr(env, mmu_idx) & SCTLR_BR; } }
{ "code": [], "line_no": [] }
static bool FUNC_0(ARMCPU *cpu, ARMMMUIdx mmu_idx, bool is_user) { CPUARMState *env = &cpu->env; if (is_user) { return false; } if (arm_feature(env, ARM_FEATURE_M)) { return env->v7m.mpu_ctrl & R_V7M_MPU_CTRL_PRIVDEFENA_MASK; } else { return regime_sctlr(env, mmu_idx) & SCTLR_BR; } }
[ "static bool FUNC_0(ARMCPU *cpu,\nARMMMUIdx mmu_idx, bool is_user)\n{", "CPUARMState *env = &cpu->env;", "if (is_user) {", "return false;", "}", "if (arm_feature(env, ARM_FEATURE_M)) {", "return env->v7m.mpu_ctrl & R_V7M_MPU_CTRL_PRIVDEFENA_MASK;", "} else {", "return regime_sctlr(env, mmu_idx) & SCTLR_BR;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ] ]
6,598
static void rtas_system_reboot(sPAPREnvironment *spapr, uint32_t token, uint32_t nargs, target_ulong args, uint32_t nret, target_ulong rets) { if (nargs != 0 || nret != 1) { rtas_st(rets, 0, -3); return; } qemu_system_reset_request(); rtas_st(rets, 0, 0); }
false
qemu
210b580b106fa798149e28aa13c66b325a43204e
static void rtas_system_reboot(sPAPREnvironment *spapr, uint32_t token, uint32_t nargs, target_ulong args, uint32_t nret, target_ulong rets) { if (nargs != 0 || nret != 1) { rtas_st(rets, 0, -3); return; } qemu_system_reset_request(); rtas_st(rets, 0, 0); }
{ "code": [], "line_no": [] }
static void FUNC_0(sPAPREnvironment *VAR_0, uint32_t VAR_1, uint32_t VAR_2, target_ulong VAR_3, uint32_t VAR_4, target_ulong VAR_5) { if (VAR_2 != 0 || VAR_4 != 1) { rtas_st(VAR_5, 0, -3); return; } qemu_system_reset_request(); rtas_st(VAR_5, 0, 0); }
[ "static void FUNC_0(sPAPREnvironment *VAR_0,\nuint32_t VAR_1, uint32_t VAR_2,\ntarget_ulong VAR_3,\nuint32_t VAR_4, target_ulong VAR_5)\n{", "if (VAR_2 != 0 || VAR_4 != 1) {", "rtas_st(VAR_5, 0, -3);", "return;", "}", "qemu_system_reset_request();", "rtas_st(VAR_5, 0, 0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ] ]
6,599
static int preallocate(BlockDriverState *bs) { uint64_t nb_sectors; uint64_t offset; uint64_t host_offset = 0; int num; int ret; QCowL2Meta *meta; nb_sectors = bdrv_getlength(bs) >> 9; offset = 0; while (nb_sectors) { num = MIN(nb_sectors, INT_MAX >> 9); ret = qcow2_alloc_cluster_offset(bs, offset, &num, &host_offset, &meta); if (ret < 0) { return ret; } ret = qcow2_alloc_cluster_link_l2(bs, meta); if (ret < 0) { qcow2_free_any_clusters(bs, meta->alloc_offset, meta->nb_clusters, QCOW2_DISCARD_NEVER); return ret; } /* There are no dependent requests, but we need to remove our request * from the list of in-flight requests */ if (meta != NULL) { QLIST_REMOVE(meta, next_in_flight); } /* TODO Preallocate data if requested */ nb_sectors -= num; offset += num << 9; } /* * It is expected that the image file is large enough to actually contain * all of the allocated clusters (otherwise we get failing reads after * EOF). Extend the image to the last allocated sector. */ if (host_offset != 0) { uint8_t buf[512]; memset(buf, 0, 512); ret = bdrv_write(bs->file, (host_offset >> 9) + num - 1, buf, 1); if (ret < 0) { return ret; } } return 0; }
false
qemu
7c2bbf4aa66ca5a9fc2ca147e0e6cb6f407a3aa2
static int preallocate(BlockDriverState *bs) { uint64_t nb_sectors; uint64_t offset; uint64_t host_offset = 0; int num; int ret; QCowL2Meta *meta; nb_sectors = bdrv_getlength(bs) >> 9; offset = 0; while (nb_sectors) { num = MIN(nb_sectors, INT_MAX >> 9); ret = qcow2_alloc_cluster_offset(bs, offset, &num, &host_offset, &meta); if (ret < 0) { return ret; } ret = qcow2_alloc_cluster_link_l2(bs, meta); if (ret < 0) { qcow2_free_any_clusters(bs, meta->alloc_offset, meta->nb_clusters, QCOW2_DISCARD_NEVER); return ret; } if (meta != NULL) { QLIST_REMOVE(meta, next_in_flight); } nb_sectors -= num; offset += num << 9; } if (host_offset != 0) { uint8_t buf[512]; memset(buf, 0, 512); ret = bdrv_write(bs->file, (host_offset >> 9) + num - 1, buf, 1); if (ret < 0) { return ret; } } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(BlockDriverState *VAR_0) { uint64_t nb_sectors; uint64_t offset; uint64_t host_offset = 0; int VAR_1; int VAR_2; QCowL2Meta *meta; nb_sectors = bdrv_getlength(VAR_0) >> 9; offset = 0; while (nb_sectors) { VAR_1 = MIN(nb_sectors, INT_MAX >> 9); VAR_2 = qcow2_alloc_cluster_offset(VAR_0, offset, &VAR_1, &host_offset, &meta); if (VAR_2 < 0) { return VAR_2; } VAR_2 = qcow2_alloc_cluster_link_l2(VAR_0, meta); if (VAR_2 < 0) { qcow2_free_any_clusters(VAR_0, meta->alloc_offset, meta->nb_clusters, QCOW2_DISCARD_NEVER); return VAR_2; } if (meta != NULL) { QLIST_REMOVE(meta, next_in_flight); } nb_sectors -= VAR_1; offset += VAR_1 << 9; } if (host_offset != 0) { uint8_t buf[512]; memset(buf, 0, 512); VAR_2 = bdrv_write(VAR_0->file, (host_offset >> 9) + VAR_1 - 1, buf, 1); if (VAR_2 < 0) { return VAR_2; } } return 0; }
[ "static int FUNC_0(BlockDriverState *VAR_0)\n{", "uint64_t nb_sectors;", "uint64_t offset;", "uint64_t host_offset = 0;", "int VAR_1;", "int VAR_2;", "QCowL2Meta *meta;", "nb_sectors = bdrv_getlength(VAR_0) >> 9;", "offset = 0;", "while (nb_sectors) {", "VAR_1 = MIN(nb_sectors, INT_MAX >> 9);", "VAR_2 = qcow2_alloc_cluster_offset(VAR_0, offset, &VAR_1,\n&host_offset, &meta);", "if (VAR_2 < 0) {", "return VAR_2;", "}", "VAR_2 = qcow2_alloc_cluster_link_l2(VAR_0, meta);", "if (VAR_2 < 0) {", "qcow2_free_any_clusters(VAR_0, meta->alloc_offset, meta->nb_clusters,\nQCOW2_DISCARD_NEVER);", "return VAR_2;", "}", "if (meta != NULL) {", "QLIST_REMOVE(meta, next_in_flight);", "}", "nb_sectors -= VAR_1;", "offset += VAR_1 << 9;", "}", "if (host_offset != 0) {", "uint8_t buf[512];", "memset(buf, 0, 512);", "VAR_2 = bdrv_write(VAR_0->file, (host_offset >> 9) + VAR_1 - 1, buf, 1);", "if (VAR_2 < 0) {", "return VAR_2;", "}", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29, 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45, 47 ], [ 49 ], [ 51 ], [ 59 ], [ 61 ], [ 63 ], [ 71 ], [ 73 ], [ 75 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 107 ], [ 109 ] ]
6,600
static int vfio_msix_vector_do_use(PCIDevice *pdev, unsigned int nr, MSIMessage *msg, IOHandler *handler) { VFIOPCIDevice *vdev = DO_UPCAST(VFIOPCIDevice, pdev, pdev); VFIOMSIVector *vector; int ret; trace_vfio_msix_vector_do_use(vdev->vbasedev.name, nr); vector = &vdev->msi_vectors[nr]; if (!vector->use) { vector->vdev = vdev; vector->virq = -1; if (event_notifier_init(&vector->interrupt, 0)) { error_report("vfio: Error: event_notifier_init failed"); } vector->use = true; msix_vector_use(pdev, nr); } qemu_set_fd_handler(event_notifier_get_fd(&vector->interrupt), handler, NULL, vector); /* * Attempt to enable route through KVM irqchip, * default to userspace handling if unavailable. */ if (vector->virq >= 0) { if (!msg) { vfio_remove_kvm_msi_virq(vector); } else { vfio_update_kvm_msi_virq(vector, *msg); } } else { vfio_add_kvm_msi_virq(vector, msg, true); } /* * We don't want to have the host allocate all possible MSI vectors * for a device if they're not in use, so we shutdown and incrementally * increase them as needed. */ if (vdev->nr_vectors < nr + 1) { vfio_disable_irqindex(&vdev->vbasedev, VFIO_PCI_MSIX_IRQ_INDEX); vdev->nr_vectors = nr + 1; ret = vfio_enable_vectors(vdev, true); if (ret) { error_report("vfio: failed to enable vectors, %d", ret); } } else { int argsz; struct vfio_irq_set *irq_set; int32_t *pfd; argsz = sizeof(*irq_set) + sizeof(*pfd); irq_set = g_malloc0(argsz); irq_set->argsz = argsz; irq_set->flags = VFIO_IRQ_SET_DATA_EVENTFD | VFIO_IRQ_SET_ACTION_TRIGGER; irq_set->index = VFIO_PCI_MSIX_IRQ_INDEX; irq_set->start = nr; irq_set->count = 1; pfd = (int32_t *)&irq_set->data; if (vector->virq >= 0) { *pfd = event_notifier_get_fd(&vector->kvm_interrupt); } else { *pfd = event_notifier_get_fd(&vector->interrupt); } ret = ioctl(vdev->vbasedev.fd, VFIO_DEVICE_SET_IRQS, irq_set); g_free(irq_set); if (ret) { error_report("vfio: failed to modify vector, %d", ret); } } return 0; }
false
qemu
46746dbaa8c2c421b9bda78193caad57d7fb1136
static int vfio_msix_vector_do_use(PCIDevice *pdev, unsigned int nr, MSIMessage *msg, IOHandler *handler) { VFIOPCIDevice *vdev = DO_UPCAST(VFIOPCIDevice, pdev, pdev); VFIOMSIVector *vector; int ret; trace_vfio_msix_vector_do_use(vdev->vbasedev.name, nr); vector = &vdev->msi_vectors[nr]; if (!vector->use) { vector->vdev = vdev; vector->virq = -1; if (event_notifier_init(&vector->interrupt, 0)) { error_report("vfio: Error: event_notifier_init failed"); } vector->use = true; msix_vector_use(pdev, nr); } qemu_set_fd_handler(event_notifier_get_fd(&vector->interrupt), handler, NULL, vector); if (vector->virq >= 0) { if (!msg) { vfio_remove_kvm_msi_virq(vector); } else { vfio_update_kvm_msi_virq(vector, *msg); } } else { vfio_add_kvm_msi_virq(vector, msg, true); } if (vdev->nr_vectors < nr + 1) { vfio_disable_irqindex(&vdev->vbasedev, VFIO_PCI_MSIX_IRQ_INDEX); vdev->nr_vectors = nr + 1; ret = vfio_enable_vectors(vdev, true); if (ret) { error_report("vfio: failed to enable vectors, %d", ret); } } else { int argsz; struct vfio_irq_set *irq_set; int32_t *pfd; argsz = sizeof(*irq_set) + sizeof(*pfd); irq_set = g_malloc0(argsz); irq_set->argsz = argsz; irq_set->flags = VFIO_IRQ_SET_DATA_EVENTFD | VFIO_IRQ_SET_ACTION_TRIGGER; irq_set->index = VFIO_PCI_MSIX_IRQ_INDEX; irq_set->start = nr; irq_set->count = 1; pfd = (int32_t *)&irq_set->data; if (vector->virq >= 0) { *pfd = event_notifier_get_fd(&vector->kvm_interrupt); } else { *pfd = event_notifier_get_fd(&vector->interrupt); } ret = ioctl(vdev->vbasedev.fd, VFIO_DEVICE_SET_IRQS, irq_set); g_free(irq_set); if (ret) { error_report("vfio: failed to modify vector, %d", ret); } } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(PCIDevice *VAR_0, unsigned int VAR_1, MSIMessage *VAR_2, IOHandler *VAR_3) { VFIOPCIDevice *vdev = DO_UPCAST(VFIOPCIDevice, VAR_0, VAR_0); VFIOMSIVector *vector; int VAR_4; trace_vfio_msix_vector_do_use(vdev->vbasedev.name, VAR_1); vector = &vdev->msi_vectors[VAR_1]; if (!vector->use) { vector->vdev = vdev; vector->virq = -1; if (event_notifier_init(&vector->interrupt, 0)) { error_report("vfio: Error: event_notifier_init failed"); } vector->use = true; msix_vector_use(VAR_0, VAR_1); } qemu_set_fd_handler(event_notifier_get_fd(&vector->interrupt), VAR_3, NULL, vector); if (vector->virq >= 0) { if (!VAR_2) { vfio_remove_kvm_msi_virq(vector); } else { vfio_update_kvm_msi_virq(vector, *VAR_2); } } else { vfio_add_kvm_msi_virq(vector, VAR_2, true); } if (vdev->nr_vectors < VAR_1 + 1) { vfio_disable_irqindex(&vdev->vbasedev, VFIO_PCI_MSIX_IRQ_INDEX); vdev->nr_vectors = VAR_1 + 1; VAR_4 = vfio_enable_vectors(vdev, true); if (VAR_4) { error_report("vfio: failed to enable vectors, %d", VAR_4); } } else { int VAR_5; struct vfio_irq_set *VAR_6; int32_t *pfd; VAR_5 = sizeof(*VAR_6) + sizeof(*pfd); VAR_6 = g_malloc0(VAR_5); VAR_6->VAR_5 = VAR_5; VAR_6->flags = VFIO_IRQ_SET_DATA_EVENTFD | VFIO_IRQ_SET_ACTION_TRIGGER; VAR_6->index = VFIO_PCI_MSIX_IRQ_INDEX; VAR_6->start = VAR_1; VAR_6->count = 1; pfd = (int32_t *)&VAR_6->data; if (vector->virq >= 0) { *pfd = event_notifier_get_fd(&vector->kvm_interrupt); } else { *pfd = event_notifier_get_fd(&vector->interrupt); } VAR_4 = ioctl(vdev->vbasedev.fd, VFIO_DEVICE_SET_IRQS, VAR_6); g_free(VAR_6); if (VAR_4) { error_report("vfio: failed to modify vector, %d", VAR_4); } } return 0; }
[ "static int FUNC_0(PCIDevice *VAR_0, unsigned int VAR_1,\nMSIMessage *VAR_2, IOHandler *VAR_3)\n{", "VFIOPCIDevice *vdev = DO_UPCAST(VFIOPCIDevice, VAR_0, VAR_0);", "VFIOMSIVector *vector;", "int VAR_4;", "trace_vfio_msix_vector_do_use(vdev->vbasedev.name, VAR_1);", "vector = &vdev->msi_vectors[VAR_1];", "if (!vector->use) {", "vector->vdev = vdev;", "vector->virq = -1;", "if (event_notifier_init(&vector->interrupt, 0)) {", "error_report(\"vfio: Error: event_notifier_init failed\");", "}", "vector->use = true;", "msix_vector_use(VAR_0, VAR_1);", "}", "qemu_set_fd_handler(event_notifier_get_fd(&vector->interrupt),\nVAR_3, NULL, vector);", "if (vector->virq >= 0) {", "if (!VAR_2) {", "vfio_remove_kvm_msi_virq(vector);", "} else {", "vfio_update_kvm_msi_virq(vector, *VAR_2);", "}", "} else {", "vfio_add_kvm_msi_virq(vector, VAR_2, true);", "}", "if (vdev->nr_vectors < VAR_1 + 1) {", "vfio_disable_irqindex(&vdev->vbasedev, VFIO_PCI_MSIX_IRQ_INDEX);", "vdev->nr_vectors = VAR_1 + 1;", "VAR_4 = vfio_enable_vectors(vdev, true);", "if (VAR_4) {", "error_report(\"vfio: failed to enable vectors, %d\", VAR_4);", "}", "} else {", "int VAR_5;", "struct vfio_irq_set *VAR_6;", "int32_t *pfd;", "VAR_5 = sizeof(*VAR_6) + sizeof(*pfd);", "VAR_6 = g_malloc0(VAR_5);", "VAR_6->VAR_5 = VAR_5;", "VAR_6->flags = VFIO_IRQ_SET_DATA_EVENTFD |\nVFIO_IRQ_SET_ACTION_TRIGGER;", "VAR_6->index = VFIO_PCI_MSIX_IRQ_INDEX;", "VAR_6->start = VAR_1;", "VAR_6->count = 1;", "pfd = (int32_t *)&VAR_6->data;", "if (vector->virq >= 0) {", "*pfd = event_notifier_get_fd(&vector->kvm_interrupt);", "} else {", "*pfd = event_notifier_get_fd(&vector->interrupt);", "}", "VAR_4 = ioctl(vdev->vbasedev.fd, VFIO_DEVICE_SET_IRQS, VAR_6);", "g_free(VAR_6);", "if (VAR_4) {", "error_report(\"vfio: failed to modify vector, %d\", VAR_4);", "}", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43, 45 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 111 ], [ 115 ], [ 117 ], [ 119, 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 159 ], [ 161 ] ]
6,601
int virtio_load(VirtIODevice *vdev, QEMUFile *f) { int i, ret; int32_t config_len; uint32_t num; uint32_t features; uint32_t supported_features; BusState *qbus = qdev_get_parent_bus(DEVICE(vdev)); VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus); if (k->load_config) { ret = k->load_config(qbus->parent, f); if (ret) return ret; } qemu_get_8s(f, &vdev->status); qemu_get_8s(f, &vdev->isr); qemu_get_be16s(f, &vdev->queue_sel); if (vdev->queue_sel >= VIRTIO_PCI_QUEUE_MAX) { return -1; } qemu_get_be32s(f, &features); if (virtio_set_features(vdev, features) < 0) { supported_features = k->get_features(qbus->parent); error_report("Features 0x%x unsupported. Allowed features: 0x%x", features, supported_features); return -1; } config_len = qemu_get_be32(f); if (config_len != vdev->config_len) { error_report("Unexpected config length 0x%x. Expected 0x%zx", config_len, vdev->config_len); return -1; } qemu_get_buffer(f, vdev->config, vdev->config_len); num = qemu_get_be32(f); if (num > VIRTIO_PCI_QUEUE_MAX) { error_report("Invalid number of PCI queues: 0x%x", num); return -1; } for (i = 0; i < num; i++) { vdev->vq[i].vring.num = qemu_get_be32(f); if (k->has_variable_vring_alignment) { vdev->vq[i].vring.align = qemu_get_be32(f); } vdev->vq[i].pa = qemu_get_be64(f); qemu_get_be16s(f, &vdev->vq[i].last_avail_idx); vdev->vq[i].signalled_used_valid = false; vdev->vq[i].notification = true; if (vdev->vq[i].pa) { uint16_t nheads; virtqueue_init(&vdev->vq[i]); nheads = vring_avail_idx(&vdev->vq[i]) - vdev->vq[i].last_avail_idx; /* Check it isn't doing very strange things with descriptor numbers. */ if (nheads > vdev->vq[i].vring.num) { error_report("VQ %d size 0x%x Guest index 0x%x " "inconsistent with Host index 0x%x: delta 0x%x", i, vdev->vq[i].vring.num, vring_avail_idx(&vdev->vq[i]), vdev->vq[i].last_avail_idx, nheads); return -1; } } else if (vdev->vq[i].last_avail_idx) { error_report("VQ %d address 0x0 " "inconsistent with Host index 0x%x", i, vdev->vq[i].last_avail_idx); return -1; } if (k->load_queue) { ret = k->load_queue(qbus->parent, i, f); if (ret) return ret; } } virtio_notify_vector(vdev, VIRTIO_NO_VECTOR); return 0; }
false
qemu
2f5732e9648fcddc8759a8fd25c0b41a38352be6
int virtio_load(VirtIODevice *vdev, QEMUFile *f) { int i, ret; int32_t config_len; uint32_t num; uint32_t features; uint32_t supported_features; BusState *qbus = qdev_get_parent_bus(DEVICE(vdev)); VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus); if (k->load_config) { ret = k->load_config(qbus->parent, f); if (ret) return ret; } qemu_get_8s(f, &vdev->status); qemu_get_8s(f, &vdev->isr); qemu_get_be16s(f, &vdev->queue_sel); if (vdev->queue_sel >= VIRTIO_PCI_QUEUE_MAX) { return -1; } qemu_get_be32s(f, &features); if (virtio_set_features(vdev, features) < 0) { supported_features = k->get_features(qbus->parent); error_report("Features 0x%x unsupported. Allowed features: 0x%x", features, supported_features); return -1; } config_len = qemu_get_be32(f); if (config_len != vdev->config_len) { error_report("Unexpected config length 0x%x. Expected 0x%zx", config_len, vdev->config_len); return -1; } qemu_get_buffer(f, vdev->config, vdev->config_len); num = qemu_get_be32(f); if (num > VIRTIO_PCI_QUEUE_MAX) { error_report("Invalid number of PCI queues: 0x%x", num); return -1; } for (i = 0; i < num; i++) { vdev->vq[i].vring.num = qemu_get_be32(f); if (k->has_variable_vring_alignment) { vdev->vq[i].vring.align = qemu_get_be32(f); } vdev->vq[i].pa = qemu_get_be64(f); qemu_get_be16s(f, &vdev->vq[i].last_avail_idx); vdev->vq[i].signalled_used_valid = false; vdev->vq[i].notification = true; if (vdev->vq[i].pa) { uint16_t nheads; virtqueue_init(&vdev->vq[i]); nheads = vring_avail_idx(&vdev->vq[i]) - vdev->vq[i].last_avail_idx; if (nheads > vdev->vq[i].vring.num) { error_report("VQ %d size 0x%x Guest index 0x%x " "inconsistent with Host index 0x%x: delta 0x%x", i, vdev->vq[i].vring.num, vring_avail_idx(&vdev->vq[i]), vdev->vq[i].last_avail_idx, nheads); return -1; } } else if (vdev->vq[i].last_avail_idx) { error_report("VQ %d address 0x0 " "inconsistent with Host index 0x%x", i, vdev->vq[i].last_avail_idx); return -1; } if (k->load_queue) { ret = k->load_queue(qbus->parent, i, f); if (ret) return ret; } } virtio_notify_vector(vdev, VIRTIO_NO_VECTOR); return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(VirtIODevice *VAR_0, QEMUFile *VAR_1) { int VAR_2, VAR_3; int32_t config_len; uint32_t num; uint32_t features; uint32_t supported_features; BusState *qbus = qdev_get_parent_bus(DEVICE(VAR_0)); VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus); if (k->load_config) { VAR_3 = k->load_config(qbus->parent, VAR_1); if (VAR_3) return VAR_3; } qemu_get_8s(VAR_1, &VAR_0->status); qemu_get_8s(VAR_1, &VAR_0->isr); qemu_get_be16s(VAR_1, &VAR_0->queue_sel); if (VAR_0->queue_sel >= VIRTIO_PCI_QUEUE_MAX) { return -1; } qemu_get_be32s(VAR_1, &features); if (virtio_set_features(VAR_0, features) < 0) { supported_features = k->get_features(qbus->parent); error_report("Features 0x%x unsupported. Allowed features: 0x%x", features, supported_features); return -1; } config_len = qemu_get_be32(VAR_1); if (config_len != VAR_0->config_len) { error_report("Unexpected config length 0x%x. Expected 0x%zx", config_len, VAR_0->config_len); return -1; } qemu_get_buffer(VAR_1, VAR_0->config, VAR_0->config_len); num = qemu_get_be32(VAR_1); if (num > VIRTIO_PCI_QUEUE_MAX) { error_report("Invalid number of PCI queues: 0x%x", num); return -1; } for (VAR_2 = 0; VAR_2 < num; VAR_2++) { VAR_0->vq[VAR_2].vring.num = qemu_get_be32(VAR_1); if (k->has_variable_vring_alignment) { VAR_0->vq[VAR_2].vring.align = qemu_get_be32(VAR_1); } VAR_0->vq[VAR_2].pa = qemu_get_be64(VAR_1); qemu_get_be16s(VAR_1, &VAR_0->vq[VAR_2].last_avail_idx); VAR_0->vq[VAR_2].signalled_used_valid = false; VAR_0->vq[VAR_2].notification = true; if (VAR_0->vq[VAR_2].pa) { uint16_t nheads; virtqueue_init(&VAR_0->vq[VAR_2]); nheads = vring_avail_idx(&VAR_0->vq[VAR_2]) - VAR_0->vq[VAR_2].last_avail_idx; if (nheads > VAR_0->vq[VAR_2].vring.num) { error_report("VQ %d size 0x%x Guest index 0x%x " "inconsistent with Host index 0x%x: delta 0x%x", VAR_2, VAR_0->vq[VAR_2].vring.num, vring_avail_idx(&VAR_0->vq[VAR_2]), VAR_0->vq[VAR_2].last_avail_idx, nheads); return -1; } } else if (VAR_0->vq[VAR_2].last_avail_idx) { error_report("VQ %d address 0x0 " "inconsistent with Host index 0x%x", VAR_2, VAR_0->vq[VAR_2].last_avail_idx); return -1; } if (k->load_queue) { VAR_3 = k->load_queue(qbus->parent, VAR_2, VAR_1); if (VAR_3) return VAR_3; } } virtio_notify_vector(VAR_0, VIRTIO_NO_VECTOR); return 0; }
[ "int FUNC_0(VirtIODevice *VAR_0, QEMUFile *VAR_1)\n{", "int VAR_2, VAR_3;", "int32_t config_len;", "uint32_t num;", "uint32_t features;", "uint32_t supported_features;", "BusState *qbus = qdev_get_parent_bus(DEVICE(VAR_0));", "VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus);", "if (k->load_config) {", "VAR_3 = k->load_config(qbus->parent, VAR_1);", "if (VAR_3)\nreturn VAR_3;", "}", "qemu_get_8s(VAR_1, &VAR_0->status);", "qemu_get_8s(VAR_1, &VAR_0->isr);", "qemu_get_be16s(VAR_1, &VAR_0->queue_sel);", "if (VAR_0->queue_sel >= VIRTIO_PCI_QUEUE_MAX) {", "return -1;", "}", "qemu_get_be32s(VAR_1, &features);", "if (virtio_set_features(VAR_0, features) < 0) {", "supported_features = k->get_features(qbus->parent);", "error_report(\"Features 0x%x unsupported. Allowed features: 0x%x\",\nfeatures, supported_features);", "return -1;", "}", "config_len = qemu_get_be32(VAR_1);", "if (config_len != VAR_0->config_len) {", "error_report(\"Unexpected config length 0x%x. Expected 0x%zx\",\nconfig_len, VAR_0->config_len);", "return -1;", "}", "qemu_get_buffer(VAR_1, VAR_0->config, VAR_0->config_len);", "num = qemu_get_be32(VAR_1);", "if (num > VIRTIO_PCI_QUEUE_MAX) {", "error_report(\"Invalid number of PCI queues: 0x%x\", num);", "return -1;", "}", "for (VAR_2 = 0; VAR_2 < num; VAR_2++) {", "VAR_0->vq[VAR_2].vring.num = qemu_get_be32(VAR_1);", "if (k->has_variable_vring_alignment) {", "VAR_0->vq[VAR_2].vring.align = qemu_get_be32(VAR_1);", "}", "VAR_0->vq[VAR_2].pa = qemu_get_be64(VAR_1);", "qemu_get_be16s(VAR_1, &VAR_0->vq[VAR_2].last_avail_idx);", "VAR_0->vq[VAR_2].signalled_used_valid = false;", "VAR_0->vq[VAR_2].notification = true;", "if (VAR_0->vq[VAR_2].pa) {", "uint16_t nheads;", "virtqueue_init(&VAR_0->vq[VAR_2]);", "nheads = vring_avail_idx(&VAR_0->vq[VAR_2]) - VAR_0->vq[VAR_2].last_avail_idx;", "if (nheads > VAR_0->vq[VAR_2].vring.num) {", "error_report(\"VQ %d size 0x%x Guest index 0x%x \"\n\"inconsistent with Host index 0x%x: delta 0x%x\",\nVAR_2, VAR_0->vq[VAR_2].vring.num,\nvring_avail_idx(&VAR_0->vq[VAR_2]),\nVAR_0->vq[VAR_2].last_avail_idx, nheads);", "return -1;", "}", "} else if (VAR_0->vq[VAR_2].last_avail_idx) {", "error_report(\"VQ %d address 0x0 \"\n\"inconsistent with Host index 0x%x\",\nVAR_2, VAR_0->vq[VAR_2].last_avail_idx);", "return -1;", "}", "if (k->load_queue) {", "VAR_3 = k->load_queue(qbus->parent, VAR_2, VAR_1);", "if (VAR_3)\nreturn VAR_3;", "}", "}", "virtio_notify_vector(VAR_0, VIRTIO_NO_VECTOR);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53, 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65, 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 121 ], [ 123, 125, 127, 129, 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139, 141, 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153, 155 ], [ 157 ], [ 159 ], [ 163 ], [ 165 ], [ 167 ] ]
6,602
static int pci_vmsvga_initfn(PCIDevice *dev) { struct pci_vmsvga_state_s *s = DO_UPCAST(struct pci_vmsvga_state_s, card, dev); pci_config_set_vendor_id(s->card.config, PCI_VENDOR_ID_VMWARE); pci_config_set_device_id(s->card.config, SVGA_PCI_DEVICE_ID); pci_config_set_class(s->card.config, PCI_CLASS_DISPLAY_VGA); s->card.config[PCI_CACHE_LINE_SIZE] = 0x08; /* Cache line size */ s->card.config[PCI_LATENCY_TIMER] = 0x40; /* Latency timer */ s->card.config[PCI_SUBSYSTEM_VENDOR_ID] = PCI_VENDOR_ID_VMWARE & 0xff; s->card.config[PCI_SUBSYSTEM_VENDOR_ID + 1] = PCI_VENDOR_ID_VMWARE >> 8; s->card.config[PCI_SUBSYSTEM_ID] = SVGA_PCI_DEVICE_ID & 0xff; s->card.config[PCI_SUBSYSTEM_ID + 1] = SVGA_PCI_DEVICE_ID >> 8; s->card.config[PCI_INTERRUPT_LINE] = 0xff; /* End */ pci_register_bar(&s->card, 0, 0x10, PCI_BASE_ADDRESS_SPACE_IO, pci_vmsvga_map_ioport); pci_register_bar(&s->card, 1, VGA_RAM_SIZE, PCI_BASE_ADDRESS_MEM_PREFETCH, pci_vmsvga_map_mem); pci_register_bar(&s->card, 2, SVGA_FIFO_SIZE, PCI_BASE_ADDRESS_MEM_PREFETCH, pci_vmsvga_map_fifo); vmsvga_init(&s->chip, VGA_RAM_SIZE); if (!dev->rom_bar) { /* compatibility with pc-0.13 and older */ vga_init_vbe(&s->chip.vga); } return 0; }
false
qemu
310faaede80a2eb270a021a26183d6afbde81180
static int pci_vmsvga_initfn(PCIDevice *dev) { struct pci_vmsvga_state_s *s = DO_UPCAST(struct pci_vmsvga_state_s, card, dev); pci_config_set_vendor_id(s->card.config, PCI_VENDOR_ID_VMWARE); pci_config_set_device_id(s->card.config, SVGA_PCI_DEVICE_ID); pci_config_set_class(s->card.config, PCI_CLASS_DISPLAY_VGA); s->card.config[PCI_CACHE_LINE_SIZE] = 0x08; s->card.config[PCI_LATENCY_TIMER] = 0x40; s->card.config[PCI_SUBSYSTEM_VENDOR_ID] = PCI_VENDOR_ID_VMWARE & 0xff; s->card.config[PCI_SUBSYSTEM_VENDOR_ID + 1] = PCI_VENDOR_ID_VMWARE >> 8; s->card.config[PCI_SUBSYSTEM_ID] = SVGA_PCI_DEVICE_ID & 0xff; s->card.config[PCI_SUBSYSTEM_ID + 1] = SVGA_PCI_DEVICE_ID >> 8; s->card.config[PCI_INTERRUPT_LINE] = 0xff; pci_register_bar(&s->card, 0, 0x10, PCI_BASE_ADDRESS_SPACE_IO, pci_vmsvga_map_ioport); pci_register_bar(&s->card, 1, VGA_RAM_SIZE, PCI_BASE_ADDRESS_MEM_PREFETCH, pci_vmsvga_map_mem); pci_register_bar(&s->card, 2, SVGA_FIFO_SIZE, PCI_BASE_ADDRESS_MEM_PREFETCH, pci_vmsvga_map_fifo); vmsvga_init(&s->chip, VGA_RAM_SIZE); if (!dev->rom_bar) { vga_init_vbe(&s->chip.vga); } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(PCIDevice *VAR_0) { struct pci_vmsvga_state_s *VAR_1 = DO_UPCAST(struct pci_vmsvga_state_s, card, VAR_0); pci_config_set_vendor_id(VAR_1->card.config, PCI_VENDOR_ID_VMWARE); pci_config_set_device_id(VAR_1->card.config, SVGA_PCI_DEVICE_ID); pci_config_set_class(VAR_1->card.config, PCI_CLASS_DISPLAY_VGA); VAR_1->card.config[PCI_CACHE_LINE_SIZE] = 0x08; VAR_1->card.config[PCI_LATENCY_TIMER] = 0x40; VAR_1->card.config[PCI_SUBSYSTEM_VENDOR_ID] = PCI_VENDOR_ID_VMWARE & 0xff; VAR_1->card.config[PCI_SUBSYSTEM_VENDOR_ID + 1] = PCI_VENDOR_ID_VMWARE >> 8; VAR_1->card.config[PCI_SUBSYSTEM_ID] = SVGA_PCI_DEVICE_ID & 0xff; VAR_1->card.config[PCI_SUBSYSTEM_ID + 1] = SVGA_PCI_DEVICE_ID >> 8; VAR_1->card.config[PCI_INTERRUPT_LINE] = 0xff; pci_register_bar(&VAR_1->card, 0, 0x10, PCI_BASE_ADDRESS_SPACE_IO, pci_vmsvga_map_ioport); pci_register_bar(&VAR_1->card, 1, VGA_RAM_SIZE, PCI_BASE_ADDRESS_MEM_PREFETCH, pci_vmsvga_map_mem); pci_register_bar(&VAR_1->card, 2, SVGA_FIFO_SIZE, PCI_BASE_ADDRESS_MEM_PREFETCH, pci_vmsvga_map_fifo); vmsvga_init(&VAR_1->chip, VGA_RAM_SIZE); if (!VAR_0->rom_bar) { vga_init_vbe(&VAR_1->chip.vga); } return 0; }
[ "static int FUNC_0(PCIDevice *VAR_0)\n{", "struct pci_vmsvga_state_s *VAR_1 =\nDO_UPCAST(struct pci_vmsvga_state_s, card, VAR_0);", "pci_config_set_vendor_id(VAR_1->card.config, PCI_VENDOR_ID_VMWARE);", "pci_config_set_device_id(VAR_1->card.config, SVGA_PCI_DEVICE_ID);", "pci_config_set_class(VAR_1->card.config, PCI_CLASS_DISPLAY_VGA);", "VAR_1->card.config[PCI_CACHE_LINE_SIZE]\t= 0x08;", "VAR_1->card.config[PCI_LATENCY_TIMER] = 0x40;", "VAR_1->card.config[PCI_SUBSYSTEM_VENDOR_ID] = PCI_VENDOR_ID_VMWARE & 0xff;", "VAR_1->card.config[PCI_SUBSYSTEM_VENDOR_ID + 1]\t= PCI_VENDOR_ID_VMWARE >> 8;", "VAR_1->card.config[PCI_SUBSYSTEM_ID] = SVGA_PCI_DEVICE_ID & 0xff;", "VAR_1->card.config[PCI_SUBSYSTEM_ID + 1] = SVGA_PCI_DEVICE_ID >> 8;", "VAR_1->card.config[PCI_INTERRUPT_LINE] = 0xff;", "pci_register_bar(&VAR_1->card, 0, 0x10,\nPCI_BASE_ADDRESS_SPACE_IO, pci_vmsvga_map_ioport);", "pci_register_bar(&VAR_1->card, 1, VGA_RAM_SIZE,\nPCI_BASE_ADDRESS_MEM_PREFETCH, pci_vmsvga_map_mem);", "pci_register_bar(&VAR_1->card, 2, SVGA_FIFO_SIZE,\nPCI_BASE_ADDRESS_MEM_PREFETCH, pci_vmsvga_map_fifo);", "vmsvga_init(&VAR_1->chip, VGA_RAM_SIZE);", "if (!VAR_0->rom_bar) {", "vga_init_vbe(&VAR_1->chip.vga);", "}", "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 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33, 35 ], [ 37, 39 ], [ 43, 45 ], [ 49 ], [ 53 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ] ]
6,603
static int qed_read_table(BDRVQEDState *s, uint64_t offset, QEDTable *table) { QEMUIOVector qiov; int noffsets; int i, ret; struct iovec iov = { .iov_base = table->offsets, .iov_len = s->header.cluster_size * s->header.table_size, }; qemu_iovec_init_external(&qiov, &iov, 1); trace_qed_read_table(s, offset, table); ret = bdrv_preadv(s->bs->file, offset, &qiov); if (ret < 0) { goto out; } /* Byteswap offsets */ qed_acquire(s); noffsets = qiov.size / sizeof(uint64_t); for (i = 0; i < noffsets; i++) { table->offsets[i] = le64_to_cpu(table->offsets[i]); } qed_release(s); ret = 0; out: /* Completion */ trace_qed_read_table_cb(s, table, ret); return ret; }
false
qemu
1f01e50b8330c24714ddca5841fdbb703076b121
static int qed_read_table(BDRVQEDState *s, uint64_t offset, QEDTable *table) { QEMUIOVector qiov; int noffsets; int i, ret; struct iovec iov = { .iov_base = table->offsets, .iov_len = s->header.cluster_size * s->header.table_size, }; qemu_iovec_init_external(&qiov, &iov, 1); trace_qed_read_table(s, offset, table); ret = bdrv_preadv(s->bs->file, offset, &qiov); if (ret < 0) { goto out; } qed_acquire(s); noffsets = qiov.size / sizeof(uint64_t); for (i = 0; i < noffsets; i++) { table->offsets[i] = le64_to_cpu(table->offsets[i]); } qed_release(s); ret = 0; out: trace_qed_read_table_cb(s, table, ret); return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(BDRVQEDState *VAR_0, uint64_t VAR_1, QEDTable *VAR_2) { QEMUIOVector qiov; int VAR_3; int VAR_4, VAR_5; struct iovec VAR_6 = { .iov_base = VAR_2->offsets, .iov_len = VAR_0->header.cluster_size * VAR_0->header.table_size, }; qemu_iovec_init_external(&qiov, &VAR_6, 1); trace_qed_read_table(VAR_0, VAR_1, VAR_2); VAR_5 = bdrv_preadv(VAR_0->bs->file, VAR_1, &qiov); if (VAR_5 < 0) { goto out; } qed_acquire(VAR_0); VAR_3 = qiov.size / sizeof(uint64_t); for (VAR_4 = 0; VAR_4 < VAR_3; VAR_4++) { VAR_2->offsets[VAR_4] = le64_to_cpu(VAR_2->offsets[VAR_4]); } qed_release(VAR_0); VAR_5 = 0; out: trace_qed_read_table_cb(VAR_0, VAR_2, VAR_5); return VAR_5; }
[ "static int FUNC_0(BDRVQEDState *VAR_0, uint64_t VAR_1, QEDTable *VAR_2)\n{", "QEMUIOVector qiov;", "int VAR_3;", "int VAR_4, VAR_5;", "struct iovec VAR_6 = {", ".iov_base = VAR_2->offsets,\n.iov_len = VAR_0->header.cluster_size * VAR_0->header.table_size,\n};", "qemu_iovec_init_external(&qiov, &VAR_6, 1);", "trace_qed_read_table(VAR_0, VAR_1, VAR_2);", "VAR_5 = bdrv_preadv(VAR_0->bs->file, VAR_1, &qiov);", "if (VAR_5 < 0) {", "goto out;", "}", "qed_acquire(VAR_0);", "VAR_3 = qiov.size / sizeof(uint64_t);", "for (VAR_4 = 0; VAR_4 < VAR_3; VAR_4++) {", "VAR_2->offsets[VAR_4] = le64_to_cpu(VAR_2->offsets[VAR_4]);", "}", "qed_release(VAR_0);", "VAR_5 = 0;", "out:\ntrace_qed_read_table_cb(VAR_0, VAR_2, VAR_5);", "return VAR_5;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15, 17, 19 ], [ 21 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57, 61 ], [ 63 ], [ 65 ] ]
6,604
long do_sigreturn(CPUState *env) { struct target_signal_frame *sf; uint32_t up_psr, pc, npc; target_sigset_t set; sigset_t host_set; abi_ulong fpu_save; int err, i; sf = (struct target_signal_frame *)g2h(env->regwptr[UREG_FP]); #if 0 fprintf(stderr, "sigreturn\n"); fprintf(stderr, "sf: %x pc %x fp %x sp %x\n", sf, env->pc, env->regwptr[UREG_FP], env->regwptr[UREG_SP]); #endif //cpu_dump_state(env, stderr, fprintf, 0); /* 1. Make sure we are not getting garbage from the user */ #if 0 if (verify_area (VERIFY_READ, sf, sizeof (*sf))) goto segv_and_exit; #endif if (((uint) sf) & 3) goto segv_and_exit; err = __get_user(pc, &sf->info.si_regs.pc); err |= __get_user(npc, &sf->info.si_regs.npc); if ((pc | npc) & 3) goto segv_and_exit; /* 2. Restore the state */ err |= __get_user(up_psr, &sf->info.si_regs.psr); /* User can only change condition codes and FPU enabling in %psr. */ env->psr = (up_psr & (PSR_ICC /* | PSR_EF */)) | (env->psr & ~(PSR_ICC /* | PSR_EF */)); env->pc = pc; env->npc = npc; err |= __get_user(env->y, &sf->info.si_regs.y); for (i=0; i < 8; i++) { err |= __get_user(env->gregs[i], &sf->info.si_regs.u_regs[i]); } for (i=0; i < 8; i++) { err |= __get_user(env->regwptr[i + UREG_I0], &sf->info.si_regs.u_regs[i+8]); } err |= __get_user(fpu_save, (abi_ulong *)&sf->fpu_save); //if (fpu_save) // err |= restore_fpu_state(env, fpu_save); /* This is pretty much atomic, no amount locking would prevent * the races which exist anyways. */ err |= __get_user(set.sig[0], &sf->info.si_mask); for(i = 1; i < TARGET_NSIG_WORDS; i++) { err |= (__get_user(set.sig[i], &sf->extramask[i - 1])); } target_to_host_sigset_internal(&host_set, &set); sigprocmask(SIG_SETMASK, &host_set, NULL); if (err) goto segv_and_exit; return env->regwptr[0]; segv_and_exit: force_sig(TARGET_SIGSEGV); }
false
qemu
f8b0aa25599782eef91edc00ebf620bd14db720c
long do_sigreturn(CPUState *env) { struct target_signal_frame *sf; uint32_t up_psr, pc, npc; target_sigset_t set; sigset_t host_set; abi_ulong fpu_save; int err, i; sf = (struct target_signal_frame *)g2h(env->regwptr[UREG_FP]); #if 0 fprintf(stderr, "sigreturn\n"); fprintf(stderr, "sf: %x pc %x fp %x sp %x\n", sf, env->pc, env->regwptr[UREG_FP], env->regwptr[UREG_SP]); #endif #if 0 if (verify_area (VERIFY_READ, sf, sizeof (*sf))) goto segv_and_exit; #endif if (((uint) sf) & 3) goto segv_and_exit; err = __get_user(pc, &sf->info.si_regs.pc); err |= __get_user(npc, &sf->info.si_regs.npc); if ((pc | npc) & 3) goto segv_and_exit; err |= __get_user(up_psr, &sf->info.si_regs.psr); env->psr = (up_psr & (PSR_ICC )) | (env->psr & ~(PSR_ICC )); env->pc = pc; env->npc = npc; err |= __get_user(env->y, &sf->info.si_regs.y); for (i=0; i < 8; i++) { err |= __get_user(env->gregs[i], &sf->info.si_regs.u_regs[i]); } for (i=0; i < 8; i++) { err |= __get_user(env->regwptr[i + UREG_I0], &sf->info.si_regs.u_regs[i+8]); } err |= __get_user(fpu_save, (abi_ulong *)&sf->fpu_save); err |= __get_user(set.sig[0], &sf->info.si_mask); for(i = 1; i < TARGET_NSIG_WORDS; i++) { err |= (__get_user(set.sig[i], &sf->extramask[i - 1])); } target_to_host_sigset_internal(&host_set, &set); sigprocmask(SIG_SETMASK, &host_set, NULL); if (err) goto segv_and_exit; return env->regwptr[0]; segv_and_exit: force_sig(TARGET_SIGSEGV); }
{ "code": [], "line_no": [] }
long FUNC_0(CPUState *VAR_0) { struct target_signal_frame *VAR_1; uint32_t up_psr, pc, npc; target_sigset_t set; sigset_t host_set; abi_ulong fpu_save; int VAR_2, VAR_3; VAR_1 = (struct target_signal_frame *)g2h(VAR_0->regwptr[UREG_FP]); #if 0 fprintf(stderr, "sigreturn\n"); fprintf(stderr, "VAR_1: %x pc %x fp %x sp %x\n", VAR_1, VAR_0->pc, VAR_0->regwptr[UREG_FP], VAR_0->regwptr[UREG_SP]); #endif #if 0 if (verify_area (VERIFY_READ, VAR_1, sizeof (*VAR_1))) goto segv_and_exit; #endif if (((uint) VAR_1) & 3) goto segv_and_exit; VAR_2 = __get_user(pc, &VAR_1->info.si_regs.pc); VAR_2 |= __get_user(npc, &VAR_1->info.si_regs.npc); if ((pc | npc) & 3) goto segv_and_exit; VAR_2 |= __get_user(up_psr, &VAR_1->info.si_regs.psr); VAR_0->psr = (up_psr & (PSR_ICC )) | (VAR_0->psr & ~(PSR_ICC )); VAR_0->pc = pc; VAR_0->npc = npc; VAR_2 |= __get_user(VAR_0->y, &VAR_1->info.si_regs.y); for (VAR_3=0; VAR_3 < 8; VAR_3++) { VAR_2 |= __get_user(VAR_0->gregs[VAR_3], &VAR_1->info.si_regs.u_regs[VAR_3]); } for (VAR_3=0; VAR_3 < 8; VAR_3++) { VAR_2 |= __get_user(VAR_0->regwptr[VAR_3 + UREG_I0], &VAR_1->info.si_regs.u_regs[VAR_3+8]); } VAR_2 |= __get_user(fpu_save, (abi_ulong *)&VAR_1->fpu_save); VAR_2 |= __get_user(set.sig[0], &VAR_1->info.si_mask); for(VAR_3 = 1; VAR_3 < TARGET_NSIG_WORDS; VAR_3++) { VAR_2 |= (__get_user(set.sig[VAR_3], &VAR_1->extramask[VAR_3 - 1])); } target_to_host_sigset_internal(&host_set, &set); sigprocmask(SIG_SETMASK, &host_set, NULL); if (VAR_2) goto segv_and_exit; return VAR_0->regwptr[0]; segv_and_exit: force_sig(TARGET_SIGSEGV); }
[ "long FUNC_0(CPUState *VAR_0)\n{", "struct target_signal_frame *VAR_1;", "uint32_t up_psr, pc, npc;", "target_sigset_t set;", "sigset_t host_set;", "abi_ulong fpu_save;", "int VAR_2, VAR_3;", "VAR_1 = (struct target_signal_frame *)g2h(VAR_0->regwptr[UREG_FP]);", "#if 0\nfprintf(stderr, \"sigreturn\\n\");", "fprintf(stderr, \"VAR_1: %x pc %x fp %x sp %x\\n\", VAR_1, VAR_0->pc, VAR_0->regwptr[UREG_FP], VAR_0->regwptr[UREG_SP]);", "#endif\n#if 0\nif (verify_area (VERIFY_READ, VAR_1, sizeof (*VAR_1)))\ngoto segv_and_exit;", "#endif\nif (((uint) VAR_1) & 3)\ngoto segv_and_exit;", "VAR_2 = __get_user(pc, &VAR_1->info.si_regs.pc);", "VAR_2 |= __get_user(npc, &VAR_1->info.si_regs.npc);", "if ((pc | npc) & 3)\ngoto segv_and_exit;", "VAR_2 |= __get_user(up_psr, &VAR_1->info.si_regs.psr);", "VAR_0->psr = (up_psr & (PSR_ICC ))\n| (VAR_0->psr & ~(PSR_ICC ));", "VAR_0->pc = pc;", "VAR_0->npc = npc;", "VAR_2 |= __get_user(VAR_0->y, &VAR_1->info.si_regs.y);", "for (VAR_3=0; VAR_3 < 8; VAR_3++) {", "VAR_2 |= __get_user(VAR_0->gregs[VAR_3], &VAR_1->info.si_regs.u_regs[VAR_3]);", "}", "for (VAR_3=0; VAR_3 < 8; VAR_3++) {", "VAR_2 |= __get_user(VAR_0->regwptr[VAR_3 + UREG_I0], &VAR_1->info.si_regs.u_regs[VAR_3+8]);", "}", "VAR_2 |= __get_user(fpu_save, (abi_ulong *)&VAR_1->fpu_save);", "VAR_2 |= __get_user(set.sig[0], &VAR_1->info.si_mask);", "for(VAR_3 = 1; VAR_3 < TARGET_NSIG_WORDS; VAR_3++) {", "VAR_2 |= (__get_user(set.sig[VAR_3], &VAR_1->extramask[VAR_3 - 1]));", "}", "target_to_host_sigset_internal(&host_set, &set);", "sigprocmask(SIG_SETMASK, &host_set, NULL);", "if (VAR_2)\ngoto segv_and_exit;", "return VAR_0->regwptr[0];", "segv_and_exit:\nforce_sig(TARGET_SIGSEGV);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21, 23 ], [ 25 ], [ 27, 35, 37, 39 ], [ 41, 45, 47 ], [ 51 ], [ 53 ], [ 57, 59 ], [ 65 ], [ 71, 73 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 97 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 123 ], [ 125 ], [ 129, 131 ], [ 135 ], [ 139, 141 ], [ 143 ] ]
6,606
int cpu_exec(CPUState *cpu) { CPUClass *cc = CPU_GET_CLASS(cpu); #ifdef TARGET_I386 X86CPU *x86_cpu = X86_CPU(cpu); CPUArchState *env = &x86_cpu->env; #endif int ret, interrupt_request; TranslationBlock *tb; uint8_t *tc_ptr; uintptr_t next_tb; SyncClocks sc; if (cpu->halted) { #if defined(TARGET_I386) && !defined(CONFIG_USER_ONLY) if (cpu->interrupt_request & CPU_INTERRUPT_POLL) { apic_poll_irq(x86_cpu->apic_state); cpu_reset_interrupt(cpu, CPU_INTERRUPT_POLL); } #endif if (!cpu_has_work(cpu)) { return EXCP_HALTED; } cpu->halted = 0; } current_cpu = cpu; atomic_mb_set(&tcg_current_cpu, cpu); rcu_read_lock(); if (unlikely(atomic_mb_read(&exit_request))) { cpu->exit_request = 1; } cc->cpu_exec_enter(cpu); /* Calculate difference between guest clock and host clock. * This delay includes the delay of the last cycle, so * what we have to do is sleep until it is 0. As for the * advance/delay we gain here, we try to fix it next time. */ init_delay_params(&sc, cpu); /* prepare setjmp context for exception handling */ for(;;) { if (sigsetjmp(cpu->jmp_env, 0) == 0) { /* if an exception is pending, we execute it here */ if (cpu->exception_index >= 0) { if (cpu->exception_index >= EXCP_INTERRUPT) { /* exit request from the cpu execution loop */ ret = cpu->exception_index; if (ret == EXCP_DEBUG) { cpu_handle_debug_exception(cpu); } cpu->exception_index = -1; break; } else { #if defined(CONFIG_USER_ONLY) /* if user mode only, we simulate a fake exception which will be handled outside the cpu execution loop */ #if defined(TARGET_I386) cc->do_interrupt(cpu); #endif ret = cpu->exception_index; cpu->exception_index = -1; break; #else cc->do_interrupt(cpu); cpu->exception_index = -1; #endif } } next_tb = 0; /* force lookup of first TB */ for(;;) { interrupt_request = cpu->interrupt_request; if (unlikely(interrupt_request)) { if (unlikely(cpu->singlestep_enabled & SSTEP_NOIRQ)) { /* Mask out external interrupts for this step. */ interrupt_request &= ~CPU_INTERRUPT_SSTEP_MASK; } if (interrupt_request & CPU_INTERRUPT_DEBUG) { cpu->interrupt_request &= ~CPU_INTERRUPT_DEBUG; cpu->exception_index = EXCP_DEBUG; cpu_loop_exit(cpu); } if (interrupt_request & CPU_INTERRUPT_HALT) { cpu->interrupt_request &= ~CPU_INTERRUPT_HALT; cpu->halted = 1; cpu->exception_index = EXCP_HLT; cpu_loop_exit(cpu); } #if defined(TARGET_I386) if (interrupt_request & CPU_INTERRUPT_INIT) { cpu_svm_check_intercept_param(env, SVM_EXIT_INIT, 0); do_cpu_init(x86_cpu); cpu->exception_index = EXCP_HALTED; cpu_loop_exit(cpu); } #else if (interrupt_request & CPU_INTERRUPT_RESET) { cpu_reset(cpu); } #endif /* The target hook has 3 exit conditions: False when the interrupt isn't processed, True when it is, and we should restart on a new TB, and via longjmp via cpu_loop_exit. */ if (cc->cpu_exec_interrupt(cpu, interrupt_request)) { next_tb = 0; } /* Don't use the cached interrupt_request value, do_interrupt may have updated the EXITTB flag. */ if (cpu->interrupt_request & CPU_INTERRUPT_EXITTB) { cpu->interrupt_request &= ~CPU_INTERRUPT_EXITTB; /* ensure that no TB jump will be modified as the program flow was changed */ next_tb = 0; } } if (unlikely(cpu->exit_request)) { cpu->exit_request = 0; cpu->exception_index = EXCP_INTERRUPT; cpu_loop_exit(cpu); } tb_lock(); tb = tb_find_fast(cpu); /* Note: we do it here to avoid a gcc bug on Mac OS X when doing it in tb_find_slow */ if (tcg_ctx.tb_ctx.tb_invalidated_flag) { /* as some TB could have been invalidated because of memory exceptions while generating the code, we must recompute the hash index here */ next_tb = 0; tcg_ctx.tb_ctx.tb_invalidated_flag = 0; } if (qemu_loglevel_mask(CPU_LOG_EXEC)) { qemu_log("Trace %p [" TARGET_FMT_lx "] %s\n", tb->tc_ptr, tb->pc, lookup_symbol(tb->pc)); } /* see if we can patch the calling TB. When the TB spans two pages, we cannot safely do a direct jump. */ if (next_tb != 0 && tb->page_addr[1] == -1 && !qemu_loglevel_mask(CPU_LOG_TB_NOCHAIN)) { tb_add_jump((TranslationBlock *)(next_tb & ~TB_EXIT_MASK), next_tb & TB_EXIT_MASK, tb); } tb_unlock(); if (likely(!cpu->exit_request)) { trace_exec_tb(tb, tb->pc); tc_ptr = tb->tc_ptr; /* execute the generated code */ cpu->current_tb = tb; next_tb = cpu_tb_exec(cpu, tc_ptr); cpu->current_tb = NULL; switch (next_tb & TB_EXIT_MASK) { case TB_EXIT_REQUESTED: /* Something asked us to stop executing * chained TBs; just continue round the main * loop. Whatever requested the exit will also * have set something else (eg exit_request or * interrupt_request) which we will handle * next time around the loop. But we need to * ensure the tcg_exit_req read in generated code * comes before the next read of cpu->exit_request * or cpu->interrupt_request. */ smp_rmb(); next_tb = 0; break; case TB_EXIT_ICOUNT_EXPIRED: { /* Instruction counter expired. */ int insns_left = cpu->icount_decr.u32; if (cpu->icount_extra && insns_left >= 0) { /* Refill decrementer and continue execution. */ cpu->icount_extra += insns_left; insns_left = MIN(0xffff, cpu->icount_extra); cpu->icount_extra -= insns_left; cpu->icount_decr.u16.low = insns_left; } else { if (insns_left > 0) { /* Execute remaining instructions. */ tb = (TranslationBlock *)(next_tb & ~TB_EXIT_MASK); cpu_exec_nocache(cpu, insns_left, tb); align_clocks(&sc, cpu); } cpu->exception_index = EXCP_INTERRUPT; next_tb = 0; cpu_loop_exit(cpu); } break; } default: break; } } /* Try to align the host and virtual clocks if the guest is in advance */ align_clocks(&sc, cpu); /* reset soft MMU for next block (it can currently only be set by a memory fault) */ } /* for(;;) */ } else { /* Reload env after longjmp - the compiler may have smashed all * local variables as longjmp is marked 'noreturn'. */ cpu = current_cpu; cc = CPU_GET_CLASS(cpu); cpu->can_do_io = 1; #ifdef TARGET_I386 x86_cpu = X86_CPU(cpu); env = &x86_cpu->env; #endif tb_lock_reset(); } } /* for(;;) */ cc->cpu_exec_exit(cpu); rcu_read_unlock(); /* fail safe : never use current_cpu outside cpu_exec() */ current_cpu = NULL; /* Does not need atomic_mb_set because a spurious wakeup is okay. */ atomic_set(&tcg_current_cpu, NULL); return ret; }
false
qemu
56c0269a9ec105d3848d9f900b5e38e6b35e2478
int cpu_exec(CPUState *cpu) { CPUClass *cc = CPU_GET_CLASS(cpu); #ifdef TARGET_I386 X86CPU *x86_cpu = X86_CPU(cpu); CPUArchState *env = &x86_cpu->env; #endif int ret, interrupt_request; TranslationBlock *tb; uint8_t *tc_ptr; uintptr_t next_tb; SyncClocks sc; if (cpu->halted) { #if defined(TARGET_I386) && !defined(CONFIG_USER_ONLY) if (cpu->interrupt_request & CPU_INTERRUPT_POLL) { apic_poll_irq(x86_cpu->apic_state); cpu_reset_interrupt(cpu, CPU_INTERRUPT_POLL); } #endif if (!cpu_has_work(cpu)) { return EXCP_HALTED; } cpu->halted = 0; } current_cpu = cpu; atomic_mb_set(&tcg_current_cpu, cpu); rcu_read_lock(); if (unlikely(atomic_mb_read(&exit_request))) { cpu->exit_request = 1; } cc->cpu_exec_enter(cpu); init_delay_params(&sc, cpu); for(;;) { if (sigsetjmp(cpu->jmp_env, 0) == 0) { if (cpu->exception_index >= 0) { if (cpu->exception_index >= EXCP_INTERRUPT) { ret = cpu->exception_index; if (ret == EXCP_DEBUG) { cpu_handle_debug_exception(cpu); } cpu->exception_index = -1; break; } else { #if defined(CONFIG_USER_ONLY) #if defined(TARGET_I386) cc->do_interrupt(cpu); #endif ret = cpu->exception_index; cpu->exception_index = -1; break; #else cc->do_interrupt(cpu); cpu->exception_index = -1; #endif } } next_tb = 0; for(;;) { interrupt_request = cpu->interrupt_request; if (unlikely(interrupt_request)) { if (unlikely(cpu->singlestep_enabled & SSTEP_NOIRQ)) { interrupt_request &= ~CPU_INTERRUPT_SSTEP_MASK; } if (interrupt_request & CPU_INTERRUPT_DEBUG) { cpu->interrupt_request &= ~CPU_INTERRUPT_DEBUG; cpu->exception_index = EXCP_DEBUG; cpu_loop_exit(cpu); } if (interrupt_request & CPU_INTERRUPT_HALT) { cpu->interrupt_request &= ~CPU_INTERRUPT_HALT; cpu->halted = 1; cpu->exception_index = EXCP_HLT; cpu_loop_exit(cpu); } #if defined(TARGET_I386) if (interrupt_request & CPU_INTERRUPT_INIT) { cpu_svm_check_intercept_param(env, SVM_EXIT_INIT, 0); do_cpu_init(x86_cpu); cpu->exception_index = EXCP_HALTED; cpu_loop_exit(cpu); } #else if (interrupt_request & CPU_INTERRUPT_RESET) { cpu_reset(cpu); } #endif if (cc->cpu_exec_interrupt(cpu, interrupt_request)) { next_tb = 0; } if (cpu->interrupt_request & CPU_INTERRUPT_EXITTB) { cpu->interrupt_request &= ~CPU_INTERRUPT_EXITTB; next_tb = 0; } } if (unlikely(cpu->exit_request)) { cpu->exit_request = 0; cpu->exception_index = EXCP_INTERRUPT; cpu_loop_exit(cpu); } tb_lock(); tb = tb_find_fast(cpu); if (tcg_ctx.tb_ctx.tb_invalidated_flag) { next_tb = 0; tcg_ctx.tb_ctx.tb_invalidated_flag = 0; } if (qemu_loglevel_mask(CPU_LOG_EXEC)) { qemu_log("Trace %p [" TARGET_FMT_lx "] %s\n", tb->tc_ptr, tb->pc, lookup_symbol(tb->pc)); } if (next_tb != 0 && tb->page_addr[1] == -1 && !qemu_loglevel_mask(CPU_LOG_TB_NOCHAIN)) { tb_add_jump((TranslationBlock *)(next_tb & ~TB_EXIT_MASK), next_tb & TB_EXIT_MASK, tb); } tb_unlock(); if (likely(!cpu->exit_request)) { trace_exec_tb(tb, tb->pc); tc_ptr = tb->tc_ptr; cpu->current_tb = tb; next_tb = cpu_tb_exec(cpu, tc_ptr); cpu->current_tb = NULL; switch (next_tb & TB_EXIT_MASK) { case TB_EXIT_REQUESTED: smp_rmb(); next_tb = 0; break; case TB_EXIT_ICOUNT_EXPIRED: { int insns_left = cpu->icount_decr.u32; if (cpu->icount_extra && insns_left >= 0) { cpu->icount_extra += insns_left; insns_left = MIN(0xffff, cpu->icount_extra); cpu->icount_extra -= insns_left; cpu->icount_decr.u16.low = insns_left; } else { if (insns_left > 0) { tb = (TranslationBlock *)(next_tb & ~TB_EXIT_MASK); cpu_exec_nocache(cpu, insns_left, tb); align_clocks(&sc, cpu); } cpu->exception_index = EXCP_INTERRUPT; next_tb = 0; cpu_loop_exit(cpu); } break; } default: break; } } align_clocks(&sc, cpu); } } else { cpu = current_cpu; cc = CPU_GET_CLASS(cpu); cpu->can_do_io = 1; #ifdef TARGET_I386 x86_cpu = X86_CPU(cpu); env = &x86_cpu->env; #endif tb_lock_reset(); } } cc->cpu_exec_exit(cpu); rcu_read_unlock(); current_cpu = NULL; atomic_set(&tcg_current_cpu, NULL); return ret; }
{ "code": [], "line_no": [] }
int FUNC_0(CPUState *VAR_0) { CPUClass *cc = CPU_GET_CLASS(VAR_0); #ifdef TARGET_I386 X86CPU *x86_cpu = X86_CPU(VAR_0); CPUArchState *env = &x86_cpu->env; #endif int VAR_1, VAR_2; TranslationBlock *tb; uint8_t *tc_ptr; uintptr_t next_tb; SyncClocks sc; if (VAR_0->halted) { #if defined(TARGET_I386) && !defined(CONFIG_USER_ONLY) if (VAR_0->VAR_2 & CPU_INTERRUPT_POLL) { apic_poll_irq(x86_cpu->apic_state); cpu_reset_interrupt(VAR_0, CPU_INTERRUPT_POLL); } #endif if (!cpu_has_work(VAR_0)) { return EXCP_HALTED; } VAR_0->halted = 0; } current_cpu = VAR_0; atomic_mb_set(&tcg_current_cpu, VAR_0); rcu_read_lock(); if (unlikely(atomic_mb_read(&exit_request))) { VAR_0->exit_request = 1; } cc->cpu_exec_enter(VAR_0); init_delay_params(&sc, VAR_0); for(;;) { if (sigsetjmp(VAR_0->jmp_env, 0) == 0) { if (VAR_0->exception_index >= 0) { if (VAR_0->exception_index >= EXCP_INTERRUPT) { VAR_1 = VAR_0->exception_index; if (VAR_1 == EXCP_DEBUG) { cpu_handle_debug_exception(VAR_0); } VAR_0->exception_index = -1; break; } else { #if defined(CONFIG_USER_ONLY) #if defined(TARGET_I386) cc->do_interrupt(VAR_0); #endif VAR_1 = VAR_0->exception_index; VAR_0->exception_index = -1; break; #else cc->do_interrupt(VAR_0); VAR_0->exception_index = -1; #endif } } next_tb = 0; for(;;) { VAR_2 = VAR_0->VAR_2; if (unlikely(VAR_2)) { if (unlikely(VAR_0->singlestep_enabled & SSTEP_NOIRQ)) { VAR_2 &= ~CPU_INTERRUPT_SSTEP_MASK; } if (VAR_2 & CPU_INTERRUPT_DEBUG) { VAR_0->VAR_2 &= ~CPU_INTERRUPT_DEBUG; VAR_0->exception_index = EXCP_DEBUG; cpu_loop_exit(VAR_0); } if (VAR_2 & CPU_INTERRUPT_HALT) { VAR_0->VAR_2 &= ~CPU_INTERRUPT_HALT; VAR_0->halted = 1; VAR_0->exception_index = EXCP_HLT; cpu_loop_exit(VAR_0); } #if defined(TARGET_I386) if (VAR_2 & CPU_INTERRUPT_INIT) { cpu_svm_check_intercept_param(env, SVM_EXIT_INIT, 0); do_cpu_init(x86_cpu); VAR_0->exception_index = EXCP_HALTED; cpu_loop_exit(VAR_0); } #else if (VAR_2 & CPU_INTERRUPT_RESET) { cpu_reset(VAR_0); } #endif if (cc->cpu_exec_interrupt(VAR_0, VAR_2)) { next_tb = 0; } if (VAR_0->VAR_2 & CPU_INTERRUPT_EXITTB) { VAR_0->VAR_2 &= ~CPU_INTERRUPT_EXITTB; next_tb = 0; } } if (unlikely(VAR_0->exit_request)) { VAR_0->exit_request = 0; VAR_0->exception_index = EXCP_INTERRUPT; cpu_loop_exit(VAR_0); } tb_lock(); tb = tb_find_fast(VAR_0); if (tcg_ctx.tb_ctx.tb_invalidated_flag) { next_tb = 0; tcg_ctx.tb_ctx.tb_invalidated_flag = 0; } if (qemu_loglevel_mask(CPU_LOG_EXEC)) { qemu_log("Trace %p [" TARGET_FMT_lx "] %s\n", tb->tc_ptr, tb->pc, lookup_symbol(tb->pc)); } if (next_tb != 0 && tb->page_addr[1] == -1 && !qemu_loglevel_mask(CPU_LOG_TB_NOCHAIN)) { tb_add_jump((TranslationBlock *)(next_tb & ~TB_EXIT_MASK), next_tb & TB_EXIT_MASK, tb); } tb_unlock(); if (likely(!VAR_0->exit_request)) { trace_exec_tb(tb, tb->pc); tc_ptr = tb->tc_ptr; VAR_0->current_tb = tb; next_tb = cpu_tb_exec(VAR_0, tc_ptr); VAR_0->current_tb = NULL; switch (next_tb & TB_EXIT_MASK) { case TB_EXIT_REQUESTED: smp_rmb(); next_tb = 0; break; case TB_EXIT_ICOUNT_EXPIRED: { int VAR_3 = VAR_0->icount_decr.u32; if (VAR_0->icount_extra && VAR_3 >= 0) { VAR_0->icount_extra += VAR_3; VAR_3 = MIN(0xffff, VAR_0->icount_extra); VAR_0->icount_extra -= VAR_3; VAR_0->icount_decr.u16.low = VAR_3; } else { if (VAR_3 > 0) { tb = (TranslationBlock *)(next_tb & ~TB_EXIT_MASK); cpu_exec_nocache(VAR_0, VAR_3, tb); align_clocks(&sc, VAR_0); } VAR_0->exception_index = EXCP_INTERRUPT; next_tb = 0; cpu_loop_exit(VAR_0); } break; } default: break; } } align_clocks(&sc, VAR_0); } } else { VAR_0 = current_cpu; cc = CPU_GET_CLASS(VAR_0); VAR_0->can_do_io = 1; #ifdef TARGET_I386 x86_cpu = X86_CPU(VAR_0); env = &x86_cpu->env; #endif tb_lock_reset(); } } cc->cpu_exec_exit(VAR_0); rcu_read_unlock(); current_cpu = NULL; atomic_set(&tcg_current_cpu, NULL); return VAR_1; }
[ "int FUNC_0(CPUState *VAR_0)\n{", "CPUClass *cc = CPU_GET_CLASS(VAR_0);", "#ifdef TARGET_I386\nX86CPU *x86_cpu = X86_CPU(VAR_0);", "CPUArchState *env = &x86_cpu->env;", "#endif\nint VAR_1, VAR_2;", "TranslationBlock *tb;", "uint8_t *tc_ptr;", "uintptr_t next_tb;", "SyncClocks sc;", "if (VAR_0->halted) {", "#if defined(TARGET_I386) && !defined(CONFIG_USER_ONLY)\nif (VAR_0->VAR_2 & CPU_INTERRUPT_POLL) {", "apic_poll_irq(x86_cpu->apic_state);", "cpu_reset_interrupt(VAR_0, CPU_INTERRUPT_POLL);", "}", "#endif\nif (!cpu_has_work(VAR_0)) {", "return EXCP_HALTED;", "}", "VAR_0->halted = 0;", "}", "current_cpu = VAR_0;", "atomic_mb_set(&tcg_current_cpu, VAR_0);", "rcu_read_lock();", "if (unlikely(atomic_mb_read(&exit_request))) {", "VAR_0->exit_request = 1;", "}", "cc->cpu_exec_enter(VAR_0);", "init_delay_params(&sc, VAR_0);", "for(;;) {", "if (sigsetjmp(VAR_0->jmp_env, 0) == 0) {", "if (VAR_0->exception_index >= 0) {", "if (VAR_0->exception_index >= EXCP_INTERRUPT) {", "VAR_1 = VAR_0->exception_index;", "if (VAR_1 == EXCP_DEBUG) {", "cpu_handle_debug_exception(VAR_0);", "}", "VAR_0->exception_index = -1;", "break;", "} else {", "#if defined(CONFIG_USER_ONLY)\n#if defined(TARGET_I386)\ncc->do_interrupt(VAR_0);", "#endif\nVAR_1 = VAR_0->exception_index;", "VAR_0->exception_index = -1;", "break;", "#else\ncc->do_interrupt(VAR_0);", "VAR_0->exception_index = -1;", "#endif\n}", "}", "next_tb = 0;", "for(;;) {", "VAR_2 = VAR_0->VAR_2;", "if (unlikely(VAR_2)) {", "if (unlikely(VAR_0->singlestep_enabled & SSTEP_NOIRQ)) {", "VAR_2 &= ~CPU_INTERRUPT_SSTEP_MASK;", "}", "if (VAR_2 & CPU_INTERRUPT_DEBUG) {", "VAR_0->VAR_2 &= ~CPU_INTERRUPT_DEBUG;", "VAR_0->exception_index = EXCP_DEBUG;", "cpu_loop_exit(VAR_0);", "}", "if (VAR_2 & CPU_INTERRUPT_HALT) {", "VAR_0->VAR_2 &= ~CPU_INTERRUPT_HALT;", "VAR_0->halted = 1;", "VAR_0->exception_index = EXCP_HLT;", "cpu_loop_exit(VAR_0);", "}", "#if defined(TARGET_I386)\nif (VAR_2 & CPU_INTERRUPT_INIT) {", "cpu_svm_check_intercept_param(env, SVM_EXIT_INIT, 0);", "do_cpu_init(x86_cpu);", "VAR_0->exception_index = EXCP_HALTED;", "cpu_loop_exit(VAR_0);", "}", "#else\nif (VAR_2 & CPU_INTERRUPT_RESET) {", "cpu_reset(VAR_0);", "}", "#endif\nif (cc->cpu_exec_interrupt(VAR_0, VAR_2)) {", "next_tb = 0;", "}", "if (VAR_0->VAR_2 & CPU_INTERRUPT_EXITTB) {", "VAR_0->VAR_2 &= ~CPU_INTERRUPT_EXITTB;", "next_tb = 0;", "}", "}", "if (unlikely(VAR_0->exit_request)) {", "VAR_0->exit_request = 0;", "VAR_0->exception_index = EXCP_INTERRUPT;", "cpu_loop_exit(VAR_0);", "}", "tb_lock();", "tb = tb_find_fast(VAR_0);", "if (tcg_ctx.tb_ctx.tb_invalidated_flag) {", "next_tb = 0;", "tcg_ctx.tb_ctx.tb_invalidated_flag = 0;", "}", "if (qemu_loglevel_mask(CPU_LOG_EXEC)) {", "qemu_log(\"Trace %p [\" TARGET_FMT_lx \"] %s\\n\",\ntb->tc_ptr, tb->pc, lookup_symbol(tb->pc));", "}", "if (next_tb != 0 && tb->page_addr[1] == -1\n&& !qemu_loglevel_mask(CPU_LOG_TB_NOCHAIN)) {", "tb_add_jump((TranslationBlock *)(next_tb & ~TB_EXIT_MASK),\nnext_tb & TB_EXIT_MASK, tb);", "}", "tb_unlock();", "if (likely(!VAR_0->exit_request)) {", "trace_exec_tb(tb, tb->pc);", "tc_ptr = tb->tc_ptr;", "VAR_0->current_tb = tb;", "next_tb = cpu_tb_exec(VAR_0, tc_ptr);", "VAR_0->current_tb = NULL;", "switch (next_tb & TB_EXIT_MASK) {", "case TB_EXIT_REQUESTED:\nsmp_rmb();", "next_tb = 0;", "break;", "case TB_EXIT_ICOUNT_EXPIRED:\n{", "int VAR_3 = VAR_0->icount_decr.u32;", "if (VAR_0->icount_extra && VAR_3 >= 0) {", "VAR_0->icount_extra += VAR_3;", "VAR_3 = MIN(0xffff, VAR_0->icount_extra);", "VAR_0->icount_extra -= VAR_3;", "VAR_0->icount_decr.u16.low = VAR_3;", "} else {", "if (VAR_3 > 0) {", "tb = (TranslationBlock *)(next_tb & ~TB_EXIT_MASK);", "cpu_exec_nocache(VAR_0, VAR_3, tb);", "align_clocks(&sc, VAR_0);", "}", "VAR_0->exception_index = EXCP_INTERRUPT;", "next_tb = 0;", "cpu_loop_exit(VAR_0);", "}", "break;", "}", "default:\nbreak;", "}", "}", "align_clocks(&sc, VAR_0);", "}", "} else {", "VAR_0 = current_cpu;", "cc = CPU_GET_CLASS(VAR_0);", "VAR_0->can_do_io = 1;", "#ifdef TARGET_I386\nx86_cpu = X86_CPU(VAR_0);", "env = &x86_cpu->env;", "#endif\ntb_lock_reset();", "}", "}", "cc->cpu_exec_exit(VAR_0);", "rcu_read_unlock();", "current_cpu = NULL;", "atomic_set(&tcg_current_cpu, NULL);", "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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 11 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29, 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 85 ], [ 91 ], [ 93 ], [ 97 ], [ 99 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117, 125, 127 ], [ 129, 131 ], [ 133 ], [ 135 ], [ 137, 139 ], [ 141 ], [ 143, 145 ], [ 147 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189, 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203, 205 ], [ 207 ], [ 209 ], [ 211, 221 ], [ 223 ], [ 225 ], [ 231 ], [ 233 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 263 ], [ 271 ], [ 273 ], [ 275 ], [ 277 ], [ 279, 281 ], [ 283 ], [ 291, 293 ], [ 295, 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305 ], [ 307 ], [ 311 ], [ 313 ], [ 315 ], [ 317 ], [ 319, 341 ], [ 343 ], [ 345 ], [ 347, 349 ], [ 353 ], [ 355 ], [ 359 ], [ 361 ], [ 363 ], [ 365 ], [ 367 ], [ 369 ], [ 373 ], [ 375 ], [ 377 ], [ 379 ], [ 381 ], [ 383 ], [ 385 ], [ 387 ], [ 389 ], [ 391 ], [ 393, 395 ], [ 397 ], [ 399 ], [ 405 ], [ 411 ], [ 413 ], [ 419 ], [ 421 ], [ 423 ], [ 425, 427 ], [ 429 ], [ 431, 433 ], [ 435 ], [ 437 ], [ 441 ], [ 443 ], [ 449 ], [ 455 ], [ 457 ], [ 459 ] ]
6,607
static int dvbsub_parse_clut_segment(AVCodecContext *avctx, const uint8_t *buf, int buf_size) { DVBSubContext *ctx = avctx->priv_data; const uint8_t *buf_end = buf + buf_size; int i, clut_id; int version; DVBSubCLUT *clut; int entry_id, depth , full_range; int y, cr, cb, alpha; int r, g, b, r_add, g_add, b_add; ff_dlog(avctx, "DVB clut packet:\n"); for (i=0; i < buf_size; i++) { ff_dlog(avctx, "%02x ", buf[i]); if (i % 16 == 15) ff_dlog(avctx, "\n"); } if (i % 16) ff_dlog(avctx, "\n"); clut_id = *buf++; version = ((*buf)>>4)&15; buf += 1; clut = get_clut(ctx, clut_id); if (!clut) { clut = av_malloc(sizeof(DVBSubCLUT)); if (!clut) return AVERROR(ENOMEM); memcpy(clut, &default_clut, sizeof(DVBSubCLUT)); clut->id = clut_id; clut->version = -1; clut->next = ctx->clut_list; ctx->clut_list = clut; } if (clut->version != version) { clut->version = version; while (buf + 4 < buf_end) { entry_id = *buf++; depth = (*buf) & 0xe0; if (depth == 0) { av_log(avctx, AV_LOG_ERROR, "Invalid clut depth 0x%x!\n", *buf); return 0; } full_range = (*buf++) & 1; if (full_range) { y = *buf++; cr = *buf++; cb = *buf++; alpha = *buf++; } else { y = buf[0] & 0xfc; cr = (((buf[0] & 3) << 2) | ((buf[1] >> 6) & 3)) << 4; cb = (buf[1] << 2) & 0xf0; alpha = (buf[1] << 6) & 0xc0; buf += 2; } if (y == 0) alpha = 0xff; YUV_TO_RGB1_CCIR(cb, cr); YUV_TO_RGB2_CCIR(r, g, b, y); ff_dlog(avctx, "clut %d := (%d,%d,%d,%d)\n", entry_id, r, g, b, alpha); if (!!(depth & 0x80) + !!(depth & 0x40) + !!(depth & 0x20) > 1) { ff_dlog(avctx, "More than one bit level marked: %x\n", depth); if (avctx->strict_std_compliance > FF_COMPLIANCE_NORMAL) return AVERROR_INVALIDDATA; } if (depth & 0x80) clut->clut4[entry_id] = RGBA(r,g,b,255 - alpha); else if (depth & 0x40) clut->clut16[entry_id] = RGBA(r,g,b,255 - alpha); else if (depth & 0x20) clut->clut256[entry_id] = RGBA(r,g,b,255 - alpha); } } return 0; }
false
FFmpeg
e5774f28d15887d36da25ae1ef2f1b3d7a75f449
static int dvbsub_parse_clut_segment(AVCodecContext *avctx, const uint8_t *buf, int buf_size) { DVBSubContext *ctx = avctx->priv_data; const uint8_t *buf_end = buf + buf_size; int i, clut_id; int version; DVBSubCLUT *clut; int entry_id, depth , full_range; int y, cr, cb, alpha; int r, g, b, r_add, g_add, b_add; ff_dlog(avctx, "DVB clut packet:\n"); for (i=0; i < buf_size; i++) { ff_dlog(avctx, "%02x ", buf[i]); if (i % 16 == 15) ff_dlog(avctx, "\n"); } if (i % 16) ff_dlog(avctx, "\n"); clut_id = *buf++; version = ((*buf)>>4)&15; buf += 1; clut = get_clut(ctx, clut_id); if (!clut) { clut = av_malloc(sizeof(DVBSubCLUT)); if (!clut) return AVERROR(ENOMEM); memcpy(clut, &default_clut, sizeof(DVBSubCLUT)); clut->id = clut_id; clut->version = -1; clut->next = ctx->clut_list; ctx->clut_list = clut; } if (clut->version != version) { clut->version = version; while (buf + 4 < buf_end) { entry_id = *buf++; depth = (*buf) & 0xe0; if (depth == 0) { av_log(avctx, AV_LOG_ERROR, "Invalid clut depth 0x%x!\n", *buf); return 0; } full_range = (*buf++) & 1; if (full_range) { y = *buf++; cr = *buf++; cb = *buf++; alpha = *buf++; } else { y = buf[0] & 0xfc; cr = (((buf[0] & 3) << 2) | ((buf[1] >> 6) & 3)) << 4; cb = (buf[1] << 2) & 0xf0; alpha = (buf[1] << 6) & 0xc0; buf += 2; } if (y == 0) alpha = 0xff; YUV_TO_RGB1_CCIR(cb, cr); YUV_TO_RGB2_CCIR(r, g, b, y); ff_dlog(avctx, "clut %d := (%d,%d,%d,%d)\n", entry_id, r, g, b, alpha); if (!!(depth & 0x80) + !!(depth & 0x40) + !!(depth & 0x20) > 1) { ff_dlog(avctx, "More than one bit level marked: %x\n", depth); if (avctx->strict_std_compliance > FF_COMPLIANCE_NORMAL) return AVERROR_INVALIDDATA; } if (depth & 0x80) clut->clut4[entry_id] = RGBA(r,g,b,255 - alpha); else if (depth & 0x40) clut->clut16[entry_id] = RGBA(r,g,b,255 - alpha); else if (depth & 0x20) clut->clut256[entry_id] = RGBA(r,g,b,255 - alpha); } } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, const uint8_t *VAR_1, int VAR_2) { DVBSubContext *ctx = VAR_0->priv_data; const uint8_t *VAR_3 = VAR_1 + VAR_2; int VAR_4, VAR_5; int VAR_6; DVBSubCLUT *clut; int VAR_7, VAR_8 , VAR_9; int VAR_10, VAR_11, VAR_12, VAR_13; int VAR_14, VAR_15, VAR_16, VAR_17, VAR_18, VAR_19; ff_dlog(VAR_0, "DVB clut packet:\n"); for (VAR_4=0; VAR_4 < VAR_2; VAR_4++) { ff_dlog(VAR_0, "%02x ", VAR_1[VAR_4]); if (VAR_4 % 16 == 15) ff_dlog(VAR_0, "\n"); } if (VAR_4 % 16) ff_dlog(VAR_0, "\n"); VAR_5 = *VAR_1++; VAR_6 = ((*VAR_1)>>4)&15; VAR_1 += 1; clut = get_clut(ctx, VAR_5); if (!clut) { clut = av_malloc(sizeof(DVBSubCLUT)); if (!clut) return AVERROR(ENOMEM); memcpy(clut, &default_clut, sizeof(DVBSubCLUT)); clut->id = VAR_5; clut->VAR_6 = -1; clut->next = ctx->clut_list; ctx->clut_list = clut; } if (clut->VAR_6 != VAR_6) { clut->VAR_6 = VAR_6; while (VAR_1 + 4 < VAR_3) { VAR_7 = *VAR_1++; VAR_8 = (*VAR_1) & 0xe0; if (VAR_8 == 0) { av_log(VAR_0, AV_LOG_ERROR, "Invalid clut VAR_8 0x%x!\n", *VAR_1); return 0; } VAR_9 = (*VAR_1++) & 1; if (VAR_9) { VAR_10 = *VAR_1++; VAR_11 = *VAR_1++; VAR_12 = *VAR_1++; VAR_13 = *VAR_1++; } else { VAR_10 = VAR_1[0] & 0xfc; VAR_11 = (((VAR_1[0] & 3) << 2) | ((VAR_1[1] >> 6) & 3)) << 4; VAR_12 = (VAR_1[1] << 2) & 0xf0; VAR_13 = (VAR_1[1] << 6) & 0xc0; VAR_1 += 2; } if (VAR_10 == 0) VAR_13 = 0xff; YUV_TO_RGB1_CCIR(VAR_12, VAR_11); YUV_TO_RGB2_CCIR(VAR_14, VAR_15, VAR_16, VAR_10); ff_dlog(VAR_0, "clut %d := (%d,%d,%d,%d)\n", VAR_7, VAR_14, VAR_15, VAR_16, VAR_13); if (!!(VAR_8 & 0x80) + !!(VAR_8 & 0x40) + !!(VAR_8 & 0x20) > 1) { ff_dlog(VAR_0, "More than one bit level marked: %x\n", VAR_8); if (VAR_0->strict_std_compliance > FF_COMPLIANCE_NORMAL) return AVERROR_INVALIDDATA; } if (VAR_8 & 0x80) clut->clut4[VAR_7] = RGBA(VAR_14,VAR_15,VAR_16,255 - VAR_13); else if (VAR_8 & 0x40) clut->clut16[VAR_7] = RGBA(VAR_14,VAR_15,VAR_16,255 - VAR_13); else if (VAR_8 & 0x20) clut->clut256[VAR_7] = RGBA(VAR_14,VAR_15,VAR_16,255 - VAR_13); } } return 0; }
[ "static int FUNC_0(AVCodecContext *VAR_0,\nconst uint8_t *VAR_1, int VAR_2)\n{", "DVBSubContext *ctx = VAR_0->priv_data;", "const uint8_t *VAR_3 = VAR_1 + VAR_2;", "int VAR_4, VAR_5;", "int VAR_6;", "DVBSubCLUT *clut;", "int VAR_7, VAR_8 , VAR_9;", "int VAR_10, VAR_11, VAR_12, VAR_13;", "int VAR_14, VAR_15, VAR_16, VAR_17, VAR_18, VAR_19;", "ff_dlog(VAR_0, \"DVB clut packet:\\n\");", "for (VAR_4=0; VAR_4 < VAR_2; VAR_4++) {", "ff_dlog(VAR_0, \"%02x \", VAR_1[VAR_4]);", "if (VAR_4 % 16 == 15)\nff_dlog(VAR_0, \"\\n\");", "}", "if (VAR_4 % 16)\nff_dlog(VAR_0, \"\\n\");", "VAR_5 = *VAR_1++;", "VAR_6 = ((*VAR_1)>>4)&15;", "VAR_1 += 1;", "clut = get_clut(ctx, VAR_5);", "if (!clut) {", "clut = av_malloc(sizeof(DVBSubCLUT));", "if (!clut)\nreturn AVERROR(ENOMEM);", "memcpy(clut, &default_clut, sizeof(DVBSubCLUT));", "clut->id = VAR_5;", "clut->VAR_6 = -1;", "clut->next = ctx->clut_list;", "ctx->clut_list = clut;", "}", "if (clut->VAR_6 != VAR_6) {", "clut->VAR_6 = VAR_6;", "while (VAR_1 + 4 < VAR_3) {", "VAR_7 = *VAR_1++;", "VAR_8 = (*VAR_1) & 0xe0;", "if (VAR_8 == 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"Invalid clut VAR_8 0x%x!\\n\", *VAR_1);", "return 0;", "}", "VAR_9 = (*VAR_1++) & 1;", "if (VAR_9) {", "VAR_10 = *VAR_1++;", "VAR_11 = *VAR_1++;", "VAR_12 = *VAR_1++;", "VAR_13 = *VAR_1++;", "} else {", "VAR_10 = VAR_1[0] & 0xfc;", "VAR_11 = (((VAR_1[0] & 3) << 2) | ((VAR_1[1] >> 6) & 3)) << 4;", "VAR_12 = (VAR_1[1] << 2) & 0xf0;", "VAR_13 = (VAR_1[1] << 6) & 0xc0;", "VAR_1 += 2;", "}", "if (VAR_10 == 0)\nVAR_13 = 0xff;", "YUV_TO_RGB1_CCIR(VAR_12, VAR_11);", "YUV_TO_RGB2_CCIR(VAR_14, VAR_15, VAR_16, VAR_10);", "ff_dlog(VAR_0, \"clut %d := (%d,%d,%d,%d)\\n\", VAR_7, VAR_14, VAR_15, VAR_16, VAR_13);", "if (!!(VAR_8 & 0x80) + !!(VAR_8 & 0x40) + !!(VAR_8 & 0x20) > 1) {", "ff_dlog(VAR_0, \"More than one bit level marked: %x\\n\", VAR_8);", "if (VAR_0->strict_std_compliance > FF_COMPLIANCE_NORMAL)\nreturn AVERROR_INVALIDDATA;", "}", "if (VAR_8 & 0x80)\nclut->clut4[VAR_7] = RGBA(VAR_14,VAR_15,VAR_16,255 - VAR_13);", "else if (VAR_8 & 0x40)\nclut->clut16[VAR_7] = RGBA(VAR_14,VAR_15,VAR_16,255 - VAR_13);", "else if (VAR_8 & 0x20)\nclut->clut256[VAR_7] = RGBA(VAR_14,VAR_15,VAR_16,255 - VAR_13);", "}", "}", "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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 31 ], [ 33 ], [ 35, 37 ], [ 39 ], [ 43, 45 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 61 ], [ 63 ], [ 65, 67 ], [ 71 ], [ 75 ], [ 77 ], [ 81 ], [ 83 ], [ 85 ], [ 89 ], [ 93 ], [ 97 ], [ 99 ], [ 103 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 117 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 143 ], [ 145 ], [ 149, 151 ], [ 155 ], [ 157 ], [ 161 ], [ 163 ], [ 165 ], [ 167, 169 ], [ 171 ], [ 175, 177 ], [ 179, 181 ], [ 183, 185 ], [ 187 ], [ 189 ], [ 193 ], [ 195 ] ]
6,608
static void load_word(DBDMA_channel *ch, int key, uint32_t addr, uint16_t len) { dbdma_cmd *current = &ch->current; uint32_t val; DBDMA_DPRINTF("load_word\n"); /* only implements KEY_SYSTEM */ if (key != KEY_SYSTEM) { printf("DBDMA: LOAD_WORD, unimplemented key %x\n", key); kill_channel(ch); return; } cpu_physical_memory_read(addr, (uint8_t*)&val, len); if (len == 2) val = (val << 16) | (current->cmd_dep & 0x0000ffff); else if (len == 1) val = (val << 24) | (current->cmd_dep & 0x00ffffff); current->cmd_dep = val; if (conditional_wait(ch)) goto wait; current->xfer_status = cpu_to_le16(be32_to_cpu(ch->regs[DBDMA_STATUS])); dbdma_cmdptr_save(ch); ch->regs[DBDMA_STATUS] &= cpu_to_be32(~FLUSH); conditional_interrupt(ch); next(ch); wait: qemu_bh_schedule(dbdma_bh); }
false
qemu
ad674e53b5cce265fadafbde2c6a4f190345cd00
static void load_word(DBDMA_channel *ch, int key, uint32_t addr, uint16_t len) { dbdma_cmd *current = &ch->current; uint32_t val; DBDMA_DPRINTF("load_word\n"); if (key != KEY_SYSTEM) { printf("DBDMA: LOAD_WORD, unimplemented key %x\n", key); kill_channel(ch); return; } cpu_physical_memory_read(addr, (uint8_t*)&val, len); if (len == 2) val = (val << 16) | (current->cmd_dep & 0x0000ffff); else if (len == 1) val = (val << 24) | (current->cmd_dep & 0x00ffffff); current->cmd_dep = val; if (conditional_wait(ch)) goto wait; current->xfer_status = cpu_to_le16(be32_to_cpu(ch->regs[DBDMA_STATUS])); dbdma_cmdptr_save(ch); ch->regs[DBDMA_STATUS] &= cpu_to_be32(~FLUSH); conditional_interrupt(ch); next(ch); wait: qemu_bh_schedule(dbdma_bh); }
{ "code": [], "line_no": [] }
static void FUNC_0(DBDMA_channel *VAR_0, int VAR_1, uint32_t VAR_2, uint16_t VAR_3) { dbdma_cmd *current = &VAR_0->current; uint32_t val; DBDMA_DPRINTF("FUNC_0\n"); if (VAR_1 != KEY_SYSTEM) { printf("DBDMA: LOAD_WORD, unimplemented VAR_1 %x\n", VAR_1); kill_channel(VAR_0); return; } cpu_physical_memory_read(VAR_2, (uint8_t*)&val, VAR_3); if (VAR_3 == 2) val = (val << 16) | (current->cmd_dep & 0x0000ffff); else if (VAR_3 == 1) val = (val << 24) | (current->cmd_dep & 0x00ffffff); current->cmd_dep = val; if (conditional_wait(VAR_0)) goto wait; current->xfer_status = cpu_to_le16(be32_to_cpu(VAR_0->regs[DBDMA_STATUS])); dbdma_cmdptr_save(VAR_0); VAR_0->regs[DBDMA_STATUS] &= cpu_to_be32(~FLUSH); conditional_interrupt(VAR_0); next(VAR_0); wait: qemu_bh_schedule(dbdma_bh); }
[ "static void FUNC_0(DBDMA_channel *VAR_0, int VAR_1, uint32_t VAR_2,\nuint16_t VAR_3)\n{", "dbdma_cmd *current = &VAR_0->current;", "uint32_t val;", "DBDMA_DPRINTF(\"FUNC_0\\n\");", "if (VAR_1 != KEY_SYSTEM) {", "printf(\"DBDMA: LOAD_WORD, unimplemented VAR_1 %x\\n\", VAR_1);", "kill_channel(VAR_0);", "return;", "}", "cpu_physical_memory_read(VAR_2, (uint8_t*)&val, VAR_3);", "if (VAR_3 == 2)\nval = (val << 16) | (current->cmd_dep & 0x0000ffff);", "else if (VAR_3 == 1)\nval = (val << 24) | (current->cmd_dep & 0x00ffffff);", "current->cmd_dep = val;", "if (conditional_wait(VAR_0))\ngoto wait;", "current->xfer_status = cpu_to_le16(be32_to_cpu(VAR_0->regs[DBDMA_STATUS]));", "dbdma_cmdptr_save(VAR_0);", "VAR_0->regs[DBDMA_STATUS] &= cpu_to_be32(~FLUSH);", "conditional_interrupt(VAR_0);", "next(VAR_0);", "wait:\nqemu_bh_schedule(dbdma_bh);", "}" ]
[ 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 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 37, 39 ], [ 41, 43 ], [ 47 ], [ 51, 53 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 71, 73 ], [ 75 ] ]
6,610
static void nvdimm_dsm_device(NvdimmDsmIn *in, hwaddr dsm_mem_addr) { /* See the comments in nvdimm_dsm_root(). */ if (!in->function) { nvdimm_dsm_function0(0 /* No function supported other than function 0 */, dsm_mem_addr); return; } /* No function except function 0 is supported yet. */ nvdimm_dsm_no_payload(1 /* Not Supported */, dsm_mem_addr); }
false
qemu
5797dcdc7ade30e8c4080d9282cd9e51b3566e14
static void nvdimm_dsm_device(NvdimmDsmIn *in, hwaddr dsm_mem_addr) { if (!in->function) { nvdimm_dsm_function0(0 , dsm_mem_addr); return; } nvdimm_dsm_no_payload(1 , dsm_mem_addr); }
{ "code": [], "line_no": [] }
static void FUNC_0(NvdimmDsmIn *VAR_0, hwaddr VAR_1) { if (!VAR_0->function) { nvdimm_dsm_function0(0 , VAR_1); return; } nvdimm_dsm_no_payload(1 , VAR_1); }
[ "static void FUNC_0(NvdimmDsmIn *VAR_0, hwaddr VAR_1)\n{", "if (!VAR_0->function) {", "nvdimm_dsm_function0(0\n, VAR_1);", "return;", "}", "nvdimm_dsm_no_payload(1 , VAR_1);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 7 ], [ 9, 11 ], [ 13 ], [ 15 ], [ 21 ], [ 23 ] ]
6,611
static void bdrv_co_em_bh(void *opaque) { BlockAIOCBCoroutine *acb = opaque; acb->common.cb(acb->common.opaque, acb->req.error); qemu_bh_delete(acb->bh); qemu_aio_unref(acb); }
false
qemu
0b5a24454fc551f0294fe93821e8c643214a55f5
static void bdrv_co_em_bh(void *opaque) { BlockAIOCBCoroutine *acb = opaque; acb->common.cb(acb->common.opaque, acb->req.error); qemu_bh_delete(acb->bh); qemu_aio_unref(acb); }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0) { BlockAIOCBCoroutine *acb = VAR_0; acb->common.cb(acb->common.VAR_0, acb->req.error); qemu_bh_delete(acb->bh); qemu_aio_unref(acb); }
[ "static void FUNC_0(void *VAR_0)\n{", "BlockAIOCBCoroutine *acb = VAR_0;", "acb->common.cb(acb->common.VAR_0, acb->req.error);", "qemu_bh_delete(acb->bh);", "qemu_aio_unref(acb);", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ] ]
6,613
static int qcow2_change_backing_file(BlockDriverState *bs, const char *backing_file, const char *backing_fmt) { /* Backing file format doesn't make sense without a backing file */ if (backing_fmt && !backing_file) { return -EINVAL; } pstrcpy(bs->backing_file, sizeof(bs->backing_file), backing_file ?: ""); pstrcpy(bs->backing_format, sizeof(bs->backing_format), backing_fmt ?: ""); return qcow2_update_header(bs); }
false
qemu
5f3777945d22248d805fb7c134e206c2d943b77b
static int qcow2_change_backing_file(BlockDriverState *bs, const char *backing_file, const char *backing_fmt) { if (backing_fmt && !backing_file) { return -EINVAL; } pstrcpy(bs->backing_file, sizeof(bs->backing_file), backing_file ?: ""); pstrcpy(bs->backing_format, sizeof(bs->backing_format), backing_fmt ?: ""); return qcow2_update_header(bs); }
{ "code": [], "line_no": [] }
static int FUNC_0(BlockDriverState *VAR_0, const char *VAR_1, const char *VAR_2) { if (VAR_2 && !VAR_1) { return -EINVAL; } pstrcpy(VAR_0->VAR_1, sizeof(VAR_0->VAR_1), VAR_1 ?: ""); pstrcpy(VAR_0->backing_format, sizeof(VAR_0->backing_format), VAR_2 ?: ""); return qcow2_update_header(VAR_0); }
[ "static int FUNC_0(BlockDriverState *VAR_0,\nconst char *VAR_1, const char *VAR_2)\n{", "if (VAR_2 && !VAR_1) {", "return -EINVAL;", "}", "pstrcpy(VAR_0->VAR_1, sizeof(VAR_0->VAR_1), VAR_1 ?: \"\");", "pstrcpy(VAR_0->backing_format, sizeof(VAR_0->backing_format), VAR_2 ?: \"\");", "return qcow2_update_header(VAR_0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ] ]
6,614
void helper_fcmp_eq_DT(CPUSH4State *env, float64 t0, float64 t1) { int relation; set_float_exception_flags(0, &env->fp_status); relation = float64_compare(t0, t1, &env->fp_status); if (unlikely(relation == float_relation_unordered)) { update_fpscr(env, GETPC()); } else { env->sr_t = (relation == float_relation_equal); } }
false
qemu
fea7d77d3ea287d3b1878648f3049fc6bb4fd57b
void helper_fcmp_eq_DT(CPUSH4State *env, float64 t0, float64 t1) { int relation; set_float_exception_flags(0, &env->fp_status); relation = float64_compare(t0, t1, &env->fp_status); if (unlikely(relation == float_relation_unordered)) { update_fpscr(env, GETPC()); } else { env->sr_t = (relation == float_relation_equal); } }
{ "code": [], "line_no": [] }
void FUNC_0(CPUSH4State *VAR_0, float64 VAR_1, float64 VAR_2) { int VAR_3; set_float_exception_flags(0, &VAR_0->fp_status); VAR_3 = float64_compare(VAR_1, VAR_2, &VAR_0->fp_status); if (unlikely(VAR_3 == float_relation_unordered)) { update_fpscr(VAR_0, GETPC()); } else { VAR_0->sr_t = (VAR_3 == float_relation_equal); } }
[ "void FUNC_0(CPUSH4State *VAR_0, float64 VAR_1, float64 VAR_2)\n{", "int VAR_3;", "set_float_exception_flags(0, &VAR_0->fp_status);", "VAR_3 = float64_compare(VAR_1, VAR_2, &VAR_0->fp_status);", "if (unlikely(VAR_3 == float_relation_unordered)) {", "update_fpscr(VAR_0, GETPC());", "} else {", "VAR_0->sr_t = (VAR_3 == float_relation_equal);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ] ]
6,615
int qcow2_update_snapshot_refcount(BlockDriverState *bs, int64_t l1_table_offset, int l1_size, int addend) { BDRVQcow2State *s = bs->opaque; uint64_t *l1_table, *l2_table, l2_offset, offset, l1_size2, refcount; bool l1_allocated = false; int64_t old_offset, old_l2_offset; int i, j, l1_modified = 0, nb_csectors; int ret; assert(addend >= -1 && addend <= 1); l2_table = NULL; l1_table = NULL; l1_size2 = l1_size * sizeof(uint64_t); s->cache_discards = true; /* WARNING: qcow2_snapshot_goto relies on this function not using the * l1_table_offset when it is the current s->l1_table_offset! Be careful * when changing this! */ if (l1_table_offset != s->l1_table_offset) { l1_table = g_try_malloc0(align_offset(l1_size2, 512)); if (l1_size2 && l1_table == NULL) { ret = -ENOMEM; goto fail; } l1_allocated = true; ret = bdrv_pread(bs->file, l1_table_offset, l1_table, l1_size2); if (ret < 0) { goto fail; } for(i = 0;i < l1_size; i++) be64_to_cpus(&l1_table[i]); } else { assert(l1_size == s->l1_size); l1_table = s->l1_table; l1_allocated = false; } for(i = 0; i < l1_size; i++) { l2_offset = l1_table[i]; if (l2_offset) { old_l2_offset = l2_offset; l2_offset &= L1E_OFFSET_MASK; if (offset_into_cluster(s, l2_offset)) { qcow2_signal_corruption(bs, true, -1, -1, "L2 table offset %#" PRIx64 " unaligned (L1 index: %#x)", l2_offset, i); ret = -EIO; goto fail; } ret = qcow2_cache_get(bs, s->l2_table_cache, l2_offset, (void**) &l2_table); if (ret < 0) { goto fail; } for(j = 0; j < s->l2_size; j++) { uint64_t cluster_index; offset = be64_to_cpu(l2_table[j]); old_offset = offset; offset &= ~QCOW_OFLAG_COPIED; switch (qcow2_get_cluster_type(offset)) { case QCOW2_CLUSTER_COMPRESSED: nb_csectors = ((offset >> s->csize_shift) & s->csize_mask) + 1; if (addend != 0) { ret = update_refcount(bs, (offset & s->cluster_offset_mask) & ~511, nb_csectors * 512, abs(addend), addend < 0, QCOW2_DISCARD_SNAPSHOT); if (ret < 0) { goto fail; } } /* compressed clusters are never modified */ refcount = 2; break; case QCOW2_CLUSTER_NORMAL: case QCOW2_CLUSTER_ZERO: if (offset_into_cluster(s, offset & L2E_OFFSET_MASK)) { qcow2_signal_corruption(bs, true, -1, -1, "Data " "cluster offset %#llx " "unaligned (L2 offset: %#" PRIx64 ", L2 index: %#x)", offset & L2E_OFFSET_MASK, l2_offset, j); ret = -EIO; goto fail; } cluster_index = (offset & L2E_OFFSET_MASK) >> s->cluster_bits; if (!cluster_index) { /* unallocated */ refcount = 0; break; } if (addend != 0) { ret = qcow2_update_cluster_refcount(bs, cluster_index, abs(addend), addend < 0, QCOW2_DISCARD_SNAPSHOT); if (ret < 0) { goto fail; } } ret = qcow2_get_refcount(bs, cluster_index, &refcount); if (ret < 0) { goto fail; } break; case QCOW2_CLUSTER_UNALLOCATED: refcount = 0; break; default: abort(); } if (refcount == 1) { offset |= QCOW_OFLAG_COPIED; } if (offset != old_offset) { if (addend > 0) { qcow2_cache_set_dependency(bs, s->l2_table_cache, s->refcount_block_cache); } l2_table[j] = cpu_to_be64(offset); qcow2_cache_entry_mark_dirty(bs, s->l2_table_cache, l2_table); } } qcow2_cache_put(bs, s->l2_table_cache, (void **) &l2_table); if (addend != 0) { ret = qcow2_update_cluster_refcount(bs, l2_offset >> s->cluster_bits, abs(addend), addend < 0, QCOW2_DISCARD_SNAPSHOT); if (ret < 0) { goto fail; } } ret = qcow2_get_refcount(bs, l2_offset >> s->cluster_bits, &refcount); if (ret < 0) { goto fail; } else if (refcount == 1) { l2_offset |= QCOW_OFLAG_COPIED; } if (l2_offset != old_l2_offset) { l1_table[i] = l2_offset; l1_modified = 1; } } } ret = bdrv_flush(bs); fail: if (l2_table) { qcow2_cache_put(bs, s->l2_table_cache, (void**) &l2_table); } s->cache_discards = false; qcow2_process_discards(bs, ret); /* Update L1 only if it isn't deleted anyway (addend = -1) */ if (ret == 0 && addend >= 0 && l1_modified) { for (i = 0; i < l1_size; i++) { cpu_to_be64s(&l1_table[i]); } ret = bdrv_pwrite_sync(bs->file, l1_table_offset, l1_table, l1_size2); for (i = 0; i < l1_size; i++) { be64_to_cpus(&l1_table[i]); } } if (l1_allocated) g_free(l1_table); return ret; }
false
qemu
b32cbae11107e9e172e5c58425a2a8362e7382ed
int qcow2_update_snapshot_refcount(BlockDriverState *bs, int64_t l1_table_offset, int l1_size, int addend) { BDRVQcow2State *s = bs->opaque; uint64_t *l1_table, *l2_table, l2_offset, offset, l1_size2, refcount; bool l1_allocated = false; int64_t old_offset, old_l2_offset; int i, j, l1_modified = 0, nb_csectors; int ret; assert(addend >= -1 && addend <= 1); l2_table = NULL; l1_table = NULL; l1_size2 = l1_size * sizeof(uint64_t); s->cache_discards = true; if (l1_table_offset != s->l1_table_offset) { l1_table = g_try_malloc0(align_offset(l1_size2, 512)); if (l1_size2 && l1_table == NULL) { ret = -ENOMEM; goto fail; } l1_allocated = true; ret = bdrv_pread(bs->file, l1_table_offset, l1_table, l1_size2); if (ret < 0) { goto fail; } for(i = 0;i < l1_size; i++) be64_to_cpus(&l1_table[i]); } else { assert(l1_size == s->l1_size); l1_table = s->l1_table; l1_allocated = false; } for(i = 0; i < l1_size; i++) { l2_offset = l1_table[i]; if (l2_offset) { old_l2_offset = l2_offset; l2_offset &= L1E_OFFSET_MASK; if (offset_into_cluster(s, l2_offset)) { qcow2_signal_corruption(bs, true, -1, -1, "L2 table offset %#" PRIx64 " unaligned (L1 index: %#x)", l2_offset, i); ret = -EIO; goto fail; } ret = qcow2_cache_get(bs, s->l2_table_cache, l2_offset, (void**) &l2_table); if (ret < 0) { goto fail; } for(j = 0; j < s->l2_size; j++) { uint64_t cluster_index; offset = be64_to_cpu(l2_table[j]); old_offset = offset; offset &= ~QCOW_OFLAG_COPIED; switch (qcow2_get_cluster_type(offset)) { case QCOW2_CLUSTER_COMPRESSED: nb_csectors = ((offset >> s->csize_shift) & s->csize_mask) + 1; if (addend != 0) { ret = update_refcount(bs, (offset & s->cluster_offset_mask) & ~511, nb_csectors * 512, abs(addend), addend < 0, QCOW2_DISCARD_SNAPSHOT); if (ret < 0) { goto fail; } } refcount = 2; break; case QCOW2_CLUSTER_NORMAL: case QCOW2_CLUSTER_ZERO: if (offset_into_cluster(s, offset & L2E_OFFSET_MASK)) { qcow2_signal_corruption(bs, true, -1, -1, "Data " "cluster offset %#llx " "unaligned (L2 offset: %#" PRIx64 ", L2 index: %#x)", offset & L2E_OFFSET_MASK, l2_offset, j); ret = -EIO; goto fail; } cluster_index = (offset & L2E_OFFSET_MASK) >> s->cluster_bits; if (!cluster_index) { refcount = 0; break; } if (addend != 0) { ret = qcow2_update_cluster_refcount(bs, cluster_index, abs(addend), addend < 0, QCOW2_DISCARD_SNAPSHOT); if (ret < 0) { goto fail; } } ret = qcow2_get_refcount(bs, cluster_index, &refcount); if (ret < 0) { goto fail; } break; case QCOW2_CLUSTER_UNALLOCATED: refcount = 0; break; default: abort(); } if (refcount == 1) { offset |= QCOW_OFLAG_COPIED; } if (offset != old_offset) { if (addend > 0) { qcow2_cache_set_dependency(bs, s->l2_table_cache, s->refcount_block_cache); } l2_table[j] = cpu_to_be64(offset); qcow2_cache_entry_mark_dirty(bs, s->l2_table_cache, l2_table); } } qcow2_cache_put(bs, s->l2_table_cache, (void **) &l2_table); if (addend != 0) { ret = qcow2_update_cluster_refcount(bs, l2_offset >> s->cluster_bits, abs(addend), addend < 0, QCOW2_DISCARD_SNAPSHOT); if (ret < 0) { goto fail; } } ret = qcow2_get_refcount(bs, l2_offset >> s->cluster_bits, &refcount); if (ret < 0) { goto fail; } else if (refcount == 1) { l2_offset |= QCOW_OFLAG_COPIED; } if (l2_offset != old_l2_offset) { l1_table[i] = l2_offset; l1_modified = 1; } } } ret = bdrv_flush(bs); fail: if (l2_table) { qcow2_cache_put(bs, s->l2_table_cache, (void**) &l2_table); } s->cache_discards = false; qcow2_process_discards(bs, ret); if (ret == 0 && addend >= 0 && l1_modified) { for (i = 0; i < l1_size; i++) { cpu_to_be64s(&l1_table[i]); } ret = bdrv_pwrite_sync(bs->file, l1_table_offset, l1_table, l1_size2); for (i = 0; i < l1_size; i++) { be64_to_cpus(&l1_table[i]); } } if (l1_allocated) g_free(l1_table); return ret; }
{ "code": [], "line_no": [] }
int FUNC_0(BlockDriverState *VAR_0, int64_t VAR_1, int VAR_2, int VAR_3) { BDRVQcow2State *s = VAR_0->opaque; uint64_t *l1_table, *l2_table, l2_offset, offset, l1_size2, refcount; bool l1_allocated = false; int64_t old_offset, old_l2_offset; int VAR_4, VAR_5, VAR_6 = 0, VAR_7; int VAR_8; assert(VAR_3 >= -1 && VAR_3 <= 1); l2_table = NULL; l1_table = NULL; l1_size2 = VAR_2 * sizeof(uint64_t); s->cache_discards = true; if (VAR_1 != s->VAR_1) { l1_table = g_try_malloc0(align_offset(l1_size2, 512)); if (l1_size2 && l1_table == NULL) { VAR_8 = -ENOMEM; goto fail; } l1_allocated = true; VAR_8 = bdrv_pread(VAR_0->file, VAR_1, l1_table, l1_size2); if (VAR_8 < 0) { goto fail; } for(VAR_4 = 0;VAR_4 < VAR_2; VAR_4++) be64_to_cpus(&l1_table[VAR_4]); } else { assert(VAR_2 == s->VAR_2); l1_table = s->l1_table; l1_allocated = false; } for(VAR_4 = 0; VAR_4 < VAR_2; VAR_4++) { l2_offset = l1_table[VAR_4]; if (l2_offset) { old_l2_offset = l2_offset; l2_offset &= L1E_OFFSET_MASK; if (offset_into_cluster(s, l2_offset)) { qcow2_signal_corruption(VAR_0, true, -1, -1, "L2 table offset %#" PRIx64 " unaligned (L1 index: %#x)", l2_offset, VAR_4); VAR_8 = -EIO; goto fail; } VAR_8 = qcow2_cache_get(VAR_0, s->l2_table_cache, l2_offset, (void**) &l2_table); if (VAR_8 < 0) { goto fail; } for(VAR_5 = 0; VAR_5 < s->l2_size; VAR_5++) { uint64_t cluster_index; offset = be64_to_cpu(l2_table[VAR_5]); old_offset = offset; offset &= ~QCOW_OFLAG_COPIED; switch (qcow2_get_cluster_type(offset)) { case QCOW2_CLUSTER_COMPRESSED: VAR_7 = ((offset >> s->csize_shift) & s->csize_mask) + 1; if (VAR_3 != 0) { VAR_8 = update_refcount(VAR_0, (offset & s->cluster_offset_mask) & ~511, VAR_7 * 512, abs(VAR_3), VAR_3 < 0, QCOW2_DISCARD_SNAPSHOT); if (VAR_8 < 0) { goto fail; } } refcount = 2; break; case QCOW2_CLUSTER_NORMAL: case QCOW2_CLUSTER_ZERO: if (offset_into_cluster(s, offset & L2E_OFFSET_MASK)) { qcow2_signal_corruption(VAR_0, true, -1, -1, "Data " "cluster offset %#llx " "unaligned (L2 offset: %#" PRIx64 ", L2 index: %#x)", offset & L2E_OFFSET_MASK, l2_offset, VAR_5); VAR_8 = -EIO; goto fail; } cluster_index = (offset & L2E_OFFSET_MASK) >> s->cluster_bits; if (!cluster_index) { refcount = 0; break; } if (VAR_3 != 0) { VAR_8 = qcow2_update_cluster_refcount(VAR_0, cluster_index, abs(VAR_3), VAR_3 < 0, QCOW2_DISCARD_SNAPSHOT); if (VAR_8 < 0) { goto fail; } } VAR_8 = qcow2_get_refcount(VAR_0, cluster_index, &refcount); if (VAR_8 < 0) { goto fail; } break; case QCOW2_CLUSTER_UNALLOCATED: refcount = 0; break; default: abort(); } if (refcount == 1) { offset |= QCOW_OFLAG_COPIED; } if (offset != old_offset) { if (VAR_3 > 0) { qcow2_cache_set_dependency(VAR_0, s->l2_table_cache, s->refcount_block_cache); } l2_table[VAR_5] = cpu_to_be64(offset); qcow2_cache_entry_mark_dirty(VAR_0, s->l2_table_cache, l2_table); } } qcow2_cache_put(VAR_0, s->l2_table_cache, (void **) &l2_table); if (VAR_3 != 0) { VAR_8 = qcow2_update_cluster_refcount(VAR_0, l2_offset >> s->cluster_bits, abs(VAR_3), VAR_3 < 0, QCOW2_DISCARD_SNAPSHOT); if (VAR_8 < 0) { goto fail; } } VAR_8 = qcow2_get_refcount(VAR_0, l2_offset >> s->cluster_bits, &refcount); if (VAR_8 < 0) { goto fail; } else if (refcount == 1) { l2_offset |= QCOW_OFLAG_COPIED; } if (l2_offset != old_l2_offset) { l1_table[VAR_4] = l2_offset; VAR_6 = 1; } } } VAR_8 = bdrv_flush(VAR_0); fail: if (l2_table) { qcow2_cache_put(VAR_0, s->l2_table_cache, (void**) &l2_table); } s->cache_discards = false; qcow2_process_discards(VAR_0, VAR_8); if (VAR_8 == 0 && VAR_3 >= 0 && VAR_6) { for (VAR_4 = 0; VAR_4 < VAR_2; VAR_4++) { cpu_to_be64s(&l1_table[VAR_4]); } VAR_8 = bdrv_pwrite_sync(VAR_0->file, VAR_1, l1_table, l1_size2); for (VAR_4 = 0; VAR_4 < VAR_2; VAR_4++) { be64_to_cpus(&l1_table[VAR_4]); } } if (l1_allocated) g_free(l1_table); return VAR_8; }
[ "int FUNC_0(BlockDriverState *VAR_0,\nint64_t VAR_1, int VAR_2, int VAR_3)\n{", "BDRVQcow2State *s = VAR_0->opaque;", "uint64_t *l1_table, *l2_table, l2_offset, offset, l1_size2, refcount;", "bool l1_allocated = false;", "int64_t old_offset, old_l2_offset;", "int VAR_4, VAR_5, VAR_6 = 0, VAR_7;", "int VAR_8;", "assert(VAR_3 >= -1 && VAR_3 <= 1);", "l2_table = NULL;", "l1_table = NULL;", "l1_size2 = VAR_2 * sizeof(uint64_t);", "s->cache_discards = true;", "if (VAR_1 != s->VAR_1) {", "l1_table = g_try_malloc0(align_offset(l1_size2, 512));", "if (l1_size2 && l1_table == NULL) {", "VAR_8 = -ENOMEM;", "goto fail;", "}", "l1_allocated = true;", "VAR_8 = bdrv_pread(VAR_0->file, VAR_1, l1_table, l1_size2);", "if (VAR_8 < 0) {", "goto fail;", "}", "for(VAR_4 = 0;VAR_4 < VAR_2; VAR_4++)", "be64_to_cpus(&l1_table[VAR_4]);", "} else {", "assert(VAR_2 == s->VAR_2);", "l1_table = s->l1_table;", "l1_allocated = false;", "}", "for(VAR_4 = 0; VAR_4 < VAR_2; VAR_4++) {", "l2_offset = l1_table[VAR_4];", "if (l2_offset) {", "old_l2_offset = l2_offset;", "l2_offset &= L1E_OFFSET_MASK;", "if (offset_into_cluster(s, l2_offset)) {", "qcow2_signal_corruption(VAR_0, true, -1, -1, \"L2 table offset %#\"\nPRIx64 \" unaligned (L1 index: %#x)\",\nl2_offset, VAR_4);", "VAR_8 = -EIO;", "goto fail;", "}", "VAR_8 = qcow2_cache_get(VAR_0, s->l2_table_cache, l2_offset,\n(void**) &l2_table);", "if (VAR_8 < 0) {", "goto fail;", "}", "for(VAR_5 = 0; VAR_5 < s->l2_size; VAR_5++) {", "uint64_t cluster_index;", "offset = be64_to_cpu(l2_table[VAR_5]);", "old_offset = offset;", "offset &= ~QCOW_OFLAG_COPIED;", "switch (qcow2_get_cluster_type(offset)) {", "case QCOW2_CLUSTER_COMPRESSED:\nVAR_7 = ((offset >> s->csize_shift) &\ns->csize_mask) + 1;", "if (VAR_3 != 0) {", "VAR_8 = update_refcount(VAR_0,\n(offset & s->cluster_offset_mask) & ~511,\nVAR_7 * 512, abs(VAR_3), VAR_3 < 0,\nQCOW2_DISCARD_SNAPSHOT);", "if (VAR_8 < 0) {", "goto fail;", "}", "}", "refcount = 2;", "break;", "case QCOW2_CLUSTER_NORMAL:\ncase QCOW2_CLUSTER_ZERO:\nif (offset_into_cluster(s, offset & L2E_OFFSET_MASK)) {", "qcow2_signal_corruption(VAR_0, true, -1, -1, \"Data \"\n\"cluster offset %#llx \"\n\"unaligned (L2 offset: %#\"\nPRIx64 \", L2 index: %#x)\",\noffset & L2E_OFFSET_MASK,\nl2_offset, VAR_5);", "VAR_8 = -EIO;", "goto fail;", "}", "cluster_index = (offset & L2E_OFFSET_MASK) >> s->cluster_bits;", "if (!cluster_index) {", "refcount = 0;", "break;", "}", "if (VAR_3 != 0) {", "VAR_8 = qcow2_update_cluster_refcount(VAR_0,\ncluster_index, abs(VAR_3), VAR_3 < 0,\nQCOW2_DISCARD_SNAPSHOT);", "if (VAR_8 < 0) {", "goto fail;", "}", "}", "VAR_8 = qcow2_get_refcount(VAR_0, cluster_index, &refcount);", "if (VAR_8 < 0) {", "goto fail;", "}", "break;", "case QCOW2_CLUSTER_UNALLOCATED:\nrefcount = 0;", "break;", "default:\nabort();", "}", "if (refcount == 1) {", "offset |= QCOW_OFLAG_COPIED;", "}", "if (offset != old_offset) {", "if (VAR_3 > 0) {", "qcow2_cache_set_dependency(VAR_0, s->l2_table_cache,\ns->refcount_block_cache);", "}", "l2_table[VAR_5] = cpu_to_be64(offset);", "qcow2_cache_entry_mark_dirty(VAR_0, s->l2_table_cache,\nl2_table);", "}", "}", "qcow2_cache_put(VAR_0, s->l2_table_cache, (void **) &l2_table);", "if (VAR_3 != 0) {", "VAR_8 = qcow2_update_cluster_refcount(VAR_0, l2_offset >>\ns->cluster_bits,\nabs(VAR_3), VAR_3 < 0,\nQCOW2_DISCARD_SNAPSHOT);", "if (VAR_8 < 0) {", "goto fail;", "}", "}", "VAR_8 = qcow2_get_refcount(VAR_0, l2_offset >> s->cluster_bits,\n&refcount);", "if (VAR_8 < 0) {", "goto fail;", "} else if (refcount == 1) {", "l2_offset |= QCOW_OFLAG_COPIED;", "}", "if (l2_offset != old_l2_offset) {", "l1_table[VAR_4] = l2_offset;", "VAR_6 = 1;", "}", "}", "}", "VAR_8 = bdrv_flush(VAR_0);", "fail:\nif (l2_table) {", "qcow2_cache_put(VAR_0, s->l2_table_cache, (void**) &l2_table);", "}", "s->cache_discards = false;", "qcow2_process_discards(VAR_0, VAR_8);", "if (VAR_8 == 0 && VAR_3 >= 0 && VAR_6) {", "for (VAR_4 = 0; VAR_4 < VAR_2; VAR_4++) {", "cpu_to_be64s(&l1_table[VAR_4]);", "}", "VAR_8 = bdrv_pwrite_sync(VAR_0->file, VAR_1,\nl1_table, l1_size2);", "for (VAR_4 = 0; VAR_4 < VAR_2; VAR_4++) {", "be64_to_cpus(&l1_table[VAR_4]);", "}", "}", "if (l1_allocated)\ng_free(l1_table);", "return VAR_8;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 97 ], [ 99, 101, 103 ], [ 105 ], [ 107 ], [ 109 ], [ 113, 115 ], [ 117 ], [ 119 ], [ 121 ], [ 125 ], [ 127 ], [ 131 ], [ 133 ], [ 135 ], [ 139 ], [ 141, 143, 145 ], [ 147 ], [ 149, 151, 153, 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 167 ], [ 169 ], [ 173, 175, 177 ], [ 179, 181, 183, 185, 187, 189 ], [ 191 ], [ 193 ], [ 195 ], [ 199 ], [ 201 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213, 215, 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 241, 243 ], [ 245 ], [ 249, 251 ], [ 253 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267, 269 ], [ 271 ], [ 273 ], [ 275, 277 ], [ 279 ], [ 281 ], [ 285 ], [ 289 ], [ 291, 293, 295, 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305 ], [ 307, 309 ], [ 311 ], [ 313 ], [ 315 ], [ 317 ], [ 319 ], [ 321 ], [ 323 ], [ 325 ], [ 327 ], [ 329 ], [ 331 ], [ 335 ], [ 337, 339 ], [ 341 ], [ 343 ], [ 347 ], [ 349 ], [ 355 ], [ 357 ], [ 359 ], [ 361 ], [ 365, 367 ], [ 371 ], [ 373 ], [ 375 ], [ 377 ], [ 379, 381 ], [ 383 ], [ 385 ] ]
6,616
static int enable_write_target(BDRVVVFATState *s, Error **errp) { BlockDriver *bdrv_qcow = NULL; QemuOpts *opts = NULL; int ret; int size = sector2cluster(s, s->sector_count); s->used_clusters = calloc(size, 1); array_init(&(s->commits), sizeof(commit_t)); s->qcow_filename = g_malloc(1024); ret = get_tmp_filename(s->qcow_filename, 1024); if (ret < 0) { error_setg_errno(errp, -ret, "can't create temporary file"); goto err; } bdrv_qcow = bdrv_find_format("qcow"); if (!bdrv_qcow) { error_setg(errp, "Failed to locate qcow driver"); ret = -ENOENT; goto err; } opts = qemu_opts_create(bdrv_qcow->create_opts, NULL, 0, &error_abort); qemu_opt_set_number(opts, BLOCK_OPT_SIZE, s->sector_count * 512); qemu_opt_set(opts, BLOCK_OPT_BACKING_FILE, "fat:"); ret = bdrv_create(bdrv_qcow, s->qcow_filename, opts, errp); qemu_opts_del(opts); if (ret < 0) { goto err; } s->qcow = NULL; ret = bdrv_open(&s->qcow, s->qcow_filename, NULL, NULL, BDRV_O_RDWR | BDRV_O_CACHE_WB | BDRV_O_NO_FLUSH, bdrv_qcow, errp); if (ret < 0) { goto err; } #ifndef _WIN32 unlink(s->qcow_filename); #endif bdrv_set_backing_hd(s->bs, bdrv_new()); s->bs->backing_hd->drv = &vvfat_write_target; s->bs->backing_hd->opaque = g_new(void *, 1); *(void**)s->bs->backing_hd->opaque = s; return 0; err: g_free(s->qcow_filename); s->qcow_filename = NULL; return ret; }
false
qemu
9a29e18f7dfd5a0e80d1c60fc856ebba18ddb738
static int enable_write_target(BDRVVVFATState *s, Error **errp) { BlockDriver *bdrv_qcow = NULL; QemuOpts *opts = NULL; int ret; int size = sector2cluster(s, s->sector_count); s->used_clusters = calloc(size, 1); array_init(&(s->commits), sizeof(commit_t)); s->qcow_filename = g_malloc(1024); ret = get_tmp_filename(s->qcow_filename, 1024); if (ret < 0) { error_setg_errno(errp, -ret, "can't create temporary file"); goto err; } bdrv_qcow = bdrv_find_format("qcow"); if (!bdrv_qcow) { error_setg(errp, "Failed to locate qcow driver"); ret = -ENOENT; goto err; } opts = qemu_opts_create(bdrv_qcow->create_opts, NULL, 0, &error_abort); qemu_opt_set_number(opts, BLOCK_OPT_SIZE, s->sector_count * 512); qemu_opt_set(opts, BLOCK_OPT_BACKING_FILE, "fat:"); ret = bdrv_create(bdrv_qcow, s->qcow_filename, opts, errp); qemu_opts_del(opts); if (ret < 0) { goto err; } s->qcow = NULL; ret = bdrv_open(&s->qcow, s->qcow_filename, NULL, NULL, BDRV_O_RDWR | BDRV_O_CACHE_WB | BDRV_O_NO_FLUSH, bdrv_qcow, errp); if (ret < 0) { goto err; } #ifndef _WIN32 unlink(s->qcow_filename); #endif bdrv_set_backing_hd(s->bs, bdrv_new()); s->bs->backing_hd->drv = &vvfat_write_target; s->bs->backing_hd->opaque = g_new(void *, 1); *(void**)s->bs->backing_hd->opaque = s; return 0; err: g_free(s->qcow_filename); s->qcow_filename = NULL; return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(BDRVVVFATState *VAR_0, Error **VAR_1) { BlockDriver *bdrv_qcow = NULL; QemuOpts *opts = NULL; int VAR_2; int VAR_3 = sector2cluster(VAR_0, VAR_0->sector_count); VAR_0->used_clusters = calloc(VAR_3, 1); array_init(&(VAR_0->commits), sizeof(commit_t)); VAR_0->qcow_filename = g_malloc(1024); VAR_2 = get_tmp_filename(VAR_0->qcow_filename, 1024); if (VAR_2 < 0) { error_setg_errno(VAR_1, -VAR_2, "can't create temporary file"); goto err; } bdrv_qcow = bdrv_find_format("qcow"); if (!bdrv_qcow) { error_setg(VAR_1, "Failed to locate qcow driver"); VAR_2 = -ENOENT; goto err; } opts = qemu_opts_create(bdrv_qcow->create_opts, NULL, 0, &error_abort); qemu_opt_set_number(opts, BLOCK_OPT_SIZE, VAR_0->sector_count * 512); qemu_opt_set(opts, BLOCK_OPT_BACKING_FILE, "fat:"); VAR_2 = bdrv_create(bdrv_qcow, VAR_0->qcow_filename, opts, VAR_1); qemu_opts_del(opts); if (VAR_2 < 0) { goto err; } VAR_0->qcow = NULL; VAR_2 = bdrv_open(&VAR_0->qcow, VAR_0->qcow_filename, NULL, NULL, BDRV_O_RDWR | BDRV_O_CACHE_WB | BDRV_O_NO_FLUSH, bdrv_qcow, VAR_1); if (VAR_2 < 0) { goto err; } #ifndef _WIN32 unlink(VAR_0->qcow_filename); #endif bdrv_set_backing_hd(VAR_0->bs, bdrv_new()); VAR_0->bs->backing_hd->drv = &vvfat_write_target; VAR_0->bs->backing_hd->opaque = g_new(void *, 1); *(void**)VAR_0->bs->backing_hd->opaque = VAR_0; return 0; err: g_free(VAR_0->qcow_filename); VAR_0->qcow_filename = NULL; return VAR_2; }
[ "static int FUNC_0(BDRVVVFATState *VAR_0, Error **VAR_1)\n{", "BlockDriver *bdrv_qcow = NULL;", "QemuOpts *opts = NULL;", "int VAR_2;", "int VAR_3 = sector2cluster(VAR_0, VAR_0->sector_count);", "VAR_0->used_clusters = calloc(VAR_3, 1);", "array_init(&(VAR_0->commits), sizeof(commit_t));", "VAR_0->qcow_filename = g_malloc(1024);", "VAR_2 = get_tmp_filename(VAR_0->qcow_filename, 1024);", "if (VAR_2 < 0) {", "error_setg_errno(VAR_1, -VAR_2, \"can't create temporary file\");", "goto err;", "}", "bdrv_qcow = bdrv_find_format(\"qcow\");", "if (!bdrv_qcow) {", "error_setg(VAR_1, \"Failed to locate qcow driver\");", "VAR_2 = -ENOENT;", "goto err;", "}", "opts = qemu_opts_create(bdrv_qcow->create_opts, NULL, 0, &error_abort);", "qemu_opt_set_number(opts, BLOCK_OPT_SIZE, VAR_0->sector_count * 512);", "qemu_opt_set(opts, BLOCK_OPT_BACKING_FILE, \"fat:\");", "VAR_2 = bdrv_create(bdrv_qcow, VAR_0->qcow_filename, opts, VAR_1);", "qemu_opts_del(opts);", "if (VAR_2 < 0) {", "goto err;", "}", "VAR_0->qcow = NULL;", "VAR_2 = bdrv_open(&VAR_0->qcow, VAR_0->qcow_filename, NULL, NULL,\nBDRV_O_RDWR | BDRV_O_CACHE_WB | BDRV_O_NO_FLUSH,\nbdrv_qcow, VAR_1);", "if (VAR_2 < 0) {", "goto err;", "}", "#ifndef _WIN32\nunlink(VAR_0->qcow_filename);", "#endif\nbdrv_set_backing_hd(VAR_0->bs, bdrv_new());", "VAR_0->bs->backing_hd->drv = &vvfat_write_target;", "VAR_0->bs->backing_hd->opaque = g_new(void *, 1);", "*(void**)VAR_0->bs->backing_hd->opaque = VAR_0;", "return 0;", "err:\ng_free(VAR_0->qcow_filename);", "VAR_0->qcow_filename = NULL;", "return VAR_2;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71, 73, 75 ], [ 77 ], [ 79 ], [ 81 ], [ 85, 87 ], [ 89, 93 ], [ 95 ], [ 97 ], [ 99 ], [ 103 ], [ 107, 109 ], [ 111 ], [ 113 ], [ 115 ] ]
6,617
static void dca_init_vlcs(void) { static int vlcs_inited = 0; int i, j; if (vlcs_inited) return; dca_bitalloc_index.offset = 1; dca_bitalloc_index.wrap = 2; for (i = 0; i < 5; i++) init_vlc(&dca_bitalloc_index.vlc[i], bitalloc_12_vlc_bits[i], 12, bitalloc_12_bits[i], 1, 1, bitalloc_12_codes[i], 2, 2, 1); dca_scalefactor.offset = -64; dca_scalefactor.wrap = 2; for (i = 0; i < 5; i++) init_vlc(&dca_scalefactor.vlc[i], SCALES_VLC_BITS, 129, scales_bits[i], 1, 1, scales_codes[i], 2, 2, 1); dca_tmode.offset = 0; dca_tmode.wrap = 1; for (i = 0; i < 4; i++) init_vlc(&dca_tmode.vlc[i], tmode_vlc_bits[i], 4, tmode_bits[i], 1, 1, tmode_codes[i], 2, 2, 1); for(i = 0; i < 10; i++) for(j = 0; j < 7; j++){ if(!bitalloc_codes[i][j]) break; dca_smpl_bitalloc[i+1].offset = bitalloc_offsets[i]; dca_smpl_bitalloc[i+1].wrap = 1 + (j > 4); init_vlc(&dca_smpl_bitalloc[i+1].vlc[j], bitalloc_maxbits[i][j], bitalloc_sizes[i], bitalloc_bits[i][j], 1, 1, bitalloc_codes[i][j], 2, 2, 1); } vlcs_inited = 1; }
false
FFmpeg
5e53486545726987ab4482321d4dcf7e23e7652f
static void dca_init_vlcs(void) { static int vlcs_inited = 0; int i, j; if (vlcs_inited) return; dca_bitalloc_index.offset = 1; dca_bitalloc_index.wrap = 2; for (i = 0; i < 5; i++) init_vlc(&dca_bitalloc_index.vlc[i], bitalloc_12_vlc_bits[i], 12, bitalloc_12_bits[i], 1, 1, bitalloc_12_codes[i], 2, 2, 1); dca_scalefactor.offset = -64; dca_scalefactor.wrap = 2; for (i = 0; i < 5; i++) init_vlc(&dca_scalefactor.vlc[i], SCALES_VLC_BITS, 129, scales_bits[i], 1, 1, scales_codes[i], 2, 2, 1); dca_tmode.offset = 0; dca_tmode.wrap = 1; for (i = 0; i < 4; i++) init_vlc(&dca_tmode.vlc[i], tmode_vlc_bits[i], 4, tmode_bits[i], 1, 1, tmode_codes[i], 2, 2, 1); for(i = 0; i < 10; i++) for(j = 0; j < 7; j++){ if(!bitalloc_codes[i][j]) break; dca_smpl_bitalloc[i+1].offset = bitalloc_offsets[i]; dca_smpl_bitalloc[i+1].wrap = 1 + (j > 4); init_vlc(&dca_smpl_bitalloc[i+1].vlc[j], bitalloc_maxbits[i][j], bitalloc_sizes[i], bitalloc_bits[i][j], 1, 1, bitalloc_codes[i][j], 2, 2, 1); } vlcs_inited = 1; }
{ "code": [], "line_no": [] }
static void FUNC_0(void) { static int VAR_0 = 0; int VAR_1, VAR_2; if (VAR_0) return; dca_bitalloc_index.offset = 1; dca_bitalloc_index.wrap = 2; for (VAR_1 = 0; VAR_1 < 5; VAR_1++) init_vlc(&dca_bitalloc_index.vlc[VAR_1], bitalloc_12_vlc_bits[VAR_1], 12, bitalloc_12_bits[VAR_1], 1, 1, bitalloc_12_codes[VAR_1], 2, 2, 1); dca_scalefactor.offset = -64; dca_scalefactor.wrap = 2; for (VAR_1 = 0; VAR_1 < 5; VAR_1++) init_vlc(&dca_scalefactor.vlc[VAR_1], SCALES_VLC_BITS, 129, scales_bits[VAR_1], 1, 1, scales_codes[VAR_1], 2, 2, 1); dca_tmode.offset = 0; dca_tmode.wrap = 1; for (VAR_1 = 0; VAR_1 < 4; VAR_1++) init_vlc(&dca_tmode.vlc[VAR_1], tmode_vlc_bits[VAR_1], 4, tmode_bits[VAR_1], 1, 1, tmode_codes[VAR_1], 2, 2, 1); for(VAR_1 = 0; VAR_1 < 10; VAR_1++) for(VAR_2 = 0; VAR_2 < 7; VAR_2++){ if(!bitalloc_codes[VAR_1][VAR_2]) break; dca_smpl_bitalloc[VAR_1+1].offset = bitalloc_offsets[VAR_1]; dca_smpl_bitalloc[VAR_1+1].wrap = 1 + (VAR_2 > 4); init_vlc(&dca_smpl_bitalloc[VAR_1+1].vlc[VAR_2], bitalloc_maxbits[VAR_1][VAR_2], bitalloc_sizes[VAR_1], bitalloc_bits[VAR_1][VAR_2], 1, 1, bitalloc_codes[VAR_1][VAR_2], 2, 2, 1); } VAR_0 = 1; }
[ "static void FUNC_0(void)\n{", "static int VAR_0 = 0;", "int VAR_1, VAR_2;", "if (VAR_0)\nreturn;", "dca_bitalloc_index.offset = 1;", "dca_bitalloc_index.wrap = 2;", "for (VAR_1 = 0; VAR_1 < 5; VAR_1++)", "init_vlc(&dca_bitalloc_index.vlc[VAR_1], bitalloc_12_vlc_bits[VAR_1], 12,\nbitalloc_12_bits[VAR_1], 1, 1,\nbitalloc_12_codes[VAR_1], 2, 2, 1);", "dca_scalefactor.offset = -64;", "dca_scalefactor.wrap = 2;", "for (VAR_1 = 0; VAR_1 < 5; VAR_1++)", "init_vlc(&dca_scalefactor.vlc[VAR_1], SCALES_VLC_BITS, 129,\nscales_bits[VAR_1], 1, 1,\nscales_codes[VAR_1], 2, 2, 1);", "dca_tmode.offset = 0;", "dca_tmode.wrap = 1;", "for (VAR_1 = 0; VAR_1 < 4; VAR_1++)", "init_vlc(&dca_tmode.vlc[VAR_1], tmode_vlc_bits[VAR_1], 4,\ntmode_bits[VAR_1], 1, 1,\ntmode_codes[VAR_1], 2, 2, 1);", "for(VAR_1 = 0; VAR_1 < 10; VAR_1++)", "for(VAR_2 = 0; VAR_2 < 7; VAR_2++){", "if(!bitalloc_codes[VAR_1][VAR_2]) break;", "dca_smpl_bitalloc[VAR_1+1].offset = bitalloc_offsets[VAR_1];", "dca_smpl_bitalloc[VAR_1+1].wrap = 1 + (VAR_2 > 4);", "init_vlc(&dca_smpl_bitalloc[VAR_1+1].vlc[VAR_2], bitalloc_maxbits[VAR_1][VAR_2],\nbitalloc_sizes[VAR_1],\nbitalloc_bits[VAR_1][VAR_2], 1, 1,\nbitalloc_codes[VAR_1][VAR_2], 2, 2, 1);", "}", "VAR_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 ], [ 17 ], [ 19 ], [ 21 ], [ 23, 25, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35, 37, 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47, 49, 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65, 67, 69, 71 ], [ 73 ], [ 75 ], [ 77 ] ]
6,620
static inline int is_yuv_planar(PixFmtInfo *ps) { return (ps->color_type == FF_COLOR_YUV || ps->color_type == FF_COLOR_YUV_JPEG) && !ps->is_packed; }
false
FFmpeg
7e7e59409294af9caa63808e56c5cc824c98b4fc
static inline int is_yuv_planar(PixFmtInfo *ps) { return (ps->color_type == FF_COLOR_YUV || ps->color_type == FF_COLOR_YUV_JPEG) && !ps->is_packed; }
{ "code": [], "line_no": [] }
static inline int FUNC_0(PixFmtInfo *VAR_0) { return (VAR_0->color_type == FF_COLOR_YUV || VAR_0->color_type == FF_COLOR_YUV_JPEG) && !VAR_0->is_packed; }
[ "static inline int FUNC_0(PixFmtInfo *VAR_0)\n{", "return (VAR_0->color_type == FF_COLOR_YUV ||\nVAR_0->color_type == FF_COLOR_YUV_JPEG) && !VAR_0->is_packed;", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9 ] ]
6,621
AVFilter *avfilter_get_by_name(const char *name) { int i; for (i = 0; registered_avfilters[i]; i++) if (!strcmp(registered_avfilters[i]->name, name)) return registered_avfilters[i]; return NULL; }
false
FFmpeg
fa2a34cd40d124161c748bb0f430dc63c94dd0da
AVFilter *avfilter_get_by_name(const char *name) { int i; for (i = 0; registered_avfilters[i]; i++) if (!strcmp(registered_avfilters[i]->name, name)) return registered_avfilters[i]; return NULL; }
{ "code": [], "line_no": [] }
AVFilter *FUNC_0(const char *name) { int VAR_0; for (VAR_0 = 0; registered_avfilters[VAR_0]; VAR_0++) if (!strcmp(registered_avfilters[VAR_0]->name, name)) return registered_avfilters[VAR_0]; return NULL; }
[ "AVFilter *FUNC_0(const char *name)\n{", "int VAR_0;", "for (VAR_0 = 0; registered_avfilters[VAR_0]; VAR_0++)", "if (!strcmp(registered_avfilters[VAR_0]->name, name))\nreturn registered_avfilters[VAR_0];", "return NULL;", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11, 13 ], [ 17 ], [ 19 ] ]
6,623
static int output_frame(H264Context *h, AVFrame *dst, AVFrame *src) { int i; int ret = av_frame_ref(dst, src); if (ret < 0) return ret; if (!h->sps.crop) return 0; for (i = 0; i < 3; i++) { int hshift = (i > 0) ? h->chroma_x_shift : 0; int vshift = (i > 0) ? h->chroma_y_shift : 0; int off = ((h->sps.crop_left >> hshift) << h->pixel_shift) + (h->sps.crop_top >> vshift) * dst->linesize[i]; dst->data[i] += off; } return 0; }
false
FFmpeg
3176217c60ca7828712985092d9102d331ea4f3d
static int output_frame(H264Context *h, AVFrame *dst, AVFrame *src) { int i; int ret = av_frame_ref(dst, src); if (ret < 0) return ret; if (!h->sps.crop) return 0; for (i = 0; i < 3; i++) { int hshift = (i > 0) ? h->chroma_x_shift : 0; int vshift = (i > 0) ? h->chroma_y_shift : 0; int off = ((h->sps.crop_left >> hshift) << h->pixel_shift) + (h->sps.crop_top >> vshift) * dst->linesize[i]; dst->data[i] += off; } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(H264Context *VAR_0, AVFrame *VAR_1, AVFrame *VAR_2) { int VAR_3; int VAR_4 = av_frame_ref(VAR_1, VAR_2); if (VAR_4 < 0) return VAR_4; if (!VAR_0->sps.crop) return 0; for (VAR_3 = 0; VAR_3 < 3; VAR_3++) { int VAR_5 = (VAR_3 > 0) ? VAR_0->chroma_x_shift : 0; int VAR_6 = (VAR_3 > 0) ? VAR_0->chroma_y_shift : 0; int VAR_7 = ((VAR_0->sps.crop_left >> VAR_5) << VAR_0->pixel_shift) + (VAR_0->sps.crop_top >> VAR_6) * VAR_1->linesize[VAR_3]; VAR_1->data[VAR_3] += VAR_7; } return 0; }
[ "static int FUNC_0(H264Context *VAR_0, AVFrame *VAR_1, AVFrame *VAR_2)\n{", "int VAR_3;", "int VAR_4 = av_frame_ref(VAR_1, VAR_2);", "if (VAR_4 < 0)\nreturn VAR_4;", "if (!VAR_0->sps.crop)\nreturn 0;", "for (VAR_3 = 0; VAR_3 < 3; VAR_3++) {", "int VAR_5 = (VAR_3 > 0) ? VAR_0->chroma_x_shift : 0;", "int VAR_6 = (VAR_3 > 0) ? VAR_0->chroma_y_shift : 0;", "int VAR_7 = ((VAR_0->sps.crop_left >> VAR_5) << VAR_0->pixel_shift) +\n(VAR_0->sps.crop_top >> VAR_6) * VAR_1->linesize[VAR_3];", "VAR_1->data[VAR_3] += VAR_7;", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9, 11 ], [ 15, 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ] ]
6,624
static inline void futex_wake(QemuEvent *ev, int n) { if (n == 1) { pthread_cond_signal(&ev->cond); } else { pthread_cond_broadcast(&ev->cond); } }
true
qemu
158ef8cbb7e0fe8bb430310924b8bebe5f186e6e
static inline void futex_wake(QemuEvent *ev, int n) { if (n == 1) { pthread_cond_signal(&ev->cond); } else { pthread_cond_broadcast(&ev->cond); } }
{ "code": [], "line_no": [] }
static inline void FUNC_0(QemuEvent *VAR_0, int VAR_1) { if (VAR_1 == 1) { pthread_cond_signal(&VAR_0->cond); } else { pthread_cond_broadcast(&VAR_0->cond); } }
[ "static inline void FUNC_0(QemuEvent *VAR_0, int VAR_1)\n{", "if (VAR_1 == 1) {", "pthread_cond_signal(&VAR_0->cond);", "} else {", "pthread_cond_broadcast(&VAR_0->cond);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 6 ], [ 8 ], [ 10 ], [ 12 ], [ 14 ], [ 17 ] ]
6,625
void vnc_flush(VncState *vs) { if (vs->output.offset) vnc_client_write(vs); }
true
qemu
198a0039c5fca224a77e9761e2350dd9cc102ad0
void vnc_flush(VncState *vs) { if (vs->output.offset) vnc_client_write(vs); }
{ "code": [ " if (vs->output.offset)" ], "line_no": [ 5 ] }
void FUNC_0(VncState *VAR_0) { if (VAR_0->output.offset) vnc_client_write(VAR_0); }
[ "void FUNC_0(VncState *VAR_0)\n{", "if (VAR_0->output.offset)\nvnc_client_write(VAR_0);", "}" ]
[ 0, 1, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9 ] ]
6,629
static void get_private_data(OutputStream *os) { AVCodecContext *codec = os->ctx->streams[0]->codec; uint8_t *ptr = codec->extradata; int size = codec->extradata_size; int i; if (codec->codec_id == AV_CODEC_ID_H264) { ff_avc_write_annexb_extradata(ptr, &ptr, &size); if (!ptr) ptr = codec->extradata; } if (!ptr) return; os->private_str = av_mallocz(2*size + 1); if (!os->private_str) return; for (i = 0; i < size; i++) snprintf(&os->private_str[2*i], 3, "%02x", ptr[i]); if (ptr != codec->extradata) av_free(ptr); }
true
FFmpeg
a863c97e99bf30a88baa74f83bab9e3ab25984dc
static void get_private_data(OutputStream *os) { AVCodecContext *codec = os->ctx->streams[0]->codec; uint8_t *ptr = codec->extradata; int size = codec->extradata_size; int i; if (codec->codec_id == AV_CODEC_ID_H264) { ff_avc_write_annexb_extradata(ptr, &ptr, &size); if (!ptr) ptr = codec->extradata; } if (!ptr) return; os->private_str = av_mallocz(2*size + 1); if (!os->private_str) return; for (i = 0; i < size; i++) snprintf(&os->private_str[2*i], 3, "%02x", ptr[i]); if (ptr != codec->extradata) av_free(ptr); }
{ "code": [], "line_no": [] }
static void FUNC_0(OutputStream *VAR_0) { AVCodecContext *codec = VAR_0->ctx->streams[0]->codec; uint8_t *ptr = codec->extradata; int VAR_1 = codec->extradata_size; int VAR_2; if (codec->codec_id == AV_CODEC_ID_H264) { ff_avc_write_annexb_extradata(ptr, &ptr, &VAR_1); if (!ptr) ptr = codec->extradata; } if (!ptr) return; VAR_0->private_str = av_mallocz(2*VAR_1 + 1); if (!VAR_0->private_str) return; for (VAR_2 = 0; VAR_2 < VAR_1; VAR_2++) snprintf(&VAR_0->private_str[2*VAR_2], 3, "%02x", ptr[VAR_2]); if (ptr != codec->extradata) av_free(ptr); }
[ "static void FUNC_0(OutputStream *VAR_0)\n{", "AVCodecContext *codec = VAR_0->ctx->streams[0]->codec;", "uint8_t *ptr = codec->extradata;", "int VAR_1 = codec->extradata_size;", "int VAR_2;", "if (codec->codec_id == AV_CODEC_ID_H264) {", "ff_avc_write_annexb_extradata(ptr, &ptr, &VAR_1);", "if (!ptr)\nptr = codec->extradata;", "}", "if (!ptr)\nreturn;", "VAR_0->private_str = av_mallocz(2*VAR_1 + 1);", "if (!VAR_0->private_str)\nreturn;", "for (VAR_2 = 0; VAR_2 < VAR_1; VAR_2++)", "snprintf(&VAR_0->private_str[2*VAR_2], 3, \"%02x\", ptr[VAR_2]);", "if (ptr != codec->extradata)\nav_free(ptr);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17, 19 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 29, 31 ], [ 33 ], [ 35 ], [ 37, 39 ], [ 41 ] ]
6,631
static int bdrv_qed_open(BlockDriverState *bs, int flags) { BDRVQEDState *s = bs->opaque; QEDHeader le_header; int64_t file_size; int ret; s->bs = bs; QSIMPLEQ_INIT(&s->allocating_write_reqs); ret = bdrv_pread(bs->file, 0, &le_header, sizeof(le_header)); if (ret < 0) { return ret; } ret = 0; /* ret should always be 0 or -errno */ qed_header_le_to_cpu(&le_header, &s->header); if (s->header.magic != QED_MAGIC) { return -EINVAL; } if (s->header.features & ~QED_FEATURE_MASK) { /* image uses unsupported feature bits */ char buf[64]; snprintf(buf, sizeof(buf), "%" PRIx64, s->header.features & ~QED_FEATURE_MASK); qerror_report(QERR_UNKNOWN_BLOCK_FORMAT_FEATURE, bs->device_name, "QED", buf); return -ENOTSUP; } if (!qed_is_cluster_size_valid(s->header.cluster_size)) { return -EINVAL; } /* Round down file size to the last cluster */ file_size = bdrv_getlength(bs->file); if (file_size < 0) { return file_size; } s->file_size = qed_start_of_cluster(s, file_size); if (!qed_is_table_size_valid(s->header.table_size)) { return -EINVAL; } if (!qed_is_image_size_valid(s->header.image_size, s->header.cluster_size, s->header.table_size)) { return -EINVAL; } if (!qed_check_table_offset(s, s->header.l1_table_offset)) { return -EINVAL; } s->table_nelems = (s->header.cluster_size * s->header.table_size) / sizeof(uint64_t); s->l2_shift = ffs(s->header.cluster_size) - 1; s->l2_mask = s->table_nelems - 1; s->l1_shift = s->l2_shift + ffs(s->table_nelems) - 1; if ((s->header.features & QED_F_BACKING_FILE)) { if ((uint64_t)s->header.backing_filename_offset + s->header.backing_filename_size > s->header.cluster_size * s->header.header_size) { return -EINVAL; } ret = qed_read_string(bs->file, s->header.backing_filename_offset, s->header.backing_filename_size, bs->backing_file, sizeof(bs->backing_file)); if (ret < 0) { return ret; } if (s->header.features & QED_F_BACKING_FORMAT_NO_PROBE) { pstrcpy(bs->backing_format, sizeof(bs->backing_format), "raw"); } } /* Reset unknown autoclear feature bits. This is a backwards * compatibility mechanism that allows images to be opened by older * programs, which "knock out" unknown feature bits. When an image is * opened by a newer program again it can detect that the autoclear * feature is no longer valid. */ if ((s->header.autoclear_features & ~QED_AUTOCLEAR_FEATURE_MASK) != 0 && !bdrv_is_read_only(bs->file)) { s->header.autoclear_features &= QED_AUTOCLEAR_FEATURE_MASK; ret = qed_write_header_sync(s); if (ret) { return ret; } /* From here on only known autoclear feature bits are valid */ bdrv_flush(bs->file); } s->l1_table = qed_alloc_table(s); qed_init_l2_cache(&s->l2_cache); ret = qed_read_l1_table_sync(s); if (ret) { goto out; } /* If image was not closed cleanly, check consistency */ if (s->header.features & QED_F_NEED_CHECK) { /* Read-only images cannot be fixed. There is no risk of corruption * since write operations are not possible. Therefore, allow * potentially inconsistent images to be opened read-only. This can * aid data recovery from an otherwise inconsistent image. */ if (!bdrv_is_read_only(bs->file)) { BdrvCheckResult result = {0}; ret = qed_check(s, &result, true); if (!ret && !result.corruptions && !result.check_errors) { /* Ensure fixes reach storage before clearing check bit */ bdrv_flush(s->bs); s->header.features &= ~QED_F_NEED_CHECK; qed_write_header_sync(s); } } } out: if (ret) { qed_free_l2_cache(&s->l2_cache); qemu_vfree(s->l1_table); } return ret; }
true
qemu
6f321e93abb27b4e7ceb228b4204aa304e95daad
static int bdrv_qed_open(BlockDriverState *bs, int flags) { BDRVQEDState *s = bs->opaque; QEDHeader le_header; int64_t file_size; int ret; s->bs = bs; QSIMPLEQ_INIT(&s->allocating_write_reqs); ret = bdrv_pread(bs->file, 0, &le_header, sizeof(le_header)); if (ret < 0) { return ret; } ret = 0; qed_header_le_to_cpu(&le_header, &s->header); if (s->header.magic != QED_MAGIC) { return -EINVAL; } if (s->header.features & ~QED_FEATURE_MASK) { char buf[64]; snprintf(buf, sizeof(buf), "%" PRIx64, s->header.features & ~QED_FEATURE_MASK); qerror_report(QERR_UNKNOWN_BLOCK_FORMAT_FEATURE, bs->device_name, "QED", buf); return -ENOTSUP; } if (!qed_is_cluster_size_valid(s->header.cluster_size)) { return -EINVAL; } file_size = bdrv_getlength(bs->file); if (file_size < 0) { return file_size; } s->file_size = qed_start_of_cluster(s, file_size); if (!qed_is_table_size_valid(s->header.table_size)) { return -EINVAL; } if (!qed_is_image_size_valid(s->header.image_size, s->header.cluster_size, s->header.table_size)) { return -EINVAL; } if (!qed_check_table_offset(s, s->header.l1_table_offset)) { return -EINVAL; } s->table_nelems = (s->header.cluster_size * s->header.table_size) / sizeof(uint64_t); s->l2_shift = ffs(s->header.cluster_size) - 1; s->l2_mask = s->table_nelems - 1; s->l1_shift = s->l2_shift + ffs(s->table_nelems) - 1; if ((s->header.features & QED_F_BACKING_FILE)) { if ((uint64_t)s->header.backing_filename_offset + s->header.backing_filename_size > s->header.cluster_size * s->header.header_size) { return -EINVAL; } ret = qed_read_string(bs->file, s->header.backing_filename_offset, s->header.backing_filename_size, bs->backing_file, sizeof(bs->backing_file)); if (ret < 0) { return ret; } if (s->header.features & QED_F_BACKING_FORMAT_NO_PROBE) { pstrcpy(bs->backing_format, sizeof(bs->backing_format), "raw"); } } if ((s->header.autoclear_features & ~QED_AUTOCLEAR_FEATURE_MASK) != 0 && !bdrv_is_read_only(bs->file)) { s->header.autoclear_features &= QED_AUTOCLEAR_FEATURE_MASK; ret = qed_write_header_sync(s); if (ret) { return ret; } bdrv_flush(bs->file); } s->l1_table = qed_alloc_table(s); qed_init_l2_cache(&s->l2_cache); ret = qed_read_l1_table_sync(s); if (ret) { goto out; } if (s->header.features & QED_F_NEED_CHECK) { if (!bdrv_is_read_only(bs->file)) { BdrvCheckResult result = {0}; ret = qed_check(s, &result, true); if (!ret && !result.corruptions && !result.check_errors) { bdrv_flush(s->bs); s->header.features &= ~QED_F_NEED_CHECK; qed_write_header_sync(s); } } } out: if (ret) { qed_free_l2_cache(&s->l2_cache); qemu_vfree(s->l1_table); } return ret; }
{ "code": [ " if (!ret && !result.corruptions && !result.check_errors) {" ], "line_no": [ 231 ] }
static int FUNC_0(BlockDriverState *VAR_0, int VAR_1) { BDRVQEDState *s = VAR_0->opaque; QEDHeader le_header; int64_t file_size; int VAR_2; s->VAR_0 = VAR_0; QSIMPLEQ_INIT(&s->allocating_write_reqs); VAR_2 = bdrv_pread(VAR_0->file, 0, &le_header, sizeof(le_header)); if (VAR_2 < 0) { return VAR_2; } VAR_2 = 0; qed_header_le_to_cpu(&le_header, &s->header); if (s->header.magic != QED_MAGIC) { return -EINVAL; } if (s->header.features & ~QED_FEATURE_MASK) { char VAR_3[64]; snprintf(VAR_3, sizeof(VAR_3), "%" PRIx64, s->header.features & ~QED_FEATURE_MASK); qerror_report(QERR_UNKNOWN_BLOCK_FORMAT_FEATURE, VAR_0->device_name, "QED", VAR_3); return -ENOTSUP; } if (!qed_is_cluster_size_valid(s->header.cluster_size)) { return -EINVAL; } file_size = bdrv_getlength(VAR_0->file); if (file_size < 0) { return file_size; } s->file_size = qed_start_of_cluster(s, file_size); if (!qed_is_table_size_valid(s->header.table_size)) { return -EINVAL; } if (!qed_is_image_size_valid(s->header.image_size, s->header.cluster_size, s->header.table_size)) { return -EINVAL; } if (!qed_check_table_offset(s, s->header.l1_table_offset)) { return -EINVAL; } s->table_nelems = (s->header.cluster_size * s->header.table_size) / sizeof(uint64_t); s->l2_shift = ffs(s->header.cluster_size) - 1; s->l2_mask = s->table_nelems - 1; s->l1_shift = s->l2_shift + ffs(s->table_nelems) - 1; if ((s->header.features & QED_F_BACKING_FILE)) { if ((uint64_t)s->header.backing_filename_offset + s->header.backing_filename_size > s->header.cluster_size * s->header.header_size) { return -EINVAL; } VAR_2 = qed_read_string(VAR_0->file, s->header.backing_filename_offset, s->header.backing_filename_size, VAR_0->backing_file, sizeof(VAR_0->backing_file)); if (VAR_2 < 0) { return VAR_2; } if (s->header.features & QED_F_BACKING_FORMAT_NO_PROBE) { pstrcpy(VAR_0->backing_format, sizeof(VAR_0->backing_format), "raw"); } } if ((s->header.autoclear_features & ~QED_AUTOCLEAR_FEATURE_MASK) != 0 && !bdrv_is_read_only(VAR_0->file)) { s->header.autoclear_features &= QED_AUTOCLEAR_FEATURE_MASK; VAR_2 = qed_write_header_sync(s); if (VAR_2) { return VAR_2; } bdrv_flush(VAR_0->file); } s->l1_table = qed_alloc_table(s); qed_init_l2_cache(&s->l2_cache); VAR_2 = qed_read_l1_table_sync(s); if (VAR_2) { goto out; } if (s->header.features & QED_F_NEED_CHECK) { if (!bdrv_is_read_only(VAR_0->file)) { BdrvCheckResult result = {0}; VAR_2 = qed_check(s, &result, true); if (!VAR_2 && !result.corruptions && !result.check_errors) { bdrv_flush(s->VAR_0); s->header.features &= ~QED_F_NEED_CHECK; qed_write_header_sync(s); } } } out: if (VAR_2) { qed_free_l2_cache(&s->l2_cache); qemu_vfree(s->l1_table); } return VAR_2; }
[ "static int FUNC_0(BlockDriverState *VAR_0, int VAR_1)\n{", "BDRVQEDState *s = VAR_0->opaque;", "QEDHeader le_header;", "int64_t file_size;", "int VAR_2;", "s->VAR_0 = VAR_0;", "QSIMPLEQ_INIT(&s->allocating_write_reqs);", "VAR_2 = bdrv_pread(VAR_0->file, 0, &le_header, sizeof(le_header));", "if (VAR_2 < 0) {", "return VAR_2;", "}", "VAR_2 = 0;", "qed_header_le_to_cpu(&le_header, &s->header);", "if (s->header.magic != QED_MAGIC) {", "return -EINVAL;", "}", "if (s->header.features & ~QED_FEATURE_MASK) {", "char VAR_3[64];", "snprintf(VAR_3, sizeof(VAR_3), \"%\" PRIx64,\ns->header.features & ~QED_FEATURE_MASK);", "qerror_report(QERR_UNKNOWN_BLOCK_FORMAT_FEATURE,\nVAR_0->device_name, \"QED\", VAR_3);", "return -ENOTSUP;", "}", "if (!qed_is_cluster_size_valid(s->header.cluster_size)) {", "return -EINVAL;", "}", "file_size = bdrv_getlength(VAR_0->file);", "if (file_size < 0) {", "return file_size;", "}", "s->file_size = qed_start_of_cluster(s, file_size);", "if (!qed_is_table_size_valid(s->header.table_size)) {", "return -EINVAL;", "}", "if (!qed_is_image_size_valid(s->header.image_size,\ns->header.cluster_size,\ns->header.table_size)) {", "return -EINVAL;", "}", "if (!qed_check_table_offset(s, s->header.l1_table_offset)) {", "return -EINVAL;", "}", "s->table_nelems = (s->header.cluster_size * s->header.table_size) /\nsizeof(uint64_t);", "s->l2_shift = ffs(s->header.cluster_size) - 1;", "s->l2_mask = s->table_nelems - 1;", "s->l1_shift = s->l2_shift + ffs(s->table_nelems) - 1;", "if ((s->header.features & QED_F_BACKING_FILE)) {", "if ((uint64_t)s->header.backing_filename_offset +\ns->header.backing_filename_size >\ns->header.cluster_size * s->header.header_size) {", "return -EINVAL;", "}", "VAR_2 = qed_read_string(VAR_0->file, s->header.backing_filename_offset,\ns->header.backing_filename_size, VAR_0->backing_file,\nsizeof(VAR_0->backing_file));", "if (VAR_2 < 0) {", "return VAR_2;", "}", "if (s->header.features & QED_F_BACKING_FORMAT_NO_PROBE) {", "pstrcpy(VAR_0->backing_format, sizeof(VAR_0->backing_format), \"raw\");", "}", "}", "if ((s->header.autoclear_features & ~QED_AUTOCLEAR_FEATURE_MASK) != 0 &&\n!bdrv_is_read_only(VAR_0->file)) {", "s->header.autoclear_features &= QED_AUTOCLEAR_FEATURE_MASK;", "VAR_2 = qed_write_header_sync(s);", "if (VAR_2) {", "return VAR_2;", "}", "bdrv_flush(VAR_0->file);", "}", "s->l1_table = qed_alloc_table(s);", "qed_init_l2_cache(&s->l2_cache);", "VAR_2 = qed_read_l1_table_sync(s);", "if (VAR_2) {", "goto out;", "}", "if (s->header.features & QED_F_NEED_CHECK) {", "if (!bdrv_is_read_only(VAR_0->file)) {", "BdrvCheckResult result = {0};", "VAR_2 = qed_check(s, &result, true);", "if (!VAR_2 && !result.corruptions && !result.check_errors) {", "bdrv_flush(s->VAR_0);", "s->header.features &= ~QED_F_NEED_CHECK;", "qed_write_header_sync(s);", "}", "}", "}", "out:\nif (VAR_2) {", "qed_free_l2_cache(&s->l2_cache);", "qemu_vfree(s->l1_table);", "}", "return VAR_2;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47, 49 ], [ 51, 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 83 ], [ 85 ], [ 87, 89, 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 105, 107 ], [ 109 ], [ 111 ], [ 113 ], [ 117 ], [ 119, 121, 123 ], [ 125 ], [ 127 ], [ 131, 133, 135 ], [ 137 ], [ 139 ], [ 141 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 167, 169 ], [ 171 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 187 ], [ 189 ], [ 193 ], [ 195 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 211 ], [ 223 ], [ 225 ], [ 229 ], [ 231 ], [ 235 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 251, 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ] ]
6,633
static void do_key_event(VncState *vs, int down, int keycode, int sym) { /* QEMU console switch */ switch(keycode) { case 0x2a: /* Left Shift */ case 0x36: /* Right Shift */ case 0x1d: /* Left CTRL */ case 0x9d: /* Right CTRL */ case 0x38: /* Left ALT */ case 0xb8: /* Right ALT */ if (down) vs->modifiers_state[keycode] = 1; else vs->modifiers_state[keycode] = 0; break; case 0x02 ... 0x0a: /* '1' to '9' keys */ if (down && vs->modifiers_state[0x1d] && vs->modifiers_state[0x38]) { /* Reset the modifiers sent to the current console */ reset_keys(vs); console_select(keycode - 0x02); return; break; case 0x3a: /* CapsLock */ case 0x45: /* NumLock */ if (!down) vs->modifiers_state[keycode] ^= 1; break; if (keycode_is_keypad(vs->vd->kbd_layout, keycode)) { /* If the numlock state needs to change then simulate an additional toggles numlock away from the VNC window. if (keysym_is_numlock(vs->vd->kbd_layout, sym & 0xFFFF)) { if (!vs->modifiers_state[0x45]) { vs->modifiers_state[0x45] = 1; press_key(vs, 0xff7f); if (vs->modifiers_state[0x45]) { vs->modifiers_state[0x45] = 0; press_key(vs, 0xff7f); if (is_graphic_console()) { if (keycode & 0x80) kbd_put_keycode(0xe0); if (down) kbd_put_keycode(keycode & 0x7f); else kbd_put_keycode(keycode | 0x80); /* QEMU console emulation */ if (down) { int numlock = vs->modifiers_state[0x45]; switch (keycode) { case 0x2a: /* Left Shift */ case 0x36: /* Right Shift */ case 0x1d: /* Left CTRL */ case 0x9d: /* Right CTRL */ case 0x38: /* Left ALT */ case 0xb8: /* Right ALT */ break; case 0xc8: kbd_put_keysym(QEMU_KEY_UP); break; case 0xd0: kbd_put_keysym(QEMU_KEY_DOWN); break; case 0xcb: kbd_put_keysym(QEMU_KEY_LEFT); break; case 0xcd: kbd_put_keysym(QEMU_KEY_RIGHT); break; case 0xd3: kbd_put_keysym(QEMU_KEY_DELETE); break; case 0xc7: kbd_put_keysym(QEMU_KEY_HOME); break; case 0xcf: kbd_put_keysym(QEMU_KEY_END); break; case 0xc9: kbd_put_keysym(QEMU_KEY_PAGEUP); break; case 0xd1: kbd_put_keysym(QEMU_KEY_PAGEDOWN); break; case 0x47: kbd_put_keysym(numlock ? '7' : QEMU_KEY_HOME); break; case 0x48: kbd_put_keysym(numlock ? '8' : QEMU_KEY_UP); break; case 0x49: kbd_put_keysym(numlock ? '9' : QEMU_KEY_PAGEUP); break; case 0x4b: kbd_put_keysym(numlock ? '4' : QEMU_KEY_LEFT); break; case 0x4c: kbd_put_keysym('5'); break; case 0x4d: kbd_put_keysym(numlock ? '6' : QEMU_KEY_RIGHT); break; case 0x4f: kbd_put_keysym(numlock ? '1' : QEMU_KEY_END); break; case 0x50: kbd_put_keysym(numlock ? '2' : QEMU_KEY_DOWN); break; case 0x51: kbd_put_keysym(numlock ? '3' : QEMU_KEY_PAGEDOWN); break; case 0x52: kbd_put_keysym('0'); break; case 0x53: kbd_put_keysym(numlock ? '.' : QEMU_KEY_DELETE); break; case 0xb5: kbd_put_keysym('/'); break; case 0x37: kbd_put_keysym('*'); break; case 0x4a: kbd_put_keysym('-'); break; case 0x4e: kbd_put_keysym('+'); break; case 0x9c: kbd_put_keysym('\n'); break; default: kbd_put_keysym(sym); break;
true
qemu
6b1325029d80455b9da7cd7bd84a88cb915b867c
static void do_key_event(VncState *vs, int down, int keycode, int sym) { switch(keycode) { case 0x2a: case 0x36: case 0x1d: case 0x9d: case 0x38: case 0xb8: if (down) vs->modifiers_state[keycode] = 1; else vs->modifiers_state[keycode] = 0; break; case 0x02 ... 0x0a: if (down && vs->modifiers_state[0x1d] && vs->modifiers_state[0x38]) { reset_keys(vs); console_select(keycode - 0x02); return; break; case 0x3a: case 0x45: if (!down) vs->modifiers_state[keycode] ^= 1; break; if (keycode_is_keypad(vs->vd->kbd_layout, keycode)) { if (down) { int numlock = vs->modifiers_state[0x45]; switch (keycode) { case 0x2a: case 0x36: case 0x1d: case 0x9d: case 0x38: case 0xb8: break; case 0xc8: kbd_put_keysym(QEMU_KEY_UP); break; case 0xd0: kbd_put_keysym(QEMU_KEY_DOWN); break; case 0xcb: kbd_put_keysym(QEMU_KEY_LEFT); break; case 0xcd: kbd_put_keysym(QEMU_KEY_RIGHT); break; case 0xd3: kbd_put_keysym(QEMU_KEY_DELETE); break; case 0xc7: kbd_put_keysym(QEMU_KEY_HOME); break; case 0xcf: kbd_put_keysym(QEMU_KEY_END); break; case 0xc9: kbd_put_keysym(QEMU_KEY_PAGEUP); break; case 0xd1: kbd_put_keysym(QEMU_KEY_PAGEDOWN); break; case 0x47: kbd_put_keysym(numlock ? '7' : QEMU_KEY_HOME); break; case 0x48: kbd_put_keysym(numlock ? '8' : QEMU_KEY_UP); break; case 0x49: kbd_put_keysym(numlock ? '9' : QEMU_KEY_PAGEUP); break; case 0x4b: kbd_put_keysym(numlock ? '4' : QEMU_KEY_LEFT); break; case 0x4c: kbd_put_keysym('5'); break; case 0x4d: kbd_put_keysym(numlock ? '6' : QEMU_KEY_RIGHT); break; case 0x4f: kbd_put_keysym(numlock ? '1' : QEMU_KEY_END); break; case 0x50: kbd_put_keysym(numlock ? '2' : QEMU_KEY_DOWN); break; case 0x51: kbd_put_keysym(numlock ? '3' : QEMU_KEY_PAGEDOWN); break; case 0x52: kbd_put_keysym('0'); break; case 0x53: kbd_put_keysym(numlock ? '.' : QEMU_KEY_DELETE); break; case 0xb5: kbd_put_keysym('/'); break; case 0x37: kbd_put_keysym('*'); break; case 0x4a: kbd_put_keysym('-'); break; case 0x4e: kbd_put_keysym('+'); break; case 0x9c: kbd_put_keysym('\n'); break; default: kbd_put_keysym(sym); break;
{ "code": [], "line_no": [] }
static void FUNC_0(VncState *VAR_0, int VAR_1, int VAR_2, int VAR_3) { switch(VAR_2) { case 0x2a: case 0x36: case 0x1d: case 0x9d: case 0x38: case 0xb8: if (VAR_1) VAR_0->modifiers_state[VAR_2] = 1; else VAR_0->modifiers_state[VAR_2] = 0; break; case 0x02 ... 0x0a: if (VAR_1 && VAR_0->modifiers_state[0x1d] && VAR_0->modifiers_state[0x38]) { reset_keys(VAR_0); console_select(VAR_2 - 0x02); return; break; case 0x3a: case 0x45: if (!VAR_1) VAR_0->modifiers_state[VAR_2] ^= 1; break; if (keycode_is_keypad(VAR_0->vd->kbd_layout, VAR_2)) { if (VAR_1) { int VAR_4 = VAR_0->modifiers_state[0x45]; switch (VAR_2) { case 0x2a: case 0x36: case 0x1d: case 0x9d: case 0x38: case 0xb8: break; case 0xc8: kbd_put_keysym(QEMU_KEY_UP); break; case 0xd0: kbd_put_keysym(QEMU_KEY_DOWN); break; case 0xcb: kbd_put_keysym(QEMU_KEY_LEFT); break; case 0xcd: kbd_put_keysym(QEMU_KEY_RIGHT); break; case 0xd3: kbd_put_keysym(QEMU_KEY_DELETE); break; case 0xc7: kbd_put_keysym(QEMU_KEY_HOME); break; case 0xcf: kbd_put_keysym(QEMU_KEY_END); break; case 0xc9: kbd_put_keysym(QEMU_KEY_PAGEUP); break; case 0xd1: kbd_put_keysym(QEMU_KEY_PAGEDOWN); break; case 0x47: kbd_put_keysym(VAR_4 ? '7' : QEMU_KEY_HOME); break; case 0x48: kbd_put_keysym(VAR_4 ? '8' : QEMU_KEY_UP); break; case 0x49: kbd_put_keysym(VAR_4 ? '9' : QEMU_KEY_PAGEUP); break; case 0x4b: kbd_put_keysym(VAR_4 ? '4' : QEMU_KEY_LEFT); break; case 0x4c: kbd_put_keysym('5'); break; case 0x4d: kbd_put_keysym(VAR_4 ? '6' : QEMU_KEY_RIGHT); break; case 0x4f: kbd_put_keysym(VAR_4 ? '1' : QEMU_KEY_END); break; case 0x50: kbd_put_keysym(VAR_4 ? '2' : QEMU_KEY_DOWN); break; case 0x51: kbd_put_keysym(VAR_4 ? '3' : QEMU_KEY_PAGEDOWN); break; case 0x52: kbd_put_keysym('0'); break; case 0x53: kbd_put_keysym(VAR_4 ? '.' : QEMU_KEY_DELETE); break; case 0xb5: kbd_put_keysym('/'); break; case 0x37: kbd_put_keysym('*'); break; case 0x4a: kbd_put_keysym('-'); break; case 0x4e: kbd_put_keysym('+'); break; case 0x9c: kbd_put_keysym('\n'); break; default: kbd_put_keysym(VAR_3); break;
[ "static void FUNC_0(VncState *VAR_0, int VAR_1, int VAR_2, int VAR_3)\n{", "switch(VAR_2) {", "case 0x2a:\ncase 0x36:\ncase 0x1d:\ncase 0x9d:\ncase 0x38:\ncase 0xb8:\nif (VAR_1)\nVAR_0->modifiers_state[VAR_2] = 1;", "else\nVAR_0->modifiers_state[VAR_2] = 0;", "break;", "case 0x02 ... 0x0a:\nif (VAR_1 && VAR_0->modifiers_state[0x1d] && VAR_0->modifiers_state[0x38]) {", "reset_keys(VAR_0);", "console_select(VAR_2 - 0x02);", "return;", "break;", "case 0x3a:\ncase 0x45:\nif (!VAR_1)\nVAR_0->modifiers_state[VAR_2] ^= 1;", "break;", "if (keycode_is_keypad(VAR_0->vd->kbd_layout, VAR_2)) {", "if (VAR_1) {", "int VAR_4 = VAR_0->modifiers_state[0x45];", "switch (VAR_2) {", "case 0x2a:\ncase 0x36:\ncase 0x1d:\ncase 0x9d:\ncase 0x38:\ncase 0xb8:\nbreak;", "case 0xc8:\nkbd_put_keysym(QEMU_KEY_UP);", "break;", "case 0xd0:\nkbd_put_keysym(QEMU_KEY_DOWN);", "break;", "case 0xcb:\nkbd_put_keysym(QEMU_KEY_LEFT);", "break;", "case 0xcd:\nkbd_put_keysym(QEMU_KEY_RIGHT);", "break;", "case 0xd3:\nkbd_put_keysym(QEMU_KEY_DELETE);", "break;", "case 0xc7:\nkbd_put_keysym(QEMU_KEY_HOME);", "break;", "case 0xcf:\nkbd_put_keysym(QEMU_KEY_END);", "break;", "case 0xc9:\nkbd_put_keysym(QEMU_KEY_PAGEUP);", "break;", "case 0xd1:\nkbd_put_keysym(QEMU_KEY_PAGEDOWN);", "break;", "case 0x47:\nkbd_put_keysym(VAR_4 ? '7' : QEMU_KEY_HOME);", "break;", "case 0x48:\nkbd_put_keysym(VAR_4 ? '8' : QEMU_KEY_UP);", "break;", "case 0x49:\nkbd_put_keysym(VAR_4 ? '9' : QEMU_KEY_PAGEUP);", "break;", "case 0x4b:\nkbd_put_keysym(VAR_4 ? '4' : QEMU_KEY_LEFT);", "break;", "case 0x4c:\nkbd_put_keysym('5');", "break;", "case 0x4d:\nkbd_put_keysym(VAR_4 ? '6' : QEMU_KEY_RIGHT);", "break;", "case 0x4f:\nkbd_put_keysym(VAR_4 ? '1' : QEMU_KEY_END);", "break;", "case 0x50:\nkbd_put_keysym(VAR_4 ? '2' : QEMU_KEY_DOWN);", "break;", "case 0x51:\nkbd_put_keysym(VAR_4 ? '3' : QEMU_KEY_PAGEDOWN);", "break;", "case 0x52:\nkbd_put_keysym('0');", "break;", "case 0x53:\nkbd_put_keysym(VAR_4 ? '.' : QEMU_KEY_DELETE);", "break;", "case 0xb5:\nkbd_put_keysym('/');", "break;", "case 0x37:\nkbd_put_keysym('*');", "break;", "case 0x4a:\nkbd_put_keysym('-');", "break;", "case 0x4e:\nkbd_put_keysym('+');", "break;", "case 0x9c:\nkbd_put_keysym('\\n');", "break;", "default:\nkbd_put_keysym(VAR_3);", "break;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2 ], [ 4 ], [ 5, 6, 7, 8, 9, 10, 11, 12 ], [ 13, 14 ], [ 15 ], [ 16, 17 ], [ 19 ], [ 20 ], [ 21 ], [ 22 ], [ 23, 24, 25, 26 ], [ 27 ], [ 28 ], [ 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, 132 ], [ 133 ] ]
6,634
void set_link_completion(ReadLineState *rs, int nb_args, const char *str) { size_t len; len = strlen(str); readline_set_completion_index(rs, len); if (nb_args == 2) { NetClientState *ncs[MAX_QUEUE_NUM]; int count, i; count = qemu_find_net_clients_except(NULL, ncs, NET_CLIENT_OPTIONS_KIND_NONE, MAX_QUEUE_NUM); for (i = 0; i < count; i++) { const char *name = ncs[i]->name; if (!strncmp(str, name, len)) { readline_add_completion(rs, name); } } } else if (nb_args == 3) { add_completion_option(rs, str, "on"); add_completion_option(rs, str, "off"); } }
true
qemu
bcfa4d60144fb879f0ffef0a6d174faa37b2df82
void set_link_completion(ReadLineState *rs, int nb_args, const char *str) { size_t len; len = strlen(str); readline_set_completion_index(rs, len); if (nb_args == 2) { NetClientState *ncs[MAX_QUEUE_NUM]; int count, i; count = qemu_find_net_clients_except(NULL, ncs, NET_CLIENT_OPTIONS_KIND_NONE, MAX_QUEUE_NUM); for (i = 0; i < count; i++) { const char *name = ncs[i]->name; if (!strncmp(str, name, len)) { readline_add_completion(rs, name); } } } else if (nb_args == 3) { add_completion_option(rs, str, "on"); add_completion_option(rs, str, "off"); } }
{ "code": [ " for (i = 0; i < count; i++) {", " for (i = 0; i < count; i++) {", " for (i = 0; i < count; i++) {" ], "line_no": [ 25, 25, 25 ] }
void FUNC_0(ReadLineState *VAR_0, int VAR_1, const char *VAR_2) { size_t len; len = strlen(VAR_2); readline_set_completion_index(VAR_0, len); if (VAR_1 == 2) { NetClientState *ncs[MAX_QUEUE_NUM]; int VAR_3, VAR_4; VAR_3 = qemu_find_net_clients_except(NULL, ncs, NET_CLIENT_OPTIONS_KIND_NONE, MAX_QUEUE_NUM); for (VAR_4 = 0; VAR_4 < VAR_3; VAR_4++) { const char *VAR_5 = ncs[VAR_4]->VAR_5; if (!strncmp(VAR_2, VAR_5, len)) { readline_add_completion(VAR_0, VAR_5); } } } else if (VAR_1 == 3) { add_completion_option(VAR_0, VAR_2, "on"); add_completion_option(VAR_0, VAR_2, "off"); } }
[ "void FUNC_0(ReadLineState *VAR_0, int VAR_1, const char *VAR_2)\n{", "size_t len;", "len = strlen(VAR_2);", "readline_set_completion_index(VAR_0, len);", "if (VAR_1 == 2) {", "NetClientState *ncs[MAX_QUEUE_NUM];", "int VAR_3, VAR_4;", "VAR_3 = qemu_find_net_clients_except(NULL, ncs,\nNET_CLIENT_OPTIONS_KIND_NONE,\nMAX_QUEUE_NUM);", "for (VAR_4 = 0; VAR_4 < VAR_3; VAR_4++) {", "const char *VAR_5 = ncs[VAR_4]->VAR_5;", "if (!strncmp(VAR_2, VAR_5, len)) {", "readline_add_completion(VAR_0, VAR_5);", "}", "}", "} else if (VAR_1 == 3) {", "add_completion_option(VAR_0, VAR_2, \"on\");", "add_completion_option(VAR_0, VAR_2, \"off\");", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 1, 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 ] ]
6,636
static void bufp_alloc(USBRedirDevice *dev, uint8_t *data, uint16_t len, uint8_t status, uint8_t ep, void *free_on_destroy) { struct buf_packet *bufp; if (!dev->endpoint[EP2I(ep)].bufpq_dropping_packets && dev->endpoint[EP2I(ep)].bufpq_size > 2 * dev->endpoint[EP2I(ep)].bufpq_target_size) { DPRINTF("bufpq overflow, dropping packets ep %02X\n", ep); dev->endpoint[EP2I(ep)].bufpq_dropping_packets = 1; } /* Since we're interupting the stream anyways, drop enough packets to get back to our target buffer size */ if (dev->endpoint[EP2I(ep)].bufpq_dropping_packets) { if (dev->endpoint[EP2I(ep)].bufpq_size > dev->endpoint[EP2I(ep)].bufpq_target_size) { free(data); return; } dev->endpoint[EP2I(ep)].bufpq_dropping_packets = 0; } bufp = g_new(struct buf_packet, 1); bufp->data = data; bufp->len = len; bufp->offset = 0; bufp->status = status; bufp->free_on_destroy = free_on_destroy; QTAILQ_INSERT_TAIL(&dev->endpoint[EP2I(ep)].bufpq, bufp, next); dev->endpoint[EP2I(ep)].bufpq_size++; }
true
qemu
e8ce12d9eaeedeb7f8d9debcd4c9b993903f1abb
static void bufp_alloc(USBRedirDevice *dev, uint8_t *data, uint16_t len, uint8_t status, uint8_t ep, void *free_on_destroy) { struct buf_packet *bufp; if (!dev->endpoint[EP2I(ep)].bufpq_dropping_packets && dev->endpoint[EP2I(ep)].bufpq_size > 2 * dev->endpoint[EP2I(ep)].bufpq_target_size) { DPRINTF("bufpq overflow, dropping packets ep %02X\n", ep); dev->endpoint[EP2I(ep)].bufpq_dropping_packets = 1; } if (dev->endpoint[EP2I(ep)].bufpq_dropping_packets) { if (dev->endpoint[EP2I(ep)].bufpq_size > dev->endpoint[EP2I(ep)].bufpq_target_size) { free(data); return; } dev->endpoint[EP2I(ep)].bufpq_dropping_packets = 0; } bufp = g_new(struct buf_packet, 1); bufp->data = data; bufp->len = len; bufp->offset = 0; bufp->status = status; bufp->free_on_destroy = free_on_destroy; QTAILQ_INSERT_TAIL(&dev->endpoint[EP2I(ep)].bufpq, bufp, next); dev->endpoint[EP2I(ep)].bufpq_size++; }
{ "code": [ "static void bufp_alloc(USBRedirDevice *dev, uint8_t *data, uint16_t len," ], "line_no": [ 1 ] }
static void FUNC_0(USBRedirDevice *VAR_0, uint8_t *VAR_1, uint16_t VAR_2, uint8_t VAR_3, uint8_t VAR_4, void *VAR_5) { struct buf_packet *VAR_6; if (!VAR_0->endpoint[EP2I(VAR_4)].bufpq_dropping_packets && VAR_0->endpoint[EP2I(VAR_4)].bufpq_size > 2 * VAR_0->endpoint[EP2I(VAR_4)].bufpq_target_size) { DPRINTF("bufpq overflow, dropping packets VAR_4 %02X\n", VAR_4); VAR_0->endpoint[EP2I(VAR_4)].bufpq_dropping_packets = 1; } if (VAR_0->endpoint[EP2I(VAR_4)].bufpq_dropping_packets) { if (VAR_0->endpoint[EP2I(VAR_4)].bufpq_size > VAR_0->endpoint[EP2I(VAR_4)].bufpq_target_size) { free(VAR_1); return; } VAR_0->endpoint[EP2I(VAR_4)].bufpq_dropping_packets = 0; } VAR_6 = g_new(struct buf_packet, 1); VAR_6->VAR_1 = VAR_1; VAR_6->VAR_2 = VAR_2; VAR_6->offset = 0; VAR_6->VAR_3 = VAR_3; VAR_6->VAR_5 = VAR_5; QTAILQ_INSERT_TAIL(&VAR_0->endpoint[EP2I(VAR_4)].bufpq, VAR_6, next); VAR_0->endpoint[EP2I(VAR_4)].bufpq_size++; }
[ "static void FUNC_0(USBRedirDevice *VAR_0, uint8_t *VAR_1, uint16_t VAR_2,\nuint8_t VAR_3, uint8_t VAR_4, void *VAR_5)\n{", "struct buf_packet *VAR_6;", "if (!VAR_0->endpoint[EP2I(VAR_4)].bufpq_dropping_packets &&\nVAR_0->endpoint[EP2I(VAR_4)].bufpq_size >\n2 * VAR_0->endpoint[EP2I(VAR_4)].bufpq_target_size) {", "DPRINTF(\"bufpq overflow, dropping packets VAR_4 %02X\\n\", VAR_4);", "VAR_0->endpoint[EP2I(VAR_4)].bufpq_dropping_packets = 1;", "}", "if (VAR_0->endpoint[EP2I(VAR_4)].bufpq_dropping_packets) {", "if (VAR_0->endpoint[EP2I(VAR_4)].bufpq_size >\nVAR_0->endpoint[EP2I(VAR_4)].bufpq_target_size) {", "free(VAR_1);", "return;", "}", "VAR_0->endpoint[EP2I(VAR_4)].bufpq_dropping_packets = 0;", "}", "VAR_6 = g_new(struct buf_packet, 1);", "VAR_6->VAR_1 = VAR_1;", "VAR_6->VAR_2 = VAR_2;", "VAR_6->offset = 0;", "VAR_6->VAR_3 = VAR_3;", "VAR_6->VAR_5 = VAR_5;", "QTAILQ_INSERT_TAIL(&VAR_0->endpoint[EP2I(VAR_4)].bufpq, VAR_6, next);", "VAR_0->endpoint[EP2I(VAR_4)].bufpq_size++;", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11, 13, 15 ], [ 17 ], [ 19 ], [ 21 ], [ 27 ], [ 29, 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ] ]
6,637
static inline void check_hwrena(CPUMIPSState *env, int reg) { if ((env->hflags & MIPS_HFLAG_CP0) || (env->CP0_HWREna & (1 << reg))) { return; } do_raise_exception(env, EXCP_RI, GETPC()); }
true
qemu
d96391c1ffeb30a0afa695c86579517c69d9a889
static inline void check_hwrena(CPUMIPSState *env, int reg) { if ((env->hflags & MIPS_HFLAG_CP0) || (env->CP0_HWREna & (1 << reg))) { return; } do_raise_exception(env, EXCP_RI, GETPC()); }
{ "code": [ "static inline void check_hwrena(CPUMIPSState *env, int reg)", " do_raise_exception(env, EXCP_RI, GETPC());" ], "line_no": [ 1, 11 ] }
static inline void FUNC_0(CPUMIPSState *VAR_0, int VAR_1) { if ((VAR_0->hflags & MIPS_HFLAG_CP0) || (VAR_0->CP0_HWREna & (1 << VAR_1))) { return; } do_raise_exception(VAR_0, EXCP_RI, GETPC()); }
[ "static inline void FUNC_0(CPUMIPSState *VAR_0, int VAR_1)\n{", "if ((VAR_0->hflags & MIPS_HFLAG_CP0) || (VAR_0->CP0_HWREna & (1 << VAR_1))) {", "return;", "}", "do_raise_exception(VAR_0, EXCP_RI, GETPC());", "}" ]
[ 1, 0, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ] ]
6,638
static bool xen_host_pci_dev_is_virtfn(XenHostPCIDevice *d) { char path[PATH_MAX]; struct stat buf; if (xen_host_pci_sysfs_path(d, "physfn", path, sizeof (path))) { return false; } return !stat(path, &buf); }
true
qemu
599d0c45615b7d099d256738a586d0f63bc707e6
static bool xen_host_pci_dev_is_virtfn(XenHostPCIDevice *d) { char path[PATH_MAX]; struct stat buf; if (xen_host_pci_sysfs_path(d, "physfn", path, sizeof (path))) { return false; } return !stat(path, &buf); }
{ "code": [ " if (xen_host_pci_sysfs_path(d, \"physfn\", path, sizeof (path))) {", " return false;" ], "line_no": [ 11, 13 ] }
static bool FUNC_0(XenHostPCIDevice *d) { char VAR_0[PATH_MAX]; struct stat VAR_1; if (xen_host_pci_sysfs_path(d, "physfn", VAR_0, sizeof (VAR_0))) { return false; } return !stat(VAR_0, &VAR_1); }
[ "static bool FUNC_0(XenHostPCIDevice *d)\n{", "char VAR_0[PATH_MAX];", "struct stat VAR_1;", "if (xen_host_pci_sysfs_path(d, \"physfn\", VAR_0, sizeof (VAR_0))) {", "return false;", "}", "return !stat(VAR_0, &VAR_1);", "}" ]
[ 0, 0, 0, 1, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ] ]
6,639
static gboolean guest_exec_output_watch(GIOChannel *ch, GIOCondition cond, gpointer p_) { GuestExecIOData *p = (GuestExecIOData *)p_; gsize bytes_read; GIOStatus gstatus; if (cond == G_IO_HUP || cond == G_IO_ERR) { goto close; } if (p->size == p->length) { gpointer t = NULL; if (!p->truncated && p->size < GUEST_EXEC_MAX_OUTPUT) { t = g_try_realloc(p->data, p->size + GUEST_EXEC_IO_SIZE); } if (t == NULL) { /* ignore truncated output */ gchar buf[GUEST_EXEC_IO_SIZE]; p->truncated = true; gstatus = g_io_channel_read_chars(ch, buf, sizeof(buf), &bytes_read, NULL); if (gstatus == G_IO_STATUS_EOF || gstatus == G_IO_STATUS_ERROR) { goto close; } return true; } p->size += GUEST_EXEC_IO_SIZE; p->data = t; } /* Calling read API once. * On next available data our callback will be called again */ gstatus = g_io_channel_read_chars(ch, (gchar *)p->data + p->length, p->size - p->length, &bytes_read, NULL); if (gstatus == G_IO_STATUS_EOF || gstatus == G_IO_STATUS_ERROR) { goto close; } p->length += bytes_read; return true; close: g_io_channel_unref(ch); g_atomic_int_set(&p->closed, 1); return false; }
true
qemu
3005c2c2fa2875a3413af97e9db368856d3330fd
static gboolean guest_exec_output_watch(GIOChannel *ch, GIOCondition cond, gpointer p_) { GuestExecIOData *p = (GuestExecIOData *)p_; gsize bytes_read; GIOStatus gstatus; if (cond == G_IO_HUP || cond == G_IO_ERR) { goto close; } if (p->size == p->length) { gpointer t = NULL; if (!p->truncated && p->size < GUEST_EXEC_MAX_OUTPUT) { t = g_try_realloc(p->data, p->size + GUEST_EXEC_IO_SIZE); } if (t == NULL) { gchar buf[GUEST_EXEC_IO_SIZE]; p->truncated = true; gstatus = g_io_channel_read_chars(ch, buf, sizeof(buf), &bytes_read, NULL); if (gstatus == G_IO_STATUS_EOF || gstatus == G_IO_STATUS_ERROR) { goto close; } return true; } p->size += GUEST_EXEC_IO_SIZE; p->data = t; } gstatus = g_io_channel_read_chars(ch, (gchar *)p->data + p->length, p->size - p->length, &bytes_read, NULL); if (gstatus == G_IO_STATUS_EOF || gstatus == G_IO_STATUS_ERROR) { goto close; } p->length += bytes_read; return true; close: g_io_channel_unref(ch); g_atomic_int_set(&p->closed, 1); return false; }
{ "code": [], "line_no": [] }
static gboolean FUNC_0(GIOChannel *ch, GIOCondition cond, gpointer p_) { GuestExecIOData *p = (GuestExecIOData *)p_; gsize bytes_read; GIOStatus gstatus; if (cond == G_IO_HUP || cond == G_IO_ERR) { goto close; } if (p->size == p->length) { gpointer t = NULL; if (!p->truncated && p->size < GUEST_EXEC_MAX_OUTPUT) { t = g_try_realloc(p->data, p->size + GUEST_EXEC_IO_SIZE); } if (t == NULL) { gchar buf[GUEST_EXEC_IO_SIZE]; p->truncated = true; gstatus = g_io_channel_read_chars(ch, buf, sizeof(buf), &bytes_read, NULL); if (gstatus == G_IO_STATUS_EOF || gstatus == G_IO_STATUS_ERROR) { goto close; } return true; } p->size += GUEST_EXEC_IO_SIZE; p->data = t; } gstatus = g_io_channel_read_chars(ch, (gchar *)p->data + p->length, p->size - p->length, &bytes_read, NULL); if (gstatus == G_IO_STATUS_EOF || gstatus == G_IO_STATUS_ERROR) { goto close; } p->length += bytes_read; return true; close: g_io_channel_unref(ch); g_atomic_int_set(&p->closed, 1); return false; }
[ "static gboolean FUNC_0(GIOChannel *ch,\nGIOCondition cond, gpointer p_)\n{", "GuestExecIOData *p = (GuestExecIOData *)p_;", "gsize bytes_read;", "GIOStatus gstatus;", "if (cond == G_IO_HUP || cond == G_IO_ERR) {", "goto close;", "}", "if (p->size == p->length) {", "gpointer t = NULL;", "if (!p->truncated && p->size < GUEST_EXEC_MAX_OUTPUT) {", "t = g_try_realloc(p->data, p->size + GUEST_EXEC_IO_SIZE);", "}", "if (t == NULL) {", "gchar buf[GUEST_EXEC_IO_SIZE];", "p->truncated = true;", "gstatus = g_io_channel_read_chars(ch, buf, sizeof(buf),\n&bytes_read, NULL);", "if (gstatus == G_IO_STATUS_EOF || gstatus == G_IO_STATUS_ERROR) {", "goto close;", "}", "return true;", "}", "p->size += GUEST_EXEC_IO_SIZE;", "p->data = t;", "}", "gstatus = g_io_channel_read_chars(ch, (gchar *)p->data + p->length,\np->size - p->length, &bytes_read, NULL);", "if (gstatus == G_IO_STATUS_EOF || gstatus == G_IO_STATUS_ERROR) {", "goto close;", "}", "p->length += bytes_read;", "return true;", "close:\ng_io_channel_unref(ch);", "g_atomic_int_set(&p->closed, 1);", "return false;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 71, 73 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 87 ], [ 91, 94 ], [ 96 ], [ 98 ], [ 100 ] ]
6,640
static int hq_decode_block(HQContext *c, GetBitContext *gb, int16_t block[64], int qsel, int is_chroma, int is_hqa) { const int32_t *q; int val, pos = 1; memset(block, 0, 64 * sizeof(*block)); if (!is_hqa) { block[0] = get_sbits(gb, 9) << 6; q = ff_hq_quants[qsel][is_chroma][get_bits(gb, 2)]; } else { q = ff_hq_quants[qsel][is_chroma][get_bits(gb, 2)]; block[0] = get_sbits(gb, 9) << 6; } for (;;) { val = get_vlc2(gb, c->hq_ac_vlc.table, 9, 2); pos += ff_hq_ac_skips[val]; if (pos >= 64) break; block[ff_zigzag_direct[pos]] = (ff_hq_ac_syms[val] * q[pos]) >> 12; pos++; } return 0; }
false
FFmpeg
28eddef689f2b4843a84f7d05fd9614246f92cc4
static int hq_decode_block(HQContext *c, GetBitContext *gb, int16_t block[64], int qsel, int is_chroma, int is_hqa) { const int32_t *q; int val, pos = 1; memset(block, 0, 64 * sizeof(*block)); if (!is_hqa) { block[0] = get_sbits(gb, 9) << 6; q = ff_hq_quants[qsel][is_chroma][get_bits(gb, 2)]; } else { q = ff_hq_quants[qsel][is_chroma][get_bits(gb, 2)]; block[0] = get_sbits(gb, 9) << 6; } for (;;) { val = get_vlc2(gb, c->hq_ac_vlc.table, 9, 2); pos += ff_hq_ac_skips[val]; if (pos >= 64) break; block[ff_zigzag_direct[pos]] = (ff_hq_ac_syms[val] * q[pos]) >> 12; pos++; } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(HQContext *VAR_0, GetBitContext *VAR_1, int16_t VAR_2[64], int VAR_3, int VAR_4, int VAR_5) { const int32_t *VAR_6; int VAR_7, VAR_8 = 1; memset(VAR_2, 0, 64 * sizeof(*VAR_2)); if (!VAR_5) { VAR_2[0] = get_sbits(VAR_1, 9) << 6; VAR_6 = ff_hq_quants[VAR_3][VAR_4][get_bits(VAR_1, 2)]; } else { VAR_6 = ff_hq_quants[VAR_3][VAR_4][get_bits(VAR_1, 2)]; VAR_2[0] = get_sbits(VAR_1, 9) << 6; } for (;;) { VAR_7 = get_vlc2(VAR_1, VAR_0->hq_ac_vlc.table, 9, 2); VAR_8 += ff_hq_ac_skips[VAR_7]; if (VAR_8 >= 64) break; VAR_2[ff_zigzag_direct[VAR_8]] = (ff_hq_ac_syms[VAR_7] * VAR_6[VAR_8]) >> 12; VAR_8++; } return 0; }
[ "static int FUNC_0(HQContext *VAR_0, GetBitContext *VAR_1, int16_t VAR_2[64],\nint VAR_3, int VAR_4, int VAR_5)\n{", "const int32_t *VAR_6;", "int VAR_7, VAR_8 = 1;", "memset(VAR_2, 0, 64 * sizeof(*VAR_2));", "if (!VAR_5) {", "VAR_2[0] = get_sbits(VAR_1, 9) << 6;", "VAR_6 = ff_hq_quants[VAR_3][VAR_4][get_bits(VAR_1, 2)];", "} else {", "VAR_6 = ff_hq_quants[VAR_3][VAR_4][get_bits(VAR_1, 2)];", "VAR_2[0] = get_sbits(VAR_1, 9) << 6;", "}", "for (;;) {", "VAR_7 = get_vlc2(VAR_1, VAR_0->hq_ac_vlc.table, 9, 2);", "VAR_8 += ff_hq_ac_skips[VAR_7];", "if (VAR_8 >= 64)\nbreak;", "VAR_2[ff_zigzag_direct[VAR_8]] = (ff_hq_ac_syms[VAR_7] * VAR_6[VAR_8]) >> 12;", "VAR_8++;", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ] ]
6,642
static void final(const short *i1, const short *i2, void *out, int *statbuf, int len) { int x, i; unsigned short int work[50]; short *ptr = work; memcpy(work, statbuf,20); memcpy(work + 10, i2, len * 2); for (i=0; i<len; i++) { int sum = 0; for(x=0; x<10; x++) sum += i1[9-x] * ptr[x]; sum >>= 12; if (ptr[10] - sum < -32768 || ptr[10] - sum > 32767) { memset(out, 0, len * 2); memset(statbuf, 0, 20); return; } ptr[10] -= sum; ptr++; } memcpy(out, work+10, len * 2); memcpy(statbuf, work + 40, 20); }
true
FFmpeg
13b6729361d45b9f308d731dd6b82dac01428dc3
static void final(const short *i1, const short *i2, void *out, int *statbuf, int len) { int x, i; unsigned short int work[50]; short *ptr = work; memcpy(work, statbuf,20); memcpy(work + 10, i2, len * 2); for (i=0; i<len; i++) { int sum = 0; for(x=0; x<10; x++) sum += i1[9-x] * ptr[x]; sum >>= 12; if (ptr[10] - sum < -32768 || ptr[10] - sum > 32767) { memset(out, 0, len * 2); memset(statbuf, 0, 20); return; } ptr[10] -= sum; ptr++; } memcpy(out, work+10, len * 2); memcpy(statbuf, work + 40, 20); }
{ "code": [ " if (ptr[10] - sum < -32768 || ptr[10] - sum > 32767) {", " ptr[10] -= sum;" ], "line_no": [ 37, 49 ] }
static void FUNC_0(const short *VAR_0, const short *VAR_1, void *VAR_2, int *VAR_3, int VAR_4) { int VAR_5, VAR_6; unsigned short int VAR_7[50]; short *VAR_8 = VAR_7; memcpy(VAR_7, VAR_3,20); memcpy(VAR_7 + 10, VAR_1, VAR_4 * 2); for (VAR_6=0; VAR_6<VAR_4; VAR_6++) { int VAR_9 = 0; for(VAR_5=0; VAR_5<10; VAR_5++) VAR_9 += VAR_0[9-VAR_5] * VAR_8[VAR_5]; VAR_9 >>= 12; if (VAR_8[10] - VAR_9 < -32768 || VAR_8[10] - VAR_9 > 32767) { memset(VAR_2, 0, VAR_4 * 2); memset(VAR_3, 0, 20); return; } VAR_8[10] -= VAR_9; VAR_8++; } memcpy(VAR_2, VAR_7+10, VAR_4 * 2); memcpy(VAR_3, VAR_7 + 40, 20); }
[ "static void FUNC_0(const short *VAR_0, const short *VAR_1,\nvoid *VAR_2, int *VAR_3, int VAR_4)\n{", "int VAR_5, VAR_6;", "unsigned short int VAR_7[50];", "short *VAR_8 = VAR_7;", "memcpy(VAR_7, VAR_3,20);", "memcpy(VAR_7 + 10, VAR_1, VAR_4 * 2);", "for (VAR_6=0; VAR_6<VAR_4; VAR_6++) {", "int VAR_9 = 0;", "for(VAR_5=0; VAR_5<10; VAR_5++)", "VAR_9 += VAR_0[9-VAR_5] * VAR_8[VAR_5];", "VAR_9 >>= 12;", "if (VAR_8[10] - VAR_9 < -32768 || VAR_8[10] - VAR_9 > 32767) {", "memset(VAR_2, 0, VAR_4 * 2);", "memset(VAR_3, 0, 20);", "return;", "}", "VAR_8[10] -= VAR_9;", "VAR_8++;", "}", "memcpy(VAR_2, VAR_7+10, VAR_4 * 2);", "memcpy(VAR_3, VAR_7 + 40, 20);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ] ]
6,643
static int showspectrumpic_request_frame(AVFilterLink *outlink) { AVFilterContext *ctx = outlink->src; ShowSpectrumContext *s = ctx->priv; AVFilterLink *inlink = ctx->inputs[0]; int ret; ret = ff_request_frame(inlink); if (ret == AVERROR_EOF && s->outpicref) { int samples = av_audio_fifo_size(s->fifo); int consumed = 0; int y, x = 0, sz = s->orientation == VERTICAL ? s->w : s->h; int ch, spf, spb; AVFrame *fin; spf = s->win_size * (samples / ((s->win_size * sz) * ceil(samples / (float)(s->win_size * sz)))); spb = (samples / (spf * sz)) * spf; fin = ff_get_audio_buffer(inlink, s->win_size); if (!fin) return AVERROR(ENOMEM); while (x < sz) { ret = av_audio_fifo_peek(s->fifo, (void **)fin->extended_data, s->win_size); if (ret < 0) { av_frame_free(&fin); return ret; } av_audio_fifo_drain(s->fifo, spf); if (ret < s->win_size) { for (ch = 0; ch < s->nb_display_channels; ch++) { memset(fin->extended_data[ch] + ret * sizeof(float), 0, (s->win_size - ret) * sizeof(float)); } } ctx->internal->execute(ctx, run_channel_fft, fin, NULL, s->nb_display_channels); acalc_magnitudes(s); consumed += spf; if (consumed >= spb) { int h = s->orientation == VERTICAL ? s->h : s->w; scale_magnitudes(s, 1. / (consumed / spf)); plot_spectrum_column(inlink, fin); consumed = 0; x++; for (ch = 0; ch < s->nb_display_channels; ch++) memset(s->magnitudes[ch], 0, h * sizeof(float)); } } av_frame_free(&fin); s->outpicref->pts = 0; if (s->legend) { int multi = (s->mode == SEPARATE && s->color_mode == CHANNEL); float spp = samples / (float)sz; uint8_t *dst; drawtext(s->outpicref, 2, outlink->h - 10, "CREATED BY LIBAVFILTER", 0); dst = s->outpicref->data[0] + (s->start_y - 1) * s->outpicref->linesize[0] + s->start_x - 1; for (x = 0; x < s->w + 1; x++) dst[x] = 200; dst = s->outpicref->data[0] + (s->start_y + s->h) * s->outpicref->linesize[0] + s->start_x - 1; for (x = 0; x < s->w + 1; x++) dst[x] = 200; for (y = 0; y < s->h + 2; y++) { dst = s->outpicref->data[0] + (y + s->start_y - 1) * s->outpicref->linesize[0]; dst[s->start_x - 1] = 200; dst[s->start_x + s->w] = 200; } if (s->orientation == VERTICAL) { int h = s->mode == SEPARATE ? s->h / s->nb_display_channels : s->h; for (ch = 0; ch < (s->mode == SEPARATE ? s->nb_display_channels : 1); ch++) { for (y = 0; y < h; y += 20) { dst = s->outpicref->data[0] + (s->start_y + h * (ch + 1) - y - 1) * s->outpicref->linesize[0]; dst[s->start_x - 2] = 200; dst[s->start_x + s->w + 1] = 200; } for (y = 0; y < h; y += 40) { dst = s->outpicref->data[0] + (s->start_y + h * (ch + 1) - y - 1) * s->outpicref->linesize[0]; dst[s->start_x - 3] = 200; dst[s->start_x + s->w + 2] = 200; } dst = s->outpicref->data[0] + (s->start_y - 2) * s->outpicref->linesize[0] + s->start_x; for (x = 0; x < s->w; x+=40) dst[x] = 200; dst = s->outpicref->data[0] + (s->start_y - 3) * s->outpicref->linesize[0] + s->start_x; for (x = 0; x < s->w; x+=80) dst[x] = 200; dst = s->outpicref->data[0] + (s->h + s->start_y + 1) * s->outpicref->linesize[0] + s->start_x; for (x = 0; x < s->w; x+=40) { dst[x] = 200; } dst = s->outpicref->data[0] + (s->h + s->start_y + 2) * s->outpicref->linesize[0] + s->start_x; for (x = 0; x < s->w; x+=80) { dst[x] = 200; } for (y = 0; y < h; y += 40) { float hertz = y * (inlink->sample_rate / 2) / (float)(1 << (int)ceil(log2(h))); char *units; if (hertz == 0) units = av_asprintf("DC"); else units = av_asprintf("%.2f", hertz); if (!units) return AVERROR(ENOMEM); drawtext(s->outpicref, s->start_x - 8 * strlen(units) - 4, h * (ch + 1) + s->start_y - y - 4, units, 0); av_free(units); } } for (x = 0; x < s->w; x+=80) { float seconds = x * spp / inlink->sample_rate; char *units; if (x == 0) units = av_asprintf("0"); else if (log10(seconds) > 6) units = av_asprintf("%.2fh", seconds / (60 * 60)); else if (log10(seconds) > 3) units = av_asprintf("%.2fm", seconds / 60); else units = av_asprintf("%.2fs", seconds); if (!units) return AVERROR(ENOMEM); drawtext(s->outpicref, s->start_x + x - 4 * strlen(units), s->h + s->start_y + 6, units, 0); drawtext(s->outpicref, s->start_x + x - 4 * strlen(units), s->start_y - 12, units, 0); av_free(units); } drawtext(s->outpicref, outlink->w / 2 - 4 * 4, outlink->h - s->start_y / 2, "TIME", 0); drawtext(s->outpicref, s->start_x / 7, outlink->h / 2 - 14 * 4, "FREQUENCY (Hz)", 1); } else { int w = s->mode == SEPARATE ? s->w / s->nb_display_channels : s->w; for (y = 0; y < s->h; y += 20) { dst = s->outpicref->data[0] + (s->start_y + y) * s->outpicref->linesize[0]; dst[s->start_x - 2] = 200; dst[s->start_x + s->w + 1] = 200; } for (y = 0; y < s->h; y += 40) { dst = s->outpicref->data[0] + (s->start_y + y) * s->outpicref->linesize[0]; dst[s->start_x - 3] = 200; dst[s->start_x + s->w + 2] = 200; } for (ch = 0; ch < (s->mode == SEPARATE ? s->nb_display_channels : 1); ch++) { dst = s->outpicref->data[0] + (s->start_y - 2) * s->outpicref->linesize[0] + s->start_x + w * ch; for (x = 0; x < w; x+=40) dst[x] = 200; dst = s->outpicref->data[0] + (s->start_y - 3) * s->outpicref->linesize[0] + s->start_x + w * ch; for (x = 0; x < w; x+=80) dst[x] = 200; dst = s->outpicref->data[0] + (s->h + s->start_y + 1) * s->outpicref->linesize[0] + s->start_x + w * ch; for (x = 0; x < w; x+=40) { dst[x] = 200; } dst = s->outpicref->data[0] + (s->h + s->start_y + 2) * s->outpicref->linesize[0] + s->start_x + w * ch; for (x = 0; x < w; x+=80) { dst[x] = 200; } for (x = 0; x < w; x += 80) { float hertz = x * (inlink->sample_rate / 2) / (float)(1 << (int)ceil(log2(w))); char *units; if (hertz == 0) units = av_asprintf("DC"); else units = av_asprintf("%.2f", hertz); if (!units) return AVERROR(ENOMEM); drawtext(s->outpicref, s->start_x - 4 * strlen(units) + x + w * ch, s->start_y - 12, units, 0); drawtext(s->outpicref, s->start_x - 4 * strlen(units) + x + w * ch, s->h + s->start_y + 6, units, 0); av_free(units); } } for (y = 0; y < s->h; y+=40) { float seconds = y * spp / inlink->sample_rate; char *units; if (x == 0) units = av_asprintf("0"); else if (log10(seconds) > 6) units = av_asprintf("%.2fh", seconds / (60 * 60)); else if (log10(seconds) > 3) units = av_asprintf("%.2fm", seconds / 60); else units = av_asprintf("%.2fs", seconds); if (!units) return AVERROR(ENOMEM); drawtext(s->outpicref, s->start_x - 8 * strlen(units) - 4, s->start_y + y - 4, units, 0); av_free(units); } drawtext(s->outpicref, s->start_x / 7, outlink->h / 2 - 4 * 4, "TIME", 1); drawtext(s->outpicref, outlink->w / 2 - 14 * 4, outlink->h - s->start_y / 2, "FREQUENCY (Hz)", 0); } for (ch = 0; ch < (multi ? s->nb_display_channels : 1); ch++) { int h = multi ? s->h / s->nb_display_channels : s->h; for (y = 0; y < h; y++) { float out[3] = { 0., 127.5, 127.5}; int chn; for (chn = 0; chn < (s->mode == SEPARATE ? 1 : s->nb_display_channels); chn++) { float yf, uf, vf; int channel = (multi) ? s->nb_display_channels - ch - 1 : chn; float lout[3]; color_range(s, channel, &yf, &uf, &vf); pick_color(s, yf, uf, vf, y / (float)h, lout); out[0] += lout[0]; out[1] += lout[1]; out[2] += lout[2]; } memset(s->outpicref->data[0]+(s->start_y + h * (ch + 1) - y - 1) * s->outpicref->linesize[0] + s->w + s->start_x + 20, av_clip_uint8(out[0]), 10); memset(s->outpicref->data[1]+(s->start_y + h * (ch + 1) - y - 1) * s->outpicref->linesize[1] + s->w + s->start_x + 20, av_clip_uint8(out[1]), 10); memset(s->outpicref->data[2]+(s->start_y + h * (ch + 1) - y - 1) * s->outpicref->linesize[2] + s->w + s->start_x + 20, av_clip_uint8(out[2]), 10); } for (y = 0; ch == 0 && y < h; y += h / 10) { float value = 120.0 * log10(1. - y / (float)h); char *text; if (value < -120) break; text = av_asprintf("%.0f dB", value); if (!text) continue; drawtext(s->outpicref, s->w + s->start_x + 35, s->start_y + y - 5, text, 0); av_free(text); } } } ret = ff_filter_frame(outlink, s->outpicref); s->outpicref = NULL; } return ret; }
true
FFmpeg
836c8750b31329e71e5ac2a194523172875b77eb
static int showspectrumpic_request_frame(AVFilterLink *outlink) { AVFilterContext *ctx = outlink->src; ShowSpectrumContext *s = ctx->priv; AVFilterLink *inlink = ctx->inputs[0]; int ret; ret = ff_request_frame(inlink); if (ret == AVERROR_EOF && s->outpicref) { int samples = av_audio_fifo_size(s->fifo); int consumed = 0; int y, x = 0, sz = s->orientation == VERTICAL ? s->w : s->h; int ch, spf, spb; AVFrame *fin; spf = s->win_size * (samples / ((s->win_size * sz) * ceil(samples / (float)(s->win_size * sz)))); spb = (samples / (spf * sz)) * spf; fin = ff_get_audio_buffer(inlink, s->win_size); if (!fin) return AVERROR(ENOMEM); while (x < sz) { ret = av_audio_fifo_peek(s->fifo, (void **)fin->extended_data, s->win_size); if (ret < 0) { av_frame_free(&fin); return ret; } av_audio_fifo_drain(s->fifo, spf); if (ret < s->win_size) { for (ch = 0; ch < s->nb_display_channels; ch++) { memset(fin->extended_data[ch] + ret * sizeof(float), 0, (s->win_size - ret) * sizeof(float)); } } ctx->internal->execute(ctx, run_channel_fft, fin, NULL, s->nb_display_channels); acalc_magnitudes(s); consumed += spf; if (consumed >= spb) { int h = s->orientation == VERTICAL ? s->h : s->w; scale_magnitudes(s, 1. / (consumed / spf)); plot_spectrum_column(inlink, fin); consumed = 0; x++; for (ch = 0; ch < s->nb_display_channels; ch++) memset(s->magnitudes[ch], 0, h * sizeof(float)); } } av_frame_free(&fin); s->outpicref->pts = 0; if (s->legend) { int multi = (s->mode == SEPARATE && s->color_mode == CHANNEL); float spp = samples / (float)sz; uint8_t *dst; drawtext(s->outpicref, 2, outlink->h - 10, "CREATED BY LIBAVFILTER", 0); dst = s->outpicref->data[0] + (s->start_y - 1) * s->outpicref->linesize[0] + s->start_x - 1; for (x = 0; x < s->w + 1; x++) dst[x] = 200; dst = s->outpicref->data[0] + (s->start_y + s->h) * s->outpicref->linesize[0] + s->start_x - 1; for (x = 0; x < s->w + 1; x++) dst[x] = 200; for (y = 0; y < s->h + 2; y++) { dst = s->outpicref->data[0] + (y + s->start_y - 1) * s->outpicref->linesize[0]; dst[s->start_x - 1] = 200; dst[s->start_x + s->w] = 200; } if (s->orientation == VERTICAL) { int h = s->mode == SEPARATE ? s->h / s->nb_display_channels : s->h; for (ch = 0; ch < (s->mode == SEPARATE ? s->nb_display_channels : 1); ch++) { for (y = 0; y < h; y += 20) { dst = s->outpicref->data[0] + (s->start_y + h * (ch + 1) - y - 1) * s->outpicref->linesize[0]; dst[s->start_x - 2] = 200; dst[s->start_x + s->w + 1] = 200; } for (y = 0; y < h; y += 40) { dst = s->outpicref->data[0] + (s->start_y + h * (ch + 1) - y - 1) * s->outpicref->linesize[0]; dst[s->start_x - 3] = 200; dst[s->start_x + s->w + 2] = 200; } dst = s->outpicref->data[0] + (s->start_y - 2) * s->outpicref->linesize[0] + s->start_x; for (x = 0; x < s->w; x+=40) dst[x] = 200; dst = s->outpicref->data[0] + (s->start_y - 3) * s->outpicref->linesize[0] + s->start_x; for (x = 0; x < s->w; x+=80) dst[x] = 200; dst = s->outpicref->data[0] + (s->h + s->start_y + 1) * s->outpicref->linesize[0] + s->start_x; for (x = 0; x < s->w; x+=40) { dst[x] = 200; } dst = s->outpicref->data[0] + (s->h + s->start_y + 2) * s->outpicref->linesize[0] + s->start_x; for (x = 0; x < s->w; x+=80) { dst[x] = 200; } for (y = 0; y < h; y += 40) { float hertz = y * (inlink->sample_rate / 2) / (float)(1 << (int)ceil(log2(h))); char *units; if (hertz == 0) units = av_asprintf("DC"); else units = av_asprintf("%.2f", hertz); if (!units) return AVERROR(ENOMEM); drawtext(s->outpicref, s->start_x - 8 * strlen(units) - 4, h * (ch + 1) + s->start_y - y - 4, units, 0); av_free(units); } } for (x = 0; x < s->w; x+=80) { float seconds = x * spp / inlink->sample_rate; char *units; if (x == 0) units = av_asprintf("0"); else if (log10(seconds) > 6) units = av_asprintf("%.2fh", seconds / (60 * 60)); else if (log10(seconds) > 3) units = av_asprintf("%.2fm", seconds / 60); else units = av_asprintf("%.2fs", seconds); if (!units) return AVERROR(ENOMEM); drawtext(s->outpicref, s->start_x + x - 4 * strlen(units), s->h + s->start_y + 6, units, 0); drawtext(s->outpicref, s->start_x + x - 4 * strlen(units), s->start_y - 12, units, 0); av_free(units); } drawtext(s->outpicref, outlink->w / 2 - 4 * 4, outlink->h - s->start_y / 2, "TIME", 0); drawtext(s->outpicref, s->start_x / 7, outlink->h / 2 - 14 * 4, "FREQUENCY (Hz)", 1); } else { int w = s->mode == SEPARATE ? s->w / s->nb_display_channels : s->w; for (y = 0; y < s->h; y += 20) { dst = s->outpicref->data[0] + (s->start_y + y) * s->outpicref->linesize[0]; dst[s->start_x - 2] = 200; dst[s->start_x + s->w + 1] = 200; } for (y = 0; y < s->h; y += 40) { dst = s->outpicref->data[0] + (s->start_y + y) * s->outpicref->linesize[0]; dst[s->start_x - 3] = 200; dst[s->start_x + s->w + 2] = 200; } for (ch = 0; ch < (s->mode == SEPARATE ? s->nb_display_channels : 1); ch++) { dst = s->outpicref->data[0] + (s->start_y - 2) * s->outpicref->linesize[0] + s->start_x + w * ch; for (x = 0; x < w; x+=40) dst[x] = 200; dst = s->outpicref->data[0] + (s->start_y - 3) * s->outpicref->linesize[0] + s->start_x + w * ch; for (x = 0; x < w; x+=80) dst[x] = 200; dst = s->outpicref->data[0] + (s->h + s->start_y + 1) * s->outpicref->linesize[0] + s->start_x + w * ch; for (x = 0; x < w; x+=40) { dst[x] = 200; } dst = s->outpicref->data[0] + (s->h + s->start_y + 2) * s->outpicref->linesize[0] + s->start_x + w * ch; for (x = 0; x < w; x+=80) { dst[x] = 200; } for (x = 0; x < w; x += 80) { float hertz = x * (inlink->sample_rate / 2) / (float)(1 << (int)ceil(log2(w))); char *units; if (hertz == 0) units = av_asprintf("DC"); else units = av_asprintf("%.2f", hertz); if (!units) return AVERROR(ENOMEM); drawtext(s->outpicref, s->start_x - 4 * strlen(units) + x + w * ch, s->start_y - 12, units, 0); drawtext(s->outpicref, s->start_x - 4 * strlen(units) + x + w * ch, s->h + s->start_y + 6, units, 0); av_free(units); } } for (y = 0; y < s->h; y+=40) { float seconds = y * spp / inlink->sample_rate; char *units; if (x == 0) units = av_asprintf("0"); else if (log10(seconds) > 6) units = av_asprintf("%.2fh", seconds / (60 * 60)); else if (log10(seconds) > 3) units = av_asprintf("%.2fm", seconds / 60); else units = av_asprintf("%.2fs", seconds); if (!units) return AVERROR(ENOMEM); drawtext(s->outpicref, s->start_x - 8 * strlen(units) - 4, s->start_y + y - 4, units, 0); av_free(units); } drawtext(s->outpicref, s->start_x / 7, outlink->h / 2 - 4 * 4, "TIME", 1); drawtext(s->outpicref, outlink->w / 2 - 14 * 4, outlink->h - s->start_y / 2, "FREQUENCY (Hz)", 0); } for (ch = 0; ch < (multi ? s->nb_display_channels : 1); ch++) { int h = multi ? s->h / s->nb_display_channels : s->h; for (y = 0; y < h; y++) { float out[3] = { 0., 127.5, 127.5}; int chn; for (chn = 0; chn < (s->mode == SEPARATE ? 1 : s->nb_display_channels); chn++) { float yf, uf, vf; int channel = (multi) ? s->nb_display_channels - ch - 1 : chn; float lout[3]; color_range(s, channel, &yf, &uf, &vf); pick_color(s, yf, uf, vf, y / (float)h, lout); out[0] += lout[0]; out[1] += lout[1]; out[2] += lout[2]; } memset(s->outpicref->data[0]+(s->start_y + h * (ch + 1) - y - 1) * s->outpicref->linesize[0] + s->w + s->start_x + 20, av_clip_uint8(out[0]), 10); memset(s->outpicref->data[1]+(s->start_y + h * (ch + 1) - y - 1) * s->outpicref->linesize[1] + s->w + s->start_x + 20, av_clip_uint8(out[1]), 10); memset(s->outpicref->data[2]+(s->start_y + h * (ch + 1) - y - 1) * s->outpicref->linesize[2] + s->w + s->start_x + 20, av_clip_uint8(out[2]), 10); } for (y = 0; ch == 0 && y < h; y += h / 10) { float value = 120.0 * log10(1. - y / (float)h); char *text; if (value < -120) break; text = av_asprintf("%.0f dB", value); if (!text) continue; drawtext(s->outpicref, s->w + s->start_x + 35, s->start_y + y - 5, text, 0); av_free(text); } } } ret = ff_filter_frame(outlink, s->outpicref); s->outpicref = NULL; } return ret; }
{ "code": [ " int ret;", " if (ret == AVERROR_EOF && s->outpicref) {", " int samples = av_audio_fifo_size(s->fifo);" ], "line_no": [ 11, 17, 19 ] }
static int FUNC_0(AVFilterLink *VAR_0) { AVFilterContext *ctx = VAR_0->src; ShowSpectrumContext *s = ctx->priv; AVFilterLink *inlink = ctx->inputs[0]; int VAR_1; VAR_1 = ff_request_frame(inlink); if (VAR_1 == AVERROR_EOF && s->outpicref) { int VAR_2 = av_audio_fifo_size(s->fifo); int VAR_3 = 0; int VAR_4, VAR_5 = 0, VAR_6 = s->orientation == VERTICAL ? s->VAR_13 : s->VAR_13; int VAR_7, VAR_8, VAR_9; AVFrame *fin; VAR_8 = s->win_size * (VAR_2 / ((s->win_size * VAR_6) * ceil(VAR_2 / (float)(s->win_size * VAR_6)))); VAR_9 = (VAR_2 / (VAR_8 * VAR_6)) * VAR_8; fin = ff_get_audio_buffer(inlink, s->win_size); if (!fin) return AVERROR(ENOMEM); while (VAR_5 < VAR_6) { VAR_1 = av_audio_fifo_peek(s->fifo, (void **)fin->extended_data, s->win_size); if (VAR_1 < 0) { av_frame_free(&fin); return VAR_1; } av_audio_fifo_drain(s->fifo, VAR_8); if (VAR_1 < s->win_size) { for (VAR_7 = 0; VAR_7 < s->nb_display_channels; VAR_7++) { memset(fin->extended_data[VAR_7] + VAR_1 * sizeof(float), 0, (s->win_size - VAR_1) * sizeof(float)); } } ctx->internal->execute(ctx, run_channel_fft, fin, NULL, s->nb_display_channels); acalc_magnitudes(s); VAR_3 += VAR_8; if (VAR_3 >= VAR_9) { int VAR_13 = s->orientation == VERTICAL ? s->VAR_13 : s->VAR_13; scale_magnitudes(s, 1. / (VAR_3 / VAR_8)); plot_spectrum_column(inlink, fin); VAR_3 = 0; VAR_5++; for (VAR_7 = 0; VAR_7 < s->nb_display_channels; VAR_7++) memset(s->magnitudes[VAR_7], 0, VAR_13 * sizeof(float)); } } av_frame_free(&fin); s->outpicref->pts = 0; if (s->legend) { int VAR_11 = (s->mode == SEPARATE && s->color_mode == CHANNEL); float VAR_12 = VAR_2 / (float)VAR_6; uint8_t *dst; drawtext(s->outpicref, 2, VAR_0->VAR_13 - 10, "CREATED BY LIBAVFILTER", 0); dst = s->outpicref->data[0] + (s->start_y - 1) * s->outpicref->linesize[0] + s->start_x - 1; for (VAR_5 = 0; VAR_5 < s->VAR_13 + 1; VAR_5++) dst[VAR_5] = 200; dst = s->outpicref->data[0] + (s->start_y + s->VAR_13) * s->outpicref->linesize[0] + s->start_x - 1; for (VAR_5 = 0; VAR_5 < s->VAR_13 + 1; VAR_5++) dst[VAR_5] = 200; for (VAR_4 = 0; VAR_4 < s->VAR_13 + 2; VAR_4++) { dst = s->outpicref->data[0] + (VAR_4 + s->start_y - 1) * s->outpicref->linesize[0]; dst[s->start_x - 1] = 200; dst[s->start_x + s->VAR_13] = 200; } if (s->orientation == VERTICAL) { int VAR_13 = s->mode == SEPARATE ? s->VAR_13 / s->nb_display_channels : s->VAR_13; for (VAR_7 = 0; VAR_7 < (s->mode == SEPARATE ? s->nb_display_channels : 1); VAR_7++) { for (VAR_4 = 0; VAR_4 < VAR_13; VAR_4 += 20) { dst = s->outpicref->data[0] + (s->start_y + VAR_13 * (VAR_7 + 1) - VAR_4 - 1) * s->outpicref->linesize[0]; dst[s->start_x - 2] = 200; dst[s->start_x + s->VAR_13 + 1] = 200; } for (VAR_4 = 0; VAR_4 < VAR_13; VAR_4 += 40) { dst = s->outpicref->data[0] + (s->start_y + VAR_13 * (VAR_7 + 1) - VAR_4 - 1) * s->outpicref->linesize[0]; dst[s->start_x - 3] = 200; dst[s->start_x + s->VAR_13 + 2] = 200; } dst = s->outpicref->data[0] + (s->start_y - 2) * s->outpicref->linesize[0] + s->start_x; for (VAR_5 = 0; VAR_5 < s->VAR_13; VAR_5+=40) dst[VAR_5] = 200; dst = s->outpicref->data[0] + (s->start_y - 3) * s->outpicref->linesize[0] + s->start_x; for (VAR_5 = 0; VAR_5 < s->VAR_13; VAR_5+=80) dst[VAR_5] = 200; dst = s->outpicref->data[0] + (s->VAR_13 + s->start_y + 1) * s->outpicref->linesize[0] + s->start_x; for (VAR_5 = 0; VAR_5 < s->VAR_13; VAR_5+=40) { dst[VAR_5] = 200; } dst = s->outpicref->data[0] + (s->VAR_13 + s->start_y + 2) * s->outpicref->linesize[0] + s->start_x; for (VAR_5 = 0; VAR_5 < s->VAR_13; VAR_5+=80) { dst[VAR_5] = 200; } for (VAR_4 = 0; VAR_4 < VAR_13; VAR_4 += 40) { float hertz = VAR_4 * (inlink->sample_rate / 2) / (float)(1 << (int)ceil(log2(VAR_13))); char *units; if (hertz == 0) units = av_asprintf("DC"); else units = av_asprintf("%.2f", hertz); if (!units) return AVERROR(ENOMEM); drawtext(s->outpicref, s->start_x - 8 * strlen(units) - 4, VAR_13 * (VAR_7 + 1) + s->start_y - VAR_4 - 4, units, 0); av_free(units); } } for (VAR_5 = 0; VAR_5 < s->VAR_13; VAR_5+=80) { float seconds = VAR_5 * VAR_12 / inlink->sample_rate; char *units; if (VAR_5 == 0) units = av_asprintf("0"); else if (log10(seconds) > 6) units = av_asprintf("%.2fh", seconds / (60 * 60)); else if (log10(seconds) > 3) units = av_asprintf("%.2fm", seconds / 60); else units = av_asprintf("%.2fs", seconds); if (!units) return AVERROR(ENOMEM); drawtext(s->outpicref, s->start_x + VAR_5 - 4 * strlen(units), s->VAR_13 + s->start_y + 6, units, 0); drawtext(s->outpicref, s->start_x + VAR_5 - 4 * strlen(units), s->start_y - 12, units, 0); av_free(units); } drawtext(s->outpicref, VAR_0->VAR_13 / 2 - 4 * 4, VAR_0->VAR_13 - s->start_y / 2, "TIME", 0); drawtext(s->outpicref, s->start_x / 7, VAR_0->VAR_13 / 2 - 14 * 4, "FREQUENCY (Hz)", 1); } else { int VAR_13 = s->mode == SEPARATE ? s->VAR_13 / s->nb_display_channels : s->VAR_13; for (VAR_4 = 0; VAR_4 < s->VAR_13; VAR_4 += 20) { dst = s->outpicref->data[0] + (s->start_y + VAR_4) * s->outpicref->linesize[0]; dst[s->start_x - 2] = 200; dst[s->start_x + s->VAR_13 + 1] = 200; } for (VAR_4 = 0; VAR_4 < s->VAR_13; VAR_4 += 40) { dst = s->outpicref->data[0] + (s->start_y + VAR_4) * s->outpicref->linesize[0]; dst[s->start_x - 3] = 200; dst[s->start_x + s->VAR_13 + 2] = 200; } for (VAR_7 = 0; VAR_7 < (s->mode == SEPARATE ? s->nb_display_channels : 1); VAR_7++) { dst = s->outpicref->data[0] + (s->start_y - 2) * s->outpicref->linesize[0] + s->start_x + VAR_13 * VAR_7; for (VAR_5 = 0; VAR_5 < VAR_13; VAR_5+=40) dst[VAR_5] = 200; dst = s->outpicref->data[0] + (s->start_y - 3) * s->outpicref->linesize[0] + s->start_x + VAR_13 * VAR_7; for (VAR_5 = 0; VAR_5 < VAR_13; VAR_5+=80) dst[VAR_5] = 200; dst = s->outpicref->data[0] + (s->VAR_13 + s->start_y + 1) * s->outpicref->linesize[0] + s->start_x + VAR_13 * VAR_7; for (VAR_5 = 0; VAR_5 < VAR_13; VAR_5+=40) { dst[VAR_5] = 200; } dst = s->outpicref->data[0] + (s->VAR_13 + s->start_y + 2) * s->outpicref->linesize[0] + s->start_x + VAR_13 * VAR_7; for (VAR_5 = 0; VAR_5 < VAR_13; VAR_5+=80) { dst[VAR_5] = 200; } for (VAR_5 = 0; VAR_5 < VAR_13; VAR_5 += 80) { float hertz = VAR_5 * (inlink->sample_rate / 2) / (float)(1 << (int)ceil(log2(VAR_13))); char *units; if (hertz == 0) units = av_asprintf("DC"); else units = av_asprintf("%.2f", hertz); if (!units) return AVERROR(ENOMEM); drawtext(s->outpicref, s->start_x - 4 * strlen(units) + VAR_5 + VAR_13 * VAR_7, s->start_y - 12, units, 0); drawtext(s->outpicref, s->start_x - 4 * strlen(units) + VAR_5 + VAR_13 * VAR_7, s->VAR_13 + s->start_y + 6, units, 0); av_free(units); } } for (VAR_4 = 0; VAR_4 < s->VAR_13; VAR_4+=40) { float seconds = VAR_4 * VAR_12 / inlink->sample_rate; char *units; if (VAR_5 == 0) units = av_asprintf("0"); else if (log10(seconds) > 6) units = av_asprintf("%.2fh", seconds / (60 * 60)); else if (log10(seconds) > 3) units = av_asprintf("%.2fm", seconds / 60); else units = av_asprintf("%.2fs", seconds); if (!units) return AVERROR(ENOMEM); drawtext(s->outpicref, s->start_x - 8 * strlen(units) - 4, s->start_y + VAR_4 - 4, units, 0); av_free(units); } drawtext(s->outpicref, s->start_x / 7, VAR_0->VAR_13 / 2 - 4 * 4, "TIME", 1); drawtext(s->outpicref, VAR_0->VAR_13 / 2 - 14 * 4, VAR_0->VAR_13 - s->start_y / 2, "FREQUENCY (Hz)", 0); } for (VAR_7 = 0; VAR_7 < (VAR_11 ? s->nb_display_channels : 1); VAR_7++) { int VAR_13 = VAR_11 ? s->VAR_13 / s->nb_display_channels : s->VAR_13; for (VAR_4 = 0; VAR_4 < VAR_13; VAR_4++) { float out[3] = { 0., 127.5, 127.5}; int chn; for (chn = 0; chn < (s->mode == SEPARATE ? 1 : s->nb_display_channels); chn++) { float yf, uf, vf; int channel = (VAR_11) ? s->nb_display_channels - VAR_7 - 1 : chn; float lout[3]; color_range(s, channel, &yf, &uf, &vf); pick_color(s, yf, uf, vf, VAR_4 / (float)VAR_13, lout); out[0] += lout[0]; out[1] += lout[1]; out[2] += lout[2]; } memset(s->outpicref->data[0]+(s->start_y + VAR_13 * (VAR_7 + 1) - VAR_4 - 1) * s->outpicref->linesize[0] + s->VAR_13 + s->start_x + 20, av_clip_uint8(out[0]), 10); memset(s->outpicref->data[1]+(s->start_y + VAR_13 * (VAR_7 + 1) - VAR_4 - 1) * s->outpicref->linesize[1] + s->VAR_13 + s->start_x + 20, av_clip_uint8(out[1]), 10); memset(s->outpicref->data[2]+(s->start_y + VAR_13 * (VAR_7 + 1) - VAR_4 - 1) * s->outpicref->linesize[2] + s->VAR_13 + s->start_x + 20, av_clip_uint8(out[2]), 10); } for (VAR_4 = 0; VAR_7 == 0 && VAR_4 < VAR_13; VAR_4 += VAR_13 / 10) { float value = 120.0 * log10(1. - VAR_4 / (float)VAR_13); char *text; if (value < -120) break; text = av_asprintf("%.0f dB", value); if (!text) continue; drawtext(s->outpicref, s->VAR_13 + s->start_x + 35, s->start_y + VAR_4 - 5, text, 0); av_free(text); } } } VAR_1 = ff_filter_frame(VAR_0, s->outpicref); s->outpicref = NULL; } return VAR_1; }
[ "static int FUNC_0(AVFilterLink *VAR_0)\n{", "AVFilterContext *ctx = VAR_0->src;", "ShowSpectrumContext *s = ctx->priv;", "AVFilterLink *inlink = ctx->inputs[0];", "int VAR_1;", "VAR_1 = ff_request_frame(inlink);", "if (VAR_1 == AVERROR_EOF && s->outpicref) {", "int VAR_2 = av_audio_fifo_size(s->fifo);", "int VAR_3 = 0;", "int VAR_4, VAR_5 = 0, VAR_6 = s->orientation == VERTICAL ? s->VAR_13 : s->VAR_13;", "int VAR_7, VAR_8, VAR_9;", "AVFrame *fin;", "VAR_8 = s->win_size * (VAR_2 / ((s->win_size * VAR_6) * ceil(VAR_2 / (float)(s->win_size * VAR_6))));", "VAR_9 = (VAR_2 / (VAR_8 * VAR_6)) * VAR_8;", "fin = ff_get_audio_buffer(inlink, s->win_size);", "if (!fin)\nreturn AVERROR(ENOMEM);", "while (VAR_5 < VAR_6) {", "VAR_1 = av_audio_fifo_peek(s->fifo, (void **)fin->extended_data, s->win_size);", "if (VAR_1 < 0) {", "av_frame_free(&fin);", "return VAR_1;", "}", "av_audio_fifo_drain(s->fifo, VAR_8);", "if (VAR_1 < s->win_size) {", "for (VAR_7 = 0; VAR_7 < s->nb_display_channels; VAR_7++) {", "memset(fin->extended_data[VAR_7] + VAR_1 * sizeof(float), 0,\n(s->win_size - VAR_1) * sizeof(float));", "}", "}", "ctx->internal->execute(ctx, run_channel_fft, fin, NULL, s->nb_display_channels);", "acalc_magnitudes(s);", "VAR_3 += VAR_8;", "if (VAR_3 >= VAR_9) {", "int VAR_13 = s->orientation == VERTICAL ? s->VAR_13 : s->VAR_13;", "scale_magnitudes(s, 1. / (VAR_3 / VAR_8));", "plot_spectrum_column(inlink, fin);", "VAR_3 = 0;", "VAR_5++;", "for (VAR_7 = 0; VAR_7 < s->nb_display_channels; VAR_7++)", "memset(s->magnitudes[VAR_7], 0, VAR_13 * sizeof(float));", "}", "}", "av_frame_free(&fin);", "s->outpicref->pts = 0;", "if (s->legend) {", "int VAR_11 = (s->mode == SEPARATE && s->color_mode == CHANNEL);", "float VAR_12 = VAR_2 / (float)VAR_6;", "uint8_t *dst;", "drawtext(s->outpicref, 2, VAR_0->VAR_13 - 10, \"CREATED BY LIBAVFILTER\", 0);", "dst = s->outpicref->data[0] + (s->start_y - 1) * s->outpicref->linesize[0] + s->start_x - 1;", "for (VAR_5 = 0; VAR_5 < s->VAR_13 + 1; VAR_5++)", "dst[VAR_5] = 200;", "dst = s->outpicref->data[0] + (s->start_y + s->VAR_13) * s->outpicref->linesize[0] + s->start_x - 1;", "for (VAR_5 = 0; VAR_5 < s->VAR_13 + 1; VAR_5++)", "dst[VAR_5] = 200;", "for (VAR_4 = 0; VAR_4 < s->VAR_13 + 2; VAR_4++) {", "dst = s->outpicref->data[0] + (VAR_4 + s->start_y - 1) * s->outpicref->linesize[0];", "dst[s->start_x - 1] = 200;", "dst[s->start_x + s->VAR_13] = 200;", "}", "if (s->orientation == VERTICAL) {", "int VAR_13 = s->mode == SEPARATE ? s->VAR_13 / s->nb_display_channels : s->VAR_13;", "for (VAR_7 = 0; VAR_7 < (s->mode == SEPARATE ? s->nb_display_channels : 1); VAR_7++) {", "for (VAR_4 = 0; VAR_4 < VAR_13; VAR_4 += 20) {", "dst = s->outpicref->data[0] + (s->start_y + VAR_13 * (VAR_7 + 1) - VAR_4 - 1) * s->outpicref->linesize[0];", "dst[s->start_x - 2] = 200;", "dst[s->start_x + s->VAR_13 + 1] = 200;", "}", "for (VAR_4 = 0; VAR_4 < VAR_13; VAR_4 += 40) {", "dst = s->outpicref->data[0] + (s->start_y + VAR_13 * (VAR_7 + 1) - VAR_4 - 1) * s->outpicref->linesize[0];", "dst[s->start_x - 3] = 200;", "dst[s->start_x + s->VAR_13 + 2] = 200;", "}", "dst = s->outpicref->data[0] + (s->start_y - 2) * s->outpicref->linesize[0] + s->start_x;", "for (VAR_5 = 0; VAR_5 < s->VAR_13; VAR_5+=40)", "dst[VAR_5] = 200;", "dst = s->outpicref->data[0] + (s->start_y - 3) * s->outpicref->linesize[0] + s->start_x;", "for (VAR_5 = 0; VAR_5 < s->VAR_13; VAR_5+=80)", "dst[VAR_5] = 200;", "dst = s->outpicref->data[0] + (s->VAR_13 + s->start_y + 1) * s->outpicref->linesize[0] + s->start_x;", "for (VAR_5 = 0; VAR_5 < s->VAR_13; VAR_5+=40) {", "dst[VAR_5] = 200;", "}", "dst = s->outpicref->data[0] + (s->VAR_13 + s->start_y + 2) * s->outpicref->linesize[0] + s->start_x;", "for (VAR_5 = 0; VAR_5 < s->VAR_13; VAR_5+=80) {", "dst[VAR_5] = 200;", "}", "for (VAR_4 = 0; VAR_4 < VAR_13; VAR_4 += 40) {", "float hertz = VAR_4 * (inlink->sample_rate / 2) / (float)(1 << (int)ceil(log2(VAR_13)));", "char *units;", "if (hertz == 0)\nunits = av_asprintf(\"DC\");", "else\nunits = av_asprintf(\"%.2f\", hertz);", "if (!units)\nreturn AVERROR(ENOMEM);", "drawtext(s->outpicref, s->start_x - 8 * strlen(units) - 4, VAR_13 * (VAR_7 + 1) + s->start_y - VAR_4 - 4, units, 0);", "av_free(units);", "}", "}", "for (VAR_5 = 0; VAR_5 < s->VAR_13; VAR_5+=80) {", "float seconds = VAR_5 * VAR_12 / inlink->sample_rate;", "char *units;", "if (VAR_5 == 0)\nunits = av_asprintf(\"0\");", "else if (log10(seconds) > 6)\nunits = av_asprintf(\"%.2fh\", seconds / (60 * 60));", "else if (log10(seconds) > 3)\nunits = av_asprintf(\"%.2fm\", seconds / 60);", "else\nunits = av_asprintf(\"%.2fs\", seconds);", "if (!units)\nreturn AVERROR(ENOMEM);", "drawtext(s->outpicref, s->start_x + VAR_5 - 4 * strlen(units), s->VAR_13 + s->start_y + 6, units, 0);", "drawtext(s->outpicref, s->start_x + VAR_5 - 4 * strlen(units), s->start_y - 12, units, 0);", "av_free(units);", "}", "drawtext(s->outpicref, VAR_0->VAR_13 / 2 - 4 * 4, VAR_0->VAR_13 - s->start_y / 2, \"TIME\", 0);", "drawtext(s->outpicref, s->start_x / 7, VAR_0->VAR_13 / 2 - 14 * 4, \"FREQUENCY (Hz)\", 1);", "} else {", "int VAR_13 = s->mode == SEPARATE ? s->VAR_13 / s->nb_display_channels : s->VAR_13;", "for (VAR_4 = 0; VAR_4 < s->VAR_13; VAR_4 += 20) {", "dst = s->outpicref->data[0] + (s->start_y + VAR_4) * s->outpicref->linesize[0];", "dst[s->start_x - 2] = 200;", "dst[s->start_x + s->VAR_13 + 1] = 200;", "}", "for (VAR_4 = 0; VAR_4 < s->VAR_13; VAR_4 += 40) {", "dst = s->outpicref->data[0] + (s->start_y + VAR_4) * s->outpicref->linesize[0];", "dst[s->start_x - 3] = 200;", "dst[s->start_x + s->VAR_13 + 2] = 200;", "}", "for (VAR_7 = 0; VAR_7 < (s->mode == SEPARATE ? s->nb_display_channels : 1); VAR_7++) {", "dst = s->outpicref->data[0] + (s->start_y - 2) * s->outpicref->linesize[0] + s->start_x + VAR_13 * VAR_7;", "for (VAR_5 = 0; VAR_5 < VAR_13; VAR_5+=40)", "dst[VAR_5] = 200;", "dst = s->outpicref->data[0] + (s->start_y - 3) * s->outpicref->linesize[0] + s->start_x + VAR_13 * VAR_7;", "for (VAR_5 = 0; VAR_5 < VAR_13; VAR_5+=80)", "dst[VAR_5] = 200;", "dst = s->outpicref->data[0] + (s->VAR_13 + s->start_y + 1) * s->outpicref->linesize[0] + s->start_x + VAR_13 * VAR_7;", "for (VAR_5 = 0; VAR_5 < VAR_13; VAR_5+=40) {", "dst[VAR_5] = 200;", "}", "dst = s->outpicref->data[0] + (s->VAR_13 + s->start_y + 2) * s->outpicref->linesize[0] + s->start_x + VAR_13 * VAR_7;", "for (VAR_5 = 0; VAR_5 < VAR_13; VAR_5+=80) {", "dst[VAR_5] = 200;", "}", "for (VAR_5 = 0; VAR_5 < VAR_13; VAR_5 += 80) {", "float hertz = VAR_5 * (inlink->sample_rate / 2) / (float)(1 << (int)ceil(log2(VAR_13)));", "char *units;", "if (hertz == 0)\nunits = av_asprintf(\"DC\");", "else\nunits = av_asprintf(\"%.2f\", hertz);", "if (!units)\nreturn AVERROR(ENOMEM);", "drawtext(s->outpicref, s->start_x - 4 * strlen(units) + VAR_5 + VAR_13 * VAR_7, s->start_y - 12, units, 0);", "drawtext(s->outpicref, s->start_x - 4 * strlen(units) + VAR_5 + VAR_13 * VAR_7, s->VAR_13 + s->start_y + 6, units, 0);", "av_free(units);", "}", "}", "for (VAR_4 = 0; VAR_4 < s->VAR_13; VAR_4+=40) {", "float seconds = VAR_4 * VAR_12 / inlink->sample_rate;", "char *units;", "if (VAR_5 == 0)\nunits = av_asprintf(\"0\");", "else if (log10(seconds) > 6)\nunits = av_asprintf(\"%.2fh\", seconds / (60 * 60));", "else if (log10(seconds) > 3)\nunits = av_asprintf(\"%.2fm\", seconds / 60);", "else\nunits = av_asprintf(\"%.2fs\", seconds);", "if (!units)\nreturn AVERROR(ENOMEM);", "drawtext(s->outpicref, s->start_x - 8 * strlen(units) - 4, s->start_y + VAR_4 - 4, units, 0);", "av_free(units);", "}", "drawtext(s->outpicref, s->start_x / 7, VAR_0->VAR_13 / 2 - 4 * 4, \"TIME\", 1);", "drawtext(s->outpicref, VAR_0->VAR_13 / 2 - 14 * 4, VAR_0->VAR_13 - s->start_y / 2, \"FREQUENCY (Hz)\", 0);", "}", "for (VAR_7 = 0; VAR_7 < (VAR_11 ? s->nb_display_channels : 1); VAR_7++) {", "int VAR_13 = VAR_11 ? s->VAR_13 / s->nb_display_channels : s->VAR_13;", "for (VAR_4 = 0; VAR_4 < VAR_13; VAR_4++) {", "float out[3] = { 0., 127.5, 127.5};", "int chn;", "for (chn = 0; chn < (s->mode == SEPARATE ? 1 : s->nb_display_channels); chn++) {", "float yf, uf, vf;", "int channel = (VAR_11) ? s->nb_display_channels - VAR_7 - 1 : chn;", "float lout[3];", "color_range(s, channel, &yf, &uf, &vf);", "pick_color(s, yf, uf, vf, VAR_4 / (float)VAR_13, lout);", "out[0] += lout[0];", "out[1] += lout[1];", "out[2] += lout[2];", "}", "memset(s->outpicref->data[0]+(s->start_y + VAR_13 * (VAR_7 + 1) - VAR_4 - 1) * s->outpicref->linesize[0] + s->VAR_13 + s->start_x + 20, av_clip_uint8(out[0]), 10);", "memset(s->outpicref->data[1]+(s->start_y + VAR_13 * (VAR_7 + 1) - VAR_4 - 1) * s->outpicref->linesize[1] + s->VAR_13 + s->start_x + 20, av_clip_uint8(out[1]), 10);", "memset(s->outpicref->data[2]+(s->start_y + VAR_13 * (VAR_7 + 1) - VAR_4 - 1) * s->outpicref->linesize[2] + s->VAR_13 + s->start_x + 20, av_clip_uint8(out[2]), 10);", "}", "for (VAR_4 = 0; VAR_7 == 0 && VAR_4 < VAR_13; VAR_4 += VAR_13 / 10) {", "float value = 120.0 * log10(1. - VAR_4 / (float)VAR_13);", "char *text;", "if (value < -120)\nbreak;", "text = av_asprintf(\"%.0f dB\", value);", "if (!text)\ncontinue;", "drawtext(s->outpicref, s->VAR_13 + s->start_x + 35, s->start_y + VAR_4 - 5, text, 0);", "av_free(text);", "}", "}", "}", "VAR_1 = ff_filter_frame(VAR_0, s->outpicref);", "s->outpicref = NULL;", "}", "return VAR_1;", "}" ]
[ 0, 0, 0, 0, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 31 ], [ 33 ], [ 37 ], [ 39, 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 63 ], [ 65 ], [ 67, 69 ], [ 71 ], [ 73 ], [ 77 ], [ 79 ], [ 83 ], [ 85 ], [ 87 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 109 ], [ 111 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 125 ], [ 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 ], [ 213, 215 ], [ 217, 219 ], [ 221, 223 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 237 ], [ 239 ], [ 241 ], [ 245, 247 ], [ 249, 251 ], [ 253, 255 ], [ 257, 259 ], [ 261, 263 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 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 ], [ 357 ], [ 359 ], [ 361 ], [ 363 ], [ 365 ], [ 367 ], [ 369 ], [ 371 ], [ 375, 377 ], [ 379, 381 ], [ 383, 385 ], [ 387, 389 ], [ 391, 393 ], [ 397 ], [ 399 ], [ 401 ], [ 403 ], [ 405 ], [ 407 ], [ 411 ], [ 413 ], [ 417 ], [ 419 ], [ 421 ], [ 425 ], [ 427 ], [ 429 ], [ 431 ], [ 435 ], [ 437 ], [ 439 ], [ 441 ], [ 443 ], [ 445 ], [ 447 ], [ 449 ], [ 451 ], [ 453 ], [ 457 ], [ 459 ], [ 461 ], [ 465, 467 ], [ 469 ], [ 471, 473 ], [ 475 ], [ 477 ], [ 479 ], [ 481 ], [ 483 ], [ 487 ], [ 489 ], [ 491 ], [ 495 ], [ 497 ] ]
6,645
static int usb_msd_initfn_storage(USBDevice *dev) { MSDState *s = DO_UPCAST(MSDState, dev, dev); BlockDriverState *bs = s->conf.bs; SCSIDevice *scsi_dev; Error *err = NULL; if (!bs) { error_report("drive property not set"); return -1; } blkconf_serial(&s->conf, &dev->serial); /* * Hack alert: this pretends to be a block device, but it's really * a SCSI bus that can serve only a single device, which it * creates automatically. But first it needs to detach from its * blockdev, or else scsi_bus_legacy_add_drive() dies when it * attaches again. * * The hack is probably a bad idea. */ bdrv_detach_dev(bs, &s->dev.qdev); s->conf.bs = NULL; usb_desc_create_serial(dev); usb_desc_init(dev); scsi_bus_new(&s->bus, sizeof(s->bus), DEVICE(dev), &usb_msd_scsi_info_storage, NULL); scsi_dev = scsi_bus_legacy_add_drive(&s->bus, bs, 0, !!s->removable, s->conf.bootindex, dev->serial, &err); if (!scsi_dev) { return -1; } s->bus.qbus.allow_hotplug = 0; usb_msd_handle_reset(dev); if (bdrv_key_required(bs)) { if (cur_mon) { monitor_read_bdrv_key_start(cur_mon, bs, usb_msd_password_cb, s); s->dev.auto_attach = 0; } else { autostart = 0; } } return 0; }
true
qemu
f0bc7fe3b75d2ae4aedb6da6f68ebb87f77d929b
static int usb_msd_initfn_storage(USBDevice *dev) { MSDState *s = DO_UPCAST(MSDState, dev, dev); BlockDriverState *bs = s->conf.bs; SCSIDevice *scsi_dev; Error *err = NULL; if (!bs) { error_report("drive property not set"); return -1; } blkconf_serial(&s->conf, &dev->serial); bdrv_detach_dev(bs, &s->dev.qdev); s->conf.bs = NULL; usb_desc_create_serial(dev); usb_desc_init(dev); scsi_bus_new(&s->bus, sizeof(s->bus), DEVICE(dev), &usb_msd_scsi_info_storage, NULL); scsi_dev = scsi_bus_legacy_add_drive(&s->bus, bs, 0, !!s->removable, s->conf.bootindex, dev->serial, &err); if (!scsi_dev) { return -1; } s->bus.qbus.allow_hotplug = 0; usb_msd_handle_reset(dev); if (bdrv_key_required(bs)) { if (cur_mon) { monitor_read_bdrv_key_start(cur_mon, bs, usb_msd_password_cb, s); s->dev.auto_attach = 0; } else { autostart = 0; } } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(USBDevice *VAR_0) { MSDState *s = DO_UPCAST(MSDState, VAR_0, VAR_0); BlockDriverState *bs = s->conf.bs; SCSIDevice *scsi_dev; Error *err = NULL; if (!bs) { error_report("drive property not set"); return -1; } blkconf_serial(&s->conf, &VAR_0->serial); bdrv_detach_dev(bs, &s->VAR_0.qdev); s->conf.bs = NULL; usb_desc_create_serial(VAR_0); usb_desc_init(VAR_0); scsi_bus_new(&s->bus, sizeof(s->bus), DEVICE(VAR_0), &usb_msd_scsi_info_storage, NULL); scsi_dev = scsi_bus_legacy_add_drive(&s->bus, bs, 0, !!s->removable, s->conf.bootindex, VAR_0->serial, &err); if (!scsi_dev) { return -1; } s->bus.qbus.allow_hotplug = 0; usb_msd_handle_reset(VAR_0); if (bdrv_key_required(bs)) { if (cur_mon) { monitor_read_bdrv_key_start(cur_mon, bs, usb_msd_password_cb, s); s->VAR_0.auto_attach = 0; } else { autostart = 0; } } return 0; }
[ "static int FUNC_0(USBDevice *VAR_0)\n{", "MSDState *s = DO_UPCAST(MSDState, VAR_0, VAR_0);", "BlockDriverState *bs = s->conf.bs;", "SCSIDevice *scsi_dev;", "Error *err = NULL;", "if (!bs) {", "error_report(\"drive property not set\");", "return -1;", "}", "blkconf_serial(&s->conf, &VAR_0->serial);", "bdrv_detach_dev(bs, &s->VAR_0.qdev);", "s->conf.bs = NULL;", "usb_desc_create_serial(VAR_0);", "usb_desc_init(VAR_0);", "scsi_bus_new(&s->bus, sizeof(s->bus), DEVICE(VAR_0),\n&usb_msd_scsi_info_storage, NULL);", "scsi_dev = scsi_bus_legacy_add_drive(&s->bus, bs, 0, !!s->removable,\ns->conf.bootindex, VAR_0->serial,\n&err);", "if (!scsi_dev) {", "return -1;", "}", "s->bus.qbus.allow_hotplug = 0;", "usb_msd_handle_reset(VAR_0);", "if (bdrv_key_required(bs)) {", "if (cur_mon) {", "monitor_read_bdrv_key_start(cur_mon, bs, usb_msd_password_cb, s);", "s->VAR_0.auto_attach = 0;", "} else {", "autostart = 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57, 59 ], [ 61, 63, 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99 ], [ 101 ] ]
6,647
static gnutls_anon_server_credentials_t vnc_tls_initialize_anon_cred(void) { gnutls_anon_server_credentials_t anon_cred; int ret; if ((ret = gnutls_anon_allocate_server_credentials(&anon_cred)) < 0) { VNC_DEBUG("Cannot allocate credentials %s\n", gnutls_strerror(ret)); return NULL; } gnutls_anon_set_server_dh_params(anon_cred, dh_params); return anon_cred; }
true
qemu
3e305e4a4752f70c0b5c3cf5b43ec957881714f7
static gnutls_anon_server_credentials_t vnc_tls_initialize_anon_cred(void) { gnutls_anon_server_credentials_t anon_cred; int ret; if ((ret = gnutls_anon_allocate_server_credentials(&anon_cred)) < 0) { VNC_DEBUG("Cannot allocate credentials %s\n", gnutls_strerror(ret)); return NULL; } gnutls_anon_set_server_dh_params(anon_cred, dh_params); return anon_cred; }
{ "code": [ " int ret;", " int ret;", " int ret;", "static gnutls_anon_server_credentials_t vnc_tls_initialize_anon_cred(void)", " gnutls_anon_server_credentials_t anon_cred;", " int ret;", " if ((ret = gnutls_anon_allocate_server_credentials(&anon_cred)) < 0) {", " VNC_DEBUG(\"Cannot allocate credentials %s\\n\", gnutls_strerror(ret));", " return NULL;", " gnutls_anon_set_server_dh_params(anon_cred, dh_params);", " return anon_cred;", " int ret;", " return NULL;", " return NULL;", " return NULL;", " VNC_DEBUG(\"Cannot allocate credentials %s\\n\", gnutls_strerror(ret));", " return NULL;", " return NULL;", " return NULL;", " int ret;" ], "line_no": [ 7, 7, 7, 1, 5, 7, 11, 13, 15, 21, 25, 7, 15, 15, 15, 13, 15, 15, 15, 7 ] }
static gnutls_anon_server_credentials_t FUNC_0(void) { gnutls_anon_server_credentials_t anon_cred; int VAR_0; if ((VAR_0 = gnutls_anon_allocate_server_credentials(&anon_cred)) < 0) { VNC_DEBUG("Cannot allocate credentials %s\n", gnutls_strerror(VAR_0)); return NULL; } gnutls_anon_set_server_dh_params(anon_cred, dh_params); return anon_cred; }
[ "static gnutls_anon_server_credentials_t FUNC_0(void)\n{", "gnutls_anon_server_credentials_t anon_cred;", "int VAR_0;", "if ((VAR_0 = gnutls_anon_allocate_server_credentials(&anon_cred)) < 0) {", "VNC_DEBUG(\"Cannot allocate credentials %s\\n\", gnutls_strerror(VAR_0));", "return NULL;", "}", "gnutls_anon_set_server_dh_params(anon_cred, dh_params);", "return anon_cred;", "}" ]
[ 1, 1, 1, 1, 1, 1, 0, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 25 ], [ 27 ] ]
6,648
static void hypercall_init(void) { /* hcall-pft */ spapr_register_hypercall(H_ENTER, h_enter); spapr_register_hypercall(H_REMOVE, h_remove); spapr_register_hypercall(H_PROTECT, h_protect); /* qemu/KVM-PPC specific hcalls */ spapr_register_hypercall(KVMPPC_H_RTAS, h_rtas); }
true
qemu
821303f59b63ab832f0921f070db55e95bb21858
static void hypercall_init(void) { spapr_register_hypercall(H_ENTER, h_enter); spapr_register_hypercall(H_REMOVE, h_remove); spapr_register_hypercall(H_PROTECT, h_protect); spapr_register_hypercall(KVMPPC_H_RTAS, h_rtas); }
{ "code": [], "line_no": [] }
static void FUNC_0(void) { spapr_register_hypercall(H_ENTER, h_enter); spapr_register_hypercall(H_REMOVE, h_remove); spapr_register_hypercall(H_PROTECT, h_protect); spapr_register_hypercall(KVMPPC_H_RTAS, h_rtas); }
[ "static void FUNC_0(void)\n{", "spapr_register_hypercall(H_ENTER, h_enter);", "spapr_register_hypercall(H_REMOVE, h_remove);", "spapr_register_hypercall(H_PROTECT, h_protect);", "spapr_register_hypercall(KVMPPC_H_RTAS, h_rtas);", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2 ], [ 4 ], [ 5 ], [ 6 ], [ 8 ], [ 9 ] ]
6,649
static int mig_save_device_bulk(QEMUFile *f, BlkMigDevState *bmds) { int64_t total_sectors = bmds->total_sectors; int64_t cur_sector = bmds->cur_sector; BlockDriverState *bs = bmds->bs; BlkMigBlock *blk; int nr_sectors; if (bmds->shared_base) { qemu_mutex_lock_iothread(); while (cur_sector < total_sectors && !bdrv_is_allocated(bs, cur_sector, MAX_IS_ALLOCATED_SEARCH, &nr_sectors)) { cur_sector += nr_sectors; } qemu_mutex_unlock_iothread(); } if (cur_sector >= total_sectors) { bmds->cur_sector = bmds->completed_sectors = total_sectors; return 1; } bmds->completed_sectors = cur_sector; cur_sector &= ~((int64_t)BDRV_SECTORS_PER_DIRTY_CHUNK - 1); /* we are going to transfer a full block even if it is not allocated */ nr_sectors = BDRV_SECTORS_PER_DIRTY_CHUNK; if (total_sectors - cur_sector < BDRV_SECTORS_PER_DIRTY_CHUNK) { nr_sectors = total_sectors - cur_sector; } blk = g_malloc(sizeof(BlkMigBlock)); blk->buf = g_malloc(BLOCK_SIZE); blk->bmds = bmds; blk->sector = cur_sector; blk->nr_sectors = nr_sectors; blk->iov.iov_base = blk->buf; blk->iov.iov_len = nr_sectors * BDRV_SECTOR_SIZE; qemu_iovec_init_external(&blk->qiov, &blk->iov, 1); blk_mig_lock(); block_mig_state.submitted++; blk_mig_unlock(); qemu_mutex_lock_iothread(); blk->aiocb = bdrv_aio_readv(bs, cur_sector, &blk->qiov, nr_sectors, blk_mig_read_cb, blk); bdrv_reset_dirty(bs, cur_sector, nr_sectors); qemu_mutex_unlock_iothread(); bmds->cur_sector = cur_sector + nr_sectors; return (bmds->cur_sector >= total_sectors); }
true
qemu
5839e53bbc0fec56021d758aab7610df421ed8c8
static int mig_save_device_bulk(QEMUFile *f, BlkMigDevState *bmds) { int64_t total_sectors = bmds->total_sectors; int64_t cur_sector = bmds->cur_sector; BlockDriverState *bs = bmds->bs; BlkMigBlock *blk; int nr_sectors; if (bmds->shared_base) { qemu_mutex_lock_iothread(); while (cur_sector < total_sectors && !bdrv_is_allocated(bs, cur_sector, MAX_IS_ALLOCATED_SEARCH, &nr_sectors)) { cur_sector += nr_sectors; } qemu_mutex_unlock_iothread(); } if (cur_sector >= total_sectors) { bmds->cur_sector = bmds->completed_sectors = total_sectors; return 1; } bmds->completed_sectors = cur_sector; cur_sector &= ~((int64_t)BDRV_SECTORS_PER_DIRTY_CHUNK - 1); nr_sectors = BDRV_SECTORS_PER_DIRTY_CHUNK; if (total_sectors - cur_sector < BDRV_SECTORS_PER_DIRTY_CHUNK) { nr_sectors = total_sectors - cur_sector; } blk = g_malloc(sizeof(BlkMigBlock)); blk->buf = g_malloc(BLOCK_SIZE); blk->bmds = bmds; blk->sector = cur_sector; blk->nr_sectors = nr_sectors; blk->iov.iov_base = blk->buf; blk->iov.iov_len = nr_sectors * BDRV_SECTOR_SIZE; qemu_iovec_init_external(&blk->qiov, &blk->iov, 1); blk_mig_lock(); block_mig_state.submitted++; blk_mig_unlock(); qemu_mutex_lock_iothread(); blk->aiocb = bdrv_aio_readv(bs, cur_sector, &blk->qiov, nr_sectors, blk_mig_read_cb, blk); bdrv_reset_dirty(bs, cur_sector, nr_sectors); qemu_mutex_unlock_iothread(); bmds->cur_sector = cur_sector + nr_sectors; return (bmds->cur_sector >= total_sectors); }
{ "code": [ " blk = g_malloc(sizeof(BlkMigBlock));" ], "line_no": [ 69 ] }
static int FUNC_0(QEMUFile *VAR_0, BlkMigDevState *VAR_1) { int64_t total_sectors = VAR_1->total_sectors; int64_t cur_sector = VAR_1->cur_sector; BlockDriverState *bs = VAR_1->bs; BlkMigBlock *blk; int VAR_2; if (VAR_1->shared_base) { qemu_mutex_lock_iothread(); while (cur_sector < total_sectors && !bdrv_is_allocated(bs, cur_sector, MAX_IS_ALLOCATED_SEARCH, &VAR_2)) { cur_sector += VAR_2; } qemu_mutex_unlock_iothread(); } if (cur_sector >= total_sectors) { VAR_1->cur_sector = VAR_1->completed_sectors = total_sectors; return 1; } VAR_1->completed_sectors = cur_sector; cur_sector &= ~((int64_t)BDRV_SECTORS_PER_DIRTY_CHUNK - 1); VAR_2 = BDRV_SECTORS_PER_DIRTY_CHUNK; if (total_sectors - cur_sector < BDRV_SECTORS_PER_DIRTY_CHUNK) { VAR_2 = total_sectors - cur_sector; } blk = g_malloc(sizeof(BlkMigBlock)); blk->buf = g_malloc(BLOCK_SIZE); blk->VAR_1 = VAR_1; blk->sector = cur_sector; blk->VAR_2 = VAR_2; blk->iov.iov_base = blk->buf; blk->iov.iov_len = VAR_2 * BDRV_SECTOR_SIZE; qemu_iovec_init_external(&blk->qiov, &blk->iov, 1); blk_mig_lock(); block_mig_state.submitted++; blk_mig_unlock(); qemu_mutex_lock_iothread(); blk->aiocb = bdrv_aio_readv(bs, cur_sector, &blk->qiov, VAR_2, blk_mig_read_cb, blk); bdrv_reset_dirty(bs, cur_sector, VAR_2); qemu_mutex_unlock_iothread(); VAR_1->cur_sector = cur_sector + VAR_2; return (VAR_1->cur_sector >= total_sectors); }
[ "static int FUNC_0(QEMUFile *VAR_0, BlkMigDevState *VAR_1)\n{", "int64_t total_sectors = VAR_1->total_sectors;", "int64_t cur_sector = VAR_1->cur_sector;", "BlockDriverState *bs = VAR_1->bs;", "BlkMigBlock *blk;", "int VAR_2;", "if (VAR_1->shared_base) {", "qemu_mutex_lock_iothread();", "while (cur_sector < total_sectors &&\n!bdrv_is_allocated(bs, cur_sector, MAX_IS_ALLOCATED_SEARCH,\n&VAR_2)) {", "cur_sector += VAR_2;", "}", "qemu_mutex_unlock_iothread();", "}", "if (cur_sector >= total_sectors) {", "VAR_1->cur_sector = VAR_1->completed_sectors = total_sectors;", "return 1;", "}", "VAR_1->completed_sectors = cur_sector;", "cur_sector &= ~((int64_t)BDRV_SECTORS_PER_DIRTY_CHUNK - 1);", "VAR_2 = BDRV_SECTORS_PER_DIRTY_CHUNK;", "if (total_sectors - cur_sector < BDRV_SECTORS_PER_DIRTY_CHUNK) {", "VAR_2 = total_sectors - cur_sector;", "}", "blk = g_malloc(sizeof(BlkMigBlock));", "blk->buf = g_malloc(BLOCK_SIZE);", "blk->VAR_1 = VAR_1;", "blk->sector = cur_sector;", "blk->VAR_2 = VAR_2;", "blk->iov.iov_base = blk->buf;", "blk->iov.iov_len = VAR_2 * BDRV_SECTOR_SIZE;", "qemu_iovec_init_external(&blk->qiov, &blk->iov, 1);", "blk_mig_lock();", "block_mig_state.submitted++;", "blk_mig_unlock();", "qemu_mutex_lock_iothread();", "blk->aiocb = bdrv_aio_readv(bs, cur_sector, &blk->qiov,\nVAR_2, blk_mig_read_cb, blk);", "bdrv_reset_dirty(bs, cur_sector, VAR_2);", "qemu_mutex_unlock_iothread();", "VAR_1->cur_sector = cur_sector + VAR_2;", "return (VAR_1->cur_sector >= total_sectors);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21, 23, 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 51 ], [ 57 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 83 ], [ 85 ], [ 89 ], [ 91 ], [ 93 ], [ 97 ], [ 99, 101 ], [ 105 ], [ 107 ], [ 111 ], [ 113 ], [ 115 ] ]
6,651
static int make_setup_request(AVFormatContext *s, const char *host, int port, int lower_transport, const char *real_challenge) { RTSPState *rt = s->priv_data; int rtx, j, i, err, interleave = 0; RTSPStream *rtsp_st; RTSPMessageHeader reply1, *reply = &reply1; char cmd[2048]; const char *trans_pref; if (rt->transport == RTSP_TRANSPORT_RDT) trans_pref = "x-pn-tng"; else trans_pref = "RTP/AVP"; /* default timeout: 1 minute */ rt->timeout = 60; /* for each stream, make the setup request */ /* XXX: we assume the same server is used for the control of each * RTSP stream */ for (j = RTSP_RTP_PORT_MIN, i = 0; i < rt->nb_rtsp_streams; ++i) { char transport[2048]; /** * WMS serves all UDP data over a single connection, the RTX, which * isn't necessarily the first in the SDP but has to be the first * to be set up, else the second/third SETUP will fail with a 461. */ if (lower_transport == RTSP_LOWER_TRANSPORT_UDP && rt->server_type == RTSP_SERVER_WMS) { if (i == 0) { /* rtx first */ for (rtx = 0; rtx < rt->nb_rtsp_streams; rtx++) { int len = strlen(rt->rtsp_streams[rtx]->control_url); if (len >= 4 && !strcmp(rt->rtsp_streams[rtx]->control_url + len - 4, "/rtx")) break; } if (rtx == rt->nb_rtsp_streams) return -1; /* no RTX found */ rtsp_st = rt->rtsp_streams[rtx]; } else rtsp_st = rt->rtsp_streams[i > rtx ? i : i - 1]; } else rtsp_st = rt->rtsp_streams[i]; /* RTP/UDP */ if (lower_transport == RTSP_LOWER_TRANSPORT_UDP) { char buf[256]; if (rt->server_type == RTSP_SERVER_WMS && i > 1) { port = reply->transports[0].client_port_min; goto have_port; } /* first try in specified port range */ if (RTSP_RTP_PORT_MIN != 0) { while (j <= RTSP_RTP_PORT_MAX) { ff_url_join(buf, sizeof(buf), "rtp", NULL, host, -1, "?localport=%d", j); /* we will use two ports per rtp stream (rtp and rtcp) */ j += 2; if (url_open(&rtsp_st->rtp_handle, buf, URL_RDWR) == 0) goto rtp_opened; } } #if 0 /* then try on any port */ if (url_open(&rtsp_st->rtp_handle, "rtp://", URL_RDONLY) < 0) { err = AVERROR_INVALIDDATA; goto fail; } #endif rtp_opened: port = rtp_get_local_rtp_port(rtsp_st->rtp_handle); have_port: snprintf(transport, sizeof(transport) - 1, "%s/UDP;", trans_pref); if (rt->server_type != RTSP_SERVER_REAL) av_strlcat(transport, "unicast;", sizeof(transport)); av_strlcatf(transport, sizeof(transport), "client_port=%d", port); if (rt->transport == RTSP_TRANSPORT_RTP && !(rt->server_type == RTSP_SERVER_WMS && i > 0)) av_strlcatf(transport, sizeof(transport), "-%d", port + 1); } /* RTP/TCP */ else if (lower_transport == RTSP_LOWER_TRANSPORT_TCP) { /** For WMS streams, the application streams are only used for * UDP. When trying to set it up for TCP streams, the server * will return an error. Therefore, we skip those streams. */ if (rt->server_type == RTSP_SERVER_WMS && s->streams[rtsp_st->stream_index]->codec->codec_type == AVMEDIA_TYPE_DATA) continue; snprintf(transport, sizeof(transport) - 1, "%s/TCP;", trans_pref); if (rt->server_type == RTSP_SERVER_WMS) av_strlcat(transport, "unicast;", sizeof(transport)); av_strlcatf(transport, sizeof(transport), "interleaved=%d-%d", interleave, interleave + 1); interleave += 2; } else if (lower_transport == RTSP_LOWER_TRANSPORT_UDP_MULTICAST) { snprintf(transport, sizeof(transport) - 1, "%s/UDP;multicast", trans_pref); } if (s->oformat) { av_strlcat(transport, ";mode=receive", sizeof(transport)); } else if (rt->server_type == RTSP_SERVER_REAL || rt->server_type == RTSP_SERVER_WMS) av_strlcat(transport, ";mode=play", sizeof(transport)); snprintf(cmd, sizeof(cmd), "Transport: %s\r\n", transport); if (i == 0 && rt->server_type == RTSP_SERVER_REAL && CONFIG_RTPDEC) { char real_res[41], real_csum[9]; ff_rdt_calc_response_and_checksum(real_res, real_csum, real_challenge); av_strlcatf(cmd, sizeof(cmd), "If-Match: %s\r\n" "RealChallenge2: %s, sd=%s\r\n", rt->session_id, real_res, real_csum); } ff_rtsp_send_cmd(s, "SETUP", rtsp_st->control_url, cmd, reply, NULL); if (reply->status_code == 461 /* Unsupported protocol */ && i == 0) { err = 1; goto fail; } else if (reply->status_code != RTSP_STATUS_OK || reply->nb_transports != 1) { err = AVERROR_INVALIDDATA; goto fail; } /* XXX: same protocol for all streams is required */ if (i > 0) { if (reply->transports[0].lower_transport != rt->lower_transport || reply->transports[0].transport != rt->transport) { err = AVERROR_INVALIDDATA; goto fail; } } else { rt->lower_transport = reply->transports[0].lower_transport; rt->transport = reply->transports[0].transport; } /* close RTP connection if not chosen */ if (reply->transports[0].lower_transport != RTSP_LOWER_TRANSPORT_UDP && (lower_transport == RTSP_LOWER_TRANSPORT_UDP)) { url_close(rtsp_st->rtp_handle); rtsp_st->rtp_handle = NULL; } switch(reply->transports[0].lower_transport) { case RTSP_LOWER_TRANSPORT_TCP: rtsp_st->interleaved_min = reply->transports[0].interleaved_min; rtsp_st->interleaved_max = reply->transports[0].interleaved_max; break; case RTSP_LOWER_TRANSPORT_UDP: { char url[1024]; /* Use source address if specified */ if (reply->transports[0].source[0]) { ff_url_join(url, sizeof(url), "rtp", NULL, reply->transports[0].source, reply->transports[0].server_port_min, NULL); } else { ff_url_join(url, sizeof(url), "rtp", NULL, host, reply->transports[0].server_port_min, NULL); } if (!(rt->server_type == RTSP_SERVER_WMS && i > 1) && rtp_set_remote_url(rtsp_st->rtp_handle, url) < 0) { err = AVERROR_INVALIDDATA; goto fail; } /* Try to initialize the connection state in a * potential NAT router by sending dummy packets. * RTP/RTCP dummy packets are used for RDT, too. */ if (!(rt->server_type == RTSP_SERVER_WMS && i > 1) && s->iformat && CONFIG_RTPDEC) rtp_send_punch_packets(rtsp_st->rtp_handle); break; } case RTSP_LOWER_TRANSPORT_UDP_MULTICAST: { char url[1024], namebuf[50]; struct sockaddr_storage addr; int port, ttl; if (reply->transports[0].destination.ss_family) { addr = reply->transports[0].destination; port = reply->transports[0].port_min; ttl = reply->transports[0].ttl; } else { addr = rtsp_st->sdp_ip; port = rtsp_st->sdp_port; ttl = rtsp_st->sdp_ttl; } getnameinfo((struct sockaddr*) &addr, sizeof(addr), namebuf, sizeof(namebuf), NULL, 0, NI_NUMERICHOST); ff_url_join(url, sizeof(url), "rtp", NULL, namebuf, port, "?ttl=%d", ttl); if (url_open(&rtsp_st->rtp_handle, url, URL_RDWR) < 0) { err = AVERROR_INVALIDDATA; goto fail; } break; } } if ((err = rtsp_open_transport_ctx(s, rtsp_st))) goto fail; } if (reply->timeout > 0) rt->timeout = reply->timeout; if (rt->server_type == RTSP_SERVER_REAL) rt->need_subscription = 1; return 0; fail: for (i = 0; i < rt->nb_rtsp_streams; i++) { if (rt->rtsp_streams[i]->rtp_handle) { url_close(rt->rtsp_streams[i]->rtp_handle); rt->rtsp_streams[i]->rtp_handle = NULL; } } return err; }
true
FFmpeg
8c579c1c604306460436dcf1523117ca3b1aca82
static int make_setup_request(AVFormatContext *s, const char *host, int port, int lower_transport, const char *real_challenge) { RTSPState *rt = s->priv_data; int rtx, j, i, err, interleave = 0; RTSPStream *rtsp_st; RTSPMessageHeader reply1, *reply = &reply1; char cmd[2048]; const char *trans_pref; if (rt->transport == RTSP_TRANSPORT_RDT) trans_pref = "x-pn-tng"; else trans_pref = "RTP/AVP"; rt->timeout = 60; for (j = RTSP_RTP_PORT_MIN, i = 0; i < rt->nb_rtsp_streams; ++i) { char transport[2048]; if (lower_transport == RTSP_LOWER_TRANSPORT_UDP && rt->server_type == RTSP_SERVER_WMS) { if (i == 0) { for (rtx = 0; rtx < rt->nb_rtsp_streams; rtx++) { int len = strlen(rt->rtsp_streams[rtx]->control_url); if (len >= 4 && !strcmp(rt->rtsp_streams[rtx]->control_url + len - 4, "/rtx")) break; } if (rtx == rt->nb_rtsp_streams) return -1; rtsp_st = rt->rtsp_streams[rtx]; } else rtsp_st = rt->rtsp_streams[i > rtx ? i : i - 1]; } else rtsp_st = rt->rtsp_streams[i]; if (lower_transport == RTSP_LOWER_TRANSPORT_UDP) { char buf[256]; if (rt->server_type == RTSP_SERVER_WMS && i > 1) { port = reply->transports[0].client_port_min; goto have_port; } if (RTSP_RTP_PORT_MIN != 0) { while (j <= RTSP_RTP_PORT_MAX) { ff_url_join(buf, sizeof(buf), "rtp", NULL, host, -1, "?localport=%d", j); j += 2; if (url_open(&rtsp_st->rtp_handle, buf, URL_RDWR) == 0) goto rtp_opened; } } #if 0 if (url_open(&rtsp_st->rtp_handle, "rtp: err = AVERROR_INVALIDDATA; goto fail; } #endif rtp_opened: port = rtp_get_local_rtp_port(rtsp_st->rtp_handle); have_port: snprintf(transport, sizeof(transport) - 1, "%s/UDP;", trans_pref); if (rt->server_type != RTSP_SERVER_REAL) av_strlcat(transport, "unicast;", sizeof(transport)); av_strlcatf(transport, sizeof(transport), "client_port=%d", port); if (rt->transport == RTSP_TRANSPORT_RTP && !(rt->server_type == RTSP_SERVER_WMS && i > 0)) av_strlcatf(transport, sizeof(transport), "-%d", port + 1); } else if (lower_transport == RTSP_LOWER_TRANSPORT_TCP) { if (rt->server_type == RTSP_SERVER_WMS && s->streams[rtsp_st->stream_index]->codec->codec_type == AVMEDIA_TYPE_DATA) continue; snprintf(transport, sizeof(transport) - 1, "%s/TCP;", trans_pref); if (rt->server_type == RTSP_SERVER_WMS) av_strlcat(transport, "unicast;", sizeof(transport)); av_strlcatf(transport, sizeof(transport), "interleaved=%d-%d", interleave, interleave + 1); interleave += 2; } else if (lower_transport == RTSP_LOWER_TRANSPORT_UDP_MULTICAST) { snprintf(transport, sizeof(transport) - 1, "%s/UDP;multicast", trans_pref); } if (s->oformat) { av_strlcat(transport, ";mode=receive", sizeof(transport)); } else if (rt->server_type == RTSP_SERVER_REAL || rt->server_type == RTSP_SERVER_WMS) av_strlcat(transport, ";mode=play", sizeof(transport)); snprintf(cmd, sizeof(cmd), "Transport: %s\r\n", transport); if (i == 0 && rt->server_type == RTSP_SERVER_REAL && CONFIG_RTPDEC) { char real_res[41], real_csum[9]; ff_rdt_calc_response_and_checksum(real_res, real_csum, real_challenge); av_strlcatf(cmd, sizeof(cmd), "If-Match: %s\r\n" "RealChallenge2: %s, sd=%s\r\n", rt->session_id, real_res, real_csum); } ff_rtsp_send_cmd(s, "SETUP", rtsp_st->control_url, cmd, reply, NULL); if (reply->status_code == 461 && i == 0) { err = 1; goto fail; } else if (reply->status_code != RTSP_STATUS_OK || reply->nb_transports != 1) { err = AVERROR_INVALIDDATA; goto fail; } if (i > 0) { if (reply->transports[0].lower_transport != rt->lower_transport || reply->transports[0].transport != rt->transport) { err = AVERROR_INVALIDDATA; goto fail; } } else { rt->lower_transport = reply->transports[0].lower_transport; rt->transport = reply->transports[0].transport; } if (reply->transports[0].lower_transport != RTSP_LOWER_TRANSPORT_UDP && (lower_transport == RTSP_LOWER_TRANSPORT_UDP)) { url_close(rtsp_st->rtp_handle); rtsp_st->rtp_handle = NULL; } switch(reply->transports[0].lower_transport) { case RTSP_LOWER_TRANSPORT_TCP: rtsp_st->interleaved_min = reply->transports[0].interleaved_min; rtsp_st->interleaved_max = reply->transports[0].interleaved_max; break; case RTSP_LOWER_TRANSPORT_UDP: { char url[1024]; if (reply->transports[0].source[0]) { ff_url_join(url, sizeof(url), "rtp", NULL, reply->transports[0].source, reply->transports[0].server_port_min, NULL); } else { ff_url_join(url, sizeof(url), "rtp", NULL, host, reply->transports[0].server_port_min, NULL); } if (!(rt->server_type == RTSP_SERVER_WMS && i > 1) && rtp_set_remote_url(rtsp_st->rtp_handle, url) < 0) { err = AVERROR_INVALIDDATA; goto fail; } if (!(rt->server_type == RTSP_SERVER_WMS && i > 1) && s->iformat && CONFIG_RTPDEC) rtp_send_punch_packets(rtsp_st->rtp_handle); break; } case RTSP_LOWER_TRANSPORT_UDP_MULTICAST: { char url[1024], namebuf[50]; struct sockaddr_storage addr; int port, ttl; if (reply->transports[0].destination.ss_family) { addr = reply->transports[0].destination; port = reply->transports[0].port_min; ttl = reply->transports[0].ttl; } else { addr = rtsp_st->sdp_ip; port = rtsp_st->sdp_port; ttl = rtsp_st->sdp_ttl; } getnameinfo((struct sockaddr*) &addr, sizeof(addr), namebuf, sizeof(namebuf), NULL, 0, NI_NUMERICHOST); ff_url_join(url, sizeof(url), "rtp", NULL, namebuf, port, "?ttl=%d", ttl); if (url_open(&rtsp_st->rtp_handle, url, URL_RDWR) < 0) { err = AVERROR_INVALIDDATA; goto fail; } break; } } if ((err = rtsp_open_transport_ctx(s, rtsp_st))) goto fail; } if (reply->timeout > 0) rt->timeout = reply->timeout; if (rt->server_type == RTSP_SERVER_REAL) rt->need_subscription = 1; return 0; fail: for (i = 0; i < rt->nb_rtsp_streams; i++) { if (rt->rtsp_streams[i]->rtp_handle) { url_close(rt->rtsp_streams[i]->rtp_handle); rt->rtsp_streams[i]->rtp_handle = NULL; } } return err; }
{ "code": [ " if (reply->transports[0].lower_transport != RTSP_LOWER_TRANSPORT_UDP &&", " (lower_transport == RTSP_LOWER_TRANSPORT_UDP)) {", " url_close(rtsp_st->rtp_handle);", " rtsp_st->rtp_handle = NULL;" ], "line_no": [ 311, 313, 315, 317 ] }
static int FUNC_0(AVFormatContext *VAR_0, const char *VAR_1, int VAR_2, int VAR_3, const char *VAR_4) { RTSPState *rt = VAR_0->priv_data; int VAR_5, VAR_6, VAR_7, VAR_8, VAR_9 = 0; RTSPStream *rtsp_st; RTSPMessageHeader reply1, *reply = &reply1; char VAR_10[2048]; const char *VAR_11; if (rt->transport == RTSP_TRANSPORT_RDT) VAR_11 = "x-pn-tng"; else VAR_11 = "RTP/AVP"; rt->timeout = 60; for (VAR_6 = RTSP_RTP_PORT_MIN, VAR_7 = 0; VAR_7 < rt->nb_rtsp_streams; ++VAR_7) { char transport[2048]; if (VAR_3 == RTSP_LOWER_TRANSPORT_UDP && rt->server_type == RTSP_SERVER_WMS) { if (VAR_7 == 0) { for (VAR_5 = 0; VAR_5 < rt->nb_rtsp_streams; VAR_5++) { int len = strlen(rt->rtsp_streams[VAR_5]->control_url); if (len >= 4 && !strcmp(rt->rtsp_streams[VAR_5]->control_url + len - 4, "/VAR_5")) break; } if (VAR_5 == rt->nb_rtsp_streams) return -1; rtsp_st = rt->rtsp_streams[VAR_5]; } else rtsp_st = rt->rtsp_streams[VAR_7 > VAR_5 ? VAR_7 : VAR_7 - 1]; } else rtsp_st = rt->rtsp_streams[VAR_7]; if (VAR_3 == RTSP_LOWER_TRANSPORT_UDP) { char buf[256]; if (rt->server_type == RTSP_SERVER_WMS && VAR_7 > 1) { VAR_2 = reply->transports[0].client_port_min; goto have_port; } if (RTSP_RTP_PORT_MIN != 0) { while (VAR_6 <= RTSP_RTP_PORT_MAX) { ff_url_join(buf, sizeof(buf), "rtp", NULL, VAR_1, -1, "?localport=%d", VAR_6); VAR_6 += 2; if (url_open(&rtsp_st->rtp_handle, buf, URL_RDWR) == 0) goto rtp_opened; } } #if 0 if (url_open(&rtsp_st->rtp_handle, "rtp: VAR_8 = AVERROR_INVALIDDATA; goto fail; } #endif rtp_opened: VAR_2 = rtp_get_local_rtp_port(rtsp_st->rtp_handle); have_port: snprintf(transport, sizeof(transport) - 1, "%VAR_0/UDP;", VAR_11); if (rt->server_type != RTSP_SERVER_REAL) av_strlcat(transport, "unicast;", sizeof(transport)); av_strlcatf(transport, sizeof(transport), "client_port=%d", VAR_2); if (rt->transport == RTSP_TRANSPORT_RTP && !(rt->server_type == RTSP_SERVER_WMS && VAR_7 > 0)) av_strlcatf(transport, sizeof(transport), "-%d", VAR_2 + 1); } else if (VAR_3 == RTSP_LOWER_TRANSPORT_TCP) { if (rt->server_type == RTSP_SERVER_WMS && VAR_0->streams[rtsp_st->stream_index]->codec->codec_type == AVMEDIA_TYPE_DATA) continue; snprintf(transport, sizeof(transport) - 1, "%VAR_0/TCP;", VAR_11); if (rt->server_type == RTSP_SERVER_WMS) av_strlcat(transport, "unicast;", sizeof(transport)); av_strlcatf(transport, sizeof(transport), "interleaved=%d-%d", VAR_9, VAR_9 + 1); VAR_9 += 2; } else if (VAR_3 == RTSP_LOWER_TRANSPORT_UDP_MULTICAST) { snprintf(transport, sizeof(transport) - 1, "%VAR_0/UDP;multicast", VAR_11); } if (VAR_0->oformat) { av_strlcat(transport, ";mode=receive", sizeof(transport)); } else if (rt->server_type == RTSP_SERVER_REAL || rt->server_type == RTSP_SERVER_WMS) av_strlcat(transport, ";mode=play", sizeof(transport)); snprintf(VAR_10, sizeof(VAR_10), "Transport: %VAR_0\r\n", transport); if (VAR_7 == 0 && rt->server_type == RTSP_SERVER_REAL && CONFIG_RTPDEC) { char real_res[41], real_csum[9]; ff_rdt_calc_response_and_checksum(real_res, real_csum, VAR_4); av_strlcatf(VAR_10, sizeof(VAR_10), "If-Match: %VAR_0\r\n" "RealChallenge2: %VAR_0, sd=%VAR_0\r\n", rt->session_id, real_res, real_csum); } ff_rtsp_send_cmd(VAR_0, "SETUP", rtsp_st->control_url, VAR_10, reply, NULL); if (reply->status_code == 461 && VAR_7 == 0) { VAR_8 = 1; goto fail; } else if (reply->status_code != RTSP_STATUS_OK || reply->nb_transports != 1) { VAR_8 = AVERROR_INVALIDDATA; goto fail; } if (VAR_7 > 0) { if (reply->transports[0].VAR_3 != rt->VAR_3 || reply->transports[0].transport != rt->transport) { VAR_8 = AVERROR_INVALIDDATA; goto fail; } } else { rt->VAR_3 = reply->transports[0].VAR_3; rt->transport = reply->transports[0].transport; } if (reply->transports[0].VAR_3 != RTSP_LOWER_TRANSPORT_UDP && (VAR_3 == RTSP_LOWER_TRANSPORT_UDP)) { url_close(rtsp_st->rtp_handle); rtsp_st->rtp_handle = NULL; } switch(reply->transports[0].VAR_3) { case RTSP_LOWER_TRANSPORT_TCP: rtsp_st->interleaved_min = reply->transports[0].interleaved_min; rtsp_st->interleaved_max = reply->transports[0].interleaved_max; break; case RTSP_LOWER_TRANSPORT_UDP: { char url[1024]; if (reply->transports[0].source[0]) { ff_url_join(url, sizeof(url), "rtp", NULL, reply->transports[0].source, reply->transports[0].server_port_min, NULL); } else { ff_url_join(url, sizeof(url), "rtp", NULL, VAR_1, reply->transports[0].server_port_min, NULL); } if (!(rt->server_type == RTSP_SERVER_WMS && VAR_7 > 1) && rtp_set_remote_url(rtsp_st->rtp_handle, url) < 0) { VAR_8 = AVERROR_INVALIDDATA; goto fail; } if (!(rt->server_type == RTSP_SERVER_WMS && VAR_7 > 1) && VAR_0->iformat && CONFIG_RTPDEC) rtp_send_punch_packets(rtsp_st->rtp_handle); break; } case RTSP_LOWER_TRANSPORT_UDP_MULTICAST: { char url[1024], namebuf[50]; struct sockaddr_storage addr; int VAR_2, ttl; if (reply->transports[0].destination.ss_family) { addr = reply->transports[0].destination; VAR_2 = reply->transports[0].port_min; ttl = reply->transports[0].ttl; } else { addr = rtsp_st->sdp_ip; VAR_2 = rtsp_st->sdp_port; ttl = rtsp_st->sdp_ttl; } getnameinfo((struct sockaddr*) &addr, sizeof(addr), namebuf, sizeof(namebuf), NULL, 0, NI_NUMERICHOST); ff_url_join(url, sizeof(url), "rtp", NULL, namebuf, VAR_2, "?ttl=%d", ttl); if (url_open(&rtsp_st->rtp_handle, url, URL_RDWR) < 0) { VAR_8 = AVERROR_INVALIDDATA; goto fail; } break; } } if ((VAR_8 = rtsp_open_transport_ctx(VAR_0, rtsp_st))) goto fail; } if (reply->timeout > 0) rt->timeout = reply->timeout; if (rt->server_type == RTSP_SERVER_REAL) rt->need_subscription = 1; return 0; fail: for (VAR_7 = 0; VAR_7 < rt->nb_rtsp_streams; VAR_7++) { if (rt->rtsp_streams[VAR_7]->rtp_handle) { url_close(rt->rtsp_streams[VAR_7]->rtp_handle); rt->rtsp_streams[VAR_7]->rtp_handle = NULL; } } return VAR_8; }
[ "static int FUNC_0(AVFormatContext *VAR_0, const char *VAR_1, int VAR_2,\nint VAR_3, const char *VAR_4)\n{", "RTSPState *rt = VAR_0->priv_data;", "int VAR_5, VAR_6, VAR_7, VAR_8, VAR_9 = 0;", "RTSPStream *rtsp_st;", "RTSPMessageHeader reply1, *reply = &reply1;", "char VAR_10[2048];", "const char *VAR_11;", "if (rt->transport == RTSP_TRANSPORT_RDT)\nVAR_11 = \"x-pn-tng\";", "else\nVAR_11 = \"RTP/AVP\";", "rt->timeout = 60;", "for (VAR_6 = RTSP_RTP_PORT_MIN, VAR_7 = 0; VAR_7 < rt->nb_rtsp_streams; ++VAR_7) {", "char transport[2048];", "if (VAR_3 == RTSP_LOWER_TRANSPORT_UDP &&\nrt->server_type == RTSP_SERVER_WMS) {", "if (VAR_7 == 0) {", "for (VAR_5 = 0; VAR_5 < rt->nb_rtsp_streams; VAR_5++) {", "int len = strlen(rt->rtsp_streams[VAR_5]->control_url);", "if (len >= 4 &&\n!strcmp(rt->rtsp_streams[VAR_5]->control_url + len - 4,\n\"/VAR_5\"))\nbreak;", "}", "if (VAR_5 == rt->nb_rtsp_streams)\nreturn -1;", "rtsp_st = rt->rtsp_streams[VAR_5];", "} else", "rtsp_st = rt->rtsp_streams[VAR_7 > VAR_5 ? VAR_7 : VAR_7 - 1];", "} else", "rtsp_st = rt->rtsp_streams[VAR_7];", "if (VAR_3 == RTSP_LOWER_TRANSPORT_UDP) {", "char buf[256];", "if (rt->server_type == RTSP_SERVER_WMS && VAR_7 > 1) {", "VAR_2 = reply->transports[0].client_port_min;", "goto have_port;", "}", "if (RTSP_RTP_PORT_MIN != 0) {", "while (VAR_6 <= RTSP_RTP_PORT_MAX) {", "ff_url_join(buf, sizeof(buf), \"rtp\", NULL, VAR_1, -1,\n\"?localport=%d\", VAR_6);", "VAR_6 += 2;", "if (url_open(&rtsp_st->rtp_handle, buf, URL_RDWR) == 0)\ngoto rtp_opened;", "}", "}", "#if 0\nif (url_open(&rtsp_st->rtp_handle, \"rtp:\nVAR_8 = AVERROR_INVALIDDATA;", "goto fail;", "}", "#endif\nrtp_opened:\nVAR_2 = rtp_get_local_rtp_port(rtsp_st->rtp_handle);", "have_port:\nsnprintf(transport, sizeof(transport) - 1,\n\"%VAR_0/UDP;\", VAR_11);", "if (rt->server_type != RTSP_SERVER_REAL)\nav_strlcat(transport, \"unicast;\", sizeof(transport));", "av_strlcatf(transport, sizeof(transport),\n\"client_port=%d\", VAR_2);", "if (rt->transport == RTSP_TRANSPORT_RTP &&\n!(rt->server_type == RTSP_SERVER_WMS && VAR_7 > 0))\nav_strlcatf(transport, sizeof(transport), \"-%d\", VAR_2 + 1);", "}", "else if (VAR_3 == RTSP_LOWER_TRANSPORT_TCP) {", "if (rt->server_type == RTSP_SERVER_WMS &&\nVAR_0->streams[rtsp_st->stream_index]->codec->codec_type ==\nAVMEDIA_TYPE_DATA)\ncontinue;", "snprintf(transport, sizeof(transport) - 1,\n\"%VAR_0/TCP;\", VAR_11);", "if (rt->server_type == RTSP_SERVER_WMS)\nav_strlcat(transport, \"unicast;\", sizeof(transport));", "av_strlcatf(transport, sizeof(transport),\n\"interleaved=%d-%d\",\nVAR_9, VAR_9 + 1);", "VAR_9 += 2;", "}", "else if (VAR_3 == RTSP_LOWER_TRANSPORT_UDP_MULTICAST) {", "snprintf(transport, sizeof(transport) - 1,\n\"%VAR_0/UDP;multicast\", VAR_11);", "}", "if (VAR_0->oformat) {", "av_strlcat(transport, \";mode=receive\", sizeof(transport));", "} else if (rt->server_type == RTSP_SERVER_REAL ||", "rt->server_type == RTSP_SERVER_WMS)\nav_strlcat(transport, \";mode=play\", sizeof(transport));", "snprintf(VAR_10, sizeof(VAR_10),\n\"Transport: %VAR_0\\r\\n\",\ntransport);", "if (VAR_7 == 0 && rt->server_type == RTSP_SERVER_REAL && CONFIG_RTPDEC) {", "char real_res[41], real_csum[9];", "ff_rdt_calc_response_and_checksum(real_res, real_csum,\nVAR_4);", "av_strlcatf(VAR_10, sizeof(VAR_10),\n\"If-Match: %VAR_0\\r\\n\"\n\"RealChallenge2: %VAR_0, sd=%VAR_0\\r\\n\",\nrt->session_id, real_res, real_csum);", "}", "ff_rtsp_send_cmd(VAR_0, \"SETUP\", rtsp_st->control_url, VAR_10, reply, NULL);", "if (reply->status_code == 461 && VAR_7 == 0) {", "VAR_8 = 1;", "goto fail;", "} else if (reply->status_code != RTSP_STATUS_OK ||", "reply->nb_transports != 1) {", "VAR_8 = AVERROR_INVALIDDATA;", "goto fail;", "}", "if (VAR_7 > 0) {", "if (reply->transports[0].VAR_3 != rt->VAR_3 ||\nreply->transports[0].transport != rt->transport) {", "VAR_8 = AVERROR_INVALIDDATA;", "goto fail;", "}", "} else {", "rt->VAR_3 = reply->transports[0].VAR_3;", "rt->transport = reply->transports[0].transport;", "}", "if (reply->transports[0].VAR_3 != RTSP_LOWER_TRANSPORT_UDP &&\n(VAR_3 == RTSP_LOWER_TRANSPORT_UDP)) {", "url_close(rtsp_st->rtp_handle);", "rtsp_st->rtp_handle = NULL;", "}", "switch(reply->transports[0].VAR_3) {", "case RTSP_LOWER_TRANSPORT_TCP:\nrtsp_st->interleaved_min = reply->transports[0].interleaved_min;", "rtsp_st->interleaved_max = reply->transports[0].interleaved_max;", "break;", "case RTSP_LOWER_TRANSPORT_UDP: {", "char url[1024];", "if (reply->transports[0].source[0]) {", "ff_url_join(url, sizeof(url), \"rtp\", NULL,\nreply->transports[0].source,\nreply->transports[0].server_port_min, NULL);", "} else {", "ff_url_join(url, sizeof(url), \"rtp\", NULL, VAR_1,\nreply->transports[0].server_port_min, NULL);", "}", "if (!(rt->server_type == RTSP_SERVER_WMS && VAR_7 > 1) &&\nrtp_set_remote_url(rtsp_st->rtp_handle, url) < 0) {", "VAR_8 = AVERROR_INVALIDDATA;", "goto fail;", "}", "if (!(rt->server_type == RTSP_SERVER_WMS && VAR_7 > 1) && VAR_0->iformat &&\nCONFIG_RTPDEC)\nrtp_send_punch_packets(rtsp_st->rtp_handle);", "break;", "}", "case RTSP_LOWER_TRANSPORT_UDP_MULTICAST: {", "char url[1024], namebuf[50];", "struct sockaddr_storage addr;", "int VAR_2, ttl;", "if (reply->transports[0].destination.ss_family) {", "addr = reply->transports[0].destination;", "VAR_2 = reply->transports[0].port_min;", "ttl = reply->transports[0].ttl;", "} else {", "addr = rtsp_st->sdp_ip;", "VAR_2 = rtsp_st->sdp_port;", "ttl = rtsp_st->sdp_ttl;", "}", "getnameinfo((struct sockaddr*) &addr, sizeof(addr),\nnamebuf, sizeof(namebuf), NULL, 0, NI_NUMERICHOST);", "ff_url_join(url, sizeof(url), \"rtp\", NULL, namebuf,\nVAR_2, \"?ttl=%d\", ttl);", "if (url_open(&rtsp_st->rtp_handle, url, URL_RDWR) < 0) {", "VAR_8 = AVERROR_INVALIDDATA;", "goto fail;", "}", "break;", "}", "}", "if ((VAR_8 = rtsp_open_transport_ctx(VAR_0, rtsp_st)))\ngoto fail;", "}", "if (reply->timeout > 0)\nrt->timeout = reply->timeout;", "if (rt->server_type == RTSP_SERVER_REAL)\nrt->need_subscription = 1;", "return 0;", "fail:\nfor (VAR_7 = 0; VAR_7 < rt->nb_rtsp_streams; VAR_7++) {", "if (rt->rtsp_streams[VAR_7]->rtp_handle) {", "url_close(rt->rtsp_streams[VAR_7]->rtp_handle);", "rt->rtsp_streams[VAR_7]->rtp_handle = NULL;", "}", "}", "return VAR_8;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 33 ], [ 45 ], [ 47 ], [ 61, 63 ], [ 65 ], [ 69 ], [ 71 ], [ 73, 75, 77, 79 ], [ 81 ], [ 83, 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 101 ], [ 103 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 119 ], [ 121 ], [ 123, 125 ], [ 129 ], [ 131, 133 ], [ 135 ], [ 137 ], [ 141, 145, 147 ], [ 149 ], [ 151 ], [ 153, 157, 159 ], [ 161, 163, 165 ], [ 167, 169 ], [ 171, 173 ], [ 175, 177, 179 ], [ 181 ], [ 187 ], [ 195, 197, 199, 201 ], [ 203, 205 ], [ 207, 209 ], [ 211, 213, 215 ], [ 217 ], [ 219 ], [ 223 ], [ 225, 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237, 239 ], [ 241, 243, 245 ], [ 247 ], [ 249 ], [ 251, 253 ], [ 255, 257, 259, 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277 ], [ 279 ], [ 281 ], [ 287 ], [ 289, 291 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305 ], [ 311, 313 ], [ 315 ], [ 317 ], [ 319 ], [ 323 ], [ 325, 327 ], [ 329 ], [ 331 ], [ 335 ], [ 337 ], [ 343 ], [ 345, 347, 349 ], [ 351 ], [ 353, 355 ], [ 357 ], [ 359, 361 ], [ 363 ], [ 365 ], [ 367 ], [ 377, 379, 381 ], [ 383 ], [ 385 ], [ 387 ], [ 389 ], [ 391 ], [ 393 ], [ 397 ], [ 399 ], [ 401 ], [ 403 ], [ 405 ], [ 407 ], [ 409 ], [ 411 ], [ 413 ], [ 415, 417 ], [ 419, 421 ], [ 423 ], [ 425 ], [ 427 ], [ 429 ], [ 431 ], [ 433 ], [ 435 ], [ 439, 441 ], [ 443 ], [ 447, 449 ], [ 453, 455 ], [ 459 ], [ 463, 465 ], [ 467 ], [ 469 ], [ 471 ], [ 473 ], [ 475 ], [ 477 ], [ 479 ] ]
6,652
void gic_update(GICState *s) { int best_irq; int best_prio; int irq; int irq_level, fiq_level; int cpu; int cm; for (cpu = 0; cpu < s->num_cpu; cpu++) { cm = 1 << cpu; s->current_pending[cpu] = 1023; if (!(s->ctlr & (GICD_CTLR_EN_GRP0 | GICD_CTLR_EN_GRP1)) || !(s->cpu_ctlr[cpu] & (GICC_CTLR_EN_GRP0 | GICC_CTLR_EN_GRP1))) { qemu_irq_lower(s->parent_irq[cpu]); qemu_irq_lower(s->parent_fiq[cpu]); continue; } best_prio = 0x100; best_irq = 1023; for (irq = 0; irq < s->num_irq; irq++) { if (GIC_TEST_ENABLED(irq, cm) && gic_test_pending(s, irq, cm) && (irq < GIC_INTERNAL || GIC_TARGET(irq) & cm)) { if (GIC_GET_PRIORITY(irq, cpu) < best_prio) { best_prio = GIC_GET_PRIORITY(irq, cpu); best_irq = irq; } } } if (best_irq != 1023) { trace_gic_update_bestirq(cpu, best_irq, best_prio, s->priority_mask[cpu], s->running_priority[cpu]); } irq_level = fiq_level = 0; if (best_prio < s->priority_mask[cpu]) { s->current_pending[cpu] = best_irq; if (best_prio < s->running_priority[cpu]) { int group = GIC_TEST_GROUP(best_irq, cm); if (extract32(s->ctlr, group, 1) && extract32(s->cpu_ctlr[cpu], group, 1)) { if (group == 0 && s->cpu_ctlr[cpu] & GICC_CTLR_FIQ_EN) { DPRINTF("Raised pending FIQ %d (cpu %d)\n", best_irq, cpu); fiq_level = 1; } else { DPRINTF("Raised pending IRQ %d (cpu %d)\n", best_irq, cpu); irq_level = 1; } } } } qemu_set_irq(s->parent_irq[cpu], irq_level); qemu_set_irq(s->parent_fiq[cpu], fiq_level); } }
true
qemu
2531088f6c1ce1f620f8d5a545f0af95598e69fc
void gic_update(GICState *s) { int best_irq; int best_prio; int irq; int irq_level, fiq_level; int cpu; int cm; for (cpu = 0; cpu < s->num_cpu; cpu++) { cm = 1 << cpu; s->current_pending[cpu] = 1023; if (!(s->ctlr & (GICD_CTLR_EN_GRP0 | GICD_CTLR_EN_GRP1)) || !(s->cpu_ctlr[cpu] & (GICC_CTLR_EN_GRP0 | GICC_CTLR_EN_GRP1))) { qemu_irq_lower(s->parent_irq[cpu]); qemu_irq_lower(s->parent_fiq[cpu]); continue; } best_prio = 0x100; best_irq = 1023; for (irq = 0; irq < s->num_irq; irq++) { if (GIC_TEST_ENABLED(irq, cm) && gic_test_pending(s, irq, cm) && (irq < GIC_INTERNAL || GIC_TARGET(irq) & cm)) { if (GIC_GET_PRIORITY(irq, cpu) < best_prio) { best_prio = GIC_GET_PRIORITY(irq, cpu); best_irq = irq; } } } if (best_irq != 1023) { trace_gic_update_bestirq(cpu, best_irq, best_prio, s->priority_mask[cpu], s->running_priority[cpu]); } irq_level = fiq_level = 0; if (best_prio < s->priority_mask[cpu]) { s->current_pending[cpu] = best_irq; if (best_prio < s->running_priority[cpu]) { int group = GIC_TEST_GROUP(best_irq, cm); if (extract32(s->ctlr, group, 1) && extract32(s->cpu_ctlr[cpu], group, 1)) { if (group == 0 && s->cpu_ctlr[cpu] & GICC_CTLR_FIQ_EN) { DPRINTF("Raised pending FIQ %d (cpu %d)\n", best_irq, cpu); fiq_level = 1; } else { DPRINTF("Raised pending IRQ %d (cpu %d)\n", best_irq, cpu); irq_level = 1; } } } } qemu_set_irq(s->parent_irq[cpu], irq_level); qemu_set_irq(s->parent_fiq[cpu], fiq_level); } }
{ "code": [], "line_no": [] }
void FUNC_0(GICState *VAR_0) { int VAR_1; int VAR_2; int VAR_3; int VAR_4, VAR_5; int VAR_6; int VAR_7; for (VAR_6 = 0; VAR_6 < VAR_0->num_cpu; VAR_6++) { VAR_7 = 1 << VAR_6; VAR_0->current_pending[VAR_6] = 1023; if (!(VAR_0->ctlr & (GICD_CTLR_EN_GRP0 | GICD_CTLR_EN_GRP1)) || !(VAR_0->cpu_ctlr[VAR_6] & (GICC_CTLR_EN_GRP0 | GICC_CTLR_EN_GRP1))) { qemu_irq_lower(VAR_0->parent_irq[VAR_6]); qemu_irq_lower(VAR_0->parent_fiq[VAR_6]); continue; } VAR_2 = 0x100; VAR_1 = 1023; for (VAR_3 = 0; VAR_3 < VAR_0->num_irq; VAR_3++) { if (GIC_TEST_ENABLED(VAR_3, VAR_7) && gic_test_pending(VAR_0, VAR_3, VAR_7) && (VAR_3 < GIC_INTERNAL || GIC_TARGET(VAR_3) & VAR_7)) { if (GIC_GET_PRIORITY(VAR_3, VAR_6) < VAR_2) { VAR_2 = GIC_GET_PRIORITY(VAR_3, VAR_6); VAR_1 = VAR_3; } } } if (VAR_1 != 1023) { trace_gic_update_bestirq(VAR_6, VAR_1, VAR_2, VAR_0->priority_mask[VAR_6], VAR_0->running_priority[VAR_6]); } VAR_4 = VAR_5 = 0; if (VAR_2 < VAR_0->priority_mask[VAR_6]) { VAR_0->current_pending[VAR_6] = VAR_1; if (VAR_2 < VAR_0->running_priority[VAR_6]) { int group = GIC_TEST_GROUP(VAR_1, VAR_7); if (extract32(VAR_0->ctlr, group, 1) && extract32(VAR_0->cpu_ctlr[VAR_6], group, 1)) { if (group == 0 && VAR_0->cpu_ctlr[VAR_6] & GICC_CTLR_FIQ_EN) { DPRINTF("Raised pending FIQ %d (VAR_6 %d)\n", VAR_1, VAR_6); VAR_5 = 1; } else { DPRINTF("Raised pending IRQ %d (VAR_6 %d)\n", VAR_1, VAR_6); VAR_4 = 1; } } } } qemu_set_irq(VAR_0->parent_irq[VAR_6], VAR_4); qemu_set_irq(VAR_0->parent_fiq[VAR_6], VAR_5); } }
[ "void FUNC_0(GICState *VAR_0)\n{", "int VAR_1;", "int VAR_2;", "int VAR_3;", "int VAR_4, VAR_5;", "int VAR_6;", "int VAR_7;", "for (VAR_6 = 0; VAR_6 < VAR_0->num_cpu; VAR_6++) {", "VAR_7 = 1 << VAR_6;", "VAR_0->current_pending[VAR_6] = 1023;", "if (!(VAR_0->ctlr & (GICD_CTLR_EN_GRP0 | GICD_CTLR_EN_GRP1))\n|| !(VAR_0->cpu_ctlr[VAR_6] & (GICC_CTLR_EN_GRP0 | GICC_CTLR_EN_GRP1))) {", "qemu_irq_lower(VAR_0->parent_irq[VAR_6]);", "qemu_irq_lower(VAR_0->parent_fiq[VAR_6]);", "continue;", "}", "VAR_2 = 0x100;", "VAR_1 = 1023;", "for (VAR_3 = 0; VAR_3 < VAR_0->num_irq; VAR_3++) {", "if (GIC_TEST_ENABLED(VAR_3, VAR_7) && gic_test_pending(VAR_0, VAR_3, VAR_7) &&\n(VAR_3 < GIC_INTERNAL || GIC_TARGET(VAR_3) & VAR_7)) {", "if (GIC_GET_PRIORITY(VAR_3, VAR_6) < VAR_2) {", "VAR_2 = GIC_GET_PRIORITY(VAR_3, VAR_6);", "VAR_1 = VAR_3;", "}", "}", "}", "if (VAR_1 != 1023) {", "trace_gic_update_bestirq(VAR_6, VAR_1, VAR_2,\nVAR_0->priority_mask[VAR_6], VAR_0->running_priority[VAR_6]);", "}", "VAR_4 = VAR_5 = 0;", "if (VAR_2 < VAR_0->priority_mask[VAR_6]) {", "VAR_0->current_pending[VAR_6] = VAR_1;", "if (VAR_2 < VAR_0->running_priority[VAR_6]) {", "int group = GIC_TEST_GROUP(VAR_1, VAR_7);", "if (extract32(VAR_0->ctlr, group, 1) &&\nextract32(VAR_0->cpu_ctlr[VAR_6], group, 1)) {", "if (group == 0 && VAR_0->cpu_ctlr[VAR_6] & GICC_CTLR_FIQ_EN) {", "DPRINTF(\"Raised pending FIQ %d (VAR_6 %d)\\n\",\nVAR_1, VAR_6);", "VAR_5 = 1;", "} else {", "DPRINTF(\"Raised pending IRQ %d (VAR_6 %d)\\n\",\nVAR_1, VAR_6);", "VAR_4 = 1;", "}", "}", "}", "}", "qemu_set_irq(VAR_0->parent_irq[VAR_6], VAR_4);", "qemu_set_irq(VAR_0->parent_fiq[VAR_6], 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63, 65 ], [ 67 ], [ 71 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 85, 87 ], [ 89 ], [ 91, 93 ], [ 95 ], [ 98 ], [ 100, 102 ], [ 104 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ] ]
6,653
static void residual_interp(int16_t *buf, int16_t *out, int lag, int gain, int *rseed) { int i; if (lag) { /* Voiced */ int16_t *vector_ptr = buf + PITCH_MAX; /* Attenuate */ for (i = 0; i < lag; i++) out[i] = vector_ptr[i - lag] * 3 >> 2; av_memcpy_backptr((uint8_t*)(out + lag), lag * sizeof(*out), (FRAME_LEN - lag) * sizeof(*out)); } else { /* Unvoiced */ for (i = 0; i < FRAME_LEN; i++) { *rseed = *rseed * 521 + 259; out[i] = gain * *rseed >> 15; } memset(buf, 0, (FRAME_LEN + PITCH_MAX) * sizeof(*buf)); } }
true
FFmpeg
f2c539d3501111f10a2b4e9480ea54c0a3190680
static void residual_interp(int16_t *buf, int16_t *out, int lag, int gain, int *rseed) { int i; if (lag) { int16_t *vector_ptr = buf + PITCH_MAX; for (i = 0; i < lag; i++) out[i] = vector_ptr[i - lag] * 3 >> 2; av_memcpy_backptr((uint8_t*)(out + lag), lag * sizeof(*out), (FRAME_LEN - lag) * sizeof(*out)); } else { for (i = 0; i < FRAME_LEN; i++) { *rseed = *rseed * 521 + 259; out[i] = gain * *rseed >> 15; } memset(buf, 0, (FRAME_LEN + PITCH_MAX) * sizeof(*buf)); } }
{ "code": [ " *rseed = *rseed * 521 + 259;" ], "line_no": [ 27 ] }
static void FUNC_0(int16_t *VAR_0, int16_t *VAR_1, int VAR_2, int VAR_3, int *VAR_4) { int VAR_5; if (VAR_2) { int16_t *vector_ptr = VAR_0 + PITCH_MAX; for (VAR_5 = 0; VAR_5 < VAR_2; VAR_5++) VAR_1[VAR_5] = vector_ptr[VAR_5 - VAR_2] * 3 >> 2; av_memcpy_backptr((uint8_t*)(VAR_1 + VAR_2), VAR_2 * sizeof(*VAR_1), (FRAME_LEN - VAR_2) * sizeof(*VAR_1)); } else { for (VAR_5 = 0; VAR_5 < FRAME_LEN; VAR_5++) { *VAR_4 = *VAR_4 * 521 + 259; VAR_1[VAR_5] = VAR_3 * *VAR_4 >> 15; } memset(VAR_0, 0, (FRAME_LEN + PITCH_MAX) * sizeof(*VAR_0)); } }
[ "static void FUNC_0(int16_t *VAR_0, int16_t *VAR_1, int VAR_2,\nint VAR_3, int *VAR_4)\n{", "int VAR_5;", "if (VAR_2) {", "int16_t *vector_ptr = VAR_0 + PITCH_MAX;", "for (VAR_5 = 0; VAR_5 < VAR_2; VAR_5++)", "VAR_1[VAR_5] = vector_ptr[VAR_5 - VAR_2] * 3 >> 2;", "av_memcpy_backptr((uint8_t*)(VAR_1 + VAR_2), VAR_2 * sizeof(*VAR_1),\n(FRAME_LEN - VAR_2) * sizeof(*VAR_1));", "} else {", "for (VAR_5 = 0; VAR_5 < FRAME_LEN; VAR_5++) {", "*VAR_4 = *VAR_4 * 521 + 259;", "VAR_1[VAR_5] = VAR_3 * *VAR_4 >> 15;", "}", "memset(VAR_0, 0, (FRAME_LEN + PITCH_MAX) * sizeof(*VAR_0));", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19, 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ] ]
6,655
static int mpeg2_decode_block_non_intra(MpegEncContext *s, DCTELEM *block, int n) { int level, i, j, run; int code; RLTable *rl = &rl_mpeg1; const UINT8 *scan_table; const UINT16 *matrix; int mismatch; if (s->alternate_scan) scan_table = ff_alternate_vertical_scan; else scan_table = zigzag_direct; mismatch = 1; { int bit_cnt, v; UINT32 bit_buf; UINT8 *buf_ptr; i = 0; if (n < 4) matrix = s->non_intra_matrix; else matrix = s->chroma_non_intra_matrix; /* special case for the first coef. no need to add a second vlc table */ SAVE_BITS(&s->gb); SHOW_BITS(&s->gb, v, 2); if (v & 2) { run = 0; level = 1 - ((v & 1) << 1); FLUSH_BITS(2); RESTORE_BITS(&s->gb); goto add_coef; } RESTORE_BITS(&s->gb); } /* now quantify & encode AC coefs */ for(;;) { code = get_vlc(&s->gb, &rl->vlc); if (code < 0) return -1; if (code == 112) { break; } else if (code == 111) { /* escape */ run = get_bits(&s->gb, 6); level = get_bits(&s->gb, 12); level = (level << 20) >> 20; } else { run = rl->table_run[code]; level = rl->table_level[code]; if (get_bits1(&s->gb)) level = -level; } i += run; if (i >= 64) return -1; add_coef: j = scan_table[i]; dprintf("%d: run=%d level=%d\n", n, run, level); /* XXX: optimize */ if (level > 0) { level = ((level * 2 + 1) * s->qscale * matrix[j]) >> 5; } else { level = ((-level * 2 + 1) * s->qscale * matrix[j]) >> 5; level = -level; } /* XXX: is it really necessary to saturate since the encoder knows whats going on ? */ mismatch ^= level; block[j] = level; i++; } block[63] ^= (mismatch & 1); s->block_last_index[n] = i; return 0; }
true
FFmpeg
d7e9533aa06f4073a27812349b35ba5fede11ca1
static int mpeg2_decode_block_non_intra(MpegEncContext *s, DCTELEM *block, int n) { int level, i, j, run; int code; RLTable *rl = &rl_mpeg1; const UINT8 *scan_table; const UINT16 *matrix; int mismatch; if (s->alternate_scan) scan_table = ff_alternate_vertical_scan; else scan_table = zigzag_direct; mismatch = 1; { int bit_cnt, v; UINT32 bit_buf; UINT8 *buf_ptr; i = 0; if (n < 4) matrix = s->non_intra_matrix; else matrix = s->chroma_non_intra_matrix; SAVE_BITS(&s->gb); SHOW_BITS(&s->gb, v, 2); if (v & 2) { run = 0; level = 1 - ((v & 1) << 1); FLUSH_BITS(2); RESTORE_BITS(&s->gb); goto add_coef; } RESTORE_BITS(&s->gb); } for(;;) { code = get_vlc(&s->gb, &rl->vlc); if (code < 0) return -1; if (code == 112) { break; } else if (code == 111) { run = get_bits(&s->gb, 6); level = get_bits(&s->gb, 12); level = (level << 20) >> 20; } else { run = rl->table_run[code]; level = rl->table_level[code]; if (get_bits1(&s->gb)) level = -level; } i += run; if (i >= 64) return -1; add_coef: j = scan_table[i]; dprintf("%d: run=%d level=%d\n", n, run, level); if (level > 0) { level = ((level * 2 + 1) * s->qscale * matrix[j]) >> 5; } else { level = ((-level * 2 + 1) * s->qscale * matrix[j]) >> 5; level = -level; } mismatch ^= level; block[j] = level; i++; } block[63] ^= (mismatch & 1); s->block_last_index[n] = i; return 0; }
{ "code": [ " } else {", " i = 0;", " matrix = s->non_intra_matrix;", " matrix = s->chroma_non_intra_matrix;", " } else {", " } else {" ], "line_no": [ 105, 43, 47, 51, 105, 105 ] }
static int FUNC_0(MpegEncContext *VAR_0, DCTELEM *VAR_1, int VAR_2) { int VAR_3, VAR_4, VAR_5, VAR_6; int VAR_7; RLTable *rl = &rl_mpeg1; const UINT8 *VAR_8; const UINT16 *VAR_9; int VAR_10; if (VAR_0->alternate_scan) VAR_8 = ff_alternate_vertical_scan; else VAR_8 = zigzag_direct; VAR_10 = 1; { int VAR_11, VAR_12; UINT32 bit_buf; UINT8 *buf_ptr; VAR_4 = 0; if (VAR_2 < 4) VAR_9 = VAR_0->non_intra_matrix; else VAR_9 = VAR_0->chroma_non_intra_matrix; SAVE_BITS(&VAR_0->gb); SHOW_BITS(&VAR_0->gb, VAR_12, 2); if (VAR_12 & 2) { VAR_6 = 0; VAR_3 = 1 - ((VAR_12 & 1) << 1); FLUSH_BITS(2); RESTORE_BITS(&VAR_0->gb); goto add_coef; } RESTORE_BITS(&VAR_0->gb); } for(;;) { VAR_7 = get_vlc(&VAR_0->gb, &rl->vlc); if (VAR_7 < 0) return -1; if (VAR_7 == 112) { break; } else if (VAR_7 == 111) { VAR_6 = get_bits(&VAR_0->gb, 6); VAR_3 = get_bits(&VAR_0->gb, 12); VAR_3 = (VAR_3 << 20) >> 20; } else { VAR_6 = rl->table_run[VAR_7]; VAR_3 = rl->table_level[VAR_7]; if (get_bits1(&VAR_0->gb)) VAR_3 = -VAR_3; } VAR_4 += VAR_6; if (VAR_4 >= 64) return -1; add_coef: VAR_5 = VAR_8[VAR_4]; dprintf("%d: VAR_6=%d VAR_3=%d\VAR_2", VAR_2, VAR_6, VAR_3); if (VAR_3 > 0) { VAR_3 = ((VAR_3 * 2 + 1) * VAR_0->qscale * VAR_9[VAR_5]) >> 5; } else { VAR_3 = ((-VAR_3 * 2 + 1) * VAR_0->qscale * VAR_9[VAR_5]) >> 5; VAR_3 = -VAR_3; } VAR_10 ^= VAR_3; VAR_1[VAR_5] = VAR_3; VAR_4++; } VAR_1[63] ^= (VAR_10 & 1); VAR_0->block_last_index[VAR_2] = VAR_4; return 0; }
[ "static int FUNC_0(MpegEncContext *VAR_0,\nDCTELEM *VAR_1,\nint VAR_2)\n{", "int VAR_3, VAR_4, VAR_5, VAR_6;", "int VAR_7;", "RLTable *rl = &rl_mpeg1;", "const UINT8 *VAR_8;", "const UINT16 *VAR_9;", "int VAR_10;", "if (VAR_0->alternate_scan)\nVAR_8 = ff_alternate_vertical_scan;", "else\nVAR_8 = zigzag_direct;", "VAR_10 = 1;", "{", "int VAR_11, VAR_12;", "UINT32 bit_buf;", "UINT8 *buf_ptr;", "VAR_4 = 0;", "if (VAR_2 < 4)\nVAR_9 = VAR_0->non_intra_matrix;", "else\nVAR_9 = VAR_0->chroma_non_intra_matrix;", "SAVE_BITS(&VAR_0->gb);", "SHOW_BITS(&VAR_0->gb, VAR_12, 2);", "if (VAR_12 & 2) {", "VAR_6 = 0;", "VAR_3 = 1 - ((VAR_12 & 1) << 1);", "FLUSH_BITS(2);", "RESTORE_BITS(&VAR_0->gb);", "goto add_coef;", "}", "RESTORE_BITS(&VAR_0->gb);", "}", "for(;;) {", "VAR_7 = get_vlc(&VAR_0->gb, &rl->vlc);", "if (VAR_7 < 0)\nreturn -1;", "if (VAR_7 == 112) {", "break;", "} else if (VAR_7 == 111) {", "VAR_6 = get_bits(&VAR_0->gb, 6);", "VAR_3 = get_bits(&VAR_0->gb, 12);", "VAR_3 = (VAR_3 << 20) >> 20;", "} else {", "VAR_6 = rl->table_run[VAR_7];", "VAR_3 = rl->table_level[VAR_7];", "if (get_bits1(&VAR_0->gb))\nVAR_3 = -VAR_3;", "}", "VAR_4 += VAR_6;", "if (VAR_4 >= 64)\nreturn -1;", "add_coef:\nVAR_5 = VAR_8[VAR_4];", "dprintf(\"%d: VAR_6=%d VAR_3=%d\\VAR_2\", VAR_2, VAR_6, VAR_3);", "if (VAR_3 > 0) {", "VAR_3 = ((VAR_3 * 2 + 1) * VAR_0->qscale * VAR_9[VAR_5]) >> 5;", "} else {", "VAR_3 = ((-VAR_3 * 2 + 1) * VAR_0->qscale * VAR_9[VAR_5]) >> 5;", "VAR_3 = -VAR_3;", "}", "VAR_10 ^= VAR_3;", "VAR_1[VAR_5] = VAR_3;", "VAR_4++;", "}", "VAR_1[63] ^= (VAR_10 & 1);", "VAR_0->block_last_index[VAR_2] = VAR_4;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23, 25 ], [ 27, 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45, 47 ], [ 49, 51 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 83 ], [ 85 ], [ 87, 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111, 113 ], [ 115 ], [ 117 ], [ 119, 121 ], [ 123, 125 ], [ 127 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ] ]
6,656
static int aiff_write_trailer(AVFormatContext *s) { AVIOContext *pb = s->pb; AIFFOutputContext *aiff = s->priv_data; AVCodecParameters *par = s->streams[0]->codecpar; /* Chunks sizes must be even */ int64_t file_size, end_size; end_size = file_size = avio_tell(pb); if (file_size & 1) { avio_w8(pb, 0); end_size++; } if (s->pb->seekable) { /* File length */ avio_seek(pb, aiff->form, SEEK_SET); avio_wb32(pb, file_size - aiff->form - 4); /* Number of sample frames */ avio_seek(pb, aiff->frames, SEEK_SET); avio_wb32(pb, (file_size - aiff->ssnd - 12) / par->block_align); /* Sound Data chunk size */ avio_seek(pb, aiff->ssnd, SEEK_SET); avio_wb32(pb, file_size - aiff->ssnd - 4); /* return to the end */ avio_seek(pb, end_size, SEEK_SET); avio_flush(pb); } return 0; }
false
FFmpeg
83548fe894cdb455cc127f754d09905b6d23c173
static int aiff_write_trailer(AVFormatContext *s) { AVIOContext *pb = s->pb; AIFFOutputContext *aiff = s->priv_data; AVCodecParameters *par = s->streams[0]->codecpar; int64_t file_size, end_size; end_size = file_size = avio_tell(pb); if (file_size & 1) { avio_w8(pb, 0); end_size++; } if (s->pb->seekable) { avio_seek(pb, aiff->form, SEEK_SET); avio_wb32(pb, file_size - aiff->form - 4); avio_seek(pb, aiff->frames, SEEK_SET); avio_wb32(pb, (file_size - aiff->ssnd - 12) / par->block_align); avio_seek(pb, aiff->ssnd, SEEK_SET); avio_wb32(pb, file_size - aiff->ssnd - 4); avio_seek(pb, end_size, SEEK_SET); avio_flush(pb); } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0) { AVIOContext *pb = VAR_0->pb; AIFFOutputContext *aiff = VAR_0->priv_data; AVCodecParameters *par = VAR_0->streams[0]->codecpar; int64_t file_size, end_size; end_size = file_size = avio_tell(pb); if (file_size & 1) { avio_w8(pb, 0); end_size++; } if (VAR_0->pb->seekable) { avio_seek(pb, aiff->form, SEEK_SET); avio_wb32(pb, file_size - aiff->form - 4); avio_seek(pb, aiff->frames, SEEK_SET); avio_wb32(pb, (file_size - aiff->ssnd - 12) / par->block_align); avio_seek(pb, aiff->ssnd, SEEK_SET); avio_wb32(pb, file_size - aiff->ssnd - 4); avio_seek(pb, end_size, SEEK_SET); avio_flush(pb); } return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0)\n{", "AVIOContext *pb = VAR_0->pb;", "AIFFOutputContext *aiff = VAR_0->priv_data;", "AVCodecParameters *par = VAR_0->streams[0]->codecpar;", "int64_t file_size, end_size;", "end_size = file_size = avio_tell(pb);", "if (file_size & 1) {", "avio_w8(pb, 0);", "end_size++;", "}", "if (VAR_0->pb->seekable) {", "avio_seek(pb, aiff->form, SEEK_SET);", "avio_wb32(pb, file_size - aiff->form - 4);", "avio_seek(pb, aiff->frames, SEEK_SET);", "avio_wb32(pb, (file_size - aiff->ssnd - 12) / par->block_align);", "avio_seek(pb, aiff->ssnd, SEEK_SET);", "avio_wb32(pb, file_size - aiff->ssnd - 4);", "avio_seek(pb, end_size, SEEK_SET);", "avio_flush(pb);", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 33 ], [ 35 ], [ 41 ], [ 43 ], [ 49 ], [ 51 ], [ 57 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ] ]
6,657
static void RENAME(yuv2rgb565_2)(SwsContext *c, const uint16_t *buf0, const uint16_t *buf1, const uint16_t *ubuf0, const uint16_t *ubuf1, const uint16_t *vbuf0, const uint16_t *vbuf1, const uint16_t *abuf0, const uint16_t *abuf1, uint8_t *dest, int dstW, int yalpha, int uvalpha, int y) { //Note 8280 == DSTW_OFFSET but the preprocessor can't handle that there :( __asm__ volatile( "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" "mov %4, %%"REG_b" \n\t" "push %%"REG_BP" \n\t" YSCALEYUV2RGB(%%REGBP, %5) "pxor %%mm7, %%mm7 \n\t" /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */ #ifdef DITHER1XBPP "paddusb "BLUE_DITHER"(%5), %%mm2 \n\t" "paddusb "GREEN_DITHER"(%5), %%mm4 \n\t" "paddusb "RED_DITHER"(%5), %%mm5 \n\t" #endif WRITERGB16(%%REGb, 8280(%5), %%REGBP) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "m" (dest), "a" (&c->redDither) ); }
false
FFmpeg
13a099799e89a76eb921ca452e1b04a7a28a9855
static void RENAME(yuv2rgb565_2)(SwsContext *c, const uint16_t *buf0, const uint16_t *buf1, const uint16_t *ubuf0, const uint16_t *ubuf1, const uint16_t *vbuf0, const uint16_t *vbuf1, const uint16_t *abuf0, const uint16_t *abuf1, uint8_t *dest, int dstW, int yalpha, int uvalpha, int y) { __asm__ volatile( "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" "mov %4, %%"REG_b" \n\t" "push %%"REG_BP" \n\t" YSCALEYUV2RGB(%%REGBP, %5) "pxor %%mm7, %%mm7 \n\t" #ifdef DITHER1XBPP "paddusb "BLUE_DITHER"(%5), %%mm2 \n\t" "paddusb "GREEN_DITHER"(%5), %%mm4 \n\t" "paddusb "RED_DITHER"(%5), %%mm5 \n\t" #endif WRITERGB16(%%REGb, 8280(%5), %%REGBP) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "m" (dest), "a" (&c->redDither) ); }
{ "code": [], "line_no": [] }
static void FUNC_0(yuv2rgb565_2)(SwsContext *c, const uint16_t *buf0, const uint16_t *buf1, const uint16_t *ubuf0, const uint16_t *ubuf1, const uint16_t *vbuf0, const uint16_t *vbuf1, const uint16_t *abuf0, const uint16_t *abuf1, uint8_t *dest, int dstW, int yalpha, int uvalpha, int y) { __asm__ volatile( "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" "mov %4, %%"REG_b" \n\t" "push %%"REG_BP" \n\t" YSCALEYUV2RGB(%%REGBP, %5) "pxor %%mm7, %%mm7 \n\t" #ifdef DITHER1XBPP "paddusb "BLUE_DITHER"(%5), %%mm2 \n\t" "paddusb "GREEN_DITHER"(%5), %%mm4 \n\t" "paddusb "RED_DITHER"(%5), %%mm5 \n\t" #endif WRITERGB16(%%REGb, 8280(%5), %%REGBP) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "m" (dest), "a" (&c->redDither) ); }
[ "static void FUNC_0(yuv2rgb565_2)(SwsContext *c, const uint16_t *buf0,\nconst uint16_t *buf1, const uint16_t *ubuf0,\nconst uint16_t *ubuf1, const uint16_t *vbuf0,\nconst uint16_t *vbuf1, const uint16_t *abuf0,\nconst uint16_t *abuf1, uint8_t *dest,\nint dstW, int yalpha, int uvalpha, int y)\n{", "__asm__ volatile(\n\"mov %%\"REG_b\", \"ESP_OFFSET\"(%5) \\n\\t\"\n\"mov %4, %%\"REG_b\" \\n\\t\"\n\"push %%\"REG_BP\" \\n\\t\"\nYSCALEYUV2RGB(%%REGBP, %5)\n\"pxor %%mm7, %%mm7 \\n\\t\"\n#ifdef DITHER1XBPP\n\"paddusb \"BLUE_DITHER\"(%5), %%mm2 \\n\\t\"\n\"paddusb \"GREEN_DITHER\"(%5), %%mm4 \\n\\t\"\n\"paddusb \"RED_DITHER\"(%5), %%mm5 \\n\\t\"\n#endif\nWRITERGB16(%%REGb, 8280(%5), %%REGBP)\n\"pop %%\"REG_BP\" \\n\\t\"\n\"mov \"ESP_OFFSET\"(%5), %%\"REG_b\" \\n\\t\"\n:: \"c\" (buf0), \"d\" (buf1), \"S\" (ubuf0), \"D\" (ubuf1), \"m\" (dest),\n\"a\" (&c->redDither)\n);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11, 13 ], [ 17, 19, 21, 23, 25, 27, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51 ], [ 53 ] ]
6,658
struct AACISError ff_aac_is_encoding_err(AACEncContext *s, ChannelElement *cpe, int start, int w, int g, float ener0, float ener1, float ener01, int use_pcoeffs, int phase) { int i, w2; SingleChannelElement *sce0 = &cpe->ch[0]; SingleChannelElement *sce1 = &cpe->ch[1]; float *L = use_pcoeffs ? sce0->pcoeffs : sce0->coeffs; float *R = use_pcoeffs ? sce1->pcoeffs : sce1->coeffs; float *L34 = &s->scoefs[256*0], *R34 = &s->scoefs[256*1]; float *IS = &s->scoefs[256*2], *I34 = &s->scoefs[256*3]; float dist1 = 0.0f, dist2 = 0.0f; struct AACISError is_error = {0}; if (ener01 <= 0 || ener0 <= 0) { is_error.pass = 0; return is_error; } for (w2 = 0; w2 < sce0->ics.group_len[w]; w2++) { FFPsyBand *band0 = &s->psy.ch[s->cur_channel+0].psy_bands[(w+w2)*16+g]; FFPsyBand *band1 = &s->psy.ch[s->cur_channel+1].psy_bands[(w+w2)*16+g]; int is_band_type, is_sf_idx = FFMAX(1, sce0->sf_idx[(w+w2)*16+g]-4); float e01_34 = phase*pow(ener1/ener0, 3.0/4.0); float maxval, dist_spec_err = 0.0f; float minthr = FFMIN(band0->threshold, band1->threshold); for (i = 0; i < sce0->ics.swb_sizes[g]; i++) IS[i] = (L[start+(w+w2)*128+i] + phase*R[start+(w+w2)*128+i])*sqrt(ener0/ener01); abs_pow34_v(L34, &L[start+(w+w2)*128], sce0->ics.swb_sizes[g]); abs_pow34_v(R34, &R[start+(w+w2)*128], sce0->ics.swb_sizes[g]); abs_pow34_v(I34, IS, sce0->ics.swb_sizes[g]); maxval = find_max_val(1, sce0->ics.swb_sizes[g], I34); is_band_type = find_min_book(maxval, is_sf_idx); dist1 += quantize_band_cost(s, &L[start + (w+w2)*128], L34, sce0->ics.swb_sizes[g], sce0->sf_idx[(w+w2)*16+g], sce0->band_type[(w+w2)*16+g], s->lambda / band0->threshold, INFINITY, NULL, NULL, 0); dist1 += quantize_band_cost(s, &R[start + (w+w2)*128], R34, sce1->ics.swb_sizes[g], sce1->sf_idx[(w+w2)*16+g], sce1->band_type[(w+w2)*16+g], s->lambda / band1->threshold, INFINITY, NULL, NULL, 0); dist2 += quantize_band_cost(s, IS, I34, sce0->ics.swb_sizes[g], is_sf_idx, is_band_type, s->lambda / minthr, INFINITY, NULL, NULL, 0); for (i = 0; i < sce0->ics.swb_sizes[g]; i++) { dist_spec_err += (L34[i] - I34[i])*(L34[i] - I34[i]); dist_spec_err += (R34[i] - I34[i]*e01_34)*(R34[i] - I34[i]*e01_34); } dist_spec_err *= s->lambda / minthr; dist2 += dist_spec_err; } is_error.pass = dist2 <= dist1; is_error.phase = phase; is_error.error = fabsf(dist1 - dist2); is_error.dist1 = dist1; is_error.dist2 = dist2; is_error.ener01 = ener01; return is_error; }
false
FFmpeg
4dcb69cc12d00d46f93a07178e2087a8d27c8f64
struct AACISError ff_aac_is_encoding_err(AACEncContext *s, ChannelElement *cpe, int start, int w, int g, float ener0, float ener1, float ener01, int use_pcoeffs, int phase) { int i, w2; SingleChannelElement *sce0 = &cpe->ch[0]; SingleChannelElement *sce1 = &cpe->ch[1]; float *L = use_pcoeffs ? sce0->pcoeffs : sce0->coeffs; float *R = use_pcoeffs ? sce1->pcoeffs : sce1->coeffs; float *L34 = &s->scoefs[256*0], *R34 = &s->scoefs[256*1]; float *IS = &s->scoefs[256*2], *I34 = &s->scoefs[256*3]; float dist1 = 0.0f, dist2 = 0.0f; struct AACISError is_error = {0}; if (ener01 <= 0 || ener0 <= 0) { is_error.pass = 0; return is_error; } for (w2 = 0; w2 < sce0->ics.group_len[w]; w2++) { FFPsyBand *band0 = &s->psy.ch[s->cur_channel+0].psy_bands[(w+w2)*16+g]; FFPsyBand *band1 = &s->psy.ch[s->cur_channel+1].psy_bands[(w+w2)*16+g]; int is_band_type, is_sf_idx = FFMAX(1, sce0->sf_idx[(w+w2)*16+g]-4); float e01_34 = phase*pow(ener1/ener0, 3.0/4.0); float maxval, dist_spec_err = 0.0f; float minthr = FFMIN(band0->threshold, band1->threshold); for (i = 0; i < sce0->ics.swb_sizes[g]; i++) IS[i] = (L[start+(w+w2)*128+i] + phase*R[start+(w+w2)*128+i])*sqrt(ener0/ener01); abs_pow34_v(L34, &L[start+(w+w2)*128], sce0->ics.swb_sizes[g]); abs_pow34_v(R34, &R[start+(w+w2)*128], sce0->ics.swb_sizes[g]); abs_pow34_v(I34, IS, sce0->ics.swb_sizes[g]); maxval = find_max_val(1, sce0->ics.swb_sizes[g], I34); is_band_type = find_min_book(maxval, is_sf_idx); dist1 += quantize_band_cost(s, &L[start + (w+w2)*128], L34, sce0->ics.swb_sizes[g], sce0->sf_idx[(w+w2)*16+g], sce0->band_type[(w+w2)*16+g], s->lambda / band0->threshold, INFINITY, NULL, NULL, 0); dist1 += quantize_band_cost(s, &R[start + (w+w2)*128], R34, sce1->ics.swb_sizes[g], sce1->sf_idx[(w+w2)*16+g], sce1->band_type[(w+w2)*16+g], s->lambda / band1->threshold, INFINITY, NULL, NULL, 0); dist2 += quantize_band_cost(s, IS, I34, sce0->ics.swb_sizes[g], is_sf_idx, is_band_type, s->lambda / minthr, INFINITY, NULL, NULL, 0); for (i = 0; i < sce0->ics.swb_sizes[g]; i++) { dist_spec_err += (L34[i] - I34[i])*(L34[i] - I34[i]); dist_spec_err += (R34[i] - I34[i]*e01_34)*(R34[i] - I34[i]*e01_34); } dist_spec_err *= s->lambda / minthr; dist2 += dist_spec_err; } is_error.pass = dist2 <= dist1; is_error.phase = phase; is_error.error = fabsf(dist1 - dist2); is_error.dist1 = dist1; is_error.dist2 = dist2; is_error.ener01 = ener01; return is_error; }
{ "code": [], "line_no": [] }
struct AACISError FUNC_0(AACEncContext *VAR_0, ChannelElement *VAR_1, int VAR_2, int VAR_3, int VAR_4, float VAR_5, float VAR_6, float VAR_7, int VAR_8, int VAR_9) { int VAR_10, VAR_11; SingleChannelElement *sce0 = &VAR_1->ch[0]; SingleChannelElement *sce1 = &VAR_1->ch[1]; float *VAR_12 = VAR_8 ? sce0->pcoeffs : sce0->coeffs; float *VAR_13 = VAR_8 ? sce1->pcoeffs : sce1->coeffs; float *VAR_14 = &VAR_0->scoefs[256*0], *VAR_15 = &VAR_0->scoefs[256*1]; float *VAR_16 = &VAR_0->scoefs[256*2], *VAR_17 = &VAR_0->scoefs[256*3]; float VAR_18 = 0.0f, VAR_19 = 0.0f; struct AACISError VAR_20 = {0}; if (VAR_7 <= 0 || VAR_5 <= 0) { VAR_20.pass = 0; return VAR_20; } for (VAR_11 = 0; VAR_11 < sce0->ics.group_len[VAR_3]; VAR_11++) { FFPsyBand *band0 = &VAR_0->psy.ch[VAR_0->cur_channel+0].psy_bands[(VAR_3+VAR_11)*16+VAR_4]; FFPsyBand *band1 = &VAR_0->psy.ch[VAR_0->cur_channel+1].psy_bands[(VAR_3+VAR_11)*16+VAR_4]; int is_band_type, is_sf_idx = FFMAX(1, sce0->sf_idx[(VAR_3+VAR_11)*16+VAR_4]-4); float e01_34 = VAR_9*pow(VAR_6/VAR_5, 3.0/4.0); float maxval, dist_spec_err = 0.0f; float minthr = FFMIN(band0->threshold, band1->threshold); for (VAR_10 = 0; VAR_10 < sce0->ics.swb_sizes[VAR_4]; VAR_10++) VAR_16[VAR_10] = (VAR_12[VAR_2+(VAR_3+VAR_11)*128+VAR_10] + VAR_9*VAR_13[VAR_2+(VAR_3+VAR_11)*128+VAR_10])*sqrt(VAR_5/VAR_7); abs_pow34_v(VAR_14, &VAR_12[VAR_2+(VAR_3+VAR_11)*128], sce0->ics.swb_sizes[VAR_4]); abs_pow34_v(VAR_15, &VAR_13[VAR_2+(VAR_3+VAR_11)*128], sce0->ics.swb_sizes[VAR_4]); abs_pow34_v(VAR_17, VAR_16, sce0->ics.swb_sizes[VAR_4]); maxval = find_max_val(1, sce0->ics.swb_sizes[VAR_4], VAR_17); is_band_type = find_min_book(maxval, is_sf_idx); VAR_18 += quantize_band_cost(VAR_0, &VAR_12[VAR_2 + (VAR_3+VAR_11)*128], VAR_14, sce0->ics.swb_sizes[VAR_4], sce0->sf_idx[(VAR_3+VAR_11)*16+VAR_4], sce0->band_type[(VAR_3+VAR_11)*16+VAR_4], VAR_0->lambda / band0->threshold, INFINITY, NULL, NULL, 0); VAR_18 += quantize_band_cost(VAR_0, &VAR_13[VAR_2 + (VAR_3+VAR_11)*128], VAR_15, sce1->ics.swb_sizes[VAR_4], sce1->sf_idx[(VAR_3+VAR_11)*16+VAR_4], sce1->band_type[(VAR_3+VAR_11)*16+VAR_4], VAR_0->lambda / band1->threshold, INFINITY, NULL, NULL, 0); VAR_19 += quantize_band_cost(VAR_0, VAR_16, VAR_17, sce0->ics.swb_sizes[VAR_4], is_sf_idx, is_band_type, VAR_0->lambda / minthr, INFINITY, NULL, NULL, 0); for (VAR_10 = 0; VAR_10 < sce0->ics.swb_sizes[VAR_4]; VAR_10++) { dist_spec_err += (VAR_14[VAR_10] - VAR_17[VAR_10])*(VAR_14[VAR_10] - VAR_17[VAR_10]); dist_spec_err += (VAR_15[VAR_10] - VAR_17[VAR_10]*e01_34)*(VAR_15[VAR_10] - VAR_17[VAR_10]*e01_34); } dist_spec_err *= VAR_0->lambda / minthr; VAR_19 += dist_spec_err; } VAR_20.pass = VAR_19 <= VAR_18; VAR_20.VAR_9 = VAR_9; VAR_20.error = fabsf(VAR_18 - VAR_19); VAR_20.VAR_18 = VAR_18; VAR_20.VAR_19 = VAR_19; VAR_20.VAR_7 = VAR_7; return VAR_20; }
[ "struct AACISError FUNC_0(AACEncContext *VAR_0, ChannelElement *VAR_1,\nint VAR_2, int VAR_3, int VAR_4, float VAR_5,\nfloat VAR_6, float VAR_7,\nint VAR_8, int VAR_9)\n{", "int VAR_10, VAR_11;", "SingleChannelElement *sce0 = &VAR_1->ch[0];", "SingleChannelElement *sce1 = &VAR_1->ch[1];", "float *VAR_12 = VAR_8 ? sce0->pcoeffs : sce0->coeffs;", "float *VAR_13 = VAR_8 ? sce1->pcoeffs : sce1->coeffs;", "float *VAR_14 = &VAR_0->scoefs[256*0], *VAR_15 = &VAR_0->scoefs[256*1];", "float *VAR_16 = &VAR_0->scoefs[256*2], *VAR_17 = &VAR_0->scoefs[256*3];", "float VAR_18 = 0.0f, VAR_19 = 0.0f;", "struct AACISError VAR_20 = {0};", "if (VAR_7 <= 0 || VAR_5 <= 0) {", "VAR_20.pass = 0;", "return VAR_20;", "}", "for (VAR_11 = 0; VAR_11 < sce0->ics.group_len[VAR_3]; VAR_11++) {", "FFPsyBand *band0 = &VAR_0->psy.ch[VAR_0->cur_channel+0].psy_bands[(VAR_3+VAR_11)*16+VAR_4];", "FFPsyBand *band1 = &VAR_0->psy.ch[VAR_0->cur_channel+1].psy_bands[(VAR_3+VAR_11)*16+VAR_4];", "int is_band_type, is_sf_idx = FFMAX(1, sce0->sf_idx[(VAR_3+VAR_11)*16+VAR_4]-4);", "float e01_34 = VAR_9*pow(VAR_6/VAR_5, 3.0/4.0);", "float maxval, dist_spec_err = 0.0f;", "float minthr = FFMIN(band0->threshold, band1->threshold);", "for (VAR_10 = 0; VAR_10 < sce0->ics.swb_sizes[VAR_4]; VAR_10++)", "VAR_16[VAR_10] = (VAR_12[VAR_2+(VAR_3+VAR_11)*128+VAR_10] + VAR_9*VAR_13[VAR_2+(VAR_3+VAR_11)*128+VAR_10])*sqrt(VAR_5/VAR_7);", "abs_pow34_v(VAR_14, &VAR_12[VAR_2+(VAR_3+VAR_11)*128], sce0->ics.swb_sizes[VAR_4]);", "abs_pow34_v(VAR_15, &VAR_13[VAR_2+(VAR_3+VAR_11)*128], sce0->ics.swb_sizes[VAR_4]);", "abs_pow34_v(VAR_17, VAR_16, sce0->ics.swb_sizes[VAR_4]);", "maxval = find_max_val(1, sce0->ics.swb_sizes[VAR_4], VAR_17);", "is_band_type = find_min_book(maxval, is_sf_idx);", "VAR_18 += quantize_band_cost(VAR_0, &VAR_12[VAR_2 + (VAR_3+VAR_11)*128], VAR_14,\nsce0->ics.swb_sizes[VAR_4],\nsce0->sf_idx[(VAR_3+VAR_11)*16+VAR_4],\nsce0->band_type[(VAR_3+VAR_11)*16+VAR_4],\nVAR_0->lambda / band0->threshold, INFINITY, NULL, NULL, 0);", "VAR_18 += quantize_band_cost(VAR_0, &VAR_13[VAR_2 + (VAR_3+VAR_11)*128], VAR_15,\nsce1->ics.swb_sizes[VAR_4],\nsce1->sf_idx[(VAR_3+VAR_11)*16+VAR_4],\nsce1->band_type[(VAR_3+VAR_11)*16+VAR_4],\nVAR_0->lambda / band1->threshold, INFINITY, NULL, NULL, 0);", "VAR_19 += quantize_band_cost(VAR_0, VAR_16, VAR_17, sce0->ics.swb_sizes[VAR_4],\nis_sf_idx, is_band_type,\nVAR_0->lambda / minthr, INFINITY, NULL, NULL, 0);", "for (VAR_10 = 0; VAR_10 < sce0->ics.swb_sizes[VAR_4]; VAR_10++) {", "dist_spec_err += (VAR_14[VAR_10] - VAR_17[VAR_10])*(VAR_14[VAR_10] - VAR_17[VAR_10]);", "dist_spec_err += (VAR_15[VAR_10] - VAR_17[VAR_10]*e01_34)*(VAR_15[VAR_10] - VAR_17[VAR_10]*e01_34);", "}", "dist_spec_err *= VAR_0->lambda / minthr;", "VAR_19 += dist_spec_err;", "}", "VAR_20.pass = VAR_19 <= VAR_18;", "VAR_20.VAR_9 = VAR_9;", "VAR_20.error = fabsf(VAR_18 - VAR_19);", "VAR_20.VAR_18 = VAR_18;", "VAR_20.VAR_19 = VAR_19;", "VAR_20.VAR_7 = VAR_7;", "return VAR_20;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 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 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 125 ], [ 127 ] ]
6,659
static int hls_write_packet(AVFormatContext *s, AVPacket *pkt) { HLSContext *hls = s->priv_data; AVFormatContext *oc = NULL; AVStream *st = s->streams[pkt->stream_index]; int64_t end_pts = hls->recording_time * hls->number; int is_ref_pkt = 1; int ret, can_split = 1; int stream_index = 0; if (hls->sequence - hls->nb_entries > hls->start_sequence && hls->init_time > 0) { /* reset end_pts, hls->recording_time at end of the init hls list */ int init_list_dur = hls->init_time * hls->nb_entries * AV_TIME_BASE; int after_init_list_dur = (hls->sequence - hls->nb_entries ) * hls->time * AV_TIME_BASE; hls->recording_time = hls->time * AV_TIME_BASE; end_pts = init_list_dur + after_init_list_dur ; } if( st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE ) { oc = hls->vtt_avf; stream_index = 0; } else { oc = hls->avf; stream_index = pkt->stream_index; } if (hls->start_pts == AV_NOPTS_VALUE) { hls->start_pts = pkt->pts; hls->end_pts = pkt->pts; } if (hls->has_video) { can_split = st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && ((pkt->flags & AV_PKT_FLAG_KEY) || (hls->flags & HLS_SPLIT_BY_TIME)); is_ref_pkt = st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO; } if (pkt->pts == AV_NOPTS_VALUE) is_ref_pkt = can_split = 0; if (is_ref_pkt) { if (hls->new_start) { hls->new_start = 0; hls->duration = (double)(pkt->pts - hls->end_pts) * st->time_base.num / st->time_base.den; hls->dpp = (double)(pkt->duration) * st->time_base.num / st->time_base.den; } else { hls->duration += (double)(pkt->duration) * st->time_base.num / st->time_base.den; } } if (can_split && av_compare_ts(pkt->pts - hls->start_pts, st->time_base, end_pts, AV_TIME_BASE_Q) >= 0) { int64_t new_start_pos; char *old_filename = av_strdup(hls->avf->filename); if (!old_filename) { return AVERROR(ENOMEM); } av_write_frame(oc, NULL); /* Flush any buffered data */ new_start_pos = avio_tell(hls->avf->pb); hls->size = new_start_pos - hls->start_pos; ff_format_io_close(s, &oc->pb); if (hls->vtt_avf) { ff_format_io_close(s, &hls->vtt_avf->pb); } if ((hls->flags & HLS_TEMP_FILE) && oc->filename[0]) { if (!(hls->flags & HLS_SINGLE_FILE) || (hls->max_seg_size <= 0)) if (hls->avf->oformat->priv_class && hls->avf->priv_data) av_opt_set(hls->avf->priv_data, "mpegts_flags", "resend_headers", 0); hls_rename_temp_file(s, oc); } ret = hls_append_segment(s, hls, hls->duration, hls->start_pos, hls->size); hls->start_pos = new_start_pos; if (ret < 0) { av_free(old_filename); return ret; } hls->end_pts = pkt->pts; hls->duration = 0; if (hls->flags & HLS_SINGLE_FILE) { hls->number++; } else if (hls->max_seg_size > 0) { if (hls->start_pos >= hls->max_seg_size) { hls->sequence++; sls_flag_file_rename(hls, old_filename); ret = hls_start(s); hls->start_pos = 0; /* When split segment by byte, the duration is short than hls_time, * so it is not enough one segment duration as hls_time, */ hls->number--; } hls->number++; } else { sls_flag_file_rename(hls, old_filename); ret = hls_start(s); } if (ret < 0) { av_free(old_filename); return ret; } if ((ret = hls_window(s, 0)) < 0) { av_free(old_filename); return ret; } } ret = ff_write_chained(oc, stream_index, pkt, s, 0); return ret; }
false
FFmpeg
d3ce067e7687203cf4a0a475ffd4b733b7c3b4f4
static int hls_write_packet(AVFormatContext *s, AVPacket *pkt) { HLSContext *hls = s->priv_data; AVFormatContext *oc = NULL; AVStream *st = s->streams[pkt->stream_index]; int64_t end_pts = hls->recording_time * hls->number; int is_ref_pkt = 1; int ret, can_split = 1; int stream_index = 0; if (hls->sequence - hls->nb_entries > hls->start_sequence && hls->init_time > 0) { int init_list_dur = hls->init_time * hls->nb_entries * AV_TIME_BASE; int after_init_list_dur = (hls->sequence - hls->nb_entries ) * hls->time * AV_TIME_BASE; hls->recording_time = hls->time * AV_TIME_BASE; end_pts = init_list_dur + after_init_list_dur ; } if( st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE ) { oc = hls->vtt_avf; stream_index = 0; } else { oc = hls->avf; stream_index = pkt->stream_index; } if (hls->start_pts == AV_NOPTS_VALUE) { hls->start_pts = pkt->pts; hls->end_pts = pkt->pts; } if (hls->has_video) { can_split = st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && ((pkt->flags & AV_PKT_FLAG_KEY) || (hls->flags & HLS_SPLIT_BY_TIME)); is_ref_pkt = st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO; } if (pkt->pts == AV_NOPTS_VALUE) is_ref_pkt = can_split = 0; if (is_ref_pkt) { if (hls->new_start) { hls->new_start = 0; hls->duration = (double)(pkt->pts - hls->end_pts) * st->time_base.num / st->time_base.den; hls->dpp = (double)(pkt->duration) * st->time_base.num / st->time_base.den; } else { hls->duration += (double)(pkt->duration) * st->time_base.num / st->time_base.den; } } if (can_split && av_compare_ts(pkt->pts - hls->start_pts, st->time_base, end_pts, AV_TIME_BASE_Q) >= 0) { int64_t new_start_pos; char *old_filename = av_strdup(hls->avf->filename); if (!old_filename) { return AVERROR(ENOMEM); } av_write_frame(oc, NULL); new_start_pos = avio_tell(hls->avf->pb); hls->size = new_start_pos - hls->start_pos; ff_format_io_close(s, &oc->pb); if (hls->vtt_avf) { ff_format_io_close(s, &hls->vtt_avf->pb); } if ((hls->flags & HLS_TEMP_FILE) && oc->filename[0]) { if (!(hls->flags & HLS_SINGLE_FILE) || (hls->max_seg_size <= 0)) if (hls->avf->oformat->priv_class && hls->avf->priv_data) av_opt_set(hls->avf->priv_data, "mpegts_flags", "resend_headers", 0); hls_rename_temp_file(s, oc); } ret = hls_append_segment(s, hls, hls->duration, hls->start_pos, hls->size); hls->start_pos = new_start_pos; if (ret < 0) { av_free(old_filename); return ret; } hls->end_pts = pkt->pts; hls->duration = 0; if (hls->flags & HLS_SINGLE_FILE) { hls->number++; } else if (hls->max_seg_size > 0) { if (hls->start_pos >= hls->max_seg_size) { hls->sequence++; sls_flag_file_rename(hls, old_filename); ret = hls_start(s); hls->start_pos = 0; hls->number--; } hls->number++; } else { sls_flag_file_rename(hls, old_filename); ret = hls_start(s); } if (ret < 0) { av_free(old_filename); return ret; } if ((ret = hls_window(s, 0)) < 0) { av_free(old_filename); return ret; } } ret = ff_write_chained(oc, stream_index, pkt, s, 0); return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1) { HLSContext *hls = VAR_0->priv_data; AVFormatContext *oc = NULL; AVStream *st = VAR_0->streams[VAR_1->VAR_5]; int64_t end_pts = hls->recording_time * hls->number; int VAR_2 = 1; int VAR_3, VAR_4 = 1; int VAR_5 = 0; if (hls->sequence - hls->nb_entries > hls->start_sequence && hls->init_time > 0) { int VAR_6 = hls->init_time * hls->nb_entries * AV_TIME_BASE; int VAR_7 = (hls->sequence - hls->nb_entries ) * hls->time * AV_TIME_BASE; hls->recording_time = hls->time * AV_TIME_BASE; end_pts = VAR_6 + VAR_7 ; } if( st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE ) { oc = hls->vtt_avf; VAR_5 = 0; } else { oc = hls->avf; VAR_5 = VAR_1->VAR_5; } if (hls->start_pts == AV_NOPTS_VALUE) { hls->start_pts = VAR_1->pts; hls->end_pts = VAR_1->pts; } if (hls->has_video) { VAR_4 = st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && ((VAR_1->flags & AV_PKT_FLAG_KEY) || (hls->flags & HLS_SPLIT_BY_TIME)); VAR_2 = st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO; } if (VAR_1->pts == AV_NOPTS_VALUE) VAR_2 = VAR_4 = 0; if (VAR_2) { if (hls->new_start) { hls->new_start = 0; hls->duration = (double)(VAR_1->pts - hls->end_pts) * st->time_base.num / st->time_base.den; hls->dpp = (double)(VAR_1->duration) * st->time_base.num / st->time_base.den; } else { hls->duration += (double)(VAR_1->duration) * st->time_base.num / st->time_base.den; } } if (VAR_4 && av_compare_ts(VAR_1->pts - hls->start_pts, st->time_base, end_pts, AV_TIME_BASE_Q) >= 0) { int64_t new_start_pos; char *VAR_8 = av_strdup(hls->avf->filename); if (!VAR_8) { return AVERROR(ENOMEM); } av_write_frame(oc, NULL); new_start_pos = avio_tell(hls->avf->pb); hls->size = new_start_pos - hls->start_pos; ff_format_io_close(VAR_0, &oc->pb); if (hls->vtt_avf) { ff_format_io_close(VAR_0, &hls->vtt_avf->pb); } if ((hls->flags & HLS_TEMP_FILE) && oc->filename[0]) { if (!(hls->flags & HLS_SINGLE_FILE) || (hls->max_seg_size <= 0)) if (hls->avf->oformat->priv_class && hls->avf->priv_data) av_opt_set(hls->avf->priv_data, "mpegts_flags", "resend_headers", 0); hls_rename_temp_file(VAR_0, oc); } VAR_3 = hls_append_segment(VAR_0, hls, hls->duration, hls->start_pos, hls->size); hls->start_pos = new_start_pos; if (VAR_3 < 0) { av_free(VAR_8); return VAR_3; } hls->end_pts = VAR_1->pts; hls->duration = 0; if (hls->flags & HLS_SINGLE_FILE) { hls->number++; } else if (hls->max_seg_size > 0) { if (hls->start_pos >= hls->max_seg_size) { hls->sequence++; sls_flag_file_rename(hls, VAR_8); VAR_3 = hls_start(VAR_0); hls->start_pos = 0; hls->number--; } hls->number++; } else { sls_flag_file_rename(hls, VAR_8); VAR_3 = hls_start(VAR_0); } if (VAR_3 < 0) { av_free(VAR_8); return VAR_3; } if ((VAR_3 = hls_window(VAR_0, 0)) < 0) { av_free(VAR_8); return VAR_3; } } VAR_3 = ff_write_chained(oc, VAR_5, VAR_1, VAR_0, 0); return VAR_3; }
[ "static int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1)\n{", "HLSContext *hls = VAR_0->priv_data;", "AVFormatContext *oc = NULL;", "AVStream *st = VAR_0->streams[VAR_1->VAR_5];", "int64_t end_pts = hls->recording_time * hls->number;", "int VAR_2 = 1;", "int VAR_3, VAR_4 = 1;", "int VAR_5 = 0;", "if (hls->sequence - hls->nb_entries > hls->start_sequence && hls->init_time > 0) {", "int VAR_6 = hls->init_time * hls->nb_entries * AV_TIME_BASE;", "int VAR_7 = (hls->sequence - hls->nb_entries ) * hls->time * AV_TIME_BASE;", "hls->recording_time = hls->time * AV_TIME_BASE;", "end_pts = VAR_6 + VAR_7 ;", "}", "if( st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE ) {", "oc = hls->vtt_avf;", "VAR_5 = 0;", "} else {", "oc = hls->avf;", "VAR_5 = VAR_1->VAR_5;", "}", "if (hls->start_pts == AV_NOPTS_VALUE) {", "hls->start_pts = VAR_1->pts;", "hls->end_pts = VAR_1->pts;", "}", "if (hls->has_video) {", "VAR_4 = st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO &&\n((VAR_1->flags & AV_PKT_FLAG_KEY) || (hls->flags & HLS_SPLIT_BY_TIME));", "VAR_2 = st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO;", "}", "if (VAR_1->pts == AV_NOPTS_VALUE)\nVAR_2 = VAR_4 = 0;", "if (VAR_2) {", "if (hls->new_start) {", "hls->new_start = 0;", "hls->duration = (double)(VAR_1->pts - hls->end_pts)\n* st->time_base.num / st->time_base.den;", "hls->dpp = (double)(VAR_1->duration) * st->time_base.num / st->time_base.den;", "} else {", "hls->duration += (double)(VAR_1->duration) * st->time_base.num / st->time_base.den;", "}", "}", "if (VAR_4 && av_compare_ts(VAR_1->pts - hls->start_pts, st->time_base,\nend_pts, AV_TIME_BASE_Q) >= 0) {", "int64_t new_start_pos;", "char *VAR_8 = av_strdup(hls->avf->filename);", "if (!VAR_8) {", "return AVERROR(ENOMEM);", "}", "av_write_frame(oc, NULL);", "new_start_pos = avio_tell(hls->avf->pb);", "hls->size = new_start_pos - hls->start_pos;", "ff_format_io_close(VAR_0, &oc->pb);", "if (hls->vtt_avf) {", "ff_format_io_close(VAR_0, &hls->vtt_avf->pb);", "}", "if ((hls->flags & HLS_TEMP_FILE) && oc->filename[0]) {", "if (!(hls->flags & HLS_SINGLE_FILE) || (hls->max_seg_size <= 0))\nif (hls->avf->oformat->priv_class && hls->avf->priv_data)\nav_opt_set(hls->avf->priv_data, \"mpegts_flags\", \"resend_headers\", 0);", "hls_rename_temp_file(VAR_0, oc);", "}", "VAR_3 = hls_append_segment(VAR_0, hls, hls->duration, hls->start_pos, hls->size);", "hls->start_pos = new_start_pos;", "if (VAR_3 < 0) {", "av_free(VAR_8);", "return VAR_3;", "}", "hls->end_pts = VAR_1->pts;", "hls->duration = 0;", "if (hls->flags & HLS_SINGLE_FILE) {", "hls->number++;", "} else if (hls->max_seg_size > 0) {", "if (hls->start_pos >= hls->max_seg_size) {", "hls->sequence++;", "sls_flag_file_rename(hls, VAR_8);", "VAR_3 = hls_start(VAR_0);", "hls->start_pos = 0;", "hls->number--;", "}", "hls->number++;", "} else {", "sls_flag_file_rename(hls, VAR_8);", "VAR_3 = hls_start(VAR_0);", "}", "if (VAR_3 < 0) {", "av_free(VAR_8);", "return VAR_3;", "}", "if ((VAR_3 = hls_window(VAR_0, 0)) < 0) {", "av_free(VAR_8);", "return VAR_3;", "}", "}", "VAR_3 = ff_write_chained(oc, VAR_5, VAR_1, VAR_0, 0);", "return VAR_3;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63, 65 ], [ 67 ], [ 69 ], [ 71, 73 ], [ 77 ], [ 79 ], [ 81 ], [ 83, 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 97 ], [ 99, 101 ], [ 103 ], [ 105 ], [ 109 ], [ 111 ], [ 113 ], [ 117 ], [ 121 ], [ 123 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137, 139, 141 ], [ 143 ], [ 145 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 163 ], [ 165 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 227 ], [ 231 ], [ 233 ] ]
6,660
static void copy_cell(Indeo3DecodeContext *ctx, Plane *plane, Cell *cell) { int h, w, mv_x, mv_y, offset, offset_dst; uint8_t *src, *dst; /* setup output and reference pointers */ offset_dst = (cell->ypos << 2) * plane->pitch + (cell->xpos << 2); dst = plane->pixels[ctx->buf_sel] + offset_dst; mv_y = cell->mv_ptr[0]; mv_x = cell->mv_ptr[1]; offset = offset_dst + mv_y * plane->pitch + mv_x; src = plane->pixels[ctx->buf_sel ^ 1] + offset; h = cell->height << 2; for (w = cell->width; w > 0;) { /* copy using 16xH blocks */ if (!((cell->xpos << 2) & 15) && w >= 4) { for (; w >= 4; src += 16, dst += 16, w -= 4) ctx->dsp.put_no_rnd_pixels_tab[0][0](dst, src, plane->pitch, h); } /* copy using 8xH blocks */ if (!((cell->xpos << 2) & 7) && w >= 2) { ctx->dsp.put_no_rnd_pixels_tab[1][0](dst, src, plane->pitch, h); w -= 2; src += 8; dst += 8; } if (w >= 1) { copy_block4(dst, src, plane->pitch, plane->pitch, h); w--; src += 4; dst += 4; } } }
true
FFmpeg
e421b79d01a3bf18d1ff8d8c4639669b66d788a5
static void copy_cell(Indeo3DecodeContext *ctx, Plane *plane, Cell *cell) { int h, w, mv_x, mv_y, offset, offset_dst; uint8_t *src, *dst; offset_dst = (cell->ypos << 2) * plane->pitch + (cell->xpos << 2); dst = plane->pixels[ctx->buf_sel] + offset_dst; mv_y = cell->mv_ptr[0]; mv_x = cell->mv_ptr[1]; offset = offset_dst + mv_y * plane->pitch + mv_x; src = plane->pixels[ctx->buf_sel ^ 1] + offset; h = cell->height << 2; for (w = cell->width; w > 0;) { if (!((cell->xpos << 2) & 15) && w >= 4) { for (; w >= 4; src += 16, dst += 16, w -= 4) ctx->dsp.put_no_rnd_pixels_tab[0][0](dst, src, plane->pitch, h); } if (!((cell->xpos << 2) & 7) && w >= 2) { ctx->dsp.put_no_rnd_pixels_tab[1][0](dst, src, plane->pitch, h); w -= 2; src += 8; dst += 8; } if (w >= 1) { copy_block4(dst, src, plane->pitch, plane->pitch, h); w--; src += 4; dst += 4; } } }
{ "code": [], "line_no": [] }
static void FUNC_0(Indeo3DecodeContext *VAR_0, Plane *VAR_1, Cell *VAR_2) { int VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8; uint8_t *src, *dst; VAR_8 = (VAR_2->ypos << 2) * VAR_1->pitch + (VAR_2->xpos << 2); dst = VAR_1->pixels[VAR_0->buf_sel] + VAR_8; VAR_6 = VAR_2->mv_ptr[0]; VAR_5 = VAR_2->mv_ptr[1]; VAR_7 = VAR_8 + VAR_6 * VAR_1->pitch + VAR_5; src = VAR_1->pixels[VAR_0->buf_sel ^ 1] + VAR_7; VAR_3 = VAR_2->height << 2; for (VAR_4 = VAR_2->width; VAR_4 > 0;) { if (!((VAR_2->xpos << 2) & 15) && VAR_4 >= 4) { for (; VAR_4 >= 4; src += 16, dst += 16, VAR_4 -= 4) VAR_0->dsp.put_no_rnd_pixels_tab[0][0](dst, src, VAR_1->pitch, VAR_3); } if (!((VAR_2->xpos << 2) & 7) && VAR_4 >= 2) { VAR_0->dsp.put_no_rnd_pixels_tab[1][0](dst, src, VAR_1->pitch, VAR_3); VAR_4 -= 2; src += 8; dst += 8; } if (VAR_4 >= 1) { copy_block4(dst, src, VAR_1->pitch, VAR_1->pitch, VAR_3); VAR_4--; src += 4; dst += 4; } } }
[ "static void FUNC_0(Indeo3DecodeContext *VAR_0, Plane *VAR_1, Cell *VAR_2)\n{", "int VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8;", "uint8_t *src, *dst;", "VAR_8 = (VAR_2->ypos << 2) * VAR_1->pitch + (VAR_2->xpos << 2);", "dst = VAR_1->pixels[VAR_0->buf_sel] + VAR_8;", "VAR_6 = VAR_2->mv_ptr[0];", "VAR_5 = VAR_2->mv_ptr[1];", "VAR_7 = VAR_8 + VAR_6 * VAR_1->pitch + VAR_5;", "src = VAR_1->pixels[VAR_0->buf_sel ^ 1] + VAR_7;", "VAR_3 = VAR_2->height << 2;", "for (VAR_4 = VAR_2->width; VAR_4 > 0;) {", "if (!((VAR_2->xpos << 2) & 15) && VAR_4 >= 4) {", "for (; VAR_4 >= 4; src += 16, dst += 16, VAR_4 -= 4)", "VAR_0->dsp.put_no_rnd_pixels_tab[0][0](dst, src, VAR_1->pitch, VAR_3);", "}", "if (!((VAR_2->xpos << 2) & 7) && VAR_4 >= 2) {", "VAR_0->dsp.put_no_rnd_pixels_tab[1][0](dst, src, VAR_1->pitch, VAR_3);", "VAR_4 -= 2;", "src += 8;", "dst += 8;", "}", "if (VAR_4 >= 1) {", "copy_block4(dst, src, VAR_1->pitch, VAR_1->pitch, VAR_3);", "VAR_4--;", "src += 4;", "dst += 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 13 ], [ 15 ], [ 18 ], [ 20 ], [ 24 ], [ 26 ], [ 30 ], [ 34 ], [ 38 ], [ 40 ], [ 42 ], [ 44 ], [ 50 ], [ 52 ], [ 54 ], [ 56 ], [ 58 ], [ 60 ], [ 64 ], [ 66 ], [ 68 ], [ 70 ], [ 72 ], [ 74 ], [ 76 ], [ 78 ] ]
6,662
static void h264_h_loop_filter_chroma_c(uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0) { h264_loop_filter_chroma_c(pix, 1, stride, alpha, beta, tc0); }
false
FFmpeg
dd561441b1e849df7d8681c6f32af82d4088dafd
static void h264_h_loop_filter_chroma_c(uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0) { h264_loop_filter_chroma_c(pix, 1, stride, alpha, beta, tc0); }
{ "code": [], "line_no": [] }
static void FUNC_0(uint8_t *VAR_0, int VAR_1, int VAR_2, int VAR_3, int8_t *VAR_4) { h264_loop_filter_chroma_c(VAR_0, 1, VAR_1, VAR_2, VAR_3, VAR_4); }
[ "static void FUNC_0(uint8_t *VAR_0, int VAR_1, int VAR_2, int VAR_3, int8_t *VAR_4)\n{", "h264_loop_filter_chroma_c(VAR_0, 1, VAR_1, VAR_2, VAR_3, VAR_4);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
6,663
static int ram_save_host_page(RAMState *rs, PageSearchStatus *pss, bool last_stage, ram_addr_t dirty_ram_abs) { int tmppages, pages = 0; size_t pagesize = qemu_ram_pagesize(pss->block); do { tmppages = ram_save_target_page(rs, pss, last_stage, dirty_ram_abs); if (tmppages < 0) { return tmppages; } pages += tmppages; pss->offset += TARGET_PAGE_SIZE; dirty_ram_abs += TARGET_PAGE_SIZE; } while (pss->offset & (pagesize - 1)); /* The offset we leave with is the last one we looked at */ pss->offset -= TARGET_PAGE_SIZE; return pages; }
true
qemu
06b106889a09277617fc8c542397a9f595ee605a
static int ram_save_host_page(RAMState *rs, PageSearchStatus *pss, bool last_stage, ram_addr_t dirty_ram_abs) { int tmppages, pages = 0; size_t pagesize = qemu_ram_pagesize(pss->block); do { tmppages = ram_save_target_page(rs, pss, last_stage, dirty_ram_abs); if (tmppages < 0) { return tmppages; } pages += tmppages; pss->offset += TARGET_PAGE_SIZE; dirty_ram_abs += TARGET_PAGE_SIZE; } while (pss->offset & (pagesize - 1)); pss->offset -= TARGET_PAGE_SIZE; return pages; }
{ "code": [ " ram_addr_t dirty_ram_abs)", " tmppages = ram_save_target_page(rs, pss, last_stage, dirty_ram_abs);", " dirty_ram_abs += TARGET_PAGE_SIZE;" ], "line_no": [ 5, 17, 31 ] }
static int FUNC_0(RAMState *VAR_0, PageSearchStatus *VAR_1, bool VAR_2, ram_addr_t VAR_3) { int VAR_4, VAR_5 = 0; size_t pagesize = qemu_ram_pagesize(VAR_1->block); do { VAR_4 = ram_save_target_page(VAR_0, VAR_1, VAR_2, VAR_3); if (VAR_4 < 0) { return VAR_4; } VAR_5 += VAR_4; VAR_1->offset += TARGET_PAGE_SIZE; VAR_3 += TARGET_PAGE_SIZE; } while (VAR_1->offset & (pagesize - 1)); VAR_1->offset -= TARGET_PAGE_SIZE; return VAR_5; }
[ "static int FUNC_0(RAMState *VAR_0, PageSearchStatus *VAR_1,\nbool VAR_2,\nram_addr_t VAR_3)\n{", "int VAR_4, VAR_5 = 0;", "size_t pagesize = qemu_ram_pagesize(VAR_1->block);", "do {", "VAR_4 = ram_save_target_page(VAR_0, VAR_1, VAR_2, VAR_3);", "if (VAR_4 < 0) {", "return VAR_4;", "}", "VAR_5 += VAR_4;", "VAR_1->offset += TARGET_PAGE_SIZE;", "VAR_3 += TARGET_PAGE_SIZE;", "} while (VAR_1->offset & (pagesize - 1));", "VAR_1->offset -= TARGET_PAGE_SIZE;", "return VAR_5;", "}" ]
[ 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 39 ], [ 41 ], [ 43 ] ]
6,664
static void gen_check_privilege(DisasContext *dc) { if (dc->cring) { gen_exception_cause(dc, PRIVILEGED_CAUSE); dc->is_jmp = DISAS_UPDATE; } }
true
qemu
97e89ee914411384dcda771d38bf89f13726d71e
static void gen_check_privilege(DisasContext *dc) { if (dc->cring) { gen_exception_cause(dc, PRIVILEGED_CAUSE); dc->is_jmp = DISAS_UPDATE; } }
{ "code": [ "static void gen_check_privilege(DisasContext *dc)" ], "line_no": [ 1 ] }
static void FUNC_0(DisasContext *VAR_0) { if (VAR_0->cring) { gen_exception_cause(VAR_0, PRIVILEGED_CAUSE); VAR_0->is_jmp = DISAS_UPDATE; } }
[ "static void FUNC_0(DisasContext *VAR_0)\n{", "if (VAR_0->cring) {", "gen_exception_cause(VAR_0, PRIVILEGED_CAUSE);", "VAR_0->is_jmp = DISAS_UPDATE;", "}", "}" ]
[ 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ] ]
6,665
MigrationState *unix_start_outgoing_migration(Monitor *mon, const char *path, int64_t bandwidth_limit, int detach, int blk, int inc) { FdMigrationState *s; struct sockaddr_un addr; int ret; addr.sun_family = AF_UNIX; snprintf(addr.sun_path, sizeof(addr.sun_path), "%s", path); s = qemu_mallocz(sizeof(*s)); s->get_error = unix_errno; s->write = unix_write; s->close = unix_close; s->mig_state.cancel = migrate_fd_cancel; s->mig_state.get_status = migrate_fd_get_status; s->mig_state.release = migrate_fd_release; s->mig_state.blk = blk; s->mig_state.shared = inc; s->state = MIG_STATE_ACTIVE; s->mon = NULL; s->bandwidth_limit = bandwidth_limit; s->fd = socket(PF_UNIX, SOCK_STREAM, 0); if (s->fd < 0) { dprintf("Unable to open socket"); goto err_after_alloc; } socket_set_nonblock(s->fd); if (!detach) { migrate_fd_monitor_suspend(s, mon); } do { ret = connect(s->fd, (struct sockaddr *)&addr, sizeof(addr)); if (ret == -1) ret = -(s->get_error(s)); if (ret == -EINPROGRESS || ret == -EWOULDBLOCK) qemu_set_fd_handler2(s->fd, NULL, NULL, unix_wait_for_connect, s); } while (ret == -EINTR); if (ret < 0 && ret != -EINPROGRESS && ret != -EWOULDBLOCK) { dprintf("connect failed\n"); goto err_after_open; } else if (ret >= 0) migrate_fd_connect(s); return &s->mig_state; err_after_open: close(s->fd); err_after_alloc: qemu_free(s); return NULL; }
true
qemu
40ff6d7e8dceca227e7f8a3e8e0d58b2c66d19b4
MigrationState *unix_start_outgoing_migration(Monitor *mon, const char *path, int64_t bandwidth_limit, int detach, int blk, int inc) { FdMigrationState *s; struct sockaddr_un addr; int ret; addr.sun_family = AF_UNIX; snprintf(addr.sun_path, sizeof(addr.sun_path), "%s", path); s = qemu_mallocz(sizeof(*s)); s->get_error = unix_errno; s->write = unix_write; s->close = unix_close; s->mig_state.cancel = migrate_fd_cancel; s->mig_state.get_status = migrate_fd_get_status; s->mig_state.release = migrate_fd_release; s->mig_state.blk = blk; s->mig_state.shared = inc; s->state = MIG_STATE_ACTIVE; s->mon = NULL; s->bandwidth_limit = bandwidth_limit; s->fd = socket(PF_UNIX, SOCK_STREAM, 0); if (s->fd < 0) { dprintf("Unable to open socket"); goto err_after_alloc; } socket_set_nonblock(s->fd); if (!detach) { migrate_fd_monitor_suspend(s, mon); } do { ret = connect(s->fd, (struct sockaddr *)&addr, sizeof(addr)); if (ret == -1) ret = -(s->get_error(s)); if (ret == -EINPROGRESS || ret == -EWOULDBLOCK) qemu_set_fd_handler2(s->fd, NULL, NULL, unix_wait_for_connect, s); } while (ret == -EINTR); if (ret < 0 && ret != -EINPROGRESS && ret != -EWOULDBLOCK) { dprintf("connect failed\n"); goto err_after_open; } else if (ret >= 0) migrate_fd_connect(s); return &s->mig_state; err_after_open: close(s->fd); err_after_alloc: qemu_free(s); return NULL; }
{ "code": [ " s->fd = socket(PF_UNIX, SOCK_STREAM, 0);" ], "line_no": [ 59 ] }
MigrationState *FUNC_0(Monitor *mon, const char *path, int64_t bandwidth_limit, int detach, int blk, int inc) { FdMigrationState *s; struct sockaddr_un VAR_0; int VAR_1; VAR_0.sun_family = AF_UNIX; snprintf(VAR_0.sun_path, sizeof(VAR_0.sun_path), "%s", path); s = qemu_mallocz(sizeof(*s)); s->get_error = unix_errno; s->write = unix_write; s->close = unix_close; s->mig_state.cancel = migrate_fd_cancel; s->mig_state.get_status = migrate_fd_get_status; s->mig_state.release = migrate_fd_release; s->mig_state.blk = blk; s->mig_state.shared = inc; s->state = MIG_STATE_ACTIVE; s->mon = NULL; s->bandwidth_limit = bandwidth_limit; s->fd = socket(PF_UNIX, SOCK_STREAM, 0); if (s->fd < 0) { dprintf("Unable to open socket"); goto err_after_alloc; } socket_set_nonblock(s->fd); if (!detach) { migrate_fd_monitor_suspend(s, mon); } do { VAR_1 = connect(s->fd, (struct sockaddr *)&VAR_0, sizeof(VAR_0)); if (VAR_1 == -1) VAR_1 = -(s->get_error(s)); if (VAR_1 == -EINPROGRESS || VAR_1 == -EWOULDBLOCK) qemu_set_fd_handler2(s->fd, NULL, NULL, unix_wait_for_connect, s); } while (VAR_1 == -EINTR); if (VAR_1 < 0 && VAR_1 != -EINPROGRESS && VAR_1 != -EWOULDBLOCK) { dprintf("connect failed\n"); goto err_after_open; } else if (VAR_1 >= 0) migrate_fd_connect(s); return &s->mig_state; err_after_open: close(s->fd); err_after_alloc: qemu_free(s); return NULL; }
[ "MigrationState *FUNC_0(Monitor *mon,\nconst char *path,\nint64_t bandwidth_limit,\nint detach,\nint blk,\nint inc)\n{", "FdMigrationState *s;", "struct sockaddr_un VAR_0;", "int VAR_1;", "VAR_0.sun_family = AF_UNIX;", "snprintf(VAR_0.sun_path, sizeof(VAR_0.sun_path), \"%s\", path);", "s = qemu_mallocz(sizeof(*s));", "s->get_error = unix_errno;", "s->write = unix_write;", "s->close = unix_close;", "s->mig_state.cancel = migrate_fd_cancel;", "s->mig_state.get_status = migrate_fd_get_status;", "s->mig_state.release = migrate_fd_release;", "s->mig_state.blk = blk;", "s->mig_state.shared = inc;", "s->state = MIG_STATE_ACTIVE;", "s->mon = NULL;", "s->bandwidth_limit = bandwidth_limit;", "s->fd = socket(PF_UNIX, SOCK_STREAM, 0);", "if (s->fd < 0) {", "dprintf(\"Unable to open socket\");", "goto err_after_alloc;", "}", "socket_set_nonblock(s->fd);", "if (!detach) {", "migrate_fd_monitor_suspend(s, mon);", "}", "do {", "VAR_1 = connect(s->fd, (struct sockaddr *)&VAR_0, sizeof(VAR_0));", "if (VAR_1 == -1)\nVAR_1 = -(s->get_error(s));", "if (VAR_1 == -EINPROGRESS || VAR_1 == -EWOULDBLOCK)\nqemu_set_fd_handler2(s->fd, NULL, NULL, unix_wait_for_connect, s);", "} while (VAR_1 == -EINTR);", "if (VAR_1 < 0 && VAR_1 != -EINPROGRESS && VAR_1 != -EWOULDBLOCK) {", "dprintf(\"connect failed\\n\");", "goto err_after_open;", "} else if (VAR_1 >= 0)", "migrate_fd_connect(s);", "return &s->mig_state;", "err_after_open:\nclose(s->fd);", "err_after_alloc:\nqemu_free(s);", "return NULL;", "}" ]
[ 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, 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 85 ], [ 87, 89 ], [ 93, 95 ], [ 97 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 113 ], [ 117, 119 ], [ 123, 125 ], [ 127 ], [ 129 ] ]
6,666
static int fdk_aac_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt) { FDKAACDecContext *s = avctx->priv_data; AVFrame *frame = data; int ret; AAC_DECODER_ERROR err; UINT valid = avpkt->size; err = aacDecoder_Fill(s->handle, &avpkt->data, &avpkt->size, &valid); if (err != AAC_DEC_OK) { av_log(avctx, AV_LOG_ERROR, "aacDecoder_Fill() failed: %x\n", err); return AVERROR_INVALIDDATA; } err = aacDecoder_DecodeFrame(s->handle, (INT_PCM *) s->decoder_buffer, s->decoder_buffer_size, 0); if (err == AAC_DEC_NOT_ENOUGH_BITS) { ret = avpkt->size - valid; goto end; } if (err != AAC_DEC_OK) { av_log(avctx, AV_LOG_ERROR, "aacDecoder_DecodeFrame() failed: %x\n", err); ret = AVERROR_UNKNOWN; goto end; } if ((ret = get_stream_info(avctx)) < 0) goto end; frame->nb_samples = avctx->frame_size; if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) goto end; memcpy(frame->extended_data[0], s->decoder_buffer, avctx->channels * avctx->frame_size * av_get_bytes_per_sample(avctx->sample_fmt)); *got_frame_ptr = 1; ret = avpkt->size - valid; end: return ret; }
true
FFmpeg
ca6776a993903dbcfef5ae8a18556c40ecf83e1c
static int fdk_aac_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt) { FDKAACDecContext *s = avctx->priv_data; AVFrame *frame = data; int ret; AAC_DECODER_ERROR err; UINT valid = avpkt->size; err = aacDecoder_Fill(s->handle, &avpkt->data, &avpkt->size, &valid); if (err != AAC_DEC_OK) { av_log(avctx, AV_LOG_ERROR, "aacDecoder_Fill() failed: %x\n", err); return AVERROR_INVALIDDATA; } err = aacDecoder_DecodeFrame(s->handle, (INT_PCM *) s->decoder_buffer, s->decoder_buffer_size, 0); if (err == AAC_DEC_NOT_ENOUGH_BITS) { ret = avpkt->size - valid; goto end; } if (err != AAC_DEC_OK) { av_log(avctx, AV_LOG_ERROR, "aacDecoder_DecodeFrame() failed: %x\n", err); ret = AVERROR_UNKNOWN; goto end; } if ((ret = get_stream_info(avctx)) < 0) goto end; frame->nb_samples = avctx->frame_size; if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) goto end; memcpy(frame->extended_data[0], s->decoder_buffer, avctx->channels * avctx->frame_size * av_get_bytes_per_sample(avctx->sample_fmt)); *got_frame_ptr = 1; ret = avpkt->size - valid; end: return ret; }
{ "code": [ " err = aacDecoder_DecodeFrame(s->handle, (INT_PCM *) s->decoder_buffer, s->decoder_buffer_size, 0);" ], "line_no": [ 31 ] }
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3) { FDKAACDecContext *s = VAR_0->priv_data; AVFrame *frame = VAR_1; int VAR_4; AAC_DECODER_ERROR err; UINT valid = VAR_3->size; err = aacDecoder_Fill(s->handle, &VAR_3->VAR_1, &VAR_3->size, &valid); if (err != AAC_DEC_OK) { av_log(VAR_0, AV_LOG_ERROR, "aacDecoder_Fill() failed: %x\n", err); return AVERROR_INVALIDDATA; } err = aacDecoder_DecodeFrame(s->handle, (INT_PCM *) s->decoder_buffer, s->decoder_buffer_size, 0); if (err == AAC_DEC_NOT_ENOUGH_BITS) { VAR_4 = VAR_3->size - valid; goto end; } if (err != AAC_DEC_OK) { av_log(VAR_0, AV_LOG_ERROR, "aacDecoder_DecodeFrame() failed: %x\n", err); VAR_4 = AVERROR_UNKNOWN; goto end; } if ((VAR_4 = get_stream_info(VAR_0)) < 0) goto end; frame->nb_samples = VAR_0->frame_size; if ((VAR_4 = ff_get_buffer(VAR_0, frame, 0)) < 0) goto end; memcpy(frame->extended_data[0], s->decoder_buffer, VAR_0->channels * VAR_0->frame_size * av_get_bytes_per_sample(VAR_0->sample_fmt)); *VAR_2 = 1; VAR_4 = VAR_3->size - valid; end: return VAR_4; }
[ "static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1,\nint *VAR_2, AVPacket *VAR_3)\n{", "FDKAACDecContext *s = VAR_0->priv_data;", "AVFrame *frame = VAR_1;", "int VAR_4;", "AAC_DECODER_ERROR err;", "UINT valid = VAR_3->size;", "err = aacDecoder_Fill(s->handle, &VAR_3->VAR_1, &VAR_3->size, &valid);", "if (err != AAC_DEC_OK) {", "av_log(VAR_0, AV_LOG_ERROR, \"aacDecoder_Fill() failed: %x\\n\", err);", "return AVERROR_INVALIDDATA;", "}", "err = aacDecoder_DecodeFrame(s->handle, (INT_PCM *) s->decoder_buffer, s->decoder_buffer_size, 0);", "if (err == AAC_DEC_NOT_ENOUGH_BITS) {", "VAR_4 = VAR_3->size - valid;", "goto end;", "}", "if (err != AAC_DEC_OK) {", "av_log(VAR_0, AV_LOG_ERROR,\n\"aacDecoder_DecodeFrame() failed: %x\\n\", err);", "VAR_4 = AVERROR_UNKNOWN;", "goto end;", "}", "if ((VAR_4 = get_stream_info(VAR_0)) < 0)\ngoto end;", "frame->nb_samples = VAR_0->frame_size;", "if ((VAR_4 = ff_get_buffer(VAR_0, frame, 0)) < 0)\ngoto end;", "memcpy(frame->extended_data[0], s->decoder_buffer,\nVAR_0->channels * VAR_0->frame_size *\nav_get_bytes_per_sample(VAR_0->sample_fmt));", "*VAR_2 = 1;", "VAR_4 = VAR_3->size - valid;", "end:\nreturn VAR_4;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55, 57 ], [ 59 ], [ 63, 65 ], [ 69, 71, 73 ], [ 77 ], [ 79 ], [ 83, 85 ], [ 87 ] ]
6,667
static void readline_completion(ReadLineState *rs) { Monitor *mon = cur_mon; int len, i, j, max_width, nb_cols, max_prefix; char *cmdline; rs->nb_completions = 0; cmdline = g_malloc(rs->cmd_buf_index + 1); memcpy(cmdline, rs->cmd_buf, rs->cmd_buf_index); cmdline[rs->cmd_buf_index] = '\0'; rs->completion_finder(cmdline); g_free(cmdline); /* no completion found */ if (rs->nb_completions <= 0) return; if (rs->nb_completions == 1) { len = strlen(rs->completions[0]); for(i = rs->completion_index; i < len; i++) { readline_insert_char(rs, rs->completions[0][i]); /* extra space for next argument. XXX: make it more generic */ if (len > 0 && rs->completions[0][len - 1] != '/') readline_insert_char(rs, ' '); } else { monitor_printf(mon, "\n"); max_width = 0; max_prefix = 0; for(i = 0; i < rs->nb_completions; i++) { len = strlen(rs->completions[i]); if (i==0) { max_prefix = len; } else { if (len < max_prefix) max_prefix = len; for(j=0; j<max_prefix; j++) { if (rs->completions[i][j] != rs->completions[0][j]) max_prefix = j; if (len > max_width) max_width = len; if (max_prefix > 0) for(i = rs->completion_index; i < max_prefix; i++) { readline_insert_char(rs, rs->completions[0][i]); max_width += 2; if (max_width < 10) max_width = 10; else if (max_width > 80) max_width = 80; nb_cols = 80 / max_width; j = 0; for(i = 0; i < rs->nb_completions; i++) { monitor_printf(rs->mon, "%-*s", max_width, rs->completions[i]); if (++j == nb_cols || i == (rs->nb_completions - 1)) { monitor_printf(rs->mon, "\n"); j = 0; readline_show_prompt(rs);
true
qemu
fc9fa4bd0a295ac18808c4cd2cfac484bc4649d3
static void readline_completion(ReadLineState *rs) { Monitor *mon = cur_mon; int len, i, j, max_width, nb_cols, max_prefix; char *cmdline; rs->nb_completions = 0; cmdline = g_malloc(rs->cmd_buf_index + 1); memcpy(cmdline, rs->cmd_buf, rs->cmd_buf_index); cmdline[rs->cmd_buf_index] = '\0'; rs->completion_finder(cmdline); g_free(cmdline); if (rs->nb_completions <= 0) return; if (rs->nb_completions == 1) { len = strlen(rs->completions[0]); for(i = rs->completion_index; i < len; i++) { readline_insert_char(rs, rs->completions[0][i]); if (len > 0 && rs->completions[0][len - 1] != '/') readline_insert_char(rs, ' '); } else { monitor_printf(mon, "\n"); max_width = 0; max_prefix = 0; for(i = 0; i < rs->nb_completions; i++) { len = strlen(rs->completions[i]); if (i==0) { max_prefix = len; } else { if (len < max_prefix) max_prefix = len; for(j=0; j<max_prefix; j++) { if (rs->completions[i][j] != rs->completions[0][j]) max_prefix = j; if (len > max_width) max_width = len; if (max_prefix > 0) for(i = rs->completion_index; i < max_prefix; i++) { readline_insert_char(rs, rs->completions[0][i]); max_width += 2; if (max_width < 10) max_width = 10; else if (max_width > 80) max_width = 80; nb_cols = 80 / max_width; j = 0; for(i = 0; i < rs->nb_completions; i++) { monitor_printf(rs->mon, "%-*s", max_width, rs->completions[i]); if (++j == nb_cols || i == (rs->nb_completions - 1)) { monitor_printf(rs->mon, "\n"); j = 0; readline_show_prompt(rs);
{ "code": [], "line_no": [] }
static void FUNC_0(ReadLineState *VAR_0) { Monitor *mon = cur_mon; int VAR_1, VAR_2, VAR_3, VAR_4, VAR_5, VAR_6; char *VAR_7; VAR_0->nb_completions = 0; VAR_7 = g_malloc(VAR_0->cmd_buf_index + 1); memcpy(VAR_7, VAR_0->cmd_buf, VAR_0->cmd_buf_index); VAR_7[VAR_0->cmd_buf_index] = '\0'; VAR_0->completion_finder(VAR_7); g_free(VAR_7); if (VAR_0->nb_completions <= 0) return; if (VAR_0->nb_completions == 1) { VAR_1 = strlen(VAR_0->completions[0]); for(VAR_2 = VAR_0->completion_index; VAR_2 < VAR_1; VAR_2++) { readline_insert_char(VAR_0, VAR_0->completions[0][VAR_2]); if (VAR_1 > 0 && VAR_0->completions[0][VAR_1 - 1] != '/') readline_insert_char(VAR_0, ' '); } else { monitor_printf(mon, "\n"); VAR_4 = 0; VAR_6 = 0; for(VAR_2 = 0; VAR_2 < VAR_0->nb_completions; VAR_2++) { VAR_1 = strlen(VAR_0->completions[VAR_2]); if (VAR_2==0) { VAR_6 = VAR_1; } else { if (VAR_1 < VAR_6) VAR_6 = VAR_1; for(VAR_3=0; VAR_3<VAR_6; VAR_3++) { if (VAR_0->completions[VAR_2][VAR_3] != VAR_0->completions[0][VAR_3]) VAR_6 = VAR_3; if (VAR_1 > VAR_4) VAR_4 = VAR_1; if (VAR_6 > 0) for(VAR_2 = VAR_0->completion_index; VAR_2 < VAR_6; VAR_2++) { readline_insert_char(VAR_0, VAR_0->completions[0][VAR_2]); VAR_4 += 2; if (VAR_4 < 10) VAR_4 = 10; else if (VAR_4 > 80) VAR_4 = 80; VAR_5 = 80 / VAR_4; VAR_3 = 0; for(VAR_2 = 0; VAR_2 < VAR_0->nb_completions; VAR_2++) { monitor_printf(VAR_0->mon, "%-*s", VAR_4, VAR_0->completions[VAR_2]); if (++VAR_3 == VAR_5 || VAR_2 == (VAR_0->nb_completions - 1)) { monitor_printf(VAR_0->mon, "\n"); VAR_3 = 0; readline_show_prompt(VAR_0);
[ "static void FUNC_0(ReadLineState *VAR_0)\n{", "Monitor *mon = cur_mon;", "int VAR_1, VAR_2, VAR_3, VAR_4, VAR_5, VAR_6;", "char *VAR_7;", "VAR_0->nb_completions = 0;", "VAR_7 = g_malloc(VAR_0->cmd_buf_index + 1);", "memcpy(VAR_7, VAR_0->cmd_buf, VAR_0->cmd_buf_index);", "VAR_7[VAR_0->cmd_buf_index] = '\\0';", "VAR_0->completion_finder(VAR_7);", "g_free(VAR_7);", "if (VAR_0->nb_completions <= 0)\nreturn;", "if (VAR_0->nb_completions == 1) {", "VAR_1 = strlen(VAR_0->completions[0]);", "for(VAR_2 = VAR_0->completion_index; VAR_2 < VAR_1; VAR_2++) {", "readline_insert_char(VAR_0, VAR_0->completions[0][VAR_2]);", "if (VAR_1 > 0 && VAR_0->completions[0][VAR_1 - 1] != '/')\nreadline_insert_char(VAR_0, ' ');", "} else {", "monitor_printf(mon, \"\\n\");", "VAR_4 = 0;", "VAR_6 = 0;", "for(VAR_2 = 0; VAR_2 < VAR_0->nb_completions; VAR_2++) {", "VAR_1 = strlen(VAR_0->completions[VAR_2]);", "if (VAR_2==0) {", "VAR_6 = VAR_1;", "} else {", "if (VAR_1 < VAR_6)\nVAR_6 = VAR_1;", "for(VAR_3=0; VAR_3<VAR_6; VAR_3++) {", "if (VAR_0->completions[VAR_2][VAR_3] != VAR_0->completions[0][VAR_3])\nVAR_6 = VAR_3;", "if (VAR_1 > VAR_4)\nVAR_4 = VAR_1;", "if (VAR_6 > 0)\nfor(VAR_2 = VAR_0->completion_index; VAR_2 < VAR_6; VAR_2++) {", "readline_insert_char(VAR_0, VAR_0->completions[0][VAR_2]);", "VAR_4 += 2;", "if (VAR_4 < 10)\nVAR_4 = 10;", "else if (VAR_4 > 80)\nVAR_4 = 80;", "VAR_5 = 80 / VAR_4;", "VAR_3 = 0;", "for(VAR_2 = 0; VAR_2 < VAR_0->nb_completions; VAR_2++) {", "monitor_printf(VAR_0->mon, \"%-*s\", VAR_4, VAR_0->completions[VAR_2]);", "if (++VAR_3 == VAR_5 || VAR_2 == (VAR_0->nb_completions - 1)) {", "monitor_printf(VAR_0->mon, \"\\n\");", "VAR_3 = 0;", "readline_show_prompt(VAR_0);" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 46, 48 ], [ 50 ], [ 52 ], [ 54 ], [ 56 ], [ 58 ], [ 60 ], [ 62 ], [ 64 ], [ 66 ], [ 68, 70 ], [ 72 ], [ 74, 76 ], [ 80, 82 ], [ 85, 87 ], [ 89 ], [ 92 ], [ 94, 96 ], [ 98, 100 ], [ 102 ], [ 104 ], [ 106 ], [ 108 ], [ 110 ], [ 112 ], [ 114 ], [ 118 ] ]
6,668
static av_cold int png_dec_init(AVCodecContext *avctx) { PNGDecContext *s = avctx->priv_data; s->avctx = avctx; s->previous_picture.f = av_frame_alloc(); s->last_picture.f = av_frame_alloc(); s->picture.f = av_frame_alloc(); if (!s->previous_picture.f || !s->last_picture.f || !s->picture.f) return AVERROR(ENOMEM); if (!avctx->internal->is_copy) { avctx->internal->allocate_progress = 1; ff_pngdsp_init(&s->dsp); } return 0; }
true
FFmpeg
6e9b060e4f0c24d2689bebd7fc03e52d75da25b2
static av_cold int png_dec_init(AVCodecContext *avctx) { PNGDecContext *s = avctx->priv_data; s->avctx = avctx; s->previous_picture.f = av_frame_alloc(); s->last_picture.f = av_frame_alloc(); s->picture.f = av_frame_alloc(); if (!s->previous_picture.f || !s->last_picture.f || !s->picture.f) return AVERROR(ENOMEM); if (!avctx->internal->is_copy) { avctx->internal->allocate_progress = 1; ff_pngdsp_init(&s->dsp); } return 0; }
{ "code": [ " if (!s->previous_picture.f || !s->last_picture.f || !s->picture.f)" ], "line_no": [ 17 ] }
static av_cold int FUNC_0(AVCodecContext *avctx) { PNGDecContext *s = avctx->priv_data; s->avctx = avctx; s->previous_picture.f = av_frame_alloc(); s->last_picture.f = av_frame_alloc(); s->picture.f = av_frame_alloc(); if (!s->previous_picture.f || !s->last_picture.f || !s->picture.f) return AVERROR(ENOMEM); if (!avctx->internal->is_copy) { avctx->internal->allocate_progress = 1; ff_pngdsp_init(&s->dsp); } return 0; }
[ "static av_cold int FUNC_0(AVCodecContext *avctx)\n{", "PNGDecContext *s = avctx->priv_data;", "s->avctx = avctx;", "s->previous_picture.f = av_frame_alloc();", "s->last_picture.f = av_frame_alloc();", "s->picture.f = av_frame_alloc();", "if (!s->previous_picture.f || !s->last_picture.f || !s->picture.f)\nreturn AVERROR(ENOMEM);", "if (!avctx->internal->is_copy) {", "avctx->internal->allocate_progress = 1;", "ff_pngdsp_init(&s->dsp);", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17, 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ] ]
6,669
static int tiff_unpack_fax(TiffContext *s, uint8_t *dst, int stride, const uint8_t *src, int size, int width, int lines) { int i, ret = 0; int line; uint8_t *src2 = av_malloc((unsigned)size + AV_INPUT_BUFFER_PADDING_SIZE); if (!src2) { av_log(s->avctx, AV_LOG_ERROR, "Error allocating temporary buffer\n"); return AVERROR(ENOMEM); } if (!s->fill_order) { memcpy(src2, src, size); } else { for (i = 0; i < size; i++) src2[i] = ff_reverse[src[i]]; } memset(src2 + size, 0, AV_INPUT_BUFFER_PADDING_SIZE); ret = ff_ccitt_unpack(s->avctx, src2, size, dst, lines, stride, s->compr, s->fax_opts); if (s->bpp < 8 && s->avctx->pix_fmt == AV_PIX_FMT_PAL8) for (line = 0; line < lines; line++) { horizontal_fill(s->bpp, dst, 1, dst, 0, width, 0); dst += stride; } av_free(src2); return ret; }
true
FFmpeg
9221445fa001093307864a53f91c1172c239de18
static int tiff_unpack_fax(TiffContext *s, uint8_t *dst, int stride, const uint8_t *src, int size, int width, int lines) { int i, ret = 0; int line; uint8_t *src2 = av_malloc((unsigned)size + AV_INPUT_BUFFER_PADDING_SIZE); if (!src2) { av_log(s->avctx, AV_LOG_ERROR, "Error allocating temporary buffer\n"); return AVERROR(ENOMEM); } if (!s->fill_order) { memcpy(src2, src, size); } else { for (i = 0; i < size; i++) src2[i] = ff_reverse[src[i]]; } memset(src2 + size, 0, AV_INPUT_BUFFER_PADDING_SIZE); ret = ff_ccitt_unpack(s->avctx, src2, size, dst, lines, stride, s->compr, s->fax_opts); if (s->bpp < 8 && s->avctx->pix_fmt == AV_PIX_FMT_PAL8) for (line = 0; line < lines; line++) { horizontal_fill(s->bpp, dst, 1, dst, 0, width, 0); dst += stride; } av_free(src2); return ret; }
{ "code": [ " uint8_t *src2 = av_malloc((unsigned)size +", " AV_INPUT_BUFFER_PADDING_SIZE);", " av_free(src2);" ], "line_no": [ 11, 13, 57 ] }
static int FUNC_0(TiffContext *VAR_0, uint8_t *VAR_1, int VAR_2, const uint8_t *VAR_3, int VAR_4, int VAR_5, int VAR_6) { int VAR_7, VAR_8 = 0; int VAR_9; uint8_t *src2 = av_malloc((unsigned)VAR_4 + AV_INPUT_BUFFER_PADDING_SIZE); if (!src2) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Error allocating temporary buffer\n"); return AVERROR(ENOMEM); } if (!VAR_0->fill_order) { memcpy(src2, VAR_3, VAR_4); } else { for (VAR_7 = 0; VAR_7 < VAR_4; VAR_7++) src2[VAR_7] = ff_reverse[VAR_3[VAR_7]]; } memset(src2 + VAR_4, 0, AV_INPUT_BUFFER_PADDING_SIZE); VAR_8 = ff_ccitt_unpack(VAR_0->avctx, src2, VAR_4, VAR_1, VAR_6, VAR_2, VAR_0->compr, VAR_0->fax_opts); if (VAR_0->bpp < 8 && VAR_0->avctx->pix_fmt == AV_PIX_FMT_PAL8) for (VAR_9 = 0; VAR_9 < VAR_6; VAR_9++) { horizontal_fill(VAR_0->bpp, VAR_1, 1, VAR_1, 0, VAR_5, 0); VAR_1 += VAR_2; } av_free(src2); return VAR_8; }
[ "static int FUNC_0(TiffContext *VAR_0, uint8_t *VAR_1, int VAR_2,\nconst uint8_t *VAR_3, int VAR_4, int VAR_5, int VAR_6)\n{", "int VAR_7, VAR_8 = 0;", "int VAR_9;", "uint8_t *src2 = av_malloc((unsigned)VAR_4 +\nAV_INPUT_BUFFER_PADDING_SIZE);", "if (!src2) {", "av_log(VAR_0->avctx, AV_LOG_ERROR,\n\"Error allocating temporary buffer\\n\");", "return AVERROR(ENOMEM);", "}", "if (!VAR_0->fill_order) {", "memcpy(src2, VAR_3, VAR_4);", "} else {", "for (VAR_7 = 0; VAR_7 < VAR_4; VAR_7++)", "src2[VAR_7] = ff_reverse[VAR_3[VAR_7]];", "}", "memset(src2 + VAR_4, 0, AV_INPUT_BUFFER_PADDING_SIZE);", "VAR_8 = ff_ccitt_unpack(VAR_0->avctx, src2, VAR_4, VAR_1, VAR_6, VAR_2,\nVAR_0->compr, VAR_0->fax_opts);", "if (VAR_0->bpp < 8 && VAR_0->avctx->pix_fmt == AV_PIX_FMT_PAL8)\nfor (VAR_9 = 0; VAR_9 < VAR_6; VAR_9++) {", "horizontal_fill(VAR_0->bpp, VAR_1, 1, VAR_1, 0, VAR_5, 0);", "VAR_1 += VAR_2;", "}", "av_free(src2);", "return VAR_8;", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11, 13 ], [ 17 ], [ 19, 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 47, 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ] ]
6,671
int tlb_set_page_exec(CPUState *env, target_ulong vaddr, target_phys_addr_t paddr, int prot, int is_user, int is_softmmu) { PhysPageDesc *p; unsigned long pd; unsigned int index; target_ulong address; target_phys_addr_t addend; int ret; CPUTLBEntry *te; p = phys_page_find(paddr >> TARGET_PAGE_BITS); if (!p) { pd = IO_MEM_UNASSIGNED; } else { pd = p->phys_offset; } #if defined(DEBUG_TLB) printf("tlb_set_page: vaddr=" TARGET_FMT_lx " paddr=0x%08x prot=%x u=%d smmu=%d pd=0x%08lx\n", vaddr, (int)paddr, prot, is_user, is_softmmu, pd); #endif ret = 0; #if !defined(CONFIG_SOFTMMU) if (is_softmmu) #endif { if ((pd & ~TARGET_PAGE_MASK) > IO_MEM_ROM && !(pd & IO_MEM_ROMD)) { /* IO memory case */ address = vaddr | pd; addend = paddr; } else { /* standard memory */ address = vaddr; addend = (unsigned long)phys_ram_base + (pd & TARGET_PAGE_MASK); } /* Make accesses to pages with watchpoints go via the watchpoint trap routines. */ for (i = 0; i < env->nb_watchpoints; i++) { if (vaddr == (env->watchpoint[i].vaddr & TARGET_PAGE_MASK)) { if (address & ~TARGET_PAGE_MASK) { env->watchpoint[i].is_ram = 0; address = vaddr | io_mem_watch; } else { env->watchpoint[i].is_ram = 1; /* TODO: Figure out how to make read watchpoints coexist with code. */ pd = (pd & TARGET_PAGE_MASK) | io_mem_watch | IO_MEM_ROMD; } } } index = (vaddr >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1); addend -= vaddr; te = &env->tlb_table[is_user][index]; te->addend = addend; if (prot & PAGE_READ) { te->addr_read = address; } else { te->addr_read = -1; } if (prot & PAGE_EXEC) { te->addr_code = address; } else { te->addr_code = -1; } if (prot & PAGE_WRITE) { if ((pd & ~TARGET_PAGE_MASK) == IO_MEM_ROM || (pd & IO_MEM_ROMD)) { /* write access calls the I/O callback */ te->addr_write = vaddr | (pd & ~(TARGET_PAGE_MASK | IO_MEM_ROMD)); } else if ((pd & ~TARGET_PAGE_MASK) == IO_MEM_RAM && !cpu_physical_memory_is_dirty(pd)) { te->addr_write = vaddr | IO_MEM_NOTDIRTY; } else { te->addr_write = address; } } else { te->addr_write = -1; } } #if !defined(CONFIG_SOFTMMU) else { if ((pd & ~TARGET_PAGE_MASK) > IO_MEM_ROM) { /* IO access: no mapping is done as it will be handled by the soft MMU */ if (!(env->hflags & HF_SOFTMMU_MASK)) ret = 2; } else { void *map_addr; if (vaddr >= MMAP_AREA_END) { ret = 2; } else { if (prot & PROT_WRITE) { if ((pd & ~TARGET_PAGE_MASK) == IO_MEM_ROM || #if defined(TARGET_HAS_SMC) || 1 first_tb || #endif ((pd & ~TARGET_PAGE_MASK) == IO_MEM_RAM && !cpu_physical_memory_is_dirty(pd))) { /* ROM: we do as if code was inside */ /* if code is present, we only map as read only and save the original mapping */ VirtPageDesc *vp; vp = virt_page_find_alloc(vaddr >> TARGET_PAGE_BITS, 1); vp->phys_addr = pd; vp->prot = prot; vp->valid_tag = virt_valid_tag; prot &= ~PAGE_WRITE; } } map_addr = mmap((void *)vaddr, TARGET_PAGE_SIZE, prot, MAP_SHARED | MAP_FIXED, phys_ram_fd, (pd & TARGET_PAGE_MASK)); if (map_addr == MAP_FAILED) { cpu_abort(env, "mmap failed when mapped physical address 0x%08x to virtual address 0x%08x\n", paddr, vaddr); } } } } #endif return ret; }
true
qemu
6658ffb81ee56a510d7d77025872a508a9adce3a
int tlb_set_page_exec(CPUState *env, target_ulong vaddr, target_phys_addr_t paddr, int prot, int is_user, int is_softmmu) { PhysPageDesc *p; unsigned long pd; unsigned int index; target_ulong address; target_phys_addr_t addend; int ret; CPUTLBEntry *te; p = phys_page_find(paddr >> TARGET_PAGE_BITS); if (!p) { pd = IO_MEM_UNASSIGNED; } else { pd = p->phys_offset; } #if defined(DEBUG_TLB) printf("tlb_set_page: vaddr=" TARGET_FMT_lx " paddr=0x%08x prot=%x u=%d smmu=%d pd=0x%08lx\n", vaddr, (int)paddr, prot, is_user, is_softmmu, pd); #endif ret = 0; #if !defined(CONFIG_SOFTMMU) if (is_softmmu) #endif { if ((pd & ~TARGET_PAGE_MASK) > IO_MEM_ROM && !(pd & IO_MEM_ROMD)) { address = vaddr | pd; addend = paddr; } else { address = vaddr; addend = (unsigned long)phys_ram_base + (pd & TARGET_PAGE_MASK); } for (i = 0; i < env->nb_watchpoints; i++) { if (vaddr == (env->watchpoint[i].vaddr & TARGET_PAGE_MASK)) { if (address & ~TARGET_PAGE_MASK) { env->watchpoint[i].is_ram = 0; address = vaddr | io_mem_watch; } else { env->watchpoint[i].is_ram = 1; pd = (pd & TARGET_PAGE_MASK) | io_mem_watch | IO_MEM_ROMD; } } } index = (vaddr >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1); addend -= vaddr; te = &env->tlb_table[is_user][index]; te->addend = addend; if (prot & PAGE_READ) { te->addr_read = address; } else { te->addr_read = -1; } if (prot & PAGE_EXEC) { te->addr_code = address; } else { te->addr_code = -1; } if (prot & PAGE_WRITE) { if ((pd & ~TARGET_PAGE_MASK) == IO_MEM_ROM || (pd & IO_MEM_ROMD)) { te->addr_write = vaddr | (pd & ~(TARGET_PAGE_MASK | IO_MEM_ROMD)); } else if ((pd & ~TARGET_PAGE_MASK) == IO_MEM_RAM && !cpu_physical_memory_is_dirty(pd)) { te->addr_write = vaddr | IO_MEM_NOTDIRTY; } else { te->addr_write = address; } } else { te->addr_write = -1; } } #if !defined(CONFIG_SOFTMMU) else { if ((pd & ~TARGET_PAGE_MASK) > IO_MEM_ROM) { if (!(env->hflags & HF_SOFTMMU_MASK)) ret = 2; } else { void *map_addr; if (vaddr >= MMAP_AREA_END) { ret = 2; } else { if (prot & PROT_WRITE) { if ((pd & ~TARGET_PAGE_MASK) == IO_MEM_ROM || #if defined(TARGET_HAS_SMC) || 1 first_tb || #endif ((pd & ~TARGET_PAGE_MASK) == IO_MEM_RAM && !cpu_physical_memory_is_dirty(pd))) { VirtPageDesc *vp; vp = virt_page_find_alloc(vaddr >> TARGET_PAGE_BITS, 1); vp->phys_addr = pd; vp->prot = prot; vp->valid_tag = virt_valid_tag; prot &= ~PAGE_WRITE; } } map_addr = mmap((void *)vaddr, TARGET_PAGE_SIZE, prot, MAP_SHARED | MAP_FIXED, phys_ram_fd, (pd & TARGET_PAGE_MASK)); if (map_addr == MAP_FAILED) { cpu_abort(env, "mmap failed when mapped physical address 0x%08x to virtual address 0x%08x\n", paddr, vaddr); } } } } #endif return ret; }
{ "code": [], "line_no": [] }
int FUNC_0(CPUState *VAR_0, target_ulong VAR_1, target_phys_addr_t VAR_2, int VAR_3, int VAR_4, int VAR_5) { PhysPageDesc *p; unsigned long VAR_6; unsigned int VAR_7; target_ulong address; target_phys_addr_t addend; int VAR_8; CPUTLBEntry *te; p = phys_page_find(VAR_2 >> TARGET_PAGE_BITS); if (!p) { VAR_6 = IO_MEM_UNASSIGNED; } else { VAR_6 = p->phys_offset; } #if defined(DEBUG_TLB) printf("tlb_set_page: VAR_1=" TARGET_FMT_lx " VAR_2=0x%08x VAR_3=%x u=%d smmu=%d VAR_6=0x%08lx\n", VAR_1, (int)VAR_2, VAR_3, VAR_4, VAR_5, VAR_6); #endif VAR_8 = 0; #if !defined(CONFIG_SOFTMMU) if (VAR_5) #endif { if ((VAR_6 & ~TARGET_PAGE_MASK) > IO_MEM_ROM && !(VAR_6 & IO_MEM_ROMD)) { address = VAR_1 | VAR_6; addend = VAR_2; } else { address = VAR_1; addend = (unsigned long)phys_ram_base + (VAR_6 & TARGET_PAGE_MASK); } for (i = 0; i < VAR_0->nb_watchpoints; i++) { if (VAR_1 == (VAR_0->watchpoint[i].VAR_1 & TARGET_PAGE_MASK)) { if (address & ~TARGET_PAGE_MASK) { VAR_0->watchpoint[i].is_ram = 0; address = VAR_1 | io_mem_watch; } else { VAR_0->watchpoint[i].is_ram = 1; VAR_6 = (VAR_6 & TARGET_PAGE_MASK) | io_mem_watch | IO_MEM_ROMD; } } } VAR_7 = (VAR_1 >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1); addend -= VAR_1; te = &VAR_0->tlb_table[VAR_4][VAR_7]; te->addend = addend; if (VAR_3 & PAGE_READ) { te->addr_read = address; } else { te->addr_read = -1; } if (VAR_3 & PAGE_EXEC) { te->addr_code = address; } else { te->addr_code = -1; } if (VAR_3 & PAGE_WRITE) { if ((VAR_6 & ~TARGET_PAGE_MASK) == IO_MEM_ROM || (VAR_6 & IO_MEM_ROMD)) { te->addr_write = VAR_1 | (VAR_6 & ~(TARGET_PAGE_MASK | IO_MEM_ROMD)); } else if ((VAR_6 & ~TARGET_PAGE_MASK) == IO_MEM_RAM && !cpu_physical_memory_is_dirty(VAR_6)) { te->addr_write = VAR_1 | IO_MEM_NOTDIRTY; } else { te->addr_write = address; } } else { te->addr_write = -1; } } #if !defined(CONFIG_SOFTMMU) else { if ((VAR_6 & ~TARGET_PAGE_MASK) > IO_MEM_ROM) { if (!(VAR_0->hflags & HF_SOFTMMU_MASK)) VAR_8 = 2; } else { void *VAR_9; if (VAR_1 >= MMAP_AREA_END) { VAR_8 = 2; } else { if (VAR_3 & PROT_WRITE) { if ((VAR_6 & ~TARGET_PAGE_MASK) == IO_MEM_ROM || #if defined(TARGET_HAS_SMC) || 1 first_tb || #endif ((VAR_6 & ~TARGET_PAGE_MASK) == IO_MEM_RAM && !cpu_physical_memory_is_dirty(VAR_6))) { VirtPageDesc *vp; vp = virt_page_find_alloc(VAR_1 >> TARGET_PAGE_BITS, 1); vp->phys_addr = VAR_6; vp->VAR_3 = VAR_3; vp->valid_tag = virt_valid_tag; VAR_3 &= ~PAGE_WRITE; } } VAR_9 = mmap((void *)VAR_1, TARGET_PAGE_SIZE, VAR_3, MAP_SHARED | MAP_FIXED, phys_ram_fd, (VAR_6 & TARGET_PAGE_MASK)); if (VAR_9 == MAP_FAILED) { cpu_abort(VAR_0, "mmap failed when mapped physical address 0x%08x to virtual address 0x%08x\n", VAR_2, VAR_1); } } } } #endif return VAR_8; }
[ "int FUNC_0(CPUState *VAR_0, target_ulong VAR_1,\ntarget_phys_addr_t VAR_2, int VAR_3,\nint VAR_4, int VAR_5)\n{", "PhysPageDesc *p;", "unsigned long VAR_6;", "unsigned int VAR_7;", "target_ulong address;", "target_phys_addr_t addend;", "int VAR_8;", "CPUTLBEntry *te;", "p = phys_page_find(VAR_2 >> TARGET_PAGE_BITS);", "if (!p) {", "VAR_6 = IO_MEM_UNASSIGNED;", "} else {", "VAR_6 = p->phys_offset;", "}", "#if defined(DEBUG_TLB)\nprintf(\"tlb_set_page: VAR_1=\" TARGET_FMT_lx \" VAR_2=0x%08x VAR_3=%x u=%d smmu=%d VAR_6=0x%08lx\\n\",\nVAR_1, (int)VAR_2, VAR_3, VAR_4, VAR_5, VAR_6);", "#endif\nVAR_8 = 0;", "#if !defined(CONFIG_SOFTMMU)\nif (VAR_5)\n#endif\n{", "if ((VAR_6 & ~TARGET_PAGE_MASK) > IO_MEM_ROM && !(VAR_6 & IO_MEM_ROMD)) {", "address = VAR_1 | VAR_6;", "addend = VAR_2;", "} else {", "address = VAR_1;", "addend = (unsigned long)phys_ram_base + (VAR_6 & TARGET_PAGE_MASK);", "}", "for (i = 0; i < VAR_0->nb_watchpoints; i++) {", "if (VAR_1 == (VAR_0->watchpoint[i].VAR_1 & TARGET_PAGE_MASK)) {", "if (address & ~TARGET_PAGE_MASK) {", "VAR_0->watchpoint[i].is_ram = 0;", "address = VAR_1 | io_mem_watch;", "} else {", "VAR_0->watchpoint[i].is_ram = 1;", "VAR_6 = (VAR_6 & TARGET_PAGE_MASK) | io_mem_watch | IO_MEM_ROMD;", "}", "}", "}", "VAR_7 = (VAR_1 >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1);", "addend -= VAR_1;", "te = &VAR_0->tlb_table[VAR_4][VAR_7];", "te->addend = addend;", "if (VAR_3 & PAGE_READ) {", "te->addr_read = address;", "} else {", "te->addr_read = -1;", "}", "if (VAR_3 & PAGE_EXEC) {", "te->addr_code = address;", "} else {", "te->addr_code = -1;", "}", "if (VAR_3 & PAGE_WRITE) {", "if ((VAR_6 & ~TARGET_PAGE_MASK) == IO_MEM_ROM ||\n(VAR_6 & IO_MEM_ROMD)) {", "te->addr_write = VAR_1 |\n(VAR_6 & ~(TARGET_PAGE_MASK | IO_MEM_ROMD));", "} else if ((VAR_6 & ~TARGET_PAGE_MASK) == IO_MEM_RAM &&", "!cpu_physical_memory_is_dirty(VAR_6)) {", "te->addr_write = VAR_1 | IO_MEM_NOTDIRTY;", "} else {", "te->addr_write = address;", "}", "} else {", "te->addr_write = -1;", "}", "}", "#if !defined(CONFIG_SOFTMMU)\nelse {", "if ((VAR_6 & ~TARGET_PAGE_MASK) > IO_MEM_ROM) {", "if (!(VAR_0->hflags & HF_SOFTMMU_MASK))\nVAR_8 = 2;", "} else {", "void *VAR_9;", "if (VAR_1 >= MMAP_AREA_END) {", "VAR_8 = 2;", "} else {", "if (VAR_3 & PROT_WRITE) {", "if ((VAR_6 & ~TARGET_PAGE_MASK) == IO_MEM_ROM ||\n#if defined(TARGET_HAS_SMC) || 1\nfirst_tb ||\n#endif\n((VAR_6 & ~TARGET_PAGE_MASK) == IO_MEM_RAM &&\n!cpu_physical_memory_is_dirty(VAR_6))) {", "VirtPageDesc *vp;", "vp = virt_page_find_alloc(VAR_1 >> TARGET_PAGE_BITS, 1);", "vp->phys_addr = VAR_6;", "vp->VAR_3 = VAR_3;", "vp->valid_tag = virt_valid_tag;", "VAR_3 &= ~PAGE_WRITE;", "}", "}", "VAR_9 = mmap((void *)VAR_1, TARGET_PAGE_SIZE, VAR_3,\nMAP_SHARED | MAP_FIXED, phys_ram_fd, (VAR_6 & TARGET_PAGE_MASK));", "if (VAR_9 == MAP_FAILED) {", "cpu_abort(VAR_0, \"mmap failed when mapped physical address 0x%08x to virtual address 0x%08x\\n\",\nVAR_2, VAR_1);", "}", "}", "}", "}", "#endif\nreturn VAR_8;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 26 ], [ 28 ], [ 30 ], [ 32 ], [ 34 ], [ 36 ], [ 38, 40, 42 ], [ 44, 48 ], [ 50, 52, 54, 56 ], [ 58 ], [ 62 ], [ 64 ], [ 66 ], [ 70 ], [ 72 ], [ 74 ], [ 82 ], [ 84 ], [ 86 ], [ 88 ], [ 90 ], [ 92 ], [ 94 ], [ 100 ], [ 102 ], [ 104 ], [ 106 ], [ 110 ], [ 112 ], [ 114 ], [ 116 ], [ 118 ], [ 120 ], [ 122 ], [ 124 ], [ 126 ], [ 128 ], [ 130 ], [ 132 ], [ 134 ], [ 136 ], [ 138 ], [ 140, 142 ], [ 146, 148 ], [ 150 ], [ 152 ], [ 154 ], [ 156 ], [ 158 ], [ 160 ], [ 162 ], [ 164 ], [ 166 ], [ 168 ], [ 170, 172 ], [ 174 ], [ 180, 182 ], [ 184 ], [ 186 ], [ 190 ], [ 192 ], [ 194 ], [ 196 ], [ 198, 200, 202, 204, 206, 208 ], [ 216 ], [ 220 ], [ 222 ], [ 224 ], [ 226 ], [ 228 ], [ 230 ], [ 232 ], [ 234, 236 ], [ 238 ], [ 240, 242 ], [ 244 ], [ 246 ], [ 248 ], [ 250 ], [ 252, 254 ], [ 256 ] ]
6,672
static void do_video_out(AVFormatContext *s, AVOutputStream *ost, AVInputStream *ist, AVPicture *in_picture, int *frame_size, AVOutputStream *audio_sync) { int nb_frames, i, ret; AVPicture *final_picture, *formatted_picture; AVPicture picture_format_temp, picture_crop_temp; static uint8_t *video_buffer; uint8_t *buf = NULL, *buf1 = NULL; AVCodecContext *enc, *dec; #define VIDEO_BUFFER_SIZE (1024*1024) enc = &ost->st->codec; dec = &ist->st->codec; /* by default, we output a single frame */ nb_frames = 1; *frame_size = 0; /* NOTE: the A/V sync is always done by considering the audio is the master clock. It is suffisant for transcoding or playing, but not for the general case */ if (audio_sync) { /* compute the A-V delay and duplicate/remove frames if needed */ double adelta, vdelta, av_delay; adelta = audio_sync->sync_ipts - ((double)audio_sync->sync_opts * s->pts_num / s->pts_den); vdelta = ost->sync_ipts - ((double)ost->sync_opts * s->pts_num / s->pts_den); av_delay = adelta - vdelta; // printf("delay=%f\n", av_delay); if (av_delay < -AV_DELAY_MAX) nb_frames = 2; else if (av_delay > AV_DELAY_MAX) nb_frames = 0; } else { double vdelta; vdelta = (double)(ost->st->pts.val) * s->pts_num / s->pts_den - (ost->sync_ipts - ost->sync_ipts_offset); if (vdelta < 100 && vdelta > -100 && ost->sync_ipts_offset) { if (vdelta < -AV_DELAY_MAX) nb_frames = 2; else if (vdelta > AV_DELAY_MAX) nb_frames = 0; } else { ost->sync_ipts_offset -= vdelta; if (!ost->sync_ipts_offset) ost->sync_ipts_offset = 0.000001; /* one microsecond */ } } #if defined(AVSYNC_DEBUG) static char *action[] = { "drop frame", "copy frame", "dup frame" }; if (audio_sync) fprintf(stderr, "Input APTS %12.6f, output APTS %12.6f, ", (double) audio_sync->sync_ipts, (double) audio_sync->st->pts.val * s->pts_num / s->pts_den); fprintf(stderr, "Input VPTS %12.6f, output VPTS %12.6f: %s\n", (double) ost->sync_ipts, (double) ost->st->pts.val * s->pts_num / s->pts_den, action[nb_frames]); #endif if (nb_frames <= 0) return; if (!video_buffer) video_buffer = av_malloc(VIDEO_BUFFER_SIZE); if (!video_buffer) return; /* convert pixel format if needed */ if (enc->pix_fmt != dec->pix_fmt) { int size; /* create temporary picture */ size = avpicture_get_size(enc->pix_fmt, dec->width, dec->height); buf = av_malloc(size); if (!buf) return; formatted_picture = &picture_format_temp; avpicture_fill(formatted_picture, buf, enc->pix_fmt, dec->width, dec->height); if (img_convert(formatted_picture, enc->pix_fmt, in_picture, dec->pix_fmt, dec->width, dec->height) < 0) { fprintf(stderr, "pixel format conversion not handled\n"); goto the_end; } } else { formatted_picture = in_picture; } /* XXX: resampling could be done before raw format convertion in some cases to go faster */ /* XXX: only works for YUV420P */ if (ost->video_resample) { final_picture = &ost->pict_tmp; img_resample(ost->img_resample_ctx, final_picture, formatted_picture); } else if (ost->video_crop) { picture_crop_temp.data[0] = formatted_picture->data[0] + (ost->topBand * formatted_picture->linesize[0]) + ost->leftBand; picture_crop_temp.data[1] = formatted_picture->data[1] + ((ost->topBand >> 1) * formatted_picture->linesize[1]) + (ost->leftBand >> 1); picture_crop_temp.data[2] = formatted_picture->data[2] + ((ost->topBand >> 1) * formatted_picture->linesize[2]) + (ost->leftBand >> 1); picture_crop_temp.linesize[0] = formatted_picture->linesize[0]; picture_crop_temp.linesize[1] = formatted_picture->linesize[1]; picture_crop_temp.linesize[2] = formatted_picture->linesize[2]; final_picture = &picture_crop_temp; } else { final_picture = formatted_picture; } /* duplicates frame if needed */ /* XXX: pb because no interleaving */ for(i=0;i<nb_frames;i++) { if (s->oformat->flags & AVFMT_RAWPICTURE) { /* raw pictures are written as AVPicture structure to avoid any copies. We support temorarily the older method. */ av_write_frame(s, ost->index, (uint8_t *)final_picture, sizeof(AVPicture)); } else { AVFrame big_picture; memset(&big_picture, 0, sizeof(AVFrame)); *(AVPicture*)&big_picture= *final_picture; /* handles sameq here. This is not correct because it may not be a global option */ if (same_quality) { big_picture.quality = ist->st->quality; }else big_picture.quality = ost->st->quality; ret = avcodec_encode_video(enc, video_buffer, VIDEO_BUFFER_SIZE, &big_picture); //enc->frame_number = enc->real_pict_num; av_write_frame(s, ost->index, video_buffer, ret); *frame_size = ret; //fprintf(stderr,"\nFrame: %3d %3d size: %5d type: %d", // enc->frame_number-1, enc->real_pict_num, ret, // enc->pict_type); /* if two pass, output log */ if (ost->logfile && enc->stats_out) { fprintf(ost->logfile, "%s", enc->stats_out); } } ost->frame_number++; } the_end: av_free(buf); av_free(buf1); }
true
FFmpeg
a686caf03ddd29b32abd1af5c6f887bc09e6d71b
static void do_video_out(AVFormatContext *s, AVOutputStream *ost, AVInputStream *ist, AVPicture *in_picture, int *frame_size, AVOutputStream *audio_sync) { int nb_frames, i, ret; AVPicture *final_picture, *formatted_picture; AVPicture picture_format_temp, picture_crop_temp; static uint8_t *video_buffer; uint8_t *buf = NULL, *buf1 = NULL; AVCodecContext *enc, *dec; #define VIDEO_BUFFER_SIZE (1024*1024) enc = &ost->st->codec; dec = &ist->st->codec; nb_frames = 1; *frame_size = 0; if (audio_sync) { double adelta, vdelta, av_delay; adelta = audio_sync->sync_ipts - ((double)audio_sync->sync_opts * s->pts_num / s->pts_den); vdelta = ost->sync_ipts - ((double)ost->sync_opts * s->pts_num / s->pts_den); av_delay = adelta - vdelta; if (av_delay < -AV_DELAY_MAX) nb_frames = 2; else if (av_delay > AV_DELAY_MAX) nb_frames = 0; } else { double vdelta; vdelta = (double)(ost->st->pts.val) * s->pts_num / s->pts_den - (ost->sync_ipts - ost->sync_ipts_offset); if (vdelta < 100 && vdelta > -100 && ost->sync_ipts_offset) { if (vdelta < -AV_DELAY_MAX) nb_frames = 2; else if (vdelta > AV_DELAY_MAX) nb_frames = 0; } else { ost->sync_ipts_offset -= vdelta; if (!ost->sync_ipts_offset) ost->sync_ipts_offset = 0.000001; } } #if defined(AVSYNC_DEBUG) static char *action[] = { "drop frame", "copy frame", "dup frame" }; if (audio_sync) fprintf(stderr, "Input APTS %12.6f, output APTS %12.6f, ", (double) audio_sync->sync_ipts, (double) audio_sync->st->pts.val * s->pts_num / s->pts_den); fprintf(stderr, "Input VPTS %12.6f, output VPTS %12.6f: %s\n", (double) ost->sync_ipts, (double) ost->st->pts.val * s->pts_num / s->pts_den, action[nb_frames]); #endif if (nb_frames <= 0) return; if (!video_buffer) video_buffer = av_malloc(VIDEO_BUFFER_SIZE); if (!video_buffer) return; if (enc->pix_fmt != dec->pix_fmt) { int size; size = avpicture_get_size(enc->pix_fmt, dec->width, dec->height); buf = av_malloc(size); if (!buf) return; formatted_picture = &picture_format_temp; avpicture_fill(formatted_picture, buf, enc->pix_fmt, dec->width, dec->height); if (img_convert(formatted_picture, enc->pix_fmt, in_picture, dec->pix_fmt, dec->width, dec->height) < 0) { fprintf(stderr, "pixel format conversion not handled\n"); goto the_end; } } else { formatted_picture = in_picture; } if (ost->video_resample) { final_picture = &ost->pict_tmp; img_resample(ost->img_resample_ctx, final_picture, formatted_picture); } else if (ost->video_crop) { picture_crop_temp.data[0] = formatted_picture->data[0] + (ost->topBand * formatted_picture->linesize[0]) + ost->leftBand; picture_crop_temp.data[1] = formatted_picture->data[1] + ((ost->topBand >> 1) * formatted_picture->linesize[1]) + (ost->leftBand >> 1); picture_crop_temp.data[2] = formatted_picture->data[2] + ((ost->topBand >> 1) * formatted_picture->linesize[2]) + (ost->leftBand >> 1); picture_crop_temp.linesize[0] = formatted_picture->linesize[0]; picture_crop_temp.linesize[1] = formatted_picture->linesize[1]; picture_crop_temp.linesize[2] = formatted_picture->linesize[2]; final_picture = &picture_crop_temp; } else { final_picture = formatted_picture; } for(i=0;i<nb_frames;i++) { if (s->oformat->flags & AVFMT_RAWPICTURE) { av_write_frame(s, ost->index, (uint8_t *)final_picture, sizeof(AVPicture)); } else { AVFrame big_picture; memset(&big_picture, 0, sizeof(AVFrame)); *(AVPicture*)&big_picture= *final_picture; if (same_quality) { big_picture.quality = ist->st->quality; }else big_picture.quality = ost->st->quality; ret = avcodec_encode_video(enc, video_buffer, VIDEO_BUFFER_SIZE, &big_picture); av_write_frame(s, ost->index, video_buffer, ret); *frame_size = ret; if (ost->logfile && enc->stats_out) { fprintf(ost->logfile, "%s", enc->stats_out); } } ost->frame_number++; } the_end: av_free(buf); av_free(buf1); }
{ "code": [ " if (enc->pix_fmt != dec->pix_fmt) {", " if (img_convert(formatted_picture, enc->pix_fmt, " ], "line_no": [ 159, 181 ] }
static void FUNC_0(AVFormatContext *VAR_0, AVOutputStream *VAR_1, AVInputStream *VAR_2, AVPicture *VAR_3, int *VAR_4, AVOutputStream *VAR_5) { int VAR_6, VAR_7, VAR_8; AVPicture *final_picture, *formatted_picture; AVPicture picture_format_temp, picture_crop_temp; static uint8_t *VAR_9; uint8_t *buf = NULL, *buf1 = NULL; AVCodecContext *enc, *dec; #define VIDEO_BUFFER_SIZE (1024*1024) enc = &VAR_1->st->codec; dec = &VAR_2->st->codec; VAR_6 = 1; *VAR_4 = 0; if (VAR_5) { double VAR_10, VAR_13, VAR_12; VAR_10 = VAR_5->sync_ipts - ((double)VAR_5->sync_opts * VAR_0->pts_num / VAR_0->pts_den); VAR_13 = VAR_1->sync_ipts - ((double)VAR_1->sync_opts * VAR_0->pts_num / VAR_0->pts_den); VAR_12 = VAR_10 - VAR_13; if (VAR_12 < -AV_DELAY_MAX) VAR_6 = 2; else if (VAR_12 > AV_DELAY_MAX) VAR_6 = 0; } else { double VAR_13; VAR_13 = (double)(VAR_1->st->pts.val) * VAR_0->pts_num / VAR_0->pts_den - (VAR_1->sync_ipts - VAR_1->sync_ipts_offset); if (VAR_13 < 100 && VAR_13 > -100 && VAR_1->sync_ipts_offset) { if (VAR_13 < -AV_DELAY_MAX) VAR_6 = 2; else if (VAR_13 > AV_DELAY_MAX) VAR_6 = 0; } else { VAR_1->sync_ipts_offset -= VAR_13; if (!VAR_1->sync_ipts_offset) VAR_1->sync_ipts_offset = 0.000001; } } #if defined(AVSYNC_DEBUG) static char *action[] = { "drop frame", "copy frame", "dup frame" }; if (VAR_5) fprintf(stderr, "Input APTS %12.6f, output APTS %12.6f, ", (double) VAR_5->sync_ipts, (double) VAR_5->st->pts.val * VAR_0->pts_num / VAR_0->pts_den); fprintf(stderr, "Input VPTS %12.6f, output VPTS %12.6f: %VAR_0\n", (double) VAR_1->sync_ipts, (double) VAR_1->st->pts.val * VAR_0->pts_num / VAR_0->pts_den, action[VAR_6]); #endif if (VAR_6 <= 0) return; if (!VAR_9) VAR_9 = av_malloc(VIDEO_BUFFER_SIZE); if (!VAR_9) return; if (enc->pix_fmt != dec->pix_fmt) { int VAR_13; VAR_13 = avpicture_get_size(enc->pix_fmt, dec->width, dec->height); buf = av_malloc(VAR_13); if (!buf) return; formatted_picture = &picture_format_temp; avpicture_fill(formatted_picture, buf, enc->pix_fmt, dec->width, dec->height); if (img_convert(formatted_picture, enc->pix_fmt, VAR_3, dec->pix_fmt, dec->width, dec->height) < 0) { fprintf(stderr, "pixel format conversion not handled\n"); goto the_end; } } else { formatted_picture = VAR_3; } if (VAR_1->video_resample) { final_picture = &VAR_1->pict_tmp; img_resample(VAR_1->img_resample_ctx, final_picture, formatted_picture); } else if (VAR_1->video_crop) { picture_crop_temp.data[0] = formatted_picture->data[0] + (VAR_1->topBand * formatted_picture->linesize[0]) + VAR_1->leftBand; picture_crop_temp.data[1] = formatted_picture->data[1] + ((VAR_1->topBand >> 1) * formatted_picture->linesize[1]) + (VAR_1->leftBand >> 1); picture_crop_temp.data[2] = formatted_picture->data[2] + ((VAR_1->topBand >> 1) * formatted_picture->linesize[2]) + (VAR_1->leftBand >> 1); picture_crop_temp.linesize[0] = formatted_picture->linesize[0]; picture_crop_temp.linesize[1] = formatted_picture->linesize[1]; picture_crop_temp.linesize[2] = formatted_picture->linesize[2]; final_picture = &picture_crop_temp; } else { final_picture = formatted_picture; } for(VAR_7=0;VAR_7<VAR_6;VAR_7++) { if (VAR_0->oformat->flags & AVFMT_RAWPICTURE) { av_write_frame(VAR_0, VAR_1->index, (uint8_t *)final_picture, sizeof(AVPicture)); } else { AVFrame big_picture; memset(&big_picture, 0, sizeof(AVFrame)); *(AVPicture*)&big_picture= *final_picture; if (same_quality) { big_picture.quality = VAR_2->st->quality; }else big_picture.quality = VAR_1->st->quality; VAR_8 = avcodec_encode_video(enc, VAR_9, VIDEO_BUFFER_SIZE, &big_picture); av_write_frame(VAR_0, VAR_1->index, VAR_9, VAR_8); *VAR_4 = VAR_8; if (VAR_1->logfile && enc->stats_out) { fprintf(VAR_1->logfile, "%VAR_0", enc->stats_out); } } VAR_1->frame_number++; } the_end: av_free(buf); av_free(buf1); }
[ "static void FUNC_0(AVFormatContext *VAR_0,\nAVOutputStream *VAR_1,\nAVInputStream *VAR_2,\nAVPicture *VAR_3,\nint *VAR_4, AVOutputStream *VAR_5)\n{", "int VAR_6, VAR_7, VAR_8;", "AVPicture *final_picture, *formatted_picture;", "AVPicture picture_format_temp, picture_crop_temp;", "static uint8_t *VAR_9;", "uint8_t *buf = NULL, *buf1 = NULL;", "AVCodecContext *enc, *dec;", "#define VIDEO_BUFFER_SIZE (1024*1024)\nenc = &VAR_1->st->codec;", "dec = &VAR_2->st->codec;", "VAR_6 = 1;", "*VAR_4 = 0;", "if (VAR_5) {", "double VAR_10, VAR_13, VAR_12;", "VAR_10 = VAR_5->sync_ipts - ((double)VAR_5->sync_opts *\nVAR_0->pts_num / VAR_0->pts_den);", "VAR_13 = VAR_1->sync_ipts - ((double)VAR_1->sync_opts *\nVAR_0->pts_num / VAR_0->pts_den);", "VAR_12 = VAR_10 - VAR_13;", "if (VAR_12 < -AV_DELAY_MAX)\nVAR_6 = 2;", "else if (VAR_12 > AV_DELAY_MAX)\nVAR_6 = 0;", "} else {", "double VAR_13;", "VAR_13 = (double)(VAR_1->st->pts.val) * VAR_0->pts_num / VAR_0->pts_den - (VAR_1->sync_ipts - VAR_1->sync_ipts_offset);", "if (VAR_13 < 100 && VAR_13 > -100 && VAR_1->sync_ipts_offset) {", "if (VAR_13 < -AV_DELAY_MAX)\nVAR_6 = 2;", "else if (VAR_13 > AV_DELAY_MAX)\nVAR_6 = 0;", "} else {", "VAR_1->sync_ipts_offset -= VAR_13;", "if (!VAR_1->sync_ipts_offset)\nVAR_1->sync_ipts_offset = 0.000001;", "}", "}", "#if defined(AVSYNC_DEBUG)\nstatic char *action[] = { \"drop frame\", \"copy frame\", \"dup frame\" };", "if (VAR_5)\nfprintf(stderr, \"Input APTS %12.6f, output APTS %12.6f, \",\n(double) VAR_5->sync_ipts,\n(double) VAR_5->st->pts.val * VAR_0->pts_num / VAR_0->pts_den);", "fprintf(stderr, \"Input VPTS %12.6f, output VPTS %12.6f: %VAR_0\\n\",\n(double) VAR_1->sync_ipts,\n(double) VAR_1->st->pts.val * VAR_0->pts_num / VAR_0->pts_den,\naction[VAR_6]);", "#endif\nif (VAR_6 <= 0)\nreturn;", "if (!VAR_9)\nVAR_9 = av_malloc(VIDEO_BUFFER_SIZE);", "if (!VAR_9)\nreturn;", "if (enc->pix_fmt != dec->pix_fmt) {", "int VAR_13;", "VAR_13 = avpicture_get_size(enc->pix_fmt, dec->width, dec->height);", "buf = av_malloc(VAR_13);", "if (!buf)\nreturn;", "formatted_picture = &picture_format_temp;", "avpicture_fill(formatted_picture, buf, enc->pix_fmt, dec->width, dec->height);", "if (img_convert(formatted_picture, enc->pix_fmt,\nVAR_3, dec->pix_fmt,\ndec->width, dec->height) < 0) {", "fprintf(stderr, \"pixel format conversion not handled\\n\");", "goto the_end;", "}", "} else {", "formatted_picture = VAR_3;", "}", "if (VAR_1->video_resample) {", "final_picture = &VAR_1->pict_tmp;", "img_resample(VAR_1->img_resample_ctx, final_picture, formatted_picture);", "} else if (VAR_1->video_crop) {", "picture_crop_temp.data[0] = formatted_picture->data[0] +\n(VAR_1->topBand * formatted_picture->linesize[0]) + VAR_1->leftBand;", "picture_crop_temp.data[1] = formatted_picture->data[1] +\n((VAR_1->topBand >> 1) * formatted_picture->linesize[1]) +\n(VAR_1->leftBand >> 1);", "picture_crop_temp.data[2] = formatted_picture->data[2] +\n((VAR_1->topBand >> 1) * formatted_picture->linesize[2]) +\n(VAR_1->leftBand >> 1);", "picture_crop_temp.linesize[0] = formatted_picture->linesize[0];", "picture_crop_temp.linesize[1] = formatted_picture->linesize[1];", "picture_crop_temp.linesize[2] = formatted_picture->linesize[2];", "final_picture = &picture_crop_temp;", "} else {", "final_picture = formatted_picture;", "}", "for(VAR_7=0;VAR_7<VAR_6;VAR_7++) {", "if (VAR_0->oformat->flags & AVFMT_RAWPICTURE) {", "av_write_frame(VAR_0, VAR_1->index,\n(uint8_t *)final_picture, sizeof(AVPicture));", "} else {", "AVFrame big_picture;", "memset(&big_picture, 0, sizeof(AVFrame));", "*(AVPicture*)&big_picture= *final_picture;", "if (same_quality) {", "big_picture.quality = VAR_2->st->quality;", "}else", "big_picture.quality = VAR_1->st->quality;", "VAR_8 = avcodec_encode_video(enc,\nVAR_9, VIDEO_BUFFER_SIZE,\n&big_picture);", "av_write_frame(VAR_0, VAR_1->index, VAR_9, VAR_8);", "*VAR_4 = VAR_8;", "if (VAR_1->logfile && enc->stats_out) {", "fprintf(VAR_1->logfile, \"%VAR_0\", enc->stats_out);", "}", "}", "VAR_1->frame_number++;", "}", "the_end:\nav_free(buf);", "av_free(buf1);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27, 31 ], [ 33 ], [ 39 ], [ 43 ], [ 53 ], [ 57 ], [ 61, 63 ], [ 67, 69 ], [ 73 ], [ 77, 79 ], [ 81, 83 ], [ 85 ], [ 87 ], [ 91 ], [ 93 ], [ 95, 97 ], [ 99, 101 ], [ 103 ], [ 105 ], [ 107, 109 ], [ 111 ], [ 113 ], [ 117, 119 ], [ 121, 123, 125, 127 ], [ 129, 131, 133, 135 ], [ 137, 141, 143 ], [ 147, 149 ], [ 151, 153 ], [ 159 ], [ 161 ], [ 167 ], [ 169 ], [ 171, 173 ], [ 175 ], [ 177 ], [ 181, 183, 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215, 217 ], [ 221, 223, 225 ], [ 229, 231, 233 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 255 ], [ 257 ], [ 265, 267 ], [ 269 ], [ 271 ], [ 275 ], [ 277 ], [ 285 ], [ 287 ], [ 289 ], [ 291 ], [ 295, 297, 299 ], [ 303 ], [ 305 ], [ 315 ], [ 317 ], [ 319 ], [ 321 ], [ 323 ], [ 325 ], [ 327, 329 ], [ 331 ], [ 333 ] ]
6,675
static int read_seek(AVFormatContext *s, int stream_index, int64_t pts, int flags) { NUTContext *nut = s->priv_data; AVStream *st = s->streams[stream_index]; Syncpoint dummy = { .ts = pts * av_q2d(st->time_base) * AV_TIME_BASE }; Syncpoint nopts_sp = { .ts = AV_NOPTS_VALUE, .back_ptr = AV_NOPTS_VALUE }; Syncpoint *sp, *next_node[2] = { &nopts_sp, &nopts_sp }; int64_t pos, pos2, ts; int i; if (nut->flags & NUT_PIPE) { return AVERROR(ENOSYS); } if (st->index_entries) { int index = av_index_search_timestamp(st, pts, flags); if (index < 0) index = av_index_search_timestamp(st, pts, flags ^ AVSEEK_FLAG_BACKWARD); if (index < 0) return -1; pos2 = st->index_entries[index].pos; ts = st->index_entries[index].timestamp; } else { av_tree_find(nut->syncpoints, &dummy, (void *) ff_nut_sp_pts_cmp, (void **) next_node); av_log(s, AV_LOG_DEBUG, "%"PRIu64"-%"PRIu64" %"PRId64"-%"PRId64"\n", next_node[0]->pos, next_node[1]->pos, next_node[0]->ts, next_node[1]->ts); pos = ff_gen_search(s, -1, dummy.ts, next_node[0]->pos, next_node[1]->pos, next_node[1]->pos, next_node[0]->ts, next_node[1]->ts, AVSEEK_FLAG_BACKWARD, &ts, nut_read_timestamp); if (!(flags & AVSEEK_FLAG_BACKWARD)) { dummy.pos = pos + 16; next_node[1] = &nopts_sp; av_tree_find(nut->syncpoints, &dummy, (void *) ff_nut_sp_pos_cmp, (void **) next_node); pos2 = ff_gen_search(s, -2, dummy.pos, next_node[0]->pos, next_node[1]->pos, next_node[1]->pos, next_node[0]->back_ptr, next_node[1]->back_ptr, flags, &ts, nut_read_timestamp); if (pos2 >= 0) pos = pos2; // FIXME dir but I think it does not matter } dummy.pos = pos; sp = av_tree_find(nut->syncpoints, &dummy, (void *) ff_nut_sp_pos_cmp, NULL); av_assert0(sp); pos2 = sp->back_ptr - 15; } av_log(NULL, AV_LOG_DEBUG, "SEEKTO: %"PRId64"\n", pos2); pos = find_startcode(s->pb, SYNCPOINT_STARTCODE, pos2); avio_seek(s->pb, pos, SEEK_SET); nut->last_syncpoint_pos = pos; av_log(NULL, AV_LOG_DEBUG, "SP: %"PRId64"\n", pos); if (pos2 > pos || pos2 + 15 < pos) av_log(NULL, AV_LOG_ERROR, "no syncpoint at backptr pos\n"); for (i = 0; i < s->nb_streams; i++) nut->stream[i].skip_until_key_frame = 1; nut->last_resync_pos = 0; return 0; }
true
FFmpeg
60ec3007e69ce8c5ae540c81b0bd21c1ebe1543a
static int read_seek(AVFormatContext *s, int stream_index, int64_t pts, int flags) { NUTContext *nut = s->priv_data; AVStream *st = s->streams[stream_index]; Syncpoint dummy = { .ts = pts * av_q2d(st->time_base) * AV_TIME_BASE }; Syncpoint nopts_sp = { .ts = AV_NOPTS_VALUE, .back_ptr = AV_NOPTS_VALUE }; Syncpoint *sp, *next_node[2] = { &nopts_sp, &nopts_sp }; int64_t pos, pos2, ts; int i; if (nut->flags & NUT_PIPE) { return AVERROR(ENOSYS); } if (st->index_entries) { int index = av_index_search_timestamp(st, pts, flags); if (index < 0) index = av_index_search_timestamp(st, pts, flags ^ AVSEEK_FLAG_BACKWARD); if (index < 0) return -1; pos2 = st->index_entries[index].pos; ts = st->index_entries[index].timestamp; } else { av_tree_find(nut->syncpoints, &dummy, (void *) ff_nut_sp_pts_cmp, (void **) next_node); av_log(s, AV_LOG_DEBUG, "%"PRIu64"-%"PRIu64" %"PRId64"-%"PRId64"\n", next_node[0]->pos, next_node[1]->pos, next_node[0]->ts, next_node[1]->ts); pos = ff_gen_search(s, -1, dummy.ts, next_node[0]->pos, next_node[1]->pos, next_node[1]->pos, next_node[0]->ts, next_node[1]->ts, AVSEEK_FLAG_BACKWARD, &ts, nut_read_timestamp); if (!(flags & AVSEEK_FLAG_BACKWARD)) { dummy.pos = pos + 16; next_node[1] = &nopts_sp; av_tree_find(nut->syncpoints, &dummy, (void *) ff_nut_sp_pos_cmp, (void **) next_node); pos2 = ff_gen_search(s, -2, dummy.pos, next_node[0]->pos, next_node[1]->pos, next_node[1]->pos, next_node[0]->back_ptr, next_node[1]->back_ptr, flags, &ts, nut_read_timestamp); if (pos2 >= 0) pos = pos2; } dummy.pos = pos; sp = av_tree_find(nut->syncpoints, &dummy, (void *) ff_nut_sp_pos_cmp, NULL); av_assert0(sp); pos2 = sp->back_ptr - 15; } av_log(NULL, AV_LOG_DEBUG, "SEEKTO: %"PRId64"\n", pos2); pos = find_startcode(s->pb, SYNCPOINT_STARTCODE, pos2); avio_seek(s->pb, pos, SEEK_SET); nut->last_syncpoint_pos = pos; av_log(NULL, AV_LOG_DEBUG, "SP: %"PRId64"\n", pos); if (pos2 > pos || pos2 + 15 < pos) av_log(NULL, AV_LOG_ERROR, "no syncpoint at backptr pos\n"); for (i = 0; i < s->nb_streams; i++) nut->stream[i].skip_until_key_frame = 1; nut->last_resync_pos = 0; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0, int VAR_1, int64_t VAR_2, int VAR_3) { NUTContext *nut = VAR_0->priv_data; AVStream *st = VAR_0->streams[VAR_1]; Syncpoint dummy = { .ts = VAR_2 * av_q2d(st->time_base) * AV_TIME_BASE }; Syncpoint nopts_sp = { .ts = AV_NOPTS_VALUE, .back_ptr = AV_NOPTS_VALUE }; Syncpoint *sp, *next_node[2] = { &nopts_sp, &nopts_sp }; int64_t pos, pos2, ts; int VAR_4; if (nut->VAR_3 & NUT_PIPE) { return AVERROR(ENOSYS); } if (st->index_entries) { int VAR_5 = av_index_search_timestamp(st, VAR_2, VAR_3); if (VAR_5 < 0) VAR_5 = av_index_search_timestamp(st, VAR_2, VAR_3 ^ AVSEEK_FLAG_BACKWARD); if (VAR_5 < 0) return -1; pos2 = st->index_entries[VAR_5].pos; ts = st->index_entries[VAR_5].timestamp; } else { av_tree_find(nut->syncpoints, &dummy, (void *) ff_nut_sp_pts_cmp, (void **) next_node); av_log(VAR_0, AV_LOG_DEBUG, "%"PRIu64"-%"PRIu64" %"PRId64"-%"PRId64"\n", next_node[0]->pos, next_node[1]->pos, next_node[0]->ts, next_node[1]->ts); pos = ff_gen_search(VAR_0, -1, dummy.ts, next_node[0]->pos, next_node[1]->pos, next_node[1]->pos, next_node[0]->ts, next_node[1]->ts, AVSEEK_FLAG_BACKWARD, &ts, nut_read_timestamp); if (!(VAR_3 & AVSEEK_FLAG_BACKWARD)) { dummy.pos = pos + 16; next_node[1] = &nopts_sp; av_tree_find(nut->syncpoints, &dummy, (void *) ff_nut_sp_pos_cmp, (void **) next_node); pos2 = ff_gen_search(VAR_0, -2, dummy.pos, next_node[0]->pos, next_node[1]->pos, next_node[1]->pos, next_node[0]->back_ptr, next_node[1]->back_ptr, VAR_3, &ts, nut_read_timestamp); if (pos2 >= 0) pos = pos2; } dummy.pos = pos; sp = av_tree_find(nut->syncpoints, &dummy, (void *) ff_nut_sp_pos_cmp, NULL); av_assert0(sp); pos2 = sp->back_ptr - 15; } av_log(NULL, AV_LOG_DEBUG, "SEEKTO: %"PRId64"\n", pos2); pos = find_startcode(VAR_0->pb, SYNCPOINT_STARTCODE, pos2); avio_seek(VAR_0->pb, pos, SEEK_SET); nut->last_syncpoint_pos = pos; av_log(NULL, AV_LOG_DEBUG, "SP: %"PRId64"\n", pos); if (pos2 > pos || pos2 + 15 < pos) av_log(NULL, AV_LOG_ERROR, "no syncpoint at backptr pos\n"); for (VAR_4 = 0; VAR_4 < VAR_0->nb_streams; VAR_4++) nut->stream[VAR_4].skip_until_key_frame = 1; nut->last_resync_pos = 0; return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0, int VAR_1,\nint64_t VAR_2, int VAR_3)\n{", "NUTContext *nut = VAR_0->priv_data;", "AVStream *st = VAR_0->streams[VAR_1];", "Syncpoint dummy = { .ts = VAR_2 * av_q2d(st->time_base) * AV_TIME_BASE };", "Syncpoint nopts_sp = { .ts = AV_NOPTS_VALUE, .back_ptr = AV_NOPTS_VALUE };", "Syncpoint *sp, *next_node[2] = { &nopts_sp, &nopts_sp };", "int64_t pos, pos2, ts;", "int VAR_4;", "if (nut->VAR_3 & NUT_PIPE) {", "return AVERROR(ENOSYS);", "}", "if (st->index_entries) {", "int VAR_5 = av_index_search_timestamp(st, VAR_2, VAR_3);", "if (VAR_5 < 0)\nVAR_5 = av_index_search_timestamp(st, VAR_2, VAR_3 ^ AVSEEK_FLAG_BACKWARD);", "if (VAR_5 < 0)\nreturn -1;", "pos2 = st->index_entries[VAR_5].pos;", "ts = st->index_entries[VAR_5].timestamp;", "} else {", "av_tree_find(nut->syncpoints, &dummy, (void *) ff_nut_sp_pts_cmp,\n(void **) next_node);", "av_log(VAR_0, AV_LOG_DEBUG, \"%\"PRIu64\"-%\"PRIu64\" %\"PRId64\"-%\"PRId64\"\\n\",\nnext_node[0]->pos, next_node[1]->pos, next_node[0]->ts,\nnext_node[1]->ts);", "pos = ff_gen_search(VAR_0, -1, dummy.ts, next_node[0]->pos,\nnext_node[1]->pos, next_node[1]->pos,\nnext_node[0]->ts, next_node[1]->ts,\nAVSEEK_FLAG_BACKWARD, &ts, nut_read_timestamp);", "if (!(VAR_3 & AVSEEK_FLAG_BACKWARD)) {", "dummy.pos = pos + 16;", "next_node[1] = &nopts_sp;", "av_tree_find(nut->syncpoints, &dummy, (void *) ff_nut_sp_pos_cmp,\n(void **) next_node);", "pos2 = ff_gen_search(VAR_0, -2, dummy.pos, next_node[0]->pos,\nnext_node[1]->pos, next_node[1]->pos,\nnext_node[0]->back_ptr, next_node[1]->back_ptr,\nVAR_3, &ts, nut_read_timestamp);", "if (pos2 >= 0)\npos = pos2;", "}", "dummy.pos = pos;", "sp = av_tree_find(nut->syncpoints, &dummy, (void *) ff_nut_sp_pos_cmp,\nNULL);", "av_assert0(sp);", "pos2 = sp->back_ptr - 15;", "}", "av_log(NULL, AV_LOG_DEBUG, \"SEEKTO: %\"PRId64\"\\n\", pos2);", "pos = find_startcode(VAR_0->pb, SYNCPOINT_STARTCODE, pos2);", "avio_seek(VAR_0->pb, pos, SEEK_SET);", "nut->last_syncpoint_pos = pos;", "av_log(NULL, AV_LOG_DEBUG, \"SP: %\"PRId64\"\\n\", pos);", "if (pos2 > pos || pos2 + 15 < pos)\nav_log(NULL, AV_LOG_ERROR, \"no syncpoint at backptr pos\\n\");", "for (VAR_4 = 0; VAR_4 < VAR_0->nb_streams; VAR_4++)", "nut->stream[VAR_4].skip_until_key_frame = 1;", "nut->last_resync_pos = 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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35, 37 ], [ 39, 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51, 53 ], [ 55, 57, 59 ], [ 61, 63, 65, 67 ], [ 73 ], [ 75 ], [ 77 ], [ 79, 81 ], [ 83, 85, 87, 89 ], [ 91, 93 ], [ 97 ], [ 99 ], [ 101, 103 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123, 125 ], [ 127 ], [ 129 ], [ 133 ], [ 137 ], [ 139 ] ]
6,676
static QList *get_cpus(QDict **resp) { *resp = qmp("{ 'execute': 'query-cpus' }"); g_assert(*resp); g_assert(qdict_haskey(*resp, "return")); return qdict_get_qlist(*resp, "return"); }
true
qemu
5e39d89d20b17cf6fb7f09d181d34f17b2ae2160
static QList *get_cpus(QDict **resp) { *resp = qmp("{ 'execute': 'query-cpus' }"); g_assert(*resp); g_assert(qdict_haskey(*resp, "return")); return qdict_get_qlist(*resp, "return"); }
{ "code": [ " return qdict_get_qlist(*resp, \"return\");" ], "line_no": [ 11 ] }
static QList *FUNC_0(QDict **resp) { *resp = qmp("{ 'execute': 'query-cpus' }"); g_assert(*resp); g_assert(qdict_haskey(*resp, "return")); return qdict_get_qlist(*resp, "return"); }
[ "static QList *FUNC_0(QDict **resp)\n{", "*resp = qmp(\"{ 'execute': 'query-cpus' }\");", "g_assert(*resp);", "g_assert(qdict_haskey(*resp, \"return\"));", "return qdict_get_qlist(*resp, \"return\");", "}" ]
[ 0, 0, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ] ]
6,677
QemuOptsList *qemu_opts_append(QemuOptsList *dst, QemuOptsList *list) { size_t num_opts, num_dst_opts; QemuOptDesc *desc; bool need_init = false; if (!list) { return dst; } /* If dst is NULL, after realloc, some area of dst should be initialized * before adding options to it. */ if (!dst) { need_init = true; } num_opts = count_opts_list(dst); num_dst_opts = num_opts; num_opts += count_opts_list(list); dst = g_realloc(dst, sizeof(QemuOptsList) + (num_opts + 1) * sizeof(QemuOptDesc)); if (need_init) { dst->name = NULL; dst->implied_opt_name = NULL; QTAILQ_INIT(&dst->head); dst->merge_lists = false; } dst->desc[num_dst_opts].name = NULL; /* append list->desc to dst->desc */ if (list) { desc = list->desc; while (desc && desc->name) { if (find_desc_by_name(dst->desc, desc->name) == NULL) { dst->desc[num_dst_opts++] = *desc; dst->desc[num_dst_opts].name = NULL; } desc++; } } return dst; }
true
qemu
a760715095e9cda6eb97486c040aa35f82297945
QemuOptsList *qemu_opts_append(QemuOptsList *dst, QemuOptsList *list) { size_t num_opts, num_dst_opts; QemuOptDesc *desc; bool need_init = false; if (!list) { return dst; } if (!dst) { need_init = true; } num_opts = count_opts_list(dst); num_dst_opts = num_opts; num_opts += count_opts_list(list); dst = g_realloc(dst, sizeof(QemuOptsList) + (num_opts + 1) * sizeof(QemuOptDesc)); if (need_init) { dst->name = NULL; dst->implied_opt_name = NULL; QTAILQ_INIT(&dst->head); dst->merge_lists = false; } dst->desc[num_dst_opts].name = NULL; if (list) { desc = list->desc; while (desc && desc->name) { if (find_desc_by_name(dst->desc, desc->name) == NULL) { dst->desc[num_dst_opts++] = *desc; dst->desc[num_dst_opts].name = NULL; } desc++; } } return dst; }
{ "code": [ " QTAILQ_INIT(&dst->head);" ], "line_no": [ 53 ] }
QemuOptsList *FUNC_0(QemuOptsList *dst, QemuOptsList *list) { size_t num_opts, num_dst_opts; QemuOptDesc *desc; bool need_init = false; if (!list) { return dst; } if (!dst) { need_init = true; } num_opts = count_opts_list(dst); num_dst_opts = num_opts; num_opts += count_opts_list(list); dst = g_realloc(dst, sizeof(QemuOptsList) + (num_opts + 1) * sizeof(QemuOptDesc)); if (need_init) { dst->name = NULL; dst->implied_opt_name = NULL; QTAILQ_INIT(&dst->head); dst->merge_lists = false; } dst->desc[num_dst_opts].name = NULL; if (list) { desc = list->desc; while (desc && desc->name) { if (find_desc_by_name(dst->desc, desc->name) == NULL) { dst->desc[num_dst_opts++] = *desc; dst->desc[num_dst_opts].name = NULL; } desc++; } } return dst; }
[ "QemuOptsList *FUNC_0(QemuOptsList *dst,\nQemuOptsList *list)\n{", "size_t num_opts, num_dst_opts;", "QemuOptDesc *desc;", "bool need_init = false;", "if (!list) {", "return dst;", "}", "if (!dst) {", "need_init = true;", "}", "num_opts = count_opts_list(dst);", "num_dst_opts = num_opts;", "num_opts += count_opts_list(list);", "dst = g_realloc(dst, sizeof(QemuOptsList) +\n(num_opts + 1) * sizeof(QemuOptDesc));", "if (need_init) {", "dst->name = NULL;", "dst->implied_opt_name = NULL;", "QTAILQ_INIT(&dst->head);", "dst->merge_lists = false;", "}", "dst->desc[num_dst_opts].name = NULL;", "if (list) {", "desc = list->desc;", "while (desc && desc->name) {", "if (find_desc_by_name(dst->desc, desc->name) == NULL) {", "dst->desc[num_dst_opts++] = *desc;", "dst->desc[num_dst_opts].name = NULL;", "}", "desc++;", "}", "}", "return dst;", "}" ]
[ 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 ], [ 15 ], [ 17 ], [ 19 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 87 ], [ 89 ] ]
6,678
static void vnc_dpy_setdata(DisplayChangeListener *dcl, DisplayState *ds) { VncDisplay *vd = ds->opaque; qemu_pixman_image_unref(vd->guest.fb); vd->guest.fb = pixman_image_ref(ds->surface->image); vd->guest.format = ds->surface->format; vnc_dpy_update(dcl, ds, 0, 0, ds_get_width(ds), ds_get_height(ds)); }
true
qemu
21ef45d71221b4577330fe3aacfb06afad91ad46
static void vnc_dpy_setdata(DisplayChangeListener *dcl, DisplayState *ds) { VncDisplay *vd = ds->opaque; qemu_pixman_image_unref(vd->guest.fb); vd->guest.fb = pixman_image_ref(ds->surface->image); vd->guest.format = ds->surface->format; vnc_dpy_update(dcl, ds, 0, 0, ds_get_width(ds), ds_get_height(ds)); }
{ "code": [ " VncDisplay *vd = ds->opaque;", " VncDisplay *vd = ds->opaque;", " VncDisplay *vd = ds->opaque;", " VncDisplay *vd = ds->opaque;" ], "line_no": [ 7, 7, 7, 7 ] }
static void FUNC_0(DisplayChangeListener *VAR_0, DisplayState *VAR_1) { VncDisplay *vd = VAR_1->opaque; qemu_pixman_image_unref(vd->guest.fb); vd->guest.fb = pixman_image_ref(VAR_1->surface->image); vd->guest.format = VAR_1->surface->format; vnc_dpy_update(VAR_0, VAR_1, 0, 0, ds_get_width(VAR_1), ds_get_height(VAR_1)); }
[ "static void FUNC_0(DisplayChangeListener *VAR_0,\nDisplayState *VAR_1)\n{", "VncDisplay *vd = VAR_1->opaque;", "qemu_pixman_image_unref(vd->guest.fb);", "vd->guest.fb = pixman_image_ref(VAR_1->surface->image);", "vd->guest.format = VAR_1->surface->format;", "vnc_dpy_update(VAR_0, VAR_1, 0, 0, ds_get_width(VAR_1), ds_get_height(VAR_1));", "}" ]
[ 0, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ] ]
6,680
static inline int cris_addc(int a, const int b) { asm ("addc\t%1, %0\n" : "+r" (a) : "r" (b)); return a; }
true
qemu
21ce148c7ec71ee32834061355a5ecfd1a11f90f
static inline int cris_addc(int a, const int b) { asm ("addc\t%1, %0\n" : "+r" (a) : "r" (b)); return a; }
{ "code": [ "static inline int cris_addc(int a, const int b)" ], "line_no": [ 1 ] }
static inline int FUNC_0(int VAR_0, const int VAR_1) { asm ("addc\t%1, %0\n" : "+r" (VAR_0) : "r" (VAR_1)); return VAR_0; }
[ "static inline int FUNC_0(int VAR_0, const int VAR_1)\n{", "asm (\"addc\\t%1, %0\\n\" : \"+r\" (VAR_0) : \"r\" (VAR_1));", "return VAR_0;", "}" ]
[ 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
6,681
void acpi_setup(PcGuestInfo *guest_info) { AcpiBuildTables tables; AcpiBuildState *build_state; if (!guest_info->fw_cfg) { ACPI_BUILD_DPRINTF("No fw cfg. Bailing out.\n"); return; } if (!guest_info->has_acpi_build) { ACPI_BUILD_DPRINTF("ACPI build disabled. Bailing out.\n"); return; } if (!acpi_enabled) { ACPI_BUILD_DPRINTF("ACPI disabled. Bailing out.\n"); return; } build_state = g_malloc0(sizeof *build_state); build_state->guest_info = guest_info; acpi_set_pci_info(); acpi_build_tables_init(&tables); acpi_build(build_state->guest_info, &tables); /* Now expose it all to Guest */ build_state->table_ram = acpi_add_rom_blob(build_state, tables.table_data, ACPI_BUILD_TABLE_FILE, ACPI_BUILD_TABLE_MAX_SIZE); assert(build_state->table_ram != RAM_ADDR_MAX); build_state->table_size = acpi_data_len(tables.table_data); acpi_add_rom_blob(NULL, tables.linker, "etc/table-loader", 0); fw_cfg_add_file(guest_info->fw_cfg, ACPI_BUILD_TPMLOG_FILE, tables.tcpalog->data, acpi_data_len(tables.tcpalog)); /* * RSDP is small so it's easy to keep it immutable, no need to * bother with ROM blobs. */ fw_cfg_add_file(guest_info->fw_cfg, ACPI_BUILD_RSDP_FILE, tables.rsdp->data, acpi_data_len(tables.rsdp)); qemu_register_reset(acpi_build_reset, build_state); acpi_build_reset(build_state); vmstate_register(NULL, 0, &vmstate_acpi_build, build_state); /* Cleanup tables but don't free the memory: we track it * in build_state. */ acpi_build_tables_cleanup(&tables, false); }
true
qemu
d70414a5788c3d51f8ce4d2f437e669e6b99dc59
void acpi_setup(PcGuestInfo *guest_info) { AcpiBuildTables tables; AcpiBuildState *build_state; if (!guest_info->fw_cfg) { ACPI_BUILD_DPRINTF("No fw cfg. Bailing out.\n"); return; } if (!guest_info->has_acpi_build) { ACPI_BUILD_DPRINTF("ACPI build disabled. Bailing out.\n"); return; } if (!acpi_enabled) { ACPI_BUILD_DPRINTF("ACPI disabled. Bailing out.\n"); return; } build_state = g_malloc0(sizeof *build_state); build_state->guest_info = guest_info; acpi_set_pci_info(); acpi_build_tables_init(&tables); acpi_build(build_state->guest_info, &tables); build_state->table_ram = acpi_add_rom_blob(build_state, tables.table_data, ACPI_BUILD_TABLE_FILE, ACPI_BUILD_TABLE_MAX_SIZE); assert(build_state->table_ram != RAM_ADDR_MAX); build_state->table_size = acpi_data_len(tables.table_data); acpi_add_rom_blob(NULL, tables.linker, "etc/table-loader", 0); fw_cfg_add_file(guest_info->fw_cfg, ACPI_BUILD_TPMLOG_FILE, tables.tcpalog->data, acpi_data_len(tables.tcpalog)); fw_cfg_add_file(guest_info->fw_cfg, ACPI_BUILD_RSDP_FILE, tables.rsdp->data, acpi_data_len(tables.rsdp)); qemu_register_reset(acpi_build_reset, build_state); acpi_build_reset(build_state); vmstate_register(NULL, 0, &vmstate_acpi_build, build_state); acpi_build_tables_cleanup(&tables, false); }
{ "code": [ " fw_cfg_add_file(guest_info->fw_cfg, ACPI_BUILD_RSDP_FILE,", " tables.rsdp->data, acpi_data_len(tables.rsdp));" ], "line_no": [ 91, 93 ] }
void FUNC_0(PcGuestInfo *VAR_0) { AcpiBuildTables tables; AcpiBuildState *build_state; if (!VAR_0->fw_cfg) { ACPI_BUILD_DPRINTF("No fw cfg. Bailing out.\n"); return; } if (!VAR_0->has_acpi_build) { ACPI_BUILD_DPRINTF("ACPI build disabled. Bailing out.\n"); return; } if (!acpi_enabled) { ACPI_BUILD_DPRINTF("ACPI disabled. Bailing out.\n"); return; } build_state = g_malloc0(sizeof *build_state); build_state->VAR_0 = VAR_0; acpi_set_pci_info(); acpi_build_tables_init(&tables); acpi_build(build_state->VAR_0, &tables); build_state->table_ram = acpi_add_rom_blob(build_state, tables.table_data, ACPI_BUILD_TABLE_FILE, ACPI_BUILD_TABLE_MAX_SIZE); assert(build_state->table_ram != RAM_ADDR_MAX); build_state->table_size = acpi_data_len(tables.table_data); acpi_add_rom_blob(NULL, tables.linker, "etc/table-loader", 0); fw_cfg_add_file(VAR_0->fw_cfg, ACPI_BUILD_TPMLOG_FILE, tables.tcpalog->data, acpi_data_len(tables.tcpalog)); fw_cfg_add_file(VAR_0->fw_cfg, ACPI_BUILD_RSDP_FILE, tables.rsdp->data, acpi_data_len(tables.rsdp)); qemu_register_reset(acpi_build_reset, build_state); acpi_build_reset(build_state); vmstate_register(NULL, 0, &vmstate_acpi_build, build_state); acpi_build_tables_cleanup(&tables, false); }
[ "void FUNC_0(PcGuestInfo *VAR_0)\n{", "AcpiBuildTables tables;", "AcpiBuildState *build_state;", "if (!VAR_0->fw_cfg) {", "ACPI_BUILD_DPRINTF(\"No fw cfg. Bailing out.\\n\");", "return;", "}", "if (!VAR_0->has_acpi_build) {", "ACPI_BUILD_DPRINTF(\"ACPI build disabled. Bailing out.\\n\");", "return;", "}", "if (!acpi_enabled) {", "ACPI_BUILD_DPRINTF(\"ACPI disabled. Bailing out.\\n\");", "return;", "}", "build_state = g_malloc0(sizeof *build_state);", "build_state->VAR_0 = VAR_0;", "acpi_set_pci_info();", "acpi_build_tables_init(&tables);", "acpi_build(build_state->VAR_0, &tables);", "build_state->table_ram = acpi_add_rom_blob(build_state, tables.table_data,\nACPI_BUILD_TABLE_FILE,\nACPI_BUILD_TABLE_MAX_SIZE);", "assert(build_state->table_ram != RAM_ADDR_MAX);", "build_state->table_size = acpi_data_len(tables.table_data);", "acpi_add_rom_blob(NULL, tables.linker, \"etc/table-loader\", 0);", "fw_cfg_add_file(VAR_0->fw_cfg, ACPI_BUILD_TPMLOG_FILE,\ntables.tcpalog->data, acpi_data_len(tables.tcpalog));", "fw_cfg_add_file(VAR_0->fw_cfg, ACPI_BUILD_RSDP_FILE,\ntables.rsdp->data, acpi_data_len(tables.rsdp));", "qemu_register_reset(acpi_build_reset, build_state);", "acpi_build_reset(build_state);", "vmstate_register(NULL, 0, &vmstate_acpi_build, build_state);", "acpi_build_tables_cleanup(&tables, false);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 45 ], [ 49 ], [ 53 ], [ 55 ], [ 61, 63, 65 ], [ 67 ], [ 69 ], [ 73 ], [ 77, 79 ], [ 91, 93 ], [ 97 ], [ 99 ], [ 101 ], [ 111 ], [ 113 ] ]
6,683
static void reset_used_window(DisasContext *dc) { dc->used_window = 0; }
true
qemu
2db59a76c421cdd1039d10e32a9798952d3ff5ba
static void reset_used_window(DisasContext *dc) { dc->used_window = 0; }
{ "code": [ "static void reset_used_window(DisasContext *dc)", " dc->used_window = 0;" ], "line_no": [ 1, 5 ] }
static void FUNC_0(DisasContext *VAR_0) { VAR_0->used_window = 0; }
[ "static void FUNC_0(DisasContext *VAR_0)\n{", "VAR_0->used_window = 0;", "}" ]
[ 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
6,684
static int decode_block(MJpegDecodeContext *s, int16_t *block, int component, int dc_index, int ac_index, uint16_t *quant_matrix) { int code, i, j, level, val; /* DC coef */ val = mjpeg_decode_dc(s, dc_index); if (val == 0xfffff) { av_log(s->avctx, AV_LOG_ERROR, "error dc\n"); return AVERROR_INVALIDDATA; } val = val * quant_matrix[0] + s->last_dc[component]; val = FFMIN(val, 32767); s->last_dc[component] = val; block[0] = val; /* AC coefs */ i = 0; {OPEN_READER(re, &s->gb); do { UPDATE_CACHE(re, &s->gb); GET_VLC(code, re, &s->gb, s->vlcs[1][ac_index].table, 9, 2); i += ((unsigned)code) >> 4; code &= 0xf; if (code) { if (code > MIN_CACHE_BITS - 16) UPDATE_CACHE(re, &s->gb); { int cache = GET_CACHE(re, &s->gb); int sign = (~cache) >> 31; level = (NEG_USR32(sign ^ cache,code) ^ sign) - sign; } LAST_SKIP_BITS(re, &s->gb, code); if (i > 63) { av_log(s->avctx, AV_LOG_ERROR, "error count: %d\n", i); return AVERROR_INVALIDDATA; } j = s->scantable.permutated[i]; block[j] = level * quant_matrix[i]; } } while (i < 63); CLOSE_READER(re, &s->gb);} return 0; }
true
FFmpeg
c28f648b19dd36ff9bc869ad527a1569a0b623e2
static int decode_block(MJpegDecodeContext *s, int16_t *block, int component, int dc_index, int ac_index, uint16_t *quant_matrix) { int code, i, j, level, val; val = mjpeg_decode_dc(s, dc_index); if (val == 0xfffff) { av_log(s->avctx, AV_LOG_ERROR, "error dc\n"); return AVERROR_INVALIDDATA; } val = val * quant_matrix[0] + s->last_dc[component]; val = FFMIN(val, 32767); s->last_dc[component] = val; block[0] = val; i = 0; {OPEN_READER(re, &s->gb); do { UPDATE_CACHE(re, &s->gb); GET_VLC(code, re, &s->gb, s->vlcs[1][ac_index].table, 9, 2); i += ((unsigned)code) >> 4; code &= 0xf; if (code) { if (code > MIN_CACHE_BITS - 16) UPDATE_CACHE(re, &s->gb); { int cache = GET_CACHE(re, &s->gb); int sign = (~cache) >> 31; level = (NEG_USR32(sign ^ cache,code) ^ sign) - sign; } LAST_SKIP_BITS(re, &s->gb, code); if (i > 63) { av_log(s->avctx, AV_LOG_ERROR, "error count: %d\n", i); return AVERROR_INVALIDDATA; } j = s->scantable.permutated[i]; block[j] = level * quant_matrix[i]; } } while (i < 63); CLOSE_READER(re, &s->gb);} return 0; }
{ "code": [ " val = FFMIN(val, 32767);" ], "line_no": [ 25 ] }
static int FUNC_0(MJpegDecodeContext *VAR_0, int16_t *VAR_1, int VAR_2, int VAR_3, int VAR_4, uint16_t *VAR_5) { int VAR_6, VAR_7, VAR_8, VAR_9, VAR_10; VAR_10 = mjpeg_decode_dc(VAR_0, VAR_3); if (VAR_10 == 0xfffff) { av_log(VAR_0->avctx, AV_LOG_ERROR, "error dc\n"); return AVERROR_INVALIDDATA; } VAR_10 = VAR_10 * VAR_5[0] + VAR_0->last_dc[VAR_2]; VAR_10 = FFMIN(VAR_10, 32767); VAR_0->last_dc[VAR_2] = VAR_10; VAR_1[0] = VAR_10; VAR_7 = 0; {OPEN_READER(re, &VAR_0->gb); do { UPDATE_CACHE(re, &VAR_0->gb); GET_VLC(VAR_6, re, &VAR_0->gb, VAR_0->vlcs[1][VAR_4].table, 9, 2); VAR_7 += ((unsigned)VAR_6) >> 4; VAR_6 &= 0xf; if (VAR_6) { if (VAR_6 > MIN_CACHE_BITS - 16) UPDATE_CACHE(re, &VAR_0->gb); { int VAR_11 = GET_CACHE(re, &VAR_0->gb); int VAR_12 = (~VAR_11) >> 31; VAR_9 = (NEG_USR32(VAR_12 ^ VAR_11,VAR_6) ^ VAR_12) - VAR_12; } LAST_SKIP_BITS(re, &VAR_0->gb, VAR_6); if (VAR_7 > 63) { av_log(VAR_0->avctx, AV_LOG_ERROR, "error count: %d\n", VAR_7); return AVERROR_INVALIDDATA; } VAR_8 = VAR_0->scantable.permutated[VAR_7]; VAR_1[VAR_8] = VAR_9 * VAR_5[VAR_7]; } } while (VAR_7 < 63); CLOSE_READER(re, &VAR_0->gb);} return 0; }
[ "static int FUNC_0(MJpegDecodeContext *VAR_0, int16_t *VAR_1, int VAR_2,\nint VAR_3, int VAR_4, uint16_t *VAR_5)\n{", "int VAR_6, VAR_7, VAR_8, VAR_9, VAR_10;", "VAR_10 = mjpeg_decode_dc(VAR_0, VAR_3);", "if (VAR_10 == 0xfffff) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"error dc\\n\");", "return AVERROR_INVALIDDATA;", "}", "VAR_10 = VAR_10 * VAR_5[0] + VAR_0->last_dc[VAR_2];", "VAR_10 = FFMIN(VAR_10, 32767);", "VAR_0->last_dc[VAR_2] = VAR_10;", "VAR_1[0] = VAR_10;", "VAR_7 = 0;", "{OPEN_READER(re, &VAR_0->gb);", "do {", "UPDATE_CACHE(re, &VAR_0->gb);", "GET_VLC(VAR_6, re, &VAR_0->gb, VAR_0->vlcs[1][VAR_4].table, 9, 2);", "VAR_7 += ((unsigned)VAR_6) >> 4;", "VAR_6 &= 0xf;", "if (VAR_6) {", "if (VAR_6 > MIN_CACHE_BITS - 16)\nUPDATE_CACHE(re, &VAR_0->gb);", "{", "int VAR_11 = GET_CACHE(re, &VAR_0->gb);", "int VAR_12 = (~VAR_11) >> 31;", "VAR_9 = (NEG_USR32(VAR_12 ^ VAR_11,VAR_6) ^ VAR_12) - VAR_12;", "}", "LAST_SKIP_BITS(re, &VAR_0->gb, VAR_6);", "if (VAR_7 > 63) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"error count: %d\\n\", VAR_7);", "return AVERROR_INVALIDDATA;", "}", "VAR_8 = VAR_0->scantable.permutated[VAR_7];", "VAR_1[VAR_8] = VAR_9 * VAR_5[VAR_7];", "}", "} while (VAR_7 < 63);", "CLOSE_READER(re, &VAR_0->gb);}", "return 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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51, 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 93 ], [ 95 ] ]
6,687
static int usb_host_scan(void *opaque, USBScanFunc *func) { FILE *f = 0; DIR *dir = 0; int ret = 0; const char *devices = "/devices"; const char *opened = "husb: opened %s%s\n"; const char *fs_type[] = {"unknown", "proc", "dev", "sys"}; char devpath[PATH_MAX]; /* only check the host once */ if (!usb_fs_type) { f = fopen(USBPROCBUS_PATH "/devices", "r"); if (f) { /* devices found in /proc/bus/usb/ */ strcpy(devpath, USBPROCBUS_PATH); usb_fs_type = USB_FS_PROC; fclose(f); dprintf(opened, USBPROCBUS_PATH, devices); } /* try additional methods if an access method hasn't been found yet */ f = fopen(USBDEVBUS_PATH "/devices", "r"); if (!usb_fs_type && f) { /* devices found in /dev/bus/usb/ */ strcpy(devpath, USBDEVBUS_PATH); usb_fs_type = USB_FS_DEV; fclose(f); dprintf(opened, USBDEVBUS_PATH, devices); } dir = opendir(USBSYSBUS_PATH "/devices"); if (!usb_fs_type && dir) { /* devices found in /dev/bus/usb/ (yes - not a mistake!) */ strcpy(devpath, USBDEVBUS_PATH); usb_fs_type = USB_FS_SYS; closedir(dir); dprintf(opened, USBSYSBUS_PATH, devices); } if (!usb_fs_type) { term_printf("husb: unable to access USB devices\n"); goto the_end; } /* the module setting (used later for opening devices) */ usb_host_device_path = qemu_mallocz(strlen(devpath)+1); if (usb_host_device_path) { strcpy(usb_host_device_path, devpath); term_printf("husb: using %s file-system with %s\n", fs_type[usb_fs_type], usb_host_device_path); } else { /* out of memory? */ perror("husb: unable to allocate memory for device path"); goto the_end; } } switch (usb_fs_type) { case USB_FS_PROC: case USB_FS_DEV: ret = usb_host_scan_dev(opaque, func); break; case USB_FS_SYS: ret = usb_host_scan_sys(opaque, func); break; } the_end: return ret; }
true
qemu
f16a0db323e1a8c0044696815cceeb98706f2243
static int usb_host_scan(void *opaque, USBScanFunc *func) { FILE *f = 0; DIR *dir = 0; int ret = 0; const char *devices = "/devices"; const char *opened = "husb: opened %s%s\n"; const char *fs_type[] = {"unknown", "proc", "dev", "sys"}; char devpath[PATH_MAX]; if (!usb_fs_type) { f = fopen(USBPROCBUS_PATH "/devices", "r"); if (f) { strcpy(devpath, USBPROCBUS_PATH); usb_fs_type = USB_FS_PROC; fclose(f); dprintf(opened, USBPROCBUS_PATH, devices); } f = fopen(USBDEVBUS_PATH "/devices", "r"); if (!usb_fs_type && f) { strcpy(devpath, USBDEVBUS_PATH); usb_fs_type = USB_FS_DEV; fclose(f); dprintf(opened, USBDEVBUS_PATH, devices); } dir = opendir(USBSYSBUS_PATH "/devices"); if (!usb_fs_type && dir) { strcpy(devpath, USBDEVBUS_PATH); usb_fs_type = USB_FS_SYS; closedir(dir); dprintf(opened, USBSYSBUS_PATH, devices); } if (!usb_fs_type) { term_printf("husb: unable to access USB devices\n"); goto the_end; } usb_host_device_path = qemu_mallocz(strlen(devpath)+1); if (usb_host_device_path) { strcpy(usb_host_device_path, devpath); term_printf("husb: using %s file-system with %s\n", fs_type[usb_fs_type], usb_host_device_path); } else { perror("husb: unable to allocate memory for device path"); goto the_end; } } switch (usb_fs_type) { case USB_FS_PROC: case USB_FS_DEV: ret = usb_host_scan_dev(opaque, func); break; case USB_FS_SYS: ret = usb_host_scan_sys(opaque, func); break; } the_end: return ret; }
{ "code": [ " if (!usb_fs_type && f) {", " if (!usb_fs_type && dir) {", " goto the_end;", " goto the_end;", " the_end:" ], "line_no": [ 45, 61, 79, 79, 127 ] }
static int FUNC_0(void *VAR_0, USBScanFunc *VAR_1) { FILE *f = 0; DIR *dir = 0; int VAR_2 = 0; const char *VAR_3 = "/VAR_3"; const char *VAR_4 = "husb: VAR_4 %s%s\n"; const char *VAR_5[] = {"unknown", "proc", "dev", "sys"}; char VAR_6[PATH_MAX]; if (!usb_fs_type) { f = fopen(USBPROCBUS_PATH "/VAR_3", "r"); if (f) { strcpy(VAR_6, USBPROCBUS_PATH); usb_fs_type = USB_FS_PROC; fclose(f); dprintf(VAR_4, USBPROCBUS_PATH, VAR_3); } f = fopen(USBDEVBUS_PATH "/VAR_3", "r"); if (!usb_fs_type && f) { strcpy(VAR_6, USBDEVBUS_PATH); usb_fs_type = USB_FS_DEV; fclose(f); dprintf(VAR_4, USBDEVBUS_PATH, VAR_3); } dir = opendir(USBSYSBUS_PATH "/VAR_3"); if (!usb_fs_type && dir) { strcpy(VAR_6, USBDEVBUS_PATH); usb_fs_type = USB_FS_SYS; closedir(dir); dprintf(VAR_4, USBSYSBUS_PATH, VAR_3); } if (!usb_fs_type) { term_printf("husb: unable to access USB VAR_3\n"); goto the_end; } usb_host_device_path = qemu_mallocz(strlen(VAR_6)+1); if (usb_host_device_path) { strcpy(usb_host_device_path, VAR_6); term_printf("husb: using %s file-system with %s\n", VAR_5[usb_fs_type], usb_host_device_path); } else { perror("husb: unable to allocate memory for device path"); goto the_end; } } switch (usb_fs_type) { case USB_FS_PROC: case USB_FS_DEV: VAR_2 = usb_host_scan_dev(VAR_0, VAR_1); break; case USB_FS_SYS: VAR_2 = usb_host_scan_sys(VAR_0, VAR_1); break; } the_end: return VAR_2; }
[ "static int FUNC_0(void *VAR_0, USBScanFunc *VAR_1)\n{", "FILE *f = 0;", "DIR *dir = 0;", "int VAR_2 = 0;", "const char *VAR_3 = \"/VAR_3\";", "const char *VAR_4 = \"husb: VAR_4 %s%s\\n\";", "const char *VAR_5[] = {\"unknown\", \"proc\", \"dev\", \"sys\"};", "char VAR_6[PATH_MAX];", "if (!usb_fs_type) {", "f = fopen(USBPROCBUS_PATH \"/VAR_3\", \"r\");", "if (f) {", "strcpy(VAR_6, USBPROCBUS_PATH);", "usb_fs_type = USB_FS_PROC;", "fclose(f);", "dprintf(VAR_4, USBPROCBUS_PATH, VAR_3);", "}", "f = fopen(USBDEVBUS_PATH \"/VAR_3\", \"r\");", "if (!usb_fs_type && f) {", "strcpy(VAR_6, USBDEVBUS_PATH);", "usb_fs_type = USB_FS_DEV;", "fclose(f);", "dprintf(VAR_4, USBDEVBUS_PATH, VAR_3);", "}", "dir = opendir(USBSYSBUS_PATH \"/VAR_3\");", "if (!usb_fs_type && dir) {", "strcpy(VAR_6, USBDEVBUS_PATH);", "usb_fs_type = USB_FS_SYS;", "closedir(dir);", "dprintf(VAR_4, USBSYSBUS_PATH, VAR_3);", "}", "if (!usb_fs_type) {", "term_printf(\"husb: unable to access USB VAR_3\\n\");", "goto the_end;", "}", "usb_host_device_path = qemu_mallocz(strlen(VAR_6)+1);", "if (usb_host_device_path) {", "strcpy(usb_host_device_path, VAR_6);", "term_printf(\"husb: using %s file-system with %s\\n\", VAR_5[usb_fs_type], usb_host_device_path);", "} else {", "perror(\"husb: unable to allocate memory for device path\");", "goto the_end;", "}", "}", "switch (usb_fs_type) {", "case USB_FS_PROC:\ncase USB_FS_DEV:\nVAR_2 = usb_host_scan_dev(VAR_0, VAR_1);", "break;", "case USB_FS_SYS:\nVAR_2 = usb_host_scan_sys(VAR_0, VAR_1);", "break;", "}", "the_end:\nreturn VAR_2;", "}" ]
[ 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, 1, 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 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 109 ], [ 111, 113, 115 ], [ 117 ], [ 119, 121 ], [ 123 ], [ 125 ], [ 127, 129 ], [ 131 ] ]
6,688
static void convert_matrix(DSPContext *dsp, int (*qmat)[64], uint16_t (*qmat16)[2][64], const uint16_t *quant_matrix, int bias, int qmin, int qmax, int intra) { int qscale; int shift=0; for(qscale=qmin; qscale<=qmax; qscale++){ int i; if (dsp->fdct == ff_jpeg_fdct_islow #ifdef FAAN_POSTSCALE || dsp->fdct == ff_faandct #endif ) { for(i=0;i<64;i++) { const int j= dsp->idct_permutation[i]; /* 16 <= qscale * quant_matrix[i] <= 7905 */ /* 19952 <= aanscales[i] * qscale * quant_matrix[i] <= 249205026 */ /* (1<<36)/19952 >= (1<<36)/(aanscales[i] * qscale * quant_matrix[i]) >= (1<<36)/249205026 */ /* 3444240 >= (1<<36)/(aanscales[i] * qscale * quant_matrix[i]) >= 275 */ qmat[qscale][i] = (int)((uint64_t_C(1) << QMAT_SHIFT) / (qscale * quant_matrix[j])); } } else if (dsp->fdct == fdct_ifast #ifndef FAAN_POSTSCALE || dsp->fdct == ff_faandct #endif ) { for(i=0;i<64;i++) { const int j= dsp->idct_permutation[i]; /* 16 <= qscale * quant_matrix[i] <= 7905 */ /* 19952 <= aanscales[i] * qscale * quant_matrix[i] <= 249205026 */ /* (1<<36)/19952 >= (1<<36)/(aanscales[i] * qscale * quant_matrix[i]) >= (1<<36)/249205026 */ /* 3444240 >= (1<<36)/(aanscales[i] * qscale * quant_matrix[i]) >= 275 */ qmat[qscale][i] = (int)((uint64_t_C(1) << (QMAT_SHIFT + 14)) / (aanscales[i] * qscale * quant_matrix[j])); } } else { for(i=0;i<64;i++) { const int j= dsp->idct_permutation[i]; /* We can safely suppose that 16 <= quant_matrix[i] <= 255 So 16 <= qscale * quant_matrix[i] <= 7905 so (1<<19) / 16 >= (1<<19) / (qscale * quant_matrix[i]) >= (1<<19) / 7905 so 32768 >= (1<<19) / (qscale * quant_matrix[i]) >= 67 */ qmat[qscale][i] = (int)((uint64_t_C(1) << QMAT_SHIFT) / (qscale * quant_matrix[j])); // qmat [qscale][i] = (1 << QMAT_SHIFT_MMX) / (qscale * quant_matrix[i]); qmat16[qscale][0][i] = (1 << QMAT_SHIFT_MMX) / (qscale * quant_matrix[j]); if(qmat16[qscale][0][i]==0 || qmat16[qscale][0][i]==128*256) qmat16[qscale][0][i]=128*256-1; qmat16[qscale][1][i]= ROUNDED_DIV(bias<<(16-QUANT_BIAS_SHIFT), qmat16[qscale][0][i]); } } for(i=intra; i<64; i++){ while(((8191LL * qmat[qscale][i]) >> shift) > INT_MAX){ shift++; } } } if(shift){ av_log(NULL, AV_LOG_INFO, "Warning, QMAT_SHIFT is larger then %d, overflows possible\n", QMAT_SHIFT - shift); } }
true
FFmpeg
3c9ec07ef2f7a761bf0418b4d806b50ef57c41f3
static void convert_matrix(DSPContext *dsp, int (*qmat)[64], uint16_t (*qmat16)[2][64], const uint16_t *quant_matrix, int bias, int qmin, int qmax, int intra) { int qscale; int shift=0; for(qscale=qmin; qscale<=qmax; qscale++){ int i; if (dsp->fdct == ff_jpeg_fdct_islow #ifdef FAAN_POSTSCALE || dsp->fdct == ff_faandct #endif ) { for(i=0;i<64;i++) { const int j= dsp->idct_permutation[i]; qmat[qscale][i] = (int)((uint64_t_C(1) << QMAT_SHIFT) / (qscale * quant_matrix[j])); } } else if (dsp->fdct == fdct_ifast #ifndef FAAN_POSTSCALE || dsp->fdct == ff_faandct #endif ) { for(i=0;i<64;i++) { const int j= dsp->idct_permutation[i]; qmat[qscale][i] = (int)((uint64_t_C(1) << (QMAT_SHIFT + 14)) / (aanscales[i] * qscale * quant_matrix[j])); } } else { for(i=0;i<64;i++) { const int j= dsp->idct_permutation[i]; qmat[qscale][i] = (int)((uint64_t_C(1) << QMAT_SHIFT) / (qscale * quant_matrix[j])); qmat16[qscale][0][i] = (1 << QMAT_SHIFT_MMX) / (qscale * quant_matrix[j]); if(qmat16[qscale][0][i]==0 || qmat16[qscale][0][i]==128*256) qmat16[qscale][0][i]=128*256-1; qmat16[qscale][1][i]= ROUNDED_DIV(bias<<(16-QUANT_BIAS_SHIFT), qmat16[qscale][0][i]); } } for(i=intra; i<64; i++){ while(((8191LL * qmat[qscale][i]) >> shift) > INT_MAX){ shift++; } } } if(shift){ av_log(NULL, AV_LOG_INFO, "Warning, QMAT_SHIFT is larger then %d, overflows possible\n", QMAT_SHIFT - shift); } }
{ "code": [ " while(((8191LL * qmat[qscale][i]) >> shift) > INT_MAX){ " ], "line_no": [ 113 ] }
static void FUNC_0(DSPContext *VAR_0, int (*VAR_1)[64], VAR_2 (*qmat16)[2][64], const VAR_2 *VAR_3, int VAR_4, int VAR_5, int VAR_6, int VAR_7) { int VAR_8; int VAR_9=0; for(VAR_8=VAR_5; VAR_8<=VAR_6; VAR_8++){ int VAR_10; if (VAR_0->fdct == ff_jpeg_fdct_islow #ifdef FAAN_POSTSCALE || VAR_0->fdct == ff_faandct #endif ) { for(VAR_10=0;VAR_10<64;VAR_10++) { const int VAR_12= VAR_0->idct_permutation[VAR_10]; VAR_1[VAR_8][VAR_10] = (int)((uint64_t_C(1) << QMAT_SHIFT) / (VAR_8 * VAR_3[VAR_12])); } } else if (VAR_0->fdct == fdct_ifast #ifndef FAAN_POSTSCALE || VAR_0->fdct == ff_faandct #endif ) { for(VAR_10=0;VAR_10<64;VAR_10++) { const int VAR_12= VAR_0->idct_permutation[VAR_10]; VAR_1[VAR_8][VAR_10] = (int)((uint64_t_C(1) << (QMAT_SHIFT + 14)) / (aanscales[VAR_10] * VAR_8 * VAR_3[VAR_12])); } } else { for(VAR_10=0;VAR_10<64;VAR_10++) { const int VAR_12= VAR_0->idct_permutation[VAR_10]; VAR_1[VAR_8][VAR_10] = (int)((uint64_t_C(1) << QMAT_SHIFT) / (VAR_8 * VAR_3[VAR_12])); qmat16[VAR_8][0][VAR_10] = (1 << QMAT_SHIFT_MMX) / (VAR_8 * VAR_3[VAR_12]); if(qmat16[VAR_8][0][VAR_10]==0 || qmat16[VAR_8][0][VAR_10]==128*256) qmat16[VAR_8][0][VAR_10]=128*256-1; qmat16[VAR_8][1][VAR_10]= ROUNDED_DIV(VAR_4<<(16-QUANT_BIAS_SHIFT), qmat16[VAR_8][0][VAR_10]); } } for(VAR_10=VAR_7; VAR_10<64; VAR_10++){ while(((8191LL * VAR_1[VAR_8][VAR_10]) >> VAR_9) > INT_MAX){ VAR_9++; } } } if(VAR_9){ av_log(NULL, AV_LOG_INFO, "Warning, QMAT_SHIFT is larger then %d, overflows possible\n", QMAT_SHIFT - VAR_9); } }
[ "static void FUNC_0(DSPContext *VAR_0, int (*VAR_1)[64], VAR_2 (*qmat16)[2][64],\nconst VAR_2 *VAR_3, int VAR_4, int VAR_5, int VAR_6, int VAR_7)\n{", "int VAR_8;", "int VAR_9=0;", "for(VAR_8=VAR_5; VAR_8<=VAR_6; VAR_8++){", "int VAR_10;", "if (VAR_0->fdct == ff_jpeg_fdct_islow\n#ifdef FAAN_POSTSCALE\n|| VAR_0->fdct == ff_faandct\n#endif\n) {", "for(VAR_10=0;VAR_10<64;VAR_10++) {", "const int VAR_12= VAR_0->idct_permutation[VAR_10];", "VAR_1[VAR_8][VAR_10] = (int)((uint64_t_C(1) << QMAT_SHIFT) /\n(VAR_8 * VAR_3[VAR_12]));", "}", "} else if (VAR_0->fdct == fdct_ifast", "#ifndef FAAN_POSTSCALE\n|| VAR_0->fdct == ff_faandct\n#endif\n) {", "for(VAR_10=0;VAR_10<64;VAR_10++) {", "const int VAR_12= VAR_0->idct_permutation[VAR_10];", "VAR_1[VAR_8][VAR_10] = (int)((uint64_t_C(1) << (QMAT_SHIFT + 14)) /\n(aanscales[VAR_10] * VAR_8 * VAR_3[VAR_12]));", "}", "} else {", "for(VAR_10=0;VAR_10<64;VAR_10++) {", "const int VAR_12= VAR_0->idct_permutation[VAR_10];", "VAR_1[VAR_8][VAR_10] = (int)((uint64_t_C(1) << QMAT_SHIFT) / (VAR_8 * VAR_3[VAR_12]));", "qmat16[VAR_8][0][VAR_10] = (1 << QMAT_SHIFT_MMX) / (VAR_8 * VAR_3[VAR_12]);", "if(qmat16[VAR_8][0][VAR_10]==0 || qmat16[VAR_8][0][VAR_10]==128*256) qmat16[VAR_8][0][VAR_10]=128*256-1;", "qmat16[VAR_8][1][VAR_10]= ROUNDED_DIV(VAR_4<<(16-QUANT_BIAS_SHIFT), qmat16[VAR_8][0][VAR_10]);", "}", "}", "for(VAR_10=VAR_7; VAR_10<64; VAR_10++){", "while(((8191LL * VAR_1[VAR_8][VAR_10]) >> VAR_9) > INT_MAX){", "VAR_9++;", "}", "}", "}", "if(VAR_9){", "av_log(NULL, AV_LOG_INFO, \"Warning, QMAT_SHIFT is larger then %d, overflows possible\\n\", QMAT_SHIFT - VAR_9);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17, 19, 21, 23, 25 ], [ 27 ], [ 29 ], [ 41, 43 ], [ 45 ], [ 47 ], [ 49, 51, 53, 55 ], [ 57 ], [ 59 ], [ 71, 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 93 ], [ 97 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ] ]
6,689
static int process_frame_obj(SANMVideoContext *ctx) { uint16_t codec, top, left, w, h; codec = bytestream2_get_le16u(&ctx->gb); left = bytestream2_get_le16u(&ctx->gb); top = bytestream2_get_le16u(&ctx->gb); w = bytestream2_get_le16u(&ctx->gb); h = bytestream2_get_le16u(&ctx->gb); if (ctx->width < left + w || ctx->height < top + h) { if (av_image_check_size(FFMAX(left + w, ctx->width), FFMAX(top + h, ctx->height), 0, ctx->avctx) < 0) avcodec_set_dimensions(ctx->avctx, FFMAX(left + w, ctx->width), FFMAX(top + h, ctx->height)); init_sizes(ctx, FFMAX(left + w, ctx->width), FFMAX(top + h, ctx->height)); if (init_buffers(ctx)) { av_log(ctx->avctx, AV_LOG_ERROR, "error resizing buffers\n"); return AVERROR(ENOMEM); bytestream2_skip(&ctx->gb, 4); av_dlog(ctx->avctx, "subcodec %d\n", codec); switch (codec) { case 1: case 3: return old_codec1(ctx, top, left, w, h); break; case 37: return old_codec37(ctx, top, left, w, h); break; case 47: return old_codec47(ctx, top, left, w, h); break; default: avpriv_request_sample(ctx->avctx, "unknown subcodec %d", codec); return AVERROR_PATCHWELCOME;
true
FFmpeg
9dd04f6d8cdd1c10c28b2cb4252c1a41df581915
static int process_frame_obj(SANMVideoContext *ctx) { uint16_t codec, top, left, w, h; codec = bytestream2_get_le16u(&ctx->gb); left = bytestream2_get_le16u(&ctx->gb); top = bytestream2_get_le16u(&ctx->gb); w = bytestream2_get_le16u(&ctx->gb); h = bytestream2_get_le16u(&ctx->gb); if (ctx->width < left + w || ctx->height < top + h) { if (av_image_check_size(FFMAX(left + w, ctx->width), FFMAX(top + h, ctx->height), 0, ctx->avctx) < 0) avcodec_set_dimensions(ctx->avctx, FFMAX(left + w, ctx->width), FFMAX(top + h, ctx->height)); init_sizes(ctx, FFMAX(left + w, ctx->width), FFMAX(top + h, ctx->height)); if (init_buffers(ctx)) { av_log(ctx->avctx, AV_LOG_ERROR, "error resizing buffers\n"); return AVERROR(ENOMEM); bytestream2_skip(&ctx->gb, 4); av_dlog(ctx->avctx, "subcodec %d\n", codec); switch (codec) { case 1: case 3: return old_codec1(ctx, top, left, w, h); break; case 37: return old_codec37(ctx, top, left, w, h); break; case 47: return old_codec47(ctx, top, left, w, h); break; default: avpriv_request_sample(ctx->avctx, "unknown subcodec %d", codec); return AVERROR_PATCHWELCOME;
{ "code": [], "line_no": [] }
static int FUNC_0(SANMVideoContext *VAR_0) { uint16_t codec, top, left, w, h; codec = bytestream2_get_le16u(&VAR_0->gb); left = bytestream2_get_le16u(&VAR_0->gb); top = bytestream2_get_le16u(&VAR_0->gb); w = bytestream2_get_le16u(&VAR_0->gb); h = bytestream2_get_le16u(&VAR_0->gb); if (VAR_0->width < left + w || VAR_0->height < top + h) { if (av_image_check_size(FFMAX(left + w, VAR_0->width), FFMAX(top + h, VAR_0->height), 0, VAR_0->avctx) < 0) avcodec_set_dimensions(VAR_0->avctx, FFMAX(left + w, VAR_0->width), FFMAX(top + h, VAR_0->height)); init_sizes(VAR_0, FFMAX(left + w, VAR_0->width), FFMAX(top + h, VAR_0->height)); if (init_buffers(VAR_0)) { av_log(VAR_0->avctx, AV_LOG_ERROR, "error resizing buffers\n"); return AVERROR(ENOMEM); bytestream2_skip(&VAR_0->gb, 4); av_dlog(VAR_0->avctx, "subcodec %d\n", codec); switch (codec) { case 1: case 3: return old_codec1(VAR_0, top, left, w, h); break; case 37: return old_codec37(VAR_0, top, left, w, h); break; case 47: return old_codec47(VAR_0, top, left, w, h); break; default: avpriv_request_sample(VAR_0->avctx, "unknown subcodec %d", codec); return AVERROR_PATCHWELCOME;
[ "static int FUNC_0(SANMVideoContext *VAR_0)\n{", "uint16_t codec, top, left, w, h;", "codec = bytestream2_get_le16u(&VAR_0->gb);", "left = bytestream2_get_le16u(&VAR_0->gb);", "top = bytestream2_get_le16u(&VAR_0->gb);", "w = bytestream2_get_le16u(&VAR_0->gb);", "h = bytestream2_get_le16u(&VAR_0->gb);", "if (VAR_0->width < left + w || VAR_0->height < top + h) {", "if (av_image_check_size(FFMAX(left + w, VAR_0->width),\nFFMAX(top + h, VAR_0->height), 0, VAR_0->avctx) < 0)\navcodec_set_dimensions(VAR_0->avctx, FFMAX(left + w, VAR_0->width),\nFFMAX(top + h, VAR_0->height));", "init_sizes(VAR_0, FFMAX(left + w, VAR_0->width),\nFFMAX(top + h, VAR_0->height));", "if (init_buffers(VAR_0)) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"error resizing buffers\\n\");", "return AVERROR(ENOMEM);", "bytestream2_skip(&VAR_0->gb, 4);", "av_dlog(VAR_0->avctx, \"subcodec %d\\n\", codec);", "switch (codec) {", "case 1:\ncase 3:\nreturn old_codec1(VAR_0, top, left, w, h);", "break;", "case 37:\nreturn old_codec37(VAR_0, top, left, w, h);", "break;", "case 47:\nreturn old_codec47(VAR_0, top, left, w, h);", "break;", "default:\navpriv_request_sample(VAR_0->avctx, \"unknown subcodec %d\", codec);", "return AVERROR_PATCHWELCOME;" ]
[ 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 ] ]
6,690
static int tgq_decode_mb(TgqContext *s, AVFrame *frame, int mb_y, int mb_x) { int mode; int i; int8_t dc[6]; mode = bytestream2_get_byte(&s->gb); if (mode > 12) { GetBitContext gb; init_get_bits8(&gb, s->gb.buffer, FFMIN(bytestream2_get_bytes_left(&s->gb), mode)); for (i = 0; i < 6; i++) tgq_decode_block(s, s->block[i], &gb); tgq_idct_put_mb(s, s->block, frame, mb_x, mb_y); bytestream2_skip(&s->gb, mode); } else { if (mode == 3) { memset(dc, bytestream2_get_byte(&s->gb), 4); dc[4] = bytestream2_get_byte(&s->gb); dc[5] = bytestream2_get_byte(&s->gb); } else if (mode == 6) { bytestream2_get_buffer(&s->gb, dc, 6); } else if (mode == 12) { for (i = 0; i < 6; i++) { dc[i] = bytestream2_get_byte(&s->gb); bytestream2_skip(&s->gb, 1); } } else { av_log(s->avctx, AV_LOG_ERROR, "unsupported mb mode %i\n", mode); return -1; } tgq_idct_put_mb_dconly(s, frame, mb_x, mb_y, dc); } return 0; }
true
FFmpeg
c447ab0e746c6b4d8d703a55190ae7444199e502
static int tgq_decode_mb(TgqContext *s, AVFrame *frame, int mb_y, int mb_x) { int mode; int i; int8_t dc[6]; mode = bytestream2_get_byte(&s->gb); if (mode > 12) { GetBitContext gb; init_get_bits8(&gb, s->gb.buffer, FFMIN(bytestream2_get_bytes_left(&s->gb), mode)); for (i = 0; i < 6; i++) tgq_decode_block(s, s->block[i], &gb); tgq_idct_put_mb(s, s->block, frame, mb_x, mb_y); bytestream2_skip(&s->gb, mode); } else { if (mode == 3) { memset(dc, bytestream2_get_byte(&s->gb), 4); dc[4] = bytestream2_get_byte(&s->gb); dc[5] = bytestream2_get_byte(&s->gb); } else if (mode == 6) { bytestream2_get_buffer(&s->gb, dc, 6); } else if (mode == 12) { for (i = 0; i < 6; i++) { dc[i] = bytestream2_get_byte(&s->gb); bytestream2_skip(&s->gb, 1); } } else { av_log(s->avctx, AV_LOG_ERROR, "unsupported mb mode %i\n", mode); return -1; } tgq_idct_put_mb_dconly(s, frame, mb_x, mb_y, dc); } return 0; }
{ "code": [ " init_get_bits8(&gb, s->gb.buffer, FFMIN(bytestream2_get_bytes_left(&s->gb), mode));" ], "line_no": [ 19 ] }
static int FUNC_0(TgqContext *VAR_0, AVFrame *VAR_1, int VAR_2, int VAR_3) { int VAR_4; int VAR_5; int8_t dc[6]; VAR_4 = bytestream2_get_byte(&VAR_0->gb); if (VAR_4 > 12) { GetBitContext gb; init_get_bits8(&gb, VAR_0->gb.buffer, FFMIN(bytestream2_get_bytes_left(&VAR_0->gb), VAR_4)); for (VAR_5 = 0; VAR_5 < 6; VAR_5++) tgq_decode_block(VAR_0, VAR_0->block[VAR_5], &gb); tgq_idct_put_mb(VAR_0, VAR_0->block, VAR_1, VAR_3, VAR_2); bytestream2_skip(&VAR_0->gb, VAR_4); } else { if (VAR_4 == 3) { memset(dc, bytestream2_get_byte(&VAR_0->gb), 4); dc[4] = bytestream2_get_byte(&VAR_0->gb); dc[5] = bytestream2_get_byte(&VAR_0->gb); } else if (VAR_4 == 6) { bytestream2_get_buffer(&VAR_0->gb, dc, 6); } else if (VAR_4 == 12) { for (VAR_5 = 0; VAR_5 < 6; VAR_5++) { dc[VAR_5] = bytestream2_get_byte(&VAR_0->gb); bytestream2_skip(&VAR_0->gb, 1); } } else { av_log(VAR_0->avctx, AV_LOG_ERROR, "unsupported mb VAR_4 %VAR_5\n", VAR_4); return -1; } tgq_idct_put_mb_dconly(VAR_0, VAR_1, VAR_3, VAR_2, dc); } return 0; }
[ "static int FUNC_0(TgqContext *VAR_0, AVFrame *VAR_1, int VAR_2, int VAR_3)\n{", "int VAR_4;", "int VAR_5;", "int8_t dc[6];", "VAR_4 = bytestream2_get_byte(&VAR_0->gb);", "if (VAR_4 > 12) {", "GetBitContext gb;", "init_get_bits8(&gb, VAR_0->gb.buffer, FFMIN(bytestream2_get_bytes_left(&VAR_0->gb), VAR_4));", "for (VAR_5 = 0; VAR_5 < 6; VAR_5++)", "tgq_decode_block(VAR_0, VAR_0->block[VAR_5], &gb);", "tgq_idct_put_mb(VAR_0, VAR_0->block, VAR_1, VAR_3, VAR_2);", "bytestream2_skip(&VAR_0->gb, VAR_4);", "} else {", "if (VAR_4 == 3) {", "memset(dc, bytestream2_get_byte(&VAR_0->gb), 4);", "dc[4] = bytestream2_get_byte(&VAR_0->gb);", "dc[5] = bytestream2_get_byte(&VAR_0->gb);", "} else if (VAR_4 == 6) {", "bytestream2_get_buffer(&VAR_0->gb, dc, 6);", "} else if (VAR_4 == 12) {", "for (VAR_5 = 0; VAR_5 < 6; VAR_5++) {", "dc[VAR_5] = bytestream2_get_byte(&VAR_0->gb);", "bytestream2_skip(&VAR_0->gb, 1);", "}", "} else {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"unsupported mb VAR_4 %VAR_5\\n\", VAR_4);", "return -1;", "}", "tgq_idct_put_mb_dconly(VAR_0, VAR_1, VAR_3, VAR_2, dc);", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 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 ] ]
6,691
static void stream_component_close(VideoState *is, int stream_index) { AVFormatContext *ic = is->ic; AVCodecContext *avctx; if (stream_index < 0 || stream_index >= ic->nb_streams) return; avctx = ic->streams[stream_index]->codec; switch(avctx->codec_type) { case AVMEDIA_TYPE_AUDIO: packet_queue_abort(&is->audioq); SDL_CloseAudio(); packet_queue_end(&is->audioq); av_free_packet(&is->audio_pkt); if (is->reformat_ctx) av_audio_convert_free(is->reformat_ctx); is->reformat_ctx = NULL; if (is->rdft) { av_rdft_end(is->rdft); av_freep(&is->rdft_data); } break; case AVMEDIA_TYPE_VIDEO: packet_queue_abort(&is->videoq); /* note: we also signal this mutex to make sure we deblock the video thread in all cases */ SDL_LockMutex(is->pictq_mutex); SDL_CondSignal(is->pictq_cond); SDL_UnlockMutex(is->pictq_mutex); SDL_WaitThread(is->video_tid, NULL); packet_queue_end(&is->videoq); break; case AVMEDIA_TYPE_SUBTITLE: packet_queue_abort(&is->subtitleq); /* note: we also signal this mutex to make sure we deblock the video thread in all cases */ SDL_LockMutex(is->subpq_mutex); is->subtitle_stream_changed = 1; SDL_CondSignal(is->subpq_cond); SDL_UnlockMutex(is->subpq_mutex); SDL_WaitThread(is->subtitle_tid, NULL); packet_queue_end(&is->subtitleq); break; default: break; } ic->streams[stream_index]->discard = AVDISCARD_ALL; avcodec_close(avctx); switch(avctx->codec_type) { case AVMEDIA_TYPE_AUDIO: is->audio_st = NULL; is->audio_stream = -1; break; case AVMEDIA_TYPE_VIDEO: is->video_st = NULL; is->video_stream = -1; break; case AVMEDIA_TYPE_SUBTITLE: is->subtitle_st = NULL; is->subtitle_stream = -1; break; default: break; } }
true
FFmpeg
f9324d5adda6147b3faad5970b6d88263397c76b
static void stream_component_close(VideoState *is, int stream_index) { AVFormatContext *ic = is->ic; AVCodecContext *avctx; if (stream_index < 0 || stream_index >= ic->nb_streams) return; avctx = ic->streams[stream_index]->codec; switch(avctx->codec_type) { case AVMEDIA_TYPE_AUDIO: packet_queue_abort(&is->audioq); SDL_CloseAudio(); packet_queue_end(&is->audioq); av_free_packet(&is->audio_pkt); if (is->reformat_ctx) av_audio_convert_free(is->reformat_ctx); is->reformat_ctx = NULL; if (is->rdft) { av_rdft_end(is->rdft); av_freep(&is->rdft_data); } break; case AVMEDIA_TYPE_VIDEO: packet_queue_abort(&is->videoq); SDL_LockMutex(is->pictq_mutex); SDL_CondSignal(is->pictq_cond); SDL_UnlockMutex(is->pictq_mutex); SDL_WaitThread(is->video_tid, NULL); packet_queue_end(&is->videoq); break; case AVMEDIA_TYPE_SUBTITLE: packet_queue_abort(&is->subtitleq); SDL_LockMutex(is->subpq_mutex); is->subtitle_stream_changed = 1; SDL_CondSignal(is->subpq_cond); SDL_UnlockMutex(is->subpq_mutex); SDL_WaitThread(is->subtitle_tid, NULL); packet_queue_end(&is->subtitleq); break; default: break; } ic->streams[stream_index]->discard = AVDISCARD_ALL; avcodec_close(avctx); switch(avctx->codec_type) { case AVMEDIA_TYPE_AUDIO: is->audio_st = NULL; is->audio_stream = -1; break; case AVMEDIA_TYPE_VIDEO: is->video_st = NULL; is->video_stream = -1; break; case AVMEDIA_TYPE_SUBTITLE: is->subtitle_st = NULL; is->subtitle_stream = -1; break; default: break; } }
{ "code": [], "line_no": [] }
static void FUNC_0(VideoState *VAR_0, int VAR_1) { AVFormatContext *ic = VAR_0->ic; AVCodecContext *avctx; if (VAR_1 < 0 || VAR_1 >= ic->nb_streams) return; avctx = ic->streams[VAR_1]->codec; switch(avctx->codec_type) { case AVMEDIA_TYPE_AUDIO: packet_queue_abort(&VAR_0->audioq); SDL_CloseAudio(); packet_queue_end(&VAR_0->audioq); av_free_packet(&VAR_0->audio_pkt); if (VAR_0->reformat_ctx) av_audio_convert_free(VAR_0->reformat_ctx); VAR_0->reformat_ctx = NULL; if (VAR_0->rdft) { av_rdft_end(VAR_0->rdft); av_freep(&VAR_0->rdft_data); } break; case AVMEDIA_TYPE_VIDEO: packet_queue_abort(&VAR_0->videoq); SDL_LockMutex(VAR_0->pictq_mutex); SDL_CondSignal(VAR_0->pictq_cond); SDL_UnlockMutex(VAR_0->pictq_mutex); SDL_WaitThread(VAR_0->video_tid, NULL); packet_queue_end(&VAR_0->videoq); break; case AVMEDIA_TYPE_SUBTITLE: packet_queue_abort(&VAR_0->subtitleq); SDL_LockMutex(VAR_0->subpq_mutex); VAR_0->subtitle_stream_changed = 1; SDL_CondSignal(VAR_0->subpq_cond); SDL_UnlockMutex(VAR_0->subpq_mutex); SDL_WaitThread(VAR_0->subtitle_tid, NULL); packet_queue_end(&VAR_0->subtitleq); break; default: break; } ic->streams[VAR_1]->discard = AVDISCARD_ALL; avcodec_close(avctx); switch(avctx->codec_type) { case AVMEDIA_TYPE_AUDIO: VAR_0->audio_st = NULL; VAR_0->audio_stream = -1; break; case AVMEDIA_TYPE_VIDEO: VAR_0->video_st = NULL; VAR_0->video_stream = -1; break; case AVMEDIA_TYPE_SUBTITLE: VAR_0->subtitle_st = NULL; VAR_0->subtitle_stream = -1; break; default: break; } }
[ "static void FUNC_0(VideoState *VAR_0, int VAR_1)\n{", "AVFormatContext *ic = VAR_0->ic;", "AVCodecContext *avctx;", "if (VAR_1 < 0 || VAR_1 >= ic->nb_streams)\nreturn;", "avctx = ic->streams[VAR_1]->codec;", "switch(avctx->codec_type) {", "case AVMEDIA_TYPE_AUDIO:\npacket_queue_abort(&VAR_0->audioq);", "SDL_CloseAudio();", "packet_queue_end(&VAR_0->audioq);", "av_free_packet(&VAR_0->audio_pkt);", "if (VAR_0->reformat_ctx)\nav_audio_convert_free(VAR_0->reformat_ctx);", "VAR_0->reformat_ctx = NULL;", "if (VAR_0->rdft) {", "av_rdft_end(VAR_0->rdft);", "av_freep(&VAR_0->rdft_data);", "}", "break;", "case AVMEDIA_TYPE_VIDEO:\npacket_queue_abort(&VAR_0->videoq);", "SDL_LockMutex(VAR_0->pictq_mutex);", "SDL_CondSignal(VAR_0->pictq_cond);", "SDL_UnlockMutex(VAR_0->pictq_mutex);", "SDL_WaitThread(VAR_0->video_tid, NULL);", "packet_queue_end(&VAR_0->videoq);", "break;", "case AVMEDIA_TYPE_SUBTITLE:\npacket_queue_abort(&VAR_0->subtitleq);", "SDL_LockMutex(VAR_0->subpq_mutex);", "VAR_0->subtitle_stream_changed = 1;", "SDL_CondSignal(VAR_0->subpq_cond);", "SDL_UnlockMutex(VAR_0->subpq_mutex);", "SDL_WaitThread(VAR_0->subtitle_tid, NULL);", "packet_queue_end(&VAR_0->subtitleq);", "break;", "default:\nbreak;", "}", "ic->streams[VAR_1]->discard = AVDISCARD_ALL;", "avcodec_close(avctx);", "switch(avctx->codec_type) {", "case AVMEDIA_TYPE_AUDIO:\nVAR_0->audio_st = NULL;", "VAR_0->audio_stream = -1;", "break;", "case AVMEDIA_TYPE_VIDEO:\nVAR_0->video_st = NULL;", "VAR_0->video_stream = -1;", "break;", "case AVMEDIA_TYPE_SUBTITLE:\nVAR_0->subtitle_st = NULL;", "VAR_0->subtitle_stream = -1;", "break;", "default:\nbreak;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11, 13 ], [ 15 ], [ 19 ], [ 21, 23 ], [ 27 ], [ 31 ], [ 33 ], [ 35, 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55, 57 ], [ 65 ], [ 67 ], [ 69 ], [ 73 ], [ 77 ], [ 79 ], [ 81, 83 ], [ 91 ], [ 93 ], [ 97 ], [ 99 ], [ 103 ], [ 107 ], [ 109 ], [ 111, 113 ], [ 115 ], [ 119 ], [ 121 ], [ 123 ], [ 125, 127 ], [ 129 ], [ 131 ], [ 133, 135 ], [ 137 ], [ 139 ], [ 141, 143 ], [ 145 ], [ 147 ], [ 149, 151 ], [ 153 ], [ 155 ] ]
6,692
void address_space_unmap(AddressSpace *as, void *buffer, hwaddr len, int is_write, hwaddr access_len) { if (buffer != bounce.buffer) { if (is_write) { ram_addr_t addr1 = qemu_ram_addr_from_host_nofail(buffer); while (access_len) { unsigned l; l = TARGET_PAGE_SIZE; if (l > access_len) l = access_len; invalidate_and_set_dirty(addr1, l); addr1 += l; access_len -= l; } } if (xen_enabled()) { xen_invalidate_map_cache_entry(buffer); } return; } if (is_write) { address_space_write(as, bounce.addr, bounce.buffer, access_len); } qemu_vfree(bounce.buffer); bounce.buffer = NULL; cpu_notify_map_clients(); }
true
qemu
7443b43758ba5eeca8f81ca15fe9fced8983be26
void address_space_unmap(AddressSpace *as, void *buffer, hwaddr len, int is_write, hwaddr access_len) { if (buffer != bounce.buffer) { if (is_write) { ram_addr_t addr1 = qemu_ram_addr_from_host_nofail(buffer); while (access_len) { unsigned l; l = TARGET_PAGE_SIZE; if (l > access_len) l = access_len; invalidate_and_set_dirty(addr1, l); addr1 += l; access_len -= l; } } if (xen_enabled()) { xen_invalidate_map_cache_entry(buffer); } return; } if (is_write) { address_space_write(as, bounce.addr, bounce.buffer, access_len); } qemu_vfree(bounce.buffer); bounce.buffer = NULL; cpu_notify_map_clients(); }
{ "code": [ " ram_addr_t addr1 = qemu_ram_addr_from_host_nofail(buffer);" ], "line_no": [ 11 ] }
void FUNC_0(AddressSpace *VAR_0, void *VAR_1, hwaddr VAR_2, int VAR_3, hwaddr VAR_4) { if (VAR_1 != bounce.VAR_1) { if (VAR_3) { ram_addr_t addr1 = qemu_ram_addr_from_host_nofail(VAR_1); while (VAR_4) { unsigned VAR_5; VAR_5 = TARGET_PAGE_SIZE; if (VAR_5 > VAR_4) VAR_5 = VAR_4; invalidate_and_set_dirty(addr1, VAR_5); addr1 += VAR_5; VAR_4 -= VAR_5; } } if (xen_enabled()) { xen_invalidate_map_cache_entry(VAR_1); } return; } if (VAR_3) { address_space_write(VAR_0, bounce.addr, bounce.VAR_1, VAR_4); } qemu_vfree(bounce.VAR_1); bounce.VAR_1 = NULL; cpu_notify_map_clients(); }
[ "void FUNC_0(AddressSpace *VAR_0, void *VAR_1, hwaddr VAR_2,\nint VAR_3, hwaddr VAR_4)\n{", "if (VAR_1 != bounce.VAR_1) {", "if (VAR_3) {", "ram_addr_t addr1 = qemu_ram_addr_from_host_nofail(VAR_1);", "while (VAR_4) {", "unsigned VAR_5;", "VAR_5 = TARGET_PAGE_SIZE;", "if (VAR_5 > VAR_4)\nVAR_5 = VAR_4;", "invalidate_and_set_dirty(addr1, VAR_5);", "addr1 += VAR_5;", "VAR_4 -= VAR_5;", "}", "}", "if (xen_enabled()) {", "xen_invalidate_map_cache_entry(VAR_1);", "}", "return;", "}", "if (VAR_3) {", "address_space_write(VAR_0, bounce.addr, bounce.VAR_1, VAR_4);", "}", "qemu_vfree(bounce.VAR_1);", "bounce.VAR_1 = NULL;", "cpu_notify_map_clients();", "}" ]
[ 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, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19, 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ] ]
6,693
static inline void idct4col_put(uint8_t *dest, int line_size, const int16_t *col) { int c0, c1, c2, c3, a0, a1, a2, a3; a0 = col[8*0]; a1 = col[8*2]; a2 = col[8*4]; a3 = col[8*6]; c0 = ((a0 + a2) << (CN_SHIFT - 1)) + (1 << (C_SHIFT - 1)); c2 = ((a0 - a2) << (CN_SHIFT - 1)) + (1 << (C_SHIFT - 1)); c1 = a1 * C1 + a3 * C2; c3 = a1 * C2 - a3 * C1; dest[0] = av_clip_uint8((c0 + c1) >> C_SHIFT); dest += line_size; dest[0] = av_clip_uint8((c2 + c3) >> C_SHIFT); dest += line_size; dest[0] = av_clip_uint8((c2 - c3) >> C_SHIFT); dest += line_size; dest[0] = av_clip_uint8((c0 - c1) >> C_SHIFT); }
true
FFmpeg
28dc6e729137ba7927f46ba15c337417b8708fe8
static inline void idct4col_put(uint8_t *dest, int line_size, const int16_t *col) { int c0, c1, c2, c3, a0, a1, a2, a3; a0 = col[8*0]; a1 = col[8*2]; a2 = col[8*4]; a3 = col[8*6]; c0 = ((a0 + a2) << (CN_SHIFT - 1)) + (1 << (C_SHIFT - 1)); c2 = ((a0 - a2) << (CN_SHIFT - 1)) + (1 << (C_SHIFT - 1)); c1 = a1 * C1 + a3 * C2; c3 = a1 * C2 - a3 * C1; dest[0] = av_clip_uint8((c0 + c1) >> C_SHIFT); dest += line_size; dest[0] = av_clip_uint8((c2 + c3) >> C_SHIFT); dest += line_size; dest[0] = av_clip_uint8((c2 - c3) >> C_SHIFT); dest += line_size; dest[0] = av_clip_uint8((c0 - c1) >> C_SHIFT); }
{ "code": [ " c0 = ((a0 + a2) << (CN_SHIFT - 1)) + (1 << (C_SHIFT - 1));", " c2 = ((a0 - a2) << (CN_SHIFT - 1)) + (1 << (C_SHIFT - 1));" ], "line_no": [ 17, 19 ] }
static inline void FUNC_0(uint8_t *VAR_0, int VAR_1, const int16_t *VAR_2) { int VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10; VAR_7 = VAR_2[8*0]; VAR_8 = VAR_2[8*2]; VAR_9 = VAR_2[8*4]; VAR_10 = VAR_2[8*6]; VAR_3 = ((VAR_7 + VAR_9) << (CN_SHIFT - 1)) + (1 << (C_SHIFT - 1)); VAR_5 = ((VAR_7 - VAR_9) << (CN_SHIFT - 1)) + (1 << (C_SHIFT - 1)); VAR_4 = VAR_8 * C1 + VAR_10 * C2; VAR_6 = VAR_8 * C2 - VAR_10 * C1; VAR_0[0] = av_clip_uint8((VAR_3 + VAR_4) >> C_SHIFT); VAR_0 += VAR_1; VAR_0[0] = av_clip_uint8((VAR_5 + VAR_6) >> C_SHIFT); VAR_0 += VAR_1; VAR_0[0] = av_clip_uint8((VAR_5 - VAR_6) >> C_SHIFT); VAR_0 += VAR_1; VAR_0[0] = av_clip_uint8((VAR_3 - VAR_4) >> C_SHIFT); }
[ "static inline void FUNC_0(uint8_t *VAR_0, int VAR_1, const int16_t *VAR_2)\n{", "int VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10;", "VAR_7 = VAR_2[8*0];", "VAR_8 = VAR_2[8*2];", "VAR_9 = VAR_2[8*4];", "VAR_10 = VAR_2[8*6];", "VAR_3 = ((VAR_7 + VAR_9) << (CN_SHIFT - 1)) + (1 << (C_SHIFT - 1));", "VAR_5 = ((VAR_7 - VAR_9) << (CN_SHIFT - 1)) + (1 << (C_SHIFT - 1));", "VAR_4 = VAR_8 * C1 + VAR_10 * C2;", "VAR_6 = VAR_8 * C2 - VAR_10 * C1;", "VAR_0[0] = av_clip_uint8((VAR_3 + VAR_4) >> C_SHIFT);", "VAR_0 += VAR_1;", "VAR_0[0] = av_clip_uint8((VAR_5 + VAR_6) >> C_SHIFT);", "VAR_0 += VAR_1;", "VAR_0[0] = av_clip_uint8((VAR_5 - VAR_6) >> C_SHIFT);", "VAR_0 += VAR_1;", "VAR_0[0] = av_clip_uint8((VAR_3 - VAR_4) >> C_SHIFT);", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 1, 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 ] ]
6,694
int mmubooke_get_physical_address (CPUState *env, mmu_ctx_t *ctx, target_ulong address, int rw, int access_type) { ppcemb_tlb_t *tlb; target_phys_addr_t raddr; int i, prot, ret; ret = -1; raddr = -1; for (i = 0; i < env->nb_tlb; i++) { tlb = &env->tlb[i].tlbe; if (ppcemb_tlb_check(env, tlb, &raddr, address, env->spr[SPR_BOOKE_PID], 1, i) < 0) continue; if (msr_pr != 0) prot = tlb->prot & 0xF; else prot = (tlb->prot >> 4) & 0xF; /* Check the address space */ if (access_type == ACCESS_CODE) { if (msr_ir != (tlb->attr & 1)) continue; ctx->prot = prot; if (prot & PAGE_EXEC) { ret = 0; break; } ret = -3; } else { if (msr_dr != (tlb->attr & 1)) continue; ctx->prot = prot; if ((!rw && prot & PAGE_READ) || (rw && (prot & PAGE_WRITE))) { ret = 0; break; } ret = -2; } } if (ret >= 0) ctx->raddr = raddr; return ret; }
true
qemu
6f2d8978728c48ca46f5c01835438508aace5c64
int mmubooke_get_physical_address (CPUState *env, mmu_ctx_t *ctx, target_ulong address, int rw, int access_type) { ppcemb_tlb_t *tlb; target_phys_addr_t raddr; int i, prot, ret; ret = -1; raddr = -1; for (i = 0; i < env->nb_tlb; i++) { tlb = &env->tlb[i].tlbe; if (ppcemb_tlb_check(env, tlb, &raddr, address, env->spr[SPR_BOOKE_PID], 1, i) < 0) continue; if (msr_pr != 0) prot = tlb->prot & 0xF; else prot = (tlb->prot >> 4) & 0xF; if (access_type == ACCESS_CODE) { if (msr_ir != (tlb->attr & 1)) continue; ctx->prot = prot; if (prot & PAGE_EXEC) { ret = 0; break; } ret = -3; } else { if (msr_dr != (tlb->attr & 1)) continue; ctx->prot = prot; if ((!rw && prot & PAGE_READ) || (rw && (prot & PAGE_WRITE))) { ret = 0; break; } ret = -2; } } if (ret >= 0) ctx->raddr = raddr; return ret; }
{ "code": [ " raddr = -1;", " raddr = -1;" ], "line_no": [ 19, 19 ] }
int FUNC_0 (CPUState *VAR_0, mmu_ctx_t *VAR_1, target_ulong VAR_2, int VAR_3, int VAR_4) { ppcemb_tlb_t *tlb; target_phys_addr_t raddr; int VAR_5, VAR_6, VAR_7; VAR_7 = -1; raddr = -1; for (VAR_5 = 0; VAR_5 < VAR_0->nb_tlb; VAR_5++) { tlb = &VAR_0->tlb[VAR_5].tlbe; if (ppcemb_tlb_check(VAR_0, tlb, &raddr, VAR_2, VAR_0->spr[SPR_BOOKE_PID], 1, VAR_5) < 0) continue; if (msr_pr != 0) VAR_6 = tlb->VAR_6 & 0xF; else VAR_6 = (tlb->VAR_6 >> 4) & 0xF; if (VAR_4 == ACCESS_CODE) { if (msr_ir != (tlb->attr & 1)) continue; VAR_1->VAR_6 = VAR_6; if (VAR_6 & PAGE_EXEC) { VAR_7 = 0; break; } VAR_7 = -3; } else { if (msr_dr != (tlb->attr & 1)) continue; VAR_1->VAR_6 = VAR_6; if ((!VAR_3 && VAR_6 & PAGE_READ) || (VAR_3 && (VAR_6 & PAGE_WRITE))) { VAR_7 = 0; break; } VAR_7 = -2; } } if (VAR_7 >= 0) VAR_1->raddr = raddr; return VAR_7; }
[ "int FUNC_0 (CPUState *VAR_0, mmu_ctx_t *VAR_1,\ntarget_ulong VAR_2, int VAR_3,\nint VAR_4)\n{", "ppcemb_tlb_t *tlb;", "target_phys_addr_t raddr;", "int VAR_5, VAR_6, VAR_7;", "VAR_7 = -1;", "raddr = -1;", "for (VAR_5 = 0; VAR_5 < VAR_0->nb_tlb; VAR_5++) {", "tlb = &VAR_0->tlb[VAR_5].tlbe;", "if (ppcemb_tlb_check(VAR_0, tlb, &raddr, VAR_2,\nVAR_0->spr[SPR_BOOKE_PID], 1, VAR_5) < 0)\ncontinue;", "if (msr_pr != 0)\nVAR_6 = tlb->VAR_6 & 0xF;", "else\nVAR_6 = (tlb->VAR_6 >> 4) & 0xF;", "if (VAR_4 == ACCESS_CODE) {", "if (msr_ir != (tlb->attr & 1))\ncontinue;", "VAR_1->VAR_6 = VAR_6;", "if (VAR_6 & PAGE_EXEC) {", "VAR_7 = 0;", "break;", "}", "VAR_7 = -3;", "} else {", "if (msr_dr != (tlb->attr & 1))\ncontinue;", "VAR_1->VAR_6 = VAR_6;", "if ((!VAR_3 && VAR_6 & PAGE_READ) || (VAR_3 && (VAR_6 & PAGE_WRITE))) {", "VAR_7 = 0;", "break;", "}", "VAR_7 = -2;", "}", "}", "if (VAR_7 >= 0)\nVAR_1->raddr = raddr;", "return VAR_7;", "}" ]
[ 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 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25, 27, 29 ], [ 31, 33 ], [ 35, 37 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61, 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81, 83 ], [ 87 ], [ 89 ] ]
6,695
void fifo_realloc(FifoBuffer *f, int new_size){ int old_size= f->end - f->buffer; if(old_size < new_size){ uint8_t *old= f->buffer; f->buffer= av_realloc(f->buffer, new_size); f->rptr += f->buffer - old; f->wptr += f->buffer - old; if(f->wptr < f->rptr){ memmove(f->rptr + new_size - old_size, f->rptr, f->buffer + old_size - f->rptr); f->rptr += new_size - old_size; } f->end= f->buffer + new_size; } }
true
FFmpeg
568e18b15e2ddf494fd8926707d34ca08c8edce5
void fifo_realloc(FifoBuffer *f, int new_size){ int old_size= f->end - f->buffer; if(old_size < new_size){ uint8_t *old= f->buffer; f->buffer= av_realloc(f->buffer, new_size); f->rptr += f->buffer - old; f->wptr += f->buffer - old; if(f->wptr < f->rptr){ memmove(f->rptr + new_size - old_size, f->rptr, f->buffer + old_size - f->rptr); f->rptr += new_size - old_size; } f->end= f->buffer + new_size; } }
{ "code": [ "void fifo_realloc(FifoBuffer *f, int new_size){", " int old_size= f->end - f->buffer;" ], "line_no": [ 1, 3 ] }
void FUNC_0(FifoBuffer *VAR_0, int VAR_1){ int VAR_2= VAR_0->end - VAR_0->buffer; if(VAR_2 < VAR_1){ uint8_t *old= VAR_0->buffer; VAR_0->buffer= av_realloc(VAR_0->buffer, VAR_1); VAR_0->rptr += VAR_0->buffer - old; VAR_0->wptr += VAR_0->buffer - old; if(VAR_0->wptr < VAR_0->rptr){ memmove(VAR_0->rptr + VAR_1 - VAR_2, VAR_0->rptr, VAR_0->buffer + VAR_2 - VAR_0->rptr); VAR_0->rptr += VAR_1 - VAR_2; } VAR_0->end= VAR_0->buffer + VAR_1; } }
[ "void FUNC_0(FifoBuffer *VAR_0, int VAR_1){", "int VAR_2= VAR_0->end - VAR_0->buffer;", "if(VAR_2 < VAR_1){", "uint8_t *old= VAR_0->buffer;", "VAR_0->buffer= av_realloc(VAR_0->buffer, VAR_1);", "VAR_0->rptr += VAR_0->buffer - old;", "VAR_0->wptr += VAR_0->buffer - old;", "if(VAR_0->wptr < VAR_0->rptr){", "memmove(VAR_0->rptr + VAR_1 - VAR_2, VAR_0->rptr, VAR_0->buffer + VAR_2 - VAR_0->rptr);", "VAR_0->rptr += VAR_1 - VAR_2;", "}", "VAR_0->end= VAR_0->buffer + VAR_1;", "}", "}" ]
[ 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 7 ], [ 9 ], [ 13 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ] ]
6,696
FFAMediaCodec* ff_AMediaCodec_createDecoderByType(const char *mime) { JNIEnv *env = NULL; FFAMediaCodec *codec = NULL; jstring mime_type = NULL; codec = av_mallocz(sizeof(FFAMediaCodec)); if (!codec) { return NULL; } codec->class = &amediacodec_class; env = ff_jni_get_env(codec); if (!env) { av_freep(&codec); return NULL; } if (ff_jni_init_jfields(env, &codec->jfields, jni_amediacodec_mapping, 1, codec) < 0) { goto fail; } mime_type = ff_jni_utf_chars_to_jstring(env, mime, codec); if (!mime_type) { goto fail; } codec->object = (*env)->CallStaticObjectMethod(env, codec->jfields.mediacodec_class, codec->jfields.create_decoder_by_type_id, mime_type); if (ff_jni_exception_check(env, 1, codec) < 0) { goto fail; } codec->object = (*env)->NewGlobalRef(env, codec->object); if (!codec->object) { goto fail; } if (codec_init_static_fields(codec) < 0) { goto fail; } if (codec->jfields.get_input_buffer_id && codec->jfields.get_output_buffer_id) { codec->has_get_i_o_buffer = 1; } return codec; fail: ff_jni_reset_jfields(env, &codec->jfields, jni_amediacodec_mapping, 1, codec); if (mime_type) { (*env)->DeleteLocalRef(env, mime_type); } av_freep(&codec); return NULL; }
true
FFmpeg
1795dccde0ad22fc8201142f92fb8d58c234f3e4
FFAMediaCodec* ff_AMediaCodec_createDecoderByType(const char *mime) { JNIEnv *env = NULL; FFAMediaCodec *codec = NULL; jstring mime_type = NULL; codec = av_mallocz(sizeof(FFAMediaCodec)); if (!codec) { return NULL; } codec->class = &amediacodec_class; env = ff_jni_get_env(codec); if (!env) { av_freep(&codec); return NULL; } if (ff_jni_init_jfields(env, &codec->jfields, jni_amediacodec_mapping, 1, codec) < 0) { goto fail; } mime_type = ff_jni_utf_chars_to_jstring(env, mime, codec); if (!mime_type) { goto fail; } codec->object = (*env)->CallStaticObjectMethod(env, codec->jfields.mediacodec_class, codec->jfields.create_decoder_by_type_id, mime_type); if (ff_jni_exception_check(env, 1, codec) < 0) { goto fail; } codec->object = (*env)->NewGlobalRef(env, codec->object); if (!codec->object) { goto fail; } if (codec_init_static_fields(codec) < 0) { goto fail; } if (codec->jfields.get_input_buffer_id && codec->jfields.get_output_buffer_id) { codec->has_get_i_o_buffer = 1; } return codec; fail: ff_jni_reset_jfields(env, &codec->jfields, jni_amediacodec_mapping, 1, codec); if (mime_type) { (*env)->DeleteLocalRef(env, mime_type); } av_freep(&codec); return NULL; }
{ "code": [ " codec->object = (*env)->NewGlobalRef(env, codec->object);", " return codec;", " ff_jni_reset_jfields(env, &codec->jfields, jni_amediacodec_mapping, 1, codec);", " av_freep(&codec);", " return NULL;", " codec->object = (*env)->CallStaticObjectMethod(env, codec->jfields.mediacodec_class, codec->jfields.create_decoder_by_type_id, mime_type);", " codec->object = (*env)->NewGlobalRef(env, codec->object);", " return codec;", " ff_jni_reset_jfields(env, &codec->jfields, jni_amediacodec_mapping, 1, codec);", " av_freep(&codec);", " return NULL;", " codec->object = (*env)->NewGlobalRef(env, codec->object);", " return codec;", " ff_jni_reset_jfields(env, &codec->jfields, jni_amediacodec_mapping, 1, codec);", " av_freep(&codec);", " return NULL;" ], "line_no": [ 65, 91, 95, 107, 111, 55, 65, 91, 95, 107, 111, 65, 91, 95, 107, 111 ] }
FFAMediaCodec* FUNC_0(const char *mime) { JNIEnv *env = NULL; FFAMediaCodec *codec = NULL; jstring mime_type = NULL; codec = av_mallocz(sizeof(FFAMediaCodec)); if (!codec) { return NULL; } codec->class = &amediacodec_class; env = ff_jni_get_env(codec); if (!env) { av_freep(&codec); return NULL; } if (ff_jni_init_jfields(env, &codec->jfields, jni_amediacodec_mapping, 1, codec) < 0) { goto fail; } mime_type = ff_jni_utf_chars_to_jstring(env, mime, codec); if (!mime_type) { goto fail; } codec->object = (*env)->CallStaticObjectMethod(env, codec->jfields.mediacodec_class, codec->jfields.create_decoder_by_type_id, mime_type); if (ff_jni_exception_check(env, 1, codec) < 0) { goto fail; } codec->object = (*env)->NewGlobalRef(env, codec->object); if (!codec->object) { goto fail; } if (codec_init_static_fields(codec) < 0) { goto fail; } if (codec->jfields.get_input_buffer_id && codec->jfields.get_output_buffer_id) { codec->has_get_i_o_buffer = 1; } return codec; fail: ff_jni_reset_jfields(env, &codec->jfields, jni_amediacodec_mapping, 1, codec); if (mime_type) { (*env)->DeleteLocalRef(env, mime_type); } av_freep(&codec); return NULL; }
[ "FFAMediaCodec* FUNC_0(const char *mime)\n{", "JNIEnv *env = NULL;", "FFAMediaCodec *codec = NULL;", "jstring mime_type = NULL;", "codec = av_mallocz(sizeof(FFAMediaCodec));", "if (!codec) {", "return NULL;", "}", "codec->class = &amediacodec_class;", "env = ff_jni_get_env(codec);", "if (!env) {", "av_freep(&codec);", "return NULL;", "}", "if (ff_jni_init_jfields(env, &codec->jfields, jni_amediacodec_mapping, 1, codec) < 0) {", "goto fail;", "}", "mime_type = ff_jni_utf_chars_to_jstring(env, mime, codec);", "if (!mime_type) {", "goto fail;", "}", "codec->object = (*env)->CallStaticObjectMethod(env, codec->jfields.mediacodec_class, codec->jfields.create_decoder_by_type_id, mime_type);", "if (ff_jni_exception_check(env, 1, codec) < 0) {", "goto fail;", "}", "codec->object = (*env)->NewGlobalRef(env, codec->object);", "if (!codec->object) {", "goto fail;", "}", "if (codec_init_static_fields(codec) < 0) {", "goto fail;", "}", "if (codec->jfields.get_input_buffer_id && codec->jfields.get_output_buffer_id) {", "codec->has_get_i_o_buffer = 1;", "}", "return codec;", "fail:\nff_jni_reset_jfields(env, &codec->jfields, jni_amediacodec_mapping, 1, codec);", "if (mime_type) {", "(*env)->DeleteLocalRef(env, mime_type);", "}", "av_freep(&codec);", "return NULL;", "}" ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 85 ], [ 87 ], [ 91 ], [ 93, 95 ], [ 99 ], [ 101 ], [ 103 ], [ 107 ], [ 111 ], [ 113 ] ]
6,698
int vnc_tls_validate_certificate(VncState *vs) { int ret; unsigned int status; const gnutls_datum_t *certs; unsigned int nCerts, i; time_t now; VNC_DEBUG("Validating client certificate\n"); if ((ret = gnutls_certificate_verify_peers2 (vs->tls.session, &status)) < 0) { VNC_DEBUG("Verify failed %s\n", gnutls_strerror(ret)); return -1; } if ((now = time(NULL)) == ((time_t)-1)) { return -1; } if (status != 0) { if (status & GNUTLS_CERT_INVALID) VNC_DEBUG("The certificate is not trusted.\n"); if (status & GNUTLS_CERT_SIGNER_NOT_FOUND) VNC_DEBUG("The certificate hasn't got a known issuer.\n"); if (status & GNUTLS_CERT_REVOKED) VNC_DEBUG("The certificate has been revoked.\n"); if (status & GNUTLS_CERT_INSECURE_ALGORITHM) VNC_DEBUG("The certificate uses an insecure algorithm\n"); return -1; } else { VNC_DEBUG("Certificate is valid!\n"); } /* Only support x509 for now */ if (gnutls_certificate_type_get(vs->tls.session) != GNUTLS_CRT_X509) return -1; if (!(certs = gnutls_certificate_get_peers(vs->tls.session, &nCerts))) return -1; for (i = 0 ; i < nCerts ; i++) { gnutls_x509_crt_t cert; VNC_DEBUG ("Checking certificate chain %d\n", i); if (gnutls_x509_crt_init (&cert) < 0) return -1; if (gnutls_x509_crt_import(cert, &certs[i], GNUTLS_X509_FMT_DER) < 0) { gnutls_x509_crt_deinit (cert); return -1; } if (gnutls_x509_crt_get_expiration_time (cert) < now) { VNC_DEBUG("The certificate has expired\n"); gnutls_x509_crt_deinit (cert); return -1; } if (gnutls_x509_crt_get_activation_time (cert) > now) { VNC_DEBUG("The certificate is not yet activated\n"); gnutls_x509_crt_deinit (cert); return -1; } if (gnutls_x509_crt_get_activation_time (cert) > now) { VNC_DEBUG("The certificate is not yet activated\n"); gnutls_x509_crt_deinit (cert); return -1; } if (i == 0) { size_t dnameSize = 1024; vs->tls.dname = g_malloc(dnameSize); requery: if ((ret = gnutls_x509_crt_get_dn (cert, vs->tls.dname, &dnameSize)) != 0) { if (ret == GNUTLS_E_SHORT_MEMORY_BUFFER) { vs->tls.dname = g_realloc(vs->tls.dname, dnameSize); goto requery; } gnutls_x509_crt_deinit (cert); VNC_DEBUG("Cannot get client distinguished name: %s", gnutls_strerror (ret)); return -1; } if (vs->vd->tls.x509verify) { int allow; if (!vs->vd->tls.acl) { VNC_DEBUG("no ACL activated, allowing access"); gnutls_x509_crt_deinit (cert); continue; } allow = qemu_acl_party_is_allowed(vs->vd->tls.acl, vs->tls.dname); VNC_DEBUG("TLS x509 ACL check for %s is %s\n", vs->tls.dname, allow ? "allowed" : "denied"); if (!allow) { gnutls_x509_crt_deinit (cert); return -1; } } } gnutls_x509_crt_deinit (cert); } return 0; }
true
qemu
3e305e4a4752f70c0b5c3cf5b43ec957881714f7
int vnc_tls_validate_certificate(VncState *vs) { int ret; unsigned int status; const gnutls_datum_t *certs; unsigned int nCerts, i; time_t now; VNC_DEBUG("Validating client certificate\n"); if ((ret = gnutls_certificate_verify_peers2 (vs->tls.session, &status)) < 0) { VNC_DEBUG("Verify failed %s\n", gnutls_strerror(ret)); return -1; } if ((now = time(NULL)) == ((time_t)-1)) { return -1; } if (status != 0) { if (status & GNUTLS_CERT_INVALID) VNC_DEBUG("The certificate is not trusted.\n"); if (status & GNUTLS_CERT_SIGNER_NOT_FOUND) VNC_DEBUG("The certificate hasn't got a known issuer.\n"); if (status & GNUTLS_CERT_REVOKED) VNC_DEBUG("The certificate has been revoked.\n"); if (status & GNUTLS_CERT_INSECURE_ALGORITHM) VNC_DEBUG("The certificate uses an insecure algorithm\n"); return -1; } else { VNC_DEBUG("Certificate is valid!\n"); } if (gnutls_certificate_type_get(vs->tls.session) != GNUTLS_CRT_X509) return -1; if (!(certs = gnutls_certificate_get_peers(vs->tls.session, &nCerts))) return -1; for (i = 0 ; i < nCerts ; i++) { gnutls_x509_crt_t cert; VNC_DEBUG ("Checking certificate chain %d\n", i); if (gnutls_x509_crt_init (&cert) < 0) return -1; if (gnutls_x509_crt_import(cert, &certs[i], GNUTLS_X509_FMT_DER) < 0) { gnutls_x509_crt_deinit (cert); return -1; } if (gnutls_x509_crt_get_expiration_time (cert) < now) { VNC_DEBUG("The certificate has expired\n"); gnutls_x509_crt_deinit (cert); return -1; } if (gnutls_x509_crt_get_activation_time (cert) > now) { VNC_DEBUG("The certificate is not yet activated\n"); gnutls_x509_crt_deinit (cert); return -1; } if (gnutls_x509_crt_get_activation_time (cert) > now) { VNC_DEBUG("The certificate is not yet activated\n"); gnutls_x509_crt_deinit (cert); return -1; } if (i == 0) { size_t dnameSize = 1024; vs->tls.dname = g_malloc(dnameSize); requery: if ((ret = gnutls_x509_crt_get_dn (cert, vs->tls.dname, &dnameSize)) != 0) { if (ret == GNUTLS_E_SHORT_MEMORY_BUFFER) { vs->tls.dname = g_realloc(vs->tls.dname, dnameSize); goto requery; } gnutls_x509_crt_deinit (cert); VNC_DEBUG("Cannot get client distinguished name: %s", gnutls_strerror (ret)); return -1; } if (vs->vd->tls.x509verify) { int allow; if (!vs->vd->tls.acl) { VNC_DEBUG("no ACL activated, allowing access"); gnutls_x509_crt_deinit (cert); continue; } allow = qemu_acl_party_is_allowed(vs->vd->tls.acl, vs->tls.dname); VNC_DEBUG("TLS x509 ACL check for %s is %s\n", vs->tls.dname, allow ? "allowed" : "denied"); if (!allow) { gnutls_x509_crt_deinit (cert); return -1; } } } gnutls_x509_crt_deinit (cert); } return 0; }
{ "code": [ " int ret;", " return -1;", " int ret;", " return -1;", " int ret;", " return -1;", " int ret;", " int ret;", "int vnc_tls_validate_certificate(VncState *vs)", " int ret;", " unsigned int status;", " const gnutls_datum_t *certs;", " unsigned int nCerts, i;", " time_t now;", " VNC_DEBUG(\"Validating client certificate\\n\");", " if ((ret = gnutls_certificate_verify_peers2 (vs->tls.session, &status)) < 0) {", " VNC_DEBUG(\"Verify failed %s\\n\", gnutls_strerror(ret));", " return -1;", " if ((now = time(NULL)) == ((time_t)-1)) {", " return -1;", " if (status != 0) {", " if (status & GNUTLS_CERT_INVALID)", " VNC_DEBUG(\"The certificate is not trusted.\\n\");", " if (status & GNUTLS_CERT_SIGNER_NOT_FOUND)", " VNC_DEBUG(\"The certificate hasn't got a known issuer.\\n\");", " if (status & GNUTLS_CERT_REVOKED)", " VNC_DEBUG(\"The certificate has been revoked.\\n\");", " if (status & GNUTLS_CERT_INSECURE_ALGORITHM)", " VNC_DEBUG(\"The certificate uses an insecure algorithm\\n\");", " return -1;", " } else {", " VNC_DEBUG(\"Certificate is valid!\\n\");", " if (gnutls_certificate_type_get(vs->tls.session) != GNUTLS_CRT_X509)", " return -1;", " if (!(certs = gnutls_certificate_get_peers(vs->tls.session, &nCerts)))", " return -1;", " for (i = 0 ; i < nCerts ; i++) {", " gnutls_x509_crt_t cert;", " VNC_DEBUG (\"Checking certificate chain %d\\n\", i);", " if (gnutls_x509_crt_init (&cert) < 0)", " return -1;", " if (gnutls_x509_crt_import(cert, &certs[i], GNUTLS_X509_FMT_DER) < 0) {", " gnutls_x509_crt_deinit (cert);", " return -1;", " if (gnutls_x509_crt_get_expiration_time (cert) < now) {", " VNC_DEBUG(\"The certificate has expired\\n\");", " gnutls_x509_crt_deinit (cert);", " return -1;", " if (gnutls_x509_crt_get_activation_time (cert) > now) {", " VNC_DEBUG(\"The certificate is not yet activated\\n\");", " gnutls_x509_crt_deinit (cert);", " return -1;", " if (gnutls_x509_crt_get_activation_time (cert) > now) {", " VNC_DEBUG(\"The certificate is not yet activated\\n\");", " gnutls_x509_crt_deinit (cert);", " return -1;", " if (i == 0) {", " size_t dnameSize = 1024;", " vs->tls.dname = g_malloc(dnameSize);", " requery:", " if ((ret = gnutls_x509_crt_get_dn (cert, vs->tls.dname, &dnameSize)) != 0) {", " if (ret == GNUTLS_E_SHORT_MEMORY_BUFFER) {", " vs->tls.dname = g_realloc(vs->tls.dname, dnameSize);", " goto requery;", " gnutls_x509_crt_deinit (cert);", " VNC_DEBUG(\"Cannot get client distinguished name: %s\",", " gnutls_strerror (ret));", " return -1;", " if (vs->vd->tls.x509verify) {", " int allow;", " if (!vs->vd->tls.acl) {", " VNC_DEBUG(\"no ACL activated, allowing access\");", " gnutls_x509_crt_deinit (cert);", " continue;", " allow = qemu_acl_party_is_allowed(vs->vd->tls.acl,", " vs->tls.dname);", " VNC_DEBUG(\"TLS x509 ACL check for %s is %s\\n\",", " vs->tls.dname, allow ? \"allowed\" : \"denied\");", " if (!allow) {", " gnutls_x509_crt_deinit (cert);", " return -1;", " gnutls_x509_crt_deinit (cert);", " return 0;", " return -1;", " return 0;", " return -1;", " return -1;", " return -1;", " return 0;", " return -1;", " return -1;", " return -1;", " return -1;", " return -1;", " return -1;", " if (vs->vd->tls.x509verify) {", " return -1;", " return -1;", " return 0;", " return -1;", " return 0;", " return 0;", " return -1;", " return -1;" ], "line_no": [ 5, 95, 5, 23, 5, 23, 5, 5, 1, 5, 7, 9, 11, 13, 17, 19, 21, 23, 29, 23, 37, 39, 41, 45, 47, 51, 53, 57, 59, 23, 65, 67, 75, 23, 81, 23, 87, 89, 91, 93, 95, 99, 101, 95, 109, 111, 101, 95, 121, 123, 101, 95, 121, 123, 101, 95, 145, 147, 149, 151, 153, 155, 157, 159, 163, 165, 167, 169, 175, 177, 179, 181, 183, 185, 191, 193, 197, 199, 201, 183, 205, 215, 221, 23, 221, 23, 23, 23, 221, 23, 95, 95, 95, 169, 169, 175, 169, 169, 221, 23, 221, 221, 23, 95 ] }
int FUNC_0(VncState *VAR_0) { int VAR_1; unsigned int VAR_2; const gnutls_datum_t *VAR_3; unsigned int VAR_4, VAR_5; time_t now; VNC_DEBUG("Validating client certificate\n"); if ((VAR_1 = gnutls_certificate_verify_peers2 (VAR_0->tls.session, &VAR_2)) < 0) { VNC_DEBUG("Verify failed %s\n", gnutls_strerror(VAR_1)); return -1; } if ((now = time(NULL)) == ((time_t)-1)) { return -1; } if (VAR_2 != 0) { if (VAR_2 & GNUTLS_CERT_INVALID) VNC_DEBUG("The certificate is not trusted.\n"); if (VAR_2 & GNUTLS_CERT_SIGNER_NOT_FOUND) VNC_DEBUG("The certificate hasn't got a known issuer.\n"); if (VAR_2 & GNUTLS_CERT_REVOKED) VNC_DEBUG("The certificate has been revoked.\n"); if (VAR_2 & GNUTLS_CERT_INSECURE_ALGORITHM) VNC_DEBUG("The certificate uses an insecure algorithm\n"); return -1; } else { VNC_DEBUG("Certificate is valid!\n"); } if (gnutls_certificate_type_get(VAR_0->tls.session) != GNUTLS_CRT_X509) return -1; if (!(VAR_3 = gnutls_certificate_get_peers(VAR_0->tls.session, &VAR_4))) return -1; for (VAR_5 = 0 ; VAR_5 < VAR_4 ; VAR_5++) { gnutls_x509_crt_t cert; VNC_DEBUG ("Checking certificate chain %d\n", VAR_5); if (gnutls_x509_crt_init (&cert) < 0) return -1; if (gnutls_x509_crt_import(cert, &VAR_3[VAR_5], GNUTLS_X509_FMT_DER) < 0) { gnutls_x509_crt_deinit (cert); return -1; } if (gnutls_x509_crt_get_expiration_time (cert) < now) { VNC_DEBUG("The certificate has expired\n"); gnutls_x509_crt_deinit (cert); return -1; } if (gnutls_x509_crt_get_activation_time (cert) > now) { VNC_DEBUG("The certificate is not yet activated\n"); gnutls_x509_crt_deinit (cert); return -1; } if (gnutls_x509_crt_get_activation_time (cert) > now) { VNC_DEBUG("The certificate is not yet activated\n"); gnutls_x509_crt_deinit (cert); return -1; } if (VAR_5 == 0) { size_t dnameSize = 1024; VAR_0->tls.dname = g_malloc(dnameSize); requery: if ((VAR_1 = gnutls_x509_crt_get_dn (cert, VAR_0->tls.dname, &dnameSize)) != 0) { if (VAR_1 == GNUTLS_E_SHORT_MEMORY_BUFFER) { VAR_0->tls.dname = g_realloc(VAR_0->tls.dname, dnameSize); goto requery; } gnutls_x509_crt_deinit (cert); VNC_DEBUG("Cannot get client distinguished name: %s", gnutls_strerror (VAR_1)); return -1; } if (VAR_0->vd->tls.x509verify) { int VAR_6; if (!VAR_0->vd->tls.acl) { VNC_DEBUG("no ACL activated, allowing access"); gnutls_x509_crt_deinit (cert); continue; } VAR_6 = qemu_acl_party_is_allowed(VAR_0->vd->tls.acl, VAR_0->tls.dname); VNC_DEBUG("TLS x509 ACL check for %s is %s\n", VAR_0->tls.dname, VAR_6 ? "allowed" : "denied"); if (!VAR_6) { gnutls_x509_crt_deinit (cert); return -1; } } } gnutls_x509_crt_deinit (cert); } return 0; }
[ "int FUNC_0(VncState *VAR_0)\n{", "int VAR_1;", "unsigned int VAR_2;", "const gnutls_datum_t *VAR_3;", "unsigned int VAR_4, VAR_5;", "time_t now;", "VNC_DEBUG(\"Validating client certificate\\n\");", "if ((VAR_1 = gnutls_certificate_verify_peers2 (VAR_0->tls.session, &VAR_2)) < 0) {", "VNC_DEBUG(\"Verify failed %s\\n\", gnutls_strerror(VAR_1));", "return -1;", "}", "if ((now = time(NULL)) == ((time_t)-1)) {", "return -1;", "}", "if (VAR_2 != 0) {", "if (VAR_2 & GNUTLS_CERT_INVALID)\nVNC_DEBUG(\"The certificate is not trusted.\\n\");", "if (VAR_2 & GNUTLS_CERT_SIGNER_NOT_FOUND)\nVNC_DEBUG(\"The certificate hasn't got a known issuer.\\n\");", "if (VAR_2 & GNUTLS_CERT_REVOKED)\nVNC_DEBUG(\"The certificate has been revoked.\\n\");", "if (VAR_2 & GNUTLS_CERT_INSECURE_ALGORITHM)\nVNC_DEBUG(\"The certificate uses an insecure algorithm\\n\");", "return -1;", "} else {", "VNC_DEBUG(\"Certificate is valid!\\n\");", "}", "if (gnutls_certificate_type_get(VAR_0->tls.session) != GNUTLS_CRT_X509)\nreturn -1;", "if (!(VAR_3 = gnutls_certificate_get_peers(VAR_0->tls.session, &VAR_4)))\nreturn -1;", "for (VAR_5 = 0 ; VAR_5 < VAR_4 ; VAR_5++) {", "gnutls_x509_crt_t cert;", "VNC_DEBUG (\"Checking certificate chain %d\\n\", VAR_5);", "if (gnutls_x509_crt_init (&cert) < 0)\nreturn -1;", "if (gnutls_x509_crt_import(cert, &VAR_3[VAR_5], GNUTLS_X509_FMT_DER) < 0) {", "gnutls_x509_crt_deinit (cert);", "return -1;", "}", "if (gnutls_x509_crt_get_expiration_time (cert) < now) {", "VNC_DEBUG(\"The certificate has expired\\n\");", "gnutls_x509_crt_deinit (cert);", "return -1;", "}", "if (gnutls_x509_crt_get_activation_time (cert) > now) {", "VNC_DEBUG(\"The certificate is not yet activated\\n\");", "gnutls_x509_crt_deinit (cert);", "return -1;", "}", "if (gnutls_x509_crt_get_activation_time (cert) > now) {", "VNC_DEBUG(\"The certificate is not yet activated\\n\");", "gnutls_x509_crt_deinit (cert);", "return -1;", "}", "if (VAR_5 == 0) {", "size_t dnameSize = 1024;", "VAR_0->tls.dname = g_malloc(dnameSize);", "requery:\nif ((VAR_1 = gnutls_x509_crt_get_dn (cert, VAR_0->tls.dname, &dnameSize)) != 0) {", "if (VAR_1 == GNUTLS_E_SHORT_MEMORY_BUFFER) {", "VAR_0->tls.dname = g_realloc(VAR_0->tls.dname, dnameSize);", "goto requery;", "}", "gnutls_x509_crt_deinit (cert);", "VNC_DEBUG(\"Cannot get client distinguished name: %s\",\ngnutls_strerror (VAR_1));", "return -1;", "}", "if (VAR_0->vd->tls.x509verify) {", "int VAR_6;", "if (!VAR_0->vd->tls.acl) {", "VNC_DEBUG(\"no ACL activated, allowing access\");", "gnutls_x509_crt_deinit (cert);", "continue;", "}", "VAR_6 = qemu_acl_party_is_allowed(VAR_0->vd->tls.acl,\nVAR_0->tls.dname);", "VNC_DEBUG(\"TLS x509 ACL check for %s is %s\\n\",\nVAR_0->tls.dname, VAR_6 ? \"allowed\" : \"denied\");", "if (!VAR_6) {", "gnutls_x509_crt_deinit (cert);", "return -1;", "}", "}", "}", "gnutls_x509_crt_deinit (cert);", "}", "return 0;", "}" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39, 41 ], [ 45, 47 ], [ 51, 53 ], [ 57, 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 75, 77 ], [ 81, 83 ], [ 87 ], [ 89 ], [ 91 ], [ 93, 95 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 145 ], [ 147 ], [ 149 ], [ 151, 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165, 167 ], [ 169 ], [ 171 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 191, 193 ], [ 197, 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 215 ], [ 217 ], [ 221 ], [ 223 ] ]
6,700
static void vc1_interp_mc(VC1Context *v) { MpegEncContext *s = &v->s; H264ChromaContext *h264chroma = &v->h264chroma; uint8_t *srcY, *srcU, *srcV; int dxy, mx, my, uvmx, uvmy, src_x, src_y, uvsrc_x, uvsrc_y; int off, off_uv; int v_edge_pos = s->v_edge_pos >> v->field_mode; int use_ic = v->next_use_ic; if (!v->field_mode && !v->s.next_picture.f.data[0]) return; mx = s->mv[1][0][0]; my = s->mv[1][0][1]; uvmx = (mx + ((mx & 3) == 3)) >> 1; uvmy = (my + ((my & 3) == 3)) >> 1; if (v->field_mode) { if (v->cur_field_type != v->ref_field_type[1]) my = my - 2 + 4 * v->cur_field_type; uvmy = uvmy - 2 + 4 * v->cur_field_type; } if (v->fastuvmc) { uvmx = uvmx + ((uvmx < 0) ? -(uvmx & 1) : (uvmx & 1)); uvmy = uvmy + ((uvmy < 0) ? -(uvmy & 1) : (uvmy & 1)); } srcY = s->next_picture.f.data[0]; srcU = s->next_picture.f.data[1]; srcV = s->next_picture.f.data[2]; src_x = s->mb_x * 16 + (mx >> 2); src_y = s->mb_y * 16 + (my >> 2); uvsrc_x = s->mb_x * 8 + (uvmx >> 2); uvsrc_y = s->mb_y * 8 + (uvmy >> 2); if (v->profile != PROFILE_ADVANCED) { src_x = av_clip( src_x, -16, s->mb_width * 16); src_y = av_clip( src_y, -16, s->mb_height * 16); uvsrc_x = av_clip(uvsrc_x, -8, s->mb_width * 8); uvsrc_y = av_clip(uvsrc_y, -8, s->mb_height * 8); } else { src_x = av_clip( src_x, -17, s->avctx->coded_width); src_y = av_clip( src_y, -18, s->avctx->coded_height + 1); uvsrc_x = av_clip(uvsrc_x, -8, s->avctx->coded_width >> 1); uvsrc_y = av_clip(uvsrc_y, -8, s->avctx->coded_height >> 1); } srcY += src_y * s->linesize + src_x; srcU += uvsrc_y * s->uvlinesize + uvsrc_x; srcV += uvsrc_y * s->uvlinesize + uvsrc_x; if (v->field_mode && v->ref_field_type[1]) { srcY += s->current_picture_ptr->f.linesize[0]; srcU += s->current_picture_ptr->f.linesize[1]; srcV += s->current_picture_ptr->f.linesize[2]; } /* for grayscale we should not try to read from unknown area */ if (s->flags & CODEC_FLAG_GRAY) { srcU = s->edge_emu_buffer + 18 * s->linesize; srcV = s->edge_emu_buffer + 18 * s->linesize; } if (v->rangeredfrm || s->h_edge_pos < 22 || v_edge_pos < 22 || use_ic || (unsigned)(src_x - 1) > s->h_edge_pos - (mx & 3) - 16 - 3 || (unsigned)(src_y - 1) > v_edge_pos - (my & 3) - 16 - 3) { uint8_t *uvbuf = s->edge_emu_buffer + 19 * s->linesize; srcY -= s->mspel * (1 + s->linesize); s->vdsp.emulated_edge_mc(s->edge_emu_buffer, srcY, s->linesize, s->linesize, 17 + s->mspel * 2, 17 + s->mspel * 2, src_x - s->mspel, src_y - s->mspel, s->h_edge_pos, v_edge_pos); srcY = s->edge_emu_buffer; s->vdsp.emulated_edge_mc(uvbuf, srcU, s->uvlinesize, s->uvlinesize, 8 + 1, 8 + 1, uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, v_edge_pos >> 1); s->vdsp.emulated_edge_mc(uvbuf + 16, srcV, s->uvlinesize, s->uvlinesize, 8 + 1, 8 + 1, uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, v_edge_pos >> 1); srcU = uvbuf; srcV = uvbuf + 16; /* if we deal with range reduction we need to scale source blocks */ if (v->rangeredfrm) { int i, j; uint8_t *src, *src2; src = srcY; for (j = 0; j < 17 + s->mspel * 2; j++) { for (i = 0; i < 17 + s->mspel * 2; i++) src[i] = ((src[i] - 128) >> 1) + 128; src += s->linesize; } src = srcU; src2 = srcV; for (j = 0; j < 9; j++) { for (i = 0; i < 9; i++) { src[i] = ((src[i] - 128) >> 1) + 128; src2[i] = ((src2[i] - 128) >> 1) + 128; } src += s->uvlinesize; src2 += s->uvlinesize; } } if (use_ic) { uint8_t (*luty )[256] = v->next_luty; uint8_t (*lutuv)[256] = v->next_lutuv; int i, j; uint8_t *src, *src2; src = srcY; for (j = 0; j < 17 + s->mspel * 2; j++) { int f = v->field_mode ? v->ref_field_type[1] : ((j+src_y - s->mspel) & 1); for (i = 0; i < 17 + s->mspel * 2; i++) src[i] = luty[f][src[i]]; src += s->linesize; } src = srcU; src2 = srcV; for (j = 0; j < 9; j++) { int f = v->field_mode ? v->ref_field_type[1] : ((j+uvsrc_y) & 1); for (i = 0; i < 9; i++) { src[i] = lutuv[f][src[i]]; src2[i] = lutuv[f][src2[i]]; } src += s->uvlinesize; src2 += s->uvlinesize; } } srcY += s->mspel * (1 + s->linesize); } off = 0; off_uv = 0; if (s->mspel) { dxy = ((my & 3) << 2) | (mx & 3); v->vc1dsp.avg_vc1_mspel_pixels_tab[dxy](s->dest[0] + off , srcY , s->linesize, v->rnd); v->vc1dsp.avg_vc1_mspel_pixels_tab[dxy](s->dest[0] + off + 8, srcY + 8, s->linesize, v->rnd); srcY += s->linesize * 8; v->vc1dsp.avg_vc1_mspel_pixels_tab[dxy](s->dest[0] + off + 8 * s->linesize , srcY , s->linesize, v->rnd); v->vc1dsp.avg_vc1_mspel_pixels_tab[dxy](s->dest[0] + off + 8 * s->linesize + 8, srcY + 8, s->linesize, v->rnd); } else { // hpel mc dxy = (my & 2) | ((mx & 2) >> 1); if (!v->rnd) s->hdsp.avg_pixels_tab[0][dxy](s->dest[0] + off, srcY, s->linesize, 16); else s->hdsp.avg_no_rnd_pixels_tab[dxy](s->dest[0] + off, srcY, s->linesize, 16); } if (s->flags & CODEC_FLAG_GRAY) return; /* Chroma MC always uses qpel blilinear */ uvmx = (uvmx & 3) << 1; uvmy = (uvmy & 3) << 1; if (!v->rnd) { h264chroma->avg_h264_chroma_pixels_tab[0](s->dest[1] + off_uv, srcU, s->uvlinesize, 8, uvmx, uvmy); h264chroma->avg_h264_chroma_pixels_tab[0](s->dest[2] + off_uv, srcV, s->uvlinesize, 8, uvmx, uvmy); } else { v->vc1dsp.avg_no_rnd_vc1_chroma_pixels_tab[0](s->dest[1] + off_uv, srcU, s->uvlinesize, 8, uvmx, uvmy); v->vc1dsp.avg_no_rnd_vc1_chroma_pixels_tab[0](s->dest[2] + off_uv, srcV, s->uvlinesize, 8, uvmx, uvmy); } }
true
FFmpeg
f6774f905fb3cfdc319523ac640be30b14c1bc55
static void vc1_interp_mc(VC1Context *v) { MpegEncContext *s = &v->s; H264ChromaContext *h264chroma = &v->h264chroma; uint8_t *srcY, *srcU, *srcV; int dxy, mx, my, uvmx, uvmy, src_x, src_y, uvsrc_x, uvsrc_y; int off, off_uv; int v_edge_pos = s->v_edge_pos >> v->field_mode; int use_ic = v->next_use_ic; if (!v->field_mode && !v->s.next_picture.f.data[0]) return; mx = s->mv[1][0][0]; my = s->mv[1][0][1]; uvmx = (mx + ((mx & 3) == 3)) >> 1; uvmy = (my + ((my & 3) == 3)) >> 1; if (v->field_mode) { if (v->cur_field_type != v->ref_field_type[1]) my = my - 2 + 4 * v->cur_field_type; uvmy = uvmy - 2 + 4 * v->cur_field_type; } if (v->fastuvmc) { uvmx = uvmx + ((uvmx < 0) ? -(uvmx & 1) : (uvmx & 1)); uvmy = uvmy + ((uvmy < 0) ? -(uvmy & 1) : (uvmy & 1)); } srcY = s->next_picture.f.data[0]; srcU = s->next_picture.f.data[1]; srcV = s->next_picture.f.data[2]; src_x = s->mb_x * 16 + (mx >> 2); src_y = s->mb_y * 16 + (my >> 2); uvsrc_x = s->mb_x * 8 + (uvmx >> 2); uvsrc_y = s->mb_y * 8 + (uvmy >> 2); if (v->profile != PROFILE_ADVANCED) { src_x = av_clip( src_x, -16, s->mb_width * 16); src_y = av_clip( src_y, -16, s->mb_height * 16); uvsrc_x = av_clip(uvsrc_x, -8, s->mb_width * 8); uvsrc_y = av_clip(uvsrc_y, -8, s->mb_height * 8); } else { src_x = av_clip( src_x, -17, s->avctx->coded_width); src_y = av_clip( src_y, -18, s->avctx->coded_height + 1); uvsrc_x = av_clip(uvsrc_x, -8, s->avctx->coded_width >> 1); uvsrc_y = av_clip(uvsrc_y, -8, s->avctx->coded_height >> 1); } srcY += src_y * s->linesize + src_x; srcU += uvsrc_y * s->uvlinesize + uvsrc_x; srcV += uvsrc_y * s->uvlinesize + uvsrc_x; if (v->field_mode && v->ref_field_type[1]) { srcY += s->current_picture_ptr->f.linesize[0]; srcU += s->current_picture_ptr->f.linesize[1]; srcV += s->current_picture_ptr->f.linesize[2]; } if (s->flags & CODEC_FLAG_GRAY) { srcU = s->edge_emu_buffer + 18 * s->linesize; srcV = s->edge_emu_buffer + 18 * s->linesize; } if (v->rangeredfrm || s->h_edge_pos < 22 || v_edge_pos < 22 || use_ic || (unsigned)(src_x - 1) > s->h_edge_pos - (mx & 3) - 16 - 3 || (unsigned)(src_y - 1) > v_edge_pos - (my & 3) - 16 - 3) { uint8_t *uvbuf = s->edge_emu_buffer + 19 * s->linesize; srcY -= s->mspel * (1 + s->linesize); s->vdsp.emulated_edge_mc(s->edge_emu_buffer, srcY, s->linesize, s->linesize, 17 + s->mspel * 2, 17 + s->mspel * 2, src_x - s->mspel, src_y - s->mspel, s->h_edge_pos, v_edge_pos); srcY = s->edge_emu_buffer; s->vdsp.emulated_edge_mc(uvbuf, srcU, s->uvlinesize, s->uvlinesize, 8 + 1, 8 + 1, uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, v_edge_pos >> 1); s->vdsp.emulated_edge_mc(uvbuf + 16, srcV, s->uvlinesize, s->uvlinesize, 8 + 1, 8 + 1, uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, v_edge_pos >> 1); srcU = uvbuf; srcV = uvbuf + 16; if (v->rangeredfrm) { int i, j; uint8_t *src, *src2; src = srcY; for (j = 0; j < 17 + s->mspel * 2; j++) { for (i = 0; i < 17 + s->mspel * 2; i++) src[i] = ((src[i] - 128) >> 1) + 128; src += s->linesize; } src = srcU; src2 = srcV; for (j = 0; j < 9; j++) { for (i = 0; i < 9; i++) { src[i] = ((src[i] - 128) >> 1) + 128; src2[i] = ((src2[i] - 128) >> 1) + 128; } src += s->uvlinesize; src2 += s->uvlinesize; } } if (use_ic) { uint8_t (*luty )[256] = v->next_luty; uint8_t (*lutuv)[256] = v->next_lutuv; int i, j; uint8_t *src, *src2; src = srcY; for (j = 0; j < 17 + s->mspel * 2; j++) { int f = v->field_mode ? v->ref_field_type[1] : ((j+src_y - s->mspel) & 1); for (i = 0; i < 17 + s->mspel * 2; i++) src[i] = luty[f][src[i]]; src += s->linesize; } src = srcU; src2 = srcV; for (j = 0; j < 9; j++) { int f = v->field_mode ? v->ref_field_type[1] : ((j+uvsrc_y) & 1); for (i = 0; i < 9; i++) { src[i] = lutuv[f][src[i]]; src2[i] = lutuv[f][src2[i]]; } src += s->uvlinesize; src2 += s->uvlinesize; } } srcY += s->mspel * (1 + s->linesize); } off = 0; off_uv = 0; if (s->mspel) { dxy = ((my & 3) << 2) | (mx & 3); v->vc1dsp.avg_vc1_mspel_pixels_tab[dxy](s->dest[0] + off , srcY , s->linesize, v->rnd); v->vc1dsp.avg_vc1_mspel_pixels_tab[dxy](s->dest[0] + off + 8, srcY + 8, s->linesize, v->rnd); srcY += s->linesize * 8; v->vc1dsp.avg_vc1_mspel_pixels_tab[dxy](s->dest[0] + off + 8 * s->linesize , srcY , s->linesize, v->rnd); v->vc1dsp.avg_vc1_mspel_pixels_tab[dxy](s->dest[0] + off + 8 * s->linesize + 8, srcY + 8, s->linesize, v->rnd); } else { dxy = (my & 2) | ((mx & 2) >> 1); if (!v->rnd) s->hdsp.avg_pixels_tab[0][dxy](s->dest[0] + off, srcY, s->linesize, 16); else s->hdsp.avg_no_rnd_pixels_tab[dxy](s->dest[0] + off, srcY, s->linesize, 16); } if (s->flags & CODEC_FLAG_GRAY) return; uvmx = (uvmx & 3) << 1; uvmy = (uvmy & 3) << 1; if (!v->rnd) { h264chroma->avg_h264_chroma_pixels_tab[0](s->dest[1] + off_uv, srcU, s->uvlinesize, 8, uvmx, uvmy); h264chroma->avg_h264_chroma_pixels_tab[0](s->dest[2] + off_uv, srcV, s->uvlinesize, 8, uvmx, uvmy); } else { v->vc1dsp.avg_no_rnd_vc1_chroma_pixels_tab[0](s->dest[1] + off_uv, srcU, s->uvlinesize, 8, uvmx, uvmy); v->vc1dsp.avg_no_rnd_vc1_chroma_pixels_tab[0](s->dest[2] + off_uv, srcV, s->uvlinesize, 8, uvmx, uvmy); } }
{ "code": [ " srcY += s->current_picture_ptr->f.linesize[0];", " srcU += s->current_picture_ptr->f.linesize[1];", " srcV += s->current_picture_ptr->f.linesize[2];", " srcY += s->current_picture_ptr->f.linesize[0];", " if (!v->field_mode && !v->s.next_picture.f.data[0])", " srcY = s->next_picture.f.data[0];", " srcU = s->next_picture.f.data[1];", " srcV = s->next_picture.f.data[2];", " srcY += s->current_picture_ptr->f.linesize[0];", " srcU += s->current_picture_ptr->f.linesize[1];", " srcV += s->current_picture_ptr->f.linesize[2];" ], "line_no": [ 105, 107, 109, 105, 21, 53, 55, 57, 105, 107, 109 ] }
static void FUNC_0(VC1Context *VAR_0) { MpegEncContext *s = &VAR_0->s; H264ChromaContext *h264chroma = &VAR_0->h264chroma; uint8_t *srcY, *srcU, *srcV; int VAR_1, VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9; int VAR_10, VAR_11; int VAR_12 = s->VAR_12 >> VAR_0->field_mode; int VAR_13 = VAR_0->next_use_ic; if (!VAR_0->field_mode && !VAR_0->s.next_picture.VAR_16.data[0]) return; VAR_2 = s->mv[1][0][0]; VAR_3 = s->mv[1][0][1]; VAR_4 = (VAR_2 + ((VAR_2 & 3) == 3)) >> 1; VAR_5 = (VAR_3 + ((VAR_3 & 3) == 3)) >> 1; if (VAR_0->field_mode) { if (VAR_0->cur_field_type != VAR_0->ref_field_type[1]) VAR_3 = VAR_3 - 2 + 4 * VAR_0->cur_field_type; VAR_5 = VAR_5 - 2 + 4 * VAR_0->cur_field_type; } if (VAR_0->fastuvmc) { VAR_4 = VAR_4 + ((VAR_4 < 0) ? -(VAR_4 & 1) : (VAR_4 & 1)); VAR_5 = VAR_5 + ((VAR_5 < 0) ? -(VAR_5 & 1) : (VAR_5 & 1)); } srcY = s->next_picture.VAR_16.data[0]; srcU = s->next_picture.VAR_16.data[1]; srcV = s->next_picture.VAR_16.data[2]; VAR_6 = s->mb_x * 16 + (VAR_2 >> 2); VAR_7 = s->mb_y * 16 + (VAR_3 >> 2); VAR_8 = s->mb_x * 8 + (VAR_4 >> 2); VAR_9 = s->mb_y * 8 + (VAR_5 >> 2); if (VAR_0->profile != PROFILE_ADVANCED) { VAR_6 = av_clip( VAR_6, -16, s->mb_width * 16); VAR_7 = av_clip( VAR_7, -16, s->mb_height * 16); VAR_8 = av_clip(VAR_8, -8, s->mb_width * 8); VAR_9 = av_clip(VAR_9, -8, s->mb_height * 8); } else { VAR_6 = av_clip( VAR_6, -17, s->avctx->coded_width); VAR_7 = av_clip( VAR_7, -18, s->avctx->coded_height + 1); VAR_8 = av_clip(VAR_8, -8, s->avctx->coded_width >> 1); VAR_9 = av_clip(VAR_9, -8, s->avctx->coded_height >> 1); } srcY += VAR_7 * s->linesize + VAR_6; srcU += VAR_9 * s->uvlinesize + VAR_8; srcV += VAR_9 * s->uvlinesize + VAR_8; if (VAR_0->field_mode && VAR_0->ref_field_type[1]) { srcY += s->current_picture_ptr->VAR_16.linesize[0]; srcU += s->current_picture_ptr->VAR_16.linesize[1]; srcV += s->current_picture_ptr->VAR_16.linesize[2]; } if (s->flags & CODEC_FLAG_GRAY) { srcU = s->edge_emu_buffer + 18 * s->linesize; srcV = s->edge_emu_buffer + 18 * s->linesize; } if (VAR_0->rangeredfrm || s->h_edge_pos < 22 || VAR_12 < 22 || VAR_13 || (unsigned)(VAR_6 - 1) > s->h_edge_pos - (VAR_2 & 3) - 16 - 3 || (unsigned)(VAR_7 - 1) > VAR_12 - (VAR_3 & 3) - 16 - 3) { uint8_t *uvbuf = s->edge_emu_buffer + 19 * s->linesize; srcY -= s->mspel * (1 + s->linesize); s->vdsp.emulated_edge_mc(s->edge_emu_buffer, srcY, s->linesize, s->linesize, 17 + s->mspel * 2, 17 + s->mspel * 2, VAR_6 - s->mspel, VAR_7 - s->mspel, s->h_edge_pos, VAR_12); srcY = s->edge_emu_buffer; s->vdsp.emulated_edge_mc(uvbuf, srcU, s->uvlinesize, s->uvlinesize, 8 + 1, 8 + 1, VAR_8, VAR_9, s->h_edge_pos >> 1, VAR_12 >> 1); s->vdsp.emulated_edge_mc(uvbuf + 16, srcV, s->uvlinesize, s->uvlinesize, 8 + 1, 8 + 1, VAR_8, VAR_9, s->h_edge_pos >> 1, VAR_12 >> 1); srcU = uvbuf; srcV = uvbuf + 16; if (VAR_0->rangeredfrm) { int VAR_16, VAR_16; uint8_t *src, *src2; src = srcY; for (VAR_16 = 0; VAR_16 < 17 + s->mspel * 2; VAR_16++) { for (VAR_16 = 0; VAR_16 < 17 + s->mspel * 2; VAR_16++) src[VAR_16] = ((src[VAR_16] - 128) >> 1) + 128; src += s->linesize; } src = srcU; src2 = srcV; for (VAR_16 = 0; VAR_16 < 9; VAR_16++) { for (VAR_16 = 0; VAR_16 < 9; VAR_16++) { src[VAR_16] = ((src[VAR_16] - 128) >> 1) + 128; src2[VAR_16] = ((src2[VAR_16] - 128) >> 1) + 128; } src += s->uvlinesize; src2 += s->uvlinesize; } } if (VAR_13) { uint8_t (*luty )[256] = VAR_0->next_luty; uint8_t (*lutuv)[256] = VAR_0->next_lutuv; int VAR_16, VAR_16; uint8_t *src, *src2; src = srcY; for (VAR_16 = 0; VAR_16 < 17 + s->mspel * 2; VAR_16++) { int VAR_16 = VAR_0->field_mode ? VAR_0->ref_field_type[1] : ((VAR_16+VAR_7 - s->mspel) & 1); for (VAR_16 = 0; VAR_16 < 17 + s->mspel * 2; VAR_16++) src[VAR_16] = luty[VAR_16][src[VAR_16]]; src += s->linesize; } src = srcU; src2 = srcV; for (VAR_16 = 0; VAR_16 < 9; VAR_16++) { int VAR_16 = VAR_0->field_mode ? VAR_0->ref_field_type[1] : ((VAR_16+VAR_9) & 1); for (VAR_16 = 0; VAR_16 < 9; VAR_16++) { src[VAR_16] = lutuv[VAR_16][src[VAR_16]]; src2[VAR_16] = lutuv[VAR_16][src2[VAR_16]]; } src += s->uvlinesize; src2 += s->uvlinesize; } } srcY += s->mspel * (1 + s->linesize); } VAR_10 = 0; VAR_11 = 0; if (s->mspel) { VAR_1 = ((VAR_3 & 3) << 2) | (VAR_2 & 3); VAR_0->vc1dsp.avg_vc1_mspel_pixels_tab[VAR_1](s->dest[0] + VAR_10 , srcY , s->linesize, VAR_0->rnd); VAR_0->vc1dsp.avg_vc1_mspel_pixels_tab[VAR_1](s->dest[0] + VAR_10 + 8, srcY + 8, s->linesize, VAR_0->rnd); srcY += s->linesize * 8; VAR_0->vc1dsp.avg_vc1_mspel_pixels_tab[VAR_1](s->dest[0] + VAR_10 + 8 * s->linesize , srcY , s->linesize, VAR_0->rnd); VAR_0->vc1dsp.avg_vc1_mspel_pixels_tab[VAR_1](s->dest[0] + VAR_10 + 8 * s->linesize + 8, srcY + 8, s->linesize, VAR_0->rnd); } else { VAR_1 = (VAR_3 & 2) | ((VAR_2 & 2) >> 1); if (!VAR_0->rnd) s->hdsp.avg_pixels_tab[0][VAR_1](s->dest[0] + VAR_10, srcY, s->linesize, 16); else s->hdsp.avg_no_rnd_pixels_tab[VAR_1](s->dest[0] + VAR_10, srcY, s->linesize, 16); } if (s->flags & CODEC_FLAG_GRAY) return; VAR_4 = (VAR_4 & 3) << 1; VAR_5 = (VAR_5 & 3) << 1; if (!VAR_0->rnd) { h264chroma->avg_h264_chroma_pixels_tab[0](s->dest[1] + VAR_11, srcU, s->uvlinesize, 8, VAR_4, VAR_5); h264chroma->avg_h264_chroma_pixels_tab[0](s->dest[2] + VAR_11, srcV, s->uvlinesize, 8, VAR_4, VAR_5); } else { VAR_0->vc1dsp.avg_no_rnd_vc1_chroma_pixels_tab[0](s->dest[1] + VAR_11, srcU, s->uvlinesize, 8, VAR_4, VAR_5); VAR_0->vc1dsp.avg_no_rnd_vc1_chroma_pixels_tab[0](s->dest[2] + VAR_11, srcV, s->uvlinesize, 8, VAR_4, VAR_5); } }
[ "static void FUNC_0(VC1Context *VAR_0)\n{", "MpegEncContext *s = &VAR_0->s;", "H264ChromaContext *h264chroma = &VAR_0->h264chroma;", "uint8_t *srcY, *srcU, *srcV;", "int VAR_1, VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9;", "int VAR_10, VAR_11;", "int VAR_12 = s->VAR_12 >> VAR_0->field_mode;", "int VAR_13 = VAR_0->next_use_ic;", "if (!VAR_0->field_mode && !VAR_0->s.next_picture.VAR_16.data[0])\nreturn;", "VAR_2 = s->mv[1][0][0];", "VAR_3 = s->mv[1][0][1];", "VAR_4 = (VAR_2 + ((VAR_2 & 3) == 3)) >> 1;", "VAR_5 = (VAR_3 + ((VAR_3 & 3) == 3)) >> 1;", "if (VAR_0->field_mode) {", "if (VAR_0->cur_field_type != VAR_0->ref_field_type[1])\nVAR_3 = VAR_3 - 2 + 4 * VAR_0->cur_field_type;", "VAR_5 = VAR_5 - 2 + 4 * VAR_0->cur_field_type;", "}", "if (VAR_0->fastuvmc) {", "VAR_4 = VAR_4 + ((VAR_4 < 0) ? -(VAR_4 & 1) : (VAR_4 & 1));", "VAR_5 = VAR_5 + ((VAR_5 < 0) ? -(VAR_5 & 1) : (VAR_5 & 1));", "}", "srcY = s->next_picture.VAR_16.data[0];", "srcU = s->next_picture.VAR_16.data[1];", "srcV = s->next_picture.VAR_16.data[2];", "VAR_6 = s->mb_x * 16 + (VAR_2 >> 2);", "VAR_7 = s->mb_y * 16 + (VAR_3 >> 2);", "VAR_8 = s->mb_x * 8 + (VAR_4 >> 2);", "VAR_9 = s->mb_y * 8 + (VAR_5 >> 2);", "if (VAR_0->profile != PROFILE_ADVANCED) {", "VAR_6 = av_clip( VAR_6, -16, s->mb_width * 16);", "VAR_7 = av_clip( VAR_7, -16, s->mb_height * 16);", "VAR_8 = av_clip(VAR_8, -8, s->mb_width * 8);", "VAR_9 = av_clip(VAR_9, -8, s->mb_height * 8);", "} else {", "VAR_6 = av_clip( VAR_6, -17, s->avctx->coded_width);", "VAR_7 = av_clip( VAR_7, -18, s->avctx->coded_height + 1);", "VAR_8 = av_clip(VAR_8, -8, s->avctx->coded_width >> 1);", "VAR_9 = av_clip(VAR_9, -8, s->avctx->coded_height >> 1);", "}", "srcY += VAR_7 * s->linesize + VAR_6;", "srcU += VAR_9 * s->uvlinesize + VAR_8;", "srcV += VAR_9 * s->uvlinesize + VAR_8;", "if (VAR_0->field_mode && VAR_0->ref_field_type[1]) {", "srcY += s->current_picture_ptr->VAR_16.linesize[0];", "srcU += s->current_picture_ptr->VAR_16.linesize[1];", "srcV += s->current_picture_ptr->VAR_16.linesize[2];", "}", "if (s->flags & CODEC_FLAG_GRAY) {", "srcU = s->edge_emu_buffer + 18 * s->linesize;", "srcV = s->edge_emu_buffer + 18 * s->linesize;", "}", "if (VAR_0->rangeredfrm || s->h_edge_pos < 22 || VAR_12 < 22 || VAR_13\n|| (unsigned)(VAR_6 - 1) > s->h_edge_pos - (VAR_2 & 3) - 16 - 3\n|| (unsigned)(VAR_7 - 1) > VAR_12 - (VAR_3 & 3) - 16 - 3) {", "uint8_t *uvbuf = s->edge_emu_buffer + 19 * s->linesize;", "srcY -= s->mspel * (1 + s->linesize);", "s->vdsp.emulated_edge_mc(s->edge_emu_buffer, srcY,\ns->linesize, s->linesize,\n17 + s->mspel * 2, 17 + s->mspel * 2,\nVAR_6 - s->mspel, VAR_7 - s->mspel,\ns->h_edge_pos, VAR_12);", "srcY = s->edge_emu_buffer;", "s->vdsp.emulated_edge_mc(uvbuf, srcU,\ns->uvlinesize, s->uvlinesize,\n8 + 1, 8 + 1,\nVAR_8, VAR_9, s->h_edge_pos >> 1, VAR_12 >> 1);", "s->vdsp.emulated_edge_mc(uvbuf + 16, srcV,\ns->uvlinesize, s->uvlinesize,\n8 + 1, 8 + 1,\nVAR_8, VAR_9, s->h_edge_pos >> 1, VAR_12 >> 1);", "srcU = uvbuf;", "srcV = uvbuf + 16;", "if (VAR_0->rangeredfrm) {", "int VAR_16, VAR_16;", "uint8_t *src, *src2;", "src = srcY;", "for (VAR_16 = 0; VAR_16 < 17 + s->mspel * 2; VAR_16++) {", "for (VAR_16 = 0; VAR_16 < 17 + s->mspel * 2; VAR_16++)", "src[VAR_16] = ((src[VAR_16] - 128) >> 1) + 128;", "src += s->linesize;", "}", "src = srcU;", "src2 = srcV;", "for (VAR_16 = 0; VAR_16 < 9; VAR_16++) {", "for (VAR_16 = 0; VAR_16 < 9; VAR_16++) {", "src[VAR_16] = ((src[VAR_16] - 128) >> 1) + 128;", "src2[VAR_16] = ((src2[VAR_16] - 128) >> 1) + 128;", "}", "src += s->uvlinesize;", "src2 += s->uvlinesize;", "}", "}", "if (VAR_13) {", "uint8_t (*luty )[256] = VAR_0->next_luty;", "uint8_t (*lutuv)[256] = VAR_0->next_lutuv;", "int VAR_16, VAR_16;", "uint8_t *src, *src2;", "src = srcY;", "for (VAR_16 = 0; VAR_16 < 17 + s->mspel * 2; VAR_16++) {", "int VAR_16 = VAR_0->field_mode ? VAR_0->ref_field_type[1] : ((VAR_16+VAR_7 - s->mspel) & 1);", "for (VAR_16 = 0; VAR_16 < 17 + s->mspel * 2; VAR_16++)", "src[VAR_16] = luty[VAR_16][src[VAR_16]];", "src += s->linesize;", "}", "src = srcU;", "src2 = srcV;", "for (VAR_16 = 0; VAR_16 < 9; VAR_16++) {", "int VAR_16 = VAR_0->field_mode ? VAR_0->ref_field_type[1] : ((VAR_16+VAR_9) & 1);", "for (VAR_16 = 0; VAR_16 < 9; VAR_16++) {", "src[VAR_16] = lutuv[VAR_16][src[VAR_16]];", "src2[VAR_16] = lutuv[VAR_16][src2[VAR_16]];", "}", "src += s->uvlinesize;", "src2 += s->uvlinesize;", "}", "}", "srcY += s->mspel * (1 + s->linesize);", "}", "VAR_10 = 0;", "VAR_11 = 0;", "if (s->mspel) {", "VAR_1 = ((VAR_3 & 3) << 2) | (VAR_2 & 3);", "VAR_0->vc1dsp.avg_vc1_mspel_pixels_tab[VAR_1](s->dest[0] + VAR_10 , srcY , s->linesize, VAR_0->rnd);", "VAR_0->vc1dsp.avg_vc1_mspel_pixels_tab[VAR_1](s->dest[0] + VAR_10 + 8, srcY + 8, s->linesize, VAR_0->rnd);", "srcY += s->linesize * 8;", "VAR_0->vc1dsp.avg_vc1_mspel_pixels_tab[VAR_1](s->dest[0] + VAR_10 + 8 * s->linesize , srcY , s->linesize, VAR_0->rnd);", "VAR_0->vc1dsp.avg_vc1_mspel_pixels_tab[VAR_1](s->dest[0] + VAR_10 + 8 * s->linesize + 8, srcY + 8, s->linesize, VAR_0->rnd);", "} else {", "VAR_1 = (VAR_3 & 2) | ((VAR_2 & 2) >> 1);", "if (!VAR_0->rnd)\ns->hdsp.avg_pixels_tab[0][VAR_1](s->dest[0] + VAR_10, srcY, s->linesize, 16);", "else\ns->hdsp.avg_no_rnd_pixels_tab[VAR_1](s->dest[0] + VAR_10, srcY, s->linesize, 16);", "}", "if (s->flags & CODEC_FLAG_GRAY) return;", "VAR_4 = (VAR_4 & 3) << 1;", "VAR_5 = (VAR_5 & 3) << 1;", "if (!VAR_0->rnd) {", "h264chroma->avg_h264_chroma_pixels_tab[0](s->dest[1] + VAR_11, srcU, s->uvlinesize, 8, VAR_4, VAR_5);", "h264chroma->avg_h264_chroma_pixels_tab[0](s->dest[2] + VAR_11, srcV, s->uvlinesize, 8, VAR_4, VAR_5);", "} else {", "VAR_0->vc1dsp.avg_no_rnd_vc1_chroma_pixels_tab[0](s->dest[1] + VAR_11, srcU, s->uvlinesize, 8, VAR_4, VAR_5);", "VAR_0->vc1dsp.avg_no_rnd_vc1_chroma_pixels_tab[0](s->dest[2] + VAR_11, srcV, s->uvlinesize, 8, VAR_4, VAR_5);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21, 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37, 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 95 ], [ 97 ], [ 99 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 127, 129, 131 ], [ 133 ], [ 137 ], [ 139, 141, 143, 145, 147 ], [ 149 ], [ 151, 153, 155, 157 ], [ 159, 161, 163, 165 ], [ 167 ], [ 169 ], [ 173 ], [ 175 ], [ 177 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 273 ], [ 275 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ], [ 291 ], [ 293 ], [ 295 ], [ 299, 301 ], [ 303, 305 ], [ 307 ], [ 311 ], [ 315 ], [ 317 ], [ 319 ], [ 321 ], [ 323 ], [ 325 ], [ 327 ], [ 329 ], [ 331 ], [ 333 ] ]
6,701
static int virtio_blk_handle_rw_error(VirtIOBlockReq *req, int error, bool is_read) { BlockErrorAction action = blk_get_error_action(req->dev->blk, is_read, error); VirtIOBlock *s = req->dev; if (action == BLOCK_ERROR_ACTION_STOP) { req->next = s->rq; s->rq = req; } else if (action == BLOCK_ERROR_ACTION_REPORT) { virtio_blk_req_complete(req, VIRTIO_BLK_S_IOERR); block_acct_done(blk_get_stats(s->blk), &req->acct); virtio_blk_free_request(req); } blk_error_action(s->blk, action, is_read, error); return action != BLOCK_ERROR_ACTION_IGNORE; }
true
qemu
01762e03222154fef6d98087ce391aed8a157be5
static int virtio_blk_handle_rw_error(VirtIOBlockReq *req, int error, bool is_read) { BlockErrorAction action = blk_get_error_action(req->dev->blk, is_read, error); VirtIOBlock *s = req->dev; if (action == BLOCK_ERROR_ACTION_STOP) { req->next = s->rq; s->rq = req; } else if (action == BLOCK_ERROR_ACTION_REPORT) { virtio_blk_req_complete(req, VIRTIO_BLK_S_IOERR); block_acct_done(blk_get_stats(s->blk), &req->acct); virtio_blk_free_request(req); } blk_error_action(s->blk, action, is_read, error); return action != BLOCK_ERROR_ACTION_IGNORE; }
{ "code": [ " block_acct_done(blk_get_stats(s->blk), &req->acct);" ], "line_no": [ 25 ] }
static int FUNC_0(VirtIOBlockReq *VAR_0, int VAR_1, bool VAR_2) { BlockErrorAction action = blk_get_error_action(VAR_0->dev->blk, VAR_2, VAR_1); VirtIOBlock *s = VAR_0->dev; if (action == BLOCK_ERROR_ACTION_STOP) { VAR_0->next = s->rq; s->rq = VAR_0; } else if (action == BLOCK_ERROR_ACTION_REPORT) { virtio_blk_req_complete(VAR_0, VIRTIO_BLK_S_IOERR); block_acct_done(blk_get_stats(s->blk), &VAR_0->acct); virtio_blk_free_request(VAR_0); } blk_error_action(s->blk, action, VAR_2, VAR_1); return action != BLOCK_ERROR_ACTION_IGNORE; }
[ "static int FUNC_0(VirtIOBlockReq *VAR_0, int VAR_1,\nbool VAR_2)\n{", "BlockErrorAction action = blk_get_error_action(VAR_0->dev->blk,\nVAR_2, VAR_1);", "VirtIOBlock *s = VAR_0->dev;", "if (action == BLOCK_ERROR_ACTION_STOP) {", "VAR_0->next = s->rq;", "s->rq = VAR_0;", "} else if (action == BLOCK_ERROR_ACTION_REPORT) {", "virtio_blk_req_complete(VAR_0, VIRTIO_BLK_S_IOERR);", "block_acct_done(blk_get_stats(s->blk), &VAR_0->acct);", "virtio_blk_free_request(VAR_0);", "}", "blk_error_action(s->blk, action, VAR_2, VAR_1);", "return action != BLOCK_ERROR_ACTION_IGNORE;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7, 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ] ]
6,702
static int dnxhd_decode_header(DNXHDContext *ctx, const uint8_t *buf, int buf_size, int first_field) { static const uint8_t header_prefix[] = { 0x00, 0x00, 0x02, 0x80, 0x01 }; int i, cid; if (buf_size < 0x280) return -1; if (memcmp(buf, header_prefix, 5)) { av_log(ctx->avctx, AV_LOG_ERROR, "error in header\n"); return -1; } if (buf[5] & 2) { /* interlaced */ ctx->cur_field = buf[5] & 1; ctx->picture.interlaced_frame = 1; ctx->picture.top_field_first = first_field ^ ctx->cur_field; av_log(ctx->avctx, AV_LOG_DEBUG, "interlaced %d, cur field %d\n", buf[5] & 3, ctx->cur_field); } ctx->height = AV_RB16(buf + 0x18); ctx->width = AV_RB16(buf + 0x1a); av_dlog(ctx->avctx, "width %d, height %d\n", ctx->width, ctx->height); if (buf[0x21] & 0x40) { ctx->avctx->pix_fmt = AV_PIX_FMT_YUV422P10; ctx->avctx->bits_per_raw_sample = 10; if (ctx->bit_depth != 10) { ff_dsputil_init(&ctx->dsp, ctx->avctx); ctx->bit_depth = 10; ctx->decode_dct_block = dnxhd_decode_dct_block_10; } } else { ctx->avctx->pix_fmt = AV_PIX_FMT_YUV422P; ctx->avctx->bits_per_raw_sample = 8; if (ctx->bit_depth != 8) { ff_dsputil_init(&ctx->dsp, ctx->avctx); ctx->bit_depth = 8; ctx->decode_dct_block = dnxhd_decode_dct_block_8; } } cid = AV_RB32(buf + 0x28); av_dlog(ctx->avctx, "compression id %d\n", cid); if (dnxhd_init_vlc(ctx, cid) < 0) return -1; if (buf_size < ctx->cid_table->coding_unit_size) { av_log(ctx->avctx, AV_LOG_ERROR, "incorrect frame size\n"); return -1; } ctx->mb_width = ctx->width>>4; ctx->mb_height = buf[0x16d]; av_dlog(ctx->avctx, "mb width %d, mb height %d\n", ctx->mb_width, ctx->mb_height); if ((ctx->height+15)>>4 == ctx->mb_height && ctx->picture.interlaced_frame) ctx->height <<= 1; if (ctx->mb_height > 68 || (ctx->mb_height<<ctx->picture.interlaced_frame) > (ctx->height+15)>>4) { av_log(ctx->avctx, AV_LOG_ERROR, "mb height too big: %d\n", ctx->mb_height); return -1; } for (i = 0; i < ctx->mb_height; i++) { ctx->mb_scan_index[i] = AV_RB32(buf + 0x170 + (i<<2)); av_dlog(ctx->avctx, "mb scan index %d\n", ctx->mb_scan_index[i]); if (buf_size < ctx->mb_scan_index[i] + 0x280) { av_log(ctx->avctx, AV_LOG_ERROR, "invalid mb scan index\n"); return -1; } } return 0; }
true
FFmpeg
4a2da83a787b24c4027aa963d9db9b453e91f413
static int dnxhd_decode_header(DNXHDContext *ctx, const uint8_t *buf, int buf_size, int first_field) { static const uint8_t header_prefix[] = { 0x00, 0x00, 0x02, 0x80, 0x01 }; int i, cid; if (buf_size < 0x280) return -1; if (memcmp(buf, header_prefix, 5)) { av_log(ctx->avctx, AV_LOG_ERROR, "error in header\n"); return -1; } if (buf[5] & 2) { ctx->cur_field = buf[5] & 1; ctx->picture.interlaced_frame = 1; ctx->picture.top_field_first = first_field ^ ctx->cur_field; av_log(ctx->avctx, AV_LOG_DEBUG, "interlaced %d, cur field %d\n", buf[5] & 3, ctx->cur_field); } ctx->height = AV_RB16(buf + 0x18); ctx->width = AV_RB16(buf + 0x1a); av_dlog(ctx->avctx, "width %d, height %d\n", ctx->width, ctx->height); if (buf[0x21] & 0x40) { ctx->avctx->pix_fmt = AV_PIX_FMT_YUV422P10; ctx->avctx->bits_per_raw_sample = 10; if (ctx->bit_depth != 10) { ff_dsputil_init(&ctx->dsp, ctx->avctx); ctx->bit_depth = 10; ctx->decode_dct_block = dnxhd_decode_dct_block_10; } } else { ctx->avctx->pix_fmt = AV_PIX_FMT_YUV422P; ctx->avctx->bits_per_raw_sample = 8; if (ctx->bit_depth != 8) { ff_dsputil_init(&ctx->dsp, ctx->avctx); ctx->bit_depth = 8; ctx->decode_dct_block = dnxhd_decode_dct_block_8; } } cid = AV_RB32(buf + 0x28); av_dlog(ctx->avctx, "compression id %d\n", cid); if (dnxhd_init_vlc(ctx, cid) < 0) return -1; if (buf_size < ctx->cid_table->coding_unit_size) { av_log(ctx->avctx, AV_LOG_ERROR, "incorrect frame size\n"); return -1; } ctx->mb_width = ctx->width>>4; ctx->mb_height = buf[0x16d]; av_dlog(ctx->avctx, "mb width %d, mb height %d\n", ctx->mb_width, ctx->mb_height); if ((ctx->height+15)>>4 == ctx->mb_height && ctx->picture.interlaced_frame) ctx->height <<= 1; if (ctx->mb_height > 68 || (ctx->mb_height<<ctx->picture.interlaced_frame) > (ctx->height+15)>>4) { av_log(ctx->avctx, AV_LOG_ERROR, "mb height too big: %d\n", ctx->mb_height); return -1; } for (i = 0; i < ctx->mb_height; i++) { ctx->mb_scan_index[i] = AV_RB32(buf + 0x170 + (i<<2)); av_dlog(ctx->avctx, "mb scan index %d\n", ctx->mb_scan_index[i]); if (buf_size < ctx->mb_scan_index[i] + 0x280) { av_log(ctx->avctx, AV_LOG_ERROR, "invalid mb scan index\n"); return -1; } } return 0; }
{ "code": [ " if (buf_size < ctx->mb_scan_index[i] + 0x280) {" ], "line_no": [ 141 ] }
static int FUNC_0(DNXHDContext *VAR_0, const uint8_t *VAR_1, int VAR_2, int VAR_3) { static const uint8_t VAR_4[] = { 0x00, 0x00, 0x02, 0x80, 0x01 }; int VAR_5, VAR_6; if (VAR_2 < 0x280) return -1; if (memcmp(VAR_1, VAR_4, 5)) { av_log(VAR_0->avctx, AV_LOG_ERROR, "error in header\n"); return -1; } if (VAR_1[5] & 2) { VAR_0->cur_field = VAR_1[5] & 1; VAR_0->picture.interlaced_frame = 1; VAR_0->picture.top_field_first = VAR_3 ^ VAR_0->cur_field; av_log(VAR_0->avctx, AV_LOG_DEBUG, "interlaced %d, cur field %d\n", VAR_1[5] & 3, VAR_0->cur_field); } VAR_0->height = AV_RB16(VAR_1 + 0x18); VAR_0->width = AV_RB16(VAR_1 + 0x1a); av_dlog(VAR_0->avctx, "width %d, height %d\n", VAR_0->width, VAR_0->height); if (VAR_1[0x21] & 0x40) { VAR_0->avctx->pix_fmt = AV_PIX_FMT_YUV422P10; VAR_0->avctx->bits_per_raw_sample = 10; if (VAR_0->bit_depth != 10) { ff_dsputil_init(&VAR_0->dsp, VAR_0->avctx); VAR_0->bit_depth = 10; VAR_0->decode_dct_block = dnxhd_decode_dct_block_10; } } else { VAR_0->avctx->pix_fmt = AV_PIX_FMT_YUV422P; VAR_0->avctx->bits_per_raw_sample = 8; if (VAR_0->bit_depth != 8) { ff_dsputil_init(&VAR_0->dsp, VAR_0->avctx); VAR_0->bit_depth = 8; VAR_0->decode_dct_block = dnxhd_decode_dct_block_8; } } VAR_6 = AV_RB32(VAR_1 + 0x28); av_dlog(VAR_0->avctx, "compression id %d\n", VAR_6); if (dnxhd_init_vlc(VAR_0, VAR_6) < 0) return -1; if (VAR_2 < VAR_0->cid_table->coding_unit_size) { av_log(VAR_0->avctx, AV_LOG_ERROR, "incorrect frame size\n"); return -1; } VAR_0->mb_width = VAR_0->width>>4; VAR_0->mb_height = VAR_1[0x16d]; av_dlog(VAR_0->avctx, "mb width %d, mb height %d\n", VAR_0->mb_width, VAR_0->mb_height); if ((VAR_0->height+15)>>4 == VAR_0->mb_height && VAR_0->picture.interlaced_frame) VAR_0->height <<= 1; if (VAR_0->mb_height > 68 || (VAR_0->mb_height<<VAR_0->picture.interlaced_frame) > (VAR_0->height+15)>>4) { av_log(VAR_0->avctx, AV_LOG_ERROR, "mb height too big: %d\n", VAR_0->mb_height); return -1; } for (VAR_5 = 0; VAR_5 < VAR_0->mb_height; VAR_5++) { VAR_0->mb_scan_index[VAR_5] = AV_RB32(VAR_1 + 0x170 + (VAR_5<<2)); av_dlog(VAR_0->avctx, "mb scan index %d\n", VAR_0->mb_scan_index[VAR_5]); if (VAR_2 < VAR_0->mb_scan_index[VAR_5] + 0x280) { av_log(VAR_0->avctx, AV_LOG_ERROR, "invalid mb scan index\n"); return -1; } } return 0; }
[ "static int FUNC_0(DNXHDContext *VAR_0, const uint8_t *VAR_1, int VAR_2, int VAR_3)\n{", "static const uint8_t VAR_4[] = { 0x00, 0x00, 0x02, 0x80, 0x01 };", "int VAR_5, VAR_6;", "if (VAR_2 < 0x280)\nreturn -1;", "if (memcmp(VAR_1, VAR_4, 5)) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"error in header\\n\");", "return -1;", "}", "if (VAR_1[5] & 2) {", "VAR_0->cur_field = VAR_1[5] & 1;", "VAR_0->picture.interlaced_frame = 1;", "VAR_0->picture.top_field_first = VAR_3 ^ VAR_0->cur_field;", "av_log(VAR_0->avctx, AV_LOG_DEBUG, \"interlaced %d, cur field %d\\n\", VAR_1[5] & 3, VAR_0->cur_field);", "}", "VAR_0->height = AV_RB16(VAR_1 + 0x18);", "VAR_0->width = AV_RB16(VAR_1 + 0x1a);", "av_dlog(VAR_0->avctx, \"width %d, height %d\\n\", VAR_0->width, VAR_0->height);", "if (VAR_1[0x21] & 0x40) {", "VAR_0->avctx->pix_fmt = AV_PIX_FMT_YUV422P10;", "VAR_0->avctx->bits_per_raw_sample = 10;", "if (VAR_0->bit_depth != 10) {", "ff_dsputil_init(&VAR_0->dsp, VAR_0->avctx);", "VAR_0->bit_depth = 10;", "VAR_0->decode_dct_block = dnxhd_decode_dct_block_10;", "}", "} else {", "VAR_0->avctx->pix_fmt = AV_PIX_FMT_YUV422P;", "VAR_0->avctx->bits_per_raw_sample = 8;", "if (VAR_0->bit_depth != 8) {", "ff_dsputil_init(&VAR_0->dsp, VAR_0->avctx);", "VAR_0->bit_depth = 8;", "VAR_0->decode_dct_block = dnxhd_decode_dct_block_8;", "}", "}", "VAR_6 = AV_RB32(VAR_1 + 0x28);", "av_dlog(VAR_0->avctx, \"compression id %d\\n\", VAR_6);", "if (dnxhd_init_vlc(VAR_0, VAR_6) < 0)\nreturn -1;", "if (VAR_2 < VAR_0->cid_table->coding_unit_size) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"incorrect frame size\\n\");", "return -1;", "}", "VAR_0->mb_width = VAR_0->width>>4;", "VAR_0->mb_height = VAR_1[0x16d];", "av_dlog(VAR_0->avctx, \"mb width %d, mb height %d\\n\", VAR_0->mb_width, VAR_0->mb_height);", "if ((VAR_0->height+15)>>4 == VAR_0->mb_height && VAR_0->picture.interlaced_frame)\nVAR_0->height <<= 1;", "if (VAR_0->mb_height > 68 ||\n(VAR_0->mb_height<<VAR_0->picture.interlaced_frame) > (VAR_0->height+15)>>4) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"mb height too big: %d\\n\", VAR_0->mb_height);", "return -1;", "}", "for (VAR_5 = 0; VAR_5 < VAR_0->mb_height; VAR_5++) {", "VAR_0->mb_scan_index[VAR_5] = AV_RB32(VAR_1 + 0x170 + (VAR_5<<2));", "av_dlog(VAR_0->avctx, \"mb scan index %d\\n\", VAR_0->mb_scan_index[VAR_5]);", "if (VAR_2 < VAR_0->mb_scan_index[VAR_5] + 0x280) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"invalid mb scan index\\n\");", "return -1;", "}", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11, 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 85 ], [ 87 ], [ 91, 93 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 107 ], [ 109 ], [ 113 ], [ 117, 119 ], [ 123, 125 ], [ 127 ], [ 129 ], [ 131 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 153 ], [ 155 ] ]
6,703
static int ogg_write_trailer(AVFormatContext *s) { int i; /* flush current page */ for (i = 0; i < s->nb_streams; i++) ogg_buffer_page(s, s->streams[i]->priv_data); ogg_write_pages(s, 1); for (i = 0; i < s->nb_streams; i++) { AVStream *st = s->streams[i]; OGGStreamContext *oggstream = st->priv_data; if (st->codec->codec_id == CODEC_ID_FLAC || st->codec->codec_id == CODEC_ID_SPEEX) { av_free(oggstream->header[0]); } av_freep(&st->priv_data); } return 0; }
true
FFmpeg
dacf07661467bc349d17bdab06516daceabffb23
static int ogg_write_trailer(AVFormatContext *s) { int i; for (i = 0; i < s->nb_streams; i++) ogg_buffer_page(s, s->streams[i]->priv_data); ogg_write_pages(s, 1); for (i = 0; i < s->nb_streams; i++) { AVStream *st = s->streams[i]; OGGStreamContext *oggstream = st->priv_data; if (st->codec->codec_id == CODEC_ID_FLAC || st->codec->codec_id == CODEC_ID_SPEEX) { av_free(oggstream->header[0]); } av_freep(&st->priv_data); } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0) { int VAR_1; for (VAR_1 = 0; VAR_1 < VAR_0->nb_streams; VAR_1++) ogg_buffer_page(VAR_0, VAR_0->streams[VAR_1]->priv_data); ogg_write_pages(VAR_0, 1); for (VAR_1 = 0; VAR_1 < VAR_0->nb_streams; VAR_1++) { AVStream *st = VAR_0->streams[VAR_1]; OGGStreamContext *oggstream = st->priv_data; if (st->codec->codec_id == CODEC_ID_FLAC || st->codec->codec_id == CODEC_ID_SPEEX) { av_free(oggstream->header[0]); } av_freep(&st->priv_data); } return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0)\n{", "int VAR_1;", "for (VAR_1 = 0; VAR_1 < VAR_0->nb_streams; VAR_1++)", "ogg_buffer_page(VAR_0, VAR_0->streams[VAR_1]->priv_data);", "ogg_write_pages(VAR_0, 1);", "for (VAR_1 = 0; VAR_1 < VAR_0->nb_streams; VAR_1++) {", "AVStream *st = VAR_0->streams[VAR_1];", "OGGStreamContext *oggstream = st->priv_data;", "if (st->codec->codec_id == CODEC_ID_FLAC ||\nst->codec->codec_id == CODEC_ID_SPEEX) {", "av_free(oggstream->header[0]);", "}", "av_freep(&st->priv_data);", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 11 ], [ 13 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 34 ], [ 38 ], [ 40 ], [ 42 ], [ 44 ] ]
6,704
static void do_inject_mce(Monitor *mon, const QDict *qdict) { CPUState *cenv; int cpu_index = qdict_get_int(qdict, "cpu_index"); int bank = qdict_get_int(qdict, "bank"); uint64_t status = qdict_get_int(qdict, "status"); uint64_t mcg_status = qdict_get_int(qdict, "mcg_status"); uint64_t addr = qdict_get_int(qdict, "addr"); uint64_t misc = qdict_get_int(qdict, "misc"); for (cenv = first_cpu; cenv != NULL; cenv = cenv->next_cpu) if (cenv->cpu_index == cpu_index && cenv->mcg_cap) { cpu_inject_x86_mce(cenv, bank, status, mcg_status, addr, misc); break; } }
true
qemu
31ce5e0c49821d92fb30cce2f3055ef33613b287
static void do_inject_mce(Monitor *mon, const QDict *qdict) { CPUState *cenv; int cpu_index = qdict_get_int(qdict, "cpu_index"); int bank = qdict_get_int(qdict, "bank"); uint64_t status = qdict_get_int(qdict, "status"); uint64_t mcg_status = qdict_get_int(qdict, "mcg_status"); uint64_t addr = qdict_get_int(qdict, "addr"); uint64_t misc = qdict_get_int(qdict, "misc"); for (cenv = first_cpu; cenv != NULL; cenv = cenv->next_cpu) if (cenv->cpu_index == cpu_index && cenv->mcg_cap) { cpu_inject_x86_mce(cenv, bank, status, mcg_status, addr, misc); break; } }
{ "code": [ " for (cenv = first_cpu; cenv != NULL; cenv = cenv->next_cpu)", " cpu_inject_x86_mce(cenv, bank, status, mcg_status, addr, misc);" ], "line_no": [ 21, 25 ] }
static void FUNC_0(Monitor *VAR_0, const QDict *VAR_1) { CPUState *cenv; int VAR_2 = qdict_get_int(VAR_1, "VAR_2"); int VAR_3 = qdict_get_int(VAR_1, "VAR_3"); uint64_t status = qdict_get_int(VAR_1, "status"); uint64_t mcg_status = qdict_get_int(VAR_1, "mcg_status"); uint64_t addr = qdict_get_int(VAR_1, "addr"); uint64_t misc = qdict_get_int(VAR_1, "misc"); for (cenv = first_cpu; cenv != NULL; cenv = cenv->next_cpu) if (cenv->VAR_2 == VAR_2 && cenv->mcg_cap) { cpu_inject_x86_mce(cenv, VAR_3, status, mcg_status, addr, misc); break; } }
[ "static void FUNC_0(Monitor *VAR_0, const QDict *VAR_1)\n{", "CPUState *cenv;", "int VAR_2 = qdict_get_int(VAR_1, \"VAR_2\");", "int VAR_3 = qdict_get_int(VAR_1, \"VAR_3\");", "uint64_t status = qdict_get_int(VAR_1, \"status\");", "uint64_t mcg_status = qdict_get_int(VAR_1, \"mcg_status\");", "uint64_t addr = qdict_get_int(VAR_1, \"addr\");", "uint64_t misc = qdict_get_int(VAR_1, \"misc\");", "for (cenv = first_cpu; cenv != NULL; cenv = cenv->next_cpu)", "if (cenv->VAR_2 == VAR_2 && cenv->mcg_cap) {", "cpu_inject_x86_mce(cenv, VAR_3, status, mcg_status, addr, misc);", "break;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ] ]
6,705
static int avi_sync(AVFormatContext *s, int exit_early) { AVIContext *avi = s->priv_data; AVIOContext *pb = s->pb; int n; unsigned int d[8]; unsigned int size; int64_t i, sync; start_sync: memset(d, -1, sizeof(d)); for (i = sync = avio_tell(pb); !avio_feof(pb); i++) { int j; for (j = 0; j < 7; j++) d[j] = d[j + 1]; d[7] = avio_r8(pb); size = d[4] + (d[5] << 8) + (d[6] << 16) + (d[7] << 24); n = get_stream_idx(d + 2); ff_tlog(s, "%X %X %X %X %X %X %X %X %"PRId64" %u %d\n", d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7], i, size, n); if (i*(avi->io_fsize>0) + (uint64_t)size > avi->fsize || d[0] > 127) continue; // parse ix## if ((d[0] == 'i' && d[1] == 'x' && n < s->nb_streams) || // parse JUNK (d[0] == 'J' && d[1] == 'U' && d[2] == 'N' && d[3] == 'K') || (d[0] == 'i' && d[1] == 'd' && d[2] == 'x' && d[3] == '1') || (d[0] == 'i' && d[1] == 'n' && d[2] == 'd' && d[3] == 'x')) { avio_skip(pb, size); goto start_sync; } // parse stray LIST if (d[0] == 'L' && d[1] == 'I' && d[2] == 'S' && d[3] == 'T') { avio_skip(pb, 4); goto start_sync; } n = get_stream_idx(d); if (!((i - avi->last_pkt_pos) & 1) && get_stream_idx(d + 1) < s->nb_streams) continue; // detect ##ix chunk and skip if (d[2] == 'i' && d[3] == 'x' && n < s->nb_streams) { avio_skip(pb, size); goto start_sync; } if (avi->dv_demux && n != 0) continue; // parse ##dc/##wb if (n < s->nb_streams) { AVStream *st; AVIStream *ast; st = s->streams[n]; ast = st->priv_data; if (!ast) { av_log(s, AV_LOG_WARNING, "Skipping foreign stream %d packet\n", n); continue; } if (s->nb_streams >= 2) { AVStream *st1 = s->streams[1]; AVIStream *ast1 = st1->priv_data; // workaround for broken small-file-bug402.avi if ( d[2] == 'w' && d[3] == 'b' && n == 0 && st ->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && st1->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && ast->prefix == 'd'*256+'c' && (d[2]*256+d[3] == ast1->prefix || !ast1->prefix_count) ) { n = 1; st = st1; ast = ast1; av_log(s, AV_LOG_WARNING, "Invalid stream + prefix combination, assuming audio.\n"); } } if (!avi->dv_demux && ((st->discard >= AVDISCARD_DEFAULT && size == 0) /* || // FIXME: needs a little reordering (st->discard >= AVDISCARD_NONKEY && !(pkt->flags & AV_PKT_FLAG_KEY)) */ || st->discard >= AVDISCARD_ALL)) { if (!exit_early) { ast->frame_offset += get_duration(ast, size); avio_skip(pb, size); goto start_sync; } } if (d[2] == 'p' && d[3] == 'c' && size <= 4 * 256 + 4) { int k = avio_r8(pb); int last = (k + avio_r8(pb) - 1) & 0xFF; avio_rl16(pb); // flags // b + (g << 8) + (r << 16); for (; k <= last; k++) ast->pal[k] = 0xFFU<<24 | avio_rb32(pb)>>8; ast->has_pal = 1; goto start_sync; } else if (((ast->prefix_count < 5 || sync + 9 > i) && d[2] < 128 && d[3] < 128) || d[2] * 256 + d[3] == ast->prefix /* || (d[2] == 'd' && d[3] == 'c') || (d[2] == 'w' && d[3] == 'b') */) { if (exit_early) return 0; if (d[2] * 256 + d[3] == ast->prefix) ast->prefix_count++; else { ast->prefix = d[2] * 256 + d[3]; ast->prefix_count = 0; } avi->stream_index = n; ast->packet_size = size + 8; ast->remaining = size; if (size) { uint64_t pos = avio_tell(pb) - 8; if (!st->index_entries || !st->nb_index_entries || st->index_entries[st->nb_index_entries - 1].pos < pos) { av_add_index_entry(st, pos, ast->frame_offset, size, 0, AVINDEX_KEYFRAME); } } return 0; } } } if (pb->error) return pb->error; return AVERROR_EOF; }
false
FFmpeg
511e10f673a69c05744be0355cc9ce5705407bc2
static int avi_sync(AVFormatContext *s, int exit_early) { AVIContext *avi = s->priv_data; AVIOContext *pb = s->pb; int n; unsigned int d[8]; unsigned int size; int64_t i, sync; start_sync: memset(d, -1, sizeof(d)); for (i = sync = avio_tell(pb); !avio_feof(pb); i++) { int j; for (j = 0; j < 7; j++) d[j] = d[j + 1]; d[7] = avio_r8(pb); size = d[4] + (d[5] << 8) + (d[6] << 16) + (d[7] << 24); n = get_stream_idx(d + 2); ff_tlog(s, "%X %X %X %X %X %X %X %X %"PRId64" %u %d\n", d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7], i, size, n); if (i*(avi->io_fsize>0) + (uint64_t)size > avi->fsize || d[0] > 127) continue; if ((d[0] == 'i' && d[1] == 'x' && n < s->nb_streams) || (d[0] == 'J' && d[1] == 'U' && d[2] == 'N' && d[3] == 'K') || (d[0] == 'i' && d[1] == 'd' && d[2] == 'x' && d[3] == '1') || (d[0] == 'i' && d[1] == 'n' && d[2] == 'd' && d[3] == 'x')) { avio_skip(pb, size); goto start_sync; } if (d[0] == 'L' && d[1] == 'I' && d[2] == 'S' && d[3] == 'T') { avio_skip(pb, 4); goto start_sync; } n = get_stream_idx(d); if (!((i - avi->last_pkt_pos) & 1) && get_stream_idx(d + 1) < s->nb_streams) continue; if (d[2] == 'i' && d[3] == 'x' && n < s->nb_streams) { avio_skip(pb, size); goto start_sync; } if (avi->dv_demux && n != 0) continue; if (n < s->nb_streams) { AVStream *st; AVIStream *ast; st = s->streams[n]; ast = st->priv_data; if (!ast) { av_log(s, AV_LOG_WARNING, "Skipping foreign stream %d packet\n", n); continue; } if (s->nb_streams >= 2) { AVStream *st1 = s->streams[1]; AVIStream *ast1 = st1->priv_data; if ( d[2] == 'w' && d[3] == 'b' && n == 0 && st ->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && st1->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && ast->prefix == 'd'*256+'c' && (d[2]*256+d[3] == ast1->prefix || !ast1->prefix_count) ) { n = 1; st = st1; ast = ast1; av_log(s, AV_LOG_WARNING, "Invalid stream + prefix combination, assuming audio.\n"); } } if (!avi->dv_demux && ((st->discard >= AVDISCARD_DEFAULT && size == 0) || st->discard >= AVDISCARD_ALL)) { if (!exit_early) { ast->frame_offset += get_duration(ast, size); avio_skip(pb, size); goto start_sync; } } if (d[2] == 'p' && d[3] == 'c' && size <= 4 * 256 + 4) { int k = avio_r8(pb); int last = (k + avio_r8(pb) - 1) & 0xFF; avio_rl16(pb); for (; k <= last; k++) ast->pal[k] = 0xFFU<<24 | avio_rb32(pb)>>8; ast->has_pal = 1; goto start_sync; } else if (((ast->prefix_count < 5 || sync + 9 > i) && d[2] < 128 && d[3] < 128) || d[2] * 256 + d[3] == ast->prefix ) { if (exit_early) return 0; if (d[2] * 256 + d[3] == ast->prefix) ast->prefix_count++; else { ast->prefix = d[2] * 256 + d[3]; ast->prefix_count = 0; } avi->stream_index = n; ast->packet_size = size + 8; ast->remaining = size; if (size) { uint64_t pos = avio_tell(pb) - 8; if (!st->index_entries || !st->nb_index_entries || st->index_entries[st->nb_index_entries - 1].pos < pos) { av_add_index_entry(st, pos, ast->frame_offset, size, 0, AVINDEX_KEYFRAME); } } return 0; } } } if (pb->error) return pb->error; return AVERROR_EOF; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0, int VAR_1) { AVIContext *avi = VAR_0->priv_data; AVIOContext *pb = VAR_0->pb; int VAR_2; unsigned int VAR_3[8]; unsigned int VAR_4; int64_t i, sync; start_sync: memset(VAR_3, -1, sizeof(VAR_3)); for (i = sync = avio_tell(pb); !avio_feof(pb); i++) { int j; for (j = 0; j < 7; j++) VAR_3[j] = VAR_3[j + 1]; VAR_3[7] = avio_r8(pb); VAR_4 = VAR_3[4] + (VAR_3[5] << 8) + (VAR_3[6] << 16) + (VAR_3[7] << 24); VAR_2 = get_stream_idx(VAR_3 + 2); ff_tlog(VAR_0, "%X %X %X %X %X %X %X %X %"PRId64" %u %VAR_3\VAR_2", VAR_3[0], VAR_3[1], VAR_3[2], VAR_3[3], VAR_3[4], VAR_3[5], VAR_3[6], VAR_3[7], i, VAR_4, VAR_2); if (i*(avi->io_fsize>0) + (uint64_t)VAR_4 > avi->fsize || VAR_3[0] > 127) continue; if ((VAR_3[0] == 'i' && VAR_3[1] == 'x' && VAR_2 < VAR_0->nb_streams) || (VAR_3[0] == 'J' && VAR_3[1] == 'U' && VAR_3[2] == 'N' && VAR_3[3] == 'K') || (VAR_3[0] == 'i' && VAR_3[1] == 'VAR_3' && VAR_3[2] == 'x' && VAR_3[3] == '1') || (VAR_3[0] == 'i' && VAR_3[1] == 'VAR_2' && VAR_3[2] == 'VAR_3' && VAR_3[3] == 'x')) { avio_skip(pb, VAR_4); goto start_sync; } if (VAR_3[0] == 'L' && VAR_3[1] == 'I' && VAR_3[2] == 'S' && VAR_3[3] == 'T') { avio_skip(pb, 4); goto start_sync; } VAR_2 = get_stream_idx(VAR_3); if (!((i - avi->last_pkt_pos) & 1) && get_stream_idx(VAR_3 + 1) < VAR_0->nb_streams) continue; if (VAR_3[2] == 'i' && VAR_3[3] == 'x' && VAR_2 < VAR_0->nb_streams) { avio_skip(pb, VAR_4); goto start_sync; } if (avi->dv_demux && VAR_2 != 0) continue; if (VAR_2 < VAR_0->nb_streams) { AVStream *st; AVIStream *ast; st = VAR_0->streams[VAR_2]; ast = st->priv_data; if (!ast) { av_log(VAR_0, AV_LOG_WARNING, "Skipping foreign stream %VAR_3 packet\VAR_2", VAR_2); continue; } if (VAR_0->nb_streams >= 2) { AVStream *st1 = VAR_0->streams[1]; AVIStream *ast1 = st1->priv_data; if ( VAR_3[2] == 'w' && VAR_3[3] == 'b' && VAR_2 == 0 && st ->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && st1->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && ast->prefix == 'VAR_3'*256+'c' && (VAR_3[2]*256+VAR_3[3] == ast1->prefix || !ast1->prefix_count) ) { VAR_2 = 1; st = st1; ast = ast1; av_log(VAR_0, AV_LOG_WARNING, "Invalid stream + prefix combination, assuming audio.\VAR_2"); } } if (!avi->dv_demux && ((st->discard >= AVDISCARD_DEFAULT && VAR_4 == 0) || st->discard >= AVDISCARD_ALL)) { if (!VAR_1) { ast->frame_offset += get_duration(ast, VAR_4); avio_skip(pb, VAR_4); goto start_sync; } } if (VAR_3[2] == 'p' && VAR_3[3] == 'c' && VAR_4 <= 4 * 256 + 4) { int k = avio_r8(pb); int last = (k + avio_r8(pb) - 1) & 0xFF; avio_rl16(pb); for (; k <= last; k++) ast->pal[k] = 0xFFU<<24 | avio_rb32(pb)>>8; ast->has_pal = 1; goto start_sync; } else if (((ast->prefix_count < 5 || sync + 9 > i) && VAR_3[2] < 128 && VAR_3[3] < 128) || VAR_3[2] * 256 + VAR_3[3] == ast->prefix ) { if (VAR_1) return 0; if (VAR_3[2] * 256 + VAR_3[3] == ast->prefix) ast->prefix_count++; else { ast->prefix = VAR_3[2] * 256 + VAR_3[3]; ast->prefix_count = 0; } avi->stream_index = VAR_2; ast->packet_size = VAR_4 + 8; ast->remaining = VAR_4; if (VAR_4) { uint64_t pos = avio_tell(pb) - 8; if (!st->index_entries || !st->nb_index_entries || st->index_entries[st->nb_index_entries - 1].pos < pos) { av_add_index_entry(st, pos, ast->frame_offset, VAR_4, 0, AVINDEX_KEYFRAME); } } return 0; } } } if (pb->error) return pb->error; return AVERROR_EOF; }
[ "static int FUNC_0(AVFormatContext *VAR_0, int VAR_1)\n{", "AVIContext *avi = VAR_0->priv_data;", "AVIOContext *pb = VAR_0->pb;", "int VAR_2;", "unsigned int VAR_3[8];", "unsigned int VAR_4;", "int64_t i, sync;", "start_sync:\nmemset(VAR_3, -1, sizeof(VAR_3));", "for (i = sync = avio_tell(pb); !avio_feof(pb); i++) {", "int j;", "for (j = 0; j < 7; j++)", "VAR_3[j] = VAR_3[j + 1];", "VAR_3[7] = avio_r8(pb);", "VAR_4 = VAR_3[4] + (VAR_3[5] << 8) + (VAR_3[6] << 16) + (VAR_3[7] << 24);", "VAR_2 = get_stream_idx(VAR_3 + 2);", "ff_tlog(VAR_0, \"%X %X %X %X %X %X %X %X %\"PRId64\" %u %VAR_3\\VAR_2\",\nVAR_3[0], VAR_3[1], VAR_3[2], VAR_3[3], VAR_3[4], VAR_3[5], VAR_3[6], VAR_3[7], i, VAR_4, VAR_2);", "if (i*(avi->io_fsize>0) + (uint64_t)VAR_4 > avi->fsize || VAR_3[0] > 127)\ncontinue;", "if ((VAR_3[0] == 'i' && VAR_3[1] == 'x' && VAR_2 < VAR_0->nb_streams) ||\n(VAR_3[0] == 'J' && VAR_3[1] == 'U' && VAR_3[2] == 'N' && VAR_3[3] == 'K') ||\n(VAR_3[0] == 'i' && VAR_3[1] == 'VAR_3' && VAR_3[2] == 'x' && VAR_3[3] == '1') ||\n(VAR_3[0] == 'i' && VAR_3[1] == 'VAR_2' && VAR_3[2] == 'VAR_3' && VAR_3[3] == 'x')) {", "avio_skip(pb, VAR_4);", "goto start_sync;", "}", "if (VAR_3[0] == 'L' && VAR_3[1] == 'I' && VAR_3[2] == 'S' && VAR_3[3] == 'T') {", "avio_skip(pb, 4);", "goto start_sync;", "}", "VAR_2 = get_stream_idx(VAR_3);", "if (!((i - avi->last_pkt_pos) & 1) &&\nget_stream_idx(VAR_3 + 1) < VAR_0->nb_streams)\ncontinue;", "if (VAR_3[2] == 'i' && VAR_3[3] == 'x' && VAR_2 < VAR_0->nb_streams) {", "avio_skip(pb, VAR_4);", "goto start_sync;", "}", "if (avi->dv_demux && VAR_2 != 0)\ncontinue;", "if (VAR_2 < VAR_0->nb_streams) {", "AVStream *st;", "AVIStream *ast;", "st = VAR_0->streams[VAR_2];", "ast = st->priv_data;", "if (!ast) {", "av_log(VAR_0, AV_LOG_WARNING, \"Skipping foreign stream %VAR_3 packet\\VAR_2\", VAR_2);", "continue;", "}", "if (VAR_0->nb_streams >= 2) {", "AVStream *st1 = VAR_0->streams[1];", "AVIStream *ast1 = st1->priv_data;", "if ( VAR_3[2] == 'w' && VAR_3[3] == 'b'\n&& VAR_2 == 0\n&& st ->codecpar->codec_type == AVMEDIA_TYPE_VIDEO\n&& st1->codecpar->codec_type == AVMEDIA_TYPE_AUDIO\n&& ast->prefix == 'VAR_3'*256+'c'\n&& (VAR_3[2]*256+VAR_3[3] == ast1->prefix || !ast1->prefix_count)\n) {", "VAR_2 = 1;", "st = st1;", "ast = ast1;", "av_log(VAR_0, AV_LOG_WARNING,\n\"Invalid stream + prefix combination, assuming audio.\\VAR_2\");", "}", "}", "if (!avi->dv_demux &&\n((st->discard >= AVDISCARD_DEFAULT && VAR_4 == 0)\n|| st->discard >= AVDISCARD_ALL)) {", "if (!VAR_1) {", "ast->frame_offset += get_duration(ast, VAR_4);", "avio_skip(pb, VAR_4);", "goto start_sync;", "}", "}", "if (VAR_3[2] == 'p' && VAR_3[3] == 'c' && VAR_4 <= 4 * 256 + 4) {", "int k = avio_r8(pb);", "int last = (k + avio_r8(pb) - 1) & 0xFF;", "avio_rl16(pb);", "for (; k <= last; k++)", "ast->pal[k] = 0xFFU<<24 | avio_rb32(pb)>>8;", "ast->has_pal = 1;", "goto start_sync;", "} else if (((ast->prefix_count < 5 || sync + 9 > i) &&", "VAR_3[2] < 128 && VAR_3[3] < 128) ||\nVAR_3[2] * 256 + VAR_3[3] == ast->prefix\n) {", "if (VAR_1)\nreturn 0;", "if (VAR_3[2] * 256 + VAR_3[3] == ast->prefix)\nast->prefix_count++;", "else {", "ast->prefix = VAR_3[2] * 256 + VAR_3[3];", "ast->prefix_count = 0;", "}", "avi->stream_index = VAR_2;", "ast->packet_size = VAR_4 + 8;", "ast->remaining = VAR_4;", "if (VAR_4) {", "uint64_t pos = avio_tell(pb) - 8;", "if (!st->index_entries || !st->nb_index_entries ||\nst->index_entries[st->nb_index_entries - 1].pos < pos) {", "av_add_index_entry(st, pos, ast->frame_offset, VAR_4,\n0, AVINDEX_KEYFRAME);", "}", "}", "return 0;", "}", "}", "}", "if (pb->error)\nreturn pb->error;", "return AVERROR_EOF;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 41 ], [ 43, 45 ], [ 47, 49 ], [ 55, 59, 61, 63 ], [ 65 ], [ 67 ], [ 69 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 85 ], [ 89, 91, 93 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 109, 111 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 139 ], [ 141 ], [ 143 ], [ 147, 149, 151, 153, 155, 157, 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167, 169 ], [ 171 ], [ 173 ], [ 177, 179, 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 203 ], [ 205 ], [ 207 ], [ 211 ], [ 217 ], [ 219 ], [ 223 ], [ 225 ], [ 227 ], [ 229, 231, 235 ], [ 237, 239 ], [ 241, 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 255 ], [ 257 ], [ 259 ], [ 263 ], [ 265 ], [ 267, 269 ], [ 271, 273 ], [ 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 289, 291 ], [ 293 ], [ 295 ] ]
6,707
static int roq_probe(AVProbeData *p) { if (p->buf_size < 6) return 0; if ((AV_RL16(&p->buf[0]) != RoQ_MAGIC_NUMBER) || (AV_RL32(&p->buf[2]) != 0xFFFFFFFF)) return 0; return AVPROBE_SCORE_MAX; }
false
FFmpeg
87e8788680e16c51f6048af26f3f7830c35207a5
static int roq_probe(AVProbeData *p) { if (p->buf_size < 6) return 0; if ((AV_RL16(&p->buf[0]) != RoQ_MAGIC_NUMBER) || (AV_RL32(&p->buf[2]) != 0xFFFFFFFF)) return 0; return AVPROBE_SCORE_MAX; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVProbeData *VAR_0) { if (VAR_0->buf_size < 6) return 0; if ((AV_RL16(&VAR_0->buf[0]) != RoQ_MAGIC_NUMBER) || (AV_RL32(&VAR_0->buf[2]) != 0xFFFFFFFF)) return 0; return AVPROBE_SCORE_MAX; }
[ "static int FUNC_0(AVProbeData *VAR_0)\n{", "if (VAR_0->buf_size < 6)\nreturn 0;", "if ((AV_RL16(&VAR_0->buf[0]) != RoQ_MAGIC_NUMBER) ||\n(AV_RL32(&VAR_0->buf[2]) != 0xFFFFFFFF))\nreturn 0;", "return AVPROBE_SCORE_MAX;", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 11, 13, 15 ], [ 19 ], [ 21 ] ]
6,709
inline static void RENAME(hcscale)(SwsContext *c, uint16_t *dst, long dstWidth, const uint8_t *src1, const uint8_t *src2, int srcW, int xInc, const int16_t *hChrFilter, const int16_t *hChrFilterPos, int hChrFilterSize, uint8_t *formatConvBuffer, uint32_t *pal) { src1 += c->chrSrcOffset; src2 += c->chrSrcOffset; if (c->chrToYV12) { c->chrToYV12(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW, pal); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } if (c->hScale16) { c->hScale16(dst , dstWidth, (uint16_t*)src1, srcW, xInc, hChrFilter, hChrFilterPos, hChrFilterSize, av_pix_fmt_descriptors[c->srcFormat].comp[0].depth_minus1); c->hScale16(dst+VOFW, dstWidth, (uint16_t*)src2, srcW, xInc, hChrFilter, hChrFilterPos, hChrFilterSize, av_pix_fmt_descriptors[c->srcFormat].comp[0].depth_minus1); } else if (!c->hcscale_fast) { c->hScale(dst , dstWidth, src1, srcW, xInc, hChrFilter, hChrFilterPos, hChrFilterSize); c->hScale(dst+VOFW, dstWidth, src2, srcW, xInc, hChrFilter, hChrFilterPos, hChrFilterSize); } else { // fast bilinear upscale / crap downscale c->hcscale_fast(c, dst, dstWidth, src1, src2, srcW, xInc); } if (c->chrConvertRange) c->chrConvertRange(dst, dstWidth); }
false
FFmpeg
d1adad3cca407f493c3637e20ecd4f7124e69212
inline static void RENAME(hcscale)(SwsContext *c, uint16_t *dst, long dstWidth, const uint8_t *src1, const uint8_t *src2, int srcW, int xInc, const int16_t *hChrFilter, const int16_t *hChrFilterPos, int hChrFilterSize, uint8_t *formatConvBuffer, uint32_t *pal) { src1 += c->chrSrcOffset; src2 += c->chrSrcOffset; if (c->chrToYV12) { c->chrToYV12(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW, pal); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } if (c->hScale16) { c->hScale16(dst , dstWidth, (uint16_t*)src1, srcW, xInc, hChrFilter, hChrFilterPos, hChrFilterSize, av_pix_fmt_descriptors[c->srcFormat].comp[0].depth_minus1); c->hScale16(dst+VOFW, dstWidth, (uint16_t*)src2, srcW, xInc, hChrFilter, hChrFilterPos, hChrFilterSize, av_pix_fmt_descriptors[c->srcFormat].comp[0].depth_minus1); } else if (!c->hcscale_fast) { c->hScale(dst , dstWidth, src1, srcW, xInc, hChrFilter, hChrFilterPos, hChrFilterSize); c->hScale(dst+VOFW, dstWidth, src2, srcW, xInc, hChrFilter, hChrFilterPos, hChrFilterSize); } else { c->hcscale_fast(c, dst, dstWidth, src1, src2, srcW, xInc); } if (c->chrConvertRange) c->chrConvertRange(dst, dstWidth); }
{ "code": [], "line_no": [] }
inline static void FUNC_0(hcscale)(SwsContext *c, uint16_t *dst, long dstWidth, const uint8_t *src1, const uint8_t *src2, int srcW, int xInc, const int16_t *hChrFilter, const int16_t *hChrFilterPos, int hChrFilterSize, uint8_t *formatConvBuffer, uint32_t *pal) { src1 += c->chrSrcOffset; src2 += c->chrSrcOffset; if (c->chrToYV12) { c->chrToYV12(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW, pal); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } if (c->hScale16) { c->hScale16(dst , dstWidth, (uint16_t*)src1, srcW, xInc, hChrFilter, hChrFilterPos, hChrFilterSize, av_pix_fmt_descriptors[c->srcFormat].comp[0].depth_minus1); c->hScale16(dst+VOFW, dstWidth, (uint16_t*)src2, srcW, xInc, hChrFilter, hChrFilterPos, hChrFilterSize, av_pix_fmt_descriptors[c->srcFormat].comp[0].depth_minus1); } else if (!c->hcscale_fast) { c->hScale(dst , dstWidth, src1, srcW, xInc, hChrFilter, hChrFilterPos, hChrFilterSize); c->hScale(dst+VOFW, dstWidth, src2, srcW, xInc, hChrFilter, hChrFilterPos, hChrFilterSize); } else { c->hcscale_fast(c, dst, dstWidth, src1, src2, srcW, xInc); } if (c->chrConvertRange) c->chrConvertRange(dst, dstWidth); }
[ "inline static void FUNC_0(hcscale)(SwsContext *c, uint16_t *dst, long dstWidth, const uint8_t *src1, const uint8_t *src2,\nint srcW, int xInc, const int16_t *hChrFilter,\nconst int16_t *hChrFilterPos, int hChrFilterSize,\nuint8_t *formatConvBuffer,\nuint32_t *pal)\n{", "src1 += c->chrSrcOffset;", "src2 += c->chrSrcOffset;", "if (c->chrToYV12) {", "c->chrToYV12(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW, pal);", "src1= formatConvBuffer;", "src2= formatConvBuffer+VOFW;", "}", "if (c->hScale16) {", "c->hScale16(dst , dstWidth, (uint16_t*)src1, srcW, xInc, hChrFilter, hChrFilterPos, hChrFilterSize, av_pix_fmt_descriptors[c->srcFormat].comp[0].depth_minus1);", "c->hScale16(dst+VOFW, dstWidth, (uint16_t*)src2, srcW, xInc, hChrFilter, hChrFilterPos, hChrFilterSize, av_pix_fmt_descriptors[c->srcFormat].comp[0].depth_minus1);", "} else if (!c->hcscale_fast) {", "c->hScale(dst , dstWidth, src1, srcW, xInc, hChrFilter, hChrFilterPos, hChrFilterSize);", "c->hScale(dst+VOFW, dstWidth, src2, srcW, xInc, hChrFilter, hChrFilterPos, hChrFilterSize);", "} else {", "c->hcscale_fast(c, dst, dstWidth, src1, src2, srcW, xInc);", "}", "if (c->chrConvertRange)\nc->chrConvertRange(dst, dstWidth);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53, 55 ], [ 57 ] ]
6,711
static int net_init_nic(QemuOpts *opts, const char *name, VLANState *vlan) { int idx; NICInfo *nd; const char *netdev; idx = nic_get_free_idx(); if (idx == -1 || nb_nics >= MAX_NICS) { error_report("Too Many NICs"); return -1; } nd = &nd_table[idx]; memset(nd, 0, sizeof(*nd)); if ((netdev = qemu_opt_get(opts, "netdev"))) { nd->netdev = qemu_find_netdev(netdev); if (!nd->netdev) { error_report("netdev '%s' not found", netdev); return -1; } } else { assert(vlan); nd->vlan = vlan; } if (name) { nd->name = g_strdup(name); } if (qemu_opt_get(opts, "model")) { nd->model = g_strdup(qemu_opt_get(opts, "model")); } if (qemu_opt_get(opts, "addr")) { nd->devaddr = g_strdup(qemu_opt_get(opts, "addr")); } if (qemu_opt_get(opts, "macaddr") && net_parse_macaddr(nd->macaddr.a, qemu_opt_get(opts, "macaddr")) < 0) { error_report("invalid syntax for ethernet address"); return -1; } qemu_macaddr_default_if_unset(&nd->macaddr); nd->nvectors = qemu_opt_get_number(opts, "vectors", DEV_NVECTORS_UNSPECIFIED); if (nd->nvectors != DEV_NVECTORS_UNSPECIFIED && (nd->nvectors < 0 || nd->nvectors > 0x7ffffff)) { error_report("invalid # of vectors: %d", nd->nvectors); return -1; } nd->used = 1; nb_nics++; return idx; }
true
qemu
6687b79d636cd60ed9adb1177d0d946b58fa7717
static int net_init_nic(QemuOpts *opts, const char *name, VLANState *vlan) { int idx; NICInfo *nd; const char *netdev; idx = nic_get_free_idx(); if (idx == -1 || nb_nics >= MAX_NICS) { error_report("Too Many NICs"); return -1; } nd = &nd_table[idx]; memset(nd, 0, sizeof(*nd)); if ((netdev = qemu_opt_get(opts, "netdev"))) { nd->netdev = qemu_find_netdev(netdev); if (!nd->netdev) { error_report("netdev '%s' not found", netdev); return -1; } } else { assert(vlan); nd->vlan = vlan; } if (name) { nd->name = g_strdup(name); } if (qemu_opt_get(opts, "model")) { nd->model = g_strdup(qemu_opt_get(opts, "model")); } if (qemu_opt_get(opts, "addr")) { nd->devaddr = g_strdup(qemu_opt_get(opts, "addr")); } if (qemu_opt_get(opts, "macaddr") && net_parse_macaddr(nd->macaddr.a, qemu_opt_get(opts, "macaddr")) < 0) { error_report("invalid syntax for ethernet address"); return -1; } qemu_macaddr_default_if_unset(&nd->macaddr); nd->nvectors = qemu_opt_get_number(opts, "vectors", DEV_NVECTORS_UNSPECIFIED); if (nd->nvectors != DEV_NVECTORS_UNSPECIFIED && (nd->nvectors < 0 || nd->nvectors > 0x7ffffff)) { error_report("invalid # of vectors: %d", nd->nvectors); return -1; } nd->used = 1; nb_nics++; return idx; }
{ "code": [ "static int net_init_nic(QemuOpts *opts, const char *name, VLANState *vlan)", " return -1;", " return -1;", " return -1;" ], "line_no": [ 1, 19, 41, 41 ] }
static int FUNC_0(QemuOpts *VAR_0, const char *VAR_1, VLANState *VAR_2) { int VAR_3; NICInfo *nd; const char *VAR_4; VAR_3 = nic_get_free_idx(); if (VAR_3 == -1 || nb_nics >= MAX_NICS) { error_report("Too Many NICs"); return -1; } nd = &nd_table[VAR_3]; memset(nd, 0, sizeof(*nd)); if ((VAR_4 = qemu_opt_get(VAR_0, "VAR_4"))) { nd->VAR_4 = qemu_find_netdev(VAR_4); if (!nd->VAR_4) { error_report("VAR_4 '%s' not found", VAR_4); return -1; } } else { assert(VAR_2); nd->VAR_2 = VAR_2; } if (VAR_1) { nd->VAR_1 = g_strdup(VAR_1); } if (qemu_opt_get(VAR_0, "model")) { nd->model = g_strdup(qemu_opt_get(VAR_0, "model")); } if (qemu_opt_get(VAR_0, "addr")) { nd->devaddr = g_strdup(qemu_opt_get(VAR_0, "addr")); } if (qemu_opt_get(VAR_0, "macaddr") && net_parse_macaddr(nd->macaddr.a, qemu_opt_get(VAR_0, "macaddr")) < 0) { error_report("invalid syntax for ethernet address"); return -1; } qemu_macaddr_default_if_unset(&nd->macaddr); nd->nvectors = qemu_opt_get_number(VAR_0, "vectors", DEV_NVECTORS_UNSPECIFIED); if (nd->nvectors != DEV_NVECTORS_UNSPECIFIED && (nd->nvectors < 0 || nd->nvectors > 0x7ffffff)) { error_report("invalid # of vectors: %d", nd->nvectors); return -1; } nd->used = 1; nb_nics++; return VAR_3; }
[ "static int FUNC_0(QemuOpts *VAR_0, const char *VAR_1, VLANState *VAR_2)\n{", "int VAR_3;", "NICInfo *nd;", "const char *VAR_4;", "VAR_3 = nic_get_free_idx();", "if (VAR_3 == -1 || nb_nics >= MAX_NICS) {", "error_report(\"Too Many NICs\");", "return -1;", "}", "nd = &nd_table[VAR_3];", "memset(nd, 0, sizeof(*nd));", "if ((VAR_4 = qemu_opt_get(VAR_0, \"VAR_4\"))) {", "nd->VAR_4 = qemu_find_netdev(VAR_4);", "if (!nd->VAR_4) {", "error_report(\"VAR_4 '%s' not found\", VAR_4);", "return -1;", "}", "} else {", "assert(VAR_2);", "nd->VAR_2 = VAR_2;", "}", "if (VAR_1) {", "nd->VAR_1 = g_strdup(VAR_1);", "}", "if (qemu_opt_get(VAR_0, \"model\")) {", "nd->model = g_strdup(qemu_opt_get(VAR_0, \"model\"));", "}", "if (qemu_opt_get(VAR_0, \"addr\")) {", "nd->devaddr = g_strdup(qemu_opt_get(VAR_0, \"addr\"));", "}", "if (qemu_opt_get(VAR_0, \"macaddr\") &&\nnet_parse_macaddr(nd->macaddr.a, qemu_opt_get(VAR_0, \"macaddr\")) < 0) {", "error_report(\"invalid syntax for ethernet address\");", "return -1;", "}", "qemu_macaddr_default_if_unset(&nd->macaddr);", "nd->nvectors = qemu_opt_get_number(VAR_0, \"vectors\",\nDEV_NVECTORS_UNSPECIFIED);", "if (nd->nvectors != DEV_NVECTORS_UNSPECIFIED &&\n(nd->nvectors < 0 || nd->nvectors > 0x7ffffff)) {", "error_report(\"invalid # of vectors: %d\", nd->nvectors);", "return -1;", "}", "nd->used = 1;", "nb_nics++;", "return VAR_3;", "}" ]
[ 1, 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 73, 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 87, 89 ], [ 91, 93 ], [ 95 ], [ 97 ], [ 99 ], [ 103 ], [ 105 ], [ 109 ], [ 111 ] ]
6,712
void ff_af_queue_remove(AudioFrameQueue *afq, int nb_samples, int64_t *pts, int *duration) { int64_t out_pts = AV_NOPTS_VALUE; int removed_samples = 0; int i; if (afq->frame_count || afq->frame_alloc) { if (afq->frames->pts != AV_NOPTS_VALUE) out_pts = afq->frames->pts; } if(!afq->frame_count) av_log(afq->avctx, AV_LOG_WARNING, "Trying to remove %d samples, but que empty\n", nb_samples); if (pts) *pts = ff_samples_to_time_base(afq->avctx, out_pts); for(i=0; nb_samples && i<afq->frame_count; i++){ int n= FFMIN(afq->frames[i].duration, nb_samples); afq->frames[i].duration -= n; nb_samples -= n; removed_samples += n; if(afq->frames[i].pts != AV_NOPTS_VALUE) afq->frames[i].pts += n; } i -= i && afq->frames[i-1].duration; memmove(afq->frames, afq->frames + i, sizeof(*afq->frames) * (afq->frame_count - i)); afq->frame_count -= i; if(nb_samples){ av_assert0(!afq->frame_count); if(afq->frames[0].pts != AV_NOPTS_VALUE) afq->frames[0].pts += nb_samples; av_log(afq->avctx, AV_LOG_DEBUG, "Trying to remove %d more samples than are in the que\n", nb_samples); } if (duration) *duration = ff_samples_to_time_base(afq->avctx, removed_samples); }
true
FFmpeg
3938a0eeae24a335b181d753c464cf5bab33ff01
void ff_af_queue_remove(AudioFrameQueue *afq, int nb_samples, int64_t *pts, int *duration) { int64_t out_pts = AV_NOPTS_VALUE; int removed_samples = 0; int i; if (afq->frame_count || afq->frame_alloc) { if (afq->frames->pts != AV_NOPTS_VALUE) out_pts = afq->frames->pts; } if(!afq->frame_count) av_log(afq->avctx, AV_LOG_WARNING, "Trying to remove %d samples, but que empty\n", nb_samples); if (pts) *pts = ff_samples_to_time_base(afq->avctx, out_pts); for(i=0; nb_samples && i<afq->frame_count; i++){ int n= FFMIN(afq->frames[i].duration, nb_samples); afq->frames[i].duration -= n; nb_samples -= n; removed_samples += n; if(afq->frames[i].pts != AV_NOPTS_VALUE) afq->frames[i].pts += n; } i -= i && afq->frames[i-1].duration; memmove(afq->frames, afq->frames + i, sizeof(*afq->frames) * (afq->frame_count - i)); afq->frame_count -= i; if(nb_samples){ av_assert0(!afq->frame_count); if(afq->frames[0].pts != AV_NOPTS_VALUE) afq->frames[0].pts += nb_samples; av_log(afq->avctx, AV_LOG_DEBUG, "Trying to remove %d more samples than are in the que\n", nb_samples); } if (duration) *duration = ff_samples_to_time_base(afq->avctx, removed_samples); }
{ "code": [ " if(afq->frames[0].pts != AV_NOPTS_VALUE)" ], "line_no": [ 61 ] }
void FUNC_0(AudioFrameQueue *VAR_0, int VAR_1, int64_t *VAR_2, int *VAR_3) { int64_t out_pts = AV_NOPTS_VALUE; int VAR_4 = 0; int VAR_5; if (VAR_0->frame_count || VAR_0->frame_alloc) { if (VAR_0->frames->VAR_2 != AV_NOPTS_VALUE) out_pts = VAR_0->frames->VAR_2; } if(!VAR_0->frame_count) av_log(VAR_0->avctx, AV_LOG_WARNING, "Trying to remove %d samples, but que empty\n", VAR_1); if (VAR_2) *VAR_2 = ff_samples_to_time_base(VAR_0->avctx, out_pts); for(VAR_5=0; VAR_1 && VAR_5<VAR_0->frame_count; VAR_5++){ int n= FFMIN(VAR_0->frames[VAR_5].VAR_3, VAR_1); VAR_0->frames[VAR_5].VAR_3 -= n; VAR_1 -= n; VAR_4 += n; if(VAR_0->frames[VAR_5].VAR_2 != AV_NOPTS_VALUE) VAR_0->frames[VAR_5].VAR_2 += n; } VAR_5 -= VAR_5 && VAR_0->frames[VAR_5-1].VAR_3; memmove(VAR_0->frames, VAR_0->frames + VAR_5, sizeof(*VAR_0->frames) * (VAR_0->frame_count - VAR_5)); VAR_0->frame_count -= VAR_5; if(VAR_1){ av_assert0(!VAR_0->frame_count); if(VAR_0->frames[0].VAR_2 != AV_NOPTS_VALUE) VAR_0->frames[0].VAR_2 += VAR_1; av_log(VAR_0->avctx, AV_LOG_DEBUG, "Trying to remove %d more samples than are in the que\n", VAR_1); } if (VAR_3) *VAR_3 = ff_samples_to_time_base(VAR_0->avctx, VAR_4); }
[ "void FUNC_0(AudioFrameQueue *VAR_0, int VAR_1, int64_t *VAR_2,\nint *VAR_3)\n{", "int64_t out_pts = AV_NOPTS_VALUE;", "int VAR_4 = 0;", "int VAR_5;", "if (VAR_0->frame_count || VAR_0->frame_alloc) {", "if (VAR_0->frames->VAR_2 != AV_NOPTS_VALUE)\nout_pts = VAR_0->frames->VAR_2;", "}", "if(!VAR_0->frame_count)\nav_log(VAR_0->avctx, AV_LOG_WARNING, \"Trying to remove %d samples, but que empty\\n\", VAR_1);", "if (VAR_2)\n*VAR_2 = ff_samples_to_time_base(VAR_0->avctx, out_pts);", "for(VAR_5=0; VAR_1 && VAR_5<VAR_0->frame_count; VAR_5++){", "int n= FFMIN(VAR_0->frames[VAR_5].VAR_3, VAR_1);", "VAR_0->frames[VAR_5].VAR_3 -= n;", "VAR_1 -= n;", "VAR_4 += n;", "if(VAR_0->frames[VAR_5].VAR_2 != AV_NOPTS_VALUE)\nVAR_0->frames[VAR_5].VAR_2 += n;", "}", "VAR_5 -= VAR_5 && VAR_0->frames[VAR_5-1].VAR_3;", "memmove(VAR_0->frames, VAR_0->frames + VAR_5, sizeof(*VAR_0->frames) * (VAR_0->frame_count - VAR_5));", "VAR_0->frame_count -= VAR_5;", "if(VAR_1){", "av_assert0(!VAR_0->frame_count);", "if(VAR_0->frames[0].VAR_2 != AV_NOPTS_VALUE)\nVAR_0->frames[0].VAR_2 += VAR_1;", "av_log(VAR_0->avctx, AV_LOG_DEBUG, \"Trying to remove %d more samples than are in the que\\n\", VAR_1);", "}", "if (VAR_3)\n*VAR_3 = ff_samples_to_time_base(VAR_0->avctx, VAR_4);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17, 19 ], [ 21 ], [ 23, 25 ], [ 27, 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61, 63 ], [ 65 ], [ 67 ], [ 69, 71 ], [ 73 ] ]
6,713
static bool qvirtio_pci_get_config_isr_status(QVirtioDevice *d) { QVirtioPCIDevice *dev = (QVirtioPCIDevice *)d; uint32_t data; if (dev->pdev->msix_enabled) { g_assert_cmpint(dev->config_msix_entry, !=, -1); if (qpci_msix_masked(dev->pdev, dev->config_msix_entry)) { /* No ISR checking should be done if masked, but read anyway */ return qpci_msix_pending(dev->pdev, dev->config_msix_entry); } else { data = readl(dev->config_msix_addr); writel(dev->config_msix_addr, 0); return data == dev->config_msix_data; } } else { return qpci_io_readb(dev->pdev, dev->addr + QVIRTIO_PCI_ISR_STATUS) & 2; } }
true
qemu
1e34cf9681ec549e26f30daaabc1ce58d60446f7
static bool qvirtio_pci_get_config_isr_status(QVirtioDevice *d) { QVirtioPCIDevice *dev = (QVirtioPCIDevice *)d; uint32_t data; if (dev->pdev->msix_enabled) { g_assert_cmpint(dev->config_msix_entry, !=, -1); if (qpci_msix_masked(dev->pdev, dev->config_msix_entry)) { return qpci_msix_pending(dev->pdev, dev->config_msix_entry); } else { data = readl(dev->config_msix_addr); writel(dev->config_msix_addr, 0); return data == dev->config_msix_data; } } else { return qpci_io_readb(dev->pdev, dev->addr + QVIRTIO_PCI_ISR_STATUS) & 2; } }
{ "code": [ " writel(dev->config_msix_addr, 0);", " return data == dev->config_msix_data;" ], "line_no": [ 25, 27 ] }
static bool FUNC_0(QVirtioDevice *d) { QVirtioPCIDevice *dev = (QVirtioPCIDevice *)d; uint32_t data; if (dev->pdev->msix_enabled) { g_assert_cmpint(dev->config_msix_entry, !=, -1); if (qpci_msix_masked(dev->pdev, dev->config_msix_entry)) { return qpci_msix_pending(dev->pdev, dev->config_msix_entry); } else { data = readl(dev->config_msix_addr); writel(dev->config_msix_addr, 0); return data == dev->config_msix_data; } } else { return qpci_io_readb(dev->pdev, dev->addr + QVIRTIO_PCI_ISR_STATUS) & 2; } }
[ "static bool FUNC_0(QVirtioDevice *d)\n{", "QVirtioPCIDevice *dev = (QVirtioPCIDevice *)d;", "uint32_t data;", "if (dev->pdev->msix_enabled) {", "g_assert_cmpint(dev->config_msix_entry, !=, -1);", "if (qpci_msix_masked(dev->pdev, dev->config_msix_entry)) {", "return qpci_msix_pending(dev->pdev, dev->config_msix_entry);", "} else {", "data = readl(dev->config_msix_addr);", "writel(dev->config_msix_addr, 0);", "return data == dev->config_msix_data;", "}", "} else {", "return qpci_io_readb(dev->pdev, dev->addr + QVIRTIO_PCI_ISR_STATUS) & 2;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ] ]