id
int32
0
27.3k
func
stringlengths
26
142k
target
bool
2 classes
project
stringclasses
2 values
commit_id
stringlengths
40
40
func_clean
stringlengths
26
131k
vul_lines
dict
normalized_func
stringlengths
24
132k
lines
sequencelengths
1
2.8k
label
sequencelengths
1
2.8k
line_no
sequencelengths
1
2.8k
24,110
static void formant_postfilter(G723_1_Context *p, int16_t *lpc, int16_t *buf) { int16_t filter_coef[2][LPC_ORDER], *buf_ptr; int filter_signal[LPC_ORDER + FRAME_LEN], *signal_ptr; int i, j, k; memcpy(buf, p->fir_mem, LPC_ORDER * sizeof(*buf)); memcpy(filter_signal, p->iir_mem, LPC_ORDER * sizeof(*filter_signal)); for (i = LPC_ORDER, j = 0; j < SUBFRAMES; i += SUBFRAME_LEN, j++) { for (k = 0; k < LPC_ORDER; k++) { filter_coef[0][k] = (-lpc[k] * postfilter_tbl[0][k] + (1 << 14)) >> 15; filter_coef[1][k] = (-lpc[k] * postfilter_tbl[1][k] + (1 << 14)) >> 15; } iir_filter(filter_coef[0], filter_coef[1], buf + i, filter_signal + i); lpc += LPC_ORDER; } memcpy(p->fir_mem, buf + FRAME_LEN, LPC_ORDER * sizeof(*p->fir_mem)); memcpy(p->iir_mem, filter_signal + FRAME_LEN, LPC_ORDER * sizeof(*p->iir_mem)); buf_ptr = buf + LPC_ORDER; signal_ptr = filter_signal + LPC_ORDER; for (i = 0; i < SUBFRAMES; i++) { int16_t temp_vector[SUBFRAME_LEN]; int temp; int auto_corr[2]; int scale, energy; /* Normalize */ memcpy(temp_vector, buf_ptr, SUBFRAME_LEN * sizeof(*temp_vector)); scale = scale_vector(temp_vector, SUBFRAME_LEN); /* Compute auto correlation coefficients */ auto_corr[0] = dot_product(temp_vector, temp_vector + 1, SUBFRAME_LEN - 1, 1); auto_corr[1] = dot_product(temp_vector, temp_vector, SUBFRAME_LEN, 1); /* Compute reflection coefficient */ temp = auto_corr[1] >> 16; if (temp) { temp = (auto_corr[0] >> 2) / temp; } p->reflection_coef = (3 * p->reflection_coef + temp + 2) >> 2; temp = -p->reflection_coef >> 1 & ~3; /* Compensation filter */ for (j = 0; j < SUBFRAME_LEN; j++) { buf_ptr[j] = av_clipl_int32(signal_ptr[j] + ((signal_ptr[j - 1] >> 16) * temp << 1)) >> 16; } /* Compute normalized signal energy */ temp = 2 * scale + 4; if (temp < 0) { energy = av_clipl_int32((int64_t)auto_corr[1] << -temp); } else energy = auto_corr[1] >> temp; gain_scale(p, buf_ptr, energy); buf_ptr += SUBFRAME_LEN; signal_ptr += SUBFRAME_LEN; } }
true
FFmpeg
05c36e0e5fbf0b75dbbbd327ad2f6a62992f9262
static void formant_postfilter(G723_1_Context *p, int16_t *lpc, int16_t *buf) { int16_t filter_coef[2][LPC_ORDER], *buf_ptr; int filter_signal[LPC_ORDER + FRAME_LEN], *signal_ptr; int i, j, k; memcpy(buf, p->fir_mem, LPC_ORDER * sizeof(*buf)); memcpy(filter_signal, p->iir_mem, LPC_ORDER * sizeof(*filter_signal)); for (i = LPC_ORDER, j = 0; j < SUBFRAMES; i += SUBFRAME_LEN, j++) { for (k = 0; k < LPC_ORDER; k++) { filter_coef[0][k] = (-lpc[k] * postfilter_tbl[0][k] + (1 << 14)) >> 15; filter_coef[1][k] = (-lpc[k] * postfilter_tbl[1][k] + (1 << 14)) >> 15; } iir_filter(filter_coef[0], filter_coef[1], buf + i, filter_signal + i); lpc += LPC_ORDER; } memcpy(p->fir_mem, buf + FRAME_LEN, LPC_ORDER * sizeof(*p->fir_mem)); memcpy(p->iir_mem, filter_signal + FRAME_LEN, LPC_ORDER * sizeof(*p->iir_mem)); buf_ptr = buf + LPC_ORDER; signal_ptr = filter_signal + LPC_ORDER; for (i = 0; i < SUBFRAMES; i++) { int16_t temp_vector[SUBFRAME_LEN]; int temp; int auto_corr[2]; int scale, energy; memcpy(temp_vector, buf_ptr, SUBFRAME_LEN * sizeof(*temp_vector)); scale = scale_vector(temp_vector, SUBFRAME_LEN); auto_corr[0] = dot_product(temp_vector, temp_vector + 1, SUBFRAME_LEN - 1, 1); auto_corr[1] = dot_product(temp_vector, temp_vector, SUBFRAME_LEN, 1); temp = auto_corr[1] >> 16; if (temp) { temp = (auto_corr[0] >> 2) / temp; } p->reflection_coef = (3 * p->reflection_coef + temp + 2) >> 2; temp = -p->reflection_coef >> 1 & ~3; for (j = 0; j < SUBFRAME_LEN; j++) { buf_ptr[j] = av_clipl_int32(signal_ptr[j] + ((signal_ptr[j - 1] >> 16) * temp << 1)) >> 16; } temp = 2 * scale + 4; if (temp < 0) { energy = av_clipl_int32((int64_t)auto_corr[1] << -temp); } else energy = auto_corr[1] >> temp; gain_scale(p, buf_ptr, energy); buf_ptr += SUBFRAME_LEN; signal_ptr += SUBFRAME_LEN; } }
{ "code": [ " buf_ptr[j] = av_clipl_int32(signal_ptr[j] +" ], "line_no": [ 105 ] }
static void FUNC_0(G723_1_Context *VAR_0, int16_t *VAR_1, int16_t *VAR_2) { int16_t filter_coef[2][LPC_ORDER], *buf_ptr; int VAR_3[LPC_ORDER + FRAME_LEN], *signal_ptr; int VAR_4, VAR_5, VAR_6; memcpy(VAR_2, VAR_0->fir_mem, LPC_ORDER * sizeof(*VAR_2)); memcpy(VAR_3, VAR_0->iir_mem, LPC_ORDER * sizeof(*VAR_3)); for (VAR_4 = LPC_ORDER, VAR_5 = 0; VAR_5 < SUBFRAMES; VAR_4 += SUBFRAME_LEN, VAR_5++) { for (VAR_6 = 0; VAR_6 < LPC_ORDER; VAR_6++) { filter_coef[0][VAR_6] = (-VAR_1[VAR_6] * postfilter_tbl[0][VAR_6] + (1 << 14)) >> 15; filter_coef[1][VAR_6] = (-VAR_1[VAR_6] * postfilter_tbl[1][VAR_6] + (1 << 14)) >> 15; } iir_filter(filter_coef[0], filter_coef[1], VAR_2 + VAR_4, VAR_3 + VAR_4); VAR_1 += LPC_ORDER; } memcpy(VAR_0->fir_mem, VAR_2 + FRAME_LEN, LPC_ORDER * sizeof(*VAR_0->fir_mem)); memcpy(VAR_0->iir_mem, VAR_3 + FRAME_LEN, LPC_ORDER * sizeof(*VAR_0->iir_mem)); buf_ptr = VAR_2 + LPC_ORDER; signal_ptr = VAR_3 + LPC_ORDER; for (VAR_4 = 0; VAR_4 < SUBFRAMES; VAR_4++) { int16_t temp_vector[SUBFRAME_LEN]; int temp; int auto_corr[2]; int scale, energy; memcpy(temp_vector, buf_ptr, SUBFRAME_LEN * sizeof(*temp_vector)); scale = scale_vector(temp_vector, SUBFRAME_LEN); auto_corr[0] = dot_product(temp_vector, temp_vector + 1, SUBFRAME_LEN - 1, 1); auto_corr[1] = dot_product(temp_vector, temp_vector, SUBFRAME_LEN, 1); temp = auto_corr[1] >> 16; if (temp) { temp = (auto_corr[0] >> 2) / temp; } VAR_0->reflection_coef = (3 * VAR_0->reflection_coef + temp + 2) >> 2; temp = -VAR_0->reflection_coef >> 1 & ~3; for (VAR_5 = 0; VAR_5 < SUBFRAME_LEN; VAR_5++) { buf_ptr[VAR_5] = av_clipl_int32(signal_ptr[VAR_5] + ((signal_ptr[VAR_5 - 1] >> 16) * temp << 1)) >> 16; } temp = 2 * scale + 4; if (temp < 0) { energy = av_clipl_int32((int64_t)auto_corr[1] << -temp); } else energy = auto_corr[1] >> temp; gain_scale(VAR_0, buf_ptr, energy); buf_ptr += SUBFRAME_LEN; signal_ptr += SUBFRAME_LEN; } }
[ "static void FUNC_0(G723_1_Context *VAR_0, int16_t *VAR_1, int16_t *VAR_2)\n{", "int16_t filter_coef[2][LPC_ORDER], *buf_ptr;", "int VAR_3[LPC_ORDER + FRAME_LEN], *signal_ptr;", "int VAR_4, VAR_5, VAR_6;", "memcpy(VAR_2, VAR_0->fir_mem, LPC_ORDER * sizeof(*VAR_2));", "memcpy(VAR_3, VAR_0->iir_mem, LPC_ORDER * sizeof(*VAR_3));", "for (VAR_4 = LPC_ORDER, VAR_5 = 0; VAR_5 < SUBFRAMES; VAR_4 += SUBFRAME_LEN, VAR_5++) {", "for (VAR_6 = 0; VAR_6 < LPC_ORDER; VAR_6++) {", "filter_coef[0][VAR_6] = (-VAR_1[VAR_6] * postfilter_tbl[0][VAR_6] +\n(1 << 14)) >> 15;", "filter_coef[1][VAR_6] = (-VAR_1[VAR_6] * postfilter_tbl[1][VAR_6] +\n(1 << 14)) >> 15;", "}", "iir_filter(filter_coef[0], filter_coef[1], VAR_2 + VAR_4,\nVAR_3 + VAR_4);", "VAR_1 += LPC_ORDER;", "}", "memcpy(VAR_0->fir_mem, VAR_2 + FRAME_LEN, LPC_ORDER * sizeof(*VAR_0->fir_mem));", "memcpy(VAR_0->iir_mem, VAR_3 + FRAME_LEN,\nLPC_ORDER * sizeof(*VAR_0->iir_mem));", "buf_ptr = VAR_2 + LPC_ORDER;", "signal_ptr = VAR_3 + LPC_ORDER;", "for (VAR_4 = 0; VAR_4 < SUBFRAMES; VAR_4++) {", "int16_t temp_vector[SUBFRAME_LEN];", "int temp;", "int auto_corr[2];", "int scale, energy;", "memcpy(temp_vector, buf_ptr, SUBFRAME_LEN * sizeof(*temp_vector));", "scale = scale_vector(temp_vector, SUBFRAME_LEN);", "auto_corr[0] = dot_product(temp_vector, temp_vector + 1,\nSUBFRAME_LEN - 1, 1);", "auto_corr[1] = dot_product(temp_vector, temp_vector, SUBFRAME_LEN, 1);", "temp = auto_corr[1] >> 16;", "if (temp) {", "temp = (auto_corr[0] >> 2) / temp;", "}", "VAR_0->reflection_coef = (3 * VAR_0->reflection_coef + temp + 2) >> 2;", "temp = -VAR_0->reflection_coef >> 1 & ~3;", "for (VAR_5 = 0; VAR_5 < SUBFRAME_LEN; VAR_5++) {", "buf_ptr[VAR_5] = av_clipl_int32(signal_ptr[VAR_5] +\n((signal_ptr[VAR_5 - 1] >> 16) *\ntemp << 1)) >> 16;", "}", "temp = 2 * scale + 4;", "if (temp < 0) {", "energy = av_clipl_int32((int64_t)auto_corr[1] << -temp);", "} else", "energy = auto_corr[1] >> temp;", "gain_scale(VAR_0, buf_ptr, energy);", "buf_ptr += SUBFRAME_LEN;", "signal_ptr += SUBFRAME_LEN;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23, 25 ], [ 27, 29 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45, 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 69 ], [ 71 ], [ 77, 79 ], [ 81 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 103 ], [ 105, 107, 109 ], [ 111 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 129 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ] ]
24,111
int attribute_align_arg avresample_convert(AVAudioResampleContext *avr, uint8_t **output, int out_plane_size, int out_samples, uint8_t **input, int in_plane_size, int in_samples) { AudioData input_buffer; AudioData output_buffer; AudioData *current_buffer; int ret, direct_output; /* reset internal buffers */ if (avr->in_buffer) { avr->in_buffer->nb_samples = 0; ff_audio_data_set_channels(avr->in_buffer, avr->in_buffer->allocated_channels); } if (avr->resample_out_buffer) { avr->resample_out_buffer->nb_samples = 0; ff_audio_data_set_channels(avr->resample_out_buffer, avr->resample_out_buffer->allocated_channels); } if (avr->out_buffer) { avr->out_buffer->nb_samples = 0; ff_audio_data_set_channels(avr->out_buffer, avr->out_buffer->allocated_channels); } av_dlog(avr, "[start conversion]\n"); /* initialize output_buffer with output data */ direct_output = output && av_audio_fifo_size(avr->out_fifo) == 0; if (output) { ret = ff_audio_data_init(&output_buffer, output, out_plane_size, avr->out_channels, out_samples, avr->out_sample_fmt, 0, "output"); if (ret < 0) return ret; output_buffer.nb_samples = 0; } if (input) { /* initialize input_buffer with input data */ ret = ff_audio_data_init(&input_buffer, input, in_plane_size, avr->in_channels, in_samples, avr->in_sample_fmt, 1, "input"); if (ret < 0) return ret; current_buffer = &input_buffer; if (avr->upmix_needed && !avr->in_convert_needed && !avr->resample_needed && !avr->out_convert_needed && direct_output && out_samples >= in_samples) { /* in some rare cases we can copy input to output and upmix directly in the output buffer */ av_dlog(avr, "[copy] %s to output\n", current_buffer->name); ret = ff_audio_data_copy(&output_buffer, current_buffer, avr->remap_point == REMAP_OUT_COPY ? &avr->ch_map_info : NULL); if (ret < 0) return ret; current_buffer = &output_buffer; } else if (avr->remap_point == REMAP_OUT_COPY && (!direct_output || out_samples < in_samples)) { /* if remapping channels during output copy, we may need to * use an intermediate buffer in order to remap before adding * samples to the output fifo */ av_dlog(avr, "[copy] %s to out_buffer\n", current_buffer->name); ret = ff_audio_data_copy(avr->out_buffer, current_buffer, &avr->ch_map_info); if (ret < 0) return ret; current_buffer = avr->out_buffer; } else if (avr->in_copy_needed || avr->in_convert_needed) { /* if needed, copy or convert input to in_buffer, and downmix if applicable */ if (avr->in_convert_needed) { ret = ff_audio_data_realloc(avr->in_buffer, current_buffer->nb_samples); if (ret < 0) return ret; av_dlog(avr, "[convert] %s to in_buffer\n", current_buffer->name); ret = ff_audio_convert(avr->ac_in, avr->in_buffer, current_buffer); if (ret < 0) return ret; } else { av_dlog(avr, "[copy] %s to in_buffer\n", current_buffer->name); ret = ff_audio_data_copy(avr->in_buffer, current_buffer, avr->remap_point == REMAP_IN_COPY ? &avr->ch_map_info : NULL); if (ret < 0) return ret; } ff_audio_data_set_channels(avr->in_buffer, avr->in_channels); if (avr->downmix_needed) { av_dlog(avr, "[downmix] in_buffer\n"); ret = ff_audio_mix(avr->am, avr->in_buffer); if (ret < 0) return ret; } current_buffer = avr->in_buffer; } } else { /* flush resampling buffer and/or output FIFO if input is NULL */ if (!avr->resample_needed) return handle_buffered_output(avr, output ? &output_buffer : NULL, NULL); current_buffer = NULL; } if (avr->resample_needed) { AudioData *resample_out; if (!avr->out_convert_needed && direct_output && out_samples > 0) resample_out = &output_buffer; else resample_out = avr->resample_out_buffer; av_dlog(avr, "[resample] %s to %s\n", current_buffer->name, resample_out->name); ret = ff_audio_resample(avr->resample, resample_out, current_buffer); if (ret < 0) return ret; /* if resampling did not produce any samples, just return 0 */ if (resample_out->nb_samples == 0) { av_dlog(avr, "[end conversion]\n"); return 0; } current_buffer = resample_out; } if (avr->upmix_needed) { av_dlog(avr, "[upmix] %s\n", current_buffer->name); ret = ff_audio_mix(avr->am, current_buffer); if (ret < 0) return ret; } /* if we resampled or upmixed directly to output, return here */ if (current_buffer == &output_buffer) { av_dlog(avr, "[end conversion]\n"); return current_buffer->nb_samples; } if (avr->out_convert_needed) { if (direct_output && out_samples >= current_buffer->nb_samples) { /* convert directly to output */ av_dlog(avr, "[convert] %s to output\n", current_buffer->name); ret = ff_audio_convert(avr->ac_out, &output_buffer, current_buffer); if (ret < 0) return ret; av_dlog(avr, "[end conversion]\n"); return output_buffer.nb_samples; } else { ret = ff_audio_data_realloc(avr->out_buffer, current_buffer->nb_samples); if (ret < 0) return ret; av_dlog(avr, "[convert] %s to out_buffer\n", current_buffer->name); ret = ff_audio_convert(avr->ac_out, avr->out_buffer, current_buffer); if (ret < 0) return ret; current_buffer = avr->out_buffer; } } return handle_buffered_output(avr, output ? &output_buffer : NULL, current_buffer); }
true
FFmpeg
211ca69b13eb0a127a9ef7e70ddaccdab125d1c5
int attribute_align_arg avresample_convert(AVAudioResampleContext *avr, uint8_t **output, int out_plane_size, int out_samples, uint8_t **input, int in_plane_size, int in_samples) { AudioData input_buffer; AudioData output_buffer; AudioData *current_buffer; int ret, direct_output; if (avr->in_buffer) { avr->in_buffer->nb_samples = 0; ff_audio_data_set_channels(avr->in_buffer, avr->in_buffer->allocated_channels); } if (avr->resample_out_buffer) { avr->resample_out_buffer->nb_samples = 0; ff_audio_data_set_channels(avr->resample_out_buffer, avr->resample_out_buffer->allocated_channels); } if (avr->out_buffer) { avr->out_buffer->nb_samples = 0; ff_audio_data_set_channels(avr->out_buffer, avr->out_buffer->allocated_channels); } av_dlog(avr, "[start conversion]\n"); direct_output = output && av_audio_fifo_size(avr->out_fifo) == 0; if (output) { ret = ff_audio_data_init(&output_buffer, output, out_plane_size, avr->out_channels, out_samples, avr->out_sample_fmt, 0, "output"); if (ret < 0) return ret; output_buffer.nb_samples = 0; } if (input) { ret = ff_audio_data_init(&input_buffer, input, in_plane_size, avr->in_channels, in_samples, avr->in_sample_fmt, 1, "input"); if (ret < 0) return ret; current_buffer = &input_buffer; if (avr->upmix_needed && !avr->in_convert_needed && !avr->resample_needed && !avr->out_convert_needed && direct_output && out_samples >= in_samples) { av_dlog(avr, "[copy] %s to output\n", current_buffer->name); ret = ff_audio_data_copy(&output_buffer, current_buffer, avr->remap_point == REMAP_OUT_COPY ? &avr->ch_map_info : NULL); if (ret < 0) return ret; current_buffer = &output_buffer; } else if (avr->remap_point == REMAP_OUT_COPY && (!direct_output || out_samples < in_samples)) { av_dlog(avr, "[copy] %s to out_buffer\n", current_buffer->name); ret = ff_audio_data_copy(avr->out_buffer, current_buffer, &avr->ch_map_info); if (ret < 0) return ret; current_buffer = avr->out_buffer; } else if (avr->in_copy_needed || avr->in_convert_needed) { if (avr->in_convert_needed) { ret = ff_audio_data_realloc(avr->in_buffer, current_buffer->nb_samples); if (ret < 0) return ret; av_dlog(avr, "[convert] %s to in_buffer\n", current_buffer->name); ret = ff_audio_convert(avr->ac_in, avr->in_buffer, current_buffer); if (ret < 0) return ret; } else { av_dlog(avr, "[copy] %s to in_buffer\n", current_buffer->name); ret = ff_audio_data_copy(avr->in_buffer, current_buffer, avr->remap_point == REMAP_IN_COPY ? &avr->ch_map_info : NULL); if (ret < 0) return ret; } ff_audio_data_set_channels(avr->in_buffer, avr->in_channels); if (avr->downmix_needed) { av_dlog(avr, "[downmix] in_buffer\n"); ret = ff_audio_mix(avr->am, avr->in_buffer); if (ret < 0) return ret; } current_buffer = avr->in_buffer; } } else { if (!avr->resample_needed) return handle_buffered_output(avr, output ? &output_buffer : NULL, NULL); current_buffer = NULL; } if (avr->resample_needed) { AudioData *resample_out; if (!avr->out_convert_needed && direct_output && out_samples > 0) resample_out = &output_buffer; else resample_out = avr->resample_out_buffer; av_dlog(avr, "[resample] %s to %s\n", current_buffer->name, resample_out->name); ret = ff_audio_resample(avr->resample, resample_out, current_buffer); if (ret < 0) return ret; if (resample_out->nb_samples == 0) { av_dlog(avr, "[end conversion]\n"); return 0; } current_buffer = resample_out; } if (avr->upmix_needed) { av_dlog(avr, "[upmix] %s\n", current_buffer->name); ret = ff_audio_mix(avr->am, current_buffer); if (ret < 0) return ret; } if (current_buffer == &output_buffer) { av_dlog(avr, "[end conversion]\n"); return current_buffer->nb_samples; } if (avr->out_convert_needed) { if (direct_output && out_samples >= current_buffer->nb_samples) { av_dlog(avr, "[convert] %s to output\n", current_buffer->name); ret = ff_audio_convert(avr->ac_out, &output_buffer, current_buffer); if (ret < 0) return ret; av_dlog(avr, "[end conversion]\n"); return output_buffer.nb_samples; } else { ret = ff_audio_data_realloc(avr->out_buffer, current_buffer->nb_samples); if (ret < 0) return ret; av_dlog(avr, "[convert] %s to out_buffer\n", current_buffer->name); ret = ff_audio_convert(avr->ac_out, avr->out_buffer, current_buffer); if (ret < 0) return ret; current_buffer = avr->out_buffer; } } return handle_buffered_output(avr, output ? &output_buffer : NULL, current_buffer); }
{ "code": [ " av_dlog(avr, \"[resample] %s to %s\\n\", current_buffer->name," ], "line_no": [ 233 ] }
int VAR_0 avresample_convert(AVAudioResampleContext *avr, uint8_t **output, int out_plane_size, int out_samples, uint8_t **input, int in_plane_size, int in_samples) { AudioData input_buffer; AudioData output_buffer; AudioData *current_buffer; int ret, direct_output; if (avr->in_buffer) { avr->in_buffer->nb_samples = 0; ff_audio_data_set_channels(avr->in_buffer, avr->in_buffer->allocated_channels); } if (avr->resample_out_buffer) { avr->resample_out_buffer->nb_samples = 0; ff_audio_data_set_channels(avr->resample_out_buffer, avr->resample_out_buffer->allocated_channels); } if (avr->out_buffer) { avr->out_buffer->nb_samples = 0; ff_audio_data_set_channels(avr->out_buffer, avr->out_buffer->allocated_channels); } av_dlog(avr, "[start conversion]\n"); direct_output = output && av_audio_fifo_size(avr->out_fifo) == 0; if (output) { ret = ff_audio_data_init(&output_buffer, output, out_plane_size, avr->out_channels, out_samples, avr->out_sample_fmt, 0, "output"); if (ret < 0) return ret; output_buffer.nb_samples = 0; } if (input) { ret = ff_audio_data_init(&input_buffer, input, in_plane_size, avr->in_channels, in_samples, avr->in_sample_fmt, 1, "input"); if (ret < 0) return ret; current_buffer = &input_buffer; if (avr->upmix_needed && !avr->in_convert_needed && !avr->resample_needed && !avr->out_convert_needed && direct_output && out_samples >= in_samples) { av_dlog(avr, "[copy] %s to output\n", current_buffer->name); ret = ff_audio_data_copy(&output_buffer, current_buffer, avr->remap_point == REMAP_OUT_COPY ? &avr->ch_map_info : NULL); if (ret < 0) return ret; current_buffer = &output_buffer; } else if (avr->remap_point == REMAP_OUT_COPY && (!direct_output || out_samples < in_samples)) { av_dlog(avr, "[copy] %s to out_buffer\n", current_buffer->name); ret = ff_audio_data_copy(avr->out_buffer, current_buffer, &avr->ch_map_info); if (ret < 0) return ret; current_buffer = avr->out_buffer; } else if (avr->in_copy_needed || avr->in_convert_needed) { if (avr->in_convert_needed) { ret = ff_audio_data_realloc(avr->in_buffer, current_buffer->nb_samples); if (ret < 0) return ret; av_dlog(avr, "[convert] %s to in_buffer\n", current_buffer->name); ret = ff_audio_convert(avr->ac_in, avr->in_buffer, current_buffer); if (ret < 0) return ret; } else { av_dlog(avr, "[copy] %s to in_buffer\n", current_buffer->name); ret = ff_audio_data_copy(avr->in_buffer, current_buffer, avr->remap_point == REMAP_IN_COPY ? &avr->ch_map_info : NULL); if (ret < 0) return ret; } ff_audio_data_set_channels(avr->in_buffer, avr->in_channels); if (avr->downmix_needed) { av_dlog(avr, "[downmix] in_buffer\n"); ret = ff_audio_mix(avr->am, avr->in_buffer); if (ret < 0) return ret; } current_buffer = avr->in_buffer; } } else { if (!avr->resample_needed) return handle_buffered_output(avr, output ? &output_buffer : NULL, NULL); current_buffer = NULL; } if (avr->resample_needed) { AudioData *resample_out; if (!avr->out_convert_needed && direct_output && out_samples > 0) resample_out = &output_buffer; else resample_out = avr->resample_out_buffer; av_dlog(avr, "[resample] %s to %s\n", current_buffer->name, resample_out->name); ret = ff_audio_resample(avr->resample, resample_out, current_buffer); if (ret < 0) return ret; if (resample_out->nb_samples == 0) { av_dlog(avr, "[end conversion]\n"); return 0; } current_buffer = resample_out; } if (avr->upmix_needed) { av_dlog(avr, "[upmix] %s\n", current_buffer->name); ret = ff_audio_mix(avr->am, current_buffer); if (ret < 0) return ret; } if (current_buffer == &output_buffer) { av_dlog(avr, "[end conversion]\n"); return current_buffer->nb_samples; } if (avr->out_convert_needed) { if (direct_output && out_samples >= current_buffer->nb_samples) { av_dlog(avr, "[convert] %s to output\n", current_buffer->name); ret = ff_audio_convert(avr->ac_out, &output_buffer, current_buffer); if (ret < 0) return ret; av_dlog(avr, "[end conversion]\n"); return output_buffer.nb_samples; } else { ret = ff_audio_data_realloc(avr->out_buffer, current_buffer->nb_samples); if (ret < 0) return ret; av_dlog(avr, "[convert] %s to out_buffer\n", current_buffer->name); ret = ff_audio_convert(avr->ac_out, avr->out_buffer, current_buffer); if (ret < 0) return ret; current_buffer = avr->out_buffer; } } return handle_buffered_output(avr, output ? &output_buffer : NULL, current_buffer); }
[ "int VAR_0 avresample_convert(AVAudioResampleContext *avr,\nuint8_t **output, int out_plane_size,\nint out_samples, uint8_t **input,\nint in_plane_size, int in_samples)\n{", "AudioData input_buffer;", "AudioData output_buffer;", "AudioData *current_buffer;", "int ret, direct_output;", "if (avr->in_buffer) {", "avr->in_buffer->nb_samples = 0;", "ff_audio_data_set_channels(avr->in_buffer,\navr->in_buffer->allocated_channels);", "}", "if (avr->resample_out_buffer) {", "avr->resample_out_buffer->nb_samples = 0;", "ff_audio_data_set_channels(avr->resample_out_buffer,\navr->resample_out_buffer->allocated_channels);", "}", "if (avr->out_buffer) {", "avr->out_buffer->nb_samples = 0;", "ff_audio_data_set_channels(avr->out_buffer,\navr->out_buffer->allocated_channels);", "}", "av_dlog(avr, \"[start conversion]\\n\");", "direct_output = output && av_audio_fifo_size(avr->out_fifo) == 0;", "if (output) {", "ret = ff_audio_data_init(&output_buffer, output, out_plane_size,\navr->out_channels, out_samples,\navr->out_sample_fmt, 0, \"output\");", "if (ret < 0)\nreturn ret;", "output_buffer.nb_samples = 0;", "}", "if (input) {", "ret = ff_audio_data_init(&input_buffer, input, in_plane_size,\navr->in_channels, in_samples,\navr->in_sample_fmt, 1, \"input\");", "if (ret < 0)\nreturn ret;", "current_buffer = &input_buffer;", "if (avr->upmix_needed && !avr->in_convert_needed && !avr->resample_needed &&\n!avr->out_convert_needed && direct_output && out_samples >= in_samples) {", "av_dlog(avr, \"[copy] %s to output\\n\", current_buffer->name);", "ret = ff_audio_data_copy(&output_buffer, current_buffer,\navr->remap_point == REMAP_OUT_COPY ?\n&avr->ch_map_info : NULL);", "if (ret < 0)\nreturn ret;", "current_buffer = &output_buffer;", "} else if (avr->remap_point == REMAP_OUT_COPY &&", "(!direct_output || out_samples < in_samples)) {", "av_dlog(avr, \"[copy] %s to out_buffer\\n\", current_buffer->name);", "ret = ff_audio_data_copy(avr->out_buffer, current_buffer,\n&avr->ch_map_info);", "if (ret < 0)\nreturn ret;", "current_buffer = avr->out_buffer;", "} else if (avr->in_copy_needed || avr->in_convert_needed) {", "if (avr->in_convert_needed) {", "ret = ff_audio_data_realloc(avr->in_buffer,\ncurrent_buffer->nb_samples);", "if (ret < 0)\nreturn ret;", "av_dlog(avr, \"[convert] %s to in_buffer\\n\", current_buffer->name);", "ret = ff_audio_convert(avr->ac_in, avr->in_buffer,\ncurrent_buffer);", "if (ret < 0)\nreturn ret;", "} else {", "av_dlog(avr, \"[copy] %s to in_buffer\\n\", current_buffer->name);", "ret = ff_audio_data_copy(avr->in_buffer, current_buffer,\navr->remap_point == REMAP_IN_COPY ?\n&avr->ch_map_info : NULL);", "if (ret < 0)\nreturn ret;", "}", "ff_audio_data_set_channels(avr->in_buffer, avr->in_channels);", "if (avr->downmix_needed) {", "av_dlog(avr, \"[downmix] in_buffer\\n\");", "ret = ff_audio_mix(avr->am, avr->in_buffer);", "if (ret < 0)\nreturn ret;", "}", "current_buffer = avr->in_buffer;", "}", "} else {", "if (!avr->resample_needed)\nreturn handle_buffered_output(avr, output ? &output_buffer : NULL,\nNULL);", "current_buffer = NULL;", "}", "if (avr->resample_needed) {", "AudioData *resample_out;", "if (!avr->out_convert_needed && direct_output && out_samples > 0)\nresample_out = &output_buffer;", "else\nresample_out = avr->resample_out_buffer;", "av_dlog(avr, \"[resample] %s to %s\\n\", current_buffer->name,\nresample_out->name);", "ret = ff_audio_resample(avr->resample, resample_out,\ncurrent_buffer);", "if (ret < 0)\nreturn ret;", "if (resample_out->nb_samples == 0) {", "av_dlog(avr, \"[end conversion]\\n\");", "return 0;", "}", "current_buffer = resample_out;", "}", "if (avr->upmix_needed) {", "av_dlog(avr, \"[upmix] %s\\n\", current_buffer->name);", "ret = ff_audio_mix(avr->am, current_buffer);", "if (ret < 0)\nreturn ret;", "}", "if (current_buffer == &output_buffer) {", "av_dlog(avr, \"[end conversion]\\n\");", "return current_buffer->nb_samples;", "}", "if (avr->out_convert_needed) {", "if (direct_output && out_samples >= current_buffer->nb_samples) {", "av_dlog(avr, \"[convert] %s to output\\n\", current_buffer->name);", "ret = ff_audio_convert(avr->ac_out, &output_buffer, current_buffer);", "if (ret < 0)\nreturn ret;", "av_dlog(avr, \"[end conversion]\\n\");", "return output_buffer.nb_samples;", "} else {", "ret = ff_audio_data_realloc(avr->out_buffer,\ncurrent_buffer->nb_samples);", "if (ret < 0)\nreturn ret;", "av_dlog(avr, \"[convert] %s to out_buffer\\n\", current_buffer->name);", "ret = ff_audio_convert(avr->ac_out, avr->out_buffer,\ncurrent_buffer);", "if (ret < 0)\nreturn ret;", "current_buffer = avr->out_buffer;", "}", "}", "return handle_buffered_output(avr, output ? &output_buffer : NULL,\ncurrent_buffer);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 23 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37, 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47, 49 ], [ 51 ], [ 55 ], [ 61 ], [ 63 ], [ 65, 67, 69 ], [ 71, 73 ], [ 75 ], [ 77 ], [ 81 ], [ 85, 87, 89 ], [ 91, 93 ], [ 95 ], [ 99, 101 ], [ 107 ], [ 109, 111, 113 ], [ 115, 117 ], [ 119 ], [ 121 ], [ 123 ], [ 131 ], [ 133, 135 ], [ 137, 139 ], [ 141 ], [ 143 ], [ 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 ], [ 207, 209, 211 ], [ 213 ], [ 215 ], [ 219 ], [ 221 ], [ 225, 227 ], [ 229, 231 ], [ 233, 235 ], [ 237, 239 ], [ 241, 243 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ], [ 259 ], [ 261 ], [ 265 ], [ 267 ], [ 269 ], [ 271, 273 ], [ 275 ], [ 281 ], [ 283 ], [ 285 ], [ 287 ], [ 291 ], [ 293 ], [ 297 ], [ 299 ], [ 301, 303 ], [ 307 ], [ 309 ], [ 311 ], [ 313, 315 ], [ 317, 319 ], [ 321 ], [ 323, 325 ], [ 327, 329 ], [ 331 ], [ 333 ], [ 335 ], [ 339, 341 ], [ 343 ] ]
24,112
static int ogg_read_header(AVFormatContext *avfcontext, AVFormatParameters *ap) { OggContext *context = avfcontext->priv_data; ogg_packet op ; char *buf ; ogg_page og ; AVStream *ast ; AVCodecContext *codec; uint8_t *p; int i; ogg_sync_init(&context->oy) ; buf = ogg_sync_buffer(&context->oy, DECODER_BUFFER_SIZE) ; if(get_buffer(&avfcontext->pb, buf, DECODER_BUFFER_SIZE) <= 0) return AVERROR_IO ; ogg_sync_wrote(&context->oy, DECODER_BUFFER_SIZE) ; ogg_sync_pageout(&context->oy, &og) ; ogg_stream_init(&context->os, ogg_page_serialno(&og)) ; ogg_stream_pagein(&context->os, &og) ; /* currently only one vorbis stream supported */ ast = av_new_stream(avfcontext, 0) ; if(!ast) return AVERROR_NOMEM ; av_set_pts_info(ast, 60, 1, AV_TIME_BASE); codec= &ast->codec; codec->codec_type = CODEC_TYPE_AUDIO; codec->codec_id = CODEC_ID_VORBIS; for(i=0; i<3; i++){ if(next_packet(avfcontext, &op)){ } codec->extradata_size+= 2 + op.bytes; codec->extradata= av_realloc(codec->extradata, codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); p= codec->extradata + codec->extradata_size - 2 - op.bytes; *(p++)= op.bytes>>8; *(p++)= op.bytes&0xFF; memcpy(p, op.packet, op.bytes); } return 0 ; }
true
FFmpeg
568e18b15e2ddf494fd8926707d34ca08c8edce5
static int ogg_read_header(AVFormatContext *avfcontext, AVFormatParameters *ap) { OggContext *context = avfcontext->priv_data; ogg_packet op ; char *buf ; ogg_page og ; AVStream *ast ; AVCodecContext *codec; uint8_t *p; int i; ogg_sync_init(&context->oy) ; buf = ogg_sync_buffer(&context->oy, DECODER_BUFFER_SIZE) ; if(get_buffer(&avfcontext->pb, buf, DECODER_BUFFER_SIZE) <= 0) return AVERROR_IO ; ogg_sync_wrote(&context->oy, DECODER_BUFFER_SIZE) ; ogg_sync_pageout(&context->oy, &og) ; ogg_stream_init(&context->os, ogg_page_serialno(&og)) ; ogg_stream_pagein(&context->os, &og) ; ast = av_new_stream(avfcontext, 0) ; if(!ast) return AVERROR_NOMEM ; av_set_pts_info(ast, 60, 1, AV_TIME_BASE); codec= &ast->codec; codec->codec_type = CODEC_TYPE_AUDIO; codec->codec_id = CODEC_ID_VORBIS; for(i=0; i<3; i++){ if(next_packet(avfcontext, &op)){ } codec->extradata_size+= 2 + op.bytes; codec->extradata= av_realloc(codec->extradata, codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); p= codec->extradata + codec->extradata_size - 2 - op.bytes; *(p++)= op.bytes>>8; *(p++)= op.bytes&0xFF; memcpy(p, op.packet, op.bytes); } return 0 ; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0, AVFormatParameters *VAR_1) { OggContext *context = VAR_0->priv_data; ogg_packet op ; char *VAR_2 ; ogg_page og ; AVStream *ast ; AVCodecContext *codec; uint8_t *p; int VAR_3; ogg_sync_init(&context->oy) ; VAR_2 = ogg_sync_buffer(&context->oy, DECODER_BUFFER_SIZE) ; if(get_buffer(&VAR_0->pb, VAR_2, DECODER_BUFFER_SIZE) <= 0) return AVERROR_IO ; ogg_sync_wrote(&context->oy, DECODER_BUFFER_SIZE) ; ogg_sync_pageout(&context->oy, &og) ; ogg_stream_init(&context->os, ogg_page_serialno(&og)) ; ogg_stream_pagein(&context->os, &og) ; ast = av_new_stream(VAR_0, 0) ; if(!ast) return AVERROR_NOMEM ; av_set_pts_info(ast, 60, 1, AV_TIME_BASE); codec= &ast->codec; codec->codec_type = CODEC_TYPE_AUDIO; codec->codec_id = CODEC_ID_VORBIS; for(VAR_3=0; VAR_3<3; VAR_3++){ if(next_packet(VAR_0, &op)){ } codec->extradata_size+= 2 + op.bytes; codec->extradata= av_realloc(codec->extradata, codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); p= codec->extradata + codec->extradata_size - 2 - op.bytes; *(p++)= op.bytes>>8; *(p++)= op.bytes&0xFF; memcpy(p, op.packet, op.bytes); } return 0 ; }
[ "static int FUNC_0(AVFormatContext *VAR_0, AVFormatParameters *VAR_1)\n{", "OggContext *context = VAR_0->priv_data;", "ogg_packet op ;", "char *VAR_2 ;", "ogg_page og ;", "AVStream *ast ;", "AVCodecContext *codec;", "uint8_t *p;", "int VAR_3;", "ogg_sync_init(&context->oy) ;", "VAR_2 = ogg_sync_buffer(&context->oy, DECODER_BUFFER_SIZE) ;", "if(get_buffer(&VAR_0->pb, VAR_2, DECODER_BUFFER_SIZE) <= 0)\nreturn AVERROR_IO ;", "ogg_sync_wrote(&context->oy, DECODER_BUFFER_SIZE) ;", "ogg_sync_pageout(&context->oy, &og) ;", "ogg_stream_init(&context->os, ogg_page_serialno(&og)) ;", "ogg_stream_pagein(&context->os, &og) ;", "ast = av_new_stream(VAR_0, 0) ;", "if(!ast)\nreturn AVERROR_NOMEM ;", "av_set_pts_info(ast, 60, 1, AV_TIME_BASE);", "codec= &ast->codec;", "codec->codec_type = CODEC_TYPE_AUDIO;", "codec->codec_id = CODEC_ID_VORBIS;", "for(VAR_3=0; VAR_3<3; VAR_3++){", "if(next_packet(VAR_0, &op)){", "}", "codec->extradata_size+= 2 + op.bytes;", "codec->extradata= av_realloc(codec->extradata, codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);", "p= codec->extradata + codec->extradata_size - 2 - op.bytes;", "*(p++)= op.bytes>>8;", "*(p++)= op.bytes&0xFF;", "memcpy(p, op.packet, op.bytes);", "}", "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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 29, 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 49 ], [ 51, 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 70 ], [ 74 ], [ 76 ], [ 78 ], [ 80 ], [ 82 ], [ 84 ], [ 86 ], [ 90 ], [ 92 ] ]
24,113
static inline int tcg_temp_new_internal(TCGType type, int temp_local) { TCGContext *s = &tcg_ctx; TCGTemp *ts; int idx, k; k = type; if (temp_local) k += TCG_TYPE_COUNT; idx = s->first_free_temp[k]; if (idx != -1) { /* There is already an available temp with the right type */ ts = &s->temps[idx]; s->first_free_temp[k] = ts->next_free_temp; ts->temp_allocated = 1; assert(ts->temp_local == temp_local); } else { idx = s->nb_temps; #if TCG_TARGET_REG_BITS == 32 if (type == TCG_TYPE_I64) { tcg_temp_alloc(s, s->nb_temps + 2); ts = &s->temps[s->nb_temps]; ts->base_type = type; ts->type = TCG_TYPE_I32; ts->temp_allocated = 1; ts->temp_local = temp_local; ts->name = NULL; ts++; ts->base_type = TCG_TYPE_I32; ts->type = TCG_TYPE_I32; ts->temp_allocated = 1; ts->temp_local = temp_local; ts->name = NULL; s->nb_temps += 2; } else { tcg_temp_alloc(s, s->nb_temps + 1); ts = &s->temps[s->nb_temps]; ts->base_type = type; ts->type = type; ts->temp_allocated = 1; ts->temp_local = temp_local; ts->name = NULL; s->nb_temps++; } } return idx; }
true
qemu
27bfd83c336283d1f7a5345ee386c4cd7b80db61
static inline int tcg_temp_new_internal(TCGType type, int temp_local) { TCGContext *s = &tcg_ctx; TCGTemp *ts; int idx, k; k = type; if (temp_local) k += TCG_TYPE_COUNT; idx = s->first_free_temp[k]; if (idx != -1) { ts = &s->temps[idx]; s->first_free_temp[k] = ts->next_free_temp; ts->temp_allocated = 1; assert(ts->temp_local == temp_local); } else { idx = s->nb_temps; #if TCG_TARGET_REG_BITS == 32 if (type == TCG_TYPE_I64) { tcg_temp_alloc(s, s->nb_temps + 2); ts = &s->temps[s->nb_temps]; ts->base_type = type; ts->type = TCG_TYPE_I32; ts->temp_allocated = 1; ts->temp_local = temp_local; ts->name = NULL; ts++; ts->base_type = TCG_TYPE_I32; ts->type = TCG_TYPE_I32; ts->temp_allocated = 1; ts->temp_local = temp_local; ts->name = NULL; s->nb_temps += 2; } else { tcg_temp_alloc(s, s->nb_temps + 1); ts = &s->temps[s->nb_temps]; ts->base_type = type; ts->type = type; ts->temp_allocated = 1; ts->temp_local = temp_local; ts->name = NULL; s->nb_temps++; } } return idx; }
{ "code": [], "line_no": [] }
static inline int FUNC_0(TCGType VAR_0, int VAR_1) { TCGContext *s = &tcg_ctx; TCGTemp *ts; int VAR_2, VAR_3; VAR_3 = VAR_0; if (VAR_1) VAR_3 += TCG_TYPE_COUNT; VAR_2 = s->first_free_temp[VAR_3]; if (VAR_2 != -1) { ts = &s->temps[VAR_2]; s->first_free_temp[VAR_3] = ts->next_free_temp; ts->temp_allocated = 1; assert(ts->VAR_1 == VAR_1); } else { VAR_2 = s->nb_temps; #if TCG_TARGET_REG_BITS == 32 if (VAR_0 == TCG_TYPE_I64) { tcg_temp_alloc(s, s->nb_temps + 2); ts = &s->temps[s->nb_temps]; ts->base_type = VAR_0; ts->VAR_0 = TCG_TYPE_I32; ts->temp_allocated = 1; ts->VAR_1 = VAR_1; ts->name = NULL; ts++; ts->base_type = TCG_TYPE_I32; ts->VAR_0 = TCG_TYPE_I32; ts->temp_allocated = 1; ts->VAR_1 = VAR_1; ts->name = NULL; s->nb_temps += 2; } else { tcg_temp_alloc(s, s->nb_temps + 1); ts = &s->temps[s->nb_temps]; ts->base_type = VAR_0; ts->VAR_0 = VAR_0; ts->temp_allocated = 1; ts->VAR_1 = VAR_1; ts->name = NULL; s->nb_temps++; } } return VAR_2; }
[ "static inline int FUNC_0(TCGType VAR_0, int VAR_1)\n{", "TCGContext *s = &tcg_ctx;", "TCGTemp *ts;", "int VAR_2, VAR_3;", "VAR_3 = VAR_0;", "if (VAR_1)\nVAR_3 += TCG_TYPE_COUNT;", "VAR_2 = s->first_free_temp[VAR_3];", "if (VAR_2 != -1) {", "ts = &s->temps[VAR_2];", "s->first_free_temp[VAR_3] = ts->next_free_temp;", "ts->temp_allocated = 1;", "assert(ts->VAR_1 == VAR_1);", "} else {", "VAR_2 = s->nb_temps;", "#if TCG_TARGET_REG_BITS == 32\nif (VAR_0 == TCG_TYPE_I64) {", "tcg_temp_alloc(s, s->nb_temps + 2);", "ts = &s->temps[s->nb_temps];", "ts->base_type = VAR_0;", "ts->VAR_0 = TCG_TYPE_I32;", "ts->temp_allocated = 1;", "ts->VAR_1 = VAR_1;", "ts->name = NULL;", "ts++;", "ts->base_type = TCG_TYPE_I32;", "ts->VAR_0 = TCG_TYPE_I32;", "ts->temp_allocated = 1;", "ts->VAR_1 = VAR_1;", "ts->name = NULL;", "s->nb_temps += 2;", "} else", "{", "tcg_temp_alloc(s, s->nb_temps + 1);", "ts = &s->temps[s->nb_temps];", "ts->base_type = VAR_0;", "ts->VAR_0 = VAR_0;", "ts->temp_allocated = 1;", "ts->VAR_1 = VAR_1;", "ts->name = NULL;", "s->nb_temps++;", "}", "}", "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 ]
[ [ 1, 2 ], [ 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7, 8 ], [ 9 ], [ 10 ], [ 13 ], [ 14 ], [ 15 ], [ 16 ], [ 17 ], [ 18 ], [ 19, 20 ], [ 21 ], [ 22 ], [ 23 ], [ 24 ], [ 25 ], [ 26 ], [ 27 ], [ 28 ], [ 29 ], [ 30 ], [ 31 ], [ 32 ], [ 33 ], [ 34 ], [ 35 ], [ 36 ], [ 37 ], [ 38 ], [ 39 ], [ 40 ], [ 41 ], [ 42 ], [ 43 ], [ 44 ], [ 45 ], [ 46 ], [ 47 ], [ 48 ] ]
24,115
static int vp56_size_changed(VP56Context *s) { AVCodecContext *avctx = s->avctx; int stride = s->frames[VP56_FRAME_CURRENT]->linesize[0]; int i; s->plane_width[0] = s->plane_width[3] = avctx->coded_width; s->plane_width[1] = s->plane_width[2] = avctx->coded_width/2; s->plane_height[0] = s->plane_height[3] = avctx->coded_height; s->plane_height[1] = s->plane_height[2] = avctx->coded_height/2; for (i=0; i<4; i++) s->stride[i] = s->flip * s->frames[VP56_FRAME_CURRENT]->linesize[i]; s->mb_width = (avctx->coded_width +15) / 16; s->mb_height = (avctx->coded_height+15) / 16; if (s->mb_width > 1000 || s->mb_height > 1000) { ff_set_dimensions(avctx, 0, 0); av_log(avctx, AV_LOG_ERROR, "picture too big\n"); return AVERROR_INVALIDDATA; } av_reallocp_array(&s->above_blocks, 4*s->mb_width+6, sizeof(*s->above_blocks)); av_reallocp_array(&s->macroblocks, s->mb_width*s->mb_height, sizeof(*s->macroblocks)); av_free(s->edge_emu_buffer_alloc); s->edge_emu_buffer_alloc = av_malloc(16*stride); s->edge_emu_buffer = s->edge_emu_buffer_alloc; if (!s->above_blocks || !s->macroblocks || !s->edge_emu_buffer_alloc) return AVERROR(ENOMEM); if (s->flip < 0) s->edge_emu_buffer += 15 * stride; if (s->alpha_context) return vp56_size_changed(s->alpha_context); return 0; }
true
FFmpeg
6e913f212907048d7009cf2f15551781c69b9985
static int vp56_size_changed(VP56Context *s) { AVCodecContext *avctx = s->avctx; int stride = s->frames[VP56_FRAME_CURRENT]->linesize[0]; int i; s->plane_width[0] = s->plane_width[3] = avctx->coded_width; s->plane_width[1] = s->plane_width[2] = avctx->coded_width/2; s->plane_height[0] = s->plane_height[3] = avctx->coded_height; s->plane_height[1] = s->plane_height[2] = avctx->coded_height/2; for (i=0; i<4; i++) s->stride[i] = s->flip * s->frames[VP56_FRAME_CURRENT]->linesize[i]; s->mb_width = (avctx->coded_width +15) / 16; s->mb_height = (avctx->coded_height+15) / 16; if (s->mb_width > 1000 || s->mb_height > 1000) { ff_set_dimensions(avctx, 0, 0); av_log(avctx, AV_LOG_ERROR, "picture too big\n"); return AVERROR_INVALIDDATA; } av_reallocp_array(&s->above_blocks, 4*s->mb_width+6, sizeof(*s->above_blocks)); av_reallocp_array(&s->macroblocks, s->mb_width*s->mb_height, sizeof(*s->macroblocks)); av_free(s->edge_emu_buffer_alloc); s->edge_emu_buffer_alloc = av_malloc(16*stride); s->edge_emu_buffer = s->edge_emu_buffer_alloc; if (!s->above_blocks || !s->macroblocks || !s->edge_emu_buffer_alloc) return AVERROR(ENOMEM); if (s->flip < 0) s->edge_emu_buffer += 15 * stride; if (s->alpha_context) return vp56_size_changed(s->alpha_context); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(VP56Context *VAR_0) { AVCodecContext *avctx = VAR_0->avctx; int VAR_1 = VAR_0->frames[VP56_FRAME_CURRENT]->linesize[0]; int VAR_2; VAR_0->plane_width[0] = VAR_0->plane_width[3] = avctx->coded_width; VAR_0->plane_width[1] = VAR_0->plane_width[2] = avctx->coded_width/2; VAR_0->plane_height[0] = VAR_0->plane_height[3] = avctx->coded_height; VAR_0->plane_height[1] = VAR_0->plane_height[2] = avctx->coded_height/2; for (VAR_2=0; VAR_2<4; VAR_2++) VAR_0->VAR_1[VAR_2] = VAR_0->flip * VAR_0->frames[VP56_FRAME_CURRENT]->linesize[VAR_2]; VAR_0->mb_width = (avctx->coded_width +15) / 16; VAR_0->mb_height = (avctx->coded_height+15) / 16; if (VAR_0->mb_width > 1000 || VAR_0->mb_height > 1000) { ff_set_dimensions(avctx, 0, 0); av_log(avctx, AV_LOG_ERROR, "picture too big\n"); return AVERROR_INVALIDDATA; } av_reallocp_array(&VAR_0->above_blocks, 4*VAR_0->mb_width+6, sizeof(*VAR_0->above_blocks)); av_reallocp_array(&VAR_0->macroblocks, VAR_0->mb_width*VAR_0->mb_height, sizeof(*VAR_0->macroblocks)); av_free(VAR_0->edge_emu_buffer_alloc); VAR_0->edge_emu_buffer_alloc = av_malloc(16*VAR_1); VAR_0->edge_emu_buffer = VAR_0->edge_emu_buffer_alloc; if (!VAR_0->above_blocks || !VAR_0->macroblocks || !VAR_0->edge_emu_buffer_alloc) return AVERROR(ENOMEM); if (VAR_0->flip < 0) VAR_0->edge_emu_buffer += 15 * VAR_1; if (VAR_0->alpha_context) return FUNC_0(VAR_0->alpha_context); return 0; }
[ "static int FUNC_0(VP56Context *VAR_0)\n{", "AVCodecContext *avctx = VAR_0->avctx;", "int VAR_1 = VAR_0->frames[VP56_FRAME_CURRENT]->linesize[0];", "int VAR_2;", "VAR_0->plane_width[0] = VAR_0->plane_width[3] = avctx->coded_width;", "VAR_0->plane_width[1] = VAR_0->plane_width[2] = avctx->coded_width/2;", "VAR_0->plane_height[0] = VAR_0->plane_height[3] = avctx->coded_height;", "VAR_0->plane_height[1] = VAR_0->plane_height[2] = avctx->coded_height/2;", "for (VAR_2=0; VAR_2<4; VAR_2++)", "VAR_0->VAR_1[VAR_2] = VAR_0->flip * VAR_0->frames[VP56_FRAME_CURRENT]->linesize[VAR_2];", "VAR_0->mb_width = (avctx->coded_width +15) / 16;", "VAR_0->mb_height = (avctx->coded_height+15) / 16;", "if (VAR_0->mb_width > 1000 || VAR_0->mb_height > 1000) {", "ff_set_dimensions(avctx, 0, 0);", "av_log(avctx, AV_LOG_ERROR, \"picture too big\\n\");", "return AVERROR_INVALIDDATA;", "}", "av_reallocp_array(&VAR_0->above_blocks, 4*VAR_0->mb_width+6,\nsizeof(*VAR_0->above_blocks));", "av_reallocp_array(&VAR_0->macroblocks, VAR_0->mb_width*VAR_0->mb_height,\nsizeof(*VAR_0->macroblocks));", "av_free(VAR_0->edge_emu_buffer_alloc);", "VAR_0->edge_emu_buffer_alloc = av_malloc(16*VAR_1);", "VAR_0->edge_emu_buffer = VAR_0->edge_emu_buffer_alloc;", "if (!VAR_0->above_blocks || !VAR_0->macroblocks || !VAR_0->edge_emu_buffer_alloc)\nreturn AVERROR(ENOMEM);", "if (VAR_0->flip < 0)\nVAR_0->edge_emu_buffer += 15 * VAR_1;", "if (VAR_0->alpha_context)\nreturn FUNC_0(VAR_0->alpha_context);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 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 ] ]
24,116
static void rtsp_cmd_teardown(HTTPContext *c, const char *url, RTSPHeader *h) { HTTPContext *rtp_c; rtp_c = find_rtp_session_with_url(url, h->session_id); if (!rtp_c) { rtsp_reply_error(c, RTSP_STATUS_SESSION); return; } /* abort the session */ close_connection(rtp_c); /* now everything is OK, so we can send the connection parameters */ rtsp_reply_header(c, RTSP_STATUS_OK); /* session ID */ url_fprintf(c->pb, "Session: %s\r\n", rtp_c->session_id); url_fprintf(c->pb, "\r\n"); }
true
FFmpeg
b0b2faa70995caf710bf49c7c6eb6dc502a67672
static void rtsp_cmd_teardown(HTTPContext *c, const char *url, RTSPHeader *h) { HTTPContext *rtp_c; rtp_c = find_rtp_session_with_url(url, h->session_id); if (!rtp_c) { rtsp_reply_error(c, RTSP_STATUS_SESSION); return; } close_connection(rtp_c); rtsp_reply_header(c, RTSP_STATUS_OK); url_fprintf(c->pb, "Session: %s\r\n", rtp_c->session_id); url_fprintf(c->pb, "\r\n"); }
{ "code": [ " url_fprintf(c->pb, \"Session: %s\\r\\n\", rtp_c->session_id);" ], "line_no": [ 33 ] }
static void FUNC_0(HTTPContext *VAR_0, const char *VAR_1, RTSPHeader *VAR_2) { HTTPContext *rtp_c; rtp_c = find_rtp_session_with_url(VAR_1, VAR_2->session_id); if (!rtp_c) { rtsp_reply_error(VAR_0, RTSP_STATUS_SESSION); return; } close_connection(rtp_c); rtsp_reply_header(VAR_0, RTSP_STATUS_OK); url_fprintf(VAR_0->pb, "Session: %s\r\n", rtp_c->session_id); url_fprintf(VAR_0->pb, "\r\n"); }
[ "static void FUNC_0(HTTPContext *VAR_0, const char *VAR_1, RTSPHeader *VAR_2)\n{", "HTTPContext *rtp_c;", "rtp_c = find_rtp_session_with_url(VAR_1, VAR_2->session_id);", "if (!rtp_c) {", "rtsp_reply_error(VAR_0, RTSP_STATUS_SESSION);", "return;", "}", "close_connection(rtp_c);", "rtsp_reply_header(VAR_0, RTSP_STATUS_OK);", "url_fprintf(VAR_0->pb, \"Session: %s\\r\\n\", rtp_c->session_id);", "url_fprintf(VAR_0->pb, \"\\r\\n\");", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 23 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ] ]
24,118
static CharDriverState *qemu_chr_open_win_path(const char *filename) { CharDriverState *chr; WinCharState *s; chr = qemu_chr_alloc(); s = g_malloc0(sizeof(WinCharState)); chr->opaque = s; chr->chr_write = win_chr_write; chr->chr_close = win_chr_close; if (win_chr_init(chr, filename) < 0) { g_free(s); g_free(chr); return NULL; } return chr; }
true
qemu
2d528d45ecf5ee3c1a566a9f3d664464925ef830
static CharDriverState *qemu_chr_open_win_path(const char *filename) { CharDriverState *chr; WinCharState *s; chr = qemu_chr_alloc(); s = g_malloc0(sizeof(WinCharState)); chr->opaque = s; chr->chr_write = win_chr_write; chr->chr_close = win_chr_close; if (win_chr_init(chr, filename) < 0) { g_free(s); g_free(chr); return NULL; } return chr; }
{ "code": [ " s = g_malloc0(sizeof(WinCharState));", " s = g_malloc0(sizeof(WinCharState));", " s = g_malloc0(sizeof(WinCharState));" ], "line_no": [ 13, 13, 13 ] }
static CharDriverState *FUNC_0(const char *filename) { CharDriverState *chr; WinCharState *s; chr = qemu_chr_alloc(); s = g_malloc0(sizeof(WinCharState)); chr->opaque = s; chr->chr_write = win_chr_write; chr->chr_close = win_chr_close; if (win_chr_init(chr, filename) < 0) { g_free(s); g_free(chr); return NULL; } return chr; }
[ "static CharDriverState *FUNC_0(const char *filename)\n{", "CharDriverState *chr;", "WinCharState *s;", "chr = qemu_chr_alloc();", "s = g_malloc0(sizeof(WinCharState));", "chr->opaque = s;", "chr->chr_write = win_chr_write;", "chr->chr_close = win_chr_close;", "if (win_chr_init(chr, filename) < 0) {", "g_free(s);", "g_free(chr);", "return NULL;", "}", "return chr;", "}" ]
[ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ] ]
24,119
static av_cold int twin_decode_init(AVCodecContext *avctx) { int ret; TwinContext *tctx = avctx->priv_data; int isampf, ibps; tctx->avctx = avctx; avctx->sample_fmt = AV_SAMPLE_FMT_FLTP; if (!avctx->extradata || avctx->extradata_size < 12) { av_log(avctx, AV_LOG_ERROR, "Missing or incomplete extradata\n"); return AVERROR_INVALIDDATA; } avctx->channels = AV_RB32(avctx->extradata ) + 1; avctx->bit_rate = AV_RB32(avctx->extradata + 4) * 1000; isampf = AV_RB32(avctx->extradata + 8); switch (isampf) { case 44: avctx->sample_rate = 44100; break; case 22: avctx->sample_rate = 22050; break; case 11: avctx->sample_rate = 11025; break; default: avctx->sample_rate = isampf * 1000; break; } if (avctx->channels > CHANNELS_MAX) { av_log(avctx, AV_LOG_ERROR, "Unsupported number of channels: %i\n", avctx->channels); return -1; } ibps = avctx->bit_rate / (1000 * avctx->channels); switch ((isampf << 8) + ibps) { case (8 <<8) + 8: tctx->mtab = &mode_08_08; break; case (11<<8) + 8: tctx->mtab = &mode_11_08; break; case (11<<8) + 10: tctx->mtab = &mode_11_10; break; case (16<<8) + 16: tctx->mtab = &mode_16_16; break; case (22<<8) + 20: tctx->mtab = &mode_22_20; break; case (22<<8) + 24: tctx->mtab = &mode_22_24; break; case (22<<8) + 32: tctx->mtab = &mode_22_32; break; case (44<<8) + 40: tctx->mtab = &mode_44_40; break; case (44<<8) + 48: tctx->mtab = &mode_44_48; break; default: av_log(avctx, AV_LOG_ERROR, "This version does not support %d kHz - %d kbit/s/ch mode.\n", isampf, isampf); return -1; } ff_dsputil_init(&tctx->dsp, avctx); avpriv_float_dsp_init(&tctx->fdsp, avctx->flags & CODEC_FLAG_BITEXACT); if ((ret = init_mdct_win(tctx))) { av_log(avctx, AV_LOG_ERROR, "Error initializing MDCT\n"); twin_decode_close(avctx); return ret; } init_bitstream_params(tctx); memset_float(tctx->bark_hist[0][0], 0.1, FF_ARRAY_ELEMS(tctx->bark_hist)); avcodec_get_frame_defaults(&tctx->frame); avctx->coded_frame = &tctx->frame; return 0; }
true
FFmpeg
8cc72ce5a0d8ab6bc88d28cf55cd62674240121d
static av_cold int twin_decode_init(AVCodecContext *avctx) { int ret; TwinContext *tctx = avctx->priv_data; int isampf, ibps; tctx->avctx = avctx; avctx->sample_fmt = AV_SAMPLE_FMT_FLTP; if (!avctx->extradata || avctx->extradata_size < 12) { av_log(avctx, AV_LOG_ERROR, "Missing or incomplete extradata\n"); return AVERROR_INVALIDDATA; } avctx->channels = AV_RB32(avctx->extradata ) + 1; avctx->bit_rate = AV_RB32(avctx->extradata + 4) * 1000; isampf = AV_RB32(avctx->extradata + 8); switch (isampf) { case 44: avctx->sample_rate = 44100; break; case 22: avctx->sample_rate = 22050; break; case 11: avctx->sample_rate = 11025; break; default: avctx->sample_rate = isampf * 1000; break; } if (avctx->channels > CHANNELS_MAX) { av_log(avctx, AV_LOG_ERROR, "Unsupported number of channels: %i\n", avctx->channels); return -1; } ibps = avctx->bit_rate / (1000 * avctx->channels); switch ((isampf << 8) + ibps) { case (8 <<8) + 8: tctx->mtab = &mode_08_08; break; case (11<<8) + 8: tctx->mtab = &mode_11_08; break; case (11<<8) + 10: tctx->mtab = &mode_11_10; break; case (16<<8) + 16: tctx->mtab = &mode_16_16; break; case (22<<8) + 20: tctx->mtab = &mode_22_20; break; case (22<<8) + 24: tctx->mtab = &mode_22_24; break; case (22<<8) + 32: tctx->mtab = &mode_22_32; break; case (44<<8) + 40: tctx->mtab = &mode_44_40; break; case (44<<8) + 48: tctx->mtab = &mode_44_48; break; default: av_log(avctx, AV_LOG_ERROR, "This version does not support %d kHz - %d kbit/s/ch mode.\n", isampf, isampf); return -1; } ff_dsputil_init(&tctx->dsp, avctx); avpriv_float_dsp_init(&tctx->fdsp, avctx->flags & CODEC_FLAG_BITEXACT); if ((ret = init_mdct_win(tctx))) { av_log(avctx, AV_LOG_ERROR, "Error initializing MDCT\n"); twin_decode_close(avctx); return ret; } init_bitstream_params(tctx); memset_float(tctx->bark_hist[0][0], 0.1, FF_ARRAY_ELEMS(tctx->bark_hist)); avcodec_get_frame_defaults(&tctx->frame); avctx->coded_frame = &tctx->frame; return 0; }
{ "code": [ " if (avctx->channels > CHANNELS_MAX) {" ], "line_no": [ 47 ] }
static av_cold int FUNC_0(AVCodecContext *avctx) { int VAR_0; TwinContext *tctx = avctx->priv_data; int VAR_1, VAR_2; tctx->avctx = avctx; avctx->sample_fmt = AV_SAMPLE_FMT_FLTP; if (!avctx->extradata || avctx->extradata_size < 12) { av_log(avctx, AV_LOG_ERROR, "Missing or incomplete extradata\n"); return AVERROR_INVALIDDATA; } avctx->channels = AV_RB32(avctx->extradata ) + 1; avctx->bit_rate = AV_RB32(avctx->extradata + 4) * 1000; VAR_1 = AV_RB32(avctx->extradata + 8); switch (VAR_1) { case 44: avctx->sample_rate = 44100; break; case 22: avctx->sample_rate = 22050; break; case 11: avctx->sample_rate = 11025; break; default: avctx->sample_rate = VAR_1 * 1000; break; } if (avctx->channels > CHANNELS_MAX) { av_log(avctx, AV_LOG_ERROR, "Unsupported number of channels: %i\n", avctx->channels); return -1; } VAR_2 = avctx->bit_rate / (1000 * avctx->channels); switch ((VAR_1 << 8) + VAR_2) { case (8 <<8) + 8: tctx->mtab = &mode_08_08; break; case (11<<8) + 8: tctx->mtab = &mode_11_08; break; case (11<<8) + 10: tctx->mtab = &mode_11_10; break; case (16<<8) + 16: tctx->mtab = &mode_16_16; break; case (22<<8) + 20: tctx->mtab = &mode_22_20; break; case (22<<8) + 24: tctx->mtab = &mode_22_24; break; case (22<<8) + 32: tctx->mtab = &mode_22_32; break; case (44<<8) + 40: tctx->mtab = &mode_44_40; break; case (44<<8) + 48: tctx->mtab = &mode_44_48; break; default: av_log(avctx, AV_LOG_ERROR, "This version does not support %d kHz - %d kbit/s/ch mode.\n", VAR_1, VAR_1); return -1; } ff_dsputil_init(&tctx->dsp, avctx); avpriv_float_dsp_init(&tctx->fdsp, avctx->flags & CODEC_FLAG_BITEXACT); if ((VAR_0 = init_mdct_win(tctx))) { av_log(avctx, AV_LOG_ERROR, "Error initializing MDCT\n"); twin_decode_close(avctx); return VAR_0; } init_bitstream_params(tctx); memset_float(tctx->bark_hist[0][0], 0.1, FF_ARRAY_ELEMS(tctx->bark_hist)); avcodec_get_frame_defaults(&tctx->frame); avctx->coded_frame = &tctx->frame; return 0; }
[ "static av_cold int FUNC_0(AVCodecContext *avctx)\n{", "int VAR_0;", "TwinContext *tctx = avctx->priv_data;", "int VAR_1, VAR_2;", "tctx->avctx = avctx;", "avctx->sample_fmt = AV_SAMPLE_FMT_FLTP;", "if (!avctx->extradata || avctx->extradata_size < 12) {", "av_log(avctx, AV_LOG_ERROR, \"Missing or incomplete extradata\\n\");", "return AVERROR_INVALIDDATA;", "}", "avctx->channels = AV_RB32(avctx->extradata ) + 1;", "avctx->bit_rate = AV_RB32(avctx->extradata + 4) * 1000;", "VAR_1 = AV_RB32(avctx->extradata + 8);", "switch (VAR_1) {", "case 44: avctx->sample_rate = 44100; break;", "case 22: avctx->sample_rate = 22050; break;", "case 11: avctx->sample_rate = 11025; break;", "default: avctx->sample_rate = VAR_1 * 1000; break;", "}", "if (avctx->channels > CHANNELS_MAX) {", "av_log(avctx, AV_LOG_ERROR, \"Unsupported number of channels: %i\\n\",\navctx->channels);", "return -1;", "}", "VAR_2 = avctx->bit_rate / (1000 * avctx->channels);", "switch ((VAR_1 << 8) + VAR_2) {", "case (8 <<8) + 8: tctx->mtab = &mode_08_08; break;", "case (11<<8) + 8: tctx->mtab = &mode_11_08; break;", "case (11<<8) + 10: tctx->mtab = &mode_11_10; break;", "case (16<<8) + 16: tctx->mtab = &mode_16_16; break;", "case (22<<8) + 20: tctx->mtab = &mode_22_20; break;", "case (22<<8) + 24: tctx->mtab = &mode_22_24; break;", "case (22<<8) + 32: tctx->mtab = &mode_22_32; break;", "case (44<<8) + 40: tctx->mtab = &mode_44_40; break;", "case (44<<8) + 48: tctx->mtab = &mode_44_48; break;", "default:\nav_log(avctx, AV_LOG_ERROR, \"This version does not support %d kHz - %d kbit/s/ch mode.\\n\", VAR_1, VAR_1);", "return -1;", "}", "ff_dsputil_init(&tctx->dsp, avctx);", "avpriv_float_dsp_init(&tctx->fdsp, avctx->flags & CODEC_FLAG_BITEXACT);", "if ((VAR_0 = init_mdct_win(tctx))) {", "av_log(avctx, AV_LOG_ERROR, \"Error initializing MDCT\\n\");", "twin_decode_close(avctx);", "return VAR_0;", "}", "init_bitstream_params(tctx);", "memset_float(tctx->bark_hist[0][0], 0.1, FF_ARRAY_ELEMS(tctx->bark_hist));", "avcodec_get_frame_defaults(&tctx->frame);", "avctx->coded_frame = &tctx->frame;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49, 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81, 83 ], [ 85 ], [ 87 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 109 ], [ 113 ], [ 115 ], [ 119 ], [ 121 ] ]
24,120
static int mov_read_sidx(MOVContext *c, AVIOContext *pb, MOVAtom atom) { int64_t offset = avio_tell(pb) + atom.size, pts, timestamp; uint8_t version; unsigned i, j, track_id, item_count; AVStream *st = NULL; AVStream *ref_st = NULL; MOVStreamContext *sc, *ref_sc = NULL; AVRational timescale; version = avio_r8(pb); if (version > 1) { avpriv_request_sample(c->fc, "sidx version %u", version); return 0; } avio_rb24(pb); // flags track_id = avio_rb32(pb); // Reference ID for (i = 0; i < c->fc->nb_streams; i++) { if (c->fc->streams[i]->id == track_id) { st = c->fc->streams[i]; break; } } if (!st) { av_log(c->fc, AV_LOG_WARNING, "could not find corresponding track id %d\n", track_id); return 0; } sc = st->priv_data; timescale = av_make_q(1, avio_rb32(pb)); if (timescale.den <= 0) { av_log(c->fc, AV_LOG_ERROR, "Invalid sidx timescale 1/%d\n", timescale.den); return AVERROR_INVALIDDATA; } if (version == 0) { pts = avio_rb32(pb); offset += avio_rb32(pb); } else { pts = avio_rb64(pb); offset += avio_rb64(pb); } avio_rb16(pb); // reserved item_count = avio_rb16(pb); for (i = 0; i < item_count; i++) { int index; MOVFragmentStreamInfo * frag_stream_info; uint32_t size = avio_rb32(pb); uint32_t duration = avio_rb32(pb); if (size & 0x80000000) { avpriv_request_sample(c->fc, "sidx reference_type 1"); return AVERROR_PATCHWELCOME; } avio_rb32(pb); // sap_flags timestamp = av_rescale_q(pts, st->time_base, timescale); index = update_frag_index(c, offset); frag_stream_info = get_frag_stream_info(&c->frag_index, index, track_id); if (frag_stream_info) frag_stream_info->sidx_pts = timestamp; offset += size; pts += duration; } st->duration = sc->track_end = pts; sc->has_sidx = 1; if (offset == avio_size(pb)) { // Find first entry in fragment index that came from an sidx. // This will pretty much always be the first entry. for (i = 0; i < c->frag_index.nb_items; i++) { MOVFragmentIndexItem * item = &c->frag_index.item[i]; for (j = 0; ref_st == NULL && j < item->nb_stream_info; j++) { MOVFragmentStreamInfo * si; si = &item->stream_info[j]; if (si->sidx_pts != AV_NOPTS_VALUE) { ref_st = c->fc->streams[i]; ref_sc = ref_st->priv_data; break; } } } for (i = 0; i < c->fc->nb_streams; i++) { st = c->fc->streams[i]; sc = st->priv_data; if (!sc->has_sidx) { st->duration = sc->track_end = av_rescale(ref_st->duration, sc->time_scale, ref_sc->time_scale); } } c->frag_index.complete = 1; } return 0; }
true
FFmpeg
bdddcb7b030d075dffa2989222d687106c06d50c
static int mov_read_sidx(MOVContext *c, AVIOContext *pb, MOVAtom atom) { int64_t offset = avio_tell(pb) + atom.size, pts, timestamp; uint8_t version; unsigned i, j, track_id, item_count; AVStream *st = NULL; AVStream *ref_st = NULL; MOVStreamContext *sc, *ref_sc = NULL; AVRational timescale; version = avio_r8(pb); if (version > 1) { avpriv_request_sample(c->fc, "sidx version %u", version); return 0; } avio_rb24(pb); track_id = avio_rb32(pb); for (i = 0; i < c->fc->nb_streams; i++) { if (c->fc->streams[i]->id == track_id) { st = c->fc->streams[i]; break; } } if (!st) { av_log(c->fc, AV_LOG_WARNING, "could not find corresponding track id %d\n", track_id); return 0; } sc = st->priv_data; timescale = av_make_q(1, avio_rb32(pb)); if (timescale.den <= 0) { av_log(c->fc, AV_LOG_ERROR, "Invalid sidx timescale 1/%d\n", timescale.den); return AVERROR_INVALIDDATA; } if (version == 0) { pts = avio_rb32(pb); offset += avio_rb32(pb); } else { pts = avio_rb64(pb); offset += avio_rb64(pb); } avio_rb16(pb); item_count = avio_rb16(pb); for (i = 0; i < item_count; i++) { int index; MOVFragmentStreamInfo * frag_stream_info; uint32_t size = avio_rb32(pb); uint32_t duration = avio_rb32(pb); if (size & 0x80000000) { avpriv_request_sample(c->fc, "sidx reference_type 1"); return AVERROR_PATCHWELCOME; } avio_rb32(pb); timestamp = av_rescale_q(pts, st->time_base, timescale); index = update_frag_index(c, offset); frag_stream_info = get_frag_stream_info(&c->frag_index, index, track_id); if (frag_stream_info) frag_stream_info->sidx_pts = timestamp; offset += size; pts += duration; } st->duration = sc->track_end = pts; sc->has_sidx = 1; if (offset == avio_size(pb)) { for (i = 0; i < c->frag_index.nb_items; i++) { MOVFragmentIndexItem * item = &c->frag_index.item[i]; for (j = 0; ref_st == NULL && j < item->nb_stream_info; j++) { MOVFragmentStreamInfo * si; si = &item->stream_info[j]; if (si->sidx_pts != AV_NOPTS_VALUE) { ref_st = c->fc->streams[i]; ref_sc = ref_st->priv_data; break; } } } for (i = 0; i < c->fc->nb_streams; i++) { st = c->fc->streams[i]; sc = st->priv_data; if (!sc->has_sidx) { st->duration = sc->track_end = av_rescale(ref_st->duration, sc->time_scale, ref_sc->time_scale); } } c->frag_index.complete = 1; } return 0; }
{ "code": [ " ref_st = c->fc->streams[i];" ], "line_no": [ 171 ] }
static int FUNC_0(MOVContext *VAR_0, AVIOContext *VAR_1, MOVAtom VAR_2) { int64_t offset = avio_tell(VAR_1) + VAR_2.size, pts, timestamp; uint8_t version; unsigned VAR_3, VAR_4, VAR_5, VAR_6; AVStream *st = NULL; AVStream *ref_st = NULL; MOVStreamContext *sc, *ref_sc = NULL; AVRational timescale; version = avio_r8(VAR_1); if (version > 1) { avpriv_request_sample(VAR_0->fc, "sidx version %u", version); return 0; } avio_rb24(VAR_1); VAR_5 = avio_rb32(VAR_1); for (VAR_3 = 0; VAR_3 < VAR_0->fc->nb_streams; VAR_3++) { if (VAR_0->fc->streams[VAR_3]->id == VAR_5) { st = VAR_0->fc->streams[VAR_3]; break; } } if (!st) { av_log(VAR_0->fc, AV_LOG_WARNING, "could not find corresponding track id %d\n", VAR_5); return 0; } sc = st->priv_data; timescale = av_make_q(1, avio_rb32(VAR_1)); if (timescale.den <= 0) { av_log(VAR_0->fc, AV_LOG_ERROR, "Invalid sidx timescale 1/%d\n", timescale.den); return AVERROR_INVALIDDATA; } if (version == 0) { pts = avio_rb32(VAR_1); offset += avio_rb32(VAR_1); } else { pts = avio_rb64(VAR_1); offset += avio_rb64(VAR_1); } avio_rb16(VAR_1); VAR_6 = avio_rb16(VAR_1); for (VAR_3 = 0; VAR_3 < VAR_6; VAR_3++) { int VAR_7; MOVFragmentStreamInfo * frag_stream_info; uint32_t size = avio_rb32(VAR_1); uint32_t duration = avio_rb32(VAR_1); if (size & 0x80000000) { avpriv_request_sample(VAR_0->fc, "sidx reference_type 1"); return AVERROR_PATCHWELCOME; } avio_rb32(VAR_1); timestamp = av_rescale_q(pts, st->time_base, timescale); VAR_7 = update_frag_index(VAR_0, offset); frag_stream_info = get_frag_stream_info(&VAR_0->frag_index, VAR_7, VAR_5); if (frag_stream_info) frag_stream_info->sidx_pts = timestamp; offset += size; pts += duration; } st->duration = sc->track_end = pts; sc->has_sidx = 1; if (offset == avio_size(VAR_1)) { for (VAR_3 = 0; VAR_3 < VAR_0->frag_index.nb_items; VAR_3++) { MOVFragmentIndexItem * item = &VAR_0->frag_index.item[VAR_3]; for (VAR_4 = 0; ref_st == NULL && VAR_4 < item->nb_stream_info; VAR_4++) { MOVFragmentStreamInfo * si; si = &item->stream_info[VAR_4]; if (si->sidx_pts != AV_NOPTS_VALUE) { ref_st = VAR_0->fc->streams[VAR_3]; ref_sc = ref_st->priv_data; break; } } } for (VAR_3 = 0; VAR_3 < VAR_0->fc->nb_streams; VAR_3++) { st = VAR_0->fc->streams[VAR_3]; sc = st->priv_data; if (!sc->has_sidx) { st->duration = sc->track_end = av_rescale(ref_st->duration, sc->time_scale, ref_sc->time_scale); } } VAR_0->frag_index.complete = 1; } return 0; }
[ "static int FUNC_0(MOVContext *VAR_0, AVIOContext *VAR_1, MOVAtom VAR_2)\n{", "int64_t offset = avio_tell(VAR_1) + VAR_2.size, pts, timestamp;", "uint8_t version;", "unsigned VAR_3, VAR_4, VAR_5, VAR_6;", "AVStream *st = NULL;", "AVStream *ref_st = NULL;", "MOVStreamContext *sc, *ref_sc = NULL;", "AVRational timescale;", "version = avio_r8(VAR_1);", "if (version > 1) {", "avpriv_request_sample(VAR_0->fc, \"sidx version %u\", version);", "return 0;", "}", "avio_rb24(VAR_1);", "VAR_5 = avio_rb32(VAR_1);", "for (VAR_3 = 0; VAR_3 < VAR_0->fc->nb_streams; VAR_3++) {", "if (VAR_0->fc->streams[VAR_3]->id == VAR_5) {", "st = VAR_0->fc->streams[VAR_3];", "break;", "}", "}", "if (!st) {", "av_log(VAR_0->fc, AV_LOG_WARNING, \"could not find corresponding track id %d\\n\", VAR_5);", "return 0;", "}", "sc = st->priv_data;", "timescale = av_make_q(1, avio_rb32(VAR_1));", "if (timescale.den <= 0) {", "av_log(VAR_0->fc, AV_LOG_ERROR, \"Invalid sidx timescale 1/%d\\n\", timescale.den);", "return AVERROR_INVALIDDATA;", "}", "if (version == 0) {", "pts = avio_rb32(VAR_1);", "offset += avio_rb32(VAR_1);", "} else {", "pts = avio_rb64(VAR_1);", "offset += avio_rb64(VAR_1);", "}", "avio_rb16(VAR_1);", "VAR_6 = avio_rb16(VAR_1);", "for (VAR_3 = 0; VAR_3 < VAR_6; VAR_3++) {", "int VAR_7;", "MOVFragmentStreamInfo * frag_stream_info;", "uint32_t size = avio_rb32(VAR_1);", "uint32_t duration = avio_rb32(VAR_1);", "if (size & 0x80000000) {", "avpriv_request_sample(VAR_0->fc, \"sidx reference_type 1\");", "return AVERROR_PATCHWELCOME;", "}", "avio_rb32(VAR_1);", "timestamp = av_rescale_q(pts, st->time_base, timescale);", "VAR_7 = update_frag_index(VAR_0, offset);", "frag_stream_info = get_frag_stream_info(&VAR_0->frag_index, VAR_7, VAR_5);", "if (frag_stream_info)\nfrag_stream_info->sidx_pts = timestamp;", "offset += size;", "pts += duration;", "}", "st->duration = sc->track_end = pts;", "sc->has_sidx = 1;", "if (offset == avio_size(VAR_1)) {", "for (VAR_3 = 0; VAR_3 < VAR_0->frag_index.nb_items; VAR_3++) {", "MOVFragmentIndexItem * item = &VAR_0->frag_index.item[VAR_3];", "for (VAR_4 = 0; ref_st == NULL && VAR_4 < item->nb_stream_info; VAR_4++) {", "MOVFragmentStreamInfo * si;", "si = &item->stream_info[VAR_4];", "if (si->sidx_pts != AV_NOPTS_VALUE) {", "ref_st = VAR_0->fc->streams[VAR_3];", "ref_sc = ref_st->priv_data;", "break;", "}", "}", "}", "for (VAR_3 = 0; VAR_3 < VAR_0->fc->nb_streams; VAR_3++) {", "st = VAR_0->fc->streams[VAR_3];", "sc = st->priv_data;", "if (!sc->has_sidx) {", "st->duration = sc->track_end = av_rescale(ref_st->duration, sc->time_scale, ref_sc->time_scale);", "}", "}", "VAR_0->frag_index.complete = 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, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 65 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 95 ], [ 99 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 127 ], [ 129 ], [ 131, 133 ], [ 137 ], [ 139 ], [ 141 ], [ 145 ], [ 149 ], [ 153 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 199 ], [ 201 ], [ 205 ], [ 207 ] ]
24,121
static void shix_init(MachineState *machine) { const char *cpu_model = machine->cpu_model; int ret; SuperHCPU *cpu; struct SH7750State *s; MemoryRegion *sysmem = get_system_memory(); MemoryRegion *rom = g_new(MemoryRegion, 1); MemoryRegion *sdram = g_new(MemoryRegion, 2); if (!cpu_model) cpu_model = "any"; cpu = SUPERH_CPU(cpu_generic_init(TYPE_SUPERH_CPU, cpu_model)); if (cpu == NULL) { fprintf(stderr, "Unable to find CPU definition\n"); exit(1); } /* Allocate memory space */ memory_region_init_ram(rom, NULL, "shix.rom", 0x4000, &error_fatal); memory_region_set_readonly(rom, true); memory_region_add_subregion(sysmem, 0x00000000, rom); memory_region_init_ram(&sdram[0], NULL, "shix.sdram1", 0x01000000, &error_fatal); memory_region_add_subregion(sysmem, 0x08000000, &sdram[0]); memory_region_init_ram(&sdram[1], NULL, "shix.sdram2", 0x01000000, &error_fatal); memory_region_add_subregion(sysmem, 0x0c000000, &sdram[1]); /* Load BIOS in 0 (and access it through P2, 0xA0000000) */ if (bios_name == NULL) bios_name = BIOS_FILENAME; ret = load_image_targphys(bios_name, 0, 0x4000); if (ret < 0 && !qtest_enabled()) { error_report("Could not load SHIX bios '%s'", bios_name); exit(1); } /* Register peripherals */ s = sh7750_init(cpu, sysmem); /* XXXXX Check success */ tc58128_init(s, "shix_linux_nand.bin", NULL); }
true
qemu
4482e05cbbb7e50e476f6a9500cf0b38913bd939
static void shix_init(MachineState *machine) { const char *cpu_model = machine->cpu_model; int ret; SuperHCPU *cpu; struct SH7750State *s; MemoryRegion *sysmem = get_system_memory(); MemoryRegion *rom = g_new(MemoryRegion, 1); MemoryRegion *sdram = g_new(MemoryRegion, 2); if (!cpu_model) cpu_model = "any"; cpu = SUPERH_CPU(cpu_generic_init(TYPE_SUPERH_CPU, cpu_model)); if (cpu == NULL) { fprintf(stderr, "Unable to find CPU definition\n"); exit(1); } memory_region_init_ram(rom, NULL, "shix.rom", 0x4000, &error_fatal); memory_region_set_readonly(rom, true); memory_region_add_subregion(sysmem, 0x00000000, rom); memory_region_init_ram(&sdram[0], NULL, "shix.sdram1", 0x01000000, &error_fatal); memory_region_add_subregion(sysmem, 0x08000000, &sdram[0]); memory_region_init_ram(&sdram[1], NULL, "shix.sdram2", 0x01000000, &error_fatal); memory_region_add_subregion(sysmem, 0x0c000000, &sdram[1]); if (bios_name == NULL) bios_name = BIOS_FILENAME; ret = load_image_targphys(bios_name, 0, 0x4000); if (ret < 0 && !qtest_enabled()) { error_report("Could not load SHIX bios '%s'", bios_name); exit(1); } s = sh7750_init(cpu, sysmem); tc58128_init(s, "shix_linux_nand.bin", NULL); }
{ "code": [ " fprintf(stderr, \"Unable to find CPU definition\\n\");", " exit(1);", " fprintf(stderr, \"Unable to find CPU definition\\n\");", " exit(1);", " fprintf(stderr, \"Unable to find CPU definition\\n\");", " exit(1);", " fprintf(stderr, \"Unable to find CPU definition\\n\");", " exit(1);", " fprintf(stderr, \"Unable to find CPU definition\\n\");", " exit(1);", " fprintf(stderr, \"Unable to find CPU definition\\n\");", " exit(1);", " exit(1);", " if (cpu == NULL) {", " exit(1);", " if (cpu == NULL) {", " exit(1);", " if (cpu == NULL) {", " exit(1);", " exit(1);", " exit(1);", " if (cpu == NULL) {", " fprintf(stderr, \"Unable to find CPU definition\\n\");", " exit(1);", " if (cpu == NULL) {", " fprintf(stderr, \"Unable to find CPU definition\\n\");", " exit(1);", " if (cpu == NULL) {", " fprintf(stderr, \"Unable to find CPU definition\\n\");", " exit(1);", " if (cpu == NULL) {", " fprintf(stderr, \"Unable to find CPU definition\\n\");", " exit(1);", " fprintf(stderr, \"Unable to find CPU definition\\n\");", " exit(1);", " if (cpu == NULL) {", " exit(1);", " if (cpu == NULL) {", " exit(1);", " exit(1);", " if (cpu == NULL) {", " exit(1);", " if (cpu == NULL) {", " fprintf(stderr, \"Unable to find CPU definition\\n\");", " exit(1);", " if (cpu == NULL) {", " fprintf(stderr, \"Unable to find CPU definition\\n\");", " exit(1);", " if (cpu == NULL) {", " exit(1);", " if (cpu == NULL) {", " exit(1);", " if (cpu == NULL) {", " exit(1);", " exit(1);", " exit(1);", " fprintf(stderr, \"Unable to find CPU definition\\n\");" ], "line_no": [ 31, 33, 31, 33, 31, 33, 31, 33, 31, 33, 31, 33, 33, 29, 33, 29, 33, 29, 33, 33, 33, 29, 31, 33, 29, 31, 33, 29, 31, 33, 29, 31, 33, 31, 33, 29, 33, 29, 33, 33, 29, 33, 29, 31, 33, 29, 31, 33, 29, 33, 29, 33, 29, 33, 33, 33, 31 ] }
static void FUNC_0(MachineState *VAR_0) { const char *VAR_1 = VAR_0->VAR_1; int VAR_2; SuperHCPU *cpu; struct SH7750State *VAR_3; MemoryRegion *sysmem = get_system_memory(); MemoryRegion *rom = g_new(MemoryRegion, 1); MemoryRegion *sdram = g_new(MemoryRegion, 2); if (!VAR_1) VAR_1 = "any"; cpu = SUPERH_CPU(cpu_generic_init(TYPE_SUPERH_CPU, VAR_1)); if (cpu == NULL) { fprintf(stderr, "Unable to find CPU definition\n"); exit(1); } memory_region_init_ram(rom, NULL, "shix.rom", 0x4000, &error_fatal); memory_region_set_readonly(rom, true); memory_region_add_subregion(sysmem, 0x00000000, rom); memory_region_init_ram(&sdram[0], NULL, "shix.sdram1", 0x01000000, &error_fatal); memory_region_add_subregion(sysmem, 0x08000000, &sdram[0]); memory_region_init_ram(&sdram[1], NULL, "shix.sdram2", 0x01000000, &error_fatal); memory_region_add_subregion(sysmem, 0x0c000000, &sdram[1]); if (bios_name == NULL) bios_name = BIOS_FILENAME; VAR_2 = load_image_targphys(bios_name, 0, 0x4000); if (VAR_2 < 0 && !qtest_enabled()) { error_report("Could not load SHIX bios '%VAR_3'", bios_name); exit(1); } VAR_3 = sh7750_init(cpu, sysmem); tc58128_init(VAR_3, "shix_linux_nand.bin", NULL); }
[ "static void FUNC_0(MachineState *VAR_0)\n{", "const char *VAR_1 = VAR_0->VAR_1;", "int VAR_2;", "SuperHCPU *cpu;", "struct SH7750State *VAR_3;", "MemoryRegion *sysmem = get_system_memory();", "MemoryRegion *rom = g_new(MemoryRegion, 1);", "MemoryRegion *sdram = g_new(MemoryRegion, 2);", "if (!VAR_1)\nVAR_1 = \"any\";", "cpu = SUPERH_CPU(cpu_generic_init(TYPE_SUPERH_CPU, VAR_1));", "if (cpu == NULL) {", "fprintf(stderr, \"Unable to find CPU definition\\n\");", "exit(1);", "}", "memory_region_init_ram(rom, NULL, \"shix.rom\", 0x4000, &error_fatal);", "memory_region_set_readonly(rom, true);", "memory_region_add_subregion(sysmem, 0x00000000, rom);", "memory_region_init_ram(&sdram[0], NULL, \"shix.sdram1\", 0x01000000,\n&error_fatal);", "memory_region_add_subregion(sysmem, 0x08000000, &sdram[0]);", "memory_region_init_ram(&sdram[1], NULL, \"shix.sdram2\", 0x01000000,\n&error_fatal);", "memory_region_add_subregion(sysmem, 0x0c000000, &sdram[1]);", "if (bios_name == NULL)\nbios_name = BIOS_FILENAME;", "VAR_2 = load_image_targphys(bios_name, 0, 0x4000);", "if (VAR_2 < 0 && !qtest_enabled()) {", "error_report(\"Could not load SHIX bios '%VAR_3'\", bios_name);", "exit(1);", "}", "VAR_3 = sh7750_init(cpu, sysmem);", "tc58128_init(VAR_3, \"shix_linux_nand.bin\", NULL);", "}" ]
[ 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21, 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 41 ], [ 43 ], [ 45 ], [ 47, 49 ], [ 51 ], [ 53, 55 ], [ 57 ], [ 63, 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 81 ], [ 85 ], [ 87 ] ]
24,122
static inline void gen_addr_imm_index (DisasContext *ctx) { target_long simm = SIMM(ctx->opcode); if (rA(ctx->opcode) == 0) { gen_op_set_T0(simm); } else { gen_op_load_gpr_T0(rA(ctx->opcode)); if (likely(simm != 0)) gen_op_addi(simm); } }
true
qemu
d9bce9d99f4656ae0b0127f7472db9067b8f84ab
static inline void gen_addr_imm_index (DisasContext *ctx) { target_long simm = SIMM(ctx->opcode); if (rA(ctx->opcode) == 0) { gen_op_set_T0(simm); } else { gen_op_load_gpr_T0(rA(ctx->opcode)); if (likely(simm != 0)) gen_op_addi(simm); } }
{ "code": [ " } else {", " } else {", " } else {", " } else {", " } else {", " } else {", " } else {", " } else {", " } else {", " } else {", " gen_op_set_T0(simm);", " gen_op_set_T0(simm);" ], "line_no": [ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 11, 11 ] }
static inline void FUNC_0 (DisasContext *VAR_0) { target_long simm = SIMM(VAR_0->opcode); if (rA(VAR_0->opcode) == 0) { gen_op_set_T0(simm); } else { gen_op_load_gpr_T0(rA(VAR_0->opcode)); if (likely(simm != 0)) gen_op_addi(simm); } }
[ "static inline void FUNC_0 (DisasContext *VAR_0)\n{", "target_long simm = SIMM(VAR_0->opcode);", "if (rA(VAR_0->opcode) == 0) {", "gen_op_set_T0(simm);", "} else {", "gen_op_load_gpr_T0(rA(VAR_0->opcode));", "if (likely(simm != 0))\ngen_op_addi(simm);", "}", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17, 19 ], [ 21 ], [ 23 ] ]
24,124
void qmp_guest_suspend_ram(Error **errp) { Error *local_err = NULL; GuestSuspendMode *mode = g_malloc(sizeof(GuestSuspendMode)); *mode = GUEST_SUSPEND_MODE_RAM; check_suspend_mode(*mode, &local_err); acquire_privilege(SE_SHUTDOWN_NAME, &local_err); execute_async(do_suspend, mode, &local_err); if (local_err) { error_propagate(errp, local_err); g_free(mode); } }
true
qemu
f3a06403b82c7f036564e4caf18b52ce6885fcfb
void qmp_guest_suspend_ram(Error **errp) { Error *local_err = NULL; GuestSuspendMode *mode = g_malloc(sizeof(GuestSuspendMode)); *mode = GUEST_SUSPEND_MODE_RAM; check_suspend_mode(*mode, &local_err); acquire_privilege(SE_SHUTDOWN_NAME, &local_err); execute_async(do_suspend, mode, &local_err); if (local_err) { error_propagate(errp, local_err); g_free(mode); } }
{ "code": [ " GuestSuspendMode *mode = g_malloc(sizeof(GuestSuspendMode));", " GuestSuspendMode *mode = g_malloc(sizeof(GuestSuspendMode));" ], "line_no": [ 7, 7 ] }
void FUNC_0(Error **VAR_0) { Error *local_err = NULL; GuestSuspendMode *mode = g_malloc(sizeof(GuestSuspendMode)); *mode = GUEST_SUSPEND_MODE_RAM; check_suspend_mode(*mode, &local_err); acquire_privilege(SE_SHUTDOWN_NAME, &local_err); execute_async(do_suspend, mode, &local_err); if (local_err) { error_propagate(VAR_0, local_err); g_free(mode); } }
[ "void FUNC_0(Error **VAR_0)\n{", "Error *local_err = NULL;", "GuestSuspendMode *mode = g_malloc(sizeof(GuestSuspendMode));", "*mode = GUEST_SUSPEND_MODE_RAM;", "check_suspend_mode(*mode, &local_err);", "acquire_privilege(SE_SHUTDOWN_NAME, &local_err);", "execute_async(do_suspend, mode, &local_err);", "if (local_err) {", "error_propagate(VAR_0, local_err);", "g_free(mode);", "}", "}" ]
[ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ] ]
24,125
void ff_hevc_cabac_init(HEVCContext *s, int ctb_addr_ts) { if (ctb_addr_ts == s->ps.pps->ctb_addr_rs_to_ts[s->sh.slice_ctb_addr_rs]) { cabac_init_decoder(s); if (s->sh.dependent_slice_segment_flag == 0 || (s->ps.pps->tiles_enabled_flag && s->ps.pps->tile_id[ctb_addr_ts] != s->ps.pps->tile_id[ctb_addr_ts - 1])) cabac_init_state(s); if (!s->sh.first_slice_in_pic_flag && s->ps.pps->entropy_coding_sync_enabled_flag) { if (ctb_addr_ts % s->ps.sps->ctb_width == 0) { if (s->ps.sps->ctb_width == 1) cabac_init_state(s); else if (s->sh.dependent_slice_segment_flag == 1) load_states(s); } } } else { if (s->ps.pps->tiles_enabled_flag && s->ps.pps->tile_id[ctb_addr_ts] != s->ps.pps->tile_id[ctb_addr_ts - 1]) { if (s->threads_number == 1) cabac_reinit(s->HEVClc); else cabac_init_decoder(s); cabac_init_state(s); } if (s->ps.pps->entropy_coding_sync_enabled_flag) { if (ctb_addr_ts % s->ps.sps->ctb_width == 0) { get_cabac_terminate(&s->HEVClc->cc); if (s->threads_number == 1) cabac_reinit(s->HEVClc); else cabac_init_decoder(s); if (s->ps.sps->ctb_width == 1) cabac_init_state(s); else load_states(s); } } } }
true
FFmpeg
933aa91e31d5cbf9dbc0cf416a988e6011bc4a40
void ff_hevc_cabac_init(HEVCContext *s, int ctb_addr_ts) { if (ctb_addr_ts == s->ps.pps->ctb_addr_rs_to_ts[s->sh.slice_ctb_addr_rs]) { cabac_init_decoder(s); if (s->sh.dependent_slice_segment_flag == 0 || (s->ps.pps->tiles_enabled_flag && s->ps.pps->tile_id[ctb_addr_ts] != s->ps.pps->tile_id[ctb_addr_ts - 1])) cabac_init_state(s); if (!s->sh.first_slice_in_pic_flag && s->ps.pps->entropy_coding_sync_enabled_flag) { if (ctb_addr_ts % s->ps.sps->ctb_width == 0) { if (s->ps.sps->ctb_width == 1) cabac_init_state(s); else if (s->sh.dependent_slice_segment_flag == 1) load_states(s); } } } else { if (s->ps.pps->tiles_enabled_flag && s->ps.pps->tile_id[ctb_addr_ts] != s->ps.pps->tile_id[ctb_addr_ts - 1]) { if (s->threads_number == 1) cabac_reinit(s->HEVClc); else cabac_init_decoder(s); cabac_init_state(s); } if (s->ps.pps->entropy_coding_sync_enabled_flag) { if (ctb_addr_ts % s->ps.sps->ctb_width == 0) { get_cabac_terminate(&s->HEVClc->cc); if (s->threads_number == 1) cabac_reinit(s->HEVClc); else cabac_init_decoder(s); if (s->ps.sps->ctb_width == 1) cabac_init_state(s); else load_states(s); } } } }
{ "code": [ "void ff_hevc_cabac_init(HEVCContext *s, int ctb_addr_ts)", " cabac_init_decoder(s);", " cabac_init_decoder(s);", " cabac_init_decoder(s);" ], "line_no": [ 1, 7, 49, 67 ] }
void FUNC_0(HEVCContext *VAR_0, int VAR_1) { if (VAR_1 == VAR_0->ps.pps->ctb_addr_rs_to_ts[VAR_0->sh.slice_ctb_addr_rs]) { cabac_init_decoder(VAR_0); if (VAR_0->sh.dependent_slice_segment_flag == 0 || (VAR_0->ps.pps->tiles_enabled_flag && VAR_0->ps.pps->tile_id[VAR_1] != VAR_0->ps.pps->tile_id[VAR_1 - 1])) cabac_init_state(VAR_0); if (!VAR_0->sh.first_slice_in_pic_flag && VAR_0->ps.pps->entropy_coding_sync_enabled_flag) { if (VAR_1 % VAR_0->ps.sps->ctb_width == 0) { if (VAR_0->ps.sps->ctb_width == 1) cabac_init_state(VAR_0); else if (VAR_0->sh.dependent_slice_segment_flag == 1) load_states(VAR_0); } } } else { if (VAR_0->ps.pps->tiles_enabled_flag && VAR_0->ps.pps->tile_id[VAR_1] != VAR_0->ps.pps->tile_id[VAR_1 - 1]) { if (VAR_0->threads_number == 1) cabac_reinit(VAR_0->HEVClc); else cabac_init_decoder(VAR_0); cabac_init_state(VAR_0); } if (VAR_0->ps.pps->entropy_coding_sync_enabled_flag) { if (VAR_1 % VAR_0->ps.sps->ctb_width == 0) { get_cabac_terminate(&VAR_0->HEVClc->cc); if (VAR_0->threads_number == 1) cabac_reinit(VAR_0->HEVClc); else cabac_init_decoder(VAR_0); if (VAR_0->ps.sps->ctb_width == 1) cabac_init_state(VAR_0); else load_states(VAR_0); } } } }
[ "void FUNC_0(HEVCContext *VAR_0, int VAR_1)\n{", "if (VAR_1 == VAR_0->ps.pps->ctb_addr_rs_to_ts[VAR_0->sh.slice_ctb_addr_rs]) {", "cabac_init_decoder(VAR_0);", "if (VAR_0->sh.dependent_slice_segment_flag == 0 ||\n(VAR_0->ps.pps->tiles_enabled_flag &&\nVAR_0->ps.pps->tile_id[VAR_1] != VAR_0->ps.pps->tile_id[VAR_1 - 1]))\ncabac_init_state(VAR_0);", "if (!VAR_0->sh.first_slice_in_pic_flag &&\nVAR_0->ps.pps->entropy_coding_sync_enabled_flag) {", "if (VAR_1 % VAR_0->ps.sps->ctb_width == 0) {", "if (VAR_0->ps.sps->ctb_width == 1)\ncabac_init_state(VAR_0);", "else if (VAR_0->sh.dependent_slice_segment_flag == 1)\nload_states(VAR_0);", "}", "}", "} else {", "if (VAR_0->ps.pps->tiles_enabled_flag &&\nVAR_0->ps.pps->tile_id[VAR_1] != VAR_0->ps.pps->tile_id[VAR_1 - 1]) {", "if (VAR_0->threads_number == 1)\ncabac_reinit(VAR_0->HEVClc);", "else\ncabac_init_decoder(VAR_0);", "cabac_init_state(VAR_0);", "}", "if (VAR_0->ps.pps->entropy_coding_sync_enabled_flag) {", "if (VAR_1 % VAR_0->ps.sps->ctb_width == 0) {", "get_cabac_terminate(&VAR_0->HEVClc->cc);", "if (VAR_0->threads_number == 1)\ncabac_reinit(VAR_0->HEVClc);", "else\ncabac_init_decoder(VAR_0);", "if (VAR_0->ps.sps->ctb_width == 1)\ncabac_init_state(VAR_0);", "else\nload_states(VAR_0);", "}", "}", "}", "}" ]
[ 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9, 11, 13, 15 ], [ 19, 21 ], [ 23 ], [ 25, 27 ], [ 29, 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39, 41 ], [ 43, 45 ], [ 47, 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61, 63 ], [ 65, 67 ], [ 71, 73 ], [ 75, 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ] ]
24,126
void lance_init(NICInfo *nd, target_phys_addr_t leaddr, void *dma_opaque, qemu_irq irq, qemu_irq *reset) { PCNetState *d; int lance_io_memory; qemu_check_nic_model(nd, "lance"); d = qemu_mallocz(sizeof(PCNetState)); lance_io_memory = cpu_register_io_memory(0, lance_mem_read, lance_mem_write, d); d->dma_opaque = dma_opaque; *reset = *qemu_allocate_irqs(parent_lance_reset, d, 1); cpu_register_physical_memory(leaddr, 4, lance_io_memory); d->irq = irq; d->phys_mem_read = ledma_memory_read; d->phys_mem_write = ledma_memory_write; pcnet_common_init(d, nd); }
true
qemu
b946a1533209f61a93e34898aebb5b43154b99c3
void lance_init(NICInfo *nd, target_phys_addr_t leaddr, void *dma_opaque, qemu_irq irq, qemu_irq *reset) { PCNetState *d; int lance_io_memory; qemu_check_nic_model(nd, "lance"); d = qemu_mallocz(sizeof(PCNetState)); lance_io_memory = cpu_register_io_memory(0, lance_mem_read, lance_mem_write, d); d->dma_opaque = dma_opaque; *reset = *qemu_allocate_irqs(parent_lance_reset, d, 1); cpu_register_physical_memory(leaddr, 4, lance_io_memory); d->irq = irq; d->phys_mem_read = ledma_memory_read; d->phys_mem_write = ledma_memory_write; pcnet_common_init(d, nd); }
{ "code": [ " pcnet_common_init(d, nd);", " int lance_io_memory;", " lance_io_memory =", " *reset = *qemu_allocate_irqs(parent_lance_reset, d, 1);", " cpu_register_physical_memory(leaddr, 4, lance_io_memory);", " pcnet_common_init(d, nd);" ], "line_no": [ 47, 9, 21, 31, 35, 47 ] }
void FUNC_0(NICInfo *VAR_0, target_phys_addr_t VAR_1, void *VAR_2, qemu_irq VAR_3, qemu_irq *VAR_4) { PCNetState *d; int VAR_5; qemu_check_nic_model(VAR_0, "lance"); d = qemu_mallocz(sizeof(PCNetState)); VAR_5 = cpu_register_io_memory(0, lance_mem_read, lance_mem_write, d); d->VAR_2 = VAR_2; *VAR_4 = *qemu_allocate_irqs(parent_lance_reset, d, 1); cpu_register_physical_memory(VAR_1, 4, VAR_5); d->VAR_3 = VAR_3; d->phys_mem_read = ledma_memory_read; d->phys_mem_write = ledma_memory_write; pcnet_common_init(d, VAR_0); }
[ "void FUNC_0(NICInfo *VAR_0, target_phys_addr_t VAR_1, void *VAR_2,\nqemu_irq VAR_3, qemu_irq *VAR_4)\n{", "PCNetState *d;", "int VAR_5;", "qemu_check_nic_model(VAR_0, \"lance\");", "d = qemu_mallocz(sizeof(PCNetState));", "VAR_5 =\ncpu_register_io_memory(0, lance_mem_read, lance_mem_write, d);", "d->VAR_2 = VAR_2;", "*VAR_4 = *qemu_allocate_irqs(parent_lance_reset, d, 1);", "cpu_register_physical_memory(VAR_1, 4, VAR_5);", "d->VAR_3 = VAR_3;", "d->phys_mem_read = ledma_memory_read;", "d->phys_mem_write = ledma_memory_write;", "pcnet_common_init(d, VAR_0);", "}" ]
[ 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17 ], [ 21, 23 ], [ 27 ], [ 31 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ] ]
24,127
static inline TCGv gen_load(DisasContext * s, int opsize, TCGv addr, int sign) { TCGv tmp; int index = IS_USER(s); s->is_mem = 1; tmp = tcg_temp_new_i32(); switch(opsize) { case OS_BYTE: if (sign) tcg_gen_qemu_ld8s(tmp, addr, index); else tcg_gen_qemu_ld8u(tmp, addr, index); break; case OS_WORD: if (sign) tcg_gen_qemu_ld16s(tmp, addr, index); else tcg_gen_qemu_ld16u(tmp, addr, index); break; case OS_LONG: case OS_SINGLE: tcg_gen_qemu_ld32u(tmp, addr, index); break; default: qemu_assert(0, "bad load size"); } gen_throws_exception = gen_last_qop; return tmp; }
true
qemu
7372c2b926200db295412efbb53f93773b7f1754
static inline TCGv gen_load(DisasContext * s, int opsize, TCGv addr, int sign) { TCGv tmp; int index = IS_USER(s); s->is_mem = 1; tmp = tcg_temp_new_i32(); switch(opsize) { case OS_BYTE: if (sign) tcg_gen_qemu_ld8s(tmp, addr, index); else tcg_gen_qemu_ld8u(tmp, addr, index); break; case OS_WORD: if (sign) tcg_gen_qemu_ld16s(tmp, addr, index); else tcg_gen_qemu_ld16u(tmp, addr, index); break; case OS_LONG: case OS_SINGLE: tcg_gen_qemu_ld32u(tmp, addr, index); break; default: qemu_assert(0, "bad load size"); } gen_throws_exception = gen_last_qop; return tmp; }
{ "code": [ " qemu_assert(0, \"bad load size\");", " break;" ], "line_no": [ 49, 25 ] }
static inline TCGv FUNC_0(DisasContext * s, int opsize, TCGv addr, int sign) { TCGv tmp; int VAR_0 = IS_USER(s); s->is_mem = 1; tmp = tcg_temp_new_i32(); switch(opsize) { case OS_BYTE: if (sign) tcg_gen_qemu_ld8s(tmp, addr, VAR_0); else tcg_gen_qemu_ld8u(tmp, addr, VAR_0); break; case OS_WORD: if (sign) tcg_gen_qemu_ld16s(tmp, addr, VAR_0); else tcg_gen_qemu_ld16u(tmp, addr, VAR_0); break; case OS_LONG: case OS_SINGLE: tcg_gen_qemu_ld32u(tmp, addr, VAR_0); break; default: qemu_assert(0, "bad load size"); } gen_throws_exception = gen_last_qop; return tmp; }
[ "static inline TCGv FUNC_0(DisasContext * s, int opsize, TCGv addr, int sign)\n{", "TCGv tmp;", "int VAR_0 = IS_USER(s);", "s->is_mem = 1;", "tmp = tcg_temp_new_i32();", "switch(opsize) {", "case OS_BYTE:\nif (sign)\ntcg_gen_qemu_ld8s(tmp, addr, VAR_0);", "else\ntcg_gen_qemu_ld8u(tmp, addr, VAR_0);", "break;", "case OS_WORD:\nif (sign)\ntcg_gen_qemu_ld16s(tmp, addr, VAR_0);", "else\ntcg_gen_qemu_ld16u(tmp, addr, VAR_0);", "break;", "case OS_LONG:\ncase OS_SINGLE:\ntcg_gen_qemu_ld32u(tmp, addr, VAR_0);", "break;", "default:\nqemu_assert(0, \"bad load size\");", "}", "gen_throws_exception = gen_last_qop;", "return tmp;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15, 17, 19 ], [ 21, 23 ], [ 25 ], [ 27, 29, 31 ], [ 33, 35 ], [ 37 ], [ 39, 41, 43 ], [ 45 ], [ 47, 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ] ]
24,128
int ff_snow_frame_start(SnowContext *s){ AVFrame tmp; int i, ret; int w= s->avctx->width; //FIXME round up to x16 ? int h= s->avctx->height; if (s->current_picture.data[0] && !(s->avctx->flags&CODEC_FLAG_EMU_EDGE)) { s->dsp.draw_edges(s->current_picture.data[0], s->current_picture.linesize[0], w , h , EDGE_WIDTH , EDGE_WIDTH , EDGE_TOP | EDGE_BOTTOM); s->dsp.draw_edges(s->current_picture.data[1], s->current_picture.linesize[1], w>>s->chroma_h_shift, h>>s->chroma_v_shift, EDGE_WIDTH>>s->chroma_h_shift, EDGE_WIDTH>>s->chroma_v_shift, EDGE_TOP | EDGE_BOTTOM); s->dsp.draw_edges(s->current_picture.data[2], s->current_picture.linesize[2], w>>s->chroma_h_shift, h>>s->chroma_v_shift, EDGE_WIDTH>>s->chroma_h_shift, EDGE_WIDTH>>s->chroma_v_shift, EDGE_TOP | EDGE_BOTTOM); } ff_snow_release_buffer(s->avctx); av_frame_move_ref(&tmp, &s->last_picture[s->max_ref_frames-1]); for(i=s->max_ref_frames-1; i>0; i--) av_frame_move_ref(&s->last_picture[i], &s->last_picture[i-1]); memmove(s->halfpel_plane+1, s->halfpel_plane, (s->max_ref_frames-1)*sizeof(void*)*4*4); if(USE_HALFPEL_PLANE && s->current_picture.data[0]) halfpel_interpol(s, s->halfpel_plane[0], &s->current_picture); av_frame_move_ref(&s->last_picture[0], &s->current_picture); av_frame_move_ref(&s->current_picture, &tmp); if(s->keyframe){ s->ref_frames= 0; }else{ int i; for(i=0; i<s->max_ref_frames && s->last_picture[i].data[0]; i++) if(i && s->last_picture[i-1].key_frame) break; s->ref_frames= i; if(s->ref_frames==0){ av_log(s->avctx,AV_LOG_ERROR, "No reference frames\n"); return -1; } } if ((ret = ff_get_buffer(s->avctx, &s->current_picture, AV_GET_BUFFER_FLAG_REF)) < 0) return ret; s->current_picture.key_frame= s->keyframe; return 0; }
true
FFmpeg
f13e733145132e39056027229ff954a798f58410
int ff_snow_frame_start(SnowContext *s){ AVFrame tmp; int i, ret; int w= s->avctx->width; int h= s->avctx->height; if (s->current_picture.data[0] && !(s->avctx->flags&CODEC_FLAG_EMU_EDGE)) { s->dsp.draw_edges(s->current_picture.data[0], s->current_picture.linesize[0], w , h , EDGE_WIDTH , EDGE_WIDTH , EDGE_TOP | EDGE_BOTTOM); s->dsp.draw_edges(s->current_picture.data[1], s->current_picture.linesize[1], w>>s->chroma_h_shift, h>>s->chroma_v_shift, EDGE_WIDTH>>s->chroma_h_shift, EDGE_WIDTH>>s->chroma_v_shift, EDGE_TOP | EDGE_BOTTOM); s->dsp.draw_edges(s->current_picture.data[2], s->current_picture.linesize[2], w>>s->chroma_h_shift, h>>s->chroma_v_shift, EDGE_WIDTH>>s->chroma_h_shift, EDGE_WIDTH>>s->chroma_v_shift, EDGE_TOP | EDGE_BOTTOM); } ff_snow_release_buffer(s->avctx); av_frame_move_ref(&tmp, &s->last_picture[s->max_ref_frames-1]); for(i=s->max_ref_frames-1; i>0; i--) av_frame_move_ref(&s->last_picture[i], &s->last_picture[i-1]); memmove(s->halfpel_plane+1, s->halfpel_plane, (s->max_ref_frames-1)*sizeof(void*)*4*4); if(USE_HALFPEL_PLANE && s->current_picture.data[0]) halfpel_interpol(s, s->halfpel_plane[0], &s->current_picture); av_frame_move_ref(&s->last_picture[0], &s->current_picture); av_frame_move_ref(&s->current_picture, &tmp); if(s->keyframe){ s->ref_frames= 0; }else{ int i; for(i=0; i<s->max_ref_frames && s->last_picture[i].data[0]; i++) if(i && s->last_picture[i-1].key_frame) break; s->ref_frames= i; if(s->ref_frames==0){ av_log(s->avctx,AV_LOG_ERROR, "No reference frames\n"); return -1; } } if ((ret = ff_get_buffer(s->avctx, &s->current_picture, AV_GET_BUFFER_FLAG_REF)) < 0) return ret; s->current_picture.key_frame= s->keyframe; return 0; }
{ "code": [ " if(USE_HALFPEL_PLANE && s->current_picture.data[0])", " halfpel_interpol(s, s->halfpel_plane[0], &s->current_picture);" ], "line_no": [ 49, 51 ] }
int FUNC_0(SnowContext *VAR_0){ AVFrame tmp; int VAR_5, VAR_2; int VAR_3= VAR_0->avctx->width; int VAR_4= VAR_0->avctx->height; if (VAR_0->current_picture.data[0] && !(VAR_0->avctx->flags&CODEC_FLAG_EMU_EDGE)) { VAR_0->dsp.draw_edges(VAR_0->current_picture.data[0], VAR_0->current_picture.linesize[0], VAR_3 , VAR_4 , EDGE_WIDTH , EDGE_WIDTH , EDGE_TOP | EDGE_BOTTOM); VAR_0->dsp.draw_edges(VAR_0->current_picture.data[1], VAR_0->current_picture.linesize[1], VAR_3>>VAR_0->chroma_h_shift, VAR_4>>VAR_0->chroma_v_shift, EDGE_WIDTH>>VAR_0->chroma_h_shift, EDGE_WIDTH>>VAR_0->chroma_v_shift, EDGE_TOP | EDGE_BOTTOM); VAR_0->dsp.draw_edges(VAR_0->current_picture.data[2], VAR_0->current_picture.linesize[2], VAR_3>>VAR_0->chroma_h_shift, VAR_4>>VAR_0->chroma_v_shift, EDGE_WIDTH>>VAR_0->chroma_h_shift, EDGE_WIDTH>>VAR_0->chroma_v_shift, EDGE_TOP | EDGE_BOTTOM); } ff_snow_release_buffer(VAR_0->avctx); av_frame_move_ref(&tmp, &VAR_0->last_picture[VAR_0->max_ref_frames-1]); for(VAR_5=VAR_0->max_ref_frames-1; VAR_5>0; VAR_5--) av_frame_move_ref(&VAR_0->last_picture[VAR_5], &VAR_0->last_picture[VAR_5-1]); memmove(VAR_0->halfpel_plane+1, VAR_0->halfpel_plane, (VAR_0->max_ref_frames-1)*sizeof(void*)*4*4); if(USE_HALFPEL_PLANE && VAR_0->current_picture.data[0]) halfpel_interpol(VAR_0, VAR_0->halfpel_plane[0], &VAR_0->current_picture); av_frame_move_ref(&VAR_0->last_picture[0], &VAR_0->current_picture); av_frame_move_ref(&VAR_0->current_picture, &tmp); if(VAR_0->keyframe){ VAR_0->ref_frames= 0; }else{ int VAR_5; for(VAR_5=0; VAR_5<VAR_0->max_ref_frames && VAR_0->last_picture[VAR_5].data[0]; VAR_5++) if(VAR_5 && VAR_0->last_picture[VAR_5-1].key_frame) break; VAR_0->ref_frames= VAR_5; if(VAR_0->ref_frames==0){ av_log(VAR_0->avctx,AV_LOG_ERROR, "No reference frames\n"); return -1; } } if ((VAR_2 = ff_get_buffer(VAR_0->avctx, &VAR_0->current_picture, AV_GET_BUFFER_FLAG_REF)) < 0) return VAR_2; VAR_0->current_picture.key_frame= VAR_0->keyframe; return 0; }
[ "int FUNC_0(SnowContext *VAR_0){", "AVFrame tmp;", "int VAR_5, VAR_2;", "int VAR_3= VAR_0->avctx->width;", "int VAR_4= VAR_0->avctx->height;", "if (VAR_0->current_picture.data[0] && !(VAR_0->avctx->flags&CODEC_FLAG_EMU_EDGE)) {", "VAR_0->dsp.draw_edges(VAR_0->current_picture.data[0],\nVAR_0->current_picture.linesize[0], VAR_3 , VAR_4 ,\nEDGE_WIDTH , EDGE_WIDTH , EDGE_TOP | EDGE_BOTTOM);", "VAR_0->dsp.draw_edges(VAR_0->current_picture.data[1],\nVAR_0->current_picture.linesize[1], VAR_3>>VAR_0->chroma_h_shift, VAR_4>>VAR_0->chroma_v_shift,\nEDGE_WIDTH>>VAR_0->chroma_h_shift, EDGE_WIDTH>>VAR_0->chroma_v_shift, EDGE_TOP | EDGE_BOTTOM);", "VAR_0->dsp.draw_edges(VAR_0->current_picture.data[2],\nVAR_0->current_picture.linesize[2], VAR_3>>VAR_0->chroma_h_shift, VAR_4>>VAR_0->chroma_v_shift,\nEDGE_WIDTH>>VAR_0->chroma_h_shift, EDGE_WIDTH>>VAR_0->chroma_v_shift, EDGE_TOP | EDGE_BOTTOM);", "}", "ff_snow_release_buffer(VAR_0->avctx);", "av_frame_move_ref(&tmp, &VAR_0->last_picture[VAR_0->max_ref_frames-1]);", "for(VAR_5=VAR_0->max_ref_frames-1; VAR_5>0; VAR_5--)", "av_frame_move_ref(&VAR_0->last_picture[VAR_5], &VAR_0->last_picture[VAR_5-1]);", "memmove(VAR_0->halfpel_plane+1, VAR_0->halfpel_plane, (VAR_0->max_ref_frames-1)*sizeof(void*)*4*4);", "if(USE_HALFPEL_PLANE && VAR_0->current_picture.data[0])\nhalfpel_interpol(VAR_0, VAR_0->halfpel_plane[0], &VAR_0->current_picture);", "av_frame_move_ref(&VAR_0->last_picture[0], &VAR_0->current_picture);", "av_frame_move_ref(&VAR_0->current_picture, &tmp);", "if(VAR_0->keyframe){", "VAR_0->ref_frames= 0;", "}else{", "int VAR_5;", "for(VAR_5=0; VAR_5<VAR_0->max_ref_frames && VAR_0->last_picture[VAR_5].data[0]; VAR_5++)", "if(VAR_5 && VAR_0->last_picture[VAR_5-1].key_frame)\nbreak;", "VAR_0->ref_frames= VAR_5;", "if(VAR_0->ref_frames==0){", "av_log(VAR_0->avctx,AV_LOG_ERROR, \"No reference frames\\n\");", "return -1;", "}", "}", "if ((VAR_2 = ff_get_buffer(VAR_0->avctx, &VAR_0->current_picture, AV_GET_BUFFER_FLAG_REF)) < 0)\nreturn VAR_2;", "VAR_0->current_picture.key_frame= VAR_0->keyframe;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15, 17, 19 ], [ 21, 23, 25 ], [ 27, 29, 31 ], [ 33 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49, 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69, 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 87, 89 ], [ 93 ], [ 97 ], [ 99 ] ]
24,129
static int h264_slice_header_parse(const H264Context *h, H264SliceContext *sl, const H2645NAL *nal) { const SPS *sps; const PPS *pps; int ret; unsigned int slice_type, tmp, i; int field_pic_flag, bottom_field_flag; int first_slice = sl == h->slice_ctx && !h->current_slice; int picture_structure; if (first_slice) av_assert0(!h->setup_finished); sl->first_mb_addr = get_ue_golomb_long(&sl->gb); slice_type = get_ue_golomb_31(&sl->gb); if (slice_type > 9) { av_log(h->avctx, AV_LOG_ERROR, "slice type %d too large at %d\n", slice_type, sl->first_mb_addr); return AVERROR_INVALIDDATA; } if (slice_type > 4) { slice_type -= 5; sl->slice_type_fixed = 1; } else sl->slice_type_fixed = 0; slice_type = ff_h264_golomb_to_pict_type[slice_type]; sl->slice_type = slice_type; sl->slice_type_nos = slice_type & 3; if (nal->type == H264_NAL_IDR_SLICE && sl->slice_type_nos != AV_PICTURE_TYPE_I) { av_log(h->avctx, AV_LOG_ERROR, "A non-intra slice in an IDR NAL unit.\n"); return AVERROR_INVALIDDATA; } sl->pps_id = get_ue_golomb(&sl->gb); if (sl->pps_id >= MAX_PPS_COUNT) { av_log(h->avctx, AV_LOG_ERROR, "pps_id %u out of range\n", sl->pps_id); return AVERROR_INVALIDDATA; } if (!h->ps.pps_list[sl->pps_id]) { av_log(h->avctx, AV_LOG_ERROR, "non-existing PPS %u referenced\n", sl->pps_id); return AVERROR_INVALIDDATA; } pps = (const PPS*)h->ps.pps_list[sl->pps_id]->data; if (!h->ps.sps_list[pps->sps_id]) { av_log(h->avctx, AV_LOG_ERROR, "non-existing SPS %u referenced\n", pps->sps_id); return AVERROR_INVALIDDATA; } sps = (const SPS*)h->ps.sps_list[pps->sps_id]->data; sl->frame_num = get_bits(&sl->gb, sps->log2_max_frame_num); if (!first_slice) { if (h->poc.frame_num != sl->frame_num) { av_log(h->avctx, AV_LOG_ERROR, "Frame num change from %d to %d\n", h->poc.frame_num, sl->frame_num); return AVERROR_INVALIDDATA; } } sl->mb_mbaff = 0; if (sps->frame_mbs_only_flag) { picture_structure = PICT_FRAME; } else { if (!sps->direct_8x8_inference_flag && slice_type == AV_PICTURE_TYPE_B) { av_log(h->avctx, AV_LOG_ERROR, "This stream was generated by a broken encoder, invalid 8x8 inference\n"); return -1; } field_pic_flag = get_bits1(&sl->gb); if (field_pic_flag) { bottom_field_flag = get_bits1(&sl->gb); picture_structure = PICT_TOP_FIELD + bottom_field_flag; } else { picture_structure = PICT_FRAME; } } sl->picture_structure = picture_structure; sl->mb_field_decoding_flag = picture_structure != PICT_FRAME; if (picture_structure == PICT_FRAME) { sl->curr_pic_num = sl->frame_num; sl->max_pic_num = 1 << sps->log2_max_frame_num; } else { sl->curr_pic_num = 2 * sl->frame_num + 1; sl->max_pic_num = 1 << (sps->log2_max_frame_num + 1); } if (nal->type == H264_NAL_IDR_SLICE) get_ue_golomb_long(&sl->gb); /* idr_pic_id */ if (sps->poc_type == 0) { sl->poc_lsb = get_bits(&sl->gb, sps->log2_max_poc_lsb); if (pps->pic_order_present == 1 && picture_structure == PICT_FRAME) sl->delta_poc_bottom = get_se_golomb(&sl->gb); } if (sps->poc_type == 1 && !sps->delta_pic_order_always_zero_flag) { sl->delta_poc[0] = get_se_golomb(&sl->gb); if (pps->pic_order_present == 1 && picture_structure == PICT_FRAME) sl->delta_poc[1] = get_se_golomb(&sl->gb); } sl->redundant_pic_count = 0; if (pps->redundant_pic_cnt_present) sl->redundant_pic_count = get_ue_golomb(&sl->gb); if (sl->slice_type_nos == AV_PICTURE_TYPE_B) sl->direct_spatial_mv_pred = get_bits1(&sl->gb); ret = ff_h264_parse_ref_count(&sl->list_count, sl->ref_count, &sl->gb, pps, sl->slice_type_nos, picture_structure, h->avctx); if (ret < 0) return ret; if (sl->slice_type_nos != AV_PICTURE_TYPE_I) { ret = ff_h264_decode_ref_pic_list_reordering(sl, h->avctx); if (ret < 0) { sl->ref_count[1] = sl->ref_count[0] = 0; return ret; } } sl->pwt.use_weight = 0; for (i = 0; i < 2; i++) { sl->pwt.luma_weight_flag[i] = 0; sl->pwt.chroma_weight_flag[i] = 0; } if ((pps->weighted_pred && sl->slice_type_nos == AV_PICTURE_TYPE_P) || (pps->weighted_bipred_idc == 1 && sl->slice_type_nos == AV_PICTURE_TYPE_B)) { ret = ff_h264_pred_weight_table(&sl->gb, sps, sl->ref_count, sl->slice_type_nos, &sl->pwt, h->avctx); if (ret < 0) return ret; } sl->explicit_ref_marking = 0; if (nal->ref_idc) { ret = ff_h264_decode_ref_pic_marking(sl, &sl->gb, nal, h->avctx); if (ret < 0 && (h->avctx->err_recognition & AV_EF_EXPLODE)) return AVERROR_INVALIDDATA; } if (sl->slice_type_nos != AV_PICTURE_TYPE_I && pps->cabac) { tmp = get_ue_golomb_31(&sl->gb); if (tmp > 2) { av_log(h->avctx, AV_LOG_ERROR, "cabac_init_idc %u overflow\n", tmp); return AVERROR_INVALIDDATA; } sl->cabac_init_idc = tmp; } sl->last_qscale_diff = 0; tmp = pps->init_qp + get_se_golomb(&sl->gb); if (tmp > 51 + 6 * (sps->bit_depth_luma - 8)) { av_log(h->avctx, AV_LOG_ERROR, "QP %u out of range\n", tmp); return AVERROR_INVALIDDATA; } sl->qscale = tmp; sl->chroma_qp[0] = get_chroma_qp(pps, 0, sl->qscale); sl->chroma_qp[1] = get_chroma_qp(pps, 1, sl->qscale); // FIXME qscale / qp ... stuff if (sl->slice_type == AV_PICTURE_TYPE_SP) get_bits1(&sl->gb); /* sp_for_switch_flag */ if (sl->slice_type == AV_PICTURE_TYPE_SP || sl->slice_type == AV_PICTURE_TYPE_SI) get_se_golomb(&sl->gb); /* slice_qs_delta */ sl->deblocking_filter = 1; sl->slice_alpha_c0_offset = 0; sl->slice_beta_offset = 0; if (pps->deblocking_filter_parameters_present) { tmp = get_ue_golomb_31(&sl->gb); if (tmp > 2) { av_log(h->avctx, AV_LOG_ERROR, "deblocking_filter_idc %u out of range\n", tmp); return AVERROR_INVALIDDATA; } sl->deblocking_filter = tmp; if (sl->deblocking_filter < 2) sl->deblocking_filter ^= 1; // 1<->0 if (sl->deblocking_filter) { sl->slice_alpha_c0_offset = get_se_golomb(&sl->gb) * 2; sl->slice_beta_offset = get_se_golomb(&sl->gb) * 2; if (sl->slice_alpha_c0_offset > 12 || sl->slice_alpha_c0_offset < -12 || sl->slice_beta_offset > 12 || sl->slice_beta_offset < -12) { av_log(h->avctx, AV_LOG_ERROR, "deblocking filter parameters %d %d out of range\n", sl->slice_alpha_c0_offset, sl->slice_beta_offset); return AVERROR_INVALIDDATA; } } } return 0; }
true
FFmpeg
09096fb68713089a8f97c8fa24e9d7f3bb9231d5
static int h264_slice_header_parse(const H264Context *h, H264SliceContext *sl, const H2645NAL *nal) { const SPS *sps; const PPS *pps; int ret; unsigned int slice_type, tmp, i; int field_pic_flag, bottom_field_flag; int first_slice = sl == h->slice_ctx && !h->current_slice; int picture_structure; if (first_slice) av_assert0(!h->setup_finished); sl->first_mb_addr = get_ue_golomb_long(&sl->gb); slice_type = get_ue_golomb_31(&sl->gb); if (slice_type > 9) { av_log(h->avctx, AV_LOG_ERROR, "slice type %d too large at %d\n", slice_type, sl->first_mb_addr); return AVERROR_INVALIDDATA; } if (slice_type > 4) { slice_type -= 5; sl->slice_type_fixed = 1; } else sl->slice_type_fixed = 0; slice_type = ff_h264_golomb_to_pict_type[slice_type]; sl->slice_type = slice_type; sl->slice_type_nos = slice_type & 3; if (nal->type == H264_NAL_IDR_SLICE && sl->slice_type_nos != AV_PICTURE_TYPE_I) { av_log(h->avctx, AV_LOG_ERROR, "A non-intra slice in an IDR NAL unit.\n"); return AVERROR_INVALIDDATA; } sl->pps_id = get_ue_golomb(&sl->gb); if (sl->pps_id >= MAX_PPS_COUNT) { av_log(h->avctx, AV_LOG_ERROR, "pps_id %u out of range\n", sl->pps_id); return AVERROR_INVALIDDATA; } if (!h->ps.pps_list[sl->pps_id]) { av_log(h->avctx, AV_LOG_ERROR, "non-existing PPS %u referenced\n", sl->pps_id); return AVERROR_INVALIDDATA; } pps = (const PPS*)h->ps.pps_list[sl->pps_id]->data; if (!h->ps.sps_list[pps->sps_id]) { av_log(h->avctx, AV_LOG_ERROR, "non-existing SPS %u referenced\n", pps->sps_id); return AVERROR_INVALIDDATA; } sps = (const SPS*)h->ps.sps_list[pps->sps_id]->data; sl->frame_num = get_bits(&sl->gb, sps->log2_max_frame_num); if (!first_slice) { if (h->poc.frame_num != sl->frame_num) { av_log(h->avctx, AV_LOG_ERROR, "Frame num change from %d to %d\n", h->poc.frame_num, sl->frame_num); return AVERROR_INVALIDDATA; } } sl->mb_mbaff = 0; if (sps->frame_mbs_only_flag) { picture_structure = PICT_FRAME; } else { if (!sps->direct_8x8_inference_flag && slice_type == AV_PICTURE_TYPE_B) { av_log(h->avctx, AV_LOG_ERROR, "This stream was generated by a broken encoder, invalid 8x8 inference\n"); return -1; } field_pic_flag = get_bits1(&sl->gb); if (field_pic_flag) { bottom_field_flag = get_bits1(&sl->gb); picture_structure = PICT_TOP_FIELD + bottom_field_flag; } else { picture_structure = PICT_FRAME; } } sl->picture_structure = picture_structure; sl->mb_field_decoding_flag = picture_structure != PICT_FRAME; if (picture_structure == PICT_FRAME) { sl->curr_pic_num = sl->frame_num; sl->max_pic_num = 1 << sps->log2_max_frame_num; } else { sl->curr_pic_num = 2 * sl->frame_num + 1; sl->max_pic_num = 1 << (sps->log2_max_frame_num + 1); } if (nal->type == H264_NAL_IDR_SLICE) get_ue_golomb_long(&sl->gb); if (sps->poc_type == 0) { sl->poc_lsb = get_bits(&sl->gb, sps->log2_max_poc_lsb); if (pps->pic_order_present == 1 && picture_structure == PICT_FRAME) sl->delta_poc_bottom = get_se_golomb(&sl->gb); } if (sps->poc_type == 1 && !sps->delta_pic_order_always_zero_flag) { sl->delta_poc[0] = get_se_golomb(&sl->gb); if (pps->pic_order_present == 1 && picture_structure == PICT_FRAME) sl->delta_poc[1] = get_se_golomb(&sl->gb); } sl->redundant_pic_count = 0; if (pps->redundant_pic_cnt_present) sl->redundant_pic_count = get_ue_golomb(&sl->gb); if (sl->slice_type_nos == AV_PICTURE_TYPE_B) sl->direct_spatial_mv_pred = get_bits1(&sl->gb); ret = ff_h264_parse_ref_count(&sl->list_count, sl->ref_count, &sl->gb, pps, sl->slice_type_nos, picture_structure, h->avctx); if (ret < 0) return ret; if (sl->slice_type_nos != AV_PICTURE_TYPE_I) { ret = ff_h264_decode_ref_pic_list_reordering(sl, h->avctx); if (ret < 0) { sl->ref_count[1] = sl->ref_count[0] = 0; return ret; } } sl->pwt.use_weight = 0; for (i = 0; i < 2; i++) { sl->pwt.luma_weight_flag[i] = 0; sl->pwt.chroma_weight_flag[i] = 0; } if ((pps->weighted_pred && sl->slice_type_nos == AV_PICTURE_TYPE_P) || (pps->weighted_bipred_idc == 1 && sl->slice_type_nos == AV_PICTURE_TYPE_B)) { ret = ff_h264_pred_weight_table(&sl->gb, sps, sl->ref_count, sl->slice_type_nos, &sl->pwt, h->avctx); if (ret < 0) return ret; } sl->explicit_ref_marking = 0; if (nal->ref_idc) { ret = ff_h264_decode_ref_pic_marking(sl, &sl->gb, nal, h->avctx); if (ret < 0 && (h->avctx->err_recognition & AV_EF_EXPLODE)) return AVERROR_INVALIDDATA; } if (sl->slice_type_nos != AV_PICTURE_TYPE_I && pps->cabac) { tmp = get_ue_golomb_31(&sl->gb); if (tmp > 2) { av_log(h->avctx, AV_LOG_ERROR, "cabac_init_idc %u overflow\n", tmp); return AVERROR_INVALIDDATA; } sl->cabac_init_idc = tmp; } sl->last_qscale_diff = 0; tmp = pps->init_qp + get_se_golomb(&sl->gb); if (tmp > 51 + 6 * (sps->bit_depth_luma - 8)) { av_log(h->avctx, AV_LOG_ERROR, "QP %u out of range\n", tmp); return AVERROR_INVALIDDATA; } sl->qscale = tmp; sl->chroma_qp[0] = get_chroma_qp(pps, 0, sl->qscale); sl->chroma_qp[1] = get_chroma_qp(pps, 1, sl->qscale); if (sl->slice_type == AV_PICTURE_TYPE_SP) get_bits1(&sl->gb); if (sl->slice_type == AV_PICTURE_TYPE_SP || sl->slice_type == AV_PICTURE_TYPE_SI) get_se_golomb(&sl->gb); sl->deblocking_filter = 1; sl->slice_alpha_c0_offset = 0; sl->slice_beta_offset = 0; if (pps->deblocking_filter_parameters_present) { tmp = get_ue_golomb_31(&sl->gb); if (tmp > 2) { av_log(h->avctx, AV_LOG_ERROR, "deblocking_filter_idc %u out of range\n", tmp); return AVERROR_INVALIDDATA; } sl->deblocking_filter = tmp; if (sl->deblocking_filter < 2) sl->deblocking_filter ^= 1; if (sl->deblocking_filter) { sl->slice_alpha_c0_offset = get_se_golomb(&sl->gb) * 2; sl->slice_beta_offset = get_se_golomb(&sl->gb) * 2; if (sl->slice_alpha_c0_offset > 12 || sl->slice_alpha_c0_offset < -12 || sl->slice_beta_offset > 12 || sl->slice_beta_offset < -12) { av_log(h->avctx, AV_LOG_ERROR, "deblocking filter parameters %d %d out of range\n", sl->slice_alpha_c0_offset, sl->slice_beta_offset); return AVERROR_INVALIDDATA; } } } return 0; }
{ "code": [ " sl->slice_type_nos, &sl->pwt, h->avctx);" ], "line_no": [ 287 ] }
static int FUNC_0(const H264Context *VAR_0, H264SliceContext *VAR_1, const H2645NAL *VAR_2) { const SPS *VAR_3; const PPS *VAR_4; int VAR_5; unsigned int VAR_6, VAR_7, VAR_8; int VAR_9, VAR_10; int VAR_11 = VAR_1 == VAR_0->slice_ctx && !VAR_0->current_slice; int VAR_12; if (VAR_11) av_assert0(!VAR_0->setup_finished); VAR_1->first_mb_addr = get_ue_golomb_long(&VAR_1->gb); VAR_6 = get_ue_golomb_31(&VAR_1->gb); if (VAR_6 > 9) { av_log(VAR_0->avctx, AV_LOG_ERROR, "slice type %d too large at %d\n", VAR_6, VAR_1->first_mb_addr); return AVERROR_INVALIDDATA; } if (VAR_6 > 4) { VAR_6 -= 5; VAR_1->slice_type_fixed = 1; } else VAR_1->slice_type_fixed = 0; VAR_6 = ff_h264_golomb_to_pict_type[VAR_6]; VAR_1->VAR_6 = VAR_6; VAR_1->slice_type_nos = VAR_6 & 3; if (VAR_2->type == H264_NAL_IDR_SLICE && VAR_1->slice_type_nos != AV_PICTURE_TYPE_I) { av_log(VAR_0->avctx, AV_LOG_ERROR, "A non-intra slice in an IDR NAL unit.\n"); return AVERROR_INVALIDDATA; } VAR_1->pps_id = get_ue_golomb(&VAR_1->gb); if (VAR_1->pps_id >= MAX_PPS_COUNT) { av_log(VAR_0->avctx, AV_LOG_ERROR, "pps_id %u out of range\n", VAR_1->pps_id); return AVERROR_INVALIDDATA; } if (!VAR_0->ps.pps_list[VAR_1->pps_id]) { av_log(VAR_0->avctx, AV_LOG_ERROR, "non-existing PPS %u referenced\n", VAR_1->pps_id); return AVERROR_INVALIDDATA; } VAR_4 = (const PPS*)VAR_0->ps.pps_list[VAR_1->pps_id]->data; if (!VAR_0->ps.sps_list[VAR_4->sps_id]) { av_log(VAR_0->avctx, AV_LOG_ERROR, "non-existing SPS %u referenced\n", VAR_4->sps_id); return AVERROR_INVALIDDATA; } VAR_3 = (const SPS*)VAR_0->ps.sps_list[VAR_4->sps_id]->data; VAR_1->frame_num = get_bits(&VAR_1->gb, VAR_3->log2_max_frame_num); if (!VAR_11) { if (VAR_0->poc.frame_num != VAR_1->frame_num) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Frame num change from %d to %d\n", VAR_0->poc.frame_num, VAR_1->frame_num); return AVERROR_INVALIDDATA; } } VAR_1->mb_mbaff = 0; if (VAR_3->frame_mbs_only_flag) { VAR_12 = PICT_FRAME; } else { if (!VAR_3->direct_8x8_inference_flag && VAR_6 == AV_PICTURE_TYPE_B) { av_log(VAR_0->avctx, AV_LOG_ERROR, "This stream was generated by a broken encoder, invalid 8x8 inference\n"); return -1; } VAR_9 = get_bits1(&VAR_1->gb); if (VAR_9) { VAR_10 = get_bits1(&VAR_1->gb); VAR_12 = PICT_TOP_FIELD + VAR_10; } else { VAR_12 = PICT_FRAME; } } VAR_1->VAR_12 = VAR_12; VAR_1->mb_field_decoding_flag = VAR_12 != PICT_FRAME; if (VAR_12 == PICT_FRAME) { VAR_1->curr_pic_num = VAR_1->frame_num; VAR_1->max_pic_num = 1 << VAR_3->log2_max_frame_num; } else { VAR_1->curr_pic_num = 2 * VAR_1->frame_num + 1; VAR_1->max_pic_num = 1 << (VAR_3->log2_max_frame_num + 1); } if (VAR_2->type == H264_NAL_IDR_SLICE) get_ue_golomb_long(&VAR_1->gb); if (VAR_3->poc_type == 0) { VAR_1->poc_lsb = get_bits(&VAR_1->gb, VAR_3->log2_max_poc_lsb); if (VAR_4->pic_order_present == 1 && VAR_12 == PICT_FRAME) VAR_1->delta_poc_bottom = get_se_golomb(&VAR_1->gb); } if (VAR_3->poc_type == 1 && !VAR_3->delta_pic_order_always_zero_flag) { VAR_1->delta_poc[0] = get_se_golomb(&VAR_1->gb); if (VAR_4->pic_order_present == 1 && VAR_12 == PICT_FRAME) VAR_1->delta_poc[1] = get_se_golomb(&VAR_1->gb); } VAR_1->redundant_pic_count = 0; if (VAR_4->redundant_pic_cnt_present) VAR_1->redundant_pic_count = get_ue_golomb(&VAR_1->gb); if (VAR_1->slice_type_nos == AV_PICTURE_TYPE_B) VAR_1->direct_spatial_mv_pred = get_bits1(&VAR_1->gb); VAR_5 = ff_h264_parse_ref_count(&VAR_1->list_count, VAR_1->ref_count, &VAR_1->gb, VAR_4, VAR_1->slice_type_nos, VAR_12, VAR_0->avctx); if (VAR_5 < 0) return VAR_5; if (VAR_1->slice_type_nos != AV_PICTURE_TYPE_I) { VAR_5 = ff_h264_decode_ref_pic_list_reordering(VAR_1, VAR_0->avctx); if (VAR_5 < 0) { VAR_1->ref_count[1] = VAR_1->ref_count[0] = 0; return VAR_5; } } VAR_1->pwt.use_weight = 0; for (VAR_8 = 0; VAR_8 < 2; VAR_8++) { VAR_1->pwt.luma_weight_flag[VAR_8] = 0; VAR_1->pwt.chroma_weight_flag[VAR_8] = 0; } if ((VAR_4->weighted_pred && VAR_1->slice_type_nos == AV_PICTURE_TYPE_P) || (VAR_4->weighted_bipred_idc == 1 && VAR_1->slice_type_nos == AV_PICTURE_TYPE_B)) { VAR_5 = ff_h264_pred_weight_table(&VAR_1->gb, VAR_3, VAR_1->ref_count, VAR_1->slice_type_nos, &VAR_1->pwt, VAR_0->avctx); if (VAR_5 < 0) return VAR_5; } VAR_1->explicit_ref_marking = 0; if (VAR_2->ref_idc) { VAR_5 = ff_h264_decode_ref_pic_marking(VAR_1, &VAR_1->gb, VAR_2, VAR_0->avctx); if (VAR_5 < 0 && (VAR_0->avctx->err_recognition & AV_EF_EXPLODE)) return AVERROR_INVALIDDATA; } if (VAR_1->slice_type_nos != AV_PICTURE_TYPE_I && VAR_4->cabac) { VAR_7 = get_ue_golomb_31(&VAR_1->gb); if (VAR_7 > 2) { av_log(VAR_0->avctx, AV_LOG_ERROR, "cabac_init_idc %u overflow\n", VAR_7); return AVERROR_INVALIDDATA; } VAR_1->cabac_init_idc = VAR_7; } VAR_1->last_qscale_diff = 0; VAR_7 = VAR_4->init_qp + get_se_golomb(&VAR_1->gb); if (VAR_7 > 51 + 6 * (VAR_3->bit_depth_luma - 8)) { av_log(VAR_0->avctx, AV_LOG_ERROR, "QP %u out of range\n", VAR_7); return AVERROR_INVALIDDATA; } VAR_1->qscale = VAR_7; VAR_1->chroma_qp[0] = get_chroma_qp(VAR_4, 0, VAR_1->qscale); VAR_1->chroma_qp[1] = get_chroma_qp(VAR_4, 1, VAR_1->qscale); if (VAR_1->VAR_6 == AV_PICTURE_TYPE_SP) get_bits1(&VAR_1->gb); if (VAR_1->VAR_6 == AV_PICTURE_TYPE_SP || VAR_1->VAR_6 == AV_PICTURE_TYPE_SI) get_se_golomb(&VAR_1->gb); VAR_1->deblocking_filter = 1; VAR_1->slice_alpha_c0_offset = 0; VAR_1->slice_beta_offset = 0; if (VAR_4->deblocking_filter_parameters_present) { VAR_7 = get_ue_golomb_31(&VAR_1->gb); if (VAR_7 > 2) { av_log(VAR_0->avctx, AV_LOG_ERROR, "deblocking_filter_idc %u out of range\n", VAR_7); return AVERROR_INVALIDDATA; } VAR_1->deblocking_filter = VAR_7; if (VAR_1->deblocking_filter < 2) VAR_1->deblocking_filter ^= 1; if (VAR_1->deblocking_filter) { VAR_1->slice_alpha_c0_offset = get_se_golomb(&VAR_1->gb) * 2; VAR_1->slice_beta_offset = get_se_golomb(&VAR_1->gb) * 2; if (VAR_1->slice_alpha_c0_offset > 12 || VAR_1->slice_alpha_c0_offset < -12 || VAR_1->slice_beta_offset > 12 || VAR_1->slice_beta_offset < -12) { av_log(VAR_0->avctx, AV_LOG_ERROR, "deblocking filter parameters %d %d out of range\n", VAR_1->slice_alpha_c0_offset, VAR_1->slice_beta_offset); return AVERROR_INVALIDDATA; } } } return 0; }
[ "static int FUNC_0(const H264Context *VAR_0, H264SliceContext *VAR_1,\nconst H2645NAL *VAR_2)\n{", "const SPS *VAR_3;", "const PPS *VAR_4;", "int VAR_5;", "unsigned int VAR_6, VAR_7, VAR_8;", "int VAR_9, VAR_10;", "int VAR_11 = VAR_1 == VAR_0->slice_ctx && !VAR_0->current_slice;", "int VAR_12;", "if (VAR_11)\nav_assert0(!VAR_0->setup_finished);", "VAR_1->first_mb_addr = get_ue_golomb_long(&VAR_1->gb);", "VAR_6 = get_ue_golomb_31(&VAR_1->gb);", "if (VAR_6 > 9) {", "av_log(VAR_0->avctx, AV_LOG_ERROR,\n\"slice type %d too large at %d\\n\",\nVAR_6, VAR_1->first_mb_addr);", "return AVERROR_INVALIDDATA;", "}", "if (VAR_6 > 4) {", "VAR_6 -= 5;", "VAR_1->slice_type_fixed = 1;", "} else", "VAR_1->slice_type_fixed = 0;", "VAR_6 = ff_h264_golomb_to_pict_type[VAR_6];", "VAR_1->VAR_6 = VAR_6;", "VAR_1->slice_type_nos = VAR_6 & 3;", "if (VAR_2->type == H264_NAL_IDR_SLICE &&\nVAR_1->slice_type_nos != AV_PICTURE_TYPE_I) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"A non-intra slice in an IDR NAL unit.\\n\");", "return AVERROR_INVALIDDATA;", "}", "VAR_1->pps_id = get_ue_golomb(&VAR_1->gb);", "if (VAR_1->pps_id >= MAX_PPS_COUNT) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"pps_id %u out of range\\n\", VAR_1->pps_id);", "return AVERROR_INVALIDDATA;", "}", "if (!VAR_0->ps.pps_list[VAR_1->pps_id]) {", "av_log(VAR_0->avctx, AV_LOG_ERROR,\n\"non-existing PPS %u referenced\\n\",\nVAR_1->pps_id);", "return AVERROR_INVALIDDATA;", "}", "VAR_4 = (const PPS*)VAR_0->ps.pps_list[VAR_1->pps_id]->data;", "if (!VAR_0->ps.sps_list[VAR_4->sps_id]) {", "av_log(VAR_0->avctx, AV_LOG_ERROR,\n\"non-existing SPS %u referenced\\n\", VAR_4->sps_id);", "return AVERROR_INVALIDDATA;", "}", "VAR_3 = (const SPS*)VAR_0->ps.sps_list[VAR_4->sps_id]->data;", "VAR_1->frame_num = get_bits(&VAR_1->gb, VAR_3->log2_max_frame_num);", "if (!VAR_11) {", "if (VAR_0->poc.frame_num != VAR_1->frame_num) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Frame num change from %d to %d\\n\",\nVAR_0->poc.frame_num, VAR_1->frame_num);", "return AVERROR_INVALIDDATA;", "}", "}", "VAR_1->mb_mbaff = 0;", "if (VAR_3->frame_mbs_only_flag) {", "VAR_12 = PICT_FRAME;", "} else {", "if (!VAR_3->direct_8x8_inference_flag && VAR_6 == AV_PICTURE_TYPE_B) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"This stream was generated by a broken encoder, invalid 8x8 inference\\n\");", "return -1;", "}", "VAR_9 = get_bits1(&VAR_1->gb);", "if (VAR_9) {", "VAR_10 = get_bits1(&VAR_1->gb);", "VAR_12 = PICT_TOP_FIELD + VAR_10;", "} else {", "VAR_12 = PICT_FRAME;", "}", "}", "VAR_1->VAR_12 = VAR_12;", "VAR_1->mb_field_decoding_flag = VAR_12 != PICT_FRAME;", "if (VAR_12 == PICT_FRAME) {", "VAR_1->curr_pic_num = VAR_1->frame_num;", "VAR_1->max_pic_num = 1 << VAR_3->log2_max_frame_num;", "} else {", "VAR_1->curr_pic_num = 2 * VAR_1->frame_num + 1;", "VAR_1->max_pic_num = 1 << (VAR_3->log2_max_frame_num + 1);", "}", "if (VAR_2->type == H264_NAL_IDR_SLICE)\nget_ue_golomb_long(&VAR_1->gb);", "if (VAR_3->poc_type == 0) {", "VAR_1->poc_lsb = get_bits(&VAR_1->gb, VAR_3->log2_max_poc_lsb);", "if (VAR_4->pic_order_present == 1 && VAR_12 == PICT_FRAME)\nVAR_1->delta_poc_bottom = get_se_golomb(&VAR_1->gb);", "}", "if (VAR_3->poc_type == 1 && !VAR_3->delta_pic_order_always_zero_flag) {", "VAR_1->delta_poc[0] = get_se_golomb(&VAR_1->gb);", "if (VAR_4->pic_order_present == 1 && VAR_12 == PICT_FRAME)\nVAR_1->delta_poc[1] = get_se_golomb(&VAR_1->gb);", "}", "VAR_1->redundant_pic_count = 0;", "if (VAR_4->redundant_pic_cnt_present)\nVAR_1->redundant_pic_count = get_ue_golomb(&VAR_1->gb);", "if (VAR_1->slice_type_nos == AV_PICTURE_TYPE_B)\nVAR_1->direct_spatial_mv_pred = get_bits1(&VAR_1->gb);", "VAR_5 = ff_h264_parse_ref_count(&VAR_1->list_count, VAR_1->ref_count,\n&VAR_1->gb, VAR_4, VAR_1->slice_type_nos,\nVAR_12, VAR_0->avctx);", "if (VAR_5 < 0)\nreturn VAR_5;", "if (VAR_1->slice_type_nos != AV_PICTURE_TYPE_I) {", "VAR_5 = ff_h264_decode_ref_pic_list_reordering(VAR_1, VAR_0->avctx);", "if (VAR_5 < 0) {", "VAR_1->ref_count[1] = VAR_1->ref_count[0] = 0;", "return VAR_5;", "}", "}", "VAR_1->pwt.use_weight = 0;", "for (VAR_8 = 0; VAR_8 < 2; VAR_8++) {", "VAR_1->pwt.luma_weight_flag[VAR_8] = 0;", "VAR_1->pwt.chroma_weight_flag[VAR_8] = 0;", "}", "if ((VAR_4->weighted_pred && VAR_1->slice_type_nos == AV_PICTURE_TYPE_P) ||\n(VAR_4->weighted_bipred_idc == 1 &&\nVAR_1->slice_type_nos == AV_PICTURE_TYPE_B)) {", "VAR_5 = ff_h264_pred_weight_table(&VAR_1->gb, VAR_3, VAR_1->ref_count,\nVAR_1->slice_type_nos, &VAR_1->pwt, VAR_0->avctx);", "if (VAR_5 < 0)\nreturn VAR_5;", "}", "VAR_1->explicit_ref_marking = 0;", "if (VAR_2->ref_idc) {", "VAR_5 = ff_h264_decode_ref_pic_marking(VAR_1, &VAR_1->gb, VAR_2, VAR_0->avctx);", "if (VAR_5 < 0 && (VAR_0->avctx->err_recognition & AV_EF_EXPLODE))\nreturn AVERROR_INVALIDDATA;", "}", "if (VAR_1->slice_type_nos != AV_PICTURE_TYPE_I && VAR_4->cabac) {", "VAR_7 = get_ue_golomb_31(&VAR_1->gb);", "if (VAR_7 > 2) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"cabac_init_idc %u overflow\\n\", VAR_7);", "return AVERROR_INVALIDDATA;", "}", "VAR_1->cabac_init_idc = VAR_7;", "}", "VAR_1->last_qscale_diff = 0;", "VAR_7 = VAR_4->init_qp + get_se_golomb(&VAR_1->gb);", "if (VAR_7 > 51 + 6 * (VAR_3->bit_depth_luma - 8)) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"QP %u out of range\\n\", VAR_7);", "return AVERROR_INVALIDDATA;", "}", "VAR_1->qscale = VAR_7;", "VAR_1->chroma_qp[0] = get_chroma_qp(VAR_4, 0, VAR_1->qscale);", "VAR_1->chroma_qp[1] = get_chroma_qp(VAR_4, 1, VAR_1->qscale);", "if (VAR_1->VAR_6 == AV_PICTURE_TYPE_SP)\nget_bits1(&VAR_1->gb);", "if (VAR_1->VAR_6 == AV_PICTURE_TYPE_SP ||\nVAR_1->VAR_6 == AV_PICTURE_TYPE_SI)\nget_se_golomb(&VAR_1->gb);", "VAR_1->deblocking_filter = 1;", "VAR_1->slice_alpha_c0_offset = 0;", "VAR_1->slice_beta_offset = 0;", "if (VAR_4->deblocking_filter_parameters_present) {", "VAR_7 = get_ue_golomb_31(&VAR_1->gb);", "if (VAR_7 > 2) {", "av_log(VAR_0->avctx, AV_LOG_ERROR,\n\"deblocking_filter_idc %u out of range\\n\", VAR_7);", "return AVERROR_INVALIDDATA;", "}", "VAR_1->deblocking_filter = VAR_7;", "if (VAR_1->deblocking_filter < 2)\nVAR_1->deblocking_filter ^= 1;", "if (VAR_1->deblocking_filter) {", "VAR_1->slice_alpha_c0_offset = get_se_golomb(&VAR_1->gb) * 2;", "VAR_1->slice_beta_offset = get_se_golomb(&VAR_1->gb) * 2;", "if (VAR_1->slice_alpha_c0_offset > 12 ||\nVAR_1->slice_alpha_c0_offset < -12 ||\nVAR_1->slice_beta_offset > 12 ||\nVAR_1->slice_beta_offset < -12) {", "av_log(VAR_0->avctx, AV_LOG_ERROR,\n\"deblocking filter parameters %d %d out of range\\n\",\nVAR_1->slice_alpha_c0_offset, VAR_1->slice_beta_offset);", "return AVERROR_INVALIDDATA;", "}", "}", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23, 25 ], [ 29 ], [ 33 ], [ 35 ], [ 37, 39, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 67, 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91, 93, 95 ], [ 97 ], [ 99 ], [ 101 ], [ 105 ], [ 107, 109 ], [ 111 ], [ 113 ], [ 115 ], [ 119 ], [ 121 ], [ 123 ], [ 125, 127 ], [ 129 ], [ 131 ], [ 133 ], [ 137 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 193, 195 ], [ 199 ], [ 201 ], [ 205, 207 ], [ 209 ], [ 213 ], [ 215 ], [ 219, 221 ], [ 223 ], [ 227 ], [ 229, 231 ], [ 235, 237 ], [ 241, 243, 245 ], [ 247, 249 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277 ], [ 279, 281, 283 ], [ 285, 287 ], [ 289, 291 ], [ 293 ], [ 297 ], [ 299 ], [ 301 ], [ 303, 305 ], [ 307 ], [ 311 ], [ 313 ], [ 315 ], [ 317 ], [ 319 ], [ 321 ], [ 323 ], [ 325 ], [ 329 ], [ 331 ], [ 333 ], [ 335 ], [ 337 ], [ 339 ], [ 341 ], [ 343 ], [ 345 ], [ 349, 351 ], [ 353, 355, 357 ], [ 361 ], [ 363 ], [ 365 ], [ 367 ], [ 369 ], [ 371 ], [ 373, 375 ], [ 377 ], [ 379 ], [ 381 ], [ 383, 385 ], [ 389 ], [ 391 ], [ 393 ], [ 395, 397, 399, 401 ], [ 403, 405, 407 ], [ 409 ], [ 411 ], [ 413 ], [ 415 ], [ 419 ], [ 421 ] ]
24,130
static inline 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) { x86_reg uv_off = c->uv_off << 1; //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, %6) "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), "m"(uv_off) ); }
true
FFmpeg
009f829dde811af654af7110326aea3a72c05d5e
static inline 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) { x86_reg uv_off = c->uv_off << 1; __asm__ volatile( "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" "mov %4, %%"REG_b" \n\t" "push %%"REG_BP" \n\t" YSCALEYUV2RGB(%%REGBP, %5, %6) "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), "m"(uv_off) ); }
{ "code": [ " x86_reg uv_off = c->uv_off << 1;", " x86_reg uv_off = c->uv_off << 1;", " YSCALEYUV2RGB(%%REGBP, %5, %6)", " \"a\" (&c->redDither), \"m\"(uv_off)", " x86_reg uv_off = c->uv_off << 1;", " YSCALEYUV2RGB(%%REGBP, %5, %6)", " \"a\" (&c->redDither), \"m\"(uv_off)", " x86_reg uv_off = c->uv_off << 1;", " YSCALEYUV2RGB(%%REGBP, %5, %6)", " \"a\" (&c->redDither), \"m\"(uv_off)", " x86_reg uv_off = c->uv_off << 1;", " \"a\" (&c->redDither), \"m\"(uv_off)", " x86_reg uv_off = c->uv_off << 1;", " x86_reg uv_off = c->uv_off << 1;", " x86_reg uv_off = c->uv_off << 1;", " x86_reg uv_off = c->uv_off << 1;", " x86_reg uv_off = c->uv_off << 1;" ], "line_no": [ 15, 15, 29, 53, 15, 29, 53, 15, 29, 53, 15, 53, 15, 15, 15, 15, 15 ] }
static inline 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) { x86_reg uv_off = c->uv_off << 1; __asm__ volatile( "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" "mov %4, %%"REG_b" \n\t" "push %%"REG_BP" \n\t" YSCALEYUV2RGB(%%REGBP, %5, %6) "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), "m"(uv_off) ); }
[ "static inline 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{", "x86_reg uv_off = c->uv_off << 1;", "__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, %6)\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), \"m\"(uv_off)\n);", "}" ]
[ 0, 1, 1, 0 ]
[ [ 1, 3, 5, 7, 9, 11, 13 ], [ 15 ], [ 21, 23, 25, 27, 29, 31, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55 ], [ 57 ] ]
24,131
static int virtio_scsi_parse_req(VirtIOSCSIReq *req, unsigned req_size, unsigned resp_size) { VirtIODevice *vdev = (VirtIODevice *) req->dev; size_t in_size, out_size; if (iov_to_buf(req->elem.out_sg, req->elem.out_num, 0, &req->req, req_size) < req_size) { return -EINVAL; } if (qemu_iovec_concat_iov(&req->resp_iov, req->elem.in_sg, req->elem.in_num, 0, resp_size) < resp_size) { return -EINVAL; } req->resp_size = resp_size; /* Old BIOSes left some padding by mistake after the req_size/resp_size. * As a workaround, always consider the first buffer as the virtio-scsi * request/response, making the payload start at the second element * of the iovec. * * The actual length of the response header, stored in req->resp_size, * does not change. * * TODO: always disable this workaround for virtio 1.0 devices. */ if (!virtio_has_feature(vdev, VIRTIO_F_ANY_LAYOUT)) { req_size = req->elem.out_sg[0].iov_len; resp_size = req->elem.in_sg[0].iov_len; } out_size = qemu_sgl_concat(req, req->elem.out_sg, &req->elem.out_addr[0], req->elem.out_num, req_size); in_size = qemu_sgl_concat(req, req->elem.in_sg, &req->elem.in_addr[0], req->elem.in_num, resp_size); if (out_size && in_size) { return -ENOTSUP; } if (out_size) { req->mode = SCSI_XFER_TO_DEV; } else if (in_size) { req->mode = SCSI_XFER_FROM_DEV; } return 0; }
true
qemu
2034e324dabc55064553aaa07de1536ebf8ea497
static int virtio_scsi_parse_req(VirtIOSCSIReq *req, unsigned req_size, unsigned resp_size) { VirtIODevice *vdev = (VirtIODevice *) req->dev; size_t in_size, out_size; if (iov_to_buf(req->elem.out_sg, req->elem.out_num, 0, &req->req, req_size) < req_size) { return -EINVAL; } if (qemu_iovec_concat_iov(&req->resp_iov, req->elem.in_sg, req->elem.in_num, 0, resp_size) < resp_size) { return -EINVAL; } req->resp_size = resp_size; if (!virtio_has_feature(vdev, VIRTIO_F_ANY_LAYOUT)) { req_size = req->elem.out_sg[0].iov_len; resp_size = req->elem.in_sg[0].iov_len; } out_size = qemu_sgl_concat(req, req->elem.out_sg, &req->elem.out_addr[0], req->elem.out_num, req_size); in_size = qemu_sgl_concat(req, req->elem.in_sg, &req->elem.in_addr[0], req->elem.in_num, resp_size); if (out_size && in_size) { return -ENOTSUP; } if (out_size) { req->mode = SCSI_XFER_TO_DEV; } else if (in_size) { req->mode = SCSI_XFER_FROM_DEV; } return 0; }
{ "code": [ " req_size = req->elem.out_sg[0].iov_len;", " resp_size = req->elem.in_sg[0].iov_len;" ], "line_no": [ 61, 63 ] }
static int FUNC_0(VirtIOSCSIReq *VAR_0, unsigned VAR_1, unsigned VAR_2) { VirtIODevice *vdev = (VirtIODevice *) VAR_0->dev; size_t in_size, out_size; if (iov_to_buf(VAR_0->elem.out_sg, VAR_0->elem.out_num, 0, &VAR_0->VAR_0, VAR_1) < VAR_1) { return -EINVAL; } if (qemu_iovec_concat_iov(&VAR_0->resp_iov, VAR_0->elem.in_sg, VAR_0->elem.in_num, 0, VAR_2) < VAR_2) { return -EINVAL; } VAR_0->VAR_2 = VAR_2; if (!virtio_has_feature(vdev, VIRTIO_F_ANY_LAYOUT)) { VAR_1 = VAR_0->elem.out_sg[0].iov_len; VAR_2 = VAR_0->elem.in_sg[0].iov_len; } out_size = qemu_sgl_concat(VAR_0, VAR_0->elem.out_sg, &VAR_0->elem.out_addr[0], VAR_0->elem.out_num, VAR_1); in_size = qemu_sgl_concat(VAR_0, VAR_0->elem.in_sg, &VAR_0->elem.in_addr[0], VAR_0->elem.in_num, VAR_2); if (out_size && in_size) { return -ENOTSUP; } if (out_size) { VAR_0->mode = SCSI_XFER_TO_DEV; } else if (in_size) { VAR_0->mode = SCSI_XFER_FROM_DEV; } return 0; }
[ "static int FUNC_0(VirtIOSCSIReq *VAR_0,\nunsigned VAR_1, unsigned VAR_2)\n{", "VirtIODevice *vdev = (VirtIODevice *) VAR_0->dev;", "size_t in_size, out_size;", "if (iov_to_buf(VAR_0->elem.out_sg, VAR_0->elem.out_num, 0,\n&VAR_0->VAR_0, VAR_1) < VAR_1) {", "return -EINVAL;", "}", "if (qemu_iovec_concat_iov(&VAR_0->resp_iov,\nVAR_0->elem.in_sg, VAR_0->elem.in_num, 0,\nVAR_2) < VAR_2) {", "return -EINVAL;", "}", "VAR_0->VAR_2 = VAR_2;", "if (!virtio_has_feature(vdev, VIRTIO_F_ANY_LAYOUT)) {", "VAR_1 = VAR_0->elem.out_sg[0].iov_len;", "VAR_2 = VAR_0->elem.in_sg[0].iov_len;", "}", "out_size = qemu_sgl_concat(VAR_0, VAR_0->elem.out_sg,\n&VAR_0->elem.out_addr[0], VAR_0->elem.out_num,\nVAR_1);", "in_size = qemu_sgl_concat(VAR_0, VAR_0->elem.in_sg,\n&VAR_0->elem.in_addr[0], VAR_0->elem.in_num,\nVAR_2);", "if (out_size && in_size) {", "return -ENOTSUP;", "}", "if (out_size) {", "VAR_0->mode = SCSI_XFER_TO_DEV;", "} else if (in_size) {", "VAR_0->mode = SCSI_XFER_FROM_DEV;", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 23, 25, 27 ], [ 29 ], [ 31 ], [ 35 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69, 71, 73 ], [ 75, 77, 79 ], [ 83 ], [ 85 ], [ 87 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 103 ], [ 105 ] ]
24,132
static int mov_write_moov_tag(AVIOContext *pb, MOVMuxContext *mov, AVFormatContext *s) { int i; int64_t pos = avio_tell(pb); avio_wb32(pb, 0); /* size placeholder*/ ffio_wfourcc(pb, "moov"); for (i = 0; i < mov->nb_streams; i++) { if (mov->tracks[i].entry <= 0 && !(mov->flags & FF_MOV_FLAG_FRAGMENT)) continue; mov->tracks[i].time = mov->time; mov->tracks[i].track_id = i + 1; if (mov->tracks[i].entry) build_chunks(&mov->tracks[i]); } if (mov->chapter_track) for (i = 0; i < s->nb_streams; i++) { mov->tracks[i].tref_tag = MKTAG('c','h','a','p'); mov->tracks[i].tref_id = mov->tracks[mov->chapter_track].track_id; } for (i = 0; i < mov->nb_streams; i++) { if (mov->tracks[i].tag == MKTAG('r','t','p',' ')) { mov->tracks[i].tref_tag = MKTAG('h','i','n','t'); mov->tracks[i].tref_id = mov->tracks[mov->tracks[i].src_track].track_id; } } for (i = 0; i < mov->nb_streams; i++) { if (mov->tracks[i].tag == MKTAG('t','m','c','d')) { int src_trk = mov->tracks[i].src_track; mov->tracks[src_trk].tref_tag = mov->tracks[i].tag; mov->tracks[src_trk].tref_id = mov->tracks[i].track_id; //src_trk may have a different timescale than the tmcd track mov->tracks[i].track_duration = av_rescale(mov->tracks[src_trk].track_duration, mov->tracks[i].timescale, mov->tracks[src_trk].timescale); } } mov_write_mvhd_tag(pb, mov); if (mov->mode != MODE_MOV && !mov->iods_skip) mov_write_iods_tag(pb, mov); for (i = 0; i < mov->nb_streams; i++) { if (mov->tracks[i].entry > 0 || mov->flags & FF_MOV_FLAG_FRAGMENT) { mov_write_trak_tag(pb, mov, &(mov->tracks[i]), i < s->nb_streams ? s->streams[i] : NULL); } } if (mov->flags & FF_MOV_FLAG_FRAGMENT) mov_write_mvex_tag(pb, mov); /* QuickTime requires trak to precede this */ if (mov->mode == MODE_PSP) mov_write_uuidusmt_tag(pb, s); else mov_write_udta_tag(pb, mov, s); return update_size(pb, pos); }
true
FFmpeg
da048c6d24729d3bab6ccb0ac340ea129e3e88d5
static int mov_write_moov_tag(AVIOContext *pb, MOVMuxContext *mov, AVFormatContext *s) { int i; int64_t pos = avio_tell(pb); avio_wb32(pb, 0); ffio_wfourcc(pb, "moov"); for (i = 0; i < mov->nb_streams; i++) { if (mov->tracks[i].entry <= 0 && !(mov->flags & FF_MOV_FLAG_FRAGMENT)) continue; mov->tracks[i].time = mov->time; mov->tracks[i].track_id = i + 1; if (mov->tracks[i].entry) build_chunks(&mov->tracks[i]); } if (mov->chapter_track) for (i = 0; i < s->nb_streams; i++) { mov->tracks[i].tref_tag = MKTAG('c','h','a','p'); mov->tracks[i].tref_id = mov->tracks[mov->chapter_track].track_id; } for (i = 0; i < mov->nb_streams; i++) { if (mov->tracks[i].tag == MKTAG('r','t','p',' ')) { mov->tracks[i].tref_tag = MKTAG('h','i','n','t'); mov->tracks[i].tref_id = mov->tracks[mov->tracks[i].src_track].track_id; } } for (i = 0; i < mov->nb_streams; i++) { if (mov->tracks[i].tag == MKTAG('t','m','c','d')) { int src_trk = mov->tracks[i].src_track; mov->tracks[src_trk].tref_tag = mov->tracks[i].tag; mov->tracks[src_trk].tref_id = mov->tracks[i].track_id; mov->tracks[i].track_duration = av_rescale(mov->tracks[src_trk].track_duration, mov->tracks[i].timescale, mov->tracks[src_trk].timescale); } } mov_write_mvhd_tag(pb, mov); if (mov->mode != MODE_MOV && !mov->iods_skip) mov_write_iods_tag(pb, mov); for (i = 0; i < mov->nb_streams; i++) { if (mov->tracks[i].entry > 0 || mov->flags & FF_MOV_FLAG_FRAGMENT) { mov_write_trak_tag(pb, mov, &(mov->tracks[i]), i < s->nb_streams ? s->streams[i] : NULL); } } if (mov->flags & FF_MOV_FLAG_FRAGMENT) mov_write_mvex_tag(pb, mov); if (mov->mode == MODE_PSP) mov_write_uuidusmt_tag(pb, s); else mov_write_udta_tag(pb, mov, s); return update_size(pb, pos); }
{ "code": [ " mov_write_trak_tag(pb, mov, &(mov->tracks[i]), i < s->nb_streams ? s->streams[i] : NULL);" ], "line_no": [ 97 ] }
static int FUNC_0(AVIOContext *VAR_0, MOVMuxContext *VAR_1, AVFormatContext *VAR_2) { int VAR_3; int64_t pos = avio_tell(VAR_0); avio_wb32(VAR_0, 0); ffio_wfourcc(VAR_0, "moov"); for (VAR_3 = 0; VAR_3 < VAR_1->nb_streams; VAR_3++) { if (VAR_1->tracks[VAR_3].entry <= 0 && !(VAR_1->flags & FF_MOV_FLAG_FRAGMENT)) continue; VAR_1->tracks[VAR_3].time = VAR_1->time; VAR_1->tracks[VAR_3].track_id = VAR_3 + 1; if (VAR_1->tracks[VAR_3].entry) build_chunks(&VAR_1->tracks[VAR_3]); } if (VAR_1->chapter_track) for (VAR_3 = 0; VAR_3 < VAR_2->nb_streams; VAR_3++) { VAR_1->tracks[VAR_3].tref_tag = MKTAG('c','h','a','p'); VAR_1->tracks[VAR_3].tref_id = VAR_1->tracks[VAR_1->chapter_track].track_id; } for (VAR_3 = 0; VAR_3 < VAR_1->nb_streams; VAR_3++) { if (VAR_1->tracks[VAR_3].tag == MKTAG('r','t','p',' ')) { VAR_1->tracks[VAR_3].tref_tag = MKTAG('h','VAR_3','n','t'); VAR_1->tracks[VAR_3].tref_id = VAR_1->tracks[VAR_1->tracks[VAR_3].src_track].track_id; } } for (VAR_3 = 0; VAR_3 < VAR_1->nb_streams; VAR_3++) { if (VAR_1->tracks[VAR_3].tag == MKTAG('t','m','c','d')) { int src_trk = VAR_1->tracks[VAR_3].src_track; VAR_1->tracks[src_trk].tref_tag = VAR_1->tracks[VAR_3].tag; VAR_1->tracks[src_trk].tref_id = VAR_1->tracks[VAR_3].track_id; VAR_1->tracks[VAR_3].track_duration = av_rescale(VAR_1->tracks[src_trk].track_duration, VAR_1->tracks[VAR_3].timescale, VAR_1->tracks[src_trk].timescale); } } mov_write_mvhd_tag(VAR_0, VAR_1); if (VAR_1->mode != MODE_MOV && !VAR_1->iods_skip) mov_write_iods_tag(VAR_0, VAR_1); for (VAR_3 = 0; VAR_3 < VAR_1->nb_streams; VAR_3++) { if (VAR_1->tracks[VAR_3].entry > 0 || VAR_1->flags & FF_MOV_FLAG_FRAGMENT) { mov_write_trak_tag(VAR_0, VAR_1, &(VAR_1->tracks[VAR_3]), VAR_3 < VAR_2->nb_streams ? VAR_2->streams[VAR_3] : NULL); } } if (VAR_1->flags & FF_MOV_FLAG_FRAGMENT) mov_write_mvex_tag(VAR_0, VAR_1); if (VAR_1->mode == MODE_PSP) mov_write_uuidusmt_tag(VAR_0, VAR_2); else mov_write_udta_tag(VAR_0, VAR_1, VAR_2); return update_size(VAR_0, pos); }
[ "static int FUNC_0(AVIOContext *VAR_0, MOVMuxContext *VAR_1,\nAVFormatContext *VAR_2)\n{", "int VAR_3;", "int64_t pos = avio_tell(VAR_0);", "avio_wb32(VAR_0, 0);", "ffio_wfourcc(VAR_0, \"moov\");", "for (VAR_3 = 0; VAR_3 < VAR_1->nb_streams; VAR_3++) {", "if (VAR_1->tracks[VAR_3].entry <= 0 && !(VAR_1->flags & FF_MOV_FLAG_FRAGMENT))\ncontinue;", "VAR_1->tracks[VAR_3].time = VAR_1->time;", "VAR_1->tracks[VAR_3].track_id = VAR_3 + 1;", "if (VAR_1->tracks[VAR_3].entry)\nbuild_chunks(&VAR_1->tracks[VAR_3]);", "}", "if (VAR_1->chapter_track)\nfor (VAR_3 = 0; VAR_3 < VAR_2->nb_streams; VAR_3++) {", "VAR_1->tracks[VAR_3].tref_tag = MKTAG('c','h','a','p');", "VAR_1->tracks[VAR_3].tref_id = VAR_1->tracks[VAR_1->chapter_track].track_id;", "}", "for (VAR_3 = 0; VAR_3 < VAR_1->nb_streams; VAR_3++) {", "if (VAR_1->tracks[VAR_3].tag == MKTAG('r','t','p',' ')) {", "VAR_1->tracks[VAR_3].tref_tag = MKTAG('h','VAR_3','n','t');", "VAR_1->tracks[VAR_3].tref_id =\nVAR_1->tracks[VAR_1->tracks[VAR_3].src_track].track_id;", "}", "}", "for (VAR_3 = 0; VAR_3 < VAR_1->nb_streams; VAR_3++) {", "if (VAR_1->tracks[VAR_3].tag == MKTAG('t','m','c','d')) {", "int src_trk = VAR_1->tracks[VAR_3].src_track;", "VAR_1->tracks[src_trk].tref_tag = VAR_1->tracks[VAR_3].tag;", "VAR_1->tracks[src_trk].tref_id = VAR_1->tracks[VAR_3].track_id;", "VAR_1->tracks[VAR_3].track_duration = av_rescale(VAR_1->tracks[src_trk].track_duration,\nVAR_1->tracks[VAR_3].timescale,\nVAR_1->tracks[src_trk].timescale);", "}", "}", "mov_write_mvhd_tag(VAR_0, VAR_1);", "if (VAR_1->mode != MODE_MOV && !VAR_1->iods_skip)\nmov_write_iods_tag(VAR_0, VAR_1);", "for (VAR_3 = 0; VAR_3 < VAR_1->nb_streams; VAR_3++) {", "if (VAR_1->tracks[VAR_3].entry > 0 || VAR_1->flags & FF_MOV_FLAG_FRAGMENT) {", "mov_write_trak_tag(VAR_0, VAR_1, &(VAR_1->tracks[VAR_3]), VAR_3 < VAR_2->nb_streams ? VAR_2->streams[VAR_3] : NULL);", "}", "}", "if (VAR_1->flags & FF_MOV_FLAG_FRAGMENT)\nmov_write_mvex_tag(VAR_0, VAR_1);", "if (VAR_1->mode == MODE_PSP)\nmov_write_uuidusmt_tag(VAR_0, VAR_2);", "else\nmov_write_udta_tag(VAR_0, VAR_1, VAR_2);", "return update_size(VAR_0, pos);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19, 21 ], [ 25 ], [ 27 ], [ 31, 33 ], [ 35 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55, 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 75, 77, 79 ], [ 81 ], [ 83 ], [ 87 ], [ 89, 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103, 105 ], [ 109, 111 ], [ 113, 115 ], [ 119 ], [ 121 ] ]
24,133
static void virtio_blk_handle_read(VirtIOBlockReq *req) { BlockDriverAIOCB *acb; uint64_t sector; sector = ldq_p(&req->out->sector); if (sector & req->dev->sector_mask) { acb = bdrv_aio_readv(req->dev->bs, sector, &req->qiov, req->qiov.size / BDRV_SECTOR_SIZE, virtio_blk_rw_complete, req); if (!acb) {
true
qemu
52c050236eaa4f0b5e1d160cd66dc18106445c4d
static void virtio_blk_handle_read(VirtIOBlockReq *req) { BlockDriverAIOCB *acb; uint64_t sector; sector = ldq_p(&req->out->sector); if (sector & req->dev->sector_mask) { acb = bdrv_aio_readv(req->dev->bs, sector, &req->qiov, req->qiov.size / BDRV_SECTOR_SIZE, virtio_blk_rw_complete, req); if (!acb) {
{ "code": [], "line_no": [] }
static void FUNC_0(VirtIOBlockReq *VAR_0) { BlockDriverAIOCB *acb; uint64_t sector; sector = ldq_p(&VAR_0->out->sector); if (sector & VAR_0->dev->sector_mask) { acb = bdrv_aio_readv(VAR_0->dev->bs, sector, &VAR_0->qiov, VAR_0->qiov.size / BDRV_SECTOR_SIZE, virtio_blk_rw_complete, VAR_0); if (!acb) {
[ "static void FUNC_0(VirtIOBlockReq *VAR_0)\n{", "BlockDriverAIOCB *acb;", "uint64_t sector;", "sector = ldq_p(&VAR_0->out->sector);", "if (sector & VAR_0->dev->sector_mask) {", "acb = bdrv_aio_readv(VAR_0->dev->bs, sector, &VAR_0->qiov,\nVAR_0->qiov.size / BDRV_SECTOR_SIZE,\nvirtio_blk_rw_complete, VAR_0);", "if (!acb) {" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 15 ], [ 26, 28, 30 ], [ 32 ] ]
24,134
void FUNC(ff_simple_idct_put)(uint8_t *dest_, int line_size, DCTELEM *block) { pixel *dest = (pixel *)dest_; int i; line_size /= sizeof(pixel); for (i = 0; i < 8; i++) FUNC(idctRowCondDC)(block + i*8); for (i = 0; i < 8; i++) FUNC(idctSparseColPut)(dest + i, line_size, block + i); }
true
FFmpeg
f78cd0c243b9149c7f604ecf1006d78e344aa6ca
void FUNC(ff_simple_idct_put)(uint8_t *dest_, int line_size, DCTELEM *block) { pixel *dest = (pixel *)dest_; int i; line_size /= sizeof(pixel); for (i = 0; i < 8; i++) FUNC(idctRowCondDC)(block + i*8); for (i = 0; i < 8; i++) FUNC(idctSparseColPut)(dest + i, line_size, block + i); }
{ "code": [ " FUNC(idctRowCondDC)(block + i*8);", " FUNC(idctRowCondDC)(block + i*8);", " FUNC(idctRowCondDC)(block + i*8);" ], "line_no": [ 17, 17, 17 ] }
void FUNC_0(ff_simple_idct_put)(uint8_t *dest_, int line_size, DCTELEM *block) { pixel *dest = (pixel *)dest_; int VAR_0; line_size /= sizeof(pixel); for (VAR_0 = 0; VAR_0 < 8; VAR_0++) FUNC_0(idctRowCondDC)(block + VAR_0*8); for (VAR_0 = 0; VAR_0 < 8; VAR_0++) FUNC_0(idctSparseColPut)(dest + VAR_0, line_size, block + VAR_0); }
[ "void FUNC_0(ff_simple_idct_put)(uint8_t *dest_, int line_size, DCTELEM *block)\n{", "pixel *dest = (pixel *)dest_;", "int VAR_0;", "line_size /= sizeof(pixel);", "for (VAR_0 = 0; VAR_0 < 8; VAR_0++)", "FUNC_0(idctRowCondDC)(block + VAR_0*8);", "for (VAR_0 = 0; VAR_0 < 8; VAR_0++)", "FUNC_0(idctSparseColPut)(dest + VAR_0, line_size, block + VAR_0);", "}" ]
[ 0, 0, 0, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ] ]
24,135
static void quantize_and_encode_band_cost_UPAIR7_mips(struct AACEncContext *s, PutBitContext *pb, const float *in, float *out, const float *scaled, int size, int scale_idx, int cb, const float lambda, const float uplim, int *bits, const float ROUNDING) { const float Q34 = ff_aac_pow34sf_tab[POW_SF2_ZERO - scale_idx + SCALE_ONE_POS - SCALE_DIV_512]; const float IQ = ff_aac_pow2sf_tab [POW_SF2_ZERO + scale_idx - SCALE_ONE_POS + SCALE_DIV_512]; int i; int qc1, qc2, qc3, qc4; uint8_t *p_bits = (uint8_t*) ff_aac_spectral_bits[cb-1]; uint16_t *p_codes = (uint16_t*)ff_aac_spectral_codes[cb-1]; float *p_vec = (float *)ff_aac_codebook_vectors[cb-1]; abs_pow34_v(s->scoefs, in, size); scaled = s->scoefs; for (i = 0; i < size; i += 4) { int curidx1, curidx2, sign1, count1, sign2, count2; int *in_int = (int *)&in[i]; uint8_t v_bits; unsigned int v_codes; int t0, t1, t2, t3, t4; const float *vec1, *vec2; qc1 = scaled[i ] * Q34 + ROUND_STANDARD; qc2 = scaled[i+1] * Q34 + ROUND_STANDARD; qc3 = scaled[i+2] * Q34 + ROUND_STANDARD; qc4 = scaled[i+3] * Q34 + ROUND_STANDARD; __asm__ volatile ( ".set push \n\t" ".set noreorder \n\t" "ori %[t4], $zero, 7 \n\t" "ori %[sign1], $zero, 0 \n\t" "ori %[sign2], $zero, 0 \n\t" "slt %[t0], %[t4], %[qc1] \n\t" "slt %[t1], %[t4], %[qc2] \n\t" "slt %[t2], %[t4], %[qc3] \n\t" "slt %[t3], %[t4], %[qc4] \n\t" "movn %[qc1], %[t4], %[t0] \n\t" "movn %[qc2], %[t4], %[t1] \n\t" "movn %[qc3], %[t4], %[t2] \n\t" "movn %[qc4], %[t4], %[t3] \n\t" "lw %[t0], 0(%[in_int]) \n\t" "lw %[t1], 4(%[in_int]) \n\t" "lw %[t2], 8(%[in_int]) \n\t" "lw %[t3], 12(%[in_int]) \n\t" "slt %[t0], %[t0], $zero \n\t" "movn %[sign1], %[t0], %[qc1] \n\t" "slt %[t2], %[t2], $zero \n\t" "movn %[sign2], %[t2], %[qc3] \n\t" "slt %[t1], %[t1], $zero \n\t" "sll %[t0], %[sign1], 1 \n\t" "or %[t0], %[t0], %[t1] \n\t" "movn %[sign1], %[t0], %[qc2] \n\t" "slt %[t3], %[t3], $zero \n\t" "sll %[t0], %[sign2], 1 \n\t" "or %[t0], %[t0], %[t3] \n\t" "movn %[sign2], %[t0], %[qc4] \n\t" "slt %[count1], $zero, %[qc1] \n\t" "slt %[t1], $zero, %[qc2] \n\t" "slt %[count2], $zero, %[qc3] \n\t" "slt %[t2], $zero, %[qc4] \n\t" "addu %[count1], %[count1], %[t1] \n\t" "addu %[count2], %[count2], %[t2] \n\t" ".set pop \n\t" : [qc1]"+r"(qc1), [qc2]"+r"(qc2), [qc3]"+r"(qc3), [qc4]"+r"(qc4), [sign1]"=&r"(sign1), [count1]"=&r"(count1), [sign2]"=&r"(sign2), [count2]"=&r"(count2), [t0]"=&r"(t0), [t1]"=&r"(t1), [t2]"=&r"(t2), [t3]"=&r"(t3), [t4]"=&r"(t4) : [in_int]"r"(in_int) : "t0", "t1", "t2", "t3", "t4", "memory" ); curidx1 = 8 * qc1; curidx1 += qc2; v_codes = (p_codes[curidx1] << count1) | sign1; v_bits = p_bits[curidx1] + count1; put_bits(pb, v_bits, v_codes); curidx2 = 8 * qc3; curidx2 += qc4; v_codes = (p_codes[curidx2] << count2) | sign2; v_bits = p_bits[curidx2] + count2; put_bits(pb, v_bits, v_codes); if (out) { vec1 = &p_vec[curidx1*2]; vec2 = &p_vec[curidx2*2]; out[i+0] = copysignf(vec1[0] * IQ, in[i+0]); out[i+1] = copysignf(vec1[1] * IQ, in[i+1]); out[i+2] = copysignf(vec2[0] * IQ, in[i+2]); out[i+3] = copysignf(vec2[1] * IQ, in[i+3]); } } }
true
FFmpeg
01ecb7172b684f1c4b3e748f95c5a9a494ca36ec
static void quantize_and_encode_band_cost_UPAIR7_mips(struct AACEncContext *s, PutBitContext *pb, const float *in, float *out, const float *scaled, int size, int scale_idx, int cb, const float lambda, const float uplim, int *bits, const float ROUNDING) { const float Q34 = ff_aac_pow34sf_tab[POW_SF2_ZERO - scale_idx + SCALE_ONE_POS - SCALE_DIV_512]; const float IQ = ff_aac_pow2sf_tab [POW_SF2_ZERO + scale_idx - SCALE_ONE_POS + SCALE_DIV_512]; int i; int qc1, qc2, qc3, qc4; uint8_t *p_bits = (uint8_t*) ff_aac_spectral_bits[cb-1]; uint16_t *p_codes = (uint16_t*)ff_aac_spectral_codes[cb-1]; float *p_vec = (float *)ff_aac_codebook_vectors[cb-1]; abs_pow34_v(s->scoefs, in, size); scaled = s->scoefs; for (i = 0; i < size; i += 4) { int curidx1, curidx2, sign1, count1, sign2, count2; int *in_int = (int *)&in[i]; uint8_t v_bits; unsigned int v_codes; int t0, t1, t2, t3, t4; const float *vec1, *vec2; qc1 = scaled[i ] * Q34 + ROUND_STANDARD; qc2 = scaled[i+1] * Q34 + ROUND_STANDARD; qc3 = scaled[i+2] * Q34 + ROUND_STANDARD; qc4 = scaled[i+3] * Q34 + ROUND_STANDARD; __asm__ volatile ( ".set push \n\t" ".set noreorder \n\t" "ori %[t4], $zero, 7 \n\t" "ori %[sign1], $zero, 0 \n\t" "ori %[sign2], $zero, 0 \n\t" "slt %[t0], %[t4], %[qc1] \n\t" "slt %[t1], %[t4], %[qc2] \n\t" "slt %[t2], %[t4], %[qc3] \n\t" "slt %[t3], %[t4], %[qc4] \n\t" "movn %[qc1], %[t4], %[t0] \n\t" "movn %[qc2], %[t4], %[t1] \n\t" "movn %[qc3], %[t4], %[t2] \n\t" "movn %[qc4], %[t4], %[t3] \n\t" "lw %[t0], 0(%[in_int]) \n\t" "lw %[t1], 4(%[in_int]) \n\t" "lw %[t2], 8(%[in_int]) \n\t" "lw %[t3], 12(%[in_int]) \n\t" "slt %[t0], %[t0], $zero \n\t" "movn %[sign1], %[t0], %[qc1] \n\t" "slt %[t2], %[t2], $zero \n\t" "movn %[sign2], %[t2], %[qc3] \n\t" "slt %[t1], %[t1], $zero \n\t" "sll %[t0], %[sign1], 1 \n\t" "or %[t0], %[t0], %[t1] \n\t" "movn %[sign1], %[t0], %[qc2] \n\t" "slt %[t3], %[t3], $zero \n\t" "sll %[t0], %[sign2], 1 \n\t" "or %[t0], %[t0], %[t3] \n\t" "movn %[sign2], %[t0], %[qc4] \n\t" "slt %[count1], $zero, %[qc1] \n\t" "slt %[t1], $zero, %[qc2] \n\t" "slt %[count2], $zero, %[qc3] \n\t" "slt %[t2], $zero, %[qc4] \n\t" "addu %[count1], %[count1], %[t1] \n\t" "addu %[count2], %[count2], %[t2] \n\t" ".set pop \n\t" : [qc1]"+r"(qc1), [qc2]"+r"(qc2), [qc3]"+r"(qc3), [qc4]"+r"(qc4), [sign1]"=&r"(sign1), [count1]"=&r"(count1), [sign2]"=&r"(sign2), [count2]"=&r"(count2), [t0]"=&r"(t0), [t1]"=&r"(t1), [t2]"=&r"(t2), [t3]"=&r"(t3), [t4]"=&r"(t4) : [in_int]"r"(in_int) : "t0", "t1", "t2", "t3", "t4", "memory" ); curidx1 = 8 * qc1; curidx1 += qc2; v_codes = (p_codes[curidx1] << count1) | sign1; v_bits = p_bits[curidx1] + count1; put_bits(pb, v_bits, v_codes); curidx2 = 8 * qc3; curidx2 += qc4; v_codes = (p_codes[curidx2] << count2) | sign2; v_bits = p_bits[curidx2] + count2; put_bits(pb, v_bits, v_codes); if (out) { vec1 = &p_vec[curidx1*2]; vec2 = &p_vec[curidx2*2]; out[i+0] = copysignf(vec1[0] * IQ, in[i+0]); out[i+1] = copysignf(vec1[1] * IQ, in[i+1]); out[i+2] = copysignf(vec2[0] * IQ, in[i+2]); out[i+3] = copysignf(vec2[1] * IQ, in[i+3]); } } }
{ "code": [ " if (out) {", " if (out) {", " if (out) {", " vec2 = &p_vec[curidx2*2];", " int *bits, const float ROUNDING)", " if (out) {", " vec1 = &p_vec[curidx1*2];", " vec2 = &p_vec[curidx2*2];", " out[i+0] = copysignf(vec1[0] * IQ, in[i+0]);", " out[i+1] = copysignf(vec1[1] * IQ, in[i+1]);", " out[i+2] = copysignf(vec2[0] * IQ, in[i+2]);", " out[i+3] = copysignf(vec2[1] * IQ, in[i+3]);", " if (out) {", " vec1 = &p_vec[curidx1*2];", " vec2 = &p_vec[curidx2*2];", " out[i+0] = copysignf(vec1[0] * IQ, in[i+0]);", " out[i+1] = copysignf(vec1[1] * IQ, in[i+1]);", " out[i+2] = copysignf(vec2[0] * IQ, in[i+2]);", " out[i+3] = copysignf(vec2[1] * IQ, in[i+3]);" ], "line_no": [ 191, 191, 191, 195, 9, 191, 193, 195, 197, 199, 201, 203, 191, 193, 195, 197, 199, 201, 203 ] }
static void FUNC_0(struct AACEncContext *VAR_0, PutBitContext *VAR_1, const float *VAR_2, float *VAR_3, const float *VAR_4, int VAR_5, int VAR_6, int VAR_7, const float VAR_8, const float VAR_9, int *VAR_10, const float VAR_11) { const float VAR_12 = ff_aac_pow34sf_tab[POW_SF2_ZERO - VAR_6 + SCALE_ONE_POS - SCALE_DIV_512]; const float VAR_13 = ff_aac_pow2sf_tab [POW_SF2_ZERO + VAR_6 - SCALE_ONE_POS + SCALE_DIV_512]; int VAR_14; int VAR_15, VAR_16, VAR_17, VAR_18; uint8_t *p_bits = (uint8_t*) ff_aac_spectral_bits[VAR_7-1]; uint16_t *p_codes = (uint16_t*)ff_aac_spectral_codes[VAR_7-1]; float *VAR_19 = (float *)ff_aac_codebook_vectors[VAR_7-1]; abs_pow34_v(VAR_0->scoefs, VAR_2, VAR_5); VAR_4 = VAR_0->scoefs; for (VAR_14 = 0; VAR_14 < VAR_5; VAR_14 += 4) { int VAR_20, VAR_21, VAR_22, VAR_23, VAR_24, VAR_25; int *VAR_26 = (int *)&VAR_2[VAR_14]; uint8_t v_bits; unsigned int VAR_27; int VAR_28, VAR_29, VAR_30, VAR_31, VAR_32; const float *VAR_33, *VAR_34; VAR_15 = VAR_4[VAR_14 ] * VAR_12 + ROUND_STANDARD; VAR_16 = VAR_4[VAR_14+1] * VAR_12 + ROUND_STANDARD; VAR_17 = VAR_4[VAR_14+2] * VAR_12 + ROUND_STANDARD; VAR_18 = VAR_4[VAR_14+3] * VAR_12 + ROUND_STANDARD; __asm__ volatile ( ".set push \n\t" ".set noreorder \n\t" "ori %[VAR_32], $zero, 7 \n\t" "ori %[VAR_22], $zero, 0 \n\t" "ori %[VAR_24], $zero, 0 \n\t" "slt %[VAR_28], %[VAR_32], %[VAR_15] \n\t" "slt %[VAR_29], %[VAR_32], %[VAR_16] \n\t" "slt %[VAR_30], %[VAR_32], %[VAR_17] \n\t" "slt %[VAR_31], %[VAR_32], %[VAR_18] \n\t" "movn %[VAR_15], %[VAR_32], %[VAR_28] \n\t" "movn %[VAR_16], %[VAR_32], %[VAR_29] \n\t" "movn %[VAR_17], %[VAR_32], %[VAR_30] \n\t" "movn %[VAR_18], %[VAR_32], %[VAR_31] \n\t" "lw %[VAR_28], 0(%[VAR_26]) \n\t" "lw %[VAR_29], 4(%[VAR_26]) \n\t" "lw %[VAR_30], 8(%[VAR_26]) \n\t" "lw %[VAR_31], 12(%[VAR_26]) \n\t" "slt %[VAR_28], %[VAR_28], $zero \n\t" "movn %[VAR_22], %[VAR_28], %[VAR_15] \n\t" "slt %[VAR_30], %[VAR_30], $zero \n\t" "movn %[VAR_24], %[VAR_30], %[VAR_17] \n\t" "slt %[VAR_29], %[VAR_29], $zero \n\t" "sll %[VAR_28], %[VAR_22], 1 \n\t" "or %[VAR_28], %[VAR_28], %[VAR_29] \n\t" "movn %[VAR_22], %[VAR_28], %[VAR_16] \n\t" "slt %[VAR_31], %[VAR_31], $zero \n\t" "sll %[VAR_28], %[VAR_24], 1 \n\t" "or %[VAR_28], %[VAR_28], %[VAR_31] \n\t" "movn %[VAR_24], %[VAR_28], %[VAR_18] \n\t" "slt %[VAR_23], $zero, %[VAR_15] \n\t" "slt %[VAR_29], $zero, %[VAR_16] \n\t" "slt %[VAR_25], $zero, %[VAR_17] \n\t" "slt %[VAR_30], $zero, %[VAR_18] \n\t" "addu %[VAR_23], %[VAR_23], %[VAR_29] \n\t" "addu %[VAR_25], %[VAR_25], %[VAR_30] \n\t" ".set pop \n\t" : [VAR_15]"+r"(VAR_15), [VAR_16]"+r"(VAR_16), [VAR_17]"+r"(VAR_17), [VAR_18]"+r"(VAR_18), [VAR_22]"=&r"(VAR_22), [VAR_23]"=&r"(VAR_23), [VAR_24]"=&r"(VAR_24), [VAR_25]"=&r"(VAR_25), [VAR_28]"=&r"(VAR_28), [VAR_29]"=&r"(VAR_29), [VAR_30]"=&r"(VAR_30), [VAR_31]"=&r"(VAR_31), [VAR_32]"=&r"(VAR_32) : [VAR_26]"r"(VAR_26) : "VAR_28", "VAR_29", "VAR_30", "VAR_31", "VAR_32", "memory" ); VAR_20 = 8 * VAR_15; VAR_20 += VAR_16; VAR_27 = (p_codes[VAR_20] << VAR_23) | VAR_22; v_bits = p_bits[VAR_20] + VAR_23; put_bits(VAR_1, v_bits, VAR_27); VAR_21 = 8 * VAR_17; VAR_21 += VAR_18; VAR_27 = (p_codes[VAR_21] << VAR_25) | VAR_24; v_bits = p_bits[VAR_21] + VAR_25; put_bits(VAR_1, v_bits, VAR_27); if (VAR_3) { VAR_33 = &VAR_19[VAR_20*2]; VAR_34 = &VAR_19[VAR_21*2]; VAR_3[VAR_14+0] = copysignf(VAR_33[0] * VAR_13, VAR_2[VAR_14+0]); VAR_3[VAR_14+1] = copysignf(VAR_33[1] * VAR_13, VAR_2[VAR_14+1]); VAR_3[VAR_14+2] = copysignf(VAR_34[0] * VAR_13, VAR_2[VAR_14+2]); VAR_3[VAR_14+3] = copysignf(VAR_34[1] * VAR_13, VAR_2[VAR_14+3]); } } }
[ "static void FUNC_0(struct AACEncContext *VAR_0,\nPutBitContext *VAR_1, const float *VAR_2, float *VAR_3,\nconst float *VAR_4, int VAR_5, int VAR_6,\nint VAR_7, const float VAR_8, const float VAR_9,\nint *VAR_10, const float VAR_11)\n{", "const float VAR_12 = ff_aac_pow34sf_tab[POW_SF2_ZERO - VAR_6 + SCALE_ONE_POS - SCALE_DIV_512];", "const float VAR_13 = ff_aac_pow2sf_tab [POW_SF2_ZERO + VAR_6 - SCALE_ONE_POS + SCALE_DIV_512];", "int VAR_14;", "int VAR_15, VAR_16, VAR_17, VAR_18;", "uint8_t *p_bits = (uint8_t*) ff_aac_spectral_bits[VAR_7-1];", "uint16_t *p_codes = (uint16_t*)ff_aac_spectral_codes[VAR_7-1];", "float *VAR_19 = (float *)ff_aac_codebook_vectors[VAR_7-1];", "abs_pow34_v(VAR_0->scoefs, VAR_2, VAR_5);", "VAR_4 = VAR_0->scoefs;", "for (VAR_14 = 0; VAR_14 < VAR_5; VAR_14 += 4) {", "int VAR_20, VAR_21, VAR_22, VAR_23, VAR_24, VAR_25;", "int *VAR_26 = (int *)&VAR_2[VAR_14];", "uint8_t v_bits;", "unsigned int VAR_27;", "int VAR_28, VAR_29, VAR_30, VAR_31, VAR_32;", "const float *VAR_33, *VAR_34;", "VAR_15 = VAR_4[VAR_14 ] * VAR_12 + ROUND_STANDARD;", "VAR_16 = VAR_4[VAR_14+1] * VAR_12 + ROUND_STANDARD;", "VAR_17 = VAR_4[VAR_14+2] * VAR_12 + ROUND_STANDARD;", "VAR_18 = VAR_4[VAR_14+3] * VAR_12 + ROUND_STANDARD;", "__asm__ volatile (\n\".set push \\n\\t\"\n\".set noreorder \\n\\t\"\n\"ori %[VAR_32], $zero, 7 \\n\\t\"\n\"ori %[VAR_22], $zero, 0 \\n\\t\"\n\"ori %[VAR_24], $zero, 0 \\n\\t\"\n\"slt %[VAR_28], %[VAR_32], %[VAR_15] \\n\\t\"\n\"slt %[VAR_29], %[VAR_32], %[VAR_16] \\n\\t\"\n\"slt %[VAR_30], %[VAR_32], %[VAR_17] \\n\\t\"\n\"slt %[VAR_31], %[VAR_32], %[VAR_18] \\n\\t\"\n\"movn %[VAR_15], %[VAR_32], %[VAR_28] \\n\\t\"\n\"movn %[VAR_16], %[VAR_32], %[VAR_29] \\n\\t\"\n\"movn %[VAR_17], %[VAR_32], %[VAR_30] \\n\\t\"\n\"movn %[VAR_18], %[VAR_32], %[VAR_31] \\n\\t\"\n\"lw %[VAR_28], 0(%[VAR_26]) \\n\\t\"\n\"lw %[VAR_29], 4(%[VAR_26]) \\n\\t\"\n\"lw %[VAR_30], 8(%[VAR_26]) \\n\\t\"\n\"lw %[VAR_31], 12(%[VAR_26]) \\n\\t\"\n\"slt %[VAR_28], %[VAR_28], $zero \\n\\t\"\n\"movn %[VAR_22], %[VAR_28], %[VAR_15] \\n\\t\"\n\"slt %[VAR_30], %[VAR_30], $zero \\n\\t\"\n\"movn %[VAR_24], %[VAR_30], %[VAR_17] \\n\\t\"\n\"slt %[VAR_29], %[VAR_29], $zero \\n\\t\"\n\"sll %[VAR_28], %[VAR_22], 1 \\n\\t\"\n\"or %[VAR_28], %[VAR_28], %[VAR_29] \\n\\t\"\n\"movn %[VAR_22], %[VAR_28], %[VAR_16] \\n\\t\"\n\"slt %[VAR_31], %[VAR_31], $zero \\n\\t\"\n\"sll %[VAR_28], %[VAR_24], 1 \\n\\t\"\n\"or %[VAR_28], %[VAR_28], %[VAR_31] \\n\\t\"\n\"movn %[VAR_24], %[VAR_28], %[VAR_18] \\n\\t\"\n\"slt %[VAR_23], $zero, %[VAR_15] \\n\\t\"\n\"slt %[VAR_29], $zero, %[VAR_16] \\n\\t\"\n\"slt %[VAR_25], $zero, %[VAR_17] \\n\\t\"\n\"slt %[VAR_30], $zero, %[VAR_18] \\n\\t\"\n\"addu %[VAR_23], %[VAR_23], %[VAR_29] \\n\\t\"\n\"addu %[VAR_25], %[VAR_25], %[VAR_30] \\n\\t\"\n\".set pop \\n\\t\"\n: [VAR_15]\"+r\"(VAR_15), [VAR_16]\"+r\"(VAR_16),\n[VAR_17]\"+r\"(VAR_17), [VAR_18]\"+r\"(VAR_18),\n[VAR_22]\"=&r\"(VAR_22), [VAR_23]\"=&r\"(VAR_23),\n[VAR_24]\"=&r\"(VAR_24), [VAR_25]\"=&r\"(VAR_25),\n[VAR_28]\"=&r\"(VAR_28), [VAR_29]\"=&r\"(VAR_29), [VAR_30]\"=&r\"(VAR_30), [VAR_31]\"=&r\"(VAR_31),\n[VAR_32]\"=&r\"(VAR_32)\n: [VAR_26]\"r\"(VAR_26)\n: \"VAR_28\", \"VAR_29\", \"VAR_30\", \"VAR_31\", \"VAR_32\",\n\"memory\"\n);", "VAR_20 = 8 * VAR_15;", "VAR_20 += VAR_16;", "VAR_27 = (p_codes[VAR_20] << VAR_23) | VAR_22;", "v_bits = p_bits[VAR_20] + VAR_23;", "put_bits(VAR_1, v_bits, VAR_27);", "VAR_21 = 8 * VAR_17;", "VAR_21 += VAR_18;", "VAR_27 = (p_codes[VAR_21] << VAR_25) | VAR_24;", "v_bits = p_bits[VAR_21] + VAR_25;", "put_bits(VAR_1, v_bits, VAR_27);", "if (VAR_3) {", "VAR_33 = &VAR_19[VAR_20*2];", "VAR_34 = &VAR_19[VAR_21*2];", "VAR_3[VAR_14+0] = copysignf(VAR_33[0] * VAR_13, VAR_2[VAR_14+0]);", "VAR_3[VAR_14+1] = copysignf(VAR_33[1] * VAR_13, VAR_2[VAR_14+1]);", "VAR_3[VAR_14+2] = copysignf(VAR_34[0] * VAR_13, VAR_2[VAR_14+2]);", "VAR_3[VAR_14+3] = copysignf(VAR_34[1] * VAR_13, VAR_2[VAR_14+3]);", "}", "}", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61, 63, 65, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, 99, 101, 103, 105, 107, 109, 111, 113, 115, 117, 119, 121, 123, 125, 127, 129, 131, 133, 137, 141, 143, 145, 147, 149, 151, 153, 155, 157, 159 ], [ 163 ], [ 165 ], [ 169 ], [ 171 ], [ 173 ], [ 177 ], [ 179 ], [ 183 ], [ 185 ], [ 187 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ] ]
24,136
static int rtmp_packet_read_one_chunk(URLContext *h, RTMPPacket *p, int chunk_size, RTMPPacket **prev_pkt_ptr, int *nb_prev_pkt, uint8_t hdr) { uint8_t buf[16]; int channel_id, timestamp, size; uint32_t ts_field; // non-extended timestamp or delta field uint32_t extra = 0; enum RTMPPacketType type; int written = 0; int ret, toread; RTMPPacket *prev_pkt; written++; channel_id = hdr & 0x3F; if (channel_id < 2) { //special case for channel number >= 64 buf[1] = 0; if (ffurl_read_complete(h, buf, channel_id + 1) != channel_id + 1) return AVERROR(EIO); written += channel_id + 1; channel_id = AV_RL16(buf) + 64; } if ((ret = ff_rtmp_check_alloc_array(prev_pkt_ptr, nb_prev_pkt, channel_id)) < 0) return ret; prev_pkt = *prev_pkt_ptr; size = prev_pkt[channel_id].size; type = prev_pkt[channel_id].type; extra = prev_pkt[channel_id].extra; hdr >>= 6; // header size indicator if (hdr == RTMP_PS_ONEBYTE) { ts_field = prev_pkt[channel_id].ts_field; } else { if (ffurl_read_complete(h, buf, 3) != 3) return AVERROR(EIO); written += 3; ts_field = AV_RB24(buf); if (hdr != RTMP_PS_FOURBYTES) { if (ffurl_read_complete(h, buf, 3) != 3) return AVERROR(EIO); written += 3; size = AV_RB24(buf); if (ffurl_read_complete(h, buf, 1) != 1) return AVERROR(EIO); written++; type = buf[0]; if (hdr == RTMP_PS_TWELVEBYTES) { if (ffurl_read_complete(h, buf, 4) != 4) return AVERROR(EIO); written += 4; extra = AV_RL32(buf); } } } if (ts_field == 0xFFFFFF) { if (ffurl_read_complete(h, buf, 4) != 4) return AVERROR(EIO); timestamp = AV_RB32(buf); } else { timestamp = ts_field; } if (hdr != RTMP_PS_TWELVEBYTES) timestamp += prev_pkt[channel_id].timestamp; if (!prev_pkt[channel_id].read) { if ((ret = ff_rtmp_packet_create(p, channel_id, type, timestamp, size)) < 0) return ret; p->read = written; p->offset = 0; prev_pkt[channel_id].ts_field = ts_field; prev_pkt[channel_id].timestamp = timestamp; } else { // previous packet in this channel hasn't completed reading RTMPPacket *prev = &prev_pkt[channel_id]; p->data = prev->data; p->size = prev->size; p->channel_id = prev->channel_id; p->type = prev->type; p->ts_field = prev->ts_field; p->extra = prev->extra; p->offset = prev->offset; p->read = prev->read + written; p->timestamp = prev->timestamp; prev->data = NULL; } p->extra = extra; // save history prev_pkt[channel_id].channel_id = channel_id; prev_pkt[channel_id].type = type; prev_pkt[channel_id].size = size; prev_pkt[channel_id].extra = extra; size = size - p->offset; toread = FFMIN(size, chunk_size); if (ffurl_read_complete(h, p->data + p->offset, toread) != toread) { ff_rtmp_packet_destroy(p); return AVERROR(EIO); } size -= toread; p->read += toread; p->offset += toread; if (size > 0) { RTMPPacket *prev = &prev_pkt[channel_id]; prev->data = p->data; prev->read = p->read; prev->offset = p->offset; return AVERROR(EAGAIN); } prev_pkt[channel_id].read = 0; // read complete; reset if needed return p->read; }
true
FFmpeg
f21c263c8979aa8a71c1c10909efb991679045c1
static int rtmp_packet_read_one_chunk(URLContext *h, RTMPPacket *p, int chunk_size, RTMPPacket **prev_pkt_ptr, int *nb_prev_pkt, uint8_t hdr) { uint8_t buf[16]; int channel_id, timestamp, size; uint32_t ts_field; uint32_t extra = 0; enum RTMPPacketType type; int written = 0; int ret, toread; RTMPPacket *prev_pkt; written++; channel_id = hdr & 0x3F; if (channel_id < 2) { buf[1] = 0; if (ffurl_read_complete(h, buf, channel_id + 1) != channel_id + 1) return AVERROR(EIO); written += channel_id + 1; channel_id = AV_RL16(buf) + 64; } if ((ret = ff_rtmp_check_alloc_array(prev_pkt_ptr, nb_prev_pkt, channel_id)) < 0) return ret; prev_pkt = *prev_pkt_ptr; size = prev_pkt[channel_id].size; type = prev_pkt[channel_id].type; extra = prev_pkt[channel_id].extra; hdr >>= 6; if (hdr == RTMP_PS_ONEBYTE) { ts_field = prev_pkt[channel_id].ts_field; } else { if (ffurl_read_complete(h, buf, 3) != 3) return AVERROR(EIO); written += 3; ts_field = AV_RB24(buf); if (hdr != RTMP_PS_FOURBYTES) { if (ffurl_read_complete(h, buf, 3) != 3) return AVERROR(EIO); written += 3; size = AV_RB24(buf); if (ffurl_read_complete(h, buf, 1) != 1) return AVERROR(EIO); written++; type = buf[0]; if (hdr == RTMP_PS_TWELVEBYTES) { if (ffurl_read_complete(h, buf, 4) != 4) return AVERROR(EIO); written += 4; extra = AV_RL32(buf); } } } if (ts_field == 0xFFFFFF) { if (ffurl_read_complete(h, buf, 4) != 4) return AVERROR(EIO); timestamp = AV_RB32(buf); } else { timestamp = ts_field; } if (hdr != RTMP_PS_TWELVEBYTES) timestamp += prev_pkt[channel_id].timestamp; if (!prev_pkt[channel_id].read) { if ((ret = ff_rtmp_packet_create(p, channel_id, type, timestamp, size)) < 0) return ret; p->read = written; p->offset = 0; prev_pkt[channel_id].ts_field = ts_field; prev_pkt[channel_id].timestamp = timestamp; } else { RTMPPacket *prev = &prev_pkt[channel_id]; p->data = prev->data; p->size = prev->size; p->channel_id = prev->channel_id; p->type = prev->type; p->ts_field = prev->ts_field; p->extra = prev->extra; p->offset = prev->offset; p->read = prev->read + written; p->timestamp = prev->timestamp; prev->data = NULL; } p->extra = extra; prev_pkt[channel_id].channel_id = channel_id; prev_pkt[channel_id].type = type; prev_pkt[channel_id].size = size; prev_pkt[channel_id].extra = extra; size = size - p->offset; toread = FFMIN(size, chunk_size); if (ffurl_read_complete(h, p->data + p->offset, toread) != toread) { ff_rtmp_packet_destroy(p); return AVERROR(EIO); } size -= toread; p->read += toread; p->offset += toread; if (size > 0) { RTMPPacket *prev = &prev_pkt[channel_id]; prev->data = p->data; prev->read = p->read; prev->offset = p->offset; return AVERROR(EAGAIN); } prev_pkt[channel_id].read = 0; return p->read; }
{ "code": [], "line_no": [] }
static int FUNC_0(URLContext *VAR_0, RTMPPacket *VAR_1, int VAR_2, RTMPPacket **VAR_3, int *VAR_4, uint8_t VAR_5) { uint8_t buf[16]; int VAR_6, VAR_7, VAR_8; uint32_t ts_field; uint32_t extra = 0; enum RTMPPacketType VAR_9; int VAR_10 = 0; int VAR_11, VAR_12; RTMPPacket *prev_pkt; VAR_10++; VAR_6 = VAR_5 & 0x3F; if (VAR_6 < 2) { buf[1] = 0; if (ffurl_read_complete(VAR_0, buf, VAR_6 + 1) != VAR_6 + 1) return AVERROR(EIO); VAR_10 += VAR_6 + 1; VAR_6 = AV_RL16(buf) + 64; } if ((VAR_11 = ff_rtmp_check_alloc_array(VAR_3, VAR_4, VAR_6)) < 0) return VAR_11; prev_pkt = *VAR_3; VAR_8 = prev_pkt[VAR_6].VAR_8; VAR_9 = prev_pkt[VAR_6].VAR_9; extra = prev_pkt[VAR_6].extra; VAR_5 >>= 6; if (VAR_5 == RTMP_PS_ONEBYTE) { ts_field = prev_pkt[VAR_6].ts_field; } else { if (ffurl_read_complete(VAR_0, buf, 3) != 3) return AVERROR(EIO); VAR_10 += 3; ts_field = AV_RB24(buf); if (VAR_5 != RTMP_PS_FOURBYTES) { if (ffurl_read_complete(VAR_0, buf, 3) != 3) return AVERROR(EIO); VAR_10 += 3; VAR_8 = AV_RB24(buf); if (ffurl_read_complete(VAR_0, buf, 1) != 1) return AVERROR(EIO); VAR_10++; VAR_9 = buf[0]; if (VAR_5 == RTMP_PS_TWELVEBYTES) { if (ffurl_read_complete(VAR_0, buf, 4) != 4) return AVERROR(EIO); VAR_10 += 4; extra = AV_RL32(buf); } } } if (ts_field == 0xFFFFFF) { if (ffurl_read_complete(VAR_0, buf, 4) != 4) return AVERROR(EIO); VAR_7 = AV_RB32(buf); } else { VAR_7 = ts_field; } if (VAR_5 != RTMP_PS_TWELVEBYTES) VAR_7 += prev_pkt[VAR_6].VAR_7; if (!prev_pkt[VAR_6].read) { if ((VAR_11 = ff_rtmp_packet_create(VAR_1, VAR_6, VAR_9, VAR_7, VAR_8)) < 0) return VAR_11; VAR_1->read = VAR_10; VAR_1->offset = 0; prev_pkt[VAR_6].ts_field = ts_field; prev_pkt[VAR_6].VAR_7 = VAR_7; } else { RTMPPacket *prev = &prev_pkt[VAR_6]; VAR_1->data = prev->data; VAR_1->VAR_8 = prev->VAR_8; VAR_1->VAR_6 = prev->VAR_6; VAR_1->VAR_9 = prev->VAR_9; VAR_1->ts_field = prev->ts_field; VAR_1->extra = prev->extra; VAR_1->offset = prev->offset; VAR_1->read = prev->read + VAR_10; VAR_1->VAR_7 = prev->VAR_7; prev->data = NULL; } VAR_1->extra = extra; prev_pkt[VAR_6].VAR_6 = VAR_6; prev_pkt[VAR_6].VAR_9 = VAR_9; prev_pkt[VAR_6].VAR_8 = VAR_8; prev_pkt[VAR_6].extra = extra; VAR_8 = VAR_8 - VAR_1->offset; VAR_12 = FFMIN(VAR_8, VAR_2); if (ffurl_read_complete(VAR_0, VAR_1->data + VAR_1->offset, VAR_12) != VAR_12) { ff_rtmp_packet_destroy(VAR_1); return AVERROR(EIO); } VAR_8 -= VAR_12; VAR_1->read += VAR_12; VAR_1->offset += VAR_12; if (VAR_8 > 0) { RTMPPacket *prev = &prev_pkt[VAR_6]; prev->data = VAR_1->data; prev->read = VAR_1->read; prev->offset = VAR_1->offset; return AVERROR(EAGAIN); } prev_pkt[VAR_6].read = 0; return VAR_1->read; }
[ "static int FUNC_0(URLContext *VAR_0, RTMPPacket *VAR_1,\nint VAR_2, RTMPPacket **VAR_3,\nint *VAR_4, uint8_t VAR_5)\n{", "uint8_t buf[16];", "int VAR_6, VAR_7, VAR_8;", "uint32_t ts_field;", "uint32_t extra = 0;", "enum RTMPPacketType VAR_9;", "int VAR_10 = 0;", "int VAR_11, VAR_12;", "RTMPPacket *prev_pkt;", "VAR_10++;", "VAR_6 = VAR_5 & 0x3F;", "if (VAR_6 < 2) {", "buf[1] = 0;", "if (ffurl_read_complete(VAR_0, buf, VAR_6 + 1) != VAR_6 + 1)\nreturn AVERROR(EIO);", "VAR_10 += VAR_6 + 1;", "VAR_6 = AV_RL16(buf) + 64;", "}", "if ((VAR_11 = ff_rtmp_check_alloc_array(VAR_3, VAR_4,\nVAR_6)) < 0)\nreturn VAR_11;", "prev_pkt = *VAR_3;", "VAR_8 = prev_pkt[VAR_6].VAR_8;", "VAR_9 = prev_pkt[VAR_6].VAR_9;", "extra = prev_pkt[VAR_6].extra;", "VAR_5 >>= 6;", "if (VAR_5 == RTMP_PS_ONEBYTE) {", "ts_field = prev_pkt[VAR_6].ts_field;", "} else {", "if (ffurl_read_complete(VAR_0, buf, 3) != 3)\nreturn AVERROR(EIO);", "VAR_10 += 3;", "ts_field = AV_RB24(buf);", "if (VAR_5 != RTMP_PS_FOURBYTES) {", "if (ffurl_read_complete(VAR_0, buf, 3) != 3)\nreturn AVERROR(EIO);", "VAR_10 += 3;", "VAR_8 = AV_RB24(buf);", "if (ffurl_read_complete(VAR_0, buf, 1) != 1)\nreturn AVERROR(EIO);", "VAR_10++;", "VAR_9 = buf[0];", "if (VAR_5 == RTMP_PS_TWELVEBYTES) {", "if (ffurl_read_complete(VAR_0, buf, 4) != 4)\nreturn AVERROR(EIO);", "VAR_10 += 4;", "extra = AV_RL32(buf);", "}", "}", "}", "if (ts_field == 0xFFFFFF) {", "if (ffurl_read_complete(VAR_0, buf, 4) != 4)\nreturn AVERROR(EIO);", "VAR_7 = AV_RB32(buf);", "} else {", "VAR_7 = ts_field;", "}", "if (VAR_5 != RTMP_PS_TWELVEBYTES)\nVAR_7 += prev_pkt[VAR_6].VAR_7;", "if (!prev_pkt[VAR_6].read) {", "if ((VAR_11 = ff_rtmp_packet_create(VAR_1, VAR_6, VAR_9, VAR_7,\nVAR_8)) < 0)\nreturn VAR_11;", "VAR_1->read = VAR_10;", "VAR_1->offset = 0;", "prev_pkt[VAR_6].ts_field = ts_field;", "prev_pkt[VAR_6].VAR_7 = VAR_7;", "} else {", "RTMPPacket *prev = &prev_pkt[VAR_6];", "VAR_1->data = prev->data;", "VAR_1->VAR_8 = prev->VAR_8;", "VAR_1->VAR_6 = prev->VAR_6;", "VAR_1->VAR_9 = prev->VAR_9;", "VAR_1->ts_field = prev->ts_field;", "VAR_1->extra = prev->extra;", "VAR_1->offset = prev->offset;", "VAR_1->read = prev->read + VAR_10;", "VAR_1->VAR_7 = prev->VAR_7;", "prev->data = NULL;", "}", "VAR_1->extra = extra;", "prev_pkt[VAR_6].VAR_6 = VAR_6;", "prev_pkt[VAR_6].VAR_9 = VAR_9;", "prev_pkt[VAR_6].VAR_8 = VAR_8;", "prev_pkt[VAR_6].extra = extra;", "VAR_8 = VAR_8 - VAR_1->offset;", "VAR_12 = FFMIN(VAR_8, VAR_2);", "if (ffurl_read_complete(VAR_0, VAR_1->data + VAR_1->offset, VAR_12) != VAR_12) {", "ff_rtmp_packet_destroy(VAR_1);", "return AVERROR(EIO);", "}", "VAR_8 -= VAR_12;", "VAR_1->read += VAR_12;", "VAR_1->offset += VAR_12;", "if (VAR_8 > 0) {", "RTMPPacket *prev = &prev_pkt[VAR_6];", "prev->data = VAR_1->data;", "prev->read = VAR_1->read;", "prev->offset = VAR_1->offset;", "return AVERROR(EAGAIN);", "}", "prev_pkt[VAR_6].read = 0;", "return VAR_1->read;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49, 51, 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73, 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83, 85 ], [ 87 ], [ 89 ], [ 91, 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101, 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117, 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129, 131 ], [ 135 ], [ 137, 139, 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 224 ], [ 226 ], [ 230 ], [ 232 ], [ 234 ] ]
24,137
int ff_h264_execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count) { int i, av_uninit(j); int current_ref_assigned = 0, err = 0; Picture *av_uninit(pic); if ((h->avctx->debug & FF_DEBUG_MMCO) && mmco_count == 0) av_log(h->avctx, AV_LOG_DEBUG, "no mmco here\n"); for (i = 0; i < mmco_count; i++) { int av_uninit(structure), av_uninit(frame_num); if (h->avctx->debug & FF_DEBUG_MMCO) av_log(h->avctx, AV_LOG_DEBUG, "mmco:%d %d %d\n", h->mmco[i].opcode, h->mmco[i].short_pic_num, h->mmco[i].long_arg); if (mmco[i].opcode == MMCO_SHORT2UNUSED || mmco[i].opcode == MMCO_SHORT2LONG) { frame_num = pic_num_extract(h, mmco[i].short_pic_num, &structure); pic = find_short(h, frame_num, &j); if (!pic) { if (mmco[i].opcode != MMCO_SHORT2LONG || !h->long_ref[mmco[i].long_arg] || h->long_ref[mmco[i].long_arg]->frame_num != frame_num) { av_log(h->avctx, AV_LOG_ERROR, "mmco: unref short failure\n"); err = AVERROR_INVALIDDATA; continue; switch (mmco[i].opcode) { case MMCO_SHORT2UNUSED: if (h->avctx->debug & FF_DEBUG_MMCO) av_log(h->avctx, AV_LOG_DEBUG, "mmco: unref short %d count %d\n", h->mmco[i].short_pic_num, h->short_ref_count); remove_short(h, frame_num, structure ^ PICT_FRAME); break; case MMCO_SHORT2LONG: if (h->long_ref[mmco[i].long_arg] != pic) remove_long(h, mmco[i].long_arg, 0); remove_short_at_index(h, j); h->long_ref[ mmco[i].long_arg ] = pic; if (h->long_ref[mmco[i].long_arg]) { h->long_ref[mmco[i].long_arg]->long_ref = 1; h->long_ref_count++; break; case MMCO_LONG2UNUSED: j = pic_num_extract(h, mmco[i].long_arg, &structure); pic = h->long_ref[j]; if (pic) { remove_long(h, j, structure ^ PICT_FRAME); } else if (h->avctx->debug & FF_DEBUG_MMCO) av_log(h->avctx, AV_LOG_DEBUG, "mmco: unref long failure\n"); break; case MMCO_LONG: // Comment below left from previous code as it is an interresting note. /* First field in pair is in short term list or * at a different long term index. * This is not allowed; see 7.4.3.3, notes 2 and 3. * Report the problem and keep the pair where it is, * and mark this field valid. */ if (h->long_ref[mmco[i].long_arg] != h->cur_pic_ptr) { remove_long(h, mmco[i].long_arg, 0); h->long_ref[mmco[i].long_arg] = h->cur_pic_ptr; h->long_ref[mmco[i].long_arg]->long_ref = 1; h->long_ref_count++; h->cur_pic_ptr->reference |= h->picture_structure; current_ref_assigned = 1; break; case MMCO_SET_MAX_LONG: assert(mmco[i].long_arg <= 16); // just remove the long term which index is greater than new max for (j = mmco[i].long_arg; j < 16; j++) { remove_long(h, j, 0); break; case MMCO_RESET: while (h->short_ref_count) { remove_short(h, h->short_ref[0]->frame_num, 0); for (j = 0; j < 16; j++) { remove_long(h, j, 0); h->frame_num = h->cur_pic_ptr->frame_num = 0; h->mmco_reset = 1; h->cur_pic_ptr->mmco_reset = 1; for (j = 0; j < MAX_DELAYED_PIC_COUNT; j++) h->last_pocs[j] = INT_MIN; break; default: assert(0); if (!current_ref_assigned) { /* Second field of complementary field pair; the first field of * which is already referenced. If short referenced, it * should be first entry in short_ref. If not, it must exist * in long_ref; trying to put it on the short list here is an * error in the encoded bit stream (ref: 7.4.3.3, NOTE 2 and 3). */ if (h->short_ref_count && h->short_ref[0] == h->cur_pic_ptr) { /* Just mark the second field valid */ h->cur_pic_ptr->reference = PICT_FRAME; } else if (h->cur_pic_ptr->long_ref) { av_log(h->avctx, AV_LOG_ERROR, "illegal short term reference " "assignment for second field " "in complementary field pair " "(first field is long term)\n"); err = AVERROR_INVALIDDATA; } else { pic = remove_short(h, h->cur_pic_ptr->frame_num, 0); if (pic) { av_log(h->avctx, AV_LOG_ERROR, "illegal short term buffer state detected\n"); err = AVERROR_INVALIDDATA; if (h->short_ref_count) memmove(&h->short_ref[1], &h->short_ref[0], h->short_ref_count * sizeof(Picture*)); h->short_ref[0] = h->cur_pic_ptr; h->short_ref_count++; h->cur_pic_ptr->reference |= h->picture_structure; if (h->long_ref_count + h->short_ref_count > FFMAX(h->sps.ref_frame_count, 1)) { /* We have too many reference frames, probably due to corrupted * stream. Need to discard one frame. Prevents overrun of the * short_ref and long_ref buffers. */ av_log(h->avctx, AV_LOG_ERROR, "number of reference frames (%d+%d) exceeds max (%d; probably " "corrupt input), discarding one\n", h->long_ref_count, h->short_ref_count, h->sps.ref_frame_count); err = AVERROR_INVALIDDATA; if (h->long_ref_count && !h->short_ref_count) { for (i = 0; i < 16; ++i) if (h->long_ref[i]) break; assert(i < 16); remove_long(h, i, 0); } else { pic = h->short_ref[h->short_ref_count - 1]; remove_short(h, pic->frame_num, 0); print_short_term(h); print_long_term(h); if(err >= 0 && h->long_ref_count==0 && h->short_ref_count<=2 && h->pps.ref_count[0]<=1 + (h->picture_structure != PICT_FRAME) && h->cur_pic_ptr->f.pict_type == AV_PICTURE_TYPE_I){ h->cur_pic_ptr->sync |= 1; if(!h->avctx->has_b_frames) h->sync = 2; return (h->avctx->err_recognition & AV_EF_EXPLODE) ? err : 0;
true
FFmpeg
92002db3eb437414281ad4fb6e84e34862f7fc92
int ff_h264_execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count) { int i, av_uninit(j); int current_ref_assigned = 0, err = 0; Picture *av_uninit(pic); if ((h->avctx->debug & FF_DEBUG_MMCO) && mmco_count == 0) av_log(h->avctx, AV_LOG_DEBUG, "no mmco here\n"); for (i = 0; i < mmco_count; i++) { int av_uninit(structure), av_uninit(frame_num); if (h->avctx->debug & FF_DEBUG_MMCO) av_log(h->avctx, AV_LOG_DEBUG, "mmco:%d %d %d\n", h->mmco[i].opcode, h->mmco[i].short_pic_num, h->mmco[i].long_arg); if (mmco[i].opcode == MMCO_SHORT2UNUSED || mmco[i].opcode == MMCO_SHORT2LONG) { frame_num = pic_num_extract(h, mmco[i].short_pic_num, &structure); pic = find_short(h, frame_num, &j); if (!pic) { if (mmco[i].opcode != MMCO_SHORT2LONG || !h->long_ref[mmco[i].long_arg] || h->long_ref[mmco[i].long_arg]->frame_num != frame_num) { av_log(h->avctx, AV_LOG_ERROR, "mmco: unref short failure\n"); err = AVERROR_INVALIDDATA; continue; switch (mmco[i].opcode) { case MMCO_SHORT2UNUSED: if (h->avctx->debug & FF_DEBUG_MMCO) av_log(h->avctx, AV_LOG_DEBUG, "mmco: unref short %d count %d\n", h->mmco[i].short_pic_num, h->short_ref_count); remove_short(h, frame_num, structure ^ PICT_FRAME); break; case MMCO_SHORT2LONG: if (h->long_ref[mmco[i].long_arg] != pic) remove_long(h, mmco[i].long_arg, 0); remove_short_at_index(h, j); h->long_ref[ mmco[i].long_arg ] = pic; if (h->long_ref[mmco[i].long_arg]) { h->long_ref[mmco[i].long_arg]->long_ref = 1; h->long_ref_count++; break; case MMCO_LONG2UNUSED: j = pic_num_extract(h, mmco[i].long_arg, &structure); pic = h->long_ref[j]; if (pic) { remove_long(h, j, structure ^ PICT_FRAME); } else if (h->avctx->debug & FF_DEBUG_MMCO) av_log(h->avctx, AV_LOG_DEBUG, "mmco: unref long failure\n"); break; case MMCO_LONG: if (h->long_ref[mmco[i].long_arg] != h->cur_pic_ptr) { remove_long(h, mmco[i].long_arg, 0); h->long_ref[mmco[i].long_arg] = h->cur_pic_ptr; h->long_ref[mmco[i].long_arg]->long_ref = 1; h->long_ref_count++; h->cur_pic_ptr->reference |= h->picture_structure; current_ref_assigned = 1; break; case MMCO_SET_MAX_LONG: assert(mmco[i].long_arg <= 16); for (j = mmco[i].long_arg; j < 16; j++) { remove_long(h, j, 0); break; case MMCO_RESET: while (h->short_ref_count) { remove_short(h, h->short_ref[0]->frame_num, 0); for (j = 0; j < 16; j++) { remove_long(h, j, 0); h->frame_num = h->cur_pic_ptr->frame_num = 0; h->mmco_reset = 1; h->cur_pic_ptr->mmco_reset = 1; for (j = 0; j < MAX_DELAYED_PIC_COUNT; j++) h->last_pocs[j] = INT_MIN; break; default: assert(0); if (!current_ref_assigned) { if (h->short_ref_count && h->short_ref[0] == h->cur_pic_ptr) { h->cur_pic_ptr->reference = PICT_FRAME; } else if (h->cur_pic_ptr->long_ref) { av_log(h->avctx, AV_LOG_ERROR, "illegal short term reference " "assignment for second field " "in complementary field pair " "(first field is long term)\n"); err = AVERROR_INVALIDDATA; } else { pic = remove_short(h, h->cur_pic_ptr->frame_num, 0); if (pic) { av_log(h->avctx, AV_LOG_ERROR, "illegal short term buffer state detected\n"); err = AVERROR_INVALIDDATA; if (h->short_ref_count) memmove(&h->short_ref[1], &h->short_ref[0], h->short_ref_count * sizeof(Picture*)); h->short_ref[0] = h->cur_pic_ptr; h->short_ref_count++; h->cur_pic_ptr->reference |= h->picture_structure; if (h->long_ref_count + h->short_ref_count > FFMAX(h->sps.ref_frame_count, 1)) { av_log(h->avctx, AV_LOG_ERROR, "number of reference frames (%d+%d) exceeds max (%d; probably " "corrupt input), discarding one\n", h->long_ref_count, h->short_ref_count, h->sps.ref_frame_count); err = AVERROR_INVALIDDATA; if (h->long_ref_count && !h->short_ref_count) { for (i = 0; i < 16; ++i) if (h->long_ref[i]) break; assert(i < 16); remove_long(h, i, 0); } else { pic = h->short_ref[h->short_ref_count - 1]; remove_short(h, pic->frame_num, 0); print_short_term(h); print_long_term(h); if(err >= 0 && h->long_ref_count==0 && h->short_ref_count<=2 && h->pps.ref_count[0]<=1 + (h->picture_structure != PICT_FRAME) && h->cur_pic_ptr->f.pict_type == AV_PICTURE_TYPE_I){ h->cur_pic_ptr->sync |= 1; if(!h->avctx->has_b_frames) h->sync = 2; return (h->avctx->err_recognition & AV_EF_EXPLODE) ? err : 0;
{ "code": [], "line_no": [] }
int FUNC_0(H264Context *VAR_0, MMCO *VAR_1, int VAR_2) { int VAR_3, FUNC_2(j); int VAR_4 = 0, VAR_5 = 0; Picture *FUNC_2(pic); if ((VAR_0->avctx->debug & FF_DEBUG_MMCO) && VAR_2 == 0) av_log(VAR_0->avctx, AV_LOG_DEBUG, "no VAR_1 here\n"); for (VAR_3 = 0; VAR_3 < VAR_2; VAR_3++) { int FUNC_2(structure), FUNC_2(frame_num); if (VAR_0->avctx->debug & FF_DEBUG_MMCO) av_log(VAR_0->avctx, AV_LOG_DEBUG, "VAR_1:%d %d %d\n", VAR_0->VAR_1[VAR_3].opcode, VAR_0->VAR_1[VAR_3].short_pic_num, VAR_0->VAR_1[VAR_3].long_arg); if (VAR_1[VAR_3].opcode == MMCO_SHORT2UNUSED || VAR_1[VAR_3].opcode == MMCO_SHORT2LONG) { frame_num = pic_num_extract(VAR_0, VAR_1[VAR_3].short_pic_num, &structure); pic = find_short(VAR_0, frame_num, &j); if (!pic) { if (VAR_1[VAR_3].opcode != MMCO_SHORT2LONG || !VAR_0->long_ref[VAR_1[VAR_3].long_arg] || VAR_0->long_ref[VAR_1[VAR_3].long_arg]->frame_num != frame_num) { av_log(VAR_0->avctx, AV_LOG_ERROR, "VAR_1: unref short failure\n"); VAR_5 = AVERROR_INVALIDDATA; continue; switch (VAR_1[VAR_3].opcode) { case MMCO_SHORT2UNUSED: if (VAR_0->avctx->debug & FF_DEBUG_MMCO) av_log(VAR_0->avctx, AV_LOG_DEBUG, "VAR_1: unref short %d count %d\n", VAR_0->VAR_1[VAR_3].short_pic_num, VAR_0->short_ref_count); remove_short(VAR_0, frame_num, structure ^ PICT_FRAME); break; case MMCO_SHORT2LONG: if (VAR_0->long_ref[VAR_1[VAR_3].long_arg] != pic) remove_long(VAR_0, VAR_1[VAR_3].long_arg, 0); remove_short_at_index(VAR_0, j); VAR_0->long_ref[ VAR_1[VAR_3].long_arg ] = pic; if (VAR_0->long_ref[VAR_1[VAR_3].long_arg]) { VAR_0->long_ref[VAR_1[VAR_3].long_arg]->long_ref = 1; VAR_0->long_ref_count++; break; case MMCO_LONG2UNUSED: j = pic_num_extract(VAR_0, VAR_1[VAR_3].long_arg, &structure); pic = VAR_0->long_ref[j]; if (pic) { remove_long(VAR_0, j, structure ^ PICT_FRAME); } else if (VAR_0->avctx->debug & FF_DEBUG_MMCO) av_log(VAR_0->avctx, AV_LOG_DEBUG, "VAR_1: unref long failure\n"); break; case MMCO_LONG: if (VAR_0->long_ref[VAR_1[VAR_3].long_arg] != VAR_0->cur_pic_ptr) { remove_long(VAR_0, VAR_1[VAR_3].long_arg, 0); VAR_0->long_ref[VAR_1[VAR_3].long_arg] = VAR_0->cur_pic_ptr; VAR_0->long_ref[VAR_1[VAR_3].long_arg]->long_ref = 1; VAR_0->long_ref_count++; VAR_0->cur_pic_ptr->reference |= VAR_0->picture_structure; VAR_4 = 1; break; case MMCO_SET_MAX_LONG: assert(VAR_1[VAR_3].long_arg <= 16); for (j = VAR_1[VAR_3].long_arg; j < 16; j++) { remove_long(VAR_0, j, 0); break; case MMCO_RESET: while (VAR_0->short_ref_count) { remove_short(VAR_0, VAR_0->short_ref[0]->frame_num, 0); for (j = 0; j < 16; j++) { remove_long(VAR_0, j, 0); VAR_0->frame_num = VAR_0->cur_pic_ptr->frame_num = 0; VAR_0->mmco_reset = 1; VAR_0->cur_pic_ptr->mmco_reset = 1; for (j = 0; j < MAX_DELAYED_PIC_COUNT; j++) VAR_0->last_pocs[j] = INT_MIN; break; default: assert(0); if (!VAR_4) { if (VAR_0->short_ref_count && VAR_0->short_ref[0] == VAR_0->cur_pic_ptr) { VAR_0->cur_pic_ptr->reference = PICT_FRAME; } else if (VAR_0->cur_pic_ptr->long_ref) { av_log(VAR_0->avctx, AV_LOG_ERROR, "illegal short term reference " "assignment for second field " "in complementary field pair " "(first field is long term)\n"); VAR_5 = AVERROR_INVALIDDATA; } else { pic = remove_short(VAR_0, VAR_0->cur_pic_ptr->frame_num, 0); if (pic) { av_log(VAR_0->avctx, AV_LOG_ERROR, "illegal short term buffer state detected\n"); VAR_5 = AVERROR_INVALIDDATA; if (VAR_0->short_ref_count) memmove(&VAR_0->short_ref[1], &VAR_0->short_ref[0], VAR_0->short_ref_count * sizeof(Picture*)); VAR_0->short_ref[0] = VAR_0->cur_pic_ptr; VAR_0->short_ref_count++; VAR_0->cur_pic_ptr->reference |= VAR_0->picture_structure; if (VAR_0->long_ref_count + VAR_0->short_ref_count > FFMAX(VAR_0->sps.ref_frame_count, 1)) { av_log(VAR_0->avctx, AV_LOG_ERROR, "number of reference frames (%d+%d) exceeds max (%d; probably " "corrupt input), discarding one\n", VAR_0->long_ref_count, VAR_0->short_ref_count, VAR_0->sps.ref_frame_count); VAR_5 = AVERROR_INVALIDDATA; if (VAR_0->long_ref_count && !VAR_0->short_ref_count) { for (VAR_3 = 0; VAR_3 < 16; ++VAR_3) if (VAR_0->long_ref[VAR_3]) break; assert(VAR_3 < 16); remove_long(VAR_0, VAR_3, 0); } else { pic = VAR_0->short_ref[VAR_0->short_ref_count - 1]; remove_short(VAR_0, pic->frame_num, 0); print_short_term(VAR_0); print_long_term(VAR_0); if(VAR_5 >= 0 && VAR_0->long_ref_count==0 && VAR_0->short_ref_count<=2 && VAR_0->pps.ref_count[0]<=1 + (VAR_0->picture_structure != PICT_FRAME) && VAR_0->cur_pic_ptr->f.pict_type == AV_PICTURE_TYPE_I){ VAR_0->cur_pic_ptr->sync |= 1; if(!VAR_0->avctx->has_b_frames) VAR_0->sync = 2; return (VAR_0->avctx->err_recognition & AV_EF_EXPLODE) ? VAR_5 : 0;
[ "int FUNC_0(H264Context *VAR_0, MMCO *VAR_1, int VAR_2)\n{", "int VAR_3, FUNC_2(j);", "int VAR_4 = 0, VAR_5 = 0;", "Picture *FUNC_2(pic);", "if ((VAR_0->avctx->debug & FF_DEBUG_MMCO) && VAR_2 == 0)\nav_log(VAR_0->avctx, AV_LOG_DEBUG, \"no VAR_1 here\\n\");", "for (VAR_3 = 0; VAR_3 < VAR_2; VAR_3++) {", "int FUNC_2(structure), FUNC_2(frame_num);", "if (VAR_0->avctx->debug & FF_DEBUG_MMCO)\nav_log(VAR_0->avctx, AV_LOG_DEBUG, \"VAR_1:%d %d %d\\n\", VAR_0->VAR_1[VAR_3].opcode,\nVAR_0->VAR_1[VAR_3].short_pic_num, VAR_0->VAR_1[VAR_3].long_arg);", "if (VAR_1[VAR_3].opcode == MMCO_SHORT2UNUSED ||\nVAR_1[VAR_3].opcode == MMCO_SHORT2LONG) {", "frame_num = pic_num_extract(VAR_0, VAR_1[VAR_3].short_pic_num, &structure);", "pic = find_short(VAR_0, frame_num, &j);", "if (!pic) {", "if (VAR_1[VAR_3].opcode != MMCO_SHORT2LONG ||\n!VAR_0->long_ref[VAR_1[VAR_3].long_arg] ||\nVAR_0->long_ref[VAR_1[VAR_3].long_arg]->frame_num != frame_num) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"VAR_1: unref short failure\\n\");", "VAR_5 = AVERROR_INVALIDDATA;", "continue;", "switch (VAR_1[VAR_3].opcode) {", "case MMCO_SHORT2UNUSED:\nif (VAR_0->avctx->debug & FF_DEBUG_MMCO)\nav_log(VAR_0->avctx, AV_LOG_DEBUG, \"VAR_1: unref short %d count %d\\n\",\nVAR_0->VAR_1[VAR_3].short_pic_num, VAR_0->short_ref_count);", "remove_short(VAR_0, frame_num, structure ^ PICT_FRAME);", "break;", "case MMCO_SHORT2LONG:\nif (VAR_0->long_ref[VAR_1[VAR_3].long_arg] != pic)\nremove_long(VAR_0, VAR_1[VAR_3].long_arg, 0);", "remove_short_at_index(VAR_0, j);", "VAR_0->long_ref[ VAR_1[VAR_3].long_arg ] = pic;", "if (VAR_0->long_ref[VAR_1[VAR_3].long_arg]) {", "VAR_0->long_ref[VAR_1[VAR_3].long_arg]->long_ref = 1;", "VAR_0->long_ref_count++;", "break;", "case MMCO_LONG2UNUSED:\nj = pic_num_extract(VAR_0, VAR_1[VAR_3].long_arg, &structure);", "pic = VAR_0->long_ref[j];", "if (pic) {", "remove_long(VAR_0, j, structure ^ PICT_FRAME);", "} else if (VAR_0->avctx->debug & FF_DEBUG_MMCO)", "av_log(VAR_0->avctx, AV_LOG_DEBUG, \"VAR_1: unref long failure\\n\");", "break;", "case MMCO_LONG:\nif (VAR_0->long_ref[VAR_1[VAR_3].long_arg] != VAR_0->cur_pic_ptr) {", "remove_long(VAR_0, VAR_1[VAR_3].long_arg, 0);", "VAR_0->long_ref[VAR_1[VAR_3].long_arg] = VAR_0->cur_pic_ptr;", "VAR_0->long_ref[VAR_1[VAR_3].long_arg]->long_ref = 1;", "VAR_0->long_ref_count++;", "VAR_0->cur_pic_ptr->reference |= VAR_0->picture_structure;", "VAR_4 = 1;", "break;", "case MMCO_SET_MAX_LONG:\nassert(VAR_1[VAR_3].long_arg <= 16);", "for (j = VAR_1[VAR_3].long_arg; j < 16; j++) {", "remove_long(VAR_0, j, 0);", "break;", "case MMCO_RESET:\nwhile (VAR_0->short_ref_count) {", "remove_short(VAR_0, VAR_0->short_ref[0]->frame_num, 0);", "for (j = 0; j < 16; j++) {", "remove_long(VAR_0, j, 0);", "VAR_0->frame_num = VAR_0->cur_pic_ptr->frame_num = 0;", "VAR_0->mmco_reset = 1;", "VAR_0->cur_pic_ptr->mmco_reset = 1;", "for (j = 0; j < MAX_DELAYED_PIC_COUNT; j++)", "VAR_0->last_pocs[j] = INT_MIN;", "break;", "default: assert(0);", "if (!VAR_4) {", "if (VAR_0->short_ref_count && VAR_0->short_ref[0] == VAR_0->cur_pic_ptr) {", "VAR_0->cur_pic_ptr->reference = PICT_FRAME;", "} else if (VAR_0->cur_pic_ptr->long_ref) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"illegal short term reference \"\n\"assignment for second field \"\n\"in complementary field pair \"\n\"(first field is long term)\\n\");", "VAR_5 = AVERROR_INVALIDDATA;", "} else {", "pic = remove_short(VAR_0, VAR_0->cur_pic_ptr->frame_num, 0);", "if (pic) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"illegal short term buffer state detected\\n\");", "VAR_5 = AVERROR_INVALIDDATA;", "if (VAR_0->short_ref_count)\nmemmove(&VAR_0->short_ref[1], &VAR_0->short_ref[0],\nVAR_0->short_ref_count * sizeof(Picture*));", "VAR_0->short_ref[0] = VAR_0->cur_pic_ptr;", "VAR_0->short_ref_count++;", "VAR_0->cur_pic_ptr->reference |= VAR_0->picture_structure;", "if (VAR_0->long_ref_count + VAR_0->short_ref_count > FFMAX(VAR_0->sps.ref_frame_count, 1)) {", "av_log(VAR_0->avctx, AV_LOG_ERROR,\n\"number of reference frames (%d+%d) exceeds max (%d; probably \"", "\"corrupt input), discarding one\\n\",\nVAR_0->long_ref_count, VAR_0->short_ref_count, VAR_0->sps.ref_frame_count);", "VAR_5 = AVERROR_INVALIDDATA;", "if (VAR_0->long_ref_count && !VAR_0->short_ref_count) {", "for (VAR_3 = 0; VAR_3 < 16; ++VAR_3)", "if (VAR_0->long_ref[VAR_3])\nbreak;", "assert(VAR_3 < 16);", "remove_long(VAR_0, VAR_3, 0);", "} else {", "pic = VAR_0->short_ref[VAR_0->short_ref_count - 1];", "remove_short(VAR_0, pic->frame_num, 0);", "print_short_term(VAR_0);", "print_long_term(VAR_0);", "if(VAR_5 >= 0 && VAR_0->long_ref_count==0 && VAR_0->short_ref_count<=2 && VAR_0->pps.ref_count[0]<=1 + (VAR_0->picture_structure != PICT_FRAME) && VAR_0->cur_pic_ptr->f.pict_type == AV_PICTURE_TYPE_I){", "VAR_0->cur_pic_ptr->sync |= 1;", "if(!VAR_0->avctx->has_b_frames)\nVAR_0->sync = 2;", "return (VAR_0->avctx->err_recognition & AV_EF_EXPLODE) ? VAR_5 : 0;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13, 15 ], [ 19 ], [ 21 ], [ 23, 25, 27 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41, 43, 45 ], [ 47 ], [ 49 ], [ 52 ], [ 58 ], [ 60, 62, 64, 66 ], [ 68 ], [ 70 ], [ 72, 74, 76 ], [ 80 ], [ 82 ], [ 84 ], [ 86 ], [ 88 ], [ 91 ], [ 93, 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109, 127 ], [ 129 ], [ 136 ], [ 138 ], [ 140 ], [ 145 ], [ 147 ], [ 149 ], [ 151, 153 ], [ 157 ], [ 159 ], [ 162 ], [ 164, 166 ], [ 168 ], [ 171 ], [ 173 ], [ 176 ], [ 178 ], [ 180 ], [ 182 ], [ 184 ], [ 186 ], [ 188 ], [ 194 ], [ 208 ], [ 212 ], [ 214 ], [ 216, 218, 220, 222 ], [ 224 ], [ 226 ], [ 228 ], [ 230 ], [ 232 ], [ 234 ], [ 239, 241, 243 ], [ 247 ], [ 249 ], [ 251 ], [ 257 ], [ 269, 271 ], [ 273, 275 ], [ 277 ], [ 281 ], [ 283 ], [ 285, 287 ], [ 291 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 305 ], [ 307 ], [ 311 ], [ 313 ], [ 315, 317 ], [ 322 ] ]
24,138
static void pc_init1(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, int pci_enabled) { char *filename; int ret, linux_boot, i; ram_addr_t ram_addr, bios_offset, option_rom_offset; ram_addr_t below_4g_mem_size, above_4g_mem_size = 0; int bios_size, isa_bios_size; PCIBus *pci_bus; ISADevice *isa_dev; int piix3_devfn = -1; CPUState *env; qemu_irq *cpu_irq; qemu_irq *isa_irq; qemu_irq *i8259; IsaIrqState *isa_irq_state; DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; DriveInfo *fd[MAX_FD]; int using_vga = cirrus_vga_enabled || std_vga_enabled || vmsvga_enabled; void *fw_cfg; if (ram_size >= 0xe0000000 ) { above_4g_mem_size = ram_size - 0xe0000000; below_4g_mem_size = 0xe0000000; } else { below_4g_mem_size = ram_size; } linux_boot = (kernel_filename != NULL); /* init CPUs */ if (cpu_model == NULL) { #ifdef TARGET_X86_64 cpu_model = "qemu64"; #else cpu_model = "qemu32"; #endif } for (i = 0; i < smp_cpus; i++) { env = pc_new_cpu(cpu_model); } vmport_init(); /* allocate RAM */ ram_addr = qemu_ram_alloc(0xa0000); cpu_register_physical_memory(0, 0xa0000, ram_addr); /* Allocate, even though we won't register, so we don't break the * phys_ram_base + PA assumption. This range includes vga (0xa0000 - 0xc0000), * and some bios areas, which will be registered later */ ram_addr = qemu_ram_alloc(0x100000 - 0xa0000); ram_addr = qemu_ram_alloc(below_4g_mem_size - 0x100000); cpu_register_physical_memory(0x100000, below_4g_mem_size - 0x100000, ram_addr); /* above 4giga memory allocation */ if (above_4g_mem_size > 0) { #if TARGET_PHYS_ADDR_BITS == 32 hw_error("To much RAM for 32-bit physical address"); #else ram_addr = qemu_ram_alloc(above_4g_mem_size); cpu_register_physical_memory(0x100000000ULL, above_4g_mem_size, ram_addr); #endif } /* BIOS load */ if (bios_name == NULL) bios_name = BIOS_FILENAME; filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); if (filename) { bios_size = get_image_size(filename); } else { bios_size = -1; } if (bios_size <= 0 || (bios_size % 65536) != 0) { goto bios_error; } bios_offset = qemu_ram_alloc(bios_size); ret = load_image(filename, qemu_get_ram_ptr(bios_offset)); if (ret != bios_size) { bios_error: fprintf(stderr, "qemu: could not load PC BIOS '%s'\n", bios_name); exit(1); } if (filename) { qemu_free(filename); } /* map the last 128KB of the BIOS in ISA space */ isa_bios_size = bios_size; if (isa_bios_size > (128 * 1024)) isa_bios_size = 128 * 1024; cpu_register_physical_memory(0x100000 - isa_bios_size, isa_bios_size, (bios_offset + bios_size - isa_bios_size) | IO_MEM_ROM); option_rom_offset = qemu_ram_alloc(PC_ROM_SIZE); cpu_register_physical_memory(PC_ROM_MIN_VGA, PC_ROM_SIZE, option_rom_offset); if (using_vga) { /* VGA BIOS load */ if (cirrus_vga_enabled) { rom_add_vga(VGABIOS_CIRRUS_FILENAME); } else { rom_add_vga(VGABIOS_FILENAME); } } /* map all the bios at the top of memory */ cpu_register_physical_memory((uint32_t)(-bios_size), bios_size, bios_offset | IO_MEM_ROM); fw_cfg = bochs_bios_init(); if (linux_boot) { load_linux(fw_cfg, kernel_filename, initrd_filename, kernel_cmdline, below_4g_mem_size); } for (i = 0; i < nb_option_roms; i++) { rom_add_option(option_rom[i]); } for (i = 0; i < nb_nics; i++) { char nic_oprom[1024]; const char *model = nd_table[i].model; if (!nd_table[i].bootable) continue; if (model == NULL) model = "e1000"; snprintf(nic_oprom, sizeof(nic_oprom), "pxe-%s.bin", model); rom_add_option(nic_oprom); } cpu_irq = qemu_allocate_irqs(pic_irq_request, NULL, 1); i8259 = i8259_init(cpu_irq[0]); isa_irq_state = qemu_mallocz(sizeof(*isa_irq_state)); isa_irq_state->i8259 = i8259; isa_irq = qemu_allocate_irqs(isa_irq_handler, isa_irq_state, 24); if (pci_enabled) { pci_bus = i440fx_init(&i440fx_state, &piix3_devfn, isa_irq); } else { pci_bus = NULL; isa_bus_new(NULL); } isa_bus_irqs(isa_irq); ferr_irq = isa_reserve_irq(13); /* init basic PC hardware */ register_ioport_write(0x80, 1, 1, ioport80_write, NULL); register_ioport_write(0xf0, 1, 1, ioportF0_write, NULL); if (cirrus_vga_enabled) { if (pci_enabled) { pci_cirrus_vga_init(pci_bus); } else { isa_cirrus_vga_init(); } } else if (vmsvga_enabled) { if (pci_enabled) pci_vmsvga_init(pci_bus); else fprintf(stderr, "%s: vmware_vga: no PCI bus\n", __FUNCTION__); } else if (std_vga_enabled) { if (pci_enabled) { pci_vga_init(pci_bus, 0, 0); } else { isa_vga_init(); } } rtc_state = rtc_init(2000); qemu_register_boot_set(pc_boot_set, rtc_state); register_ioport_read(0x92, 1, 1, ioport92_read, NULL); register_ioport_write(0x92, 1, 1, ioport92_write, NULL); if (pci_enabled) { isa_irq_state->ioapic = ioapic_init(); } pit = pit_init(0x40, isa_reserve_irq(0)); pcspk_init(pit); if (!no_hpet) { hpet_init(isa_irq); } for(i = 0; i < MAX_SERIAL_PORTS; i++) { if (serial_hds[i]) { serial_isa_init(i, serial_hds[i]); } } for(i = 0; i < MAX_PARALLEL_PORTS; i++) { if (parallel_hds[i]) { parallel_init(i, parallel_hds[i]); } } for(i = 0; i < nb_nics; i++) { NICInfo *nd = &nd_table[i]; if (!pci_enabled || (nd->model && strcmp(nd->model, "ne2k_isa") == 0)) pc_init_ne2k_isa(nd); else pci_nic_init_nofail(nd, "e1000", NULL); } if (drive_get_max_bus(IF_IDE) >= MAX_IDE_BUS) { fprintf(stderr, "qemu: too many IDE bus\n"); exit(1); } for(i = 0; i < MAX_IDE_BUS * MAX_IDE_DEVS; i++) { hd[i] = drive_get(IF_IDE, i / MAX_IDE_DEVS, i % MAX_IDE_DEVS); } if (pci_enabled) { pci_piix3_ide_init(pci_bus, hd, piix3_devfn + 1); } else { for(i = 0; i < MAX_IDE_BUS; i++) { isa_ide_init(ide_iobase[i], ide_iobase2[i], ide_irq[i], hd[MAX_IDE_DEVS * i], hd[MAX_IDE_DEVS * i + 1]); } } isa_dev = isa_create_simple("i8042"); DMA_init(0); #ifdef HAS_AUDIO audio_init(pci_enabled ? pci_bus : NULL, isa_irq); #endif for(i = 0; i < MAX_FD; i++) { fd[i] = drive_get(IF_FLOPPY, 0, i); } floppy_controller = fdctrl_init_isa(fd); cmos_init(below_4g_mem_size, above_4g_mem_size, boot_device, hd); if (pci_enabled && usb_enabled) { usb_uhci_piix3_init(pci_bus, piix3_devfn + 2); } if (pci_enabled && acpi_enabled) { uint8_t *eeprom_buf = qemu_mallocz(8 * 256); /* XXX: make this persistent */ i2c_bus *smbus; /* TODO: Populate SPD eeprom data. */ smbus = piix4_pm_init(pci_bus, piix3_devfn + 3, 0xb100, isa_reserve_irq(9)); for (i = 0; i < 8; i++) { DeviceState *eeprom; eeprom = qdev_create((BusState *)smbus, "smbus-eeprom"); qdev_prop_set_uint8(eeprom, "address", 0x50 + i); qdev_prop_set_ptr(eeprom, "data", eeprom_buf + (i * 256)); qdev_init(eeprom); } piix4_acpi_system_hot_add_init(pci_bus); } if (i440fx_state) { i440fx_init_memory_mappings(i440fx_state); } if (pci_enabled) { int max_bus; int bus; max_bus = drive_get_max_bus(IF_SCSI); for (bus = 0; bus <= max_bus; bus++) { pci_create_simple(pci_bus, -1, "lsi53c895a"); } } /* Add virtio console devices */ if (pci_enabled) { for(i = 0; i < MAX_VIRTIO_CONSOLES; i++) { if (virtcon_hds[i]) { pci_create_simple(pci_bus, -1, "virtio-console-pci"); } } } }
true
qemu
e23a1b33b53d25510320b26d9f154e19c6c99725
static void pc_init1(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, int pci_enabled) { char *filename; int ret, linux_boot, i; ram_addr_t ram_addr, bios_offset, option_rom_offset; ram_addr_t below_4g_mem_size, above_4g_mem_size = 0; int bios_size, isa_bios_size; PCIBus *pci_bus; ISADevice *isa_dev; int piix3_devfn = -1; CPUState *env; qemu_irq *cpu_irq; qemu_irq *isa_irq; qemu_irq *i8259; IsaIrqState *isa_irq_state; DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; DriveInfo *fd[MAX_FD]; int using_vga = cirrus_vga_enabled || std_vga_enabled || vmsvga_enabled; void *fw_cfg; if (ram_size >= 0xe0000000 ) { above_4g_mem_size = ram_size - 0xe0000000; below_4g_mem_size = 0xe0000000; } else { below_4g_mem_size = ram_size; } linux_boot = (kernel_filename != NULL); if (cpu_model == NULL) { #ifdef TARGET_X86_64 cpu_model = "qemu64"; #else cpu_model = "qemu32"; #endif } for (i = 0; i < smp_cpus; i++) { env = pc_new_cpu(cpu_model); } vmport_init(); ram_addr = qemu_ram_alloc(0xa0000); cpu_register_physical_memory(0, 0xa0000, ram_addr); ram_addr = qemu_ram_alloc(0x100000 - 0xa0000); ram_addr = qemu_ram_alloc(below_4g_mem_size - 0x100000); cpu_register_physical_memory(0x100000, below_4g_mem_size - 0x100000, ram_addr); if (above_4g_mem_size > 0) { #if TARGET_PHYS_ADDR_BITS == 32 hw_error("To much RAM for 32-bit physical address"); #else ram_addr = qemu_ram_alloc(above_4g_mem_size); cpu_register_physical_memory(0x100000000ULL, above_4g_mem_size, ram_addr); #endif } if (bios_name == NULL) bios_name = BIOS_FILENAME; filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); if (filename) { bios_size = get_image_size(filename); } else { bios_size = -1; } if (bios_size <= 0 || (bios_size % 65536) != 0) { goto bios_error; } bios_offset = qemu_ram_alloc(bios_size); ret = load_image(filename, qemu_get_ram_ptr(bios_offset)); if (ret != bios_size) { bios_error: fprintf(stderr, "qemu: could not load PC BIOS '%s'\n", bios_name); exit(1); } if (filename) { qemu_free(filename); } isa_bios_size = bios_size; if (isa_bios_size > (128 * 1024)) isa_bios_size = 128 * 1024; cpu_register_physical_memory(0x100000 - isa_bios_size, isa_bios_size, (bios_offset + bios_size - isa_bios_size) | IO_MEM_ROM); option_rom_offset = qemu_ram_alloc(PC_ROM_SIZE); cpu_register_physical_memory(PC_ROM_MIN_VGA, PC_ROM_SIZE, option_rom_offset); if (using_vga) { if (cirrus_vga_enabled) { rom_add_vga(VGABIOS_CIRRUS_FILENAME); } else { rom_add_vga(VGABIOS_FILENAME); } } cpu_register_physical_memory((uint32_t)(-bios_size), bios_size, bios_offset | IO_MEM_ROM); fw_cfg = bochs_bios_init(); if (linux_boot) { load_linux(fw_cfg, kernel_filename, initrd_filename, kernel_cmdline, below_4g_mem_size); } for (i = 0; i < nb_option_roms; i++) { rom_add_option(option_rom[i]); } for (i = 0; i < nb_nics; i++) { char nic_oprom[1024]; const char *model = nd_table[i].model; if (!nd_table[i].bootable) continue; if (model == NULL) model = "e1000"; snprintf(nic_oprom, sizeof(nic_oprom), "pxe-%s.bin", model); rom_add_option(nic_oprom); } cpu_irq = qemu_allocate_irqs(pic_irq_request, NULL, 1); i8259 = i8259_init(cpu_irq[0]); isa_irq_state = qemu_mallocz(sizeof(*isa_irq_state)); isa_irq_state->i8259 = i8259; isa_irq = qemu_allocate_irqs(isa_irq_handler, isa_irq_state, 24); if (pci_enabled) { pci_bus = i440fx_init(&i440fx_state, &piix3_devfn, isa_irq); } else { pci_bus = NULL; isa_bus_new(NULL); } isa_bus_irqs(isa_irq); ferr_irq = isa_reserve_irq(13); register_ioport_write(0x80, 1, 1, ioport80_write, NULL); register_ioport_write(0xf0, 1, 1, ioportF0_write, NULL); if (cirrus_vga_enabled) { if (pci_enabled) { pci_cirrus_vga_init(pci_bus); } else { isa_cirrus_vga_init(); } } else if (vmsvga_enabled) { if (pci_enabled) pci_vmsvga_init(pci_bus); else fprintf(stderr, "%s: vmware_vga: no PCI bus\n", __FUNCTION__); } else if (std_vga_enabled) { if (pci_enabled) { pci_vga_init(pci_bus, 0, 0); } else { isa_vga_init(); } } rtc_state = rtc_init(2000); qemu_register_boot_set(pc_boot_set, rtc_state); register_ioport_read(0x92, 1, 1, ioport92_read, NULL); register_ioport_write(0x92, 1, 1, ioport92_write, NULL); if (pci_enabled) { isa_irq_state->ioapic = ioapic_init(); } pit = pit_init(0x40, isa_reserve_irq(0)); pcspk_init(pit); if (!no_hpet) { hpet_init(isa_irq); } for(i = 0; i < MAX_SERIAL_PORTS; i++) { if (serial_hds[i]) { serial_isa_init(i, serial_hds[i]); } } for(i = 0; i < MAX_PARALLEL_PORTS; i++) { if (parallel_hds[i]) { parallel_init(i, parallel_hds[i]); } } for(i = 0; i < nb_nics; i++) { NICInfo *nd = &nd_table[i]; if (!pci_enabled || (nd->model && strcmp(nd->model, "ne2k_isa") == 0)) pc_init_ne2k_isa(nd); else pci_nic_init_nofail(nd, "e1000", NULL); } if (drive_get_max_bus(IF_IDE) >= MAX_IDE_BUS) { fprintf(stderr, "qemu: too many IDE bus\n"); exit(1); } for(i = 0; i < MAX_IDE_BUS * MAX_IDE_DEVS; i++) { hd[i] = drive_get(IF_IDE, i / MAX_IDE_DEVS, i % MAX_IDE_DEVS); } if (pci_enabled) { pci_piix3_ide_init(pci_bus, hd, piix3_devfn + 1); } else { for(i = 0; i < MAX_IDE_BUS; i++) { isa_ide_init(ide_iobase[i], ide_iobase2[i], ide_irq[i], hd[MAX_IDE_DEVS * i], hd[MAX_IDE_DEVS * i + 1]); } } isa_dev = isa_create_simple("i8042"); DMA_init(0); #ifdef HAS_AUDIO audio_init(pci_enabled ? pci_bus : NULL, isa_irq); #endif for(i = 0; i < MAX_FD; i++) { fd[i] = drive_get(IF_FLOPPY, 0, i); } floppy_controller = fdctrl_init_isa(fd); cmos_init(below_4g_mem_size, above_4g_mem_size, boot_device, hd); if (pci_enabled && usb_enabled) { usb_uhci_piix3_init(pci_bus, piix3_devfn + 2); } if (pci_enabled && acpi_enabled) { uint8_t *eeprom_buf = qemu_mallocz(8 * 256); i2c_bus *smbus; smbus = piix4_pm_init(pci_bus, piix3_devfn + 3, 0xb100, isa_reserve_irq(9)); for (i = 0; i < 8; i++) { DeviceState *eeprom; eeprom = qdev_create((BusState *)smbus, "smbus-eeprom"); qdev_prop_set_uint8(eeprom, "address", 0x50 + i); qdev_prop_set_ptr(eeprom, "data", eeprom_buf + (i * 256)); qdev_init(eeprom); } piix4_acpi_system_hot_add_init(pci_bus); } if (i440fx_state) { i440fx_init_memory_mappings(i440fx_state); } if (pci_enabled) { int max_bus; int bus; max_bus = drive_get_max_bus(IF_SCSI); for (bus = 0; bus <= max_bus; bus++) { pci_create_simple(pci_bus, -1, "lsi53c895a"); } } if (pci_enabled) { for(i = 0; i < MAX_VIRTIO_CONSOLES; i++) { if (virtcon_hds[i]) { pci_create_simple(pci_bus, -1, "virtio-console-pci"); } } } }
{ "code": [ " qdev_init(eeprom);" ], "line_no": [ 549 ] }
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, int VAR_6) { char *VAR_7; int VAR_8, VAR_9, VAR_10; ram_addr_t ram_addr, bios_offset, option_rom_offset; ram_addr_t below_4g_mem_size, above_4g_mem_size = 0; int VAR_11, VAR_12; PCIBus *pci_bus; ISADevice *isa_dev; int VAR_13 = -1; CPUState *env; qemu_irq *cpu_irq; qemu_irq *isa_irq; qemu_irq *i8259; IsaIrqState *isa_irq_state; DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; DriveInfo *fd[MAX_FD]; int VAR_14 = cirrus_vga_enabled || std_vga_enabled || vmsvga_enabled; void *VAR_15; if (VAR_0 >= 0xe0000000 ) { above_4g_mem_size = VAR_0 - 0xe0000000; below_4g_mem_size = 0xe0000000; } else { below_4g_mem_size = VAR_0; } VAR_9 = (VAR_2 != NULL); if (VAR_5 == NULL) { #ifdef TARGET_X86_64 VAR_5 = "qemu64"; #else VAR_5 = "qemu32"; #endif } for (VAR_10 = 0; VAR_10 < smp_cpus; VAR_10++) { env = pc_new_cpu(VAR_5); } vmport_init(); ram_addr = qemu_ram_alloc(0xa0000); cpu_register_physical_memory(0, 0xa0000, ram_addr); ram_addr = qemu_ram_alloc(0x100000 - 0xa0000); ram_addr = qemu_ram_alloc(below_4g_mem_size - 0x100000); cpu_register_physical_memory(0x100000, below_4g_mem_size - 0x100000, ram_addr); if (above_4g_mem_size > 0) { #if TARGET_PHYS_ADDR_BITS == 32 hw_error("To much RAM for 32-bit physical address"); #else ram_addr = qemu_ram_alloc(above_4g_mem_size); cpu_register_physical_memory(0x100000000ULL, above_4g_mem_size, ram_addr); #endif } if (bios_name == NULL) bios_name = BIOS_FILENAME; VAR_7 = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); if (VAR_7) { VAR_11 = get_image_size(VAR_7); } else { VAR_11 = -1; } if (VAR_11 <= 0 || (VAR_11 % 65536) != 0) { goto bios_error; } bios_offset = qemu_ram_alloc(VAR_11); VAR_8 = load_image(VAR_7, qemu_get_ram_ptr(bios_offset)); if (VAR_8 != VAR_11) { bios_error: fprintf(stderr, "qemu: could not load PC BIOS '%s'\n", bios_name); exit(1); } if (VAR_7) { qemu_free(VAR_7); } VAR_12 = VAR_11; if (VAR_12 > (128 * 1024)) VAR_12 = 128 * 1024; cpu_register_physical_memory(0x100000 - VAR_12, VAR_12, (bios_offset + VAR_11 - VAR_12) | IO_MEM_ROM); option_rom_offset = qemu_ram_alloc(PC_ROM_SIZE); cpu_register_physical_memory(PC_ROM_MIN_VGA, PC_ROM_SIZE, option_rom_offset); if (VAR_14) { if (cirrus_vga_enabled) { rom_add_vga(VGABIOS_CIRRUS_FILENAME); } else { rom_add_vga(VGABIOS_FILENAME); } } cpu_register_physical_memory((uint32_t)(-VAR_11), VAR_11, bios_offset | IO_MEM_ROM); VAR_15 = bochs_bios_init(); if (VAR_9) { load_linux(VAR_15, VAR_2, VAR_4, VAR_3, below_4g_mem_size); } for (VAR_10 = 0; VAR_10 < nb_option_roms; VAR_10++) { rom_add_option(option_rom[VAR_10]); } for (VAR_10 = 0; VAR_10 < nb_nics; VAR_10++) { char nic_oprom[1024]; const char *model = nd_table[VAR_10].model; if (!nd_table[VAR_10].bootable) continue; if (model == NULL) model = "e1000"; snprintf(nic_oprom, sizeof(nic_oprom), "pxe-%s.bin", model); rom_add_option(nic_oprom); } cpu_irq = qemu_allocate_irqs(pic_irq_request, NULL, 1); i8259 = i8259_init(cpu_irq[0]); isa_irq_state = qemu_mallocz(sizeof(*isa_irq_state)); isa_irq_state->i8259 = i8259; isa_irq = qemu_allocate_irqs(isa_irq_handler, isa_irq_state, 24); if (VAR_6) { pci_bus = i440fx_init(&i440fx_state, &VAR_13, isa_irq); } else { pci_bus = NULL; isa_bus_new(NULL); } isa_bus_irqs(isa_irq); ferr_irq = isa_reserve_irq(13); register_ioport_write(0x80, 1, 1, ioport80_write, NULL); register_ioport_write(0xf0, 1, 1, ioportF0_write, NULL); if (cirrus_vga_enabled) { if (VAR_6) { pci_cirrus_vga_init(pci_bus); } else { isa_cirrus_vga_init(); } } else if (vmsvga_enabled) { if (VAR_6) pci_vmsvga_init(pci_bus); else fprintf(stderr, "%s: vmware_vga: no PCI VAR_17\n", __FUNCTION__); } else if (std_vga_enabled) { if (VAR_6) { pci_vga_init(pci_bus, 0, 0); } else { isa_vga_init(); } } rtc_state = rtc_init(2000); qemu_register_boot_set(pc_boot_set, rtc_state); register_ioport_read(0x92, 1, 1, ioport92_read, NULL); register_ioport_write(0x92, 1, 1, ioport92_write, NULL); if (VAR_6) { isa_irq_state->ioapic = ioapic_init(); } pit = pit_init(0x40, isa_reserve_irq(0)); pcspk_init(pit); if (!no_hpet) { hpet_init(isa_irq); } for(VAR_10 = 0; VAR_10 < MAX_SERIAL_PORTS; VAR_10++) { if (serial_hds[VAR_10]) { serial_isa_init(VAR_10, serial_hds[VAR_10]); } } for(VAR_10 = 0; VAR_10 < MAX_PARALLEL_PORTS; VAR_10++) { if (parallel_hds[VAR_10]) { parallel_init(VAR_10, parallel_hds[VAR_10]); } } for(VAR_10 = 0; VAR_10 < nb_nics; VAR_10++) { NICInfo *nd = &nd_table[VAR_10]; if (!VAR_6 || (nd->model && strcmp(nd->model, "ne2k_isa") == 0)) pc_init_ne2k_isa(nd); else pci_nic_init_nofail(nd, "e1000", NULL); } if (drive_get_max_bus(IF_IDE) >= MAX_IDE_BUS) { fprintf(stderr, "qemu: too many IDE VAR_17\n"); exit(1); } for(VAR_10 = 0; VAR_10 < MAX_IDE_BUS * MAX_IDE_DEVS; VAR_10++) { hd[VAR_10] = drive_get(IF_IDE, VAR_10 / MAX_IDE_DEVS, VAR_10 % MAX_IDE_DEVS); } if (VAR_6) { pci_piix3_ide_init(pci_bus, hd, VAR_13 + 1); } else { for(VAR_10 = 0; VAR_10 < MAX_IDE_BUS; VAR_10++) { isa_ide_init(ide_iobase[VAR_10], ide_iobase2[VAR_10], ide_irq[VAR_10], hd[MAX_IDE_DEVS * VAR_10], hd[MAX_IDE_DEVS * VAR_10 + 1]); } } isa_dev = isa_create_simple("i8042"); DMA_init(0); #ifdef HAS_AUDIO audio_init(VAR_6 ? pci_bus : NULL, isa_irq); #endif for(VAR_10 = 0; VAR_10 < MAX_FD; VAR_10++) { fd[VAR_10] = drive_get(IF_FLOPPY, 0, VAR_10); } floppy_controller = fdctrl_init_isa(fd); cmos_init(below_4g_mem_size, above_4g_mem_size, VAR_1, hd); if (VAR_6 && usb_enabled) { usb_uhci_piix3_init(pci_bus, VAR_13 + 2); } if (VAR_6 && acpi_enabled) { uint8_t *eeprom_buf = qemu_mallocz(8 * 256); i2c_bus *smbus; smbus = piix4_pm_init(pci_bus, VAR_13 + 3, 0xb100, isa_reserve_irq(9)); for (VAR_10 = 0; VAR_10 < 8; VAR_10++) { DeviceState *eeprom; eeprom = qdev_create((BusState *)smbus, "smbus-eeprom"); qdev_prop_set_uint8(eeprom, "address", 0x50 + VAR_10); qdev_prop_set_ptr(eeprom, "data", eeprom_buf + (VAR_10 * 256)); qdev_init(eeprom); } piix4_acpi_system_hot_add_init(pci_bus); } if (i440fx_state) { i440fx_init_memory_mappings(i440fx_state); } if (VAR_6) { int VAR_16; int VAR_17; VAR_16 = drive_get_max_bus(IF_SCSI); for (VAR_17 = 0; VAR_17 <= VAR_16; VAR_17++) { pci_create_simple(pci_bus, -1, "lsi53c895a"); } } if (VAR_6) { for(VAR_10 = 0; VAR_10 < MAX_VIRTIO_CONSOLES; VAR_10++) { if (virtcon_hds[VAR_10]) { pci_create_simple(pci_bus, -1, "virtio-console-pci"); } } } }
[ "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,\nint VAR_6)\n{", "char *VAR_7;", "int VAR_8, VAR_9, VAR_10;", "ram_addr_t ram_addr, bios_offset, option_rom_offset;", "ram_addr_t below_4g_mem_size, above_4g_mem_size = 0;", "int VAR_11, VAR_12;", "PCIBus *pci_bus;", "ISADevice *isa_dev;", "int VAR_13 = -1;", "CPUState *env;", "qemu_irq *cpu_irq;", "qemu_irq *isa_irq;", "qemu_irq *i8259;", "IsaIrqState *isa_irq_state;", "DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];", "DriveInfo *fd[MAX_FD];", "int VAR_14 = cirrus_vga_enabled || std_vga_enabled || vmsvga_enabled;", "void *VAR_15;", "if (VAR_0 >= 0xe0000000 ) {", "above_4g_mem_size = VAR_0 - 0xe0000000;", "below_4g_mem_size = 0xe0000000;", "} else {", "below_4g_mem_size = VAR_0;", "}", "VAR_9 = (VAR_2 != NULL);", "if (VAR_5 == NULL) {", "#ifdef TARGET_X86_64\nVAR_5 = \"qemu64\";", "#else\nVAR_5 = \"qemu32\";", "#endif\n}", "for (VAR_10 = 0; VAR_10 < smp_cpus; VAR_10++) {", "env = pc_new_cpu(VAR_5);", "}", "vmport_init();", "ram_addr = qemu_ram_alloc(0xa0000);", "cpu_register_physical_memory(0, 0xa0000, ram_addr);", "ram_addr = qemu_ram_alloc(0x100000 - 0xa0000);", "ram_addr = qemu_ram_alloc(below_4g_mem_size - 0x100000);", "cpu_register_physical_memory(0x100000,\nbelow_4g_mem_size - 0x100000,\nram_addr);", "if (above_4g_mem_size > 0) {", "#if TARGET_PHYS_ADDR_BITS == 32\nhw_error(\"To much RAM for 32-bit physical address\");", "#else\nram_addr = qemu_ram_alloc(above_4g_mem_size);", "cpu_register_physical_memory(0x100000000ULL,\nabove_4g_mem_size,\nram_addr);", "#endif\n}", "if (bios_name == NULL)\nbios_name = BIOS_FILENAME;", "VAR_7 = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);", "if (VAR_7) {", "VAR_11 = get_image_size(VAR_7);", "} else {", "VAR_11 = -1;", "}", "if (VAR_11 <= 0 ||\n(VAR_11 % 65536) != 0) {", "goto bios_error;", "}", "bios_offset = qemu_ram_alloc(VAR_11);", "VAR_8 = load_image(VAR_7, qemu_get_ram_ptr(bios_offset));", "if (VAR_8 != VAR_11) {", "bios_error:\nfprintf(stderr, \"qemu: could not load PC BIOS '%s'\\n\", bios_name);", "exit(1);", "}", "if (VAR_7) {", "qemu_free(VAR_7);", "}", "VAR_12 = VAR_11;", "if (VAR_12 > (128 * 1024))\nVAR_12 = 128 * 1024;", "cpu_register_physical_memory(0x100000 - VAR_12,\nVAR_12,\n(bios_offset + VAR_11 - VAR_12) | IO_MEM_ROM);", "option_rom_offset = qemu_ram_alloc(PC_ROM_SIZE);", "cpu_register_physical_memory(PC_ROM_MIN_VGA, PC_ROM_SIZE, option_rom_offset);", "if (VAR_14) {", "if (cirrus_vga_enabled) {", "rom_add_vga(VGABIOS_CIRRUS_FILENAME);", "} else {", "rom_add_vga(VGABIOS_FILENAME);", "}", "}", "cpu_register_physical_memory((uint32_t)(-VAR_11),\nVAR_11, bios_offset | IO_MEM_ROM);", "VAR_15 = bochs_bios_init();", "if (VAR_9) {", "load_linux(VAR_15, VAR_2, VAR_4, VAR_3, below_4g_mem_size);", "}", "for (VAR_10 = 0; VAR_10 < nb_option_roms; VAR_10++) {", "rom_add_option(option_rom[VAR_10]);", "}", "for (VAR_10 = 0; VAR_10 < nb_nics; VAR_10++) {", "char nic_oprom[1024];", "const char *model = nd_table[VAR_10].model;", "if (!nd_table[VAR_10].bootable)\ncontinue;", "if (model == NULL)\nmodel = \"e1000\";", "snprintf(nic_oprom, sizeof(nic_oprom), \"pxe-%s.bin\", model);", "rom_add_option(nic_oprom);", "}", "cpu_irq = qemu_allocate_irqs(pic_irq_request, NULL, 1);", "i8259 = i8259_init(cpu_irq[0]);", "isa_irq_state = qemu_mallocz(sizeof(*isa_irq_state));", "isa_irq_state->i8259 = i8259;", "isa_irq = qemu_allocate_irqs(isa_irq_handler, isa_irq_state, 24);", "if (VAR_6) {", "pci_bus = i440fx_init(&i440fx_state, &VAR_13, isa_irq);", "} else {", "pci_bus = NULL;", "isa_bus_new(NULL);", "}", "isa_bus_irqs(isa_irq);", "ferr_irq = isa_reserve_irq(13);", "register_ioport_write(0x80, 1, 1, ioport80_write, NULL);", "register_ioport_write(0xf0, 1, 1, ioportF0_write, NULL);", "if (cirrus_vga_enabled) {", "if (VAR_6) {", "pci_cirrus_vga_init(pci_bus);", "} else {", "isa_cirrus_vga_init();", "}", "} else if (vmsvga_enabled) {", "if (VAR_6)\npci_vmsvga_init(pci_bus);", "else\nfprintf(stderr, \"%s: vmware_vga: no PCI VAR_17\\n\", __FUNCTION__);", "} else if (std_vga_enabled) {", "if (VAR_6) {", "pci_vga_init(pci_bus, 0, 0);", "} else {", "isa_vga_init();", "}", "}", "rtc_state = rtc_init(2000);", "qemu_register_boot_set(pc_boot_set, rtc_state);", "register_ioport_read(0x92, 1, 1, ioport92_read, NULL);", "register_ioport_write(0x92, 1, 1, ioport92_write, NULL);", "if (VAR_6) {", "isa_irq_state->ioapic = ioapic_init();", "}", "pit = pit_init(0x40, isa_reserve_irq(0));", "pcspk_init(pit);", "if (!no_hpet) {", "hpet_init(isa_irq);", "}", "for(VAR_10 = 0; VAR_10 < MAX_SERIAL_PORTS; VAR_10++) {", "if (serial_hds[VAR_10]) {", "serial_isa_init(VAR_10, serial_hds[VAR_10]);", "}", "}", "for(VAR_10 = 0; VAR_10 < MAX_PARALLEL_PORTS; VAR_10++) {", "if (parallel_hds[VAR_10]) {", "parallel_init(VAR_10, parallel_hds[VAR_10]);", "}", "}", "for(VAR_10 = 0; VAR_10 < nb_nics; VAR_10++) {", "NICInfo *nd = &nd_table[VAR_10];", "if (!VAR_6 || (nd->model && strcmp(nd->model, \"ne2k_isa\") == 0))\npc_init_ne2k_isa(nd);", "else\npci_nic_init_nofail(nd, \"e1000\", NULL);", "}", "if (drive_get_max_bus(IF_IDE) >= MAX_IDE_BUS) {", "fprintf(stderr, \"qemu: too many IDE VAR_17\\n\");", "exit(1);", "}", "for(VAR_10 = 0; VAR_10 < MAX_IDE_BUS * MAX_IDE_DEVS; VAR_10++) {", "hd[VAR_10] = drive_get(IF_IDE, VAR_10 / MAX_IDE_DEVS, VAR_10 % MAX_IDE_DEVS);", "}", "if (VAR_6) {", "pci_piix3_ide_init(pci_bus, hd, VAR_13 + 1);", "} else {", "for(VAR_10 = 0; VAR_10 < MAX_IDE_BUS; VAR_10++) {", "isa_ide_init(ide_iobase[VAR_10], ide_iobase2[VAR_10], ide_irq[VAR_10],\nhd[MAX_IDE_DEVS * VAR_10], hd[MAX_IDE_DEVS * VAR_10 + 1]);", "}", "}", "isa_dev = isa_create_simple(\"i8042\");", "DMA_init(0);", "#ifdef HAS_AUDIO\naudio_init(VAR_6 ? pci_bus : NULL, isa_irq);", "#endif\nfor(VAR_10 = 0; VAR_10 < MAX_FD; VAR_10++) {", "fd[VAR_10] = drive_get(IF_FLOPPY, 0, VAR_10);", "}", "floppy_controller = fdctrl_init_isa(fd);", "cmos_init(below_4g_mem_size, above_4g_mem_size, VAR_1, hd);", "if (VAR_6 && usb_enabled) {", "usb_uhci_piix3_init(pci_bus, VAR_13 + 2);", "}", "if (VAR_6 && acpi_enabled) {", "uint8_t *eeprom_buf = qemu_mallocz(8 * 256);", "i2c_bus *smbus;", "smbus = piix4_pm_init(pci_bus, VAR_13 + 3, 0xb100,\nisa_reserve_irq(9));", "for (VAR_10 = 0; VAR_10 < 8; VAR_10++) {", "DeviceState *eeprom;", "eeprom = qdev_create((BusState *)smbus, \"smbus-eeprom\");", "qdev_prop_set_uint8(eeprom, \"address\", 0x50 + VAR_10);", "qdev_prop_set_ptr(eeprom, \"data\", eeprom_buf + (VAR_10 * 256));", "qdev_init(eeprom);", "}", "piix4_acpi_system_hot_add_init(pci_bus);", "}", "if (i440fx_state) {", "i440fx_init_memory_mappings(i440fx_state);", "}", "if (VAR_6) {", "int VAR_16;", "int VAR_17;", "VAR_16 = drive_get_max_bus(IF_SCSI);", "for (VAR_17 = 0; VAR_17 <= VAR_16; VAR_17++) {", "pci_create_simple(pci_bus, -1, \"lsi53c895a\");", "}", "}", "if (VAR_6) {", "for(VAR_10 = 0; VAR_10 < MAX_VIRTIO_CONSOLES; VAR_10++) {", "if (virtcon_hds[VAR_10]) {", "pci_create_simple(pci_bus, -1, \"virtio-console-pci\");", "}", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11, 13, 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 73 ], [ 75, 77 ], [ 79, 81 ], [ 83, 85 ], [ 89 ], [ 91 ], [ 93 ], [ 97 ], [ 103 ], [ 105 ], [ 117 ], [ 119 ], [ 121, 123, 125 ], [ 131 ], [ 133, 135 ], [ 137, 139 ], [ 141, 143, 145 ], [ 147, 149 ], [ 157, 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173, 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187, 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 203 ], [ 205, 207 ], [ 209, 211, 213 ], [ 221 ], [ 223 ], [ 227 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 247, 249 ], [ 253 ], [ 257 ], [ 259 ], [ 261 ], [ 265 ], [ 267 ], [ 269 ], [ 273 ], [ 275 ], [ 277 ], [ 281, 283 ], [ 287, 289 ], [ 291 ], [ 295 ], [ 297 ], [ 301 ], [ 303 ], [ 305 ], [ 307 ], [ 309 ], [ 313 ], [ 315 ], [ 317 ], [ 319 ], [ 321 ], [ 323 ], [ 325 ], [ 329 ], [ 335 ], [ 339 ], [ 343 ], [ 345 ], [ 347 ], [ 349 ], [ 351 ], [ 353 ], [ 355 ], [ 357, 359 ], [ 361, 363 ], [ 365 ], [ 367 ], [ 369 ], [ 371 ], [ 373 ], [ 375 ], [ 377 ], [ 381 ], [ 385 ], [ 389 ], [ 391 ], [ 395 ], [ 397 ], [ 399 ], [ 401 ], [ 403 ], [ 405 ], [ 407 ], [ 409 ], [ 413 ], [ 415 ], [ 417 ], [ 419 ], [ 421 ], [ 425 ], [ 427 ], [ 429 ], [ 431 ], [ 433 ], [ 437 ], [ 439 ], [ 443, 445 ], [ 447, 449 ], [ 451 ], [ 455 ], [ 457 ], [ 459 ], [ 461 ], [ 465 ], [ 467 ], [ 469 ], [ 473 ], [ 475 ], [ 477 ], [ 479 ], [ 481, 483 ], [ 485 ], [ 487 ], [ 491 ], [ 493 ], [ 495, 497 ], [ 499, 503 ], [ 505 ], [ 507 ], [ 509 ], [ 513 ], [ 517 ], [ 519 ], [ 521 ], [ 525 ], [ 527 ], [ 529 ], [ 535, 537 ], [ 539 ], [ 541 ], [ 543 ], [ 545 ], [ 547 ], [ 549 ], [ 551 ], [ 553 ], [ 555 ], [ 559 ], [ 561 ], [ 563 ], [ 567 ], [ 569 ], [ 571 ], [ 575 ], [ 577 ], [ 579 ], [ 581 ], [ 583 ], [ 589 ], [ 591 ], [ 593 ], [ 595 ], [ 597 ], [ 599 ], [ 601 ], [ 603 ] ]
24,139
void *av_tree_insert(AVTreeNode **tp, void *key, int (*cmp)(void *key, const void *b), AVTreeNode **next){ AVTreeNode *t= *tp; if(t){ unsigned int v= cmp(t->elem, key); void *ret; if(!v){ if(*next) return t->elem; else if(t->child[0]||t->child[1]){ int i= !t->child[0]; void *next_elem[2]; av_tree_find(t->child[i], key, cmp, next_elem); key= t->elem= next_elem[i]; v= -i; }else{ *next= t; *tp=NULL; return NULL; } } ret= av_tree_insert(&t->child[v>>31], key, cmp, next); if(!ret){ int i= (v>>31) ^ !!*next; AVTreeNode **child= &t->child[i]; t->state += 2*i - 1; if(!(t->state&1)){ if(t->state){ /* The following code is equivalent to if((*child)->state*2 == -t->state) rotate(child, i^1); rotate(tp, i); with rotate(): static void rotate(AVTreeNode **tp, int i){ AVTreeNode *t= *tp; *tp= t->child[i]; t->child[i]= t->child[i]->child[i^1]; (*tp)->child[i^1]= t; i= 4*t->state + 2*(*tp)->state + 12; t ->state= ((0x614586 >> i) & 3)-1; (*tp)->state= ((*tp)->state>>1) + ((0x400EEA >> i) & 3)-1; } but such a rotate function is both bigger and slower */ if((*child)->state*2 == -t->state){ *tp= (*child)->child[i^1]; (*child)->child[i^1]= (*tp)->child[i]; (*tp)->child[i]= *child; *child= (*tp)->child[i^1]; (*tp)->child[i^1]= t; (*tp)->child[0]->state= -((*tp)->state>0); (*tp)->child[1]->state= (*tp)->state<0 ; (*tp)->state=0; }else{ *tp= *child; *child= (*child)->child[i^1]; (*tp)->child[i^1]= t; if((*tp)->state) t->state = 0; else t->state>>= 1; (*tp)->state= -t->state; } } } if(!(*tp)->state ^ !!*next) return key; } return ret; }else{ *tp= *next; *next= NULL; (*tp)->elem= key; return NULL; } }
true
FFmpeg
eed36075645ecc3d3ef202c94badb66818114c2c
void *av_tree_insert(AVTreeNode **tp, void *key, int (*cmp)(void *key, const void *b), AVTreeNode **next){ AVTreeNode *t= *tp; if(t){ unsigned int v= cmp(t->elem, key); void *ret; if(!v){ if(*next) return t->elem; else if(t->child[0]||t->child[1]){ int i= !t->child[0]; void *next_elem[2]; av_tree_find(t->child[i], key, cmp, next_elem); key= t->elem= next_elem[i]; v= -i; }else{ *next= t; *tp=NULL; return NULL; } } ret= av_tree_insert(&t->child[v>>31], key, cmp, next); if(!ret){ int i= (v>>31) ^ !!*next; AVTreeNode **child= &t->child[i]; t->state += 2*i - 1; if(!(t->state&1)){ if(t->state){ if((*child)->state*2 == -t->state){ *tp= (*child)->child[i^1]; (*child)->child[i^1]= (*tp)->child[i]; (*tp)->child[i]= *child; *child= (*tp)->child[i^1]; (*tp)->child[i^1]= t; (*tp)->child[0]->state= -((*tp)->state>0); (*tp)->child[1]->state= (*tp)->state<0 ; (*tp)->state=0; }else{ *tp= *child; *child= (*child)->child[i^1]; (*tp)->child[i^1]= t; if((*tp)->state) t->state = 0; else t->state>>= 1; (*tp)->state= -t->state; } } } if(!(*tp)->state ^ !!*next) return key; } return ret; }else{ *tp= *next; *next= NULL; (*tp)->elem= key; return NULL; } }
{ "code": [ " (*tp)->elem= key;", " return NULL;" ], "line_no": [ 145, 147 ] }
void *FUNC_0(AVTreeNode **VAR_0, void *VAR_3, int (*VAR_2)(void *VAR_3, const void *VAR_3), AVTreeNode **VAR_4){ AVTreeNode *t= *VAR_0; if(t){ unsigned int VAR_5= VAR_2(t->elem, VAR_3); void *VAR_6; if(!VAR_5){ if(*VAR_4) return t->elem; else if(t->child[0]||t->child[1]){ int VAR_9= !t->child[0]; void *VAR_8[2]; av_tree_find(t->child[VAR_9], VAR_3, VAR_2, VAR_8); VAR_3= t->elem= VAR_8[VAR_9]; VAR_5= -VAR_9; }else{ *VAR_4= t; *VAR_0=NULL; return NULL; } } VAR_6= FUNC_0(&t->child[VAR_5>>31], VAR_3, VAR_2, VAR_4); if(!VAR_6){ int VAR_9= (VAR_5>>31) ^ !!*VAR_4; AVTreeNode **child= &t->child[VAR_9]; t->state += 2*VAR_9 - 1; if(!(t->state&1)){ if(t->state){ if((*child)->state*2 == -t->state){ *VAR_0= (*child)->child[VAR_9^1]; (*child)->child[VAR_9^1]= (*VAR_0)->child[VAR_9]; (*VAR_0)->child[VAR_9]= *child; *child= (*VAR_0)->child[VAR_9^1]; (*VAR_0)->child[VAR_9^1]= t; (*VAR_0)->child[0]->state= -((*VAR_0)->state>0); (*VAR_0)->child[1]->state= (*VAR_0)->state<0 ; (*VAR_0)->state=0; }else{ *VAR_0= *child; *child= (*child)->child[VAR_9^1]; (*VAR_0)->child[VAR_9^1]= t; if((*VAR_0)->state) t->state = 0; else t->state>>= 1; (*VAR_0)->state= -t->state; } } } if(!(*VAR_0)->state ^ !!*VAR_4) return VAR_3; } return VAR_6; }else{ *VAR_0= *VAR_4; *VAR_4= NULL; (*VAR_0)->elem= VAR_3; return NULL; } }
[ "void *FUNC_0(AVTreeNode **VAR_0, void *VAR_3, int (*VAR_2)(void *VAR_3, const void *VAR_3), AVTreeNode **VAR_4){", "AVTreeNode *t= *VAR_0;", "if(t){", "unsigned int VAR_5= VAR_2(t->elem, VAR_3);", "void *VAR_6;", "if(!VAR_5){", "if(*VAR_4)\nreturn t->elem;", "else if(t->child[0]||t->child[1]){", "int VAR_9= !t->child[0];", "void *VAR_8[2];", "av_tree_find(t->child[VAR_9], VAR_3, VAR_2, VAR_8);", "VAR_3= t->elem= VAR_8[VAR_9];", "VAR_5= -VAR_9;", "}else{", "*VAR_4= t;", "*VAR_0=NULL;", "return NULL;", "}", "}", "VAR_6= FUNC_0(&t->child[VAR_5>>31], VAR_3, VAR_2, VAR_4);", "if(!VAR_6){", "int VAR_9= (VAR_5>>31) ^ !!*VAR_4;", "AVTreeNode **child= &t->child[VAR_9];", "t->state += 2*VAR_9 - 1;", "if(!(t->state&1)){", "if(t->state){", "if((*child)->state*2 == -t->state){", "*VAR_0= (*child)->child[VAR_9^1];", "(*child)->child[VAR_9^1]= (*VAR_0)->child[VAR_9];", "(*VAR_0)->child[VAR_9]= *child;", "*child= (*VAR_0)->child[VAR_9^1];", "(*VAR_0)->child[VAR_9^1]= t;", "(*VAR_0)->child[0]->state= -((*VAR_0)->state>0);", "(*VAR_0)->child[1]->state= (*VAR_0)->state<0 ;", "(*VAR_0)->state=0;", "}else{", "*VAR_0= *child;", "*child= (*child)->child[VAR_9^1];", "(*VAR_0)->child[VAR_9^1]= t;", "if((*VAR_0)->state) t->state = 0;", "else t->state>>= 1;", "(*VAR_0)->state= -t->state;", "}", "}", "}", "if(!(*VAR_0)->state ^ !!*VAR_4)\nreturn VAR_3;", "}", "return VAR_6;", "}else{", "*VAR_0= *VAR_4; *VAR_4= NULL;", "(*VAR_0)->elem= VAR_3;", "return NULL;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0 ]
[ [ 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 ], [ 53 ], [ 55 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133, 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ] ]
24,140
static size_t refcount_array_byte_size(BDRVQcow2State *s, uint64_t entries) { /* This assertion holds because there is no way we can address more than * 2^(64 - 9) clusters at once (with cluster size 512 = 2^9, and because * offsets have to be representable in bytes); due to every cluster * corresponding to one refcount entry, we are well below that limit */ assert(entries < (UINT64_C(1) << (64 - 9))); /* Thanks to the assertion this will not overflow, because * s->refcount_order < 7. * (note: x << s->refcount_order == x * s->refcount_bits) */ return DIV_ROUND_UP(entries << s->refcount_order, 8); }
true
qemu
c2551b47c9b9465962c4000268eda1307f55614a
static size_t refcount_array_byte_size(BDRVQcow2State *s, uint64_t entries) { assert(entries < (UINT64_C(1) << (64 - 9))); return DIV_ROUND_UP(entries << s->refcount_order, 8); }
{ "code": [ "static size_t refcount_array_byte_size(BDRVQcow2State *s, uint64_t entries)" ], "line_no": [ 1 ] }
static size_t FUNC_0(BDRVQcow2State *s, uint64_t entries) { assert(entries < (UINT64_C(1) << (64 - 9))); return DIV_ROUND_UP(entries << s->refcount_order, 8); }
[ "static size_t FUNC_0(BDRVQcow2State *s, uint64_t entries)\n{", "assert(entries < (UINT64_C(1) << (64 - 9)));", "return DIV_ROUND_UP(entries << s->refcount_order, 8);", "}" ]
[ 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 13 ], [ 23 ], [ 25 ] ]
24,142
static inline void RENAME(hyscale)(SwsContext *c, uint16_t *dst, long dstWidth, uint8_t *src, int srcW, int xInc, int flags, int canMMX2BeUsed, int16_t *hLumFilter, int16_t *hLumFilterPos, int hLumFilterSize, void *funnyYCode, int srcFormat, uint8_t *formatConvBuffer, int16_t *mmx2Filter, int32_t *mmx2FilterPos, uint8_t *pal) { if (srcFormat==PIX_FMT_YUYV422 || srcFormat==PIX_FMT_GRAY16BE) { RENAME(yuy2ToY)(formatConvBuffer, src, srcW); src= formatConvBuffer; } else if (srcFormat==PIX_FMT_UYVY422 || srcFormat==PIX_FMT_GRAY16LE) { RENAME(uyvyToY)(formatConvBuffer, src, srcW); src= formatConvBuffer; } else if (srcFormat==PIX_FMT_RGB32) { RENAME(bgr32ToY)(formatConvBuffer, src, srcW); src= formatConvBuffer; } else if (srcFormat==PIX_FMT_RGB32_1) { RENAME(bgr32ToY)(formatConvBuffer, src+ALT32_CORR, srcW); src= formatConvBuffer; } else if (srcFormat==PIX_FMT_BGR24) { RENAME(bgr24ToY)(formatConvBuffer, src, srcW); src= formatConvBuffer; } else if (srcFormat==PIX_FMT_BGR565) { RENAME(bgr16ToY)(formatConvBuffer, src, srcW); src= formatConvBuffer; } else if (srcFormat==PIX_FMT_BGR555) { RENAME(bgr15ToY)(formatConvBuffer, src, srcW); src= formatConvBuffer; } else if (srcFormat==PIX_FMT_BGR32) { RENAME(rgb32ToY)(formatConvBuffer, src, srcW); src= formatConvBuffer; } else if (srcFormat==PIX_FMT_BGR32_1) { RENAME(rgb32ToY)(formatConvBuffer, src+ALT32_CORR, srcW); src= formatConvBuffer; } else if (srcFormat==PIX_FMT_RGB24) { RENAME(rgb24ToY)(formatConvBuffer, src, srcW); src= formatConvBuffer; } else if (srcFormat==PIX_FMT_RGB565) { RENAME(rgb16ToY)(formatConvBuffer, src, srcW); src= formatConvBuffer; } else if (srcFormat==PIX_FMT_RGB555) { RENAME(rgb15ToY)(formatConvBuffer, src, srcW); src= formatConvBuffer; } else if (srcFormat==PIX_FMT_RGB8 || srcFormat==PIX_FMT_BGR8 || srcFormat==PIX_FMT_PAL8 || srcFormat==PIX_FMT_BGR4_BYTE || srcFormat==PIX_FMT_RGB4_BYTE) { RENAME(palToY)(formatConvBuffer, src, srcW, (uint32_t*)pal); src= formatConvBuffer; } #ifdef HAVE_MMX // Use the new MMX scaler if the MMX2 one can't be used (it is faster than the x86 ASM one). if (!(flags&SWS_FAST_BILINEAR) || (!canMMX2BeUsed)) #else if (!(flags&SWS_FAST_BILINEAR)) #endif { RENAME(hScale)(dst, dstWidth, src, srcW, xInc, hLumFilter, hLumFilterPos, hLumFilterSize); } else // fast bilinear upscale / crap downscale { #if defined(ARCH_X86) #ifdef HAVE_MMX2 int i; #if defined(PIC) uint64_t ebxsave __attribute__((aligned(8))); #endif if (canMMX2BeUsed) { asm volatile( #if defined(PIC) "mov %%"REG_b", %5 \n\t" #endif "pxor %%mm7, %%mm7 \n\t" "mov %0, %%"REG_c" \n\t" "mov %1, %%"REG_D" \n\t" "mov %2, %%"REG_d" \n\t" "mov %3, %%"REG_b" \n\t" "xor %%"REG_a", %%"REG_a" \n\t" // i PREFETCH" (%%"REG_c") \n\t" PREFETCH" 32(%%"REG_c") \n\t" PREFETCH" 64(%%"REG_c") \n\t" #ifdef ARCH_X86_64 #define FUNNY_Y_CODE \ "movl (%%"REG_b"), %%esi \n\t"\ "call *%4 \n\t"\ "movl (%%"REG_b", %%"REG_a"), %%esi \n\t"\ "add %%"REG_S", %%"REG_c" \n\t"\ "add %%"REG_a", %%"REG_D" \n\t"\ "xor %%"REG_a", %%"REG_a" \n\t"\ #else #define FUNNY_Y_CODE \ "movl (%%"REG_b"), %%esi \n\t"\ "call *%4 \n\t"\ "addl (%%"REG_b", %%"REG_a"), %%"REG_c" \n\t"\ "add %%"REG_a", %%"REG_D" \n\t"\ "xor %%"REG_a", %%"REG_a" \n\t"\ #endif /* ARCH_X86_64 */ FUNNY_Y_CODE FUNNY_Y_CODE FUNNY_Y_CODE FUNNY_Y_CODE FUNNY_Y_CODE FUNNY_Y_CODE FUNNY_Y_CODE FUNNY_Y_CODE #if defined(PIC) "mov %5, %%"REG_b" \n\t" #endif :: "m" (src), "m" (dst), "m" (mmx2Filter), "m" (mmx2FilterPos), "m" (funnyYCode) #if defined(PIC) ,"m" (ebxsave) #endif : "%"REG_a, "%"REG_c, "%"REG_d, "%"REG_S, "%"REG_D #if !defined(PIC) ,"%"REG_b #endif ); for (i=dstWidth-1; (i*xInc)>>16 >=srcW-1; i--) dst[i] = src[srcW-1]*128; } else { #endif /* HAVE_MMX2 */ long xInc_shr16 = xInc >> 16; uint16_t xInc_mask = xInc & 0xffff; //NO MMX just normal asm ... asm volatile( "xor %%"REG_a", %%"REG_a" \n\t" // i "xor %%"REG_d", %%"REG_d" \n\t" // xx "xorl %%ecx, %%ecx \n\t" // 2*xalpha ASMALIGN(4) "1: \n\t" "movzbl (%0, %%"REG_d"), %%edi \n\t" //src[xx] "movzbl 1(%0, %%"REG_d"), %%esi \n\t" //src[xx+1] "subl %%edi, %%esi \n\t" //src[xx+1] - src[xx] "imull %%ecx, %%esi \n\t" //(src[xx+1] - src[xx])*2*xalpha "shll $16, %%edi \n\t" "addl %%edi, %%esi \n\t" //src[xx+1]*2*xalpha + src[xx]*(1-2*xalpha) "mov %1, %%"REG_D" \n\t" "shrl $9, %%esi \n\t" "movw %%si, (%%"REG_D", %%"REG_a", 2) \n\t" "addw %4, %%cx \n\t" //2*xalpha += xInc&0xFF "adc %3, %%"REG_d" \n\t" //xx+= xInc>>8 + carry "movzbl (%0, %%"REG_d"), %%edi \n\t" //src[xx] "movzbl 1(%0, %%"REG_d"), %%esi \n\t" //src[xx+1] "subl %%edi, %%esi \n\t" //src[xx+1] - src[xx] "imull %%ecx, %%esi \n\t" //(src[xx+1] - src[xx])*2*xalpha "shll $16, %%edi \n\t" "addl %%edi, %%esi \n\t" //src[xx+1]*2*xalpha + src[xx]*(1-2*xalpha) "mov %1, %%"REG_D" \n\t" "shrl $9, %%esi \n\t" "movw %%si, 2(%%"REG_D", %%"REG_a", 2) \n\t" "addw %4, %%cx \n\t" //2*xalpha += xInc&0xFF "adc %3, %%"REG_d" \n\t" //xx+= xInc>>8 + carry "add $2, %%"REG_a" \n\t" "cmp %2, %%"REG_a" \n\t" " jb 1b \n\t" :: "r" (src), "m" (dst), "m" (dstWidth), "m" (xInc_shr16), "m" (xInc_mask) : "%"REG_a, "%"REG_d, "%ecx", "%"REG_D, "%esi" ); #ifdef HAVE_MMX2 } //if MMX2 can't be used #endif #else int i; unsigned int xpos=0; for (i=0;i<dstWidth;i++) { register unsigned int xx=xpos>>16; register unsigned int xalpha=(xpos&0xFFFF)>>9; dst[i]= (src[xx]<<7) + (src[xx+1] - src[xx])*xalpha; xpos+=xInc; } #endif /* defined(ARCH_X86) */ } if(c->srcRange != c->dstRange && !(isRGB(c->dstFormat) || isBGR(c->dstFormat))){ int i; //FIXME all pal and rgb srcFormats could do this convertion as well //FIXME all scalers more complex than bilinear could do half of this transform if(c->srcRange){ for (i=0; i<dstWidth; i++) dst[i]= (dst[i]*14071 + 33561947)>>14; }else{ for (i=0; i<dstWidth; i++) dst[i]= (dst[i]*19077 - 39057361)>>14; } } }
true
FFmpeg
aa13b0fc55f5aec58fce24d1a047271b3e5727f1
static inline void RENAME(hyscale)(SwsContext *c, uint16_t *dst, long dstWidth, uint8_t *src, int srcW, int xInc, int flags, int canMMX2BeUsed, int16_t *hLumFilter, int16_t *hLumFilterPos, int hLumFilterSize, void *funnyYCode, int srcFormat, uint8_t *formatConvBuffer, int16_t *mmx2Filter, int32_t *mmx2FilterPos, uint8_t *pal) { if (srcFormat==PIX_FMT_YUYV422 || srcFormat==PIX_FMT_GRAY16BE) { RENAME(yuy2ToY)(formatConvBuffer, src, srcW); src= formatConvBuffer; } else if (srcFormat==PIX_FMT_UYVY422 || srcFormat==PIX_FMT_GRAY16LE) { RENAME(uyvyToY)(formatConvBuffer, src, srcW); src= formatConvBuffer; } else if (srcFormat==PIX_FMT_RGB32) { RENAME(bgr32ToY)(formatConvBuffer, src, srcW); src= formatConvBuffer; } else if (srcFormat==PIX_FMT_RGB32_1) { RENAME(bgr32ToY)(formatConvBuffer, src+ALT32_CORR, srcW); src= formatConvBuffer; } else if (srcFormat==PIX_FMT_BGR24) { RENAME(bgr24ToY)(formatConvBuffer, src, srcW); src= formatConvBuffer; } else if (srcFormat==PIX_FMT_BGR565) { RENAME(bgr16ToY)(formatConvBuffer, src, srcW); src= formatConvBuffer; } else if (srcFormat==PIX_FMT_BGR555) { RENAME(bgr15ToY)(formatConvBuffer, src, srcW); src= formatConvBuffer; } else if (srcFormat==PIX_FMT_BGR32) { RENAME(rgb32ToY)(formatConvBuffer, src, srcW); src= formatConvBuffer; } else if (srcFormat==PIX_FMT_BGR32_1) { RENAME(rgb32ToY)(formatConvBuffer, src+ALT32_CORR, srcW); src= formatConvBuffer; } else if (srcFormat==PIX_FMT_RGB24) { RENAME(rgb24ToY)(formatConvBuffer, src, srcW); src= formatConvBuffer; } else if (srcFormat==PIX_FMT_RGB565) { RENAME(rgb16ToY)(formatConvBuffer, src, srcW); src= formatConvBuffer; } else if (srcFormat==PIX_FMT_RGB555) { RENAME(rgb15ToY)(formatConvBuffer, src, srcW); src= formatConvBuffer; } else if (srcFormat==PIX_FMT_RGB8 || srcFormat==PIX_FMT_BGR8 || srcFormat==PIX_FMT_PAL8 || srcFormat==PIX_FMT_BGR4_BYTE || srcFormat==PIX_FMT_RGB4_BYTE) { RENAME(palToY)(formatConvBuffer, src, srcW, (uint32_t*)pal); src= formatConvBuffer; } #ifdef HAVE_MMX if (!(flags&SWS_FAST_BILINEAR) || (!canMMX2BeUsed)) #else if (!(flags&SWS_FAST_BILINEAR)) #endif { RENAME(hScale)(dst, dstWidth, src, srcW, xInc, hLumFilter, hLumFilterPos, hLumFilterSize); } else { #if defined(ARCH_X86) #ifdef HAVE_MMX2 int i; #if defined(PIC) uint64_t ebxsave __attribute__((aligned(8))); #endif if (canMMX2BeUsed) { asm volatile( #if defined(PIC) "mov %%"REG_b", %5 \n\t" #endif "pxor %%mm7, %%mm7 \n\t" "mov %0, %%"REG_c" \n\t" "mov %1, %%"REG_D" \n\t" "mov %2, %%"REG_d" \n\t" "mov %3, %%"REG_b" \n\t" "xor %%"REG_a", %%"REG_a" \n\t" PREFETCH" (%%"REG_c") \n\t" PREFETCH" 32(%%"REG_c") \n\t" PREFETCH" 64(%%"REG_c") \n\t" #ifdef ARCH_X86_64 #define FUNNY_Y_CODE \ "movl (%%"REG_b"), %%esi \n\t"\ "call *%4 \n\t"\ "movl (%%"REG_b", %%"REG_a"), %%esi \n\t"\ "add %%"REG_S", %%"REG_c" \n\t"\ "add %%"REG_a", %%"REG_D" \n\t"\ "xor %%"REG_a", %%"REG_a" \n\t"\ #else #define FUNNY_Y_CODE \ "movl (%%"REG_b"), %%esi \n\t"\ "call *%4 \n\t"\ "addl (%%"REG_b", %%"REG_a"), %%"REG_c" \n\t"\ "add %%"REG_a", %%"REG_D" \n\t"\ "xor %%"REG_a", %%"REG_a" \n\t"\ #endif FUNNY_Y_CODE FUNNY_Y_CODE FUNNY_Y_CODE FUNNY_Y_CODE FUNNY_Y_CODE FUNNY_Y_CODE FUNNY_Y_CODE FUNNY_Y_CODE #if defined(PIC) "mov %5, %%"REG_b" \n\t" #endif :: "m" (src), "m" (dst), "m" (mmx2Filter), "m" (mmx2FilterPos), "m" (funnyYCode) #if defined(PIC) ,"m" (ebxsave) #endif : "%"REG_a, "%"REG_c, "%"REG_d, "%"REG_S, "%"REG_D #if !defined(PIC) ,"%"REG_b #endif ); for (i=dstWidth-1; (i*xInc)>>16 >=srcW-1; i--) dst[i] = src[srcW-1]*128; } else { #endif long xInc_shr16 = xInc >> 16; uint16_t xInc_mask = xInc & 0xffff; asm volatile( "xor %%"REG_a", %%"REG_a" \n\t" "xor %%"REG_d", %%"REG_d" \n\t" "xorl %%ecx, %%ecx \n\t" ASMALIGN(4) "1: \n\t" "movzbl (%0, %%"REG_d"), %%edi \n\t" "movzbl 1(%0, %%"REG_d"), %%esi \n\t" "subl %%edi, %%esi \n\t" - src[xx] "imull %%ecx, %%esi \n\t" "shll $16, %%edi \n\t" "addl %%edi, %%esi \n\t" *2*xalpha + src[xx]*(1-2*xalpha) "mov %1, %%"REG_D" \n\t" "shrl $9, %%esi \n\t" "movw %%si, (%%"REG_D", %%"REG_a", 2) \n\t" "addw %4, %%cx \n\t" "adc %3, %%"REG_d" \n\t" "movzbl (%0, %%"REG_d"), %%edi \n\t" "movzbl 1(%0, %%"REG_d"), %%esi \n\t" "subl %%edi, %%esi \n\t" - src[xx] "imull %%ecx, %%esi \n\t" "shll $16, %%edi \n\t" "addl %%edi, %%esi \n\t" *2*xalpha + src[xx]*(1-2*xalpha) "mov %1, %%"REG_D" \n\t" "shrl $9, %%esi \n\t" "movw %%si, 2(%%"REG_D", %%"REG_a", 2) \n\t" "addw %4, %%cx \n\t" "adc %3, %%"REG_d" \n\t" "add $2, %%"REG_a" \n\t" "cmp %2, %%"REG_a" \n\t" " jb 1b \n\t" :: "r" (src), "m" (dst), "m" (dstWidth), "m" (xInc_shr16), "m" (xInc_mask) : "%"REG_a, "%"REG_d, "%ecx", "%"REG_D, "%esi" ); #ifdef HAVE_MMX2 } #endif #else int i; unsigned int xpos=0; for (i=0;i<dstWidth;i++) { register unsigned int xx=xpos>>16; register unsigned int xalpha=(xpos&0xFFFF)>>9; dst[i]= (src[xx]<<7) + (src[xx+1] - src[xx])*xalpha; xpos+=xInc; } #endif } if(c->srcRange != c->dstRange && !(isRGB(c->dstFormat) || isBGR(c->dstFormat))){ int i; if(c->srcRange){ for (i=0; i<dstWidth; i++) dst[i]= (dst[i]*14071 + 33561947)>>14; }else{ for (i=0; i<dstWidth; i++) dst[i]= (dst[i]*19077 - 39057361)>>14; } } }
{ "code": [ " dst[i]= (dst[i]*19077 - 39057361)>>14;" ], "line_no": [ 441 ] }
static inline void FUNC_0(hyscale)(SwsContext *c, uint16_t *dst, long dstWidth, uint8_t *src, int srcW, int xInc, int flags, int canMMX2BeUsed, int16_t *hLumFilter, int16_t *hLumFilterPos, int hLumFilterSize, void *funnyYCode, int srcFormat, uint8_t *formatConvBuffer, int16_t *mmx2Filter, int32_t *mmx2FilterPos, uint8_t *pal) { if (srcFormat==PIX_FMT_YUYV422 || srcFormat==PIX_FMT_GRAY16BE) { FUNC_0(yuy2ToY)(formatConvBuffer, src, srcW); src= formatConvBuffer; } else if (srcFormat==PIX_FMT_UYVY422 || srcFormat==PIX_FMT_GRAY16LE) { FUNC_0(uyvyToY)(formatConvBuffer, src, srcW); src= formatConvBuffer; } else if (srcFormat==PIX_FMT_RGB32) { FUNC_0(bgr32ToY)(formatConvBuffer, src, srcW); src= formatConvBuffer; } else if (srcFormat==PIX_FMT_RGB32_1) { FUNC_0(bgr32ToY)(formatConvBuffer, src+ALT32_CORR, srcW); src= formatConvBuffer; } else if (srcFormat==PIX_FMT_BGR24) { FUNC_0(bgr24ToY)(formatConvBuffer, src, srcW); src= formatConvBuffer; } else if (srcFormat==PIX_FMT_BGR565) { FUNC_0(bgr16ToY)(formatConvBuffer, src, srcW); src= formatConvBuffer; } else if (srcFormat==PIX_FMT_BGR555) { FUNC_0(bgr15ToY)(formatConvBuffer, src, srcW); src= formatConvBuffer; } else if (srcFormat==PIX_FMT_BGR32) { FUNC_0(rgb32ToY)(formatConvBuffer, src, srcW); src= formatConvBuffer; } else if (srcFormat==PIX_FMT_BGR32_1) { FUNC_0(rgb32ToY)(formatConvBuffer, src+ALT32_CORR, srcW); src= formatConvBuffer; } else if (srcFormat==PIX_FMT_RGB24) { FUNC_0(rgb24ToY)(formatConvBuffer, src, srcW); src= formatConvBuffer; } else if (srcFormat==PIX_FMT_RGB565) { FUNC_0(rgb16ToY)(formatConvBuffer, src, srcW); src= formatConvBuffer; } else if (srcFormat==PIX_FMT_RGB555) { FUNC_0(rgb15ToY)(formatConvBuffer, src, srcW); src= formatConvBuffer; } else if (srcFormat==PIX_FMT_RGB8 || srcFormat==PIX_FMT_BGR8 || srcFormat==PIX_FMT_PAL8 || srcFormat==PIX_FMT_BGR4_BYTE || srcFormat==PIX_FMT_RGB4_BYTE) { FUNC_0(palToY)(formatConvBuffer, src, srcW, (uint32_t*)pal); src= formatConvBuffer; } #ifdef HAVE_MMX if (!(flags&SWS_FAST_BILINEAR) || (!canMMX2BeUsed)) #else if (!(flags&SWS_FAST_BILINEAR)) #endif { FUNC_0(hScale)(dst, dstWidth, src, srcW, xInc, hLumFilter, hLumFilterPos, hLumFilterSize); } else { #if defined(ARCH_X86) #ifdef HAVE_MMX2 int VAR_2; #if defined(PIC) uint64_t ebxsave __attribute__((aligned(8))); #endif if (canMMX2BeUsed) { asm volatile( #if defined(PIC) "mov %%"REG_b", %5 \n\t" #endif "pxor %%mm7, %%mm7 \n\t" "mov %0, %%"REG_c" \n\t" "mov %1, %%"REG_D" \n\t" "mov %2, %%"REG_d" \n\t" "mov %3, %%"REG_b" \n\t" "xor %%"REG_a", %%"REG_a" \n\t" PREFETCH" (%%"REG_c") \n\t" PREFETCH" 32(%%"REG_c") \n\t" PREFETCH" 64(%%"REG_c") \n\t" #ifdef ARCH_X86_64 #define FUNNY_Y_CODE \ "movl (%%"REG_b"), %%esi \n\t"\ "call *%4 \n\t"\ "movl (%%"REG_b", %%"REG_a"), %%esi \n\t"\ "add %%"REG_S", %%"REG_c" \n\t"\ "add %%"REG_a", %%"REG_D" \n\t"\ "xor %%"REG_a", %%"REG_a" \n\t"\ #else #define FUNNY_Y_CODE \ "movl (%%"REG_b"), %%esi \n\t"\ "call *%4 \n\t"\ "addl (%%"REG_b", %%"REG_a"), %%"REG_c" \n\t"\ "add %%"REG_a", %%"REG_D" \n\t"\ "xor %%"REG_a", %%"REG_a" \n\t"\ #endif FUNNY_Y_CODE FUNNY_Y_CODE FUNNY_Y_CODE FUNNY_Y_CODE FUNNY_Y_CODE FUNNY_Y_CODE FUNNY_Y_CODE FUNNY_Y_CODE #if defined(PIC) "mov %5, %%"REG_b" \n\t" #endif :: "m" (src), "m" (dst), "m" (mmx2Filter), "m" (mmx2FilterPos), "m" (funnyYCode) #if defined(PIC) ,"m" (ebxsave) #endif : "%"REG_a, "%"REG_c, "%"REG_d, "%"REG_S, "%"REG_D #if !defined(PIC) ,"%"REG_b #endif ); for (VAR_2=dstWidth-1; (VAR_2*xInc)>>16 >=srcW-1; VAR_2--) dst[VAR_2] = src[srcW-1]*128; } else { #endif long xInc_shr16 = xInc >> 16; uint16_t xInc_mask = xInc & 0xffff; asm volatile( "xor %%"REG_a", %%"REG_a" \n\t" "xor %%"REG_d", %%"REG_d" \n\t" "xorl %%ecx, %%ecx \n\t" ASMALIGN(4) "1: \n\t" "movzbl (%0, %%"REG_d"), %%edi \n\t" "movzbl 1(%0, %%"REG_d"), %%esi \n\t" "subl %%edi, %%esi \n\t" - src[xx] "imull %%ecx, %%esi \n\t" "shll $16, %%edi \n\t" "addl %%edi, %%esi \n\t" *2*xalpha + src[xx]*(1-2*xalpha) "mov %1, %%"REG_D" \n\t" "shrl $9, %%esi \n\t" "movw %%si, (%%"REG_D", %%"REG_a", 2) \n\t" "addw %4, %%cx \n\t" "adc %3, %%"REG_d" \n\t" "movzbl (%0, %%"REG_d"), %%edi \n\t" "movzbl 1(%0, %%"REG_d"), %%esi \n\t" "subl %%edi, %%esi \n\t" - src[xx] "imull %%ecx, %%esi \n\t" "shll $16, %%edi \n\t" "addl %%edi, %%esi \n\t" *2*xalpha + src[xx]*(1-2*xalpha) "mov %1, %%"REG_D" \n\t" "shrl $9, %%esi \n\t" "movw %%si, 2(%%"REG_D", %%"REG_a", 2) \n\t" "addw %4, %%cx \n\t" "adc %3, %%"REG_d" \n\t" "add $2, %%"REG_a" \n\t" "cmp %2, %%"REG_a" \n\t" " jb 1b \n\t" :: "r" (src), "m" (dst), "m" (dstWidth), "m" (xInc_shr16), "m" (xInc_mask) : "%"REG_a, "%"REG_d, "%ecx", "%"REG_D, "%esi" ); #ifdef HAVE_MMX2 } #endif #else int VAR_2; unsigned int VAR_1=0; for (VAR_2=0;VAR_2<dstWidth;VAR_2++) { register unsigned int xx=VAR_1>>16; register unsigned int xalpha=(VAR_1&0xFFFF)>>9; dst[VAR_2]= (src[xx]<<7) + (src[xx+1] - src[xx])*xalpha; VAR_1+=xInc; } #endif } if(c->srcRange != c->dstRange && !(isRGB(c->dstFormat) || isBGR(c->dstFormat))){ int VAR_2; if(c->srcRange){ for (VAR_2=0; VAR_2<dstWidth; VAR_2++) dst[VAR_2]= (dst[VAR_2]*14071 + 33561947)>>14; }else{ for (VAR_2=0; VAR_2<dstWidth; VAR_2++) dst[VAR_2]= (dst[VAR_2]*19077 - 39057361)>>14; } } }
[ "static inline void FUNC_0(hyscale)(SwsContext *c, uint16_t *dst, long dstWidth, uint8_t *src, int srcW, int xInc,\nint flags, int canMMX2BeUsed, int16_t *hLumFilter,\nint16_t *hLumFilterPos, int hLumFilterSize, void *funnyYCode,\nint srcFormat, uint8_t *formatConvBuffer, int16_t *mmx2Filter,\nint32_t *mmx2FilterPos, uint8_t *pal)\n{", "if (srcFormat==PIX_FMT_YUYV422 || srcFormat==PIX_FMT_GRAY16BE)\n{", "FUNC_0(yuy2ToY)(formatConvBuffer, src, srcW);", "src= formatConvBuffer;", "}", "else if (srcFormat==PIX_FMT_UYVY422 || srcFormat==PIX_FMT_GRAY16LE)\n{", "FUNC_0(uyvyToY)(formatConvBuffer, src, srcW);", "src= formatConvBuffer;", "}", "else if (srcFormat==PIX_FMT_RGB32)\n{", "FUNC_0(bgr32ToY)(formatConvBuffer, src, srcW);", "src= formatConvBuffer;", "}", "else if (srcFormat==PIX_FMT_RGB32_1)\n{", "FUNC_0(bgr32ToY)(formatConvBuffer, src+ALT32_CORR, srcW);", "src= formatConvBuffer;", "}", "else if (srcFormat==PIX_FMT_BGR24)\n{", "FUNC_0(bgr24ToY)(formatConvBuffer, src, srcW);", "src= formatConvBuffer;", "}", "else if (srcFormat==PIX_FMT_BGR565)\n{", "FUNC_0(bgr16ToY)(formatConvBuffer, src, srcW);", "src= formatConvBuffer;", "}", "else if (srcFormat==PIX_FMT_BGR555)\n{", "FUNC_0(bgr15ToY)(formatConvBuffer, src, srcW);", "src= formatConvBuffer;", "}", "else if (srcFormat==PIX_FMT_BGR32)\n{", "FUNC_0(rgb32ToY)(formatConvBuffer, src, srcW);", "src= formatConvBuffer;", "}", "else if (srcFormat==PIX_FMT_BGR32_1)\n{", "FUNC_0(rgb32ToY)(formatConvBuffer, src+ALT32_CORR, srcW);", "src= formatConvBuffer;", "}", "else if (srcFormat==PIX_FMT_RGB24)\n{", "FUNC_0(rgb24ToY)(formatConvBuffer, src, srcW);", "src= formatConvBuffer;", "}", "else if (srcFormat==PIX_FMT_RGB565)\n{", "FUNC_0(rgb16ToY)(formatConvBuffer, src, srcW);", "src= formatConvBuffer;", "}", "else if (srcFormat==PIX_FMT_RGB555)\n{", "FUNC_0(rgb15ToY)(formatConvBuffer, src, srcW);", "src= formatConvBuffer;", "}", "else if (srcFormat==PIX_FMT_RGB8 || srcFormat==PIX_FMT_BGR8 || srcFormat==PIX_FMT_PAL8 || srcFormat==PIX_FMT_BGR4_BYTE || srcFormat==PIX_FMT_RGB4_BYTE)\n{", "FUNC_0(palToY)(formatConvBuffer, src, srcW, (uint32_t*)pal);", "src= formatConvBuffer;", "}", "#ifdef HAVE_MMX\nif (!(flags&SWS_FAST_BILINEAR) || (!canMMX2BeUsed))\n#else\nif (!(flags&SWS_FAST_BILINEAR))\n#endif\n{", "FUNC_0(hScale)(dst, dstWidth, src, srcW, xInc, hLumFilter, hLumFilterPos, hLumFilterSize);", "}", "else\n{", "#if defined(ARCH_X86)\n#ifdef HAVE_MMX2\nint VAR_2;", "#if defined(PIC)\nuint64_t ebxsave __attribute__((aligned(8)));", "#endif\nif (canMMX2BeUsed)\n{", "asm volatile(\n#if defined(PIC)\n\"mov %%\"REG_b\", %5 \\n\\t\"\n#endif\n\"pxor %%mm7, %%mm7 \\n\\t\"\n\"mov %0, %%\"REG_c\" \\n\\t\"\n\"mov %1, %%\"REG_D\" \\n\\t\"\n\"mov %2, %%\"REG_d\" \\n\\t\"\n\"mov %3, %%\"REG_b\" \\n\\t\"\n\"xor %%\"REG_a\", %%\"REG_a\" \\n\\t\"\nPREFETCH\" (%%\"REG_c\") \\n\\t\"\nPREFETCH\" 32(%%\"REG_c\") \\n\\t\"\nPREFETCH\" 64(%%\"REG_c\") \\n\\t\"\n#ifdef ARCH_X86_64\n#define FUNNY_Y_CODE \\\n\"movl (%%\"REG_b\"), %%esi \\n\\t\"\\\n\"call *%4 \\n\\t\"\\\n\"movl (%%\"REG_b\", %%\"REG_a\"), %%esi \\n\\t\"\\\n\"add %%\"REG_S\", %%\"REG_c\" \\n\\t\"\\\n\"add %%\"REG_a\", %%\"REG_D\" \\n\\t\"\\\n\"xor %%\"REG_a\", %%\"REG_a\" \\n\\t\"\\\n#else\n#define FUNNY_Y_CODE \\\n\"movl (%%\"REG_b\"), %%esi \\n\\t\"\\\n\"call *%4 \\n\\t\"\\\n\"addl (%%\"REG_b\", %%\"REG_a\"), %%\"REG_c\" \\n\\t\"\\\n\"add %%\"REG_a\", %%\"REG_D\" \\n\\t\"\\\n\"xor %%\"REG_a\", %%\"REG_a\" \\n\\t\"\\\n#endif\nFUNNY_Y_CODE\nFUNNY_Y_CODE\nFUNNY_Y_CODE\nFUNNY_Y_CODE\nFUNNY_Y_CODE\nFUNNY_Y_CODE\nFUNNY_Y_CODE\nFUNNY_Y_CODE\n#if defined(PIC)\n\"mov %5, %%\"REG_b\" \\n\\t\"\n#endif\n:: \"m\" (src), \"m\" (dst), \"m\" (mmx2Filter), \"m\" (mmx2FilterPos),\n\"m\" (funnyYCode)\n#if defined(PIC)\n,\"m\" (ebxsave)\n#endif\n: \"%\"REG_a, \"%\"REG_c, \"%\"REG_d, \"%\"REG_S, \"%\"REG_D\n#if !defined(PIC)\n,\"%\"REG_b\n#endif\n);", "for (VAR_2=dstWidth-1; (VAR_2*xInc)>>16 >=srcW-1; VAR_2--) dst[VAR_2] = src[srcW-1]*128;", "}", "else\n{", "#endif\nlong xInc_shr16 = xInc >> 16;", "uint16_t xInc_mask = xInc & 0xffff;", "asm volatile(\n\"xor %%\"REG_a\", %%\"REG_a\" \\n\\t\"\n\"xor %%\"REG_d\", %%\"REG_d\" \\n\\t\"\n\"xorl %%ecx, %%ecx \\n\\t\"\nASMALIGN(4)\n\"1: \\n\\t\"\n\"movzbl (%0, %%\"REG_d\"), %%edi \\n\\t\"\n\"movzbl 1(%0, %%\"REG_d\"), %%esi \\n\\t\"\n\"subl %%edi, %%esi \\n\\t\" - src[xx]\n\"imull %%ecx, %%esi \\n\\t\"\n\"shll $16, %%edi \\n\\t\"\n\"addl %%edi, %%esi \\n\\t\" *2*xalpha + src[xx]*(1-2*xalpha)\n\"mov %1, %%\"REG_D\" \\n\\t\"\n\"shrl $9, %%esi \\n\\t\"\n\"movw %%si, (%%\"REG_D\", %%\"REG_a\", 2) \\n\\t\"\n\"addw %4, %%cx \\n\\t\"\n\"adc %3, %%\"REG_d\" \\n\\t\"\n\"movzbl (%0, %%\"REG_d\"), %%edi \\n\\t\"\n\"movzbl 1(%0, %%\"REG_d\"), %%esi \\n\\t\"\n\"subl %%edi, %%esi \\n\\t\" - src[xx]\n\"imull %%ecx, %%esi \\n\\t\"\n\"shll $16, %%edi \\n\\t\"\n\"addl %%edi, %%esi \\n\\t\" *2*xalpha + src[xx]*(1-2*xalpha)\n\"mov %1, %%\"REG_D\" \\n\\t\"\n\"shrl $9, %%esi \\n\\t\"\n\"movw %%si, 2(%%\"REG_D\", %%\"REG_a\", 2) \\n\\t\"\n\"addw %4, %%cx \\n\\t\"\n\"adc %3, %%\"REG_d\" \\n\\t\"\n\"add $2, %%\"REG_a\" \\n\\t\"\n\"cmp %2, %%\"REG_a\" \\n\\t\"\n\" jb 1b \\n\\t\"\n:: \"r\" (src), \"m\" (dst), \"m\" (dstWidth), \"m\" (xInc_shr16), \"m\" (xInc_mask)\n: \"%\"REG_a, \"%\"REG_d, \"%ecx\", \"%\"REG_D, \"%esi\"\n);", "#ifdef HAVE_MMX2\n}", "#endif\n#else\nint VAR_2;", "unsigned int VAR_1=0;", "for (VAR_2=0;VAR_2<dstWidth;VAR_2++)", "{", "register unsigned int xx=VAR_1>>16;", "register unsigned int xalpha=(VAR_1&0xFFFF)>>9;", "dst[VAR_2]= (src[xx]<<7) + (src[xx+1] - src[xx])*xalpha;", "VAR_1+=xInc;", "}", "#endif\n}", "if(c->srcRange != c->dstRange && !(isRGB(c->dstFormat) || isBGR(c->dstFormat))){", "int VAR_2;", "if(c->srcRange){", "for (VAR_2=0; VAR_2<dstWidth; VAR_2++)", "dst[VAR_2]= (dst[VAR_2]*14071 + 33561947)>>14;", "}else{", "for (VAR_2=0; VAR_2<dstWidth; VAR_2++)", "dst[VAR_2]= (dst[VAR_2]*19077 - 39057361)>>14;", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53, 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63, 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73, 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83, 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93, 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103, 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113, 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123, 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133, 135 ], [ 137 ], [ 139 ], [ 141 ], [ 145, 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, 211, 215, 217, 219, 221, 223, 225, 227, 231, 235, 237, 239, 241, 243, 245, 249, 253, 255, 257, 259, 261, 263, 265, 267, 271, 273, 275, 277, 279, 281, 283, 285, 287, 289, 291, 293, 295 ], [ 297 ], [ 299 ], [ 301, 303 ], [ 305, 307 ], [ 309 ], [ 313, 315, 317, 319, 321, 323, 325, 327, 329, 331, 333, 335, 337, 339, 341, 343, 345, 349, 351, 353, 355, 357, 359, 361, 363, 365, 367, 369, 375, 377, 379, 385, 387, 389 ], [ 391, 393 ], [ 395, 397, 399 ], [ 401 ], [ 403 ], [ 405 ], [ 407 ], [ 409 ], [ 411 ], [ 413 ], [ 415 ], [ 417, 419 ], [ 423 ], [ 425 ], [ 431 ], [ 433 ], [ 435 ], [ 437 ], [ 439 ], [ 441 ], [ 443 ], [ 445 ], [ 447 ] ]
24,143
static int applehttp_read_header(AVFormatContext *s, AVFormatParameters *ap) { AppleHTTPContext *c = s->priv_data; int ret = 0, i, j, stream_offset = 0; if ((ret = parse_playlist(c, s->filename, NULL, s->pb)) < 0) goto fail; if (c->n_variants == 0) { av_log(NULL, AV_LOG_WARNING, "Empty playlist\n"); ret = AVERROR_EOF; goto fail; } /* If the playlist only contained variants, parse each individual * variant playlist. */ if (c->n_variants > 1 || c->variants[0]->n_segments == 0) { for (i = 0; i < c->n_variants; i++) { struct variant *v = c->variants[i]; if ((ret = parse_playlist(c, v->url, v, NULL)) < 0) goto fail; } } if (c->variants[0]->n_segments == 0) { av_log(NULL, AV_LOG_WARNING, "Empty playlist\n"); ret = AVERROR_EOF; goto fail; } /* If this isn't a live stream, calculate the total duration of the * stream. */ if (c->finished) { int duration = 0; for (i = 0; i < c->variants[0]->n_segments; i++) duration += c->variants[0]->segments[i]->duration; s->duration = duration * AV_TIME_BASE; } c->min_end_seq = INT_MAX; /* Open the demuxer for each variant */ for (i = 0; i < c->n_variants; i++) { struct variant *v = c->variants[i]; if (v->n_segments == 0) continue; c->max_start_seq = FFMAX(c->max_start_seq, v->start_seq_no); c->min_end_seq = FFMIN(c->min_end_seq, v->start_seq_no + v->n_segments); ret = av_open_input_file(&v->ctx, v->segments[0]->url, NULL, 0, NULL); if (ret < 0) goto fail; url_fclose(v->ctx->pb); v->ctx->pb = NULL; v->stream_offset = stream_offset; /* Create new AVStreams for each stream in this variant */ for (j = 0; j < v->ctx->nb_streams; j++) { AVStream *st = av_new_stream(s, i); if (!st) { ret = AVERROR(ENOMEM); goto fail; } avcodec_copy_context(st->codec, v->ctx->streams[j]->codec); } stream_offset += v->ctx->nb_streams; } c->last_packet_dts = AV_NOPTS_VALUE; c->cur_seq_no = c->max_start_seq; /* If this is a live stream with more than 3 segments, start at the * third last segment. */ if (!c->finished && c->min_end_seq - c->max_start_seq > 3) c->cur_seq_no = c->min_end_seq - 2; return 0; fail: free_variant_list(c); return ret; }
true
FFmpeg
b79c3df08807c96a945d9cea21c5d923c464d622
static int applehttp_read_header(AVFormatContext *s, AVFormatParameters *ap) { AppleHTTPContext *c = s->priv_data; int ret = 0, i, j, stream_offset = 0; if ((ret = parse_playlist(c, s->filename, NULL, s->pb)) < 0) goto fail; if (c->n_variants == 0) { av_log(NULL, AV_LOG_WARNING, "Empty playlist\n"); ret = AVERROR_EOF; goto fail; } if (c->n_variants > 1 || c->variants[0]->n_segments == 0) { for (i = 0; i < c->n_variants; i++) { struct variant *v = c->variants[i]; if ((ret = parse_playlist(c, v->url, v, NULL)) < 0) goto fail; } } if (c->variants[0]->n_segments == 0) { av_log(NULL, AV_LOG_WARNING, "Empty playlist\n"); ret = AVERROR_EOF; goto fail; } if (c->finished) { int duration = 0; for (i = 0; i < c->variants[0]->n_segments; i++) duration += c->variants[0]->segments[i]->duration; s->duration = duration * AV_TIME_BASE; } c->min_end_seq = INT_MAX; for (i = 0; i < c->n_variants; i++) { struct variant *v = c->variants[i]; if (v->n_segments == 0) continue; c->max_start_seq = FFMAX(c->max_start_seq, v->start_seq_no); c->min_end_seq = FFMIN(c->min_end_seq, v->start_seq_no + v->n_segments); ret = av_open_input_file(&v->ctx, v->segments[0]->url, NULL, 0, NULL); if (ret < 0) goto fail; url_fclose(v->ctx->pb); v->ctx->pb = NULL; v->stream_offset = stream_offset; for (j = 0; j < v->ctx->nb_streams; j++) { AVStream *st = av_new_stream(s, i); if (!st) { ret = AVERROR(ENOMEM); goto fail; } avcodec_copy_context(st->codec, v->ctx->streams[j]->codec); } stream_offset += v->ctx->nb_streams; } c->last_packet_dts = AV_NOPTS_VALUE; c->cur_seq_no = c->max_start_seq; if (!c->finished && c->min_end_seq - c->max_start_seq > 3) c->cur_seq_no = c->min_end_seq - 2; return 0; fail: free_variant_list(c); return ret; }
{ "code": [ " int duration = 0;" ], "line_no": [ 65 ] }
static int FUNC_0(AVFormatContext *VAR_0, AVFormatParameters *VAR_1) { AppleHTTPContext *c = VAR_0->priv_data; int VAR_2 = 0, VAR_3, VAR_4, VAR_5 = 0; if ((VAR_2 = parse_playlist(c, VAR_0->filename, NULL, VAR_0->pb)) < 0) goto fail; if (c->n_variants == 0) { av_log(NULL, AV_LOG_WARNING, "Empty playlist\n"); VAR_2 = AVERROR_EOF; goto fail; } if (c->n_variants > 1 || c->variants[0]->n_segments == 0) { for (VAR_3 = 0; VAR_3 < c->n_variants; VAR_3++) { struct variant *v = c->variants[VAR_3]; if ((VAR_2 = parse_playlist(c, v->url, v, NULL)) < 0) goto fail; } } if (c->variants[0]->n_segments == 0) { av_log(NULL, AV_LOG_WARNING, "Empty playlist\n"); VAR_2 = AVERROR_EOF; goto fail; } if (c->finished) { int VAR_6 = 0; for (VAR_3 = 0; VAR_3 < c->variants[0]->n_segments; VAR_3++) VAR_6 += c->variants[0]->segments[VAR_3]->VAR_6; VAR_0->VAR_6 = VAR_6 * AV_TIME_BASE; } c->min_end_seq = INT_MAX; for (VAR_3 = 0; VAR_3 < c->n_variants; VAR_3++) { struct variant *v = c->variants[VAR_3]; if (v->n_segments == 0) continue; c->max_start_seq = FFMAX(c->max_start_seq, v->start_seq_no); c->min_end_seq = FFMIN(c->min_end_seq, v->start_seq_no + v->n_segments); VAR_2 = av_open_input_file(&v->ctx, v->segments[0]->url, NULL, 0, NULL); if (VAR_2 < 0) goto fail; url_fclose(v->ctx->pb); v->ctx->pb = NULL; v->VAR_5 = VAR_5; for (VAR_4 = 0; VAR_4 < v->ctx->nb_streams; VAR_4++) { AVStream *st = av_new_stream(VAR_0, VAR_3); if (!st) { VAR_2 = AVERROR(ENOMEM); goto fail; } avcodec_copy_context(st->codec, v->ctx->streams[VAR_4]->codec); } VAR_5 += v->ctx->nb_streams; } c->last_packet_dts = AV_NOPTS_VALUE; c->cur_seq_no = c->max_start_seq; if (!c->finished && c->min_end_seq - c->max_start_seq > 3) c->cur_seq_no = c->min_end_seq - 2; return 0; fail: free_variant_list(c); return VAR_2; }
[ "static int FUNC_0(AVFormatContext *VAR_0, AVFormatParameters *VAR_1)\n{", "AppleHTTPContext *c = VAR_0->priv_data;", "int VAR_2 = 0, VAR_3, VAR_4, VAR_5 = 0;", "if ((VAR_2 = parse_playlist(c, VAR_0->filename, NULL, VAR_0->pb)) < 0)\ngoto fail;", "if (c->n_variants == 0) {", "av_log(NULL, AV_LOG_WARNING, \"Empty playlist\\n\");", "VAR_2 = AVERROR_EOF;", "goto fail;", "}", "if (c->n_variants > 1 || c->variants[0]->n_segments == 0) {", "for (VAR_3 = 0; VAR_3 < c->n_variants; VAR_3++) {", "struct variant *v = c->variants[VAR_3];", "if ((VAR_2 = parse_playlist(c, v->url, v, NULL)) < 0)\ngoto fail;", "}", "}", "if (c->variants[0]->n_segments == 0) {", "av_log(NULL, AV_LOG_WARNING, \"Empty playlist\\n\");", "VAR_2 = AVERROR_EOF;", "goto fail;", "}", "if (c->finished) {", "int VAR_6 = 0;", "for (VAR_3 = 0; VAR_3 < c->variants[0]->n_segments; VAR_3++)", "VAR_6 += c->variants[0]->segments[VAR_3]->VAR_6;", "VAR_0->VAR_6 = VAR_6 * AV_TIME_BASE;", "}", "c->min_end_seq = INT_MAX;", "for (VAR_3 = 0; VAR_3 < c->n_variants; VAR_3++) {", "struct variant *v = c->variants[VAR_3];", "if (v->n_segments == 0)\ncontinue;", "c->max_start_seq = FFMAX(c->max_start_seq, v->start_seq_no);", "c->min_end_seq = FFMIN(c->min_end_seq, v->start_seq_no +\nv->n_segments);", "VAR_2 = av_open_input_file(&v->ctx, v->segments[0]->url, NULL, 0, NULL);", "if (VAR_2 < 0)\ngoto fail;", "url_fclose(v->ctx->pb);", "v->ctx->pb = NULL;", "v->VAR_5 = VAR_5;", "for (VAR_4 = 0; VAR_4 < v->ctx->nb_streams; VAR_4++) {", "AVStream *st = av_new_stream(VAR_0, VAR_3);", "if (!st) {", "VAR_2 = AVERROR(ENOMEM);", "goto fail;", "}", "avcodec_copy_context(st->codec, v->ctx->streams[VAR_4]->codec);", "}", "VAR_5 += v->ctx->nb_streams;", "}", "c->last_packet_dts = AV_NOPTS_VALUE;", "c->cur_seq_no = c->max_start_seq;", "if (!c->finished && c->min_end_seq - c->max_start_seq > 3)\nc->cur_seq_no = c->min_end_seq - 2;", "return 0;", "fail:\nfree_variant_list(c);", "return VAR_2;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11, 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 31 ], [ 33 ], [ 35 ], [ 37, 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 81 ], [ 83 ], [ 85, 87 ], [ 89 ], [ 91, 93 ], [ 95 ], [ 97, 99 ], [ 101 ], [ 103 ], [ 105 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 133 ], [ 139, 141 ], [ 145 ], [ 147, 149 ], [ 151 ], [ 153 ] ]
24,144
static int nvenc_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet) { NVENCSTATUS nv_status; NvencOutputSurface *tmpoutsurf; int res, i = 0; NvencContext *ctx = avctx->priv_data; NvencDynLoadFunctions *dl_fn = &ctx->nvenc_dload_funcs; NV_ENCODE_API_FUNCTION_LIST *p_nvenc = &dl_fn->nvenc_funcs; NV_ENC_PIC_PARAMS pic_params = { 0 }; pic_params.version = NV_ENC_PIC_PARAMS_VER; if (frame) { NV_ENC_LOCK_INPUT_BUFFER lockBufferParams = { 0 }; NvencInputSurface *inSurf = NULL; for (i = 0; i < ctx->max_surface_count; ++i) { if (!ctx->input_surfaces[i].lockCount) { inSurf = &ctx->input_surfaces[i]; break; } } av_assert0(inSurf); inSurf->lockCount = 1; lockBufferParams.version = NV_ENC_LOCK_INPUT_BUFFER_VER; lockBufferParams.inputBuffer = inSurf->input_surface; nv_status = p_nvenc->nvEncLockInputBuffer(ctx->nvencoder, &lockBufferParams); if (nv_status != NV_ENC_SUCCESS) { av_log(avctx, AV_LOG_ERROR, "Failed locking nvenc input buffer\n"); return 0; } if (avctx->pix_fmt == AV_PIX_FMT_YUV420P) { uint8_t *buf = lockBufferParams.bufferDataPtr; av_image_copy_plane(buf, lockBufferParams.pitch, frame->data[0], frame->linesize[0], avctx->width, avctx->height); buf += inSurf->height * lockBufferParams.pitch; av_image_copy_plane(buf, lockBufferParams.pitch >> 1, frame->data[2], frame->linesize[2], avctx->width >> 1, avctx->height >> 1); buf += (inSurf->height * lockBufferParams.pitch) >> 2; av_image_copy_plane(buf, lockBufferParams.pitch >> 1, frame->data[1], frame->linesize[1], avctx->width >> 1, avctx->height >> 1); } else if (avctx->pix_fmt == AV_PIX_FMT_NV12) { uint8_t *buf = lockBufferParams.bufferDataPtr; av_image_copy_plane(buf, lockBufferParams.pitch, frame->data[0], frame->linesize[0], avctx->width, avctx->height); buf += inSurf->height * lockBufferParams.pitch; av_image_copy_plane(buf, lockBufferParams.pitch, frame->data[1], frame->linesize[1], avctx->width, avctx->height >> 1); } else if (avctx->pix_fmt == AV_PIX_FMT_YUV444P) { uint8_t *buf = lockBufferParams.bufferDataPtr; av_image_copy_plane(buf, lockBufferParams.pitch, frame->data[0], frame->linesize[0], avctx->width, avctx->height); buf += inSurf->height * lockBufferParams.pitch; av_image_copy_plane(buf, lockBufferParams.pitch, frame->data[1], frame->linesize[1], avctx->width, avctx->height); buf += inSurf->height * lockBufferParams.pitch; av_image_copy_plane(buf, lockBufferParams.pitch, frame->data[2], frame->linesize[2], avctx->width, avctx->height); } else { av_log(avctx, AV_LOG_FATAL, "Invalid pixel format!\n"); return AVERROR(EINVAL); } nv_status = p_nvenc->nvEncUnlockInputBuffer(ctx->nvencoder, inSurf->input_surface); if (nv_status != NV_ENC_SUCCESS) { av_log(avctx, AV_LOG_FATAL, "Failed unlocking input buffer!\n"); return AVERROR_EXTERNAL; } for (i = 0; i < ctx->max_surface_count; ++i) if (!ctx->output_surfaces[i].busy) break; if (i == ctx->max_surface_count) { inSurf->lockCount = 0; av_log(avctx, AV_LOG_FATAL, "No free output surface found!\n"); return AVERROR_EXTERNAL; } ctx->output_surfaces[i].input_surface = inSurf; pic_params.inputBuffer = inSurf->input_surface; pic_params.bufferFmt = inSurf->format; pic_params.inputWidth = avctx->width; pic_params.inputHeight = avctx->height; pic_params.outputBitstream = ctx->output_surfaces[i].output_surface; pic_params.completionEvent = 0; if (avctx->flags & AV_CODEC_FLAG_INTERLACED_DCT) { if (frame->top_field_first) { pic_params.pictureStruct = NV_ENC_PIC_STRUCT_FIELD_TOP_BOTTOM; } else { pic_params.pictureStruct = NV_ENC_PIC_STRUCT_FIELD_BOTTOM_TOP; } } else { pic_params.pictureStruct = NV_ENC_PIC_STRUCT_FRAME; } pic_params.encodePicFlags = 0; pic_params.inputTimeStamp = frame->pts; pic_params.inputDuration = 0; switch (avctx->codec->id) { case AV_CODEC_ID_H264: pic_params.codecPicParams.h264PicParams.sliceMode = ctx->encode_config.encodeCodecConfig.h264Config.sliceMode; pic_params.codecPicParams.h264PicParams.sliceModeData = ctx->encode_config.encodeCodecConfig.h264Config.sliceModeData; break; case AV_CODEC_ID_H265: pic_params.codecPicParams.hevcPicParams.sliceMode = ctx->encode_config.encodeCodecConfig.hevcConfig.sliceMode; pic_params.codecPicParams.hevcPicParams.sliceModeData = ctx->encode_config.encodeCodecConfig.hevcConfig.sliceModeData; break; default: av_log(avctx, AV_LOG_ERROR, "Unknown codec name\n"); return AVERROR(EINVAL); } res = timestamp_queue_enqueue(&ctx->timestamp_list, frame->pts); if (res) return res; } else { pic_params.encodePicFlags = NV_ENC_PIC_FLAG_EOS; } nv_status = p_nvenc->nvEncEncodePicture(ctx->nvencoder, &pic_params); if (frame && nv_status == NV_ENC_ERR_NEED_MORE_INPUT) { res = out_surf_queue_enqueue(&ctx->output_surface_queue, &ctx->output_surfaces[i]); if (res) return res; ctx->output_surfaces[i].busy = 1; } if (nv_status != NV_ENC_SUCCESS && nv_status != NV_ENC_ERR_NEED_MORE_INPUT) { av_log(avctx, AV_LOG_ERROR, "EncodePicture failed!\n"); return AVERROR_EXTERNAL; } if (nv_status != NV_ENC_ERR_NEED_MORE_INPUT) { while (ctx->output_surface_queue.count) { tmpoutsurf = out_surf_queue_dequeue(&ctx->output_surface_queue); res = out_surf_queue_enqueue(&ctx->output_surface_ready_queue, tmpoutsurf); if (res) return res; } if (frame) { res = out_surf_queue_enqueue(&ctx->output_surface_ready_queue, &ctx->output_surfaces[i]); if (res) return res; ctx->output_surfaces[i].busy = 1; } } if (ctx->output_surface_ready_queue.count && (!frame || ctx->output_surface_ready_queue.count + ctx->output_surface_queue.count >= ctx->buffer_delay)) { tmpoutsurf = out_surf_queue_dequeue(&ctx->output_surface_ready_queue); res = process_output_surface(avctx, pkt, tmpoutsurf); if (res) return res; tmpoutsurf->busy = 0; av_assert0(tmpoutsurf->input_surface->lockCount); tmpoutsurf->input_surface->lockCount--; *got_packet = 1; } else { *got_packet = 0; } return 0; }
true
FFmpeg
82d705e245050c1040321022e200969f9c3ff9c3
static int nvenc_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet) { NVENCSTATUS nv_status; NvencOutputSurface *tmpoutsurf; int res, i = 0; NvencContext *ctx = avctx->priv_data; NvencDynLoadFunctions *dl_fn = &ctx->nvenc_dload_funcs; NV_ENCODE_API_FUNCTION_LIST *p_nvenc = &dl_fn->nvenc_funcs; NV_ENC_PIC_PARAMS pic_params = { 0 }; pic_params.version = NV_ENC_PIC_PARAMS_VER; if (frame) { NV_ENC_LOCK_INPUT_BUFFER lockBufferParams = { 0 }; NvencInputSurface *inSurf = NULL; for (i = 0; i < ctx->max_surface_count; ++i) { if (!ctx->input_surfaces[i].lockCount) { inSurf = &ctx->input_surfaces[i]; break; } } av_assert0(inSurf); inSurf->lockCount = 1; lockBufferParams.version = NV_ENC_LOCK_INPUT_BUFFER_VER; lockBufferParams.inputBuffer = inSurf->input_surface; nv_status = p_nvenc->nvEncLockInputBuffer(ctx->nvencoder, &lockBufferParams); if (nv_status != NV_ENC_SUCCESS) { av_log(avctx, AV_LOG_ERROR, "Failed locking nvenc input buffer\n"); return 0; } if (avctx->pix_fmt == AV_PIX_FMT_YUV420P) { uint8_t *buf = lockBufferParams.bufferDataPtr; av_image_copy_plane(buf, lockBufferParams.pitch, frame->data[0], frame->linesize[0], avctx->width, avctx->height); buf += inSurf->height * lockBufferParams.pitch; av_image_copy_plane(buf, lockBufferParams.pitch >> 1, frame->data[2], frame->linesize[2], avctx->width >> 1, avctx->height >> 1); buf += (inSurf->height * lockBufferParams.pitch) >> 2; av_image_copy_plane(buf, lockBufferParams.pitch >> 1, frame->data[1], frame->linesize[1], avctx->width >> 1, avctx->height >> 1); } else if (avctx->pix_fmt == AV_PIX_FMT_NV12) { uint8_t *buf = lockBufferParams.bufferDataPtr; av_image_copy_plane(buf, lockBufferParams.pitch, frame->data[0], frame->linesize[0], avctx->width, avctx->height); buf += inSurf->height * lockBufferParams.pitch; av_image_copy_plane(buf, lockBufferParams.pitch, frame->data[1], frame->linesize[1], avctx->width, avctx->height >> 1); } else if (avctx->pix_fmt == AV_PIX_FMT_YUV444P) { uint8_t *buf = lockBufferParams.bufferDataPtr; av_image_copy_plane(buf, lockBufferParams.pitch, frame->data[0], frame->linesize[0], avctx->width, avctx->height); buf += inSurf->height * lockBufferParams.pitch; av_image_copy_plane(buf, lockBufferParams.pitch, frame->data[1], frame->linesize[1], avctx->width, avctx->height); buf += inSurf->height * lockBufferParams.pitch; av_image_copy_plane(buf, lockBufferParams.pitch, frame->data[2], frame->linesize[2], avctx->width, avctx->height); } else { av_log(avctx, AV_LOG_FATAL, "Invalid pixel format!\n"); return AVERROR(EINVAL); } nv_status = p_nvenc->nvEncUnlockInputBuffer(ctx->nvencoder, inSurf->input_surface); if (nv_status != NV_ENC_SUCCESS) { av_log(avctx, AV_LOG_FATAL, "Failed unlocking input buffer!\n"); return AVERROR_EXTERNAL; } for (i = 0; i < ctx->max_surface_count; ++i) if (!ctx->output_surfaces[i].busy) break; if (i == ctx->max_surface_count) { inSurf->lockCount = 0; av_log(avctx, AV_LOG_FATAL, "No free output surface found!\n"); return AVERROR_EXTERNAL; } ctx->output_surfaces[i].input_surface = inSurf; pic_params.inputBuffer = inSurf->input_surface; pic_params.bufferFmt = inSurf->format; pic_params.inputWidth = avctx->width; pic_params.inputHeight = avctx->height; pic_params.outputBitstream = ctx->output_surfaces[i].output_surface; pic_params.completionEvent = 0; if (avctx->flags & AV_CODEC_FLAG_INTERLACED_DCT) { if (frame->top_field_first) { pic_params.pictureStruct = NV_ENC_PIC_STRUCT_FIELD_TOP_BOTTOM; } else { pic_params.pictureStruct = NV_ENC_PIC_STRUCT_FIELD_BOTTOM_TOP; } } else { pic_params.pictureStruct = NV_ENC_PIC_STRUCT_FRAME; } pic_params.encodePicFlags = 0; pic_params.inputTimeStamp = frame->pts; pic_params.inputDuration = 0; switch (avctx->codec->id) { case AV_CODEC_ID_H264: pic_params.codecPicParams.h264PicParams.sliceMode = ctx->encode_config.encodeCodecConfig.h264Config.sliceMode; pic_params.codecPicParams.h264PicParams.sliceModeData = ctx->encode_config.encodeCodecConfig.h264Config.sliceModeData; break; case AV_CODEC_ID_H265: pic_params.codecPicParams.hevcPicParams.sliceMode = ctx->encode_config.encodeCodecConfig.hevcConfig.sliceMode; pic_params.codecPicParams.hevcPicParams.sliceModeData = ctx->encode_config.encodeCodecConfig.hevcConfig.sliceModeData; break; default: av_log(avctx, AV_LOG_ERROR, "Unknown codec name\n"); return AVERROR(EINVAL); } res = timestamp_queue_enqueue(&ctx->timestamp_list, frame->pts); if (res) return res; } else { pic_params.encodePicFlags = NV_ENC_PIC_FLAG_EOS; } nv_status = p_nvenc->nvEncEncodePicture(ctx->nvencoder, &pic_params); if (frame && nv_status == NV_ENC_ERR_NEED_MORE_INPUT) { res = out_surf_queue_enqueue(&ctx->output_surface_queue, &ctx->output_surfaces[i]); if (res) return res; ctx->output_surfaces[i].busy = 1; } if (nv_status != NV_ENC_SUCCESS && nv_status != NV_ENC_ERR_NEED_MORE_INPUT) { av_log(avctx, AV_LOG_ERROR, "EncodePicture failed!\n"); return AVERROR_EXTERNAL; } if (nv_status != NV_ENC_ERR_NEED_MORE_INPUT) { while (ctx->output_surface_queue.count) { tmpoutsurf = out_surf_queue_dequeue(&ctx->output_surface_queue); res = out_surf_queue_enqueue(&ctx->output_surface_ready_queue, tmpoutsurf); if (res) return res; } if (frame) { res = out_surf_queue_enqueue(&ctx->output_surface_ready_queue, &ctx->output_surfaces[i]); if (res) return res; ctx->output_surfaces[i].busy = 1; } } if (ctx->output_surface_ready_queue.count && (!frame || ctx->output_surface_ready_queue.count + ctx->output_surface_queue.count >= ctx->buffer_delay)) { tmpoutsurf = out_surf_queue_dequeue(&ctx->output_surface_ready_queue); res = process_output_surface(avctx, pkt, tmpoutsurf); if (res) return res; tmpoutsurf->busy = 0; av_assert0(tmpoutsurf->input_surface->lockCount); tmpoutsurf->input_surface->lockCount--; *got_packet = 1; } else { *got_packet = 0; } return 0; }
{ "code": [ " NV_ENCODE_API_FUNCTION_LIST *p_nvenc = &dl_fn->nvenc_funcs;", " return AVERROR_EXTERNAL;", " switch (avctx->codec->id) {", " case AV_CODEC_ID_H264:", " case AV_CODEC_ID_H265:", " } else {", " } else {", " } else {", " } else {", " } else {", " } else {", " break;", " break;", " break;", " break;", " break;", " } else {", " } else {", " } else {", " } else {", " default:", " if (nv_status != NV_ENC_SUCCESS) {", " if (nv_status != NV_ENC_SUCCESS) {", " if (nv_status != NV_ENC_SUCCESS) {", " NV_ENC_LOCK_INPUT_BUFFER lockBufferParams = { 0 };", " NvencInputSurface *inSurf = NULL;", " for (i = 0; i < ctx->max_surface_count; ++i) {", " if (!ctx->input_surfaces[i].lockCount) {", " inSurf = &ctx->input_surfaces[i];", " break;", " inSurf->lockCount = 1;", " lockBufferParams.version = NV_ENC_LOCK_INPUT_BUFFER_VER;", " lockBufferParams.inputBuffer = inSurf->input_surface;", " nv_status = p_nvenc->nvEncLockInputBuffer(ctx->nvencoder, &lockBufferParams);", " if (nv_status != NV_ENC_SUCCESS) {", " av_log(avctx, AV_LOG_ERROR, \"Failed locking nvenc input buffer\\n\");", " return 0;", " if (avctx->pix_fmt == AV_PIX_FMT_YUV420P) {", " uint8_t *buf = lockBufferParams.bufferDataPtr;", " av_image_copy_plane(buf, lockBufferParams.pitch,", " frame->data[0], frame->linesize[0],", " avctx->width, avctx->height);", " buf += inSurf->height * lockBufferParams.pitch;", " av_image_copy_plane(buf, lockBufferParams.pitch >> 1,", " frame->data[2], frame->linesize[2],", " avctx->width >> 1, avctx->height >> 1);", " buf += (inSurf->height * lockBufferParams.pitch) >> 2;", " av_image_copy_plane(buf, lockBufferParams.pitch >> 1,", " frame->data[1], frame->linesize[1],", " avctx->width >> 1, avctx->height >> 1);", " } else if (avctx->pix_fmt == AV_PIX_FMT_NV12) {", " uint8_t *buf = lockBufferParams.bufferDataPtr;", " av_image_copy_plane(buf, lockBufferParams.pitch,", " frame->data[0], frame->linesize[0],", " avctx->width, avctx->height);", " buf += inSurf->height * lockBufferParams.pitch;", " av_image_copy_plane(buf, lockBufferParams.pitch,", " frame->data[1], frame->linesize[1],", " avctx->width, avctx->height >> 1);", " } else if (avctx->pix_fmt == AV_PIX_FMT_YUV444P) {", " uint8_t *buf = lockBufferParams.bufferDataPtr;", " av_image_copy_plane(buf, lockBufferParams.pitch,", " frame->data[0], frame->linesize[0],", " avctx->width, avctx->height);", " buf += inSurf->height * lockBufferParams.pitch;", " av_image_copy_plane(buf, lockBufferParams.pitch,", " frame->data[1], frame->linesize[1],", " avctx->width, avctx->height);", " buf += inSurf->height * lockBufferParams.pitch;", " av_image_copy_plane(buf, lockBufferParams.pitch,", " frame->data[2], frame->linesize[2],", " avctx->width, avctx->height);", " } else {", " av_log(avctx, AV_LOG_FATAL, \"Invalid pixel format!\\n\");", " return AVERROR(EINVAL);", " nv_status = p_nvenc->nvEncUnlockInputBuffer(ctx->nvencoder, inSurf->input_surface);", " if (nv_status != NV_ENC_SUCCESS) {", " av_log(avctx, AV_LOG_FATAL, \"Failed unlocking input buffer!\\n\");", " return AVERROR_EXTERNAL;", " switch (avctx->codec->id) {", " case AV_CODEC_ID_H264:", " pic_params.codecPicParams.h264PicParams.sliceMode = ctx->encode_config.encodeCodecConfig.h264Config.sliceMode;", " pic_params.codecPicParams.h264PicParams.sliceModeData = ctx->encode_config.encodeCodecConfig.h264Config.sliceModeData;", " break;", " case AV_CODEC_ID_H265:", " pic_params.codecPicParams.hevcPicParams.sliceMode = ctx->encode_config.encodeCodecConfig.hevcConfig.sliceMode;", " pic_params.codecPicParams.hevcPicParams.sliceModeData = ctx->encode_config.encodeCodecConfig.hevcConfig.sliceModeData;", " break;", " default:", " av_log(avctx, AV_LOG_ERROR, \"Unknown codec name\\n\");", " return AVERROR(EINVAL);", " if (res)" ], "line_no": [ 19, 329, 259, 261, 269, 173, 295, 239, 173, 239, 173, 43, 43, 43, 43, 43, 239, 173, 173, 239, 277, 67, 67, 67, 31, 33, 37, 39, 41, 43, 55, 59, 61, 65, 67, 69, 71, 77, 79, 83, 85, 87, 91, 95, 97, 99, 103, 95, 109, 99, 113, 79, 83, 85, 87, 91, 83, 109, 135, 137, 79, 83, 85, 87, 91, 83, 109, 87, 91, 83, 97, 87, 173, 175, 177, 183, 67, 187, 189, 259, 261, 263, 265, 267, 269, 271, 273, 267, 277, 279, 281, 291 ] }
static int FUNC_0(AVCodecContext *VAR_0, AVPacket *VAR_1, const AVFrame *VAR_2, int *VAR_3) { NVENCSTATUS nv_status; NvencOutputSurface *tmpoutsurf; int VAR_4, VAR_5 = 0; NvencContext *ctx = VAR_0->priv_data; NvencDynLoadFunctions *dl_fn = &ctx->nvenc_dload_funcs; NV_ENCODE_API_FUNCTION_LIST *p_nvenc = &dl_fn->nvenc_funcs; NV_ENC_PIC_PARAMS pic_params = { 0 }; pic_params.version = NV_ENC_PIC_PARAMS_VER; if (VAR_2) { NV_ENC_LOCK_INPUT_BUFFER lockBufferParams = { 0 }; NvencInputSurface *inSurf = NULL; for (VAR_5 = 0; VAR_5 < ctx->max_surface_count; ++VAR_5) { if (!ctx->input_surfaces[VAR_5].lockCount) { inSurf = &ctx->input_surfaces[VAR_5]; break; } } av_assert0(inSurf); inSurf->lockCount = 1; lockBufferParams.version = NV_ENC_LOCK_INPUT_BUFFER_VER; lockBufferParams.inputBuffer = inSurf->input_surface; nv_status = p_nvenc->nvEncLockInputBuffer(ctx->nvencoder, &lockBufferParams); if (nv_status != NV_ENC_SUCCESS) { av_log(VAR_0, AV_LOG_ERROR, "Failed locking nvenc input buffer\n"); return 0; } if (VAR_0->pix_fmt == AV_PIX_FMT_YUV420P) { uint8_t *buf = lockBufferParams.bufferDataPtr; av_image_copy_plane(buf, lockBufferParams.pitch, VAR_2->data[0], VAR_2->linesize[0], VAR_0->width, VAR_0->height); buf += inSurf->height * lockBufferParams.pitch; av_image_copy_plane(buf, lockBufferParams.pitch >> 1, VAR_2->data[2], VAR_2->linesize[2], VAR_0->width >> 1, VAR_0->height >> 1); buf += (inSurf->height * lockBufferParams.pitch) >> 2; av_image_copy_plane(buf, lockBufferParams.pitch >> 1, VAR_2->data[1], VAR_2->linesize[1], VAR_0->width >> 1, VAR_0->height >> 1); } else if (VAR_0->pix_fmt == AV_PIX_FMT_NV12) { uint8_t *buf = lockBufferParams.bufferDataPtr; av_image_copy_plane(buf, lockBufferParams.pitch, VAR_2->data[0], VAR_2->linesize[0], VAR_0->width, VAR_0->height); buf += inSurf->height * lockBufferParams.pitch; av_image_copy_plane(buf, lockBufferParams.pitch, VAR_2->data[1], VAR_2->linesize[1], VAR_0->width, VAR_0->height >> 1); } else if (VAR_0->pix_fmt == AV_PIX_FMT_YUV444P) { uint8_t *buf = lockBufferParams.bufferDataPtr; av_image_copy_plane(buf, lockBufferParams.pitch, VAR_2->data[0], VAR_2->linesize[0], VAR_0->width, VAR_0->height); buf += inSurf->height * lockBufferParams.pitch; av_image_copy_plane(buf, lockBufferParams.pitch, VAR_2->data[1], VAR_2->linesize[1], VAR_0->width, VAR_0->height); buf += inSurf->height * lockBufferParams.pitch; av_image_copy_plane(buf, lockBufferParams.pitch, VAR_2->data[2], VAR_2->linesize[2], VAR_0->width, VAR_0->height); } else { av_log(VAR_0, AV_LOG_FATAL, "Invalid pixel format!\n"); return AVERROR(EINVAL); } nv_status = p_nvenc->nvEncUnlockInputBuffer(ctx->nvencoder, inSurf->input_surface); if (nv_status != NV_ENC_SUCCESS) { av_log(VAR_0, AV_LOG_FATAL, "Failed unlocking input buffer!\n"); return AVERROR_EXTERNAL; } for (VAR_5 = 0; VAR_5 < ctx->max_surface_count; ++VAR_5) if (!ctx->output_surfaces[VAR_5].busy) break; if (VAR_5 == ctx->max_surface_count) { inSurf->lockCount = 0; av_log(VAR_0, AV_LOG_FATAL, "No free output surface found!\n"); return AVERROR_EXTERNAL; } ctx->output_surfaces[VAR_5].input_surface = inSurf; pic_params.inputBuffer = inSurf->input_surface; pic_params.bufferFmt = inSurf->format; pic_params.inputWidth = VAR_0->width; pic_params.inputHeight = VAR_0->height; pic_params.outputBitstream = ctx->output_surfaces[VAR_5].output_surface; pic_params.completionEvent = 0; if (VAR_0->flags & AV_CODEC_FLAG_INTERLACED_DCT) { if (VAR_2->top_field_first) { pic_params.pictureStruct = NV_ENC_PIC_STRUCT_FIELD_TOP_BOTTOM; } else { pic_params.pictureStruct = NV_ENC_PIC_STRUCT_FIELD_BOTTOM_TOP; } } else { pic_params.pictureStruct = NV_ENC_PIC_STRUCT_FRAME; } pic_params.encodePicFlags = 0; pic_params.inputTimeStamp = VAR_2->pts; pic_params.inputDuration = 0; switch (VAR_0->codec->id) { case AV_CODEC_ID_H264: pic_params.codecPicParams.h264PicParams.sliceMode = ctx->encode_config.encodeCodecConfig.h264Config.sliceMode; pic_params.codecPicParams.h264PicParams.sliceModeData = ctx->encode_config.encodeCodecConfig.h264Config.sliceModeData; break; case AV_CODEC_ID_H265: pic_params.codecPicParams.hevcPicParams.sliceMode = ctx->encode_config.encodeCodecConfig.hevcConfig.sliceMode; pic_params.codecPicParams.hevcPicParams.sliceModeData = ctx->encode_config.encodeCodecConfig.hevcConfig.sliceModeData; break; default: av_log(VAR_0, AV_LOG_ERROR, "Unknown codec name\n"); return AVERROR(EINVAL); } VAR_4 = timestamp_queue_enqueue(&ctx->timestamp_list, VAR_2->pts); if (VAR_4) return VAR_4; } else { pic_params.encodePicFlags = NV_ENC_PIC_FLAG_EOS; } nv_status = p_nvenc->nvEncEncodePicture(ctx->nvencoder, &pic_params); if (VAR_2 && nv_status == NV_ENC_ERR_NEED_MORE_INPUT) { VAR_4 = out_surf_queue_enqueue(&ctx->output_surface_queue, &ctx->output_surfaces[VAR_5]); if (VAR_4) return VAR_4; ctx->output_surfaces[VAR_5].busy = 1; } if (nv_status != NV_ENC_SUCCESS && nv_status != NV_ENC_ERR_NEED_MORE_INPUT) { av_log(VAR_0, AV_LOG_ERROR, "EncodePicture failed!\n"); return AVERROR_EXTERNAL; } if (nv_status != NV_ENC_ERR_NEED_MORE_INPUT) { while (ctx->output_surface_queue.count) { tmpoutsurf = out_surf_queue_dequeue(&ctx->output_surface_queue); VAR_4 = out_surf_queue_enqueue(&ctx->output_surface_ready_queue, tmpoutsurf); if (VAR_4) return VAR_4; } if (VAR_2) { VAR_4 = out_surf_queue_enqueue(&ctx->output_surface_ready_queue, &ctx->output_surfaces[VAR_5]); if (VAR_4) return VAR_4; ctx->output_surfaces[VAR_5].busy = 1; } } if (ctx->output_surface_ready_queue.count && (!VAR_2 || ctx->output_surface_ready_queue.count + ctx->output_surface_queue.count >= ctx->buffer_delay)) { tmpoutsurf = out_surf_queue_dequeue(&ctx->output_surface_ready_queue); VAR_4 = process_output_surface(VAR_0, VAR_1, tmpoutsurf); if (VAR_4) return VAR_4; tmpoutsurf->busy = 0; av_assert0(tmpoutsurf->input_surface->lockCount); tmpoutsurf->input_surface->lockCount--; *VAR_3 = 1; } else { *VAR_3 = 0; } return 0; }
[ "static int FUNC_0(AVCodecContext *VAR_0, AVPacket *VAR_1,\nconst AVFrame *VAR_2, int *VAR_3)\n{", "NVENCSTATUS nv_status;", "NvencOutputSurface *tmpoutsurf;", "int VAR_4, VAR_5 = 0;", "NvencContext *ctx = VAR_0->priv_data;", "NvencDynLoadFunctions *dl_fn = &ctx->nvenc_dload_funcs;", "NV_ENCODE_API_FUNCTION_LIST *p_nvenc = &dl_fn->nvenc_funcs;", "NV_ENC_PIC_PARAMS pic_params = { 0 };", "pic_params.version = NV_ENC_PIC_PARAMS_VER;", "if (VAR_2) {", "NV_ENC_LOCK_INPUT_BUFFER lockBufferParams = { 0 };", "NvencInputSurface *inSurf = NULL;", "for (VAR_5 = 0; VAR_5 < ctx->max_surface_count; ++VAR_5) {", "if (!ctx->input_surfaces[VAR_5].lockCount) {", "inSurf = &ctx->input_surfaces[VAR_5];", "break;", "}", "}", "av_assert0(inSurf);", "inSurf->lockCount = 1;", "lockBufferParams.version = NV_ENC_LOCK_INPUT_BUFFER_VER;", "lockBufferParams.inputBuffer = inSurf->input_surface;", "nv_status = p_nvenc->nvEncLockInputBuffer(ctx->nvencoder, &lockBufferParams);", "if (nv_status != NV_ENC_SUCCESS) {", "av_log(VAR_0, AV_LOG_ERROR, \"Failed locking nvenc input buffer\\n\");", "return 0;", "}", "if (VAR_0->pix_fmt == AV_PIX_FMT_YUV420P) {", "uint8_t *buf = lockBufferParams.bufferDataPtr;", "av_image_copy_plane(buf, lockBufferParams.pitch,\nVAR_2->data[0], VAR_2->linesize[0],\nVAR_0->width, VAR_0->height);", "buf += inSurf->height * lockBufferParams.pitch;", "av_image_copy_plane(buf, lockBufferParams.pitch >> 1,\nVAR_2->data[2], VAR_2->linesize[2],\nVAR_0->width >> 1, VAR_0->height >> 1);", "buf += (inSurf->height * lockBufferParams.pitch) >> 2;", "av_image_copy_plane(buf, lockBufferParams.pitch >> 1,\nVAR_2->data[1], VAR_2->linesize[1],\nVAR_0->width >> 1, VAR_0->height >> 1);", "} else if (VAR_0->pix_fmt == AV_PIX_FMT_NV12) {", "uint8_t *buf = lockBufferParams.bufferDataPtr;", "av_image_copy_plane(buf, lockBufferParams.pitch,\nVAR_2->data[0], VAR_2->linesize[0],\nVAR_0->width, VAR_0->height);", "buf += inSurf->height * lockBufferParams.pitch;", "av_image_copy_plane(buf, lockBufferParams.pitch,\nVAR_2->data[1], VAR_2->linesize[1],\nVAR_0->width, VAR_0->height >> 1);", "} else if (VAR_0->pix_fmt == AV_PIX_FMT_YUV444P) {", "uint8_t *buf = lockBufferParams.bufferDataPtr;", "av_image_copy_plane(buf, lockBufferParams.pitch,\nVAR_2->data[0], VAR_2->linesize[0],\nVAR_0->width, VAR_0->height);", "buf += inSurf->height * lockBufferParams.pitch;", "av_image_copy_plane(buf, lockBufferParams.pitch,\nVAR_2->data[1], VAR_2->linesize[1],\nVAR_0->width, VAR_0->height);", "buf += inSurf->height * lockBufferParams.pitch;", "av_image_copy_plane(buf, lockBufferParams.pitch,\nVAR_2->data[2], VAR_2->linesize[2],\nVAR_0->width, VAR_0->height);", "} else {", "av_log(VAR_0, AV_LOG_FATAL, \"Invalid pixel format!\\n\");", "return AVERROR(EINVAL);", "}", "nv_status = p_nvenc->nvEncUnlockInputBuffer(ctx->nvencoder, inSurf->input_surface);", "if (nv_status != NV_ENC_SUCCESS) {", "av_log(VAR_0, AV_LOG_FATAL, \"Failed unlocking input buffer!\\n\");", "return AVERROR_EXTERNAL;", "}", "for (VAR_5 = 0; VAR_5 < ctx->max_surface_count; ++VAR_5)", "if (!ctx->output_surfaces[VAR_5].busy)\nbreak;", "if (VAR_5 == ctx->max_surface_count) {", "inSurf->lockCount = 0;", "av_log(VAR_0, AV_LOG_FATAL, \"No free output surface found!\\n\");", "return AVERROR_EXTERNAL;", "}", "ctx->output_surfaces[VAR_5].input_surface = inSurf;", "pic_params.inputBuffer = inSurf->input_surface;", "pic_params.bufferFmt = inSurf->format;", "pic_params.inputWidth = VAR_0->width;", "pic_params.inputHeight = VAR_0->height;", "pic_params.outputBitstream = ctx->output_surfaces[VAR_5].output_surface;", "pic_params.completionEvent = 0;", "if (VAR_0->flags & AV_CODEC_FLAG_INTERLACED_DCT) {", "if (VAR_2->top_field_first) {", "pic_params.pictureStruct = NV_ENC_PIC_STRUCT_FIELD_TOP_BOTTOM;", "} else {", "pic_params.pictureStruct = NV_ENC_PIC_STRUCT_FIELD_BOTTOM_TOP;", "}", "} else {", "pic_params.pictureStruct = NV_ENC_PIC_STRUCT_FRAME;", "}", "pic_params.encodePicFlags = 0;", "pic_params.inputTimeStamp = VAR_2->pts;", "pic_params.inputDuration = 0;", "switch (VAR_0->codec->id) {", "case AV_CODEC_ID_H264:\npic_params.codecPicParams.h264PicParams.sliceMode = ctx->encode_config.encodeCodecConfig.h264Config.sliceMode;", "pic_params.codecPicParams.h264PicParams.sliceModeData = ctx->encode_config.encodeCodecConfig.h264Config.sliceModeData;", "break;", "case AV_CODEC_ID_H265:\npic_params.codecPicParams.hevcPicParams.sliceMode = ctx->encode_config.encodeCodecConfig.hevcConfig.sliceMode;", "pic_params.codecPicParams.hevcPicParams.sliceModeData = ctx->encode_config.encodeCodecConfig.hevcConfig.sliceModeData;", "break;", "default:\nav_log(VAR_0, AV_LOG_ERROR, \"Unknown codec name\\n\");", "return AVERROR(EINVAL);", "}", "VAR_4 = timestamp_queue_enqueue(&ctx->timestamp_list, VAR_2->pts);", "if (VAR_4)\nreturn VAR_4;", "} else {", "pic_params.encodePicFlags = NV_ENC_PIC_FLAG_EOS;", "}", "nv_status = p_nvenc->nvEncEncodePicture(ctx->nvencoder, &pic_params);", "if (VAR_2 && nv_status == NV_ENC_ERR_NEED_MORE_INPUT) {", "VAR_4 = out_surf_queue_enqueue(&ctx->output_surface_queue, &ctx->output_surfaces[VAR_5]);", "if (VAR_4)\nreturn VAR_4;", "ctx->output_surfaces[VAR_5].busy = 1;", "}", "if (nv_status != NV_ENC_SUCCESS && nv_status != NV_ENC_ERR_NEED_MORE_INPUT) {", "av_log(VAR_0, AV_LOG_ERROR, \"EncodePicture failed!\\n\");", "return AVERROR_EXTERNAL;", "}", "if (nv_status != NV_ENC_ERR_NEED_MORE_INPUT) {", "while (ctx->output_surface_queue.count) {", "tmpoutsurf = out_surf_queue_dequeue(&ctx->output_surface_queue);", "VAR_4 = out_surf_queue_enqueue(&ctx->output_surface_ready_queue, tmpoutsurf);", "if (VAR_4)\nreturn VAR_4;", "}", "if (VAR_2) {", "VAR_4 = out_surf_queue_enqueue(&ctx->output_surface_ready_queue, &ctx->output_surfaces[VAR_5]);", "if (VAR_4)\nreturn VAR_4;", "ctx->output_surfaces[VAR_5].busy = 1;", "}", "}", "if (ctx->output_surface_ready_queue.count && (!VAR_2 || ctx->output_surface_ready_queue.count + ctx->output_surface_queue.count >= ctx->buffer_delay)) {", "tmpoutsurf = out_surf_queue_dequeue(&ctx->output_surface_ready_queue);", "VAR_4 = process_output_surface(VAR_0, VAR_1, tmpoutsurf);", "if (VAR_4)\nreturn VAR_4;", "tmpoutsurf->busy = 0;", "av_assert0(tmpoutsurf->input_surface->lockCount);", "tmpoutsurf->input_surface->lockCount--;", "*VAR_3 = 1;", "} else {", "*VAR_3 = 0;", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 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, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 55 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 79 ], [ 83, 85, 87 ], [ 91 ], [ 95, 97, 99 ], [ 103 ], [ 107, 109, 111 ], [ 113 ], [ 115 ], [ 119, 121, 123 ], [ 127 ], [ 131, 133, 135 ], [ 137 ], [ 139 ], [ 143, 145, 147 ], [ 151 ], [ 155, 157, 159 ], [ 163 ], [ 167, 169, 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 195 ], [ 197, 199 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 215 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261, 263 ], [ 265 ], [ 267 ], [ 269, 271 ], [ 273 ], [ 275 ], [ 277, 279 ], [ 281 ], [ 283 ], [ 287 ], [ 291, 293 ], [ 295 ], [ 297 ], [ 299 ], [ 303 ], [ 307 ], [ 309 ], [ 313, 315 ], [ 319 ], [ 321 ], [ 325 ], [ 327 ], [ 329 ], [ 331 ], [ 335 ], [ 337 ], [ 339 ], [ 341 ], [ 345, 347 ], [ 349 ], [ 353 ], [ 355 ], [ 359, 361 ], [ 365 ], [ 367 ], [ 369 ], [ 373 ], [ 375 ], [ 379 ], [ 383, 385 ], [ 389 ], [ 391 ], [ 393 ], [ 397 ], [ 399 ], [ 401 ], [ 403 ], [ 407 ], [ 409 ] ]
24,145
static int mov_read_glbl(MOVContext *c, ByteIOContext *pb, MOVAtom atom) { AVStream *st = c->fc->streams[c->fc->nb_streams-1]; if((uint64_t)atom.size > (1<<30)) return -1; av_free(st->codec->extradata); st->codec->extradata = av_mallocz(atom.size + FF_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) return AVERROR(ENOMEM); st->codec->extradata_size = atom.size; get_buffer(pb, st->codec->extradata, atom.size); return 0; }
false
FFmpeg
6a63ff19b6a7fe3bc32c7fb4a62fca8f65786432
static int mov_read_glbl(MOVContext *c, ByteIOContext *pb, MOVAtom atom) { AVStream *st = c->fc->streams[c->fc->nb_streams-1]; if((uint64_t)atom.size > (1<<30)) return -1; av_free(st->codec->extradata); st->codec->extradata = av_mallocz(atom.size + FF_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) return AVERROR(ENOMEM); st->codec->extradata_size = atom.size; get_buffer(pb, st->codec->extradata, atom.size); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(MOVContext *VAR_0, ByteIOContext *VAR_1, MOVAtom VAR_2) { AVStream *st = VAR_0->fc->streams[VAR_0->fc->nb_streams-1]; if((uint64_t)VAR_2.size > (1<<30)) return -1; av_free(st->codec->extradata); st->codec->extradata = av_mallocz(VAR_2.size + FF_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) return AVERROR(ENOMEM); st->codec->extradata_size = VAR_2.size; get_buffer(VAR_1, st->codec->extradata, VAR_2.size); return 0; }
[ "static int FUNC_0(MOVContext *VAR_0, ByteIOContext *VAR_1, MOVAtom VAR_2)\n{", "AVStream *st = VAR_0->fc->streams[VAR_0->fc->nb_streams-1];", "if((uint64_t)VAR_2.size > (1<<30))\nreturn -1;", "av_free(st->codec->extradata);", "st->codec->extradata = av_mallocz(VAR_2.size + FF_INPUT_BUFFER_PADDING_SIZE);", "if (!st->codec->extradata)\nreturn AVERROR(ENOMEM);", "st->codec->extradata_size = VAR_2.size;", "get_buffer(VAR_1, st->codec->extradata, VAR_2.size);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11 ], [ 15 ], [ 17 ], [ 19, 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ] ]
24,146
static uint64_t find_any_startcode(ByteIOContext *bc, int64_t pos){ uint64_t state=0; if(pos >= 0) url_fseek(bc, pos, SEEK_SET); //note, this may fail if the stream isnt seekable, but that shouldnt matter, as in this case we simply start where we are currently while(bytes_left(bc)){ state= (state<<8) | get_byte(bc); if((state>>56) != 'N') continue; switch(state){ case MAIN_STARTCODE: case STREAM_STARTCODE: case KEYFRAME_STARTCODE: case INFO_STARTCODE: case INDEX_STARTCODE: return state; } } return 0; }
false
FFmpeg
465e1dadbef7596a3eb87089a66bb4ecdc26d3c4
static uint64_t find_any_startcode(ByteIOContext *bc, int64_t pos){ uint64_t state=0; if(pos >= 0) url_fseek(bc, pos, SEEK_SET); while(bytes_left(bc)){ state= (state<<8) | get_byte(bc); if((state>>56) != 'N') continue; switch(state){ case MAIN_STARTCODE: case STREAM_STARTCODE: case KEYFRAME_STARTCODE: case INFO_STARTCODE: case INDEX_STARTCODE: return state; } } return 0; }
{ "code": [], "line_no": [] }
static uint64_t FUNC_0(ByteIOContext *bc, int64_t pos){ uint64_t state=0; if(pos >= 0) url_fseek(bc, pos, SEEK_SET); while(bytes_left(bc)){ state= (state<<8) | get_byte(bc); if((state>>56) != 'N') continue; switch(state){ case MAIN_STARTCODE: case STREAM_STARTCODE: case KEYFRAME_STARTCODE: case INFO_STARTCODE: case INDEX_STARTCODE: return state; } } return 0; }
[ "static uint64_t FUNC_0(ByteIOContext *bc, int64_t pos){", "uint64_t state=0;", "if(pos >= 0)\nurl_fseek(bc, pos, SEEK_SET);", "while(bytes_left(bc)){", "state= (state<<8) | get_byte(bc);", "if((state>>56) != 'N')\ncontinue;", "switch(state){", "case MAIN_STARTCODE:\ncase STREAM_STARTCODE:\ncase KEYFRAME_STARTCODE:\ncase INFO_STARTCODE:\ncase INDEX_STARTCODE:\nreturn state;", "}", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 7, 9 ], [ 13 ], [ 15 ], [ 17, 19 ], [ 21 ], [ 23, 25, 27, 29, 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ] ]
24,147
static void ape_unpack_stereo(APEContext *ctx, int count) { int32_t left, right; int32_t *decoded0 = ctx->decoded[0]; int32_t *decoded1 = ctx->decoded[1]; if (ctx->frameflags & APE_FRAMECODE_STEREO_SILENCE) { /* We are pure silence, so we're done. */ av_log(ctx->avctx, AV_LOG_DEBUG, "pure silence stereo\n"); return; } entropy_decode(ctx, count, 1); ape_apply_filters(ctx, decoded0, decoded1, count); /* Now apply the predictor decoding */ predictor_decode_stereo(ctx, count); /* Decorrelate and scale to output depth */ while (count--) { left = *decoded1 - (*decoded0 / 2); right = left + *decoded0; *(decoded0++) = left; *(decoded1++) = right; } }
false
FFmpeg
b164d66e35d349de414e2f0d7365a147aba8a620
static void ape_unpack_stereo(APEContext *ctx, int count) { int32_t left, right; int32_t *decoded0 = ctx->decoded[0]; int32_t *decoded1 = ctx->decoded[1]; if (ctx->frameflags & APE_FRAMECODE_STEREO_SILENCE) { av_log(ctx->avctx, AV_LOG_DEBUG, "pure silence stereo\n"); return; } entropy_decode(ctx, count, 1); ape_apply_filters(ctx, decoded0, decoded1, count); predictor_decode_stereo(ctx, count); while (count--) { left = *decoded1 - (*decoded0 / 2); right = left + *decoded0; *(decoded0++) = left; *(decoded1++) = right; } }
{ "code": [], "line_no": [] }
static void FUNC_0(APEContext *VAR_0, int VAR_1) { int32_t left, right; int32_t *decoded0 = VAR_0->decoded[0]; int32_t *decoded1 = VAR_0->decoded[1]; if (VAR_0->frameflags & APE_FRAMECODE_STEREO_SILENCE) { av_log(VAR_0->avctx, AV_LOG_DEBUG, "pure silence stereo\n"); return; } entropy_decode(VAR_0, VAR_1, 1); ape_apply_filters(VAR_0, decoded0, decoded1, VAR_1); predictor_decode_stereo(VAR_0, VAR_1); while (VAR_1--) { left = *decoded1 - (*decoded0 / 2); right = left + *decoded0; *(decoded0++) = left; *(decoded1++) = right; } }
[ "static void FUNC_0(APEContext *VAR_0, int VAR_1)\n{", "int32_t left, right;", "int32_t *decoded0 = VAR_0->decoded[0];", "int32_t *decoded1 = VAR_0->decoded[1];", "if (VAR_0->frameflags & APE_FRAMECODE_STEREO_SILENCE) {", "av_log(VAR_0->avctx, AV_LOG_DEBUG, \"pure silence stereo\\n\");", "return;", "}", "entropy_decode(VAR_0, VAR_1, 1);", "ape_apply_filters(VAR_0, decoded0, decoded1, VAR_1);", "predictor_decode_stereo(VAR_0, VAR_1);", "while (VAR_1--) {", "left = *decoded1 - (*decoded0 / 2);", "right = left + *decoded0;", "*(decoded0++) = left;", "*(decoded1++) = right;", "}", "}" ]
[ 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 ], [ 25 ], [ 27 ], [ 33 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ] ]
24,149
static void jpeg_init_destination(j_compress_ptr cinfo) { VncState *vs = cinfo->client_data; Buffer *buffer = &vs->tight_jpeg; cinfo->dest->next_output_byte = (JOCTET *)buffer->buffer + buffer->offset; cinfo->dest->free_in_buffer = (size_t)(buffer->capacity - buffer->offset); }
false
qemu
245f7b51c0ea04fb2224b1127430a096c91aee70
static void jpeg_init_destination(j_compress_ptr cinfo) { VncState *vs = cinfo->client_data; Buffer *buffer = &vs->tight_jpeg; cinfo->dest->next_output_byte = (JOCTET *)buffer->buffer + buffer->offset; cinfo->dest->free_in_buffer = (size_t)(buffer->capacity - buffer->offset); }
{ "code": [], "line_no": [] }
static void FUNC_0(j_compress_ptr VAR_0) { VncState *vs = VAR_0->client_data; Buffer *buffer = &vs->tight_jpeg; VAR_0->dest->next_output_byte = (JOCTET *)buffer->buffer + buffer->offset; VAR_0->dest->free_in_buffer = (size_t)(buffer->capacity - buffer->offset); }
[ "static void FUNC_0(j_compress_ptr VAR_0)\n{", "VncState *vs = VAR_0->client_data;", "Buffer *buffer = &vs->tight_jpeg;", "VAR_0->dest->next_output_byte = (JOCTET *)buffer->buffer + buffer->offset;", "VAR_0->dest->free_in_buffer = (size_t)(buffer->capacity - buffer->offset);", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ] ]
24,150
static void ref405ep_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) { char *filename; ppc4xx_bd_info_t bd; CPUPPCState *env; qemu_irq *pic; ram_addr_t sram_offset, bios_offset, bdloc; target_phys_addr_t ram_bases[2], ram_sizes[2]; target_ulong sram_size; long bios_size; //int phy_addr = 0; //static int phy_addr = 1; target_ulong kernel_base, initrd_base; long kernel_size, initrd_size; int linux_boot; int fl_idx, fl_sectors, len; DriveInfo *dinfo; /* XXX: fix this */ ram_bases[0] = qemu_ram_alloc(NULL, "ef405ep.ram", 0x08000000); ram_sizes[0] = 0x08000000; ram_bases[1] = 0x00000000; ram_sizes[1] = 0x00000000; ram_size = 128 * 1024 * 1024; #ifdef DEBUG_BOARD_INIT printf("%s: register cpu\n", __func__); #endif env = ppc405ep_init(ram_bases, ram_sizes, 33333333, &pic, kernel_filename == NULL ? 0 : 1); /* allocate SRAM */ sram_size = 512 * 1024; sram_offset = qemu_ram_alloc(NULL, "ef405ep.sram", sram_size); #ifdef DEBUG_BOARD_INIT printf("%s: register SRAM at offset %08lx\n", __func__, sram_offset); #endif cpu_register_physical_memory(0xFFF00000, sram_size, sram_offset | IO_MEM_RAM); /* allocate and load BIOS */ #ifdef DEBUG_BOARD_INIT printf("%s: register BIOS\n", __func__); #endif fl_idx = 0; #ifdef USE_FLASH_BIOS dinfo = drive_get(IF_PFLASH, 0, fl_idx); if (dinfo) { bios_size = bdrv_getlength(dinfo->bdrv); bios_offset = qemu_ram_alloc(NULL, "ef405ep.bios", bios_size); fl_sectors = (bios_size + 65535) >> 16; #ifdef DEBUG_BOARD_INIT printf("Register parallel flash %d size %lx" " at offset %08lx addr %lx '%s' %d\n", fl_idx, bios_size, bios_offset, -bios_size, bdrv_get_device_name(dinfo->bdrv), fl_sectors); #endif pflash_cfi02_register((uint32_t)(-bios_size), bios_offset, dinfo->bdrv, 65536, fl_sectors, 1, 2, 0x0001, 0x22DA, 0x0000, 0x0000, 0x555, 0x2AA, 1); fl_idx++; } else #endif { #ifdef DEBUG_BOARD_INIT printf("Load BIOS from file\n"); #endif bios_offset = qemu_ram_alloc(NULL, "ef405ep.bios", BIOS_SIZE); if (bios_name == NULL) bios_name = BIOS_FILENAME; filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); if (filename) { bios_size = load_image(filename, qemu_get_ram_ptr(bios_offset)); g_free(filename); } else { bios_size = -1; } if (bios_size < 0 || bios_size > BIOS_SIZE) { fprintf(stderr, "qemu: could not load PowerPC bios '%s'\n", bios_name); exit(1); } bios_size = (bios_size + 0xfff) & ~0xfff; cpu_register_physical_memory((uint32_t)(-bios_size), bios_size, bios_offset | IO_MEM_ROM); } /* Register FPGA */ #ifdef DEBUG_BOARD_INIT printf("%s: register FPGA\n", __func__); #endif ref405ep_fpga_init(0xF0300000); /* Register NVRAM */ #ifdef DEBUG_BOARD_INIT printf("%s: register NVRAM\n", __func__); #endif m48t59_init(NULL, 0xF0000000, 0, 8192, 8); /* Load kernel */ linux_boot = (kernel_filename != NULL); if (linux_boot) { #ifdef DEBUG_BOARD_INIT printf("%s: load kernel\n", __func__); #endif memset(&bd, 0, sizeof(bd)); bd.bi_memstart = 0x00000000; bd.bi_memsize = ram_size; bd.bi_flashstart = -bios_size; bd.bi_flashsize = -bios_size; bd.bi_flashoffset = 0; bd.bi_sramstart = 0xFFF00000; bd.bi_sramsize = sram_size; bd.bi_bootflags = 0; bd.bi_intfreq = 133333333; bd.bi_busfreq = 33333333; bd.bi_baudrate = 115200; bd.bi_s_version[0] = 'Q'; bd.bi_s_version[1] = 'M'; bd.bi_s_version[2] = 'U'; bd.bi_s_version[3] = '\0'; bd.bi_r_version[0] = 'Q'; bd.bi_r_version[1] = 'E'; bd.bi_r_version[2] = 'M'; bd.bi_r_version[3] = 'U'; bd.bi_r_version[4] = '\0'; bd.bi_procfreq = 133333333; bd.bi_plb_busfreq = 33333333; bd.bi_pci_busfreq = 33333333; bd.bi_opbfreq = 33333333; bdloc = ppc405_set_bootinfo(env, &bd, 0x00000001); env->gpr[3] = bdloc; kernel_base = KERNEL_LOAD_ADDR; /* now we can load the kernel */ kernel_size = load_image_targphys(kernel_filename, kernel_base, ram_size - kernel_base); if (kernel_size < 0) { fprintf(stderr, "qemu: could not load kernel '%s'\n", kernel_filename); exit(1); } printf("Load kernel size %ld at " TARGET_FMT_lx, kernel_size, kernel_base); /* load initrd */ if (initrd_filename) { initrd_base = INITRD_LOAD_ADDR; 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); } } else { initrd_base = 0; initrd_size = 0; } env->gpr[4] = initrd_base; env->gpr[5] = initrd_size; if (kernel_cmdline != NULL) { len = strlen(kernel_cmdline); bdloc -= ((len + 255) & ~255); cpu_physical_memory_write(bdloc, (void *)kernel_cmdline, len + 1); env->gpr[6] = bdloc; env->gpr[7] = bdloc + len; } else { env->gpr[6] = 0; env->gpr[7] = 0; } env->nip = KERNEL_LOAD_ADDR; } else { kernel_base = 0; kernel_size = 0; initrd_base = 0; initrd_size = 0; bdloc = 0; } #ifdef DEBUG_BOARD_INIT printf("%s: Done\n", __func__); #endif printf("bdloc %016lx\n", (unsigned long)bdloc); }
false
qemu
b6dcbe086c77ec683f5ff0b693593cda1d61f3a1
static void ref405ep_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) { char *filename; ppc4xx_bd_info_t bd; CPUPPCState *env; qemu_irq *pic; ram_addr_t sram_offset, bios_offset, bdloc; target_phys_addr_t ram_bases[2], ram_sizes[2]; target_ulong sram_size; long bios_size; target_ulong kernel_base, initrd_base; long kernel_size, initrd_size; int linux_boot; int fl_idx, fl_sectors, len; DriveInfo *dinfo; ram_bases[0] = qemu_ram_alloc(NULL, "ef405ep.ram", 0x08000000); ram_sizes[0] = 0x08000000; ram_bases[1] = 0x00000000; ram_sizes[1] = 0x00000000; ram_size = 128 * 1024 * 1024; #ifdef DEBUG_BOARD_INIT printf("%s: register cpu\n", __func__); #endif env = ppc405ep_init(ram_bases, ram_sizes, 33333333, &pic, kernel_filename == NULL ? 0 : 1); sram_size = 512 * 1024; sram_offset = qemu_ram_alloc(NULL, "ef405ep.sram", sram_size); #ifdef DEBUG_BOARD_INIT printf("%s: register SRAM at offset %08lx\n", __func__, sram_offset); #endif cpu_register_physical_memory(0xFFF00000, sram_size, sram_offset | IO_MEM_RAM); #ifdef DEBUG_BOARD_INIT printf("%s: register BIOS\n", __func__); #endif fl_idx = 0; #ifdef USE_FLASH_BIOS dinfo = drive_get(IF_PFLASH, 0, fl_idx); if (dinfo) { bios_size = bdrv_getlength(dinfo->bdrv); bios_offset = qemu_ram_alloc(NULL, "ef405ep.bios", bios_size); fl_sectors = (bios_size + 65535) >> 16; #ifdef DEBUG_BOARD_INIT printf("Register parallel flash %d size %lx" " at offset %08lx addr %lx '%s' %d\n", fl_idx, bios_size, bios_offset, -bios_size, bdrv_get_device_name(dinfo->bdrv), fl_sectors); #endif pflash_cfi02_register((uint32_t)(-bios_size), bios_offset, dinfo->bdrv, 65536, fl_sectors, 1, 2, 0x0001, 0x22DA, 0x0000, 0x0000, 0x555, 0x2AA, 1); fl_idx++; } else #endif { #ifdef DEBUG_BOARD_INIT printf("Load BIOS from file\n"); #endif bios_offset = qemu_ram_alloc(NULL, "ef405ep.bios", BIOS_SIZE); if (bios_name == NULL) bios_name = BIOS_FILENAME; filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); if (filename) { bios_size = load_image(filename, qemu_get_ram_ptr(bios_offset)); g_free(filename); } else { bios_size = -1; } if (bios_size < 0 || bios_size > BIOS_SIZE) { fprintf(stderr, "qemu: could not load PowerPC bios '%s'\n", bios_name); exit(1); } bios_size = (bios_size + 0xfff) & ~0xfff; cpu_register_physical_memory((uint32_t)(-bios_size), bios_size, bios_offset | IO_MEM_ROM); } #ifdef DEBUG_BOARD_INIT printf("%s: register FPGA\n", __func__); #endif ref405ep_fpga_init(0xF0300000); #ifdef DEBUG_BOARD_INIT printf("%s: register NVRAM\n", __func__); #endif m48t59_init(NULL, 0xF0000000, 0, 8192, 8); linux_boot = (kernel_filename != NULL); if (linux_boot) { #ifdef DEBUG_BOARD_INIT printf("%s: load kernel\n", __func__); #endif memset(&bd, 0, sizeof(bd)); bd.bi_memstart = 0x00000000; bd.bi_memsize = ram_size; bd.bi_flashstart = -bios_size; bd.bi_flashsize = -bios_size; bd.bi_flashoffset = 0; bd.bi_sramstart = 0xFFF00000; bd.bi_sramsize = sram_size; bd.bi_bootflags = 0; bd.bi_intfreq = 133333333; bd.bi_busfreq = 33333333; bd.bi_baudrate = 115200; bd.bi_s_version[0] = 'Q'; bd.bi_s_version[1] = 'M'; bd.bi_s_version[2] = 'U'; bd.bi_s_version[3] = '\0'; bd.bi_r_version[0] = 'Q'; bd.bi_r_version[1] = 'E'; bd.bi_r_version[2] = 'M'; bd.bi_r_version[3] = 'U'; bd.bi_r_version[4] = '\0'; bd.bi_procfreq = 133333333; bd.bi_plb_busfreq = 33333333; bd.bi_pci_busfreq = 33333333; bd.bi_opbfreq = 33333333; bdloc = ppc405_set_bootinfo(env, &bd, 0x00000001); env->gpr[3] = bdloc; kernel_base = KERNEL_LOAD_ADDR; kernel_size = load_image_targphys(kernel_filename, kernel_base, ram_size - kernel_base); if (kernel_size < 0) { fprintf(stderr, "qemu: could not load kernel '%s'\n", kernel_filename); exit(1); } printf("Load kernel size %ld at " TARGET_FMT_lx, kernel_size, kernel_base); if (initrd_filename) { initrd_base = INITRD_LOAD_ADDR; 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); } } else { initrd_base = 0; initrd_size = 0; } env->gpr[4] = initrd_base; env->gpr[5] = initrd_size; if (kernel_cmdline != NULL) { len = strlen(kernel_cmdline); bdloc -= ((len + 255) & ~255); cpu_physical_memory_write(bdloc, (void *)kernel_cmdline, len + 1); env->gpr[6] = bdloc; env->gpr[7] = bdloc + len; } else { env->gpr[6] = 0; env->gpr[7] = 0; } env->nip = KERNEL_LOAD_ADDR; } else { kernel_base = 0; kernel_size = 0; initrd_base = 0; initrd_size = 0; bdloc = 0; } #ifdef DEBUG_BOARD_INIT printf("%s: Done\n", __func__); #endif printf("bdloc %016lx\n", (unsigned long)bdloc); }
{ "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) { char *VAR_6; ppc4xx_bd_info_t bd; CPUPPCState *env; qemu_irq *pic; ram_addr_t sram_offset, bios_offset, bdloc; target_phys_addr_t ram_bases[2], ram_sizes[2]; target_ulong sram_size; long VAR_7; target_ulong kernel_base, initrd_base; long VAR_8, VAR_9; int VAR_10; int VAR_11, VAR_12, VAR_13; DriveInfo *dinfo; ram_bases[0] = qemu_ram_alloc(NULL, "ef405ep.ram", 0x08000000); ram_sizes[0] = 0x08000000; ram_bases[1] = 0x00000000; ram_sizes[1] = 0x00000000; VAR_0 = 128 * 1024 * 1024; #ifdef DEBUG_BOARD_INIT printf("%s: register cpu\n", __func__); #endif env = ppc405ep_init(ram_bases, ram_sizes, 33333333, &pic, VAR_2 == NULL ? 0 : 1); sram_size = 512 * 1024; sram_offset = qemu_ram_alloc(NULL, "ef405ep.sram", sram_size); #ifdef DEBUG_BOARD_INIT printf("%s: register SRAM at offset %08lx\n", __func__, sram_offset); #endif cpu_register_physical_memory(0xFFF00000, sram_size, sram_offset | IO_MEM_RAM); #ifdef DEBUG_BOARD_INIT printf("%s: register BIOS\n", __func__); #endif VAR_11 = 0; #ifdef USE_FLASH_BIOS dinfo = drive_get(IF_PFLASH, 0, VAR_11); if (dinfo) { VAR_7 = bdrv_getlength(dinfo->bdrv); bios_offset = qemu_ram_alloc(NULL, "ef405ep.bios", VAR_7); VAR_12 = (VAR_7 + 65535) >> 16; #ifdef DEBUG_BOARD_INIT printf("Register parallel flash %d size %lx" " at offset %08lx addr %lx '%s' %d\n", VAR_11, VAR_7, bios_offset, -VAR_7, bdrv_get_device_name(dinfo->bdrv), VAR_12); #endif pflash_cfi02_register((uint32_t)(-VAR_7), bios_offset, dinfo->bdrv, 65536, VAR_12, 1, 2, 0x0001, 0x22DA, 0x0000, 0x0000, 0x555, 0x2AA, 1); VAR_11++; } else #endif { #ifdef DEBUG_BOARD_INIT printf("Load BIOS from file\n"); #endif bios_offset = qemu_ram_alloc(NULL, "ef405ep.bios", BIOS_SIZE); if (bios_name == NULL) bios_name = BIOS_FILENAME; VAR_6 = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); if (VAR_6) { VAR_7 = load_image(VAR_6, qemu_get_ram_ptr(bios_offset)); g_free(VAR_6); } else { VAR_7 = -1; } if (VAR_7 < 0 || VAR_7 > BIOS_SIZE) { fprintf(stderr, "qemu: could not load PowerPC bios '%s'\n", bios_name); exit(1); } VAR_7 = (VAR_7 + 0xfff) & ~0xfff; cpu_register_physical_memory((uint32_t)(-VAR_7), VAR_7, bios_offset | IO_MEM_ROM); } #ifdef DEBUG_BOARD_INIT printf("%s: register FPGA\n", __func__); #endif ref405ep_fpga_init(0xF0300000); #ifdef DEBUG_BOARD_INIT printf("%s: register NVRAM\n", __func__); #endif m48t59_init(NULL, 0xF0000000, 0, 8192, 8); VAR_10 = (VAR_2 != NULL); if (VAR_10) { #ifdef DEBUG_BOARD_INIT printf("%s: load kernel\n", __func__); #endif memset(&bd, 0, sizeof(bd)); bd.bi_memstart = 0x00000000; bd.bi_memsize = VAR_0; bd.bi_flashstart = -VAR_7; bd.bi_flashsize = -VAR_7; bd.bi_flashoffset = 0; bd.bi_sramstart = 0xFFF00000; bd.bi_sramsize = sram_size; bd.bi_bootflags = 0; bd.bi_intfreq = 133333333; bd.bi_busfreq = 33333333; bd.bi_baudrate = 115200; bd.bi_s_version[0] = 'Q'; bd.bi_s_version[1] = 'M'; bd.bi_s_version[2] = 'U'; bd.bi_s_version[3] = '\0'; bd.bi_r_version[0] = 'Q'; bd.bi_r_version[1] = 'E'; bd.bi_r_version[2] = 'M'; bd.bi_r_version[3] = 'U'; bd.bi_r_version[4] = '\0'; bd.bi_procfreq = 133333333; bd.bi_plb_busfreq = 33333333; bd.bi_pci_busfreq = 33333333; bd.bi_opbfreq = 33333333; bdloc = ppc405_set_bootinfo(env, &bd, 0x00000001); env->gpr[3] = bdloc; kernel_base = KERNEL_LOAD_ADDR; VAR_8 = load_image_targphys(VAR_2, kernel_base, VAR_0 - kernel_base); if (VAR_8 < 0) { fprintf(stderr, "qemu: could not load kernel '%s'\n", VAR_2); exit(1); } printf("Load kernel size %ld at " TARGET_FMT_lx, VAR_8, kernel_base); if (VAR_4) { initrd_base = INITRD_LOAD_ADDR; VAR_9 = load_image_targphys(VAR_4, initrd_base, VAR_0 - initrd_base); if (VAR_9 < 0) { fprintf(stderr, "qemu: could not load initial ram disk '%s'\n", VAR_4); exit(1); } } else { initrd_base = 0; VAR_9 = 0; } env->gpr[4] = initrd_base; env->gpr[5] = VAR_9; if (VAR_3 != NULL) { VAR_13 = strlen(VAR_3); bdloc -= ((VAR_13 + 255) & ~255); cpu_physical_memory_write(bdloc, (void *)VAR_3, VAR_13 + 1); env->gpr[6] = bdloc; env->gpr[7] = bdloc + VAR_13; } else { env->gpr[6] = 0; env->gpr[7] = 0; } env->nip = KERNEL_LOAD_ADDR; } else { kernel_base = 0; VAR_8 = 0; initrd_base = 0; VAR_9 = 0; bdloc = 0; } #ifdef DEBUG_BOARD_INIT printf("%s: Done\n", __func__); #endif printf("bdloc %016lx\n", (unsigned long)bdloc); }
[ "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{", "char *VAR_6;", "ppc4xx_bd_info_t bd;", "CPUPPCState *env;", "qemu_irq *pic;", "ram_addr_t sram_offset, bios_offset, bdloc;", "target_phys_addr_t ram_bases[2], ram_sizes[2];", "target_ulong sram_size;", "long VAR_7;", "target_ulong kernel_base, initrd_base;", "long VAR_8, VAR_9;", "int VAR_10;", "int VAR_11, VAR_12, VAR_13;", "DriveInfo *dinfo;", "ram_bases[0] = qemu_ram_alloc(NULL, \"ef405ep.ram\", 0x08000000);", "ram_sizes[0] = 0x08000000;", "ram_bases[1] = 0x00000000;", "ram_sizes[1] = 0x00000000;", "VAR_0 = 128 * 1024 * 1024;", "#ifdef DEBUG_BOARD_INIT\nprintf(\"%s: register cpu\\n\", __func__);", "#endif\nenv = ppc405ep_init(ram_bases, ram_sizes, 33333333, &pic,\nVAR_2 == NULL ? 0 : 1);", "sram_size = 512 * 1024;", "sram_offset = qemu_ram_alloc(NULL, \"ef405ep.sram\", sram_size);", "#ifdef DEBUG_BOARD_INIT\nprintf(\"%s: register SRAM at offset %08lx\\n\", __func__, sram_offset);", "#endif\ncpu_register_physical_memory(0xFFF00000, sram_size,\nsram_offset | IO_MEM_RAM);", "#ifdef DEBUG_BOARD_INIT\nprintf(\"%s: register BIOS\\n\", __func__);", "#endif\nVAR_11 = 0;", "#ifdef USE_FLASH_BIOS\ndinfo = drive_get(IF_PFLASH, 0, VAR_11);", "if (dinfo) {", "VAR_7 = bdrv_getlength(dinfo->bdrv);", "bios_offset = qemu_ram_alloc(NULL, \"ef405ep.bios\", VAR_7);", "VAR_12 = (VAR_7 + 65535) >> 16;", "#ifdef DEBUG_BOARD_INIT\nprintf(\"Register parallel flash %d size %lx\"\n\" at offset %08lx addr %lx '%s' %d\\n\",\nVAR_11, VAR_7, bios_offset, -VAR_7,\nbdrv_get_device_name(dinfo->bdrv), VAR_12);", "#endif\npflash_cfi02_register((uint32_t)(-VAR_7), bios_offset,\ndinfo->bdrv, 65536, VAR_12, 1,\n2, 0x0001, 0x22DA, 0x0000, 0x0000, 0x555, 0x2AA,\n1);", "VAR_11++;", "} else", "#endif\n{", "#ifdef DEBUG_BOARD_INIT\nprintf(\"Load BIOS from file\\n\");", "#endif\nbios_offset = qemu_ram_alloc(NULL, \"ef405ep.bios\", BIOS_SIZE);", "if (bios_name == NULL)\nbios_name = BIOS_FILENAME;", "VAR_6 = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);", "if (VAR_6) {", "VAR_7 = load_image(VAR_6, qemu_get_ram_ptr(bios_offset));", "g_free(VAR_6);", "} else {", "VAR_7 = -1;", "}", "if (VAR_7 < 0 || VAR_7 > BIOS_SIZE) {", "fprintf(stderr, \"qemu: could not load PowerPC bios '%s'\\n\",\nbios_name);", "exit(1);", "}", "VAR_7 = (VAR_7 + 0xfff) & ~0xfff;", "cpu_register_physical_memory((uint32_t)(-VAR_7),\nVAR_7, bios_offset | IO_MEM_ROM);", "}", "#ifdef DEBUG_BOARD_INIT\nprintf(\"%s: register FPGA\\n\", __func__);", "#endif\nref405ep_fpga_init(0xF0300000);", "#ifdef DEBUG_BOARD_INIT\nprintf(\"%s: register NVRAM\\n\", __func__);", "#endif\nm48t59_init(NULL, 0xF0000000, 0, 8192, 8);", "VAR_10 = (VAR_2 != NULL);", "if (VAR_10) {", "#ifdef DEBUG_BOARD_INIT\nprintf(\"%s: load kernel\\n\", __func__);", "#endif\nmemset(&bd, 0, sizeof(bd));", "bd.bi_memstart = 0x00000000;", "bd.bi_memsize = VAR_0;", "bd.bi_flashstart = -VAR_7;", "bd.bi_flashsize = -VAR_7;", "bd.bi_flashoffset = 0;", "bd.bi_sramstart = 0xFFF00000;", "bd.bi_sramsize = sram_size;", "bd.bi_bootflags = 0;", "bd.bi_intfreq = 133333333;", "bd.bi_busfreq = 33333333;", "bd.bi_baudrate = 115200;", "bd.bi_s_version[0] = 'Q';", "bd.bi_s_version[1] = 'M';", "bd.bi_s_version[2] = 'U';", "bd.bi_s_version[3] = '\\0';", "bd.bi_r_version[0] = 'Q';", "bd.bi_r_version[1] = 'E';", "bd.bi_r_version[2] = 'M';", "bd.bi_r_version[3] = 'U';", "bd.bi_r_version[4] = '\\0';", "bd.bi_procfreq = 133333333;", "bd.bi_plb_busfreq = 33333333;", "bd.bi_pci_busfreq = 33333333;", "bd.bi_opbfreq = 33333333;", "bdloc = ppc405_set_bootinfo(env, &bd, 0x00000001);", "env->gpr[3] = bdloc;", "kernel_base = KERNEL_LOAD_ADDR;", "VAR_8 = load_image_targphys(VAR_2, kernel_base,\nVAR_0 - kernel_base);", "if (VAR_8 < 0) {", "fprintf(stderr, \"qemu: could not load kernel '%s'\\n\",\nVAR_2);", "exit(1);", "}", "printf(\"Load kernel size %ld at \" TARGET_FMT_lx,\nVAR_8, kernel_base);", "if (VAR_4) {", "initrd_base = INITRD_LOAD_ADDR;", "VAR_9 = load_image_targphys(VAR_4, initrd_base,\nVAR_0 - initrd_base);", "if (VAR_9 < 0) {", "fprintf(stderr, \"qemu: could not load initial ram disk '%s'\\n\",\nVAR_4);", "exit(1);", "}", "} else {", "initrd_base = 0;", "VAR_9 = 0;", "}", "env->gpr[4] = initrd_base;", "env->gpr[5] = VAR_9;", "if (VAR_3 != NULL) {", "VAR_13 = strlen(VAR_3);", "bdloc -= ((VAR_13 + 255) & ~255);", "cpu_physical_memory_write(bdloc, (void *)VAR_3, VAR_13 + 1);", "env->gpr[6] = bdloc;", "env->gpr[7] = bdloc + VAR_13;", "} else {", "env->gpr[6] = 0;", "env->gpr[7] = 0;", "}", "env->nip = KERNEL_LOAD_ADDR;", "} else {", "kernel_base = 0;", "VAR_8 = 0;", "initrd_base = 0;", "VAR_9 = 0;", "bdloc = 0;", "}", "#ifdef DEBUG_BOARD_INIT\nprintf(\"%s: Done\\n\", __func__);", "#endif\nprintf(\"bdloc %016lx\\n\", (unsigned long)bdloc);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59, 61 ], [ 63, 65, 67 ], [ 71 ], [ 73 ], [ 75, 77 ], [ 79, 81, 83 ], [ 87, 89 ], [ 91, 93 ], [ 95, 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107, 109, 111, 113, 115 ], [ 117, 119, 121, 123, 125 ], [ 127 ], [ 129 ], [ 131, 133 ], [ 135, 137 ], [ 139, 141 ], [ 143, 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163, 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173, 175 ], [ 177 ], [ 181, 183 ], [ 185, 187 ], [ 191, 193 ], [ 195, 197 ], [ 201 ], [ 203 ], [ 205, 207 ], [ 209, 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 269, 271 ], [ 273 ], [ 275, 277 ], [ 279 ], [ 281 ], [ 283, 285 ], [ 289 ], [ 291 ], [ 293, 295 ], [ 297 ], [ 299, 301 ], [ 303 ], [ 305 ], [ 307 ], [ 309 ], [ 311 ], [ 313 ], [ 315 ], [ 317 ], [ 319 ], [ 321 ], [ 323 ], [ 325 ], [ 327 ], [ 329 ], [ 331 ], [ 333 ], [ 335 ], [ 337 ], [ 339 ], [ 341 ], [ 343 ], [ 345 ], [ 347 ], [ 349 ], [ 351 ], [ 353 ], [ 355, 357 ], [ 359, 361 ], [ 363 ] ]
24,151
void ppc_store_sdr1 (CPUPPCState *env, target_ulong value) { LOG_MMU("%s: " TARGET_FMT_lx "\n", __func__, value); if (env->sdr1 != value) { /* XXX: for PowerPC 64, should check that the HTABSIZE value * is <= 28 */ env->sdr1 = value; tlb_flush(env, 1); } }
false
qemu
bb593904c18e22ea0671dfa1b02e24982f2bf0ea
void ppc_store_sdr1 (CPUPPCState *env, target_ulong value) { LOG_MMU("%s: " TARGET_FMT_lx "\n", __func__, value); if (env->sdr1 != value) { env->sdr1 = value; tlb_flush(env, 1); } }
{ "code": [], "line_no": [] }
void FUNC_0 (CPUPPCState *VAR_0, target_ulong VAR_1) { LOG_MMU("%s: " TARGET_FMT_lx "\n", __func__, VAR_1); if (VAR_0->sdr1 != VAR_1) { VAR_0->sdr1 = VAR_1; tlb_flush(VAR_0, 1); } }
[ "void FUNC_0 (CPUPPCState *VAR_0, target_ulong VAR_1)\n{", "LOG_MMU(\"%s: \" TARGET_FMT_lx \"\\n\", __func__, VAR_1);", "if (VAR_0->sdr1 != VAR_1) {", "VAR_0->sdr1 = VAR_1;", "tlb_flush(VAR_0, 1);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
24,152
static void memory_region_finalize(Object *obj) { MemoryRegion *mr = MEMORY_REGION(obj); assert(QTAILQ_EMPTY(&mr->subregions)); assert(memory_region_transaction_depth == 0); mr->destructor(mr); memory_region_clear_coalescing(mr); g_free((char *)mr->name); g_free(mr->ioeventfds); }
false
qemu
b476c99d01519277e3494a10dc0329d07157ae02
static void memory_region_finalize(Object *obj) { MemoryRegion *mr = MEMORY_REGION(obj); assert(QTAILQ_EMPTY(&mr->subregions)); assert(memory_region_transaction_depth == 0); mr->destructor(mr); memory_region_clear_coalescing(mr); g_free((char *)mr->name); g_free(mr->ioeventfds); }
{ "code": [], "line_no": [] }
static void FUNC_0(Object *VAR_0) { MemoryRegion *mr = MEMORY_REGION(VAR_0); assert(QTAILQ_EMPTY(&mr->subregions)); assert(memory_region_transaction_depth == 0); mr->destructor(mr); memory_region_clear_coalescing(mr); g_free((char *)mr->name); g_free(mr->ioeventfds); }
[ "static void FUNC_0(Object *VAR_0)\n{", "MemoryRegion *mr = MEMORY_REGION(VAR_0);", "assert(QTAILQ_EMPTY(&mr->subregions));", "assert(memory_region_transaction_depth == 0);", "mr->destructor(mr);", "memory_region_clear_coalescing(mr);", "g_free((char *)mr->name);", "g_free(mr->ioeventfds);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
24,153
static void tgen64_ori(TCGContext *s, TCGReg dest, tcg_target_ulong val) { static const S390Opcode oi_insns[4] = { RI_OILL, RI_OILH, RI_OIHL, RI_OIHH }; static const S390Opcode nif_insns[2] = { RIL_OILF, RIL_OIHF }; int i; /* Look for no-op. */ if (val == 0) { return; } if (facilities & FACILITY_EXT_IMM) { /* Try all 32-bit insns that can perform it in one go. */ for (i = 0; i < 4; i++) { tcg_target_ulong mask = (0xffffull << i*16); if ((val & mask) != 0 && (val & ~mask) == 0) { tcg_out_insn_RI(s, oi_insns[i], dest, val >> i*16); return; } } /* Try all 48-bit insns that can perform it in one go. */ for (i = 0; i < 2; i++) { tcg_target_ulong mask = (0xffffffffull << i*32); if ((val & mask) != 0 && (val & ~mask) == 0) { tcg_out_insn_RIL(s, nif_insns[i], dest, val >> i*32); return; } } /* Perform the OR via sequential modifications to the high and low parts. Do this via recursion to handle 16-bit vs 32-bit masks in each half. */ tgen64_ori(s, dest, val & 0x00000000ffffffffull); tgen64_ori(s, dest, val & 0xffffffff00000000ull); } else { /* With no extended-immediate facility, we don't need to be so clever. Just iterate over the insns and mask in the constant. */ for (i = 0; i < 4; i++) { tcg_target_ulong mask = (0xffffull << i*16); if ((val & mask) != 0) { tcg_out_insn_RI(s, oi_insns[i], dest, val >> i*16); } } } }
false
qemu
b2c98d9d392c87c9b9e975d30f79924719d9cbbe
static void tgen64_ori(TCGContext *s, TCGReg dest, tcg_target_ulong val) { static const S390Opcode oi_insns[4] = { RI_OILL, RI_OILH, RI_OIHL, RI_OIHH }; static const S390Opcode nif_insns[2] = { RIL_OILF, RIL_OIHF }; int i; if (val == 0) { return; } if (facilities & FACILITY_EXT_IMM) { for (i = 0; i < 4; i++) { tcg_target_ulong mask = (0xffffull << i*16); if ((val & mask) != 0 && (val & ~mask) == 0) { tcg_out_insn_RI(s, oi_insns[i], dest, val >> i*16); return; } } for (i = 0; i < 2; i++) { tcg_target_ulong mask = (0xffffffffull << i*32); if ((val & mask) != 0 && (val & ~mask) == 0) { tcg_out_insn_RIL(s, nif_insns[i], dest, val >> i*32); return; } } tgen64_ori(s, dest, val & 0x00000000ffffffffull); tgen64_ori(s, dest, val & 0xffffffff00000000ull); } else { for (i = 0; i < 4; i++) { tcg_target_ulong mask = (0xffffull << i*16); if ((val & mask) != 0) { tcg_out_insn_RI(s, oi_insns[i], dest, val >> i*16); } } } }
{ "code": [], "line_no": [] }
static void FUNC_0(TCGContext *VAR_0, TCGReg VAR_1, tcg_target_ulong VAR_2) { static const S390Opcode VAR_3[4] = { RI_OILL, RI_OILH, RI_OIHL, RI_OIHH }; static const S390Opcode VAR_4[2] = { RIL_OILF, RIL_OIHF }; int VAR_5; if (VAR_2 == 0) { return; } if (facilities & FACILITY_EXT_IMM) { for (VAR_5 = 0; VAR_5 < 4; VAR_5++) { tcg_target_ulong mask = (0xffffull << VAR_5*16); if ((VAR_2 & mask) != 0 && (VAR_2 & ~mask) == 0) { tcg_out_insn_RI(VAR_0, VAR_3[VAR_5], VAR_1, VAR_2 >> VAR_5*16); return; } } for (VAR_5 = 0; VAR_5 < 2; VAR_5++) { tcg_target_ulong mask = (0xffffffffull << VAR_5*32); if ((VAR_2 & mask) != 0 && (VAR_2 & ~mask) == 0) { tcg_out_insn_RIL(VAR_0, VAR_4[VAR_5], VAR_1, VAR_2 >> VAR_5*32); return; } } FUNC_0(VAR_0, VAR_1, VAR_2 & 0x00000000ffffffffull); FUNC_0(VAR_0, VAR_1, VAR_2 & 0xffffffff00000000ull); } else { for (VAR_5 = 0; VAR_5 < 4; VAR_5++) { tcg_target_ulong mask = (0xffffull << VAR_5*16); if ((VAR_2 & mask) != 0) { tcg_out_insn_RI(VAR_0, VAR_3[VAR_5], VAR_1, VAR_2 >> VAR_5*16); } } } }
[ "static void FUNC_0(TCGContext *VAR_0, TCGReg VAR_1, tcg_target_ulong VAR_2)\n{", "static const S390Opcode VAR_3[4] = {", "RI_OILL, RI_OILH, RI_OIHL, RI_OIHH\n};", "static const S390Opcode VAR_4[2] = {", "RIL_OILF, RIL_OIHF\n};", "int VAR_5;", "if (VAR_2 == 0) {", "return;", "}", "if (facilities & FACILITY_EXT_IMM) {", "for (VAR_5 = 0; VAR_5 < 4; VAR_5++) {", "tcg_target_ulong mask = (0xffffull << VAR_5*16);", "if ((VAR_2 & mask) != 0 && (VAR_2 & ~mask) == 0) {", "tcg_out_insn_RI(VAR_0, VAR_3[VAR_5], VAR_1, VAR_2 >> VAR_5*16);", "return;", "}", "}", "for (VAR_5 = 0; VAR_5 < 2; VAR_5++) {", "tcg_target_ulong mask = (0xffffffffull << VAR_5*32);", "if ((VAR_2 & mask) != 0 && (VAR_2 & ~mask) == 0) {", "tcg_out_insn_RIL(VAR_0, VAR_4[VAR_5], VAR_1, VAR_2 >> VAR_5*32);", "return;", "}", "}", "FUNC_0(VAR_0, VAR_1, VAR_2 & 0x00000000ffffffffull);", "FUNC_0(VAR_0, VAR_1, VAR_2 & 0xffffffff00000000ull);", "} else {", "for (VAR_5 = 0; VAR_5 < 4; VAR_5++) {", "tcg_target_ulong mask = (0xffffull << VAR_5*16);", "if ((VAR_2 & mask) != 0) {", "tcg_out_insn_RI(VAR_0, VAR_3[VAR_5], VAR_1, VAR_2 >> VAR_5*16);", "}", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 77 ], [ 79 ], [ 81 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ] ]
24,154
int xen_be_init(void) { xenstore = xs_daemon_open(); if (!xenstore) { xen_be_printf(NULL, 0, "can't connect to xenstored\n"); return -1; } if (qemu_set_fd_handler(xs_fileno(xenstore), xenstore_update, NULL, NULL) < 0) { goto err; } xen_xc = xc_interface_open(); if (xen_xc == -1) { xen_be_printf(NULL, 0, "can't open xen interface\n"); goto err; } return 0; err: qemu_set_fd_handler(xs_fileno(xenstore), NULL, NULL, NULL); xs_daemon_close(xenstore); xenstore = NULL; return -1; }
false
qemu
d5b93ddfefe63d5869a8eb97ea3474867d3b105b
int xen_be_init(void) { xenstore = xs_daemon_open(); if (!xenstore) { xen_be_printf(NULL, 0, "can't connect to xenstored\n"); return -1; } if (qemu_set_fd_handler(xs_fileno(xenstore), xenstore_update, NULL, NULL) < 0) { goto err; } xen_xc = xc_interface_open(); if (xen_xc == -1) { xen_be_printf(NULL, 0, "can't open xen interface\n"); goto err; } return 0; err: qemu_set_fd_handler(xs_fileno(xenstore), NULL, NULL, NULL); xs_daemon_close(xenstore); xenstore = NULL; return -1; }
{ "code": [], "line_no": [] }
int FUNC_0(void) { xenstore = xs_daemon_open(); if (!xenstore) { xen_be_printf(NULL, 0, "can't connect to xenstored\n"); return -1; } if (qemu_set_fd_handler(xs_fileno(xenstore), xenstore_update, NULL, NULL) < 0) { goto err; } xen_xc = xc_interface_open(); if (xen_xc == -1) { xen_be_printf(NULL, 0, "can't open xen interface\n"); goto err; } return 0; err: qemu_set_fd_handler(xs_fileno(xenstore), NULL, NULL, NULL); xs_daemon_close(xenstore); xenstore = NULL; return -1; }
[ "int FUNC_0(void)\n{", "xenstore = xs_daemon_open();", "if (!xenstore) {", "xen_be_printf(NULL, 0, \"can't connect to xenstored\\n\");", "return -1;", "}", "if (qemu_set_fd_handler(xs_fileno(xenstore), xenstore_update, NULL, NULL) < 0) {", "goto err;", "}", "xen_xc = xc_interface_open();", "if (xen_xc == -1) {", "xen_be_printf(NULL, 0, \"can't open xen interface\\n\");", "goto err;", "}", "return 0;", "err:\nqemu_set_fd_handler(xs_fileno(xenstore), NULL, NULL, NULL);", "xs_daemon_close(xenstore);", "xenstore = NULL;", "return -1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ] ]
24,157
static void virtio_input_handle_event(DeviceState *dev, QemuConsole *src, InputEvent *evt) { VirtIOInput *vinput = VIRTIO_INPUT(dev); virtio_input_event event; int qcode; switch (evt->kind) { case INPUT_EVENT_KIND_KEY: qcode = qemu_input_key_value_to_qcode(evt->key->key); if (qcode && keymap_qcode[qcode]) { event.type = cpu_to_le16(EV_KEY); event.code = cpu_to_le16(keymap_qcode[qcode]); event.value = cpu_to_le32(evt->key->down ? 1 : 0); virtio_input_send(vinput, &event); } else { if (evt->key->down) { fprintf(stderr, "%s: unmapped key: %d [%s]\n", __func__, qcode, QKeyCode_lookup[qcode]); } } break; case INPUT_EVENT_KIND_BTN: if (keymap_button[evt->btn->button]) { event.type = cpu_to_le16(EV_KEY); event.code = cpu_to_le16(keymap_button[evt->btn->button]); event.value = cpu_to_le32(evt->btn->down ? 1 : 0); virtio_input_send(vinput, &event); } else { if (evt->btn->down) { fprintf(stderr, "%s: unmapped button: %d [%s]\n", __func__, evt->btn->button, InputButton_lookup[evt->btn->button]); } } break; case INPUT_EVENT_KIND_REL: event.type = cpu_to_le16(EV_REL); event.code = cpu_to_le16(axismap_rel[evt->rel->axis]); event.value = cpu_to_le32(evt->rel->value); virtio_input_send(vinput, &event); break; case INPUT_EVENT_KIND_ABS: event.type = cpu_to_le16(EV_ABS); event.code = cpu_to_le16(axismap_abs[evt->abs->axis]); event.value = cpu_to_le32(evt->abs->value); virtio_input_send(vinput, &event); break; default: /* keep gcc happy */ break; } }
false
qemu
568c73a4783cd981e9aa6de4f15dcda7829643ad
static void virtio_input_handle_event(DeviceState *dev, QemuConsole *src, InputEvent *evt) { VirtIOInput *vinput = VIRTIO_INPUT(dev); virtio_input_event event; int qcode; switch (evt->kind) { case INPUT_EVENT_KIND_KEY: qcode = qemu_input_key_value_to_qcode(evt->key->key); if (qcode && keymap_qcode[qcode]) { event.type = cpu_to_le16(EV_KEY); event.code = cpu_to_le16(keymap_qcode[qcode]); event.value = cpu_to_le32(evt->key->down ? 1 : 0); virtio_input_send(vinput, &event); } else { if (evt->key->down) { fprintf(stderr, "%s: unmapped key: %d [%s]\n", __func__, qcode, QKeyCode_lookup[qcode]); } } break; case INPUT_EVENT_KIND_BTN: if (keymap_button[evt->btn->button]) { event.type = cpu_to_le16(EV_KEY); event.code = cpu_to_le16(keymap_button[evt->btn->button]); event.value = cpu_to_le32(evt->btn->down ? 1 : 0); virtio_input_send(vinput, &event); } else { if (evt->btn->down) { fprintf(stderr, "%s: unmapped button: %d [%s]\n", __func__, evt->btn->button, InputButton_lookup[evt->btn->button]); } } break; case INPUT_EVENT_KIND_REL: event.type = cpu_to_le16(EV_REL); event.code = cpu_to_le16(axismap_rel[evt->rel->axis]); event.value = cpu_to_le32(evt->rel->value); virtio_input_send(vinput, &event); break; case INPUT_EVENT_KIND_ABS: event.type = cpu_to_le16(EV_ABS); event.code = cpu_to_le16(axismap_abs[evt->abs->axis]); event.value = cpu_to_le32(evt->abs->value); virtio_input_send(vinput, &event); break; default: break; } }
{ "code": [], "line_no": [] }
static void FUNC_0(DeviceState *VAR_0, QemuConsole *VAR_1, InputEvent *VAR_2) { VirtIOInput *vinput = VIRTIO_INPUT(VAR_0); virtio_input_event event; int VAR_3; switch (VAR_2->kind) { case INPUT_EVENT_KIND_KEY: VAR_3 = qemu_input_key_value_to_qcode(VAR_2->key->key); if (VAR_3 && keymap_qcode[VAR_3]) { event.type = cpu_to_le16(EV_KEY); event.code = cpu_to_le16(keymap_qcode[VAR_3]); event.value = cpu_to_le32(VAR_2->key->down ? 1 : 0); virtio_input_send(vinput, &event); } else { if (VAR_2->key->down) { fprintf(stderr, "%s: unmapped key: %d [%s]\n", __func__, VAR_3, QKeyCode_lookup[VAR_3]); } } break; case INPUT_EVENT_KIND_BTN: if (keymap_button[VAR_2->btn->button]) { event.type = cpu_to_le16(EV_KEY); event.code = cpu_to_le16(keymap_button[VAR_2->btn->button]); event.value = cpu_to_le32(VAR_2->btn->down ? 1 : 0); virtio_input_send(vinput, &event); } else { if (VAR_2->btn->down) { fprintf(stderr, "%s: unmapped button: %d [%s]\n", __func__, VAR_2->btn->button, InputButton_lookup[VAR_2->btn->button]); } } break; case INPUT_EVENT_KIND_REL: event.type = cpu_to_le16(EV_REL); event.code = cpu_to_le16(axismap_rel[VAR_2->rel->axis]); event.value = cpu_to_le32(VAR_2->rel->value); virtio_input_send(vinput, &event); break; case INPUT_EVENT_KIND_ABS: event.type = cpu_to_le16(EV_ABS); event.code = cpu_to_le16(axismap_abs[VAR_2->abs->axis]); event.value = cpu_to_le32(VAR_2->abs->value); virtio_input_send(vinput, &event); break; default: break; } }
[ "static void FUNC_0(DeviceState *VAR_0, QemuConsole *VAR_1,\nInputEvent *VAR_2)\n{", "VirtIOInput *vinput = VIRTIO_INPUT(VAR_0);", "virtio_input_event event;", "int VAR_3;", "switch (VAR_2->kind) {", "case INPUT_EVENT_KIND_KEY:\nVAR_3 = qemu_input_key_value_to_qcode(VAR_2->key->key);", "if (VAR_3 && keymap_qcode[VAR_3]) {", "event.type = cpu_to_le16(EV_KEY);", "event.code = cpu_to_le16(keymap_qcode[VAR_3]);", "event.value = cpu_to_le32(VAR_2->key->down ? 1 : 0);", "virtio_input_send(vinput, &event);", "} else {", "if (VAR_2->key->down) {", "fprintf(stderr, \"%s: unmapped key: %d [%s]\\n\", __func__,\nVAR_3, QKeyCode_lookup[VAR_3]);", "}", "}", "break;", "case INPUT_EVENT_KIND_BTN:\nif (keymap_button[VAR_2->btn->button]) {", "event.type = cpu_to_le16(EV_KEY);", "event.code = cpu_to_le16(keymap_button[VAR_2->btn->button]);", "event.value = cpu_to_le32(VAR_2->btn->down ? 1 : 0);", "virtio_input_send(vinput, &event);", "} else {", "if (VAR_2->btn->down) {", "fprintf(stderr, \"%s: unmapped button: %d [%s]\\n\", __func__,\nVAR_2->btn->button, InputButton_lookup[VAR_2->btn->button]);", "}", "}", "break;", "case INPUT_EVENT_KIND_REL:\nevent.type = cpu_to_le16(EV_REL);", "event.code = cpu_to_le16(axismap_rel[VAR_2->rel->axis]);", "event.value = cpu_to_le32(VAR_2->rel->value);", "virtio_input_send(vinput, &event);", "break;", "case INPUT_EVENT_KIND_ABS:\nevent.type = cpu_to_le16(EV_ABS);", "event.code = cpu_to_le16(axismap_abs[VAR_2->abs->axis]);", "event.value = cpu_to_le32(VAR_2->abs->value);", "virtio_input_send(vinput, &event);", "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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17, 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35, 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45, 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61, 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71, 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83, 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95, 99 ], [ 101 ], [ 103 ] ]
24,158
static int uhci_handle_td(UHCIState *s, uint32_t addr, UHCI_TD *td, uint32_t *int_mask, bool queuing) { UHCIAsync *async; int len = 0, max_len; uint8_t pid; USBDevice *dev; USBEndpoint *ep; /* Is active ? */ if (!(td->ctrl & TD_CTRL_ACTIVE)) return TD_RESULT_NEXT_QH; async = uhci_async_find_td(s, addr, td); if (async) { /* Already submitted */ async->queue->valid = 32; if (!async->done) return TD_RESULT_ASYNC_CONT; if (queuing) { /* we are busy filling the queue, we are not prepared to consume completed packages then, just leave them in async state */ return TD_RESULT_ASYNC_CONT; } uhci_async_unlink(async); goto done; } /* Allocate new packet */ async = uhci_async_alloc(uhci_queue_get(s, td), addr); /* valid needs to be large enough to handle 10 frame delay * for initial isochronous requests */ async->queue->valid = 32; async->isoc = td->ctrl & TD_CTRL_IOS; max_len = ((td->token >> 21) + 1) & 0x7ff; pid = td->token & 0xff; dev = uhci_find_device(s, (td->token >> 8) & 0x7f); ep = usb_ep_get(dev, pid, (td->token >> 15) & 0xf); usb_packet_setup(&async->packet, pid, ep, addr); qemu_sglist_add(&async->sgl, td->buffer, max_len); usb_packet_map(&async->packet, &async->sgl); switch(pid) { case USB_TOKEN_OUT: case USB_TOKEN_SETUP: len = usb_handle_packet(dev, &async->packet); if (len >= 0) len = max_len; break; case USB_TOKEN_IN: len = usb_handle_packet(dev, &async->packet); break; default: /* invalid pid : frame interrupted */ uhci_async_free(async); s->status |= UHCI_STS_HCPERR; uhci_update_irq(s); return TD_RESULT_STOP_FRAME; } if (len == USB_RET_ASYNC) { uhci_async_link(async); return TD_RESULT_ASYNC_START; } async->packet.result = len; done: len = uhci_complete_td(s, td, async, int_mask); usb_packet_unmap(&async->packet, &async->sgl); uhci_async_free(async); return len; }
false
qemu
883bca776daa43111e9c39008f0038f7c62ae723
static int uhci_handle_td(UHCIState *s, uint32_t addr, UHCI_TD *td, uint32_t *int_mask, bool queuing) { UHCIAsync *async; int len = 0, max_len; uint8_t pid; USBDevice *dev; USBEndpoint *ep; if (!(td->ctrl & TD_CTRL_ACTIVE)) return TD_RESULT_NEXT_QH; async = uhci_async_find_td(s, addr, td); if (async) { async->queue->valid = 32; if (!async->done) return TD_RESULT_ASYNC_CONT; if (queuing) { return TD_RESULT_ASYNC_CONT; } uhci_async_unlink(async); goto done; } async = uhci_async_alloc(uhci_queue_get(s, td), addr); async->queue->valid = 32; async->isoc = td->ctrl & TD_CTRL_IOS; max_len = ((td->token >> 21) + 1) & 0x7ff; pid = td->token & 0xff; dev = uhci_find_device(s, (td->token >> 8) & 0x7f); ep = usb_ep_get(dev, pid, (td->token >> 15) & 0xf); usb_packet_setup(&async->packet, pid, ep, addr); qemu_sglist_add(&async->sgl, td->buffer, max_len); usb_packet_map(&async->packet, &async->sgl); switch(pid) { case USB_TOKEN_OUT: case USB_TOKEN_SETUP: len = usb_handle_packet(dev, &async->packet); if (len >= 0) len = max_len; break; case USB_TOKEN_IN: len = usb_handle_packet(dev, &async->packet); break; default: uhci_async_free(async); s->status |= UHCI_STS_HCPERR; uhci_update_irq(s); return TD_RESULT_STOP_FRAME; } if (len == USB_RET_ASYNC) { uhci_async_link(async); return TD_RESULT_ASYNC_START; } async->packet.result = len; done: len = uhci_complete_td(s, td, async, int_mask); usb_packet_unmap(&async->packet, &async->sgl); uhci_async_free(async); return len; }
{ "code": [], "line_no": [] }
static int FUNC_0(UHCIState *VAR_0, uint32_t VAR_1, UHCI_TD *VAR_2, uint32_t *VAR_3, bool VAR_4) { UHCIAsync *async; int VAR_5 = 0, VAR_6; uint8_t pid; USBDevice *dev; USBEndpoint *ep; if (!(VAR_2->ctrl & TD_CTRL_ACTIVE)) return TD_RESULT_NEXT_QH; async = uhci_async_find_td(VAR_0, VAR_1, VAR_2); if (async) { async->queue->valid = 32; if (!async->done) return TD_RESULT_ASYNC_CONT; if (VAR_4) { return TD_RESULT_ASYNC_CONT; } uhci_async_unlink(async); goto done; } async = uhci_async_alloc(uhci_queue_get(VAR_0, VAR_2), VAR_1); async->queue->valid = 32; async->isoc = VAR_2->ctrl & TD_CTRL_IOS; VAR_6 = ((VAR_2->token >> 21) + 1) & 0x7ff; pid = VAR_2->token & 0xff; dev = uhci_find_device(VAR_0, (VAR_2->token >> 8) & 0x7f); ep = usb_ep_get(dev, pid, (VAR_2->token >> 15) & 0xf); usb_packet_setup(&async->packet, pid, ep, VAR_1); qemu_sglist_add(&async->sgl, VAR_2->buffer, VAR_6); usb_packet_map(&async->packet, &async->sgl); switch(pid) { case USB_TOKEN_OUT: case USB_TOKEN_SETUP: VAR_5 = usb_handle_packet(dev, &async->packet); if (VAR_5 >= 0) VAR_5 = VAR_6; break; case USB_TOKEN_IN: VAR_5 = usb_handle_packet(dev, &async->packet); break; default: uhci_async_free(async); VAR_0->status |= UHCI_STS_HCPERR; uhci_update_irq(VAR_0); return TD_RESULT_STOP_FRAME; } if (VAR_5 == USB_RET_ASYNC) { uhci_async_link(async); return TD_RESULT_ASYNC_START; } async->packet.result = VAR_5; done: VAR_5 = uhci_complete_td(VAR_0, VAR_2, async, VAR_3); usb_packet_unmap(&async->packet, &async->sgl); uhci_async_free(async); return VAR_5; }
[ "static int FUNC_0(UHCIState *VAR_0, uint32_t VAR_1, UHCI_TD *VAR_2,\nuint32_t *VAR_3, bool VAR_4)\n{", "UHCIAsync *async;", "int VAR_5 = 0, VAR_6;", "uint8_t pid;", "USBDevice *dev;", "USBEndpoint *ep;", "if (!(VAR_2->ctrl & TD_CTRL_ACTIVE))\nreturn TD_RESULT_NEXT_QH;", "async = uhci_async_find_td(VAR_0, VAR_1, VAR_2);", "if (async) {", "async->queue->valid = 32;", "if (!async->done)\nreturn TD_RESULT_ASYNC_CONT;", "if (VAR_4) {", "return TD_RESULT_ASYNC_CONT;", "}", "uhci_async_unlink(async);", "goto done;", "}", "async = uhci_async_alloc(uhci_queue_get(VAR_0, VAR_2), VAR_1);", "async->queue->valid = 32;", "async->isoc = VAR_2->ctrl & TD_CTRL_IOS;", "VAR_6 = ((VAR_2->token >> 21) + 1) & 0x7ff;", "pid = VAR_2->token & 0xff;", "dev = uhci_find_device(VAR_0, (VAR_2->token >> 8) & 0x7f);", "ep = usb_ep_get(dev, pid, (VAR_2->token >> 15) & 0xf);", "usb_packet_setup(&async->packet, pid, ep, VAR_1);", "qemu_sglist_add(&async->sgl, VAR_2->buffer, VAR_6);", "usb_packet_map(&async->packet, &async->sgl);", "switch(pid) {", "case USB_TOKEN_OUT:\ncase USB_TOKEN_SETUP:\nVAR_5 = usb_handle_packet(dev, &async->packet);", "if (VAR_5 >= 0)\nVAR_5 = VAR_6;", "break;", "case USB_TOKEN_IN:\nVAR_5 = usb_handle_packet(dev, &async->packet);", "break;", "default:\nuhci_async_free(async);", "VAR_0->status |= UHCI_STS_HCPERR;", "uhci_update_irq(VAR_0);", "return TD_RESULT_STOP_FRAME;", "}", "if (VAR_5 == USB_RET_ASYNC) {", "uhci_async_link(async);", "return TD_RESULT_ASYNC_START;", "}", "async->packet.result = VAR_5;", "done:\nVAR_5 = uhci_complete_td(VAR_0, VAR_2, async, VAR_3);", "usb_packet_unmap(&async->packet, &async->sgl);", "uhci_async_free(async);", "return VAR_5;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 21, 23 ], [ 27 ], [ 29 ], [ 33 ], [ 37, 39 ], [ 41 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 65 ], [ 75 ], [ 77 ], [ 81 ], [ 83 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99 ], [ 101, 103, 105 ], [ 107, 109 ], [ 111 ], [ 115, 117 ], [ 119 ], [ 123, 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 149 ], [ 153, 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ] ]
24,159
static void xen_pt_region_update(XenPCIPassthroughState *s, MemoryRegionSection *sec, bool adding) { PCIDevice *d = &s->dev; MemoryRegion *mr = sec->mr; int bar = -1; int rc; int op = adding ? DPCI_ADD_MAPPING : DPCI_REMOVE_MAPPING; struct CheckBarArgs args = { .s = s, .addr = sec->offset_within_address_space, .size = int128_get64(sec->size), .rc = false, }; bar = xen_pt_bar_from_region(s, mr); if (bar == -1 && (!s->msix || &s->msix->mmio != mr)) { return; } if (s->msix && &s->msix->mmio == mr) { if (adding) { s->msix->mmio_base_addr = sec->offset_within_address_space; rc = xen_pt_msix_update_remap(s, s->msix->bar_index); } return; } args.type = d->io_regions[bar].type; pci_for_each_device(d->bus, pci_bus_num(d->bus), xen_pt_check_bar_overlap, &args); if (args.rc) { XEN_PT_WARN(d, "Region: %d (addr: %#"FMT_PCIBUS ", len: %#"FMT_PCIBUS") is overlapped.\n", bar, sec->offset_within_address_space, int128_get64(sec->size)); } if (d->io_regions[bar].type & PCI_BASE_ADDRESS_SPACE_IO) { uint32_t guest_port = sec->offset_within_address_space; uint32_t machine_port = s->bases[bar].access.pio_base; uint32_t size = int128_get64(sec->size); rc = xc_domain_ioport_mapping(xen_xc, xen_domid, guest_port, machine_port, size, op); if (rc) { XEN_PT_ERR(d, "%s ioport mapping failed! (err: %i)\n", adding ? "create new" : "remove old", errno); } } else { pcibus_t guest_addr = sec->offset_within_address_space; pcibus_t machine_addr = s->bases[bar].access.maddr + sec->offset_within_region; pcibus_t size = int128_get64(sec->size); rc = xc_domain_memory_mapping(xen_xc, xen_domid, XEN_PFN(guest_addr + XC_PAGE_SIZE - 1), XEN_PFN(machine_addr + XC_PAGE_SIZE - 1), XEN_PFN(size + XC_PAGE_SIZE - 1), op); if (rc) { XEN_PT_ERR(d, "%s mem mapping failed! (err: %i)\n", adding ? "create new" : "remove old", errno); } } }
false
qemu
fd56e0612b6454a282fa6a953fdb09281a98c589
static void xen_pt_region_update(XenPCIPassthroughState *s, MemoryRegionSection *sec, bool adding) { PCIDevice *d = &s->dev; MemoryRegion *mr = sec->mr; int bar = -1; int rc; int op = adding ? DPCI_ADD_MAPPING : DPCI_REMOVE_MAPPING; struct CheckBarArgs args = { .s = s, .addr = sec->offset_within_address_space, .size = int128_get64(sec->size), .rc = false, }; bar = xen_pt_bar_from_region(s, mr); if (bar == -1 && (!s->msix || &s->msix->mmio != mr)) { return; } if (s->msix && &s->msix->mmio == mr) { if (adding) { s->msix->mmio_base_addr = sec->offset_within_address_space; rc = xen_pt_msix_update_remap(s, s->msix->bar_index); } return; } args.type = d->io_regions[bar].type; pci_for_each_device(d->bus, pci_bus_num(d->bus), xen_pt_check_bar_overlap, &args); if (args.rc) { XEN_PT_WARN(d, "Region: %d (addr: %#"FMT_PCIBUS ", len: %#"FMT_PCIBUS") is overlapped.\n", bar, sec->offset_within_address_space, int128_get64(sec->size)); } if (d->io_regions[bar].type & PCI_BASE_ADDRESS_SPACE_IO) { uint32_t guest_port = sec->offset_within_address_space; uint32_t machine_port = s->bases[bar].access.pio_base; uint32_t size = int128_get64(sec->size); rc = xc_domain_ioport_mapping(xen_xc, xen_domid, guest_port, machine_port, size, op); if (rc) { XEN_PT_ERR(d, "%s ioport mapping failed! (err: %i)\n", adding ? "create new" : "remove old", errno); } } else { pcibus_t guest_addr = sec->offset_within_address_space; pcibus_t machine_addr = s->bases[bar].access.maddr + sec->offset_within_region; pcibus_t size = int128_get64(sec->size); rc = xc_domain_memory_mapping(xen_xc, xen_domid, XEN_PFN(guest_addr + XC_PAGE_SIZE - 1), XEN_PFN(machine_addr + XC_PAGE_SIZE - 1), XEN_PFN(size + XC_PAGE_SIZE - 1), op); if (rc) { XEN_PT_ERR(d, "%s mem mapping failed! (err: %i)\n", adding ? "create new" : "remove old", errno); } } }
{ "code": [], "line_no": [] }
static void FUNC_0(XenPCIPassthroughState *VAR_0, MemoryRegionSection *VAR_1, bool VAR_2) { PCIDevice *d = &VAR_0->dev; MemoryRegion *mr = VAR_1->mr; int VAR_3 = -1; int VAR_4; int VAR_5 = VAR_2 ? DPCI_ADD_MAPPING : DPCI_REMOVE_MAPPING; struct CheckBarArgs VAR_6 = { .VAR_0 = VAR_0, .addr = VAR_1->offset_within_address_space, .size = int128_get64(VAR_1->size), .VAR_4 = false, }; VAR_3 = xen_pt_bar_from_region(VAR_0, mr); if (VAR_3 == -1 && (!VAR_0->msix || &VAR_0->msix->mmio != mr)) { return; } if (VAR_0->msix && &VAR_0->msix->mmio == mr) { if (VAR_2) { VAR_0->msix->mmio_base_addr = VAR_1->offset_within_address_space; VAR_4 = xen_pt_msix_update_remap(VAR_0, VAR_0->msix->bar_index); } return; } VAR_6.type = d->io_regions[VAR_3].type; pci_for_each_device(d->bus, pci_bus_num(d->bus), xen_pt_check_bar_overlap, &VAR_6); if (VAR_6.VAR_4) { XEN_PT_WARN(d, "Region: %d (addr: %#"FMT_PCIBUS ", len: %#"FMT_PCIBUS") is overlapped.\n", VAR_3, VAR_1->offset_within_address_space, int128_get64(VAR_1->size)); } if (d->io_regions[VAR_3].type & PCI_BASE_ADDRESS_SPACE_IO) { uint32_t guest_port = VAR_1->offset_within_address_space; uint32_t machine_port = VAR_0->bases[VAR_3].access.pio_base; uint32_t size = int128_get64(VAR_1->size); VAR_4 = xc_domain_ioport_mapping(xen_xc, xen_domid, guest_port, machine_port, size, VAR_5); if (VAR_4) { XEN_PT_ERR(d, "%VAR_0 ioport mapping failed! (err: %i)\n", VAR_2 ? "create new" : "remove old", errno); } } else { pcibus_t guest_addr = VAR_1->offset_within_address_space; pcibus_t machine_addr = VAR_0->bases[VAR_3].access.maddr + VAR_1->offset_within_region; pcibus_t size = int128_get64(VAR_1->size); VAR_4 = xc_domain_memory_mapping(xen_xc, xen_domid, XEN_PFN(guest_addr + XC_PAGE_SIZE - 1), XEN_PFN(machine_addr + XC_PAGE_SIZE - 1), XEN_PFN(size + XC_PAGE_SIZE - 1), VAR_5); if (VAR_4) { XEN_PT_ERR(d, "%VAR_0 mem mapping failed! (err: %i)\n", VAR_2 ? "create new" : "remove old", errno); } } }
[ "static void FUNC_0(XenPCIPassthroughState *VAR_0,\nMemoryRegionSection *VAR_1, bool VAR_2)\n{", "PCIDevice *d = &VAR_0->dev;", "MemoryRegion *mr = VAR_1->mr;", "int VAR_3 = -1;", "int VAR_4;", "int VAR_5 = VAR_2 ? DPCI_ADD_MAPPING : DPCI_REMOVE_MAPPING;", "struct CheckBarArgs VAR_6 = {", ".VAR_0 = VAR_0,\n.addr = VAR_1->offset_within_address_space,\n.size = int128_get64(VAR_1->size),\n.VAR_4 = false,\n};", "VAR_3 = xen_pt_bar_from_region(VAR_0, mr);", "if (VAR_3 == -1 && (!VAR_0->msix || &VAR_0->msix->mmio != mr)) {", "return;", "}", "if (VAR_0->msix && &VAR_0->msix->mmio == mr) {", "if (VAR_2) {", "VAR_0->msix->mmio_base_addr = VAR_1->offset_within_address_space;", "VAR_4 = xen_pt_msix_update_remap(VAR_0, VAR_0->msix->bar_index);", "}", "return;", "}", "VAR_6.type = d->io_regions[VAR_3].type;", "pci_for_each_device(d->bus, pci_bus_num(d->bus),\nxen_pt_check_bar_overlap, &VAR_6);", "if (VAR_6.VAR_4) {", "XEN_PT_WARN(d, \"Region: %d (addr: %#\"FMT_PCIBUS\n\", len: %#\"FMT_PCIBUS\") is overlapped.\\n\",\nVAR_3, VAR_1->offset_within_address_space,\nint128_get64(VAR_1->size));", "}", "if (d->io_regions[VAR_3].type & PCI_BASE_ADDRESS_SPACE_IO) {", "uint32_t guest_port = VAR_1->offset_within_address_space;", "uint32_t machine_port = VAR_0->bases[VAR_3].access.pio_base;", "uint32_t size = int128_get64(VAR_1->size);", "VAR_4 = xc_domain_ioport_mapping(xen_xc, xen_domid,\nguest_port, machine_port, size,\nVAR_5);", "if (VAR_4) {", "XEN_PT_ERR(d, \"%VAR_0 ioport mapping failed! (err: %i)\\n\",\nVAR_2 ? \"create new\" : \"remove old\", errno);", "}", "} else {", "pcibus_t guest_addr = VAR_1->offset_within_address_space;", "pcibus_t machine_addr = VAR_0->bases[VAR_3].access.maddr\n+ VAR_1->offset_within_region;", "pcibus_t size = int128_get64(VAR_1->size);", "VAR_4 = xc_domain_memory_mapping(xen_xc, xen_domid,\nXEN_PFN(guest_addr + XC_PAGE_SIZE - 1),\nXEN_PFN(machine_addr + XC_PAGE_SIZE - 1),\nXEN_PFN(size + XC_PAGE_SIZE - 1),\nVAR_5);", "if (VAR_4) {", "XEN_PT_ERR(d, \"%VAR_0 mem mapping failed! (err: %i)\\n\",\nVAR_2 ? \"create new\" : \"remove old\", errno);", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 57 ], [ 59, 61 ], [ 63 ], [ 65, 67, 69, 71 ], [ 73 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85, 87, 89 ], [ 91 ], [ 93, 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103, 105 ], [ 107 ], [ 109, 111, 113, 115, 117 ], [ 119 ], [ 121, 123 ], [ 125 ], [ 127 ], [ 129 ] ]
24,163
static void omap_inth_sir_update(struct omap_intr_handler_s *s, int is_fiq) { int i, j, sir_intr, p_intr, p, f; uint32_t level; sir_intr = 0; p_intr = 255; /* Find the interrupt line with the highest dynamic priority. * Note: 0 denotes the hightest priority. * If all interrupts have the same priority, the default order is IRQ_N, * IRQ_N-1,...,IRQ_0. */ for (j = 0; j < s->nbanks; ++j) { level = s->bank[j].irqs & ~s->bank[j].mask & (is_fiq ? s->bank[j].fiq : ~s->bank[j].fiq); for (f = ffs(level), i = f - 1, level >>= f - 1; f; i += f, level >>= f) { p = s->bank[j].priority[i]; if (p <= p_intr) { p_intr = p; sir_intr = 32 * j + i; } f = ffs(level >> 1); } } s->sir_intr[is_fiq] = sir_intr; }
false
qemu
41074f3d3ff0e9a3c6f638627c12ebbf6d757cea
static void omap_inth_sir_update(struct omap_intr_handler_s *s, int is_fiq) { int i, j, sir_intr, p_intr, p, f; uint32_t level; sir_intr = 0; p_intr = 255; for (j = 0; j < s->nbanks; ++j) { level = s->bank[j].irqs & ~s->bank[j].mask & (is_fiq ? s->bank[j].fiq : ~s->bank[j].fiq); for (f = ffs(level), i = f - 1, level >>= f - 1; f; i += f, level >>= f) { p = s->bank[j].priority[i]; if (p <= p_intr) { p_intr = p; sir_intr = 32 * j + i; } f = ffs(level >> 1); } } s->sir_intr[is_fiq] = sir_intr; }
{ "code": [], "line_no": [] }
static void FUNC_0(struct omap_intr_handler_s *VAR_0, int VAR_1) { int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7; uint32_t level; VAR_4 = 0; VAR_5 = 255; for (VAR_3 = 0; VAR_3 < VAR_0->nbanks; ++VAR_3) { level = VAR_0->bank[VAR_3].irqs & ~VAR_0->bank[VAR_3].mask & (VAR_1 ? VAR_0->bank[VAR_3].fiq : ~VAR_0->bank[VAR_3].fiq); for (VAR_7 = ffs(level), VAR_2 = VAR_7 - 1, level >>= VAR_7 - 1; VAR_7; VAR_2 += VAR_7, level >>= VAR_7) { VAR_6 = VAR_0->bank[VAR_3].priority[VAR_2]; if (VAR_6 <= VAR_5) { VAR_5 = VAR_6; VAR_4 = 32 * VAR_3 + VAR_2; } VAR_7 = ffs(level >> 1); } } VAR_0->VAR_4[VAR_1] = VAR_4; }
[ "static void FUNC_0(struct omap_intr_handler_s *VAR_0, int VAR_1)\n{", "int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7;", "uint32_t level;", "VAR_4 = 0;", "VAR_5 = 255;", "for (VAR_3 = 0; VAR_3 < VAR_0->nbanks; ++VAR_3) {", "level = VAR_0->bank[VAR_3].irqs & ~VAR_0->bank[VAR_3].mask &\n(VAR_1 ? VAR_0->bank[VAR_3].fiq : ~VAR_0->bank[VAR_3].fiq);", "for (VAR_7 = ffs(level), VAR_2 = VAR_7 - 1, level >>= VAR_7 - 1; VAR_7; VAR_2 += VAR_7,", "level >>= VAR_7) {", "VAR_6 = VAR_0->bank[VAR_3].priority[VAR_2];", "if (VAR_6 <= VAR_5) {", "VAR_5 = VAR_6;", "VAR_4 = 32 * VAR_3 + VAR_2;", "}", "VAR_7 = ffs(level >> 1);", "}", "}", "VAR_0->VAR_4[VAR_1] = VAR_4;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ] ]
24,165
static int coroutine_fn bdrv_co_do_writev(BdrvChild *child, int64_t sector_num, int nb_sectors, QEMUIOVector *qiov, BdrvRequestFlags flags) { if (nb_sectors < 0 || nb_sectors > BDRV_REQUEST_MAX_SECTORS) { return -EINVAL; } return bdrv_co_pwritev(child->bs, sector_num << BDRV_SECTOR_BITS, nb_sectors << BDRV_SECTOR_BITS, qiov, flags); }
false
qemu
a03ef88f77af045a2eb9629b5ce774a3fb973c5e
static int coroutine_fn bdrv_co_do_writev(BdrvChild *child, int64_t sector_num, int nb_sectors, QEMUIOVector *qiov, BdrvRequestFlags flags) { if (nb_sectors < 0 || nb_sectors > BDRV_REQUEST_MAX_SECTORS) { return -EINVAL; } return bdrv_co_pwritev(child->bs, sector_num << BDRV_SECTOR_BITS, nb_sectors << BDRV_SECTOR_BITS, qiov, flags); }
{ "code": [], "line_no": [] }
static int VAR_0 bdrv_co_do_writev(BdrvChild *child, int64_t sector_num, int nb_sectors, QEMUIOVector *qiov, BdrvRequestFlags flags) { if (nb_sectors < 0 || nb_sectors > BDRV_REQUEST_MAX_SECTORS) { return -EINVAL; } return bdrv_co_pwritev(child->bs, sector_num << BDRV_SECTOR_BITS, nb_sectors << BDRV_SECTOR_BITS, qiov, flags); }
[ "static int VAR_0 bdrv_co_do_writev(BdrvChild *child,\nint64_t sector_num, int nb_sectors, QEMUIOVector *qiov,\nBdrvRequestFlags flags)\n{", "if (nb_sectors < 0 || nb_sectors > BDRV_REQUEST_MAX_SECTORS) {", "return -EINVAL;", "}", "return bdrv_co_pwritev(child->bs, sector_num << BDRV_SECTOR_BITS,\nnb_sectors << BDRV_SECTOR_BITS, qiov, flags);", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17, 19 ], [ 21 ] ]
24,166
static int decorrelate(TAKDecContext *s, int c1, int c2, int length) { GetBitContext *gb = &s->gb; int32_t *p1 = s->decoded[c1] + (s->dmode > 5); int32_t *p2 = s->decoded[c2] + (s->dmode > 5); int32_t bp1 = p1[0]; int32_t bp2 = p2[0]; int i; int dshift, dfactor; length += s->dmode < 6; switch (s->dmode) { case 1: /* left/side */ s->tdsp.decorrelate_ls(p1, p2, length); break; case 2: /* side/right */ s->tdsp.decorrelate_sr(p1, p2, length); break; case 3: /* side/mid */ s->tdsp.decorrelate_sm(p1, p2, length); break; case 4: /* side/left with scale factor */ FFSWAP(int32_t*, p1, p2); FFSWAP(int32_t, bp1, bp2); case 5: /* side/right with scale factor */ dshift = get_bits_esc4(gb); dfactor = get_sbits(gb, 10); s->tdsp.decorrelate_sf(p1, p2, length, dshift, dfactor); break; case 6: FFSWAP(int32_t*, p1, p2); case 7: { int length2, order_half, filter_order, dval1, dval2; int tmp, x, code_size; if (length < 256) return AVERROR_INVALIDDATA; dshift = get_bits_esc4(gb); filter_order = 8 << get_bits1(gb); dval1 = get_bits1(gb); dval2 = get_bits1(gb); for (i = 0; i < filter_order; i++) { if (!(i & 3)) code_size = 14 - get_bits(gb, 3); s->filter[i] = get_sbits(gb, code_size); } order_half = filter_order / 2; length2 = length - (filter_order - 1); /* decorrelate beginning samples */ if (dval1) { for (i = 0; i < order_half; i++) { int32_t a = p1[i]; int32_t b = p2[i]; p1[i] = a + b; } } /* decorrelate ending samples */ if (dval2) { for (i = length2 + order_half; i < length; i++) { int32_t a = p1[i]; int32_t b = p2[i]; p1[i] = a + b; } } for (i = 0; i < filter_order; i++) s->residues[i] = *p2++ >> dshift; p1 += order_half; x = FF_ARRAY_ELEMS(s->residues) - filter_order; for (; length2 > 0; length2 -= tmp) { tmp = FFMIN(length2, x); for (i = 0; i < tmp; i++) s->residues[filter_order + i] = *p2++ >> dshift; for (i = 0; i < tmp; i++) { int v = 1 << 9; if (filter_order == 16) { v += s->adsp.scalarproduct_int16(&s->residues[i], s->filter, filter_order); } else { v += s->residues[i + 7] * s->filter[7] + s->residues[i + 6] * s->filter[6] + s->residues[i + 5] * s->filter[5] + s->residues[i + 4] * s->filter[4] + s->residues[i + 3] * s->filter[3] + s->residues[i + 2] * s->filter[2] + s->residues[i + 1] * s->filter[1] + s->residues[i ] * s->filter[0]; } v = (av_clip_intp2(v >> 10, 13) << dshift) - *p1; *p1++ = v; } memmove(s->residues, &s->residues[tmp], 2 * filter_order); } emms_c(); break; } } if (s->dmode > 0 && s->dmode < 6) { p1[0] = bp1; p2[0] = bp2; } return 0; }
false
FFmpeg
08b520636e96ba6888b669b9b3f4c414631ea1d2
static int decorrelate(TAKDecContext *s, int c1, int c2, int length) { GetBitContext *gb = &s->gb; int32_t *p1 = s->decoded[c1] + (s->dmode > 5); int32_t *p2 = s->decoded[c2] + (s->dmode > 5); int32_t bp1 = p1[0]; int32_t bp2 = p2[0]; int i; int dshift, dfactor; length += s->dmode < 6; switch (s->dmode) { case 1: s->tdsp.decorrelate_ls(p1, p2, length); break; case 2: s->tdsp.decorrelate_sr(p1, p2, length); break; case 3: s->tdsp.decorrelate_sm(p1, p2, length); break; case 4: FFSWAP(int32_t*, p1, p2); FFSWAP(int32_t, bp1, bp2); case 5: dshift = get_bits_esc4(gb); dfactor = get_sbits(gb, 10); s->tdsp.decorrelate_sf(p1, p2, length, dshift, dfactor); break; case 6: FFSWAP(int32_t*, p1, p2); case 7: { int length2, order_half, filter_order, dval1, dval2; int tmp, x, code_size; if (length < 256) return AVERROR_INVALIDDATA; dshift = get_bits_esc4(gb); filter_order = 8 << get_bits1(gb); dval1 = get_bits1(gb); dval2 = get_bits1(gb); for (i = 0; i < filter_order; i++) { if (!(i & 3)) code_size = 14 - get_bits(gb, 3); s->filter[i] = get_sbits(gb, code_size); } order_half = filter_order / 2; length2 = length - (filter_order - 1); if (dval1) { for (i = 0; i < order_half; i++) { int32_t a = p1[i]; int32_t b = p2[i]; p1[i] = a + b; } } if (dval2) { for (i = length2 + order_half; i < length; i++) { int32_t a = p1[i]; int32_t b = p2[i]; p1[i] = a + b; } } for (i = 0; i < filter_order; i++) s->residues[i] = *p2++ >> dshift; p1 += order_half; x = FF_ARRAY_ELEMS(s->residues) - filter_order; for (; length2 > 0; length2 -= tmp) { tmp = FFMIN(length2, x); for (i = 0; i < tmp; i++) s->residues[filter_order + i] = *p2++ >> dshift; for (i = 0; i < tmp; i++) { int v = 1 << 9; if (filter_order == 16) { v += s->adsp.scalarproduct_int16(&s->residues[i], s->filter, filter_order); } else { v += s->residues[i + 7] * s->filter[7] + s->residues[i + 6] * s->filter[6] + s->residues[i + 5] * s->filter[5] + s->residues[i + 4] * s->filter[4] + s->residues[i + 3] * s->filter[3] + s->residues[i + 2] * s->filter[2] + s->residues[i + 1] * s->filter[1] + s->residues[i ] * s->filter[0]; } v = (av_clip_intp2(v >> 10, 13) << dshift) - *p1; *p1++ = v; } memmove(s->residues, &s->residues[tmp], 2 * filter_order); } emms_c(); break; } } if (s->dmode > 0 && s->dmode < 6) { p1[0] = bp1; p2[0] = bp2; } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(TAKDecContext *VAR_0, int VAR_1, int VAR_2, int VAR_3) { GetBitContext *gb = &VAR_0->gb; int32_t *p1 = VAR_0->decoded[VAR_1] + (VAR_0->dmode > 5); int32_t *p2 = VAR_0->decoded[VAR_2] + (VAR_0->dmode > 5); int32_t bp1 = p1[0]; int32_t bp2 = p2[0]; int VAR_4; int VAR_5, VAR_6; VAR_3 += VAR_0->dmode < 6; switch (VAR_0->dmode) { case 1: VAR_0->tdsp.decorrelate_ls(p1, p2, VAR_3); break; case 2: VAR_0->tdsp.decorrelate_sr(p1, p2, VAR_3); break; case 3: VAR_0->tdsp.decorrelate_sm(p1, p2, VAR_3); break; case 4: FFSWAP(int32_t*, p1, p2); FFSWAP(int32_t, bp1, bp2); case 5: VAR_5 = get_bits_esc4(gb); VAR_6 = get_sbits(gb, 10); VAR_0->tdsp.decorrelate_sf(p1, p2, VAR_3, VAR_5, VAR_6); break; case 6: FFSWAP(int32_t*, p1, p2); case 7: { int VAR_7, VAR_8, VAR_9, VAR_10, VAR_11; int VAR_12, VAR_13, VAR_14; if (VAR_3 < 256) return AVERROR_INVALIDDATA; VAR_5 = get_bits_esc4(gb); VAR_9 = 8 << get_bits1(gb); VAR_10 = get_bits1(gb); VAR_11 = get_bits1(gb); for (VAR_4 = 0; VAR_4 < VAR_9; VAR_4++) { if (!(VAR_4 & 3)) VAR_14 = 14 - get_bits(gb, 3); VAR_0->filter[VAR_4] = get_sbits(gb, VAR_14); } VAR_8 = VAR_9 / 2; VAR_7 = VAR_3 - (VAR_9 - 1); if (VAR_10) { for (VAR_4 = 0; VAR_4 < VAR_8; VAR_4++) { int32_t a = p1[VAR_4]; int32_t b = p2[VAR_4]; p1[VAR_4] = a + b; } } if (VAR_11) { for (VAR_4 = VAR_7 + VAR_8; VAR_4 < VAR_3; VAR_4++) { int32_t a = p1[VAR_4]; int32_t b = p2[VAR_4]; p1[VAR_4] = a + b; } } for (VAR_4 = 0; VAR_4 < VAR_9; VAR_4++) VAR_0->residues[VAR_4] = *p2++ >> VAR_5; p1 += VAR_8; VAR_13 = FF_ARRAY_ELEMS(VAR_0->residues) - VAR_9; for (; VAR_7 > 0; VAR_7 -= VAR_12) { VAR_12 = FFMIN(VAR_7, VAR_13); for (VAR_4 = 0; VAR_4 < VAR_12; VAR_4++) VAR_0->residues[VAR_9 + VAR_4] = *p2++ >> VAR_5; for (VAR_4 = 0; VAR_4 < VAR_12; VAR_4++) { int VAR_15 = 1 << 9; if (VAR_9 == 16) { VAR_15 += VAR_0->adsp.scalarproduct_int16(&VAR_0->residues[VAR_4], VAR_0->filter, VAR_9); } else { VAR_15 += VAR_0->residues[VAR_4 + 7] * VAR_0->filter[7] + VAR_0->residues[VAR_4 + 6] * VAR_0->filter[6] + VAR_0->residues[VAR_4 + 5] * VAR_0->filter[5] + VAR_0->residues[VAR_4 + 4] * VAR_0->filter[4] + VAR_0->residues[VAR_4 + 3] * VAR_0->filter[3] + VAR_0->residues[VAR_4 + 2] * VAR_0->filter[2] + VAR_0->residues[VAR_4 + 1] * VAR_0->filter[1] + VAR_0->residues[VAR_4 ] * VAR_0->filter[0]; } VAR_15 = (av_clip_intp2(VAR_15 >> 10, 13) << VAR_5) - *p1; *p1++ = VAR_15; } memmove(VAR_0->residues, &VAR_0->residues[VAR_12], 2 * VAR_9); } emms_c(); break; } } if (VAR_0->dmode > 0 && VAR_0->dmode < 6) { p1[0] = bp1; p2[0] = bp2; } return 0; }
[ "static int FUNC_0(TAKDecContext *VAR_0, int VAR_1, int VAR_2, int VAR_3)\n{", "GetBitContext *gb = &VAR_0->gb;", "int32_t *p1 = VAR_0->decoded[VAR_1] + (VAR_0->dmode > 5);", "int32_t *p2 = VAR_0->decoded[VAR_2] + (VAR_0->dmode > 5);", "int32_t bp1 = p1[0];", "int32_t bp2 = p2[0];", "int VAR_4;", "int VAR_5, VAR_6;", "VAR_3 += VAR_0->dmode < 6;", "switch (VAR_0->dmode) {", "case 1:\nVAR_0->tdsp.decorrelate_ls(p1, p2, VAR_3);", "break;", "case 2:\nVAR_0->tdsp.decorrelate_sr(p1, p2, VAR_3);", "break;", "case 3:\nVAR_0->tdsp.decorrelate_sm(p1, p2, VAR_3);", "break;", "case 4:\nFFSWAP(int32_t*, p1, p2);", "FFSWAP(int32_t, bp1, bp2);", "case 5:\nVAR_5 = get_bits_esc4(gb);", "VAR_6 = get_sbits(gb, 10);", "VAR_0->tdsp.decorrelate_sf(p1, p2, VAR_3, VAR_5, VAR_6);", "break;", "case 6:\nFFSWAP(int32_t*, p1, p2);", "case 7: {", "int VAR_7, VAR_8, VAR_9, VAR_10, VAR_11;", "int VAR_12, VAR_13, VAR_14;", "if (VAR_3 < 256)\nreturn AVERROR_INVALIDDATA;", "VAR_5 = get_bits_esc4(gb);", "VAR_9 = 8 << get_bits1(gb);", "VAR_10 = get_bits1(gb);", "VAR_11 = get_bits1(gb);", "for (VAR_4 = 0; VAR_4 < VAR_9; VAR_4++) {", "if (!(VAR_4 & 3))\nVAR_14 = 14 - get_bits(gb, 3);", "VAR_0->filter[VAR_4] = get_sbits(gb, VAR_14);", "}", "VAR_8 = VAR_9 / 2;", "VAR_7 = VAR_3 - (VAR_9 - 1);", "if (VAR_10) {", "for (VAR_4 = 0; VAR_4 < VAR_8; VAR_4++) {", "int32_t a = p1[VAR_4];", "int32_t b = p2[VAR_4];", "p1[VAR_4] = a + b;", "}", "}", "if (VAR_11) {", "for (VAR_4 = VAR_7 + VAR_8; VAR_4 < VAR_3; VAR_4++) {", "int32_t a = p1[VAR_4];", "int32_t b = p2[VAR_4];", "p1[VAR_4] = a + b;", "}", "}", "for (VAR_4 = 0; VAR_4 < VAR_9; VAR_4++)", "VAR_0->residues[VAR_4] = *p2++ >> VAR_5;", "p1 += VAR_8;", "VAR_13 = FF_ARRAY_ELEMS(VAR_0->residues) - VAR_9;", "for (; VAR_7 > 0; VAR_7 -= VAR_12) {", "VAR_12 = FFMIN(VAR_7, VAR_13);", "for (VAR_4 = 0; VAR_4 < VAR_12; VAR_4++)", "VAR_0->residues[VAR_9 + VAR_4] = *p2++ >> VAR_5;", "for (VAR_4 = 0; VAR_4 < VAR_12; VAR_4++) {", "int VAR_15 = 1 << 9;", "if (VAR_9 == 16) {", "VAR_15 += VAR_0->adsp.scalarproduct_int16(&VAR_0->residues[VAR_4], VAR_0->filter,\nVAR_9);", "} else {", "VAR_15 += VAR_0->residues[VAR_4 + 7] * VAR_0->filter[7] +\nVAR_0->residues[VAR_4 + 6] * VAR_0->filter[6] +\nVAR_0->residues[VAR_4 + 5] * VAR_0->filter[5] +\nVAR_0->residues[VAR_4 + 4] * VAR_0->filter[4] +\nVAR_0->residues[VAR_4 + 3] * VAR_0->filter[3] +\nVAR_0->residues[VAR_4 + 2] * VAR_0->filter[2] +\nVAR_0->residues[VAR_4 + 1] * VAR_0->filter[1] +\nVAR_0->residues[VAR_4 ] * VAR_0->filter[0];", "}", "VAR_15 = (av_clip_intp2(VAR_15 >> 10, 13) << VAR_5) - *p1;", "*p1++ = VAR_15;", "}", "memmove(VAR_0->residues, &VAR_0->residues[VAR_12], 2 * VAR_9);", "}", "emms_c();", "break;", "}", "}", "if (VAR_0->dmode > 0 && VAR_0->dmode < 6) {", "p1[0] = bp1;", "p2[0] = bp2;", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45, 47 ], [ 49 ], [ 51, 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61, 63 ], [ 65 ], [ 67 ], [ 69 ], [ 73, 75 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 89 ], [ 91, 93 ], [ 95 ], [ 97 ], [ 101 ], [ 103 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 145 ], [ 147 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 161 ], [ 163 ], [ 167 ], [ 169 ], [ 173 ], [ 175, 177 ], [ 179 ], [ 181, 183, 185, 187, 189, 191, 193, 195 ], [ 197 ], [ 201 ], [ 203 ], [ 205 ], [ 209 ], [ 211 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 235 ], [ 237 ] ]
24,167
static MegasasCmd *megasas_lookup_frame(MegasasState *s, target_phys_addr_t frame) { MegasasCmd *cmd = NULL; int num = 0, index; index = s->reply_queue_head; while (num < s->fw_cmds) { if (s->frames[index].pa && s->frames[index].pa == frame) { cmd = &s->frames[index]; break; } index = megasas_next_index(s, index, s->fw_cmds); num++; } return cmd; }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static MegasasCmd *megasas_lookup_frame(MegasasState *s, target_phys_addr_t frame) { MegasasCmd *cmd = NULL; int num = 0, index; index = s->reply_queue_head; while (num < s->fw_cmds) { if (s->frames[index].pa && s->frames[index].pa == frame) { cmd = &s->frames[index]; break; } index = megasas_next_index(s, index, s->fw_cmds); num++; } return cmd; }
{ "code": [], "line_no": [] }
static MegasasCmd *FUNC_0(MegasasState *s, target_phys_addr_t frame) { MegasasCmd *cmd = NULL; int VAR_0 = 0, VAR_1; VAR_1 = s->reply_queue_head; while (VAR_0 < s->fw_cmds) { if (s->frames[VAR_1].pa && s->frames[VAR_1].pa == frame) { cmd = &s->frames[VAR_1]; break; } VAR_1 = megasas_next_index(s, VAR_1, s->fw_cmds); VAR_0++; } return cmd; }
[ "static MegasasCmd *FUNC_0(MegasasState *s,\ntarget_phys_addr_t frame)\n{", "MegasasCmd *cmd = NULL;", "int VAR_0 = 0, VAR_1;", "VAR_1 = s->reply_queue_head;", "while (VAR_0 < s->fw_cmds) {", "if (s->frames[VAR_1].pa && s->frames[VAR_1].pa == frame) {", "cmd = &s->frames[VAR_1];", "break;", "}", "VAR_1 = megasas_next_index(s, VAR_1, s->fw_cmds);", "VAR_0++;", "}", "return cmd;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ] ]
24,169
static int ebml_parse_elem(MatroskaDemuxContext *matroska, EbmlSyntax *syntax, void *data) { static const uint64_t max_lengths[EBML_TYPE_COUNT] = { [EBML_UINT] = 8, [EBML_FLOAT] = 8, // max. 16 MB for strings [EBML_STR] = 0x1000000, [EBML_UTF8] = 0x1000000, // max. 256 MB for binary data [EBML_BIN] = 0x10000000, // no limits for anything else }; AVIOContext *pb = matroska->ctx->pb; uint32_t id = syntax->id; uint64_t length; int res; data = (char *)data + syntax->data_offset; if (syntax->list_elem_size) { EbmlList *list = data; list->elem = av_realloc(list->elem, (list->nb_elem+1)*syntax->list_elem_size); data = (char*)list->elem + list->nb_elem*syntax->list_elem_size; memset(data, 0, syntax->list_elem_size); list->nb_elem++; } if (syntax->type != EBML_PASS && syntax->type != EBML_STOP) { matroska->current_id = 0; if ((res = ebml_read_length(matroska, pb, &length)) < 0) return res; if (max_lengths[syntax->type] && length > max_lengths[syntax->type]) { av_log(matroska->ctx, AV_LOG_ERROR, "Invalid length 0x%"PRIx64" > 0x%"PRIx64" for syntax element %i\n", length, max_lengths[syntax->type], syntax->type); return AVERROR_INVALIDDATA; } } switch (syntax->type) { case EBML_UINT: res = ebml_read_uint (pb, length, data); break; case EBML_FLOAT: res = ebml_read_float (pb, length, data); break; case EBML_STR: case EBML_UTF8: res = ebml_read_ascii (pb, length, data); break; case EBML_BIN: res = ebml_read_binary(pb, length, data); break; case EBML_NEST: if ((res=ebml_read_master(matroska, length)) < 0) return res; if (id == MATROSKA_ID_SEGMENT) matroska->segment_start = avio_tell(matroska->ctx->pb); return ebml_parse_nest(matroska, syntax->def.n, data); case EBML_PASS: return ebml_parse_id(matroska, syntax->def.n, id, data); case EBML_STOP: return 1; default: return avio_skip(pb,length)<0 ? AVERROR(EIO) : 0; } if (res == AVERROR_INVALIDDATA) av_log(matroska->ctx, AV_LOG_ERROR, "Invalid element\n"); else if (res == AVERROR(EIO)) av_log(matroska->ctx, AV_LOG_ERROR, "Read error\n"); return res; }
true
FFmpeg
77d2ef13a8fa630e5081f14bde3fd20f84c90aec
static int ebml_parse_elem(MatroskaDemuxContext *matroska, EbmlSyntax *syntax, void *data) { static const uint64_t max_lengths[EBML_TYPE_COUNT] = { [EBML_UINT] = 8, [EBML_FLOAT] = 8, [EBML_STR] = 0x1000000, [EBML_UTF8] = 0x1000000, [EBML_BIN] = 0x10000000, }; AVIOContext *pb = matroska->ctx->pb; uint32_t id = syntax->id; uint64_t length; int res; data = (char *)data + syntax->data_offset; if (syntax->list_elem_size) { EbmlList *list = data; list->elem = av_realloc(list->elem, (list->nb_elem+1)*syntax->list_elem_size); data = (char*)list->elem + list->nb_elem*syntax->list_elem_size; memset(data, 0, syntax->list_elem_size); list->nb_elem++; } if (syntax->type != EBML_PASS && syntax->type != EBML_STOP) { matroska->current_id = 0; if ((res = ebml_read_length(matroska, pb, &length)) < 0) return res; if (max_lengths[syntax->type] && length > max_lengths[syntax->type]) { av_log(matroska->ctx, AV_LOG_ERROR, "Invalid length 0x%"PRIx64" > 0x%"PRIx64" for syntax element %i\n", length, max_lengths[syntax->type], syntax->type); return AVERROR_INVALIDDATA; } } switch (syntax->type) { case EBML_UINT: res = ebml_read_uint (pb, length, data); break; case EBML_FLOAT: res = ebml_read_float (pb, length, data); break; case EBML_STR: case EBML_UTF8: res = ebml_read_ascii (pb, length, data); break; case EBML_BIN: res = ebml_read_binary(pb, length, data); break; case EBML_NEST: if ((res=ebml_read_master(matroska, length)) < 0) return res; if (id == MATROSKA_ID_SEGMENT) matroska->segment_start = avio_tell(matroska->ctx->pb); return ebml_parse_nest(matroska, syntax->def.n, data); case EBML_PASS: return ebml_parse_id(matroska, syntax->def.n, id, data); case EBML_STOP: return 1; default: return avio_skip(pb,length)<0 ? AVERROR(EIO) : 0; } if (res == AVERROR_INVALIDDATA) av_log(matroska->ctx, AV_LOG_ERROR, "Invalid element\n"); else if (res == AVERROR(EIO)) av_log(matroska->ctx, AV_LOG_ERROR, "Read error\n"); return res; }
{ "code": [ " list->elem = av_realloc(list->elem, (list->nb_elem+1)*syntax->list_elem_size);" ], "line_no": [ 43 ] }
static int FUNC_0(MatroskaDemuxContext *VAR_0, EbmlSyntax *VAR_1, void *VAR_2) { static const uint64_t VAR_3[EBML_TYPE_COUNT] = { [EBML_UINT] = 8, [EBML_FLOAT] = 8, [EBML_STR] = 0x1000000, [EBML_UTF8] = 0x1000000, [EBML_BIN] = 0x10000000, }; AVIOContext *pb = VAR_0->ctx->pb; uint32_t id = VAR_1->id; uint64_t length; int VAR_4; VAR_2 = (char *)VAR_2 + VAR_1->data_offset; if (VAR_1->list_elem_size) { EbmlList *list = VAR_2; list->elem = av_realloc(list->elem, (list->nb_elem+1)*VAR_1->list_elem_size); VAR_2 = (char*)list->elem + list->nb_elem*VAR_1->list_elem_size; memset(VAR_2, 0, VAR_1->list_elem_size); list->nb_elem++; } if (VAR_1->type != EBML_PASS && VAR_1->type != EBML_STOP) { VAR_0->current_id = 0; if ((VAR_4 = ebml_read_length(VAR_0, pb, &length)) < 0) return VAR_4; if (VAR_3[VAR_1->type] && length > VAR_3[VAR_1->type]) { av_log(VAR_0->ctx, AV_LOG_ERROR, "Invalid length 0x%"PRIx64" > 0x%"PRIx64" for VAR_1 element %i\n", length, VAR_3[VAR_1->type], VAR_1->type); return AVERROR_INVALIDDATA; } } switch (VAR_1->type) { case EBML_UINT: VAR_4 = ebml_read_uint (pb, length, VAR_2); break; case EBML_FLOAT: VAR_4 = ebml_read_float (pb, length, VAR_2); break; case EBML_STR: case EBML_UTF8: VAR_4 = ebml_read_ascii (pb, length, VAR_2); break; case EBML_BIN: VAR_4 = ebml_read_binary(pb, length, VAR_2); break; case EBML_NEST: if ((VAR_4=ebml_read_master(VAR_0, length)) < 0) return VAR_4; if (id == MATROSKA_ID_SEGMENT) VAR_0->segment_start = avio_tell(VAR_0->ctx->pb); return ebml_parse_nest(VAR_0, VAR_1->def.n, VAR_2); case EBML_PASS: return ebml_parse_id(VAR_0, VAR_1->def.n, id, VAR_2); case EBML_STOP: return 1; default: return avio_skip(pb,length)<0 ? AVERROR(EIO) : 0; } if (VAR_4 == AVERROR_INVALIDDATA) av_log(VAR_0->ctx, AV_LOG_ERROR, "Invalid element\n"); else if (VAR_4 == AVERROR(EIO)) av_log(VAR_0->ctx, AV_LOG_ERROR, "Read error\n"); return VAR_4; }
[ "static int FUNC_0(MatroskaDemuxContext *VAR_0,\nEbmlSyntax *VAR_1, void *VAR_2)\n{", "static const uint64_t VAR_3[EBML_TYPE_COUNT] = {", "[EBML_UINT] = 8,\n[EBML_FLOAT] = 8,\n[EBML_STR] = 0x1000000,\n[EBML_UTF8] = 0x1000000,\n[EBML_BIN] = 0x10000000,\n};", "AVIOContext *pb = VAR_0->ctx->pb;", "uint32_t id = VAR_1->id;", "uint64_t length;", "int VAR_4;", "VAR_2 = (char *)VAR_2 + VAR_1->data_offset;", "if (VAR_1->list_elem_size) {", "EbmlList *list = VAR_2;", "list->elem = av_realloc(list->elem, (list->nb_elem+1)*VAR_1->list_elem_size);", "VAR_2 = (char*)list->elem + list->nb_elem*VAR_1->list_elem_size;", "memset(VAR_2, 0, VAR_1->list_elem_size);", "list->nb_elem++;", "}", "if (VAR_1->type != EBML_PASS && VAR_1->type != EBML_STOP) {", "VAR_0->current_id = 0;", "if ((VAR_4 = ebml_read_length(VAR_0, pb, &length)) < 0)\nreturn VAR_4;", "if (VAR_3[VAR_1->type] && length > VAR_3[VAR_1->type]) {", "av_log(VAR_0->ctx, AV_LOG_ERROR,\n\"Invalid length 0x%\"PRIx64\" > 0x%\"PRIx64\" for VAR_1 element %i\\n\",\nlength, VAR_3[VAR_1->type], VAR_1->type);", "return AVERROR_INVALIDDATA;", "}", "}", "switch (VAR_1->type) {", "case EBML_UINT: VAR_4 = ebml_read_uint (pb, length, VAR_2); break;", "case EBML_FLOAT: VAR_4 = ebml_read_float (pb, length, VAR_2); break;", "case EBML_STR:\ncase EBML_UTF8: VAR_4 = ebml_read_ascii (pb, length, VAR_2); break;", "case EBML_BIN: VAR_4 = ebml_read_binary(pb, length, VAR_2); break;", "case EBML_NEST: if ((VAR_4=ebml_read_master(VAR_0, length)) < 0)\nreturn VAR_4;", "if (id == MATROSKA_ID_SEGMENT)\nVAR_0->segment_start = avio_tell(VAR_0->ctx->pb);", "return ebml_parse_nest(VAR_0, VAR_1->def.n, VAR_2);", "case EBML_PASS: return ebml_parse_id(VAR_0, VAR_1->def.n, id, VAR_2);", "case EBML_STOP: return 1;", "default: return avio_skip(pb,length)<0 ? AVERROR(EIO) : 0;", "}", "if (VAR_4 == AVERROR_INVALIDDATA)\nav_log(VAR_0->ctx, AV_LOG_ERROR, \"Invalid element\\n\");", "else if (VAR_4 == AVERROR(EIO))\nav_log(VAR_0->ctx, AV_LOG_ERROR, \"Read error\\n\");", "return VAR_4;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9, 11, 15, 17, 21, 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59, 61 ], [ 63 ], [ 65, 67, 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ], [ 83 ], [ 85, 87 ], [ 89 ], [ 91, 93 ], [ 95, 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109, 111 ], [ 113, 115 ], [ 117 ], [ 119 ] ]
24,170
static int ehci_init_transfer(EHCIPacket *p) { uint32_t cpage, offset, bytes, plen; dma_addr_t page; cpage = get_field(p->qtd.token, QTD_TOKEN_CPAGE); bytes = get_field(p->qtd.token, QTD_TOKEN_TBYTES); offset = p->qtd.bufptr[0] & ~QTD_BUFPTR_MASK; qemu_sglist_init(&p->sgl, p->queue->ehci->device, 5, p->queue->ehci->as); while (bytes > 0) { if (cpage > 4) { fprintf(stderr, "cpage out of range (%d)\n", cpage); return -1; } page = p->qtd.bufptr[cpage] & QTD_BUFPTR_MASK; page += offset; plen = bytes; if (plen > 4096 - offset) { plen = 4096 - offset; offset = 0; cpage++; } qemu_sglist_add(&p->sgl, page, plen); bytes -= plen; } return 0; }
true
qemu
791f97758e223de3290592d169f8e6339c281714
static int ehci_init_transfer(EHCIPacket *p) { uint32_t cpage, offset, bytes, plen; dma_addr_t page; cpage = get_field(p->qtd.token, QTD_TOKEN_CPAGE); bytes = get_field(p->qtd.token, QTD_TOKEN_TBYTES); offset = p->qtd.bufptr[0] & ~QTD_BUFPTR_MASK; qemu_sglist_init(&p->sgl, p->queue->ehci->device, 5, p->queue->ehci->as); while (bytes > 0) { if (cpage > 4) { fprintf(stderr, "cpage out of range (%d)\n", cpage); return -1; } page = p->qtd.bufptr[cpage] & QTD_BUFPTR_MASK; page += offset; plen = bytes; if (plen > 4096 - offset) { plen = 4096 - offset; offset = 0; cpage++; } qemu_sglist_add(&p->sgl, page, plen); bytes -= plen; } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(EHCIPacket *VAR_0) { uint32_t cpage, offset, bytes, plen; dma_addr_t page; cpage = get_field(VAR_0->qtd.token, QTD_TOKEN_CPAGE); bytes = get_field(VAR_0->qtd.token, QTD_TOKEN_TBYTES); offset = VAR_0->qtd.bufptr[0] & ~QTD_BUFPTR_MASK; qemu_sglist_init(&VAR_0->sgl, VAR_0->queue->ehci->device, 5, VAR_0->queue->ehci->as); while (bytes > 0) { if (cpage > 4) { fprintf(stderr, "cpage out of range (%d)\n", cpage); return -1; } page = VAR_0->qtd.bufptr[cpage] & QTD_BUFPTR_MASK; page += offset; plen = bytes; if (plen > 4096 - offset) { plen = 4096 - offset; offset = 0; cpage++; } qemu_sglist_add(&VAR_0->sgl, page, plen); bytes -= plen; } return 0; }
[ "static int FUNC_0(EHCIPacket *VAR_0)\n{", "uint32_t cpage, offset, bytes, plen;", "dma_addr_t page;", "cpage = get_field(VAR_0->qtd.token, QTD_TOKEN_CPAGE);", "bytes = get_field(VAR_0->qtd.token, QTD_TOKEN_TBYTES);", "offset = VAR_0->qtd.bufptr[0] & ~QTD_BUFPTR_MASK;", "qemu_sglist_init(&VAR_0->sgl, VAR_0->queue->ehci->device, 5, VAR_0->queue->ehci->as);", "while (bytes > 0) {", "if (cpage > 4) {", "fprintf(stderr, \"cpage out of range (%d)\\n\", cpage);", "return -1;", "}", "page = VAR_0->qtd.bufptr[cpage] & QTD_BUFPTR_MASK;", "page += offset;", "plen = bytes;", "if (plen > 4096 - offset) {", "plen = 4096 - offset;", "offset = 0;", "cpage++;", "}", "qemu_sglist_add(&VAR_0->sgl, page, plen);", "bytes -= plen;", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 28 ], [ 30 ], [ 34 ], [ 36 ], [ 38 ], [ 40 ], [ 42 ], [ 44 ], [ 46 ], [ 48 ], [ 52 ], [ 54 ], [ 56 ], [ 58 ], [ 60 ] ]
24,171
static target_long monitor_get_pc (const struct MonitorDef *md, int val) { CPUState *env = mon_get_cpu(); if (!env) return 0; return env->eip + env->segs[R_CS].base; }
true
qemu
09b9418c6d085a0728372aa760ebd10128a020b1
static target_long monitor_get_pc (const struct MonitorDef *md, int val) { CPUState *env = mon_get_cpu(); if (!env) return 0; return env->eip + env->segs[R_CS].base; }
{ "code": [ " if (!env)", " if (!env)", " if (!env)", " if (!env)", " if (!env)", " return 0;", " if (!env)", " return 0;", " if (!env)", " return 0;", " if (!env)", " return 0;", " if (!env)", " return 0;", " if (!env)", " return 0;", " if (!env)", " return 0;", " if (!env)", " return 0;", " if (!env)", " return 0;" ], "line_no": [ 7, 7, 7, 7, 7, 9, 7, 9, 7, 9, 7, 9, 7, 9, 7, 9, 7, 9, 7, 9, 7, 9 ] }
static target_long FUNC_0 (const struct MonitorDef *md, int val) { CPUState *env = mon_get_cpu(); if (!env) return 0; return env->eip + env->segs[R_CS].base; }
[ "static target_long FUNC_0 (const struct MonitorDef *md, int val)\n{", "CPUState *env = mon_get_cpu();", "if (!env)\nreturn 0;", "return env->eip + env->segs[R_CS].base;", "}" ]
[ 0, 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 11 ], [ 13 ] ]
24,172
static void gen_stswi(DisasContext *ctx) { TCGv t0; TCGv_i32 t1, t2; int nb = NB(ctx->opcode); gen_set_access_type(ctx, ACCESS_INT); /* NIP cannot be restored if the memory exception comes from an helper */ gen_update_nip(ctx, ctx->nip - 4); t0 = tcg_temp_new(); gen_addr_register(ctx, t0); if (nb == 0) nb = 32; t1 = tcg_const_i32(nb); t2 = tcg_const_i32(rS(ctx->opcode)); gen_helper_stsw(cpu_env, t0, t1, t2); tcg_temp_free(t0); tcg_temp_free_i32(t1); tcg_temp_free_i32(t2); }
true
qemu
e41029b378b4a65a0b89b5a8dc087aca6b5d012d
static void gen_stswi(DisasContext *ctx) { TCGv t0; TCGv_i32 t1, t2; int nb = NB(ctx->opcode); gen_set_access_type(ctx, ACCESS_INT); gen_update_nip(ctx, ctx->nip - 4); t0 = tcg_temp_new(); gen_addr_register(ctx, t0); if (nb == 0) nb = 32; t1 = tcg_const_i32(nb); t2 = tcg_const_i32(rS(ctx->opcode)); gen_helper_stsw(cpu_env, t0, t1, t2); tcg_temp_free(t0); tcg_temp_free_i32(t1); tcg_temp_free_i32(t2); }
{ "code": [ " gen_update_nip(ctx, ctx->nip - 4);", " gen_update_nip(ctx, ctx->nip - 4);", " gen_update_nip(ctx, ctx->nip - 4);", " gen_update_nip(ctx, ctx->nip - 4);" ], "line_no": [ 15, 15, 15, 15 ] }
static void FUNC_0(DisasContext *VAR_0) { TCGv t0; TCGv_i32 t1, t2; int VAR_1 = NB(VAR_0->opcode); gen_set_access_type(VAR_0, ACCESS_INT); gen_update_nip(VAR_0, VAR_0->nip - 4); t0 = tcg_temp_new(); gen_addr_register(VAR_0, t0); if (VAR_1 == 0) VAR_1 = 32; t1 = tcg_const_i32(VAR_1); t2 = tcg_const_i32(rS(VAR_0->opcode)); gen_helper_stsw(cpu_env, t0, t1, t2); tcg_temp_free(t0); tcg_temp_free_i32(t1); tcg_temp_free_i32(t2); }
[ "static void FUNC_0(DisasContext *VAR_0)\n{", "TCGv t0;", "TCGv_i32 t1, t2;", "int VAR_1 = NB(VAR_0->opcode);", "gen_set_access_type(VAR_0, ACCESS_INT);", "gen_update_nip(VAR_0, VAR_0->nip - 4);", "t0 = tcg_temp_new();", "gen_addr_register(VAR_0, t0);", "if (VAR_1 == 0)\nVAR_1 = 32;", "t1 = tcg_const_i32(VAR_1);", "t2 = tcg_const_i32(rS(VAR_0->opcode));", "gen_helper_stsw(cpu_env, t0, t1, t2);", "tcg_temp_free(t0);", "tcg_temp_free_i32(t1);", "tcg_temp_free_i32(t2);", "}" ]
[ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21, 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ] ]
24,173
static void bufp_alloc(USBRedirDevice *dev, uint8_t *data, int len, int status, uint8_t ep) { 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_malloc(sizeof(struct buf_packet)); bufp->data = data; bufp->len = len; bufp->status = status; QTAILQ_INSERT_TAIL(&dev->endpoint[EP2I(ep)].bufpq, bufp, next); dev->endpoint[EP2I(ep)].bufpq_size++; }
true
qemu
b2d1fe67d09d2b6c7da647fbcea6ca0148c206d3
static void bufp_alloc(USBRedirDevice *dev, uint8_t *data, int len, int status, uint8_t ep) { 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_malloc(sizeof(struct buf_packet)); bufp->data = data; bufp->len = len; bufp->status = status; 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, int len, int status, uint8_t ep)" ], "line_no": [ 1, 3 ] }
static void FUNC_0(USBRedirDevice *VAR_0, uint8_t *VAR_1, int VAR_2, int VAR_3, uint8_t VAR_4) { struct buf_packet *VAR_5; 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_5 = g_malloc(sizeof(struct buf_packet)); VAR_5->VAR_1 = VAR_1; VAR_5->VAR_2 = VAR_2; VAR_5->VAR_3 = VAR_3; QTAILQ_INSERT_TAIL(&VAR_0->endpoint[EP2I(VAR_4)].bufpq, VAR_5, next); VAR_0->endpoint[EP2I(VAR_4)].bufpq_size++; }
[ "static void FUNC_0(USBRedirDevice *VAR_0,\nuint8_t *VAR_1, int VAR_2, int VAR_3, uint8_t VAR_4)\n{", "struct buf_packet *VAR_5;", "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_5 = g_malloc(sizeof(struct buf_packet));", "VAR_5->VAR_1 = VAR_1;", "VAR_5->VAR_2 = VAR_2;", "VAR_5->VAR_3 = VAR_3;", "QTAILQ_INSERT_TAIL(&VAR_0->endpoint[EP2I(VAR_4)].bufpq, VAR_5, 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 ]
[ [ 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 ] ]
24,174
static int vmdk_open_vmfs_sparse(BlockDriverState *bs, BlockDriverState *file, int flags, Error **errp) { int ret; uint32_t magic; VMDK3Header header; VmdkExtent *extent; ret = bdrv_pread(file, sizeof(magic), &header, sizeof(header)); if (ret < 0) { error_setg_errno(errp, -ret, "Could not read header from file '%s'", file->filename); return ret; } ret = vmdk_add_extent(bs, file, false, le32_to_cpu(header.disk_sectors), le32_to_cpu(header.l1dir_offset) << 9, 0, le32_to_cpu(header.l1dir_size), 4096, le32_to_cpu(header.granularity), &extent, errp); if (ret < 0) { return ret; } ret = vmdk_init_tables(bs, extent, errp); if (ret) { /* free extent allocated by vmdk_add_extent */ vmdk_free_last_extent(bs); } return ret; }
true
qemu
7237aecd7e8fcc3ccf7fded77b6c127b4df5d3ac
static int vmdk_open_vmfs_sparse(BlockDriverState *bs, BlockDriverState *file, int flags, Error **errp) { int ret; uint32_t magic; VMDK3Header header; VmdkExtent *extent; ret = bdrv_pread(file, sizeof(magic), &header, sizeof(header)); if (ret < 0) { error_setg_errno(errp, -ret, "Could not read header from file '%s'", file->filename); return ret; } ret = vmdk_add_extent(bs, file, false, le32_to_cpu(header.disk_sectors), le32_to_cpu(header.l1dir_offset) << 9, 0, le32_to_cpu(header.l1dir_size), 4096, le32_to_cpu(header.granularity), &extent, errp); if (ret < 0) { return ret; } ret = vmdk_init_tables(bs, extent, errp); if (ret) { vmdk_free_last_extent(bs); } return ret; }
{ "code": [ " le32_to_cpu(header.l1dir_offset) << 9," ], "line_no": [ 37 ] }
static int FUNC_0(BlockDriverState *VAR_0, BlockDriverState *VAR_1, int VAR_2, Error **VAR_3) { int VAR_4; uint32_t magic; VMDK3Header header; VmdkExtent *extent; VAR_4 = bdrv_pread(VAR_1, sizeof(magic), &header, sizeof(header)); if (VAR_4 < 0) { error_setg_errno(VAR_3, -VAR_4, "Could not read header from VAR_1 '%s'", VAR_1->filename); return VAR_4; } VAR_4 = vmdk_add_extent(VAR_0, VAR_1, false, le32_to_cpu(header.disk_sectors), le32_to_cpu(header.l1dir_offset) << 9, 0, le32_to_cpu(header.l1dir_size), 4096, le32_to_cpu(header.granularity), &extent, VAR_3); if (VAR_4 < 0) { return VAR_4; } VAR_4 = vmdk_init_tables(VAR_0, extent, VAR_3); if (VAR_4) { vmdk_free_last_extent(VAR_0); } return VAR_4; }
[ "static int FUNC_0(BlockDriverState *VAR_0,\nBlockDriverState *VAR_1,\nint VAR_2, Error **VAR_3)\n{", "int VAR_4;", "uint32_t magic;", "VMDK3Header header;", "VmdkExtent *extent;", "VAR_4 = bdrv_pread(VAR_1, sizeof(magic), &header, sizeof(header));", "if (VAR_4 < 0) {", "error_setg_errno(VAR_3, -VAR_4,\n\"Could not read header from VAR_1 '%s'\",\nVAR_1->filename);", "return VAR_4;", "}", "VAR_4 = vmdk_add_extent(VAR_0, VAR_1, false,\nle32_to_cpu(header.disk_sectors),\nle32_to_cpu(header.l1dir_offset) << 9,\n0,\nle32_to_cpu(header.l1dir_size),\n4096,\nle32_to_cpu(header.granularity),\n&extent,\nVAR_3);", "if (VAR_4 < 0) {", "return VAR_4;", "}", "VAR_4 = vmdk_init_tables(VAR_0, extent, VAR_3);", "if (VAR_4) {", "vmdk_free_last_extent(VAR_0);", "}", "return VAR_4;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23, 25, 27 ], [ 29 ], [ 31 ], [ 33, 35, 37, 39, 41, 43, 45, 47, 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ] ]
24,175
static int au_write_header(AVFormatContext *s) { AVIOContext *pb = s->pb; AVCodecContext *enc = s->streams[0]->codec; if (!enc->codec_tag) return AVERROR(EINVAL); ffio_wfourcc(pb, ".snd"); /* magic number */ avio_wb32(pb, AU_HEADER_SIZE); /* header size */ avio_wb32(pb, AU_UNKNOWN_SIZE); /* data size */ avio_wb32(pb, enc->codec_tag); /* codec ID */ avio_wb32(pb, enc->sample_rate); avio_wb32(pb, enc->channels); avio_wb64(pb, 0); /* annotation field */ avio_flush(pb); return 0; }
true
FFmpeg
0dcfccaa691bf533b0f144b6d98b49eb59f1f3ab
static int au_write_header(AVFormatContext *s) { AVIOContext *pb = s->pb; AVCodecContext *enc = s->streams[0]->codec; if (!enc->codec_tag) return AVERROR(EINVAL); ffio_wfourcc(pb, ".snd"); avio_wb32(pb, AU_HEADER_SIZE); avio_wb32(pb, AU_UNKNOWN_SIZE); avio_wb32(pb, enc->codec_tag); avio_wb32(pb, enc->sample_rate); avio_wb32(pb, enc->channels); avio_wb64(pb, 0); avio_flush(pb); return 0; }
{ "code": [ " if (!enc->codec_tag)" ], "line_no": [ 11 ] }
static int FUNC_0(AVFormatContext *VAR_0) { AVIOContext *pb = VAR_0->pb; AVCodecContext *enc = VAR_0->streams[0]->codec; if (!enc->codec_tag) return AVERROR(EINVAL); ffio_wfourcc(pb, ".snd"); avio_wb32(pb, AU_HEADER_SIZE); avio_wb32(pb, AU_UNKNOWN_SIZE); avio_wb32(pb, enc->codec_tag); avio_wb32(pb, enc->sample_rate); avio_wb32(pb, enc->channels); avio_wb64(pb, 0); avio_flush(pb); return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0)\n{", "AVIOContext *pb = VAR_0->pb;", "AVCodecContext *enc = VAR_0->streams[0]->codec;", "if (!enc->codec_tag)\nreturn AVERROR(EINVAL);", "ffio_wfourcc(pb, \".snd\");", "avio_wb32(pb, AU_HEADER_SIZE);", "avio_wb32(pb, AU_UNKNOWN_SIZE);", "avio_wb32(pb, enc->codec_tag);", "avio_wb32(pb, enc->sample_rate);", "avio_wb32(pb, enc->channels);", "avio_wb64(pb, 0);", "avio_flush(pb);", "return 0;", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11, 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ] ]
24,176
static ssize_t nbd_co_receive_request(NBDRequest *req, struct nbd_request *request) { NBDClient *client = req->client; int csock = client->sock; ssize_t rc; client->recv_coroutine = qemu_coroutine_self(); if (nbd_receive_request(csock, request) == -1) { rc = -EIO; goto out; } if (request->len > NBD_BUFFER_SIZE) { LOG("len (%u) is larger than max len (%u)", request->len, NBD_BUFFER_SIZE); rc = -EINVAL; goto out; } if ((request->from + request->len) < request->from) { LOG("integer overflow detected! " "you're probably being attacked"); rc = -EINVAL; goto out; } TRACE("Decoding type"); if ((request->type & NBD_CMD_MASK_COMMAND) == NBD_CMD_WRITE) { TRACE("Reading %u byte(s)", request->len); if (qemu_co_recv(csock, req->data, request->len) != request->len) { LOG("reading from socket failed"); rc = -EIO; goto out; } } rc = 0; out: client->recv_coroutine = NULL; return rc; }
false
qemu
fc19f8a02e45c4d8ad24dd7eb374330b03dfc28e
static ssize_t nbd_co_receive_request(NBDRequest *req, struct nbd_request *request) { NBDClient *client = req->client; int csock = client->sock; ssize_t rc; client->recv_coroutine = qemu_coroutine_self(); if (nbd_receive_request(csock, request) == -1) { rc = -EIO; goto out; } if (request->len > NBD_BUFFER_SIZE) { LOG("len (%u) is larger than max len (%u)", request->len, NBD_BUFFER_SIZE); rc = -EINVAL; goto out; } if ((request->from + request->len) < request->from) { LOG("integer overflow detected! " "you're probably being attacked"); rc = -EINVAL; goto out; } TRACE("Decoding type"); if ((request->type & NBD_CMD_MASK_COMMAND) == NBD_CMD_WRITE) { TRACE("Reading %u byte(s)", request->len); if (qemu_co_recv(csock, req->data, request->len) != request->len) { LOG("reading from socket failed"); rc = -EIO; goto out; } } rc = 0; out: client->recv_coroutine = NULL; return rc; }
{ "code": [], "line_no": [] }
static ssize_t FUNC_0(NBDRequest *req, struct nbd_request *request) { NBDClient *client = req->client; int VAR_0 = client->sock; ssize_t rc; client->recv_coroutine = qemu_coroutine_self(); if (nbd_receive_request(VAR_0, request) == -1) { rc = -EIO; goto out; } if (request->len > NBD_BUFFER_SIZE) { LOG("len (%u) is larger than max len (%u)", request->len, NBD_BUFFER_SIZE); rc = -EINVAL; goto out; } if ((request->from + request->len) < request->from) { LOG("integer overflow detected! " "you're probably being attacked"); rc = -EINVAL; goto out; } TRACE("Decoding type"); if ((request->type & NBD_CMD_MASK_COMMAND) == NBD_CMD_WRITE) { TRACE("Reading %u byte(s)", request->len); if (qemu_co_recv(VAR_0, req->data, request->len) != request->len) { LOG("reading from socket failed"); rc = -EIO; goto out; } } rc = 0; out: client->recv_coroutine = NULL; return rc; }
[ "static ssize_t FUNC_0(NBDRequest *req, struct nbd_request *request)\n{", "NBDClient *client = req->client;", "int VAR_0 = client->sock;", "ssize_t rc;", "client->recv_coroutine = qemu_coroutine_self();", "if (nbd_receive_request(VAR_0, request) == -1) {", "rc = -EIO;", "goto out;", "}", "if (request->len > NBD_BUFFER_SIZE) {", "LOG(\"len (%u) is larger than max len (%u)\",\nrequest->len, NBD_BUFFER_SIZE);", "rc = -EINVAL;", "goto out;", "}", "if ((request->from + request->len) < request->from) {", "LOG(\"integer overflow detected! \"\n\"you're probably being attacked\");", "rc = -EINVAL;", "goto out;", "}", "TRACE(\"Decoding type\");", "if ((request->type & NBD_CMD_MASK_COMMAND) == NBD_CMD_WRITE) {", "TRACE(\"Reading %u byte(s)\", request->len);", "if (qemu_co_recv(VAR_0, req->data, request->len) != request->len) {", "LOG(\"reading from socket failed\");", "rc = -EIO;", "goto out;", "}", "}", "rc = 0;", "out:\nclient->recv_coroutine = NULL;", "return rc;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 27, 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41, 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79, 81 ], [ 83 ], [ 85 ] ]
24,177
static int pci_vga_initfn(PCIDevice *dev) { PCIVGAState *d = DO_UPCAST(PCIVGAState, dev, dev); VGACommonState *s = &d->vga; uint8_t *pci_conf = d->dev.config; // vga + console init vga_common_init(s, VGA_RAM_SIZE); vga_init(s); s->ds = graphic_console_init(s->update, s->invalidate, s->screen_dump, s->text_update, s); // dummy VGA (same as Bochs ID) pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_QEMU); pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_QEMU_VGA); pci_config_set_class(pci_conf, PCI_CLASS_DISPLAY_VGA); /* XXX: VGA_RAM_SIZE must be a power of two */ pci_register_bar(&d->dev, 0, VGA_RAM_SIZE, PCI_BASE_ADDRESS_MEM_PREFETCH, vga_map); if (!dev->rom_bar) { /* compatibility with pc-0.13 and older */ vga_init_vbe(s); } return 0; }
false
qemu
32902772833dbe424f754d5b841d996b90be87b2
static int pci_vga_initfn(PCIDevice *dev) { PCIVGAState *d = DO_UPCAST(PCIVGAState, dev, dev); VGACommonState *s = &d->vga; uint8_t *pci_conf = d->dev.config; vga_common_init(s, VGA_RAM_SIZE); vga_init(s); s->ds = graphic_console_init(s->update, s->invalidate, s->screen_dump, s->text_update, s); pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_QEMU); pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_QEMU_VGA); pci_config_set_class(pci_conf, PCI_CLASS_DISPLAY_VGA); pci_register_bar(&d->dev, 0, VGA_RAM_SIZE, PCI_BASE_ADDRESS_MEM_PREFETCH, vga_map); if (!dev->rom_bar) { vga_init_vbe(s); } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(PCIDevice *VAR_0) { PCIVGAState *d = DO_UPCAST(PCIVGAState, VAR_0, VAR_0); VGACommonState *s = &d->vga; uint8_t *pci_conf = d->VAR_0.config; vga_common_init(s, VGA_RAM_SIZE); vga_init(s); s->ds = graphic_console_init(s->update, s->invalidate, s->screen_dump, s->text_update, s); pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_QEMU); pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_QEMU_VGA); pci_config_set_class(pci_conf, PCI_CLASS_DISPLAY_VGA); pci_register_bar(&d->VAR_0, 0, VGA_RAM_SIZE, PCI_BASE_ADDRESS_MEM_PREFETCH, vga_map); if (!VAR_0->rom_bar) { vga_init_vbe(s); } return 0; }
[ "static int FUNC_0(PCIDevice *VAR_0)\n{", "PCIVGAState *d = DO_UPCAST(PCIVGAState, VAR_0, VAR_0);", "VGACommonState *s = &d->vga;", "uint8_t *pci_conf = d->VAR_0.config;", "vga_common_init(s, VGA_RAM_SIZE);", "vga_init(s);", "s->ds = graphic_console_init(s->update, s->invalidate,\ns->screen_dump, s->text_update, s);", "pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_QEMU);", "pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_QEMU_VGA);", "pci_config_set_class(pci_conf, PCI_CLASS_DISPLAY_VGA);", "pci_register_bar(&d->VAR_0, 0, VGA_RAM_SIZE,\nPCI_BASE_ADDRESS_MEM_PREFETCH, vga_map);", "if (!VAR_0->rom_bar) {", "vga_init_vbe(s);", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 15 ], [ 17 ], [ 21, 23 ], [ 29 ], [ 31 ], [ 33 ], [ 39, 41 ], [ 45 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ] ]
24,178
void portio_list_add(PortioList *piolist, MemoryRegion *address_space, uint32_t start) { const MemoryRegionPortio *pio, *pio_start = piolist->ports; unsigned int off_low, off_high, off_last, count; piolist->address_space = address_space; /* Handle the first entry specially. */ off_last = off_low = pio_start->offset; off_high = off_low + pio_start->len; count = 1; for (pio = pio_start + 1; pio->size != 0; pio++, count++) { /* All entries must be sorted by offset. */ assert(pio->offset >= off_last); off_last = pio->offset; /* If we see a hole, break the region. */ if (off_last > off_high) { portio_list_add_1(piolist, pio_start, count, start, off_low, off_high); /* ... and start collecting anew. */ pio_start = pio; off_low = off_last; off_high = off_low + pio->len; count = 0; } else if (off_last + pio->len > off_high) { off_high = off_last + pio->len; } } /* There will always be an open sub-list. */ portio_list_add_1(piolist, pio_start, count, start, off_low, off_high); }
false
qemu
4080a13c11398d684668d286da27b6f8ee668e44
void portio_list_add(PortioList *piolist, MemoryRegion *address_space, uint32_t start) { const MemoryRegionPortio *pio, *pio_start = piolist->ports; unsigned int off_low, off_high, off_last, count; piolist->address_space = address_space; off_last = off_low = pio_start->offset; off_high = off_low + pio_start->len; count = 1; for (pio = pio_start + 1; pio->size != 0; pio++, count++) { assert(pio->offset >= off_last); off_last = pio->offset; if (off_last > off_high) { portio_list_add_1(piolist, pio_start, count, start, off_low, off_high); pio_start = pio; off_low = off_last; off_high = off_low + pio->len; count = 0; } else if (off_last + pio->len > off_high) { off_high = off_last + pio->len; } } portio_list_add_1(piolist, pio_start, count, start, off_low, off_high); }
{ "code": [], "line_no": [] }
void FUNC_0(PortioList *VAR_0, MemoryRegion *VAR_1, uint32_t VAR_2) { const MemoryRegionPortio *VAR_3, *pio_start = VAR_0->ports; unsigned int VAR_4, VAR_5, VAR_6, VAR_7; VAR_0->VAR_1 = VAR_1; VAR_6 = VAR_4 = pio_start->offset; VAR_5 = VAR_4 + pio_start->len; VAR_7 = 1; for (VAR_3 = pio_start + 1; VAR_3->size != 0; VAR_3++, VAR_7++) { assert(VAR_3->offset >= VAR_6); VAR_6 = VAR_3->offset; if (VAR_6 > VAR_5) { portio_list_add_1(VAR_0, pio_start, VAR_7, VAR_2, VAR_4, VAR_5); pio_start = VAR_3; VAR_4 = VAR_6; VAR_5 = VAR_4 + VAR_3->len; VAR_7 = 0; } else if (VAR_6 + VAR_3->len > VAR_5) { VAR_5 = VAR_6 + VAR_3->len; } } portio_list_add_1(VAR_0, pio_start, VAR_7, VAR_2, VAR_4, VAR_5); }
[ "void FUNC_0(PortioList *VAR_0,\nMemoryRegion *VAR_1,\nuint32_t VAR_2)\n{", "const MemoryRegionPortio *VAR_3, *pio_start = VAR_0->ports;", "unsigned int VAR_4, VAR_5, VAR_6, VAR_7;", "VAR_0->VAR_1 = VAR_1;", "VAR_6 = VAR_4 = pio_start->offset;", "VAR_5 = VAR_4 + pio_start->len;", "VAR_7 = 1;", "for (VAR_3 = pio_start + 1; VAR_3->size != 0; VAR_3++, VAR_7++) {", "assert(VAR_3->offset >= VAR_6);", "VAR_6 = VAR_3->offset;", "if (VAR_6 > VAR_5) {", "portio_list_add_1(VAR_0, pio_start, VAR_7, VAR_2, VAR_4,\nVAR_5);", "pio_start = VAR_3;", "VAR_4 = VAR_6;", "VAR_5 = VAR_4 + VAR_3->len;", "VAR_7 = 0;", "} else if (VAR_6 + VAR_3->len > VAR_5) {", "VAR_5 = VAR_6 + VAR_3->len;", "}", "}", "portio_list_add_1(VAR_0, pio_start, VAR_7, VAR_2, VAR_4, 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 ], [ 11 ], [ 15 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 33 ], [ 35 ], [ 41 ], [ 43, 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 69 ], [ 71 ] ]
24,180
void qemu_console_resize(QEMUConsole *console, int width, int height) { if (console->g_width != width || console->g_height != height) { console->g_width = width; console->g_height = height; if (active_console == console) { dpy_resize(console->ds, width, height); } } }
false
qemu
3bba22de7cb9631452dad492c907affce6a69a3b
void qemu_console_resize(QEMUConsole *console, int width, int height) { if (console->g_width != width || console->g_height != height) { console->g_width = width; console->g_height = height; if (active_console == console) { dpy_resize(console->ds, width, height); } } }
{ "code": [], "line_no": [] }
void FUNC_0(QEMUConsole *VAR_0, int VAR_1, int VAR_2) { if (VAR_0->g_width != VAR_1 || VAR_0->g_height != VAR_2) { VAR_0->g_width = VAR_1; VAR_0->g_height = VAR_2; if (active_console == VAR_0) { dpy_resize(VAR_0->ds, VAR_1, VAR_2); } } }
[ "void FUNC_0(QEMUConsole *VAR_0, int VAR_1, int VAR_2)\n{", "if (VAR_0->g_width != VAR_1 || VAR_0->g_height != VAR_2) {", "VAR_0->g_width = VAR_1;", "VAR_0->g_height = VAR_2;", "if (active_console == VAR_0) {", "dpy_resize(VAR_0->ds, VAR_1, VAR_2);", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ] ]
24,181
static void coroutine_fn bdrv_get_block_status_co_entry(void *opaque) { BdrvCoGetBlockStatusData *data = opaque; BlockDriverState *bs = data->bs; data->ret = bdrv_co_get_block_status(bs, data->sector_num, data->nb_sectors, data->pnum); data->done = true; }
false
qemu
61007b316cd71ee7333ff7a0a749a8949527575f
static void coroutine_fn bdrv_get_block_status_co_entry(void *opaque) { BdrvCoGetBlockStatusData *data = opaque; BlockDriverState *bs = data->bs; data->ret = bdrv_co_get_block_status(bs, data->sector_num, data->nb_sectors, data->pnum); data->done = true; }
{ "code": [], "line_no": [] }
static void VAR_0 bdrv_get_block_status_co_entry(void *opaque) { BdrvCoGetBlockStatusData *data = opaque; BlockDriverState *bs = data->bs; data->ret = bdrv_co_get_block_status(bs, data->sector_num, data->nb_sectors, data->pnum); data->done = true; }
[ "static void VAR_0 bdrv_get_block_status_co_entry(void *opaque)\n{", "BdrvCoGetBlockStatusData *data = opaque;", "BlockDriverState *bs = data->bs;", "data->ret = bdrv_co_get_block_status(bs, data->sector_num, data->nb_sectors,\ndata->pnum);", "data->done = true;", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11, 13 ], [ 15 ], [ 17 ] ]
24,182
static int process_cc608(CCaptionSubContext *ctx, int64_t pts, uint8_t hi, uint8_t lo) { int ret = 0; #define COR3(var, with1, with2, with3) ( (var) == (with1) || (var) == (with2) || (var) == (with3) ) if ( hi == ctx->prev_cmd[0] && lo == ctx->prev_cmd[1]) { /* ignore redundant command */ } else if ( (hi == 0x10 && (lo >= 0x40 || lo <= 0x5f)) || ( (hi >= 0x11 && hi <= 0x17) && (lo >= 0x40 && lo <= 0x7f) ) ) { handle_pac(ctx, hi, lo); } else if ( ( hi == 0x11 && lo >= 0x20 && lo <= 0x2f ) || ( hi == 0x17 && lo >= 0x2e && lo <= 0x2f) ) { handle_textattr(ctx, hi, lo); } else if ( COR3(hi, 0x14, 0x15, 0x1C) && lo == 0x20 ) { /* resume caption loading */ ctx->mode = CCMODE_POPON; } else if ( COR3(hi, 0x14, 0x15, 0x1C) && lo == 0x24 ) { handle_delete_end_of_row(ctx, hi, lo); } else if ( COR3(hi, 0x14, 0x15, 0x1C) && lo == 0x25 ) { ctx->rollup = 2; ctx->mode = CCMODE_ROLLUP_2; } else if ( COR3(hi, 0x14, 0x15, 0x1C) && lo == 0x26 ) { ctx->rollup = 3; ctx->mode = CCMODE_ROLLUP_3; } else if ( COR3(hi, 0x14, 0x15, 0x1C) && lo == 0x27 ) { ctx->rollup = 4; ctx->mode = CCMODE_ROLLUP_4; } else if ( COR3(hi, 0x14, 0x15, 0x1C) && lo == 0x29 ) { /* resume direct captioning */ ctx->mode = CCMODE_PAINTON; } else if ( COR3(hi, 0x14, 0x15, 0x1C) && lo == 0x2B ) { /* resume text display */ ctx->mode = CCMODE_TEXT; } else if ( COR3(hi, 0x14, 0x15, 0x1C) && lo == 0x2C ) { /* erase display memory */ ret = handle_edm(ctx, pts); } else if ( COR3(hi, 0x14, 0x15, 0x1C) && lo == 0x2D ) { /* carriage return */ av_dlog(ctx, "carriage return\n"); reap_screen(ctx, pts); roll_up(ctx); ctx->screen_changed = 1; ctx->cursor_column = 0; } else if ( COR3(hi, 0x14, 0x15, 0x1C) && lo == 0x2F ) { /* end of caption */ av_dlog(ctx, "handle_eoc\n"); ret = handle_eoc(ctx, pts); } else if (hi>=0x20) { /* Standard characters (always in pairs) */ handle_char(ctx, hi, lo, pts); } else { /* Ignoring all other non data code */ av_dlog(ctx, "Unknown command 0x%hhx 0x%hhx\n", hi, lo); } /* set prev command */ ctx->prev_cmd[0] = hi; ctx->prev_cmd[1] = lo; #undef COR3 return ret; }
false
FFmpeg
229843aa359ae0c9519977d7fa952688db63f559
static int process_cc608(CCaptionSubContext *ctx, int64_t pts, uint8_t hi, uint8_t lo) { int ret = 0; #define COR3(var, with1, with2, with3) ( (var) == (with1) || (var) == (with2) || (var) == (with3) ) if ( hi == ctx->prev_cmd[0] && lo == ctx->prev_cmd[1]) { } else if ( (hi == 0x10 && (lo >= 0x40 || lo <= 0x5f)) || ( (hi >= 0x11 && hi <= 0x17) && (lo >= 0x40 && lo <= 0x7f) ) ) { handle_pac(ctx, hi, lo); } else if ( ( hi == 0x11 && lo >= 0x20 && lo <= 0x2f ) || ( hi == 0x17 && lo >= 0x2e && lo <= 0x2f) ) { handle_textattr(ctx, hi, lo); } else if ( COR3(hi, 0x14, 0x15, 0x1C) && lo == 0x20 ) { ctx->mode = CCMODE_POPON; } else if ( COR3(hi, 0x14, 0x15, 0x1C) && lo == 0x24 ) { handle_delete_end_of_row(ctx, hi, lo); } else if ( COR3(hi, 0x14, 0x15, 0x1C) && lo == 0x25 ) { ctx->rollup = 2; ctx->mode = CCMODE_ROLLUP_2; } else if ( COR3(hi, 0x14, 0x15, 0x1C) && lo == 0x26 ) { ctx->rollup = 3; ctx->mode = CCMODE_ROLLUP_3; } else if ( COR3(hi, 0x14, 0x15, 0x1C) && lo == 0x27 ) { ctx->rollup = 4; ctx->mode = CCMODE_ROLLUP_4; } else if ( COR3(hi, 0x14, 0x15, 0x1C) && lo == 0x29 ) { ctx->mode = CCMODE_PAINTON; } else if ( COR3(hi, 0x14, 0x15, 0x1C) && lo == 0x2B ) { ctx->mode = CCMODE_TEXT; } else if ( COR3(hi, 0x14, 0x15, 0x1C) && lo == 0x2C ) { ret = handle_edm(ctx, pts); } else if ( COR3(hi, 0x14, 0x15, 0x1C) && lo == 0x2D ) { av_dlog(ctx, "carriage return\n"); reap_screen(ctx, pts); roll_up(ctx); ctx->screen_changed = 1; ctx->cursor_column = 0; } else if ( COR3(hi, 0x14, 0x15, 0x1C) && lo == 0x2F ) { av_dlog(ctx, "handle_eoc\n"); ret = handle_eoc(ctx, pts); } else if (hi>=0x20) { handle_char(ctx, hi, lo, pts); } else { av_dlog(ctx, "Unknown command 0x%hhx 0x%hhx\n", hi, lo); } ctx->prev_cmd[0] = hi; ctx->prev_cmd[1] = lo; #undef COR3 return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(CCaptionSubContext *VAR_0, int64_t VAR_1, uint8_t VAR_2, uint8_t VAR_3) { int VAR_4 = 0; #define COR3(var, with1, with2, with3) ( (var) == (with1) || (var) == (with2) || (var) == (with3) ) if ( VAR_2 == VAR_0->prev_cmd[0] && VAR_3 == VAR_0->prev_cmd[1]) { } else if ( (VAR_2 == 0x10 && (VAR_3 >= 0x40 || VAR_3 <= 0x5f)) || ( (VAR_2 >= 0x11 && VAR_2 <= 0x17) && (VAR_3 >= 0x40 && VAR_3 <= 0x7f) ) ) { handle_pac(VAR_0, VAR_2, VAR_3); } else if ( ( VAR_2 == 0x11 && VAR_3 >= 0x20 && VAR_3 <= 0x2f ) || ( VAR_2 == 0x17 && VAR_3 >= 0x2e && VAR_3 <= 0x2f) ) { handle_textattr(VAR_0, VAR_2, VAR_3); } else if ( COR3(VAR_2, 0x14, 0x15, 0x1C) && VAR_3 == 0x20 ) { VAR_0->mode = CCMODE_POPON; } else if ( COR3(VAR_2, 0x14, 0x15, 0x1C) && VAR_3 == 0x24 ) { handle_delete_end_of_row(VAR_0, VAR_2, VAR_3); } else if ( COR3(VAR_2, 0x14, 0x15, 0x1C) && VAR_3 == 0x25 ) { VAR_0->rollup = 2; VAR_0->mode = CCMODE_ROLLUP_2; } else if ( COR3(VAR_2, 0x14, 0x15, 0x1C) && VAR_3 == 0x26 ) { VAR_0->rollup = 3; VAR_0->mode = CCMODE_ROLLUP_3; } else if ( COR3(VAR_2, 0x14, 0x15, 0x1C) && VAR_3 == 0x27 ) { VAR_0->rollup = 4; VAR_0->mode = CCMODE_ROLLUP_4; } else if ( COR3(VAR_2, 0x14, 0x15, 0x1C) && VAR_3 == 0x29 ) { VAR_0->mode = CCMODE_PAINTON; } else if ( COR3(VAR_2, 0x14, 0x15, 0x1C) && VAR_3 == 0x2B ) { VAR_0->mode = CCMODE_TEXT; } else if ( COR3(VAR_2, 0x14, 0x15, 0x1C) && VAR_3 == 0x2C ) { VAR_4 = handle_edm(VAR_0, VAR_1); } else if ( COR3(VAR_2, 0x14, 0x15, 0x1C) && VAR_3 == 0x2D ) { av_dlog(VAR_0, "carriage return\n"); reap_screen(VAR_0, VAR_1); roll_up(VAR_0); VAR_0->screen_changed = 1; VAR_0->cursor_column = 0; } else if ( COR3(VAR_2, 0x14, 0x15, 0x1C) && VAR_3 == 0x2F ) { av_dlog(VAR_0, "handle_eoc\n"); VAR_4 = handle_eoc(VAR_0, VAR_1); } else if (VAR_2>=0x20) { handle_char(VAR_0, VAR_2, VAR_3, VAR_1); } else { av_dlog(VAR_0, "Unknown command 0x%hhx 0x%hhx\n", VAR_2, VAR_3); } VAR_0->prev_cmd[0] = VAR_2; VAR_0->prev_cmd[1] = VAR_3; #undef COR3 return VAR_4; }
[ "static int FUNC_0(CCaptionSubContext *VAR_0, int64_t VAR_1, uint8_t VAR_2, uint8_t VAR_3)\n{", "int VAR_4 = 0;", "#define COR3(var, with1, with2, with3) ( (var) == (with1) || (var) == (with2) || (var) == (with3) )\nif ( VAR_2 == VAR_0->prev_cmd[0] && VAR_3 == VAR_0->prev_cmd[1]) {", "} else if ( (VAR_2 == 0x10 && (VAR_3 >= 0x40 || VAR_3 <= 0x5f)) ||", "( (VAR_2 >= 0x11 && VAR_2 <= 0x17) && (VAR_3 >= 0x40 && VAR_3 <= 0x7f) ) ) {", "handle_pac(VAR_0, VAR_2, VAR_3);", "} else if ( ( VAR_2 == 0x11 && VAR_3 >= 0x20 && VAR_3 <= 0x2f ) ||", "( VAR_2 == 0x17 && VAR_3 >= 0x2e && VAR_3 <= 0x2f) ) {", "handle_textattr(VAR_0, VAR_2, VAR_3);", "} else if ( COR3(VAR_2, 0x14, 0x15, 0x1C) && VAR_3 == 0x20 ) {", "VAR_0->mode = CCMODE_POPON;", "} else if ( COR3(VAR_2, 0x14, 0x15, 0x1C) && VAR_3 == 0x24 ) {", "handle_delete_end_of_row(VAR_0, VAR_2, VAR_3);", "} else if ( COR3(VAR_2, 0x14, 0x15, 0x1C) && VAR_3 == 0x25 ) {", "VAR_0->rollup = 2;", "VAR_0->mode = CCMODE_ROLLUP_2;", "} else if ( COR3(VAR_2, 0x14, 0x15, 0x1C) && VAR_3 == 0x26 ) {", "VAR_0->rollup = 3;", "VAR_0->mode = CCMODE_ROLLUP_3;", "} else if ( COR3(VAR_2, 0x14, 0x15, 0x1C) && VAR_3 == 0x27 ) {", "VAR_0->rollup = 4;", "VAR_0->mode = CCMODE_ROLLUP_4;", "} else if ( COR3(VAR_2, 0x14, 0x15, 0x1C) && VAR_3 == 0x29 ) {", "VAR_0->mode = CCMODE_PAINTON;", "} else if ( COR3(VAR_2, 0x14, 0x15, 0x1C) && VAR_3 == 0x2B ) {", "VAR_0->mode = CCMODE_TEXT;", "} else if ( COR3(VAR_2, 0x14, 0x15, 0x1C) && VAR_3 == 0x2C ) {", "VAR_4 = handle_edm(VAR_0, VAR_1);", "} else if ( COR3(VAR_2, 0x14, 0x15, 0x1C) && VAR_3 == 0x2D ) {", "av_dlog(VAR_0, \"carriage return\\n\");", "reap_screen(VAR_0, VAR_1);", "roll_up(VAR_0);", "VAR_0->screen_changed = 1;", "VAR_0->cursor_column = 0;", "} else if ( COR3(VAR_2, 0x14, 0x15, 0x1C) && VAR_3 == 0x2F ) {", "av_dlog(VAR_0, \"handle_eoc\\n\");", "VAR_4 = handle_eoc(VAR_0, VAR_1);", "} else if (VAR_2>=0x20) {", "handle_char(VAR_0, VAR_2, VAR_3, VAR_1);", "} else {", "av_dlog(VAR_0, \"Unknown command 0x%hhx 0x%hhx\\n\", VAR_2, VAR_3);", "}", "VAR_0->prev_cmd[0] = VAR_2;", "VAR_0->prev_cmd[1] = VAR_3;", "#undef COR3\nreturn VAR_4;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 89 ], [ 91 ], [ 93 ], [ 97 ], [ 99 ], [ 103 ], [ 105 ], [ 111 ], [ 113 ], [ 117, 119 ], [ 123 ] ]
24,183
static uint32_t vmsvga_value_read(void *opaque, uint32_t address) { uint32_t caps; struct vmsvga_state_s *s = opaque; switch (s->index) { case SVGA_REG_ID: return s->svgaid; case SVGA_REG_ENABLE: return s->enable; case SVGA_REG_WIDTH: return s->width; case SVGA_REG_HEIGHT: return s->height; case SVGA_REG_MAX_WIDTH: return SVGA_MAX_WIDTH; case SVGA_REG_MAX_HEIGHT: return SVGA_MAX_HEIGHT; case SVGA_REG_DEPTH: return s->depth; case SVGA_REG_BITS_PER_PIXEL: return (s->depth + 7) & ~7; case SVGA_REG_PSEUDOCOLOR: return 0x0; case SVGA_REG_RED_MASK: return s->wred; case SVGA_REG_GREEN_MASK: return s->wgreen; case SVGA_REG_BLUE_MASK: return s->wblue; case SVGA_REG_BYTES_PER_LINE: return ((s->depth + 7) >> 3) * s->new_width; case SVGA_REG_FB_START: { struct pci_vmsvga_state_s *pci_vmsvga = container_of(s, struct pci_vmsvga_state_s, chip); return pci_get_bar_addr(&pci_vmsvga->card, 1); } case SVGA_REG_FB_OFFSET: return 0x0; case SVGA_REG_VRAM_SIZE: return s->vga.vram_size; case SVGA_REG_FB_SIZE: return s->fb_size; case SVGA_REG_CAPABILITIES: caps = SVGA_CAP_NONE; #ifdef HW_RECT_ACCEL caps |= SVGA_CAP_RECT_COPY; #endif #ifdef HW_FILL_ACCEL caps |= SVGA_CAP_RECT_FILL; #endif #ifdef HW_MOUSE_ACCEL if (dpy_cursor_define_supported(s->vga.ds)) { caps |= SVGA_CAP_CURSOR | SVGA_CAP_CURSOR_BYPASS_2 | SVGA_CAP_CURSOR_BYPASS; } #endif return caps; case SVGA_REG_MEM_START: { struct pci_vmsvga_state_s *pci_vmsvga = container_of(s, struct pci_vmsvga_state_s, chip); return pci_get_bar_addr(&pci_vmsvga->card, 2); } case SVGA_REG_MEM_SIZE: return s->fifo_size; case SVGA_REG_CONFIG_DONE: return s->config; case SVGA_REG_SYNC: case SVGA_REG_BUSY: return s->syncing; case SVGA_REG_GUEST_ID: return s->guest; case SVGA_REG_CURSOR_ID: return s->cursor.id; case SVGA_REG_CURSOR_X: return s->cursor.x; case SVGA_REG_CURSOR_Y: return s->cursor.x; case SVGA_REG_CURSOR_ON: return s->cursor.on; case SVGA_REG_HOST_BITS_PER_PIXEL: return (s->depth + 7) & ~7; case SVGA_REG_SCRATCH_SIZE: return s->scratch_size; case SVGA_REG_MEM_REGS: case SVGA_REG_NUM_DISPLAYS: case SVGA_REG_PITCHLOCK: case SVGA_PALETTE_BASE ... SVGA_PALETTE_END: return 0; default: if (s->index >= SVGA_SCRATCH_BASE && s->index < SVGA_SCRATCH_BASE + s->scratch_size) return s->scratch[s->index - SVGA_SCRATCH_BASE]; printf("%s: Bad register %02x\n", __FUNCTION__, s->index); } return 0; }
false
qemu
0d7937974cd0504f30ad483c3368b21da426ddf9
static uint32_t vmsvga_value_read(void *opaque, uint32_t address) { uint32_t caps; struct vmsvga_state_s *s = opaque; switch (s->index) { case SVGA_REG_ID: return s->svgaid; case SVGA_REG_ENABLE: return s->enable; case SVGA_REG_WIDTH: return s->width; case SVGA_REG_HEIGHT: return s->height; case SVGA_REG_MAX_WIDTH: return SVGA_MAX_WIDTH; case SVGA_REG_MAX_HEIGHT: return SVGA_MAX_HEIGHT; case SVGA_REG_DEPTH: return s->depth; case SVGA_REG_BITS_PER_PIXEL: return (s->depth + 7) & ~7; case SVGA_REG_PSEUDOCOLOR: return 0x0; case SVGA_REG_RED_MASK: return s->wred; case SVGA_REG_GREEN_MASK: return s->wgreen; case SVGA_REG_BLUE_MASK: return s->wblue; case SVGA_REG_BYTES_PER_LINE: return ((s->depth + 7) >> 3) * s->new_width; case SVGA_REG_FB_START: { struct pci_vmsvga_state_s *pci_vmsvga = container_of(s, struct pci_vmsvga_state_s, chip); return pci_get_bar_addr(&pci_vmsvga->card, 1); } case SVGA_REG_FB_OFFSET: return 0x0; case SVGA_REG_VRAM_SIZE: return s->vga.vram_size; case SVGA_REG_FB_SIZE: return s->fb_size; case SVGA_REG_CAPABILITIES: caps = SVGA_CAP_NONE; #ifdef HW_RECT_ACCEL caps |= SVGA_CAP_RECT_COPY; #endif #ifdef HW_FILL_ACCEL caps |= SVGA_CAP_RECT_FILL; #endif #ifdef HW_MOUSE_ACCEL if (dpy_cursor_define_supported(s->vga.ds)) { caps |= SVGA_CAP_CURSOR | SVGA_CAP_CURSOR_BYPASS_2 | SVGA_CAP_CURSOR_BYPASS; } #endif return caps; case SVGA_REG_MEM_START: { struct pci_vmsvga_state_s *pci_vmsvga = container_of(s, struct pci_vmsvga_state_s, chip); return pci_get_bar_addr(&pci_vmsvga->card, 2); } case SVGA_REG_MEM_SIZE: return s->fifo_size; case SVGA_REG_CONFIG_DONE: return s->config; case SVGA_REG_SYNC: case SVGA_REG_BUSY: return s->syncing; case SVGA_REG_GUEST_ID: return s->guest; case SVGA_REG_CURSOR_ID: return s->cursor.id; case SVGA_REG_CURSOR_X: return s->cursor.x; case SVGA_REG_CURSOR_Y: return s->cursor.x; case SVGA_REG_CURSOR_ON: return s->cursor.on; case SVGA_REG_HOST_BITS_PER_PIXEL: return (s->depth + 7) & ~7; case SVGA_REG_SCRATCH_SIZE: return s->scratch_size; case SVGA_REG_MEM_REGS: case SVGA_REG_NUM_DISPLAYS: case SVGA_REG_PITCHLOCK: case SVGA_PALETTE_BASE ... SVGA_PALETTE_END: return 0; default: if (s->index >= SVGA_SCRATCH_BASE && s->index < SVGA_SCRATCH_BASE + s->scratch_size) return s->scratch[s->index - SVGA_SCRATCH_BASE]; printf("%s: Bad register %02x\n", __FUNCTION__, s->index); } return 0; }
{ "code": [], "line_no": [] }
static uint32_t FUNC_0(void *opaque, uint32_t address) { uint32_t caps; struct vmsvga_state_s *VAR_0 = opaque; switch (VAR_0->index) { case SVGA_REG_ID: return VAR_0->svgaid; case SVGA_REG_ENABLE: return VAR_0->enable; case SVGA_REG_WIDTH: return VAR_0->width; case SVGA_REG_HEIGHT: return VAR_0->height; case SVGA_REG_MAX_WIDTH: return SVGA_MAX_WIDTH; case SVGA_REG_MAX_HEIGHT: return SVGA_MAX_HEIGHT; case SVGA_REG_DEPTH: return VAR_0->depth; case SVGA_REG_BITS_PER_PIXEL: return (VAR_0->depth + 7) & ~7; case SVGA_REG_PSEUDOCOLOR: return 0x0; case SVGA_REG_RED_MASK: return VAR_0->wred; case SVGA_REG_GREEN_MASK: return VAR_0->wgreen; case SVGA_REG_BLUE_MASK: return VAR_0->wblue; case SVGA_REG_BYTES_PER_LINE: return ((VAR_0->depth + 7) >> 3) * VAR_0->new_width; case SVGA_REG_FB_START: { struct pci_vmsvga_state_s *VAR_2 = container_of(VAR_0, struct pci_vmsvga_state_s, chip); return pci_get_bar_addr(&VAR_2->card, 1); } case SVGA_REG_FB_OFFSET: return 0x0; case SVGA_REG_VRAM_SIZE: return VAR_0->vga.vram_size; case SVGA_REG_FB_SIZE: return VAR_0->fb_size; case SVGA_REG_CAPABILITIES: caps = SVGA_CAP_NONE; #ifdef HW_RECT_ACCEL caps |= SVGA_CAP_RECT_COPY; #endif #ifdef HW_FILL_ACCEL caps |= SVGA_CAP_RECT_FILL; #endif #ifdef HW_MOUSE_ACCEL if (dpy_cursor_define_supported(VAR_0->vga.ds)) { caps |= SVGA_CAP_CURSOR | SVGA_CAP_CURSOR_BYPASS_2 | SVGA_CAP_CURSOR_BYPASS; } #endif return caps; case SVGA_REG_MEM_START: { struct pci_vmsvga_state_s *VAR_2 = container_of(VAR_0, struct pci_vmsvga_state_s, chip); return pci_get_bar_addr(&VAR_2->card, 2); } case SVGA_REG_MEM_SIZE: return VAR_0->fifo_size; case SVGA_REG_CONFIG_DONE: return VAR_0->config; case SVGA_REG_SYNC: case SVGA_REG_BUSY: return VAR_0->syncing; case SVGA_REG_GUEST_ID: return VAR_0->guest; case SVGA_REG_CURSOR_ID: return VAR_0->cursor.id; case SVGA_REG_CURSOR_X: return VAR_0->cursor.x; case SVGA_REG_CURSOR_Y: return VAR_0->cursor.x; case SVGA_REG_CURSOR_ON: return VAR_0->cursor.on; case SVGA_REG_HOST_BITS_PER_PIXEL: return (VAR_0->depth + 7) & ~7; case SVGA_REG_SCRATCH_SIZE: return VAR_0->scratch_size; case SVGA_REG_MEM_REGS: case SVGA_REG_NUM_DISPLAYS: case SVGA_REG_PITCHLOCK: case SVGA_PALETTE_BASE ... SVGA_PALETTE_END: return 0; default: if (VAR_0->index >= SVGA_SCRATCH_BASE && VAR_0->index < SVGA_SCRATCH_BASE + VAR_0->scratch_size) return VAR_0->scratch[VAR_0->index - SVGA_SCRATCH_BASE]; printf("%VAR_0: Bad register %02x\n", __FUNCTION__, VAR_0->index); } return 0; }
[ "static uint32_t FUNC_0(void *opaque, uint32_t address)\n{", "uint32_t caps;", "struct vmsvga_state_s *VAR_0 = opaque;", "switch (VAR_0->index) {", "case SVGA_REG_ID:\nreturn VAR_0->svgaid;", "case SVGA_REG_ENABLE:\nreturn VAR_0->enable;", "case SVGA_REG_WIDTH:\nreturn VAR_0->width;", "case SVGA_REG_HEIGHT:\nreturn VAR_0->height;", "case SVGA_REG_MAX_WIDTH:\nreturn SVGA_MAX_WIDTH;", "case SVGA_REG_MAX_HEIGHT:\nreturn SVGA_MAX_HEIGHT;", "case SVGA_REG_DEPTH:\nreturn VAR_0->depth;", "case SVGA_REG_BITS_PER_PIXEL:\nreturn (VAR_0->depth + 7) & ~7;", "case SVGA_REG_PSEUDOCOLOR:\nreturn 0x0;", "case SVGA_REG_RED_MASK:\nreturn VAR_0->wred;", "case SVGA_REG_GREEN_MASK:\nreturn VAR_0->wgreen;", "case SVGA_REG_BLUE_MASK:\nreturn VAR_0->wblue;", "case SVGA_REG_BYTES_PER_LINE:\nreturn ((VAR_0->depth + 7) >> 3) * VAR_0->new_width;", "case SVGA_REG_FB_START: {", "struct pci_vmsvga_state_s *VAR_2\n= container_of(VAR_0, struct pci_vmsvga_state_s, chip);", "return pci_get_bar_addr(&VAR_2->card, 1);", "}", "case SVGA_REG_FB_OFFSET:\nreturn 0x0;", "case SVGA_REG_VRAM_SIZE:\nreturn VAR_0->vga.vram_size;", "case SVGA_REG_FB_SIZE:\nreturn VAR_0->fb_size;", "case SVGA_REG_CAPABILITIES:\ncaps = SVGA_CAP_NONE;", "#ifdef HW_RECT_ACCEL\ncaps |= SVGA_CAP_RECT_COPY;", "#endif\n#ifdef HW_FILL_ACCEL\ncaps |= SVGA_CAP_RECT_FILL;", "#endif\n#ifdef HW_MOUSE_ACCEL\nif (dpy_cursor_define_supported(VAR_0->vga.ds)) {", "caps |= SVGA_CAP_CURSOR | SVGA_CAP_CURSOR_BYPASS_2 |\nSVGA_CAP_CURSOR_BYPASS;", "}", "#endif\nreturn caps;", "case SVGA_REG_MEM_START: {", "struct pci_vmsvga_state_s *VAR_2\n= container_of(VAR_0, struct pci_vmsvga_state_s, chip);", "return pci_get_bar_addr(&VAR_2->card, 2);", "}", "case SVGA_REG_MEM_SIZE:\nreturn VAR_0->fifo_size;", "case SVGA_REG_CONFIG_DONE:\nreturn VAR_0->config;", "case SVGA_REG_SYNC:\ncase SVGA_REG_BUSY:\nreturn VAR_0->syncing;", "case SVGA_REG_GUEST_ID:\nreturn VAR_0->guest;", "case SVGA_REG_CURSOR_ID:\nreturn VAR_0->cursor.id;", "case SVGA_REG_CURSOR_X:\nreturn VAR_0->cursor.x;", "case SVGA_REG_CURSOR_Y:\nreturn VAR_0->cursor.x;", "case SVGA_REG_CURSOR_ON:\nreturn VAR_0->cursor.on;", "case SVGA_REG_HOST_BITS_PER_PIXEL:\nreturn (VAR_0->depth + 7) & ~7;", "case SVGA_REG_SCRATCH_SIZE:\nreturn VAR_0->scratch_size;", "case SVGA_REG_MEM_REGS:\ncase SVGA_REG_NUM_DISPLAYS:\ncase SVGA_REG_PITCHLOCK:\ncase SVGA_PALETTE_BASE ... SVGA_PALETTE_END:\nreturn 0;", "default:\nif (VAR_0->index >= SVGA_SCRATCH_BASE &&\nVAR_0->index < SVGA_SCRATCH_BASE + VAR_0->scratch_size)\nreturn VAR_0->scratch[VAR_0->index - SVGA_SCRATCH_BASE];", "printf(\"%VAR_0: Bad register %02x\\n\", __FUNCTION__, VAR_0->index);", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11, 13 ], [ 17, 19 ], [ 23, 25 ], [ 29, 31 ], [ 35, 37 ], [ 41, 43 ], [ 47, 49 ], [ 53, 55 ], [ 59, 61 ], [ 65, 67 ], [ 69, 71 ], [ 73, 75 ], [ 79, 81 ], [ 85 ], [ 87, 89 ], [ 91 ], [ 93 ], [ 97, 99 ], [ 103, 105 ], [ 109, 111 ], [ 115, 117 ], [ 119, 121 ], [ 123, 125, 127 ], [ 129, 131, 133 ], [ 135, 137 ], [ 139 ], [ 141, 143 ], [ 147 ], [ 149, 151 ], [ 153 ], [ 155 ], [ 159, 161 ], [ 165, 167 ], [ 171, 173, 175 ], [ 179, 181 ], [ 185, 187 ], [ 191, 193 ], [ 197, 199 ], [ 203, 205 ], [ 209, 211 ], [ 215, 217 ], [ 221, 223, 225, 227, 229 ], [ 233, 235, 237, 239 ], [ 241 ], [ 243 ], [ 247 ], [ 249 ] ]
24,184
static void qemu_chr_parse_file_out(QemuOpts *opts, ChardevBackend *backend, Error **errp) { const char *path = qemu_opt_get(opts, "path"); ChardevFile *file; if (path == NULL) { error_setg(errp, "chardev: file: no filename given"); return; } file = backend->u.file = g_new0(ChardevFile, 1); qemu_chr_parse_common(opts, qapi_ChardevFile_base(file)); file->out = g_strdup(path); file->has_append = true; file->append = qemu_opt_get_bool(opts, "append", false); }
false
qemu
32bafa8fdd098d52fbf1102d5a5e48d29398c0aa
static void qemu_chr_parse_file_out(QemuOpts *opts, ChardevBackend *backend, Error **errp) { const char *path = qemu_opt_get(opts, "path"); ChardevFile *file; if (path == NULL) { error_setg(errp, "chardev: file: no filename given"); return; } file = backend->u.file = g_new0(ChardevFile, 1); qemu_chr_parse_common(opts, qapi_ChardevFile_base(file)); file->out = g_strdup(path); file->has_append = true; file->append = qemu_opt_get_bool(opts, "append", false); }
{ "code": [], "line_no": [] }
static void FUNC_0(QemuOpts *VAR_0, ChardevBackend *VAR_1, Error **VAR_2) { const char *VAR_3 = qemu_opt_get(VAR_0, "VAR_3"); ChardevFile *file; if (VAR_3 == NULL) { error_setg(VAR_2, "chardev: file: no filename given"); return; } file = VAR_1->u.file = g_new0(ChardevFile, 1); qemu_chr_parse_common(VAR_0, qapi_ChardevFile_base(file)); file->out = g_strdup(VAR_3); file->has_append = true; file->append = qemu_opt_get_bool(VAR_0, "append", false); }
[ "static void FUNC_0(QemuOpts *VAR_0, ChardevBackend *VAR_1,\nError **VAR_2)\n{", "const char *VAR_3 = qemu_opt_get(VAR_0, \"VAR_3\");", "ChardevFile *file;", "if (VAR_3 == NULL) {", "error_setg(VAR_2, \"chardev: file: no filename given\");", "return;", "}", "file = VAR_1->u.file = g_new0(ChardevFile, 1);", "qemu_chr_parse_common(VAR_0, qapi_ChardevFile_base(file));", "file->out = g_strdup(VAR_3);", "file->has_append = true;", "file->append = qemu_opt_get_bool(VAR_0, \"append\", false);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ] ]
24,185
nvdimm_dsm_write(void *opaque, hwaddr addr, uint64_t val, unsigned size) { AcpiNVDIMMState *state = opaque; NvdimmDsmIn *in; hwaddr dsm_mem_addr = val; nvdimm_debug("dsm memory address %#" HWADDR_PRIx ".\n", dsm_mem_addr); /* * The DSM memory is mapped to guest address space so an evil guest * can change its content while we are doing DSM emulation. Avoid * this by copying DSM memory to QEMU local memory. */ in = g_new(NvdimmDsmIn, 1); cpu_physical_memory_read(dsm_mem_addr, in, sizeof(*in)); le32_to_cpus(&in->revision); le32_to_cpus(&in->function); le32_to_cpus(&in->handle); nvdimm_debug("Revision %#x Handler %#x Function %#x.\n", in->revision, in->handle, in->function); if (in->revision != 0x1 /* Currently we only support DSM Spec Rev1. */) { nvdimm_debug("Revision %#x is not supported, expect %#x.\n", in->revision, 0x1); nvdimm_dsm_no_payload(1 /* Not Supported */, dsm_mem_addr); goto exit; } if (in->handle == NVDIMM_QEMU_RSVD_HANDLE_ROOT) { nvdimm_dsm_reserved_root(state, in, dsm_mem_addr); goto exit; } /* Handle 0 is reserved for NVDIMM Root Device. */ if (!in->handle) { nvdimm_dsm_root(in, dsm_mem_addr); goto exit; } nvdimm_dsm_device(in, dsm_mem_addr); exit: g_free(in); }
false
qemu
c2fa30757a2ba1bb5b053883773a9a61fbdd7082
nvdimm_dsm_write(void *opaque, hwaddr addr, uint64_t val, unsigned size) { AcpiNVDIMMState *state = opaque; NvdimmDsmIn *in; hwaddr dsm_mem_addr = val; nvdimm_debug("dsm memory address %#" HWADDR_PRIx ".\n", dsm_mem_addr); in = g_new(NvdimmDsmIn, 1); cpu_physical_memory_read(dsm_mem_addr, in, sizeof(*in)); le32_to_cpus(&in->revision); le32_to_cpus(&in->function); le32_to_cpus(&in->handle); nvdimm_debug("Revision %#x Handler %#x Function %#x.\n", in->revision, in->handle, in->function); if (in->revision != 0x1 ) { nvdimm_debug("Revision %#x is not supported, expect %#x.\n", in->revision, 0x1); nvdimm_dsm_no_payload(1 , dsm_mem_addr); goto exit; } if (in->handle == NVDIMM_QEMU_RSVD_HANDLE_ROOT) { nvdimm_dsm_reserved_root(state, in, dsm_mem_addr); goto exit; } if (!in->handle) { nvdimm_dsm_root(in, dsm_mem_addr); goto exit; } nvdimm_dsm_device(in, dsm_mem_addr); exit: g_free(in); }
{ "code": [], "line_no": [] }
FUNC_0(void *VAR_0, hwaddr VAR_1, uint64_t VAR_2, unsigned VAR_3) { AcpiNVDIMMState *state = VAR_0; NvdimmDsmIn *in; hwaddr dsm_mem_addr = VAR_2; nvdimm_debug("dsm memory address %#" HWADDR_PRIx ".\n", dsm_mem_addr); in = g_new(NvdimmDsmIn, 1); cpu_physical_memory_read(dsm_mem_addr, in, sizeof(*in)); le32_to_cpus(&in->revision); le32_to_cpus(&in->function); le32_to_cpus(&in->handle); nvdimm_debug("Revision %#x Handler %#x Function %#x.\n", in->revision, in->handle, in->function); if (in->revision != 0x1 ) { nvdimm_debug("Revision %#x is not supported, expect %#x.\n", in->revision, 0x1); nvdimm_dsm_no_payload(1 , dsm_mem_addr); goto exit; } if (in->handle == NVDIMM_QEMU_RSVD_HANDLE_ROOT) { nvdimm_dsm_reserved_root(state, in, dsm_mem_addr); goto exit; } if (!in->handle) { nvdimm_dsm_root(in, dsm_mem_addr); goto exit; } nvdimm_dsm_device(in, dsm_mem_addr); exit: g_free(in); }
[ "FUNC_0(void *VAR_0, hwaddr VAR_1, uint64_t VAR_2, unsigned VAR_3)\n{", "AcpiNVDIMMState *state = VAR_0;", "NvdimmDsmIn *in;", "hwaddr dsm_mem_addr = VAR_2;", "nvdimm_debug(\"dsm memory address %#\" HWADDR_PRIx \".\\n\", dsm_mem_addr);", "in = g_new(NvdimmDsmIn, 1);", "cpu_physical_memory_read(dsm_mem_addr, in, sizeof(*in));", "le32_to_cpus(&in->revision);", "le32_to_cpus(&in->function);", "le32_to_cpus(&in->handle);", "nvdimm_debug(\"Revision %#x Handler %#x Function %#x.\\n\", in->revision,\nin->handle, in->function);", "if (in->revision != 0x1 ) {", "nvdimm_debug(\"Revision %#x is not supported, expect %#x.\\n\",\nin->revision, 0x1);", "nvdimm_dsm_no_payload(1 , dsm_mem_addr);", "goto exit;", "}", "if (in->handle == NVDIMM_QEMU_RSVD_HANDLE_ROOT) {", "nvdimm_dsm_reserved_root(state, in, dsm_mem_addr);", "goto exit;", "}", "if (!in->handle) {", "nvdimm_dsm_root(in, dsm_mem_addr);", "goto exit;", "}", "nvdimm_dsm_device(in, dsm_mem_addr);", "exit:\ng_free(in);", "}" ]
[ 0, 0, 0, 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 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 41, 43 ], [ 47 ], [ 49, 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 87, 89 ], [ 91 ] ]
24,186
static BlockDriverAIOCB *hdev_aio_ioctl(BlockDriverState *bs, unsigned long int req, void *buf, BlockDriverCompletionFunc *cb, void *opaque) { BDRVRawState *s = bs->opaque; if (fd_open(bs) < 0) return NULL; return paio_ioctl(bs, s->fd, req, buf, cb, opaque); }
false
qemu
c208e8c2d88eea2bbafc2850d8856525637e495d
static BlockDriverAIOCB *hdev_aio_ioctl(BlockDriverState *bs, unsigned long int req, void *buf, BlockDriverCompletionFunc *cb, void *opaque) { BDRVRawState *s = bs->opaque; if (fd_open(bs) < 0) return NULL; return paio_ioctl(bs, s->fd, req, buf, cb, opaque); }
{ "code": [], "line_no": [] }
static BlockDriverAIOCB *FUNC_0(BlockDriverState *bs, unsigned long int req, void *buf, BlockDriverCompletionFunc *cb, void *opaque) { BDRVRawState *s = bs->opaque; if (fd_open(bs) < 0) return NULL; return paio_ioctl(bs, s->fd, req, buf, cb, opaque); }
[ "static BlockDriverAIOCB *FUNC_0(BlockDriverState *bs,\nunsigned long int req, void *buf,\nBlockDriverCompletionFunc *cb, void *opaque)\n{", "BDRVRawState *s = bs->opaque;", "if (fd_open(bs) < 0)\nreturn NULL;", "return paio_ioctl(bs, s->fd, req, buf, cb, opaque);", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 13, 15 ], [ 17 ], [ 19 ] ]
24,187
static void qxl_init_ramsize(PCIQXLDevice *qxl) { /* vga mode framebuffer / primary surface (bar 0, first part) */ if (qxl->vgamem_size_mb < 8) { qxl->vgamem_size_mb = 8; } /* XXX: we round vgamem_size_mb up to a nearest power of two and it must be * less than vga_common_init()'s maximum on qxl->vga.vram_size (512 now). */ if (qxl->vgamem_size_mb > 256) { qxl->vgamem_size_mb = 256; } qxl->vgamem_size = qxl->vgamem_size_mb * 1024 * 1024; /* vga ram (bar 0, total) */ if (qxl->ram_size_mb != -1) { qxl->vga.vram_size = qxl->ram_size_mb * 1024 * 1024; } if (qxl->vga.vram_size < qxl->vgamem_size * 2) { qxl->vga.vram_size = qxl->vgamem_size * 2; } /* vram32 (surfaces, 32bit, bar 1) */ if (qxl->vram32_size_mb != -1) { qxl->vram32_size = qxl->vram32_size_mb * 1024 * 1024; } if (qxl->vram32_size < 4096) { qxl->vram32_size = 4096; } /* vram (surfaces, 64bit, bar 4+5) */ if (qxl->vram_size_mb != -1) { qxl->vram_size = qxl->vram_size_mb * 1024 * 1024; } if (qxl->vram_size < qxl->vram32_size) { qxl->vram_size = qxl->vram32_size; } if (qxl->revision == 1) { qxl->vram32_size = 4096; qxl->vram_size = 4096; } qxl->vgamem_size = pow2ceil(qxl->vgamem_size); qxl->vga.vram_size = pow2ceil(qxl->vga.vram_size); qxl->vram32_size = pow2ceil(qxl->vram32_size); qxl->vram_size = pow2ceil(qxl->vram_size); }
false
qemu
de1b9b85eff3dca42fe2cabe6e026cd2a2d5c769
static void qxl_init_ramsize(PCIQXLDevice *qxl) { if (qxl->vgamem_size_mb < 8) { qxl->vgamem_size_mb = 8; } if (qxl->vgamem_size_mb > 256) { qxl->vgamem_size_mb = 256; } qxl->vgamem_size = qxl->vgamem_size_mb * 1024 * 1024; if (qxl->ram_size_mb != -1) { qxl->vga.vram_size = qxl->ram_size_mb * 1024 * 1024; } if (qxl->vga.vram_size < qxl->vgamem_size * 2) { qxl->vga.vram_size = qxl->vgamem_size * 2; } if (qxl->vram32_size_mb != -1) { qxl->vram32_size = qxl->vram32_size_mb * 1024 * 1024; } if (qxl->vram32_size < 4096) { qxl->vram32_size = 4096; } if (qxl->vram_size_mb != -1) { qxl->vram_size = qxl->vram_size_mb * 1024 * 1024; } if (qxl->vram_size < qxl->vram32_size) { qxl->vram_size = qxl->vram32_size; } if (qxl->revision == 1) { qxl->vram32_size = 4096; qxl->vram_size = 4096; } qxl->vgamem_size = pow2ceil(qxl->vgamem_size); qxl->vga.vram_size = pow2ceil(qxl->vga.vram_size); qxl->vram32_size = pow2ceil(qxl->vram32_size); qxl->vram_size = pow2ceil(qxl->vram_size); }
{ "code": [], "line_no": [] }
static void FUNC_0(PCIQXLDevice *VAR_0) { if (VAR_0->vgamem_size_mb < 8) { VAR_0->vgamem_size_mb = 8; } if (VAR_0->vgamem_size_mb > 256) { VAR_0->vgamem_size_mb = 256; } VAR_0->vgamem_size = VAR_0->vgamem_size_mb * 1024 * 1024; if (VAR_0->ram_size_mb != -1) { VAR_0->vga.vram_size = VAR_0->ram_size_mb * 1024 * 1024; } if (VAR_0->vga.vram_size < VAR_0->vgamem_size * 2) { VAR_0->vga.vram_size = VAR_0->vgamem_size * 2; } if (VAR_0->vram32_size_mb != -1) { VAR_0->vram32_size = VAR_0->vram32_size_mb * 1024 * 1024; } if (VAR_0->vram32_size < 4096) { VAR_0->vram32_size = 4096; } if (VAR_0->vram_size_mb != -1) { VAR_0->vram_size = VAR_0->vram_size_mb * 1024 * 1024; } if (VAR_0->vram_size < VAR_0->vram32_size) { VAR_0->vram_size = VAR_0->vram32_size; } if (VAR_0->revision == 1) { VAR_0->vram32_size = 4096; VAR_0->vram_size = 4096; } VAR_0->vgamem_size = pow2ceil(VAR_0->vgamem_size); VAR_0->vga.vram_size = pow2ceil(VAR_0->vga.vram_size); VAR_0->vram32_size = pow2ceil(VAR_0->vram32_size); VAR_0->vram_size = pow2ceil(VAR_0->vram_size); }
[ "static void FUNC_0(PCIQXLDevice *VAR_0)\n{", "if (VAR_0->vgamem_size_mb < 8) {", "VAR_0->vgamem_size_mb = 8;", "}", "if (VAR_0->vgamem_size_mb > 256) {", "VAR_0->vgamem_size_mb = 256;", "}", "VAR_0->vgamem_size = VAR_0->vgamem_size_mb * 1024 * 1024;", "if (VAR_0->ram_size_mb != -1) {", "VAR_0->vga.vram_size = VAR_0->ram_size_mb * 1024 * 1024;", "}", "if (VAR_0->vga.vram_size < VAR_0->vgamem_size * 2) {", "VAR_0->vga.vram_size = VAR_0->vgamem_size * 2;", "}", "if (VAR_0->vram32_size_mb != -1) {", "VAR_0->vram32_size = VAR_0->vram32_size_mb * 1024 * 1024;", "}", "if (VAR_0->vram32_size < 4096) {", "VAR_0->vram32_size = 4096;", "}", "if (VAR_0->vram_size_mb != -1) {", "VAR_0->vram_size = VAR_0->vram_size_mb * 1024 * 1024;", "}", "if (VAR_0->vram_size < VAR_0->vram32_size) {", "VAR_0->vram_size = VAR_0->vram32_size;", "}", "if (VAR_0->revision == 1) {", "VAR_0->vram32_size = 4096;", "VAR_0->vram_size = 4096;", "}", "VAR_0->vgamem_size = pow2ceil(VAR_0->vgamem_size);", "VAR_0->vga.vram_size = pow2ceil(VAR_0->vga.vram_size);", "VAR_0->vram32_size = pow2ceil(VAR_0->vram32_size);", "VAR_0->vram_size = pow2ceil(VAR_0->vram_size);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 7 ], [ 9 ], [ 11 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ] ]
24,188
static int rtl8139_config_writable(RTL8139State *s) { if (s->Cfg9346 & Cfg9346_Unlock) { return 1; } DPRINTF("Configuration registers are write-protected\n"); return 0; }
false
qemu
eb46c5eda7d8b38c1407dd55f67cf4a6aa3b7b23
static int rtl8139_config_writable(RTL8139State *s) { if (s->Cfg9346 & Cfg9346_Unlock) { return 1; } DPRINTF("Configuration registers are write-protected\n"); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(RTL8139State *VAR_0) { if (VAR_0->Cfg9346 & Cfg9346_Unlock) { return 1; } DPRINTF("Configuration registers are write-protected\n"); return 0; }
[ "static int FUNC_0(RTL8139State *VAR_0)\n{", "if (VAR_0->Cfg9346 & Cfg9346_Unlock)\n{", "return 1;", "}", "DPRINTF(\"Configuration registers are write-protected\\n\");", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9 ], [ 11 ], [ 15 ], [ 19 ], [ 21 ] ]
24,189
static int vfio_container_do_ioctl(AddressSpace *as, int32_t groupid, int req, void *param) { VFIOGroup *group; VFIOContainer *container; int ret = -1; group = vfio_get_group(groupid, as); if (!group) { error_report("vfio: group %d not registered", groupid); return ret; } container = group->container; if (group->container) { ret = ioctl(container->fd, req, param); if (ret < 0) { error_report("vfio: failed to ioctl %d to container: ret=%d, %s", _IOC_NR(req) - VFIO_BASE, ret, strerror(errno)); } } vfio_put_group(group); return ret; }
false
qemu
3356128cd13d7ec7689b7cddd3efbfbc5339a262
static int vfio_container_do_ioctl(AddressSpace *as, int32_t groupid, int req, void *param) { VFIOGroup *group; VFIOContainer *container; int ret = -1; group = vfio_get_group(groupid, as); if (!group) { error_report("vfio: group %d not registered", groupid); return ret; } container = group->container; if (group->container) { ret = ioctl(container->fd, req, param); if (ret < 0) { error_report("vfio: failed to ioctl %d to container: ret=%d, %s", _IOC_NR(req) - VFIO_BASE, ret, strerror(errno)); } } vfio_put_group(group); return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(AddressSpace *VAR_0, int32_t VAR_1, int VAR_2, void *VAR_3) { VFIOGroup *group; VFIOContainer *container; int VAR_4 = -1; group = vfio_get_group(VAR_1, VAR_0); if (!group) { error_report("vfio: group %d not registered", VAR_1); return VAR_4; } container = group->container; if (group->container) { VAR_4 = ioctl(container->fd, VAR_2, VAR_3); if (VAR_4 < 0) { error_report("vfio: failed to ioctl %d to container: VAR_4=%d, %s", _IOC_NR(VAR_2) - VFIO_BASE, VAR_4, strerror(errno)); } } vfio_put_group(group); return VAR_4; }
[ "static int FUNC_0(AddressSpace *VAR_0, int32_t VAR_1,\nint VAR_2, void *VAR_3)\n{", "VFIOGroup *group;", "VFIOContainer *container;", "int VAR_4 = -1;", "group = vfio_get_group(VAR_1, VAR_0);", "if (!group) {", "error_report(\"vfio: group %d not registered\", VAR_1);", "return VAR_4;", "}", "container = group->container;", "if (group->container) {", "VAR_4 = ioctl(container->fd, VAR_2, VAR_3);", "if (VAR_4 < 0) {", "error_report(\"vfio: failed to ioctl %d to container: VAR_4=%d, %s\",\n_IOC_NR(VAR_2) - VFIO_BASE, VAR_4, strerror(errno));", "}", "}", "vfio_put_group(group);", "return VAR_4;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35, 37 ], [ 39 ], [ 41 ], [ 45 ], [ 49 ], [ 51 ] ]
24,190
void vnc_flush(VncState *vs) { vnc_lock_output(vs); if (vs->csock != -1 && (vs->output.offset #ifdef CONFIG_VNC_WS || vs->ws_output.offset #endif )) { vnc_client_write_locked(vs); } vnc_unlock_output(vs); }
false
qemu
8e9b0d24fb986d4241ae3b77752eca5dab4cb486
void vnc_flush(VncState *vs) { vnc_lock_output(vs); if (vs->csock != -1 && (vs->output.offset #ifdef CONFIG_VNC_WS || vs->ws_output.offset #endif )) { vnc_client_write_locked(vs); } vnc_unlock_output(vs); }
{ "code": [], "line_no": [] }
void FUNC_0(VncState *VAR_0) { vnc_lock_output(VAR_0); if (VAR_0->csock != -1 && (VAR_0->output.offset #ifdef CONFIG_VNC_WS || VAR_0->ws_output.offset #endif )) { vnc_client_write_locked(VAR_0); } vnc_unlock_output(VAR_0); }
[ "void FUNC_0(VncState *VAR_0)\n{", "vnc_lock_output(VAR_0);", "if (VAR_0->csock != -1 && (VAR_0->output.offset\n#ifdef CONFIG_VNC_WS\n|| VAR_0->ws_output.offset\n#endif\n)) {", "vnc_client_write_locked(VAR_0);", "}", "vnc_unlock_output(VAR_0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9, 11, 13, 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ] ]
24,191
static float32 roundAndPackFloat32( flag zSign, int16 zExp, bits32 zSig STATUS_PARAM) { int8 roundingMode; flag roundNearestEven; int8 roundIncrement, roundBits; flag isTiny; roundingMode = STATUS(float_rounding_mode); roundNearestEven = ( roundingMode == float_round_nearest_even ); roundIncrement = 0x40; if ( ! roundNearestEven ) { if ( roundingMode == float_round_to_zero ) { roundIncrement = 0; } else { roundIncrement = 0x7F; if ( zSign ) { if ( roundingMode == float_round_up ) roundIncrement = 0; } else { if ( roundingMode == float_round_down ) roundIncrement = 0; } } } roundBits = zSig & 0x7F; if ( 0xFD <= (bits16) zExp ) { if ( ( 0xFD < zExp ) || ( ( zExp == 0xFD ) && ( (sbits32) ( zSig + roundIncrement ) < 0 ) ) ) { float_raise( float_flag_overflow | float_flag_inexact STATUS_VAR); return packFloat32( zSign, 0xFF, 0 ) - ( roundIncrement == 0 ); } if ( zExp < 0 ) { isTiny = ( STATUS(float_detect_tininess) == float_tininess_before_rounding ) || ( zExp < -1 ) || ( zSig + roundIncrement < 0x80000000 ); shift32RightJamming( zSig, - zExp, &zSig ); zExp = 0; roundBits = zSig & 0x7F; if ( isTiny && roundBits ) float_raise( float_flag_underflow STATUS_VAR); } } if ( roundBits ) STATUS(float_exception_flags) |= float_flag_inexact; zSig = ( zSig + roundIncrement )>>7; zSig &= ~ ( ( ( roundBits ^ 0x40 ) == 0 ) & roundNearestEven ); if ( zSig == 0 ) zExp = 0; return packFloat32( zSign, zExp, zSig ); }
false
qemu
f090c9d4ad5812fb92843d6470a1111c15190c4c
static float32 roundAndPackFloat32( flag zSign, int16 zExp, bits32 zSig STATUS_PARAM) { int8 roundingMode; flag roundNearestEven; int8 roundIncrement, roundBits; flag isTiny; roundingMode = STATUS(float_rounding_mode); roundNearestEven = ( roundingMode == float_round_nearest_even ); roundIncrement = 0x40; if ( ! roundNearestEven ) { if ( roundingMode == float_round_to_zero ) { roundIncrement = 0; } else { roundIncrement = 0x7F; if ( zSign ) { if ( roundingMode == float_round_up ) roundIncrement = 0; } else { if ( roundingMode == float_round_down ) roundIncrement = 0; } } } roundBits = zSig & 0x7F; if ( 0xFD <= (bits16) zExp ) { if ( ( 0xFD < zExp ) || ( ( zExp == 0xFD ) && ( (sbits32) ( zSig + roundIncrement ) < 0 ) ) ) { float_raise( float_flag_overflow | float_flag_inexact STATUS_VAR); return packFloat32( zSign, 0xFF, 0 ) - ( roundIncrement == 0 ); } if ( zExp < 0 ) { isTiny = ( STATUS(float_detect_tininess) == float_tininess_before_rounding ) || ( zExp < -1 ) || ( zSig + roundIncrement < 0x80000000 ); shift32RightJamming( zSig, - zExp, &zSig ); zExp = 0; roundBits = zSig & 0x7F; if ( isTiny && roundBits ) float_raise( float_flag_underflow STATUS_VAR); } } if ( roundBits ) STATUS(float_exception_flags) |= float_flag_inexact; zSig = ( zSig + roundIncrement )>>7; zSig &= ~ ( ( ( roundBits ^ 0x40 ) == 0 ) & roundNearestEven ); if ( zSig == 0 ) zExp = 0; return packFloat32( zSign, zExp, zSig ); }
{ "code": [], "line_no": [] }
static float32 FUNC_0( flag zSign, int16 zExp, bits32 zSig STATUS_PARAM) { int8 roundingMode; flag roundNearestEven; int8 roundIncrement, roundBits; flag isTiny; roundingMode = STATUS(float_rounding_mode); roundNearestEven = ( roundingMode == float_round_nearest_even ); roundIncrement = 0x40; if ( ! roundNearestEven ) { if ( roundingMode == float_round_to_zero ) { roundIncrement = 0; } else { roundIncrement = 0x7F; if ( zSign ) { if ( roundingMode == float_round_up ) roundIncrement = 0; } else { if ( roundingMode == float_round_down ) roundIncrement = 0; } } } roundBits = zSig & 0x7F; if ( 0xFD <= (bits16) zExp ) { if ( ( 0xFD < zExp ) || ( ( zExp == 0xFD ) && ( (sbits32) ( zSig + roundIncrement ) < 0 ) ) ) { float_raise( float_flag_overflow | float_flag_inexact STATUS_VAR); return packFloat32( zSign, 0xFF, 0 ) - ( roundIncrement == 0 ); } if ( zExp < 0 ) { isTiny = ( STATUS(float_detect_tininess) == float_tininess_before_rounding ) || ( zExp < -1 ) || ( zSig + roundIncrement < 0x80000000 ); shift32RightJamming( zSig, - zExp, &zSig ); zExp = 0; roundBits = zSig & 0x7F; if ( isTiny && roundBits ) float_raise( float_flag_underflow STATUS_VAR); } } if ( roundBits ) STATUS(float_exception_flags) |= float_flag_inexact; zSig = ( zSig + roundIncrement )>>7; zSig &= ~ ( ( ( roundBits ^ 0x40 ) == 0 ) & roundNearestEven ); if ( zSig == 0 ) zExp = 0; return packFloat32( zSign, zExp, zSig ); }
[ "static float32 FUNC_0( flag zSign, int16 zExp, bits32 zSig STATUS_PARAM)\n{", "int8 roundingMode;", "flag roundNearestEven;", "int8 roundIncrement, roundBits;", "flag isTiny;", "roundingMode = STATUS(float_rounding_mode);", "roundNearestEven = ( roundingMode == float_round_nearest_even );", "roundIncrement = 0x40;", "if ( ! roundNearestEven ) {", "if ( roundingMode == float_round_to_zero ) {", "roundIncrement = 0;", "}", "else {", "roundIncrement = 0x7F;", "if ( zSign ) {", "if ( roundingMode == float_round_up ) roundIncrement = 0;", "}", "else {", "if ( roundingMode == float_round_down ) roundIncrement = 0;", "}", "}", "}", "roundBits = zSig & 0x7F;", "if ( 0xFD <= (bits16) zExp ) {", "if ( ( 0xFD < zExp )\n|| ( ( zExp == 0xFD )\n&& ( (sbits32) ( zSig + roundIncrement ) < 0 ) )\n) {", "float_raise( float_flag_overflow | float_flag_inexact STATUS_VAR);", "return packFloat32( zSign, 0xFF, 0 ) - ( roundIncrement == 0 );", "}", "if ( zExp < 0 ) {", "isTiny =\n( STATUS(float_detect_tininess) == float_tininess_before_rounding )\n|| ( zExp < -1 )\n|| ( zSig + roundIncrement < 0x80000000 );", "shift32RightJamming( zSig, - zExp, &zSig );", "zExp = 0;", "roundBits = zSig & 0x7F;", "if ( isTiny && roundBits ) float_raise( float_flag_underflow STATUS_VAR);", "}", "}", "if ( roundBits ) STATUS(float_exception_flags) |= float_flag_inexact;", "zSig = ( zSig + roundIncrement )>>7;", "zSig &= ~ ( ( ( roundBits ^ 0x40 ) == 0 ) & roundNearestEven );", "if ( zSig == 0 ) zExp = 0;", "return packFloat32( zSign, zExp, zSig );", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53, 55, 57, 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69, 71, 73, 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 101 ] ]
24,192
static void omap_lpg_write(void *opaque, target_phys_addr_t addr, uint64_t value, unsigned size) { struct omap_lpg_s *s = (struct omap_lpg_s *) opaque; int offset = addr & OMAP_MPUI_REG_MASK; if (size != 1) { return omap_badwidth_write8(opaque, addr, value); } switch (offset) { case 0x00: /* LCR */ if (~value & (1 << 6)) /* LPGRES */ omap_lpg_reset(s); s->control = value & 0xff; omap_lpg_update(s); return; case 0x04: /* PMR */ s->power = value & 0x01; omap_lpg_update(s); return; default: OMAP_BAD_REG(addr); return; } }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static void omap_lpg_write(void *opaque, target_phys_addr_t addr, uint64_t value, unsigned size) { struct omap_lpg_s *s = (struct omap_lpg_s *) opaque; int offset = addr & OMAP_MPUI_REG_MASK; if (size != 1) { return omap_badwidth_write8(opaque, addr, value); } switch (offset) { case 0x00: if (~value & (1 << 6)) omap_lpg_reset(s); s->control = value & 0xff; omap_lpg_update(s); return; case 0x04: s->power = value & 0x01; omap_lpg_update(s); return; default: OMAP_BAD_REG(addr); return; } }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1, uint64_t VAR_2, unsigned VAR_3) { struct omap_lpg_s *VAR_4 = (struct omap_lpg_s *) VAR_0; int VAR_5 = VAR_1 & OMAP_MPUI_REG_MASK; if (VAR_3 != 1) { return omap_badwidth_write8(VAR_0, VAR_1, VAR_2); } switch (VAR_5) { case 0x00: if (~VAR_2 & (1 << 6)) omap_lpg_reset(VAR_4); VAR_4->control = VAR_2 & 0xff; omap_lpg_update(VAR_4); return; case 0x04: VAR_4->power = VAR_2 & 0x01; omap_lpg_update(VAR_4); return; default: OMAP_BAD_REG(VAR_1); return; } }
[ "static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1,\nuint64_t VAR_2, unsigned VAR_3)\n{", "struct omap_lpg_s *VAR_4 = (struct omap_lpg_s *) VAR_0;", "int VAR_5 = VAR_1 & OMAP_MPUI_REG_MASK;", "if (VAR_3 != 1) {", "return omap_badwidth_write8(VAR_0, VAR_1, VAR_2);", "}", "switch (VAR_5) {", "case 0x00:\nif (~VAR_2 & (1 << 6))\nomap_lpg_reset(VAR_4);", "VAR_4->control = VAR_2 & 0xff;", "omap_lpg_update(VAR_4);", "return;", "case 0x04:\nVAR_4->power = VAR_2 & 0x01;", "omap_lpg_update(VAR_4);", "return;", "default:\nOMAP_BAD_REG(VAR_1);", "return;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23, 25, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37, 39 ], [ 41 ], [ 43 ], [ 47, 49 ], [ 51 ], [ 53 ], [ 55 ] ]
24,193
static int h264_find_frame_end(H264ParseContext *p, const uint8_t *buf, int buf_size) { int i; uint32_t state; ParseContext *pc = &p->pc; // mb_addr= pc->mb_addr - 1; state = pc->state; if (state > 13) state = 7; for (i = 0; i < buf_size; i++) { if (state == 7) { i += p->h264dsp.startcode_find_candidate(buf + i, buf_size - i); if (i < buf_size) state = 2; } else if (state <= 2) { if (buf[i] == 1) state ^= 5; // 2->7, 1->4, 0->5 else if (buf[i]) state = 7; else state >>= 1; // 2->1, 1->0, 0->0 } else if (state <= 5) { int nalu_type = buf[i] & 0x1F; if (nalu_type == NAL_SEI || nalu_type == NAL_SPS || nalu_type == NAL_PPS || nalu_type == NAL_AUD) { if (pc->frame_start_found) { i++; goto found; } } else if (nalu_type == NAL_SLICE || nalu_type == NAL_DPA || nalu_type == NAL_IDR_SLICE) { if (pc->frame_start_found) { state += 8; continue; } else pc->frame_start_found = 1; } state = 7; } else { // first_mb_in_slice is 0, probably the first nal of a new slice if (buf[i] & 0x80) goto found; state = 7; } } pc->state = state; return END_NOT_FOUND; found: pc->state = 7; pc->frame_start_found = 0; return i - (state & 5); }
false
FFmpeg
5c2fb561d94fc51d76ab21d6f7cc5b6cc3aa599c
static int h264_find_frame_end(H264ParseContext *p, const uint8_t *buf, int buf_size) { int i; uint32_t state; ParseContext *pc = &p->pc; state = pc->state; if (state > 13) state = 7; for (i = 0; i < buf_size; i++) { if (state == 7) { i += p->h264dsp.startcode_find_candidate(buf + i, buf_size - i); if (i < buf_size) state = 2; } else if (state <= 2) { if (buf[i] == 1) state ^= 5; else if (buf[i]) state = 7; else state >>= 1; } else if (state <= 5) { int nalu_type = buf[i] & 0x1F; if (nalu_type == NAL_SEI || nalu_type == NAL_SPS || nalu_type == NAL_PPS || nalu_type == NAL_AUD) { if (pc->frame_start_found) { i++; goto found; } } else if (nalu_type == NAL_SLICE || nalu_type == NAL_DPA || nalu_type == NAL_IDR_SLICE) { if (pc->frame_start_found) { state += 8; continue; } else pc->frame_start_found = 1; } state = 7; } else { if (buf[i] & 0x80) goto found; state = 7; } } pc->state = state; return END_NOT_FOUND; found: pc->state = 7; pc->frame_start_found = 0; return i - (state & 5); }
{ "code": [], "line_no": [] }
static int FUNC_0(H264ParseContext *VAR_0, const uint8_t *VAR_1, int VAR_2) { int VAR_3; uint32_t state; ParseContext *pc = &VAR_0->pc; state = pc->state; if (state > 13) state = 7; for (VAR_3 = 0; VAR_3 < VAR_2; VAR_3++) { if (state == 7) { VAR_3 += VAR_0->h264dsp.startcode_find_candidate(VAR_1 + VAR_3, VAR_2 - VAR_3); if (VAR_3 < VAR_2) state = 2; } else if (state <= 2) { if (VAR_1[VAR_3] == 1) state ^= 5; else if (VAR_1[VAR_3]) state = 7; else state >>= 1; } else if (state <= 5) { int VAR_4 = VAR_1[VAR_3] & 0x1F; if (VAR_4 == NAL_SEI || VAR_4 == NAL_SPS || VAR_4 == NAL_PPS || VAR_4 == NAL_AUD) { if (pc->frame_start_found) { VAR_3++; goto found; } } else if (VAR_4 == NAL_SLICE || VAR_4 == NAL_DPA || VAR_4 == NAL_IDR_SLICE) { if (pc->frame_start_found) { state += 8; continue; } else pc->frame_start_found = 1; } state = 7; } else { if (VAR_1[VAR_3] & 0x80) goto found; state = 7; } } pc->state = state; return END_NOT_FOUND; found: pc->state = 7; pc->frame_start_found = 0; return VAR_3 - (state & 5); }
[ "static int FUNC_0(H264ParseContext *VAR_0, const uint8_t *VAR_1,\nint VAR_2)\n{", "int VAR_3;", "uint32_t state;", "ParseContext *pc = &VAR_0->pc;", "state = pc->state;", "if (state > 13)\nstate = 7;", "for (VAR_3 = 0; VAR_3 < VAR_2; VAR_3++) {", "if (state == 7) {", "VAR_3 += VAR_0->h264dsp.startcode_find_candidate(VAR_1 + VAR_3, VAR_2 - VAR_3);", "if (VAR_3 < VAR_2)\nstate = 2;", "} else if (state <= 2) {", "if (VAR_1[VAR_3] == 1)\nstate ^= 5;", "else if (VAR_1[VAR_3])\nstate = 7;", "else\nstate >>= 1;", "} else if (state <= 5) {", "int VAR_4 = VAR_1[VAR_3] & 0x1F;", "if (VAR_4 == NAL_SEI || VAR_4 == NAL_SPS ||\nVAR_4 == NAL_PPS || VAR_4 == NAL_AUD) {", "if (pc->frame_start_found) {", "VAR_3++;", "goto found;", "}", "} else if (VAR_4 == NAL_SLICE || VAR_4 == NAL_DPA ||", "VAR_4 == NAL_IDR_SLICE) {", "if (pc->frame_start_found) {", "state += 8;", "continue;", "} else", "pc->frame_start_found = 1;", "}", "state = 7;", "} else {", "if (VAR_1[VAR_3] & 0x80)\ngoto found;", "state = 7;", "}", "}", "pc->state = state;", "return END_NOT_FOUND;", "found:\npc->state = 7;", "pc->frame_start_found = 0;", "return VAR_3 - (state & 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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17, 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29, 31 ], [ 33 ], [ 35, 37 ], [ 39, 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 51, 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 85, 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 101, 103 ], [ 105 ], [ 107 ], [ 109 ] ]
24,194
static uint64_t omap_mpu_timer_read(void *opaque, target_phys_addr_t addr, unsigned size) { struct omap_mpu_timer_s *s = (struct omap_mpu_timer_s *) opaque; if (size != 4) { return omap_badwidth_read32(opaque, addr); } switch (addr) { case 0x00: /* CNTL_TIMER */ return (s->enable << 5) | (s->ptv << 2) | (s->ar << 1) | s->st; case 0x04: /* LOAD_TIM */ break; case 0x08: /* READ_TIM */ return omap_timer_read(s); } OMAP_BAD_REG(addr); return 0; }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static uint64_t omap_mpu_timer_read(void *opaque, target_phys_addr_t addr, unsigned size) { struct omap_mpu_timer_s *s = (struct omap_mpu_timer_s *) opaque; if (size != 4) { return omap_badwidth_read32(opaque, addr); } switch (addr) { case 0x00: return (s->enable << 5) | (s->ptv << 2) | (s->ar << 1) | s->st; case 0x04: break; case 0x08: return omap_timer_read(s); } OMAP_BAD_REG(addr); return 0; }
{ "code": [], "line_no": [] }
static uint64_t FUNC_0(void *opaque, target_phys_addr_t addr, unsigned size) { struct omap_mpu_timer_s *VAR_0 = (struct omap_mpu_timer_s *) opaque; if (size != 4) { return omap_badwidth_read32(opaque, addr); } switch (addr) { case 0x00: return (VAR_0->enable << 5) | (VAR_0->ptv << 2) | (VAR_0->ar << 1) | VAR_0->st; case 0x04: break; case 0x08: return omap_timer_read(VAR_0); } OMAP_BAD_REG(addr); return 0; }
[ "static uint64_t FUNC_0(void *opaque, target_phys_addr_t addr,\nunsigned size)\n{", "struct omap_mpu_timer_s *VAR_0 = (struct omap_mpu_timer_s *) opaque;", "if (size != 4) {", "return omap_badwidth_read32(opaque, addr);", "}", "switch (addr) {", "case 0x00:\nreturn (VAR_0->enable << 5) | (VAR_0->ptv << 2) | (VAR_0->ar << 1) | VAR_0->st;", "case 0x04:\nbreak;", "case 0x08:\nreturn omap_timer_read(VAR_0);", "}", "OMAP_BAD_REG(addr);", "return 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, 29 ], [ 33, 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ] ]
24,195
void bdrv_close(BlockDriverState *bs) { BdrvAioNotifier *ban, *ban_next; if (bs->job) { block_job_cancel_sync(bs->job); } /* Disable I/O limits and drain all pending throttled requests */ if (bs->io_limits_enabled) { bdrv_io_limits_disable(bs); } bdrv_drain(bs); /* complete I/O */ bdrv_flush(bs); bdrv_drain(bs); /* in case flush left pending I/O */ notifier_list_notify(&bs->close_notifiers, bs); if (bs->drv) { BdrvChild *child, *next; bs->drv->bdrv_close(bs); bs->drv = NULL; bdrv_set_backing_hd(bs, NULL); if (bs->file != NULL) { bdrv_unref_child(bs, bs->file); bs->file = NULL; } QLIST_FOREACH_SAFE(child, &bs->children, next, next) { /* TODO Remove bdrv_unref() from drivers' close function and use * bdrv_unref_child() here */ if (child->bs->inherits_from == bs) { child->bs->inherits_from = NULL; } bdrv_detach_child(child); } g_free(bs->opaque); bs->opaque = NULL; bs->copy_on_read = 0; bs->backing_file[0] = '\0'; bs->backing_format[0] = '\0'; bs->total_sectors = 0; bs->encrypted = 0; bs->valid_key = 0; bs->sg = 0; bs->zero_beyond_eof = false; QDECREF(bs->options); bs->options = NULL; QDECREF(bs->full_open_options); bs->full_open_options = NULL; } if (bs->blk) { blk_dev_change_media_cb(bs->blk, false); } QLIST_FOREACH_SAFE(ban, &bs->aio_notifiers, list, ban_next) { g_free(ban); } QLIST_INIT(&bs->aio_notifiers); }
false
qemu
b4d02820d95e025e57d82144f7b2ccd677ac2418
void bdrv_close(BlockDriverState *bs) { BdrvAioNotifier *ban, *ban_next; if (bs->job) { block_job_cancel_sync(bs->job); } if (bs->io_limits_enabled) { bdrv_io_limits_disable(bs); } bdrv_drain(bs); bdrv_flush(bs); bdrv_drain(bs); notifier_list_notify(&bs->close_notifiers, bs); if (bs->drv) { BdrvChild *child, *next; bs->drv->bdrv_close(bs); bs->drv = NULL; bdrv_set_backing_hd(bs, NULL); if (bs->file != NULL) { bdrv_unref_child(bs, bs->file); bs->file = NULL; } QLIST_FOREACH_SAFE(child, &bs->children, next, next) { if (child->bs->inherits_from == bs) { child->bs->inherits_from = NULL; } bdrv_detach_child(child); } g_free(bs->opaque); bs->opaque = NULL; bs->copy_on_read = 0; bs->backing_file[0] = '\0'; bs->backing_format[0] = '\0'; bs->total_sectors = 0; bs->encrypted = 0; bs->valid_key = 0; bs->sg = 0; bs->zero_beyond_eof = false; QDECREF(bs->options); bs->options = NULL; QDECREF(bs->full_open_options); bs->full_open_options = NULL; } if (bs->blk) { blk_dev_change_media_cb(bs->blk, false); } QLIST_FOREACH_SAFE(ban, &bs->aio_notifiers, list, ban_next) { g_free(ban); } QLIST_INIT(&bs->aio_notifiers); }
{ "code": [], "line_no": [] }
void FUNC_0(BlockDriverState *VAR_0) { BdrvAioNotifier *ban, *ban_next; if (VAR_0->job) { block_job_cancel_sync(VAR_0->job); } if (VAR_0->io_limits_enabled) { bdrv_io_limits_disable(VAR_0); } bdrv_drain(VAR_0); bdrv_flush(VAR_0); bdrv_drain(VAR_0); notifier_list_notify(&VAR_0->close_notifiers, VAR_0); if (VAR_0->drv) { BdrvChild *child, *next; VAR_0->drv->FUNC_0(VAR_0); VAR_0->drv = NULL; bdrv_set_backing_hd(VAR_0, NULL); if (VAR_0->file != NULL) { bdrv_unref_child(VAR_0, VAR_0->file); VAR_0->file = NULL; } QLIST_FOREACH_SAFE(child, &VAR_0->children, next, next) { if (child->VAR_0->inherits_from == VAR_0) { child->VAR_0->inherits_from = NULL; } bdrv_detach_child(child); } g_free(VAR_0->opaque); VAR_0->opaque = NULL; VAR_0->copy_on_read = 0; VAR_0->backing_file[0] = '\0'; VAR_0->backing_format[0] = '\0'; VAR_0->total_sectors = 0; VAR_0->encrypted = 0; VAR_0->valid_key = 0; VAR_0->sg = 0; VAR_0->zero_beyond_eof = false; QDECREF(VAR_0->options); VAR_0->options = NULL; QDECREF(VAR_0->full_open_options); VAR_0->full_open_options = NULL; } if (VAR_0->blk) { blk_dev_change_media_cb(VAR_0->blk, false); } QLIST_FOREACH_SAFE(ban, &VAR_0->aio_notifiers, list, ban_next) { g_free(ban); } QLIST_INIT(&VAR_0->aio_notifiers); }
[ "void FUNC_0(BlockDriverState *VAR_0)\n{", "BdrvAioNotifier *ban, *ban_next;", "if (VAR_0->job) {", "block_job_cancel_sync(VAR_0->job);", "}", "if (VAR_0->io_limits_enabled) {", "bdrv_io_limits_disable(VAR_0);", "}", "bdrv_drain(VAR_0);", "bdrv_flush(VAR_0);", "bdrv_drain(VAR_0);", "notifier_list_notify(&VAR_0->close_notifiers, VAR_0);", "if (VAR_0->drv) {", "BdrvChild *child, *next;", "VAR_0->drv->FUNC_0(VAR_0);", "VAR_0->drv = NULL;", "bdrv_set_backing_hd(VAR_0, NULL);", "if (VAR_0->file != NULL) {", "bdrv_unref_child(VAR_0, VAR_0->file);", "VAR_0->file = NULL;", "}", "QLIST_FOREACH_SAFE(child, &VAR_0->children, next, next) {", "if (child->VAR_0->inherits_from == VAR_0) {", "child->VAR_0->inherits_from = NULL;", "}", "bdrv_detach_child(child);", "}", "g_free(VAR_0->opaque);", "VAR_0->opaque = NULL;", "VAR_0->copy_on_read = 0;", "VAR_0->backing_file[0] = '\\0';", "VAR_0->backing_format[0] = '\\0';", "VAR_0->total_sectors = 0;", "VAR_0->encrypted = 0;", "VAR_0->valid_key = 0;", "VAR_0->sg = 0;", "VAR_0->zero_beyond_eof = false;", "QDECREF(VAR_0->options);", "VAR_0->options = NULL;", "QDECREF(VAR_0->full_open_options);", "VAR_0->full_open_options = NULL;", "}", "if (VAR_0->blk) {", "blk_dev_change_media_cb(VAR_0->blk, false);", "}", "QLIST_FOREACH_SAFE(ban, &VAR_0->aio_notifiers, list, ban_next) {", "g_free(ban);", "}", "QLIST_INIT(&VAR_0->aio_notifiers);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 113 ], [ 115 ], [ 117 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ] ]
24,196
void slirp_select_poll(fd_set *readfds, fd_set *writefds, fd_set *xfds, int select_error) { }
false
qemu
8917c3bdba37d6fe4393db0fad3fabbde9530d6b
void slirp_select_poll(fd_set *readfds, fd_set *writefds, fd_set *xfds, int select_error) { }
{ "code": [], "line_no": [] }
void FUNC_0(fd_set *VAR_0, fd_set *VAR_1, fd_set *VAR_2, int VAR_3) { }
[ "void FUNC_0(fd_set *VAR_0, fd_set *VAR_1,\nfd_set *VAR_2, int VAR_3)\n{", "}" ]
[ 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ] ]
24,197
struct omap_mcbsp_s *omap_mcbsp_init(MemoryRegion *system_memory, target_phys_addr_t base, qemu_irq *irq, qemu_irq *dma, omap_clk clk) { struct omap_mcbsp_s *s = (struct omap_mcbsp_s *) g_malloc0(sizeof(struct omap_mcbsp_s)); s->txirq = irq[0]; s->rxirq = irq[1]; s->txdrq = dma[0]; s->rxdrq = dma[1]; s->sink_timer = qemu_new_timer_ns(vm_clock, omap_mcbsp_sink_tick, s); s->source_timer = qemu_new_timer_ns(vm_clock, omap_mcbsp_source_tick, s); omap_mcbsp_reset(s); memory_region_init_io(&s->iomem, &omap_mcbsp_ops, s, "omap-mcbsp", 0x800); memory_region_add_subregion(system_memory, base, &s->iomem); return s; }
false
qemu
0919ac787641db11024912651f3bc5764d4f1286
struct omap_mcbsp_s *omap_mcbsp_init(MemoryRegion *system_memory, target_phys_addr_t base, qemu_irq *irq, qemu_irq *dma, omap_clk clk) { struct omap_mcbsp_s *s = (struct omap_mcbsp_s *) g_malloc0(sizeof(struct omap_mcbsp_s)); s->txirq = irq[0]; s->rxirq = irq[1]; s->txdrq = dma[0]; s->rxdrq = dma[1]; s->sink_timer = qemu_new_timer_ns(vm_clock, omap_mcbsp_sink_tick, s); s->source_timer = qemu_new_timer_ns(vm_clock, omap_mcbsp_source_tick, s); omap_mcbsp_reset(s); memory_region_init_io(&s->iomem, &omap_mcbsp_ops, s, "omap-mcbsp", 0x800); memory_region_add_subregion(system_memory, base, &s->iomem); return s; }
{ "code": [], "line_no": [] }
struct omap_mcbsp_s *FUNC_0(MemoryRegion *VAR_0, target_phys_addr_t VAR_1, qemu_irq *VAR_2, qemu_irq *VAR_3, omap_clk VAR_4) { struct omap_mcbsp_s *VAR_5 = (struct omap_mcbsp_s *) g_malloc0(sizeof(struct omap_mcbsp_s)); VAR_5->txirq = VAR_2[0]; VAR_5->rxirq = VAR_2[1]; VAR_5->txdrq = VAR_3[0]; VAR_5->rxdrq = VAR_3[1]; VAR_5->sink_timer = qemu_new_timer_ns(vm_clock, omap_mcbsp_sink_tick, VAR_5); VAR_5->source_timer = qemu_new_timer_ns(vm_clock, omap_mcbsp_source_tick, VAR_5); omap_mcbsp_reset(VAR_5); memory_region_init_io(&VAR_5->iomem, &omap_mcbsp_ops, VAR_5, "omap-mcbsp", 0x800); memory_region_add_subregion(VAR_0, VAR_1, &VAR_5->iomem); return VAR_5; }
[ "struct omap_mcbsp_s *FUNC_0(MemoryRegion *VAR_0,\ntarget_phys_addr_t VAR_1,\nqemu_irq *VAR_2, qemu_irq *VAR_3, omap_clk VAR_4)\n{", "struct omap_mcbsp_s *VAR_5 = (struct omap_mcbsp_s *)\ng_malloc0(sizeof(struct omap_mcbsp_s));", "VAR_5->txirq = VAR_2[0];", "VAR_5->rxirq = VAR_2[1];", "VAR_5->txdrq = VAR_3[0];", "VAR_5->rxdrq = VAR_3[1];", "VAR_5->sink_timer = qemu_new_timer_ns(vm_clock, omap_mcbsp_sink_tick, VAR_5);", "VAR_5->source_timer = qemu_new_timer_ns(vm_clock, omap_mcbsp_source_tick, VAR_5);", "omap_mcbsp_reset(VAR_5);", "memory_region_init_io(&VAR_5->iomem, &omap_mcbsp_ops, VAR_5, \"omap-mcbsp\", 0x800);", "memory_region_add_subregion(VAR_0, VAR_1, &VAR_5->iomem);", "return VAR_5;", "}" ]
[ 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 ] ]
24,198
static target_ulong h_rtas(PowerPCCPU *cpu, sPAPREnvironment *spapr, target_ulong opcode, target_ulong *args) { target_ulong rtas_r3 = args[0]; uint32_t token = ldl_be_phys(rtas_r3); uint32_t nargs = ldl_be_phys(rtas_r3 + 4); uint32_t nret = ldl_be_phys(rtas_r3 + 8); return spapr_rtas_call(spapr, token, nargs, rtas_r3 + 12, nret, rtas_r3 + 12 + 4*nargs); }
false
qemu
210b580b106fa798149e28aa13c66b325a43204e
static target_ulong h_rtas(PowerPCCPU *cpu, sPAPREnvironment *spapr, target_ulong opcode, target_ulong *args) { target_ulong rtas_r3 = args[0]; uint32_t token = ldl_be_phys(rtas_r3); uint32_t nargs = ldl_be_phys(rtas_r3 + 4); uint32_t nret = ldl_be_phys(rtas_r3 + 8); return spapr_rtas_call(spapr, token, nargs, rtas_r3 + 12, nret, rtas_r3 + 12 + 4*nargs); }
{ "code": [], "line_no": [] }
static target_ulong FUNC_0(PowerPCCPU *cpu, sPAPREnvironment *spapr, target_ulong opcode, target_ulong *args) { target_ulong rtas_r3 = args[0]; uint32_t token = ldl_be_phys(rtas_r3); uint32_t nargs = ldl_be_phys(rtas_r3 + 4); uint32_t nret = ldl_be_phys(rtas_r3 + 8); return spapr_rtas_call(spapr, token, nargs, rtas_r3 + 12, nret, rtas_r3 + 12 + 4*nargs); }
[ "static target_ulong FUNC_0(PowerPCCPU *cpu, sPAPREnvironment *spapr,\ntarget_ulong opcode, target_ulong *args)\n{", "target_ulong rtas_r3 = args[0];", "uint32_t token = ldl_be_phys(rtas_r3);", "uint32_t nargs = ldl_be_phys(rtas_r3 + 4);", "uint32_t nret = ldl_be_phys(rtas_r3 + 8);", "return spapr_rtas_call(spapr, token, nargs, rtas_r3 + 12,\nnret, rtas_r3 + 12 + 4*nargs);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17, 19 ], [ 21 ] ]
24,202
static void do_info_balloon(Monitor *mon, QObject **ret_data) { ram_addr_t actual; actual = qemu_balloon_status(); if (kvm_enabled() && !kvm_has_sync_mmu()) qemu_error_new(QERR_KVM_MISSING_CAP, "synchronous MMU", "balloon"); else if (actual == 0) qemu_error_new(QERR_DEVICE_NOT_ACTIVE, "balloon"); else *ret_data = qobject_from_jsonf("{ 'balloon': %" PRId64 "}", (int64_t) actual); }
false
qemu
cfdf2c40577ed99bb19cdc05d0537e2808d77a78
static void do_info_balloon(Monitor *mon, QObject **ret_data) { ram_addr_t actual; actual = qemu_balloon_status(); if (kvm_enabled() && !kvm_has_sync_mmu()) qemu_error_new(QERR_KVM_MISSING_CAP, "synchronous MMU", "balloon"); else if (actual == 0) qemu_error_new(QERR_DEVICE_NOT_ACTIVE, "balloon"); else *ret_data = qobject_from_jsonf("{ 'balloon': %" PRId64 "}", (int64_t) actual); }
{ "code": [], "line_no": [] }
static void FUNC_0(Monitor *VAR_0, QObject **VAR_1) { ram_addr_t actual; actual = qemu_balloon_status(); if (kvm_enabled() && !kvm_has_sync_mmu()) qemu_error_new(QERR_KVM_MISSING_CAP, "synchronous MMU", "balloon"); else if (actual == 0) qemu_error_new(QERR_DEVICE_NOT_ACTIVE, "balloon"); else *VAR_1 = qobject_from_jsonf("{ 'balloon': %" PRId64 "}", (int64_t) actual); }
[ "static void FUNC_0(Monitor *VAR_0, QObject **VAR_1)\n{", "ram_addr_t actual;", "actual = qemu_balloon_status();", "if (kvm_enabled() && !kvm_has_sync_mmu())\nqemu_error_new(QERR_KVM_MISSING_CAP, \"synchronous MMU\", \"balloon\");", "else if (actual == 0)\nqemu_error_new(QERR_DEVICE_NOT_ACTIVE, \"balloon\");", "else\n*VAR_1 = qobject_from_jsonf(\"{ 'balloon': %\" PRId64 \"}\",", "(int64_t) actual);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11, 13 ], [ 15, 17 ], [ 19, 21 ], [ 23 ], [ 25 ] ]
24,203
static void virtio_scsi_hotplug(SCSIBus *bus, SCSIDevice *dev) { VirtIOSCSI *s = container_of(bus, VirtIOSCSI, bus); if (((s->vdev.guest_features >> VIRTIO_SCSI_F_HOTPLUG) & 1) && (s->vdev.status & VIRTIO_CONFIG_S_DRIVER_OK)) { virtio_scsi_push_event(s, dev, VIRTIO_SCSI_T_TRANSPORT_RESET, VIRTIO_SCSI_EVT_RESET_RESCAN); } }
false
qemu
cd41a671b370a3dd603963432d2b02f1e5990fb7
static void virtio_scsi_hotplug(SCSIBus *bus, SCSIDevice *dev) { VirtIOSCSI *s = container_of(bus, VirtIOSCSI, bus); if (((s->vdev.guest_features >> VIRTIO_SCSI_F_HOTPLUG) & 1) && (s->vdev.status & VIRTIO_CONFIG_S_DRIVER_OK)) { virtio_scsi_push_event(s, dev, VIRTIO_SCSI_T_TRANSPORT_RESET, VIRTIO_SCSI_EVT_RESET_RESCAN); } }
{ "code": [], "line_no": [] }
static void FUNC_0(SCSIBus *VAR_0, SCSIDevice *VAR_1) { VirtIOSCSI *s = container_of(VAR_0, VirtIOSCSI, VAR_0); if (((s->vdev.guest_features >> VIRTIO_SCSI_F_HOTPLUG) & 1) && (s->vdev.status & VIRTIO_CONFIG_S_DRIVER_OK)) { virtio_scsi_push_event(s, VAR_1, VIRTIO_SCSI_T_TRANSPORT_RESET, VIRTIO_SCSI_EVT_RESET_RESCAN); } }
[ "static void FUNC_0(SCSIBus *VAR_0, SCSIDevice *VAR_1)\n{", "VirtIOSCSI *s = container_of(VAR_0, VirtIOSCSI, VAR_0);", "if (((s->vdev.guest_features >> VIRTIO_SCSI_F_HOTPLUG) & 1) &&\n(s->vdev.status & VIRTIO_CONFIG_S_DRIVER_OK)) {", "virtio_scsi_push_event(s, VAR_1, VIRTIO_SCSI_T_TRANSPORT_RESET,\nVIRTIO_SCSI_EVT_RESET_RESCAN);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11 ], [ 13, 15 ], [ 17 ], [ 19 ] ]
24,204
void qio_channel_socket_listen_async(QIOChannelSocket *ioc, SocketAddressLegacy *addr, QIOTaskFunc callback, gpointer opaque, GDestroyNotify destroy) { QIOTask *task = qio_task_new( OBJECT(ioc), callback, opaque, destroy); SocketAddressLegacy *addrCopy; addrCopy = QAPI_CLONE(SocketAddressLegacy, addr); /* socket_listen() blocks in DNS lookups, so we must use a thread */ trace_qio_channel_socket_listen_async(ioc, addr); qio_task_run_in_thread(task, qio_channel_socket_listen_worker, addrCopy, (GDestroyNotify)qapi_free_SocketAddressLegacy); }
false
qemu
bd269ebc82fbaa5fe7ce5bc7c1770ac8acecd884
void qio_channel_socket_listen_async(QIOChannelSocket *ioc, SocketAddressLegacy *addr, QIOTaskFunc callback, gpointer opaque, GDestroyNotify destroy) { QIOTask *task = qio_task_new( OBJECT(ioc), callback, opaque, destroy); SocketAddressLegacy *addrCopy; addrCopy = QAPI_CLONE(SocketAddressLegacy, addr); trace_qio_channel_socket_listen_async(ioc, addr); qio_task_run_in_thread(task, qio_channel_socket_listen_worker, addrCopy, (GDestroyNotify)qapi_free_SocketAddressLegacy); }
{ "code": [], "line_no": [] }
void FUNC_0(QIOChannelSocket *VAR_0, SocketAddressLegacy *VAR_1, QIOTaskFunc VAR_2, gpointer VAR_3, GDestroyNotify VAR_4) { QIOTask *task = qio_task_new( OBJECT(VAR_0), VAR_2, VAR_3, VAR_4); SocketAddressLegacy *addrCopy; addrCopy = QAPI_CLONE(SocketAddressLegacy, VAR_1); trace_qio_channel_socket_listen_async(VAR_0, VAR_1); qio_task_run_in_thread(task, qio_channel_socket_listen_worker, addrCopy, (GDestroyNotify)qapi_free_SocketAddressLegacy); }
[ "void FUNC_0(QIOChannelSocket *VAR_0,\nSocketAddressLegacy *VAR_1,\nQIOTaskFunc VAR_2,\ngpointer VAR_3,\nGDestroyNotify VAR_4)\n{", "QIOTask *task = qio_task_new(\nOBJECT(VAR_0), VAR_2, VAR_3, VAR_4);", "SocketAddressLegacy *addrCopy;", "addrCopy = QAPI_CLONE(SocketAddressLegacy, VAR_1);", "trace_qio_channel_socket_listen_async(VAR_0, VAR_1);", "qio_task_run_in_thread(task,\nqio_channel_socket_listen_worker,\naddrCopy,\n(GDestroyNotify)qapi_free_SocketAddressLegacy);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11 ], [ 13, 15 ], [ 17 ], [ 21 ], [ 27 ], [ 29, 31, 33, 35 ], [ 37 ] ]
24,207
static void bmdma_write(void *opaque, target_phys_addr_t addr, uint64_t val, unsigned size) { BMDMAState *bm = opaque; if (size != 1) { return; } #ifdef DEBUG_IDE printf("bmdma: writeb 0x%02x : 0x%02x\n", addr, val); #endif switch (addr & 3) { case 0: bmdma_cmd_writeb(bm, val); break; case 2: bm->status = (val & 0x60) | (bm->status & 1) | (bm->status & ~val & 0x06); break; default:; } }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static void bmdma_write(void *opaque, target_phys_addr_t addr, uint64_t val, unsigned size) { BMDMAState *bm = opaque; if (size != 1) { return; } #ifdef DEBUG_IDE printf("bmdma: writeb 0x%02x : 0x%02x\n", addr, val); #endif switch (addr & 3) { case 0: bmdma_cmd_writeb(bm, val); break; case 2: bm->status = (val & 0x60) | (bm->status & 1) | (bm->status & ~val & 0x06); break; default:; } }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1, uint64_t VAR_2, unsigned VAR_3) { BMDMAState *bm = VAR_0; if (VAR_3 != 1) { return; } #ifdef DEBUG_IDE printf("bmdma: writeb 0x%02x : 0x%02x\n", VAR_1, VAR_2); #endif switch (VAR_1 & 3) { case 0: bmdma_cmd_writeb(bm, VAR_2); break; case 2: bm->status = (VAR_2 & 0x60) | (bm->status & 1) | (bm->status & ~VAR_2 & 0x06); break; default:; } }
[ "static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1,\nuint64_t VAR_2, unsigned VAR_3)\n{", "BMDMAState *bm = VAR_0;", "if (VAR_3 != 1) {", "return;", "}", "#ifdef DEBUG_IDE\nprintf(\"bmdma: writeb 0x%02x : 0x%02x\\n\", VAR_1, VAR_2);", "#endif\nswitch (VAR_1 & 3) {", "case 0:\nbmdma_cmd_writeb(bm, VAR_2);", "break;", "case 2:\nbm->status = (VAR_2 & 0x60) | (bm->status & 1) | (bm->status & ~VAR_2 & 0x06);", "break;", "default:;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 19, 21 ], [ 23, 25 ], [ 27, 29 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ] ]
24,208
int bdrv_open(BlockDriverState *bs, const char *filename, int flags, BlockDriver *drv) { int ret, open_flags; char tmp_filename[PATH_MAX]; char backing_filename[PATH_MAX]; bs->is_temporary = 0; bs->encrypted = 0; bs->valid_key = 0; bs->open_flags = flags; /* buffer_alignment defaulted to 512, drivers can change this value */ bs->buffer_alignment = 512; if (flags & BDRV_O_SNAPSHOT) { BlockDriverState *bs1; int64_t total_size; int is_protocol = 0; BlockDriver *bdrv_qcow2; QEMUOptionParameter *options; /* if snapshot, we create a temporary backing file and open it instead of opening 'filename' directly */ /* if there is a backing file, use it */ bs1 = bdrv_new(""); ret = bdrv_open(bs1, filename, 0, drv); if (ret < 0) { bdrv_delete(bs1); return ret; } total_size = bdrv_getlength(bs1) >> BDRV_SECTOR_BITS; if (bs1->drv && bs1->drv->protocol_name) is_protocol = 1; bdrv_delete(bs1); get_tmp_filename(tmp_filename, sizeof(tmp_filename)); /* Real path is meaningless for protocols */ if (is_protocol) snprintf(backing_filename, sizeof(backing_filename), "%s", filename); else if (!realpath(filename, backing_filename)) return -errno; bdrv_qcow2 = bdrv_find_format("qcow2"); options = parse_option_parameters("", bdrv_qcow2->create_options, NULL); set_option_parameter_int(options, BLOCK_OPT_SIZE, total_size * 512); set_option_parameter(options, BLOCK_OPT_BACKING_FILE, backing_filename); if (drv) { set_option_parameter(options, BLOCK_OPT_BACKING_FMT, drv->format_name); } ret = bdrv_create(bdrv_qcow2, tmp_filename, options); if (ret < 0) { return ret; } filename = tmp_filename; drv = bdrv_qcow2; bs->is_temporary = 1; } pstrcpy(bs->filename, sizeof(bs->filename), filename); if (!drv) { drv = find_hdev_driver(filename); if (!drv) { drv = find_image_format(filename); } } if (!drv) { ret = -ENOENT; goto unlink_and_fail; } if (use_bdrv_whitelist && !bdrv_is_whitelisted(drv)) { ret = -ENOTSUP; goto unlink_and_fail; } bs->drv = drv; bs->opaque = qemu_mallocz(drv->instance_size); /* * Yes, BDRV_O_NOCACHE aka O_DIRECT means we have to present a * write cache to the guest. We do need the fdatasync to flush * out transactions for block allocations, and we maybe have a * volatile write cache in our backing device to deal with. */ if (flags & (BDRV_O_CACHE_WB|BDRV_O_NOCACHE)) bs->enable_write_cache = 1; /* * Clear flags that are internal to the block layer before opening the * image. */ open_flags = flags & ~(BDRV_O_SNAPSHOT | BDRV_O_NO_BACKING); /* * Snapshots should be writeable. */ if (bs->is_temporary) { open_flags |= BDRV_O_RDWR; } ret = drv->bdrv_open(bs, filename, open_flags); if (ret < 0) { goto free_and_fail; } bs->keep_read_only = bs->read_only = !(open_flags & BDRV_O_RDWR); if (drv->bdrv_getlength) { bs->total_sectors = bdrv_getlength(bs) >> BDRV_SECTOR_BITS; } #ifndef _WIN32 if (bs->is_temporary) { unlink(filename); } #endif if ((flags & BDRV_O_NO_BACKING) == 0 && bs->backing_file[0] != '\0') { /* if there is a backing file, use it */ BlockDriver *back_drv = NULL; bs->backing_hd = bdrv_new(""); path_combine(backing_filename, sizeof(backing_filename), filename, bs->backing_file); if (bs->backing_format[0] != '\0') back_drv = bdrv_find_format(bs->backing_format); /* backing files always opened read-only */ open_flags &= ~BDRV_O_RDWR; ret = bdrv_open(bs->backing_hd, backing_filename, open_flags, back_drv); if (ret < 0) { bdrv_close(bs); return ret; } if (bs->is_temporary) { bs->backing_hd->keep_read_only = !(flags & BDRV_O_RDWR); } else { /* base image inherits from "parent" */ bs->backing_hd->keep_read_only = bs->keep_read_only; } } if (!bdrv_key_required(bs)) { /* call the change callback */ bs->media_changed = 1; if (bs->change_cb) bs->change_cb(bs->change_opaque); } return 0; free_and_fail: qemu_free(bs->opaque); bs->opaque = NULL; bs->drv = NULL; unlink_and_fail: if (bs->is_temporary) unlink(filename); return ret; }
false
qemu
84a12e6648444f517055138a7d7f25a22d7e1029
int bdrv_open(BlockDriverState *bs, const char *filename, int flags, BlockDriver *drv) { int ret, open_flags; char tmp_filename[PATH_MAX]; char backing_filename[PATH_MAX]; bs->is_temporary = 0; bs->encrypted = 0; bs->valid_key = 0; bs->open_flags = flags; bs->buffer_alignment = 512; if (flags & BDRV_O_SNAPSHOT) { BlockDriverState *bs1; int64_t total_size; int is_protocol = 0; BlockDriver *bdrv_qcow2; QEMUOptionParameter *options; bs1 = bdrv_new(""); ret = bdrv_open(bs1, filename, 0, drv); if (ret < 0) { bdrv_delete(bs1); return ret; } total_size = bdrv_getlength(bs1) >> BDRV_SECTOR_BITS; if (bs1->drv && bs1->drv->protocol_name) is_protocol = 1; bdrv_delete(bs1); get_tmp_filename(tmp_filename, sizeof(tmp_filename)); if (is_protocol) snprintf(backing_filename, sizeof(backing_filename), "%s", filename); else if (!realpath(filename, backing_filename)) return -errno; bdrv_qcow2 = bdrv_find_format("qcow2"); options = parse_option_parameters("", bdrv_qcow2->create_options, NULL); set_option_parameter_int(options, BLOCK_OPT_SIZE, total_size * 512); set_option_parameter(options, BLOCK_OPT_BACKING_FILE, backing_filename); if (drv) { set_option_parameter(options, BLOCK_OPT_BACKING_FMT, drv->format_name); } ret = bdrv_create(bdrv_qcow2, tmp_filename, options); if (ret < 0) { return ret; } filename = tmp_filename; drv = bdrv_qcow2; bs->is_temporary = 1; } pstrcpy(bs->filename, sizeof(bs->filename), filename); if (!drv) { drv = find_hdev_driver(filename); if (!drv) { drv = find_image_format(filename); } } if (!drv) { ret = -ENOENT; goto unlink_and_fail; } if (use_bdrv_whitelist && !bdrv_is_whitelisted(drv)) { ret = -ENOTSUP; goto unlink_and_fail; } bs->drv = drv; bs->opaque = qemu_mallocz(drv->instance_size); if (flags & (BDRV_O_CACHE_WB|BDRV_O_NOCACHE)) bs->enable_write_cache = 1; open_flags = flags & ~(BDRV_O_SNAPSHOT | BDRV_O_NO_BACKING); if (bs->is_temporary) { open_flags |= BDRV_O_RDWR; } ret = drv->bdrv_open(bs, filename, open_flags); if (ret < 0) { goto free_and_fail; } bs->keep_read_only = bs->read_only = !(open_flags & BDRV_O_RDWR); if (drv->bdrv_getlength) { bs->total_sectors = bdrv_getlength(bs) >> BDRV_SECTOR_BITS; } #ifndef _WIN32 if (bs->is_temporary) { unlink(filename); } #endif if ((flags & BDRV_O_NO_BACKING) == 0 && bs->backing_file[0] != '\0') { BlockDriver *back_drv = NULL; bs->backing_hd = bdrv_new(""); path_combine(backing_filename, sizeof(backing_filename), filename, bs->backing_file); if (bs->backing_format[0] != '\0') back_drv = bdrv_find_format(bs->backing_format); open_flags &= ~BDRV_O_RDWR; ret = bdrv_open(bs->backing_hd, backing_filename, open_flags, back_drv); if (ret < 0) { bdrv_close(bs); return ret; } if (bs->is_temporary) { bs->backing_hd->keep_read_only = !(flags & BDRV_O_RDWR); } else { bs->backing_hd->keep_read_only = bs->keep_read_only; } } if (!bdrv_key_required(bs)) { bs->media_changed = 1; if (bs->change_cb) bs->change_cb(bs->change_opaque); } return 0; free_and_fail: qemu_free(bs->opaque); bs->opaque = NULL; bs->drv = NULL; unlink_and_fail: if (bs->is_temporary) unlink(filename); return ret; }
{ "code": [], "line_no": [] }
int FUNC_0(BlockDriverState *VAR_0, const char *VAR_1, int VAR_2, BlockDriver *VAR_3) { int VAR_4, VAR_5; char VAR_6[PATH_MAX]; char VAR_7[PATH_MAX]; VAR_0->is_temporary = 0; VAR_0->encrypted = 0; VAR_0->valid_key = 0; VAR_0->VAR_5 = VAR_2; VAR_0->buffer_alignment = 512; if (VAR_2 & BDRV_O_SNAPSHOT) { BlockDriverState *bs1; int64_t total_size; int VAR_8 = 0; BlockDriver *bdrv_qcow2; QEMUOptionParameter *options; bs1 = bdrv_new(""); VAR_4 = FUNC_0(bs1, VAR_1, 0, VAR_3); if (VAR_4 < 0) { bdrv_delete(bs1); return VAR_4; } total_size = bdrv_getlength(bs1) >> BDRV_SECTOR_BITS; if (bs1->VAR_3 && bs1->VAR_3->protocol_name) VAR_8 = 1; bdrv_delete(bs1); get_tmp_filename(VAR_6, sizeof(VAR_6)); if (VAR_8) snprintf(VAR_7, sizeof(VAR_7), "%s", VAR_1); else if (!realpath(VAR_1, VAR_7)) return -errno; bdrv_qcow2 = bdrv_find_format("qcow2"); options = parse_option_parameters("", bdrv_qcow2->create_options, NULL); set_option_parameter_int(options, BLOCK_OPT_SIZE, total_size * 512); set_option_parameter(options, BLOCK_OPT_BACKING_FILE, VAR_7); if (VAR_3) { set_option_parameter(options, BLOCK_OPT_BACKING_FMT, VAR_3->format_name); } VAR_4 = bdrv_create(bdrv_qcow2, VAR_6, options); if (VAR_4 < 0) { return VAR_4; } VAR_1 = VAR_6; VAR_3 = bdrv_qcow2; VAR_0->is_temporary = 1; } pstrcpy(VAR_0->VAR_1, sizeof(VAR_0->VAR_1), VAR_1); if (!VAR_3) { VAR_3 = find_hdev_driver(VAR_1); if (!VAR_3) { VAR_3 = find_image_format(VAR_1); } } if (!VAR_3) { VAR_4 = -ENOENT; goto unlink_and_fail; } if (use_bdrv_whitelist && !bdrv_is_whitelisted(VAR_3)) { VAR_4 = -ENOTSUP; goto unlink_and_fail; } VAR_0->VAR_3 = VAR_3; VAR_0->opaque = qemu_mallocz(VAR_3->instance_size); if (VAR_2 & (BDRV_O_CACHE_WB|BDRV_O_NOCACHE)) VAR_0->enable_write_cache = 1; VAR_5 = VAR_2 & ~(BDRV_O_SNAPSHOT | BDRV_O_NO_BACKING); if (VAR_0->is_temporary) { VAR_5 |= BDRV_O_RDWR; } VAR_4 = VAR_3->FUNC_0(VAR_0, VAR_1, VAR_5); if (VAR_4 < 0) { goto free_and_fail; } VAR_0->keep_read_only = VAR_0->read_only = !(VAR_5 & BDRV_O_RDWR); if (VAR_3->bdrv_getlength) { VAR_0->total_sectors = bdrv_getlength(VAR_0) >> BDRV_SECTOR_BITS; } #ifndef _WIN32 if (VAR_0->is_temporary) { unlink(VAR_1); } #endif if ((VAR_2 & BDRV_O_NO_BACKING) == 0 && VAR_0->backing_file[0] != '\0') { BlockDriver *back_drv = NULL; VAR_0->backing_hd = bdrv_new(""); path_combine(VAR_7, sizeof(VAR_7), VAR_1, VAR_0->backing_file); if (VAR_0->backing_format[0] != '\0') back_drv = bdrv_find_format(VAR_0->backing_format); VAR_5 &= ~BDRV_O_RDWR; VAR_4 = FUNC_0(VAR_0->backing_hd, VAR_7, VAR_5, back_drv); if (VAR_4 < 0) { bdrv_close(VAR_0); return VAR_4; } if (VAR_0->is_temporary) { VAR_0->backing_hd->keep_read_only = !(VAR_2 & BDRV_O_RDWR); } else { VAR_0->backing_hd->keep_read_only = VAR_0->keep_read_only; } } if (!bdrv_key_required(VAR_0)) { VAR_0->media_changed = 1; if (VAR_0->change_cb) VAR_0->change_cb(VAR_0->change_opaque); } return 0; free_and_fail: qemu_free(VAR_0->opaque); VAR_0->opaque = NULL; VAR_0->VAR_3 = NULL; unlink_and_fail: if (VAR_0->is_temporary) unlink(VAR_1); return VAR_4; }
[ "int FUNC_0(BlockDriverState *VAR_0, const char *VAR_1, int VAR_2,\nBlockDriver *VAR_3)\n{", "int VAR_4, VAR_5;", "char VAR_6[PATH_MAX];", "char VAR_7[PATH_MAX];", "VAR_0->is_temporary = 0;", "VAR_0->encrypted = 0;", "VAR_0->valid_key = 0;", "VAR_0->VAR_5 = VAR_2;", "VAR_0->buffer_alignment = 512;", "if (VAR_2 & BDRV_O_SNAPSHOT) {", "BlockDriverState *bs1;", "int64_t total_size;", "int VAR_8 = 0;", "BlockDriver *bdrv_qcow2;", "QEMUOptionParameter *options;", "bs1 = bdrv_new(\"\");", "VAR_4 = FUNC_0(bs1, VAR_1, 0, VAR_3);", "if (VAR_4 < 0) {", "bdrv_delete(bs1);", "return VAR_4;", "}", "total_size = bdrv_getlength(bs1) >> BDRV_SECTOR_BITS;", "if (bs1->VAR_3 && bs1->VAR_3->protocol_name)\nVAR_8 = 1;", "bdrv_delete(bs1);", "get_tmp_filename(VAR_6, sizeof(VAR_6));", "if (VAR_8)\nsnprintf(VAR_7, sizeof(VAR_7),\n\"%s\", VAR_1);", "else if (!realpath(VAR_1, VAR_7))\nreturn -errno;", "bdrv_qcow2 = bdrv_find_format(\"qcow2\");", "options = parse_option_parameters(\"\", bdrv_qcow2->create_options, NULL);", "set_option_parameter_int(options, BLOCK_OPT_SIZE, total_size * 512);", "set_option_parameter(options, BLOCK_OPT_BACKING_FILE, VAR_7);", "if (VAR_3) {", "set_option_parameter(options, BLOCK_OPT_BACKING_FMT,\nVAR_3->format_name);", "}", "VAR_4 = bdrv_create(bdrv_qcow2, VAR_6, options);", "if (VAR_4 < 0) {", "return VAR_4;", "}", "VAR_1 = VAR_6;", "VAR_3 = bdrv_qcow2;", "VAR_0->is_temporary = 1;", "}", "pstrcpy(VAR_0->VAR_1, sizeof(VAR_0->VAR_1), VAR_1);", "if (!VAR_3) {", "VAR_3 = find_hdev_driver(VAR_1);", "if (!VAR_3) {", "VAR_3 = find_image_format(VAR_1);", "}", "}", "if (!VAR_3) {", "VAR_4 = -ENOENT;", "goto unlink_and_fail;", "}", "if (use_bdrv_whitelist && !bdrv_is_whitelisted(VAR_3)) {", "VAR_4 = -ENOTSUP;", "goto unlink_and_fail;", "}", "VAR_0->VAR_3 = VAR_3;", "VAR_0->opaque = qemu_mallocz(VAR_3->instance_size);", "if (VAR_2 & (BDRV_O_CACHE_WB|BDRV_O_NOCACHE))\nVAR_0->enable_write_cache = 1;", "VAR_5 = VAR_2 & ~(BDRV_O_SNAPSHOT | BDRV_O_NO_BACKING);", "if (VAR_0->is_temporary) {", "VAR_5 |= BDRV_O_RDWR;", "}", "VAR_4 = VAR_3->FUNC_0(VAR_0, VAR_1, VAR_5);", "if (VAR_4 < 0) {", "goto free_and_fail;", "}", "VAR_0->keep_read_only = VAR_0->read_only = !(VAR_5 & BDRV_O_RDWR);", "if (VAR_3->bdrv_getlength) {", "VAR_0->total_sectors = bdrv_getlength(VAR_0) >> BDRV_SECTOR_BITS;", "}", "#ifndef _WIN32\nif (VAR_0->is_temporary) {", "unlink(VAR_1);", "}", "#endif\nif ((VAR_2 & BDRV_O_NO_BACKING) == 0 && VAR_0->backing_file[0] != '\\0') {", "BlockDriver *back_drv = NULL;", "VAR_0->backing_hd = bdrv_new(\"\");", "path_combine(VAR_7, sizeof(VAR_7),\nVAR_1, VAR_0->backing_file);", "if (VAR_0->backing_format[0] != '\\0')\nback_drv = bdrv_find_format(VAR_0->backing_format);", "VAR_5 &= ~BDRV_O_RDWR;", "VAR_4 = FUNC_0(VAR_0->backing_hd, VAR_7, VAR_5, back_drv);", "if (VAR_4 < 0) {", "bdrv_close(VAR_0);", "return VAR_4;", "}", "if (VAR_0->is_temporary) {", "VAR_0->backing_hd->keep_read_only = !(VAR_2 & BDRV_O_RDWR);", "} else {", "VAR_0->backing_hd->keep_read_only = VAR_0->keep_read_only;", "}", "}", "if (!bdrv_key_required(VAR_0)) {", "VAR_0->media_changed = 1;", "if (VAR_0->change_cb)\nVAR_0->change_cb(VAR_0->change_opaque);", "}", "return 0;", "free_and_fail:\nqemu_free(VAR_0->opaque);", "VAR_0->opaque = NULL;", "VAR_0->VAR_3 = NULL;", "unlink_and_fail:\nif (VAR_0->is_temporary)\nunlink(VAR_1);", "return VAR_4;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67, 69 ], [ 73 ], [ 77 ], [ 83, 85, 87 ], [ 89, 91 ], [ 95 ], [ 97 ], [ 101 ], [ 103 ], [ 105 ], [ 107, 109 ], [ 111 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 135 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 171 ], [ 173 ], [ 189, 191 ], [ 203 ], [ 213 ], [ 215 ], [ 217 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239, 241 ], [ 243 ], [ 245 ], [ 247, 249 ], [ 253 ], [ 255 ], [ 257, 259 ], [ 261, 263 ], [ 269 ], [ 273 ], [ 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 287 ], [ 291 ], [ 293 ], [ 295 ], [ 299 ], [ 303 ], [ 305, 307 ], [ 309 ], [ 311 ], [ 315, 317 ], [ 319 ], [ 321 ], [ 323, 325, 327 ], [ 329 ], [ 331 ] ]
24,209
static uint32_t omap_l4_io_readw(void *opaque, target_phys_addr_t addr) { unsigned int i = (addr - OMAP2_L4_BASE) >> TARGET_PAGE_BITS; return omap_l4_io_readw_fn[i](omap_l4_io_opaque[i], addr); }
false
qemu
92c0bba9a95739c92e959fe478cb1acb92fa5446
static uint32_t omap_l4_io_readw(void *opaque, target_phys_addr_t addr) { unsigned int i = (addr - OMAP2_L4_BASE) >> TARGET_PAGE_BITS; return omap_l4_io_readw_fn[i](omap_l4_io_opaque[i], addr); }
{ "code": [], "line_no": [] }
static uint32_t FUNC_0(void *opaque, target_phys_addr_t addr) { unsigned int VAR_0 = (addr - OMAP2_L4_BASE) >> TARGET_PAGE_BITS; return omap_l4_io_readw_fn[VAR_0](omap_l4_io_opaque[VAR_0], addr); }
[ "static uint32_t FUNC_0(void *opaque, target_phys_addr_t addr)\n{", "unsigned int VAR_0 = (addr - OMAP2_L4_BASE) >> TARGET_PAGE_BITS;", "return omap_l4_io_readw_fn[VAR_0](omap_l4_io_opaque[VAR_0], addr);", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ] ]
24,210
PCIBus *typhoon_init(ram_addr_t ram_size, ISABus **isa_bus, qemu_irq *p_rtc_irq, AlphaCPU *cpus[4], pci_map_irq_fn sys_map_irq) { const uint64_t MB = 1024 * 1024; const uint64_t GB = 1024 * MB; MemoryRegion *addr_space = get_system_memory(); DeviceState *dev; TyphoonState *s; PCIHostState *phb; PCIBus *b; int i; dev = qdev_create(NULL, TYPE_TYPHOON_PCI_HOST_BRIDGE); qdev_init_nofail(dev); s = TYPHOON_PCI_HOST_BRIDGE(dev); phb = PCI_HOST_BRIDGE(dev); /* Remember the CPUs so that we can deliver interrupts to them. */ for (i = 0; i < 4; i++) { AlphaCPU *cpu = cpus[i]; s->cchip.cpu[i] = cpu; if (cpu != NULL) { cpu->alarm_timer = qemu_new_timer_ns(rtc_clock, typhoon_alarm_timer, (void *)((uintptr_t)s + i)); } } *p_rtc_irq = *qemu_allocate_irqs(typhoon_set_timer_irq, s, 1); /* Main memory region, 0x00.0000.0000. Real hardware supports 32GB, but the address space hole reserved at this point is 8TB. */ memory_region_init_ram(&s->ram_region, OBJECT(s), "ram", ram_size); vmstate_register_ram_global(&s->ram_region); memory_region_add_subregion(addr_space, 0, &s->ram_region); /* TIGbus, 0x801.0000.0000, 1GB. */ /* ??? The TIGbus is used for delivering interrupts, and access to the flash ROM. I'm not sure that we need to implement it at all. */ /* Pchip0 CSRs, 0x801.8000.0000, 256MB. */ memory_region_init_io(&s->pchip.region, OBJECT(s), &pchip_ops, s, "pchip0", 256*MB); memory_region_add_subregion(addr_space, 0x80180000000ULL, &s->pchip.region); /* Cchip CSRs, 0x801.A000.0000, 256MB. */ memory_region_init_io(&s->cchip.region, OBJECT(s), &cchip_ops, s, "cchip0", 256*MB); memory_region_add_subregion(addr_space, 0x801a0000000ULL, &s->cchip.region); /* Dchip CSRs, 0x801.B000.0000, 256MB. */ memory_region_init_io(&s->dchip_region, OBJECT(s), &dchip_ops, s, "dchip0", 256*MB); memory_region_add_subregion(addr_space, 0x801b0000000ULL, &s->dchip_region); /* Pchip0 PCI memory, 0x800.0000.0000, 4GB. */ memory_region_init(&s->pchip.reg_mem, OBJECT(s), "pci0-mem", 4*GB); memory_region_add_subregion(addr_space, 0x80000000000ULL, &s->pchip.reg_mem); /* Pchip0 PCI I/O, 0x801.FC00.0000, 32MB. */ memory_region_init(&s->pchip.reg_io, OBJECT(s), "pci0-io", 32*MB); memory_region_add_subregion(addr_space, 0x801fc000000ULL, &s->pchip.reg_io); b = pci_register_bus(dev, "pci", typhoon_set_irq, sys_map_irq, s, &s->pchip.reg_mem, &s->pchip.reg_io, 0, 64, TYPE_PCI_BUS); phb->bus = b; /* Pchip0 PCI special/interrupt acknowledge, 0x801.F800.0000, 64MB. */ memory_region_init_io(&s->pchip.reg_iack, OBJECT(s), &alpha_pci_iack_ops, b, "pci0-iack", 64*MB); memory_region_add_subregion(addr_space, 0x801f8000000ULL, &s->pchip.reg_iack); /* Pchip0 PCI configuration, 0x801.FE00.0000, 16MB. */ memory_region_init_io(&s->pchip.reg_conf, OBJECT(s), &alpha_pci_conf1_ops, b, "pci0-conf", 16*MB); memory_region_add_subregion(addr_space, 0x801fe000000ULL, &s->pchip.reg_conf); /* For the record, these are the mappings for the second PCI bus. We can get away with not implementing them because we indicate via the Cchip.CSC<PIP> bit that Pchip1 is not present. */ /* Pchip1 PCI memory, 0x802.0000.0000, 4GB. */ /* Pchip1 CSRs, 0x802.8000.0000, 256MB. */ /* Pchip1 PCI special/interrupt acknowledge, 0x802.F800.0000, 64MB. */ /* Pchip1 PCI I/O, 0x802.FC00.0000, 32MB. */ /* Pchip1 PCI configuration, 0x802.FE00.0000, 16MB. */ /* Init the ISA bus. */ /* ??? Technically there should be a cy82c693ub pci-isa bridge. */ { qemu_irq isa_pci_irq, *isa_irqs; *isa_bus = isa_bus_new(NULL, &s->pchip.reg_io); isa_pci_irq = *qemu_allocate_irqs(typhoon_set_isa_irq, s, 1); isa_irqs = i8259_init(*isa_bus, isa_pci_irq); isa_bus_irqs(*isa_bus, isa_irqs); } return b; }
false
qemu
3661049fec64ffd7ab008e57e396881c6a4b53a4
PCIBus *typhoon_init(ram_addr_t ram_size, ISABus **isa_bus, qemu_irq *p_rtc_irq, AlphaCPU *cpus[4], pci_map_irq_fn sys_map_irq) { const uint64_t MB = 1024 * 1024; const uint64_t GB = 1024 * MB; MemoryRegion *addr_space = get_system_memory(); DeviceState *dev; TyphoonState *s; PCIHostState *phb; PCIBus *b; int i; dev = qdev_create(NULL, TYPE_TYPHOON_PCI_HOST_BRIDGE); qdev_init_nofail(dev); s = TYPHOON_PCI_HOST_BRIDGE(dev); phb = PCI_HOST_BRIDGE(dev); for (i = 0; i < 4; i++) { AlphaCPU *cpu = cpus[i]; s->cchip.cpu[i] = cpu; if (cpu != NULL) { cpu->alarm_timer = qemu_new_timer_ns(rtc_clock, typhoon_alarm_timer, (void *)((uintptr_t)s + i)); } } *p_rtc_irq = *qemu_allocate_irqs(typhoon_set_timer_irq, s, 1); memory_region_init_ram(&s->ram_region, OBJECT(s), "ram", ram_size); vmstate_register_ram_global(&s->ram_region); memory_region_add_subregion(addr_space, 0, &s->ram_region); memory_region_init_io(&s->pchip.region, OBJECT(s), &pchip_ops, s, "pchip0", 256*MB); memory_region_add_subregion(addr_space, 0x80180000000ULL, &s->pchip.region); memory_region_init_io(&s->cchip.region, OBJECT(s), &cchip_ops, s, "cchip0", 256*MB); memory_region_add_subregion(addr_space, 0x801a0000000ULL, &s->cchip.region); memory_region_init_io(&s->dchip_region, OBJECT(s), &dchip_ops, s, "dchip0", 256*MB); memory_region_add_subregion(addr_space, 0x801b0000000ULL, &s->dchip_region); memory_region_init(&s->pchip.reg_mem, OBJECT(s), "pci0-mem", 4*GB); memory_region_add_subregion(addr_space, 0x80000000000ULL, &s->pchip.reg_mem); memory_region_init(&s->pchip.reg_io, OBJECT(s), "pci0-io", 32*MB); memory_region_add_subregion(addr_space, 0x801fc000000ULL, &s->pchip.reg_io); b = pci_register_bus(dev, "pci", typhoon_set_irq, sys_map_irq, s, &s->pchip.reg_mem, &s->pchip.reg_io, 0, 64, TYPE_PCI_BUS); phb->bus = b; memory_region_init_io(&s->pchip.reg_iack, OBJECT(s), &alpha_pci_iack_ops, b, "pci0-iack", 64*MB); memory_region_add_subregion(addr_space, 0x801f8000000ULL, &s->pchip.reg_iack); memory_region_init_io(&s->pchip.reg_conf, OBJECT(s), &alpha_pci_conf1_ops, b, "pci0-conf", 16*MB); memory_region_add_subregion(addr_space, 0x801fe000000ULL, &s->pchip.reg_conf); { qemu_irq isa_pci_irq, *isa_irqs; *isa_bus = isa_bus_new(NULL, &s->pchip.reg_io); isa_pci_irq = *qemu_allocate_irqs(typhoon_set_isa_irq, s, 1); isa_irqs = i8259_init(*isa_bus, isa_pci_irq); isa_bus_irqs(*isa_bus, isa_irqs); } return b; }
{ "code": [], "line_no": [] }
PCIBus *FUNC_0(ram_addr_t ram_size, ISABus **isa_bus, qemu_irq *p_rtc_irq, AlphaCPU *cpus[4], pci_map_irq_fn sys_map_irq) { const uint64_t VAR_0 = 1024 * 1024; const uint64_t VAR_1 = 1024 * VAR_0; MemoryRegion *addr_space = get_system_memory(); DeviceState *dev; TyphoonState *s; PCIHostState *phb; PCIBus *b; int VAR_2; dev = qdev_create(NULL, TYPE_TYPHOON_PCI_HOST_BRIDGE); qdev_init_nofail(dev); s = TYPHOON_PCI_HOST_BRIDGE(dev); phb = PCI_HOST_BRIDGE(dev); for (VAR_2 = 0; VAR_2 < 4; VAR_2++) { AlphaCPU *cpu = cpus[VAR_2]; s->cchip.cpu[VAR_2] = cpu; if (cpu != NULL) { cpu->alarm_timer = qemu_new_timer_ns(rtc_clock, typhoon_alarm_timer, (void *)((uintptr_t)s + VAR_2)); } } *p_rtc_irq = *qemu_allocate_irqs(typhoon_set_timer_irq, s, 1); memory_region_init_ram(&s->ram_region, OBJECT(s), "ram", ram_size); vmstate_register_ram_global(&s->ram_region); memory_region_add_subregion(addr_space, 0, &s->ram_region); memory_region_init_io(&s->pchip.region, OBJECT(s), &pchip_ops, s, "pchip0", 256*VAR_0); memory_region_add_subregion(addr_space, 0x80180000000ULL, &s->pchip.region); memory_region_init_io(&s->cchip.region, OBJECT(s), &cchip_ops, s, "cchip0", 256*VAR_0); memory_region_add_subregion(addr_space, 0x801a0000000ULL, &s->cchip.region); memory_region_init_io(&s->dchip_region, OBJECT(s), &dchip_ops, s, "dchip0", 256*VAR_0); memory_region_add_subregion(addr_space, 0x801b0000000ULL, &s->dchip_region); memory_region_init(&s->pchip.reg_mem, OBJECT(s), "pci0-mem", 4*VAR_1); memory_region_add_subregion(addr_space, 0x80000000000ULL, &s->pchip.reg_mem); memory_region_init(&s->pchip.reg_io, OBJECT(s), "pci0-io", 32*VAR_0); memory_region_add_subregion(addr_space, 0x801fc000000ULL, &s->pchip.reg_io); b = pci_register_bus(dev, "pci", typhoon_set_irq, sys_map_irq, s, &s->pchip.reg_mem, &s->pchip.reg_io, 0, 64, TYPE_PCI_BUS); phb->bus = b; memory_region_init_io(&s->pchip.reg_iack, OBJECT(s), &alpha_pci_iack_ops, b, "pci0-iack", 64*VAR_0); memory_region_add_subregion(addr_space, 0x801f8000000ULL, &s->pchip.reg_iack); memory_region_init_io(&s->pchip.reg_conf, OBJECT(s), &alpha_pci_conf1_ops, b, "pci0-conf", 16*VAR_0); memory_region_add_subregion(addr_space, 0x801fe000000ULL, &s->pchip.reg_conf); { qemu_irq isa_pci_irq, *isa_irqs; *isa_bus = isa_bus_new(NULL, &s->pchip.reg_io); isa_pci_irq = *qemu_allocate_irqs(typhoon_set_isa_irq, s, 1); isa_irqs = i8259_init(*isa_bus, isa_pci_irq); isa_bus_irqs(*isa_bus, isa_irqs); } return b; }
[ "PCIBus *FUNC_0(ram_addr_t ram_size, ISABus **isa_bus,\nqemu_irq *p_rtc_irq,\nAlphaCPU *cpus[4], pci_map_irq_fn sys_map_irq)\n{", "const uint64_t VAR_0 = 1024 * 1024;", "const uint64_t VAR_1 = 1024 * VAR_0;", "MemoryRegion *addr_space = get_system_memory();", "DeviceState *dev;", "TyphoonState *s;", "PCIHostState *phb;", "PCIBus *b;", "int VAR_2;", "dev = qdev_create(NULL, TYPE_TYPHOON_PCI_HOST_BRIDGE);", "qdev_init_nofail(dev);", "s = TYPHOON_PCI_HOST_BRIDGE(dev);", "phb = PCI_HOST_BRIDGE(dev);", "for (VAR_2 = 0; VAR_2 < 4; VAR_2++) {", "AlphaCPU *cpu = cpus[VAR_2];", "s->cchip.cpu[VAR_2] = cpu;", "if (cpu != NULL) {", "cpu->alarm_timer = qemu_new_timer_ns(rtc_clock,\ntyphoon_alarm_timer,\n(void *)((uintptr_t)s + VAR_2));", "}", "}", "*p_rtc_irq = *qemu_allocate_irqs(typhoon_set_timer_irq, s, 1);", "memory_region_init_ram(&s->ram_region, OBJECT(s), \"ram\", ram_size);", "vmstate_register_ram_global(&s->ram_region);", "memory_region_add_subregion(addr_space, 0, &s->ram_region);", "memory_region_init_io(&s->pchip.region, OBJECT(s), &pchip_ops, s, \"pchip0\",\n256*VAR_0);", "memory_region_add_subregion(addr_space, 0x80180000000ULL,\n&s->pchip.region);", "memory_region_init_io(&s->cchip.region, OBJECT(s), &cchip_ops, s, \"cchip0\",\n256*VAR_0);", "memory_region_add_subregion(addr_space, 0x801a0000000ULL,\n&s->cchip.region);", "memory_region_init_io(&s->dchip_region, OBJECT(s), &dchip_ops, s, \"dchip0\",\n256*VAR_0);", "memory_region_add_subregion(addr_space, 0x801b0000000ULL,\n&s->dchip_region);", "memory_region_init(&s->pchip.reg_mem, OBJECT(s), \"pci0-mem\", 4*VAR_1);", "memory_region_add_subregion(addr_space, 0x80000000000ULL,\n&s->pchip.reg_mem);", "memory_region_init(&s->pchip.reg_io, OBJECT(s), \"pci0-io\", 32*VAR_0);", "memory_region_add_subregion(addr_space, 0x801fc000000ULL,\n&s->pchip.reg_io);", "b = pci_register_bus(dev, \"pci\",\ntyphoon_set_irq, sys_map_irq, s,\n&s->pchip.reg_mem, &s->pchip.reg_io,\n0, 64, TYPE_PCI_BUS);", "phb->bus = b;", "memory_region_init_io(&s->pchip.reg_iack, OBJECT(s), &alpha_pci_iack_ops,\nb, \"pci0-iack\", 64*VAR_0);", "memory_region_add_subregion(addr_space, 0x801f8000000ULL,\n&s->pchip.reg_iack);", "memory_region_init_io(&s->pchip.reg_conf, OBJECT(s), &alpha_pci_conf1_ops,\nb, \"pci0-conf\", 16*VAR_0);", "memory_region_add_subregion(addr_space, 0x801fe000000ULL,\n&s->pchip.reg_conf);", "{", "qemu_irq isa_pci_irq, *isa_irqs;", "*isa_bus = isa_bus_new(NULL, &s->pchip.reg_io);", "isa_pci_irq = *qemu_allocate_irqs(typhoon_set_isa_irq, s, 1);", "isa_irqs = i8259_init(*isa_bus, isa_pci_irq);", "isa_bus_irqs(*isa_bus, isa_irqs);", "}", "return b;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 33 ], [ 35 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49, 51, 53 ], [ 55 ], [ 57 ], [ 61 ], [ 69 ], [ 71 ], [ 73 ], [ 87, 89 ], [ 91, 93 ], [ 99, 101 ], [ 103, 105 ], [ 111, 113 ], [ 115, 117 ], [ 123 ], [ 125, 127 ], [ 133 ], [ 135, 137 ], [ 141, 143, 145, 147 ], [ 149 ], [ 155, 157 ], [ 159, 161 ], [ 167, 169 ], [ 171, 173 ], [ 199 ], [ 201 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 217 ], [ 219 ] ]
24,211
static void qmp_output_end_struct(Visitor *v, void **obj) { QmpOutputVisitor *qov = to_qov(v); QObject *value = qmp_output_pop(qov, obj); assert(qobject_type(value) == QTYPE_QDICT); }
false
qemu
7d5e199ade76c53ec316ab6779800581bb47c50a
static void qmp_output_end_struct(Visitor *v, void **obj) { QmpOutputVisitor *qov = to_qov(v); QObject *value = qmp_output_pop(qov, obj); assert(qobject_type(value) == QTYPE_QDICT); }
{ "code": [], "line_no": [] }
static void FUNC_0(Visitor *VAR_0, void **VAR_1) { QmpOutputVisitor *qov = to_qov(VAR_0); QObject *value = qmp_output_pop(qov, VAR_1); assert(qobject_type(value) == QTYPE_QDICT); }
[ "static void FUNC_0(Visitor *VAR_0, void **VAR_1)\n{", "QmpOutputVisitor *qov = to_qov(VAR_0);", "QObject *value = qmp_output_pop(qov, VAR_1);", "assert(qobject_type(value) == QTYPE_QDICT);", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ] ]
24,214
static void pmuserenr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) { env->cp15.c9_pmuserenr = value & 1; }
false
qemu
6ecd0b6ba0591ef280ed984103924d4bdca5ac32
static void pmuserenr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) { env->cp15.c9_pmuserenr = value & 1; }
{ "code": [], "line_no": [] }
static void FUNC_0(CPUARMState *VAR_0, const ARMCPRegInfo *VAR_1, uint64_t VAR_2) { VAR_0->cp15.c9_pmuserenr = VAR_2 & 1; }
[ "static void FUNC_0(CPUARMState *VAR_0, const ARMCPRegInfo *VAR_1,\nuint64_t VAR_2)\n{", "VAR_0->cp15.c9_pmuserenr = VAR_2 & 1;", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ] ]
24,215
static int parse_drive(DeviceState *dev, Property *prop, const char *str) { DriveInfo **ptr = qdev_get_prop_ptr(dev, prop); *ptr = drive_get_by_id(str); if (*ptr == NULL) return -ENOENT; return 0; }
false
qemu
f8b6cc0070aab8b75bd082582c829be1353f395f
static int parse_drive(DeviceState *dev, Property *prop, const char *str) { DriveInfo **ptr = qdev_get_prop_ptr(dev, prop); *ptr = drive_get_by_id(str); if (*ptr == NULL) return -ENOENT; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(DeviceState *VAR_0, Property *VAR_1, const char *VAR_2) { DriveInfo **ptr = qdev_get_prop_ptr(VAR_0, VAR_1); *ptr = drive_get_by_id(VAR_2); if (*ptr == NULL) return -ENOENT; return 0; }
[ "static int FUNC_0(DeviceState *VAR_0, Property *VAR_1, const char *VAR_2)\n{", "DriveInfo **ptr = qdev_get_prop_ptr(VAR_0, VAR_1);", "*ptr = drive_get_by_id(VAR_2);", "if (*ptr == NULL)\nreturn -ENOENT;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11, 13 ], [ 15 ], [ 17 ] ]
24,216
void put_pixels8_xy2_altivec(uint8_t *block, const uint8_t *pixels, int line_size, int h) { POWERPC_TBL_DECLARE(altivec_put_pixels8_xy2_num, 1); #ifdef ALTIVEC_USE_REFERENCE_C_CODE int j; POWERPC_TBL_START_COUNT(altivec_put_pixels8_xy2_num, 1); for (j = 0; j < 2; j++) { int i; const uint32_t a = (((const struct unaligned_32 *) (pixels))->l); const uint32_t b = (((const struct unaligned_32 *) (pixels + 1))->l); uint32_t l0 = (a & 0x03030303UL) + (b & 0x03030303UL) + 0x02020202UL; uint32_t h0 = ((a & 0xFCFCFCFCUL) >> 2) + ((b & 0xFCFCFCFCUL) >> 2); uint32_t l1, h1; pixels += line_size; for (i = 0; i < h; i += 2) { uint32_t a = (((const struct unaligned_32 *) (pixels))->l); uint32_t b = (((const struct unaligned_32 *) (pixels + 1))->l); l1 = (a & 0x03030303UL) + (b & 0x03030303UL); h1 = ((a & 0xFCFCFCFCUL) >> 2) + ((b & 0xFCFCFCFCUL) >> 2); *((uint32_t *) block) = h0 + h1 + (((l0 + l1) >> 2) & 0x0F0F0F0FUL); pixels += line_size; block += line_size; a = (((const struct unaligned_32 *) (pixels))->l); b = (((const struct unaligned_32 *) (pixels + 1))->l); l0 = (a & 0x03030303UL) + (b & 0x03030303UL) + 0x02020202UL; h0 = ((a & 0xFCFCFCFCUL) >> 2) + ((b & 0xFCFCFCFCUL) >> 2); *((uint32_t *) block) = h0 + h1 + (((l0 + l1) >> 2) & 0x0F0F0F0FUL); pixels += line_size; block += line_size; } pixels += 4 - line_size * (h + 1); block += 4 - line_size * h; } POWERPC_TBL_STOP_COUNT(altivec_put_pixels8_xy2_num, 1); #else /* ALTIVEC_USE_REFERENCE_C_CODE */ register int i; register vector unsigned char pixelsv1, pixelsv2, pixelsavg; register vector unsigned char blockv, temp1, temp2; register vector unsigned short pixelssum1, pixelssum2, temp3; register const vector unsigned char vczero = (const vector unsigned char)vec_splat_u8(0); register const vector unsigned short vctwo = (const vector unsigned short)vec_splat_u16(2); temp1 = vec_ld(0, pixels); temp2 = vec_ld(16, pixels); pixelsv1 = vec_perm(temp1, temp2, vec_lvsl(0, pixels)); if ((((unsigned long)pixels) & 0x0000000F) == 0x0000000F) { pixelsv2 = temp2; } else { pixelsv2 = vec_perm(temp1, temp2, vec_lvsl(1, pixels)); } pixelsv1 = vec_mergeh(vczero, pixelsv1); pixelsv2 = vec_mergeh(vczero, pixelsv2); pixelssum1 = vec_add((vector unsigned short)pixelsv1, (vector unsigned short)pixelsv2); pixelssum1 = vec_add(pixelssum1, vctwo); POWERPC_TBL_START_COUNT(altivec_put_pixels8_xy2_num, 1); for (i = 0; i < h ; i++) { int rightside = ((unsigned long)block & 0x0000000F); blockv = vec_ld(0, block); temp1 = vec_ld(line_size, pixels); temp2 = vec_ld(line_size + 16, pixels); pixelsv1 = vec_perm(temp1, temp2, vec_lvsl(line_size, pixels)); if (((((unsigned long)pixels) + line_size) & 0x0000000F) == 0x0000000F) { pixelsv2 = temp2; } else { pixelsv2 = vec_perm(temp1, temp2, vec_lvsl(line_size + 1, pixels)); } pixelsv1 = vec_mergeh(vczero, pixelsv1); pixelsv2 = vec_mergeh(vczero, pixelsv2); pixelssum2 = vec_add((vector unsigned short)pixelsv1, (vector unsigned short)pixelsv2); temp3 = vec_add(pixelssum1, pixelssum2); temp3 = vec_sra(temp3, vctwo); pixelssum1 = vec_add(pixelssum2, vctwo); pixelsavg = vec_packsu(temp3, (vector unsigned short) vczero); if (rightside) { blockv = vec_perm(blockv, pixelsavg, vcprm(0, 1, s0, s1)); } else { blockv = vec_perm(blockv, pixelsavg, vcprm(s0, s1, 2, 3)); } vec_st(blockv, 0, block); block += line_size; pixels += line_size; } POWERPC_TBL_STOP_COUNT(altivec_put_pixels8_xy2_num, 1); #endif /* ALTIVEC_USE_REFERENCE_C_CODE */ }
false
FFmpeg
e45a2872fafe631c14aee9f79d0963d68c4fc1fd
void put_pixels8_xy2_altivec(uint8_t *block, const uint8_t *pixels, int line_size, int h) { POWERPC_TBL_DECLARE(altivec_put_pixels8_xy2_num, 1); #ifdef ALTIVEC_USE_REFERENCE_C_CODE int j; POWERPC_TBL_START_COUNT(altivec_put_pixels8_xy2_num, 1); for (j = 0; j < 2; j++) { int i; const uint32_t a = (((const struct unaligned_32 *) (pixels))->l); const uint32_t b = (((const struct unaligned_32 *) (pixels + 1))->l); uint32_t l0 = (a & 0x03030303UL) + (b & 0x03030303UL) + 0x02020202UL; uint32_t h0 = ((a & 0xFCFCFCFCUL) >> 2) + ((b & 0xFCFCFCFCUL) >> 2); uint32_t l1, h1; pixels += line_size; for (i = 0; i < h; i += 2) { uint32_t a = (((const struct unaligned_32 *) (pixels))->l); uint32_t b = (((const struct unaligned_32 *) (pixels + 1))->l); l1 = (a & 0x03030303UL) + (b & 0x03030303UL); h1 = ((a & 0xFCFCFCFCUL) >> 2) + ((b & 0xFCFCFCFCUL) >> 2); *((uint32_t *) block) = h0 + h1 + (((l0 + l1) >> 2) & 0x0F0F0F0FUL); pixels += line_size; block += line_size; a = (((const struct unaligned_32 *) (pixels))->l); b = (((const struct unaligned_32 *) (pixels + 1))->l); l0 = (a & 0x03030303UL) + (b & 0x03030303UL) + 0x02020202UL; h0 = ((a & 0xFCFCFCFCUL) >> 2) + ((b & 0xFCFCFCFCUL) >> 2); *((uint32_t *) block) = h0 + h1 + (((l0 + l1) >> 2) & 0x0F0F0F0FUL); pixels += line_size; block += line_size; } pixels += 4 - line_size * (h + 1); block += 4 - line_size * h; } POWERPC_TBL_STOP_COUNT(altivec_put_pixels8_xy2_num, 1); #else register int i; register vector unsigned char pixelsv1, pixelsv2, pixelsavg; register vector unsigned char blockv, temp1, temp2; register vector unsigned short pixelssum1, pixelssum2, temp3; register const vector unsigned char vczero = (const vector unsigned char)vec_splat_u8(0); register const vector unsigned short vctwo = (const vector unsigned short)vec_splat_u16(2); temp1 = vec_ld(0, pixels); temp2 = vec_ld(16, pixels); pixelsv1 = vec_perm(temp1, temp2, vec_lvsl(0, pixels)); if ((((unsigned long)pixels) & 0x0000000F) == 0x0000000F) { pixelsv2 = temp2; } else { pixelsv2 = vec_perm(temp1, temp2, vec_lvsl(1, pixels)); } pixelsv1 = vec_mergeh(vczero, pixelsv1); pixelsv2 = vec_mergeh(vczero, pixelsv2); pixelssum1 = vec_add((vector unsigned short)pixelsv1, (vector unsigned short)pixelsv2); pixelssum1 = vec_add(pixelssum1, vctwo); POWERPC_TBL_START_COUNT(altivec_put_pixels8_xy2_num, 1); for (i = 0; i < h ; i++) { int rightside = ((unsigned long)block & 0x0000000F); blockv = vec_ld(0, block); temp1 = vec_ld(line_size, pixels); temp2 = vec_ld(line_size + 16, pixels); pixelsv1 = vec_perm(temp1, temp2, vec_lvsl(line_size, pixels)); if (((((unsigned long)pixels) + line_size) & 0x0000000F) == 0x0000000F) { pixelsv2 = temp2; } else { pixelsv2 = vec_perm(temp1, temp2, vec_lvsl(line_size + 1, pixels)); } pixelsv1 = vec_mergeh(vczero, pixelsv1); pixelsv2 = vec_mergeh(vczero, pixelsv2); pixelssum2 = vec_add((vector unsigned short)pixelsv1, (vector unsigned short)pixelsv2); temp3 = vec_add(pixelssum1, pixelssum2); temp3 = vec_sra(temp3, vctwo); pixelssum1 = vec_add(pixelssum2, vctwo); pixelsavg = vec_packsu(temp3, (vector unsigned short) vczero); if (rightside) { blockv = vec_perm(blockv, pixelsavg, vcprm(0, 1, s0, s1)); } else { blockv = vec_perm(blockv, pixelsavg, vcprm(s0, s1, 2, 3)); } vec_st(blockv, 0, block); block += line_size; pixels += line_size; } POWERPC_TBL_STOP_COUNT(altivec_put_pixels8_xy2_num, 1); #endif }
{ "code": [], "line_no": [] }
void FUNC_0(uint8_t *VAR_0, const uint8_t *VAR_1, int VAR_2, int VAR_3) { POWERPC_TBL_DECLARE(altivec_put_pixels8_xy2_num, 1); #ifdef ALTIVEC_USE_REFERENCE_C_CODE int j; POWERPC_TBL_START_COUNT(altivec_put_pixels8_xy2_num, 1); for (j = 0; j < 2; j++) { int VAR_4; const uint32_t a = (((const struct unaligned_32 *) (VAR_1))->l); const uint32_t b = (((const struct unaligned_32 *) (VAR_1 + 1))->l); uint32_t l0 = (a & 0x03030303UL) + (b & 0x03030303UL) + 0x02020202UL; uint32_t h0 = ((a & 0xFCFCFCFCUL) >> 2) + ((b & 0xFCFCFCFCUL) >> 2); uint32_t l1, h1; VAR_1 += VAR_2; for (VAR_4 = 0; VAR_4 < VAR_3; VAR_4 += 2) { uint32_t a = (((const struct unaligned_32 *) (VAR_1))->l); uint32_t b = (((const struct unaligned_32 *) (VAR_1 + 1))->l); l1 = (a & 0x03030303UL) + (b & 0x03030303UL); h1 = ((a & 0xFCFCFCFCUL) >> 2) + ((b & 0xFCFCFCFCUL) >> 2); *((uint32_t *) VAR_0) = h0 + h1 + (((l0 + l1) >> 2) & 0x0F0F0F0FUL); VAR_1 += VAR_2; VAR_0 += VAR_2; a = (((const struct unaligned_32 *) (VAR_1))->l); b = (((const struct unaligned_32 *) (VAR_1 + 1))->l); l0 = (a & 0x03030303UL) + (b & 0x03030303UL) + 0x02020202UL; h0 = ((a & 0xFCFCFCFCUL) >> 2) + ((b & 0xFCFCFCFCUL) >> 2); *((uint32_t *) VAR_0) = h0 + h1 + (((l0 + l1) >> 2) & 0x0F0F0F0FUL); VAR_1 += VAR_2; VAR_0 += VAR_2; } VAR_1 += 4 - VAR_2 * (VAR_3 + 1); VAR_0 += 4 - VAR_2 * VAR_3; } POWERPC_TBL_STOP_COUNT(altivec_put_pixels8_xy2_num, 1); #else register int VAR_4; register vector unsigned char VAR_5, pixelsv2, pixelsavg; register vector unsigned char VAR_6, temp1, temp2; register vector unsigned short VAR_7, pixelssum2, temp3; register const vector unsigned char VAR_8 = (const vector unsigned char)vec_splat_u8(0); register const vector unsigned short VAR_9 = (const vector unsigned short)vec_splat_u16(2); temp1 = vec_ld(0, VAR_1); temp2 = vec_ld(16, VAR_1); VAR_5 = vec_perm(temp1, temp2, vec_lvsl(0, VAR_1)); if ((((unsigned long)VAR_1) & 0x0000000F) == 0x0000000F) { pixelsv2 = temp2; } else { pixelsv2 = vec_perm(temp1, temp2, vec_lvsl(1, VAR_1)); } VAR_5 = vec_mergeh(VAR_8, VAR_5); pixelsv2 = vec_mergeh(VAR_8, pixelsv2); VAR_7 = vec_add((vector unsigned short)VAR_5, (vector unsigned short)pixelsv2); VAR_7 = vec_add(VAR_7, VAR_9); POWERPC_TBL_START_COUNT(altivec_put_pixels8_xy2_num, 1); for (VAR_4 = 0; VAR_4 < VAR_3 ; VAR_4++) { int VAR_10 = ((unsigned long)VAR_0 & 0x0000000F); VAR_6 = vec_ld(0, VAR_0); temp1 = vec_ld(VAR_2, VAR_1); temp2 = vec_ld(VAR_2 + 16, VAR_1); VAR_5 = vec_perm(temp1, temp2, vec_lvsl(VAR_2, VAR_1)); if (((((unsigned long)VAR_1) + VAR_2) & 0x0000000F) == 0x0000000F) { pixelsv2 = temp2; } else { pixelsv2 = vec_perm(temp1, temp2, vec_lvsl(VAR_2 + 1, VAR_1)); } VAR_5 = vec_mergeh(VAR_8, VAR_5); pixelsv2 = vec_mergeh(VAR_8, pixelsv2); pixelssum2 = vec_add((vector unsigned short)VAR_5, (vector unsigned short)pixelsv2); temp3 = vec_add(VAR_7, pixelssum2); temp3 = vec_sra(temp3, VAR_9); VAR_7 = vec_add(pixelssum2, VAR_9); pixelsavg = vec_packsu(temp3, (vector unsigned short) VAR_8); if (VAR_10) { VAR_6 = vec_perm(VAR_6, pixelsavg, vcprm(0, 1, s0, s1)); } else { VAR_6 = vec_perm(VAR_6, pixelsavg, vcprm(s0, s1, 2, 3)); } vec_st(VAR_6, 0, VAR_0); VAR_0 += VAR_2; VAR_1 += VAR_2; } POWERPC_TBL_STOP_COUNT(altivec_put_pixels8_xy2_num, 1); #endif }
[ "void FUNC_0(uint8_t *VAR_0, const uint8_t *VAR_1, int VAR_2, int VAR_3)\n{", "POWERPC_TBL_DECLARE(altivec_put_pixels8_xy2_num, 1);", "#ifdef ALTIVEC_USE_REFERENCE_C_CODE\nint j;", "POWERPC_TBL_START_COUNT(altivec_put_pixels8_xy2_num, 1);", "for (j = 0; j < 2; j++) {", "int VAR_4;", "const uint32_t a = (((const struct unaligned_32 *) (VAR_1))->l);", "const uint32_t b =\n(((const struct unaligned_32 *) (VAR_1 + 1))->l);", "uint32_t l0 =\n(a & 0x03030303UL) + (b & 0x03030303UL) + 0x02020202UL;", "uint32_t h0 =\n((a & 0xFCFCFCFCUL) >> 2) + ((b & 0xFCFCFCFCUL) >> 2);", "uint32_t l1, h1;", "VAR_1 += VAR_2;", "for (VAR_4 = 0; VAR_4 < VAR_3; VAR_4 += 2) {", "uint32_t a = (((const struct unaligned_32 *) (VAR_1))->l);", "uint32_t b = (((const struct unaligned_32 *) (VAR_1 + 1))->l);", "l1 = (a & 0x03030303UL) + (b & 0x03030303UL);", "h1 = ((a & 0xFCFCFCFCUL) >> 2) + ((b & 0xFCFCFCFCUL) >> 2);", "*((uint32_t *) VAR_0) =\nh0 + h1 + (((l0 + l1) >> 2) & 0x0F0F0F0FUL);", "VAR_1 += VAR_2;", "VAR_0 += VAR_2;", "a = (((const struct unaligned_32 *) (VAR_1))->l);", "b = (((const struct unaligned_32 *) (VAR_1 + 1))->l);", "l0 = (a & 0x03030303UL) + (b & 0x03030303UL) + 0x02020202UL;", "h0 = ((a & 0xFCFCFCFCUL) >> 2) + ((b & 0xFCFCFCFCUL) >> 2);", "*((uint32_t *) VAR_0) =\nh0 + h1 + (((l0 + l1) >> 2) & 0x0F0F0F0FUL);", "VAR_1 += VAR_2;", "VAR_0 += VAR_2;", "} VAR_1 += 4 - VAR_2 * (VAR_3 + 1);", "VAR_0 += 4 - VAR_2 * VAR_3;", "}", "POWERPC_TBL_STOP_COUNT(altivec_put_pixels8_xy2_num, 1);", "#else\nregister int VAR_4;", "register vector unsigned char\nVAR_5, pixelsv2,\npixelsavg;", "register vector unsigned char\nVAR_6, temp1, temp2;", "register vector unsigned short\nVAR_7, pixelssum2, temp3;", "register const vector unsigned char VAR_8 = (const vector unsigned char)vec_splat_u8(0);", "register const vector unsigned short VAR_9 = (const vector unsigned short)vec_splat_u16(2);", "temp1 = vec_ld(0, VAR_1);", "temp2 = vec_ld(16, VAR_1);", "VAR_5 = vec_perm(temp1, temp2, vec_lvsl(0, VAR_1));", "if ((((unsigned long)VAR_1) & 0x0000000F) == 0x0000000F)\n{", "pixelsv2 = temp2;", "}", "else\n{", "pixelsv2 = vec_perm(temp1, temp2, vec_lvsl(1, VAR_1));", "}", "VAR_5 = vec_mergeh(VAR_8, VAR_5);", "pixelsv2 = vec_mergeh(VAR_8, pixelsv2);", "VAR_7 = vec_add((vector unsigned short)VAR_5,\n(vector unsigned short)pixelsv2);", "VAR_7 = vec_add(VAR_7, VAR_9);", "POWERPC_TBL_START_COUNT(altivec_put_pixels8_xy2_num, 1);", "for (VAR_4 = 0; VAR_4 < VAR_3 ; VAR_4++) {", "int VAR_10 = ((unsigned long)VAR_0 & 0x0000000F);", "VAR_6 = vec_ld(0, VAR_0);", "temp1 = vec_ld(VAR_2, VAR_1);", "temp2 = vec_ld(VAR_2 + 16, VAR_1);", "VAR_5 = vec_perm(temp1, temp2, vec_lvsl(VAR_2, VAR_1));", "if (((((unsigned long)VAR_1) + VAR_2) & 0x0000000F) == 0x0000000F)\n{", "pixelsv2 = temp2;", "}", "else\n{", "pixelsv2 = vec_perm(temp1, temp2, vec_lvsl(VAR_2 + 1, VAR_1));", "}", "VAR_5 = vec_mergeh(VAR_8, VAR_5);", "pixelsv2 = vec_mergeh(VAR_8, pixelsv2);", "pixelssum2 = vec_add((vector unsigned short)VAR_5,\n(vector unsigned short)pixelsv2);", "temp3 = vec_add(VAR_7, pixelssum2);", "temp3 = vec_sra(temp3, VAR_9);", "VAR_7 = vec_add(pixelssum2, VAR_9);", "pixelsavg = vec_packsu(temp3, (vector unsigned short) VAR_8);", "if (VAR_10)\n{", "VAR_6 = vec_perm(VAR_6, pixelsavg, vcprm(0, 1, s0, s1));", "}", "else\n{", "VAR_6 = vec_perm(VAR_6, pixelsavg, vcprm(s0, s1, 2, 3));", "}", "vec_st(VAR_6, 0, VAR_0);", "VAR_0 += VAR_2;", "VAR_1 += VAR_2;", "}", "POWERPC_TBL_STOP_COUNT(altivec_put_pixels8_xy2_num, 1);", "#endif\n}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19, 21 ], [ 23, 25 ], [ 27, 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45, 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61, 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 81, 83 ], [ 85, 87, 89 ], [ 91, 93 ], [ 95, 97 ], [ 99 ], [ 101 ], [ 105 ], [ 107 ], [ 109 ], [ 111, 113 ], [ 115 ], [ 117 ], [ 119, 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131, 133 ], [ 135 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 149 ], [ 151 ], [ 153 ], [ 155, 157 ], [ 159 ], [ 161 ], [ 163, 165 ], [ 167 ], [ 169 ], [ 173 ], [ 175 ], [ 177, 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 191, 193 ], [ 195 ], [ 197 ], [ 199, 201 ], [ 203 ], [ 205 ], [ 209 ], [ 213 ], [ 215 ], [ 217 ], [ 221 ], [ 223, 225 ] ]
24,217
void cpu_x86_interrupt(CPUX86State *s) { s->interrupt_request = 1; }
false
qemu
e4533c7a8cdcc79ccdf695f0aaa2e23a5b926ed0
void cpu_x86_interrupt(CPUX86State *s) { s->interrupt_request = 1; }
{ "code": [], "line_no": [] }
void FUNC_0(CPUX86State *VAR_0) { VAR_0->interrupt_request = 1; }
[ "void FUNC_0(CPUX86State *VAR_0)\n{", "VAR_0->interrupt_request = 1;", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
24,220
void hmp_block_stream(Monitor *mon, const QDict *qdict) { Error *error = NULL; const char *device = qdict_get_str(qdict, "device"); const char *base = qdict_get_try_str(qdict, "base"); qmp_block_stream(device, base != NULL, base, &error); hmp_handle_error(mon, &error); }
false
qemu
c83c66c3b58893a4dc056e272822beb88fe9ec7f
void hmp_block_stream(Monitor *mon, const QDict *qdict) { Error *error = NULL; const char *device = qdict_get_str(qdict, "device"); const char *base = qdict_get_try_str(qdict, "base"); qmp_block_stream(device, base != NULL, base, &error); hmp_handle_error(mon, &error); }
{ "code": [], "line_no": [] }
void FUNC_0(Monitor *VAR_0, const QDict *VAR_1) { Error *error = NULL; const char *VAR_2 = qdict_get_str(VAR_1, "VAR_2"); const char *VAR_3 = qdict_get_try_str(VAR_1, "VAR_3"); qmp_block_stream(VAR_2, VAR_3 != NULL, VAR_3, &error); hmp_handle_error(VAR_0, &error); }
[ "void FUNC_0(Monitor *VAR_0, const QDict *VAR_1)\n{", "Error *error = NULL;", "const char *VAR_2 = qdict_get_str(VAR_1, \"VAR_2\");", "const char *VAR_3 = qdict_get_try_str(VAR_1, \"VAR_3\");", "qmp_block_stream(VAR_2, VAR_3 != NULL, VAR_3, &error);", "hmp_handle_error(VAR_0, &error);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17 ], [ 19 ] ]
24,223
static int flic_read_packet(AVFormatContext *s, AVPacket *pkt) { FlicDemuxContext *flic = (FlicDemuxContext *)s->priv_data; ByteIOContext *pb = &s->pb; int packet_read = 0; unsigned int size; int magic; int ret = 0; unsigned char preamble[FLIC_PREAMBLE_SIZE]; while (!packet_read) { if ((ret = get_buffer(pb, preamble, FLIC_PREAMBLE_SIZE)) != FLIC_PREAMBLE_SIZE) { ret = AVERROR_IO; break; } size = LE_32(&preamble[0]); magic = LE_16(&preamble[4]); if ((magic == FLIC_CHUNK_MAGIC_1) || (magic == FLIC_CHUNK_MAGIC_2)) { if (av_new_packet(pkt, size)) { ret = AVERROR_IO; break; } pkt->stream_index = flic->video_stream_index; pkt->pts = flic->pts; memcpy(pkt->data, preamble, FLIC_PREAMBLE_SIZE); ret = get_buffer(pb, pkt->data + FLIC_PREAMBLE_SIZE, size - FLIC_PREAMBLE_SIZE); if (ret != size - FLIC_PREAMBLE_SIZE) { av_free_packet(pkt); ret = AVERROR_IO; } flic->pts += flic->frame_pts_inc; packet_read = 1; } else { /* not interested in this chunk */ url_fseek(pb, size - 6, SEEK_CUR); } } return ret; }
true
FFmpeg
0ecca7a49f8e254c12a3a1de048d738bfbb614c6
static int flic_read_packet(AVFormatContext *s, AVPacket *pkt) { FlicDemuxContext *flic = (FlicDemuxContext *)s->priv_data; ByteIOContext *pb = &s->pb; int packet_read = 0; unsigned int size; int magic; int ret = 0; unsigned char preamble[FLIC_PREAMBLE_SIZE]; while (!packet_read) { if ((ret = get_buffer(pb, preamble, FLIC_PREAMBLE_SIZE)) != FLIC_PREAMBLE_SIZE) { ret = AVERROR_IO; break; } size = LE_32(&preamble[0]); magic = LE_16(&preamble[4]); if ((magic == FLIC_CHUNK_MAGIC_1) || (magic == FLIC_CHUNK_MAGIC_2)) { if (av_new_packet(pkt, size)) { ret = AVERROR_IO; break; } pkt->stream_index = flic->video_stream_index; pkt->pts = flic->pts; memcpy(pkt->data, preamble, FLIC_PREAMBLE_SIZE); ret = get_buffer(pb, pkt->data + FLIC_PREAMBLE_SIZE, size - FLIC_PREAMBLE_SIZE); if (ret != size - FLIC_PREAMBLE_SIZE) { av_free_packet(pkt); ret = AVERROR_IO; } flic->pts += flic->frame_pts_inc; packet_read = 1; } else { url_fseek(pb, size - 6, SEEK_CUR); } } return ret; }
{ "code": [ " if ((magic == FLIC_CHUNK_MAGIC_1) || (magic == FLIC_CHUNK_MAGIC_2)) {" ], "line_no": [ 45 ] }
static int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1) { FlicDemuxContext *flic = (FlicDemuxContext *)VAR_0->priv_data; ByteIOContext *pb = &VAR_0->pb; int VAR_2 = 0; unsigned int VAR_3; int VAR_4; int VAR_5 = 0; unsigned char VAR_6[FLIC_PREAMBLE_SIZE]; while (!VAR_2) { if ((VAR_5 = get_buffer(pb, VAR_6, FLIC_PREAMBLE_SIZE)) != FLIC_PREAMBLE_SIZE) { VAR_5 = AVERROR_IO; break; } VAR_3 = LE_32(&VAR_6[0]); VAR_4 = LE_16(&VAR_6[4]); if ((VAR_4 == FLIC_CHUNK_MAGIC_1) || (VAR_4 == FLIC_CHUNK_MAGIC_2)) { if (av_new_packet(VAR_1, VAR_3)) { VAR_5 = AVERROR_IO; break; } VAR_1->stream_index = flic->video_stream_index; VAR_1->pts = flic->pts; memcpy(VAR_1->data, VAR_6, FLIC_PREAMBLE_SIZE); VAR_5 = get_buffer(pb, VAR_1->data + FLIC_PREAMBLE_SIZE, VAR_3 - FLIC_PREAMBLE_SIZE); if (VAR_5 != VAR_3 - FLIC_PREAMBLE_SIZE) { av_free_packet(VAR_1); VAR_5 = AVERROR_IO; } flic->pts += flic->frame_pts_inc; VAR_2 = 1; } else { url_fseek(pb, VAR_3 - 6, SEEK_CUR); } } return VAR_5; }
[ "static int FUNC_0(AVFormatContext *VAR_0,\nAVPacket *VAR_1)\n{", "FlicDemuxContext *flic = (FlicDemuxContext *)VAR_0->priv_data;", "ByteIOContext *pb = &VAR_0->pb;", "int VAR_2 = 0;", "unsigned int VAR_3;", "int VAR_4;", "int VAR_5 = 0;", "unsigned char VAR_6[FLIC_PREAMBLE_SIZE];", "while (!VAR_2) {", "if ((VAR_5 = get_buffer(pb, VAR_6, FLIC_PREAMBLE_SIZE)) !=\nFLIC_PREAMBLE_SIZE) {", "VAR_5 = AVERROR_IO;", "break;", "}", "VAR_3 = LE_32(&VAR_6[0]);", "VAR_4 = LE_16(&VAR_6[4]);", "if ((VAR_4 == FLIC_CHUNK_MAGIC_1) || (VAR_4 == FLIC_CHUNK_MAGIC_2)) {", "if (av_new_packet(VAR_1, VAR_3)) {", "VAR_5 = AVERROR_IO;", "break;", "}", "VAR_1->stream_index = flic->video_stream_index;", "VAR_1->pts = flic->pts;", "memcpy(VAR_1->data, VAR_6, FLIC_PREAMBLE_SIZE);", "VAR_5 = get_buffer(pb, VAR_1->data + FLIC_PREAMBLE_SIZE,\nVAR_3 - FLIC_PREAMBLE_SIZE);", "if (VAR_5 != VAR_3 - FLIC_PREAMBLE_SIZE) {", "av_free_packet(VAR_1);", "VAR_5 = AVERROR_IO;", "}", "flic->pts += flic->frame_pts_inc;", "VAR_2 = 1;", "} else {", "url_fseek(pb, VAR_3 - 6, SEEK_CUR);", "}", "}", "return VAR_5;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 27, 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61, 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 83 ], [ 85 ], [ 89 ], [ 91 ] ]
24,225
static int get_ref_idx(AVFrame *frame) { FrameDecodeData *fdd; NVDECFrame *cf; if (!frame || !frame->private_ref) return -1; fdd = (FrameDecodeData*)frame->private_ref->data; cf = (NVDECFrame*)fdd->hwaccel_priv; return cf->idx; }
false
FFmpeg
4c7b023d56e09a78a587d036db1b64bf7c493b3d
static int get_ref_idx(AVFrame *frame) { FrameDecodeData *fdd; NVDECFrame *cf; if (!frame || !frame->private_ref) return -1; fdd = (FrameDecodeData*)frame->private_ref->data; cf = (NVDECFrame*)fdd->hwaccel_priv; return cf->idx; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFrame *VAR_0) { FrameDecodeData *fdd; NVDECFrame *cf; if (!VAR_0 || !VAR_0->private_ref) return -1; fdd = (FrameDecodeData*)VAR_0->private_ref->data; cf = (NVDECFrame*)fdd->hwaccel_priv; return cf->idx; }
[ "static int FUNC_0(AVFrame *VAR_0)\n{", "FrameDecodeData *fdd;", "NVDECFrame *cf;", "if (!VAR_0 || !VAR_0->private_ref)\nreturn -1;", "fdd = (FrameDecodeData*)VAR_0->private_ref->data;", "cf = (NVDECFrame*)fdd->hwaccel_priv;", "return cf->idx;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11, 13 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ] ]
24,228
static int put_packetheader(NUTContext *nut, ByteIOContext *bc, int max_size, int calculate_checksum) { put_flush_packet(bc); nut->packet_start[2]= url_ftell(bc) - 8; nut->written_packet_size = max_size; if(calculate_checksum) init_checksum(bc, update_adler32, 0); /* packet header */ put_v(bc, nut->written_packet_size); /* forward ptr */ return 0; }
false
FFmpeg
a26e1d4c1f7c93d24250dd9c0786241f92fcdea4
static int put_packetheader(NUTContext *nut, ByteIOContext *bc, int max_size, int calculate_checksum) { put_flush_packet(bc); nut->packet_start[2]= url_ftell(bc) - 8; nut->written_packet_size = max_size; if(calculate_checksum) init_checksum(bc, update_adler32, 0); put_v(bc, nut->written_packet_size); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(NUTContext *VAR_0, ByteIOContext *VAR_1, int VAR_2, int VAR_3) { put_flush_packet(VAR_1); VAR_0->packet_start[2]= url_ftell(VAR_1) - 8; VAR_0->written_packet_size = VAR_2; if(VAR_3) init_checksum(VAR_1, update_adler32, 0); put_v(VAR_1, VAR_0->written_packet_size); return 0; }
[ "static int FUNC_0(NUTContext *VAR_0, ByteIOContext *VAR_1, int VAR_2, int VAR_3)\n{", "put_flush_packet(VAR_1);", "VAR_0->packet_start[2]= url_ftell(VAR_1) - 8;", "VAR_0->written_packet_size = VAR_2;", "if(VAR_3)\ninit_checksum(VAR_1, update_adler32, 0);", "put_v(VAR_1, VAR_0->written_packet_size);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13, 15 ], [ 21 ], [ 25 ], [ 27 ] ]
24,229
inline static void RENAME(hcscale)(SwsContext *c, uint16_t *dst, long dstWidth, uint8_t *src1, uint8_t *src2, int srcW, int xInc, int flags, int canMMX2BeUsed, int16_t *hChrFilter, int16_t *hChrFilterPos, int hChrFilterSize, void *funnyUVCode, int srcFormat, uint8_t *formatConvBuffer, int16_t *mmx2Filter, int32_t *mmx2FilterPos, uint8_t *pal) { if (srcFormat==PIX_FMT_YUYV422) { RENAME(yuy2ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } else if (srcFormat==PIX_FMT_UYVY422) { RENAME(uyvyToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } else if (srcFormat==PIX_FMT_RGB32) { if(c->chrSrcHSubSample) RENAME(bgr32ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); else RENAME(bgr32ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } else if (srcFormat==PIX_FMT_RGB32_1) { if(c->chrSrcHSubSample) RENAME(bgr32ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1+ALT32_CORR, src2+ALT32_CORR, srcW); else RENAME(bgr32ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1+ALT32_CORR, src2+ALT32_CORR, srcW); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } else if (srcFormat==PIX_FMT_BGR24) { if(c->chrSrcHSubSample) RENAME(bgr24ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); else RENAME(bgr24ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } else if (srcFormat==PIX_FMT_BGR565) { if(c->chrSrcHSubSample) RENAME(bgr16ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); else RENAME(bgr16ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } else if (srcFormat==PIX_FMT_BGR555) { if(c->chrSrcHSubSample) RENAME(bgr15ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); else RENAME(bgr15ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } else if (srcFormat==PIX_FMT_BGR32) { if(c->chrSrcHSubSample) RENAME(rgb32ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); else RENAME(rgb32ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } else if (srcFormat==PIX_FMT_BGR32_1) { if(c->chrSrcHSubSample) RENAME(rgb32ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1+ALT32_CORR, src2+ALT32_CORR, srcW); else RENAME(rgb32ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1+ALT32_CORR, src2+ALT32_CORR, srcW); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } else if (srcFormat==PIX_FMT_RGB24) { if(c->chrSrcHSubSample) RENAME(rgb24ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); else RENAME(rgb24ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } else if (srcFormat==PIX_FMT_RGB565) { if(c->chrSrcHSubSample) RENAME(rgb16ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); else RENAME(rgb16ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } else if (srcFormat==PIX_FMT_RGB555) { if(c->chrSrcHSubSample) RENAME(rgb15ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); else RENAME(rgb15ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } else if (isGray(srcFormat) || srcFormat==PIX_FMT_MONOBLACK || PIX_FMT_MONOWHITE) { return; } else if (srcFormat==PIX_FMT_RGB8 || srcFormat==PIX_FMT_BGR8 || srcFormat==PIX_FMT_PAL8 || srcFormat==PIX_FMT_BGR4_BYTE || srcFormat==PIX_FMT_RGB4_BYTE) { RENAME(palToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW, (uint32_t*)pal); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } #ifdef HAVE_MMX // Use the new MMX scaler if the MMX2 one can't be used (it is faster than the x86 ASM one). if (!(flags&SWS_FAST_BILINEAR) || (!canMMX2BeUsed)) #else if (!(flags&SWS_FAST_BILINEAR)) #endif { RENAME(hScale)(dst , dstWidth, src1, srcW, xInc, hChrFilter, hChrFilterPos, hChrFilterSize); RENAME(hScale)(dst+VOFW, dstWidth, src2, srcW, xInc, hChrFilter, hChrFilterPos, hChrFilterSize); } else // fast bilinear upscale / crap downscale { #if defined(ARCH_X86) #ifdef HAVE_MMX2 int i; #if defined(PIC) uint64_t ebxsave __attribute__((aligned(8))); #endif if (canMMX2BeUsed) { asm volatile( #if defined(PIC) "mov %%"REG_b", %6 \n\t" #endif "pxor %%mm7, %%mm7 \n\t" "mov %0, %%"REG_c" \n\t" "mov %1, %%"REG_D" \n\t" "mov %2, %%"REG_d" \n\t" "mov %3, %%"REG_b" \n\t" "xor %%"REG_a", %%"REG_a" \n\t" // i PREFETCH" (%%"REG_c") \n\t" PREFETCH" 32(%%"REG_c") \n\t" PREFETCH" 64(%%"REG_c") \n\t" #ifdef ARCH_X86_64 #define FUNNY_UV_CODE \ "movl (%%"REG_b"), %%esi \n\t"\ "call *%4 \n\t"\ "movl (%%"REG_b", %%"REG_a"), %%esi \n\t"\ "add %%"REG_S", %%"REG_c" \n\t"\ "add %%"REG_a", %%"REG_D" \n\t"\ "xor %%"REG_a", %%"REG_a" \n\t"\ #else #define FUNNY_UV_CODE \ "movl (%%"REG_b"), %%esi \n\t"\ "call *%4 \n\t"\ "addl (%%"REG_b", %%"REG_a"), %%"REG_c" \n\t"\ "add %%"REG_a", %%"REG_D" \n\t"\ "xor %%"REG_a", %%"REG_a" \n\t"\ #endif /* ARCH_X86_64 */ FUNNY_UV_CODE FUNNY_UV_CODE FUNNY_UV_CODE FUNNY_UV_CODE "xor %%"REG_a", %%"REG_a" \n\t" // i "mov %5, %%"REG_c" \n\t" // src "mov %1, %%"REG_D" \n\t" // buf1 "add $"AV_STRINGIFY(VOF)", %%"REG_D" \n\t" PREFETCH" (%%"REG_c") \n\t" PREFETCH" 32(%%"REG_c") \n\t" PREFETCH" 64(%%"REG_c") \n\t" FUNNY_UV_CODE FUNNY_UV_CODE FUNNY_UV_CODE FUNNY_UV_CODE #if defined(PIC) "mov %6, %%"REG_b" \n\t" #endif :: "m" (src1), "m" (dst), "m" (mmx2Filter), "m" (mmx2FilterPos), "m" (funnyUVCode), "m" (src2) #if defined(PIC) ,"m" (ebxsave) #endif : "%"REG_a, "%"REG_c, "%"REG_d, "%"REG_S, "%"REG_D #if !defined(PIC) ,"%"REG_b #endif ); for (i=dstWidth-1; (i*xInc)>>16 >=srcW-1; i--) { //printf("%d %d %d\n", dstWidth, i, srcW); dst[i] = src1[srcW-1]*128; dst[i+VOFW] = src2[srcW-1]*128; } } else { #endif /* HAVE_MMX2 */ long xInc_shr16 = (long) (xInc >> 16); uint16_t xInc_mask = xInc & 0xffff; asm volatile( "xor %%"REG_a", %%"REG_a" \n\t" // i "xor %%"REG_d", %%"REG_d" \n\t" // xx "xorl %%ecx, %%ecx \n\t" // 2*xalpha ASMALIGN(4) "1: \n\t" "mov %0, %%"REG_S" \n\t" "movzbl (%%"REG_S", %%"REG_d"), %%edi \n\t" //src[xx] "movzbl 1(%%"REG_S", %%"REG_d"), %%esi \n\t" //src[xx+1] "subl %%edi, %%esi \n\t" //src[xx+1] - src[xx] "imull %%ecx, %%esi \n\t" //(src[xx+1] - src[xx])*2*xalpha "shll $16, %%edi \n\t" "addl %%edi, %%esi \n\t" //src[xx+1]*2*xalpha + src[xx]*(1-2*xalpha) "mov %1, %%"REG_D" \n\t" "shrl $9, %%esi \n\t" "movw %%si, (%%"REG_D", %%"REG_a", 2) \n\t" "movzbl (%5, %%"REG_d"), %%edi \n\t" //src[xx] "movzbl 1(%5, %%"REG_d"), %%esi \n\t" //src[xx+1] "subl %%edi, %%esi \n\t" //src[xx+1] - src[xx] "imull %%ecx, %%esi \n\t" //(src[xx+1] - src[xx])*2*xalpha "shll $16, %%edi \n\t" "addl %%edi, %%esi \n\t" //src[xx+1]*2*xalpha + src[xx]*(1-2*xalpha) "mov %1, %%"REG_D" \n\t" "shrl $9, %%esi \n\t" "movw %%si, "AV_STRINGIFY(VOF)"(%%"REG_D", %%"REG_a", 2) \n\t" "addw %4, %%cx \n\t" //2*xalpha += xInc&0xFF "adc %3, %%"REG_d" \n\t" //xx+= xInc>>8 + carry "add $1, %%"REG_a" \n\t" "cmp %2, %%"REG_a" \n\t" " jb 1b \n\t" /* GCC 3.3 makes MPlayer crash on IA-32 machines when using "g" operand here, which is needed to support GCC 4.0. */ #if defined(ARCH_X86_64) && ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) :: "m" (src1), "m" (dst), "g" ((long)dstWidth), "m" (xInc_shr16), "m" (xInc_mask), #else :: "m" (src1), "m" (dst), "m" ((long)dstWidth), "m" (xInc_shr16), "m" (xInc_mask), #endif "r" (src2) : "%"REG_a, "%"REG_d, "%ecx", "%"REG_D, "%esi" ); #ifdef HAVE_MMX2 } //if MMX2 can't be used #endif #else int i; unsigned int xpos=0; for (i=0;i<dstWidth;i++) { register unsigned int xx=xpos>>16; register unsigned int xalpha=(xpos&0xFFFF)>>9; dst[i]=(src1[xx]*(xalpha^127)+src1[xx+1]*xalpha); dst[i+VOFW]=(src2[xx]*(xalpha^127)+src2[xx+1]*xalpha); /* slower dst[i]= (src1[xx]<<7) + (src1[xx+1] - src1[xx])*xalpha; dst[i+VOFW]=(src2[xx]<<7) + (src2[xx+1] - src2[xx])*xalpha; */ xpos+=xInc; } #endif /* defined(ARCH_X86) */ } if(c->srcRange != c->dstRange && !(isRGB(c->dstFormat) || isBGR(c->dstFormat))){ int i; //FIXME all pal and rgb srcFormats could do this convertion as well //FIXME all scalers more complex than bilinear could do half of this transform if(c->srcRange){ for (i=0; i<dstWidth; i++){ dst[i ]= (dst[i ]*1799 + 4081085)>>11; //1469 dst[i+VOFW]= (dst[i+VOFW]*1799 + 4081085)>>11; //1469 } }else{ for (i=0; i<dstWidth; i++){ dst[i ]= (FFMIN(dst[i ],30775)*4663 - 9289992)>>12; //-264 dst[i+VOFW]= (FFMIN(dst[i+VOFW],30775)*4663 - 9289992)>>12; //-264 } } } }
false
FFmpeg
4bb9adcff1be7ccbb6b8fab40cd68b3808544edc
inline static void RENAME(hcscale)(SwsContext *c, uint16_t *dst, long dstWidth, uint8_t *src1, uint8_t *src2, int srcW, int xInc, int flags, int canMMX2BeUsed, int16_t *hChrFilter, int16_t *hChrFilterPos, int hChrFilterSize, void *funnyUVCode, int srcFormat, uint8_t *formatConvBuffer, int16_t *mmx2Filter, int32_t *mmx2FilterPos, uint8_t *pal) { if (srcFormat==PIX_FMT_YUYV422) { RENAME(yuy2ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } else if (srcFormat==PIX_FMT_UYVY422) { RENAME(uyvyToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } else if (srcFormat==PIX_FMT_RGB32) { if(c->chrSrcHSubSample) RENAME(bgr32ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); else RENAME(bgr32ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } else if (srcFormat==PIX_FMT_RGB32_1) { if(c->chrSrcHSubSample) RENAME(bgr32ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1+ALT32_CORR, src2+ALT32_CORR, srcW); else RENAME(bgr32ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1+ALT32_CORR, src2+ALT32_CORR, srcW); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } else if (srcFormat==PIX_FMT_BGR24) { if(c->chrSrcHSubSample) RENAME(bgr24ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); else RENAME(bgr24ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } else if (srcFormat==PIX_FMT_BGR565) { if(c->chrSrcHSubSample) RENAME(bgr16ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); else RENAME(bgr16ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } else if (srcFormat==PIX_FMT_BGR555) { if(c->chrSrcHSubSample) RENAME(bgr15ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); else RENAME(bgr15ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } else if (srcFormat==PIX_FMT_BGR32) { if(c->chrSrcHSubSample) RENAME(rgb32ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); else RENAME(rgb32ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } else if (srcFormat==PIX_FMT_BGR32_1) { if(c->chrSrcHSubSample) RENAME(rgb32ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1+ALT32_CORR, src2+ALT32_CORR, srcW); else RENAME(rgb32ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1+ALT32_CORR, src2+ALT32_CORR, srcW); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } else if (srcFormat==PIX_FMT_RGB24) { if(c->chrSrcHSubSample) RENAME(rgb24ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); else RENAME(rgb24ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } else if (srcFormat==PIX_FMT_RGB565) { if(c->chrSrcHSubSample) RENAME(rgb16ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); else RENAME(rgb16ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } else if (srcFormat==PIX_FMT_RGB555) { if(c->chrSrcHSubSample) RENAME(rgb15ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); else RENAME(rgb15ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } else if (isGray(srcFormat) || srcFormat==PIX_FMT_MONOBLACK || PIX_FMT_MONOWHITE) { return; } else if (srcFormat==PIX_FMT_RGB8 || srcFormat==PIX_FMT_BGR8 || srcFormat==PIX_FMT_PAL8 || srcFormat==PIX_FMT_BGR4_BYTE || srcFormat==PIX_FMT_RGB4_BYTE) { RENAME(palToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW, (uint32_t*)pal); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } #ifdef HAVE_MMX if (!(flags&SWS_FAST_BILINEAR) || (!canMMX2BeUsed)) #else if (!(flags&SWS_FAST_BILINEAR)) #endif { RENAME(hScale)(dst , dstWidth, src1, srcW, xInc, hChrFilter, hChrFilterPos, hChrFilterSize); RENAME(hScale)(dst+VOFW, dstWidth, src2, srcW, xInc, hChrFilter, hChrFilterPos, hChrFilterSize); } else { #if defined(ARCH_X86) #ifdef HAVE_MMX2 int i; #if defined(PIC) uint64_t ebxsave __attribute__((aligned(8))); #endif if (canMMX2BeUsed) { asm volatile( #if defined(PIC) "mov %%"REG_b", %6 \n\t" #endif "pxor %%mm7, %%mm7 \n\t" "mov %0, %%"REG_c" \n\t" "mov %1, %%"REG_D" \n\t" "mov %2, %%"REG_d" \n\t" "mov %3, %%"REG_b" \n\t" "xor %%"REG_a", %%"REG_a" \n\t" PREFETCH" (%%"REG_c") \n\t" PREFETCH" 32(%%"REG_c") \n\t" PREFETCH" 64(%%"REG_c") \n\t" #ifdef ARCH_X86_64 #define FUNNY_UV_CODE \ "movl (%%"REG_b"), %%esi \n\t"\ "call *%4 \n\t"\ "movl (%%"REG_b", %%"REG_a"), %%esi \n\t"\ "add %%"REG_S", %%"REG_c" \n\t"\ "add %%"REG_a", %%"REG_D" \n\t"\ "xor %%"REG_a", %%"REG_a" \n\t"\ #else #define FUNNY_UV_CODE \ "movl (%%"REG_b"), %%esi \n\t"\ "call *%4 \n\t"\ "addl (%%"REG_b", %%"REG_a"), %%"REG_c" \n\t"\ "add %%"REG_a", %%"REG_D" \n\t"\ "xor %%"REG_a", %%"REG_a" \n\t"\ #endif FUNNY_UV_CODE FUNNY_UV_CODE FUNNY_UV_CODE FUNNY_UV_CODE "xor %%"REG_a", %%"REG_a" \n\t" "mov %5, %%"REG_c" \n\t" "mov %1, %%"REG_D" \n\t" "add $"AV_STRINGIFY(VOF)", %%"REG_D" \n\t" PREFETCH" (%%"REG_c") \n\t" PREFETCH" 32(%%"REG_c") \n\t" PREFETCH" 64(%%"REG_c") \n\t" FUNNY_UV_CODE FUNNY_UV_CODE FUNNY_UV_CODE FUNNY_UV_CODE #if defined(PIC) "mov %6, %%"REG_b" \n\t" #endif :: "m" (src1), "m" (dst), "m" (mmx2Filter), "m" (mmx2FilterPos), "m" (funnyUVCode), "m" (src2) #if defined(PIC) ,"m" (ebxsave) #endif : "%"REG_a, "%"REG_c, "%"REG_d, "%"REG_S, "%"REG_D #if !defined(PIC) ,"%"REG_b #endif ); for (i=dstWidth-1; (i*xInc)>>16 >=srcW-1; i--) { dst[i] = src1[srcW-1]*128; dst[i+VOFW] = src2[srcW-1]*128; } } else { #endif long xInc_shr16 = (long) (xInc >> 16); uint16_t xInc_mask = xInc & 0xffff; asm volatile( "xor %%"REG_a", %%"REG_a" \n\t" "xor %%"REG_d", %%"REG_d" \n\t" "xorl %%ecx, %%ecx \n\t" ASMALIGN(4) "1: \n\t" "mov %0, %%"REG_S" \n\t" "movzbl (%%"REG_S", %%"REG_d"), %%edi \n\t" "movzbl 1(%%"REG_S", %%"REG_d"), %%esi \n\t" "subl %%edi, %%esi \n\t" - src[xx] "imull %%ecx, %%esi \n\t" "shll $16, %%edi \n\t" "addl %%edi, %%esi \n\t" *2*xalpha + src[xx]*(1-2*xalpha) "mov %1, %%"REG_D" \n\t" "shrl $9, %%esi \n\t" "movw %%si, (%%"REG_D", %%"REG_a", 2) \n\t" "movzbl (%5, %%"REG_d"), %%edi \n\t" "movzbl 1(%5, %%"REG_d"), %%esi \n\t" "subl %%edi, %%esi \n\t" - src[xx] "imull %%ecx, %%esi \n\t" "shll $16, %%edi \n\t" "addl %%edi, %%esi \n\t" *2*xalpha + src[xx]*(1-2*xalpha) "mov %1, %%"REG_D" \n\t" "shrl $9, %%esi \n\t" "movw %%si, "AV_STRINGIFY(VOF)"(%%"REG_D", %%"REG_a", 2) \n\t" "addw %4, %%cx \n\t" "adc %3, %%"REG_d" \n\t" "add $1, %%"REG_a" \n\t" "cmp %2, %%"REG_a" \n\t" " jb 1b \n\t" #if defined(ARCH_X86_64) && ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) :: "m" (src1), "m" (dst), "g" ((long)dstWidth), "m" (xInc_shr16), "m" (xInc_mask), #else :: "m" (src1), "m" (dst), "m" ((long)dstWidth), "m" (xInc_shr16), "m" (xInc_mask), #endif "r" (src2) : "%"REG_a, "%"REG_d, "%ecx", "%"REG_D, "%esi" ); #ifdef HAVE_MMX2 } #endif #else int i; unsigned int xpos=0; for (i=0;i<dstWidth;i++) { register unsigned int xx=xpos>>16; register unsigned int xalpha=(xpos&0xFFFF)>>9; dst[i]=(src1[xx]*(xalpha^127)+src1[xx+1]*xalpha); dst[i+VOFW]=(src2[xx]*(xalpha^127)+src2[xx+1]*xalpha); xpos+=xInc; } #endif } if(c->srcRange != c->dstRange && !(isRGB(c->dstFormat) || isBGR(c->dstFormat))){ int i; if(c->srcRange){ for (i=0; i<dstWidth; i++){ dst[i ]= (dst[i ]*1799 + 4081085)>>11; dst[i+VOFW]= (dst[i+VOFW]*1799 + 4081085)>>11; } }else{ for (i=0; i<dstWidth; i++){ dst[i ]= (FFMIN(dst[i ],30775)*4663 - 9289992)>>12; dst[i+VOFW]= (FFMIN(dst[i+VOFW],30775)*4663 - 9289992)>>12; } } } }
{ "code": [], "line_no": [] }
inline static void FUNC_0(hcscale)(SwsContext *c, uint16_t *dst, long dstWidth, uint8_t *src1, uint8_t *src2, int srcW, int xInc, int flags, int canMMX2BeUsed, int16_t *hChrFilter, int16_t *hChrFilterPos, int hChrFilterSize, void *funnyUVCode, int srcFormat, uint8_t *formatConvBuffer, int16_t *mmx2Filter, int32_t *mmx2FilterPos, uint8_t *pal) { if (srcFormat==PIX_FMT_YUYV422) { FUNC_0(yuy2ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } else if (srcFormat==PIX_FMT_UYVY422) { FUNC_0(uyvyToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } else if (srcFormat==PIX_FMT_RGB32) { if(c->chrSrcHSubSample) FUNC_0(bgr32ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); else FUNC_0(bgr32ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } else if (srcFormat==PIX_FMT_RGB32_1) { if(c->chrSrcHSubSample) FUNC_0(bgr32ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1+ALT32_CORR, src2+ALT32_CORR, srcW); else FUNC_0(bgr32ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1+ALT32_CORR, src2+ALT32_CORR, srcW); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } else if (srcFormat==PIX_FMT_BGR24) { if(c->chrSrcHSubSample) FUNC_0(bgr24ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); else FUNC_0(bgr24ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } else if (srcFormat==PIX_FMT_BGR565) { if(c->chrSrcHSubSample) FUNC_0(bgr16ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); else FUNC_0(bgr16ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } else if (srcFormat==PIX_FMT_BGR555) { if(c->chrSrcHSubSample) FUNC_0(bgr15ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); else FUNC_0(bgr15ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } else if (srcFormat==PIX_FMT_BGR32) { if(c->chrSrcHSubSample) FUNC_0(rgb32ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); else FUNC_0(rgb32ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } else if (srcFormat==PIX_FMT_BGR32_1) { if(c->chrSrcHSubSample) FUNC_0(rgb32ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1+ALT32_CORR, src2+ALT32_CORR, srcW); else FUNC_0(rgb32ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1+ALT32_CORR, src2+ALT32_CORR, srcW); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } else if (srcFormat==PIX_FMT_RGB24) { if(c->chrSrcHSubSample) FUNC_0(rgb24ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); else FUNC_0(rgb24ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } else if (srcFormat==PIX_FMT_RGB565) { if(c->chrSrcHSubSample) FUNC_0(rgb16ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); else FUNC_0(rgb16ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } else if (srcFormat==PIX_FMT_RGB555) { if(c->chrSrcHSubSample) FUNC_0(rgb15ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); else FUNC_0(rgb15ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } else if (isGray(srcFormat) || srcFormat==PIX_FMT_MONOBLACK || PIX_FMT_MONOWHITE) { return; } else if (srcFormat==PIX_FMT_RGB8 || srcFormat==PIX_FMT_BGR8 || srcFormat==PIX_FMT_PAL8 || srcFormat==PIX_FMT_BGR4_BYTE || srcFormat==PIX_FMT_RGB4_BYTE) { FUNC_0(palToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW, (uint32_t*)pal); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } #ifdef HAVE_MMX if (!(flags&SWS_FAST_BILINEAR) || (!canMMX2BeUsed)) #else if (!(flags&SWS_FAST_BILINEAR)) #endif { FUNC_0(hScale)(dst , dstWidth, src1, srcW, xInc, hChrFilter, hChrFilterPos, hChrFilterSize); FUNC_0(hScale)(dst+VOFW, dstWidth, src2, srcW, xInc, hChrFilter, hChrFilterPos, hChrFilterSize); } else { #if defined(ARCH_X86) #ifdef HAVE_MMX2 int VAR_2; #if defined(PIC) uint64_t ebxsave __attribute__((aligned(8))); #endif if (canMMX2BeUsed) { asm volatile( #if defined(PIC) "mov %%"REG_b", %6 \n\t" #endif "pxor %%mm7, %%mm7 \n\t" "mov %0, %%"REG_c" \n\t" "mov %1, %%"REG_D" \n\t" "mov %2, %%"REG_d" \n\t" "mov %3, %%"REG_b" \n\t" "xor %%"REG_a", %%"REG_a" \n\t" PREFETCH" (%%"REG_c") \n\t" PREFETCH" 32(%%"REG_c") \n\t" PREFETCH" 64(%%"REG_c") \n\t" #ifdef ARCH_X86_64 #define FUNNY_UV_CODE \ "movl (%%"REG_b"), %%esi \n\t"\ "call *%4 \n\t"\ "movl (%%"REG_b", %%"REG_a"), %%esi \n\t"\ "add %%"REG_S", %%"REG_c" \n\t"\ "add %%"REG_a", %%"REG_D" \n\t"\ "xor %%"REG_a", %%"REG_a" \n\t"\ #else #define FUNNY_UV_CODE \ "movl (%%"REG_b"), %%esi \n\t"\ "call *%4 \n\t"\ "addl (%%"REG_b", %%"REG_a"), %%"REG_c" \n\t"\ "add %%"REG_a", %%"REG_D" \n\t"\ "xor %%"REG_a", %%"REG_a" \n\t"\ #endif FUNNY_UV_CODE FUNNY_UV_CODE FUNNY_UV_CODE FUNNY_UV_CODE "xor %%"REG_a", %%"REG_a" \n\t" "mov %5, %%"REG_c" \n\t" "mov %1, %%"REG_D" \n\t" "add $"AV_STRINGIFY(VOF)", %%"REG_D" \n\t" PREFETCH" (%%"REG_c") \n\t" PREFETCH" 32(%%"REG_c") \n\t" PREFETCH" 64(%%"REG_c") \n\t" FUNNY_UV_CODE FUNNY_UV_CODE FUNNY_UV_CODE FUNNY_UV_CODE #if defined(PIC) "mov %6, %%"REG_b" \n\t" #endif :: "m" (src1), "m" (dst), "m" (mmx2Filter), "m" (mmx2FilterPos), "m" (funnyUVCode), "m" (src2) #if defined(PIC) ,"m" (ebxsave) #endif : "%"REG_a, "%"REG_c, "%"REG_d, "%"REG_S, "%"REG_D #if !defined(PIC) ,"%"REG_b #endif ); for (VAR_2=dstWidth-1; (VAR_2*xInc)>>16 >=srcW-1; VAR_2--) { dst[VAR_2] = src1[srcW-1]*128; dst[VAR_2+VOFW] = src2[srcW-1]*128; } } else { #endif long xInc_shr16 = (long) (xInc >> 16); uint16_t xInc_mask = xInc & 0xffff; asm volatile( "xor %%"REG_a", %%"REG_a" \n\t" "xor %%"REG_d", %%"REG_d" \n\t" "xorl %%ecx, %%ecx \n\t" ASMALIGN(4) "1: \n\t" "mov %0, %%"REG_S" \n\t" "movzbl (%%"REG_S", %%"REG_d"), %%edi \n\t" "movzbl 1(%%"REG_S", %%"REG_d"), %%esi \n\t" "subl %%edi, %%esi \n\t" - src[xx] "imull %%ecx, %%esi \n\t" "shll $16, %%edi \n\t" "addl %%edi, %%esi \n\t" *2*xalpha + src[xx]*(1-2*xalpha) "mov %1, %%"REG_D" \n\t" "shrl $9, %%esi \n\t" "movw %%si, (%%"REG_D", %%"REG_a", 2) \n\t" "movzbl (%5, %%"REG_d"), %%edi \n\t" "movzbl 1(%5, %%"REG_d"), %%esi \n\t" "subl %%edi, %%esi \n\t" - src[xx] "imull %%ecx, %%esi \n\t" "shll $16, %%edi \n\t" "addl %%edi, %%esi \n\t" *2*xalpha + src[xx]*(1-2*xalpha) "mov %1, %%"REG_D" \n\t" "shrl $9, %%esi \n\t" "movw %%si, "AV_STRINGIFY(VOF)"(%%"REG_D", %%"REG_a", 2) \n\t" "addw %4, %%cx \n\t" "adc %3, %%"REG_d" \n\t" "add $1, %%"REG_a" \n\t" "cmp %2, %%"REG_a" \n\t" " jb 1b \n\t" #if defined(ARCH_X86_64) && ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) :: "m" (src1), "m" (dst), "g" ((long)dstWidth), "m" (xInc_shr16), "m" (xInc_mask), #else :: "m" (src1), "m" (dst), "m" ((long)dstWidth), "m" (xInc_shr16), "m" (xInc_mask), #endif "r" (src2) : "%"REG_a, "%"REG_d, "%ecx", "%"REG_D, "%esi" ); #ifdef HAVE_MMX2 } #endif #else int VAR_2; unsigned int VAR_1=0; for (VAR_2=0;VAR_2<dstWidth;VAR_2++) { register unsigned int xx=VAR_1>>16; register unsigned int xalpha=(VAR_1&0xFFFF)>>9; dst[VAR_2]=(src1[xx]*(xalpha^127)+src1[xx+1]*xalpha); dst[VAR_2+VOFW]=(src2[xx]*(xalpha^127)+src2[xx+1]*xalpha); VAR_1+=xInc; } #endif } if(c->srcRange != c->dstRange && !(isRGB(c->dstFormat) || isBGR(c->dstFormat))){ int VAR_2; if(c->srcRange){ for (VAR_2=0; VAR_2<dstWidth; VAR_2++){ dst[VAR_2 ]= (dst[VAR_2 ]*1799 + 4081085)>>11; dst[VAR_2+VOFW]= (dst[VAR_2+VOFW]*1799 + 4081085)>>11; } }else{ for (VAR_2=0; VAR_2<dstWidth; VAR_2++){ dst[VAR_2 ]= (FFMIN(dst[VAR_2 ],30775)*4663 - 9289992)>>12; dst[VAR_2+VOFW]= (FFMIN(dst[VAR_2+VOFW],30775)*4663 - 9289992)>>12; } } } }
[ "inline static void FUNC_0(hcscale)(SwsContext *c, uint16_t *dst, long dstWidth, uint8_t *src1, uint8_t *src2,\nint srcW, int xInc, int flags, int canMMX2BeUsed, int16_t *hChrFilter,\nint16_t *hChrFilterPos, int hChrFilterSize, void *funnyUVCode,\nint srcFormat, uint8_t *formatConvBuffer, int16_t *mmx2Filter,\nint32_t *mmx2FilterPos, uint8_t *pal)\n{", "if (srcFormat==PIX_FMT_YUYV422)\n{", "FUNC_0(yuy2ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW);", "src1= formatConvBuffer;", "src2= formatConvBuffer+VOFW;", "}", "else if (srcFormat==PIX_FMT_UYVY422)\n{", "FUNC_0(uyvyToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW);", "src1= formatConvBuffer;", "src2= formatConvBuffer+VOFW;", "}", "else if (srcFormat==PIX_FMT_RGB32)\n{", "if(c->chrSrcHSubSample)\nFUNC_0(bgr32ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW);", "else\nFUNC_0(bgr32ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW);", "src1= formatConvBuffer;", "src2= formatConvBuffer+VOFW;", "}", "else if (srcFormat==PIX_FMT_RGB32_1)\n{", "if(c->chrSrcHSubSample)\nFUNC_0(bgr32ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1+ALT32_CORR, src2+ALT32_CORR, srcW);", "else\nFUNC_0(bgr32ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1+ALT32_CORR, src2+ALT32_CORR, srcW);", "src1= formatConvBuffer;", "src2= formatConvBuffer+VOFW;", "}", "else if (srcFormat==PIX_FMT_BGR24)\n{", "if(c->chrSrcHSubSample)\nFUNC_0(bgr24ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW);", "else\nFUNC_0(bgr24ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW);", "src1= formatConvBuffer;", "src2= formatConvBuffer+VOFW;", "}", "else if (srcFormat==PIX_FMT_BGR565)\n{", "if(c->chrSrcHSubSample)\nFUNC_0(bgr16ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW);", "else\nFUNC_0(bgr16ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW);", "src1= formatConvBuffer;", "src2= formatConvBuffer+VOFW;", "}", "else if (srcFormat==PIX_FMT_BGR555)\n{", "if(c->chrSrcHSubSample)\nFUNC_0(bgr15ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW);", "else\nFUNC_0(bgr15ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW);", "src1= formatConvBuffer;", "src2= formatConvBuffer+VOFW;", "}", "else if (srcFormat==PIX_FMT_BGR32)\n{", "if(c->chrSrcHSubSample)\nFUNC_0(rgb32ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW);", "else\nFUNC_0(rgb32ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW);", "src1= formatConvBuffer;", "src2= formatConvBuffer+VOFW;", "}", "else if (srcFormat==PIX_FMT_BGR32_1)\n{", "if(c->chrSrcHSubSample)\nFUNC_0(rgb32ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1+ALT32_CORR, src2+ALT32_CORR, srcW);", "else\nFUNC_0(rgb32ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1+ALT32_CORR, src2+ALT32_CORR, srcW);", "src1= formatConvBuffer;", "src2= formatConvBuffer+VOFW;", "}", "else if (srcFormat==PIX_FMT_RGB24)\n{", "if(c->chrSrcHSubSample)\nFUNC_0(rgb24ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW);", "else\nFUNC_0(rgb24ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW);", "src1= formatConvBuffer;", "src2= formatConvBuffer+VOFW;", "}", "else if (srcFormat==PIX_FMT_RGB565)\n{", "if(c->chrSrcHSubSample)\nFUNC_0(rgb16ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW);", "else\nFUNC_0(rgb16ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW);", "src1= formatConvBuffer;", "src2= formatConvBuffer+VOFW;", "}", "else if (srcFormat==PIX_FMT_RGB555)\n{", "if(c->chrSrcHSubSample)\nFUNC_0(rgb15ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW);", "else\nFUNC_0(rgb15ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW);", "src1= formatConvBuffer;", "src2= formatConvBuffer+VOFW;", "}", "else if (isGray(srcFormat) || srcFormat==PIX_FMT_MONOBLACK || PIX_FMT_MONOWHITE)\n{", "return;", "}", "else if (srcFormat==PIX_FMT_RGB8 || srcFormat==PIX_FMT_BGR8 || srcFormat==PIX_FMT_PAL8 || srcFormat==PIX_FMT_BGR4_BYTE || srcFormat==PIX_FMT_RGB4_BYTE)\n{", "FUNC_0(palToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW, (uint32_t*)pal);", "src1= formatConvBuffer;", "src2= formatConvBuffer+VOFW;", "}", "#ifdef HAVE_MMX\nif (!(flags&SWS_FAST_BILINEAR) || (!canMMX2BeUsed))\n#else\nif (!(flags&SWS_FAST_BILINEAR))\n#endif\n{", "FUNC_0(hScale)(dst , dstWidth, src1, srcW, xInc, hChrFilter, hChrFilterPos, hChrFilterSize);", "FUNC_0(hScale)(dst+VOFW, dstWidth, src2, srcW, xInc, hChrFilter, hChrFilterPos, hChrFilterSize);", "}", "else\n{", "#if defined(ARCH_X86)\n#ifdef HAVE_MMX2\nint VAR_2;", "#if defined(PIC)\nuint64_t ebxsave __attribute__((aligned(8)));", "#endif\nif (canMMX2BeUsed)\n{", "asm volatile(\n#if defined(PIC)\n\"mov %%\"REG_b\", %6 \\n\\t\"\n#endif\n\"pxor %%mm7, %%mm7 \\n\\t\"\n\"mov %0, %%\"REG_c\" \\n\\t\"\n\"mov %1, %%\"REG_D\" \\n\\t\"\n\"mov %2, %%\"REG_d\" \\n\\t\"\n\"mov %3, %%\"REG_b\" \\n\\t\"\n\"xor %%\"REG_a\", %%\"REG_a\" \\n\\t\"\nPREFETCH\" (%%\"REG_c\") \\n\\t\"\nPREFETCH\" 32(%%\"REG_c\") \\n\\t\"\nPREFETCH\" 64(%%\"REG_c\") \\n\\t\"\n#ifdef ARCH_X86_64\n#define FUNNY_UV_CODE \\\n\"movl (%%\"REG_b\"), %%esi \\n\\t\"\\\n\"call *%4 \\n\\t\"\\\n\"movl (%%\"REG_b\", %%\"REG_a\"), %%esi \\n\\t\"\\\n\"add %%\"REG_S\", %%\"REG_c\" \\n\\t\"\\\n\"add %%\"REG_a\", %%\"REG_D\" \\n\\t\"\\\n\"xor %%\"REG_a\", %%\"REG_a\" \\n\\t\"\\\n#else\n#define FUNNY_UV_CODE \\\n\"movl (%%\"REG_b\"), %%esi \\n\\t\"\\\n\"call *%4 \\n\\t\"\\\n\"addl (%%\"REG_b\", %%\"REG_a\"), %%\"REG_c\" \\n\\t\"\\\n\"add %%\"REG_a\", %%\"REG_D\" \\n\\t\"\\\n\"xor %%\"REG_a\", %%\"REG_a\" \\n\\t\"\\\n#endif\nFUNNY_UV_CODE\nFUNNY_UV_CODE\nFUNNY_UV_CODE\nFUNNY_UV_CODE\n\"xor %%\"REG_a\", %%\"REG_a\" \\n\\t\"\n\"mov %5, %%\"REG_c\" \\n\\t\"\n\"mov %1, %%\"REG_D\" \\n\\t\"\n\"add $\"AV_STRINGIFY(VOF)\", %%\"REG_D\" \\n\\t\"\nPREFETCH\" (%%\"REG_c\") \\n\\t\"\nPREFETCH\" 32(%%\"REG_c\") \\n\\t\"\nPREFETCH\" 64(%%\"REG_c\") \\n\\t\"\nFUNNY_UV_CODE\nFUNNY_UV_CODE\nFUNNY_UV_CODE\nFUNNY_UV_CODE\n#if defined(PIC)\n\"mov %6, %%\"REG_b\" \\n\\t\"\n#endif\n:: \"m\" (src1), \"m\" (dst), \"m\" (mmx2Filter), \"m\" (mmx2FilterPos),\n\"m\" (funnyUVCode), \"m\" (src2)\n#if defined(PIC)\n,\"m\" (ebxsave)\n#endif\n: \"%\"REG_a, \"%\"REG_c, \"%\"REG_d, \"%\"REG_S, \"%\"REG_D\n#if !defined(PIC)\n,\"%\"REG_b\n#endif\n);", "for (VAR_2=dstWidth-1; (VAR_2*xInc)>>16 >=srcW-1; VAR_2--)", "{", "dst[VAR_2] = src1[srcW-1]*128;", "dst[VAR_2+VOFW] = src2[srcW-1]*128;", "}", "}", "else\n{", "#endif\nlong xInc_shr16 = (long) (xInc >> 16);", "uint16_t xInc_mask = xInc & 0xffff;", "asm volatile(\n\"xor %%\"REG_a\", %%\"REG_a\" \\n\\t\"\n\"xor %%\"REG_d\", %%\"REG_d\" \\n\\t\"\n\"xorl %%ecx, %%ecx \\n\\t\"\nASMALIGN(4)\n\"1: \\n\\t\"\n\"mov %0, %%\"REG_S\" \\n\\t\"\n\"movzbl (%%\"REG_S\", %%\"REG_d\"), %%edi \\n\\t\"\n\"movzbl 1(%%\"REG_S\", %%\"REG_d\"), %%esi \\n\\t\"\n\"subl %%edi, %%esi \\n\\t\" - src[xx]\n\"imull %%ecx, %%esi \\n\\t\"\n\"shll $16, %%edi \\n\\t\"\n\"addl %%edi, %%esi \\n\\t\" *2*xalpha + src[xx]*(1-2*xalpha)\n\"mov %1, %%\"REG_D\" \\n\\t\"\n\"shrl $9, %%esi \\n\\t\"\n\"movw %%si, (%%\"REG_D\", %%\"REG_a\", 2) \\n\\t\"\n\"movzbl (%5, %%\"REG_d\"), %%edi \\n\\t\"\n\"movzbl 1(%5, %%\"REG_d\"), %%esi \\n\\t\"\n\"subl %%edi, %%esi \\n\\t\" - src[xx]\n\"imull %%ecx, %%esi \\n\\t\"\n\"shll $16, %%edi \\n\\t\"\n\"addl %%edi, %%esi \\n\\t\" *2*xalpha + src[xx]*(1-2*xalpha)\n\"mov %1, %%\"REG_D\" \\n\\t\"\n\"shrl $9, %%esi \\n\\t\"\n\"movw %%si, \"AV_STRINGIFY(VOF)\"(%%\"REG_D\", %%\"REG_a\", 2) \\n\\t\"\n\"addw %4, %%cx \\n\\t\"\n\"adc %3, %%\"REG_d\" \\n\\t\"\n\"add $1, %%\"REG_a\" \\n\\t\"\n\"cmp %2, %%\"REG_a\" \\n\\t\"\n\" jb 1b \\n\\t\"\n#if defined(ARCH_X86_64) && ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))\n:: \"m\" (src1), \"m\" (dst), \"g\" ((long)dstWidth), \"m\" (xInc_shr16), \"m\" (xInc_mask),\n#else\n:: \"m\" (src1), \"m\" (dst), \"m\" ((long)dstWidth), \"m\" (xInc_shr16), \"m\" (xInc_mask),\n#endif\n\"r\" (src2)\n: \"%\"REG_a, \"%\"REG_d, \"%ecx\", \"%\"REG_D, \"%esi\"\n);", "#ifdef HAVE_MMX2\n}", "#endif\n#else\nint VAR_2;", "unsigned int VAR_1=0;", "for (VAR_2=0;VAR_2<dstWidth;VAR_2++)", "{", "register unsigned int xx=VAR_1>>16;", "register unsigned int xalpha=(VAR_1&0xFFFF)>>9;", "dst[VAR_2]=(src1[xx]*(xalpha^127)+src1[xx+1]*xalpha);", "dst[VAR_2+VOFW]=(src2[xx]*(xalpha^127)+src2[xx+1]*xalpha);", "VAR_1+=xInc;", "}", "#endif\n}", "if(c->srcRange != c->dstRange && !(isRGB(c->dstFormat) || isBGR(c->dstFormat))){", "int VAR_2;", "if(c->srcRange){", "for (VAR_2=0; VAR_2<dstWidth; VAR_2++){", "dst[VAR_2 ]= (dst[VAR_2 ]*1799 + 4081085)>>11;", "dst[VAR_2+VOFW]= (dst[VAR_2+VOFW]*1799 + 4081085)>>11;", "}", "}else{", "for (VAR_2=0; VAR_2<dstWidth; VAR_2++){", "dst[VAR_2 ]= (FFMIN(dst[VAR_2 ],30775)*4663 - 9289992)>>12;", "dst[VAR_2+VOFW]= (FFMIN(dst[VAR_2+VOFW],30775)*4663 - 9289992)>>12;", "}", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37, 39 ], [ 41, 43 ], [ 45, 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55, 57 ], [ 59, 61 ], [ 63, 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73, 75 ], [ 77, 79 ], [ 81, 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91, 93 ], [ 95, 97 ], [ 99, 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109, 111 ], [ 113, 115 ], [ 117, 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127, 129 ], [ 131, 133 ], [ 135, 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145, 147 ], [ 149, 151 ], [ 153, 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163, 165 ], [ 167, 169 ], [ 171, 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181, 183 ], [ 185, 187 ], [ 189, 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199, 201 ], [ 203, 205 ], [ 207, 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217, 219 ], [ 221 ], [ 223 ], [ 225, 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 239, 243, 245, 247, 249, 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259, 261 ], [ 263, 265, 267 ], [ 269, 271 ], [ 273, 275, 277 ], [ 279, 281, 283, 285, 287, 289, 291, 293, 295, 297, 299, 301, 303, 307, 311, 313, 315, 317, 319, 321, 323, 327, 331, 333, 335, 337, 339, 341, 345, 349, 351, 353, 355, 357, 359, 361, 363, 365, 367, 369, 373, 375, 377, 379, 383, 385, 387, 389, 391, 393, 395, 397, 399, 401, 403, 405, 407 ], [ 409 ], [ 411 ], [ 415 ], [ 417 ], [ 419 ], [ 421 ], [ 423, 425 ], [ 427, 429 ], [ 431 ], [ 433, 435, 437, 439, 441, 443, 445, 447, 449, 451, 453, 455, 457, 459, 461, 463, 467, 469, 471, 473, 475, 477, 479, 481, 483, 487, 489, 491, 493, 495, 503, 505, 507, 509, 511, 513, 515, 517 ], [ 519, 521 ], [ 523, 525, 527 ], [ 529 ], [ 531 ], [ 533 ], [ 535 ], [ 537 ], [ 539 ], [ 541 ], [ 551 ], [ 553 ], [ 555, 557 ], [ 559 ], [ 561 ], [ 567 ], [ 569 ], [ 571 ], [ 573 ], [ 575 ], [ 577 ], [ 579 ], [ 581 ], [ 583 ], [ 585 ], [ 587 ], [ 589 ], [ 591 ] ]
24,232
int avpriv_unlock_avformat(void) { if (lockmgr_cb) { if ((*lockmgr_cb)(&avformat_mutex, AV_LOCK_RELEASE)) return -1; } return 0; }
true
FFmpeg
a04c2c707de2ce850f79870e84ac9d7ec7aa9143
int avpriv_unlock_avformat(void) { if (lockmgr_cb) { if ((*lockmgr_cb)(&avformat_mutex, AV_LOCK_RELEASE)) return -1; } return 0; }
{ "code": [ " if (lockmgr_cb) {", " if (lockmgr_cb) {", " return -1;", " if (lockmgr_cb) {", " return -1;", " if (lockmgr_cb) {", " return -1;", " return 0;", " if (lockmgr_cb) {", " if ((*lockmgr_cb)(&avformat_mutex, AV_LOCK_RELEASE))", " return -1;", " return 0;" ], "line_no": [ 5, 5, 9, 5, 9, 5, 9, 13, 5, 7, 9, 13 ] }
int FUNC_0(void) { if (lockmgr_cb) { if ((*lockmgr_cb)(&avformat_mutex, AV_LOCK_RELEASE)) return -1; } return 0; }
[ "int FUNC_0(void)\n{", "if (lockmgr_cb) {", "if ((*lockmgr_cb)(&avformat_mutex, AV_LOCK_RELEASE))\nreturn -1;", "}", "return 0;", "}" ]
[ 0, 1, 1, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 11 ], [ 13 ], [ 15 ] ]
24,233
static int disas_neon_ls_insn(CPUState * env, DisasContext *s, uint32_t insn) { int rd, rn, rm; int op; int nregs; int interleave; int spacing; int stride; int size; int reg; int pass; int load; int shift; int n; TCGv addr; TCGv tmp; TCGv tmp2; TCGv_i64 tmp64; if (!s->vfp_enabled) return 1; VFP_DREG_D(rd, insn); rn = (insn >> 16) & 0xf; rm = insn & 0xf; load = (insn & (1 << 21)) != 0; addr = tcg_temp_new_i32(); if ((insn & (1 << 23)) == 0) { /* Load store all elements. */ op = (insn >> 8) & 0xf; size = (insn >> 6) & 3; if (op > 10) return 1; nregs = neon_ls_element_type[op].nregs; interleave = neon_ls_element_type[op].interleave; spacing = neon_ls_element_type[op].spacing; if (size == 3 && (interleave | spacing) != 1) return 1; load_reg_var(s, addr, rn); stride = (1 << size) * interleave; for (reg = 0; reg < nregs; reg++) { if (interleave > 2 || (interleave == 2 && nregs == 2)) { load_reg_var(s, addr, rn); tcg_gen_addi_i32(addr, addr, (1 << size) * reg); } else if (interleave == 2 && nregs == 4 && reg == 2) { load_reg_var(s, addr, rn); tcg_gen_addi_i32(addr, addr, 1 << size); } if (size == 3) { if (load) { tmp64 = gen_ld64(addr, IS_USER(s)); neon_store_reg64(tmp64, rd); tcg_temp_free_i64(tmp64); } else { tmp64 = tcg_temp_new_i64(); neon_load_reg64(tmp64, rd); gen_st64(tmp64, addr, IS_USER(s)); } tcg_gen_addi_i32(addr, addr, stride); } else { for (pass = 0; pass < 2; pass++) { if (size == 2) { if (load) { tmp = gen_ld32(addr, IS_USER(s)); neon_store_reg(rd, pass, tmp); } else { tmp = neon_load_reg(rd, pass); gen_st32(tmp, addr, IS_USER(s)); } tcg_gen_addi_i32(addr, addr, stride); } else if (size == 1) { if (load) { tmp = gen_ld16u(addr, IS_USER(s)); tcg_gen_addi_i32(addr, addr, stride); tmp2 = gen_ld16u(addr, IS_USER(s)); tcg_gen_addi_i32(addr, addr, stride); tcg_gen_shli_i32(tmp2, tmp2, 16); tcg_gen_or_i32(tmp, tmp, tmp2); tcg_temp_free_i32(tmp2); neon_store_reg(rd, pass, tmp); } else { tmp = neon_load_reg(rd, pass); tmp2 = tcg_temp_new_i32(); tcg_gen_shri_i32(tmp2, tmp, 16); gen_st16(tmp, addr, IS_USER(s)); tcg_gen_addi_i32(addr, addr, stride); gen_st16(tmp2, addr, IS_USER(s)); tcg_gen_addi_i32(addr, addr, stride); } } else /* size == 0 */ { if (load) { TCGV_UNUSED(tmp2); for (n = 0; n < 4; n++) { tmp = gen_ld8u(addr, IS_USER(s)); tcg_gen_addi_i32(addr, addr, stride); if (n == 0) { tmp2 = tmp; } else { tcg_gen_shli_i32(tmp, tmp, n * 8); tcg_gen_or_i32(tmp2, tmp2, tmp); tcg_temp_free_i32(tmp); } } neon_store_reg(rd, pass, tmp2); } else { tmp2 = neon_load_reg(rd, pass); for (n = 0; n < 4; n++) { tmp = tcg_temp_new_i32(); if (n == 0) { tcg_gen_mov_i32(tmp, tmp2); } else { tcg_gen_shri_i32(tmp, tmp2, n * 8); } gen_st8(tmp, addr, IS_USER(s)); tcg_gen_addi_i32(addr, addr, stride); } tcg_temp_free_i32(tmp2); } } } } rd += spacing; } stride = nregs * 8; } else { size = (insn >> 10) & 3; if (size == 3) { /* Load single element to all lanes. */ int a = (insn >> 4) & 1; if (!load) { return 1; } size = (insn >> 6) & 3; nregs = ((insn >> 8) & 3) + 1; if (size == 3) { if (nregs != 4 || a == 0) { return 1; } /* For VLD4 size==3 a == 1 means 32 bits at 16 byte alignment */ size = 2; } if (nregs == 1 && a == 1 && size == 0) { return 1; } if (nregs == 3 && a == 1) { return 1; } load_reg_var(s, addr, rn); if (nregs == 1) { /* VLD1 to all lanes: bit 5 indicates how many Dregs to write */ tmp = gen_load_and_replicate(s, addr, size); tcg_gen_st_i32(tmp, cpu_env, neon_reg_offset(rd, 0)); tcg_gen_st_i32(tmp, cpu_env, neon_reg_offset(rd, 1)); if (insn & (1 << 5)) { tcg_gen_st_i32(tmp, cpu_env, neon_reg_offset(rd + 1, 0)); tcg_gen_st_i32(tmp, cpu_env, neon_reg_offset(rd + 1, 1)); } tcg_temp_free_i32(tmp); } else { /* VLD2/3/4 to all lanes: bit 5 indicates register stride */ stride = (insn & (1 << 5)) ? 2 : 1; for (reg = 0; reg < nregs; reg++) { tmp = gen_load_and_replicate(s, addr, size); tcg_gen_st_i32(tmp, cpu_env, neon_reg_offset(rd, 0)); tcg_gen_st_i32(tmp, cpu_env, neon_reg_offset(rd, 1)); tcg_temp_free_i32(tmp); tcg_gen_addi_i32(addr, addr, 1 << size); rd += stride; } } stride = (1 << size) * nregs; } else { /* Single element. */ pass = (insn >> 7) & 1; switch (size) { case 0: shift = ((insn >> 5) & 3) * 8; stride = 1; break; case 1: shift = ((insn >> 6) & 1) * 16; stride = (insn & (1 << 5)) ? 2 : 1; break; case 2: shift = 0; stride = (insn & (1 << 6)) ? 2 : 1; break; default: abort(); } nregs = ((insn >> 8) & 3) + 1; load_reg_var(s, addr, rn); for (reg = 0; reg < nregs; reg++) { if (load) { switch (size) { case 0: tmp = gen_ld8u(addr, IS_USER(s)); break; case 1: tmp = gen_ld16u(addr, IS_USER(s)); break; case 2: tmp = gen_ld32(addr, IS_USER(s)); break; default: /* Avoid compiler warnings. */ abort(); } if (size != 2) { tmp2 = neon_load_reg(rd, pass); gen_bfi(tmp, tmp2, tmp, shift, size ? 0xffff : 0xff); tcg_temp_free_i32(tmp2); } neon_store_reg(rd, pass, tmp); } else { /* Store */ tmp = neon_load_reg(rd, pass); if (shift) tcg_gen_shri_i32(tmp, tmp, shift); switch (size) { case 0: gen_st8(tmp, addr, IS_USER(s)); break; case 1: gen_st16(tmp, addr, IS_USER(s)); break; case 2: gen_st32(tmp, addr, IS_USER(s)); break; } } rd += stride; tcg_gen_addi_i32(addr, addr, 1 << size); } stride = nregs * (1 << size); } } tcg_temp_free_i32(addr); if (rm != 15) { TCGv base; base = load_reg(s, rn); if (rm == 13) { tcg_gen_addi_i32(base, base, stride); } else { TCGv index; index = load_reg(s, rm); tcg_gen_add_i32(base, base, index); tcg_temp_free_i32(index); } store_reg(s, rn, base); } return 0; }
true
qemu
e318a60b94b152c1e80125861a8917ae177d845e
static int disas_neon_ls_insn(CPUState * env, DisasContext *s, uint32_t insn) { int rd, rn, rm; int op; int nregs; int interleave; int spacing; int stride; int size; int reg; int pass; int load; int shift; int n; TCGv addr; TCGv tmp; TCGv tmp2; TCGv_i64 tmp64; if (!s->vfp_enabled) return 1; VFP_DREG_D(rd, insn); rn = (insn >> 16) & 0xf; rm = insn & 0xf; load = (insn & (1 << 21)) != 0; addr = tcg_temp_new_i32(); if ((insn & (1 << 23)) == 0) { op = (insn >> 8) & 0xf; size = (insn >> 6) & 3; if (op > 10) return 1; nregs = neon_ls_element_type[op].nregs; interleave = neon_ls_element_type[op].interleave; spacing = neon_ls_element_type[op].spacing; if (size == 3 && (interleave | spacing) != 1) return 1; load_reg_var(s, addr, rn); stride = (1 << size) * interleave; for (reg = 0; reg < nregs; reg++) { if (interleave > 2 || (interleave == 2 && nregs == 2)) { load_reg_var(s, addr, rn); tcg_gen_addi_i32(addr, addr, (1 << size) * reg); } else if (interleave == 2 && nregs == 4 && reg == 2) { load_reg_var(s, addr, rn); tcg_gen_addi_i32(addr, addr, 1 << size); } if (size == 3) { if (load) { tmp64 = gen_ld64(addr, IS_USER(s)); neon_store_reg64(tmp64, rd); tcg_temp_free_i64(tmp64); } else { tmp64 = tcg_temp_new_i64(); neon_load_reg64(tmp64, rd); gen_st64(tmp64, addr, IS_USER(s)); } tcg_gen_addi_i32(addr, addr, stride); } else { for (pass = 0; pass < 2; pass++) { if (size == 2) { if (load) { tmp = gen_ld32(addr, IS_USER(s)); neon_store_reg(rd, pass, tmp); } else { tmp = neon_load_reg(rd, pass); gen_st32(tmp, addr, IS_USER(s)); } tcg_gen_addi_i32(addr, addr, stride); } else if (size == 1) { if (load) { tmp = gen_ld16u(addr, IS_USER(s)); tcg_gen_addi_i32(addr, addr, stride); tmp2 = gen_ld16u(addr, IS_USER(s)); tcg_gen_addi_i32(addr, addr, stride); tcg_gen_shli_i32(tmp2, tmp2, 16); tcg_gen_or_i32(tmp, tmp, tmp2); tcg_temp_free_i32(tmp2); neon_store_reg(rd, pass, tmp); } else { tmp = neon_load_reg(rd, pass); tmp2 = tcg_temp_new_i32(); tcg_gen_shri_i32(tmp2, tmp, 16); gen_st16(tmp, addr, IS_USER(s)); tcg_gen_addi_i32(addr, addr, stride); gen_st16(tmp2, addr, IS_USER(s)); tcg_gen_addi_i32(addr, addr, stride); } } else { if (load) { TCGV_UNUSED(tmp2); for (n = 0; n < 4; n++) { tmp = gen_ld8u(addr, IS_USER(s)); tcg_gen_addi_i32(addr, addr, stride); if (n == 0) { tmp2 = tmp; } else { tcg_gen_shli_i32(tmp, tmp, n * 8); tcg_gen_or_i32(tmp2, tmp2, tmp); tcg_temp_free_i32(tmp); } } neon_store_reg(rd, pass, tmp2); } else { tmp2 = neon_load_reg(rd, pass); for (n = 0; n < 4; n++) { tmp = tcg_temp_new_i32(); if (n == 0) { tcg_gen_mov_i32(tmp, tmp2); } else { tcg_gen_shri_i32(tmp, tmp2, n * 8); } gen_st8(tmp, addr, IS_USER(s)); tcg_gen_addi_i32(addr, addr, stride); } tcg_temp_free_i32(tmp2); } } } } rd += spacing; } stride = nregs * 8; } else { size = (insn >> 10) & 3; if (size == 3) { int a = (insn >> 4) & 1; if (!load) { return 1; } size = (insn >> 6) & 3; nregs = ((insn >> 8) & 3) + 1; if (size == 3) { if (nregs != 4 || a == 0) { return 1; } size = 2; } if (nregs == 1 && a == 1 && size == 0) { return 1; } if (nregs == 3 && a == 1) { return 1; } load_reg_var(s, addr, rn); if (nregs == 1) { tmp = gen_load_and_replicate(s, addr, size); tcg_gen_st_i32(tmp, cpu_env, neon_reg_offset(rd, 0)); tcg_gen_st_i32(tmp, cpu_env, neon_reg_offset(rd, 1)); if (insn & (1 << 5)) { tcg_gen_st_i32(tmp, cpu_env, neon_reg_offset(rd + 1, 0)); tcg_gen_st_i32(tmp, cpu_env, neon_reg_offset(rd + 1, 1)); } tcg_temp_free_i32(tmp); } else { stride = (insn & (1 << 5)) ? 2 : 1; for (reg = 0; reg < nregs; reg++) { tmp = gen_load_and_replicate(s, addr, size); tcg_gen_st_i32(tmp, cpu_env, neon_reg_offset(rd, 0)); tcg_gen_st_i32(tmp, cpu_env, neon_reg_offset(rd, 1)); tcg_temp_free_i32(tmp); tcg_gen_addi_i32(addr, addr, 1 << size); rd += stride; } } stride = (1 << size) * nregs; } else { pass = (insn >> 7) & 1; switch (size) { case 0: shift = ((insn >> 5) & 3) * 8; stride = 1; break; case 1: shift = ((insn >> 6) & 1) * 16; stride = (insn & (1 << 5)) ? 2 : 1; break; case 2: shift = 0; stride = (insn & (1 << 6)) ? 2 : 1; break; default: abort(); } nregs = ((insn >> 8) & 3) + 1; load_reg_var(s, addr, rn); for (reg = 0; reg < nregs; reg++) { if (load) { switch (size) { case 0: tmp = gen_ld8u(addr, IS_USER(s)); break; case 1: tmp = gen_ld16u(addr, IS_USER(s)); break; case 2: tmp = gen_ld32(addr, IS_USER(s)); break; default: abort(); } if (size != 2) { tmp2 = neon_load_reg(rd, pass); gen_bfi(tmp, tmp2, tmp, shift, size ? 0xffff : 0xff); tcg_temp_free_i32(tmp2); } neon_store_reg(rd, pass, tmp); } else { tmp = neon_load_reg(rd, pass); if (shift) tcg_gen_shri_i32(tmp, tmp, shift); switch (size) { case 0: gen_st8(tmp, addr, IS_USER(s)); break; case 1: gen_st16(tmp, addr, IS_USER(s)); break; case 2: gen_st32(tmp, addr, IS_USER(s)); break; } } rd += stride; tcg_gen_addi_i32(addr, addr, 1 << size); } stride = nregs * (1 << size); } } tcg_temp_free_i32(addr); if (rm != 15) { TCGv base; base = load_reg(s, rn); if (rm == 13) { tcg_gen_addi_i32(base, base, stride); } else { TCGv index; index = load_reg(s, rm); tcg_gen_add_i32(base, base, index); tcg_temp_free_i32(index); } store_reg(s, rn, base); } return 0; }
{ "code": [ " addr = tcg_temp_new_i32();", " tcg_temp_free_i32(addr);" ], "line_no": [ 51, 471 ] }
static int FUNC_0(CPUState * VAR_0, DisasContext *VAR_1, uint32_t VAR_2) { int VAR_3, VAR_4, VAR_5; int VAR_6; int VAR_7; int VAR_8; int VAR_9; int VAR_10; int VAR_11; int VAR_12; int VAR_13; int VAR_14; int VAR_15; int VAR_16; TCGv addr; TCGv tmp; TCGv tmp2; TCGv_i64 tmp64; if (!VAR_1->vfp_enabled) return 1; VFP_DREG_D(VAR_3, VAR_2); VAR_4 = (VAR_2 >> 16) & 0xf; VAR_5 = VAR_2 & 0xf; VAR_14 = (VAR_2 & (1 << 21)) != 0; addr = tcg_temp_new_i32(); if ((VAR_2 & (1 << 23)) == 0) { VAR_6 = (VAR_2 >> 8) & 0xf; VAR_11 = (VAR_2 >> 6) & 3; if (VAR_6 > 10) return 1; VAR_7 = neon_ls_element_type[VAR_6].VAR_7; VAR_8 = neon_ls_element_type[VAR_6].VAR_8; VAR_9 = neon_ls_element_type[VAR_6].VAR_9; if (VAR_11 == 3 && (VAR_8 | VAR_9) != 1) return 1; load_reg_var(VAR_1, addr, VAR_4); VAR_10 = (1 << VAR_11) * VAR_8; for (VAR_12 = 0; VAR_12 < VAR_7; VAR_12++) { if (VAR_8 > 2 || (VAR_8 == 2 && VAR_7 == 2)) { load_reg_var(VAR_1, addr, VAR_4); tcg_gen_addi_i32(addr, addr, (1 << VAR_11) * VAR_12); } else if (VAR_8 == 2 && VAR_7 == 4 && VAR_12 == 2) { load_reg_var(VAR_1, addr, VAR_4); tcg_gen_addi_i32(addr, addr, 1 << VAR_11); } if (VAR_11 == 3) { if (VAR_14) { tmp64 = gen_ld64(addr, IS_USER(VAR_1)); neon_store_reg64(tmp64, VAR_3); tcg_temp_free_i64(tmp64); } else { tmp64 = tcg_temp_new_i64(); neon_load_reg64(tmp64, VAR_3); gen_st64(tmp64, addr, IS_USER(VAR_1)); } tcg_gen_addi_i32(addr, addr, VAR_10); } else { for (VAR_13 = 0; VAR_13 < 2; VAR_13++) { if (VAR_11 == 2) { if (VAR_14) { tmp = gen_ld32(addr, IS_USER(VAR_1)); neon_store_reg(VAR_3, VAR_13, tmp); } else { tmp = neon_load_reg(VAR_3, VAR_13); gen_st32(tmp, addr, IS_USER(VAR_1)); } tcg_gen_addi_i32(addr, addr, VAR_10); } else if (VAR_11 == 1) { if (VAR_14) { tmp = gen_ld16u(addr, IS_USER(VAR_1)); tcg_gen_addi_i32(addr, addr, VAR_10); tmp2 = gen_ld16u(addr, IS_USER(VAR_1)); tcg_gen_addi_i32(addr, addr, VAR_10); tcg_gen_shli_i32(tmp2, tmp2, 16); tcg_gen_or_i32(tmp, tmp, tmp2); tcg_temp_free_i32(tmp2); neon_store_reg(VAR_3, VAR_13, tmp); } else { tmp = neon_load_reg(VAR_3, VAR_13); tmp2 = tcg_temp_new_i32(); tcg_gen_shri_i32(tmp2, tmp, 16); gen_st16(tmp, addr, IS_USER(VAR_1)); tcg_gen_addi_i32(addr, addr, VAR_10); gen_st16(tmp2, addr, IS_USER(VAR_1)); tcg_gen_addi_i32(addr, addr, VAR_10); } } else { if (VAR_14) { TCGV_UNUSED(tmp2); for (VAR_16 = 0; VAR_16 < 4; VAR_16++) { tmp = gen_ld8u(addr, IS_USER(VAR_1)); tcg_gen_addi_i32(addr, addr, VAR_10); if (VAR_16 == 0) { tmp2 = tmp; } else { tcg_gen_shli_i32(tmp, tmp, VAR_16 * 8); tcg_gen_or_i32(tmp2, tmp2, tmp); tcg_temp_free_i32(tmp); } } neon_store_reg(VAR_3, VAR_13, tmp2); } else { tmp2 = neon_load_reg(VAR_3, VAR_13); for (VAR_16 = 0; VAR_16 < 4; VAR_16++) { tmp = tcg_temp_new_i32(); if (VAR_16 == 0) { tcg_gen_mov_i32(tmp, tmp2); } else { tcg_gen_shri_i32(tmp, tmp2, VAR_16 * 8); } gen_st8(tmp, addr, IS_USER(VAR_1)); tcg_gen_addi_i32(addr, addr, VAR_10); } tcg_temp_free_i32(tmp2); } } } } VAR_3 += VAR_9; } VAR_10 = VAR_7 * 8; } else { VAR_11 = (VAR_2 >> 10) & 3; if (VAR_11 == 3) { int VAR_17 = (VAR_2 >> 4) & 1; if (!VAR_14) { return 1; } VAR_11 = (VAR_2 >> 6) & 3; VAR_7 = ((VAR_2 >> 8) & 3) + 1; if (VAR_11 == 3) { if (VAR_7 != 4 || VAR_17 == 0) { return 1; } VAR_11 = 2; } if (VAR_7 == 1 && VAR_17 == 1 && VAR_11 == 0) { return 1; } if (VAR_7 == 3 && VAR_17 == 1) { return 1; } load_reg_var(VAR_1, addr, VAR_4); if (VAR_7 == 1) { tmp = gen_load_and_replicate(VAR_1, addr, VAR_11); tcg_gen_st_i32(tmp, cpu_env, neon_reg_offset(VAR_3, 0)); tcg_gen_st_i32(tmp, cpu_env, neon_reg_offset(VAR_3, 1)); if (VAR_2 & (1 << 5)) { tcg_gen_st_i32(tmp, cpu_env, neon_reg_offset(VAR_3 + 1, 0)); tcg_gen_st_i32(tmp, cpu_env, neon_reg_offset(VAR_3 + 1, 1)); } tcg_temp_free_i32(tmp); } else { VAR_10 = (VAR_2 & (1 << 5)) ? 2 : 1; for (VAR_12 = 0; VAR_12 < VAR_7; VAR_12++) { tmp = gen_load_and_replicate(VAR_1, addr, VAR_11); tcg_gen_st_i32(tmp, cpu_env, neon_reg_offset(VAR_3, 0)); tcg_gen_st_i32(tmp, cpu_env, neon_reg_offset(VAR_3, 1)); tcg_temp_free_i32(tmp); tcg_gen_addi_i32(addr, addr, 1 << VAR_11); VAR_3 += VAR_10; } } VAR_10 = (1 << VAR_11) * VAR_7; } else { VAR_13 = (VAR_2 >> 7) & 1; switch (VAR_11) { case 0: VAR_15 = ((VAR_2 >> 5) & 3) * 8; VAR_10 = 1; break; case 1: VAR_15 = ((VAR_2 >> 6) & 1) * 16; VAR_10 = (VAR_2 & (1 << 5)) ? 2 : 1; break; case 2: VAR_15 = 0; VAR_10 = (VAR_2 & (1 << 6)) ? 2 : 1; break; default: abort(); } VAR_7 = ((VAR_2 >> 8) & 3) + 1; load_reg_var(VAR_1, addr, VAR_4); for (VAR_12 = 0; VAR_12 < VAR_7; VAR_12++) { if (VAR_14) { switch (VAR_11) { case 0: tmp = gen_ld8u(addr, IS_USER(VAR_1)); break; case 1: tmp = gen_ld16u(addr, IS_USER(VAR_1)); break; case 2: tmp = gen_ld32(addr, IS_USER(VAR_1)); break; default: abort(); } if (VAR_11 != 2) { tmp2 = neon_load_reg(VAR_3, VAR_13); gen_bfi(tmp, tmp2, tmp, VAR_15, VAR_11 ? 0xffff : 0xff); tcg_temp_free_i32(tmp2); } neon_store_reg(VAR_3, VAR_13, tmp); } else { tmp = neon_load_reg(VAR_3, VAR_13); if (VAR_15) tcg_gen_shri_i32(tmp, tmp, VAR_15); switch (VAR_11) { case 0: gen_st8(tmp, addr, IS_USER(VAR_1)); break; case 1: gen_st16(tmp, addr, IS_USER(VAR_1)); break; case 2: gen_st32(tmp, addr, IS_USER(VAR_1)); break; } } VAR_3 += VAR_10; tcg_gen_addi_i32(addr, addr, 1 << VAR_11); } VAR_10 = VAR_7 * (1 << VAR_11); } } tcg_temp_free_i32(addr); if (VAR_5 != 15) { TCGv base; base = load_reg(VAR_1, VAR_4); if (VAR_5 == 13) { tcg_gen_addi_i32(base, base, VAR_10); } else { TCGv index; index = load_reg(VAR_1, VAR_5); tcg_gen_add_i32(base, base, index); tcg_temp_free_i32(index); } store_reg(VAR_1, VAR_4, base); } return 0; }
[ "static int FUNC_0(CPUState * VAR_0, DisasContext *VAR_1, uint32_t VAR_2)\n{", "int VAR_3, VAR_4, VAR_5;", "int VAR_6;", "int VAR_7;", "int VAR_8;", "int VAR_9;", "int VAR_10;", "int VAR_11;", "int VAR_12;", "int VAR_13;", "int VAR_14;", "int VAR_15;", "int VAR_16;", "TCGv addr;", "TCGv tmp;", "TCGv tmp2;", "TCGv_i64 tmp64;", "if (!VAR_1->vfp_enabled)\nreturn 1;", "VFP_DREG_D(VAR_3, VAR_2);", "VAR_4 = (VAR_2 >> 16) & 0xf;", "VAR_5 = VAR_2 & 0xf;", "VAR_14 = (VAR_2 & (1 << 21)) != 0;", "addr = tcg_temp_new_i32();", "if ((VAR_2 & (1 << 23)) == 0) {", "VAR_6 = (VAR_2 >> 8) & 0xf;", "VAR_11 = (VAR_2 >> 6) & 3;", "if (VAR_6 > 10)\nreturn 1;", "VAR_7 = neon_ls_element_type[VAR_6].VAR_7;", "VAR_8 = neon_ls_element_type[VAR_6].VAR_8;", "VAR_9 = neon_ls_element_type[VAR_6].VAR_9;", "if (VAR_11 == 3 && (VAR_8 | VAR_9) != 1)\nreturn 1;", "load_reg_var(VAR_1, addr, VAR_4);", "VAR_10 = (1 << VAR_11) * VAR_8;", "for (VAR_12 = 0; VAR_12 < VAR_7; VAR_12++) {", "if (VAR_8 > 2 || (VAR_8 == 2 && VAR_7 == 2)) {", "load_reg_var(VAR_1, addr, VAR_4);", "tcg_gen_addi_i32(addr, addr, (1 << VAR_11) * VAR_12);", "} else if (VAR_8 == 2 && VAR_7 == 4 && VAR_12 == 2) {", "load_reg_var(VAR_1, addr, VAR_4);", "tcg_gen_addi_i32(addr, addr, 1 << VAR_11);", "}", "if (VAR_11 == 3) {", "if (VAR_14) {", "tmp64 = gen_ld64(addr, IS_USER(VAR_1));", "neon_store_reg64(tmp64, VAR_3);", "tcg_temp_free_i64(tmp64);", "} else {", "tmp64 = tcg_temp_new_i64();", "neon_load_reg64(tmp64, VAR_3);", "gen_st64(tmp64, addr, IS_USER(VAR_1));", "}", "tcg_gen_addi_i32(addr, addr, VAR_10);", "} else {", "for (VAR_13 = 0; VAR_13 < 2; VAR_13++) {", "if (VAR_11 == 2) {", "if (VAR_14) {", "tmp = gen_ld32(addr, IS_USER(VAR_1));", "neon_store_reg(VAR_3, VAR_13, tmp);", "} else {", "tmp = neon_load_reg(VAR_3, VAR_13);", "gen_st32(tmp, addr, IS_USER(VAR_1));", "}", "tcg_gen_addi_i32(addr, addr, VAR_10);", "} else if (VAR_11 == 1) {", "if (VAR_14) {", "tmp = gen_ld16u(addr, IS_USER(VAR_1));", "tcg_gen_addi_i32(addr, addr, VAR_10);", "tmp2 = gen_ld16u(addr, IS_USER(VAR_1));", "tcg_gen_addi_i32(addr, addr, VAR_10);", "tcg_gen_shli_i32(tmp2, tmp2, 16);", "tcg_gen_or_i32(tmp, tmp, tmp2);", "tcg_temp_free_i32(tmp2);", "neon_store_reg(VAR_3, VAR_13, tmp);", "} else {", "tmp = neon_load_reg(VAR_3, VAR_13);", "tmp2 = tcg_temp_new_i32();", "tcg_gen_shri_i32(tmp2, tmp, 16);", "gen_st16(tmp, addr, IS_USER(VAR_1));", "tcg_gen_addi_i32(addr, addr, VAR_10);", "gen_st16(tmp2, addr, IS_USER(VAR_1));", "tcg_gen_addi_i32(addr, addr, VAR_10);", "}", "} else {", "if (VAR_14) {", "TCGV_UNUSED(tmp2);", "for (VAR_16 = 0; VAR_16 < 4; VAR_16++) {", "tmp = gen_ld8u(addr, IS_USER(VAR_1));", "tcg_gen_addi_i32(addr, addr, VAR_10);", "if (VAR_16 == 0) {", "tmp2 = tmp;", "} else {", "tcg_gen_shli_i32(tmp, tmp, VAR_16 * 8);", "tcg_gen_or_i32(tmp2, tmp2, tmp);", "tcg_temp_free_i32(tmp);", "}", "}", "neon_store_reg(VAR_3, VAR_13, tmp2);", "} else {", "tmp2 = neon_load_reg(VAR_3, VAR_13);", "for (VAR_16 = 0; VAR_16 < 4; VAR_16++) {", "tmp = tcg_temp_new_i32();", "if (VAR_16 == 0) {", "tcg_gen_mov_i32(tmp, tmp2);", "} else {", "tcg_gen_shri_i32(tmp, tmp2, VAR_16 * 8);", "}", "gen_st8(tmp, addr, IS_USER(VAR_1));", "tcg_gen_addi_i32(addr, addr, VAR_10);", "}", "tcg_temp_free_i32(tmp2);", "}", "}", "}", "}", "VAR_3 += VAR_9;", "}", "VAR_10 = VAR_7 * 8;", "} else {", "VAR_11 = (VAR_2 >> 10) & 3;", "if (VAR_11 == 3) {", "int VAR_17 = (VAR_2 >> 4) & 1;", "if (!VAR_14) {", "return 1;", "}", "VAR_11 = (VAR_2 >> 6) & 3;", "VAR_7 = ((VAR_2 >> 8) & 3) + 1;", "if (VAR_11 == 3) {", "if (VAR_7 != 4 || VAR_17 == 0) {", "return 1;", "}", "VAR_11 = 2;", "}", "if (VAR_7 == 1 && VAR_17 == 1 && VAR_11 == 0) {", "return 1;", "}", "if (VAR_7 == 3 && VAR_17 == 1) {", "return 1;", "}", "load_reg_var(VAR_1, addr, VAR_4);", "if (VAR_7 == 1) {", "tmp = gen_load_and_replicate(VAR_1, addr, VAR_11);", "tcg_gen_st_i32(tmp, cpu_env, neon_reg_offset(VAR_3, 0));", "tcg_gen_st_i32(tmp, cpu_env, neon_reg_offset(VAR_3, 1));", "if (VAR_2 & (1 << 5)) {", "tcg_gen_st_i32(tmp, cpu_env, neon_reg_offset(VAR_3 + 1, 0));", "tcg_gen_st_i32(tmp, cpu_env, neon_reg_offset(VAR_3 + 1, 1));", "}", "tcg_temp_free_i32(tmp);", "} else {", "VAR_10 = (VAR_2 & (1 << 5)) ? 2 : 1;", "for (VAR_12 = 0; VAR_12 < VAR_7; VAR_12++) {", "tmp = gen_load_and_replicate(VAR_1, addr, VAR_11);", "tcg_gen_st_i32(tmp, cpu_env, neon_reg_offset(VAR_3, 0));", "tcg_gen_st_i32(tmp, cpu_env, neon_reg_offset(VAR_3, 1));", "tcg_temp_free_i32(tmp);", "tcg_gen_addi_i32(addr, addr, 1 << VAR_11);", "VAR_3 += VAR_10;", "}", "}", "VAR_10 = (1 << VAR_11) * VAR_7;", "} else {", "VAR_13 = (VAR_2 >> 7) & 1;", "switch (VAR_11) {", "case 0:\nVAR_15 = ((VAR_2 >> 5) & 3) * 8;", "VAR_10 = 1;", "break;", "case 1:\nVAR_15 = ((VAR_2 >> 6) & 1) * 16;", "VAR_10 = (VAR_2 & (1 << 5)) ? 2 : 1;", "break;", "case 2:\nVAR_15 = 0;", "VAR_10 = (VAR_2 & (1 << 6)) ? 2 : 1;", "break;", "default:\nabort();", "}", "VAR_7 = ((VAR_2 >> 8) & 3) + 1;", "load_reg_var(VAR_1, addr, VAR_4);", "for (VAR_12 = 0; VAR_12 < VAR_7; VAR_12++) {", "if (VAR_14) {", "switch (VAR_11) {", "case 0:\ntmp = gen_ld8u(addr, IS_USER(VAR_1));", "break;", "case 1:\ntmp = gen_ld16u(addr, IS_USER(VAR_1));", "break;", "case 2:\ntmp = gen_ld32(addr, IS_USER(VAR_1));", "break;", "default:\nabort();", "}", "if (VAR_11 != 2) {", "tmp2 = neon_load_reg(VAR_3, VAR_13);", "gen_bfi(tmp, tmp2, tmp, VAR_15, VAR_11 ? 0xffff : 0xff);", "tcg_temp_free_i32(tmp2);", "}", "neon_store_reg(VAR_3, VAR_13, tmp);", "} else {", "tmp = neon_load_reg(VAR_3, VAR_13);", "if (VAR_15)\ntcg_gen_shri_i32(tmp, tmp, VAR_15);", "switch (VAR_11) {", "case 0:\ngen_st8(tmp, addr, IS_USER(VAR_1));", "break;", "case 1:\ngen_st16(tmp, addr, IS_USER(VAR_1));", "break;", "case 2:\ngen_st32(tmp, addr, IS_USER(VAR_1));", "break;", "}", "}", "VAR_3 += VAR_10;", "tcg_gen_addi_i32(addr, addr, 1 << VAR_11);", "}", "VAR_10 = VAR_7 * (1 << VAR_11);", "}", "}", "tcg_temp_free_i32(addr);", "if (VAR_5 != 15) {", "TCGv base;", "base = load_reg(VAR_1, VAR_4);", "if (VAR_5 == 13) {", "tcg_gen_addi_i32(base, base, VAR_10);", "} else {", "TCGv index;", "index = load_reg(VAR_1, VAR_5);", "tcg_gen_add_i32(base, base, index);", "tcg_temp_free_i32(index);", "}", "store_reg(VAR_1, VAR_4, base);", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61, 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71, 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ], [ 291 ], [ 293 ], [ 295 ], [ 297 ], [ 301 ], [ 303 ], [ 305 ], [ 307 ], [ 309 ], [ 311 ], [ 313 ], [ 315 ], [ 317 ], [ 321 ], [ 323 ], [ 325 ], [ 327 ], [ 329 ], [ 331 ], [ 333 ], [ 335 ], [ 337 ], [ 339 ], [ 341 ], [ 343 ], [ 347 ], [ 349 ], [ 351, 353 ], [ 355 ], [ 357 ], [ 359, 361 ], [ 363 ], [ 365 ], [ 367, 369 ], [ 371 ], [ 373 ], [ 375, 377 ], [ 379 ], [ 381 ], [ 383 ], [ 385 ], [ 387 ], [ 389 ], [ 391, 393 ], [ 395 ], [ 397, 399 ], [ 401 ], [ 403, 405 ], [ 407 ], [ 409, 411 ], [ 413 ], [ 415 ], [ 417 ], [ 419 ], [ 421 ], [ 423 ], [ 425 ], [ 427 ], [ 429 ], [ 431, 433 ], [ 435 ], [ 437, 439 ], [ 441 ], [ 443, 445 ], [ 447 ], [ 449, 451 ], [ 453 ], [ 455 ], [ 457 ], [ 459 ], [ 461 ], [ 463 ], [ 465 ], [ 467 ], [ 469 ], [ 471 ], [ 473 ], [ 475 ], [ 479 ], [ 481 ], [ 483 ], [ 485 ], [ 487 ], [ 489 ], [ 491 ], [ 493 ], [ 495 ], [ 497 ], [ 499 ], [ 501 ], [ 503 ] ]
24,234
vu_queue_empty(VuDev *dev, VuVirtq *vq) { if (vq->shadow_avail_idx != vq->last_avail_idx) { return 0; } return vring_avail_idx(vq) == vq->last_avail_idx; }
true
qemu
640601c7cb1b6b41d3e1a435b986266c2b71e9bc
vu_queue_empty(VuDev *dev, VuVirtq *vq) { if (vq->shadow_avail_idx != vq->last_avail_idx) { return 0; } return vring_avail_idx(vq) == vq->last_avail_idx; }
{ "code": [ " return 0;" ], "line_no": [ 7 ] }
FUNC_0(VuDev *VAR_0, VuVirtq *VAR_1) { if (VAR_1->shadow_avail_idx != VAR_1->last_avail_idx) { return 0; } return vring_avail_idx(VAR_1) == VAR_1->last_avail_idx; }
[ "FUNC_0(VuDev *VAR_0, VuVirtq *VAR_1)\n{", "if (VAR_1->shadow_avail_idx != VAR_1->last_avail_idx) {", "return 0;", "}", "return vring_avail_idx(VAR_1) == VAR_1->last_avail_idx;", "}" ]
[ 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ] ]
24,236
static CURLState *curl_init_state(BlockDriverState *bs, BDRVCURLState *s) { CURLState *state = NULL; int i, j; do { for (i=0; i<CURL_NUM_STATES; i++) { for (j=0; j<CURL_NUM_ACB; j++) if (s->states[i].acb[j]) continue; if (s->states[i].in_use) continue; state = &s->states[i]; state->in_use = 1; break; } if (!state) { qemu_mutex_unlock(&s->mutex); aio_poll(bdrv_get_aio_context(bs), true); qemu_mutex_lock(&s->mutex); } } while(!state); if (!state->curl) { state->curl = curl_easy_init(); if (!state->curl) { return NULL; } curl_easy_setopt(state->curl, CURLOPT_URL, s->url); curl_easy_setopt(state->curl, CURLOPT_SSL_VERIFYPEER, (long) s->sslverify); if (s->cookie) { curl_easy_setopt(state->curl, CURLOPT_COOKIE, s->cookie); } curl_easy_setopt(state->curl, CURLOPT_TIMEOUT, (long)s->timeout); curl_easy_setopt(state->curl, CURLOPT_WRITEFUNCTION, (void *)curl_read_cb); curl_easy_setopt(state->curl, CURLOPT_WRITEDATA, (void *)state); curl_easy_setopt(state->curl, CURLOPT_PRIVATE, (void *)state); curl_easy_setopt(state->curl, CURLOPT_AUTOREFERER, 1); curl_easy_setopt(state->curl, CURLOPT_FOLLOWLOCATION, 1); curl_easy_setopt(state->curl, CURLOPT_NOSIGNAL, 1); curl_easy_setopt(state->curl, CURLOPT_ERRORBUFFER, state->errmsg); curl_easy_setopt(state->curl, CURLOPT_FAILONERROR, 1); if (s->username) { curl_easy_setopt(state->curl, CURLOPT_USERNAME, s->username); } if (s->password) { curl_easy_setopt(state->curl, CURLOPT_PASSWORD, s->password); } if (s->proxyusername) { curl_easy_setopt(state->curl, CURLOPT_PROXYUSERNAME, s->proxyusername); } if (s->proxypassword) { curl_easy_setopt(state->curl, CURLOPT_PROXYPASSWORD, s->proxypassword); } /* Restrict supported protocols to avoid security issues in the more * obscure protocols. For example, do not allow POP3/SMTP/IMAP see * CVE-2013-0249. * * Restricting protocols is only supported from 7.19.4 upwards. */ #if LIBCURL_VERSION_NUM >= 0x071304 curl_easy_setopt(state->curl, CURLOPT_PROTOCOLS, PROTOCOLS); curl_easy_setopt(state->curl, CURLOPT_REDIR_PROTOCOLS, PROTOCOLS); #endif #ifdef DEBUG_VERBOSE curl_easy_setopt(state->curl, CURLOPT_VERBOSE, 1); #endif } QLIST_INIT(&state->sockets); state->s = s; return state; }
true
qemu
3ce6a729b5d78b13283ddc6c529811f67519a62d
static CURLState *curl_init_state(BlockDriverState *bs, BDRVCURLState *s) { CURLState *state = NULL; int i, j; do { for (i=0; i<CURL_NUM_STATES; i++) { for (j=0; j<CURL_NUM_ACB; j++) if (s->states[i].acb[j]) continue; if (s->states[i].in_use) continue; state = &s->states[i]; state->in_use = 1; break; } if (!state) { qemu_mutex_unlock(&s->mutex); aio_poll(bdrv_get_aio_context(bs), true); qemu_mutex_lock(&s->mutex); } } while(!state); if (!state->curl) { state->curl = curl_easy_init(); if (!state->curl) { return NULL; } curl_easy_setopt(state->curl, CURLOPT_URL, s->url); curl_easy_setopt(state->curl, CURLOPT_SSL_VERIFYPEER, (long) s->sslverify); if (s->cookie) { curl_easy_setopt(state->curl, CURLOPT_COOKIE, s->cookie); } curl_easy_setopt(state->curl, CURLOPT_TIMEOUT, (long)s->timeout); curl_easy_setopt(state->curl, CURLOPT_WRITEFUNCTION, (void *)curl_read_cb); curl_easy_setopt(state->curl, CURLOPT_WRITEDATA, (void *)state); curl_easy_setopt(state->curl, CURLOPT_PRIVATE, (void *)state); curl_easy_setopt(state->curl, CURLOPT_AUTOREFERER, 1); curl_easy_setopt(state->curl, CURLOPT_FOLLOWLOCATION, 1); curl_easy_setopt(state->curl, CURLOPT_NOSIGNAL, 1); curl_easy_setopt(state->curl, CURLOPT_ERRORBUFFER, state->errmsg); curl_easy_setopt(state->curl, CURLOPT_FAILONERROR, 1); if (s->username) { curl_easy_setopt(state->curl, CURLOPT_USERNAME, s->username); } if (s->password) { curl_easy_setopt(state->curl, CURLOPT_PASSWORD, s->password); } if (s->proxyusername) { curl_easy_setopt(state->curl, CURLOPT_PROXYUSERNAME, s->proxyusername); } if (s->proxypassword) { curl_easy_setopt(state->curl, CURLOPT_PROXYPASSWORD, s->proxypassword); } #if LIBCURL_VERSION_NUM >= 0x071304 curl_easy_setopt(state->curl, CURLOPT_PROTOCOLS, PROTOCOLS); curl_easy_setopt(state->curl, CURLOPT_REDIR_PROTOCOLS, PROTOCOLS); #endif #ifdef DEBUG_VERBOSE curl_easy_setopt(state->curl, CURLOPT_VERBOSE, 1); #endif } QLIST_INIT(&state->sockets); state->s = s; return state; }
{ "code": [ "static CURLState *curl_init_state(BlockDriverState *bs, BDRVCURLState *s)", " int i, j;", " do {", " for (i=0; i<CURL_NUM_STATES; i++) {", " for (j=0; j<CURL_NUM_ACB; j++)", " if (s->states[i].acb[j])", " continue;", " if (s->states[i].in_use)", " continue;", " if (!state) {", " qemu_mutex_unlock(&s->mutex);", " aio_poll(bdrv_get_aio_context(bs), true);", " qemu_mutex_lock(&s->mutex);", " } while(!state);", " return NULL;", " return state;" ], "line_no": [ 1, 7, 11, 13, 15, 17, 19, 21, 23, 35, 37, 39, 41, 45, 55, 161 ] }
static CURLState *FUNC_0(BlockDriverState *bs, BDRVCURLState *s) { CURLState *state = NULL; int VAR_0, VAR_1; do { for (VAR_0=0; VAR_0<CURL_NUM_STATES; VAR_0++) { for (VAR_1=0; VAR_1<CURL_NUM_ACB; VAR_1++) if (s->states[VAR_0].acb[VAR_1]) continue; if (s->states[VAR_0].in_use) continue; state = &s->states[VAR_0]; state->in_use = 1; break; } if (!state) { qemu_mutex_unlock(&s->mutex); aio_poll(bdrv_get_aio_context(bs), true); qemu_mutex_lock(&s->mutex); } } while(!state); if (!state->curl) { state->curl = curl_easy_init(); if (!state->curl) { return NULL; } curl_easy_setopt(state->curl, CURLOPT_URL, s->url); curl_easy_setopt(state->curl, CURLOPT_SSL_VERIFYPEER, (long) s->sslverify); if (s->cookie) { curl_easy_setopt(state->curl, CURLOPT_COOKIE, s->cookie); } curl_easy_setopt(state->curl, CURLOPT_TIMEOUT, (long)s->timeout); curl_easy_setopt(state->curl, CURLOPT_WRITEFUNCTION, (void *)curl_read_cb); curl_easy_setopt(state->curl, CURLOPT_WRITEDATA, (void *)state); curl_easy_setopt(state->curl, CURLOPT_PRIVATE, (void *)state); curl_easy_setopt(state->curl, CURLOPT_AUTOREFERER, 1); curl_easy_setopt(state->curl, CURLOPT_FOLLOWLOCATION, 1); curl_easy_setopt(state->curl, CURLOPT_NOSIGNAL, 1); curl_easy_setopt(state->curl, CURLOPT_ERRORBUFFER, state->errmsg); curl_easy_setopt(state->curl, CURLOPT_FAILONERROR, 1); if (s->username) { curl_easy_setopt(state->curl, CURLOPT_USERNAME, s->username); } if (s->password) { curl_easy_setopt(state->curl, CURLOPT_PASSWORD, s->password); } if (s->proxyusername) { curl_easy_setopt(state->curl, CURLOPT_PROXYUSERNAME, s->proxyusername); } if (s->proxypassword) { curl_easy_setopt(state->curl, CURLOPT_PROXYPASSWORD, s->proxypassword); } #if LIBCURL_VERSION_NUM >= 0x071304 curl_easy_setopt(state->curl, CURLOPT_PROTOCOLS, PROTOCOLS); curl_easy_setopt(state->curl, CURLOPT_REDIR_PROTOCOLS, PROTOCOLS); #endif #ifdef DEBUG_VERBOSE curl_easy_setopt(state->curl, CURLOPT_VERBOSE, 1); #endif } QLIST_INIT(&state->sockets); state->s = s; return state; }
[ "static CURLState *FUNC_0(BlockDriverState *bs, BDRVCURLState *s)\n{", "CURLState *state = NULL;", "int VAR_0, VAR_1;", "do {", "for (VAR_0=0; VAR_0<CURL_NUM_STATES; VAR_0++) {", "for (VAR_1=0; VAR_1<CURL_NUM_ACB; VAR_1++)", "if (s->states[VAR_0].acb[VAR_1])\ncontinue;", "if (s->states[VAR_0].in_use)\ncontinue;", "state = &s->states[VAR_0];", "state->in_use = 1;", "break;", "}", "if (!state) {", "qemu_mutex_unlock(&s->mutex);", "aio_poll(bdrv_get_aio_context(bs), true);", "qemu_mutex_lock(&s->mutex);", "}", "} while(!state);", "if (!state->curl) {", "state->curl = curl_easy_init();", "if (!state->curl) {", "return NULL;", "}", "curl_easy_setopt(state->curl, CURLOPT_URL, s->url);", "curl_easy_setopt(state->curl, CURLOPT_SSL_VERIFYPEER,\n(long) s->sslverify);", "if (s->cookie) {", "curl_easy_setopt(state->curl, CURLOPT_COOKIE, s->cookie);", "}", "curl_easy_setopt(state->curl, CURLOPT_TIMEOUT, (long)s->timeout);", "curl_easy_setopt(state->curl, CURLOPT_WRITEFUNCTION,\n(void *)curl_read_cb);", "curl_easy_setopt(state->curl, CURLOPT_WRITEDATA, (void *)state);", "curl_easy_setopt(state->curl, CURLOPT_PRIVATE, (void *)state);", "curl_easy_setopt(state->curl, CURLOPT_AUTOREFERER, 1);", "curl_easy_setopt(state->curl, CURLOPT_FOLLOWLOCATION, 1);", "curl_easy_setopt(state->curl, CURLOPT_NOSIGNAL, 1);", "curl_easy_setopt(state->curl, CURLOPT_ERRORBUFFER, state->errmsg);", "curl_easy_setopt(state->curl, CURLOPT_FAILONERROR, 1);", "if (s->username) {", "curl_easy_setopt(state->curl, CURLOPT_USERNAME, s->username);", "}", "if (s->password) {", "curl_easy_setopt(state->curl, CURLOPT_PASSWORD, s->password);", "}", "if (s->proxyusername) {", "curl_easy_setopt(state->curl,\nCURLOPT_PROXYUSERNAME, s->proxyusername);", "}", "if (s->proxypassword) {", "curl_easy_setopt(state->curl,\nCURLOPT_PROXYPASSWORD, s->proxypassword);", "}", "#if LIBCURL_VERSION_NUM >= 0x071304\ncurl_easy_setopt(state->curl, CURLOPT_PROTOCOLS, PROTOCOLS);", "curl_easy_setopt(state->curl, CURLOPT_REDIR_PROTOCOLS, PROTOCOLS);", "#endif\n#ifdef DEBUG_VERBOSE\ncurl_easy_setopt(state->curl, CURLOPT_VERBOSE, 1);", "#endif\n}", "QLIST_INIT(&state->sockets);", "state->s = s;", "return state;", "}" ]
[ 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17, 19 ], [ 21, 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61, 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73, 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107, 109 ], [ 111 ], [ 113 ], [ 115, 117 ], [ 119 ], [ 135, 137 ], [ 139 ], [ 141, 145, 147 ], [ 149, 151 ], [ 155 ], [ 157 ], [ 161 ], [ 163 ] ]
24,237
static int ssi_sd_load(QEMUFile *f, void *opaque, int version_id) { SSISlave *ss = SSI_SLAVE(opaque); ssi_sd_state *s = (ssi_sd_state *)opaque; int i; if (version_id != 1) s->mode = qemu_get_be32(f); s->cmd = qemu_get_be32(f); for (i = 0; i < 4; i++) s->cmdarg[i] = qemu_get_be32(f); for (i = 0; i < 5; i++) s->response[i] = qemu_get_be32(f); s->arglen = qemu_get_be32(f); s->response_pos = qemu_get_be32(f); s->stopping = qemu_get_be32(f); ss->cs = qemu_get_be32(f); return 0;
true
qemu
a9c380db3b8c6af19546a68145c8d1438a09c92b
static int ssi_sd_load(QEMUFile *f, void *opaque, int version_id) { SSISlave *ss = SSI_SLAVE(opaque); ssi_sd_state *s = (ssi_sd_state *)opaque; int i; if (version_id != 1) s->mode = qemu_get_be32(f); s->cmd = qemu_get_be32(f); for (i = 0; i < 4; i++) s->cmdarg[i] = qemu_get_be32(f); for (i = 0; i < 5; i++) s->response[i] = qemu_get_be32(f); s->arglen = qemu_get_be32(f); s->response_pos = qemu_get_be32(f); s->stopping = qemu_get_be32(f); ss->cs = qemu_get_be32(f); return 0;
{ "code": [], "line_no": [] }
static int FUNC_0(QEMUFile *VAR_0, void *VAR_1, int VAR_2) { SSISlave *ss = SSI_SLAVE(VAR_1); ssi_sd_state *s = (ssi_sd_state *)VAR_1; int VAR_3; if (VAR_2 != 1) s->mode = qemu_get_be32(VAR_0); s->cmd = qemu_get_be32(VAR_0); for (VAR_3 = 0; VAR_3 < 4; VAR_3++) s->cmdarg[VAR_3] = qemu_get_be32(VAR_0); for (VAR_3 = 0; VAR_3 < 5; VAR_3++) s->response[VAR_3] = qemu_get_be32(VAR_0); s->arglen = qemu_get_be32(VAR_0); s->response_pos = qemu_get_be32(VAR_0); s->stopping = qemu_get_be32(VAR_0); ss->cs = qemu_get_be32(VAR_0); return 0;
[ "static int FUNC_0(QEMUFile *VAR_0, void *VAR_1, int VAR_2)\n{", "SSISlave *ss = SSI_SLAVE(VAR_1);", "ssi_sd_state *s = (ssi_sd_state *)VAR_1;", "int VAR_3;", "if (VAR_2 != 1)\ns->mode = qemu_get_be32(VAR_0);", "s->cmd = qemu_get_be32(VAR_0);", "for (VAR_3 = 0; VAR_3 < 4; VAR_3++)", "s->cmdarg[VAR_3] = qemu_get_be32(VAR_0);", "for (VAR_3 = 0; VAR_3 < 5; VAR_3++)", "s->response[VAR_3] = qemu_get_be32(VAR_0);", "s->arglen = qemu_get_be32(VAR_0);", "s->response_pos = qemu_get_be32(VAR_0);", "s->stopping = qemu_get_be32(VAR_0);", "ss->cs = qemu_get_be32(VAR_0);", "return 0;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13, 18 ], [ 20 ], [ 22 ], [ 24 ], [ 26 ], [ 28 ], [ 30 ], [ 36 ], [ 38 ], [ 47 ], [ 51 ] ]
24,238
static inline uint8_t *ram_chunk_end(const RDMALocalBlock *rdma_ram_block, uint64_t i) { uint8_t *result = ram_chunk_start(rdma_ram_block, i) + (1UL << RDMA_REG_CHUNK_SHIFT); if (result > (rdma_ram_block->local_host_addr + rdma_ram_block->length)) { result = rdma_ram_block->local_host_addr + rdma_ram_block->length; } return result; }
true
qemu
60fe637bf0e4d7989e21e50f52526444765c63b4
static inline uint8_t *ram_chunk_end(const RDMALocalBlock *rdma_ram_block, uint64_t i) { uint8_t *result = ram_chunk_start(rdma_ram_block, i) + (1UL << RDMA_REG_CHUNK_SHIFT); if (result > (rdma_ram_block->local_host_addr + rdma_ram_block->length)) { result = rdma_ram_block->local_host_addr + rdma_ram_block->length; } return result; }
{ "code": [], "line_no": [] }
static inline uint8_t *FUNC_0(const RDMALocalBlock *rdma_ram_block, uint64_t i) { uint8_t *result = ram_chunk_start(rdma_ram_block, i) + (1UL << RDMA_REG_CHUNK_SHIFT); if (result > (rdma_ram_block->local_host_addr + rdma_ram_block->length)) { result = rdma_ram_block->local_host_addr + rdma_ram_block->length; } return result; }
[ "static inline uint8_t *FUNC_0(const RDMALocalBlock *rdma_ram_block,\nuint64_t i)\n{", "uint8_t *result = ram_chunk_start(rdma_ram_block, i) +\n(1UL << RDMA_REG_CHUNK_SHIFT);", "if (result > (rdma_ram_block->local_host_addr + rdma_ram_block->length)) {", "result = rdma_ram_block->local_host_addr + rdma_ram_block->length;", "}", "return result;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7, 9 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ] ]
24,239
static int build_vlc(VLC *vlc, const uint8_t *bits_table, const uint8_t *val_table, int nb_codes) { uint8_t huff_size[256]; uint16_t huff_code[256]; memset(huff_size, 0, sizeof(huff_size)); build_huffman_codes(huff_size, huff_code, bits_table, val_table); return init_vlc(vlc, 9, nb_codes, huff_size, 1, 1, huff_code, 2, 2); }
true
FFmpeg
073c2593c9f0aa4445a6fc1b9b24e6e52a8cc2c1
static int build_vlc(VLC *vlc, const uint8_t *bits_table, const uint8_t *val_table, int nb_codes) { uint8_t huff_size[256]; uint16_t huff_code[256]; memset(huff_size, 0, sizeof(huff_size)); build_huffman_codes(huff_size, huff_code, bits_table, val_table); return init_vlc(vlc, 9, nb_codes, huff_size, 1, 1, huff_code, 2, 2); }
{ "code": [ " int nb_codes)", " return init_vlc(vlc, 9, nb_codes, huff_size, 1, 1, huff_code, 2, 2);" ], "line_no": [ 3, 19 ] }
static int FUNC_0(VLC *VAR_0, const uint8_t *VAR_1, const uint8_t *VAR_2, int VAR_3) { uint8_t huff_size[256]; uint16_t huff_code[256]; memset(huff_size, 0, sizeof(huff_size)); build_huffman_codes(huff_size, huff_code, VAR_1, VAR_2); return init_vlc(VAR_0, 9, VAR_3, huff_size, 1, 1, huff_code, 2, 2); }
[ "static int FUNC_0(VLC *VAR_0, const uint8_t *VAR_1, const uint8_t *VAR_2,\nint VAR_3)\n{", "uint8_t huff_size[256];", "uint16_t huff_code[256];", "memset(huff_size, 0, sizeof(huff_size));", "build_huffman_codes(huff_size, huff_code, VAR_1, VAR_2);", "return init_vlc(VAR_0, 9, VAR_3, huff_size, 1, 1, huff_code, 2, 2);", "}" ]
[ 1, 0, 0, 0, 0, 1, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ] ]