id
int32
0
27.3k
func
stringlengths
26
142k
target
bool
2 classes
project
stringclasses
2 values
commit_id
stringlengths
40
40
func_clean
stringlengths
26
131k
vul_lines
dict
normalized_func
stringlengths
24
132k
lines
listlengths
1
2.8k
label
listlengths
1
2.8k
line_no
listlengths
1
2.8k
11,083
static int decode_frame(AVCodecContext * avctx, void *data, int *got_frame, AVPacket *avpkt) { KmvcContext *const ctx = avctx->priv_data; AVFrame *frame = data; uint8_t *out, *src; int i, ret; int header; int blocksize; const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL); bytestream2_init(&ctx->g, avpkt->data, avpkt->size); if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; header = bytestream2_get_byte(&ctx->g); /* blocksize 127 is really palette change event */ if (bytestream2_peek_byte(&ctx->g) == 127) { bytestream2_skip(&ctx->g, 3); for (i = 0; i < 127; i++) { ctx->pal[i + (header & 0x81)] = 0xFFU << 24 | bytestream2_get_be24(&ctx->g); bytestream2_skip(&ctx->g, 1); } bytestream2_seek(&ctx->g, -127 * 4 - 3, SEEK_CUR); } if (header & KMVC_KEYFRAME) { frame->key_frame = 1; frame->pict_type = AV_PICTURE_TYPE_I; } else { frame->key_frame = 0; frame->pict_type = AV_PICTURE_TYPE_P; } if (header & KMVC_PALETTE) { frame->palette_has_changed = 1; // palette starts from index 1 and has 127 entries for (i = 1; i <= ctx->palsize; i++) { ctx->pal[i] = 0xFFU << 24 | bytestream2_get_be24(&ctx->g); } } if (pal) { frame->palette_has_changed = 1; memcpy(ctx->pal, pal, AVPALETTE_SIZE); } if (ctx->setpal) { ctx->setpal = 0; frame->palette_has_changed = 1; } /* make the palette available on the way out */ memcpy(frame->data[1], ctx->pal, 1024); blocksize = bytestream2_get_byte(&ctx->g); if (blocksize != 8 && blocksize != 127) { av_log(avctx, AV_LOG_ERROR, "Block size = %i\n", blocksize); return AVERROR_INVALIDDATA; } memset(ctx->cur, 0, 320 * 200); switch (header & KMVC_METHOD) { case 0: case 1: // used in palette changed event memcpy(ctx->cur, ctx->prev, 320 * 200); break; case 3: kmvc_decode_intra_8x8(ctx, avctx->width, avctx->height); break; case 4: kmvc_decode_inter_8x8(ctx, avctx->width, avctx->height); break; default: av_log(avctx, AV_LOG_ERROR, "Unknown compression method %i\n", header & KMVC_METHOD); return AVERROR_INVALIDDATA; } out = frame->data[0]; src = ctx->cur; for (i = 0; i < avctx->height; i++) { memcpy(out, src, avctx->width); src += 320; out += frame->linesize[0]; } /* flip buffers */ if (ctx->cur == ctx->frm0) { ctx->cur = ctx->frm1; ctx->prev = ctx->frm0; } else { ctx->cur = ctx->frm0; ctx->prev = ctx->frm1; } *got_frame = 1; /* always report that the buffer was completely consumed */ return avpkt->size; }
false
FFmpeg
2d99101d0964f754822fb4af121c4abc69047dba
static int decode_frame(AVCodecContext * avctx, void *data, int *got_frame, AVPacket *avpkt) { KmvcContext *const ctx = avctx->priv_data; AVFrame *frame = data; uint8_t *out, *src; int i, ret; int header; int blocksize; const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL); bytestream2_init(&ctx->g, avpkt->data, avpkt->size); if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; header = bytestream2_get_byte(&ctx->g); if (bytestream2_peek_byte(&ctx->g) == 127) { bytestream2_skip(&ctx->g, 3); for (i = 0; i < 127; i++) { ctx->pal[i + (header & 0x81)] = 0xFFU << 24 | bytestream2_get_be24(&ctx->g); bytestream2_skip(&ctx->g, 1); } bytestream2_seek(&ctx->g, -127 * 4 - 3, SEEK_CUR); } if (header & KMVC_KEYFRAME) { frame->key_frame = 1; frame->pict_type = AV_PICTURE_TYPE_I; } else { frame->key_frame = 0; frame->pict_type = AV_PICTURE_TYPE_P; } if (header & KMVC_PALETTE) { frame->palette_has_changed = 1; for (i = 1; i <= ctx->palsize; i++) { ctx->pal[i] = 0xFFU << 24 | bytestream2_get_be24(&ctx->g); } } if (pal) { frame->palette_has_changed = 1; memcpy(ctx->pal, pal, AVPALETTE_SIZE); } if (ctx->setpal) { ctx->setpal = 0; frame->palette_has_changed = 1; } memcpy(frame->data[1], ctx->pal, 1024); blocksize = bytestream2_get_byte(&ctx->g); if (blocksize != 8 && blocksize != 127) { av_log(avctx, AV_LOG_ERROR, "Block size = %i\n", blocksize); return AVERROR_INVALIDDATA; } memset(ctx->cur, 0, 320 * 200); switch (header & KMVC_METHOD) { case 0: case 1: memcpy(ctx->cur, ctx->prev, 320 * 200); break; case 3: kmvc_decode_intra_8x8(ctx, avctx->width, avctx->height); break; case 4: kmvc_decode_inter_8x8(ctx, avctx->width, avctx->height); break; default: av_log(avctx, AV_LOG_ERROR, "Unknown compression method %i\n", header & KMVC_METHOD); return AVERROR_INVALIDDATA; } out = frame->data[0]; src = ctx->cur; for (i = 0; i < avctx->height; i++) { memcpy(out, src, avctx->width); src += 320; out += frame->linesize[0]; } if (ctx->cur == ctx->frm0) { ctx->cur = ctx->frm1; ctx->prev = ctx->frm0; } else { ctx->cur = ctx->frm0; ctx->prev = ctx->frm1; } *got_frame = 1; return avpkt->size; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext * VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3) { KmvcContext *const ctx = VAR_0->priv_data; AVFrame *frame = VAR_1; uint8_t *out, *src; int VAR_4, VAR_5; int VAR_6; int VAR_7; const uint8_t *VAR_8 = av_packet_get_side_data(VAR_3, AV_PKT_DATA_PALETTE, NULL); bytestream2_init(&ctx->g, VAR_3->VAR_1, VAR_3->size); if ((VAR_5 = ff_get_buffer(VAR_0, frame, 0)) < 0) return VAR_5; VAR_6 = bytestream2_get_byte(&ctx->g); if (bytestream2_peek_byte(&ctx->g) == 127) { bytestream2_skip(&ctx->g, 3); for (VAR_4 = 0; VAR_4 < 127; VAR_4++) { ctx->VAR_8[VAR_4 + (VAR_6 & 0x81)] = 0xFFU << 24 | bytestream2_get_be24(&ctx->g); bytestream2_skip(&ctx->g, 1); } bytestream2_seek(&ctx->g, -127 * 4 - 3, SEEK_CUR); } if (VAR_6 & KMVC_KEYFRAME) { frame->key_frame = 1; frame->pict_type = AV_PICTURE_TYPE_I; } else { frame->key_frame = 0; frame->pict_type = AV_PICTURE_TYPE_P; } if (VAR_6 & KMVC_PALETTE) { frame->palette_has_changed = 1; for (VAR_4 = 1; VAR_4 <= ctx->palsize; VAR_4++) { ctx->VAR_8[VAR_4] = 0xFFU << 24 | bytestream2_get_be24(&ctx->g); } } if (VAR_8) { frame->palette_has_changed = 1; memcpy(ctx->VAR_8, VAR_8, AVPALETTE_SIZE); } if (ctx->setpal) { ctx->setpal = 0; frame->palette_has_changed = 1; } memcpy(frame->VAR_1[1], ctx->VAR_8, 1024); VAR_7 = bytestream2_get_byte(&ctx->g); if (VAR_7 != 8 && VAR_7 != 127) { av_log(VAR_0, AV_LOG_ERROR, "Block size = %VAR_4\n", VAR_7); return AVERROR_INVALIDDATA; } memset(ctx->cur, 0, 320 * 200); switch (VAR_6 & KMVC_METHOD) { case 0: case 1: memcpy(ctx->cur, ctx->prev, 320 * 200); break; case 3: kmvc_decode_intra_8x8(ctx, VAR_0->width, VAR_0->height); break; case 4: kmvc_decode_inter_8x8(ctx, VAR_0->width, VAR_0->height); break; default: av_log(VAR_0, AV_LOG_ERROR, "Unknown compression method %VAR_4\n", VAR_6 & KMVC_METHOD); return AVERROR_INVALIDDATA; } out = frame->VAR_1[0]; src = ctx->cur; for (VAR_4 = 0; VAR_4 < VAR_0->height; VAR_4++) { memcpy(out, src, VAR_0->width); src += 320; out += frame->linesize[0]; } if (ctx->cur == ctx->frm0) { ctx->cur = ctx->frm1; ctx->prev = ctx->frm0; } else { ctx->cur = ctx->frm0; ctx->prev = ctx->frm1; } *VAR_2 = 1; return VAR_3->size; }
[ "static int FUNC_0(AVCodecContext * VAR_0, void *VAR_1, int *VAR_2,\nAVPacket *VAR_3)\n{", "KmvcContext *const ctx = VAR_0->priv_data;", "AVFrame *frame = VAR_1;", "uint8_t *out, *src;", "int VAR_4, VAR_5;", "int VAR_6;", "int VAR_7;", "const uint8_t *VAR_8 = av_packet_get_side_data(VAR_3, AV_PKT_DATA_PALETTE, NULL);", "bytestream2_init(&ctx->g, VAR_3->VAR_1, VAR_3->size);", "if ((VAR_5 = ff_get_buffer(VAR_0, frame, 0)) < 0)\nreturn VAR_5;", "VAR_6 = bytestream2_get_byte(&ctx->g);", "if (bytestream2_peek_byte(&ctx->g) == 127) {", "bytestream2_skip(&ctx->g, 3);", "for (VAR_4 = 0; VAR_4 < 127; VAR_4++) {", "ctx->VAR_8[VAR_4 + (VAR_6 & 0x81)] = 0xFFU << 24 | bytestream2_get_be24(&ctx->g);", "bytestream2_skip(&ctx->g, 1);", "}", "bytestream2_seek(&ctx->g, -127 * 4 - 3, SEEK_CUR);", "}", "if (VAR_6 & KMVC_KEYFRAME) {", "frame->key_frame = 1;", "frame->pict_type = AV_PICTURE_TYPE_I;", "} else {", "frame->key_frame = 0;", "frame->pict_type = AV_PICTURE_TYPE_P;", "}", "if (VAR_6 & KMVC_PALETTE) {", "frame->palette_has_changed = 1;", "for (VAR_4 = 1; VAR_4 <= ctx->palsize; VAR_4++) {", "ctx->VAR_8[VAR_4] = 0xFFU << 24 | bytestream2_get_be24(&ctx->g);", "}", "}", "if (VAR_8) {", "frame->palette_has_changed = 1;", "memcpy(ctx->VAR_8, VAR_8, AVPALETTE_SIZE);", "}", "if (ctx->setpal) {", "ctx->setpal = 0;", "frame->palette_has_changed = 1;", "}", "memcpy(frame->VAR_1[1], ctx->VAR_8, 1024);", "VAR_7 = bytestream2_get_byte(&ctx->g);", "if (VAR_7 != 8 && VAR_7 != 127) {", "av_log(VAR_0, AV_LOG_ERROR, \"Block size = %VAR_4\\n\", VAR_7);", "return AVERROR_INVALIDDATA;", "}", "memset(ctx->cur, 0, 320 * 200);", "switch (VAR_6 & KMVC_METHOD) {", "case 0:\ncase 1:\nmemcpy(ctx->cur, ctx->prev, 320 * 200);", "break;", "case 3:\nkmvc_decode_intra_8x8(ctx, VAR_0->width, VAR_0->height);", "break;", "case 4:\nkmvc_decode_inter_8x8(ctx, VAR_0->width, VAR_0->height);", "break;", "default:\nav_log(VAR_0, AV_LOG_ERROR, \"Unknown compression method %VAR_4\\n\", VAR_6 & KMVC_METHOD);", "return AVERROR_INVALIDDATA;", "}", "out = frame->VAR_1[0];", "src = ctx->cur;", "for (VAR_4 = 0; VAR_4 < VAR_0->height; VAR_4++) {", "memcpy(out, src, VAR_0->width);", "src += 320;", "out += frame->linesize[0];", "}", "if (ctx->cur == ctx->frm0) {", "ctx->cur = ctx->frm1;", "ctx->prev = ctx->frm0;", "} else {", "ctx->cur = ctx->frm0;", "ctx->prev = ctx->frm1;", "}", "*VAR_2 = 1;", "return VAR_3->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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 27, 29 ], [ 33 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 111 ], [ 115 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131, 133, 135 ], [ 137 ], [ 139, 141 ], [ 143 ], [ 145, 147 ], [ 149 ], [ 151, 153 ], [ 155 ], [ 157 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 195 ], [ 201 ], [ 203 ] ]
11,085
static int test_vector_fmul(AVFloatDSPContext *fdsp, AVFloatDSPContext *cdsp, const float *v1, const float *v2) { LOCAL_ALIGNED(32, float, cdst, [LEN]); LOCAL_ALIGNED(32, float, odst, [LEN]); int ret; cdsp->vector_fmul(cdst, v1, v2, LEN); fdsp->vector_fmul(odst, v1, v2, LEN); if (ret = compare_floats(cdst, odst, LEN, FLT_EPSILON)) av_log(NULL, AV_LOG_ERROR, "vector_fmul failed\n"); return ret; }
false
FFmpeg
e53c9065ca08a9153ecc73a6a8940bcc6d667e58
static int test_vector_fmul(AVFloatDSPContext *fdsp, AVFloatDSPContext *cdsp, const float *v1, const float *v2) { LOCAL_ALIGNED(32, float, cdst, [LEN]); LOCAL_ALIGNED(32, float, odst, [LEN]); int ret; cdsp->vector_fmul(cdst, v1, v2, LEN); fdsp->vector_fmul(odst, v1, v2, LEN); if (ret = compare_floats(cdst, odst, LEN, FLT_EPSILON)) av_log(NULL, AV_LOG_ERROR, "vector_fmul failed\n"); return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFloatDSPContext *VAR_0, AVFloatDSPContext *VAR_1, const float *VAR_2, const float *VAR_3) { LOCAL_ALIGNED(32, float, cdst, [LEN]); LOCAL_ALIGNED(32, float, odst, [LEN]); int VAR_4; VAR_1->vector_fmul(cdst, VAR_2, VAR_3, LEN); VAR_0->vector_fmul(odst, VAR_2, VAR_3, LEN); if (VAR_4 = compare_floats(cdst, odst, LEN, FLT_EPSILON)) av_log(NULL, AV_LOG_ERROR, "vector_fmul failed\n"); return VAR_4; }
[ "static int FUNC_0(AVFloatDSPContext *VAR_0, AVFloatDSPContext *VAR_1,\nconst float *VAR_2, const float *VAR_3)\n{", "LOCAL_ALIGNED(32, float, cdst, [LEN]);", "LOCAL_ALIGNED(32, float, odst, [LEN]);", "int VAR_4;", "VAR_1->vector_fmul(cdst, VAR_2, VAR_3, LEN);", "VAR_0->vector_fmul(odst, VAR_2, VAR_3, LEN);", "if (VAR_4 = compare_floats(cdst, odst, LEN, FLT_EPSILON))\nav_log(NULL, AV_LOG_ERROR, \"vector_fmul failed\\n\");", "return VAR_4;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 21, 23 ], [ 27 ], [ 29 ] ]
11,086
static int vc1_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size, n_slices = 0, i, ret; VC1Context *v = avctx->priv_data; MpegEncContext *s = &v->s; AVFrame *pict = data; uint8_t *buf2 = NULL; const uint8_t *buf_start = buf; int mb_height, n_slices1; struct { uint8_t *buf; GetBitContext gb; int mby_start; } *slices = NULL, *tmp; /* no supplementary picture */ if (buf_size == 0 || (buf_size == 4 && AV_RB32(buf) == VC1_CODE_ENDOFSEQ)) { /* special case for last picture */ if (s->low_delay == 0 && s->next_picture_ptr) { if ((ret = av_frame_ref(pict, s->next_picture_ptr->f)) < 0) return ret; s->next_picture_ptr = NULL; *got_frame = 1; } return 0; } //for advanced profile we may need to parse and unescape data if (avctx->codec_id == AV_CODEC_ID_VC1 || avctx->codec_id == AV_CODEC_ID_VC1IMAGE) { int buf_size2 = 0; buf2 = av_mallocz(buf_size + FF_INPUT_BUFFER_PADDING_SIZE); if (IS_MARKER(AV_RB32(buf))) { /* frame starts with marker and needs to be parsed */ const uint8_t *start, *end, *next; int size; next = buf; for (start = buf, end = buf + buf_size; next < end; start = next) { next = find_next_marker(start + 4, end); size = next - start - 4; if (size <= 0) continue; switch (AV_RB32(start)) { case VC1_CODE_FRAME: if (avctx->hwaccel) buf_start = start; buf_size2 = vc1_unescape_buffer(start + 4, size, buf2); break; case VC1_CODE_FIELD: { int buf_size3; tmp = av_realloc(slices, sizeof(*slices) * (n_slices+1)); if (!tmp) goto err; slices = tmp; slices[n_slices].buf = av_mallocz(buf_size + FF_INPUT_BUFFER_PADDING_SIZE); if (!slices[n_slices].buf) goto err; buf_size3 = vc1_unescape_buffer(start + 4, size, slices[n_slices].buf); init_get_bits(&slices[n_slices].gb, slices[n_slices].buf, buf_size3 << 3); /* assuming that the field marker is at the exact middle, hope it's correct */ slices[n_slices].mby_start = s->mb_height >> 1; n_slices1 = n_slices - 1; // index of the last slice of the first field n_slices++; break; } case VC1_CODE_ENTRYPOINT: /* it should be before frame data */ buf_size2 = vc1_unescape_buffer(start + 4, size, buf2); init_get_bits(&s->gb, buf2, buf_size2 * 8); ff_vc1_decode_entry_point(avctx, v, &s->gb); break; case VC1_CODE_SLICE: { int buf_size3; tmp = av_realloc(slices, sizeof(*slices) * (n_slices+1)); if (!tmp) goto err; slices = tmp; slices[n_slices].buf = av_mallocz(buf_size + FF_INPUT_BUFFER_PADDING_SIZE); if (!slices[n_slices].buf) goto err; buf_size3 = vc1_unescape_buffer(start + 4, size, slices[n_slices].buf); init_get_bits(&slices[n_slices].gb, slices[n_slices].buf, buf_size3 << 3); slices[n_slices].mby_start = get_bits(&slices[n_slices].gb, 9); n_slices++; break; } } } } else if (v->interlace && ((buf[0] & 0xC0) == 0xC0)) { /* WVC1 interlaced stores both fields divided by marker */ const uint8_t *divider; int buf_size3; divider = find_next_marker(buf, buf + buf_size); if ((divider == (buf + buf_size)) || AV_RB32(divider) != VC1_CODE_FIELD) { av_log(avctx, AV_LOG_ERROR, "Error in WVC1 interlaced frame\n"); goto err; } else { // found field marker, unescape second field tmp = av_realloc(slices, sizeof(*slices) * (n_slices+1)); if (!tmp) goto err; slices = tmp; slices[n_slices].buf = av_mallocz(buf_size + FF_INPUT_BUFFER_PADDING_SIZE); if (!slices[n_slices].buf) goto err; buf_size3 = vc1_unescape_buffer(divider + 4, buf + buf_size - divider - 4, slices[n_slices].buf); init_get_bits(&slices[n_slices].gb, slices[n_slices].buf, buf_size3 << 3); slices[n_slices].mby_start = s->mb_height >> 1; n_slices1 = n_slices - 1; n_slices++; } buf_size2 = vc1_unescape_buffer(buf, divider - buf, buf2); } else { buf_size2 = vc1_unescape_buffer(buf, buf_size, buf2); } init_get_bits(&s->gb, buf2, buf_size2*8); } else init_get_bits(&s->gb, buf, buf_size*8); if (v->res_sprite) { v->new_sprite = !get_bits1(&s->gb); v->two_sprites = get_bits1(&s->gb); /* res_sprite means a Windows Media Image stream, AV_CODEC_ID_*IMAGE means we're using the sprite compositor. These are intentionally kept separate so you can get the raw sprites by using the wmv3 decoder for WMVP or the vc1 one for WVP2 */ if (avctx->codec_id == AV_CODEC_ID_WMV3IMAGE || avctx->codec_id == AV_CODEC_ID_VC1IMAGE) { if (v->new_sprite) { // switch AVCodecContext parameters to those of the sprites avctx->width = avctx->coded_width = v->sprite_width; avctx->height = avctx->coded_height = v->sprite_height; } else { goto image; } } } if (s->context_initialized && (s->width != avctx->coded_width || s->height != avctx->coded_height)) { ff_vc1_decode_end(avctx); } if (!s->context_initialized) { if (ff_msmpeg4_decode_init(avctx) < 0) goto err; if (ff_vc1_decode_init_alloc_tables(v) < 0) { ff_mpv_common_end(s); goto err; } s->low_delay = !avctx->has_b_frames || v->res_sprite; if (v->profile == PROFILE_ADVANCED) { s->h_edge_pos = avctx->coded_width; s->v_edge_pos = avctx->coded_height; } } // do parse frame header v->pic_header_flag = 0; v->first_pic_header_flag = 1; if (v->profile < PROFILE_ADVANCED) { if (ff_vc1_parse_frame_header(v, &s->gb) < 0) { goto err; } } else { if (ff_vc1_parse_frame_header_adv(v, &s->gb) < 0) { goto err; } } v->first_pic_header_flag = 0; if ((avctx->codec_id == AV_CODEC_ID_WMV3IMAGE || avctx->codec_id == AV_CODEC_ID_VC1IMAGE) && s->pict_type != AV_PICTURE_TYPE_I) { av_log(v->s.avctx, AV_LOG_ERROR, "Sprite decoder: expected I-frame\n"); goto err; } // for skipping the frame s->current_picture.f->pict_type = s->pict_type; s->current_picture.f->key_frame = s->pict_type == AV_PICTURE_TYPE_I; /* skip B-frames if we don't have reference frames */ if (s->last_picture_ptr == NULL && (s->pict_type == AV_PICTURE_TYPE_B || s->droppable)) { goto end; } if ((avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type == AV_PICTURE_TYPE_B) || (avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type != AV_PICTURE_TYPE_I) || avctx->skip_frame >= AVDISCARD_ALL) { goto end; } if (s->next_p_frame_damaged) { if (s->pict_type == AV_PICTURE_TYPE_B) goto end; else s->next_p_frame_damaged = 0; } if (ff_mpv_frame_start(s, avctx) < 0) { goto err; } // process pulldown flags s->current_picture_ptr->f->repeat_pict = 0; // Pulldown flags are only valid when 'broadcast' has been set. // So ticks_per_frame will be 2 if (v->rff) { // repeat field s->current_picture_ptr->f->repeat_pict = 1; } else if (v->rptfrm) { // repeat frames s->current_picture_ptr->f->repeat_pict = v->rptfrm * 2; } s->me.qpel_put = s->qdsp.put_qpel_pixels_tab; s->me.qpel_avg = s->qdsp.avg_qpel_pixels_tab; if (avctx->hwaccel) { if (avctx->hwaccel->start_frame(avctx, buf, buf_size) < 0) goto err; if (avctx->hwaccel->decode_slice(avctx, buf_start, (buf + buf_size) - buf_start) < 0) goto err; if (avctx->hwaccel->end_frame(avctx) < 0) goto err; } else { int header_ret = 0; ff_mpeg_er_frame_start(s); v->bits = buf_size * 8; v->end_mb_x = s->mb_width; if (v->field_mode) { s->current_picture.f->linesize[0] <<= 1; s->current_picture.f->linesize[1] <<= 1; s->current_picture.f->linesize[2] <<= 1; s->linesize <<= 1; s->uvlinesize <<= 1; } mb_height = s->mb_height >> v->field_mode; if (!mb_height) { av_log(v->s.avctx, AV_LOG_ERROR, "Invalid mb_height.\n"); goto err; } for (i = 0; i <= n_slices; i++) { if (i > 0 && slices[i - 1].mby_start >= mb_height) { if (v->field_mode <= 0) { av_log(v->s.avctx, AV_LOG_ERROR, "Slice %d starts beyond " "picture boundary (%d >= %d)\n", i, slices[i - 1].mby_start, mb_height); continue; } v->second_field = 1; v->blocks_off = s->mb_width * s->mb_height << 1; v->mb_off = s->mb_stride * s->mb_height >> 1; } else { v->second_field = 0; v->blocks_off = 0; v->mb_off = 0; } if (i) { v->pic_header_flag = 0; if (v->field_mode && i == n_slices1 + 2) { if ((header_ret = ff_vc1_parse_frame_header_adv(v, &s->gb)) < 0) { av_log(v->s.avctx, AV_LOG_ERROR, "Field header damaged\n"); if (avctx->err_recognition & AV_EF_EXPLODE) goto err; continue; } } else if (get_bits1(&s->gb)) { v->pic_header_flag = 1; if ((header_ret = ff_vc1_parse_frame_header_adv(v, &s->gb)) < 0) { av_log(v->s.avctx, AV_LOG_ERROR, "Slice header damaged\n"); if (avctx->err_recognition & AV_EF_EXPLODE) goto err; continue; } } } if (header_ret < 0) continue; s->start_mb_y = (i == 0) ? 0 : FFMAX(0, slices[i-1].mby_start % mb_height); if (!v->field_mode || v->second_field) s->end_mb_y = (i == n_slices ) ? mb_height : FFMIN(mb_height, slices[i].mby_start % mb_height); else s->end_mb_y = (i <= n_slices1 + 1) ? mb_height : FFMIN(mb_height, slices[i].mby_start % mb_height); ff_vc1_decode_blocks(v); if (i != n_slices) s->gb = slices[i].gb; } if (v->field_mode) { v->second_field = 0; s->current_picture.f->linesize[0] >>= 1; s->current_picture.f->linesize[1] >>= 1; s->current_picture.f->linesize[2] >>= 1; s->linesize >>= 1; s->uvlinesize >>= 1; if (v->s.pict_type != AV_PICTURE_TYPE_BI && v->s.pict_type != AV_PICTURE_TYPE_B) { FFSWAP(uint8_t *, v->mv_f_next[0], v->mv_f[0]); FFSWAP(uint8_t *, v->mv_f_next[1], v->mv_f[1]); } } av_dlog(s->avctx, "Consumed %i/%i bits\n", get_bits_count(&s->gb), s->gb.size_in_bits); // if (get_bits_count(&s->gb) > buf_size * 8) // return -1; if (!v->field_mode) ff_er_frame_end(&s->er); } ff_mpv_frame_end(s); if (avctx->codec_id == AV_CODEC_ID_WMV3IMAGE || avctx->codec_id == AV_CODEC_ID_VC1IMAGE) { image: avctx->width = avctx->coded_width = v->output_width; avctx->height = avctx->coded_height = v->output_height; if (avctx->skip_frame >= AVDISCARD_NONREF) goto end; #if CONFIG_WMV3IMAGE_DECODER || CONFIG_VC1IMAGE_DECODER if (vc1_decode_sprites(v, &s->gb)) goto err; #endif if ((ret = av_frame_ref(pict, v->sprite_output_frame)) < 0) goto err; *got_frame = 1; } else { if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) { if ((ret = av_frame_ref(pict, s->current_picture_ptr->f)) < 0) goto err; ff_print_debug_info(s, s->current_picture_ptr); *got_frame = 1; } else if (s->last_picture_ptr != NULL) { if ((ret = av_frame_ref(pict, s->last_picture_ptr->f)) < 0) goto err; ff_print_debug_info(s, s->last_picture_ptr); *got_frame = 1; } } end: av_free(buf2); for (i = 0; i < n_slices; i++) av_free(slices[i].buf); av_free(slices); return buf_size; err: av_free(buf2); for (i = 0; i < n_slices; i++) av_free(slices[i].buf); av_free(slices); return -1; }
false
FFmpeg
f929ab0569ff31ed5a59b0b0adb7ce09df3fca39
static int vc1_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size, n_slices = 0, i, ret; VC1Context *v = avctx->priv_data; MpegEncContext *s = &v->s; AVFrame *pict = data; uint8_t *buf2 = NULL; const uint8_t *buf_start = buf; int mb_height, n_slices1; struct { uint8_t *buf; GetBitContext gb; int mby_start; } *slices = NULL, *tmp; if (buf_size == 0 || (buf_size == 4 && AV_RB32(buf) == VC1_CODE_ENDOFSEQ)) { if (s->low_delay == 0 && s->next_picture_ptr) { if ((ret = av_frame_ref(pict, s->next_picture_ptr->f)) < 0) return ret; s->next_picture_ptr = NULL; *got_frame = 1; } return 0; } if (avctx->codec_id == AV_CODEC_ID_VC1 || avctx->codec_id == AV_CODEC_ID_VC1IMAGE) { int buf_size2 = 0; buf2 = av_mallocz(buf_size + FF_INPUT_BUFFER_PADDING_SIZE); if (IS_MARKER(AV_RB32(buf))) { const uint8_t *start, *end, *next; int size; next = buf; for (start = buf, end = buf + buf_size; next < end; start = next) { next = find_next_marker(start + 4, end); size = next - start - 4; if (size <= 0) continue; switch (AV_RB32(start)) { case VC1_CODE_FRAME: if (avctx->hwaccel) buf_start = start; buf_size2 = vc1_unescape_buffer(start + 4, size, buf2); break; case VC1_CODE_FIELD: { int buf_size3; tmp = av_realloc(slices, sizeof(*slices) * (n_slices+1)); if (!tmp) goto err; slices = tmp; slices[n_slices].buf = av_mallocz(buf_size + FF_INPUT_BUFFER_PADDING_SIZE); if (!slices[n_slices].buf) goto err; buf_size3 = vc1_unescape_buffer(start + 4, size, slices[n_slices].buf); init_get_bits(&slices[n_slices].gb, slices[n_slices].buf, buf_size3 << 3); slices[n_slices].mby_start = s->mb_height >> 1; n_slices1 = n_slices - 1; n_slices++; break; } case VC1_CODE_ENTRYPOINT: buf_size2 = vc1_unescape_buffer(start + 4, size, buf2); init_get_bits(&s->gb, buf2, buf_size2 * 8); ff_vc1_decode_entry_point(avctx, v, &s->gb); break; case VC1_CODE_SLICE: { int buf_size3; tmp = av_realloc(slices, sizeof(*slices) * (n_slices+1)); if (!tmp) goto err; slices = tmp; slices[n_slices].buf = av_mallocz(buf_size + FF_INPUT_BUFFER_PADDING_SIZE); if (!slices[n_slices].buf) goto err; buf_size3 = vc1_unescape_buffer(start + 4, size, slices[n_slices].buf); init_get_bits(&slices[n_slices].gb, slices[n_slices].buf, buf_size3 << 3); slices[n_slices].mby_start = get_bits(&slices[n_slices].gb, 9); n_slices++; break; } } } } else if (v->interlace && ((buf[0] & 0xC0) == 0xC0)) { const uint8_t *divider; int buf_size3; divider = find_next_marker(buf, buf + buf_size); if ((divider == (buf + buf_size)) || AV_RB32(divider) != VC1_CODE_FIELD) { av_log(avctx, AV_LOG_ERROR, "Error in WVC1 interlaced frame\n"); goto err; } else { tmp = av_realloc(slices, sizeof(*slices) * (n_slices+1)); if (!tmp) goto err; slices = tmp; slices[n_slices].buf = av_mallocz(buf_size + FF_INPUT_BUFFER_PADDING_SIZE); if (!slices[n_slices].buf) goto err; buf_size3 = vc1_unescape_buffer(divider + 4, buf + buf_size - divider - 4, slices[n_slices].buf); init_get_bits(&slices[n_slices].gb, slices[n_slices].buf, buf_size3 << 3); slices[n_slices].mby_start = s->mb_height >> 1; n_slices1 = n_slices - 1; n_slices++; } buf_size2 = vc1_unescape_buffer(buf, divider - buf, buf2); } else { buf_size2 = vc1_unescape_buffer(buf, buf_size, buf2); } init_get_bits(&s->gb, buf2, buf_size2*8); } else init_get_bits(&s->gb, buf, buf_size*8); if (v->res_sprite) { v->new_sprite = !get_bits1(&s->gb); v->two_sprites = get_bits1(&s->gb); if (avctx->codec_id == AV_CODEC_ID_WMV3IMAGE || avctx->codec_id == AV_CODEC_ID_VC1IMAGE) { if (v->new_sprite) { avctx->width = avctx->coded_width = v->sprite_width; avctx->height = avctx->coded_height = v->sprite_height; } else { goto image; } } } if (s->context_initialized && (s->width != avctx->coded_width || s->height != avctx->coded_height)) { ff_vc1_decode_end(avctx); } if (!s->context_initialized) { if (ff_msmpeg4_decode_init(avctx) < 0) goto err; if (ff_vc1_decode_init_alloc_tables(v) < 0) { ff_mpv_common_end(s); goto err; } s->low_delay = !avctx->has_b_frames || v->res_sprite; if (v->profile == PROFILE_ADVANCED) { s->h_edge_pos = avctx->coded_width; s->v_edge_pos = avctx->coded_height; } } v->pic_header_flag = 0; v->first_pic_header_flag = 1; if (v->profile < PROFILE_ADVANCED) { if (ff_vc1_parse_frame_header(v, &s->gb) < 0) { goto err; } } else { if (ff_vc1_parse_frame_header_adv(v, &s->gb) < 0) { goto err; } } v->first_pic_header_flag = 0; if ((avctx->codec_id == AV_CODEC_ID_WMV3IMAGE || avctx->codec_id == AV_CODEC_ID_VC1IMAGE) && s->pict_type != AV_PICTURE_TYPE_I) { av_log(v->s.avctx, AV_LOG_ERROR, "Sprite decoder: expected I-frame\n"); goto err; } s->current_picture.f->pict_type = s->pict_type; s->current_picture.f->key_frame = s->pict_type == AV_PICTURE_TYPE_I; if (s->last_picture_ptr == NULL && (s->pict_type == AV_PICTURE_TYPE_B || s->droppable)) { goto end; } if ((avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type == AV_PICTURE_TYPE_B) || (avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type != AV_PICTURE_TYPE_I) || avctx->skip_frame >= AVDISCARD_ALL) { goto end; } if (s->next_p_frame_damaged) { if (s->pict_type == AV_PICTURE_TYPE_B) goto end; else s->next_p_frame_damaged = 0; } if (ff_mpv_frame_start(s, avctx) < 0) { goto err; } s->current_picture_ptr->f->repeat_pict = 0; if (v->rff) { s->current_picture_ptr->f->repeat_pict = 1; } else if (v->rptfrm) { s->current_picture_ptr->f->repeat_pict = v->rptfrm * 2; } s->me.qpel_put = s->qdsp.put_qpel_pixels_tab; s->me.qpel_avg = s->qdsp.avg_qpel_pixels_tab; if (avctx->hwaccel) { if (avctx->hwaccel->start_frame(avctx, buf, buf_size) < 0) goto err; if (avctx->hwaccel->decode_slice(avctx, buf_start, (buf + buf_size) - buf_start) < 0) goto err; if (avctx->hwaccel->end_frame(avctx) < 0) goto err; } else { int header_ret = 0; ff_mpeg_er_frame_start(s); v->bits = buf_size * 8; v->end_mb_x = s->mb_width; if (v->field_mode) { s->current_picture.f->linesize[0] <<= 1; s->current_picture.f->linesize[1] <<= 1; s->current_picture.f->linesize[2] <<= 1; s->linesize <<= 1; s->uvlinesize <<= 1; } mb_height = s->mb_height >> v->field_mode; if (!mb_height) { av_log(v->s.avctx, AV_LOG_ERROR, "Invalid mb_height.\n"); goto err; } for (i = 0; i <= n_slices; i++) { if (i > 0 && slices[i - 1].mby_start >= mb_height) { if (v->field_mode <= 0) { av_log(v->s.avctx, AV_LOG_ERROR, "Slice %d starts beyond " "picture boundary (%d >= %d)\n", i, slices[i - 1].mby_start, mb_height); continue; } v->second_field = 1; v->blocks_off = s->mb_width * s->mb_height << 1; v->mb_off = s->mb_stride * s->mb_height >> 1; } else { v->second_field = 0; v->blocks_off = 0; v->mb_off = 0; } if (i) { v->pic_header_flag = 0; if (v->field_mode && i == n_slices1 + 2) { if ((header_ret = ff_vc1_parse_frame_header_adv(v, &s->gb)) < 0) { av_log(v->s.avctx, AV_LOG_ERROR, "Field header damaged\n"); if (avctx->err_recognition & AV_EF_EXPLODE) goto err; continue; } } else if (get_bits1(&s->gb)) { v->pic_header_flag = 1; if ((header_ret = ff_vc1_parse_frame_header_adv(v, &s->gb)) < 0) { av_log(v->s.avctx, AV_LOG_ERROR, "Slice header damaged\n"); if (avctx->err_recognition & AV_EF_EXPLODE) goto err; continue; } } } if (header_ret < 0) continue; s->start_mb_y = (i == 0) ? 0 : FFMAX(0, slices[i-1].mby_start % mb_height); if (!v->field_mode || v->second_field) s->end_mb_y = (i == n_slices ) ? mb_height : FFMIN(mb_height, slices[i].mby_start % mb_height); else s->end_mb_y = (i <= n_slices1 + 1) ? mb_height : FFMIN(mb_height, slices[i].mby_start % mb_height); ff_vc1_decode_blocks(v); if (i != n_slices) s->gb = slices[i].gb; } if (v->field_mode) { v->second_field = 0; s->current_picture.f->linesize[0] >>= 1; s->current_picture.f->linesize[1] >>= 1; s->current_picture.f->linesize[2] >>= 1; s->linesize >>= 1; s->uvlinesize >>= 1; if (v->s.pict_type != AV_PICTURE_TYPE_BI && v->s.pict_type != AV_PICTURE_TYPE_B) { FFSWAP(uint8_t *, v->mv_f_next[0], v->mv_f[0]); FFSWAP(uint8_t *, v->mv_f_next[1], v->mv_f[1]); } } av_dlog(s->avctx, "Consumed %i/%i bits\n", get_bits_count(&s->gb), s->gb.size_in_bits); if (!v->field_mode) ff_er_frame_end(&s->er); } ff_mpv_frame_end(s); if (avctx->codec_id == AV_CODEC_ID_WMV3IMAGE || avctx->codec_id == AV_CODEC_ID_VC1IMAGE) { image: avctx->width = avctx->coded_width = v->output_width; avctx->height = avctx->coded_height = v->output_height; if (avctx->skip_frame >= AVDISCARD_NONREF) goto end; #if CONFIG_WMV3IMAGE_DECODER || CONFIG_VC1IMAGE_DECODER if (vc1_decode_sprites(v, &s->gb)) goto err; #endif if ((ret = av_frame_ref(pict, v->sprite_output_frame)) < 0) goto err; *got_frame = 1; } else { if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) { if ((ret = av_frame_ref(pict, s->current_picture_ptr->f)) < 0) goto err; ff_print_debug_info(s, s->current_picture_ptr); *got_frame = 1; } else if (s->last_picture_ptr != NULL) { if ((ret = av_frame_ref(pict, s->last_picture_ptr->f)) < 0) goto err; ff_print_debug_info(s, s->last_picture_ptr); *got_frame = 1; } } end: av_free(buf2); for (i = 0; i < n_slices; i++) av_free(slices[i].buf); av_free(slices); return buf_size; err: av_free(buf2); for (i = 0; i < n_slices; i++) av_free(slices[i].buf); av_free(slices); return -1; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3) { const uint8_t *VAR_4 = VAR_3->VAR_1; int VAR_5 = VAR_3->VAR_16, VAR_6 = 0, VAR_7, VAR_8; VC1Context *v = VAR_0->priv_data; MpegEncContext *s = &v->s; AVFrame *pict = VAR_1; uint8_t *buf2 = NULL; const uint8_t *VAR_9 = VAR_4; int VAR_10, VAR_11; struct { uint8_t *VAR_4; GetBitContext gb; int mby_start; } *VAR_12 = NULL, *VAR_13; if (VAR_5 == 0 || (VAR_5 == 4 && AV_RB32(VAR_4) == VC1_CODE_ENDOFSEQ)) { if (s->low_delay == 0 && s->next_picture_ptr) { if ((VAR_8 = av_frame_ref(pict, s->next_picture_ptr->f)) < 0) return VAR_8; s->next_picture_ptr = NULL; *VAR_2 = 1; } return 0; } if (VAR_0->codec_id == AV_CODEC_ID_VC1 || VAR_0->codec_id == AV_CODEC_ID_VC1IMAGE) { int VAR_14 = 0; buf2 = av_mallocz(VAR_5 + FF_INPUT_BUFFER_PADDING_SIZE); if (IS_MARKER(AV_RB32(VAR_4))) { const uint8_t *VAR_15, *end, *next; int VAR_16; next = VAR_4; for (VAR_15 = VAR_4, end = VAR_4 + VAR_5; next < end; VAR_15 = next) { next = find_next_marker(VAR_15 + 4, end); VAR_16 = next - VAR_15 - 4; if (VAR_16 <= 0) continue; switch (AV_RB32(VAR_15)) { case VC1_CODE_FRAME: if (VAR_0->hwaccel) VAR_9 = VAR_15; VAR_14 = vc1_unescape_buffer(VAR_15 + 4, VAR_16, buf2); break; case VC1_CODE_FIELD: { int VAR_18; VAR_13 = av_realloc(VAR_12, sizeof(*VAR_12) * (VAR_6+1)); if (!VAR_13) goto err; VAR_12 = VAR_13; VAR_12[VAR_6].VAR_4 = av_mallocz(VAR_5 + FF_INPUT_BUFFER_PADDING_SIZE); if (!VAR_12[VAR_6].VAR_4) goto err; VAR_18 = vc1_unescape_buffer(VAR_15 + 4, VAR_16, VAR_12[VAR_6].VAR_4); init_get_bits(&VAR_12[VAR_6].gb, VAR_12[VAR_6].VAR_4, VAR_18 << 3); VAR_12[VAR_6].mby_start = s->VAR_10 >> 1; VAR_11 = VAR_6 - 1; VAR_6++; break; } case VC1_CODE_ENTRYPOINT: VAR_14 = vc1_unescape_buffer(VAR_15 + 4, VAR_16, buf2); init_get_bits(&s->gb, buf2, VAR_14 * 8); ff_vc1_decode_entry_point(VAR_0, v, &s->gb); break; case VC1_CODE_SLICE: { int VAR_18; VAR_13 = av_realloc(VAR_12, sizeof(*VAR_12) * (VAR_6+1)); if (!VAR_13) goto err; VAR_12 = VAR_13; VAR_12[VAR_6].VAR_4 = av_mallocz(VAR_5 + FF_INPUT_BUFFER_PADDING_SIZE); if (!VAR_12[VAR_6].VAR_4) goto err; VAR_18 = vc1_unescape_buffer(VAR_15 + 4, VAR_16, VAR_12[VAR_6].VAR_4); init_get_bits(&VAR_12[VAR_6].gb, VAR_12[VAR_6].VAR_4, VAR_18 << 3); VAR_12[VAR_6].mby_start = get_bits(&VAR_12[VAR_6].gb, 9); VAR_6++; break; } } } } else if (v->interlace && ((VAR_4[0] & 0xC0) == 0xC0)) { const uint8_t *VAR_17; int VAR_18; VAR_17 = find_next_marker(VAR_4, VAR_4 + VAR_5); if ((VAR_17 == (VAR_4 + VAR_5)) || AV_RB32(VAR_17) != VC1_CODE_FIELD) { av_log(VAR_0, AV_LOG_ERROR, "Error in WVC1 interlaced frame\n"); goto err; } else { VAR_13 = av_realloc(VAR_12, sizeof(*VAR_12) * (VAR_6+1)); if (!VAR_13) goto err; VAR_12 = VAR_13; VAR_12[VAR_6].VAR_4 = av_mallocz(VAR_5 + FF_INPUT_BUFFER_PADDING_SIZE); if (!VAR_12[VAR_6].VAR_4) goto err; VAR_18 = vc1_unescape_buffer(VAR_17 + 4, VAR_4 + VAR_5 - VAR_17 - 4, VAR_12[VAR_6].VAR_4); init_get_bits(&VAR_12[VAR_6].gb, VAR_12[VAR_6].VAR_4, VAR_18 << 3); VAR_12[VAR_6].mby_start = s->VAR_10 >> 1; VAR_11 = VAR_6 - 1; VAR_6++; } VAR_14 = vc1_unescape_buffer(VAR_4, VAR_17 - VAR_4, buf2); } else { VAR_14 = vc1_unescape_buffer(VAR_4, VAR_5, buf2); } init_get_bits(&s->gb, buf2, VAR_14*8); } else init_get_bits(&s->gb, VAR_4, VAR_5*8); if (v->res_sprite) { v->new_sprite = !get_bits1(&s->gb); v->two_sprites = get_bits1(&s->gb); if (VAR_0->codec_id == AV_CODEC_ID_WMV3IMAGE || VAR_0->codec_id == AV_CODEC_ID_VC1IMAGE) { if (v->new_sprite) { VAR_0->width = VAR_0->coded_width = v->sprite_width; VAR_0->height = VAR_0->coded_height = v->sprite_height; } else { goto image; } } } if (s->context_initialized && (s->width != VAR_0->coded_width || s->height != VAR_0->coded_height)) { ff_vc1_decode_end(VAR_0); } if (!s->context_initialized) { if (ff_msmpeg4_decode_init(VAR_0) < 0) goto err; if (ff_vc1_decode_init_alloc_tables(v) < 0) { ff_mpv_common_end(s); goto err; } s->low_delay = !VAR_0->has_b_frames || v->res_sprite; if (v->profile == PROFILE_ADVANCED) { s->h_edge_pos = VAR_0->coded_width; s->v_edge_pos = VAR_0->coded_height; } } v->pic_header_flag = 0; v->first_pic_header_flag = 1; if (v->profile < PROFILE_ADVANCED) { if (ff_vc1_parse_frame_header(v, &s->gb) < 0) { goto err; } } else { if (ff_vc1_parse_frame_header_adv(v, &s->gb) < 0) { goto err; } } v->first_pic_header_flag = 0; if ((VAR_0->codec_id == AV_CODEC_ID_WMV3IMAGE || VAR_0->codec_id == AV_CODEC_ID_VC1IMAGE) && s->pict_type != AV_PICTURE_TYPE_I) { av_log(v->s.VAR_0, AV_LOG_ERROR, "Sprite decoder: expected I-frame\n"); goto err; } s->current_picture.f->pict_type = s->pict_type; s->current_picture.f->key_frame = s->pict_type == AV_PICTURE_TYPE_I; if (s->last_picture_ptr == NULL && (s->pict_type == AV_PICTURE_TYPE_B || s->droppable)) { goto end; } if ((VAR_0->skip_frame >= AVDISCARD_NONREF && s->pict_type == AV_PICTURE_TYPE_B) || (VAR_0->skip_frame >= AVDISCARD_NONKEY && s->pict_type != AV_PICTURE_TYPE_I) || VAR_0->skip_frame >= AVDISCARD_ALL) { goto end; } if (s->next_p_frame_damaged) { if (s->pict_type == AV_PICTURE_TYPE_B) goto end; else s->next_p_frame_damaged = 0; } if (ff_mpv_frame_start(s, VAR_0) < 0) { goto err; } s->current_picture_ptr->f->repeat_pict = 0; if (v->rff) { s->current_picture_ptr->f->repeat_pict = 1; } else if (v->rptfrm) { s->current_picture_ptr->f->repeat_pict = v->rptfrm * 2; } s->me.qpel_put = s->qdsp.put_qpel_pixels_tab; s->me.qpel_avg = s->qdsp.avg_qpel_pixels_tab; if (VAR_0->hwaccel) { if (VAR_0->hwaccel->start_frame(VAR_0, VAR_4, VAR_5) < 0) goto err; if (VAR_0->hwaccel->decode_slice(VAR_0, VAR_9, (VAR_4 + VAR_5) - VAR_9) < 0) goto err; if (VAR_0->hwaccel->end_frame(VAR_0) < 0) goto err; } else { int VAR_19 = 0; ff_mpeg_er_frame_start(s); v->bits = VAR_5 * 8; v->end_mb_x = s->mb_width; if (v->field_mode) { s->current_picture.f->linesize[0] <<= 1; s->current_picture.f->linesize[1] <<= 1; s->current_picture.f->linesize[2] <<= 1; s->linesize <<= 1; s->uvlinesize <<= 1; } VAR_10 = s->VAR_10 >> v->field_mode; if (!VAR_10) { av_log(v->s.VAR_0, AV_LOG_ERROR, "Invalid VAR_10.\n"); goto err; } for (VAR_7 = 0; VAR_7 <= VAR_6; VAR_7++) { if (VAR_7 > 0 && VAR_12[VAR_7 - 1].mby_start >= VAR_10) { if (v->field_mode <= 0) { av_log(v->s.VAR_0, AV_LOG_ERROR, "Slice %d starts beyond " "picture boundary (%d >= %d)\n", VAR_7, VAR_12[VAR_7 - 1].mby_start, VAR_10); continue; } v->second_field = 1; v->blocks_off = s->mb_width * s->VAR_10 << 1; v->mb_off = s->mb_stride * s->VAR_10 >> 1; } else { v->second_field = 0; v->blocks_off = 0; v->mb_off = 0; } if (VAR_7) { v->pic_header_flag = 0; if (v->field_mode && VAR_7 == VAR_11 + 2) { if ((VAR_19 = ff_vc1_parse_frame_header_adv(v, &s->gb)) < 0) { av_log(v->s.VAR_0, AV_LOG_ERROR, "Field header damaged\n"); if (VAR_0->err_recognition & AV_EF_EXPLODE) goto err; continue; } } else if (get_bits1(&s->gb)) { v->pic_header_flag = 1; if ((VAR_19 = ff_vc1_parse_frame_header_adv(v, &s->gb)) < 0) { av_log(v->s.VAR_0, AV_LOG_ERROR, "Slice header damaged\n"); if (VAR_0->err_recognition & AV_EF_EXPLODE) goto err; continue; } } } if (VAR_19 < 0) continue; s->start_mb_y = (VAR_7 == 0) ? 0 : FFMAX(0, VAR_12[VAR_7-1].mby_start % VAR_10); if (!v->field_mode || v->second_field) s->end_mb_y = (VAR_7 == VAR_6 ) ? VAR_10 : FFMIN(VAR_10, VAR_12[VAR_7].mby_start % VAR_10); else s->end_mb_y = (VAR_7 <= VAR_11 + 1) ? VAR_10 : FFMIN(VAR_10, VAR_12[VAR_7].mby_start % VAR_10); ff_vc1_decode_blocks(v); if (VAR_7 != VAR_6) s->gb = VAR_12[VAR_7].gb; } if (v->field_mode) { v->second_field = 0; s->current_picture.f->linesize[0] >>= 1; s->current_picture.f->linesize[1] >>= 1; s->current_picture.f->linesize[2] >>= 1; s->linesize >>= 1; s->uvlinesize >>= 1; if (v->s.pict_type != AV_PICTURE_TYPE_BI && v->s.pict_type != AV_PICTURE_TYPE_B) { FFSWAP(uint8_t *, v->mv_f_next[0], v->mv_f[0]); FFSWAP(uint8_t *, v->mv_f_next[1], v->mv_f[1]); } } av_dlog(s->VAR_0, "Consumed %VAR_7/%VAR_7 bits\n", get_bits_count(&s->gb), s->gb.size_in_bits); if (!v->field_mode) ff_er_frame_end(&s->er); } ff_mpv_frame_end(s); if (VAR_0->codec_id == AV_CODEC_ID_WMV3IMAGE || VAR_0->codec_id == AV_CODEC_ID_VC1IMAGE) { image: VAR_0->width = VAR_0->coded_width = v->output_width; VAR_0->height = VAR_0->coded_height = v->output_height; if (VAR_0->skip_frame >= AVDISCARD_NONREF) goto end; #if CONFIG_WMV3IMAGE_DECODER || CONFIG_VC1IMAGE_DECODER if (vc1_decode_sprites(v, &s->gb)) goto err; #endif if ((VAR_8 = av_frame_ref(pict, v->sprite_output_frame)) < 0) goto err; *VAR_2 = 1; } else { if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) { if ((VAR_8 = av_frame_ref(pict, s->current_picture_ptr->f)) < 0) goto err; ff_print_debug_info(s, s->current_picture_ptr); *VAR_2 = 1; } else if (s->last_picture_ptr != NULL) { if ((VAR_8 = av_frame_ref(pict, s->last_picture_ptr->f)) < 0) goto err; ff_print_debug_info(s, s->last_picture_ptr); *VAR_2 = 1; } } end: av_free(buf2); for (VAR_7 = 0; VAR_7 < VAR_6; VAR_7++) av_free(VAR_12[VAR_7].VAR_4); av_free(VAR_12); return VAR_5; err: av_free(buf2); for (VAR_7 = 0; VAR_7 < VAR_6; VAR_7++) av_free(VAR_12[VAR_7].VAR_4); av_free(VAR_12); return -1; }
[ "static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1,\nint *VAR_2, AVPacket *VAR_3)\n{", "const uint8_t *VAR_4 = VAR_3->VAR_1;", "int VAR_5 = VAR_3->VAR_16, VAR_6 = 0, VAR_7, VAR_8;", "VC1Context *v = VAR_0->priv_data;", "MpegEncContext *s = &v->s;", "AVFrame *pict = VAR_1;", "uint8_t *buf2 = NULL;", "const uint8_t *VAR_9 = VAR_4;", "int VAR_10, VAR_11;", "struct {", "uint8_t *VAR_4;", "GetBitContext gb;", "int mby_start;", "} *VAR_12 = NULL, *VAR_13;", "if (VAR_5 == 0 || (VAR_5 == 4 && AV_RB32(VAR_4) == VC1_CODE_ENDOFSEQ)) {", "if (s->low_delay == 0 && s->next_picture_ptr) {", "if ((VAR_8 = av_frame_ref(pict, s->next_picture_ptr->f)) < 0)\nreturn VAR_8;", "s->next_picture_ptr = NULL;", "*VAR_2 = 1;", "}", "return 0;", "}", "if (VAR_0->codec_id == AV_CODEC_ID_VC1 || VAR_0->codec_id == AV_CODEC_ID_VC1IMAGE) {", "int VAR_14 = 0;", "buf2 = av_mallocz(VAR_5 + FF_INPUT_BUFFER_PADDING_SIZE);", "if (IS_MARKER(AV_RB32(VAR_4))) {", "const uint8_t *VAR_15, *end, *next;", "int VAR_16;", "next = VAR_4;", "for (VAR_15 = VAR_4, end = VAR_4 + VAR_5; next < end; VAR_15 = next) {", "next = find_next_marker(VAR_15 + 4, end);", "VAR_16 = next - VAR_15 - 4;", "if (VAR_16 <= 0) continue;", "switch (AV_RB32(VAR_15)) {", "case VC1_CODE_FRAME:\nif (VAR_0->hwaccel)\nVAR_9 = VAR_15;", "VAR_14 = vc1_unescape_buffer(VAR_15 + 4, VAR_16, buf2);", "break;", "case VC1_CODE_FIELD: {", "int VAR_18;", "VAR_13 = av_realloc(VAR_12, sizeof(*VAR_12) * (VAR_6+1));", "if (!VAR_13)\ngoto err;", "VAR_12 = VAR_13;", "VAR_12[VAR_6].VAR_4 = av_mallocz(VAR_5 + FF_INPUT_BUFFER_PADDING_SIZE);", "if (!VAR_12[VAR_6].VAR_4)\ngoto err;", "VAR_18 = vc1_unescape_buffer(VAR_15 + 4, VAR_16,\nVAR_12[VAR_6].VAR_4);", "init_get_bits(&VAR_12[VAR_6].gb, VAR_12[VAR_6].VAR_4,\nVAR_18 << 3);", "VAR_12[VAR_6].mby_start = s->VAR_10 >> 1;", "VAR_11 = VAR_6 - 1;", "VAR_6++;", "break;", "}", "case VC1_CODE_ENTRYPOINT:\nVAR_14 = vc1_unescape_buffer(VAR_15 + 4, VAR_16, buf2);", "init_get_bits(&s->gb, buf2, VAR_14 * 8);", "ff_vc1_decode_entry_point(VAR_0, v, &s->gb);", "break;", "case VC1_CODE_SLICE: {", "int VAR_18;", "VAR_13 = av_realloc(VAR_12, sizeof(*VAR_12) * (VAR_6+1));", "if (!VAR_13)\ngoto err;", "VAR_12 = VAR_13;", "VAR_12[VAR_6].VAR_4 = av_mallocz(VAR_5 + FF_INPUT_BUFFER_PADDING_SIZE);", "if (!VAR_12[VAR_6].VAR_4)\ngoto err;", "VAR_18 = vc1_unescape_buffer(VAR_15 + 4, VAR_16,\nVAR_12[VAR_6].VAR_4);", "init_get_bits(&VAR_12[VAR_6].gb, VAR_12[VAR_6].VAR_4,\nVAR_18 << 3);", "VAR_12[VAR_6].mby_start = get_bits(&VAR_12[VAR_6].gb, 9);", "VAR_6++;", "break;", "}", "}", "}", "} else if (v->interlace && ((VAR_4[0] & 0xC0) == 0xC0)) {", "const uint8_t *VAR_17;", "int VAR_18;", "VAR_17 = find_next_marker(VAR_4, VAR_4 + VAR_5);", "if ((VAR_17 == (VAR_4 + VAR_5)) || AV_RB32(VAR_17) != VC1_CODE_FIELD) {", "av_log(VAR_0, AV_LOG_ERROR, \"Error in WVC1 interlaced frame\\n\");", "goto err;", "} else {", "VAR_13 = av_realloc(VAR_12, sizeof(*VAR_12) * (VAR_6+1));", "if (!VAR_13)\ngoto err;", "VAR_12 = VAR_13;", "VAR_12[VAR_6].VAR_4 = av_mallocz(VAR_5 + FF_INPUT_BUFFER_PADDING_SIZE);", "if (!VAR_12[VAR_6].VAR_4)\ngoto err;", "VAR_18 = vc1_unescape_buffer(VAR_17 + 4, VAR_4 + VAR_5 - VAR_17 - 4, VAR_12[VAR_6].VAR_4);", "init_get_bits(&VAR_12[VAR_6].gb, VAR_12[VAR_6].VAR_4,\nVAR_18 << 3);", "VAR_12[VAR_6].mby_start = s->VAR_10 >> 1;", "VAR_11 = VAR_6 - 1;", "VAR_6++;", "}", "VAR_14 = vc1_unescape_buffer(VAR_4, VAR_17 - VAR_4, buf2);", "} else {", "VAR_14 = vc1_unescape_buffer(VAR_4, VAR_5, buf2);", "}", "init_get_bits(&s->gb, buf2, VAR_14*8);", "} else", "init_get_bits(&s->gb, VAR_4, VAR_5*8);", "if (v->res_sprite) {", "v->new_sprite = !get_bits1(&s->gb);", "v->two_sprites = get_bits1(&s->gb);", "if (VAR_0->codec_id == AV_CODEC_ID_WMV3IMAGE || VAR_0->codec_id == AV_CODEC_ID_VC1IMAGE) {", "if (v->new_sprite) {", "VAR_0->width = VAR_0->coded_width = v->sprite_width;", "VAR_0->height = VAR_0->coded_height = v->sprite_height;", "} else {", "goto image;", "}", "}", "}", "if (s->context_initialized &&\n(s->width != VAR_0->coded_width ||\ns->height != VAR_0->coded_height)) {", "ff_vc1_decode_end(VAR_0);", "}", "if (!s->context_initialized) {", "if (ff_msmpeg4_decode_init(VAR_0) < 0)\ngoto err;", "if (ff_vc1_decode_init_alloc_tables(v) < 0) {", "ff_mpv_common_end(s);", "goto err;", "}", "s->low_delay = !VAR_0->has_b_frames || v->res_sprite;", "if (v->profile == PROFILE_ADVANCED) {", "s->h_edge_pos = VAR_0->coded_width;", "s->v_edge_pos = VAR_0->coded_height;", "}", "}", "v->pic_header_flag = 0;", "v->first_pic_header_flag = 1;", "if (v->profile < PROFILE_ADVANCED) {", "if (ff_vc1_parse_frame_header(v, &s->gb) < 0) {", "goto err;", "}", "} else {", "if (ff_vc1_parse_frame_header_adv(v, &s->gb) < 0) {", "goto err;", "}", "}", "v->first_pic_header_flag = 0;", "if ((VAR_0->codec_id == AV_CODEC_ID_WMV3IMAGE || VAR_0->codec_id == AV_CODEC_ID_VC1IMAGE)\n&& s->pict_type != AV_PICTURE_TYPE_I) {", "av_log(v->s.VAR_0, AV_LOG_ERROR, \"Sprite decoder: expected I-frame\\n\");", "goto err;", "}", "s->current_picture.f->pict_type = s->pict_type;", "s->current_picture.f->key_frame = s->pict_type == AV_PICTURE_TYPE_I;", "if (s->last_picture_ptr == NULL && (s->pict_type == AV_PICTURE_TYPE_B || s->droppable)) {", "goto end;", "}", "if ((VAR_0->skip_frame >= AVDISCARD_NONREF && s->pict_type == AV_PICTURE_TYPE_B) ||\n(VAR_0->skip_frame >= AVDISCARD_NONKEY && s->pict_type != AV_PICTURE_TYPE_I) ||\nVAR_0->skip_frame >= AVDISCARD_ALL) {", "goto end;", "}", "if (s->next_p_frame_damaged) {", "if (s->pict_type == AV_PICTURE_TYPE_B)\ngoto end;", "else\ns->next_p_frame_damaged = 0;", "}", "if (ff_mpv_frame_start(s, VAR_0) < 0) {", "goto err;", "}", "s->current_picture_ptr->f->repeat_pict = 0;", "if (v->rff) {", "s->current_picture_ptr->f->repeat_pict = 1;", "} else if (v->rptfrm) {", "s->current_picture_ptr->f->repeat_pict = v->rptfrm * 2;", "}", "s->me.qpel_put = s->qdsp.put_qpel_pixels_tab;", "s->me.qpel_avg = s->qdsp.avg_qpel_pixels_tab;", "if (VAR_0->hwaccel) {", "if (VAR_0->hwaccel->start_frame(VAR_0, VAR_4, VAR_5) < 0)\ngoto err;", "if (VAR_0->hwaccel->decode_slice(VAR_0, VAR_9, (VAR_4 + VAR_5) - VAR_9) < 0)\ngoto err;", "if (VAR_0->hwaccel->end_frame(VAR_0) < 0)\ngoto err;", "} else {", "int VAR_19 = 0;", "ff_mpeg_er_frame_start(s);", "v->bits = VAR_5 * 8;", "v->end_mb_x = s->mb_width;", "if (v->field_mode) {", "s->current_picture.f->linesize[0] <<= 1;", "s->current_picture.f->linesize[1] <<= 1;", "s->current_picture.f->linesize[2] <<= 1;", "s->linesize <<= 1;", "s->uvlinesize <<= 1;", "}", "VAR_10 = s->VAR_10 >> v->field_mode;", "if (!VAR_10) {", "av_log(v->s.VAR_0, AV_LOG_ERROR, \"Invalid VAR_10.\\n\");", "goto err;", "}", "for (VAR_7 = 0; VAR_7 <= VAR_6; VAR_7++) {", "if (VAR_7 > 0 && VAR_12[VAR_7 - 1].mby_start >= VAR_10) {", "if (v->field_mode <= 0) {", "av_log(v->s.VAR_0, AV_LOG_ERROR, \"Slice %d starts beyond \"\n\"picture boundary (%d >= %d)\\n\", VAR_7,\nVAR_12[VAR_7 - 1].mby_start, VAR_10);", "continue;", "}", "v->second_field = 1;", "v->blocks_off = s->mb_width * s->VAR_10 << 1;", "v->mb_off = s->mb_stride * s->VAR_10 >> 1;", "} else {", "v->second_field = 0;", "v->blocks_off = 0;", "v->mb_off = 0;", "}", "if (VAR_7) {", "v->pic_header_flag = 0;", "if (v->field_mode && VAR_7 == VAR_11 + 2) {", "if ((VAR_19 = ff_vc1_parse_frame_header_adv(v, &s->gb)) < 0) {", "av_log(v->s.VAR_0, AV_LOG_ERROR, \"Field header damaged\\n\");", "if (VAR_0->err_recognition & AV_EF_EXPLODE)\ngoto err;", "continue;", "}", "} else if (get_bits1(&s->gb)) {", "v->pic_header_flag = 1;", "if ((VAR_19 = ff_vc1_parse_frame_header_adv(v, &s->gb)) < 0) {", "av_log(v->s.VAR_0, AV_LOG_ERROR, \"Slice header damaged\\n\");", "if (VAR_0->err_recognition & AV_EF_EXPLODE)\ngoto err;", "continue;", "}", "}", "}", "if (VAR_19 < 0)\ncontinue;", "s->start_mb_y = (VAR_7 == 0) ? 0 : FFMAX(0, VAR_12[VAR_7-1].mby_start % VAR_10);", "if (!v->field_mode || v->second_field)\ns->end_mb_y = (VAR_7 == VAR_6 ) ? VAR_10 : FFMIN(VAR_10, VAR_12[VAR_7].mby_start % VAR_10);", "else\ns->end_mb_y = (VAR_7 <= VAR_11 + 1) ? VAR_10 : FFMIN(VAR_10, VAR_12[VAR_7].mby_start % VAR_10);", "ff_vc1_decode_blocks(v);", "if (VAR_7 != VAR_6)\ns->gb = VAR_12[VAR_7].gb;", "}", "if (v->field_mode) {", "v->second_field = 0;", "s->current_picture.f->linesize[0] >>= 1;", "s->current_picture.f->linesize[1] >>= 1;", "s->current_picture.f->linesize[2] >>= 1;", "s->linesize >>= 1;", "s->uvlinesize >>= 1;", "if (v->s.pict_type != AV_PICTURE_TYPE_BI && v->s.pict_type != AV_PICTURE_TYPE_B) {", "FFSWAP(uint8_t *, v->mv_f_next[0], v->mv_f[0]);", "FFSWAP(uint8_t *, v->mv_f_next[1], v->mv_f[1]);", "}", "}", "av_dlog(s->VAR_0, \"Consumed %VAR_7/%VAR_7 bits\\n\",\nget_bits_count(&s->gb), s->gb.size_in_bits);", "if (!v->field_mode)\nff_er_frame_end(&s->er);", "}", "ff_mpv_frame_end(s);", "if (VAR_0->codec_id == AV_CODEC_ID_WMV3IMAGE || VAR_0->codec_id == AV_CODEC_ID_VC1IMAGE) {", "image:\nVAR_0->width = VAR_0->coded_width = v->output_width;", "VAR_0->height = VAR_0->coded_height = v->output_height;", "if (VAR_0->skip_frame >= AVDISCARD_NONREF)\ngoto end;", "#if CONFIG_WMV3IMAGE_DECODER || CONFIG_VC1IMAGE_DECODER\nif (vc1_decode_sprites(v, &s->gb))\ngoto err;", "#endif\nif ((VAR_8 = av_frame_ref(pict, v->sprite_output_frame)) < 0)\ngoto err;", "*VAR_2 = 1;", "} else {", "if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) {", "if ((VAR_8 = av_frame_ref(pict, s->current_picture_ptr->f)) < 0)\ngoto err;", "ff_print_debug_info(s, s->current_picture_ptr);", "*VAR_2 = 1;", "} else if (s->last_picture_ptr != NULL) {", "if ((VAR_8 = av_frame_ref(pict, s->last_picture_ptr->f)) < 0)\ngoto err;", "ff_print_debug_info(s, s->last_picture_ptr);", "*VAR_2 = 1;", "}", "}", "end:\nav_free(buf2);", "for (VAR_7 = 0; VAR_7 < VAR_6; VAR_7++)", "av_free(VAR_12[VAR_7].VAR_4);", "av_free(VAR_12);", "return VAR_5;", "err:\nav_free(buf2);", "for (VAR_7 = 0; VAR_7 < VAR_6; VAR_7++)", "av_free(VAR_12[VAR_7].VAR_4);", "av_free(VAR_12);", "return -1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 37 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 65 ], [ 67 ], [ 69 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93, 95, 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109, 111 ], [ 113 ], [ 115 ], [ 117, 119 ], [ 121, 123 ], [ 125, 127 ], [ 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 ], [ 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 ], [ 253 ], [ 255 ], [ 257 ], [ 267 ], [ 269 ], [ 273 ], [ 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 289, 291, 293 ], [ 295 ], [ 297 ], [ 301 ], [ 303, 305 ], [ 307 ], [ 309 ], [ 311 ], [ 313 ], [ 317 ], [ 321 ], [ 323 ], [ 325 ], [ 327 ], [ 329 ], [ 335 ], [ 337 ], [ 339 ], [ 341 ], [ 343 ], [ 345 ], [ 347 ], [ 349 ], [ 351 ], [ 353 ], [ 355 ], [ 357 ], [ 361, 363 ], [ 365 ], [ 367 ], [ 369 ], [ 375 ], [ 377 ], [ 383 ], [ 385 ], [ 387 ], [ 389, 391, 393 ], [ 395 ], [ 397 ], [ 401 ], [ 403, 405 ], [ 407, 409 ], [ 411 ], [ 415 ], [ 417 ], [ 419 ], [ 425 ], [ 431 ], [ 435 ], [ 437 ], [ 441 ], [ 443 ], [ 447 ], [ 449 ], [ 453 ], [ 455, 457 ], [ 459, 461 ], [ 463, 465 ], [ 467 ], [ 469 ], [ 473 ], [ 477 ], [ 479 ], [ 481 ], [ 483 ], [ 485 ], [ 487 ], [ 489 ], [ 491 ], [ 493 ], [ 495 ], [ 499 ], [ 501 ], [ 503 ], [ 505 ], [ 509 ], [ 511 ], [ 513 ], [ 515, 517, 519 ], [ 521 ], [ 523 ], [ 525 ], [ 527 ], [ 529 ], [ 531 ], [ 533 ], [ 535 ], [ 537 ], [ 539 ], [ 541 ], [ 543 ], [ 545 ], [ 547 ], [ 549 ], [ 551, 553 ], [ 555 ], [ 557 ], [ 559 ], [ 561 ], [ 563 ], [ 565 ], [ 567, 569 ], [ 571 ], [ 573 ], [ 575 ], [ 577 ], [ 579, 581 ], [ 583 ], [ 585, 587 ], [ 589, 591 ], [ 593 ], [ 595, 597 ], [ 599 ], [ 601 ], [ 603 ], [ 605 ], [ 607 ], [ 609 ], [ 611 ], [ 613 ], [ 615 ], [ 617 ], [ 619 ], [ 621 ], [ 623 ], [ 625, 627 ], [ 633, 635 ], [ 637 ], [ 641 ], [ 645 ], [ 647, 649 ], [ 651 ], [ 653, 655 ], [ 657, 659, 661 ], [ 663, 665, 667 ], [ 669 ], [ 671 ], [ 673 ], [ 675, 677 ], [ 679 ], [ 681 ], [ 683 ], [ 685, 687 ], [ 689 ], [ 691 ], [ 693 ], [ 695 ], [ 699, 701 ], [ 703 ], [ 705 ], [ 707 ], [ 709 ], [ 713, 715 ], [ 717 ], [ 719 ], [ 721 ], [ 723 ], [ 725 ] ]
11,088
static int flac_write_block_comment(AVIOContext *pb, AVDictionary **m, int last_block, int bitexact) { const char *vendor = bitexact ? "ffmpeg" : LIBAVFORMAT_IDENT; unsigned int len; uint8_t *p, *p0; ff_metadata_conv(m, ff_vorbiscomment_metadata_conv, NULL); len = ff_vorbiscomment_length(*m, vendor); p0 = av_malloc(len+4); if (!p0) return AVERROR(ENOMEM); p = p0; bytestream_put_byte(&p, last_block ? 0x84 : 0x04); bytestream_put_be24(&p, len); ff_vorbiscomment_write(&p, m, vendor); avio_write(pb, p0, len+4); av_freep(&p0); p = NULL; return 0; }
false
FFmpeg
40a7700b82aec0036622f8673ce64e070a520891
static int flac_write_block_comment(AVIOContext *pb, AVDictionary **m, int last_block, int bitexact) { const char *vendor = bitexact ? "ffmpeg" : LIBAVFORMAT_IDENT; unsigned int len; uint8_t *p, *p0; ff_metadata_conv(m, ff_vorbiscomment_metadata_conv, NULL); len = ff_vorbiscomment_length(*m, vendor); p0 = av_malloc(len+4); if (!p0) return AVERROR(ENOMEM); p = p0; bytestream_put_byte(&p, last_block ? 0x84 : 0x04); bytestream_put_be24(&p, len); ff_vorbiscomment_write(&p, m, vendor); avio_write(pb, p0, len+4); av_freep(&p0); p = NULL; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVIOContext *VAR_0, AVDictionary **VAR_1, int VAR_2, int VAR_3) { const char *VAR_4 = VAR_3 ? "ffmpeg" : LIBAVFORMAT_IDENT; unsigned int VAR_5; uint8_t *p, *p0; ff_metadata_conv(VAR_1, ff_vorbiscomment_metadata_conv, NULL); VAR_5 = ff_vorbiscomment_length(*VAR_1, VAR_4); p0 = av_malloc(VAR_5+4); if (!p0) return AVERROR(ENOMEM); p = p0; bytestream_put_byte(&p, VAR_2 ? 0x84 : 0x04); bytestream_put_be24(&p, VAR_5); ff_vorbiscomment_write(&p, VAR_1, VAR_4); avio_write(VAR_0, p0, VAR_5+4); av_freep(&p0); p = NULL; return 0; }
[ "static int FUNC_0(AVIOContext *VAR_0, AVDictionary **VAR_1,\nint VAR_2, int VAR_3)\n{", "const char *VAR_4 = VAR_3 ? \"ffmpeg\" : LIBAVFORMAT_IDENT;", "unsigned int VAR_5;", "uint8_t *p, *p0;", "ff_metadata_conv(VAR_1, ff_vorbiscomment_metadata_conv, NULL);", "VAR_5 = ff_vorbiscomment_length(*VAR_1, VAR_4);", "p0 = av_malloc(VAR_5+4);", "if (!p0)\nreturn AVERROR(ENOMEM);", "p = p0;", "bytestream_put_byte(&p, VAR_2 ? 0x84 : 0x04);", "bytestream_put_be24(&p, VAR_5);", "ff_vorbiscomment_write(&p, VAR_1, VAR_4);", "avio_write(VAR_0, p0, VAR_5+4);", "av_freep(&p0);", "p = NULL;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 19 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ] ]
11,089
static void modified_levinson_durbin(int *window, int window_entries, int *out, int out_entries, int channels, int *tap_quant) { int i; int *state = av_calloc(window_entries, sizeof(*state)); memcpy(state, window, 4* window_entries); for (i = 0; i < out_entries; i++) { int step = (i+1)*channels, k, j; double xx = 0.0, xy = 0.0; #if 1 int *x_ptr = &(window[step]); int *state_ptr = &(state[0]); j = window_entries - step; for (;j>0;j--,x_ptr++,state_ptr++) { double x_value = *x_ptr; double state_value = *state_ptr; xx += state_value*state_value; xy += x_value*state_value; } #else for (j = 0; j <= (window_entries - step); j++); { double stepval = window[step+j]; double stateval = window[j]; // xx += (double)window[j]*(double)window[j]; // xy += (double)window[step+j]*(double)window[j]; xx += stateval*stateval; xy += stepval*stateval; } #endif if (xx == 0.0) k = 0; else k = (int)(floor(-xy/xx * (double)LATTICE_FACTOR / (double)(tap_quant[i]) + 0.5)); if (k > (LATTICE_FACTOR/tap_quant[i])) k = LATTICE_FACTOR/tap_quant[i]; if (-k > (LATTICE_FACTOR/tap_quant[i])) k = -(LATTICE_FACTOR/tap_quant[i]); out[i] = k; k *= tap_quant[i]; #if 1 x_ptr = &(window[step]); state_ptr = &(state[0]); j = window_entries - step; for (;j>0;j--,x_ptr++,state_ptr++) { int x_value = *x_ptr; int state_value = *state_ptr; *x_ptr = x_value + shift_down(k*state_value,LATTICE_SHIFT); *state_ptr = state_value + shift_down(k*x_value, LATTICE_SHIFT); } #else for (j=0; j <= (window_entries - step); j++) { int stepval = window[step+j]; int stateval=state[j]; window[step+j] += shift_down(k * stateval, LATTICE_SHIFT); state[j] += shift_down(k * stepval, LATTICE_SHIFT); } #endif } av_free(state); }
false
FFmpeg
c131a9fead5bf63215b6e1172b3c5c183cf90b85
static void modified_levinson_durbin(int *window, int window_entries, int *out, int out_entries, int channels, int *tap_quant) { int i; int *state = av_calloc(window_entries, sizeof(*state)); memcpy(state, window, 4* window_entries); for (i = 0; i < out_entries; i++) { int step = (i+1)*channels, k, j; double xx = 0.0, xy = 0.0; #if 1 int *x_ptr = &(window[step]); int *state_ptr = &(state[0]); j = window_entries - step; for (;j>0;j--,x_ptr++,state_ptr++) { double x_value = *x_ptr; double state_value = *state_ptr; xx += state_value*state_value; xy += x_value*state_value; } #else for (j = 0; j <= (window_entries - step); j++); { double stepval = window[step+j]; double stateval = window[j]; xx += stateval*stateval; xy += stepval*stateval; } #endif if (xx == 0.0) k = 0; else k = (int)(floor(-xy/xx * (double)LATTICE_FACTOR / (double)(tap_quant[i]) + 0.5)); if (k > (LATTICE_FACTOR/tap_quant[i])) k = LATTICE_FACTOR/tap_quant[i]; if (-k > (LATTICE_FACTOR/tap_quant[i])) k = -(LATTICE_FACTOR/tap_quant[i]); out[i] = k; k *= tap_quant[i]; #if 1 x_ptr = &(window[step]); state_ptr = &(state[0]); j = window_entries - step; for (;j>0;j--,x_ptr++,state_ptr++) { int x_value = *x_ptr; int state_value = *state_ptr; *x_ptr = x_value + shift_down(k*state_value,LATTICE_SHIFT); *state_ptr = state_value + shift_down(k*x_value, LATTICE_SHIFT); } #else for (j=0; j <= (window_entries - step); j++) { int stepval = window[step+j]; int stateval=state[j]; window[step+j] += shift_down(k * stateval, LATTICE_SHIFT); state[j] += shift_down(k * stepval, LATTICE_SHIFT); } #endif } av_free(state); }
{ "code": [], "line_no": [] }
static void FUNC_0(int *VAR_0, int VAR_1, int *VAR_2, int VAR_3, int VAR_4, int *VAR_5) { int VAR_6; int *VAR_7 = av_calloc(VAR_1, sizeof(*VAR_7)); memcpy(VAR_7, VAR_0, 4* VAR_1); for (VAR_6 = 0; VAR_6 < VAR_3; VAR_6++) { int VAR_8 = (VAR_6+1)*VAR_4, VAR_9, VAR_10; double VAR_11 = 0.0, VAR_12 = 0.0; #if 1 int *VAR_13 = &(VAR_0[VAR_8]); int *VAR_14 = &(VAR_7[0]); VAR_10 = VAR_1 - VAR_8; for (;VAR_10>0;VAR_10--,VAR_13++,VAR_14++) { double VAR_17 = *VAR_13; double VAR_17 = *VAR_14; VAR_11 += VAR_17*VAR_17; VAR_12 += VAR_17*VAR_17; } #else for (VAR_10 = 0; VAR_10 <= (VAR_1 - VAR_8); VAR_10++); { double stepval = VAR_0[VAR_8+VAR_10]; double stateval = VAR_0[VAR_10]; VAR_11 += stateval*stateval; VAR_12 += stepval*stateval; } #endif if (VAR_11 == 0.0) VAR_9 = 0; else VAR_9 = (int)(floor(-VAR_12/VAR_11 * (double)LATTICE_FACTOR / (double)(VAR_5[VAR_6]) + 0.5)); if (VAR_9 > (LATTICE_FACTOR/VAR_5[VAR_6])) VAR_9 = LATTICE_FACTOR/VAR_5[VAR_6]; if (-VAR_9 > (LATTICE_FACTOR/VAR_5[VAR_6])) VAR_9 = -(LATTICE_FACTOR/VAR_5[VAR_6]); VAR_2[VAR_6] = VAR_9; VAR_9 *= VAR_5[VAR_6]; #if 1 VAR_13 = &(VAR_0[VAR_8]); VAR_14 = &(VAR_7[0]); VAR_10 = VAR_1 - VAR_8; for (;VAR_10>0;VAR_10--,VAR_13++,VAR_14++) { int VAR_17 = *VAR_13; int VAR_17 = *VAR_14; *VAR_13 = VAR_17 + shift_down(VAR_9*VAR_17,LATTICE_SHIFT); *VAR_14 = VAR_17 + shift_down(VAR_9*VAR_17, LATTICE_SHIFT); } #else for (VAR_10=0; VAR_10 <= (VAR_1 - VAR_8); VAR_10++) { int stepval = VAR_0[VAR_8+VAR_10]; int stateval=VAR_7[VAR_10]; VAR_0[VAR_8+VAR_10] += shift_down(VAR_9 * stateval, LATTICE_SHIFT); VAR_7[VAR_10] += shift_down(VAR_9 * stepval, LATTICE_SHIFT); } #endif } av_free(VAR_7); }
[ "static void FUNC_0(int *VAR_0, int VAR_1,\nint *VAR_2, int VAR_3, int VAR_4, int *VAR_5)\n{", "int VAR_6;", "int *VAR_7 = av_calloc(VAR_1, sizeof(*VAR_7));", "memcpy(VAR_7, VAR_0, 4* VAR_1);", "for (VAR_6 = 0; VAR_6 < VAR_3; VAR_6++)", "{", "int VAR_8 = (VAR_6+1)*VAR_4, VAR_9, VAR_10;", "double VAR_11 = 0.0, VAR_12 = 0.0;", "#if 1\nint *VAR_13 = &(VAR_0[VAR_8]);", "int *VAR_14 = &(VAR_7[0]);", "VAR_10 = VAR_1 - VAR_8;", "for (;VAR_10>0;VAR_10--,VAR_13++,VAR_14++)", "{", "double VAR_17 = *VAR_13;", "double VAR_17 = *VAR_14;", "VAR_11 += VAR_17*VAR_17;", "VAR_12 += VAR_17*VAR_17;", "}", "#else\nfor (VAR_10 = 0; VAR_10 <= (VAR_1 - VAR_8); VAR_10++);", "{", "double stepval = VAR_0[VAR_8+VAR_10];", "double stateval = VAR_0[VAR_10];", "VAR_11 += stateval*stateval;", "VAR_12 += stepval*stateval;", "}", "#endif\nif (VAR_11 == 0.0)\nVAR_9 = 0;", "else\nVAR_9 = (int)(floor(-VAR_12/VAR_11 * (double)LATTICE_FACTOR / (double)(VAR_5[VAR_6]) + 0.5));", "if (VAR_9 > (LATTICE_FACTOR/VAR_5[VAR_6]))\nVAR_9 = LATTICE_FACTOR/VAR_5[VAR_6];", "if (-VAR_9 > (LATTICE_FACTOR/VAR_5[VAR_6]))\nVAR_9 = -(LATTICE_FACTOR/VAR_5[VAR_6]);", "VAR_2[VAR_6] = VAR_9;", "VAR_9 *= VAR_5[VAR_6];", "#if 1\nVAR_13 = &(VAR_0[VAR_8]);", "VAR_14 = &(VAR_7[0]);", "VAR_10 = VAR_1 - VAR_8;", "for (;VAR_10>0;VAR_10--,VAR_13++,VAR_14++)", "{", "int VAR_17 = *VAR_13;", "int VAR_17 = *VAR_14;", "*VAR_13 = VAR_17 + shift_down(VAR_9*VAR_17,LATTICE_SHIFT);", "*VAR_14 = VAR_17 + shift_down(VAR_9*VAR_17, LATTICE_SHIFT);", "}", "#else\nfor (VAR_10=0; VAR_10 <= (VAR_1 - VAR_8); VAR_10++)", "{", "int stepval = VAR_0[VAR_8+VAR_10];", "int stateval=VAR_7[VAR_10];", "VAR_0[VAR_8+VAR_10] += shift_down(VAR_9 * stateval, LATTICE_SHIFT);", "VAR_7[VAR_10] += shift_down(VAR_9 * stepval, LATTICE_SHIFT);", "}", "#endif\n}", "av_free(VAR_7);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47, 49 ], [ 51 ], [ 53 ], [ 55 ], [ 61 ], [ 63 ], [ 65 ], [ 67, 69, 71 ], [ 73, 75 ], [ 79, 81 ], [ 83, 85 ], [ 89 ], [ 91 ], [ 95, 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117, 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133, 135 ], [ 139 ], [ 141 ] ]
11,090
void av_url_split(char *proto, int proto_size, char *authorization, int authorization_size, char *hostname, int hostname_size, int *port_ptr, char *path, int path_size, const char *url) { const char *p, *ls, *ls2, *at, *col, *brk; if (port_ptr) *port_ptr = -1; if (proto_size > 0) proto[0] = 0; if (authorization_size > 0) authorization[0] = 0; if (hostname_size > 0) hostname[0] = 0; if (path_size > 0) path[0] = 0; /* parse protocol */ if ((p = strchr(url, ':'))) { av_strlcpy(proto, url, FFMIN(proto_size, p + 1 - url)); p++; /* skip ':' */ if (*p == '/') p++; if (*p == '/') p++; } else { /* no protocol means plain filename */ av_strlcpy(path, url, path_size); return; } /* separate path from hostname */ ls = strchr(p, '/'); ls2 = strchr(p, '?'); if(!ls) ls = ls2; else if (ls && ls2) ls = FFMIN(ls, ls2); if(ls) av_strlcpy(path, ls, path_size); else ls = &p[strlen(p)]; // XXX /* the rest is hostname, use that to parse auth/port */ if (ls != p) { /* authorization (user[:pass]@hostname) */ if ((at = strchr(p, '@')) && at < ls) { av_strlcpy(authorization, p, FFMIN(authorization_size, at + 1 - p)); p = at + 1; /* skip '@' */ } if (*p == '[' && (brk = strchr(p, ']')) && brk < ls) { /* [host]:port */ av_strlcpy(hostname, p + 1, FFMIN(hostname_size, brk - p)); if (brk[1] == ':' && port_ptr) *port_ptr = atoi(brk + 2); } else if ((col = strchr(p, ':')) && col < ls) { av_strlcpy(hostname, p, FFMIN(col + 1 - p, hostname_size)); if (port_ptr) *port_ptr = atoi(col + 1); } else av_strlcpy(hostname, p, FFMIN(ls + 1 - p, hostname_size)); } }
false
FFmpeg
19660a887677bdf22593cb89753f13db7f525358
void av_url_split(char *proto, int proto_size, char *authorization, int authorization_size, char *hostname, int hostname_size, int *port_ptr, char *path, int path_size, const char *url) { const char *p, *ls, *ls2, *at, *col, *brk; if (port_ptr) *port_ptr = -1; if (proto_size > 0) proto[0] = 0; if (authorization_size > 0) authorization[0] = 0; if (hostname_size > 0) hostname[0] = 0; if (path_size > 0) path[0] = 0; if ((p = strchr(url, ':'))) { av_strlcpy(proto, url, FFMIN(proto_size, p + 1 - url)); p++; if (*p == '/') p++; if (*p == '/') p++; } else { av_strlcpy(path, url, path_size); return; } ls = strchr(p, '/'); ls2 = strchr(p, '?'); if(!ls) ls = ls2; else if (ls && ls2) ls = FFMIN(ls, ls2); if(ls) av_strlcpy(path, ls, path_size); else ls = &p[strlen(p)]; if (ls != p) { if ((at = strchr(p, '@')) && at < ls) { av_strlcpy(authorization, p, FFMIN(authorization_size, at + 1 - p)); p = at + 1; } if (*p == '[' && (brk = strchr(p, ']')) && brk < ls) { av_strlcpy(hostname, p + 1, FFMIN(hostname_size, brk - p)); if (brk[1] == ':' && port_ptr) *port_ptr = atoi(brk + 2); } else if ((col = strchr(p, ':')) && col < ls) { av_strlcpy(hostname, p, FFMIN(col + 1 - p, hostname_size)); if (port_ptr) *port_ptr = atoi(col + 1); } else av_strlcpy(hostname, p, FFMIN(ls + 1 - p, hostname_size)); } }
{ "code": [], "line_no": [] }
void FUNC_0(char *VAR_0, int VAR_1, char *VAR_2, int VAR_3, char *VAR_4, int VAR_5, int *VAR_6, char *VAR_7, int VAR_8, const char *VAR_9) { const char *VAR_10, *VAR_11, *VAR_12, *VAR_13, *VAR_14, *VAR_15; if (VAR_6) *VAR_6 = -1; if (VAR_1 > 0) VAR_0[0] = 0; if (VAR_3 > 0) VAR_2[0] = 0; if (VAR_5 > 0) VAR_4[0] = 0; if (VAR_8 > 0) VAR_7[0] = 0; if ((VAR_10 = strchr(VAR_9, ':'))) { av_strlcpy(VAR_0, VAR_9, FFMIN(VAR_1, VAR_10 + 1 - VAR_9)); VAR_10++; if (*VAR_10 == '/') VAR_10++; if (*VAR_10 == '/') VAR_10++; } else { av_strlcpy(VAR_7, VAR_9, VAR_8); return; } VAR_11 = strchr(VAR_10, '/'); VAR_12 = strchr(VAR_10, '?'); if(!VAR_11) VAR_11 = VAR_12; else if (VAR_11 && VAR_12) VAR_11 = FFMIN(VAR_11, VAR_12); if(VAR_11) av_strlcpy(VAR_7, VAR_11, VAR_8); else VAR_11 = &VAR_10[strlen(VAR_10)]; if (VAR_11 != VAR_10) { if ((VAR_13 = strchr(VAR_10, '@')) && VAR_13 < VAR_11) { av_strlcpy(VAR_2, VAR_10, FFMIN(VAR_3, VAR_13 + 1 - VAR_10)); VAR_10 = VAR_13 + 1; } if (*VAR_10 == '[' && (VAR_15 = strchr(VAR_10, ']')) && VAR_15 < VAR_11) { av_strlcpy(VAR_4, VAR_10 + 1, FFMIN(VAR_5, VAR_15 - VAR_10)); if (VAR_15[1] == ':' && VAR_6) *VAR_6 = atoi(VAR_15 + 2); } else if ((VAR_14 = strchr(VAR_10, ':')) && VAR_14 < VAR_11) { av_strlcpy(VAR_4, VAR_10, FFMIN(VAR_14 + 1 - VAR_10, VAR_5)); if (VAR_6) *VAR_6 = atoi(VAR_14 + 1); } else av_strlcpy(VAR_4, VAR_10, FFMIN(VAR_11 + 1 - VAR_10, VAR_5)); } }
[ "void FUNC_0(char *VAR_0, int VAR_1,\nchar *VAR_2, int VAR_3,\nchar *VAR_4, int VAR_5,\nint *VAR_6,\nchar *VAR_7, int VAR_8,\nconst char *VAR_9)\n{", "const char *VAR_10, *VAR_11, *VAR_12, *VAR_13, *VAR_14, *VAR_15;", "if (VAR_6) *VAR_6 = -1;", "if (VAR_1 > 0) VAR_0[0] = 0;", "if (VAR_3 > 0) VAR_2[0] = 0;", "if (VAR_5 > 0) VAR_4[0] = 0;", "if (VAR_8 > 0) VAR_7[0] = 0;", "if ((VAR_10 = strchr(VAR_9, ':'))) {", "av_strlcpy(VAR_0, VAR_9, FFMIN(VAR_1, VAR_10 + 1 - VAR_9));", "VAR_10++;", "if (*VAR_10 == '/') VAR_10++;", "if (*VAR_10 == '/') VAR_10++;", "} else {", "av_strlcpy(VAR_7, VAR_9, VAR_8);", "return;", "}", "VAR_11 = strchr(VAR_10, '/');", "VAR_12 = strchr(VAR_10, '?');", "if(!VAR_11)\nVAR_11 = VAR_12;", "else if (VAR_11 && VAR_12)\nVAR_11 = FFMIN(VAR_11, VAR_12);", "if(VAR_11)\nav_strlcpy(VAR_7, VAR_11, VAR_8);", "else\nVAR_11 = &VAR_10[strlen(VAR_10)];", "if (VAR_11 != VAR_10) {", "if ((VAR_13 = strchr(VAR_10, '@')) && VAR_13 < VAR_11) {", "av_strlcpy(VAR_2, VAR_10,\nFFMIN(VAR_3, VAR_13 + 1 - VAR_10));", "VAR_10 = VAR_13 + 1;", "}", "if (*VAR_10 == '[' && (VAR_15 = strchr(VAR_10, ']')) && VAR_15 < VAR_11) {", "av_strlcpy(VAR_4, VAR_10 + 1,\nFFMIN(VAR_5, VAR_15 - VAR_10));", "if (VAR_15[1] == ':' && VAR_6)\n*VAR_6 = atoi(VAR_15 + 2);", "} else if ((VAR_14 = strchr(VAR_10, ':')) && VAR_14 < VAR_11) {", "av_strlcpy(VAR_4, VAR_10,\nFFMIN(VAR_14 + 1 - VAR_10, VAR_5));", "if (VAR_6) *VAR_6 = atoi(VAR_14 + 1);", "} else", "av_strlcpy(VAR_4, VAR_10,\nFFMIN(VAR_11 + 1 - VAR_10, 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 ]
[ [ 1, 3, 5, 7, 9, 11, 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 57 ], [ 59 ], [ 61, 63 ], [ 65, 67 ], [ 69, 71 ], [ 73, 75 ], [ 81 ], [ 85 ], [ 87, 89 ], [ 91 ], [ 93 ], [ 97 ], [ 101, 103 ], [ 105, 107 ], [ 109 ], [ 111, 113 ], [ 115 ], [ 117 ], [ 119, 121 ], [ 123 ], [ 125 ] ]
11,091
static void ohci_bus_stop(OHCIState *ohci) { trace_usb_ohci_stop(ohci->name); if (ohci->eof_timer) { timer_del(ohci->eof_timer); timer_free(ohci->eof_timer); } ohci->eof_timer = NULL; }
true
qemu
fa1298c2d623522eda7b4f1f721fcb935abb7360
static void ohci_bus_stop(OHCIState *ohci) { trace_usb_ohci_stop(ohci->name); if (ohci->eof_timer) { timer_del(ohci->eof_timer); timer_free(ohci->eof_timer); } ohci->eof_timer = NULL; }
{ "code": [ " if (ohci->eof_timer) {", " timer_del(ohci->eof_timer);", " timer_free(ohci->eof_timer);", " ohci->eof_timer = NULL;" ], "line_no": [ 7, 9, 11, 15 ] }
static void FUNC_0(OHCIState *VAR_0) { trace_usb_ohci_stop(VAR_0->name); if (VAR_0->eof_timer) { timer_del(VAR_0->eof_timer); timer_free(VAR_0->eof_timer); } VAR_0->eof_timer = NULL; }
[ "static void FUNC_0(OHCIState *VAR_0)\n{", "trace_usb_ohci_stop(VAR_0->name);", "if (VAR_0->eof_timer) {", "timer_del(VAR_0->eof_timer);", "timer_free(VAR_0->eof_timer);", "}", "VAR_0->eof_timer = NULL;", "}" ]
[ 0, 0, 1, 1, 1, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ] ]
11,092
static int avisynth_read_header(AVFormatContext *s) { AVISynthContext *avs = s->priv_data; HRESULT res; AVIFILEINFO info; DWORD id; AVStream *st; AVISynthStream *stream; wchar_t filename_wchar[1024] = { 0 }; char filename_char[1024] = { 0 }; AVIFileInit(); /* avisynth can't accept UTF-8 filename */ MultiByteToWideChar(CP_UTF8, 0, s->filename, -1, filename_wchar, 1024); WideCharToMultiByte(CP_THREAD_ACP, 0, filename_wchar, -1, filename_char, 1024, NULL, NULL); res = AVIFileOpen(&avs->file, filename_char, OF_READ|OF_SHARE_DENY_WRITE, NULL); if (res != S_OK) { av_log(s, AV_LOG_ERROR, "AVIFileOpen failed with error %ld", res); AVIFileExit(); return -1; } res = AVIFileInfo(avs->file, &info, sizeof(info)); if (res != S_OK) { av_log(s, AV_LOG_ERROR, "AVIFileInfo failed with error %ld", res); AVIFileExit(); return -1; } avs->streams = av_mallocz(info.dwStreams * sizeof(AVISynthStream)); for (id=0; id<info.dwStreams; id++) { stream = &avs->streams[id]; stream->read = 0; if (AVIFileGetStream(avs->file, &stream->handle, 0, id) == S_OK) { if (AVIStreamInfo(stream->handle, &stream->info, sizeof(stream->info)) == S_OK) { if (stream->info.fccType == streamtypeAUDIO) { WAVEFORMATEX wvfmt; LONG struct_size = sizeof(WAVEFORMATEX); if (AVIStreamReadFormat(stream->handle, 0, &wvfmt, &struct_size) != S_OK) continue; st = avformat_new_stream(s, NULL); st->id = id; st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->block_align = wvfmt.nBlockAlign; st->codec->channels = wvfmt.nChannels; st->codec->sample_rate = wvfmt.nSamplesPerSec; st->codec->bit_rate = wvfmt.nAvgBytesPerSec * 8; st->codec->bits_per_coded_sample = wvfmt.wBitsPerSample; stream->chunck_samples = wvfmt.nSamplesPerSec * (uint64_t)info.dwScale / (uint64_t)info.dwRate; stream->chunck_size = stream->chunck_samples * wvfmt.nChannels * wvfmt.wBitsPerSample / 8; st->codec->codec_tag = wvfmt.wFormatTag; st->codec->codec_id = ff_wav_codec_get_id(wvfmt.wFormatTag, st->codec->bits_per_coded_sample); } else if (stream->info.fccType == streamtypeVIDEO) { BITMAPINFO imgfmt; LONG struct_size = sizeof(BITMAPINFO); stream->chunck_size = stream->info.dwSampleSize; stream->chunck_samples = 1; if (AVIStreamReadFormat(stream->handle, 0, &imgfmt, &struct_size) != S_OK) continue; st = avformat_new_stream(s, NULL); st->id = id; st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->r_frame_rate.num = stream->info.dwRate; st->r_frame_rate.den = stream->info.dwScale; st->codec->width = imgfmt.bmiHeader.biWidth; st->codec->height = imgfmt.bmiHeader.biHeight; st->codec->bits_per_coded_sample = imgfmt.bmiHeader.biBitCount; st->codec->bit_rate = (uint64_t)stream->info.dwSampleSize * (uint64_t)stream->info.dwRate * 8 / (uint64_t)stream->info.dwScale; st->codec->codec_tag = imgfmt.bmiHeader.biCompression; st->codec->codec_id = ff_codec_get_id(ff_codec_bmp_tags, imgfmt.bmiHeader.biCompression); st->duration = stream->info.dwLength; } else { AVIStreamRelease(stream->handle); continue; } avs->nb_streams++; st->codec->stream_codec_tag = stream->info.fccHandler; avpriv_set_pts_info(st, 64, info.dwScale, info.dwRate); st->start_time = stream->info.dwStart; } } } return 0; }
true
FFmpeg
aba232cfa9b193604ed98f3fa505378d006b1b3b
static int avisynth_read_header(AVFormatContext *s) { AVISynthContext *avs = s->priv_data; HRESULT res; AVIFILEINFO info; DWORD id; AVStream *st; AVISynthStream *stream; wchar_t filename_wchar[1024] = { 0 }; char filename_char[1024] = { 0 }; AVIFileInit(); MultiByteToWideChar(CP_UTF8, 0, s->filename, -1, filename_wchar, 1024); WideCharToMultiByte(CP_THREAD_ACP, 0, filename_wchar, -1, filename_char, 1024, NULL, NULL); res = AVIFileOpen(&avs->file, filename_char, OF_READ|OF_SHARE_DENY_WRITE, NULL); if (res != S_OK) { av_log(s, AV_LOG_ERROR, "AVIFileOpen failed with error %ld", res); AVIFileExit(); return -1; } res = AVIFileInfo(avs->file, &info, sizeof(info)); if (res != S_OK) { av_log(s, AV_LOG_ERROR, "AVIFileInfo failed with error %ld", res); AVIFileExit(); return -1; } avs->streams = av_mallocz(info.dwStreams * sizeof(AVISynthStream)); for (id=0; id<info.dwStreams; id++) { stream = &avs->streams[id]; stream->read = 0; if (AVIFileGetStream(avs->file, &stream->handle, 0, id) == S_OK) { if (AVIStreamInfo(stream->handle, &stream->info, sizeof(stream->info)) == S_OK) { if (stream->info.fccType == streamtypeAUDIO) { WAVEFORMATEX wvfmt; LONG struct_size = sizeof(WAVEFORMATEX); if (AVIStreamReadFormat(stream->handle, 0, &wvfmt, &struct_size) != S_OK) continue; st = avformat_new_stream(s, NULL); st->id = id; st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->block_align = wvfmt.nBlockAlign; st->codec->channels = wvfmt.nChannels; st->codec->sample_rate = wvfmt.nSamplesPerSec; st->codec->bit_rate = wvfmt.nAvgBytesPerSec * 8; st->codec->bits_per_coded_sample = wvfmt.wBitsPerSample; stream->chunck_samples = wvfmt.nSamplesPerSec * (uint64_t)info.dwScale / (uint64_t)info.dwRate; stream->chunck_size = stream->chunck_samples * wvfmt.nChannels * wvfmt.wBitsPerSample / 8; st->codec->codec_tag = wvfmt.wFormatTag; st->codec->codec_id = ff_wav_codec_get_id(wvfmt.wFormatTag, st->codec->bits_per_coded_sample); } else if (stream->info.fccType == streamtypeVIDEO) { BITMAPINFO imgfmt; LONG struct_size = sizeof(BITMAPINFO); stream->chunck_size = stream->info.dwSampleSize; stream->chunck_samples = 1; if (AVIStreamReadFormat(stream->handle, 0, &imgfmt, &struct_size) != S_OK) continue; st = avformat_new_stream(s, NULL); st->id = id; st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->r_frame_rate.num = stream->info.dwRate; st->r_frame_rate.den = stream->info.dwScale; st->codec->width = imgfmt.bmiHeader.biWidth; st->codec->height = imgfmt.bmiHeader.biHeight; st->codec->bits_per_coded_sample = imgfmt.bmiHeader.biBitCount; st->codec->bit_rate = (uint64_t)stream->info.dwSampleSize * (uint64_t)stream->info.dwRate * 8 / (uint64_t)stream->info.dwScale; st->codec->codec_tag = imgfmt.bmiHeader.biCompression; st->codec->codec_id = ff_codec_get_id(ff_codec_bmp_tags, imgfmt.bmiHeader.biCompression); st->duration = stream->info.dwLength; } else { AVIStreamRelease(stream->handle); continue; } avs->nb_streams++; st->codec->stream_codec_tag = stream->info.fccHandler; avpriv_set_pts_info(st, 64, info.dwScale, info.dwRate); st->start_time = stream->info.dwStart; } } } return 0; }
{ "code": [ " st->r_frame_rate.num = stream->info.dwRate;", " st->r_frame_rate.den = stream->info.dwScale;" ], "line_no": [ 159, 161 ] }
static int FUNC_0(AVFormatContext *VAR_0) { AVISynthContext *avs = VAR_0->priv_data; HRESULT res; AVIFILEINFO info; DWORD id; AVStream *st; AVISynthStream *stream; wchar_t filename_wchar[1024] = { 0 }; char VAR_1[1024] = { 0 }; AVIFileInit(); MultiByteToWideChar(CP_UTF8, 0, VAR_0->filename, -1, filename_wchar, 1024); WideCharToMultiByte(CP_THREAD_ACP, 0, filename_wchar, -1, VAR_1, 1024, NULL, NULL); res = AVIFileOpen(&avs->file, VAR_1, OF_READ|OF_SHARE_DENY_WRITE, NULL); if (res != S_OK) { av_log(VAR_0, AV_LOG_ERROR, "AVIFileOpen failed with error %ld", res); AVIFileExit(); return -1; } res = AVIFileInfo(avs->file, &info, sizeof(info)); if (res != S_OK) { av_log(VAR_0, AV_LOG_ERROR, "AVIFileInfo failed with error %ld", res); AVIFileExit(); return -1; } avs->streams = av_mallocz(info.dwStreams * sizeof(AVISynthStream)); for (id=0; id<info.dwStreams; id++) { stream = &avs->streams[id]; stream->read = 0; if (AVIFileGetStream(avs->file, &stream->handle, 0, id) == S_OK) { if (AVIStreamInfo(stream->handle, &stream->info, sizeof(stream->info)) == S_OK) { if (stream->info.fccType == streamtypeAUDIO) { WAVEFORMATEX wvfmt; LONG struct_size = sizeof(WAVEFORMATEX); if (AVIStreamReadFormat(stream->handle, 0, &wvfmt, &struct_size) != S_OK) continue; st = avformat_new_stream(VAR_0, NULL); st->id = id; st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->block_align = wvfmt.nBlockAlign; st->codec->channels = wvfmt.nChannels; st->codec->sample_rate = wvfmt.nSamplesPerSec; st->codec->bit_rate = wvfmt.nAvgBytesPerSec * 8; st->codec->bits_per_coded_sample = wvfmt.wBitsPerSample; stream->chunck_samples = wvfmt.nSamplesPerSec * (uint64_t)info.dwScale / (uint64_t)info.dwRate; stream->chunck_size = stream->chunck_samples * wvfmt.nChannels * wvfmt.wBitsPerSample / 8; st->codec->codec_tag = wvfmt.wFormatTag; st->codec->codec_id = ff_wav_codec_get_id(wvfmt.wFormatTag, st->codec->bits_per_coded_sample); } else if (stream->info.fccType == streamtypeVIDEO) { BITMAPINFO imgfmt; LONG struct_size = sizeof(BITMAPINFO); stream->chunck_size = stream->info.dwSampleSize; stream->chunck_samples = 1; if (AVIStreamReadFormat(stream->handle, 0, &imgfmt, &struct_size) != S_OK) continue; st = avformat_new_stream(VAR_0, NULL); st->id = id; st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->r_frame_rate.num = stream->info.dwRate; st->r_frame_rate.den = stream->info.dwScale; st->codec->width = imgfmt.bmiHeader.biWidth; st->codec->height = imgfmt.bmiHeader.biHeight; st->codec->bits_per_coded_sample = imgfmt.bmiHeader.biBitCount; st->codec->bit_rate = (uint64_t)stream->info.dwSampleSize * (uint64_t)stream->info.dwRate * 8 / (uint64_t)stream->info.dwScale; st->codec->codec_tag = imgfmt.bmiHeader.biCompression; st->codec->codec_id = ff_codec_get_id(ff_codec_bmp_tags, imgfmt.bmiHeader.biCompression); st->duration = stream->info.dwLength; } else { AVIStreamRelease(stream->handle); continue; } avs->nb_streams++; st->codec->stream_codec_tag = stream->info.fccHandler; avpriv_set_pts_info(st, 64, info.dwScale, info.dwRate); st->start_time = stream->info.dwStart; } } } return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0)\n{", "AVISynthContext *avs = VAR_0->priv_data;", "HRESULT res;", "AVIFILEINFO info;", "DWORD id;", "AVStream *st;", "AVISynthStream *stream;", "wchar_t filename_wchar[1024] = { 0 };", "char VAR_1[1024] = { 0 };", "AVIFileInit();", "MultiByteToWideChar(CP_UTF8, 0, VAR_0->filename, -1, filename_wchar, 1024);", "WideCharToMultiByte(CP_THREAD_ACP, 0, filename_wchar, -1, VAR_1, 1024, NULL, NULL);", "res = AVIFileOpen(&avs->file, VAR_1, OF_READ|OF_SHARE_DENY_WRITE, NULL);", "if (res != S_OK)\n{", "av_log(VAR_0, AV_LOG_ERROR, \"AVIFileOpen failed with error %ld\", res);", "AVIFileExit();", "return -1;", "}", "res = AVIFileInfo(avs->file, &info, sizeof(info));", "if (res != S_OK)\n{", "av_log(VAR_0, AV_LOG_ERROR, \"AVIFileInfo failed with error %ld\", res);", "AVIFileExit();", "return -1;", "}", "avs->streams = av_mallocz(info.dwStreams * sizeof(AVISynthStream));", "for (id=0; id<info.dwStreams; id++)", "{", "stream = &avs->streams[id];", "stream->read = 0;", "if (AVIFileGetStream(avs->file, &stream->handle, 0, id) == S_OK)\n{", "if (AVIStreamInfo(stream->handle, &stream->info, sizeof(stream->info)) == S_OK)\n{", "if (stream->info.fccType == streamtypeAUDIO)\n{", "WAVEFORMATEX wvfmt;", "LONG struct_size = sizeof(WAVEFORMATEX);", "if (AVIStreamReadFormat(stream->handle, 0, &wvfmt, &struct_size) != S_OK)\ncontinue;", "st = avformat_new_stream(VAR_0, NULL);", "st->id = id;", "st->codec->codec_type = AVMEDIA_TYPE_AUDIO;", "st->codec->block_align = wvfmt.nBlockAlign;", "st->codec->channels = wvfmt.nChannels;", "st->codec->sample_rate = wvfmt.nSamplesPerSec;", "st->codec->bit_rate = wvfmt.nAvgBytesPerSec * 8;", "st->codec->bits_per_coded_sample = wvfmt.wBitsPerSample;", "stream->chunck_samples = wvfmt.nSamplesPerSec * (uint64_t)info.dwScale / (uint64_t)info.dwRate;", "stream->chunck_size = stream->chunck_samples * wvfmt.nChannels * wvfmt.wBitsPerSample / 8;", "st->codec->codec_tag = wvfmt.wFormatTag;", "st->codec->codec_id = ff_wav_codec_get_id(wvfmt.wFormatTag, st->codec->bits_per_coded_sample);", "}", "else if (stream->info.fccType == streamtypeVIDEO)\n{", "BITMAPINFO imgfmt;", "LONG struct_size = sizeof(BITMAPINFO);", "stream->chunck_size = stream->info.dwSampleSize;", "stream->chunck_samples = 1;", "if (AVIStreamReadFormat(stream->handle, 0, &imgfmt, &struct_size) != S_OK)\ncontinue;", "st = avformat_new_stream(VAR_0, NULL);", "st->id = id;", "st->codec->codec_type = AVMEDIA_TYPE_VIDEO;", "st->r_frame_rate.num = stream->info.dwRate;", "st->r_frame_rate.den = stream->info.dwScale;", "st->codec->width = imgfmt.bmiHeader.biWidth;", "st->codec->height = imgfmt.bmiHeader.biHeight;", "st->codec->bits_per_coded_sample = imgfmt.bmiHeader.biBitCount;", "st->codec->bit_rate = (uint64_t)stream->info.dwSampleSize * (uint64_t)stream->info.dwRate * 8 / (uint64_t)stream->info.dwScale;", "st->codec->codec_tag = imgfmt.bmiHeader.biCompression;", "st->codec->codec_id = ff_codec_get_id(ff_codec_bmp_tags, imgfmt.bmiHeader.biCompression);", "st->duration = stream->info.dwLength;", "}", "else\n{", "AVIStreamRelease(stream->handle);", "continue;", "}", "avs->nb_streams++;", "st->codec->stream_codec_tag = stream->info.fccHandler;", "avpriv_set_pts_info(st, 64, info.dwScale, info.dwRate);", "st->start_time = stream->info.dwStart;", "}", "}", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 29 ], [ 31 ], [ 33 ], [ 35, 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51, 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77, 79 ], [ 81, 83 ], [ 85, 87 ], [ 89 ], [ 91 ], [ 93, 95 ], [ 99 ], [ 101 ], [ 103 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 119 ], [ 121 ], [ 125 ], [ 127 ], [ 129 ], [ 131, 133 ], [ 135 ], [ 137 ], [ 141 ], [ 143 ], [ 147, 149 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 165 ], [ 167 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 181 ], [ 183 ], [ 185, 187 ], [ 189 ], [ 191 ], [ 193 ], [ 197 ], [ 201 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 217 ], [ 219 ] ]
11,093
void ioinst_handle_rsch(S390CPU *cpu, uint64_t reg1) { int cssid, ssid, schid, m; SubchDev *sch; int ret = -ENODEV; int cc; if (ioinst_disassemble_sch_ident(reg1, &m, &cssid, &ssid, &schid)) { program_interrupt(&cpu->env, PGM_OPERAND, 4); return; } trace_ioinst_sch_id("rsch", cssid, ssid, schid); sch = css_find_subch(m, cssid, ssid, schid); if (sch && css_subch_visible(sch)) { ret = css_do_rsch(sch); } switch (ret) { case -ENODEV: cc = 3; break; case -EINVAL: cc = 2; break; case 0: cc = 0; break; default: cc = 1; break; } setcc(cpu, cc); }
true
qemu
66dc50f7057b9a0191f54e55764412202306858d
void ioinst_handle_rsch(S390CPU *cpu, uint64_t reg1) { int cssid, ssid, schid, m; SubchDev *sch; int ret = -ENODEV; int cc; if (ioinst_disassemble_sch_ident(reg1, &m, &cssid, &ssid, &schid)) { program_interrupt(&cpu->env, PGM_OPERAND, 4); return; } trace_ioinst_sch_id("rsch", cssid, ssid, schid); sch = css_find_subch(m, cssid, ssid, schid); if (sch && css_subch_visible(sch)) { ret = css_do_rsch(sch); } switch (ret) { case -ENODEV: cc = 3; break; case -EINVAL: cc = 2; break; case 0: cc = 0; break; default: cc = 1; break; } setcc(cpu, cc); }
{ "code": [ " switch (ret) {", " case 0:", " break;", " break;", " case -ENODEV:", " break;", " break;", " default:", " int ret = -ENODEV;", " int cc;", " if (sch && css_subch_visible(sch)) {", " switch (ret) {", " case -ENODEV:", " cc = 3;", " break;", " cc = 2;", " break;", " case 0:", " cc = 0;", " break;", " default:", " cc = 1;", " break;", " setcc(cpu, cc);", " int ret = -ENODEV;", " int cc;", " if (sch && css_subch_visible(sch)) {", " ret = css_do_rsch(sch);", " switch (ret) {", " case -ENODEV:", " cc = 3;", " break;", " case -EINVAL:", " cc = 2;", " break;", " case 0:", " cc = 0;", " break;", " default:", " cc = 1;", " break;", " setcc(cpu, cc);" ], "line_no": [ 33, 47, 39, 39, 35, 39, 39, 53, 9, 11, 27, 33, 35, 37, 39, 43, 39, 47, 49, 39, 53, 55, 39, 61, 9, 11, 27, 29, 33, 35, 37, 39, 41, 43, 39, 47, 49, 39, 53, 55, 39, 61 ] }
void FUNC_0(S390CPU *VAR_0, uint64_t VAR_1) { int VAR_2, VAR_3, VAR_4, VAR_5; SubchDev *sch; int VAR_6 = -ENODEV; int VAR_7; if (ioinst_disassemble_sch_ident(VAR_1, &VAR_5, &VAR_2, &VAR_3, &VAR_4)) { program_interrupt(&VAR_0->env, PGM_OPERAND, 4); return; } trace_ioinst_sch_id("rsch", VAR_2, VAR_3, VAR_4); sch = css_find_subch(VAR_5, VAR_2, VAR_3, VAR_4); if (sch && css_subch_visible(sch)) { VAR_6 = css_do_rsch(sch); } switch (VAR_6) { case -ENODEV: VAR_7 = 3; break; case -EINVAL: VAR_7 = 2; break; case 0: VAR_7 = 0; break; default: VAR_7 = 1; break; } setcc(VAR_0, VAR_7); }
[ "void FUNC_0(S390CPU *VAR_0, uint64_t VAR_1)\n{", "int VAR_2, VAR_3, VAR_4, VAR_5;", "SubchDev *sch;", "int VAR_6 = -ENODEV;", "int VAR_7;", "if (ioinst_disassemble_sch_ident(VAR_1, &VAR_5, &VAR_2, &VAR_3, &VAR_4)) {", "program_interrupt(&VAR_0->env, PGM_OPERAND, 4);", "return;", "}", "trace_ioinst_sch_id(\"rsch\", VAR_2, VAR_3, VAR_4);", "sch = css_find_subch(VAR_5, VAR_2, VAR_3, VAR_4);", "if (sch && css_subch_visible(sch)) {", "VAR_6 = css_do_rsch(sch);", "}", "switch (VAR_6) {", "case -ENODEV:\nVAR_7 = 3;", "break;", "case -EINVAL:\nVAR_7 = 2;", "break;", "case 0:\nVAR_7 = 0;", "break;", "default:\nVAR_7 = 1;", "break;", "}", "setcc(VAR_0, VAR_7);", "}" ]
[ 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1, 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 ] ]
11,094
static int commit_one_file(BDRVVVFATState* s, int dir_index, uint32_t offset) { direntry_t* direntry = array_get(&(s->directory), dir_index); uint32_t c = begin_of_direntry(direntry); uint32_t first_cluster = c; mapping_t* mapping = find_mapping_for_cluster(s, c); uint32_t size = filesize_of_direntry(direntry); char* cluster = g_malloc(s->cluster_size); uint32_t i; int fd = 0; assert(offset < size); assert((offset % s->cluster_size) == 0); for (i = s->cluster_size; i < offset; i += s->cluster_size) c = modified_fat_get(s, c); fd = open(mapping->path, O_RDWR | O_CREAT | O_BINARY, 0666); if (fd < 0) { fprintf(stderr, "Could not open %s... (%s, %d)\n", mapping->path, strerror(errno), errno); return fd; } if (offset > 0) if (lseek(fd, offset, SEEK_SET) != offset) return -3; while (offset < size) { uint32_t c1; int rest_size = (size - offset > s->cluster_size ? s->cluster_size : size - offset); int ret; c1 = modified_fat_get(s, c); assert((size - offset == 0 && fat_eof(s, c)) || (size > offset && c >=2 && !fat_eof(s, c))); ret = vvfat_read(s->bs, cluster2sector(s, c), (uint8_t*)cluster, (rest_size + 0x1ff) / 0x200); if (ret < 0) return ret; if (write(fd, cluster, rest_size) < 0) return -2; offset += rest_size; c = c1; } if (ftruncate(fd, size)) { perror("ftruncate()"); close(fd); return -4; } close(fd); return commit_mappings(s, first_cluster, dir_index); }
true
qemu
ce137829e7e58fcdc5ba63b5e256f972e80be438
static int commit_one_file(BDRVVVFATState* s, int dir_index, uint32_t offset) { direntry_t* direntry = array_get(&(s->directory), dir_index); uint32_t c = begin_of_direntry(direntry); uint32_t first_cluster = c; mapping_t* mapping = find_mapping_for_cluster(s, c); uint32_t size = filesize_of_direntry(direntry); char* cluster = g_malloc(s->cluster_size); uint32_t i; int fd = 0; assert(offset < size); assert((offset % s->cluster_size) == 0); for (i = s->cluster_size; i < offset; i += s->cluster_size) c = modified_fat_get(s, c); fd = open(mapping->path, O_RDWR | O_CREAT | O_BINARY, 0666); if (fd < 0) { fprintf(stderr, "Could not open %s... (%s, %d)\n", mapping->path, strerror(errno), errno); return fd; } if (offset > 0) if (lseek(fd, offset, SEEK_SET) != offset) return -3; while (offset < size) { uint32_t c1; int rest_size = (size - offset > s->cluster_size ? s->cluster_size : size - offset); int ret; c1 = modified_fat_get(s, c); assert((size - offset == 0 && fat_eof(s, c)) || (size > offset && c >=2 && !fat_eof(s, c))); ret = vvfat_read(s->bs, cluster2sector(s, c), (uint8_t*)cluster, (rest_size + 0x1ff) / 0x200); if (ret < 0) return ret; if (write(fd, cluster, rest_size) < 0) return -2; offset += rest_size; c = c1; } if (ftruncate(fd, size)) { perror("ftruncate()"); close(fd); return -4; } close(fd); return commit_mappings(s, first_cluster, dir_index); }
{ "code": [ " if (offset > 0)", "\tif (lseek(fd, offset, SEEK_SET) != offset)", "\t return -3;", "\tif (ret < 0)", "\t return ret;", "\tif (write(fd, cluster, rest_size) < 0)", "\t return -2;" ], "line_no": [ 49, 51, 53, 85, 87, 91, 93 ] }
static int FUNC_0(BDRVVVFATState* VAR_0, int VAR_1, uint32_t VAR_2) { direntry_t* direntry = array_get(&(VAR_0->directory), VAR_1); uint32_t c = begin_of_direntry(direntry); uint32_t first_cluster = c; mapping_t* mapping = find_mapping_for_cluster(VAR_0, c); uint32_t size = filesize_of_direntry(direntry); char* VAR_3 = g_malloc(VAR_0->cluster_size); uint32_t i; int VAR_4 = 0; assert(VAR_2 < size); assert((VAR_2 % VAR_0->cluster_size) == 0); for (i = VAR_0->cluster_size; i < VAR_2; i += VAR_0->cluster_size) c = modified_fat_get(VAR_0, c); VAR_4 = open(mapping->path, O_RDWR | O_CREAT | O_BINARY, 0666); if (VAR_4 < 0) { fprintf(stderr, "Could not open %VAR_0... (%VAR_0, %d)\n", mapping->path, strerror(errno), errno); return VAR_4; } if (VAR_2 > 0) if (lseek(VAR_4, VAR_2, SEEK_SET) != VAR_2) return -3; while (VAR_2 < size) { uint32_t c1; int VAR_5 = (size - VAR_2 > VAR_0->cluster_size ? VAR_0->cluster_size : size - VAR_2); int VAR_6; c1 = modified_fat_get(VAR_0, c); assert((size - VAR_2 == 0 && fat_eof(VAR_0, c)) || (size > VAR_2 && c >=2 && !fat_eof(VAR_0, c))); VAR_6 = vvfat_read(VAR_0->bs, cluster2sector(VAR_0, c), (uint8_t*)VAR_3, (VAR_5 + 0x1ff) / 0x200); if (VAR_6 < 0) return VAR_6; if (write(VAR_4, VAR_3, VAR_5) < 0) return -2; VAR_2 += VAR_5; c = c1; } if (ftruncate(VAR_4, size)) { perror("ftruncate()"); close(VAR_4); return -4; } close(VAR_4); return commit_mappings(VAR_0, first_cluster, VAR_1); }
[ "static int FUNC_0(BDRVVVFATState* VAR_0,\nint VAR_1, uint32_t VAR_2)\n{", "direntry_t* direntry = array_get(&(VAR_0->directory), VAR_1);", "uint32_t c = begin_of_direntry(direntry);", "uint32_t first_cluster = c;", "mapping_t* mapping = find_mapping_for_cluster(VAR_0, c);", "uint32_t size = filesize_of_direntry(direntry);", "char* VAR_3 = g_malloc(VAR_0->cluster_size);", "uint32_t i;", "int VAR_4 = 0;", "assert(VAR_2 < size);", "assert((VAR_2 % VAR_0->cluster_size) == 0);", "for (i = VAR_0->cluster_size; i < VAR_2; i += VAR_0->cluster_size)", "c = modified_fat_get(VAR_0, c);", "VAR_4 = open(mapping->path, O_RDWR | O_CREAT | O_BINARY, 0666);", "if (VAR_4 < 0) {", "fprintf(stderr, \"Could not open %VAR_0... (%VAR_0, %d)\\n\", mapping->path,\nstrerror(errno), errno);", "return VAR_4;", "}", "if (VAR_2 > 0)\nif (lseek(VAR_4, VAR_2, SEEK_SET) != VAR_2)\nreturn -3;", "while (VAR_2 < size) {", "uint32_t c1;", "int VAR_5 = (size - VAR_2 > VAR_0->cluster_size ?\nVAR_0->cluster_size : size - VAR_2);", "int VAR_6;", "c1 = modified_fat_get(VAR_0, c);", "assert((size - VAR_2 == 0 && fat_eof(VAR_0, c)) ||\n(size > VAR_2 && c >=2 && !fat_eof(VAR_0, c)));", "VAR_6 = vvfat_read(VAR_0->bs, cluster2sector(VAR_0, c),\n(uint8_t*)VAR_3, (VAR_5 + 0x1ff) / 0x200);", "if (VAR_6 < 0)\nreturn VAR_6;", "if (write(VAR_4, VAR_3, VAR_5) < 0)\nreturn -2;", "VAR_2 += VAR_5;", "c = c1;", "}", "if (ftruncate(VAR_4, size)) {", "perror(\"ftruncate()\");", "close(VAR_4);", "return -4;", "}", "close(VAR_4);", "return commit_mappings(VAR_0, first_cluster, VAR_1);", "}" ]
[ 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, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41, 43 ], [ 45 ], [ 47 ], [ 49, 51, 53 ], [ 57 ], [ 59 ], [ 61, 63 ], [ 65 ], [ 69 ], [ 73, 75 ], [ 79, 81 ], [ 85, 87 ], [ 91, 93 ], [ 97 ], [ 99 ], [ 101 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 119 ], [ 121 ] ]
11,096
static int vhost_user_read(struct vhost_dev *dev, VhostUserMsg *msg) { CharDriverState *chr = dev->opaque; uint8_t *p = (uint8_t *) msg; int r, size = VHOST_USER_HDR_SIZE; r = qemu_chr_fe_read_all(chr, p, size); if (r != size) { error_report("Failed to read msg header. Read %d instead of %d.", r, size); goto fail; } /* validate received flags */ if (msg->flags != (VHOST_USER_REPLY_MASK | VHOST_USER_VERSION)) { error_report("Failed to read msg header." " Flags 0x%x instead of 0x%x.", msg->flags, VHOST_USER_REPLY_MASK | VHOST_USER_VERSION); goto fail; } /* validate message size is sane */ if (msg->size > VHOST_USER_PAYLOAD_SIZE) { error_report("Failed to read msg header." " Size %d exceeds the maximum %zu.", msg->size, VHOST_USER_PAYLOAD_SIZE); goto fail; } if (msg->size) { p += VHOST_USER_HDR_SIZE; size = msg->size; r = qemu_chr_fe_read_all(chr, p, size); if (r != size) { error_report("Failed to read msg payload." " Read %d instead of %d.", r, msg->size); goto fail; } } return 0; fail: return -1; }
true
qemu
5421f318ecc82294ad089fd54924df787b67c971
static int vhost_user_read(struct vhost_dev *dev, VhostUserMsg *msg) { CharDriverState *chr = dev->opaque; uint8_t *p = (uint8_t *) msg; int r, size = VHOST_USER_HDR_SIZE; r = qemu_chr_fe_read_all(chr, p, size); if (r != size) { error_report("Failed to read msg header. Read %d instead of %d.", r, size); goto fail; } if (msg->flags != (VHOST_USER_REPLY_MASK | VHOST_USER_VERSION)) { error_report("Failed to read msg header." " Flags 0x%x instead of 0x%x.", msg->flags, VHOST_USER_REPLY_MASK | VHOST_USER_VERSION); goto fail; } if (msg->size > VHOST_USER_PAYLOAD_SIZE) { error_report("Failed to read msg header." " Size %d exceeds the maximum %zu.", msg->size, VHOST_USER_PAYLOAD_SIZE); goto fail; } if (msg->size) { p += VHOST_USER_HDR_SIZE; size = msg->size; r = qemu_chr_fe_read_all(chr, p, size); if (r != size) { error_report("Failed to read msg payload." " Read %d instead of %d.", r, msg->size); goto fail; } } return 0; fail: return -1; }
{ "code": [ " error_report(\"Failed to read msg header. Read %d instead of %d.\", r,", " size);" ], "line_no": [ 17, 19 ] }
static int FUNC_0(struct vhost_dev *VAR_0, VhostUserMsg *VAR_1) { CharDriverState *chr = VAR_0->opaque; uint8_t *p = (uint8_t *) VAR_1; int VAR_2, VAR_3 = VHOST_USER_HDR_SIZE; VAR_2 = qemu_chr_fe_read_all(chr, p, VAR_3); if (VAR_2 != VAR_3) { error_report("Failed to read VAR_1 header. Read %d instead of %d.", VAR_2, VAR_3); goto fail; } if (VAR_1->flags != (VHOST_USER_REPLY_MASK | VHOST_USER_VERSION)) { error_report("Failed to read VAR_1 header." " Flags 0x%x instead of 0x%x.", VAR_1->flags, VHOST_USER_REPLY_MASK | VHOST_USER_VERSION); goto fail; } if (VAR_1->VAR_3 > VHOST_USER_PAYLOAD_SIZE) { error_report("Failed to read VAR_1 header." " Size %d exceeds the maximum %zu.", VAR_1->VAR_3, VHOST_USER_PAYLOAD_SIZE); goto fail; } if (VAR_1->VAR_3) { p += VHOST_USER_HDR_SIZE; VAR_3 = VAR_1->VAR_3; VAR_2 = qemu_chr_fe_read_all(chr, p, VAR_3); if (VAR_2 != VAR_3) { error_report("Failed to read VAR_1 payload." " Read %d instead of %d.", VAR_2, VAR_1->VAR_3); goto fail; } } return 0; fail: return -1; }
[ "static int FUNC_0(struct vhost_dev *VAR_0, VhostUserMsg *VAR_1)\n{", "CharDriverState *chr = VAR_0->opaque;", "uint8_t *p = (uint8_t *) VAR_1;", "int VAR_2, VAR_3 = VHOST_USER_HDR_SIZE;", "VAR_2 = qemu_chr_fe_read_all(chr, p, VAR_3);", "if (VAR_2 != VAR_3) {", "error_report(\"Failed to read VAR_1 header. Read %d instead of %d.\", VAR_2,\nVAR_3);", "goto fail;", "}", "if (VAR_1->flags != (VHOST_USER_REPLY_MASK | VHOST_USER_VERSION)) {", "error_report(\"Failed to read VAR_1 header.\"\n\" Flags 0x%x instead of 0x%x.\", VAR_1->flags,\nVHOST_USER_REPLY_MASK | VHOST_USER_VERSION);", "goto fail;", "}", "if (VAR_1->VAR_3 > VHOST_USER_PAYLOAD_SIZE) {", "error_report(\"Failed to read VAR_1 header.\"\n\" Size %d exceeds the maximum %zu.\", VAR_1->VAR_3,\nVHOST_USER_PAYLOAD_SIZE);", "goto fail;", "}", "if (VAR_1->VAR_3) {", "p += VHOST_USER_HDR_SIZE;", "VAR_3 = VAR_1->VAR_3;", "VAR_2 = qemu_chr_fe_read_all(chr, p, VAR_3);", "if (VAR_2 != VAR_3) {", "error_report(\"Failed to read VAR_1 payload.\"\n\" Read %d instead of %d.\", VAR_2, VAR_1->VAR_3);", "goto fail;", "}", "}", "return 0;", "fail:\nreturn -1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17, 19 ], [ 21 ], [ 23 ], [ 29 ], [ 31, 33, 35 ], [ 37 ], [ 39 ], [ 45 ], [ 47, 49, 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69, 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 85, 87 ], [ 89 ] ]
11,097
av_cold void ff_vp9dsp_init_x86(VP9DSPContext *dsp, int bpp) { #if HAVE_YASM int cpu_flags; if (bpp != 8) return; cpu_flags = av_get_cpu_flags(); #define init_fpel(idx1, idx2, sz, type, opt) \ dsp->mc[idx1][FILTER_8TAP_SMOOTH ][idx2][0][0] = \ dsp->mc[idx1][FILTER_8TAP_REGULAR][idx2][0][0] = \ dsp->mc[idx1][FILTER_8TAP_SHARP ][idx2][0][0] = \ dsp->mc[idx1][FILTER_BILINEAR ][idx2][0][0] = ff_vp9_##type##sz##_##opt #define init_subpel1(idx1, idx2, idxh, idxv, sz, dir, type, opt) \ dsp->mc[idx1][FILTER_8TAP_SMOOTH ][idx2][idxh][idxv] = type##_8tap_smooth_##sz##dir##_##opt; \ dsp->mc[idx1][FILTER_8TAP_REGULAR][idx2][idxh][idxv] = type##_8tap_regular_##sz##dir##_##opt; \ dsp->mc[idx1][FILTER_8TAP_SHARP ][idx2][idxh][idxv] = type##_8tap_sharp_##sz##dir##_##opt #define init_subpel2(idx1, idx2, sz, type, opt) \ init_subpel1(idx1, idx2, 1, 1, sz, hv, type, opt); \ init_subpel1(idx1, idx2, 0, 1, sz, v, type, opt); \ init_subpel1(idx1, idx2, 1, 0, sz, h, type, opt) #define init_subpel3_32_64(idx, type, opt) \ init_subpel2(0, idx, 64, type, opt); \ init_subpel2(1, idx, 32, type, opt) #define init_subpel3_8to64(idx, type, opt) \ init_subpel3_32_64(idx, type, opt); \ init_subpel2(2, idx, 16, type, opt); \ init_subpel2(3, idx, 8, type, opt) #define init_subpel3(idx, type, opt) \ init_subpel3_8to64(idx, type, opt); \ init_subpel2(4, idx, 4, type, opt) #define init_lpf(opt) do { \ dsp->loop_filter_16[0] = ff_vp9_loop_filter_h_16_16_##opt; \ dsp->loop_filter_16[1] = ff_vp9_loop_filter_v_16_16_##opt; \ dsp->loop_filter_mix2[0][0][0] = ff_vp9_loop_filter_h_44_16_##opt; \ dsp->loop_filter_mix2[0][0][1] = ff_vp9_loop_filter_v_44_16_##opt; \ dsp->loop_filter_mix2[0][1][0] = ff_vp9_loop_filter_h_48_16_##opt; \ dsp->loop_filter_mix2[0][1][1] = ff_vp9_loop_filter_v_48_16_##opt; \ dsp->loop_filter_mix2[1][0][0] = ff_vp9_loop_filter_h_84_16_##opt; \ dsp->loop_filter_mix2[1][0][1] = ff_vp9_loop_filter_v_84_16_##opt; \ dsp->loop_filter_mix2[1][1][0] = ff_vp9_loop_filter_h_88_16_##opt; \ dsp->loop_filter_mix2[1][1][1] = ff_vp9_loop_filter_v_88_16_##opt; \ } while (0) #define init_ipred(sz, opt, t, e) \ dsp->intra_pred[TX_##sz##X##sz][e##_PRED] = ff_vp9_ipred_##t##_##sz##x##sz##_##opt #define ff_vp9_ipred_hd_4x4_ssse3 ff_vp9_ipred_hd_4x4_mmxext #define ff_vp9_ipred_vl_4x4_ssse3 ff_vp9_ipred_vl_4x4_mmxext #define init_dir_tm_ipred(sz, opt) do { \ init_ipred(sz, opt, dl, DIAG_DOWN_LEFT); \ init_ipred(sz, opt, dr, DIAG_DOWN_RIGHT); \ init_ipred(sz, opt, hd, HOR_DOWN); \ init_ipred(sz, opt, vl, VERT_LEFT); \ init_ipred(sz, opt, hu, HOR_UP); \ init_ipred(sz, opt, tm, TM_VP8); \ init_ipred(sz, opt, vr, VERT_RIGHT); \ } while (0) #define init_dir_tm_h_ipred(sz, opt) do { \ init_dir_tm_ipred(sz, opt); \ init_ipred(sz, opt, h, HOR); \ } while (0) #define init_dc_ipred(sz, opt) do { \ init_ipred(sz, opt, dc, DC); \ init_ipred(sz, opt, dc_left, LEFT_DC); \ init_ipred(sz, opt, dc_top, TOP_DC); \ } while (0) #define init_all_ipred(sz, opt) do { \ init_dc_ipred(sz, opt); \ init_dir_tm_h_ipred(sz, opt); \ } while (0) if (EXTERNAL_MMX(cpu_flags)) { init_fpel(4, 0, 4, put, mmx); init_fpel(3, 0, 8, put, mmx); dsp->itxfm_add[4 /* lossless */][DCT_DCT] = dsp->itxfm_add[4 /* lossless */][ADST_DCT] = dsp->itxfm_add[4 /* lossless */][DCT_ADST] = dsp->itxfm_add[4 /* lossless */][ADST_ADST] = ff_vp9_iwht_iwht_4x4_add_mmx; init_ipred(8, mmx, v, VERT); } if (EXTERNAL_MMXEXT(cpu_flags)) { init_subpel2(4, 0, 4, put, mmxext); init_subpel2(4, 1, 4, avg, mmxext); init_fpel(4, 1, 4, avg, mmxext); init_fpel(3, 1, 8, avg, mmxext); dsp->itxfm_add[TX_4X4][DCT_DCT] = ff_vp9_idct_idct_4x4_add_mmxext; init_dc_ipred(4, mmxext); init_dc_ipred(8, mmxext); init_dir_tm_ipred(4, mmxext); } if (EXTERNAL_SSE(cpu_flags)) { init_fpel(2, 0, 16, put, sse); init_fpel(1, 0, 32, put, sse); init_fpel(0, 0, 64, put, sse); init_ipred(16, sse, v, VERT); init_ipred(32, sse, v, VERT); } if (EXTERNAL_SSE2(cpu_flags)) { init_subpel3_8to64(0, put, sse2); init_subpel3_8to64(1, avg, sse2); init_fpel(2, 1, 16, avg, sse2); init_fpel(1, 1, 32, avg, sse2); init_fpel(0, 1, 64, avg, sse2); init_lpf(sse2); dsp->itxfm_add[TX_4X4][ADST_DCT] = ff_vp9_idct_iadst_4x4_add_sse2; dsp->itxfm_add[TX_4X4][DCT_ADST] = ff_vp9_iadst_idct_4x4_add_sse2; dsp->itxfm_add[TX_4X4][ADST_ADST] = ff_vp9_iadst_iadst_4x4_add_sse2; dsp->itxfm_add[TX_8X8][DCT_DCT] = ff_vp9_idct_idct_8x8_add_sse2; dsp->itxfm_add[TX_8X8][ADST_DCT] = ff_vp9_idct_iadst_8x8_add_sse2; dsp->itxfm_add[TX_8X8][DCT_ADST] = ff_vp9_iadst_idct_8x8_add_sse2; dsp->itxfm_add[TX_8X8][ADST_ADST] = ff_vp9_iadst_iadst_8x8_add_sse2; dsp->itxfm_add[TX_16X16][DCT_DCT] = ff_vp9_idct_idct_16x16_add_sse2; dsp->itxfm_add[TX_16X16][ADST_DCT] = ff_vp9_idct_iadst_16x16_add_sse2; dsp->itxfm_add[TX_16X16][DCT_ADST] = ff_vp9_iadst_idct_16x16_add_sse2; dsp->itxfm_add[TX_16X16][ADST_ADST] = ff_vp9_iadst_iadst_16x16_add_sse2; dsp->itxfm_add[TX_32X32][ADST_ADST] = dsp->itxfm_add[TX_32X32][ADST_DCT] = dsp->itxfm_add[TX_32X32][DCT_ADST] = dsp->itxfm_add[TX_32X32][DCT_DCT] = ff_vp9_idct_idct_32x32_add_sse2; init_dc_ipred(16, sse2); init_dc_ipred(32, sse2); init_dir_tm_h_ipred(8, sse2); init_dir_tm_h_ipred(16, sse2); init_dir_tm_h_ipred(32, sse2); init_ipred(4, sse2, h, HOR); } if (EXTERNAL_SSSE3(cpu_flags)) { init_subpel3(0, put, ssse3); init_subpel3(1, avg, ssse3); dsp->itxfm_add[TX_4X4][DCT_DCT] = ff_vp9_idct_idct_4x4_add_ssse3; dsp->itxfm_add[TX_4X4][ADST_DCT] = ff_vp9_idct_iadst_4x4_add_ssse3; dsp->itxfm_add[TX_4X4][DCT_ADST] = ff_vp9_iadst_idct_4x4_add_ssse3; dsp->itxfm_add[TX_4X4][ADST_ADST] = ff_vp9_iadst_iadst_4x4_add_ssse3; dsp->itxfm_add[TX_8X8][DCT_DCT] = ff_vp9_idct_idct_8x8_add_ssse3; dsp->itxfm_add[TX_8X8][ADST_DCT] = ff_vp9_idct_iadst_8x8_add_ssse3; dsp->itxfm_add[TX_8X8][DCT_ADST] = ff_vp9_iadst_idct_8x8_add_ssse3; dsp->itxfm_add[TX_8X8][ADST_ADST] = ff_vp9_iadst_iadst_8x8_add_ssse3; dsp->itxfm_add[TX_16X16][DCT_DCT] = ff_vp9_idct_idct_16x16_add_ssse3; dsp->itxfm_add[TX_16X16][ADST_DCT] = ff_vp9_idct_iadst_16x16_add_ssse3; dsp->itxfm_add[TX_16X16][DCT_ADST] = ff_vp9_iadst_idct_16x16_add_ssse3; dsp->itxfm_add[TX_16X16][ADST_ADST] = ff_vp9_iadst_iadst_16x16_add_ssse3; dsp->itxfm_add[TX_32X32][ADST_ADST] = dsp->itxfm_add[TX_32X32][ADST_DCT] = dsp->itxfm_add[TX_32X32][DCT_ADST] = dsp->itxfm_add[TX_32X32][DCT_DCT] = ff_vp9_idct_idct_32x32_add_ssse3; init_lpf(ssse3); init_all_ipred(4, ssse3); init_all_ipred(8, ssse3); init_all_ipred(16, ssse3); init_all_ipred(32, ssse3); } if (EXTERNAL_AVX(cpu_flags)) { dsp->itxfm_add[TX_8X8][DCT_DCT] = ff_vp9_idct_idct_8x8_add_avx; dsp->itxfm_add[TX_8X8][ADST_DCT] = ff_vp9_idct_iadst_8x8_add_avx; dsp->itxfm_add[TX_8X8][DCT_ADST] = ff_vp9_iadst_idct_8x8_add_avx; dsp->itxfm_add[TX_8X8][ADST_ADST] = ff_vp9_iadst_iadst_8x8_add_avx; dsp->itxfm_add[TX_16X16][DCT_DCT] = ff_vp9_idct_idct_16x16_add_avx; dsp->itxfm_add[TX_16X16][ADST_DCT] = ff_vp9_idct_iadst_16x16_add_avx; dsp->itxfm_add[TX_16X16][DCT_ADST] = ff_vp9_iadst_idct_16x16_add_avx; dsp->itxfm_add[TX_16X16][ADST_ADST] = ff_vp9_iadst_iadst_16x16_add_avx; dsp->itxfm_add[TX_32X32][ADST_ADST] = dsp->itxfm_add[TX_32X32][ADST_DCT] = dsp->itxfm_add[TX_32X32][DCT_ADST] = dsp->itxfm_add[TX_32X32][DCT_DCT] = ff_vp9_idct_idct_32x32_add_avx; init_lpf(avx); init_dir_tm_h_ipred(8, avx); init_dir_tm_h_ipred(16, avx); init_dir_tm_h_ipred(32, avx); } if (EXTERNAL_AVX_FAST(cpu_flags)) { init_fpel(1, 0, 32, put, avx); init_fpel(0, 0, 64, put, avx); init_ipred(32, avx, v, VERT); } if (EXTERNAL_AVX2(cpu_flags)) { init_fpel(1, 1, 32, avg, avx2); init_fpel(0, 1, 64, avg, avx2); if (ARCH_X86_64) { #if ARCH_X86_64 && HAVE_AVX2_EXTERNAL init_subpel3_32_64(0, put, avx2); init_subpel3_32_64(1, avg, avx2); #endif } init_dc_ipred(32, avx2); init_ipred(32, avx2, h, HOR); init_ipred(32, avx2, tm, TM_VP8); } #undef init_fpel #undef init_subpel1 #undef init_subpel2 #undef init_subpel3 #endif /* HAVE_YASM */ }
true
FFmpeg
fd8b90f5f63de12c1ee1ec1cbe99791c5629c582
av_cold void ff_vp9dsp_init_x86(VP9DSPContext *dsp, int bpp) { #if HAVE_YASM int cpu_flags; if (bpp != 8) return; cpu_flags = av_get_cpu_flags(); #define init_fpel(idx1, idx2, sz, type, opt) \ dsp->mc[idx1][FILTER_8TAP_SMOOTH ][idx2][0][0] = \ dsp->mc[idx1][FILTER_8TAP_REGULAR][idx2][0][0] = \ dsp->mc[idx1][FILTER_8TAP_SHARP ][idx2][0][0] = \ dsp->mc[idx1][FILTER_BILINEAR ][idx2][0][0] = ff_vp9_##type##sz##_##opt #define init_subpel1(idx1, idx2, idxh, idxv, sz, dir, type, opt) \ dsp->mc[idx1][FILTER_8TAP_SMOOTH ][idx2][idxh][idxv] = type##_8tap_smooth_##sz##dir##_##opt; \ dsp->mc[idx1][FILTER_8TAP_REGULAR][idx2][idxh][idxv] = type##_8tap_regular_##sz##dir##_##opt; \ dsp->mc[idx1][FILTER_8TAP_SHARP ][idx2][idxh][idxv] = type##_8tap_sharp_##sz##dir##_##opt #define init_subpel2(idx1, idx2, sz, type, opt) \ init_subpel1(idx1, idx2, 1, 1, sz, hv, type, opt); \ init_subpel1(idx1, idx2, 0, 1, sz, v, type, opt); \ init_subpel1(idx1, idx2, 1, 0, sz, h, type, opt) #define init_subpel3_32_64(idx, type, opt) \ init_subpel2(0, idx, 64, type, opt); \ init_subpel2(1, idx, 32, type, opt) #define init_subpel3_8to64(idx, type, opt) \ init_subpel3_32_64(idx, type, opt); \ init_subpel2(2, idx, 16, type, opt); \ init_subpel2(3, idx, 8, type, opt) #define init_subpel3(idx, type, opt) \ init_subpel3_8to64(idx, type, opt); \ init_subpel2(4, idx, 4, type, opt) #define init_lpf(opt) do { \ dsp->loop_filter_16[0] = ff_vp9_loop_filter_h_16_16_##opt; \ dsp->loop_filter_16[1] = ff_vp9_loop_filter_v_16_16_##opt; \ dsp->loop_filter_mix2[0][0][0] = ff_vp9_loop_filter_h_44_16_##opt; \ dsp->loop_filter_mix2[0][0][1] = ff_vp9_loop_filter_v_44_16_##opt; \ dsp->loop_filter_mix2[0][1][0] = ff_vp9_loop_filter_h_48_16_##opt; \ dsp->loop_filter_mix2[0][1][1] = ff_vp9_loop_filter_v_48_16_##opt; \ dsp->loop_filter_mix2[1][0][0] = ff_vp9_loop_filter_h_84_16_##opt; \ dsp->loop_filter_mix2[1][0][1] = ff_vp9_loop_filter_v_84_16_##opt; \ dsp->loop_filter_mix2[1][1][0] = ff_vp9_loop_filter_h_88_16_##opt; \ dsp->loop_filter_mix2[1][1][1] = ff_vp9_loop_filter_v_88_16_##opt; \ } while (0) #define init_ipred(sz, opt, t, e) \ dsp->intra_pred[TX_##sz##X##sz][e##_PRED] = ff_vp9_ipred_##t##_##sz##x##sz##_##opt #define ff_vp9_ipred_hd_4x4_ssse3 ff_vp9_ipred_hd_4x4_mmxext #define ff_vp9_ipred_vl_4x4_ssse3 ff_vp9_ipred_vl_4x4_mmxext #define init_dir_tm_ipred(sz, opt) do { \ init_ipred(sz, opt, dl, DIAG_DOWN_LEFT); \ init_ipred(sz, opt, dr, DIAG_DOWN_RIGHT); \ init_ipred(sz, opt, hd, HOR_DOWN); \ init_ipred(sz, opt, vl, VERT_LEFT); \ init_ipred(sz, opt, hu, HOR_UP); \ init_ipred(sz, opt, tm, TM_VP8); \ init_ipred(sz, opt, vr, VERT_RIGHT); \ } while (0) #define init_dir_tm_h_ipred(sz, opt) do { \ init_dir_tm_ipred(sz, opt); \ init_ipred(sz, opt, h, HOR); \ } while (0) #define init_dc_ipred(sz, opt) do { \ init_ipred(sz, opt, dc, DC); \ init_ipred(sz, opt, dc_left, LEFT_DC); \ init_ipred(sz, opt, dc_top, TOP_DC); \ } while (0) #define init_all_ipred(sz, opt) do { \ init_dc_ipred(sz, opt); \ init_dir_tm_h_ipred(sz, opt); \ } while (0) if (EXTERNAL_MMX(cpu_flags)) { init_fpel(4, 0, 4, put, mmx); init_fpel(3, 0, 8, put, mmx); dsp->itxfm_add[4 ][DCT_DCT] = dsp->itxfm_add[4 ][ADST_DCT] = dsp->itxfm_add[4 ][DCT_ADST] = dsp->itxfm_add[4 ][ADST_ADST] = ff_vp9_iwht_iwht_4x4_add_mmx; init_ipred(8, mmx, v, VERT); } if (EXTERNAL_MMXEXT(cpu_flags)) { init_subpel2(4, 0, 4, put, mmxext); init_subpel2(4, 1, 4, avg, mmxext); init_fpel(4, 1, 4, avg, mmxext); init_fpel(3, 1, 8, avg, mmxext); dsp->itxfm_add[TX_4X4][DCT_DCT] = ff_vp9_idct_idct_4x4_add_mmxext; init_dc_ipred(4, mmxext); init_dc_ipred(8, mmxext); init_dir_tm_ipred(4, mmxext); } if (EXTERNAL_SSE(cpu_flags)) { init_fpel(2, 0, 16, put, sse); init_fpel(1, 0, 32, put, sse); init_fpel(0, 0, 64, put, sse); init_ipred(16, sse, v, VERT); init_ipred(32, sse, v, VERT); } if (EXTERNAL_SSE2(cpu_flags)) { init_subpel3_8to64(0, put, sse2); init_subpel3_8to64(1, avg, sse2); init_fpel(2, 1, 16, avg, sse2); init_fpel(1, 1, 32, avg, sse2); init_fpel(0, 1, 64, avg, sse2); init_lpf(sse2); dsp->itxfm_add[TX_4X4][ADST_DCT] = ff_vp9_idct_iadst_4x4_add_sse2; dsp->itxfm_add[TX_4X4][DCT_ADST] = ff_vp9_iadst_idct_4x4_add_sse2; dsp->itxfm_add[TX_4X4][ADST_ADST] = ff_vp9_iadst_iadst_4x4_add_sse2; dsp->itxfm_add[TX_8X8][DCT_DCT] = ff_vp9_idct_idct_8x8_add_sse2; dsp->itxfm_add[TX_8X8][ADST_DCT] = ff_vp9_idct_iadst_8x8_add_sse2; dsp->itxfm_add[TX_8X8][DCT_ADST] = ff_vp9_iadst_idct_8x8_add_sse2; dsp->itxfm_add[TX_8X8][ADST_ADST] = ff_vp9_iadst_iadst_8x8_add_sse2; dsp->itxfm_add[TX_16X16][DCT_DCT] = ff_vp9_idct_idct_16x16_add_sse2; dsp->itxfm_add[TX_16X16][ADST_DCT] = ff_vp9_idct_iadst_16x16_add_sse2; dsp->itxfm_add[TX_16X16][DCT_ADST] = ff_vp9_iadst_idct_16x16_add_sse2; dsp->itxfm_add[TX_16X16][ADST_ADST] = ff_vp9_iadst_iadst_16x16_add_sse2; dsp->itxfm_add[TX_32X32][ADST_ADST] = dsp->itxfm_add[TX_32X32][ADST_DCT] = dsp->itxfm_add[TX_32X32][DCT_ADST] = dsp->itxfm_add[TX_32X32][DCT_DCT] = ff_vp9_idct_idct_32x32_add_sse2; init_dc_ipred(16, sse2); init_dc_ipred(32, sse2); init_dir_tm_h_ipred(8, sse2); init_dir_tm_h_ipred(16, sse2); init_dir_tm_h_ipred(32, sse2); init_ipred(4, sse2, h, HOR); } if (EXTERNAL_SSSE3(cpu_flags)) { init_subpel3(0, put, ssse3); init_subpel3(1, avg, ssse3); dsp->itxfm_add[TX_4X4][DCT_DCT] = ff_vp9_idct_idct_4x4_add_ssse3; dsp->itxfm_add[TX_4X4][ADST_DCT] = ff_vp9_idct_iadst_4x4_add_ssse3; dsp->itxfm_add[TX_4X4][DCT_ADST] = ff_vp9_iadst_idct_4x4_add_ssse3; dsp->itxfm_add[TX_4X4][ADST_ADST] = ff_vp9_iadst_iadst_4x4_add_ssse3; dsp->itxfm_add[TX_8X8][DCT_DCT] = ff_vp9_idct_idct_8x8_add_ssse3; dsp->itxfm_add[TX_8X8][ADST_DCT] = ff_vp9_idct_iadst_8x8_add_ssse3; dsp->itxfm_add[TX_8X8][DCT_ADST] = ff_vp9_iadst_idct_8x8_add_ssse3; dsp->itxfm_add[TX_8X8][ADST_ADST] = ff_vp9_iadst_iadst_8x8_add_ssse3; dsp->itxfm_add[TX_16X16][DCT_DCT] = ff_vp9_idct_idct_16x16_add_ssse3; dsp->itxfm_add[TX_16X16][ADST_DCT] = ff_vp9_idct_iadst_16x16_add_ssse3; dsp->itxfm_add[TX_16X16][DCT_ADST] = ff_vp9_iadst_idct_16x16_add_ssse3; dsp->itxfm_add[TX_16X16][ADST_ADST] = ff_vp9_iadst_iadst_16x16_add_ssse3; dsp->itxfm_add[TX_32X32][ADST_ADST] = dsp->itxfm_add[TX_32X32][ADST_DCT] = dsp->itxfm_add[TX_32X32][DCT_ADST] = dsp->itxfm_add[TX_32X32][DCT_DCT] = ff_vp9_idct_idct_32x32_add_ssse3; init_lpf(ssse3); init_all_ipred(4, ssse3); init_all_ipred(8, ssse3); init_all_ipred(16, ssse3); init_all_ipred(32, ssse3); } if (EXTERNAL_AVX(cpu_flags)) { dsp->itxfm_add[TX_8X8][DCT_DCT] = ff_vp9_idct_idct_8x8_add_avx; dsp->itxfm_add[TX_8X8][ADST_DCT] = ff_vp9_idct_iadst_8x8_add_avx; dsp->itxfm_add[TX_8X8][DCT_ADST] = ff_vp9_iadst_idct_8x8_add_avx; dsp->itxfm_add[TX_8X8][ADST_ADST] = ff_vp9_iadst_iadst_8x8_add_avx; dsp->itxfm_add[TX_16X16][DCT_DCT] = ff_vp9_idct_idct_16x16_add_avx; dsp->itxfm_add[TX_16X16][ADST_DCT] = ff_vp9_idct_iadst_16x16_add_avx; dsp->itxfm_add[TX_16X16][DCT_ADST] = ff_vp9_iadst_idct_16x16_add_avx; dsp->itxfm_add[TX_16X16][ADST_ADST] = ff_vp9_iadst_iadst_16x16_add_avx; dsp->itxfm_add[TX_32X32][ADST_ADST] = dsp->itxfm_add[TX_32X32][ADST_DCT] = dsp->itxfm_add[TX_32X32][DCT_ADST] = dsp->itxfm_add[TX_32X32][DCT_DCT] = ff_vp9_idct_idct_32x32_add_avx; init_lpf(avx); init_dir_tm_h_ipred(8, avx); init_dir_tm_h_ipred(16, avx); init_dir_tm_h_ipred(32, avx); } if (EXTERNAL_AVX_FAST(cpu_flags)) { init_fpel(1, 0, 32, put, avx); init_fpel(0, 0, 64, put, avx); init_ipred(32, avx, v, VERT); } if (EXTERNAL_AVX2(cpu_flags)) { init_fpel(1, 1, 32, avg, avx2); init_fpel(0, 1, 64, avg, avx2); if (ARCH_X86_64) { #if ARCH_X86_64 && HAVE_AVX2_EXTERNAL init_subpel3_32_64(0, put, avx2); init_subpel3_32_64(1, avg, avx2); #endif } init_dc_ipred(32, avx2); init_ipred(32, avx2, h, HOR); init_ipred(32, avx2, tm, TM_VP8); } #undef init_fpel #undef init_subpel1 #undef init_subpel2 #undef init_subpel3 #endif }
{ "code": [ "av_cold void ff_vp9dsp_init_x86(VP9DSPContext *dsp, int bpp)" ], "line_no": [ 1 ] }
av_cold void FUNC_0(VP9DSPContext *dsp, int bpp) { #if HAVE_YASM int cpu_flags; if (bpp != 8) return; cpu_flags = av_get_cpu_flags(); #define init_fpel(idx1, idx2, sz, type, opt) \ dsp->mc[idx1][FILTER_8TAP_SMOOTH ][idx2][0][0] = \ dsp->mc[idx1][FILTER_8TAP_REGULAR][idx2][0][0] = \ dsp->mc[idx1][FILTER_8TAP_SHARP ][idx2][0][0] = \ dsp->mc[idx1][FILTER_BILINEAR ][idx2][0][0] = ff_vp9_##type##sz##_##opt #define init_subpel1(idx1, idx2, idxh, idxv, sz, dir, type, opt) \ dsp->mc[idx1][FILTER_8TAP_SMOOTH ][idx2][idxh][idxv] = type##_8tap_smooth_##sz##dir##_##opt; \ dsp->mc[idx1][FILTER_8TAP_REGULAR][idx2][idxh][idxv] = type##_8tap_regular_##sz##dir##_##opt; \ dsp->mc[idx1][FILTER_8TAP_SHARP ][idx2][idxh][idxv] = type##_8tap_sharp_##sz##dir##_##opt #define init_subpel2(idx1, idx2, sz, type, opt) \ init_subpel1(idx1, idx2, 1, 1, sz, hv, type, opt); \ init_subpel1(idx1, idx2, 0, 1, sz, v, type, opt); \ init_subpel1(idx1, idx2, 1, 0, sz, h, type, opt) #define init_subpel3_32_64(idx, type, opt) \ init_subpel2(0, idx, 64, type, opt); \ init_subpel2(1, idx, 32, type, opt) #define init_subpel3_8to64(idx, type, opt) \ init_subpel3_32_64(idx, type, opt); \ init_subpel2(2, idx, 16, type, opt); \ init_subpel2(3, idx, 8, type, opt) #define init_subpel3(idx, type, opt) \ init_subpel3_8to64(idx, type, opt); \ init_subpel2(4, idx, 4, type, opt) #define init_lpf(opt) do { \ dsp->loop_filter_16[0] = ff_vp9_loop_filter_h_16_16_##opt; \ dsp->loop_filter_16[1] = ff_vp9_loop_filter_v_16_16_##opt; \ dsp->loop_filter_mix2[0][0][0] = ff_vp9_loop_filter_h_44_16_##opt; \ dsp->loop_filter_mix2[0][0][1] = ff_vp9_loop_filter_v_44_16_##opt; \ dsp->loop_filter_mix2[0][1][0] = ff_vp9_loop_filter_h_48_16_##opt; \ dsp->loop_filter_mix2[0][1][1] = ff_vp9_loop_filter_v_48_16_##opt; \ dsp->loop_filter_mix2[1][0][0] = ff_vp9_loop_filter_h_84_16_##opt; \ dsp->loop_filter_mix2[1][0][1] = ff_vp9_loop_filter_v_84_16_##opt; \ dsp->loop_filter_mix2[1][1][0] = ff_vp9_loop_filter_h_88_16_##opt; \ dsp->loop_filter_mix2[1][1][1] = ff_vp9_loop_filter_v_88_16_##opt; \ } while (0) #define init_ipred(sz, opt, t, e) \ dsp->intra_pred[TX_##sz##X##sz][e##_PRED] = ff_vp9_ipred_##t##_##sz##x##sz##_##opt #define ff_vp9_ipred_hd_4x4_ssse3 ff_vp9_ipred_hd_4x4_mmxext #define ff_vp9_ipred_vl_4x4_ssse3 ff_vp9_ipred_vl_4x4_mmxext #define init_dir_tm_ipred(sz, opt) do { \ init_ipred(sz, opt, dl, DIAG_DOWN_LEFT); \ init_ipred(sz, opt, dr, DIAG_DOWN_RIGHT); \ init_ipred(sz, opt, hd, HOR_DOWN); \ init_ipred(sz, opt, vl, VERT_LEFT); \ init_ipred(sz, opt, hu, HOR_UP); \ init_ipred(sz, opt, tm, TM_VP8); \ init_ipred(sz, opt, vr, VERT_RIGHT); \ } while (0) #define init_dir_tm_h_ipred(sz, opt) do { \ init_dir_tm_ipred(sz, opt); \ init_ipred(sz, opt, h, HOR); \ } while (0) #define init_dc_ipred(sz, opt) do { \ init_ipred(sz, opt, dc, DC); \ init_ipred(sz, opt, dc_left, LEFT_DC); \ init_ipred(sz, opt, dc_top, TOP_DC); \ } while (0) #define init_all_ipred(sz, opt) do { \ init_dc_ipred(sz, opt); \ init_dir_tm_h_ipred(sz, opt); \ } while (0) if (EXTERNAL_MMX(cpu_flags)) { init_fpel(4, 0, 4, put, mmx); init_fpel(3, 0, 8, put, mmx); dsp->itxfm_add[4 ][DCT_DCT] = dsp->itxfm_add[4 ][ADST_DCT] = dsp->itxfm_add[4 ][DCT_ADST] = dsp->itxfm_add[4 ][ADST_ADST] = ff_vp9_iwht_iwht_4x4_add_mmx; init_ipred(8, mmx, v, VERT); } if (EXTERNAL_MMXEXT(cpu_flags)) { init_subpel2(4, 0, 4, put, mmxext); init_subpel2(4, 1, 4, avg, mmxext); init_fpel(4, 1, 4, avg, mmxext); init_fpel(3, 1, 8, avg, mmxext); dsp->itxfm_add[TX_4X4][DCT_DCT] = ff_vp9_idct_idct_4x4_add_mmxext; init_dc_ipred(4, mmxext); init_dc_ipred(8, mmxext); init_dir_tm_ipred(4, mmxext); } if (EXTERNAL_SSE(cpu_flags)) { init_fpel(2, 0, 16, put, sse); init_fpel(1, 0, 32, put, sse); init_fpel(0, 0, 64, put, sse); init_ipred(16, sse, v, VERT); init_ipred(32, sse, v, VERT); } if (EXTERNAL_SSE2(cpu_flags)) { init_subpel3_8to64(0, put, sse2); init_subpel3_8to64(1, avg, sse2); init_fpel(2, 1, 16, avg, sse2); init_fpel(1, 1, 32, avg, sse2); init_fpel(0, 1, 64, avg, sse2); init_lpf(sse2); dsp->itxfm_add[TX_4X4][ADST_DCT] = ff_vp9_idct_iadst_4x4_add_sse2; dsp->itxfm_add[TX_4X4][DCT_ADST] = ff_vp9_iadst_idct_4x4_add_sse2; dsp->itxfm_add[TX_4X4][ADST_ADST] = ff_vp9_iadst_iadst_4x4_add_sse2; dsp->itxfm_add[TX_8X8][DCT_DCT] = ff_vp9_idct_idct_8x8_add_sse2; dsp->itxfm_add[TX_8X8][ADST_DCT] = ff_vp9_idct_iadst_8x8_add_sse2; dsp->itxfm_add[TX_8X8][DCT_ADST] = ff_vp9_iadst_idct_8x8_add_sse2; dsp->itxfm_add[TX_8X8][ADST_ADST] = ff_vp9_iadst_iadst_8x8_add_sse2; dsp->itxfm_add[TX_16X16][DCT_DCT] = ff_vp9_idct_idct_16x16_add_sse2; dsp->itxfm_add[TX_16X16][ADST_DCT] = ff_vp9_idct_iadst_16x16_add_sse2; dsp->itxfm_add[TX_16X16][DCT_ADST] = ff_vp9_iadst_idct_16x16_add_sse2; dsp->itxfm_add[TX_16X16][ADST_ADST] = ff_vp9_iadst_iadst_16x16_add_sse2; dsp->itxfm_add[TX_32X32][ADST_ADST] = dsp->itxfm_add[TX_32X32][ADST_DCT] = dsp->itxfm_add[TX_32X32][DCT_ADST] = dsp->itxfm_add[TX_32X32][DCT_DCT] = ff_vp9_idct_idct_32x32_add_sse2; init_dc_ipred(16, sse2); init_dc_ipred(32, sse2); init_dir_tm_h_ipred(8, sse2); init_dir_tm_h_ipred(16, sse2); init_dir_tm_h_ipred(32, sse2); init_ipred(4, sse2, h, HOR); } if (EXTERNAL_SSSE3(cpu_flags)) { init_subpel3(0, put, ssse3); init_subpel3(1, avg, ssse3); dsp->itxfm_add[TX_4X4][DCT_DCT] = ff_vp9_idct_idct_4x4_add_ssse3; dsp->itxfm_add[TX_4X4][ADST_DCT] = ff_vp9_idct_iadst_4x4_add_ssse3; dsp->itxfm_add[TX_4X4][DCT_ADST] = ff_vp9_iadst_idct_4x4_add_ssse3; dsp->itxfm_add[TX_4X4][ADST_ADST] = ff_vp9_iadst_iadst_4x4_add_ssse3; dsp->itxfm_add[TX_8X8][DCT_DCT] = ff_vp9_idct_idct_8x8_add_ssse3; dsp->itxfm_add[TX_8X8][ADST_DCT] = ff_vp9_idct_iadst_8x8_add_ssse3; dsp->itxfm_add[TX_8X8][DCT_ADST] = ff_vp9_iadst_idct_8x8_add_ssse3; dsp->itxfm_add[TX_8X8][ADST_ADST] = ff_vp9_iadst_iadst_8x8_add_ssse3; dsp->itxfm_add[TX_16X16][DCT_DCT] = ff_vp9_idct_idct_16x16_add_ssse3; dsp->itxfm_add[TX_16X16][ADST_DCT] = ff_vp9_idct_iadst_16x16_add_ssse3; dsp->itxfm_add[TX_16X16][DCT_ADST] = ff_vp9_iadst_idct_16x16_add_ssse3; dsp->itxfm_add[TX_16X16][ADST_ADST] = ff_vp9_iadst_iadst_16x16_add_ssse3; dsp->itxfm_add[TX_32X32][ADST_ADST] = dsp->itxfm_add[TX_32X32][ADST_DCT] = dsp->itxfm_add[TX_32X32][DCT_ADST] = dsp->itxfm_add[TX_32X32][DCT_DCT] = ff_vp9_idct_idct_32x32_add_ssse3; init_lpf(ssse3); init_all_ipred(4, ssse3); init_all_ipred(8, ssse3); init_all_ipred(16, ssse3); init_all_ipred(32, ssse3); } if (EXTERNAL_AVX(cpu_flags)) { dsp->itxfm_add[TX_8X8][DCT_DCT] = ff_vp9_idct_idct_8x8_add_avx; dsp->itxfm_add[TX_8X8][ADST_DCT] = ff_vp9_idct_iadst_8x8_add_avx; dsp->itxfm_add[TX_8X8][DCT_ADST] = ff_vp9_iadst_idct_8x8_add_avx; dsp->itxfm_add[TX_8X8][ADST_ADST] = ff_vp9_iadst_iadst_8x8_add_avx; dsp->itxfm_add[TX_16X16][DCT_DCT] = ff_vp9_idct_idct_16x16_add_avx; dsp->itxfm_add[TX_16X16][ADST_DCT] = ff_vp9_idct_iadst_16x16_add_avx; dsp->itxfm_add[TX_16X16][DCT_ADST] = ff_vp9_iadst_idct_16x16_add_avx; dsp->itxfm_add[TX_16X16][ADST_ADST] = ff_vp9_iadst_iadst_16x16_add_avx; dsp->itxfm_add[TX_32X32][ADST_ADST] = dsp->itxfm_add[TX_32X32][ADST_DCT] = dsp->itxfm_add[TX_32X32][DCT_ADST] = dsp->itxfm_add[TX_32X32][DCT_DCT] = ff_vp9_idct_idct_32x32_add_avx; init_lpf(avx); init_dir_tm_h_ipred(8, avx); init_dir_tm_h_ipred(16, avx); init_dir_tm_h_ipred(32, avx); } if (EXTERNAL_AVX_FAST(cpu_flags)) { init_fpel(1, 0, 32, put, avx); init_fpel(0, 0, 64, put, avx); init_ipred(32, avx, v, VERT); } if (EXTERNAL_AVX2(cpu_flags)) { init_fpel(1, 1, 32, avg, avx2); init_fpel(0, 1, 64, avg, avx2); if (ARCH_X86_64) { #if ARCH_X86_64 && HAVE_AVX2_EXTERNAL init_subpel3_32_64(0, put, avx2); init_subpel3_32_64(1, avg, avx2); #endif } init_dc_ipred(32, avx2); init_ipred(32, avx2, h, HOR); init_ipred(32, avx2, tm, TM_VP8); } #undef init_fpel #undef init_subpel1 #undef init_subpel2 #undef init_subpel3 #endif }
[ "av_cold void FUNC_0(VP9DSPContext *dsp, int bpp)\n{", "#if HAVE_YASM\nint cpu_flags;", "if (bpp != 8) return;", "cpu_flags = av_get_cpu_flags();", "#define init_fpel(idx1, idx2, sz, type, opt) \\\ndsp->mc[idx1][FILTER_8TAP_SMOOTH ][idx2][0][0] = \\\ndsp->mc[idx1][FILTER_8TAP_REGULAR][idx2][0][0] = \\\ndsp->mc[idx1][FILTER_8TAP_SHARP ][idx2][0][0] = \\\ndsp->mc[idx1][FILTER_BILINEAR ][idx2][0][0] = ff_vp9_##type##sz##_##opt\n#define init_subpel1(idx1, idx2, idxh, idxv, sz, dir, type, opt) \\\ndsp->mc[idx1][FILTER_8TAP_SMOOTH ][idx2][idxh][idxv] = type##_8tap_smooth_##sz##dir##_##opt; \\", "dsp->mc[idx1][FILTER_8TAP_REGULAR][idx2][idxh][idxv] = type##_8tap_regular_##sz##dir##_##opt; \\", "dsp->mc[idx1][FILTER_8TAP_SHARP ][idx2][idxh][idxv] = type##_8tap_sharp_##sz##dir##_##opt\n#define init_subpel2(idx1, idx2, sz, type, opt) \\\ninit_subpel1(idx1, idx2, 1, 1, sz, hv, type, opt); \\", "init_subpel1(idx1, idx2, 0, 1, sz, v, type, opt); \\", "init_subpel1(idx1, idx2, 1, 0, sz, h, type, opt)\n#define init_subpel3_32_64(idx, type, opt) \\\ninit_subpel2(0, idx, 64, type, opt); \\", "init_subpel2(1, idx, 32, type, opt)\n#define init_subpel3_8to64(idx, type, opt) \\\ninit_subpel3_32_64(idx, type, opt); \\", "init_subpel2(2, idx, 16, type, opt); \\", "init_subpel2(3, idx, 8, type, opt)\n#define init_subpel3(idx, type, opt) \\\ninit_subpel3_8to64(idx, type, opt); \\", "init_subpel2(4, idx, 4, type, opt)\n#define init_lpf(opt) do { \\", "dsp->loop_filter_16[0] = ff_vp9_loop_filter_h_16_16_##opt; \\", "dsp->loop_filter_16[1] = ff_vp9_loop_filter_v_16_16_##opt; \\", "dsp->loop_filter_mix2[0][0][0] = ff_vp9_loop_filter_h_44_16_##opt; \\", "dsp->loop_filter_mix2[0][0][1] = ff_vp9_loop_filter_v_44_16_##opt; \\", "dsp->loop_filter_mix2[0][1][0] = ff_vp9_loop_filter_h_48_16_##opt; \\", "dsp->loop_filter_mix2[0][1][1] = ff_vp9_loop_filter_v_48_16_##opt; \\", "dsp->loop_filter_mix2[1][0][0] = ff_vp9_loop_filter_h_84_16_##opt; \\", "dsp->loop_filter_mix2[1][0][1] = ff_vp9_loop_filter_v_84_16_##opt; \\", "dsp->loop_filter_mix2[1][1][0] = ff_vp9_loop_filter_h_88_16_##opt; \\", "dsp->loop_filter_mix2[1][1][1] = ff_vp9_loop_filter_v_88_16_##opt; \\", "} while (0)", "#define init_ipred(sz, opt, t, e) \\\ndsp->intra_pred[TX_##sz##X##sz][e##_PRED] = ff_vp9_ipred_##t##_##sz##x##sz##_##opt\n#define ff_vp9_ipred_hd_4x4_ssse3 ff_vp9_ipred_hd_4x4_mmxext\n#define ff_vp9_ipred_vl_4x4_ssse3 ff_vp9_ipred_vl_4x4_mmxext\n#define init_dir_tm_ipred(sz, opt) do { \\", "init_ipred(sz, opt, dl, DIAG_DOWN_LEFT); \\", "init_ipred(sz, opt, dr, DIAG_DOWN_RIGHT); \\", "init_ipred(sz, opt, hd, HOR_DOWN); \\", "init_ipred(sz, opt, vl, VERT_LEFT); \\", "init_ipred(sz, opt, hu, HOR_UP); \\", "init_ipred(sz, opt, tm, TM_VP8); \\", "init_ipred(sz, opt, vr, VERT_RIGHT); \\", "} while (0)", "#define init_dir_tm_h_ipred(sz, opt) do { \\", "init_dir_tm_ipred(sz, opt); \\", "init_ipred(sz, opt, h, HOR); \\", "} while (0)", "#define init_dc_ipred(sz, opt) do { \\", "init_ipred(sz, opt, dc, DC); \\", "init_ipred(sz, opt, dc_left, LEFT_DC); \\", "init_ipred(sz, opt, dc_top, TOP_DC); \\", "} while (0)", "#define init_all_ipred(sz, opt) do { \\", "init_dc_ipred(sz, opt); \\", "init_dir_tm_h_ipred(sz, opt); \\", "} while (0)", "if (EXTERNAL_MMX(cpu_flags)) {", "init_fpel(4, 0, 4, put, mmx);", "init_fpel(3, 0, 8, put, mmx);", "dsp->itxfm_add[4 ][DCT_DCT] =\ndsp->itxfm_add[4 ][ADST_DCT] =\ndsp->itxfm_add[4 ][DCT_ADST] =\ndsp->itxfm_add[4 ][ADST_ADST] = ff_vp9_iwht_iwht_4x4_add_mmx;", "init_ipred(8, mmx, v, VERT);", "}", "if (EXTERNAL_MMXEXT(cpu_flags)) {", "init_subpel2(4, 0, 4, put, mmxext);", "init_subpel2(4, 1, 4, avg, mmxext);", "init_fpel(4, 1, 4, avg, mmxext);", "init_fpel(3, 1, 8, avg, mmxext);", "dsp->itxfm_add[TX_4X4][DCT_DCT] = ff_vp9_idct_idct_4x4_add_mmxext;", "init_dc_ipred(4, mmxext);", "init_dc_ipred(8, mmxext);", "init_dir_tm_ipred(4, mmxext);", "}", "if (EXTERNAL_SSE(cpu_flags)) {", "init_fpel(2, 0, 16, put, sse);", "init_fpel(1, 0, 32, put, sse);", "init_fpel(0, 0, 64, put, sse);", "init_ipred(16, sse, v, VERT);", "init_ipred(32, sse, v, VERT);", "}", "if (EXTERNAL_SSE2(cpu_flags)) {", "init_subpel3_8to64(0, put, sse2);", "init_subpel3_8to64(1, avg, sse2);", "init_fpel(2, 1, 16, avg, sse2);", "init_fpel(1, 1, 32, avg, sse2);", "init_fpel(0, 1, 64, avg, sse2);", "init_lpf(sse2);", "dsp->itxfm_add[TX_4X4][ADST_DCT] = ff_vp9_idct_iadst_4x4_add_sse2;", "dsp->itxfm_add[TX_4X4][DCT_ADST] = ff_vp9_iadst_idct_4x4_add_sse2;", "dsp->itxfm_add[TX_4X4][ADST_ADST] = ff_vp9_iadst_iadst_4x4_add_sse2;", "dsp->itxfm_add[TX_8X8][DCT_DCT] = ff_vp9_idct_idct_8x8_add_sse2;", "dsp->itxfm_add[TX_8X8][ADST_DCT] = ff_vp9_idct_iadst_8x8_add_sse2;", "dsp->itxfm_add[TX_8X8][DCT_ADST] = ff_vp9_iadst_idct_8x8_add_sse2;", "dsp->itxfm_add[TX_8X8][ADST_ADST] = ff_vp9_iadst_iadst_8x8_add_sse2;", "dsp->itxfm_add[TX_16X16][DCT_DCT] = ff_vp9_idct_idct_16x16_add_sse2;", "dsp->itxfm_add[TX_16X16][ADST_DCT] = ff_vp9_idct_iadst_16x16_add_sse2;", "dsp->itxfm_add[TX_16X16][DCT_ADST] = ff_vp9_iadst_idct_16x16_add_sse2;", "dsp->itxfm_add[TX_16X16][ADST_ADST] = ff_vp9_iadst_iadst_16x16_add_sse2;", "dsp->itxfm_add[TX_32X32][ADST_ADST] =\ndsp->itxfm_add[TX_32X32][ADST_DCT] =\ndsp->itxfm_add[TX_32X32][DCT_ADST] =\ndsp->itxfm_add[TX_32X32][DCT_DCT] = ff_vp9_idct_idct_32x32_add_sse2;", "init_dc_ipred(16, sse2);", "init_dc_ipred(32, sse2);", "init_dir_tm_h_ipred(8, sse2);", "init_dir_tm_h_ipred(16, sse2);", "init_dir_tm_h_ipred(32, sse2);", "init_ipred(4, sse2, h, HOR);", "}", "if (EXTERNAL_SSSE3(cpu_flags)) {", "init_subpel3(0, put, ssse3);", "init_subpel3(1, avg, ssse3);", "dsp->itxfm_add[TX_4X4][DCT_DCT] = ff_vp9_idct_idct_4x4_add_ssse3;", "dsp->itxfm_add[TX_4X4][ADST_DCT] = ff_vp9_idct_iadst_4x4_add_ssse3;", "dsp->itxfm_add[TX_4X4][DCT_ADST] = ff_vp9_iadst_idct_4x4_add_ssse3;", "dsp->itxfm_add[TX_4X4][ADST_ADST] = ff_vp9_iadst_iadst_4x4_add_ssse3;", "dsp->itxfm_add[TX_8X8][DCT_DCT] = ff_vp9_idct_idct_8x8_add_ssse3;", "dsp->itxfm_add[TX_8X8][ADST_DCT] = ff_vp9_idct_iadst_8x8_add_ssse3;", "dsp->itxfm_add[TX_8X8][DCT_ADST] = ff_vp9_iadst_idct_8x8_add_ssse3;", "dsp->itxfm_add[TX_8X8][ADST_ADST] = ff_vp9_iadst_iadst_8x8_add_ssse3;", "dsp->itxfm_add[TX_16X16][DCT_DCT] = ff_vp9_idct_idct_16x16_add_ssse3;", "dsp->itxfm_add[TX_16X16][ADST_DCT] = ff_vp9_idct_iadst_16x16_add_ssse3;", "dsp->itxfm_add[TX_16X16][DCT_ADST] = ff_vp9_iadst_idct_16x16_add_ssse3;", "dsp->itxfm_add[TX_16X16][ADST_ADST] = ff_vp9_iadst_iadst_16x16_add_ssse3;", "dsp->itxfm_add[TX_32X32][ADST_ADST] =\ndsp->itxfm_add[TX_32X32][ADST_DCT] =\ndsp->itxfm_add[TX_32X32][DCT_ADST] =\ndsp->itxfm_add[TX_32X32][DCT_DCT] = ff_vp9_idct_idct_32x32_add_ssse3;", "init_lpf(ssse3);", "init_all_ipred(4, ssse3);", "init_all_ipred(8, ssse3);", "init_all_ipred(16, ssse3);", "init_all_ipred(32, ssse3);", "}", "if (EXTERNAL_AVX(cpu_flags)) {", "dsp->itxfm_add[TX_8X8][DCT_DCT] = ff_vp9_idct_idct_8x8_add_avx;", "dsp->itxfm_add[TX_8X8][ADST_DCT] = ff_vp9_idct_iadst_8x8_add_avx;", "dsp->itxfm_add[TX_8X8][DCT_ADST] = ff_vp9_iadst_idct_8x8_add_avx;", "dsp->itxfm_add[TX_8X8][ADST_ADST] = ff_vp9_iadst_iadst_8x8_add_avx;", "dsp->itxfm_add[TX_16X16][DCT_DCT] = ff_vp9_idct_idct_16x16_add_avx;", "dsp->itxfm_add[TX_16X16][ADST_DCT] = ff_vp9_idct_iadst_16x16_add_avx;", "dsp->itxfm_add[TX_16X16][DCT_ADST] = ff_vp9_iadst_idct_16x16_add_avx;", "dsp->itxfm_add[TX_16X16][ADST_ADST] = ff_vp9_iadst_iadst_16x16_add_avx;", "dsp->itxfm_add[TX_32X32][ADST_ADST] =\ndsp->itxfm_add[TX_32X32][ADST_DCT] =\ndsp->itxfm_add[TX_32X32][DCT_ADST] =\ndsp->itxfm_add[TX_32X32][DCT_DCT] = ff_vp9_idct_idct_32x32_add_avx;", "init_lpf(avx);", "init_dir_tm_h_ipred(8, avx);", "init_dir_tm_h_ipred(16, avx);", "init_dir_tm_h_ipred(32, avx);", "}", "if (EXTERNAL_AVX_FAST(cpu_flags)) {", "init_fpel(1, 0, 32, put, avx);", "init_fpel(0, 0, 64, put, avx);", "init_ipred(32, avx, v, VERT);", "}", "if (EXTERNAL_AVX2(cpu_flags)) {", "init_fpel(1, 1, 32, avg, avx2);", "init_fpel(0, 1, 64, avg, avx2);", "if (ARCH_X86_64) {", "#if ARCH_X86_64 && HAVE_AVX2_EXTERNAL\ninit_subpel3_32_64(0, put, avx2);", "init_subpel3_32_64(1, avg, avx2);", "#endif\n}", "init_dc_ipred(32, avx2);", "init_ipred(32, avx2, h, HOR);", "init_ipred(32, avx2, tm, TM_VP8);", "}", "#undef init_fpel\n#undef init_subpel1\n#undef init_subpel2\n#undef init_subpel3\n#endif\n}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9 ], [ 13 ], [ 17, 19, 21, 23, 25, 29, 31 ], [ 33 ], [ 35, 39, 41 ], [ 43 ], [ 45, 49, 51 ], [ 53, 57, 59 ], [ 61 ], [ 63, 67, 69 ], [ 71, 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 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 ], [ 153 ], [ 157 ], [ 159 ], [ 161 ], [ 163, 165, 167, 169 ], [ 171 ], [ 173 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251, 253, 255, 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ], [ 291 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305, 307, 309, 311 ], [ 313 ], [ 315 ], [ 317 ], [ 319 ], [ 321 ], [ 323 ], [ 327 ], [ 329 ], [ 331 ], [ 333 ], [ 335 ], [ 337 ], [ 339 ], [ 341 ], [ 343 ], [ 345, 347, 349, 351 ], [ 353 ], [ 355 ], [ 357 ], [ 359 ], [ 361 ], [ 363 ], [ 365 ], [ 367 ], [ 369 ], [ 371 ], [ 375 ], [ 377 ], [ 379 ], [ 381 ], [ 383, 385 ], [ 387 ], [ 389, 391 ], [ 393 ], [ 395 ], [ 397 ], [ 399 ], [ 403, 405, 407, 409, 413, 415 ] ]
11,098
MemdevList *qmp_query_memdev(Error **errp) { Object *obj; MemdevList *list = NULL; obj = object_get_objects_root(); if (obj == NULL) { return NULL; } if (object_child_foreach(obj, query_memdev, &list) != 0) { goto error; } return list; error: qapi_free_MemdevList(list); return NULL; }
true
qemu
2f6f826e03e09eb3b65b3a764580d66b857e3a23
MemdevList *qmp_query_memdev(Error **errp) { Object *obj; MemdevList *list = NULL; obj = object_get_objects_root(); if (obj == NULL) { return NULL; } if (object_child_foreach(obj, query_memdev, &list) != 0) { goto error; } return list; error: qapi_free_MemdevList(list); return NULL; }
{ "code": [ "error:", " Object *obj;", " obj = object_get_objects_root();", " if (obj == NULL) {", " return NULL;", " if (object_child_foreach(obj, query_memdev, &list) != 0) {", " goto error;", "error:", " qapi_free_MemdevList(list);", " return NULL;" ], "line_no": [ 33, 5, 11, 13, 15, 21, 23, 33, 35, 37 ] }
MemdevList *FUNC_0(Error **errp) { Object *obj; MemdevList *list = NULL; obj = object_get_objects_root(); if (obj == NULL) { return NULL; } if (object_child_foreach(obj, query_memdev, &list) != 0) { goto error; } return list; error: qapi_free_MemdevList(list); return NULL; }
[ "MemdevList *FUNC_0(Error **errp)\n{", "Object *obj;", "MemdevList *list = NULL;", "obj = object_get_objects_root();", "if (obj == NULL) {", "return NULL;", "}", "if (object_child_foreach(obj, query_memdev, &list) != 0) {", "goto error;", "}", "return list;", "error:\nqapi_free_MemdevList(list);", "return NULL;", "}" ]
[ 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 33, 35 ], [ 37 ], [ 39 ] ]
11,099
static void create_cpu_without_cps(const char *cpu_model, qemu_irq *cbus_irq, qemu_irq *i8259_irq) { CPUMIPSState *env; MIPSCPU *cpu; int i; for (i = 0; i < smp_cpus; i++) { cpu = cpu_mips_init(cpu_model); if (cpu == NULL) { fprintf(stderr, "Unable to find CPU definition\n"); exit(1); } /* Init internal devices */ cpu_mips_irq_init_cpu(cpu); cpu_mips_clock_init(cpu); qemu_register_reset(main_cpu_reset, cpu); } cpu = MIPS_CPU(first_cpu); env = &cpu->env; *i8259_irq = env->irq[2]; *cbus_irq = env->irq[4]; }
true
qemu
4482e05cbbb7e50e476f6a9500cf0b38913bd939
static void create_cpu_without_cps(const char *cpu_model, qemu_irq *cbus_irq, qemu_irq *i8259_irq) { CPUMIPSState *env; MIPSCPU *cpu; int i; for (i = 0; i < smp_cpus; i++) { cpu = cpu_mips_init(cpu_model); if (cpu == NULL) { fprintf(stderr, "Unable to find CPU definition\n"); exit(1); } cpu_mips_irq_init_cpu(cpu); cpu_mips_clock_init(cpu); qemu_register_reset(main_cpu_reset, cpu); } cpu = MIPS_CPU(first_cpu); env = &cpu->env; *i8259_irq = env->irq[2]; *cbus_irq = env->irq[4]; }
{ "code": [ " exit(1);", " if (cpu == NULL) {", " 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);", " if (cpu == NULL) {", " exit(1);", " if (cpu == NULL) {", " exit(1);", " if (cpu == NULL) {", " if (cpu == NULL) {" ], "line_no": [ 23, 19, 19, 21, 23, 19, 23, 19, 23, 19, 23, 19, 23, 19, 23, 19, 19 ] }
static void FUNC_0(const char *VAR_0, qemu_irq *VAR_1, qemu_irq *VAR_2) { CPUMIPSState *env; MIPSCPU *cpu; int VAR_3; for (VAR_3 = 0; VAR_3 < smp_cpus; VAR_3++) { cpu = cpu_mips_init(VAR_0); if (cpu == NULL) { fprintf(stderr, "Unable to find CPU definition\n"); exit(1); } cpu_mips_irq_init_cpu(cpu); cpu_mips_clock_init(cpu); qemu_register_reset(main_cpu_reset, cpu); } cpu = MIPS_CPU(first_cpu); env = &cpu->env; *VAR_2 = env->irq[2]; *VAR_1 = env->irq[4]; }
[ "static void FUNC_0(const char *VAR_0,\nqemu_irq *VAR_1, qemu_irq *VAR_2)\n{", "CPUMIPSState *env;", "MIPSCPU *cpu;", "int VAR_3;", "for (VAR_3 = 0; VAR_3 < smp_cpus; VAR_3++) {", "cpu = cpu_mips_init(VAR_0);", "if (cpu == NULL) {", "fprintf(stderr, \"Unable to find CPU definition\\n\");", "exit(1);", "}", "cpu_mips_irq_init_cpu(cpu);", "cpu_mips_clock_init(cpu);", "qemu_register_reset(main_cpu_reset, cpu);", "}", "cpu = MIPS_CPU(first_cpu);", "env = &cpu->env;", "*VAR_2 = env->irq[2];", "*VAR_1 = env->irq[4];", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ] ]
11,100
static void qmf_32_subbands(DCAContext * s, int chans, float samples_in[32][8], float *samples_out, float scale) { const float *prCoeff; int i; int sb_act = s->subband_activity[chans]; int subindex; scale *= sqrt(1/8.0); /* Select filter */ if (!s->multirate_inter) /* Non-perfect reconstruction */ prCoeff = fir_32bands_nonperfect; else /* Perfect reconstruction */ prCoeff = fir_32bands_perfect; for (i = sb_act; i < 32; i++) s->raXin[i] = 0.0; /* Reconstructed channel sample index */ for (subindex = 0; subindex < 8; subindex++) { /* Load in one sample from each subband and clear inactive subbands */ for (i = 0; i < sb_act; i++){ uint32_t v = AV_RN32A(&samples_in[i][subindex]) ^ ((i-1)&2)<<30; AV_WN32A(&s->raXin[i], v); } s->synth.synth_filter_float(&s->imdct, s->subband_fir_hist[chans], &s->hist_index[chans], s->subband_fir_noidea[chans], prCoeff, samples_out, s->raXin, scale); samples_out+= 32; } }
true
FFmpeg
559c244d42be7a02c23976216b47fd63b80d6c7f
static void qmf_32_subbands(DCAContext * s, int chans, float samples_in[32][8], float *samples_out, float scale) { const float *prCoeff; int i; int sb_act = s->subband_activity[chans]; int subindex; scale *= sqrt(1/8.0); if (!s->multirate_inter) prCoeff = fir_32bands_nonperfect; else prCoeff = fir_32bands_perfect; for (i = sb_act; i < 32; i++) s->raXin[i] = 0.0; for (subindex = 0; subindex < 8; subindex++) { for (i = 0; i < sb_act; i++){ uint32_t v = AV_RN32A(&samples_in[i][subindex]) ^ ((i-1)&2)<<30; AV_WN32A(&s->raXin[i], v); } s->synth.synth_filter_float(&s->imdct, s->subband_fir_hist[chans], &s->hist_index[chans], s->subband_fir_noidea[chans], prCoeff, samples_out, s->raXin, scale); samples_out+= 32; } }
{ "code": [ " uint32_t v = AV_RN32A(&samples_in[i][subindex]) ^ ((i-1)&2)<<30;" ], "line_no": [ 51 ] }
static void FUNC_0(DCAContext * VAR_0, int VAR_1, float VAR_2[32][8], float *VAR_3, float VAR_4) { const float *VAR_5; int VAR_6; int VAR_7 = VAR_0->subband_activity[VAR_1]; int VAR_8; VAR_4 *= sqrt(1/8.0); if (!VAR_0->multirate_inter) VAR_5 = fir_32bands_nonperfect; else VAR_5 = fir_32bands_perfect; for (VAR_6 = VAR_7; VAR_6 < 32; VAR_6++) VAR_0->raXin[VAR_6] = 0.0; for (VAR_8 = 0; VAR_8 < 8; VAR_8++) { for (VAR_6 = 0; VAR_6 < VAR_7; VAR_6++){ uint32_t v = AV_RN32A(&VAR_2[VAR_6][VAR_8]) ^ ((VAR_6-1)&2)<<30; AV_WN32A(&VAR_0->raXin[VAR_6], v); } VAR_0->synth.synth_filter_float(&VAR_0->imdct, VAR_0->subband_fir_hist[VAR_1], &VAR_0->hist_index[VAR_1], VAR_0->subband_fir_noidea[VAR_1], VAR_5, VAR_3, VAR_0->raXin, VAR_4); VAR_3+= 32; } }
[ "static void FUNC_0(DCAContext * VAR_0, int VAR_1,\nfloat VAR_2[32][8], float *VAR_3,\nfloat VAR_4)\n{", "const float *VAR_5;", "int VAR_6;", "int VAR_7 = VAR_0->subband_activity[VAR_1];", "int VAR_8;", "VAR_4 *= sqrt(1/8.0);", "if (!VAR_0->multirate_inter)\nVAR_5 = fir_32bands_nonperfect;", "else\nVAR_5 = fir_32bands_perfect;", "for (VAR_6 = VAR_7; VAR_6 < 32; VAR_6++)", "VAR_0->raXin[VAR_6] = 0.0;", "for (VAR_8 = 0; VAR_8 < 8; VAR_8++) {", "for (VAR_6 = 0; VAR_6 < VAR_7; VAR_6++){", "uint32_t v = AV_RN32A(&VAR_2[VAR_6][VAR_8]) ^ ((VAR_6-1)&2)<<30;", "AV_WN32A(&VAR_0->raXin[VAR_6], v);", "}", "VAR_0->synth.synth_filter_float(&VAR_0->imdct,\nVAR_0->subband_fir_hist[VAR_1], &VAR_0->hist_index[VAR_1],\nVAR_0->subband_fir_noidea[VAR_1], VAR_5,\nVAR_3, VAR_0->raXin, VAR_4);", "VAR_3+= 32;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 21 ], [ 27, 29 ], [ 31, 33 ], [ 37 ], [ 39 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59, 61, 63, 65 ], [ 67 ], [ 71 ], [ 73 ] ]
11,101
static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref) { AVFilterContext *ctx = inlink->dst; SeparateFieldsContext *sf = ctx->priv; AVFilterLink *outlink = ctx->outputs[0]; AVFrame *second; int i, ret; inpicref->height = outlink->h; inpicref->interlaced_frame = 0; second = av_frame_clone(inpicref); if (!second) return AVERROR(ENOMEM); for (i = 0; i < sf->nb_planes; i++) { if (!inpicref->top_field_first) inpicref->data[i] = inpicref->data[i] + inpicref->linesize[i]; else second->data[i] = second->data[i] + second->linesize[i]; inpicref->linesize[i] *= 2; second->linesize[i] *= 2; } inpicref->pts = outlink->frame_count * sf->ts_unit; ret = ff_filter_frame(outlink, inpicref); if (ret < 0) return ret; second->pts = outlink->frame_count * sf->ts_unit; return ff_filter_frame(outlink, second); }
true
FFmpeg
e7834d29f2a8f572a5bdf173d56b5a9b5af16043
static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref) { AVFilterContext *ctx = inlink->dst; SeparateFieldsContext *sf = ctx->priv; AVFilterLink *outlink = ctx->outputs[0]; AVFrame *second; int i, ret; inpicref->height = outlink->h; inpicref->interlaced_frame = 0; second = av_frame_clone(inpicref); if (!second) return AVERROR(ENOMEM); for (i = 0; i < sf->nb_planes; i++) { if (!inpicref->top_field_first) inpicref->data[i] = inpicref->data[i] + inpicref->linesize[i]; else second->data[i] = second->data[i] + second->linesize[i]; inpicref->linesize[i] *= 2; second->linesize[i] *= 2; } inpicref->pts = outlink->frame_count * sf->ts_unit; ret = ff_filter_frame(outlink, inpicref); if (ret < 0) return ret; second->pts = outlink->frame_count * sf->ts_unit; return ff_filter_frame(outlink, second); }
{ "code": [ " if (ret < 0)" ], "line_no": [ 53 ] }
static int FUNC_0(AVFilterLink *VAR_0, AVFrame *VAR_1) { AVFilterContext *ctx = VAR_0->dst; SeparateFieldsContext *sf = ctx->priv; AVFilterLink *outlink = ctx->outputs[0]; AVFrame *second; int VAR_2, VAR_3; VAR_1->height = outlink->h; VAR_1->interlaced_frame = 0; second = av_frame_clone(VAR_1); if (!second) return AVERROR(ENOMEM); for (VAR_2 = 0; VAR_2 < sf->nb_planes; VAR_2++) { if (!VAR_1->top_field_first) VAR_1->data[VAR_2] = VAR_1->data[VAR_2] + VAR_1->linesize[VAR_2]; else second->data[VAR_2] = second->data[VAR_2] + second->linesize[VAR_2]; VAR_1->linesize[VAR_2] *= 2; second->linesize[VAR_2] *= 2; } VAR_1->pts = outlink->frame_count * sf->ts_unit; VAR_3 = ff_filter_frame(outlink, VAR_1); if (VAR_3 < 0) return VAR_3; second->pts = outlink->frame_count * sf->ts_unit; return ff_filter_frame(outlink, second); }
[ "static int FUNC_0(AVFilterLink *VAR_0, AVFrame *VAR_1)\n{", "AVFilterContext *ctx = VAR_0->dst;", "SeparateFieldsContext *sf = ctx->priv;", "AVFilterLink *outlink = ctx->outputs[0];", "AVFrame *second;", "int VAR_2, VAR_3;", "VAR_1->height = outlink->h;", "VAR_1->interlaced_frame = 0;", "second = av_frame_clone(VAR_1);", "if (!second)\nreturn AVERROR(ENOMEM);", "for (VAR_2 = 0; VAR_2 < sf->nb_planes; VAR_2++) {", "if (!VAR_1->top_field_first)\nVAR_1->data[VAR_2] = VAR_1->data[VAR_2] + VAR_1->linesize[VAR_2];", "else\nsecond->data[VAR_2] = second->data[VAR_2] + second->linesize[VAR_2];", "VAR_1->linesize[VAR_2] *= 2;", "second->linesize[VAR_2] *= 2;", "}", "VAR_1->pts = outlink->frame_count * sf->ts_unit;", "VAR_3 = ff_filter_frame(outlink, VAR_1);", "if (VAR_3 < 0)\nreturn VAR_3;", "second->pts = outlink->frame_count * sf->ts_unit;", "return ff_filter_frame(outlink, second);", "}" ]
[ 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 ], [ 17 ], [ 19 ], [ 23 ], [ 25, 27 ], [ 31 ], [ 33, 35 ], [ 37, 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53, 55 ], [ 59 ], [ 61 ], [ 63 ] ]
11,102
int nbd_receive_reply(int csock, struct nbd_reply *reply) { uint8_t buf[NBD_REPLY_SIZE]; uint32_t magic; memset(buf, 0xAA, sizeof(buf)); if (read_sync(csock, buf, sizeof(buf)) != sizeof(buf)) { LOG("read failed"); errno = EINVAL; return -1; } /* Reply [ 0 .. 3] magic (NBD_REPLY_MAGIC) [ 4 .. 7] error (0 == no error) [ 7 .. 15] handle */ magic = be32_to_cpup((uint32_t*)buf); reply->error = be32_to_cpup((uint32_t*)(buf + 4)); reply->handle = be64_to_cpup((uint64_t*)(buf + 8)); TRACE("Got reply: " "{ magic = 0x%x, .error = %d, handle = %" PRIu64" }", magic, reply->error, reply->handle); if (magic != NBD_REPLY_MAGIC) { LOG("invalid magic (got 0x%x)", magic); errno = EINVAL; return -1; } return 0; }
true
qemu
94e7340b5db8bce7866e44e700ffa8fd26585c7e
int nbd_receive_reply(int csock, struct nbd_reply *reply) { uint8_t buf[NBD_REPLY_SIZE]; uint32_t magic; memset(buf, 0xAA, sizeof(buf)); if (read_sync(csock, buf, sizeof(buf)) != sizeof(buf)) { LOG("read failed"); errno = EINVAL; return -1; } magic = be32_to_cpup((uint32_t*)buf); reply->error = be32_to_cpup((uint32_t*)(buf + 4)); reply->handle = be64_to_cpup((uint64_t*)(buf + 8)); TRACE("Got reply: " "{ magic = 0x%x, .error = %d, handle = %" PRIu64" }", magic, reply->error, reply->handle); if (magic != NBD_REPLY_MAGIC) { LOG("invalid magic (got 0x%x)", magic); errno = EINVAL; return -1; } return 0; }
{ "code": [ "int nbd_receive_reply(int csock, struct nbd_reply *reply)", " memset(buf, 0xAA, sizeof(buf));" ], "line_no": [ 1, 11 ] }
int FUNC_0(int VAR_0, struct nbd_reply *VAR_1) { uint8_t buf[NBD_REPLY_SIZE]; uint32_t magic; memset(buf, 0xAA, sizeof(buf)); if (read_sync(VAR_0, buf, sizeof(buf)) != sizeof(buf)) { LOG("read failed"); errno = EINVAL; return -1; } magic = be32_to_cpup((uint32_t*)buf); VAR_1->error = be32_to_cpup((uint32_t*)(buf + 4)); VAR_1->handle = be64_to_cpup((uint64_t*)(buf + 8)); TRACE("Got VAR_1: " "{ magic = 0x%x, .error = %d, handle = %" PRIu64" }", magic, VAR_1->error, VAR_1->handle); if (magic != NBD_REPLY_MAGIC) { LOG("invalid magic (got 0x%x)", magic); errno = EINVAL; return -1; } return 0; }
[ "int FUNC_0(int VAR_0, struct nbd_reply *VAR_1)\n{", "uint8_t buf[NBD_REPLY_SIZE];", "uint32_t magic;", "memset(buf, 0xAA, sizeof(buf));", "if (read_sync(VAR_0, buf, sizeof(buf)) != sizeof(buf)) {", "LOG(\"read failed\");", "errno = EINVAL;", "return -1;", "}", "magic = be32_to_cpup((uint32_t*)buf);", "VAR_1->error = be32_to_cpup((uint32_t*)(buf + 4));", "VAR_1->handle = be64_to_cpup((uint64_t*)(buf + 8));", "TRACE(\"Got VAR_1: \"\n\"{ magic = 0x%x, .error = %d, handle = %\" PRIu64\" }\",", "magic, VAR_1->error, VAR_1->handle);", "if (magic != NBD_REPLY_MAGIC) {", "LOG(\"invalid magic (got 0x%x)\", magic);", "errno = EINVAL;", "return -1;", "}", "return 0;", "}" ]
[ 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 39 ], [ 41 ], [ 43 ], [ 47, 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ] ]
11,103
static int file_write(URLContext *h, const unsigned char *buf, int size) { FileContext *c = h->priv_data; int r = write(c->fd, buf, size); return (-1 == r)?AVERROR(errno):r; }
false
FFmpeg
a8f171151f0f027abb06f72e48c44929616a84cb
static int file_write(URLContext *h, const unsigned char *buf, int size) { FileContext *c = h->priv_data; int r = write(c->fd, buf, size); return (-1 == r)?AVERROR(errno):r; }
{ "code": [], "line_no": [] }
static int FUNC_0(URLContext *VAR_0, const unsigned char *VAR_1, int VAR_2) { FileContext *c = VAR_0->priv_data; int VAR_3 = write(c->fd, VAR_1, VAR_2); return (-1 == VAR_3)?AVERROR(errno):VAR_3; }
[ "static int FUNC_0(URLContext *VAR_0, const unsigned char *VAR_1, int VAR_2)\n{", "FileContext *c = VAR_0->priv_data;", "int VAR_3 = write(c->fd, VAR_1, VAR_2);", "return (-1 == VAR_3)?AVERROR(errno):VAR_3;", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ] ]
11,104
static void calc_transform_coeffs_cpl(AC3DecodeContext *s) { int bin, band, ch, band_end; bin = s->start_freq[CPL_CH]; for (band = 0; band < s->num_cpl_bands; band++) { band_end = bin + s->cpl_band_sizes[band]; for (; bin < band_end; bin++) { for (ch = 1; ch <= s->fbw_channels; ch++) { if (s->channel_in_cpl[ch]) { s->fixed_coeffs[ch][bin] = ((int64_t)s->fixed_coeffs[CPL_CH][bin] * (int64_t)s->cpl_coords[ch][band]) >> 23; if (ch == 2 && s->phase_flags[band]) s->fixed_coeffs[ch][bin] = -s->fixed_coeffs[ch][bin]; } } } } }
false
FFmpeg
3b6c5ad2f67cc8eeeec89fb9d497ec79c1f3948a
static void calc_transform_coeffs_cpl(AC3DecodeContext *s) { int bin, band, ch, band_end; bin = s->start_freq[CPL_CH]; for (band = 0; band < s->num_cpl_bands; band++) { band_end = bin + s->cpl_band_sizes[band]; for (; bin < band_end; bin++) { for (ch = 1; ch <= s->fbw_channels; ch++) { if (s->channel_in_cpl[ch]) { s->fixed_coeffs[ch][bin] = ((int64_t)s->fixed_coeffs[CPL_CH][bin] * (int64_t)s->cpl_coords[ch][band]) >> 23; if (ch == 2 && s->phase_flags[band]) s->fixed_coeffs[ch][bin] = -s->fixed_coeffs[ch][bin]; } } } } }
{ "code": [], "line_no": [] }
static void FUNC_0(AC3DecodeContext *VAR_0) { int VAR_1, VAR_2, VAR_3, VAR_4; VAR_1 = VAR_0->start_freq[CPL_CH]; for (VAR_2 = 0; VAR_2 < VAR_0->num_cpl_bands; VAR_2++) { VAR_4 = VAR_1 + VAR_0->cpl_band_sizes[VAR_2]; for (; VAR_1 < VAR_4; VAR_1++) { for (VAR_3 = 1; VAR_3 <= VAR_0->fbw_channels; VAR_3++) { if (VAR_0->channel_in_cpl[VAR_3]) { VAR_0->fixed_coeffs[VAR_3][VAR_1] = ((int64_t)VAR_0->fixed_coeffs[CPL_CH][VAR_1] * (int64_t)VAR_0->cpl_coords[VAR_3][VAR_2]) >> 23; if (VAR_3 == 2 && VAR_0->phase_flags[VAR_2]) VAR_0->fixed_coeffs[VAR_3][VAR_1] = -VAR_0->fixed_coeffs[VAR_3][VAR_1]; } } } } }
[ "static void FUNC_0(AC3DecodeContext *VAR_0)\n{", "int VAR_1, VAR_2, VAR_3, VAR_4;", "VAR_1 = VAR_0->start_freq[CPL_CH];", "for (VAR_2 = 0; VAR_2 < VAR_0->num_cpl_bands; VAR_2++) {", "VAR_4 = VAR_1 + VAR_0->cpl_band_sizes[VAR_2];", "for (; VAR_1 < VAR_4; VAR_1++) {", "for (VAR_3 = 1; VAR_3 <= VAR_0->fbw_channels; VAR_3++) {", "if (VAR_0->channel_in_cpl[VAR_3]) {", "VAR_0->fixed_coeffs[VAR_3][VAR_1] = ((int64_t)VAR_0->fixed_coeffs[CPL_CH][VAR_1] *\n(int64_t)VAR_0->cpl_coords[VAR_3][VAR_2]) >> 23;", "if (VAR_3 == 2 && VAR_0->phase_flags[VAR_2])\nVAR_0->fixed_coeffs[VAR_3][VAR_1] = -VAR_0->fixed_coeffs[VAR_3][VAR_1];", "}", "}", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21, 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ] ]
11,105
int ff_dirac_golomb_read_16bit(DiracGolombLUT *lut_ctx, const uint8_t *buf, int bytes, uint8_t *_dst, int coeffs) { int i, b, c_idx = 0; int16_t *dst = (int16_t *)_dst; DiracGolombLUT *future[4], *l = &lut_ctx[2*LUT_SIZE + buf[0]]; INIT_RESIDUE(res); for (b = 1; b <= bytes; b++) { future[0] = &lut_ctx[buf[b]]; future[1] = future[0] + 1*LUT_SIZE; future[2] = future[0] + 2*LUT_SIZE; future[3] = future[0] + 3*LUT_SIZE; if ((c_idx + 1) > coeffs) return c_idx; if (res_bits && l->sign) { int32_t coeff = 1; APPEND_RESIDUE(res, l->preamble); for (i = 0; i < (res_bits >> 1) - 1; i++) { coeff <<= 1; coeff |= (res >> (RSIZE_BITS - 2*i - 2)) & 1; } dst[c_idx++] = l->sign * (coeff - 1); SET_RESIDUE(res, 0, 0); } for (i = 0; i < LUT_BITS; i++) dst[c_idx + i] = l->ready[i]; c_idx += l->ready_num; APPEND_RESIDUE(res, l->leftover); l = future[l->need_s ? 3 : !res_bits ? 2 : res_bits & 1]; } return c_idx; }
false
FFmpeg
f41e37b84f3d57c29d4a2a21f9337159135b981d
int ff_dirac_golomb_read_16bit(DiracGolombLUT *lut_ctx, const uint8_t *buf, int bytes, uint8_t *_dst, int coeffs) { int i, b, c_idx = 0; int16_t *dst = (int16_t *)_dst; DiracGolombLUT *future[4], *l = &lut_ctx[2*LUT_SIZE + buf[0]]; INIT_RESIDUE(res); for (b = 1; b <= bytes; b++) { future[0] = &lut_ctx[buf[b]]; future[1] = future[0] + 1*LUT_SIZE; future[2] = future[0] + 2*LUT_SIZE; future[3] = future[0] + 3*LUT_SIZE; if ((c_idx + 1) > coeffs) return c_idx; if (res_bits && l->sign) { int32_t coeff = 1; APPEND_RESIDUE(res, l->preamble); for (i = 0; i < (res_bits >> 1) - 1; i++) { coeff <<= 1; coeff |= (res >> (RSIZE_BITS - 2*i - 2)) & 1; } dst[c_idx++] = l->sign * (coeff - 1); SET_RESIDUE(res, 0, 0); } for (i = 0; i < LUT_BITS; i++) dst[c_idx + i] = l->ready[i]; c_idx += l->ready_num; APPEND_RESIDUE(res, l->leftover); l = future[l->need_s ? 3 : !res_bits ? 2 : res_bits & 1]; } return c_idx; }
{ "code": [], "line_no": [] }
int FUNC_0(DiracGolombLUT *VAR_0, const uint8_t *VAR_1, int VAR_2, uint8_t *VAR_3, int VAR_4) { int VAR_5, VAR_6, VAR_7 = 0; int16_t *dst = (int16_t *)VAR_3; DiracGolombLUT *future[4], *l = &VAR_0[2*LUT_SIZE + VAR_1[0]]; INIT_RESIDUE(res); for (VAR_6 = 1; VAR_6 <= VAR_2; VAR_6++) { future[0] = &VAR_0[VAR_1[VAR_6]]; future[1] = future[0] + 1*LUT_SIZE; future[2] = future[0] + 2*LUT_SIZE; future[3] = future[0] + 3*LUT_SIZE; if ((VAR_7 + 1) > VAR_4) return VAR_7; if (res_bits && l->sign) { int32_t coeff = 1; APPEND_RESIDUE(res, l->preamble); for (VAR_5 = 0; VAR_5 < (res_bits >> 1) - 1; VAR_5++) { coeff <<= 1; coeff |= (res >> (RSIZE_BITS - 2*VAR_5 - 2)) & 1; } dst[VAR_7++] = l->sign * (coeff - 1); SET_RESIDUE(res, 0, 0); } for (VAR_5 = 0; VAR_5 < LUT_BITS; VAR_5++) dst[VAR_7 + VAR_5] = l->ready[VAR_5]; VAR_7 += l->ready_num; APPEND_RESIDUE(res, l->leftover); l = future[l->need_s ? 3 : !res_bits ? 2 : res_bits & 1]; } return VAR_7; }
[ "int FUNC_0(DiracGolombLUT *VAR_0, const uint8_t *VAR_1,\nint VAR_2, uint8_t *VAR_3, int VAR_4)\n{", "int VAR_5, VAR_6, VAR_7 = 0;", "int16_t *dst = (int16_t *)VAR_3;", "DiracGolombLUT *future[4], *l = &VAR_0[2*LUT_SIZE + VAR_1[0]];", "INIT_RESIDUE(res);", "for (VAR_6 = 1; VAR_6 <= VAR_2; VAR_6++) {", "future[0] = &VAR_0[VAR_1[VAR_6]];", "future[1] = future[0] + 1*LUT_SIZE;", "future[2] = future[0] + 2*LUT_SIZE;", "future[3] = future[0] + 3*LUT_SIZE;", "if ((VAR_7 + 1) > VAR_4)\nreturn VAR_7;", "if (res_bits && l->sign) {", "int32_t coeff = 1;", "APPEND_RESIDUE(res, l->preamble);", "for (VAR_5 = 0; VAR_5 < (res_bits >> 1) - 1; VAR_5++) {", "coeff <<= 1;", "coeff |= (res >> (RSIZE_BITS - 2*VAR_5 - 2)) & 1;", "}", "dst[VAR_7++] = l->sign * (coeff - 1);", "SET_RESIDUE(res, 0, 0);", "}", "for (VAR_5 = 0; VAR_5 < LUT_BITS; VAR_5++)", "dst[VAR_7 + VAR_5] = l->ready[VAR_5];", "VAR_7 += l->ready_num;", "APPEND_RESIDUE(res, l->leftover);", "l = future[l->need_s ? 3 : !res_bits ? 2 : res_bits & 1];", "}", "return VAR_7;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29, 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 69 ], [ 71 ], [ 75 ], [ 77 ] ]
11,106
void ff_celt_quant_bands(CeltFrame *f, OpusRangeCoder *rc) { float lowband_scratch[8 * 22]; float norm1[2 * 8 * 100]; float *norm2 = norm1 + 8 * 100; int totalbits = (f->framebits << 3) - f->anticollapse_needed; int update_lowband = 1; int lowband_offset = 0; int i, j; for (i = f->start_band; i < f->end_band; i++) { uint32_t cm[2] = { (1 << f->blocks) - 1, (1 << f->blocks) - 1 }; int band_offset = ff_celt_freq_bands[i] << f->size; int band_size = ff_celt_freq_range[i] << f->size; float *X = f->block[0].coeffs + band_offset; float *Y = (f->channels == 2) ? f->block[1].coeffs + band_offset : NULL; float *norm_loc1, *norm_loc2; int consumed = opus_rc_tell_frac(rc); int effective_lowband = -1; int b = 0; /* Compute how many bits we want to allocate to this band */ if (i != f->start_band) f->remaining -= consumed; f->remaining2 = totalbits - consumed - 1; if (i <= f->coded_bands - 1) { int curr_balance = f->remaining / FFMIN(3, f->coded_bands-i); b = av_clip_uintp2(FFMIN(f->remaining2 + 1, f->pulses[i] + curr_balance), 14); } if ((ff_celt_freq_bands[i] - ff_celt_freq_range[i] >= ff_celt_freq_bands[f->start_band] || i == f->start_band + 1) && (update_lowband || lowband_offset == 0)) lowband_offset = i; if (i == f->start_band + 1) { /* Special Hybrid Folding (RFC 8251 section 9). Copy the first band into the second to ensure the second band never has to use the LCG. */ int offset = 8 * ff_celt_freq_bands[i]; int count = 8 * (ff_celt_freq_range[i] - ff_celt_freq_range[i-1]); memcpy(&norm1[offset], &norm1[offset - count], count * sizeof(float)); if (f->channels == 2) memcpy(&norm2[offset], &norm2[offset - count], count * sizeof(float)); } /* Get a conservative estimate of the collapse_mask's for the bands we're going to be folding from. */ if (lowband_offset != 0 && (f->spread != CELT_SPREAD_AGGRESSIVE || f->blocks > 1 || f->tf_change[i] < 0)) { int foldstart, foldend; /* This ensures we never repeat spectral content within one band */ effective_lowband = FFMAX(ff_celt_freq_bands[f->start_band], ff_celt_freq_bands[lowband_offset] - ff_celt_freq_range[i]); foldstart = lowband_offset; while (ff_celt_freq_bands[--foldstart] > effective_lowband); foldend = lowband_offset - 1; while (++foldend < i && ff_celt_freq_bands[foldend] < effective_lowband + ff_celt_freq_range[i]); cm[0] = cm[1] = 0; for (j = foldstart; j < foldend; j++) { cm[0] |= f->block[0].collapse_masks[j]; cm[1] |= f->block[f->channels - 1].collapse_masks[j]; } } if (f->dual_stereo && i == f->intensity_stereo) { /* Switch off dual stereo to do intensity */ f->dual_stereo = 0; for (j = ff_celt_freq_bands[f->start_band] << f->size; j < band_offset; j++) norm1[j] = (norm1[j] + norm2[j]) / 2; } norm_loc1 = effective_lowband != -1 ? norm1 + (effective_lowband << f->size) : NULL; norm_loc2 = effective_lowband != -1 ? norm2 + (effective_lowband << f->size) : NULL; if (f->dual_stereo) { cm[0] = f->pvq->quant_band(f->pvq, f, rc, i, X, NULL, band_size, b >> 1, f->blocks, norm_loc1, f->size, norm1 + band_offset, 0, 1.0f, lowband_scratch, cm[0]); cm[1] = f->pvq->quant_band(f->pvq, f, rc, i, Y, NULL, band_size, b >> 1, f->blocks, norm_loc2, f->size, norm2 + band_offset, 0, 1.0f, lowband_scratch, cm[1]); } else { cm[0] = f->pvq->quant_band(f->pvq, f, rc, i, X, Y, band_size, b >> 0, f->blocks, norm_loc1, f->size, norm1 + band_offset, 0, 1.0f, lowband_scratch, cm[0] | cm[1]); cm[1] = cm[0]; } f->block[0].collapse_masks[i] = (uint8_t)cm[0]; f->block[f->channels - 1].collapse_masks[i] = (uint8_t)cm[1]; f->remaining += f->pulses[i] + consumed; /* Update the folding position only as long as we have 1 bit/sample depth */ update_lowband = (b > band_size << 3); } }
true
FFmpeg
4678339e745dac8fa4288541b79f1577f19bb4c2
void ff_celt_quant_bands(CeltFrame *f, OpusRangeCoder *rc) { float lowband_scratch[8 * 22]; float norm1[2 * 8 * 100]; float *norm2 = norm1 + 8 * 100; int totalbits = (f->framebits << 3) - f->anticollapse_needed; int update_lowband = 1; int lowband_offset = 0; int i, j; for (i = f->start_band; i < f->end_band; i++) { uint32_t cm[2] = { (1 << f->blocks) - 1, (1 << f->blocks) - 1 }; int band_offset = ff_celt_freq_bands[i] << f->size; int band_size = ff_celt_freq_range[i] << f->size; float *X = f->block[0].coeffs + band_offset; float *Y = (f->channels == 2) ? f->block[1].coeffs + band_offset : NULL; float *norm_loc1, *norm_loc2; int consumed = opus_rc_tell_frac(rc); int effective_lowband = -1; int b = 0; if (i != f->start_band) f->remaining -= consumed; f->remaining2 = totalbits - consumed - 1; if (i <= f->coded_bands - 1) { int curr_balance = f->remaining / FFMIN(3, f->coded_bands-i); b = av_clip_uintp2(FFMIN(f->remaining2 + 1, f->pulses[i] + curr_balance), 14); } if ((ff_celt_freq_bands[i] - ff_celt_freq_range[i] >= ff_celt_freq_bands[f->start_band] || i == f->start_band + 1) && (update_lowband || lowband_offset == 0)) lowband_offset = i; if (i == f->start_band + 1) { int offset = 8 * ff_celt_freq_bands[i]; int count = 8 * (ff_celt_freq_range[i] - ff_celt_freq_range[i-1]); memcpy(&norm1[offset], &norm1[offset - count], count * sizeof(float)); if (f->channels == 2) memcpy(&norm2[offset], &norm2[offset - count], count * sizeof(float)); } if (lowband_offset != 0 && (f->spread != CELT_SPREAD_AGGRESSIVE || f->blocks > 1 || f->tf_change[i] < 0)) { int foldstart, foldend; effective_lowband = FFMAX(ff_celt_freq_bands[f->start_band], ff_celt_freq_bands[lowband_offset] - ff_celt_freq_range[i]); foldstart = lowband_offset; while (ff_celt_freq_bands[--foldstart] > effective_lowband); foldend = lowband_offset - 1; while (++foldend < i && ff_celt_freq_bands[foldend] < effective_lowband + ff_celt_freq_range[i]); cm[0] = cm[1] = 0; for (j = foldstart; j < foldend; j++) { cm[0] |= f->block[0].collapse_masks[j]; cm[1] |= f->block[f->channels - 1].collapse_masks[j]; } } if (f->dual_stereo && i == f->intensity_stereo) { f->dual_stereo = 0; for (j = ff_celt_freq_bands[f->start_band] << f->size; j < band_offset; j++) norm1[j] = (norm1[j] + norm2[j]) / 2; } norm_loc1 = effective_lowband != -1 ? norm1 + (effective_lowband << f->size) : NULL; norm_loc2 = effective_lowband != -1 ? norm2 + (effective_lowband << f->size) : NULL; if (f->dual_stereo) { cm[0] = f->pvq->quant_band(f->pvq, f, rc, i, X, NULL, band_size, b >> 1, f->blocks, norm_loc1, f->size, norm1 + band_offset, 0, 1.0f, lowband_scratch, cm[0]); cm[1] = f->pvq->quant_band(f->pvq, f, rc, i, Y, NULL, band_size, b >> 1, f->blocks, norm_loc2, f->size, norm2 + band_offset, 0, 1.0f, lowband_scratch, cm[1]); } else { cm[0] = f->pvq->quant_band(f->pvq, f, rc, i, X, Y, band_size, b >> 0, f->blocks, norm_loc1, f->size, norm1 + band_offset, 0, 1.0f, lowband_scratch, cm[0] | cm[1]); cm[1] = cm[0]; } f->block[0].collapse_masks[i] = (uint8_t)cm[0]; f->block[f->channels - 1].collapse_masks[i] = (uint8_t)cm[1]; f->remaining += f->pulses[i] + consumed; update_lowband = (b > band_size << 3); } }
{ "code": [ " int offset = 8 * ff_celt_freq_bands[i];", " int count = 8 * (ff_celt_freq_range[i] - ff_celt_freq_range[i-1]);", " memcpy(&norm1[offset], &norm1[offset - count], count * sizeof(float));", " memcpy(&norm2[offset], &norm2[offset - count], count * sizeof(float));" ], "line_no": [ 83, 85, 89, 95 ] }
void FUNC_0(CeltFrame *VAR_0, OpusRangeCoder *VAR_1) { float VAR_2[8 * 22]; float VAR_3[2 * 8 * 100]; float *VAR_4 = VAR_3 + 8 * 100; int VAR_5 = (VAR_0->framebits << 3) - VAR_0->anticollapse_needed; int VAR_6 = 1; int VAR_7 = 0; int VAR_8, VAR_9; for (VAR_8 = VAR_0->start_band; VAR_8 < VAR_0->end_band; VAR_8++) { uint32_t cm[2] = { (1 << VAR_0->blocks) - 1, (1 << VAR_0->blocks) - 1 }; int band_offset = ff_celt_freq_bands[VAR_8] << VAR_0->size; int band_size = ff_celt_freq_range[VAR_8] << VAR_0->size; float *X = VAR_0->block[0].coeffs + band_offset; float *Y = (VAR_0->channels == 2) ? VAR_0->block[1].coeffs + band_offset : NULL; float *norm_loc1, *norm_loc2; int consumed = opus_rc_tell_frac(VAR_1); int effective_lowband = -1; int b = 0; if (VAR_8 != VAR_0->start_band) VAR_0->remaining -= consumed; VAR_0->remaining2 = VAR_5 - consumed - 1; if (VAR_8 <= VAR_0->coded_bands - 1) { int curr_balance = VAR_0->remaining / FFMIN(3, VAR_0->coded_bands-VAR_8); b = av_clip_uintp2(FFMIN(VAR_0->remaining2 + 1, VAR_0->pulses[VAR_8] + curr_balance), 14); } if ((ff_celt_freq_bands[VAR_8] - ff_celt_freq_range[VAR_8] >= ff_celt_freq_bands[VAR_0->start_band] || VAR_8 == VAR_0->start_band + 1) && (VAR_6 || VAR_7 == 0)) VAR_7 = VAR_8; if (VAR_8 == VAR_0->start_band + 1) { int offset = 8 * ff_celt_freq_bands[VAR_8]; int count = 8 * (ff_celt_freq_range[VAR_8] - ff_celt_freq_range[VAR_8-1]); memcpy(&VAR_3[offset], &VAR_3[offset - count], count * sizeof(float)); if (VAR_0->channels == 2) memcpy(&VAR_4[offset], &VAR_4[offset - count], count * sizeof(float)); } if (VAR_7 != 0 && (VAR_0->spread != CELT_SPREAD_AGGRESSIVE || VAR_0->blocks > 1 || VAR_0->tf_change[VAR_8] < 0)) { int foldstart, foldend; effective_lowband = FFMAX(ff_celt_freq_bands[VAR_0->start_band], ff_celt_freq_bands[VAR_7] - ff_celt_freq_range[VAR_8]); foldstart = VAR_7; while (ff_celt_freq_bands[--foldstart] > effective_lowband); foldend = VAR_7 - 1; while (++foldend < VAR_8 && ff_celt_freq_bands[foldend] < effective_lowband + ff_celt_freq_range[VAR_8]); cm[0] = cm[1] = 0; for (VAR_9 = foldstart; VAR_9 < foldend; VAR_9++) { cm[0] |= VAR_0->block[0].collapse_masks[VAR_9]; cm[1] |= VAR_0->block[VAR_0->channels - 1].collapse_masks[VAR_9]; } } if (VAR_0->dual_stereo && VAR_8 == VAR_0->intensity_stereo) { VAR_0->dual_stereo = 0; for (VAR_9 = ff_celt_freq_bands[VAR_0->start_band] << VAR_0->size; VAR_9 < band_offset; VAR_9++) VAR_3[VAR_9] = (VAR_3[VAR_9] + VAR_4[VAR_9]) / 2; } norm_loc1 = effective_lowband != -1 ? VAR_3 + (effective_lowband << VAR_0->size) : NULL; norm_loc2 = effective_lowband != -1 ? VAR_4 + (effective_lowband << VAR_0->size) : NULL; if (VAR_0->dual_stereo) { cm[0] = VAR_0->pvq->quant_band(VAR_0->pvq, VAR_0, VAR_1, VAR_8, X, NULL, band_size, b >> 1, VAR_0->blocks, norm_loc1, VAR_0->size, VAR_3 + band_offset, 0, 1.0f, VAR_2, cm[0]); cm[1] = VAR_0->pvq->quant_band(VAR_0->pvq, VAR_0, VAR_1, VAR_8, Y, NULL, band_size, b >> 1, VAR_0->blocks, norm_loc2, VAR_0->size, VAR_4 + band_offset, 0, 1.0f, VAR_2, cm[1]); } else { cm[0] = VAR_0->pvq->quant_band(VAR_0->pvq, VAR_0, VAR_1, VAR_8, X, Y, band_size, b >> 0, VAR_0->blocks, norm_loc1, VAR_0->size, VAR_3 + band_offset, 0, 1.0f, VAR_2, cm[0] | cm[1]); cm[1] = cm[0]; } VAR_0->block[0].collapse_masks[VAR_8] = (uint8_t)cm[0]; VAR_0->block[VAR_0->channels - 1].collapse_masks[VAR_8] = (uint8_t)cm[1]; VAR_0->remaining += VAR_0->pulses[VAR_8] + consumed; VAR_6 = (b > band_size << 3); } }
[ "void FUNC_0(CeltFrame *VAR_0, OpusRangeCoder *VAR_1)\n{", "float VAR_2[8 * 22];", "float VAR_3[2 * 8 * 100];", "float *VAR_4 = VAR_3 + 8 * 100;", "int VAR_5 = (VAR_0->framebits << 3) - VAR_0->anticollapse_needed;", "int VAR_6 = 1;", "int VAR_7 = 0;", "int VAR_8, VAR_9;", "for (VAR_8 = VAR_0->start_band; VAR_8 < VAR_0->end_band; VAR_8++) {", "uint32_t cm[2] = { (1 << VAR_0->blocks) - 1, (1 << VAR_0->blocks) - 1 };", "int band_offset = ff_celt_freq_bands[VAR_8] << VAR_0->size;", "int band_size = ff_celt_freq_range[VAR_8] << VAR_0->size;", "float *X = VAR_0->block[0].coeffs + band_offset;", "float *Y = (VAR_0->channels == 2) ? VAR_0->block[1].coeffs + band_offset : NULL;", "float *norm_loc1, *norm_loc2;", "int consumed = opus_rc_tell_frac(VAR_1);", "int effective_lowband = -1;", "int b = 0;", "if (VAR_8 != VAR_0->start_band)\nVAR_0->remaining -= consumed;", "VAR_0->remaining2 = VAR_5 - consumed - 1;", "if (VAR_8 <= VAR_0->coded_bands - 1) {", "int curr_balance = VAR_0->remaining / FFMIN(3, VAR_0->coded_bands-VAR_8);", "b = av_clip_uintp2(FFMIN(VAR_0->remaining2 + 1, VAR_0->pulses[VAR_8] + curr_balance), 14);", "}", "if ((ff_celt_freq_bands[VAR_8] - ff_celt_freq_range[VAR_8] >= ff_celt_freq_bands[VAR_0->start_band] ||\nVAR_8 == VAR_0->start_band + 1) && (VAR_6 || VAR_7 == 0))\nVAR_7 = VAR_8;", "if (VAR_8 == VAR_0->start_band + 1) {", "int offset = 8 * ff_celt_freq_bands[VAR_8];", "int count = 8 * (ff_celt_freq_range[VAR_8] - ff_celt_freq_range[VAR_8-1]);", "memcpy(&VAR_3[offset], &VAR_3[offset - count], count * sizeof(float));", "if (VAR_0->channels == 2)\nmemcpy(&VAR_4[offset], &VAR_4[offset - count], count * sizeof(float));", "}", "if (VAR_7 != 0 && (VAR_0->spread != CELT_SPREAD_AGGRESSIVE ||\nVAR_0->blocks > 1 || VAR_0->tf_change[VAR_8] < 0)) {", "int foldstart, foldend;", "effective_lowband = FFMAX(ff_celt_freq_bands[VAR_0->start_band],\nff_celt_freq_bands[VAR_7] - ff_celt_freq_range[VAR_8]);", "foldstart = VAR_7;", "while (ff_celt_freq_bands[--foldstart] > effective_lowband);", "foldend = VAR_7 - 1;", "while (++foldend < VAR_8 && ff_celt_freq_bands[foldend] < effective_lowband + ff_celt_freq_range[VAR_8]);", "cm[0] = cm[1] = 0;", "for (VAR_9 = foldstart; VAR_9 < foldend; VAR_9++) {", "cm[0] |= VAR_0->block[0].collapse_masks[VAR_9];", "cm[1] |= VAR_0->block[VAR_0->channels - 1].collapse_masks[VAR_9];", "}", "}", "if (VAR_0->dual_stereo && VAR_8 == VAR_0->intensity_stereo) {", "VAR_0->dual_stereo = 0;", "for (VAR_9 = ff_celt_freq_bands[VAR_0->start_band] << VAR_0->size; VAR_9 < band_offset; VAR_9++)", "VAR_3[VAR_9] = (VAR_3[VAR_9] + VAR_4[VAR_9]) / 2;", "}", "norm_loc1 = effective_lowband != -1 ? VAR_3 + (effective_lowband << VAR_0->size) : NULL;", "norm_loc2 = effective_lowband != -1 ? VAR_4 + (effective_lowband << VAR_0->size) : NULL;", "if (VAR_0->dual_stereo) {", "cm[0] = VAR_0->pvq->quant_band(VAR_0->pvq, VAR_0, VAR_1, VAR_8, X, NULL, band_size, b >> 1,\nVAR_0->blocks, norm_loc1, VAR_0->size,\nVAR_3 + band_offset, 0, 1.0f,\nVAR_2, cm[0]);", "cm[1] = VAR_0->pvq->quant_band(VAR_0->pvq, VAR_0, VAR_1, VAR_8, Y, NULL, band_size, b >> 1,\nVAR_0->blocks, norm_loc2, VAR_0->size,\nVAR_4 + band_offset, 0, 1.0f,\nVAR_2, cm[1]);", "} else {", "cm[0] = VAR_0->pvq->quant_band(VAR_0->pvq, VAR_0, VAR_1, VAR_8, X, Y, band_size, b >> 0,\nVAR_0->blocks, norm_loc1, VAR_0->size,\nVAR_3 + band_offset, 0, 1.0f,\nVAR_2, cm[0] | cm[1]);", "cm[1] = cm[0];", "}", "VAR_0->block[0].collapse_masks[VAR_8] = (uint8_t)cm[0];", "VAR_0->block[VAR_0->channels - 1].collapse_masks[VAR_8] = (uint8_t)cm[1];", "VAR_0->remaining += VAR_0->pulses[VAR_8] + consumed;", "VAR_6 = (b > band_size << 3);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17 ], [ 19 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 53, 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69, 71, 73 ], [ 77 ], [ 83 ], [ 85 ], [ 89 ], [ 93, 95 ], [ 97 ], [ 105, 107 ], [ 109 ], [ 115, 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 143 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 157 ], [ 159 ], [ 163 ], [ 165, 167, 169, 171 ], [ 175, 177, 179, 181 ], [ 183 ], [ 185, 187, 189, 191 ], [ 193 ], [ 195 ], [ 199 ], [ 201 ], [ 203 ], [ 209 ], [ 211 ], [ 213 ] ]
11,107
MigrationCapabilityStatusList *qmp_query_migrate_capabilities(Error **errp) { MigrationCapabilityStatusList *head = NULL; MigrationCapabilityStatusList *caps; MigrationState *s = migrate_get_current(); int i; for (i = 0; i < MIGRATION_CAPABILITY_MAX; i++) { if (head == NULL) { head = g_malloc0(sizeof(*caps)); caps = head; } else { caps->next = g_malloc0(sizeof(*caps)); caps = caps->next; } caps->value = g_malloc(sizeof(*caps->value)); caps->value->capability = i; caps->value->state = s->enabled_capabilities[i]; } return head; }
true
qemu
387eedebf60a463ba30833588f10123da296ba4d
MigrationCapabilityStatusList *qmp_query_migrate_capabilities(Error **errp) { MigrationCapabilityStatusList *head = NULL; MigrationCapabilityStatusList *caps; MigrationState *s = migrate_get_current(); int i; for (i = 0; i < MIGRATION_CAPABILITY_MAX; i++) { if (head == NULL) { head = g_malloc0(sizeof(*caps)); caps = head; } else { caps->next = g_malloc0(sizeof(*caps)); caps = caps->next; } caps->value = g_malloc(sizeof(*caps->value)); caps->value->capability = i; caps->value->state = s->enabled_capabilities[i]; } return head; }
{ "code": [], "line_no": [] }
MigrationCapabilityStatusList *FUNC_0(Error **errp) { MigrationCapabilityStatusList *head = NULL; MigrationCapabilityStatusList *caps; MigrationState *s = migrate_get_current(); int VAR_0; for (VAR_0 = 0; VAR_0 < MIGRATION_CAPABILITY_MAX; VAR_0++) { if (head == NULL) { head = g_malloc0(sizeof(*caps)); caps = head; } else { caps->next = g_malloc0(sizeof(*caps)); caps = caps->next; } caps->value = g_malloc(sizeof(*caps->value)); caps->value->capability = VAR_0; caps->value->state = s->enabled_capabilities[VAR_0]; } return head; }
[ "MigrationCapabilityStatusList *FUNC_0(Error **errp)\n{", "MigrationCapabilityStatusList *head = NULL;", "MigrationCapabilityStatusList *caps;", "MigrationState *s = migrate_get_current();", "int VAR_0;", "for (VAR_0 = 0; VAR_0 < MIGRATION_CAPABILITY_MAX; VAR_0++) {", "if (head == NULL) {", "head = g_malloc0(sizeof(*caps));", "caps = head;", "} else {", "caps->next = g_malloc0(sizeof(*caps));", "caps = caps->next;", "}", "caps->value =\ng_malloc(sizeof(*caps->value));", "caps->value->capability = VAR_0;", "caps->value->state = s->enabled_capabilities[VAR_0];", "}", "return head;", "}" ]
[ 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 ], [ 16 ], [ 18 ], [ 20 ], [ 22 ], [ 24 ], [ 26 ], [ 28 ], [ 30 ], [ 32, 34 ], [ 36 ], [ 38 ], [ 40 ], [ 44 ], [ 46 ] ]
11,108
static void armv7m_nvic_class_init(ObjectClass *klass, void *data) { NVICClass *nc = NVIC_CLASS(klass); DeviceClass *dc = DEVICE_CLASS(klass); SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass); nc->parent_reset = dc->reset; nc->parent_init = sdc->init; sdc->init = armv7m_nvic_init; dc->vmsd = &vmstate_nvic; dc->reset = armv7m_nvic_reset; }
true
qemu
53111180946a56d314a9c1d07d09b9ef91e847b9
static void armv7m_nvic_class_init(ObjectClass *klass, void *data) { NVICClass *nc = NVIC_CLASS(klass); DeviceClass *dc = DEVICE_CLASS(klass); SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass); nc->parent_reset = dc->reset; nc->parent_init = sdc->init; sdc->init = armv7m_nvic_init; dc->vmsd = &vmstate_nvic; dc->reset = armv7m_nvic_reset; }
{ "code": [ " SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass);", " nc->parent_init = sdc->init;", " sdc->init = armv7m_nvic_init;" ], "line_no": [ 9, 15, 17 ] }
static void FUNC_0(ObjectClass *VAR_0, void *VAR_1) { NVICClass *nc = NVIC_CLASS(VAR_0); DeviceClass *dc = DEVICE_CLASS(VAR_0); SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(VAR_0); nc->parent_reset = dc->reset; nc->parent_init = sdc->init; sdc->init = armv7m_nvic_init; dc->vmsd = &vmstate_nvic; dc->reset = armv7m_nvic_reset; }
[ "static void FUNC_0(ObjectClass *VAR_0, void *VAR_1)\n{", "NVICClass *nc = NVIC_CLASS(VAR_0);", "DeviceClass *dc = DEVICE_CLASS(VAR_0);", "SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(VAR_0);", "nc->parent_reset = dc->reset;", "nc->parent_init = sdc->init;", "sdc->init = armv7m_nvic_init;", "dc->vmsd = &vmstate_nvic;", "dc->reset = armv7m_nvic_reset;", "}" ]
[ 0, 0, 0, 1, 0, 1, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ] ]
11,109
static void ide_sector_write_cb(void *opaque, int ret) { IDEState *s = opaque; int n; if (ret == -ECANCELED) { return; } block_acct_done(blk_get_stats(s->blk), &s->acct); s->pio_aiocb = NULL; s->status &= ~BUSY_STAT; if (ret != 0) { if (ide_handle_rw_error(s, -ret, IDE_RETRY_PIO)) { return; } } n = s->nsector; if (n > s->req_nb_sectors) { n = s->req_nb_sectors; } s->nsector -= n; ide_set_sector(s, ide_get_sector(s) + n); if (s->nsector == 0) { /* no more sectors to write */ ide_transfer_stop(s); } else { int n1 = s->nsector; if (n1 > s->req_nb_sectors) { n1 = s->req_nb_sectors; } ide_transfer_start(s, s->io_buffer, n1 * BDRV_SECTOR_SIZE, ide_sector_write); } if (win2k_install_hack && ((++s->irq_count % 16) == 0)) { /* It seems there is a bug in the Windows 2000 installer HDD IDE driver which fills the disk with empty logs when the IDE write IRQ comes too early. This hack tries to correct that at the expense of slower write performances. Use this option _only_ to install Windows 2000. You must disable it for normal use. */ timer_mod(s->sector_write_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + (get_ticks_per_sec() / 1000)); } else { ide_set_irq(s->bus); } }
true
qemu
ecca3b397d06a957b18913ff9afc63860001cfdf
static void ide_sector_write_cb(void *opaque, int ret) { IDEState *s = opaque; int n; if (ret == -ECANCELED) { return; } block_acct_done(blk_get_stats(s->blk), &s->acct); s->pio_aiocb = NULL; s->status &= ~BUSY_STAT; if (ret != 0) { if (ide_handle_rw_error(s, -ret, IDE_RETRY_PIO)) { return; } } n = s->nsector; if (n > s->req_nb_sectors) { n = s->req_nb_sectors; } s->nsector -= n; ide_set_sector(s, ide_get_sector(s) + n); if (s->nsector == 0) { ide_transfer_stop(s); } else { int n1 = s->nsector; if (n1 > s->req_nb_sectors) { n1 = s->req_nb_sectors; } ide_transfer_start(s, s->io_buffer, n1 * BDRV_SECTOR_SIZE, ide_sector_write); } if (win2k_install_hack && ((++s->irq_count % 16) == 0)) { timer_mod(s->sector_write_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + (get_ticks_per_sec() / 1000)); } else { ide_set_irq(s->bus); } }
{ "code": [ " block_acct_done(blk_get_stats(s->blk), &s->acct);", " block_acct_done(blk_get_stats(s->blk), &s->acct);" ], "line_no": [ 17, 17 ] }
static void FUNC_0(void *VAR_0, int VAR_1) { IDEState *s = VAR_0; int VAR_2; if (VAR_1 == -ECANCELED) { return; } block_acct_done(blk_get_stats(s->blk), &s->acct); s->pio_aiocb = NULL; s->status &= ~BUSY_STAT; if (VAR_1 != 0) { if (ide_handle_rw_error(s, -VAR_1, IDE_RETRY_PIO)) { return; } } VAR_2 = s->nsector; if (VAR_2 > s->req_nb_sectors) { VAR_2 = s->req_nb_sectors; } s->nsector -= VAR_2; ide_set_sector(s, ide_get_sector(s) + VAR_2); if (s->nsector == 0) { ide_transfer_stop(s); } else { int VAR_3 = s->nsector; if (VAR_3 > s->req_nb_sectors) { VAR_3 = s->req_nb_sectors; } ide_transfer_start(s, s->io_buffer, VAR_3 * BDRV_SECTOR_SIZE, ide_sector_write); } if (win2k_install_hack && ((++s->irq_count % 16) == 0)) { timer_mod(s->sector_write_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + (get_ticks_per_sec() / 1000)); } else { ide_set_irq(s->bus); } }
[ "static void FUNC_0(void *VAR_0, int VAR_1)\n{", "IDEState *s = VAR_0;", "int VAR_2;", "if (VAR_1 == -ECANCELED) {", "return;", "}", "block_acct_done(blk_get_stats(s->blk), &s->acct);", "s->pio_aiocb = NULL;", "s->status &= ~BUSY_STAT;", "if (VAR_1 != 0) {", "if (ide_handle_rw_error(s, -VAR_1, IDE_RETRY_PIO)) {", "return;", "}", "}", "VAR_2 = s->nsector;", "if (VAR_2 > s->req_nb_sectors) {", "VAR_2 = s->req_nb_sectors;", "}", "s->nsector -= VAR_2;", "ide_set_sector(s, ide_get_sector(s) + VAR_2);", "if (s->nsector == 0) {", "ide_transfer_stop(s);", "} else {", "int VAR_3 = s->nsector;", "if (VAR_3 > s->req_nb_sectors) {", "VAR_3 = s->req_nb_sectors;", "}", "ide_transfer_start(s, s->io_buffer, VAR_3 * BDRV_SECTOR_SIZE,\nide_sector_write);", "}", "if (win2k_install_hack && ((++s->irq_count % 16) == 0)) {", "timer_mod(s->sector_write_timer,\nqemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + (get_ticks_per_sec() / 1000));", "} else {", "ide_set_irq(s->bus);", "}", "}" ]
[ 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 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69, 71 ], [ 73 ], [ 77 ], [ 91, 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ] ]
11,110
static int init_ralf_vlc(VLC *vlc, const uint8_t *data, int elems) { uint8_t lens[MAX_ELEMS]; uint16_t codes[MAX_ELEMS]; int counts[17], prefixes[18]; int i, cur_len; int max_bits = 0; GetBitContext gb; init_get_bits(&gb, data, elems * 4); for (i = 0; i <= 16; i++) counts[i] = 0; for (i = 0; i < elems; i++) { cur_len = get_bits(&gb, 4) + 1; counts[cur_len]++; max_bits = FFMAX(max_bits, cur_len); lens[i] = cur_len; } prefixes[1] = 0; for (i = 1; i <= 16; i++) prefixes[i + 1] = (prefixes[i] + counts[i]) << 1; for (i = 0; i < elems; i++) codes[i] = prefixes[lens[i]]++; return ff_init_vlc_sparse(vlc, FFMIN(max_bits, 9), elems, lens, 1, 1, codes, 2, 2, NULL, 0, 0, 0); }
true
FFmpeg
494bce6224c7da6a174fb16a49ed26e5aab32af1
static int init_ralf_vlc(VLC *vlc, const uint8_t *data, int elems) { uint8_t lens[MAX_ELEMS]; uint16_t codes[MAX_ELEMS]; int counts[17], prefixes[18]; int i, cur_len; int max_bits = 0; GetBitContext gb; init_get_bits(&gb, data, elems * 4); for (i = 0; i <= 16; i++) counts[i] = 0; for (i = 0; i < elems; i++) { cur_len = get_bits(&gb, 4) + 1; counts[cur_len]++; max_bits = FFMAX(max_bits, cur_len); lens[i] = cur_len; } prefixes[1] = 0; for (i = 1; i <= 16; i++) prefixes[i + 1] = (prefixes[i] + counts[i]) << 1; for (i = 0; i < elems; i++) codes[i] = prefixes[lens[i]]++; return ff_init_vlc_sparse(vlc, FFMIN(max_bits, 9), elems, lens, 1, 1, codes, 2, 2, NULL, 0, 0, 0); }
{ "code": [ " GetBitContext gb;", " init_get_bits(&gb, data, elems * 4);", " cur_len = get_bits(&gb, 4) + 1;" ], "line_no": [ 15, 19, 29 ] }
static int FUNC_0(VLC *VAR_0, const uint8_t *VAR_1, int VAR_2) { uint8_t lens[MAX_ELEMS]; uint16_t codes[MAX_ELEMS]; int VAR_3[17], VAR_4[18]; int VAR_5, VAR_6; int VAR_7 = 0; GetBitContext gb; init_get_bits(&gb, VAR_1, VAR_2 * 4); for (VAR_5 = 0; VAR_5 <= 16; VAR_5++) VAR_3[VAR_5] = 0; for (VAR_5 = 0; VAR_5 < VAR_2; VAR_5++) { VAR_6 = get_bits(&gb, 4) + 1; VAR_3[VAR_6]++; VAR_7 = FFMAX(VAR_7, VAR_6); lens[VAR_5] = VAR_6; } VAR_4[1] = 0; for (VAR_5 = 1; VAR_5 <= 16; VAR_5++) VAR_4[VAR_5 + 1] = (VAR_4[VAR_5] + VAR_3[VAR_5]) << 1; for (VAR_5 = 0; VAR_5 < VAR_2; VAR_5++) codes[VAR_5] = VAR_4[lens[VAR_5]]++; return ff_init_vlc_sparse(VAR_0, FFMIN(VAR_7, 9), VAR_2, lens, 1, 1, codes, 2, 2, NULL, 0, 0, 0); }
[ "static int FUNC_0(VLC *VAR_0, const uint8_t *VAR_1, int VAR_2)\n{", "uint8_t lens[MAX_ELEMS];", "uint16_t codes[MAX_ELEMS];", "int VAR_3[17], VAR_4[18];", "int VAR_5, VAR_6;", "int VAR_7 = 0;", "GetBitContext gb;", "init_get_bits(&gb, VAR_1, VAR_2 * 4);", "for (VAR_5 = 0; VAR_5 <= 16; VAR_5++)", "VAR_3[VAR_5] = 0;", "for (VAR_5 = 0; VAR_5 < VAR_2; VAR_5++) {", "VAR_6 = get_bits(&gb, 4) + 1;", "VAR_3[VAR_6]++;", "VAR_7 = FFMAX(VAR_7, VAR_6);", "lens[VAR_5] = VAR_6;", "}", "VAR_4[1] = 0;", "for (VAR_5 = 1; VAR_5 <= 16; VAR_5++)", "VAR_4[VAR_5 + 1] = (VAR_4[VAR_5] + VAR_3[VAR_5]) << 1;", "for (VAR_5 = 0; VAR_5 < VAR_2; VAR_5++)", "codes[VAR_5] = VAR_4[lens[VAR_5]]++;", "return ff_init_vlc_sparse(VAR_0, FFMIN(VAR_7, 9), VAR_2,\nlens, 1, 1, codes, 2, 2, NULL, 0, 0, 0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 53, 55 ], [ 57 ] ]
11,111
static int ioreq_runio_qemu_sync(struct ioreq *ioreq) { struct XenBlkDev *blkdev = ioreq->blkdev; int i, rc, len = 0; off_t pos; if (ioreq->req.nr_segments && ioreq_map(ioreq) == -1) goto err; if (ioreq->presync) bdrv_flush(blkdev->bs); switch (ioreq->req.operation) { case BLKIF_OP_READ: pos = ioreq->start; for (i = 0; i < ioreq->v.niov; i++) { rc = bdrv_read(blkdev->bs, pos / BLOCK_SIZE, ioreq->v.iov[i].iov_base, ioreq->v.iov[i].iov_len / BLOCK_SIZE); if (rc != 0) { xen_be_printf(&blkdev->xendev, 0, "rd I/O error (%p, len %zd)\n", ioreq->v.iov[i].iov_base, ioreq->v.iov[i].iov_len); goto err; } len += ioreq->v.iov[i].iov_len; pos += ioreq->v.iov[i].iov_len; } break; case BLKIF_OP_WRITE: case BLKIF_OP_WRITE_BARRIER: if (!ioreq->req.nr_segments) break; pos = ioreq->start; for (i = 0; i < ioreq->v.niov; i++) { rc = bdrv_write(blkdev->bs, pos / BLOCK_SIZE, ioreq->v.iov[i].iov_base, ioreq->v.iov[i].iov_len / BLOCK_SIZE); if (rc != 0) { xen_be_printf(&blkdev->xendev, 0, "wr I/O error (%p, len %zd)\n", ioreq->v.iov[i].iov_base, ioreq->v.iov[i].iov_len); goto err; } len += ioreq->v.iov[i].iov_len; pos += ioreq->v.iov[i].iov_len; } break; default: /* unknown operation (shouldn't happen -- parse catches this) */ goto err; } if (ioreq->postsync) bdrv_flush(blkdev->bs); ioreq->status = BLKIF_RSP_OKAY; ioreq_unmap(ioreq); ioreq_finish(ioreq); return 0; err: ioreq->status = BLKIF_RSP_ERROR; return -1; }
true
qemu
f6ec953ca329d4509e5a1a1ff051365fccdbb6b7
static int ioreq_runio_qemu_sync(struct ioreq *ioreq) { struct XenBlkDev *blkdev = ioreq->blkdev; int i, rc, len = 0; off_t pos; if (ioreq->req.nr_segments && ioreq_map(ioreq) == -1) goto err; if (ioreq->presync) bdrv_flush(blkdev->bs); switch (ioreq->req.operation) { case BLKIF_OP_READ: pos = ioreq->start; for (i = 0; i < ioreq->v.niov; i++) { rc = bdrv_read(blkdev->bs, pos / BLOCK_SIZE, ioreq->v.iov[i].iov_base, ioreq->v.iov[i].iov_len / BLOCK_SIZE); if (rc != 0) { xen_be_printf(&blkdev->xendev, 0, "rd I/O error (%p, len %zd)\n", ioreq->v.iov[i].iov_base, ioreq->v.iov[i].iov_len); goto err; } len += ioreq->v.iov[i].iov_len; pos += ioreq->v.iov[i].iov_len; } break; case BLKIF_OP_WRITE: case BLKIF_OP_WRITE_BARRIER: if (!ioreq->req.nr_segments) break; pos = ioreq->start; for (i = 0; i < ioreq->v.niov; i++) { rc = bdrv_write(blkdev->bs, pos / BLOCK_SIZE, ioreq->v.iov[i].iov_base, ioreq->v.iov[i].iov_len / BLOCK_SIZE); if (rc != 0) { xen_be_printf(&blkdev->xendev, 0, "wr I/O error (%p, len %zd)\n", ioreq->v.iov[i].iov_base, ioreq->v.iov[i].iov_len); goto err; } len += ioreq->v.iov[i].iov_len; pos += ioreq->v.iov[i].iov_len; } break; default: goto err; } if (ioreq->postsync) bdrv_flush(blkdev->bs); ioreq->status = BLKIF_RSP_OKAY; ioreq_unmap(ioreq); ioreq_finish(ioreq); return 0; err: ioreq->status = BLKIF_RSP_ERROR; return -1; }
{ "code": [ "\tgoto err;", "\tgoto err;" ], "line_no": [ 15, 15 ] }
static int FUNC_0(struct VAR_0 *VAR_0) { struct XenBlkDev *VAR_1 = VAR_0->VAR_1; int VAR_2, VAR_3, VAR_4 = 0; off_t pos; if (VAR_0->req.nr_segments && ioreq_map(VAR_0) == -1) goto err; if (VAR_0->presync) bdrv_flush(VAR_1->bs); switch (VAR_0->req.operation) { case BLKIF_OP_READ: pos = VAR_0->start; for (VAR_2 = 0; VAR_2 < VAR_0->v.niov; VAR_2++) { VAR_3 = bdrv_read(VAR_1->bs, pos / BLOCK_SIZE, VAR_0->v.iov[VAR_2].iov_base, VAR_0->v.iov[VAR_2].iov_len / BLOCK_SIZE); if (VAR_3 != 0) { xen_be_printf(&VAR_1->xendev, 0, "rd I/O error (%p, VAR_4 %zd)\n", VAR_0->v.iov[VAR_2].iov_base, VAR_0->v.iov[VAR_2].iov_len); goto err; } VAR_4 += VAR_0->v.iov[VAR_2].iov_len; pos += VAR_0->v.iov[VAR_2].iov_len; } break; case BLKIF_OP_WRITE: case BLKIF_OP_WRITE_BARRIER: if (!VAR_0->req.nr_segments) break; pos = VAR_0->start; for (VAR_2 = 0; VAR_2 < VAR_0->v.niov; VAR_2++) { VAR_3 = bdrv_write(VAR_1->bs, pos / BLOCK_SIZE, VAR_0->v.iov[VAR_2].iov_base, VAR_0->v.iov[VAR_2].iov_len / BLOCK_SIZE); if (VAR_3 != 0) { xen_be_printf(&VAR_1->xendev, 0, "wr I/O error (%p, VAR_4 %zd)\n", VAR_0->v.iov[VAR_2].iov_base, VAR_0->v.iov[VAR_2].iov_len); goto err; } VAR_4 += VAR_0->v.iov[VAR_2].iov_len; pos += VAR_0->v.iov[VAR_2].iov_len; } break; default: goto err; } if (VAR_0->postsync) bdrv_flush(VAR_1->bs); VAR_0->status = BLKIF_RSP_OKAY; ioreq_unmap(VAR_0); ioreq_finish(VAR_0); return 0; err: VAR_0->status = BLKIF_RSP_ERROR; return -1; }
[ "static int FUNC_0(struct VAR_0 *VAR_0)\n{", "struct XenBlkDev *VAR_1 = VAR_0->VAR_1;", "int VAR_2, VAR_3, VAR_4 = 0;", "off_t pos;", "if (VAR_0->req.nr_segments && ioreq_map(VAR_0) == -1)\ngoto err;", "if (VAR_0->presync)\nbdrv_flush(VAR_1->bs);", "switch (VAR_0->req.operation) {", "case BLKIF_OP_READ:\npos = VAR_0->start;", "for (VAR_2 = 0; VAR_2 < VAR_0->v.niov; VAR_2++) {", "VAR_3 = bdrv_read(VAR_1->bs, pos / BLOCK_SIZE,\nVAR_0->v.iov[VAR_2].iov_base,\nVAR_0->v.iov[VAR_2].iov_len / BLOCK_SIZE);", "if (VAR_3 != 0) {", "xen_be_printf(&VAR_1->xendev, 0, \"rd I/O error (%p, VAR_4 %zd)\\n\",\nVAR_0->v.iov[VAR_2].iov_base,\nVAR_0->v.iov[VAR_2].iov_len);", "goto err;", "}", "VAR_4 += VAR_0->v.iov[VAR_2].iov_len;", "pos += VAR_0->v.iov[VAR_2].iov_len;", "}", "break;", "case BLKIF_OP_WRITE:\ncase BLKIF_OP_WRITE_BARRIER:\nif (!VAR_0->req.nr_segments)\nbreak;", "pos = VAR_0->start;", "for (VAR_2 = 0; VAR_2 < VAR_0->v.niov; VAR_2++) {", "VAR_3 = bdrv_write(VAR_1->bs, pos / BLOCK_SIZE,\nVAR_0->v.iov[VAR_2].iov_base,\nVAR_0->v.iov[VAR_2].iov_len / BLOCK_SIZE);", "if (VAR_3 != 0) {", "xen_be_printf(&VAR_1->xendev, 0, \"wr I/O error (%p, VAR_4 %zd)\\n\",\nVAR_0->v.iov[VAR_2].iov_base,\nVAR_0->v.iov[VAR_2].iov_len);", "goto err;", "}", "VAR_4 += VAR_0->v.iov[VAR_2].iov_len;", "pos += VAR_0->v.iov[VAR_2].iov_len;", "}", "break;", "default:\ngoto err;", "}", "if (VAR_0->postsync)\nbdrv_flush(VAR_1->bs);", "VAR_0->status = BLKIF_RSP_OKAY;", "ioreq_unmap(VAR_0);", "ioreq_finish(VAR_0);", "return 0;", "err:\nVAR_0->status = BLKIF_RSP_ERROR;", "return -1;", "}" ]
[ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13, 15 ], [ 17, 19 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31, 33, 35 ], [ 37 ], [ 39, 41, 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57, 59, 61, 63 ], [ 65 ], [ 67 ], [ 69, 71, 73 ], [ 75 ], [ 77, 79, 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95, 99 ], [ 101 ], [ 105, 107 ], [ 109 ], [ 113 ], [ 115 ], [ 117 ], [ 121, 123 ], [ 125 ], [ 127 ] ]
11,112
static int vaapi_encode_h264_init_sequence_params(AVCodecContext *avctx) { VAAPIEncodeContext *ctx = avctx->priv_data; VAEncSequenceParameterBufferH264 *vseq = ctx->codec_sequence_params; VAEncPictureParameterBufferH264 *vpic = ctx->codec_picture_params; VAAPIEncodeH264Context *priv = ctx->priv_data; VAAPIEncodeH264MiscSequenceParams *mseq = &priv->misc_sequence_params; int i; { vseq->seq_parameter_set_id = 0; vseq->level_idc = avctx->level; vseq->max_num_ref_frames = 1 + (avctx->max_b_frames > 0); vseq->picture_width_in_mbs = priv->mb_width; vseq->picture_height_in_mbs = priv->mb_height; vseq->seq_fields.bits.chroma_format_idc = 1; vseq->seq_fields.bits.frame_mbs_only_flag = 1; vseq->seq_fields.bits.direct_8x8_inference_flag = 1; vseq->seq_fields.bits.log2_max_frame_num_minus4 = 4; vseq->seq_fields.bits.pic_order_cnt_type = 0; if (avctx->width != ctx->surface_width || avctx->height != ctx->surface_height) { vseq->frame_cropping_flag = 1; vseq->frame_crop_left_offset = 0; vseq->frame_crop_right_offset = (ctx->surface_width - avctx->width) / 2; vseq->frame_crop_top_offset = 0; vseq->frame_crop_bottom_offset = (ctx->surface_height - avctx->height) / 2; } else { vseq->frame_cropping_flag = 0; } vseq->vui_parameters_present_flag = 1; if (avctx->sample_aspect_ratio.num != 0) { vseq->vui_fields.bits.aspect_ratio_info_present_flag = 1; // There is a large enum of these which we could support // individually rather than using the generic X/Y form? if (avctx->sample_aspect_ratio.num == avctx->sample_aspect_ratio.den) { vseq->aspect_ratio_idc = 1; } else { vseq->aspect_ratio_idc = 255; // Extended SAR. vseq->sar_width = avctx->sample_aspect_ratio.num; vseq->sar_height = avctx->sample_aspect_ratio.den; } } if (avctx->color_primaries != AVCOL_PRI_UNSPECIFIED || avctx->color_trc != AVCOL_TRC_UNSPECIFIED || avctx->colorspace != AVCOL_SPC_UNSPECIFIED) { mseq->video_signal_type_present_flag = 1; mseq->video_format = 5; // Unspecified. mseq->video_full_range_flag = 0; mseq->colour_description_present_flag = 1; // These enums are derived from the standard and hence // we can just use the values directly. mseq->colour_primaries = avctx->color_primaries; mseq->transfer_characteristics = avctx->color_trc; mseq->matrix_coefficients = avctx->colorspace; } vseq->vui_fields.bits.bitstream_restriction_flag = 1; mseq->motion_vectors_over_pic_boundaries_flag = 1; mseq->max_bytes_per_pic_denom = 0; mseq->max_bits_per_mb_denom = 0; vseq->vui_fields.bits.log2_max_mv_length_horizontal = 16; vseq->vui_fields.bits.log2_max_mv_length_vertical = 16; mseq->max_num_reorder_frames = (avctx->max_b_frames > 0); mseq->max_dec_pic_buffering = vseq->max_num_ref_frames; vseq->bits_per_second = avctx->bit_rate; vseq->vui_fields.bits.timing_info_present_flag = 1; if (avctx->framerate.num > 0 && avctx->framerate.den > 0) { vseq->num_units_in_tick = avctx->framerate.den; vseq->time_scale = 2 * avctx->framerate.num; mseq->fixed_frame_rate_flag = 1; } else { vseq->num_units_in_tick = avctx->time_base.num; vseq->time_scale = 2 * avctx->time_base.den; mseq->fixed_frame_rate_flag = 0; } if (ctx->va_rc_mode == VA_RC_CBR) { priv->send_timing_sei = 1; mseq->nal_hrd_parameters_present_flag = 1; mseq->cpb_cnt_minus1 = 0; // Try to scale these to a sensible range so that the // golomb encode of the value is not overlong. mseq->bit_rate_scale = av_clip_uintp2(av_log2(avctx->bit_rate) - 15 - 6, 4); mseq->bit_rate_value_minus1[0] = (avctx->bit_rate >> mseq->bit_rate_scale + 6) - 1; mseq->cpb_size_scale = av_clip_uintp2(av_log2(ctx->hrd_params.hrd.buffer_size) - 15 - 4, 4); mseq->cpb_size_value_minus1[0] = (ctx->hrd_params.hrd.buffer_size >> mseq->cpb_size_scale + 4) - 1; // CBR mode isn't actually available here, despite naming. mseq->cbr_flag[0] = 0; mseq->initial_cpb_removal_delay_length_minus1 = 23; mseq->cpb_removal_delay_length_minus1 = 23; mseq->dpb_output_delay_length_minus1 = 7; mseq->time_offset_length = 0; // This calculation can easily overflow 32 bits. mseq->initial_cpb_removal_delay = 90000 * (uint64_t)ctx->hrd_params.hrd.initial_buffer_fullness / ctx->hrd_params.hrd.buffer_size; mseq->initial_cpb_removal_delay_offset = 0; } else { priv->send_timing_sei = 0; mseq->nal_hrd_parameters_present_flag = 0; } vseq->intra_period = ctx->p_per_i * (ctx->b_per_p + 1); vseq->intra_idr_period = vseq->intra_period; vseq->ip_period = ctx->b_per_p + 1; } { vpic->CurrPic.picture_id = VA_INVALID_ID; vpic->CurrPic.flags = VA_PICTURE_H264_INVALID; for (i = 0; i < FF_ARRAY_ELEMS(vpic->ReferenceFrames); i++) { vpic->ReferenceFrames[i].picture_id = VA_INVALID_ID; vpic->ReferenceFrames[i].flags = VA_PICTURE_H264_INVALID; } vpic->coded_buf = VA_INVALID_ID; vpic->pic_parameter_set_id = 0; vpic->seq_parameter_set_id = 0; vpic->num_ref_idx_l0_active_minus1 = 0; vpic->num_ref_idx_l1_active_minus1 = 0; vpic->pic_fields.bits.entropy_coding_mode_flag = ((avctx->profile & 0xff) != 66); vpic->pic_fields.bits.weighted_pred_flag = 0; vpic->pic_fields.bits.weighted_bipred_idc = 0; vpic->pic_fields.bits.transform_8x8_mode_flag = ((avctx->profile & 0xff) >= 100); vpic->pic_init_qp = priv->fixed_qp_idr; } { mseq->profile_idc = avctx->profile & 0xff; if (avctx->profile & FF_PROFILE_H264_CONSTRAINED) mseq->constraint_set1_flag = 1; if (avctx->profile & FF_PROFILE_H264_INTRA) mseq->constraint_set3_flag = 1; } return 0; }
true
FFmpeg
89725a8512721fffd190021ded2d3f5b42e20e2a
static int vaapi_encode_h264_init_sequence_params(AVCodecContext *avctx) { VAAPIEncodeContext *ctx = avctx->priv_data; VAEncSequenceParameterBufferH264 *vseq = ctx->codec_sequence_params; VAEncPictureParameterBufferH264 *vpic = ctx->codec_picture_params; VAAPIEncodeH264Context *priv = ctx->priv_data; VAAPIEncodeH264MiscSequenceParams *mseq = &priv->misc_sequence_params; int i; { vseq->seq_parameter_set_id = 0; vseq->level_idc = avctx->level; vseq->max_num_ref_frames = 1 + (avctx->max_b_frames > 0); vseq->picture_width_in_mbs = priv->mb_width; vseq->picture_height_in_mbs = priv->mb_height; vseq->seq_fields.bits.chroma_format_idc = 1; vseq->seq_fields.bits.frame_mbs_only_flag = 1; vseq->seq_fields.bits.direct_8x8_inference_flag = 1; vseq->seq_fields.bits.log2_max_frame_num_minus4 = 4; vseq->seq_fields.bits.pic_order_cnt_type = 0; if (avctx->width != ctx->surface_width || avctx->height != ctx->surface_height) { vseq->frame_cropping_flag = 1; vseq->frame_crop_left_offset = 0; vseq->frame_crop_right_offset = (ctx->surface_width - avctx->width) / 2; vseq->frame_crop_top_offset = 0; vseq->frame_crop_bottom_offset = (ctx->surface_height - avctx->height) / 2; } else { vseq->frame_cropping_flag = 0; } vseq->vui_parameters_present_flag = 1; if (avctx->sample_aspect_ratio.num != 0) { vseq->vui_fields.bits.aspect_ratio_info_present_flag = 1; if (avctx->sample_aspect_ratio.num == avctx->sample_aspect_ratio.den) { vseq->aspect_ratio_idc = 1; } else { vseq->aspect_ratio_idc = 255; vseq->sar_width = avctx->sample_aspect_ratio.num; vseq->sar_height = avctx->sample_aspect_ratio.den; } } if (avctx->color_primaries != AVCOL_PRI_UNSPECIFIED || avctx->color_trc != AVCOL_TRC_UNSPECIFIED || avctx->colorspace != AVCOL_SPC_UNSPECIFIED) { mseq->video_signal_type_present_flag = 1; mseq->video_format = 5; mseq->video_full_range_flag = 0; mseq->colour_description_present_flag = 1; mseq->colour_primaries = avctx->color_primaries; mseq->transfer_characteristics = avctx->color_trc; mseq->matrix_coefficients = avctx->colorspace; } vseq->vui_fields.bits.bitstream_restriction_flag = 1; mseq->motion_vectors_over_pic_boundaries_flag = 1; mseq->max_bytes_per_pic_denom = 0; mseq->max_bits_per_mb_denom = 0; vseq->vui_fields.bits.log2_max_mv_length_horizontal = 16; vseq->vui_fields.bits.log2_max_mv_length_vertical = 16; mseq->max_num_reorder_frames = (avctx->max_b_frames > 0); mseq->max_dec_pic_buffering = vseq->max_num_ref_frames; vseq->bits_per_second = avctx->bit_rate; vseq->vui_fields.bits.timing_info_present_flag = 1; if (avctx->framerate.num > 0 && avctx->framerate.den > 0) { vseq->num_units_in_tick = avctx->framerate.den; vseq->time_scale = 2 * avctx->framerate.num; mseq->fixed_frame_rate_flag = 1; } else { vseq->num_units_in_tick = avctx->time_base.num; vseq->time_scale = 2 * avctx->time_base.den; mseq->fixed_frame_rate_flag = 0; } if (ctx->va_rc_mode == VA_RC_CBR) { priv->send_timing_sei = 1; mseq->nal_hrd_parameters_present_flag = 1; mseq->cpb_cnt_minus1 = 0; mseq->bit_rate_scale = av_clip_uintp2(av_log2(avctx->bit_rate) - 15 - 6, 4); mseq->bit_rate_value_minus1[0] = (avctx->bit_rate >> mseq->bit_rate_scale + 6) - 1; mseq->cpb_size_scale = av_clip_uintp2(av_log2(ctx->hrd_params.hrd.buffer_size) - 15 - 4, 4); mseq->cpb_size_value_minus1[0] = (ctx->hrd_params.hrd.buffer_size >> mseq->cpb_size_scale + 4) - 1; mseq->cbr_flag[0] = 0; mseq->initial_cpb_removal_delay_length_minus1 = 23; mseq->cpb_removal_delay_length_minus1 = 23; mseq->dpb_output_delay_length_minus1 = 7; mseq->time_offset_length = 0; mseq->initial_cpb_removal_delay = 90000 * (uint64_t)ctx->hrd_params.hrd.initial_buffer_fullness / ctx->hrd_params.hrd.buffer_size; mseq->initial_cpb_removal_delay_offset = 0; } else { priv->send_timing_sei = 0; mseq->nal_hrd_parameters_present_flag = 0; } vseq->intra_period = ctx->p_per_i * (ctx->b_per_p + 1); vseq->intra_idr_period = vseq->intra_period; vseq->ip_period = ctx->b_per_p + 1; } { vpic->CurrPic.picture_id = VA_INVALID_ID; vpic->CurrPic.flags = VA_PICTURE_H264_INVALID; for (i = 0; i < FF_ARRAY_ELEMS(vpic->ReferenceFrames); i++) { vpic->ReferenceFrames[i].picture_id = VA_INVALID_ID; vpic->ReferenceFrames[i].flags = VA_PICTURE_H264_INVALID; } vpic->coded_buf = VA_INVALID_ID; vpic->pic_parameter_set_id = 0; vpic->seq_parameter_set_id = 0; vpic->num_ref_idx_l0_active_minus1 = 0; vpic->num_ref_idx_l1_active_minus1 = 0; vpic->pic_fields.bits.entropy_coding_mode_flag = ((avctx->profile & 0xff) != 66); vpic->pic_fields.bits.weighted_pred_flag = 0; vpic->pic_fields.bits.weighted_bipred_idc = 0; vpic->pic_fields.bits.transform_8x8_mode_flag = ((avctx->profile & 0xff) >= 100); vpic->pic_init_qp = priv->fixed_qp_idr; } { mseq->profile_idc = avctx->profile & 0xff; if (avctx->profile & FF_PROFILE_H264_CONSTRAINED) mseq->constraint_set1_flag = 1; if (avctx->profile & FF_PROFILE_H264_INTRA) mseq->constraint_set3_flag = 1; } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0) { VAAPIEncodeContext *ctx = VAR_0->priv_data; VAEncSequenceParameterBufferH264 *vseq = ctx->codec_sequence_params; VAEncPictureParameterBufferH264 *vpic = ctx->codec_picture_params; VAAPIEncodeH264Context *priv = ctx->priv_data; VAAPIEncodeH264MiscSequenceParams *mseq = &priv->misc_sequence_params; int VAR_1; { vseq->seq_parameter_set_id = 0; vseq->level_idc = VAR_0->level; vseq->max_num_ref_frames = 1 + (VAR_0->max_b_frames > 0); vseq->picture_width_in_mbs = priv->mb_width; vseq->picture_height_in_mbs = priv->mb_height; vseq->seq_fields.bits.chroma_format_idc = 1; vseq->seq_fields.bits.frame_mbs_only_flag = 1; vseq->seq_fields.bits.direct_8x8_inference_flag = 1; vseq->seq_fields.bits.log2_max_frame_num_minus4 = 4; vseq->seq_fields.bits.pic_order_cnt_type = 0; if (VAR_0->width != ctx->surface_width || VAR_0->height != ctx->surface_height) { vseq->frame_cropping_flag = 1; vseq->frame_crop_left_offset = 0; vseq->frame_crop_right_offset = (ctx->surface_width - VAR_0->width) / 2; vseq->frame_crop_top_offset = 0; vseq->frame_crop_bottom_offset = (ctx->surface_height - VAR_0->height) / 2; } else { vseq->frame_cropping_flag = 0; } vseq->vui_parameters_present_flag = 1; if (VAR_0->sample_aspect_ratio.num != 0) { vseq->vui_fields.bits.aspect_ratio_info_present_flag = 1; if (VAR_0->sample_aspect_ratio.num == VAR_0->sample_aspect_ratio.den) { vseq->aspect_ratio_idc = 1; } else { vseq->aspect_ratio_idc = 255; vseq->sar_width = VAR_0->sample_aspect_ratio.num; vseq->sar_height = VAR_0->sample_aspect_ratio.den; } } if (VAR_0->color_primaries != AVCOL_PRI_UNSPECIFIED || VAR_0->color_trc != AVCOL_TRC_UNSPECIFIED || VAR_0->colorspace != AVCOL_SPC_UNSPECIFIED) { mseq->video_signal_type_present_flag = 1; mseq->video_format = 5; mseq->video_full_range_flag = 0; mseq->colour_description_present_flag = 1; mseq->colour_primaries = VAR_0->color_primaries; mseq->transfer_characteristics = VAR_0->color_trc; mseq->matrix_coefficients = VAR_0->colorspace; } vseq->vui_fields.bits.bitstream_restriction_flag = 1; mseq->motion_vectors_over_pic_boundaries_flag = 1; mseq->max_bytes_per_pic_denom = 0; mseq->max_bits_per_mb_denom = 0; vseq->vui_fields.bits.log2_max_mv_length_horizontal = 16; vseq->vui_fields.bits.log2_max_mv_length_vertical = 16; mseq->max_num_reorder_frames = (VAR_0->max_b_frames > 0); mseq->max_dec_pic_buffering = vseq->max_num_ref_frames; vseq->bits_per_second = VAR_0->bit_rate; vseq->vui_fields.bits.timing_info_present_flag = 1; if (VAR_0->framerate.num > 0 && VAR_0->framerate.den > 0) { vseq->num_units_in_tick = VAR_0->framerate.den; vseq->time_scale = 2 * VAR_0->framerate.num; mseq->fixed_frame_rate_flag = 1; } else { vseq->num_units_in_tick = VAR_0->time_base.num; vseq->time_scale = 2 * VAR_0->time_base.den; mseq->fixed_frame_rate_flag = 0; } if (ctx->va_rc_mode == VA_RC_CBR) { priv->send_timing_sei = 1; mseq->nal_hrd_parameters_present_flag = 1; mseq->cpb_cnt_minus1 = 0; mseq->bit_rate_scale = av_clip_uintp2(av_log2(VAR_0->bit_rate) - 15 - 6, 4); mseq->bit_rate_value_minus1[0] = (VAR_0->bit_rate >> mseq->bit_rate_scale + 6) - 1; mseq->cpb_size_scale = av_clip_uintp2(av_log2(ctx->hrd_params.hrd.buffer_size) - 15 - 4, 4); mseq->cpb_size_value_minus1[0] = (ctx->hrd_params.hrd.buffer_size >> mseq->cpb_size_scale + 4) - 1; mseq->cbr_flag[0] = 0; mseq->initial_cpb_removal_delay_length_minus1 = 23; mseq->cpb_removal_delay_length_minus1 = 23; mseq->dpb_output_delay_length_minus1 = 7; mseq->time_offset_length = 0; mseq->initial_cpb_removal_delay = 90000 * (uint64_t)ctx->hrd_params.hrd.initial_buffer_fullness / ctx->hrd_params.hrd.buffer_size; mseq->initial_cpb_removal_delay_offset = 0; } else { priv->send_timing_sei = 0; mseq->nal_hrd_parameters_present_flag = 0; } vseq->intra_period = ctx->p_per_i * (ctx->b_per_p + 1); vseq->intra_idr_period = vseq->intra_period; vseq->ip_period = ctx->b_per_p + 1; } { vpic->CurrPic.picture_id = VA_INVALID_ID; vpic->CurrPic.flags = VA_PICTURE_H264_INVALID; for (VAR_1 = 0; VAR_1 < FF_ARRAY_ELEMS(vpic->ReferenceFrames); VAR_1++) { vpic->ReferenceFrames[VAR_1].picture_id = VA_INVALID_ID; vpic->ReferenceFrames[VAR_1].flags = VA_PICTURE_H264_INVALID; } vpic->coded_buf = VA_INVALID_ID; vpic->pic_parameter_set_id = 0; vpic->seq_parameter_set_id = 0; vpic->num_ref_idx_l0_active_minus1 = 0; vpic->num_ref_idx_l1_active_minus1 = 0; vpic->pic_fields.bits.entropy_coding_mode_flag = ((VAR_0->profile & 0xff) != 66); vpic->pic_fields.bits.weighted_pred_flag = 0; vpic->pic_fields.bits.weighted_bipred_idc = 0; vpic->pic_fields.bits.transform_8x8_mode_flag = ((VAR_0->profile & 0xff) >= 100); vpic->pic_init_qp = priv->fixed_qp_idr; } { mseq->profile_idc = VAR_0->profile & 0xff; if (VAR_0->profile & FF_PROFILE_H264_CONSTRAINED) mseq->constraint_set1_flag = 1; if (VAR_0->profile & FF_PROFILE_H264_INTRA) mseq->constraint_set3_flag = 1; } return 0; }
[ "static int FUNC_0(AVCodecContext *VAR_0)\n{", "VAAPIEncodeContext *ctx = VAR_0->priv_data;", "VAEncSequenceParameterBufferH264 *vseq = ctx->codec_sequence_params;", "VAEncPictureParameterBufferH264 *vpic = ctx->codec_picture_params;", "VAAPIEncodeH264Context *priv = ctx->priv_data;", "VAAPIEncodeH264MiscSequenceParams *mseq = &priv->misc_sequence_params;", "int VAR_1;", "{", "vseq->seq_parameter_set_id = 0;", "vseq->level_idc = VAR_0->level;", "vseq->max_num_ref_frames = 1 + (VAR_0->max_b_frames > 0);", "vseq->picture_width_in_mbs = priv->mb_width;", "vseq->picture_height_in_mbs = priv->mb_height;", "vseq->seq_fields.bits.chroma_format_idc = 1;", "vseq->seq_fields.bits.frame_mbs_only_flag = 1;", "vseq->seq_fields.bits.direct_8x8_inference_flag = 1;", "vseq->seq_fields.bits.log2_max_frame_num_minus4 = 4;", "vseq->seq_fields.bits.pic_order_cnt_type = 0;", "if (VAR_0->width != ctx->surface_width ||\nVAR_0->height != ctx->surface_height) {", "vseq->frame_cropping_flag = 1;", "vseq->frame_crop_left_offset = 0;", "vseq->frame_crop_right_offset =\n(ctx->surface_width - VAR_0->width) / 2;", "vseq->frame_crop_top_offset = 0;", "vseq->frame_crop_bottom_offset =\n(ctx->surface_height - VAR_0->height) / 2;", "} else {", "vseq->frame_cropping_flag = 0;", "}", "vseq->vui_parameters_present_flag = 1;", "if (VAR_0->sample_aspect_ratio.num != 0) {", "vseq->vui_fields.bits.aspect_ratio_info_present_flag = 1;", "if (VAR_0->sample_aspect_ratio.num ==\nVAR_0->sample_aspect_ratio.den) {", "vseq->aspect_ratio_idc = 1;", "} else {", "vseq->aspect_ratio_idc = 255;", "vseq->sar_width = VAR_0->sample_aspect_ratio.num;", "vseq->sar_height = VAR_0->sample_aspect_ratio.den;", "}", "}", "if (VAR_0->color_primaries != AVCOL_PRI_UNSPECIFIED ||\nVAR_0->color_trc != AVCOL_TRC_UNSPECIFIED ||\nVAR_0->colorspace != AVCOL_SPC_UNSPECIFIED) {", "mseq->video_signal_type_present_flag = 1;", "mseq->video_format = 5;", "mseq->video_full_range_flag = 0;", "mseq->colour_description_present_flag = 1;", "mseq->colour_primaries = VAR_0->color_primaries;", "mseq->transfer_characteristics = VAR_0->color_trc;", "mseq->matrix_coefficients = VAR_0->colorspace;", "}", "vseq->vui_fields.bits.bitstream_restriction_flag = 1;", "mseq->motion_vectors_over_pic_boundaries_flag = 1;", "mseq->max_bytes_per_pic_denom = 0;", "mseq->max_bits_per_mb_denom = 0;", "vseq->vui_fields.bits.log2_max_mv_length_horizontal = 16;", "vseq->vui_fields.bits.log2_max_mv_length_vertical = 16;", "mseq->max_num_reorder_frames = (VAR_0->max_b_frames > 0);", "mseq->max_dec_pic_buffering = vseq->max_num_ref_frames;", "vseq->bits_per_second = VAR_0->bit_rate;", "vseq->vui_fields.bits.timing_info_present_flag = 1;", "if (VAR_0->framerate.num > 0 && VAR_0->framerate.den > 0) {", "vseq->num_units_in_tick = VAR_0->framerate.den;", "vseq->time_scale = 2 * VAR_0->framerate.num;", "mseq->fixed_frame_rate_flag = 1;", "} else {", "vseq->num_units_in_tick = VAR_0->time_base.num;", "vseq->time_scale = 2 * VAR_0->time_base.den;", "mseq->fixed_frame_rate_flag = 0;", "}", "if (ctx->va_rc_mode == VA_RC_CBR) {", "priv->send_timing_sei = 1;", "mseq->nal_hrd_parameters_present_flag = 1;", "mseq->cpb_cnt_minus1 = 0;", "mseq->bit_rate_scale =\nav_clip_uintp2(av_log2(VAR_0->bit_rate) - 15 - 6, 4);", "mseq->bit_rate_value_minus1[0] =\n(VAR_0->bit_rate >> mseq->bit_rate_scale + 6) - 1;", "mseq->cpb_size_scale =\nav_clip_uintp2(av_log2(ctx->hrd_params.hrd.buffer_size) - 15 - 4, 4);", "mseq->cpb_size_value_minus1[0] =\n(ctx->hrd_params.hrd.buffer_size >> mseq->cpb_size_scale + 4) - 1;", "mseq->cbr_flag[0] = 0;", "mseq->initial_cpb_removal_delay_length_minus1 = 23;", "mseq->cpb_removal_delay_length_minus1 = 23;", "mseq->dpb_output_delay_length_minus1 = 7;", "mseq->time_offset_length = 0;", "mseq->initial_cpb_removal_delay = 90000 *\n(uint64_t)ctx->hrd_params.hrd.initial_buffer_fullness /\nctx->hrd_params.hrd.buffer_size;", "mseq->initial_cpb_removal_delay_offset = 0;", "} else {", "priv->send_timing_sei = 0;", "mseq->nal_hrd_parameters_present_flag = 0;", "}", "vseq->intra_period = ctx->p_per_i * (ctx->b_per_p + 1);", "vseq->intra_idr_period = vseq->intra_period;", "vseq->ip_period = ctx->b_per_p + 1;", "}", "{", "vpic->CurrPic.picture_id = VA_INVALID_ID;", "vpic->CurrPic.flags = VA_PICTURE_H264_INVALID;", "for (VAR_1 = 0; VAR_1 < FF_ARRAY_ELEMS(vpic->ReferenceFrames); VAR_1++) {", "vpic->ReferenceFrames[VAR_1].picture_id = VA_INVALID_ID;", "vpic->ReferenceFrames[VAR_1].flags = VA_PICTURE_H264_INVALID;", "}", "vpic->coded_buf = VA_INVALID_ID;", "vpic->pic_parameter_set_id = 0;", "vpic->seq_parameter_set_id = 0;", "vpic->num_ref_idx_l0_active_minus1 = 0;", "vpic->num_ref_idx_l1_active_minus1 = 0;", "vpic->pic_fields.bits.entropy_coding_mode_flag =\n((VAR_0->profile & 0xff) != 66);", "vpic->pic_fields.bits.weighted_pred_flag = 0;", "vpic->pic_fields.bits.weighted_bipred_idc = 0;", "vpic->pic_fields.bits.transform_8x8_mode_flag =\n((VAR_0->profile & 0xff) >= 100);", "vpic->pic_init_qp = priv->fixed_qp_idr;", "}", "{", "mseq->profile_idc = VAR_0->profile & 0xff;", "if (VAR_0->profile & FF_PROFILE_H264_CONSTRAINED)\nmseq->constraint_set1_flag = 1;", "if (VAR_0->profile & FF_PROFILE_H264_INTRA)\nmseq->constraint_set3_flag = 1;", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 25 ], [ 29 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 53, 55 ], [ 57 ], [ 61 ], [ 63, 65 ], [ 67 ], [ 69, 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 83 ], [ 85 ], [ 91, 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109, 111, 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 151 ], [ 153 ], [ 157 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 183 ], [ 185 ], [ 187 ], [ 191 ], [ 199, 201 ], [ 203, 205 ], [ 209, 211 ], [ 213, 215 ], [ 221 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 237, 239, 241 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 267 ], [ 269 ], [ 271 ], [ 275 ], [ 277 ], [ 279 ], [ 281 ], [ 285 ], [ 289 ], [ 291 ], [ 295 ], [ 297 ], [ 301, 303 ], [ 305 ], [ 307 ], [ 309, 311 ], [ 315 ], [ 317 ], [ 321 ], [ 323 ], [ 327, 329 ], [ 331, 333 ], [ 335 ], [ 339 ], [ 341 ] ]
11,114
static void socket_start_outgoing_migration(MigrationState *s, SocketAddress *saddr, Error **errp) { QIOChannelSocket *sioc = qio_channel_socket_new(); qio_channel_socket_connect_async(sioc, saddr, socket_outgoing_migration, s, NULL); qapi_free_SocketAddress(saddr); }
true
qemu
e122636562218b3d442cd2cd18fbc188dd9ce709
static void socket_start_outgoing_migration(MigrationState *s, SocketAddress *saddr, Error **errp) { QIOChannelSocket *sioc = qio_channel_socket_new(); qio_channel_socket_connect_async(sioc, saddr, socket_outgoing_migration, s, NULL); qapi_free_SocketAddress(saddr); }
{ "code": [ " s,", " NULL);" ], "line_no": [ 17, 19 ] }
static void FUNC_0(MigrationState *VAR_0, SocketAddress *VAR_1, Error **VAR_2) { QIOChannelSocket *sioc = qio_channel_socket_new(); qio_channel_socket_connect_async(sioc, VAR_1, socket_outgoing_migration, VAR_0, NULL); qapi_free_SocketAddress(VAR_1); }
[ "static void FUNC_0(MigrationState *VAR_0,\nSocketAddress *VAR_1,\nError **VAR_2)\n{", "QIOChannelSocket *sioc = qio_channel_socket_new();", "qio_channel_socket_connect_async(sioc,\nVAR_1,\nsocket_outgoing_migration,\nVAR_0,\nNULL);", "qapi_free_SocketAddress(VAR_1);", "}" ]
[ 0, 0, 1, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11, 13, 15, 17, 19 ], [ 21 ], [ 23 ] ]
11,115
void qdist_bin__internal(struct qdist *to, const struct qdist *from, size_t n) { double xmin, xmax; double step; size_t i, j; qdist_init(to); if (from->n == 0) { return; } if (n == 0 || from->n == 1) { n = from->n; } /* set equally-sized bins between @from's left and right */ xmin = qdist_xmin(from); xmax = qdist_xmax(from); step = (xmax - xmin) / n; if (n == from->n) { /* if @from's entries are equally spaced, no need to re-bin */ for (i = 0; i < from->n; i++) { if (from->entries[i].x != xmin + i * step) { goto rebin; } } /* they're equally spaced, so copy the dist and bail out */ to->entries = g_new(struct qdist_entry, from->n); to->n = from->n; memcpy(to->entries, from->entries, sizeof(*to->entries) * to->n); return; } rebin: j = 0; for (i = 0; i < n; i++) { double x; double left, right; left = xmin + i * step; right = xmin + (i + 1) * step; /* Add x, even if it might not get any counts later */ x = left; qdist_add(to, x, 0); /* * To avoid double-counting we capture [left, right) ranges, except for * the righmost bin, which captures a [left, right] range. */ while (j < from->n && (from->entries[j].x < right || i == n - 1)) { struct qdist_entry *o = &from->entries[j]; qdist_add(to, x, o->count); j++; } } }
true
qemu
f9dbc19e8bf58d0cbc830083352475bb16f315c4
void qdist_bin__internal(struct qdist *to, const struct qdist *from, size_t n) { double xmin, xmax; double step; size_t i, j; qdist_init(to); if (from->n == 0) { return; } if (n == 0 || from->n == 1) { n = from->n; } xmin = qdist_xmin(from); xmax = qdist_xmax(from); step = (xmax - xmin) / n; if (n == from->n) { for (i = 0; i < from->n; i++) { if (from->entries[i].x != xmin + i * step) { goto rebin; } } to->entries = g_new(struct qdist_entry, from->n); to->n = from->n; memcpy(to->entries, from->entries, sizeof(*to->entries) * to->n); return; } rebin: j = 0; for (i = 0; i < n; i++) { double x; double left, right; left = xmin + i * step; right = xmin + (i + 1) * step; x = left; qdist_add(to, x, 0); while (j < from->n && (from->entries[j].x < right || i == n - 1)) { struct qdist_entry *o = &from->entries[j]; qdist_add(to, x, o->count); j++; } } }
{ "code": [ " to->entries = g_new(struct qdist_entry, from->n);" ], "line_no": [ 57 ] }
void FUNC_0(struct qdist *VAR_0, const struct qdist *VAR_1, size_t VAR_2) { double VAR_3, VAR_4; double VAR_5; size_t i, j; qdist_init(VAR_0); if (VAR_1->VAR_2 == 0) { return; } if (VAR_2 == 0 || VAR_1->VAR_2 == 1) { VAR_2 = VAR_1->VAR_2; } VAR_3 = qdist_xmin(VAR_1); VAR_4 = qdist_xmax(VAR_1); VAR_5 = (VAR_4 - VAR_3) / VAR_2; if (VAR_2 == VAR_1->VAR_2) { for (i = 0; i < VAR_1->VAR_2; i++) { if (VAR_1->entries[i].x != VAR_3 + i * VAR_5) { goto rebin; } } VAR_0->entries = g_new(struct qdist_entry, VAR_1->VAR_2); VAR_0->VAR_2 = VAR_1->VAR_2; memcpy(VAR_0->entries, VAR_1->entries, sizeof(*VAR_0->entries) * VAR_0->VAR_2); return; } rebin: j = 0; for (i = 0; i < VAR_2; i++) { double x; double left, right; left = VAR_3 + i * VAR_5; right = VAR_3 + (i + 1) * VAR_5; x = left; qdist_add(VAR_0, x, 0); while (j < VAR_1->VAR_2 && (VAR_1->entries[j].x < right || i == VAR_2 - 1)) { struct qdist_entry *o = &VAR_1->entries[j]; qdist_add(VAR_0, x, o->count); j++; } } }
[ "void FUNC_0(struct qdist *VAR_0, const struct qdist *VAR_1, size_t VAR_2)\n{", "double VAR_3, VAR_4;", "double VAR_5;", "size_t i, j;", "qdist_init(VAR_0);", "if (VAR_1->VAR_2 == 0) {", "return;", "}", "if (VAR_2 == 0 || VAR_1->VAR_2 == 1) {", "VAR_2 = VAR_1->VAR_2;", "}", "VAR_3 = qdist_xmin(VAR_1);", "VAR_4 = qdist_xmax(VAR_1);", "VAR_5 = (VAR_4 - VAR_3) / VAR_2;", "if (VAR_2 == VAR_1->VAR_2) {", "for (i = 0; i < VAR_1->VAR_2; i++) {", "if (VAR_1->entries[i].x != VAR_3 + i * VAR_5) {", "goto rebin;", "}", "}", "VAR_0->entries = g_new(struct qdist_entry, VAR_1->VAR_2);", "VAR_0->VAR_2 = VAR_1->VAR_2;", "memcpy(VAR_0->entries, VAR_1->entries, sizeof(*VAR_0->entries) * VAR_0->VAR_2);", "return;", "}", "rebin:\nj = 0;", "for (i = 0; i < VAR_2; i++) {", "double x;", "double left, right;", "left = VAR_3 + i * VAR_5;", "right = VAR_3 + (i + 1) * VAR_5;", "x = left;", "qdist_add(VAR_0, x, 0);", "while (j < VAR_1->VAR_2 && (VAR_1->entries[j].x < right || i == VAR_2 - 1)) {", "struct qdist_entry *o = &VAR_1->entries[j];", "qdist_add(VAR_0, x, o->count);", "j++;", "}", "}", "}" ]
[ 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69, 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 83 ], [ 89 ], [ 91 ], [ 103 ], [ 105 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ] ]
11,116
static inline void asv2_put_level(PutBitContext *pb, int level) { unsigned int index = level + 31; if (index <= 62) { put_bits(pb, ff_asv2_level_tab[index][1], ff_asv2_level_tab[index][0]); } else { put_bits(pb, ff_asv2_level_tab[31][1], ff_asv2_level_tab[31][0]); asv2_put_bits(pb, 8, level & 0xFF); } }
true
FFmpeg
0bb5ad7a06ebcda9102357f8755d18b63f56aa29
static inline void asv2_put_level(PutBitContext *pb, int level) { unsigned int index = level + 31; if (index <= 62) { put_bits(pb, ff_asv2_level_tab[index][1], ff_asv2_level_tab[index][0]); } else { put_bits(pb, ff_asv2_level_tab[31][1], ff_asv2_level_tab[31][0]); asv2_put_bits(pb, 8, level & 0xFF); } }
{ "code": [ "static inline void asv2_put_level(PutBitContext *pb, int level)" ], "line_no": [ 1 ] }
static inline void FUNC_0(PutBitContext *VAR_0, int VAR_1) { unsigned int VAR_2 = VAR_1 + 31; if (VAR_2 <= 62) { put_bits(VAR_0, ff_asv2_level_tab[VAR_2][1], ff_asv2_level_tab[VAR_2][0]); } else { put_bits(VAR_0, ff_asv2_level_tab[31][1], ff_asv2_level_tab[31][0]); asv2_put_bits(VAR_0, 8, VAR_1 & 0xFF); } }
[ "static inline void FUNC_0(PutBitContext *VAR_0, int VAR_1)\n{", "unsigned int VAR_2 = VAR_1 + 31;", "if (VAR_2 <= 62) {", "put_bits(VAR_0, ff_asv2_level_tab[VAR_2][1], ff_asv2_level_tab[VAR_2][0]);", "} else {", "put_bits(VAR_0, ff_asv2_level_tab[31][1], ff_asv2_level_tab[31][0]);", "asv2_put_bits(VAR_0, 8, VAR_1 & 0xFF);", "}", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
11,118
int net_init_l2tpv3(const NetClientOptions *opts, const char *name, NetClientState *peer) { const NetdevL2TPv3Options *l2tpv3; NetL2TPV3State *s; NetClientState *nc; int fd = -1, gairet; struct addrinfo hints; struct addrinfo *result = NULL; char *srcport, *dstport; nc = qemu_new_net_client(&net_l2tpv3_info, peer, "l2tpv3", name); s = DO_UPCAST(NetL2TPV3State, nc, nc); s->queue_head = 0; s->queue_tail = 0; s->header_mismatch = false; assert(opts->kind == NET_CLIENT_OPTIONS_KIND_L2TPV3); l2tpv3 = opts->l2tpv3; if (l2tpv3->has_ipv6 && l2tpv3->ipv6) { s->ipv6 = l2tpv3->ipv6; } else { s->ipv6 = false; } if ((l2tpv3->has_offset) && (l2tpv3->offset > 256)) { error_report("l2tpv3_open : offset must be less than 256 bytes"); goto outerr; } if (l2tpv3->has_rxcookie || l2tpv3->has_txcookie) { if (l2tpv3->has_rxcookie && l2tpv3->has_txcookie) { s->cookie = true; } else { goto outerr; } } else { s->cookie = false; } if (l2tpv3->has_cookie64 || l2tpv3->cookie64) { s->cookie_is_64 = true; } else { s->cookie_is_64 = false; } if (l2tpv3->has_udp && l2tpv3->udp) { s->udp = true; if (!(l2tpv3->has_srcport && l2tpv3->has_dstport)) { error_report("l2tpv3_open : need both src and dst port for udp"); goto outerr; } else { srcport = l2tpv3->srcport; dstport = l2tpv3->dstport; } } else { s->udp = false; srcport = NULL; dstport = NULL; } s->offset = 4; s->session_offset = 0; s->cookie_offset = 4; s->counter_offset = 4; s->tx_session = l2tpv3->txsession; if (l2tpv3->has_rxsession) { s->rx_session = l2tpv3->rxsession; } else { s->rx_session = s->tx_session; } if (s->cookie) { s->rx_cookie = l2tpv3->rxcookie; s->tx_cookie = l2tpv3->txcookie; if (s->cookie_is_64 == true) { /* 64 bit cookie */ s->offset += 8; s->counter_offset += 8; } else { /* 32 bit cookie */ s->offset += 4; s->counter_offset += 4; } } memset(&hints, 0, sizeof(hints)); if (s->ipv6) { hints.ai_family = AF_INET6; } else { hints.ai_family = AF_INET; } if (s->udp) { hints.ai_socktype = SOCK_DGRAM; hints.ai_protocol = 0; s->offset += 4; s->counter_offset += 4; s->session_offset += 4; s->cookie_offset += 4; } else { hints.ai_socktype = SOCK_RAW; hints.ai_protocol = IPPROTO_L2TP; } gairet = getaddrinfo(l2tpv3->src, srcport, &hints, &result); if ((gairet != 0) || (result == NULL)) { error_report( "l2tpv3_open : could not resolve src, errno = %s", gai_strerror(gairet) ); goto outerr; } fd = socket(result->ai_family, result->ai_socktype, result->ai_protocol); if (fd == -1) { fd = -errno; error_report("l2tpv3_open : socket creation failed, errno = %d", -fd); goto outerr; } if (bind(fd, (struct sockaddr *) result->ai_addr, result->ai_addrlen)) { error_report("l2tpv3_open : could not bind socket err=%i", errno); goto outerr; } if (result) { freeaddrinfo(result); } memset(&hints, 0, sizeof(hints)); if (s->ipv6) { hints.ai_family = AF_INET6; } else { hints.ai_family = AF_INET; } if (s->udp) { hints.ai_socktype = SOCK_DGRAM; hints.ai_protocol = 0; } else { hints.ai_socktype = SOCK_RAW; hints.ai_protocol = IPPROTO_L2TP; } result = NULL; gairet = getaddrinfo(l2tpv3->dst, dstport, &hints, &result); if ((gairet != 0) || (result == NULL)) { error_report( "l2tpv3_open : could not resolve dst, error = %s", gai_strerror(gairet) ); goto outerr; } s->dgram_dst = g_malloc(sizeof(struct sockaddr_storage)); memset(s->dgram_dst, '\0' , sizeof(struct sockaddr_storage)); memcpy(s->dgram_dst, result->ai_addr, result->ai_addrlen); s->dst_size = result->ai_addrlen; if (result) { freeaddrinfo(result); } if (l2tpv3->has_counter && l2tpv3->counter) { s->has_counter = true; s->offset += 4; } else { s->has_counter = false; } if (l2tpv3->has_pincounter && l2tpv3->pincounter) { s->has_counter = true; /* pin counter implies that there is counter */ s->pin_counter = true; } else { s->pin_counter = false; } if (l2tpv3->has_offset) { /* extra offset */ s->offset += l2tpv3->offset; } if ((s->ipv6) || (s->udp)) { s->header_size = s->offset; } else { s->header_size = s->offset + sizeof(struct iphdr); } s->msgvec = build_l2tpv3_vector(s, MAX_L2TPV3_MSGCNT); s->vec = g_malloc(sizeof(struct iovec) * MAX_L2TPV3_IOVCNT); s->header_buf = g_malloc(s->header_size); qemu_set_nonblock(fd); s->fd = fd; s->counter = 0; l2tpv3_read_poll(s, true); snprintf(s->nc.info_str, sizeof(s->nc.info_str), "l2tpv3: connected"); return 0; outerr: qemu_del_net_client(nc); if (fd > 0) { close(fd); } if (result) { freeaddrinfo(result); } return -1; }
true
qemu
d4754a953196516b16beef707dcdfdb35c2eec6e
int net_init_l2tpv3(const NetClientOptions *opts, const char *name, NetClientState *peer) { const NetdevL2TPv3Options *l2tpv3; NetL2TPV3State *s; NetClientState *nc; int fd = -1, gairet; struct addrinfo hints; struct addrinfo *result = NULL; char *srcport, *dstport; nc = qemu_new_net_client(&net_l2tpv3_info, peer, "l2tpv3", name); s = DO_UPCAST(NetL2TPV3State, nc, nc); s->queue_head = 0; s->queue_tail = 0; s->header_mismatch = false; assert(opts->kind == NET_CLIENT_OPTIONS_KIND_L2TPV3); l2tpv3 = opts->l2tpv3; if (l2tpv3->has_ipv6 && l2tpv3->ipv6) { s->ipv6 = l2tpv3->ipv6; } else { s->ipv6 = false; } if ((l2tpv3->has_offset) && (l2tpv3->offset > 256)) { error_report("l2tpv3_open : offset must be less than 256 bytes"); goto outerr; } if (l2tpv3->has_rxcookie || l2tpv3->has_txcookie) { if (l2tpv3->has_rxcookie && l2tpv3->has_txcookie) { s->cookie = true; } else { goto outerr; } } else { s->cookie = false; } if (l2tpv3->has_cookie64 || l2tpv3->cookie64) { s->cookie_is_64 = true; } else { s->cookie_is_64 = false; } if (l2tpv3->has_udp && l2tpv3->udp) { s->udp = true; if (!(l2tpv3->has_srcport && l2tpv3->has_dstport)) { error_report("l2tpv3_open : need both src and dst port for udp"); goto outerr; } else { srcport = l2tpv3->srcport; dstport = l2tpv3->dstport; } } else { s->udp = false; srcport = NULL; dstport = NULL; } s->offset = 4; s->session_offset = 0; s->cookie_offset = 4; s->counter_offset = 4; s->tx_session = l2tpv3->txsession; if (l2tpv3->has_rxsession) { s->rx_session = l2tpv3->rxsession; } else { s->rx_session = s->tx_session; } if (s->cookie) { s->rx_cookie = l2tpv3->rxcookie; s->tx_cookie = l2tpv3->txcookie; if (s->cookie_is_64 == true) { s->offset += 8; s->counter_offset += 8; } else { s->offset += 4; s->counter_offset += 4; } } memset(&hints, 0, sizeof(hints)); if (s->ipv6) { hints.ai_family = AF_INET6; } else { hints.ai_family = AF_INET; } if (s->udp) { hints.ai_socktype = SOCK_DGRAM; hints.ai_protocol = 0; s->offset += 4; s->counter_offset += 4; s->session_offset += 4; s->cookie_offset += 4; } else { hints.ai_socktype = SOCK_RAW; hints.ai_protocol = IPPROTO_L2TP; } gairet = getaddrinfo(l2tpv3->src, srcport, &hints, &result); if ((gairet != 0) || (result == NULL)) { error_report( "l2tpv3_open : could not resolve src, errno = %s", gai_strerror(gairet) ); goto outerr; } fd = socket(result->ai_family, result->ai_socktype, result->ai_protocol); if (fd == -1) { fd = -errno; error_report("l2tpv3_open : socket creation failed, errno = %d", -fd); goto outerr; } if (bind(fd, (struct sockaddr *) result->ai_addr, result->ai_addrlen)) { error_report("l2tpv3_open : could not bind socket err=%i", errno); goto outerr; } if (result) { freeaddrinfo(result); } memset(&hints, 0, sizeof(hints)); if (s->ipv6) { hints.ai_family = AF_INET6; } else { hints.ai_family = AF_INET; } if (s->udp) { hints.ai_socktype = SOCK_DGRAM; hints.ai_protocol = 0; } else { hints.ai_socktype = SOCK_RAW; hints.ai_protocol = IPPROTO_L2TP; } result = NULL; gairet = getaddrinfo(l2tpv3->dst, dstport, &hints, &result); if ((gairet != 0) || (result == NULL)) { error_report( "l2tpv3_open : could not resolve dst, error = %s", gai_strerror(gairet) ); goto outerr; } s->dgram_dst = g_malloc(sizeof(struct sockaddr_storage)); memset(s->dgram_dst, '\0' , sizeof(struct sockaddr_storage)); memcpy(s->dgram_dst, result->ai_addr, result->ai_addrlen); s->dst_size = result->ai_addrlen; if (result) { freeaddrinfo(result); } if (l2tpv3->has_counter && l2tpv3->counter) { s->has_counter = true; s->offset += 4; } else { s->has_counter = false; } if (l2tpv3->has_pincounter && l2tpv3->pincounter) { s->has_counter = true; s->pin_counter = true; } else { s->pin_counter = false; } if (l2tpv3->has_offset) { s->offset += l2tpv3->offset; } if ((s->ipv6) || (s->udp)) { s->header_size = s->offset; } else { s->header_size = s->offset + sizeof(struct iphdr); } s->msgvec = build_l2tpv3_vector(s, MAX_L2TPV3_MSGCNT); s->vec = g_malloc(sizeof(struct iovec) * MAX_L2TPV3_IOVCNT); s->header_buf = g_malloc(s->header_size); qemu_set_nonblock(fd); s->fd = fd; s->counter = 0; l2tpv3_read_poll(s, true); snprintf(s->nc.info_str, sizeof(s->nc.info_str), "l2tpv3: connected"); return 0; outerr: qemu_del_net_client(nc); if (fd > 0) { close(fd); } if (result) { freeaddrinfo(result); } return -1; }
{ "code": [ " if (fd > 0) {" ], "line_no": [ 423 ] }
int FUNC_0(const NetClientOptions *VAR_0, const char *VAR_1, NetClientState *VAR_2) { const NetdevL2TPv3Options *VAR_3; NetL2TPV3State *s; NetClientState *nc; int VAR_4 = -1, VAR_5; struct addrinfo VAR_6; struct addrinfo *VAR_7 = NULL; char *VAR_8, *VAR_9; nc = qemu_new_net_client(&net_l2tpv3_info, VAR_2, "VAR_3", VAR_1); s = DO_UPCAST(NetL2TPV3State, nc, nc); s->queue_head = 0; s->queue_tail = 0; s->header_mismatch = false; assert(VAR_0->kind == NET_CLIENT_OPTIONS_KIND_L2TPV3); VAR_3 = VAR_0->VAR_3; if (VAR_3->has_ipv6 && VAR_3->ipv6) { s->ipv6 = VAR_3->ipv6; } else { s->ipv6 = false; } if ((VAR_3->has_offset) && (VAR_3->offset > 256)) { error_report("l2tpv3_open : offset must be less than 256 bytes"); goto outerr; } if (VAR_3->has_rxcookie || VAR_3->has_txcookie) { if (VAR_3->has_rxcookie && VAR_3->has_txcookie) { s->cookie = true; } else { goto outerr; } } else { s->cookie = false; } if (VAR_3->has_cookie64 || VAR_3->cookie64) { s->cookie_is_64 = true; } else { s->cookie_is_64 = false; } if (VAR_3->has_udp && VAR_3->udp) { s->udp = true; if (!(VAR_3->has_srcport && VAR_3->has_dstport)) { error_report("l2tpv3_open : need both src and dst port for udp"); goto outerr; } else { VAR_8 = VAR_3->VAR_8; VAR_9 = VAR_3->VAR_9; } } else { s->udp = false; VAR_8 = NULL; VAR_9 = NULL; } s->offset = 4; s->session_offset = 0; s->cookie_offset = 4; s->counter_offset = 4; s->tx_session = VAR_3->txsession; if (VAR_3->has_rxsession) { s->rx_session = VAR_3->rxsession; } else { s->rx_session = s->tx_session; } if (s->cookie) { s->rx_cookie = VAR_3->rxcookie; s->tx_cookie = VAR_3->txcookie; if (s->cookie_is_64 == true) { s->offset += 8; s->counter_offset += 8; } else { s->offset += 4; s->counter_offset += 4; } } memset(&VAR_6, 0, sizeof(VAR_6)); if (s->ipv6) { VAR_6.ai_family = AF_INET6; } else { VAR_6.ai_family = AF_INET; } if (s->udp) { VAR_6.ai_socktype = SOCK_DGRAM; VAR_6.ai_protocol = 0; s->offset += 4; s->counter_offset += 4; s->session_offset += 4; s->cookie_offset += 4; } else { VAR_6.ai_socktype = SOCK_RAW; VAR_6.ai_protocol = IPPROTO_L2TP; } VAR_5 = getaddrinfo(VAR_3->src, VAR_8, &VAR_6, &VAR_7); if ((VAR_5 != 0) || (VAR_7 == NULL)) { error_report( "l2tpv3_open : could not resolve src, errno = %s", gai_strerror(VAR_5) ); goto outerr; } VAR_4 = socket(VAR_7->ai_family, VAR_7->ai_socktype, VAR_7->ai_protocol); if (VAR_4 == -1) { VAR_4 = -errno; error_report("l2tpv3_open : socket creation failed, errno = %d", -VAR_4); goto outerr; } if (bind(VAR_4, (struct sockaddr *) VAR_7->ai_addr, VAR_7->ai_addrlen)) { error_report("l2tpv3_open : could not bind socket err=%i", errno); goto outerr; } if (VAR_7) { freeaddrinfo(VAR_7); } memset(&VAR_6, 0, sizeof(VAR_6)); if (s->ipv6) { VAR_6.ai_family = AF_INET6; } else { VAR_6.ai_family = AF_INET; } if (s->udp) { VAR_6.ai_socktype = SOCK_DGRAM; VAR_6.ai_protocol = 0; } else { VAR_6.ai_socktype = SOCK_RAW; VAR_6.ai_protocol = IPPROTO_L2TP; } VAR_7 = NULL; VAR_5 = getaddrinfo(VAR_3->dst, VAR_9, &VAR_6, &VAR_7); if ((VAR_5 != 0) || (VAR_7 == NULL)) { error_report( "l2tpv3_open : could not resolve dst, error = %s", gai_strerror(VAR_5) ); goto outerr; } s->dgram_dst = g_malloc(sizeof(struct sockaddr_storage)); memset(s->dgram_dst, '\0' , sizeof(struct sockaddr_storage)); memcpy(s->dgram_dst, VAR_7->ai_addr, VAR_7->ai_addrlen); s->dst_size = VAR_7->ai_addrlen; if (VAR_7) { freeaddrinfo(VAR_7); } if (VAR_3->has_counter && VAR_3->counter) { s->has_counter = true; s->offset += 4; } else { s->has_counter = false; } if (VAR_3->has_pincounter && VAR_3->pincounter) { s->has_counter = true; s->pin_counter = true; } else { s->pin_counter = false; } if (VAR_3->has_offset) { s->offset += VAR_3->offset; } if ((s->ipv6) || (s->udp)) { s->header_size = s->offset; } else { s->header_size = s->offset + sizeof(struct iphdr); } s->msgvec = build_l2tpv3_vector(s, MAX_L2TPV3_MSGCNT); s->vec = g_malloc(sizeof(struct iovec) * MAX_L2TPV3_IOVCNT); s->header_buf = g_malloc(s->header_size); qemu_set_nonblock(VAR_4); s->VAR_4 = VAR_4; s->counter = 0; l2tpv3_read_poll(s, true); snprintf(s->nc.info_str, sizeof(s->nc.info_str), "VAR_3: connected"); return 0; outerr: qemu_del_net_client(nc); if (VAR_4 > 0) { close(VAR_4); } if (VAR_7) { freeaddrinfo(VAR_7); } return -1; }
[ "int FUNC_0(const NetClientOptions *VAR_0,\nconst char *VAR_1,\nNetClientState *VAR_2)\n{", "const NetdevL2TPv3Options *VAR_3;", "NetL2TPV3State *s;", "NetClientState *nc;", "int VAR_4 = -1, VAR_5;", "struct addrinfo VAR_6;", "struct addrinfo *VAR_7 = NULL;", "char *VAR_8, *VAR_9;", "nc = qemu_new_net_client(&net_l2tpv3_info, VAR_2, \"VAR_3\", VAR_1);", "s = DO_UPCAST(NetL2TPV3State, nc, nc);", "s->queue_head = 0;", "s->queue_tail = 0;", "s->header_mismatch = false;", "assert(VAR_0->kind == NET_CLIENT_OPTIONS_KIND_L2TPV3);", "VAR_3 = VAR_0->VAR_3;", "if (VAR_3->has_ipv6 && VAR_3->ipv6) {", "s->ipv6 = VAR_3->ipv6;", "} else {", "s->ipv6 = false;", "}", "if ((VAR_3->has_offset) && (VAR_3->offset > 256)) {", "error_report(\"l2tpv3_open : offset must be less than 256 bytes\");", "goto outerr;", "}", "if (VAR_3->has_rxcookie || VAR_3->has_txcookie) {", "if (VAR_3->has_rxcookie && VAR_3->has_txcookie) {", "s->cookie = true;", "} else {", "goto outerr;", "}", "} else {", "s->cookie = false;", "}", "if (VAR_3->has_cookie64 || VAR_3->cookie64) {", "s->cookie_is_64 = true;", "} else {", "s->cookie_is_64 = false;", "}", "if (VAR_3->has_udp && VAR_3->udp) {", "s->udp = true;", "if (!(VAR_3->has_srcport && VAR_3->has_dstport)) {", "error_report(\"l2tpv3_open : need both src and dst port for udp\");", "goto outerr;", "} else {", "VAR_8 = VAR_3->VAR_8;", "VAR_9 = VAR_3->VAR_9;", "}", "} else {", "s->udp = false;", "VAR_8 = NULL;", "VAR_9 = NULL;", "}", "s->offset = 4;", "s->session_offset = 0;", "s->cookie_offset = 4;", "s->counter_offset = 4;", "s->tx_session = VAR_3->txsession;", "if (VAR_3->has_rxsession) {", "s->rx_session = VAR_3->rxsession;", "} else {", "s->rx_session = s->tx_session;", "}", "if (s->cookie) {", "s->rx_cookie = VAR_3->rxcookie;", "s->tx_cookie = VAR_3->txcookie;", "if (s->cookie_is_64 == true) {", "s->offset += 8;", "s->counter_offset += 8;", "} else {", "s->offset += 4;", "s->counter_offset += 4;", "}", "}", "memset(&VAR_6, 0, sizeof(VAR_6));", "if (s->ipv6) {", "VAR_6.ai_family = AF_INET6;", "} else {", "VAR_6.ai_family = AF_INET;", "}", "if (s->udp) {", "VAR_6.ai_socktype = SOCK_DGRAM;", "VAR_6.ai_protocol = 0;", "s->offset += 4;", "s->counter_offset += 4;", "s->session_offset += 4;", "s->cookie_offset += 4;", "} else {", "VAR_6.ai_socktype = SOCK_RAW;", "VAR_6.ai_protocol = IPPROTO_L2TP;", "}", "VAR_5 = getaddrinfo(VAR_3->src, VAR_8, &VAR_6, &VAR_7);", "if ((VAR_5 != 0) || (VAR_7 == NULL)) {", "error_report(\n\"l2tpv3_open : could not resolve src, errno = %s\",\ngai_strerror(VAR_5)\n);", "goto outerr;", "}", "VAR_4 = socket(VAR_7->ai_family, VAR_7->ai_socktype, VAR_7->ai_protocol);", "if (VAR_4 == -1) {", "VAR_4 = -errno;", "error_report(\"l2tpv3_open : socket creation failed, errno = %d\", -VAR_4);", "goto outerr;", "}", "if (bind(VAR_4, (struct sockaddr *) VAR_7->ai_addr, VAR_7->ai_addrlen)) {", "error_report(\"l2tpv3_open : could not bind socket err=%i\", errno);", "goto outerr;", "}", "if (VAR_7) {", "freeaddrinfo(VAR_7);", "}", "memset(&VAR_6, 0, sizeof(VAR_6));", "if (s->ipv6) {", "VAR_6.ai_family = AF_INET6;", "} else {", "VAR_6.ai_family = AF_INET;", "}", "if (s->udp) {", "VAR_6.ai_socktype = SOCK_DGRAM;", "VAR_6.ai_protocol = 0;", "} else {", "VAR_6.ai_socktype = SOCK_RAW;", "VAR_6.ai_protocol = IPPROTO_L2TP;", "}", "VAR_7 = NULL;", "VAR_5 = getaddrinfo(VAR_3->dst, VAR_9, &VAR_6, &VAR_7);", "if ((VAR_5 != 0) || (VAR_7 == NULL)) {", "error_report(\n\"l2tpv3_open : could not resolve dst, error = %s\",\ngai_strerror(VAR_5)\n);", "goto outerr;", "}", "s->dgram_dst = g_malloc(sizeof(struct sockaddr_storage));", "memset(s->dgram_dst, '\\0' , sizeof(struct sockaddr_storage));", "memcpy(s->dgram_dst, VAR_7->ai_addr, VAR_7->ai_addrlen);", "s->dst_size = VAR_7->ai_addrlen;", "if (VAR_7) {", "freeaddrinfo(VAR_7);", "}", "if (VAR_3->has_counter && VAR_3->counter) {", "s->has_counter = true;", "s->offset += 4;", "} else {", "s->has_counter = false;", "}", "if (VAR_3->has_pincounter && VAR_3->pincounter) {", "s->has_counter = true;", "s->pin_counter = true;", "} else {", "s->pin_counter = false;", "}", "if (VAR_3->has_offset) {", "s->offset += VAR_3->offset;", "}", "if ((s->ipv6) || (s->udp)) {", "s->header_size = s->offset;", "} else {", "s->header_size = s->offset + sizeof(struct iphdr);", "}", "s->msgvec = build_l2tpv3_vector(s, MAX_L2TPV3_MSGCNT);", "s->vec = g_malloc(sizeof(struct iovec) * MAX_L2TPV3_IOVCNT);", "s->header_buf = g_malloc(s->header_size);", "qemu_set_nonblock(VAR_4);", "s->VAR_4 = VAR_4;", "s->counter = 0;", "l2tpv3_read_poll(s, true);", "snprintf(s->nc.info_str, sizeof(s->nc.info_str),\n\"VAR_3: connected\");", "return 0;", "outerr:\nqemu_del_net_client(nc);", "if (VAR_4 > 0) {", "close(VAR_4);", "}", "if (VAR_7) {", "freeaddrinfo(VAR_7);", "}", "return -1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 171 ], [ 173 ], [ 175 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 189 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 227 ], [ 231 ], [ 233, 235, 237, 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 273 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ], [ 291 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 303 ], [ 305 ], [ 307 ], [ 309, 311, 313, 315 ], [ 317 ], [ 319 ], [ 323 ], [ 325 ], [ 327 ], [ 329 ], [ 333 ], [ 335 ], [ 337 ], [ 341 ], [ 343 ], [ 345 ], [ 347 ], [ 349 ], [ 351 ], [ 355 ], [ 357 ], [ 359 ], [ 361 ], [ 363 ], [ 365 ], [ 369 ], [ 373 ], [ 375 ], [ 379 ], [ 381 ], [ 383 ], [ 385 ], [ 387 ], [ 391 ], [ 393 ], [ 395 ], [ 399 ], [ 403 ], [ 405 ], [ 409 ], [ 413, 415 ], [ 417 ], [ 419, 421 ], [ 423 ], [ 425 ], [ 427 ], [ 429 ], [ 431 ], [ 433 ], [ 435 ], [ 437 ] ]
11,119
static int subtitle_thread(void *arg) { VideoState *is = arg; Frame *sp; int got_subtitle; double pts; int i, j; int r, g, b, y, u, v, a; for (;;) { while (is->paused && !is->subtitleq.abort_request) { SDL_Delay(10); } if (!(sp = frame_queue_peek_writable(&is->subpq))) return 0; if ((got_subtitle = decoder_decode_frame(&is->subdec, &sp->sub)) < 0) break; pts = 0; if (got_subtitle && sp->sub.format == 0) { if (sp->sub.pts != AV_NOPTS_VALUE) pts = sp->sub.pts / (double)AV_TIME_BASE; sp->pts = pts; sp->serial = is->subdec.pkt_serial; for (i = 0; i < sp->sub.num_rects; i++) { for (j = 0; j < sp->sub.rects[i]->nb_colors; j++) { RGBA_IN(r, g, b, a, (uint32_t*)sp->sub.rects[i]->pict.data[1] + j); y = RGB_TO_Y_CCIR(r, g, b); u = RGB_TO_U_CCIR(r, g, b, 0); v = RGB_TO_V_CCIR(r, g, b, 0); YUVA_OUT((uint32_t*)sp->sub.rects[i]->pict.data[1] + j, y, u, v, a); } } /* now we can update the picture count */ frame_queue_push(&is->subpq); } else if (got_subtitle) { avsubtitle_free(&sp->sub); } } return 0; }
true
FFmpeg
2ec4a84dca603a24a8131297036dfe30eed33dd7
static int subtitle_thread(void *arg) { VideoState *is = arg; Frame *sp; int got_subtitle; double pts; int i, j; int r, g, b, y, u, v, a; for (;;) { while (is->paused && !is->subtitleq.abort_request) { SDL_Delay(10); } if (!(sp = frame_queue_peek_writable(&is->subpq))) return 0; if ((got_subtitle = decoder_decode_frame(&is->subdec, &sp->sub)) < 0) break; pts = 0; if (got_subtitle && sp->sub.format == 0) { if (sp->sub.pts != AV_NOPTS_VALUE) pts = sp->sub.pts / (double)AV_TIME_BASE; sp->pts = pts; sp->serial = is->subdec.pkt_serial; for (i = 0; i < sp->sub.num_rects; i++) { for (j = 0; j < sp->sub.rects[i]->nb_colors; j++) { RGBA_IN(r, g, b, a, (uint32_t*)sp->sub.rects[i]->pict.data[1] + j); y = RGB_TO_Y_CCIR(r, g, b); u = RGB_TO_U_CCIR(r, g, b, 0); v = RGB_TO_V_CCIR(r, g, b, 0); YUVA_OUT((uint32_t*)sp->sub.rects[i]->pict.data[1] + j, y, u, v, a); } } frame_queue_push(&is->subpq); } else if (got_subtitle) { avsubtitle_free(&sp->sub); } } return 0; }
{ "code": [ " if ((got_subtitle = decoder_decode_frame(&is->subdec, &sp->sub)) < 0)" ], "line_no": [ 35 ] }
static int FUNC_0(void *VAR_0) { VideoState *is = VAR_0; Frame *sp; int VAR_1; double VAR_2; int VAR_3, VAR_4; int VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_11; for (;;) { while (is->paused && !is->subtitleq.abort_request) { SDL_Delay(10); } if (!(sp = frame_queue_peek_writable(&is->subpq))) return 0; if ((VAR_1 = decoder_decode_frame(&is->subdec, &sp->sub)) < 0) break; VAR_2 = 0; if (VAR_1 && sp->sub.format == 0) { if (sp->sub.VAR_2 != AV_NOPTS_VALUE) VAR_2 = sp->sub.VAR_2 / (double)AV_TIME_BASE; sp->VAR_2 = VAR_2; sp->serial = is->subdec.pkt_serial; for (VAR_3 = 0; VAR_3 < sp->sub.num_rects; VAR_3++) { for (VAR_4 = 0; VAR_4 < sp->sub.rects[VAR_3]->nb_colors; VAR_4++) { RGBA_IN(VAR_5, VAR_6, VAR_7, VAR_11, (uint32_t*)sp->sub.rects[VAR_3]->pict.data[1] + VAR_4); VAR_8 = RGB_TO_Y_CCIR(VAR_5, VAR_6, VAR_7); VAR_9 = RGB_TO_U_CCIR(VAR_5, VAR_6, VAR_7, 0); VAR_10 = RGB_TO_V_CCIR(VAR_5, VAR_6, VAR_7, 0); YUVA_OUT((uint32_t*)sp->sub.rects[VAR_3]->pict.data[1] + VAR_4, VAR_8, VAR_9, VAR_10, VAR_11); } } frame_queue_push(&is->subpq); } else if (VAR_1) { avsubtitle_free(&sp->sub); } } return 0; }
[ "static int FUNC_0(void *VAR_0)\n{", "VideoState *is = VAR_0;", "Frame *sp;", "int VAR_1;", "double VAR_2;", "int VAR_3, VAR_4;", "int VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_11;", "for (;;) {", "while (is->paused && !is->subtitleq.abort_request) {", "SDL_Delay(10);", "}", "if (!(sp = frame_queue_peek_writable(&is->subpq)))\nreturn 0;", "if ((VAR_1 = decoder_decode_frame(&is->subdec, &sp->sub)) < 0)\nbreak;", "VAR_2 = 0;", "if (VAR_1 && sp->sub.format == 0) {", "if (sp->sub.VAR_2 != AV_NOPTS_VALUE)\nVAR_2 = sp->sub.VAR_2 / (double)AV_TIME_BASE;", "sp->VAR_2 = VAR_2;", "sp->serial = is->subdec.pkt_serial;", "for (VAR_3 = 0; VAR_3 < sp->sub.num_rects; VAR_3++)", "{", "for (VAR_4 = 0; VAR_4 < sp->sub.rects[VAR_3]->nb_colors; VAR_4++)", "{", "RGBA_IN(VAR_5, VAR_6, VAR_7, VAR_11, (uint32_t*)sp->sub.rects[VAR_3]->pict.data[1] + VAR_4);", "VAR_8 = RGB_TO_Y_CCIR(VAR_5, VAR_6, VAR_7);", "VAR_9 = RGB_TO_U_CCIR(VAR_5, VAR_6, VAR_7, 0);", "VAR_10 = RGB_TO_V_CCIR(VAR_5, VAR_6, VAR_7, 0);", "YUVA_OUT((uint32_t*)sp->sub.rects[VAR_3]->pict.data[1] + VAR_4, VAR_8, VAR_9, VAR_10, VAR_11);", "}", "}", "frame_queue_push(&is->subpq);", "} else if (VAR_1) {", "avsubtitle_free(&sp->sub);", "}", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29, 31 ], [ 35, 37 ], [ 41 ], [ 45 ], [ 47, 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ] ]
11,120
static av_cold int avisynth_load_library(void) { avs_library.library = LoadLibrary(AVISYNTH_LIB); if (!avs_library.library) return AVERROR_UNKNOWN; #define LOAD_AVS_FUNC(name, continue_on_fail) \ avs_library.name = \ (void *)GetProcAddress(avs_library.library, #name); \ if (!continue_on_fail && !avs_library.name) \ goto fail; LOAD_AVS_FUNC(avs_bit_blt, 0); LOAD_AVS_FUNC(avs_clip_get_error, 0); LOAD_AVS_FUNC(avs_create_script_environment, 0); LOAD_AVS_FUNC(avs_delete_script_environment, 0); LOAD_AVS_FUNC(avs_get_audio, 0); LOAD_AVS_FUNC(avs_get_error, 1); // New to AviSynth 2.6 LOAD_AVS_FUNC(avs_get_frame, 0); LOAD_AVS_FUNC(avs_get_version, 0); LOAD_AVS_FUNC(avs_get_video_info, 0); LOAD_AVS_FUNC(avs_invoke, 0); LOAD_AVS_FUNC(avs_release_clip, 0); LOAD_AVS_FUNC(avs_release_value, 0); LOAD_AVS_FUNC(avs_release_video_frame, 0); LOAD_AVS_FUNC(avs_take_clip, 0); #ifdef USING_AVISYNTH LOAD_AVS_FUNC(avs_bits_per_pixel, 1); LOAD_AVS_FUNC(avs_get_height_p, 1); LOAD_AVS_FUNC(avs_get_pitch_p, 1); LOAD_AVS_FUNC(avs_get_read_ptr_p, 1); LOAD_AVS_FUNC(avs_get_row_size_p, 1); LOAD_AVS_FUNC(avs_is_yv24, 1); LOAD_AVS_FUNC(avs_is_yv16, 1); LOAD_AVS_FUNC(avs_is_yv411, 1); LOAD_AVS_FUNC(avs_is_y8, 1); #endif #undef LOAD_AVS_FUNC atexit(avisynth_atexit_handler); return 0; fail: FreeLibrary(avs_library.library); return AVERROR_UNKNOWN; }
false
FFmpeg
0ed5c3ce81811dcd93f21cdd1204d4c68bca9654
static av_cold int avisynth_load_library(void) { avs_library.library = LoadLibrary(AVISYNTH_LIB); if (!avs_library.library) return AVERROR_UNKNOWN; #define LOAD_AVS_FUNC(name, continue_on_fail) \ avs_library.name = \ (void *)GetProcAddress(avs_library.library, #name); \ if (!continue_on_fail && !avs_library.name) \ goto fail; LOAD_AVS_FUNC(avs_bit_blt, 0); LOAD_AVS_FUNC(avs_clip_get_error, 0); LOAD_AVS_FUNC(avs_create_script_environment, 0); LOAD_AVS_FUNC(avs_delete_script_environment, 0); LOAD_AVS_FUNC(avs_get_audio, 0); LOAD_AVS_FUNC(avs_get_error, 1); LOAD_AVS_FUNC(avs_get_frame, 0); LOAD_AVS_FUNC(avs_get_version, 0); LOAD_AVS_FUNC(avs_get_video_info, 0); LOAD_AVS_FUNC(avs_invoke, 0); LOAD_AVS_FUNC(avs_release_clip, 0); LOAD_AVS_FUNC(avs_release_value, 0); LOAD_AVS_FUNC(avs_release_video_frame, 0); LOAD_AVS_FUNC(avs_take_clip, 0); #ifdef USING_AVISYNTH LOAD_AVS_FUNC(avs_bits_per_pixel, 1); LOAD_AVS_FUNC(avs_get_height_p, 1); LOAD_AVS_FUNC(avs_get_pitch_p, 1); LOAD_AVS_FUNC(avs_get_read_ptr_p, 1); LOAD_AVS_FUNC(avs_get_row_size_p, 1); LOAD_AVS_FUNC(avs_is_yv24, 1); LOAD_AVS_FUNC(avs_is_yv16, 1); LOAD_AVS_FUNC(avs_is_yv411, 1); LOAD_AVS_FUNC(avs_is_y8, 1); #endif #undef LOAD_AVS_FUNC atexit(avisynth_atexit_handler); return 0; fail: FreeLibrary(avs_library.library); return AVERROR_UNKNOWN; }
{ "code": [], "line_no": [] }
static av_cold int FUNC_0(void) { avs_library.library = LoadLibrary(AVISYNTH_LIB); if (!avs_library.library) return AVERROR_UNKNOWN; #define LOAD_AVS_FUNC(name, continue_on_fail) \ avs_library.name = \ (void *)GetProcAddress(avs_library.library, #name); \ if (!continue_on_fail && !avs_library.name) \ goto fail; LOAD_AVS_FUNC(avs_bit_blt, 0); LOAD_AVS_FUNC(avs_clip_get_error, 0); LOAD_AVS_FUNC(avs_create_script_environment, 0); LOAD_AVS_FUNC(avs_delete_script_environment, 0); LOAD_AVS_FUNC(avs_get_audio, 0); LOAD_AVS_FUNC(avs_get_error, 1); LOAD_AVS_FUNC(avs_get_frame, 0); LOAD_AVS_FUNC(avs_get_version, 0); LOAD_AVS_FUNC(avs_get_video_info, 0); LOAD_AVS_FUNC(avs_invoke, 0); LOAD_AVS_FUNC(avs_release_clip, 0); LOAD_AVS_FUNC(avs_release_value, 0); LOAD_AVS_FUNC(avs_release_video_frame, 0); LOAD_AVS_FUNC(avs_take_clip, 0); #ifdef USING_AVISYNTH LOAD_AVS_FUNC(avs_bits_per_pixel, 1); LOAD_AVS_FUNC(avs_get_height_p, 1); LOAD_AVS_FUNC(avs_get_pitch_p, 1); LOAD_AVS_FUNC(avs_get_read_ptr_p, 1); LOAD_AVS_FUNC(avs_get_row_size_p, 1); LOAD_AVS_FUNC(avs_is_yv24, 1); LOAD_AVS_FUNC(avs_is_yv16, 1); LOAD_AVS_FUNC(avs_is_yv411, 1); LOAD_AVS_FUNC(avs_is_y8, 1); #endif #undef LOAD_AVS_FUNC atexit(avisynth_atexit_handler); return 0; fail: FreeLibrary(avs_library.library); return AVERROR_UNKNOWN; }
[ "static av_cold int FUNC_0(void)\n{", "avs_library.library = LoadLibrary(AVISYNTH_LIB);", "if (!avs_library.library)\nreturn AVERROR_UNKNOWN;", "#define LOAD_AVS_FUNC(name, continue_on_fail) \\\navs_library.name = \\\n(void *)GetProcAddress(avs_library.library, #name); \\", "if (!continue_on_fail && !avs_library.name) \\\ngoto fail;", "LOAD_AVS_FUNC(avs_bit_blt, 0);", "LOAD_AVS_FUNC(avs_clip_get_error, 0);", "LOAD_AVS_FUNC(avs_create_script_environment, 0);", "LOAD_AVS_FUNC(avs_delete_script_environment, 0);", "LOAD_AVS_FUNC(avs_get_audio, 0);", "LOAD_AVS_FUNC(avs_get_error, 1);", "LOAD_AVS_FUNC(avs_get_frame, 0);", "LOAD_AVS_FUNC(avs_get_version, 0);", "LOAD_AVS_FUNC(avs_get_video_info, 0);", "LOAD_AVS_FUNC(avs_invoke, 0);", "LOAD_AVS_FUNC(avs_release_clip, 0);", "LOAD_AVS_FUNC(avs_release_value, 0);", "LOAD_AVS_FUNC(avs_release_video_frame, 0);", "LOAD_AVS_FUNC(avs_take_clip, 0);", "#ifdef USING_AVISYNTH\nLOAD_AVS_FUNC(avs_bits_per_pixel, 1);", "LOAD_AVS_FUNC(avs_get_height_p, 1);", "LOAD_AVS_FUNC(avs_get_pitch_p, 1);", "LOAD_AVS_FUNC(avs_get_read_ptr_p, 1);", "LOAD_AVS_FUNC(avs_get_row_size_p, 1);", "LOAD_AVS_FUNC(avs_is_yv24, 1);", "LOAD_AVS_FUNC(avs_is_yv16, 1);", "LOAD_AVS_FUNC(avs_is_yv411, 1);", "LOAD_AVS_FUNC(avs_is_y8, 1);", "#endif\n#undef LOAD_AVS_FUNC\natexit(avisynth_atexit_handler);", "return 0;", "fail:\nFreeLibrary(avs_library.library);", "return AVERROR_UNKNOWN;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53, 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73, 75, 79 ], [ 81 ], [ 85, 87 ], [ 89 ], [ 91 ] ]
11,121
static int decode_chunks(AVCodecContext *avctx, AVFrame *picture, int *data_size, const uint8_t *buf, int buf_size) { Mpeg1Context *s = avctx->priv_data; MpegEncContext *s2 = &s->mpeg_enc_ctx; const uint8_t *buf_ptr = buf; const uint8_t *buf_end = buf + buf_size; int ret, input_size; int last_code= 0; for(;;) { /* find next start code */ uint32_t start_code = -1; buf_ptr = ff_find_start_code(buf_ptr,buf_end, &start_code); if (start_code > 0x1ff){ if(s2->pict_type != AV_PICTURE_TYPE_B || avctx->skip_frame <= AVDISCARD_DEFAULT){ if(avctx->thread_count > 1){ int i; avctx->execute(avctx, slice_decode_thread, &s2->thread_context[0], NULL, s->slice_count, sizeof(void*)); for(i=0; i<s->slice_count; i++) s2->error_count += s2->thread_context[i]->error_count; } if (CONFIG_MPEG_VDPAU_DECODER && avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU) ff_vdpau_mpeg_picture_complete(s2, buf, buf_size, s->slice_count); if (slice_end(avctx, picture)) { if(s2->last_picture_ptr || s2->low_delay) //FIXME merge with the stuff in mpeg_decode_slice *data_size = sizeof(AVPicture); } } s2->pict_type= 0; return FFMAX(0, buf_ptr - buf - s2->parse_context.last_index); } input_size = buf_end - buf_ptr; if(avctx->debug & FF_DEBUG_STARTCODE){ av_log(avctx, AV_LOG_DEBUG, "%3X at %td left %d\n", start_code, buf_ptr-buf, input_size); } /* prepare data for next start code */ switch(start_code) { case SEQ_START_CODE: if(last_code == 0){ mpeg1_decode_sequence(avctx, buf_ptr, input_size); s->sync=1; }else{ av_log(avctx, AV_LOG_ERROR, "ignoring SEQ_START_CODE after %X\n", last_code); } break; case PICTURE_START_CODE: if (HAVE_THREADS && (avctx->active_thread_type&FF_THREAD_SLICE) && s->slice_count) { int i; avctx->execute(avctx, slice_decode_thread, s2->thread_context, NULL, s->slice_count, sizeof(void*)); for (i = 0; i < s->slice_count; i++) s2->error_count += s2->thread_context[i]->error_count; s->slice_count = 0; } if(last_code == 0 || last_code == SLICE_MIN_START_CODE){ if(mpeg_decode_postinit(avctx) < 0){ av_log(avctx, AV_LOG_ERROR, "mpeg_decode_postinit() failure\n"); return -1; } /* we have a complete image: we try to decompress it */ if(mpeg1_decode_picture(avctx, buf_ptr, input_size) < 0) s2->pict_type=0; s2->first_slice = 1; last_code= PICTURE_START_CODE; }else{ av_log(avctx, AV_LOG_ERROR, "ignoring pic after %X\n", last_code); } break; case EXT_START_CODE: init_get_bits(&s2->gb, buf_ptr, input_size*8); switch(get_bits(&s2->gb, 4)) { case 0x1: if(last_code == 0){ mpeg_decode_sequence_extension(s); }else{ av_log(avctx, AV_LOG_ERROR, "ignoring seq ext after %X\n", last_code); } break; case 0x2: mpeg_decode_sequence_display_extension(s); break; case 0x3: mpeg_decode_quant_matrix_extension(s2); break; case 0x7: mpeg_decode_picture_display_extension(s); break; case 0x8: if(last_code == PICTURE_START_CODE){ mpeg_decode_picture_coding_extension(s); }else{ av_log(avctx, AV_LOG_ERROR, "ignoring pic cod ext after %X\n", last_code); } break; } break; case USER_START_CODE: mpeg_decode_user_data(avctx, buf_ptr, input_size); break; case GOP_START_CODE: if(last_code == 0){ s2->first_field=0; mpeg_decode_gop(avctx, buf_ptr, input_size); s->sync=1; }else{ av_log(avctx, AV_LOG_ERROR, "ignoring GOP_START_CODE after %X\n", last_code); } break; default: if (start_code >= SLICE_MIN_START_CODE && start_code <= SLICE_MAX_START_CODE && last_code!=0) { const int field_pic= s2->picture_structure != PICT_FRAME; int mb_y= (start_code - SLICE_MIN_START_CODE) << field_pic; last_code= SLICE_MIN_START_CODE; if(s2->picture_structure == PICT_BOTTOM_FIELD) mb_y++; if (mb_y >= s2->mb_height){ av_log(s2->avctx, AV_LOG_ERROR, "slice below image (%d >= %d)\n", mb_y, s2->mb_height); return -1; } if(s2->last_picture_ptr==NULL){ /* Skip B-frames if we do not have reference frames and gop is not closed */ if(s2->pict_type==AV_PICTURE_TYPE_B){ if(!s2->closed_gop) break; } } if(s2->pict_type==AV_PICTURE_TYPE_I) s->sync=1; if(s2->next_picture_ptr==NULL){ /* Skip P-frames if we do not have a reference frame or we have an invalid header. */ if(s2->pict_type==AV_PICTURE_TYPE_P && !s->sync) break; } if( (avctx->skip_frame >= AVDISCARD_NONREF && s2->pict_type==AV_PICTURE_TYPE_B) ||(avctx->skip_frame >= AVDISCARD_NONKEY && s2->pict_type!=AV_PICTURE_TYPE_I) || avctx->skip_frame >= AVDISCARD_ALL) break; if (!s->mpeg_enc_ctx_allocated) break; if(s2->codec_id == CODEC_ID_MPEG2VIDEO){ if(mb_y < avctx->skip_top || mb_y >= s2->mb_height - avctx->skip_bottom) break; } if(!s2->pict_type){ av_log(avctx, AV_LOG_ERROR, "Missing picture start code\n"); break; } if(s2->first_slice){ s2->first_slice=0; if(mpeg_field_start(s2, buf, buf_size) < 0) return -1; } if(!s2->current_picture_ptr){ av_log(avctx, AV_LOG_ERROR, "current_picture not initialized\n"); return -1; } if (avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU) { s->slice_count++; break; } if(avctx->thread_count > 1){ int threshold= (s2->mb_height*s->slice_count + avctx->thread_count/2) / avctx->thread_count; if(threshold <= mb_y){ MpegEncContext *thread_context= s2->thread_context[s->slice_count]; thread_context->start_mb_y= mb_y; thread_context->end_mb_y = s2->mb_height; if(s->slice_count){ s2->thread_context[s->slice_count-1]->end_mb_y= mb_y; ff_update_duplicate_context(thread_context, s2); } init_get_bits(&thread_context->gb, buf_ptr, input_size*8); s->slice_count++; } buf_ptr += 2; //FIXME add minimum number of bytes per slice }else{ ret = mpeg_decode_slice(s, mb_y, &buf_ptr, input_size); emms_c(); if(ret < 0){ if(s2->resync_mb_x>=0 && s2->resync_mb_y>=0) ff_er_add_slice(s2, s2->resync_mb_x, s2->resync_mb_y, s2->mb_x, s2->mb_y, AC_ERROR|DC_ERROR|MV_ERROR); }else{ ff_er_add_slice(s2, s2->resync_mb_x, s2->resync_mb_y, s2->mb_x-1, s2->mb_y, AC_END|DC_END|MV_END); } } } break; } } }
false
FFmpeg
508a24f8dc63e74bd9917e6f0c4cdbb744741ef0
static int decode_chunks(AVCodecContext *avctx, AVFrame *picture, int *data_size, const uint8_t *buf, int buf_size) { Mpeg1Context *s = avctx->priv_data; MpegEncContext *s2 = &s->mpeg_enc_ctx; const uint8_t *buf_ptr = buf; const uint8_t *buf_end = buf + buf_size; int ret, input_size; int last_code= 0; for(;;) { uint32_t start_code = -1; buf_ptr = ff_find_start_code(buf_ptr,buf_end, &start_code); if (start_code > 0x1ff){ if(s2->pict_type != AV_PICTURE_TYPE_B || avctx->skip_frame <= AVDISCARD_DEFAULT){ if(avctx->thread_count > 1){ int i; avctx->execute(avctx, slice_decode_thread, &s2->thread_context[0], NULL, s->slice_count, sizeof(void*)); for(i=0; i<s->slice_count; i++) s2->error_count += s2->thread_context[i]->error_count; } if (CONFIG_MPEG_VDPAU_DECODER && avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU) ff_vdpau_mpeg_picture_complete(s2, buf, buf_size, s->slice_count); if (slice_end(avctx, picture)) { if(s2->last_picture_ptr || s2->low_delay) *data_size = sizeof(AVPicture); } } s2->pict_type= 0; return FFMAX(0, buf_ptr - buf - s2->parse_context.last_index); } input_size = buf_end - buf_ptr; if(avctx->debug & FF_DEBUG_STARTCODE){ av_log(avctx, AV_LOG_DEBUG, "%3X at %td left %d\n", start_code, buf_ptr-buf, input_size); } switch(start_code) { case SEQ_START_CODE: if(last_code == 0){ mpeg1_decode_sequence(avctx, buf_ptr, input_size); s->sync=1; }else{ av_log(avctx, AV_LOG_ERROR, "ignoring SEQ_START_CODE after %X\n", last_code); } break; case PICTURE_START_CODE: if (HAVE_THREADS && (avctx->active_thread_type&FF_THREAD_SLICE) && s->slice_count) { int i; avctx->execute(avctx, slice_decode_thread, s2->thread_context, NULL, s->slice_count, sizeof(void*)); for (i = 0; i < s->slice_count; i++) s2->error_count += s2->thread_context[i]->error_count; s->slice_count = 0; } if(last_code == 0 || last_code == SLICE_MIN_START_CODE){ if(mpeg_decode_postinit(avctx) < 0){ av_log(avctx, AV_LOG_ERROR, "mpeg_decode_postinit() failure\n"); return -1; } if(mpeg1_decode_picture(avctx, buf_ptr, input_size) < 0) s2->pict_type=0; s2->first_slice = 1; last_code= PICTURE_START_CODE; }else{ av_log(avctx, AV_LOG_ERROR, "ignoring pic after %X\n", last_code); } break; case EXT_START_CODE: init_get_bits(&s2->gb, buf_ptr, input_size*8); switch(get_bits(&s2->gb, 4)) { case 0x1: if(last_code == 0){ mpeg_decode_sequence_extension(s); }else{ av_log(avctx, AV_LOG_ERROR, "ignoring seq ext after %X\n", last_code); } break; case 0x2: mpeg_decode_sequence_display_extension(s); break; case 0x3: mpeg_decode_quant_matrix_extension(s2); break; case 0x7: mpeg_decode_picture_display_extension(s); break; case 0x8: if(last_code == PICTURE_START_CODE){ mpeg_decode_picture_coding_extension(s); }else{ av_log(avctx, AV_LOG_ERROR, "ignoring pic cod ext after %X\n", last_code); } break; } break; case USER_START_CODE: mpeg_decode_user_data(avctx, buf_ptr, input_size); break; case GOP_START_CODE: if(last_code == 0){ s2->first_field=0; mpeg_decode_gop(avctx, buf_ptr, input_size); s->sync=1; }else{ av_log(avctx, AV_LOG_ERROR, "ignoring GOP_START_CODE after %X\n", last_code); } break; default: if (start_code >= SLICE_MIN_START_CODE && start_code <= SLICE_MAX_START_CODE && last_code!=0) { const int field_pic= s2->picture_structure != PICT_FRAME; int mb_y= (start_code - SLICE_MIN_START_CODE) << field_pic; last_code= SLICE_MIN_START_CODE; if(s2->picture_structure == PICT_BOTTOM_FIELD) mb_y++; if (mb_y >= s2->mb_height){ av_log(s2->avctx, AV_LOG_ERROR, "slice below image (%d >= %d)\n", mb_y, s2->mb_height); return -1; } if(s2->last_picture_ptr==NULL){ if(s2->pict_type==AV_PICTURE_TYPE_B){ if(!s2->closed_gop) break; } } if(s2->pict_type==AV_PICTURE_TYPE_I) s->sync=1; if(s2->next_picture_ptr==NULL){ if(s2->pict_type==AV_PICTURE_TYPE_P && !s->sync) break; } if( (avctx->skip_frame >= AVDISCARD_NONREF && s2->pict_type==AV_PICTURE_TYPE_B) ||(avctx->skip_frame >= AVDISCARD_NONKEY && s2->pict_type!=AV_PICTURE_TYPE_I) || avctx->skip_frame >= AVDISCARD_ALL) break; if (!s->mpeg_enc_ctx_allocated) break; if(s2->codec_id == CODEC_ID_MPEG2VIDEO){ if(mb_y < avctx->skip_top || mb_y >= s2->mb_height - avctx->skip_bottom) break; } if(!s2->pict_type){ av_log(avctx, AV_LOG_ERROR, "Missing picture start code\n"); break; } if(s2->first_slice){ s2->first_slice=0; if(mpeg_field_start(s2, buf, buf_size) < 0) return -1; } if(!s2->current_picture_ptr){ av_log(avctx, AV_LOG_ERROR, "current_picture not initialized\n"); return -1; } if (avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU) { s->slice_count++; break; } if(avctx->thread_count > 1){ int threshold= (s2->mb_height*s->slice_count + avctx->thread_count/2) / avctx->thread_count; if(threshold <= mb_y){ MpegEncContext *thread_context= s2->thread_context[s->slice_count]; thread_context->start_mb_y= mb_y; thread_context->end_mb_y = s2->mb_height; if(s->slice_count){ s2->thread_context[s->slice_count-1]->end_mb_y= mb_y; ff_update_duplicate_context(thread_context, s2); } init_get_bits(&thread_context->gb, buf_ptr, input_size*8); s->slice_count++; } buf_ptr += 2; }else{ ret = mpeg_decode_slice(s, mb_y, &buf_ptr, input_size); emms_c(); if(ret < 0){ if(s2->resync_mb_x>=0 && s2->resync_mb_y>=0) ff_er_add_slice(s2, s2->resync_mb_x, s2->resync_mb_y, s2->mb_x, s2->mb_y, AC_ERROR|DC_ERROR|MV_ERROR); }else{ ff_er_add_slice(s2, s2->resync_mb_x, s2->resync_mb_y, s2->mb_x-1, s2->mb_y, AC_END|DC_END|MV_END); } } } break; } } }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, AVFrame *VAR_1, int *VAR_2, const uint8_t *VAR_3, int VAR_4) { Mpeg1Context *s = VAR_0->priv_data; MpegEncContext *s2 = &s->mpeg_enc_ctx; const uint8_t *VAR_5 = VAR_3; const uint8_t *VAR_6 = VAR_3 + VAR_4; int VAR_7, VAR_8; int VAR_9= 0; for(;;) { uint32_t start_code = -1; VAR_5 = ff_find_start_code(VAR_5,VAR_6, &start_code); if (start_code > 0x1ff){ if(s2->pict_type != AV_PICTURE_TYPE_B || VAR_0->skip_frame <= AVDISCARD_DEFAULT){ if(VAR_0->thread_count > 1){ int VAR_11; VAR_0->execute(VAR_0, slice_decode_thread, &s2->thread_context[0], NULL, s->slice_count, sizeof(void*)); for(VAR_11=0; VAR_11<s->slice_count; VAR_11++) s2->error_count += s2->thread_context[VAR_11]->error_count; } if (CONFIG_MPEG_VDPAU_DECODER && VAR_0->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU) ff_vdpau_mpeg_picture_complete(s2, VAR_3, VAR_4, s->slice_count); if (slice_end(VAR_0, VAR_1)) { if(s2->last_picture_ptr || s2->low_delay) *VAR_2 = sizeof(AVPicture); } } s2->pict_type= 0; return FFMAX(0, VAR_5 - VAR_3 - s2->parse_context.last_index); } VAR_8 = VAR_6 - VAR_5; if(VAR_0->debug & FF_DEBUG_STARTCODE){ av_log(VAR_0, AV_LOG_DEBUG, "%3X at %td left %d\n", start_code, VAR_5-VAR_3, VAR_8); } switch(start_code) { case SEQ_START_CODE: if(VAR_9 == 0){ mpeg1_decode_sequence(VAR_0, VAR_5, VAR_8); s->sync=1; }else{ av_log(VAR_0, AV_LOG_ERROR, "ignoring SEQ_START_CODE after %X\n", VAR_9); } break; case PICTURE_START_CODE: if (HAVE_THREADS && (VAR_0->active_thread_type&FF_THREAD_SLICE) && s->slice_count) { int VAR_11; VAR_0->execute(VAR_0, slice_decode_thread, s2->thread_context, NULL, s->slice_count, sizeof(void*)); for (VAR_11 = 0; VAR_11 < s->slice_count; VAR_11++) s2->error_count += s2->thread_context[VAR_11]->error_count; s->slice_count = 0; } if(VAR_9 == 0 || VAR_9 == SLICE_MIN_START_CODE){ if(mpeg_decode_postinit(VAR_0) < 0){ av_log(VAR_0, AV_LOG_ERROR, "mpeg_decode_postinit() failure\n"); return -1; } if(mpeg1_decode_picture(VAR_0, VAR_5, VAR_8) < 0) s2->pict_type=0; s2->first_slice = 1; VAR_9= PICTURE_START_CODE; }else{ av_log(VAR_0, AV_LOG_ERROR, "ignoring pic after %X\n", VAR_9); } break; case EXT_START_CODE: init_get_bits(&s2->gb, VAR_5, VAR_8*8); switch(get_bits(&s2->gb, 4)) { case 0x1: if(VAR_9 == 0){ mpeg_decode_sequence_extension(s); }else{ av_log(VAR_0, AV_LOG_ERROR, "ignoring seq ext after %X\n", VAR_9); } break; case 0x2: mpeg_decode_sequence_display_extension(s); break; case 0x3: mpeg_decode_quant_matrix_extension(s2); break; case 0x7: mpeg_decode_picture_display_extension(s); break; case 0x8: if(VAR_9 == PICTURE_START_CODE){ mpeg_decode_picture_coding_extension(s); }else{ av_log(VAR_0, AV_LOG_ERROR, "ignoring pic cod ext after %X\n", VAR_9); } break; } break; case USER_START_CODE: mpeg_decode_user_data(VAR_0, VAR_5, VAR_8); break; case GOP_START_CODE: if(VAR_9 == 0){ s2->first_field=0; mpeg_decode_gop(VAR_0, VAR_5, VAR_8); s->sync=1; }else{ av_log(VAR_0, AV_LOG_ERROR, "ignoring GOP_START_CODE after %X\n", VAR_9); } break; default: if (start_code >= SLICE_MIN_START_CODE && start_code <= SLICE_MAX_START_CODE && VAR_9!=0) { const int VAR_11= s2->picture_structure != PICT_FRAME; int VAR_12= (start_code - SLICE_MIN_START_CODE) << VAR_11; VAR_9= SLICE_MIN_START_CODE; if(s2->picture_structure == PICT_BOTTOM_FIELD) VAR_12++; if (VAR_12 >= s2->mb_height){ av_log(s2->VAR_0, AV_LOG_ERROR, "slice below image (%d >= %d)\n", VAR_12, s2->mb_height); return -1; } if(s2->last_picture_ptr==NULL){ if(s2->pict_type==AV_PICTURE_TYPE_B){ if(!s2->closed_gop) break; } } if(s2->pict_type==AV_PICTURE_TYPE_I) s->sync=1; if(s2->next_picture_ptr==NULL){ if(s2->pict_type==AV_PICTURE_TYPE_P && !s->sync) break; } if( (VAR_0->skip_frame >= AVDISCARD_NONREF && s2->pict_type==AV_PICTURE_TYPE_B) ||(VAR_0->skip_frame >= AVDISCARD_NONKEY && s2->pict_type!=AV_PICTURE_TYPE_I) || VAR_0->skip_frame >= AVDISCARD_ALL) break; if (!s->mpeg_enc_ctx_allocated) break; if(s2->codec_id == CODEC_ID_MPEG2VIDEO){ if(VAR_12 < VAR_0->skip_top || VAR_12 >= s2->mb_height - VAR_0->skip_bottom) break; } if(!s2->pict_type){ av_log(VAR_0, AV_LOG_ERROR, "Missing VAR_1 start code\n"); break; } if(s2->first_slice){ s2->first_slice=0; if(mpeg_field_start(s2, VAR_3, VAR_4) < 0) return -1; } if(!s2->current_picture_ptr){ av_log(VAR_0, AV_LOG_ERROR, "current_picture not initialized\n"); return -1; } if (VAR_0->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU) { s->slice_count++; break; } if(VAR_0->thread_count > 1){ int VAR_13= (s2->mb_height*s->slice_count + VAR_0->thread_count/2) / VAR_0->thread_count; if(VAR_13 <= VAR_12){ MpegEncContext *thread_context= s2->thread_context[s->slice_count]; thread_context->start_mb_y= VAR_12; thread_context->end_mb_y = s2->mb_height; if(s->slice_count){ s2->thread_context[s->slice_count-1]->end_mb_y= VAR_12; ff_update_duplicate_context(thread_context, s2); } init_get_bits(&thread_context->gb, VAR_5, VAR_8*8); s->slice_count++; } VAR_5 += 2; }else{ VAR_7 = mpeg_decode_slice(s, VAR_12, &VAR_5, VAR_8); emms_c(); if(VAR_7 < 0){ if(s2->resync_mb_x>=0 && s2->resync_mb_y>=0) ff_er_add_slice(s2, s2->resync_mb_x, s2->resync_mb_y, s2->mb_x, s2->VAR_12, AC_ERROR|DC_ERROR|MV_ERROR); }else{ ff_er_add_slice(s2, s2->resync_mb_x, s2->resync_mb_y, s2->mb_x-1, s2->VAR_12, AC_END|DC_END|MV_END); } } } break; } } }
[ "static int FUNC_0(AVCodecContext *VAR_0,\nAVFrame *VAR_1, int *VAR_2,\nconst uint8_t *VAR_3, int VAR_4)\n{", "Mpeg1Context *s = VAR_0->priv_data;", "MpegEncContext *s2 = &s->mpeg_enc_ctx;", "const uint8_t *VAR_5 = VAR_3;", "const uint8_t *VAR_6 = VAR_3 + VAR_4;", "int VAR_7, VAR_8;", "int VAR_9= 0;", "for(;;) {", "uint32_t start_code = -1;", "VAR_5 = ff_find_start_code(VAR_5,VAR_6, &start_code);", "if (start_code > 0x1ff){", "if(s2->pict_type != AV_PICTURE_TYPE_B || VAR_0->skip_frame <= AVDISCARD_DEFAULT){", "if(VAR_0->thread_count > 1){", "int VAR_11;", "VAR_0->execute(VAR_0, slice_decode_thread, &s2->thread_context[0], NULL, s->slice_count, sizeof(void*));", "for(VAR_11=0; VAR_11<s->slice_count; VAR_11++)", "s2->error_count += s2->thread_context[VAR_11]->error_count;", "}", "if (CONFIG_MPEG_VDPAU_DECODER && VAR_0->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU)\nff_vdpau_mpeg_picture_complete(s2, VAR_3, VAR_4, s->slice_count);", "if (slice_end(VAR_0, VAR_1)) {", "if(s2->last_picture_ptr || s2->low_delay)\n*VAR_2 = sizeof(AVPicture);", "}", "}", "s2->pict_type= 0;", "return FFMAX(0, VAR_5 - VAR_3 - s2->parse_context.last_index);", "}", "VAR_8 = VAR_6 - VAR_5;", "if(VAR_0->debug & FF_DEBUG_STARTCODE){", "av_log(VAR_0, AV_LOG_DEBUG, \"%3X at %td left %d\\n\", start_code, VAR_5-VAR_3, VAR_8);", "}", "switch(start_code) {", "case SEQ_START_CODE:\nif(VAR_9 == 0){", "mpeg1_decode_sequence(VAR_0, VAR_5,\nVAR_8);", "s->sync=1;", "}else{", "av_log(VAR_0, AV_LOG_ERROR, \"ignoring SEQ_START_CODE after %X\\n\", VAR_9);", "}", "break;", "case PICTURE_START_CODE:\nif (HAVE_THREADS && (VAR_0->active_thread_type&FF_THREAD_SLICE) && s->slice_count) {", "int VAR_11;", "VAR_0->execute(VAR_0, slice_decode_thread,\ns2->thread_context, NULL,\ns->slice_count, sizeof(void*));", "for (VAR_11 = 0; VAR_11 < s->slice_count; VAR_11++)", "s2->error_count += s2->thread_context[VAR_11]->error_count;", "s->slice_count = 0;", "}", "if(VAR_9 == 0 || VAR_9 == SLICE_MIN_START_CODE){", "if(mpeg_decode_postinit(VAR_0) < 0){", "av_log(VAR_0, AV_LOG_ERROR, \"mpeg_decode_postinit() failure\\n\");", "return -1;", "}", "if(mpeg1_decode_picture(VAR_0,\nVAR_5, VAR_8) < 0)\ns2->pict_type=0;", "s2->first_slice = 1;", "VAR_9= PICTURE_START_CODE;", "}else{", "av_log(VAR_0, AV_LOG_ERROR, \"ignoring pic after %X\\n\", VAR_9);", "}", "break;", "case EXT_START_CODE:\ninit_get_bits(&s2->gb, VAR_5, VAR_8*8);", "switch(get_bits(&s2->gb, 4)) {", "case 0x1:\nif(VAR_9 == 0){", "mpeg_decode_sequence_extension(s);", "}else{", "av_log(VAR_0, AV_LOG_ERROR, \"ignoring seq ext after %X\\n\", VAR_9);", "}", "break;", "case 0x2:\nmpeg_decode_sequence_display_extension(s);", "break;", "case 0x3:\nmpeg_decode_quant_matrix_extension(s2);", "break;", "case 0x7:\nmpeg_decode_picture_display_extension(s);", "break;", "case 0x8:\nif(VAR_9 == PICTURE_START_CODE){", "mpeg_decode_picture_coding_extension(s);", "}else{", "av_log(VAR_0, AV_LOG_ERROR, \"ignoring pic cod ext after %X\\n\", VAR_9);", "}", "break;", "}", "break;", "case USER_START_CODE:\nmpeg_decode_user_data(VAR_0,\nVAR_5, VAR_8);", "break;", "case GOP_START_CODE:\nif(VAR_9 == 0){", "s2->first_field=0;", "mpeg_decode_gop(VAR_0,\nVAR_5, VAR_8);", "s->sync=1;", "}else{", "av_log(VAR_0, AV_LOG_ERROR, \"ignoring GOP_START_CODE after %X\\n\", VAR_9);", "}", "break;", "default:\nif (start_code >= SLICE_MIN_START_CODE &&\nstart_code <= SLICE_MAX_START_CODE && VAR_9!=0) {", "const int VAR_11= s2->picture_structure != PICT_FRAME;", "int VAR_12= (start_code - SLICE_MIN_START_CODE) << VAR_11;", "VAR_9= SLICE_MIN_START_CODE;", "if(s2->picture_structure == PICT_BOTTOM_FIELD)\nVAR_12++;", "if (VAR_12 >= s2->mb_height){", "av_log(s2->VAR_0, AV_LOG_ERROR, \"slice below image (%d >= %d)\\n\", VAR_12, s2->mb_height);", "return -1;", "}", "if(s2->last_picture_ptr==NULL){", "if(s2->pict_type==AV_PICTURE_TYPE_B){", "if(!s2->closed_gop)\nbreak;", "}", "}", "if(s2->pict_type==AV_PICTURE_TYPE_I)\ns->sync=1;", "if(s2->next_picture_ptr==NULL){", "if(s2->pict_type==AV_PICTURE_TYPE_P && !s->sync) break;", "}", "if( (VAR_0->skip_frame >= AVDISCARD_NONREF && s2->pict_type==AV_PICTURE_TYPE_B)\n||(VAR_0->skip_frame >= AVDISCARD_NONKEY && s2->pict_type!=AV_PICTURE_TYPE_I)\n|| VAR_0->skip_frame >= AVDISCARD_ALL)\nbreak;", "if (!s->mpeg_enc_ctx_allocated) break;", "if(s2->codec_id == CODEC_ID_MPEG2VIDEO){", "if(VAR_12 < VAR_0->skip_top || VAR_12 >= s2->mb_height - VAR_0->skip_bottom)\nbreak;", "}", "if(!s2->pict_type){", "av_log(VAR_0, AV_LOG_ERROR, \"Missing VAR_1 start code\\n\");", "break;", "}", "if(s2->first_slice){", "s2->first_slice=0;", "if(mpeg_field_start(s2, VAR_3, VAR_4) < 0)\nreturn -1;", "}", "if(!s2->current_picture_ptr){", "av_log(VAR_0, AV_LOG_ERROR, \"current_picture not initialized\\n\");", "return -1;", "}", "if (VAR_0->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU) {", "s->slice_count++;", "break;", "}", "if(VAR_0->thread_count > 1){", "int VAR_13= (s2->mb_height*s->slice_count + VAR_0->thread_count/2) / VAR_0->thread_count;", "if(VAR_13 <= VAR_12){", "MpegEncContext *thread_context= s2->thread_context[s->slice_count];", "thread_context->start_mb_y= VAR_12;", "thread_context->end_mb_y = s2->mb_height;", "if(s->slice_count){", "s2->thread_context[s->slice_count-1]->end_mb_y= VAR_12;", "ff_update_duplicate_context(thread_context, s2);", "}", "init_get_bits(&thread_context->gb, VAR_5, VAR_8*8);", "s->slice_count++;", "}", "VAR_5 += 2;", "}else{", "VAR_7 = mpeg_decode_slice(s, VAR_12, &VAR_5, VAR_8);", "emms_c();", "if(VAR_7 < 0){", "if(s2->resync_mb_x>=0 && s2->resync_mb_y>=0)\nff_er_add_slice(s2, s2->resync_mb_x, s2->resync_mb_y, s2->mb_x, s2->VAR_12, AC_ERROR|DC_ERROR|MV_ERROR);", "}else{", "ff_er_add_slice(s2, s2->resync_mb_x, s2->resync_mb_y, s2->mb_x-1, s2->VAR_12, AC_END|DC_END|MV_END);", "}", "}", "}", "break;", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51, 53 ], [ 57 ], [ 59, 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 75 ], [ 79 ], [ 81 ], [ 83 ], [ 89 ], [ 91, 93 ], [ 95, 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 111, 113 ], [ 115 ], [ 119, 121, 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 147, 149, 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165, 167 ], [ 171 ], [ 173, 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187, 189 ], [ 191 ], [ 193, 195 ], [ 197 ], [ 199, 201 ], [ 203 ], [ 205, 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223, 225, 227 ], [ 229 ], [ 231, 233 ], [ 235 ], [ 237, 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251, 253, 255 ], [ 257 ], [ 259 ], [ 261 ], [ 265, 267 ], [ 271 ], [ 273 ], [ 275 ], [ 277 ], [ 281 ], [ 285 ], [ 287, 289 ], [ 291 ], [ 293 ], [ 295, 297 ], [ 299 ], [ 303 ], [ 305 ], [ 307, 309, 311, 313 ], [ 317 ], [ 321 ], [ 323, 325 ], [ 327 ], [ 331 ], [ 333 ], [ 335 ], [ 337 ], [ 341 ], [ 343 ], [ 345, 347 ], [ 349 ], [ 351 ], [ 353 ], [ 355 ], [ 357 ], [ 361 ], [ 363 ], [ 365 ], [ 367 ], [ 371 ], [ 373 ], [ 375 ], [ 377 ], [ 381 ], [ 383 ], [ 385 ], [ 387 ], [ 389 ], [ 391 ], [ 393 ], [ 395 ], [ 397 ], [ 399 ], [ 401 ], [ 403 ], [ 405 ], [ 409 ], [ 411, 413 ], [ 415 ], [ 417 ], [ 419 ], [ 421 ], [ 423 ], [ 425 ], [ 427 ], [ 429 ], [ 431 ] ]
11,122
void cpu_ppc_store_decr (CPUState *env, uint32_t value) { /* TO FIX */ }
false
qemu
e1833e1f96456fd8fc17463246fe0b2050e68efb
void cpu_ppc_store_decr (CPUState *env, uint32_t value) { }
{ "code": [], "line_no": [] }
void FUNC_0 (CPUState *VAR_0, uint32_t VAR_1) { }
[ "void FUNC_0 (CPUState *VAR_0, uint32_t VAR_1)\n{", "}" ]
[ 0, 0 ]
[ [ 1, 3 ], [ 7 ] ]
11,123
static void do_closefd(Monitor *mon, const QDict *qdict) { const char *fdname = qdict_get_str(qdict, "fdname"); mon_fd_t *monfd; LIST_FOREACH(monfd, &mon->fds, next) { if (strcmp(monfd->name, fdname) != 0) { continue; } LIST_REMOVE(monfd, next); close(monfd->fd); qemu_free(monfd->name); qemu_free(monfd); return; } monitor_printf(mon, "Failed to find file descriptor named %s\n", fdname); }
false
qemu
72cf2d4f0e181d0d3a3122e04129c58a95da713e
static void do_closefd(Monitor *mon, const QDict *qdict) { const char *fdname = qdict_get_str(qdict, "fdname"); mon_fd_t *monfd; LIST_FOREACH(monfd, &mon->fds, next) { if (strcmp(monfd->name, fdname) != 0) { continue; } LIST_REMOVE(monfd, next); close(monfd->fd); qemu_free(monfd->name); qemu_free(monfd); return; } monitor_printf(mon, "Failed to find file descriptor named %s\n", fdname); }
{ "code": [], "line_no": [] }
static void FUNC_0(Monitor *VAR_0, const QDict *VAR_1) { const char *VAR_2 = qdict_get_str(VAR_1, "VAR_2"); mon_fd_t *monfd; LIST_FOREACH(monfd, &VAR_0->fds, next) { if (strcmp(monfd->name, VAR_2) != 0) { continue; } LIST_REMOVE(monfd, next); close(monfd->fd); qemu_free(monfd->name); qemu_free(monfd); return; } monitor_printf(VAR_0, "Failed to find file descriptor named %s\n", VAR_2); }
[ "static void FUNC_0(Monitor *VAR_0, const QDict *VAR_1)\n{", "const char *VAR_2 = qdict_get_str(VAR_1, \"VAR_2\");", "mon_fd_t *monfd;", "LIST_FOREACH(monfd, &VAR_0->fds, next) {", "if (strcmp(monfd->name, VAR_2) != 0) {", "continue;", "}", "LIST_REMOVE(monfd, next);", "close(monfd->fd);", "qemu_free(monfd->name);", "qemu_free(monfd);", "return;", "}", "monitor_printf(VAR_0, \"Failed to find file descriptor named %s\\n\",\nVAR_2);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35, 37 ], [ 39 ] ]
11,125
int ide_init_drive(IDEState *s, BlockDriverState *bs, IDEDriveKind kind, const char *version, const char *serial, const char *model, uint64_t wwn, uint32_t cylinders, uint32_t heads, uint32_t secs, int chs_trans) { uint64_t nb_sectors; s->bs = bs; s->drive_kind = kind; bdrv_get_geometry(bs, &nb_sectors); if (cylinders < 1 || cylinders > 16383) { error_report("cyls must be between 1 and 16383"); return -1; } if (heads < 1 || heads > 16) { error_report("heads must be between 1 and 16"); return -1; } if (secs < 1 || secs > 63) { error_report("secs must be between 1 and 63"); return -1; } s->cylinders = cylinders; s->heads = heads; s->sectors = secs; s->chs_trans = chs_trans; s->nb_sectors = nb_sectors; s->wwn = wwn; /* The SMART values should be preserved across power cycles but they aren't. */ s->smart_enabled = 1; s->smart_autosave = 1; s->smart_errors = 0; s->smart_selftest_count = 0; if (kind == IDE_CD) { bdrv_set_dev_ops(bs, &ide_cd_block_ops, s); bdrv_set_buffer_alignment(bs, 2048); } else { if (!bdrv_is_inserted(s->bs)) { error_report("Device needs media, but drive is empty"); return -1; } if (bdrv_is_read_only(bs)) { error_report("Can't use a read-only drive"); return -1; } } if (serial) { pstrcpy(s->drive_serial_str, sizeof(s->drive_serial_str), serial); } else { snprintf(s->drive_serial_str, sizeof(s->drive_serial_str), "QM%05d", s->drive_serial); } if (model) { pstrcpy(s->drive_model_str, sizeof(s->drive_model_str), model); } else { switch (kind) { case IDE_CD: strcpy(s->drive_model_str, "QEMU DVD-ROM"); break; case IDE_CFATA: strcpy(s->drive_model_str, "QEMU MICRODRIVE"); break; default: strcpy(s->drive_model_str, "QEMU HARDDISK"); break; } } if (version) { pstrcpy(s->version, sizeof(s->version), version); } else { pstrcpy(s->version, sizeof(s->version), qemu_get_version()); } ide_reset(s); bdrv_iostatus_enable(bs); return 0; }
false
qemu
b51daf003aa42c5c23876739ebd0b64dd2075931
int ide_init_drive(IDEState *s, BlockDriverState *bs, IDEDriveKind kind, const char *version, const char *serial, const char *model, uint64_t wwn, uint32_t cylinders, uint32_t heads, uint32_t secs, int chs_trans) { uint64_t nb_sectors; s->bs = bs; s->drive_kind = kind; bdrv_get_geometry(bs, &nb_sectors); if (cylinders < 1 || cylinders > 16383) { error_report("cyls must be between 1 and 16383"); return -1; } if (heads < 1 || heads > 16) { error_report("heads must be between 1 and 16"); return -1; } if (secs < 1 || secs > 63) { error_report("secs must be between 1 and 63"); return -1; } s->cylinders = cylinders; s->heads = heads; s->sectors = secs; s->chs_trans = chs_trans; s->nb_sectors = nb_sectors; s->wwn = wwn; s->smart_enabled = 1; s->smart_autosave = 1; s->smart_errors = 0; s->smart_selftest_count = 0; if (kind == IDE_CD) { bdrv_set_dev_ops(bs, &ide_cd_block_ops, s); bdrv_set_buffer_alignment(bs, 2048); } else { if (!bdrv_is_inserted(s->bs)) { error_report("Device needs media, but drive is empty"); return -1; } if (bdrv_is_read_only(bs)) { error_report("Can't use a read-only drive"); return -1; } } if (serial) { pstrcpy(s->drive_serial_str, sizeof(s->drive_serial_str), serial); } else { snprintf(s->drive_serial_str, sizeof(s->drive_serial_str), "QM%05d", s->drive_serial); } if (model) { pstrcpy(s->drive_model_str, sizeof(s->drive_model_str), model); } else { switch (kind) { case IDE_CD: strcpy(s->drive_model_str, "QEMU DVD-ROM"); break; case IDE_CFATA: strcpy(s->drive_model_str, "QEMU MICRODRIVE"); break; default: strcpy(s->drive_model_str, "QEMU HARDDISK"); break; } } if (version) { pstrcpy(s->version, sizeof(s->version), version); } else { pstrcpy(s->version, sizeof(s->version), qemu_get_version()); } ide_reset(s); bdrv_iostatus_enable(bs); return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(IDEState *VAR_0, BlockDriverState *VAR_1, IDEDriveKind VAR_2, const char *VAR_3, const char *VAR_4, const char *VAR_5, uint64_t VAR_6, uint32_t VAR_7, uint32_t VAR_8, uint32_t VAR_9, int VAR_10) { uint64_t nb_sectors; VAR_0->VAR_1 = VAR_1; VAR_0->drive_kind = VAR_2; bdrv_get_geometry(VAR_1, &nb_sectors); if (VAR_7 < 1 || VAR_7 > 16383) { error_report("cyls must be between 1 and 16383"); return -1; } if (VAR_8 < 1 || VAR_8 > 16) { error_report("VAR_8 must be between 1 and 16"); return -1; } if (VAR_9 < 1 || VAR_9 > 63) { error_report("VAR_9 must be between 1 and 63"); return -1; } VAR_0->VAR_7 = VAR_7; VAR_0->VAR_8 = VAR_8; VAR_0->sectors = VAR_9; VAR_0->VAR_10 = VAR_10; VAR_0->nb_sectors = nb_sectors; VAR_0->VAR_6 = VAR_6; VAR_0->smart_enabled = 1; VAR_0->smart_autosave = 1; VAR_0->smart_errors = 0; VAR_0->smart_selftest_count = 0; if (VAR_2 == IDE_CD) { bdrv_set_dev_ops(VAR_1, &ide_cd_block_ops, VAR_0); bdrv_set_buffer_alignment(VAR_1, 2048); } else { if (!bdrv_is_inserted(VAR_0->VAR_1)) { error_report("Device needs media, but drive is empty"); return -1; } if (bdrv_is_read_only(VAR_1)) { error_report("Can't use a read-only drive"); return -1; } } if (VAR_4) { pstrcpy(VAR_0->drive_serial_str, sizeof(VAR_0->drive_serial_str), VAR_4); } else { snprintf(VAR_0->drive_serial_str, sizeof(VAR_0->drive_serial_str), "QM%05d", VAR_0->drive_serial); } if (VAR_5) { pstrcpy(VAR_0->drive_model_str, sizeof(VAR_0->drive_model_str), VAR_5); } else { switch (VAR_2) { case IDE_CD: strcpy(VAR_0->drive_model_str, "QEMU DVD-ROM"); break; case IDE_CFATA: strcpy(VAR_0->drive_model_str, "QEMU MICRODRIVE"); break; default: strcpy(VAR_0->drive_model_str, "QEMU HARDDISK"); break; } } if (VAR_3) { pstrcpy(VAR_0->VAR_3, sizeof(VAR_0->VAR_3), VAR_3); } else { pstrcpy(VAR_0->VAR_3, sizeof(VAR_0->VAR_3), qemu_get_version()); } ide_reset(VAR_0); bdrv_iostatus_enable(VAR_1); return 0; }
[ "int FUNC_0(IDEState *VAR_0, BlockDriverState *VAR_1, IDEDriveKind VAR_2,\nconst char *VAR_3, const char *VAR_4, const char *VAR_5,\nuint64_t VAR_6,\nuint32_t VAR_7, uint32_t VAR_8, uint32_t VAR_9,\nint VAR_10)\n{", "uint64_t nb_sectors;", "VAR_0->VAR_1 = VAR_1;", "VAR_0->drive_kind = VAR_2;", "bdrv_get_geometry(VAR_1, &nb_sectors);", "if (VAR_7 < 1 || VAR_7 > 16383) {", "error_report(\"cyls must be between 1 and 16383\");", "return -1;", "}", "if (VAR_8 < 1 || VAR_8 > 16) {", "error_report(\"VAR_8 must be between 1 and 16\");", "return -1;", "}", "if (VAR_9 < 1 || VAR_9 > 63) {", "error_report(\"VAR_9 must be between 1 and 63\");", "return -1;", "}", "VAR_0->VAR_7 = VAR_7;", "VAR_0->VAR_8 = VAR_8;", "VAR_0->sectors = VAR_9;", "VAR_0->VAR_10 = VAR_10;", "VAR_0->nb_sectors = nb_sectors;", "VAR_0->VAR_6 = VAR_6;", "VAR_0->smart_enabled = 1;", "VAR_0->smart_autosave = 1;", "VAR_0->smart_errors = 0;", "VAR_0->smart_selftest_count = 0;", "if (VAR_2 == IDE_CD) {", "bdrv_set_dev_ops(VAR_1, &ide_cd_block_ops, VAR_0);", "bdrv_set_buffer_alignment(VAR_1, 2048);", "} else {", "if (!bdrv_is_inserted(VAR_0->VAR_1)) {", "error_report(\"Device needs media, but drive is empty\");", "return -1;", "}", "if (bdrv_is_read_only(VAR_1)) {", "error_report(\"Can't use a read-only drive\");", "return -1;", "}", "}", "if (VAR_4) {", "pstrcpy(VAR_0->drive_serial_str, sizeof(VAR_0->drive_serial_str), VAR_4);", "} else {", "snprintf(VAR_0->drive_serial_str, sizeof(VAR_0->drive_serial_str),\n\"QM%05d\", VAR_0->drive_serial);", "}", "if (VAR_5) {", "pstrcpy(VAR_0->drive_model_str, sizeof(VAR_0->drive_model_str), VAR_5);", "} else {", "switch (VAR_2) {", "case IDE_CD:\nstrcpy(VAR_0->drive_model_str, \"QEMU DVD-ROM\");", "break;", "case IDE_CFATA:\nstrcpy(VAR_0->drive_model_str, \"QEMU MICRODRIVE\");", "break;", "default:\nstrcpy(VAR_0->drive_model_str, \"QEMU HARDDISK\");", "break;", "}", "}", "if (VAR_3) {", "pstrcpy(VAR_0->VAR_3, sizeof(VAR_0->VAR_3), VAR_3);", "} else {", "pstrcpy(VAR_0->VAR_3, sizeof(VAR_0->VAR_3), qemu_get_version());", "}", "ide_reset(VAR_0);", "bdrv_iostatus_enable(VAR_1);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11 ], [ 13 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 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 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ] ]
11,129
static int decode_mb_cabac(H264Context *h) { MpegEncContext * const s = &h->s; const int mb_xy= s->mb_x + s->mb_y*s->mb_stride; int mb_type, partition_count, cbp = 0; int dct8x8_allowed= h->pps.transform_8x8_mode; s->dsp.clear_blocks(h->mb); //FIXME avoid if already clear (move after skip handlong?) tprintf("pic:%d mb:%d/%d\n", h->frame_num, s->mb_x, s->mb_y); if( h->slice_type != I_TYPE && h->slice_type != SI_TYPE ) { int skip; /* a skipped mb needs the aff flag from the following mb */ if( FRAME_MBAFF && s->mb_x==0 && (s->mb_y&1)==0 ) predict_field_decoding_flag(h); if( FRAME_MBAFF && (s->mb_y&1)==1 && h->prev_mb_skipped ) skip = h->next_mb_skipped; else skip = decode_cabac_mb_skip( h, s->mb_x, s->mb_y ); /* read skip flags */ if( skip ) { if( FRAME_MBAFF && (s->mb_y&1)==0 ){ s->current_picture.mb_type[mb_xy] = MB_TYPE_SKIP; h->next_mb_skipped = decode_cabac_mb_skip( h, s->mb_x, s->mb_y+1 ); if(h->next_mb_skipped) predict_field_decoding_flag(h); else h->mb_mbaff = h->mb_field_decoding_flag = decode_cabac_field_decoding_flag(h); } decode_mb_skip(h); h->cbp_table[mb_xy] = 0; h->chroma_pred_mode_table[mb_xy] = 0; h->last_qscale_diff = 0; return 0; } } if(FRAME_MBAFF){ if( (s->mb_y&1) == 0 ) h->mb_mbaff = h->mb_field_decoding_flag = decode_cabac_field_decoding_flag(h); }else h->mb_field_decoding_flag= (s->picture_structure!=PICT_FRAME); h->prev_mb_skipped = 0; compute_mb_neighbors(h); if( ( mb_type = decode_cabac_mb_type( h ) ) < 0 ) { av_log( h->s.avctx, AV_LOG_ERROR, "decode_cabac_mb_type failed\n" ); return -1; } if( h->slice_type == B_TYPE ) { if( mb_type < 23 ){ partition_count= b_mb_type_info[mb_type].partition_count; mb_type= b_mb_type_info[mb_type].type; }else{ mb_type -= 23; goto decode_intra_mb; } } else if( h->slice_type == P_TYPE ) { if( mb_type < 5) { partition_count= p_mb_type_info[mb_type].partition_count; mb_type= p_mb_type_info[mb_type].type; } else { mb_type -= 5; goto decode_intra_mb; } } else { assert(h->slice_type == I_TYPE); decode_intra_mb: partition_count = 0; cbp= i_mb_type_info[mb_type].cbp; h->intra16x16_pred_mode= i_mb_type_info[mb_type].pred_mode; mb_type= i_mb_type_info[mb_type].type; } if(MB_FIELD) mb_type |= MB_TYPE_INTERLACED; h->slice_table[ mb_xy ]= h->slice_num; if(IS_INTRA_PCM(mb_type)) { const uint8_t *ptr; unsigned int x, y; // We assume these blocks are very rare so we dont optimize it. // FIXME The two following lines get the bitstream position in the cabac // decode, I think it should be done by a function in cabac.h (or cabac.c). ptr= h->cabac.bytestream; if(h->cabac.low&0x1) ptr--; if(CABAC_BITS==16){ if(h->cabac.low&0x1FF) ptr--; } // The pixels are stored in the same order as levels in h->mb array. for(y=0; y<16; y++){ const int index= 4*(y&3) + 32*((y>>2)&1) + 128*(y>>3); for(x=0; x<16; x++){ tprintf("LUMA ICPM LEVEL (%3d)\n", *ptr); h->mb[index + (x&3) + 16*((x>>2)&1) + 64*(x>>3)]= *ptr++; } } for(y=0; y<8; y++){ const int index= 256 + 4*(y&3) + 32*(y>>2); for(x=0; x<8; x++){ tprintf("CHROMA U ICPM LEVEL (%3d)\n", *ptr); h->mb[index + (x&3) + 16*(x>>2)]= *ptr++; } } for(y=0; y<8; y++){ const int index= 256 + 64 + 4*(y&3) + 32*(y>>2); for(x=0; x<8; x++){ tprintf("CHROMA V ICPM LEVEL (%3d)\n", *ptr); h->mb[index + (x&3) + 16*(x>>2)]= *ptr++; } } ff_init_cabac_decoder(&h->cabac, ptr, h->cabac.bytestream_end - ptr); // All blocks are present h->cbp_table[mb_xy] = 0x1ef; h->chroma_pred_mode_table[mb_xy] = 0; // In deblocking, the quantizer is 0 s->current_picture.qscale_table[mb_xy]= 0; h->chroma_qp = get_chroma_qp(h->pps.chroma_qp_index_offset, 0); // All coeffs are present memset(h->non_zero_count[mb_xy], 16, 16); s->current_picture.mb_type[mb_xy]= mb_type; return 0; } if(MB_MBAFF){ h->ref_count[0] <<= 1; h->ref_count[1] <<= 1; } fill_caches(h, mb_type, 0); if( IS_INTRA( mb_type ) ) { int i, pred_mode; if( IS_INTRA4x4( mb_type ) ) { if( dct8x8_allowed && decode_cabac_mb_transform_size( h ) ) { mb_type |= MB_TYPE_8x8DCT; for( i = 0; i < 16; i+=4 ) { int pred = pred_intra_mode( h, i ); int mode = decode_cabac_mb_intra4x4_pred_mode( h, pred ); fill_rectangle( &h->intra4x4_pred_mode_cache[ scan8[i] ], 2, 2, 8, mode, 1 ); } } else { for( i = 0; i < 16; i++ ) { int pred = pred_intra_mode( h, i ); h->intra4x4_pred_mode_cache[ scan8[i] ] = decode_cabac_mb_intra4x4_pred_mode( h, pred ); //av_log( s->avctx, AV_LOG_ERROR, "i4x4 pred=%d mode=%d\n", pred, h->intra4x4_pred_mode_cache[ scan8[i] ] ); } } write_back_intra_pred_mode(h); if( check_intra4x4_pred_mode(h) < 0 ) return -1; } else { h->intra16x16_pred_mode= check_intra_pred_mode( h, h->intra16x16_pred_mode ); if( h->intra16x16_pred_mode < 0 ) return -1; } h->chroma_pred_mode_table[mb_xy] = pred_mode = decode_cabac_mb_chroma_pre_mode( h ); pred_mode= check_intra_pred_mode( h, pred_mode ); if( pred_mode < 0 ) return -1; h->chroma_pred_mode= pred_mode; } else if( partition_count == 4 ) { int i, j, sub_partition_count[4], list, ref[2][4]; if( h->slice_type == B_TYPE ) { for( i = 0; i < 4; i++ ) { h->sub_mb_type[i] = decode_cabac_b_mb_sub_type( h ); sub_partition_count[i]= b_sub_mb_type_info[ h->sub_mb_type[i] ].partition_count; h->sub_mb_type[i]= b_sub_mb_type_info[ h->sub_mb_type[i] ].type; } if( IS_DIRECT(h->sub_mb_type[0] | h->sub_mb_type[1] | h->sub_mb_type[2] | h->sub_mb_type[3]) ) { pred_direct_motion(h, &mb_type); if( h->ref_count[0] > 1 || h->ref_count[1] > 1 ) { for( i = 0; i < 4; i++ ) if( IS_DIRECT(h->sub_mb_type[i]) ) fill_rectangle( &h->direct_cache[scan8[4*i]], 2, 2, 8, 1, 1 ); } } } else { for( i = 0; i < 4; i++ ) { h->sub_mb_type[i] = decode_cabac_p_mb_sub_type( h ); sub_partition_count[i]= p_sub_mb_type_info[ h->sub_mb_type[i] ].partition_count; h->sub_mb_type[i]= p_sub_mb_type_info[ h->sub_mb_type[i] ].type; } } for( list = 0; list < h->list_count; list++ ) { for( i = 0; i < 4; i++ ) { if(IS_DIRECT(h->sub_mb_type[i])) continue; if(IS_DIR(h->sub_mb_type[i], 0, list)){ if( h->ref_count[list] > 1 ) ref[list][i] = decode_cabac_mb_ref( h, list, 4*i ); else ref[list][i] = 0; } else { ref[list][i] = -1; } h->ref_cache[list][ scan8[4*i]+1 ]= h->ref_cache[list][ scan8[4*i]+8 ]=h->ref_cache[list][ scan8[4*i]+9 ]= ref[list][i]; } } if(dct8x8_allowed) dct8x8_allowed = get_dct8x8_allowed(h); for(list=0; list<h->list_count; list++){ for(i=0; i<4; i++){ if(IS_DIRECT(h->sub_mb_type[i])){ fill_rectangle(h->mvd_cache[list][scan8[4*i]], 2, 2, 8, 0, 4); continue; } h->ref_cache[list][ scan8[4*i] ]=h->ref_cache[list][ scan8[4*i]+1 ]; if(IS_DIR(h->sub_mb_type[i], 0, list) && !IS_DIRECT(h->sub_mb_type[i])){ const int sub_mb_type= h->sub_mb_type[i]; const int block_width= (sub_mb_type & (MB_TYPE_16x16|MB_TYPE_16x8)) ? 2 : 1; for(j=0; j<sub_partition_count[i]; j++){ int mpx, mpy; int mx, my; const int index= 4*i + block_width*j; int16_t (* mv_cache)[2]= &h->mv_cache[list][ scan8[index] ]; int16_t (* mvd_cache)[2]= &h->mvd_cache[list][ scan8[index] ]; pred_motion(h, index, block_width, list, h->ref_cache[list][ scan8[index] ], &mpx, &mpy); mx = mpx + decode_cabac_mb_mvd( h, list, index, 0 ); my = mpy + decode_cabac_mb_mvd( h, list, index, 1 ); tprintf("final mv:%d %d\n", mx, my); if(IS_SUB_8X8(sub_mb_type)){ mv_cache[ 1 ][0]= mv_cache[ 8 ][0]= mv_cache[ 9 ][0]= mx; mv_cache[ 1 ][1]= mv_cache[ 8 ][1]= mv_cache[ 9 ][1]= my; mvd_cache[ 1 ][0]= mvd_cache[ 8 ][0]= mvd_cache[ 9 ][0]= mx - mpx; mvd_cache[ 1 ][1]= mvd_cache[ 8 ][1]= mvd_cache[ 9 ][1]= my - mpy; }else if(IS_SUB_8X4(sub_mb_type)){ mv_cache[ 1 ][0]= mx; mv_cache[ 1 ][1]= my; mvd_cache[ 1 ][0]= mx - mpx; mvd_cache[ 1 ][1]= my - mpy; }else if(IS_SUB_4X8(sub_mb_type)){ mv_cache[ 8 ][0]= mx; mv_cache[ 8 ][1]= my; mvd_cache[ 8 ][0]= mx - mpx; mvd_cache[ 8 ][1]= my - mpy; } mv_cache[ 0 ][0]= mx; mv_cache[ 0 ][1]= my; mvd_cache[ 0 ][0]= mx - mpx; mvd_cache[ 0 ][1]= my - mpy; } }else{ uint32_t *p= (uint32_t *)&h->mv_cache[list][ scan8[4*i] ][0]; uint32_t *pd= (uint32_t *)&h->mvd_cache[list][ scan8[4*i] ][0]; p[0] = p[1] = p[8] = p[9] = 0; pd[0]= pd[1]= pd[8]= pd[9]= 0; } } } } else if( IS_DIRECT(mb_type) ) { pred_direct_motion(h, &mb_type); fill_rectangle(h->mvd_cache[0][scan8[0]], 4, 4, 8, 0, 4); fill_rectangle(h->mvd_cache[1][scan8[0]], 4, 4, 8, 0, 4); dct8x8_allowed &= h->sps.direct_8x8_inference_flag; } else { int list, mx, my, i, mpx, mpy; if(IS_16X16(mb_type)){ for(list=0; list<2; list++){ if(IS_DIR(mb_type, 0, list)){ if(h->ref_count[list] > 0 ){ const int ref = h->ref_count[list] > 1 ? decode_cabac_mb_ref( h, list, 0 ) : 0; fill_rectangle(&h->ref_cache[list][ scan8[0] ], 4, 4, 8, ref, 1); } }else fill_rectangle(&h->ref_cache[list][ scan8[0] ], 4, 4, 8, (uint8_t)LIST_NOT_USED, 1); } for(list=0; list<2; list++){ if(IS_DIR(mb_type, 0, list)){ pred_motion(h, 0, 4, list, h->ref_cache[list][ scan8[0] ], &mpx, &mpy); mx = mpx + decode_cabac_mb_mvd( h, list, 0, 0 ); my = mpy + decode_cabac_mb_mvd( h, list, 0, 1 ); tprintf("final mv:%d %d\n", mx, my); fill_rectangle(h->mvd_cache[list][ scan8[0] ], 4, 4, 8, pack16to32(mx-mpx,my-mpy), 4); fill_rectangle(h->mv_cache[list][ scan8[0] ], 4, 4, 8, pack16to32(mx,my), 4); }else fill_rectangle(h->mv_cache[list][ scan8[0] ], 4, 4, 8, 0, 4); } } else if(IS_16X8(mb_type)){ for(list=0; list<h->list_count; list++){ for(i=0; i<2; i++){ if(IS_DIR(mb_type, i, list)){ const int ref= h->ref_count[list] > 1 ? decode_cabac_mb_ref( h, list, 8*i ) : 0; fill_rectangle(&h->ref_cache[list][ scan8[0] + 16*i ], 4, 2, 8, ref, 1); }else fill_rectangle(&h->ref_cache[list][ scan8[0] + 16*i ], 4, 2, 8, (LIST_NOT_USED&0xFF), 1); } } for(list=0; list<h->list_count; list++){ for(i=0; i<2; i++){ if(IS_DIR(mb_type, i, list)){ pred_16x8_motion(h, 8*i, list, h->ref_cache[list][scan8[0] + 16*i], &mpx, &mpy); mx = mpx + decode_cabac_mb_mvd( h, list, 8*i, 0 ); my = mpy + decode_cabac_mb_mvd( h, list, 8*i, 1 ); tprintf("final mv:%d %d\n", mx, my); fill_rectangle(h->mvd_cache[list][ scan8[0] + 16*i ], 4, 2, 8, pack16to32(mx-mpx,my-mpy), 4); fill_rectangle(h->mv_cache[list][ scan8[0] + 16*i ], 4, 2, 8, pack16to32(mx,my), 4); }else{ fill_rectangle(h->mvd_cache[list][ scan8[0] + 16*i ], 4, 2, 8, 0, 4); fill_rectangle(h-> mv_cache[list][ scan8[0] + 16*i ], 4, 2, 8, 0, 4); } } } }else{ assert(IS_8X16(mb_type)); for(list=0; list<h->list_count; list++){ for(i=0; i<2; i++){ if(IS_DIR(mb_type, i, list)){ //FIXME optimize const int ref= h->ref_count[list] > 1 ? decode_cabac_mb_ref( h, list, 4*i ) : 0; fill_rectangle(&h->ref_cache[list][ scan8[0] + 2*i ], 2, 4, 8, ref, 1); }else fill_rectangle(&h->ref_cache[list][ scan8[0] + 2*i ], 2, 4, 8, (LIST_NOT_USED&0xFF), 1); } } for(list=0; list<h->list_count; list++){ for(i=0; i<2; i++){ if(IS_DIR(mb_type, i, list)){ pred_8x16_motion(h, i*4, list, h->ref_cache[list][ scan8[0] + 2*i ], &mpx, &mpy); mx = mpx + decode_cabac_mb_mvd( h, list, 4*i, 0 ); my = mpy + decode_cabac_mb_mvd( h, list, 4*i, 1 ); tprintf("final mv:%d %d\n", mx, my); fill_rectangle(h->mvd_cache[list][ scan8[0] + 2*i ], 2, 4, 8, pack16to32(mx-mpx,my-mpy), 4); fill_rectangle(h->mv_cache[list][ scan8[0] + 2*i ], 2, 4, 8, pack16to32(mx,my), 4); }else{ fill_rectangle(h->mvd_cache[list][ scan8[0] + 2*i ], 2, 4, 8, 0, 4); fill_rectangle(h-> mv_cache[list][ scan8[0] + 2*i ], 2, 4, 8, 0, 4); } } } } } if( IS_INTER( mb_type ) ) { h->chroma_pred_mode_table[mb_xy] = 0; write_back_motion( h, mb_type ); } if( !IS_INTRA16x16( mb_type ) ) { cbp = decode_cabac_mb_cbp_luma( h ); cbp |= decode_cabac_mb_cbp_chroma( h ) << 4; } h->cbp_table[mb_xy] = h->cbp = cbp; if( dct8x8_allowed && (cbp&15) && !IS_INTRA( mb_type ) ) { if( decode_cabac_mb_transform_size( h ) ) mb_type |= MB_TYPE_8x8DCT; } s->current_picture.mb_type[mb_xy]= mb_type; if( cbp || IS_INTRA16x16( mb_type ) ) { const uint8_t *scan, *scan8x8, *dc_scan; int dqp; if(IS_INTERLACED(mb_type)){ scan8x8= s->qscale ? h->field_scan8x8 : h->field_scan8x8_q0; scan= s->qscale ? h->field_scan : h->field_scan_q0; dc_scan= luma_dc_field_scan; }else{ scan8x8= s->qscale ? h->zigzag_scan8x8 : h->zigzag_scan8x8_q0; scan= s->qscale ? h->zigzag_scan : h->zigzag_scan_q0; dc_scan= luma_dc_zigzag_scan; } h->last_qscale_diff = dqp = decode_cabac_mb_dqp( h ); if( dqp == INT_MIN ){ av_log(h->s.avctx, AV_LOG_ERROR, "cabac decode of qscale diff failed at %d %d\n", s->mb_x, s->mb_y); return -1; } s->qscale += dqp; if(((unsigned)s->qscale) > 51){ if(s->qscale<0) s->qscale+= 52; else s->qscale-= 52; } h->chroma_qp = get_chroma_qp(h->pps.chroma_qp_index_offset, s->qscale); if( IS_INTRA16x16( mb_type ) ) { int i; //av_log( s->avctx, AV_LOG_ERROR, "INTRA16x16 DC\n" ); if( decode_cabac_residual( h, h->mb, 0, 0, dc_scan, NULL, 16) < 0) return -1; if( cbp&15 ) { for( i = 0; i < 16; i++ ) { //av_log( s->avctx, AV_LOG_ERROR, "INTRA16x16 AC:%d\n", i ); if( decode_cabac_residual(h, h->mb + 16*i, 1, i, scan + 1, h->dequant4_coeff[0][s->qscale], 15) < 0 ) return -1; } } else { fill_rectangle(&h->non_zero_count_cache[scan8[0]], 4, 4, 8, 0, 1); } } else { int i8x8, i4x4; for( i8x8 = 0; i8x8 < 4; i8x8++ ) { if( cbp & (1<<i8x8) ) { if( IS_8x8DCT(mb_type) ) { if( decode_cabac_residual(h, h->mb + 64*i8x8, 5, 4*i8x8, scan8x8, h->dequant8_coeff[IS_INTRA( mb_type ) ? 0:1][s->qscale], 64) < 0 ) return -1; } else for( i4x4 = 0; i4x4 < 4; i4x4++ ) { const int index = 4*i8x8 + i4x4; //av_log( s->avctx, AV_LOG_ERROR, "Luma4x4: %d\n", index ); //START_TIMER if( decode_cabac_residual(h, h->mb + 16*index, 2, index, scan, h->dequant4_coeff[IS_INTRA( mb_type ) ? 0:3][s->qscale], 16) < 0 ) return -1; //STOP_TIMER("decode_residual") } } else { uint8_t * const nnz= &h->non_zero_count_cache[ scan8[4*i8x8] ]; nnz[0] = nnz[1] = nnz[8] = nnz[9] = 0; } } } if( cbp&0x30 ){ int c; for( c = 0; c < 2; c++ ) { //av_log( s->avctx, AV_LOG_ERROR, "INTRA C%d-DC\n",c ); if( decode_cabac_residual(h, h->mb + 256 + 16*4*c, 3, c, chroma_dc_scan, NULL, 4) < 0) return -1; } } if( cbp&0x20 ) { int c, i; for( c = 0; c < 2; c++ ) { for( i = 0; i < 4; i++ ) { const int index = 16 + 4 * c + i; //av_log( s->avctx, AV_LOG_ERROR, "INTRA C%d-AC %d\n",c, index - 16 ); if( decode_cabac_residual(h, h->mb + 16*index, 4, index - 16, scan + 1, h->dequant4_coeff[c+1+(IS_INTRA( mb_type ) ? 0:3)][h->chroma_qp], 15) < 0) return -1; } } } else { uint8_t * const nnz= &h->non_zero_count_cache[0]; nnz[ scan8[16]+0 ] = nnz[ scan8[16]+1 ] =nnz[ scan8[16]+8 ] =nnz[ scan8[16]+9 ] = nnz[ scan8[20]+0 ] = nnz[ scan8[20]+1 ] =nnz[ scan8[20]+8 ] =nnz[ scan8[20]+9 ] = 0; } } else { uint8_t * const nnz= &h->non_zero_count_cache[0]; fill_rectangle(&nnz[scan8[0]], 4, 4, 8, 0, 1); nnz[ scan8[16]+0 ] = nnz[ scan8[16]+1 ] =nnz[ scan8[16]+8 ] =nnz[ scan8[16]+9 ] = nnz[ scan8[20]+0 ] = nnz[ scan8[20]+1 ] =nnz[ scan8[20]+8 ] =nnz[ scan8[20]+9 ] = 0; h->last_qscale_diff = 0; } s->current_picture.qscale_table[mb_xy]= s->qscale; write_back_non_zero_count(h); if(MB_MBAFF){ h->ref_count[0] >>= 1; h->ref_count[1] >>= 1; } return 0; }
false
FFmpeg
8d6947bc7d50732202f5a6c10633169c9d4e08bc
static int decode_mb_cabac(H264Context *h) { MpegEncContext * const s = &h->s; const int mb_xy= s->mb_x + s->mb_y*s->mb_stride; int mb_type, partition_count, cbp = 0; int dct8x8_allowed= h->pps.transform_8x8_mode; s->dsp.clear_blocks(h->mb); tprintf("pic:%d mb:%d/%d\n", h->frame_num, s->mb_x, s->mb_y); if( h->slice_type != I_TYPE && h->slice_type != SI_TYPE ) { int skip; if( FRAME_MBAFF && s->mb_x==0 && (s->mb_y&1)==0 ) predict_field_decoding_flag(h); if( FRAME_MBAFF && (s->mb_y&1)==1 && h->prev_mb_skipped ) skip = h->next_mb_skipped; else skip = decode_cabac_mb_skip( h, s->mb_x, s->mb_y ); if( skip ) { if( FRAME_MBAFF && (s->mb_y&1)==0 ){ s->current_picture.mb_type[mb_xy] = MB_TYPE_SKIP; h->next_mb_skipped = decode_cabac_mb_skip( h, s->mb_x, s->mb_y+1 ); if(h->next_mb_skipped) predict_field_decoding_flag(h); else h->mb_mbaff = h->mb_field_decoding_flag = decode_cabac_field_decoding_flag(h); } decode_mb_skip(h); h->cbp_table[mb_xy] = 0; h->chroma_pred_mode_table[mb_xy] = 0; h->last_qscale_diff = 0; return 0; } } if(FRAME_MBAFF){ if( (s->mb_y&1) == 0 ) h->mb_mbaff = h->mb_field_decoding_flag = decode_cabac_field_decoding_flag(h); }else h->mb_field_decoding_flag= (s->picture_structure!=PICT_FRAME); h->prev_mb_skipped = 0; compute_mb_neighbors(h); if( ( mb_type = decode_cabac_mb_type( h ) ) < 0 ) { av_log( h->s.avctx, AV_LOG_ERROR, "decode_cabac_mb_type failed\n" ); return -1; } if( h->slice_type == B_TYPE ) { if( mb_type < 23 ){ partition_count= b_mb_type_info[mb_type].partition_count; mb_type= b_mb_type_info[mb_type].type; }else{ mb_type -= 23; goto decode_intra_mb; } } else if( h->slice_type == P_TYPE ) { if( mb_type < 5) { partition_count= p_mb_type_info[mb_type].partition_count; mb_type= p_mb_type_info[mb_type].type; } else { mb_type -= 5; goto decode_intra_mb; } } else { assert(h->slice_type == I_TYPE); decode_intra_mb: partition_count = 0; cbp= i_mb_type_info[mb_type].cbp; h->intra16x16_pred_mode= i_mb_type_info[mb_type].pred_mode; mb_type= i_mb_type_info[mb_type].type; } if(MB_FIELD) mb_type |= MB_TYPE_INTERLACED; h->slice_table[ mb_xy ]= h->slice_num; if(IS_INTRA_PCM(mb_type)) { const uint8_t *ptr; unsigned int x, y; ptr= h->cabac.bytestream; if(h->cabac.low&0x1) ptr--; if(CABAC_BITS==16){ if(h->cabac.low&0x1FF) ptr--; } for(y=0; y<16; y++){ const int index= 4*(y&3) + 32*((y>>2)&1) + 128*(y>>3); for(x=0; x<16; x++){ tprintf("LUMA ICPM LEVEL (%3d)\n", *ptr); h->mb[index + (x&3) + 16*((x>>2)&1) + 64*(x>>3)]= *ptr++; } } for(y=0; y<8; y++){ const int index= 256 + 4*(y&3) + 32*(y>>2); for(x=0; x<8; x++){ tprintf("CHROMA U ICPM LEVEL (%3d)\n", *ptr); h->mb[index + (x&3) + 16*(x>>2)]= *ptr++; } } for(y=0; y<8; y++){ const int index= 256 + 64 + 4*(y&3) + 32*(y>>2); for(x=0; x<8; x++){ tprintf("CHROMA V ICPM LEVEL (%3d)\n", *ptr); h->mb[index + (x&3) + 16*(x>>2)]= *ptr++; } } ff_init_cabac_decoder(&h->cabac, ptr, h->cabac.bytestream_end - ptr); h->cbp_table[mb_xy] = 0x1ef; h->chroma_pred_mode_table[mb_xy] = 0; s->current_picture.qscale_table[mb_xy]= 0; h->chroma_qp = get_chroma_qp(h->pps.chroma_qp_index_offset, 0); memset(h->non_zero_count[mb_xy], 16, 16); s->current_picture.mb_type[mb_xy]= mb_type; return 0; } if(MB_MBAFF){ h->ref_count[0] <<= 1; h->ref_count[1] <<= 1; } fill_caches(h, mb_type, 0); if( IS_INTRA( mb_type ) ) { int i, pred_mode; if( IS_INTRA4x4( mb_type ) ) { if( dct8x8_allowed && decode_cabac_mb_transform_size( h ) ) { mb_type |= MB_TYPE_8x8DCT; for( i = 0; i < 16; i+=4 ) { int pred = pred_intra_mode( h, i ); int mode = decode_cabac_mb_intra4x4_pred_mode( h, pred ); fill_rectangle( &h->intra4x4_pred_mode_cache[ scan8[i] ], 2, 2, 8, mode, 1 ); } } else { for( i = 0; i < 16; i++ ) { int pred = pred_intra_mode( h, i ); h->intra4x4_pred_mode_cache[ scan8[i] ] = decode_cabac_mb_intra4x4_pred_mode( h, pred ); } } write_back_intra_pred_mode(h); if( check_intra4x4_pred_mode(h) < 0 ) return -1; } else { h->intra16x16_pred_mode= check_intra_pred_mode( h, h->intra16x16_pred_mode ); if( h->intra16x16_pred_mode < 0 ) return -1; } h->chroma_pred_mode_table[mb_xy] = pred_mode = decode_cabac_mb_chroma_pre_mode( h ); pred_mode= check_intra_pred_mode( h, pred_mode ); if( pred_mode < 0 ) return -1; h->chroma_pred_mode= pred_mode; } else if( partition_count == 4 ) { int i, j, sub_partition_count[4], list, ref[2][4]; if( h->slice_type == B_TYPE ) { for( i = 0; i < 4; i++ ) { h->sub_mb_type[i] = decode_cabac_b_mb_sub_type( h ); sub_partition_count[i]= b_sub_mb_type_info[ h->sub_mb_type[i] ].partition_count; h->sub_mb_type[i]= b_sub_mb_type_info[ h->sub_mb_type[i] ].type; } if( IS_DIRECT(h->sub_mb_type[0] | h->sub_mb_type[1] | h->sub_mb_type[2] | h->sub_mb_type[3]) ) { pred_direct_motion(h, &mb_type); if( h->ref_count[0] > 1 || h->ref_count[1] > 1 ) { for( i = 0; i < 4; i++ ) if( IS_DIRECT(h->sub_mb_type[i]) ) fill_rectangle( &h->direct_cache[scan8[4*i]], 2, 2, 8, 1, 1 ); } } } else { for( i = 0; i < 4; i++ ) { h->sub_mb_type[i] = decode_cabac_p_mb_sub_type( h ); sub_partition_count[i]= p_sub_mb_type_info[ h->sub_mb_type[i] ].partition_count; h->sub_mb_type[i]= p_sub_mb_type_info[ h->sub_mb_type[i] ].type; } } for( list = 0; list < h->list_count; list++ ) { for( i = 0; i < 4; i++ ) { if(IS_DIRECT(h->sub_mb_type[i])) continue; if(IS_DIR(h->sub_mb_type[i], 0, list)){ if( h->ref_count[list] > 1 ) ref[list][i] = decode_cabac_mb_ref( h, list, 4*i ); else ref[list][i] = 0; } else { ref[list][i] = -1; } h->ref_cache[list][ scan8[4*i]+1 ]= h->ref_cache[list][ scan8[4*i]+8 ]=h->ref_cache[list][ scan8[4*i]+9 ]= ref[list][i]; } } if(dct8x8_allowed) dct8x8_allowed = get_dct8x8_allowed(h); for(list=0; list<h->list_count; list++){ for(i=0; i<4; i++){ if(IS_DIRECT(h->sub_mb_type[i])){ fill_rectangle(h->mvd_cache[list][scan8[4*i]], 2, 2, 8, 0, 4); continue; } h->ref_cache[list][ scan8[4*i] ]=h->ref_cache[list][ scan8[4*i]+1 ]; if(IS_DIR(h->sub_mb_type[i], 0, list) && !IS_DIRECT(h->sub_mb_type[i])){ const int sub_mb_type= h->sub_mb_type[i]; const int block_width= (sub_mb_type & (MB_TYPE_16x16|MB_TYPE_16x8)) ? 2 : 1; for(j=0; j<sub_partition_count[i]; j++){ int mpx, mpy; int mx, my; const int index= 4*i + block_width*j; int16_t (* mv_cache)[2]= &h->mv_cache[list][ scan8[index] ]; int16_t (* mvd_cache)[2]= &h->mvd_cache[list][ scan8[index] ]; pred_motion(h, index, block_width, list, h->ref_cache[list][ scan8[index] ], &mpx, &mpy); mx = mpx + decode_cabac_mb_mvd( h, list, index, 0 ); my = mpy + decode_cabac_mb_mvd( h, list, index, 1 ); tprintf("final mv:%d %d\n", mx, my); if(IS_SUB_8X8(sub_mb_type)){ mv_cache[ 1 ][0]= mv_cache[ 8 ][0]= mv_cache[ 9 ][0]= mx; mv_cache[ 1 ][1]= mv_cache[ 8 ][1]= mv_cache[ 9 ][1]= my; mvd_cache[ 1 ][0]= mvd_cache[ 8 ][0]= mvd_cache[ 9 ][0]= mx - mpx; mvd_cache[ 1 ][1]= mvd_cache[ 8 ][1]= mvd_cache[ 9 ][1]= my - mpy; }else if(IS_SUB_8X4(sub_mb_type)){ mv_cache[ 1 ][0]= mx; mv_cache[ 1 ][1]= my; mvd_cache[ 1 ][0]= mx - mpx; mvd_cache[ 1 ][1]= my - mpy; }else if(IS_SUB_4X8(sub_mb_type)){ mv_cache[ 8 ][0]= mx; mv_cache[ 8 ][1]= my; mvd_cache[ 8 ][0]= mx - mpx; mvd_cache[ 8 ][1]= my - mpy; } mv_cache[ 0 ][0]= mx; mv_cache[ 0 ][1]= my; mvd_cache[ 0 ][0]= mx - mpx; mvd_cache[ 0 ][1]= my - mpy; } }else{ uint32_t *p= (uint32_t *)&h->mv_cache[list][ scan8[4*i] ][0]; uint32_t *pd= (uint32_t *)&h->mvd_cache[list][ scan8[4*i] ][0]; p[0] = p[1] = p[8] = p[9] = 0; pd[0]= pd[1]= pd[8]= pd[9]= 0; } } } } else if( IS_DIRECT(mb_type) ) { pred_direct_motion(h, &mb_type); fill_rectangle(h->mvd_cache[0][scan8[0]], 4, 4, 8, 0, 4); fill_rectangle(h->mvd_cache[1][scan8[0]], 4, 4, 8, 0, 4); dct8x8_allowed &= h->sps.direct_8x8_inference_flag; } else { int list, mx, my, i, mpx, mpy; if(IS_16X16(mb_type)){ for(list=0; list<2; list++){ if(IS_DIR(mb_type, 0, list)){ if(h->ref_count[list] > 0 ){ const int ref = h->ref_count[list] > 1 ? decode_cabac_mb_ref( h, list, 0 ) : 0; fill_rectangle(&h->ref_cache[list][ scan8[0] ], 4, 4, 8, ref, 1); } }else fill_rectangle(&h->ref_cache[list][ scan8[0] ], 4, 4, 8, (uint8_t)LIST_NOT_USED, 1); } for(list=0; list<2; list++){ if(IS_DIR(mb_type, 0, list)){ pred_motion(h, 0, 4, list, h->ref_cache[list][ scan8[0] ], &mpx, &mpy); mx = mpx + decode_cabac_mb_mvd( h, list, 0, 0 ); my = mpy + decode_cabac_mb_mvd( h, list, 0, 1 ); tprintf("final mv:%d %d\n", mx, my); fill_rectangle(h->mvd_cache[list][ scan8[0] ], 4, 4, 8, pack16to32(mx-mpx,my-mpy), 4); fill_rectangle(h->mv_cache[list][ scan8[0] ], 4, 4, 8, pack16to32(mx,my), 4); }else fill_rectangle(h->mv_cache[list][ scan8[0] ], 4, 4, 8, 0, 4); } } else if(IS_16X8(mb_type)){ for(list=0; list<h->list_count; list++){ for(i=0; i<2; i++){ if(IS_DIR(mb_type, i, list)){ const int ref= h->ref_count[list] > 1 ? decode_cabac_mb_ref( h, list, 8*i ) : 0; fill_rectangle(&h->ref_cache[list][ scan8[0] + 16*i ], 4, 2, 8, ref, 1); }else fill_rectangle(&h->ref_cache[list][ scan8[0] + 16*i ], 4, 2, 8, (LIST_NOT_USED&0xFF), 1); } } for(list=0; list<h->list_count; list++){ for(i=0; i<2; i++){ if(IS_DIR(mb_type, i, list)){ pred_16x8_motion(h, 8*i, list, h->ref_cache[list][scan8[0] + 16*i], &mpx, &mpy); mx = mpx + decode_cabac_mb_mvd( h, list, 8*i, 0 ); my = mpy + decode_cabac_mb_mvd( h, list, 8*i, 1 ); tprintf("final mv:%d %d\n", mx, my); fill_rectangle(h->mvd_cache[list][ scan8[0] + 16*i ], 4, 2, 8, pack16to32(mx-mpx,my-mpy), 4); fill_rectangle(h->mv_cache[list][ scan8[0] + 16*i ], 4, 2, 8, pack16to32(mx,my), 4); }else{ fill_rectangle(h->mvd_cache[list][ scan8[0] + 16*i ], 4, 2, 8, 0, 4); fill_rectangle(h-> mv_cache[list][ scan8[0] + 16*i ], 4, 2, 8, 0, 4); } } } }else{ assert(IS_8X16(mb_type)); for(list=0; list<h->list_count; list++){ for(i=0; i<2; i++){ if(IS_DIR(mb_type, i, list)){ const int ref= h->ref_count[list] > 1 ? decode_cabac_mb_ref( h, list, 4*i ) : 0; fill_rectangle(&h->ref_cache[list][ scan8[0] + 2*i ], 2, 4, 8, ref, 1); }else fill_rectangle(&h->ref_cache[list][ scan8[0] + 2*i ], 2, 4, 8, (LIST_NOT_USED&0xFF), 1); } } for(list=0; list<h->list_count; list++){ for(i=0; i<2; i++){ if(IS_DIR(mb_type, i, list)){ pred_8x16_motion(h, i*4, list, h->ref_cache[list][ scan8[0] + 2*i ], &mpx, &mpy); mx = mpx + decode_cabac_mb_mvd( h, list, 4*i, 0 ); my = mpy + decode_cabac_mb_mvd( h, list, 4*i, 1 ); tprintf("final mv:%d %d\n", mx, my); fill_rectangle(h->mvd_cache[list][ scan8[0] + 2*i ], 2, 4, 8, pack16to32(mx-mpx,my-mpy), 4); fill_rectangle(h->mv_cache[list][ scan8[0] + 2*i ], 2, 4, 8, pack16to32(mx,my), 4); }else{ fill_rectangle(h->mvd_cache[list][ scan8[0] + 2*i ], 2, 4, 8, 0, 4); fill_rectangle(h-> mv_cache[list][ scan8[0] + 2*i ], 2, 4, 8, 0, 4); } } } } } if( IS_INTER( mb_type ) ) { h->chroma_pred_mode_table[mb_xy] = 0; write_back_motion( h, mb_type ); } if( !IS_INTRA16x16( mb_type ) ) { cbp = decode_cabac_mb_cbp_luma( h ); cbp |= decode_cabac_mb_cbp_chroma( h ) << 4; } h->cbp_table[mb_xy] = h->cbp = cbp; if( dct8x8_allowed && (cbp&15) && !IS_INTRA( mb_type ) ) { if( decode_cabac_mb_transform_size( h ) ) mb_type |= MB_TYPE_8x8DCT; } s->current_picture.mb_type[mb_xy]= mb_type; if( cbp || IS_INTRA16x16( mb_type ) ) { const uint8_t *scan, *scan8x8, *dc_scan; int dqp; if(IS_INTERLACED(mb_type)){ scan8x8= s->qscale ? h->field_scan8x8 : h->field_scan8x8_q0; scan= s->qscale ? h->field_scan : h->field_scan_q0; dc_scan= luma_dc_field_scan; }else{ scan8x8= s->qscale ? h->zigzag_scan8x8 : h->zigzag_scan8x8_q0; scan= s->qscale ? h->zigzag_scan : h->zigzag_scan_q0; dc_scan= luma_dc_zigzag_scan; } h->last_qscale_diff = dqp = decode_cabac_mb_dqp( h ); if( dqp == INT_MIN ){ av_log(h->s.avctx, AV_LOG_ERROR, "cabac decode of qscale diff failed at %d %d\n", s->mb_x, s->mb_y); return -1; } s->qscale += dqp; if(((unsigned)s->qscale) > 51){ if(s->qscale<0) s->qscale+= 52; else s->qscale-= 52; } h->chroma_qp = get_chroma_qp(h->pps.chroma_qp_index_offset, s->qscale); if( IS_INTRA16x16( mb_type ) ) { int i; if( decode_cabac_residual( h, h->mb, 0, 0, dc_scan, NULL, 16) < 0) return -1; if( cbp&15 ) { for( i = 0; i < 16; i++ ) { if( decode_cabac_residual(h, h->mb + 16*i, 1, i, scan + 1, h->dequant4_coeff[0][s->qscale], 15) < 0 ) return -1; } } else { fill_rectangle(&h->non_zero_count_cache[scan8[0]], 4, 4, 8, 0, 1); } } else { int i8x8, i4x4; for( i8x8 = 0; i8x8 < 4; i8x8++ ) { if( cbp & (1<<i8x8) ) { if( IS_8x8DCT(mb_type) ) { if( decode_cabac_residual(h, h->mb + 64*i8x8, 5, 4*i8x8, scan8x8, h->dequant8_coeff[IS_INTRA( mb_type ) ? 0:1][s->qscale], 64) < 0 ) return -1; } else for( i4x4 = 0; i4x4 < 4; i4x4++ ) { const int index = 4*i8x8 + i4x4; if( decode_cabac_residual(h, h->mb + 16*index, 2, index, scan, h->dequant4_coeff[IS_INTRA( mb_type ) ? 0:3][s->qscale], 16) < 0 ) return -1; } } else { uint8_t * const nnz= &h->non_zero_count_cache[ scan8[4*i8x8] ]; nnz[0] = nnz[1] = nnz[8] = nnz[9] = 0; } } } if( cbp&0x30 ){ int c; for( c = 0; c < 2; c++ ) { if( decode_cabac_residual(h, h->mb + 256 + 16*4*c, 3, c, chroma_dc_scan, NULL, 4) < 0) return -1; } } if( cbp&0x20 ) { int c, i; for( c = 0; c < 2; c++ ) { for( i = 0; i < 4; i++ ) { const int index = 16 + 4 * c + i; if( decode_cabac_residual(h, h->mb + 16*index, 4, index - 16, scan + 1, h->dequant4_coeff[c+1+(IS_INTRA( mb_type ) ? 0:3)][h->chroma_qp], 15) < 0) return -1; } } } else { uint8_t * const nnz= &h->non_zero_count_cache[0]; nnz[ scan8[16]+0 ] = nnz[ scan8[16]+1 ] =nnz[ scan8[16]+8 ] =nnz[ scan8[16]+9 ] = nnz[ scan8[20]+0 ] = nnz[ scan8[20]+1 ] =nnz[ scan8[20]+8 ] =nnz[ scan8[20]+9 ] = 0; } } else { uint8_t * const nnz= &h->non_zero_count_cache[0]; fill_rectangle(&nnz[scan8[0]], 4, 4, 8, 0, 1); nnz[ scan8[16]+0 ] = nnz[ scan8[16]+1 ] =nnz[ scan8[16]+8 ] =nnz[ scan8[16]+9 ] = nnz[ scan8[20]+0 ] = nnz[ scan8[20]+1 ] =nnz[ scan8[20]+8 ] =nnz[ scan8[20]+9 ] = 0; h->last_qscale_diff = 0; } s->current_picture.qscale_table[mb_xy]= s->qscale; write_back_non_zero_count(h); if(MB_MBAFF){ h->ref_count[0] >>= 1; h->ref_count[1] >>= 1; } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(H264Context *VAR_0) { MpegEncContext * const s = &VAR_0->s; const int VAR_1= s->mb_x + s->mb_y*s->mb_stride; int VAR_2, VAR_3, VAR_4 = 0; int VAR_5= VAR_0->pps.transform_8x8_mode; s->dsp.clear_blocks(VAR_0->mb); tprintf("pic:%d mb:%d/%d\n", VAR_0->frame_num, s->mb_x, s->mb_y); if( VAR_0->slice_type != I_TYPE && VAR_0->slice_type != SI_TYPE ) { int VAR_6; if( FRAME_MBAFF && s->mb_x==0 && (s->mb_y&1)==0 ) predict_field_decoding_flag(VAR_0); if( FRAME_MBAFF && (s->mb_y&1)==1 && VAR_0->prev_mb_skipped ) VAR_6 = VAR_0->next_mb_skipped; else VAR_6 = decode_cabac_mb_skip( VAR_0, s->mb_x, s->mb_y ); if( VAR_6 ) { if( FRAME_MBAFF && (s->mb_y&1)==0 ){ s->current_picture.VAR_2[VAR_1] = MB_TYPE_SKIP; VAR_0->next_mb_skipped = decode_cabac_mb_skip( VAR_0, s->mb_x, s->mb_y+1 ); if(VAR_0->next_mb_skipped) predict_field_decoding_flag(VAR_0); else VAR_0->mb_mbaff = VAR_0->mb_field_decoding_flag = decode_cabac_field_decoding_flag(VAR_0); } decode_mb_skip(VAR_0); VAR_0->cbp_table[VAR_1] = 0; VAR_0->chroma_pred_mode_table[VAR_1] = 0; VAR_0->last_qscale_diff = 0; return 0; } } if(FRAME_MBAFF){ if( (s->mb_y&1) == 0 ) VAR_0->mb_mbaff = VAR_0->mb_field_decoding_flag = decode_cabac_field_decoding_flag(VAR_0); }else VAR_0->mb_field_decoding_flag= (s->picture_structure!=PICT_FRAME); VAR_0->prev_mb_skipped = 0; compute_mb_neighbors(VAR_0); if( ( VAR_2 = decode_cabac_mb_type( VAR_0 ) ) < 0 ) { av_log( VAR_0->s.avctx, AV_LOG_ERROR, "decode_cabac_mb_type failed\n" ); return -1; } if( VAR_0->slice_type == B_TYPE ) { if( VAR_2 < 23 ){ VAR_3= b_mb_type_info[VAR_2].VAR_3; VAR_2= b_mb_type_info[VAR_2].type; }else{ VAR_2 -= 23; goto decode_intra_mb; } } else if( VAR_0->slice_type == P_TYPE ) { if( VAR_2 < 5) { VAR_3= p_mb_type_info[VAR_2].VAR_3; VAR_2= p_mb_type_info[VAR_2].type; } else { VAR_2 -= 5; goto decode_intra_mb; } } else { assert(VAR_0->slice_type == I_TYPE); decode_intra_mb: VAR_3 = 0; VAR_4= i_mb_type_info[VAR_2].VAR_4; VAR_0->intra16x16_pred_mode= i_mb_type_info[VAR_2].VAR_12; VAR_2= i_mb_type_info[VAR_2].type; } if(MB_FIELD) VAR_2 |= MB_TYPE_INTERLACED; VAR_0->slice_table[ VAR_1 ]= VAR_0->slice_num; if(IS_INTRA_PCM(VAR_2)) { const uint8_t *VAR_7; unsigned int VAR_8, VAR_9; VAR_7= VAR_0->cabac.bytestream; if(VAR_0->cabac.low&0x1) VAR_7--; if(CABAC_BITS==16){ if(VAR_0->cabac.low&0x1FF) VAR_7--; } for(VAR_9=0; VAR_9<16; VAR_9++){ const int VAR_28= 4*(VAR_9&3) + 32*((VAR_9>>2)&1) + 128*(VAR_9>>3); for(VAR_8=0; VAR_8<16; VAR_8++){ tprintf("LUMA ICPM LEVEL (%3d)\n", *VAR_7); VAR_0->mb[VAR_28 + (VAR_8&3) + 16*((VAR_8>>2)&1) + 64*(VAR_8>>3)]= *VAR_7++; } } for(VAR_9=0; VAR_9<8; VAR_9++){ const int VAR_28= 256 + 4*(VAR_9&3) + 32*(VAR_9>>2); for(VAR_8=0; VAR_8<8; VAR_8++){ tprintf("CHROMA U ICPM LEVEL (%3d)\n", *VAR_7); VAR_0->mb[VAR_28 + (VAR_8&3) + 16*(VAR_8>>2)]= *VAR_7++; } } for(VAR_9=0; VAR_9<8; VAR_9++){ const int VAR_28= 256 + 64 + 4*(VAR_9&3) + 32*(VAR_9>>2); for(VAR_8=0; VAR_8<8; VAR_8++){ tprintf("CHROMA V ICPM LEVEL (%3d)\n", *VAR_7); VAR_0->mb[VAR_28 + (VAR_8&3) + 16*(VAR_8>>2)]= *VAR_7++; } } ff_init_cabac_decoder(&VAR_0->cabac, VAR_7, VAR_0->cabac.bytestream_end - VAR_7); VAR_0->cbp_table[VAR_1] = 0x1ef; VAR_0->chroma_pred_mode_table[VAR_1] = 0; s->current_picture.qscale_table[VAR_1]= 0; VAR_0->chroma_qp = get_chroma_qp(VAR_0->pps.chroma_qp_index_offset, 0); memset(VAR_0->non_zero_count[VAR_1], 16, 16); s->current_picture.VAR_2[VAR_1]= VAR_2; return 0; } if(MB_MBAFF){ VAR_0->ref_count[0] <<= 1; VAR_0->ref_count[1] <<= 1; } fill_caches(VAR_0, VAR_2, 0); if( IS_INTRA( VAR_2 ) ) { int VAR_28, VAR_12; if( IS_INTRA4x4( VAR_2 ) ) { if( VAR_5 && decode_cabac_mb_transform_size( VAR_0 ) ) { VAR_2 |= MB_TYPE_8x8DCT; for( VAR_28 = 0; VAR_28 < 16; VAR_28+=4 ) { int VAR_15 = pred_intra_mode( VAR_0, VAR_28 ); int VAR_14 = decode_cabac_mb_intra4x4_pred_mode( VAR_0, VAR_15 ); fill_rectangle( &VAR_0->intra4x4_pred_mode_cache[ scan8[VAR_28] ], 2, 2, 8, VAR_14, 1 ); } } else { for( VAR_28 = 0; VAR_28 < 16; VAR_28++ ) { int VAR_15 = pred_intra_mode( VAR_0, VAR_28 ); VAR_0->intra4x4_pred_mode_cache[ scan8[VAR_28] ] = decode_cabac_mb_intra4x4_pred_mode( VAR_0, VAR_15 ); } } write_back_intra_pred_mode(VAR_0); if( check_intra4x4_pred_mode(VAR_0) < 0 ) return -1; } else { VAR_0->intra16x16_pred_mode= check_intra_pred_mode( VAR_0, VAR_0->intra16x16_pred_mode ); if( VAR_0->intra16x16_pred_mode < 0 ) return -1; } VAR_0->chroma_pred_mode_table[VAR_1] = VAR_12 = decode_cabac_mb_chroma_pre_mode( VAR_0 ); VAR_12= check_intra_pred_mode( VAR_0, VAR_12 ); if( VAR_12 < 0 ) return -1; VAR_0->chroma_pred_mode= VAR_12; } else if( VAR_3 == 4 ) { int VAR_28, VAR_15, VAR_16[4], VAR_19, VAR_23[2][4]; if( VAR_0->slice_type == B_TYPE ) { for( VAR_28 = 0; VAR_28 < 4; VAR_28++ ) { VAR_0->sub_mb_type[VAR_28] = decode_cabac_b_mb_sub_type( VAR_0 ); VAR_16[VAR_28]= b_sub_mb_type_info[ VAR_0->sub_mb_type[VAR_28] ].VAR_3; VAR_0->sub_mb_type[VAR_28]= b_sub_mb_type_info[ VAR_0->sub_mb_type[VAR_28] ].type; } if( IS_DIRECT(VAR_0->sub_mb_type[0] | VAR_0->sub_mb_type[1] | VAR_0->sub_mb_type[2] | VAR_0->sub_mb_type[3]) ) { pred_direct_motion(VAR_0, &VAR_2); if( VAR_0->ref_count[0] > 1 || VAR_0->ref_count[1] > 1 ) { for( VAR_28 = 0; VAR_28 < 4; VAR_28++ ) if( IS_DIRECT(VAR_0->sub_mb_type[VAR_28]) ) fill_rectangle( &VAR_0->direct_cache[scan8[4*VAR_28]], 2, 2, 8, 1, 1 ); } } } else { for( VAR_28 = 0; VAR_28 < 4; VAR_28++ ) { VAR_0->sub_mb_type[VAR_28] = decode_cabac_p_mb_sub_type( VAR_0 ); VAR_16[VAR_28]= p_sub_mb_type_info[ VAR_0->sub_mb_type[VAR_28] ].VAR_3; VAR_0->sub_mb_type[VAR_28]= p_sub_mb_type_info[ VAR_0->sub_mb_type[VAR_28] ].type; } } for( VAR_19 = 0; VAR_19 < VAR_0->list_count; VAR_19++ ) { for( VAR_28 = 0; VAR_28 < 4; VAR_28++ ) { if(IS_DIRECT(VAR_0->sub_mb_type[VAR_28])) continue; if(IS_DIR(VAR_0->sub_mb_type[VAR_28], 0, VAR_19)){ if( VAR_0->ref_count[VAR_19] > 1 ) VAR_23[VAR_19][VAR_28] = decode_cabac_mb_ref( VAR_0, VAR_19, 4*VAR_28 ); else VAR_23[VAR_19][VAR_28] = 0; } else { VAR_23[VAR_19][VAR_28] = -1; } VAR_0->ref_cache[VAR_19][ scan8[4*VAR_28]+1 ]= VAR_0->ref_cache[VAR_19][ scan8[4*VAR_28]+8 ]=VAR_0->ref_cache[VAR_19][ scan8[4*VAR_28]+9 ]= VAR_23[VAR_19][VAR_28]; } } if(VAR_5) VAR_5 = get_dct8x8_allowed(VAR_0); for(VAR_19=0; VAR_19<VAR_0->list_count; VAR_19++){ for(VAR_28=0; VAR_28<4; VAR_28++){ if(IS_DIRECT(VAR_0->sub_mb_type[VAR_28])){ fill_rectangle(VAR_0->mvd_cache[VAR_19][scan8[4*VAR_28]], 2, 2, 8, 0, 4); continue; } VAR_0->ref_cache[VAR_19][ scan8[4*VAR_28] ]=VAR_0->ref_cache[VAR_19][ scan8[4*VAR_28]+1 ]; if(IS_DIR(VAR_0->sub_mb_type[VAR_28], 0, VAR_19) && !IS_DIRECT(VAR_0->sub_mb_type[VAR_28])){ const int sub_mb_type= VAR_0->sub_mb_type[VAR_28]; const int block_width= (sub_mb_type & (MB_TYPE_16x16|MB_TYPE_16x8)) ? 2 : 1; for(VAR_15=0; VAR_15<VAR_16[VAR_28]; VAR_15++){ int VAR_21, VAR_22; int VAR_19, VAR_20; const int VAR_28= 4*VAR_28 + block_width*VAR_15; int16_t (* mv_cache)[2]= &VAR_0->mv_cache[VAR_19][ scan8[VAR_28] ]; int16_t (* mvd_cache)[2]= &VAR_0->mvd_cache[VAR_19][ scan8[VAR_28] ]; pred_motion(VAR_0, VAR_28, block_width, VAR_19, VAR_0->ref_cache[VAR_19][ scan8[VAR_28] ], &VAR_21, &VAR_22); VAR_19 = VAR_21 + decode_cabac_mb_mvd( VAR_0, VAR_19, VAR_28, 0 ); VAR_20 = VAR_22 + decode_cabac_mb_mvd( VAR_0, VAR_19, VAR_28, 1 ); tprintf("final mv:%d %d\n", VAR_19, VAR_20); if(IS_SUB_8X8(sub_mb_type)){ mv_cache[ 1 ][0]= mv_cache[ 8 ][0]= mv_cache[ 9 ][0]= VAR_19; mv_cache[ 1 ][1]= mv_cache[ 8 ][1]= mv_cache[ 9 ][1]= VAR_20; mvd_cache[ 1 ][0]= mvd_cache[ 8 ][0]= mvd_cache[ 9 ][0]= VAR_19 - VAR_21; mvd_cache[ 1 ][1]= mvd_cache[ 8 ][1]= mvd_cache[ 9 ][1]= VAR_20 - VAR_22; }else if(IS_SUB_8X4(sub_mb_type)){ mv_cache[ 1 ][0]= VAR_19; mv_cache[ 1 ][1]= VAR_20; mvd_cache[ 1 ][0]= VAR_19 - VAR_21; mvd_cache[ 1 ][1]= VAR_20 - VAR_22; }else if(IS_SUB_4X8(sub_mb_type)){ mv_cache[ 8 ][0]= VAR_19; mv_cache[ 8 ][1]= VAR_20; mvd_cache[ 8 ][0]= VAR_19 - VAR_21; mvd_cache[ 8 ][1]= VAR_20 - VAR_22; } mv_cache[ 0 ][0]= VAR_19; mv_cache[ 0 ][1]= VAR_20; mvd_cache[ 0 ][0]= VAR_19 - VAR_21; mvd_cache[ 0 ][1]= VAR_20 - VAR_22; } }else{ uint32_t *p= (uint32_t *)&VAR_0->mv_cache[VAR_19][ scan8[4*VAR_28] ][0]; uint32_t *pd= (uint32_t *)&VAR_0->mvd_cache[VAR_19][ scan8[4*VAR_28] ][0]; p[0] = p[1] = p[8] = p[9] = 0; pd[0]= pd[1]= pd[8]= pd[9]= 0; } } } } else if( IS_DIRECT(VAR_2) ) { pred_direct_motion(VAR_0, &VAR_2); fill_rectangle(VAR_0->mvd_cache[0][scan8[0]], 4, 4, 8, 0, 4); fill_rectangle(VAR_0->mvd_cache[1][scan8[0]], 4, 4, 8, 0, 4); VAR_5 &= VAR_0->sps.direct_8x8_inference_flag; } else { int VAR_19, VAR_19, VAR_20, VAR_28, VAR_21, VAR_22; if(IS_16X16(VAR_2)){ for(VAR_19=0; VAR_19<2; VAR_19++){ if(IS_DIR(VAR_2, 0, VAR_19)){ if(VAR_0->ref_count[VAR_19] > 0 ){ const int VAR_23 = VAR_0->ref_count[VAR_19] > 1 ? decode_cabac_mb_ref( VAR_0, VAR_19, 0 ) : 0; fill_rectangle(&VAR_0->ref_cache[VAR_19][ scan8[0] ], 4, 4, 8, VAR_23, 1); } }else fill_rectangle(&VAR_0->ref_cache[VAR_19][ scan8[0] ], 4, 4, 8, (uint8_t)LIST_NOT_USED, 1); } for(VAR_19=0; VAR_19<2; VAR_19++){ if(IS_DIR(VAR_2, 0, VAR_19)){ pred_motion(VAR_0, 0, 4, VAR_19, VAR_0->ref_cache[VAR_19][ scan8[0] ], &VAR_21, &VAR_22); VAR_19 = VAR_21 + decode_cabac_mb_mvd( VAR_0, VAR_19, 0, 0 ); VAR_20 = VAR_22 + decode_cabac_mb_mvd( VAR_0, VAR_19, 0, 1 ); tprintf("final mv:%d %d\n", VAR_19, VAR_20); fill_rectangle(VAR_0->mvd_cache[VAR_19][ scan8[0] ], 4, 4, 8, pack16to32(VAR_19-VAR_21,VAR_20-VAR_22), 4); fill_rectangle(VAR_0->mv_cache[VAR_19][ scan8[0] ], 4, 4, 8, pack16to32(VAR_19,VAR_20), 4); }else fill_rectangle(VAR_0->mv_cache[VAR_19][ scan8[0] ], 4, 4, 8, 0, 4); } } else if(IS_16X8(VAR_2)){ for(VAR_19=0; VAR_19<VAR_0->list_count; VAR_19++){ for(VAR_28=0; VAR_28<2; VAR_28++){ if(IS_DIR(VAR_2, VAR_28, VAR_19)){ const int VAR_23= VAR_0->ref_count[VAR_19] > 1 ? decode_cabac_mb_ref( VAR_0, VAR_19, 8*VAR_28 ) : 0; fill_rectangle(&VAR_0->ref_cache[VAR_19][ scan8[0] + 16*VAR_28 ], 4, 2, 8, VAR_23, 1); }else fill_rectangle(&VAR_0->ref_cache[VAR_19][ scan8[0] + 16*VAR_28 ], 4, 2, 8, (LIST_NOT_USED&0xFF), 1); } } for(VAR_19=0; VAR_19<VAR_0->list_count; VAR_19++){ for(VAR_28=0; VAR_28<2; VAR_28++){ if(IS_DIR(VAR_2, VAR_28, VAR_19)){ pred_16x8_motion(VAR_0, 8*VAR_28, VAR_19, VAR_0->ref_cache[VAR_19][scan8[0] + 16*VAR_28], &VAR_21, &VAR_22); VAR_19 = VAR_21 + decode_cabac_mb_mvd( VAR_0, VAR_19, 8*VAR_28, 0 ); VAR_20 = VAR_22 + decode_cabac_mb_mvd( VAR_0, VAR_19, 8*VAR_28, 1 ); tprintf("final mv:%d %d\n", VAR_19, VAR_20); fill_rectangle(VAR_0->mvd_cache[VAR_19][ scan8[0] + 16*VAR_28 ], 4, 2, 8, pack16to32(VAR_19-VAR_21,VAR_20-VAR_22), 4); fill_rectangle(VAR_0->mv_cache[VAR_19][ scan8[0] + 16*VAR_28 ], 4, 2, 8, pack16to32(VAR_19,VAR_20), 4); }else{ fill_rectangle(VAR_0->mvd_cache[VAR_19][ scan8[0] + 16*VAR_28 ], 4, 2, 8, 0, 4); fill_rectangle(VAR_0-> mv_cache[VAR_19][ scan8[0] + 16*VAR_28 ], 4, 2, 8, 0, 4); } } } }else{ assert(IS_8X16(VAR_2)); for(VAR_19=0; VAR_19<VAR_0->list_count; VAR_19++){ for(VAR_28=0; VAR_28<2; VAR_28++){ if(IS_DIR(VAR_2, VAR_28, VAR_19)){ const int VAR_23= VAR_0->ref_count[VAR_19] > 1 ? decode_cabac_mb_ref( VAR_0, VAR_19, 4*VAR_28 ) : 0; fill_rectangle(&VAR_0->ref_cache[VAR_19][ scan8[0] + 2*VAR_28 ], 2, 4, 8, VAR_23, 1); }else fill_rectangle(&VAR_0->ref_cache[VAR_19][ scan8[0] + 2*VAR_28 ], 2, 4, 8, (LIST_NOT_USED&0xFF), 1); } } for(VAR_19=0; VAR_19<VAR_0->list_count; VAR_19++){ for(VAR_28=0; VAR_28<2; VAR_28++){ if(IS_DIR(VAR_2, VAR_28, VAR_19)){ pred_8x16_motion(VAR_0, VAR_28*4, VAR_19, VAR_0->ref_cache[VAR_19][ scan8[0] + 2*VAR_28 ], &VAR_21, &VAR_22); VAR_19 = VAR_21 + decode_cabac_mb_mvd( VAR_0, VAR_19, 4*VAR_28, 0 ); VAR_20 = VAR_22 + decode_cabac_mb_mvd( VAR_0, VAR_19, 4*VAR_28, 1 ); tprintf("final mv:%d %d\n", VAR_19, VAR_20); fill_rectangle(VAR_0->mvd_cache[VAR_19][ scan8[0] + 2*VAR_28 ], 2, 4, 8, pack16to32(VAR_19-VAR_21,VAR_20-VAR_22), 4); fill_rectangle(VAR_0->mv_cache[VAR_19][ scan8[0] + 2*VAR_28 ], 2, 4, 8, pack16to32(VAR_19,VAR_20), 4); }else{ fill_rectangle(VAR_0->mvd_cache[VAR_19][ scan8[0] + 2*VAR_28 ], 2, 4, 8, 0, 4); fill_rectangle(VAR_0-> mv_cache[VAR_19][ scan8[0] + 2*VAR_28 ], 2, 4, 8, 0, 4); } } } } } if( IS_INTER( VAR_2 ) ) { VAR_0->chroma_pred_mode_table[VAR_1] = 0; write_back_motion( VAR_0, VAR_2 ); } if( !IS_INTRA16x16( VAR_2 ) ) { VAR_4 = decode_cabac_mb_cbp_luma( VAR_0 ); VAR_4 |= decode_cabac_mb_cbp_chroma( VAR_0 ) << 4; } VAR_0->cbp_table[VAR_1] = VAR_0->VAR_4 = VAR_4; if( VAR_5 && (VAR_4&15) && !IS_INTRA( VAR_2 ) ) { if( decode_cabac_mb_transform_size( VAR_0 ) ) VAR_2 |= MB_TYPE_8x8DCT; } s->current_picture.VAR_2[VAR_1]= VAR_2; if( VAR_4 || IS_INTRA16x16( VAR_2 ) ) { const uint8_t *VAR_23, *scan8x8, *dc_scan; int VAR_24; if(IS_INTERLACED(VAR_2)){ scan8x8= s->qscale ? VAR_0->field_scan8x8 : VAR_0->field_scan8x8_q0; VAR_23= s->qscale ? VAR_0->field_scan : VAR_0->field_scan_q0; dc_scan= luma_dc_field_scan; }else{ scan8x8= s->qscale ? VAR_0->zigzag_scan8x8 : VAR_0->zigzag_scan8x8_q0; VAR_23= s->qscale ? VAR_0->zigzag_scan : VAR_0->zigzag_scan_q0; dc_scan= luma_dc_zigzag_scan; } VAR_0->last_qscale_diff = VAR_24 = decode_cabac_mb_dqp( VAR_0 ); if( VAR_24 == INT_MIN ){ av_log(VAR_0->s.avctx, AV_LOG_ERROR, "cabac decode of qscale diff failed at %d %d\n", s->mb_x, s->mb_y); return -1; } s->qscale += VAR_24; if(((unsigned)s->qscale) > 51){ if(s->qscale<0) s->qscale+= 52; else s->qscale-= 52; } VAR_0->chroma_qp = get_chroma_qp(VAR_0->pps.chroma_qp_index_offset, s->qscale); if( IS_INTRA16x16( VAR_2 ) ) { int VAR_28; if( decode_cabac_residual( VAR_0, VAR_0->mb, 0, 0, dc_scan, NULL, 16) < 0) return -1; if( VAR_4&15 ) { for( VAR_28 = 0; VAR_28 < 16; VAR_28++ ) { if( decode_cabac_residual(VAR_0, VAR_0->mb + 16*VAR_28, 1, VAR_28, VAR_23 + 1, VAR_0->dequant4_coeff[0][s->qscale], 15) < 0 ) return -1; } } else { fill_rectangle(&VAR_0->non_zero_count_cache[scan8[0]], 4, 4, 8, 0, 1); } } else { int VAR_25, VAR_26; for( VAR_25 = 0; VAR_25 < 4; VAR_25++ ) { if( VAR_4 & (1<<VAR_25) ) { if( IS_8x8DCT(VAR_2) ) { if( decode_cabac_residual(VAR_0, VAR_0->mb + 64*VAR_25, 5, 4*VAR_25, scan8x8, VAR_0->dequant8_coeff[IS_INTRA( VAR_2 ) ? 0:1][s->qscale], 64) < 0 ) return -1; } else for( VAR_26 = 0; VAR_26 < 4; VAR_26++ ) { const int VAR_28 = 4*VAR_25 + VAR_26; if( decode_cabac_residual(VAR_0, VAR_0->mb + 16*VAR_28, 2, VAR_28, VAR_23, VAR_0->dequant4_coeff[IS_INTRA( VAR_2 ) ? 0:3][s->qscale], 16) < 0 ) return -1; } } else { uint8_t * const nnz= &VAR_0->non_zero_count_cache[ scan8[4*VAR_25] ]; nnz[0] = nnz[1] = nnz[8] = nnz[9] = 0; } } } if( VAR_4&0x30 ){ int VAR_28; for( VAR_28 = 0; VAR_28 < 2; VAR_28++ ) { if( decode_cabac_residual(VAR_0, VAR_0->mb + 256 + 16*4*VAR_28, 3, VAR_28, chroma_dc_scan, NULL, 4) < 0) return -1; } } if( VAR_4&0x20 ) { int VAR_28, VAR_28; for( VAR_28 = 0; VAR_28 < 2; VAR_28++ ) { for( VAR_28 = 0; VAR_28 < 4; VAR_28++ ) { const int VAR_28 = 16 + 4 * VAR_28 + VAR_28; if( decode_cabac_residual(VAR_0, VAR_0->mb + 16*VAR_28, 4, VAR_28 - 16, VAR_23 + 1, VAR_0->dequant4_coeff[VAR_28+1+(IS_INTRA( VAR_2 ) ? 0:3)][VAR_0->chroma_qp], 15) < 0) return -1; } } } else { uint8_t * const nnz= &VAR_0->non_zero_count_cache[0]; nnz[ scan8[16]+0 ] = nnz[ scan8[16]+1 ] =nnz[ scan8[16]+8 ] =nnz[ scan8[16]+9 ] = nnz[ scan8[20]+0 ] = nnz[ scan8[20]+1 ] =nnz[ scan8[20]+8 ] =nnz[ scan8[20]+9 ] = 0; } } else { uint8_t * const nnz= &VAR_0->non_zero_count_cache[0]; fill_rectangle(&nnz[scan8[0]], 4, 4, 8, 0, 1); nnz[ scan8[16]+0 ] = nnz[ scan8[16]+1 ] =nnz[ scan8[16]+8 ] =nnz[ scan8[16]+9 ] = nnz[ scan8[20]+0 ] = nnz[ scan8[20]+1 ] =nnz[ scan8[20]+8 ] =nnz[ scan8[20]+9 ] = 0; VAR_0->last_qscale_diff = 0; } s->current_picture.qscale_table[VAR_1]= s->qscale; write_back_non_zero_count(VAR_0); if(MB_MBAFF){ VAR_0->ref_count[0] >>= 1; VAR_0->ref_count[1] >>= 1; } return 0; }
[ "static int FUNC_0(H264Context *VAR_0) {", "MpegEncContext * const s = &VAR_0->s;", "const int VAR_1= s->mb_x + s->mb_y*s->mb_stride;", "int VAR_2, VAR_3, VAR_4 = 0;", "int VAR_5= VAR_0->pps.transform_8x8_mode;", "s->dsp.clear_blocks(VAR_0->mb);", "tprintf(\"pic:%d mb:%d/%d\\n\", VAR_0->frame_num, s->mb_x, s->mb_y);", "if( VAR_0->slice_type != I_TYPE && VAR_0->slice_type != SI_TYPE ) {", "int VAR_6;", "if( FRAME_MBAFF && s->mb_x==0 && (s->mb_y&1)==0 )\npredict_field_decoding_flag(VAR_0);", "if( FRAME_MBAFF && (s->mb_y&1)==1 && VAR_0->prev_mb_skipped )\nVAR_6 = VAR_0->next_mb_skipped;", "else\nVAR_6 = decode_cabac_mb_skip( VAR_0, s->mb_x, s->mb_y );", "if( VAR_6 ) {", "if( FRAME_MBAFF && (s->mb_y&1)==0 ){", "s->current_picture.VAR_2[VAR_1] = MB_TYPE_SKIP;", "VAR_0->next_mb_skipped = decode_cabac_mb_skip( VAR_0, s->mb_x, s->mb_y+1 );", "if(VAR_0->next_mb_skipped)\npredict_field_decoding_flag(VAR_0);", "else\nVAR_0->mb_mbaff = VAR_0->mb_field_decoding_flag = decode_cabac_field_decoding_flag(VAR_0);", "}", "decode_mb_skip(VAR_0);", "VAR_0->cbp_table[VAR_1] = 0;", "VAR_0->chroma_pred_mode_table[VAR_1] = 0;", "VAR_0->last_qscale_diff = 0;", "return 0;", "}", "}", "if(FRAME_MBAFF){", "if( (s->mb_y&1) == 0 )\nVAR_0->mb_mbaff =\nVAR_0->mb_field_decoding_flag = decode_cabac_field_decoding_flag(VAR_0);", "}else", "VAR_0->mb_field_decoding_flag= (s->picture_structure!=PICT_FRAME);", "VAR_0->prev_mb_skipped = 0;", "compute_mb_neighbors(VAR_0);", "if( ( VAR_2 = decode_cabac_mb_type( VAR_0 ) ) < 0 ) {", "av_log( VAR_0->s.avctx, AV_LOG_ERROR, \"decode_cabac_mb_type failed\\n\" );", "return -1;", "}", "if( VAR_0->slice_type == B_TYPE ) {", "if( VAR_2 < 23 ){", "VAR_3= b_mb_type_info[VAR_2].VAR_3;", "VAR_2= b_mb_type_info[VAR_2].type;", "}else{", "VAR_2 -= 23;", "goto decode_intra_mb;", "}", "} else if( VAR_0->slice_type == P_TYPE ) {", "if( VAR_2 < 5) {", "VAR_3= p_mb_type_info[VAR_2].VAR_3;", "VAR_2= p_mb_type_info[VAR_2].type;", "} else {", "VAR_2 -= 5;", "goto decode_intra_mb;", "}", "} else {", "assert(VAR_0->slice_type == I_TYPE);", "decode_intra_mb:\nVAR_3 = 0;", "VAR_4= i_mb_type_info[VAR_2].VAR_4;", "VAR_0->intra16x16_pred_mode= i_mb_type_info[VAR_2].VAR_12;", "VAR_2= i_mb_type_info[VAR_2].type;", "}", "if(MB_FIELD)\nVAR_2 |= MB_TYPE_INTERLACED;", "VAR_0->slice_table[ VAR_1 ]= VAR_0->slice_num;", "if(IS_INTRA_PCM(VAR_2)) {", "const uint8_t *VAR_7;", "unsigned int VAR_8, VAR_9;", "VAR_7= VAR_0->cabac.bytestream;", "if(VAR_0->cabac.low&0x1) VAR_7--;", "if(CABAC_BITS==16){", "if(VAR_0->cabac.low&0x1FF) VAR_7--;", "}", "for(VAR_9=0; VAR_9<16; VAR_9++){", "const int VAR_28= 4*(VAR_9&3) + 32*((VAR_9>>2)&1) + 128*(VAR_9>>3);", "for(VAR_8=0; VAR_8<16; VAR_8++){", "tprintf(\"LUMA ICPM LEVEL (%3d)\\n\", *VAR_7);", "VAR_0->mb[VAR_28 + (VAR_8&3) + 16*((VAR_8>>2)&1) + 64*(VAR_8>>3)]= *VAR_7++;", "}", "}", "for(VAR_9=0; VAR_9<8; VAR_9++){", "const int VAR_28= 256 + 4*(VAR_9&3) + 32*(VAR_9>>2);", "for(VAR_8=0; VAR_8<8; VAR_8++){", "tprintf(\"CHROMA U ICPM LEVEL (%3d)\\n\", *VAR_7);", "VAR_0->mb[VAR_28 + (VAR_8&3) + 16*(VAR_8>>2)]= *VAR_7++;", "}", "}", "for(VAR_9=0; VAR_9<8; VAR_9++){", "const int VAR_28= 256 + 64 + 4*(VAR_9&3) + 32*(VAR_9>>2);", "for(VAR_8=0; VAR_8<8; VAR_8++){", "tprintf(\"CHROMA V ICPM LEVEL (%3d)\\n\", *VAR_7);", "VAR_0->mb[VAR_28 + (VAR_8&3) + 16*(VAR_8>>2)]= *VAR_7++;", "}", "}", "ff_init_cabac_decoder(&VAR_0->cabac, VAR_7, VAR_0->cabac.bytestream_end - VAR_7);", "VAR_0->cbp_table[VAR_1] = 0x1ef;", "VAR_0->chroma_pred_mode_table[VAR_1] = 0;", "s->current_picture.qscale_table[VAR_1]= 0;", "VAR_0->chroma_qp = get_chroma_qp(VAR_0->pps.chroma_qp_index_offset, 0);", "memset(VAR_0->non_zero_count[VAR_1], 16, 16);", "s->current_picture.VAR_2[VAR_1]= VAR_2;", "return 0;", "}", "if(MB_MBAFF){", "VAR_0->ref_count[0] <<= 1;", "VAR_0->ref_count[1] <<= 1;", "}", "fill_caches(VAR_0, VAR_2, 0);", "if( IS_INTRA( VAR_2 ) ) {", "int VAR_28, VAR_12;", "if( IS_INTRA4x4( VAR_2 ) ) {", "if( VAR_5 && decode_cabac_mb_transform_size( VAR_0 ) ) {", "VAR_2 |= MB_TYPE_8x8DCT;", "for( VAR_28 = 0; VAR_28 < 16; VAR_28+=4 ) {", "int VAR_15 = pred_intra_mode( VAR_0, VAR_28 );", "int VAR_14 = decode_cabac_mb_intra4x4_pred_mode( VAR_0, VAR_15 );", "fill_rectangle( &VAR_0->intra4x4_pred_mode_cache[ scan8[VAR_28] ], 2, 2, 8, VAR_14, 1 );", "}", "} else {", "for( VAR_28 = 0; VAR_28 < 16; VAR_28++ ) {", "int VAR_15 = pred_intra_mode( VAR_0, VAR_28 );", "VAR_0->intra4x4_pred_mode_cache[ scan8[VAR_28] ] = decode_cabac_mb_intra4x4_pred_mode( VAR_0, VAR_15 );", "}", "}", "write_back_intra_pred_mode(VAR_0);", "if( check_intra4x4_pred_mode(VAR_0) < 0 ) return -1;", "} else {", "VAR_0->intra16x16_pred_mode= check_intra_pred_mode( VAR_0, VAR_0->intra16x16_pred_mode );", "if( VAR_0->intra16x16_pred_mode < 0 ) return -1;", "}", "VAR_0->chroma_pred_mode_table[VAR_1] =\nVAR_12 = decode_cabac_mb_chroma_pre_mode( VAR_0 );", "VAR_12= check_intra_pred_mode( VAR_0, VAR_12 );", "if( VAR_12 < 0 ) return -1;", "VAR_0->chroma_pred_mode= VAR_12;", "} else if( VAR_3 == 4 ) {", "int VAR_28, VAR_15, VAR_16[4], VAR_19, VAR_23[2][4];", "if( VAR_0->slice_type == B_TYPE ) {", "for( VAR_28 = 0; VAR_28 < 4; VAR_28++ ) {", "VAR_0->sub_mb_type[VAR_28] = decode_cabac_b_mb_sub_type( VAR_0 );", "VAR_16[VAR_28]= b_sub_mb_type_info[ VAR_0->sub_mb_type[VAR_28] ].VAR_3;", "VAR_0->sub_mb_type[VAR_28]= b_sub_mb_type_info[ VAR_0->sub_mb_type[VAR_28] ].type;", "}", "if( IS_DIRECT(VAR_0->sub_mb_type[0] | VAR_0->sub_mb_type[1] |\nVAR_0->sub_mb_type[2] | VAR_0->sub_mb_type[3]) ) {", "pred_direct_motion(VAR_0, &VAR_2);", "if( VAR_0->ref_count[0] > 1 || VAR_0->ref_count[1] > 1 ) {", "for( VAR_28 = 0; VAR_28 < 4; VAR_28++ )", "if( IS_DIRECT(VAR_0->sub_mb_type[VAR_28]) )\nfill_rectangle( &VAR_0->direct_cache[scan8[4*VAR_28]], 2, 2, 8, 1, 1 );", "}", "}", "} else {", "for( VAR_28 = 0; VAR_28 < 4; VAR_28++ ) {", "VAR_0->sub_mb_type[VAR_28] = decode_cabac_p_mb_sub_type( VAR_0 );", "VAR_16[VAR_28]= p_sub_mb_type_info[ VAR_0->sub_mb_type[VAR_28] ].VAR_3;", "VAR_0->sub_mb_type[VAR_28]= p_sub_mb_type_info[ VAR_0->sub_mb_type[VAR_28] ].type;", "}", "}", "for( VAR_19 = 0; VAR_19 < VAR_0->list_count; VAR_19++ ) {", "for( VAR_28 = 0; VAR_28 < 4; VAR_28++ ) {", "if(IS_DIRECT(VAR_0->sub_mb_type[VAR_28])) continue;", "if(IS_DIR(VAR_0->sub_mb_type[VAR_28], 0, VAR_19)){", "if( VAR_0->ref_count[VAR_19] > 1 )\nVAR_23[VAR_19][VAR_28] = decode_cabac_mb_ref( VAR_0, VAR_19, 4*VAR_28 );", "else\nVAR_23[VAR_19][VAR_28] = 0;", "} else {", "VAR_23[VAR_19][VAR_28] = -1;", "}", "VAR_0->ref_cache[VAR_19][ scan8[4*VAR_28]+1 ]=\nVAR_0->ref_cache[VAR_19][ scan8[4*VAR_28]+8 ]=VAR_0->ref_cache[VAR_19][ scan8[4*VAR_28]+9 ]= VAR_23[VAR_19][VAR_28];", "}", "}", "if(VAR_5)\nVAR_5 = get_dct8x8_allowed(VAR_0);", "for(VAR_19=0; VAR_19<VAR_0->list_count; VAR_19++){", "for(VAR_28=0; VAR_28<4; VAR_28++){", "if(IS_DIRECT(VAR_0->sub_mb_type[VAR_28])){", "fill_rectangle(VAR_0->mvd_cache[VAR_19][scan8[4*VAR_28]], 2, 2, 8, 0, 4);", "continue;", "}", "VAR_0->ref_cache[VAR_19][ scan8[4*VAR_28] ]=VAR_0->ref_cache[VAR_19][ scan8[4*VAR_28]+1 ];", "if(IS_DIR(VAR_0->sub_mb_type[VAR_28], 0, VAR_19) && !IS_DIRECT(VAR_0->sub_mb_type[VAR_28])){", "const int sub_mb_type= VAR_0->sub_mb_type[VAR_28];", "const int block_width= (sub_mb_type & (MB_TYPE_16x16|MB_TYPE_16x8)) ? 2 : 1;", "for(VAR_15=0; VAR_15<VAR_16[VAR_28]; VAR_15++){", "int VAR_21, VAR_22;", "int VAR_19, VAR_20;", "const int VAR_28= 4*VAR_28 + block_width*VAR_15;", "int16_t (* mv_cache)[2]= &VAR_0->mv_cache[VAR_19][ scan8[VAR_28] ];", "int16_t (* mvd_cache)[2]= &VAR_0->mvd_cache[VAR_19][ scan8[VAR_28] ];", "pred_motion(VAR_0, VAR_28, block_width, VAR_19, VAR_0->ref_cache[VAR_19][ scan8[VAR_28] ], &VAR_21, &VAR_22);", "VAR_19 = VAR_21 + decode_cabac_mb_mvd( VAR_0, VAR_19, VAR_28, 0 );", "VAR_20 = VAR_22 + decode_cabac_mb_mvd( VAR_0, VAR_19, VAR_28, 1 );", "tprintf(\"final mv:%d %d\\n\", VAR_19, VAR_20);", "if(IS_SUB_8X8(sub_mb_type)){", "mv_cache[ 1 ][0]=\nmv_cache[ 8 ][0]= mv_cache[ 9 ][0]= VAR_19;", "mv_cache[ 1 ][1]=\nmv_cache[ 8 ][1]= mv_cache[ 9 ][1]= VAR_20;", "mvd_cache[ 1 ][0]=\nmvd_cache[ 8 ][0]= mvd_cache[ 9 ][0]= VAR_19 - VAR_21;", "mvd_cache[ 1 ][1]=\nmvd_cache[ 8 ][1]= mvd_cache[ 9 ][1]= VAR_20 - VAR_22;", "}else if(IS_SUB_8X4(sub_mb_type)){", "mv_cache[ 1 ][0]= VAR_19;", "mv_cache[ 1 ][1]= VAR_20;", "mvd_cache[ 1 ][0]= VAR_19 - VAR_21;", "mvd_cache[ 1 ][1]= VAR_20 - VAR_22;", "}else if(IS_SUB_4X8(sub_mb_type)){", "mv_cache[ 8 ][0]= VAR_19;", "mv_cache[ 8 ][1]= VAR_20;", "mvd_cache[ 8 ][0]= VAR_19 - VAR_21;", "mvd_cache[ 8 ][1]= VAR_20 - VAR_22;", "}", "mv_cache[ 0 ][0]= VAR_19;", "mv_cache[ 0 ][1]= VAR_20;", "mvd_cache[ 0 ][0]= VAR_19 - VAR_21;", "mvd_cache[ 0 ][1]= VAR_20 - VAR_22;", "}", "}else{", "uint32_t *p= (uint32_t *)&VAR_0->mv_cache[VAR_19][ scan8[4*VAR_28] ][0];", "uint32_t *pd= (uint32_t *)&VAR_0->mvd_cache[VAR_19][ scan8[4*VAR_28] ][0];", "p[0] = p[1] = p[8] = p[9] = 0;", "pd[0]= pd[1]= pd[8]= pd[9]= 0;", "}", "}", "}", "} else if( IS_DIRECT(VAR_2) ) {", "pred_direct_motion(VAR_0, &VAR_2);", "fill_rectangle(VAR_0->mvd_cache[0][scan8[0]], 4, 4, 8, 0, 4);", "fill_rectangle(VAR_0->mvd_cache[1][scan8[0]], 4, 4, 8, 0, 4);", "VAR_5 &= VAR_0->sps.direct_8x8_inference_flag;", "} else {", "int VAR_19, VAR_19, VAR_20, VAR_28, VAR_21, VAR_22;", "if(IS_16X16(VAR_2)){", "for(VAR_19=0; VAR_19<2; VAR_19++){", "if(IS_DIR(VAR_2, 0, VAR_19)){", "if(VAR_0->ref_count[VAR_19] > 0 ){", "const int VAR_23 = VAR_0->ref_count[VAR_19] > 1 ? decode_cabac_mb_ref( VAR_0, VAR_19, 0 ) : 0;", "fill_rectangle(&VAR_0->ref_cache[VAR_19][ scan8[0] ], 4, 4, 8, VAR_23, 1);", "}", "}else", "fill_rectangle(&VAR_0->ref_cache[VAR_19][ scan8[0] ], 4, 4, 8, (uint8_t)LIST_NOT_USED, 1);", "}", "for(VAR_19=0; VAR_19<2; VAR_19++){", "if(IS_DIR(VAR_2, 0, VAR_19)){", "pred_motion(VAR_0, 0, 4, VAR_19, VAR_0->ref_cache[VAR_19][ scan8[0] ], &VAR_21, &VAR_22);", "VAR_19 = VAR_21 + decode_cabac_mb_mvd( VAR_0, VAR_19, 0, 0 );", "VAR_20 = VAR_22 + decode_cabac_mb_mvd( VAR_0, VAR_19, 0, 1 );", "tprintf(\"final mv:%d %d\\n\", VAR_19, VAR_20);", "fill_rectangle(VAR_0->mvd_cache[VAR_19][ scan8[0] ], 4, 4, 8, pack16to32(VAR_19-VAR_21,VAR_20-VAR_22), 4);", "fill_rectangle(VAR_0->mv_cache[VAR_19][ scan8[0] ], 4, 4, 8, pack16to32(VAR_19,VAR_20), 4);", "}else", "fill_rectangle(VAR_0->mv_cache[VAR_19][ scan8[0] ], 4, 4, 8, 0, 4);", "}", "}", "else if(IS_16X8(VAR_2)){", "for(VAR_19=0; VAR_19<VAR_0->list_count; VAR_19++){", "for(VAR_28=0; VAR_28<2; VAR_28++){", "if(IS_DIR(VAR_2, VAR_28, VAR_19)){", "const int VAR_23= VAR_0->ref_count[VAR_19] > 1 ? decode_cabac_mb_ref( VAR_0, VAR_19, 8*VAR_28 ) : 0;", "fill_rectangle(&VAR_0->ref_cache[VAR_19][ scan8[0] + 16*VAR_28 ], 4, 2, 8, VAR_23, 1);", "}else", "fill_rectangle(&VAR_0->ref_cache[VAR_19][ scan8[0] + 16*VAR_28 ], 4, 2, 8, (LIST_NOT_USED&0xFF), 1);", "}", "}", "for(VAR_19=0; VAR_19<VAR_0->list_count; VAR_19++){", "for(VAR_28=0; VAR_28<2; VAR_28++){", "if(IS_DIR(VAR_2, VAR_28, VAR_19)){", "pred_16x8_motion(VAR_0, 8*VAR_28, VAR_19, VAR_0->ref_cache[VAR_19][scan8[0] + 16*VAR_28], &VAR_21, &VAR_22);", "VAR_19 = VAR_21 + decode_cabac_mb_mvd( VAR_0, VAR_19, 8*VAR_28, 0 );", "VAR_20 = VAR_22 + decode_cabac_mb_mvd( VAR_0, VAR_19, 8*VAR_28, 1 );", "tprintf(\"final mv:%d %d\\n\", VAR_19, VAR_20);", "fill_rectangle(VAR_0->mvd_cache[VAR_19][ scan8[0] + 16*VAR_28 ], 4, 2, 8, pack16to32(VAR_19-VAR_21,VAR_20-VAR_22), 4);", "fill_rectangle(VAR_0->mv_cache[VAR_19][ scan8[0] + 16*VAR_28 ], 4, 2, 8, pack16to32(VAR_19,VAR_20), 4);", "}else{", "fill_rectangle(VAR_0->mvd_cache[VAR_19][ scan8[0] + 16*VAR_28 ], 4, 2, 8, 0, 4);", "fill_rectangle(VAR_0-> mv_cache[VAR_19][ scan8[0] + 16*VAR_28 ], 4, 2, 8, 0, 4);", "}", "}", "}", "}else{", "assert(IS_8X16(VAR_2));", "for(VAR_19=0; VAR_19<VAR_0->list_count; VAR_19++){", "for(VAR_28=0; VAR_28<2; VAR_28++){", "if(IS_DIR(VAR_2, VAR_28, VAR_19)){", "const int VAR_23= VAR_0->ref_count[VAR_19] > 1 ? decode_cabac_mb_ref( VAR_0, VAR_19, 4*VAR_28 ) : 0;", "fill_rectangle(&VAR_0->ref_cache[VAR_19][ scan8[0] + 2*VAR_28 ], 2, 4, 8, VAR_23, 1);", "}else", "fill_rectangle(&VAR_0->ref_cache[VAR_19][ scan8[0] + 2*VAR_28 ], 2, 4, 8, (LIST_NOT_USED&0xFF), 1);", "}", "}", "for(VAR_19=0; VAR_19<VAR_0->list_count; VAR_19++){", "for(VAR_28=0; VAR_28<2; VAR_28++){", "if(IS_DIR(VAR_2, VAR_28, VAR_19)){", "pred_8x16_motion(VAR_0, VAR_28*4, VAR_19, VAR_0->ref_cache[VAR_19][ scan8[0] + 2*VAR_28 ], &VAR_21, &VAR_22);", "VAR_19 = VAR_21 + decode_cabac_mb_mvd( VAR_0, VAR_19, 4*VAR_28, 0 );", "VAR_20 = VAR_22 + decode_cabac_mb_mvd( VAR_0, VAR_19, 4*VAR_28, 1 );", "tprintf(\"final mv:%d %d\\n\", VAR_19, VAR_20);", "fill_rectangle(VAR_0->mvd_cache[VAR_19][ scan8[0] + 2*VAR_28 ], 2, 4, 8, pack16to32(VAR_19-VAR_21,VAR_20-VAR_22), 4);", "fill_rectangle(VAR_0->mv_cache[VAR_19][ scan8[0] + 2*VAR_28 ], 2, 4, 8, pack16to32(VAR_19,VAR_20), 4);", "}else{", "fill_rectangle(VAR_0->mvd_cache[VAR_19][ scan8[0] + 2*VAR_28 ], 2, 4, 8, 0, 4);", "fill_rectangle(VAR_0-> mv_cache[VAR_19][ scan8[0] + 2*VAR_28 ], 2, 4, 8, 0, 4);", "}", "}", "}", "}", "}", "if( IS_INTER( VAR_2 ) ) {", "VAR_0->chroma_pred_mode_table[VAR_1] = 0;", "write_back_motion( VAR_0, VAR_2 );", "}", "if( !IS_INTRA16x16( VAR_2 ) ) {", "VAR_4 = decode_cabac_mb_cbp_luma( VAR_0 );", "VAR_4 |= decode_cabac_mb_cbp_chroma( VAR_0 ) << 4;", "}", "VAR_0->cbp_table[VAR_1] = VAR_0->VAR_4 = VAR_4;", "if( VAR_5 && (VAR_4&15) && !IS_INTRA( VAR_2 ) ) {", "if( decode_cabac_mb_transform_size( VAR_0 ) )\nVAR_2 |= MB_TYPE_8x8DCT;", "}", "s->current_picture.VAR_2[VAR_1]= VAR_2;", "if( VAR_4 || IS_INTRA16x16( VAR_2 ) ) {", "const uint8_t *VAR_23, *scan8x8, *dc_scan;", "int VAR_24;", "if(IS_INTERLACED(VAR_2)){", "scan8x8= s->qscale ? VAR_0->field_scan8x8 : VAR_0->field_scan8x8_q0;", "VAR_23= s->qscale ? VAR_0->field_scan : VAR_0->field_scan_q0;", "dc_scan= luma_dc_field_scan;", "}else{", "scan8x8= s->qscale ? VAR_0->zigzag_scan8x8 : VAR_0->zigzag_scan8x8_q0;", "VAR_23= s->qscale ? VAR_0->zigzag_scan : VAR_0->zigzag_scan_q0;", "dc_scan= luma_dc_zigzag_scan;", "}", "VAR_0->last_qscale_diff = VAR_24 = decode_cabac_mb_dqp( VAR_0 );", "if( VAR_24 == INT_MIN ){", "av_log(VAR_0->s.avctx, AV_LOG_ERROR, \"cabac decode of qscale diff failed at %d %d\\n\", s->mb_x, s->mb_y);", "return -1;", "}", "s->qscale += VAR_24;", "if(((unsigned)s->qscale) > 51){", "if(s->qscale<0) s->qscale+= 52;", "else s->qscale-= 52;", "}", "VAR_0->chroma_qp = get_chroma_qp(VAR_0->pps.chroma_qp_index_offset, s->qscale);", "if( IS_INTRA16x16( VAR_2 ) ) {", "int VAR_28;", "if( decode_cabac_residual( VAR_0, VAR_0->mb, 0, 0, dc_scan, NULL, 16) < 0)\nreturn -1;", "if( VAR_4&15 ) {", "for( VAR_28 = 0; VAR_28 < 16; VAR_28++ ) {", "if( decode_cabac_residual(VAR_0, VAR_0->mb + 16*VAR_28, 1, VAR_28, VAR_23 + 1, VAR_0->dequant4_coeff[0][s->qscale], 15) < 0 )\nreturn -1;", "}", "} else {", "fill_rectangle(&VAR_0->non_zero_count_cache[scan8[0]], 4, 4, 8, 0, 1);", "}", "} else {", "int VAR_25, VAR_26;", "for( VAR_25 = 0; VAR_25 < 4; VAR_25++ ) {", "if( VAR_4 & (1<<VAR_25) ) {", "if( IS_8x8DCT(VAR_2) ) {", "if( decode_cabac_residual(VAR_0, VAR_0->mb + 64*VAR_25, 5, 4*VAR_25,\nscan8x8, VAR_0->dequant8_coeff[IS_INTRA( VAR_2 ) ? 0:1][s->qscale], 64) < 0 )\nreturn -1;", "} else", "for( VAR_26 = 0; VAR_26 < 4; VAR_26++ ) {", "const int VAR_28 = 4*VAR_25 + VAR_26;", "if( decode_cabac_residual(VAR_0, VAR_0->mb + 16*VAR_28, 2, VAR_28, VAR_23, VAR_0->dequant4_coeff[IS_INTRA( VAR_2 ) ? 0:3][s->qscale], 16) < 0 )\nreturn -1;", "}", "} else {", "uint8_t * const nnz= &VAR_0->non_zero_count_cache[ scan8[4*VAR_25] ];", "nnz[0] = nnz[1] = nnz[8] = nnz[9] = 0;", "}", "}", "}", "if( VAR_4&0x30 ){", "int VAR_28;", "for( VAR_28 = 0; VAR_28 < 2; VAR_28++ ) {", "if( decode_cabac_residual(VAR_0, VAR_0->mb + 256 + 16*4*VAR_28, 3, VAR_28, chroma_dc_scan, NULL, 4) < 0)\nreturn -1;", "}", "}", "if( VAR_4&0x20 ) {", "int VAR_28, VAR_28;", "for( VAR_28 = 0; VAR_28 < 2; VAR_28++ ) {", "for( VAR_28 = 0; VAR_28 < 4; VAR_28++ ) {", "const int VAR_28 = 16 + 4 * VAR_28 + VAR_28;", "if( decode_cabac_residual(VAR_0, VAR_0->mb + 16*VAR_28, 4, VAR_28 - 16, VAR_23 + 1, VAR_0->dequant4_coeff[VAR_28+1+(IS_INTRA( VAR_2 ) ? 0:3)][VAR_0->chroma_qp], 15) < 0)\nreturn -1;", "}", "}", "} else {", "uint8_t * const nnz= &VAR_0->non_zero_count_cache[0];", "nnz[ scan8[16]+0 ] = nnz[ scan8[16]+1 ] =nnz[ scan8[16]+8 ] =nnz[ scan8[16]+9 ] =\nnnz[ scan8[20]+0 ] = nnz[ scan8[20]+1 ] =nnz[ scan8[20]+8 ] =nnz[ scan8[20]+9 ] = 0;", "}", "} else {", "uint8_t * const nnz= &VAR_0->non_zero_count_cache[0];", "fill_rectangle(&nnz[scan8[0]], 4, 4, 8, 0, 1);", "nnz[ scan8[16]+0 ] = nnz[ scan8[16]+1 ] =nnz[ scan8[16]+8 ] =nnz[ scan8[16]+9 ] =\nnnz[ scan8[20]+0 ] = nnz[ scan8[20]+1 ] =nnz[ scan8[20]+8 ] =nnz[ scan8[20]+9 ] = 0;", "VAR_0->last_qscale_diff = 0;", "}", "s->current_picture.qscale_table[VAR_1]= s->qscale;", "write_back_non_zero_count(VAR_0);", "if(MB_MBAFF){", "VAR_0->ref_count[0] >>= 1;", "VAR_0->ref_count[1] >>= 1;", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 25, 27 ], [ 29, 31 ], [ 33, 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47, 49 ], [ 51, 53 ], [ 55 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 75 ], [ 77 ], [ 79 ], [ 81, 83, 85 ], [ 87 ], [ 89 ], [ 93 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 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 ], [ 163 ], [ 167 ], [ 169 ], [ 171 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 239 ], [ 245 ], [ 247 ], [ 251 ], [ 253 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 277 ], [ 281 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ], [ 291 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305 ], [ 307 ], [ 313 ], [ 315 ], [ 317 ], [ 319 ], [ 321 ], [ 323 ], [ 325 ], [ 327 ], [ 329, 331 ], [ 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 ], [ 393 ], [ 395 ], [ 397 ], [ 399 ], [ 401, 403 ], [ 405, 407 ], [ 409 ], [ 411 ], [ 413 ], [ 415, 417 ], [ 419 ], [ 421 ], [ 425, 427 ], [ 431 ], [ 433 ], [ 435 ], [ 437 ], [ 439 ], [ 441 ], [ 443 ], [ 447 ], [ 449 ], [ 451 ], [ 453 ], [ 455 ], [ 457 ], [ 459 ], [ 461 ], [ 463 ], [ 465 ], [ 469 ], [ 471 ], [ 473 ], [ 477 ], [ 479, 481 ], [ 483, 485 ], [ 489, 491 ], [ 493, 495 ], [ 497 ], [ 499 ], [ 501 ], [ 505 ], [ 507 ], [ 509 ], [ 511 ], [ 513 ], [ 517 ], [ 519 ], [ 521 ], [ 523 ], [ 525 ], [ 529 ], [ 531 ], [ 533 ], [ 535 ], [ 537 ], [ 539 ], [ 541 ], [ 543 ], [ 545 ], [ 547 ], [ 549 ], [ 551 ], [ 553 ], [ 555 ], [ 557 ], [ 559 ], [ 561 ], [ 563 ], [ 565 ], [ 567 ], [ 569 ], [ 571 ], [ 573 ], [ 575 ], [ 577 ], [ 579 ], [ 581 ], [ 583 ], [ 585 ], [ 587 ], [ 589 ], [ 593 ], [ 595 ], [ 597 ], [ 601 ], [ 603 ], [ 605 ], [ 607 ], [ 609 ], [ 611 ], [ 613 ], [ 615 ], [ 617 ], [ 619 ], [ 621 ], [ 623 ], [ 625 ], [ 627 ], [ 629 ], [ 631 ], [ 633 ], [ 635 ], [ 637 ], [ 639 ], [ 641 ], [ 643 ], [ 645 ], [ 649 ], [ 651 ], [ 653 ], [ 655 ], [ 657 ], [ 659 ], [ 661 ], [ 663 ], [ 665 ], [ 667 ], [ 669 ], [ 671 ], [ 673 ], [ 675 ], [ 677 ], [ 679 ], [ 681 ], [ 683 ], [ 685 ], [ 687 ], [ 689 ], [ 691 ], [ 693 ], [ 695 ], [ 697 ], [ 701 ], [ 703 ], [ 705 ], [ 707 ], [ 709 ], [ 711 ], [ 713 ], [ 715 ], [ 717 ], [ 719 ], [ 721 ], [ 725 ], [ 727 ], [ 729 ], [ 731 ], [ 735 ], [ 737 ], [ 739 ], [ 741 ], [ 745 ], [ 749 ], [ 751, 753 ], [ 755 ], [ 757 ], [ 761 ], [ 763 ], [ 765 ], [ 769 ], [ 771 ], [ 773 ], [ 775 ], [ 777 ], [ 779 ], [ 781 ], [ 783 ], [ 785 ], [ 789 ], [ 791 ], [ 793 ], [ 795 ], [ 797 ], [ 799 ], [ 801 ], [ 803 ], [ 805 ], [ 807 ], [ 809 ], [ 813 ], [ 815 ], [ 819, 821 ], [ 823 ], [ 825 ], [ 829, 831 ], [ 833 ], [ 835 ], [ 837 ], [ 839 ], [ 841 ], [ 843 ], [ 845 ], [ 847 ], [ 849 ], [ 851, 853, 855 ], [ 857 ], [ 859 ], [ 861 ], [ 867, 869 ], [ 873 ], [ 875 ], [ 877 ], [ 879 ], [ 881 ], [ 883 ], [ 885 ], [ 889 ], [ 891 ], [ 893 ], [ 897, 899 ], [ 901 ], [ 903 ], [ 907 ], [ 909 ], [ 911 ], [ 913 ], [ 915 ], [ 919, 921 ], [ 923 ], [ 925 ], [ 927 ], [ 929 ], [ 931, 933 ], [ 935 ], [ 937 ], [ 939 ], [ 941 ], [ 943, 945 ], [ 947 ], [ 949 ], [ 953 ], [ 955 ], [ 959 ], [ 961 ], [ 963 ], [ 965 ], [ 969 ], [ 971 ] ]
11,130
static inline int get_phys_addr(CPUState *env, uint32_t address, int access_type, int is_user, uint32_t *phys_ptr, int *prot) { /* Fast Context Switch Extension. */ if (address < 0x02000000) address += env->cp15.c13_fcse; if ((env->cp15.c1_sys & 1) == 0) { /* MMU/MPU disabled. */ *phys_ptr = address; *prot = PAGE_READ | PAGE_WRITE; return 0; } else if (arm_feature(env, ARM_FEATURE_MPU)) { return get_phys_addr_mpu(env, address, access_type, is_user, phys_ptr, prot); } else if (env->cp15.c1_sys & (1 << 23)) { return get_phys_addr_v6(env, address, access_type, is_user, phys_ptr, prot); } else { return get_phys_addr_v5(env, address, access_type, is_user, phys_ptr, prot); } }
false
qemu
d4c430a80f000d722bb70287af4d4c184a8d7006
static inline int get_phys_addr(CPUState *env, uint32_t address, int access_type, int is_user, uint32_t *phys_ptr, int *prot) { if (address < 0x02000000) address += env->cp15.c13_fcse; if ((env->cp15.c1_sys & 1) == 0) { *phys_ptr = address; *prot = PAGE_READ | PAGE_WRITE; return 0; } else if (arm_feature(env, ARM_FEATURE_MPU)) { return get_phys_addr_mpu(env, address, access_type, is_user, phys_ptr, prot); } else if (env->cp15.c1_sys & (1 << 23)) { return get_phys_addr_v6(env, address, access_type, is_user, phys_ptr, prot); } else { return get_phys_addr_v5(env, address, access_type, is_user, phys_ptr, prot); } }
{ "code": [], "line_no": [] }
static inline int FUNC_0(CPUState *VAR_0, uint32_t VAR_1, int VAR_2, int VAR_3, uint32_t *VAR_4, int *VAR_5) { if (VAR_1 < 0x02000000) VAR_1 += VAR_0->cp15.c13_fcse; if ((VAR_0->cp15.c1_sys & 1) == 0) { *VAR_4 = VAR_1; *VAR_5 = PAGE_READ | PAGE_WRITE; return 0; } else if (arm_feature(VAR_0, ARM_FEATURE_MPU)) { return get_phys_addr_mpu(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5); } else if (VAR_0->cp15.c1_sys & (1 << 23)) { return get_phys_addr_v6(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5); } else { return get_phys_addr_v5(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5); } }
[ "static inline int FUNC_0(CPUState *VAR_0, uint32_t VAR_1,\nint VAR_2, int VAR_3,\nuint32_t *VAR_4, int *VAR_5)\n{", "if (VAR_1 < 0x02000000)\nVAR_1 += VAR_0->cp15.c13_fcse;", "if ((VAR_0->cp15.c1_sys & 1) == 0) {", "*VAR_4 = VAR_1;", "*VAR_5 = PAGE_READ | PAGE_WRITE;", "return 0;", "} else if (arm_feature(VAR_0, ARM_FEATURE_MPU)) {", "return get_phys_addr_mpu(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4,\nVAR_5);", "} else if (VAR_0->cp15.c1_sys & (1 << 23)) {", "return get_phys_addr_v6(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4,\nVAR_5);", "} else {", "return get_phys_addr_v5(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4,\nVAR_5);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 11, 13 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29, 31 ], [ 33 ], [ 35, 37 ], [ 39 ], [ 41, 43 ], [ 45 ], [ 47 ] ]
11,131
static void conditional_interrupt(DBDMA_channel *ch) { dbdma_cmd *current = &ch->current; uint16_t intr; uint16_t sel_mask, sel_value; uint32_t status; int cond; DBDMA_DPRINTF("conditional_interrupt\n"); intr = le16_to_cpu(current->command) & INTR_MASK; switch(intr) { case INTR_NEVER: /* don't interrupt */ return; case INTR_ALWAYS: /* always interrupt */ qemu_irq_raise(ch->irq); return; } status = be32_to_cpu(ch->regs[DBDMA_STATUS]) & DEVSTAT; sel_mask = (be32_to_cpu(ch->regs[DBDMA_INTR_SEL]) >> 16) & 0x0f; sel_value = be32_to_cpu(ch->regs[DBDMA_INTR_SEL]) & 0x0f; cond = (status & sel_mask) == (sel_value & sel_mask); switch(intr) { case INTR_IFSET: /* intr if condition bit is 1 */ if (cond) qemu_irq_raise(ch->irq); return; case INTR_IFCLR: /* intr if condition bit is 0 */ if (!cond) qemu_irq_raise(ch->irq); return; } }
false
qemu
ad674e53b5cce265fadafbde2c6a4f190345cd00
static void conditional_interrupt(DBDMA_channel *ch) { dbdma_cmd *current = &ch->current; uint16_t intr; uint16_t sel_mask, sel_value; uint32_t status; int cond; DBDMA_DPRINTF("conditional_interrupt\n"); intr = le16_to_cpu(current->command) & INTR_MASK; switch(intr) { case INTR_NEVER: return; case INTR_ALWAYS: qemu_irq_raise(ch->irq); return; } status = be32_to_cpu(ch->regs[DBDMA_STATUS]) & DEVSTAT; sel_mask = (be32_to_cpu(ch->regs[DBDMA_INTR_SEL]) >> 16) & 0x0f; sel_value = be32_to_cpu(ch->regs[DBDMA_INTR_SEL]) & 0x0f; cond = (status & sel_mask) == (sel_value & sel_mask); switch(intr) { case INTR_IFSET: if (cond) qemu_irq_raise(ch->irq); return; case INTR_IFCLR: if (!cond) qemu_irq_raise(ch->irq); return; } }
{ "code": [], "line_no": [] }
static void FUNC_0(DBDMA_channel *VAR_0) { dbdma_cmd *current = &VAR_0->current; uint16_t intr; uint16_t sel_mask, sel_value; uint32_t status; int VAR_1; DBDMA_DPRINTF("FUNC_0\n"); intr = le16_to_cpu(current->command) & INTR_MASK; switch(intr) { case INTR_NEVER: return; case INTR_ALWAYS: qemu_irq_raise(VAR_0->irq); return; } status = be32_to_cpu(VAR_0->regs[DBDMA_STATUS]) & DEVSTAT; sel_mask = (be32_to_cpu(VAR_0->regs[DBDMA_INTR_SEL]) >> 16) & 0x0f; sel_value = be32_to_cpu(VAR_0->regs[DBDMA_INTR_SEL]) & 0x0f; VAR_1 = (status & sel_mask) == (sel_value & sel_mask); switch(intr) { case INTR_IFSET: if (VAR_1) qemu_irq_raise(VAR_0->irq); return; case INTR_IFCLR: if (!VAR_1) qemu_irq_raise(VAR_0->irq); return; } }
[ "static void FUNC_0(DBDMA_channel *VAR_0)\n{", "dbdma_cmd *current = &VAR_0->current;", "uint16_t intr;", "uint16_t sel_mask, sel_value;", "uint32_t status;", "int VAR_1;", "DBDMA_DPRINTF(\"FUNC_0\\n\");", "intr = le16_to_cpu(current->command) & INTR_MASK;", "switch(intr) {", "case INTR_NEVER:\nreturn;", "case INTR_ALWAYS:\nqemu_irq_raise(VAR_0->irq);", "return;", "}", "status = be32_to_cpu(VAR_0->regs[DBDMA_STATUS]) & DEVSTAT;", "sel_mask = (be32_to_cpu(VAR_0->regs[DBDMA_INTR_SEL]) >> 16) & 0x0f;", "sel_value = be32_to_cpu(VAR_0->regs[DBDMA_INTR_SEL]) & 0x0f;", "VAR_1 = (status & sel_mask) == (sel_value & sel_mask);", "switch(intr) {", "case INTR_IFSET:\nif (VAR_1)\nqemu_irq_raise(VAR_0->irq);", "return;", "case INTR_IFCLR:\nif (!VAR_1)\nqemu_irq_raise(VAR_0->irq);", "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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 21 ], [ 25 ], [ 27, 29 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 41 ], [ 45 ], [ 47 ], [ 51 ], [ 55 ], [ 57, 59, 61 ], [ 63 ], [ 65, 67, 69 ], [ 71 ], [ 73 ], [ 75 ] ]
11,133
static int cloop_open(BlockDriverState *bs, QDict *options, int flags, Error **errp) { BDRVCloopState *s = bs->opaque; uint32_t offsets_size, max_compressed_block_size = 1, i; int ret; bs->file = bdrv_open_child(NULL, options, "file", bs, &child_file, false, errp); if (!bs->file) { return -EINVAL; } bdrv_set_read_only(bs, true); /* read header */ ret = bdrv_pread(bs->file, 128, &s->block_size, 4); if (ret < 0) { return ret; } s->block_size = be32_to_cpu(s->block_size); if (s->block_size % 512) { error_setg(errp, "block_size %" PRIu32 " must be a multiple of 512", s->block_size); return -EINVAL; } if (s->block_size == 0) { error_setg(errp, "block_size cannot be zero"); return -EINVAL; } /* cloop's create_compressed_fs.c warns about block sizes beyond 256 KB but * we can accept more. Prevent ridiculous values like 4 GB - 1 since we * need a buffer this big. */ if (s->block_size > MAX_BLOCK_SIZE) { error_setg(errp, "block_size %" PRIu32 " must be %u MB or less", s->block_size, MAX_BLOCK_SIZE / (1024 * 1024)); return -EINVAL; } ret = bdrv_pread(bs->file, 128 + 4, &s->n_blocks, 4); if (ret < 0) { return ret; } s->n_blocks = be32_to_cpu(s->n_blocks); /* read offsets */ if (s->n_blocks > (UINT32_MAX - 1) / sizeof(uint64_t)) { /* Prevent integer overflow */ error_setg(errp, "n_blocks %" PRIu32 " must be %zu or less", s->n_blocks, (UINT32_MAX - 1) / sizeof(uint64_t)); return -EINVAL; } offsets_size = (s->n_blocks + 1) * sizeof(uint64_t); if (offsets_size > 512 * 1024 * 1024) { /* Prevent ridiculous offsets_size which causes memory allocation to * fail or overflows bdrv_pread() size. In practice the 512 MB * offsets[] limit supports 16 TB images at 256 KB block size. */ error_setg(errp, "image requires too many offsets, " "try increasing block size"); return -EINVAL; } s->offsets = g_try_malloc(offsets_size); if (s->offsets == NULL) { error_setg(errp, "Could not allocate offsets table"); return -ENOMEM; } ret = bdrv_pread(bs->file, 128 + 4 + 4, s->offsets, offsets_size); if (ret < 0) { goto fail; } for (i = 0; i < s->n_blocks + 1; i++) { uint64_t size; s->offsets[i] = be64_to_cpu(s->offsets[i]); if (i == 0) { continue; } if (s->offsets[i] < s->offsets[i - 1]) { error_setg(errp, "offsets not monotonically increasing at " "index %" PRIu32 ", image file is corrupt", i); ret = -EINVAL; goto fail; } size = s->offsets[i] - s->offsets[i - 1]; /* Compressed blocks should be smaller than the uncompressed block size * but maybe compression performed poorly so the compressed block is * actually bigger. Clamp down on unrealistic values to prevent * ridiculous s->compressed_block allocation. */ if (size > 2 * MAX_BLOCK_SIZE) { error_setg(errp, "invalid compressed block size at index %" PRIu32 ", image file is corrupt", i); ret = -EINVAL; goto fail; } if (size > max_compressed_block_size) { max_compressed_block_size = size; } } /* initialize zlib engine */ s->compressed_block = g_try_malloc(max_compressed_block_size + 1); if (s->compressed_block == NULL) { error_setg(errp, "Could not allocate compressed_block"); ret = -ENOMEM; goto fail; } s->uncompressed_block = g_try_malloc(s->block_size); if (s->uncompressed_block == NULL) { error_setg(errp, "Could not allocate uncompressed_block"); ret = -ENOMEM; goto fail; } if (inflateInit(&s->zstream) != Z_OK) { ret = -EINVAL; goto fail; } s->current_block = s->n_blocks; s->sectors_per_block = s->block_size/512; bs->total_sectors = s->n_blocks * s->sectors_per_block; qemu_co_mutex_init(&s->lock); return 0; fail: g_free(s->offsets); g_free(s->compressed_block); g_free(s->uncompressed_block); return ret; }
false
qemu
e2b8247a322cd92945785edf25f09e6b3e8285f9
static int cloop_open(BlockDriverState *bs, QDict *options, int flags, Error **errp) { BDRVCloopState *s = bs->opaque; uint32_t offsets_size, max_compressed_block_size = 1, i; int ret; bs->file = bdrv_open_child(NULL, options, "file", bs, &child_file, false, errp); if (!bs->file) { return -EINVAL; } bdrv_set_read_only(bs, true); ret = bdrv_pread(bs->file, 128, &s->block_size, 4); if (ret < 0) { return ret; } s->block_size = be32_to_cpu(s->block_size); if (s->block_size % 512) { error_setg(errp, "block_size %" PRIu32 " must be a multiple of 512", s->block_size); return -EINVAL; } if (s->block_size == 0) { error_setg(errp, "block_size cannot be zero"); return -EINVAL; } if (s->block_size > MAX_BLOCK_SIZE) { error_setg(errp, "block_size %" PRIu32 " must be %u MB or less", s->block_size, MAX_BLOCK_SIZE / (1024 * 1024)); return -EINVAL; } ret = bdrv_pread(bs->file, 128 + 4, &s->n_blocks, 4); if (ret < 0) { return ret; } s->n_blocks = be32_to_cpu(s->n_blocks); if (s->n_blocks > (UINT32_MAX - 1) / sizeof(uint64_t)) { error_setg(errp, "n_blocks %" PRIu32 " must be %zu or less", s->n_blocks, (UINT32_MAX - 1) / sizeof(uint64_t)); return -EINVAL; } offsets_size = (s->n_blocks + 1) * sizeof(uint64_t); if (offsets_size > 512 * 1024 * 1024) { error_setg(errp, "image requires too many offsets, " "try increasing block size"); return -EINVAL; } s->offsets = g_try_malloc(offsets_size); if (s->offsets == NULL) { error_setg(errp, "Could not allocate offsets table"); return -ENOMEM; } ret = bdrv_pread(bs->file, 128 + 4 + 4, s->offsets, offsets_size); if (ret < 0) { goto fail; } for (i = 0; i < s->n_blocks + 1; i++) { uint64_t size; s->offsets[i] = be64_to_cpu(s->offsets[i]); if (i == 0) { continue; } if (s->offsets[i] < s->offsets[i - 1]) { error_setg(errp, "offsets not monotonically increasing at " "index %" PRIu32 ", image file is corrupt", i); ret = -EINVAL; goto fail; } size = s->offsets[i] - s->offsets[i - 1]; if (size > 2 * MAX_BLOCK_SIZE) { error_setg(errp, "invalid compressed block size at index %" PRIu32 ", image file is corrupt", i); ret = -EINVAL; goto fail; } if (size > max_compressed_block_size) { max_compressed_block_size = size; } } s->compressed_block = g_try_malloc(max_compressed_block_size + 1); if (s->compressed_block == NULL) { error_setg(errp, "Could not allocate compressed_block"); ret = -ENOMEM; goto fail; } s->uncompressed_block = g_try_malloc(s->block_size); if (s->uncompressed_block == NULL) { error_setg(errp, "Could not allocate uncompressed_block"); ret = -ENOMEM; goto fail; } if (inflateInit(&s->zstream) != Z_OK) { ret = -EINVAL; goto fail; } s->current_block = s->n_blocks; s->sectors_per_block = s->block_size/512; bs->total_sectors = s->n_blocks * s->sectors_per_block; qemu_co_mutex_init(&s->lock); return 0; fail: g_free(s->offsets); g_free(s->compressed_block); g_free(s->uncompressed_block); return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(BlockDriverState *VAR_0, QDict *VAR_1, int VAR_2, Error **VAR_3) { BDRVCloopState *s = VAR_0->opaque; uint32_t offsets_size, max_compressed_block_size = 1, i; int VAR_4; VAR_0->file = bdrv_open_child(NULL, VAR_1, "file", VAR_0, &child_file, false, VAR_3); if (!VAR_0->file) { return -EINVAL; } bdrv_set_read_only(VAR_0, true); VAR_4 = bdrv_pread(VAR_0->file, 128, &s->block_size, 4); if (VAR_4 < 0) { return VAR_4; } s->block_size = be32_to_cpu(s->block_size); if (s->block_size % 512) { error_setg(VAR_3, "block_size %" PRIu32 " must be a multiple of 512", s->block_size); return -EINVAL; } if (s->block_size == 0) { error_setg(VAR_3, "block_size cannot be zero"); return -EINVAL; } if (s->block_size > MAX_BLOCK_SIZE) { error_setg(VAR_3, "block_size %" PRIu32 " must be %u MB or less", s->block_size, MAX_BLOCK_SIZE / (1024 * 1024)); return -EINVAL; } VAR_4 = bdrv_pread(VAR_0->file, 128 + 4, &s->n_blocks, 4); if (VAR_4 < 0) { return VAR_4; } s->n_blocks = be32_to_cpu(s->n_blocks); if (s->n_blocks > (UINT32_MAX - 1) / sizeof(uint64_t)) { error_setg(VAR_3, "n_blocks %" PRIu32 " must be %zu or less", s->n_blocks, (UINT32_MAX - 1) / sizeof(uint64_t)); return -EINVAL; } offsets_size = (s->n_blocks + 1) * sizeof(uint64_t); if (offsets_size > 512 * 1024 * 1024) { error_setg(VAR_3, "image requires too many offsets, " "try increasing block size"); return -EINVAL; } s->offsets = g_try_malloc(offsets_size); if (s->offsets == NULL) { error_setg(VAR_3, "Could not allocate offsets table"); return -ENOMEM; } VAR_4 = bdrv_pread(VAR_0->file, 128 + 4 + 4, s->offsets, offsets_size); if (VAR_4 < 0) { goto fail; } for (i = 0; i < s->n_blocks + 1; i++) { uint64_t size; s->offsets[i] = be64_to_cpu(s->offsets[i]); if (i == 0) { continue; } if (s->offsets[i] < s->offsets[i - 1]) { error_setg(VAR_3, "offsets not monotonically increasing at " "index %" PRIu32 ", image file is corrupt", i); VAR_4 = -EINVAL; goto fail; } size = s->offsets[i] - s->offsets[i - 1]; if (size > 2 * MAX_BLOCK_SIZE) { error_setg(VAR_3, "invalid compressed block size at index %" PRIu32 ", image file is corrupt", i); VAR_4 = -EINVAL; goto fail; } if (size > max_compressed_block_size) { max_compressed_block_size = size; } } s->compressed_block = g_try_malloc(max_compressed_block_size + 1); if (s->compressed_block == NULL) { error_setg(VAR_3, "Could not allocate compressed_block"); VAR_4 = -ENOMEM; goto fail; } s->uncompressed_block = g_try_malloc(s->block_size); if (s->uncompressed_block == NULL) { error_setg(VAR_3, "Could not allocate uncompressed_block"); VAR_4 = -ENOMEM; goto fail; } if (inflateInit(&s->zstream) != Z_OK) { VAR_4 = -EINVAL; goto fail; } s->current_block = s->n_blocks; s->sectors_per_block = s->block_size/512; VAR_0->total_sectors = s->n_blocks * s->sectors_per_block; qemu_co_mutex_init(&s->lock); return 0; fail: g_free(s->offsets); g_free(s->compressed_block); g_free(s->uncompressed_block); return VAR_4; }
[ "static int FUNC_0(BlockDriverState *VAR_0, QDict *VAR_1, int VAR_2,\nError **VAR_3)\n{", "BDRVCloopState *s = VAR_0->opaque;", "uint32_t offsets_size, max_compressed_block_size = 1, i;", "int VAR_4;", "VAR_0->file = bdrv_open_child(NULL, VAR_1, \"file\", VAR_0, &child_file,\nfalse, VAR_3);", "if (!VAR_0->file) {", "return -EINVAL;", "}", "bdrv_set_read_only(VAR_0, true);", "VAR_4 = bdrv_pread(VAR_0->file, 128, &s->block_size, 4);", "if (VAR_4 < 0) {", "return VAR_4;", "}", "s->block_size = be32_to_cpu(s->block_size);", "if (s->block_size % 512) {", "error_setg(VAR_3, \"block_size %\" PRIu32 \" must be a multiple of 512\",\ns->block_size);", "return -EINVAL;", "}", "if (s->block_size == 0) {", "error_setg(VAR_3, \"block_size cannot be zero\");", "return -EINVAL;", "}", "if (s->block_size > MAX_BLOCK_SIZE) {", "error_setg(VAR_3, \"block_size %\" PRIu32 \" must be %u MB or less\",\ns->block_size,\nMAX_BLOCK_SIZE / (1024 * 1024));", "return -EINVAL;", "}", "VAR_4 = bdrv_pread(VAR_0->file, 128 + 4, &s->n_blocks, 4);", "if (VAR_4 < 0) {", "return VAR_4;", "}", "s->n_blocks = be32_to_cpu(s->n_blocks);", "if (s->n_blocks > (UINT32_MAX - 1) / sizeof(uint64_t)) {", "error_setg(VAR_3, \"n_blocks %\" PRIu32 \" must be %zu or less\",\ns->n_blocks,\n(UINT32_MAX - 1) / sizeof(uint64_t));", "return -EINVAL;", "}", "offsets_size = (s->n_blocks + 1) * sizeof(uint64_t);", "if (offsets_size > 512 * 1024 * 1024) {", "error_setg(VAR_3, \"image requires too many offsets, \"\n\"try increasing block size\");", "return -EINVAL;", "}", "s->offsets = g_try_malloc(offsets_size);", "if (s->offsets == NULL) {", "error_setg(VAR_3, \"Could not allocate offsets table\");", "return -ENOMEM;", "}", "VAR_4 = bdrv_pread(VAR_0->file, 128 + 4 + 4, s->offsets, offsets_size);", "if (VAR_4 < 0) {", "goto fail;", "}", "for (i = 0; i < s->n_blocks + 1; i++) {", "uint64_t size;", "s->offsets[i] = be64_to_cpu(s->offsets[i]);", "if (i == 0) {", "continue;", "}", "if (s->offsets[i] < s->offsets[i - 1]) {", "error_setg(VAR_3, \"offsets not monotonically increasing at \"\n\"index %\" PRIu32 \", image file is corrupt\", i);", "VAR_4 = -EINVAL;", "goto fail;", "}", "size = s->offsets[i] - s->offsets[i - 1];", "if (size > 2 * MAX_BLOCK_SIZE) {", "error_setg(VAR_3, \"invalid compressed block size at index %\" PRIu32\n\", image file is corrupt\", i);", "VAR_4 = -EINVAL;", "goto fail;", "}", "if (size > max_compressed_block_size) {", "max_compressed_block_size = size;", "}", "}", "s->compressed_block = g_try_malloc(max_compressed_block_size + 1);", "if (s->compressed_block == NULL) {", "error_setg(VAR_3, \"Could not allocate compressed_block\");", "VAR_4 = -ENOMEM;", "goto fail;", "}", "s->uncompressed_block = g_try_malloc(s->block_size);", "if (s->uncompressed_block == NULL) {", "error_setg(VAR_3, \"Could not allocate uncompressed_block\");", "VAR_4 = -ENOMEM;", "goto fail;", "}", "if (inflateInit(&s->zstream) != Z_OK) {", "VAR_4 = -EINVAL;", "goto fail;", "}", "s->current_block = s->n_blocks;", "s->sectors_per_block = s->block_size/512;", "VAR_0->total_sectors = s->n_blocks * s->sectors_per_block;", "qemu_co_mutex_init(&s->lock);", "return 0;", "fail:\ng_free(s->offsets);", "g_free(s->compressed_block);", "g_free(s->uncompressed_block);", "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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15, 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45, 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 71 ], [ 73, 75, 77 ], [ 79 ], [ 81 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 99 ], [ 103, 105, 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 125, 127 ], [ 129 ], [ 131 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 157 ], [ 159 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 173 ], [ 175, 177 ], [ 179 ], [ 181 ], [ 183 ], [ 187 ], [ 201 ], [ 203, 205 ], [ 207 ], [ 209 ], [ 211 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 277, 279 ], [ 281 ], [ 283 ], [ 285 ], [ 287 ] ]
11,134
static uint32_t sm501_palette_read(void *opaque, target_phys_addr_t addr) { SM501State * s = (SM501State *)opaque; SM501_DPRINTF("sm501 palette read addr=%x\n", (int)addr); /* TODO : consider BYTE/WORD access */ /* TODO : consider endian */ assert(0 <= addr && addr < 0x400 * 3); return *(uint32_t*)&s->dc_palette[addr]; }
false
qemu
45416789e8ccced568a4984af61974adfbfa0f62
static uint32_t sm501_palette_read(void *opaque, target_phys_addr_t addr) { SM501State * s = (SM501State *)opaque; SM501_DPRINTF("sm501 palette read addr=%x\n", (int)addr); assert(0 <= addr && addr < 0x400 * 3); return *(uint32_t*)&s->dc_palette[addr]; }
{ "code": [], "line_no": [] }
static uint32_t FUNC_0(void *opaque, target_phys_addr_t addr) { SM501State * s = (SM501State *)opaque; SM501_DPRINTF("sm501 palette read addr=%x\n", (int)addr); assert(0 <= addr && addr < 0x400 * 3); return *(uint32_t*)&s->dc_palette[addr]; }
[ "static uint32_t FUNC_0(void *opaque, target_phys_addr_t addr)\n{", "SM501State * s = (SM501State *)opaque;", "SM501_DPRINTF(\"sm501 palette read addr=%x\\n\", (int)addr);", "assert(0 <= addr && addr < 0x400 * 3);", "return *(uint32_t*)&s->dc_palette[addr];", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 17 ], [ 19 ], [ 21 ] ]
11,135
static void gen_spr_amr (CPUPPCState *env) { #ifndef CONFIG_USER_ONLY /* Virtual Page Class Key protection */ /* The AMR is accessible either via SPR 13 or SPR 29. 13 is * userspace accessible, 29 is privileged. So we only need to set * the kvm ONE_REG id on one of them, we use 29 */ spr_register(env, SPR_UAMR, "UAMR", &spr_read_uamr, &spr_write_uamr_pr, &spr_read_uamr, &spr_write_uamr, 0); spr_register_kvm(env, SPR_AMR, "AMR", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, KVM_REG_PPC_AMR, 0xffffffffffffffffULL); spr_register_kvm(env, SPR_UAMOR, "UAMOR", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, KVM_REG_PPC_UAMOR, 0); #endif /* !CONFIG_USER_ONLY */ }
false
qemu
0dc083fe10c5cc848f36498b9157a336cbc8c7c1
static void gen_spr_amr (CPUPPCState *env) { #ifndef CONFIG_USER_ONLY spr_register(env, SPR_UAMR, "UAMR", &spr_read_uamr, &spr_write_uamr_pr, &spr_read_uamr, &spr_write_uamr, 0); spr_register_kvm(env, SPR_AMR, "AMR", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, KVM_REG_PPC_AMR, 0xffffffffffffffffULL); spr_register_kvm(env, SPR_UAMOR, "UAMOR", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, KVM_REG_PPC_UAMOR, 0); #endif }
{ "code": [], "line_no": [] }
static void FUNC_0 (CPUPPCState *VAR_0) { #ifndef CONFIG_USER_ONLY spr_register(VAR_0, SPR_UAMR, "UAMR", &spr_read_uamr, &spr_write_uamr_pr, &spr_read_uamr, &spr_write_uamr, 0); spr_register_kvm(VAR_0, SPR_AMR, "AMR", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, KVM_REG_PPC_AMR, 0xffffffffffffffffULL); spr_register_kvm(VAR_0, SPR_UAMOR, "UAMOR", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, KVM_REG_PPC_UAMOR, 0); #endif }
[ "static void FUNC_0 (CPUPPCState *VAR_0)\n{", "#ifndef CONFIG_USER_ONLY\nspr_register(VAR_0, SPR_UAMR, \"UAMR\",\n&spr_read_uamr, &spr_write_uamr_pr,\n&spr_read_uamr, &spr_write_uamr,\n0);", "spr_register_kvm(VAR_0, SPR_AMR, \"AMR\",\nSPR_NOACCESS, SPR_NOACCESS,\n&spr_read_generic, &spr_write_generic,\nKVM_REG_PPC_AMR, 0xffffffffffffffffULL);", "spr_register_kvm(VAR_0, SPR_UAMOR, \"UAMOR\",\nSPR_NOACCESS, SPR_NOACCESS,\n&spr_read_generic, &spr_write_generic,\nKVM_REG_PPC_UAMOR, 0);", "#endif\n}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 15, 17, 19, 21 ], [ 23, 25, 27, 29 ], [ 31, 33, 35, 37 ], [ 39, 41 ] ]
11,136
static void set_kernel_args(const struct arm_boot_info *info) { int initrd_size = info->initrd_size; target_phys_addr_t base = info->loader_start; target_phys_addr_t p; p = base + KERNEL_ARGS_ADDR; /* ATAG_CORE */ WRITE_WORD(p, 5); WRITE_WORD(p, 0x54410001); WRITE_WORD(p, 1); WRITE_WORD(p, 0x1000); WRITE_WORD(p, 0); /* ATAG_MEM */ /* TODO: handle multiple chips on one ATAG list */ WRITE_WORD(p, 4); WRITE_WORD(p, 0x54410002); WRITE_WORD(p, info->ram_size); WRITE_WORD(p, info->loader_start); if (initrd_size) { /* ATAG_INITRD2 */ WRITE_WORD(p, 4); WRITE_WORD(p, 0x54420005); WRITE_WORD(p, info->loader_start + INITRD_LOAD_ADDR); WRITE_WORD(p, initrd_size); } if (info->kernel_cmdline && *info->kernel_cmdline) { /* ATAG_CMDLINE */ int cmdline_size; cmdline_size = strlen(info->kernel_cmdline); cpu_physical_memory_write(p + 8, (void *)info->kernel_cmdline, cmdline_size + 1); cmdline_size = (cmdline_size >> 2) + 1; WRITE_WORD(p, cmdline_size + 2); WRITE_WORD(p, 0x54410009); p += cmdline_size * 4; } if (info->atag_board) { /* ATAG_BOARD */ int atag_board_len; uint8_t atag_board_buf[0x1000]; atag_board_len = (info->atag_board(info, atag_board_buf) + 3) & ~3; WRITE_WORD(p, (atag_board_len + 8) >> 2); WRITE_WORD(p, 0x414f4d50); cpu_physical_memory_write(p, atag_board_buf, atag_board_len); p += atag_board_len; } /* ATAG_END */ WRITE_WORD(p, 0); WRITE_WORD(p, 0); }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static void set_kernel_args(const struct arm_boot_info *info) { int initrd_size = info->initrd_size; target_phys_addr_t base = info->loader_start; target_phys_addr_t p; p = base + KERNEL_ARGS_ADDR; WRITE_WORD(p, 5); WRITE_WORD(p, 0x54410001); WRITE_WORD(p, 1); WRITE_WORD(p, 0x1000); WRITE_WORD(p, 0); WRITE_WORD(p, 4); WRITE_WORD(p, 0x54410002); WRITE_WORD(p, info->ram_size); WRITE_WORD(p, info->loader_start); if (initrd_size) { WRITE_WORD(p, 4); WRITE_WORD(p, 0x54420005); WRITE_WORD(p, info->loader_start + INITRD_LOAD_ADDR); WRITE_WORD(p, initrd_size); } if (info->kernel_cmdline && *info->kernel_cmdline) { int cmdline_size; cmdline_size = strlen(info->kernel_cmdline); cpu_physical_memory_write(p + 8, (void *)info->kernel_cmdline, cmdline_size + 1); cmdline_size = (cmdline_size >> 2) + 1; WRITE_WORD(p, cmdline_size + 2); WRITE_WORD(p, 0x54410009); p += cmdline_size * 4; } if (info->atag_board) { int atag_board_len; uint8_t atag_board_buf[0x1000]; atag_board_len = (info->atag_board(info, atag_board_buf) + 3) & ~3; WRITE_WORD(p, (atag_board_len + 8) >> 2); WRITE_WORD(p, 0x414f4d50); cpu_physical_memory_write(p, atag_board_buf, atag_board_len); p += atag_board_len; } WRITE_WORD(p, 0); WRITE_WORD(p, 0); }
{ "code": [], "line_no": [] }
static void FUNC_0(const struct arm_boot_info *VAR_0) { int VAR_1 = VAR_0->VAR_1; target_phys_addr_t base = VAR_0->loader_start; target_phys_addr_t p; p = base + KERNEL_ARGS_ADDR; WRITE_WORD(p, 5); WRITE_WORD(p, 0x54410001); WRITE_WORD(p, 1); WRITE_WORD(p, 0x1000); WRITE_WORD(p, 0); WRITE_WORD(p, 4); WRITE_WORD(p, 0x54410002); WRITE_WORD(p, VAR_0->ram_size); WRITE_WORD(p, VAR_0->loader_start); if (VAR_1) { WRITE_WORD(p, 4); WRITE_WORD(p, 0x54420005); WRITE_WORD(p, VAR_0->loader_start + INITRD_LOAD_ADDR); WRITE_WORD(p, VAR_1); } if (VAR_0->kernel_cmdline && *VAR_0->kernel_cmdline) { int VAR_2; VAR_2 = strlen(VAR_0->kernel_cmdline); cpu_physical_memory_write(p + 8, (void *)VAR_0->kernel_cmdline, VAR_2 + 1); VAR_2 = (VAR_2 >> 2) + 1; WRITE_WORD(p, VAR_2 + 2); WRITE_WORD(p, 0x54410009); p += VAR_2 * 4; } if (VAR_0->atag_board) { int VAR_3; uint8_t atag_board_buf[0x1000]; VAR_3 = (VAR_0->atag_board(VAR_0, atag_board_buf) + 3) & ~3; WRITE_WORD(p, (VAR_3 + 8) >> 2); WRITE_WORD(p, 0x414f4d50); cpu_physical_memory_write(p, atag_board_buf, VAR_3); p += VAR_3; } WRITE_WORD(p, 0); WRITE_WORD(p, 0); }
[ "static void FUNC_0(const struct arm_boot_info *VAR_0)\n{", "int VAR_1 = VAR_0->VAR_1;", "target_phys_addr_t base = VAR_0->loader_start;", "target_phys_addr_t p;", "p = base + KERNEL_ARGS_ADDR;", "WRITE_WORD(p, 5);", "WRITE_WORD(p, 0x54410001);", "WRITE_WORD(p, 1);", "WRITE_WORD(p, 0x1000);", "WRITE_WORD(p, 0);", "WRITE_WORD(p, 4);", "WRITE_WORD(p, 0x54410002);", "WRITE_WORD(p, VAR_0->ram_size);", "WRITE_WORD(p, VAR_0->loader_start);", "if (VAR_1) {", "WRITE_WORD(p, 4);", "WRITE_WORD(p, 0x54420005);", "WRITE_WORD(p, VAR_0->loader_start + INITRD_LOAD_ADDR);", "WRITE_WORD(p, VAR_1);", "}", "if (VAR_0->kernel_cmdline && *VAR_0->kernel_cmdline) {", "int VAR_2;", "VAR_2 = strlen(VAR_0->kernel_cmdline);", "cpu_physical_memory_write(p + 8, (void *)VAR_0->kernel_cmdline,\nVAR_2 + 1);", "VAR_2 = (VAR_2 >> 2) + 1;", "WRITE_WORD(p, VAR_2 + 2);", "WRITE_WORD(p, 0x54410009);", "p += VAR_2 * 4;", "}", "if (VAR_0->atag_board) {", "int VAR_3;", "uint8_t atag_board_buf[0x1000];", "VAR_3 = (VAR_0->atag_board(VAR_0, atag_board_buf) + 3) & ~3;", "WRITE_WORD(p, (VAR_3 + 8) >> 2);", "WRITE_WORD(p, 0x414f4d50);", "cpu_physical_memory_write(p, atag_board_buf, VAR_3);", "p += VAR_3;", "}", "WRITE_WORD(p, 0);", "WRITE_WORD(p, 0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 61 ], [ 63, 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 83 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 101 ], [ 103 ], [ 105 ] ]
11,137
static void ppc_powernv_init(MachineState *machine) { PnvMachineState *pnv = POWERNV_MACHINE(machine); MemoryRegion *ram; char *fw_filename; long fw_size; int i; char *chip_typename; /* allocate RAM */ if (machine->ram_size < (1 * G_BYTE)) { error_report("Warning: skiboot may not work with < 1GB of RAM"); } ram = g_new(MemoryRegion, 1); memory_region_allocate_system_memory(ram, NULL, "ppc_powernv.ram", machine->ram_size); memory_region_add_subregion(get_system_memory(), 0, ram); /* load skiboot firmware */ if (bios_name == NULL) { bios_name = FW_FILE_NAME; } fw_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); fw_size = load_image_targphys(fw_filename, FW_LOAD_ADDR, FW_MAX_SIZE); if (fw_size < 0) { error_report("Could not load OPAL '%s'", fw_filename); exit(1); } g_free(fw_filename); /* load kernel */ if (machine->kernel_filename) { long kernel_size; kernel_size = load_image_targphys(machine->kernel_filename, KERNEL_LOAD_ADDR, 0x2000000); if (kernel_size < 0) { error_report("Could not load kernel '%s'", machine->kernel_filename); exit(1); } } /* load initrd */ if (machine->initrd_filename) { pnv->initrd_base = INITRD_LOAD_ADDR; pnv->initrd_size = load_image_targphys(machine->initrd_filename, pnv->initrd_base, 0x10000000); /* 128MB max */ if (pnv->initrd_size < 0) { error_report("Could not load initial ram disk '%s'", machine->initrd_filename); exit(1); } } /* We need some cpu model to instantiate the PnvChip class */ if (machine->cpu_model == NULL) { machine->cpu_model = "POWER8"; } /* Create the processor chips */ chip_typename = g_strdup_printf(TYPE_PNV_CHIP "-%s", machine->cpu_model); if (!object_class_by_name(chip_typename)) { error_report("invalid CPU model '%s' for %s machine", machine->cpu_model, MACHINE_GET_CLASS(machine)->name); exit(1); } pnv->chips = g_new0(PnvChip *, pnv->num_chips); for (i = 0; i < pnv->num_chips; i++) { char chip_name[32]; Object *chip = object_new(chip_typename); pnv->chips[i] = PNV_CHIP(chip); /* TODO: put all the memory in one node on chip 0 until we find a * way to specify different ranges for each chip */ if (i == 0) { object_property_set_int(chip, machine->ram_size, "ram-size", &error_fatal); } snprintf(chip_name, sizeof(chip_name), "chip[%d]", PNV_CHIP_HWID(i)); object_property_add_child(OBJECT(pnv), chip_name, chip, &error_fatal); object_property_set_int(chip, PNV_CHIP_HWID(i), "chip-id", &error_fatal); object_property_set_int(chip, smp_cores, "nr-cores", &error_fatal); object_property_set_bool(chip, true, "realized", &error_fatal); } g_free(chip_typename); /* Instantiate ISA bus on chip 0 */ pnv->isa_bus = pnv_isa_create(pnv->chips[0]); /* Create serial port */ serial_hds_isa_init(pnv->isa_bus, 0, MAX_SERIAL_PORTS); /* Create an RTC ISA device too */ rtc_init(pnv->isa_bus, 2000, NULL); /* OpenPOWER systems use a IPMI SEL Event message to notify the * host to powerdown */ pnv->powerdown_notifier.notify = pnv_powerdown_notify; qemu_register_powerdown_notifier(&pnv->powerdown_notifier); }
false
qemu
3dc6f8693694a649a9c83f1e2746565b47683923
static void ppc_powernv_init(MachineState *machine) { PnvMachineState *pnv = POWERNV_MACHINE(machine); MemoryRegion *ram; char *fw_filename; long fw_size; int i; char *chip_typename; if (machine->ram_size < (1 * G_BYTE)) { error_report("Warning: skiboot may not work with < 1GB of RAM"); } ram = g_new(MemoryRegion, 1); memory_region_allocate_system_memory(ram, NULL, "ppc_powernv.ram", machine->ram_size); memory_region_add_subregion(get_system_memory(), 0, ram); if (bios_name == NULL) { bios_name = FW_FILE_NAME; } fw_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); fw_size = load_image_targphys(fw_filename, FW_LOAD_ADDR, FW_MAX_SIZE); if (fw_size < 0) { error_report("Could not load OPAL '%s'", fw_filename); exit(1); } g_free(fw_filename); if (machine->kernel_filename) { long kernel_size; kernel_size = load_image_targphys(machine->kernel_filename, KERNEL_LOAD_ADDR, 0x2000000); if (kernel_size < 0) { error_report("Could not load kernel '%s'", machine->kernel_filename); exit(1); } } if (machine->initrd_filename) { pnv->initrd_base = INITRD_LOAD_ADDR; pnv->initrd_size = load_image_targphys(machine->initrd_filename, pnv->initrd_base, 0x10000000); if (pnv->initrd_size < 0) { error_report("Could not load initial ram disk '%s'", machine->initrd_filename); exit(1); } } if (machine->cpu_model == NULL) { machine->cpu_model = "POWER8"; } chip_typename = g_strdup_printf(TYPE_PNV_CHIP "-%s", machine->cpu_model); if (!object_class_by_name(chip_typename)) { error_report("invalid CPU model '%s' for %s machine", machine->cpu_model, MACHINE_GET_CLASS(machine)->name); exit(1); } pnv->chips = g_new0(PnvChip *, pnv->num_chips); for (i = 0; i < pnv->num_chips; i++) { char chip_name[32]; Object *chip = object_new(chip_typename); pnv->chips[i] = PNV_CHIP(chip); if (i == 0) { object_property_set_int(chip, machine->ram_size, "ram-size", &error_fatal); } snprintf(chip_name, sizeof(chip_name), "chip[%d]", PNV_CHIP_HWID(i)); object_property_add_child(OBJECT(pnv), chip_name, chip, &error_fatal); object_property_set_int(chip, PNV_CHIP_HWID(i), "chip-id", &error_fatal); object_property_set_int(chip, smp_cores, "nr-cores", &error_fatal); object_property_set_bool(chip, true, "realized", &error_fatal); } g_free(chip_typename); pnv->isa_bus = pnv_isa_create(pnv->chips[0]); serial_hds_isa_init(pnv->isa_bus, 0, MAX_SERIAL_PORTS); rtc_init(pnv->isa_bus, 2000, NULL); pnv->powerdown_notifier.notify = pnv_powerdown_notify; qemu_register_powerdown_notifier(&pnv->powerdown_notifier); }
{ "code": [], "line_no": [] }
static void FUNC_0(MachineState *VAR_0) { PnvMachineState *pnv = POWERNV_MACHINE(VAR_0); MemoryRegion *ram; char *VAR_1; long VAR_2; int VAR_3; char *VAR_4; if (VAR_0->ram_size < (1 * G_BYTE)) { error_report("Warning: skiboot may not work with < 1GB of RAM"); } ram = g_new(MemoryRegion, 1); memory_region_allocate_system_memory(ram, NULL, "ppc_powernv.ram", VAR_0->ram_size); memory_region_add_subregion(get_system_memory(), 0, ram); if (bios_name == NULL) { bios_name = FW_FILE_NAME; } VAR_1 = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); VAR_2 = load_image_targphys(VAR_1, FW_LOAD_ADDR, FW_MAX_SIZE); if (VAR_2 < 0) { error_report("Could not load OPAL '%s'", VAR_1); exit(1); } g_free(VAR_1); if (VAR_0->kernel_filename) { long VAR_5; VAR_5 = load_image_targphys(VAR_0->kernel_filename, KERNEL_LOAD_ADDR, 0x2000000); if (VAR_5 < 0) { error_report("Could not load kernel '%s'", VAR_0->kernel_filename); exit(1); } } if (VAR_0->initrd_filename) { pnv->initrd_base = INITRD_LOAD_ADDR; pnv->initrd_size = load_image_targphys(VAR_0->initrd_filename, pnv->initrd_base, 0x10000000); if (pnv->initrd_size < 0) { error_report("Could not load initial ram disk '%s'", VAR_0->initrd_filename); exit(1); } } if (VAR_0->cpu_model == NULL) { VAR_0->cpu_model = "POWER8"; } VAR_4 = g_strdup_printf(TYPE_PNV_CHIP "-%s", VAR_0->cpu_model); if (!object_class_by_name(VAR_4)) { error_report("invalid CPU model '%s' for %s VAR_0", VAR_0->cpu_model, MACHINE_GET_CLASS(VAR_0)->name); exit(1); } pnv->chips = g_new0(PnvChip *, pnv->num_chips); for (VAR_3 = 0; VAR_3 < pnv->num_chips; VAR_3++) { char chip_name[32]; Object *chip = object_new(VAR_4); pnv->chips[VAR_3] = PNV_CHIP(chip); if (VAR_3 == 0) { object_property_set_int(chip, VAR_0->ram_size, "ram-size", &error_fatal); } snprintf(chip_name, sizeof(chip_name), "chip[%d]", PNV_CHIP_HWID(VAR_3)); object_property_add_child(OBJECT(pnv), chip_name, chip, &error_fatal); object_property_set_int(chip, PNV_CHIP_HWID(VAR_3), "chip-id", &error_fatal); object_property_set_int(chip, smp_cores, "nr-cores", &error_fatal); object_property_set_bool(chip, true, "realized", &error_fatal); } g_free(VAR_4); pnv->isa_bus = pnv_isa_create(pnv->chips[0]); serial_hds_isa_init(pnv->isa_bus, 0, MAX_SERIAL_PORTS); rtc_init(pnv->isa_bus, 2000, NULL); pnv->powerdown_notifier.notify = pnv_powerdown_notify; qemu_register_powerdown_notifier(&pnv->powerdown_notifier); }
[ "static void FUNC_0(MachineState *VAR_0)\n{", "PnvMachineState *pnv = POWERNV_MACHINE(VAR_0);", "MemoryRegion *ram;", "char *VAR_1;", "long VAR_2;", "int VAR_3;", "char *VAR_4;", "if (VAR_0->ram_size < (1 * G_BYTE)) {", "error_report(\"Warning: skiboot may not work with < 1GB of RAM\");", "}", "ram = g_new(MemoryRegion, 1);", "memory_region_allocate_system_memory(ram, NULL, \"ppc_powernv.ram\",\nVAR_0->ram_size);", "memory_region_add_subregion(get_system_memory(), 0, ram);", "if (bios_name == NULL) {", "bios_name = FW_FILE_NAME;", "}", "VAR_1 = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);", "VAR_2 = load_image_targphys(VAR_1, FW_LOAD_ADDR, FW_MAX_SIZE);", "if (VAR_2 < 0) {", "error_report(\"Could not load OPAL '%s'\", VAR_1);", "exit(1);", "}", "g_free(VAR_1);", "if (VAR_0->kernel_filename) {", "long VAR_5;", "VAR_5 = load_image_targphys(VAR_0->kernel_filename,\nKERNEL_LOAD_ADDR, 0x2000000);", "if (VAR_5 < 0) {", "error_report(\"Could not load kernel '%s'\",\nVAR_0->kernel_filename);", "exit(1);", "}", "}", "if (VAR_0->initrd_filename) {", "pnv->initrd_base = INITRD_LOAD_ADDR;", "pnv->initrd_size = load_image_targphys(VAR_0->initrd_filename,\npnv->initrd_base, 0x10000000);", "if (pnv->initrd_size < 0) {", "error_report(\"Could not load initial ram disk '%s'\",\nVAR_0->initrd_filename);", "exit(1);", "}", "}", "if (VAR_0->cpu_model == NULL) {", "VAR_0->cpu_model = \"POWER8\";", "}", "VAR_4 = g_strdup_printf(TYPE_PNV_CHIP \"-%s\", VAR_0->cpu_model);", "if (!object_class_by_name(VAR_4)) {", "error_report(\"invalid CPU model '%s' for %s VAR_0\",\nVAR_0->cpu_model, MACHINE_GET_CLASS(VAR_0)->name);", "exit(1);", "}", "pnv->chips = g_new0(PnvChip *, pnv->num_chips);", "for (VAR_3 = 0; VAR_3 < pnv->num_chips; VAR_3++) {", "char chip_name[32];", "Object *chip = object_new(VAR_4);", "pnv->chips[VAR_3] = PNV_CHIP(chip);", "if (VAR_3 == 0) {", "object_property_set_int(chip, VAR_0->ram_size, \"ram-size\",\n&error_fatal);", "}", "snprintf(chip_name, sizeof(chip_name), \"chip[%d]\", PNV_CHIP_HWID(VAR_3));", "object_property_add_child(OBJECT(pnv), chip_name, chip, &error_fatal);", "object_property_set_int(chip, PNV_CHIP_HWID(VAR_3), \"chip-id\",\n&error_fatal);", "object_property_set_int(chip, smp_cores, \"nr-cores\", &error_fatal);", "object_property_set_bool(chip, true, \"realized\", &error_fatal);", "}", "g_free(VAR_4);", "pnv->isa_bus = pnv_isa_create(pnv->chips[0]);", "serial_hds_isa_init(pnv->isa_bus, 0, MAX_SERIAL_PORTS);", "rtc_init(pnv->isa_bus, 2000, NULL);", "pnv->powerdown_notifier.notify = pnv_powerdown_notify;", "qemu_register_powerdown_notifier(&pnv->powerdown_notifier);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 69 ], [ 71 ], [ 75, 77 ], [ 79 ], [ 81, 83 ], [ 85 ], [ 87 ], [ 89 ], [ 95 ], [ 97 ], [ 99, 101 ], [ 103 ], [ 105, 107 ], [ 109 ], [ 111 ], [ 113 ], [ 119 ], [ 121 ], [ 123 ], [ 129 ], [ 131 ], [ 133, 135 ], [ 137 ], [ 139 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 153 ], [ 163 ], [ 165, 167 ], [ 169 ], [ 173 ], [ 175 ], [ 177, 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 193 ], [ 199 ], [ 205 ], [ 213 ], [ 215 ], [ 217 ] ]
11,138
static int proxy_remove(FsContext *ctx, const char *path) { int retval; V9fsString name; v9fs_string_init(&name); v9fs_string_sprintf(&name, "%s", path); retval = v9fs_request(ctx->private, T_REMOVE, NULL, "s", &name); v9fs_string_free(&name); if (retval < 0) { errno = -retval; } return retval; }
false
qemu
494a8ebe713055d3946183f4b395f85a18b43e9e
static int proxy_remove(FsContext *ctx, const char *path) { int retval; V9fsString name; v9fs_string_init(&name); v9fs_string_sprintf(&name, "%s", path); retval = v9fs_request(ctx->private, T_REMOVE, NULL, "s", &name); v9fs_string_free(&name); if (retval < 0) { errno = -retval; } return retval; }
{ "code": [], "line_no": [] }
static int FUNC_0(FsContext *VAR_0, const char *VAR_1) { int VAR_2; V9fsString name; v9fs_string_init(&name); v9fs_string_sprintf(&name, "%s", VAR_1); VAR_2 = v9fs_request(VAR_0->private, T_REMOVE, NULL, "s", &name); v9fs_string_free(&name); if (VAR_2 < 0) { errno = -VAR_2; } return VAR_2; }
[ "static int FUNC_0(FsContext *VAR_0, const char *VAR_1)\n{", "int VAR_2;", "V9fsString name;", "v9fs_string_init(&name);", "v9fs_string_sprintf(&name, \"%s\", VAR_1);", "VAR_2 = v9fs_request(VAR_0->private, T_REMOVE, NULL, \"s\", &name);", "v9fs_string_free(&name);", "if (VAR_2 < 0) {", "errno = -VAR_2;", "}", "return VAR_2;", "}" ]
[ 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 ] ]
11,139
static uint64_t pxa2xx_ssp_read(void *opaque, hwaddr addr, unsigned size) { PXA2xxSSPState *s = (PXA2xxSSPState *) opaque; uint32_t retval; switch (addr) { case SSCR0: return s->sscr[0]; case SSCR1: return s->sscr[1]; case SSPSP: return s->sspsp; case SSTO: return s->ssto; case SSITR: return s->ssitr; case SSSR: return s->sssr | s->ssitr; case SSDR: if (!s->enable) return 0xffffffff; if (s->rx_level < 1) { printf("%s: SSP Rx Underrun\n", __FUNCTION__); return 0xffffffff; } s->rx_level --; retval = s->rx_fifo[s->rx_start ++]; s->rx_start &= 0xf; pxa2xx_ssp_fifo_update(s); return retval; case SSTSA: return s->sstsa; case SSRSA: return s->ssrsa; case SSTSS: return 0; case SSACD: return s->ssacd; default: printf("%s: Bad register " REG_FMT "\n", __FUNCTION__, addr); break; } return 0; }
false
qemu
a89f364ae8740dfc31b321eed9ee454e996dc3c1
static uint64_t pxa2xx_ssp_read(void *opaque, hwaddr addr, unsigned size) { PXA2xxSSPState *s = (PXA2xxSSPState *) opaque; uint32_t retval; switch (addr) { case SSCR0: return s->sscr[0]; case SSCR1: return s->sscr[1]; case SSPSP: return s->sspsp; case SSTO: return s->ssto; case SSITR: return s->ssitr; case SSSR: return s->sssr | s->ssitr; case SSDR: if (!s->enable) return 0xffffffff; if (s->rx_level < 1) { printf("%s: SSP Rx Underrun\n", __FUNCTION__); return 0xffffffff; } s->rx_level --; retval = s->rx_fifo[s->rx_start ++]; s->rx_start &= 0xf; pxa2xx_ssp_fifo_update(s); return retval; case SSTSA: return s->sstsa; case SSRSA: return s->ssrsa; case SSTSS: return 0; case SSACD: return s->ssacd; default: printf("%s: Bad register " REG_FMT "\n", __FUNCTION__, addr); break; } return 0; }
{ "code": [], "line_no": [] }
static uint64_t FUNC_0(void *opaque, hwaddr addr, unsigned size) { PXA2xxSSPState *s = (PXA2xxSSPState *) opaque; uint32_t retval; switch (addr) { case SSCR0: return s->sscr[0]; case SSCR1: return s->sscr[1]; case SSPSP: return s->sspsp; case SSTO: return s->ssto; case SSITR: return s->ssitr; case SSSR: return s->sssr | s->ssitr; case SSDR: if (!s->enable) return 0xffffffff; if (s->rx_level < 1) { printf("%s: SSP Rx Underrun\n", __FUNCTION__); return 0xffffffff; } s->rx_level --; retval = s->rx_fifo[s->rx_start ++]; s->rx_start &= 0xf; pxa2xx_ssp_fifo_update(s); return retval; case SSTSA: return s->sstsa; case SSRSA: return s->ssrsa; case SSTSS: return 0; case SSACD: return s->ssacd; default: printf("%s: Bad register " REG_FMT "\n", __FUNCTION__, addr); break; } return 0; }
[ "static uint64_t FUNC_0(void *opaque, hwaddr addr,\nunsigned size)\n{", "PXA2xxSSPState *s = (PXA2xxSSPState *) opaque;", "uint32_t retval;", "switch (addr) {", "case SSCR0:\nreturn s->sscr[0];", "case SSCR1:\nreturn s->sscr[1];", "case SSPSP:\nreturn s->sspsp;", "case SSTO:\nreturn s->ssto;", "case SSITR:\nreturn s->ssitr;", "case SSSR:\nreturn s->sssr | s->ssitr;", "case SSDR:\nif (!s->enable)\nreturn 0xffffffff;", "if (s->rx_level < 1) {", "printf(\"%s: SSP Rx Underrun\\n\", __FUNCTION__);", "return 0xffffffff;", "}", "s->rx_level --;", "retval = s->rx_fifo[s->rx_start ++];", "s->rx_start &= 0xf;", "pxa2xx_ssp_fifo_update(s);", "return retval;", "case SSTSA:\nreturn s->sstsa;", "case SSRSA:\nreturn s->ssrsa;", "case SSTSS:\nreturn 0;", "case SSACD:\nreturn s->ssacd;", "default:\nprintf(\"%s: Bad register \" REG_FMT \"\\n\", __FUNCTION__, addr);", "break;", "}", "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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15, 17 ], [ 19, 21 ], [ 23, 25 ], [ 27, 29 ], [ 31, 33 ], [ 35, 37 ], [ 39, 41, 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63, 65 ], [ 67, 69 ], [ 71, 73 ], [ 75, 77 ], [ 79, 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ] ]
11,144
static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args, const int *const_args) { int c, vexop, rexw = 0; #if TCG_TARGET_REG_BITS == 64 # define OP_32_64(x) \ case glue(glue(INDEX_op_, x), _i64): \ rexw = P_REXW; /* FALLTHRU */ \ case glue(glue(INDEX_op_, x), _i32) #else # define OP_32_64(x) \ case glue(glue(INDEX_op_, x), _i32) #endif switch(opc) { case INDEX_op_exit_tb: tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_EAX, args[0]); tcg_out_jmp(s, tb_ret_addr); break; case INDEX_op_goto_tb: if (s->tb_jmp_offset) { /* direct jump method */ tcg_out8(s, OPC_JMP_long); /* jmp im */ s->tb_jmp_offset[args[0]] = tcg_current_code_size(s); tcg_out32(s, 0); } else { /* indirect jump method */ tcg_out_modrm_offset(s, OPC_GRP5, EXT5_JMPN_Ev, -1, (intptr_t)(s->tb_next + args[0])); } s->tb_next_offset[args[0]] = tcg_current_code_size(s); break; case INDEX_op_br: tcg_out_jxx(s, JCC_JMP, args[0], 0); break; OP_32_64(ld8u): /* Note that we can ignore REXW for the zero-extend to 64-bit. */ tcg_out_modrm_offset(s, OPC_MOVZBL, args[0], args[1], args[2]); break; OP_32_64(ld8s): tcg_out_modrm_offset(s, OPC_MOVSBL + rexw, args[0], args[1], args[2]); break; OP_32_64(ld16u): /* Note that we can ignore REXW for the zero-extend to 64-bit. */ tcg_out_modrm_offset(s, OPC_MOVZWL, args[0], args[1], args[2]); break; OP_32_64(ld16s): tcg_out_modrm_offset(s, OPC_MOVSWL + rexw, args[0], args[1], args[2]); break; #if TCG_TARGET_REG_BITS == 64 case INDEX_op_ld32u_i64: #endif case INDEX_op_ld_i32: tcg_out_ld(s, TCG_TYPE_I32, args[0], args[1], args[2]); break; OP_32_64(st8): if (const_args[0]) { tcg_out_modrm_offset(s, OPC_MOVB_EvIz, 0, args[1], args[2]); tcg_out8(s, args[0]); } else { tcg_out_modrm_offset(s, OPC_MOVB_EvGv | P_REXB_R, args[0], args[1], args[2]); } break; OP_32_64(st16): if (const_args[0]) { tcg_out_modrm_offset(s, OPC_MOVL_EvIz | P_DATA16, 0, args[1], args[2]); tcg_out16(s, args[0]); } else { tcg_out_modrm_offset(s, OPC_MOVL_EvGv | P_DATA16, args[0], args[1], args[2]); } break; #if TCG_TARGET_REG_BITS == 64 case INDEX_op_st32_i64: #endif case INDEX_op_st_i32: if (const_args[0]) { tcg_out_modrm_offset(s, OPC_MOVL_EvIz, 0, args[1], args[2]); tcg_out32(s, args[0]); } else { tcg_out_st(s, TCG_TYPE_I32, args[0], args[1], args[2]); } break; OP_32_64(add): /* For 3-operand addition, use LEA. */ if (args[0] != args[1]) { TCGArg a0 = args[0], a1 = args[1], a2 = args[2], c3 = 0; if (const_args[2]) { c3 = a2, a2 = -1; } else if (a0 == a2) { /* Watch out for dest = src + dest, since we've removed the matching constraint on the add. */ tgen_arithr(s, ARITH_ADD + rexw, a0, a1); break; } tcg_out_modrm_sib_offset(s, OPC_LEA + rexw, a0, a1, a2, 0, c3); break; } c = ARITH_ADD; goto gen_arith; OP_32_64(sub): c = ARITH_SUB; goto gen_arith; OP_32_64(and): c = ARITH_AND; goto gen_arith; OP_32_64(or): c = ARITH_OR; goto gen_arith; OP_32_64(xor): c = ARITH_XOR; goto gen_arith; gen_arith: if (const_args[2]) { tgen_arithi(s, c + rexw, args[0], args[2], 0); } else { tgen_arithr(s, c + rexw, args[0], args[2]); } break; OP_32_64(andc): if (const_args[2]) { tcg_out_mov(s, rexw ? TCG_TYPE_I64 : TCG_TYPE_I32, args[0], args[1]); tgen_arithi(s, ARITH_AND + rexw, args[0], ~args[2], 0); } else { tcg_out_vex_modrm(s, OPC_ANDN + rexw, args[0], args[2], args[1]); } break; OP_32_64(mul): if (const_args[2]) { int32_t val; val = args[2]; if (val == (int8_t)val) { tcg_out_modrm(s, OPC_IMUL_GvEvIb + rexw, args[0], args[0]); tcg_out8(s, val); } else { tcg_out_modrm(s, OPC_IMUL_GvEvIz + rexw, args[0], args[0]); tcg_out32(s, val); } } else { tcg_out_modrm(s, OPC_IMUL_GvEv + rexw, args[0], args[2]); } break; OP_32_64(div2): tcg_out_modrm(s, OPC_GRP3_Ev + rexw, EXT3_IDIV, args[4]); break; OP_32_64(divu2): tcg_out_modrm(s, OPC_GRP3_Ev + rexw, EXT3_DIV, args[4]); break; OP_32_64(shl): c = SHIFT_SHL; vexop = OPC_SHLX; goto gen_shift_maybe_vex; OP_32_64(shr): c = SHIFT_SHR; vexop = OPC_SHRX; goto gen_shift_maybe_vex; OP_32_64(sar): c = SHIFT_SAR; vexop = OPC_SARX; goto gen_shift_maybe_vex; OP_32_64(rotl): c = SHIFT_ROL; goto gen_shift; OP_32_64(rotr): c = SHIFT_ROR; goto gen_shift; gen_shift_maybe_vex: if (have_bmi2 && !const_args[2]) { tcg_out_vex_modrm(s, vexop + rexw, args[0], args[2], args[1]); break; } /* FALLTHRU */ gen_shift: if (const_args[2]) { tcg_out_shifti(s, c + rexw, args[0], args[2]); } else { tcg_out_modrm(s, OPC_SHIFT_cl + rexw, c, args[0]); } break; case INDEX_op_brcond_i32: tcg_out_brcond32(s, args[2], args[0], args[1], const_args[1], args[3], 0); break; case INDEX_op_setcond_i32: tcg_out_setcond32(s, args[3], args[0], args[1], args[2], const_args[2]); break; case INDEX_op_movcond_i32: tcg_out_movcond32(s, args[5], args[0], args[1], args[2], const_args[2], args[3]); break; OP_32_64(bswap16): tcg_out_rolw_8(s, args[0]); break; OP_32_64(bswap32): tcg_out_bswap32(s, args[0]); break; OP_32_64(neg): tcg_out_modrm(s, OPC_GRP3_Ev + rexw, EXT3_NEG, args[0]); break; OP_32_64(not): tcg_out_modrm(s, OPC_GRP3_Ev + rexw, EXT3_NOT, args[0]); break; OP_32_64(ext8s): tcg_out_ext8s(s, args[0], args[1], rexw); break; OP_32_64(ext16s): tcg_out_ext16s(s, args[0], args[1], rexw); break; OP_32_64(ext8u): tcg_out_ext8u(s, args[0], args[1]); break; OP_32_64(ext16u): tcg_out_ext16u(s, args[0], args[1]); break; case INDEX_op_qemu_ld_i32: tcg_out_qemu_ld(s, args, 0); break; case INDEX_op_qemu_ld_i64: tcg_out_qemu_ld(s, args, 1); break; case INDEX_op_qemu_st_i32: tcg_out_qemu_st(s, args, 0); break; case INDEX_op_qemu_st_i64: tcg_out_qemu_st(s, args, 1); break; OP_32_64(mulu2): tcg_out_modrm(s, OPC_GRP3_Ev + rexw, EXT3_MUL, args[3]); break; OP_32_64(muls2): tcg_out_modrm(s, OPC_GRP3_Ev + rexw, EXT3_IMUL, args[3]); break; OP_32_64(add2): if (const_args[4]) { tgen_arithi(s, ARITH_ADD + rexw, args[0], args[4], 1); } else { tgen_arithr(s, ARITH_ADD + rexw, args[0], args[4]); } if (const_args[5]) { tgen_arithi(s, ARITH_ADC + rexw, args[1], args[5], 1); } else { tgen_arithr(s, ARITH_ADC + rexw, args[1], args[5]); } break; OP_32_64(sub2): if (const_args[4]) { tgen_arithi(s, ARITH_SUB + rexw, args[0], args[4], 1); } else { tgen_arithr(s, ARITH_SUB + rexw, args[0], args[4]); } if (const_args[5]) { tgen_arithi(s, ARITH_SBB + rexw, args[1], args[5], 1); } else { tgen_arithr(s, ARITH_SBB + rexw, args[1], args[5]); } break; #if TCG_TARGET_REG_BITS == 32 case INDEX_op_brcond2_i32: tcg_out_brcond2(s, args, const_args, 0); break; case INDEX_op_setcond2_i32: tcg_out_setcond2(s, args, const_args); break; #else /* TCG_TARGET_REG_BITS == 64 */ case INDEX_op_ld32s_i64: tcg_out_modrm_offset(s, OPC_MOVSLQ, args[0], args[1], args[2]); break; case INDEX_op_ld_i64: tcg_out_ld(s, TCG_TYPE_I64, args[0], args[1], args[2]); break; case INDEX_op_st_i64: if (const_args[0]) { tcg_out_modrm_offset(s, OPC_MOVL_EvIz | P_REXW, 0, args[1], args[2]); tcg_out32(s, args[0]); } else { tcg_out_st(s, TCG_TYPE_I64, args[0], args[1], args[2]); } break; case INDEX_op_brcond_i64: tcg_out_brcond64(s, args[2], args[0], args[1], const_args[1], args[3], 0); break; case INDEX_op_setcond_i64: tcg_out_setcond64(s, args[3], args[0], args[1], args[2], const_args[2]); break; case INDEX_op_movcond_i64: tcg_out_movcond64(s, args[5], args[0], args[1], args[2], const_args[2], args[3]); break; case INDEX_op_bswap64_i64: tcg_out_bswap64(s, args[0]); break; case INDEX_op_ext32u_i64: tcg_out_ext32u(s, args[0], args[1]); break; case INDEX_op_ext32s_i64: tcg_out_ext32s(s, args[0], args[1]); break; #endif OP_32_64(deposit): if (args[3] == 0 && args[4] == 8) { /* load bits 0..7 */ tcg_out_modrm(s, OPC_MOVB_EvGv | P_REXB_R | P_REXB_RM, args[2], args[0]); } else if (args[3] == 8 && args[4] == 8) { /* load bits 8..15 */ tcg_out_modrm(s, OPC_MOVB_EvGv, args[2], args[0] + 4); } else if (args[3] == 0 && args[4] == 16) { /* load bits 0..15 */ tcg_out_modrm(s, OPC_MOVL_EvGv | P_DATA16, args[2], args[0]); } else { tcg_abort(); } break; case INDEX_op_mov_i32: /* Always emitted via tcg_out_mov. */ case INDEX_op_mov_i64: case INDEX_op_movi_i32: /* Always emitted via tcg_out_movi. */ case INDEX_op_movi_i64: case INDEX_op_call: /* Always emitted via tcg_out_call. */ default: tcg_abort(); } #undef OP_32_64 }
false
qemu
bec1631100323fac0900aea71043d5c4e22fc2fa
static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args, const int *const_args) { int c, vexop, rexw = 0; #if TCG_TARGET_REG_BITS == 64 # define OP_32_64(x) \ case glue(glue(INDEX_op_, x), _i64): \ rexw = P_REXW; \ case glue(glue(INDEX_op_, x), _i32) #else # define OP_32_64(x) \ case glue(glue(INDEX_op_, x), _i32) #endif switch(opc) { case INDEX_op_exit_tb: tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_EAX, args[0]); tcg_out_jmp(s, tb_ret_addr); break; case INDEX_op_goto_tb: if (s->tb_jmp_offset) { tcg_out8(s, OPC_JMP_long); s->tb_jmp_offset[args[0]] = tcg_current_code_size(s); tcg_out32(s, 0); } else { tcg_out_modrm_offset(s, OPC_GRP5, EXT5_JMPN_Ev, -1, (intptr_t)(s->tb_next + args[0])); } s->tb_next_offset[args[0]] = tcg_current_code_size(s); break; case INDEX_op_br: tcg_out_jxx(s, JCC_JMP, args[0], 0); break; OP_32_64(ld8u): tcg_out_modrm_offset(s, OPC_MOVZBL, args[0], args[1], args[2]); break; OP_32_64(ld8s): tcg_out_modrm_offset(s, OPC_MOVSBL + rexw, args[0], args[1], args[2]); break; OP_32_64(ld16u): tcg_out_modrm_offset(s, OPC_MOVZWL, args[0], args[1], args[2]); break; OP_32_64(ld16s): tcg_out_modrm_offset(s, OPC_MOVSWL + rexw, args[0], args[1], args[2]); break; #if TCG_TARGET_REG_BITS == 64 case INDEX_op_ld32u_i64: #endif case INDEX_op_ld_i32: tcg_out_ld(s, TCG_TYPE_I32, args[0], args[1], args[2]); break; OP_32_64(st8): if (const_args[0]) { tcg_out_modrm_offset(s, OPC_MOVB_EvIz, 0, args[1], args[2]); tcg_out8(s, args[0]); } else { tcg_out_modrm_offset(s, OPC_MOVB_EvGv | P_REXB_R, args[0], args[1], args[2]); } break; OP_32_64(st16): if (const_args[0]) { tcg_out_modrm_offset(s, OPC_MOVL_EvIz | P_DATA16, 0, args[1], args[2]); tcg_out16(s, args[0]); } else { tcg_out_modrm_offset(s, OPC_MOVL_EvGv | P_DATA16, args[0], args[1], args[2]); } break; #if TCG_TARGET_REG_BITS == 64 case INDEX_op_st32_i64: #endif case INDEX_op_st_i32: if (const_args[0]) { tcg_out_modrm_offset(s, OPC_MOVL_EvIz, 0, args[1], args[2]); tcg_out32(s, args[0]); } else { tcg_out_st(s, TCG_TYPE_I32, args[0], args[1], args[2]); } break; OP_32_64(add): if (args[0] != args[1]) { TCGArg a0 = args[0], a1 = args[1], a2 = args[2], c3 = 0; if (const_args[2]) { c3 = a2, a2 = -1; } else if (a0 == a2) { tgen_arithr(s, ARITH_ADD + rexw, a0, a1); break; } tcg_out_modrm_sib_offset(s, OPC_LEA + rexw, a0, a1, a2, 0, c3); break; } c = ARITH_ADD; goto gen_arith; OP_32_64(sub): c = ARITH_SUB; goto gen_arith; OP_32_64(and): c = ARITH_AND; goto gen_arith; OP_32_64(or): c = ARITH_OR; goto gen_arith; OP_32_64(xor): c = ARITH_XOR; goto gen_arith; gen_arith: if (const_args[2]) { tgen_arithi(s, c + rexw, args[0], args[2], 0); } else { tgen_arithr(s, c + rexw, args[0], args[2]); } break; OP_32_64(andc): if (const_args[2]) { tcg_out_mov(s, rexw ? TCG_TYPE_I64 : TCG_TYPE_I32, args[0], args[1]); tgen_arithi(s, ARITH_AND + rexw, args[0], ~args[2], 0); } else { tcg_out_vex_modrm(s, OPC_ANDN + rexw, args[0], args[2], args[1]); } break; OP_32_64(mul): if (const_args[2]) { int32_t val; val = args[2]; if (val == (int8_t)val) { tcg_out_modrm(s, OPC_IMUL_GvEvIb + rexw, args[0], args[0]); tcg_out8(s, val); } else { tcg_out_modrm(s, OPC_IMUL_GvEvIz + rexw, args[0], args[0]); tcg_out32(s, val); } } else { tcg_out_modrm(s, OPC_IMUL_GvEv + rexw, args[0], args[2]); } break; OP_32_64(div2): tcg_out_modrm(s, OPC_GRP3_Ev + rexw, EXT3_IDIV, args[4]); break; OP_32_64(divu2): tcg_out_modrm(s, OPC_GRP3_Ev + rexw, EXT3_DIV, args[4]); break; OP_32_64(shl): c = SHIFT_SHL; vexop = OPC_SHLX; goto gen_shift_maybe_vex; OP_32_64(shr): c = SHIFT_SHR; vexop = OPC_SHRX; goto gen_shift_maybe_vex; OP_32_64(sar): c = SHIFT_SAR; vexop = OPC_SARX; goto gen_shift_maybe_vex; OP_32_64(rotl): c = SHIFT_ROL; goto gen_shift; OP_32_64(rotr): c = SHIFT_ROR; goto gen_shift; gen_shift_maybe_vex: if (have_bmi2 && !const_args[2]) { tcg_out_vex_modrm(s, vexop + rexw, args[0], args[2], args[1]); break; } gen_shift: if (const_args[2]) { tcg_out_shifti(s, c + rexw, args[0], args[2]); } else { tcg_out_modrm(s, OPC_SHIFT_cl + rexw, c, args[0]); } break; case INDEX_op_brcond_i32: tcg_out_brcond32(s, args[2], args[0], args[1], const_args[1], args[3], 0); break; case INDEX_op_setcond_i32: tcg_out_setcond32(s, args[3], args[0], args[1], args[2], const_args[2]); break; case INDEX_op_movcond_i32: tcg_out_movcond32(s, args[5], args[0], args[1], args[2], const_args[2], args[3]); break; OP_32_64(bswap16): tcg_out_rolw_8(s, args[0]); break; OP_32_64(bswap32): tcg_out_bswap32(s, args[0]); break; OP_32_64(neg): tcg_out_modrm(s, OPC_GRP3_Ev + rexw, EXT3_NEG, args[0]); break; OP_32_64(not): tcg_out_modrm(s, OPC_GRP3_Ev + rexw, EXT3_NOT, args[0]); break; OP_32_64(ext8s): tcg_out_ext8s(s, args[0], args[1], rexw); break; OP_32_64(ext16s): tcg_out_ext16s(s, args[0], args[1], rexw); break; OP_32_64(ext8u): tcg_out_ext8u(s, args[0], args[1]); break; OP_32_64(ext16u): tcg_out_ext16u(s, args[0], args[1]); break; case INDEX_op_qemu_ld_i32: tcg_out_qemu_ld(s, args, 0); break; case INDEX_op_qemu_ld_i64: tcg_out_qemu_ld(s, args, 1); break; case INDEX_op_qemu_st_i32: tcg_out_qemu_st(s, args, 0); break; case INDEX_op_qemu_st_i64: tcg_out_qemu_st(s, args, 1); break; OP_32_64(mulu2): tcg_out_modrm(s, OPC_GRP3_Ev + rexw, EXT3_MUL, args[3]); break; OP_32_64(muls2): tcg_out_modrm(s, OPC_GRP3_Ev + rexw, EXT3_IMUL, args[3]); break; OP_32_64(add2): if (const_args[4]) { tgen_arithi(s, ARITH_ADD + rexw, args[0], args[4], 1); } else { tgen_arithr(s, ARITH_ADD + rexw, args[0], args[4]); } if (const_args[5]) { tgen_arithi(s, ARITH_ADC + rexw, args[1], args[5], 1); } else { tgen_arithr(s, ARITH_ADC + rexw, args[1], args[5]); } break; OP_32_64(sub2): if (const_args[4]) { tgen_arithi(s, ARITH_SUB + rexw, args[0], args[4], 1); } else { tgen_arithr(s, ARITH_SUB + rexw, args[0], args[4]); } if (const_args[5]) { tgen_arithi(s, ARITH_SBB + rexw, args[1], args[5], 1); } else { tgen_arithr(s, ARITH_SBB + rexw, args[1], args[5]); } break; #if TCG_TARGET_REG_BITS == 32 case INDEX_op_brcond2_i32: tcg_out_brcond2(s, args, const_args, 0); break; case INDEX_op_setcond2_i32: tcg_out_setcond2(s, args, const_args); break; #else case INDEX_op_ld32s_i64: tcg_out_modrm_offset(s, OPC_MOVSLQ, args[0], args[1], args[2]); break; case INDEX_op_ld_i64: tcg_out_ld(s, TCG_TYPE_I64, args[0], args[1], args[2]); break; case INDEX_op_st_i64: if (const_args[0]) { tcg_out_modrm_offset(s, OPC_MOVL_EvIz | P_REXW, 0, args[1], args[2]); tcg_out32(s, args[0]); } else { tcg_out_st(s, TCG_TYPE_I64, args[0], args[1], args[2]); } break; case INDEX_op_brcond_i64: tcg_out_brcond64(s, args[2], args[0], args[1], const_args[1], args[3], 0); break; case INDEX_op_setcond_i64: tcg_out_setcond64(s, args[3], args[0], args[1], args[2], const_args[2]); break; case INDEX_op_movcond_i64: tcg_out_movcond64(s, args[5], args[0], args[1], args[2], const_args[2], args[3]); break; case INDEX_op_bswap64_i64: tcg_out_bswap64(s, args[0]); break; case INDEX_op_ext32u_i64: tcg_out_ext32u(s, args[0], args[1]); break; case INDEX_op_ext32s_i64: tcg_out_ext32s(s, args[0], args[1]); break; #endif OP_32_64(deposit): if (args[3] == 0 && args[4] == 8) { tcg_out_modrm(s, OPC_MOVB_EvGv | P_REXB_R | P_REXB_RM, args[2], args[0]); } else if (args[3] == 8 && args[4] == 8) { tcg_out_modrm(s, OPC_MOVB_EvGv, args[2], args[0] + 4); } else if (args[3] == 0 && args[4] == 16) { tcg_out_modrm(s, OPC_MOVL_EvGv | P_DATA16, args[2], args[0]); } else { tcg_abort(); } break; case INDEX_op_mov_i32: case INDEX_op_mov_i64: case INDEX_op_movi_i32: case INDEX_op_movi_i64: case INDEX_op_call: default: tcg_abort(); } #undef OP_32_64 }
{ "code": [], "line_no": [] }
static inline void FUNC_0(TCGContext *VAR_0, TCGOpcode VAR_1, const TCGArg *VAR_2, const int *VAR_3) { int VAR_4, VAR_5, VAR_6 = 0; #if TCG_TARGET_REG_BITS == 64 # define OP_32_64(x) \ case glue(glue(INDEX_op_, x), _i64): \ VAR_6 = P_REXW; \ case glue(glue(INDEX_op_, x), _i32) #else # define OP_32_64(x) \ case glue(glue(INDEX_op_, x), _i32) #endif switch(VAR_1) { case INDEX_op_exit_tb: tcg_out_movi(VAR_0, TCG_TYPE_PTR, TCG_REG_EAX, VAR_2[0]); tcg_out_jmp(VAR_0, tb_ret_addr); break; case INDEX_op_goto_tb: if (VAR_0->tb_jmp_offset) { tcg_out8(VAR_0, OPC_JMP_long); VAR_0->tb_jmp_offset[VAR_2[0]] = tcg_current_code_size(VAR_0); tcg_out32(VAR_0, 0); } else { tcg_out_modrm_offset(VAR_0, OPC_GRP5, EXT5_JMPN_Ev, -1, (intptr_t)(VAR_0->tb_next + VAR_2[0])); } VAR_0->tb_next_offset[VAR_2[0]] = tcg_current_code_size(VAR_0); break; case INDEX_op_br: tcg_out_jxx(VAR_0, JCC_JMP, VAR_2[0], 0); break; OP_32_64(ld8u): tcg_out_modrm_offset(VAR_0, OPC_MOVZBL, VAR_2[0], VAR_2[1], VAR_2[2]); break; OP_32_64(ld8s): tcg_out_modrm_offset(VAR_0, OPC_MOVSBL + VAR_6, VAR_2[0], VAR_2[1], VAR_2[2]); break; OP_32_64(ld16u): tcg_out_modrm_offset(VAR_0, OPC_MOVZWL, VAR_2[0], VAR_2[1], VAR_2[2]); break; OP_32_64(ld16s): tcg_out_modrm_offset(VAR_0, OPC_MOVSWL + VAR_6, VAR_2[0], VAR_2[1], VAR_2[2]); break; #if TCG_TARGET_REG_BITS == 64 case INDEX_op_ld32u_i64: #endif case INDEX_op_ld_i32: tcg_out_ld(VAR_0, TCG_TYPE_I32, VAR_2[0], VAR_2[1], VAR_2[2]); break; OP_32_64(st8): if (VAR_3[0]) { tcg_out_modrm_offset(VAR_0, OPC_MOVB_EvIz, 0, VAR_2[1], VAR_2[2]); tcg_out8(VAR_0, VAR_2[0]); } else { tcg_out_modrm_offset(VAR_0, OPC_MOVB_EvGv | P_REXB_R, VAR_2[0], VAR_2[1], VAR_2[2]); } break; OP_32_64(st16): if (VAR_3[0]) { tcg_out_modrm_offset(VAR_0, OPC_MOVL_EvIz | P_DATA16, 0, VAR_2[1], VAR_2[2]); tcg_out16(VAR_0, VAR_2[0]); } else { tcg_out_modrm_offset(VAR_0, OPC_MOVL_EvGv | P_DATA16, VAR_2[0], VAR_2[1], VAR_2[2]); } break; #if TCG_TARGET_REG_BITS == 64 case INDEX_op_st32_i64: #endif case INDEX_op_st_i32: if (VAR_3[0]) { tcg_out_modrm_offset(VAR_0, OPC_MOVL_EvIz, 0, VAR_2[1], VAR_2[2]); tcg_out32(VAR_0, VAR_2[0]); } else { tcg_out_st(VAR_0, TCG_TYPE_I32, VAR_2[0], VAR_2[1], VAR_2[2]); } break; OP_32_64(add): if (VAR_2[0] != VAR_2[1]) { TCGArg a0 = VAR_2[0], a1 = VAR_2[1], a2 = VAR_2[2], c3 = 0; if (VAR_3[2]) { c3 = a2, a2 = -1; } else if (a0 == a2) { tgen_arithr(VAR_0, ARITH_ADD + VAR_6, a0, a1); break; } tcg_out_modrm_sib_offset(VAR_0, OPC_LEA + VAR_6, a0, a1, a2, 0, c3); break; } VAR_4 = ARITH_ADD; goto gen_arith; OP_32_64(sub): VAR_4 = ARITH_SUB; goto gen_arith; OP_32_64(and): VAR_4 = ARITH_AND; goto gen_arith; OP_32_64(or): VAR_4 = ARITH_OR; goto gen_arith; OP_32_64(xor): VAR_4 = ARITH_XOR; goto gen_arith; gen_arith: if (VAR_3[2]) { tgen_arithi(VAR_0, VAR_4 + VAR_6, VAR_2[0], VAR_2[2], 0); } else { tgen_arithr(VAR_0, VAR_4 + VAR_6, VAR_2[0], VAR_2[2]); } break; OP_32_64(andc): if (VAR_3[2]) { tcg_out_mov(VAR_0, VAR_6 ? TCG_TYPE_I64 : TCG_TYPE_I32, VAR_2[0], VAR_2[1]); tgen_arithi(VAR_0, ARITH_AND + VAR_6, VAR_2[0], ~VAR_2[2], 0); } else { tcg_out_vex_modrm(VAR_0, OPC_ANDN + VAR_6, VAR_2[0], VAR_2[2], VAR_2[1]); } break; OP_32_64(mul): if (VAR_3[2]) { int32_t val; val = VAR_2[2]; if (val == (int8_t)val) { tcg_out_modrm(VAR_0, OPC_IMUL_GvEvIb + VAR_6, VAR_2[0], VAR_2[0]); tcg_out8(VAR_0, val); } else { tcg_out_modrm(VAR_0, OPC_IMUL_GvEvIz + VAR_6, VAR_2[0], VAR_2[0]); tcg_out32(VAR_0, val); } } else { tcg_out_modrm(VAR_0, OPC_IMUL_GvEv + VAR_6, VAR_2[0], VAR_2[2]); } break; OP_32_64(div2): tcg_out_modrm(VAR_0, OPC_GRP3_Ev + VAR_6, EXT3_IDIV, VAR_2[4]); break; OP_32_64(divu2): tcg_out_modrm(VAR_0, OPC_GRP3_Ev + VAR_6, EXT3_DIV, VAR_2[4]); break; OP_32_64(shl): VAR_4 = SHIFT_SHL; VAR_5 = OPC_SHLX; goto gen_shift_maybe_vex; OP_32_64(shr): VAR_4 = SHIFT_SHR; VAR_5 = OPC_SHRX; goto gen_shift_maybe_vex; OP_32_64(sar): VAR_4 = SHIFT_SAR; VAR_5 = OPC_SARX; goto gen_shift_maybe_vex; OP_32_64(rotl): VAR_4 = SHIFT_ROL; goto gen_shift; OP_32_64(rotr): VAR_4 = SHIFT_ROR; goto gen_shift; gen_shift_maybe_vex: if (have_bmi2 && !VAR_3[2]) { tcg_out_vex_modrm(VAR_0, VAR_5 + VAR_6, VAR_2[0], VAR_2[2], VAR_2[1]); break; } gen_shift: if (VAR_3[2]) { tcg_out_shifti(VAR_0, VAR_4 + VAR_6, VAR_2[0], VAR_2[2]); } else { tcg_out_modrm(VAR_0, OPC_SHIFT_cl + VAR_6, VAR_4, VAR_2[0]); } break; case INDEX_op_brcond_i32: tcg_out_brcond32(VAR_0, VAR_2[2], VAR_2[0], VAR_2[1], VAR_3[1], VAR_2[3], 0); break; case INDEX_op_setcond_i32: tcg_out_setcond32(VAR_0, VAR_2[3], VAR_2[0], VAR_2[1], VAR_2[2], VAR_3[2]); break; case INDEX_op_movcond_i32: tcg_out_movcond32(VAR_0, VAR_2[5], VAR_2[0], VAR_2[1], VAR_2[2], VAR_3[2], VAR_2[3]); break; OP_32_64(bswap16): tcg_out_rolw_8(VAR_0, VAR_2[0]); break; OP_32_64(bswap32): tcg_out_bswap32(VAR_0, VAR_2[0]); break; OP_32_64(neg): tcg_out_modrm(VAR_0, OPC_GRP3_Ev + VAR_6, EXT3_NEG, VAR_2[0]); break; OP_32_64(not): tcg_out_modrm(VAR_0, OPC_GRP3_Ev + VAR_6, EXT3_NOT, VAR_2[0]); break; OP_32_64(ext8s): tcg_out_ext8s(VAR_0, VAR_2[0], VAR_2[1], VAR_6); break; OP_32_64(ext16s): tcg_out_ext16s(VAR_0, VAR_2[0], VAR_2[1], VAR_6); break; OP_32_64(ext8u): tcg_out_ext8u(VAR_0, VAR_2[0], VAR_2[1]); break; OP_32_64(ext16u): tcg_out_ext16u(VAR_0, VAR_2[0], VAR_2[1]); break; case INDEX_op_qemu_ld_i32: tcg_out_qemu_ld(VAR_0, VAR_2, 0); break; case INDEX_op_qemu_ld_i64: tcg_out_qemu_ld(VAR_0, VAR_2, 1); break; case INDEX_op_qemu_st_i32: tcg_out_qemu_st(VAR_0, VAR_2, 0); break; case INDEX_op_qemu_st_i64: tcg_out_qemu_st(VAR_0, VAR_2, 1); break; OP_32_64(mulu2): tcg_out_modrm(VAR_0, OPC_GRP3_Ev + VAR_6, EXT3_MUL, VAR_2[3]); break; OP_32_64(muls2): tcg_out_modrm(VAR_0, OPC_GRP3_Ev + VAR_6, EXT3_IMUL, VAR_2[3]); break; OP_32_64(add2): if (VAR_3[4]) { tgen_arithi(VAR_0, ARITH_ADD + VAR_6, VAR_2[0], VAR_2[4], 1); } else { tgen_arithr(VAR_0, ARITH_ADD + VAR_6, VAR_2[0], VAR_2[4]); } if (VAR_3[5]) { tgen_arithi(VAR_0, ARITH_ADC + VAR_6, VAR_2[1], VAR_2[5], 1); } else { tgen_arithr(VAR_0, ARITH_ADC + VAR_6, VAR_2[1], VAR_2[5]); } break; OP_32_64(sub2): if (VAR_3[4]) { tgen_arithi(VAR_0, ARITH_SUB + VAR_6, VAR_2[0], VAR_2[4], 1); } else { tgen_arithr(VAR_0, ARITH_SUB + VAR_6, VAR_2[0], VAR_2[4]); } if (VAR_3[5]) { tgen_arithi(VAR_0, ARITH_SBB + VAR_6, VAR_2[1], VAR_2[5], 1); } else { tgen_arithr(VAR_0, ARITH_SBB + VAR_6, VAR_2[1], VAR_2[5]); } break; #if TCG_TARGET_REG_BITS == 32 case INDEX_op_brcond2_i32: tcg_out_brcond2(VAR_0, VAR_2, VAR_3, 0); break; case INDEX_op_setcond2_i32: tcg_out_setcond2(VAR_0, VAR_2, VAR_3); break; #else case INDEX_op_ld32s_i64: tcg_out_modrm_offset(VAR_0, OPC_MOVSLQ, VAR_2[0], VAR_2[1], VAR_2[2]); break; case INDEX_op_ld_i64: tcg_out_ld(VAR_0, TCG_TYPE_I64, VAR_2[0], VAR_2[1], VAR_2[2]); break; case INDEX_op_st_i64: if (VAR_3[0]) { tcg_out_modrm_offset(VAR_0, OPC_MOVL_EvIz | P_REXW, 0, VAR_2[1], VAR_2[2]); tcg_out32(VAR_0, VAR_2[0]); } else { tcg_out_st(VAR_0, TCG_TYPE_I64, VAR_2[0], VAR_2[1], VAR_2[2]); } break; case INDEX_op_brcond_i64: tcg_out_brcond64(VAR_0, VAR_2[2], VAR_2[0], VAR_2[1], VAR_3[1], VAR_2[3], 0); break; case INDEX_op_setcond_i64: tcg_out_setcond64(VAR_0, VAR_2[3], VAR_2[0], VAR_2[1], VAR_2[2], VAR_3[2]); break; case INDEX_op_movcond_i64: tcg_out_movcond64(VAR_0, VAR_2[5], VAR_2[0], VAR_2[1], VAR_2[2], VAR_3[2], VAR_2[3]); break; case INDEX_op_bswap64_i64: tcg_out_bswap64(VAR_0, VAR_2[0]); break; case INDEX_op_ext32u_i64: tcg_out_ext32u(VAR_0, VAR_2[0], VAR_2[1]); break; case INDEX_op_ext32s_i64: tcg_out_ext32s(VAR_0, VAR_2[0], VAR_2[1]); break; #endif OP_32_64(deposit): if (VAR_2[3] == 0 && VAR_2[4] == 8) { tcg_out_modrm(VAR_0, OPC_MOVB_EvGv | P_REXB_R | P_REXB_RM, VAR_2[2], VAR_2[0]); } else if (VAR_2[3] == 8 && VAR_2[4] == 8) { tcg_out_modrm(VAR_0, OPC_MOVB_EvGv, VAR_2[2], VAR_2[0] + 4); } else if (VAR_2[3] == 0 && VAR_2[4] == 16) { tcg_out_modrm(VAR_0, OPC_MOVL_EvGv | P_DATA16, VAR_2[2], VAR_2[0]); } else { tcg_abort(); } break; case INDEX_op_mov_i32: case INDEX_op_mov_i64: case INDEX_op_movi_i32: case INDEX_op_movi_i64: case INDEX_op_call: default: tcg_abort(); } #undef OP_32_64 }
[ "static inline void FUNC_0(TCGContext *VAR_0, TCGOpcode VAR_1,\nconst TCGArg *VAR_2, const int *VAR_3)\n{", "int VAR_4, VAR_5, VAR_6 = 0;", "#if TCG_TARGET_REG_BITS == 64\n# define OP_32_64(x) \\\ncase glue(glue(INDEX_op_, x), _i64): \\\nVAR_6 = P_REXW; \\", "case glue(glue(INDEX_op_, x), _i32)\n#else\n# define OP_32_64(x) \\\ncase glue(glue(INDEX_op_, x), _i32)\n#endif\nswitch(VAR_1) {", "case INDEX_op_exit_tb:\ntcg_out_movi(VAR_0, TCG_TYPE_PTR, TCG_REG_EAX, VAR_2[0]);", "tcg_out_jmp(VAR_0, tb_ret_addr);", "break;", "case INDEX_op_goto_tb:\nif (VAR_0->tb_jmp_offset) {", "tcg_out8(VAR_0, OPC_JMP_long);", "VAR_0->tb_jmp_offset[VAR_2[0]] = tcg_current_code_size(VAR_0);", "tcg_out32(VAR_0, 0);", "} else {", "tcg_out_modrm_offset(VAR_0, OPC_GRP5, EXT5_JMPN_Ev, -1,\n(intptr_t)(VAR_0->tb_next + VAR_2[0]));", "}", "VAR_0->tb_next_offset[VAR_2[0]] = tcg_current_code_size(VAR_0);", "break;", "case INDEX_op_br:\ntcg_out_jxx(VAR_0, JCC_JMP, VAR_2[0], 0);", "break;", "OP_32_64(ld8u):\ntcg_out_modrm_offset(VAR_0, OPC_MOVZBL, VAR_2[0], VAR_2[1], VAR_2[2]);", "break;", "OP_32_64(ld8s):\ntcg_out_modrm_offset(VAR_0, OPC_MOVSBL + VAR_6, VAR_2[0], VAR_2[1], VAR_2[2]);", "break;", "OP_32_64(ld16u):\ntcg_out_modrm_offset(VAR_0, OPC_MOVZWL, VAR_2[0], VAR_2[1], VAR_2[2]);", "break;", "OP_32_64(ld16s):\ntcg_out_modrm_offset(VAR_0, OPC_MOVSWL + VAR_6, VAR_2[0], VAR_2[1], VAR_2[2]);", "break;", "#if TCG_TARGET_REG_BITS == 64\ncase INDEX_op_ld32u_i64:\n#endif\ncase INDEX_op_ld_i32:\ntcg_out_ld(VAR_0, TCG_TYPE_I32, VAR_2[0], VAR_2[1], VAR_2[2]);", "break;", "OP_32_64(st8):\nif (VAR_3[0]) {", "tcg_out_modrm_offset(VAR_0, OPC_MOVB_EvIz,\n0, VAR_2[1], VAR_2[2]);", "tcg_out8(VAR_0, VAR_2[0]);", "} else {", "tcg_out_modrm_offset(VAR_0, OPC_MOVB_EvGv | P_REXB_R,\nVAR_2[0], VAR_2[1], VAR_2[2]);", "}", "break;", "OP_32_64(st16):\nif (VAR_3[0]) {", "tcg_out_modrm_offset(VAR_0, OPC_MOVL_EvIz | P_DATA16,\n0, VAR_2[1], VAR_2[2]);", "tcg_out16(VAR_0, VAR_2[0]);", "} else {", "tcg_out_modrm_offset(VAR_0, OPC_MOVL_EvGv | P_DATA16,\nVAR_2[0], VAR_2[1], VAR_2[2]);", "}", "break;", "#if TCG_TARGET_REG_BITS == 64\ncase INDEX_op_st32_i64:\n#endif\ncase INDEX_op_st_i32:\nif (VAR_3[0]) {", "tcg_out_modrm_offset(VAR_0, OPC_MOVL_EvIz, 0, VAR_2[1], VAR_2[2]);", "tcg_out32(VAR_0, VAR_2[0]);", "} else {", "tcg_out_st(VAR_0, TCG_TYPE_I32, VAR_2[0], VAR_2[1], VAR_2[2]);", "}", "break;", "OP_32_64(add):\nif (VAR_2[0] != VAR_2[1]) {", "TCGArg a0 = VAR_2[0], a1 = VAR_2[1], a2 = VAR_2[2], c3 = 0;", "if (VAR_3[2]) {", "c3 = a2, a2 = -1;", "} else if (a0 == a2) {", "tgen_arithr(VAR_0, ARITH_ADD + VAR_6, a0, a1);", "break;", "}", "tcg_out_modrm_sib_offset(VAR_0, OPC_LEA + VAR_6, a0, a1, a2, 0, c3);", "break;", "}", "VAR_4 = ARITH_ADD;", "goto gen_arith;", "OP_32_64(sub):\nVAR_4 = ARITH_SUB;", "goto gen_arith;", "OP_32_64(and):\nVAR_4 = ARITH_AND;", "goto gen_arith;", "OP_32_64(or):\nVAR_4 = ARITH_OR;", "goto gen_arith;", "OP_32_64(xor):\nVAR_4 = ARITH_XOR;", "goto gen_arith;", "gen_arith:\nif (VAR_3[2]) {", "tgen_arithi(VAR_0, VAR_4 + VAR_6, VAR_2[0], VAR_2[2], 0);", "} else {", "tgen_arithr(VAR_0, VAR_4 + VAR_6, VAR_2[0], VAR_2[2]);", "}", "break;", "OP_32_64(andc):\nif (VAR_3[2]) {", "tcg_out_mov(VAR_0, VAR_6 ? TCG_TYPE_I64 : TCG_TYPE_I32,\nVAR_2[0], VAR_2[1]);", "tgen_arithi(VAR_0, ARITH_AND + VAR_6, VAR_2[0], ~VAR_2[2], 0);", "} else {", "tcg_out_vex_modrm(VAR_0, OPC_ANDN + VAR_6, VAR_2[0], VAR_2[2], VAR_2[1]);", "}", "break;", "OP_32_64(mul):\nif (VAR_3[2]) {", "int32_t val;", "val = VAR_2[2];", "if (val == (int8_t)val) {", "tcg_out_modrm(VAR_0, OPC_IMUL_GvEvIb + VAR_6, VAR_2[0], VAR_2[0]);", "tcg_out8(VAR_0, val);", "} else {", "tcg_out_modrm(VAR_0, OPC_IMUL_GvEvIz + VAR_6, VAR_2[0], VAR_2[0]);", "tcg_out32(VAR_0, val);", "}", "} else {", "tcg_out_modrm(VAR_0, OPC_IMUL_GvEv + VAR_6, VAR_2[0], VAR_2[2]);", "}", "break;", "OP_32_64(div2):\ntcg_out_modrm(VAR_0, OPC_GRP3_Ev + VAR_6, EXT3_IDIV, VAR_2[4]);", "break;", "OP_32_64(divu2):\ntcg_out_modrm(VAR_0, OPC_GRP3_Ev + VAR_6, EXT3_DIV, VAR_2[4]);", "break;", "OP_32_64(shl):\nVAR_4 = SHIFT_SHL;", "VAR_5 = OPC_SHLX;", "goto gen_shift_maybe_vex;", "OP_32_64(shr):\nVAR_4 = SHIFT_SHR;", "VAR_5 = OPC_SHRX;", "goto gen_shift_maybe_vex;", "OP_32_64(sar):\nVAR_4 = SHIFT_SAR;", "VAR_5 = OPC_SARX;", "goto gen_shift_maybe_vex;", "OP_32_64(rotl):\nVAR_4 = SHIFT_ROL;", "goto gen_shift;", "OP_32_64(rotr):\nVAR_4 = SHIFT_ROR;", "goto gen_shift;", "gen_shift_maybe_vex:\nif (have_bmi2 && !VAR_3[2]) {", "tcg_out_vex_modrm(VAR_0, VAR_5 + VAR_6, VAR_2[0], VAR_2[2], VAR_2[1]);", "break;", "}", "gen_shift:\nif (VAR_3[2]) {", "tcg_out_shifti(VAR_0, VAR_4 + VAR_6, VAR_2[0], VAR_2[2]);", "} else {", "tcg_out_modrm(VAR_0, OPC_SHIFT_cl + VAR_6, VAR_4, VAR_2[0]);", "}", "break;", "case INDEX_op_brcond_i32:\ntcg_out_brcond32(VAR_0, VAR_2[2], VAR_2[0], VAR_2[1], VAR_3[1],\nVAR_2[3], 0);", "break;", "case INDEX_op_setcond_i32:\ntcg_out_setcond32(VAR_0, VAR_2[3], VAR_2[0], VAR_2[1],\nVAR_2[2], VAR_3[2]);", "break;", "case INDEX_op_movcond_i32:\ntcg_out_movcond32(VAR_0, VAR_2[5], VAR_2[0], VAR_2[1],\nVAR_2[2], VAR_3[2], VAR_2[3]);", "break;", "OP_32_64(bswap16):\ntcg_out_rolw_8(VAR_0, VAR_2[0]);", "break;", "OP_32_64(bswap32):\ntcg_out_bswap32(VAR_0, VAR_2[0]);", "break;", "OP_32_64(neg):\ntcg_out_modrm(VAR_0, OPC_GRP3_Ev + VAR_6, EXT3_NEG, VAR_2[0]);", "break;", "OP_32_64(not):\ntcg_out_modrm(VAR_0, OPC_GRP3_Ev + VAR_6, EXT3_NOT, VAR_2[0]);", "break;", "OP_32_64(ext8s):\ntcg_out_ext8s(VAR_0, VAR_2[0], VAR_2[1], VAR_6);", "break;", "OP_32_64(ext16s):\ntcg_out_ext16s(VAR_0, VAR_2[0], VAR_2[1], VAR_6);", "break;", "OP_32_64(ext8u):\ntcg_out_ext8u(VAR_0, VAR_2[0], VAR_2[1]);", "break;", "OP_32_64(ext16u):\ntcg_out_ext16u(VAR_0, VAR_2[0], VAR_2[1]);", "break;", "case INDEX_op_qemu_ld_i32:\ntcg_out_qemu_ld(VAR_0, VAR_2, 0);", "break;", "case INDEX_op_qemu_ld_i64:\ntcg_out_qemu_ld(VAR_0, VAR_2, 1);", "break;", "case INDEX_op_qemu_st_i32:\ntcg_out_qemu_st(VAR_0, VAR_2, 0);", "break;", "case INDEX_op_qemu_st_i64:\ntcg_out_qemu_st(VAR_0, VAR_2, 1);", "break;", "OP_32_64(mulu2):\ntcg_out_modrm(VAR_0, OPC_GRP3_Ev + VAR_6, EXT3_MUL, VAR_2[3]);", "break;", "OP_32_64(muls2):\ntcg_out_modrm(VAR_0, OPC_GRP3_Ev + VAR_6, EXT3_IMUL, VAR_2[3]);", "break;", "OP_32_64(add2):\nif (VAR_3[4]) {", "tgen_arithi(VAR_0, ARITH_ADD + VAR_6, VAR_2[0], VAR_2[4], 1);", "} else {", "tgen_arithr(VAR_0, ARITH_ADD + VAR_6, VAR_2[0], VAR_2[4]);", "}", "if (VAR_3[5]) {", "tgen_arithi(VAR_0, ARITH_ADC + VAR_6, VAR_2[1], VAR_2[5], 1);", "} else {", "tgen_arithr(VAR_0, ARITH_ADC + VAR_6, VAR_2[1], VAR_2[5]);", "}", "break;", "OP_32_64(sub2):\nif (VAR_3[4]) {", "tgen_arithi(VAR_0, ARITH_SUB + VAR_6, VAR_2[0], VAR_2[4], 1);", "} else {", "tgen_arithr(VAR_0, ARITH_SUB + VAR_6, VAR_2[0], VAR_2[4]);", "}", "if (VAR_3[5]) {", "tgen_arithi(VAR_0, ARITH_SBB + VAR_6, VAR_2[1], VAR_2[5], 1);", "} else {", "tgen_arithr(VAR_0, ARITH_SBB + VAR_6, VAR_2[1], VAR_2[5]);", "}", "break;", "#if TCG_TARGET_REG_BITS == 32\ncase INDEX_op_brcond2_i32:\ntcg_out_brcond2(VAR_0, VAR_2, VAR_3, 0);", "break;", "case INDEX_op_setcond2_i32:\ntcg_out_setcond2(VAR_0, VAR_2, VAR_3);", "break;", "#else\ncase INDEX_op_ld32s_i64:\ntcg_out_modrm_offset(VAR_0, OPC_MOVSLQ, VAR_2[0], VAR_2[1], VAR_2[2]);", "break;", "case INDEX_op_ld_i64:\ntcg_out_ld(VAR_0, TCG_TYPE_I64, VAR_2[0], VAR_2[1], VAR_2[2]);", "break;", "case INDEX_op_st_i64:\nif (VAR_3[0]) {", "tcg_out_modrm_offset(VAR_0, OPC_MOVL_EvIz | P_REXW,\n0, VAR_2[1], VAR_2[2]);", "tcg_out32(VAR_0, VAR_2[0]);", "} else {", "tcg_out_st(VAR_0, TCG_TYPE_I64, VAR_2[0], VAR_2[1], VAR_2[2]);", "}", "break;", "case INDEX_op_brcond_i64:\ntcg_out_brcond64(VAR_0, VAR_2[2], VAR_2[0], VAR_2[1], VAR_3[1],\nVAR_2[3], 0);", "break;", "case INDEX_op_setcond_i64:\ntcg_out_setcond64(VAR_0, VAR_2[3], VAR_2[0], VAR_2[1],\nVAR_2[2], VAR_3[2]);", "break;", "case INDEX_op_movcond_i64:\ntcg_out_movcond64(VAR_0, VAR_2[5], VAR_2[0], VAR_2[1],\nVAR_2[2], VAR_3[2], VAR_2[3]);", "break;", "case INDEX_op_bswap64_i64:\ntcg_out_bswap64(VAR_0, VAR_2[0]);", "break;", "case INDEX_op_ext32u_i64:\ntcg_out_ext32u(VAR_0, VAR_2[0], VAR_2[1]);", "break;", "case INDEX_op_ext32s_i64:\ntcg_out_ext32s(VAR_0, VAR_2[0], VAR_2[1]);", "break;", "#endif\nOP_32_64(deposit):\nif (VAR_2[3] == 0 && VAR_2[4] == 8) {", "tcg_out_modrm(VAR_0, OPC_MOVB_EvGv | P_REXB_R | P_REXB_RM,\nVAR_2[2], VAR_2[0]);", "} else if (VAR_2[3] == 8 && VAR_2[4] == 8) {", "tcg_out_modrm(VAR_0, OPC_MOVB_EvGv, VAR_2[2], VAR_2[0] + 4);", "} else if (VAR_2[3] == 0 && VAR_2[4] == 16) {", "tcg_out_modrm(VAR_0, OPC_MOVL_EvGv | P_DATA16, VAR_2[2], VAR_2[0]);", "} else {", "tcg_abort();", "}", "break;", "case INDEX_op_mov_i32:\ncase INDEX_op_mov_i64:\ncase INDEX_op_movi_i32:\ncase INDEX_op_movi_i64:\ncase INDEX_op_call:\ndefault:\ntcg_abort();", "}", "#undef OP_32_64\n}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11, 13, 15, 17 ], [ 19, 21, 23, 25, 27, 31 ], [ 33, 35 ], [ 37 ], [ 39 ], [ 41, 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57, 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67, 69 ], [ 71 ], [ 73, 77 ], [ 79 ], [ 81, 83 ], [ 85 ], [ 87, 91 ], [ 93 ], [ 95, 97 ], [ 99 ], [ 101, 103, 105, 107, 109 ], [ 111 ], [ 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 ], [ 179, 183 ], [ 185 ], [ 189 ], [ 191 ], [ 193 ], [ 199 ], [ 201 ], [ 203 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217, 219 ], [ 221 ], [ 223, 225 ], [ 227 ], [ 229, 231 ], [ 233 ], [ 235, 237 ], [ 239 ], [ 241, 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 257, 259 ], [ 261, 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 277, 279 ], [ 281 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ], [ 291 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305 ], [ 309, 311 ], [ 313 ], [ 315, 317 ], [ 319 ], [ 323, 325 ], [ 327 ], [ 329 ], [ 331, 333 ], [ 335 ], [ 337 ], [ 339, 341 ], [ 343 ], [ 345 ], [ 347, 349 ], [ 351 ], [ 353, 355 ], [ 357 ], [ 359, 361 ], [ 363 ], [ 365 ], [ 367 ], [ 371, 373 ], [ 375 ], [ 377 ], [ 379 ], [ 381 ], [ 383 ], [ 387, 389, 391 ], [ 393 ], [ 395, 397, 399 ], [ 401 ], [ 403, 405, 407 ], [ 409 ], [ 413, 415 ], [ 417 ], [ 419, 421 ], [ 423 ], [ 427, 429 ], [ 431 ], [ 433, 435 ], [ 437 ], [ 441, 443 ], [ 445 ], [ 447, 449 ], [ 451 ], [ 453, 455 ], [ 457 ], [ 459, 461 ], [ 463 ], [ 467, 469 ], [ 471 ], [ 473, 475 ], [ 477 ], [ 479, 481 ], [ 483 ], [ 485, 487 ], [ 489 ], [ 493, 495 ], [ 497 ], [ 499, 501 ], [ 503 ], [ 505, 507 ], [ 509 ], [ 511 ], [ 513 ], [ 515 ], [ 517 ], [ 519 ], [ 521 ], [ 523 ], [ 525 ], [ 527 ], [ 529, 531 ], [ 533 ], [ 535 ], [ 537 ], [ 539 ], [ 541 ], [ 543 ], [ 545 ], [ 547 ], [ 549 ], [ 551 ], [ 555, 557, 559 ], [ 561 ], [ 563, 565 ], [ 567 ], [ 569, 571, 573 ], [ 575 ], [ 577, 579 ], [ 581 ], [ 583, 585 ], [ 587, 589 ], [ 591 ], [ 593 ], [ 595 ], [ 597 ], [ 599 ], [ 603, 605, 607 ], [ 609 ], [ 611, 613, 615 ], [ 617 ], [ 619, 621, 623 ], [ 625 ], [ 629, 631 ], [ 633 ], [ 635, 637 ], [ 639 ], [ 641, 643 ], [ 645 ], [ 647, 651, 653 ], [ 657, 659 ], [ 661 ], [ 665 ], [ 667 ], [ 671 ], [ 673 ], [ 675 ], [ 677 ], [ 679 ], [ 683, 685, 687, 689, 691, 693, 695 ], [ 697 ], [ 701, 703 ] ]
11,145
static int coroutine_fn bdrv_co_do_write_zeroes(BlockDriverState *bs, int64_t sector_num, int nb_sectors, BdrvRequestFlags flags) { BlockDriver *drv = bs->drv; QEMUIOVector qiov; struct iovec iov = {0}; int ret = 0; int max_write_zeroes = bs->bl.max_write_zeroes ? bs->bl.max_write_zeroes : INT_MAX; while (nb_sectors > 0 && !ret) { int num = nb_sectors; /* Align request. Block drivers can expect the "bulk" of the request * to be aligned. */ if (bs->bl.write_zeroes_alignment && num > bs->bl.write_zeroes_alignment) { if (sector_num % bs->bl.write_zeroes_alignment != 0) { /* Make a small request up to the first aligned sector. */ num = bs->bl.write_zeroes_alignment; num -= sector_num % bs->bl.write_zeroes_alignment; } else if ((sector_num + num) % bs->bl.write_zeroes_alignment != 0) { /* Shorten the request to the last aligned sector. num cannot * underflow because num > bs->bl.write_zeroes_alignment. */ num -= (sector_num + num) % bs->bl.write_zeroes_alignment; } } /* limit request size */ if (num > max_write_zeroes) { num = max_write_zeroes; } ret = -ENOTSUP; /* First try the efficient write zeroes operation */ if (drv->bdrv_co_write_zeroes) { ret = drv->bdrv_co_write_zeroes(bs, sector_num, num, flags); } if (ret == -ENOTSUP) { /* Fall back to bounce buffer if write zeroes is unsupported */ int max_xfer_len = MIN_NON_ZERO(bs->bl.max_transfer_length, MAX_WRITE_ZEROES_BOUNCE_BUFFER); num = MIN(num, max_xfer_len); iov.iov_len = num * BDRV_SECTOR_SIZE; if (iov.iov_base == NULL) { iov.iov_base = qemu_try_blockalign(bs, num * BDRV_SECTOR_SIZE); if (iov.iov_base == NULL) { ret = -ENOMEM; goto fail; } memset(iov.iov_base, 0, num * BDRV_SECTOR_SIZE); } qemu_iovec_init_external(&qiov, &iov, 1); ret = drv->bdrv_co_writev(bs, sector_num, num, &qiov); /* Keep bounce buffer around if it is big enough for all * all future requests. */ if (num < max_xfer_len) { qemu_vfree(iov.iov_base); iov.iov_base = NULL; } } sector_num += num; nb_sectors -= num; } fail: qemu_vfree(iov.iov_base); return ret; }
false
qemu
75af1f34cd5b07c3c7fcf86dfc99a42de48a600d
static int coroutine_fn bdrv_co_do_write_zeroes(BlockDriverState *bs, int64_t sector_num, int nb_sectors, BdrvRequestFlags flags) { BlockDriver *drv = bs->drv; QEMUIOVector qiov; struct iovec iov = {0}; int ret = 0; int max_write_zeroes = bs->bl.max_write_zeroes ? bs->bl.max_write_zeroes : INT_MAX; while (nb_sectors > 0 && !ret) { int num = nb_sectors; if (bs->bl.write_zeroes_alignment && num > bs->bl.write_zeroes_alignment) { if (sector_num % bs->bl.write_zeroes_alignment != 0) { num = bs->bl.write_zeroes_alignment; num -= sector_num % bs->bl.write_zeroes_alignment; } else if ((sector_num + num) % bs->bl.write_zeroes_alignment != 0) { num -= (sector_num + num) % bs->bl.write_zeroes_alignment; } } if (num > max_write_zeroes) { num = max_write_zeroes; } ret = -ENOTSUP; if (drv->bdrv_co_write_zeroes) { ret = drv->bdrv_co_write_zeroes(bs, sector_num, num, flags); } if (ret == -ENOTSUP) { int max_xfer_len = MIN_NON_ZERO(bs->bl.max_transfer_length, MAX_WRITE_ZEROES_BOUNCE_BUFFER); num = MIN(num, max_xfer_len); iov.iov_len = num * BDRV_SECTOR_SIZE; if (iov.iov_base == NULL) { iov.iov_base = qemu_try_blockalign(bs, num * BDRV_SECTOR_SIZE); if (iov.iov_base == NULL) { ret = -ENOMEM; goto fail; } memset(iov.iov_base, 0, num * BDRV_SECTOR_SIZE); } qemu_iovec_init_external(&qiov, &iov, 1); ret = drv->bdrv_co_writev(bs, sector_num, num, &qiov); if (num < max_xfer_len) { qemu_vfree(iov.iov_base); iov.iov_base = NULL; } } sector_num += num; nb_sectors -= num; } fail: qemu_vfree(iov.iov_base); return ret; }
{ "code": [], "line_no": [] }
static int VAR_0 bdrv_co_do_write_zeroes(BlockDriverState *bs, int64_t sector_num, int nb_sectors, BdrvRequestFlags flags) { BlockDriver *drv = bs->drv; QEMUIOVector qiov; struct iovec iov = {0}; int ret = 0; int max_write_zeroes = bs->bl.max_write_zeroes ? bs->bl.max_write_zeroes : INT_MAX; while (nb_sectors > 0 && !ret) { int num = nb_sectors; if (bs->bl.write_zeroes_alignment && num > bs->bl.write_zeroes_alignment) { if (sector_num % bs->bl.write_zeroes_alignment != 0) { num = bs->bl.write_zeroes_alignment; num -= sector_num % bs->bl.write_zeroes_alignment; } else if ((sector_num + num) % bs->bl.write_zeroes_alignment != 0) { num -= (sector_num + num) % bs->bl.write_zeroes_alignment; } } if (num > max_write_zeroes) { num = max_write_zeroes; } ret = -ENOTSUP; if (drv->bdrv_co_write_zeroes) { ret = drv->bdrv_co_write_zeroes(bs, sector_num, num, flags); } if (ret == -ENOTSUP) { int max_xfer_len = MIN_NON_ZERO(bs->bl.max_transfer_length, MAX_WRITE_ZEROES_BOUNCE_BUFFER); num = MIN(num, max_xfer_len); iov.iov_len = num * BDRV_SECTOR_SIZE; if (iov.iov_base == NULL) { iov.iov_base = qemu_try_blockalign(bs, num * BDRV_SECTOR_SIZE); if (iov.iov_base == NULL) { ret = -ENOMEM; goto fail; } memset(iov.iov_base, 0, num * BDRV_SECTOR_SIZE); } qemu_iovec_init_external(&qiov, &iov, 1); ret = drv->bdrv_co_writev(bs, sector_num, num, &qiov); if (num < max_xfer_len) { qemu_vfree(iov.iov_base); iov.iov_base = NULL; } } sector_num += num; nb_sectors -= num; } fail: qemu_vfree(iov.iov_base); return ret; }
[ "static int VAR_0 bdrv_co_do_write_zeroes(BlockDriverState *bs,\nint64_t sector_num, int nb_sectors, BdrvRequestFlags flags)\n{", "BlockDriver *drv = bs->drv;", "QEMUIOVector qiov;", "struct iovec iov = {0};", "int ret = 0;", "int max_write_zeroes = bs->bl.max_write_zeroes ?\nbs->bl.max_write_zeroes : INT_MAX;", "while (nb_sectors > 0 && !ret) {", "int num = nb_sectors;", "if (bs->bl.write_zeroes_alignment\n&& num > bs->bl.write_zeroes_alignment) {", "if (sector_num % bs->bl.write_zeroes_alignment != 0) {", "num = bs->bl.write_zeroes_alignment;", "num -= sector_num % bs->bl.write_zeroes_alignment;", "} else if ((sector_num + num) % bs->bl.write_zeroes_alignment != 0) {", "num -= (sector_num + num) % bs->bl.write_zeroes_alignment;", "}", "}", "if (num > max_write_zeroes) {", "num = max_write_zeroes;", "}", "ret = -ENOTSUP;", "if (drv->bdrv_co_write_zeroes) {", "ret = drv->bdrv_co_write_zeroes(bs, sector_num, num, flags);", "}", "if (ret == -ENOTSUP) {", "int max_xfer_len = MIN_NON_ZERO(bs->bl.max_transfer_length,\nMAX_WRITE_ZEROES_BOUNCE_BUFFER);", "num = MIN(num, max_xfer_len);", "iov.iov_len = num * BDRV_SECTOR_SIZE;", "if (iov.iov_base == NULL) {", "iov.iov_base = qemu_try_blockalign(bs, num * BDRV_SECTOR_SIZE);", "if (iov.iov_base == NULL) {", "ret = -ENOMEM;", "goto fail;", "}", "memset(iov.iov_base, 0, num * BDRV_SECTOR_SIZE);", "}", "qemu_iovec_init_external(&qiov, &iov, 1);", "ret = drv->bdrv_co_writev(bs, sector_num, num, &qiov);", "if (num < max_xfer_len) {", "qemu_vfree(iov.iov_base);", "iov.iov_base = NULL;", "}", "}", "sector_num += num;", "nb_sectors -= num;", "}", "fail:\nqemu_vfree(iov.iov_base);", "return ret;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17, 19 ], [ 23 ], [ 25 ], [ 35, 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 55 ], [ 57 ], [ 59 ], [ 65 ], [ 67 ], [ 69 ], [ 73 ], [ 77 ], [ 79 ], [ 81 ], [ 85 ], [ 89, 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 117 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 139 ], [ 141 ], [ 143 ], [ 147, 149 ], [ 151 ], [ 153 ] ]
11,146
static void sigp_cpu_reset(CPUState *cs, run_on_cpu_data arg) { S390CPU *cpu = S390_CPU(cs); S390CPUClass *scc = S390_CPU_GET_CLASS(cpu); SigpInfo *si = arg.host_ptr; cpu_synchronize_state(cs); scc->cpu_reset(cs); cpu_synchronize_post_reset(cs); si->cc = SIGP_CC_ORDER_CODE_ACCEPTED; }
false
qemu
74b4c74d5efb0a489bdf0acc5b5d0197167e7649
static void sigp_cpu_reset(CPUState *cs, run_on_cpu_data arg) { S390CPU *cpu = S390_CPU(cs); S390CPUClass *scc = S390_CPU_GET_CLASS(cpu); SigpInfo *si = arg.host_ptr; cpu_synchronize_state(cs); scc->cpu_reset(cs); cpu_synchronize_post_reset(cs); si->cc = SIGP_CC_ORDER_CODE_ACCEPTED; }
{ "code": [], "line_no": [] }
static void FUNC_0(CPUState *VAR_0, run_on_cpu_data VAR_1) { S390CPU *cpu = S390_CPU(VAR_0); S390CPUClass *scc = S390_CPU_GET_CLASS(cpu); SigpInfo *si = VAR_1.host_ptr; cpu_synchronize_state(VAR_0); scc->cpu_reset(VAR_0); cpu_synchronize_post_reset(VAR_0); si->cc = SIGP_CC_ORDER_CODE_ACCEPTED; }
[ "static void FUNC_0(CPUState *VAR_0, run_on_cpu_data VAR_1)\n{", "S390CPU *cpu = S390_CPU(VAR_0);", "S390CPUClass *scc = S390_CPU_GET_CLASS(cpu);", "SigpInfo *si = VAR_1.host_ptr;", "cpu_synchronize_state(VAR_0);", "scc->cpu_reset(VAR_0);", "cpu_synchronize_post_reset(VAR_0);", "si->cc = SIGP_CC_ORDER_CODE_ACCEPTED;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
11,147
static void GCC_FMT_ATTR(3, 4) parse_error(JSONParserContext *ctxt, QObject *token, const char *msg, ...) { va_list ap; char message[1024]; va_start(ap, msg); vsnprintf(message, sizeof(message), msg, ap); va_end(ap); if (ctxt->err) { error_free(ctxt->err); ctxt->err = NULL; } error_setg(&ctxt->err, "JSON parse error, %s", message); }
false
qemu
9bada8971173345ceb37ed1a47b00a01a4dd48cf
static void GCC_FMT_ATTR(3, 4) parse_error(JSONParserContext *ctxt, QObject *token, const char *msg, ...) { va_list ap; char message[1024]; va_start(ap, msg); vsnprintf(message, sizeof(message), msg, ap); va_end(ap); if (ctxt->err) { error_free(ctxt->err); ctxt->err = NULL; } error_setg(&ctxt->err, "JSON parse error, %s", message); }
{ "code": [], "line_no": [] }
static void GCC_FMT_ATTR(3, 4) parse_error(JSONParserContext *ctxt, QObject *token, const char *msg, ...) { va_list ap; char message[1024]; va_start(ap, msg); vsnprintf(message, sizeof(message), msg, ap); va_end(ap); if (ctxt->err) { error_free(ctxt->err); ctxt->err = NULL; } error_setg(&ctxt->err, "JSON parse error, %s", message); }
[ "static void GCC_FMT_ATTR(3, 4) parse_error(JSONParserContext *ctxt,\nQObject *token, const char *msg, ...)\n{", "va_list ap;", "char message[1024];", "va_start(ap, msg);", "vsnprintf(message, sizeof(message), msg, ap);", "va_end(ap);", "if (ctxt->err) {", "error_free(ctxt->err);", "ctxt->err = NULL;", "}", "error_setg(&ctxt->err, \"JSON parse error, %s\", message);", "}" ]
[ 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 ] ]
11,148
static int cpu_x86_register (CPUX86State *env, const char *cpu_model) { x86_def_t def1, *def = &def1; if (cpu_x86_find_by_name(def, cpu_model) < 0) return -1; if (def->vendor1) { env->cpuid_vendor1 = def->vendor1; env->cpuid_vendor2 = def->vendor2; env->cpuid_vendor3 = def->vendor3; } else { env->cpuid_vendor1 = CPUID_VENDOR_INTEL_1; env->cpuid_vendor2 = CPUID_VENDOR_INTEL_2; env->cpuid_vendor3 = CPUID_VENDOR_INTEL_3; } env->cpuid_vendor_override = def->vendor_override; env->cpuid_level = def->level; if (def->family > 0x0f) env->cpuid_version = 0xf00 | ((def->family - 0x0f) << 20); else env->cpuid_version = def->family << 8; env->cpuid_version |= ((def->model & 0xf) << 4) | ((def->model >> 4) << 16); env->cpuid_version |= def->stepping; env->cpuid_features = def->features; env->pat = 0x0007040600070406ULL; env->cpuid_ext_features = def->ext_features; env->cpuid_ext2_features = def->ext2_features; env->cpuid_xlevel = def->xlevel; env->cpuid_ext3_features = def->ext3_features; { const char *model_id = def->model_id; int c, len, i; if (!model_id) model_id = ""; len = strlen(model_id); for(i = 0; i < 48; i++) { if (i >= len) c = '\0'; else c = (uint8_t)model_id[i]; env->cpuid_model[i >> 2] |= c << (8 * (i & 3)); } } return 0; }
false
qemu
bb0300dc57c10b3721451b0ff566a03f9276cc77
static int cpu_x86_register (CPUX86State *env, const char *cpu_model) { x86_def_t def1, *def = &def1; if (cpu_x86_find_by_name(def, cpu_model) < 0) return -1; if (def->vendor1) { env->cpuid_vendor1 = def->vendor1; env->cpuid_vendor2 = def->vendor2; env->cpuid_vendor3 = def->vendor3; } else { env->cpuid_vendor1 = CPUID_VENDOR_INTEL_1; env->cpuid_vendor2 = CPUID_VENDOR_INTEL_2; env->cpuid_vendor3 = CPUID_VENDOR_INTEL_3; } env->cpuid_vendor_override = def->vendor_override; env->cpuid_level = def->level; if (def->family > 0x0f) env->cpuid_version = 0xf00 | ((def->family - 0x0f) << 20); else env->cpuid_version = def->family << 8; env->cpuid_version |= ((def->model & 0xf) << 4) | ((def->model >> 4) << 16); env->cpuid_version |= def->stepping; env->cpuid_features = def->features; env->pat = 0x0007040600070406ULL; env->cpuid_ext_features = def->ext_features; env->cpuid_ext2_features = def->ext2_features; env->cpuid_xlevel = def->xlevel; env->cpuid_ext3_features = def->ext3_features; { const char *model_id = def->model_id; int c, len, i; if (!model_id) model_id = ""; len = strlen(model_id); for(i = 0; i < 48; i++) { if (i >= len) c = '\0'; else c = (uint8_t)model_id[i]; env->cpuid_model[i >> 2] |= c << (8 * (i & 3)); } } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0 (CPUX86State *VAR_0, const char *VAR_1) { x86_def_t def1, *def = &def1; if (cpu_x86_find_by_name(def, VAR_1) < 0) return -1; if (def->vendor1) { VAR_0->cpuid_vendor1 = def->vendor1; VAR_0->cpuid_vendor2 = def->vendor2; VAR_0->cpuid_vendor3 = def->vendor3; } else { VAR_0->cpuid_vendor1 = CPUID_VENDOR_INTEL_1; VAR_0->cpuid_vendor2 = CPUID_VENDOR_INTEL_2; VAR_0->cpuid_vendor3 = CPUID_VENDOR_INTEL_3; } VAR_0->cpuid_vendor_override = def->vendor_override; VAR_0->cpuid_level = def->level; if (def->family > 0x0f) VAR_0->cpuid_version = 0xf00 | ((def->family - 0x0f) << 20); else VAR_0->cpuid_version = def->family << 8; VAR_0->cpuid_version |= ((def->model & 0xf) << 4) | ((def->model >> 4) << 16); VAR_0->cpuid_version |= def->stepping; VAR_0->cpuid_features = def->features; VAR_0->pat = 0x0007040600070406ULL; VAR_0->cpuid_ext_features = def->ext_features; VAR_0->cpuid_ext2_features = def->ext2_features; VAR_0->cpuid_xlevel = def->xlevel; VAR_0->cpuid_ext3_features = def->ext3_features; { const char *VAR_2 = def->VAR_2; int VAR_3, VAR_4, VAR_5; if (!VAR_2) VAR_2 = ""; VAR_4 = strlen(VAR_2); for(VAR_5 = 0; VAR_5 < 48; VAR_5++) { if (VAR_5 >= VAR_4) VAR_3 = '\0'; else VAR_3 = (uint8_t)VAR_2[VAR_5]; VAR_0->cpuid_model[VAR_5 >> 2] |= VAR_3 << (8 * (VAR_5 & 3)); } } return 0; }
[ "static int FUNC_0 (CPUX86State *VAR_0, const char *VAR_1)\n{", "x86_def_t def1, *def = &def1;", "if (cpu_x86_find_by_name(def, VAR_1) < 0)\nreturn -1;", "if (def->vendor1) {", "VAR_0->cpuid_vendor1 = def->vendor1;", "VAR_0->cpuid_vendor2 = def->vendor2;", "VAR_0->cpuid_vendor3 = def->vendor3;", "} else {", "VAR_0->cpuid_vendor1 = CPUID_VENDOR_INTEL_1;", "VAR_0->cpuid_vendor2 = CPUID_VENDOR_INTEL_2;", "VAR_0->cpuid_vendor3 = CPUID_VENDOR_INTEL_3;", "}", "VAR_0->cpuid_vendor_override = def->vendor_override;", "VAR_0->cpuid_level = def->level;", "if (def->family > 0x0f)\nVAR_0->cpuid_version = 0xf00 | ((def->family - 0x0f) << 20);", "else\nVAR_0->cpuid_version = def->family << 8;", "VAR_0->cpuid_version |= ((def->model & 0xf) << 4) | ((def->model >> 4) << 16);", "VAR_0->cpuid_version |= def->stepping;", "VAR_0->cpuid_features = def->features;", "VAR_0->pat = 0x0007040600070406ULL;", "VAR_0->cpuid_ext_features = def->ext_features;", "VAR_0->cpuid_ext2_features = def->ext2_features;", "VAR_0->cpuid_xlevel = def->xlevel;", "VAR_0->cpuid_ext3_features = def->ext3_features;", "{", "const char *VAR_2 = def->VAR_2;", "int VAR_3, VAR_4, VAR_5;", "if (!VAR_2)\nVAR_2 = \"\";", "VAR_4 = strlen(VAR_2);", "for(VAR_5 = 0; VAR_5 < 48; VAR_5++) {", "if (VAR_5 >= VAR_4)\nVAR_3 = '\\0';", "else\nVAR_3 = (uint8_t)VAR_2[VAR_5];", "VAR_0->cpuid_model[VAR_5 >> 2] |= VAR_3 << (8 * (VAR_5 & 3));", "}", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35, 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65, 67 ], [ 69 ], [ 71 ], [ 73, 75 ], [ 77, 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ] ]
11,149
void bdrv_info(void) { BlockDriverState *bs; for (bs = bdrv_first; bs != NULL; bs = bs->next) { term_printf("%s:", bs->device_name); term_printf(" type="); switch(bs->type) { case BDRV_TYPE_HD: term_printf("hd"); break; case BDRV_TYPE_CDROM: term_printf("cdrom"); break; case BDRV_TYPE_FLOPPY: term_printf("floppy"); break; } term_printf(" removable=%d", bs->removable); if (bs->removable) { term_printf(" locked=%d", bs->locked); } if (bs->drv) { term_printf(" file="); term_print_filename(bs->filename); if (bs->backing_file[0] != '\0') { term_printf(" backing_file="); term_print_filename(bs->backing_file); } term_printf(" ro=%d", bs->read_only); term_printf(" drv=%s", bs->drv->format_name); if (bs->encrypted) term_printf(" encrypted"); } else { term_printf(" [not inserted]"); } term_printf("\n"); } }
false
qemu
430eb509d2d05bd568c1394213fd12cb447467a7
void bdrv_info(void) { BlockDriverState *bs; for (bs = bdrv_first; bs != NULL; bs = bs->next) { term_printf("%s:", bs->device_name); term_printf(" type="); switch(bs->type) { case BDRV_TYPE_HD: term_printf("hd"); break; case BDRV_TYPE_CDROM: term_printf("cdrom"); break; case BDRV_TYPE_FLOPPY: term_printf("floppy"); break; } term_printf(" removable=%d", bs->removable); if (bs->removable) { term_printf(" locked=%d", bs->locked); } if (bs->drv) { term_printf(" file="); term_print_filename(bs->filename); if (bs->backing_file[0] != '\0') { term_printf(" backing_file="); term_print_filename(bs->backing_file); } term_printf(" ro=%d", bs->read_only); term_printf(" drv=%s", bs->drv->format_name); if (bs->encrypted) term_printf(" encrypted"); } else { term_printf(" [not inserted]"); } term_printf("\n"); } }
{ "code": [], "line_no": [] }
void FUNC_0(void) { BlockDriverState *bs; for (bs = bdrv_first; bs != NULL; bs = bs->next) { term_printf("%s:", bs->device_name); term_printf(" type="); switch(bs->type) { case BDRV_TYPE_HD: term_printf("hd"); break; case BDRV_TYPE_CDROM: term_printf("cdrom"); break; case BDRV_TYPE_FLOPPY: term_printf("floppy"); break; } term_printf(" removable=%d", bs->removable); if (bs->removable) { term_printf(" locked=%d", bs->locked); } if (bs->drv) { term_printf(" file="); term_print_filename(bs->filename); if (bs->backing_file[0] != '\0') { term_printf(" backing_file="); term_print_filename(bs->backing_file); } term_printf(" ro=%d", bs->read_only); term_printf(" drv=%s", bs->drv->format_name); if (bs->encrypted) term_printf(" encrypted"); } else { term_printf(" [not inserted]"); } term_printf("\n"); } }
[ "void FUNC_0(void)\n{", "BlockDriverState *bs;", "for (bs = bdrv_first; bs != NULL; bs = bs->next) {", "term_printf(\"%s:\", bs->device_name);", "term_printf(\" type=\");", "switch(bs->type) {", "case BDRV_TYPE_HD:\nterm_printf(\"hd\");", "break;", "case BDRV_TYPE_CDROM:\nterm_printf(\"cdrom\");", "break;", "case BDRV_TYPE_FLOPPY:\nterm_printf(\"floppy\");", "break;", "}", "term_printf(\" removable=%d\", bs->removable);", "if (bs->removable) {", "term_printf(\" locked=%d\", bs->locked);", "}", "if (bs->drv) {", "term_printf(\" file=\");", "term_print_filename(bs->filename);", "if (bs->backing_file[0] != '\\0') {", "term_printf(\" backing_file=\");", "term_print_filename(bs->backing_file);", "}", "term_printf(\" ro=%d\", bs->read_only);", "term_printf(\" drv=%s\", bs->drv->format_name);", "if (bs->encrypted)\nterm_printf(\" encrypted\");", "} else {", "term_printf(\" [not inserted]\");", "}", "term_printf(\"\\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 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17, 19 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 29, 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63, 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ] ]
11,150
int qcrypto_hash_bytesv(QCryptoHashAlgorithm alg, const struct iovec *iov, size_t niov, uint8_t **result, size_t *resultlen, Error **errp) { int i, ret; gnutls_hash_hd_t dig; if (alg >= G_N_ELEMENTS(qcrypto_hash_alg_map)) { error_setg(errp, "Unknown hash algorithm %d", alg); return -1; } ret = gnutls_hash_init(&dig, qcrypto_hash_alg_map[alg]); if (ret < 0) { error_setg(errp, "Unable to initialize hash algorithm: %s", gnutls_strerror(ret)); return -1; } for (i = 0; i < niov; i++) { ret = gnutls_hash(dig, iov[i].iov_base, iov[i].iov_len); if (ret < 0) { error_setg(errp, "Unable process hash data: %s", gnutls_strerror(ret)); goto error; } } ret = gnutls_hash_get_len(qcrypto_hash_alg_map[alg]); if (ret <= 0) { error_setg(errp, "Unable to get hash length: %s", gnutls_strerror(ret)); goto error; } if (*resultlen == 0) { *resultlen = ret; *result = g_new0(uint8_t, *resultlen); } else if (*resultlen != ret) { error_setg(errp, "Result buffer size %zu is smaller than hash %d", *resultlen, ret); goto error; } gnutls_hash_deinit(dig, *result); return 0; error: gnutls_hash_deinit(dig, NULL); return -1; }
false
qemu
0c16c056a4f9dec18fdd56feec82a5db9ff3c15e
int qcrypto_hash_bytesv(QCryptoHashAlgorithm alg, const struct iovec *iov, size_t niov, uint8_t **result, size_t *resultlen, Error **errp) { int i, ret; gnutls_hash_hd_t dig; if (alg >= G_N_ELEMENTS(qcrypto_hash_alg_map)) { error_setg(errp, "Unknown hash algorithm %d", alg); return -1; } ret = gnutls_hash_init(&dig, qcrypto_hash_alg_map[alg]); if (ret < 0) { error_setg(errp, "Unable to initialize hash algorithm: %s", gnutls_strerror(ret)); return -1; } for (i = 0; i < niov; i++) { ret = gnutls_hash(dig, iov[i].iov_base, iov[i].iov_len); if (ret < 0) { error_setg(errp, "Unable process hash data: %s", gnutls_strerror(ret)); goto error; } } ret = gnutls_hash_get_len(qcrypto_hash_alg_map[alg]); if (ret <= 0) { error_setg(errp, "Unable to get hash length: %s", gnutls_strerror(ret)); goto error; } if (*resultlen == 0) { *resultlen = ret; *result = g_new0(uint8_t, *resultlen); } else if (*resultlen != ret) { error_setg(errp, "Result buffer size %zu is smaller than hash %d", *resultlen, ret); goto error; } gnutls_hash_deinit(dig, *result); return 0; error: gnutls_hash_deinit(dig, NULL); return -1; }
{ "code": [], "line_no": [] }
int FUNC_0(QCryptoHashAlgorithm VAR_0, const struct iovec *VAR_1, size_t VAR_2, uint8_t **VAR_3, size_t *VAR_4, Error **VAR_5) { int VAR_6, VAR_7; gnutls_hash_hd_t dig; if (VAR_0 >= G_N_ELEMENTS(qcrypto_hash_alg_map)) { error_setg(VAR_5, "Unknown hash algorithm %d", VAR_0); return -1; } VAR_7 = gnutls_hash_init(&dig, qcrypto_hash_alg_map[VAR_0]); if (VAR_7 < 0) { error_setg(VAR_5, "Unable to initialize hash algorithm: %s", gnutls_strerror(VAR_7)); return -1; } for (VAR_6 = 0; VAR_6 < VAR_2; VAR_6++) { VAR_7 = gnutls_hash(dig, VAR_1[VAR_6].iov_base, VAR_1[VAR_6].iov_len); if (VAR_7 < 0) { error_setg(VAR_5, "Unable process hash data: %s", gnutls_strerror(VAR_7)); goto error; } } VAR_7 = gnutls_hash_get_len(qcrypto_hash_alg_map[VAR_0]); if (VAR_7 <= 0) { error_setg(VAR_5, "Unable to get hash length: %s", gnutls_strerror(VAR_7)); goto error; } if (*VAR_4 == 0) { *VAR_4 = VAR_7; *VAR_3 = g_new0(uint8_t, *VAR_4); } else if (*VAR_4 != VAR_7) { error_setg(VAR_5, "Result buffer size %zu is smaller than hash %d", *VAR_4, VAR_7); goto error; } gnutls_hash_deinit(dig, *VAR_3); return 0; error: gnutls_hash_deinit(dig, NULL); return -1; }
[ "int FUNC_0(QCryptoHashAlgorithm VAR_0,\nconst struct iovec *VAR_1,\nsize_t VAR_2,\nuint8_t **VAR_3,\nsize_t *VAR_4,\nError **VAR_5)\n{", "int VAR_6, VAR_7;", "gnutls_hash_hd_t dig;", "if (VAR_0 >= G_N_ELEMENTS(qcrypto_hash_alg_map)) {", "error_setg(VAR_5,\n\"Unknown hash algorithm %d\",\nVAR_0);", "return -1;", "}", "VAR_7 = gnutls_hash_init(&dig, qcrypto_hash_alg_map[VAR_0]);", "if (VAR_7 < 0) {", "error_setg(VAR_5,\n\"Unable to initialize hash algorithm: %s\",\ngnutls_strerror(VAR_7));", "return -1;", "}", "for (VAR_6 = 0; VAR_6 < VAR_2; VAR_6++) {", "VAR_7 = gnutls_hash(dig, VAR_1[VAR_6].iov_base, VAR_1[VAR_6].iov_len);", "if (VAR_7 < 0) {", "error_setg(VAR_5,\n\"Unable process hash data: %s\",\ngnutls_strerror(VAR_7));", "goto error;", "}", "}", "VAR_7 = gnutls_hash_get_len(qcrypto_hash_alg_map[VAR_0]);", "if (VAR_7 <= 0) {", "error_setg(VAR_5,\n\"Unable to get hash length: %s\",\ngnutls_strerror(VAR_7));", "goto error;", "}", "if (*VAR_4 == 0) {", "*VAR_4 = VAR_7;", "*VAR_3 = g_new0(uint8_t, *VAR_4);", "} else if (*VAR_4 != VAR_7) {", "error_setg(VAR_5,\n\"Result buffer size %zu is smaller than hash %d\",\n*VAR_4, VAR_7);", "goto error;", "}", "gnutls_hash_deinit(dig, *VAR_3);", "return 0;", "error:\ngnutls_hash_deinit(dig, NULL);", "return -1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11, 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23, 25, 27 ], [ 29 ], [ 31 ], [ 35 ], [ 39 ], [ 41, 43, 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 59, 61, 63 ], [ 65 ], [ 67 ], [ 69 ], [ 73 ], [ 75 ], [ 77, 79, 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95, 97, 99 ], [ 101 ], [ 103 ], [ 107 ], [ 109 ], [ 113, 115 ], [ 117 ], [ 119 ] ]
11,152
static void start_input(DBDMA_channel *ch, int key, uint32_t addr, uint16_t req_count, int is_last) { DBDMA_DPRINTF("start_input\n"); /* KEY_REGS, KEY_DEVICE and KEY_STREAM * are not implemented in the mac-io chip */ if (!addr || key > KEY_STREAM3) { kill_channel(ch); return; } ch->io.addr = addr; ch->io.len = req_count; ch->io.is_last = is_last; ch->io.dma_end = dbdma_end; ch->io.is_dma_out = 0; ch->processing = 1; ch->rw(&ch->io); }
false
qemu
a9ceb76d55abfed9426a819024aa3a4b87266c9f
static void start_input(DBDMA_channel *ch, int key, uint32_t addr, uint16_t req_count, int is_last) { DBDMA_DPRINTF("start_input\n"); if (!addr || key > KEY_STREAM3) { kill_channel(ch); return; } ch->io.addr = addr; ch->io.len = req_count; ch->io.is_last = is_last; ch->io.dma_end = dbdma_end; ch->io.is_dma_out = 0; ch->processing = 1; ch->rw(&ch->io); }
{ "code": [], "line_no": [] }
static void FUNC_0(DBDMA_channel *VAR_0, int VAR_1, uint32_t VAR_2, uint16_t VAR_3, int VAR_4) { DBDMA_DPRINTF("FUNC_0\n"); if (!VAR_2 || VAR_1 > KEY_STREAM3) { kill_channel(VAR_0); return; } VAR_0->io.VAR_2 = VAR_2; VAR_0->io.len = VAR_3; VAR_0->io.VAR_4 = VAR_4; VAR_0->io.dma_end = dbdma_end; VAR_0->io.is_dma_out = 0; VAR_0->processing = 1; VAR_0->rw(&VAR_0->io); }
[ "static void FUNC_0(DBDMA_channel *VAR_0, int VAR_1, uint32_t VAR_2,\nuint16_t VAR_3, int VAR_4)\n{", "DBDMA_DPRINTF(\"FUNC_0\\n\");", "if (!VAR_2 || VAR_1 > KEY_STREAM3) {", "kill_channel(VAR_0);", "return;", "}", "VAR_0->io.VAR_2 = VAR_2;", "VAR_0->io.len = VAR_3;", "VAR_0->io.VAR_4 = VAR_4;", "VAR_0->io.dma_end = dbdma_end;", "VAR_0->io.is_dma_out = 0;", "VAR_0->processing = 1;", "VAR_0->rw(&VAR_0->io);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ] ]
11,153
static void spapr_core_release(DeviceState *dev, void *opaque) { HotplugHandler *hotplug_ctrl; hotplug_ctrl = qdev_get_hotplug_handler(dev); hotplug_handler_unplug(hotplug_ctrl, dev, &error_abort); }
false
qemu
318347234d7069b62d38391dd27e269a3107d668
static void spapr_core_release(DeviceState *dev, void *opaque) { HotplugHandler *hotplug_ctrl; hotplug_ctrl = qdev_get_hotplug_handler(dev); hotplug_handler_unplug(hotplug_ctrl, dev, &error_abort); }
{ "code": [], "line_no": [] }
static void FUNC_0(DeviceState *VAR_0, void *VAR_1) { HotplugHandler *hotplug_ctrl; hotplug_ctrl = qdev_get_hotplug_handler(VAR_0); hotplug_handler_unplug(hotplug_ctrl, VAR_0, &error_abort); }
[ "static void FUNC_0(DeviceState *VAR_0, void *VAR_1)\n{", "HotplugHandler *hotplug_ctrl;", "hotplug_ctrl = qdev_get_hotplug_handler(VAR_0);", "hotplug_handler_unplug(hotplug_ctrl, VAR_0, &error_abort);", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ] ]
11,154
static uint64_t macio_nvram_readb(void *opaque, target_phys_addr_t addr, unsigned size) { MacIONVRAMState *s = opaque; uint32_t value; addr = (addr >> s->it_shift) & (s->size - 1); value = s->data[addr]; NVR_DPRINTF("readb addr %04x val %x\n", (int)addr, value); return value; }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static uint64_t macio_nvram_readb(void *opaque, target_phys_addr_t addr, unsigned size) { MacIONVRAMState *s = opaque; uint32_t value; addr = (addr >> s->it_shift) & (s->size - 1); value = s->data[addr]; NVR_DPRINTF("readb addr %04x val %x\n", (int)addr, value); return value; }
{ "code": [], "line_no": [] }
static uint64_t FUNC_0(void *opaque, target_phys_addr_t addr, unsigned size) { MacIONVRAMState *s = opaque; uint32_t value; addr = (addr >> s->it_shift) & (s->size - 1); value = s->data[addr]; NVR_DPRINTF("readb addr %04x val %x\n", (int)addr, value); return value; }
[ "static uint64_t FUNC_0(void *opaque, target_phys_addr_t addr,\nunsigned size)\n{", "MacIONVRAMState *s = opaque;", "uint32_t value;", "addr = (addr >> s->it_shift) & (s->size - 1);", "value = s->data[addr];", "NVR_DPRINTF(\"readb addr %04x val %x\\n\", (int)addr, value);", "return value;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ] ]
11,156
static const HWAccel *get_hwaccel(enum AVPixelFormat pix_fmt, enum HWAccelID selected_hwaccel_id) { int i; for (i = 0; hwaccels[i].name; i++) if (hwaccels[i].pix_fmt == pix_fmt && (!selected_hwaccel_id || selected_hwaccel_id == HWACCEL_AUTO || hwaccels[i].id == selected_hwaccel_id)) return &hwaccels[i]; return NULL; }
false
FFmpeg
b0cd14fb1dab4b044f7fe6b53ac635409849de77
static const HWAccel *get_hwaccel(enum AVPixelFormat pix_fmt, enum HWAccelID selected_hwaccel_id) { int i; for (i = 0; hwaccels[i].name; i++) if (hwaccels[i].pix_fmt == pix_fmt && (!selected_hwaccel_id || selected_hwaccel_id == HWACCEL_AUTO || hwaccels[i].id == selected_hwaccel_id)) return &hwaccels[i]; return NULL; }
{ "code": [], "line_no": [] }
static const HWAccel *FUNC_0(enum AVPixelFormat pix_fmt, enum HWAccelID selected_hwaccel_id) { int VAR_0; for (VAR_0 = 0; hwaccels[VAR_0].name; VAR_0++) if (hwaccels[VAR_0].pix_fmt == pix_fmt && (!selected_hwaccel_id || selected_hwaccel_id == HWACCEL_AUTO || hwaccels[VAR_0].id == selected_hwaccel_id)) return &hwaccels[VAR_0]; return NULL; }
[ "static const HWAccel *FUNC_0(enum AVPixelFormat pix_fmt, enum HWAccelID selected_hwaccel_id)\n{", "int VAR_0;", "for (VAR_0 = 0; hwaccels[VAR_0].name; VAR_0++)", "if (hwaccels[VAR_0].pix_fmt == pix_fmt &&\n(!selected_hwaccel_id || selected_hwaccel_id == HWACCEL_AUTO || hwaccels[VAR_0].id == selected_hwaccel_id))\nreturn &hwaccels[VAR_0];", "return NULL;", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9, 11, 13 ], [ 15 ], [ 17 ] ]
11,157
static int ir2_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; Ir2Context * const s = avctx->priv_data; AVFrame *picture = data; AVFrame * const p = &s->picture; int start, ret; if(p->data[0]) avctx->release_buffer(avctx, p); p->reference = 1; p->buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE; if ((ret = avctx->reget_buffer(avctx, p)) < 0) { av_log(s->avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); return ret; } start = 48; /* hardcoded for now */ if (start >= buf_size) { av_log(s->avctx, AV_LOG_ERROR, "input buffer size too small (%d)\n", buf_size); return AVERROR_INVALIDDATA; } s->decode_delta = buf[18]; /* decide whether frame uses deltas or not */ #ifndef BITSTREAM_READER_LE for (i = 0; i < buf_size; i++) buf[i] = ff_reverse[buf[i]]; #endif init_get_bits(&s->gb, buf + start, (buf_size - start) * 8); if (s->decode_delta) { /* intraframe */ ir2_decode_plane(s, avctx->width, avctx->height, s->picture.data[0], s->picture.linesize[0], ir2_luma_table); /* swapped U and V */ ir2_decode_plane(s, avctx->width >> 2, avctx->height >> 2, s->picture.data[2], s->picture.linesize[2], ir2_luma_table); ir2_decode_plane(s, avctx->width >> 2, avctx->height >> 2, s->picture.data[1], s->picture.linesize[1], ir2_luma_table); } else { /* interframe */ ir2_decode_plane_inter(s, avctx->width, avctx->height, s->picture.data[0], s->picture.linesize[0], ir2_luma_table); /* swapped U and V */ ir2_decode_plane_inter(s, avctx->width >> 2, avctx->height >> 2, s->picture.data[2], s->picture.linesize[2], ir2_luma_table); ir2_decode_plane_inter(s, avctx->width >> 2, avctx->height >> 2, s->picture.data[1], s->picture.linesize[1], ir2_luma_table); } *picture = s->picture; *got_frame = 1; return buf_size; }
false
FFmpeg
7b1fbd4729a52dd7c02622dbe7bb81a6a7ed12f8
static int ir2_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; Ir2Context * const s = avctx->priv_data; AVFrame *picture = data; AVFrame * const p = &s->picture; int start, ret; if(p->data[0]) avctx->release_buffer(avctx, p); p->reference = 1; p->buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE; if ((ret = avctx->reget_buffer(avctx, p)) < 0) { av_log(s->avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); return ret; } start = 48; if (start >= buf_size) { av_log(s->avctx, AV_LOG_ERROR, "input buffer size too small (%d)\n", buf_size); return AVERROR_INVALIDDATA; } s->decode_delta = buf[18]; #ifndef BITSTREAM_READER_LE for (i = 0; i < buf_size; i++) buf[i] = ff_reverse[buf[i]]; #endif init_get_bits(&s->gb, buf + start, (buf_size - start) * 8); if (s->decode_delta) { ir2_decode_plane(s, avctx->width, avctx->height, s->picture.data[0], s->picture.linesize[0], ir2_luma_table); ir2_decode_plane(s, avctx->width >> 2, avctx->height >> 2, s->picture.data[2], s->picture.linesize[2], ir2_luma_table); ir2_decode_plane(s, avctx->width >> 2, avctx->height >> 2, s->picture.data[1], s->picture.linesize[1], ir2_luma_table); } else { ir2_decode_plane_inter(s, avctx->width, avctx->height, s->picture.data[0], s->picture.linesize[0], ir2_luma_table); ir2_decode_plane_inter(s, avctx->width >> 2, avctx->height >> 2, s->picture.data[2], s->picture.linesize[2], ir2_luma_table); ir2_decode_plane_inter(s, avctx->width >> 2, avctx->height >> 2, s->picture.data[1], s->picture.linesize[1], ir2_luma_table); } *picture = s->picture; *got_frame = 1; return buf_size; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3) { const uint8_t *VAR_4 = VAR_3->VAR_1; int VAR_5 = VAR_3->size; Ir2Context * const s = VAR_0->priv_data; AVFrame *picture = VAR_1; AVFrame * const p = &s->picture; int VAR_6, VAR_7; if(p->VAR_1[0]) VAR_0->release_buffer(VAR_0, p); p->reference = 1; p->buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE; if ((VAR_7 = VAR_0->reget_buffer(VAR_0, p)) < 0) { av_log(s->VAR_0, AV_LOG_ERROR, "reget_buffer() failed\n"); return VAR_7; } VAR_6 = 48; if (VAR_6 >= VAR_5) { av_log(s->VAR_0, AV_LOG_ERROR, "input buffer size too small (%d)\n", VAR_5); return AVERROR_INVALIDDATA; } s->decode_delta = VAR_4[18]; #ifndef BITSTREAM_READER_LE for (i = 0; i < VAR_5; i++) VAR_4[i] = ff_reverse[VAR_4[i]]; #endif init_get_bits(&s->gb, VAR_4 + VAR_6, (VAR_5 - VAR_6) * 8); if (s->decode_delta) { ir2_decode_plane(s, VAR_0->width, VAR_0->height, s->picture.VAR_1[0], s->picture.linesize[0], ir2_luma_table); ir2_decode_plane(s, VAR_0->width >> 2, VAR_0->height >> 2, s->picture.VAR_1[2], s->picture.linesize[2], ir2_luma_table); ir2_decode_plane(s, VAR_0->width >> 2, VAR_0->height >> 2, s->picture.VAR_1[1], s->picture.linesize[1], ir2_luma_table); } else { ir2_decode_plane_inter(s, VAR_0->width, VAR_0->height, s->picture.VAR_1[0], s->picture.linesize[0], ir2_luma_table); ir2_decode_plane_inter(s, VAR_0->width >> 2, VAR_0->height >> 2, s->picture.VAR_1[2], s->picture.linesize[2], ir2_luma_table); ir2_decode_plane_inter(s, VAR_0->width >> 2, VAR_0->height >> 2, s->picture.VAR_1[1], s->picture.linesize[1], ir2_luma_table); } *picture = s->picture; *VAR_2 = 1; return VAR_5; }
[ "static int FUNC_0(AVCodecContext *VAR_0,\nvoid *VAR_1, int *VAR_2,\nAVPacket *VAR_3)\n{", "const uint8_t *VAR_4 = VAR_3->VAR_1;", "int VAR_5 = VAR_3->size;", "Ir2Context * const s = VAR_0->priv_data;", "AVFrame *picture = VAR_1;", "AVFrame * const p = &s->picture;", "int VAR_6, VAR_7;", "if(p->VAR_1[0])\nVAR_0->release_buffer(VAR_0, p);", "p->reference = 1;", "p->buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;", "if ((VAR_7 = VAR_0->reget_buffer(VAR_0, p)) < 0) {", "av_log(s->VAR_0, AV_LOG_ERROR, \"reget_buffer() failed\\n\");", "return VAR_7;", "}", "VAR_6 = 48;", "if (VAR_6 >= VAR_5) {", "av_log(s->VAR_0, AV_LOG_ERROR, \"input buffer size too small (%d)\\n\", VAR_5);", "return AVERROR_INVALIDDATA;", "}", "s->decode_delta = VAR_4[18];", "#ifndef BITSTREAM_READER_LE\nfor (i = 0; i < VAR_5; i++)", "VAR_4[i] = ff_reverse[VAR_4[i]];", "#endif\ninit_get_bits(&s->gb, VAR_4 + VAR_6, (VAR_5 - VAR_6) * 8);", "if (s->decode_delta) {", "ir2_decode_plane(s, VAR_0->width, VAR_0->height,\ns->picture.VAR_1[0], s->picture.linesize[0], ir2_luma_table);", "ir2_decode_plane(s, VAR_0->width >> 2, VAR_0->height >> 2,\ns->picture.VAR_1[2], s->picture.linesize[2], ir2_luma_table);", "ir2_decode_plane(s, VAR_0->width >> 2, VAR_0->height >> 2,\ns->picture.VAR_1[1], s->picture.linesize[1], ir2_luma_table);", "} else {", "ir2_decode_plane_inter(s, VAR_0->width, VAR_0->height,\ns->picture.VAR_1[0], s->picture.linesize[0], ir2_luma_table);", "ir2_decode_plane_inter(s, VAR_0->width >> 2, VAR_0->height >> 2,\ns->picture.VAR_1[2], s->picture.linesize[2], ir2_luma_table);", "ir2_decode_plane_inter(s, VAR_0->width >> 2, VAR_0->height >> 2,\ns->picture.VAR_1[1], s->picture.linesize[1], ir2_luma_table);", "}", "*picture = s->picture;", "*VAR_2 = 1;", "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 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23, 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 63, 65 ], [ 67 ], [ 69, 73 ], [ 77 ], [ 79, 81 ], [ 85, 87 ], [ 89, 91 ], [ 93 ], [ 95, 97 ], [ 101, 103 ], [ 105, 107 ], [ 109 ], [ 113 ], [ 115 ], [ 119 ], [ 121 ] ]
11,159
static int rsd_read_packet(AVFormatContext *s, AVPacket *pkt) { AVCodecContext *codec = s->streams[0]->codec; int ret, size = 1024; if (avio_feof(s->pb)) return AVERROR_EOF; if (codec->codec_id == AV_CODEC_ID_ADPCM_IMA_RAD || codec->codec_id == AV_CODEC_ID_ADPCM_IMA_WAV) { ret = av_get_packet(s->pb, pkt, codec->block_align); } else if (codec->codec_tag == MKTAG('W','A','D','P') && codec->channels > 1) { int i, ch; av_new_packet(pkt, codec->block_align); for (i = 0; i < 4; i++) { for (ch = 0; ch < codec->channels; ch++) { pkt->data[ch * 8 + i * 2 + 0] = avio_r8(s->pb); pkt->data[ch * 8 + i * 2 + 1] = avio_r8(s->pb); } } ret = 0; } else { ret = av_get_packet(s->pb, pkt, size); } pkt->stream_index = 0; return ret; }
false
FFmpeg
92a26261d1ccc02c4fbdae2031e279009804c159
static int rsd_read_packet(AVFormatContext *s, AVPacket *pkt) { AVCodecContext *codec = s->streams[0]->codec; int ret, size = 1024; if (avio_feof(s->pb)) return AVERROR_EOF; if (codec->codec_id == AV_CODEC_ID_ADPCM_IMA_RAD || codec->codec_id == AV_CODEC_ID_ADPCM_IMA_WAV) { ret = av_get_packet(s->pb, pkt, codec->block_align); } else if (codec->codec_tag == MKTAG('W','A','D','P') && codec->channels > 1) { int i, ch; av_new_packet(pkt, codec->block_align); for (i = 0; i < 4; i++) { for (ch = 0; ch < codec->channels; ch++) { pkt->data[ch * 8 + i * 2 + 0] = avio_r8(s->pb); pkt->data[ch * 8 + i * 2 + 1] = avio_r8(s->pb); } } ret = 0; } else { ret = av_get_packet(s->pb, pkt, size); } pkt->stream_index = 0; return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1) { AVCodecContext *codec = VAR_0->streams[0]->codec; int VAR_2, VAR_3 = 1024; if (avio_feof(VAR_0->pb)) return AVERROR_EOF; if (codec->codec_id == AV_CODEC_ID_ADPCM_IMA_RAD || codec->codec_id == AV_CODEC_ID_ADPCM_IMA_WAV) { VAR_2 = av_get_packet(VAR_0->pb, VAR_1, codec->block_align); } else if (codec->codec_tag == MKTAG('W','A','D','P') && codec->channels > 1) { int VAR_4, VAR_5; av_new_packet(VAR_1, codec->block_align); for (VAR_4 = 0; VAR_4 < 4; VAR_4++) { for (VAR_5 = 0; VAR_5 < codec->channels; VAR_5++) { VAR_1->data[VAR_5 * 8 + VAR_4 * 2 + 0] = avio_r8(VAR_0->pb); VAR_1->data[VAR_5 * 8 + VAR_4 * 2 + 1] = avio_r8(VAR_0->pb); } } VAR_2 = 0; } else { VAR_2 = av_get_packet(VAR_0->pb, VAR_1, VAR_3); } VAR_1->stream_index = 0; return VAR_2; }
[ "static int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1)\n{", "AVCodecContext *codec = VAR_0->streams[0]->codec;", "int VAR_2, VAR_3 = 1024;", "if (avio_feof(VAR_0->pb))\nreturn AVERROR_EOF;", "if (codec->codec_id == AV_CODEC_ID_ADPCM_IMA_RAD ||\ncodec->codec_id == AV_CODEC_ID_ADPCM_IMA_WAV) {", "VAR_2 = av_get_packet(VAR_0->pb, VAR_1, codec->block_align);", "} else if (codec->codec_tag == MKTAG('W','A','D','P') &&", "codec->channels > 1) {", "int VAR_4, VAR_5;", "av_new_packet(VAR_1, codec->block_align);", "for (VAR_4 = 0; VAR_4 < 4; VAR_4++) {", "for (VAR_5 = 0; VAR_5 < codec->channels; VAR_5++) {", "VAR_1->data[VAR_5 * 8 + VAR_4 * 2 + 0] = avio_r8(VAR_0->pb);", "VAR_1->data[VAR_5 * 8 + VAR_4 * 2 + 1] = avio_r8(VAR_0->pb);", "}", "}", "VAR_2 = 0;", "} else {", "VAR_2 = av_get_packet(VAR_0->pb, VAR_1, VAR_3);", "}", "VAR_1->stream_index = 0;", "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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11, 13 ], [ 17, 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 59 ], [ 61 ] ]
11,161
static TCGv_i64 gen_muls_i64_i32(TCGv a, TCGv b) { TCGv_i64 tmp1 = tcg_temp_new_i64(); TCGv_i64 tmp2 = tcg_temp_new_i64(); tcg_gen_ext_i32_i64(tmp1, a); dead_tmp(a); tcg_gen_ext_i32_i64(tmp2, b); dead_tmp(b); tcg_gen_mul_i64(tmp1, tmp1, tmp2); tcg_temp_free_i64(tmp2); return tmp1; }
true
qemu
7d1b0095bff7157e856d1d0e6c4295641ced2752
static TCGv_i64 gen_muls_i64_i32(TCGv a, TCGv b) { TCGv_i64 tmp1 = tcg_temp_new_i64(); TCGv_i64 tmp2 = tcg_temp_new_i64(); tcg_gen_ext_i32_i64(tmp1, a); dead_tmp(a); tcg_gen_ext_i32_i64(tmp2, b); dead_tmp(b); tcg_gen_mul_i64(tmp1, tmp1, tmp2); tcg_temp_free_i64(tmp2); return tmp1; }
{ "code": [ " dead_tmp(b);", " dead_tmp(b);", " dead_tmp(a);", " dead_tmp(b);", " dead_tmp(a);", " dead_tmp(b);" ], "line_no": [ 17, 17, 13, 17, 13, 17 ] }
static TCGv_i64 FUNC_0(TCGv a, TCGv b) { TCGv_i64 tmp1 = tcg_temp_new_i64(); TCGv_i64 tmp2 = tcg_temp_new_i64(); tcg_gen_ext_i32_i64(tmp1, a); dead_tmp(a); tcg_gen_ext_i32_i64(tmp2, b); dead_tmp(b); tcg_gen_mul_i64(tmp1, tmp1, tmp2); tcg_temp_free_i64(tmp2); return tmp1; }
[ "static TCGv_i64 FUNC_0(TCGv a, TCGv b)\n{", "TCGv_i64 tmp1 = tcg_temp_new_i64();", "TCGv_i64 tmp2 = tcg_temp_new_i64();", "tcg_gen_ext_i32_i64(tmp1, a);", "dead_tmp(a);", "tcg_gen_ext_i32_i64(tmp2, b);", "dead_tmp(b);", "tcg_gen_mul_i64(tmp1, tmp1, tmp2);", "tcg_temp_free_i64(tmp2);", "return tmp1;", "}" ]
[ 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ] ]
11,162
void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size) { void **p = ptr; if (min_size < *size) return; min_size= FFMAX(17*min_size/16 + 32, min_size); av_free(*p); *p = av_malloc(min_size); if (!*p) min_size = 0; *size= min_size; }
true
FFmpeg
3b55429d5692dd782d8b3ce6a19819305157d1b8
void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size) { void **p = ptr; if (min_size < *size) return; min_size= FFMAX(17*min_size/16 + 32, min_size); av_free(*p); *p = av_malloc(min_size); if (!*p) min_size = 0; *size= min_size; }
{ "code": [ "void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size)", " *p = av_malloc(min_size);" ], "line_no": [ 1, 15 ] }
void FUNC_0(void *VAR_0, unsigned int *VAR_1, size_t VAR_2) { void **VAR_3 = VAR_0; if (VAR_2 < *VAR_1) return; VAR_2= FFMAX(17*VAR_2/16 + 32, VAR_2); av_free(*VAR_3); *VAR_3 = av_malloc(VAR_2); if (!*VAR_3) VAR_2 = 0; *VAR_1= VAR_2; }
[ "void FUNC_0(void *VAR_0, unsigned int *VAR_1, size_t VAR_2)\n{", "void **VAR_3 = VAR_0;", "if (VAR_2 < *VAR_1)\nreturn;", "VAR_2= FFMAX(17*VAR_2/16 + 32, VAR_2);", "av_free(*VAR_3);", "*VAR_3 = av_malloc(VAR_2);", "if (!*VAR_3) VAR_2 = 0;", "*VAR_1= VAR_2;", "}" ]
[ 1, 0, 0, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
11,163
static void vmxnet3_fill_stats(VMXNET3State *s) { int i; if (!s->device_active) return; for (i = 0; i < s->txq_num; i++) { pci_dma_write(PCI_DEVICE(s), s->txq_descr[i].tx_stats_pa, &s->txq_descr[i].txq_stats, sizeof(s->txq_descr[i].txq_stats)); } for (i = 0; i < s->rxq_num; i++) { pci_dma_write(PCI_DEVICE(s), s->rxq_descr[i].rx_stats_pa, &s->rxq_descr[i].rxq_stats, sizeof(s->rxq_descr[i].rxq_stats)); } }
true
qemu
c508277335e3b6b20cf18e6ea3a35c1fa835c64a
static void vmxnet3_fill_stats(VMXNET3State *s) { int i; if (!s->device_active) return; for (i = 0; i < s->txq_num; i++) { pci_dma_write(PCI_DEVICE(s), s->txq_descr[i].tx_stats_pa, &s->txq_descr[i].txq_stats, sizeof(s->txq_descr[i].txq_stats)); } for (i = 0; i < s->rxq_num; i++) { pci_dma_write(PCI_DEVICE(s), s->rxq_descr[i].rx_stats_pa, &s->rxq_descr[i].rxq_stats, sizeof(s->rxq_descr[i].rxq_stats)); } }
{ "code": [ " pci_dma_write(PCI_DEVICE(s),", " pci_dma_write(PCI_DEVICE(s)," ], "line_no": [ 17, 17 ] }
static void FUNC_0(VMXNET3State *VAR_0) { int VAR_1; if (!VAR_0->device_active) return; for (VAR_1 = 0; VAR_1 < VAR_0->txq_num; VAR_1++) { pci_dma_write(PCI_DEVICE(VAR_0), VAR_0->txq_descr[VAR_1].tx_stats_pa, &VAR_0->txq_descr[VAR_1].txq_stats, sizeof(VAR_0->txq_descr[VAR_1].txq_stats)); } for (VAR_1 = 0; VAR_1 < VAR_0->rxq_num; VAR_1++) { pci_dma_write(PCI_DEVICE(VAR_0), VAR_0->rxq_descr[VAR_1].rx_stats_pa, &VAR_0->rxq_descr[VAR_1].rxq_stats, sizeof(VAR_0->rxq_descr[VAR_1].rxq_stats)); } }
[ "static void FUNC_0(VMXNET3State *VAR_0)\n{", "int VAR_1;", "if (!VAR_0->device_active)\nreturn;", "for (VAR_1 = 0; VAR_1 < VAR_0->txq_num; VAR_1++) {", "pci_dma_write(PCI_DEVICE(VAR_0),\nVAR_0->txq_descr[VAR_1].tx_stats_pa,\n&VAR_0->txq_descr[VAR_1].txq_stats,\nsizeof(VAR_0->txq_descr[VAR_1].txq_stats));", "}", "for (VAR_1 = 0; VAR_1 < VAR_0->rxq_num; VAR_1++) {", "pci_dma_write(PCI_DEVICE(VAR_0),\nVAR_0->rxq_descr[VAR_1].rx_stats_pa,\n&VAR_0->rxq_descr[VAR_1].rxq_stats,\nsizeof(VAR_0->rxq_descr[VAR_1].rxq_stats));", "}", "}" ]
[ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11 ], [ 15 ], [ 17, 19, 21, 23 ], [ 25 ], [ 29 ], [ 31, 33, 35, 37 ], [ 39 ], [ 41 ] ]
11,164
static int ljpeg_decode_yuv_scan(MJpegDecodeContext *s, int predictor, int point_transform) { int i, mb_x, mb_y; const int nb_components=s->nb_components; int bits= (s->bits+7)&~7; int resync_mb_y = 0; int resync_mb_x = 0; point_transform += bits - s->bits; av_assert0(nb_components>=1 && nb_components<=3); for (mb_y = 0; mb_y < s->mb_height; mb_y++) { for (mb_x = 0; mb_x < s->mb_width; mb_x++) { if (s->restart_interval && !s->restart_count){ s->restart_count = s->restart_interval; resync_mb_x = mb_x; resync_mb_y = mb_y; } if(!mb_x || mb_y == resync_mb_y || mb_y == resync_mb_y+1 && mb_x < resync_mb_x || s->interlaced){ int toprow = mb_y == resync_mb_y || mb_y == resync_mb_y+1 && mb_x < resync_mb_x; int leftcol = !mb_x || mb_y == resync_mb_y && mb_x == resync_mb_x; for (i = 0; i < nb_components; i++) { uint8_t *ptr; uint16_t *ptr16; int n, h, v, x, y, c, j, linesize; n = s->nb_blocks[i]; c = s->comp_index[i]; h = s->h_scount[i]; v = s->v_scount[i]; x = 0; y = 0; linesize= s->linesize[c]; if(bits>8) linesize /= 2; for(j=0; j<n; j++) { int pred, dc; dc = mjpeg_decode_dc(s, s->dc_index[i]); if(dc == 0xFFFF) return -1; if(bits<=8){ ptr = s->picture.data[c] + (linesize * (v * mb_y + y)) + (h * mb_x + x); //FIXME optimize this crap if(y==0 && toprow){ if(x==0 && leftcol){ pred= 1 << (bits - 1); }else{ pred= ptr[-1]; } }else{ if(x==0 && leftcol){ pred= ptr[-linesize]; }else{ PREDICT(pred, ptr[-linesize-1], ptr[-linesize], ptr[-1], predictor); } } if (s->interlaced && s->bottom_field) ptr += linesize >> 1; pred &= (-1)<<(8-s->bits); *ptr= pred + (dc << point_transform); }else{ ptr16 = (uint16_t*)(s->picture.data[c] + 2*(linesize * (v * mb_y + y)) + 2*(h * mb_x + x)); //FIXME optimize this crap if(y==0 && toprow){ if(x==0 && leftcol){ pred= 1 << (bits - 1); }else{ pred= ptr16[-1]; } }else{ if(x==0 && leftcol){ pred= ptr16[-linesize]; }else{ PREDICT(pred, ptr16[-linesize-1], ptr16[-linesize], ptr16[-1], predictor); } } if (s->interlaced && s->bottom_field) ptr16 += linesize >> 1; pred &= (-1)<<(16-s->bits); *ptr16= pred + (dc << point_transform); } if (++x == h) { x = 0; y++; } } } } else { for (i = 0; i < nb_components; i++) { uint8_t *ptr; uint16_t *ptr16; int n, h, v, x, y, c, j, linesize, dc; n = s->nb_blocks[i]; c = s->comp_index[i]; h = s->h_scount[i]; v = s->v_scount[i]; x = 0; y = 0; linesize = s->linesize[c]; if(bits>8) linesize /= 2; for (j = 0; j < n; j++) { int pred; dc = mjpeg_decode_dc(s, s->dc_index[i]); if(dc == 0xFFFF) return -1; if(bits<=8){ ptr = s->picture.data[c] + (linesize * (v * mb_y + y)) + (h * mb_x + x); //FIXME optimize this crap PREDICT(pred, ptr[-linesize-1], ptr[-linesize], ptr[-1], predictor); pred &= (-1)<<(8-s->bits); *ptr = pred + (dc << point_transform); }else{ ptr16 = (uint16_t*)(s->picture.data[c] + 2*(linesize * (v * mb_y + y)) + 2*(h * mb_x + x)); //FIXME optimize this crap PREDICT(pred, ptr16[-linesize-1], ptr16[-linesize], ptr16[-1], predictor); pred &= (-1)<<(16-s->bits); *ptr16= pred + (dc << point_transform); } if (++x == h) { x = 0; y++; } } } } if (s->restart_interval && !--s->restart_count) { align_get_bits(&s->gb); skip_bits(&s->gb, 16); /* skip RSTn */ } } } return 0; }
true
FFmpeg
b2e57eb5a3cb9d5dfab601077fa0edee91e06ca5
static int ljpeg_decode_yuv_scan(MJpegDecodeContext *s, int predictor, int point_transform) { int i, mb_x, mb_y; const int nb_components=s->nb_components; int bits= (s->bits+7)&~7; int resync_mb_y = 0; int resync_mb_x = 0; point_transform += bits - s->bits; av_assert0(nb_components>=1 && nb_components<=3); for (mb_y = 0; mb_y < s->mb_height; mb_y++) { for (mb_x = 0; mb_x < s->mb_width; mb_x++) { if (s->restart_interval && !s->restart_count){ s->restart_count = s->restart_interval; resync_mb_x = mb_x; resync_mb_y = mb_y; } if(!mb_x || mb_y == resync_mb_y || mb_y == resync_mb_y+1 && mb_x < resync_mb_x || s->interlaced){ int toprow = mb_y == resync_mb_y || mb_y == resync_mb_y+1 && mb_x < resync_mb_x; int leftcol = !mb_x || mb_y == resync_mb_y && mb_x == resync_mb_x; for (i = 0; i < nb_components; i++) { uint8_t *ptr; uint16_t *ptr16; int n, h, v, x, y, c, j, linesize; n = s->nb_blocks[i]; c = s->comp_index[i]; h = s->h_scount[i]; v = s->v_scount[i]; x = 0; y = 0; linesize= s->linesize[c]; if(bits>8) linesize /= 2; for(j=0; j<n; j++) { int pred, dc; dc = mjpeg_decode_dc(s, s->dc_index[i]); if(dc == 0xFFFF) return -1; if(bits<=8){ ptr = s->picture.data[c] + (linesize * (v * mb_y + y)) + (h * mb_x + x); if(y==0 && toprow){ if(x==0 && leftcol){ pred= 1 << (bits - 1); }else{ pred= ptr[-1]; } }else{ if(x==0 && leftcol){ pred= ptr[-linesize]; }else{ PREDICT(pred, ptr[-linesize-1], ptr[-linesize], ptr[-1], predictor); } } if (s->interlaced && s->bottom_field) ptr += linesize >> 1; pred &= (-1)<<(8-s->bits); *ptr= pred + (dc << point_transform); }else{ ptr16 = (uint16_t*)(s->picture.data[c] + 2*(linesize * (v * mb_y + y)) + 2*(h * mb_x + x)); if(y==0 && toprow){ if(x==0 && leftcol){ pred= 1 << (bits - 1); }else{ pred= ptr16[-1]; } }else{ if(x==0 && leftcol){ pred= ptr16[-linesize]; }else{ PREDICT(pred, ptr16[-linesize-1], ptr16[-linesize], ptr16[-1], predictor); } } if (s->interlaced && s->bottom_field) ptr16 += linesize >> 1; pred &= (-1)<<(16-s->bits); *ptr16= pred + (dc << point_transform); } if (++x == h) { x = 0; y++; } } } } else { for (i = 0; i < nb_components; i++) { uint8_t *ptr; uint16_t *ptr16; int n, h, v, x, y, c, j, linesize, dc; n = s->nb_blocks[i]; c = s->comp_index[i]; h = s->h_scount[i]; v = s->v_scount[i]; x = 0; y = 0; linesize = s->linesize[c]; if(bits>8) linesize /= 2; for (j = 0; j < n; j++) { int pred; dc = mjpeg_decode_dc(s, s->dc_index[i]); if(dc == 0xFFFF) return -1; if(bits<=8){ ptr = s->picture.data[c] + (linesize * (v * mb_y + y)) + (h * mb_x + x); PREDICT(pred, ptr[-linesize-1], ptr[-linesize], ptr[-1], predictor); pred &= (-1)<<(8-s->bits); *ptr = pred + (dc << point_transform); }else{ ptr16 = (uint16_t*)(s->picture.data[c] + 2*(linesize * (v * mb_y + y)) + 2*(h * mb_x + x)); PREDICT(pred, ptr16[-linesize-1], ptr16[-linesize], ptr16[-1], predictor); pred &= (-1)<<(16-s->bits); *ptr16= pred + (dc << point_transform); } if (++x == h) { x = 0; y++; } } } } if (s->restart_interval && !--s->restart_count) { align_get_bits(&s->gb); skip_bits(&s->gb, 16); } } } return 0; }
{ "code": [ "static int ljpeg_decode_yuv_scan(MJpegDecodeContext *s, int predictor,", " const int nb_components=s->nb_components;" ], "line_no": [ 1, 9 ] }
static int FUNC_0(MJpegDecodeContext *VAR_0, int VAR_1, int VAR_2) { int VAR_3, VAR_4, VAR_5; const int VAR_6=VAR_0->VAR_6; int VAR_7= (VAR_0->VAR_7+7)&~7; int VAR_8 = 0; int VAR_9 = 0; VAR_2 += VAR_7 - VAR_0->VAR_7; av_assert0(VAR_6>=1 && VAR_6<=3); for (VAR_5 = 0; VAR_5 < VAR_0->mb_height; VAR_5++) { for (VAR_4 = 0; VAR_4 < VAR_0->mb_width; VAR_4++) { if (VAR_0->restart_interval && !VAR_0->restart_count){ VAR_0->restart_count = VAR_0->restart_interval; VAR_9 = VAR_4; VAR_8 = VAR_5; } if(!VAR_4 || VAR_5 == VAR_8 || VAR_5 == VAR_8+1 && VAR_4 < VAR_9 || VAR_0->interlaced){ int toprow = VAR_5 == VAR_8 || VAR_5 == VAR_8+1 && VAR_4 < VAR_9; int leftcol = !VAR_4 || VAR_5 == VAR_8 && VAR_4 == VAR_9; for (VAR_3 = 0; VAR_3 < VAR_6; VAR_3++) { uint8_t *ptr; uint16_t *ptr16; int n, h, v, x, y, c, j, linesize; n = VAR_0->nb_blocks[VAR_3]; c = VAR_0->comp_index[VAR_3]; h = VAR_0->h_scount[VAR_3]; v = VAR_0->v_scount[VAR_3]; x = 0; y = 0; linesize= VAR_0->linesize[c]; if(VAR_7>8) linesize /= 2; for(j=0; j<n; j++) { int pred, dc; dc = mjpeg_decode_dc(VAR_0, VAR_0->dc_index[VAR_3]); if(dc == 0xFFFF) return -1; if(VAR_7<=8){ ptr = VAR_0->picture.data[c] + (linesize * (v * VAR_5 + y)) + (h * VAR_4 + x); if(y==0 && toprow){ if(x==0 && leftcol){ pred= 1 << (VAR_7 - 1); }else{ pred= ptr[-1]; } }else{ if(x==0 && leftcol){ pred= ptr[-linesize]; }else{ PREDICT(pred, ptr[-linesize-1], ptr[-linesize], ptr[-1], VAR_1); } } if (VAR_0->interlaced && VAR_0->bottom_field) ptr += linesize >> 1; pred &= (-1)<<(8-VAR_0->VAR_7); *ptr= pred + (dc << VAR_2); }else{ ptr16 = (uint16_t*)(VAR_0->picture.data[c] + 2*(linesize * (v * VAR_5 + y)) + 2*(h * VAR_4 + x)); if(y==0 && toprow){ if(x==0 && leftcol){ pred= 1 << (VAR_7 - 1); }else{ pred= ptr16[-1]; } }else{ if(x==0 && leftcol){ pred= ptr16[-linesize]; }else{ PREDICT(pred, ptr16[-linesize-1], ptr16[-linesize], ptr16[-1], VAR_1); } } if (VAR_0->interlaced && VAR_0->bottom_field) ptr16 += linesize >> 1; pred &= (-1)<<(16-VAR_0->VAR_7); *ptr16= pred + (dc << VAR_2); } if (++x == h) { x = 0; y++; } } } } else { for (VAR_3 = 0; VAR_3 < VAR_6; VAR_3++) { uint8_t *ptr; uint16_t *ptr16; int n, h, v, x, y, c, j, linesize, dc; n = VAR_0->nb_blocks[VAR_3]; c = VAR_0->comp_index[VAR_3]; h = VAR_0->h_scount[VAR_3]; v = VAR_0->v_scount[VAR_3]; x = 0; y = 0; linesize = VAR_0->linesize[c]; if(VAR_7>8) linesize /= 2; for (j = 0; j < n; j++) { int pred; dc = mjpeg_decode_dc(VAR_0, VAR_0->dc_index[VAR_3]); if(dc == 0xFFFF) return -1; if(VAR_7<=8){ ptr = VAR_0->picture.data[c] + (linesize * (v * VAR_5 + y)) + (h * VAR_4 + x); PREDICT(pred, ptr[-linesize-1], ptr[-linesize], ptr[-1], VAR_1); pred &= (-1)<<(8-VAR_0->VAR_7); *ptr = pred + (dc << VAR_2); }else{ ptr16 = (uint16_t*)(VAR_0->picture.data[c] + 2*(linesize * (v * VAR_5 + y)) + 2*(h * VAR_4 + x)); PREDICT(pred, ptr16[-linesize-1], ptr16[-linesize], ptr16[-1], VAR_1); pred &= (-1)<<(16-VAR_0->VAR_7); *ptr16= pred + (dc << VAR_2); } if (++x == h) { x = 0; y++; } } } } if (VAR_0->restart_interval && !--VAR_0->restart_count) { align_get_bits(&VAR_0->gb); skip_bits(&VAR_0->gb, 16); } } } return 0; }
[ "static int FUNC_0(MJpegDecodeContext *VAR_0, int VAR_1,\nint VAR_2)\n{", "int VAR_3, VAR_4, VAR_5;", "const int VAR_6=VAR_0->VAR_6;", "int VAR_7= (VAR_0->VAR_7+7)&~7;", "int VAR_8 = 0;", "int VAR_9 = 0;", "VAR_2 += VAR_7 - VAR_0->VAR_7;", "av_assert0(VAR_6>=1 && VAR_6<=3);", "for (VAR_5 = 0; VAR_5 < VAR_0->mb_height; VAR_5++) {", "for (VAR_4 = 0; VAR_4 < VAR_0->mb_width; VAR_4++) {", "if (VAR_0->restart_interval && !VAR_0->restart_count){", "VAR_0->restart_count = VAR_0->restart_interval;", "VAR_9 = VAR_4;", "VAR_8 = VAR_5;", "}", "if(!VAR_4 || VAR_5 == VAR_8 || VAR_5 == VAR_8+1 && VAR_4 < VAR_9 || VAR_0->interlaced){", "int toprow = VAR_5 == VAR_8 || VAR_5 == VAR_8+1 && VAR_4 < VAR_9;", "int leftcol = !VAR_4 || VAR_5 == VAR_8 && VAR_4 == VAR_9;", "for (VAR_3 = 0; VAR_3 < VAR_6; VAR_3++) {", "uint8_t *ptr;", "uint16_t *ptr16;", "int n, h, v, x, y, c, j, linesize;", "n = VAR_0->nb_blocks[VAR_3];", "c = VAR_0->comp_index[VAR_3];", "h = VAR_0->h_scount[VAR_3];", "v = VAR_0->v_scount[VAR_3];", "x = 0;", "y = 0;", "linesize= VAR_0->linesize[c];", "if(VAR_7>8) linesize /= 2;", "for(j=0; j<n; j++) {", "int pred, dc;", "dc = mjpeg_decode_dc(VAR_0, VAR_0->dc_index[VAR_3]);", "if(dc == 0xFFFF)\nreturn -1;", "if(VAR_7<=8){", "ptr = VAR_0->picture.data[c] + (linesize * (v * VAR_5 + y)) + (h * VAR_4 + x);", "if(y==0 && toprow){", "if(x==0 && leftcol){", "pred= 1 << (VAR_7 - 1);", "}else{", "pred= ptr[-1];", "}", "}else{", "if(x==0 && leftcol){", "pred= ptr[-linesize];", "}else{", "PREDICT(pred, ptr[-linesize-1], ptr[-linesize], ptr[-1], VAR_1);", "}", "}", "if (VAR_0->interlaced && VAR_0->bottom_field)\nptr += linesize >> 1;", "pred &= (-1)<<(8-VAR_0->VAR_7);", "*ptr= pred + (dc << VAR_2);", "}else{", "ptr16 = (uint16_t*)(VAR_0->picture.data[c] + 2*(linesize * (v * VAR_5 + y)) + 2*(h * VAR_4 + x));", "if(y==0 && toprow){", "if(x==0 && leftcol){", "pred= 1 << (VAR_7 - 1);", "}else{", "pred= ptr16[-1];", "}", "}else{", "if(x==0 && leftcol){", "pred= ptr16[-linesize];", "}else{", "PREDICT(pred, ptr16[-linesize-1], ptr16[-linesize], ptr16[-1], VAR_1);", "}", "}", "if (VAR_0->interlaced && VAR_0->bottom_field)\nptr16 += linesize >> 1;", "pred &= (-1)<<(16-VAR_0->VAR_7);", "*ptr16= pred + (dc << VAR_2);", "}", "if (++x == h) {", "x = 0;", "y++;", "}", "}", "}", "} else {", "for (VAR_3 = 0; VAR_3 < VAR_6; VAR_3++) {", "uint8_t *ptr;", "uint16_t *ptr16;", "int n, h, v, x, y, c, j, linesize, dc;", "n = VAR_0->nb_blocks[VAR_3];", "c = VAR_0->comp_index[VAR_3];", "h = VAR_0->h_scount[VAR_3];", "v = VAR_0->v_scount[VAR_3];", "x = 0;", "y = 0;", "linesize = VAR_0->linesize[c];", "if(VAR_7>8) linesize /= 2;", "for (j = 0; j < n; j++) {", "int pred;", "dc = mjpeg_decode_dc(VAR_0, VAR_0->dc_index[VAR_3]);", "if(dc == 0xFFFF)\nreturn -1;", "if(VAR_7<=8){", "ptr = VAR_0->picture.data[c] +\n(linesize * (v * VAR_5 + y)) +\n(h * VAR_4 + x);", "PREDICT(pred, ptr[-linesize-1], ptr[-linesize], ptr[-1], VAR_1);", "pred &= (-1)<<(8-VAR_0->VAR_7);", "*ptr = pred + (dc << VAR_2);", "}else{", "ptr16 = (uint16_t*)(VAR_0->picture.data[c] + 2*(linesize * (v * VAR_5 + y)) + 2*(h * VAR_4 + x));", "PREDICT(pred, ptr16[-linesize-1], ptr16[-linesize], ptr16[-1], VAR_1);", "pred &= (-1)<<(16-VAR_0->VAR_7);", "*ptr16= pred + (dc << VAR_2);", "}", "if (++x == h) {", "x = 0;", "y++;", "}", "}", "}", "}", "if (VAR_0->restart_interval && !--VAR_0->restart_count) {", "align_get_bits(&VAR_0->gb);", "skip_bits(&VAR_0->gb, 16);", "}", "}", "}", "return 0;", "}" ]
[ 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 73 ], [ 77 ], [ 79 ], [ 83 ], [ 85, 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 121, 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 161, 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 209 ], [ 213 ], [ 215 ], [ 219 ], [ 221, 223 ], [ 225 ], [ 227, 229, 231 ], [ 233 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 249 ], [ 251 ], [ 253 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ] ]
11,165
static void map_exec(void *addr, long size) { DWORD old_protect; VirtualProtect(addr, size, PAGE_EXECUTE_READWRITE, &old_protect); }
false
qemu
4438c8a9469d79fa2c58189418befb506da54d97
static void map_exec(void *addr, long size) { DWORD old_protect; VirtualProtect(addr, size, PAGE_EXECUTE_READWRITE, &old_protect); }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, long VAR_1) { DWORD old_protect; VirtualProtect(VAR_0, VAR_1, PAGE_EXECUTE_READWRITE, &old_protect); }
[ "static void FUNC_0(void *VAR_0, long VAR_1)\n{", "DWORD old_protect;", "VirtualProtect(VAR_0, VAR_1,\nPAGE_EXECUTE_READWRITE, &old_protect);", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 13 ] ]
11,166
static void gen_exception_insn(DisasContext *s, int offset, int excp, int syn, uint32_t target_el) { gen_set_condexec(s); gen_set_pc_im(s, s->pc - offset); gen_exception(excp, syn, target_el); s->is_jmp = DISAS_JUMP; }
false
qemu
8a6b28c7b5104263344508df0f4bce97f22cfcaf
static void gen_exception_insn(DisasContext *s, int offset, int excp, int syn, uint32_t target_el) { gen_set_condexec(s); gen_set_pc_im(s, s->pc - offset); gen_exception(excp, syn, target_el); s->is_jmp = DISAS_JUMP; }
{ "code": [], "line_no": [] }
static void FUNC_0(DisasContext *VAR_0, int VAR_1, int VAR_2, int VAR_3, uint32_t VAR_4) { gen_set_condexec(VAR_0); gen_set_pc_im(VAR_0, VAR_0->pc - VAR_1); gen_exception(VAR_2, VAR_3, VAR_4); VAR_0->is_jmp = DISAS_JUMP; }
[ "static void FUNC_0(DisasContext *VAR_0, int VAR_1, int VAR_2,\nint VAR_3, uint32_t VAR_4)\n{", "gen_set_condexec(VAR_0);", "gen_set_pc_im(VAR_0, VAR_0->pc - VAR_1);", "gen_exception(VAR_2, VAR_3, VAR_4);", "VAR_0->is_jmp = DISAS_JUMP;", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ] ]
11,168
static int omap2_validate_addr(struct omap_mpu_state_s *s, target_phys_addr_t addr) { return 1; }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static int omap2_validate_addr(struct omap_mpu_state_s *s, target_phys_addr_t addr) { return 1; }
{ "code": [], "line_no": [] }
static int FUNC_0(struct omap_mpu_state_s *VAR_0, target_phys_addr_t VAR_1) { return 1; }
[ "static int FUNC_0(struct omap_mpu_state_s *VAR_0,\ntarget_phys_addr_t VAR_1)\n{", "return 1;", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ] ]
11,169
static void htab_save_first_pass(QEMUFile *f, sPAPRMachineState *spapr, int64_t max_ns) { int htabslots = HTAB_SIZE(spapr) / HASH_PTE_SIZE_64; int index = spapr->htab_save_index; int64_t starttime = qemu_clock_get_ns(QEMU_CLOCK_REALTIME); assert(spapr->htab_first_pass); do { int chunkstart; /* Consume invalid HPTEs */ while ((index < htabslots) && !HPTE_VALID(HPTE(spapr->htab, index))) { index++; CLEAN_HPTE(HPTE(spapr->htab, index)); } /* Consume valid HPTEs */ chunkstart = index; while ((index < htabslots) && (index - chunkstart < USHRT_MAX) && HPTE_VALID(HPTE(spapr->htab, index))) { index++; CLEAN_HPTE(HPTE(spapr->htab, index)); } if (index > chunkstart) { int n_valid = index - chunkstart; qemu_put_be32(f, chunkstart); qemu_put_be16(f, n_valid); qemu_put_be16(f, 0); qemu_put_buffer(f, HPTE(spapr->htab, chunkstart), HASH_PTE_SIZE_64 * n_valid); if ((qemu_clock_get_ns(QEMU_CLOCK_REALTIME) - starttime) > max_ns) { break; } } } while ((index < htabslots) && !qemu_file_rate_limit(f)); if (index >= htabslots) { assert(index == htabslots); index = 0; spapr->htab_first_pass = false; } spapr->htab_save_index = index; }
false
qemu
378bc21756f016abfde16a0de4977be49f499b1c
static void htab_save_first_pass(QEMUFile *f, sPAPRMachineState *spapr, int64_t max_ns) { int htabslots = HTAB_SIZE(spapr) / HASH_PTE_SIZE_64; int index = spapr->htab_save_index; int64_t starttime = qemu_clock_get_ns(QEMU_CLOCK_REALTIME); assert(spapr->htab_first_pass); do { int chunkstart; while ((index < htabslots) && !HPTE_VALID(HPTE(spapr->htab, index))) { index++; CLEAN_HPTE(HPTE(spapr->htab, index)); } chunkstart = index; while ((index < htabslots) && (index - chunkstart < USHRT_MAX) && HPTE_VALID(HPTE(spapr->htab, index))) { index++; CLEAN_HPTE(HPTE(spapr->htab, index)); } if (index > chunkstart) { int n_valid = index - chunkstart; qemu_put_be32(f, chunkstart); qemu_put_be16(f, n_valid); qemu_put_be16(f, 0); qemu_put_buffer(f, HPTE(spapr->htab, chunkstart), HASH_PTE_SIZE_64 * n_valid); if ((qemu_clock_get_ns(QEMU_CLOCK_REALTIME) - starttime) > max_ns) { break; } } } while ((index < htabslots) && !qemu_file_rate_limit(f)); if (index >= htabslots) { assert(index == htabslots); index = 0; spapr->htab_first_pass = false; } spapr->htab_save_index = index; }
{ "code": [], "line_no": [] }
static void FUNC_0(QEMUFile *VAR_0, sPAPRMachineState *VAR_1, int64_t VAR_2) { int VAR_3 = HTAB_SIZE(VAR_1) / HASH_PTE_SIZE_64; int VAR_4 = VAR_1->htab_save_index; int64_t starttime = qemu_clock_get_ns(QEMU_CLOCK_REALTIME); assert(VAR_1->htab_first_pass); do { int VAR_5; while ((VAR_4 < VAR_3) && !HPTE_VALID(HPTE(VAR_1->htab, VAR_4))) { VAR_4++; CLEAN_HPTE(HPTE(VAR_1->htab, VAR_4)); } VAR_5 = VAR_4; while ((VAR_4 < VAR_3) && (VAR_4 - VAR_5 < USHRT_MAX) && HPTE_VALID(HPTE(VAR_1->htab, VAR_4))) { VAR_4++; CLEAN_HPTE(HPTE(VAR_1->htab, VAR_4)); } if (VAR_4 > VAR_5) { int VAR_6 = VAR_4 - VAR_5; qemu_put_be32(VAR_0, VAR_5); qemu_put_be16(VAR_0, VAR_6); qemu_put_be16(VAR_0, 0); qemu_put_buffer(VAR_0, HPTE(VAR_1->htab, VAR_5), HASH_PTE_SIZE_64 * VAR_6); if ((qemu_clock_get_ns(QEMU_CLOCK_REALTIME) - starttime) > VAR_2) { break; } } } while ((VAR_4 < VAR_3) && !qemu_file_rate_limit(VAR_0)); if (VAR_4 >= VAR_3) { assert(VAR_4 == VAR_3); VAR_4 = 0; VAR_1->htab_first_pass = false; } VAR_1->htab_save_index = VAR_4; }
[ "static void FUNC_0(QEMUFile *VAR_0, sPAPRMachineState *VAR_1,\nint64_t VAR_2)\n{", "int VAR_3 = HTAB_SIZE(VAR_1) / HASH_PTE_SIZE_64;", "int VAR_4 = VAR_1->htab_save_index;", "int64_t starttime = qemu_clock_get_ns(QEMU_CLOCK_REALTIME);", "assert(VAR_1->htab_first_pass);", "do {", "int VAR_5;", "while ((VAR_4 < VAR_3)\n&& !HPTE_VALID(HPTE(VAR_1->htab, VAR_4))) {", "VAR_4++;", "CLEAN_HPTE(HPTE(VAR_1->htab, VAR_4));", "}", "VAR_5 = VAR_4;", "while ((VAR_4 < VAR_3) && (VAR_4 - VAR_5 < USHRT_MAX)\n&& HPTE_VALID(HPTE(VAR_1->htab, VAR_4))) {", "VAR_4++;", "CLEAN_HPTE(HPTE(VAR_1->htab, VAR_4));", "}", "if (VAR_4 > VAR_5) {", "int VAR_6 = VAR_4 - VAR_5;", "qemu_put_be32(VAR_0, VAR_5);", "qemu_put_be16(VAR_0, VAR_6);", "qemu_put_be16(VAR_0, 0);", "qemu_put_buffer(VAR_0, HPTE(VAR_1->htab, VAR_5),\nHASH_PTE_SIZE_64 * VAR_6);", "if ((qemu_clock_get_ns(QEMU_CLOCK_REALTIME) - starttime) > VAR_2) {", "break;", "}", "}", "} while ((VAR_4 < VAR_3) && !qemu_file_rate_limit(VAR_0));", "if (VAR_4 >= VAR_3) {", "assert(VAR_4 == VAR_3);", "VAR_4 = 0;", "VAR_1->htab_first_pass = false;", "}", "VAR_1->htab_save_index = 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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 19 ], [ 21 ], [ 27, 29 ], [ 31 ], [ 33 ], [ 35 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 65 ], [ 67, 69 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ] ]
11,170
void tcg_gen_brcondi_i64(TCGCond cond, TCGv_i64 arg1, int64_t arg2, int label) { if (cond == TCG_COND_ALWAYS) { tcg_gen_br(label); } else if (cond != TCG_COND_NEVER) { TCGv_i64 t0 = tcg_const_i64(arg2); tcg_gen_brcond_i64(cond, arg1, t0, label); tcg_temp_free_i64(t0); } }
false
qemu
42a268c241183877192c376d03bd9b6d527407c7
void tcg_gen_brcondi_i64(TCGCond cond, TCGv_i64 arg1, int64_t arg2, int label) { if (cond == TCG_COND_ALWAYS) { tcg_gen_br(label); } else if (cond != TCG_COND_NEVER) { TCGv_i64 t0 = tcg_const_i64(arg2); tcg_gen_brcond_i64(cond, arg1, t0, label); tcg_temp_free_i64(t0); } }
{ "code": [], "line_no": [] }
void FUNC_0(TCGCond VAR_0, TCGv_i64 VAR_1, int64_t VAR_2, int VAR_3) { if (VAR_0 == TCG_COND_ALWAYS) { tcg_gen_br(VAR_3); } else if (VAR_0 != TCG_COND_NEVER) { TCGv_i64 t0 = tcg_const_i64(VAR_2); tcg_gen_brcond_i64(VAR_0, VAR_1, t0, VAR_3); tcg_temp_free_i64(t0); } }
[ "void FUNC_0(TCGCond VAR_0, TCGv_i64 VAR_1, int64_t VAR_2, int VAR_3)\n{", "if (VAR_0 == TCG_COND_ALWAYS) {", "tcg_gen_br(VAR_3);", "} else if (VAR_0 != TCG_COND_NEVER) {", "TCGv_i64 t0 = tcg_const_i64(VAR_2);", "tcg_gen_brcond_i64(VAR_0, VAR_1, t0, VAR_3);", "tcg_temp_free_i64(t0);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ] ]
11,171
QObject *qlist_peek(QList *qlist) { QListEntry *entry; QObject *ret; if (qlist == NULL || QTAILQ_EMPTY(&qlist->head)) { return NULL; } entry = QTAILQ_FIRST(&qlist->head); ret = entry->value; return ret; }
false
qemu
9be385980d37e8f4fd33f605f5fb1c3d144170a8
QObject *qlist_peek(QList *qlist) { QListEntry *entry; QObject *ret; if (qlist == NULL || QTAILQ_EMPTY(&qlist->head)) { return NULL; } entry = QTAILQ_FIRST(&qlist->head); ret = entry->value; return ret; }
{ "code": [], "line_no": [] }
QObject *FUNC_0(QList *qlist) { QListEntry *entry; QObject *ret; if (qlist == NULL || QTAILQ_EMPTY(&qlist->head)) { return NULL; } entry = QTAILQ_FIRST(&qlist->head); ret = entry->value; return ret; }
[ "QObject *FUNC_0(QList *qlist)\n{", "QListEntry *entry;", "QObject *ret;", "if (qlist == NULL || QTAILQ_EMPTY(&qlist->head)) {", "return NULL;", "}", "entry = QTAILQ_FIRST(&qlist->head);", "ret = entry->value;", "return ret;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 23 ], [ 27 ], [ 29 ] ]
11,172
static int wav_read_header(AVFormatContext *s, AVFormatParameters *ap) { int64_t size, av_uninit(data_size); int64_t sample_count=0; int rf64; unsigned int tag; AVIOContext *pb = s->pb; AVStream *st; WAVContext *wav = s->priv_data; int ret, got_fmt = 0; int64_t next_tag_ofs, data_ofs = -1; /* check RIFF header */ tag = avio_rl32(pb); rf64 = tag == MKTAG('R', 'F', '6', '4'); if (!rf64 && tag != MKTAG('R', 'I', 'F', 'F')) return -1; avio_rl32(pb); /* file size */ tag = avio_rl32(pb); if (tag != MKTAG('W', 'A', 'V', 'E')) return -1; if (rf64) { if (avio_rl32(pb) != MKTAG('d', 's', '6', '4')) return -1; size = avio_rl32(pb); if (size < 16) return -1; avio_rl64(pb); /* RIFF size */ data_size = avio_rl64(pb); sample_count = avio_rl64(pb); if (data_size < 0 || sample_count < 0) { av_log(s, AV_LOG_ERROR, "negative data_size and/or sample_count in " "ds64: data_size = %"PRId64", sample_count = %"PRId64"\n", data_size, sample_count); return AVERROR_INVALIDDATA; } avio_skip(pb, size - 24); /* skip rest of ds64 chunk */ } for (;;) { size = next_tag(pb, &tag); next_tag_ofs = avio_tell(pb) + size; if (url_feof(pb)) break; switch (tag) { case MKTAG('f', 'm', 't', ' '): /* only parse the first 'fmt ' tag found */ if (!got_fmt && (ret = wav_parse_fmt_tag(s, size, &st) < 0)) { return ret; } else if (got_fmt) av_log(s, AV_LOG_WARNING, "found more than one 'fmt ' tag\n"); got_fmt = 1; break; case MKTAG('d', 'a', 't', 'a'): if (!got_fmt) { av_log(s, AV_LOG_ERROR, "found no 'fmt ' tag before the 'data' tag\n"); return AVERROR_INVALIDDATA; } if (rf64) { next_tag_ofs = wav->data_end = avio_tell(pb) + data_size; } else { data_size = size; next_tag_ofs = wav->data_end = size ? next_tag_ofs : INT64_MAX; } data_ofs = avio_tell(pb); /* don't look for footer metadata if we can't seek or if we don't * know where the data tag ends */ if (!pb->seekable || (!rf64 && !size)) goto break_loop; break; case MKTAG('f','a','c','t'): if(!sample_count) sample_count = avio_rl32(pb); break; case MKTAG('b','e','x','t'): if ((ret = wav_parse_bext_tag(s, size)) < 0) return ret; break; } /* seek to next tag unless we know that we'll run into EOF */ if ((avio_size(pb) > 0 && next_tag_ofs >= avio_size(pb)) || avio_seek(pb, next_tag_ofs, SEEK_SET) < 0) { break; } } break_loop: if (data_ofs < 0) { av_log(s, AV_LOG_ERROR, "no 'data' tag found\n"); return AVERROR_INVALIDDATA; } avio_seek(pb, data_ofs, SEEK_SET); if (!sample_count && st->codec->channels && av_get_bits_per_sample(st->codec->codec_id)) sample_count = (data_size<<3) / (st->codec->channels * (uint64_t)av_get_bits_per_sample(st->codec->codec_id)); if (sample_count) st->duration = sample_count; ff_metadata_conv_ctx(s, NULL, wav_metadata_conv); return 0; }
false
FFmpeg
c9614bb22c98c513c010e1e14b12349a8cc74d8c
static int wav_read_header(AVFormatContext *s, AVFormatParameters *ap) { int64_t size, av_uninit(data_size); int64_t sample_count=0; int rf64; unsigned int tag; AVIOContext *pb = s->pb; AVStream *st; WAVContext *wav = s->priv_data; int ret, got_fmt = 0; int64_t next_tag_ofs, data_ofs = -1; tag = avio_rl32(pb); rf64 = tag == MKTAG('R', 'F', '6', '4'); if (!rf64 && tag != MKTAG('R', 'I', 'F', 'F')) return -1; avio_rl32(pb); tag = avio_rl32(pb); if (tag != MKTAG('W', 'A', 'V', 'E')) return -1; if (rf64) { if (avio_rl32(pb) != MKTAG('d', 's', '6', '4')) return -1; size = avio_rl32(pb); if (size < 16) return -1; avio_rl64(pb); data_size = avio_rl64(pb); sample_count = avio_rl64(pb); if (data_size < 0 || sample_count < 0) { av_log(s, AV_LOG_ERROR, "negative data_size and/or sample_count in " "ds64: data_size = %"PRId64", sample_count = %"PRId64"\n", data_size, sample_count); return AVERROR_INVALIDDATA; } avio_skip(pb, size - 24); } for (;;) { size = next_tag(pb, &tag); next_tag_ofs = avio_tell(pb) + size; if (url_feof(pb)) break; switch (tag) { case MKTAG('f', 'm', 't', ' '): if (!got_fmt && (ret = wav_parse_fmt_tag(s, size, &st) < 0)) { return ret; } else if (got_fmt) av_log(s, AV_LOG_WARNING, "found more than one 'fmt ' tag\n"); got_fmt = 1; break; case MKTAG('d', 'a', 't', 'a'): if (!got_fmt) { av_log(s, AV_LOG_ERROR, "found no 'fmt ' tag before the 'data' tag\n"); return AVERROR_INVALIDDATA; } if (rf64) { next_tag_ofs = wav->data_end = avio_tell(pb) + data_size; } else { data_size = size; next_tag_ofs = wav->data_end = size ? next_tag_ofs : INT64_MAX; } data_ofs = avio_tell(pb); if (!pb->seekable || (!rf64 && !size)) goto break_loop; break; case MKTAG('f','a','c','t'): if(!sample_count) sample_count = avio_rl32(pb); break; case MKTAG('b','e','x','t'): if ((ret = wav_parse_bext_tag(s, size)) < 0) return ret; break; } if ((avio_size(pb) > 0 && next_tag_ofs >= avio_size(pb)) || avio_seek(pb, next_tag_ofs, SEEK_SET) < 0) { break; } } break_loop: if (data_ofs < 0) { av_log(s, AV_LOG_ERROR, "no 'data' tag found\n"); return AVERROR_INVALIDDATA; } avio_seek(pb, data_ofs, SEEK_SET); if (!sample_count && st->codec->channels && av_get_bits_per_sample(st->codec->codec_id)) sample_count = (data_size<<3) / (st->codec->channels * (uint64_t)av_get_bits_per_sample(st->codec->codec_id)); if (sample_count) st->duration = sample_count; ff_metadata_conv_ctx(s, NULL, wav_metadata_conv); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0, AVFormatParameters *VAR_1) { int64_t size, av_uninit(data_size); int64_t sample_count=0; int VAR_2; unsigned int VAR_3; AVIOContext *pb = VAR_0->pb; AVStream *st; WAVContext *wav = VAR_0->priv_data; int VAR_4, VAR_5 = 0; int64_t next_tag_ofs, data_ofs = -1; VAR_3 = avio_rl32(pb); VAR_2 = VAR_3 == MKTAG('R', 'F', '6', '4'); if (!VAR_2 && VAR_3 != MKTAG('R', 'I', 'F', 'F')) return -1; avio_rl32(pb); VAR_3 = avio_rl32(pb); if (VAR_3 != MKTAG('W', 'A', 'V', 'E')) return -1; if (VAR_2) { if (avio_rl32(pb) != MKTAG('d', 'VAR_0', '6', '4')) return -1; size = avio_rl32(pb); if (size < 16) return -1; avio_rl64(pb); data_size = avio_rl64(pb); sample_count = avio_rl64(pb); if (data_size < 0 || sample_count < 0) { av_log(VAR_0, AV_LOG_ERROR, "negative data_size and/or sample_count in " "ds64: data_size = %"PRId64", sample_count = %"PRId64"\n", data_size, sample_count); return AVERROR_INVALIDDATA; } avio_skip(pb, size - 24); } for (;;) { size = next_tag(pb, &VAR_3); next_tag_ofs = avio_tell(pb) + size; if (url_feof(pb)) break; switch (VAR_3) { case MKTAG('f', 'm', 't', ' '): if (!VAR_5 && (VAR_4 = wav_parse_fmt_tag(VAR_0, size, &st) < 0)) { return VAR_4; } else if (VAR_5) av_log(VAR_0, AV_LOG_WARNING, "found more than one 'fmt ' VAR_3\n"); VAR_5 = 1; break; case MKTAG('d', 'a', 't', 'a'): if (!VAR_5) { av_log(VAR_0, AV_LOG_ERROR, "found no 'fmt ' VAR_3 before the 'data' VAR_3\n"); return AVERROR_INVALIDDATA; } if (VAR_2) { next_tag_ofs = wav->data_end = avio_tell(pb) + data_size; } else { data_size = size; next_tag_ofs = wav->data_end = size ? next_tag_ofs : INT64_MAX; } data_ofs = avio_tell(pb); if (!pb->seekable || (!VAR_2 && !size)) goto break_loop; break; case MKTAG('f','a','c','t'): if(!sample_count) sample_count = avio_rl32(pb); break; case MKTAG('b','e','x','t'): if ((VAR_4 = wav_parse_bext_tag(VAR_0, size)) < 0) return VAR_4; break; } if ((avio_size(pb) > 0 && next_tag_ofs >= avio_size(pb)) || avio_seek(pb, next_tag_ofs, SEEK_SET) < 0) { break; } } break_loop: if (data_ofs < 0) { av_log(VAR_0, AV_LOG_ERROR, "no 'data' VAR_3 found\n"); return AVERROR_INVALIDDATA; } avio_seek(pb, data_ofs, SEEK_SET); if (!sample_count && st->codec->channels && av_get_bits_per_sample(st->codec->codec_id)) sample_count = (data_size<<3) / (st->codec->channels * (uint64_t)av_get_bits_per_sample(st->codec->codec_id)); if (sample_count) st->duration = sample_count; ff_metadata_conv_ctx(VAR_0, NULL, wav_metadata_conv); return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0,\nAVFormatParameters *VAR_1)\n{", "int64_t size, av_uninit(data_size);", "int64_t sample_count=0;", "int VAR_2;", "unsigned int VAR_3;", "AVIOContext *pb = VAR_0->pb;", "AVStream *st;", "WAVContext *wav = VAR_0->priv_data;", "int VAR_4, VAR_5 = 0;", "int64_t next_tag_ofs, data_ofs = -1;", "VAR_3 = avio_rl32(pb);", "VAR_2 = VAR_3 == MKTAG('R', 'F', '6', '4');", "if (!VAR_2 && VAR_3 != MKTAG('R', 'I', 'F', 'F'))\nreturn -1;", "avio_rl32(pb);", "VAR_3 = avio_rl32(pb);", "if (VAR_3 != MKTAG('W', 'A', 'V', 'E'))\nreturn -1;", "if (VAR_2) {", "if (avio_rl32(pb) != MKTAG('d', 'VAR_0', '6', '4'))\nreturn -1;", "size = avio_rl32(pb);", "if (size < 16)\nreturn -1;", "avio_rl64(pb);", "data_size = avio_rl64(pb);", "sample_count = avio_rl64(pb);", "if (data_size < 0 || sample_count < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"negative data_size and/or sample_count in \"\n\"ds64: data_size = %\"PRId64\", sample_count = %\"PRId64\"\\n\",\ndata_size, sample_count);", "return AVERROR_INVALIDDATA;", "}", "avio_skip(pb, size - 24);", "}", "for (;;) {", "size = next_tag(pb, &VAR_3);", "next_tag_ofs = avio_tell(pb) + size;", "if (url_feof(pb))\nbreak;", "switch (VAR_3) {", "case MKTAG('f', 'm', 't', ' '):\nif (!VAR_5 && (VAR_4 = wav_parse_fmt_tag(VAR_0, size, &st) < 0)) {", "return VAR_4;", "} else if (VAR_5)", "av_log(VAR_0, AV_LOG_WARNING, \"found more than one 'fmt ' VAR_3\\n\");", "VAR_5 = 1;", "break;", "case MKTAG('d', 'a', 't', 'a'):\nif (!VAR_5) {", "av_log(VAR_0, AV_LOG_ERROR, \"found no 'fmt ' VAR_3 before the 'data' VAR_3\\n\");", "return AVERROR_INVALIDDATA;", "}", "if (VAR_2) {", "next_tag_ofs = wav->data_end = avio_tell(pb) + data_size;", "} else {", "data_size = size;", "next_tag_ofs = wav->data_end = size ? next_tag_ofs : INT64_MAX;", "}", "data_ofs = avio_tell(pb);", "if (!pb->seekable || (!VAR_2 && !size))\ngoto break_loop;", "break;", "case MKTAG('f','a','c','t'):\nif(!sample_count)\nsample_count = avio_rl32(pb);", "break;", "case MKTAG('b','e','x','t'):\nif ((VAR_4 = wav_parse_bext_tag(VAR_0, size)) < 0)\nreturn VAR_4;", "break;", "}", "if ((avio_size(pb) > 0 && next_tag_ofs >= avio_size(pb)) ||\navio_seek(pb, next_tag_ofs, SEEK_SET) < 0) {", "break;", "}", "}", "break_loop:\nif (data_ofs < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"no 'data' VAR_3 found\\n\");", "return AVERROR_INVALIDDATA;", "}", "avio_seek(pb, data_ofs, SEEK_SET);", "if (!sample_count && st->codec->channels && av_get_bits_per_sample(st->codec->codec_id))\nsample_count = (data_size<<3) / (st->codec->channels * (uint64_t)av_get_bits_per_sample(st->codec->codec_id));", "if (sample_count)\nst->duration = sample_count;", "ff_metadata_conv_ctx(VAR_0, NULL, wav_metadata_conv);", "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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 29 ], [ 33 ], [ 35, 37 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 49 ], [ 51, 53 ], [ 55 ], [ 57, 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69, 71, 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 85 ], [ 87 ], [ 89 ], [ 93, 95 ], [ 99 ], [ 101, 105 ], [ 107 ], [ 109 ], [ 111 ], [ 115 ], [ 117 ], [ 119, 121 ], [ 123 ], [ 125 ], [ 127 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 145 ], [ 155, 157 ], [ 159 ], [ 161, 163, 165 ], [ 167 ], [ 169, 171, 173 ], [ 175 ], [ 177 ], [ 183, 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193, 195 ], [ 197 ], [ 199 ], [ 201 ], [ 205 ], [ 209, 211 ], [ 213, 215 ], [ 219 ], [ 223 ], [ 225 ] ]
11,173
static void init_native_list(UserDefNativeListUnion *cvalue) { int i; switch (cvalue->type) { case USER_DEF_NATIVE_LIST_UNION_KIND_INTEGER: { intList **list = &cvalue->u.integer.data; for (i = 0; i < 32; i++) { *list = g_new0(intList, 1); (*list)->value = i; (*list)->next = NULL; list = &(*list)->next; } break; } case USER_DEF_NATIVE_LIST_UNION_KIND_S8: { int8List **list = &cvalue->u.s8.data; for (i = 0; i < 32; i++) { *list = g_new0(int8List, 1); (*list)->value = i; (*list)->next = NULL; list = &(*list)->next; } break; } case USER_DEF_NATIVE_LIST_UNION_KIND_S16: { int16List **list = &cvalue->u.s16.data; for (i = 0; i < 32; i++) { *list = g_new0(int16List, 1); (*list)->value = i; (*list)->next = NULL; list = &(*list)->next; } break; } case USER_DEF_NATIVE_LIST_UNION_KIND_S32: { int32List **list = &cvalue->u.s32.data; for (i = 0; i < 32; i++) { *list = g_new0(int32List, 1); (*list)->value = i; (*list)->next = NULL; list = &(*list)->next; } break; } case USER_DEF_NATIVE_LIST_UNION_KIND_S64: { int64List **list = &cvalue->u.s64.data; for (i = 0; i < 32; i++) { *list = g_new0(int64List, 1); (*list)->value = i; (*list)->next = NULL; list = &(*list)->next; } break; } case USER_DEF_NATIVE_LIST_UNION_KIND_U8: { uint8List **list = &cvalue->u.u8.data; for (i = 0; i < 32; i++) { *list = g_new0(uint8List, 1); (*list)->value = i; (*list)->next = NULL; list = &(*list)->next; } break; } case USER_DEF_NATIVE_LIST_UNION_KIND_U16: { uint16List **list = &cvalue->u.u16.data; for (i = 0; i < 32; i++) { *list = g_new0(uint16List, 1); (*list)->value = i; (*list)->next = NULL; list = &(*list)->next; } break; } case USER_DEF_NATIVE_LIST_UNION_KIND_U32: { uint32List **list = &cvalue->u.u32.data; for (i = 0; i < 32; i++) { *list = g_new0(uint32List, 1); (*list)->value = i; (*list)->next = NULL; list = &(*list)->next; } break; } case USER_DEF_NATIVE_LIST_UNION_KIND_U64: { uint64List **list = &cvalue->u.u64.data; for (i = 0; i < 32; i++) { *list = g_new0(uint64List, 1); (*list)->value = i; (*list)->next = NULL; list = &(*list)->next; } break; } case USER_DEF_NATIVE_LIST_UNION_KIND_BOOLEAN: { boolList **list = &cvalue->u.boolean.data; for (i = 0; i < 32; i++) { *list = g_new0(boolList, 1); (*list)->value = (i % 3 == 0); (*list)->next = NULL; list = &(*list)->next; } break; } case USER_DEF_NATIVE_LIST_UNION_KIND_STRING: { strList **list = &cvalue->u.string.data; for (i = 0; i < 32; i++) { *list = g_new0(strList, 1); (*list)->value = g_strdup_printf("%d", i); (*list)->next = NULL; list = &(*list)->next; } break; } case USER_DEF_NATIVE_LIST_UNION_KIND_NUMBER: { numberList **list = &cvalue->u.number.data; for (i = 0; i < 32; i++) { *list = g_new0(numberList, 1); (*list)->value = (double)i / 3; (*list)->next = NULL; list = &(*list)->next; } break; } default: g_assert_not_reached(); } }
false
qemu
b3db211f3c80bb996a704d665fe275619f728bd4
static void init_native_list(UserDefNativeListUnion *cvalue) { int i; switch (cvalue->type) { case USER_DEF_NATIVE_LIST_UNION_KIND_INTEGER: { intList **list = &cvalue->u.integer.data; for (i = 0; i < 32; i++) { *list = g_new0(intList, 1); (*list)->value = i; (*list)->next = NULL; list = &(*list)->next; } break; } case USER_DEF_NATIVE_LIST_UNION_KIND_S8: { int8List **list = &cvalue->u.s8.data; for (i = 0; i < 32; i++) { *list = g_new0(int8List, 1); (*list)->value = i; (*list)->next = NULL; list = &(*list)->next; } break; } case USER_DEF_NATIVE_LIST_UNION_KIND_S16: { int16List **list = &cvalue->u.s16.data; for (i = 0; i < 32; i++) { *list = g_new0(int16List, 1); (*list)->value = i; (*list)->next = NULL; list = &(*list)->next; } break; } case USER_DEF_NATIVE_LIST_UNION_KIND_S32: { int32List **list = &cvalue->u.s32.data; for (i = 0; i < 32; i++) { *list = g_new0(int32List, 1); (*list)->value = i; (*list)->next = NULL; list = &(*list)->next; } break; } case USER_DEF_NATIVE_LIST_UNION_KIND_S64: { int64List **list = &cvalue->u.s64.data; for (i = 0; i < 32; i++) { *list = g_new0(int64List, 1); (*list)->value = i; (*list)->next = NULL; list = &(*list)->next; } break; } case USER_DEF_NATIVE_LIST_UNION_KIND_U8: { uint8List **list = &cvalue->u.u8.data; for (i = 0; i < 32; i++) { *list = g_new0(uint8List, 1); (*list)->value = i; (*list)->next = NULL; list = &(*list)->next; } break; } case USER_DEF_NATIVE_LIST_UNION_KIND_U16: { uint16List **list = &cvalue->u.u16.data; for (i = 0; i < 32; i++) { *list = g_new0(uint16List, 1); (*list)->value = i; (*list)->next = NULL; list = &(*list)->next; } break; } case USER_DEF_NATIVE_LIST_UNION_KIND_U32: { uint32List **list = &cvalue->u.u32.data; for (i = 0; i < 32; i++) { *list = g_new0(uint32List, 1); (*list)->value = i; (*list)->next = NULL; list = &(*list)->next; } break; } case USER_DEF_NATIVE_LIST_UNION_KIND_U64: { uint64List **list = &cvalue->u.u64.data; for (i = 0; i < 32; i++) { *list = g_new0(uint64List, 1); (*list)->value = i; (*list)->next = NULL; list = &(*list)->next; } break; } case USER_DEF_NATIVE_LIST_UNION_KIND_BOOLEAN: { boolList **list = &cvalue->u.boolean.data; for (i = 0; i < 32; i++) { *list = g_new0(boolList, 1); (*list)->value = (i % 3 == 0); (*list)->next = NULL; list = &(*list)->next; } break; } case USER_DEF_NATIVE_LIST_UNION_KIND_STRING: { strList **list = &cvalue->u.string.data; for (i = 0; i < 32; i++) { *list = g_new0(strList, 1); (*list)->value = g_strdup_printf("%d", i); (*list)->next = NULL; list = &(*list)->next; } break; } case USER_DEF_NATIVE_LIST_UNION_KIND_NUMBER: { numberList **list = &cvalue->u.number.data; for (i = 0; i < 32; i++) { *list = g_new0(numberList, 1); (*list)->value = (double)i / 3; (*list)->next = NULL; list = &(*list)->next; } break; } default: g_assert_not_reached(); } }
{ "code": [], "line_no": [] }
static void FUNC_0(UserDefNativeListUnion *VAR_0) { int VAR_1; switch (VAR_0->type) { case USER_DEF_NATIVE_LIST_UNION_KIND_INTEGER: { intList **list = &VAR_0->u.integer.data; for (VAR_1 = 0; VAR_1 < 32; VAR_1++) { *list = g_new0(intList, 1); (*list)->value = VAR_1; (*list)->next = NULL; list = &(*list)->next; } break; } case USER_DEF_NATIVE_LIST_UNION_KIND_S8: { int8List **list = &VAR_0->u.s8.data; for (VAR_1 = 0; VAR_1 < 32; VAR_1++) { *list = g_new0(int8List, 1); (*list)->value = VAR_1; (*list)->next = NULL; list = &(*list)->next; } break; } case USER_DEF_NATIVE_LIST_UNION_KIND_S16: { int16List **list = &VAR_0->u.s16.data; for (VAR_1 = 0; VAR_1 < 32; VAR_1++) { *list = g_new0(int16List, 1); (*list)->value = VAR_1; (*list)->next = NULL; list = &(*list)->next; } break; } case USER_DEF_NATIVE_LIST_UNION_KIND_S32: { int32List **list = &VAR_0->u.s32.data; for (VAR_1 = 0; VAR_1 < 32; VAR_1++) { *list = g_new0(int32List, 1); (*list)->value = VAR_1; (*list)->next = NULL; list = &(*list)->next; } break; } case USER_DEF_NATIVE_LIST_UNION_KIND_S64: { int64List **list = &VAR_0->u.s64.data; for (VAR_1 = 0; VAR_1 < 32; VAR_1++) { *list = g_new0(int64List, 1); (*list)->value = VAR_1; (*list)->next = NULL; list = &(*list)->next; } break; } case USER_DEF_NATIVE_LIST_UNION_KIND_U8: { uint8List **list = &VAR_0->u.u8.data; for (VAR_1 = 0; VAR_1 < 32; VAR_1++) { *list = g_new0(uint8List, 1); (*list)->value = VAR_1; (*list)->next = NULL; list = &(*list)->next; } break; } case USER_DEF_NATIVE_LIST_UNION_KIND_U16: { uint16List **list = &VAR_0->u.u16.data; for (VAR_1 = 0; VAR_1 < 32; VAR_1++) { *list = g_new0(uint16List, 1); (*list)->value = VAR_1; (*list)->next = NULL; list = &(*list)->next; } break; } case USER_DEF_NATIVE_LIST_UNION_KIND_U32: { uint32List **list = &VAR_0->u.u32.data; for (VAR_1 = 0; VAR_1 < 32; VAR_1++) { *list = g_new0(uint32List, 1); (*list)->value = VAR_1; (*list)->next = NULL; list = &(*list)->next; } break; } case USER_DEF_NATIVE_LIST_UNION_KIND_U64: { uint64List **list = &VAR_0->u.u64.data; for (VAR_1 = 0; VAR_1 < 32; VAR_1++) { *list = g_new0(uint64List, 1); (*list)->value = VAR_1; (*list)->next = NULL; list = &(*list)->next; } break; } case USER_DEF_NATIVE_LIST_UNION_KIND_BOOLEAN: { boolList **list = &VAR_0->u.boolean.data; for (VAR_1 = 0; VAR_1 < 32; VAR_1++) { *list = g_new0(boolList, 1); (*list)->value = (VAR_1 % 3 == 0); (*list)->next = NULL; list = &(*list)->next; } break; } case USER_DEF_NATIVE_LIST_UNION_KIND_STRING: { strList **list = &VAR_0->u.string.data; for (VAR_1 = 0; VAR_1 < 32; VAR_1++) { *list = g_new0(strList, 1); (*list)->value = g_strdup_printf("%d", VAR_1); (*list)->next = NULL; list = &(*list)->next; } break; } case USER_DEF_NATIVE_LIST_UNION_KIND_NUMBER: { numberList **list = &VAR_0->u.number.data; for (VAR_1 = 0; VAR_1 < 32; VAR_1++) { *list = g_new0(numberList, 1); (*list)->value = (double)VAR_1 / 3; (*list)->next = NULL; list = &(*list)->next; } break; } default: g_assert_not_reached(); } }
[ "static void FUNC_0(UserDefNativeListUnion *VAR_0)\n{", "int VAR_1;", "switch (VAR_0->type) {", "case USER_DEF_NATIVE_LIST_UNION_KIND_INTEGER: {", "intList **list = &VAR_0->u.integer.data;", "for (VAR_1 = 0; VAR_1 < 32; VAR_1++) {", "*list = g_new0(intList, 1);", "(*list)->value = VAR_1;", "(*list)->next = NULL;", "list = &(*list)->next;", "}", "break;", "}", "case USER_DEF_NATIVE_LIST_UNION_KIND_S8: {", "int8List **list = &VAR_0->u.s8.data;", "for (VAR_1 = 0; VAR_1 < 32; VAR_1++) {", "*list = g_new0(int8List, 1);", "(*list)->value = VAR_1;", "(*list)->next = NULL;", "list = &(*list)->next;", "}", "break;", "}", "case USER_DEF_NATIVE_LIST_UNION_KIND_S16: {", "int16List **list = &VAR_0->u.s16.data;", "for (VAR_1 = 0; VAR_1 < 32; VAR_1++) {", "*list = g_new0(int16List, 1);", "(*list)->value = VAR_1;", "(*list)->next = NULL;", "list = &(*list)->next;", "}", "break;", "}", "case USER_DEF_NATIVE_LIST_UNION_KIND_S32: {", "int32List **list = &VAR_0->u.s32.data;", "for (VAR_1 = 0; VAR_1 < 32; VAR_1++) {", "*list = g_new0(int32List, 1);", "(*list)->value = VAR_1;", "(*list)->next = NULL;", "list = &(*list)->next;", "}", "break;", "}", "case USER_DEF_NATIVE_LIST_UNION_KIND_S64: {", "int64List **list = &VAR_0->u.s64.data;", "for (VAR_1 = 0; VAR_1 < 32; VAR_1++) {", "*list = g_new0(int64List, 1);", "(*list)->value = VAR_1;", "(*list)->next = NULL;", "list = &(*list)->next;", "}", "break;", "}", "case USER_DEF_NATIVE_LIST_UNION_KIND_U8: {", "uint8List **list = &VAR_0->u.u8.data;", "for (VAR_1 = 0; VAR_1 < 32; VAR_1++) {", "*list = g_new0(uint8List, 1);", "(*list)->value = VAR_1;", "(*list)->next = NULL;", "list = &(*list)->next;", "}", "break;", "}", "case USER_DEF_NATIVE_LIST_UNION_KIND_U16: {", "uint16List **list = &VAR_0->u.u16.data;", "for (VAR_1 = 0; VAR_1 < 32; VAR_1++) {", "*list = g_new0(uint16List, 1);", "(*list)->value = VAR_1;", "(*list)->next = NULL;", "list = &(*list)->next;", "}", "break;", "}", "case USER_DEF_NATIVE_LIST_UNION_KIND_U32: {", "uint32List **list = &VAR_0->u.u32.data;", "for (VAR_1 = 0; VAR_1 < 32; VAR_1++) {", "*list = g_new0(uint32List, 1);", "(*list)->value = VAR_1;", "(*list)->next = NULL;", "list = &(*list)->next;", "}", "break;", "}", "case USER_DEF_NATIVE_LIST_UNION_KIND_U64: {", "uint64List **list = &VAR_0->u.u64.data;", "for (VAR_1 = 0; VAR_1 < 32; VAR_1++) {", "*list = g_new0(uint64List, 1);", "(*list)->value = VAR_1;", "(*list)->next = NULL;", "list = &(*list)->next;", "}", "break;", "}", "case USER_DEF_NATIVE_LIST_UNION_KIND_BOOLEAN: {", "boolList **list = &VAR_0->u.boolean.data;", "for (VAR_1 = 0; VAR_1 < 32; VAR_1++) {", "*list = g_new0(boolList, 1);", "(*list)->value = (VAR_1 % 3 == 0);", "(*list)->next = NULL;", "list = &(*list)->next;", "}", "break;", "}", "case USER_DEF_NATIVE_LIST_UNION_KIND_STRING: {", "strList **list = &VAR_0->u.string.data;", "for (VAR_1 = 0; VAR_1 < 32; VAR_1++) {", "*list = g_new0(strList, 1);", "(*list)->value = g_strdup_printf(\"%d\", VAR_1);", "(*list)->next = NULL;", "list = &(*list)->next;", "}", "break;", "}", "case USER_DEF_NATIVE_LIST_UNION_KIND_NUMBER: {", "numberList **list = &VAR_0->u.number.data;", "for (VAR_1 = 0; VAR_1 < 32; VAR_1++) {", "*list = g_new0(numberList, 1);", "(*list)->value = (double)VAR_1 / 3;", "(*list)->next = NULL;", "list = &(*list)->next;", "}", "break;", "}", "default:\ng_assert_not_reached();", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249, 251 ], [ 253 ], [ 255 ] ]
11,174
static void internal_snapshot_prepare(BlkTransactionState *common, Error **errp) { Error *local_err = NULL; const char *device; const char *name; BlockBackend *blk; BlockDriverState *bs; QEMUSnapshotInfo old_sn, *sn; bool ret; qemu_timeval tv; BlockdevSnapshotInternal *internal; InternalSnapshotState *state; int ret1; g_assert(common->action->kind == TRANSACTION_ACTION_KIND_BLOCKDEV_SNAPSHOT_INTERNAL_SYNC); internal = common->action->blockdev_snapshot_internal_sync; state = DO_UPCAST(InternalSnapshotState, common, common); /* 1. parse input */ device = internal->device; name = internal->name; /* 2. check for validation */ blk = blk_by_name(device); if (!blk) { error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, "Device '%s' not found", device); return; } /* AioContext is released in .clean() */ state->aio_context = blk_get_aio_context(blk); aio_context_acquire(state->aio_context); if (!blk_is_available(blk)) { error_setg(errp, QERR_DEVICE_HAS_NO_MEDIUM, device); return; } bs = blk_bs(blk); state->bs = bs; bdrv_drained_begin(bs); if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_INTERNAL_SNAPSHOT, errp)) { return; } if (bdrv_is_read_only(bs)) { error_setg(errp, "Device '%s' is read only", device); return; } if (!bdrv_can_snapshot(bs)) { error_setg(errp, "Block format '%s' used by device '%s' " "does not support internal snapshots", bs->drv->format_name, device); return; } if (!strlen(name)) { error_setg(errp, "Name is empty"); return; } /* check whether a snapshot with name exist */ ret = bdrv_snapshot_find_by_id_and_name(bs, NULL, name, &old_sn, &local_err); if (local_err) { error_propagate(errp, local_err); return; } else if (ret) { error_setg(errp, "Snapshot with name '%s' already exists on device '%s'", name, device); return; } /* 3. take the snapshot */ sn = &state->sn; pstrcpy(sn->name, sizeof(sn->name), name); qemu_gettimeofday(&tv); sn->date_sec = tv.tv_sec; sn->date_nsec = tv.tv_usec * 1000; sn->vm_clock_nsec = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); ret1 = bdrv_snapshot_create(bs, sn); if (ret1 < 0) { error_setg_errno(errp, -ret1, "Failed to create snapshot '%s' on device '%s'", name, device); return; } /* 4. succeed, mark a snapshot is created */ state->created = true; }
false
qemu
6a8f9661dc3c088ed0d2f5b41d940190407cbdc5
static void internal_snapshot_prepare(BlkTransactionState *common, Error **errp) { Error *local_err = NULL; const char *device; const char *name; BlockBackend *blk; BlockDriverState *bs; QEMUSnapshotInfo old_sn, *sn; bool ret; qemu_timeval tv; BlockdevSnapshotInternal *internal; InternalSnapshotState *state; int ret1; g_assert(common->action->kind == TRANSACTION_ACTION_KIND_BLOCKDEV_SNAPSHOT_INTERNAL_SYNC); internal = common->action->blockdev_snapshot_internal_sync; state = DO_UPCAST(InternalSnapshotState, common, common); device = internal->device; name = internal->name; blk = blk_by_name(device); if (!blk) { error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, "Device '%s' not found", device); return; } state->aio_context = blk_get_aio_context(blk); aio_context_acquire(state->aio_context); if (!blk_is_available(blk)) { error_setg(errp, QERR_DEVICE_HAS_NO_MEDIUM, device); return; } bs = blk_bs(blk); state->bs = bs; bdrv_drained_begin(bs); if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_INTERNAL_SNAPSHOT, errp)) { return; } if (bdrv_is_read_only(bs)) { error_setg(errp, "Device '%s' is read only", device); return; } if (!bdrv_can_snapshot(bs)) { error_setg(errp, "Block format '%s' used by device '%s' " "does not support internal snapshots", bs->drv->format_name, device); return; } if (!strlen(name)) { error_setg(errp, "Name is empty"); return; } ret = bdrv_snapshot_find_by_id_and_name(bs, NULL, name, &old_sn, &local_err); if (local_err) { error_propagate(errp, local_err); return; } else if (ret) { error_setg(errp, "Snapshot with name '%s' already exists on device '%s'", name, device); return; } sn = &state->sn; pstrcpy(sn->name, sizeof(sn->name), name); qemu_gettimeofday(&tv); sn->date_sec = tv.tv_sec; sn->date_nsec = tv.tv_usec * 1000; sn->vm_clock_nsec = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); ret1 = bdrv_snapshot_create(bs, sn); if (ret1 < 0) { error_setg_errno(errp, -ret1, "Failed to create snapshot '%s' on device '%s'", name, device); return; } state->created = true; }
{ "code": [], "line_no": [] }
static void FUNC_0(BlkTransactionState *VAR_0, Error **VAR_1) { Error *local_err = NULL; const char *VAR_2; const char *VAR_3; BlockBackend *blk; BlockDriverState *bs; QEMUSnapshotInfo old_sn, *sn; bool ret; qemu_timeval tv; BlockdevSnapshotInternal *internal; InternalSnapshotState *state; int VAR_4; g_assert(VAR_0->action->kind == TRANSACTION_ACTION_KIND_BLOCKDEV_SNAPSHOT_INTERNAL_SYNC); internal = VAR_0->action->blockdev_snapshot_internal_sync; state = DO_UPCAST(InternalSnapshotState, VAR_0, VAR_0); VAR_2 = internal->VAR_2; VAR_3 = internal->VAR_3; blk = blk_by_name(VAR_2); if (!blk) { error_set(VAR_1, ERROR_CLASS_DEVICE_NOT_FOUND, "Device '%s' not found", VAR_2); return; } state->aio_context = blk_get_aio_context(blk); aio_context_acquire(state->aio_context); if (!blk_is_available(blk)) { error_setg(VAR_1, QERR_DEVICE_HAS_NO_MEDIUM, VAR_2); return; } bs = blk_bs(blk); state->bs = bs; bdrv_drained_begin(bs); if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_INTERNAL_SNAPSHOT, VAR_1)) { return; } if (bdrv_is_read_only(bs)) { error_setg(VAR_1, "Device '%s' is read only", VAR_2); return; } if (!bdrv_can_snapshot(bs)) { error_setg(VAR_1, "Block format '%s' used by VAR_2 '%s' " "does not support internal snapshots", bs->drv->format_name, VAR_2); return; } if (!strlen(VAR_3)) { error_setg(VAR_1, "Name is empty"); return; } ret = bdrv_snapshot_find_by_id_and_name(bs, NULL, VAR_3, &old_sn, &local_err); if (local_err) { error_propagate(VAR_1, local_err); return; } else if (ret) { error_setg(VAR_1, "Snapshot with VAR_3 '%s' already exists on VAR_2 '%s'", VAR_3, VAR_2); return; } sn = &state->sn; pstrcpy(sn->VAR_3, sizeof(sn->VAR_3), VAR_3); qemu_gettimeofday(&tv); sn->date_sec = tv.tv_sec; sn->date_nsec = tv.tv_usec * 1000; sn->vm_clock_nsec = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); VAR_4 = bdrv_snapshot_create(bs, sn); if (VAR_4 < 0) { error_setg_errno(VAR_1, -VAR_4, "Failed to create snapshot '%s' on VAR_2 '%s'", VAR_3, VAR_2); return; } state->created = true; }
[ "static void FUNC_0(BlkTransactionState *VAR_0,\nError **VAR_1)\n{", "Error *local_err = NULL;", "const char *VAR_2;", "const char *VAR_3;", "BlockBackend *blk;", "BlockDriverState *bs;", "QEMUSnapshotInfo old_sn, *sn;", "bool ret;", "qemu_timeval tv;", "BlockdevSnapshotInternal *internal;", "InternalSnapshotState *state;", "int VAR_4;", "g_assert(VAR_0->action->kind ==\nTRANSACTION_ACTION_KIND_BLOCKDEV_SNAPSHOT_INTERNAL_SYNC);", "internal = VAR_0->action->blockdev_snapshot_internal_sync;", "state = DO_UPCAST(InternalSnapshotState, VAR_0, VAR_0);", "VAR_2 = internal->VAR_2;", "VAR_3 = internal->VAR_3;", "blk = blk_by_name(VAR_2);", "if (!blk) {", "error_set(VAR_1, ERROR_CLASS_DEVICE_NOT_FOUND,\n\"Device '%s' not found\", VAR_2);", "return;", "}", "state->aio_context = blk_get_aio_context(blk);", "aio_context_acquire(state->aio_context);", "if (!blk_is_available(blk)) {", "error_setg(VAR_1, QERR_DEVICE_HAS_NO_MEDIUM, VAR_2);", "return;", "}", "bs = blk_bs(blk);", "state->bs = bs;", "bdrv_drained_begin(bs);", "if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_INTERNAL_SNAPSHOT, VAR_1)) {", "return;", "}", "if (bdrv_is_read_only(bs)) {", "error_setg(VAR_1, \"Device '%s' is read only\", VAR_2);", "return;", "}", "if (!bdrv_can_snapshot(bs)) {", "error_setg(VAR_1, \"Block format '%s' used by VAR_2 '%s' \"\n\"does not support internal snapshots\",\nbs->drv->format_name, VAR_2);", "return;", "}", "if (!strlen(VAR_3)) {", "error_setg(VAR_1, \"Name is empty\");", "return;", "}", "ret = bdrv_snapshot_find_by_id_and_name(bs, NULL, VAR_3, &old_sn,\n&local_err);", "if (local_err) {", "error_propagate(VAR_1, local_err);", "return;", "} else if (ret) {", "error_setg(VAR_1,\n\"Snapshot with VAR_3 '%s' already exists on VAR_2 '%s'\",\nVAR_3, VAR_2);", "return;", "}", "sn = &state->sn;", "pstrcpy(sn->VAR_3, sizeof(sn->VAR_3), VAR_3);", "qemu_gettimeofday(&tv);", "sn->date_sec = tv.tv_sec;", "sn->date_nsec = tv.tv_usec * 1000;", "sn->vm_clock_nsec = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);", "VAR_4 = bdrv_snapshot_create(bs, sn);", "if (VAR_4 < 0) {", "error_setg_errno(VAR_1, -VAR_4,\n\"Failed to create snapshot '%s' on VAR_2 '%s'\",\nVAR_3, VAR_2);", "return;", "}", "state->created = true;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 43 ], [ 45 ], [ 51 ], [ 53 ], [ 55, 57 ], [ 59 ], [ 61 ], [ 67 ], [ 69 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 85 ], [ 87 ], [ 91 ], [ 93 ], [ 95 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 109 ], [ 111, 113, 115 ], [ 117 ], [ 119 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 135, 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147, 149, 151 ], [ 153 ], [ 155 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 175 ], [ 177 ], [ 179, 181, 183 ], [ 185 ], [ 187 ], [ 193 ], [ 195 ] ]
11,175
void thread_pool_free(ThreadPool *pool) { if (!pool) { return; } assert(QLIST_EMPTY(&pool->head)); qemu_mutex_lock(&pool->lock); /* Stop new threads from spawning */ qemu_bh_delete(pool->new_thread_bh); pool->cur_threads -= pool->new_threads; pool->new_threads = 0; /* Wait for worker threads to terminate */ pool->stopping = true; while (pool->cur_threads > 0) { qemu_sem_post(&pool->sem); qemu_cond_wait(&pool->worker_stopped, &pool->lock); } qemu_mutex_unlock(&pool->lock); qemu_bh_delete(pool->completion_bh); qemu_sem_destroy(&pool->sem); qemu_cond_destroy(&pool->worker_stopped); qemu_mutex_destroy(&pool->lock); g_free(pool); }
false
qemu
c2b38b277a7882a592f4f2ec955084b2b756daaa
void thread_pool_free(ThreadPool *pool) { if (!pool) { return; } assert(QLIST_EMPTY(&pool->head)); qemu_mutex_lock(&pool->lock); qemu_bh_delete(pool->new_thread_bh); pool->cur_threads -= pool->new_threads; pool->new_threads = 0; pool->stopping = true; while (pool->cur_threads > 0) { qemu_sem_post(&pool->sem); qemu_cond_wait(&pool->worker_stopped, &pool->lock); } qemu_mutex_unlock(&pool->lock); qemu_bh_delete(pool->completion_bh); qemu_sem_destroy(&pool->sem); qemu_cond_destroy(&pool->worker_stopped); qemu_mutex_destroy(&pool->lock); g_free(pool); }
{ "code": [], "line_no": [] }
void FUNC_0(ThreadPool *VAR_0) { if (!VAR_0) { return; } assert(QLIST_EMPTY(&VAR_0->head)); qemu_mutex_lock(&VAR_0->lock); qemu_bh_delete(VAR_0->new_thread_bh); VAR_0->cur_threads -= VAR_0->new_threads; VAR_0->new_threads = 0; VAR_0->stopping = true; while (VAR_0->cur_threads > 0) { qemu_sem_post(&VAR_0->sem); qemu_cond_wait(&VAR_0->worker_stopped, &VAR_0->lock); } qemu_mutex_unlock(&VAR_0->lock); qemu_bh_delete(VAR_0->completion_bh); qemu_sem_destroy(&VAR_0->sem); qemu_cond_destroy(&VAR_0->worker_stopped); qemu_mutex_destroy(&VAR_0->lock); g_free(VAR_0); }
[ "void FUNC_0(ThreadPool *VAR_0)\n{", "if (!VAR_0) {", "return;", "}", "assert(QLIST_EMPTY(&VAR_0->head));", "qemu_mutex_lock(&VAR_0->lock);", "qemu_bh_delete(VAR_0->new_thread_bh);", "VAR_0->cur_threads -= VAR_0->new_threads;", "VAR_0->new_threads = 0;", "VAR_0->stopping = true;", "while (VAR_0->cur_threads > 0) {", "qemu_sem_post(&VAR_0->sem);", "qemu_cond_wait(&VAR_0->worker_stopped, &VAR_0->lock);", "}", "qemu_mutex_unlock(&VAR_0->lock);", "qemu_bh_delete(VAR_0->completion_bh);", "qemu_sem_destroy(&VAR_0->sem);", "qemu_cond_destroy(&VAR_0->worker_stopped);", "qemu_mutex_destroy(&VAR_0->lock);", "g_free(VAR_0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17 ], [ 23 ], [ 25 ], [ 27 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ] ]
11,176
static int find_real_tpr_addr(VAPICROMState *s, CPUX86State *env) { target_phys_addr_t paddr; target_ulong addr; if (s->state == VAPIC_ACTIVE) { return 0; } /* * If there is no prior TPR access instruction we could analyze (which is * the case after resume from hibernation), we need to scan the possible * virtual address space for the APIC mapping. */ for (addr = 0xfffff000; addr >= 0x80000000; addr -= TARGET_PAGE_SIZE) { paddr = cpu_get_phys_page_debug(env, addr); if (paddr != APIC_DEFAULT_ADDRESS) { continue; } s->real_tpr_addr = addr + 0x80; update_guest_rom_state(s); return 0; } return -1; }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static int find_real_tpr_addr(VAPICROMState *s, CPUX86State *env) { target_phys_addr_t paddr; target_ulong addr; if (s->state == VAPIC_ACTIVE) { return 0; } for (addr = 0xfffff000; addr >= 0x80000000; addr -= TARGET_PAGE_SIZE) { paddr = cpu_get_phys_page_debug(env, addr); if (paddr != APIC_DEFAULT_ADDRESS) { continue; } s->real_tpr_addr = addr + 0x80; update_guest_rom_state(s); return 0; } return -1; }
{ "code": [], "line_no": [] }
static int FUNC_0(VAPICROMState *VAR_0, CPUX86State *VAR_1) { target_phys_addr_t paddr; target_ulong addr; if (VAR_0->state == VAPIC_ACTIVE) { return 0; } for (addr = 0xfffff000; addr >= 0x80000000; addr -= TARGET_PAGE_SIZE) { paddr = cpu_get_phys_page_debug(VAR_1, addr); if (paddr != APIC_DEFAULT_ADDRESS) { continue; } VAR_0->real_tpr_addr = addr + 0x80; update_guest_rom_state(VAR_0); return 0; } return -1; }
[ "static int FUNC_0(VAPICROMState *VAR_0, CPUX86State *VAR_1)\n{", "target_phys_addr_t paddr;", "target_ulong addr;", "if (VAR_0->state == VAPIC_ACTIVE) {", "return 0;", "}", "for (addr = 0xfffff000; addr >= 0x80000000; addr -= TARGET_PAGE_SIZE) {", "paddr = cpu_get_phys_page_debug(VAR_1, addr);", "if (paddr != APIC_DEFAULT_ADDRESS) {", "continue;", "}", "VAR_0->real_tpr_addr = addr + 0x80;", "update_guest_rom_state(VAR_0);", "return 0;", "}", "return -1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ] ]
11,177
void memory_region_ram_resize(MemoryRegion *mr, ram_addr_t newsize, Error **errp) { assert(mr->terminates); qemu_ram_resize(mr->ram_addr, newsize, errp); }
false
qemu
ec05ec26f940564b1e07bf88857035ec27e21dd8
void memory_region_ram_resize(MemoryRegion *mr, ram_addr_t newsize, Error **errp) { assert(mr->terminates); qemu_ram_resize(mr->ram_addr, newsize, errp); }
{ "code": [], "line_no": [] }
void FUNC_0(MemoryRegion *VAR_0, ram_addr_t VAR_1, Error **VAR_2) { assert(VAR_0->terminates); qemu_ram_resize(VAR_0->ram_addr, VAR_1, VAR_2); }
[ "void FUNC_0(MemoryRegion *VAR_0, ram_addr_t VAR_1, Error **VAR_2)\n{", "assert(VAR_0->terminates);", "qemu_ram_resize(VAR_0->ram_addr, VAR_1, VAR_2);", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ] ]
11,178
void replay_read_events(int checkpoint) { while (replay_data_kind == EVENT_ASYNC) { Event *event = replay_read_event(checkpoint); if (!event) { break; } replay_mutex_unlock(); replay_run_event(event); replay_mutex_lock(); g_free(event); replay_finish_event(); read_event_kind = -1; } }
false
qemu
f186d64d8fda4bb22c15beb8e45b7814fbd8b51e
void replay_read_events(int checkpoint) { while (replay_data_kind == EVENT_ASYNC) { Event *event = replay_read_event(checkpoint); if (!event) { break; } replay_mutex_unlock(); replay_run_event(event); replay_mutex_lock(); g_free(event); replay_finish_event(); read_event_kind = -1; } }
{ "code": [], "line_no": [] }
void FUNC_0(int VAR_0) { while (replay_data_kind == EVENT_ASYNC) { Event *event = replay_read_event(VAR_0); if (!event) { break; } replay_mutex_unlock(); replay_run_event(event); replay_mutex_lock(); g_free(event); replay_finish_event(); read_event_kind = -1; } }
[ "void FUNC_0(int VAR_0)\n{", "while (replay_data_kind == EVENT_ASYNC) {", "Event *event = replay_read_event(VAR_0);", "if (!event) {", "break;", "}", "replay_mutex_unlock();", "replay_run_event(event);", "replay_mutex_lock();", "g_free(event);", "replay_finish_event();", "read_event_kind = -1;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ] ]
11,179
void qmp_block_resize(bool has_device, const char *device, bool has_node_name, const char *node_name, int64_t size, Error **errp) { Error *local_err = NULL; BlockDriverState *bs; AioContext *aio_context; int ret; bs = bdrv_lookup_bs(has_device ? device : NULL, has_node_name ? node_name : NULL, &local_err); if (local_err) { error_propagate(errp, local_err); return; } aio_context = bdrv_get_aio_context(bs); aio_context_acquire(aio_context); if (!bdrv_is_first_non_filter(bs)) { error_setg(errp, QERR_FEATURE_DISABLED, "resize"); goto out; } if (size < 0) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "size", "a >0 size"); goto out; } if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_RESIZE, NULL)) { error_setg(errp, QERR_DEVICE_IN_USE, device); goto out; } /* complete all in-flight operations before resizing the device */ bdrv_drain_all(); ret = bdrv_truncate(bs, size); switch (ret) { case 0: break; case -ENOMEDIUM: error_setg(errp, QERR_DEVICE_HAS_NO_MEDIUM, device); break; case -ENOTSUP: error_setg(errp, QERR_UNSUPPORTED); break; case -EACCES: error_setg(errp, "Device '%s' is read only", device); break; case -EBUSY: error_setg(errp, QERR_DEVICE_IN_USE, device); break; default: error_setg_errno(errp, -ret, "Could not resize"); break; } out: aio_context_release(aio_context); }
false
qemu
7dad9ee6467e0e3024fbe09f8a363148558b8eef
void qmp_block_resize(bool has_device, const char *device, bool has_node_name, const char *node_name, int64_t size, Error **errp) { Error *local_err = NULL; BlockDriverState *bs; AioContext *aio_context; int ret; bs = bdrv_lookup_bs(has_device ? device : NULL, has_node_name ? node_name : NULL, &local_err); if (local_err) { error_propagate(errp, local_err); return; } aio_context = bdrv_get_aio_context(bs); aio_context_acquire(aio_context); if (!bdrv_is_first_non_filter(bs)) { error_setg(errp, QERR_FEATURE_DISABLED, "resize"); goto out; } if (size < 0) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "size", "a >0 size"); goto out; } if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_RESIZE, NULL)) { error_setg(errp, QERR_DEVICE_IN_USE, device); goto out; } bdrv_drain_all(); ret = bdrv_truncate(bs, size); switch (ret) { case 0: break; case -ENOMEDIUM: error_setg(errp, QERR_DEVICE_HAS_NO_MEDIUM, device); break; case -ENOTSUP: error_setg(errp, QERR_UNSUPPORTED); break; case -EACCES: error_setg(errp, "Device '%s' is read only", device); break; case -EBUSY: error_setg(errp, QERR_DEVICE_IN_USE, device); break; default: error_setg_errno(errp, -ret, "Could not resize"); break; } out: aio_context_release(aio_context); }
{ "code": [], "line_no": [] }
void FUNC_0(bool VAR_0, const char *VAR_1, bool VAR_2, const char *VAR_3, int64_t VAR_4, Error **VAR_5) { Error *local_err = NULL; BlockDriverState *bs; AioContext *aio_context; int VAR_6; bs = bdrv_lookup_bs(VAR_0 ? VAR_1 : NULL, VAR_2 ? VAR_3 : NULL, &local_err); if (local_err) { error_propagate(VAR_5, local_err); return; } aio_context = bdrv_get_aio_context(bs); aio_context_acquire(aio_context); if (!bdrv_is_first_non_filter(bs)) { error_setg(VAR_5, QERR_FEATURE_DISABLED, "resize"); goto out; } if (VAR_4 < 0) { error_setg(VAR_5, QERR_INVALID_PARAMETER_VALUE, "VAR_4", "a >0 VAR_4"); goto out; } if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_RESIZE, NULL)) { error_setg(VAR_5, QERR_DEVICE_IN_USE, VAR_1); goto out; } bdrv_drain_all(); VAR_6 = bdrv_truncate(bs, VAR_4); switch (VAR_6) { case 0: break; case -ENOMEDIUM: error_setg(VAR_5, QERR_DEVICE_HAS_NO_MEDIUM, VAR_1); break; case -ENOTSUP: error_setg(VAR_5, QERR_UNSUPPORTED); break; case -EACCES: error_setg(VAR_5, "Device '%s' is read only", VAR_1); break; case -EBUSY: error_setg(VAR_5, QERR_DEVICE_IN_USE, VAR_1); break; default: error_setg_errno(VAR_5, -VAR_6, "Could not resize"); break; } out: aio_context_release(aio_context); }
[ "void FUNC_0(bool VAR_0, const char *VAR_1,\nbool VAR_2, const char *VAR_3,\nint64_t VAR_4, Error **VAR_5)\n{", "Error *local_err = NULL;", "BlockDriverState *bs;", "AioContext *aio_context;", "int VAR_6;", "bs = bdrv_lookup_bs(VAR_0 ? VAR_1 : NULL,\nVAR_2 ? VAR_3 : NULL,\n&local_err);", "if (local_err) {", "error_propagate(VAR_5, local_err);", "return;", "}", "aio_context = bdrv_get_aio_context(bs);", "aio_context_acquire(aio_context);", "if (!bdrv_is_first_non_filter(bs)) {", "error_setg(VAR_5, QERR_FEATURE_DISABLED, \"resize\");", "goto out;", "}", "if (VAR_4 < 0) {", "error_setg(VAR_5, QERR_INVALID_PARAMETER_VALUE, \"VAR_4\", \"a >0 VAR_4\");", "goto out;", "}", "if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_RESIZE, NULL)) {", "error_setg(VAR_5, QERR_DEVICE_IN_USE, VAR_1);", "goto out;", "}", "bdrv_drain_all();", "VAR_6 = bdrv_truncate(bs, VAR_4);", "switch (VAR_6) {", "case 0:\nbreak;", "case -ENOMEDIUM:\nerror_setg(VAR_5, QERR_DEVICE_HAS_NO_MEDIUM, VAR_1);", "break;", "case -ENOTSUP:\nerror_setg(VAR_5, QERR_UNSUPPORTED);", "break;", "case -EACCES:\nerror_setg(VAR_5, \"Device '%s' is read only\", VAR_1);", "break;", "case -EBUSY:\nerror_setg(VAR_5, QERR_DEVICE_IN_USE, VAR_1);", "break;", "default:\nerror_setg_errno(VAR_5, -VAR_6, \"Could not resize\");", "break;", "}", "out:\naio_context_release(aio_context);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19, 21, 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 73 ], [ 77 ], [ 79 ], [ 81, 83 ], [ 85, 87 ], [ 89 ], [ 91, 93 ], [ 95 ], [ 97, 99 ], [ 101 ], [ 103, 105 ], [ 107 ], [ 109, 111 ], [ 113 ], [ 115 ], [ 119, 121 ], [ 123 ] ]
11,180
uint64_t mcf_uart_read(void *opaque, target_phys_addr_t addr, unsigned size) { mcf_uart_state *s = (mcf_uart_state *)opaque; switch (addr & 0x3f) { case 0x00: return s->mr[s->current_mr]; case 0x04: return s->sr; case 0x0c: { uint8_t val; int i; if (s->fifo_len == 0) return 0; val = s->fifo[0]; s->fifo_len--; for (i = 0; i < s->fifo_len; i++) s->fifo[i] = s->fifo[i + 1]; s->sr &= ~MCF_UART_FFULL; if (s->fifo_len == 0) s->sr &= ~MCF_UART_RxRDY; mcf_uart_update(s); qemu_chr_accept_input(s->chr); return val; } case 0x10: /* TODO: Implement IPCR. */ return 0; case 0x14: return s->isr; case 0x18: return s->bg1; case 0x1c: return s->bg2; default: return 0; } }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
uint64_t mcf_uart_read(void *opaque, target_phys_addr_t addr, unsigned size) { mcf_uart_state *s = (mcf_uart_state *)opaque; switch (addr & 0x3f) { case 0x00: return s->mr[s->current_mr]; case 0x04: return s->sr; case 0x0c: { uint8_t val; int i; if (s->fifo_len == 0) return 0; val = s->fifo[0]; s->fifo_len--; for (i = 0; i < s->fifo_len; i++) s->fifo[i] = s->fifo[i + 1]; s->sr &= ~MCF_UART_FFULL; if (s->fifo_len == 0) s->sr &= ~MCF_UART_RxRDY; mcf_uart_update(s); qemu_chr_accept_input(s->chr); return val; } case 0x10: return 0; case 0x14: return s->isr; case 0x18: return s->bg1; case 0x1c: return s->bg2; default: return 0; } }
{ "code": [], "line_no": [] }
uint64_t FUNC_0(void *opaque, target_phys_addr_t addr, unsigned size) { mcf_uart_state *s = (mcf_uart_state *)opaque; switch (addr & 0x3f) { case 0x00: return s->mr[s->current_mr]; case 0x04: return s->sr; case 0x0c: { uint8_t val; int VAR_0; if (s->fifo_len == 0) return 0; val = s->fifo[0]; s->fifo_len--; for (VAR_0 = 0; VAR_0 < s->fifo_len; VAR_0++) s->fifo[VAR_0] = s->fifo[VAR_0 + 1]; s->sr &= ~MCF_UART_FFULL; if (s->fifo_len == 0) s->sr &= ~MCF_UART_RxRDY; mcf_uart_update(s); qemu_chr_accept_input(s->chr); return val; } case 0x10: return 0; case 0x14: return s->isr; case 0x18: return s->bg1; case 0x1c: return s->bg2; default: return 0; } }
[ "uint64_t FUNC_0(void *opaque, target_phys_addr_t addr,\nunsigned size)\n{", "mcf_uart_state *s = (mcf_uart_state *)opaque;", "switch (addr & 0x3f) {", "case 0x00:\nreturn s->mr[s->current_mr];", "case 0x04:\nreturn s->sr;", "case 0x0c:\n{", "uint8_t val;", "int VAR_0;", "if (s->fifo_len == 0)\nreturn 0;", "val = s->fifo[0];", "s->fifo_len--;", "for (VAR_0 = 0; VAR_0 < s->fifo_len; VAR_0++)", "s->fifo[VAR_0] = s->fifo[VAR_0 + 1];", "s->sr &= ~MCF_UART_FFULL;", "if (s->fifo_len == 0)\ns->sr &= ~MCF_UART_RxRDY;", "mcf_uart_update(s);", "qemu_chr_accept_input(s->chr);", "return val;", "}", "case 0x10:\nreturn 0;", "case 0x14:\nreturn s->isr;", "case 0x18:\nreturn s->bg1;", "case 0x1c:\nreturn s->bg2;", "default:\nreturn 0;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11, 13 ], [ 15, 17 ], [ 19, 21 ], [ 23 ], [ 25 ], [ 29, 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45, 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57, 61 ], [ 63, 65 ], [ 67, 69 ], [ 71, 73 ], [ 75, 77 ], [ 79 ], [ 81 ] ]
11,181
int qcow2_zero_clusters(BlockDriverState *bs, uint64_t offset, int nb_sectors, int flags) { BDRVQcow2State *s = bs->opaque; uint64_t end_offset; uint64_t nb_clusters; int ret; end_offset = offset + (nb_sectors << BDRV_SECTOR_BITS); /* Caller must pass aligned values, except at image end */ assert(QEMU_IS_ALIGNED(offset, s->cluster_size)); assert(QEMU_IS_ALIGNED(end_offset, s->cluster_size) || end_offset == bs->total_sectors << BDRV_SECTOR_BITS); /* The zero flag is only supported by version 3 and newer */ if (s->qcow_version < 3) { return -ENOTSUP; } /* Each L2 table is handled by its own loop iteration */ nb_clusters = size_to_clusters(s, nb_sectors << BDRV_SECTOR_BITS); s->cache_discards = true; while (nb_clusters > 0) { ret = zero_single_l2(bs, offset, nb_clusters, flags); if (ret < 0) { goto fail; } nb_clusters -= ret; offset += (ret * s->cluster_size); } ret = 0; fail: s->cache_discards = false; qcow2_process_discards(bs, ret); return ret; }
false
qemu
d2cb36af2b0040d421b347e6e4e803e07220f78d
int qcow2_zero_clusters(BlockDriverState *bs, uint64_t offset, int nb_sectors, int flags) { BDRVQcow2State *s = bs->opaque; uint64_t end_offset; uint64_t nb_clusters; int ret; end_offset = offset + (nb_sectors << BDRV_SECTOR_BITS); assert(QEMU_IS_ALIGNED(offset, s->cluster_size)); assert(QEMU_IS_ALIGNED(end_offset, s->cluster_size) || end_offset == bs->total_sectors << BDRV_SECTOR_BITS); if (s->qcow_version < 3) { return -ENOTSUP; } nb_clusters = size_to_clusters(s, nb_sectors << BDRV_SECTOR_BITS); s->cache_discards = true; while (nb_clusters > 0) { ret = zero_single_l2(bs, offset, nb_clusters, flags); if (ret < 0) { goto fail; } nb_clusters -= ret; offset += (ret * s->cluster_size); } ret = 0; fail: s->cache_discards = false; qcow2_process_discards(bs, ret); return ret; }
{ "code": [], "line_no": [] }
int FUNC_0(BlockDriverState *VAR_0, uint64_t VAR_1, int VAR_2, int VAR_3) { BDRVQcow2State *s = VAR_0->opaque; uint64_t end_offset; uint64_t nb_clusters; int VAR_4; end_offset = VAR_1 + (VAR_2 << BDRV_SECTOR_BITS); assert(QEMU_IS_ALIGNED(VAR_1, s->cluster_size)); assert(QEMU_IS_ALIGNED(end_offset, s->cluster_size) || end_offset == VAR_0->total_sectors << BDRV_SECTOR_BITS); if (s->qcow_version < 3) { return -ENOTSUP; } nb_clusters = size_to_clusters(s, VAR_2 << BDRV_SECTOR_BITS); s->cache_discards = true; while (nb_clusters > 0) { VAR_4 = zero_single_l2(VAR_0, VAR_1, nb_clusters, VAR_3); if (VAR_4 < 0) { goto fail; } nb_clusters -= VAR_4; VAR_1 += (VAR_4 * s->cluster_size); } VAR_4 = 0; fail: s->cache_discards = false; qcow2_process_discards(VAR_0, VAR_4); return VAR_4; }
[ "int FUNC_0(BlockDriverState *VAR_0, uint64_t VAR_1, int VAR_2,\nint VAR_3)\n{", "BDRVQcow2State *s = VAR_0->opaque;", "uint64_t end_offset;", "uint64_t nb_clusters;", "int VAR_4;", "end_offset = VAR_1 + (VAR_2 << BDRV_SECTOR_BITS);", "assert(QEMU_IS_ALIGNED(VAR_1, s->cluster_size));", "assert(QEMU_IS_ALIGNED(end_offset, s->cluster_size) ||\nend_offset == VAR_0->total_sectors << BDRV_SECTOR_BITS);", "if (s->qcow_version < 3) {", "return -ENOTSUP;", "}", "nb_clusters = size_to_clusters(s, VAR_2 << BDRV_SECTOR_BITS);", "s->cache_discards = true;", "while (nb_clusters > 0) {", "VAR_4 = zero_single_l2(VAR_0, VAR_1, nb_clusters, VAR_3);", "if (VAR_4 < 0) {", "goto fail;", "}", "nb_clusters -= VAR_4;", "VAR_1 += (VAR_4 * s->cluster_size);", "}", "VAR_4 = 0;", "fail:\ns->cache_discards = false;", "qcow2_process_discards(VAR_0, VAR_4);", "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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 23 ], [ 25, 27 ], [ 33 ], [ 35 ], [ 37 ], [ 43 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73, 75 ], [ 77 ], [ 81 ], [ 83 ] ]
11,182
void bdrv_append_temp_snapshot(BlockDriverState *bs, Error **errp) { /* TODO: extra byte is a hack to ensure MAX_PATH space on Windows. */ char tmp_filename[PATH_MAX + 1]; int64_t total_size; BlockDriver *bdrv_qcow2; QEMUOptionParameter *create_options; QDict *snapshot_options; BlockDriverState *bs_snapshot; Error *local_err; int ret; /* if snapshot, we create a temporary backing file and open it instead of opening 'filename' directly */ /* Get the required size from the image */ total_size = bdrv_getlength(bs); if (total_size < 0) { error_setg_errno(errp, -total_size, "Could not get image size"); return; } total_size &= BDRV_SECTOR_MASK; /* Create the temporary image */ ret = get_tmp_filename(tmp_filename, sizeof(tmp_filename)); if (ret < 0) { error_setg_errno(errp, -ret, "Could not get temporary filename"); return; } bdrv_qcow2 = bdrv_find_format("qcow2"); create_options = parse_option_parameters("", bdrv_qcow2->create_options, NULL); set_option_parameter_int(create_options, BLOCK_OPT_SIZE, total_size); ret = bdrv_create(bdrv_qcow2, tmp_filename, create_options, &local_err); free_option_parameters(create_options); if (ret < 0) { error_setg_errno(errp, -ret, "Could not create temporary overlay " "'%s': %s", tmp_filename, error_get_pretty(local_err)); error_free(local_err); return; } /* Prepare a new options QDict for the temporary file */ snapshot_options = qdict_new(); qdict_put(snapshot_options, "file.driver", qstring_from_str("file")); qdict_put(snapshot_options, "file.filename", qstring_from_str(tmp_filename)); bs_snapshot = bdrv_new(""); bs_snapshot->is_temporary = 1; ret = bdrv_open(&bs_snapshot, NULL, NULL, snapshot_options, bs->open_flags & ~BDRV_O_SNAPSHOT, bdrv_qcow2, &local_err); if (ret < 0) { error_propagate(errp, local_err); return; } bdrv_append(bs_snapshot, bs); }
false
qemu
98522f63f40adaebc412481e1d2e9170160d4539
void bdrv_append_temp_snapshot(BlockDriverState *bs, Error **errp) { char tmp_filename[PATH_MAX + 1]; int64_t total_size; BlockDriver *bdrv_qcow2; QEMUOptionParameter *create_options; QDict *snapshot_options; BlockDriverState *bs_snapshot; Error *local_err; int ret; total_size = bdrv_getlength(bs); if (total_size < 0) { error_setg_errno(errp, -total_size, "Could not get image size"); return; } total_size &= BDRV_SECTOR_MASK; ret = get_tmp_filename(tmp_filename, sizeof(tmp_filename)); if (ret < 0) { error_setg_errno(errp, -ret, "Could not get temporary filename"); return; } bdrv_qcow2 = bdrv_find_format("qcow2"); create_options = parse_option_parameters("", bdrv_qcow2->create_options, NULL); set_option_parameter_int(create_options, BLOCK_OPT_SIZE, total_size); ret = bdrv_create(bdrv_qcow2, tmp_filename, create_options, &local_err); free_option_parameters(create_options); if (ret < 0) { error_setg_errno(errp, -ret, "Could not create temporary overlay " "'%s': %s", tmp_filename, error_get_pretty(local_err)); error_free(local_err); return; } snapshot_options = qdict_new(); qdict_put(snapshot_options, "file.driver", qstring_from_str("file")); qdict_put(snapshot_options, "file.filename", qstring_from_str(tmp_filename)); bs_snapshot = bdrv_new(""); bs_snapshot->is_temporary = 1; ret = bdrv_open(&bs_snapshot, NULL, NULL, snapshot_options, bs->open_flags & ~BDRV_O_SNAPSHOT, bdrv_qcow2, &local_err); if (ret < 0) { error_propagate(errp, local_err); return; } bdrv_append(bs_snapshot, bs); }
{ "code": [], "line_no": [] }
void FUNC_0(BlockDriverState *VAR_0, Error **VAR_1) { char VAR_2[PATH_MAX + 1]; int64_t total_size; BlockDriver *bdrv_qcow2; QEMUOptionParameter *create_options; QDict *snapshot_options; BlockDriverState *bs_snapshot; Error *local_err; int VAR_3; total_size = bdrv_getlength(VAR_0); if (total_size < 0) { error_setg_errno(VAR_1, -total_size, "Could not get image size"); return; } total_size &= BDRV_SECTOR_MASK; VAR_3 = get_tmp_filename(VAR_2, sizeof(VAR_2)); if (VAR_3 < 0) { error_setg_errno(VAR_1, -VAR_3, "Could not get temporary filename"); return; } bdrv_qcow2 = bdrv_find_format("qcow2"); create_options = parse_option_parameters("", bdrv_qcow2->create_options, NULL); set_option_parameter_int(create_options, BLOCK_OPT_SIZE, total_size); VAR_3 = bdrv_create(bdrv_qcow2, VAR_2, create_options, &local_err); free_option_parameters(create_options); if (VAR_3 < 0) { error_setg_errno(VAR_1, -VAR_3, "Could not create temporary overlay " "'%s': %s", VAR_2, error_get_pretty(local_err)); error_free(local_err); return; } snapshot_options = qdict_new(); qdict_put(snapshot_options, "file.driver", qstring_from_str("file")); qdict_put(snapshot_options, "file.filename", qstring_from_str(VAR_2)); bs_snapshot = bdrv_new(""); bs_snapshot->is_temporary = 1; VAR_3 = bdrv_open(&bs_snapshot, NULL, NULL, snapshot_options, VAR_0->open_flags & ~BDRV_O_SNAPSHOT, bdrv_qcow2, &local_err); if (VAR_3 < 0) { error_propagate(VAR_1, local_err); return; } bdrv_append(bs_snapshot, VAR_0); }
[ "void FUNC_0(BlockDriverState *VAR_0, Error **VAR_1)\n{", "char VAR_2[PATH_MAX + 1];", "int64_t total_size;", "BlockDriver *bdrv_qcow2;", "QEMUOptionParameter *create_options;", "QDict *snapshot_options;", "BlockDriverState *bs_snapshot;", "Error *local_err;", "int VAR_3;", "total_size = bdrv_getlength(VAR_0);", "if (total_size < 0) {", "error_setg_errno(VAR_1, -total_size, \"Could not get image size\");", "return;", "}", "total_size &= BDRV_SECTOR_MASK;", "VAR_3 = get_tmp_filename(VAR_2, sizeof(VAR_2));", "if (VAR_3 < 0) {", "error_setg_errno(VAR_1, -VAR_3, \"Could not get temporary filename\");", "return;", "}", "bdrv_qcow2 = bdrv_find_format(\"qcow2\");", "create_options = parse_option_parameters(\"\", bdrv_qcow2->create_options,\nNULL);", "set_option_parameter_int(create_options, BLOCK_OPT_SIZE, total_size);", "VAR_3 = bdrv_create(bdrv_qcow2, VAR_2, create_options, &local_err);", "free_option_parameters(create_options);", "if (VAR_3 < 0) {", "error_setg_errno(VAR_1, -VAR_3, \"Could not create temporary overlay \"\n\"'%s': %s\", VAR_2,\nerror_get_pretty(local_err));", "error_free(local_err);", "return;", "}", "snapshot_options = qdict_new();", "qdict_put(snapshot_options, \"file.driver\",\nqstring_from_str(\"file\"));", "qdict_put(snapshot_options, \"file.filename\",\nqstring_from_str(VAR_2));", "bs_snapshot = bdrv_new(\"\");", "bs_snapshot->is_temporary = 1;", "VAR_3 = bdrv_open(&bs_snapshot, NULL, NULL, snapshot_options,\nVAR_0->open_flags & ~BDRV_O_SNAPSHOT, bdrv_qcow2, &local_err);", "if (VAR_3 < 0) {", "error_propagate(VAR_1, local_err);", "return;", "}", "bdrv_append(bs_snapshot, VAR_0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65, 67 ], [ 71 ], [ 75 ], [ 77 ], [ 79 ], [ 81, 83, 85 ], [ 87 ], [ 89 ], [ 91 ], [ 97 ], [ 99, 101 ], [ 103, 105 ], [ 109 ], [ 111 ], [ 115, 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 129 ], [ 131 ] ]
11,183
static int mov_read_dec3(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; enum AVAudioServiceType *ast; int eac3info, acmod, lfeon, bsmod; if (c->fc->nb_streams < 1) return 0; st = c->fc->streams[c->fc->nb_streams-1]; ast = (enum AVAudioServiceType*)ff_stream_new_side_data(st, AV_PKT_DATA_AUDIO_SERVICE_TYPE, sizeof(*ast)); if (!ast) return AVERROR(ENOMEM); /* No need to parse fields for additional independent substreams and its * associated dependent substreams since libavcodec's E-AC-3 decoder * does not support them yet. */ avio_rb16(pb); /* data_rate and num_ind_sub */ eac3info = avio_rb24(pb); bsmod = (eac3info >> 12) & 0x1f; acmod = (eac3info >> 9) & 0x7; lfeon = (eac3info >> 8) & 0x1; st->codec->channel_layout = avpriv_ac3_channel_layout_tab[acmod]; if (lfeon) st->codec->channel_layout |= AV_CH_LOW_FREQUENCY; st->codec->channels = av_get_channel_layout_nb_channels(st->codec->channel_layout); *ast = bsmod; if (st->codec->channels > 1 && bsmod == 0x7) *ast = AV_AUDIO_SERVICE_TYPE_KARAOKE; st->codec->audio_service_type = *ast; return 0; }
false
FFmpeg
7f4ec4364bc4a73036660c1c6a3c4801db524e9e
static int mov_read_dec3(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; enum AVAudioServiceType *ast; int eac3info, acmod, lfeon, bsmod; if (c->fc->nb_streams < 1) return 0; st = c->fc->streams[c->fc->nb_streams-1]; ast = (enum AVAudioServiceType*)ff_stream_new_side_data(st, AV_PKT_DATA_AUDIO_SERVICE_TYPE, sizeof(*ast)); if (!ast) return AVERROR(ENOMEM); avio_rb16(pb); eac3info = avio_rb24(pb); bsmod = (eac3info >> 12) & 0x1f; acmod = (eac3info >> 9) & 0x7; lfeon = (eac3info >> 8) & 0x1; st->codec->channel_layout = avpriv_ac3_channel_layout_tab[acmod]; if (lfeon) st->codec->channel_layout |= AV_CH_LOW_FREQUENCY; st->codec->channels = av_get_channel_layout_nb_channels(st->codec->channel_layout); *ast = bsmod; if (st->codec->channels > 1 && bsmod == 0x7) *ast = AV_AUDIO_SERVICE_TYPE_KARAOKE; st->codec->audio_service_type = *ast; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(MOVContext *VAR_0, AVIOContext *VAR_1, MOVAtom VAR_2) { AVStream *st; enum AVAudioServiceType *VAR_3; int VAR_4, VAR_5, VAR_6, VAR_7; if (VAR_0->fc->nb_streams < 1) return 0; st = VAR_0->fc->streams[VAR_0->fc->nb_streams-1]; VAR_3 = (enum AVAudioServiceType*)ff_stream_new_side_data(st, AV_PKT_DATA_AUDIO_SERVICE_TYPE, sizeof(*VAR_3)); if (!VAR_3) return AVERROR(ENOMEM); avio_rb16(VAR_1); VAR_4 = avio_rb24(VAR_1); VAR_7 = (VAR_4 >> 12) & 0x1f; VAR_5 = (VAR_4 >> 9) & 0x7; VAR_6 = (VAR_4 >> 8) & 0x1; st->codec->channel_layout = avpriv_ac3_channel_layout_tab[VAR_5]; if (VAR_6) st->codec->channel_layout |= AV_CH_LOW_FREQUENCY; st->codec->channels = av_get_channel_layout_nb_channels(st->codec->channel_layout); *VAR_3 = VAR_7; if (st->codec->channels > 1 && VAR_7 == 0x7) *VAR_3 = AV_AUDIO_SERVICE_TYPE_KARAOKE; st->codec->audio_service_type = *VAR_3; return 0; }
[ "static int FUNC_0(MOVContext *VAR_0, AVIOContext *VAR_1, MOVAtom VAR_2)\n{", "AVStream *st;", "enum AVAudioServiceType *VAR_3;", "int VAR_4, VAR_5, VAR_6, VAR_7;", "if (VAR_0->fc->nb_streams < 1)\nreturn 0;", "st = VAR_0->fc->streams[VAR_0->fc->nb_streams-1];", "VAR_3 = (enum AVAudioServiceType*)ff_stream_new_side_data(st, AV_PKT_DATA_AUDIO_SERVICE_TYPE,\nsizeof(*VAR_3));", "if (!VAR_3)\nreturn AVERROR(ENOMEM);", "avio_rb16(VAR_1);", "VAR_4 = avio_rb24(VAR_1);", "VAR_7 = (VAR_4 >> 12) & 0x1f;", "VAR_5 = (VAR_4 >> 9) & 0x7;", "VAR_6 = (VAR_4 >> 8) & 0x1;", "st->codec->channel_layout = avpriv_ac3_channel_layout_tab[VAR_5];", "if (VAR_6)\nst->codec->channel_layout |= AV_CH_LOW_FREQUENCY;", "st->codec->channels = av_get_channel_layout_nb_channels(st->codec->channel_layout);", "*VAR_3 = VAR_7;", "if (st->codec->channels > 1 && VAR_7 == 0x7)\n*VAR_3 = AV_AUDIO_SERVICE_TYPE_KARAOKE;", "st->codec->audio_service_type = *VAR_3;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13, 15 ], [ 17 ], [ 21, 23 ], [ 25, 27 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49, 51 ], [ 53 ], [ 55 ], [ 57, 59 ], [ 63 ], [ 67 ], [ 69 ] ]
11,184
Visitor *visitor_input_test_init(TestInputVisitorData *data, const char *json_string, ...) { Visitor *v; va_list ap; va_start(ap, json_string); v = visitor_input_test_init_internal(data, json_string, &ap); va_end(ap); return v; }
false
qemu
b3db211f3c80bb996a704d665fe275619f728bd4
Visitor *visitor_input_test_init(TestInputVisitorData *data, const char *json_string, ...) { Visitor *v; va_list ap; va_start(ap, json_string); v = visitor_input_test_init_internal(data, json_string, &ap); va_end(ap); return v; }
{ "code": [], "line_no": [] }
Visitor *FUNC_0(TestInputVisitorData *data, const char *json_string, ...) { Visitor *v; va_list ap; va_start(ap, json_string); v = visitor_input_test_init_internal(data, json_string, &ap); va_end(ap); return v; }
[ "Visitor *FUNC_0(TestInputVisitorData *data,\nconst char *json_string, ...)\n{", "Visitor *v;", "va_list ap;", "va_start(ap, json_string);", "v = visitor_input_test_init_internal(data, json_string, &ap);", "va_end(ap);", "return v;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
11,185
int qemu_pixman_get_type(int rshift, int gshift, int bshift) { int type = PIXMAN_TYPE_OTHER; if (rshift > gshift && gshift > bshift) { if (bshift == 0) { type = PIXMAN_TYPE_ARGB; } else { #if PIXMAN_VERSION >= PIXMAN_VERSION_ENCODE(0, 21, 8) type = PIXMAN_TYPE_RGBA; #endif } } else if (rshift < gshift && gshift < bshift) { if (rshift == 0) { type = PIXMAN_TYPE_ABGR; } else { #if PIXMAN_VERSION >= PIXMAN_VERSION_ENCODE(0, 21, 8) type = PIXMAN_TYPE_BGRA; #endif } } return type; }
false
qemu
fbddfc727bde692f009a269e8e628d8c152b537b
int qemu_pixman_get_type(int rshift, int gshift, int bshift) { int type = PIXMAN_TYPE_OTHER; if (rshift > gshift && gshift > bshift) { if (bshift == 0) { type = PIXMAN_TYPE_ARGB; } else { #if PIXMAN_VERSION >= PIXMAN_VERSION_ENCODE(0, 21, 8) type = PIXMAN_TYPE_RGBA; #endif } } else if (rshift < gshift && gshift < bshift) { if (rshift == 0) { type = PIXMAN_TYPE_ABGR; } else { #if PIXMAN_VERSION >= PIXMAN_VERSION_ENCODE(0, 21, 8) type = PIXMAN_TYPE_BGRA; #endif } } return type; }
{ "code": [], "line_no": [] }
int FUNC_0(int VAR_0, int VAR_1, int VAR_2) { int VAR_3 = PIXMAN_TYPE_OTHER; if (VAR_0 > VAR_1 && VAR_1 > VAR_2) { if (VAR_2 == 0) { VAR_3 = PIXMAN_TYPE_ARGB; } else { #if PIXMAN_VERSION >= PIXMAN_VERSION_ENCODE(0, 21, 8) VAR_3 = PIXMAN_TYPE_RGBA; #endif } } else if (VAR_0 < VAR_1 && VAR_1 < VAR_2) { if (VAR_0 == 0) { VAR_3 = PIXMAN_TYPE_ABGR; } else { #if PIXMAN_VERSION >= PIXMAN_VERSION_ENCODE(0, 21, 8) VAR_3 = PIXMAN_TYPE_BGRA; #endif } } return VAR_3; }
[ "int FUNC_0(int VAR_0, int VAR_1, int VAR_2)\n{", "int VAR_3 = PIXMAN_TYPE_OTHER;", "if (VAR_0 > VAR_1 && VAR_1 > VAR_2) {", "if (VAR_2 == 0) {", "VAR_3 = PIXMAN_TYPE_ARGB;", "} else {", "#if PIXMAN_VERSION >= PIXMAN_VERSION_ENCODE(0, 21, 8)\nVAR_3 = PIXMAN_TYPE_RGBA;", "#endif\n}", "} else if (VAR_0 < VAR_1 && VAR_1 < VAR_2) {", "if (VAR_0 == 0) {", "VAR_3 = PIXMAN_TYPE_ABGR;", "} else {", "#if PIXMAN_VERSION >= PIXMAN_VERSION_ENCODE(0, 21, 8)\nVAR_3 = PIXMAN_TYPE_BGRA;", "#endif\n}", "}", "return VAR_3;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17, 19 ], [ 21, 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33, 35 ], [ 37, 39 ], [ 41 ], [ 43 ], [ 45 ] ]
11,186
static struct omap_32khz_timer_s *omap_os_timer_init(MemoryRegion *memory, target_phys_addr_t base, qemu_irq irq, omap_clk clk) { struct omap_32khz_timer_s *s = (struct omap_32khz_timer_s *) g_malloc0(sizeof(struct omap_32khz_timer_s)); s->timer.irq = irq; s->timer.clk = clk; s->timer.timer = qemu_new_timer_ns(vm_clock, omap_timer_tick, &s->timer); omap_os_timer_reset(s); omap_timer_clk_setup(&s->timer); memory_region_init_io(&s->iomem, &omap_os_timer_ops, s, "omap-os-timer", 0x800); memory_region_add_subregion(memory, base, &s->iomem); return s; }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static struct omap_32khz_timer_s *omap_os_timer_init(MemoryRegion *memory, target_phys_addr_t base, qemu_irq irq, omap_clk clk) { struct omap_32khz_timer_s *s = (struct omap_32khz_timer_s *) g_malloc0(sizeof(struct omap_32khz_timer_s)); s->timer.irq = irq; s->timer.clk = clk; s->timer.timer = qemu_new_timer_ns(vm_clock, omap_timer_tick, &s->timer); omap_os_timer_reset(s); omap_timer_clk_setup(&s->timer); memory_region_init_io(&s->iomem, &omap_os_timer_ops, s, "omap-os-timer", 0x800); memory_region_add_subregion(memory, base, &s->iomem); return s; }
{ "code": [], "line_no": [] }
static struct omap_32khz_timer_s *FUNC_0(MemoryRegion *VAR_0, target_phys_addr_t VAR_1, qemu_irq VAR_2, omap_clk VAR_3) { struct omap_32khz_timer_s *VAR_4 = (struct omap_32khz_timer_s *) g_malloc0(sizeof(struct omap_32khz_timer_s)); VAR_4->timer.VAR_2 = VAR_2; VAR_4->timer.VAR_3 = VAR_3; VAR_4->timer.timer = qemu_new_timer_ns(vm_clock, omap_timer_tick, &VAR_4->timer); omap_os_timer_reset(VAR_4); omap_timer_clk_setup(&VAR_4->timer); memory_region_init_io(&VAR_4->iomem, &omap_os_timer_ops, VAR_4, "omap-os-timer", 0x800); memory_region_add_subregion(VAR_0, VAR_1, &VAR_4->iomem); return VAR_4; }
[ "static struct omap_32khz_timer_s *FUNC_0(MemoryRegion *VAR_0,\ntarget_phys_addr_t VAR_1,\nqemu_irq VAR_2, omap_clk VAR_3)\n{", "struct omap_32khz_timer_s *VAR_4 = (struct omap_32khz_timer_s *)\ng_malloc0(sizeof(struct omap_32khz_timer_s));", "VAR_4->timer.VAR_2 = VAR_2;", "VAR_4->timer.VAR_3 = VAR_3;", "VAR_4->timer.timer = qemu_new_timer_ns(vm_clock, omap_timer_tick, &VAR_4->timer);", "omap_os_timer_reset(VAR_4);", "omap_timer_clk_setup(&VAR_4->timer);", "memory_region_init_io(&VAR_4->iomem, &omap_os_timer_ops, VAR_4,\n\"omap-os-timer\", 0x800);", "memory_region_add_subregion(VAR_0, VAR_1, &VAR_4->iomem);", "return VAR_4;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9, 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27, 29 ], [ 31 ], [ 35 ], [ 37 ] ]
11,187
static void acpi_pcihp_eject_slot(AcpiPciHpState *s, unsigned bsel, unsigned slots) { BusChild *kid, *next; int slot = ffs(slots) - 1; PCIBus *bus = acpi_pcihp_find_hotplug_bus(s, bsel); if (!bus) { return; } /* Mark request as complete */ s->acpi_pcihp_pci_status[bsel].down &= ~(1U << slot); s->acpi_pcihp_pci_status[bsel].up &= ~(1U << slot); QTAILQ_FOREACH_SAFE(kid, &bus->qbus.children, sibling, next) { DeviceState *qdev = kid->child; PCIDevice *dev = PCI_DEVICE(qdev); if (PCI_SLOT(dev->devfn) == slot) { if (!acpi_pcihp_pc_no_hotplug(s, dev)) { object_unparent(OBJECT(qdev)); } } } }
false
qemu
786a4ea82ec9c87e3a895cf41081029b285a5fe5
static void acpi_pcihp_eject_slot(AcpiPciHpState *s, unsigned bsel, unsigned slots) { BusChild *kid, *next; int slot = ffs(slots) - 1; PCIBus *bus = acpi_pcihp_find_hotplug_bus(s, bsel); if (!bus) { return; } s->acpi_pcihp_pci_status[bsel].down &= ~(1U << slot); s->acpi_pcihp_pci_status[bsel].up &= ~(1U << slot); QTAILQ_FOREACH_SAFE(kid, &bus->qbus.children, sibling, next) { DeviceState *qdev = kid->child; PCIDevice *dev = PCI_DEVICE(qdev); if (PCI_SLOT(dev->devfn) == slot) { if (!acpi_pcihp_pc_no_hotplug(s, dev)) { object_unparent(OBJECT(qdev)); } } } }
{ "code": [], "line_no": [] }
static void FUNC_0(AcpiPciHpState *VAR_0, unsigned VAR_1, unsigned VAR_2) { BusChild *kid, *next; int VAR_3 = ffs(VAR_2) - 1; PCIBus *bus = acpi_pcihp_find_hotplug_bus(VAR_0, VAR_1); if (!bus) { return; } VAR_0->acpi_pcihp_pci_status[VAR_1].down &= ~(1U << VAR_3); VAR_0->acpi_pcihp_pci_status[VAR_1].up &= ~(1U << VAR_3); QTAILQ_FOREACH_SAFE(kid, &bus->qbus.children, sibling, next) { DeviceState *qdev = kid->child; PCIDevice *dev = PCI_DEVICE(qdev); if (PCI_SLOT(dev->devfn) == VAR_3) { if (!acpi_pcihp_pc_no_hotplug(VAR_0, dev)) { object_unparent(OBJECT(qdev)); } } } }
[ "static void FUNC_0(AcpiPciHpState *VAR_0, unsigned VAR_1, unsigned VAR_2)\n{", "BusChild *kid, *next;", "int VAR_3 = ffs(VAR_2) - 1;", "PCIBus *bus = acpi_pcihp_find_hotplug_bus(VAR_0, VAR_1);", "if (!bus) {", "return;", "}", "VAR_0->acpi_pcihp_pci_status[VAR_1].down &= ~(1U << VAR_3);", "VAR_0->acpi_pcihp_pci_status[VAR_1].up &= ~(1U << VAR_3);", "QTAILQ_FOREACH_SAFE(kid, &bus->qbus.children, sibling, next) {", "DeviceState *qdev = kid->child;", "PCIDevice *dev = PCI_DEVICE(qdev);", "if (PCI_SLOT(dev->devfn) == VAR_3) {", "if (!acpi_pcihp_pc_no_hotplug(VAR_0, dev)) {", "object_unparent(OBJECT(qdev));", "}", "}", "}", "}" ]
[ 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 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ] ]
11,188
static void machine_cpu_reset(MicroBlazeCPU *cpu) { CPUMBState *env = &cpu->env; env->pvr.regs[10] = 0x0e000000; /* virtex 6 */ /* setup pvr to match kernel setting */ env->pvr.regs[0] |= (0x14 << 8); env->pvr.regs[4] = 0xc56b8000; env->pvr.regs[5] = 0xc56be000; }
false
qemu
a87310a62d1885b8f6d6b5b30227cbd9792d2c3c
static void machine_cpu_reset(MicroBlazeCPU *cpu) { CPUMBState *env = &cpu->env; env->pvr.regs[10] = 0x0e000000; env->pvr.regs[0] |= (0x14 << 8); env->pvr.regs[4] = 0xc56b8000; env->pvr.regs[5] = 0xc56be000; }
{ "code": [], "line_no": [] }
static void FUNC_0(MicroBlazeCPU *VAR_0) { CPUMBState *env = &VAR_0->env; env->pvr.regs[10] = 0x0e000000; env->pvr.regs[0] |= (0x14 << 8); env->pvr.regs[4] = 0xc56b8000; env->pvr.regs[5] = 0xc56be000; }
[ "static void FUNC_0(MicroBlazeCPU *VAR_0)\n{", "CPUMBState *env = &VAR_0->env;", "env->pvr.regs[10] = 0x0e000000;", "env->pvr.regs[0] |= (0x14 << 8);", "env->pvr.regs[4] = 0xc56b8000;", "env->pvr.regs[5] = 0xc56be000;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ] ]
11,189
static int nbd_handle_list(NBDClient *client, uint32_t length) { int csock; NBDExport *exp; csock = client->sock; if (length) { return nbd_send_rep(csock, NBD_REP_ERR_INVALID, NBD_OPT_LIST); /* For each export, send a NBD_REP_SERVER reply. */ QTAILQ_FOREACH(exp, &exports, next) { if (nbd_send_rep_list(csock, exp)) { return -EINVAL; /* Finish with a NBD_REP_ACK. */ return nbd_send_rep(csock, NBD_REP_ACK, NBD_OPT_LIST);
true
qemu
0379f474ddebfc69f42fa8231d86687cf29d997b
static int nbd_handle_list(NBDClient *client, uint32_t length) { int csock; NBDExport *exp; csock = client->sock; if (length) { return nbd_send_rep(csock, NBD_REP_ERR_INVALID, NBD_OPT_LIST); QTAILQ_FOREACH(exp, &exports, next) { if (nbd_send_rep_list(csock, exp)) { return -EINVAL; return nbd_send_rep(csock, NBD_REP_ACK, NBD_OPT_LIST);
{ "code": [], "line_no": [] }
static int FUNC_0(NBDClient *VAR_0, uint32_t VAR_1) { int VAR_2; NBDExport *exp; VAR_2 = VAR_0->sock; if (VAR_1) { return nbd_send_rep(VAR_2, NBD_REP_ERR_INVALID, NBD_OPT_LIST); QTAILQ_FOREACH(exp, &exports, next) { if (nbd_send_rep_list(VAR_2, exp)) { return -EINVAL; return nbd_send_rep(VAR_2, NBD_REP_ACK, NBD_OPT_LIST);
[ "static int FUNC_0(NBDClient *VAR_0, uint32_t VAR_1)\n{", "int VAR_2;", "NBDExport *exp;", "VAR_2 = VAR_0->sock;", "if (VAR_1) {", "return nbd_send_rep(VAR_2, NBD_REP_ERR_INVALID, NBD_OPT_LIST);", "QTAILQ_FOREACH(exp, &exports, next) {", "if (nbd_send_rep_list(VAR_2, exp)) {", "return -EINVAL;", "return nbd_send_rep(VAR_2, NBD_REP_ACK, NBD_OPT_LIST);" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 18 ], [ 25 ], [ 27 ], [ 29 ], [ 35 ] ]
11,190
static void create_header32(DumpState *s, Error **errp) { DiskDumpHeader32 *dh = NULL; KdumpSubHeader32 *kh = NULL; size_t size; uint32_t block_size; uint32_t sub_hdr_size; uint32_t bitmap_blocks; uint32_t status = 0; uint64_t offset_note; Error *local_err = NULL; /* write common header, the version of kdump-compressed format is 6th */ size = sizeof(DiskDumpHeader32); dh = g_malloc0(size); strncpy(dh->signature, KDUMP_SIGNATURE, strlen(KDUMP_SIGNATURE)); dh->header_version = cpu_to_dump32(s, 6); block_size = s->dump_info.page_size; dh->block_size = cpu_to_dump32(s, block_size); sub_hdr_size = sizeof(struct KdumpSubHeader32) + s->note_size; sub_hdr_size = DIV_ROUND_UP(sub_hdr_size, block_size); dh->sub_hdr_size = cpu_to_dump32(s, sub_hdr_size); /* dh->max_mapnr may be truncated, full 64bit is in kh.max_mapnr_64 */ dh->max_mapnr = cpu_to_dump32(s, MIN(s->max_mapnr, UINT_MAX)); dh->nr_cpus = cpu_to_dump32(s, s->nr_cpus); bitmap_blocks = DIV_ROUND_UP(s->len_dump_bitmap, block_size) * 2; dh->bitmap_blocks = cpu_to_dump32(s, bitmap_blocks); strncpy(dh->utsname.machine, ELF_MACHINE_UNAME, sizeof(dh->utsname.machine)); if (s->flag_compress & DUMP_DH_COMPRESSED_ZLIB) { status |= DUMP_DH_COMPRESSED_ZLIB; #ifdef CONFIG_LZO if (s->flag_compress & DUMP_DH_COMPRESSED_LZO) { status |= DUMP_DH_COMPRESSED_LZO; #endif #ifdef CONFIG_SNAPPY if (s->flag_compress & DUMP_DH_COMPRESSED_SNAPPY) { status |= DUMP_DH_COMPRESSED_SNAPPY; #endif dh->status = cpu_to_dump32(s, status); if (write_buffer(s->fd, 0, dh, size) < 0) { error_setg(errp, "dump: failed to write disk dump header"); goto out; /* write sub header */ size = sizeof(KdumpSubHeader32); kh = g_malloc0(size); /* 64bit max_mapnr_64 */ kh->max_mapnr_64 = cpu_to_dump64(s, s->max_mapnr); kh->phys_base = cpu_to_dump32(s, s->dump_info.phys_base); kh->dump_level = cpu_to_dump32(s, DUMP_LEVEL); offset_note = DISKDUMP_HEADER_BLOCKS * block_size + size; kh->offset_note = cpu_to_dump64(s, offset_note); kh->note_size = cpu_to_dump32(s, s->note_size); if (write_buffer(s->fd, DISKDUMP_HEADER_BLOCKS * block_size, kh, size) < 0) { error_setg(errp, "dump: failed to write kdump sub header"); goto out; /* write note */ s->note_buf = g_malloc0(s->note_size); s->note_buf_offset = 0; /* use s->note_buf to store notes temporarily */ write_elf32_notes(buf_write_note, s, &local_err); if (local_err) { error_propagate(errp, local_err); goto out; if (write_buffer(s->fd, offset_note, s->note_buf, s->note_size) < 0) { error_setg(errp, "dump: failed to write notes"); goto out; /* get offset of dump_bitmap */ s->offset_dump_bitmap = (DISKDUMP_HEADER_BLOCKS + sub_hdr_size) * block_size; /* get offset of page */ s->offset_page = (DISKDUMP_HEADER_BLOCKS + sub_hdr_size + bitmap_blocks) * block_size; out: g_free(dh); g_free(kh); g_free(s->note_buf);
true
qemu
9ada575bbafaf6d3724a7f59df9da89776817cac
static void create_header32(DumpState *s, Error **errp) { DiskDumpHeader32 *dh = NULL; KdumpSubHeader32 *kh = NULL; size_t size; uint32_t block_size; uint32_t sub_hdr_size; uint32_t bitmap_blocks; uint32_t status = 0; uint64_t offset_note; Error *local_err = NULL; size = sizeof(DiskDumpHeader32); dh = g_malloc0(size); strncpy(dh->signature, KDUMP_SIGNATURE, strlen(KDUMP_SIGNATURE)); dh->header_version = cpu_to_dump32(s, 6); block_size = s->dump_info.page_size; dh->block_size = cpu_to_dump32(s, block_size); sub_hdr_size = sizeof(struct KdumpSubHeader32) + s->note_size; sub_hdr_size = DIV_ROUND_UP(sub_hdr_size, block_size); dh->sub_hdr_size = cpu_to_dump32(s, sub_hdr_size); dh->max_mapnr = cpu_to_dump32(s, MIN(s->max_mapnr, UINT_MAX)); dh->nr_cpus = cpu_to_dump32(s, s->nr_cpus); bitmap_blocks = DIV_ROUND_UP(s->len_dump_bitmap, block_size) * 2; dh->bitmap_blocks = cpu_to_dump32(s, bitmap_blocks); strncpy(dh->utsname.machine, ELF_MACHINE_UNAME, sizeof(dh->utsname.machine)); if (s->flag_compress & DUMP_DH_COMPRESSED_ZLIB) { status |= DUMP_DH_COMPRESSED_ZLIB; #ifdef CONFIG_LZO if (s->flag_compress & DUMP_DH_COMPRESSED_LZO) { status |= DUMP_DH_COMPRESSED_LZO; #endif #ifdef CONFIG_SNAPPY if (s->flag_compress & DUMP_DH_COMPRESSED_SNAPPY) { status |= DUMP_DH_COMPRESSED_SNAPPY; #endif dh->status = cpu_to_dump32(s, status); if (write_buffer(s->fd, 0, dh, size) < 0) { error_setg(errp, "dump: failed to write disk dump header"); goto out; size = sizeof(KdumpSubHeader32); kh = g_malloc0(size); kh->max_mapnr_64 = cpu_to_dump64(s, s->max_mapnr); kh->phys_base = cpu_to_dump32(s, s->dump_info.phys_base); kh->dump_level = cpu_to_dump32(s, DUMP_LEVEL); offset_note = DISKDUMP_HEADER_BLOCKS * block_size + size; kh->offset_note = cpu_to_dump64(s, offset_note); kh->note_size = cpu_to_dump32(s, s->note_size); if (write_buffer(s->fd, DISKDUMP_HEADER_BLOCKS * block_size, kh, size) < 0) { error_setg(errp, "dump: failed to write kdump sub header"); goto out; s->note_buf = g_malloc0(s->note_size); s->note_buf_offset = 0; write_elf32_notes(buf_write_note, s, &local_err); if (local_err) { error_propagate(errp, local_err); goto out; if (write_buffer(s->fd, offset_note, s->note_buf, s->note_size) < 0) { error_setg(errp, "dump: failed to write notes"); goto out; s->offset_dump_bitmap = (DISKDUMP_HEADER_BLOCKS + sub_hdr_size) * block_size; s->offset_page = (DISKDUMP_HEADER_BLOCKS + sub_hdr_size + bitmap_blocks) * block_size; out: g_free(dh); g_free(kh); g_free(s->note_buf);
{ "code": [], "line_no": [] }
static void FUNC_0(DumpState *VAR_0, Error **VAR_1) { DiskDumpHeader32 *dh = NULL; KdumpSubHeader32 *kh = NULL; size_t size; uint32_t block_size; uint32_t sub_hdr_size; uint32_t bitmap_blocks; uint32_t status = 0; uint64_t offset_note; Error *local_err = NULL; size = sizeof(DiskDumpHeader32); dh = g_malloc0(size); strncpy(dh->signature, KDUMP_SIGNATURE, strlen(KDUMP_SIGNATURE)); dh->header_version = cpu_to_dump32(VAR_0, 6); block_size = VAR_0->dump_info.page_size; dh->block_size = cpu_to_dump32(VAR_0, block_size); sub_hdr_size = sizeof(struct KdumpSubHeader32) + VAR_0->note_size; sub_hdr_size = DIV_ROUND_UP(sub_hdr_size, block_size); dh->sub_hdr_size = cpu_to_dump32(VAR_0, sub_hdr_size); dh->max_mapnr = cpu_to_dump32(VAR_0, MIN(VAR_0->max_mapnr, UINT_MAX)); dh->nr_cpus = cpu_to_dump32(VAR_0, VAR_0->nr_cpus); bitmap_blocks = DIV_ROUND_UP(VAR_0->len_dump_bitmap, block_size) * 2; dh->bitmap_blocks = cpu_to_dump32(VAR_0, bitmap_blocks); strncpy(dh->utsname.machine, ELF_MACHINE_UNAME, sizeof(dh->utsname.machine)); if (VAR_0->flag_compress & DUMP_DH_COMPRESSED_ZLIB) { status |= DUMP_DH_COMPRESSED_ZLIB; #ifdef CONFIG_LZO if (VAR_0->flag_compress & DUMP_DH_COMPRESSED_LZO) { status |= DUMP_DH_COMPRESSED_LZO; #endif #ifdef CONFIG_SNAPPY if (VAR_0->flag_compress & DUMP_DH_COMPRESSED_SNAPPY) { status |= DUMP_DH_COMPRESSED_SNAPPY; #endif dh->status = cpu_to_dump32(VAR_0, status); if (write_buffer(VAR_0->fd, 0, dh, size) < 0) { error_setg(VAR_1, "dump: failed to write disk dump header"); goto out; size = sizeof(KdumpSubHeader32); kh = g_malloc0(size); kh->max_mapnr_64 = cpu_to_dump64(VAR_0, VAR_0->max_mapnr); kh->phys_base = cpu_to_dump32(VAR_0, VAR_0->dump_info.phys_base); kh->dump_level = cpu_to_dump32(VAR_0, DUMP_LEVEL); offset_note = DISKDUMP_HEADER_BLOCKS * block_size + size; kh->offset_note = cpu_to_dump64(VAR_0, offset_note); kh->note_size = cpu_to_dump32(VAR_0, VAR_0->note_size); if (write_buffer(VAR_0->fd, DISKDUMP_HEADER_BLOCKS * block_size, kh, size) < 0) { error_setg(VAR_1, "dump: failed to write kdump sub header"); goto out; VAR_0->note_buf = g_malloc0(VAR_0->note_size); VAR_0->note_buf_offset = 0; write_elf32_notes(buf_write_note, VAR_0, &local_err); if (local_err) { error_propagate(VAR_1, local_err); goto out; if (write_buffer(VAR_0->fd, offset_note, VAR_0->note_buf, VAR_0->note_size) < 0) { error_setg(VAR_1, "dump: failed to write notes"); goto out; VAR_0->offset_dump_bitmap = (DISKDUMP_HEADER_BLOCKS + sub_hdr_size) * block_size; VAR_0->offset_page = (DISKDUMP_HEADER_BLOCKS + sub_hdr_size + bitmap_blocks) * block_size; out: g_free(dh); g_free(kh); g_free(VAR_0->note_buf);
[ "static void FUNC_0(DumpState *VAR_0, Error **VAR_1)\n{", "DiskDumpHeader32 *dh = NULL;", "KdumpSubHeader32 *kh = NULL;", "size_t size;", "uint32_t block_size;", "uint32_t sub_hdr_size;", "uint32_t bitmap_blocks;", "uint32_t status = 0;", "uint64_t offset_note;", "Error *local_err = NULL;", "size = sizeof(DiskDumpHeader32);", "dh = g_malloc0(size);", "strncpy(dh->signature, KDUMP_SIGNATURE, strlen(KDUMP_SIGNATURE));", "dh->header_version = cpu_to_dump32(VAR_0, 6);", "block_size = VAR_0->dump_info.page_size;", "dh->block_size = cpu_to_dump32(VAR_0, block_size);", "sub_hdr_size = sizeof(struct KdumpSubHeader32) + VAR_0->note_size;", "sub_hdr_size = DIV_ROUND_UP(sub_hdr_size, block_size);", "dh->sub_hdr_size = cpu_to_dump32(VAR_0, sub_hdr_size);", "dh->max_mapnr = cpu_to_dump32(VAR_0, MIN(VAR_0->max_mapnr, UINT_MAX));", "dh->nr_cpus = cpu_to_dump32(VAR_0, VAR_0->nr_cpus);", "bitmap_blocks = DIV_ROUND_UP(VAR_0->len_dump_bitmap, block_size) * 2;", "dh->bitmap_blocks = cpu_to_dump32(VAR_0, bitmap_blocks);", "strncpy(dh->utsname.machine, ELF_MACHINE_UNAME, sizeof(dh->utsname.machine));", "if (VAR_0->flag_compress & DUMP_DH_COMPRESSED_ZLIB) {", "status |= DUMP_DH_COMPRESSED_ZLIB;", "#ifdef CONFIG_LZO\nif (VAR_0->flag_compress & DUMP_DH_COMPRESSED_LZO) {", "status |= DUMP_DH_COMPRESSED_LZO;", "#endif\n#ifdef CONFIG_SNAPPY\nif (VAR_0->flag_compress & DUMP_DH_COMPRESSED_SNAPPY) {", "status |= DUMP_DH_COMPRESSED_SNAPPY;", "#endif\ndh->status = cpu_to_dump32(VAR_0, status);", "if (write_buffer(VAR_0->fd, 0, dh, size) < 0) {", "error_setg(VAR_1, \"dump: failed to write disk dump header\");", "goto out;", "size = sizeof(KdumpSubHeader32);", "kh = g_malloc0(size);", "kh->max_mapnr_64 = cpu_to_dump64(VAR_0, VAR_0->max_mapnr);", "kh->phys_base = cpu_to_dump32(VAR_0, VAR_0->dump_info.phys_base);", "kh->dump_level = cpu_to_dump32(VAR_0, DUMP_LEVEL);", "offset_note = DISKDUMP_HEADER_BLOCKS * block_size + size;", "kh->offset_note = cpu_to_dump64(VAR_0, offset_note);", "kh->note_size = cpu_to_dump32(VAR_0, VAR_0->note_size);", "if (write_buffer(VAR_0->fd, DISKDUMP_HEADER_BLOCKS *\nblock_size, kh, size) < 0) {", "error_setg(VAR_1, \"dump: failed to write kdump sub header\");", "goto out;", "VAR_0->note_buf = g_malloc0(VAR_0->note_size);", "VAR_0->note_buf_offset = 0;", "write_elf32_notes(buf_write_note, VAR_0, &local_err);", "if (local_err) {", "error_propagate(VAR_1, local_err);", "goto out;", "if (write_buffer(VAR_0->fd, offset_note, VAR_0->note_buf,\nVAR_0->note_size) < 0) {", "error_setg(VAR_1, \"dump: failed to write notes\");", "goto out;", "VAR_0->offset_dump_bitmap = (DISKDUMP_HEADER_BLOCKS + sub_hdr_size) *\nblock_size;", "VAR_0->offset_page = (DISKDUMP_HEADER_BLOCKS + sub_hdr_size + bitmap_blocks) *\nblock_size;", "out:\ng_free(dh);", "g_free(kh);", "g_free(VAR_0->note_buf);" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 13 ], [ 14 ], [ 15 ], [ 16 ], [ 17 ], [ 18 ], [ 19 ], [ 20 ], [ 21 ], [ 23 ], [ 24 ], [ 25 ], [ 26 ], [ 27 ], [ 28 ], [ 29 ], [ 30, 31 ], [ 32 ], [ 33, 34, 35 ], [ 36 ], [ 37, 38 ], [ 39 ], [ 40 ], [ 41 ], [ 43 ], [ 44 ], [ 46 ], [ 47 ], [ 48 ], [ 49 ], [ 50 ], [ 51 ], [ 52, 53 ], [ 54 ], [ 55 ], [ 57 ], [ 58 ], [ 60 ], [ 61 ], [ 62 ], [ 63 ], [ 64, 65 ], [ 66 ], [ 67 ], [ 69, 70 ], [ 72, 73 ], [ 74, 75 ], [ 76 ], [ 77 ] ]
11,191
static void test_qemu_strtoull_invalid(void) { const char *str = " xxxx \t abc"; char f = 'X'; const char *endptr = &f; uint64_t res = 999; int err; err = qemu_strtoull(str, &endptr, 0, &res); g_assert_cmpint(err, ==, 0); g_assert(endptr == str); }
true
qemu
47d4be12c3997343e436c6cca89aefbbbeb70863
static void test_qemu_strtoull_invalid(void) { const char *str = " xxxx \t abc"; char f = 'X'; const char *endptr = &f; uint64_t res = 999; int err; err = qemu_strtoull(str, &endptr, 0, &res); g_assert_cmpint(err, ==, 0); g_assert(endptr == str); }
{ "code": [ " g_assert_cmpint(err, ==, 0);", " g_assert(endptr == str);", " g_assert_cmpint(err, ==, 0);", " g_assert(endptr == str);", " g_assert_cmpint(err, ==, 0);", " g_assert(endptr == str);", " g_assert_cmpint(err, ==, 0);", " g_assert_cmpint(err, ==, 0);", " g_assert(endptr == str);", " g_assert_cmpint(err, ==, 0);", " g_assert(endptr == str);", " g_assert_cmpint(err, ==, 0);", " g_assert(endptr == str);", " g_assert_cmpint(err, ==, 0);", " g_assert_cmpint(err, ==, 0);", " g_assert(endptr == str);", " g_assert_cmpint(err, ==, 0);", " g_assert(endptr == str);", " g_assert_cmpint(err, ==, 0);", " g_assert(endptr == str);", " g_assert_cmpint(err, ==, 0);", " g_assert_cmpint(err, ==, 0);", " g_assert(endptr == str);", " g_assert_cmpint(err, ==, 0);", " g_assert(endptr == str);", " g_assert_cmpint(err, ==, 0);", " g_assert(endptr == str);", " g_assert_cmpint(err, ==, 0);" ], "line_no": [ 21, 23, 21, 23, 21, 23, 21, 21, 23, 21, 23, 21, 23, 21, 21, 23, 21, 23, 21, 23, 21, 21, 23, 21, 23, 21, 23, 21 ] }
static void FUNC_0(void) { const char *VAR_0 = " xxxx \t abc"; char VAR_1 = 'X'; const char *VAR_2 = &VAR_1; uint64_t res = 999; int VAR_3; VAR_3 = qemu_strtoull(VAR_0, &VAR_2, 0, &res); g_assert_cmpint(VAR_3, ==, 0); g_assert(VAR_2 == VAR_0); }
[ "static void FUNC_0(void)\n{", "const char *VAR_0 = \" xxxx \\t abc\";", "char VAR_1 = 'X';", "const char *VAR_2 = &VAR_1;", "uint64_t res = 999;", "int VAR_3;", "VAR_3 = qemu_strtoull(VAR_0, &VAR_2, 0, &res);", "g_assert_cmpint(VAR_3, ==, 0);", "g_assert(VAR_2 == VAR_0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ] ]
11,192
static void scsi_remove_request(SCSIGenericReq *r) { qemu_free(r->buf); scsi_req_free(&r->req); }
true
qemu
ad2d30f79d3b0812f02c741be2189796b788d6d7
static void scsi_remove_request(SCSIGenericReq *r) { qemu_free(r->buf); scsi_req_free(&r->req); }
{ "code": [ " scsi_req_free(&r->req);", "static void scsi_remove_request(SCSIGenericReq *r)", " scsi_req_free(&r->req);" ], "line_no": [ 7, 1, 7 ] }
static void FUNC_0(SCSIGenericReq *VAR_0) { qemu_free(VAR_0->buf); scsi_req_free(&VAR_0->req); }
[ "static void FUNC_0(SCSIGenericReq *VAR_0)\n{", "qemu_free(VAR_0->buf);", "scsi_req_free(&VAR_0->req);", "}" ]
[ 1, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
11,195
static int get_device_guid( char *name, int name_size, char *actual_name, int actual_name_size) { LONG status; HKEY control_net_key; DWORD len; int i = 0; int stop = 0; status = RegOpenKeyEx( HKEY_LOCAL_MACHINE, NETWORK_CONNECTIONS_KEY, 0, KEY_READ, &control_net_key); if (status != ERROR_SUCCESS) { return -1; } while (!stop) { char enum_name[256]; char connection_string[256]; HKEY connection_key; char name_data[256]; DWORD name_type; const char name_string[] = "Name"; len = sizeof (enum_name); status = RegEnumKeyEx( control_net_key, i, enum_name, &len, NULL, NULL, NULL, NULL); if (status == ERROR_NO_MORE_ITEMS) break; else if (status != ERROR_SUCCESS) { return -1; } snprintf(connection_string, sizeof(connection_string), "%s\\%s\\Connection", NETWORK_CONNECTIONS_KEY, enum_name); status = RegOpenKeyEx( HKEY_LOCAL_MACHINE, connection_string, 0, KEY_READ, &connection_key); if (status == ERROR_SUCCESS) { len = sizeof (name_data); status = RegQueryValueEx( connection_key, name_string, NULL, &name_type, (LPBYTE)name_data, &len); if (status != ERROR_SUCCESS || name_type != REG_SZ) { return -1; } else { if (is_tap_win32_dev(enum_name)) { snprintf(name, name_size, "%s", enum_name); if (actual_name) { if (strcmp(actual_name, "") != 0) { if (strcmp(name_data, actual_name) != 0) { RegCloseKey (connection_key); ++i; continue; } } else { snprintf(actual_name, actual_name_size, "%s", name_data); } } stop = 1; } } RegCloseKey (connection_key); } ++i; } RegCloseKey (control_net_key); if (stop == 0) return -1; return 0; }
true
qemu
ee0428e3acd237e4d555cc54134cea473cab5ee7
static int get_device_guid( char *name, int name_size, char *actual_name, int actual_name_size) { LONG status; HKEY control_net_key; DWORD len; int i = 0; int stop = 0; status = RegOpenKeyEx( HKEY_LOCAL_MACHINE, NETWORK_CONNECTIONS_KEY, 0, KEY_READ, &control_net_key); if (status != ERROR_SUCCESS) { return -1; } while (!stop) { char enum_name[256]; char connection_string[256]; HKEY connection_key; char name_data[256]; DWORD name_type; const char name_string[] = "Name"; len = sizeof (enum_name); status = RegEnumKeyEx( control_net_key, i, enum_name, &len, NULL, NULL, NULL, NULL); if (status == ERROR_NO_MORE_ITEMS) break; else if (status != ERROR_SUCCESS) { return -1; } snprintf(connection_string, sizeof(connection_string), "%s\\%s\\Connection", NETWORK_CONNECTIONS_KEY, enum_name); status = RegOpenKeyEx( HKEY_LOCAL_MACHINE, connection_string, 0, KEY_READ, &connection_key); if (status == ERROR_SUCCESS) { len = sizeof (name_data); status = RegQueryValueEx( connection_key, name_string, NULL, &name_type, (LPBYTE)name_data, &len); if (status != ERROR_SUCCESS || name_type != REG_SZ) { return -1; } else { if (is_tap_win32_dev(enum_name)) { snprintf(name, name_size, "%s", enum_name); if (actual_name) { if (strcmp(actual_name, "") != 0) { if (strcmp(name_data, actual_name) != 0) { RegCloseKey (connection_key); ++i; continue; } } else { snprintf(actual_name, actual_name_size, "%s", name_data); } } stop = 1; } } RegCloseKey (connection_key); } ++i; } RegCloseKey (control_net_key); if (stop == 0) return -1; return 0; }
{ "code": [ " return -1;" ], "line_no": [ 145 ] }
static int FUNC_0( char *VAR_0, int VAR_1, char *VAR_2, int VAR_3) { LONG status; HKEY control_net_key; DWORD len; int VAR_4 = 0; int VAR_5 = 0; status = RegOpenKeyEx( HKEY_LOCAL_MACHINE, NETWORK_CONNECTIONS_KEY, 0, KEY_READ, &control_net_key); if (status != ERROR_SUCCESS) { return -1; } while (!VAR_5) { char VAR_6[256]; char VAR_7[256]; HKEY connection_key; char VAR_8[256]; DWORD name_type; const char VAR_9[] = "Name"; len = sizeof (VAR_6); status = RegEnumKeyEx( control_net_key, VAR_4, VAR_6, &len, NULL, NULL, NULL, NULL); if (status == ERROR_NO_MORE_ITEMS) break; else if (status != ERROR_SUCCESS) { return -1; } snprintf(VAR_7, sizeof(VAR_7), "%s\\%s\\Connection", NETWORK_CONNECTIONS_KEY, VAR_6); status = RegOpenKeyEx( HKEY_LOCAL_MACHINE, VAR_7, 0, KEY_READ, &connection_key); if (status == ERROR_SUCCESS) { len = sizeof (VAR_8); status = RegQueryValueEx( connection_key, VAR_9, NULL, &name_type, (LPBYTE)VAR_8, &len); if (status != ERROR_SUCCESS || name_type != REG_SZ) { return -1; } else { if (is_tap_win32_dev(VAR_6)) { snprintf(VAR_0, VAR_1, "%s", VAR_6); if (VAR_2) { if (strcmp(VAR_2, "") != 0) { if (strcmp(VAR_8, VAR_2) != 0) { RegCloseKey (connection_key); ++VAR_4; continue; } } else { snprintf(VAR_2, VAR_3, "%s", VAR_8); } } VAR_5 = 1; } } RegCloseKey (connection_key); } ++VAR_4; } RegCloseKey (control_net_key); if (VAR_5 == 0) return -1; return 0; }
[ "static int FUNC_0(\nchar *VAR_0,\nint VAR_1,\nchar *VAR_2,\nint VAR_3)\n{", "LONG status;", "HKEY control_net_key;", "DWORD len;", "int VAR_4 = 0;", "int VAR_5 = 0;", "status = RegOpenKeyEx(\nHKEY_LOCAL_MACHINE,\nNETWORK_CONNECTIONS_KEY,\n0,\nKEY_READ,\n&control_net_key);", "if (status != ERROR_SUCCESS) {", "return -1;", "}", "while (!VAR_5)\n{", "char VAR_6[256];", "char VAR_7[256];", "HKEY connection_key;", "char VAR_8[256];", "DWORD name_type;", "const char VAR_9[] = \"Name\";", "len = sizeof (VAR_6);", "status = RegEnumKeyEx(\ncontrol_net_key,\nVAR_4,\nVAR_6,\n&len,\nNULL,\nNULL,\nNULL,\nNULL);", "if (status == ERROR_NO_MORE_ITEMS)\nbreak;", "else if (status != ERROR_SUCCESS) {", "return -1;", "}", "snprintf(VAR_7,\nsizeof(VAR_7),\n\"%s\\\\%s\\\\Connection\",\nNETWORK_CONNECTIONS_KEY, VAR_6);", "status = RegOpenKeyEx(\nHKEY_LOCAL_MACHINE,\nVAR_7,\n0,\nKEY_READ,\n&connection_key);", "if (status == ERROR_SUCCESS) {", "len = sizeof (VAR_8);", "status = RegQueryValueEx(\nconnection_key,\nVAR_9,\nNULL,\n&name_type,\n(LPBYTE)VAR_8,\n&len);", "if (status != ERROR_SUCCESS || name_type != REG_SZ) {", "return -1;", "}", "else {", "if (is_tap_win32_dev(VAR_6)) {", "snprintf(VAR_0, VAR_1, \"%s\", VAR_6);", "if (VAR_2) {", "if (strcmp(VAR_2, \"\") != 0) {", "if (strcmp(VAR_8, VAR_2) != 0) {", "RegCloseKey (connection_key);", "++VAR_4;", "continue;", "}", "}", "else {", "snprintf(VAR_2, VAR_3, \"%s\", VAR_8);", "}", "}", "VAR_5 = 1;", "}", "}", "RegCloseKey (connection_key);", "}", "++VAR_4;", "}", "RegCloseKey (control_net_key);", "if (VAR_5 == 0)\nreturn -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, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25, 27, 29, 31, 33, 35 ], [ 39 ], [ 41 ], [ 43 ], [ 47, 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67, 69, 71, 73, 75, 77, 79, 81, 83 ], [ 87, 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99, 101, 103, 105 ], [ 109, 111, 113, 115, 117, 119 ], [ 123 ], [ 125 ], [ 127, 129, 131, 133, 135, 137, 139 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 197 ], [ 201, 203 ], [ 207 ], [ 209 ] ]
11,196
static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream, AVFormatContext *fmt_ctx) { AVBPrint pbuf; char val_str[128]; const char *s; int i; av_bprint_init(&pbuf, 1, AV_BPRINT_SIZE_UNLIMITED); writer_print_section_header(w, SECTION_ID_FRAME); s = av_get_media_type_string(stream->codecpar->codec_type); if (s) print_str ("media_type", s); else print_str_opt("media_type", "unknown"); print_int("stream_index", stream->index); print_int("key_frame", frame->key_frame); print_ts ("pkt_pts", frame->pts); print_time("pkt_pts_time", frame->pts, &stream->time_base); print_ts ("pkt_dts", frame->pkt_dts); print_time("pkt_dts_time", frame->pkt_dts, &stream->time_base); print_ts ("best_effort_timestamp", frame->best_effort_timestamp); print_time("best_effort_timestamp_time", frame->best_effort_timestamp, &stream->time_base); print_duration_ts ("pkt_duration", frame->pkt_duration); print_duration_time("pkt_duration_time", frame->pkt_duration, &stream->time_base); if (frame->pkt_pos != -1) print_fmt ("pkt_pos", "%"PRId64, frame->pkt_pos); else print_str_opt("pkt_pos", "N/A"); if (frame->pkt_size != -1) print_val ("pkt_size", frame->pkt_size, unit_byte_str); else print_str_opt("pkt_size", "N/A"); switch (stream->codecpar->codec_type) { AVRational sar; case AVMEDIA_TYPE_VIDEO: print_int("width", frame->width); print_int("height", frame->height); s = av_get_pix_fmt_name(frame->format); if (s) print_str ("pix_fmt", s); else print_str_opt("pix_fmt", "unknown"); sar = av_guess_sample_aspect_ratio(fmt_ctx, stream, frame); if (sar.num) { print_q("sample_aspect_ratio", sar, ':'); } else { print_str_opt("sample_aspect_ratio", "N/A"); } print_fmt("pict_type", "%c", av_get_picture_type_char(frame->pict_type)); print_int("coded_picture_number", frame->coded_picture_number); print_int("display_picture_number", frame->display_picture_number); print_int("interlaced_frame", frame->interlaced_frame); print_int("top_field_first", frame->top_field_first); print_int("repeat_pict", frame->repeat_pict); if (frame->color_range != AVCOL_RANGE_UNSPECIFIED) print_str("color_range", av_color_range_name(frame->color_range)); else print_str_opt("color_range", av_color_range_name(frame->color_range)); if (frame->colorspace != AVCOL_SPC_UNSPECIFIED) print_str("color_space", av_color_space_name(frame->colorspace)); else print_str_opt("color_space", av_color_space_name(frame->colorspace)); if (frame->color_primaries != AVCOL_PRI_UNSPECIFIED) print_str("color_primaries", av_color_primaries_name(frame->color_primaries)); else print_str_opt("color_primaries", av_color_primaries_name(frame->color_primaries)); if (frame->color_trc != AVCOL_TRC_UNSPECIFIED) print_str("color_transfer", av_color_transfer_name(frame->color_trc)); else print_str_opt("color_transfer", av_color_transfer_name(frame->color_trc)); if (frame->chroma_location != AVCHROMA_LOC_UNSPECIFIED) print_str("chroma_location", av_chroma_location_name(frame->chroma_location)); else print_str_opt("chroma_location", av_chroma_location_name(frame->chroma_location)); break; case AVMEDIA_TYPE_AUDIO: s = av_get_sample_fmt_name(frame->format); if (s) print_str ("sample_fmt", s); else print_str_opt("sample_fmt", "unknown"); print_int("nb_samples", frame->nb_samples); print_int("channels", frame->channels); if (frame->channel_layout) { av_bprint_clear(&pbuf); av_bprint_channel_layout(&pbuf, frame->channels, frame->channel_layout); print_str ("channel_layout", pbuf.str); } else print_str_opt("channel_layout", "unknown"); break; } if (do_show_frame_tags) show_tags(w, frame->metadata, SECTION_ID_FRAME_TAGS); if (do_show_log) show_log(w, SECTION_ID_FRAME_LOGS, SECTION_ID_FRAME_LOG, do_show_log); if (frame->nb_side_data) { writer_print_section_header(w, SECTION_ID_FRAME_SIDE_DATA_LIST); for (i = 0; i < frame->nb_side_data; i++) { AVFrameSideData *sd = frame->side_data[i]; const char *name; writer_print_section_header(w, SECTION_ID_FRAME_SIDE_DATA); name = av_frame_side_data_name(sd->type); print_str("side_data_type", name ? name : "unknown"); if (sd->type == AV_FRAME_DATA_DISPLAYMATRIX && sd->size >= 9*4) { writer_print_integers(w, "displaymatrix", sd->data, 9, " %11d", 3, 4, 1); print_int("rotation", av_display_rotation_get((int32_t *)sd->data)); } else if (sd->type == AV_FRAME_DATA_GOP_TIMECODE && sd->size >= 8) { char tcbuf[AV_TIMECODE_STR_SIZE]; av_timecode_make_mpeg_tc_string(tcbuf, *(int64_t *)(sd->data)); print_str("timecode", tcbuf); } else if (sd->type == AV_FRAME_DATA_MASTERING_DISPLAY_METADATA) { AVMasteringDisplayMetadata *metadata = (AVMasteringDisplayMetadata *)sd->data; if (metadata->has_primaries) { print_q("red_x", metadata->display_primaries[0][0], '/'); print_q("red_y", metadata->display_primaries[0][1], '/'); print_q("green_x", metadata->display_primaries[1][0], '/'); print_q("green_y", metadata->display_primaries[1][1], '/'); print_q("blue_x", metadata->display_primaries[2][0], '/'); print_q("blue_y", metadata->display_primaries[2][1], '/'); print_q("white_point_x", metadata->white_point[0], '/'); print_q("white_point_y", metadata->white_point[1], '/'); } if (metadata->has_luminance) { print_q("min_luminance", metadata->min_luminance, '/'); print_q("max_luminance", metadata->max_luminance, '/'); } } else if (sd->type == AV_FRAME_DATA_CONTENT_LIGHT_LEVEL) { AVContentLightMetadata *metadata = (AVContentLightMetadata *)sd->data; print_int("max_content", metadata->MaxCLL); print_int("max_average", metadata->MaxFALL); } else if (sd->type == AV_FRAME_DATA_ICC_PROFILE) { AVDictionaryEntry *tag = av_dict_get(sd->metadata, "name", NULL, AV_DICT_MATCH_CASE); if (tag) print_str(tag->key, tag->value); print_int("size", sd->size); } writer_print_section_footer(w); } writer_print_section_footer(w); } writer_print_section_footer(w); av_bprint_finalize(&pbuf, NULL); fflush(stdout); }
true
FFmpeg
837cb4325b712ff1aab531bf41668933f61d75d2
static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream, AVFormatContext *fmt_ctx) { AVBPrint pbuf; char val_str[128]; const char *s; int i; av_bprint_init(&pbuf, 1, AV_BPRINT_SIZE_UNLIMITED); writer_print_section_header(w, SECTION_ID_FRAME); s = av_get_media_type_string(stream->codecpar->codec_type); if (s) print_str ("media_type", s); else print_str_opt("media_type", "unknown"); print_int("stream_index", stream->index); print_int("key_frame", frame->key_frame); print_ts ("pkt_pts", frame->pts); print_time("pkt_pts_time", frame->pts, &stream->time_base); print_ts ("pkt_dts", frame->pkt_dts); print_time("pkt_dts_time", frame->pkt_dts, &stream->time_base); print_ts ("best_effort_timestamp", frame->best_effort_timestamp); print_time("best_effort_timestamp_time", frame->best_effort_timestamp, &stream->time_base); print_duration_ts ("pkt_duration", frame->pkt_duration); print_duration_time("pkt_duration_time", frame->pkt_duration, &stream->time_base); if (frame->pkt_pos != -1) print_fmt ("pkt_pos", "%"PRId64, frame->pkt_pos); else print_str_opt("pkt_pos", "N/A"); if (frame->pkt_size != -1) print_val ("pkt_size", frame->pkt_size, unit_byte_str); else print_str_opt("pkt_size", "N/A"); switch (stream->codecpar->codec_type) { AVRational sar; case AVMEDIA_TYPE_VIDEO: print_int("width", frame->width); print_int("height", frame->height); s = av_get_pix_fmt_name(frame->format); if (s) print_str ("pix_fmt", s); else print_str_opt("pix_fmt", "unknown"); sar = av_guess_sample_aspect_ratio(fmt_ctx, stream, frame); if (sar.num) { print_q("sample_aspect_ratio", sar, ':'); } else { print_str_opt("sample_aspect_ratio", "N/A"); } print_fmt("pict_type", "%c", av_get_picture_type_char(frame->pict_type)); print_int("coded_picture_number", frame->coded_picture_number); print_int("display_picture_number", frame->display_picture_number); print_int("interlaced_frame", frame->interlaced_frame); print_int("top_field_first", frame->top_field_first); print_int("repeat_pict", frame->repeat_pict); if (frame->color_range != AVCOL_RANGE_UNSPECIFIED) print_str("color_range", av_color_range_name(frame->color_range)); else print_str_opt("color_range", av_color_range_name(frame->color_range)); if (frame->colorspace != AVCOL_SPC_UNSPECIFIED) print_str("color_space", av_color_space_name(frame->colorspace)); else print_str_opt("color_space", av_color_space_name(frame->colorspace)); if (frame->color_primaries != AVCOL_PRI_UNSPECIFIED) print_str("color_primaries", av_color_primaries_name(frame->color_primaries)); else print_str_opt("color_primaries", av_color_primaries_name(frame->color_primaries)); if (frame->color_trc != AVCOL_TRC_UNSPECIFIED) print_str("color_transfer", av_color_transfer_name(frame->color_trc)); else print_str_opt("color_transfer", av_color_transfer_name(frame->color_trc)); if (frame->chroma_location != AVCHROMA_LOC_UNSPECIFIED) print_str("chroma_location", av_chroma_location_name(frame->chroma_location)); else print_str_opt("chroma_location", av_chroma_location_name(frame->chroma_location)); break; case AVMEDIA_TYPE_AUDIO: s = av_get_sample_fmt_name(frame->format); if (s) print_str ("sample_fmt", s); else print_str_opt("sample_fmt", "unknown"); print_int("nb_samples", frame->nb_samples); print_int("channels", frame->channels); if (frame->channel_layout) { av_bprint_clear(&pbuf); av_bprint_channel_layout(&pbuf, frame->channels, frame->channel_layout); print_str ("channel_layout", pbuf.str); } else print_str_opt("channel_layout", "unknown"); break; } if (do_show_frame_tags) show_tags(w, frame->metadata, SECTION_ID_FRAME_TAGS); if (do_show_log) show_log(w, SECTION_ID_FRAME_LOGS, SECTION_ID_FRAME_LOG, do_show_log); if (frame->nb_side_data) { writer_print_section_header(w, SECTION_ID_FRAME_SIDE_DATA_LIST); for (i = 0; i < frame->nb_side_data; i++) { AVFrameSideData *sd = frame->side_data[i]; const char *name; writer_print_section_header(w, SECTION_ID_FRAME_SIDE_DATA); name = av_frame_side_data_name(sd->type); print_str("side_data_type", name ? name : "unknown"); if (sd->type == AV_FRAME_DATA_DISPLAYMATRIX && sd->size >= 9*4) { writer_print_integers(w, "displaymatrix", sd->data, 9, " %11d", 3, 4, 1); print_int("rotation", av_display_rotation_get((int32_t *)sd->data)); } else if (sd->type == AV_FRAME_DATA_GOP_TIMECODE && sd->size >= 8) { char tcbuf[AV_TIMECODE_STR_SIZE]; av_timecode_make_mpeg_tc_string(tcbuf, *(int64_t *)(sd->data)); print_str("timecode", tcbuf); } else if (sd->type == AV_FRAME_DATA_MASTERING_DISPLAY_METADATA) { AVMasteringDisplayMetadata *metadata = (AVMasteringDisplayMetadata *)sd->data; if (metadata->has_primaries) { print_q("red_x", metadata->display_primaries[0][0], '/'); print_q("red_y", metadata->display_primaries[0][1], '/'); print_q("green_x", metadata->display_primaries[1][0], '/'); print_q("green_y", metadata->display_primaries[1][1], '/'); print_q("blue_x", metadata->display_primaries[2][0], '/'); print_q("blue_y", metadata->display_primaries[2][1], '/'); print_q("white_point_x", metadata->white_point[0], '/'); print_q("white_point_y", metadata->white_point[1], '/'); } if (metadata->has_luminance) { print_q("min_luminance", metadata->min_luminance, '/'); print_q("max_luminance", metadata->max_luminance, '/'); } } else if (sd->type == AV_FRAME_DATA_CONTENT_LIGHT_LEVEL) { AVContentLightMetadata *metadata = (AVContentLightMetadata *)sd->data; print_int("max_content", metadata->MaxCLL); print_int("max_average", metadata->MaxFALL); } else if (sd->type == AV_FRAME_DATA_ICC_PROFILE) { AVDictionaryEntry *tag = av_dict_get(sd->metadata, "name", NULL, AV_DICT_MATCH_CASE); if (tag) print_str(tag->key, tag->value); print_int("size", sd->size); } writer_print_section_footer(w); } writer_print_section_footer(w); } writer_print_section_footer(w); av_bprint_finalize(&pbuf, NULL); fflush(stdout); }
{ "code": [ " if (frame->color_primaries != AVCOL_PRI_UNSPECIFIED)", " print_str(\"color_primaries\", av_color_primaries_name(frame->color_primaries));", " print_str_opt(\"color_primaries\", av_color_primaries_name(frame->color_primaries));" ], "line_no": [ 125, 127, 131 ] }
static void FUNC_0(WriterContext *VAR_0, AVFrame *VAR_1, AVStream *VAR_2, AVFormatContext *VAR_3) { AVBPrint pbuf; char VAR_4[128]; const char *VAR_5; int VAR_6; av_bprint_init(&pbuf, 1, AV_BPRINT_SIZE_UNLIMITED); writer_print_section_header(VAR_0, SECTION_ID_FRAME); VAR_5 = av_get_media_type_string(VAR_2->codecpar->codec_type); if (VAR_5) print_str ("media_type", VAR_5); else print_str_opt("media_type", "unknown"); print_int("stream_index", VAR_2->index); print_int("key_frame", VAR_1->key_frame); print_ts ("pkt_pts", VAR_1->pts); print_time("pkt_pts_time", VAR_1->pts, &VAR_2->time_base); print_ts ("pkt_dts", VAR_1->pkt_dts); print_time("pkt_dts_time", VAR_1->pkt_dts, &VAR_2->time_base); print_ts ("best_effort_timestamp", VAR_1->best_effort_timestamp); print_time("best_effort_timestamp_time", VAR_1->best_effort_timestamp, &VAR_2->time_base); print_duration_ts ("pkt_duration", VAR_1->pkt_duration); print_duration_time("pkt_duration_time", VAR_1->pkt_duration, &VAR_2->time_base); if (VAR_1->pkt_pos != -1) print_fmt ("pkt_pos", "%"PRId64, VAR_1->pkt_pos); else print_str_opt("pkt_pos", "N/A"); if (VAR_1->pkt_size != -1) print_val ("pkt_size", VAR_1->pkt_size, unit_byte_str); else print_str_opt("pkt_size", "N/A"); switch (VAR_2->codecpar->codec_type) { AVRational sar; case AVMEDIA_TYPE_VIDEO: print_int("width", VAR_1->width); print_int("height", VAR_1->height); VAR_5 = av_get_pix_fmt_name(VAR_1->format); if (VAR_5) print_str ("pix_fmt", VAR_5); else print_str_opt("pix_fmt", "unknown"); sar = av_guess_sample_aspect_ratio(VAR_3, VAR_2, VAR_1); if (sar.num) { print_q("sample_aspect_ratio", sar, ':'); } else { print_str_opt("sample_aspect_ratio", "N/A"); } print_fmt("pict_type", "%c", av_get_picture_type_char(VAR_1->pict_type)); print_int("coded_picture_number", VAR_1->coded_picture_number); print_int("display_picture_number", VAR_1->display_picture_number); print_int("interlaced_frame", VAR_1->interlaced_frame); print_int("top_field_first", VAR_1->top_field_first); print_int("repeat_pict", VAR_1->repeat_pict); if (VAR_1->color_range != AVCOL_RANGE_UNSPECIFIED) print_str("color_range", av_color_range_name(VAR_1->color_range)); else print_str_opt("color_range", av_color_range_name(VAR_1->color_range)); if (VAR_1->colorspace != AVCOL_SPC_UNSPECIFIED) print_str("color_space", av_color_space_name(VAR_1->colorspace)); else print_str_opt("color_space", av_color_space_name(VAR_1->colorspace)); if (VAR_1->color_primaries != AVCOL_PRI_UNSPECIFIED) print_str("color_primaries", av_color_primaries_name(VAR_1->color_primaries)); else print_str_opt("color_primaries", av_color_primaries_name(VAR_1->color_primaries)); if (VAR_1->color_trc != AVCOL_TRC_UNSPECIFIED) print_str("color_transfer", av_color_transfer_name(VAR_1->color_trc)); else print_str_opt("color_transfer", av_color_transfer_name(VAR_1->color_trc)); if (VAR_1->chroma_location != AVCHROMA_LOC_UNSPECIFIED) print_str("chroma_location", av_chroma_location_name(VAR_1->chroma_location)); else print_str_opt("chroma_location", av_chroma_location_name(VAR_1->chroma_location)); break; case AVMEDIA_TYPE_AUDIO: VAR_5 = av_get_sample_fmt_name(VAR_1->format); if (VAR_5) print_str ("sample_fmt", VAR_5); else print_str_opt("sample_fmt", "unknown"); print_int("nb_samples", VAR_1->nb_samples); print_int("channels", VAR_1->channels); if (VAR_1->channel_layout) { av_bprint_clear(&pbuf); av_bprint_channel_layout(&pbuf, VAR_1->channels, VAR_1->channel_layout); print_str ("channel_layout", pbuf.str); } else print_str_opt("channel_layout", "unknown"); break; } if (do_show_frame_tags) show_tags(VAR_0, VAR_1->metadata, SECTION_ID_FRAME_TAGS); if (do_show_log) show_log(VAR_0, SECTION_ID_FRAME_LOGS, SECTION_ID_FRAME_LOG, do_show_log); if (VAR_1->nb_side_data) { writer_print_section_header(VAR_0, SECTION_ID_FRAME_SIDE_DATA_LIST); for (VAR_6 = 0; VAR_6 < VAR_1->nb_side_data; VAR_6++) { AVFrameSideData *sd = VAR_1->side_data[VAR_6]; const char *name; writer_print_section_header(VAR_0, SECTION_ID_FRAME_SIDE_DATA); name = av_frame_side_data_name(sd->type); print_str("side_data_type", name ? name : "unknown"); if (sd->type == AV_FRAME_DATA_DISPLAYMATRIX && sd->size >= 9*4) { writer_print_integers(VAR_0, "displaymatrix", sd->data, 9, " %11d", 3, 4, 1); print_int("rotation", av_display_rotation_get((int32_t *)sd->data)); } else if (sd->type == AV_FRAME_DATA_GOP_TIMECODE && sd->size >= 8) { char tcbuf[AV_TIMECODE_STR_SIZE]; av_timecode_make_mpeg_tc_string(tcbuf, *(int64_t *)(sd->data)); print_str("timecode", tcbuf); } else if (sd->type == AV_FRAME_DATA_MASTERING_DISPLAY_METADATA) { AVMasteringDisplayMetadata *metadata = (AVMasteringDisplayMetadata *)sd->data; if (metadata->has_primaries) { print_q("red_x", metadata->display_primaries[0][0], '/'); print_q("red_y", metadata->display_primaries[0][1], '/'); print_q("green_x", metadata->display_primaries[1][0], '/'); print_q("green_y", metadata->display_primaries[1][1], '/'); print_q("blue_x", metadata->display_primaries[2][0], '/'); print_q("blue_y", metadata->display_primaries[2][1], '/'); print_q("white_point_x", metadata->white_point[0], '/'); print_q("white_point_y", metadata->white_point[1], '/'); } if (metadata->has_luminance) { print_q("min_luminance", metadata->min_luminance, '/'); print_q("max_luminance", metadata->max_luminance, '/'); } } else if (sd->type == AV_FRAME_DATA_CONTENT_LIGHT_LEVEL) { AVContentLightMetadata *metadata = (AVContentLightMetadata *)sd->data; print_int("max_content", metadata->MaxCLL); print_int("max_average", metadata->MaxFALL); } else if (sd->type == AV_FRAME_DATA_ICC_PROFILE) { AVDictionaryEntry *tag = av_dict_get(sd->metadata, "name", NULL, AV_DICT_MATCH_CASE); if (tag) print_str(tag->key, tag->value); print_int("size", sd->size); } writer_print_section_footer(VAR_0); } writer_print_section_footer(VAR_0); } writer_print_section_footer(VAR_0); av_bprint_finalize(&pbuf, NULL); fflush(stdout); }
[ "static void FUNC_0(WriterContext *VAR_0, AVFrame *VAR_1, AVStream *VAR_2,\nAVFormatContext *VAR_3)\n{", "AVBPrint pbuf;", "char VAR_4[128];", "const char *VAR_5;", "int VAR_6;", "av_bprint_init(&pbuf, 1, AV_BPRINT_SIZE_UNLIMITED);", "writer_print_section_header(VAR_0, SECTION_ID_FRAME);", "VAR_5 = av_get_media_type_string(VAR_2->codecpar->codec_type);", "if (VAR_5) print_str (\"media_type\", VAR_5);", "else print_str_opt(\"media_type\", \"unknown\");", "print_int(\"stream_index\", VAR_2->index);", "print_int(\"key_frame\", VAR_1->key_frame);", "print_ts (\"pkt_pts\", VAR_1->pts);", "print_time(\"pkt_pts_time\", VAR_1->pts, &VAR_2->time_base);", "print_ts (\"pkt_dts\", VAR_1->pkt_dts);", "print_time(\"pkt_dts_time\", VAR_1->pkt_dts, &VAR_2->time_base);", "print_ts (\"best_effort_timestamp\", VAR_1->best_effort_timestamp);", "print_time(\"best_effort_timestamp_time\", VAR_1->best_effort_timestamp, &VAR_2->time_base);", "print_duration_ts (\"pkt_duration\", VAR_1->pkt_duration);", "print_duration_time(\"pkt_duration_time\", VAR_1->pkt_duration, &VAR_2->time_base);", "if (VAR_1->pkt_pos != -1) print_fmt (\"pkt_pos\", \"%\"PRId64, VAR_1->pkt_pos);", "else print_str_opt(\"pkt_pos\", \"N/A\");", "if (VAR_1->pkt_size != -1) print_val (\"pkt_size\", VAR_1->pkt_size, unit_byte_str);", "else print_str_opt(\"pkt_size\", \"N/A\");", "switch (VAR_2->codecpar->codec_type) {", "AVRational sar;", "case AVMEDIA_TYPE_VIDEO:\nprint_int(\"width\", VAR_1->width);", "print_int(\"height\", VAR_1->height);", "VAR_5 = av_get_pix_fmt_name(VAR_1->format);", "if (VAR_5) print_str (\"pix_fmt\", VAR_5);", "else print_str_opt(\"pix_fmt\", \"unknown\");", "sar = av_guess_sample_aspect_ratio(VAR_3, VAR_2, VAR_1);", "if (sar.num) {", "print_q(\"sample_aspect_ratio\", sar, ':');", "} else {", "print_str_opt(\"sample_aspect_ratio\", \"N/A\");", "}", "print_fmt(\"pict_type\", \"%c\", av_get_picture_type_char(VAR_1->pict_type));", "print_int(\"coded_picture_number\", VAR_1->coded_picture_number);", "print_int(\"display_picture_number\", VAR_1->display_picture_number);", "print_int(\"interlaced_frame\", VAR_1->interlaced_frame);", "print_int(\"top_field_first\", VAR_1->top_field_first);", "print_int(\"repeat_pict\", VAR_1->repeat_pict);", "if (VAR_1->color_range != AVCOL_RANGE_UNSPECIFIED)\nprint_str(\"color_range\", av_color_range_name(VAR_1->color_range));", "else\nprint_str_opt(\"color_range\", av_color_range_name(VAR_1->color_range));", "if (VAR_1->colorspace != AVCOL_SPC_UNSPECIFIED)\nprint_str(\"color_space\", av_color_space_name(VAR_1->colorspace));", "else\nprint_str_opt(\"color_space\", av_color_space_name(VAR_1->colorspace));", "if (VAR_1->color_primaries != AVCOL_PRI_UNSPECIFIED)\nprint_str(\"color_primaries\", av_color_primaries_name(VAR_1->color_primaries));", "else\nprint_str_opt(\"color_primaries\", av_color_primaries_name(VAR_1->color_primaries));", "if (VAR_1->color_trc != AVCOL_TRC_UNSPECIFIED)\nprint_str(\"color_transfer\", av_color_transfer_name(VAR_1->color_trc));", "else\nprint_str_opt(\"color_transfer\", av_color_transfer_name(VAR_1->color_trc));", "if (VAR_1->chroma_location != AVCHROMA_LOC_UNSPECIFIED)\nprint_str(\"chroma_location\", av_chroma_location_name(VAR_1->chroma_location));", "else\nprint_str_opt(\"chroma_location\", av_chroma_location_name(VAR_1->chroma_location));", "break;", "case AVMEDIA_TYPE_AUDIO:\nVAR_5 = av_get_sample_fmt_name(VAR_1->format);", "if (VAR_5) print_str (\"sample_fmt\", VAR_5);", "else print_str_opt(\"sample_fmt\", \"unknown\");", "print_int(\"nb_samples\", VAR_1->nb_samples);", "print_int(\"channels\", VAR_1->channels);", "if (VAR_1->channel_layout) {", "av_bprint_clear(&pbuf);", "av_bprint_channel_layout(&pbuf, VAR_1->channels,\nVAR_1->channel_layout);", "print_str (\"channel_layout\", pbuf.str);", "} else", "print_str_opt(\"channel_layout\", \"unknown\");", "break;", "}", "if (do_show_frame_tags)\nshow_tags(VAR_0, VAR_1->metadata, SECTION_ID_FRAME_TAGS);", "if (do_show_log)\nshow_log(VAR_0, SECTION_ID_FRAME_LOGS, SECTION_ID_FRAME_LOG, do_show_log);", "if (VAR_1->nb_side_data) {", "writer_print_section_header(VAR_0, SECTION_ID_FRAME_SIDE_DATA_LIST);", "for (VAR_6 = 0; VAR_6 < VAR_1->nb_side_data; VAR_6++) {", "AVFrameSideData *sd = VAR_1->side_data[VAR_6];", "const char *name;", "writer_print_section_header(VAR_0, SECTION_ID_FRAME_SIDE_DATA);", "name = av_frame_side_data_name(sd->type);", "print_str(\"side_data_type\", name ? name : \"unknown\");", "if (sd->type == AV_FRAME_DATA_DISPLAYMATRIX && sd->size >= 9*4) {", "writer_print_integers(VAR_0, \"displaymatrix\", sd->data, 9, \" %11d\", 3, 4, 1);", "print_int(\"rotation\", av_display_rotation_get((int32_t *)sd->data));", "} else if (sd->type == AV_FRAME_DATA_GOP_TIMECODE && sd->size >= 8) {", "char tcbuf[AV_TIMECODE_STR_SIZE];", "av_timecode_make_mpeg_tc_string(tcbuf, *(int64_t *)(sd->data));", "print_str(\"timecode\", tcbuf);", "} else if (sd->type == AV_FRAME_DATA_MASTERING_DISPLAY_METADATA) {", "AVMasteringDisplayMetadata *metadata = (AVMasteringDisplayMetadata *)sd->data;", "if (metadata->has_primaries) {", "print_q(\"red_x\", metadata->display_primaries[0][0], '/');", "print_q(\"red_y\", metadata->display_primaries[0][1], '/');", "print_q(\"green_x\", metadata->display_primaries[1][0], '/');", "print_q(\"green_y\", metadata->display_primaries[1][1], '/');", "print_q(\"blue_x\", metadata->display_primaries[2][0], '/');", "print_q(\"blue_y\", metadata->display_primaries[2][1], '/');", "print_q(\"white_point_x\", metadata->white_point[0], '/');", "print_q(\"white_point_y\", metadata->white_point[1], '/');", "}", "if (metadata->has_luminance) {", "print_q(\"min_luminance\", metadata->min_luminance, '/');", "print_q(\"max_luminance\", metadata->max_luminance, '/');", "}", "} else if (sd->type == AV_FRAME_DATA_CONTENT_LIGHT_LEVEL) {", "AVContentLightMetadata *metadata = (AVContentLightMetadata *)sd->data;", "print_int(\"max_content\", metadata->MaxCLL);", "print_int(\"max_average\", metadata->MaxFALL);", "} else if (sd->type == AV_FRAME_DATA_ICC_PROFILE) {", "AVDictionaryEntry *tag = av_dict_get(sd->metadata, \"name\", NULL, AV_DICT_MATCH_CASE);", "if (tag)\nprint_str(tag->key, tag->value);", "print_int(\"size\", sd->size);", "}", "writer_print_section_footer(VAR_0);", "}", "writer_print_section_footer(VAR_0);", "}", "writer_print_section_footer(VAR_0);", "av_bprint_finalize(&pbuf, NULL);", "fflush(stdout);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 67, 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 105, 107 ], [ 109, 111 ], [ 115, 117 ], [ 119, 121 ], [ 125, 127 ], [ 129, 131 ], [ 135, 137 ], [ 139, 141 ], [ 145, 147 ], [ 149, 151 ], [ 153 ], [ 157, 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173, 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187, 189 ], [ 191, 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 249 ], [ 251 ], [ 253 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277, 279 ], [ 281 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ], [ 291 ], [ 295 ], [ 299 ], [ 301 ], [ 303 ] ]
11,198
void ff_xface_generate_face(uint8_t *dst, uint8_t * const src) { int h, i, j, k, l, m; for (j = 0; j < XFACE_HEIGHT; j++) { for (i = 0; i < XFACE_WIDTH; i++) { h = i + j * XFACE_WIDTH; k = 0; /* Compute k, encoding the bits *before* the current one, contained in the image buffer. That is, given the grid: l i | | v v +--+--+--+--+--+ m -> | 1| 2| 3| 4| 5| +--+--+--+--+--+ | 6| 7| 8| 9|10| +--+--+--+--+--+ j -> |11|12| *| | | +--+--+--+--+--+ the value k for the pixel marked as "*" will contain the bit encoding of the values in the matrix marked from "1" to "12". In case the pixel is near the border of the grid, the number of values contained within the grid will be lesser than 12. */ for (l = i - 2; l <= i + 2; l++) { for (m = j - 2; m <= j; m++) { if (l >= i && m == j) continue; if (l > 0 && l <= XFACE_WIDTH && m > 0) k = 2*k + src[l + m * XFACE_WIDTH]; } } /* Use the guess for the given position and the computed value of k. The following table shows the number of digits in k, depending on the position of the pixel, and shows the corresponding guess table to use: i=1 i=2 i=3 i=w-1 i=w +----+----+----+ ... +----+----+ j=1 | 0 | 1 | 2 | | 2 | 2 | |g22 |g12 |g02 | |g42 |g32 | +----+----+----+ ... +----+----+ j=2 | 3 | 5 | 7 | | 6 | 5 | |g21 |g11 |g01 | |g41 |g31 | +----+----+----+ ... +----+----+ j=3 | 5 | 9 | 12 | | 10 | 8 | |g20 |g10 |g00 | |g40 |g30 | +----+----+----+ ... +----+----+ */ #define GEN(table) dst[h] ^= (table[k>>3]>>(7-(k&7)))&1 switch (i) { case 1: switch (j) { case 1: GEN(g_22); break; case 2: GEN(g_21); break; default: GEN(g_20); break; } break; case 2: switch (j) { case 1: GEN(g_12); break; case 2: GEN(g_11); break; default: GEN(g_10); break; } break; case XFACE_WIDTH - 1: switch (j) { case 1: GEN(g_42); break; case 2: GEN(g_41); break; default: GEN(g_40); break; } break; case XFACE_WIDTH: switch (j) { case 1: GEN(g_32); break; case 2: GEN(g_31); break; default: GEN(g_30); break; } break; default: switch (j) { case 1: GEN(g_02); break; case 2: GEN(g_01); break; default: GEN(g_00); break; } break; } } } }
true
FFmpeg
66c1c9b2774968dc26017269ac175b356592f878
void ff_xface_generate_face(uint8_t *dst, uint8_t * const src) { int h, i, j, k, l, m; for (j = 0; j < XFACE_HEIGHT; j++) { for (i = 0; i < XFACE_WIDTH; i++) { h = i + j * XFACE_WIDTH; k = 0; for (l = i - 2; l <= i + 2; l++) { for (m = j - 2; m <= j; m++) { if (l >= i && m == j) continue; if (l > 0 && l <= XFACE_WIDTH && m > 0) k = 2*k + src[l + m * XFACE_WIDTH]; } } #define GEN(table) dst[h] ^= (table[k>>3]>>(7-(k&7)))&1 switch (i) { case 1: switch (j) { case 1: GEN(g_22); break; case 2: GEN(g_21); break; default: GEN(g_20); break; } break; case 2: switch (j) { case 1: GEN(g_12); break; case 2: GEN(g_11); break; default: GEN(g_10); break; } break; case XFACE_WIDTH - 1: switch (j) { case 1: GEN(g_42); break; case 2: GEN(g_41); break; default: GEN(g_40); break; } break; case XFACE_WIDTH: switch (j) { case 1: GEN(g_32); break; case 2: GEN(g_31); break; default: GEN(g_30); break; } break; default: switch (j) { case 1: GEN(g_02); break; case 2: GEN(g_01); break; default: GEN(g_00); break; } break; } } } }
{ "code": [ " if (l >= i && m == j)", " if (l > 0 && l <= XFACE_WIDTH && m > 0)" ], "line_no": [ 65, 69 ] }
void FUNC_0(uint8_t *VAR_0, uint8_t * const VAR_1) { int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7; for (VAR_4 = 0; VAR_4 < XFACE_HEIGHT; VAR_4++) { for (VAR_3 = 0; VAR_3 < XFACE_WIDTH; VAR_3++) { VAR_2 = VAR_3 + VAR_4 * XFACE_WIDTH; VAR_5 = 0; for (VAR_6 = VAR_3 - 2; VAR_6 <= VAR_3 + 2; VAR_6++) { for (VAR_7 = VAR_4 - 2; VAR_7 <= VAR_4; VAR_7++) { if (VAR_6 >= VAR_3 && VAR_7 == VAR_4) continue; if (VAR_6 > 0 && VAR_6 <= XFACE_WIDTH && VAR_7 > 0) VAR_5 = 2*VAR_5 + VAR_1[VAR_6 + VAR_7 * XFACE_WIDTH]; } } #define GEN(table) VAR_0[VAR_2] ^= (table[VAR_5>>3]>>(7-(VAR_5&7)))&1 switch (VAR_3) { case 1: switch (VAR_4) { case 1: GEN(g_22); break; case 2: GEN(g_21); break; default: GEN(g_20); break; } break; case 2: switch (VAR_4) { case 1: GEN(g_12); break; case 2: GEN(g_11); break; default: GEN(g_10); break; } break; case XFACE_WIDTH - 1: switch (VAR_4) { case 1: GEN(g_42); break; case 2: GEN(g_41); break; default: GEN(g_40); break; } break; case XFACE_WIDTH: switch (VAR_4) { case 1: GEN(g_32); break; case 2: GEN(g_31); break; default: GEN(g_30); break; } break; default: switch (VAR_4) { case 1: GEN(g_02); break; case 2: GEN(g_01); break; default: GEN(g_00); break; } break; } } } }
[ "void FUNC_0(uint8_t *VAR_0, uint8_t * const VAR_1)\n{", "int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7;", "for (VAR_4 = 0; VAR_4 < XFACE_HEIGHT; VAR_4++) {", "for (VAR_3 = 0; VAR_3 < XFACE_WIDTH; VAR_3++) {", "VAR_2 = VAR_3 + VAR_4 * XFACE_WIDTH;", "VAR_5 = 0;", "for (VAR_6 = VAR_3 - 2; VAR_6 <= VAR_3 + 2; VAR_6++) {", "for (VAR_7 = VAR_4 - 2; VAR_7 <= VAR_4; VAR_7++) {", "if (VAR_6 >= VAR_3 && VAR_7 == VAR_4)\ncontinue;", "if (VAR_6 > 0 && VAR_6 <= XFACE_WIDTH && VAR_7 > 0)\nVAR_5 = 2*VAR_5 + VAR_1[VAR_6 + VAR_7 * XFACE_WIDTH];", "}", "}", "#define GEN(table) VAR_0[VAR_2] ^= (table[VAR_5>>3]>>(7-(VAR_5&7)))&1\nswitch (VAR_3) {", "case 1:\nswitch (VAR_4) {", "case 1: GEN(g_22); break;", "case 2: GEN(g_21); break;", "default: GEN(g_20); break;", "}", "break;", "case 2:\nswitch (VAR_4) {", "case 1: GEN(g_12); break;", "case 2: GEN(g_11); break;", "default: GEN(g_10); break;", "}", "break;", "case XFACE_WIDTH - 1:\nswitch (VAR_4) {", "case 1: GEN(g_42); break;", "case 2: GEN(g_41); break;", "default: GEN(g_40); break;", "}", "break;", "case XFACE_WIDTH:\nswitch (VAR_4) {", "case 1: GEN(g_32); break;", "case 2: GEN(g_31); break;", "default: GEN(g_30); break;", "}", "break;", "default:\nswitch (VAR_4) {", "case 1: GEN(g_02); break;", "case 2: GEN(g_01); break;", "default: GEN(g_00); break;", "}", "break;", "}", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 61 ], [ 63 ], [ 65, 67 ], [ 69, 71 ], [ 73 ], [ 75 ], [ 119, 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 ] ]
11,199
void ff_imdct_half_3dn2(FFTContext *s, FFTSample *output, const FFTSample *input) { x86_reg j, k; long n = s->mdct_size; long n2 = n >> 1; long n4 = n >> 2; long n8 = n >> 3; const uint16_t *revtab = s->revtab; const FFTSample *tcos = s->tcos; const FFTSample *tsin = s->tsin; const FFTSample *in1, *in2; FFTComplex *z = (FFTComplex *)output; /* pre rotation */ in1 = input; in2 = input + n2 - 1; #ifdef EMULATE_3DNOWEXT __asm__ volatile("movd %0, %%mm7" ::"r"(1<<31)); #endif for(k = 0; k < n4; k++) { // FIXME a single block is faster, but gcc 2.95 and 3.4.x on 32bit can't compile it __asm__ volatile( "movd %0, %%mm0 \n" "movd %2, %%mm1 \n" "punpckldq %1, %%mm0 \n" "punpckldq %3, %%mm1 \n" "movq %%mm0, %%mm2 \n" PSWAPD( %%mm1, %%mm3 ) "pfmul %%mm1, %%mm0 \n" "pfmul %%mm3, %%mm2 \n" #ifdef EMULATE_3DNOWEXT "movq %%mm0, %%mm1 \n" "punpckhdq %%mm2, %%mm0 \n" "punpckldq %%mm2, %%mm1 \n" "pxor %%mm7, %%mm0 \n" "pfadd %%mm1, %%mm0 \n" #else "pfpnacc %%mm2, %%mm0 \n" #endif ::"m"(in2[-2*k]), "m"(in1[2*k]), "m"(tcos[k]), "m"(tsin[k]) ); __asm__ volatile( "movq %%mm0, %0 \n\t" :"=m"(z[revtab[k]]) ); } ff_fft_dispatch_3dn2(z, s->nbits); #define CMUL(j,mm0,mm1)\ "movq (%2,"#j",2), %%mm6 \n"\ "movq 8(%2,"#j",2), "#mm0"\n"\ "movq %%mm6, "#mm1"\n"\ "movq "#mm0",%%mm7 \n"\ "pfmul (%3,"#j"), %%mm6 \n"\ "pfmul (%4,"#j"), "#mm0"\n"\ "pfmul (%4,"#j"), "#mm1"\n"\ "pfmul (%3,"#j"), %%mm7 \n"\ "pfsub %%mm6, "#mm0"\n"\ "pfadd %%mm7, "#mm1"\n" /* post rotation */ j = -n2; k = n2-8; __asm__ volatile( "1: \n" CMUL(%0, %%mm0, %%mm1) CMUL(%1, %%mm2, %%mm3) "movd %%mm0, (%2,%0,2) \n" "movd %%mm1,12(%2,%1,2) \n" "movd %%mm2, (%2,%1,2) \n" "movd %%mm3,12(%2,%0,2) \n" "psrlq $32, %%mm0 \n" "psrlq $32, %%mm1 \n" "psrlq $32, %%mm2 \n" "psrlq $32, %%mm3 \n" "movd %%mm0, 8(%2,%0,2) \n" "movd %%mm1, 4(%2,%1,2) \n" "movd %%mm2, 8(%2,%1,2) \n" "movd %%mm3, 4(%2,%0,2) \n" "sub $8, %1 \n" "add $8, %0 \n" "jl 1b \n" :"+r"(j), "+r"(k) :"r"(z+n8), "r"(tcos+n8), "r"(tsin+n8) :"memory" ); __asm__ volatile("femms"); }
true
FFmpeg
c2d3f561072132044114588a5f56b8e1974a2af7
void ff_imdct_half_3dn2(FFTContext *s, FFTSample *output, const FFTSample *input) { x86_reg j, k; long n = s->mdct_size; long n2 = n >> 1; long n4 = n >> 2; long n8 = n >> 3; const uint16_t *revtab = s->revtab; const FFTSample *tcos = s->tcos; const FFTSample *tsin = s->tsin; const FFTSample *in1, *in2; FFTComplex *z = (FFTComplex *)output; in1 = input; in2 = input + n2 - 1; #ifdef EMULATE_3DNOWEXT __asm__ volatile("movd %0, %%mm7" ::"r"(1<<31)); #endif for(k = 0; k < n4; k++) { __asm__ volatile( "movd %0, %%mm0 \n" "movd %2, %%mm1 \n" "punpckldq %1, %%mm0 \n" "punpckldq %3, %%mm1 \n" "movq %%mm0, %%mm2 \n" PSWAPD( %%mm1, %%mm3 ) "pfmul %%mm1, %%mm0 \n" "pfmul %%mm3, %%mm2 \n" #ifdef EMULATE_3DNOWEXT "movq %%mm0, %%mm1 \n" "punpckhdq %%mm2, %%mm0 \n" "punpckldq %%mm2, %%mm1 \n" "pxor %%mm7, %%mm0 \n" "pfadd %%mm1, %%mm0 \n" #else "pfpnacc %%mm2, %%mm0 \n" #endif ::"m"(in2[-2*k]), "m"(in1[2*k]), "m"(tcos[k]), "m"(tsin[k]) ); __asm__ volatile( "movq %%mm0, %0 \n\t" :"=m"(z[revtab[k]]) ); } ff_fft_dispatch_3dn2(z, s->nbits); #define CMUL(j,mm0,mm1)\ "movq (%2,"#j",2), %%mm6 \n"\ "movq 8(%2,"#j",2), "#mm0"\n"\ "movq %%mm6, "#mm1"\n"\ "movq "#mm0",%%mm7 \n"\ "pfmul (%3,"#j"), %%mm6 \n"\ "pfmul (%4,"#j"), "#mm0"\n"\ "pfmul (%4,"#j"), "#mm1"\n"\ "pfmul (%3,"#j"), %%mm7 \n"\ "pfsub %%mm6, "#mm0"\n"\ "pfadd %%mm7, "#mm1"\n" j = -n2; k = n2-8; __asm__ volatile( "1: \n" CMUL(%0, %%mm0, %%mm1) CMUL(%1, %%mm2, %%mm3) "movd %%mm0, (%2,%0,2) \n" "movd %%mm1,12(%2,%1,2) \n" "movd %%mm2, (%2,%1,2) \n" "movd %%mm3,12(%2,%0,2) \n" "psrlq $32, %%mm0 \n" "psrlq $32, %%mm1 \n" "psrlq $32, %%mm2 \n" "psrlq $32, %%mm3 \n" "movd %%mm0, 8(%2,%0,2) \n" "movd %%mm1, 4(%2,%1,2) \n" "movd %%mm2, 8(%2,%1,2) \n" "movd %%mm3, 4(%2,%0,2) \n" "sub $8, %1 \n" "add $8, %0 \n" "jl 1b \n" :"+r"(j), "+r"(k) :"r"(z+n8), "r"(tcos+n8), "r"(tsin+n8) :"memory" ); __asm__ volatile("femms"); }
{ "code": [ " __asm__ volatile(\"movd %0, %%mm7\" ::\"r\"(1<<31));" ], "line_no": [ 35 ] }
void FUNC_0(FFTContext *VAR_0, FFTSample *VAR_1, const FFTSample *VAR_2) { x86_reg j, k; long VAR_3 = VAR_0->mdct_size; long VAR_4 = VAR_3 >> 1; long VAR_5 = VAR_3 >> 2; long VAR_6 = VAR_3 >> 3; const uint16_t *VAR_7 = VAR_0->VAR_7; const FFTSample *VAR_8 = VAR_0->VAR_8; const FFTSample *VAR_9 = VAR_0->VAR_9; const FFTSample *VAR_10, *in2; FFTComplex *z = (FFTComplex *)VAR_1; VAR_10 = VAR_2; in2 = VAR_2 + VAR_4 - 1; #ifdef EMULATE_3DNOWEXT __asm__ volatile("movd %0, %%mm7" ::"r"(1<<31)); #endif for(k = 0; k < VAR_5; k++) { __asm__ volatile( "movd %0, %%mm0 \VAR_3" "movd %2, %%mm1 \VAR_3" "punpckldq %1, %%mm0 \VAR_3" "punpckldq %3, %%mm1 \VAR_3" "movq %%mm0, %%mm2 \VAR_3" PSWAPD( %%mm1, %%mm3 ) "pfmul %%mm1, %%mm0 \VAR_3" "pfmul %%mm3, %%mm2 \VAR_3" #ifdef EMULATE_3DNOWEXT "movq %%mm0, %%mm1 \VAR_3" "punpckhdq %%mm2, %%mm0 \VAR_3" "punpckldq %%mm2, %%mm1 \VAR_3" "pxor %%mm7, %%mm0 \VAR_3" "pfadd %%mm1, %%mm0 \VAR_3" #else "pfpnacc %%mm2, %%mm0 \VAR_3" #endif ::"m"(in2[-2*k]), "m"(VAR_10[2*k]), "m"(VAR_8[k]), "m"(VAR_9[k]) ); __asm__ volatile( "movq %%mm0, %0 \VAR_3\t" :"=m"(z[VAR_7[k]]) ); } ff_fft_dispatch_3dn2(z, VAR_0->nbits); #define CMUL(j,mm0,mm1)\ "movq (%2,"#j",2), %%mm6 \VAR_3"\ "movq 8(%2,"#j",2), "#mm0"\VAR_3"\ "movq %%mm6, "#mm1"\VAR_3"\ "movq "#mm0",%%mm7 \VAR_3"\ "pfmul (%3,"#j"), %%mm6 \VAR_3"\ "pfmul (%4,"#j"), "#mm0"\VAR_3"\ "pfmul (%4,"#j"), "#mm1"\VAR_3"\ "pfmul (%3,"#j"), %%mm7 \VAR_3"\ "pfsub %%mm6, "#mm0"\VAR_3"\ "pfadd %%mm7, "#mm1"\VAR_3" j = -VAR_4; k = VAR_4-8; __asm__ volatile( "1: \VAR_3" CMUL(%0, %%mm0, %%mm1) CMUL(%1, %%mm2, %%mm3) "movd %%mm0, (%2,%0,2) \VAR_3" "movd %%mm1,12(%2,%1,2) \VAR_3" "movd %%mm2, (%2,%1,2) \VAR_3" "movd %%mm3,12(%2,%0,2) \VAR_3" "psrlq $32, %%mm0 \VAR_3" "psrlq $32, %%mm1 \VAR_3" "psrlq $32, %%mm2 \VAR_3" "psrlq $32, %%mm3 \VAR_3" "movd %%mm0, 8(%2,%0,2) \VAR_3" "movd %%mm1, 4(%2,%1,2) \VAR_3" "movd %%mm2, 8(%2,%1,2) \VAR_3" "movd %%mm3, 4(%2,%0,2) \VAR_3" "sub $8, %1 \VAR_3" "add $8, %0 \VAR_3" "jl 1b \VAR_3" :"+r"(j), "+r"(k) :"r"(z+VAR_6), "r"(VAR_8+VAR_6), "r"(VAR_9+VAR_6) :"memory" ); __asm__ volatile("femms"); }
[ "void FUNC_0(FFTContext *VAR_0, FFTSample *VAR_1, const FFTSample *VAR_2)\n{", "x86_reg j, k;", "long VAR_3 = VAR_0->mdct_size;", "long VAR_4 = VAR_3 >> 1;", "long VAR_5 = VAR_3 >> 2;", "long VAR_6 = VAR_3 >> 3;", "const uint16_t *VAR_7 = VAR_0->VAR_7;", "const FFTSample *VAR_8 = VAR_0->VAR_8;", "const FFTSample *VAR_9 = VAR_0->VAR_9;", "const FFTSample *VAR_10, *in2;", "FFTComplex *z = (FFTComplex *)VAR_1;", "VAR_10 = VAR_2;", "in2 = VAR_2 + VAR_4 - 1;", "#ifdef EMULATE_3DNOWEXT\n__asm__ volatile(\"movd %0, %%mm7\" ::\"r\"(1<<31));", "#endif\nfor(k = 0; k < VAR_5; k++) {", "__asm__ volatile(\n\"movd %0, %%mm0 \\VAR_3\"\n\"movd %2, %%mm1 \\VAR_3\"\n\"punpckldq %1, %%mm0 \\VAR_3\"\n\"punpckldq %3, %%mm1 \\VAR_3\"\n\"movq %%mm0, %%mm2 \\VAR_3\"\nPSWAPD( %%mm1, %%mm3 )\n\"pfmul %%mm1, %%mm0 \\VAR_3\"\n\"pfmul %%mm3, %%mm2 \\VAR_3\"\n#ifdef EMULATE_3DNOWEXT\n\"movq %%mm0, %%mm1 \\VAR_3\"\n\"punpckhdq %%mm2, %%mm0 \\VAR_3\"\n\"punpckldq %%mm2, %%mm1 \\VAR_3\"\n\"pxor %%mm7, %%mm0 \\VAR_3\"\n\"pfadd %%mm1, %%mm0 \\VAR_3\"\n#else\n\"pfpnacc %%mm2, %%mm0 \\VAR_3\"\n#endif\n::\"m\"(in2[-2*k]), \"m\"(VAR_10[2*k]),\n\"m\"(VAR_8[k]), \"m\"(VAR_9[k])\n);", "__asm__ volatile(\n\"movq %%mm0, %0 \\VAR_3\\t\"\n:\"=m\"(z[VAR_7[k]])\n);", "}", "ff_fft_dispatch_3dn2(z, VAR_0->nbits);", "#define CMUL(j,mm0,mm1)\\\n\"movq (%2,\"#j\",2), %%mm6 \\VAR_3\"\\\n\"movq 8(%2,\"#j\",2), \"#mm0\"\\VAR_3\"\\\n\"movq %%mm6, \"#mm1\"\\VAR_3\"\\\n\"movq \"#mm0\",%%mm7 \\VAR_3\"\\\n\"pfmul (%3,\"#j\"), %%mm6 \\VAR_3\"\\\n\"pfmul (%4,\"#j\"), \"#mm0\"\\VAR_3\"\\\n\"pfmul (%4,\"#j\"), \"#mm1\"\\VAR_3\"\\\n\"pfmul (%3,\"#j\"), %%mm7 \\VAR_3\"\\\n\"pfsub %%mm6, \"#mm0\"\\VAR_3\"\\\n\"pfadd %%mm7, \"#mm1\"\\VAR_3\"\nj = -VAR_4;", "k = VAR_4-8;", "__asm__ volatile(\n\"1: \\VAR_3\"\nCMUL(%0, %%mm0, %%mm1)\nCMUL(%1, %%mm2, %%mm3)\n\"movd %%mm0, (%2,%0,2) \\VAR_3\"\n\"movd %%mm1,12(%2,%1,2) \\VAR_3\"\n\"movd %%mm2, (%2,%1,2) \\VAR_3\"\n\"movd %%mm3,12(%2,%0,2) \\VAR_3\"\n\"psrlq $32, %%mm0 \\VAR_3\"\n\"psrlq $32, %%mm1 \\VAR_3\"\n\"psrlq $32, %%mm2 \\VAR_3\"\n\"psrlq $32, %%mm3 \\VAR_3\"\n\"movd %%mm0, 8(%2,%0,2) \\VAR_3\"\n\"movd %%mm1, 4(%2,%1,2) \\VAR_3\"\n\"movd %%mm2, 8(%2,%1,2) \\VAR_3\"\n\"movd %%mm3, 4(%2,%0,2) \\VAR_3\"\n\"sub $8, %1 \\VAR_3\"\n\"add $8, %0 \\VAR_3\"\n\"jl 1b \\VAR_3\"\n:\"+r\"(j), \"+r\"(k)\n:\"r\"(z+VAR_6), \"r\"(VAR_8+VAR_6), \"r\"(VAR_9+VAR_6)\n:\"memory\"\n);", "__asm__ volatile(\"femms\");", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 29 ], [ 31 ], [ 33, 35 ], [ 37, 39 ], [ 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 ], [ 97 ], [ 101, 103, 105, 107, 109, 111, 113, 115, 117, 119, 121, 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 ] ]
11,200
static av_cold int decimate_init(AVFilterContext *ctx) { DecimateContext *dm = ctx->priv; AVFilterPad pad = { .name = av_strdup("main"), .type = AVMEDIA_TYPE_VIDEO, .filter_frame = filter_frame, .config_props = config_input, }; if (!pad.name) return AVERROR(ENOMEM); ff_insert_inpad(ctx, INPUT_MAIN, &pad); if (dm->ppsrc) { pad.name = av_strdup("clean_src"); pad.config_props = NULL; if (!pad.name) return AVERROR(ENOMEM); ff_insert_inpad(ctx, INPUT_CLEANSRC, &pad); } if ((dm->blockx & (dm->blockx - 1)) || (dm->blocky & (dm->blocky - 1))) { av_log(ctx, AV_LOG_ERROR, "blockx and blocky settings must be power of two\n"); return AVERROR(EINVAL); } dm->start_pts = AV_NOPTS_VALUE; return 0; }
true
FFmpeg
0b940c95b2171cb1035c79b85492f5f6cdb060a6
static av_cold int decimate_init(AVFilterContext *ctx) { DecimateContext *dm = ctx->priv; AVFilterPad pad = { .name = av_strdup("main"), .type = AVMEDIA_TYPE_VIDEO, .filter_frame = filter_frame, .config_props = config_input, }; if (!pad.name) return AVERROR(ENOMEM); ff_insert_inpad(ctx, INPUT_MAIN, &pad); if (dm->ppsrc) { pad.name = av_strdup("clean_src"); pad.config_props = NULL; if (!pad.name) return AVERROR(ENOMEM); ff_insert_inpad(ctx, INPUT_CLEANSRC, &pad); } if ((dm->blockx & (dm->blockx - 1)) || (dm->blocky & (dm->blocky - 1))) { av_log(ctx, AV_LOG_ERROR, "blockx and blocky settings must be power of two\n"); return AVERROR(EINVAL); } dm->start_pts = AV_NOPTS_VALUE; return 0; }
{ "code": [ " ff_insert_inpad(ctx, INPUT_MAIN, &pad);", " ff_insert_inpad(ctx, INPUT_CLEANSRC, &pad);" ], "line_no": [ 25, 39 ] }
static av_cold int FUNC_0(AVFilterContext *ctx) { DecimateContext *dm = ctx->priv; AVFilterPad pad = { .name = av_strdup("main"), .type = AVMEDIA_TYPE_VIDEO, .filter_frame = filter_frame, .config_props = config_input, }; if (!pad.name) return AVERROR(ENOMEM); ff_insert_inpad(ctx, INPUT_MAIN, &pad); if (dm->ppsrc) { pad.name = av_strdup("clean_src"); pad.config_props = NULL; if (!pad.name) return AVERROR(ENOMEM); ff_insert_inpad(ctx, INPUT_CLEANSRC, &pad); } if ((dm->blockx & (dm->blockx - 1)) || (dm->blocky & (dm->blocky - 1))) { av_log(ctx, AV_LOG_ERROR, "blockx and blocky settings must be power of two\n"); return AVERROR(EINVAL); } dm->start_pts = AV_NOPTS_VALUE; return 0; }
[ "static av_cold int FUNC_0(AVFilterContext *ctx)\n{", "DecimateContext *dm = ctx->priv;", "AVFilterPad pad = {", ".name = av_strdup(\"main\"),\n.type = AVMEDIA_TYPE_VIDEO,\n.filter_frame = filter_frame,\n.config_props = config_input,\n};", "if (!pad.name)\nreturn AVERROR(ENOMEM);", "ff_insert_inpad(ctx, INPUT_MAIN, &pad);", "if (dm->ppsrc) {", "pad.name = av_strdup(\"clean_src\");", "pad.config_props = NULL;", "if (!pad.name)\nreturn AVERROR(ENOMEM);", "ff_insert_inpad(ctx, INPUT_CLEANSRC, &pad);", "}", "if ((dm->blockx & (dm->blockx - 1)) ||\n(dm->blocky & (dm->blocky - 1))) {", "av_log(ctx, AV_LOG_ERROR, \"blockx and blocky settings must be power of two\\n\");", "return AVERROR(EINVAL);", "}", "dm->start_pts = AV_NOPTS_VALUE;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9, 11, 13, 15, 17 ], [ 21, 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35, 37 ], [ 39 ], [ 41 ], [ 45, 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 61 ], [ 63 ] ]
11,201
static int get_qcc(J2kDecoderContext *s, int n, J2kQuantStyle *q, uint8_t *properties) { int compno; if (s->buf_end - s->buf < 1) return AVERROR(EINVAL); compno = bytestream_get_byte(&s->buf); properties[compno] |= HAD_QCC; return get_qcx(s, n-1, q+compno); }
true
FFmpeg
ddfa3751c092feaf1e080f66587024689dfe603c
static int get_qcc(J2kDecoderContext *s, int n, J2kQuantStyle *q, uint8_t *properties) { int compno; if (s->buf_end - s->buf < 1) return AVERROR(EINVAL); compno = bytestream_get_byte(&s->buf); properties[compno] |= HAD_QCC; return get_qcx(s, n-1, q+compno); }
{ "code": [ " return AVERROR(EINVAL);", " compno = bytestream_get_byte(&s->buf);", " if (s->buf_end - s->buf < 1)", " if (s->buf_end - s->buf < 1)", " compno = bytestream_get_byte(&s->buf);" ], "line_no": [ 11, 15, 9, 9, 15 ] }
static int FUNC_0(J2kDecoderContext *VAR_0, int VAR_1, J2kQuantStyle *VAR_2, uint8_t *VAR_3) { int VAR_4; if (VAR_0->buf_end - VAR_0->buf < 1) return AVERROR(EINVAL); VAR_4 = bytestream_get_byte(&VAR_0->buf); VAR_3[VAR_4] |= HAD_QCC; return get_qcx(VAR_0, VAR_1-1, VAR_2+VAR_4); }
[ "static int FUNC_0(J2kDecoderContext *VAR_0, int VAR_1, J2kQuantStyle *VAR_2, uint8_t *VAR_3)\n{", "int VAR_4;", "if (VAR_0->buf_end - VAR_0->buf < 1)\nreturn AVERROR(EINVAL);", "VAR_4 = bytestream_get_byte(&VAR_0->buf);", "VAR_3[VAR_4] |= HAD_QCC;", "return get_qcx(VAR_0, VAR_1-1, VAR_2+VAR_4);", "}" ]
[ 0, 0, 1, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
11,203
void migration_incoming_state_destroy(void) { struct MigrationIncomingState *mis = migration_incoming_get_current(); qemu_event_destroy(&mis->main_thread_load_event);
true
qemu
3482655bbc21d158ed0daaa294c890997238cc23
void migration_incoming_state_destroy(void) { struct MigrationIncomingState *mis = migration_incoming_get_current(); qemu_event_destroy(&mis->main_thread_load_event);
{ "code": [], "line_no": [] }
void FUNC_0(void) { struct MigrationIncomingState *VAR_0 = migration_incoming_get_current(); qemu_event_destroy(&VAR_0->main_thread_load_event);
[ "void FUNC_0(void)\n{", "struct MigrationIncomingState *VAR_0 = migration_incoming_get_current();", "qemu_event_destroy(&VAR_0->main_thread_load_event);" ]
[ 0, 0, 0 ]
[ [ 1, 2 ], [ 3 ], [ 4 ] ]
11,204
static QString *read_line(FILE *file, char *key) { char value[128]; if (fscanf(file, "%s%s", key, value) == EOF) return NULL; remove_dots(key); return qstring_from_str(value); }
true
qemu
7464f0587b2938a3e10e9f995f384df8a5f298ac
static QString *read_line(FILE *file, char *key) { char value[128]; if (fscanf(file, "%s%s", key, value) == EOF) return NULL; remove_dots(key); return qstring_from_str(value); }
{ "code": [ " if (fscanf(file, \"%s%s\", key, value) == EOF)" ], "line_no": [ 9 ] }
static QString *FUNC_0(FILE *file, char *key) { char VAR_0[128]; if (fscanf(file, "%s%s", key, VAR_0) == EOF) return NULL; remove_dots(key); return qstring_from_str(VAR_0); }
[ "static QString *FUNC_0(FILE *file, char *key)\n{", "char VAR_0[128];", "if (fscanf(file, \"%s%s\", key, VAR_0) == EOF)\nreturn NULL;", "remove_dots(key);", "return qstring_from_str(VAR_0);", "}" ]
[ 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11 ], [ 13 ], [ 15 ], [ 17 ] ]
11,205
av_cold void ff_intrax8_common_init(IntraX8Context *w, MpegEncContext *const s) { w->s = s; x8_vlc_init(); assert(s->mb_width > 0); // two rows, 2 blocks per cannon mb w->prediction_table = av_mallocz(s->mb_width * 2 * 2); ff_init_scantable(s->idsp.idct_permutation, &w->scantable[0], ff_wmv1_scantable[0]); ff_init_scantable(s->idsp.idct_permutation, &w->scantable[1], ff_wmv1_scantable[2]); ff_init_scantable(s->idsp.idct_permutation, &w->scantable[2], ff_wmv1_scantable[3]); ff_intrax8dsp_init(&w->dsp); }
false
FFmpeg
0372e73f917e72c40b09270f771046fc142be4a7
av_cold void ff_intrax8_common_init(IntraX8Context *w, MpegEncContext *const s) { w->s = s; x8_vlc_init(); assert(s->mb_width > 0); w->prediction_table = av_mallocz(s->mb_width * 2 * 2); ff_init_scantable(s->idsp.idct_permutation, &w->scantable[0], ff_wmv1_scantable[0]); ff_init_scantable(s->idsp.idct_permutation, &w->scantable[1], ff_wmv1_scantable[2]); ff_init_scantable(s->idsp.idct_permutation, &w->scantable[2], ff_wmv1_scantable[3]); ff_intrax8dsp_init(&w->dsp); }
{ "code": [], "line_no": [] }
av_cold void FUNC_0(IntraX8Context *w, MpegEncContext *const s) { w->s = s; x8_vlc_init(); assert(s->mb_width > 0); w->prediction_table = av_mallocz(s->mb_width * 2 * 2); ff_init_scantable(s->idsp.idct_permutation, &w->scantable[0], ff_wmv1_scantable[0]); ff_init_scantable(s->idsp.idct_permutation, &w->scantable[1], ff_wmv1_scantable[2]); ff_init_scantable(s->idsp.idct_permutation, &w->scantable[2], ff_wmv1_scantable[3]); ff_intrax8dsp_init(&w->dsp); }
[ "av_cold void FUNC_0(IntraX8Context *w, MpegEncContext *const s)\n{", "w->s = s;", "x8_vlc_init();", "assert(s->mb_width > 0);", "w->prediction_table = av_mallocz(s->mb_width * 2 * 2);", "ff_init_scantable(s->idsp.idct_permutation, &w->scantable[0],\nff_wmv1_scantable[0]);", "ff_init_scantable(s->idsp.idct_permutation, &w->scantable[1],\nff_wmv1_scantable[2]);", "ff_init_scantable(s->idsp.idct_permutation, &w->scantable[2],\nff_wmv1_scantable[3]);", "ff_intrax8dsp_init(&w->dsp);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 15 ], [ 19, 21 ], [ 23, 25 ], [ 27, 29 ], [ 33 ], [ 35 ] ]