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
17,852
static void implicit_weight_table(H264Context *h){ MpegEncContext * const s = &h->s; int ref0, ref1, i; int cur_poc = s->current_picture_ptr->poc; if( h->ref_count[0] == 1 && h->ref_count[1] == 1 && h->ref_list[0][0].poc + h->ref_list[1][0].poc == 2*cur_poc){ h->use_weight= 0; h->use_weight_chroma= 0; return; } h->use_weight= 2; h->use_weight_chroma= 2; h->luma_log2_weight_denom= 5; h->chroma_log2_weight_denom= 5; for (i = 0; i < 2; i++) { h->luma_weight_flag[i] = 0; h->chroma_weight_flag[i] = 0; } for(ref0=0; ref0 < h->ref_count[0]; ref0++){ int poc0 = h->ref_list[0][ref0].poc; for(ref1=0; ref1 < h->ref_count[1]; ref1++){ int poc1 = h->ref_list[1][ref1].poc; int td = av_clip(poc1 - poc0, -128, 127); if(td){ int tb = av_clip(cur_poc - poc0, -128, 127); int tx = (16384 + (FFABS(td) >> 1)) / td; int dist_scale_factor = av_clip((tb*tx + 32) >> 6, -1024, 1023) >> 2; if(dist_scale_factor < -64 || dist_scale_factor > 128) h->implicit_weight[ref0][ref1] = 32; else h->implicit_weight[ref0][ref1] = 64 - dist_scale_factor; }else h->implicit_weight[ref0][ref1] = 32; } } }
false
FFmpeg
ce09f9270a8bf43212dad58fcb73fee2900c364f
static void implicit_weight_table(H264Context *h){ MpegEncContext * const s = &h->s; int ref0, ref1, i; int cur_poc = s->current_picture_ptr->poc; if( h->ref_count[0] == 1 && h->ref_count[1] == 1 && h->ref_list[0][0].poc + h->ref_list[1][0].poc == 2*cur_poc){ h->use_weight= 0; h->use_weight_chroma= 0; return; } h->use_weight= 2; h->use_weight_chroma= 2; h->luma_log2_weight_denom= 5; h->chroma_log2_weight_denom= 5; for (i = 0; i < 2; i++) { h->luma_weight_flag[i] = 0; h->chroma_weight_flag[i] = 0; } for(ref0=0; ref0 < h->ref_count[0]; ref0++){ int poc0 = h->ref_list[0][ref0].poc; for(ref1=0; ref1 < h->ref_count[1]; ref1++){ int poc1 = h->ref_list[1][ref1].poc; int td = av_clip(poc1 - poc0, -128, 127); if(td){ int tb = av_clip(cur_poc - poc0, -128, 127); int tx = (16384 + (FFABS(td) >> 1)) / td; int dist_scale_factor = av_clip((tb*tx + 32) >> 6, -1024, 1023) >> 2; if(dist_scale_factor < -64 || dist_scale_factor > 128) h->implicit_weight[ref0][ref1] = 32; else h->implicit_weight[ref0][ref1] = 64 - dist_scale_factor; }else h->implicit_weight[ref0][ref1] = 32; } } }
{ "code": [], "line_no": [] }
static void FUNC_0(H264Context *VAR_0){ MpegEncContext * const s = &VAR_0->s; int VAR_1, VAR_2, VAR_3; int VAR_4 = s->current_picture_ptr->poc; if( VAR_0->ref_count[0] == 1 && VAR_0->ref_count[1] == 1 && VAR_0->ref_list[0][0].poc + VAR_0->ref_list[1][0].poc == 2*VAR_4){ VAR_0->use_weight= 0; VAR_0->use_weight_chroma= 0; return; } VAR_0->use_weight= 2; VAR_0->use_weight_chroma= 2; VAR_0->luma_log2_weight_denom= 5; VAR_0->chroma_log2_weight_denom= 5; for (VAR_3 = 0; VAR_3 < 2; VAR_3++) { VAR_0->luma_weight_flag[VAR_3] = 0; VAR_0->chroma_weight_flag[VAR_3] = 0; } for(VAR_1=0; VAR_1 < VAR_0->ref_count[0]; VAR_1++){ int poc0 = VAR_0->ref_list[0][VAR_1].poc; for(VAR_2=0; VAR_2 < VAR_0->ref_count[1]; VAR_2++){ int poc1 = VAR_0->ref_list[1][VAR_2].poc; int td = av_clip(poc1 - poc0, -128, 127); if(td){ int tb = av_clip(VAR_4 - poc0, -128, 127); int tx = (16384 + (FFABS(td) >> 1)) / td; int dist_scale_factor = av_clip((tb*tx + 32) >> 6, -1024, 1023) >> 2; if(dist_scale_factor < -64 || dist_scale_factor > 128) VAR_0->implicit_weight[VAR_1][VAR_2] = 32; else VAR_0->implicit_weight[VAR_1][VAR_2] = 64 - dist_scale_factor; }else VAR_0->implicit_weight[VAR_1][VAR_2] = 32; } } }
[ "static void FUNC_0(H264Context *VAR_0){", "MpegEncContext * const s = &VAR_0->s;", "int VAR_1, VAR_2, VAR_3;", "int VAR_4 = s->current_picture_ptr->poc;", "if( VAR_0->ref_count[0] == 1 && VAR_0->ref_count[1] == 1\n&& VAR_0->ref_list[0][0].poc + VAR_0->ref_list[1][0].poc == 2*VAR_4){", "VAR_0->use_weight= 0;", "VAR_0->use_weight_chroma= 0;", "return;", "}", "VAR_0->use_weight= 2;", "VAR_0->use_weight_chroma= 2;", "VAR_0->luma_log2_weight_denom= 5;", "VAR_0->chroma_log2_weight_denom= 5;", "for (VAR_3 = 0; VAR_3 < 2; VAR_3++) {", "VAR_0->luma_weight_flag[VAR_3] = 0;", "VAR_0->chroma_weight_flag[VAR_3] = 0;", "}", "for(VAR_1=0; VAR_1 < VAR_0->ref_count[0]; VAR_1++){", "int poc0 = VAR_0->ref_list[0][VAR_1].poc;", "for(VAR_2=0; VAR_2 < VAR_0->ref_count[1]; VAR_2++){", "int poc1 = VAR_0->ref_list[1][VAR_2].poc;", "int td = av_clip(poc1 - poc0, -128, 127);", "if(td){", "int tb = av_clip(VAR_4 - poc0, -128, 127);", "int tx = (16384 + (FFABS(td) >> 1)) / td;", "int dist_scale_factor = av_clip((tb*tx + 32) >> 6, -1024, 1023) >> 2;", "if(dist_scale_factor < -64 || dist_scale_factor > 128)\nVAR_0->implicit_weight[VAR_1][VAR_2] = 32;", "else\nVAR_0->implicit_weight[VAR_1][VAR_2] = 64 - dist_scale_factor;", "}else", "VAR_0->implicit_weight[VAR_1][VAR_2] = 32;", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61, 63 ], [ 65, 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ] ]
17,853
static av_cold int ra144_encode_init(AVCodecContext * avctx) { RA144Context *ractx; int ret; if (avctx->channels != 1) { av_log(avctx, AV_LOG_ERROR, "invalid number of channels: %d\n", avctx->channels); return -1; } avctx->frame_size = NBLOCKS * BLOCKSIZE; avctx->delay = avctx->frame_size; avctx->bit_rate = 8000; ractx = avctx->priv_data; ractx->lpc_coef[0] = ractx->lpc_tables[0]; ractx->lpc_coef[1] = ractx->lpc_tables[1]; ractx->avctx = avctx; ret = ff_lpc_init(&ractx->lpc_ctx, avctx->frame_size, LPC_ORDER, FF_LPC_TYPE_LEVINSON); if (ret < 0) goto error; ff_af_queue_init(avctx, &ractx->afq); return 0; error: ra144_encode_close(avctx); return ret; }
false
FFmpeg
2df0c32ea12ddfa72ba88309812bfb13b674130f
static av_cold int ra144_encode_init(AVCodecContext * avctx) { RA144Context *ractx; int ret; if (avctx->channels != 1) { av_log(avctx, AV_LOG_ERROR, "invalid number of channels: %d\n", avctx->channels); return -1; } avctx->frame_size = NBLOCKS * BLOCKSIZE; avctx->delay = avctx->frame_size; avctx->bit_rate = 8000; ractx = avctx->priv_data; ractx->lpc_coef[0] = ractx->lpc_tables[0]; ractx->lpc_coef[1] = ractx->lpc_tables[1]; ractx->avctx = avctx; ret = ff_lpc_init(&ractx->lpc_ctx, avctx->frame_size, LPC_ORDER, FF_LPC_TYPE_LEVINSON); if (ret < 0) goto error; ff_af_queue_init(avctx, &ractx->afq); return 0; error: ra144_encode_close(avctx); return ret; }
{ "code": [], "line_no": [] }
static av_cold int FUNC_0(AVCodecContext * avctx) { RA144Context *ractx; int VAR_0; if (avctx->channels != 1) { av_log(avctx, AV_LOG_ERROR, "invalid number of channels: %d\n", avctx->channels); return -1; } avctx->frame_size = NBLOCKS * BLOCKSIZE; avctx->delay = avctx->frame_size; avctx->bit_rate = 8000; ractx = avctx->priv_data; ractx->lpc_coef[0] = ractx->lpc_tables[0]; ractx->lpc_coef[1] = ractx->lpc_tables[1]; ractx->avctx = avctx; VAR_0 = ff_lpc_init(&ractx->lpc_ctx, avctx->frame_size, LPC_ORDER, FF_LPC_TYPE_LEVINSON); if (VAR_0 < 0) goto error; ff_af_queue_init(avctx, &ractx->afq); return 0; error: ra144_encode_close(avctx); return VAR_0; }
[ "static av_cold int FUNC_0(AVCodecContext * avctx)\n{", "RA144Context *ractx;", "int VAR_0;", "if (avctx->channels != 1) {", "av_log(avctx, AV_LOG_ERROR, \"invalid number of channels: %d\\n\",\navctx->channels);", "return -1;", "}", "avctx->frame_size = NBLOCKS * BLOCKSIZE;", "avctx->delay = avctx->frame_size;", "avctx->bit_rate = 8000;", "ractx = avctx->priv_data;", "ractx->lpc_coef[0] = ractx->lpc_tables[0];", "ractx->lpc_coef[1] = ractx->lpc_tables[1];", "ractx->avctx = avctx;", "VAR_0 = ff_lpc_init(&ractx->lpc_ctx, avctx->frame_size, LPC_ORDER,\nFF_LPC_TYPE_LEVINSON);", "if (VAR_0 < 0)\ngoto error;", "ff_af_queue_init(avctx, &ractx->afq);", "return 0;", "error:\nra144_encode_close(avctx);", "return 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 ], [ 11 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35, 37 ], [ 39, 41 ], [ 45 ], [ 49 ], [ 51, 53 ], [ 55 ], [ 57 ] ]
17,854
static int mxf_read_generic_descriptor(void *arg, AVIOContext *pb, int tag, int size, UID uid, int64_t klv_offset) { MXFDescriptor *descriptor = arg; descriptor->pix_fmt = AV_PIX_FMT_NONE; switch(tag) { case 0x3F01: descriptor->sub_descriptors_count = avio_rb32(pb); if (descriptor->sub_descriptors_count >= UINT_MAX / sizeof(UID)) return AVERROR_INVALIDDATA; descriptor->sub_descriptors_refs = av_malloc(descriptor->sub_descriptors_count * sizeof(UID)); if (!descriptor->sub_descriptors_refs) return AVERROR(ENOMEM); avio_skip(pb, 4); /* useless size of objects, always 16 according to specs */ avio_read(pb, (uint8_t *)descriptor->sub_descriptors_refs, descriptor->sub_descriptors_count * sizeof(UID)); break; case 0x3004: avio_read(pb, descriptor->essence_container_ul, 16); break; case 0x3006: descriptor->linked_track_id = avio_rb32(pb); break; case 0x3201: /* PictureEssenceCoding */ avio_read(pb, descriptor->essence_codec_ul, 16); break; case 0x3203: descriptor->width = avio_rb32(pb); break; case 0x3202: descriptor->height = avio_rb32(pb); break; case 0x320C: descriptor->frame_layout = avio_r8(pb); break; case 0x320E: descriptor->aspect_ratio.num = avio_rb32(pb); descriptor->aspect_ratio.den = avio_rb32(pb); break; case 0x3301: descriptor->component_depth = avio_rb32(pb); break; case 0x3302: descriptor->horiz_subsampling = avio_rb32(pb); break; case 0x3308: descriptor->vert_subsampling = avio_rb32(pb); break; case 0x3D03: descriptor->sample_rate.num = avio_rb32(pb); descriptor->sample_rate.den = avio_rb32(pb); break; case 0x3D06: /* SoundEssenceCompression */ avio_read(pb, descriptor->essence_codec_ul, 16); break; case 0x3D07: descriptor->channels = avio_rb32(pb); break; case 0x3D01: descriptor->bits_per_sample = avio_rb32(pb); break; case 0x3401: mxf_read_pixel_layout(pb, descriptor); break; default: /* Private uid used by SONY C0023S01.mxf */ if (IS_KLV_KEY(uid, mxf_sony_mpeg4_extradata)) { descriptor->extradata = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE); if (!descriptor->extradata) return AVERROR(ENOMEM); descriptor->extradata_size = size; avio_read(pb, descriptor->extradata, size); } break; } return 0; }
true
FFmpeg
0d6605c7ef43f97a88950542af09078adef33b6d
static int mxf_read_generic_descriptor(void *arg, AVIOContext *pb, int tag, int size, UID uid, int64_t klv_offset) { MXFDescriptor *descriptor = arg; descriptor->pix_fmt = AV_PIX_FMT_NONE; switch(tag) { case 0x3F01: descriptor->sub_descriptors_count = avio_rb32(pb); if (descriptor->sub_descriptors_count >= UINT_MAX / sizeof(UID)) return AVERROR_INVALIDDATA; descriptor->sub_descriptors_refs = av_malloc(descriptor->sub_descriptors_count * sizeof(UID)); if (!descriptor->sub_descriptors_refs) return AVERROR(ENOMEM); avio_skip(pb, 4); avio_read(pb, (uint8_t *)descriptor->sub_descriptors_refs, descriptor->sub_descriptors_count * sizeof(UID)); break; case 0x3004: avio_read(pb, descriptor->essence_container_ul, 16); break; case 0x3006: descriptor->linked_track_id = avio_rb32(pb); break; case 0x3201: avio_read(pb, descriptor->essence_codec_ul, 16); break; case 0x3203: descriptor->width = avio_rb32(pb); break; case 0x3202: descriptor->height = avio_rb32(pb); break; case 0x320C: descriptor->frame_layout = avio_r8(pb); break; case 0x320E: descriptor->aspect_ratio.num = avio_rb32(pb); descriptor->aspect_ratio.den = avio_rb32(pb); break; case 0x3301: descriptor->component_depth = avio_rb32(pb); break; case 0x3302: descriptor->horiz_subsampling = avio_rb32(pb); break; case 0x3308: descriptor->vert_subsampling = avio_rb32(pb); break; case 0x3D03: descriptor->sample_rate.num = avio_rb32(pb); descriptor->sample_rate.den = avio_rb32(pb); break; case 0x3D06: avio_read(pb, descriptor->essence_codec_ul, 16); break; case 0x3D07: descriptor->channels = avio_rb32(pb); break; case 0x3D01: descriptor->bits_per_sample = avio_rb32(pb); break; case 0x3401: mxf_read_pixel_layout(pb, descriptor); break; default: if (IS_KLV_KEY(uid, mxf_sony_mpeg4_extradata)) { descriptor->extradata = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE); if (!descriptor->extradata) return AVERROR(ENOMEM); descriptor->extradata_size = size; avio_read(pb, descriptor->extradata, size); } break; } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(void *VAR_0, AVIOContext *VAR_1, int VAR_2, int VAR_3, UID VAR_4, int64_t VAR_5) { MXFDescriptor *descriptor = VAR_0; descriptor->pix_fmt = AV_PIX_FMT_NONE; switch(VAR_2) { case 0x3F01: descriptor->sub_descriptors_count = avio_rb32(VAR_1); if (descriptor->sub_descriptors_count >= UINT_MAX / sizeof(UID)) return AVERROR_INVALIDDATA; descriptor->sub_descriptors_refs = av_malloc(descriptor->sub_descriptors_count * sizeof(UID)); if (!descriptor->sub_descriptors_refs) return AVERROR(ENOMEM); avio_skip(VAR_1, 4); avio_read(VAR_1, (uint8_t *)descriptor->sub_descriptors_refs, descriptor->sub_descriptors_count * sizeof(UID)); break; case 0x3004: avio_read(VAR_1, descriptor->essence_container_ul, 16); break; case 0x3006: descriptor->linked_track_id = avio_rb32(VAR_1); break; case 0x3201: avio_read(VAR_1, descriptor->essence_codec_ul, 16); break; case 0x3203: descriptor->width = avio_rb32(VAR_1); break; case 0x3202: descriptor->height = avio_rb32(VAR_1); break; case 0x320C: descriptor->frame_layout = avio_r8(VAR_1); break; case 0x320E: descriptor->aspect_ratio.num = avio_rb32(VAR_1); descriptor->aspect_ratio.den = avio_rb32(VAR_1); break; case 0x3301: descriptor->component_depth = avio_rb32(VAR_1); break; case 0x3302: descriptor->horiz_subsampling = avio_rb32(VAR_1); break; case 0x3308: descriptor->vert_subsampling = avio_rb32(VAR_1); break; case 0x3D03: descriptor->sample_rate.num = avio_rb32(VAR_1); descriptor->sample_rate.den = avio_rb32(VAR_1); break; case 0x3D06: avio_read(VAR_1, descriptor->essence_codec_ul, 16); break; case 0x3D07: descriptor->channels = avio_rb32(VAR_1); break; case 0x3D01: descriptor->bits_per_sample = avio_rb32(VAR_1); break; case 0x3401: mxf_read_pixel_layout(VAR_1, descriptor); break; default: if (IS_KLV_KEY(VAR_4, mxf_sony_mpeg4_extradata)) { descriptor->extradata = av_malloc(VAR_3 + FF_INPUT_BUFFER_PADDING_SIZE); if (!descriptor->extradata) return AVERROR(ENOMEM); descriptor->extradata_size = VAR_3; avio_read(VAR_1, descriptor->extradata, VAR_3); } break; } return 0; }
[ "static int FUNC_0(void *VAR_0, AVIOContext *VAR_1, int VAR_2, int VAR_3, UID VAR_4, int64_t VAR_5)\n{", "MXFDescriptor *descriptor = VAR_0;", "descriptor->pix_fmt = AV_PIX_FMT_NONE;", "switch(VAR_2) {", "case 0x3F01:\ndescriptor->sub_descriptors_count = avio_rb32(VAR_1);", "if (descriptor->sub_descriptors_count >= UINT_MAX / sizeof(UID))\nreturn AVERROR_INVALIDDATA;", "descriptor->sub_descriptors_refs = av_malloc(descriptor->sub_descriptors_count * sizeof(UID));", "if (!descriptor->sub_descriptors_refs)\nreturn AVERROR(ENOMEM);", "avio_skip(VAR_1, 4);", "avio_read(VAR_1, (uint8_t *)descriptor->sub_descriptors_refs, descriptor->sub_descriptors_count * sizeof(UID));", "break;", "case 0x3004:\navio_read(VAR_1, descriptor->essence_container_ul, 16);", "break;", "case 0x3006:\ndescriptor->linked_track_id = avio_rb32(VAR_1);", "break;", "case 0x3201:\navio_read(VAR_1, descriptor->essence_codec_ul, 16);", "break;", "case 0x3203:\ndescriptor->width = avio_rb32(VAR_1);", "break;", "case 0x3202:\ndescriptor->height = avio_rb32(VAR_1);", "break;", "case 0x320C:\ndescriptor->frame_layout = avio_r8(VAR_1);", "break;", "case 0x320E:\ndescriptor->aspect_ratio.num = avio_rb32(VAR_1);", "descriptor->aspect_ratio.den = avio_rb32(VAR_1);", "break;", "case 0x3301:\ndescriptor->component_depth = avio_rb32(VAR_1);", "break;", "case 0x3302:\ndescriptor->horiz_subsampling = avio_rb32(VAR_1);", "break;", "case 0x3308:\ndescriptor->vert_subsampling = avio_rb32(VAR_1);", "break;", "case 0x3D03:\ndescriptor->sample_rate.num = avio_rb32(VAR_1);", "descriptor->sample_rate.den = avio_rb32(VAR_1);", "break;", "case 0x3D06:\navio_read(VAR_1, descriptor->essence_codec_ul, 16);", "break;", "case 0x3D07:\ndescriptor->channels = avio_rb32(VAR_1);", "break;", "case 0x3D01:\ndescriptor->bits_per_sample = avio_rb32(VAR_1);", "break;", "case 0x3401:\nmxf_read_pixel_layout(VAR_1, descriptor);", "break;", "default:\nif (IS_KLV_KEY(VAR_4, mxf_sony_mpeg4_extradata)) {", "descriptor->extradata = av_malloc(VAR_3 + FF_INPUT_BUFFER_PADDING_SIZE);", "if (!descriptor->extradata)\nreturn AVERROR(ENOMEM);", "descriptor->extradata_size = VAR_3;", "avio_read(VAR_1, descriptor->extradata, VAR_3);", "}", "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, 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, 129 ], [ 133 ], [ 135, 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ] ]
17,855
int pt_removexattr(FsContext *ctx, const char *path, const char *name) { char *buffer; int ret; buffer = rpath(ctx, path); ret = lremovexattr(path, name); g_free(buffer); return ret; }
true
qemu
72f0d0bf51362011c4d841a89fb8f5cfb16e0bf3
int pt_removexattr(FsContext *ctx, const char *path, const char *name) { char *buffer; int ret; buffer = rpath(ctx, path); ret = lremovexattr(path, name); g_free(buffer); return ret; }
{ "code": [ " char *buffer;", " buffer = rpath(ctx, path);", " g_free(buffer);", " char *buffer;", " buffer = rpath(ctx, path);", " g_free(buffer);", " char *buffer;", " int ret;", " buffer = rpath(ctx, path);", " g_free(buffer);", " return ret;", "int pt_removexattr(FsContext *ctx, const char *path, const char *name)", " char *buffer;", " buffer = rpath(ctx, path);", " ret = lremovexattr(path, name);", " g_free(buffer);" ], "line_no": [ 5, 11, 15, 5, 11, 15, 5, 7, 11, 15, 17, 1, 5, 11, 13, 15 ] }
int FUNC_0(FsContext *VAR_0, const char *VAR_1, const char *VAR_2) { char *VAR_3; int VAR_4; VAR_3 = rpath(VAR_0, VAR_1); VAR_4 = lremovexattr(VAR_1, VAR_2); g_free(VAR_3); return VAR_4; }
[ "int FUNC_0(FsContext *VAR_0, const char *VAR_1, const char *VAR_2)\n{", "char *VAR_3;", "int VAR_4;", "VAR_3 = rpath(VAR_0, VAR_1);", "VAR_4 = lremovexattr(VAR_1, VAR_2);", "g_free(VAR_3);", "return VAR_4;", "}" ]
[ 1, 1, 1, 1, 1, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ] ]
17,856
int64_t ff_ape_parse_tag(AVFormatContext *s) { AVIOContext *pb = s->pb; int file_size = avio_size(pb); uint32_t val, fields, tag_bytes; uint8_t buf[8]; int64_t tag_start; int i; if (file_size < APE_TAG_FOOTER_BYTES) return 0; avio_seek(pb, file_size - APE_TAG_FOOTER_BYTES, SEEK_SET); avio_read(pb, buf, 8); /* APETAGEX */ if (strncmp(buf, "APETAGEX", 8)) { return 0; } val = avio_rl32(pb); /* APE tag version */ if (val > APE_TAG_VERSION) { av_log(s, AV_LOG_ERROR, "Unsupported tag version. (>=%d)\n", APE_TAG_VERSION); return 0; } tag_bytes = avio_rl32(pb); /* tag size */ if (tag_bytes - APE_TAG_FOOTER_BYTES > (1024 * 1024 * 16)) { av_log(s, AV_LOG_ERROR, "Tag size is way too big\n"); return 0; } tag_start = file_size - tag_bytes - APE_TAG_FOOTER_BYTES; if (tag_start < 0) { av_log(s, AV_LOG_ERROR, "Invalid tag size %u.\n", tag_bytes); return 0; } fields = avio_rl32(pb); /* number of fields */ if (fields > 65536) { av_log(s, AV_LOG_ERROR, "Too many tag fields (%d)\n", fields); return 0; } val = avio_rl32(pb); /* flags */ if (val & APE_TAG_FLAG_IS_HEADER) { av_log(s, AV_LOG_ERROR, "APE Tag is a header\n"); return 0; } avio_seek(pb, file_size - tag_bytes, SEEK_SET); for (i=0; i<fields; i++) if (ape_tag_read_field(s) < 0) break; return tag_start; }
true
FFmpeg
b655cfefafd565590bfc5976b9ce8dd141b3c41c
int64_t ff_ape_parse_tag(AVFormatContext *s) { AVIOContext *pb = s->pb; int file_size = avio_size(pb); uint32_t val, fields, tag_bytes; uint8_t buf[8]; int64_t tag_start; int i; if (file_size < APE_TAG_FOOTER_BYTES) return 0; avio_seek(pb, file_size - APE_TAG_FOOTER_BYTES, SEEK_SET); avio_read(pb, buf, 8); if (strncmp(buf, "APETAGEX", 8)) { return 0; } val = avio_rl32(pb); if (val > APE_TAG_VERSION) { av_log(s, AV_LOG_ERROR, "Unsupported tag version. (>=%d)\n", APE_TAG_VERSION); return 0; } tag_bytes = avio_rl32(pb); if (tag_bytes - APE_TAG_FOOTER_BYTES > (1024 * 1024 * 16)) { av_log(s, AV_LOG_ERROR, "Tag size is way too big\n"); return 0; } tag_start = file_size - tag_bytes - APE_TAG_FOOTER_BYTES; if (tag_start < 0) { av_log(s, AV_LOG_ERROR, "Invalid tag size %u.\n", tag_bytes); return 0; } fields = avio_rl32(pb); if (fields > 65536) { av_log(s, AV_LOG_ERROR, "Too many tag fields (%d)\n", fields); return 0; } val = avio_rl32(pb); if (val & APE_TAG_FLAG_IS_HEADER) { av_log(s, AV_LOG_ERROR, "APE Tag is a header\n"); return 0; } avio_seek(pb, file_size - tag_bytes, SEEK_SET); for (i=0; i<fields; i++) if (ape_tag_read_field(s) < 0) break; return tag_start; }
{ "code": [ " tag_start = file_size - tag_bytes - APE_TAG_FOOTER_BYTES;", " if (tag_start < 0) {" ], "line_no": [ 63, 65 ] }
int64_t FUNC_0(AVFormatContext *s) { AVIOContext *pb = s->pb; int VAR_0 = avio_size(pb); uint32_t val, fields, tag_bytes; uint8_t buf[8]; int64_t tag_start; int VAR_1; if (VAR_0 < APE_TAG_FOOTER_BYTES) return 0; avio_seek(pb, VAR_0 - APE_TAG_FOOTER_BYTES, SEEK_SET); avio_read(pb, buf, 8); if (strncmp(buf, "APETAGEX", 8)) { return 0; } val = avio_rl32(pb); if (val > APE_TAG_VERSION) { av_log(s, AV_LOG_ERROR, "Unsupported tag version. (>=%d)\n", APE_TAG_VERSION); return 0; } tag_bytes = avio_rl32(pb); if (tag_bytes - APE_TAG_FOOTER_BYTES > (1024 * 1024 * 16)) { av_log(s, AV_LOG_ERROR, "Tag size is way too big\n"); return 0; } tag_start = VAR_0 - tag_bytes - APE_TAG_FOOTER_BYTES; if (tag_start < 0) { av_log(s, AV_LOG_ERROR, "Invalid tag size %u.\n", tag_bytes); return 0; } fields = avio_rl32(pb); if (fields > 65536) { av_log(s, AV_LOG_ERROR, "Too many tag fields (%d)\n", fields); return 0; } val = avio_rl32(pb); if (val & APE_TAG_FLAG_IS_HEADER) { av_log(s, AV_LOG_ERROR, "APE Tag is a header\n"); return 0; } avio_seek(pb, VAR_0 - tag_bytes, SEEK_SET); for (VAR_1=0; VAR_1<fields; VAR_1++) if (ape_tag_read_field(s) < 0) break; return tag_start; }
[ "int64_t FUNC_0(AVFormatContext *s)\n{", "AVIOContext *pb = s->pb;", "int VAR_0 = avio_size(pb);", "uint32_t val, fields, tag_bytes;", "uint8_t buf[8];", "int64_t tag_start;", "int VAR_1;", "if (VAR_0 < APE_TAG_FOOTER_BYTES)\nreturn 0;", "avio_seek(pb, VAR_0 - APE_TAG_FOOTER_BYTES, SEEK_SET);", "avio_read(pb, buf, 8);", "if (strncmp(buf, \"APETAGEX\", 8)) {", "return 0;", "}", "val = avio_rl32(pb);", "if (val > APE_TAG_VERSION) {", "av_log(s, AV_LOG_ERROR, \"Unsupported tag version. (>=%d)\\n\", APE_TAG_VERSION);", "return 0;", "}", "tag_bytes = avio_rl32(pb);", "if (tag_bytes - APE_TAG_FOOTER_BYTES > (1024 * 1024 * 16)) {", "av_log(s, AV_LOG_ERROR, \"Tag size is way too big\\n\");", "return 0;", "}", "tag_start = VAR_0 - tag_bytes - APE_TAG_FOOTER_BYTES;", "if (tag_start < 0) {", "av_log(s, AV_LOG_ERROR, \"Invalid tag size %u.\\n\", tag_bytes);", "return 0;", "}", "fields = avio_rl32(pb);", "if (fields > 65536) {", "av_log(s, AV_LOG_ERROR, \"Too many tag fields (%d)\\n\", fields);", "return 0;", "}", "val = avio_rl32(pb);", "if (val & APE_TAG_FLAG_IS_HEADER) {", "av_log(s, AV_LOG_ERROR, \"APE Tag is a header\\n\");", "return 0;", "}", "avio_seek(pb, VAR_0 - tag_bytes, SEEK_SET);", "for (VAR_1=0; VAR_1<fields; VAR_1++)", "if (ape_tag_read_field(s) < 0) break;", "return tag_start;", "}" ]
[ 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19, 21 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99 ], [ 103 ], [ 105 ], [ 109 ], [ 111 ] ]
17,857
static void* attribute_align_arg worker(void *v) { ThreadContext *c = v; int our_job = c->nb_jobs; int nb_threads = c->nb_threads; unsigned int last_execute = 0; int self_id; pthread_mutex_lock(&c->current_job_lock); self_id = c->current_job++; for (;;) { while (our_job >= c->nb_jobs) { if (c->current_job == nb_threads + c->nb_jobs) pthread_cond_signal(&c->last_job_cond); while (last_execute == c->current_execute && !c->done) pthread_cond_wait(&c->current_job_cond, &c->current_job_lock); last_execute = c->current_execute; our_job = self_id; if (c->done) { pthread_mutex_unlock(&c->current_job_lock); return NULL; } } pthread_mutex_unlock(&c->current_job_lock); c->rets[our_job % c->nb_rets] = c->func(c->ctx, c->arg, our_job, c->nb_jobs); pthread_mutex_lock(&c->current_job_lock); our_job = c->current_job++; } }
true
FFmpeg
473f0f75a16b4d37bdaa943f75e4ae249212c1ba
static void* attribute_align_arg worker(void *v) { ThreadContext *c = v; int our_job = c->nb_jobs; int nb_threads = c->nb_threads; unsigned int last_execute = 0; int self_id; pthread_mutex_lock(&c->current_job_lock); self_id = c->current_job++; for (;;) { while (our_job >= c->nb_jobs) { if (c->current_job == nb_threads + c->nb_jobs) pthread_cond_signal(&c->last_job_cond); while (last_execute == c->current_execute && !c->done) pthread_cond_wait(&c->current_job_cond, &c->current_job_lock); last_execute = c->current_execute; our_job = self_id; if (c->done) { pthread_mutex_unlock(&c->current_job_lock); return NULL; } } pthread_mutex_unlock(&c->current_job_lock); c->rets[our_job % c->nb_rets] = c->func(c->ctx, c->arg, our_job, c->nb_jobs); pthread_mutex_lock(&c->current_job_lock); our_job = c->current_job++; } }
{ "code": [ " int self_id;", " c->rets[our_job % c->nb_rets] = c->func(c->ctx, c->arg, our_job, c->nb_jobs);" ], "line_no": [ 13, 55 ] }
static void* VAR_0 worker(void *v) { ThreadContext *c = v; int our_job = c->nb_jobs; int nb_threads = c->nb_threads; unsigned int last_execute = 0; int self_id; pthread_mutex_lock(&c->current_job_lock); self_id = c->current_job++; for (;;) { while (our_job >= c->nb_jobs) { if (c->current_job == nb_threads + c->nb_jobs) pthread_cond_signal(&c->last_job_cond); while (last_execute == c->current_execute && !c->done) pthread_cond_wait(&c->current_job_cond, &c->current_job_lock); last_execute = c->current_execute; our_job = self_id; if (c->done) { pthread_mutex_unlock(&c->current_job_lock); return NULL; } } pthread_mutex_unlock(&c->current_job_lock); c->rets[our_job % c->nb_rets] = c->func(c->ctx, c->arg, our_job, c->nb_jobs); pthread_mutex_lock(&c->current_job_lock); our_job = c->current_job++; } }
[ "static void* VAR_0 worker(void *v)\n{", "ThreadContext *c = v;", "int our_job = c->nb_jobs;", "int nb_threads = c->nb_threads;", "unsigned int last_execute = 0;", "int self_id;", "pthread_mutex_lock(&c->current_job_lock);", "self_id = c->current_job++;", "for (;;) {", "while (our_job >= c->nb_jobs) {", "if (c->current_job == nb_threads + c->nb_jobs)\npthread_cond_signal(&c->last_job_cond);", "while (last_execute == c->current_execute && !c->done)\npthread_cond_wait(&c->current_job_cond, &c->current_job_lock);", "last_execute = c->current_execute;", "our_job = self_id;", "if (c->done) {", "pthread_mutex_unlock(&c->current_job_lock);", "return NULL;", "}", "}", "pthread_mutex_unlock(&c->current_job_lock);", "c->rets[our_job % c->nb_rets] = c->func(c->ctx, c->arg, our_job, c->nb_jobs);", "pthread_mutex_lock(&c->current_job_lock);", "our_job = c->current_job++;", "}", "}" ]
[ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25, 27 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ] ]
17,859
static void pc87312_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); dc->realize = pc87312_realize; dc->reset = pc87312_reset; dc->vmsd = &vmstate_pc87312; dc->props = pc87312_properties; }
true
qemu
35deebb2327227d8c5f4816476befb06f6329de6
static void pc87312_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); dc->realize = pc87312_realize; dc->reset = pc87312_reset; dc->vmsd = &vmstate_pc87312; dc->props = pc87312_properties; }
{ "code": [], "line_no": [] }
static void FUNC_0(ObjectClass *VAR_0, void *VAR_1) { DeviceClass *dc = DEVICE_CLASS(VAR_0); dc->realize = pc87312_realize; dc->reset = pc87312_reset; dc->vmsd = &vmstate_pc87312; dc->props = pc87312_properties; }
[ "static void FUNC_0(ObjectClass *VAR_0, void *VAR_1)\n{", "DeviceClass *dc = DEVICE_CLASS(VAR_0);", "dc->realize = pc87312_realize;", "dc->reset = pc87312_reset;", "dc->vmsd = &vmstate_pc87312;", "dc->props = pc87312_properties;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ] ]
17,860
static int mkv_field_order(MatroskaDemuxContext *matroska, int64_t field_order) { int major, minor, micro, bttb = 0; /* workaround a bug in our Matroska muxer, introduced in version 57.36 alongside * this function, and fixed in 57.52 */ if (sscanf(matroska->muxingapp, "Lavf%d.%d.%d", &major, &minor, &micro) == 3) bttb = (major == 57 && minor >= 36 && minor <= 51 && micro >= 100); switch (field_order) { case MATROSKA_VIDEO_FIELDORDER_PROGRESSIVE: return AV_FIELD_PROGRESSIVE; case MATROSKA_VIDEO_FIELDORDER_UNDETERMINED: return AV_FIELD_UNKNOWN; case MATROSKA_VIDEO_FIELDORDER_TT: return AV_FIELD_TT; case MATROSKA_VIDEO_FIELDORDER_BB: return AV_FIELD_BB; case MATROSKA_VIDEO_FIELDORDER_BT: return bttb ? AV_FIELD_TB : AV_FIELD_BT; case MATROSKA_VIDEO_FIELDORDER_TB: return bttb ? AV_FIELD_BT : AV_FIELD_TB; default: return AV_FIELD_UNKNOWN; } }
true
FFmpeg
eb751f06db9f627c8b5c63d08836a39f7572bf56
static int mkv_field_order(MatroskaDemuxContext *matroska, int64_t field_order) { int major, minor, micro, bttb = 0; if (sscanf(matroska->muxingapp, "Lavf%d.%d.%d", &major, &minor, &micro) == 3) bttb = (major == 57 && minor >= 36 && minor <= 51 && micro >= 100); switch (field_order) { case MATROSKA_VIDEO_FIELDORDER_PROGRESSIVE: return AV_FIELD_PROGRESSIVE; case MATROSKA_VIDEO_FIELDORDER_UNDETERMINED: return AV_FIELD_UNKNOWN; case MATROSKA_VIDEO_FIELDORDER_TT: return AV_FIELD_TT; case MATROSKA_VIDEO_FIELDORDER_BB: return AV_FIELD_BB; case MATROSKA_VIDEO_FIELDORDER_BT: return bttb ? AV_FIELD_TB : AV_FIELD_BT; case MATROSKA_VIDEO_FIELDORDER_TB: return bttb ? AV_FIELD_BT : AV_FIELD_TB; default: return AV_FIELD_UNKNOWN; } }
{ "code": [ " if (sscanf(matroska->muxingapp, \"Lavf%d.%d.%d\", &major, &minor, &micro) == 3)" ], "line_no": [ 13 ] }
static int FUNC_0(MatroskaDemuxContext *VAR_0, int64_t VAR_1) { int VAR_2, VAR_3, VAR_4, VAR_5 = 0; if (sscanf(VAR_0->muxingapp, "Lavf%d.%d.%d", &VAR_2, &VAR_3, &VAR_4) == 3) VAR_5 = (VAR_2 == 57 && VAR_3 >= 36 && VAR_3 <= 51 && VAR_4 >= 100); switch (VAR_1) { case MATROSKA_VIDEO_FIELDORDER_PROGRESSIVE: return AV_FIELD_PROGRESSIVE; case MATROSKA_VIDEO_FIELDORDER_UNDETERMINED: return AV_FIELD_UNKNOWN; case MATROSKA_VIDEO_FIELDORDER_TT: return AV_FIELD_TT; case MATROSKA_VIDEO_FIELDORDER_BB: return AV_FIELD_BB; case MATROSKA_VIDEO_FIELDORDER_BT: return VAR_5 ? AV_FIELD_TB : AV_FIELD_BT; case MATROSKA_VIDEO_FIELDORDER_TB: return VAR_5 ? AV_FIELD_BT : AV_FIELD_TB; default: return AV_FIELD_UNKNOWN; } }
[ "static int FUNC_0(MatroskaDemuxContext *VAR_0, int64_t VAR_1)\n{", "int VAR_2, VAR_3, VAR_4, VAR_5 = 0;", "if (sscanf(VAR_0->muxingapp, \"Lavf%d.%d.%d\", &VAR_2, &VAR_3, &VAR_4) == 3)\nVAR_5 = (VAR_2 == 57 && VAR_3 >= 36 && VAR_3 <= 51 && VAR_4 >= 100);", "switch (VAR_1) {", "case MATROSKA_VIDEO_FIELDORDER_PROGRESSIVE:\nreturn AV_FIELD_PROGRESSIVE;", "case MATROSKA_VIDEO_FIELDORDER_UNDETERMINED:\nreturn AV_FIELD_UNKNOWN;", "case MATROSKA_VIDEO_FIELDORDER_TT:\nreturn AV_FIELD_TT;", "case MATROSKA_VIDEO_FIELDORDER_BB:\nreturn AV_FIELD_BB;", "case MATROSKA_VIDEO_FIELDORDER_BT:\nreturn VAR_5 ? AV_FIELD_TB : AV_FIELD_BT;", "case MATROSKA_VIDEO_FIELDORDER_TB:\nreturn VAR_5 ? AV_FIELD_BT : AV_FIELD_TB;", "default:\nreturn AV_FIELD_UNKNOWN;", "}", "}" ]
[ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 13, 15 ], [ 19 ], [ 21, 23 ], [ 25, 27 ], [ 29, 31 ], [ 33, 35 ], [ 37, 39 ], [ 41, 43 ], [ 45, 47 ], [ 49 ], [ 51 ] ]
17,861
av_cold void ff_fft_init_arm(FFTContext *s) { int cpu_flags = av_get_cpu_flags(); if (have_vfp(cpu_flags) && !have_vfpv3(cpu_flags)) { s->fft_calc = ff_fft_calc_vfp; #if CONFIG_MDCT s->imdct_half = ff_imdct_half_vfp; #endif } if (have_neon(cpu_flags)) { s->fft_permute = ff_fft_permute_neon; s->fft_calc = ff_fft_calc_neon; #if CONFIG_MDCT s->imdct_calc = ff_imdct_calc_neon; s->imdct_half = ff_imdct_half_neon; s->mdct_calc = ff_mdct_calc_neon; s->mdct_permutation = FF_MDCT_PERM_INTERLEAVE; #endif } }
true
FFmpeg
e2710e790c09e49e86baa58c6063af0097cc8cb0
av_cold void ff_fft_init_arm(FFTContext *s) { int cpu_flags = av_get_cpu_flags(); if (have_vfp(cpu_flags) && !have_vfpv3(cpu_flags)) { s->fft_calc = ff_fft_calc_vfp; #if CONFIG_MDCT s->imdct_half = ff_imdct_half_vfp; #endif } if (have_neon(cpu_flags)) { s->fft_permute = ff_fft_permute_neon; s->fft_calc = ff_fft_calc_neon; #if CONFIG_MDCT s->imdct_calc = ff_imdct_calc_neon; s->imdct_half = ff_imdct_half_neon; s->mdct_calc = ff_mdct_calc_neon; s->mdct_permutation = FF_MDCT_PERM_INTERLEAVE; #endif } }
{ "code": [ " if (have_vfp(cpu_flags) && !have_vfpv3(cpu_flags)) {", " if (have_vfp(cpu_flags) && !have_vfpv3(cpu_flags)) {" ], "line_no": [ 9, 9 ] }
av_cold void FUNC_0(FFTContext *s) { int VAR_0 = av_get_cpu_flags(); if (have_vfp(VAR_0) && !have_vfpv3(VAR_0)) { s->fft_calc = ff_fft_calc_vfp; #if CONFIG_MDCT s->imdct_half = ff_imdct_half_vfp; #endif } if (have_neon(VAR_0)) { s->fft_permute = ff_fft_permute_neon; s->fft_calc = ff_fft_calc_neon; #if CONFIG_MDCT s->imdct_calc = ff_imdct_calc_neon; s->imdct_half = ff_imdct_half_neon; s->mdct_calc = ff_mdct_calc_neon; s->mdct_permutation = FF_MDCT_PERM_INTERLEAVE; #endif } }
[ "av_cold void FUNC_0(FFTContext *s)\n{", "int VAR_0 = av_get_cpu_flags();", "if (have_vfp(VAR_0) && !have_vfpv3(VAR_0)) {", "s->fft_calc = ff_fft_calc_vfp;", "#if CONFIG_MDCT\ns->imdct_half = ff_imdct_half_vfp;", "#endif\n}", "if (have_neon(VAR_0)) {", "s->fft_permute = ff_fft_permute_neon;", "s->fft_calc = ff_fft_calc_neon;", "#if CONFIG_MDCT\ns->imdct_calc = ff_imdct_calc_neon;", "s->imdct_half = ff_imdct_half_neon;", "s->mdct_calc = ff_mdct_calc_neon;", "s->mdct_permutation = FF_MDCT_PERM_INTERLEAVE;", "#endif\n}", "}" ]
[ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13, 15 ], [ 17, 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29, 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39, 41 ], [ 43 ] ]
17,862
unsigned long find_next_bit(const unsigned long *addr, unsigned long size, unsigned long offset) { const unsigned long *p = addr + BITOP_WORD(offset); unsigned long result = offset & ~(BITS_PER_LONG-1); unsigned long tmp; if (offset >= size) { return size; } size -= result; offset %= BITS_PER_LONG; if (offset) { tmp = *(p++); tmp &= (~0UL << offset); if (size < BITS_PER_LONG) { goto found_first; } if (tmp) { goto found_middle; } size -= BITS_PER_LONG; result += BITS_PER_LONG; } while (size & ~(BITS_PER_LONG-1)) { if ((tmp = *(p++))) { goto found_middle; } result += BITS_PER_LONG; size -= BITS_PER_LONG; } if (!size) { return result; } tmp = *p; found_first: tmp &= (~0UL >> (BITS_PER_LONG - size)); if (tmp == 0UL) { /* Are any bits set? */ return result + size; /* Nope. */ } found_middle: return result + bitops_ffsl(tmp); }
true
qemu
fbeadf50f2f965741def823036b086bbc2999b1f
unsigned long find_next_bit(const unsigned long *addr, unsigned long size, unsigned long offset) { const unsigned long *p = addr + BITOP_WORD(offset); unsigned long result = offset & ~(BITS_PER_LONG-1); unsigned long tmp; if (offset >= size) { return size; } size -= result; offset %= BITS_PER_LONG; if (offset) { tmp = *(p++); tmp &= (~0UL << offset); if (size < BITS_PER_LONG) { goto found_first; } if (tmp) { goto found_middle; } size -= BITS_PER_LONG; result += BITS_PER_LONG; } while (size & ~(BITS_PER_LONG-1)) { if ((tmp = *(p++))) { goto found_middle; } result += BITS_PER_LONG; size -= BITS_PER_LONG; } if (!size) { return result; } tmp = *p; found_first: tmp &= (~0UL >> (BITS_PER_LONG - size)); if (tmp == 0UL) { return result + size; } found_middle: return result + bitops_ffsl(tmp); }
{ "code": [ " return result + bitops_ffsl(tmp);" ], "line_no": [ 85 ] }
unsigned long FUNC_0(const unsigned long *VAR_0, unsigned long VAR_1, unsigned long VAR_2) { const unsigned long *VAR_3 = VAR_0 + BITOP_WORD(VAR_2); unsigned long VAR_4 = VAR_2 & ~(BITS_PER_LONG-1); unsigned long VAR_5; if (VAR_2 >= VAR_1) { return VAR_1; } VAR_1 -= VAR_4; VAR_2 %= BITS_PER_LONG; if (VAR_2) { VAR_5 = *(VAR_3++); VAR_5 &= (~0UL << VAR_2); if (VAR_1 < BITS_PER_LONG) { goto found_first; } if (VAR_5) { goto found_middle; } VAR_1 -= BITS_PER_LONG; VAR_4 += BITS_PER_LONG; } while (VAR_1 & ~(BITS_PER_LONG-1)) { if ((VAR_5 = *(VAR_3++))) { goto found_middle; } VAR_4 += BITS_PER_LONG; VAR_1 -= BITS_PER_LONG; } if (!VAR_1) { return VAR_4; } VAR_5 = *VAR_3; found_first: VAR_5 &= (~0UL >> (BITS_PER_LONG - VAR_1)); if (VAR_5 == 0UL) { return VAR_4 + VAR_1; } found_middle: return VAR_4 + bitops_ffsl(VAR_5); }
[ "unsigned long FUNC_0(const unsigned long *VAR_0, unsigned long VAR_1,\nunsigned long VAR_2)\n{", "const unsigned long *VAR_3 = VAR_0 + BITOP_WORD(VAR_2);", "unsigned long VAR_4 = VAR_2 & ~(BITS_PER_LONG-1);", "unsigned long VAR_5;", "if (VAR_2 >= VAR_1) {", "return VAR_1;", "}", "VAR_1 -= VAR_4;", "VAR_2 %= BITS_PER_LONG;", "if (VAR_2) {", "VAR_5 = *(VAR_3++);", "VAR_5 &= (~0UL << VAR_2);", "if (VAR_1 < BITS_PER_LONG) {", "goto found_first;", "}", "if (VAR_5) {", "goto found_middle;", "}", "VAR_1 -= BITS_PER_LONG;", "VAR_4 += BITS_PER_LONG;", "}", "while (VAR_1 & ~(BITS_PER_LONG-1)) {", "if ((VAR_5 = *(VAR_3++))) {", "goto found_middle;", "}", "VAR_4 += BITS_PER_LONG;", "VAR_1 -= BITS_PER_LONG;", "}", "if (!VAR_1) {", "return VAR_4;", "}", "VAR_5 = *VAR_3;", "found_first:\nVAR_5 &= (~0UL >> (BITS_PER_LONG - VAR_1));", "if (VAR_5 == 0UL) {", "return VAR_4 + VAR_1;", "}", "found_middle:\nreturn VAR_4 + bitops_ffsl(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, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 73, 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83, 85 ], [ 87 ] ]
17,863
void migration_set_outgoing_channel(MigrationState *s, QIOChannel *ioc) { QEMUFile *f = qemu_fopen_channel_output(ioc); s->to_dst_file = f; migrate_fd_connect(s); }
true
qemu
e122636562218b3d442cd2cd18fbc188dd9ce709
void migration_set_outgoing_channel(MigrationState *s, QIOChannel *ioc) { QEMUFile *f = qemu_fopen_channel_output(ioc); s->to_dst_file = f; migrate_fd_connect(s); }
{ "code": [ " QIOChannel *ioc)", " QEMUFile *f = qemu_fopen_channel_output(ioc);", " s->to_dst_file = f;", " migrate_fd_connect(s);" ], "line_no": [ 3, 7, 11, 15 ] }
void FUNC_0(MigrationState *VAR_0, QIOChannel *VAR_1) { QEMUFile *f = qemu_fopen_channel_output(VAR_1); VAR_0->to_dst_file = f; migrate_fd_connect(VAR_0); }
[ "void FUNC_0(MigrationState *VAR_0,\nQIOChannel *VAR_1)\n{", "QEMUFile *f = qemu_fopen_channel_output(VAR_1);", "VAR_0->to_dst_file = f;", "migrate_fd_connect(VAR_0);", "}" ]
[ 1, 1, 1, 1, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 15 ], [ 17 ] ]
17,864
static void qemu_wait_io_event_common(CPUState *cpu) { if (cpu->stop) { cpu->stop = false; cpu->stopped = true; qemu_cond_broadcast(&qemu_pause_cond); } process_queued_cpu_work(cpu); cpu->thread_kicked = false; }
true
qemu
372579427a5040a26dfee78464b50e2bdf27ef26
static void qemu_wait_io_event_common(CPUState *cpu) { if (cpu->stop) { cpu->stop = false; cpu->stopped = true; qemu_cond_broadcast(&qemu_pause_cond); } process_queued_cpu_work(cpu); cpu->thread_kicked = false; }
{ "code": [ " cpu->thread_kicked = false;" ], "line_no": [ 17 ] }
static void FUNC_0(CPUState *VAR_0) { if (VAR_0->stop) { VAR_0->stop = false; VAR_0->stopped = true; qemu_cond_broadcast(&qemu_pause_cond); } process_queued_cpu_work(VAR_0); VAR_0->thread_kicked = false; }
[ "static void FUNC_0(CPUState *VAR_0)\n{", "if (VAR_0->stop) {", "VAR_0->stop = false;", "VAR_0->stopped = true;", "qemu_cond_broadcast(&qemu_pause_cond);", "}", "process_queued_cpu_work(VAR_0);", "VAR_0->thread_kicked = false;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ] ]
17,865
static void ahci_test_identify(AHCIQState *ahci) { uint16_t buff[256]; unsigned px; int rc; uint16_t sect_size; const size_t buffsize = 512; g_assert(ahci != NULL); /** * This serves as a bit of a tutorial on AHCI device programming: * * (1) Create a data buffer for the IDENTIFY response to be sent to * (2) Create a Command Table buffer, where we will store the * command and PRDT (Physical Region Descriptor Table) * (3) Construct an FIS host-to-device command structure, and write it to * the top of the Command Table buffer. * (4) Create one or more Physical Region Descriptors (PRDs) that describe * a location in memory where data may be stored/retrieved. * (5) Write these PRDTs to the bottom (offset 0x80) of the Command Table. * (6) Each AHCI port has up to 32 command slots. Each slot contains a * header that points to a Command Table buffer. Pick an unused slot * and update it to point to the Command Table we have built. * (7) Now: Command #n points to our Command Table, and our Command Table * contains the FIS (that describes our command) and the PRDTL, which * describes our buffer. * (8) We inform the HBA via PxCI (Command Issue) that the command in slot * #n is ready for processing. */ /* Pick the first implemented and running port */ px = ahci_port_select(ahci); g_test_message("Selected port %u for test", px); /* Clear out the FIS Receive area and any pending interrupts. */ ahci_port_clear(ahci, px); /* "Read" 512 bytes using CMD_IDENTIFY into the host buffer. */ ahci_io(ahci, px, CMD_IDENTIFY, &buff, buffsize); /* Check serial number/version in the buffer */ /* NB: IDENTIFY strings are packed in 16bit little endian chunks. * Since we copy byte-for-byte in ahci-test, on both LE and BE, we need to * unchunk this data. By contrast, ide-test copies 2 bytes at a time, and * as a consequence, only needs to unchunk the data on LE machines. */ string_bswap16(&buff[10], 20); rc = memcmp(&buff[10], "testdisk ", 20); g_assert_cmphex(rc, ==, 0); string_bswap16(&buff[23], 8); rc = memcmp(&buff[23], "version ", 8); g_assert_cmphex(rc, ==, 0); }
true
qemu
122482a398db9f02287efce9eec26e08dac82bcd
static void ahci_test_identify(AHCIQState *ahci) { uint16_t buff[256]; unsigned px; int rc; uint16_t sect_size; const size_t buffsize = 512; g_assert(ahci != NULL); px = ahci_port_select(ahci); g_test_message("Selected port %u for test", px); ahci_port_clear(ahci, px); ahci_io(ahci, px, CMD_IDENTIFY, &buff, buffsize); string_bswap16(&buff[10], 20); rc = memcmp(&buff[10], "testdisk ", 20); g_assert_cmphex(rc, ==, 0); string_bswap16(&buff[23], 8); rc = memcmp(&buff[23], "version ", 8); g_assert_cmphex(rc, ==, 0); }
{ "code": [], "line_no": [] }
static void FUNC_0(AHCIQState *VAR_0) { uint16_t buff[256]; unsigned VAR_1; int VAR_2; uint16_t sect_size; const size_t VAR_3 = 512; g_assert(VAR_0 != NULL); VAR_1 = ahci_port_select(VAR_0); g_test_message("Selected port %u for test", VAR_1); ahci_port_clear(VAR_0, VAR_1); ahci_io(VAR_0, VAR_1, CMD_IDENTIFY, &buff, VAR_3); string_bswap16(&buff[10], 20); VAR_2 = memcmp(&buff[10], "testdisk ", 20); g_assert_cmphex(VAR_2, ==, 0); string_bswap16(&buff[23], 8); VAR_2 = memcmp(&buff[23], "version ", 8); g_assert_cmphex(VAR_2, ==, 0); }
[ "static void FUNC_0(AHCIQState *VAR_0)\n{", "uint16_t buff[256];", "unsigned VAR_1;", "int VAR_2;", "uint16_t sect_size;", "const size_t VAR_3 = 512;", "g_assert(VAR_0 != NULL);", "VAR_1 = ahci_port_select(VAR_0);", "g_test_message(\"Selected port %u for test\", VAR_1);", "ahci_port_clear(VAR_0, VAR_1);", "ahci_io(VAR_0, VAR_1, CMD_IDENTIFY, &buff, VAR_3);", "string_bswap16(&buff[10], 20);", "VAR_2 = memcmp(&buff[10], \"testdisk \", 20);", "g_assert_cmphex(VAR_2, ==, 0);", "string_bswap16(&buff[23], 8);", "VAR_2 = memcmp(&buff[23], \"version \", 8);", "g_assert_cmphex(VAR_2, ==, 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 ], [ 30 ], [ 31 ], [ 33 ], [ 35 ], [ 41 ], [ 42 ], [ 43 ], [ 44 ], [ 45 ], [ 46 ], [ 47 ] ]
17,867
static void rc4030_realize(DeviceState *dev, Error **errp) { rc4030State *s = RC4030(dev); Object *o = OBJECT(dev); int i; s->periodic_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, rc4030_periodic_timer, s); memory_region_init_io(&s->iomem_chipset, NULL, &rc4030_ops, s, "rc4030.chipset", 0x300); memory_region_init_io(&s->iomem_jazzio, NULL, &jazzio_ops, s, "rc4030.jazzio", 0x00001000); memory_region_init_rom_device(&s->dma_tt, o, &rc4030_dma_tt_ops, s, "dma-table", MAX_TL_ENTRIES * sizeof(dma_pagetable_entry), NULL); memory_region_init(&s->dma_tt_alias, o, "dma-table-alias", 0); memory_region_init(&s->dma_mr, o, "dma", INT32_MAX); for (i = 0; i < MAX_TL_ENTRIES; ++i) { memory_region_init_alias(&s->dma_mrs[i], o, "dma-alias", get_system_memory(), 0, DMA_PAGESIZE); memory_region_set_enabled(&s->dma_mrs[i], false); memory_region_add_subregion(&s->dma_mr, i * DMA_PAGESIZE, &s->dma_mrs[i]); } address_space_init(&s->dma_as, &s->dma_mr, "rc4030-dma"); }
true
qemu
c627e7526a902dd5bb1907dbbd5cf961679dfa68
static void rc4030_realize(DeviceState *dev, Error **errp) { rc4030State *s = RC4030(dev); Object *o = OBJECT(dev); int i; s->periodic_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, rc4030_periodic_timer, s); memory_region_init_io(&s->iomem_chipset, NULL, &rc4030_ops, s, "rc4030.chipset", 0x300); memory_region_init_io(&s->iomem_jazzio, NULL, &jazzio_ops, s, "rc4030.jazzio", 0x00001000); memory_region_init_rom_device(&s->dma_tt, o, &rc4030_dma_tt_ops, s, "dma-table", MAX_TL_ENTRIES * sizeof(dma_pagetable_entry), NULL); memory_region_init(&s->dma_tt_alias, o, "dma-table-alias", 0); memory_region_init(&s->dma_mr, o, "dma", INT32_MAX); for (i = 0; i < MAX_TL_ENTRIES; ++i) { memory_region_init_alias(&s->dma_mrs[i], o, "dma-alias", get_system_memory(), 0, DMA_PAGESIZE); memory_region_set_enabled(&s->dma_mrs[i], false); memory_region_add_subregion(&s->dma_mr, i * DMA_PAGESIZE, &s->dma_mrs[i]); } address_space_init(&s->dma_as, &s->dma_mr, "rc4030-dma"); }
{ "code": [ " int i;", " memory_region_init_rom_device(&s->dma_tt, o,", " &rc4030_dma_tt_ops, s, \"dma-table\",", " MAX_TL_ENTRIES * sizeof(dma_pagetable_entry),", " NULL);", " memory_region_init(&s->dma_tt_alias, o, \"dma-table-alias\", 0);", " memory_region_init(&s->dma_mr, o, \"dma\", INT32_MAX);", " for (i = 0; i < MAX_TL_ENTRIES; ++i) {", " memory_region_init_alias(&s->dma_mrs[i], o, \"dma-alias\",", " get_system_memory(), 0, DMA_PAGESIZE);", " memory_region_set_enabled(&s->dma_mrs[i], false);", " memory_region_add_subregion(&s->dma_mr, i * DMA_PAGESIZE,", " &s->dma_mrs[i]);", " int i;", " for (i = 0; i < MAX_TL_ENTRIES; ++i) {" ], "line_no": [ 9, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 9, 41 ] }
static void FUNC_0(DeviceState *VAR_0, Error **VAR_1) { rc4030State *s = RC4030(VAR_0); Object *o = OBJECT(VAR_0); int VAR_2; s->periodic_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, rc4030_periodic_timer, s); memory_region_init_io(&s->iomem_chipset, NULL, &rc4030_ops, s, "rc4030.chipset", 0x300); memory_region_init_io(&s->iomem_jazzio, NULL, &jazzio_ops, s, "rc4030.jazzio", 0x00001000); memory_region_init_rom_device(&s->dma_tt, o, &rc4030_dma_tt_ops, s, "dma-table", MAX_TL_ENTRIES * sizeof(dma_pagetable_entry), NULL); memory_region_init(&s->dma_tt_alias, o, "dma-table-alias", 0); memory_region_init(&s->dma_mr, o, "dma", INT32_MAX); for (VAR_2 = 0; VAR_2 < MAX_TL_ENTRIES; ++VAR_2) { memory_region_init_alias(&s->dma_mrs[VAR_2], o, "dma-alias", get_system_memory(), 0, DMA_PAGESIZE); memory_region_set_enabled(&s->dma_mrs[VAR_2], false); memory_region_add_subregion(&s->dma_mr, VAR_2 * DMA_PAGESIZE, &s->dma_mrs[VAR_2]); } address_space_init(&s->dma_as, &s->dma_mr, "rc4030-dma"); }
[ "static void FUNC_0(DeviceState *VAR_0, Error **VAR_1)\n{", "rc4030State *s = RC4030(VAR_0);", "Object *o = OBJECT(VAR_0);", "int VAR_2;", "s->periodic_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL,\nrc4030_periodic_timer, s);", "memory_region_init_io(&s->iomem_chipset, NULL, &rc4030_ops, s,\n\"rc4030.chipset\", 0x300);", "memory_region_init_io(&s->iomem_jazzio, NULL, &jazzio_ops, s,\n\"rc4030.jazzio\", 0x00001000);", "memory_region_init_rom_device(&s->dma_tt, o,\n&rc4030_dma_tt_ops, s, \"dma-table\",\nMAX_TL_ENTRIES * sizeof(dma_pagetable_entry),\nNULL);", "memory_region_init(&s->dma_tt_alias, o, \"dma-table-alias\", 0);", "memory_region_init(&s->dma_mr, o, \"dma\", INT32_MAX);", "for (VAR_2 = 0; VAR_2 < MAX_TL_ENTRIES; ++VAR_2) {", "memory_region_init_alias(&s->dma_mrs[VAR_2], o, \"dma-alias\",\nget_system_memory(), 0, DMA_PAGESIZE);", "memory_region_set_enabled(&s->dma_mrs[VAR_2], false);", "memory_region_add_subregion(&s->dma_mr, VAR_2 * DMA_PAGESIZE,\n&s->dma_mrs[VAR_2]);", "}", "address_space_init(&s->dma_as, &s->dma_mr, \"rc4030-dma\");", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13, 15 ], [ 19, 21 ], [ 23, 25 ], [ 29, 31, 33, 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49, 51 ], [ 53 ], [ 55 ], [ 57 ] ]
17,868
static int fourxm_probe(AVProbeData *p) { if ((AV_RL32(&p->buf[0]) != RIFF_TAG) || (AV_RL32(&p->buf[8]) != _4XMV_TAG)) return 0; return AVPROBE_SCORE_MAX; }
true
FFmpeg
c54286ab08e0c55dba72e4e9718e81b416e585d0
static int fourxm_probe(AVProbeData *p) { if ((AV_RL32(&p->buf[0]) != RIFF_TAG) || (AV_RL32(&p->buf[8]) != _4XMV_TAG)) return 0; return AVPROBE_SCORE_MAX; }
{ "code": [ " (AV_RL32(&p->buf[8]) != _4XMV_TAG))" ], "line_no": [ 7 ] }
static int FUNC_0(AVProbeData *VAR_0) { if ((AV_RL32(&VAR_0->buf[0]) != RIFF_TAG) || (AV_RL32(&VAR_0->buf[8]) != _4XMV_TAG)) return 0; return AVPROBE_SCORE_MAX; }
[ "static int FUNC_0(AVProbeData *VAR_0)\n{", "if ((AV_RL32(&VAR_0->buf[0]) != RIFF_TAG) ||\n(AV_RL32(&VAR_0->buf[8]) != _4XMV_TAG))\nreturn 0;", "return AVPROBE_SCORE_MAX;", "}" ]
[ 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5, 7, 9 ], [ 13 ], [ 15 ] ]
17,869
void monitor_disas(Monitor *mon, CPUState *cpu, target_ulong pc, int nb_insn, int is_physical) { CPUClass *cc = CPU_GET_CLASS(cpu); int count, i; CPUDebug s; INIT_DISASSEMBLE_INFO(s.info, (FILE *)mon, monitor_fprintf); s.cpu = cpu; monitor_disas_is_physical = is_physical; s.info.read_memory_func = monitor_read_memory; s.info.print_address_func = generic_print_address; s.info.buffer_vma = pc; s.info.cap_arch = -1; s.info.cap_mode = 0; #ifdef TARGET_WORDS_BIGENDIAN s.info.endian = BFD_ENDIAN_BIG; #else s.info.endian = BFD_ENDIAN_LITTLE; #endif if (cc->disas_set_info) { cc->disas_set_info(cpu, &s.info); } if (s.info.cap_arch >= 0 && cap_disas_monitor(&s.info, pc, nb_insn)) { return; } if (!s.info.print_insn) { monitor_printf(mon, "0x" TARGET_FMT_lx ": Asm output not supported on this arch\n", pc); return; } for(i = 0; i < nb_insn; i++) { monitor_printf(mon, "0x" TARGET_FMT_lx ": ", pc); count = s.info.print_insn(pc, &s.info); monitor_printf(mon, "\n"); if (count < 0) break; pc += count; } }
true
qemu
b8d8720892f7912e8a2621b30ebac0e9a48e89e3
void monitor_disas(Monitor *mon, CPUState *cpu, target_ulong pc, int nb_insn, int is_physical) { CPUClass *cc = CPU_GET_CLASS(cpu); int count, i; CPUDebug s; INIT_DISASSEMBLE_INFO(s.info, (FILE *)mon, monitor_fprintf); s.cpu = cpu; monitor_disas_is_physical = is_physical; s.info.read_memory_func = monitor_read_memory; s.info.print_address_func = generic_print_address; s.info.buffer_vma = pc; s.info.cap_arch = -1; s.info.cap_mode = 0; #ifdef TARGET_WORDS_BIGENDIAN s.info.endian = BFD_ENDIAN_BIG; #else s.info.endian = BFD_ENDIAN_LITTLE; #endif if (cc->disas_set_info) { cc->disas_set_info(cpu, &s.info); } if (s.info.cap_arch >= 0 && cap_disas_monitor(&s.info, pc, nb_insn)) { return; } if (!s.info.print_insn) { monitor_printf(mon, "0x" TARGET_FMT_lx ": Asm output not supported on this arch\n", pc); return; } for(i = 0; i < nb_insn; i++) { monitor_printf(mon, "0x" TARGET_FMT_lx ": ", pc); count = s.info.print_insn(pc, &s.info); monitor_printf(mon, "\n"); if (count < 0) break; pc += count; } }
{ "code": [ " monitor_disas_is_physical = is_physical;", " s.info.read_memory_func = monitor_read_memory;" ], "line_no": [ 21, 23 ] }
void FUNC_0(Monitor *VAR_0, CPUState *VAR_1, target_ulong VAR_2, int VAR_3, int VAR_4) { CPUClass *cc = CPU_GET_CLASS(VAR_1); int VAR_5, VAR_6; CPUDebug s; INIT_DISASSEMBLE_INFO(s.info, (FILE *)VAR_0, monitor_fprintf); s.VAR_1 = VAR_1; monitor_disas_is_physical = VAR_4; s.info.read_memory_func = monitor_read_memory; s.info.print_address_func = generic_print_address; s.info.buffer_vma = VAR_2; s.info.cap_arch = -1; s.info.cap_mode = 0; #ifdef TARGET_WORDS_BIGENDIAN s.info.endian = BFD_ENDIAN_BIG; #else s.info.endian = BFD_ENDIAN_LITTLE; #endif if (cc->disas_set_info) { cc->disas_set_info(VAR_1, &s.info); } if (s.info.cap_arch >= 0 && cap_disas_monitor(&s.info, VAR_2, VAR_3)) { return; } if (!s.info.print_insn) { monitor_printf(VAR_0, "0x" TARGET_FMT_lx ": Asm output not supported on this arch\n", VAR_2); return; } for(VAR_6 = 0; VAR_6 < VAR_3; VAR_6++) { monitor_printf(VAR_0, "0x" TARGET_FMT_lx ": ", VAR_2); VAR_5 = s.info.print_insn(VAR_2, &s.info); monitor_printf(VAR_0, "\n"); if (VAR_5 < 0) break; VAR_2 += VAR_5; } }
[ "void FUNC_0(Monitor *VAR_0, CPUState *VAR_1,\ntarget_ulong VAR_2, int VAR_3, int VAR_4)\n{", "CPUClass *cc = CPU_GET_CLASS(VAR_1);", "int VAR_5, VAR_6;", "CPUDebug s;", "INIT_DISASSEMBLE_INFO(s.info, (FILE *)VAR_0, monitor_fprintf);", "s.VAR_1 = VAR_1;", "monitor_disas_is_physical = VAR_4;", "s.info.read_memory_func = monitor_read_memory;", "s.info.print_address_func = generic_print_address;", "s.info.buffer_vma = VAR_2;", "s.info.cap_arch = -1;", "s.info.cap_mode = 0;", "#ifdef TARGET_WORDS_BIGENDIAN\ns.info.endian = BFD_ENDIAN_BIG;", "#else\ns.info.endian = BFD_ENDIAN_LITTLE;", "#endif\nif (cc->disas_set_info) {", "cc->disas_set_info(VAR_1, &s.info);", "}", "if (s.info.cap_arch >= 0 && cap_disas_monitor(&s.info, VAR_2, VAR_3)) {", "return;", "}", "if (!s.info.print_insn) {", "monitor_printf(VAR_0, \"0x\" TARGET_FMT_lx\n\": Asm output not supported on this arch\\n\", VAR_2);", "return;", "}", "for(VAR_6 = 0; VAR_6 < VAR_3; VAR_6++) {", "monitor_printf(VAR_0, \"0x\" TARGET_FMT_lx \": \", VAR_2);", "VAR_5 = s.info.print_insn(VAR_2, &s.info);", "monitor_printf(VAR_0, \"\\n\");", "if (VAR_5 < 0)\nbreak;", "VAR_2 += VAR_5;", "}", "}" ]
[ 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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35, 37 ], [ 39, 41 ], [ 43, 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65, 67 ], [ 69 ], [ 71 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83, 85 ], [ 87 ], [ 89 ], [ 91 ] ]
17,870
static struct omap_pwl_s *omap_pwl_init(MemoryRegion *system_memory, hwaddr base, omap_clk clk) { struct omap_pwl_s *s = g_malloc0(sizeof(*s)); omap_pwl_reset(s); memory_region_init_io(&s->iomem, NULL, &omap_pwl_ops, s, "omap-pwl", 0x800); memory_region_add_subregion(system_memory, base, &s->iomem); omap_clk_adduser(clk, qemu_allocate_irqs(omap_pwl_clk_update, s, 1)[0]); return s; }
true
qemu
f3c7d0389fe8a2792fd4c1cf151b885de03c8f62
static struct omap_pwl_s *omap_pwl_init(MemoryRegion *system_memory, hwaddr base, omap_clk clk) { struct omap_pwl_s *s = g_malloc0(sizeof(*s)); omap_pwl_reset(s); memory_region_init_io(&s->iomem, NULL, &omap_pwl_ops, s, "omap-pwl", 0x800); memory_region_add_subregion(system_memory, base, &s->iomem); omap_clk_adduser(clk, qemu_allocate_irqs(omap_pwl_clk_update, s, 1)[0]); return s; }
{ "code": [ " omap_clk_adduser(clk, qemu_allocate_irqs(omap_pwl_clk_update, s, 1)[0]);" ], "line_no": [ 25 ] }
static struct omap_pwl_s *FUNC_0(MemoryRegion *VAR_0, hwaddr VAR_1, omap_clk VAR_2) { struct omap_pwl_s *VAR_3 = g_malloc0(sizeof(*VAR_3)); omap_pwl_reset(VAR_3); memory_region_init_io(&VAR_3->iomem, NULL, &omap_pwl_ops, VAR_3, "omap-pwl", 0x800); memory_region_add_subregion(VAR_0, VAR_1, &VAR_3->iomem); omap_clk_adduser(VAR_2, qemu_allocate_irqs(omap_pwl_clk_update, VAR_3, 1)[0]); return VAR_3; }
[ "static struct omap_pwl_s *FUNC_0(MemoryRegion *VAR_0,\nhwaddr VAR_1,\nomap_clk VAR_2)\n{", "struct omap_pwl_s *VAR_3 = g_malloc0(sizeof(*VAR_3));", "omap_pwl_reset(VAR_3);", "memory_region_init_io(&VAR_3->iomem, NULL, &omap_pwl_ops, VAR_3,\n\"omap-pwl\", 0x800);", "memory_region_add_subregion(VAR_0, VAR_1, &VAR_3->iomem);", "omap_clk_adduser(VAR_2, qemu_allocate_irqs(omap_pwl_clk_update, VAR_3, 1)[0]);", "return VAR_3;", "}" ]
[ 0, 0, 0, 0, 0, 1, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 13 ], [ 17, 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ] ]
17,872
static int amr_nb_decode_frame(AVCodecContext * avctx, void *data, int *data_size, uint8_t * buf, int buf_size) { AMRContext *s = avctx->priv_data; uint8_t*amrData=buf; int offset=0; UWord8 toc, q, ft; Word16 serial[SERIAL_FRAMESIZE]; /* coded bits */ Word16 *synth; UWord8 *packed_bits; static Word16 packed_size[16] = {12, 13, 15, 17, 19, 20, 26, 31, 5, 0, 0, 0, 0, 0, 0, 0}; int i; //printf("amr_decode_frame data_size=%i buf=0x%X buf_size=%d frameCount=%d!!\n",*data_size,buf,buf_size,s->frameCount); synth=data; // while(offset<buf_size) { toc=amrData[offset]; /* read rest of the frame based on ToC byte */ q = (toc >> 2) & 0x01; ft = (toc >> 3) & 0x0F; //printf("offset=%d, packet_size=%d amrData= 0x%X %X %X %X\n",offset,packed_size[ft],amrData[offset],amrData[offset+1],amrData[offset+2],amrData[offset+3]); offset++; packed_bits=amrData+offset; offset+=packed_size[ft]; //Unsort and unpack bits s->rx_type = UnpackBits(q, ft, packed_bits, &s->mode, &serial[1]); //We have a new frame s->frameCount++; if (s->rx_type == RX_NO_DATA) { s->mode = s->speech_decoder_state->prev_mode; } else { s->speech_decoder_state->prev_mode = s->mode; } /* if homed: check if this frame is another homing frame */ if (s->reset_flag_old == 1) { /* only check until end of first subframe */ s->reset_flag = decoder_homing_frame_test_first(&serial[1], s->mode); } /* produce encoder homing frame if homed & input=decoder homing frame */ if ((s->reset_flag != 0) && (s->reset_flag_old != 0)) { for (i = 0; i < L_FRAME; i++) { synth[i] = EHF_MASK; } } else { /* decode frame */ Speech_Decode_Frame(s->speech_decoder_state, s->mode, &serial[1], s->rx_type, synth); } //Each AMR-frame results in 160 16-bit samples *data_size+=160*2; synth+=160; /* if not homed: check whether current frame is a homing frame */ if (s->reset_flag_old == 0) { /* check whole frame */ s->reset_flag = decoder_homing_frame_test(&serial[1], s->mode); } /* reset decoder if current frame is a homing frame */ if (s->reset_flag != 0) { Speech_Decode_Frame_reset(s->speech_decoder_state); } s->reset_flag_old = s->reset_flag; } return offset; }
false
FFmpeg
636b69c5a4445a28d509e803ff528c753047ef9d
static int amr_nb_decode_frame(AVCodecContext * avctx, void *data, int *data_size, uint8_t * buf, int buf_size) { AMRContext *s = avctx->priv_data; uint8_t*amrData=buf; int offset=0; UWord8 toc, q, ft; Word16 serial[SERIAL_FRAMESIZE]; Word16 *synth; UWord8 *packed_bits; static Word16 packed_size[16] = {12, 13, 15, 17, 19, 20, 26, 31, 5, 0, 0, 0, 0, 0, 0, 0}; int i; synth=data; { toc=amrData[offset]; q = (toc >> 2) & 0x01; ft = (toc >> 3) & 0x0F; offset++; packed_bits=amrData+offset; offset+=packed_size[ft]; s->rx_type = UnpackBits(q, ft, packed_bits, &s->mode, &serial[1]); s->frameCount++; if (s->rx_type == RX_NO_DATA) { s->mode = s->speech_decoder_state->prev_mode; } else { s->speech_decoder_state->prev_mode = s->mode; } if (s->reset_flag_old == 1) { s->reset_flag = decoder_homing_frame_test_first(&serial[1], s->mode); } if ((s->reset_flag != 0) && (s->reset_flag_old != 0)) { for (i = 0; i < L_FRAME; i++) { synth[i] = EHF_MASK; } } else { Speech_Decode_Frame(s->speech_decoder_state, s->mode, &serial[1], s->rx_type, synth); } *data_size+=160*2; synth+=160; if (s->reset_flag_old == 0) { s->reset_flag = decoder_homing_frame_test(&serial[1], s->mode); } if (s->reset_flag != 0) { Speech_Decode_Frame_reset(s->speech_decoder_state); } s->reset_flag_old = s->reset_flag; } return offset; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext * VAR_0, void *VAR_1, int *VAR_2, uint8_t * VAR_3, int VAR_4) { AMRContext *s = VAR_0->priv_data; uint8_t*amrData=VAR_3; int VAR_5=0; UWord8 toc, q, ft; Word16 serial[SERIAL_FRAMESIZE]; Word16 *synth; UWord8 *packed_bits; static Word16 VAR_6[16] = {12, 13, 15, 17, 19, 20, 26, 31, 5, 0, 0, 0, 0, 0, 0, 0}; int VAR_7; synth=VAR_1; { toc=amrData[VAR_5]; q = (toc >> 2) & 0x01; ft = (toc >> 3) & 0x0F; VAR_5++; packed_bits=amrData+VAR_5; VAR_5+=VAR_6[ft]; s->rx_type = UnpackBits(q, ft, packed_bits, &s->mode, &serial[1]); s->frameCount++; if (s->rx_type == RX_NO_DATA) { s->mode = s->speech_decoder_state->prev_mode; } else { s->speech_decoder_state->prev_mode = s->mode; } if (s->reset_flag_old == 1) { s->reset_flag = decoder_homing_frame_test_first(&serial[1], s->mode); } if ((s->reset_flag != 0) && (s->reset_flag_old != 0)) { for (VAR_7 = 0; VAR_7 < L_FRAME; VAR_7++) { synth[VAR_7] = EHF_MASK; } } else { Speech_Decode_Frame(s->speech_decoder_state, s->mode, &serial[1], s->rx_type, synth); } *VAR_2+=160*2; synth+=160; if (s->reset_flag_old == 0) { s->reset_flag = decoder_homing_frame_test(&serial[1], s->mode); } if (s->reset_flag != 0) { Speech_Decode_Frame_reset(s->speech_decoder_state); } s->reset_flag_old = s->reset_flag; } return VAR_5; }
[ "static int FUNC_0(AVCodecContext * VAR_0,\nvoid *VAR_1, int *VAR_2,\nuint8_t * VAR_3, int VAR_4)\n{", "AMRContext *s = VAR_0->priv_data;", "uint8_t*amrData=VAR_3;", "int VAR_5=0;", "UWord8 toc, q, ft;", "Word16 serial[SERIAL_FRAMESIZE];", "Word16 *synth;", "UWord8 *packed_bits;", "static Word16 VAR_6[16] = {12, 13, 15, 17, 19, 20, 26, 31, 5, 0, 0, 0, 0, 0, 0, 0};", "int VAR_7;", "synth=VAR_1;", "{", "toc=amrData[VAR_5];", "q = (toc >> 2) & 0x01;", "ft = (toc >> 3) & 0x0F;", "VAR_5++;", "packed_bits=amrData+VAR_5;", "VAR_5+=VAR_6[ft];", "s->rx_type = UnpackBits(q, ft, packed_bits, &s->mode, &serial[1]);", "s->frameCount++;", "if (s->rx_type == RX_NO_DATA)\n{", "s->mode = s->speech_decoder_state->prev_mode;", "}", "else {", "s->speech_decoder_state->prev_mode = s->mode;", "}", "if (s->reset_flag_old == 1)\n{", "s->reset_flag = decoder_homing_frame_test_first(&serial[1], s->mode);", "}", "if ((s->reset_flag != 0) && (s->reset_flag_old != 0))\n{", "for (VAR_7 = 0; VAR_7 < L_FRAME; VAR_7++)", "{", "synth[VAR_7] = EHF_MASK;", "}", "}", "else\n{", "Speech_Decode_Frame(s->speech_decoder_state, s->mode, &serial[1], s->rx_type, synth);", "}", "*VAR_2+=160*2;", "synth+=160;", "if (s->reset_flag_old == 0)\n{", "s->reset_flag = decoder_homing_frame_test(&serial[1], s->mode);", "}", "if (s->reset_flag != 0)\n{", "Speech_Decode_Frame_reset(s->speech_decoder_state);", "}", "s->reset_flag_old = s->reset_flag;", "}", "return VAR_5;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 33 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 55 ], [ 59 ], [ 63 ], [ 69 ], [ 75 ], [ 79, 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 97, 99 ], [ 103 ], [ 105 ], [ 109, 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123, 125 ], [ 129 ], [ 131 ], [ 137 ], [ 139 ], [ 145, 147 ], [ 151 ], [ 153 ], [ 157, 159 ], [ 161 ], [ 163 ], [ 165 ], [ 169 ], [ 171 ], [ 173 ] ]
17,873
static int mov_write_stbl_tag(AVFormatContext *s, AVIOContext *pb, MOVMuxContext *mov, MOVTrack *track) { int64_t pos = avio_tell(pb); int ret; avio_wb32(pb, 0); /* size */ ffio_wfourcc(pb, "stbl"); mov_write_stsd_tag(s, pb, mov, track); mov_write_stts_tag(pb, track); if ((track->par->codec_type == AVMEDIA_TYPE_VIDEO || track->par->codec_tag == MKTAG('r','t','p',' ')) && track->has_keyframes && track->has_keyframes < track->entry) mov_write_stss_tag(pb, track, MOV_SYNC_SAMPLE); if (track->mode == MODE_MOV && track->flags & MOV_TRACK_STPS) mov_write_stss_tag(pb, track, MOV_PARTIAL_SYNC_SAMPLE); if (track->par->codec_type == AVMEDIA_TYPE_VIDEO && track->flags & MOV_TRACK_CTTS && track->entry) { if ((ret = mov_write_ctts_tag(pb, track)) < 0) return ret; } mov_write_stsc_tag(pb, track); mov_write_stsz_tag(pb, track); mov_write_stco_tag(pb, track); if (mov->encryption_scheme == MOV_ENC_CENC_AES_CTR) { ff_mov_cenc_write_stbl_atoms(&track->cenc, pb); } if (track->par->codec_id == AV_CODEC_ID_OPUS) { mov_preroll_write_stbl_atoms(pb, track); } return update_size(pb, pos); }
false
FFmpeg
15bd309af8302661838150de1905acc4df386d19
static int mov_write_stbl_tag(AVFormatContext *s, AVIOContext *pb, MOVMuxContext *mov, MOVTrack *track) { int64_t pos = avio_tell(pb); int ret; avio_wb32(pb, 0); ffio_wfourcc(pb, "stbl"); mov_write_stsd_tag(s, pb, mov, track); mov_write_stts_tag(pb, track); if ((track->par->codec_type == AVMEDIA_TYPE_VIDEO || track->par->codec_tag == MKTAG('r','t','p',' ')) && track->has_keyframes && track->has_keyframes < track->entry) mov_write_stss_tag(pb, track, MOV_SYNC_SAMPLE); if (track->mode == MODE_MOV && track->flags & MOV_TRACK_STPS) mov_write_stss_tag(pb, track, MOV_PARTIAL_SYNC_SAMPLE); if (track->par->codec_type == AVMEDIA_TYPE_VIDEO && track->flags & MOV_TRACK_CTTS && track->entry) { if ((ret = mov_write_ctts_tag(pb, track)) < 0) return ret; } mov_write_stsc_tag(pb, track); mov_write_stsz_tag(pb, track); mov_write_stco_tag(pb, track); if (mov->encryption_scheme == MOV_ENC_CENC_AES_CTR) { ff_mov_cenc_write_stbl_atoms(&track->cenc, pb); } if (track->par->codec_id == AV_CODEC_ID_OPUS) { mov_preroll_write_stbl_atoms(pb, track); } return update_size(pb, pos); }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0, AVIOContext *VAR_1, MOVMuxContext *VAR_2, MOVTrack *VAR_3) { int64_t pos = avio_tell(VAR_1); int VAR_4; avio_wb32(VAR_1, 0); ffio_wfourcc(VAR_1, "stbl"); mov_write_stsd_tag(VAR_0, VAR_1, VAR_2, VAR_3); mov_write_stts_tag(VAR_1, VAR_3); if ((VAR_3->par->codec_type == AVMEDIA_TYPE_VIDEO || VAR_3->par->codec_tag == MKTAG('r','t','p',' ')) && VAR_3->has_keyframes && VAR_3->has_keyframes < VAR_3->entry) mov_write_stss_tag(VAR_1, VAR_3, MOV_SYNC_SAMPLE); if (VAR_3->mode == MODE_MOV && VAR_3->flags & MOV_TRACK_STPS) mov_write_stss_tag(VAR_1, VAR_3, MOV_PARTIAL_SYNC_SAMPLE); if (VAR_3->par->codec_type == AVMEDIA_TYPE_VIDEO && VAR_3->flags & MOV_TRACK_CTTS && VAR_3->entry) { if ((VAR_4 = mov_write_ctts_tag(VAR_1, VAR_3)) < 0) return VAR_4; } mov_write_stsc_tag(VAR_1, VAR_3); mov_write_stsz_tag(VAR_1, VAR_3); mov_write_stco_tag(VAR_1, VAR_3); if (VAR_2->encryption_scheme == MOV_ENC_CENC_AES_CTR) { ff_mov_cenc_write_stbl_atoms(&VAR_3->cenc, VAR_1); } if (VAR_3->par->codec_id == AV_CODEC_ID_OPUS) { mov_preroll_write_stbl_atoms(VAR_1, VAR_3); } return update_size(VAR_1, pos); }
[ "static int FUNC_0(AVFormatContext *VAR_0, AVIOContext *VAR_1, MOVMuxContext *VAR_2, MOVTrack *VAR_3)\n{", "int64_t pos = avio_tell(VAR_1);", "int VAR_4;", "avio_wb32(VAR_1, 0);", "ffio_wfourcc(VAR_1, \"stbl\");", "mov_write_stsd_tag(VAR_0, VAR_1, VAR_2, VAR_3);", "mov_write_stts_tag(VAR_1, VAR_3);", "if ((VAR_3->par->codec_type == AVMEDIA_TYPE_VIDEO ||\nVAR_3->par->codec_tag == MKTAG('r','t','p',' ')) &&\nVAR_3->has_keyframes && VAR_3->has_keyframes < VAR_3->entry)\nmov_write_stss_tag(VAR_1, VAR_3, MOV_SYNC_SAMPLE);", "if (VAR_3->mode == MODE_MOV && VAR_3->flags & MOV_TRACK_STPS)\nmov_write_stss_tag(VAR_1, VAR_3, MOV_PARTIAL_SYNC_SAMPLE);", "if (VAR_3->par->codec_type == AVMEDIA_TYPE_VIDEO &&\nVAR_3->flags & MOV_TRACK_CTTS && VAR_3->entry) {", "if ((VAR_4 = mov_write_ctts_tag(VAR_1, VAR_3)) < 0)\nreturn VAR_4;", "}", "mov_write_stsc_tag(VAR_1, VAR_3);", "mov_write_stsz_tag(VAR_1, VAR_3);", "mov_write_stco_tag(VAR_1, VAR_3);", "if (VAR_2->encryption_scheme == MOV_ENC_CENC_AES_CTR) {", "ff_mov_cenc_write_stbl_atoms(&VAR_3->cenc, VAR_1);", "}", "if (VAR_3->par->codec_id == AV_CODEC_ID_OPUS) {", "mov_preroll_write_stbl_atoms(VAR_1, VAR_3);", "}", "return update_size(VAR_1, pos);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19, 21, 23, 25 ], [ 27, 29 ], [ 31, 33 ], [ 37, 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ] ]
17,874
static av_cold void h264dsp_init_neon(H264DSPContext *c, const int bit_depth, const int chroma_format_idc) { if (bit_depth == 8) { c->h264_v_loop_filter_luma = ff_h264_v_loop_filter_luma_neon; c->h264_h_loop_filter_luma = ff_h264_h_loop_filter_luma_neon; c->h264_v_loop_filter_chroma = ff_h264_v_loop_filter_chroma_neon; c->h264_h_loop_filter_chroma = ff_h264_h_loop_filter_chroma_neon; c->weight_h264_pixels_tab[0] = ff_weight_h264_pixels_16_neon; c->weight_h264_pixels_tab[1] = ff_weight_h264_pixels_8_neon; c->weight_h264_pixels_tab[2] = ff_weight_h264_pixels_4_neon; c->biweight_h264_pixels_tab[0] = ff_biweight_h264_pixels_16_neon; c->biweight_h264_pixels_tab[1] = ff_biweight_h264_pixels_8_neon; c->biweight_h264_pixels_tab[2] = ff_biweight_h264_pixels_4_neon; c->h264_idct_add = ff_h264_idct_add_neon; c->h264_idct_dc_add = ff_h264_idct_dc_add_neon; c->h264_idct_add16 = ff_h264_idct_add16_neon; c->h264_idct_add16intra = ff_h264_idct_add16intra_neon; if (chroma_format_idc == 1) c->h264_idct_add8 = ff_h264_idct_add8_neon; c->h264_idct8_add = ff_h264_idct8_add_neon; c->h264_idct8_dc_add = ff_h264_idct8_dc_add_neon; c->h264_idct8_add4 = ff_h264_idct8_add4_neon; } }
true
FFmpeg
a03a642d5ceb5f2f7c6ebbf56ff365dfbcdb65eb
static av_cold void h264dsp_init_neon(H264DSPContext *c, const int bit_depth, const int chroma_format_idc) { if (bit_depth == 8) { c->h264_v_loop_filter_luma = ff_h264_v_loop_filter_luma_neon; c->h264_h_loop_filter_luma = ff_h264_h_loop_filter_luma_neon; c->h264_v_loop_filter_chroma = ff_h264_v_loop_filter_chroma_neon; c->h264_h_loop_filter_chroma = ff_h264_h_loop_filter_chroma_neon; c->weight_h264_pixels_tab[0] = ff_weight_h264_pixels_16_neon; c->weight_h264_pixels_tab[1] = ff_weight_h264_pixels_8_neon; c->weight_h264_pixels_tab[2] = ff_weight_h264_pixels_4_neon; c->biweight_h264_pixels_tab[0] = ff_biweight_h264_pixels_16_neon; c->biweight_h264_pixels_tab[1] = ff_biweight_h264_pixels_8_neon; c->biweight_h264_pixels_tab[2] = ff_biweight_h264_pixels_4_neon; c->h264_idct_add = ff_h264_idct_add_neon; c->h264_idct_dc_add = ff_h264_idct_dc_add_neon; c->h264_idct_add16 = ff_h264_idct_add16_neon; c->h264_idct_add16intra = ff_h264_idct_add16intra_neon; if (chroma_format_idc == 1) c->h264_idct_add8 = ff_h264_idct_add8_neon; c->h264_idct8_add = ff_h264_idct8_add_neon; c->h264_idct8_dc_add = ff_h264_idct8_dc_add_neon; c->h264_idct8_add4 = ff_h264_idct8_add4_neon; } }
{ "code": [ " if (chroma_format_idc == 1)" ], "line_no": [ 43 ] }
static av_cold void FUNC_0(H264DSPContext *c, const int bit_depth, const int chroma_format_idc) { if (bit_depth == 8) { c->h264_v_loop_filter_luma = ff_h264_v_loop_filter_luma_neon; c->h264_h_loop_filter_luma = ff_h264_h_loop_filter_luma_neon; c->h264_v_loop_filter_chroma = ff_h264_v_loop_filter_chroma_neon; c->h264_h_loop_filter_chroma = ff_h264_h_loop_filter_chroma_neon; c->weight_h264_pixels_tab[0] = ff_weight_h264_pixels_16_neon; c->weight_h264_pixels_tab[1] = ff_weight_h264_pixels_8_neon; c->weight_h264_pixels_tab[2] = ff_weight_h264_pixels_4_neon; c->biweight_h264_pixels_tab[0] = ff_biweight_h264_pixels_16_neon; c->biweight_h264_pixels_tab[1] = ff_biweight_h264_pixels_8_neon; c->biweight_h264_pixels_tab[2] = ff_biweight_h264_pixels_4_neon; c->h264_idct_add = ff_h264_idct_add_neon; c->h264_idct_dc_add = ff_h264_idct_dc_add_neon; c->h264_idct_add16 = ff_h264_idct_add16_neon; c->h264_idct_add16intra = ff_h264_idct_add16intra_neon; if (chroma_format_idc == 1) c->h264_idct_add8 = ff_h264_idct_add8_neon; c->h264_idct8_add = ff_h264_idct8_add_neon; c->h264_idct8_dc_add = ff_h264_idct8_dc_add_neon; c->h264_idct8_add4 = ff_h264_idct8_add4_neon; } }
[ "static av_cold void FUNC_0(H264DSPContext *c, const int bit_depth,\nconst int chroma_format_idc)\n{", "if (bit_depth == 8) {", "c->h264_v_loop_filter_luma = ff_h264_v_loop_filter_luma_neon;", "c->h264_h_loop_filter_luma = ff_h264_h_loop_filter_luma_neon;", "c->h264_v_loop_filter_chroma = ff_h264_v_loop_filter_chroma_neon;", "c->h264_h_loop_filter_chroma = ff_h264_h_loop_filter_chroma_neon;", "c->weight_h264_pixels_tab[0] = ff_weight_h264_pixels_16_neon;", "c->weight_h264_pixels_tab[1] = ff_weight_h264_pixels_8_neon;", "c->weight_h264_pixels_tab[2] = ff_weight_h264_pixels_4_neon;", "c->biweight_h264_pixels_tab[0] = ff_biweight_h264_pixels_16_neon;", "c->biweight_h264_pixels_tab[1] = ff_biweight_h264_pixels_8_neon;", "c->biweight_h264_pixels_tab[2] = ff_biweight_h264_pixels_4_neon;", "c->h264_idct_add = ff_h264_idct_add_neon;", "c->h264_idct_dc_add = ff_h264_idct_dc_add_neon;", "c->h264_idct_add16 = ff_h264_idct_add16_neon;", "c->h264_idct_add16intra = ff_h264_idct_add16intra_neon;", "if (chroma_format_idc == 1)\nc->h264_idct_add8 = ff_h264_idct_add8_neon;", "c->h264_idct8_add = ff_h264_idct8_add_neon;", "c->h264_idct8_dc_add = ff_h264_idct8_dc_add_neon;", "c->h264_idct8_add4 = ff_h264_idct8_add4_neon;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ] ]
17,875
ssize_t qemu_sendv_packet(VLANClientState *vc1, const struct iovec *iov, int iovcnt) { VLANState *vlan = vc1->vlan; VLANClientState *vc; ssize_t max_len = 0; if (vc1->link_down) return calc_iov_length(iov, iovcnt); for (vc = vlan->first_client; vc != NULL; vc = vc->next) { ssize_t len = 0; if (vc == vc1) continue; if (vc->link_down) len = calc_iov_length(iov, iovcnt); else if (vc->fd_readv) len = vc->fd_readv(vc->opaque, iov, iovcnt); else if (vc->fd_read) len = vc_sendv_compat(vc, iov, iovcnt); max_len = MAX(max_len, len); } return max_len; }
true
qemu
c27ff60871aff588a35e51d1a90faed410993e55
ssize_t qemu_sendv_packet(VLANClientState *vc1, const struct iovec *iov, int iovcnt) { VLANState *vlan = vc1->vlan; VLANClientState *vc; ssize_t max_len = 0; if (vc1->link_down) return calc_iov_length(iov, iovcnt); for (vc = vlan->first_client; vc != NULL; vc = vc->next) { ssize_t len = 0; if (vc == vc1) continue; if (vc->link_down) len = calc_iov_length(iov, iovcnt); else if (vc->fd_readv) len = vc->fd_readv(vc->opaque, iov, iovcnt); else if (vc->fd_read) len = vc_sendv_compat(vc, iov, iovcnt); max_len = MAX(max_len, len); } return max_len; }
{ "code": [ "ssize_t qemu_sendv_packet(VLANClientState *vc1, const struct iovec *iov,", " VLANState *vlan = vc1->vlan;", " if (vc1->link_down)", " for (vc = vlan->first_client; vc != NULL; vc = vc->next) {", " ssize_t len = 0;", " if (vc == vc1)", " continue;", " if (vc->link_down)", " len = calc_iov_length(iov, iovcnt);", " else if (vc->fd_readv)", " len = vc->fd_readv(vc->opaque, iov, iovcnt);", " else if (vc->fd_read)", " len = vc_sendv_compat(vc, iov, iovcnt);", " max_len = MAX(max_len, len);" ], "line_no": [ 1, 7, 15, 21, 23, 27, 29, 33, 35, 37, 39, 41, 43, 47 ] }
ssize_t FUNC_0(VLANClientState *vc1, const struct iovec *iov, int iovcnt) { VLANState *vlan = vc1->vlan; VLANClientState *vc; ssize_t max_len = 0; if (vc1->link_down) return calc_iov_length(iov, iovcnt); for (vc = vlan->first_client; vc != NULL; vc = vc->next) { ssize_t len = 0; if (vc == vc1) continue; if (vc->link_down) len = calc_iov_length(iov, iovcnt); else if (vc->fd_readv) len = vc->fd_readv(vc->opaque, iov, iovcnt); else if (vc->fd_read) len = vc_sendv_compat(vc, iov, iovcnt); max_len = MAX(max_len, len); } return max_len; }
[ "ssize_t FUNC_0(VLANClientState *vc1, const struct iovec *iov,\nint iovcnt)\n{", "VLANState *vlan = vc1->vlan;", "VLANClientState *vc;", "ssize_t max_len = 0;", "if (vc1->link_down)\nreturn calc_iov_length(iov, iovcnt);", "for (vc = vlan->first_client; vc != NULL; vc = vc->next) {", "ssize_t len = 0;", "if (vc == vc1)\ncontinue;", "if (vc->link_down)\nlen = calc_iov_length(iov, iovcnt);", "else if (vc->fd_readv)\nlen = vc->fd_readv(vc->opaque, iov, iovcnt);", "else if (vc->fd_read)\nlen = vc_sendv_compat(vc, iov, iovcnt);", "max_len = MAX(max_len, len);", "}", "return max_len;", "}" ]
[ 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15, 17 ], [ 21 ], [ 23 ], [ 27, 29 ], [ 33, 35 ], [ 37, 39 ], [ 41, 43 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ] ]
17,876
static bool blit_region_is_unsafe(struct CirrusVGAState *s, int32_t pitch, int32_t addr) { if (pitch < 0) { int64_t min = addr + ((int64_t)s->cirrus_blt_height-1) * pitch; int32_t max = addr + s->cirrus_blt_width; if (min < 0 || max >= s->vga.vram_size) { return true; } } else { int64_t max = addr + ((int64_t)s->cirrus_blt_height-1) * pitch + s->cirrus_blt_width; if (max >= s->vga.vram_size) { return true; } } return false; }
true
qemu
d2ba7ecb348d3b996fcd920cf1ca7b72722c1dfd
static bool blit_region_is_unsafe(struct CirrusVGAState *s, int32_t pitch, int32_t addr) { if (pitch < 0) { int64_t min = addr + ((int64_t)s->cirrus_blt_height-1) * pitch; int32_t max = addr + s->cirrus_blt_width; if (min < 0 || max >= s->vga.vram_size) { return true; } } else { int64_t max = addr + ((int64_t)s->cirrus_blt_height-1) * pitch + s->cirrus_blt_width; if (max >= s->vga.vram_size) { return true; } } return false; }
{ "code": [ " if (min < 0 || max >= s->vga.vram_size) {", " if (max >= s->vga.vram_size) {" ], "line_no": [ 17, 31 ] }
static bool FUNC_0(struct CirrusVGAState *s, int32_t pitch, int32_t addr) { if (pitch < 0) { int64_t min = addr + ((int64_t)s->cirrus_blt_height-1) * pitch; int32_t max = addr + s->cirrus_blt_width; if (min < 0 || max >= s->vga.vram_size) { return true; } } else { int64_t max = addr + ((int64_t)s->cirrus_blt_height-1) * pitch + s->cirrus_blt_width; if (max >= s->vga.vram_size) { return true; } } return false; }
[ "static bool FUNC_0(struct CirrusVGAState *s,\nint32_t pitch, int32_t addr)\n{", "if (pitch < 0) {", "int64_t min = addr\n+ ((int64_t)s->cirrus_blt_height-1) * pitch;", "int32_t max = addr\n+ s->cirrus_blt_width;", "if (min < 0 || max >= s->vga.vram_size) {", "return true;", "}", "} else {", "int64_t max = addr\n+ ((int64_t)s->cirrus_blt_height-1) * pitch\n+ s->cirrus_blt_width;", "if (max >= s->vga.vram_size) {", "return true;", "}", "}", "return false;", "}" ]
[ 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 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 ] ]
17,879
static int rv10_decode_picture_header(MpegEncContext *s) { int mb_count, pb_frame, marker, h, full_frame; /* skip packet header */ h = get_bits(&s->gb, 8); if ((h & 0xc0) == 0xc0) { int len, pos; full_frame = 1; len = get_num(&s->gb); pos = get_num(&s->gb); } else { int seq, frame_size, pos; full_frame = 0; seq = get_bits(&s->gb, 8); frame_size = get_num(&s->gb); pos = get_num(&s->gb); } /* picture number */ get_bits(&s->gb, 8); marker = get_bits(&s->gb, 1); if (get_bits(&s->gb, 1)) s->pict_type = P_TYPE; else s->pict_type = I_TYPE; pb_frame = get_bits(&s->gb, 1); #ifdef DEBUG printf("pict_type=%d pb_frame=%d\n", s->pict_type, pb_frame); #endif if (pb_frame) return -1; s->qscale = get_bits(&s->gb, 5); if (s->pict_type == I_TYPE) { if (s->rv10_version == 3) { /* specific MPEG like DC coding not used */ s->last_dc[0] = get_bits(&s->gb, 8); s->last_dc[1] = get_bits(&s->gb, 8); s->last_dc[2] = get_bits(&s->gb, 8); #ifdef DEBUG printf("DC:%d %d %d\n", s->last_dc[0], s->last_dc[1], s->last_dc[2]); #endif } } /* if multiple packets per frame are sent, the position at which to display the macro blocks is coded here */ if (!full_frame) { s->mb_x = get_bits(&s->gb, 6); /* mb_x */ s->mb_y = get_bits(&s->gb, 6); /* mb_y */ mb_count = get_bits(&s->gb, 12); } else { s->mb_x = 0; s->mb_y = 0; mb_count = s->mb_width * s->mb_height; } get_bits(&s->gb, 3); /* ignored */ s->f_code = 1; s->unrestricted_mv = 1; #if 0 s->h263_long_vectors = 1; #endif return mb_count; }
true
FFmpeg
ee3b2be65da55cfe1fc17d1db75738535f99ceef
static int rv10_decode_picture_header(MpegEncContext *s) { int mb_count, pb_frame, marker, h, full_frame; h = get_bits(&s->gb, 8); if ((h & 0xc0) == 0xc0) { int len, pos; full_frame = 1; len = get_num(&s->gb); pos = get_num(&s->gb); } else { int seq, frame_size, pos; full_frame = 0; seq = get_bits(&s->gb, 8); frame_size = get_num(&s->gb); pos = get_num(&s->gb); } get_bits(&s->gb, 8); marker = get_bits(&s->gb, 1); if (get_bits(&s->gb, 1)) s->pict_type = P_TYPE; else s->pict_type = I_TYPE; pb_frame = get_bits(&s->gb, 1); #ifdef DEBUG printf("pict_type=%d pb_frame=%d\n", s->pict_type, pb_frame); #endif if (pb_frame) return -1; s->qscale = get_bits(&s->gb, 5); if (s->pict_type == I_TYPE) { if (s->rv10_version == 3) { s->last_dc[0] = get_bits(&s->gb, 8); s->last_dc[1] = get_bits(&s->gb, 8); s->last_dc[2] = get_bits(&s->gb, 8); #ifdef DEBUG printf("DC:%d %d %d\n", s->last_dc[0], s->last_dc[1], s->last_dc[2]); #endif } } if (!full_frame) { s->mb_x = get_bits(&s->gb, 6); s->mb_y = get_bits(&s->gb, 6); mb_count = get_bits(&s->gb, 12); } else { s->mb_x = 0; s->mb_y = 0; mb_count = s->mb_width * s->mb_height; } get_bits(&s->gb, 3); s->f_code = 1; s->unrestricted_mv = 1; #if 0 s->h263_long_vectors = 1; #endif return mb_count; }
{ "code": [], "line_no": [] }
static int FUNC_0(MpegEncContext *VAR_0) { int VAR_1, VAR_2, VAR_3, VAR_4, VAR_5; VAR_4 = get_bits(&VAR_0->gb, 8); if ((VAR_4 & 0xc0) == 0xc0) { int VAR_6, VAR_10; VAR_5 = 1; VAR_6 = get_num(&VAR_0->gb); VAR_10 = get_num(&VAR_0->gb); } else { int VAR_8, VAR_9, VAR_10; VAR_5 = 0; VAR_8 = get_bits(&VAR_0->gb, 8); VAR_9 = get_num(&VAR_0->gb); VAR_10 = get_num(&VAR_0->gb); } get_bits(&VAR_0->gb, 8); VAR_3 = get_bits(&VAR_0->gb, 1); if (get_bits(&VAR_0->gb, 1)) VAR_0->pict_type = P_TYPE; else VAR_0->pict_type = I_TYPE; VAR_2 = get_bits(&VAR_0->gb, 1); #ifdef DEBUG printf("pict_type=%d VAR_2=%d\n", VAR_0->pict_type, VAR_2); #endif if (VAR_2) return -1; VAR_0->qscale = get_bits(&VAR_0->gb, 5); if (VAR_0->pict_type == I_TYPE) { if (VAR_0->rv10_version == 3) { VAR_0->last_dc[0] = get_bits(&VAR_0->gb, 8); VAR_0->last_dc[1] = get_bits(&VAR_0->gb, 8); VAR_0->last_dc[2] = get_bits(&VAR_0->gb, 8); #ifdef DEBUG printf("DC:%d %d %d\n", VAR_0->last_dc[0], VAR_0->last_dc[1], VAR_0->last_dc[2]); #endif } } if (!VAR_5) { VAR_0->mb_x = get_bits(&VAR_0->gb, 6); VAR_0->mb_y = get_bits(&VAR_0->gb, 6); VAR_1 = get_bits(&VAR_0->gb, 12); } else { VAR_0->mb_x = 0; VAR_0->mb_y = 0; VAR_1 = VAR_0->mb_width * VAR_0->mb_height; } get_bits(&VAR_0->gb, 3); VAR_0->f_code = 1; VAR_0->unrestricted_mv = 1; #if 0 VAR_0->h263_long_vectors = 1; #endif return VAR_1; }
[ "static int FUNC_0(MpegEncContext *VAR_0)\n{", "int VAR_1, VAR_2, VAR_3, VAR_4, VAR_5;", "VAR_4 = get_bits(&VAR_0->gb, 8);", "if ((VAR_4 & 0xc0) == 0xc0) {", "int VAR_6, VAR_10;", "VAR_5 = 1;", "VAR_6 = get_num(&VAR_0->gb);", "VAR_10 = get_num(&VAR_0->gb);", "} else {", "int VAR_8, VAR_9, VAR_10;", "VAR_5 = 0;", "VAR_8 = get_bits(&VAR_0->gb, 8);", "VAR_9 = get_num(&VAR_0->gb);", "VAR_10 = get_num(&VAR_0->gb);", "}", "get_bits(&VAR_0->gb, 8);", "VAR_3 = get_bits(&VAR_0->gb, 1);", "if (get_bits(&VAR_0->gb, 1))\nVAR_0->pict_type = P_TYPE;", "else\nVAR_0->pict_type = I_TYPE;", "VAR_2 = get_bits(&VAR_0->gb, 1);", "#ifdef DEBUG\nprintf(\"pict_type=%d VAR_2=%d\\n\", VAR_0->pict_type, VAR_2);", "#endif\nif (VAR_2)\nreturn -1;", "VAR_0->qscale = get_bits(&VAR_0->gb, 5);", "if (VAR_0->pict_type == I_TYPE) {", "if (VAR_0->rv10_version == 3) {", "VAR_0->last_dc[0] = get_bits(&VAR_0->gb, 8);", "VAR_0->last_dc[1] = get_bits(&VAR_0->gb, 8);", "VAR_0->last_dc[2] = get_bits(&VAR_0->gb, 8);", "#ifdef DEBUG\nprintf(\"DC:%d %d %d\\n\",\nVAR_0->last_dc[0],\nVAR_0->last_dc[1],\nVAR_0->last_dc[2]);", "#endif\n}", "}", "if (!VAR_5) {", "VAR_0->mb_x = get_bits(&VAR_0->gb, 6);", "VAR_0->mb_y = get_bits(&VAR_0->gb, 6);", "VAR_1 = get_bits(&VAR_0->gb, 12);", "} else {", "VAR_0->mb_x = 0;", "VAR_0->mb_y = 0;", "VAR_1 = VAR_0->mb_width * VAR_0->mb_height;", "}", "get_bits(&VAR_0->gb, 3);", "VAR_0->f_code = 1;", "VAR_0->unrestricted_mv = 1;", "#if 0\nVAR_0->h263_long_vectors = 1;", "#endif\nreturn VAR_1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 43 ], [ 47, 49 ], [ 51, 53 ], [ 57 ], [ 61, 63 ], [ 65, 69, 71 ], [ 75 ], [ 79 ], [ 81 ], [ 85 ], [ 87 ], [ 89 ], [ 91, 93, 95, 97, 99 ], [ 101, 103 ], [ 105 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 131 ], [ 133 ], [ 135 ], [ 137, 139 ], [ 141, 143 ], [ 145 ] ]
17,880
host_memory_backend_get_host_nodes(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { HostMemoryBackend *backend = MEMORY_BACKEND(obj); uint16List *host_nodes = NULL; uint16List **node = &host_nodes; unsigned long value; value = find_first_bit(backend->host_nodes, MAX_NODES); node = host_memory_append_node(node, value); if (value == MAX_NODES) { goto out; } do { value = find_next_bit(backend->host_nodes, MAX_NODES, value + 1); if (value == MAX_NODES) { break; } node = host_memory_append_node(node, value); } while (true); out: visit_type_uint16List(v, name, &host_nodes, errp); }
true
qemu
658ae5a7b90139a6a296cd4cd83643d843964796
host_memory_backend_get_host_nodes(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { HostMemoryBackend *backend = MEMORY_BACKEND(obj); uint16List *host_nodes = NULL; uint16List **node = &host_nodes; unsigned long value; value = find_first_bit(backend->host_nodes, MAX_NODES); node = host_memory_append_node(node, value); if (value == MAX_NODES) { goto out; } do { value = find_next_bit(backend->host_nodes, MAX_NODES, value + 1); if (value == MAX_NODES) { break; } node = host_memory_append_node(node, value); } while (true); out: visit_type_uint16List(v, name, &host_nodes, errp); }
{ "code": [ " node = host_memory_append_node(node, value);", " goto out;", " node = host_memory_append_node(node, value);", "out:" ], "line_no": [ 21, 27, 45, 51 ] }
FUNC_0(Object *VAR_0, Visitor *VAR_1, const char *VAR_2, void *VAR_3, Error **VAR_4) { HostMemoryBackend *backend = MEMORY_BACKEND(VAR_0); uint16List *host_nodes = NULL; uint16List **node = &host_nodes; unsigned long VAR_5; VAR_5 = find_first_bit(backend->host_nodes, MAX_NODES); node = host_memory_append_node(node, VAR_5); if (VAR_5 == MAX_NODES) { goto out; } do { VAR_5 = find_next_bit(backend->host_nodes, MAX_NODES, VAR_5 + 1); if (VAR_5 == MAX_NODES) { break; } node = host_memory_append_node(node, VAR_5); } while (true); out: visit_type_uint16List(VAR_1, VAR_2, &host_nodes, VAR_4); }
[ "FUNC_0(Object *VAR_0, Visitor *VAR_1, const char *VAR_2,\nvoid *VAR_3, Error **VAR_4)\n{", "HostMemoryBackend *backend = MEMORY_BACKEND(VAR_0);", "uint16List *host_nodes = NULL;", "uint16List **node = &host_nodes;", "unsigned long VAR_5;", "VAR_5 = find_first_bit(backend->host_nodes, MAX_NODES);", "node = host_memory_append_node(node, VAR_5);", "if (VAR_5 == MAX_NODES) {", "goto out;", "}", "do {", "VAR_5 = find_next_bit(backend->host_nodes, MAX_NODES, VAR_5 + 1);", "if (VAR_5 == MAX_NODES) {", "break;", "}", "node = host_memory_append_node(node, VAR_5);", "} while (true);", "out:\nvisit_type_uint16List(VAR_1, VAR_2, &host_nodes, VAR_4);", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 51, 53 ], [ 55 ] ]
17,881
static int v4l2_read_header(AVFormatContext *s1) { struct video_data *s = s1->priv_data; AVStream *st; int res = 0; uint32_t desired_format; enum AVCodecID codec_id = AV_CODEC_ID_NONE; enum AVPixelFormat pix_fmt = AV_PIX_FMT_NONE; struct v4l2_input input = { 0 }; st = avformat_new_stream(s1, NULL); if (!st) return AVERROR(ENOMEM); #if CONFIG_LIBV4L2 /* silence libv4l2 logging. if fopen() fails v4l2_log_file will be NULL and errors will get sent to stderr */ v4l2_log_file = fopen("/dev/null", "w"); #endif s->fd = device_open(s1); if (s->fd < 0) return s->fd; if (s->channel != -1) { /* set video input */ av_log(s1, AV_LOG_DEBUG, "Selecting input_channel: %d\n", s->channel); if (v4l2_ioctl(s->fd, VIDIOC_S_INPUT, &s->channel) < 0) { res = AVERROR(errno); av_log(s1, AV_LOG_ERROR, "ioctl(VIDIOC_S_INPUT): %s\n", av_err2str(res)); return res; } } else { /* get current video input */ if (v4l2_ioctl(s->fd, VIDIOC_G_INPUT, &s->channel) < 0) { res = AVERROR(errno); av_log(s1, AV_LOG_ERROR, "ioctl(VIDIOC_G_INPUT): %s\n", av_err2str(res)); return res; } } /* enum input */ input.index = s->channel; if (v4l2_ioctl(s->fd, VIDIOC_ENUMINPUT, &input) < 0) { res = AVERROR(errno); av_log(s1, AV_LOG_ERROR, "ioctl(VIDIOC_ENUMINPUT): %s\n", av_err2str(res)); return res; } s->std_id = input.std; av_log(s1, AV_LOG_DEBUG, "Current input_channel: %d, input_name: %s\n", s->channel, input.name); if (s->list_format) { list_formats(s1, s->fd, s->list_format); return AVERROR_EXIT; } if (s->list_standard) { list_standards(s1); return AVERROR_EXIT; } avpriv_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in us */ if (s->pixel_format) { AVCodec *codec = avcodec_find_decoder_by_name(s->pixel_format); if (codec) s1->video_codec_id = codec->id; pix_fmt = av_get_pix_fmt(s->pixel_format); if (pix_fmt == AV_PIX_FMT_NONE && !codec) { av_log(s1, AV_LOG_ERROR, "No such input format: %s.\n", s->pixel_format); return AVERROR(EINVAL); } } if (!s->width && !s->height) { struct v4l2_format fmt; av_log(s1, AV_LOG_VERBOSE, "Querying the device for the current frame size\n"); fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; if (v4l2_ioctl(s->fd, VIDIOC_G_FMT, &fmt) < 0) { res = AVERROR(errno); av_log(s1, AV_LOG_ERROR, "ioctl(VIDIOC_G_FMT): %s\n", av_err2str(res)); return res; } s->width = fmt.fmt.pix.width; s->height = fmt.fmt.pix.height; av_log(s1, AV_LOG_VERBOSE, "Setting frame size to %dx%d\n", s->width, s->height); } res = device_try_init(s1, pix_fmt, &s->width, &s->height, &desired_format, &codec_id); if (res < 0) { v4l2_close(s->fd); return res; } /* If no pixel_format was specified, the codec_id was not known up * until now. Set video_codec_id in the context, as codec_id will * not be available outside this function */ if (codec_id != AV_CODEC_ID_NONE && s1->video_codec_id == AV_CODEC_ID_NONE) s1->video_codec_id = codec_id; if ((res = av_image_check_size(s->width, s->height, 0, s1)) < 0) return res; s->frame_format = desired_format; if ((res = v4l2_set_parameters(s1)) < 0) return res; st->codec->pix_fmt = fmt_v4l2ff(desired_format, codec_id); s->frame_size = avpicture_get_size(st->codec->pix_fmt, s->width, s->height); if ((res = mmap_init(s1)) || (res = mmap_start(s1)) < 0) { v4l2_close(s->fd); return res; } s->top_field_first = first_field(s->fd); st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_id = codec_id; if (codec_id == AV_CODEC_ID_RAWVIDEO) st->codec->codec_tag = avcodec_pix_fmt_to_codec_tag(st->codec->pix_fmt); if (desired_format == V4L2_PIX_FMT_YVU420) st->codec->codec_tag = MKTAG('Y', 'V', '1', '2'); else if (desired_format == V4L2_PIX_FMT_YVU410) st->codec->codec_tag = MKTAG('Y', 'V', 'U', '9'); st->codec->width = s->width; st->codec->height = s->height; st->codec->bit_rate = s->frame_size * av_q2d(st->avg_frame_rate) * 8; return 0; }
true
FFmpeg
9dd54d74226eaaa1087ba994ba212bf9a107c97d
static int v4l2_read_header(AVFormatContext *s1) { struct video_data *s = s1->priv_data; AVStream *st; int res = 0; uint32_t desired_format; enum AVCodecID codec_id = AV_CODEC_ID_NONE; enum AVPixelFormat pix_fmt = AV_PIX_FMT_NONE; struct v4l2_input input = { 0 }; st = avformat_new_stream(s1, NULL); if (!st) return AVERROR(ENOMEM); #if CONFIG_LIBV4L2 v4l2_log_file = fopen("/dev/null", "w"); #endif s->fd = device_open(s1); if (s->fd < 0) return s->fd; if (s->channel != -1) { av_log(s1, AV_LOG_DEBUG, "Selecting input_channel: %d\n", s->channel); if (v4l2_ioctl(s->fd, VIDIOC_S_INPUT, &s->channel) < 0) { res = AVERROR(errno); av_log(s1, AV_LOG_ERROR, "ioctl(VIDIOC_S_INPUT): %s\n", av_err2str(res)); return res; } } else { if (v4l2_ioctl(s->fd, VIDIOC_G_INPUT, &s->channel) < 0) { res = AVERROR(errno); av_log(s1, AV_LOG_ERROR, "ioctl(VIDIOC_G_INPUT): %s\n", av_err2str(res)); return res; } } input.index = s->channel; if (v4l2_ioctl(s->fd, VIDIOC_ENUMINPUT, &input) < 0) { res = AVERROR(errno); av_log(s1, AV_LOG_ERROR, "ioctl(VIDIOC_ENUMINPUT): %s\n", av_err2str(res)); return res; } s->std_id = input.std; av_log(s1, AV_LOG_DEBUG, "Current input_channel: %d, input_name: %s\n", s->channel, input.name); if (s->list_format) { list_formats(s1, s->fd, s->list_format); return AVERROR_EXIT; } if (s->list_standard) { list_standards(s1); return AVERROR_EXIT; } avpriv_set_pts_info(st, 64, 1, 1000000); if (s->pixel_format) { AVCodec *codec = avcodec_find_decoder_by_name(s->pixel_format); if (codec) s1->video_codec_id = codec->id; pix_fmt = av_get_pix_fmt(s->pixel_format); if (pix_fmt == AV_PIX_FMT_NONE && !codec) { av_log(s1, AV_LOG_ERROR, "No such input format: %s.\n", s->pixel_format); return AVERROR(EINVAL); } } if (!s->width && !s->height) { struct v4l2_format fmt; av_log(s1, AV_LOG_VERBOSE, "Querying the device for the current frame size\n"); fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; if (v4l2_ioctl(s->fd, VIDIOC_G_FMT, &fmt) < 0) { res = AVERROR(errno); av_log(s1, AV_LOG_ERROR, "ioctl(VIDIOC_G_FMT): %s\n", av_err2str(res)); return res; } s->width = fmt.fmt.pix.width; s->height = fmt.fmt.pix.height; av_log(s1, AV_LOG_VERBOSE, "Setting frame size to %dx%d\n", s->width, s->height); } res = device_try_init(s1, pix_fmt, &s->width, &s->height, &desired_format, &codec_id); if (res < 0) { v4l2_close(s->fd); return res; } if (codec_id != AV_CODEC_ID_NONE && s1->video_codec_id == AV_CODEC_ID_NONE) s1->video_codec_id = codec_id; if ((res = av_image_check_size(s->width, s->height, 0, s1)) < 0) return res; s->frame_format = desired_format; if ((res = v4l2_set_parameters(s1)) < 0) return res; st->codec->pix_fmt = fmt_v4l2ff(desired_format, codec_id); s->frame_size = avpicture_get_size(st->codec->pix_fmt, s->width, s->height); if ((res = mmap_init(s1)) || (res = mmap_start(s1)) < 0) { v4l2_close(s->fd); return res; } s->top_field_first = first_field(s->fd); st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_id = codec_id; if (codec_id == AV_CODEC_ID_RAWVIDEO) st->codec->codec_tag = avcodec_pix_fmt_to_codec_tag(st->codec->pix_fmt); if (desired_format == V4L2_PIX_FMT_YVU420) st->codec->codec_tag = MKTAG('Y', 'V', '1', '2'); else if (desired_format == V4L2_PIX_FMT_YVU410) st->codec->codec_tag = MKTAG('Y', 'V', 'U', '9'); st->codec->width = s->width; st->codec->height = s->height; st->codec->bit_rate = s->frame_size * av_q2d(st->avg_frame_rate) * 8; return 0; }
{ "code": [ " struct v4l2_format fmt;", " fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;" ], "line_no": [ 163, 171 ] }
static int FUNC_0(AVFormatContext *VAR_0) { struct video_data *VAR_1 = VAR_0->priv_data; AVStream *st; int VAR_2 = 0; uint32_t desired_format; enum AVCodecID VAR_3 = AV_CODEC_ID_NONE; enum AVPixelFormat VAR_4 = AV_PIX_FMT_NONE; struct v4l2_input VAR_5 = { 0 }; st = avformat_new_stream(VAR_0, NULL); if (!st) return AVERROR(ENOMEM); #if CONFIG_LIBV4L2 v4l2_log_file = fopen("/dev/null", "w"); #endif VAR_1->fd = device_open(VAR_0); if (VAR_1->fd < 0) return VAR_1->fd; if (VAR_1->channel != -1) { av_log(VAR_0, AV_LOG_DEBUG, "Selecting input_channel: %d\n", VAR_1->channel); if (v4l2_ioctl(VAR_1->fd, VIDIOC_S_INPUT, &VAR_1->channel) < 0) { VAR_2 = AVERROR(errno); av_log(VAR_0, AV_LOG_ERROR, "ioctl(VIDIOC_S_INPUT): %VAR_1\n", av_err2str(VAR_2)); return VAR_2; } } else { if (v4l2_ioctl(VAR_1->fd, VIDIOC_G_INPUT, &VAR_1->channel) < 0) { VAR_2 = AVERROR(errno); av_log(VAR_0, AV_LOG_ERROR, "ioctl(VIDIOC_G_INPUT): %VAR_1\n", av_err2str(VAR_2)); return VAR_2; } } VAR_5.index = VAR_1->channel; if (v4l2_ioctl(VAR_1->fd, VIDIOC_ENUMINPUT, &VAR_5) < 0) { VAR_2 = AVERROR(errno); av_log(VAR_0, AV_LOG_ERROR, "ioctl(VIDIOC_ENUMINPUT): %VAR_1\n", av_err2str(VAR_2)); return VAR_2; } VAR_1->std_id = VAR_5.std; av_log(VAR_0, AV_LOG_DEBUG, "Current input_channel: %d, input_name: %VAR_1\n", VAR_1->channel, VAR_5.name); if (VAR_1->list_format) { list_formats(VAR_0, VAR_1->fd, VAR_1->list_format); return AVERROR_EXIT; } if (VAR_1->list_standard) { list_standards(VAR_0); return AVERROR_EXIT; } avpriv_set_pts_info(st, 64, 1, 1000000); if (VAR_1->pixel_format) { AVCodec *codec = avcodec_find_decoder_by_name(VAR_1->pixel_format); if (codec) VAR_0->video_codec_id = codec->id; VAR_4 = av_get_pix_fmt(VAR_1->pixel_format); if (VAR_4 == AV_PIX_FMT_NONE && !codec) { av_log(VAR_0, AV_LOG_ERROR, "No such VAR_5 format: %VAR_1.\n", VAR_1->pixel_format); return AVERROR(EINVAL); } } if (!VAR_1->width && !VAR_1->height) { struct v4l2_format VAR_6; av_log(VAR_0, AV_LOG_VERBOSE, "Querying the device for the current frame size\n"); VAR_6.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; if (v4l2_ioctl(VAR_1->fd, VIDIOC_G_FMT, &VAR_6) < 0) { VAR_2 = AVERROR(errno); av_log(VAR_0, AV_LOG_ERROR, "ioctl(VIDIOC_G_FMT): %VAR_1\n", av_err2str(VAR_2)); return VAR_2; } VAR_1->width = VAR_6.VAR_6.pix.width; VAR_1->height = VAR_6.VAR_6.pix.height; av_log(VAR_0, AV_LOG_VERBOSE, "Setting frame size to %dx%d\n", VAR_1->width, VAR_1->height); } VAR_2 = device_try_init(VAR_0, VAR_4, &VAR_1->width, &VAR_1->height, &desired_format, &VAR_3); if (VAR_2 < 0) { v4l2_close(VAR_1->fd); return VAR_2; } if (VAR_3 != AV_CODEC_ID_NONE && VAR_0->video_codec_id == AV_CODEC_ID_NONE) VAR_0->video_codec_id = VAR_3; if ((VAR_2 = av_image_check_size(VAR_1->width, VAR_1->height, 0, VAR_0)) < 0) return VAR_2; VAR_1->frame_format = desired_format; if ((VAR_2 = v4l2_set_parameters(VAR_0)) < 0) return VAR_2; st->codec->VAR_4 = fmt_v4l2ff(desired_format, VAR_3); VAR_1->frame_size = avpicture_get_size(st->codec->VAR_4, VAR_1->width, VAR_1->height); if ((VAR_2 = mmap_init(VAR_0)) || (VAR_2 = mmap_start(VAR_0)) < 0) { v4l2_close(VAR_1->fd); return VAR_2; } VAR_1->top_field_first = first_field(VAR_1->fd); st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->VAR_3 = VAR_3; if (VAR_3 == AV_CODEC_ID_RAWVIDEO) st->codec->codec_tag = avcodec_pix_fmt_to_codec_tag(st->codec->VAR_4); if (desired_format == V4L2_PIX_FMT_YVU420) st->codec->codec_tag = MKTAG('Y', 'V', '1', '2'); else if (desired_format == V4L2_PIX_FMT_YVU410) st->codec->codec_tag = MKTAG('Y', 'V', 'U', '9'); st->codec->width = VAR_1->width; st->codec->height = VAR_1->height; st->codec->bit_rate = VAR_1->frame_size * av_q2d(st->avg_frame_rate) * 8; return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0)\n{", "struct video_data *VAR_1 = VAR_0->priv_data;", "AVStream *st;", "int VAR_2 = 0;", "uint32_t desired_format;", "enum AVCodecID VAR_3 = AV_CODEC_ID_NONE;", "enum AVPixelFormat VAR_4 = AV_PIX_FMT_NONE;", "struct v4l2_input VAR_5 = { 0 };", "st = avformat_new_stream(VAR_0, NULL);", "if (!st)\nreturn AVERROR(ENOMEM);", "#if CONFIG_LIBV4L2\nv4l2_log_file = fopen(\"/dev/null\", \"w\");", "#endif\nVAR_1->fd = device_open(VAR_0);", "if (VAR_1->fd < 0)\nreturn VAR_1->fd;", "if (VAR_1->channel != -1) {", "av_log(VAR_0, AV_LOG_DEBUG, \"Selecting input_channel: %d\\n\", VAR_1->channel);", "if (v4l2_ioctl(VAR_1->fd, VIDIOC_S_INPUT, &VAR_1->channel) < 0) {", "VAR_2 = AVERROR(errno);", "av_log(VAR_0, AV_LOG_ERROR, \"ioctl(VIDIOC_S_INPUT): %VAR_1\\n\", av_err2str(VAR_2));", "return VAR_2;", "}", "} else {", "if (v4l2_ioctl(VAR_1->fd, VIDIOC_G_INPUT, &VAR_1->channel) < 0) {", "VAR_2 = AVERROR(errno);", "av_log(VAR_0, AV_LOG_ERROR, \"ioctl(VIDIOC_G_INPUT): %VAR_1\\n\", av_err2str(VAR_2));", "return VAR_2;", "}", "}", "VAR_5.index = VAR_1->channel;", "if (v4l2_ioctl(VAR_1->fd, VIDIOC_ENUMINPUT, &VAR_5) < 0) {", "VAR_2 = AVERROR(errno);", "av_log(VAR_0, AV_LOG_ERROR, \"ioctl(VIDIOC_ENUMINPUT): %VAR_1\\n\", av_err2str(VAR_2));", "return VAR_2;", "}", "VAR_1->std_id = VAR_5.std;", "av_log(VAR_0, AV_LOG_DEBUG, \"Current input_channel: %d, input_name: %VAR_1\\n\",\nVAR_1->channel, VAR_5.name);", "if (VAR_1->list_format) {", "list_formats(VAR_0, VAR_1->fd, VAR_1->list_format);", "return AVERROR_EXIT;", "}", "if (VAR_1->list_standard) {", "list_standards(VAR_0);", "return AVERROR_EXIT;", "}", "avpriv_set_pts_info(st, 64, 1, 1000000);", "if (VAR_1->pixel_format) {", "AVCodec *codec = avcodec_find_decoder_by_name(VAR_1->pixel_format);", "if (codec)\nVAR_0->video_codec_id = codec->id;", "VAR_4 = av_get_pix_fmt(VAR_1->pixel_format);", "if (VAR_4 == AV_PIX_FMT_NONE && !codec) {", "av_log(VAR_0, AV_LOG_ERROR, \"No such VAR_5 format: %VAR_1.\\n\",\nVAR_1->pixel_format);", "return AVERROR(EINVAL);", "}", "}", "if (!VAR_1->width && !VAR_1->height) {", "struct v4l2_format VAR_6;", "av_log(VAR_0, AV_LOG_VERBOSE,\n\"Querying the device for the current frame size\\n\");", "VAR_6.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;", "if (v4l2_ioctl(VAR_1->fd, VIDIOC_G_FMT, &VAR_6) < 0) {", "VAR_2 = AVERROR(errno);", "av_log(VAR_0, AV_LOG_ERROR, \"ioctl(VIDIOC_G_FMT): %VAR_1\\n\", av_err2str(VAR_2));", "return VAR_2;", "}", "VAR_1->width = VAR_6.VAR_6.pix.width;", "VAR_1->height = VAR_6.VAR_6.pix.height;", "av_log(VAR_0, AV_LOG_VERBOSE,\n\"Setting frame size to %dx%d\\n\", VAR_1->width, VAR_1->height);", "}", "VAR_2 = device_try_init(VAR_0, VAR_4, &VAR_1->width, &VAR_1->height, &desired_format, &VAR_3);", "if (VAR_2 < 0) {", "v4l2_close(VAR_1->fd);", "return VAR_2;", "}", "if (VAR_3 != AV_CODEC_ID_NONE && VAR_0->video_codec_id == AV_CODEC_ID_NONE)\nVAR_0->video_codec_id = VAR_3;", "if ((VAR_2 = av_image_check_size(VAR_1->width, VAR_1->height, 0, VAR_0)) < 0)\nreturn VAR_2;", "VAR_1->frame_format = desired_format;", "if ((VAR_2 = v4l2_set_parameters(VAR_0)) < 0)\nreturn VAR_2;", "st->codec->VAR_4 = fmt_v4l2ff(desired_format, VAR_3);", "VAR_1->frame_size =\navpicture_get_size(st->codec->VAR_4, VAR_1->width, VAR_1->height);", "if ((VAR_2 = mmap_init(VAR_0)) ||\n(VAR_2 = mmap_start(VAR_0)) < 0) {", "v4l2_close(VAR_1->fd);", "return VAR_2;", "}", "VAR_1->top_field_first = first_field(VAR_1->fd);", "st->codec->codec_type = AVMEDIA_TYPE_VIDEO;", "st->codec->VAR_3 = VAR_3;", "if (VAR_3 == AV_CODEC_ID_RAWVIDEO)\nst->codec->codec_tag =\navcodec_pix_fmt_to_codec_tag(st->codec->VAR_4);", "if (desired_format == V4L2_PIX_FMT_YVU420)\nst->codec->codec_tag = MKTAG('Y', 'V', '1', '2');", "else if (desired_format == V4L2_PIX_FMT_YVU410)\nst->codec->codec_tag = MKTAG('Y', 'V', 'U', '9');", "st->codec->width = VAR_1->width;", "st->codec->height = VAR_1->height;", "st->codec->bit_rate = VAR_1->frame_size * av_q2d(st->avg_frame_rate) * 8;", "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, 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23, 25 ], [ 29, 35 ], [ 37, 41 ], [ 43, 45 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99, 101 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 125 ], [ 129 ], [ 131 ], [ 135, 137 ], [ 141 ], [ 145 ], [ 147, 149 ], [ 153 ], [ 155 ], [ 157 ], [ 161 ], [ 163 ], [ 167, 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 185 ], [ 187 ], [ 189, 191 ], [ 193 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 217, 219 ], [ 223, 225 ], [ 229 ], [ 233, 235 ], [ 239 ], [ 241, 243 ], [ 247, 249 ], [ 251 ], [ 253 ], [ 255 ], [ 259 ], [ 263 ], [ 265 ], [ 267, 269, 271 ], [ 273, 275 ], [ 277, 279 ], [ 281 ], [ 283 ], [ 285 ], [ 289 ], [ 291 ] ]
17,882
avfilter_get_video_buffer_ref_from_arrays(uint8_t *data[4], int linesize[4], int perms, int w, int h, enum PixelFormat format) { AVFilterBuffer *pic = av_mallocz(sizeof(AVFilterBuffer)); AVFilterBufferRef *picref = av_mallocz(sizeof(AVFilterBufferRef)); if (!pic || !picref) goto fail; picref->buf = pic; picref->buf->free = ff_avfilter_default_free_buffer; if (!(picref->video = av_mallocz(sizeof(AVFilterBufferRefVideoProps)))) goto fail; picref->video->w = w; picref->video->h = h; /* make sure the buffer gets read permission or it's useless for output */ picref->perms = perms | AV_PERM_READ; pic->refcount = 1; picref->type = AVMEDIA_TYPE_VIDEO; picref->format = format; memcpy(pic->data, data, sizeof(pic->data)); memcpy(pic->linesize, linesize, sizeof(pic->linesize)); memcpy(picref->data, pic->data, sizeof(picref->data)); memcpy(picref->linesize, pic->linesize, sizeof(picref->linesize)); return picref; fail: if (picref && picref->video) av_free(picref->video); av_free(picref); av_free(pic); return NULL; }
false
FFmpeg
36dc00de529fb4cd182e02f927597eef9514b886
avfilter_get_video_buffer_ref_from_arrays(uint8_t *data[4], int linesize[4], int perms, int w, int h, enum PixelFormat format) { AVFilterBuffer *pic = av_mallocz(sizeof(AVFilterBuffer)); AVFilterBufferRef *picref = av_mallocz(sizeof(AVFilterBufferRef)); if (!pic || !picref) goto fail; picref->buf = pic; picref->buf->free = ff_avfilter_default_free_buffer; if (!(picref->video = av_mallocz(sizeof(AVFilterBufferRefVideoProps)))) goto fail; picref->video->w = w; picref->video->h = h; picref->perms = perms | AV_PERM_READ; pic->refcount = 1; picref->type = AVMEDIA_TYPE_VIDEO; picref->format = format; memcpy(pic->data, data, sizeof(pic->data)); memcpy(pic->linesize, linesize, sizeof(pic->linesize)); memcpy(picref->data, pic->data, sizeof(picref->data)); memcpy(picref->linesize, pic->linesize, sizeof(picref->linesize)); return picref; fail: if (picref && picref->video) av_free(picref->video); av_free(picref); av_free(pic); return NULL; }
{ "code": [], "line_no": [] }
FUNC_0(uint8_t *VAR_0[4], int VAR_1[4], int VAR_2, int VAR_3, int VAR_4, enum PixelFormat VAR_5) { AVFilterBuffer *pic = av_mallocz(sizeof(AVFilterBuffer)); AVFilterBufferRef *picref = av_mallocz(sizeof(AVFilterBufferRef)); if (!pic || !picref) goto fail; picref->buf = pic; picref->buf->free = ff_avfilter_default_free_buffer; if (!(picref->video = av_mallocz(sizeof(AVFilterBufferRefVideoProps)))) goto fail; picref->video->VAR_3 = VAR_3; picref->video->VAR_4 = VAR_4; picref->VAR_2 = VAR_2 | AV_PERM_READ; pic->refcount = 1; picref->type = AVMEDIA_TYPE_VIDEO; picref->VAR_5 = VAR_5; memcpy(pic->VAR_0, VAR_0, sizeof(pic->VAR_0)); memcpy(pic->VAR_1, VAR_1, sizeof(pic->VAR_1)); memcpy(picref->VAR_0, pic->VAR_0, sizeof(picref->VAR_0)); memcpy(picref->VAR_1, pic->VAR_1, sizeof(picref->VAR_1)); return picref; fail: if (picref && picref->video) av_free(picref->video); av_free(picref); av_free(pic); return NULL; }
[ "FUNC_0(uint8_t *VAR_0[4], int VAR_1[4], int VAR_2,\nint VAR_3, int VAR_4, enum PixelFormat VAR_5)\n{", "AVFilterBuffer *pic = av_mallocz(sizeof(AVFilterBuffer));", "AVFilterBufferRef *picref = av_mallocz(sizeof(AVFilterBufferRef));", "if (!pic || !picref)\ngoto fail;", "picref->buf = pic;", "picref->buf->free = ff_avfilter_default_free_buffer;", "if (!(picref->video = av_mallocz(sizeof(AVFilterBufferRefVideoProps))))\ngoto fail;", "picref->video->VAR_3 = VAR_3;", "picref->video->VAR_4 = VAR_4;", "picref->VAR_2 = VAR_2 | AV_PERM_READ;", "pic->refcount = 1;", "picref->type = AVMEDIA_TYPE_VIDEO;", "picref->VAR_5 = VAR_5;", "memcpy(pic->VAR_0, VAR_0, sizeof(pic->VAR_0));", "memcpy(pic->VAR_1, VAR_1, sizeof(pic->VAR_1));", "memcpy(picref->VAR_0, pic->VAR_0, sizeof(picref->VAR_0));", "memcpy(picref->VAR_1, pic->VAR_1, sizeof(picref->VAR_1));", "return picref;", "fail:\nif (picref && picref->video)\nav_free(picref->video);", "av_free(picref);", "av_free(pic);", "return NULL;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13, 15 ], [ 19 ], [ 21 ], [ 23, 25 ], [ 29 ], [ 31 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 63, 65, 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ] ]
17,884
static int dca_decode_frame(AVCodecContext * avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; int i; int16_t *samples = data; DCAContext *s = avctx->priv_data; int channels; s->dca_buffer_size = dca_convert_bitstream(buf, buf_size, s->dca_buffer, DCA_MAX_FRAME_SIZE); if (s->dca_buffer_size == -1) { av_log(avctx, AV_LOG_ERROR, "Not a valid DCA frame\n"); } init_get_bits(&s->gb, s->dca_buffer, s->dca_buffer_size * 8); if (dca_parse_frame_header(s) < 0) { //seems like the frame is corrupt, try with the next one *data_size=0; return buf_size; } //set AVCodec values with parsed data avctx->sample_rate = s->sample_rate; avctx->bit_rate = s->bit_rate; channels = s->prim_channels + !!s->lfe; if (s->amode<16) { avctx->channel_layout = dca_core_channel_layout[s->amode]; if (s->lfe) { avctx->channel_layout |= CH_LOW_FREQUENCY; s->channel_order_tab = dca_channel_reorder_lfe[s->amode]; } else s->channel_order_tab = dca_channel_reorder_nolfe[s->amode]; if(avctx->request_channels == 2 && s->prim_channels > 2) { channels = 2; s->output = DCA_STEREO; avctx->channel_layout = CH_LAYOUT_STEREO; } } else { av_log(avctx, AV_LOG_ERROR, "Non standard configuration %d !\n",s->amode); } /* There is nothing that prevents a dts frame to change channel configuration but FFmpeg doesn't support that so only set the channels if it is previously unset. Ideally during the first probe for channels the crc should be checked and only set avctx->channels when the crc is ok. Right now the decoder could set the channels based on a broken first frame.*/ if (!avctx->channels) avctx->channels = channels; if(*data_size < (s->sample_blocks / 8) * 256 * sizeof(int16_t) * channels) *data_size = 256 / 8 * s->sample_blocks * sizeof(int16_t) * channels; for (i = 0; i < (s->sample_blocks / 8); i++) { dca_decode_block(s); s->dsp.float_to_int16_interleave(samples, s->samples_chanptr, 256, channels); samples += 256 * channels; } return buf_size; }
true
FFmpeg
4e06acbde4a75cf9aa6a3e46dd3a7c6ed1ecfb8f
static int dca_decode_frame(AVCodecContext * avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; int i; int16_t *samples = data; DCAContext *s = avctx->priv_data; int channels; s->dca_buffer_size = dca_convert_bitstream(buf, buf_size, s->dca_buffer, DCA_MAX_FRAME_SIZE); if (s->dca_buffer_size == -1) { av_log(avctx, AV_LOG_ERROR, "Not a valid DCA frame\n"); } init_get_bits(&s->gb, s->dca_buffer, s->dca_buffer_size * 8); if (dca_parse_frame_header(s) < 0) { *data_size=0; return buf_size; } avctx->sample_rate = s->sample_rate; avctx->bit_rate = s->bit_rate; channels = s->prim_channels + !!s->lfe; if (s->amode<16) { avctx->channel_layout = dca_core_channel_layout[s->amode]; if (s->lfe) { avctx->channel_layout |= CH_LOW_FREQUENCY; s->channel_order_tab = dca_channel_reorder_lfe[s->amode]; } else s->channel_order_tab = dca_channel_reorder_nolfe[s->amode]; if(avctx->request_channels == 2 && s->prim_channels > 2) { channels = 2; s->output = DCA_STEREO; avctx->channel_layout = CH_LAYOUT_STEREO; } } else { av_log(avctx, AV_LOG_ERROR, "Non standard configuration %d !\n",s->amode); } if (!avctx->channels) avctx->channels = channels; if(*data_size < (s->sample_blocks / 8) * 256 * sizeof(int16_t) * channels) *data_size = 256 / 8 * s->sample_blocks * sizeof(int16_t) * channels; for (i = 0; i < (s->sample_blocks / 8); i++) { dca_decode_block(s); s->dsp.float_to_int16_interleave(samples, s->samples_chanptr, 256, channels); samples += 256 * channels; } 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; int VAR_6; int16_t *samples = VAR_1; DCAContext *s = VAR_0->priv_data; int VAR_7; s->dca_buffer_size = dca_convert_bitstream(VAR_4, VAR_5, s->dca_buffer, DCA_MAX_FRAME_SIZE); if (s->dca_buffer_size == -1) { av_log(VAR_0, AV_LOG_ERROR, "Not a valid DCA frame\n"); } init_get_bits(&s->gb, s->dca_buffer, s->dca_buffer_size * 8); if (dca_parse_frame_header(s) < 0) { *VAR_2=0; return VAR_5; } VAR_0->sample_rate = s->sample_rate; VAR_0->bit_rate = s->bit_rate; VAR_7 = s->prim_channels + !!s->lfe; if (s->amode<16) { VAR_0->channel_layout = dca_core_channel_layout[s->amode]; if (s->lfe) { VAR_0->channel_layout |= CH_LOW_FREQUENCY; s->channel_order_tab = dca_channel_reorder_lfe[s->amode]; } else s->channel_order_tab = dca_channel_reorder_nolfe[s->amode]; if(VAR_0->request_channels == 2 && s->prim_channels > 2) { VAR_7 = 2; s->output = DCA_STEREO; VAR_0->channel_layout = CH_LAYOUT_STEREO; } } else { av_log(VAR_0, AV_LOG_ERROR, "Non standard configuration %d !\n",s->amode); } if (!VAR_0->VAR_7) VAR_0->VAR_7 = VAR_7; if(*VAR_2 < (s->sample_blocks / 8) * 256 * sizeof(int16_t) * VAR_7) *VAR_2 = 256 / 8 * s->sample_blocks * sizeof(int16_t) * VAR_7; for (VAR_6 = 0; VAR_6 < (s->sample_blocks / 8); VAR_6++) { dca_decode_block(s); s->dsp.float_to_int16_interleave(samples, s->samples_chanptr, 256, VAR_7); samples += 256 * VAR_7; } 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;", "int VAR_6;", "int16_t *samples = VAR_1;", "DCAContext *s = VAR_0->priv_data;", "int VAR_7;", "s->dca_buffer_size = dca_convert_bitstream(VAR_4, VAR_5, s->dca_buffer, DCA_MAX_FRAME_SIZE);", "if (s->dca_buffer_size == -1) {", "av_log(VAR_0, AV_LOG_ERROR, \"Not a valid DCA frame\\n\");", "}", "init_get_bits(&s->gb, s->dca_buffer, s->dca_buffer_size * 8);", "if (dca_parse_frame_header(s) < 0) {", "*VAR_2=0;", "return VAR_5;", "}", "VAR_0->sample_rate = s->sample_rate;", "VAR_0->bit_rate = s->bit_rate;", "VAR_7 = s->prim_channels + !!s->lfe;", "if (s->amode<16) {", "VAR_0->channel_layout = dca_core_channel_layout[s->amode];", "if (s->lfe) {", "VAR_0->channel_layout |= CH_LOW_FREQUENCY;", "s->channel_order_tab = dca_channel_reorder_lfe[s->amode];", "} else", "s->channel_order_tab = dca_channel_reorder_nolfe[s->amode];", "if(VAR_0->request_channels == 2 && s->prim_channels > 2) {", "VAR_7 = 2;", "s->output = DCA_STEREO;", "VAR_0->channel_layout = CH_LAYOUT_STEREO;", "}", "} else {", "av_log(VAR_0, AV_LOG_ERROR, \"Non standard configuration %d !\\n\",s->amode);", "}", "if (!VAR_0->VAR_7)\nVAR_0->VAR_7 = VAR_7;", "if(*VAR_2 < (s->sample_blocks / 8) * 256 * sizeof(int16_t) * VAR_7)\n*VAR_2 = 256 / 8 * s->sample_blocks * sizeof(int16_t) * VAR_7;", "for (VAR_6 = 0; VAR_6 < (s->sample_blocks / 8); VAR_6++) {", "dca_decode_block(s);", "s->dsp.float_to_int16_interleave(samples, s->samples_chanptr, 256, VAR_7);", "samples += 256 * VAR_7;", "}", "return VAR_5;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2, 3, 4 ], [ 5 ], [ 6 ], [ 7 ], [ 8 ], [ 9 ], [ 10 ], [ 11 ], [ 12 ], [ 13 ], [ 14 ], [ 15 ], [ 16 ], [ 18 ], [ 19 ], [ 20 ], [ 22 ], [ 23 ], [ 24 ], [ 25 ], [ 26 ], [ 27 ], [ 28 ], [ 29 ], [ 30 ], [ 31 ], [ 32 ], [ 33 ], [ 34 ], [ 35 ], [ 36 ], [ 37 ], [ 38 ], [ 39 ], [ 45, 46 ], [ 47, 48 ], [ 49 ], [ 50 ], [ 51 ], [ 52 ], [ 53 ], [ 54 ], [ 55 ] ]
17,886
static void dmg_close(BlockDriverState *bs) { BDRVDMGState *s = bs->opaque; g_free(s->types); g_free(s->offsets); g_free(s->lengths); g_free(s->sectors); g_free(s->sectorcounts); g_free(s->compressed_chunk); g_free(s->uncompressed_chunk); inflateEnd(&s->zstream); }
true
qemu
b546a944749f963c5b4e27765354df10ac531853
static void dmg_close(BlockDriverState *bs) { BDRVDMGState *s = bs->opaque; g_free(s->types); g_free(s->offsets); g_free(s->lengths); g_free(s->sectors); g_free(s->sectorcounts); g_free(s->compressed_chunk); g_free(s->uncompressed_chunk); inflateEnd(&s->zstream); }
{ "code": [ " g_free(s->compressed_chunk);", " g_free(s->uncompressed_chunk);", " g_free(s->compressed_chunk);", " g_free(s->uncompressed_chunk);" ], "line_no": [ 19, 21, 19, 21 ] }
static void FUNC_0(BlockDriverState *VAR_0) { BDRVDMGState *s = VAR_0->opaque; g_free(s->types); g_free(s->offsets); g_free(s->lengths); g_free(s->sectors); g_free(s->sectorcounts); g_free(s->compressed_chunk); g_free(s->uncompressed_chunk); inflateEnd(&s->zstream); }
[ "static void FUNC_0(BlockDriverState *VAR_0)\n{", "BDRVDMGState *s = VAR_0->opaque;", "g_free(s->types);", "g_free(s->offsets);", "g_free(s->lengths);", "g_free(s->sectors);", "g_free(s->sectorcounts);", "g_free(s->compressed_chunk);", "g_free(s->uncompressed_chunk);", "inflateEnd(&s->zstream);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ] ]
17,887
int gdbserver_start(const char *device) { GDBState *s; char gdbstub_device_name[128]; CharDriverState *chr = NULL; CharDriverState *mon_chr; if (!device) return -1; if (strcmp(device, "none") != 0) { if (strstart(device, "tcp:", NULL)) { /* enforce required TCP attributes */ snprintf(gdbstub_device_name, sizeof(gdbstub_device_name), "%s,nowait,nodelay,server", device); device = gdbstub_device_name; } #ifndef _WIN32 else if (strcmp(device, "stdio") == 0) { struct sigaction act; memset(&act, 0, sizeof(act)); act.sa_handler = gdb_sigterm_handler; sigaction(SIGINT, &act, NULL); } #endif chr = qemu_chr_new("gdb", device, NULL); if (!chr) return -1; qemu_chr_add_handlers(chr, gdb_chr_can_receive, gdb_chr_receive, gdb_chr_event, NULL); } s = gdbserver_state; if (!s) { s = g_malloc0(sizeof(GDBState)); gdbserver_state = s; qemu_add_vm_change_state_handler(gdb_vm_state_change, NULL); /* Initialize a monitor terminal for gdb */ mon_chr = g_malloc0(sizeof(*mon_chr)); mon_chr->chr_write = gdb_monitor_write; monitor_init(mon_chr, 0); } else { if (s->chr) qemu_chr_delete(s->chr); mon_chr = s->mon_chr; memset(s, 0, sizeof(GDBState)); } s->c_cpu = first_cpu; s->g_cpu = first_cpu; s->chr = chr; s->state = chr ? RS_IDLE : RS_INACTIVE; s->mon_chr = mon_chr; s->current_syscall_cb = NULL; return 0; }
true
qemu
456d60692310e7ac25cf822cc1e98192ad636ece
int gdbserver_start(const char *device) { GDBState *s; char gdbstub_device_name[128]; CharDriverState *chr = NULL; CharDriverState *mon_chr; if (!device) return -1; if (strcmp(device, "none") != 0) { if (strstart(device, "tcp:", NULL)) { snprintf(gdbstub_device_name, sizeof(gdbstub_device_name), "%s,nowait,nodelay,server", device); device = gdbstub_device_name; } #ifndef _WIN32 else if (strcmp(device, "stdio") == 0) { struct sigaction act; memset(&act, 0, sizeof(act)); act.sa_handler = gdb_sigterm_handler; sigaction(SIGINT, &act, NULL); } #endif chr = qemu_chr_new("gdb", device, NULL); if (!chr) return -1; qemu_chr_add_handlers(chr, gdb_chr_can_receive, gdb_chr_receive, gdb_chr_event, NULL); } s = gdbserver_state; if (!s) { s = g_malloc0(sizeof(GDBState)); gdbserver_state = s; qemu_add_vm_change_state_handler(gdb_vm_state_change, NULL); mon_chr = g_malloc0(sizeof(*mon_chr)); mon_chr->chr_write = gdb_monitor_write; monitor_init(mon_chr, 0); } else { if (s->chr) qemu_chr_delete(s->chr); mon_chr = s->mon_chr; memset(s, 0, sizeof(GDBState)); } s->c_cpu = first_cpu; s->g_cpu = first_cpu; s->chr = chr; s->state = chr ? RS_IDLE : RS_INACTIVE; s->mon_chr = mon_chr; s->current_syscall_cb = NULL; return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(const char *VAR_0) { GDBState *s; char VAR_1[128]; CharDriverState *chr = NULL; CharDriverState *mon_chr; if (!VAR_0) return -1; if (strcmp(VAR_0, "none") != 0) { if (strstart(VAR_0, "tcp:", NULL)) { snprintf(VAR_1, sizeof(VAR_1), "%s,nowait,nodelay,server", VAR_0); VAR_0 = VAR_1; } #ifndef _WIN32 else if (strcmp(VAR_0, "stdio") == 0) { struct sigaction VAR_2; memset(&VAR_2, 0, sizeof(VAR_2)); VAR_2.sa_handler = gdb_sigterm_handler; sigaction(SIGINT, &VAR_2, NULL); } #endif chr = qemu_chr_new("gdb", VAR_0, NULL); if (!chr) return -1; qemu_chr_add_handlers(chr, gdb_chr_can_receive, gdb_chr_receive, gdb_chr_event, NULL); } s = gdbserver_state; if (!s) { s = g_malloc0(sizeof(GDBState)); gdbserver_state = s; qemu_add_vm_change_state_handler(gdb_vm_state_change, NULL); mon_chr = g_malloc0(sizeof(*mon_chr)); mon_chr->chr_write = gdb_monitor_write; monitor_init(mon_chr, 0); } else { if (s->chr) qemu_chr_delete(s->chr); mon_chr = s->mon_chr; memset(s, 0, sizeof(GDBState)); } s->c_cpu = first_cpu; s->g_cpu = first_cpu; s->chr = chr; s->state = chr ? RS_IDLE : RS_INACTIVE; s->mon_chr = mon_chr; s->current_syscall_cb = NULL; return 0; }
[ "int FUNC_0(const char *VAR_0)\n{", "GDBState *s;", "char VAR_1[128];", "CharDriverState *chr = NULL;", "CharDriverState *mon_chr;", "if (!VAR_0)\nreturn -1;", "if (strcmp(VAR_0, \"none\") != 0) {", "if (strstart(VAR_0, \"tcp:\", NULL)) {", "snprintf(VAR_1, sizeof(VAR_1),\n\"%s,nowait,nodelay,server\", VAR_0);", "VAR_0 = VAR_1;", "}", "#ifndef _WIN32\nelse if (strcmp(VAR_0, \"stdio\") == 0) {", "struct sigaction VAR_2;", "memset(&VAR_2, 0, sizeof(VAR_2));", "VAR_2.sa_handler = gdb_sigterm_handler;", "sigaction(SIGINT, &VAR_2, NULL);", "}", "#endif\nchr = qemu_chr_new(\"gdb\", VAR_0, NULL);", "if (!chr)\nreturn -1;", "qemu_chr_add_handlers(chr, gdb_chr_can_receive, gdb_chr_receive,\ngdb_chr_event, NULL);", "}", "s = gdbserver_state;", "if (!s) {", "s = g_malloc0(sizeof(GDBState));", "gdbserver_state = s;", "qemu_add_vm_change_state_handler(gdb_vm_state_change, NULL);", "mon_chr = g_malloc0(sizeof(*mon_chr));", "mon_chr->chr_write = gdb_monitor_write;", "monitor_init(mon_chr, 0);", "} else {", "if (s->chr)\nqemu_chr_delete(s->chr);", "mon_chr = s->mon_chr;", "memset(s, 0, sizeof(GDBState));", "}", "s->c_cpu = first_cpu;", "s->g_cpu = first_cpu;", "s->chr = chr;", "s->state = chr ? RS_IDLE : RS_INACTIVE;", "s->mon_chr = mon_chr;", "s->current_syscall_cb = NULL;", "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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15, 17 ], [ 19 ], [ 21 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49, 51 ], [ 53, 55 ], [ 60, 62 ], [ 64 ], [ 68 ], [ 70 ], [ 72 ], [ 74 ], [ 78 ], [ 84 ], [ 86 ], [ 88 ], [ 90 ], [ 92, 94 ], [ 96 ], [ 98 ], [ 100 ], [ 102 ], [ 104 ], [ 106 ], [ 108 ], [ 110 ], [ 112 ], [ 116 ], [ 118 ] ]
17,888
static int opus_packet(AVFormatContext *avf, int idx) { struct ogg *ogg = avf->priv_data; struct ogg_stream *os = &ogg->streams[idx]; AVStream *st = avf->streams[idx]; struct oggopus_private *priv = os->private; uint8_t *packet = os->buf + os->pstart; int ret; if (!os->psize) return AVERROR_INVALIDDATA; if (os->granule > INT64_MAX - UINT32_MAX) { av_log(avf, AV_LOG_ERROR, "Unsupported huge granule pos %"PRId64 "\n", os->granule); return AVERROR_INVALIDDATA; } if ((!os->lastpts || os->lastpts == AV_NOPTS_VALUE) && !(os->flags & OGG_FLAG_EOS)) { int seg, d; int duration; uint8_t *last_pkt = os->buf + os->pstart; uint8_t *next_pkt = last_pkt; duration = 0; seg = os->segp; d = opus_duration(last_pkt, os->psize); if (d < 0) { os->pflags |= AV_PKT_FLAG_CORRUPT; return 0; } duration += d; last_pkt = next_pkt = next_pkt + os->psize; for (; seg < os->nsegs; seg++) { next_pkt += os->segments[seg]; if (os->segments[seg] < 255 && next_pkt != last_pkt) { int d = opus_duration(last_pkt, next_pkt - last_pkt); if (d > 0) duration += d; last_pkt = next_pkt; } } os->lastpts = os->lastdts = os->granule - duration; } if ((ret = opus_duration(packet, os->psize)) < 0) return ret; os->pduration = ret; if (os->lastpts != AV_NOPTS_VALUE) { if (st->start_time == AV_NOPTS_VALUE) st->start_time = os->lastpts; priv->cur_dts = os->lastdts = os->lastpts -= priv->pre_skip; } priv->cur_dts += os->pduration; if ((os->flags & OGG_FLAG_EOS)) { int64_t skip = priv->cur_dts - os->granule + priv->pre_skip; skip = FFMIN(skip, os->pduration); if (skip > 0) { os->pduration = skip < os->pduration ? os->pduration - skip : 1; os->end_trimming = skip; av_log(avf, AV_LOG_DEBUG, "Last packet was truncated to %d due to end trimming.\n", os->pduration); } } return 0; }
true
FFmpeg
1a82d2cf8fb6a7e854e7548dfcf73c3d046b34ac
static int opus_packet(AVFormatContext *avf, int idx) { struct ogg *ogg = avf->priv_data; struct ogg_stream *os = &ogg->streams[idx]; AVStream *st = avf->streams[idx]; struct oggopus_private *priv = os->private; uint8_t *packet = os->buf + os->pstart; int ret; if (!os->psize) return AVERROR_INVALIDDATA; if (os->granule > INT64_MAX - UINT32_MAX) { av_log(avf, AV_LOG_ERROR, "Unsupported huge granule pos %"PRId64 "\n", os->granule); return AVERROR_INVALIDDATA; } if ((!os->lastpts || os->lastpts == AV_NOPTS_VALUE) && !(os->flags & OGG_FLAG_EOS)) { int seg, d; int duration; uint8_t *last_pkt = os->buf + os->pstart; uint8_t *next_pkt = last_pkt; duration = 0; seg = os->segp; d = opus_duration(last_pkt, os->psize); if (d < 0) { os->pflags |= AV_PKT_FLAG_CORRUPT; return 0; } duration += d; last_pkt = next_pkt = next_pkt + os->psize; for (; seg < os->nsegs; seg++) { next_pkt += os->segments[seg]; if (os->segments[seg] < 255 && next_pkt != last_pkt) { int d = opus_duration(last_pkt, next_pkt - last_pkt); if (d > 0) duration += d; last_pkt = next_pkt; } } os->lastpts = os->lastdts = os->granule - duration; } if ((ret = opus_duration(packet, os->psize)) < 0) return ret; os->pduration = ret; if (os->lastpts != AV_NOPTS_VALUE) { if (st->start_time == AV_NOPTS_VALUE) st->start_time = os->lastpts; priv->cur_dts = os->lastdts = os->lastpts -= priv->pre_skip; } priv->cur_dts += os->pduration; if ((os->flags & OGG_FLAG_EOS)) { int64_t skip = priv->cur_dts - os->granule + priv->pre_skip; skip = FFMIN(skip, os->pduration); if (skip > 0) { os->pduration = skip < os->pduration ? os->pduration - skip : 1; os->end_trimming = skip; av_log(avf, AV_LOG_DEBUG, "Last packet was truncated to %d due to end trimming.\n", os->pduration); } } return 0; }
{ "code": [ " if (os->granule > INT64_MAX - UINT32_MAX) {" ], "line_no": [ 23 ] }
static int FUNC_0(AVFormatContext *VAR_0, int VAR_1) { struct VAR_2 *VAR_2 = VAR_0->priv_data; struct ogg_stream *VAR_3 = &VAR_2->streams[VAR_1]; AVStream *st = VAR_0->streams[VAR_1]; struct oggopus_private *VAR_4 = VAR_3->private; uint8_t *packet = VAR_3->buf + VAR_3->pstart; int VAR_5; if (!VAR_3->psize) return AVERROR_INVALIDDATA; if (VAR_3->granule > INT64_MAX - UINT32_MAX) { av_log(VAR_0, AV_LOG_ERROR, "Unsupported huge granule pos %"PRId64 "\n", VAR_3->granule); return AVERROR_INVALIDDATA; } if ((!VAR_3->lastpts || VAR_3->lastpts == AV_NOPTS_VALUE) && !(VAR_3->flags & OGG_FLAG_EOS)) { int VAR_6, VAR_9; int VAR_8; uint8_t *last_pkt = VAR_3->buf + VAR_3->pstart; uint8_t *next_pkt = last_pkt; VAR_8 = 0; VAR_6 = VAR_3->segp; VAR_9 = opus_duration(last_pkt, VAR_3->psize); if (VAR_9 < 0) { VAR_3->pflags |= AV_PKT_FLAG_CORRUPT; return 0; } VAR_8 += VAR_9; last_pkt = next_pkt = next_pkt + VAR_3->psize; for (; VAR_6 < VAR_3->nsegs; VAR_6++) { next_pkt += VAR_3->segments[VAR_6]; if (VAR_3->segments[VAR_6] < 255 && next_pkt != last_pkt) { int VAR_9 = opus_duration(last_pkt, next_pkt - last_pkt); if (VAR_9 > 0) VAR_8 += VAR_9; last_pkt = next_pkt; } } VAR_3->lastpts = VAR_3->lastdts = VAR_3->granule - VAR_8; } if ((VAR_5 = opus_duration(packet, VAR_3->psize)) < 0) return VAR_5; VAR_3->pduration = VAR_5; if (VAR_3->lastpts != AV_NOPTS_VALUE) { if (st->start_time == AV_NOPTS_VALUE) st->start_time = VAR_3->lastpts; VAR_4->cur_dts = VAR_3->lastdts = VAR_3->lastpts -= VAR_4->pre_skip; } VAR_4->cur_dts += VAR_3->pduration; if ((VAR_3->flags & OGG_FLAG_EOS)) { int64_t skip = VAR_4->cur_dts - VAR_3->granule + VAR_4->pre_skip; skip = FFMIN(skip, VAR_3->pduration); if (skip > 0) { VAR_3->pduration = skip < VAR_3->pduration ? VAR_3->pduration - skip : 1; VAR_3->end_trimming = skip; av_log(VAR_0, AV_LOG_DEBUG, "Last packet was truncated to %VAR_9 due to end trimming.\n", VAR_3->pduration); } } return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0, int VAR_1)\n{", "struct VAR_2 *VAR_2 = VAR_0->priv_data;", "struct ogg_stream *VAR_3 = &VAR_2->streams[VAR_1];", "AVStream *st = VAR_0->streams[VAR_1];", "struct oggopus_private *VAR_4 = VAR_3->private;", "uint8_t *packet = VAR_3->buf + VAR_3->pstart;", "int VAR_5;", "if (!VAR_3->psize)\nreturn AVERROR_INVALIDDATA;", "if (VAR_3->granule > INT64_MAX - UINT32_MAX) {", "av_log(VAR_0, AV_LOG_ERROR, \"Unsupported huge granule pos %\"PRId64 \"\\n\", VAR_3->granule);", "return AVERROR_INVALIDDATA;", "}", "if ((!VAR_3->lastpts || VAR_3->lastpts == AV_NOPTS_VALUE) && !(VAR_3->flags & OGG_FLAG_EOS)) {", "int VAR_6, VAR_9;", "int VAR_8;", "uint8_t *last_pkt = VAR_3->buf + VAR_3->pstart;", "uint8_t *next_pkt = last_pkt;", "VAR_8 = 0;", "VAR_6 = VAR_3->segp;", "VAR_9 = opus_duration(last_pkt, VAR_3->psize);", "if (VAR_9 < 0) {", "VAR_3->pflags |= AV_PKT_FLAG_CORRUPT;", "return 0;", "}", "VAR_8 += VAR_9;", "last_pkt = next_pkt = next_pkt + VAR_3->psize;", "for (; VAR_6 < VAR_3->nsegs; VAR_6++) {", "next_pkt += VAR_3->segments[VAR_6];", "if (VAR_3->segments[VAR_6] < 255 && next_pkt != last_pkt) {", "int VAR_9 = opus_duration(last_pkt, next_pkt - last_pkt);", "if (VAR_9 > 0)\nVAR_8 += VAR_9;", "last_pkt = next_pkt;", "}", "}", "VAR_3->lastpts =\nVAR_3->lastdts = VAR_3->granule - VAR_8;", "}", "if ((VAR_5 = opus_duration(packet, VAR_3->psize)) < 0)\nreturn VAR_5;", "VAR_3->pduration = VAR_5;", "if (VAR_3->lastpts != AV_NOPTS_VALUE) {", "if (st->start_time == AV_NOPTS_VALUE)\nst->start_time = VAR_3->lastpts;", "VAR_4->cur_dts = VAR_3->lastdts = VAR_3->lastpts -= VAR_4->pre_skip;", "}", "VAR_4->cur_dts += VAR_3->pduration;", "if ((VAR_3->flags & OGG_FLAG_EOS)) {", "int64_t skip = VAR_4->cur_dts - VAR_3->granule + VAR_4->pre_skip;", "skip = FFMIN(skip, VAR_3->pduration);", "if (skip > 0) {", "VAR_3->pduration = skip < VAR_3->pduration ? VAR_3->pduration - skip : 1;", "VAR_3->end_trimming = skip;", "av_log(VAR_0, AV_LOG_DEBUG,\n\"Last packet was truncated to %VAR_9 due to end trimming.\\n\",\nVAR_3->pduration);", "}", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71, 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81, 83 ], [ 85 ], [ 89, 91 ], [ 95 ], [ 97 ], [ 99, 101 ], [ 103 ], [ 105 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123, 125, 127 ], [ 129 ], [ 131 ], [ 135 ], [ 137 ] ]
17,890
static unsigned int mszh_decomp(unsigned char * srcptr, int srclen, unsigned char * destptr, unsigned int destsize) { unsigned char *destptr_bak = destptr; unsigned char *destptr_end = destptr + destsize; unsigned char mask = 0; unsigned char maskbit = 0; unsigned int ofs, cnt; while (srclen > 0 && destptr < destptr_end) { if (maskbit == 0) { mask = *srcptr++; maskbit = 8; srclen--; continue; } if ((mask & (1 << (--maskbit))) == 0) { if (destptr + 4 > destptr_end) break; memcpy(destptr, srcptr, 4); srclen -= 4; destptr += 4; srcptr += 4; } else { ofs = *srcptr++; cnt = *srcptr++; ofs += cnt * 256; cnt = ((cnt >> 3) & 0x1f) + 1; ofs &= 0x7ff; srclen -= 2; cnt *= 4; if (destptr + cnt > destptr_end) { cnt = destptr_end - destptr; } for (; cnt > 0; cnt--) { *destptr = *(destptr - ofs); destptr++; } } } return destptr - destptr_bak; }
true
FFmpeg
dbc53ffc7c398f90ae1cf59e513d3882bc0dc188
static unsigned int mszh_decomp(unsigned char * srcptr, int srclen, unsigned char * destptr, unsigned int destsize) { unsigned char *destptr_bak = destptr; unsigned char *destptr_end = destptr + destsize; unsigned char mask = 0; unsigned char maskbit = 0; unsigned int ofs, cnt; while (srclen > 0 && destptr < destptr_end) { if (maskbit == 0) { mask = *srcptr++; maskbit = 8; srclen--; continue; } if ((mask & (1 << (--maskbit))) == 0) { if (destptr + 4 > destptr_end) break; memcpy(destptr, srcptr, 4); srclen -= 4; destptr += 4; srcptr += 4; } else { ofs = *srcptr++; cnt = *srcptr++; ofs += cnt * 256; cnt = ((cnt >> 3) & 0x1f) + 1; ofs &= 0x7ff; srclen -= 2; cnt *= 4; if (destptr + cnt > destptr_end) { cnt = destptr_end - destptr; } for (; cnt > 0; cnt--) { *destptr = *(destptr - ofs); destptr++; } } } return destptr - destptr_bak; }
{ "code": [ " if (destptr + 4 > destptr_end)", " if (destptr + cnt > destptr_end) {" ], "line_no": [ 33, 61 ] }
static unsigned int FUNC_0(unsigned char * VAR_0, int VAR_1, unsigned char * VAR_2, unsigned int VAR_3) { unsigned char *VAR_4 = VAR_2; unsigned char *VAR_5 = VAR_2 + VAR_3; unsigned char VAR_6 = 0; unsigned char VAR_7 = 0; unsigned int VAR_8, VAR_9; while (VAR_1 > 0 && VAR_2 < VAR_5) { if (VAR_7 == 0) { VAR_6 = *VAR_0++; VAR_7 = 8; VAR_1--; continue; } if ((VAR_6 & (1 << (--VAR_7))) == 0) { if (VAR_2 + 4 > VAR_5) break; memcpy(VAR_2, VAR_0, 4); VAR_1 -= 4; VAR_2 += 4; VAR_0 += 4; } else { VAR_8 = *VAR_0++; VAR_9 = *VAR_0++; VAR_8 += VAR_9 * 256; VAR_9 = ((VAR_9 >> 3) & 0x1f) + 1; VAR_8 &= 0x7ff; VAR_1 -= 2; VAR_9 *= 4; if (VAR_2 + VAR_9 > VAR_5) { VAR_9 = VAR_5 - VAR_2; } for (; VAR_9 > 0; VAR_9--) { *VAR_2 = *(VAR_2 - VAR_8); VAR_2++; } } } return VAR_2 - VAR_4; }
[ "static unsigned int FUNC_0(unsigned char * VAR_0, int VAR_1, unsigned char * VAR_2, unsigned int VAR_3)\n{", "unsigned char *VAR_4 = VAR_2;", "unsigned char *VAR_5 = VAR_2 + VAR_3;", "unsigned char VAR_6 = 0;", "unsigned char VAR_7 = 0;", "unsigned int VAR_8, VAR_9;", "while (VAR_1 > 0 && VAR_2 < VAR_5) {", "if (VAR_7 == 0) {", "VAR_6 = *VAR_0++;", "VAR_7 = 8;", "VAR_1--;", "continue;", "}", "if ((VAR_6 & (1 << (--VAR_7))) == 0) {", "if (VAR_2 + 4 > VAR_5)\nbreak;", "memcpy(VAR_2, VAR_0, 4);", "VAR_1 -= 4;", "VAR_2 += 4;", "VAR_0 += 4;", "} else {", "VAR_8 = *VAR_0++;", "VAR_9 = *VAR_0++;", "VAR_8 += VAR_9 * 256;", "VAR_9 = ((VAR_9 >> 3) & 0x1f) + 1;", "VAR_8 &= 0x7ff;", "VAR_1 -= 2;", "VAR_9 *= 4;", "if (VAR_2 + VAR_9 > VAR_5) {", "VAR_9 = VAR_5 - VAR_2;", "}", "for (; VAR_9 > 0; VAR_9--) {", "*VAR_2 = *(VAR_2 - VAR_8);", "VAR_2++;", "}", "}", "}", "return VAR_2 - VAR_4;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 83 ] ]
17,891
static int decode_codestream(Jpeg2000DecoderContext *s) { Jpeg2000CodingStyle *codsty = s->codsty; Jpeg2000QuantStyle *qntsty = s->qntsty; uint8_t *properties = s->properties; for (;;){ int oldpos, marker, len, ret = 0; if (bytestream2_get_bytes_left(&s->g) < 2) { av_log(s->avctx, AV_LOG_ERROR, "Missing EOC\n"); break; } marker = bytestream2_get_be16u(&s->g); av_dlog(s->avctx, "marker 0x%.4X at pos 0x%x\n", marker, bytestream2_tell(&s->g) - 4); oldpos = bytestream2_tell(&s->g); if (marker == JPEG2000_SOD){ Jpeg2000Tile *tile = s->tile + s->curtileno; if (ret = init_tile(s, s->curtileno)) { av_log(s->avctx, AV_LOG_ERROR, "tile initialization failed\n"); return ret; } if (ret = jpeg2000_decode_packets(s, tile)) { av_log(s->avctx, AV_LOG_ERROR, "packets decoding failed\n"); return ret; } continue; } if (marker == JPEG2000_EOC) break; if (bytestream2_get_bytes_left(&s->g) < 2) return AVERROR(EINVAL); len = bytestream2_get_be16u(&s->g); switch (marker){ case JPEG2000_SIZ: ret = get_siz(s); break; case JPEG2000_COC: ret = get_coc(s, codsty, properties); break; case JPEG2000_COD: ret = get_cod(s, codsty, properties); break; case JPEG2000_QCC: ret = get_qcc(s, len, qntsty, properties); break; case JPEG2000_QCD: ret = get_qcd(s, len, qntsty, properties); break; case JPEG2000_SOT: if (!(ret = get_sot(s))){ codsty = s->tile[s->curtileno].codsty; qntsty = s->tile[s->curtileno].qntsty; properties = s->tile[s->curtileno].properties; } break; case JPEG2000_COM: // the comment is ignored bytestream2_skip(&s->g, len - 2); break; default: av_log(s->avctx, AV_LOG_ERROR, "unsupported marker 0x%.4X at pos 0x%x\n", marker, bytestream2_tell(&s->g) - 4); bytestream2_skip(&s->g, len - 2); break; } if (bytestream2_tell(&s->g) - oldpos != len || ret){ av_log(s->avctx, AV_LOG_ERROR, "error during processing marker segment %.4x\n", marker); return ret ? ret : -1; } } return 0; }
true
FFmpeg
17e66c9ff4774e254932d34dade77b1c04139a4f
static int decode_codestream(Jpeg2000DecoderContext *s) { Jpeg2000CodingStyle *codsty = s->codsty; Jpeg2000QuantStyle *qntsty = s->qntsty; uint8_t *properties = s->properties; for (;;){ int oldpos, marker, len, ret = 0; if (bytestream2_get_bytes_left(&s->g) < 2) { av_log(s->avctx, AV_LOG_ERROR, "Missing EOC\n"); break; } marker = bytestream2_get_be16u(&s->g); av_dlog(s->avctx, "marker 0x%.4X at pos 0x%x\n", marker, bytestream2_tell(&s->g) - 4); oldpos = bytestream2_tell(&s->g); if (marker == JPEG2000_SOD){ Jpeg2000Tile *tile = s->tile + s->curtileno; if (ret = init_tile(s, s->curtileno)) { av_log(s->avctx, AV_LOG_ERROR, "tile initialization failed\n"); return ret; } if (ret = jpeg2000_decode_packets(s, tile)) { av_log(s->avctx, AV_LOG_ERROR, "packets decoding failed\n"); return ret; } continue; } if (marker == JPEG2000_EOC) break; if (bytestream2_get_bytes_left(&s->g) < 2) return AVERROR(EINVAL); len = bytestream2_get_be16u(&s->g); switch (marker){ case JPEG2000_SIZ: ret = get_siz(s); break; case JPEG2000_COC: ret = get_coc(s, codsty, properties); break; case JPEG2000_COD: ret = get_cod(s, codsty, properties); break; case JPEG2000_QCC: ret = get_qcc(s, len, qntsty, properties); break; case JPEG2000_QCD: ret = get_qcd(s, len, qntsty, properties); break; case JPEG2000_SOT: if (!(ret = get_sot(s))){ codsty = s->tile[s->curtileno].codsty; qntsty = s->tile[s->curtileno].qntsty; properties = s->tile[s->curtileno].properties; } break; case JPEG2000_COM: bytestream2_skip(&s->g, len - 2); break; default: av_log(s->avctx, AV_LOG_ERROR, "unsupported marker 0x%.4X at pos 0x%x\n", marker, bytestream2_tell(&s->g) - 4); bytestream2_skip(&s->g, len - 2); break; } if (bytestream2_tell(&s->g) - oldpos != len || ret){ av_log(s->avctx, AV_LOG_ERROR, "error during processing marker segment %.4x\n", marker); return ret ? ret : -1; } } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(Jpeg2000DecoderContext *VAR_0) { Jpeg2000CodingStyle *codsty = VAR_0->codsty; Jpeg2000QuantStyle *qntsty = VAR_0->qntsty; uint8_t *properties = VAR_0->properties; for (;;){ int VAR_1, VAR_2, VAR_3, VAR_4 = 0; if (bytestream2_get_bytes_left(&VAR_0->g) < 2) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Missing EOC\n"); break; } VAR_2 = bytestream2_get_be16u(&VAR_0->g); av_dlog(VAR_0->avctx, "VAR_2 0x%.4X at pos 0x%x\n", VAR_2, bytestream2_tell(&VAR_0->g) - 4); VAR_1 = bytestream2_tell(&VAR_0->g); if (VAR_2 == JPEG2000_SOD){ Jpeg2000Tile *tile = VAR_0->tile + VAR_0->curtileno; if (VAR_4 = init_tile(VAR_0, VAR_0->curtileno)) { av_log(VAR_0->avctx, AV_LOG_ERROR, "tile initialization failed\n"); return VAR_4; } if (VAR_4 = jpeg2000_decode_packets(VAR_0, tile)) { av_log(VAR_0->avctx, AV_LOG_ERROR, "packets decoding failed\n"); return VAR_4; } continue; } if (VAR_2 == JPEG2000_EOC) break; if (bytestream2_get_bytes_left(&VAR_0->g) < 2) return AVERROR(EINVAL); VAR_3 = bytestream2_get_be16u(&VAR_0->g); switch (VAR_2){ case JPEG2000_SIZ: VAR_4 = get_siz(VAR_0); break; case JPEG2000_COC: VAR_4 = get_coc(VAR_0, codsty, properties); break; case JPEG2000_COD: VAR_4 = get_cod(VAR_0, codsty, properties); break; case JPEG2000_QCC: VAR_4 = get_qcc(VAR_0, VAR_3, qntsty, properties); break; case JPEG2000_QCD: VAR_4 = get_qcd(VAR_0, VAR_3, qntsty, properties); break; case JPEG2000_SOT: if (!(VAR_4 = get_sot(VAR_0))){ codsty = VAR_0->tile[VAR_0->curtileno].codsty; qntsty = VAR_0->tile[VAR_0->curtileno].qntsty; properties = VAR_0->tile[VAR_0->curtileno].properties; } break; case JPEG2000_COM: bytestream2_skip(&VAR_0->g, VAR_3 - 2); break; default: av_log(VAR_0->avctx, AV_LOG_ERROR, "unsupported VAR_2 0x%.4X at pos 0x%x\n", VAR_2, bytestream2_tell(&VAR_0->g) - 4); bytestream2_skip(&VAR_0->g, VAR_3 - 2); break; } if (bytestream2_tell(&VAR_0->g) - VAR_1 != VAR_3 || VAR_4){ av_log(VAR_0->avctx, AV_LOG_ERROR, "error during processing VAR_2 segment %.4x\n", VAR_2); return VAR_4 ? VAR_4 : -1; } } return 0; }
[ "static int FUNC_0(Jpeg2000DecoderContext *VAR_0)\n{", "Jpeg2000CodingStyle *codsty = VAR_0->codsty;", "Jpeg2000QuantStyle *qntsty = VAR_0->qntsty;", "uint8_t *properties = VAR_0->properties;", "for (;;){", "int VAR_1, VAR_2, VAR_3, VAR_4 = 0;", "if (bytestream2_get_bytes_left(&VAR_0->g) < 2) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Missing EOC\\n\");", "break;", "}", "VAR_2 = bytestream2_get_be16u(&VAR_0->g);", "av_dlog(VAR_0->avctx, \"VAR_2 0x%.4X at pos 0x%x\\n\", VAR_2, bytestream2_tell(&VAR_0->g) - 4);", "VAR_1 = bytestream2_tell(&VAR_0->g);", "if (VAR_2 == JPEG2000_SOD){", "Jpeg2000Tile *tile = VAR_0->tile + VAR_0->curtileno;", "if (VAR_4 = init_tile(VAR_0, VAR_0->curtileno)) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"tile initialization failed\\n\");", "return VAR_4;", "}", "if (VAR_4 = jpeg2000_decode_packets(VAR_0, tile)) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"packets decoding failed\\n\");", "return VAR_4;", "}", "continue;", "}", "if (VAR_2 == JPEG2000_EOC)\nbreak;", "if (bytestream2_get_bytes_left(&VAR_0->g) < 2)\nreturn AVERROR(EINVAL);", "VAR_3 = bytestream2_get_be16u(&VAR_0->g);", "switch (VAR_2){", "case JPEG2000_SIZ:\nVAR_4 = get_siz(VAR_0);", "break;", "case JPEG2000_COC:\nVAR_4 = get_coc(VAR_0, codsty, properties);", "break;", "case JPEG2000_COD:\nVAR_4 = get_cod(VAR_0, codsty, properties);", "break;", "case JPEG2000_QCC:\nVAR_4 = get_qcc(VAR_0, VAR_3, qntsty, properties);", "break;", "case JPEG2000_QCD:\nVAR_4 = get_qcd(VAR_0, VAR_3, qntsty, properties);", "break;", "case JPEG2000_SOT:\nif (!(VAR_4 = get_sot(VAR_0))){", "codsty = VAR_0->tile[VAR_0->curtileno].codsty;", "qntsty = VAR_0->tile[VAR_0->curtileno].qntsty;", "properties = VAR_0->tile[VAR_0->curtileno].properties;", "}", "break;", "case JPEG2000_COM:\nbytestream2_skip(&VAR_0->g, VAR_3 - 2);", "break;", "default:\nav_log(VAR_0->avctx, AV_LOG_ERROR, \"unsupported VAR_2 0x%.4X at pos 0x%x\\n\", VAR_2, bytestream2_tell(&VAR_0->g) - 4);", "bytestream2_skip(&VAR_0->g, VAR_3 - 2);", "break;", "}", "if (bytestream2_tell(&VAR_0->g) - VAR_1 != VAR_3 || VAR_4){", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"error during processing VAR_2 segment %.4x\\n\", VAR_2);", "return VAR_4 ? VAR_4 : -1;", "}", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61, 63 ], [ 67, 69 ], [ 71 ], [ 73 ], [ 75, 77 ], [ 81 ], [ 83, 85 ], [ 87 ], [ 89, 91 ], [ 93 ], [ 95, 97 ], [ 99 ], [ 101, 103 ], [ 105 ], [ 107, 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121, 125 ], [ 127 ], [ 129, 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ] ]
17,895
void do_mulldo (void) { int64_t th; uint64_t tl; muls64(&tl, &th, T0, T1); if (likely(th == 0)) { xer_ov = 0; } else { xer_ov = 1; xer_so = 1; } T0 = (int64_t)tl; }
true
qemu
88ad920b8adbce8b00085c51a61e57b5fbc83b0c
void do_mulldo (void) { int64_t th; uint64_t tl; muls64(&tl, &th, T0, T1); if (likely(th == 0)) { xer_ov = 0; } else { xer_ov = 1; xer_so = 1; } T0 = (int64_t)tl; }
{ "code": [ " if (likely(th == 0)) {" ], "line_no": [ 13 ] }
void FUNC_0 (void) { int64_t th; uint64_t tl; muls64(&tl, &th, T0, T1); if (likely(th == 0)) { xer_ov = 0; } else { xer_ov = 1; xer_so = 1; } T0 = (int64_t)tl; }
[ "void FUNC_0 (void)\n{", "int64_t th;", "uint64_t tl;", "muls64(&tl, &th, T0, T1);", "if (likely(th == 0)) {", "xer_ov = 0;", "} else {", "xer_ov = 1;", "xer_so = 1;", "}", "T0 = (int64_t)tl;", "}" ]
[ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ] ]
17,896
static int decode_unit(SCPRContext *s, PixelModel *pixel, unsigned step, unsigned *rval) { GetByteContext *gb = &s->gb; RangeCoder *rc = &s->rc; unsigned totfr = pixel->total_freq; unsigned value, x = 0, cumfr = 0, cnt_x = 0; int i, j, ret, c, cnt_c; if ((ret = s->get_freq(rc, totfr, &value)) < 0) return ret; while (x < 16) { cnt_x = pixel->lookup[x]; if (value >= cumfr + cnt_x) cumfr += cnt_x; else break; x++; } c = x * 16; cnt_c = 0; while (c < 256) { cnt_c = pixel->freq[c]; if (value >= cumfr + cnt_c) cumfr += cnt_c; else break; c++; } s->decode(gb, rc, cumfr, cnt_c, totfr); pixel->freq[c] = cnt_c + step; pixel->lookup[x] = cnt_x + step; totfr += step; if (totfr > BOT) { totfr = 0; for (i = 0; i < 256; i++) { unsigned nc = (pixel->freq[i] >> 1) + 1; pixel->freq[i] = nc; totfr += nc; } for (i = 0; i < 16; i++) { unsigned sum = 0; unsigned i16_17 = i << 4; for (j = 0; j < 16; j++) sum += pixel->freq[i16_17 + j]; pixel->lookup[i] = sum; } } pixel->total_freq = totfr; *rval = c & s->cbits; return 0; }
false
FFmpeg
86ab6b6e08e2982fb5785e0691c0a7e289339ffb
static int decode_unit(SCPRContext *s, PixelModel *pixel, unsigned step, unsigned *rval) { GetByteContext *gb = &s->gb; RangeCoder *rc = &s->rc; unsigned totfr = pixel->total_freq; unsigned value, x = 0, cumfr = 0, cnt_x = 0; int i, j, ret, c, cnt_c; if ((ret = s->get_freq(rc, totfr, &value)) < 0) return ret; while (x < 16) { cnt_x = pixel->lookup[x]; if (value >= cumfr + cnt_x) cumfr += cnt_x; else break; x++; } c = x * 16; cnt_c = 0; while (c < 256) { cnt_c = pixel->freq[c]; if (value >= cumfr + cnt_c) cumfr += cnt_c; else break; c++; } s->decode(gb, rc, cumfr, cnt_c, totfr); pixel->freq[c] = cnt_c + step; pixel->lookup[x] = cnt_x + step; totfr += step; if (totfr > BOT) { totfr = 0; for (i = 0; i < 256; i++) { unsigned nc = (pixel->freq[i] >> 1) + 1; pixel->freq[i] = nc; totfr += nc; } for (i = 0; i < 16; i++) { unsigned sum = 0; unsigned i16_17 = i << 4; for (j = 0; j < 16; j++) sum += pixel->freq[i16_17 + j]; pixel->lookup[i] = sum; } } pixel->total_freq = totfr; *rval = c & s->cbits; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(SCPRContext *VAR_0, PixelModel *VAR_1, unsigned VAR_2, unsigned *VAR_3) { GetByteContext *gb = &VAR_0->gb; RangeCoder *rc = &VAR_0->rc; unsigned VAR_4 = VAR_1->total_freq; unsigned VAR_5, VAR_6 = 0, VAR_7 = 0, VAR_8 = 0; int VAR_9, VAR_10, VAR_11, VAR_12, VAR_13; if ((VAR_11 = VAR_0->get_freq(rc, VAR_4, &VAR_5)) < 0) return VAR_11; while (VAR_6 < 16) { VAR_8 = VAR_1->lookup[VAR_6]; if (VAR_5 >= VAR_7 + VAR_8) VAR_7 += VAR_8; else break; VAR_6++; } VAR_12 = VAR_6 * 16; VAR_13 = 0; while (VAR_12 < 256) { VAR_13 = VAR_1->freq[VAR_12]; if (VAR_5 >= VAR_7 + VAR_13) VAR_7 += VAR_13; else break; VAR_12++; } VAR_0->decode(gb, rc, VAR_7, VAR_13, VAR_4); VAR_1->freq[VAR_12] = VAR_13 + VAR_2; VAR_1->lookup[VAR_6] = VAR_8 + VAR_2; VAR_4 += VAR_2; if (VAR_4 > BOT) { VAR_4 = 0; for (VAR_9 = 0; VAR_9 < 256; VAR_9++) { unsigned VAR_14 = (VAR_1->freq[VAR_9] >> 1) + 1; VAR_1->freq[VAR_9] = VAR_14; VAR_4 += VAR_14; } for (VAR_9 = 0; VAR_9 < 16; VAR_9++) { unsigned VAR_15 = 0; unsigned VAR_16 = VAR_9 << 4; for (VAR_10 = 0; VAR_10 < 16; VAR_10++) VAR_15 += VAR_1->freq[VAR_16 + VAR_10]; VAR_1->lookup[VAR_9] = VAR_15; } } VAR_1->total_freq = VAR_4; *VAR_3 = VAR_12 & VAR_0->cbits; return 0; }
[ "static int FUNC_0(SCPRContext *VAR_0, PixelModel *VAR_1, unsigned VAR_2, unsigned *VAR_3)\n{", "GetByteContext *gb = &VAR_0->gb;", "RangeCoder *rc = &VAR_0->rc;", "unsigned VAR_4 = VAR_1->total_freq;", "unsigned VAR_5, VAR_6 = 0, VAR_7 = 0, VAR_8 = 0;", "int VAR_9, VAR_10, VAR_11, VAR_12, VAR_13;", "if ((VAR_11 = VAR_0->get_freq(rc, VAR_4, &VAR_5)) < 0)\nreturn VAR_11;", "while (VAR_6 < 16) {", "VAR_8 = VAR_1->lookup[VAR_6];", "if (VAR_5 >= VAR_7 + VAR_8)\nVAR_7 += VAR_8;", "else\nbreak;", "VAR_6++;", "}", "VAR_12 = VAR_6 * 16;", "VAR_13 = 0;", "while (VAR_12 < 256) {", "VAR_13 = VAR_1->freq[VAR_12];", "if (VAR_5 >= VAR_7 + VAR_13)\nVAR_7 += VAR_13;", "else\nbreak;", "VAR_12++;", "}", "VAR_0->decode(gb, rc, VAR_7, VAR_13, VAR_4);", "VAR_1->freq[VAR_12] = VAR_13 + VAR_2;", "VAR_1->lookup[VAR_6] = VAR_8 + VAR_2;", "VAR_4 += VAR_2;", "if (VAR_4 > BOT) {", "VAR_4 = 0;", "for (VAR_9 = 0; VAR_9 < 256; VAR_9++) {", "unsigned VAR_14 = (VAR_1->freq[VAR_9] >> 1) + 1;", "VAR_1->freq[VAR_9] = VAR_14;", "VAR_4 += VAR_14;", "}", "for (VAR_9 = 0; VAR_9 < 16; VAR_9++) {", "unsigned VAR_15 = 0;", "unsigned VAR_16 = VAR_9 << 4;", "for (VAR_10 = 0; VAR_10 < 16; VAR_10++)", "VAR_15 += VAR_1->freq[VAR_16 + VAR_10];", "VAR_1->lookup[VAR_9] = VAR_15;", "}", "}", "VAR_1->total_freq = VAR_4;", "*VAR_3 = VAR_12 & VAR_0->cbits;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17, 19 ], [ 23 ], [ 25 ], [ 27, 29 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49, 51 ], [ 53, 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 103 ], [ 107 ], [ 109 ] ]
17,897
static void sbr_env_estimate(float (*e_curr)[48], float X_high[64][40][2], SpectralBandReplication *sbr, SBRData *ch_data) { int e, i, m; if (sbr->bs_interpol_freq) { for (e = 0; e < ch_data->bs_num_env; e++) { const float recip_env_size = 0.5f / (ch_data->t_env[e + 1] - ch_data->t_env[e]); int ilb = ch_data->t_env[e] * 2 + ENVELOPE_ADJUSTMENT_OFFSET; int iub = ch_data->t_env[e + 1] * 2 + ENVELOPE_ADJUSTMENT_OFFSET; for (m = 0; m < sbr->m[1]; m++) { float sum = 0.0f; for (i = ilb; i < iub; i++) { sum += X_high[m + sbr->kx[1]][i][0] * X_high[m + sbr->kx[1]][i][0] + X_high[m + sbr->kx[1]][i][1] * X_high[m + sbr->kx[1]][i][1]; } e_curr[e][m] = sum * recip_env_size; } } } else { int k, p; for (e = 0; e < ch_data->bs_num_env; e++) { const int env_size = 2 * (ch_data->t_env[e + 1] - ch_data->t_env[e]); int ilb = ch_data->t_env[e] * 2 + ENVELOPE_ADJUSTMENT_OFFSET; int iub = ch_data->t_env[e + 1] * 2 + ENVELOPE_ADJUSTMENT_OFFSET; const uint16_t *table = ch_data->bs_freq_res[e + 1] ? sbr->f_tablehigh : sbr->f_tablelow; for (p = 0; p < sbr->n[ch_data->bs_freq_res[e + 1]]; p++) { float sum = 0.0f; const int den = env_size * (table[p + 1] - table[p]); for (k = table[p]; k < table[p + 1]; k++) { for (i = ilb; i < iub; i++) { sum += X_high[k][i][0] * X_high[k][i][0] + X_high[k][i][1] * X_high[k][i][1]; } } sum /= den; for (k = table[p]; k < table[p + 1]; k++) { e_curr[e][k - sbr->kx[1]] = sum; } } } } }
false
FFmpeg
aac46e088d67a390489af686b846dea4987d8ffb
static void sbr_env_estimate(float (*e_curr)[48], float X_high[64][40][2], SpectralBandReplication *sbr, SBRData *ch_data) { int e, i, m; if (sbr->bs_interpol_freq) { for (e = 0; e < ch_data->bs_num_env; e++) { const float recip_env_size = 0.5f / (ch_data->t_env[e + 1] - ch_data->t_env[e]); int ilb = ch_data->t_env[e] * 2 + ENVELOPE_ADJUSTMENT_OFFSET; int iub = ch_data->t_env[e + 1] * 2 + ENVELOPE_ADJUSTMENT_OFFSET; for (m = 0; m < sbr->m[1]; m++) { float sum = 0.0f; for (i = ilb; i < iub; i++) { sum += X_high[m + sbr->kx[1]][i][0] * X_high[m + sbr->kx[1]][i][0] + X_high[m + sbr->kx[1]][i][1] * X_high[m + sbr->kx[1]][i][1]; } e_curr[e][m] = sum * recip_env_size; } } } else { int k, p; for (e = 0; e < ch_data->bs_num_env; e++) { const int env_size = 2 * (ch_data->t_env[e + 1] - ch_data->t_env[e]); int ilb = ch_data->t_env[e] * 2 + ENVELOPE_ADJUSTMENT_OFFSET; int iub = ch_data->t_env[e + 1] * 2 + ENVELOPE_ADJUSTMENT_OFFSET; const uint16_t *table = ch_data->bs_freq_res[e + 1] ? sbr->f_tablehigh : sbr->f_tablelow; for (p = 0; p < sbr->n[ch_data->bs_freq_res[e + 1]]; p++) { float sum = 0.0f; const int den = env_size * (table[p + 1] - table[p]); for (k = table[p]; k < table[p + 1]; k++) { for (i = ilb; i < iub; i++) { sum += X_high[k][i][0] * X_high[k][i][0] + X_high[k][i][1] * X_high[k][i][1]; } } sum /= den; for (k = table[p]; k < table[p + 1]; k++) { e_curr[e][k - sbr->kx[1]] = sum; } } } } }
{ "code": [], "line_no": [] }
static void FUNC_0(float (*VAR_0)[48], float VAR_1[64][40][2], SpectralBandReplication *VAR_2, SBRData *VAR_3) { int VAR_4, VAR_5, VAR_6; if (VAR_2->bs_interpol_freq) { for (VAR_4 = 0; VAR_4 < VAR_3->bs_num_env; VAR_4++) { const float recip_env_size = 0.5f / (VAR_3->t_env[VAR_4 + 1] - VAR_3->t_env[VAR_4]); int ilb = VAR_3->t_env[VAR_4] * 2 + ENVELOPE_ADJUSTMENT_OFFSET; int iub = VAR_3->t_env[VAR_4 + 1] * 2 + ENVELOPE_ADJUSTMENT_OFFSET; for (VAR_6 = 0; VAR_6 < VAR_2->VAR_6[1]; VAR_6++) { float sum = 0.0f; for (VAR_5 = ilb; VAR_5 < iub; VAR_5++) { sum += VAR_1[VAR_6 + VAR_2->kx[1]][VAR_5][0] * VAR_1[VAR_6 + VAR_2->kx[1]][VAR_5][0] + VAR_1[VAR_6 + VAR_2->kx[1]][VAR_5][1] * VAR_1[VAR_6 + VAR_2->kx[1]][VAR_5][1]; } VAR_0[VAR_4][VAR_6] = sum * recip_env_size; } } } else { int VAR_7, VAR_8; for (VAR_4 = 0; VAR_4 < VAR_3->bs_num_env; VAR_4++) { const int env_size = 2 * (VAR_3->t_env[VAR_4 + 1] - VAR_3->t_env[VAR_4]); int ilb = VAR_3->t_env[VAR_4] * 2 + ENVELOPE_ADJUSTMENT_OFFSET; int iub = VAR_3->t_env[VAR_4 + 1] * 2 + ENVELOPE_ADJUSTMENT_OFFSET; const uint16_t *table = VAR_3->bs_freq_res[VAR_4 + 1] ? VAR_2->f_tablehigh : VAR_2->f_tablelow; for (VAR_8 = 0; VAR_8 < VAR_2->n[VAR_3->bs_freq_res[VAR_4 + 1]]; VAR_8++) { float sum = 0.0f; const int den = env_size * (table[VAR_8 + 1] - table[VAR_8]); for (VAR_7 = table[VAR_8]; VAR_7 < table[VAR_8 + 1]; VAR_7++) { for (VAR_5 = ilb; VAR_5 < iub; VAR_5++) { sum += VAR_1[VAR_7][VAR_5][0] * VAR_1[VAR_7][VAR_5][0] + VAR_1[VAR_7][VAR_5][1] * VAR_1[VAR_7][VAR_5][1]; } } sum /= den; for (VAR_7 = table[VAR_8]; VAR_7 < table[VAR_8 + 1]; VAR_7++) { VAR_0[VAR_4][VAR_7 - VAR_2->kx[1]] = sum; } } } } }
[ "static void FUNC_0(float (*VAR_0)[48], float VAR_1[64][40][2],\nSpectralBandReplication *VAR_2, SBRData *VAR_3)\n{", "int VAR_4, VAR_5, VAR_6;", "if (VAR_2->bs_interpol_freq) {", "for (VAR_4 = 0; VAR_4 < VAR_3->bs_num_env; VAR_4++) {", "const float recip_env_size = 0.5f / (VAR_3->t_env[VAR_4 + 1] - VAR_3->t_env[VAR_4]);", "int ilb = VAR_3->t_env[VAR_4] * 2 + ENVELOPE_ADJUSTMENT_OFFSET;", "int iub = VAR_3->t_env[VAR_4 + 1] * 2 + ENVELOPE_ADJUSTMENT_OFFSET;", "for (VAR_6 = 0; VAR_6 < VAR_2->VAR_6[1]; VAR_6++) {", "float sum = 0.0f;", "for (VAR_5 = ilb; VAR_5 < iub; VAR_5++) {", "sum += VAR_1[VAR_6 + VAR_2->kx[1]][VAR_5][0] * VAR_1[VAR_6 + VAR_2->kx[1]][VAR_5][0] +\nVAR_1[VAR_6 + VAR_2->kx[1]][VAR_5][1] * VAR_1[VAR_6 + VAR_2->kx[1]][VAR_5][1];", "}", "VAR_0[VAR_4][VAR_6] = sum * recip_env_size;", "}", "}", "} else {", "int VAR_7, VAR_8;", "for (VAR_4 = 0; VAR_4 < VAR_3->bs_num_env; VAR_4++) {", "const int env_size = 2 * (VAR_3->t_env[VAR_4 + 1] - VAR_3->t_env[VAR_4]);", "int ilb = VAR_3->t_env[VAR_4] * 2 + ENVELOPE_ADJUSTMENT_OFFSET;", "int iub = VAR_3->t_env[VAR_4 + 1] * 2 + ENVELOPE_ADJUSTMENT_OFFSET;", "const uint16_t *table = VAR_3->bs_freq_res[VAR_4 + 1] ? VAR_2->f_tablehigh : VAR_2->f_tablelow;", "for (VAR_8 = 0; VAR_8 < VAR_2->n[VAR_3->bs_freq_res[VAR_4 + 1]]; VAR_8++) {", "float sum = 0.0f;", "const int den = env_size * (table[VAR_8 + 1] - table[VAR_8]);", "for (VAR_7 = table[VAR_8]; VAR_7 < table[VAR_8 + 1]; VAR_7++) {", "for (VAR_5 = ilb; VAR_5 < iub; VAR_5++) {", "sum += VAR_1[VAR_7][VAR_5][0] * VAR_1[VAR_7][VAR_5][0] +\nVAR_1[VAR_7][VAR_5][1] * VAR_1[VAR_7][VAR_5][1];", "}", "}", "sum /= den;", "for (VAR_7 = table[VAR_8]; VAR_7 < table[VAR_8 + 1]; VAR_7++) {", "VAR_0[VAR_4][VAR_7 - VAR_2->kx[1]] = sum;", "}", "}", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 23 ], [ 25 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ], [ 73, 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ] ]
17,898
static int test_scalarproduct_float(AVFloatDSPContext *fdsp, AVFloatDSPContext *cdsp, const float *v1, const float *v2) { float cprod, oprod; int ret; cprod = cdsp->scalarproduct_float(v1, v2, LEN); oprod = fdsp->scalarproduct_float(v1, v2, LEN); if (ret = compare_floats(&cprod, &oprod, 1, ARBITRARY_SCALARPRODUCT_CONST)) av_log(NULL, AV_LOG_ERROR, "scalarproduct_float failed\n"); return ret; }
false
FFmpeg
e53c9065ca08a9153ecc73a6a8940bcc6d667e58
static int test_scalarproduct_float(AVFloatDSPContext *fdsp, AVFloatDSPContext *cdsp, const float *v1, const float *v2) { float cprod, oprod; int ret; cprod = cdsp->scalarproduct_float(v1, v2, LEN); oprod = fdsp->scalarproduct_float(v1, v2, LEN); if (ret = compare_floats(&cprod, &oprod, 1, ARBITRARY_SCALARPRODUCT_CONST)) av_log(NULL, AV_LOG_ERROR, "scalarproduct_float 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) { float VAR_4, VAR_5; int VAR_6; VAR_4 = VAR_1->scalarproduct_float(VAR_2, VAR_3, LEN); VAR_5 = VAR_0->scalarproduct_float(VAR_2, VAR_3, LEN); if (VAR_6 = compare_floats(&VAR_4, &VAR_5, 1, ARBITRARY_SCALARPRODUCT_CONST)) av_log(NULL, AV_LOG_ERROR, "scalarproduct_float failed\n"); return VAR_6; }
[ "static int FUNC_0(AVFloatDSPContext *VAR_0, AVFloatDSPContext *VAR_1,\nconst float *VAR_2, const float *VAR_3)\n{", "float VAR_4, VAR_5;", "int VAR_6;", "VAR_4 = VAR_1->scalarproduct_float(VAR_2, VAR_3, LEN);", "VAR_5 = VAR_0->scalarproduct_float(VAR_2, VAR_3, LEN);", "if (VAR_6 = compare_floats(&VAR_4, &VAR_5, 1, ARBITRARY_SCALARPRODUCT_CONST))\nav_log(NULL, AV_LOG_ERROR, \"scalarproduct_float failed\\n\");", "return VAR_6;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 19, 21 ], [ 25 ], [ 27 ] ]
17,899
static int mov_read_pasp(MOVContext *c, ByteIOContext *pb, MOVAtom atom) { const int num = get_be32(pb); const int den = get_be32(pb); AVStream * const st = c->fc->streams[c->fc->nb_streams-1]; if (den != 0) { if ((st->sample_aspect_ratio.den != 1 || st->sample_aspect_ratio.num) && // default (den != st->sample_aspect_ratio.den || num != st->sample_aspect_ratio.num)) av_log(c->fc, AV_LOG_WARNING, "sample aspect ratio already set to %d:%d, overriding by 'pasp' atom\n", st->sample_aspect_ratio.num, st->sample_aspect_ratio.den); st->sample_aspect_ratio.num = num; st->sample_aspect_ratio.den = den; } return 0; }
false
FFmpeg
6a63ff19b6a7fe3bc32c7fb4a62fca8f65786432
static int mov_read_pasp(MOVContext *c, ByteIOContext *pb, MOVAtom atom) { const int num = get_be32(pb); const int den = get_be32(pb); AVStream * const st = c->fc->streams[c->fc->nb_streams-1]; if (den != 0) { if ((st->sample_aspect_ratio.den != 1 || st->sample_aspect_ratio.num) && (den != st->sample_aspect_ratio.den || num != st->sample_aspect_ratio.num)) av_log(c->fc, AV_LOG_WARNING, "sample aspect ratio already set to %d:%d, overriding by 'pasp' atom\n", st->sample_aspect_ratio.num, st->sample_aspect_ratio.den); st->sample_aspect_ratio.num = num; st->sample_aspect_ratio.den = den; } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(MOVContext *VAR_0, ByteIOContext *VAR_1, MOVAtom VAR_2) { const int VAR_3 = get_be32(VAR_1); const int VAR_4 = get_be32(VAR_1); AVStream * const st = VAR_0->fc->streams[VAR_0->fc->nb_streams-1]; if (VAR_4 != 0) { if ((st->sample_aspect_ratio.VAR_4 != 1 || st->sample_aspect_ratio.VAR_3) && (VAR_4 != st->sample_aspect_ratio.VAR_4 || VAR_3 != st->sample_aspect_ratio.VAR_3)) av_log(VAR_0->fc, AV_LOG_WARNING, "sample aspect ratio already set to %d:%d, overriding by 'pasp' VAR_2\n", st->sample_aspect_ratio.VAR_3, st->sample_aspect_ratio.VAR_4); st->sample_aspect_ratio.VAR_3 = VAR_3; st->sample_aspect_ratio.VAR_4 = VAR_4; } return 0; }
[ "static int FUNC_0(MOVContext *VAR_0, ByteIOContext *VAR_1, MOVAtom VAR_2)\n{", "const int VAR_3 = get_be32(VAR_1);", "const int VAR_4 = get_be32(VAR_1);", "AVStream * const st = VAR_0->fc->streams[VAR_0->fc->nb_streams-1];", "if (VAR_4 != 0) {", "if ((st->sample_aspect_ratio.VAR_4 != 1 || st->sample_aspect_ratio.VAR_3) &&\n(VAR_4 != st->sample_aspect_ratio.VAR_4 || VAR_3 != st->sample_aspect_ratio.VAR_3))\nav_log(VAR_0->fc, AV_LOG_WARNING,\n\"sample aspect ratio already set to %d:%d, overriding by 'pasp' VAR_2\\n\",\nst->sample_aspect_ratio.VAR_3, st->sample_aspect_ratio.VAR_4);", "st->sample_aspect_ratio.VAR_3 = VAR_3;", "st->sample_aspect_ratio.VAR_4 = VAR_4;", "}", "return 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 ] ]
17,900
static void MPV_encode_defaults(MpegEncContext *s){ static int done=0; MPV_common_defaults(s); if(!done){ int i; done=1; for(i=-16; i<16; i++){ default_fcode_tab[i + MAX_MV]= 1; } } s->me.mv_penalty= default_mv_penalty; s->fcode_tab= default_fcode_tab; }
false
FFmpeg
3e207bb1bd822ee1bce3e2de4c784702e0b6e24a
static void MPV_encode_defaults(MpegEncContext *s){ static int done=0; MPV_common_defaults(s); if(!done){ int i; done=1; for(i=-16; i<16; i++){ default_fcode_tab[i + MAX_MV]= 1; } } s->me.mv_penalty= default_mv_penalty; s->fcode_tab= default_fcode_tab; }
{ "code": [], "line_no": [] }
static void FUNC_0(MpegEncContext *VAR_0){ static int VAR_1=0; MPV_common_defaults(VAR_0); if(!VAR_1){ int VAR_2; VAR_1=1; for(VAR_2=-16; VAR_2<16; VAR_2++){ default_fcode_tab[VAR_2 + MAX_MV]= 1; } } VAR_0->me.mv_penalty= default_mv_penalty; VAR_0->fcode_tab= default_fcode_tab; }
[ "static void FUNC_0(MpegEncContext *VAR_0){", "static int VAR_1=0;", "MPV_common_defaults(VAR_0);", "if(!VAR_1){", "int VAR_2;", "VAR_1=1;", "for(VAR_2=-16; VAR_2<16; VAR_2++){", "default_fcode_tab[VAR_2 + MAX_MV]= 1;", "}", "}", "VAR_0->me.mv_penalty= default_mv_penalty;", "VAR_0->fcode_tab= default_fcode_tab;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ] ]
17,901
int avcodec_get_pix_fmt_loss(int dst_pix_fmt, int src_pix_fmt, int has_alpha) { const PixFmtInfo *pf, *ps; int loss; ps = &pix_fmt_info[src_pix_fmt]; pf = &pix_fmt_info[dst_pix_fmt]; /* compute loss */ loss = 0; pf = &pix_fmt_info[dst_pix_fmt]; if (pf->depth < ps->depth) loss |= FF_LOSS_DEPTH; if (pf->x_chroma_shift >= ps->x_chroma_shift || pf->y_chroma_shift >= ps->y_chroma_shift) loss |= FF_LOSS_RESOLUTION; switch(pf->color_type) { case FF_COLOR_RGB: if (ps->color_type != FF_COLOR_RGB && ps->color_type != FF_COLOR_GRAY) loss |= FF_LOSS_COLORSPACE; break; case FF_COLOR_GRAY: if (ps->color_type != FF_COLOR_GRAY) loss |= FF_LOSS_COLORSPACE; break; case FF_COLOR_YUV: if (ps->color_type != FF_COLOR_YUV) loss |= FF_LOSS_COLORSPACE; break; case FF_COLOR_YUV_JPEG: if (ps->color_type != FF_COLOR_YUV_JPEG && ps->color_type != FF_COLOR_YUV) loss |= FF_LOSS_COLORSPACE; break; default: /* fail safe test */ if (ps->color_type != pf->color_type) loss |= FF_LOSS_COLORSPACE; break; } if (pf->color_type == FF_COLOR_GRAY && ps->color_type != FF_COLOR_GRAY) loss |= FF_LOSS_CHROMA; if (!pf->is_alpha && (ps->is_alpha && has_alpha)) loss |= FF_LOSS_ALPHA; if (pf->is_paletted && (!ps->is_paletted && ps->color_type != FF_COLOR_GRAY)) loss |= FF_LOSS_COLORQUANT; return loss; }
false
FFmpeg
7e7e59409294af9caa63808e56c5cc824c98b4fc
int avcodec_get_pix_fmt_loss(int dst_pix_fmt, int src_pix_fmt, int has_alpha) { const PixFmtInfo *pf, *ps; int loss; ps = &pix_fmt_info[src_pix_fmt]; pf = &pix_fmt_info[dst_pix_fmt]; loss = 0; pf = &pix_fmt_info[dst_pix_fmt]; if (pf->depth < ps->depth) loss |= FF_LOSS_DEPTH; if (pf->x_chroma_shift >= ps->x_chroma_shift || pf->y_chroma_shift >= ps->y_chroma_shift) loss |= FF_LOSS_RESOLUTION; switch(pf->color_type) { case FF_COLOR_RGB: if (ps->color_type != FF_COLOR_RGB && ps->color_type != FF_COLOR_GRAY) loss |= FF_LOSS_COLORSPACE; break; case FF_COLOR_GRAY: if (ps->color_type != FF_COLOR_GRAY) loss |= FF_LOSS_COLORSPACE; break; case FF_COLOR_YUV: if (ps->color_type != FF_COLOR_YUV) loss |= FF_LOSS_COLORSPACE; break; case FF_COLOR_YUV_JPEG: if (ps->color_type != FF_COLOR_YUV_JPEG && ps->color_type != FF_COLOR_YUV) loss |= FF_LOSS_COLORSPACE; break; default: if (ps->color_type != pf->color_type) loss |= FF_LOSS_COLORSPACE; break; } if (pf->color_type == FF_COLOR_GRAY && ps->color_type != FF_COLOR_GRAY) loss |= FF_LOSS_CHROMA; if (!pf->is_alpha && (ps->is_alpha && has_alpha)) loss |= FF_LOSS_ALPHA; if (pf->is_paletted && (!ps->is_paletted && ps->color_type != FF_COLOR_GRAY)) loss |= FF_LOSS_COLORQUANT; return loss; }
{ "code": [], "line_no": [] }
int FUNC_0(int VAR_0, int VAR_1, int VAR_2) { const PixFmtInfo *VAR_3, *ps; int VAR_4; ps = &pix_fmt_info[VAR_1]; VAR_3 = &pix_fmt_info[VAR_0]; VAR_4 = 0; VAR_3 = &pix_fmt_info[VAR_0]; if (VAR_3->depth < ps->depth) VAR_4 |= FF_LOSS_DEPTH; if (VAR_3->x_chroma_shift >= ps->x_chroma_shift || VAR_3->y_chroma_shift >= ps->y_chroma_shift) VAR_4 |= FF_LOSS_RESOLUTION; switch(VAR_3->color_type) { case FF_COLOR_RGB: if (ps->color_type != FF_COLOR_RGB && ps->color_type != FF_COLOR_GRAY) VAR_4 |= FF_LOSS_COLORSPACE; break; case FF_COLOR_GRAY: if (ps->color_type != FF_COLOR_GRAY) VAR_4 |= FF_LOSS_COLORSPACE; break; case FF_COLOR_YUV: if (ps->color_type != FF_COLOR_YUV) VAR_4 |= FF_LOSS_COLORSPACE; break; case FF_COLOR_YUV_JPEG: if (ps->color_type != FF_COLOR_YUV_JPEG && ps->color_type != FF_COLOR_YUV) VAR_4 |= FF_LOSS_COLORSPACE; break; default: if (ps->color_type != VAR_3->color_type) VAR_4 |= FF_LOSS_COLORSPACE; break; } if (VAR_3->color_type == FF_COLOR_GRAY && ps->color_type != FF_COLOR_GRAY) VAR_4 |= FF_LOSS_CHROMA; if (!VAR_3->is_alpha && (ps->is_alpha && VAR_2)) VAR_4 |= FF_LOSS_ALPHA; if (VAR_3->is_paletted && (!ps->is_paletted && ps->color_type != FF_COLOR_GRAY)) VAR_4 |= FF_LOSS_COLORQUANT; return VAR_4; }
[ "int FUNC_0(int VAR_0, int VAR_1,\nint VAR_2)\n{", "const PixFmtInfo *VAR_3, *ps;", "int VAR_4;", "ps = &pix_fmt_info[VAR_1];", "VAR_3 = &pix_fmt_info[VAR_0];", "VAR_4 = 0;", "VAR_3 = &pix_fmt_info[VAR_0];", "if (VAR_3->depth < ps->depth)\nVAR_4 |= FF_LOSS_DEPTH;", "if (VAR_3->x_chroma_shift >= ps->x_chroma_shift ||\nVAR_3->y_chroma_shift >= ps->y_chroma_shift)\nVAR_4 |= FF_LOSS_RESOLUTION;", "switch(VAR_3->color_type) {", "case FF_COLOR_RGB:\nif (ps->color_type != FF_COLOR_RGB &&\nps->color_type != FF_COLOR_GRAY)\nVAR_4 |= FF_LOSS_COLORSPACE;", "break;", "case FF_COLOR_GRAY:\nif (ps->color_type != FF_COLOR_GRAY)\nVAR_4 |= FF_LOSS_COLORSPACE;", "break;", "case FF_COLOR_YUV:\nif (ps->color_type != FF_COLOR_YUV)\nVAR_4 |= FF_LOSS_COLORSPACE;", "break;", "case FF_COLOR_YUV_JPEG:\nif (ps->color_type != FF_COLOR_YUV_JPEG &&\nps->color_type != FF_COLOR_YUV)\nVAR_4 |= FF_LOSS_COLORSPACE;", "break;", "default:\nif (ps->color_type != VAR_3->color_type)\nVAR_4 |= FF_LOSS_COLORSPACE;", "break;", "}", "if (VAR_3->color_type == FF_COLOR_GRAY &&\nps->color_type != FF_COLOR_GRAY)\nVAR_4 |= FF_LOSS_CHROMA;", "if (!VAR_3->is_alpha && (ps->is_alpha && VAR_2))\nVAR_4 |= FF_LOSS_ALPHA;", "if (VAR_3->is_paletted && (!ps->is_paletted && ps->color_type != FF_COLOR_GRAY))\nVAR_4 |= FF_LOSS_COLORQUANT;", "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 ], [ 13 ], [ 15 ], [ 21 ], [ 23 ], [ 25, 27 ], [ 29, 31, 33 ], [ 35 ], [ 37, 39, 41, 43 ], [ 45 ], [ 47, 49, 51 ], [ 53 ], [ 55, 57, 59 ], [ 61 ], [ 63, 65, 67, 69 ], [ 71 ], [ 73, 77, 79 ], [ 81 ], [ 83 ], [ 85, 87, 89 ], [ 91, 93 ], [ 95, 97 ], [ 99 ], [ 101 ] ]
17,902
static int ftp_get_file_handle(URLContext *h) { FTPContext *s = h->priv_data; av_dlog(h, "ftp protocol get_file_handle\n"); if (s->conn_data) return ffurl_get_file_handle(s->conn_data); return AVERROR(EIO); }
false
FFmpeg
229843aa359ae0c9519977d7fa952688db63f559
static int ftp_get_file_handle(URLContext *h) { FTPContext *s = h->priv_data; av_dlog(h, "ftp protocol get_file_handle\n"); if (s->conn_data) return ffurl_get_file_handle(s->conn_data); return AVERROR(EIO); }
{ "code": [], "line_no": [] }
static int FUNC_0(URLContext *VAR_0) { FTPContext *s = VAR_0->priv_data; av_dlog(VAR_0, "ftp protocol get_file_handle\n"); if (s->conn_data) return ffurl_get_file_handle(s->conn_data); return AVERROR(EIO); }
[ "static int FUNC_0(URLContext *VAR_0)\n{", "FTPContext *s = VAR_0->priv_data;", "av_dlog(VAR_0, \"ftp protocol get_file_handle\\n\");", "if (s->conn_data)\nreturn ffurl_get_file_handle(s->conn_data);", "return AVERROR(EIO);", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 13, 15 ], [ 19 ], [ 21 ] ]
17,903
static void sdp_write_header(char *buff, int size, struct sdp_session_level *s) { av_strlcatf(buff, size, "v=%d\r\n" "o=- %d %d IN IPV4 %s\r\n" "t=%d %d\r\n" "s=%s\r\n" "a=tool:libavformat " AV_STRINGIFY(LIBAVFORMAT_VERSION) "\r\n", s->sdp_version, s->id, s->version, s->src_addr, s->start_time, s->end_time, s->name[0] ? s->name : "No Name"); dest_write(buff, size, s->dst_addr, s->ttl); }
false
FFmpeg
c16184e9baad4e4304d5bfb9340e8b5b6decad65
static void sdp_write_header(char *buff, int size, struct sdp_session_level *s) { av_strlcatf(buff, size, "v=%d\r\n" "o=- %d %d IN IPV4 %s\r\n" "t=%d %d\r\n" "s=%s\r\n" "a=tool:libavformat " AV_STRINGIFY(LIBAVFORMAT_VERSION) "\r\n", s->sdp_version, s->id, s->version, s->src_addr, s->start_time, s->end_time, s->name[0] ? s->name : "No Name"); dest_write(buff, size, s->dst_addr, s->ttl); }
{ "code": [], "line_no": [] }
static void FUNC_0(char *VAR_0, int VAR_1, struct sdp_session_level *VAR_2) { av_strlcatf(VAR_0, VAR_1, "v=%d\r\n" "o=- %d %d IN IPV4 %VAR_2\r\n" "t=%d %d\r\n" "VAR_2=%VAR_2\r\n" "a=tool:libavformat " AV_STRINGIFY(LIBAVFORMAT_VERSION) "\r\n", VAR_2->sdp_version, VAR_2->id, VAR_2->version, VAR_2->src_addr, VAR_2->start_time, VAR_2->end_time, VAR_2->name[0] ? VAR_2->name : "No Name"); dest_write(VAR_0, VAR_1, VAR_2->dst_addr, VAR_2->ttl); }
[ "static void FUNC_0(char *VAR_0, int VAR_1, struct sdp_session_level *VAR_2)\n{", "av_strlcatf(VAR_0, VAR_1, \"v=%d\\r\\n\"\n\"o=- %d %d IN IPV4 %VAR_2\\r\\n\"\n\"t=%d %d\\r\\n\"\n\"VAR_2=%VAR_2\\r\\n\"\n\"a=tool:libavformat \" AV_STRINGIFY(LIBAVFORMAT_VERSION) \"\\r\\n\",\nVAR_2->sdp_version,\nVAR_2->id, VAR_2->version, VAR_2->src_addr,\nVAR_2->start_time, VAR_2->end_time,\nVAR_2->name[0] ? VAR_2->name : \"No Name\");", "dest_write(VAR_0, VAR_1, VAR_2->dst_addr, VAR_2->ttl);", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7, 9, 11, 13, 15, 17, 19, 21 ], [ 23 ], [ 25 ] ]
17,905
static int print_device_sources(AVInputFormat *fmt, AVDictionary *opts) { int ret, i; AVFormatContext *dev = NULL; AVDeviceInfoList *device_list = NULL; AVDictionary *tmp_opts = NULL; if (!fmt || !fmt->priv_class || !AV_IS_INPUT_DEVICE(fmt->priv_class->category)) return AVERROR(EINVAL); printf("Audo-detected sources for %s:\n", fmt->name); if (!fmt->get_device_list) { ret = AVERROR(ENOSYS); printf("Cannot list sources. Not implemented.\n"); goto fail; } /* TODO: avformat_open_input calls read_header callback which is not necessary. Function like avformat_alloc_output_context2 for input could be helpful here. */ av_dict_copy(&tmp_opts, opts, 0); if ((ret = avformat_open_input(&dev, NULL, fmt, &tmp_opts)) < 0) { printf("Cannot open device: %s.\n", fmt->name); goto fail; } if ((ret = avdevice_list_devices(dev, &device_list)) < 0) { printf("Cannot list sources.\n"); goto fail; } for (i = 0; i < device_list->nb_devices; i++) { printf("%s %s [%s]\n", device_list->default_device == i ? "*" : " ", device_list->devices[i]->device_name, device_list->devices[i]->device_description); } fail: av_dict_free(&tmp_opts); avdevice_free_list_devices(&device_list); avformat_close_input(&dev); return ret; }
true
FFmpeg
44e6eeb30de8e2d20db56284984da4615763525c
static int print_device_sources(AVInputFormat *fmt, AVDictionary *opts) { int ret, i; AVFormatContext *dev = NULL; AVDeviceInfoList *device_list = NULL; AVDictionary *tmp_opts = NULL; if (!fmt || !fmt->priv_class || !AV_IS_INPUT_DEVICE(fmt->priv_class->category)) return AVERROR(EINVAL); printf("Audo-detected sources for %s:\n", fmt->name); if (!fmt->get_device_list) { ret = AVERROR(ENOSYS); printf("Cannot list sources. Not implemented.\n"); goto fail; } av_dict_copy(&tmp_opts, opts, 0); if ((ret = avformat_open_input(&dev, NULL, fmt, &tmp_opts)) < 0) { printf("Cannot open device: %s.\n", fmt->name); goto fail; } if ((ret = avdevice_list_devices(dev, &device_list)) < 0) { printf("Cannot list sources.\n"); goto fail; } for (i = 0; i < device_list->nb_devices; i++) { printf("%s %s [%s]\n", device_list->default_device == i ? "*" : " ", device_list->devices[i]->device_name, device_list->devices[i]->device_description); } fail: av_dict_free(&tmp_opts); avdevice_free_list_devices(&device_list); avformat_close_input(&dev); return ret; }
{ "code": [ " AVFormatContext *dev = NULL;", " AVDictionary *tmp_opts = NULL;", " av_dict_copy(&tmp_opts, opts, 0);", " if ((ret = avformat_open_input(&dev, NULL, fmt, &tmp_opts)) < 0) {", " printf(\"Cannot open device: %s.\\n\", fmt->name);", " goto fail;", " if ((ret = avdevice_list_devices(dev, &device_list)) < 0) {", " av_dict_free(&tmp_opts);", " avformat_close_input(&dev);", " AVFormatContext *dev = NULL;", " AVDictionary *tmp_opts = NULL;", " printf(\"Cannot open device: %s.\\n\", fmt->name);", " goto fail;", " av_dict_copy(&tmp_opts, opts, 0);", " if ((ret = avdevice_list_devices(dev, &device_list)) < 0) {", " av_dict_free(&tmp_opts);" ], "line_no": [ 7, 11, 39, 41, 43, 29, 51, 73, 77, 7, 11, 43, 29, 39, 51, 73 ] }
static int FUNC_0(AVInputFormat *VAR_0, AVDictionary *VAR_1) { int VAR_2, VAR_3; AVFormatContext *dev = NULL; AVDeviceInfoList *device_list = NULL; AVDictionary *tmp_opts = NULL; if (!VAR_0 || !VAR_0->priv_class || !AV_IS_INPUT_DEVICE(VAR_0->priv_class->category)) return AVERROR(EINVAL); printf("Audo-detected sources for %s:\n", VAR_0->name); if (!VAR_0->get_device_list) { VAR_2 = AVERROR(ENOSYS); printf("Cannot list sources. Not implemented.\n"); goto fail; } av_dict_copy(&tmp_opts, VAR_1, 0); if ((VAR_2 = avformat_open_input(&dev, NULL, VAR_0, &tmp_opts)) < 0) { printf("Cannot open device: %s.\n", VAR_0->name); goto fail; } if ((VAR_2 = avdevice_list_devices(dev, &device_list)) < 0) { printf("Cannot list sources.\n"); goto fail; } for (VAR_3 = 0; VAR_3 < device_list->nb_devices; VAR_3++) { printf("%s %s [%s]\n", device_list->default_device == VAR_3 ? "*" : " ", device_list->devices[VAR_3]->device_name, device_list->devices[VAR_3]->device_description); } fail: av_dict_free(&tmp_opts); avdevice_free_list_devices(&device_list); avformat_close_input(&dev); return VAR_2; }
[ "static int FUNC_0(AVInputFormat *VAR_0, AVDictionary *VAR_1)\n{", "int VAR_2, VAR_3;", "AVFormatContext *dev = NULL;", "AVDeviceInfoList *device_list = NULL;", "AVDictionary *tmp_opts = NULL;", "if (!VAR_0 || !VAR_0->priv_class || !AV_IS_INPUT_DEVICE(VAR_0->priv_class->category))\nreturn AVERROR(EINVAL);", "printf(\"Audo-detected sources for %s:\\n\", VAR_0->name);", "if (!VAR_0->get_device_list) {", "VAR_2 = AVERROR(ENOSYS);", "printf(\"Cannot list sources. Not implemented.\\n\");", "goto fail;", "}", "av_dict_copy(&tmp_opts, VAR_1, 0);", "if ((VAR_2 = avformat_open_input(&dev, NULL, VAR_0, &tmp_opts)) < 0) {", "printf(\"Cannot open device: %s.\\n\", VAR_0->name);", "goto fail;", "}", "if ((VAR_2 = avdevice_list_devices(dev, &device_list)) < 0) {", "printf(\"Cannot list sources.\\n\");", "goto fail;", "}", "for (VAR_3 = 0; VAR_3 < device_list->nb_devices; VAR_3++) {", "printf(\"%s %s [%s]\\n\", device_list->default_device == VAR_3 ? \"*\" : \" \",\ndevice_list->devices[VAR_3]->device_name, device_list->devices[VAR_3]->device_description);", "}", "fail:\nav_dict_free(&tmp_opts);", "avdevice_free_list_devices(&device_list);", "avformat_close_input(&dev);", "return VAR_2;", "}" ]
[ 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15, 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63, 65 ], [ 67 ], [ 71, 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ] ]
17,906
static inline void RENAME(yuv2packedX)(SwsContext *c, int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize, int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize, uint8_t *dest, int dstW, int dstY) { int dummy=0; switch(c->dstFormat) { #ifdef HAVE_MMX case IMGFMT_BGR32: { asm volatile( YSCALEYUV2RGBX WRITEBGR32(%4, %5, %%REGa) :: "r" (&c->redDither), "m" (dummy), "m" (dummy), "m" (dummy), "r" (dest), "m" (dstW) : "%"REG_a, "%"REG_d, "%"REG_S ); } break; case IMGFMT_BGR24: { asm volatile( YSCALEYUV2RGBX "lea (%%"REG_a", %%"REG_a", 2), %%"REG_b"\n\t" //FIXME optimize "add %4, %%"REG_b" \n\t" WRITEBGR24(%%REGb, %5, %%REGa) :: "r" (&c->redDither), "m" (dummy), "m" (dummy), "m" (dummy), "r" (dest), "m" (dstW) : "%"REG_a, "%"REG_b, "%"REG_d, "%"REG_S //FIXME ebx ); } break; case IMGFMT_BGR15: { asm volatile( YSCALEYUV2RGBX /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */ #ifdef DITHER1XBPP "paddusb "MANGLE(b5Dither)", %%mm2\n\t" "paddusb "MANGLE(g5Dither)", %%mm4\n\t" "paddusb "MANGLE(r5Dither)", %%mm5\n\t" #endif WRITEBGR15(%4, %5, %%REGa) :: "r" (&c->redDither), "m" (dummy), "m" (dummy), "m" (dummy), "r" (dest), "m" (dstW) : "%"REG_a, "%"REG_d, "%"REG_S ); } break; case IMGFMT_BGR16: { asm volatile( YSCALEYUV2RGBX /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */ #ifdef DITHER1XBPP "paddusb "MANGLE(b5Dither)", %%mm2\n\t" "paddusb "MANGLE(g6Dither)", %%mm4\n\t" "paddusb "MANGLE(r5Dither)", %%mm5\n\t" #endif WRITEBGR16(%4, %5, %%REGa) :: "r" (&c->redDither), "m" (dummy), "m" (dummy), "m" (dummy), "r" (dest), "m" (dstW) : "%"REG_a, "%"REG_d, "%"REG_S ); } break; case IMGFMT_YUY2: { asm volatile( YSCALEYUV2PACKEDX /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */ "psraw $3, %%mm3 \n\t" "psraw $3, %%mm4 \n\t" "psraw $3, %%mm1 \n\t" "psraw $3, %%mm7 \n\t" WRITEYUY2(%4, %5, %%REGa) :: "r" (&c->redDither), "m" (dummy), "m" (dummy), "m" (dummy), "r" (dest), "m" (dstW) : "%"REG_a, "%"REG_d, "%"REG_S ); } break; #endif default: #ifdef HAVE_ALTIVEC /* The following list of supported dstFormat values should match what's found in the body of altivec_yuv2packedX() */ if(c->dstFormat==IMGFMT_ABGR || c->dstFormat==IMGFMT_BGRA || c->dstFormat==IMGFMT_BGR24 || c->dstFormat==IMGFMT_RGB24 || c->dstFormat==IMGFMT_RGBA || c->dstFormat==IMGFMT_ARGB) altivec_yuv2packedX (c, lumFilter, lumSrc, lumFilterSize, chrFilter, chrSrc, chrFilterSize, dest, dstW, dstY); else #endif yuv2packedXinC(c, lumFilter, lumSrc, lumFilterSize, chrFilter, chrSrc, chrFilterSize, dest, dstW, dstY); break; } }
true
FFmpeg
065ee1ec325ed7d34acf13d0bf319c1c6b457e21
static inline void RENAME(yuv2packedX)(SwsContext *c, int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize, int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize, uint8_t *dest, int dstW, int dstY) { int dummy=0; switch(c->dstFormat) { #ifdef HAVE_MMX case IMGFMT_BGR32: { asm volatile( YSCALEYUV2RGBX WRITEBGR32(%4, %5, %%REGa) :: "r" (&c->redDither), "m" (dummy), "m" (dummy), "m" (dummy), "r" (dest), "m" (dstW) : "%"REG_a, "%"REG_d, "%"REG_S ); } break; case IMGFMT_BGR24: { asm volatile( YSCALEYUV2RGBX "lea (%%"REG_a", %%"REG_a", 2), %%"REG_b"\n\t" "add %4, %%"REG_b" \n\t" WRITEBGR24(%%REGb, %5, %%REGa) :: "r" (&c->redDither), "m" (dummy), "m" (dummy), "m" (dummy), "r" (dest), "m" (dstW) : "%"REG_a, "%"REG_b, "%"REG_d, "%"REG_S ); } break; case IMGFMT_BGR15: { asm volatile( YSCALEYUV2RGBX #ifdef DITHER1XBPP "paddusb "MANGLE(b5Dither)", %%mm2\n\t" "paddusb "MANGLE(g5Dither)", %%mm4\n\t" "paddusb "MANGLE(r5Dither)", %%mm5\n\t" #endif WRITEBGR15(%4, %5, %%REGa) :: "r" (&c->redDither), "m" (dummy), "m" (dummy), "m" (dummy), "r" (dest), "m" (dstW) : "%"REG_a, "%"REG_d, "%"REG_S ); } break; case IMGFMT_BGR16: { asm volatile( YSCALEYUV2RGBX #ifdef DITHER1XBPP "paddusb "MANGLE(b5Dither)", %%mm2\n\t" "paddusb "MANGLE(g6Dither)", %%mm4\n\t" "paddusb "MANGLE(r5Dither)", %%mm5\n\t" #endif WRITEBGR16(%4, %5, %%REGa) :: "r" (&c->redDither), "m" (dummy), "m" (dummy), "m" (dummy), "r" (dest), "m" (dstW) : "%"REG_a, "%"REG_d, "%"REG_S ); } break; case IMGFMT_YUY2: { asm volatile( YSCALEYUV2PACKEDX "psraw $3, %%mm3 \n\t" "psraw $3, %%mm4 \n\t" "psraw $3, %%mm1 \n\t" "psraw $3, %%mm7 \n\t" WRITEYUY2(%4, %5, %%REGa) :: "r" (&c->redDither), "m" (dummy), "m" (dummy), "m" (dummy), "r" (dest), "m" (dstW) : "%"REG_a, "%"REG_d, "%"REG_S ); } break; #endif default: #ifdef HAVE_ALTIVEC if(c->dstFormat==IMGFMT_ABGR || c->dstFormat==IMGFMT_BGRA || c->dstFormat==IMGFMT_BGR24 || c->dstFormat==IMGFMT_RGB24 || c->dstFormat==IMGFMT_RGBA || c->dstFormat==IMGFMT_ARGB) altivec_yuv2packedX (c, lumFilter, lumSrc, lumFilterSize, chrFilter, chrSrc, chrFilterSize, dest, dstW, dstY); else #endif yuv2packedXinC(c, lumFilter, lumSrc, lumFilterSize, chrFilter, chrSrc, chrFilterSize, dest, dstW, dstY); break; } }
{ "code": [ "\t\t\t uint8_t *dest, int dstW, int dstY)", "\tint dummy=0;" ], "line_no": [ 5, 9 ] }
static inline void FUNC_0(yuv2packedX)(SwsContext *c, int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize, int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize, uint8_t *dest, int dstW, int dstY) { int VAR_0=0; switch(c->dstFormat) { #ifdef HAVE_MMX case IMGFMT_BGR32: { asm volatile( YSCALEYUV2RGBX WRITEBGR32(%4, %5, %%REGa) :: "r" (&c->redDither), "m" (VAR_0), "m" (VAR_0), "m" (VAR_0), "r" (dest), "m" (dstW) : "%"REG_a, "%"REG_d, "%"REG_S ); } break; case IMGFMT_BGR24: { asm volatile( YSCALEYUV2RGBX "lea (%%"REG_a", %%"REG_a", 2), %%"REG_b"\n\t" "add %4, %%"REG_b" \n\t" WRITEBGR24(%%REGb, %5, %%REGa) :: "r" (&c->redDither), "m" (VAR_0), "m" (VAR_0), "m" (VAR_0), "r" (dest), "m" (dstW) : "%"REG_a, "%"REG_b, "%"REG_d, "%"REG_S ); } break; case IMGFMT_BGR15: { asm volatile( YSCALEYUV2RGBX #ifdef DITHER1XBPP "paddusb "MANGLE(b5Dither)", %%mm2\n\t" "paddusb "MANGLE(g5Dither)", %%mm4\n\t" "paddusb "MANGLE(r5Dither)", %%mm5\n\t" #endif WRITEBGR15(%4, %5, %%REGa) :: "r" (&c->redDither), "m" (VAR_0), "m" (VAR_0), "m" (VAR_0), "r" (dest), "m" (dstW) : "%"REG_a, "%"REG_d, "%"REG_S ); } break; case IMGFMT_BGR16: { asm volatile( YSCALEYUV2RGBX #ifdef DITHER1XBPP "paddusb "MANGLE(b5Dither)", %%mm2\n\t" "paddusb "MANGLE(g6Dither)", %%mm4\n\t" "paddusb "MANGLE(r5Dither)", %%mm5\n\t" #endif WRITEBGR16(%4, %5, %%REGa) :: "r" (&c->redDither), "m" (VAR_0), "m" (VAR_0), "m" (VAR_0), "r" (dest), "m" (dstW) : "%"REG_a, "%"REG_d, "%"REG_S ); } break; case IMGFMT_YUY2: { asm volatile( YSCALEYUV2PACKEDX "psraw $3, %%mm3 \n\t" "psraw $3, %%mm4 \n\t" "psraw $3, %%mm1 \n\t" "psraw $3, %%mm7 \n\t" WRITEYUY2(%4, %5, %%REGa) :: "r" (&c->redDither), "m" (VAR_0), "m" (VAR_0), "m" (VAR_0), "r" (dest), "m" (dstW) : "%"REG_a, "%"REG_d, "%"REG_S ); } break; #endif default: #ifdef HAVE_ALTIVEC if(c->dstFormat==IMGFMT_ABGR || c->dstFormat==IMGFMT_BGRA || c->dstFormat==IMGFMT_BGR24 || c->dstFormat==IMGFMT_RGB24 || c->dstFormat==IMGFMT_RGBA || c->dstFormat==IMGFMT_ARGB) altivec_yuv2packedX (c, lumFilter, lumSrc, lumFilterSize, chrFilter, chrSrc, chrFilterSize, dest, dstW, dstY); else #endif yuv2packedXinC(c, lumFilter, lumSrc, lumFilterSize, chrFilter, chrSrc, chrFilterSize, dest, dstW, dstY); break; } }
[ "static inline void FUNC_0(yuv2packedX)(SwsContext *c, int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize,\nint16_t *chrFilter, int16_t **chrSrc, int chrFilterSize,\nuint8_t *dest, int dstW, int dstY)\n{", "int VAR_0=0;", "switch(c->dstFormat)\n{", "#ifdef HAVE_MMX\ncase IMGFMT_BGR32:\n{", "asm volatile(\nYSCALEYUV2RGBX\nWRITEBGR32(%4, %5, %%REGa)\n:: \"r\" (&c->redDither),\n\"m\" (VAR_0), \"m\" (VAR_0), \"m\" (VAR_0),\n\"r\" (dest), \"m\" (dstW)\n: \"%\"REG_a, \"%\"REG_d, \"%\"REG_S\n);", "}", "break;", "case IMGFMT_BGR24:\n{", "asm volatile(\nYSCALEYUV2RGBX\n\"lea (%%\"REG_a\", %%\"REG_a\", 2), %%\"REG_b\"\\n\\t\"\n\"add %4, %%\"REG_b\"\t\t\t\\n\\t\"\nWRITEBGR24(%%REGb, %5, %%REGa)\n:: \"r\" (&c->redDither),\n\"m\" (VAR_0), \"m\" (VAR_0), \"m\" (VAR_0),\n\"r\" (dest), \"m\" (dstW)\n: \"%\"REG_a, \"%\"REG_b, \"%\"REG_d, \"%\"REG_S\n);", "}", "break;", "case IMGFMT_BGR15:\n{", "asm volatile(\nYSCALEYUV2RGBX\n#ifdef DITHER1XBPP\n\"paddusb \"MANGLE(b5Dither)\", %%mm2\\n\\t\"\n\"paddusb \"MANGLE(g5Dither)\", %%mm4\\n\\t\"\n\"paddusb \"MANGLE(r5Dither)\", %%mm5\\n\\t\"\n#endif\nWRITEBGR15(%4, %5, %%REGa)\n:: \"r\" (&c->redDither),\n\"m\" (VAR_0), \"m\" (VAR_0), \"m\" (VAR_0),\n\"r\" (dest), \"m\" (dstW)\n: \"%\"REG_a, \"%\"REG_d, \"%\"REG_S\n);", "}", "break;", "case IMGFMT_BGR16:\n{", "asm volatile(\nYSCALEYUV2RGBX\n#ifdef DITHER1XBPP\n\"paddusb \"MANGLE(b5Dither)\", %%mm2\\n\\t\"\n\"paddusb \"MANGLE(g6Dither)\", %%mm4\\n\\t\"\n\"paddusb \"MANGLE(r5Dither)\", %%mm5\\n\\t\"\n#endif\nWRITEBGR16(%4, %5, %%REGa)\n:: \"r\" (&c->redDither),\n\"m\" (VAR_0), \"m\" (VAR_0), \"m\" (VAR_0),\n\"r\" (dest), \"m\" (dstW)\n: \"%\"REG_a, \"%\"REG_d, \"%\"REG_S\n);", "}", "break;", "case IMGFMT_YUY2:\n{", "asm volatile(\nYSCALEYUV2PACKEDX\n\"psraw $3, %%mm3\t\t\\n\\t\"\n\"psraw $3, %%mm4\t\t\\n\\t\"\n\"psraw $3, %%mm1\t\t\\n\\t\"\n\"psraw $3, %%mm7\t\t\\n\\t\"\nWRITEYUY2(%4, %5, %%REGa)\n:: \"r\" (&c->redDither),\n\"m\" (VAR_0), \"m\" (VAR_0), \"m\" (VAR_0),\n\"r\" (dest), \"m\" (dstW)\n: \"%\"REG_a, \"%\"REG_d, \"%\"REG_S\n);", "}", "break;", "#endif\ndefault:\n#ifdef HAVE_ALTIVEC\nif(c->dstFormat==IMGFMT_ABGR || c->dstFormat==IMGFMT_BGRA ||\nc->dstFormat==IMGFMT_BGR24 || c->dstFormat==IMGFMT_RGB24 ||\nc->dstFormat==IMGFMT_RGBA || c->dstFormat==IMGFMT_ARGB)\naltivec_yuv2packedX (c, lumFilter, lumSrc, lumFilterSize,\nchrFilter, chrSrc, chrFilterSize,\ndest, dstW, dstY);", "else\n#endif\nyuv2packedXinC(c, lumFilter, lumSrc, lumFilterSize,\nchrFilter, chrSrc, chrFilterSize,\ndest, dstW, dstY);", "break;", "}", "}" ]
[ 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 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11, 13 ], [ 15, 17, 19 ], [ 21, 23, 25, 29, 31, 33, 35, 37 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 47, 49, 51, 53, 55, 59, 61, 63, 65, 67 ], [ 69 ], [ 71 ], [ 73, 75 ], [ 77, 79, 83, 85, 87, 89, 91, 95, 99, 101, 103, 105, 107 ], [ 109 ], [ 111 ], [ 113, 115 ], [ 117, 119, 123, 125, 127, 129, 131, 135, 139, 141, 143, 145, 147 ], [ 149 ], [ 151 ], [ 153, 155 ], [ 157, 159, 165, 167, 169, 171, 173, 177, 179, 181, 183, 185 ], [ 187 ], [ 189 ], [ 191, 193, 195, 201, 203, 205, 207, 209, 211 ], [ 213, 215, 217, 219, 221 ], [ 223 ], [ 225 ], [ 227 ] ]
17,907
static int multiple_resample(ResampleContext *c, AudioData *dst, int dst_size, AudioData *src, int src_size, int *consumed){ int i, ret= -1; int av_unused mm_flags = av_get_cpu_flags(); int need_emms= 0; if (c->compensation_distance) dst_size = FFMIN(dst_size, c->compensation_distance); for(i=0; i<dst->ch_count; i++){ #if HAVE_MMXEXT_INLINE #if HAVE_SSE2_INLINE if(c->format == AV_SAMPLE_FMT_S16P && (mm_flags&AV_CPU_FLAG_SSE2)) ret= swri_resample_int16_sse2 (c, (int16_t*)dst->ch[i], (const int16_t*)src->ch[i], consumed, src_size, dst_size, i+1==dst->ch_count); else #endif if(c->format == AV_SAMPLE_FMT_S16P && (mm_flags&AV_CPU_FLAG_MMX2 )){ ret= swri_resample_int16_mmx2 (c, (int16_t*)dst->ch[i], (const int16_t*)src->ch[i], consumed, src_size, dst_size, i+1==dst->ch_count); need_emms= 1; } else #endif if(c->format == AV_SAMPLE_FMT_S16P) ret= swri_resample_int16(c, (int16_t*)dst->ch[i], (const int16_t*)src->ch[i], consumed, src_size, dst_size, i+1==dst->ch_count); else if(c->format == AV_SAMPLE_FMT_S32P) ret= swri_resample_int32(c, (int32_t*)dst->ch[i], (const int32_t*)src->ch[i], consumed, src_size, dst_size, i+1==dst->ch_count); #if HAVE_AVX_INLINE else if(c->format == AV_SAMPLE_FMT_FLTP && (mm_flags&AV_CPU_FLAG_AVX)) ret= swri_resample_float_avx (c, (float*)dst->ch[i], (const float*)src->ch[i], consumed, src_size, dst_size, i+1==dst->ch_count); #endif #if HAVE_SSE_INLINE else if(c->format == AV_SAMPLE_FMT_FLTP && (mm_flags&AV_CPU_FLAG_SSE)) ret= swri_resample_float_sse (c, (float*)dst->ch[i], (const float*)src->ch[i], consumed, src_size, dst_size, i+1==dst->ch_count); #endif else if(c->format == AV_SAMPLE_FMT_FLTP) ret= swri_resample_float(c, (float *)dst->ch[i], (const float *)src->ch[i], consumed, src_size, dst_size, i+1==dst->ch_count); #if HAVE_SSE2_INLINE else if(c->format == AV_SAMPLE_FMT_DBLP && (mm_flags&AV_CPU_FLAG_SSE2)) ret= swri_resample_double_sse2(c,(double *)dst->ch[i], (const double *)src->ch[i], consumed, src_size, dst_size, i+1==dst->ch_count); #endif else if(c->format == AV_SAMPLE_FMT_DBLP) ret= swri_resample_double(c,(double *)dst->ch[i], (const double *)src->ch[i], consumed, src_size, dst_size, i+1==dst->ch_count); if(need_emms) emms_c(); return ret;
true
FFmpeg
cdfd9717edac118968e63e6f83c3e45a7e337833
static int multiple_resample(ResampleContext *c, AudioData *dst, int dst_size, AudioData *src, int src_size, int *consumed){ int i, ret= -1; int av_unused mm_flags = av_get_cpu_flags(); int need_emms= 0; if (c->compensation_distance) dst_size = FFMIN(dst_size, c->compensation_distance); for(i=0; i<dst->ch_count; i++){ #if HAVE_MMXEXT_INLINE #if HAVE_SSE2_INLINE if(c->format == AV_SAMPLE_FMT_S16P && (mm_flags&AV_CPU_FLAG_SSE2)) ret= swri_resample_int16_sse2 (c, (int16_t*)dst->ch[i], (const int16_t*)src->ch[i], consumed, src_size, dst_size, i+1==dst->ch_count); else #endif if(c->format == AV_SAMPLE_FMT_S16P && (mm_flags&AV_CPU_FLAG_MMX2 )){ ret= swri_resample_int16_mmx2 (c, (int16_t*)dst->ch[i], (const int16_t*)src->ch[i], consumed, src_size, dst_size, i+1==dst->ch_count); need_emms= 1; } else #endif if(c->format == AV_SAMPLE_FMT_S16P) ret= swri_resample_int16(c, (int16_t*)dst->ch[i], (const int16_t*)src->ch[i], consumed, src_size, dst_size, i+1==dst->ch_count); else if(c->format == AV_SAMPLE_FMT_S32P) ret= swri_resample_int32(c, (int32_t*)dst->ch[i], (const int32_t*)src->ch[i], consumed, src_size, dst_size, i+1==dst->ch_count); #if HAVE_AVX_INLINE else if(c->format == AV_SAMPLE_FMT_FLTP && (mm_flags&AV_CPU_FLAG_AVX)) ret= swri_resample_float_avx (c, (float*)dst->ch[i], (const float*)src->ch[i], consumed, src_size, dst_size, i+1==dst->ch_count); #endif #if HAVE_SSE_INLINE else if(c->format == AV_SAMPLE_FMT_FLTP && (mm_flags&AV_CPU_FLAG_SSE)) ret= swri_resample_float_sse (c, (float*)dst->ch[i], (const float*)src->ch[i], consumed, src_size, dst_size, i+1==dst->ch_count); #endif else if(c->format == AV_SAMPLE_FMT_FLTP) ret= swri_resample_float(c, (float *)dst->ch[i], (const float *)src->ch[i], consumed, src_size, dst_size, i+1==dst->ch_count); #if HAVE_SSE2_INLINE else if(c->format == AV_SAMPLE_FMT_DBLP && (mm_flags&AV_CPU_FLAG_SSE2)) ret= swri_resample_double_sse2(c,(double *)dst->ch[i], (const double *)src->ch[i], consumed, src_size, dst_size, i+1==dst->ch_count); #endif else if(c->format == AV_SAMPLE_FMT_DBLP) ret= swri_resample_double(c,(double *)dst->ch[i], (const double *)src->ch[i], consumed, src_size, dst_size, i+1==dst->ch_count); if(need_emms) emms_c(); return ret;
{ "code": [], "line_no": [] }
static int FUNC_0(ResampleContext *VAR_0, AudioData *VAR_1, int VAR_2, AudioData *VAR_3, int VAR_4, int *VAR_5){ int VAR_6, VAR_7= -1; int VAR_8 mm_flags = av_get_cpu_flags(); int VAR_9= 0; if (VAR_0->compensation_distance) VAR_2 = FFMIN(VAR_2, VAR_0->compensation_distance); for(VAR_6=0; VAR_6<VAR_1->ch_count; VAR_6++){ #if HAVE_MMXEXT_INLINE #if HAVE_SSE2_INLINE if(VAR_0->format == AV_SAMPLE_FMT_S16P && (mm_flags&AV_CPU_FLAG_SSE2)) VAR_7= swri_resample_int16_sse2 (VAR_0, (int16_t*)VAR_1->ch[VAR_6], (const int16_t*)VAR_3->ch[VAR_6], VAR_5, VAR_4, VAR_2, VAR_6+1==VAR_1->ch_count); else #endif if(VAR_0->format == AV_SAMPLE_FMT_S16P && (mm_flags&AV_CPU_FLAG_MMX2 )){ VAR_7= swri_resample_int16_mmx2 (VAR_0, (int16_t*)VAR_1->ch[VAR_6], (const int16_t*)VAR_3->ch[VAR_6], VAR_5, VAR_4, VAR_2, VAR_6+1==VAR_1->ch_count); VAR_9= 1; } else #endif if(VAR_0->format == AV_SAMPLE_FMT_S16P) VAR_7= swri_resample_int16(VAR_0, (int16_t*)VAR_1->ch[VAR_6], (const int16_t*)VAR_3->ch[VAR_6], VAR_5, VAR_4, VAR_2, VAR_6+1==VAR_1->ch_count); else if(VAR_0->format == AV_SAMPLE_FMT_S32P) VAR_7= swri_resample_int32(VAR_0, (int32_t*)VAR_1->ch[VAR_6], (const int32_t*)VAR_3->ch[VAR_6], VAR_5, VAR_4, VAR_2, VAR_6+1==VAR_1->ch_count); #if HAVE_AVX_INLINE else if(VAR_0->format == AV_SAMPLE_FMT_FLTP && (mm_flags&AV_CPU_FLAG_AVX)) VAR_7= swri_resample_float_avx (VAR_0, (float*)VAR_1->ch[VAR_6], (const float*)VAR_3->ch[VAR_6], VAR_5, VAR_4, VAR_2, VAR_6+1==VAR_1->ch_count); #endif #if HAVE_SSE_INLINE else if(VAR_0->format == AV_SAMPLE_FMT_FLTP && (mm_flags&AV_CPU_FLAG_SSE)) VAR_7= swri_resample_float_sse (VAR_0, (float*)VAR_1->ch[VAR_6], (const float*)VAR_3->ch[VAR_6], VAR_5, VAR_4, VAR_2, VAR_6+1==VAR_1->ch_count); #endif else if(VAR_0->format == AV_SAMPLE_FMT_FLTP) VAR_7= swri_resample_float(VAR_0, (float *)VAR_1->ch[VAR_6], (const float *)VAR_3->ch[VAR_6], VAR_5, VAR_4, VAR_2, VAR_6+1==VAR_1->ch_count); #if HAVE_SSE2_INLINE else if(VAR_0->format == AV_SAMPLE_FMT_DBLP && (mm_flags&AV_CPU_FLAG_SSE2)) VAR_7= swri_resample_double_sse2(VAR_0,(double *)VAR_1->ch[VAR_6], (const double *)VAR_3->ch[VAR_6], VAR_5, VAR_4, VAR_2, VAR_6+1==VAR_1->ch_count); #endif else if(VAR_0->format == AV_SAMPLE_FMT_DBLP) VAR_7= swri_resample_double(VAR_0,(double *)VAR_1->ch[VAR_6], (const double *)VAR_3->ch[VAR_6], VAR_5, VAR_4, VAR_2, VAR_6+1==VAR_1->ch_count); if(VAR_9) emms_c(); return VAR_7;
[ "static int FUNC_0(ResampleContext *VAR_0, AudioData *VAR_1, int VAR_2, AudioData *VAR_3, int VAR_4, int *VAR_5){", "int VAR_6, VAR_7= -1;", "int VAR_8 mm_flags = av_get_cpu_flags();", "int VAR_9= 0;", "if (VAR_0->compensation_distance)\nVAR_2 = FFMIN(VAR_2, VAR_0->compensation_distance);", "for(VAR_6=0; VAR_6<VAR_1->ch_count; VAR_6++){", "#if HAVE_MMXEXT_INLINE\n#if HAVE_SSE2_INLINE\nif(VAR_0->format == AV_SAMPLE_FMT_S16P && (mm_flags&AV_CPU_FLAG_SSE2)) VAR_7= swri_resample_int16_sse2 (VAR_0, (int16_t*)VAR_1->ch[VAR_6], (const int16_t*)VAR_3->ch[VAR_6], VAR_5, VAR_4, VAR_2, VAR_6+1==VAR_1->ch_count);", "else\n#endif\nif(VAR_0->format == AV_SAMPLE_FMT_S16P && (mm_flags&AV_CPU_FLAG_MMX2 )){", "VAR_7= swri_resample_int16_mmx2 (VAR_0, (int16_t*)VAR_1->ch[VAR_6], (const int16_t*)VAR_3->ch[VAR_6], VAR_5, VAR_4, VAR_2, VAR_6+1==VAR_1->ch_count);", "VAR_9= 1;", "} else", "#endif\nif(VAR_0->format == AV_SAMPLE_FMT_S16P) VAR_7= swri_resample_int16(VAR_0, (int16_t*)VAR_1->ch[VAR_6], (const int16_t*)VAR_3->ch[VAR_6], VAR_5, VAR_4, VAR_2, VAR_6+1==VAR_1->ch_count);", "else if(VAR_0->format == AV_SAMPLE_FMT_S32P) VAR_7= swri_resample_int32(VAR_0, (int32_t*)VAR_1->ch[VAR_6], (const int32_t*)VAR_3->ch[VAR_6], VAR_5, VAR_4, VAR_2, VAR_6+1==VAR_1->ch_count);", "#if HAVE_AVX_INLINE\nelse if(VAR_0->format == AV_SAMPLE_FMT_FLTP && (mm_flags&AV_CPU_FLAG_AVX))\nVAR_7= swri_resample_float_avx (VAR_0, (float*)VAR_1->ch[VAR_6], (const float*)VAR_3->ch[VAR_6], VAR_5, VAR_4, VAR_2, VAR_6+1==VAR_1->ch_count);", "#endif\n#if HAVE_SSE_INLINE\nelse if(VAR_0->format == AV_SAMPLE_FMT_FLTP && (mm_flags&AV_CPU_FLAG_SSE))\nVAR_7= swri_resample_float_sse (VAR_0, (float*)VAR_1->ch[VAR_6], (const float*)VAR_3->ch[VAR_6], VAR_5, VAR_4, VAR_2, VAR_6+1==VAR_1->ch_count);", "#endif\nelse if(VAR_0->format == AV_SAMPLE_FMT_FLTP) VAR_7= swri_resample_float(VAR_0, (float *)VAR_1->ch[VAR_6], (const float *)VAR_3->ch[VAR_6], VAR_5, VAR_4, VAR_2, VAR_6+1==VAR_1->ch_count);", "#if HAVE_SSE2_INLINE\nelse if(VAR_0->format == AV_SAMPLE_FMT_DBLP && (mm_flags&AV_CPU_FLAG_SSE2))\nVAR_7= swri_resample_double_sse2(VAR_0,(double *)VAR_1->ch[VAR_6], (const double *)VAR_3->ch[VAR_6], VAR_5, VAR_4, VAR_2, VAR_6+1==VAR_1->ch_count);", "#endif\nelse if(VAR_0->format == AV_SAMPLE_FMT_DBLP) VAR_7= swri_resample_double(VAR_0,(double *)VAR_1->ch[VAR_6], (const double *)VAR_3->ch[VAR_6], VAR_5, VAR_4, VAR_2, VAR_6+1==VAR_1->ch_count);", "if(VAR_9)\nemms_c();", "return VAR_7;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 2 ], [ 3 ], [ 4 ], [ 5, 6 ], [ 7 ], [ 8, 9, 10 ], [ 11, 12, 13 ], [ 14 ], [ 15 ], [ 16 ], [ 17, 18 ], [ 19 ], [ 20, 21, 22 ], [ 23, 24, 25, 26 ], [ 27, 28 ], [ 29, 30, 31 ], [ 32, 33 ], [ 34, 35 ], [ 36 ] ]
17,910
static void mpegts_write_pes(AVFormatContext *s, AVStream *st, const uint8_t *payload, int payload_size, int64_t pts, int64_t dts, int key, int stream_id) { MpegTSWriteStream *ts_st = st->priv_data; MpegTSWrite *ts = s->priv_data; uint8_t buf[TS_PACKET_SIZE]; uint8_t *q; int val, is_start, len, header_len, write_pcr, is_dvb_subtitle, is_dvb_teletext, flags; int afc_len, stuffing_len; int64_t pcr = -1; /* avoid warning */ int64_t delay = av_rescale(s->max_delay, 90000, AV_TIME_BASE); int force_pat = st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && key && !ts_st->prev_payload_key; av_assert0(ts_st->payload != buf || st->codecpar->codec_type != AVMEDIA_TYPE_VIDEO); if (ts->flags & MPEGTS_FLAG_PAT_PMT_AT_FRAMES && st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) { force_pat = 1; is_start = 1; while (payload_size > 0) { retransmit_si_info(s, force_pat, dts); force_pat = 0; write_pcr = 0; if (ts_st->pid == ts_st->service->pcr_pid) { if (ts->mux_rate > 1 || is_start) // VBR pcr period is based on frames ts_st->service->pcr_packet_count++; if (ts_st->service->pcr_packet_count >= ts_st->service->pcr_packet_period) { ts_st->service->pcr_packet_count = 0; write_pcr = 1; if (ts->mux_rate > 1 && dts != AV_NOPTS_VALUE && (dts - get_pcr(ts, s->pb) / 300) > delay) { /* pcr insert gets priority over null packet insert */ if (write_pcr) mpegts_insert_pcr_only(s, st); else mpegts_insert_null_packet(s); /* recalculate write_pcr and possibly retransmit si_info */ continue; /* prepare packet header */ q = buf; *q++ = 0x47; val = ts_st->pid >> 8; if (is_start) val |= 0x40; *q++ = val; *q++ = ts_st->pid; ts_st->cc = ts_st->cc + 1 & 0xf; *q++ = 0x10 | ts_st->cc; // payload indicator + CC if (key && is_start && pts != AV_NOPTS_VALUE) { // set Random Access for key frames if (ts_st->pid == ts_st->service->pcr_pid) write_pcr = 1; set_af_flag(buf, 0x40); if (write_pcr) { set_af_flag(buf, 0x10); // add 11, pcr references the last byte of program clock reference base if (ts->mux_rate > 1) pcr = get_pcr(ts, s->pb); else pcr = (dts - delay) * 300; if (dts != AV_NOPTS_VALUE && dts < pcr / 300) av_log(s, AV_LOG_WARNING, "dts < pcr, TS is invalid\n"); extend_af(buf, write_pcr_bits(q, pcr)); if (is_start) { int pes_extension = 0; int pes_header_stuffing_bytes = 0; /* write PES header */ *q++ = 0x00; *q++ = 0x00; *q++ = 0x01; is_dvb_subtitle = 0; is_dvb_teletext = 0; if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) { if (st->codecpar->codec_id == AV_CODEC_ID_DIRAC) *q++ = 0xfd; else *q++ = 0xe0; } else if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && (st->codecpar->codec_id == AV_CODEC_ID_MP2 || st->codecpar->codec_id == AV_CODEC_ID_MP3 || st->codecpar->codec_id == AV_CODEC_ID_AAC)) { *q++ = 0xc0; } else if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && st->codecpar->codec_id == AV_CODEC_ID_AC3 && ts->m2ts_mode) { *q++ = 0xfd; } else if (st->codecpar->codec_type == AVMEDIA_TYPE_DATA && st->codecpar->codec_id == AV_CODEC_ID_TIMED_ID3) { *q++ = 0xbd; } else if (st->codecpar->codec_type == AVMEDIA_TYPE_DATA) { *q++ = stream_id != -1 ? stream_id : 0xfc; if (stream_id == 0xbd) /* asynchronous KLV */ pts = dts = AV_NOPTS_VALUE; } else { *q++ = 0xbd; if (st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE) { if (st->codecpar->codec_id == AV_CODEC_ID_DVB_SUBTITLE) { is_dvb_subtitle = 1; } else if (st->codecpar->codec_id == AV_CODEC_ID_DVB_TELETEXT) { is_dvb_teletext = 1; header_len = 0; flags = 0; if (pts != AV_NOPTS_VALUE) { header_len += 5; flags |= 0x80; if (dts != AV_NOPTS_VALUE && pts != AV_NOPTS_VALUE && dts != pts) { header_len += 5; flags |= 0x40; if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && st->codecpar->codec_id == AV_CODEC_ID_DIRAC) { /* set PES_extension_flag */ pes_extension = 1; flags |= 0x01; /* One byte for PES2 extension flag + * one byte for extension length + * one byte for extension id */ header_len += 3; /* for Blu-ray AC3 Audio the PES Extension flag should be as follow * otherwise it will not play sound on blu-ray */ if (ts->m2ts_mode && st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && st->codecpar->codec_id == AV_CODEC_ID_AC3) { /* set PES_extension_flag */ pes_extension = 1; flags |= 0x01; header_len += 3; if (is_dvb_teletext) { pes_header_stuffing_bytes = 0x24 - header_len; header_len = 0x24; len = payload_size + header_len + 3; /* 3 extra bytes should be added to DVB subtitle payload: 0x20 0x00 at the beginning and trailing 0xff */ if (is_dvb_subtitle) { len += 3; payload_size++; if (len > 0xffff) len = 0; if (ts->omit_video_pes_length && st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) { len = 0; *q++ = len >> 8; *q++ = len; val = 0x80; /* data alignment indicator is required for subtitle and data streams */ if (st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE || st->codecpar->codec_type == AVMEDIA_TYPE_DATA) val |= 0x04; *q++ = val; *q++ = flags; *q++ = header_len; if (pts != AV_NOPTS_VALUE) { write_pts(q, flags >> 6, pts); q += 5; if (dts != AV_NOPTS_VALUE && pts != AV_NOPTS_VALUE && dts != pts) { write_pts(q, 1, dts); q += 5; if (pes_extension && st->codecpar->codec_id == AV_CODEC_ID_DIRAC) { flags = 0x01; /* set PES_extension_flag_2 */ *q++ = flags; *q++ = 0x80 | 0x01; /* marker bit + extension length */ /* Set the stream ID extension flag bit to 0 and * write the extended stream ID. */ *q++ = 0x00 | 0x60; /* For Blu-ray AC3 Audio Setting extended flags */ if (ts->m2ts_mode && pes_extension && st->codecpar->codec_id == AV_CODEC_ID_AC3) { flags = 0x01; /* set PES_extension_flag_2 */ *q++ = flags; *q++ = 0x80 | 0x01; /* marker bit + extension length */ *q++ = 0x00 | 0x71; /* for AC3 Audio (specifically on blue-rays) */ if (is_dvb_subtitle) { /* First two fields of DVB subtitles PES data: * data_identifier: for DVB subtitle streams shall be coded with the value 0x20 * subtitle_stream_id: for DVB subtitle stream shall be identified by the value 0x00 */ *q++ = 0x20; *q++ = 0x00; if (is_dvb_teletext) { memset(q, 0xff, pes_header_stuffing_bytes); q += pes_header_stuffing_bytes; is_start = 0; /* header size */ header_len = q - buf; /* data len */ len = TS_PACKET_SIZE - header_len; if (len > payload_size) len = payload_size; stuffing_len = TS_PACKET_SIZE - header_len - len; if (stuffing_len > 0) { /* add stuffing with AFC */ if (buf[3] & 0x20) { /* stuffing already present: increase its size */ afc_len = buf[4] + 1; memmove(buf + 4 + afc_len + stuffing_len, buf + 4 + afc_len, header_len - (4 + afc_len)); buf[4] += stuffing_len; memset(buf + 4 + afc_len, 0xff, stuffing_len); } else { /* add stuffing */ memmove(buf + 4 + stuffing_len, buf + 4, header_len - 4); buf[3] |= 0x20; buf[4] = stuffing_len - 1; if (stuffing_len >= 2) { buf[5] = 0x00; memset(buf + 6, 0xff, stuffing_len - 2); if (is_dvb_subtitle && payload_size == len) { memcpy(buf + TS_PACKET_SIZE - len, payload, len - 1); buf[TS_PACKET_SIZE - 1] = 0xff; /* end_of_PES_data_field_marker: an 8-bit field with fixed contents 0xff for DVB subtitle */ } else { memcpy(buf + TS_PACKET_SIZE - len, payload, len); payload += len; payload_size -= len; mpegts_prefix_m2ts_header(s); avio_write(s->pb, buf, TS_PACKET_SIZE); ts_st->prev_payload_key = key;
true
FFmpeg
a566c952f905639456966413fee0b5701867ddcd
static void mpegts_write_pes(AVFormatContext *s, AVStream *st, const uint8_t *payload, int payload_size, int64_t pts, int64_t dts, int key, int stream_id) { MpegTSWriteStream *ts_st = st->priv_data; MpegTSWrite *ts = s->priv_data; uint8_t buf[TS_PACKET_SIZE]; uint8_t *q; int val, is_start, len, header_len, write_pcr, is_dvb_subtitle, is_dvb_teletext, flags; int afc_len, stuffing_len; int64_t pcr = -1; int64_t delay = av_rescale(s->max_delay, 90000, AV_TIME_BASE); int force_pat = st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && key && !ts_st->prev_payload_key; av_assert0(ts_st->payload != buf || st->codecpar->codec_type != AVMEDIA_TYPE_VIDEO); if (ts->flags & MPEGTS_FLAG_PAT_PMT_AT_FRAMES && st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) { force_pat = 1; is_start = 1; while (payload_size > 0) { retransmit_si_info(s, force_pat, dts); force_pat = 0; write_pcr = 0; if (ts_st->pid == ts_st->service->pcr_pid) { if (ts->mux_rate > 1 || is_start) ts_st->service->pcr_packet_count++; if (ts_st->service->pcr_packet_count >= ts_st->service->pcr_packet_period) { ts_st->service->pcr_packet_count = 0; write_pcr = 1; if (ts->mux_rate > 1 && dts != AV_NOPTS_VALUE && (dts - get_pcr(ts, s->pb) / 300) > delay) { if (write_pcr) mpegts_insert_pcr_only(s, st); else mpegts_insert_null_packet(s); continue; q = buf; *q++ = 0x47; val = ts_st->pid >> 8; if (is_start) val |= 0x40; *q++ = val; *q++ = ts_st->pid; ts_st->cc = ts_st->cc + 1 & 0xf; *q++ = 0x10 | ts_st->cc; if (key && is_start && pts != AV_NOPTS_VALUE) { if (ts_st->pid == ts_st->service->pcr_pid) write_pcr = 1; set_af_flag(buf, 0x40); if (write_pcr) { set_af_flag(buf, 0x10); if (ts->mux_rate > 1) pcr = get_pcr(ts, s->pb); else pcr = (dts - delay) * 300; if (dts != AV_NOPTS_VALUE && dts < pcr / 300) av_log(s, AV_LOG_WARNING, "dts < pcr, TS is invalid\n"); extend_af(buf, write_pcr_bits(q, pcr)); if (is_start) { int pes_extension = 0; int pes_header_stuffing_bytes = 0; *q++ = 0x00; *q++ = 0x00; *q++ = 0x01; is_dvb_subtitle = 0; is_dvb_teletext = 0; if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) { if (st->codecpar->codec_id == AV_CODEC_ID_DIRAC) *q++ = 0xfd; else *q++ = 0xe0; } else if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && (st->codecpar->codec_id == AV_CODEC_ID_MP2 || st->codecpar->codec_id == AV_CODEC_ID_MP3 || st->codecpar->codec_id == AV_CODEC_ID_AAC)) { *q++ = 0xc0; } else if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && st->codecpar->codec_id == AV_CODEC_ID_AC3 && ts->m2ts_mode) { *q++ = 0xfd; } else if (st->codecpar->codec_type == AVMEDIA_TYPE_DATA && st->codecpar->codec_id == AV_CODEC_ID_TIMED_ID3) { *q++ = 0xbd; } else if (st->codecpar->codec_type == AVMEDIA_TYPE_DATA) { *q++ = stream_id != -1 ? stream_id : 0xfc; if (stream_id == 0xbd) pts = dts = AV_NOPTS_VALUE; } else { *q++ = 0xbd; if (st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE) { if (st->codecpar->codec_id == AV_CODEC_ID_DVB_SUBTITLE) { is_dvb_subtitle = 1; } else if (st->codecpar->codec_id == AV_CODEC_ID_DVB_TELETEXT) { is_dvb_teletext = 1; header_len = 0; flags = 0; if (pts != AV_NOPTS_VALUE) { header_len += 5; flags |= 0x80; if (dts != AV_NOPTS_VALUE && pts != AV_NOPTS_VALUE && dts != pts) { header_len += 5; flags |= 0x40; if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && st->codecpar->codec_id == AV_CODEC_ID_DIRAC) { pes_extension = 1; flags |= 0x01; header_len += 3; if (ts->m2ts_mode && st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && st->codecpar->codec_id == AV_CODEC_ID_AC3) { pes_extension = 1; flags |= 0x01; header_len += 3; if (is_dvb_teletext) { pes_header_stuffing_bytes = 0x24 - header_len; header_len = 0x24; len = payload_size + header_len + 3; if (is_dvb_subtitle) { len += 3; payload_size++; if (len > 0xffff) len = 0; if (ts->omit_video_pes_length && st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) { len = 0; *q++ = len >> 8; *q++ = len; val = 0x80; if (st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE || st->codecpar->codec_type == AVMEDIA_TYPE_DATA) val |= 0x04; *q++ = val; *q++ = flags; *q++ = header_len; if (pts != AV_NOPTS_VALUE) { write_pts(q, flags >> 6, pts); q += 5; if (dts != AV_NOPTS_VALUE && pts != AV_NOPTS_VALUE && dts != pts) { write_pts(q, 1, dts); q += 5; if (pes_extension && st->codecpar->codec_id == AV_CODEC_ID_DIRAC) { flags = 0x01; *q++ = flags; *q++ = 0x80 | 0x01; *q++ = 0x00 | 0x60; if (ts->m2ts_mode && pes_extension && st->codecpar->codec_id == AV_CODEC_ID_AC3) { flags = 0x01; *q++ = flags; *q++ = 0x80 | 0x01; *q++ = 0x00 | 0x71; if (is_dvb_subtitle) { *q++ = 0x20; *q++ = 0x00; if (is_dvb_teletext) { memset(q, 0xff, pes_header_stuffing_bytes); q += pes_header_stuffing_bytes; is_start = 0; header_len = q - buf; len = TS_PACKET_SIZE - header_len; if (len > payload_size) len = payload_size; stuffing_len = TS_PACKET_SIZE - header_len - len; if (stuffing_len > 0) { if (buf[3] & 0x20) { afc_len = buf[4] + 1; memmove(buf + 4 + afc_len + stuffing_len, buf + 4 + afc_len, header_len - (4 + afc_len)); buf[4] += stuffing_len; memset(buf + 4 + afc_len, 0xff, stuffing_len); } else { memmove(buf + 4 + stuffing_len, buf + 4, header_len - 4); buf[3] |= 0x20; buf[4] = stuffing_len - 1; if (stuffing_len >= 2) { buf[5] = 0x00; memset(buf + 6, 0xff, stuffing_len - 2); if (is_dvb_subtitle && payload_size == len) { memcpy(buf + TS_PACKET_SIZE - len, payload, len - 1); buf[TS_PACKET_SIZE - 1] = 0xff; } else { memcpy(buf + TS_PACKET_SIZE - len, payload, len); payload += len; payload_size -= len; mpegts_prefix_m2ts_header(s); avio_write(s->pb, buf, TS_PACKET_SIZE); ts_st->prev_payload_key = key;
{ "code": [], "line_no": [] }
static void FUNC_0(AVFormatContext *VAR_0, AVStream *VAR_1, const uint8_t *VAR_2, int VAR_3, int64_t VAR_4, int64_t VAR_5, int VAR_6, int VAR_7) { MpegTSWriteStream *ts_st = VAR_1->priv_data; MpegTSWrite *ts = VAR_0->priv_data; uint8_t buf[TS_PACKET_SIZE]; uint8_t *q; int VAR_8, VAR_9, VAR_10, VAR_11, VAR_12, VAR_13, VAR_14, VAR_15; int VAR_16, VAR_17; int64_t pcr = -1; int64_t delay = av_rescale(VAR_0->max_delay, 90000, AV_TIME_BASE); int VAR_18 = VAR_1->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && VAR_6 && !ts_st->prev_payload_key; av_assert0(ts_st->VAR_2 != buf || VAR_1->codecpar->codec_type != AVMEDIA_TYPE_VIDEO); if (ts->VAR_15 & MPEGTS_FLAG_PAT_PMT_AT_FRAMES && VAR_1->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) { VAR_18 = 1; VAR_9 = 1; while (VAR_3 > 0) { retransmit_si_info(VAR_0, VAR_18, VAR_5); VAR_18 = 0; VAR_12 = 0; if (ts_st->pid == ts_st->service->pcr_pid) { if (ts->mux_rate > 1 || VAR_9) ts_st->service->pcr_packet_count++; if (ts_st->service->pcr_packet_count >= ts_st->service->pcr_packet_period) { ts_st->service->pcr_packet_count = 0; VAR_12 = 1; if (ts->mux_rate > 1 && VAR_5 != AV_NOPTS_VALUE && (VAR_5 - get_pcr(ts, VAR_0->pb) / 300) > delay) { if (VAR_12) mpegts_insert_pcr_only(VAR_0, VAR_1); else mpegts_insert_null_packet(VAR_0); continue; q = buf; *q++ = 0x47; VAR_8 = ts_st->pid >> 8; if (VAR_9) VAR_8 |= 0x40; *q++ = VAR_8; *q++ = ts_st->pid; ts_st->cc = ts_st->cc + 1 & 0xf; *q++ = 0x10 | ts_st->cc; if (VAR_6 && VAR_9 && VAR_4 != AV_NOPTS_VALUE) { if (ts_st->pid == ts_st->service->pcr_pid) VAR_12 = 1; set_af_flag(buf, 0x40); if (VAR_12) { set_af_flag(buf, 0x10); if (ts->mux_rate > 1) pcr = get_pcr(ts, VAR_0->pb); else pcr = (VAR_5 - delay) * 300; if (VAR_5 != AV_NOPTS_VALUE && VAR_5 < pcr / 300) av_log(VAR_0, AV_LOG_WARNING, "VAR_5 < pcr, TS is invalid\n"); extend_af(buf, write_pcr_bits(q, pcr)); if (VAR_9) { int VAR_19 = 0; int VAR_20 = 0; *q++ = 0x00; *q++ = 0x00; *q++ = 0x01; VAR_13 = 0; VAR_14 = 0; if (VAR_1->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) { if (VAR_1->codecpar->codec_id == AV_CODEC_ID_DIRAC) *q++ = 0xfd; else *q++ = 0xe0; } else if (VAR_1->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && (VAR_1->codecpar->codec_id == AV_CODEC_ID_MP2 || VAR_1->codecpar->codec_id == AV_CODEC_ID_MP3 || VAR_1->codecpar->codec_id == AV_CODEC_ID_AAC)) { *q++ = 0xc0; } else if (VAR_1->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && VAR_1->codecpar->codec_id == AV_CODEC_ID_AC3 && ts->m2ts_mode) { *q++ = 0xfd; } else if (VAR_1->codecpar->codec_type == AVMEDIA_TYPE_DATA && VAR_1->codecpar->codec_id == AV_CODEC_ID_TIMED_ID3) { *q++ = 0xbd; } else if (VAR_1->codecpar->codec_type == AVMEDIA_TYPE_DATA) { *q++ = VAR_7 != -1 ? VAR_7 : 0xfc; if (VAR_7 == 0xbd) VAR_4 = VAR_5 = AV_NOPTS_VALUE; } else { *q++ = 0xbd; if (VAR_1->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE) { if (VAR_1->codecpar->codec_id == AV_CODEC_ID_DVB_SUBTITLE) { VAR_13 = 1; } else if (VAR_1->codecpar->codec_id == AV_CODEC_ID_DVB_TELETEXT) { VAR_14 = 1; VAR_11 = 0; VAR_15 = 0; if (VAR_4 != AV_NOPTS_VALUE) { VAR_11 += 5; VAR_15 |= 0x80; if (VAR_5 != AV_NOPTS_VALUE && VAR_4 != AV_NOPTS_VALUE && VAR_5 != VAR_4) { VAR_11 += 5; VAR_15 |= 0x40; if (VAR_1->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && VAR_1->codecpar->codec_id == AV_CODEC_ID_DIRAC) { VAR_19 = 1; VAR_15 |= 0x01; VAR_11 += 3; if (ts->m2ts_mode && VAR_1->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && VAR_1->codecpar->codec_id == AV_CODEC_ID_AC3) { VAR_19 = 1; VAR_15 |= 0x01; VAR_11 += 3; if (VAR_14) { VAR_20 = 0x24 - VAR_11; VAR_11 = 0x24; VAR_10 = VAR_3 + VAR_11 + 3; if (VAR_13) { VAR_10 += 3; VAR_3++; if (VAR_10 > 0xffff) VAR_10 = 0; if (ts->omit_video_pes_length && VAR_1->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) { VAR_10 = 0; *q++ = VAR_10 >> 8; *q++ = VAR_10; VAR_8 = 0x80; if (VAR_1->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE || VAR_1->codecpar->codec_type == AVMEDIA_TYPE_DATA) VAR_8 |= 0x04; *q++ = VAR_8; *q++ = VAR_15; *q++ = VAR_11; if (VAR_4 != AV_NOPTS_VALUE) { write_pts(q, VAR_15 >> 6, VAR_4); q += 5; if (VAR_5 != AV_NOPTS_VALUE && VAR_4 != AV_NOPTS_VALUE && VAR_5 != VAR_4) { write_pts(q, 1, VAR_5); q += 5; if (VAR_19 && VAR_1->codecpar->codec_id == AV_CODEC_ID_DIRAC) { VAR_15 = 0x01; *q++ = VAR_15; *q++ = 0x80 | 0x01; *q++ = 0x00 | 0x60; if (ts->m2ts_mode && VAR_19 && VAR_1->codecpar->codec_id == AV_CODEC_ID_AC3) { VAR_15 = 0x01; *q++ = VAR_15; *q++ = 0x80 | 0x01; *q++ = 0x00 | 0x71; if (VAR_13) { *q++ = 0x20; *q++ = 0x00; if (VAR_14) { memset(q, 0xff, VAR_20); q += VAR_20; VAR_9 = 0; VAR_11 = q - buf; VAR_10 = TS_PACKET_SIZE - VAR_11; if (VAR_10 > VAR_3) VAR_10 = VAR_3; VAR_17 = TS_PACKET_SIZE - VAR_11 - VAR_10; if (VAR_17 > 0) { if (buf[3] & 0x20) { VAR_16 = buf[4] + 1; memmove(buf + 4 + VAR_16 + VAR_17, buf + 4 + VAR_16, VAR_11 - (4 + VAR_16)); buf[4] += VAR_17; memset(buf + 4 + VAR_16, 0xff, VAR_17); } else { memmove(buf + 4 + VAR_17, buf + 4, VAR_11 - 4); buf[3] |= 0x20; buf[4] = VAR_17 - 1; if (VAR_17 >= 2) { buf[5] = 0x00; memset(buf + 6, 0xff, VAR_17 - 2); if (VAR_13 && VAR_3 == VAR_10) { memcpy(buf + TS_PACKET_SIZE - VAR_10, VAR_2, VAR_10 - 1); buf[TS_PACKET_SIZE - 1] = 0xff; } else { memcpy(buf + TS_PACKET_SIZE - VAR_10, VAR_2, VAR_10); VAR_2 += VAR_10; VAR_3 -= VAR_10; mpegts_prefix_m2ts_header(VAR_0); avio_write(VAR_0->pb, buf, TS_PACKET_SIZE); ts_st->prev_payload_key = VAR_6;
[ "static void FUNC_0(AVFormatContext *VAR_0, AVStream *VAR_1,\nconst uint8_t *VAR_2, int VAR_3,\nint64_t VAR_4, int64_t VAR_5, int VAR_6, int VAR_7)\n{", "MpegTSWriteStream *ts_st = VAR_1->priv_data;", "MpegTSWrite *ts = VAR_0->priv_data;", "uint8_t buf[TS_PACKET_SIZE];", "uint8_t *q;", "int VAR_8, VAR_9, VAR_10, VAR_11, VAR_12, VAR_13, VAR_14, VAR_15;", "int VAR_16, VAR_17;", "int64_t pcr = -1;", "int64_t delay = av_rescale(VAR_0->max_delay, 90000, AV_TIME_BASE);", "int VAR_18 = VAR_1->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && VAR_6 && !ts_st->prev_payload_key;", "av_assert0(ts_st->VAR_2 != buf || VAR_1->codecpar->codec_type != AVMEDIA_TYPE_VIDEO);", "if (ts->VAR_15 & MPEGTS_FLAG_PAT_PMT_AT_FRAMES && VAR_1->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {", "VAR_18 = 1;", "VAR_9 = 1;", "while (VAR_3 > 0) {", "retransmit_si_info(VAR_0, VAR_18, VAR_5);", "VAR_18 = 0;", "VAR_12 = 0;", "if (ts_st->pid == ts_st->service->pcr_pid) {", "if (ts->mux_rate > 1 || VAR_9)\nts_st->service->pcr_packet_count++;", "if (ts_st->service->pcr_packet_count >=\nts_st->service->pcr_packet_period) {", "ts_st->service->pcr_packet_count = 0;", "VAR_12 = 1;", "if (ts->mux_rate > 1 && VAR_5 != AV_NOPTS_VALUE &&\n(VAR_5 - get_pcr(ts, VAR_0->pb) / 300) > delay) {", "if (VAR_12)\nmpegts_insert_pcr_only(VAR_0, VAR_1);", "else\nmpegts_insert_null_packet(VAR_0);", "continue;", "q = buf;", "*q++ = 0x47;", "VAR_8 = ts_st->pid >> 8;", "if (VAR_9)\nVAR_8 |= 0x40;", "*q++ = VAR_8;", "*q++ = ts_st->pid;", "ts_st->cc = ts_st->cc + 1 & 0xf;", "*q++ = 0x10 | ts_st->cc;", "if (VAR_6 && VAR_9 && VAR_4 != AV_NOPTS_VALUE) {", "if (ts_st->pid == ts_st->service->pcr_pid)\nVAR_12 = 1;", "set_af_flag(buf, 0x40);", "if (VAR_12) {", "set_af_flag(buf, 0x10);", "if (ts->mux_rate > 1)\npcr = get_pcr(ts, VAR_0->pb);", "else\npcr = (VAR_5 - delay) * 300;", "if (VAR_5 != AV_NOPTS_VALUE && VAR_5 < pcr / 300)\nav_log(VAR_0, AV_LOG_WARNING, \"VAR_5 < pcr, TS is invalid\\n\");", "extend_af(buf, write_pcr_bits(q, pcr));", "if (VAR_9) {", "int VAR_19 = 0;", "int VAR_20 = 0;", "*q++ = 0x00;", "*q++ = 0x00;", "*q++ = 0x01;", "VAR_13 = 0;", "VAR_14 = 0;", "if (VAR_1->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {", "if (VAR_1->codecpar->codec_id == AV_CODEC_ID_DIRAC)\n*q++ = 0xfd;", "else\n*q++ = 0xe0;", "} else if (VAR_1->codecpar->codec_type == AVMEDIA_TYPE_AUDIO &&", "(VAR_1->codecpar->codec_id == AV_CODEC_ID_MP2 ||\nVAR_1->codecpar->codec_id == AV_CODEC_ID_MP3 ||\nVAR_1->codecpar->codec_id == AV_CODEC_ID_AAC)) {", "*q++ = 0xc0;", "} else if (VAR_1->codecpar->codec_type == AVMEDIA_TYPE_AUDIO &&", "VAR_1->codecpar->codec_id == AV_CODEC_ID_AC3 &&\nts->m2ts_mode) {", "*q++ = 0xfd;", "} else if (VAR_1->codecpar->codec_type == AVMEDIA_TYPE_DATA &&", "VAR_1->codecpar->codec_id == AV_CODEC_ID_TIMED_ID3) {", "*q++ = 0xbd;", "} else if (VAR_1->codecpar->codec_type == AVMEDIA_TYPE_DATA) {", "*q++ = VAR_7 != -1 ? VAR_7 : 0xfc;", "if (VAR_7 == 0xbd)\nVAR_4 = VAR_5 = AV_NOPTS_VALUE;", "} else {", "*q++ = 0xbd;", "if (VAR_1->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE) {", "if (VAR_1->codecpar->codec_id == AV_CODEC_ID_DVB_SUBTITLE) {", "VAR_13 = 1;", "} else if (VAR_1->codecpar->codec_id == AV_CODEC_ID_DVB_TELETEXT) {", "VAR_14 = 1;", "VAR_11 = 0;", "VAR_15 = 0;", "if (VAR_4 != AV_NOPTS_VALUE) {", "VAR_11 += 5;", "VAR_15 |= 0x80;", "if (VAR_5 != AV_NOPTS_VALUE && VAR_4 != AV_NOPTS_VALUE && VAR_5 != VAR_4) {", "VAR_11 += 5;", "VAR_15 |= 0x40;", "if (VAR_1->codecpar->codec_type == AVMEDIA_TYPE_VIDEO &&\nVAR_1->codecpar->codec_id == AV_CODEC_ID_DIRAC) {", "VAR_19 = 1;", "VAR_15 |= 0x01;", "VAR_11 += 3;", "if (ts->m2ts_mode &&\nVAR_1->codecpar->codec_type == AVMEDIA_TYPE_AUDIO &&\nVAR_1->codecpar->codec_id == AV_CODEC_ID_AC3) {", "VAR_19 = 1;", "VAR_15 |= 0x01;", "VAR_11 += 3;", "if (VAR_14) {", "VAR_20 = 0x24 - VAR_11;", "VAR_11 = 0x24;", "VAR_10 = VAR_3 + VAR_11 + 3;", "if (VAR_13) {", "VAR_10 += 3;", "VAR_3++;", "if (VAR_10 > 0xffff)\nVAR_10 = 0;", "if (ts->omit_video_pes_length && VAR_1->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {", "VAR_10 = 0;", "*q++ = VAR_10 >> 8;", "*q++ = VAR_10;", "VAR_8 = 0x80;", "if (VAR_1->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE || VAR_1->codecpar->codec_type == AVMEDIA_TYPE_DATA)\nVAR_8 |= 0x04;", "*q++ = VAR_8;", "*q++ = VAR_15;", "*q++ = VAR_11;", "if (VAR_4 != AV_NOPTS_VALUE) {", "write_pts(q, VAR_15 >> 6, VAR_4);", "q += 5;", "if (VAR_5 != AV_NOPTS_VALUE && VAR_4 != AV_NOPTS_VALUE && VAR_5 != VAR_4) {", "write_pts(q, 1, VAR_5);", "q += 5;", "if (VAR_19 && VAR_1->codecpar->codec_id == AV_CODEC_ID_DIRAC) {", "VAR_15 = 0x01;", "*q++ = VAR_15;", "*q++ = 0x80 | 0x01;", "*q++ = 0x00 | 0x60;", "if (ts->m2ts_mode &&\nVAR_19 &&\nVAR_1->codecpar->codec_id == AV_CODEC_ID_AC3) {", "VAR_15 = 0x01;", "*q++ = VAR_15;", "*q++ = 0x80 | 0x01;", "*q++ = 0x00 | 0x71;", "if (VAR_13) {", "*q++ = 0x20;", "*q++ = 0x00;", "if (VAR_14) {", "memset(q, 0xff, VAR_20);", "q += VAR_20;", "VAR_9 = 0;", "VAR_11 = q - buf;", "VAR_10 = TS_PACKET_SIZE - VAR_11;", "if (VAR_10 > VAR_3)\nVAR_10 = VAR_3;", "VAR_17 = TS_PACKET_SIZE - VAR_11 - VAR_10;", "if (VAR_17 > 0) {", "if (buf[3] & 0x20) {", "VAR_16 = buf[4] + 1;", "memmove(buf + 4 + VAR_16 + VAR_17,\nbuf + 4 + VAR_16,\nVAR_11 - (4 + VAR_16));", "buf[4] += VAR_17;", "memset(buf + 4 + VAR_16, 0xff, VAR_17);", "} else {", "memmove(buf + 4 + VAR_17, buf + 4, VAR_11 - 4);", "buf[3] |= 0x20;", "buf[4] = VAR_17 - 1;", "if (VAR_17 >= 2) {", "buf[5] = 0x00;", "memset(buf + 6, 0xff, VAR_17 - 2);", "if (VAR_13 && VAR_3 == VAR_10) {", "memcpy(buf + TS_PACKET_SIZE - VAR_10, VAR_2, VAR_10 - 1);", "buf[TS_PACKET_SIZE - 1] = 0xff;", "} else {", "memcpy(buf + TS_PACKET_SIZE - VAR_10, VAR_2, VAR_10);", "VAR_2 += VAR_10;", "VAR_3 -= VAR_10;", "mpegts_prefix_m2ts_header(VAR_0);", "avio_write(VAR_0->pb, buf, TS_PACKET_SIZE);", "ts_st->prev_payload_key = VAR_6;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 38 ], [ 40 ], [ 42 ], [ 44 ], [ 48 ], [ 50 ], [ 52, 54 ], [ 56, 58 ], [ 60 ], [ 62 ], [ 68, 70 ], [ 74, 76 ], [ 78, 80 ], [ 84 ], [ 91 ], [ 93 ], [ 95 ], [ 97, 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 114 ], [ 118, 120 ], [ 122 ], [ 126 ], [ 128 ], [ 133, 135 ], [ 137, 139 ], [ 141, 143 ], [ 145 ], [ 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 ], [ 228 ], [ 230 ], [ 232 ], [ 234 ], [ 236 ], [ 239 ], [ 241 ], [ 243 ], [ 246, 248 ], [ 252 ], [ 254 ], [ 264 ], [ 273, 275, 277 ], [ 281 ], [ 283 ], [ 285 ], [ 288 ], [ 290 ], [ 292 ], [ 295 ], [ 299 ], [ 301 ], [ 303 ], [ 306, 308 ], [ 310 ], [ 312 ], [ 315 ], [ 317 ], [ 319 ], [ 323, 325 ], [ 327 ], [ 329 ], [ 331 ], [ 333 ], [ 335 ], [ 337 ], [ 340 ], [ 342 ], [ 344 ], [ 347 ], [ 349 ], [ 351 ], [ 353 ], [ 359 ], [ 364, 366, 368 ], [ 370 ], [ 372 ], [ 374 ], [ 376 ], [ 383 ], [ 391 ], [ 393 ], [ 396 ], [ 398 ], [ 400 ], [ 403 ], [ 408 ], [ 412 ], [ 414, 416 ], [ 418 ], [ 420 ], [ 424 ], [ 428 ], [ 430, 432, 434 ], [ 436 ], [ 438 ], [ 440 ], [ 444 ], [ 446 ], [ 448 ], [ 450 ], [ 452 ], [ 454 ], [ 461 ], [ 463 ], [ 465 ], [ 467 ], [ 469 ], [ 474 ], [ 476 ], [ 478 ], [ 480 ], [ 483 ] ]
17,911
void ff_ac3_bit_alloc_calc_bap(int16_t *mask, int16_t *psd, int start, int end, int snr_offset, int floor, const uint8_t *bap_tab, uint8_t *bap) { int i, j, end1, v, address; /* special case, if snr offset is -960, set all bap's to zero */ if (snr_offset == -960) { memset(bap, 0, 256); return; } i = start; j = bin_to_band_tab[start]; do { v = (FFMAX(mask[j] - snr_offset - floor, 0) & 0x1FE0) + floor; end1 = FFMIN(band_start_tab[j] + ff_ac3_critical_band_size_tab[j], end); for (; i < end1; i++) { address = av_clip((psd[i] - v) >> 5, 0, 63); bap[i] = bap_tab[address]; } } while (end > band_start_tab[j++]); }
false
FFmpeg
4e745ea83eee0010c0e2f228f47d1394ed1e2170
void ff_ac3_bit_alloc_calc_bap(int16_t *mask, int16_t *psd, int start, int end, int snr_offset, int floor, const uint8_t *bap_tab, uint8_t *bap) { int i, j, end1, v, address; if (snr_offset == -960) { memset(bap, 0, 256); return; } i = start; j = bin_to_band_tab[start]; do { v = (FFMAX(mask[j] - snr_offset - floor, 0) & 0x1FE0) + floor; end1 = FFMIN(band_start_tab[j] + ff_ac3_critical_band_size_tab[j], end); for (; i < end1; i++) { address = av_clip((psd[i] - v) >> 5, 0, 63); bap[i] = bap_tab[address]; } } while (end > band_start_tab[j++]); }
{ "code": [], "line_no": [] }
void FUNC_0(int16_t *VAR_0, int16_t *VAR_1, int VAR_2, int VAR_3, int VAR_4, int VAR_5, const uint8_t *VAR_6, uint8_t *VAR_7) { int VAR_8, VAR_9, VAR_10, VAR_11, VAR_12; if (VAR_4 == -960) { memset(VAR_7, 0, 256); return; } VAR_8 = VAR_2; VAR_9 = bin_to_band_tab[VAR_2]; do { VAR_11 = (FFMAX(VAR_0[VAR_9] - VAR_4 - VAR_5, 0) & 0x1FE0) + VAR_5; VAR_10 = FFMIN(band_start_tab[VAR_9] + ff_ac3_critical_band_size_tab[VAR_9], VAR_3); for (; VAR_8 < VAR_10; VAR_8++) { VAR_12 = av_clip((VAR_1[VAR_8] - VAR_11) >> 5, 0, 63); VAR_7[VAR_8] = VAR_6[VAR_12]; } } while (VAR_3 > band_start_tab[VAR_9++]); }
[ "void FUNC_0(int16_t *VAR_0, int16_t *VAR_1, int VAR_2, int VAR_3,\nint VAR_4, int VAR_5,\nconst uint8_t *VAR_6, uint8_t *VAR_7)\n{", "int VAR_8, VAR_9, VAR_10, VAR_11, VAR_12;", "if (VAR_4 == -960) {", "memset(VAR_7, 0, 256);", "return;", "}", "VAR_8 = VAR_2;", "VAR_9 = bin_to_band_tab[VAR_2];", "do {", "VAR_11 = (FFMAX(VAR_0[VAR_9] - VAR_4 - VAR_5, 0) & 0x1FE0) + VAR_5;", "VAR_10 = FFMIN(band_start_tab[VAR_9] + ff_ac3_critical_band_size_tab[VAR_9], VAR_3);", "for (; VAR_8 < VAR_10; VAR_8++) {", "VAR_12 = av_clip((VAR_1[VAR_8] - VAR_11) >> 5, 0, 63);", "VAR_7[VAR_8] = VAR_6[VAR_12];", "}", "} while (VAR_3 > band_start_tab[VAR_9++]);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ] ]
17,912
static int check_refcounts_l2(BlockDriverState *bs, BdrvCheckResult *res, uint16_t **refcount_table, int64_t *refcount_table_size, int64_t l2_offset, int flags) { BDRVQcowState *s = bs->opaque; uint64_t *l2_table, l2_entry; uint64_t next_contiguous_offset = 0; int i, l2_size, nb_csectors, ret; /* Read L2 table from disk */ l2_size = s->l2_size * sizeof(uint64_t); l2_table = g_malloc(l2_size); ret = bdrv_pread(bs->file, l2_offset, l2_table, l2_size); if (ret < 0) { fprintf(stderr, "ERROR: I/O error in check_refcounts_l2\n"); res->check_errors++; goto fail; } /* Do the actual checks */ for(i = 0; i < s->l2_size; i++) { l2_entry = be64_to_cpu(l2_table[i]); switch (qcow2_get_cluster_type(l2_entry)) { case QCOW2_CLUSTER_COMPRESSED: /* Compressed clusters don't have QCOW_OFLAG_COPIED */ if (l2_entry & QCOW_OFLAG_COPIED) { fprintf(stderr, "ERROR: cluster %" PRId64 ": " "copied flag must never be set for compressed " "clusters\n", l2_entry >> s->cluster_bits); l2_entry &= ~QCOW_OFLAG_COPIED; res->corruptions++; } /* Mark cluster as used */ nb_csectors = ((l2_entry >> s->csize_shift) & s->csize_mask) + 1; l2_entry &= s->cluster_offset_mask; ret = inc_refcounts(bs, res, refcount_table, refcount_table_size, l2_entry & ~511, nb_csectors * 512); if (ret < 0) { goto fail; } if (flags & CHECK_FRAG_INFO) { res->bfi.allocated_clusters++; res->bfi.compressed_clusters++; /* Compressed clusters are fragmented by nature. Since they * take up sub-sector space but we only have sector granularity * I/O we need to re-read the same sectors even for adjacent * compressed clusters. */ res->bfi.fragmented_clusters++; } break; case QCOW2_CLUSTER_ZERO: if ((l2_entry & L2E_OFFSET_MASK) == 0) { break; } /* fall through */ case QCOW2_CLUSTER_NORMAL: { uint64_t offset = l2_entry & L2E_OFFSET_MASK; if (flags & CHECK_FRAG_INFO) { res->bfi.allocated_clusters++; if (next_contiguous_offset && offset != next_contiguous_offset) { res->bfi.fragmented_clusters++; } next_contiguous_offset = offset + s->cluster_size; } /* Mark cluster as used */ ret = inc_refcounts(bs, res, refcount_table, refcount_table_size, offset, s->cluster_size); if (ret < 0) { goto fail; } /* Correct offsets are cluster aligned */ if (offset_into_cluster(s, offset)) { fprintf(stderr, "ERROR offset=%" PRIx64 ": Cluster is not " "properly aligned; L2 entry corrupted.\n", offset); res->corruptions++; } break; } case QCOW2_CLUSTER_UNALLOCATED: break; default: abort(); } } g_free(l2_table); return 0; fail: g_free(l2_table); return ret; }
true
qemu
7453c96b78c2b09aa72924f933bb9616e5474194
static int check_refcounts_l2(BlockDriverState *bs, BdrvCheckResult *res, uint16_t **refcount_table, int64_t *refcount_table_size, int64_t l2_offset, int flags) { BDRVQcowState *s = bs->opaque; uint64_t *l2_table, l2_entry; uint64_t next_contiguous_offset = 0; int i, l2_size, nb_csectors, ret; l2_size = s->l2_size * sizeof(uint64_t); l2_table = g_malloc(l2_size); ret = bdrv_pread(bs->file, l2_offset, l2_table, l2_size); if (ret < 0) { fprintf(stderr, "ERROR: I/O error in check_refcounts_l2\n"); res->check_errors++; goto fail; } for(i = 0; i < s->l2_size; i++) { l2_entry = be64_to_cpu(l2_table[i]); switch (qcow2_get_cluster_type(l2_entry)) { case QCOW2_CLUSTER_COMPRESSED: if (l2_entry & QCOW_OFLAG_COPIED) { fprintf(stderr, "ERROR: cluster %" PRId64 ": " "copied flag must never be set for compressed " "clusters\n", l2_entry >> s->cluster_bits); l2_entry &= ~QCOW_OFLAG_COPIED; res->corruptions++; } nb_csectors = ((l2_entry >> s->csize_shift) & s->csize_mask) + 1; l2_entry &= s->cluster_offset_mask; ret = inc_refcounts(bs, res, refcount_table, refcount_table_size, l2_entry & ~511, nb_csectors * 512); if (ret < 0) { goto fail; } if (flags & CHECK_FRAG_INFO) { res->bfi.allocated_clusters++; res->bfi.compressed_clusters++; res->bfi.fragmented_clusters++; } break; case QCOW2_CLUSTER_ZERO: if ((l2_entry & L2E_OFFSET_MASK) == 0) { break; } case QCOW2_CLUSTER_NORMAL: { uint64_t offset = l2_entry & L2E_OFFSET_MASK; if (flags & CHECK_FRAG_INFO) { res->bfi.allocated_clusters++; if (next_contiguous_offset && offset != next_contiguous_offset) { res->bfi.fragmented_clusters++; } next_contiguous_offset = offset + s->cluster_size; } ret = inc_refcounts(bs, res, refcount_table, refcount_table_size, offset, s->cluster_size); if (ret < 0) { goto fail; } if (offset_into_cluster(s, offset)) { fprintf(stderr, "ERROR offset=%" PRIx64 ": Cluster is not " "properly aligned; L2 entry corrupted.\n", offset); res->corruptions++; } break; } case QCOW2_CLUSTER_UNALLOCATED: break; default: abort(); } } g_free(l2_table); return 0; fail: g_free(l2_table); return ret; }
{ "code": [ " uint16_t **refcount_table, int64_t *refcount_table_size, int64_t l2_offset,", " int flags)" ], "line_no": [ 3, 5 ] }
static int FUNC_0(BlockDriverState *VAR_0, BdrvCheckResult *VAR_1, uint16_t **VAR_2, int64_t *VAR_3, int64_t VAR_4, int VAR_5) { BDRVQcowState *s = VAR_0->opaque; uint64_t *l2_table, l2_entry; uint64_t next_contiguous_offset = 0; int VAR_6, VAR_7, VAR_8, VAR_9; VAR_7 = s->VAR_7 * sizeof(uint64_t); l2_table = g_malloc(VAR_7); VAR_9 = bdrv_pread(VAR_0->file, VAR_4, l2_table, VAR_7); if (VAR_9 < 0) { fprintf(stderr, "ERROR: I/O error in FUNC_0\n"); VAR_1->check_errors++; goto fail; } for(VAR_6 = 0; VAR_6 < s->VAR_7; VAR_6++) { l2_entry = be64_to_cpu(l2_table[VAR_6]); switch (qcow2_get_cluster_type(l2_entry)) { case QCOW2_CLUSTER_COMPRESSED: if (l2_entry & QCOW_OFLAG_COPIED) { fprintf(stderr, "ERROR: cluster %" PRId64 ": " "copied flag must never be set for compressed " "clusters\n", l2_entry >> s->cluster_bits); l2_entry &= ~QCOW_OFLAG_COPIED; VAR_1->corruptions++; } VAR_8 = ((l2_entry >> s->csize_shift) & s->csize_mask) + 1; l2_entry &= s->cluster_offset_mask; VAR_9 = inc_refcounts(VAR_0, VAR_1, VAR_2, VAR_3, l2_entry & ~511, VAR_8 * 512); if (VAR_9 < 0) { goto fail; } if (VAR_5 & CHECK_FRAG_INFO) { VAR_1->bfi.allocated_clusters++; VAR_1->bfi.compressed_clusters++; VAR_1->bfi.fragmented_clusters++; } break; case QCOW2_CLUSTER_ZERO: if ((l2_entry & L2E_OFFSET_MASK) == 0) { break; } case QCOW2_CLUSTER_NORMAL: { uint64_t offset = l2_entry & L2E_OFFSET_MASK; if (VAR_5 & CHECK_FRAG_INFO) { VAR_1->bfi.allocated_clusters++; if (next_contiguous_offset && offset != next_contiguous_offset) { VAR_1->bfi.fragmented_clusters++; } next_contiguous_offset = offset + s->cluster_size; } VAR_9 = inc_refcounts(VAR_0, VAR_1, VAR_2, VAR_3, offset, s->cluster_size); if (VAR_9 < 0) { goto fail; } if (offset_into_cluster(s, offset)) { fprintf(stderr, "ERROR offset=%" PRIx64 ": Cluster is not " "properly aligned; L2 entry corrupted.\n", offset); VAR_1->corruptions++; } break; } case QCOW2_CLUSTER_UNALLOCATED: break; default: abort(); } } g_free(l2_table); return 0; fail: g_free(l2_table); return VAR_9; }
[ "static int FUNC_0(BlockDriverState *VAR_0, BdrvCheckResult *VAR_1,\nuint16_t **VAR_2, int64_t *VAR_3, int64_t VAR_4,\nint VAR_5)\n{", "BDRVQcowState *s = VAR_0->opaque;", "uint64_t *l2_table, l2_entry;", "uint64_t next_contiguous_offset = 0;", "int VAR_6, VAR_7, VAR_8, VAR_9;", "VAR_7 = s->VAR_7 * sizeof(uint64_t);", "l2_table = g_malloc(VAR_7);", "VAR_9 = bdrv_pread(VAR_0->file, VAR_4, l2_table, VAR_7);", "if (VAR_9 < 0) {", "fprintf(stderr, \"ERROR: I/O error in FUNC_0\\n\");", "VAR_1->check_errors++;", "goto fail;", "}", "for(VAR_6 = 0; VAR_6 < s->VAR_7; VAR_6++) {", "l2_entry = be64_to_cpu(l2_table[VAR_6]);", "switch (qcow2_get_cluster_type(l2_entry)) {", "case QCOW2_CLUSTER_COMPRESSED:\nif (l2_entry & QCOW_OFLAG_COPIED) {", "fprintf(stderr, \"ERROR: cluster %\" PRId64 \": \"\n\"copied flag must never be set for compressed \"\n\"clusters\\n\", l2_entry >> s->cluster_bits);", "l2_entry &= ~QCOW_OFLAG_COPIED;", "VAR_1->corruptions++;", "}", "VAR_8 = ((l2_entry >> s->csize_shift) &\ns->csize_mask) + 1;", "l2_entry &= s->cluster_offset_mask;", "VAR_9 = inc_refcounts(VAR_0, VAR_1, VAR_2, VAR_3,\nl2_entry & ~511, VAR_8 * 512);", "if (VAR_9 < 0) {", "goto fail;", "}", "if (VAR_5 & CHECK_FRAG_INFO) {", "VAR_1->bfi.allocated_clusters++;", "VAR_1->bfi.compressed_clusters++;", "VAR_1->bfi.fragmented_clusters++;", "}", "break;", "case QCOW2_CLUSTER_ZERO:\nif ((l2_entry & L2E_OFFSET_MASK) == 0) {", "break;", "}", "case QCOW2_CLUSTER_NORMAL:\n{", "uint64_t offset = l2_entry & L2E_OFFSET_MASK;", "if (VAR_5 & CHECK_FRAG_INFO) {", "VAR_1->bfi.allocated_clusters++;", "if (next_contiguous_offset &&\noffset != next_contiguous_offset) {", "VAR_1->bfi.fragmented_clusters++;", "}", "next_contiguous_offset = offset + s->cluster_size;", "}", "VAR_9 = inc_refcounts(VAR_0, VAR_1, VAR_2, VAR_3,\noffset, s->cluster_size);", "if (VAR_9 < 0) {", "goto fail;", "}", "if (offset_into_cluster(s, offset)) {", "fprintf(stderr, \"ERROR offset=%\" PRIx64 \": Cluster is not \"\n\"properly aligned; L2 entry corrupted.\\n\", offset);", "VAR_1->corruptions++;", "}", "break;", "}", "case QCOW2_CLUSTER_UNALLOCATED:\nbreak;", "default:\nabort();", "}", "}", "g_free(l2_table);", "return 0;", "fail:\ng_free(l2_table);", "return VAR_9;", "}" ]
[ 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 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 43 ], [ 45 ], [ 49 ], [ 51, 55 ], [ 57, 59, 61 ], [ 63 ], [ 65 ], [ 67 ], [ 73, 75 ], [ 77 ], [ 79, 81 ], [ 83 ], [ 85 ], [ 87 ], [ 91 ], [ 93 ], [ 95 ], [ 109 ], [ 111 ], [ 113 ], [ 117, 119 ], [ 121 ], [ 123 ], [ 129, 131 ], [ 133 ], [ 137 ], [ 139 ], [ 141, 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 157, 159 ], [ 161 ], [ 163 ], [ 165 ], [ 171 ], [ 173, 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 187, 189 ], [ 193, 195 ], [ 197 ], [ 199 ], [ 203 ], [ 205 ], [ 209, 211 ], [ 213 ], [ 215 ] ]
17,914
static inline void mix_3f_to_mono(AC3DecodeContext *ctx) { int i; float (*output)[256] = ctx->audio_block.block_output; for (i = 0; i < 256; i++) output[1][i] += (output[2][i] + output[3][i]); memset(output[2], 0, sizeof(output[2])); memset(output[3], 0, sizeof(output[3])); }
false
FFmpeg
486637af8ef29ec215e0e0b7ecd3b5470f0e04e5
static inline void mix_3f_to_mono(AC3DecodeContext *ctx) { int i; float (*output)[256] = ctx->audio_block.block_output; for (i = 0; i < 256; i++) output[1][i] += (output[2][i] + output[3][i]); memset(output[2], 0, sizeof(output[2])); memset(output[3], 0, sizeof(output[3])); }
{ "code": [], "line_no": [] }
static inline void FUNC_0(AC3DecodeContext *VAR_0) { int VAR_1; float (*VAR_2)[256] = VAR_0->audio_block.block_output; for (VAR_1 = 0; VAR_1 < 256; VAR_1++) VAR_2[1][VAR_1] += (VAR_2[2][VAR_1] + VAR_2[3][VAR_1]); memset(VAR_2[2], 0, sizeof(VAR_2[2])); memset(VAR_2[3], 0, sizeof(VAR_2[3])); }
[ "static inline void FUNC_0(AC3DecodeContext *VAR_0)\n{", "int VAR_1;", "float (*VAR_2)[256] = VAR_0->audio_block.block_output;", "for (VAR_1 = 0; VAR_1 < 256; VAR_1++)", "VAR_2[1][VAR_1] += (VAR_2[2][VAR_1] + VAR_2[3][VAR_1]);", "memset(VAR_2[2], 0, sizeof(VAR_2[2]));", "memset(VAR_2[3], 0, sizeof(VAR_2[3]));", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ] ]
17,915
int ff_vc1_parse_frame_header_adv(VC1Context *v, GetBitContext* gb) { int pqindex, lowquant; int status; int mbmodetab, imvtab, icbptab, twomvbptab, fourmvbptab; /* useful only for debugging */ int scale, shift, i; /* for initializing LUT for intensity compensation */ v->numref=0; v->p_frame_skipped = 0; if (v->second_field) { if(v->fcm!=2 || v->field_mode!=1) return -1; v->s.pict_type = (v->fptype & 1) ? AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_I; if (v->fptype & 4) v->s.pict_type = (v->fptype & 1) ? AV_PICTURE_TYPE_BI : AV_PICTURE_TYPE_B; v->s.current_picture_ptr->f.pict_type = v->s.pict_type; if (!v->pic_header_flag) goto parse_common_info; } v->field_mode = 0; if (v->interlace) { v->fcm = decode012(gb); if (v->fcm) { if (v->fcm == ILACE_FIELD) v->field_mode = 1; if (!v->warn_interlaced++) av_log(v->s.avctx, AV_LOG_ERROR, "Interlaced frames/fields support is incomplete\n"); } } else { v->fcm = PROGRESSIVE; } if (v->field_mode) { v->fptype = get_bits(gb, 3); v->s.pict_type = (v->fptype & 2) ? AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_I; if (v->fptype & 4) // B-picture v->s.pict_type = (v->fptype & 2) ? AV_PICTURE_TYPE_BI : AV_PICTURE_TYPE_B; } else { switch (get_unary(gb, 0, 4)) { case 0: v->s.pict_type = AV_PICTURE_TYPE_P; break; case 1: v->s.pict_type = AV_PICTURE_TYPE_B; break; case 2: v->s.pict_type = AV_PICTURE_TYPE_I; break; case 3: v->s.pict_type = AV_PICTURE_TYPE_BI; break; case 4: v->s.pict_type = AV_PICTURE_TYPE_P; // skipped pic v->p_frame_skipped = 1; break; } } if (v->tfcntrflag) skip_bits(gb, 8); if (v->broadcast) { if (!v->interlace || v->psf) { v->rptfrm = get_bits(gb, 2); } else { v->tff = get_bits1(gb); v->rff = get_bits1(gb); } } if (v->panscanflag) { av_log_missing_feature(v->s.avctx, "Pan-scan", 0); //... } if (v->p_frame_skipped) { return 0; } v->rnd = get_bits1(gb); if (v->interlace) v->uvsamp = get_bits1(gb); if(!ff_vc1_bfraction_vlc.table) return 0; //parsing only, vlc tables havnt been allocated if (v->field_mode) { if (!v->refdist_flag) v->refdist = 0; else if ((v->s.pict_type != AV_PICTURE_TYPE_B) && (v->s.pict_type != AV_PICTURE_TYPE_BI)) { v->refdist = get_bits(gb, 2); if (v->refdist == 3) v->refdist += get_unary(gb, 0, 16); } if ((v->s.pict_type == AV_PICTURE_TYPE_B) || (v->s.pict_type == AV_PICTURE_TYPE_BI)) { v->bfraction_lut_index = get_vlc2(gb, ff_vc1_bfraction_vlc.table, VC1_BFRACTION_VLC_BITS, 1); v->bfraction = ff_vc1_bfraction_lut[v->bfraction_lut_index]; v->frfd = (v->bfraction * v->refdist) >> 8; v->brfd = v->refdist - v->frfd - 1; if (v->brfd < 0) v->brfd = 0; } goto parse_common_info; } if (v->fcm == PROGRESSIVE) { if (v->finterpflag) v->interpfrm = get_bits1(gb); if (v->s.pict_type == AV_PICTURE_TYPE_B) { v->bfraction_lut_index = get_vlc2(gb, ff_vc1_bfraction_vlc.table, VC1_BFRACTION_VLC_BITS, 1); v->bfraction = ff_vc1_bfraction_lut[v->bfraction_lut_index]; if (v->bfraction == 0) { v->s.pict_type = AV_PICTURE_TYPE_BI; /* XXX: should not happen here */ } } } parse_common_info: if (v->field_mode) v->cur_field_type = !(v->tff ^ v->second_field); pqindex = get_bits(gb, 5); if (!pqindex) return -1; v->pqindex = pqindex; if (v->quantizer_mode == QUANT_FRAME_IMPLICIT) v->pq = ff_vc1_pquant_table[0][pqindex]; else v->pq = ff_vc1_pquant_table[1][pqindex]; v->pquantizer = 1; if (v->quantizer_mode == QUANT_FRAME_IMPLICIT) v->pquantizer = pqindex < 9; if (v->quantizer_mode == QUANT_NON_UNIFORM) v->pquantizer = 0; v->pqindex = pqindex; if (pqindex < 9) v->halfpq = get_bits1(gb); else v->halfpq = 0; if (v->quantizer_mode == QUANT_FRAME_EXPLICIT) v->pquantizer = get_bits1(gb); if (v->postprocflag) v->postproc = get_bits(gb, 2); if (v->s.pict_type == AV_PICTURE_TYPE_I || v->s.pict_type == AV_PICTURE_TYPE_P) v->use_ic = 0; if (v->parse_only) return 0; switch (v->s.pict_type) { case AV_PICTURE_TYPE_I: case AV_PICTURE_TYPE_BI: if (v->fcm == ILACE_FRAME) { //interlace frame picture status = bitplane_decoding(v->fieldtx_plane, &v->fieldtx_is_raw, v); if (status < 0) return -1; av_log(v->s.avctx, AV_LOG_DEBUG, "FIELDTX plane encoding: " "Imode: %i, Invert: %i\n", status>>1, status&1); } status = bitplane_decoding(v->acpred_plane, &v->acpred_is_raw, v); if (status < 0) return -1; av_log(v->s.avctx, AV_LOG_DEBUG, "ACPRED plane encoding: " "Imode: %i, Invert: %i\n", status>>1, status&1); v->condover = CONDOVER_NONE; if (v->overlap && v->pq <= 8) { v->condover = decode012(gb); if (v->condover == CONDOVER_SELECT) { status = bitplane_decoding(v->over_flags_plane, &v->overflg_is_raw, v); if (status < 0) return -1; av_log(v->s.avctx, AV_LOG_DEBUG, "CONDOVER plane encoding: " "Imode: %i, Invert: %i\n", status>>1, status&1); } } break; case AV_PICTURE_TYPE_P: if (v->field_mode) { v->numref = get_bits1(gb); if (!v->numref) { v->reffield = get_bits1(gb); v->ref_field_type[0] = v->reffield ^ !v->cur_field_type; } } if (v->extended_mv) v->mvrange = get_unary(gb, 0, 3); else v->mvrange = 0; if (v->interlace) { if (v->extended_dmv) v->dmvrange = get_unary(gb, 0, 3); else v->dmvrange = 0; if (v->fcm == ILACE_FRAME) { // interlaced frame picture v->fourmvswitch = get_bits1(gb); v->intcomp = get_bits1(gb); if (v->intcomp) { v->lumscale = get_bits(gb, 6); v->lumshift = get_bits(gb, 6); INIT_LUT(v->lumscale, v->lumshift, v->luty, v->lutuv); } status = bitplane_decoding(v->s.mbskip_table, &v->skip_is_raw, v); av_log(v->s.avctx, AV_LOG_DEBUG, "SKIPMB plane encoding: " "Imode: %i, Invert: %i\n", status>>1, status&1); mbmodetab = get_bits(gb, 2); if (v->fourmvswitch) v->mbmode_vlc = &ff_vc1_intfr_4mv_mbmode_vlc[mbmodetab]; else v->mbmode_vlc = &ff_vc1_intfr_non4mv_mbmode_vlc[mbmodetab]; imvtab = get_bits(gb, 2); v->imv_vlc = &ff_vc1_1ref_mvdata_vlc[imvtab]; // interlaced p-picture cbpcy range is [1, 63] icbptab = get_bits(gb, 3); v->cbpcy_vlc = &ff_vc1_icbpcy_vlc[icbptab]; twomvbptab = get_bits(gb, 2); v->twomvbp_vlc = &ff_vc1_2mv_block_pattern_vlc[twomvbptab]; if (v->fourmvswitch) { fourmvbptab = get_bits(gb, 2); v->fourmvbp_vlc = &ff_vc1_4mv_block_pattern_vlc[fourmvbptab]; } } } v->k_x = v->mvrange + 9 + (v->mvrange >> 1); //k_x can be 9 10 12 13 v->k_y = v->mvrange + 8; //k_y can be 8 9 10 11 v->range_x = 1 << (v->k_x - 1); v->range_y = 1 << (v->k_y - 1); if (v->pq < 5) v->tt_index = 0; else if (v->pq < 13) v->tt_index = 1; else v->tt_index = 2; if (v->fcm != ILACE_FRAME) { int mvmode; mvmode = get_unary(gb, 1, 4); lowquant = (v->pq > 12) ? 0 : 1; v->mv_mode = ff_vc1_mv_pmode_table[lowquant][mvmode]; if (v->mv_mode == MV_PMODE_INTENSITY_COMP) { int mvmode2; mvmode2 = get_unary(gb, 1, 3); v->mv_mode2 = ff_vc1_mv_pmode_table2[lowquant][mvmode2]; if (v->field_mode) v->intcompfield = decode210(gb); v->lumscale = get_bits(gb, 6); v->lumshift = get_bits(gb, 6); INIT_LUT(v->lumscale, v->lumshift, v->luty, v->lutuv); if ((v->field_mode) && !v->intcompfield) { v->lumscale2 = get_bits(gb, 6); v->lumshift2 = get_bits(gb, 6); INIT_LUT(v->lumscale2, v->lumshift2, v->luty2, v->lutuv2); } v->use_ic = 1; } v->qs_last = v->s.quarter_sample; if (v->mv_mode == MV_PMODE_1MV_HPEL || v->mv_mode == MV_PMODE_1MV_HPEL_BILIN) v->s.quarter_sample = 0; else if (v->mv_mode == MV_PMODE_INTENSITY_COMP) { if (v->mv_mode2 == MV_PMODE_1MV_HPEL || v->mv_mode2 == MV_PMODE_1MV_HPEL_BILIN) v->s.quarter_sample = 0; else v->s.quarter_sample = 1; } else v->s.quarter_sample = 1; v->s.mspel = !(v->mv_mode == MV_PMODE_1MV_HPEL_BILIN || (v->mv_mode == MV_PMODE_INTENSITY_COMP && v->mv_mode2 == MV_PMODE_1MV_HPEL_BILIN)); } if (v->fcm == PROGRESSIVE) { // progressive if ((v->mv_mode == MV_PMODE_INTENSITY_COMP && v->mv_mode2 == MV_PMODE_MIXED_MV) || v->mv_mode == MV_PMODE_MIXED_MV) { status = bitplane_decoding(v->mv_type_mb_plane, &v->mv_type_is_raw, v); if (status < 0) return -1; av_log(v->s.avctx, AV_LOG_DEBUG, "MB MV Type plane encoding: " "Imode: %i, Invert: %i\n", status>>1, status&1); } else { v->mv_type_is_raw = 0; memset(v->mv_type_mb_plane, 0, v->s.mb_stride * v->s.mb_height); } status = bitplane_decoding(v->s.mbskip_table, &v->skip_is_raw, v); if (status < 0) return -1; av_log(v->s.avctx, AV_LOG_DEBUG, "MB Skip plane encoding: " "Imode: %i, Invert: %i\n", status>>1, status&1); /* Hopefully this is correct for P frames */ v->s.mv_table_index = get_bits(gb, 2); //but using ff_vc1_ tables v->cbpcy_vlc = &ff_vc1_cbpcy_p_vlc[get_bits(gb, 2)]; } else if (v->fcm == ILACE_FRAME) { // frame interlaced v->qs_last = v->s.quarter_sample; v->s.quarter_sample = 1; v->s.mspel = 1; } else { // field interlaced mbmodetab = get_bits(gb, 3); imvtab = get_bits(gb, 2 + v->numref); if (!v->numref) v->imv_vlc = &ff_vc1_1ref_mvdata_vlc[imvtab]; else v->imv_vlc = &ff_vc1_2ref_mvdata_vlc[imvtab]; icbptab = get_bits(gb, 3); v->cbpcy_vlc = &ff_vc1_icbpcy_vlc[icbptab]; if ((v->mv_mode == MV_PMODE_INTENSITY_COMP && v->mv_mode2 == MV_PMODE_MIXED_MV) || v->mv_mode == MV_PMODE_MIXED_MV) { fourmvbptab = get_bits(gb, 2); v->fourmvbp_vlc = &ff_vc1_4mv_block_pattern_vlc[fourmvbptab]; v->mbmode_vlc = &ff_vc1_if_mmv_mbmode_vlc[mbmodetab]; } else { v->mbmode_vlc = &ff_vc1_if_1mv_mbmode_vlc[mbmodetab]; } } if (v->dquant) { av_log(v->s.avctx, AV_LOG_DEBUG, "VOP DQuant info\n"); vop_dquant_decoding(v); } v->ttfrm = 0; //FIXME Is that so ? if (v->vstransform) { v->ttmbf = get_bits1(gb); if (v->ttmbf) { v->ttfrm = ff_vc1_ttfrm_to_tt[get_bits(gb, 2)]; } } else { v->ttmbf = 1; v->ttfrm = TT_8X8; } break; case AV_PICTURE_TYPE_B: if (v->fcm == ILACE_FRAME) { v->bfraction_lut_index = get_vlc2(gb, ff_vc1_bfraction_vlc.table, VC1_BFRACTION_VLC_BITS, 1); v->bfraction = ff_vc1_bfraction_lut[v->bfraction_lut_index]; if (v->bfraction == 0) { return -1; } } if (v->extended_mv) v->mvrange = get_unary(gb, 0, 3); else v->mvrange = 0; v->k_x = v->mvrange + 9 + (v->mvrange >> 1); //k_x can be 9 10 12 13 v->k_y = v->mvrange + 8; //k_y can be 8 9 10 11 v->range_x = 1 << (v->k_x - 1); v->range_y = 1 << (v->k_y - 1); if (v->pq < 5) v->tt_index = 0; else if (v->pq < 13) v->tt_index = 1; else v->tt_index = 2; if (v->field_mode) { int mvmode; av_log(v->s.avctx, AV_LOG_DEBUG, "B Fields\n"); if (v->extended_dmv) v->dmvrange = get_unary(gb, 0, 3); mvmode = get_unary(gb, 1, 3); lowquant = (v->pq > 12) ? 0 : 1; v->mv_mode = ff_vc1_mv_pmode_table2[lowquant][mvmode]; v->qs_last = v->s.quarter_sample; v->s.quarter_sample = (v->mv_mode == MV_PMODE_1MV || v->mv_mode == MV_PMODE_MIXED_MV); v->s.mspel = !(v->mv_mode == MV_PMODE_1MV_HPEL_BILIN || v->mv_mode == MV_PMODE_1MV_HPEL); status = bitplane_decoding(v->forward_mb_plane, &v->fmb_is_raw, v); if (status < 0) return -1; av_log(v->s.avctx, AV_LOG_DEBUG, "MB Forward Type plane encoding: " "Imode: %i, Invert: %i\n", status>>1, status&1); mbmodetab = get_bits(gb, 3); if (v->mv_mode == MV_PMODE_MIXED_MV) v->mbmode_vlc = &ff_vc1_if_mmv_mbmode_vlc[mbmodetab]; else v->mbmode_vlc = &ff_vc1_if_1mv_mbmode_vlc[mbmodetab]; imvtab = get_bits(gb, 3); v->imv_vlc = &ff_vc1_2ref_mvdata_vlc[imvtab]; icbptab = get_bits(gb, 3); v->cbpcy_vlc = &ff_vc1_icbpcy_vlc[icbptab]; if (v->mv_mode == MV_PMODE_MIXED_MV) { fourmvbptab = get_bits(gb, 2); v->fourmvbp_vlc = &ff_vc1_4mv_block_pattern_vlc[fourmvbptab]; } v->numref = 1; // interlaced field B pictures are always 2-ref } else if (v->fcm == ILACE_FRAME) { if (v->extended_dmv) v->dmvrange = get_unary(gb, 0, 3); get_bits1(gb); /* intcomp - present but shall always be 0 */ v->intcomp = 0; v->mv_mode = MV_PMODE_1MV; v->fourmvswitch = 0; v->qs_last = v->s.quarter_sample; v->s.quarter_sample = 1; v->s.mspel = 1; status = bitplane_decoding(v->direct_mb_plane, &v->dmb_is_raw, v); if (status < 0) return -1; av_log(v->s.avctx, AV_LOG_DEBUG, "MB Direct Type plane encoding: " "Imode: %i, Invert: %i\n", status>>1, status&1); status = bitplane_decoding(v->s.mbskip_table, &v->skip_is_raw, v); if (status < 0) return -1; av_log(v->s.avctx, AV_LOG_DEBUG, "MB Skip plane encoding: " "Imode: %i, Invert: %i\n", status>>1, status&1); mbmodetab = get_bits(gb, 2); v->mbmode_vlc = &ff_vc1_intfr_non4mv_mbmode_vlc[mbmodetab]; imvtab = get_bits(gb, 2); v->imv_vlc = &ff_vc1_1ref_mvdata_vlc[imvtab]; // interlaced p/b-picture cbpcy range is [1, 63] icbptab = get_bits(gb, 3); v->cbpcy_vlc = &ff_vc1_icbpcy_vlc[icbptab]; twomvbptab = get_bits(gb, 2); v->twomvbp_vlc = &ff_vc1_2mv_block_pattern_vlc[twomvbptab]; fourmvbptab = get_bits(gb, 2); v->fourmvbp_vlc = &ff_vc1_4mv_block_pattern_vlc[fourmvbptab]; } else { v->mv_mode = get_bits1(gb) ? MV_PMODE_1MV : MV_PMODE_1MV_HPEL_BILIN; v->qs_last = v->s.quarter_sample; v->s.quarter_sample = (v->mv_mode == MV_PMODE_1MV); v->s.mspel = v->s.quarter_sample; status = bitplane_decoding(v->direct_mb_plane, &v->dmb_is_raw, v); if (status < 0) return -1; av_log(v->s.avctx, AV_LOG_DEBUG, "MB Direct Type plane encoding: " "Imode: %i, Invert: %i\n", status>>1, status&1); status = bitplane_decoding(v->s.mbskip_table, &v->skip_is_raw, v); if (status < 0) return -1; av_log(v->s.avctx, AV_LOG_DEBUG, "MB Skip plane encoding: " "Imode: %i, Invert: %i\n", status>>1, status&1); v->s.mv_table_index = get_bits(gb, 2); v->cbpcy_vlc = &ff_vc1_cbpcy_p_vlc[get_bits(gb, 2)]; } if (v->dquant) { av_log(v->s.avctx, AV_LOG_DEBUG, "VOP DQuant info\n"); vop_dquant_decoding(v); } v->ttfrm = 0; if (v->vstransform) { v->ttmbf = get_bits1(gb); if (v->ttmbf) { v->ttfrm = ff_vc1_ttfrm_to_tt[get_bits(gb, 2)]; } } else { v->ttmbf = 1; v->ttfrm = TT_8X8; } break; } if (v->fcm != PROGRESSIVE && !v->s.quarter_sample) { v->range_x <<= 1; v->range_y <<= 1; } /* AC Syntax */ v->c_ac_table_index = decode012(gb); if (v->s.pict_type == AV_PICTURE_TYPE_I || v->s.pict_type == AV_PICTURE_TYPE_BI) { v->y_ac_table_index = decode012(gb); } /* DC Syntax */ v->s.dc_table_index = get_bits1(gb); if ((v->s.pict_type == AV_PICTURE_TYPE_I || v->s.pict_type == AV_PICTURE_TYPE_BI) && v->dquant) { av_log(v->s.avctx, AV_LOG_DEBUG, "VOP DQuant info\n"); vop_dquant_decoding(v); } v->bi_type = 0; if (v->s.pict_type == AV_PICTURE_TYPE_BI) { v->s.pict_type = AV_PICTURE_TYPE_B; v->bi_type = 1; } return 0; }
false
FFmpeg
7845f8d282a98d5e01aaeddfa9af698697d8874d
int ff_vc1_parse_frame_header_adv(VC1Context *v, GetBitContext* gb) { int pqindex, lowquant; int status; int mbmodetab, imvtab, icbptab, twomvbptab, fourmvbptab; int scale, shift, i; v->numref=0; v->p_frame_skipped = 0; if (v->second_field) { if(v->fcm!=2 || v->field_mode!=1) return -1; v->s.pict_type = (v->fptype & 1) ? AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_I; if (v->fptype & 4) v->s.pict_type = (v->fptype & 1) ? AV_PICTURE_TYPE_BI : AV_PICTURE_TYPE_B; v->s.current_picture_ptr->f.pict_type = v->s.pict_type; if (!v->pic_header_flag) goto parse_common_info; } v->field_mode = 0; if (v->interlace) { v->fcm = decode012(gb); if (v->fcm) { if (v->fcm == ILACE_FIELD) v->field_mode = 1; if (!v->warn_interlaced++) av_log(v->s.avctx, AV_LOG_ERROR, "Interlaced frames/fields support is incomplete\n"); } } else { v->fcm = PROGRESSIVE; } if (v->field_mode) { v->fptype = get_bits(gb, 3); v->s.pict_type = (v->fptype & 2) ? AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_I; if (v->fptype & 4) v->s.pict_type = (v->fptype & 2) ? AV_PICTURE_TYPE_BI : AV_PICTURE_TYPE_B; } else { switch (get_unary(gb, 0, 4)) { case 0: v->s.pict_type = AV_PICTURE_TYPE_P; break; case 1: v->s.pict_type = AV_PICTURE_TYPE_B; break; case 2: v->s.pict_type = AV_PICTURE_TYPE_I; break; case 3: v->s.pict_type = AV_PICTURE_TYPE_BI; break; case 4: v->s.pict_type = AV_PICTURE_TYPE_P; v->p_frame_skipped = 1; break; } } if (v->tfcntrflag) skip_bits(gb, 8); if (v->broadcast) { if (!v->interlace || v->psf) { v->rptfrm = get_bits(gb, 2); } else { v->tff = get_bits1(gb); v->rff = get_bits1(gb); } } if (v->panscanflag) { av_log_missing_feature(v->s.avctx, "Pan-scan", 0); } if (v->p_frame_skipped) { return 0; } v->rnd = get_bits1(gb); if (v->interlace) v->uvsamp = get_bits1(gb); if(!ff_vc1_bfraction_vlc.table) return 0; if (v->field_mode) { if (!v->refdist_flag) v->refdist = 0; else if ((v->s.pict_type != AV_PICTURE_TYPE_B) && (v->s.pict_type != AV_PICTURE_TYPE_BI)) { v->refdist = get_bits(gb, 2); if (v->refdist == 3) v->refdist += get_unary(gb, 0, 16); } if ((v->s.pict_type == AV_PICTURE_TYPE_B) || (v->s.pict_type == AV_PICTURE_TYPE_BI)) { v->bfraction_lut_index = get_vlc2(gb, ff_vc1_bfraction_vlc.table, VC1_BFRACTION_VLC_BITS, 1); v->bfraction = ff_vc1_bfraction_lut[v->bfraction_lut_index]; v->frfd = (v->bfraction * v->refdist) >> 8; v->brfd = v->refdist - v->frfd - 1; if (v->brfd < 0) v->brfd = 0; } goto parse_common_info; } if (v->fcm == PROGRESSIVE) { if (v->finterpflag) v->interpfrm = get_bits1(gb); if (v->s.pict_type == AV_PICTURE_TYPE_B) { v->bfraction_lut_index = get_vlc2(gb, ff_vc1_bfraction_vlc.table, VC1_BFRACTION_VLC_BITS, 1); v->bfraction = ff_vc1_bfraction_lut[v->bfraction_lut_index]; if (v->bfraction == 0) { v->s.pict_type = AV_PICTURE_TYPE_BI; } } } parse_common_info: if (v->field_mode) v->cur_field_type = !(v->tff ^ v->second_field); pqindex = get_bits(gb, 5); if (!pqindex) return -1; v->pqindex = pqindex; if (v->quantizer_mode == QUANT_FRAME_IMPLICIT) v->pq = ff_vc1_pquant_table[0][pqindex]; else v->pq = ff_vc1_pquant_table[1][pqindex]; v->pquantizer = 1; if (v->quantizer_mode == QUANT_FRAME_IMPLICIT) v->pquantizer = pqindex < 9; if (v->quantizer_mode == QUANT_NON_UNIFORM) v->pquantizer = 0; v->pqindex = pqindex; if (pqindex < 9) v->halfpq = get_bits1(gb); else v->halfpq = 0; if (v->quantizer_mode == QUANT_FRAME_EXPLICIT) v->pquantizer = get_bits1(gb); if (v->postprocflag) v->postproc = get_bits(gb, 2); if (v->s.pict_type == AV_PICTURE_TYPE_I || v->s.pict_type == AV_PICTURE_TYPE_P) v->use_ic = 0; if (v->parse_only) return 0; switch (v->s.pict_type) { case AV_PICTURE_TYPE_I: case AV_PICTURE_TYPE_BI: if (v->fcm == ILACE_FRAME) { status = bitplane_decoding(v->fieldtx_plane, &v->fieldtx_is_raw, v); if (status < 0) return -1; av_log(v->s.avctx, AV_LOG_DEBUG, "FIELDTX plane encoding: " "Imode: %i, Invert: %i\n", status>>1, status&1); } status = bitplane_decoding(v->acpred_plane, &v->acpred_is_raw, v); if (status < 0) return -1; av_log(v->s.avctx, AV_LOG_DEBUG, "ACPRED plane encoding: " "Imode: %i, Invert: %i\n", status>>1, status&1); v->condover = CONDOVER_NONE; if (v->overlap && v->pq <= 8) { v->condover = decode012(gb); if (v->condover == CONDOVER_SELECT) { status = bitplane_decoding(v->over_flags_plane, &v->overflg_is_raw, v); if (status < 0) return -1; av_log(v->s.avctx, AV_LOG_DEBUG, "CONDOVER plane encoding: " "Imode: %i, Invert: %i\n", status>>1, status&1); } } break; case AV_PICTURE_TYPE_P: if (v->field_mode) { v->numref = get_bits1(gb); if (!v->numref) { v->reffield = get_bits1(gb); v->ref_field_type[0] = v->reffield ^ !v->cur_field_type; } } if (v->extended_mv) v->mvrange = get_unary(gb, 0, 3); else v->mvrange = 0; if (v->interlace) { if (v->extended_dmv) v->dmvrange = get_unary(gb, 0, 3); else v->dmvrange = 0; if (v->fcm == ILACE_FRAME) { v->fourmvswitch = get_bits1(gb); v->intcomp = get_bits1(gb); if (v->intcomp) { v->lumscale = get_bits(gb, 6); v->lumshift = get_bits(gb, 6); INIT_LUT(v->lumscale, v->lumshift, v->luty, v->lutuv); } status = bitplane_decoding(v->s.mbskip_table, &v->skip_is_raw, v); av_log(v->s.avctx, AV_LOG_DEBUG, "SKIPMB plane encoding: " "Imode: %i, Invert: %i\n", status>>1, status&1); mbmodetab = get_bits(gb, 2); if (v->fourmvswitch) v->mbmode_vlc = &ff_vc1_intfr_4mv_mbmode_vlc[mbmodetab]; else v->mbmode_vlc = &ff_vc1_intfr_non4mv_mbmode_vlc[mbmodetab]; imvtab = get_bits(gb, 2); v->imv_vlc = &ff_vc1_1ref_mvdata_vlc[imvtab]; icbptab = get_bits(gb, 3); v->cbpcy_vlc = &ff_vc1_icbpcy_vlc[icbptab]; twomvbptab = get_bits(gb, 2); v->twomvbp_vlc = &ff_vc1_2mv_block_pattern_vlc[twomvbptab]; if (v->fourmvswitch) { fourmvbptab = get_bits(gb, 2); v->fourmvbp_vlc = &ff_vc1_4mv_block_pattern_vlc[fourmvbptab]; } } } v->k_x = v->mvrange + 9 + (v->mvrange >> 1); v->k_y = v->mvrange + 8; v->range_x = 1 << (v->k_x - 1); v->range_y = 1 << (v->k_y - 1); if (v->pq < 5) v->tt_index = 0; else if (v->pq < 13) v->tt_index = 1; else v->tt_index = 2; if (v->fcm != ILACE_FRAME) { int mvmode; mvmode = get_unary(gb, 1, 4); lowquant = (v->pq > 12) ? 0 : 1; v->mv_mode = ff_vc1_mv_pmode_table[lowquant][mvmode]; if (v->mv_mode == MV_PMODE_INTENSITY_COMP) { int mvmode2; mvmode2 = get_unary(gb, 1, 3); v->mv_mode2 = ff_vc1_mv_pmode_table2[lowquant][mvmode2]; if (v->field_mode) v->intcompfield = decode210(gb); v->lumscale = get_bits(gb, 6); v->lumshift = get_bits(gb, 6); INIT_LUT(v->lumscale, v->lumshift, v->luty, v->lutuv); if ((v->field_mode) && !v->intcompfield) { v->lumscale2 = get_bits(gb, 6); v->lumshift2 = get_bits(gb, 6); INIT_LUT(v->lumscale2, v->lumshift2, v->luty2, v->lutuv2); } v->use_ic = 1; } v->qs_last = v->s.quarter_sample; if (v->mv_mode == MV_PMODE_1MV_HPEL || v->mv_mode == MV_PMODE_1MV_HPEL_BILIN) v->s.quarter_sample = 0; else if (v->mv_mode == MV_PMODE_INTENSITY_COMP) { if (v->mv_mode2 == MV_PMODE_1MV_HPEL || v->mv_mode2 == MV_PMODE_1MV_HPEL_BILIN) v->s.quarter_sample = 0; else v->s.quarter_sample = 1; } else v->s.quarter_sample = 1; v->s.mspel = !(v->mv_mode == MV_PMODE_1MV_HPEL_BILIN || (v->mv_mode == MV_PMODE_INTENSITY_COMP && v->mv_mode2 == MV_PMODE_1MV_HPEL_BILIN)); } if (v->fcm == PROGRESSIVE) { if ((v->mv_mode == MV_PMODE_INTENSITY_COMP && v->mv_mode2 == MV_PMODE_MIXED_MV) || v->mv_mode == MV_PMODE_MIXED_MV) { status = bitplane_decoding(v->mv_type_mb_plane, &v->mv_type_is_raw, v); if (status < 0) return -1; av_log(v->s.avctx, AV_LOG_DEBUG, "MB MV Type plane encoding: " "Imode: %i, Invert: %i\n", status>>1, status&1); } else { v->mv_type_is_raw = 0; memset(v->mv_type_mb_plane, 0, v->s.mb_stride * v->s.mb_height); } status = bitplane_decoding(v->s.mbskip_table, &v->skip_is_raw, v); if (status < 0) return -1; av_log(v->s.avctx, AV_LOG_DEBUG, "MB Skip plane encoding: " "Imode: %i, Invert: %i\n", status>>1, status&1); v->s.mv_table_index = get_bits(gb, 2); v->cbpcy_vlc = &ff_vc1_cbpcy_p_vlc[get_bits(gb, 2)]; } else if (v->fcm == ILACE_FRAME) { v->qs_last = v->s.quarter_sample; v->s.quarter_sample = 1; v->s.mspel = 1; } else { mbmodetab = get_bits(gb, 3); imvtab = get_bits(gb, 2 + v->numref); if (!v->numref) v->imv_vlc = &ff_vc1_1ref_mvdata_vlc[imvtab]; else v->imv_vlc = &ff_vc1_2ref_mvdata_vlc[imvtab]; icbptab = get_bits(gb, 3); v->cbpcy_vlc = &ff_vc1_icbpcy_vlc[icbptab]; if ((v->mv_mode == MV_PMODE_INTENSITY_COMP && v->mv_mode2 == MV_PMODE_MIXED_MV) || v->mv_mode == MV_PMODE_MIXED_MV) { fourmvbptab = get_bits(gb, 2); v->fourmvbp_vlc = &ff_vc1_4mv_block_pattern_vlc[fourmvbptab]; v->mbmode_vlc = &ff_vc1_if_mmv_mbmode_vlc[mbmodetab]; } else { v->mbmode_vlc = &ff_vc1_if_1mv_mbmode_vlc[mbmodetab]; } } if (v->dquant) { av_log(v->s.avctx, AV_LOG_DEBUG, "VOP DQuant info\n"); vop_dquant_decoding(v); } v->ttfrm = 0; if (v->vstransform) { v->ttmbf = get_bits1(gb); if (v->ttmbf) { v->ttfrm = ff_vc1_ttfrm_to_tt[get_bits(gb, 2)]; } } else { v->ttmbf = 1; v->ttfrm = TT_8X8; } break; case AV_PICTURE_TYPE_B: if (v->fcm == ILACE_FRAME) { v->bfraction_lut_index = get_vlc2(gb, ff_vc1_bfraction_vlc.table, VC1_BFRACTION_VLC_BITS, 1); v->bfraction = ff_vc1_bfraction_lut[v->bfraction_lut_index]; if (v->bfraction == 0) { return -1; } } if (v->extended_mv) v->mvrange = get_unary(gb, 0, 3); else v->mvrange = 0; v->k_x = v->mvrange + 9 + (v->mvrange >> 1); v->k_y = v->mvrange + 8; v->range_x = 1 << (v->k_x - 1); v->range_y = 1 << (v->k_y - 1); if (v->pq < 5) v->tt_index = 0; else if (v->pq < 13) v->tt_index = 1; else v->tt_index = 2; if (v->field_mode) { int mvmode; av_log(v->s.avctx, AV_LOG_DEBUG, "B Fields\n"); if (v->extended_dmv) v->dmvrange = get_unary(gb, 0, 3); mvmode = get_unary(gb, 1, 3); lowquant = (v->pq > 12) ? 0 : 1; v->mv_mode = ff_vc1_mv_pmode_table2[lowquant][mvmode]; v->qs_last = v->s.quarter_sample; v->s.quarter_sample = (v->mv_mode == MV_PMODE_1MV || v->mv_mode == MV_PMODE_MIXED_MV); v->s.mspel = !(v->mv_mode == MV_PMODE_1MV_HPEL_BILIN || v->mv_mode == MV_PMODE_1MV_HPEL); status = bitplane_decoding(v->forward_mb_plane, &v->fmb_is_raw, v); if (status < 0) return -1; av_log(v->s.avctx, AV_LOG_DEBUG, "MB Forward Type plane encoding: " "Imode: %i, Invert: %i\n", status>>1, status&1); mbmodetab = get_bits(gb, 3); if (v->mv_mode == MV_PMODE_MIXED_MV) v->mbmode_vlc = &ff_vc1_if_mmv_mbmode_vlc[mbmodetab]; else v->mbmode_vlc = &ff_vc1_if_1mv_mbmode_vlc[mbmodetab]; imvtab = get_bits(gb, 3); v->imv_vlc = &ff_vc1_2ref_mvdata_vlc[imvtab]; icbptab = get_bits(gb, 3); v->cbpcy_vlc = &ff_vc1_icbpcy_vlc[icbptab]; if (v->mv_mode == MV_PMODE_MIXED_MV) { fourmvbptab = get_bits(gb, 2); v->fourmvbp_vlc = &ff_vc1_4mv_block_pattern_vlc[fourmvbptab]; } v->numref = 1; } else if (v->fcm == ILACE_FRAME) { if (v->extended_dmv) v->dmvrange = get_unary(gb, 0, 3); get_bits1(gb); v->intcomp = 0; v->mv_mode = MV_PMODE_1MV; v->fourmvswitch = 0; v->qs_last = v->s.quarter_sample; v->s.quarter_sample = 1; v->s.mspel = 1; status = bitplane_decoding(v->direct_mb_plane, &v->dmb_is_raw, v); if (status < 0) return -1; av_log(v->s.avctx, AV_LOG_DEBUG, "MB Direct Type plane encoding: " "Imode: %i, Invert: %i\n", status>>1, status&1); status = bitplane_decoding(v->s.mbskip_table, &v->skip_is_raw, v); if (status < 0) return -1; av_log(v->s.avctx, AV_LOG_DEBUG, "MB Skip plane encoding: " "Imode: %i, Invert: %i\n", status>>1, status&1); mbmodetab = get_bits(gb, 2); v->mbmode_vlc = &ff_vc1_intfr_non4mv_mbmode_vlc[mbmodetab]; imvtab = get_bits(gb, 2); v->imv_vlc = &ff_vc1_1ref_mvdata_vlc[imvtab]; icbptab = get_bits(gb, 3); v->cbpcy_vlc = &ff_vc1_icbpcy_vlc[icbptab]; twomvbptab = get_bits(gb, 2); v->twomvbp_vlc = &ff_vc1_2mv_block_pattern_vlc[twomvbptab]; fourmvbptab = get_bits(gb, 2); v->fourmvbp_vlc = &ff_vc1_4mv_block_pattern_vlc[fourmvbptab]; } else { v->mv_mode = get_bits1(gb) ? MV_PMODE_1MV : MV_PMODE_1MV_HPEL_BILIN; v->qs_last = v->s.quarter_sample; v->s.quarter_sample = (v->mv_mode == MV_PMODE_1MV); v->s.mspel = v->s.quarter_sample; status = bitplane_decoding(v->direct_mb_plane, &v->dmb_is_raw, v); if (status < 0) return -1; av_log(v->s.avctx, AV_LOG_DEBUG, "MB Direct Type plane encoding: " "Imode: %i, Invert: %i\n", status>>1, status&1); status = bitplane_decoding(v->s.mbskip_table, &v->skip_is_raw, v); if (status < 0) return -1; av_log(v->s.avctx, AV_LOG_DEBUG, "MB Skip plane encoding: " "Imode: %i, Invert: %i\n", status>>1, status&1); v->s.mv_table_index = get_bits(gb, 2); v->cbpcy_vlc = &ff_vc1_cbpcy_p_vlc[get_bits(gb, 2)]; } if (v->dquant) { av_log(v->s.avctx, AV_LOG_DEBUG, "VOP DQuant info\n"); vop_dquant_decoding(v); } v->ttfrm = 0; if (v->vstransform) { v->ttmbf = get_bits1(gb); if (v->ttmbf) { v->ttfrm = ff_vc1_ttfrm_to_tt[get_bits(gb, 2)]; } } else { v->ttmbf = 1; v->ttfrm = TT_8X8; } break; } if (v->fcm != PROGRESSIVE && !v->s.quarter_sample) { v->range_x <<= 1; v->range_y <<= 1; } v->c_ac_table_index = decode012(gb); if (v->s.pict_type == AV_PICTURE_TYPE_I || v->s.pict_type == AV_PICTURE_TYPE_BI) { v->y_ac_table_index = decode012(gb); } v->s.dc_table_index = get_bits1(gb); if ((v->s.pict_type == AV_PICTURE_TYPE_I || v->s.pict_type == AV_PICTURE_TYPE_BI) && v->dquant) { av_log(v->s.avctx, AV_LOG_DEBUG, "VOP DQuant info\n"); vop_dquant_decoding(v); } v->bi_type = 0; if (v->s.pict_type == AV_PICTURE_TYPE_BI) { v->s.pict_type = AV_PICTURE_TYPE_B; v->bi_type = 1; } return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(VC1Context *VAR_0, GetBitContext* VAR_1) { int VAR_2, VAR_3; int VAR_4; int VAR_5, VAR_6, VAR_7, VAR_8, VAR_9; int VAR_10, VAR_11, VAR_12; VAR_0->numref=0; VAR_0->p_frame_skipped = 0; if (VAR_0->second_field) { if(VAR_0->fcm!=2 || VAR_0->field_mode!=1) return -1; VAR_0->s.pict_type = (VAR_0->fptype & 1) ? AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_I; if (VAR_0->fptype & 4) VAR_0->s.pict_type = (VAR_0->fptype & 1) ? AV_PICTURE_TYPE_BI : AV_PICTURE_TYPE_B; VAR_0->s.current_picture_ptr->f.pict_type = VAR_0->s.pict_type; if (!VAR_0->pic_header_flag) goto parse_common_info; } VAR_0->field_mode = 0; if (VAR_0->interlace) { VAR_0->fcm = decode012(VAR_1); if (VAR_0->fcm) { if (VAR_0->fcm == ILACE_FIELD) VAR_0->field_mode = 1; if (!VAR_0->warn_interlaced++) av_log(VAR_0->s.avctx, AV_LOG_ERROR, "Interlaced frames/fields support is incomplete\n"); } } else { VAR_0->fcm = PROGRESSIVE; } if (VAR_0->field_mode) { VAR_0->fptype = get_bits(VAR_1, 3); VAR_0->s.pict_type = (VAR_0->fptype & 2) ? AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_I; if (VAR_0->fptype & 4) VAR_0->s.pict_type = (VAR_0->fptype & 2) ? AV_PICTURE_TYPE_BI : AV_PICTURE_TYPE_B; } else { switch (get_unary(VAR_1, 0, 4)) { case 0: VAR_0->s.pict_type = AV_PICTURE_TYPE_P; break; case 1: VAR_0->s.pict_type = AV_PICTURE_TYPE_B; break; case 2: VAR_0->s.pict_type = AV_PICTURE_TYPE_I; break; case 3: VAR_0->s.pict_type = AV_PICTURE_TYPE_BI; break; case 4: VAR_0->s.pict_type = AV_PICTURE_TYPE_P; VAR_0->p_frame_skipped = 1; break; } } if (VAR_0->tfcntrflag) skip_bits(VAR_1, 8); if (VAR_0->broadcast) { if (!VAR_0->interlace || VAR_0->psf) { VAR_0->rptfrm = get_bits(VAR_1, 2); } else { VAR_0->tff = get_bits1(VAR_1); VAR_0->rff = get_bits1(VAR_1); } } if (VAR_0->panscanflag) { av_log_missing_feature(VAR_0->s.avctx, "Pan-scan", 0); } if (VAR_0->p_frame_skipped) { return 0; } VAR_0->rnd = get_bits1(VAR_1); if (VAR_0->interlace) VAR_0->uvsamp = get_bits1(VAR_1); if(!ff_vc1_bfraction_vlc.table) return 0; if (VAR_0->field_mode) { if (!VAR_0->refdist_flag) VAR_0->refdist = 0; else if ((VAR_0->s.pict_type != AV_PICTURE_TYPE_B) && (VAR_0->s.pict_type != AV_PICTURE_TYPE_BI)) { VAR_0->refdist = get_bits(VAR_1, 2); if (VAR_0->refdist == 3) VAR_0->refdist += get_unary(VAR_1, 0, 16); } if ((VAR_0->s.pict_type == AV_PICTURE_TYPE_B) || (VAR_0->s.pict_type == AV_PICTURE_TYPE_BI)) { VAR_0->bfraction_lut_index = get_vlc2(VAR_1, ff_vc1_bfraction_vlc.table, VC1_BFRACTION_VLC_BITS, 1); VAR_0->bfraction = ff_vc1_bfraction_lut[VAR_0->bfraction_lut_index]; VAR_0->frfd = (VAR_0->bfraction * VAR_0->refdist) >> 8; VAR_0->brfd = VAR_0->refdist - VAR_0->frfd - 1; if (VAR_0->brfd < 0) VAR_0->brfd = 0; } goto parse_common_info; } if (VAR_0->fcm == PROGRESSIVE) { if (VAR_0->finterpflag) VAR_0->interpfrm = get_bits1(VAR_1); if (VAR_0->s.pict_type == AV_PICTURE_TYPE_B) { VAR_0->bfraction_lut_index = get_vlc2(VAR_1, ff_vc1_bfraction_vlc.table, VC1_BFRACTION_VLC_BITS, 1); VAR_0->bfraction = ff_vc1_bfraction_lut[VAR_0->bfraction_lut_index]; if (VAR_0->bfraction == 0) { VAR_0->s.pict_type = AV_PICTURE_TYPE_BI; } } } parse_common_info: if (VAR_0->field_mode) VAR_0->cur_field_type = !(VAR_0->tff ^ VAR_0->second_field); VAR_2 = get_bits(VAR_1, 5); if (!VAR_2) return -1; VAR_0->VAR_2 = VAR_2; if (VAR_0->quantizer_mode == QUANT_FRAME_IMPLICIT) VAR_0->pq = ff_vc1_pquant_table[0][VAR_2]; else VAR_0->pq = ff_vc1_pquant_table[1][VAR_2]; VAR_0->pquantizer = 1; if (VAR_0->quantizer_mode == QUANT_FRAME_IMPLICIT) VAR_0->pquantizer = VAR_2 < 9; if (VAR_0->quantizer_mode == QUANT_NON_UNIFORM) VAR_0->pquantizer = 0; VAR_0->VAR_2 = VAR_2; if (VAR_2 < 9) VAR_0->halfpq = get_bits1(VAR_1); else VAR_0->halfpq = 0; if (VAR_0->quantizer_mode == QUANT_FRAME_EXPLICIT) VAR_0->pquantizer = get_bits1(VAR_1); if (VAR_0->postprocflag) VAR_0->postproc = get_bits(VAR_1, 2); if (VAR_0->s.pict_type == AV_PICTURE_TYPE_I || VAR_0->s.pict_type == AV_PICTURE_TYPE_P) VAR_0->use_ic = 0; if (VAR_0->parse_only) return 0; switch (VAR_0->s.pict_type) { case AV_PICTURE_TYPE_I: case AV_PICTURE_TYPE_BI: if (VAR_0->fcm == ILACE_FRAME) { VAR_4 = bitplane_decoding(VAR_0->fieldtx_plane, &VAR_0->fieldtx_is_raw, VAR_0); if (VAR_4 < 0) return -1; av_log(VAR_0->s.avctx, AV_LOG_DEBUG, "FIELDTX plane encoding: " "Imode: %VAR_12, Invert: %VAR_12\n", VAR_4>>1, VAR_4&1); } VAR_4 = bitplane_decoding(VAR_0->acpred_plane, &VAR_0->acpred_is_raw, VAR_0); if (VAR_4 < 0) return -1; av_log(VAR_0->s.avctx, AV_LOG_DEBUG, "ACPRED plane encoding: " "Imode: %VAR_12, Invert: %VAR_12\n", VAR_4>>1, VAR_4&1); VAR_0->condover = CONDOVER_NONE; if (VAR_0->overlap && VAR_0->pq <= 8) { VAR_0->condover = decode012(VAR_1); if (VAR_0->condover == CONDOVER_SELECT) { VAR_4 = bitplane_decoding(VAR_0->over_flags_plane, &VAR_0->overflg_is_raw, VAR_0); if (VAR_4 < 0) return -1; av_log(VAR_0->s.avctx, AV_LOG_DEBUG, "CONDOVER plane encoding: " "Imode: %VAR_12, Invert: %VAR_12\n", VAR_4>>1, VAR_4&1); } } break; case AV_PICTURE_TYPE_P: if (VAR_0->field_mode) { VAR_0->numref = get_bits1(VAR_1); if (!VAR_0->numref) { VAR_0->reffield = get_bits1(VAR_1); VAR_0->ref_field_type[0] = VAR_0->reffield ^ !VAR_0->cur_field_type; } } if (VAR_0->extended_mv) VAR_0->mvrange = get_unary(VAR_1, 0, 3); else VAR_0->mvrange = 0; if (VAR_0->interlace) { if (VAR_0->extended_dmv) VAR_0->dmvrange = get_unary(VAR_1, 0, 3); else VAR_0->dmvrange = 0; if (VAR_0->fcm == ILACE_FRAME) { VAR_0->fourmvswitch = get_bits1(VAR_1); VAR_0->intcomp = get_bits1(VAR_1); if (VAR_0->intcomp) { VAR_0->lumscale = get_bits(VAR_1, 6); VAR_0->lumshift = get_bits(VAR_1, 6); INIT_LUT(VAR_0->lumscale, VAR_0->lumshift, VAR_0->luty, VAR_0->lutuv); } VAR_4 = bitplane_decoding(VAR_0->s.mbskip_table, &VAR_0->skip_is_raw, VAR_0); av_log(VAR_0->s.avctx, AV_LOG_DEBUG, "SKIPMB plane encoding: " "Imode: %VAR_12, Invert: %VAR_12\n", VAR_4>>1, VAR_4&1); VAR_5 = get_bits(VAR_1, 2); if (VAR_0->fourmvswitch) VAR_0->mbmode_vlc = &ff_vc1_intfr_4mv_mbmode_vlc[VAR_5]; else VAR_0->mbmode_vlc = &ff_vc1_intfr_non4mv_mbmode_vlc[VAR_5]; VAR_6 = get_bits(VAR_1, 2); VAR_0->imv_vlc = &ff_vc1_1ref_mvdata_vlc[VAR_6]; VAR_7 = get_bits(VAR_1, 3); VAR_0->cbpcy_vlc = &ff_vc1_icbpcy_vlc[VAR_7]; VAR_8 = get_bits(VAR_1, 2); VAR_0->twomvbp_vlc = &ff_vc1_2mv_block_pattern_vlc[VAR_8]; if (VAR_0->fourmvswitch) { VAR_9 = get_bits(VAR_1, 2); VAR_0->fourmvbp_vlc = &ff_vc1_4mv_block_pattern_vlc[VAR_9]; } } } VAR_0->k_x = VAR_0->mvrange + 9 + (VAR_0->mvrange >> 1); VAR_0->k_y = VAR_0->mvrange + 8; VAR_0->range_x = 1 << (VAR_0->k_x - 1); VAR_0->range_y = 1 << (VAR_0->k_y - 1); if (VAR_0->pq < 5) VAR_0->tt_index = 0; else if (VAR_0->pq < 13) VAR_0->tt_index = 1; else VAR_0->tt_index = 2; if (VAR_0->fcm != ILACE_FRAME) { int VAR_15; VAR_15 = get_unary(VAR_1, 1, 4); VAR_3 = (VAR_0->pq > 12) ? 0 : 1; VAR_0->mv_mode = ff_vc1_mv_pmode_table[VAR_3][VAR_15]; if (VAR_0->mv_mode == MV_PMODE_INTENSITY_COMP) { int VAR_14; VAR_14 = get_unary(VAR_1, 1, 3); VAR_0->mv_mode2 = ff_vc1_mv_pmode_table2[VAR_3][VAR_14]; if (VAR_0->field_mode) VAR_0->intcompfield = decode210(VAR_1); VAR_0->lumscale = get_bits(VAR_1, 6); VAR_0->lumshift = get_bits(VAR_1, 6); INIT_LUT(VAR_0->lumscale, VAR_0->lumshift, VAR_0->luty, VAR_0->lutuv); if ((VAR_0->field_mode) && !VAR_0->intcompfield) { VAR_0->lumscale2 = get_bits(VAR_1, 6); VAR_0->lumshift2 = get_bits(VAR_1, 6); INIT_LUT(VAR_0->lumscale2, VAR_0->lumshift2, VAR_0->luty2, VAR_0->lutuv2); } VAR_0->use_ic = 1; } VAR_0->qs_last = VAR_0->s.quarter_sample; if (VAR_0->mv_mode == MV_PMODE_1MV_HPEL || VAR_0->mv_mode == MV_PMODE_1MV_HPEL_BILIN) VAR_0->s.quarter_sample = 0; else if (VAR_0->mv_mode == MV_PMODE_INTENSITY_COMP) { if (VAR_0->mv_mode2 == MV_PMODE_1MV_HPEL || VAR_0->mv_mode2 == MV_PMODE_1MV_HPEL_BILIN) VAR_0->s.quarter_sample = 0; else VAR_0->s.quarter_sample = 1; } else VAR_0->s.quarter_sample = 1; VAR_0->s.mspel = !(VAR_0->mv_mode == MV_PMODE_1MV_HPEL_BILIN || (VAR_0->mv_mode == MV_PMODE_INTENSITY_COMP && VAR_0->mv_mode2 == MV_PMODE_1MV_HPEL_BILIN)); } if (VAR_0->fcm == PROGRESSIVE) { if ((VAR_0->mv_mode == MV_PMODE_INTENSITY_COMP && VAR_0->mv_mode2 == MV_PMODE_MIXED_MV) || VAR_0->mv_mode == MV_PMODE_MIXED_MV) { VAR_4 = bitplane_decoding(VAR_0->mv_type_mb_plane, &VAR_0->mv_type_is_raw, VAR_0); if (VAR_4 < 0) return -1; av_log(VAR_0->s.avctx, AV_LOG_DEBUG, "MB MV Type plane encoding: " "Imode: %VAR_12, Invert: %VAR_12\n", VAR_4>>1, VAR_4&1); } else { VAR_0->mv_type_is_raw = 0; memset(VAR_0->mv_type_mb_plane, 0, VAR_0->s.mb_stride * VAR_0->s.mb_height); } VAR_4 = bitplane_decoding(VAR_0->s.mbskip_table, &VAR_0->skip_is_raw, VAR_0); if (VAR_4 < 0) return -1; av_log(VAR_0->s.avctx, AV_LOG_DEBUG, "MB Skip plane encoding: " "Imode: %VAR_12, Invert: %VAR_12\n", VAR_4>>1, VAR_4&1); VAR_0->s.mv_table_index = get_bits(VAR_1, 2); VAR_0->cbpcy_vlc = &ff_vc1_cbpcy_p_vlc[get_bits(VAR_1, 2)]; } else if (VAR_0->fcm == ILACE_FRAME) { VAR_0->qs_last = VAR_0->s.quarter_sample; VAR_0->s.quarter_sample = 1; VAR_0->s.mspel = 1; } else { VAR_5 = get_bits(VAR_1, 3); VAR_6 = get_bits(VAR_1, 2 + VAR_0->numref); if (!VAR_0->numref) VAR_0->imv_vlc = &ff_vc1_1ref_mvdata_vlc[VAR_6]; else VAR_0->imv_vlc = &ff_vc1_2ref_mvdata_vlc[VAR_6]; VAR_7 = get_bits(VAR_1, 3); VAR_0->cbpcy_vlc = &ff_vc1_icbpcy_vlc[VAR_7]; if ((VAR_0->mv_mode == MV_PMODE_INTENSITY_COMP && VAR_0->mv_mode2 == MV_PMODE_MIXED_MV) || VAR_0->mv_mode == MV_PMODE_MIXED_MV) { VAR_9 = get_bits(VAR_1, 2); VAR_0->fourmvbp_vlc = &ff_vc1_4mv_block_pattern_vlc[VAR_9]; VAR_0->mbmode_vlc = &ff_vc1_if_mmv_mbmode_vlc[VAR_5]; } else { VAR_0->mbmode_vlc = &ff_vc1_if_1mv_mbmode_vlc[VAR_5]; } } if (VAR_0->dquant) { av_log(VAR_0->s.avctx, AV_LOG_DEBUG, "VOP DQuant info\n"); vop_dquant_decoding(VAR_0); } VAR_0->ttfrm = 0; if (VAR_0->vstransform) { VAR_0->ttmbf = get_bits1(VAR_1); if (VAR_0->ttmbf) { VAR_0->ttfrm = ff_vc1_ttfrm_to_tt[get_bits(VAR_1, 2)]; } } else { VAR_0->ttmbf = 1; VAR_0->ttfrm = TT_8X8; } break; case AV_PICTURE_TYPE_B: if (VAR_0->fcm == ILACE_FRAME) { VAR_0->bfraction_lut_index = get_vlc2(VAR_1, ff_vc1_bfraction_vlc.table, VC1_BFRACTION_VLC_BITS, 1); VAR_0->bfraction = ff_vc1_bfraction_lut[VAR_0->bfraction_lut_index]; if (VAR_0->bfraction == 0) { return -1; } } if (VAR_0->extended_mv) VAR_0->mvrange = get_unary(VAR_1, 0, 3); else VAR_0->mvrange = 0; VAR_0->k_x = VAR_0->mvrange + 9 + (VAR_0->mvrange >> 1); VAR_0->k_y = VAR_0->mvrange + 8; VAR_0->range_x = 1 << (VAR_0->k_x - 1); VAR_0->range_y = 1 << (VAR_0->k_y - 1); if (VAR_0->pq < 5) VAR_0->tt_index = 0; else if (VAR_0->pq < 13) VAR_0->tt_index = 1; else VAR_0->tt_index = 2; if (VAR_0->field_mode) { int VAR_15; av_log(VAR_0->s.avctx, AV_LOG_DEBUG, "B Fields\n"); if (VAR_0->extended_dmv) VAR_0->dmvrange = get_unary(VAR_1, 0, 3); VAR_15 = get_unary(VAR_1, 1, 3); VAR_3 = (VAR_0->pq > 12) ? 0 : 1; VAR_0->mv_mode = ff_vc1_mv_pmode_table2[VAR_3][VAR_15]; VAR_0->qs_last = VAR_0->s.quarter_sample; VAR_0->s.quarter_sample = (VAR_0->mv_mode == MV_PMODE_1MV || VAR_0->mv_mode == MV_PMODE_MIXED_MV); VAR_0->s.mspel = !(VAR_0->mv_mode == MV_PMODE_1MV_HPEL_BILIN || VAR_0->mv_mode == MV_PMODE_1MV_HPEL); VAR_4 = bitplane_decoding(VAR_0->forward_mb_plane, &VAR_0->fmb_is_raw, VAR_0); if (VAR_4 < 0) return -1; av_log(VAR_0->s.avctx, AV_LOG_DEBUG, "MB Forward Type plane encoding: " "Imode: %VAR_12, Invert: %VAR_12\n", VAR_4>>1, VAR_4&1); VAR_5 = get_bits(VAR_1, 3); if (VAR_0->mv_mode == MV_PMODE_MIXED_MV) VAR_0->mbmode_vlc = &ff_vc1_if_mmv_mbmode_vlc[VAR_5]; else VAR_0->mbmode_vlc = &ff_vc1_if_1mv_mbmode_vlc[VAR_5]; VAR_6 = get_bits(VAR_1, 3); VAR_0->imv_vlc = &ff_vc1_2ref_mvdata_vlc[VAR_6]; VAR_7 = get_bits(VAR_1, 3); VAR_0->cbpcy_vlc = &ff_vc1_icbpcy_vlc[VAR_7]; if (VAR_0->mv_mode == MV_PMODE_MIXED_MV) { VAR_9 = get_bits(VAR_1, 2); VAR_0->fourmvbp_vlc = &ff_vc1_4mv_block_pattern_vlc[VAR_9]; } VAR_0->numref = 1; } else if (VAR_0->fcm == ILACE_FRAME) { if (VAR_0->extended_dmv) VAR_0->dmvrange = get_unary(VAR_1, 0, 3); get_bits1(VAR_1); VAR_0->intcomp = 0; VAR_0->mv_mode = MV_PMODE_1MV; VAR_0->fourmvswitch = 0; VAR_0->qs_last = VAR_0->s.quarter_sample; VAR_0->s.quarter_sample = 1; VAR_0->s.mspel = 1; VAR_4 = bitplane_decoding(VAR_0->direct_mb_plane, &VAR_0->dmb_is_raw, VAR_0); if (VAR_4 < 0) return -1; av_log(VAR_0->s.avctx, AV_LOG_DEBUG, "MB Direct Type plane encoding: " "Imode: %VAR_12, Invert: %VAR_12\n", VAR_4>>1, VAR_4&1); VAR_4 = bitplane_decoding(VAR_0->s.mbskip_table, &VAR_0->skip_is_raw, VAR_0); if (VAR_4 < 0) return -1; av_log(VAR_0->s.avctx, AV_LOG_DEBUG, "MB Skip plane encoding: " "Imode: %VAR_12, Invert: %VAR_12\n", VAR_4>>1, VAR_4&1); VAR_5 = get_bits(VAR_1, 2); VAR_0->mbmode_vlc = &ff_vc1_intfr_non4mv_mbmode_vlc[VAR_5]; VAR_6 = get_bits(VAR_1, 2); VAR_0->imv_vlc = &ff_vc1_1ref_mvdata_vlc[VAR_6]; VAR_7 = get_bits(VAR_1, 3); VAR_0->cbpcy_vlc = &ff_vc1_icbpcy_vlc[VAR_7]; VAR_8 = get_bits(VAR_1, 2); VAR_0->twomvbp_vlc = &ff_vc1_2mv_block_pattern_vlc[VAR_8]; VAR_9 = get_bits(VAR_1, 2); VAR_0->fourmvbp_vlc = &ff_vc1_4mv_block_pattern_vlc[VAR_9]; } else { VAR_0->mv_mode = get_bits1(VAR_1) ? MV_PMODE_1MV : MV_PMODE_1MV_HPEL_BILIN; VAR_0->qs_last = VAR_0->s.quarter_sample; VAR_0->s.quarter_sample = (VAR_0->mv_mode == MV_PMODE_1MV); VAR_0->s.mspel = VAR_0->s.quarter_sample; VAR_4 = bitplane_decoding(VAR_0->direct_mb_plane, &VAR_0->dmb_is_raw, VAR_0); if (VAR_4 < 0) return -1; av_log(VAR_0->s.avctx, AV_LOG_DEBUG, "MB Direct Type plane encoding: " "Imode: %VAR_12, Invert: %VAR_12\n", VAR_4>>1, VAR_4&1); VAR_4 = bitplane_decoding(VAR_0->s.mbskip_table, &VAR_0->skip_is_raw, VAR_0); if (VAR_4 < 0) return -1; av_log(VAR_0->s.avctx, AV_LOG_DEBUG, "MB Skip plane encoding: " "Imode: %VAR_12, Invert: %VAR_12\n", VAR_4>>1, VAR_4&1); VAR_0->s.mv_table_index = get_bits(VAR_1, 2); VAR_0->cbpcy_vlc = &ff_vc1_cbpcy_p_vlc[get_bits(VAR_1, 2)]; } if (VAR_0->dquant) { av_log(VAR_0->s.avctx, AV_LOG_DEBUG, "VOP DQuant info\n"); vop_dquant_decoding(VAR_0); } VAR_0->ttfrm = 0; if (VAR_0->vstransform) { VAR_0->ttmbf = get_bits1(VAR_1); if (VAR_0->ttmbf) { VAR_0->ttfrm = ff_vc1_ttfrm_to_tt[get_bits(VAR_1, 2)]; } } else { VAR_0->ttmbf = 1; VAR_0->ttfrm = TT_8X8; } break; } if (VAR_0->fcm != PROGRESSIVE && !VAR_0->s.quarter_sample) { VAR_0->range_x <<= 1; VAR_0->range_y <<= 1; } VAR_0->c_ac_table_index = decode012(VAR_1); if (VAR_0->s.pict_type == AV_PICTURE_TYPE_I || VAR_0->s.pict_type == AV_PICTURE_TYPE_BI) { VAR_0->y_ac_table_index = decode012(VAR_1); } VAR_0->s.dc_table_index = get_bits1(VAR_1); if ((VAR_0->s.pict_type == AV_PICTURE_TYPE_I || VAR_0->s.pict_type == AV_PICTURE_TYPE_BI) && VAR_0->dquant) { av_log(VAR_0->s.avctx, AV_LOG_DEBUG, "VOP DQuant info\n"); vop_dquant_decoding(VAR_0); } VAR_0->bi_type = 0; if (VAR_0->s.pict_type == AV_PICTURE_TYPE_BI) { VAR_0->s.pict_type = AV_PICTURE_TYPE_B; VAR_0->bi_type = 1; } return 0; }
[ "int FUNC_0(VC1Context *VAR_0, GetBitContext* VAR_1)\n{", "int VAR_2, VAR_3;", "int VAR_4;", "int VAR_5, VAR_6, VAR_7, VAR_8, VAR_9;", "int VAR_10, VAR_11, VAR_12;", "VAR_0->numref=0;", "VAR_0->p_frame_skipped = 0;", "if (VAR_0->second_field) {", "if(VAR_0->fcm!=2 || VAR_0->field_mode!=1)\nreturn -1;", "VAR_0->s.pict_type = (VAR_0->fptype & 1) ? AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_I;", "if (VAR_0->fptype & 4)\nVAR_0->s.pict_type = (VAR_0->fptype & 1) ? AV_PICTURE_TYPE_BI : AV_PICTURE_TYPE_B;", "VAR_0->s.current_picture_ptr->f.pict_type = VAR_0->s.pict_type;", "if (!VAR_0->pic_header_flag)\ngoto parse_common_info;", "}", "VAR_0->field_mode = 0;", "if (VAR_0->interlace) {", "VAR_0->fcm = decode012(VAR_1);", "if (VAR_0->fcm) {", "if (VAR_0->fcm == ILACE_FIELD)\nVAR_0->field_mode = 1;", "if (!VAR_0->warn_interlaced++)\nav_log(VAR_0->s.avctx, AV_LOG_ERROR,\n\"Interlaced frames/fields support is incomplete\\n\");", "}", "} else {", "VAR_0->fcm = PROGRESSIVE;", "}", "if (VAR_0->field_mode) {", "VAR_0->fptype = get_bits(VAR_1, 3);", "VAR_0->s.pict_type = (VAR_0->fptype & 2) ? AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_I;", "if (VAR_0->fptype & 4)\nVAR_0->s.pict_type = (VAR_0->fptype & 2) ? AV_PICTURE_TYPE_BI : AV_PICTURE_TYPE_B;", "} else {", "switch (get_unary(VAR_1, 0, 4)) {", "case 0:\nVAR_0->s.pict_type = AV_PICTURE_TYPE_P;", "break;", "case 1:\nVAR_0->s.pict_type = AV_PICTURE_TYPE_B;", "break;", "case 2:\nVAR_0->s.pict_type = AV_PICTURE_TYPE_I;", "break;", "case 3:\nVAR_0->s.pict_type = AV_PICTURE_TYPE_BI;", "break;", "case 4:\nVAR_0->s.pict_type = AV_PICTURE_TYPE_P;", "VAR_0->p_frame_skipped = 1;", "break;", "}", "}", "if (VAR_0->tfcntrflag)\nskip_bits(VAR_1, 8);", "if (VAR_0->broadcast) {", "if (!VAR_0->interlace || VAR_0->psf) {", "VAR_0->rptfrm = get_bits(VAR_1, 2);", "} else {", "VAR_0->tff = get_bits1(VAR_1);", "VAR_0->rff = get_bits1(VAR_1);", "}", "}", "if (VAR_0->panscanflag) {", "av_log_missing_feature(VAR_0->s.avctx, \"Pan-scan\", 0);", "}", "if (VAR_0->p_frame_skipped) {", "return 0;", "}", "VAR_0->rnd = get_bits1(VAR_1);", "if (VAR_0->interlace)\nVAR_0->uvsamp = get_bits1(VAR_1);", "if(!ff_vc1_bfraction_vlc.table)\nreturn 0;", "if (VAR_0->field_mode) {", "if (!VAR_0->refdist_flag)\nVAR_0->refdist = 0;", "else if ((VAR_0->s.pict_type != AV_PICTURE_TYPE_B) && (VAR_0->s.pict_type != AV_PICTURE_TYPE_BI)) {", "VAR_0->refdist = get_bits(VAR_1, 2);", "if (VAR_0->refdist == 3)\nVAR_0->refdist += get_unary(VAR_1, 0, 16);", "}", "if ((VAR_0->s.pict_type == AV_PICTURE_TYPE_B) || (VAR_0->s.pict_type == AV_PICTURE_TYPE_BI)) {", "VAR_0->bfraction_lut_index = get_vlc2(VAR_1, ff_vc1_bfraction_vlc.table, VC1_BFRACTION_VLC_BITS, 1);", "VAR_0->bfraction = ff_vc1_bfraction_lut[VAR_0->bfraction_lut_index];", "VAR_0->frfd = (VAR_0->bfraction * VAR_0->refdist) >> 8;", "VAR_0->brfd = VAR_0->refdist - VAR_0->frfd - 1;", "if (VAR_0->brfd < 0)\nVAR_0->brfd = 0;", "}", "goto parse_common_info;", "}", "if (VAR_0->fcm == PROGRESSIVE) {", "if (VAR_0->finterpflag)\nVAR_0->interpfrm = get_bits1(VAR_1);", "if (VAR_0->s.pict_type == AV_PICTURE_TYPE_B) {", "VAR_0->bfraction_lut_index = get_vlc2(VAR_1, ff_vc1_bfraction_vlc.table, VC1_BFRACTION_VLC_BITS, 1);", "VAR_0->bfraction = ff_vc1_bfraction_lut[VAR_0->bfraction_lut_index];", "if (VAR_0->bfraction == 0) {", "VAR_0->s.pict_type = AV_PICTURE_TYPE_BI;", "}", "}", "}", "parse_common_info:\nif (VAR_0->field_mode)\nVAR_0->cur_field_type = !(VAR_0->tff ^ VAR_0->second_field);", "VAR_2 = get_bits(VAR_1, 5);", "if (!VAR_2)\nreturn -1;", "VAR_0->VAR_2 = VAR_2;", "if (VAR_0->quantizer_mode == QUANT_FRAME_IMPLICIT)\nVAR_0->pq = ff_vc1_pquant_table[0][VAR_2];", "else\nVAR_0->pq = ff_vc1_pquant_table[1][VAR_2];", "VAR_0->pquantizer = 1;", "if (VAR_0->quantizer_mode == QUANT_FRAME_IMPLICIT)\nVAR_0->pquantizer = VAR_2 < 9;", "if (VAR_0->quantizer_mode == QUANT_NON_UNIFORM)\nVAR_0->pquantizer = 0;", "VAR_0->VAR_2 = VAR_2;", "if (VAR_2 < 9)\nVAR_0->halfpq = get_bits1(VAR_1);", "else\nVAR_0->halfpq = 0;", "if (VAR_0->quantizer_mode == QUANT_FRAME_EXPLICIT)\nVAR_0->pquantizer = get_bits1(VAR_1);", "if (VAR_0->postprocflag)\nVAR_0->postproc = get_bits(VAR_1, 2);", "if (VAR_0->s.pict_type == AV_PICTURE_TYPE_I || VAR_0->s.pict_type == AV_PICTURE_TYPE_P)\nVAR_0->use_ic = 0;", "if (VAR_0->parse_only)\nreturn 0;", "switch (VAR_0->s.pict_type) {", "case AV_PICTURE_TYPE_I:\ncase AV_PICTURE_TYPE_BI:\nif (VAR_0->fcm == ILACE_FRAME) {", "VAR_4 = bitplane_decoding(VAR_0->fieldtx_plane, &VAR_0->fieldtx_is_raw, VAR_0);", "if (VAR_4 < 0)\nreturn -1;", "av_log(VAR_0->s.avctx, AV_LOG_DEBUG, \"FIELDTX plane encoding: \"\n\"Imode: %VAR_12, Invert: %VAR_12\\n\", VAR_4>>1, VAR_4&1);", "}", "VAR_4 = bitplane_decoding(VAR_0->acpred_plane, &VAR_0->acpred_is_raw, VAR_0);", "if (VAR_4 < 0)\nreturn -1;", "av_log(VAR_0->s.avctx, AV_LOG_DEBUG, \"ACPRED plane encoding: \"\n\"Imode: %VAR_12, Invert: %VAR_12\\n\", VAR_4>>1, VAR_4&1);", "VAR_0->condover = CONDOVER_NONE;", "if (VAR_0->overlap && VAR_0->pq <= 8) {", "VAR_0->condover = decode012(VAR_1);", "if (VAR_0->condover == CONDOVER_SELECT) {", "VAR_4 = bitplane_decoding(VAR_0->over_flags_plane, &VAR_0->overflg_is_raw, VAR_0);", "if (VAR_4 < 0)\nreturn -1;", "av_log(VAR_0->s.avctx, AV_LOG_DEBUG, \"CONDOVER plane encoding: \"\n\"Imode: %VAR_12, Invert: %VAR_12\\n\", VAR_4>>1, VAR_4&1);", "}", "}", "break;", "case AV_PICTURE_TYPE_P:\nif (VAR_0->field_mode) {", "VAR_0->numref = get_bits1(VAR_1);", "if (!VAR_0->numref) {", "VAR_0->reffield = get_bits1(VAR_1);", "VAR_0->ref_field_type[0] = VAR_0->reffield ^ !VAR_0->cur_field_type;", "}", "}", "if (VAR_0->extended_mv)\nVAR_0->mvrange = get_unary(VAR_1, 0, 3);", "else\nVAR_0->mvrange = 0;", "if (VAR_0->interlace) {", "if (VAR_0->extended_dmv)\nVAR_0->dmvrange = get_unary(VAR_1, 0, 3);", "else\nVAR_0->dmvrange = 0;", "if (VAR_0->fcm == ILACE_FRAME) {", "VAR_0->fourmvswitch = get_bits1(VAR_1);", "VAR_0->intcomp = get_bits1(VAR_1);", "if (VAR_0->intcomp) {", "VAR_0->lumscale = get_bits(VAR_1, 6);", "VAR_0->lumshift = get_bits(VAR_1, 6);", "INIT_LUT(VAR_0->lumscale, VAR_0->lumshift, VAR_0->luty, VAR_0->lutuv);", "}", "VAR_4 = bitplane_decoding(VAR_0->s.mbskip_table, &VAR_0->skip_is_raw, VAR_0);", "av_log(VAR_0->s.avctx, AV_LOG_DEBUG, \"SKIPMB plane encoding: \"\n\"Imode: %VAR_12, Invert: %VAR_12\\n\", VAR_4>>1, VAR_4&1);", "VAR_5 = get_bits(VAR_1, 2);", "if (VAR_0->fourmvswitch)\nVAR_0->mbmode_vlc = &ff_vc1_intfr_4mv_mbmode_vlc[VAR_5];", "else\nVAR_0->mbmode_vlc = &ff_vc1_intfr_non4mv_mbmode_vlc[VAR_5];", "VAR_6 = get_bits(VAR_1, 2);", "VAR_0->imv_vlc = &ff_vc1_1ref_mvdata_vlc[VAR_6];", "VAR_7 = get_bits(VAR_1, 3);", "VAR_0->cbpcy_vlc = &ff_vc1_icbpcy_vlc[VAR_7];", "VAR_8 = get_bits(VAR_1, 2);", "VAR_0->twomvbp_vlc = &ff_vc1_2mv_block_pattern_vlc[VAR_8];", "if (VAR_0->fourmvswitch) {", "VAR_9 = get_bits(VAR_1, 2);", "VAR_0->fourmvbp_vlc = &ff_vc1_4mv_block_pattern_vlc[VAR_9];", "}", "}", "}", "VAR_0->k_x = VAR_0->mvrange + 9 + (VAR_0->mvrange >> 1);", "VAR_0->k_y = VAR_0->mvrange + 8;", "VAR_0->range_x = 1 << (VAR_0->k_x - 1);", "VAR_0->range_y = 1 << (VAR_0->k_y - 1);", "if (VAR_0->pq < 5)\nVAR_0->tt_index = 0;", "else if (VAR_0->pq < 13)\nVAR_0->tt_index = 1;", "else\nVAR_0->tt_index = 2;", "if (VAR_0->fcm != ILACE_FRAME) {", "int VAR_15;", "VAR_15 = get_unary(VAR_1, 1, 4);", "VAR_3 = (VAR_0->pq > 12) ? 0 : 1;", "VAR_0->mv_mode = ff_vc1_mv_pmode_table[VAR_3][VAR_15];", "if (VAR_0->mv_mode == MV_PMODE_INTENSITY_COMP) {", "int VAR_14;", "VAR_14 = get_unary(VAR_1, 1, 3);", "VAR_0->mv_mode2 = ff_vc1_mv_pmode_table2[VAR_3][VAR_14];", "if (VAR_0->field_mode)\nVAR_0->intcompfield = decode210(VAR_1);", "VAR_0->lumscale = get_bits(VAR_1, 6);", "VAR_0->lumshift = get_bits(VAR_1, 6);", "INIT_LUT(VAR_0->lumscale, VAR_0->lumshift, VAR_0->luty, VAR_0->lutuv);", "if ((VAR_0->field_mode) && !VAR_0->intcompfield) {", "VAR_0->lumscale2 = get_bits(VAR_1, 6);", "VAR_0->lumshift2 = get_bits(VAR_1, 6);", "INIT_LUT(VAR_0->lumscale2, VAR_0->lumshift2, VAR_0->luty2, VAR_0->lutuv2);", "}", "VAR_0->use_ic = 1;", "}", "VAR_0->qs_last = VAR_0->s.quarter_sample;", "if (VAR_0->mv_mode == MV_PMODE_1MV_HPEL || VAR_0->mv_mode == MV_PMODE_1MV_HPEL_BILIN)\nVAR_0->s.quarter_sample = 0;", "else if (VAR_0->mv_mode == MV_PMODE_INTENSITY_COMP) {", "if (VAR_0->mv_mode2 == MV_PMODE_1MV_HPEL || VAR_0->mv_mode2 == MV_PMODE_1MV_HPEL_BILIN)\nVAR_0->s.quarter_sample = 0;", "else\nVAR_0->s.quarter_sample = 1;", "} else", "VAR_0->s.quarter_sample = 1;", "VAR_0->s.mspel = !(VAR_0->mv_mode == MV_PMODE_1MV_HPEL_BILIN\n|| (VAR_0->mv_mode == MV_PMODE_INTENSITY_COMP\n&& VAR_0->mv_mode2 == MV_PMODE_1MV_HPEL_BILIN));", "}", "if (VAR_0->fcm == PROGRESSIVE) {", "if ((VAR_0->mv_mode == MV_PMODE_INTENSITY_COMP &&\nVAR_0->mv_mode2 == MV_PMODE_MIXED_MV)\n|| VAR_0->mv_mode == MV_PMODE_MIXED_MV) {", "VAR_4 = bitplane_decoding(VAR_0->mv_type_mb_plane, &VAR_0->mv_type_is_raw, VAR_0);", "if (VAR_4 < 0)\nreturn -1;", "av_log(VAR_0->s.avctx, AV_LOG_DEBUG, \"MB MV Type plane encoding: \"\n\"Imode: %VAR_12, Invert: %VAR_12\\n\", VAR_4>>1, VAR_4&1);", "} else {", "VAR_0->mv_type_is_raw = 0;", "memset(VAR_0->mv_type_mb_plane, 0, VAR_0->s.mb_stride * VAR_0->s.mb_height);", "}", "VAR_4 = bitplane_decoding(VAR_0->s.mbskip_table, &VAR_0->skip_is_raw, VAR_0);", "if (VAR_4 < 0)\nreturn -1;", "av_log(VAR_0->s.avctx, AV_LOG_DEBUG, \"MB Skip plane encoding: \"\n\"Imode: %VAR_12, Invert: %VAR_12\\n\", VAR_4>>1, VAR_4&1);", "VAR_0->s.mv_table_index = get_bits(VAR_1, 2);", "VAR_0->cbpcy_vlc = &ff_vc1_cbpcy_p_vlc[get_bits(VAR_1, 2)];", "} else if (VAR_0->fcm == ILACE_FRAME) {", "VAR_0->qs_last = VAR_0->s.quarter_sample;", "VAR_0->s.quarter_sample = 1;", "VAR_0->s.mspel = 1;", "} else {", "VAR_5 = get_bits(VAR_1, 3);", "VAR_6 = get_bits(VAR_1, 2 + VAR_0->numref);", "if (!VAR_0->numref)\nVAR_0->imv_vlc = &ff_vc1_1ref_mvdata_vlc[VAR_6];", "else\nVAR_0->imv_vlc = &ff_vc1_2ref_mvdata_vlc[VAR_6];", "VAR_7 = get_bits(VAR_1, 3);", "VAR_0->cbpcy_vlc = &ff_vc1_icbpcy_vlc[VAR_7];", "if ((VAR_0->mv_mode == MV_PMODE_INTENSITY_COMP &&\nVAR_0->mv_mode2 == MV_PMODE_MIXED_MV) || VAR_0->mv_mode == MV_PMODE_MIXED_MV) {", "VAR_9 = get_bits(VAR_1, 2);", "VAR_0->fourmvbp_vlc = &ff_vc1_4mv_block_pattern_vlc[VAR_9];", "VAR_0->mbmode_vlc = &ff_vc1_if_mmv_mbmode_vlc[VAR_5];", "} else {", "VAR_0->mbmode_vlc = &ff_vc1_if_1mv_mbmode_vlc[VAR_5];", "}", "}", "if (VAR_0->dquant) {", "av_log(VAR_0->s.avctx, AV_LOG_DEBUG, \"VOP DQuant info\\n\");", "vop_dquant_decoding(VAR_0);", "}", "VAR_0->ttfrm = 0;", "if (VAR_0->vstransform) {", "VAR_0->ttmbf = get_bits1(VAR_1);", "if (VAR_0->ttmbf) {", "VAR_0->ttfrm = ff_vc1_ttfrm_to_tt[get_bits(VAR_1, 2)];", "}", "} else {", "VAR_0->ttmbf = 1;", "VAR_0->ttfrm = TT_8X8;", "}", "break;", "case AV_PICTURE_TYPE_B:\nif (VAR_0->fcm == ILACE_FRAME) {", "VAR_0->bfraction_lut_index = get_vlc2(VAR_1, ff_vc1_bfraction_vlc.table, VC1_BFRACTION_VLC_BITS, 1);", "VAR_0->bfraction = ff_vc1_bfraction_lut[VAR_0->bfraction_lut_index];", "if (VAR_0->bfraction == 0) {", "return -1;", "}", "}", "if (VAR_0->extended_mv)\nVAR_0->mvrange = get_unary(VAR_1, 0, 3);", "else\nVAR_0->mvrange = 0;", "VAR_0->k_x = VAR_0->mvrange + 9 + (VAR_0->mvrange >> 1);", "VAR_0->k_y = VAR_0->mvrange + 8;", "VAR_0->range_x = 1 << (VAR_0->k_x - 1);", "VAR_0->range_y = 1 << (VAR_0->k_y - 1);", "if (VAR_0->pq < 5)\nVAR_0->tt_index = 0;", "else if (VAR_0->pq < 13)\nVAR_0->tt_index = 1;", "else\nVAR_0->tt_index = 2;", "if (VAR_0->field_mode) {", "int VAR_15;", "av_log(VAR_0->s.avctx, AV_LOG_DEBUG, \"B Fields\\n\");", "if (VAR_0->extended_dmv)\nVAR_0->dmvrange = get_unary(VAR_1, 0, 3);", "VAR_15 = get_unary(VAR_1, 1, 3);", "VAR_3 = (VAR_0->pq > 12) ? 0 : 1;", "VAR_0->mv_mode = ff_vc1_mv_pmode_table2[VAR_3][VAR_15];", "VAR_0->qs_last = VAR_0->s.quarter_sample;", "VAR_0->s.quarter_sample = (VAR_0->mv_mode == MV_PMODE_1MV || VAR_0->mv_mode == MV_PMODE_MIXED_MV);", "VAR_0->s.mspel = !(VAR_0->mv_mode == MV_PMODE_1MV_HPEL_BILIN || VAR_0->mv_mode == MV_PMODE_1MV_HPEL);", "VAR_4 = bitplane_decoding(VAR_0->forward_mb_plane, &VAR_0->fmb_is_raw, VAR_0);", "if (VAR_4 < 0)\nreturn -1;", "av_log(VAR_0->s.avctx, AV_LOG_DEBUG, \"MB Forward Type plane encoding: \"\n\"Imode: %VAR_12, Invert: %VAR_12\\n\", VAR_4>>1, VAR_4&1);", "VAR_5 = get_bits(VAR_1, 3);", "if (VAR_0->mv_mode == MV_PMODE_MIXED_MV)\nVAR_0->mbmode_vlc = &ff_vc1_if_mmv_mbmode_vlc[VAR_5];", "else\nVAR_0->mbmode_vlc = &ff_vc1_if_1mv_mbmode_vlc[VAR_5];", "VAR_6 = get_bits(VAR_1, 3);", "VAR_0->imv_vlc = &ff_vc1_2ref_mvdata_vlc[VAR_6];", "VAR_7 = get_bits(VAR_1, 3);", "VAR_0->cbpcy_vlc = &ff_vc1_icbpcy_vlc[VAR_7];", "if (VAR_0->mv_mode == MV_PMODE_MIXED_MV) {", "VAR_9 = get_bits(VAR_1, 2);", "VAR_0->fourmvbp_vlc = &ff_vc1_4mv_block_pattern_vlc[VAR_9];", "}", "VAR_0->numref = 1;", "} else if (VAR_0->fcm == ILACE_FRAME) {", "if (VAR_0->extended_dmv)\nVAR_0->dmvrange = get_unary(VAR_1, 0, 3);", "get_bits1(VAR_1);", "VAR_0->intcomp = 0;", "VAR_0->mv_mode = MV_PMODE_1MV;", "VAR_0->fourmvswitch = 0;", "VAR_0->qs_last = VAR_0->s.quarter_sample;", "VAR_0->s.quarter_sample = 1;", "VAR_0->s.mspel = 1;", "VAR_4 = bitplane_decoding(VAR_0->direct_mb_plane, &VAR_0->dmb_is_raw, VAR_0);", "if (VAR_4 < 0)\nreturn -1;", "av_log(VAR_0->s.avctx, AV_LOG_DEBUG, \"MB Direct Type plane encoding: \"\n\"Imode: %VAR_12, Invert: %VAR_12\\n\", VAR_4>>1, VAR_4&1);", "VAR_4 = bitplane_decoding(VAR_0->s.mbskip_table, &VAR_0->skip_is_raw, VAR_0);", "if (VAR_4 < 0)\nreturn -1;", "av_log(VAR_0->s.avctx, AV_LOG_DEBUG, \"MB Skip plane encoding: \"\n\"Imode: %VAR_12, Invert: %VAR_12\\n\", VAR_4>>1, VAR_4&1);", "VAR_5 = get_bits(VAR_1, 2);", "VAR_0->mbmode_vlc = &ff_vc1_intfr_non4mv_mbmode_vlc[VAR_5];", "VAR_6 = get_bits(VAR_1, 2);", "VAR_0->imv_vlc = &ff_vc1_1ref_mvdata_vlc[VAR_6];", "VAR_7 = get_bits(VAR_1, 3);", "VAR_0->cbpcy_vlc = &ff_vc1_icbpcy_vlc[VAR_7];", "VAR_8 = get_bits(VAR_1, 2);", "VAR_0->twomvbp_vlc = &ff_vc1_2mv_block_pattern_vlc[VAR_8];", "VAR_9 = get_bits(VAR_1, 2);", "VAR_0->fourmvbp_vlc = &ff_vc1_4mv_block_pattern_vlc[VAR_9];", "} else {", "VAR_0->mv_mode = get_bits1(VAR_1) ? MV_PMODE_1MV : MV_PMODE_1MV_HPEL_BILIN;", "VAR_0->qs_last = VAR_0->s.quarter_sample;", "VAR_0->s.quarter_sample = (VAR_0->mv_mode == MV_PMODE_1MV);", "VAR_0->s.mspel = VAR_0->s.quarter_sample;", "VAR_4 = bitplane_decoding(VAR_0->direct_mb_plane, &VAR_0->dmb_is_raw, VAR_0);", "if (VAR_4 < 0)\nreturn -1;", "av_log(VAR_0->s.avctx, AV_LOG_DEBUG, \"MB Direct Type plane encoding: \"\n\"Imode: %VAR_12, Invert: %VAR_12\\n\", VAR_4>>1, VAR_4&1);", "VAR_4 = bitplane_decoding(VAR_0->s.mbskip_table, &VAR_0->skip_is_raw, VAR_0);", "if (VAR_4 < 0)\nreturn -1;", "av_log(VAR_0->s.avctx, AV_LOG_DEBUG, \"MB Skip plane encoding: \"\n\"Imode: %VAR_12, Invert: %VAR_12\\n\", VAR_4>>1, VAR_4&1);", "VAR_0->s.mv_table_index = get_bits(VAR_1, 2);", "VAR_0->cbpcy_vlc = &ff_vc1_cbpcy_p_vlc[get_bits(VAR_1, 2)];", "}", "if (VAR_0->dquant) {", "av_log(VAR_0->s.avctx, AV_LOG_DEBUG, \"VOP DQuant info\\n\");", "vop_dquant_decoding(VAR_0);", "}", "VAR_0->ttfrm = 0;", "if (VAR_0->vstransform) {", "VAR_0->ttmbf = get_bits1(VAR_1);", "if (VAR_0->ttmbf) {", "VAR_0->ttfrm = ff_vc1_ttfrm_to_tt[get_bits(VAR_1, 2)];", "}", "} else {", "VAR_0->ttmbf = 1;", "VAR_0->ttfrm = TT_8X8;", "}", "break;", "}", "if (VAR_0->fcm != PROGRESSIVE && !VAR_0->s.quarter_sample) {", "VAR_0->range_x <<= 1;", "VAR_0->range_y <<= 1;", "}", "VAR_0->c_ac_table_index = decode012(VAR_1);", "if (VAR_0->s.pict_type == AV_PICTURE_TYPE_I || VAR_0->s.pict_type == AV_PICTURE_TYPE_BI) {", "VAR_0->y_ac_table_index = decode012(VAR_1);", "}", "VAR_0->s.dc_table_index = get_bits1(VAR_1);", "if ((VAR_0->s.pict_type == AV_PICTURE_TYPE_I || VAR_0->s.pict_type == AV_PICTURE_TYPE_BI)\n&& VAR_0->dquant) {", "av_log(VAR_0->s.avctx, AV_LOG_DEBUG, \"VOP DQuant info\\n\");", "vop_dquant_decoding(VAR_0);", "}", "VAR_0->bi_type = 0;", "if (VAR_0->s.pict_type == AV_PICTURE_TYPE_BI) {", "VAR_0->s.pict_type = AV_PICTURE_TYPE_B;", "VAR_0->bi_type = 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21, 23 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49, 51 ], [ 53, 55, 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ], [ 73 ], [ 75, 77 ], [ 79 ], [ 81 ], [ 83, 85 ], [ 87 ], [ 89, 91 ], [ 93 ], [ 95, 97 ], [ 99 ], [ 101, 103 ], [ 105 ], [ 107, 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119, 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 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 ], [ 223, 225, 227 ], [ 229 ], [ 231, 233 ], [ 235 ], [ 237, 239 ], [ 241, 243 ], [ 247 ], [ 249, 251 ], [ 253, 255 ], [ 257 ], [ 259, 261 ], [ 263, 265 ], [ 267, 269 ], [ 271, 273 ], [ 277, 279 ], [ 283, 285 ], [ 289 ], [ 291, 293, 295 ], [ 297 ], [ 299, 301 ], [ 303, 305 ], [ 307 ], [ 309 ], [ 311, 313 ], [ 315, 317 ], [ 319 ], [ 321 ], [ 323 ], [ 325 ], [ 327 ], [ 329, 331 ], [ 333, 335 ], [ 337 ], [ 339 ], [ 341 ], [ 343, 345 ], [ 347 ], [ 349 ], [ 351 ], [ 353 ], [ 355 ], [ 357 ], [ 359, 361 ], [ 363, 365 ], [ 367 ], [ 369, 371 ], [ 373, 375 ], [ 377 ], [ 379 ], [ 381 ], [ 383 ], [ 385 ], [ 387 ], [ 389 ], [ 391 ], [ 393 ], [ 395, 397 ], [ 399 ], [ 401, 403 ], [ 405, 407 ], [ 409 ], [ 411 ], [ 415 ], [ 417 ], [ 419 ], [ 421 ], [ 423 ], [ 425 ], [ 427 ], [ 429 ], [ 431 ], [ 433 ], [ 435 ], [ 437 ], [ 439 ], [ 441 ], [ 445, 447 ], [ 449, 451 ], [ 453, 455 ], [ 457 ], [ 459 ], [ 461 ], [ 463 ], [ 465 ], [ 467 ], [ 469 ], [ 471 ], [ 473 ], [ 475, 477 ], [ 479 ], [ 481 ], [ 483 ], [ 485 ], [ 487 ], [ 489 ], [ 491 ], [ 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 ], [ 553 ], [ 555, 557 ], [ 559, 561 ], [ 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 ], [ 625 ], [ 627 ], [ 629 ], [ 631 ], [ 633 ], [ 635 ], [ 637 ], [ 639 ], [ 641 ], [ 643 ], [ 645 ], [ 647, 649 ], [ 651 ], [ 653 ], [ 655 ], [ 657 ], [ 659 ], [ 661 ], [ 663, 665 ], [ 667, 669 ], [ 671 ], [ 673 ], [ 675 ], [ 677 ], [ 681, 683 ], [ 685, 687 ], [ 689, 691 ], [ 695 ], [ 697 ], [ 699 ], [ 701, 703 ], [ 705 ], [ 707 ], [ 709 ], [ 711 ], [ 713 ], [ 715 ], [ 717 ], [ 719, 721 ], [ 723, 725 ], [ 727 ], [ 729, 731 ], [ 733, 735 ], [ 737 ], [ 739 ], [ 741 ], [ 743 ], [ 745 ], [ 747 ], [ 749 ], [ 751 ], [ 753 ], [ 755 ], [ 757, 759 ], [ 761 ], [ 763 ], [ 765 ], [ 767 ], [ 769 ], [ 771 ], [ 773 ], [ 775 ], [ 777, 779 ], [ 781, 783 ], [ 785 ], [ 787, 789 ], [ 791, 793 ], [ 795 ], [ 797 ], [ 799 ], [ 801 ], [ 805 ], [ 807 ], [ 809 ], [ 811 ], [ 813 ], [ 815 ], [ 817 ], [ 819 ], [ 821 ], [ 823 ], [ 825 ], [ 827 ], [ 829, 831 ], [ 833, 835 ], [ 837 ], [ 839, 841 ], [ 843, 845 ], [ 847 ], [ 849 ], [ 851 ], [ 855 ], [ 857 ], [ 859 ], [ 861 ], [ 865 ], [ 867 ], [ 869 ], [ 871 ], [ 873 ], [ 875 ], [ 877 ], [ 879 ], [ 881 ], [ 883 ], [ 885 ], [ 887 ], [ 891 ], [ 893 ], [ 895 ], [ 897 ], [ 903 ], [ 905 ], [ 907 ], [ 909 ], [ 913 ], [ 915, 917 ], [ 919 ], [ 921 ], [ 923 ], [ 927 ], [ 929 ], [ 931 ], [ 933 ], [ 935 ], [ 937 ], [ 939 ] ]
17,916
static int vivo_probe(AVProbeData *p) { const unsigned char *buf = p->buf; unsigned c, length = 0; // stream must start with packet of type 0 and sequence number 0 if (*buf++ != 0) return 0; // read at most 2 bytes of coded length c = *buf++; length = c & 0x7F; if (c & 0x80) { c = *buf++; length = (length << 7) | (c & 0x7F); } if (c & 0x80 || length > 1024 || length < 21) return 0; if (memcmp(buf, "\r\nVersion:Vivo/", 15)) return 0; buf += 15; if (*buf < '0' && *buf > '2') return 0; return AVPROBE_SCORE_MAX; }
false
FFmpeg
035e932d7c039030bd8142bf2f99cbbd1d3e92cf
static int vivo_probe(AVProbeData *p) { const unsigned char *buf = p->buf; unsigned c, length = 0; if (*buf++ != 0) return 0; c = *buf++; length = c & 0x7F; if (c & 0x80) { c = *buf++; length = (length << 7) | (c & 0x7F); } if (c & 0x80 || length > 1024 || length < 21) return 0; if (memcmp(buf, "\r\nVersion:Vivo/", 15)) return 0; buf += 15; if (*buf < '0' && *buf > '2') return 0; return AVPROBE_SCORE_MAX; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVProbeData *VAR_0) { const unsigned char *VAR_1 = VAR_0->VAR_1; unsigned VAR_2, VAR_3 = 0; if (*VAR_1++ != 0) return 0; VAR_2 = *VAR_1++; VAR_3 = VAR_2 & 0x7F; if (VAR_2 & 0x80) { VAR_2 = *VAR_1++; VAR_3 = (VAR_3 << 7) | (VAR_2 & 0x7F); } if (VAR_2 & 0x80 || VAR_3 > 1024 || VAR_3 < 21) return 0; if (memcmp(VAR_1, "\r\nVersion:Vivo/", 15)) return 0; VAR_1 += 15; if (*VAR_1 < '0' && *VAR_1 > '2') return 0; return AVPROBE_SCORE_MAX; }
[ "static int FUNC_0(AVProbeData *VAR_0)\n{", "const unsigned char *VAR_1 = VAR_0->VAR_1;", "unsigned VAR_2, VAR_3 = 0;", "if (*VAR_1++ != 0)\nreturn 0;", "VAR_2 = *VAR_1++;", "VAR_3 = VAR_2 & 0x7F;", "if (VAR_2 & 0x80) {", "VAR_2 = *VAR_1++;", "VAR_3 = (VAR_3 << 7) | (VAR_2 & 0x7F);", "}", "if (VAR_2 & 0x80 || VAR_3 > 1024 || VAR_3 < 21)\nreturn 0;", "if (memcmp(VAR_1, \"\\r\\nVersion:Vivo/\", 15))\nreturn 0;", "VAR_1 += 15;", "if (*VAR_1 < '0' && *VAR_1 > '2')\nreturn 0;", "return AVPROBE_SCORE_MAX;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 13, 15 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33, 35 ], [ 39, 41 ], [ 43 ], [ 47, 49 ], [ 53 ], [ 55 ] ]
17,917
static void print_report(int is_last_report, int64_t timer_start, int64_t cur_time) { char buf[1024]; AVBPrint buf_script; OutputStream *ost; AVFormatContext *oc; int64_t total_size; AVCodecContext *enc; int frame_number, vid, i; double bitrate; int64_t pts = INT64_MIN; static int64_t last_time = -1; static int qp_histogram[52]; int hours, mins, secs, us; if (!print_stats && !is_last_report && !progress_avio) return; if (!is_last_report) { if (last_time == -1) { last_time = cur_time; return; } if ((cur_time - last_time) < 500000) return; last_time = cur_time; } oc = output_files[0]->ctx; total_size = avio_size(oc->pb); if (total_size <= 0) // FIXME improve avio_size() so it works with non seekable output too total_size = avio_tell(oc->pb); buf[0] = '\0'; vid = 0; av_bprint_init(&buf_script, 0, 1); for (i = 0; i < nb_output_streams; i++) { float q = -1; ost = output_streams[i]; enc = ost->enc_ctx; if (!ost->stream_copy && enc->coded_frame) q = enc->coded_frame->quality / (float)FF_QP2LAMBDA; if (vid && enc->codec_type == AVMEDIA_TYPE_VIDEO) { snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "q=%2.1f ", q); av_bprintf(&buf_script, "stream_%d_%d_q=%.1f\n", ost->file_index, ost->index, q); } if (!vid && enc->codec_type == AVMEDIA_TYPE_VIDEO) { float fps, t = (cur_time-timer_start) / 1000000.0; frame_number = ost->frame_number; fps = t > 1 ? frame_number / t : 0; snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "frame=%5d fps=%3.*f q=%3.1f ", frame_number, fps < 9.95, fps, q); av_bprintf(&buf_script, "frame=%d\n", frame_number); av_bprintf(&buf_script, "fps=%.1f\n", fps); av_bprintf(&buf_script, "stream_%d_%d_q=%.1f\n", ost->file_index, ost->index, q); if (is_last_report) snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "L"); if (qp_hist) { int j; int qp = lrintf(q); if (qp >= 0 && qp < FF_ARRAY_ELEMS(qp_histogram)) qp_histogram[qp]++; for (j = 0; j < 32; j++) snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%X", (int)lrintf(log2(qp_histogram[j] + 1))); } if ((enc->flags&CODEC_FLAG_PSNR) && (enc->coded_frame || is_last_report)) { int j; double error, error_sum = 0; double scale, scale_sum = 0; double p; char type[3] = { 'Y','U','V' }; snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "PSNR="); for (j = 0; j < 3; j++) { if (is_last_report) { error = enc->error[j]; scale = enc->width * enc->height * 255.0 * 255.0 * frame_number; } else { error = enc->coded_frame->error[j]; scale = enc->width * enc->height * 255.0 * 255.0; } if (j) scale /= 4; error_sum += error; scale_sum += scale; p = psnr(error / scale); snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%c:%2.2f ", type[j], p); av_bprintf(&buf_script, "stream_%d_%d_psnr_%c=%2.2f\n", ost->file_index, ost->index, type[j] | 32, p); } p = psnr(error_sum / scale_sum); snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "*:%2.2f ", psnr(error_sum / scale_sum)); av_bprintf(&buf_script, "stream_%d_%d_psnr_all=%2.2f\n", ost->file_index, ost->index, p); } vid = 1; } /* compute min output value */ if (av_stream_get_end_pts(ost->st) != AV_NOPTS_VALUE) pts = FFMAX(pts, av_rescale_q(av_stream_get_end_pts(ost->st), ost->st->time_base, AV_TIME_BASE_Q)); if (is_last_report) nb_frames_drop += ost->last_droped; } secs = pts / AV_TIME_BASE; us = pts % AV_TIME_BASE; mins = secs / 60; secs %= 60; hours = mins / 60; mins %= 60; bitrate = pts && total_size >= 0 ? total_size * 8 / (pts / 1000.0) : -1; if (total_size < 0) snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "size=N/A time="); else snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "size=%8.0fkB time=", total_size / 1024.0); snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%02d:%02d:%02d.%02d ", hours, mins, secs, (100 * us) / AV_TIME_BASE); if (bitrate < 0) { snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),"bitrate=N/A"); av_bprintf(&buf_script, "bitrate=N/A\n"); }else{ snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),"bitrate=%6.1fkbits/s", bitrate); av_bprintf(&buf_script, "bitrate=%6.1fkbits/s\n", bitrate); } if (total_size < 0) av_bprintf(&buf_script, "total_size=N/A\n"); else av_bprintf(&buf_script, "total_size=%"PRId64"\n", total_size); av_bprintf(&buf_script, "out_time_ms=%"PRId64"\n", pts); av_bprintf(&buf_script, "out_time=%02d:%02d:%02d.%06d\n", hours, mins, secs, us); if (nb_frames_dup || nb_frames_drop) snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " dup=%d drop=%d", nb_frames_dup, nb_frames_drop); av_bprintf(&buf_script, "dup_frames=%d\n", nb_frames_dup); av_bprintf(&buf_script, "drop_frames=%d\n", nb_frames_drop); if (print_stats || is_last_report) { const char end = is_last_report ? '\n' : '\r'; if (print_stats==1 && AV_LOG_INFO > av_log_get_level()) { fprintf(stderr, "%s %c", buf, end); } else av_log(NULL, AV_LOG_INFO, "%s %c", buf, end); fflush(stderr); } if (progress_avio) { av_bprintf(&buf_script, "progress=%s\n", is_last_report ? "end" : "continue"); avio_write(progress_avio, buf_script.str, FFMIN(buf_script.len, buf_script.size - 1)); avio_flush(progress_avio); av_bprint_finalize(&buf_script, NULL); if (is_last_report) { avio_closep(&progress_avio); } } if (is_last_report) print_final_stats(total_size); }
false
FFmpeg
23849339855875b737aee94813b31ddde2e40f9a
static void print_report(int is_last_report, int64_t timer_start, int64_t cur_time) { char buf[1024]; AVBPrint buf_script; OutputStream *ost; AVFormatContext *oc; int64_t total_size; AVCodecContext *enc; int frame_number, vid, i; double bitrate; int64_t pts = INT64_MIN; static int64_t last_time = -1; static int qp_histogram[52]; int hours, mins, secs, us; if (!print_stats && !is_last_report && !progress_avio) return; if (!is_last_report) { if (last_time == -1) { last_time = cur_time; return; } if ((cur_time - last_time) < 500000) return; last_time = cur_time; } oc = output_files[0]->ctx; total_size = avio_size(oc->pb); if (total_size <= 0) total_size = avio_tell(oc->pb); buf[0] = '\0'; vid = 0; av_bprint_init(&buf_script, 0, 1); for (i = 0; i < nb_output_streams; i++) { float q = -1; ost = output_streams[i]; enc = ost->enc_ctx; if (!ost->stream_copy && enc->coded_frame) q = enc->coded_frame->quality / (float)FF_QP2LAMBDA; if (vid && enc->codec_type == AVMEDIA_TYPE_VIDEO) { snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "q=%2.1f ", q); av_bprintf(&buf_script, "stream_%d_%d_q=%.1f\n", ost->file_index, ost->index, q); } if (!vid && enc->codec_type == AVMEDIA_TYPE_VIDEO) { float fps, t = (cur_time-timer_start) / 1000000.0; frame_number = ost->frame_number; fps = t > 1 ? frame_number / t : 0; snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "frame=%5d fps=%3.*f q=%3.1f ", frame_number, fps < 9.95, fps, q); av_bprintf(&buf_script, "frame=%d\n", frame_number); av_bprintf(&buf_script, "fps=%.1f\n", fps); av_bprintf(&buf_script, "stream_%d_%d_q=%.1f\n", ost->file_index, ost->index, q); if (is_last_report) snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "L"); if (qp_hist) { int j; int qp = lrintf(q); if (qp >= 0 && qp < FF_ARRAY_ELEMS(qp_histogram)) qp_histogram[qp]++; for (j = 0; j < 32; j++) snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%X", (int)lrintf(log2(qp_histogram[j] + 1))); } if ((enc->flags&CODEC_FLAG_PSNR) && (enc->coded_frame || is_last_report)) { int j; double error, error_sum = 0; double scale, scale_sum = 0; double p; char type[3] = { 'Y','U','V' }; snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "PSNR="); for (j = 0; j < 3; j++) { if (is_last_report) { error = enc->error[j]; scale = enc->width * enc->height * 255.0 * 255.0 * frame_number; } else { error = enc->coded_frame->error[j]; scale = enc->width * enc->height * 255.0 * 255.0; } if (j) scale /= 4; error_sum += error; scale_sum += scale; p = psnr(error / scale); snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%c:%2.2f ", type[j], p); av_bprintf(&buf_script, "stream_%d_%d_psnr_%c=%2.2f\n", ost->file_index, ost->index, type[j] | 32, p); } p = psnr(error_sum / scale_sum); snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "*:%2.2f ", psnr(error_sum / scale_sum)); av_bprintf(&buf_script, "stream_%d_%d_psnr_all=%2.2f\n", ost->file_index, ost->index, p); } vid = 1; } if (av_stream_get_end_pts(ost->st) != AV_NOPTS_VALUE) pts = FFMAX(pts, av_rescale_q(av_stream_get_end_pts(ost->st), ost->st->time_base, AV_TIME_BASE_Q)); if (is_last_report) nb_frames_drop += ost->last_droped; } secs = pts / AV_TIME_BASE; us = pts % AV_TIME_BASE; mins = secs / 60; secs %= 60; hours = mins / 60; mins %= 60; bitrate = pts && total_size >= 0 ? total_size * 8 / (pts / 1000.0) : -1; if (total_size < 0) snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "size=N/A time="); else snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "size=%8.0fkB time=", total_size / 1024.0); snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%02d:%02d:%02d.%02d ", hours, mins, secs, (100 * us) / AV_TIME_BASE); if (bitrate < 0) { snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),"bitrate=N/A"); av_bprintf(&buf_script, "bitrate=N/A\n"); }else{ snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),"bitrate=%6.1fkbits/s", bitrate); av_bprintf(&buf_script, "bitrate=%6.1fkbits/s\n", bitrate); } if (total_size < 0) av_bprintf(&buf_script, "total_size=N/A\n"); else av_bprintf(&buf_script, "total_size=%"PRId64"\n", total_size); av_bprintf(&buf_script, "out_time_ms=%"PRId64"\n", pts); av_bprintf(&buf_script, "out_time=%02d:%02d:%02d.%06d\n", hours, mins, secs, us); if (nb_frames_dup || nb_frames_drop) snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " dup=%d drop=%d", nb_frames_dup, nb_frames_drop); av_bprintf(&buf_script, "dup_frames=%d\n", nb_frames_dup); av_bprintf(&buf_script, "drop_frames=%d\n", nb_frames_drop); if (print_stats || is_last_report) { const char end = is_last_report ? '\n' : '\r'; if (print_stats==1 && AV_LOG_INFO > av_log_get_level()) { fprintf(stderr, "%s %c", buf, end); } else av_log(NULL, AV_LOG_INFO, "%s %c", buf, end); fflush(stderr); } if (progress_avio) { av_bprintf(&buf_script, "progress=%s\n", is_last_report ? "end" : "continue"); avio_write(progress_avio, buf_script.str, FFMIN(buf_script.len, buf_script.size - 1)); avio_flush(progress_avio); av_bprint_finalize(&buf_script, NULL); if (is_last_report) { avio_closep(&progress_avio); } } if (is_last_report) print_final_stats(total_size); }
{ "code": [], "line_no": [] }
static void FUNC_0(int VAR_0, int64_t VAR_1, int64_t VAR_2) { char VAR_3[1024]; AVBPrint buf_script; OutputStream *ost; AVFormatContext *oc; int64_t total_size; AVCodecContext *enc; int VAR_4, VAR_5, VAR_6; double VAR_7; int64_t pts = INT64_MIN; static int64_t VAR_8 = -1; static int VAR_9[52]; int VAR_10, VAR_11, VAR_12, VAR_13; if (!print_stats && !VAR_0 && !progress_avio) return; if (!VAR_0) { if (VAR_8 == -1) { VAR_8 = VAR_2; return; } if ((VAR_2 - VAR_8) < 500000) return; VAR_8 = VAR_2; } oc = output_files[0]->ctx; total_size = avio_size(oc->pb); if (total_size <= 0) total_size = avio_tell(oc->pb); VAR_3[0] = '\0'; VAR_5 = 0; av_bprint_init(&buf_script, 0, 1); for (VAR_6 = 0; VAR_6 < nb_output_streams; VAR_6++) { float q = -1; ost = output_streams[VAR_6]; enc = ost->enc_ctx; if (!ost->stream_copy && enc->coded_frame) q = enc->coded_frame->quality / (float)FF_QP2LAMBDA; if (VAR_5 && enc->codec_type == AVMEDIA_TYPE_VIDEO) { snprintf(VAR_3 + strlen(VAR_3), sizeof(VAR_3) - strlen(VAR_3), "q=%2.1f ", q); av_bprintf(&buf_script, "stream_%d_%d_q=%.1f\n", ost->file_index, ost->index, q); } if (!VAR_5 && enc->codec_type == AVMEDIA_TYPE_VIDEO) { float fps, t = (VAR_2-VAR_1) / 1000000.0; VAR_4 = ost->VAR_4; fps = t > 1 ? VAR_4 / t : 0; snprintf(VAR_3 + strlen(VAR_3), sizeof(VAR_3) - strlen(VAR_3), "frame=%5d fps=%3.*f q=%3.1f ", VAR_4, fps < 9.95, fps, q); av_bprintf(&buf_script, "frame=%d\n", VAR_4); av_bprintf(&buf_script, "fps=%.1f\n", fps); av_bprintf(&buf_script, "stream_%d_%d_q=%.1f\n", ost->file_index, ost->index, q); if (VAR_0) snprintf(VAR_3 + strlen(VAR_3), sizeof(VAR_3) - strlen(VAR_3), "L"); if (qp_hist) { int j; int qp = lrintf(q); if (qp >= 0 && qp < FF_ARRAY_ELEMS(VAR_9)) VAR_9[qp]++; for (j = 0; j < 32; j++) snprintf(VAR_3 + strlen(VAR_3), sizeof(VAR_3) - strlen(VAR_3), "%X", (int)lrintf(log2(VAR_9[j] + 1))); } if ((enc->flags&CODEC_FLAG_PSNR) && (enc->coded_frame || VAR_0)) { int j; double error, error_sum = 0; double scale, scale_sum = 0; double p; char type[3] = { 'Y','U','V' }; snprintf(VAR_3 + strlen(VAR_3), sizeof(VAR_3) - strlen(VAR_3), "PSNR="); for (j = 0; j < 3; j++) { if (VAR_0) { error = enc->error[j]; scale = enc->width * enc->height * 255.0 * 255.0 * VAR_4; } else { error = enc->coded_frame->error[j]; scale = enc->width * enc->height * 255.0 * 255.0; } if (j) scale /= 4; error_sum += error; scale_sum += scale; p = psnr(error / scale); snprintf(VAR_3 + strlen(VAR_3), sizeof(VAR_3) - strlen(VAR_3), "%c:%2.2f ", type[j], p); av_bprintf(&buf_script, "stream_%d_%d_psnr_%c=%2.2f\n", ost->file_index, ost->index, type[j] | 32, p); } p = psnr(error_sum / scale_sum); snprintf(VAR_3 + strlen(VAR_3), sizeof(VAR_3) - strlen(VAR_3), "*:%2.2f ", psnr(error_sum / scale_sum)); av_bprintf(&buf_script, "stream_%d_%d_psnr_all=%2.2f\n", ost->file_index, ost->index, p); } VAR_5 = 1; } if (av_stream_get_end_pts(ost->st) != AV_NOPTS_VALUE) pts = FFMAX(pts, av_rescale_q(av_stream_get_end_pts(ost->st), ost->st->time_base, AV_TIME_BASE_Q)); if (VAR_0) nb_frames_drop += ost->last_droped; } VAR_12 = pts / AV_TIME_BASE; VAR_13 = pts % AV_TIME_BASE; VAR_11 = VAR_12 / 60; VAR_12 %= 60; VAR_10 = VAR_11 / 60; VAR_11 %= 60; VAR_7 = pts && total_size >= 0 ? total_size * 8 / (pts / 1000.0) : -1; if (total_size < 0) snprintf(VAR_3 + strlen(VAR_3), sizeof(VAR_3) - strlen(VAR_3), "size=N/A time="); else snprintf(VAR_3 + strlen(VAR_3), sizeof(VAR_3) - strlen(VAR_3), "size=%8.0fkB time=", total_size / 1024.0); snprintf(VAR_3 + strlen(VAR_3), sizeof(VAR_3) - strlen(VAR_3), "%02d:%02d:%02d.%02d ", VAR_10, VAR_11, VAR_12, (100 * VAR_13) / AV_TIME_BASE); if (VAR_7 < 0) { snprintf(VAR_3 + strlen(VAR_3), sizeof(VAR_3) - strlen(VAR_3),"VAR_7=N/A"); av_bprintf(&buf_script, "VAR_7=N/A\n"); }else{ snprintf(VAR_3 + strlen(VAR_3), sizeof(VAR_3) - strlen(VAR_3),"VAR_7=%6.1fkbits/s", VAR_7); av_bprintf(&buf_script, "VAR_7=%6.1fkbits/s\n", VAR_7); } if (total_size < 0) av_bprintf(&buf_script, "total_size=N/A\n"); else av_bprintf(&buf_script, "total_size=%"PRId64"\n", total_size); av_bprintf(&buf_script, "out_time_ms=%"PRId64"\n", pts); av_bprintf(&buf_script, "out_time=%02d:%02d:%02d.%06d\n", VAR_10, VAR_11, VAR_12, VAR_13); if (nb_frames_dup || nb_frames_drop) snprintf(VAR_3 + strlen(VAR_3), sizeof(VAR_3) - strlen(VAR_3), " dup=%d drop=%d", nb_frames_dup, nb_frames_drop); av_bprintf(&buf_script, "dup_frames=%d\n", nb_frames_dup); av_bprintf(&buf_script, "drop_frames=%d\n", nb_frames_drop); if (print_stats || VAR_0) { const char VAR_14 = VAR_0 ? '\n' : '\r'; if (print_stats==1 && AV_LOG_INFO > av_log_get_level()) { fprintf(stderr, "%s %c", VAR_3, VAR_14); } else av_log(NULL, AV_LOG_INFO, "%s %c", VAR_3, VAR_14); fflush(stderr); } if (progress_avio) { av_bprintf(&buf_script, "progress=%s\n", VAR_0 ? "VAR_14" : "continue"); avio_write(progress_avio, buf_script.str, FFMIN(buf_script.len, buf_script.size - 1)); avio_flush(progress_avio); av_bprint_finalize(&buf_script, NULL); if (VAR_0) { avio_closep(&progress_avio); } } if (VAR_0) print_final_stats(total_size); }
[ "static void FUNC_0(int VAR_0, int64_t VAR_1, int64_t VAR_2)\n{", "char VAR_3[1024];", "AVBPrint buf_script;", "OutputStream *ost;", "AVFormatContext *oc;", "int64_t total_size;", "AVCodecContext *enc;", "int VAR_4, VAR_5, VAR_6;", "double VAR_7;", "int64_t pts = INT64_MIN;", "static int64_t VAR_8 = -1;", "static int VAR_9[52];", "int VAR_10, VAR_11, VAR_12, VAR_13;", "if (!print_stats && !VAR_0 && !progress_avio)\nreturn;", "if (!VAR_0) {", "if (VAR_8 == -1) {", "VAR_8 = VAR_2;", "return;", "}", "if ((VAR_2 - VAR_8) < 500000)\nreturn;", "VAR_8 = VAR_2;", "}", "oc = output_files[0]->ctx;", "total_size = avio_size(oc->pb);", "if (total_size <= 0)\ntotal_size = avio_tell(oc->pb);", "VAR_3[0] = '\\0';", "VAR_5 = 0;", "av_bprint_init(&buf_script, 0, 1);", "for (VAR_6 = 0; VAR_6 < nb_output_streams; VAR_6++) {", "float q = -1;", "ost = output_streams[VAR_6];", "enc = ost->enc_ctx;", "if (!ost->stream_copy && enc->coded_frame)\nq = enc->coded_frame->quality / (float)FF_QP2LAMBDA;", "if (VAR_5 && enc->codec_type == AVMEDIA_TYPE_VIDEO) {", "snprintf(VAR_3 + strlen(VAR_3), sizeof(VAR_3) - strlen(VAR_3), \"q=%2.1f \", q);", "av_bprintf(&buf_script, \"stream_%d_%d_q=%.1f\\n\",\nost->file_index, ost->index, q);", "}", "if (!VAR_5 && enc->codec_type == AVMEDIA_TYPE_VIDEO) {", "float fps, t = (VAR_2-VAR_1) / 1000000.0;", "VAR_4 = ost->VAR_4;", "fps = t > 1 ? VAR_4 / t : 0;", "snprintf(VAR_3 + strlen(VAR_3), sizeof(VAR_3) - strlen(VAR_3), \"frame=%5d fps=%3.*f q=%3.1f \",\nVAR_4, fps < 9.95, fps, q);", "av_bprintf(&buf_script, \"frame=%d\\n\", VAR_4);", "av_bprintf(&buf_script, \"fps=%.1f\\n\", fps);", "av_bprintf(&buf_script, \"stream_%d_%d_q=%.1f\\n\",\nost->file_index, ost->index, q);", "if (VAR_0)\nsnprintf(VAR_3 + strlen(VAR_3), sizeof(VAR_3) - strlen(VAR_3), \"L\");", "if (qp_hist) {", "int j;", "int qp = lrintf(q);", "if (qp >= 0 && qp < FF_ARRAY_ELEMS(VAR_9))\nVAR_9[qp]++;", "for (j = 0; j < 32; j++)", "snprintf(VAR_3 + strlen(VAR_3), sizeof(VAR_3) - strlen(VAR_3), \"%X\", (int)lrintf(log2(VAR_9[j] + 1)));", "}", "if ((enc->flags&CODEC_FLAG_PSNR) && (enc->coded_frame || VAR_0)) {", "int j;", "double error, error_sum = 0;", "double scale, scale_sum = 0;", "double p;", "char type[3] = { 'Y','U','V' };", "snprintf(VAR_3 + strlen(VAR_3), sizeof(VAR_3) - strlen(VAR_3), \"PSNR=\");", "for (j = 0; j < 3; j++) {", "if (VAR_0) {", "error = enc->error[j];", "scale = enc->width * enc->height * 255.0 * 255.0 * VAR_4;", "} else {", "error = enc->coded_frame->error[j];", "scale = enc->width * enc->height * 255.0 * 255.0;", "}", "if (j)\nscale /= 4;", "error_sum += error;", "scale_sum += scale;", "p = psnr(error / scale);", "snprintf(VAR_3 + strlen(VAR_3), sizeof(VAR_3) - strlen(VAR_3), \"%c:%2.2f \", type[j], p);", "av_bprintf(&buf_script, \"stream_%d_%d_psnr_%c=%2.2f\\n\",\nost->file_index, ost->index, type[j] | 32, p);", "}", "p = psnr(error_sum / scale_sum);", "snprintf(VAR_3 + strlen(VAR_3), sizeof(VAR_3) - strlen(VAR_3), \"*:%2.2f \", psnr(error_sum / scale_sum));", "av_bprintf(&buf_script, \"stream_%d_%d_psnr_all=%2.2f\\n\",\nost->file_index, ost->index, p);", "}", "VAR_5 = 1;", "}", "if (av_stream_get_end_pts(ost->st) != AV_NOPTS_VALUE)\npts = FFMAX(pts, av_rescale_q(av_stream_get_end_pts(ost->st),\nost->st->time_base, AV_TIME_BASE_Q));", "if (VAR_0)\nnb_frames_drop += ost->last_droped;", "}", "VAR_12 = pts / AV_TIME_BASE;", "VAR_13 = pts % AV_TIME_BASE;", "VAR_11 = VAR_12 / 60;", "VAR_12 %= 60;", "VAR_10 = VAR_11 / 60;", "VAR_11 %= 60;", "VAR_7 = pts && total_size >= 0 ? total_size * 8 / (pts / 1000.0) : -1;", "if (total_size < 0) snprintf(VAR_3 + strlen(VAR_3), sizeof(VAR_3) - strlen(VAR_3),\n\"size=N/A time=\");", "else snprintf(VAR_3 + strlen(VAR_3), sizeof(VAR_3) - strlen(VAR_3),\n\"size=%8.0fkB time=\", total_size / 1024.0);", "snprintf(VAR_3 + strlen(VAR_3), sizeof(VAR_3) - strlen(VAR_3),\n\"%02d:%02d:%02d.%02d \", VAR_10, VAR_11, VAR_12,\n(100 * VAR_13) / AV_TIME_BASE);", "if (VAR_7 < 0) {", "snprintf(VAR_3 + strlen(VAR_3), sizeof(VAR_3) - strlen(VAR_3),\"VAR_7=N/A\");", "av_bprintf(&buf_script, \"VAR_7=N/A\\n\");", "}else{", "snprintf(VAR_3 + strlen(VAR_3), sizeof(VAR_3) - strlen(VAR_3),\"VAR_7=%6.1fkbits/s\", VAR_7);", "av_bprintf(&buf_script, \"VAR_7=%6.1fkbits/s\\n\", VAR_7);", "}", "if (total_size < 0) av_bprintf(&buf_script, \"total_size=N/A\\n\");", "else av_bprintf(&buf_script, \"total_size=%\"PRId64\"\\n\", total_size);", "av_bprintf(&buf_script, \"out_time_ms=%\"PRId64\"\\n\", pts);", "av_bprintf(&buf_script, \"out_time=%02d:%02d:%02d.%06d\\n\",\nVAR_10, VAR_11, VAR_12, VAR_13);", "if (nb_frames_dup || nb_frames_drop)\nsnprintf(VAR_3 + strlen(VAR_3), sizeof(VAR_3) - strlen(VAR_3), \" dup=%d drop=%d\",\nnb_frames_dup, nb_frames_drop);", "av_bprintf(&buf_script, \"dup_frames=%d\\n\", nb_frames_dup);", "av_bprintf(&buf_script, \"drop_frames=%d\\n\", nb_frames_drop);", "if (print_stats || VAR_0) {", "const char VAR_14 = VAR_0 ? '\\n' : '\\r';", "if (print_stats==1 && AV_LOG_INFO > av_log_get_level()) {", "fprintf(stderr, \"%s %c\", VAR_3, VAR_14);", "} else", "av_log(NULL, AV_LOG_INFO, \"%s %c\", VAR_3, VAR_14);", "fflush(stderr);", "}", "if (progress_avio) {", "av_bprintf(&buf_script, \"progress=%s\\n\",\nVAR_0 ? \"VAR_14\" : \"continue\");", "avio_write(progress_avio, buf_script.str,\nFFMIN(buf_script.len, buf_script.size - 1));", "avio_flush(progress_avio);", "av_bprint_finalize(&buf_script, NULL);", "if (VAR_0) {", "avio_closep(&progress_avio);", "}", "}", "if (VAR_0)\nprint_final_stats(total_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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47, 49 ], [ 51 ], [ 53 ], [ 59 ], [ 63 ], [ 65, 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85, 87 ], [ 89 ], [ 91 ], [ 93, 95 ], [ 97 ], [ 99 ], [ 101 ], [ 105 ], [ 107 ], [ 109, 111 ], [ 113 ], [ 115 ], [ 117, 119 ], [ 121, 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131, 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171, 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183, 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193, 195 ], [ 197 ], [ 199 ], [ 201 ], [ 205, 207, 209 ], [ 211, 213 ], [ 215 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 233 ], [ 237, 239 ], [ 241, 243 ], [ 245, 247, 249 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 269 ], [ 271 ], [ 273 ], [ 275, 277 ], [ 281, 283, 285 ], [ 287 ], [ 289 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 307 ], [ 309 ], [ 313 ], [ 315, 317 ], [ 319, 321 ], [ 323 ], [ 325 ], [ 327 ], [ 329 ], [ 331 ], [ 333 ], [ 337, 339 ], [ 341 ] ]
17,918
static int put_packetheader(NUTContext *nut, ByteIOContext *bc, int max_size) { put_flush_packet(bc); nut->last_packet_start= nut->packet_start; nut->packet_start+= nut->written_packet_size; nut->packet_size_pos = url_ftell(bc); nut->written_packet_size = max_size; /* packet header */ put_v(bc, nut->written_packet_size); /* forward ptr */ put_v(bc, nut->packet_start - nut->last_packet_start); /* backward ptr */ return 0; }
false
FFmpeg
ee9f36a88eb3e2706ea659acb0ca80c414fa5d8a
static int put_packetheader(NUTContext *nut, ByteIOContext *bc, int max_size) { put_flush_packet(bc); nut->last_packet_start= nut->packet_start; nut->packet_start+= nut->written_packet_size; nut->packet_size_pos = url_ftell(bc); nut->written_packet_size = max_size; put_v(bc, nut->written_packet_size); put_v(bc, nut->packet_start - nut->last_packet_start); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(NUTContext *VAR_0, ByteIOContext *VAR_1, int VAR_2) { put_flush_packet(VAR_1); VAR_0->last_packet_start= VAR_0->packet_start; VAR_0->packet_start+= VAR_0->written_packet_size; VAR_0->packet_size_pos = url_ftell(VAR_1); VAR_0->written_packet_size = VAR_2; put_v(VAR_1, VAR_0->written_packet_size); put_v(VAR_1, VAR_0->packet_start - VAR_0->last_packet_start); return 0; }
[ "static int FUNC_0(NUTContext *VAR_0, ByteIOContext *VAR_1, int VAR_2)\n{", "put_flush_packet(VAR_1);", "VAR_0->last_packet_start= VAR_0->packet_start;", "VAR_0->packet_start+= VAR_0->written_packet_size;", "VAR_0->packet_size_pos = url_ftell(VAR_1);", "VAR_0->written_packet_size = VAR_2;", "put_v(VAR_1, VAR_0->written_packet_size);", "put_v(VAR_1, VAR_0->packet_start - VAR_0->last_packet_start);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ] ]
17,919
static int decode_mb_cavlc(H264Context *h){ MpegEncContext * const s = &h->s; int mb_xy; int partition_count; unsigned int mb_type, cbp; int dct8x8_allowed= h->pps.transform_8x8_mode; mb_xy = h->mb_xy = s->mb_x + s->mb_y*s->mb_stride; s->dsp.clear_blocks(h->mb); //FIXME avoid if already clear (move after skip handlong? tprintf(s->avctx, "pic:%d mb:%d/%d\n", h->frame_num, s->mb_x, s->mb_y); cbp = 0; /* avoid warning. FIXME: find a solution without slowing down the code */ if(h->slice_type_nos != FF_I_TYPE){ if(s->mb_skip_run==-1) s->mb_skip_run= get_ue_golomb(&s->gb); if (s->mb_skip_run--) { if(FRAME_MBAFF && (s->mb_y&1) == 0){ if(s->mb_skip_run==0) h->mb_mbaff = h->mb_field_decoding_flag = get_bits1(&s->gb); else predict_field_decoding_flag(h); } decode_mb_skip(h); return 0; } } if(FRAME_MBAFF){ if( (s->mb_y&1) == 0 ) h->mb_mbaff = h->mb_field_decoding_flag = get_bits1(&s->gb); }else h->mb_field_decoding_flag= (s->picture_structure!=PICT_FRAME); h->prev_mb_skipped= 0; mb_type= get_ue_golomb(&s->gb); if(h->slice_type_nos == FF_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_nos == FF_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_nos == FF_I_TYPE); if(h->slice_type == FF_SI_TYPE && mb_type) mb_type--; decode_intra_mb: if(mb_type > 25){ av_log(h->s.avctx, AV_LOG_ERROR, "mb_type %d in %c slice too large at %d %d\n", mb_type, av_get_pict_type_char(h->slice_type), s->mb_x, s->mb_y); return -1; } 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)){ unsigned int x, y; // We assume these blocks are very rare so we do not optimize it. align_get_bits(&s->gb); // 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(s->avctx, "LUMA ICPM LEVEL (%3d)\n", show_bits(&s->gb, 8)); h->mb[index + (x&3) + 16*((x>>2)&1) + 64*(x>>3)]= get_bits(&s->gb, 8); } } for(y=0; y<8; y++){ const int index= 256 + 4*(y&3) + 32*(y>>2); for(x=0; x<8; x++){ tprintf(s->avctx, "CHROMA U ICPM LEVEL (%3d)\n", show_bits(&s->gb, 8)); h->mb[index + (x&3) + 16*(x>>2)]= get_bits(&s->gb, 8); } } for(y=0; y<8; y++){ const int index= 256 + 64 + 4*(y&3) + 32*(y>>2); for(x=0; x<8; x++){ tprintf(s->avctx, "CHROMA V ICPM LEVEL (%3d)\n", show_bits(&s->gb, 8)); h->mb[index + (x&3) + 16*(x>>2)]= get_bits(&s->gb, 8); } } // In deblocking, the quantizer is 0 s->current_picture.qscale_table[mb_xy]= 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); //mb_pred if(IS_INTRA(mb_type)){ int pred_mode; // init_top_left_availability(h); if(IS_INTRA4x4(mb_type)){ int i; int di = 1; if(dct8x8_allowed && get_bits1(&s->gb)){ mb_type |= MB_TYPE_8x8DCT; di = 4; } // fill_intra4x4_pred_table(h); for(i=0; i<16; i+=di){ int mode= pred_intra_mode(h, i); if(!get_bits1(&s->gb)){ const int rem_mode= get_bits(&s->gb, 3); mode = rem_mode + (rem_mode >= mode); } if(di==4) fill_rectangle( &h->intra4x4_pred_mode_cache[ scan8[i] ], 2, 2, 8, mode, 1 ); else h->intra4x4_pred_mode_cache[ scan8[i] ] = mode; } 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; } pred_mode= check_intra_pred_mode(h, get_ue_golomb(&s->gb)); 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_nos == FF_B_TYPE){ for(i=0; i<4; i++){ h->sub_mb_type[i]= get_ue_golomb(&s->gb); if(h->sub_mb_type[i] >=13){ av_log(h->s.avctx, AV_LOG_ERROR, "B sub_mb_type %u out of range at %d %d\n", h->sub_mb_type[i], s->mb_x, s->mb_y); return -1; } 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]) || IS_DIRECT(h->sub_mb_type[1]) || IS_DIRECT(h->sub_mb_type[2]) || IS_DIRECT(h->sub_mb_type[3])) { pred_direct_motion(h, &mb_type); h->ref_cache[0][scan8[4]] = h->ref_cache[1][scan8[4]] = h->ref_cache[0][scan8[12]] = h->ref_cache[1][scan8[12]] = PART_NOT_AVAILABLE; } }else{ assert(h->slice_type_nos == FF_P_TYPE); //FIXME SP correct ? for(i=0; i<4; i++){ h->sub_mb_type[i]= get_ue_golomb(&s->gb); if(h->sub_mb_type[i] >=4){ av_log(h->s.avctx, AV_LOG_ERROR, "P sub_mb_type %u out of range at %d %d\n", h->sub_mb_type[i], s->mb_x, s->mb_y); return -1; } 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++){ int ref_count= IS_REF0(mb_type) ? 1 : h->ref_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)){ unsigned int tmp = get_te0_golomb(&s->gb, ref_count); //FIXME init to 0 before and skip? if(tmp>=ref_count){ av_log(h->s.avctx, AV_LOG_ERROR, "ref %u overflow\n", tmp); return -1; } ref[list][i]= tmp; }else{ //FIXME ref[list][i] = -1; } } } 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])) { h->ref_cache[list][ scan8[4*i] ] = h->ref_cache[list][ scan8[4*i]+1 ]; continue; } h->ref_cache[list][ scan8[4*i] ]=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(IS_DIR(h->sub_mb_type[i], 0, list)){ 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 mx, my; const int index= 4*i + block_width*j; int16_t (* mv_cache)[2]= &h->mv_cache[list][ scan8[index] ]; pred_motion(h, index, block_width, list, h->ref_cache[list][ scan8[index] ], &mx, &my); mx += get_se_golomb(&s->gb); my += get_se_golomb(&s->gb); tprintf(s->avctx, "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; }else if(IS_SUB_8X4(sub_mb_type)){ mv_cache[ 1 ][0]= mx; mv_cache[ 1 ][1]= my; }else if(IS_SUB_4X8(sub_mb_type)){ mv_cache[ 8 ][0]= mx; mv_cache[ 8 ][1]= my; } mv_cache[ 0 ][0]= mx; mv_cache[ 0 ][1]= my; } }else{ uint32_t *p= (uint32_t *)&h->mv_cache[list][ scan8[4*i] ][0]; p[0] = p[1]= p[8] = p[9]= 0; } } } }else if(IS_DIRECT(mb_type)){ pred_direct_motion(h, &mb_type); dct8x8_allowed &= h->sps.direct_8x8_inference_flag; }else{ int list, mx, my, i; //FIXME we should set ref_idx_l? to 0 if we use that later ... if(IS_16X16(mb_type)){ for(list=0; list<h->list_count; list++){ unsigned int val; if(IS_DIR(mb_type, 0, list)){ val= get_te0_golomb(&s->gb, h->ref_count[list]); if(val >= h->ref_count[list]){ av_log(h->s.avctx, AV_LOG_ERROR, "ref %u overflow\n", val); return -1; } }else val= LIST_NOT_USED&0xFF; fill_rectangle(&h->ref_cache[list][ scan8[0] ], 4, 4, 8, val, 1); } for(list=0; list<h->list_count; list++){ unsigned int val; if(IS_DIR(mb_type, 0, list)){ pred_motion(h, 0, 4, list, h->ref_cache[list][ scan8[0] ], &mx, &my); mx += get_se_golomb(&s->gb); my += get_se_golomb(&s->gb); tprintf(s->avctx, "final mv:%d %d\n", mx, my); val= pack16to32(mx,my); }else val=0; fill_rectangle(h->mv_cache[list][ scan8[0] ], 4, 4, 8, val, 4); } } else if(IS_16X8(mb_type)){ for(list=0; list<h->list_count; list++){ for(i=0; i<2; i++){ unsigned int val; if(IS_DIR(mb_type, i, list)){ val= get_te0_golomb(&s->gb, h->ref_count[list]); if(val >= h->ref_count[list]){ av_log(h->s.avctx, AV_LOG_ERROR, "ref %u overflow\n", val); return -1; } }else val= LIST_NOT_USED&0xFF; fill_rectangle(&h->ref_cache[list][ scan8[0] + 16*i ], 4, 2, 8, val, 1); } } for(list=0; list<h->list_count; list++){ for(i=0; i<2; i++){ unsigned int val; if(IS_DIR(mb_type, i, list)){ pred_16x8_motion(h, 8*i, list, h->ref_cache[list][scan8[0] + 16*i], &mx, &my); mx += get_se_golomb(&s->gb); my += get_se_golomb(&s->gb); tprintf(s->avctx, "final mv:%d %d\n", mx, my); val= pack16to32(mx,my); }else val=0; fill_rectangle(h->mv_cache[list][ scan8[0] + 16*i ], 4, 2, 8, val, 4); } } }else{ assert(IS_8X16(mb_type)); for(list=0; list<h->list_count; list++){ for(i=0; i<2; i++){ unsigned int val; if(IS_DIR(mb_type, i, list)){ //FIXME optimize val= get_te0_golomb(&s->gb, h->ref_count[list]); if(val >= h->ref_count[list]){ av_log(h->s.avctx, AV_LOG_ERROR, "ref %u overflow\n", val); return -1; } }else val= LIST_NOT_USED&0xFF; fill_rectangle(&h->ref_cache[list][ scan8[0] + 2*i ], 2, 4, 8, val, 1); } } for(list=0; list<h->list_count; list++){ for(i=0; i<2; i++){ unsigned int val; if(IS_DIR(mb_type, i, list)){ pred_8x16_motion(h, i*4, list, h->ref_cache[list][ scan8[0] + 2*i ], &mx, &my); mx += get_se_golomb(&s->gb); my += get_se_golomb(&s->gb); tprintf(s->avctx, "final mv:%d %d\n", mx, my); val= pack16to32(mx,my); }else val=0; fill_rectangle(h->mv_cache[list][ scan8[0] + 2*i ], 2, 4, 8, val, 4); } } } } if(IS_INTER(mb_type)) write_back_motion(h, mb_type); if(!IS_INTRA16x16(mb_type)){ cbp= get_ue_golomb(&s->gb); if(cbp > 47){ av_log(h->s.avctx, AV_LOG_ERROR, "cbp too large (%u) at %d %d\n", cbp, s->mb_x, s->mb_y); return -1; } if(IS_INTRA4x4(mb_type)) cbp= golomb_to_intra4x4_cbp[cbp]; else cbp= golomb_to_inter_cbp[cbp]; } h->cbp = cbp; if(dct8x8_allowed && (cbp&15) && !IS_INTRA(mb_type)){ if(get_bits1(&s->gb)) mb_type |= MB_TYPE_8x8DCT; } s->current_picture.mb_type[mb_xy]= mb_type; if(cbp || IS_INTRA16x16(mb_type)){ int i8x8, i4x4, chroma_idx; int dquant; GetBitContext *gb= IS_INTRA(mb_type) ? h->intra_gb_ptr : h->inter_gb_ptr; const uint8_t *scan, *scan8x8, *dc_scan; // fill_non_zero_count_cache(h); if(IS_INTERLACED(mb_type)){ scan8x8= s->qscale ? h->field_scan8x8_cavlc : h->field_scan8x8_cavlc_q0; scan= s->qscale ? h->field_scan : h->field_scan_q0; dc_scan= luma_dc_field_scan; }else{ scan8x8= s->qscale ? h->zigzag_scan8x8_cavlc : h->zigzag_scan8x8_cavlc_q0; scan= s->qscale ? h->zigzag_scan : h->zigzag_scan_q0; dc_scan= luma_dc_zigzag_scan; } dquant= get_se_golomb(&s->gb); if( dquant > 25 || dquant < -26 ){ av_log(h->s.avctx, AV_LOG_ERROR, "dquant out of range (%d) at %d %d\n", dquant, s->mb_x, s->mb_y); return -1; } s->qscale += dquant; if(((unsigned)s->qscale) > 51){ if(s->qscale<0) s->qscale+= 52; else s->qscale-= 52; } h->chroma_qp[0]= get_chroma_qp(h, 0, s->qscale); h->chroma_qp[1]= get_chroma_qp(h, 1, s->qscale); if(IS_INTRA16x16(mb_type)){ if( decode_residual(h, h->intra_gb_ptr, h->mb, LUMA_DC_BLOCK_INDEX, dc_scan, h->dequant4_coeff[0][s->qscale], 16) < 0){ return -1; //FIXME continue if partitioned and other return -1 too } assert((cbp&15) == 0 || (cbp&15) == 15); if(cbp&15){ for(i8x8=0; i8x8<4; i8x8++){ for(i4x4=0; i4x4<4; i4x4++){ const int index= i4x4 + 4*i8x8; if( decode_residual(h, h->intra_gb_ptr, h->mb + 16*index, index, 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{ for(i8x8=0; i8x8<4; i8x8++){ if(cbp & (1<<i8x8)){ if(IS_8x8DCT(mb_type)){ DCTELEM *buf = &h->mb[64*i8x8]; uint8_t *nnz; for(i4x4=0; i4x4<4; i4x4++){ if( decode_residual(h, gb, buf, i4x4+4*i8x8, scan8x8+16*i4x4, h->dequant8_coeff[IS_INTRA( mb_type ) ? 0:1][s->qscale], 16) <0 ) return -1; } nnz= &h->non_zero_count_cache[ scan8[4*i8x8] ]; nnz[0] += nnz[1] + nnz[8] + nnz[9]; }else{ for(i4x4=0; i4x4<4; i4x4++){ const int index= i4x4 + 4*i8x8; if( decode_residual(h, gb, h->mb + 16*index, 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){ for(chroma_idx=0; chroma_idx<2; chroma_idx++) if( decode_residual(h, gb, h->mb + 256 + 16*4*chroma_idx, CHROMA_DC_BLOCK_INDEX, chroma_dc_scan, NULL, 4) < 0){ return -1; } } if(cbp&0x20){ for(chroma_idx=0; chroma_idx<2; chroma_idx++){ const uint32_t *qmul = h->dequant4_coeff[chroma_idx+1+(IS_INTRA( mb_type ) ? 0:3)][h->chroma_qp[chroma_idx]]; for(i4x4=0; i4x4<4; i4x4++){ const int index= 16 + 4*chroma_idx + i4x4; if( decode_residual(h, gb, h->mb + 16*index, index, scan + 1, qmul, 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; } 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
ac5057c2de1678847f1ce5b508fc18a9126b5e20
static int decode_mb_cavlc(H264Context *h){ MpegEncContext * const s = &h->s; int mb_xy; int partition_count; unsigned int mb_type, cbp; int dct8x8_allowed= h->pps.transform_8x8_mode; mb_xy = h->mb_xy = s->mb_x + s->mb_y*s->mb_stride; s->dsp.clear_blocks(h->mb); tprintf(s->avctx, "pic:%d mb:%d/%d\n", h->frame_num, s->mb_x, s->mb_y); cbp = 0; if(h->slice_type_nos != FF_I_TYPE){ if(s->mb_skip_run==-1) s->mb_skip_run= get_ue_golomb(&s->gb); if (s->mb_skip_run--) { if(FRAME_MBAFF && (s->mb_y&1) == 0){ if(s->mb_skip_run==0) h->mb_mbaff = h->mb_field_decoding_flag = get_bits1(&s->gb); else predict_field_decoding_flag(h); } decode_mb_skip(h); return 0; } } if(FRAME_MBAFF){ if( (s->mb_y&1) == 0 ) h->mb_mbaff = h->mb_field_decoding_flag = get_bits1(&s->gb); }else h->mb_field_decoding_flag= (s->picture_structure!=PICT_FRAME); h->prev_mb_skipped= 0; mb_type= get_ue_golomb(&s->gb); if(h->slice_type_nos == FF_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_nos == FF_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_nos == FF_I_TYPE); if(h->slice_type == FF_SI_TYPE && mb_type) mb_type--; decode_intra_mb: if(mb_type > 25){ av_log(h->s.avctx, AV_LOG_ERROR, "mb_type %d in %c slice too large at %d %d\n", mb_type, av_get_pict_type_char(h->slice_type), s->mb_x, s->mb_y); return -1; } 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)){ unsigned int x, y; align_get_bits(&s->gb); 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(s->avctx, "LUMA ICPM LEVEL (%3d)\n", show_bits(&s->gb, 8)); h->mb[index + (x&3) + 16*((x>>2)&1) + 64*(x>>3)]= get_bits(&s->gb, 8); } } for(y=0; y<8; y++){ const int index= 256 + 4*(y&3) + 32*(y>>2); for(x=0; x<8; x++){ tprintf(s->avctx, "CHROMA U ICPM LEVEL (%3d)\n", show_bits(&s->gb, 8)); h->mb[index + (x&3) + 16*(x>>2)]= get_bits(&s->gb, 8); } } for(y=0; y<8; y++){ const int index= 256 + 64 + 4*(y&3) + 32*(y>>2); for(x=0; x<8; x++){ tprintf(s->avctx, "CHROMA V ICPM LEVEL (%3d)\n", show_bits(&s->gb, 8)); h->mb[index + (x&3) + 16*(x>>2)]= get_bits(&s->gb, 8); } } s->current_picture.qscale_table[mb_xy]= 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 pred_mode; if(IS_INTRA4x4(mb_type)){ int i; int di = 1; if(dct8x8_allowed && get_bits1(&s->gb)){ mb_type |= MB_TYPE_8x8DCT; di = 4; } for(i=0; i<16; i+=di){ int mode= pred_intra_mode(h, i); if(!get_bits1(&s->gb)){ const int rem_mode= get_bits(&s->gb, 3); mode = rem_mode + (rem_mode >= mode); } if(di==4) fill_rectangle( &h->intra4x4_pred_mode_cache[ scan8[i] ], 2, 2, 8, mode, 1 ); else h->intra4x4_pred_mode_cache[ scan8[i] ] = mode; } 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; } pred_mode= check_intra_pred_mode(h, get_ue_golomb(&s->gb)); 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_nos == FF_B_TYPE){ for(i=0; i<4; i++){ h->sub_mb_type[i]= get_ue_golomb(&s->gb); if(h->sub_mb_type[i] >=13){ av_log(h->s.avctx, AV_LOG_ERROR, "B sub_mb_type %u out of range at %d %d\n", h->sub_mb_type[i], s->mb_x, s->mb_y); return -1; } 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]) || IS_DIRECT(h->sub_mb_type[1]) || IS_DIRECT(h->sub_mb_type[2]) || IS_DIRECT(h->sub_mb_type[3])) { pred_direct_motion(h, &mb_type); h->ref_cache[0][scan8[4]] = h->ref_cache[1][scan8[4]] = h->ref_cache[0][scan8[12]] = h->ref_cache[1][scan8[12]] = PART_NOT_AVAILABLE; } }else{ assert(h->slice_type_nos == FF_P_TYPE); for(i=0; i<4; i++){ h->sub_mb_type[i]= get_ue_golomb(&s->gb); if(h->sub_mb_type[i] >=4){ av_log(h->s.avctx, AV_LOG_ERROR, "P sub_mb_type %u out of range at %d %d\n", h->sub_mb_type[i], s->mb_x, s->mb_y); return -1; } 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++){ int ref_count= IS_REF0(mb_type) ? 1 : h->ref_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)){ unsigned int tmp = get_te0_golomb(&s->gb, ref_count); if(tmp>=ref_count){ av_log(h->s.avctx, AV_LOG_ERROR, "ref %u overflow\n", tmp); return -1; } ref[list][i]= tmp; }else{ ref[list][i] = -1; } } } 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])) { h->ref_cache[list][ scan8[4*i] ] = h->ref_cache[list][ scan8[4*i]+1 ]; continue; } h->ref_cache[list][ scan8[4*i] ]=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(IS_DIR(h->sub_mb_type[i], 0, list)){ 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 mx, my; const int index= 4*i + block_width*j; int16_t (* mv_cache)[2]= &h->mv_cache[list][ scan8[index] ]; pred_motion(h, index, block_width, list, h->ref_cache[list][ scan8[index] ], &mx, &my); mx += get_se_golomb(&s->gb); my += get_se_golomb(&s->gb); tprintf(s->avctx, "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; }else if(IS_SUB_8X4(sub_mb_type)){ mv_cache[ 1 ][0]= mx; mv_cache[ 1 ][1]= my; }else if(IS_SUB_4X8(sub_mb_type)){ mv_cache[ 8 ][0]= mx; mv_cache[ 8 ][1]= my; } mv_cache[ 0 ][0]= mx; mv_cache[ 0 ][1]= my; } }else{ uint32_t *p= (uint32_t *)&h->mv_cache[list][ scan8[4*i] ][0]; p[0] = p[1]= p[8] = p[9]= 0; } } } }else if(IS_DIRECT(mb_type)){ pred_direct_motion(h, &mb_type); dct8x8_allowed &= h->sps.direct_8x8_inference_flag; }else{ int list, mx, my, i; we should set ref_idx_l? to 0 if we use that later ... if(IS_16X16(mb_type)){ for(list=0; list<h->list_count; list++){ unsigned int val; if(IS_DIR(mb_type, 0, list)){ val= get_te0_golomb(&s->gb, h->ref_count[list]); if(val >= h->ref_count[list]){ av_log(h->s.avctx, AV_LOG_ERROR, "ref %u overflow\n", val); return -1; } }else val= LIST_NOT_USED&0xFF; fill_rectangle(&h->ref_cache[list][ scan8[0] ], 4, 4, 8, val, 1); } for(list=0; list<h->list_count; list++){ unsigned int val; if(IS_DIR(mb_type, 0, list)){ pred_motion(h, 0, 4, list, h->ref_cache[list][ scan8[0] ], &mx, &my); mx += get_se_golomb(&s->gb); my += get_se_golomb(&s->gb); tprintf(s->avctx, "final mv:%d %d\n", mx, my); val= pack16to32(mx,my); }else val=0; fill_rectangle(h->mv_cache[list][ scan8[0] ], 4, 4, 8, val, 4); } } else if(IS_16X8(mb_type)){ for(list=0; list<h->list_count; list++){ for(i=0; i<2; i++){ unsigned int val; if(IS_DIR(mb_type, i, list)){ val= get_te0_golomb(&s->gb, h->ref_count[list]); if(val >= h->ref_count[list]){ av_log(h->s.avctx, AV_LOG_ERROR, "ref %u overflow\n", val); return -1; } }else val= LIST_NOT_USED&0xFF; fill_rectangle(&h->ref_cache[list][ scan8[0] + 16*i ], 4, 2, 8, val, 1); } } for(list=0; list<h->list_count; list++){ for(i=0; i<2; i++){ unsigned int val; if(IS_DIR(mb_type, i, list)){ pred_16x8_motion(h, 8*i, list, h->ref_cache[list][scan8[0] + 16*i], &mx, &my); mx += get_se_golomb(&s->gb); my += get_se_golomb(&s->gb); tprintf(s->avctx, "final mv:%d %d\n", mx, my); val= pack16to32(mx,my); }else val=0; fill_rectangle(h->mv_cache[list][ scan8[0] + 16*i ], 4, 2, 8, val, 4); } } }else{ assert(IS_8X16(mb_type)); for(list=0; list<h->list_count; list++){ for(i=0; i<2; i++){ unsigned int val; if(IS_DIR(mb_type, i, list)){ optimize val= get_te0_golomb(&s->gb, h->ref_count[list]); if(val >= h->ref_count[list]){ av_log(h->s.avctx, AV_LOG_ERROR, "ref %u overflow\n", val); return -1; } }else val= LIST_NOT_USED&0xFF; fill_rectangle(&h->ref_cache[list][ scan8[0] + 2*i ], 2, 4, 8, val, 1); } } for(list=0; list<h->list_count; list++){ for(i=0; i<2; i++){ unsigned int val; if(IS_DIR(mb_type, i, list)){ pred_8x16_motion(h, i*4, list, h->ref_cache[list][ scan8[0] + 2*i ], &mx, &my); mx += get_se_golomb(&s->gb); my += get_se_golomb(&s->gb); tprintf(s->avctx, "final mv:%d %d\n", mx, my); val= pack16to32(mx,my); }else val=0; fill_rectangle(h->mv_cache[list][ scan8[0] + 2*i ], 2, 4, 8, val, 4); } } } } if(IS_INTER(mb_type)) write_back_motion(h, mb_type); if(!IS_INTRA16x16(mb_type)){ cbp= get_ue_golomb(&s->gb); if(cbp > 47){ av_log(h->s.avctx, AV_LOG_ERROR, "cbp too large (%u) at %d %d\n", cbp, s->mb_x, s->mb_y); return -1; } if(IS_INTRA4x4(mb_type)) cbp= golomb_to_intra4x4_cbp[cbp]; else cbp= golomb_to_inter_cbp[cbp]; } h->cbp = cbp; if(dct8x8_allowed && (cbp&15) && !IS_INTRA(mb_type)){ if(get_bits1(&s->gb)) mb_type |= MB_TYPE_8x8DCT; } s->current_picture.mb_type[mb_xy]= mb_type; if(cbp || IS_INTRA16x16(mb_type)){ int i8x8, i4x4, chroma_idx; int dquant; GetBitContext *gb= IS_INTRA(mb_type) ? h->intra_gb_ptr : h->inter_gb_ptr; const uint8_t *scan, *scan8x8, *dc_scan; if(IS_INTERLACED(mb_type)){ scan8x8= s->qscale ? h->field_scan8x8_cavlc : h->field_scan8x8_cavlc_q0; scan= s->qscale ? h->field_scan : h->field_scan_q0; dc_scan= luma_dc_field_scan; }else{ scan8x8= s->qscale ? h->zigzag_scan8x8_cavlc : h->zigzag_scan8x8_cavlc_q0; scan= s->qscale ? h->zigzag_scan : h->zigzag_scan_q0; dc_scan= luma_dc_zigzag_scan; } dquant= get_se_golomb(&s->gb); if( dquant > 25 || dquant < -26 ){ av_log(h->s.avctx, AV_LOG_ERROR, "dquant out of range (%d) at %d %d\n", dquant, s->mb_x, s->mb_y); return -1; } s->qscale += dquant; if(((unsigned)s->qscale) > 51){ if(s->qscale<0) s->qscale+= 52; else s->qscale-= 52; } h->chroma_qp[0]= get_chroma_qp(h, 0, s->qscale); h->chroma_qp[1]= get_chroma_qp(h, 1, s->qscale); if(IS_INTRA16x16(mb_type)){ if( decode_residual(h, h->intra_gb_ptr, h->mb, LUMA_DC_BLOCK_INDEX, dc_scan, h->dequant4_coeff[0][s->qscale], 16) < 0){ return -1; continue if partitioned and other return -1 too } assert((cbp&15) == 0 || (cbp&15) == 15); if(cbp&15){ for(i8x8=0; i8x8<4; i8x8++){ for(i4x4=0; i4x4<4; i4x4++){ const int index= i4x4 + 4*i8x8; if( decode_residual(h, h->intra_gb_ptr, h->mb + 16*index, index, 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{ for(i8x8=0; i8x8<4; i8x8++){ if(cbp & (1<<i8x8)){ if(IS_8x8DCT(mb_type)){ DCTELEM *buf = &h->mb[64*i8x8]; uint8_t *nnz; for(i4x4=0; i4x4<4; i4x4++){ if( decode_residual(h, gb, buf, i4x4+4*i8x8, scan8x8+16*i4x4, h->dequant8_coeff[IS_INTRA( mb_type ) ? 0:1][s->qscale], 16) <0 ) return -1; } nnz= &h->non_zero_count_cache[ scan8[4*i8x8] ]; nnz[0] += nnz[1] + nnz[8] + nnz[9]; }else{ for(i4x4=0; i4x4<4; i4x4++){ const int index= i4x4 + 4*i8x8; if( decode_residual(h, gb, h->mb + 16*index, 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){ for(chroma_idx=0; chroma_idx<2; chroma_idx++) if( decode_residual(h, gb, h->mb + 256 + 16*4*chroma_idx, CHROMA_DC_BLOCK_INDEX, chroma_dc_scan, NULL, 4) < 0){ return -1; } } if(cbp&0x20){ for(chroma_idx=0; chroma_idx<2; chroma_idx++){ const uint32_t *qmul = h->dequant4_coeff[chroma_idx+1+(IS_INTRA( mb_type ) ? 0:3)][h->chroma_qp[chroma_idx]]; for(i4x4=0; i4x4<4; i4x4++){ const int index= 16 + 4*chroma_idx + i4x4; if( decode_residual(h, gb, h->mb + 16*index, index, scan + 1, qmul, 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; } 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; int VAR_1; int VAR_2; unsigned int VAR_3, VAR_4; int VAR_5= VAR_0->pps.transform_8x8_mode; VAR_1 = VAR_0->VAR_1 = s->mb_x + s->mb_y*s->mb_stride; s->dsp.clear_blocks(VAR_0->mb); tprintf(s->avctx, "pic:%d mb:%d/%d\n", VAR_0->frame_num, s->mb_x, s->mb_y); VAR_4 = 0; if(VAR_0->slice_type_nos != FF_I_TYPE){ if(s->mb_skip_run==-1) s->mb_skip_run= get_ue_golomb(&s->gb); if (s->mb_skip_run--) { if(FRAME_MBAFF && (s->mb_y&1) == 0){ if(s->mb_skip_run==0) VAR_0->mb_mbaff = VAR_0->mb_field_decoding_flag = get_bits1(&s->gb); else predict_field_decoding_flag(VAR_0); } decode_mb_skip(VAR_0); return 0; } } if(FRAME_MBAFF){ if( (s->mb_y&1) == 0 ) VAR_0->mb_mbaff = VAR_0->mb_field_decoding_flag = get_bits1(&s->gb); }else VAR_0->mb_field_decoding_flag= (s->picture_structure!=PICT_FRAME); VAR_0->prev_mb_skipped= 0; VAR_3= get_ue_golomb(&s->gb); if(VAR_0->slice_type_nos == FF_B_TYPE){ if(VAR_3 < 23){ VAR_2= b_mb_type_info[VAR_3].VAR_2; VAR_3= b_mb_type_info[VAR_3].type; }else{ VAR_3 -= 23; goto decode_intra_mb; } }else if(VAR_0->slice_type_nos == FF_P_TYPE){ if(VAR_3 < 5){ VAR_2= p_mb_type_info[VAR_3].VAR_2; VAR_3= p_mb_type_info[VAR_3].type; }else{ VAR_3 -= 5; goto decode_intra_mb; } }else{ assert(VAR_0->slice_type_nos == FF_I_TYPE); if(VAR_0->slice_type == FF_SI_TYPE && VAR_3) VAR_3--; decode_intra_mb: if(VAR_3 > 25){ av_log(VAR_0->s.avctx, AV_LOG_ERROR, "VAR_3 %d in %c slice too large at %d %d\n", VAR_3, av_get_pict_type_char(VAR_0->slice_type), s->mb_x, s->mb_y); return -1; } VAR_2=0; VAR_4= i_mb_type_info[VAR_3].VAR_4; VAR_0->intra16x16_pred_mode= i_mb_type_info[VAR_3].VAR_9; VAR_3= i_mb_type_info[VAR_3].type; } if(MB_FIELD) VAR_3 |= MB_TYPE_INTERLACED; VAR_0->slice_table[ VAR_1 ]= VAR_0->slice_num; if(IS_INTRA_PCM(VAR_3)){ unsigned int VAR_6, VAR_7; align_get_bits(&s->gb); for(VAR_7=0; VAR_7<16; VAR_7++){ const int VAR_26= 4*(VAR_7&3) + 32*((VAR_7>>2)&1) + 128*(VAR_7>>3); for(VAR_6=0; VAR_6<16; VAR_6++){ tprintf(s->avctx, "LUMA ICPM LEVEL (%3d)\n", show_bits(&s->gb, 8)); VAR_0->mb[VAR_26 + (VAR_6&3) + 16*((VAR_6>>2)&1) + 64*(VAR_6>>3)]= get_bits(&s->gb, 8); } } for(VAR_7=0; VAR_7<8; VAR_7++){ const int VAR_26= 256 + 4*(VAR_7&3) + 32*(VAR_7>>2); for(VAR_6=0; VAR_6<8; VAR_6++){ tprintf(s->avctx, "CHROMA U ICPM LEVEL (%3d)\n", show_bits(&s->gb, 8)); VAR_0->mb[VAR_26 + (VAR_6&3) + 16*(VAR_6>>2)]= get_bits(&s->gb, 8); } } for(VAR_7=0; VAR_7<8; VAR_7++){ const int VAR_26= 256 + 64 + 4*(VAR_7&3) + 32*(VAR_7>>2); for(VAR_6=0; VAR_6<8; VAR_6++){ tprintf(s->avctx, "CHROMA V ICPM LEVEL (%3d)\n", show_bits(&s->gb, 8)); VAR_0->mb[VAR_26 + (VAR_6&3) + 16*(VAR_6>>2)]= get_bits(&s->gb, 8); } } s->current_picture.qscale_table[VAR_1]= 0; memset(VAR_0->non_zero_count[VAR_1], 16, 16); s->current_picture.VAR_3[VAR_1]= VAR_3; return 0; } if(MB_MBAFF){ VAR_0->ref_count[0] <<= 1; VAR_0->ref_count[1] <<= 1; } fill_caches(VAR_0, VAR_3, 0); if(IS_INTRA(VAR_3)){ int VAR_9; if(IS_INTRA4x4(VAR_3)){ int VAR_20; int VAR_11 = 1; if(VAR_5 && get_bits1(&s->gb)){ VAR_3 |= MB_TYPE_8x8DCT; VAR_11 = 4; } for(VAR_20=0; VAR_20<16; VAR_20+=VAR_11){ int VAR_12= pred_intra_mode(VAR_0, VAR_20); if(!get_bits1(&s->gb)){ const int VAR_13= get_bits(&s->gb, 3); VAR_12 = VAR_13 + (VAR_13 >= VAR_12); } if(VAR_11==4) fill_rectangle( &VAR_0->intra4x4_pred_mode_cache[ scan8[VAR_20] ], 2, 2, 8, VAR_12, 1 ); else VAR_0->intra4x4_pred_mode_cache[ scan8[VAR_20] ] = VAR_12; } 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_9= check_intra_pred_mode(VAR_0, get_ue_golomb(&s->gb)); if(VAR_9 < 0) return -1; VAR_0->chroma_pred_mode= VAR_9; }else if(VAR_2==4){ int VAR_20, VAR_14, VAR_15[4], VAR_18, VAR_17[2][4]; if(VAR_0->slice_type_nos == FF_B_TYPE){ for(VAR_20=0; VAR_20<4; VAR_20++){ VAR_0->sub_mb_type[VAR_20]= get_ue_golomb(&s->gb); if(VAR_0->sub_mb_type[VAR_20] >=13){ av_log(VAR_0->s.avctx, AV_LOG_ERROR, "B sub_mb_type %u out of range at %d %d\n", VAR_0->sub_mb_type[VAR_20], s->mb_x, s->mb_y); return -1; } VAR_15[VAR_20]= b_sub_mb_type_info[ VAR_0->sub_mb_type[VAR_20] ].VAR_2; VAR_0->sub_mb_type[VAR_20]= b_sub_mb_type_info[ VAR_0->sub_mb_type[VAR_20] ].type; } if( IS_DIRECT(VAR_0->sub_mb_type[0]) || IS_DIRECT(VAR_0->sub_mb_type[1]) || IS_DIRECT(VAR_0->sub_mb_type[2]) || IS_DIRECT(VAR_0->sub_mb_type[3])) { pred_direct_motion(VAR_0, &VAR_3); VAR_0->ref_cache[0][scan8[4]] = VAR_0->ref_cache[1][scan8[4]] = VAR_0->ref_cache[0][scan8[12]] = VAR_0->ref_cache[1][scan8[12]] = PART_NOT_AVAILABLE; } }else{ assert(VAR_0->slice_type_nos == FF_P_TYPE); for(VAR_20=0; VAR_20<4; VAR_20++){ VAR_0->sub_mb_type[VAR_20]= get_ue_golomb(&s->gb); if(VAR_0->sub_mb_type[VAR_20] >=4){ av_log(VAR_0->s.avctx, AV_LOG_ERROR, "P sub_mb_type %u out of range at %d %d\n", VAR_0->sub_mb_type[VAR_20], s->mb_x, s->mb_y); return -1; } VAR_15[VAR_20]= p_sub_mb_type_info[ VAR_0->sub_mb_type[VAR_20] ].VAR_2; VAR_0->sub_mb_type[VAR_20]= p_sub_mb_type_info[ VAR_0->sub_mb_type[VAR_20] ].type; } } for(VAR_18=0; VAR_18<VAR_0->list_count; VAR_18++){ int ref_count= IS_REF0(VAR_3) ? 1 : VAR_0->ref_count[VAR_18]; for(VAR_20=0; VAR_20<4; VAR_20++){ if(IS_DIRECT(VAR_0->sub_mb_type[VAR_20])) continue; if(IS_DIR(VAR_0->sub_mb_type[VAR_20], 0, VAR_18)){ unsigned int tmp = get_te0_golomb(&s->gb, ref_count); if(tmp>=ref_count){ av_log(VAR_0->s.avctx, AV_LOG_ERROR, "VAR_17 %u overflow\n", tmp); return -1; } VAR_17[VAR_18][VAR_20]= tmp; }else{ VAR_17[VAR_18][VAR_20] = -1; } } } if(VAR_5) VAR_5 = get_dct8x8_allowed(VAR_0); for(VAR_18=0; VAR_18<VAR_0->list_count; VAR_18++){ for(VAR_20=0; VAR_20<4; VAR_20++){ if(IS_DIRECT(VAR_0->sub_mb_type[VAR_20])) { VAR_0->ref_cache[VAR_18][ scan8[4*VAR_20] ] = VAR_0->ref_cache[VAR_18][ scan8[4*VAR_20]+1 ]; continue; } VAR_0->ref_cache[VAR_18][ scan8[4*VAR_20] ]=VAR_0->ref_cache[VAR_18][ scan8[4*VAR_20]+1 ]= VAR_0->ref_cache[VAR_18][ scan8[4*VAR_20]+8 ]=VAR_0->ref_cache[VAR_18][ scan8[4*VAR_20]+9 ]= VAR_17[VAR_18][VAR_20]; if(IS_DIR(VAR_0->sub_mb_type[VAR_20], 0, VAR_18)){ const int sub_mb_type= VAR_0->sub_mb_type[VAR_20]; const int block_width= (sub_mb_type & (MB_TYPE_16x16|MB_TYPE_16x8)) ? 2 : 1; for(VAR_14=0; VAR_14<VAR_15[VAR_20]; VAR_14++){ int VAR_18, VAR_19; const int VAR_26= 4*VAR_20 + block_width*VAR_14; int16_t (* mv_cache)[2]= &VAR_0->mv_cache[VAR_18][ scan8[VAR_26] ]; pred_motion(VAR_0, VAR_26, block_width, VAR_18, VAR_0->ref_cache[VAR_18][ scan8[VAR_26] ], &VAR_18, &VAR_19); VAR_18 += get_se_golomb(&s->gb); VAR_19 += get_se_golomb(&s->gb); tprintf(s->avctx, "final mv:%d %d\n", VAR_18, VAR_19); if(IS_SUB_8X8(sub_mb_type)){ mv_cache[ 1 ][0]= mv_cache[ 8 ][0]= mv_cache[ 9 ][0]= VAR_18; mv_cache[ 1 ][1]= mv_cache[ 8 ][1]= mv_cache[ 9 ][1]= VAR_19; }else if(IS_SUB_8X4(sub_mb_type)){ mv_cache[ 1 ][0]= VAR_18; mv_cache[ 1 ][1]= VAR_19; }else if(IS_SUB_4X8(sub_mb_type)){ mv_cache[ 8 ][0]= VAR_18; mv_cache[ 8 ][1]= VAR_19; } mv_cache[ 0 ][0]= VAR_18; mv_cache[ 0 ][1]= VAR_19; } }else{ uint32_t *p= (uint32_t *)&VAR_0->mv_cache[VAR_18][ scan8[4*VAR_20] ][0]; p[0] = p[1]= p[8] = p[9]= 0; } } } }else if(IS_DIRECT(VAR_3)){ pred_direct_motion(VAR_0, &VAR_3); VAR_5 &= VAR_0->sps.direct_8x8_inference_flag; }else{ int VAR_18, VAR_18, VAR_19, VAR_20; we should set ref_idx_l? to 0 if we use that later ... if(IS_16X16(VAR_3)){ for(VAR_18=0; VAR_18<VAR_0->list_count; VAR_18++){ unsigned int val; if(IS_DIR(VAR_3, 0, VAR_18)){ val= get_te0_golomb(&s->gb, VAR_0->ref_count[VAR_18]); if(val >= VAR_0->ref_count[VAR_18]){ av_log(VAR_0->s.avctx, AV_LOG_ERROR, "VAR_17 %u overflow\n", val); return -1; } }else val= LIST_NOT_USED&0xFF; fill_rectangle(&VAR_0->ref_cache[VAR_18][ scan8[0] ], 4, 4, 8, val, 1); } for(VAR_18=0; VAR_18<VAR_0->list_count; VAR_18++){ unsigned int val; if(IS_DIR(VAR_3, 0, VAR_18)){ pred_motion(VAR_0, 0, 4, VAR_18, VAR_0->ref_cache[VAR_18][ scan8[0] ], &VAR_18, &VAR_19); VAR_18 += get_se_golomb(&s->gb); VAR_19 += get_se_golomb(&s->gb); tprintf(s->avctx, "final mv:%d %d\n", VAR_18, VAR_19); val= pack16to32(VAR_18,VAR_19); }else val=0; fill_rectangle(VAR_0->mv_cache[VAR_18][ scan8[0] ], 4, 4, 8, val, 4); } } else if(IS_16X8(VAR_3)){ for(VAR_18=0; VAR_18<VAR_0->list_count; VAR_18++){ for(VAR_20=0; VAR_20<2; VAR_20++){ unsigned int val; if(IS_DIR(VAR_3, VAR_20, VAR_18)){ val= get_te0_golomb(&s->gb, VAR_0->ref_count[VAR_18]); if(val >= VAR_0->ref_count[VAR_18]){ av_log(VAR_0->s.avctx, AV_LOG_ERROR, "VAR_17 %u overflow\n", val); return -1; } }else val= LIST_NOT_USED&0xFF; fill_rectangle(&VAR_0->ref_cache[VAR_18][ scan8[0] + 16*VAR_20 ], 4, 2, 8, val, 1); } } for(VAR_18=0; VAR_18<VAR_0->list_count; VAR_18++){ for(VAR_20=0; VAR_20<2; VAR_20++){ unsigned int val; if(IS_DIR(VAR_3, VAR_20, VAR_18)){ pred_16x8_motion(VAR_0, 8*VAR_20, VAR_18, VAR_0->ref_cache[VAR_18][scan8[0] + 16*VAR_20], &VAR_18, &VAR_19); VAR_18 += get_se_golomb(&s->gb); VAR_19 += get_se_golomb(&s->gb); tprintf(s->avctx, "final mv:%d %d\n", VAR_18, VAR_19); val= pack16to32(VAR_18,VAR_19); }else val=0; fill_rectangle(VAR_0->mv_cache[VAR_18][ scan8[0] + 16*VAR_20 ], 4, 2, 8, val, 4); } } }else{ assert(IS_8X16(VAR_3)); for(VAR_18=0; VAR_18<VAR_0->list_count; VAR_18++){ for(VAR_20=0; VAR_20<2; VAR_20++){ unsigned int val; if(IS_DIR(VAR_3, VAR_20, VAR_18)){ optimize val= get_te0_golomb(&s->gb, VAR_0->ref_count[VAR_18]); if(val >= VAR_0->ref_count[VAR_18]){ av_log(VAR_0->s.avctx, AV_LOG_ERROR, "VAR_17 %u overflow\n", val); return -1; } }else val= LIST_NOT_USED&0xFF; fill_rectangle(&VAR_0->ref_cache[VAR_18][ scan8[0] + 2*VAR_20 ], 2, 4, 8, val, 1); } } for(VAR_18=0; VAR_18<VAR_0->list_count; VAR_18++){ for(VAR_20=0; VAR_20<2; VAR_20++){ unsigned int val; if(IS_DIR(VAR_3, VAR_20, VAR_18)){ pred_8x16_motion(VAR_0, VAR_20*4, VAR_18, VAR_0->ref_cache[VAR_18][ scan8[0] + 2*VAR_20 ], &VAR_18, &VAR_19); VAR_18 += get_se_golomb(&s->gb); VAR_19 += get_se_golomb(&s->gb); tprintf(s->avctx, "final mv:%d %d\n", VAR_18, VAR_19); val= pack16to32(VAR_18,VAR_19); }else val=0; fill_rectangle(VAR_0->mv_cache[VAR_18][ scan8[0] + 2*VAR_20 ], 2, 4, 8, val, 4); } } } } if(IS_INTER(VAR_3)) write_back_motion(VAR_0, VAR_3); if(!IS_INTRA16x16(VAR_3)){ VAR_4= get_ue_golomb(&s->gb); if(VAR_4 > 47){ av_log(VAR_0->s.avctx, AV_LOG_ERROR, "VAR_4 too large (%u) at %d %d\n", VAR_4, s->mb_x, s->mb_y); return -1; } if(IS_INTRA4x4(VAR_3)) VAR_4= golomb_to_intra4x4_cbp[VAR_4]; else VAR_4= golomb_to_inter_cbp[VAR_4]; } VAR_0->VAR_4 = VAR_4; if(VAR_5 && (VAR_4&15) && !IS_INTRA(VAR_3)){ if(get_bits1(&s->gb)) VAR_3 |= MB_TYPE_8x8DCT; } s->current_picture.VAR_3[VAR_1]= VAR_3; if(VAR_4 || IS_INTRA16x16(VAR_3)){ int VAR_20, VAR_21, VAR_22; int VAR_23; GetBitContext *gb= IS_INTRA(VAR_3) ? VAR_0->intra_gb_ptr : VAR_0->inter_gb_ptr; const uint8_t *VAR_24, *scan8x8, *dc_scan; if(IS_INTERLACED(VAR_3)){ scan8x8= s->qscale ? VAR_0->field_scan8x8_cavlc : VAR_0->field_scan8x8_cavlc_q0; VAR_24= 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_cavlc : VAR_0->zigzag_scan8x8_cavlc_q0; VAR_24= s->qscale ? VAR_0->zigzag_scan : VAR_0->zigzag_scan_q0; dc_scan= luma_dc_zigzag_scan; } VAR_23= get_se_golomb(&s->gb); if( VAR_23 > 25 || VAR_23 < -26 ){ av_log(VAR_0->s.avctx, AV_LOG_ERROR, "VAR_23 out of range (%d) at %d %d\n", VAR_23, s->mb_x, s->mb_y); return -1; } s->qscale += VAR_23; if(((unsigned)s->qscale) > 51){ if(s->qscale<0) s->qscale+= 52; else s->qscale-= 52; } VAR_0->chroma_qp[0]= get_chroma_qp(VAR_0, 0, s->qscale); VAR_0->chroma_qp[1]= get_chroma_qp(VAR_0, 1, s->qscale); if(IS_INTRA16x16(VAR_3)){ if( decode_residual(VAR_0, VAR_0->intra_gb_ptr, VAR_0->mb, LUMA_DC_BLOCK_INDEX, dc_scan, VAR_0->dequant4_coeff[0][s->qscale], 16) < 0){ return -1; continue if partitioned and other return -1 too } assert((VAR_4&15) == 0 || (VAR_4&15) == 15); if(VAR_4&15){ for(VAR_20=0; VAR_20<4; VAR_20++){ for(VAR_21=0; VAR_21<4; VAR_21++){ const int VAR_26= VAR_21 + 4*VAR_20; if( decode_residual(VAR_0, VAR_0->intra_gb_ptr, VAR_0->mb + 16*VAR_26, VAR_26, VAR_24 + 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{ for(VAR_20=0; VAR_20<4; VAR_20++){ if(VAR_4 & (1<<VAR_20)){ if(IS_8x8DCT(VAR_3)){ DCTELEM *buf = &VAR_0->mb[64*VAR_20]; uint8_t *nnz; for(VAR_21=0; VAR_21<4; VAR_21++){ if( decode_residual(VAR_0, gb, buf, VAR_21+4*VAR_20, scan8x8+16*VAR_21, VAR_0->dequant8_coeff[IS_INTRA( VAR_3 ) ? 0:1][s->qscale], 16) <0 ) return -1; } nnz= &VAR_0->non_zero_count_cache[ scan8[4*VAR_20] ]; nnz[0] += nnz[1] + nnz[8] + nnz[9]; }else{ for(VAR_21=0; VAR_21<4; VAR_21++){ const int VAR_26= VAR_21 + 4*VAR_20; if( decode_residual(VAR_0, gb, VAR_0->mb + 16*VAR_26, VAR_26, VAR_24, VAR_0->dequant4_coeff[IS_INTRA( VAR_3 ) ? 0:3][s->qscale], 16) <0 ){ return -1; } } } }else{ uint8_t * const nnz= &VAR_0->non_zero_count_cache[ scan8[4*VAR_20] ]; nnz[0] = nnz[1] = nnz[8] = nnz[9] = 0; } } } if(VAR_4&0x30){ for(VAR_22=0; VAR_22<2; VAR_22++) if( decode_residual(VAR_0, gb, VAR_0->mb + 256 + 16*4*VAR_22, CHROMA_DC_BLOCK_INDEX, chroma_dc_scan, NULL, 4) < 0){ return -1; } } if(VAR_4&0x20){ for(VAR_22=0; VAR_22<2; VAR_22++){ const uint32_t *VAR_25 = VAR_0->dequant4_coeff[VAR_22+1+(IS_INTRA( VAR_3 ) ? 0:3)][VAR_0->chroma_qp[VAR_22]]; for(VAR_21=0; VAR_21<4; VAR_21++){ const int VAR_26= 16 + 4*VAR_22 + VAR_21; if( decode_residual(VAR_0, gb, VAR_0->mb + 16*VAR_26, VAR_26, VAR_24 + 1, VAR_25, 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; } 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;", "int VAR_1;", "int VAR_2;", "unsigned int VAR_3, VAR_4;", "int VAR_5= VAR_0->pps.transform_8x8_mode;", "VAR_1 = VAR_0->VAR_1 = s->mb_x + s->mb_y*s->mb_stride;", "s->dsp.clear_blocks(VAR_0->mb);", "tprintf(s->avctx, \"pic:%d mb:%d/%d\\n\", VAR_0->frame_num, s->mb_x, s->mb_y);", "VAR_4 = 0;", "if(VAR_0->slice_type_nos != FF_I_TYPE){", "if(s->mb_skip_run==-1)\ns->mb_skip_run= get_ue_golomb(&s->gb);", "if (s->mb_skip_run--) {", "if(FRAME_MBAFF && (s->mb_y&1) == 0){", "if(s->mb_skip_run==0)\nVAR_0->mb_mbaff = VAR_0->mb_field_decoding_flag = get_bits1(&s->gb);", "else\npredict_field_decoding_flag(VAR_0);", "}", "decode_mb_skip(VAR_0);", "return 0;", "}", "}", "if(FRAME_MBAFF){", "if( (s->mb_y&1) == 0 )\nVAR_0->mb_mbaff = VAR_0->mb_field_decoding_flag = get_bits1(&s->gb);", "}else", "VAR_0->mb_field_decoding_flag= (s->picture_structure!=PICT_FRAME);", "VAR_0->prev_mb_skipped= 0;", "VAR_3= get_ue_golomb(&s->gb);", "if(VAR_0->slice_type_nos == FF_B_TYPE){", "if(VAR_3 < 23){", "VAR_2= b_mb_type_info[VAR_3].VAR_2;", "VAR_3= b_mb_type_info[VAR_3].type;", "}else{", "VAR_3 -= 23;", "goto decode_intra_mb;", "}", "}else if(VAR_0->slice_type_nos == FF_P_TYPE){", "if(VAR_3 < 5){", "VAR_2= p_mb_type_info[VAR_3].VAR_2;", "VAR_3= p_mb_type_info[VAR_3].type;", "}else{", "VAR_3 -= 5;", "goto decode_intra_mb;", "}", "}else{", "assert(VAR_0->slice_type_nos == FF_I_TYPE);", "if(VAR_0->slice_type == FF_SI_TYPE && VAR_3)\nVAR_3--;", "decode_intra_mb:\nif(VAR_3 > 25){", "av_log(VAR_0->s.avctx, AV_LOG_ERROR, \"VAR_3 %d in %c slice too large at %d %d\\n\", VAR_3, av_get_pict_type_char(VAR_0->slice_type), s->mb_x, s->mb_y);", "return -1;", "}", "VAR_2=0;", "VAR_4= i_mb_type_info[VAR_3].VAR_4;", "VAR_0->intra16x16_pred_mode= i_mb_type_info[VAR_3].VAR_9;", "VAR_3= i_mb_type_info[VAR_3].type;", "}", "if(MB_FIELD)\nVAR_3 |= MB_TYPE_INTERLACED;", "VAR_0->slice_table[ VAR_1 ]= VAR_0->slice_num;", "if(IS_INTRA_PCM(VAR_3)){", "unsigned int VAR_6, VAR_7;", "align_get_bits(&s->gb);", "for(VAR_7=0; VAR_7<16; VAR_7++){", "const int VAR_26= 4*(VAR_7&3) + 32*((VAR_7>>2)&1) + 128*(VAR_7>>3);", "for(VAR_6=0; VAR_6<16; VAR_6++){", "tprintf(s->avctx, \"LUMA ICPM LEVEL (%3d)\\n\", show_bits(&s->gb, 8));", "VAR_0->mb[VAR_26 + (VAR_6&3) + 16*((VAR_6>>2)&1) + 64*(VAR_6>>3)]= get_bits(&s->gb, 8);", "}", "}", "for(VAR_7=0; VAR_7<8; VAR_7++){", "const int VAR_26= 256 + 4*(VAR_7&3) + 32*(VAR_7>>2);", "for(VAR_6=0; VAR_6<8; VAR_6++){", "tprintf(s->avctx, \"CHROMA U ICPM LEVEL (%3d)\\n\", show_bits(&s->gb, 8));", "VAR_0->mb[VAR_26 + (VAR_6&3) + 16*(VAR_6>>2)]= get_bits(&s->gb, 8);", "}", "}", "for(VAR_7=0; VAR_7<8; VAR_7++){", "const int VAR_26= 256 + 64 + 4*(VAR_7&3) + 32*(VAR_7>>2);", "for(VAR_6=0; VAR_6<8; VAR_6++){", "tprintf(s->avctx, \"CHROMA V ICPM LEVEL (%3d)\\n\", show_bits(&s->gb, 8));", "VAR_0->mb[VAR_26 + (VAR_6&3) + 16*(VAR_6>>2)]= get_bits(&s->gb, 8);", "}", "}", "s->current_picture.qscale_table[VAR_1]= 0;", "memset(VAR_0->non_zero_count[VAR_1], 16, 16);", "s->current_picture.VAR_3[VAR_1]= VAR_3;", "return 0;", "}", "if(MB_MBAFF){", "VAR_0->ref_count[0] <<= 1;", "VAR_0->ref_count[1] <<= 1;", "}", "fill_caches(VAR_0, VAR_3, 0);", "if(IS_INTRA(VAR_3)){", "int VAR_9;", "if(IS_INTRA4x4(VAR_3)){", "int VAR_20;", "int VAR_11 = 1;", "if(VAR_5 && get_bits1(&s->gb)){", "VAR_3 |= MB_TYPE_8x8DCT;", "VAR_11 = 4;", "}", "for(VAR_20=0; VAR_20<16; VAR_20+=VAR_11){", "int VAR_12= pred_intra_mode(VAR_0, VAR_20);", "if(!get_bits1(&s->gb)){", "const int VAR_13= get_bits(&s->gb, 3);", "VAR_12 = VAR_13 + (VAR_13 >= VAR_12);", "}", "if(VAR_11==4)\nfill_rectangle( &VAR_0->intra4x4_pred_mode_cache[ scan8[VAR_20] ], 2, 2, 8, VAR_12, 1 );", "else\nVAR_0->intra4x4_pred_mode_cache[ scan8[VAR_20] ] = VAR_12;", "}", "write_back_intra_pred_mode(VAR_0);", "if( check_intra4x4_pred_mode(VAR_0) < 0)\nreturn -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)\nreturn -1;", "}", "VAR_9= check_intra_pred_mode(VAR_0, get_ue_golomb(&s->gb));", "if(VAR_9 < 0)\nreturn -1;", "VAR_0->chroma_pred_mode= VAR_9;", "}else if(VAR_2==4){", "int VAR_20, VAR_14, VAR_15[4], VAR_18, VAR_17[2][4];", "if(VAR_0->slice_type_nos == FF_B_TYPE){", "for(VAR_20=0; VAR_20<4; VAR_20++){", "VAR_0->sub_mb_type[VAR_20]= get_ue_golomb(&s->gb);", "if(VAR_0->sub_mb_type[VAR_20] >=13){", "av_log(VAR_0->s.avctx, AV_LOG_ERROR, \"B sub_mb_type %u out of range at %d %d\\n\", VAR_0->sub_mb_type[VAR_20], s->mb_x, s->mb_y);", "return -1;", "}", "VAR_15[VAR_20]= b_sub_mb_type_info[ VAR_0->sub_mb_type[VAR_20] ].VAR_2;", "VAR_0->sub_mb_type[VAR_20]= b_sub_mb_type_info[ VAR_0->sub_mb_type[VAR_20] ].type;", "}", "if( IS_DIRECT(VAR_0->sub_mb_type[0]) || IS_DIRECT(VAR_0->sub_mb_type[1])\n|| IS_DIRECT(VAR_0->sub_mb_type[2]) || IS_DIRECT(VAR_0->sub_mb_type[3])) {", "pred_direct_motion(VAR_0, &VAR_3);", "VAR_0->ref_cache[0][scan8[4]] =\nVAR_0->ref_cache[1][scan8[4]] =\nVAR_0->ref_cache[0][scan8[12]] =\nVAR_0->ref_cache[1][scan8[12]] = PART_NOT_AVAILABLE;", "}", "}else{", "assert(VAR_0->slice_type_nos == FF_P_TYPE);", "for(VAR_20=0; VAR_20<4; VAR_20++){", "VAR_0->sub_mb_type[VAR_20]= get_ue_golomb(&s->gb);", "if(VAR_0->sub_mb_type[VAR_20] >=4){", "av_log(VAR_0->s.avctx, AV_LOG_ERROR, \"P sub_mb_type %u out of range at %d %d\\n\", VAR_0->sub_mb_type[VAR_20], s->mb_x, s->mb_y);", "return -1;", "}", "VAR_15[VAR_20]= p_sub_mb_type_info[ VAR_0->sub_mb_type[VAR_20] ].VAR_2;", "VAR_0->sub_mb_type[VAR_20]= p_sub_mb_type_info[ VAR_0->sub_mb_type[VAR_20] ].type;", "}", "}", "for(VAR_18=0; VAR_18<VAR_0->list_count; VAR_18++){", "int ref_count= IS_REF0(VAR_3) ? 1 : VAR_0->ref_count[VAR_18];", "for(VAR_20=0; VAR_20<4; VAR_20++){", "if(IS_DIRECT(VAR_0->sub_mb_type[VAR_20])) continue;", "if(IS_DIR(VAR_0->sub_mb_type[VAR_20], 0, VAR_18)){", "unsigned int tmp = get_te0_golomb(&s->gb, ref_count);", "if(tmp>=ref_count){", "av_log(VAR_0->s.avctx, AV_LOG_ERROR, \"VAR_17 %u overflow\\n\", tmp);", "return -1;", "}", "VAR_17[VAR_18][VAR_20]= tmp;", "}else{", "VAR_17[VAR_18][VAR_20] = -1;", "}", "}", "}", "if(VAR_5)\nVAR_5 = get_dct8x8_allowed(VAR_0);", "for(VAR_18=0; VAR_18<VAR_0->list_count; VAR_18++){", "for(VAR_20=0; VAR_20<4; VAR_20++){", "if(IS_DIRECT(VAR_0->sub_mb_type[VAR_20])) {", "VAR_0->ref_cache[VAR_18][ scan8[4*VAR_20] ] = VAR_0->ref_cache[VAR_18][ scan8[4*VAR_20]+1 ];", "continue;", "}", "VAR_0->ref_cache[VAR_18][ scan8[4*VAR_20] ]=VAR_0->ref_cache[VAR_18][ scan8[4*VAR_20]+1 ]=\nVAR_0->ref_cache[VAR_18][ scan8[4*VAR_20]+8 ]=VAR_0->ref_cache[VAR_18][ scan8[4*VAR_20]+9 ]= VAR_17[VAR_18][VAR_20];", "if(IS_DIR(VAR_0->sub_mb_type[VAR_20], 0, VAR_18)){", "const int sub_mb_type= VAR_0->sub_mb_type[VAR_20];", "const int block_width= (sub_mb_type & (MB_TYPE_16x16|MB_TYPE_16x8)) ? 2 : 1;", "for(VAR_14=0; VAR_14<VAR_15[VAR_20]; VAR_14++){", "int VAR_18, VAR_19;", "const int VAR_26= 4*VAR_20 + block_width*VAR_14;", "int16_t (* mv_cache)[2]= &VAR_0->mv_cache[VAR_18][ scan8[VAR_26] ];", "pred_motion(VAR_0, VAR_26, block_width, VAR_18, VAR_0->ref_cache[VAR_18][ scan8[VAR_26] ], &VAR_18, &VAR_19);", "VAR_18 += get_se_golomb(&s->gb);", "VAR_19 += get_se_golomb(&s->gb);", "tprintf(s->avctx, \"final mv:%d %d\\n\", VAR_18, VAR_19);", "if(IS_SUB_8X8(sub_mb_type)){", "mv_cache[ 1 ][0]=\nmv_cache[ 8 ][0]= mv_cache[ 9 ][0]= VAR_18;", "mv_cache[ 1 ][1]=\nmv_cache[ 8 ][1]= mv_cache[ 9 ][1]= VAR_19;", "}else if(IS_SUB_8X4(sub_mb_type)){", "mv_cache[ 1 ][0]= VAR_18;", "mv_cache[ 1 ][1]= VAR_19;", "}else if(IS_SUB_4X8(sub_mb_type)){", "mv_cache[ 8 ][0]= VAR_18;", "mv_cache[ 8 ][1]= VAR_19;", "}", "mv_cache[ 0 ][0]= VAR_18;", "mv_cache[ 0 ][1]= VAR_19;", "}", "}else{", "uint32_t *p= (uint32_t *)&VAR_0->mv_cache[VAR_18][ scan8[4*VAR_20] ][0];", "p[0] = p[1]=\np[8] = p[9]= 0;", "}", "}", "}", "}else if(IS_DIRECT(VAR_3)){", "pred_direct_motion(VAR_0, &VAR_3);", "VAR_5 &= VAR_0->sps.direct_8x8_inference_flag;", "}else{", "int VAR_18, VAR_18, VAR_19, VAR_20;", "we should set ref_idx_l? to 0 if we use that later ...\nif(IS_16X16(VAR_3)){", "for(VAR_18=0; VAR_18<VAR_0->list_count; VAR_18++){", "unsigned int val;", "if(IS_DIR(VAR_3, 0, VAR_18)){", "val= get_te0_golomb(&s->gb, VAR_0->ref_count[VAR_18]);", "if(val >= VAR_0->ref_count[VAR_18]){", "av_log(VAR_0->s.avctx, AV_LOG_ERROR, \"VAR_17 %u overflow\\n\", val);", "return -1;", "}", "}else", "val= LIST_NOT_USED&0xFF;", "fill_rectangle(&VAR_0->ref_cache[VAR_18][ scan8[0] ], 4, 4, 8, val, 1);", "}", "for(VAR_18=0; VAR_18<VAR_0->list_count; VAR_18++){", "unsigned int val;", "if(IS_DIR(VAR_3, 0, VAR_18)){", "pred_motion(VAR_0, 0, 4, VAR_18, VAR_0->ref_cache[VAR_18][ scan8[0] ], &VAR_18, &VAR_19);", "VAR_18 += get_se_golomb(&s->gb);", "VAR_19 += get_se_golomb(&s->gb);", "tprintf(s->avctx, \"final mv:%d %d\\n\", VAR_18, VAR_19);", "val= pack16to32(VAR_18,VAR_19);", "}else", "val=0;", "fill_rectangle(VAR_0->mv_cache[VAR_18][ scan8[0] ], 4, 4, 8, val, 4);", "}", "}", "else if(IS_16X8(VAR_3)){", "for(VAR_18=0; VAR_18<VAR_0->list_count; VAR_18++){", "for(VAR_20=0; VAR_20<2; VAR_20++){", "unsigned int val;", "if(IS_DIR(VAR_3, VAR_20, VAR_18)){", "val= get_te0_golomb(&s->gb, VAR_0->ref_count[VAR_18]);", "if(val >= VAR_0->ref_count[VAR_18]){", "av_log(VAR_0->s.avctx, AV_LOG_ERROR, \"VAR_17 %u overflow\\n\", val);", "return -1;", "}", "}else", "val= LIST_NOT_USED&0xFF;", "fill_rectangle(&VAR_0->ref_cache[VAR_18][ scan8[0] + 16*VAR_20 ], 4, 2, 8, val, 1);", "}", "}", "for(VAR_18=0; VAR_18<VAR_0->list_count; VAR_18++){", "for(VAR_20=0; VAR_20<2; VAR_20++){", "unsigned int val;", "if(IS_DIR(VAR_3, VAR_20, VAR_18)){", "pred_16x8_motion(VAR_0, 8*VAR_20, VAR_18, VAR_0->ref_cache[VAR_18][scan8[0] + 16*VAR_20], &VAR_18, &VAR_19);", "VAR_18 += get_se_golomb(&s->gb);", "VAR_19 += get_se_golomb(&s->gb);", "tprintf(s->avctx, \"final mv:%d %d\\n\", VAR_18, VAR_19);", "val= pack16to32(VAR_18,VAR_19);", "}else", "val=0;", "fill_rectangle(VAR_0->mv_cache[VAR_18][ scan8[0] + 16*VAR_20 ], 4, 2, 8, val, 4);", "}", "}", "}else{", "assert(IS_8X16(VAR_3));", "for(VAR_18=0; VAR_18<VAR_0->list_count; VAR_18++){", "for(VAR_20=0; VAR_20<2; VAR_20++){", "unsigned int val;", "if(IS_DIR(VAR_3, VAR_20, VAR_18)){ optimize", "val= get_te0_golomb(&s->gb, VAR_0->ref_count[VAR_18]);", "if(val >= VAR_0->ref_count[VAR_18]){", "av_log(VAR_0->s.avctx, AV_LOG_ERROR, \"VAR_17 %u overflow\\n\", val);", "return -1;", "}", "}else", "val= LIST_NOT_USED&0xFF;", "fill_rectangle(&VAR_0->ref_cache[VAR_18][ scan8[0] + 2*VAR_20 ], 2, 4, 8, val, 1);", "}", "}", "for(VAR_18=0; VAR_18<VAR_0->list_count; VAR_18++){", "for(VAR_20=0; VAR_20<2; VAR_20++){", "unsigned int val;", "if(IS_DIR(VAR_3, VAR_20, VAR_18)){", "pred_8x16_motion(VAR_0, VAR_20*4, VAR_18, VAR_0->ref_cache[VAR_18][ scan8[0] + 2*VAR_20 ], &VAR_18, &VAR_19);", "VAR_18 += get_se_golomb(&s->gb);", "VAR_19 += get_se_golomb(&s->gb);", "tprintf(s->avctx, \"final mv:%d %d\\n\", VAR_18, VAR_19);", "val= pack16to32(VAR_18,VAR_19);", "}else", "val=0;", "fill_rectangle(VAR_0->mv_cache[VAR_18][ scan8[0] + 2*VAR_20 ], 2, 4, 8, val, 4);", "}", "}", "}", "}", "if(IS_INTER(VAR_3))\nwrite_back_motion(VAR_0, VAR_3);", "if(!IS_INTRA16x16(VAR_3)){", "VAR_4= get_ue_golomb(&s->gb);", "if(VAR_4 > 47){", "av_log(VAR_0->s.avctx, AV_LOG_ERROR, \"VAR_4 too large (%u) at %d %d\\n\", VAR_4, s->mb_x, s->mb_y);", "return -1;", "}", "if(IS_INTRA4x4(VAR_3))\nVAR_4= golomb_to_intra4x4_cbp[VAR_4];", "else\nVAR_4= golomb_to_inter_cbp[VAR_4];", "}", "VAR_0->VAR_4 = VAR_4;", "if(VAR_5 && (VAR_4&15) && !IS_INTRA(VAR_3)){", "if(get_bits1(&s->gb))\nVAR_3 |= MB_TYPE_8x8DCT;", "}", "s->current_picture.VAR_3[VAR_1]= VAR_3;", "if(VAR_4 || IS_INTRA16x16(VAR_3)){", "int VAR_20, VAR_21, VAR_22;", "int VAR_23;", "GetBitContext *gb= IS_INTRA(VAR_3) ? VAR_0->intra_gb_ptr : VAR_0->inter_gb_ptr;", "const uint8_t *VAR_24, *scan8x8, *dc_scan;", "if(IS_INTERLACED(VAR_3)){", "scan8x8= s->qscale ? VAR_0->field_scan8x8_cavlc : VAR_0->field_scan8x8_cavlc_q0;", "VAR_24= 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_cavlc : VAR_0->zigzag_scan8x8_cavlc_q0;", "VAR_24= s->qscale ? VAR_0->zigzag_scan : VAR_0->zigzag_scan_q0;", "dc_scan= luma_dc_zigzag_scan;", "}", "VAR_23= get_se_golomb(&s->gb);", "if( VAR_23 > 25 || VAR_23 < -26 ){", "av_log(VAR_0->s.avctx, AV_LOG_ERROR, \"VAR_23 out of range (%d) at %d %d\\n\", VAR_23, s->mb_x, s->mb_y);", "return -1;", "}", "s->qscale += VAR_23;", "if(((unsigned)s->qscale) > 51){", "if(s->qscale<0) s->qscale+= 52;", "else s->qscale-= 52;", "}", "VAR_0->chroma_qp[0]= get_chroma_qp(VAR_0, 0, s->qscale);", "VAR_0->chroma_qp[1]= get_chroma_qp(VAR_0, 1, s->qscale);", "if(IS_INTRA16x16(VAR_3)){", "if( decode_residual(VAR_0, VAR_0->intra_gb_ptr, VAR_0->mb, LUMA_DC_BLOCK_INDEX, dc_scan, VAR_0->dequant4_coeff[0][s->qscale], 16) < 0){", "return -1; continue if partitioned and other return -1 too", "}", "assert((VAR_4&15) == 0 || (VAR_4&15) == 15);", "if(VAR_4&15){", "for(VAR_20=0; VAR_20<4; VAR_20++){", "for(VAR_21=0; VAR_21<4; VAR_21++){", "const int VAR_26= VAR_21 + 4*VAR_20;", "if( decode_residual(VAR_0, VAR_0->intra_gb_ptr, VAR_0->mb + 16*VAR_26, VAR_26, VAR_24 + 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{", "for(VAR_20=0; VAR_20<4; VAR_20++){", "if(VAR_4 & (1<<VAR_20)){", "if(IS_8x8DCT(VAR_3)){", "DCTELEM *buf = &VAR_0->mb[64*VAR_20];", "uint8_t *nnz;", "for(VAR_21=0; VAR_21<4; VAR_21++){", "if( decode_residual(VAR_0, gb, buf, VAR_21+4*VAR_20, scan8x8+16*VAR_21,\nVAR_0->dequant8_coeff[IS_INTRA( VAR_3 ) ? 0:1][s->qscale], 16) <0 )\nreturn -1;", "}", "nnz= &VAR_0->non_zero_count_cache[ scan8[4*VAR_20] ];", "nnz[0] += nnz[1] + nnz[8] + nnz[9];", "}else{", "for(VAR_21=0; VAR_21<4; VAR_21++){", "const int VAR_26= VAR_21 + 4*VAR_20;", "if( decode_residual(VAR_0, gb, VAR_0->mb + 16*VAR_26, VAR_26, VAR_24, VAR_0->dequant4_coeff[IS_INTRA( VAR_3 ) ? 0:3][s->qscale], 16) <0 ){", "return -1;", "}", "}", "}", "}else{", "uint8_t * const nnz= &VAR_0->non_zero_count_cache[ scan8[4*VAR_20] ];", "nnz[0] = nnz[1] = nnz[8] = nnz[9] = 0;", "}", "}", "}", "if(VAR_4&0x30){", "for(VAR_22=0; VAR_22<2; VAR_22++)", "if( decode_residual(VAR_0, gb, VAR_0->mb + 256 + 16*4*VAR_22, CHROMA_DC_BLOCK_INDEX, chroma_dc_scan, NULL, 4) < 0){", "return -1;", "}", "}", "if(VAR_4&0x20){", "for(VAR_22=0; VAR_22<2; VAR_22++){", "const uint32_t *VAR_25 = VAR_0->dequant4_coeff[VAR_22+1+(IS_INTRA( VAR_3 ) ? 0:3)][VAR_0->chroma_qp[VAR_22]];", "for(VAR_21=0; VAR_21<4; VAR_21++){", "const int VAR_26= 16 + 4*VAR_22 + VAR_21;", "if( decode_residual(VAR_0, gb, VAR_0->mb + 16*VAR_26, VAR_26, VAR_24 + 1, VAR_25, 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 ] =\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;", "}", "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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 19 ], [ 23 ], [ 25 ], [ 29 ], [ 31, 33 ], [ 37 ], [ 39 ], [ 41, 43 ], [ 45, 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61, 63 ], [ 65 ], [ 67 ], [ 71 ], [ 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 ], [ 139, 141 ], [ 145 ], [ 149 ], [ 151 ], [ 157 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 209 ], [ 213 ], [ 217 ], [ 219 ], [ 221 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 235 ], [ 241 ], [ 243 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 265 ], [ 267 ], [ 271 ], [ 273 ], [ 275 ], [ 277 ], [ 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 ], [ 369 ], [ 371 ], [ 373 ], [ 375 ], [ 377 ], [ 379 ], [ 381 ], [ 385 ], [ 387 ], [ 389 ], [ 391 ], [ 393 ], [ 395 ], [ 397 ], [ 399 ], [ 401 ], [ 403 ], [ 405 ], [ 407 ], [ 411 ], [ 413 ], [ 415 ], [ 417 ], [ 421, 423 ], [ 427 ], [ 429 ], [ 431 ], [ 433 ], [ 435 ], [ 437 ], [ 439, 441 ], [ 445 ], [ 447 ], [ 449 ], [ 451 ], [ 453 ], [ 455 ], [ 457 ], [ 459 ], [ 461 ], [ 463 ], [ 465 ], [ 469 ], [ 471, 473 ], [ 475, 477 ], [ 479 ], [ 481 ], [ 483 ], [ 485 ], [ 487 ], [ 489 ], [ 491 ], [ 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 ], [ 553 ], [ 555 ], [ 557 ], [ 559 ], [ 561 ], [ 563 ], [ 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 ], [ 627 ], [ 629 ], [ 631 ], [ 633 ], [ 635 ], [ 637 ], [ 639 ], [ 641 ], [ 643 ], [ 645 ], [ 647 ], [ 649 ], [ 651 ], [ 653 ], [ 655 ], [ 657 ], [ 659 ], [ 661 ], [ 663 ], [ 665 ], [ 667 ], [ 669 ], [ 671 ], [ 673 ], [ 675 ], [ 677 ], [ 679 ], [ 681 ], [ 683 ], [ 685 ], [ 689 ], [ 691 ], [ 693 ], [ 695 ], [ 697 ], [ 699 ], [ 701 ], [ 703 ], [ 707, 709 ], [ 713 ], [ 715 ], [ 717 ], [ 719 ], [ 721 ], [ 723 ], [ 727, 729 ], [ 731, 733 ], [ 735 ], [ 737 ], [ 741 ], [ 743, 745 ], [ 747 ], [ 749 ], [ 753 ], [ 755 ], [ 757 ], [ 759 ], [ 761 ], [ 769 ], [ 771 ], [ 773 ], [ 775 ], [ 777 ], [ 779 ], [ 781 ], [ 783 ], [ 785 ], [ 789 ], [ 793 ], [ 795 ], [ 797 ], [ 799 ], [ 803 ], [ 805 ], [ 807 ], [ 809 ], [ 811 ], [ 815 ], [ 817 ], [ 819 ], [ 821 ], [ 823 ], [ 825 ], [ 829 ], [ 833 ], [ 835 ], [ 837 ], [ 839 ], [ 841 ], [ 843 ], [ 845 ], [ 847 ], [ 849 ], [ 851 ], [ 853 ], [ 855 ], [ 857 ], [ 859 ], [ 861 ], [ 863 ], [ 865 ], [ 867 ], [ 869 ], [ 871, 873, 875 ], [ 877 ], [ 879 ], [ 881 ], [ 883 ], [ 885 ], [ 887 ], [ 891 ], [ 893 ], [ 895 ], [ 897 ], [ 899 ], [ 901 ], [ 903 ], [ 905 ], [ 907 ], [ 909 ], [ 911 ], [ 915 ], [ 917 ], [ 919 ], [ 921 ], [ 923 ], [ 925 ], [ 929 ], [ 931 ], [ 933 ], [ 935 ], [ 937 ], [ 939 ], [ 941 ], [ 943 ], [ 945 ], [ 947 ], [ 949 ], [ 951 ], [ 953, 955 ], [ 957 ], [ 959 ], [ 961 ], [ 963 ], [ 965, 967 ], [ 969 ], [ 971 ], [ 973 ], [ 977 ], [ 979 ], [ 981 ], [ 983 ], [ 987 ], [ 989 ] ]
17,920
static int read_dct_coeffs(GetBitContext *gb, int32_t block[64], const uint8_t *scan, const int32_t quant_matrices[16][64], int q) { int coef_list[128]; int mode_list[128]; int i, t, mask, bits, ccoef, mode, sign; int list_start = 64, list_end = 64, list_pos; int coef_count = 0; int coef_idx[64]; int quant_idx; const int32_t *quant; coef_list[list_end] = 4; mode_list[list_end++] = 0; coef_list[list_end] = 24; mode_list[list_end++] = 0; coef_list[list_end] = 44; mode_list[list_end++] = 0; coef_list[list_end] = 1; mode_list[list_end++] = 3; coef_list[list_end] = 2; mode_list[list_end++] = 3; coef_list[list_end] = 3; mode_list[list_end++] = 3; bits = get_bits(gb, 4) - 1; for (mask = 1 << bits; bits >= 0; mask >>= 1, bits--) { list_pos = list_start; while (list_pos < list_end) { if (!(mode_list[list_pos] | coef_list[list_pos]) || !get_bits1(gb)) { list_pos++; continue; } ccoef = coef_list[list_pos]; mode = mode_list[list_pos]; switch (mode) { case 0: coef_list[list_pos] = ccoef + 4; mode_list[list_pos] = 1; case 2: if (mode == 2) { coef_list[list_pos] = 0; mode_list[list_pos++] = 0; } for (i = 0; i < 4; i++, ccoef++) { if (get_bits1(gb)) { coef_list[--list_start] = ccoef; mode_list[ list_start] = 3; } else { if (!bits) { t = 1 - (get_bits1(gb) << 1); } else { t = get_bits(gb, bits) | mask; sign = -get_bits1(gb); t = (t ^ sign) - sign; } block[scan[ccoef]] = t; coef_idx[coef_count++] = ccoef; } } break; case 1: mode_list[list_pos] = 2; for (i = 0; i < 3; i++) { ccoef += 4; coef_list[list_end] = ccoef; mode_list[list_end++] = 2; } break; case 3: if (!bits) { t = 1 - (get_bits1(gb) << 1); } else { t = get_bits(gb, bits) | mask; sign = -get_bits1(gb); t = (t ^ sign) - sign; } block[scan[ccoef]] = t; coef_idx[coef_count++] = ccoef; coef_list[list_pos] = 0; mode_list[list_pos++] = 0; break; } } } if (q == -1) { quant_idx = get_bits(gb, 4); } else { quant_idx = q; } quant = quant_matrices[quant_idx]; block[0] = (block[0] * quant[0]) >> 11; for (i = 0; i < coef_count; i++) { int idx = coef_idx[i]; block[scan[idx]] = (block[scan[idx]] * quant[idx]) >> 11; } return 0; }
false
FFmpeg
3f5d6a665aba439a9309ed735e71403d236a313d
static int read_dct_coeffs(GetBitContext *gb, int32_t block[64], const uint8_t *scan, const int32_t quant_matrices[16][64], int q) { int coef_list[128]; int mode_list[128]; int i, t, mask, bits, ccoef, mode, sign; int list_start = 64, list_end = 64, list_pos; int coef_count = 0; int coef_idx[64]; int quant_idx; const int32_t *quant; coef_list[list_end] = 4; mode_list[list_end++] = 0; coef_list[list_end] = 24; mode_list[list_end++] = 0; coef_list[list_end] = 44; mode_list[list_end++] = 0; coef_list[list_end] = 1; mode_list[list_end++] = 3; coef_list[list_end] = 2; mode_list[list_end++] = 3; coef_list[list_end] = 3; mode_list[list_end++] = 3; bits = get_bits(gb, 4) - 1; for (mask = 1 << bits; bits >= 0; mask >>= 1, bits--) { list_pos = list_start; while (list_pos < list_end) { if (!(mode_list[list_pos] | coef_list[list_pos]) || !get_bits1(gb)) { list_pos++; continue; } ccoef = coef_list[list_pos]; mode = mode_list[list_pos]; switch (mode) { case 0: coef_list[list_pos] = ccoef + 4; mode_list[list_pos] = 1; case 2: if (mode == 2) { coef_list[list_pos] = 0; mode_list[list_pos++] = 0; } for (i = 0; i < 4; i++, ccoef++) { if (get_bits1(gb)) { coef_list[--list_start] = ccoef; mode_list[ list_start] = 3; } else { if (!bits) { t = 1 - (get_bits1(gb) << 1); } else { t = get_bits(gb, bits) | mask; sign = -get_bits1(gb); t = (t ^ sign) - sign; } block[scan[ccoef]] = t; coef_idx[coef_count++] = ccoef; } } break; case 1: mode_list[list_pos] = 2; for (i = 0; i < 3; i++) { ccoef += 4; coef_list[list_end] = ccoef; mode_list[list_end++] = 2; } break; case 3: if (!bits) { t = 1 - (get_bits1(gb) << 1); } else { t = get_bits(gb, bits) | mask; sign = -get_bits1(gb); t = (t ^ sign) - sign; } block[scan[ccoef]] = t; coef_idx[coef_count++] = ccoef; coef_list[list_pos] = 0; mode_list[list_pos++] = 0; break; } } } if (q == -1) { quant_idx = get_bits(gb, 4); } else { quant_idx = q; } quant = quant_matrices[quant_idx]; block[0] = (block[0] * quant[0]) >> 11; for (i = 0; i < coef_count; i++) { int idx = coef_idx[i]; block[scan[idx]] = (block[scan[idx]] * quant[idx]) >> 11; } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(GetBitContext *VAR_0, int32_t VAR_1[64], const uint8_t *VAR_2, const int32_t VAR_3[16][64], int VAR_4) { int VAR_5[128]; int VAR_6[128]; int VAR_7, VAR_8, VAR_9, VAR_10, VAR_11, VAR_12, VAR_13; int VAR_14 = 64, VAR_15 = 64, VAR_16; int VAR_17 = 0; int VAR_18[64]; int VAR_19; const int32_t *VAR_20; VAR_5[VAR_15] = 4; VAR_6[VAR_15++] = 0; VAR_5[VAR_15] = 24; VAR_6[VAR_15++] = 0; VAR_5[VAR_15] = 44; VAR_6[VAR_15++] = 0; VAR_5[VAR_15] = 1; VAR_6[VAR_15++] = 3; VAR_5[VAR_15] = 2; VAR_6[VAR_15++] = 3; VAR_5[VAR_15] = 3; VAR_6[VAR_15++] = 3; VAR_10 = get_bits(VAR_0, 4) - 1; for (VAR_9 = 1 << VAR_10; VAR_10 >= 0; VAR_9 >>= 1, VAR_10--) { VAR_16 = VAR_14; while (VAR_16 < VAR_15) { if (!(VAR_6[VAR_16] | VAR_5[VAR_16]) || !get_bits1(VAR_0)) { VAR_16++; continue; } VAR_11 = VAR_5[VAR_16]; VAR_12 = VAR_6[VAR_16]; switch (VAR_12) { case 0: VAR_5[VAR_16] = VAR_11 + 4; VAR_6[VAR_16] = 1; case 2: if (VAR_12 == 2) { VAR_5[VAR_16] = 0; VAR_6[VAR_16++] = 0; } for (VAR_7 = 0; VAR_7 < 4; VAR_7++, VAR_11++) { if (get_bits1(VAR_0)) { VAR_5[--VAR_14] = VAR_11; VAR_6[ VAR_14] = 3; } else { if (!VAR_10) { VAR_8 = 1 - (get_bits1(VAR_0) << 1); } else { VAR_8 = get_bits(VAR_0, VAR_10) | VAR_9; VAR_13 = -get_bits1(VAR_0); VAR_8 = (VAR_8 ^ VAR_13) - VAR_13; } VAR_1[VAR_2[VAR_11]] = VAR_8; VAR_18[VAR_17++] = VAR_11; } } break; case 1: VAR_6[VAR_16] = 2; for (VAR_7 = 0; VAR_7 < 3; VAR_7++) { VAR_11 += 4; VAR_5[VAR_15] = VAR_11; VAR_6[VAR_15++] = 2; } break; case 3: if (!VAR_10) { VAR_8 = 1 - (get_bits1(VAR_0) << 1); } else { VAR_8 = get_bits(VAR_0, VAR_10) | VAR_9; VAR_13 = -get_bits1(VAR_0); VAR_8 = (VAR_8 ^ VAR_13) - VAR_13; } VAR_1[VAR_2[VAR_11]] = VAR_8; VAR_18[VAR_17++] = VAR_11; VAR_5[VAR_16] = 0; VAR_6[VAR_16++] = 0; break; } } } if (VAR_4 == -1) { VAR_19 = get_bits(VAR_0, 4); } else { VAR_19 = VAR_4; } VAR_20 = VAR_3[VAR_19]; VAR_1[0] = (VAR_1[0] * VAR_20[0]) >> 11; for (VAR_7 = 0; VAR_7 < VAR_17; VAR_7++) { int VAR_21 = VAR_18[VAR_7]; VAR_1[VAR_2[VAR_21]] = (VAR_1[VAR_2[VAR_21]] * VAR_20[VAR_21]) >> 11; } return 0; }
[ "static int FUNC_0(GetBitContext *VAR_0, int32_t VAR_1[64], const uint8_t *VAR_2,\nconst int32_t VAR_3[16][64], int VAR_4)\n{", "int VAR_5[128];", "int VAR_6[128];", "int VAR_7, VAR_8, VAR_9, VAR_10, VAR_11, VAR_12, VAR_13;", "int VAR_14 = 64, VAR_15 = 64, VAR_16;", "int VAR_17 = 0;", "int VAR_18[64];", "int VAR_19;", "const int32_t *VAR_20;", "VAR_5[VAR_15] = 4; VAR_6[VAR_15++] = 0;", "VAR_5[VAR_15] = 24; VAR_6[VAR_15++] = 0;", "VAR_5[VAR_15] = 44; VAR_6[VAR_15++] = 0;", "VAR_5[VAR_15] = 1; VAR_6[VAR_15++] = 3;", "VAR_5[VAR_15] = 2; VAR_6[VAR_15++] = 3;", "VAR_5[VAR_15] = 3; VAR_6[VAR_15++] = 3;", "VAR_10 = get_bits(VAR_0, 4) - 1;", "for (VAR_9 = 1 << VAR_10; VAR_10 >= 0; VAR_9 >>= 1, VAR_10--) {", "VAR_16 = VAR_14;", "while (VAR_16 < VAR_15) {", "if (!(VAR_6[VAR_16] | VAR_5[VAR_16]) || !get_bits1(VAR_0)) {", "VAR_16++;", "continue;", "}", "VAR_11 = VAR_5[VAR_16];", "VAR_12 = VAR_6[VAR_16];", "switch (VAR_12) {", "case 0:\nVAR_5[VAR_16] = VAR_11 + 4;", "VAR_6[VAR_16] = 1;", "case 2:\nif (VAR_12 == 2) {", "VAR_5[VAR_16] = 0;", "VAR_6[VAR_16++] = 0;", "}", "for (VAR_7 = 0; VAR_7 < 4; VAR_7++, VAR_11++) {", "if (get_bits1(VAR_0)) {", "VAR_5[--VAR_14] = VAR_11;", "VAR_6[ VAR_14] = 3;", "} else {", "if (!VAR_10) {", "VAR_8 = 1 - (get_bits1(VAR_0) << 1);", "} else {", "VAR_8 = get_bits(VAR_0, VAR_10) | VAR_9;", "VAR_13 = -get_bits1(VAR_0);", "VAR_8 = (VAR_8 ^ VAR_13) - VAR_13;", "}", "VAR_1[VAR_2[VAR_11]] = VAR_8;", "VAR_18[VAR_17++] = VAR_11;", "}", "}", "break;", "case 1:\nVAR_6[VAR_16] = 2;", "for (VAR_7 = 0; VAR_7 < 3; VAR_7++) {", "VAR_11 += 4;", "VAR_5[VAR_15] = VAR_11;", "VAR_6[VAR_15++] = 2;", "}", "break;", "case 3:\nif (!VAR_10) {", "VAR_8 = 1 - (get_bits1(VAR_0) << 1);", "} else {", "VAR_8 = get_bits(VAR_0, VAR_10) | VAR_9;", "VAR_13 = -get_bits1(VAR_0);", "VAR_8 = (VAR_8 ^ VAR_13) - VAR_13;", "}", "VAR_1[VAR_2[VAR_11]] = VAR_8;", "VAR_18[VAR_17++] = VAR_11;", "VAR_5[VAR_16] = 0;", "VAR_6[VAR_16++] = 0;", "break;", "}", "}", "}", "if (VAR_4 == -1) {", "VAR_19 = get_bits(VAR_0, 4);", "} else {", "VAR_19 = VAR_4;", "}", "VAR_20 = VAR_3[VAR_19];", "VAR_1[0] = (VAR_1[0] * VAR_20[0]) >> 11;", "for (VAR_7 = 0; VAR_7 < VAR_17; VAR_7++) {", "int VAR_21 = VAR_18[VAR_7];", "VAR_1[VAR_2[VAR_21]] = (VAR_1[VAR_2[VAR_21]] * VAR_20[VAR_21]) >> 11;", "}", "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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 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 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 173 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 189 ], [ 191 ] ]
17,921
static int decode_rle(CamtasiaContext *c) { unsigned char *src = c->decomp_buf; unsigned char *output; int p1, p2, line=c->height, pos=0, i; output = c->pic.data[0] + (c->height - 1) * c->pic.linesize[0]; while(src < c->decomp_buf + c->decomp_size) { p1 = *src++; if(p1 == 0) { //Escape code p2 = *src++; if(p2 == 0) { //End-of-line output = c->pic.data[0] + (--line) * c->pic.linesize[0]; pos = 0; continue; } else if(p2 == 1) { //End-of-picture return 0; } else if(p2 == 2) { //Skip p1 = *src++; p2 = *src++; line -= p2; pos += p1; output = c->pic.data[0] + line * c->pic.linesize[0] + pos * (c->bpp / 8); continue; } // Copy data for(i = 0; i < p2 * (c->bpp / 8); i++) { *output++ = *src++; } // RLE8 copy is actually padded - and runs are not! if(c->bpp == 8 && (p2 & 1)) { src++; } pos += p2; } else { //Run of pixels int pix[3]; //original pixel switch(c->bpp){ case 8: pix[0] = *src++; break; case 16: pix[0] = *src++; pix[1] = *src++; break; case 24: pix[0] = *src++; pix[1] = *src++; pix[2] = *src++; break; } for(i = 0; i < p1; i++) { switch(c->bpp){ case 8: *output++ = pix[0]; break; case 16: *output++ = pix[0]; *output++ = pix[1]; break; case 24: *output++ = pix[0]; *output++ = pix[1]; *output++ = pix[2]; break; } } pos += p1; } } av_log(c->avctx, AV_LOG_ERROR, "Camtasia warning: no End-of-picture code\n"); return 1; }
false
FFmpeg
cca1a4265388eed91156216cec7ed5c8c9f8016d
static int decode_rle(CamtasiaContext *c) { unsigned char *src = c->decomp_buf; unsigned char *output; int p1, p2, line=c->height, pos=0, i; output = c->pic.data[0] + (c->height - 1) * c->pic.linesize[0]; while(src < c->decomp_buf + c->decomp_size) { p1 = *src++; if(p1 == 0) { p2 = *src++; if(p2 == 0) { output = c->pic.data[0] + (--line) * c->pic.linesize[0]; pos = 0; continue; } else if(p2 == 1) { return 0; } else if(p2 == 2) { p1 = *src++; p2 = *src++; line -= p2; pos += p1; output = c->pic.data[0] + line * c->pic.linesize[0] + pos * (c->bpp / 8); continue; } for(i = 0; i < p2 * (c->bpp / 8); i++) { *output++ = *src++; } if(c->bpp == 8 && (p2 & 1)) { src++; } pos += p2; } else { int pix[3]; switch(c->bpp){ case 8: pix[0] = *src++; break; case 16: pix[0] = *src++; pix[1] = *src++; break; case 24: pix[0] = *src++; pix[1] = *src++; pix[2] = *src++; break; } for(i = 0; i < p1; i++) { switch(c->bpp){ case 8: *output++ = pix[0]; break; case 16: *output++ = pix[0]; *output++ = pix[1]; break; case 24: *output++ = pix[0]; *output++ = pix[1]; *output++ = pix[2]; break; } } pos += p1; } } av_log(c->avctx, AV_LOG_ERROR, "Camtasia warning: no End-of-picture code\n"); return 1; }
{ "code": [], "line_no": [] }
static int FUNC_0(CamtasiaContext *VAR_0) { unsigned char *VAR_1 = VAR_0->decomp_buf; unsigned char *VAR_2; int VAR_3, VAR_4, VAR_5=VAR_0->height, VAR_6=0, VAR_7; VAR_2 = VAR_0->pic.data[0] + (VAR_0->height - 1) * VAR_0->pic.linesize[0]; while(VAR_1 < VAR_0->decomp_buf + VAR_0->decomp_size) { VAR_3 = *VAR_1++; if(VAR_3 == 0) { VAR_4 = *VAR_1++; if(VAR_4 == 0) { VAR_2 = VAR_0->pic.data[0] + (--VAR_5) * VAR_0->pic.linesize[0]; VAR_6 = 0; continue; } else if(VAR_4 == 1) { return 0; } else if(VAR_4 == 2) { VAR_3 = *VAR_1++; VAR_4 = *VAR_1++; VAR_5 -= VAR_4; VAR_6 += VAR_3; VAR_2 = VAR_0->pic.data[0] + VAR_5 * VAR_0->pic.linesize[0] + VAR_6 * (VAR_0->bpp / 8); continue; } for(VAR_7 = 0; VAR_7 < VAR_4 * (VAR_0->bpp / 8); VAR_7++) { *VAR_2++ = *VAR_1++; } if(VAR_0->bpp == 8 && (VAR_4 & 1)) { VAR_1++; } VAR_6 += VAR_4; } else { int VAR_8[3]; switch(VAR_0->bpp){ case 8: VAR_8[0] = *VAR_1++; break; case 16: VAR_8[0] = *VAR_1++; VAR_8[1] = *VAR_1++; break; case 24: VAR_8[0] = *VAR_1++; VAR_8[1] = *VAR_1++; VAR_8[2] = *VAR_1++; break; } for(VAR_7 = 0; VAR_7 < VAR_3; VAR_7++) { switch(VAR_0->bpp){ case 8: *VAR_2++ = VAR_8[0]; break; case 16: *VAR_2++ = VAR_8[0]; *VAR_2++ = VAR_8[1]; break; case 24: *VAR_2++ = VAR_8[0]; *VAR_2++ = VAR_8[1]; *VAR_2++ = VAR_8[2]; break; } } VAR_6 += VAR_3; } } av_log(VAR_0->avctx, AV_LOG_ERROR, "Camtasia warning: no End-of-picture code\n"); return 1; }
[ "static int FUNC_0(CamtasiaContext *VAR_0)\n{", "unsigned char *VAR_1 = VAR_0->decomp_buf;", "unsigned char *VAR_2;", "int VAR_3, VAR_4, VAR_5=VAR_0->height, VAR_6=0, VAR_7;", "VAR_2 = VAR_0->pic.data[0] + (VAR_0->height - 1) * VAR_0->pic.linesize[0];", "while(VAR_1 < VAR_0->decomp_buf + VAR_0->decomp_size) {", "VAR_3 = *VAR_1++;", "if(VAR_3 == 0) {", "VAR_4 = *VAR_1++;", "if(VAR_4 == 0) {", "VAR_2 = VAR_0->pic.data[0] + (--VAR_5) * VAR_0->pic.linesize[0];", "VAR_6 = 0;", "continue;", "} else if(VAR_4 == 1) {", "return 0;", "} else if(VAR_4 == 2) {", "VAR_3 = *VAR_1++;", "VAR_4 = *VAR_1++;", "VAR_5 -= VAR_4;", "VAR_6 += VAR_3;", "VAR_2 = VAR_0->pic.data[0] + VAR_5 * VAR_0->pic.linesize[0] + VAR_6 * (VAR_0->bpp / 8);", "continue;", "}", "for(VAR_7 = 0; VAR_7 < VAR_4 * (VAR_0->bpp / 8); VAR_7++) {", "*VAR_2++ = *VAR_1++;", "}", "if(VAR_0->bpp == 8 && (VAR_4 & 1)) {", "VAR_1++;", "}", "VAR_6 += VAR_4;", "} else {", "int VAR_8[3];", "switch(VAR_0->bpp){", "case 8: VAR_8[0] = *VAR_1++;", "break;", "case 16: VAR_8[0] = *VAR_1++;", "VAR_8[1] = *VAR_1++;", "break;", "case 24: VAR_8[0] = *VAR_1++;", "VAR_8[1] = *VAR_1++;", "VAR_8[2] = *VAR_1++;", "break;", "}", "for(VAR_7 = 0; VAR_7 < VAR_3; VAR_7++) {", "switch(VAR_0->bpp){", "case 8: *VAR_2++ = VAR_8[0];", "break;", "case 16: *VAR_2++ = VAR_8[0];", "*VAR_2++ = VAR_8[1];", "break;", "case 24: *VAR_2++ = VAR_8[0];", "*VAR_2++ = VAR_8[1];", "*VAR_2++ = VAR_8[2];", "break;", "}", "}", "VAR_6 += VAR_3;", "}", "}", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Camtasia warning: no End-of-picture code\\n\");", "return 1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 129 ], [ 131 ], [ 133 ] ]
17,922
decode_cabac_residual_internal(H264Context *h, int16_t *block, int cat, int n, const uint8_t *scantable, const uint32_t *qmul, int max_coeff, int is_dc, int chroma422) { static const int significant_coeff_flag_offset[2][14] = { { 105+0, 105+15, 105+29, 105+44, 105+47, 402, 484+0, 484+15, 484+29, 660, 528+0, 528+15, 528+29, 718 }, { 277+0, 277+15, 277+29, 277+44, 277+47, 436, 776+0, 776+15, 776+29, 675, 820+0, 820+15, 820+29, 733 } }; static const int last_coeff_flag_offset[2][14] = { { 166+0, 166+15, 166+29, 166+44, 166+47, 417, 572+0, 572+15, 572+29, 690, 616+0, 616+15, 616+29, 748 }, { 338+0, 338+15, 338+29, 338+44, 338+47, 451, 864+0, 864+15, 864+29, 699, 908+0, 908+15, 908+29, 757 } }; static const int coeff_abs_level_m1_offset[14] = { 227+0, 227+10, 227+20, 227+30, 227+39, 426, 952+0, 952+10, 952+20, 708, 982+0, 982+10, 982+20, 766 }; static const uint8_t significant_coeff_flag_offset_8x8[2][63] = { { 0, 1, 2, 3, 4, 5, 5, 4, 4, 3, 3, 4, 4, 4, 5, 5, 4, 4, 4, 4, 3, 3, 6, 7, 7, 7, 8, 9,10, 9, 8, 7, 7, 6,11,12,13,11, 6, 7, 8, 9,14,10, 9, 8, 6,11, 12,13,11, 6, 9,14,10, 9,11,12,13,11,14,10,12 }, { 0, 1, 1, 2, 2, 3, 3, 4, 5, 6, 7, 7, 7, 8, 4, 5, 6, 9,10,10, 8,11,12,11, 9, 9,10,10, 8,11,12,11, 9, 9,10,10, 8,11,12,11, 9, 9,10,10, 8,13,13, 9, 9,10,10, 8,13,13, 9, 9,10,10,14,14,14,14,14 } }; static const uint8_t sig_coeff_offset_dc[7] = { 0, 0, 1, 1, 2, 2, 2 }; /* node ctx: 0..3: abslevel1 (with abslevelgt1 == 0). * 4..7: abslevelgt1 + 3 (and abslevel1 doesn't matter). * map node ctx => cabac ctx for level=1 */ static const uint8_t coeff_abs_level1_ctx[8] = { 1, 2, 3, 4, 0, 0, 0, 0 }; /* map node ctx => cabac ctx for level>1 */ static const uint8_t coeff_abs_levelgt1_ctx[2][8] = { { 5, 5, 5, 5, 6, 7, 8, 9 }, { 5, 5, 5, 5, 6, 7, 8, 8 }, // 422/dc case }; static const uint8_t coeff_abs_level_transition[2][8] = { /* update node ctx after decoding a level=1 */ { 1, 2, 3, 3, 4, 5, 6, 7 }, /* update node ctx after decoding a level>1 */ { 4, 4, 4, 4, 5, 6, 7, 7 } }; int index[64]; int av_unused last; int coeff_count = 0; int node_ctx = 0; uint8_t *significant_coeff_ctx_base; uint8_t *last_coeff_ctx_base; uint8_t *abs_level_m1_ctx_base; #if !ARCH_X86 #define CABAC_ON_STACK #endif #ifdef CABAC_ON_STACK #define CC &cc CABACContext cc; cc.range = h->cabac.range; cc.low = h->cabac.low; cc.bytestream= h->cabac.bytestream; #else #define CC &h->cabac #endif significant_coeff_ctx_base = h->cabac_state + significant_coeff_flag_offset[MB_FIELD][cat]; last_coeff_ctx_base = h->cabac_state + last_coeff_flag_offset[MB_FIELD][cat]; abs_level_m1_ctx_base = h->cabac_state + coeff_abs_level_m1_offset[cat]; if( !is_dc && max_coeff == 64 ) { #define DECODE_SIGNIFICANCE( coefs, sig_off, last_off ) \ for(last= 0; last < coefs; last++) { \ uint8_t *sig_ctx = significant_coeff_ctx_base + sig_off; \ if( get_cabac( CC, sig_ctx )) { \ uint8_t *last_ctx = last_coeff_ctx_base + last_off; \ index[coeff_count++] = last; \ if( get_cabac( CC, last_ctx ) ) { \ last= max_coeff; \ break; \ } \ } \ }\ if( last == max_coeff -1 ) {\ index[coeff_count++] = last;\ } const uint8_t *sig_off = significant_coeff_flag_offset_8x8[MB_FIELD]; #ifdef decode_significance coeff_count = decode_significance_8x8(CC, significant_coeff_ctx_base, index, last_coeff_ctx_base, sig_off); } else { if (is_dc && chroma422) { // dc 422 DECODE_SIGNIFICANCE(7, sig_coeff_offset_dc[last], sig_coeff_offset_dc[last]); } else { coeff_count = decode_significance(CC, max_coeff, significant_coeff_ctx_base, index, last_coeff_ctx_base-significant_coeff_ctx_base); } #else DECODE_SIGNIFICANCE( 63, sig_off[last], ff_h264_last_coeff_flag_offset_8x8[last] ); } else { if (is_dc && chroma422) { // dc 422 DECODE_SIGNIFICANCE(7, sig_coeff_offset_dc[last], sig_coeff_offset_dc[last]); } else { DECODE_SIGNIFICANCE(max_coeff - 1, last, last); } #endif } av_assert2(coeff_count > 0); if( is_dc ) { if( cat == 3 ) h->cbp_table[h->mb_xy] |= 0x40 << (n - CHROMA_DC_BLOCK_INDEX); else h->cbp_table[h->mb_xy] |= 0x100 << (n - LUMA_DC_BLOCK_INDEX); h->non_zero_count_cache[scan8[n]] = coeff_count; } else { if( max_coeff == 64 ) fill_rectangle(&h->non_zero_count_cache[scan8[n]], 2, 2, 8, coeff_count, 1); else { av_assert2( cat == 1 || cat == 2 || cat == 4 || cat == 7 || cat == 8 || cat == 11 || cat == 12 ); h->non_zero_count_cache[scan8[n]] = coeff_count; } } #define STORE_BLOCK(type) \ do { \ uint8_t *ctx = coeff_abs_level1_ctx[node_ctx] + abs_level_m1_ctx_base; \ \ int j= scantable[index[--coeff_count]]; \ \ if( get_cabac( CC, ctx ) == 0 ) { \ node_ctx = coeff_abs_level_transition[0][node_ctx]; \ if( is_dc ) { \ ((type*)block)[j] = get_cabac_bypass_sign( CC, -1); \ }else{ \ ((type*)block)[j] = (get_cabac_bypass_sign( CC, -qmul[j]) + 32) >> 6; \ } \ } else { \ int coeff_abs = 2; \ ctx = coeff_abs_levelgt1_ctx[is_dc && chroma422][node_ctx] + abs_level_m1_ctx_base; \ node_ctx = coeff_abs_level_transition[1][node_ctx]; \ \ while( coeff_abs < 15 && get_cabac( CC, ctx ) ) { \ coeff_abs++; \ } \ \ if( coeff_abs >= 15 ) { \ int j = 0; \ while( get_cabac_bypass( CC ) ) { \ j++; \ } \ \ coeff_abs=1; \ while( j-- ) { \ coeff_abs += coeff_abs + get_cabac_bypass( CC ); \ } \ coeff_abs+= 14; \ } \ \ if( is_dc ) { \ ((type*)block)[j] = get_cabac_bypass_sign( CC, -coeff_abs ); \ }else{ \ ((type*)block)[j] = ((int)(get_cabac_bypass_sign( CC, -coeff_abs ) * qmul[j] + 32)) >> 6; \ } \ } \ } while ( coeff_count ); if (h->pixel_shift) { STORE_BLOCK(int32_t) } else { STORE_BLOCK(int16_t) } #ifdef CABAC_ON_STACK h->cabac.range = cc.range ; h->cabac.low = cc.low ; h->cabac.bytestream= cc.bytestream; #endif }
false
FFmpeg
cdf0877bc341684c56ac1fe057397adbadf329ee
decode_cabac_residual_internal(H264Context *h, int16_t *block, int cat, int n, const uint8_t *scantable, const uint32_t *qmul, int max_coeff, int is_dc, int chroma422) { static const int significant_coeff_flag_offset[2][14] = { { 105+0, 105+15, 105+29, 105+44, 105+47, 402, 484+0, 484+15, 484+29, 660, 528+0, 528+15, 528+29, 718 }, { 277+0, 277+15, 277+29, 277+44, 277+47, 436, 776+0, 776+15, 776+29, 675, 820+0, 820+15, 820+29, 733 } }; static const int last_coeff_flag_offset[2][14] = { { 166+0, 166+15, 166+29, 166+44, 166+47, 417, 572+0, 572+15, 572+29, 690, 616+0, 616+15, 616+29, 748 }, { 338+0, 338+15, 338+29, 338+44, 338+47, 451, 864+0, 864+15, 864+29, 699, 908+0, 908+15, 908+29, 757 } }; static const int coeff_abs_level_m1_offset[14] = { 227+0, 227+10, 227+20, 227+30, 227+39, 426, 952+0, 952+10, 952+20, 708, 982+0, 982+10, 982+20, 766 }; static const uint8_t significant_coeff_flag_offset_8x8[2][63] = { { 0, 1, 2, 3, 4, 5, 5, 4, 4, 3, 3, 4, 4, 4, 5, 5, 4, 4, 4, 4, 3, 3, 6, 7, 7, 7, 8, 9,10, 9, 8, 7, 7, 6,11,12,13,11, 6, 7, 8, 9,14,10, 9, 8, 6,11, 12,13,11, 6, 9,14,10, 9,11,12,13,11,14,10,12 }, { 0, 1, 1, 2, 2, 3, 3, 4, 5, 6, 7, 7, 7, 8, 4, 5, 6, 9,10,10, 8,11,12,11, 9, 9,10,10, 8,11,12,11, 9, 9,10,10, 8,11,12,11, 9, 9,10,10, 8,13,13, 9, 9,10,10, 8,13,13, 9, 9,10,10,14,14,14,14,14 } }; static const uint8_t sig_coeff_offset_dc[7] = { 0, 0, 1, 1, 2, 2, 2 }; static const uint8_t coeff_abs_level1_ctx[8] = { 1, 2, 3, 4, 0, 0, 0, 0 }; static const uint8_t coeff_abs_levelgt1_ctx[2][8] = { { 5, 5, 5, 5, 6, 7, 8, 9 }, { 5, 5, 5, 5, 6, 7, 8, 8 }, }; static const uint8_t coeff_abs_level_transition[2][8] = { { 1, 2, 3, 3, 4, 5, 6, 7 }, { 4, 4, 4, 4, 5, 6, 7, 7 } }; int index[64]; int av_unused last; int coeff_count = 0; int node_ctx = 0; uint8_t *significant_coeff_ctx_base; uint8_t *last_coeff_ctx_base; uint8_t *abs_level_m1_ctx_base; #if !ARCH_X86 #define CABAC_ON_STACK #endif #ifdef CABAC_ON_STACK #define CC &cc CABACContext cc; cc.range = h->cabac.range; cc.low = h->cabac.low; cc.bytestream= h->cabac.bytestream; #else #define CC &h->cabac #endif significant_coeff_ctx_base = h->cabac_state + significant_coeff_flag_offset[MB_FIELD][cat]; last_coeff_ctx_base = h->cabac_state + last_coeff_flag_offset[MB_FIELD][cat]; abs_level_m1_ctx_base = h->cabac_state + coeff_abs_level_m1_offset[cat]; if( !is_dc && max_coeff == 64 ) { #define DECODE_SIGNIFICANCE( coefs, sig_off, last_off ) \ for(last= 0; last < coefs; last++) { \ uint8_t *sig_ctx = significant_coeff_ctx_base + sig_off; \ if( get_cabac( CC, sig_ctx )) { \ uint8_t *last_ctx = last_coeff_ctx_base + last_off; \ index[coeff_count++] = last; \ if( get_cabac( CC, last_ctx ) ) { \ last= max_coeff; \ break; \ } \ } \ }\ if( last == max_coeff -1 ) {\ index[coeff_count++] = last;\ } const uint8_t *sig_off = significant_coeff_flag_offset_8x8[MB_FIELD]; #ifdef decode_significance coeff_count = decode_significance_8x8(CC, significant_coeff_ctx_base, index, last_coeff_ctx_base, sig_off); } else { if (is_dc && chroma422) { DECODE_SIGNIFICANCE(7, sig_coeff_offset_dc[last], sig_coeff_offset_dc[last]); } else { coeff_count = decode_significance(CC, max_coeff, significant_coeff_ctx_base, index, last_coeff_ctx_base-significant_coeff_ctx_base); } #else DECODE_SIGNIFICANCE( 63, sig_off[last], ff_h264_last_coeff_flag_offset_8x8[last] ); } else { if (is_dc && chroma422) { DECODE_SIGNIFICANCE(7, sig_coeff_offset_dc[last], sig_coeff_offset_dc[last]); } else { DECODE_SIGNIFICANCE(max_coeff - 1, last, last); } #endif } av_assert2(coeff_count > 0); if( is_dc ) { if( cat == 3 ) h->cbp_table[h->mb_xy] |= 0x40 << (n - CHROMA_DC_BLOCK_INDEX); else h->cbp_table[h->mb_xy] |= 0x100 << (n - LUMA_DC_BLOCK_INDEX); h->non_zero_count_cache[scan8[n]] = coeff_count; } else { if( max_coeff == 64 ) fill_rectangle(&h->non_zero_count_cache[scan8[n]], 2, 2, 8, coeff_count, 1); else { av_assert2( cat == 1 || cat == 2 || cat == 4 || cat == 7 || cat == 8 || cat == 11 || cat == 12 ); h->non_zero_count_cache[scan8[n]] = coeff_count; } } #define STORE_BLOCK(type) \ do { \ uint8_t *ctx = coeff_abs_level1_ctx[node_ctx] + abs_level_m1_ctx_base; \ \ int j= scantable[index[--coeff_count]]; \ \ if( get_cabac( CC, ctx ) == 0 ) { \ node_ctx = coeff_abs_level_transition[0][node_ctx]; \ if( is_dc ) { \ ((type*)block)[j] = get_cabac_bypass_sign( CC, -1); \ }else{ \ ((type*)block)[j] = (get_cabac_bypass_sign( CC, -qmul[j]) + 32) >> 6; \ } \ } else { \ int coeff_abs = 2; \ ctx = coeff_abs_levelgt1_ctx[is_dc && chroma422][node_ctx] + abs_level_m1_ctx_base; \ node_ctx = coeff_abs_level_transition[1][node_ctx]; \ \ while( coeff_abs < 15 && get_cabac( CC, ctx ) ) { \ coeff_abs++; \ } \ \ if( coeff_abs >= 15 ) { \ int j = 0; \ while( get_cabac_bypass( CC ) ) { \ j++; \ } \ \ coeff_abs=1; \ while( j-- ) { \ coeff_abs += coeff_abs + get_cabac_bypass( CC ); \ } \ coeff_abs+= 14; \ } \ \ if( is_dc ) { \ ((type*)block)[j] = get_cabac_bypass_sign( CC, -coeff_abs ); \ }else{ \ ((type*)block)[j] = ((int)(get_cabac_bypass_sign( CC, -coeff_abs ) * qmul[j] + 32)) >> 6; \ } \ } \ } while ( coeff_count ); if (h->pixel_shift) { STORE_BLOCK(int32_t) } else { STORE_BLOCK(int16_t) } #ifdef CABAC_ON_STACK h->cabac.range = cc.range ; h->cabac.low = cc.low ; h->cabac.bytestream= cc.bytestream; #endif }
{ "code": [], "line_no": [] }
FUNC_0(H264Context *VAR_0, int16_t *VAR_1, int VAR_2, int VAR_3, const uint8_t *VAR_4, const uint32_t *VAR_5, int VAR_6, int VAR_7, int VAR_8) { static const int VAR_9[2][14] = { { 105+0, 105+15, 105+29, 105+44, 105+47, 402, 484+0, 484+15, 484+29, 660, 528+0, 528+15, 528+29, 718 }, { 277+0, 277+15, 277+29, 277+44, 277+47, 436, 776+0, 776+15, 776+29, 675, 820+0, 820+15, 820+29, 733 } }; static const int VAR_10[2][14] = { { 166+0, 166+15, 166+29, 166+44, 166+47, 417, 572+0, 572+15, 572+29, 690, 616+0, 616+15, 616+29, 748 }, { 338+0, 338+15, 338+29, 338+44, 338+47, 451, 864+0, 864+15, 864+29, 699, 908+0, 908+15, 908+29, 757 } }; static const int VAR_11[14] = { 227+0, 227+10, 227+20, 227+30, 227+39, 426, 952+0, 952+10, 952+20, 708, 982+0, 982+10, 982+20, 766 }; static const uint8_t VAR_12[2][63] = { { 0, 1, 2, 3, 4, 5, 5, 4, 4, 3, 3, 4, 4, 4, 5, 5, 4, 4, 4, 4, 3, 3, 6, 7, 7, 7, 8, 9,10, 9, 8, 7, 7, 6,11,12,13,11, 6, 7, 8, 9,14,10, 9, 8, 6,11, 12,13,11, 6, 9,14,10, 9,11,12,13,11,14,10,12 }, { 0, 1, 1, 2, 2, 3, 3, 4, 5, 6, 7, 7, 7, 8, 4, 5, 6, 9,10,10, 8,11,12,11, 9, 9,10,10, 8,11,12,11, 9, 9,10,10, 8,11,12,11, 9, 9,10,10, 8,13,13, 9, 9,10,10, 8,13,13, 9, 9,10,10,14,14,14,14,14 } }; static const uint8_t VAR_13[7] = { 0, 0, 1, 1, 2, 2, 2 }; static const uint8_t VAR_14[8] = { 1, 2, 3, 4, 0, 0, 0, 0 }; static const uint8_t VAR_15[2][8] = { { 5, 5, 5, 5, 6, 7, 8, 9 }, { 5, 5, 5, 5, 6, 7, 8, 8 }, }; static const uint8_t VAR_16[2][8] = { { 1, 2, 3, 3, 4, 5, 6, 7 }, { 4, 4, 4, 4, 5, 6, 7, 7 } }; int VAR_17[64]; int VAR_18 last; int VAR_19 = 0; int VAR_20 = 0; uint8_t *significant_coeff_ctx_base; uint8_t *last_coeff_ctx_base; uint8_t *abs_level_m1_ctx_base; #if !ARCH_X86 #define CABAC_ON_STACK #endif #ifdef CABAC_ON_STACK #define CC &cc CABACContext cc; cc.range = VAR_0->cabac.range; cc.low = VAR_0->cabac.low; cc.bytestream= VAR_0->cabac.bytestream; #else #define CC &VAR_0->cabac #endif significant_coeff_ctx_base = VAR_0->cabac_state + VAR_9[MB_FIELD][VAR_2]; last_coeff_ctx_base = VAR_0->cabac_state + VAR_10[MB_FIELD][VAR_2]; abs_level_m1_ctx_base = VAR_0->cabac_state + VAR_11[VAR_2]; if( !VAR_7 && VAR_6 == 64 ) { #define DECODE_SIGNIFICANCE( coefs, VAR_21, last_off ) \ for(last= 0; last < coefs; last++) { \ uint8_t *sig_ctx = significant_coeff_ctx_base + VAR_21; \ if( get_cabac( CC, sig_ctx )) { \ uint8_t *last_ctx = last_coeff_ctx_base + last_off; \ VAR_17[VAR_19++] = last; \ if( get_cabac( CC, last_ctx ) ) { \ last= VAR_6; \ break; \ } \ } \ }\ if( last == VAR_6 -1 ) {\ VAR_17[VAR_19++] = last;\ } const uint8_t *VAR_21 = VAR_12[MB_FIELD]; #ifdef decode_significance VAR_19 = decode_significance_8x8(CC, significant_coeff_ctx_base, VAR_17, last_coeff_ctx_base, VAR_21); } else { if (VAR_7 && VAR_8) { DECODE_SIGNIFICANCE(7, VAR_13[last], VAR_13[last]); } else { VAR_19 = decode_significance(CC, VAR_6, significant_coeff_ctx_base, VAR_17, last_coeff_ctx_base-significant_coeff_ctx_base); } #else DECODE_SIGNIFICANCE( 63, VAR_21[last], ff_h264_last_coeff_flag_offset_8x8[last] ); } else { if (VAR_7 && VAR_8) { DECODE_SIGNIFICANCE(7, VAR_13[last], VAR_13[last]); } else { DECODE_SIGNIFICANCE(VAR_6 - 1, last, last); } #endif } av_assert2(VAR_19 > 0); if( VAR_7 ) { if( VAR_2 == 3 ) VAR_0->cbp_table[VAR_0->mb_xy] |= 0x40 << (VAR_3 - CHROMA_DC_BLOCK_INDEX); else VAR_0->cbp_table[VAR_0->mb_xy] |= 0x100 << (VAR_3 - LUMA_DC_BLOCK_INDEX); VAR_0->non_zero_count_cache[scan8[VAR_3]] = VAR_19; } else { if( VAR_6 == 64 ) fill_rectangle(&VAR_0->non_zero_count_cache[scan8[VAR_3]], 2, 2, 8, VAR_19, 1); else { av_assert2( VAR_2 == 1 || VAR_2 == 2 || VAR_2 == 4 || VAR_2 == 7 || VAR_2 == 8 || VAR_2 == 11 || VAR_2 == 12 ); VAR_0->non_zero_count_cache[scan8[VAR_3]] = VAR_19; } } #define STORE_BLOCK(type) \ do { \ uint8_t *ctx = VAR_14[VAR_20] + abs_level_m1_ctx_base; \ \ int VAR_24= VAR_4[VAR_17[--VAR_19]]; \ \ if( get_cabac( CC, ctx ) == 0 ) { \ VAR_20 = VAR_16[0][VAR_20]; \ if( VAR_7 ) { \ ((type*)VAR_1)[VAR_24] = get_cabac_bypass_sign( CC, -1); \ }else{ \ ((type*)VAR_1)[VAR_24] = (get_cabac_bypass_sign( CC, -VAR_5[VAR_24]) + 32) >> 6; \ } \ } else { \ int VAR_23 = 2; \ ctx = VAR_15[VAR_7 && VAR_8][VAR_20] + abs_level_m1_ctx_base; \ VAR_20 = VAR_16[1][VAR_20]; \ \ while( VAR_23 < 15 && get_cabac( CC, ctx ) ) { \ VAR_23++; \ } \ \ if( VAR_23 >= 15 ) { \ int VAR_24 = 0; \ while( get_cabac_bypass( CC ) ) { \ VAR_24++; \ } \ \ VAR_23=1; \ while( VAR_24-- ) { \ VAR_23 += VAR_23 + get_cabac_bypass( CC ); \ } \ VAR_23+= 14; \ } \ \ if( VAR_7 ) { \ ((type*)VAR_1)[VAR_24] = get_cabac_bypass_sign( CC, -VAR_23 ); \ }else{ \ ((type*)VAR_1)[VAR_24] = ((int)(get_cabac_bypass_sign( CC, -VAR_23 ) * VAR_5[VAR_24] + 32)) >> 6; \ } \ } \ } while ( VAR_19 ); if (VAR_0->pixel_shift) { STORE_BLOCK(int32_t) } else { STORE_BLOCK(int16_t) } #ifdef CABAC_ON_STACK VAR_0->cabac.range = cc.range ; VAR_0->cabac.low = cc.low ; VAR_0->cabac.bytestream= cc.bytestream; #endif }
[ "FUNC_0(H264Context *VAR_0, int16_t *VAR_1,\nint VAR_2, int VAR_3, const uint8_t *VAR_4,\nconst uint32_t *VAR_5, int VAR_6,\nint VAR_7, int VAR_8)\n{", "static const int VAR_9[2][14] = {", "{ 105+0, 105+15, 105+29, 105+44, 105+47, 402, 484+0, 484+15, 484+29, 660, 528+0, 528+15, 528+29, 718 },", "{ 277+0, 277+15, 277+29, 277+44, 277+47, 436, 776+0, 776+15, 776+29, 675, 820+0, 820+15, 820+29, 733 }", "};", "static const int VAR_10[2][14] = {", "{ 166+0, 166+15, 166+29, 166+44, 166+47, 417, 572+0, 572+15, 572+29, 690, 616+0, 616+15, 616+29, 748 },", "{ 338+0, 338+15, 338+29, 338+44, 338+47, 451, 864+0, 864+15, 864+29, 699, 908+0, 908+15, 908+29, 757 }", "};", "static const int VAR_11[14] = {", "227+0, 227+10, 227+20, 227+30, 227+39, 426, 952+0, 952+10, 952+20, 708, 982+0, 982+10, 982+20, 766\n};", "static const uint8_t VAR_12[2][63] = {", "{ 0, 1, 2, 3, 4, 5, 5, 4, 4, 3, 3, 4, 4, 4, 5, 5,", "4, 4, 4, 4, 3, 3, 6, 7, 7, 7, 8, 9,10, 9, 8, 7,\n7, 6,11,12,13,11, 6, 7, 8, 9,14,10, 9, 8, 6,11,\n12,13,11, 6, 9,14,10, 9,11,12,13,11,14,10,12 },", "{ 0, 1, 1, 2, 2, 3, 3, 4, 5, 6, 7, 7, 7, 8, 4, 5,", "6, 9,10,10, 8,11,12,11, 9, 9,10,10, 8,11,12,11,\n9, 9,10,10, 8,11,12,11, 9, 9,10,10, 8,13,13, 9,\n9,10,10, 8,13,13, 9, 9,10,10,14,14,14,14,14 }", "};", "static const uint8_t VAR_13[7] = { 0, 0, 1, 1, 2, 2, 2 };", "static const uint8_t VAR_14[8] = { 1, 2, 3, 4, 0, 0, 0, 0 };", "static const uint8_t VAR_15[2][8] = {", "{ 5, 5, 5, 5, 6, 7, 8, 9 },", "{ 5, 5, 5, 5, 6, 7, 8, 8 },", "};", "static const uint8_t VAR_16[2][8] = {", "{ 1, 2, 3, 3, 4, 5, 6, 7 },", "{ 4, 4, 4, 4, 5, 6, 7, 7 }", "};", "int VAR_17[64];", "int VAR_18 last;", "int VAR_19 = 0;", "int VAR_20 = 0;", "uint8_t *significant_coeff_ctx_base;", "uint8_t *last_coeff_ctx_base;", "uint8_t *abs_level_m1_ctx_base;", "#if !ARCH_X86\n#define CABAC_ON_STACK\n#endif\n#ifdef CABAC_ON_STACK\n#define CC &cc\nCABACContext cc;", "cc.range = VAR_0->cabac.range;", "cc.low = VAR_0->cabac.low;", "cc.bytestream= VAR_0->cabac.bytestream;", "#else\n#define CC &VAR_0->cabac\n#endif\nsignificant_coeff_ctx_base = VAR_0->cabac_state\n+ VAR_9[MB_FIELD][VAR_2];", "last_coeff_ctx_base = VAR_0->cabac_state\n+ VAR_10[MB_FIELD][VAR_2];", "abs_level_m1_ctx_base = VAR_0->cabac_state\n+ VAR_11[VAR_2];", "if( !VAR_7 && VAR_6 == 64 ) {", "#define DECODE_SIGNIFICANCE( coefs, VAR_21, last_off ) \\\nfor(last= 0; last < coefs; last++) { \\", "uint8_t *sig_ctx = significant_coeff_ctx_base + VAR_21; \\", "if( get_cabac( CC, sig_ctx )) { \\", "uint8_t *last_ctx = last_coeff_ctx_base + last_off; \\", "VAR_17[VAR_19++] = last; \\", "if( get_cabac( CC, last_ctx ) ) { \\", "last= VAR_6; \\", "break; \\", "} \\", "} \\", "}\\", "if( last == VAR_6 -1 ) {\\", "VAR_17[VAR_19++] = last;\\", "}", "const uint8_t *VAR_21 = VAR_12[MB_FIELD];", "#ifdef decode_significance\nVAR_19 = decode_significance_8x8(CC, significant_coeff_ctx_base, VAR_17,\nlast_coeff_ctx_base, VAR_21);", "} else {", "if (VAR_7 && VAR_8) {", "DECODE_SIGNIFICANCE(7, VAR_13[last], VAR_13[last]);", "} else {", "VAR_19 = decode_significance(CC, VAR_6, significant_coeff_ctx_base, VAR_17,\nlast_coeff_ctx_base-significant_coeff_ctx_base);", "}", "#else\nDECODE_SIGNIFICANCE( 63, VAR_21[last], ff_h264_last_coeff_flag_offset_8x8[last] );", "} else {", "if (VAR_7 && VAR_8) {", "DECODE_SIGNIFICANCE(7, VAR_13[last], VAR_13[last]);", "} else {", "DECODE_SIGNIFICANCE(VAR_6 - 1, last, last);", "}", "#endif\n}", "av_assert2(VAR_19 > 0);", "if( VAR_7 ) {", "if( VAR_2 == 3 )\nVAR_0->cbp_table[VAR_0->mb_xy] |= 0x40 << (VAR_3 - CHROMA_DC_BLOCK_INDEX);", "else\nVAR_0->cbp_table[VAR_0->mb_xy] |= 0x100 << (VAR_3 - LUMA_DC_BLOCK_INDEX);", "VAR_0->non_zero_count_cache[scan8[VAR_3]] = VAR_19;", "} else {", "if( VAR_6 == 64 )\nfill_rectangle(&VAR_0->non_zero_count_cache[scan8[VAR_3]], 2, 2, 8, VAR_19, 1);", "else {", "av_assert2( VAR_2 == 1 || VAR_2 == 2 || VAR_2 == 4 || VAR_2 == 7 || VAR_2 == 8 || VAR_2 == 11 || VAR_2 == 12 );", "VAR_0->non_zero_count_cache[scan8[VAR_3]] = VAR_19;", "}", "}", "#define STORE_BLOCK(type) \\\ndo { \\", "uint8_t *ctx = VAR_14[VAR_20] + abs_level_m1_ctx_base; \\", "\\\nint VAR_24= VAR_4[VAR_17[--VAR_19]]; \\", "\\\nif( get_cabac( CC, ctx ) == 0 ) { \\", "VAR_20 = VAR_16[0][VAR_20]; \\", "if( VAR_7 ) { \\", "((type*)VAR_1)[VAR_24] = get_cabac_bypass_sign( CC, -1); \\", "}else{ \\", "((type*)VAR_1)[VAR_24] = (get_cabac_bypass_sign( CC, -VAR_5[VAR_24]) + 32) >> 6; \\", "} \\", "} else { \\", "int VAR_23 = 2; \\", "ctx = VAR_15[VAR_7 && VAR_8][VAR_20] + abs_level_m1_ctx_base; \\", "VAR_20 = VAR_16[1][VAR_20]; \\", "\\\nwhile( VAR_23 < 15 && get_cabac( CC, ctx ) ) { \\", "VAR_23++; \\", "} \\", "\\\nif( VAR_23 >= 15 ) { \\", "int VAR_24 = 0; \\", "while( get_cabac_bypass( CC ) ) { \\", "VAR_24++; \\", "} \\", "\\\nVAR_23=1; \\", "while( VAR_24-- ) { \\", "VAR_23 += VAR_23 + get_cabac_bypass( CC ); \\", "} \\", "VAR_23+= 14; \\", "} \\", "\\\nif( VAR_7 ) { \\", "((type*)VAR_1)[VAR_24] = get_cabac_bypass_sign( CC, -VAR_23 ); \\", "}else{ \\", "((type*)VAR_1)[VAR_24] = ((int)(get_cabac_bypass_sign( CC, -VAR_23 ) * VAR_5[VAR_24] + 32)) >> 6; \\", "} \\", "} \\", "} while ( VAR_19 );", "if (VAR_0->pixel_shift) {", "STORE_BLOCK(int32_t)\n} else {", "STORE_BLOCK(int16_t)\n}", "#ifdef CABAC_ON_STACK\nVAR_0->cabac.range = cc.range ;", "VAR_0->cabac.low = cc.low ;", "VAR_0->cabac.bytestream= cc.bytestream;", "#endif\n}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 81 ], [ 83 ], [ 87 ], [ 91 ], [ 93 ], [ 95 ], [ 99 ], [ 101 ], [ 103 ], [ 107, 109, 111, 113, 115, 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125, 127, 129, 133, 135 ], [ 137, 139 ], [ 141, 143 ], [ 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 ], [ 225 ], [ 227, 229 ], [ 231, 233 ], [ 235 ], [ 237 ], [ 239, 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 257, 259 ], [ 261 ], [ 263, 265 ], [ 267, 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ], [ 291, 293 ], [ 295 ], [ 297 ], [ 299, 301 ], [ 303 ], [ 305 ], [ 307 ], [ 309 ], [ 311, 313 ], [ 315 ], [ 317 ], [ 319 ], [ 321 ], [ 323 ], [ 325, 327 ], [ 329 ], [ 331 ], [ 333 ], [ 335 ], [ 337 ], [ 339 ], [ 343 ], [ 345, 347 ], [ 349, 351 ], [ 353, 355 ], [ 357 ], [ 359 ], [ 361, 365 ] ]
17,923
static void gen_pool32axf (CPUMIPSState *env, DisasContext *ctx, int rt, int rs, int *is_branch) { int extension = (ctx->opcode >> 6) & 0x3f; int minor = (ctx->opcode >> 12) & 0xf; uint32_t mips32_op; switch (extension) { case TEQ: mips32_op = OPC_TEQ; goto do_trap; case TGE: mips32_op = OPC_TGE; goto do_trap; case TGEU: mips32_op = OPC_TGEU; goto do_trap; case TLT: mips32_op = OPC_TLT; goto do_trap; case TLTU: mips32_op = OPC_TLTU; goto do_trap; case TNE: mips32_op = OPC_TNE; do_trap: gen_trap(ctx, mips32_op, rs, rt, -1); break; #ifndef CONFIG_USER_ONLY case MFC0: case MFC0 + 32: check_cp0_enabled(ctx); if (rt == 0) { /* Treat as NOP. */ break; } gen_mfc0(ctx, cpu_gpr[rt], rs, (ctx->opcode >> 11) & 0x7); break; case MTC0: case MTC0 + 32: check_cp0_enabled(ctx); { TCGv t0 = tcg_temp_new(); gen_load_gpr(t0, rt); gen_mtc0(ctx, t0, rs, (ctx->opcode >> 11) & 0x7); tcg_temp_free(t0); } break; #endif case 0x2c: switch (minor) { case SEB: gen_bshfl(ctx, OPC_SEB, rs, rt); break; case SEH: gen_bshfl(ctx, OPC_SEH, rs, rt); break; case CLO: mips32_op = OPC_CLO; goto do_cl; case CLZ: mips32_op = OPC_CLZ; do_cl: check_insn(ctx, ISA_MIPS32); gen_cl(ctx, mips32_op, rt, rs); break; case RDHWR: gen_rdhwr(ctx, rt, rs); break; case WSBH: gen_bshfl(ctx, OPC_WSBH, rs, rt); break; case MULT: mips32_op = OPC_MULT; goto do_mul; case MULTU: mips32_op = OPC_MULTU; goto do_mul; case DIV: mips32_op = OPC_DIV; goto do_div; case DIVU: mips32_op = OPC_DIVU; goto do_div; do_div: check_insn(ctx, ISA_MIPS32); gen_muldiv(ctx, mips32_op, 0, rs, rt); break; case MADD: mips32_op = OPC_MADD; goto do_mul; case MADDU: mips32_op = OPC_MADDU; goto do_mul; case MSUB: mips32_op = OPC_MSUB; goto do_mul; case MSUBU: mips32_op = OPC_MSUBU; do_mul: check_insn(ctx, ISA_MIPS32); gen_muldiv(ctx, mips32_op, (ctx->opcode >> 14) & 3, rs, rt); break; default: goto pool32axf_invalid; } break; case 0x34: switch (minor) { case MFC2: case MTC2: case MFHC2: case MTHC2: case CFC2: case CTC2: generate_exception_err(ctx, EXCP_CpU, 2); break; default: goto pool32axf_invalid; } break; case 0x3c: switch (minor) { case JALR: case JALR_HB: gen_compute_branch (ctx, OPC_JALR, 4, rs, rt, 0); *is_branch = 1; break; case JALRS: case JALRS_HB: gen_compute_branch (ctx, OPC_JALRS, 4, rs, rt, 0); *is_branch = 1; break; default: goto pool32axf_invalid; } break; case 0x05: switch (minor) { case RDPGPR: check_cp0_enabled(ctx); check_insn(ctx, ISA_MIPS32R2); gen_load_srsgpr(rt, rs); break; case WRPGPR: check_cp0_enabled(ctx); check_insn(ctx, ISA_MIPS32R2); gen_store_srsgpr(rt, rs); break; default: goto pool32axf_invalid; } break; #ifndef CONFIG_USER_ONLY case 0x0d: switch (minor) { case TLBP: mips32_op = OPC_TLBP; goto do_cp0; case TLBR: mips32_op = OPC_TLBR; goto do_cp0; case TLBWI: mips32_op = OPC_TLBWI; goto do_cp0; case TLBWR: mips32_op = OPC_TLBWR; goto do_cp0; case WAIT: mips32_op = OPC_WAIT; goto do_cp0; case DERET: mips32_op = OPC_DERET; goto do_cp0; case ERET: mips32_op = OPC_ERET; do_cp0: gen_cp0(env, ctx, mips32_op, rt, rs); break; default: goto pool32axf_invalid; } break; case 0x1d: switch (minor) { case DI: check_cp0_enabled(ctx); { TCGv t0 = tcg_temp_new(); save_cpu_state(ctx, 1); gen_helper_di(t0, cpu_env); gen_store_gpr(t0, rs); /* Stop translation as we may have switched the execution mode */ ctx->bstate = BS_STOP; tcg_temp_free(t0); } break; case EI: check_cp0_enabled(ctx); { TCGv t0 = tcg_temp_new(); save_cpu_state(ctx, 1); gen_helper_ei(t0, cpu_env); gen_store_gpr(t0, rs); /* Stop translation as we may have switched the execution mode */ ctx->bstate = BS_STOP; tcg_temp_free(t0); } break; default: goto pool32axf_invalid; } break; #endif case 0x2d: switch (minor) { case SYNC: /* NOP */ break; case SYSCALL: generate_exception(ctx, EXCP_SYSCALL); ctx->bstate = BS_STOP; break; case SDBBP: check_insn(ctx, ISA_MIPS32); if (!(ctx->hflags & MIPS_HFLAG_DM)) { generate_exception(ctx, EXCP_DBp); } else { generate_exception(ctx, EXCP_DBp); } break; default: goto pool32axf_invalid; } break; case 0x35: switch (minor & 3) { case MFHI32: gen_HILO(ctx, OPC_MFHI, minor >> 2, rs); break; case MFLO32: gen_HILO(ctx, OPC_MFLO, minor >> 2, rs); break; case MTHI32: gen_HILO(ctx, OPC_MTHI, minor >> 2, rs); break; case MTLO32: gen_HILO(ctx, OPC_MTLO, minor >> 2, rs); break; default: goto pool32axf_invalid; } break; default: pool32axf_invalid: MIPS_INVAL("pool32axf"); generate_exception(ctx, EXCP_RI); break; } }
true
qemu
240ce26a0533a6e5ee472789fbfbd9f7f939197e
static void gen_pool32axf (CPUMIPSState *env, DisasContext *ctx, int rt, int rs, int *is_branch) { int extension = (ctx->opcode >> 6) & 0x3f; int minor = (ctx->opcode >> 12) & 0xf; uint32_t mips32_op; switch (extension) { case TEQ: mips32_op = OPC_TEQ; goto do_trap; case TGE: mips32_op = OPC_TGE; goto do_trap; case TGEU: mips32_op = OPC_TGEU; goto do_trap; case TLT: mips32_op = OPC_TLT; goto do_trap; case TLTU: mips32_op = OPC_TLTU; goto do_trap; case TNE: mips32_op = OPC_TNE; do_trap: gen_trap(ctx, mips32_op, rs, rt, -1); break; #ifndef CONFIG_USER_ONLY case MFC0: case MFC0 + 32: check_cp0_enabled(ctx); if (rt == 0) { break; } gen_mfc0(ctx, cpu_gpr[rt], rs, (ctx->opcode >> 11) & 0x7); break; case MTC0: case MTC0 + 32: check_cp0_enabled(ctx); { TCGv t0 = tcg_temp_new(); gen_load_gpr(t0, rt); gen_mtc0(ctx, t0, rs, (ctx->opcode >> 11) & 0x7); tcg_temp_free(t0); } break; #endif case 0x2c: switch (minor) { case SEB: gen_bshfl(ctx, OPC_SEB, rs, rt); break; case SEH: gen_bshfl(ctx, OPC_SEH, rs, rt); break; case CLO: mips32_op = OPC_CLO; goto do_cl; case CLZ: mips32_op = OPC_CLZ; do_cl: check_insn(ctx, ISA_MIPS32); gen_cl(ctx, mips32_op, rt, rs); break; case RDHWR: gen_rdhwr(ctx, rt, rs); break; case WSBH: gen_bshfl(ctx, OPC_WSBH, rs, rt); break; case MULT: mips32_op = OPC_MULT; goto do_mul; case MULTU: mips32_op = OPC_MULTU; goto do_mul; case DIV: mips32_op = OPC_DIV; goto do_div; case DIVU: mips32_op = OPC_DIVU; goto do_div; do_div: check_insn(ctx, ISA_MIPS32); gen_muldiv(ctx, mips32_op, 0, rs, rt); break; case MADD: mips32_op = OPC_MADD; goto do_mul; case MADDU: mips32_op = OPC_MADDU; goto do_mul; case MSUB: mips32_op = OPC_MSUB; goto do_mul; case MSUBU: mips32_op = OPC_MSUBU; do_mul: check_insn(ctx, ISA_MIPS32); gen_muldiv(ctx, mips32_op, (ctx->opcode >> 14) & 3, rs, rt); break; default: goto pool32axf_invalid; } break; case 0x34: switch (minor) { case MFC2: case MTC2: case MFHC2: case MTHC2: case CFC2: case CTC2: generate_exception_err(ctx, EXCP_CpU, 2); break; default: goto pool32axf_invalid; } break; case 0x3c: switch (minor) { case JALR: case JALR_HB: gen_compute_branch (ctx, OPC_JALR, 4, rs, rt, 0); *is_branch = 1; break; case JALRS: case JALRS_HB: gen_compute_branch (ctx, OPC_JALRS, 4, rs, rt, 0); *is_branch = 1; break; default: goto pool32axf_invalid; } break; case 0x05: switch (minor) { case RDPGPR: check_cp0_enabled(ctx); check_insn(ctx, ISA_MIPS32R2); gen_load_srsgpr(rt, rs); break; case WRPGPR: check_cp0_enabled(ctx); check_insn(ctx, ISA_MIPS32R2); gen_store_srsgpr(rt, rs); break; default: goto pool32axf_invalid; } break; #ifndef CONFIG_USER_ONLY case 0x0d: switch (minor) { case TLBP: mips32_op = OPC_TLBP; goto do_cp0; case TLBR: mips32_op = OPC_TLBR; goto do_cp0; case TLBWI: mips32_op = OPC_TLBWI; goto do_cp0; case TLBWR: mips32_op = OPC_TLBWR; goto do_cp0; case WAIT: mips32_op = OPC_WAIT; goto do_cp0; case DERET: mips32_op = OPC_DERET; goto do_cp0; case ERET: mips32_op = OPC_ERET; do_cp0: gen_cp0(env, ctx, mips32_op, rt, rs); break; default: goto pool32axf_invalid; } break; case 0x1d: switch (minor) { case DI: check_cp0_enabled(ctx); { TCGv t0 = tcg_temp_new(); save_cpu_state(ctx, 1); gen_helper_di(t0, cpu_env); gen_store_gpr(t0, rs); ctx->bstate = BS_STOP; tcg_temp_free(t0); } break; case EI: check_cp0_enabled(ctx); { TCGv t0 = tcg_temp_new(); save_cpu_state(ctx, 1); gen_helper_ei(t0, cpu_env); gen_store_gpr(t0, rs); ctx->bstate = BS_STOP; tcg_temp_free(t0); } break; default: goto pool32axf_invalid; } break; #endif case 0x2d: switch (minor) { case SYNC: break; case SYSCALL: generate_exception(ctx, EXCP_SYSCALL); ctx->bstate = BS_STOP; break; case SDBBP: check_insn(ctx, ISA_MIPS32); if (!(ctx->hflags & MIPS_HFLAG_DM)) { generate_exception(ctx, EXCP_DBp); } else { generate_exception(ctx, EXCP_DBp); } break; default: goto pool32axf_invalid; } break; case 0x35: switch (minor & 3) { case MFHI32: gen_HILO(ctx, OPC_MFHI, minor >> 2, rs); break; case MFLO32: gen_HILO(ctx, OPC_MFLO, minor >> 2, rs); break; case MTHI32: gen_HILO(ctx, OPC_MTHI, minor >> 2, rs); break; case MTLO32: gen_HILO(ctx, OPC_MTLO, minor >> 2, rs); break; default: goto pool32axf_invalid; } break; default: pool32axf_invalid: MIPS_INVAL("pool32axf"); generate_exception(ctx, EXCP_RI); break; } }
{ "code": [ "static void gen_pool32axf (CPUMIPSState *env, DisasContext *ctx, int rt, int rs,", " int *is_branch)", " *is_branch = 1;", " *is_branch = 1;", " *is_branch = 1;", " *is_branch = 1;", " *is_branch = 1;", " *is_branch = 1;", " *is_branch = 1;" ], "line_no": [ 1, 3, 255, 255, 255, 255, 255, 255, 255 ] }
static void FUNC_0 (CPUMIPSState *VAR_0, DisasContext *VAR_1, int VAR_2, int VAR_3, int *VAR_4) { int VAR_5 = (VAR_1->opcode >> 6) & 0x3f; int VAR_6 = (VAR_1->opcode >> 12) & 0xf; uint32_t mips32_op; switch (VAR_5) { case TEQ: mips32_op = OPC_TEQ; goto do_trap; case TGE: mips32_op = OPC_TGE; goto do_trap; case TGEU: mips32_op = OPC_TGEU; goto do_trap; case TLT: mips32_op = OPC_TLT; goto do_trap; case TLTU: mips32_op = OPC_TLTU; goto do_trap; case TNE: mips32_op = OPC_TNE; do_trap: gen_trap(VAR_1, mips32_op, VAR_3, VAR_2, -1); break; #ifndef CONFIG_USER_ONLY case MFC0: case MFC0 + 32: check_cp0_enabled(VAR_1); if (VAR_2 == 0) { break; } gen_mfc0(VAR_1, cpu_gpr[VAR_2], VAR_3, (VAR_1->opcode >> 11) & 0x7); break; case MTC0: case MTC0 + 32: check_cp0_enabled(VAR_1); { TCGv t0 = tcg_temp_new(); gen_load_gpr(t0, VAR_2); gen_mtc0(VAR_1, t0, VAR_3, (VAR_1->opcode >> 11) & 0x7); tcg_temp_free(t0); } break; #endif case 0x2c: switch (VAR_6) { case SEB: gen_bshfl(VAR_1, OPC_SEB, VAR_3, VAR_2); break; case SEH: gen_bshfl(VAR_1, OPC_SEH, VAR_3, VAR_2); break; case CLO: mips32_op = OPC_CLO; goto do_cl; case CLZ: mips32_op = OPC_CLZ; do_cl: check_insn(VAR_1, ISA_MIPS32); gen_cl(VAR_1, mips32_op, VAR_2, VAR_3); break; case RDHWR: gen_rdhwr(VAR_1, VAR_2, VAR_3); break; case WSBH: gen_bshfl(VAR_1, OPC_WSBH, VAR_3, VAR_2); break; case MULT: mips32_op = OPC_MULT; goto do_mul; case MULTU: mips32_op = OPC_MULTU; goto do_mul; case DIV: mips32_op = OPC_DIV; goto do_div; case DIVU: mips32_op = OPC_DIVU; goto do_div; do_div: check_insn(VAR_1, ISA_MIPS32); gen_muldiv(VAR_1, mips32_op, 0, VAR_3, VAR_2); break; case MADD: mips32_op = OPC_MADD; goto do_mul; case MADDU: mips32_op = OPC_MADDU; goto do_mul; case MSUB: mips32_op = OPC_MSUB; goto do_mul; case MSUBU: mips32_op = OPC_MSUBU; do_mul: check_insn(VAR_1, ISA_MIPS32); gen_muldiv(VAR_1, mips32_op, (VAR_1->opcode >> 14) & 3, VAR_3, VAR_2); break; default: goto pool32axf_invalid; } break; case 0x34: switch (VAR_6) { case MFC2: case MTC2: case MFHC2: case MTHC2: case CFC2: case CTC2: generate_exception_err(VAR_1, EXCP_CpU, 2); break; default: goto pool32axf_invalid; } break; case 0x3c: switch (VAR_6) { case JALR: case JALR_HB: gen_compute_branch (VAR_1, OPC_JALR, 4, VAR_3, VAR_2, 0); *VAR_4 = 1; break; case JALRS: case JALRS_HB: gen_compute_branch (VAR_1, OPC_JALRS, 4, VAR_3, VAR_2, 0); *VAR_4 = 1; break; default: goto pool32axf_invalid; } break; case 0x05: switch (VAR_6) { case RDPGPR: check_cp0_enabled(VAR_1); check_insn(VAR_1, ISA_MIPS32R2); gen_load_srsgpr(VAR_2, VAR_3); break; case WRPGPR: check_cp0_enabled(VAR_1); check_insn(VAR_1, ISA_MIPS32R2); gen_store_srsgpr(VAR_2, VAR_3); break; default: goto pool32axf_invalid; } break; #ifndef CONFIG_USER_ONLY case 0x0d: switch (VAR_6) { case TLBP: mips32_op = OPC_TLBP; goto do_cp0; case TLBR: mips32_op = OPC_TLBR; goto do_cp0; case TLBWI: mips32_op = OPC_TLBWI; goto do_cp0; case TLBWR: mips32_op = OPC_TLBWR; goto do_cp0; case WAIT: mips32_op = OPC_WAIT; goto do_cp0; case DERET: mips32_op = OPC_DERET; goto do_cp0; case ERET: mips32_op = OPC_ERET; do_cp0: gen_cp0(VAR_0, VAR_1, mips32_op, VAR_2, VAR_3); break; default: goto pool32axf_invalid; } break; case 0x1d: switch (VAR_6) { case DI: check_cp0_enabled(VAR_1); { TCGv t0 = tcg_temp_new(); save_cpu_state(VAR_1, 1); gen_helper_di(t0, cpu_env); gen_store_gpr(t0, VAR_3); VAR_1->bstate = BS_STOP; tcg_temp_free(t0); } break; case EI: check_cp0_enabled(VAR_1); { TCGv t0 = tcg_temp_new(); save_cpu_state(VAR_1, 1); gen_helper_ei(t0, cpu_env); gen_store_gpr(t0, VAR_3); VAR_1->bstate = BS_STOP; tcg_temp_free(t0); } break; default: goto pool32axf_invalid; } break; #endif case 0x2d: switch (VAR_6) { case SYNC: break; case SYSCALL: generate_exception(VAR_1, EXCP_SYSCALL); VAR_1->bstate = BS_STOP; break; case SDBBP: check_insn(VAR_1, ISA_MIPS32); if (!(VAR_1->hflags & MIPS_HFLAG_DM)) { generate_exception(VAR_1, EXCP_DBp); } else { generate_exception(VAR_1, EXCP_DBp); } break; default: goto pool32axf_invalid; } break; case 0x35: switch (VAR_6 & 3) { case MFHI32: gen_HILO(VAR_1, OPC_MFHI, VAR_6 >> 2, VAR_3); break; case MFLO32: gen_HILO(VAR_1, OPC_MFLO, VAR_6 >> 2, VAR_3); break; case MTHI32: gen_HILO(VAR_1, OPC_MTHI, VAR_6 >> 2, VAR_3); break; case MTLO32: gen_HILO(VAR_1, OPC_MTLO, VAR_6 >> 2, VAR_3); break; default: goto pool32axf_invalid; } break; default: pool32axf_invalid: MIPS_INVAL("pool32axf"); generate_exception(VAR_1, EXCP_RI); break; } }
[ "static void FUNC_0 (CPUMIPSState *VAR_0, DisasContext *VAR_1, int VAR_2, int VAR_3,\nint *VAR_4)\n{", "int VAR_5 = (VAR_1->opcode >> 6) & 0x3f;", "int VAR_6 = (VAR_1->opcode >> 12) & 0xf;", "uint32_t mips32_op;", "switch (VAR_5) {", "case TEQ:\nmips32_op = OPC_TEQ;", "goto do_trap;", "case TGE:\nmips32_op = OPC_TGE;", "goto do_trap;", "case TGEU:\nmips32_op = OPC_TGEU;", "goto do_trap;", "case TLT:\nmips32_op = OPC_TLT;", "goto do_trap;", "case TLTU:\nmips32_op = OPC_TLTU;", "goto do_trap;", "case TNE:\nmips32_op = OPC_TNE;", "do_trap:\ngen_trap(VAR_1, mips32_op, VAR_3, VAR_2, -1);", "break;", "#ifndef CONFIG_USER_ONLY\ncase MFC0:\ncase MFC0 + 32:\ncheck_cp0_enabled(VAR_1);", "if (VAR_2 == 0) {", "break;", "}", "gen_mfc0(VAR_1, cpu_gpr[VAR_2], VAR_3, (VAR_1->opcode >> 11) & 0x7);", "break;", "case MTC0:\ncase MTC0 + 32:\ncheck_cp0_enabled(VAR_1);", "{", "TCGv t0 = tcg_temp_new();", "gen_load_gpr(t0, VAR_2);", "gen_mtc0(VAR_1, t0, VAR_3, (VAR_1->opcode >> 11) & 0x7);", "tcg_temp_free(t0);", "}", "break;", "#endif\ncase 0x2c:\nswitch (VAR_6) {", "case SEB:\ngen_bshfl(VAR_1, OPC_SEB, VAR_3, VAR_2);", "break;", "case SEH:\ngen_bshfl(VAR_1, OPC_SEH, VAR_3, VAR_2);", "break;", "case CLO:\nmips32_op = OPC_CLO;", "goto do_cl;", "case CLZ:\nmips32_op = OPC_CLZ;", "do_cl:\ncheck_insn(VAR_1, ISA_MIPS32);", "gen_cl(VAR_1, mips32_op, VAR_2, VAR_3);", "break;", "case RDHWR:\ngen_rdhwr(VAR_1, VAR_2, VAR_3);", "break;", "case WSBH:\ngen_bshfl(VAR_1, OPC_WSBH, VAR_3, VAR_2);", "break;", "case MULT:\nmips32_op = OPC_MULT;", "goto do_mul;", "case MULTU:\nmips32_op = OPC_MULTU;", "goto do_mul;", "case DIV:\nmips32_op = OPC_DIV;", "goto do_div;", "case DIVU:\nmips32_op = OPC_DIVU;", "goto do_div;", "do_div:\ncheck_insn(VAR_1, ISA_MIPS32);", "gen_muldiv(VAR_1, mips32_op, 0, VAR_3, VAR_2);", "break;", "case MADD:\nmips32_op = OPC_MADD;", "goto do_mul;", "case MADDU:\nmips32_op = OPC_MADDU;", "goto do_mul;", "case MSUB:\nmips32_op = OPC_MSUB;", "goto do_mul;", "case MSUBU:\nmips32_op = OPC_MSUBU;", "do_mul:\ncheck_insn(VAR_1, ISA_MIPS32);", "gen_muldiv(VAR_1, mips32_op, (VAR_1->opcode >> 14) & 3, VAR_3, VAR_2);", "break;", "default:\ngoto pool32axf_invalid;", "}", "break;", "case 0x34:\nswitch (VAR_6) {", "case MFC2:\ncase MTC2:\ncase MFHC2:\ncase MTHC2:\ncase CFC2:\ncase CTC2:\ngenerate_exception_err(VAR_1, EXCP_CpU, 2);", "break;", "default:\ngoto pool32axf_invalid;", "}", "break;", "case 0x3c:\nswitch (VAR_6) {", "case JALR:\ncase JALR_HB:\ngen_compute_branch (VAR_1, OPC_JALR, 4, VAR_3, VAR_2, 0);", "*VAR_4 = 1;", "break;", "case JALRS:\ncase JALRS_HB:\ngen_compute_branch (VAR_1, OPC_JALRS, 4, VAR_3, VAR_2, 0);", "*VAR_4 = 1;", "break;", "default:\ngoto pool32axf_invalid;", "}", "break;", "case 0x05:\nswitch (VAR_6) {", "case RDPGPR:\ncheck_cp0_enabled(VAR_1);", "check_insn(VAR_1, ISA_MIPS32R2);", "gen_load_srsgpr(VAR_2, VAR_3);", "break;", "case WRPGPR:\ncheck_cp0_enabled(VAR_1);", "check_insn(VAR_1, ISA_MIPS32R2);", "gen_store_srsgpr(VAR_2, VAR_3);", "break;", "default:\ngoto pool32axf_invalid;", "}", "break;", "#ifndef CONFIG_USER_ONLY\ncase 0x0d:\nswitch (VAR_6) {", "case TLBP:\nmips32_op = OPC_TLBP;", "goto do_cp0;", "case TLBR:\nmips32_op = OPC_TLBR;", "goto do_cp0;", "case TLBWI:\nmips32_op = OPC_TLBWI;", "goto do_cp0;", "case TLBWR:\nmips32_op = OPC_TLBWR;", "goto do_cp0;", "case WAIT:\nmips32_op = OPC_WAIT;", "goto do_cp0;", "case DERET:\nmips32_op = OPC_DERET;", "goto do_cp0;", "case ERET:\nmips32_op = OPC_ERET;", "do_cp0:\ngen_cp0(VAR_0, VAR_1, mips32_op, VAR_2, VAR_3);", "break;", "default:\ngoto pool32axf_invalid;", "}", "break;", "case 0x1d:\nswitch (VAR_6) {", "case DI:\ncheck_cp0_enabled(VAR_1);", "{", "TCGv t0 = tcg_temp_new();", "save_cpu_state(VAR_1, 1);", "gen_helper_di(t0, cpu_env);", "gen_store_gpr(t0, VAR_3);", "VAR_1->bstate = BS_STOP;", "tcg_temp_free(t0);", "}", "break;", "case EI:\ncheck_cp0_enabled(VAR_1);", "{", "TCGv t0 = tcg_temp_new();", "save_cpu_state(VAR_1, 1);", "gen_helper_ei(t0, cpu_env);", "gen_store_gpr(t0, VAR_3);", "VAR_1->bstate = BS_STOP;", "tcg_temp_free(t0);", "}", "break;", "default:\ngoto pool32axf_invalid;", "}", "break;", "#endif\ncase 0x2d:\nswitch (VAR_6) {", "case SYNC:\nbreak;", "case SYSCALL:\ngenerate_exception(VAR_1, EXCP_SYSCALL);", "VAR_1->bstate = BS_STOP;", "break;", "case SDBBP:\ncheck_insn(VAR_1, ISA_MIPS32);", "if (!(VAR_1->hflags & MIPS_HFLAG_DM)) {", "generate_exception(VAR_1, EXCP_DBp);", "} else {", "generate_exception(VAR_1, EXCP_DBp);", "}", "break;", "default:\ngoto pool32axf_invalid;", "}", "break;", "case 0x35:\nswitch (VAR_6 & 3) {", "case MFHI32:\ngen_HILO(VAR_1, OPC_MFHI, VAR_6 >> 2, VAR_3);", "break;", "case MFLO32:\ngen_HILO(VAR_1, OPC_MFLO, VAR_6 >> 2, VAR_3);", "break;", "case MTHI32:\ngen_HILO(VAR_1, OPC_MTHI, VAR_6 >> 2, VAR_3);", "break;", "case MTLO32:\ngen_HILO(VAR_1, OPC_MTLO, VAR_6 >> 2, VAR_3);", "break;", "default:\ngoto pool32axf_invalid;", "}", "break;", "default:\npool32axf_invalid:\nMIPS_INVAL(\"pool32axf\");", "generate_exception(VAR_1, EXCP_RI);", "break;", "}", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17, 19 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 29, 31 ], [ 33 ], [ 35, 37 ], [ 39 ], [ 41, 43 ], [ 45 ], [ 47, 49 ], [ 51, 53 ], [ 55 ], [ 57, 59, 61, 63 ], [ 65 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77, 79, 81 ], [ 83 ], [ 85 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99, 101, 103 ], [ 105, 107 ], [ 109 ], [ 111, 113 ], [ 115 ], [ 117, 119 ], [ 121 ], [ 123, 125 ], [ 127, 129 ], [ 131 ], [ 133 ], [ 135, 137 ], [ 139 ], [ 141, 143 ], [ 145 ], [ 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 ], [ 257 ], [ 259, 261, 263 ], [ 265 ], [ 267 ], [ 269, 271 ], [ 273 ], [ 275 ], [ 277, 279 ], [ 281, 283 ], [ 285 ], [ 287 ], [ 289 ], [ 291, 293 ], [ 295 ], [ 297 ], [ 299 ], [ 301, 303 ], [ 305 ], [ 307 ], [ 309, 311, 313 ], [ 315, 317 ], [ 319 ], [ 321, 323 ], [ 325 ], [ 327, 329 ], [ 331 ], [ 333, 335 ], [ 337 ], [ 339, 341 ], [ 343 ], [ 345, 347 ], [ 349 ], [ 351, 353 ], [ 355, 357 ], [ 359 ], [ 361, 363 ], [ 365 ], [ 367 ], [ 369, 371 ], [ 373, 375 ], [ 377 ], [ 379 ], [ 383 ], [ 385 ], [ 387 ], [ 391 ], [ 393 ], [ 395 ], [ 397 ], [ 399, 401 ], [ 403 ], [ 405 ], [ 409 ], [ 411 ], [ 413 ], [ 417 ], [ 419 ], [ 421 ], [ 423 ], [ 425, 427 ], [ 429 ], [ 431 ], [ 433, 435, 437 ], [ 439, 443 ], [ 445, 447 ], [ 449 ], [ 451 ], [ 453, 455 ], [ 457 ], [ 459 ], [ 461 ], [ 463 ], [ 465 ], [ 467 ], [ 469, 471 ], [ 473 ], [ 475 ], [ 477, 479 ], [ 481, 483 ], [ 485 ], [ 487, 489 ], [ 491 ], [ 493, 495 ], [ 497 ], [ 499, 501 ], [ 503 ], [ 505, 507 ], [ 509 ], [ 511 ], [ 513, 515, 517 ], [ 519 ], [ 521 ], [ 523 ], [ 525 ] ]
17,924
static int mpegts_write_pmt(AVFormatContext *s, MpegTSService *service) { MpegTSWrite *ts = s->priv_data; uint8_t data[SECTION_LENGTH], *q, *desc_length_ptr, *program_info_length_ptr; int val, stream_type, i, err = 0; q = data; put16(&q, 0xe000 | service->pcr_pid); program_info_length_ptr = q; q += 2; /* patched after */ /* put program info here */ val = 0xf000 | (q - program_info_length_ptr - 2); program_info_length_ptr[0] = val >> 8; program_info_length_ptr[1] = val; for (i = 0; i < s->nb_streams; i++) { AVStream *st = s->streams[i]; MpegTSWriteStream *ts_st = st->priv_data; AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL, 0); if (q - data > SECTION_LENGTH - 32) { err = 1; break; } switch (st->codec->codec_id) { case AV_CODEC_ID_MPEG1VIDEO: case AV_CODEC_ID_MPEG2VIDEO: stream_type = STREAM_TYPE_VIDEO_MPEG2; break; case AV_CODEC_ID_MPEG4: stream_type = STREAM_TYPE_VIDEO_MPEG4; break; case AV_CODEC_ID_H264: stream_type = STREAM_TYPE_VIDEO_H264; break; case AV_CODEC_ID_HEVC: stream_type = STREAM_TYPE_VIDEO_HEVC; break; case AV_CODEC_ID_CAVS: stream_type = STREAM_TYPE_VIDEO_CAVS; break; case AV_CODEC_ID_DIRAC: stream_type = STREAM_TYPE_VIDEO_DIRAC; break; case AV_CODEC_ID_VC1: stream_type = STREAM_TYPE_VIDEO_VC1; break; case AV_CODEC_ID_MP2: case AV_CODEC_ID_MP3: stream_type = STREAM_TYPE_AUDIO_MPEG1; break; case AV_CODEC_ID_AAC: stream_type = (ts->flags & MPEGTS_FLAG_AAC_LATM) ? STREAM_TYPE_AUDIO_AAC_LATM : STREAM_TYPE_AUDIO_AAC; break; case AV_CODEC_ID_AAC_LATM: stream_type = STREAM_TYPE_AUDIO_AAC_LATM; break; case AV_CODEC_ID_AC3: stream_type = STREAM_TYPE_AUDIO_AC3; break; case AV_CODEC_ID_DTS: stream_type = STREAM_TYPE_AUDIO_DTS; break; case AV_CODEC_ID_TRUEHD: stream_type = STREAM_TYPE_AUDIO_TRUEHD; break; case AV_CODEC_ID_OPUS: stream_type = STREAM_TYPE_PRIVATE_DATA; break; default: stream_type = STREAM_TYPE_PRIVATE_DATA; break; } *q++ = stream_type; put16(&q, 0xe000 | ts_st->pid); desc_length_ptr = q; q += 2; /* patched after */ /* write optional descriptors here */ switch (st->codec->codec_type) { case AVMEDIA_TYPE_AUDIO: if (st->codec->codec_id==AV_CODEC_ID_EAC3) { *q++=0x7a; // EAC3 descriptor see A038 DVB SI *q++=1; // 1 byte, all flags sets to 0 *q++=0; // omit all fields... } if (st->codec->codec_id==AV_CODEC_ID_S302M) { *q++ = 0x05; /* MPEG-2 registration descriptor*/ *q++ = 4; *q++ = 'B'; *q++ = 'S'; *q++ = 'S'; *q++ = 'D'; } if (st->codec->codec_id==AV_CODEC_ID_OPUS) { /* 6 bytes registration descriptor, 4 bytes Opus audio descriptor */ if (q - data > SECTION_LENGTH - 6 - 4) { err = 1; break; } *q++ = 0x05; /* MPEG-2 registration descriptor*/ *q++ = 4; *q++ = 'O'; *q++ = 'p'; *q++ = 'u'; *q++ = 's'; *q++ = 0x7f; /* DVB extension descriptor */ *q++ = 2; *q++ = 0x80; if (st->codec->extradata && st->codec->extradata_size >= 19) { if (st->codec->extradata[18] == 0 && st->codec->channels <= 2) { /* RTP mapping family */ *q++ = st->codec->channels; } else if (st->codec->extradata[18] == 1 && st->codec->channels <= 8 && st->codec->extradata_size >= 21 + st->codec->channels) { static const uint8_t coupled_stream_counts[9] = { 1, 0, 1, 1, 2, 2, 2, 3, 3 }; static const uint8_t channel_map_a[8][8] = { {0}, {0, 1}, {0, 2, 1}, {0, 1, 2, 3}, {0, 4, 1, 2, 3}, {0, 4, 1, 2, 3, 5}, {0, 4, 1, 2, 3, 5, 6}, {0, 6, 1, 2, 3, 4, 5, 7}, }; static const uint8_t channel_map_b[8][8] = { {0}, {0, 1}, {0, 1, 2}, {0, 1, 2, 3}, {0, 1, 2, 3, 4}, {0, 1, 2, 3, 4, 5}, {0, 1, 2, 3, 4, 5, 6}, {0, 1, 2, 3, 4, 5, 6, 7}, }; /* Vorbis mapping family */ if (st->codec->extradata[19] == st->codec->channels - coupled_stream_counts[st->codec->channels] && st->codec->extradata[20] == coupled_stream_counts[st->codec->channels] && memcmp(&st->codec->extradata[21], channel_map_a[st->codec->channels], st->codec->channels) == 0) { *q++ = st->codec->channels; } else if (st->codec->channels >= 2 && st->codec->extradata[19] == st->codec->channels && st->codec->extradata[20] == 0 && memcmp(&st->codec->extradata[21], channel_map_b[st->codec->channels], st->codec->channels) == 0) { *q++ = st->codec->channels | 0x80; } else { /* Unsupported, could write an extended descriptor here */ av_log(s, AV_LOG_ERROR, "Unsupported Opus Vorbis-style channel mapping"); *q++ = 0xff; } } else { /* Unsupported */ av_log(s, AV_LOG_ERROR, "Unsupported Opus channel mapping for family %d", st->codec->extradata[18]); *q++ = 0xff; } } else if (st->codec->channels <= 2) { /* Assume RTP mapping family */ *q++ = st->codec->channels; } else { /* Unsupported */ av_log(s, AV_LOG_ERROR, "Unsupported Opus channel mapping"); *q++ = 0xff; } } if (lang) { char *p; char *next = lang->value; uint8_t *len_ptr; *q++ = 0x0a; /* ISO 639 language descriptor */ len_ptr = q++; *len_ptr = 0; for (p = lang->value; next && *len_ptr < 255 / 4 * 4; p = next + 1) { if (q - data > SECTION_LENGTH - 4) { err = 1; break; } next = strchr(p, ','); if (strlen(p) != 3 && (!next || next != p + 3)) continue; /* not a 3-letter code */ *q++ = *p++; *q++ = *p++; *q++ = *p++; if (st->disposition & AV_DISPOSITION_CLEAN_EFFECTS) *q++ = 0x01; else if (st->disposition & AV_DISPOSITION_HEARING_IMPAIRED) *q++ = 0x02; else if (st->disposition & AV_DISPOSITION_VISUAL_IMPAIRED) *q++ = 0x03; else *q++ = 0; /* undefined type */ *len_ptr += 4; } if (*len_ptr == 0) q -= 2; /* no language codes were written */ } break; case AVMEDIA_TYPE_SUBTITLE: { const char default_language[] = "und"; const char *language = lang && strlen(lang->value) >= 3 ? lang->value : default_language; if (st->codec->codec_id == AV_CODEC_ID_DVB_SUBTITLE) { uint8_t *len_ptr; int extradata_copied = 0; *q++ = 0x59; /* subtitling_descriptor */ len_ptr = q++; while (strlen(language) >= 3) { if (sizeof(data) - (q - data) < 8) { /* 8 bytes per DVB subtitle substream data */ err = 1; break; } *q++ = *language++; *q++ = *language++; *q++ = *language++; /* Skip comma */ if (*language != '\0') language++; if (st->codec->extradata_size - extradata_copied >= 5) { *q++ = st->codec->extradata[extradata_copied + 4]; /* subtitling_type */ memcpy(q, st->codec->extradata + extradata_copied, 4); /* composition_page_id and ancillary_page_id */ extradata_copied += 5; q += 4; } else { /* subtitling_type: * 0x10 - normal with no monitor aspect ratio criticality * 0x20 - for the hard of hearing with no monitor aspect ratio criticality */ *q++ = (st->disposition & AV_DISPOSITION_HEARING_IMPAIRED) ? 0x20 : 0x10; if ((st->codec->extradata_size == 4) && (extradata_copied == 0)) { /* support of old 4-byte extradata format */ memcpy(q, st->codec->extradata, 4); /* composition_page_id and ancillary_page_id */ extradata_copied += 4; q += 4; } else { put16(&q, 1); /* composition_page_id */ put16(&q, 1); /* ancillary_page_id */ } } } *len_ptr = q - len_ptr - 1; } else if (st->codec->codec_id == AV_CODEC_ID_DVB_TELETEXT) { uint8_t *len_ptr = NULL; int extradata_copied = 0; /* The descriptor tag. teletext_descriptor */ *q++ = 0x56; len_ptr = q++; while (strlen(language) >= 3 && q - data < sizeof(data) - 6) { *q++ = *language++; *q++ = *language++; *q++ = *language++; /* Skip comma */ if (*language != '\0') language++; if (st->codec->extradata_size - 1 > extradata_copied) { memcpy(q, st->codec->extradata + extradata_copied, 2); extradata_copied += 2; q += 2; } else { /* The Teletext descriptor: * teletext_type: This 5-bit field indicates the type of Teletext page indicated. (0x01 Initial Teletext page) * teletext_magazine_number: This is a 3-bit field which identifies the magazine number. * teletext_page_number: This is an 8-bit field giving two 4-bit hex digits identifying the page number. */ *q++ = 0x08; *q++ = 0x00; } } *len_ptr = q - len_ptr - 1; } } break; case AVMEDIA_TYPE_VIDEO: if (stream_type == STREAM_TYPE_VIDEO_DIRAC) { *q++ = 0x05; /*MPEG-2 registration descriptor*/ *q++ = 4; *q++ = 'd'; *q++ = 'r'; *q++ = 'a'; *q++ = 'c'; } else if (stream_type == STREAM_TYPE_VIDEO_VC1) { *q++ = 0x05; /*MPEG-2 registration descriptor*/ *q++ = 4; *q++ = 'V'; *q++ = 'C'; *q++ = '-'; *q++ = '1'; } break; case AVMEDIA_TYPE_DATA: if (st->codec->codec_id == AV_CODEC_ID_SMPTE_KLV) { *q++ = 0x05; /* MPEG-2 registration descriptor */ *q++ = 4; *q++ = 'K'; *q++ = 'L'; *q++ = 'V'; *q++ = 'A'; } break; } val = 0xf000 | (q - desc_length_ptr - 2); desc_length_ptr[0] = val >> 8; desc_length_ptr[1] = val; } if (err) av_log(s, AV_LOG_ERROR, "The PMT section cannot fit stream %d and all following streams.\n" "Try reducing the number of languages in the audio streams " "or the total number of streams.\n", i); mpegts_write_section1(&service->pmt, PMT_TID, service->sid, ts->tables_version, 0, 0, data, q - data); return 0; }
true
FFmpeg
eb3628d87f67b35e8dd354a466028e93bdd7f9c0
static int mpegts_write_pmt(AVFormatContext *s, MpegTSService *service) { MpegTSWrite *ts = s->priv_data; uint8_t data[SECTION_LENGTH], *q, *desc_length_ptr, *program_info_length_ptr; int val, stream_type, i, err = 0; q = data; put16(&q, 0xe000 | service->pcr_pid); program_info_length_ptr = q; q += 2; val = 0xf000 | (q - program_info_length_ptr - 2); program_info_length_ptr[0] = val >> 8; program_info_length_ptr[1] = val; for (i = 0; i < s->nb_streams; i++) { AVStream *st = s->streams[i]; MpegTSWriteStream *ts_st = st->priv_data; AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL, 0); if (q - data > SECTION_LENGTH - 32) { err = 1; break; } switch (st->codec->codec_id) { case AV_CODEC_ID_MPEG1VIDEO: case AV_CODEC_ID_MPEG2VIDEO: stream_type = STREAM_TYPE_VIDEO_MPEG2; break; case AV_CODEC_ID_MPEG4: stream_type = STREAM_TYPE_VIDEO_MPEG4; break; case AV_CODEC_ID_H264: stream_type = STREAM_TYPE_VIDEO_H264; break; case AV_CODEC_ID_HEVC: stream_type = STREAM_TYPE_VIDEO_HEVC; break; case AV_CODEC_ID_CAVS: stream_type = STREAM_TYPE_VIDEO_CAVS; break; case AV_CODEC_ID_DIRAC: stream_type = STREAM_TYPE_VIDEO_DIRAC; break; case AV_CODEC_ID_VC1: stream_type = STREAM_TYPE_VIDEO_VC1; break; case AV_CODEC_ID_MP2: case AV_CODEC_ID_MP3: stream_type = STREAM_TYPE_AUDIO_MPEG1; break; case AV_CODEC_ID_AAC: stream_type = (ts->flags & MPEGTS_FLAG_AAC_LATM) ? STREAM_TYPE_AUDIO_AAC_LATM : STREAM_TYPE_AUDIO_AAC; break; case AV_CODEC_ID_AAC_LATM: stream_type = STREAM_TYPE_AUDIO_AAC_LATM; break; case AV_CODEC_ID_AC3: stream_type = STREAM_TYPE_AUDIO_AC3; break; case AV_CODEC_ID_DTS: stream_type = STREAM_TYPE_AUDIO_DTS; break; case AV_CODEC_ID_TRUEHD: stream_type = STREAM_TYPE_AUDIO_TRUEHD; break; case AV_CODEC_ID_OPUS: stream_type = STREAM_TYPE_PRIVATE_DATA; break; default: stream_type = STREAM_TYPE_PRIVATE_DATA; break; } *q++ = stream_type; put16(&q, 0xe000 | ts_st->pid); desc_length_ptr = q; q += 2; switch (st->codec->codec_type) { case AVMEDIA_TYPE_AUDIO: if (st->codec->codec_id==AV_CODEC_ID_EAC3) { *q++=0x7a; *q++=1; *q++=0; } if (st->codec->codec_id==AV_CODEC_ID_S302M) { *q++ = 0x05; *q++ = 4; *q++ = 'B'; *q++ = 'S'; *q++ = 'S'; *q++ = 'D'; } if (st->codec->codec_id==AV_CODEC_ID_OPUS) { if (q - data > SECTION_LENGTH - 6 - 4) { err = 1; break; } *q++ = 0x05; *q++ = 4; *q++ = 'O'; *q++ = 'p'; *q++ = 'u'; *q++ = 's'; *q++ = 0x7f; *q++ = 2; *q++ = 0x80; if (st->codec->extradata && st->codec->extradata_size >= 19) { if (st->codec->extradata[18] == 0 && st->codec->channels <= 2) { *q++ = st->codec->channels; } else if (st->codec->extradata[18] == 1 && st->codec->channels <= 8 && st->codec->extradata_size >= 21 + st->codec->channels) { static const uint8_t coupled_stream_counts[9] = { 1, 0, 1, 1, 2, 2, 2, 3, 3 }; static const uint8_t channel_map_a[8][8] = { {0}, {0, 1}, {0, 2, 1}, {0, 1, 2, 3}, {0, 4, 1, 2, 3}, {0, 4, 1, 2, 3, 5}, {0, 4, 1, 2, 3, 5, 6}, {0, 6, 1, 2, 3, 4, 5, 7}, }; static const uint8_t channel_map_b[8][8] = { {0}, {0, 1}, {0, 1, 2}, {0, 1, 2, 3}, {0, 1, 2, 3, 4}, {0, 1, 2, 3, 4, 5}, {0, 1, 2, 3, 4, 5, 6}, {0, 1, 2, 3, 4, 5, 6, 7}, }; if (st->codec->extradata[19] == st->codec->channels - coupled_stream_counts[st->codec->channels] && st->codec->extradata[20] == coupled_stream_counts[st->codec->channels] && memcmp(&st->codec->extradata[21], channel_map_a[st->codec->channels], st->codec->channels) == 0) { *q++ = st->codec->channels; } else if (st->codec->channels >= 2 && st->codec->extradata[19] == st->codec->channels && st->codec->extradata[20] == 0 && memcmp(&st->codec->extradata[21], channel_map_b[st->codec->channels], st->codec->channels) == 0) { *q++ = st->codec->channels | 0x80; } else { av_log(s, AV_LOG_ERROR, "Unsupported Opus Vorbis-style channel mapping"); *q++ = 0xff; } } else { av_log(s, AV_LOG_ERROR, "Unsupported Opus channel mapping for family %d", st->codec->extradata[18]); *q++ = 0xff; } } else if (st->codec->channels <= 2) { *q++ = st->codec->channels; } else { av_log(s, AV_LOG_ERROR, "Unsupported Opus channel mapping"); *q++ = 0xff; } } if (lang) { char *p; char *next = lang->value; uint8_t *len_ptr; *q++ = 0x0a; len_ptr = q++; *len_ptr = 0; for (p = lang->value; next && *len_ptr < 255 / 4 * 4; p = next + 1) { if (q - data > SECTION_LENGTH - 4) { err = 1; break; } next = strchr(p, ','); if (strlen(p) != 3 && (!next || next != p + 3)) continue; *q++ = *p++; *q++ = *p++; *q++ = *p++; if (st->disposition & AV_DISPOSITION_CLEAN_EFFECTS) *q++ = 0x01; else if (st->disposition & AV_DISPOSITION_HEARING_IMPAIRED) *q++ = 0x02; else if (st->disposition & AV_DISPOSITION_VISUAL_IMPAIRED) *q++ = 0x03; else *q++ = 0; *len_ptr += 4; } if (*len_ptr == 0) q -= 2; } break; case AVMEDIA_TYPE_SUBTITLE: { const char default_language[] = "und"; const char *language = lang && strlen(lang->value) >= 3 ? lang->value : default_language; if (st->codec->codec_id == AV_CODEC_ID_DVB_SUBTITLE) { uint8_t *len_ptr; int extradata_copied = 0; *q++ = 0x59; len_ptr = q++; while (strlen(language) >= 3) { if (sizeof(data) - (q - data) < 8) { err = 1; break; } *q++ = *language++; *q++ = *language++; *q++ = *language++; if (*language != '\0') language++; if (st->codec->extradata_size - extradata_copied >= 5) { *q++ = st->codec->extradata[extradata_copied + 4]; memcpy(q, st->codec->extradata + extradata_copied, 4); extradata_copied += 5; q += 4; } else { *q++ = (st->disposition & AV_DISPOSITION_HEARING_IMPAIRED) ? 0x20 : 0x10; if ((st->codec->extradata_size == 4) && (extradata_copied == 0)) { memcpy(q, st->codec->extradata, 4); extradata_copied += 4; q += 4; } else { put16(&q, 1); put16(&q, 1); } } } *len_ptr = q - len_ptr - 1; } else if (st->codec->codec_id == AV_CODEC_ID_DVB_TELETEXT) { uint8_t *len_ptr = NULL; int extradata_copied = 0; *q++ = 0x56; len_ptr = q++; while (strlen(language) >= 3 && q - data < sizeof(data) - 6) { *q++ = *language++; *q++ = *language++; *q++ = *language++; if (*language != '\0') language++; if (st->codec->extradata_size - 1 > extradata_copied) { memcpy(q, st->codec->extradata + extradata_copied, 2); extradata_copied += 2; q += 2; } else { *q++ = 0x08; *q++ = 0x00; } } *len_ptr = q - len_ptr - 1; } } break; case AVMEDIA_TYPE_VIDEO: if (stream_type == STREAM_TYPE_VIDEO_DIRAC) { *q++ = 0x05; *q++ = 4; *q++ = 'd'; *q++ = 'r'; *q++ = 'a'; *q++ = 'c'; } else if (stream_type == STREAM_TYPE_VIDEO_VC1) { *q++ = 0x05; *q++ = 4; *q++ = 'V'; *q++ = 'C'; *q++ = '-'; *q++ = '1'; } break; case AVMEDIA_TYPE_DATA: if (st->codec->codec_id == AV_CODEC_ID_SMPTE_KLV) { *q++ = 0x05; *q++ = 4; *q++ = 'K'; *q++ = 'L'; *q++ = 'V'; *q++ = 'A'; } break; } val = 0xf000 | (q - desc_length_ptr - 2); desc_length_ptr[0] = val >> 8; desc_length_ptr[1] = val; } if (err) av_log(s, AV_LOG_ERROR, "The PMT section cannot fit stream %d and all following streams.\n" "Try reducing the number of languages in the audio streams " "or the total number of streams.\n", i); mpegts_write_section1(&service->pmt, PMT_TID, service->sid, ts->tables_version, 0, 0, data, q - data); return 0; }
{ "code": [ " memcmp(&st->codec->extradata[21], channel_map_a[st->codec->channels], st->codec->channels) == 0) {", " memcmp(&st->codec->extradata[21], channel_map_b[st->codec->channels], st->codec->channels) == 0) {" ], "line_no": [ 303, 311 ] }
static int FUNC_0(AVFormatContext *VAR_0, MpegTSService *VAR_1) { MpegTSWrite *ts = VAR_0->priv_data; uint8_t data[SECTION_LENGTH], *q, *desc_length_ptr, *program_info_length_ptr; int VAR_2, VAR_3, VAR_4, VAR_5 = 0; q = data; put16(&q, 0xe000 | VAR_1->pcr_pid); program_info_length_ptr = q; q += 2; VAR_2 = 0xf000 | (q - program_info_length_ptr - 2); program_info_length_ptr[0] = VAR_2 >> 8; program_info_length_ptr[1] = VAR_2; for (VAR_4 = 0; VAR_4 < VAR_0->nb_streams; VAR_4++) { AVStream *st = VAR_0->streams[VAR_4]; MpegTSWriteStream *ts_st = st->priv_data; AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL, 0); if (q - data > SECTION_LENGTH - 32) { VAR_5 = 1; break; } switch (st->codec->codec_id) { case AV_CODEC_ID_MPEG1VIDEO: case AV_CODEC_ID_MPEG2VIDEO: VAR_3 = STREAM_TYPE_VIDEO_MPEG2; break; case AV_CODEC_ID_MPEG4: VAR_3 = STREAM_TYPE_VIDEO_MPEG4; break; case AV_CODEC_ID_H264: VAR_3 = STREAM_TYPE_VIDEO_H264; break; case AV_CODEC_ID_HEVC: VAR_3 = STREAM_TYPE_VIDEO_HEVC; break; case AV_CODEC_ID_CAVS: VAR_3 = STREAM_TYPE_VIDEO_CAVS; break; case AV_CODEC_ID_DIRAC: VAR_3 = STREAM_TYPE_VIDEO_DIRAC; break; case AV_CODEC_ID_VC1: VAR_3 = STREAM_TYPE_VIDEO_VC1; break; case AV_CODEC_ID_MP2: case AV_CODEC_ID_MP3: VAR_3 = STREAM_TYPE_AUDIO_MPEG1; break; case AV_CODEC_ID_AAC: VAR_3 = (ts->flags & MPEGTS_FLAG_AAC_LATM) ? STREAM_TYPE_AUDIO_AAC_LATM : STREAM_TYPE_AUDIO_AAC; break; case AV_CODEC_ID_AAC_LATM: VAR_3 = STREAM_TYPE_AUDIO_AAC_LATM; break; case AV_CODEC_ID_AC3: VAR_3 = STREAM_TYPE_AUDIO_AC3; break; case AV_CODEC_ID_DTS: VAR_3 = STREAM_TYPE_AUDIO_DTS; break; case AV_CODEC_ID_TRUEHD: VAR_3 = STREAM_TYPE_AUDIO_TRUEHD; break; case AV_CODEC_ID_OPUS: VAR_3 = STREAM_TYPE_PRIVATE_DATA; break; default: VAR_3 = STREAM_TYPE_PRIVATE_DATA; break; } *q++ = VAR_3; put16(&q, 0xe000 | ts_st->pid); desc_length_ptr = q; q += 2; switch (st->codec->codec_type) { case AVMEDIA_TYPE_AUDIO: if (st->codec->codec_id==AV_CODEC_ID_EAC3) { *q++=0x7a; *q++=1; *q++=0; } if (st->codec->codec_id==AV_CODEC_ID_S302M) { *q++ = 0x05; *q++ = 4; *q++ = 'B'; *q++ = 'S'; *q++ = 'S'; *q++ = 'D'; } if (st->codec->codec_id==AV_CODEC_ID_OPUS) { if (q - data > SECTION_LENGTH - 6 - 4) { VAR_5 = 1; break; } *q++ = 0x05; *q++ = 4; *q++ = 'O'; *q++ = 'p'; *q++ = 'u'; *q++ = 'VAR_0'; *q++ = 0x7f; *q++ = 2; *q++ = 0x80; if (st->codec->extradata && st->codec->extradata_size >= 19) { if (st->codec->extradata[18] == 0 && st->codec->channels <= 2) { *q++ = st->codec->channels; } else if (st->codec->extradata[18] == 1 && st->codec->channels <= 8 && st->codec->extradata_size >= 21 + st->codec->channels) { static const uint8_t coupled_stream_counts[9] = { 1, 0, 1, 1, 2, 2, 2, 3, 3 }; static const uint8_t channel_map_a[8][8] = { {0}, {0, 1}, {0, 2, 1}, {0, 1, 2, 3}, {0, 4, 1, 2, 3}, {0, 4, 1, 2, 3, 5}, {0, 4, 1, 2, 3, 5, 6}, {0, 6, 1, 2, 3, 4, 5, 7}, }; static const uint8_t channel_map_b[8][8] = { {0}, {0, 1}, {0, 1, 2}, {0, 1, 2, 3}, {0, 1, 2, 3, 4}, {0, 1, 2, 3, 4, 5}, {0, 1, 2, 3, 4, 5, 6}, {0, 1, 2, 3, 4, 5, 6, 7}, }; if (st->codec->extradata[19] == st->codec->channels - coupled_stream_counts[st->codec->channels] && st->codec->extradata[20] == coupled_stream_counts[st->codec->channels] && memcmp(&st->codec->extradata[21], channel_map_a[st->codec->channels], st->codec->channels) == 0) { *q++ = st->codec->channels; } else if (st->codec->channels >= 2 && st->codec->extradata[19] == st->codec->channels && st->codec->extradata[20] == 0 && memcmp(&st->codec->extradata[21], channel_map_b[st->codec->channels], st->codec->channels) == 0) { *q++ = st->codec->channels | 0x80; } else { av_log(VAR_0, AV_LOG_ERROR, "Unsupported Opus Vorbis-style channel mapping"); *q++ = 0xff; } } else { av_log(VAR_0, AV_LOG_ERROR, "Unsupported Opus channel mapping for family %d", st->codec->extradata[18]); *q++ = 0xff; } } else if (st->codec->channels <= 2) { *q++ = st->codec->channels; } else { av_log(VAR_0, AV_LOG_ERROR, "Unsupported Opus channel mapping"); *q++ = 0xff; } } if (lang) { char *p; char *next = lang->value; uint8_t *len_ptr; *q++ = 0x0a; len_ptr = q++; *len_ptr = 0; for (p = lang->value; next && *len_ptr < 255 / 4 * 4; p = next + 1) { if (q - data > SECTION_LENGTH - 4) { VAR_5 = 1; break; } next = strchr(p, ','); if (strlen(p) != 3 && (!next || next != p + 3)) continue; *q++ = *p++; *q++ = *p++; *q++ = *p++; if (st->disposition & AV_DISPOSITION_CLEAN_EFFECTS) *q++ = 0x01; else if (st->disposition & AV_DISPOSITION_HEARING_IMPAIRED) *q++ = 0x02; else if (st->disposition & AV_DISPOSITION_VISUAL_IMPAIRED) *q++ = 0x03; else *q++ = 0; *len_ptr += 4; } if (*len_ptr == 0) q -= 2; } break; case AVMEDIA_TYPE_SUBTITLE: { const char default_language[] = "und"; const char *language = lang && strlen(lang->value) >= 3 ? lang->value : default_language; if (st->codec->codec_id == AV_CODEC_ID_DVB_SUBTITLE) { uint8_t *len_ptr; int extradata_copied = 0; *q++ = 0x59; len_ptr = q++; while (strlen(language) >= 3) { if (sizeof(data) - (q - data) < 8) { VAR_5 = 1; break; } *q++ = *language++; *q++ = *language++; *q++ = *language++; if (*language != '\0') language++; if (st->codec->extradata_size - extradata_copied >= 5) { *q++ = st->codec->extradata[extradata_copied + 4]; memcpy(q, st->codec->extradata + extradata_copied, 4); extradata_copied += 5; q += 4; } else { *q++ = (st->disposition & AV_DISPOSITION_HEARING_IMPAIRED) ? 0x20 : 0x10; if ((st->codec->extradata_size == 4) && (extradata_copied == 0)) { memcpy(q, st->codec->extradata, 4); extradata_copied += 4; q += 4; } else { put16(&q, 1); put16(&q, 1); } } } *len_ptr = q - len_ptr - 1; } else if (st->codec->codec_id == AV_CODEC_ID_DVB_TELETEXT) { uint8_t *len_ptr = NULL; int extradata_copied = 0; *q++ = 0x56; len_ptr = q++; while (strlen(language) >= 3 && q - data < sizeof(data) - 6) { *q++ = *language++; *q++ = *language++; *q++ = *language++; if (*language != '\0') language++; if (st->codec->extradata_size - 1 > extradata_copied) { memcpy(q, st->codec->extradata + extradata_copied, 2); extradata_copied += 2; q += 2; } else { *q++ = 0x08; *q++ = 0x00; } } *len_ptr = q - len_ptr - 1; } } break; case AVMEDIA_TYPE_VIDEO: if (VAR_3 == STREAM_TYPE_VIDEO_DIRAC) { *q++ = 0x05; *q++ = 4; *q++ = 'd'; *q++ = 'r'; *q++ = 'a'; *q++ = 'c'; } else if (VAR_3 == STREAM_TYPE_VIDEO_VC1) { *q++ = 0x05; *q++ = 4; *q++ = 'V'; *q++ = 'C'; *q++ = '-'; *q++ = '1'; } break; case AVMEDIA_TYPE_DATA: if (st->codec->codec_id == AV_CODEC_ID_SMPTE_KLV) { *q++ = 0x05; *q++ = 4; *q++ = 'K'; *q++ = 'L'; *q++ = 'V'; *q++ = 'A'; } break; } VAR_2 = 0xf000 | (q - desc_length_ptr - 2); desc_length_ptr[0] = VAR_2 >> 8; desc_length_ptr[1] = VAR_2; } if (VAR_5) av_log(VAR_0, AV_LOG_ERROR, "The PMT section cannot fit stream %d and all following streams.\n" "Try reducing the number of languages in the audio streams " "or the total number of streams.\n", VAR_4); mpegts_write_section1(&VAR_1->pmt, PMT_TID, VAR_1->sid, ts->tables_version, 0, 0, data, q - data); return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0, MpegTSService *VAR_1)\n{", "MpegTSWrite *ts = VAR_0->priv_data;", "uint8_t data[SECTION_LENGTH], *q, *desc_length_ptr, *program_info_length_ptr;", "int VAR_2, VAR_3, VAR_4, VAR_5 = 0;", "q = data;", "put16(&q, 0xe000 | VAR_1->pcr_pid);", "program_info_length_ptr = q;", "q += 2;", "VAR_2 = 0xf000 | (q - program_info_length_ptr - 2);", "program_info_length_ptr[0] = VAR_2 >> 8;", "program_info_length_ptr[1] = VAR_2;", "for (VAR_4 = 0; VAR_4 < VAR_0->nb_streams; VAR_4++) {", "AVStream *st = VAR_0->streams[VAR_4];", "MpegTSWriteStream *ts_st = st->priv_data;", "AVDictionaryEntry *lang = av_dict_get(st->metadata, \"language\", NULL, 0);", "if (q - data > SECTION_LENGTH - 32) {", "VAR_5 = 1;", "break;", "}", "switch (st->codec->codec_id) {", "case AV_CODEC_ID_MPEG1VIDEO:\ncase AV_CODEC_ID_MPEG2VIDEO:\nVAR_3 = STREAM_TYPE_VIDEO_MPEG2;", "break;", "case AV_CODEC_ID_MPEG4:\nVAR_3 = STREAM_TYPE_VIDEO_MPEG4;", "break;", "case AV_CODEC_ID_H264:\nVAR_3 = STREAM_TYPE_VIDEO_H264;", "break;", "case AV_CODEC_ID_HEVC:\nVAR_3 = STREAM_TYPE_VIDEO_HEVC;", "break;", "case AV_CODEC_ID_CAVS:\nVAR_3 = STREAM_TYPE_VIDEO_CAVS;", "break;", "case AV_CODEC_ID_DIRAC:\nVAR_3 = STREAM_TYPE_VIDEO_DIRAC;", "break;", "case AV_CODEC_ID_VC1:\nVAR_3 = STREAM_TYPE_VIDEO_VC1;", "break;", "case AV_CODEC_ID_MP2:\ncase AV_CODEC_ID_MP3:\nVAR_3 = STREAM_TYPE_AUDIO_MPEG1;", "break;", "case AV_CODEC_ID_AAC:\nVAR_3 = (ts->flags & MPEGTS_FLAG_AAC_LATM)\n? STREAM_TYPE_AUDIO_AAC_LATM\n: STREAM_TYPE_AUDIO_AAC;", "break;", "case AV_CODEC_ID_AAC_LATM:\nVAR_3 = STREAM_TYPE_AUDIO_AAC_LATM;", "break;", "case AV_CODEC_ID_AC3:\nVAR_3 = STREAM_TYPE_AUDIO_AC3;", "break;", "case AV_CODEC_ID_DTS:\nVAR_3 = STREAM_TYPE_AUDIO_DTS;", "break;", "case AV_CODEC_ID_TRUEHD:\nVAR_3 = STREAM_TYPE_AUDIO_TRUEHD;", "break;", "case AV_CODEC_ID_OPUS:\nVAR_3 = STREAM_TYPE_PRIVATE_DATA;", "break;", "default:\nVAR_3 = STREAM_TYPE_PRIVATE_DATA;", "break;", "}", "*q++ = VAR_3;", "put16(&q, 0xe000 | ts_st->pid);", "desc_length_ptr = q;", "q += 2;", "switch (st->codec->codec_type) {", "case AVMEDIA_TYPE_AUDIO:\nif (st->codec->codec_id==AV_CODEC_ID_EAC3) {", "*q++=0x7a;", "*q++=1;", "*q++=0;", "}", "if (st->codec->codec_id==AV_CODEC_ID_S302M) {", "*q++ = 0x05;", "*q++ = 4;", "*q++ = 'B';", "*q++ = 'S';", "*q++ = 'S';", "*q++ = 'D';", "}", "if (st->codec->codec_id==AV_CODEC_ID_OPUS) {", "if (q - data > SECTION_LENGTH - 6 - 4) {", "VAR_5 = 1;", "break;", "}", "*q++ = 0x05;", "*q++ = 4;", "*q++ = 'O';", "*q++ = 'p';", "*q++ = 'u';", "*q++ = 'VAR_0';", "*q++ = 0x7f;", "*q++ = 2;", "*q++ = 0x80;", "if (st->codec->extradata && st->codec->extradata_size >= 19) {", "if (st->codec->extradata[18] == 0 && st->codec->channels <= 2) {", "*q++ = st->codec->channels;", "} else if (st->codec->extradata[18] == 1 && st->codec->channels <= 8 &&", "st->codec->extradata_size >= 21 + st->codec->channels) {", "static const uint8_t coupled_stream_counts[9] = {", "1, 0, 1, 1, 2, 2, 2, 3, 3\n};", "static const uint8_t channel_map_a[8][8] = {", "{0},", "{0, 1},", "{0, 2, 1},", "{0, 1, 2, 3},", "{0, 4, 1, 2, 3},", "{0, 4, 1, 2, 3, 5},", "{0, 4, 1, 2, 3, 5, 6},", "{0, 6, 1, 2, 3, 4, 5, 7},", "};", "static const uint8_t channel_map_b[8][8] = {", "{0},", "{0, 1},", "{0, 1, 2},", "{0, 1, 2, 3},", "{0, 1, 2, 3, 4},", "{0, 1, 2, 3, 4, 5},", "{0, 1, 2, 3, 4, 5, 6},", "{0, 1, 2, 3, 4, 5, 6, 7},", "};", "if (st->codec->extradata[19] == st->codec->channels - coupled_stream_counts[st->codec->channels] &&\nst->codec->extradata[20] == coupled_stream_counts[st->codec->channels] &&\nmemcmp(&st->codec->extradata[21], channel_map_a[st->codec->channels], st->codec->channels) == 0) {", "*q++ = st->codec->channels;", "} else if (st->codec->channels >= 2 && st->codec->extradata[19] == st->codec->channels &&", "st->codec->extradata[20] == 0 &&\nmemcmp(&st->codec->extradata[21], channel_map_b[st->codec->channels], st->codec->channels) == 0) {", "*q++ = st->codec->channels | 0x80;", "} else {", "av_log(VAR_0, AV_LOG_ERROR, \"Unsupported Opus Vorbis-style channel mapping\");", "*q++ = 0xff;", "}", "} else {", "av_log(VAR_0, AV_LOG_ERROR, \"Unsupported Opus channel mapping for family %d\", st->codec->extradata[18]);", "*q++ = 0xff;", "}", "} else if (st->codec->channels <= 2) {", "*q++ = st->codec->channels;", "} else {", "av_log(VAR_0, AV_LOG_ERROR, \"Unsupported Opus channel mapping\");", "*q++ = 0xff;", "}", "}", "if (lang) {", "char *p;", "char *next = lang->value;", "uint8_t *len_ptr;", "*q++ = 0x0a;", "len_ptr = q++;", "*len_ptr = 0;", "for (p = lang->value; next && *len_ptr < 255 / 4 * 4; p = next + 1) {", "if (q - data > SECTION_LENGTH - 4) {", "VAR_5 = 1;", "break;", "}", "next = strchr(p, ',');", "if (strlen(p) != 3 && (!next || next != p + 3))\ncontinue;", "*q++ = *p++;", "*q++ = *p++;", "*q++ = *p++;", "if (st->disposition & AV_DISPOSITION_CLEAN_EFFECTS)\n*q++ = 0x01;", "else if (st->disposition & AV_DISPOSITION_HEARING_IMPAIRED)\n*q++ = 0x02;", "else if (st->disposition & AV_DISPOSITION_VISUAL_IMPAIRED)\n*q++ = 0x03;", "else\n*q++ = 0;", "*len_ptr += 4;", "}", "if (*len_ptr == 0)\nq -= 2;", "}", "break;", "case AVMEDIA_TYPE_SUBTITLE:\n{", "const char default_language[] = \"und\";", "const char *language = lang && strlen(lang->value) >= 3 ? lang->value : default_language;", "if (st->codec->codec_id == AV_CODEC_ID_DVB_SUBTITLE) {", "uint8_t *len_ptr;", "int extradata_copied = 0;", "*q++ = 0x59;", "len_ptr = q++;", "while (strlen(language) >= 3) {", "if (sizeof(data) - (q - data) < 8) {", "VAR_5 = 1;", "break;", "}", "*q++ = *language++;", "*q++ = *language++;", "*q++ = *language++;", "if (*language != '\\0')\nlanguage++;", "if (st->codec->extradata_size - extradata_copied >= 5) {", "*q++ = st->codec->extradata[extradata_copied + 4];", "memcpy(q, st->codec->extradata + extradata_copied, 4);", "extradata_copied += 5;", "q += 4;", "} else {", "*q++ = (st->disposition & AV_DISPOSITION_HEARING_IMPAIRED) ? 0x20 : 0x10;", "if ((st->codec->extradata_size == 4) && (extradata_copied == 0)) {", "memcpy(q, st->codec->extradata, 4);", "extradata_copied += 4;", "q += 4;", "} else {", "put16(&q, 1);", "put16(&q, 1);", "}", "}", "}", "*len_ptr = q - len_ptr - 1;", "} else if (st->codec->codec_id == AV_CODEC_ID_DVB_TELETEXT) {", "uint8_t *len_ptr = NULL;", "int extradata_copied = 0;", "*q++ = 0x56;", "len_ptr = q++;", "while (strlen(language) >= 3 && q - data < sizeof(data) - 6) {", "*q++ = *language++;", "*q++ = *language++;", "*q++ = *language++;", "if (*language != '\\0')\nlanguage++;", "if (st->codec->extradata_size - 1 > extradata_copied) {", "memcpy(q, st->codec->extradata + extradata_copied, 2);", "extradata_copied += 2;", "q += 2;", "} else {", "*q++ = 0x08;", "*q++ = 0x00;", "}", "}", "*len_ptr = q - len_ptr - 1;", "}", "}", "break;", "case AVMEDIA_TYPE_VIDEO:\nif (VAR_3 == STREAM_TYPE_VIDEO_DIRAC) {", "*q++ = 0x05;", "*q++ = 4;", "*q++ = 'd';", "*q++ = 'r';", "*q++ = 'a';", "*q++ = 'c';", "} else if (VAR_3 == STREAM_TYPE_VIDEO_VC1) {", "*q++ = 0x05;", "*q++ = 4;", "*q++ = 'V';", "*q++ = 'C';", "*q++ = '-';", "*q++ = '1';", "}", "break;", "case AVMEDIA_TYPE_DATA:\nif (st->codec->codec_id == AV_CODEC_ID_SMPTE_KLV) {", "*q++ = 0x05;", "*q++ = 4;", "*q++ = 'K';", "*q++ = 'L';", "*q++ = 'V';", "*q++ = 'A';", "}", "break;", "}", "VAR_2 = 0xf000 | (q - desc_length_ptr - 2);", "desc_length_ptr[0] = VAR_2 >> 8;", "desc_length_ptr[1] = VAR_2;", "}", "if (VAR_5)\nav_log(VAR_0, AV_LOG_ERROR,\n\"The PMT section cannot fit stream %d and all following streams.\\n\"\n\"Try reducing the number of languages in the audio streams \"\n\"or the total number of streams.\\n\", VAR_4);", "mpegts_write_section1(&VAR_1->pmt, PMT_TID, VAR_1->sid, ts->tables_version, 0, 0,\ndata, q - data);", "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, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57, 59, 61 ], [ 63 ], [ 65, 67 ], [ 69 ], [ 71, 73 ], [ 75 ], [ 77, 79 ], [ 81 ], [ 83, 85 ], [ 87 ], [ 89, 91 ], [ 93 ], [ 95, 97 ], [ 99 ], [ 101, 103, 105 ], [ 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 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 171 ], [ 173, 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 229 ], [ 231 ], [ 233 ], [ 237 ], [ 239 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251, 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ], [ 291 ], [ 293 ], [ 299, 301, 303 ], [ 305 ], [ 307 ], [ 309, 311 ], [ 313 ], [ 315 ], [ 319 ], [ 321 ], [ 323 ], [ 325 ], [ 329 ], [ 331 ], [ 333 ], [ 335 ], [ 339 ], [ 341 ], [ 345 ], [ 347 ], [ 349 ], [ 351 ], [ 355 ], [ 357 ], [ 359 ], [ 361 ], [ 365 ], [ 367 ], [ 369 ], [ 373 ], [ 375 ], [ 377 ], [ 379 ], [ 381 ], [ 383 ], [ 385, 387 ], [ 391 ], [ 393 ], [ 395 ], [ 399, 401 ], [ 403, 405 ], [ 407, 409 ], [ 411, 413 ], [ 417 ], [ 419 ], [ 423, 425 ], [ 427 ], [ 429 ], [ 431, 433 ], [ 435 ], [ 437 ], [ 441 ], [ 443 ], [ 445 ], [ 449 ], [ 451 ], [ 455 ], [ 457 ], [ 459 ], [ 461 ], [ 463 ], [ 465 ], [ 467 ], [ 469 ], [ 473, 475 ], [ 479 ], [ 481 ], [ 483 ], [ 485 ], [ 487 ], [ 489 ], [ 497 ], [ 499 ], [ 503 ], [ 505 ], [ 507 ], [ 509 ], [ 511 ], [ 513 ], [ 515 ], [ 517 ], [ 519 ], [ 523 ], [ 525 ], [ 527 ], [ 529 ], [ 535 ], [ 537 ], [ 541 ], [ 543 ], [ 545 ], [ 547 ], [ 551, 553 ], [ 557 ], [ 559 ], [ 561 ], [ 563 ], [ 565 ], [ 575 ], [ 577 ], [ 579 ], [ 581 ], [ 585 ], [ 587 ], [ 589 ], [ 591 ], [ 593, 595 ], [ 597 ], [ 599 ], [ 601 ], [ 603 ], [ 605 ], [ 607 ], [ 609 ], [ 611 ], [ 613 ], [ 615 ], [ 617 ], [ 619 ], [ 621 ], [ 623 ], [ 625 ], [ 627, 629 ], [ 631 ], [ 633 ], [ 635 ], [ 637 ], [ 639 ], [ 641 ], [ 643 ], [ 645 ], [ 647 ], [ 651 ], [ 653 ], [ 655 ], [ 657 ], [ 661, 663, 665, 667, 669 ], [ 673, 675 ], [ 677 ], [ 679 ] ]
17,926
static void ahci_reset_port(AHCIState *s, int port) { AHCIDevice *d = &s->dev[port]; AHCIPortRegs *pr = &d->port_regs; IDEState *ide_state = &d->port.ifs[0]; int i; DPRINTF(port, "reset port\n"); ide_bus_reset(&d->port); ide_state->ncq_queues = AHCI_MAX_CMDS; pr->scr_stat = 0; pr->scr_err = 0; pr->scr_act = 0; d->busy_slot = -1; d->init_d2h_sent = 0; ide_state = &s->dev[port].port.ifs[0]; if (!ide_state->bs) { return; /* reset ncq queue */ for (i = 0; i < AHCI_MAX_CMDS; i++) { NCQTransferState *ncq_tfs = &s->dev[port].ncq_tfs[i]; if (ncq_tfs->aiocb) { bdrv_aio_cancel(ncq_tfs->aiocb); ncq_tfs->aiocb = NULL; qemu_sglist_destroy(&ncq_tfs->sglist); ncq_tfs->used = 0; s->dev[port].port_state = STATE_RUN; if (!ide_state->bs) { s->dev[port].port_regs.sig = 0; ide_state->status = SEEK_STAT | WRERR_STAT; } else if (ide_state->drive_kind == IDE_CD) { s->dev[port].port_regs.sig = SATA_SIGNATURE_CDROM; ide_state->lcyl = 0x14; ide_state->hcyl = 0xeb; DPRINTF(port, "set lcyl = %d\n", ide_state->lcyl); ide_state->status = SEEK_STAT | WRERR_STAT | READY_STAT; } else { s->dev[port].port_regs.sig = SATA_SIGNATURE_DISK; ide_state->status = SEEK_STAT | WRERR_STAT; ide_state->error = 1; ahci_init_d2h(d);
true
qemu
c9b308d20b642c106048f088ccc31f2aa7cf59ba
static void ahci_reset_port(AHCIState *s, int port) { AHCIDevice *d = &s->dev[port]; AHCIPortRegs *pr = &d->port_regs; IDEState *ide_state = &d->port.ifs[0]; int i; DPRINTF(port, "reset port\n"); ide_bus_reset(&d->port); ide_state->ncq_queues = AHCI_MAX_CMDS; pr->scr_stat = 0; pr->scr_err = 0; pr->scr_act = 0; d->busy_slot = -1; d->init_d2h_sent = 0; ide_state = &s->dev[port].port.ifs[0]; if (!ide_state->bs) { return; for (i = 0; i < AHCI_MAX_CMDS; i++) { NCQTransferState *ncq_tfs = &s->dev[port].ncq_tfs[i]; if (ncq_tfs->aiocb) { bdrv_aio_cancel(ncq_tfs->aiocb); ncq_tfs->aiocb = NULL; qemu_sglist_destroy(&ncq_tfs->sglist); ncq_tfs->used = 0; s->dev[port].port_state = STATE_RUN; if (!ide_state->bs) { s->dev[port].port_regs.sig = 0; ide_state->status = SEEK_STAT | WRERR_STAT; } else if (ide_state->drive_kind == IDE_CD) { s->dev[port].port_regs.sig = SATA_SIGNATURE_CDROM; ide_state->lcyl = 0x14; ide_state->hcyl = 0xeb; DPRINTF(port, "set lcyl = %d\n", ide_state->lcyl); ide_state->status = SEEK_STAT | WRERR_STAT | READY_STAT; } else { s->dev[port].port_regs.sig = SATA_SIGNATURE_DISK; ide_state->status = SEEK_STAT | WRERR_STAT; ide_state->error = 1; ahci_init_d2h(d);
{ "code": [], "line_no": [] }
static void FUNC_0(AHCIState *VAR_0, int VAR_1) { AHCIDevice *d = &VAR_0->dev[VAR_1]; AHCIPortRegs *pr = &d->port_regs; IDEState *ide_state = &d->VAR_1.ifs[0]; int VAR_2; DPRINTF(VAR_1, "reset VAR_1\n"); ide_bus_reset(&d->VAR_1); ide_state->ncq_queues = AHCI_MAX_CMDS; pr->scr_stat = 0; pr->scr_err = 0; pr->scr_act = 0; d->busy_slot = -1; d->init_d2h_sent = 0; ide_state = &VAR_0->dev[VAR_1].VAR_1.ifs[0]; if (!ide_state->bs) { return; for (VAR_2 = 0; VAR_2 < AHCI_MAX_CMDS; VAR_2++) { NCQTransferState *ncq_tfs = &VAR_0->dev[VAR_1].ncq_tfs[VAR_2]; if (ncq_tfs->aiocb) { bdrv_aio_cancel(ncq_tfs->aiocb); ncq_tfs->aiocb = NULL; qemu_sglist_destroy(&ncq_tfs->sglist); ncq_tfs->used = 0; VAR_0->dev[VAR_1].port_state = STATE_RUN; if (!ide_state->bs) { VAR_0->dev[VAR_1].port_regs.sig = 0; ide_state->status = SEEK_STAT | WRERR_STAT; } else if (ide_state->drive_kind == IDE_CD) { VAR_0->dev[VAR_1].port_regs.sig = SATA_SIGNATURE_CDROM; ide_state->lcyl = 0x14; ide_state->hcyl = 0xeb; DPRINTF(VAR_1, "set lcyl = %d\n", ide_state->lcyl); ide_state->status = SEEK_STAT | WRERR_STAT | READY_STAT; } else { VAR_0->dev[VAR_1].port_regs.sig = SATA_SIGNATURE_DISK; ide_state->status = SEEK_STAT | WRERR_STAT; ide_state->error = 1; ahci_init_d2h(d);
[ "static void FUNC_0(AHCIState *VAR_0, int VAR_1)\n{", "AHCIDevice *d = &VAR_0->dev[VAR_1];", "AHCIPortRegs *pr = &d->port_regs;", "IDEState *ide_state = &d->VAR_1.ifs[0];", "int VAR_2;", "DPRINTF(VAR_1, \"reset VAR_1\\n\");", "ide_bus_reset(&d->VAR_1);", "ide_state->ncq_queues = AHCI_MAX_CMDS;", "pr->scr_stat = 0;", "pr->scr_err = 0;", "pr->scr_act = 0;", "d->busy_slot = -1;", "d->init_d2h_sent = 0;", "ide_state = &VAR_0->dev[VAR_1].VAR_1.ifs[0];", "if (!ide_state->bs) {", "return;", "for (VAR_2 = 0; VAR_2 < AHCI_MAX_CMDS; VAR_2++) {", "NCQTransferState *ncq_tfs = &VAR_0->dev[VAR_1].ncq_tfs[VAR_2];", "if (ncq_tfs->aiocb) {", "bdrv_aio_cancel(ncq_tfs->aiocb);", "ncq_tfs->aiocb = NULL;", "qemu_sglist_destroy(&ncq_tfs->sglist);", "ncq_tfs->used = 0;", "VAR_0->dev[VAR_1].port_state = STATE_RUN;", "if (!ide_state->bs) {", "VAR_0->dev[VAR_1].port_regs.sig = 0;", "ide_state->status = SEEK_STAT | WRERR_STAT;", "} else if (ide_state->drive_kind == IDE_CD) {", "VAR_0->dev[VAR_1].port_regs.sig = SATA_SIGNATURE_CDROM;", "ide_state->lcyl = 0x14;", "ide_state->hcyl = 0xeb;", "DPRINTF(VAR_1, \"set lcyl = %d\\n\", ide_state->lcyl);", "ide_state->status = SEEK_STAT | WRERR_STAT | READY_STAT;", "} else {", "VAR_0->dev[VAR_1].port_regs.sig = SATA_SIGNATURE_DISK;", "ide_state->status = SEEK_STAT | WRERR_STAT;", "ide_state->error = 1;", "ahci_init_d2h(d);" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2 ], [ 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ], [ 8 ], [ 9 ], [ 10 ], [ 11 ], [ 12 ], [ 13 ], [ 14 ], [ 15 ], [ 16 ], [ 17 ], [ 19 ], [ 20 ], [ 21 ], [ 22 ], [ 23 ], [ 24 ], [ 25 ], [ 26 ], [ 27 ], [ 28 ], [ 29 ], [ 30 ], [ 31 ], [ 32 ], [ 33 ], [ 34 ], [ 35 ], [ 36 ], [ 37 ], [ 38 ], [ 39 ], [ 40 ] ]
17,927
int mjpeg_init(MpegEncContext *s) { MJpegContext *m; m = malloc(sizeof(MJpegContext)); if (!m) return -1; /* build all the huffman tables */ build_huffman_codes(m->huff_size_dc_luminance, m->huff_code_dc_luminance, bits_dc_luminance, val_dc_luminance); build_huffman_codes(m->huff_size_dc_chrominance, m->huff_code_dc_chrominance, bits_dc_chrominance, val_dc_chrominance); build_huffman_codes(m->huff_size_ac_luminance, m->huff_code_ac_luminance, bits_ac_luminance, val_ac_luminance); build_huffman_codes(m->huff_size_ac_chrominance, m->huff_code_ac_chrominance, bits_ac_chrominance, val_ac_chrominance); s->mjpeg_ctx = m; return 0; }
true
FFmpeg
d7e9533aa06f4073a27812349b35ba5fede11ca1
int mjpeg_init(MpegEncContext *s) { MJpegContext *m; m = malloc(sizeof(MJpegContext)); if (!m) return -1; build_huffman_codes(m->huff_size_dc_luminance, m->huff_code_dc_luminance, bits_dc_luminance, val_dc_luminance); build_huffman_codes(m->huff_size_dc_chrominance, m->huff_code_dc_chrominance, bits_dc_chrominance, val_dc_chrominance); build_huffman_codes(m->huff_size_ac_luminance, m->huff_code_ac_luminance, bits_ac_luminance, val_ac_luminance); build_huffman_codes(m->huff_size_ac_chrominance, m->huff_code_ac_chrominance, bits_ac_chrominance, val_ac_chrominance); s->mjpeg_ctx = m; return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(MpegEncContext *VAR_0) { MJpegContext *m; m = malloc(sizeof(MJpegContext)); if (!m) return -1; build_huffman_codes(m->huff_size_dc_luminance, m->huff_code_dc_luminance, bits_dc_luminance, val_dc_luminance); build_huffman_codes(m->huff_size_dc_chrominance, m->huff_code_dc_chrominance, bits_dc_chrominance, val_dc_chrominance); build_huffman_codes(m->huff_size_ac_luminance, m->huff_code_ac_luminance, bits_ac_luminance, val_ac_luminance); build_huffman_codes(m->huff_size_ac_chrominance, m->huff_code_ac_chrominance, bits_ac_chrominance, val_ac_chrominance); VAR_0->mjpeg_ctx = m; return 0; }
[ "int FUNC_0(MpegEncContext *VAR_0)\n{", "MJpegContext *m;", "m = malloc(sizeof(MJpegContext));", "if (!m)\nreturn -1;", "build_huffman_codes(m->huff_size_dc_luminance,\nm->huff_code_dc_luminance,\nbits_dc_luminance,\nval_dc_luminance);", "build_huffman_codes(m->huff_size_dc_chrominance,\nm->huff_code_dc_chrominance,\nbits_dc_chrominance,\nval_dc_chrominance);", "build_huffman_codes(m->huff_size_ac_luminance,\nm->huff_code_ac_luminance,\nbits_ac_luminance,\nval_ac_luminance);", "build_huffman_codes(m->huff_size_ac_chrominance,\nm->huff_code_ac_chrominance,\nbits_ac_chrominance,\nval_ac_chrominance);", "VAR_0->mjpeg_ctx = m;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2 ], [ 3 ], [ 4 ], [ 5, 6 ], [ 8, 9, 10, 11 ], [ 12, 13, 14, 15 ], [ 16, 17, 18, 19 ], [ 20, 21, 22, 23 ], [ 24 ], [ 25 ], [ 26 ] ]
17,928
static void *bochs_bios_init(void) { void *fw_cfg; uint8_t *smbios_table; size_t smbios_len; uint64_t *numa_fw_cfg; int i, j; fw_cfg = fw_cfg_init(BIOS_CFG_IOPORT, BIOS_CFG_IOPORT + 1, 0, 0); fw_cfg_add_i32(fw_cfg, FW_CFG_ID, 1); fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size); fw_cfg_add_bytes(fw_cfg, FW_CFG_ACPI_TABLES, (uint8_t *)acpi_tables, acpi_tables_len); fw_cfg_add_i32(fw_cfg, FW_CFG_IRQ0_OVERRIDE, kvm_allows_irq0_override()); smbios_table = smbios_get_table(&smbios_len); if (smbios_table) fw_cfg_add_bytes(fw_cfg, FW_CFG_SMBIOS_ENTRIES, smbios_table, smbios_len); fw_cfg_add_bytes(fw_cfg, FW_CFG_E820_TABLE, (uint8_t *)&e820_table, sizeof(e820_table)); fw_cfg_add_bytes(fw_cfg, FW_CFG_HPET, (uint8_t *)&hpet_cfg, sizeof(struct hpet_fw_config)); /* allocate memory for the NUMA channel: one (64bit) word for the number * of nodes, one word for each VCPU->node and one word for each node to * hold the amount of memory. */ numa_fw_cfg = g_new0(uint64_t, 1 + max_cpus + nb_numa_nodes); numa_fw_cfg[0] = cpu_to_le64(nb_numa_nodes); for (i = 0; i < max_cpus; i++) { for (j = 0; j < nb_numa_nodes; j++) { if (test_bit(i, node_cpumask[j])) { numa_fw_cfg[i + 1] = cpu_to_le64(j); break; } } } for (i = 0; i < nb_numa_nodes; i++) { numa_fw_cfg[max_cpus + 1 + i] = cpu_to_le64(node_mem[i]); } fw_cfg_add_bytes(fw_cfg, FW_CFG_NUMA, (uint8_t *)numa_fw_cfg, (1 + max_cpus + nb_numa_nodes) * sizeof(*numa_fw_cfg)); return fw_cfg; }
true
qemu
089da572b956ef0f8f5b8d5917358e07892a77c2
static void *bochs_bios_init(void) { void *fw_cfg; uint8_t *smbios_table; size_t smbios_len; uint64_t *numa_fw_cfg; int i, j; fw_cfg = fw_cfg_init(BIOS_CFG_IOPORT, BIOS_CFG_IOPORT + 1, 0, 0); fw_cfg_add_i32(fw_cfg, FW_CFG_ID, 1); fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size); fw_cfg_add_bytes(fw_cfg, FW_CFG_ACPI_TABLES, (uint8_t *)acpi_tables, acpi_tables_len); fw_cfg_add_i32(fw_cfg, FW_CFG_IRQ0_OVERRIDE, kvm_allows_irq0_override()); smbios_table = smbios_get_table(&smbios_len); if (smbios_table) fw_cfg_add_bytes(fw_cfg, FW_CFG_SMBIOS_ENTRIES, smbios_table, smbios_len); fw_cfg_add_bytes(fw_cfg, FW_CFG_E820_TABLE, (uint8_t *)&e820_table, sizeof(e820_table)); fw_cfg_add_bytes(fw_cfg, FW_CFG_HPET, (uint8_t *)&hpet_cfg, sizeof(struct hpet_fw_config)); numa_fw_cfg = g_new0(uint64_t, 1 + max_cpus + nb_numa_nodes); numa_fw_cfg[0] = cpu_to_le64(nb_numa_nodes); for (i = 0; i < max_cpus; i++) { for (j = 0; j < nb_numa_nodes; j++) { if (test_bit(i, node_cpumask[j])) { numa_fw_cfg[i + 1] = cpu_to_le64(j); break; } } } for (i = 0; i < nb_numa_nodes; i++) { numa_fw_cfg[max_cpus + 1 + i] = cpu_to_le64(node_mem[i]); } fw_cfg_add_bytes(fw_cfg, FW_CFG_NUMA, (uint8_t *)numa_fw_cfg, (1 + max_cpus + nb_numa_nodes) * sizeof(*numa_fw_cfg)); return fw_cfg; }
{ "code": [ " fw_cfg_add_bytes(fw_cfg, FW_CFG_ACPI_TABLES, (uint8_t *)acpi_tables,", " acpi_tables_len);", " fw_cfg_add_bytes(fw_cfg, FW_CFG_E820_TABLE, (uint8_t *)&e820_table,", " sizeof(e820_table));", " fw_cfg_add_bytes(fw_cfg, FW_CFG_HPET, (uint8_t *)&hpet_cfg,", " sizeof(struct hpet_fw_config));", " fw_cfg_add_bytes(fw_cfg, FW_CFG_NUMA, (uint8_t *)numa_fw_cfg," ], "line_no": [ 25, 27, 41, 43, 47, 49, 85 ] }
static void *FUNC_0(void) { void *VAR_0; uint8_t *smbios_table; size_t smbios_len; uint64_t *numa_fw_cfg; int VAR_1, VAR_2; VAR_0 = fw_cfg_init(BIOS_CFG_IOPORT, BIOS_CFG_IOPORT + 1, 0, 0); fw_cfg_add_i32(VAR_0, FW_CFG_ID, 1); fw_cfg_add_i64(VAR_0, FW_CFG_RAM_SIZE, (uint64_t)ram_size); fw_cfg_add_bytes(VAR_0, FW_CFG_ACPI_TABLES, (uint8_t *)acpi_tables, acpi_tables_len); fw_cfg_add_i32(VAR_0, FW_CFG_IRQ0_OVERRIDE, kvm_allows_irq0_override()); smbios_table = smbios_get_table(&smbios_len); if (smbios_table) fw_cfg_add_bytes(VAR_0, FW_CFG_SMBIOS_ENTRIES, smbios_table, smbios_len); fw_cfg_add_bytes(VAR_0, FW_CFG_E820_TABLE, (uint8_t *)&e820_table, sizeof(e820_table)); fw_cfg_add_bytes(VAR_0, FW_CFG_HPET, (uint8_t *)&hpet_cfg, sizeof(struct hpet_fw_config)); numa_fw_cfg = g_new0(uint64_t, 1 + max_cpus + nb_numa_nodes); numa_fw_cfg[0] = cpu_to_le64(nb_numa_nodes); for (VAR_1 = 0; VAR_1 < max_cpus; VAR_1++) { for (VAR_2 = 0; VAR_2 < nb_numa_nodes; VAR_2++) { if (test_bit(VAR_1, node_cpumask[VAR_2])) { numa_fw_cfg[VAR_1 + 1] = cpu_to_le64(VAR_2); break; } } } for (VAR_1 = 0; VAR_1 < nb_numa_nodes; VAR_1++) { numa_fw_cfg[max_cpus + 1 + VAR_1] = cpu_to_le64(node_mem[VAR_1]); } fw_cfg_add_bytes(VAR_0, FW_CFG_NUMA, (uint8_t *)numa_fw_cfg, (1 + max_cpus + nb_numa_nodes) * sizeof(*numa_fw_cfg)); return VAR_0; }
[ "static void *FUNC_0(void)\n{", "void *VAR_0;", "uint8_t *smbios_table;", "size_t smbios_len;", "uint64_t *numa_fw_cfg;", "int VAR_1, VAR_2;", "VAR_0 = fw_cfg_init(BIOS_CFG_IOPORT, BIOS_CFG_IOPORT + 1, 0, 0);", "fw_cfg_add_i32(VAR_0, FW_CFG_ID, 1);", "fw_cfg_add_i64(VAR_0, FW_CFG_RAM_SIZE, (uint64_t)ram_size);", "fw_cfg_add_bytes(VAR_0, FW_CFG_ACPI_TABLES, (uint8_t *)acpi_tables,\nacpi_tables_len);", "fw_cfg_add_i32(VAR_0, FW_CFG_IRQ0_OVERRIDE, kvm_allows_irq0_override());", "smbios_table = smbios_get_table(&smbios_len);", "if (smbios_table)\nfw_cfg_add_bytes(VAR_0, FW_CFG_SMBIOS_ENTRIES,\nsmbios_table, smbios_len);", "fw_cfg_add_bytes(VAR_0, FW_CFG_E820_TABLE, (uint8_t *)&e820_table,\nsizeof(e820_table));", "fw_cfg_add_bytes(VAR_0, FW_CFG_HPET, (uint8_t *)&hpet_cfg,\nsizeof(struct hpet_fw_config));", "numa_fw_cfg = g_new0(uint64_t, 1 + max_cpus + nb_numa_nodes);", "numa_fw_cfg[0] = cpu_to_le64(nb_numa_nodes);", "for (VAR_1 = 0; VAR_1 < max_cpus; VAR_1++) {", "for (VAR_2 = 0; VAR_2 < nb_numa_nodes; VAR_2++) {", "if (test_bit(VAR_1, node_cpumask[VAR_2])) {", "numa_fw_cfg[VAR_1 + 1] = cpu_to_le64(VAR_2);", "break;", "}", "}", "}", "for (VAR_1 = 0; VAR_1 < nb_numa_nodes; VAR_1++) {", "numa_fw_cfg[max_cpus + 1 + VAR_1] = cpu_to_le64(node_mem[VAR_1]);", "}", "fw_cfg_add_bytes(VAR_0, FW_CFG_NUMA, (uint8_t *)numa_fw_cfg,\n(1 + max_cpus + nb_numa_nodes) * sizeof(*numa_fw_cfg));", "return VAR_0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 21 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 33 ], [ 35, 37, 39 ], [ 41, 43 ], [ 47, 49 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85, 87 ], [ 91 ], [ 93 ] ]
17,930
static CharDriverState *gd_vc_handler(ChardevVC *vc, Error **errp) { ChardevCommon *common = qapi_ChardevVC_base(vc); CharDriverState *chr; chr = qemu_chr_alloc(common, errp); if (!chr) { chr->chr_write = gd_vc_chr_write; chr->chr_set_echo = gd_vc_chr_set_echo; /* Temporary, until gd_vc_vte_init runs. */ chr->opaque = g_new0(VirtualConsole, 1); vcs[nb_vcs++] = chr; return chr;
true
qemu
c952b71582e2e4be286087ad34de5e3ec1b8d974
static CharDriverState *gd_vc_handler(ChardevVC *vc, Error **errp) { ChardevCommon *common = qapi_ChardevVC_base(vc); CharDriverState *chr; chr = qemu_chr_alloc(common, errp); if (!chr) { chr->chr_write = gd_vc_chr_write; chr->chr_set_echo = gd_vc_chr_set_echo; chr->opaque = g_new0(VirtualConsole, 1); vcs[nb_vcs++] = chr; return chr;
{ "code": [], "line_no": [] }
static CharDriverState *FUNC_0(ChardevVC *vc, Error **errp) { ChardevCommon *common = qapi_ChardevVC_base(vc); CharDriverState *chr; chr = qemu_chr_alloc(common, errp); if (!chr) { chr->chr_write = gd_vc_chr_write; chr->chr_set_echo = gd_vc_chr_set_echo; chr->opaque = g_new0(VirtualConsole, 1); vcs[nb_vcs++] = chr; return chr;
[ "static CharDriverState *FUNC_0(ChardevVC *vc, Error **errp)\n{", "ChardevCommon *common = qapi_ChardevVC_base(vc);", "CharDriverState *chr;", "chr = qemu_chr_alloc(common, errp);", "if (!chr) {", "chr->chr_write = gd_vc_chr_write;", "chr->chr_set_echo = gd_vc_chr_set_echo;", "chr->opaque = g_new0(VirtualConsole, 1);", "vcs[nb_vcs++] = chr;", "return chr;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2 ], [ 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ], [ 8 ], [ 10 ], [ 11 ], [ 12 ] ]
17,931
int av_parse_color(uint8_t *rgba_color, const char *color_string, void *log_ctx) { if (!strcasecmp(color_string, "random") || !strcasecmp(color_string, "bikeshed")) { int rgba = ff_random_get_seed(); rgba_color[0] = rgba >> 24; rgba_color[1] = rgba >> 16; rgba_color[2] = rgba >> 8; rgba_color[3] = rgba; } else if (!strncmp(color_string, "0x", 2)) { char *tail; int len = strlen(color_string); int rgba = strtol(color_string, &tail, 16); if (*tail || (len != 8 && len != 10)) { av_log(log_ctx, AV_LOG_ERROR, "Invalid 0xRRGGBB[AA] color string: '%s'\n", color_string); return -1; } if (len == 10) { rgba_color[3] = rgba; rgba >>= 8; } rgba_color[0] = rgba >> 16; rgba_color[1] = rgba >> 8; rgba_color[2] = rgba; } else { const ColorEntry *entry = bsearch(color_string, color_table, FF_ARRAY_ELEMS(color_table), sizeof(ColorEntry), color_table_compare); if (!entry) { av_log(log_ctx, AV_LOG_ERROR, "Cannot find color '%s'\n", color_string); return -1; } memcpy(rgba_color, entry->rgba_color, 4); } return 0; }
true
FFmpeg
7d132c544b2447ef5a6b04ca6f21e245d6a48986
int av_parse_color(uint8_t *rgba_color, const char *color_string, void *log_ctx) { if (!strcasecmp(color_string, "random") || !strcasecmp(color_string, "bikeshed")) { int rgba = ff_random_get_seed(); rgba_color[0] = rgba >> 24; rgba_color[1] = rgba >> 16; rgba_color[2] = rgba >> 8; rgba_color[3] = rgba; } else if (!strncmp(color_string, "0x", 2)) { char *tail; int len = strlen(color_string); int rgba = strtol(color_string, &tail, 16); if (*tail || (len != 8 && len != 10)) { av_log(log_ctx, AV_LOG_ERROR, "Invalid 0xRRGGBB[AA] color string: '%s'\n", color_string); return -1; } if (len == 10) { rgba_color[3] = rgba; rgba >>= 8; } rgba_color[0] = rgba >> 16; rgba_color[1] = rgba >> 8; rgba_color[2] = rgba; } else { const ColorEntry *entry = bsearch(color_string, color_table, FF_ARRAY_ELEMS(color_table), sizeof(ColorEntry), color_table_compare); if (!entry) { av_log(log_ctx, AV_LOG_ERROR, "Cannot find color '%s'\n", color_string); return -1; } memcpy(rgba_color, entry->rgba_color, 4); } return 0; }
{ "code": [ " int rgba = strtol(color_string, &tail, 16);" ], "line_no": [ 25 ] }
int FUNC_0(uint8_t *VAR_0, const char *VAR_1, void *VAR_2) { if (!strcasecmp(VAR_1, "random") || !strcasecmp(VAR_1, "bikeshed")) { int VAR_6 = ff_random_get_seed(); VAR_0[0] = VAR_6 >> 24; VAR_0[1] = VAR_6 >> 16; VAR_0[2] = VAR_6 >> 8; VAR_0[3] = VAR_6; } else if (!strncmp(VAR_1, "0x", 2)) { char *VAR_4; int VAR_5 = strlen(VAR_1); int VAR_6 = strtol(VAR_1, &VAR_4, 16); if (*VAR_4 || (VAR_5 != 8 && VAR_5 != 10)) { av_log(VAR_2, AV_LOG_ERROR, "Invalid 0xRRGGBB[AA] color string: '%s'\n", VAR_1); return -1; } if (VAR_5 == 10) { VAR_0[3] = VAR_6; VAR_6 >>= 8; } VAR_0[0] = VAR_6 >> 16; VAR_0[1] = VAR_6 >> 8; VAR_0[2] = VAR_6; } else { const ColorEntry *VAR_6 = bsearch(VAR_1, color_table, FF_ARRAY_ELEMS(color_table), sizeof(ColorEntry), color_table_compare); if (!VAR_6) { av_log(VAR_2, AV_LOG_ERROR, "Cannot find color '%s'\n", VAR_1); return -1; } memcpy(VAR_0, VAR_6->VAR_0, 4); } return 0; }
[ "int FUNC_0(uint8_t *VAR_0, const char *VAR_1, void *VAR_2)\n{", "if (!strcasecmp(VAR_1, \"random\") || !strcasecmp(VAR_1, \"bikeshed\")) {", "int VAR_6 = ff_random_get_seed();", "VAR_0[0] = VAR_6 >> 24;", "VAR_0[1] = VAR_6 >> 16;", "VAR_0[2] = VAR_6 >> 8;", "VAR_0[3] = VAR_6;", "} else", "if (!strncmp(VAR_1, \"0x\", 2)) {", "char *VAR_4;", "int VAR_5 = strlen(VAR_1);", "int VAR_6 = strtol(VAR_1, &VAR_4, 16);", "if (*VAR_4 || (VAR_5 != 8 && VAR_5 != 10)) {", "av_log(VAR_2, AV_LOG_ERROR, \"Invalid 0xRRGGBB[AA] color string: '%s'\\n\", VAR_1);", "return -1;", "}", "if (VAR_5 == 10) {", "VAR_0[3] = VAR_6;", "VAR_6 >>= 8;", "}", "VAR_0[0] = VAR_6 >> 16;", "VAR_0[1] = VAR_6 >> 8;", "VAR_0[2] = VAR_6;", "} else {", "const ColorEntry *VAR_6 = bsearch(VAR_1,\ncolor_table,\nFF_ARRAY_ELEMS(color_table),\nsizeof(ColorEntry),\ncolor_table_compare);", "if (!VAR_6) {", "av_log(VAR_2, AV_LOG_ERROR, \"Cannot find color '%s'\\n\", VAR_1);", "return -1;", "}", "memcpy(VAR_0, VAR_6->VAR_0, 4);", "}", "return 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53, 55, 57, 59, 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 79 ] ]
17,934
static av_cold int aac_encode_init(AVCodecContext *avctx) { AACEncContext *s = avctx->priv_data; int i; const uint8_t *sizes[2]; uint8_t grouping[AAC_MAX_CHANNELS]; int lengths[2]; avctx->frame_size = 1024; for (i = 0; i < 16; i++) if (avctx->sample_rate == avpriv_mpeg4audio_sample_rates[i]) break; if (i == 16) { av_log(avctx, AV_LOG_ERROR, "Unsupported sample rate %d\n", avctx->sample_rate); return -1; } if (avctx->channels > AAC_MAX_CHANNELS) { av_log(avctx, AV_LOG_ERROR, "Unsupported number of channels: %d\n", avctx->channels); return -1; } if (avctx->profile != FF_PROFILE_UNKNOWN && avctx->profile != FF_PROFILE_AAC_LOW) { av_log(avctx, AV_LOG_ERROR, "Unsupported profile %d\n", avctx->profile); return -1; } if (1024.0 * avctx->bit_rate / avctx->sample_rate > 6144 * avctx->channels) { av_log(avctx, AV_LOG_ERROR, "Too many bits per frame requested\n"); return -1; } s->samplerate_index = i; dsputil_init(&s->dsp, avctx); ff_mdct_init(&s->mdct1024, 11, 0, 1.0); ff_mdct_init(&s->mdct128, 8, 0, 1.0); // window init ff_kbd_window_init(ff_aac_kbd_long_1024, 4.0, 1024); ff_kbd_window_init(ff_aac_kbd_short_128, 6.0, 128); ff_init_ff_sine_windows(10); ff_init_ff_sine_windows(7); s->chan_map = aac_chan_configs[avctx->channels-1]; s->samples = av_malloc(2 * 1024 * avctx->channels * sizeof(s->samples[0])); s->cpe = av_mallocz(sizeof(ChannelElement) * s->chan_map[0]); avctx->extradata = av_mallocz(5 + FF_INPUT_BUFFER_PADDING_SIZE); avctx->extradata_size = 5; put_audio_specific_config(avctx); sizes[0] = swb_size_1024[i]; sizes[1] = swb_size_128[i]; lengths[0] = ff_aac_num_swb_1024[i]; lengths[1] = ff_aac_num_swb_128[i]; for (i = 0; i < s->chan_map[0]; i++) grouping[i] = s->chan_map[i + 1] == TYPE_CPE; ff_psy_init(&s->psy, avctx, 2, sizes, lengths, s->chan_map[0], grouping); s->psypp = ff_psy_preprocess_init(avctx); s->coder = &ff_aac_coders[2]; s->lambda = avctx->global_quality ? avctx->global_quality : 120; ff_aac_tableinit(); return 0; }
true
FFmpeg
17ae608127324cabd083202a32a8dc210d30c3a1
static av_cold int aac_encode_init(AVCodecContext *avctx) { AACEncContext *s = avctx->priv_data; int i; const uint8_t *sizes[2]; uint8_t grouping[AAC_MAX_CHANNELS]; int lengths[2]; avctx->frame_size = 1024; for (i = 0; i < 16; i++) if (avctx->sample_rate == avpriv_mpeg4audio_sample_rates[i]) break; if (i == 16) { av_log(avctx, AV_LOG_ERROR, "Unsupported sample rate %d\n", avctx->sample_rate); return -1; } if (avctx->channels > AAC_MAX_CHANNELS) { av_log(avctx, AV_LOG_ERROR, "Unsupported number of channels: %d\n", avctx->channels); return -1; } if (avctx->profile != FF_PROFILE_UNKNOWN && avctx->profile != FF_PROFILE_AAC_LOW) { av_log(avctx, AV_LOG_ERROR, "Unsupported profile %d\n", avctx->profile); return -1; } if (1024.0 * avctx->bit_rate / avctx->sample_rate > 6144 * avctx->channels) { av_log(avctx, AV_LOG_ERROR, "Too many bits per frame requested\n"); return -1; } s->samplerate_index = i; dsputil_init(&s->dsp, avctx); ff_mdct_init(&s->mdct1024, 11, 0, 1.0); ff_mdct_init(&s->mdct128, 8, 0, 1.0); ff_kbd_window_init(ff_aac_kbd_long_1024, 4.0, 1024); ff_kbd_window_init(ff_aac_kbd_short_128, 6.0, 128); ff_init_ff_sine_windows(10); ff_init_ff_sine_windows(7); s->chan_map = aac_chan_configs[avctx->channels-1]; s->samples = av_malloc(2 * 1024 * avctx->channels * sizeof(s->samples[0])); s->cpe = av_mallocz(sizeof(ChannelElement) * s->chan_map[0]); avctx->extradata = av_mallocz(5 + FF_INPUT_BUFFER_PADDING_SIZE); avctx->extradata_size = 5; put_audio_specific_config(avctx); sizes[0] = swb_size_1024[i]; sizes[1] = swb_size_128[i]; lengths[0] = ff_aac_num_swb_1024[i]; lengths[1] = ff_aac_num_swb_128[i]; for (i = 0; i < s->chan_map[0]; i++) grouping[i] = s->chan_map[i + 1] == TYPE_CPE; ff_psy_init(&s->psy, avctx, 2, sizes, lengths, s->chan_map[0], grouping); s->psypp = ff_psy_preprocess_init(avctx); s->coder = &ff_aac_coders[2]; s->lambda = avctx->global_quality ? avctx->global_quality : 120; ff_aac_tableinit(); return 0; }
{ "code": [ " int i;", " if (i == 16) {", " av_log(avctx, AV_LOG_ERROR, \"Unsupported sample rate %d\\n\", avctx->sample_rate);", " return -1;", " if (avctx->channels > AAC_MAX_CHANNELS) {", " av_log(avctx, AV_LOG_ERROR, \"Unsupported number of channels: %d\\n\", avctx->channels);", " return -1;", " if (avctx->profile != FF_PROFILE_UNKNOWN && avctx->profile != FF_PROFILE_AAC_LOW) {", " av_log(avctx, AV_LOG_ERROR, \"Unsupported profile %d\\n\", avctx->profile);", " return -1;", " if (1024.0 * avctx->bit_rate / avctx->sample_rate > 6144 * avctx->channels) {", " av_log(avctx, AV_LOG_ERROR, \"Too many bits per frame requested\\n\");", " return -1;", " dsputil_init(&s->dsp, avctx);", " ff_mdct_init(&s->mdct1024, 11, 0, 1.0);", " ff_mdct_init(&s->mdct128, 8, 0, 1.0);", " ff_kbd_window_init(ff_aac_kbd_long_1024, 4.0, 1024);", " ff_kbd_window_init(ff_aac_kbd_short_128, 6.0, 128);", " ff_init_ff_sine_windows(10);", " ff_init_ff_sine_windows(7);", " s->chan_map = aac_chan_configs[avctx->channels-1];", " s->samples = av_malloc(2 * 1024 * avctx->channels * sizeof(s->samples[0]));", " s->cpe = av_mallocz(sizeof(ChannelElement) * s->chan_map[0]);", " avctx->extradata = av_mallocz(5 + FF_INPUT_BUFFER_PADDING_SIZE);", " ff_psy_init(&s->psy, avctx, 2, sizes, lengths, s->chan_map[0], grouping);", " AACEncContext *s = avctx->priv_data;", " return 0;" ], "line_no": [ 7, 27, 29, 31, 35, 37, 31, 43, 45, 31, 51, 53, 31, 63, 65, 67, 71, 73, 75, 77, 81, 83, 85, 87, 107, 5, 123 ] }
static av_cold int FUNC_0(AVCodecContext *avctx) { AACEncContext *s = avctx->priv_data; int VAR_0; const uint8_t *VAR_1[2]; uint8_t grouping[AAC_MAX_CHANNELS]; int VAR_2[2]; avctx->frame_size = 1024; for (VAR_0 = 0; VAR_0 < 16; VAR_0++) if (avctx->sample_rate == avpriv_mpeg4audio_sample_rates[VAR_0]) break; if (VAR_0 == 16) { av_log(avctx, AV_LOG_ERROR, "Unsupported sample rate %d\n", avctx->sample_rate); return -1; } if (avctx->channels > AAC_MAX_CHANNELS) { av_log(avctx, AV_LOG_ERROR, "Unsupported number of channels: %d\n", avctx->channels); return -1; } if (avctx->profile != FF_PROFILE_UNKNOWN && avctx->profile != FF_PROFILE_AAC_LOW) { av_log(avctx, AV_LOG_ERROR, "Unsupported profile %d\n", avctx->profile); return -1; } if (1024.0 * avctx->bit_rate / avctx->sample_rate > 6144 * avctx->channels) { av_log(avctx, AV_LOG_ERROR, "Too many bits per frame requested\n"); return -1; } s->samplerate_index = VAR_0; dsputil_init(&s->dsp, avctx); ff_mdct_init(&s->mdct1024, 11, 0, 1.0); ff_mdct_init(&s->mdct128, 8, 0, 1.0); ff_kbd_window_init(ff_aac_kbd_long_1024, 4.0, 1024); ff_kbd_window_init(ff_aac_kbd_short_128, 6.0, 128); ff_init_ff_sine_windows(10); ff_init_ff_sine_windows(7); s->chan_map = aac_chan_configs[avctx->channels-1]; s->samples = av_malloc(2 * 1024 * avctx->channels * sizeof(s->samples[0])); s->cpe = av_mallocz(sizeof(ChannelElement) * s->chan_map[0]); avctx->extradata = av_mallocz(5 + FF_INPUT_BUFFER_PADDING_SIZE); avctx->extradata_size = 5; put_audio_specific_config(avctx); VAR_1[0] = swb_size_1024[VAR_0]; VAR_1[1] = swb_size_128[VAR_0]; VAR_2[0] = ff_aac_num_swb_1024[VAR_0]; VAR_2[1] = ff_aac_num_swb_128[VAR_0]; for (VAR_0 = 0; VAR_0 < s->chan_map[0]; VAR_0++) grouping[VAR_0] = s->chan_map[VAR_0 + 1] == TYPE_CPE; ff_psy_init(&s->psy, avctx, 2, VAR_1, VAR_2, s->chan_map[0], grouping); s->psypp = ff_psy_preprocess_init(avctx); s->coder = &ff_aac_coders[2]; s->lambda = avctx->global_quality ? avctx->global_quality : 120; ff_aac_tableinit(); return 0; }
[ "static av_cold int FUNC_0(AVCodecContext *avctx)\n{", "AACEncContext *s = avctx->priv_data;", "int VAR_0;", "const uint8_t *VAR_1[2];", "uint8_t grouping[AAC_MAX_CHANNELS];", "int VAR_2[2];", "avctx->frame_size = 1024;", "for (VAR_0 = 0; VAR_0 < 16; VAR_0++)", "if (avctx->sample_rate == avpriv_mpeg4audio_sample_rates[VAR_0])\nbreak;", "if (VAR_0 == 16) {", "av_log(avctx, AV_LOG_ERROR, \"Unsupported sample rate %d\\n\", avctx->sample_rate);", "return -1;", "}", "if (avctx->channels > AAC_MAX_CHANNELS) {", "av_log(avctx, AV_LOG_ERROR, \"Unsupported number of channels: %d\\n\", avctx->channels);", "return -1;", "}", "if (avctx->profile != FF_PROFILE_UNKNOWN && avctx->profile != FF_PROFILE_AAC_LOW) {", "av_log(avctx, AV_LOG_ERROR, \"Unsupported profile %d\\n\", avctx->profile);", "return -1;", "}", "if (1024.0 * avctx->bit_rate / avctx->sample_rate > 6144 * avctx->channels) {", "av_log(avctx, AV_LOG_ERROR, \"Too many bits per frame requested\\n\");", "return -1;", "}", "s->samplerate_index = VAR_0;", "dsputil_init(&s->dsp, avctx);", "ff_mdct_init(&s->mdct1024, 11, 0, 1.0);", "ff_mdct_init(&s->mdct128, 8, 0, 1.0);", "ff_kbd_window_init(ff_aac_kbd_long_1024, 4.0, 1024);", "ff_kbd_window_init(ff_aac_kbd_short_128, 6.0, 128);", "ff_init_ff_sine_windows(10);", "ff_init_ff_sine_windows(7);", "s->chan_map = aac_chan_configs[avctx->channels-1];", "s->samples = av_malloc(2 * 1024 * avctx->channels * sizeof(s->samples[0]));", "s->cpe = av_mallocz(sizeof(ChannelElement) * s->chan_map[0]);", "avctx->extradata = av_mallocz(5 + FF_INPUT_BUFFER_PADDING_SIZE);", "avctx->extradata_size = 5;", "put_audio_specific_config(avctx);", "VAR_1[0] = swb_size_1024[VAR_0];", "VAR_1[1] = swb_size_128[VAR_0];", "VAR_2[0] = ff_aac_num_swb_1024[VAR_0];", "VAR_2[1] = ff_aac_num_swb_128[VAR_0];", "for (VAR_0 = 0; VAR_0 < s->chan_map[0]; VAR_0++)", "grouping[VAR_0] = s->chan_map[VAR_0 + 1] == TYPE_CPE;", "ff_psy_init(&s->psy, avctx, 2, VAR_1, VAR_2, s->chan_map[0], grouping);", "s->psypp = ff_psy_preprocess_init(avctx);", "s->coder = &ff_aac_coders[2];", "s->lambda = avctx->global_quality ? avctx->global_quality : 120;", "ff_aac_tableinit();", "return 0;", "}" ]
[ 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 115 ], [ 119 ], [ 123 ], [ 125 ] ]
17,935
static int of_dpa_cmd_flow_add(OfDpa *of_dpa, uint64_t cookie, RockerTlv **flow_tlvs) { OfDpaFlow *flow = of_dpa_flow_find(of_dpa, cookie); int err = ROCKER_OK; if (flow) { return -ROCKER_EEXIST; } flow = of_dpa_flow_alloc(cookie); if (!flow) { return -ROCKER_ENOMEM; } err = of_dpa_cmd_flow_add_mod(of_dpa, flow, flow_tlvs); if (err) { g_free(flow); return err; } return of_dpa_flow_add(of_dpa, flow); }
true
qemu
107e4b352cc309f9bd7588ef1a44549200620078
static int of_dpa_cmd_flow_add(OfDpa *of_dpa, uint64_t cookie, RockerTlv **flow_tlvs) { OfDpaFlow *flow = of_dpa_flow_find(of_dpa, cookie); int err = ROCKER_OK; if (flow) { return -ROCKER_EEXIST; } flow = of_dpa_flow_alloc(cookie); if (!flow) { return -ROCKER_ENOMEM; } err = of_dpa_cmd_flow_add_mod(of_dpa, flow, flow_tlvs); if (err) { g_free(flow); return err; } return of_dpa_flow_add(of_dpa, flow); }
{ "code": [ " if (!flow) {", " if (!flow) {", " return -ROCKER_ENOMEM;", " return -ROCKER_ENOMEM;", " return -ROCKER_ENOMEM;" ], "line_no": [ 23, 23, 25, 25, 25 ] }
static int FUNC_0(OfDpa *VAR_0, uint64_t VAR_1, RockerTlv **VAR_2) { OfDpaFlow *flow = of_dpa_flow_find(VAR_0, VAR_1); int VAR_3 = ROCKER_OK; if (flow) { return -ROCKER_EEXIST; } flow = of_dpa_flow_alloc(VAR_1); if (!flow) { return -ROCKER_ENOMEM; } VAR_3 = of_dpa_cmd_flow_add_mod(VAR_0, flow, VAR_2); if (VAR_3) { g_free(flow); return VAR_3; } return of_dpa_flow_add(VAR_0, flow); }
[ "static int FUNC_0(OfDpa *VAR_0, uint64_t VAR_1,\nRockerTlv **VAR_2)\n{", "OfDpaFlow *flow = of_dpa_flow_find(VAR_0, VAR_1);", "int VAR_3 = ROCKER_OK;", "if (flow) {", "return -ROCKER_EEXIST;", "}", "flow = of_dpa_flow_alloc(VAR_1);", "if (!flow) {", "return -ROCKER_ENOMEM;", "}", "VAR_3 = of_dpa_cmd_flow_add_mod(VAR_0, flow, VAR_2);", "if (VAR_3) {", "g_free(flow);", "return VAR_3;", "}", "return of_dpa_flow_add(VAR_0, flow);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ] ]
17,936
static int epaf_read_header(AVFormatContext *s) { int le, sample_rate, codec, channels; AVStream *st; avio_skip(s->pb, 4); if (avio_rl32(s->pb)) return AVERROR_INVALIDDATA; le = avio_rl32(s->pb); if (le && le != 1) return AVERROR_INVALIDDATA; if (le) { sample_rate = avio_rl32(s->pb); codec = avio_rl32(s->pb); channels = avio_rl32(s->pb); } else { sample_rate = avio_rb32(s->pb); codec = avio_rb32(s->pb); channels = avio_rb32(s->pb); } if (!channels || !sample_rate) return AVERROR_INVALIDDATA; st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; st->codecpar->channels = channels; st->codecpar->sample_rate = sample_rate; switch (codec) { case 0: st->codecpar->codec_id = le ? AV_CODEC_ID_PCM_S16LE : AV_CODEC_ID_PCM_S16BE; break; case 2: st->codecpar->codec_id = AV_CODEC_ID_PCM_S8; break; case 1: avpriv_request_sample(s, "24-bit Paris PCM format"); default: return AVERROR_INVALIDDATA; } st->codecpar->bits_per_coded_sample = av_get_bits_per_sample(st->codecpar->codec_id); st->codecpar->block_align = st->codecpar->bits_per_coded_sample * st->codecpar->channels / 8; avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate); if (avio_skip(s->pb, 2024) < 0) return AVERROR_INVALIDDATA; return 0; }
true
FFmpeg
74bd17d31648c77d01a0d35b09724715bc40fba2
static int epaf_read_header(AVFormatContext *s) { int le, sample_rate, codec, channels; AVStream *st; avio_skip(s->pb, 4); if (avio_rl32(s->pb)) return AVERROR_INVALIDDATA; le = avio_rl32(s->pb); if (le && le != 1) return AVERROR_INVALIDDATA; if (le) { sample_rate = avio_rl32(s->pb); codec = avio_rl32(s->pb); channels = avio_rl32(s->pb); } else { sample_rate = avio_rb32(s->pb); codec = avio_rb32(s->pb); channels = avio_rb32(s->pb); } if (!channels || !sample_rate) return AVERROR_INVALIDDATA; st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; st->codecpar->channels = channels; st->codecpar->sample_rate = sample_rate; switch (codec) { case 0: st->codecpar->codec_id = le ? AV_CODEC_ID_PCM_S16LE : AV_CODEC_ID_PCM_S16BE; break; case 2: st->codecpar->codec_id = AV_CODEC_ID_PCM_S8; break; case 1: avpriv_request_sample(s, "24-bit Paris PCM format"); default: return AVERROR_INVALIDDATA; } st->codecpar->bits_per_coded_sample = av_get_bits_per_sample(st->codecpar->codec_id); st->codecpar->block_align = st->codecpar->bits_per_coded_sample * st->codecpar->channels / 8; avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate); if (avio_skip(s->pb, 2024) < 0) return AVERROR_INVALIDDATA; return 0; }
{ "code": [ " if (!channels || !sample_rate)" ], "line_no": [ 47 ] }
static int FUNC_0(AVFormatContext *VAR_0) { int VAR_1, VAR_2, VAR_3, VAR_4; AVStream *st; avio_skip(VAR_0->pb, 4); if (avio_rl32(VAR_0->pb)) return AVERROR_INVALIDDATA; VAR_1 = avio_rl32(VAR_0->pb); if (VAR_1 && VAR_1 != 1) return AVERROR_INVALIDDATA; if (VAR_1) { VAR_2 = avio_rl32(VAR_0->pb); VAR_3 = avio_rl32(VAR_0->pb); VAR_4 = avio_rl32(VAR_0->pb); } else { VAR_2 = avio_rb32(VAR_0->pb); VAR_3 = avio_rb32(VAR_0->pb); VAR_4 = avio_rb32(VAR_0->pb); } if (!VAR_4 || !VAR_2) return AVERROR_INVALIDDATA; st = avformat_new_stream(VAR_0, NULL); if (!st) return AVERROR(ENOMEM); st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; st->codecpar->VAR_4 = VAR_4; st->codecpar->VAR_2 = VAR_2; switch (VAR_3) { case 0: st->codecpar->codec_id = VAR_1 ? AV_CODEC_ID_PCM_S16LE : AV_CODEC_ID_PCM_S16BE; break; case 2: st->codecpar->codec_id = AV_CODEC_ID_PCM_S8; break; case 1: avpriv_request_sample(VAR_0, "24-bit Paris PCM format"); default: return AVERROR_INVALIDDATA; } st->codecpar->bits_per_coded_sample = av_get_bits_per_sample(st->codecpar->codec_id); st->codecpar->block_align = st->codecpar->bits_per_coded_sample * st->codecpar->VAR_4 / 8; avpriv_set_pts_info(st, 64, 1, st->codecpar->VAR_2); if (avio_skip(VAR_0->pb, 2024) < 0) return AVERROR_INVALIDDATA; return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0)\n{", "int VAR_1, VAR_2, VAR_3, VAR_4;", "AVStream *st;", "avio_skip(VAR_0->pb, 4);", "if (avio_rl32(VAR_0->pb))\nreturn AVERROR_INVALIDDATA;", "VAR_1 = avio_rl32(VAR_0->pb);", "if (VAR_1 && VAR_1 != 1)\nreturn AVERROR_INVALIDDATA;", "if (VAR_1) {", "VAR_2 = avio_rl32(VAR_0->pb);", "VAR_3 = avio_rl32(VAR_0->pb);", "VAR_4 = avio_rl32(VAR_0->pb);", "} else {", "VAR_2 = avio_rb32(VAR_0->pb);", "VAR_3 = avio_rb32(VAR_0->pb);", "VAR_4 = avio_rb32(VAR_0->pb);", "}", "if (!VAR_4 || !VAR_2)\nreturn AVERROR_INVALIDDATA;", "st = avformat_new_stream(VAR_0, NULL);", "if (!st)\nreturn AVERROR(ENOMEM);", "st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;", "st->codecpar->VAR_4 = VAR_4;", "st->codecpar->VAR_2 = VAR_2;", "switch (VAR_3) {", "case 0:\nst->codecpar->codec_id = VAR_1 ? AV_CODEC_ID_PCM_S16LE : AV_CODEC_ID_PCM_S16BE;", "break;", "case 2:\nst->codecpar->codec_id = AV_CODEC_ID_PCM_S8;", "break;", "case 1:\navpriv_request_sample(VAR_0, \"24-bit Paris PCM format\");", "default:\nreturn AVERROR_INVALIDDATA;", "}", "st->codecpar->bits_per_coded_sample = av_get_bits_per_sample(st->codecpar->codec_id);", "st->codecpar->block_align = st->codecpar->bits_per_coded_sample * st->codecpar->VAR_4 / 8;", "avpriv_set_pts_info(st, 64, 1, st->codecpar->VAR_2);", "if (avio_skip(VAR_0->pb, 2024) < 0)\nreturn AVERROR_INVALIDDATA;", "return 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 ], [ 11 ], [ 13, 15 ], [ 19 ], [ 21, 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47, 49 ], [ 53 ], [ 55, 57 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69, 71 ], [ 73 ], [ 75, 77 ], [ 79 ], [ 81, 83 ], [ 85, 87 ], [ 89 ], [ 93 ], [ 95 ], [ 99 ], [ 103, 105 ], [ 107 ], [ 109 ] ]
17,937
static void audio_init (void) { size_t i; int done = 0; const char *drvname; VMChangeStateEntry *e; AudioState *s = &glob_audio_state; if (s->drv) { return; } QLIST_INIT (&s->hw_head_out); QLIST_INIT (&s->hw_head_in); QLIST_INIT (&s->cap_head); atexit (audio_atexit); s->ts = timer_new_ns(QEMU_CLOCK_VIRTUAL, audio_timer, s); if (!s->ts) { hw_error("Could not create audio timer\n"); } audio_process_options ("AUDIO", audio_options); s->nb_hw_voices_out = conf.fixed_out.nb_voices; s->nb_hw_voices_in = conf.fixed_in.nb_voices; if (s->nb_hw_voices_out <= 0) { dolog ("Bogus number of playback voices %d, setting to 1\n", s->nb_hw_voices_out); s->nb_hw_voices_out = 1; } if (s->nb_hw_voices_in <= 0) { dolog ("Bogus number of capture voices %d, setting to 0\n", s->nb_hw_voices_in); s->nb_hw_voices_in = 0; } { int def; drvname = audio_get_conf_str ("QEMU_AUDIO_DRV", NULL, &def); } if (drvname) { int found = 0; for (i = 0; i < ARRAY_SIZE (drvtab); i++) { if (!strcmp (drvname, drvtab[i]->name)) { done = !audio_driver_init (s, drvtab[i]); found = 1; break; } } if (!found) { dolog ("Unknown audio driver `%s'\n", drvname); dolog ("Run with -audio-help to list available drivers\n"); } } if (!done) { for (i = 0; !done && i < ARRAY_SIZE (drvtab); i++) { if (drvtab[i]->can_be_default) { done = !audio_driver_init (s, drvtab[i]); } } } if (!done) { done = !audio_driver_init (s, &no_audio_driver); if (!done) { hw_error("Could not initialize audio subsystem\n"); } else { dolog ("warning: Using timer based audio emulation\n"); } } if (conf.period.hertz <= 0) { if (conf.period.hertz < 0) { dolog ("warning: Timer period is negative - %d " "treating as zero\n", conf.period.hertz); } conf.period.ticks = 1; } else { conf.period.ticks = muldiv64 (1, get_ticks_per_sec (), conf.period.hertz); } e = qemu_add_vm_change_state_handler (audio_vm_change_state_handler, s); if (!e) { dolog ("warning: Could not register change state handler\n" "(Audio can continue looping even after stopping the VM)\n"); } QLIST_INIT (&s->card_head); vmstate_register (NULL, 0, &vmstate_audio, s); }
true
qemu
7e274652e4e2225298a2735c3dcc74f2f8ba7b07
static void audio_init (void) { size_t i; int done = 0; const char *drvname; VMChangeStateEntry *e; AudioState *s = &glob_audio_state; if (s->drv) { return; } QLIST_INIT (&s->hw_head_out); QLIST_INIT (&s->hw_head_in); QLIST_INIT (&s->cap_head); atexit (audio_atexit); s->ts = timer_new_ns(QEMU_CLOCK_VIRTUAL, audio_timer, s); if (!s->ts) { hw_error("Could not create audio timer\n"); } audio_process_options ("AUDIO", audio_options); s->nb_hw_voices_out = conf.fixed_out.nb_voices; s->nb_hw_voices_in = conf.fixed_in.nb_voices; if (s->nb_hw_voices_out <= 0) { dolog ("Bogus number of playback voices %d, setting to 1\n", s->nb_hw_voices_out); s->nb_hw_voices_out = 1; } if (s->nb_hw_voices_in <= 0) { dolog ("Bogus number of capture voices %d, setting to 0\n", s->nb_hw_voices_in); s->nb_hw_voices_in = 0; } { int def; drvname = audio_get_conf_str ("QEMU_AUDIO_DRV", NULL, &def); } if (drvname) { int found = 0; for (i = 0; i < ARRAY_SIZE (drvtab); i++) { if (!strcmp (drvname, drvtab[i]->name)) { done = !audio_driver_init (s, drvtab[i]); found = 1; break; } } if (!found) { dolog ("Unknown audio driver `%s'\n", drvname); dolog ("Run with -audio-help to list available drivers\n"); } } if (!done) { for (i = 0; !done && i < ARRAY_SIZE (drvtab); i++) { if (drvtab[i]->can_be_default) { done = !audio_driver_init (s, drvtab[i]); } } } if (!done) { done = !audio_driver_init (s, &no_audio_driver); if (!done) { hw_error("Could not initialize audio subsystem\n"); } else { dolog ("warning: Using timer based audio emulation\n"); } } if (conf.period.hertz <= 0) { if (conf.period.hertz < 0) { dolog ("warning: Timer period is negative - %d " "treating as zero\n", conf.period.hertz); } conf.period.ticks = 1; } else { conf.period.ticks = muldiv64 (1, get_ticks_per_sec (), conf.period.hertz); } e = qemu_add_vm_change_state_handler (audio_vm_change_state_handler, s); if (!e) { dolog ("warning: Could not register change state handler\n" "(Audio can continue looping even after stopping the VM)\n"); } QLIST_INIT (&s->card_head); vmstate_register (NULL, 0, &vmstate_audio, s); }
{ "code": [ " if (!s->ts) {", " hw_error(\"Could not create audio timer\\n\");", " if (!done) {", " hw_error(\"Could not initialize audio subsystem\\n\");", " else {", " dolog (\"warning: Using timer based audio emulation\\n\");" ], "line_no": [ 37, 39, 143, 145, 149, 151 ] }
static void FUNC_0 (void) { size_t i; int VAR_0 = 0; const char *VAR_1; VMChangeStateEntry *e; AudioState *s = &glob_audio_state; if (s->drv) { return; } QLIST_INIT (&s->hw_head_out); QLIST_INIT (&s->hw_head_in); QLIST_INIT (&s->cap_head); atexit (audio_atexit); s->ts = timer_new_ns(QEMU_CLOCK_VIRTUAL, audio_timer, s); if (!s->ts) { hw_error("Could not create audio timer\n"); } audio_process_options ("AUDIO", audio_options); s->nb_hw_voices_out = conf.fixed_out.nb_voices; s->nb_hw_voices_in = conf.fixed_in.nb_voices; if (s->nb_hw_voices_out <= 0) { dolog ("Bogus number of playback voices %d, setting to 1\n", s->nb_hw_voices_out); s->nb_hw_voices_out = 1; } if (s->nb_hw_voices_in <= 0) { dolog ("Bogus number of capture voices %d, setting to 0\n", s->nb_hw_voices_in); s->nb_hw_voices_in = 0; } { int VAR_2; VAR_1 = audio_get_conf_str ("QEMU_AUDIO_DRV", NULL, &VAR_2); } if (VAR_1) { int VAR_3 = 0; for (i = 0; i < ARRAY_SIZE (drvtab); i++) { if (!strcmp (VAR_1, drvtab[i]->name)) { VAR_0 = !audio_driver_init (s, drvtab[i]); VAR_3 = 1; break; } } if (!VAR_3) { dolog ("Unknown audio driver `%s'\n", VAR_1); dolog ("Run with -audio-help to list available drivers\n"); } } if (!VAR_0) { for (i = 0; !VAR_0 && i < ARRAY_SIZE (drvtab); i++) { if (drvtab[i]->can_be_default) { VAR_0 = !audio_driver_init (s, drvtab[i]); } } } if (!VAR_0) { VAR_0 = !audio_driver_init (s, &no_audio_driver); if (!VAR_0) { hw_error("Could not initialize audio subsystem\n"); } else { dolog ("warning: Using timer based audio emulation\n"); } } if (conf.period.hertz <= 0) { if (conf.period.hertz < 0) { dolog ("warning: Timer period is negative - %d " "treating as zero\n", conf.period.hertz); } conf.period.ticks = 1; } else { conf.period.ticks = muldiv64 (1, get_ticks_per_sec (), conf.period.hertz); } e = qemu_add_vm_change_state_handler (audio_vm_change_state_handler, s); if (!e) { dolog ("warning: Could not register change state handler\n" "(Audio can continue looping even after stopping the VM)\n"); } QLIST_INIT (&s->card_head); vmstate_register (NULL, 0, &vmstate_audio, s); }
[ "static void FUNC_0 (void)\n{", "size_t i;", "int VAR_0 = 0;", "const char *VAR_1;", "VMChangeStateEntry *e;", "AudioState *s = &glob_audio_state;", "if (s->drv) {", "return;", "}", "QLIST_INIT (&s->hw_head_out);", "QLIST_INIT (&s->hw_head_in);", "QLIST_INIT (&s->cap_head);", "atexit (audio_atexit);", "s->ts = timer_new_ns(QEMU_CLOCK_VIRTUAL, audio_timer, s);", "if (!s->ts) {", "hw_error(\"Could not create audio timer\\n\");", "}", "audio_process_options (\"AUDIO\", audio_options);", "s->nb_hw_voices_out = conf.fixed_out.nb_voices;", "s->nb_hw_voices_in = conf.fixed_in.nb_voices;", "if (s->nb_hw_voices_out <= 0) {", "dolog (\"Bogus number of playback voices %d, setting to 1\\n\",\ns->nb_hw_voices_out);", "s->nb_hw_voices_out = 1;", "}", "if (s->nb_hw_voices_in <= 0) {", "dolog (\"Bogus number of capture voices %d, setting to 0\\n\",\ns->nb_hw_voices_in);", "s->nb_hw_voices_in = 0;", "}", "{", "int VAR_2;", "VAR_1 = audio_get_conf_str (\"QEMU_AUDIO_DRV\", NULL, &VAR_2);", "}", "if (VAR_1) {", "int VAR_3 = 0;", "for (i = 0; i < ARRAY_SIZE (drvtab); i++) {", "if (!strcmp (VAR_1, drvtab[i]->name)) {", "VAR_0 = !audio_driver_init (s, drvtab[i]);", "VAR_3 = 1;", "break;", "}", "}", "if (!VAR_3) {", "dolog (\"Unknown audio driver `%s'\\n\", VAR_1);", "dolog (\"Run with -audio-help to list available drivers\\n\");", "}", "}", "if (!VAR_0) {", "for (i = 0; !VAR_0 && i < ARRAY_SIZE (drvtab); i++) {", "if (drvtab[i]->can_be_default) {", "VAR_0 = !audio_driver_init (s, drvtab[i]);", "}", "}", "}", "if (!VAR_0) {", "VAR_0 = !audio_driver_init (s, &no_audio_driver);", "if (!VAR_0) {", "hw_error(\"Could not initialize audio subsystem\\n\");", "}", "else {", "dolog (\"warning: Using timer based audio emulation\\n\");", "}", "}", "if (conf.period.hertz <= 0) {", "if (conf.period.hertz < 0) {", "dolog (\"warning: Timer period is negative - %d \"\n\"treating as zero\\n\",\nconf.period.hertz);", "}", "conf.period.ticks = 1;", "} else {", "conf.period.ticks =\nmuldiv64 (1, get_ticks_per_sec (), conf.period.hertz);", "}", "e = qemu_add_vm_change_state_handler (audio_vm_change_state_handler, s);", "if (!e) {", "dolog (\"warning: Could not register change state handler\\n\"\n\"(Audio can continue looping even after stopping the VM)\\n\");", "}", "QLIST_INIT (&s->card_head);", "vmstate_register (NULL, 0, &vmstate_audio, s);", "}" ]
[ 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, 1, 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 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 49 ], [ 51 ], [ 55 ], [ 57, 59 ], [ 61 ], [ 63 ], [ 67 ], [ 69, 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 89 ], [ 91 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 159 ], [ 161 ], [ 163, 165, 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175, 177 ], [ 179 ], [ 183 ], [ 185 ], [ 187, 189 ], [ 191 ], [ 195 ], [ 197 ], [ 199 ] ]
17,939
static void taihu_405ep_init(MachineState *machine) { ram_addr_t ram_size = machine->ram_size; const char *kernel_filename = machine->kernel_filename; const char *initrd_filename = machine->initrd_filename; char *filename; qemu_irq *pic; MemoryRegion *sysmem = get_system_memory(); MemoryRegion *bios; MemoryRegion *ram_memories = g_malloc(2 * sizeof(*ram_memories)); hwaddr ram_bases[2], ram_sizes[2]; long bios_size; target_ulong kernel_base, initrd_base; long kernel_size, initrd_size; int linux_boot; int fl_idx, fl_sectors; DriveInfo *dinfo; /* RAM is soldered to the board so the size cannot be changed */ memory_region_allocate_system_memory(&ram_memories[0], NULL, "taihu_405ep.ram-0", 0x04000000); ram_bases[0] = 0; ram_sizes[0] = 0x04000000; memory_region_allocate_system_memory(&ram_memories[1], NULL, "taihu_405ep.ram-1", 0x04000000); ram_bases[1] = 0x04000000; ram_sizes[1] = 0x04000000; ram_size = 0x08000000; #ifdef DEBUG_BOARD_INIT printf("%s: register cpu\n", __func__); #endif ppc405ep_init(sysmem, ram_memories, ram_bases, ram_sizes, 33333333, &pic, kernel_filename == NULL ? 0 : 1); /* allocate and load BIOS */ #ifdef DEBUG_BOARD_INIT printf("%s: register BIOS\n", __func__); #endif fl_idx = 0; #if defined(USE_FLASH_BIOS) dinfo = drive_get(IF_PFLASH, 0, fl_idx); if (dinfo) { bios_size = bdrv_getlength(dinfo->bdrv); /* XXX: should check that size is 2MB */ // bios_size = 2 * 1024 * 1024; fl_sectors = (bios_size + 65535) >> 16; #ifdef DEBUG_BOARD_INIT printf("Register parallel flash %d size %lx" " at addr %lx '%s' %d\n", fl_idx, bios_size, -bios_size, bdrv_get_device_name(dinfo->bdrv), fl_sectors); #endif pflash_cfi02_register((uint32_t)(-bios_size), NULL, "taihu_405ep.bios", bios_size, dinfo->bdrv, 65536, fl_sectors, 1, 4, 0x0001, 0x22DA, 0x0000, 0x0000, 0x555, 0x2AA, 1); fl_idx++; } else #endif { #ifdef DEBUG_BOARD_INIT printf("Load BIOS from file\n"); #endif if (bios_name == NULL) bios_name = BIOS_FILENAME; bios = g_new(MemoryRegion, 1); memory_region_allocate_system_memory(bios, NULL, "taihu_405ep.bios", BIOS_SIZE); filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); if (filename) { bios_size = load_image(filename, memory_region_get_ram_ptr(bios)); g_free(filename); if (bios_size < 0 || bios_size > BIOS_SIZE) { error_report("Could not load PowerPC BIOS '%s'", bios_name); exit(1); } bios_size = (bios_size + 0xfff) & ~0xfff; memory_region_add_subregion(sysmem, (uint32_t)(-bios_size), bios); } else if (!qtest_enabled()) { error_report("Could not load PowerPC BIOS '%s'", bios_name); exit(1); } memory_region_set_readonly(bios, true); } /* Register Linux flash */ dinfo = drive_get(IF_PFLASH, 0, fl_idx); if (dinfo) { bios_size = bdrv_getlength(dinfo->bdrv); /* XXX: should check that size is 32MB */ bios_size = 32 * 1024 * 1024; fl_sectors = (bios_size + 65535) >> 16; #ifdef DEBUG_BOARD_INIT printf("Register parallel flash %d size %lx" " at addr " TARGET_FMT_lx " '%s'\n", fl_idx, bios_size, (target_ulong)0xfc000000, bdrv_get_device_name(dinfo->bdrv)); #endif pflash_cfi02_register(0xfc000000, NULL, "taihu_405ep.flash", bios_size, dinfo->bdrv, 65536, fl_sectors, 1, 4, 0x0001, 0x22DA, 0x0000, 0x0000, 0x555, 0x2AA, 1); fl_idx++; } /* Register CLPD & LCD display */ #ifdef DEBUG_BOARD_INIT printf("%s: register CPLD\n", __func__); #endif taihu_cpld_init(sysmem, 0x50100000); /* Load kernel */ linux_boot = (kernel_filename != NULL); if (linux_boot) { #ifdef DEBUG_BOARD_INIT printf("%s: load kernel\n", __func__); #endif kernel_base = KERNEL_LOAD_ADDR; /* now we can load the kernel */ kernel_size = load_image_targphys(kernel_filename, kernel_base, ram_size - kernel_base); if (kernel_size < 0) { fprintf(stderr, "qemu: could not load kernel '%s'\n", kernel_filename); exit(1); } /* load initrd */ if (initrd_filename) { initrd_base = INITRD_LOAD_ADDR; initrd_size = load_image_targphys(initrd_filename, initrd_base, ram_size - initrd_base); if (initrd_size < 0) { fprintf(stderr, "qemu: could not load initial ram disk '%s'\n", initrd_filename); exit(1); } } else { initrd_base = 0; initrd_size = 0; } } else { kernel_base = 0; kernel_size = 0; initrd_base = 0; initrd_size = 0; } #ifdef DEBUG_BOARD_INIT printf("%s: Done\n", __func__); #endif }
true
qemu
e206ad48333c50373663945746828fc893b50700
static void taihu_405ep_init(MachineState *machine) { ram_addr_t ram_size = machine->ram_size; const char *kernel_filename = machine->kernel_filename; const char *initrd_filename = machine->initrd_filename; char *filename; qemu_irq *pic; MemoryRegion *sysmem = get_system_memory(); MemoryRegion *bios; MemoryRegion *ram_memories = g_malloc(2 * sizeof(*ram_memories)); hwaddr ram_bases[2], ram_sizes[2]; long bios_size; target_ulong kernel_base, initrd_base; long kernel_size, initrd_size; int linux_boot; int fl_idx, fl_sectors; DriveInfo *dinfo; memory_region_allocate_system_memory(&ram_memories[0], NULL, "taihu_405ep.ram-0", 0x04000000); ram_bases[0] = 0; ram_sizes[0] = 0x04000000; memory_region_allocate_system_memory(&ram_memories[1], NULL, "taihu_405ep.ram-1", 0x04000000); ram_bases[1] = 0x04000000; ram_sizes[1] = 0x04000000; ram_size = 0x08000000; #ifdef DEBUG_BOARD_INIT printf("%s: register cpu\n", __func__); #endif ppc405ep_init(sysmem, ram_memories, ram_bases, ram_sizes, 33333333, &pic, kernel_filename == NULL ? 0 : 1); #ifdef DEBUG_BOARD_INIT printf("%s: register BIOS\n", __func__); #endif fl_idx = 0; #if defined(USE_FLASH_BIOS) dinfo = drive_get(IF_PFLASH, 0, fl_idx); if (dinfo) { bios_size = bdrv_getlength(dinfo->bdrv); fl_sectors = (bios_size + 65535) >> 16; #ifdef DEBUG_BOARD_INIT printf("Register parallel flash %d size %lx" " at addr %lx '%s' %d\n", fl_idx, bios_size, -bios_size, bdrv_get_device_name(dinfo->bdrv), fl_sectors); #endif pflash_cfi02_register((uint32_t)(-bios_size), NULL, "taihu_405ep.bios", bios_size, dinfo->bdrv, 65536, fl_sectors, 1, 4, 0x0001, 0x22DA, 0x0000, 0x0000, 0x555, 0x2AA, 1); fl_idx++; } else #endif { #ifdef DEBUG_BOARD_INIT printf("Load BIOS from file\n"); #endif if (bios_name == NULL) bios_name = BIOS_FILENAME; bios = g_new(MemoryRegion, 1); memory_region_allocate_system_memory(bios, NULL, "taihu_405ep.bios", BIOS_SIZE); filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); if (filename) { bios_size = load_image(filename, memory_region_get_ram_ptr(bios)); g_free(filename); if (bios_size < 0 || bios_size > BIOS_SIZE) { error_report("Could not load PowerPC BIOS '%s'", bios_name); exit(1); } bios_size = (bios_size + 0xfff) & ~0xfff; memory_region_add_subregion(sysmem, (uint32_t)(-bios_size), bios); } else if (!qtest_enabled()) { error_report("Could not load PowerPC BIOS '%s'", bios_name); exit(1); } memory_region_set_readonly(bios, true); } dinfo = drive_get(IF_PFLASH, 0, fl_idx); if (dinfo) { bios_size = bdrv_getlength(dinfo->bdrv); bios_size = 32 * 1024 * 1024; fl_sectors = (bios_size + 65535) >> 16; #ifdef DEBUG_BOARD_INIT printf("Register parallel flash %d size %lx" " at addr " TARGET_FMT_lx " '%s'\n", fl_idx, bios_size, (target_ulong)0xfc000000, bdrv_get_device_name(dinfo->bdrv)); #endif pflash_cfi02_register(0xfc000000, NULL, "taihu_405ep.flash", bios_size, dinfo->bdrv, 65536, fl_sectors, 1, 4, 0x0001, 0x22DA, 0x0000, 0x0000, 0x555, 0x2AA, 1); fl_idx++; } #ifdef DEBUG_BOARD_INIT printf("%s: register CPLD\n", __func__); #endif taihu_cpld_init(sysmem, 0x50100000); linux_boot = (kernel_filename != NULL); if (linux_boot) { #ifdef DEBUG_BOARD_INIT printf("%s: load kernel\n", __func__); #endif kernel_base = KERNEL_LOAD_ADDR; kernel_size = load_image_targphys(kernel_filename, kernel_base, ram_size - kernel_base); if (kernel_size < 0) { fprintf(stderr, "qemu: could not load kernel '%s'\n", kernel_filename); exit(1); } if (initrd_filename) { initrd_base = INITRD_LOAD_ADDR; initrd_size = load_image_targphys(initrd_filename, initrd_base, ram_size - initrd_base); if (initrd_size < 0) { fprintf(stderr, "qemu: could not load initial ram disk '%s'\n", initrd_filename); exit(1); } } else { initrd_base = 0; initrd_size = 0; } } else { kernel_base = 0; kernel_size = 0; initrd_base = 0; initrd_size = 0; } #ifdef DEBUG_BOARD_INIT printf("%s: Done\n", __func__); #endif }
{ "code": [ " BIOS_SIZE);", " memory_region_allocate_system_memory(&ram_memories[0], NULL,", " \"taihu_405ep.ram-0\", 0x04000000);", " memory_region_allocate_system_memory(&ram_memories[1], NULL,", " \"taihu_405ep.ram-1\", 0x04000000);", " ram_size = 0x08000000;", " memory_region_allocate_system_memory(bios, NULL, \"taihu_405ep.bios\",", " BIOS_SIZE);" ], "line_no": [ 135, 39, 41, 47, 49, 55, 133, 135 ] }
static void FUNC_0(MachineState *VAR_0) { ram_addr_t ram_size = VAR_0->ram_size; const char *VAR_1 = VAR_0->VAR_1; const char *VAR_2 = VAR_0->VAR_2; char *VAR_3; qemu_irq *pic; MemoryRegion *sysmem = get_system_memory(); MemoryRegion *bios; MemoryRegion *ram_memories = g_malloc(2 * sizeof(*ram_memories)); hwaddr ram_bases[2], ram_sizes[2]; long VAR_4; target_ulong kernel_base, initrd_base; long VAR_5, VAR_6; int VAR_7; int VAR_8, VAR_9; DriveInfo *dinfo; memory_region_allocate_system_memory(&ram_memories[0], NULL, "taihu_405ep.ram-0", 0x04000000); ram_bases[0] = 0; ram_sizes[0] = 0x04000000; memory_region_allocate_system_memory(&ram_memories[1], NULL, "taihu_405ep.ram-1", 0x04000000); ram_bases[1] = 0x04000000; ram_sizes[1] = 0x04000000; ram_size = 0x08000000; #ifdef DEBUG_BOARD_INIT printf("%s: register cpu\n", __func__); #endif ppc405ep_init(sysmem, ram_memories, ram_bases, ram_sizes, 33333333, &pic, VAR_1 == NULL ? 0 : 1); #ifdef DEBUG_BOARD_INIT printf("%s: register BIOS\n", __func__); #endif VAR_8 = 0; #if defined(USE_FLASH_BIOS) dinfo = drive_get(IF_PFLASH, 0, VAR_8); if (dinfo) { VAR_4 = bdrv_getlength(dinfo->bdrv); VAR_9 = (VAR_4 + 65535) >> 16; #ifdef DEBUG_BOARD_INIT printf("Register parallel flash %d size %lx" " at addr %lx '%s' %d\n", VAR_8, VAR_4, -VAR_4, bdrv_get_device_name(dinfo->bdrv), VAR_9); #endif pflash_cfi02_register((uint32_t)(-VAR_4), NULL, "taihu_405ep.bios", VAR_4, dinfo->bdrv, 65536, VAR_9, 1, 4, 0x0001, 0x22DA, 0x0000, 0x0000, 0x555, 0x2AA, 1); VAR_8++; } else #endif { #ifdef DEBUG_BOARD_INIT printf("Load BIOS from file\n"); #endif if (bios_name == NULL) bios_name = BIOS_FILENAME; bios = g_new(MemoryRegion, 1); memory_region_allocate_system_memory(bios, NULL, "taihu_405ep.bios", BIOS_SIZE); VAR_3 = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); if (VAR_3) { VAR_4 = load_image(VAR_3, memory_region_get_ram_ptr(bios)); g_free(VAR_3); if (VAR_4 < 0 || VAR_4 > BIOS_SIZE) { error_report("Could not load PowerPC BIOS '%s'", bios_name); exit(1); } VAR_4 = (VAR_4 + 0xfff) & ~0xfff; memory_region_add_subregion(sysmem, (uint32_t)(-VAR_4), bios); } else if (!qtest_enabled()) { error_report("Could not load PowerPC BIOS '%s'", bios_name); exit(1); } memory_region_set_readonly(bios, true); } dinfo = drive_get(IF_PFLASH, 0, VAR_8); if (dinfo) { VAR_4 = bdrv_getlength(dinfo->bdrv); VAR_4 = 32 * 1024 * 1024; VAR_9 = (VAR_4 + 65535) >> 16; #ifdef DEBUG_BOARD_INIT printf("Register parallel flash %d size %lx" " at addr " TARGET_FMT_lx " '%s'\n", VAR_8, VAR_4, (target_ulong)0xfc000000, bdrv_get_device_name(dinfo->bdrv)); #endif pflash_cfi02_register(0xfc000000, NULL, "taihu_405ep.flash", VAR_4, dinfo->bdrv, 65536, VAR_9, 1, 4, 0x0001, 0x22DA, 0x0000, 0x0000, 0x555, 0x2AA, 1); VAR_8++; } #ifdef DEBUG_BOARD_INIT printf("%s: register CPLD\n", __func__); #endif taihu_cpld_init(sysmem, 0x50100000); VAR_7 = (VAR_1 != NULL); if (VAR_7) { #ifdef DEBUG_BOARD_INIT printf("%s: load kernel\n", __func__); #endif kernel_base = KERNEL_LOAD_ADDR; VAR_5 = load_image_targphys(VAR_1, kernel_base, ram_size - kernel_base); if (VAR_5 < 0) { fprintf(stderr, "qemu: could not load kernel '%s'\n", VAR_1); exit(1); } if (VAR_2) { initrd_base = INITRD_LOAD_ADDR; VAR_6 = load_image_targphys(VAR_2, initrd_base, ram_size - initrd_base); if (VAR_6 < 0) { fprintf(stderr, "qemu: could not load initial ram disk '%s'\n", VAR_2); exit(1); } } else { initrd_base = 0; VAR_6 = 0; } } else { kernel_base = 0; VAR_5 = 0; initrd_base = 0; VAR_6 = 0; } #ifdef DEBUG_BOARD_INIT printf("%s: Done\n", __func__); #endif }
[ "static void FUNC_0(MachineState *VAR_0)\n{", "ram_addr_t ram_size = VAR_0->ram_size;", "const char *VAR_1 = VAR_0->VAR_1;", "const char *VAR_2 = VAR_0->VAR_2;", "char *VAR_3;", "qemu_irq *pic;", "MemoryRegion *sysmem = get_system_memory();", "MemoryRegion *bios;", "MemoryRegion *ram_memories = g_malloc(2 * sizeof(*ram_memories));", "hwaddr ram_bases[2], ram_sizes[2];", "long VAR_4;", "target_ulong kernel_base, initrd_base;", "long VAR_5, VAR_6;", "int VAR_7;", "int VAR_8, VAR_9;", "DriveInfo *dinfo;", "memory_region_allocate_system_memory(&ram_memories[0], NULL,\n\"taihu_405ep.ram-0\", 0x04000000);", "ram_bases[0] = 0;", "ram_sizes[0] = 0x04000000;", "memory_region_allocate_system_memory(&ram_memories[1], NULL,\n\"taihu_405ep.ram-1\", 0x04000000);", "ram_bases[1] = 0x04000000;", "ram_sizes[1] = 0x04000000;", "ram_size = 0x08000000;", "#ifdef DEBUG_BOARD_INIT\nprintf(\"%s: register cpu\\n\", __func__);", "#endif\nppc405ep_init(sysmem, ram_memories, ram_bases, ram_sizes,\n33333333, &pic, VAR_1 == NULL ? 0 : 1);", "#ifdef DEBUG_BOARD_INIT\nprintf(\"%s: register BIOS\\n\", __func__);", "#endif\nVAR_8 = 0;", "#if defined(USE_FLASH_BIOS)\ndinfo = drive_get(IF_PFLASH, 0, VAR_8);", "if (dinfo) {", "VAR_4 = bdrv_getlength(dinfo->bdrv);", "VAR_9 = (VAR_4 + 65535) >> 16;", "#ifdef DEBUG_BOARD_INIT\nprintf(\"Register parallel flash %d size %lx\"\n\" at addr %lx '%s' %d\\n\",\nVAR_8, VAR_4, -VAR_4,\nbdrv_get_device_name(dinfo->bdrv), VAR_9);", "#endif\npflash_cfi02_register((uint32_t)(-VAR_4),\nNULL, \"taihu_405ep.bios\", VAR_4,\ndinfo->bdrv, 65536, VAR_9, 1,\n4, 0x0001, 0x22DA, 0x0000, 0x0000, 0x555, 0x2AA,\n1);", "VAR_8++;", "} else", "#endif\n{", "#ifdef DEBUG_BOARD_INIT\nprintf(\"Load BIOS from file\\n\");", "#endif\nif (bios_name == NULL)\nbios_name = BIOS_FILENAME;", "bios = g_new(MemoryRegion, 1);", "memory_region_allocate_system_memory(bios, NULL, \"taihu_405ep.bios\",\nBIOS_SIZE);", "VAR_3 = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);", "if (VAR_3) {", "VAR_4 = load_image(VAR_3, memory_region_get_ram_ptr(bios));", "g_free(VAR_3);", "if (VAR_4 < 0 || VAR_4 > BIOS_SIZE) {", "error_report(\"Could not load PowerPC BIOS '%s'\", bios_name);", "exit(1);", "}", "VAR_4 = (VAR_4 + 0xfff) & ~0xfff;", "memory_region_add_subregion(sysmem, (uint32_t)(-VAR_4), bios);", "} else if (!qtest_enabled()) {", "error_report(\"Could not load PowerPC BIOS '%s'\", bios_name);", "exit(1);", "}", "memory_region_set_readonly(bios, true);", "}", "dinfo = drive_get(IF_PFLASH, 0, VAR_8);", "if (dinfo) {", "VAR_4 = bdrv_getlength(dinfo->bdrv);", "VAR_4 = 32 * 1024 * 1024;", "VAR_9 = (VAR_4 + 65535) >> 16;", "#ifdef DEBUG_BOARD_INIT\nprintf(\"Register parallel flash %d size %lx\"\n\" at addr \" TARGET_FMT_lx \" '%s'\\n\",\nVAR_8, VAR_4, (target_ulong)0xfc000000,\nbdrv_get_device_name(dinfo->bdrv));", "#endif\npflash_cfi02_register(0xfc000000, NULL, \"taihu_405ep.flash\", VAR_4,\ndinfo->bdrv, 65536, VAR_9, 1,\n4, 0x0001, 0x22DA, 0x0000, 0x0000, 0x555, 0x2AA,\n1);", "VAR_8++;", "}", "#ifdef DEBUG_BOARD_INIT\nprintf(\"%s: register CPLD\\n\", __func__);", "#endif\ntaihu_cpld_init(sysmem, 0x50100000);", "VAR_7 = (VAR_1 != NULL);", "if (VAR_7) {", "#ifdef DEBUG_BOARD_INIT\nprintf(\"%s: load kernel\\n\", __func__);", "#endif\nkernel_base = KERNEL_LOAD_ADDR;", "VAR_5 = load_image_targphys(VAR_1, kernel_base,\nram_size - kernel_base);", "if (VAR_5 < 0) {", "fprintf(stderr, \"qemu: could not load kernel '%s'\\n\",\nVAR_1);", "exit(1);", "}", "if (VAR_2) {", "initrd_base = INITRD_LOAD_ADDR;", "VAR_6 = load_image_targphys(VAR_2, initrd_base,\nram_size - initrd_base);", "if (VAR_6 < 0) {", "fprintf(stderr,\n\"qemu: could not load initial ram disk '%s'\\n\",\nVAR_2);", "exit(1);", "}", "} else {", "initrd_base = 0;", "VAR_6 = 0;", "}", "} else {", "kernel_base = 0;", "VAR_5 = 0;", "initrd_base = 0;", "VAR_6 = 0;", "}", "#ifdef DEBUG_BOARD_INIT\nprintf(\"%s: Done\\n\", __func__);", "#endif\n}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 47, 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57, 59 ], [ 61, 63, 65 ], [ 69, 71 ], [ 73, 75 ], [ 77, 79 ], [ 81 ], [ 83 ], [ 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 ], [ 171 ], [ 173 ], [ 175 ], [ 179 ], [ 181 ], [ 183, 185, 187, 189, 191 ], [ 193, 195, 197, 199, 201 ], [ 203 ], [ 205 ], [ 209, 211 ], [ 213, 215 ], [ 219 ], [ 221 ], [ 223, 225 ], [ 227, 229 ], [ 233, 235 ], [ 237 ], [ 239, 241 ], [ 243 ], [ 245 ], [ 249 ], [ 251 ], [ 253, 255 ], [ 257 ], [ 259, 261, 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 287 ], [ 289, 291 ], [ 293, 295 ] ]
17,940
static void qmp_input_type_any(Visitor *v, const char *name, QObject **obj, Error **errp) { QmpInputVisitor *qiv = to_qiv(v); QObject *qobj = qmp_input_get_object(qiv, name, true); qobject_incref(qobj); *obj = qobj;
true
qemu
c489780203f9b22aca5539ec7589b7140bdc951f
static void qmp_input_type_any(Visitor *v, const char *name, QObject **obj, Error **errp) { QmpInputVisitor *qiv = to_qiv(v); QObject *qobj = qmp_input_get_object(qiv, name, true); qobject_incref(qobj); *obj = qobj;
{ "code": [], "line_no": [] }
static void FUNC_0(Visitor *VAR_0, const char *VAR_1, QObject **VAR_2, Error **VAR_3) { QmpInputVisitor *qiv = to_qiv(VAR_0); QObject *qobj = qmp_input_get_object(qiv, VAR_1, true); qobject_incref(qobj); *VAR_2 = qobj;
[ "static void FUNC_0(Visitor *VAR_0, const char *VAR_1, QObject **VAR_2,\nError **VAR_3)\n{", "QmpInputVisitor *qiv = to_qiv(VAR_0);", "QObject *qobj = qmp_input_get_object(qiv, VAR_1, true);", "qobject_incref(qobj);", "*VAR_2 = qobj;" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 2, 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ] ]
17,941
PPC_OP(clear_xer_cr) { xer_so = 0; xer_ov = 0; xer_ca = 0; RETURN(); }
true
qemu
e864cabdc0a38bb598ddcf88b264896dc6f3e3b2
PPC_OP(clear_xer_cr) { xer_so = 0; xer_ov = 0; xer_ca = 0; RETURN(); }
{ "code": [ "PPC_OP(clear_xer_cr)" ], "line_no": [ 1 ] }
FUNC_0(VAR_0) { xer_so = 0; xer_ov = 0; xer_ca = 0; RETURN(); }
[ "FUNC_0(VAR_0)\n{", "xer_so = 0;", "xer_ov = 0;", "xer_ca = 0;", "RETURN();", "}" ]
[ 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ] ]
17,942
static void flush_encoders(void) { int i, ret; for (i = 0; i < nb_output_streams; i++) { OutputStream *ost = output_streams[i]; AVCodecContext *enc = ost->enc_ctx; OutputFile *of = output_files[ost->file_index]; if (!ost->encoding_needed) continue; // Try to enable encoding with no input frames. // Maybe we should just let encoding fail instead. if (!ost->initialized) { FilterGraph *fg = ost->filter->graph; char error[1024]; av_log(NULL, AV_LOG_WARNING, "Finishing stream %d:%d without any data written to it.\n", ost->file_index, ost->st->index); if (ost->filter && !fg->graph) { int x; for (x = 0; x < fg->nb_inputs; x++) { InputFilter *ifilter = fg->inputs[x]; if (ifilter->format < 0) { AVCodecParameters *par = ifilter->ist->st->codecpar; // We never got any input. Set a fake format, which will // come from libavformat. ifilter->format = par->format; ifilter->sample_rate = par->sample_rate; ifilter->channels = par->channels; ifilter->channel_layout = par->channel_layout; ifilter->width = par->width; ifilter->height = par->height; ifilter->sample_aspect_ratio = par->sample_aspect_ratio; } } if (!ifilter_has_all_input_formats(fg)) continue; ret = configure_filtergraph(fg); if (ret < 0) { av_log(NULL, AV_LOG_ERROR, "Error configuring filter graph\n"); exit_program(1); } finish_output_stream(ost); } ret = init_output_stream(ost, error, sizeof(error)); if (ret < 0) { av_log(NULL, AV_LOG_ERROR, "Error initializing output stream %d:%d -- %s\n", ost->file_index, ost->index, error); exit_program(1); } } if (enc->codec_type == AVMEDIA_TYPE_AUDIO && enc->frame_size <= 1) continue; #if FF_API_LAVF_FMT_RAWPICTURE if (enc->codec_type == AVMEDIA_TYPE_VIDEO && (of->ctx->oformat->flags & AVFMT_RAWPICTURE) && enc->codec->id == AV_CODEC_ID_RAWVIDEO) continue; #endif if (enc->codec_type != AVMEDIA_TYPE_VIDEO && enc->codec_type != AVMEDIA_TYPE_AUDIO) continue; avcodec_send_frame(enc, NULL); for (;;) { const char *desc = NULL; AVPacket pkt; int pkt_size; switch (enc->codec_type) { case AVMEDIA_TYPE_AUDIO: desc = "audio"; break; case AVMEDIA_TYPE_VIDEO: desc = "video"; break; default: av_assert0(0); } av_init_packet(&pkt); pkt.data = NULL; pkt.size = 0; update_benchmark(NULL); ret = avcodec_receive_packet(enc, &pkt); update_benchmark("flush_%s %d.%d", desc, ost->file_index, ost->index); if (ret < 0 && ret != AVERROR_EOF) { av_log(NULL, AV_LOG_FATAL, "%s encoding failed: %s\n", desc, av_err2str(ret)); exit_program(1); } if (ost->logfile && enc->stats_out) { fprintf(ost->logfile, "%s", enc->stats_out); } if (ret == AVERROR_EOF) { break; } if (ost->finished & MUXER_FINISHED) { av_packet_unref(&pkt); continue; } av_packet_rescale_ts(&pkt, enc->time_base, ost->mux_timebase); pkt_size = pkt.size; output_packet(of, &pkt, ost); if (ost->enc_ctx->codec_type == AVMEDIA_TYPE_VIDEO && vstats_filename) { do_video_stats(ost, pkt_size); } } } }
true
FFmpeg
4b192ffdbe226461d8a07fd36d655ec13b2c7582
static void flush_encoders(void) { int i, ret; for (i = 0; i < nb_output_streams; i++) { OutputStream *ost = output_streams[i]; AVCodecContext *enc = ost->enc_ctx; OutputFile *of = output_files[ost->file_index]; if (!ost->encoding_needed) continue; if (!ost->initialized) { FilterGraph *fg = ost->filter->graph; char error[1024]; av_log(NULL, AV_LOG_WARNING, "Finishing stream %d:%d without any data written to it.\n", ost->file_index, ost->st->index); if (ost->filter && !fg->graph) { int x; for (x = 0; x < fg->nb_inputs; x++) { InputFilter *ifilter = fg->inputs[x]; if (ifilter->format < 0) { AVCodecParameters *par = ifilter->ist->st->codecpar; ifilter->format = par->format; ifilter->sample_rate = par->sample_rate; ifilter->channels = par->channels; ifilter->channel_layout = par->channel_layout; ifilter->width = par->width; ifilter->height = par->height; ifilter->sample_aspect_ratio = par->sample_aspect_ratio; } } if (!ifilter_has_all_input_formats(fg)) continue; ret = configure_filtergraph(fg); if (ret < 0) { av_log(NULL, AV_LOG_ERROR, "Error configuring filter graph\n"); exit_program(1); } finish_output_stream(ost); } ret = init_output_stream(ost, error, sizeof(error)); if (ret < 0) { av_log(NULL, AV_LOG_ERROR, "Error initializing output stream %d:%d -- %s\n", ost->file_index, ost->index, error); exit_program(1); } } if (enc->codec_type == AVMEDIA_TYPE_AUDIO && enc->frame_size <= 1) continue; #if FF_API_LAVF_FMT_RAWPICTURE if (enc->codec_type == AVMEDIA_TYPE_VIDEO && (of->ctx->oformat->flags & AVFMT_RAWPICTURE) && enc->codec->id == AV_CODEC_ID_RAWVIDEO) continue; #endif if (enc->codec_type != AVMEDIA_TYPE_VIDEO && enc->codec_type != AVMEDIA_TYPE_AUDIO) continue; avcodec_send_frame(enc, NULL); for (;;) { const char *desc = NULL; AVPacket pkt; int pkt_size; switch (enc->codec_type) { case AVMEDIA_TYPE_AUDIO: desc = "audio"; break; case AVMEDIA_TYPE_VIDEO: desc = "video"; break; default: av_assert0(0); } av_init_packet(&pkt); pkt.data = NULL; pkt.size = 0; update_benchmark(NULL); ret = avcodec_receive_packet(enc, &pkt); update_benchmark("flush_%s %d.%d", desc, ost->file_index, ost->index); if (ret < 0 && ret != AVERROR_EOF) { av_log(NULL, AV_LOG_FATAL, "%s encoding failed: %s\n", desc, av_err2str(ret)); exit_program(1); } if (ost->logfile && enc->stats_out) { fprintf(ost->logfile, "%s", enc->stats_out); } if (ret == AVERROR_EOF) { break; } if (ost->finished & MUXER_FINISHED) { av_packet_unref(&pkt); continue; } av_packet_rescale_ts(&pkt, enc->time_base, ost->mux_timebase); pkt_size = pkt.size; output_packet(of, &pkt, ost); if (ost->enc_ctx->codec_type == AVMEDIA_TYPE_VIDEO && vstats_filename) { do_video_stats(ost, pkt_size); } } } }
{ "code": [ " char error[1024];", " char error[1024];" ], "line_no": [ 33, 33 ] }
static void FUNC_0(void) { int VAR_0, VAR_1; for (VAR_0 = 0; VAR_0 < nb_output_streams; VAR_0++) { OutputStream *ost = output_streams[VAR_0]; AVCodecContext *enc = ost->enc_ctx; OutputFile *of = output_files[ost->file_index]; if (!ost->encoding_needed) continue; if (!ost->initialized) { FilterGraph *fg = ost->filter->graph; char error[1024]; av_log(NULL, AV_LOG_WARNING, "Finishing stream %d:%d without any data written to it.\n", ost->file_index, ost->st->index); if (ost->filter && !fg->graph) { int x; for (x = 0; x < fg->nb_inputs; x++) { InputFilter *ifilter = fg->inputs[x]; if (ifilter->format < 0) { AVCodecParameters *par = ifilter->ist->st->codecpar; ifilter->format = par->format; ifilter->sample_rate = par->sample_rate; ifilter->channels = par->channels; ifilter->channel_layout = par->channel_layout; ifilter->width = par->width; ifilter->height = par->height; ifilter->sample_aspect_ratio = par->sample_aspect_ratio; } } if (!ifilter_has_all_input_formats(fg)) continue; VAR_1 = configure_filtergraph(fg); if (VAR_1 < 0) { av_log(NULL, AV_LOG_ERROR, "Error configuring filter graph\n"); exit_program(1); } finish_output_stream(ost); } VAR_1 = init_output_stream(ost, error, sizeof(error)); if (VAR_1 < 0) { av_log(NULL, AV_LOG_ERROR, "Error initializing output stream %d:%d -- %s\n", ost->file_index, ost->index, error); exit_program(1); } } if (enc->codec_type == AVMEDIA_TYPE_AUDIO && enc->frame_size <= 1) continue; #if FF_API_LAVF_FMT_RAWPICTURE if (enc->codec_type == AVMEDIA_TYPE_VIDEO && (of->ctx->oformat->flags & AVFMT_RAWPICTURE) && enc->codec->id == AV_CODEC_ID_RAWVIDEO) continue; #endif if (enc->codec_type != AVMEDIA_TYPE_VIDEO && enc->codec_type != AVMEDIA_TYPE_AUDIO) continue; avcodec_send_frame(enc, NULL); for (;;) { const char *desc = NULL; AVPacket pkt; int pkt_size; switch (enc->codec_type) { case AVMEDIA_TYPE_AUDIO: desc = "audio"; break; case AVMEDIA_TYPE_VIDEO: desc = "video"; break; default: av_assert0(0); } av_init_packet(&pkt); pkt.data = NULL; pkt.size = 0; update_benchmark(NULL); VAR_1 = avcodec_receive_packet(enc, &pkt); update_benchmark("flush_%s %d.%d", desc, ost->file_index, ost->index); if (VAR_1 < 0 && VAR_1 != AVERROR_EOF) { av_log(NULL, AV_LOG_FATAL, "%s encoding failed: %s\n", desc, av_err2str(VAR_1)); exit_program(1); } if (ost->logfile && enc->stats_out) { fprintf(ost->logfile, "%s", enc->stats_out); } if (VAR_1 == AVERROR_EOF) { break; } if (ost->finished & MUXER_FINISHED) { av_packet_unref(&pkt); continue; } av_packet_rescale_ts(&pkt, enc->time_base, ost->mux_timebase); pkt_size = pkt.size; output_packet(of, &pkt, ost); if (ost->enc_ctx->codec_type == AVMEDIA_TYPE_VIDEO && vstats_filename) { do_video_stats(ost, pkt_size); } } } }
[ "static void FUNC_0(void)\n{", "int VAR_0, VAR_1;", "for (VAR_0 = 0; VAR_0 < nb_output_streams; VAR_0++) {", "OutputStream *ost = output_streams[VAR_0];", "AVCodecContext *enc = ost->enc_ctx;", "OutputFile *of = output_files[ost->file_index];", "if (!ost->encoding_needed)\ncontinue;", "if (!ost->initialized) {", "FilterGraph *fg = ost->filter->graph;", "char error[1024];", "av_log(NULL, AV_LOG_WARNING,\n\"Finishing stream %d:%d without any data written to it.\\n\",\nost->file_index, ost->st->index);", "if (ost->filter && !fg->graph) {", "int x;", "for (x = 0; x < fg->nb_inputs; x++) {", "InputFilter *ifilter = fg->inputs[x];", "if (ifilter->format < 0) {", "AVCodecParameters *par = ifilter->ist->st->codecpar;", "ifilter->format = par->format;", "ifilter->sample_rate = par->sample_rate;", "ifilter->channels = par->channels;", "ifilter->channel_layout = par->channel_layout;", "ifilter->width = par->width;", "ifilter->height = par->height;", "ifilter->sample_aspect_ratio = par->sample_aspect_ratio;", "}", "}", "if (!ifilter_has_all_input_formats(fg))\ncontinue;", "VAR_1 = configure_filtergraph(fg);", "if (VAR_1 < 0) {", "av_log(NULL, AV_LOG_ERROR, \"Error configuring filter graph\\n\");", "exit_program(1);", "}", "finish_output_stream(ost);", "}", "VAR_1 = init_output_stream(ost, error, sizeof(error));", "if (VAR_1 < 0) {", "av_log(NULL, AV_LOG_ERROR, \"Error initializing output stream %d:%d -- %s\\n\",\nost->file_index, ost->index, error);", "exit_program(1);", "}", "}", "if (enc->codec_type == AVMEDIA_TYPE_AUDIO && enc->frame_size <= 1)\ncontinue;", "#if FF_API_LAVF_FMT_RAWPICTURE\nif (enc->codec_type == AVMEDIA_TYPE_VIDEO && (of->ctx->oformat->flags & AVFMT_RAWPICTURE) && enc->codec->id == AV_CODEC_ID_RAWVIDEO)\ncontinue;", "#endif\nif (enc->codec_type != AVMEDIA_TYPE_VIDEO && enc->codec_type != AVMEDIA_TYPE_AUDIO)\ncontinue;", "avcodec_send_frame(enc, NULL);", "for (;;) {", "const char *desc = NULL;", "AVPacket pkt;", "int pkt_size;", "switch (enc->codec_type) {", "case AVMEDIA_TYPE_AUDIO:\ndesc = \"audio\";", "break;", "case AVMEDIA_TYPE_VIDEO:\ndesc = \"video\";", "break;", "default:\nav_assert0(0);", "}", "av_init_packet(&pkt);", "pkt.data = NULL;", "pkt.size = 0;", "update_benchmark(NULL);", "VAR_1 = avcodec_receive_packet(enc, &pkt);", "update_benchmark(\"flush_%s %d.%d\", desc, ost->file_index, ost->index);", "if (VAR_1 < 0 && VAR_1 != AVERROR_EOF) {", "av_log(NULL, AV_LOG_FATAL, \"%s encoding failed: %s\\n\",\ndesc,\nav_err2str(VAR_1));", "exit_program(1);", "}", "if (ost->logfile && enc->stats_out) {", "fprintf(ost->logfile, \"%s\", enc->stats_out);", "}", "if (VAR_1 == AVERROR_EOF) {", "break;", "}", "if (ost->finished & MUXER_FINISHED) {", "av_packet_unref(&pkt);", "continue;", "}", "av_packet_rescale_ts(&pkt, enc->time_base, ost->mux_timebase);", "pkt_size = pkt.size;", "output_packet(of, &pkt, ost);", "if (ost->enc_ctx->codec_type == AVMEDIA_TYPE_VIDEO && vstats_filename) {", "do_video_stats(ost, pkt_size);", "}", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19, 21 ], [ 29 ], [ 31 ], [ 33 ], [ 37, 39, 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81, 83 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99 ], [ 101 ], [ 105 ], [ 107 ], [ 109, 111 ], [ 113 ], [ 115 ], [ 117 ], [ 121, 123 ], [ 125, 127, 129 ], [ 131, 135, 137 ], [ 141 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 155 ], [ 157, 159 ], [ 161 ], [ 163, 165 ], [ 167 ], [ 169, 171 ], [ 173 ], [ 177 ], [ 179 ], [ 181 ], [ 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 ] ]
17,944
int fw_cfg_add_i32(FWCfgState *s, uint16_t key, uint32_t value) { uint32_t *copy; copy = g_malloc(sizeof(value)); *copy = cpu_to_le32(value); return fw_cfg_add_bytes(s, key, (uint8_t *)copy, sizeof(value)); }
true
qemu
4cad3867b6df2c0826ae508a9fe15dd0b9d8936a
int fw_cfg_add_i32(FWCfgState *s, uint16_t key, uint32_t value) { uint32_t *copy; copy = g_malloc(sizeof(value)); *copy = cpu_to_le32(value); return fw_cfg_add_bytes(s, key, (uint8_t *)copy, sizeof(value)); }
{ "code": [ " return fw_cfg_add_bytes(s, key, (uint8_t *)copy, sizeof(value));", "int fw_cfg_add_i32(FWCfgState *s, uint16_t key, uint32_t value)", " return fw_cfg_add_bytes(s, key, (uint8_t *)copy, sizeof(value));", " return fw_cfg_add_bytes(s, key, (uint8_t *)copy, sizeof(value));" ], "line_no": [ 13, 1, 13, 13 ] }
int FUNC_0(FWCfgState *VAR_0, uint16_t VAR_1, uint32_t VAR_2) { uint32_t *copy; copy = g_malloc(sizeof(VAR_2)); *copy = cpu_to_le32(VAR_2); return fw_cfg_add_bytes(VAR_0, VAR_1, (uint8_t *)copy, sizeof(VAR_2)); }
[ "int FUNC_0(FWCfgState *VAR_0, uint16_t VAR_1, uint32_t VAR_2)\n{", "uint32_t *copy;", "copy = g_malloc(sizeof(VAR_2));", "*copy = cpu_to_le32(VAR_2);", "return fw_cfg_add_bytes(VAR_0, VAR_1, (uint8_t *)copy, sizeof(VAR_2));", "}" ]
[ 1, 0, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ] ]
17,945
static void use_normal_update_speed(WmallDecodeCtx *s, int ich) { int ilms, recent, icoef; s->update_speed[ich] = 8; for (ilms = s->cdlms_ttl[ich]; ilms >= 0; ilms--) { recent = s->cdlms[ich][ilms].recent; if (s->bV3RTM) { for (icoef = 0; icoef < s->cdlms[ich][ilms].order; icoef++) s->cdlms[ich][ilms].lms_updates[icoef + recent] /= 2; } else { for (icoef = 0; icoef < s->cdlms[ich][ilms].order; icoef++) s->cdlms[ich][ilms].lms_updates[icoef] /= 2; } } }
true
FFmpeg
6cf31ef263d36f6b89d9b64f15ca81cef4f24901
static void use_normal_update_speed(WmallDecodeCtx *s, int ich) { int ilms, recent, icoef; s->update_speed[ich] = 8; for (ilms = s->cdlms_ttl[ich]; ilms >= 0; ilms--) { recent = s->cdlms[ich][ilms].recent; if (s->bV3RTM) { for (icoef = 0; icoef < s->cdlms[ich][ilms].order; icoef++) s->cdlms[ich][ilms].lms_updates[icoef + recent] /= 2; } else { for (icoef = 0; icoef < s->cdlms[ich][ilms].order; icoef++) s->cdlms[ich][ilms].lms_updates[icoef] /= 2; } } }
{ "code": [ " for (ilms = s->cdlms_ttl[ich]; ilms >= 0; ilms--) {", " for (ilms = s->cdlms_ttl[ich]; ilms >= 0; ilms--) {" ], "line_no": [ 9, 9 ] }
static void FUNC_0(WmallDecodeCtx *VAR_0, int VAR_1) { int VAR_2, VAR_3, VAR_4; VAR_0->update_speed[VAR_1] = 8; for (VAR_2 = VAR_0->cdlms_ttl[VAR_1]; VAR_2 >= 0; VAR_2--) { VAR_3 = VAR_0->cdlms[VAR_1][VAR_2].VAR_3; if (VAR_0->bV3RTM) { for (VAR_4 = 0; VAR_4 < VAR_0->cdlms[VAR_1][VAR_2].order; VAR_4++) VAR_0->cdlms[VAR_1][VAR_2].lms_updates[VAR_4 + VAR_3] /= 2; } else { for (VAR_4 = 0; VAR_4 < VAR_0->cdlms[VAR_1][VAR_2].order; VAR_4++) VAR_0->cdlms[VAR_1][VAR_2].lms_updates[VAR_4] /= 2; } } }
[ "static void FUNC_0(WmallDecodeCtx *VAR_0, int VAR_1)\n{", "int VAR_2, VAR_3, VAR_4;", "VAR_0->update_speed[VAR_1] = 8;", "for (VAR_2 = VAR_0->cdlms_ttl[VAR_1]; VAR_2 >= 0; VAR_2--) {", "VAR_3 = VAR_0->cdlms[VAR_1][VAR_2].VAR_3;", "if (VAR_0->bV3RTM) {", "for (VAR_4 = 0; VAR_4 < VAR_0->cdlms[VAR_1][VAR_2].order; VAR_4++)", "VAR_0->cdlms[VAR_1][VAR_2].lms_updates[VAR_4 + VAR_3] /= 2;", "} else {", "for (VAR_4 = 0; VAR_4 < VAR_0->cdlms[VAR_1][VAR_2].order; VAR_4++)", "VAR_0->cdlms[VAR_1][VAR_2].lms_updates[VAR_4] /= 2;", "}", "}", "}" ]
[ 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 ], [ 25 ], [ 27 ], [ 29 ] ]
17,946
static int ram_save_target_page(RAMState *rs, PageSearchStatus *pss, bool last_stage, ram_addr_t dirty_ram_abs) { int res = 0; /* Check the pages is dirty and if it is send it */ if (migration_bitmap_clear_dirty(rs, dirty_ram_abs)) { unsigned long *unsentmap; /* * If xbzrle is on, stop using the data compression after first * round of migration even if compression is enabled. In theory, * xbzrle can do better than compression. */ if (migrate_use_compression() && (rs->ram_bulk_stage || !migrate_use_xbzrle())) { res = ram_save_compressed_page(rs, pss, last_stage); } else { res = ram_save_page(rs, pss, last_stage); } if (res < 0) { return res; } unsentmap = atomic_rcu_read(&rs->ram_bitmap)->unsentmap; if (unsentmap) { clear_bit(dirty_ram_abs >> TARGET_PAGE_BITS, unsentmap); } } return res; }
true
qemu
06b106889a09277617fc8c542397a9f595ee605a
static int ram_save_target_page(RAMState *rs, PageSearchStatus *pss, bool last_stage, ram_addr_t dirty_ram_abs) { int res = 0; if (migration_bitmap_clear_dirty(rs, dirty_ram_abs)) { unsigned long *unsentmap; if (migrate_use_compression() && (rs->ram_bulk_stage || !migrate_use_xbzrle())) { res = ram_save_compressed_page(rs, pss, last_stage); } else { res = ram_save_page(rs, pss, last_stage); } if (res < 0) { return res; } unsentmap = atomic_rcu_read(&rs->ram_bitmap)->unsentmap; if (unsentmap) { clear_bit(dirty_ram_abs >> TARGET_PAGE_BITS, unsentmap); } } return res; }
{ "code": [ " bool last_stage, ram_addr_t dirty_ram_abs)", " if (migration_bitmap_clear_dirty(rs, dirty_ram_abs)) {", " clear_bit(dirty_ram_abs >> TARGET_PAGE_BITS, unsentmap);" ], "line_no": [ 3, 13, 53 ] }
static int FUNC_0(RAMState *VAR_0, PageSearchStatus *VAR_1, bool VAR_2, ram_addr_t VAR_3) { int VAR_4 = 0; if (migration_bitmap_clear_dirty(VAR_0, VAR_3)) { unsigned long *VAR_5; if (migrate_use_compression() && (VAR_0->ram_bulk_stage || !migrate_use_xbzrle())) { VAR_4 = ram_save_compressed_page(VAR_0, VAR_1, VAR_2); } else { VAR_4 = ram_save_page(VAR_0, VAR_1, VAR_2); } if (VAR_4 < 0) { return VAR_4; } VAR_5 = atomic_rcu_read(&VAR_0->ram_bitmap)->VAR_5; if (VAR_5) { clear_bit(VAR_3 >> TARGET_PAGE_BITS, VAR_5); } } return VAR_4; }
[ "static int FUNC_0(RAMState *VAR_0, PageSearchStatus *VAR_1,\nbool VAR_2, ram_addr_t VAR_3)\n{", "int VAR_4 = 0;", "if (migration_bitmap_clear_dirty(VAR_0, VAR_3)) {", "unsigned long *VAR_5;", "if (migrate_use_compression()\n&& (VAR_0->ram_bulk_stage || !migrate_use_xbzrle())) {", "VAR_4 = ram_save_compressed_page(VAR_0, VAR_1, VAR_2);", "} else {", "VAR_4 = ram_save_page(VAR_0, VAR_1, VAR_2);", "}", "if (VAR_4 < 0) {", "return VAR_4;", "}", "VAR_5 = atomic_rcu_read(&VAR_0->ram_bitmap)->VAR_5;", "if (VAR_5) {", "clear_bit(VAR_3 >> TARGET_PAGE_BITS, VAR_5);", "}", "}", "return VAR_4;", "}" ]
[ 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 13 ], [ 15 ], [ 29, 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ] ]
17,947
static int vmdk_parent_open(BlockDriverState *bs, const char * filename) { BDRVVmdkState *s = bs->opaque; char *p_name; char desc[DESC_SIZE]; char parent_img_name[1024]; /* the descriptor offset = 0x200 */ if (bdrv_pread(s->hd, 0x200, desc, DESC_SIZE) != DESC_SIZE) return -1; if ((p_name = strstr(desc,"parentFileNameHint")) != 0) { char *end_name; struct stat file_buf; p_name += sizeof("parentFileNameHint") + 1; if ((end_name = strchr(p_name,'\"')) == 0) return -1; strncpy(s->hd->backing_file, p_name, end_name - p_name); if (stat(s->hd->backing_file, &file_buf) != 0) { path_combine(parent_img_name, sizeof(parent_img_name), filename, s->hd->backing_file); } else { strcpy(parent_img_name, s->hd->backing_file); } s->hd->backing_hd = bdrv_new(""); if (!s->hd->backing_hd) { failure: bdrv_close(s->hd); return -1; } if (bdrv_open(s->hd->backing_hd, parent_img_name, 0) < 0) goto failure; } return 0; }
true
qemu
630530a6529bc3da9ab8aead7053dc753cb9ac77
static int vmdk_parent_open(BlockDriverState *bs, const char * filename) { BDRVVmdkState *s = bs->opaque; char *p_name; char desc[DESC_SIZE]; char parent_img_name[1024]; if (bdrv_pread(s->hd, 0x200, desc, DESC_SIZE) != DESC_SIZE) return -1; if ((p_name = strstr(desc,"parentFileNameHint")) != 0) { char *end_name; struct stat file_buf; p_name += sizeof("parentFileNameHint") + 1; if ((end_name = strchr(p_name,'\"')) == 0) return -1; strncpy(s->hd->backing_file, p_name, end_name - p_name); if (stat(s->hd->backing_file, &file_buf) != 0) { path_combine(parent_img_name, sizeof(parent_img_name), filename, s->hd->backing_file); } else { strcpy(parent_img_name, s->hd->backing_file); } s->hd->backing_hd = bdrv_new(""); if (!s->hd->backing_hd) { failure: bdrv_close(s->hd); return -1; } if (bdrv_open(s->hd->backing_hd, parent_img_name, 0) < 0) goto failure; } return 0; }
{ "code": [ " if (bdrv_open(s->hd->backing_hd, parent_img_name, 0) < 0)", " return -1;" ], "line_no": [ 67, 35 ] }
static int FUNC_0(BlockDriverState *VAR_0, const char * VAR_1) { BDRVVmdkState *s = VAR_0->opaque; char *VAR_2; char VAR_3[DESC_SIZE]; char VAR_4[1024]; if (bdrv_pread(s->hd, 0x200, VAR_3, DESC_SIZE) != DESC_SIZE) return -1; if ((VAR_2 = strstr(VAR_3,"parentFileNameHint")) != 0) { char *VAR_5; struct stat VAR_6; VAR_2 += sizeof("parentFileNameHint") + 1; if ((VAR_5 = strchr(VAR_2,'\"')) == 0) return -1; strncpy(s->hd->backing_file, VAR_2, VAR_5 - VAR_2); if (stat(s->hd->backing_file, &VAR_6) != 0) { path_combine(VAR_4, sizeof(VAR_4), VAR_1, s->hd->backing_file); } else { strcpy(VAR_4, s->hd->backing_file); } s->hd->backing_hd = bdrv_new(""); if (!s->hd->backing_hd) { failure: bdrv_close(s->hd); return -1; } if (bdrv_open(s->hd->backing_hd, VAR_4, 0) < 0) goto failure; } return 0; }
[ "static int FUNC_0(BlockDriverState *VAR_0, const char * VAR_1)\n{", "BDRVVmdkState *s = VAR_0->opaque;", "char *VAR_2;", "char VAR_3[DESC_SIZE];", "char VAR_4[1024];", "if (bdrv_pread(s->hd, 0x200, VAR_3, DESC_SIZE) != DESC_SIZE)\nreturn -1;", "if ((VAR_2 = strstr(VAR_3,\"parentFileNameHint\")) != 0) {", "char *VAR_5;", "struct stat VAR_6;", "VAR_2 += sizeof(\"parentFileNameHint\") + 1;", "if ((VAR_5 = strchr(VAR_2,'\\\"')) == 0)\nreturn -1;", "strncpy(s->hd->backing_file, VAR_2, VAR_5 - VAR_2);", "if (stat(s->hd->backing_file, &VAR_6) != 0) {", "path_combine(VAR_4, sizeof(VAR_4),\nVAR_1, s->hd->backing_file);", "} else {", "strcpy(VAR_4, s->hd->backing_file);", "}", "s->hd->backing_hd = bdrv_new(\"\");", "if (!s->hd->backing_hd) {", "failure:\nbdrv_close(s->hd);", "return -1;", "}", "if (bdrv_open(s->hd->backing_hd, VAR_4, 0) < 0)\ngoto failure;", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 17, 19 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33, 35 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59, 61 ], [ 63 ], [ 65 ], [ 67, 69 ], [ 71 ], [ 75 ], [ 77 ] ]
17,948
static int sd_snapshot_list(BlockDriverState *bs, QEMUSnapshotInfo **psn_tab) { Error *local_err = NULL; BDRVSheepdogState *s = bs->opaque; SheepdogReq req; int fd, nr = 1024, ret, max = BITS_TO_LONGS(SD_NR_VDIS) * sizeof(long); QEMUSnapshotInfo *sn_tab = NULL; unsigned wlen, rlen; int found = 0; static SheepdogInode inode; unsigned long *vdi_inuse; unsigned int start_nr; uint64_t hval; uint32_t vid; vdi_inuse = g_malloc(max); fd = connect_to_sdog(s, &local_err); if (fd < 0) { error_report("%s", error_get_pretty(local_err));; error_free(local_err); ret = fd; goto out; } rlen = max; wlen = 0; memset(&req, 0, sizeof(req)); req.opcode = SD_OP_READ_VDIS; req.data_length = max; ret = do_req(fd, s->aio_context, (SheepdogReq *)&req, vdi_inuse, &wlen, &rlen); closesocket(fd); if (ret) { goto out; } sn_tab = g_malloc0(nr * sizeof(*sn_tab)); /* calculate a vdi id with hash function */ hval = fnv_64a_buf(s->name, strlen(s->name), FNV1A_64_INIT); start_nr = hval & (SD_NR_VDIS - 1); fd = connect_to_sdog(s, &local_err); if (fd < 0) { error_report("%s", error_get_pretty(local_err));; error_free(local_err); ret = fd; goto out; } for (vid = start_nr; found < nr; vid = (vid + 1) % SD_NR_VDIS) { if (!test_bit(vid, vdi_inuse)) { break; } /* we don't need to read entire object */ ret = read_object(fd, s->aio_context, (char *)&inode, vid_to_vdi_oid(vid), 0, SD_INODE_SIZE - sizeof(inode.data_vdi_id), 0, s->cache_flags); if (ret) { continue; } if (!strcmp(inode.name, s->name) && is_snapshot(&inode)) { sn_tab[found].date_sec = inode.snap_ctime >> 32; sn_tab[found].date_nsec = inode.snap_ctime & 0xffffffff; sn_tab[found].vm_state_size = inode.vm_state_size; sn_tab[found].vm_clock_nsec = inode.vm_clock_nsec; snprintf(sn_tab[found].id_str, sizeof(sn_tab[found].id_str), "%" PRIu32, inode.snap_id); pstrcpy(sn_tab[found].name, MIN(sizeof(sn_tab[found].name), sizeof(inode.tag)), inode.tag); found++; } } closesocket(fd); out: *psn_tab = sn_tab; g_free(vdi_inuse); if (ret < 0) { return ret; } return found; }
true
qemu
02c4f26b1517d9e403ec10d6f6ca3c0276d19e43
static int sd_snapshot_list(BlockDriverState *bs, QEMUSnapshotInfo **psn_tab) { Error *local_err = NULL; BDRVSheepdogState *s = bs->opaque; SheepdogReq req; int fd, nr = 1024, ret, max = BITS_TO_LONGS(SD_NR_VDIS) * sizeof(long); QEMUSnapshotInfo *sn_tab = NULL; unsigned wlen, rlen; int found = 0; static SheepdogInode inode; unsigned long *vdi_inuse; unsigned int start_nr; uint64_t hval; uint32_t vid; vdi_inuse = g_malloc(max); fd = connect_to_sdog(s, &local_err); if (fd < 0) { error_report("%s", error_get_pretty(local_err));; error_free(local_err); ret = fd; goto out; } rlen = max; wlen = 0; memset(&req, 0, sizeof(req)); req.opcode = SD_OP_READ_VDIS; req.data_length = max; ret = do_req(fd, s->aio_context, (SheepdogReq *)&req, vdi_inuse, &wlen, &rlen); closesocket(fd); if (ret) { goto out; } sn_tab = g_malloc0(nr * sizeof(*sn_tab)); hval = fnv_64a_buf(s->name, strlen(s->name), FNV1A_64_INIT); start_nr = hval & (SD_NR_VDIS - 1); fd = connect_to_sdog(s, &local_err); if (fd < 0) { error_report("%s", error_get_pretty(local_err));; error_free(local_err); ret = fd; goto out; } for (vid = start_nr; found < nr; vid = (vid + 1) % SD_NR_VDIS) { if (!test_bit(vid, vdi_inuse)) { break; } ret = read_object(fd, s->aio_context, (char *)&inode, vid_to_vdi_oid(vid), 0, SD_INODE_SIZE - sizeof(inode.data_vdi_id), 0, s->cache_flags); if (ret) { continue; } if (!strcmp(inode.name, s->name) && is_snapshot(&inode)) { sn_tab[found].date_sec = inode.snap_ctime >> 32; sn_tab[found].date_nsec = inode.snap_ctime & 0xffffffff; sn_tab[found].vm_state_size = inode.vm_state_size; sn_tab[found].vm_clock_nsec = inode.vm_clock_nsec; snprintf(sn_tab[found].id_str, sizeof(sn_tab[found].id_str), "%" PRIu32, inode.snap_id); pstrcpy(sn_tab[found].name, MIN(sizeof(sn_tab[found].name), sizeof(inode.tag)), inode.tag); found++; } } closesocket(fd); out: *psn_tab = sn_tab; g_free(vdi_inuse); if (ret < 0) { return ret; } return found; }
{ "code": [ " sn_tab = g_malloc0(nr * sizeof(*sn_tab));" ], "line_no": [ 83 ] }
static int FUNC_0(BlockDriverState *VAR_0, QEMUSnapshotInfo **VAR_1) { Error *local_err = NULL; BDRVSheepdogState *s = VAR_0->opaque; SheepdogReq req; int VAR_2, VAR_3 = 1024, VAR_4, VAR_5 = BITS_TO_LONGS(SD_NR_VDIS) * sizeof(long); QEMUSnapshotInfo *sn_tab = NULL; unsigned VAR_6, VAR_7; int VAR_8 = 0; static SheepdogInode VAR_9; unsigned long *VAR_10; unsigned int VAR_11; uint64_t hval; uint32_t vid; VAR_10 = g_malloc(VAR_5); VAR_2 = connect_to_sdog(s, &local_err); if (VAR_2 < 0) { error_report("%s", error_get_pretty(local_err));; error_free(local_err); VAR_4 = VAR_2; goto out; } VAR_7 = VAR_5; VAR_6 = 0; memset(&req, 0, sizeof(req)); req.opcode = SD_OP_READ_VDIS; req.data_length = VAR_5; VAR_4 = do_req(VAR_2, s->aio_context, (SheepdogReq *)&req, VAR_10, &VAR_6, &VAR_7); closesocket(VAR_2); if (VAR_4) { goto out; } sn_tab = g_malloc0(VAR_3 * sizeof(*sn_tab)); hval = fnv_64a_buf(s->name, strlen(s->name), FNV1A_64_INIT); VAR_11 = hval & (SD_NR_VDIS - 1); VAR_2 = connect_to_sdog(s, &local_err); if (VAR_2 < 0) { error_report("%s", error_get_pretty(local_err));; error_free(local_err); VAR_4 = VAR_2; goto out; } for (vid = VAR_11; VAR_8 < VAR_3; vid = (vid + 1) % SD_NR_VDIS) { if (!test_bit(vid, VAR_10)) { break; } VAR_4 = read_object(VAR_2, s->aio_context, (char *)&VAR_9, vid_to_vdi_oid(vid), 0, SD_INODE_SIZE - sizeof(VAR_9.data_vdi_id), 0, s->cache_flags); if (VAR_4) { continue; } if (!strcmp(VAR_9.name, s->name) && is_snapshot(&VAR_9)) { sn_tab[VAR_8].date_sec = VAR_9.snap_ctime >> 32; sn_tab[VAR_8].date_nsec = VAR_9.snap_ctime & 0xffffffff; sn_tab[VAR_8].vm_state_size = VAR_9.vm_state_size; sn_tab[VAR_8].vm_clock_nsec = VAR_9.vm_clock_nsec; snprintf(sn_tab[VAR_8].id_str, sizeof(sn_tab[VAR_8].id_str), "%" PRIu32, VAR_9.snap_id); pstrcpy(sn_tab[VAR_8].name, MIN(sizeof(sn_tab[VAR_8].name), sizeof(VAR_9.tag)), VAR_9.tag); VAR_8++; } } closesocket(VAR_2); out: *VAR_1 = sn_tab; g_free(VAR_10); if (VAR_4 < 0) { return VAR_4; } return VAR_8; }
[ "static int FUNC_0(BlockDriverState *VAR_0, QEMUSnapshotInfo **VAR_1)\n{", "Error *local_err = NULL;", "BDRVSheepdogState *s = VAR_0->opaque;", "SheepdogReq req;", "int VAR_2, VAR_3 = 1024, VAR_4, VAR_5 = BITS_TO_LONGS(SD_NR_VDIS) * sizeof(long);", "QEMUSnapshotInfo *sn_tab = NULL;", "unsigned VAR_6, VAR_7;", "int VAR_8 = 0;", "static SheepdogInode VAR_9;", "unsigned long *VAR_10;", "unsigned int VAR_11;", "uint64_t hval;", "uint32_t vid;", "VAR_10 = g_malloc(VAR_5);", "VAR_2 = connect_to_sdog(s, &local_err);", "if (VAR_2 < 0) {", "error_report(\"%s\", error_get_pretty(local_err));;", "error_free(local_err);", "VAR_4 = VAR_2;", "goto out;", "}", "VAR_7 = VAR_5;", "VAR_6 = 0;", "memset(&req, 0, sizeof(req));", "req.opcode = SD_OP_READ_VDIS;", "req.data_length = VAR_5;", "VAR_4 = do_req(VAR_2, s->aio_context, (SheepdogReq *)&req,\nVAR_10, &VAR_6, &VAR_7);", "closesocket(VAR_2);", "if (VAR_4) {", "goto out;", "}", "sn_tab = g_malloc0(VAR_3 * sizeof(*sn_tab));", "hval = fnv_64a_buf(s->name, strlen(s->name), FNV1A_64_INIT);", "VAR_11 = hval & (SD_NR_VDIS - 1);", "VAR_2 = connect_to_sdog(s, &local_err);", "if (VAR_2 < 0) {", "error_report(\"%s\", error_get_pretty(local_err));;", "error_free(local_err);", "VAR_4 = VAR_2;", "goto out;", "}", "for (vid = VAR_11; VAR_8 < VAR_3; vid = (vid + 1) % SD_NR_VDIS) {", "if (!test_bit(vid, VAR_10)) {", "break;", "}", "VAR_4 = read_object(VAR_2, s->aio_context, (char *)&VAR_9,\nvid_to_vdi_oid(vid),\n0, SD_INODE_SIZE - sizeof(VAR_9.data_vdi_id), 0,\ns->cache_flags);", "if (VAR_4) {", "continue;", "}", "if (!strcmp(VAR_9.name, s->name) && is_snapshot(&VAR_9)) {", "sn_tab[VAR_8].date_sec = VAR_9.snap_ctime >> 32;", "sn_tab[VAR_8].date_nsec = VAR_9.snap_ctime & 0xffffffff;", "sn_tab[VAR_8].vm_state_size = VAR_9.vm_state_size;", "sn_tab[VAR_8].vm_clock_nsec = VAR_9.vm_clock_nsec;", "snprintf(sn_tab[VAR_8].id_str, sizeof(sn_tab[VAR_8].id_str),\n\"%\" PRIu32, VAR_9.snap_id);", "pstrcpy(sn_tab[VAR_8].name,\nMIN(sizeof(sn_tab[VAR_8].name), sizeof(VAR_9.tag)),\nVAR_9.tag);", "VAR_8++;", "}", "}", "closesocket(VAR_2);", "out:\n*VAR_1 = sn_tab;", "g_free(VAR_10);", "if (VAR_4 < 0) {", "return VAR_4;", "}", "return VAR_8;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 57 ], [ 61 ], [ 63 ], [ 67, 69 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 89 ], [ 91 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 123, 125, 127, 129 ], [ 133 ], [ 135 ], [ 137 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 153, 155 ], [ 157, 159, 161 ], [ 163 ], [ 165 ], [ 167 ], [ 171 ], [ 173, 175 ], [ 179 ], [ 183 ], [ 185 ], [ 187 ], [ 191 ], [ 193 ] ]
17,949
static void config_parse(GAConfig *config, int argc, char **argv) { const char *sopt = "hVvdm:p:l:f:F::b:s:t:D"; int opt_ind = 0, ch; const struct option lopt[] = { { "help", 0, NULL, 'h' }, { "version", 0, NULL, 'V' }, { "dump-conf", 0, NULL, 'D' }, { "logfile", 1, NULL, 'l' }, { "pidfile", 1, NULL, 'f' }, #ifdef CONFIG_FSFREEZE { "fsfreeze-hook", 2, NULL, 'F' }, #endif { "verbose", 0, NULL, 'v' }, { "method", 1, NULL, 'm' }, { "path", 1, NULL, 'p' }, { "daemonize", 0, NULL, 'd' }, { "blacklist", 1, NULL, 'b' }, #ifdef _WIN32 { "service", 1, NULL, 's' }, #endif { "statedir", 1, NULL, 't' }, { NULL, 0, NULL, 0 } }; config->log_level = G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL; while ((ch = getopt_long(argc, argv, sopt, lopt, &opt_ind)) != -1) { switch (ch) { case 'm': g_free(config->method); config->method = g_strdup(optarg); break; case 'p': g_free(config->channel_path); config->channel_path = g_strdup(optarg); break; case 'l': g_free(config->log_filepath); config->log_filepath = g_strdup(optarg); break; case 'f': g_free(config->pid_filepath); config->pid_filepath = g_strdup(optarg); break; #ifdef CONFIG_FSFREEZE case 'F': g_free(config->fsfreeze_hook); config->fsfreeze_hook = g_strdup(optarg ?: QGA_FSFREEZE_HOOK_DEFAULT); break; #endif case 't': g_free(config->state_dir); config->state_dir = g_strdup(optarg); break; case 'v': /* enable all log levels */ config->log_level = G_LOG_LEVEL_MASK; break; case 'V': printf("QEMU Guest Agent %s\n", QEMU_VERSION); exit(EXIT_SUCCESS); case 'd': config->daemonize = 1; break; case 'D': config->dumpconf = 1; break; case 'b': { if (is_help_option(optarg)) { qmp_for_each_command(ga_print_cmd, NULL); exit(EXIT_SUCCESS); } config->blacklist = g_list_concat(config->blacklist, split_list(optarg, ",")); break; } #ifdef _WIN32 case 's': config->service = optarg; if (strcmp(config->service, "install") == 0) { if (ga_install_vss_provider()) { exit(EXIT_FAILURE); } if (ga_install_service(config->channel_path, config->log_filepath, config->state_dir)) { exit(EXIT_FAILURE); } exit(EXIT_SUCCESS); } else if (strcmp(config->service, "uninstall") == 0) { ga_uninstall_vss_provider(); exit(ga_uninstall_service()); } else if (strcmp(config->service, "vss-install") == 0) { if (ga_install_vss_provider()) { exit(EXIT_FAILURE); } exit(EXIT_SUCCESS); } else if (strcmp(config->service, "vss-uninstall") == 0) { ga_uninstall_vss_provider(); exit(EXIT_SUCCESS); } else { printf("Unknown service command.\n"); exit(EXIT_FAILURE); } break; #endif case 'h': usage(argv[0]); exit(EXIT_SUCCESS); case '?': g_print("Unknown option, try '%s --help' for more information.\n", argv[0]); exit(EXIT_FAILURE); } } }
true
qemu
6eaeae37a5fdd0a1ef88ed9ab4b807669ffc0e2d
static void config_parse(GAConfig *config, int argc, char **argv) { const char *sopt = "hVvdm:p:l:f:F::b:s:t:D"; int opt_ind = 0, ch; const struct option lopt[] = { { "help", 0, NULL, 'h' }, { "version", 0, NULL, 'V' }, { "dump-conf", 0, NULL, 'D' }, { "logfile", 1, NULL, 'l' }, { "pidfile", 1, NULL, 'f' }, #ifdef CONFIG_FSFREEZE { "fsfreeze-hook", 2, NULL, 'F' }, #endif { "verbose", 0, NULL, 'v' }, { "method", 1, NULL, 'm' }, { "path", 1, NULL, 'p' }, { "daemonize", 0, NULL, 'd' }, { "blacklist", 1, NULL, 'b' }, #ifdef _WIN32 { "service", 1, NULL, 's' }, #endif { "statedir", 1, NULL, 't' }, { NULL, 0, NULL, 0 } }; config->log_level = G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL; while ((ch = getopt_long(argc, argv, sopt, lopt, &opt_ind)) != -1) { switch (ch) { case 'm': g_free(config->method); config->method = g_strdup(optarg); break; case 'p': g_free(config->channel_path); config->channel_path = g_strdup(optarg); break; case 'l': g_free(config->log_filepath); config->log_filepath = g_strdup(optarg); break; case 'f': g_free(config->pid_filepath); config->pid_filepath = g_strdup(optarg); break; #ifdef CONFIG_FSFREEZE case 'F': g_free(config->fsfreeze_hook); config->fsfreeze_hook = g_strdup(optarg ?: QGA_FSFREEZE_HOOK_DEFAULT); break; #endif case 't': g_free(config->state_dir); config->state_dir = g_strdup(optarg); break; case 'v': config->log_level = G_LOG_LEVEL_MASK; break; case 'V': printf("QEMU Guest Agent %s\n", QEMU_VERSION); exit(EXIT_SUCCESS); case 'd': config->daemonize = 1; break; case 'D': config->dumpconf = 1; break; case 'b': { if (is_help_option(optarg)) { qmp_for_each_command(ga_print_cmd, NULL); exit(EXIT_SUCCESS); } config->blacklist = g_list_concat(config->blacklist, split_list(optarg, ",")); break; } #ifdef _WIN32 case 's': config->service = optarg; if (strcmp(config->service, "install") == 0) { if (ga_install_vss_provider()) { exit(EXIT_FAILURE); } if (ga_install_service(config->channel_path, config->log_filepath, config->state_dir)) { exit(EXIT_FAILURE); } exit(EXIT_SUCCESS); } else if (strcmp(config->service, "uninstall") == 0) { ga_uninstall_vss_provider(); exit(ga_uninstall_service()); } else if (strcmp(config->service, "vss-install") == 0) { if (ga_install_vss_provider()) { exit(EXIT_FAILURE); } exit(EXIT_SUCCESS); } else if (strcmp(config->service, "vss-uninstall") == 0) { ga_uninstall_vss_provider(); exit(EXIT_SUCCESS); } else { printf("Unknown service command.\n"); exit(EXIT_FAILURE); } break; #endif case 'h': usage(argv[0]); exit(EXIT_SUCCESS); case '?': g_print("Unknown option, try '%s --help' for more information.\n", argv[0]); exit(EXIT_FAILURE); } } }
{ "code": [ " config->log_level = G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL;" ], "line_no": [ 51 ] }
static void FUNC_0(GAConfig *VAR_0, int VAR_1, char **VAR_2) { const char *VAR_3 = "hVvdm:p:l:f:F::b:s:t:D"; int VAR_4 = 0, VAR_5; const struct option VAR_6[] = { { "help", 0, NULL, 'h' }, { "version", 0, NULL, 'V' }, { "dump-conf", 0, NULL, 'D' }, { "logfile", 1, NULL, 'l' }, { "pidfile", 1, NULL, 'f' }, #ifdef CONFIG_FSFREEZE { "fsfreeze-hook", 2, NULL, 'F' }, #endif { "verbose", 0, NULL, 'v' }, { "method", 1, NULL, 'm' }, { "path", 1, NULL, 'p' }, { "daemonize", 0, NULL, 'd' }, { "blacklist", 1, NULL, 'b' }, #ifdef _WIN32 { "service", 1, NULL, 's' }, #endif { "statedir", 1, NULL, 't' }, { NULL, 0, NULL, 0 } }; VAR_0->log_level = G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL; while ((VAR_5 = getopt_long(VAR_1, VAR_2, VAR_3, VAR_6, &VAR_4)) != -1) { switch (VAR_5) { case 'm': g_free(VAR_0->method); VAR_0->method = g_strdup(optarg); break; case 'p': g_free(VAR_0->channel_path); VAR_0->channel_path = g_strdup(optarg); break; case 'l': g_free(VAR_0->log_filepath); VAR_0->log_filepath = g_strdup(optarg); break; case 'f': g_free(VAR_0->pid_filepath); VAR_0->pid_filepath = g_strdup(optarg); break; #ifdef CONFIG_FSFREEZE case 'F': g_free(VAR_0->fsfreeze_hook); VAR_0->fsfreeze_hook = g_strdup(optarg ?: QGA_FSFREEZE_HOOK_DEFAULT); break; #endif case 't': g_free(VAR_0->state_dir); VAR_0->state_dir = g_strdup(optarg); break; case 'v': VAR_0->log_level = G_LOG_LEVEL_MASK; break; case 'V': printf("QEMU Guest Agent %s\n", QEMU_VERSION); exit(EXIT_SUCCESS); case 'd': VAR_0->daemonize = 1; break; case 'D': VAR_0->dumpconf = 1; break; case 'b': { if (is_help_option(optarg)) { qmp_for_each_command(ga_print_cmd, NULL); exit(EXIT_SUCCESS); } VAR_0->blacklist = g_list_concat(VAR_0->blacklist, split_list(optarg, ",")); break; } #ifdef _WIN32 case 's': VAR_0->service = optarg; if (strcmp(VAR_0->service, "install") == 0) { if (ga_install_vss_provider()) { exit(EXIT_FAILURE); } if (ga_install_service(VAR_0->channel_path, VAR_0->log_filepath, VAR_0->state_dir)) { exit(EXIT_FAILURE); } exit(EXIT_SUCCESS); } else if (strcmp(VAR_0->service, "uninstall") == 0) { ga_uninstall_vss_provider(); exit(ga_uninstall_service()); } else if (strcmp(VAR_0->service, "vss-install") == 0) { if (ga_install_vss_provider()) { exit(EXIT_FAILURE); } exit(EXIT_SUCCESS); } else if (strcmp(VAR_0->service, "vss-uninstall") == 0) { ga_uninstall_vss_provider(); exit(EXIT_SUCCESS); } else { printf("Unknown service command.\n"); exit(EXIT_FAILURE); } break; #endif case 'h': usage(VAR_2[0]); exit(EXIT_SUCCESS); case '?': g_print("Unknown option, try '%s --help' for more information.\n", VAR_2[0]); exit(EXIT_FAILURE); } } }
[ "static void FUNC_0(GAConfig *VAR_0, int VAR_1, char **VAR_2)\n{", "const char *VAR_3 = \"hVvdm:p:l:f:F::b:s:t:D\";", "int VAR_4 = 0, VAR_5;", "const struct option VAR_6[] = {", "{ \"help\", 0, NULL, 'h' },", "{ \"version\", 0, NULL, 'V' },", "{ \"dump-conf\", 0, NULL, 'D' },", "{ \"logfile\", 1, NULL, 'l' },", "{ \"pidfile\", 1, NULL, 'f' },", "#ifdef CONFIG_FSFREEZE\n{ \"fsfreeze-hook\", 2, NULL, 'F' },", "#endif\n{ \"verbose\", 0, NULL, 'v' },", "{ \"method\", 1, NULL, 'm' },", "{ \"path\", 1, NULL, 'p' },", "{ \"daemonize\", 0, NULL, 'd' },", "{ \"blacklist\", 1, NULL, 'b' },", "#ifdef _WIN32\n{ \"service\", 1, NULL, 's' },", "#endif\n{ \"statedir\", 1, NULL, 't' },", "{ NULL, 0, NULL, 0 }", "};", "VAR_0->log_level = G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL;", "while ((VAR_5 = getopt_long(VAR_1, VAR_2, VAR_3, VAR_6, &VAR_4)) != -1) {", "switch (VAR_5) {", "case 'm':\ng_free(VAR_0->method);", "VAR_0->method = g_strdup(optarg);", "break;", "case 'p':\ng_free(VAR_0->channel_path);", "VAR_0->channel_path = g_strdup(optarg);", "break;", "case 'l':\ng_free(VAR_0->log_filepath);", "VAR_0->log_filepath = g_strdup(optarg);", "break;", "case 'f':\ng_free(VAR_0->pid_filepath);", "VAR_0->pid_filepath = g_strdup(optarg);", "break;", "#ifdef CONFIG_FSFREEZE\ncase 'F':\ng_free(VAR_0->fsfreeze_hook);", "VAR_0->fsfreeze_hook = g_strdup(optarg ?: QGA_FSFREEZE_HOOK_DEFAULT);", "break;", "#endif\ncase 't':\ng_free(VAR_0->state_dir);", "VAR_0->state_dir = g_strdup(optarg);", "break;", "case 'v':\nVAR_0->log_level = G_LOG_LEVEL_MASK;", "break;", "case 'V':\nprintf(\"QEMU Guest Agent %s\\n\", QEMU_VERSION);", "exit(EXIT_SUCCESS);", "case 'd':\nVAR_0->daemonize = 1;", "break;", "case 'D':\nVAR_0->dumpconf = 1;", "break;", "case 'b': {", "if (is_help_option(optarg)) {", "qmp_for_each_command(ga_print_cmd, NULL);", "exit(EXIT_SUCCESS);", "}", "VAR_0->blacklist = g_list_concat(VAR_0->blacklist,\nsplit_list(optarg, \",\"));", "break;", "}", "#ifdef _WIN32\ncase 's':\nVAR_0->service = optarg;", "if (strcmp(VAR_0->service, \"install\") == 0) {", "if (ga_install_vss_provider()) {", "exit(EXIT_FAILURE);", "}", "if (ga_install_service(VAR_0->channel_path,\nVAR_0->log_filepath, VAR_0->state_dir)) {", "exit(EXIT_FAILURE);", "}", "exit(EXIT_SUCCESS);", "} else if (strcmp(VAR_0->service, \"uninstall\") == 0) {", "ga_uninstall_vss_provider();", "exit(ga_uninstall_service());", "} else if (strcmp(VAR_0->service, \"vss-install\") == 0) {", "if (ga_install_vss_provider()) {", "exit(EXIT_FAILURE);", "}", "exit(EXIT_SUCCESS);", "} else if (strcmp(VAR_0->service, \"vss-uninstall\") == 0) {", "ga_uninstall_vss_provider();", "exit(EXIT_SUCCESS);", "} else {", "printf(\"Unknown service command.\\n\");", "exit(EXIT_FAILURE);", "}", "break;", "#endif\ncase 'h':\nusage(VAR_2[0]);", "exit(EXIT_SUCCESS);", "case '?':\ng_print(\"Unknown option, try '%s --help' for more information.\\n\",\nVAR_2[0]);", "exit(EXIT_FAILURE);", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21, 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37, 39 ], [ 41, 43 ], [ 45 ], [ 47 ], [ 51 ], [ 55 ], [ 57 ], [ 59, 61 ], [ 63 ], [ 65 ], [ 67, 69 ], [ 71 ], [ 73 ], [ 75, 77 ], [ 79 ], [ 81 ], [ 83, 85 ], [ 87 ], [ 89 ], [ 91, 93, 95 ], [ 97 ], [ 99 ], [ 101, 103, 105 ], [ 107 ], [ 109 ], [ 111, 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 ] ]
17,950
static void gen_abs(DisasContext *ctx) { int l1 = gen_new_label(); int l2 = gen_new_label(); tcg_gen_brcondi_tl(TCG_COND_GE, cpu_gpr[rA(ctx->opcode)], 0, l1); tcg_gen_neg_tl(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcode)]); tcg_gen_br(l2); gen_set_label(l1); tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcode)]); gen_set_label(l2); if (unlikely(Rc(ctx->opcode) != 0)) gen_set_Rc0(ctx, cpu_gpr[rD(ctx->opcode)]); }
false
qemu
42a268c241183877192c376d03bd9b6d527407c7
static void gen_abs(DisasContext *ctx) { int l1 = gen_new_label(); int l2 = gen_new_label(); tcg_gen_brcondi_tl(TCG_COND_GE, cpu_gpr[rA(ctx->opcode)], 0, l1); tcg_gen_neg_tl(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcode)]); tcg_gen_br(l2); gen_set_label(l1); tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcode)]); gen_set_label(l2); if (unlikely(Rc(ctx->opcode) != 0)) gen_set_Rc0(ctx, cpu_gpr[rD(ctx->opcode)]); }
{ "code": [], "line_no": [] }
static void FUNC_0(DisasContext *VAR_0) { int VAR_1 = gen_new_label(); int VAR_2 = gen_new_label(); tcg_gen_brcondi_tl(TCG_COND_GE, cpu_gpr[rA(VAR_0->opcode)], 0, VAR_1); tcg_gen_neg_tl(cpu_gpr[rD(VAR_0->opcode)], cpu_gpr[rA(VAR_0->opcode)]); tcg_gen_br(VAR_2); gen_set_label(VAR_1); tcg_gen_mov_tl(cpu_gpr[rD(VAR_0->opcode)], cpu_gpr[rA(VAR_0->opcode)]); gen_set_label(VAR_2); if (unlikely(Rc(VAR_0->opcode) != 0)) gen_set_Rc0(VAR_0, cpu_gpr[rD(VAR_0->opcode)]); }
[ "static void FUNC_0(DisasContext *VAR_0)\n{", "int VAR_1 = gen_new_label();", "int VAR_2 = gen_new_label();", "tcg_gen_brcondi_tl(TCG_COND_GE, cpu_gpr[rA(VAR_0->opcode)], 0, VAR_1);", "tcg_gen_neg_tl(cpu_gpr[rD(VAR_0->opcode)], cpu_gpr[rA(VAR_0->opcode)]);", "tcg_gen_br(VAR_2);", "gen_set_label(VAR_1);", "tcg_gen_mov_tl(cpu_gpr[rD(VAR_0->opcode)], cpu_gpr[rA(VAR_0->opcode)]);", "gen_set_label(VAR_2);", "if (unlikely(Rc(VAR_0->opcode) != 0))\ngen_set_Rc0(VAR_0, cpu_gpr[rD(VAR_0->opcode)]);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21, 23 ], [ 25 ] ]
17,951
static void ga_channel_client_close(GAChannel *c) { g_assert(c->client_channel); g_io_channel_shutdown(c->client_channel, true, NULL); g_io_channel_unref(c->client_channel); c->client_channel = NULL; if (c->method == GA_CHANNEL_UNIX_LISTEN && c->listen_channel) { ga_channel_listen_add(c, 0, false); } }
false
qemu
f06b2031a31cdd3acf6f61a977e505b8c6b58f73
static void ga_channel_client_close(GAChannel *c) { g_assert(c->client_channel); g_io_channel_shutdown(c->client_channel, true, NULL); g_io_channel_unref(c->client_channel); c->client_channel = NULL; if (c->method == GA_CHANNEL_UNIX_LISTEN && c->listen_channel) { ga_channel_listen_add(c, 0, false); } }
{ "code": [], "line_no": [] }
static void FUNC_0(GAChannel *VAR_0) { g_assert(VAR_0->client_channel); g_io_channel_shutdown(VAR_0->client_channel, true, NULL); g_io_channel_unref(VAR_0->client_channel); VAR_0->client_channel = NULL; if (VAR_0->method == GA_CHANNEL_UNIX_LISTEN && VAR_0->listen_channel) { ga_channel_listen_add(VAR_0, 0, false); } }
[ "static void FUNC_0(GAChannel *VAR_0)\n{", "g_assert(VAR_0->client_channel);", "g_io_channel_shutdown(VAR_0->client_channel, true, NULL);", "g_io_channel_unref(VAR_0->client_channel);", "VAR_0->client_channel = NULL;", "if (VAR_0->method == GA_CHANNEL_UNIX_LISTEN && VAR_0->listen_channel) {", "ga_channel_listen_add(VAR_0, 0, false);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ] ]
17,952
static int omap_validate_tipb_addr(struct omap_mpu_state_s *s, target_phys_addr_t addr) { return range_covers_byte(0xfffb0000, 0xffff0000 - 0xfffb0000, addr); }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static int omap_validate_tipb_addr(struct omap_mpu_state_s *s, target_phys_addr_t addr) { return range_covers_byte(0xfffb0000, 0xffff0000 - 0xfffb0000, addr); }
{ "code": [], "line_no": [] }
static int FUNC_0(struct omap_mpu_state_s *VAR_0, target_phys_addr_t VAR_1) { return range_covers_byte(0xfffb0000, 0xffff0000 - 0xfffb0000, VAR_1); }
[ "static int FUNC_0(struct omap_mpu_state_s *VAR_0,\ntarget_phys_addr_t VAR_1)\n{", "return range_covers_byte(0xfffb0000, 0xffff0000 - 0xfffb0000, VAR_1);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ] ]
17,955
static int is_allocated_sectors(const uint8_t *buf, int n, int *pnum) { int v, i; if (n <= 0) { *pnum = 0; return 0; } v = is_not_zero(buf, 512); for(i = 1; i < n; i++) { buf += 512; if (v != is_not_zero(buf, 512)) break; } *pnum = i; return v; }
false
qemu
1a6d39fd71ddf90c5b76026cac4d5ff51fbaf8d8
static int is_allocated_sectors(const uint8_t *buf, int n, int *pnum) { int v, i; if (n <= 0) { *pnum = 0; return 0; } v = is_not_zero(buf, 512); for(i = 1; i < n; i++) { buf += 512; if (v != is_not_zero(buf, 512)) break; } *pnum = i; return v; }
{ "code": [], "line_no": [] }
static int FUNC_0(const uint8_t *VAR_0, int VAR_1, int *VAR_2) { int VAR_3, VAR_4; if (VAR_1 <= 0) { *VAR_2 = 0; return 0; } VAR_3 = is_not_zero(VAR_0, 512); for(VAR_4 = 1; VAR_4 < VAR_1; VAR_4++) { VAR_0 += 512; if (VAR_3 != is_not_zero(VAR_0, 512)) break; } *VAR_2 = VAR_4; return VAR_3; }
[ "static int FUNC_0(const uint8_t *VAR_0, int VAR_1, int *VAR_2)\n{", "int VAR_3, VAR_4;", "if (VAR_1 <= 0) {", "*VAR_2 = 0;", "return 0;", "}", "VAR_3 = is_not_zero(VAR_0, 512);", "for(VAR_4 = 1; VAR_4 < VAR_1; VAR_4++) {", "VAR_0 += 512;", "if (VAR_3 != is_not_zero(VAR_0, 512))\nbreak;", "}", "*VAR_2 = VAR_4;", "return VAR_3;", "}" ]
[ 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 ] ]
17,956
static void s390_virtio_blk_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); VirtIOS390DeviceClass *k = VIRTIO_S390_DEVICE_CLASS(klass); k->init = s390_virtio_blk_init; dc->props = s390_virtio_blk_properties; dc->alias = "virtio-blk"; }
false
qemu
6acbe4c6f18e7de00481ff30574262b58526de45
static void s390_virtio_blk_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); VirtIOS390DeviceClass *k = VIRTIO_S390_DEVICE_CLASS(klass); k->init = s390_virtio_blk_init; dc->props = s390_virtio_blk_properties; dc->alias = "virtio-blk"; }
{ "code": [], "line_no": [] }
static void FUNC_0(ObjectClass *VAR_0, void *VAR_1) { DeviceClass *dc = DEVICE_CLASS(VAR_0); VirtIOS390DeviceClass *k = VIRTIO_S390_DEVICE_CLASS(VAR_0); k->init = s390_virtio_blk_init; dc->props = s390_virtio_blk_properties; dc->alias = "virtio-blk"; }
[ "static void FUNC_0(ObjectClass *VAR_0, void *VAR_1)\n{", "DeviceClass *dc = DEVICE_CLASS(VAR_0);", "VirtIOS390DeviceClass *k = VIRTIO_S390_DEVICE_CLASS(VAR_0);", "k->init = s390_virtio_blk_init;", "dc->props = s390_virtio_blk_properties;", "dc->alias = \"virtio-blk\";", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ] ]
17,957
void do_info_vnc(Monitor *mon, QObject **ret_data) { if (vnc_display == NULL || vnc_display->display == NULL) { *ret_data = qobject_from_jsonf("{ 'enabled': false }"); } else { QDict *qdict; QList *clist; clist = qlist_new(); if (vnc_display->clients) { VncState *client = vnc_display->clients; while (client) { qdict = do_info_vnc_client(mon, client); if (qdict) qlist_append(clist, qdict); client = client->next; } } *ret_data = qobject_from_jsonf("{ 'enabled': true, 'clients': %p }", QOBJECT(clist)); assert(*ret_data != NULL); if (vnc_server_info_put(qobject_to_qdict(*ret_data)) < 0) { qobject_decref(*ret_data); *ret_data = NULL; } } }
false
qemu
4a80dba3920cf8e0829b9ce4769842ce94748bf4
void do_info_vnc(Monitor *mon, QObject **ret_data) { if (vnc_display == NULL || vnc_display->display == NULL) { *ret_data = qobject_from_jsonf("{ 'enabled': false }"); } else { QDict *qdict; QList *clist; clist = qlist_new(); if (vnc_display->clients) { VncState *client = vnc_display->clients; while (client) { qdict = do_info_vnc_client(mon, client); if (qdict) qlist_append(clist, qdict); client = client->next; } } *ret_data = qobject_from_jsonf("{ 'enabled': true, 'clients': %p }", QOBJECT(clist)); assert(*ret_data != NULL); if (vnc_server_info_put(qobject_to_qdict(*ret_data)) < 0) { qobject_decref(*ret_data); *ret_data = NULL; } } }
{ "code": [], "line_no": [] }
void FUNC_0(Monitor *VAR_0, QObject **VAR_1) { if (vnc_display == NULL || vnc_display->display == NULL) { *VAR_1 = qobject_from_jsonf("{ 'enabled': false }"); } else { QDict *qdict; QList *clist; clist = qlist_new(); if (vnc_display->clients) { VncState *client = vnc_display->clients; while (client) { qdict = do_info_vnc_client(VAR_0, client); if (qdict) qlist_append(clist, qdict); client = client->next; } } *VAR_1 = qobject_from_jsonf("{ 'enabled': true, 'clients': %p }", QOBJECT(clist)); assert(*VAR_1 != NULL); if (vnc_server_info_put(qobject_to_qdict(*VAR_1)) < 0) { qobject_decref(*VAR_1); *VAR_1 = NULL; } } }
[ "void FUNC_0(Monitor *VAR_0, QObject **VAR_1)\n{", "if (vnc_display == NULL || vnc_display->display == NULL) {", "*VAR_1 = qobject_from_jsonf(\"{ 'enabled': false }\");", "} else {", "QDict *qdict;", "QList *clist;", "clist = qlist_new();", "if (vnc_display->clients) {", "VncState *client = vnc_display->clients;", "while (client) {", "qdict = do_info_vnc_client(VAR_0, client);", "if (qdict)\nqlist_append(clist, qdict);", "client = client->next;", "}", "}", "*VAR_1 = qobject_from_jsonf(\"{ 'enabled': true, 'clients': %p }\",", "QOBJECT(clist));", "assert(*VAR_1 != NULL);", "if (vnc_server_info_put(qobject_to_qdict(*VAR_1)) < 0) {", "qobject_decref(*VAR_1);", "*VAR_1 = NULL;", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ] ]
17,959
static void breakpoint_invalidate(CPUArchState *env, target_ulong pc) { target_phys_addr_t addr; ram_addr_t ram_addr; MemoryRegionSection *section; addr = cpu_get_phys_page_debug(env, pc); section = phys_page_find(addr >> TARGET_PAGE_BITS); if (!(memory_region_is_ram(section->mr) || (section->mr->rom_device && section->mr->readable))) { return; } ram_addr = (memory_region_get_ram_addr(section->mr) & TARGET_PAGE_MASK) + section_addr(section, addr); tb_invalidate_phys_page_range(ram_addr, ram_addr + 1, 0); }
false
qemu
1e7855a558085d6acd0aba4e3278b594d05df1ec
static void breakpoint_invalidate(CPUArchState *env, target_ulong pc) { target_phys_addr_t addr; ram_addr_t ram_addr; MemoryRegionSection *section; addr = cpu_get_phys_page_debug(env, pc); section = phys_page_find(addr >> TARGET_PAGE_BITS); if (!(memory_region_is_ram(section->mr) || (section->mr->rom_device && section->mr->readable))) { return; } ram_addr = (memory_region_get_ram_addr(section->mr) & TARGET_PAGE_MASK) + section_addr(section, addr); tb_invalidate_phys_page_range(ram_addr, ram_addr + 1, 0); }
{ "code": [], "line_no": [] }
static void FUNC_0(CPUArchState *VAR_0, target_ulong VAR_1) { target_phys_addr_t addr; ram_addr_t ram_addr; MemoryRegionSection *section; addr = cpu_get_phys_page_debug(VAR_0, VAR_1); section = phys_page_find(addr >> TARGET_PAGE_BITS); if (!(memory_region_is_ram(section->mr) || (section->mr->rom_device && section->mr->readable))) { return; } ram_addr = (memory_region_get_ram_addr(section->mr) & TARGET_PAGE_MASK) + section_addr(section, addr); tb_invalidate_phys_page_range(ram_addr, ram_addr + 1, 0); }
[ "static void FUNC_0(CPUArchState *VAR_0, target_ulong VAR_1)\n{", "target_phys_addr_t addr;", "ram_addr_t ram_addr;", "MemoryRegionSection *section;", "addr = cpu_get_phys_page_debug(VAR_0, VAR_1);", "section = phys_page_find(addr >> TARGET_PAGE_BITS);", "if (!(memory_region_is_ram(section->mr)\n|| (section->mr->rom_device && section->mr->readable))) {", "return;", "}", "ram_addr = (memory_region_get_ram_addr(section->mr) & TARGET_PAGE_MASK)\n+ section_addr(section, addr);", "tb_invalidate_phys_page_range(ram_addr, ram_addr + 1, 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 ] ]
17,960
static int mon_init_func(void *opaque, QemuOpts *opts, Error **errp) { CharDriverState *chr; const char *chardev; const char *mode; int flags; mode = qemu_opt_get(opts, "mode"); if (mode == NULL) { mode = "readline"; } if (strcmp(mode, "readline") == 0) { flags = MONITOR_USE_READLINE; } else if (strcmp(mode, "control") == 0) { flags = MONITOR_USE_CONTROL; } else { fprintf(stderr, "unknown monitor mode \"%s\"\n", mode); exit(1); } if (qemu_opt_get_bool(opts, "pretty", 0)) flags |= MONITOR_USE_PRETTY; if (qemu_opt_get_bool(opts, "default", 0)) flags |= MONITOR_IS_DEFAULT; chardev = qemu_opt_get(opts, "chardev"); chr = qemu_chr_find(chardev); if (chr == NULL) { fprintf(stderr, "chardev \"%s\" not found\n", chardev); exit(1); } qemu_chr_fe_claim_no_fail(chr); monitor_init(chr, flags); return 0; }
false
qemu
f61eddcb2bb5cbbdd1d911b7e937db9affc29028
static int mon_init_func(void *opaque, QemuOpts *opts, Error **errp) { CharDriverState *chr; const char *chardev; const char *mode; int flags; mode = qemu_opt_get(opts, "mode"); if (mode == NULL) { mode = "readline"; } if (strcmp(mode, "readline") == 0) { flags = MONITOR_USE_READLINE; } else if (strcmp(mode, "control") == 0) { flags = MONITOR_USE_CONTROL; } else { fprintf(stderr, "unknown monitor mode \"%s\"\n", mode); exit(1); } if (qemu_opt_get_bool(opts, "pretty", 0)) flags |= MONITOR_USE_PRETTY; if (qemu_opt_get_bool(opts, "default", 0)) flags |= MONITOR_IS_DEFAULT; chardev = qemu_opt_get(opts, "chardev"); chr = qemu_chr_find(chardev); if (chr == NULL) { fprintf(stderr, "chardev \"%s\" not found\n", chardev); exit(1); } qemu_chr_fe_claim_no_fail(chr); monitor_init(chr, flags); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(void *VAR_0, QemuOpts *VAR_1, Error **VAR_2) { CharDriverState *chr; const char *VAR_3; const char *VAR_4; int VAR_5; VAR_4 = qemu_opt_get(VAR_1, "VAR_4"); if (VAR_4 == NULL) { VAR_4 = "readline"; } if (strcmp(VAR_4, "readline") == 0) { VAR_5 = MONITOR_USE_READLINE; } else if (strcmp(VAR_4, "control") == 0) { VAR_5 = MONITOR_USE_CONTROL; } else { fprintf(stderr, "unknown monitor VAR_4 \"%s\"\n", VAR_4); exit(1); } if (qemu_opt_get_bool(VAR_1, "pretty", 0)) VAR_5 |= MONITOR_USE_PRETTY; if (qemu_opt_get_bool(VAR_1, "default", 0)) VAR_5 |= MONITOR_IS_DEFAULT; VAR_3 = qemu_opt_get(VAR_1, "VAR_3"); chr = qemu_chr_find(VAR_3); if (chr == NULL) { fprintf(stderr, "VAR_3 \"%s\" not found\n", VAR_3); exit(1); } qemu_chr_fe_claim_no_fail(chr); monitor_init(chr, VAR_5); return 0; }
[ "static int FUNC_0(void *VAR_0, QemuOpts *VAR_1, Error **VAR_2)\n{", "CharDriverState *chr;", "const char *VAR_3;", "const char *VAR_4;", "int VAR_5;", "VAR_4 = qemu_opt_get(VAR_1, \"VAR_4\");", "if (VAR_4 == NULL) {", "VAR_4 = \"readline\";", "}", "if (strcmp(VAR_4, \"readline\") == 0) {", "VAR_5 = MONITOR_USE_READLINE;", "} else if (strcmp(VAR_4, \"control\") == 0) {", "VAR_5 = MONITOR_USE_CONTROL;", "} else {", "fprintf(stderr, \"unknown monitor VAR_4 \\\"%s\\\"\\n\", VAR_4);", "exit(1);", "}", "if (qemu_opt_get_bool(VAR_1, \"pretty\", 0))\nVAR_5 |= MONITOR_USE_PRETTY;", "if (qemu_opt_get_bool(VAR_1, \"default\", 0))\nVAR_5 |= MONITOR_IS_DEFAULT;", "VAR_3 = qemu_opt_get(VAR_1, \"VAR_3\");", "chr = qemu_chr_find(VAR_3);", "if (chr == NULL) {", "fprintf(stderr, \"VAR_3 \\\"%s\\\" not found\\n\", VAR_3);", "exit(1);", "}", "qemu_chr_fe_claim_no_fail(chr);", "monitor_init(chr, VAR_5);", "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 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41, 43 ], [ 47, 49 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ] ]
17,961
static void show_parts(const char *device) { if (fork() == 0) { int nbd; /* linux just needs an open() to trigger * the partition table update * but remember to load the module with max_part != 0 : * modprobe nbd max_part=63 */ nbd = open(device, O_RDWR); if (nbd != -1) close(nbd); exit(0); } }
false
qemu
a517e88baa9bef2b5c54a11d62b2b2ab2a5c4ab7
static void show_parts(const char *device) { if (fork() == 0) { int nbd; nbd = open(device, O_RDWR); if (nbd != -1) close(nbd); exit(0); } }
{ "code": [], "line_no": [] }
static void FUNC_0(const char *VAR_0) { if (fork() == 0) { int VAR_1; VAR_1 = open(VAR_0, O_RDWR); if (VAR_1 != -1) close(VAR_1); exit(0); } }
[ "static void FUNC_0(const char *VAR_0)\n{", "if (fork() == 0) {", "int VAR_1;", "VAR_1 = open(VAR_0, O_RDWR);", "if (VAR_1 != -1)\nclose(VAR_1);", "exit(0);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 29 ], [ 31 ] ]
17,962
static void isa_mmio_writel(void *opaque, target_phys_addr_t addr, uint32_t val) { cpu_outl(addr & IOPORTS_MASK, val); }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static void isa_mmio_writel(void *opaque, target_phys_addr_t addr, uint32_t val) { cpu_outl(addr & IOPORTS_MASK, val); }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1, uint32_t VAR_2) { cpu_outl(VAR_1 & IOPORTS_MASK, VAR_2); }
[ "static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1,\nuint32_t VAR_2)\n{", "cpu_outl(VAR_1 & IOPORTS_MASK, VAR_2);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ] ]
17,963
static inline void t_gen_subx_carry(DisasContext *dc, TCGv d) { if (dc->flagx_known) { if (dc->flags_x) { TCGv c; c = tcg_temp_new(TCG_TYPE_TL); t_gen_mov_TN_preg(c, PR_CCS); /* C flag is already at bit 0. */ tcg_gen_andi_tl(c, c, C_FLAG); tcg_gen_sub_tl(d, d, c); tcg_temp_free(c); } } else { TCGv x, c; x = tcg_temp_new(TCG_TYPE_TL); c = tcg_temp_new(TCG_TYPE_TL); t_gen_mov_TN_preg(x, PR_CCS); tcg_gen_mov_tl(c, x); /* Propagate carry into d if X is set. Branch free. */ tcg_gen_andi_tl(c, c, C_FLAG); tcg_gen_andi_tl(x, x, X_FLAG); tcg_gen_shri_tl(x, x, 4); tcg_gen_and_tl(x, x, c); tcg_gen_sub_tl(d, d, x); tcg_temp_free(x); tcg_temp_free(c); } }
false
qemu
a7812ae412311d7d47f8aa85656faadac9d64b56
static inline void t_gen_subx_carry(DisasContext *dc, TCGv d) { if (dc->flagx_known) { if (dc->flags_x) { TCGv c; c = tcg_temp_new(TCG_TYPE_TL); t_gen_mov_TN_preg(c, PR_CCS); tcg_gen_andi_tl(c, c, C_FLAG); tcg_gen_sub_tl(d, d, c); tcg_temp_free(c); } } else { TCGv x, c; x = tcg_temp_new(TCG_TYPE_TL); c = tcg_temp_new(TCG_TYPE_TL); t_gen_mov_TN_preg(x, PR_CCS); tcg_gen_mov_tl(c, x); tcg_gen_andi_tl(c, c, C_FLAG); tcg_gen_andi_tl(x, x, X_FLAG); tcg_gen_shri_tl(x, x, 4); tcg_gen_and_tl(x, x, c); tcg_gen_sub_tl(d, d, x); tcg_temp_free(x); tcg_temp_free(c); } }
{ "code": [], "line_no": [] }
static inline void FUNC_0(DisasContext *VAR_0, TCGv VAR_1) { if (VAR_0->flagx_known) { if (VAR_0->flags_x) { TCGv c; c = tcg_temp_new(TCG_TYPE_TL); t_gen_mov_TN_preg(c, PR_CCS); tcg_gen_andi_tl(c, c, C_FLAG); tcg_gen_sub_tl(VAR_1, VAR_1, c); tcg_temp_free(c); } } else { TCGv x, c; x = tcg_temp_new(TCG_TYPE_TL); c = tcg_temp_new(TCG_TYPE_TL); t_gen_mov_TN_preg(x, PR_CCS); tcg_gen_mov_tl(c, x); tcg_gen_andi_tl(c, c, C_FLAG); tcg_gen_andi_tl(x, x, X_FLAG); tcg_gen_shri_tl(x, x, 4); tcg_gen_and_tl(x, x, c); tcg_gen_sub_tl(VAR_1, VAR_1, x); tcg_temp_free(x); tcg_temp_free(c); } }
[ "static inline void FUNC_0(DisasContext *VAR_0, TCGv VAR_1)\n{", "if (VAR_0->flagx_known) {", "if (VAR_0->flags_x) {", "TCGv c;", "c = tcg_temp_new(TCG_TYPE_TL);", "t_gen_mov_TN_preg(c, PR_CCS);", "tcg_gen_andi_tl(c, c, C_FLAG);", "tcg_gen_sub_tl(VAR_1, VAR_1, c);", "tcg_temp_free(c);", "}", "} else {", "TCGv x, c;", "x = tcg_temp_new(TCG_TYPE_TL);", "c = tcg_temp_new(TCG_TYPE_TL);", "t_gen_mov_TN_preg(x, PR_CCS);", "tcg_gen_mov_tl(c, x);", "tcg_gen_andi_tl(c, c, C_FLAG);", "tcg_gen_andi_tl(x, x, X_FLAG);", "tcg_gen_shri_tl(x, x, 4);", "tcg_gen_and_tl(x, x, c);", "tcg_gen_sub_tl(VAR_1, VAR_1, x);", "tcg_temp_free(x);", "tcg_temp_free(c);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ] ]
17,965
SwsContext *getSwsContext(int srcW, int srcH, int srcFormat, int dstW, int dstH, int dstFormat, int flags, SwsFilter *srcFilter, SwsFilter *dstFilter){ SwsContext *c; int i; SwsFilter dummyFilter= {NULL, NULL, NULL, NULL}; #ifdef ARCH_X86 if(gCpuCaps.hasMMX) asm volatile("emms\n\t"::: "memory"); #endif if(swScale==NULL) globalInit(); /* sanity check */ if(srcW<4 || srcH<1 || dstW<8 || dstH<1) return NULL; //FIXME check if these are enough and try to lowwer them after fixing the relevant parts of the code // if(!isSupportedIn(srcFormat)) return NULL; // if(!isSupportedOut(dstFormat)) return NULL; if(!dstFilter) dstFilter= &dummyFilter; if(!srcFilter) srcFilter= &dummyFilter; c= memalign(64, sizeof(SwsContext)); memset(c, 0, sizeof(SwsContext)); c->srcW= srcW; c->srcH= srcH; c->dstW= dstW; c->dstH= dstH; c->lumXInc= ((srcW<<16) + (dstW>>1))/dstW; c->lumYInc= ((srcH<<16) + (dstH>>1))/dstH; c->flags= flags; c->dstFormat= dstFormat; c->srcFormat= srcFormat; if(cpuCaps.hasMMX2) { c->canMMX2BeUsed= (dstW >=srcW && (dstW&31)==0 && (srcW&15)==0) ? 1 : 0; if(!c->canMMX2BeUsed && dstW >=srcW && (srcW&15)==0 && (flags&SWS_FAST_BILINEAR)) { if(flags&SWS_PRINT_INFO) fprintf(stderr, "SwScaler: output Width is not a multiple of 32 -> no MMX2 scaler\n"); } } else c->canMMX2BeUsed=0; /* dont use full vertical UV input/internaly if the source doesnt even have it */ if(isHalfChrV(srcFormat)) c->flags= flags= flags&(~SWS_FULL_CHR_V); /* dont use full horizontal UV input if the source doesnt even have it */ if(isHalfChrH(srcFormat)) c->flags= flags= flags&(~SWS_FULL_CHR_H_INP); /* dont use full horizontal UV internally if the destination doesnt even have it */ if(isHalfChrH(dstFormat)) c->flags= flags= flags&(~SWS_FULL_CHR_H_INT); if(flags&SWS_FULL_CHR_H_INP) c->chrSrcW= srcW; else c->chrSrcW= (srcW+1)>>1; if(flags&SWS_FULL_CHR_H_INT) c->chrDstW= dstW; else c->chrDstW= (dstW+1)>>1; if(flags&SWS_FULL_CHR_V) c->chrSrcH= srcH; else c->chrSrcH= (srcH+1)>>1; if(isHalfChrV(dstFormat)) c->chrDstH= (dstH+1)>>1; else c->chrDstH= dstH; c->chrXInc= ((c->chrSrcW<<16) + (c->chrDstW>>1))/c->chrDstW; c->chrYInc= ((c->chrSrcH<<16) + (c->chrDstH>>1))/c->chrDstH; // match pixel 0 of the src to pixel 0 of dst and match pixel n-2 of src to pixel n-2 of dst // but only for the FAST_BILINEAR mode otherwise do correct scaling // n-2 is the last chrominance sample available // this is not perfect, but noone shuld notice the difference, the more correct variant // would be like the vertical one, but that would require some special code for the // first and last pixel if(flags&SWS_FAST_BILINEAR) { if(c->canMMX2BeUsed) { c->lumXInc+= 20; c->chrXInc+= 20; } //we dont use the x86asm scaler if mmx is available else if(cpuCaps.hasMMX) { c->lumXInc = ((srcW-2)<<16)/(dstW-2) - 20; c->chrXInc = ((c->chrSrcW-2)<<16)/(c->chrDstW-2) - 20; } } /* precalculate horizontal scaler filter coefficients */ { const int filterAlign= cpuCaps.hasMMX ? 4 : 1; initFilter(&c->hLumFilter, &c->hLumFilterPos, &c->hLumFilterSize, c->lumXInc, srcW , dstW, filterAlign, 1<<14, flags, srcFilter->lumH, dstFilter->lumH); initFilter(&c->hChrFilter, &c->hChrFilterPos, &c->hChrFilterSize, c->chrXInc, (srcW+1)>>1, c->chrDstW, filterAlign, 1<<14, flags, srcFilter->chrH, dstFilter->chrH); #ifdef ARCH_X86 // cant downscale !!! if(c->canMMX2BeUsed && (flags & SWS_FAST_BILINEAR)) { initMMX2HScaler( dstW, c->lumXInc, c->funnyYCode); initMMX2HScaler(c->chrDstW, c->chrXInc, c->funnyUVCode); } #endif } // Init Horizontal stuff /* precalculate vertical scaler filter coefficients */ initFilter(&c->vLumFilter, &c->vLumFilterPos, &c->vLumFilterSize, c->lumYInc, srcH , dstH, 1, (1<<12)-4, flags, srcFilter->lumV, dstFilter->lumV); initFilter(&c->vChrFilter, &c->vChrFilterPos, &c->vChrFilterSize, c->chrYInc, (srcH+1)>>1, c->chrDstH, 1, (1<<12)-4, flags, srcFilter->chrV, dstFilter->chrV); // Calculate Buffer Sizes so that they wont run out while handling these damn slices c->vLumBufSize= c->vLumFilterSize; c->vChrBufSize= c->vChrFilterSize; for(i=0; i<dstH; i++) { int chrI= i*c->chrDstH / dstH; int nextSlice= MAX(c->vLumFilterPos[i ] + c->vLumFilterSize - 1, ((c->vChrFilterPos[chrI] + c->vChrFilterSize - 1)<<1)); nextSlice&= ~1; // Slices start at even boundaries if(c->vLumFilterPos[i ] + c->vLumBufSize < nextSlice) c->vLumBufSize= nextSlice - c->vLumFilterPos[i ]; if(c->vChrFilterPos[chrI] + c->vChrBufSize < (nextSlice>>1)) c->vChrBufSize= (nextSlice>>1) - c->vChrFilterPos[chrI]; } // allocate pixbufs (we use dynamic allocation because otherwise we would need to c->lumPixBuf= (int16_t**)memalign(4, c->vLumBufSize*2*sizeof(int16_t*)); c->chrPixBuf= (int16_t**)memalign(4, c->vChrBufSize*2*sizeof(int16_t*)); //Note we need at least one pixel more at the end because of the mmx code (just in case someone wanna replace the 4000/8000) for(i=0; i<c->vLumBufSize; i++) c->lumPixBuf[i]= c->lumPixBuf[i+c->vLumBufSize]= (uint16_t*)memalign(8, 4000); for(i=0; i<c->vChrBufSize; i++) c->chrPixBuf[i]= c->chrPixBuf[i+c->vChrBufSize]= (uint16_t*)memalign(8, 8000); //try to avoid drawing green stuff between the right end and the stride end for(i=0; i<c->vLumBufSize; i++) memset(c->lumPixBuf[i], 0, 4000); for(i=0; i<c->vChrBufSize; i++) memset(c->chrPixBuf[i], 64, 8000); ASSERT(c->chrDstH <= dstH) // pack filter data for mmx code if(cpuCaps.hasMMX) { c->lumMmxFilter= (int16_t*)memalign(8, c->vLumFilterSize* dstH*4*sizeof(int16_t)); c->chrMmxFilter= (int16_t*)memalign(8, c->vChrFilterSize*c->chrDstH*4*sizeof(int16_t)); for(i=0; i<c->vLumFilterSize*dstH; i++) c->lumMmxFilter[4*i]=c->lumMmxFilter[4*i+1]=c->lumMmxFilter[4*i+2]=c->lumMmxFilter[4*i+3]= c->vLumFilter[i]; for(i=0; i<c->vChrFilterSize*c->chrDstH; i++) c->chrMmxFilter[4*i]=c->chrMmxFilter[4*i+1]=c->chrMmxFilter[4*i+2]=c->chrMmxFilter[4*i+3]= c->vChrFilter[i]; } if(flags&SWS_PRINT_INFO) { #ifdef DITHER1XBPP char *dither= " dithered"; #else char *dither= ""; #endif if(flags&SWS_FAST_BILINEAR) fprintf(stderr, "\nSwScaler: FAST_BILINEAR scaler, "); else if(flags&SWS_BILINEAR) fprintf(stderr, "\nSwScaler: BILINEAR scaler, "); else if(flags&SWS_BICUBIC) fprintf(stderr, "\nSwScaler: BICUBIC scaler, "); else if(flags&SWS_X) fprintf(stderr, "\nSwScaler: Experimental scaler, "); else if(flags&SWS_POINT) fprintf(stderr, "\nSwScaler: Nearest Neighbor / POINT scaler, "); else if(flags&SWS_AREA) fprintf(stderr, "\nSwScaler: Area Averageing scaler, "); else fprintf(stderr, "\nSwScaler: ehh flags invalid?! "); if(dstFormat==IMGFMT_BGR15 || dstFormat==IMGFMT_BGR16) fprintf(stderr, "from %s to%s %s ", vo_format_name(srcFormat), dither, vo_format_name(dstFormat)); else fprintf(stderr, "from %s to %s ", vo_format_name(srcFormat), vo_format_name(dstFormat)); if(cpuCaps.hasMMX2) fprintf(stderr, "using MMX2\n"); else if(cpuCaps.has3DNow) fprintf(stderr, "using 3DNOW\n"); else if(cpuCaps.hasMMX) fprintf(stderr, "using MMX\n"); else fprintf(stderr, "using C\n"); } if((flags & SWS_PRINT_INFO) && verbose) { if(cpuCaps.hasMMX) { if(c->canMMX2BeUsed && (flags&SWS_FAST_BILINEAR)) printf("SwScaler: using FAST_BILINEAR MMX2 scaler for horizontal scaling\n"); else { if(c->hLumFilterSize==4) printf("SwScaler: using 4-tap MMX scaler for horizontal luminance scaling\n"); else if(c->hLumFilterSize==8) printf("SwScaler: using 8-tap MMX scaler for horizontal luminance scaling\n"); else printf("SwScaler: using n-tap MMX scaler for horizontal luminance scaling\n"); if(c->hChrFilterSize==4) printf("SwScaler: using 4-tap MMX scaler for horizontal chrominance scaling\n"); else if(c->hChrFilterSize==8) printf("SwScaler: using 8-tap MMX scaler for horizontal chrominance scaling\n"); else printf("SwScaler: using n-tap MMX scaler for horizontal chrominance scaling\n"); } } else { #ifdef ARCH_X86 printf("SwScaler: using X86-Asm scaler for horizontal scaling\n"); #else if(flags & SWS_FAST_BILINEAR) printf("SwScaler: using FAST_BILINEAR C scaler for horizontal scaling\n"); else printf("SwScaler: using C scaler for horizontal scaling\n"); #endif } if(isPlanarYUV(dstFormat)) { if(c->vLumFilterSize==1) printf("SwScaler: using 1-tap %s \"scaler\" for vertical scaling (YV12 like)\n", cpuCaps.hasMMX ? "MMX" : "C"); else printf("SwScaler: using n-tap %s scaler for vertical scaling (YV12 like)\n", cpuCaps.hasMMX ? "MMX" : "C"); } else { if(c->vLumFilterSize==1 && c->vChrFilterSize==2) printf("SwScaler: using 1-tap %s \"scaler\" for vertical luminance scaling (BGR)\n" "SwScaler: 2-tap scaler for vertical chrominance scaling (BGR)\n",cpuCaps.hasMMX ? "MMX" : "C"); else if(c->vLumFilterSize==2 && c->vChrFilterSize==2) printf("SwScaler: using 2-tap linear %s scaler for vertical scaling (BGR)\n", cpuCaps.hasMMX ? "MMX" : "C"); else printf("SwScaler: using n-tap %s scaler for vertical scaling (BGR)\n", cpuCaps.hasMMX ? "MMX" : "C"); } if(dstFormat==IMGFMT_BGR24) printf("SwScaler: using %s YV12->BGR24 Converter\n", cpuCaps.hasMMX2 ? "MMX2" : (cpuCaps.hasMMX ? "MMX" : "C")); else if(dstFormat==IMGFMT_BGR32) printf("SwScaler: using %s YV12->BGR32 Converter\n", cpuCaps.hasMMX ? "MMX" : "C"); else if(dstFormat==IMGFMT_BGR16) printf("SwScaler: using %s YV12->BGR16 Converter\n", cpuCaps.hasMMX ? "MMX" : "C"); else if(dstFormat==IMGFMT_BGR15) printf("SwScaler: using %s YV12->BGR15 Converter\n", cpuCaps.hasMMX ? "MMX" : "C"); printf("SwScaler: %dx%d -> %dx%d\n", srcW, srcH, dstW, dstH); } if((flags & SWS_PRINT_INFO) && verbose>1) { printf("SwScaler:Lum srcW=%d srcH=%d dstW=%d dstH=%d xInc=%d yInc=%d\n", c->srcW, c->srcH, c->dstW, c->dstH, c->lumXInc, c->lumYInc); printf("SwScaler:Chr srcW=%d srcH=%d dstW=%d dstH=%d xInc=%d yInc=%d\n", c->chrSrcW, c->chrSrcH, c->chrDstW, c->chrDstH, c->chrXInc, c->chrYInc); } return c; }
false
FFmpeg
6ff0ad6bfd0f00a3d54705811ee91a7ce3c22cda
SwsContext *getSwsContext(int srcW, int srcH, int srcFormat, int dstW, int dstH, int dstFormat, int flags, SwsFilter *srcFilter, SwsFilter *dstFilter){ SwsContext *c; int i; SwsFilter dummyFilter= {NULL, NULL, NULL, NULL}; #ifdef ARCH_X86 if(gCpuCaps.hasMMX) asm volatile("emms\n\t"::: "memory"); #endif if(swScale==NULL) globalInit(); if(srcW<4 || srcH<1 || dstW<8 || dstH<1) return NULL; if(!dstFilter) dstFilter= &dummyFilter; if(!srcFilter) srcFilter= &dummyFilter; c= memalign(64, sizeof(SwsContext)); memset(c, 0, sizeof(SwsContext)); c->srcW= srcW; c->srcH= srcH; c->dstW= dstW; c->dstH= dstH; c->lumXInc= ((srcW<<16) + (dstW>>1))/dstW; c->lumYInc= ((srcH<<16) + (dstH>>1))/dstH; c->flags= flags; c->dstFormat= dstFormat; c->srcFormat= srcFormat; if(cpuCaps.hasMMX2) { c->canMMX2BeUsed= (dstW >=srcW && (dstW&31)==0 && (srcW&15)==0) ? 1 : 0; if(!c->canMMX2BeUsed && dstW >=srcW && (srcW&15)==0 && (flags&SWS_FAST_BILINEAR)) { if(flags&SWS_PRINT_INFO) fprintf(stderr, "SwScaler: output Width is not a multiple of 32 -> no MMX2 scaler\n"); } } else c->canMMX2BeUsed=0; if(isHalfChrV(srcFormat)) c->flags= flags= flags&(~SWS_FULL_CHR_V); if(isHalfChrH(srcFormat)) c->flags= flags= flags&(~SWS_FULL_CHR_H_INP); if(isHalfChrH(dstFormat)) c->flags= flags= flags&(~SWS_FULL_CHR_H_INT); if(flags&SWS_FULL_CHR_H_INP) c->chrSrcW= srcW; else c->chrSrcW= (srcW+1)>>1; if(flags&SWS_FULL_CHR_H_INT) c->chrDstW= dstW; else c->chrDstW= (dstW+1)>>1; if(flags&SWS_FULL_CHR_V) c->chrSrcH= srcH; else c->chrSrcH= (srcH+1)>>1; if(isHalfChrV(dstFormat)) c->chrDstH= (dstH+1)>>1; else c->chrDstH= dstH; c->chrXInc= ((c->chrSrcW<<16) + (c->chrDstW>>1))/c->chrDstW; c->chrYInc= ((c->chrSrcH<<16) + (c->chrDstH>>1))/c->chrDstH; if(flags&SWS_FAST_BILINEAR) { if(c->canMMX2BeUsed) { c->lumXInc+= 20; c->chrXInc+= 20; } else if(cpuCaps.hasMMX) { c->lumXInc = ((srcW-2)<<16)/(dstW-2) - 20; c->chrXInc = ((c->chrSrcW-2)<<16)/(c->chrDstW-2) - 20; } } { const int filterAlign= cpuCaps.hasMMX ? 4 : 1; initFilter(&c->hLumFilter, &c->hLumFilterPos, &c->hLumFilterSize, c->lumXInc, srcW , dstW, filterAlign, 1<<14, flags, srcFilter->lumH, dstFilter->lumH); initFilter(&c->hChrFilter, &c->hChrFilterPos, &c->hChrFilterSize, c->chrXInc, (srcW+1)>>1, c->chrDstW, filterAlign, 1<<14, flags, srcFilter->chrH, dstFilter->chrH); #ifdef ARCH_X86 if(c->canMMX2BeUsed && (flags & SWS_FAST_BILINEAR)) { initMMX2HScaler( dstW, c->lumXInc, c->funnyYCode); initMMX2HScaler(c->chrDstW, c->chrXInc, c->funnyUVCode); } #endif } initFilter(&c->vLumFilter, &c->vLumFilterPos, &c->vLumFilterSize, c->lumYInc, srcH , dstH, 1, (1<<12)-4, flags, srcFilter->lumV, dstFilter->lumV); initFilter(&c->vChrFilter, &c->vChrFilterPos, &c->vChrFilterSize, c->chrYInc, (srcH+1)>>1, c->chrDstH, 1, (1<<12)-4, flags, srcFilter->chrV, dstFilter->chrV); c->vLumBufSize= c->vLumFilterSize; c->vChrBufSize= c->vChrFilterSize; for(i=0; i<dstH; i++) { int chrI= i*c->chrDstH / dstH; int nextSlice= MAX(c->vLumFilterPos[i ] + c->vLumFilterSize - 1, ((c->vChrFilterPos[chrI] + c->vChrFilterSize - 1)<<1)); nextSlice&= ~1; if(c->vLumFilterPos[i ] + c->vLumBufSize < nextSlice) c->vLumBufSize= nextSlice - c->vLumFilterPos[i ]; if(c->vChrFilterPos[chrI] + c->vChrBufSize < (nextSlice>>1)) c->vChrBufSize= (nextSlice>>1) - c->vChrFilterPos[chrI]; } c->lumPixBuf= (int16_t**)memalign(4, c->vLumBufSize*2*sizeof(int16_t*)); c->chrPixBuf= (int16_t**)memalign(4, c->vChrBufSize*2*sizeof(int16_t*)); for(i=0; i<c->vLumBufSize; i++) c->lumPixBuf[i]= c->lumPixBuf[i+c->vLumBufSize]= (uint16_t*)memalign(8, 4000); for(i=0; i<c->vChrBufSize; i++) c->chrPixBuf[i]= c->chrPixBuf[i+c->vChrBufSize]= (uint16_t*)memalign(8, 8000); for(i=0; i<c->vLumBufSize; i++) memset(c->lumPixBuf[i], 0, 4000); for(i=0; i<c->vChrBufSize; i++) memset(c->chrPixBuf[i], 64, 8000); ASSERT(c->chrDstH <= dstH) if(cpuCaps.hasMMX) { c->lumMmxFilter= (int16_t*)memalign(8, c->vLumFilterSize* dstH*4*sizeof(int16_t)); c->chrMmxFilter= (int16_t*)memalign(8, c->vChrFilterSize*c->chrDstH*4*sizeof(int16_t)); for(i=0; i<c->vLumFilterSize*dstH; i++) c->lumMmxFilter[4*i]=c->lumMmxFilter[4*i+1]=c->lumMmxFilter[4*i+2]=c->lumMmxFilter[4*i+3]= c->vLumFilter[i]; for(i=0; i<c->vChrFilterSize*c->chrDstH; i++) c->chrMmxFilter[4*i]=c->chrMmxFilter[4*i+1]=c->chrMmxFilter[4*i+2]=c->chrMmxFilter[4*i+3]= c->vChrFilter[i]; } if(flags&SWS_PRINT_INFO) { #ifdef DITHER1XBPP char *dither= " dithered"; #else char *dither= ""; #endif if(flags&SWS_FAST_BILINEAR) fprintf(stderr, "\nSwScaler: FAST_BILINEAR scaler, "); else if(flags&SWS_BILINEAR) fprintf(stderr, "\nSwScaler: BILINEAR scaler, "); else if(flags&SWS_BICUBIC) fprintf(stderr, "\nSwScaler: BICUBIC scaler, "); else if(flags&SWS_X) fprintf(stderr, "\nSwScaler: Experimental scaler, "); else if(flags&SWS_POINT) fprintf(stderr, "\nSwScaler: Nearest Neighbor / POINT scaler, "); else if(flags&SWS_AREA) fprintf(stderr, "\nSwScaler: Area Averageing scaler, "); else fprintf(stderr, "\nSwScaler: ehh flags invalid?! "); if(dstFormat==IMGFMT_BGR15 || dstFormat==IMGFMT_BGR16) fprintf(stderr, "from %s to%s %s ", vo_format_name(srcFormat), dither, vo_format_name(dstFormat)); else fprintf(stderr, "from %s to %s ", vo_format_name(srcFormat), vo_format_name(dstFormat)); if(cpuCaps.hasMMX2) fprintf(stderr, "using MMX2\n"); else if(cpuCaps.has3DNow) fprintf(stderr, "using 3DNOW\n"); else if(cpuCaps.hasMMX) fprintf(stderr, "using MMX\n"); else fprintf(stderr, "using C\n"); } if((flags & SWS_PRINT_INFO) && verbose) { if(cpuCaps.hasMMX) { if(c->canMMX2BeUsed && (flags&SWS_FAST_BILINEAR)) printf("SwScaler: using FAST_BILINEAR MMX2 scaler for horizontal scaling\n"); else { if(c->hLumFilterSize==4) printf("SwScaler: using 4-tap MMX scaler for horizontal luminance scaling\n"); else if(c->hLumFilterSize==8) printf("SwScaler: using 8-tap MMX scaler for horizontal luminance scaling\n"); else printf("SwScaler: using n-tap MMX scaler for horizontal luminance scaling\n"); if(c->hChrFilterSize==4) printf("SwScaler: using 4-tap MMX scaler for horizontal chrominance scaling\n"); else if(c->hChrFilterSize==8) printf("SwScaler: using 8-tap MMX scaler for horizontal chrominance scaling\n"); else printf("SwScaler: using n-tap MMX scaler for horizontal chrominance scaling\n"); } } else { #ifdef ARCH_X86 printf("SwScaler: using X86-Asm scaler for horizontal scaling\n"); #else if(flags & SWS_FAST_BILINEAR) printf("SwScaler: using FAST_BILINEAR C scaler for horizontal scaling\n"); else printf("SwScaler: using C scaler for horizontal scaling\n"); #endif } if(isPlanarYUV(dstFormat)) { if(c->vLumFilterSize==1) printf("SwScaler: using 1-tap %s \"scaler\" for vertical scaling (YV12 like)\n", cpuCaps.hasMMX ? "MMX" : "C"); else printf("SwScaler: using n-tap %s scaler for vertical scaling (YV12 like)\n", cpuCaps.hasMMX ? "MMX" : "C"); } else { if(c->vLumFilterSize==1 && c->vChrFilterSize==2) printf("SwScaler: using 1-tap %s \"scaler\" for vertical luminance scaling (BGR)\n" "SwScaler: 2-tap scaler for vertical chrominance scaling (BGR)\n",cpuCaps.hasMMX ? "MMX" : "C"); else if(c->vLumFilterSize==2 && c->vChrFilterSize==2) printf("SwScaler: using 2-tap linear %s scaler for vertical scaling (BGR)\n", cpuCaps.hasMMX ? "MMX" : "C"); else printf("SwScaler: using n-tap %s scaler for vertical scaling (BGR)\n", cpuCaps.hasMMX ? "MMX" : "C"); } if(dstFormat==IMGFMT_BGR24) printf("SwScaler: using %s YV12->BGR24 Converter\n", cpuCaps.hasMMX2 ? "MMX2" : (cpuCaps.hasMMX ? "MMX" : "C")); else if(dstFormat==IMGFMT_BGR32) printf("SwScaler: using %s YV12->BGR32 Converter\n", cpuCaps.hasMMX ? "MMX" : "C"); else if(dstFormat==IMGFMT_BGR16) printf("SwScaler: using %s YV12->BGR16 Converter\n", cpuCaps.hasMMX ? "MMX" : "C"); else if(dstFormat==IMGFMT_BGR15) printf("SwScaler: using %s YV12->BGR15 Converter\n", cpuCaps.hasMMX ? "MMX" : "C"); printf("SwScaler: %dx%d -> %dx%d\n", srcW, srcH, dstW, dstH); } if((flags & SWS_PRINT_INFO) && verbose>1) { printf("SwScaler:Lum srcW=%d srcH=%d dstW=%d dstH=%d xInc=%d yInc=%d\n", c->srcW, c->srcH, c->dstW, c->dstH, c->lumXInc, c->lumYInc); printf("SwScaler:Chr srcW=%d srcH=%d dstW=%d dstH=%d xInc=%d yInc=%d\n", c->chrSrcW, c->chrSrcH, c->chrDstW, c->chrDstH, c->chrXInc, c->chrYInc); } return c; }
{ "code": [], "line_no": [] }
SwsContext *FUNC_0(int srcW, int srcH, int srcFormat, int dstW, int dstH, int dstFormat, int flags, SwsFilter *srcFilter, SwsFilter *dstFilter){ SwsContext *c; int VAR_0; SwsFilter dummyFilter= {NULL, NULL, NULL, NULL}; #ifdef ARCH_X86 if(gCpuCaps.hasMMX) asm volatile("emms\n\t"::: "memory"); #endif if(swScale==NULL) globalInit(); if(srcW<4 || srcH<1 || dstW<8 || dstH<1) return NULL; if(!dstFilter) dstFilter= &dummyFilter; if(!srcFilter) srcFilter= &dummyFilter; c= memalign(64, sizeof(SwsContext)); memset(c, 0, sizeof(SwsContext)); c->srcW= srcW; c->srcH= srcH; c->dstW= dstW; c->dstH= dstH; c->lumXInc= ((srcW<<16) + (dstW>>1))/dstW; c->lumYInc= ((srcH<<16) + (dstH>>1))/dstH; c->flags= flags; c->dstFormat= dstFormat; c->srcFormat= srcFormat; if(cpuCaps.hasMMX2) { c->canMMX2BeUsed= (dstW >=srcW && (dstW&31)==0 && (srcW&15)==0) ? 1 : 0; if(!c->canMMX2BeUsed && dstW >=srcW && (srcW&15)==0 && (flags&SWS_FAST_BILINEAR)) { if(flags&SWS_PRINT_INFO) fprintf(stderr, "SwScaler: output Width is not a multiple of 32 -> no MMX2 scaler\n"); } } else c->canMMX2BeUsed=0; if(isHalfChrV(srcFormat)) c->flags= flags= flags&(~SWS_FULL_CHR_V); if(isHalfChrH(srcFormat)) c->flags= flags= flags&(~SWS_FULL_CHR_H_INP); if(isHalfChrH(dstFormat)) c->flags= flags= flags&(~SWS_FULL_CHR_H_INT); if(flags&SWS_FULL_CHR_H_INP) c->chrSrcW= srcW; else c->chrSrcW= (srcW+1)>>1; if(flags&SWS_FULL_CHR_H_INT) c->chrDstW= dstW; else c->chrDstW= (dstW+1)>>1; if(flags&SWS_FULL_CHR_V) c->chrSrcH= srcH; else c->chrSrcH= (srcH+1)>>1; if(isHalfChrV(dstFormat)) c->chrDstH= (dstH+1)>>1; else c->chrDstH= dstH; c->chrXInc= ((c->chrSrcW<<16) + (c->chrDstW>>1))/c->chrDstW; c->chrYInc= ((c->chrSrcH<<16) + (c->chrDstH>>1))/c->chrDstH; if(flags&SWS_FAST_BILINEAR) { if(c->canMMX2BeUsed) { c->lumXInc+= 20; c->chrXInc+= 20; } else if(cpuCaps.hasMMX) { c->lumXInc = ((srcW-2)<<16)/(dstW-2) - 20; c->chrXInc = ((c->chrSrcW-2)<<16)/(c->chrDstW-2) - 20; } } { const int VAR_1= cpuCaps.hasMMX ? 4 : 1; initFilter(&c->hLumFilter, &c->hLumFilterPos, &c->hLumFilterSize, c->lumXInc, srcW , dstW, VAR_1, 1<<14, flags, srcFilter->lumH, dstFilter->lumH); initFilter(&c->hChrFilter, &c->hChrFilterPos, &c->hChrFilterSize, c->chrXInc, (srcW+1)>>1, c->chrDstW, VAR_1, 1<<14, flags, srcFilter->chrH, dstFilter->chrH); #ifdef ARCH_X86 if(c->canMMX2BeUsed && (flags & SWS_FAST_BILINEAR)) { initMMX2HScaler( dstW, c->lumXInc, c->funnyYCode); initMMX2HScaler(c->chrDstW, c->chrXInc, c->funnyUVCode); } #endif } initFilter(&c->vLumFilter, &c->vLumFilterPos, &c->vLumFilterSize, c->lumYInc, srcH , dstH, 1, (1<<12)-4, flags, srcFilter->lumV, dstFilter->lumV); initFilter(&c->vChrFilter, &c->vChrFilterPos, &c->vChrFilterSize, c->chrYInc, (srcH+1)>>1, c->chrDstH, 1, (1<<12)-4, flags, srcFilter->chrV, dstFilter->chrV); c->vLumBufSize= c->vLumFilterSize; c->vChrBufSize= c->vChrFilterSize; for(VAR_0=0; VAR_0<dstH; VAR_0++) { int VAR_2= VAR_0*c->chrDstH / dstH; int VAR_3= MAX(c->vLumFilterPos[VAR_0 ] + c->vLumFilterSize - 1, ((c->vChrFilterPos[VAR_2] + c->vChrFilterSize - 1)<<1)); VAR_3&= ~1; if(c->vLumFilterPos[VAR_0 ] + c->vLumBufSize < VAR_3) c->vLumBufSize= VAR_3 - c->vLumFilterPos[VAR_0 ]; if(c->vChrFilterPos[VAR_2] + c->vChrBufSize < (VAR_3>>1)) c->vChrBufSize= (VAR_3>>1) - c->vChrFilterPos[VAR_2]; } c->lumPixBuf= (int16_t**)memalign(4, c->vLumBufSize*2*sizeof(int16_t*)); c->chrPixBuf= (int16_t**)memalign(4, c->vChrBufSize*2*sizeof(int16_t*)); for(VAR_0=0; VAR_0<c->vLumBufSize; VAR_0++) c->lumPixBuf[VAR_0]= c->lumPixBuf[VAR_0+c->vLumBufSize]= (uint16_t*)memalign(8, 4000); for(VAR_0=0; VAR_0<c->vChrBufSize; VAR_0++) c->chrPixBuf[VAR_0]= c->chrPixBuf[VAR_0+c->vChrBufSize]= (uint16_t*)memalign(8, 8000); for(VAR_0=0; VAR_0<c->vLumBufSize; VAR_0++) memset(c->lumPixBuf[VAR_0], 0, 4000); for(VAR_0=0; VAR_0<c->vChrBufSize; VAR_0++) memset(c->chrPixBuf[VAR_0], 64, 8000); ASSERT(c->chrDstH <= dstH) if(cpuCaps.hasMMX) { c->lumMmxFilter= (int16_t*)memalign(8, c->vLumFilterSize* dstH*4*sizeof(int16_t)); c->chrMmxFilter= (int16_t*)memalign(8, c->vChrFilterSize*c->chrDstH*4*sizeof(int16_t)); for(VAR_0=0; VAR_0<c->vLumFilterSize*dstH; VAR_0++) c->lumMmxFilter[4*VAR_0]=c->lumMmxFilter[4*VAR_0+1]=c->lumMmxFilter[4*VAR_0+2]=c->lumMmxFilter[4*VAR_0+3]= c->vLumFilter[VAR_0]; for(VAR_0=0; VAR_0<c->vChrFilterSize*c->chrDstH; VAR_0++) c->chrMmxFilter[4*VAR_0]=c->chrMmxFilter[4*VAR_0+1]=c->chrMmxFilter[4*VAR_0+2]=c->chrMmxFilter[4*VAR_0+3]= c->vChrFilter[VAR_0]; } if(flags&SWS_PRINT_INFO) { #ifdef DITHER1XBPP char *dither= " dithered"; #else char *dither= ""; #endif if(flags&SWS_FAST_BILINEAR) fprintf(stderr, "\nSwScaler: FAST_BILINEAR scaler, "); else if(flags&SWS_BILINEAR) fprintf(stderr, "\nSwScaler: BILINEAR scaler, "); else if(flags&SWS_BICUBIC) fprintf(stderr, "\nSwScaler: BICUBIC scaler, "); else if(flags&SWS_X) fprintf(stderr, "\nSwScaler: Experimental scaler, "); else if(flags&SWS_POINT) fprintf(stderr, "\nSwScaler: Nearest Neighbor / POINT scaler, "); else if(flags&SWS_AREA) fprintf(stderr, "\nSwScaler: Area Averageing scaler, "); else fprintf(stderr, "\nSwScaler: ehh flags invalid?! "); if(dstFormat==IMGFMT_BGR15 || dstFormat==IMGFMT_BGR16) fprintf(stderr, "from %s to%s %s ", vo_format_name(srcFormat), dither, vo_format_name(dstFormat)); else fprintf(stderr, "from %s to %s ", vo_format_name(srcFormat), vo_format_name(dstFormat)); if(cpuCaps.hasMMX2) fprintf(stderr, "using MMX2\n"); else if(cpuCaps.has3DNow) fprintf(stderr, "using 3DNOW\n"); else if(cpuCaps.hasMMX) fprintf(stderr, "using MMX\n"); else fprintf(stderr, "using C\n"); } if((flags & SWS_PRINT_INFO) && verbose) { if(cpuCaps.hasMMX) { if(c->canMMX2BeUsed && (flags&SWS_FAST_BILINEAR)) printf("SwScaler: using FAST_BILINEAR MMX2 scaler for horizontal scaling\n"); else { if(c->hLumFilterSize==4) printf("SwScaler: using 4-tap MMX scaler for horizontal luminance scaling\n"); else if(c->hLumFilterSize==8) printf("SwScaler: using 8-tap MMX scaler for horizontal luminance scaling\n"); else printf("SwScaler: using n-tap MMX scaler for horizontal luminance scaling\n"); if(c->hChrFilterSize==4) printf("SwScaler: using 4-tap MMX scaler for horizontal chrominance scaling\n"); else if(c->hChrFilterSize==8) printf("SwScaler: using 8-tap MMX scaler for horizontal chrominance scaling\n"); else printf("SwScaler: using n-tap MMX scaler for horizontal chrominance scaling\n"); } } else { #ifdef ARCH_X86 printf("SwScaler: using X86-Asm scaler for horizontal scaling\n"); #else if(flags & SWS_FAST_BILINEAR) printf("SwScaler: using FAST_BILINEAR C scaler for horizontal scaling\n"); else printf("SwScaler: using C scaler for horizontal scaling\n"); #endif } if(isPlanarYUV(dstFormat)) { if(c->vLumFilterSize==1) printf("SwScaler: using 1-tap %s \"scaler\" for vertical scaling (YV12 like)\n", cpuCaps.hasMMX ? "MMX" : "C"); else printf("SwScaler: using n-tap %s scaler for vertical scaling (YV12 like)\n", cpuCaps.hasMMX ? "MMX" : "C"); } else { if(c->vLumFilterSize==1 && c->vChrFilterSize==2) printf("SwScaler: using 1-tap %s \"scaler\" for vertical luminance scaling (BGR)\n" "SwScaler: 2-tap scaler for vertical chrominance scaling (BGR)\n",cpuCaps.hasMMX ? "MMX" : "C"); else if(c->vLumFilterSize==2 && c->vChrFilterSize==2) printf("SwScaler: using 2-tap linear %s scaler for vertical scaling (BGR)\n", cpuCaps.hasMMX ? "MMX" : "C"); else printf("SwScaler: using n-tap %s scaler for vertical scaling (BGR)\n", cpuCaps.hasMMX ? "MMX" : "C"); } if(dstFormat==IMGFMT_BGR24) printf("SwScaler: using %s YV12->BGR24 Converter\n", cpuCaps.hasMMX2 ? "MMX2" : (cpuCaps.hasMMX ? "MMX" : "C")); else if(dstFormat==IMGFMT_BGR32) printf("SwScaler: using %s YV12->BGR32 Converter\n", cpuCaps.hasMMX ? "MMX" : "C"); else if(dstFormat==IMGFMT_BGR16) printf("SwScaler: using %s YV12->BGR16 Converter\n", cpuCaps.hasMMX ? "MMX" : "C"); else if(dstFormat==IMGFMT_BGR15) printf("SwScaler: using %s YV12->BGR15 Converter\n", cpuCaps.hasMMX ? "MMX" : "C"); printf("SwScaler: %dx%d -> %dx%d\n", srcW, srcH, dstW, dstH); } if((flags & SWS_PRINT_INFO) && verbose>1) { printf("SwScaler:Lum srcW=%d srcH=%d dstW=%d dstH=%d xInc=%d yInc=%d\n", c->srcW, c->srcH, c->dstW, c->dstH, c->lumXInc, c->lumYInc); printf("SwScaler:Chr srcW=%d srcH=%d dstW=%d dstH=%d xInc=%d yInc=%d\n", c->chrSrcW, c->chrSrcH, c->chrDstW, c->chrDstH, c->chrXInc, c->chrYInc); } return c; }
[ "SwsContext *FUNC_0(int srcW, int srcH, int srcFormat, int dstW, int dstH, int dstFormat, int flags,\nSwsFilter *srcFilter, SwsFilter *dstFilter){", "SwsContext *c;", "int VAR_0;", "SwsFilter dummyFilter= {NULL, NULL, NULL, NULL};", "#ifdef ARCH_X86\nif(gCpuCaps.hasMMX)\nasm volatile(\"emms\\n\\t\"::: \"memory\");", "#endif\nif(swScale==NULL) globalInit();", "if(srcW<4 || srcH<1 || dstW<8 || dstH<1) return NULL;", "if(!dstFilter) dstFilter= &dummyFilter;", "if(!srcFilter) srcFilter= &dummyFilter;", "c= memalign(64, sizeof(SwsContext));", "memset(c, 0, sizeof(SwsContext));", "c->srcW= srcW;", "c->srcH= srcH;", "c->dstW= dstW;", "c->dstH= dstH;", "c->lumXInc= ((srcW<<16) + (dstW>>1))/dstW;", "c->lumYInc= ((srcH<<16) + (dstH>>1))/dstH;", "c->flags= flags;", "c->dstFormat= dstFormat;", "c->srcFormat= srcFormat;", "if(cpuCaps.hasMMX2)\n{", "c->canMMX2BeUsed= (dstW >=srcW && (dstW&31)==0 && (srcW&15)==0) ? 1 : 0;", "if(!c->canMMX2BeUsed && dstW >=srcW && (srcW&15)==0 && (flags&SWS_FAST_BILINEAR))\n{", "if(flags&SWS_PRINT_INFO)\nfprintf(stderr, \"SwScaler: output Width is not a multiple of 32 -> no MMX2 scaler\\n\");", "}", "}", "else\nc->canMMX2BeUsed=0;", "if(isHalfChrV(srcFormat)) c->flags= flags= flags&(~SWS_FULL_CHR_V);", "if(isHalfChrH(srcFormat)) c->flags= flags= flags&(~SWS_FULL_CHR_H_INP);", "if(isHalfChrH(dstFormat)) c->flags= flags= flags&(~SWS_FULL_CHR_H_INT);", "if(flags&SWS_FULL_CHR_H_INP)\tc->chrSrcW= srcW;", "else\t\t\t\tc->chrSrcW= (srcW+1)>>1;", "if(flags&SWS_FULL_CHR_H_INT)\tc->chrDstW= dstW;", "else\t\t\t\tc->chrDstW= (dstW+1)>>1;", "if(flags&SWS_FULL_CHR_V)\tc->chrSrcH= srcH;", "else\t\t\t\tc->chrSrcH= (srcH+1)>>1;", "if(isHalfChrV(dstFormat))\tc->chrDstH= (dstH+1)>>1;", "else\t\t\t\tc->chrDstH= dstH;", "c->chrXInc= ((c->chrSrcW<<16) + (c->chrDstW>>1))/c->chrDstW;", "c->chrYInc= ((c->chrSrcH<<16) + (c->chrDstH>>1))/c->chrDstH;", "if(flags&SWS_FAST_BILINEAR)\n{", "if(c->canMMX2BeUsed)\n{", "c->lumXInc+= 20;", "c->chrXInc+= 20;", "}", "else if(cpuCaps.hasMMX)\n{", "c->lumXInc = ((srcW-2)<<16)/(dstW-2) - 20;", "c->chrXInc = ((c->chrSrcW-2)<<16)/(c->chrDstW-2) - 20;", "}", "}", "{", "const int VAR_1= cpuCaps.hasMMX ? 4 : 1;", "initFilter(&c->hLumFilter, &c->hLumFilterPos, &c->hLumFilterSize, c->lumXInc,\nsrcW , dstW, VAR_1, 1<<14, flags,\nsrcFilter->lumH, dstFilter->lumH);", "initFilter(&c->hChrFilter, &c->hChrFilterPos, &c->hChrFilterSize, c->chrXInc,\n(srcW+1)>>1, c->chrDstW, VAR_1, 1<<14, flags,\nsrcFilter->chrH, dstFilter->chrH);", "#ifdef ARCH_X86\nif(c->canMMX2BeUsed && (flags & SWS_FAST_BILINEAR))\n{", "initMMX2HScaler( dstW, c->lumXInc, c->funnyYCode);", "initMMX2HScaler(c->chrDstW, c->chrXInc, c->funnyUVCode);", "}", "#endif\n}", "initFilter(&c->vLumFilter, &c->vLumFilterPos, &c->vLumFilterSize, c->lumYInc,\nsrcH , dstH, 1, (1<<12)-4, flags,\nsrcFilter->lumV, dstFilter->lumV);", "initFilter(&c->vChrFilter, &c->vChrFilterPos, &c->vChrFilterSize, c->chrYInc,\n(srcH+1)>>1, c->chrDstH, 1, (1<<12)-4, flags,\nsrcFilter->chrV, dstFilter->chrV);", "c->vLumBufSize= c->vLumFilterSize;", "c->vChrBufSize= c->vChrFilterSize;", "for(VAR_0=0; VAR_0<dstH; VAR_0++)", "{", "int VAR_2= VAR_0*c->chrDstH / dstH;", "int VAR_3= MAX(c->vLumFilterPos[VAR_0 ] + c->vLumFilterSize - 1,\n((c->vChrFilterPos[VAR_2] + c->vChrFilterSize - 1)<<1));", "VAR_3&= ~1;", "if(c->vLumFilterPos[VAR_0 ] + c->vLumBufSize < VAR_3)\nc->vLumBufSize= VAR_3 - c->vLumFilterPos[VAR_0 ];", "if(c->vChrFilterPos[VAR_2] + c->vChrBufSize < (VAR_3>>1))\nc->vChrBufSize= (VAR_3>>1) - c->vChrFilterPos[VAR_2];", "}", "c->lumPixBuf= (int16_t**)memalign(4, c->vLumBufSize*2*sizeof(int16_t*));", "c->chrPixBuf= (int16_t**)memalign(4, c->vChrBufSize*2*sizeof(int16_t*));", "for(VAR_0=0; VAR_0<c->vLumBufSize; VAR_0++)", "c->lumPixBuf[VAR_0]= c->lumPixBuf[VAR_0+c->vLumBufSize]= (uint16_t*)memalign(8, 4000);", "for(VAR_0=0; VAR_0<c->vChrBufSize; VAR_0++)", "c->chrPixBuf[VAR_0]= c->chrPixBuf[VAR_0+c->vChrBufSize]= (uint16_t*)memalign(8, 8000);", "for(VAR_0=0; VAR_0<c->vLumBufSize; VAR_0++) memset(c->lumPixBuf[VAR_0], 0, 4000);", "for(VAR_0=0; VAR_0<c->vChrBufSize; VAR_0++) memset(c->chrPixBuf[VAR_0], 64, 8000);", "ASSERT(c->chrDstH <= dstH)\nif(cpuCaps.hasMMX)\n{", "c->lumMmxFilter= (int16_t*)memalign(8, c->vLumFilterSize* dstH*4*sizeof(int16_t));", "c->chrMmxFilter= (int16_t*)memalign(8, c->vChrFilterSize*c->chrDstH*4*sizeof(int16_t));", "for(VAR_0=0; VAR_0<c->vLumFilterSize*dstH; VAR_0++)", "c->lumMmxFilter[4*VAR_0]=c->lumMmxFilter[4*VAR_0+1]=c->lumMmxFilter[4*VAR_0+2]=c->lumMmxFilter[4*VAR_0+3]=\nc->vLumFilter[VAR_0];", "for(VAR_0=0; VAR_0<c->vChrFilterSize*c->chrDstH; VAR_0++)", "c->chrMmxFilter[4*VAR_0]=c->chrMmxFilter[4*VAR_0+1]=c->chrMmxFilter[4*VAR_0+2]=c->chrMmxFilter[4*VAR_0+3]=\nc->vChrFilter[VAR_0];", "}", "if(flags&SWS_PRINT_INFO)\n{", "#ifdef DITHER1XBPP\nchar *dither= \" dithered\";", "#else\nchar *dither= \"\";", "#endif\nif(flags&SWS_FAST_BILINEAR)\nfprintf(stderr, \"\\nSwScaler: FAST_BILINEAR scaler, \");", "else if(flags&SWS_BILINEAR)\nfprintf(stderr, \"\\nSwScaler: BILINEAR scaler, \");", "else if(flags&SWS_BICUBIC)\nfprintf(stderr, \"\\nSwScaler: BICUBIC scaler, \");", "else if(flags&SWS_X)\nfprintf(stderr, \"\\nSwScaler: Experimental scaler, \");", "else if(flags&SWS_POINT)\nfprintf(stderr, \"\\nSwScaler: Nearest Neighbor / POINT scaler, \");", "else if(flags&SWS_AREA)\nfprintf(stderr, \"\\nSwScaler: Area Averageing scaler, \");", "else\nfprintf(stderr, \"\\nSwScaler: ehh flags invalid?! \");", "if(dstFormat==IMGFMT_BGR15 || dstFormat==IMGFMT_BGR16)\nfprintf(stderr, \"from %s to%s %s \",\nvo_format_name(srcFormat), dither, vo_format_name(dstFormat));", "else\nfprintf(stderr, \"from %s to %s \",\nvo_format_name(srcFormat), vo_format_name(dstFormat));", "if(cpuCaps.hasMMX2)\nfprintf(stderr, \"using MMX2\\n\");", "else if(cpuCaps.has3DNow)\nfprintf(stderr, \"using 3DNOW\\n\");", "else if(cpuCaps.hasMMX)\nfprintf(stderr, \"using MMX\\n\");", "else\nfprintf(stderr, \"using C\\n\");", "}", "if((flags & SWS_PRINT_INFO) && verbose)\n{", "if(cpuCaps.hasMMX)\n{", "if(c->canMMX2BeUsed && (flags&SWS_FAST_BILINEAR))\nprintf(\"SwScaler: using FAST_BILINEAR MMX2 scaler for horizontal scaling\\n\");", "else\n{", "if(c->hLumFilterSize==4)\nprintf(\"SwScaler: using 4-tap MMX scaler for horizontal luminance scaling\\n\");", "else if(c->hLumFilterSize==8)\nprintf(\"SwScaler: using 8-tap MMX scaler for horizontal luminance scaling\\n\");", "else\nprintf(\"SwScaler: using n-tap MMX scaler for horizontal luminance scaling\\n\");", "if(c->hChrFilterSize==4)\nprintf(\"SwScaler: using 4-tap MMX scaler for horizontal chrominance scaling\\n\");", "else if(c->hChrFilterSize==8)\nprintf(\"SwScaler: using 8-tap MMX scaler for horizontal chrominance scaling\\n\");", "else\nprintf(\"SwScaler: using n-tap MMX scaler for horizontal chrominance scaling\\n\");", "}", "}", "else\n{", "#ifdef ARCH_X86\nprintf(\"SwScaler: using X86-Asm scaler for horizontal scaling\\n\");", "#else\nif(flags & SWS_FAST_BILINEAR)\nprintf(\"SwScaler: using FAST_BILINEAR C scaler for horizontal scaling\\n\");", "else\nprintf(\"SwScaler: using C scaler for horizontal scaling\\n\");", "#endif\n}", "if(isPlanarYUV(dstFormat))\n{", "if(c->vLumFilterSize==1)\nprintf(\"SwScaler: using 1-tap %s \\\"scaler\\\" for vertical scaling (YV12 like)\\n\", cpuCaps.hasMMX ? \"MMX\" : \"C\");", "else\nprintf(\"SwScaler: using n-tap %s scaler for vertical scaling (YV12 like)\\n\", cpuCaps.hasMMX ? \"MMX\" : \"C\");", "}", "else\n{", "if(c->vLumFilterSize==1 && c->vChrFilterSize==2)\nprintf(\"SwScaler: using 1-tap %s \\\"scaler\\\" for vertical luminance scaling (BGR)\\n\"\n\"SwScaler: 2-tap scaler for vertical chrominance scaling (BGR)\\n\",cpuCaps.hasMMX ? \"MMX\" : \"C\");", "else if(c->vLumFilterSize==2 && c->vChrFilterSize==2)\nprintf(\"SwScaler: using 2-tap linear %s scaler for vertical scaling (BGR)\\n\", cpuCaps.hasMMX ? \"MMX\" : \"C\");", "else\nprintf(\"SwScaler: using n-tap %s scaler for vertical scaling (BGR)\\n\", cpuCaps.hasMMX ? \"MMX\" : \"C\");", "}", "if(dstFormat==IMGFMT_BGR24)\nprintf(\"SwScaler: using %s YV12->BGR24 Converter\\n\",\ncpuCaps.hasMMX2 ? \"MMX2\" : (cpuCaps.hasMMX ? \"MMX\" : \"C\"));", "else if(dstFormat==IMGFMT_BGR32)\nprintf(\"SwScaler: using %s YV12->BGR32 Converter\\n\", cpuCaps.hasMMX ? \"MMX\" : \"C\");", "else if(dstFormat==IMGFMT_BGR16)\nprintf(\"SwScaler: using %s YV12->BGR16 Converter\\n\", cpuCaps.hasMMX ? \"MMX\" : \"C\");", "else if(dstFormat==IMGFMT_BGR15)\nprintf(\"SwScaler: using %s YV12->BGR15 Converter\\n\", cpuCaps.hasMMX ? \"MMX\" : \"C\");", "printf(\"SwScaler: %dx%d -> %dx%d\\n\", srcW, srcH, dstW, dstH);", "}", "if((flags & SWS_PRINT_INFO) && verbose>1)\n{", "printf(\"SwScaler:Lum srcW=%d srcH=%d dstW=%d dstH=%d xInc=%d yInc=%d\\n\",\nc->srcW, c->srcH, c->dstW, c->dstH, c->lumXInc, c->lumYInc);", "printf(\"SwScaler:Chr srcW=%d srcH=%d dstW=%d dstH=%d xInc=%d yInc=%d\\n\",\nc->chrSrcW, c->chrSrcH, c->chrDstW, c->chrDstH, c->chrXInc, c->chrYInc);", "}", "return c;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 7 ], [ 9 ], [ 11 ], [ 15, 17, 19 ], [ 21, 25 ], [ 31 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 73, 75 ], [ 77 ], [ 79, 81 ], [ 83, 85 ], [ 87 ], [ 89 ], [ 91, 93 ], [ 101 ], [ 105 ], [ 109 ], [ 113 ], [ 115 ], [ 119 ], [ 121 ], [ 125 ], [ 127 ], [ 131 ], [ 133 ], [ 137 ], [ 139 ], [ 157, 159 ], [ 161, 163 ], [ 165 ], [ 167 ], [ 169 ], [ 173, 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 189 ], [ 191 ], [ 195, 197, 199 ], [ 201, 203, 205 ], [ 209, 213, 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223, 225 ], [ 235, 237, 239 ], [ 241, 243, 245 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261, 263 ], [ 265 ], [ 267, 269 ], [ 271, 273 ], [ 275 ], [ 281 ], [ 283 ], [ 287 ], [ 289 ], [ 291 ], [ 293 ], [ 299 ], [ 301 ], [ 305, 311, 313 ], [ 315 ], [ 317 ], [ 319 ], [ 321, 323 ], [ 325 ], [ 327, 329 ], [ 331 ], [ 335, 337 ], [ 339, 341 ], [ 343, 345 ], [ 347, 349, 351 ], [ 353, 355 ], [ 357, 359 ], [ 361, 363 ], [ 365, 367 ], [ 369, 371 ], [ 373, 375 ], [ 379, 381, 383 ], [ 385, 387, 389 ], [ 393, 395 ], [ 397, 399 ], [ 401, 403 ], [ 405, 407 ], [ 409 ], [ 413, 415 ], [ 417, 419 ], [ 421, 423 ], [ 425, 427 ], [ 429, 431 ], [ 433, 435 ], [ 437, 439 ], [ 443, 445 ], [ 447, 449 ], [ 451, 453 ], [ 455 ], [ 457 ], [ 459, 461 ], [ 463, 465 ], [ 467, 469, 471 ], [ 473, 475 ], [ 477, 479 ], [ 481, 483 ], [ 485, 487 ], [ 489, 491 ], [ 493 ], [ 495, 497 ], [ 499, 501, 503 ], [ 505, 507 ], [ 509, 511 ], [ 513 ], [ 517, 519, 521 ], [ 523, 525 ], [ 527, 529 ], [ 531, 533 ], [ 537 ], [ 539 ], [ 541, 543 ], [ 545, 547 ], [ 549, 551 ], [ 553 ], [ 557 ], [ 559 ] ]
17,966
struct pxa2xx_state_s *pxa270_init(unsigned int sdram_size, DisplayState *ds, const char *revision) { struct pxa2xx_state_s *s; struct pxa2xx_ssp_s *ssp; int iomemtype, i; s = (struct pxa2xx_state_s *) qemu_mallocz(sizeof(struct pxa2xx_state_s)); if (revision && strncmp(revision, "pxa27", 5)) { fprintf(stderr, "Machine requires a PXA27x processor.\n"); exit(1); } s->env = cpu_init(); cpu_arm_set_model(s->env, revision ?: "pxa270"); register_savevm("cpu", 0, 0, cpu_save, cpu_load, s->env); /* SDRAM & Internal Memory Storage */ cpu_register_physical_memory(PXA2XX_SDRAM_BASE, sdram_size, qemu_ram_alloc(sdram_size) | IO_MEM_RAM); cpu_register_physical_memory(PXA2XX_INTERNAL_BASE, 0x40000, qemu_ram_alloc(0x40000) | IO_MEM_RAM); s->pic = pxa2xx_pic_init(0x40d00000, s->env); s->dma = pxa27x_dma_init(0x40000000, s->pic[PXA2XX_PIC_DMA]); pxa27x_timer_init(0x40a00000, &s->pic[PXA2XX_PIC_OST_0], s->pic[PXA27X_PIC_OST_4_11]); s->gpio = pxa2xx_gpio_init(0x40e00000, s->env, s->pic, 121); s->mmc = pxa2xx_mmci_init(0x41100000, s->pic[PXA2XX_PIC_MMC], s->dma); for (i = 0; pxa270_serial[i].io_base; i ++) if (serial_hds[i]) serial_mm_init(pxa270_serial[i].io_base, 2, s->pic[pxa270_serial[i].irqn], serial_hds[i], 1); else break; if (serial_hds[i]) s->fir = pxa2xx_fir_init(0x40800000, s->pic[PXA2XX_PIC_ICP], s->dma, serial_hds[i]); if (ds) s->lcd = pxa2xx_lcdc_init(0x44000000, s->pic[PXA2XX_PIC_LCD], ds); s->cm_base = 0x41300000; s->cm_regs[CCCR >> 4] = 0x02000210; /* 416.0 MHz */ s->clkcfg = 0x00000009; /* Turbo mode active */ iomemtype = cpu_register_io_memory(0, pxa2xx_cm_readfn, pxa2xx_cm_writefn, s); cpu_register_physical_memory(s->cm_base, 0xfff, iomemtype); register_savevm("pxa2xx_cm", 0, 0, pxa2xx_cm_save, pxa2xx_cm_load, s); cpu_arm_set_cp_io(s->env, 14, pxa2xx_cp14_read, pxa2xx_cp14_write, s); s->mm_base = 0x48000000; s->mm_regs[MDMRS >> 2] = 0x00020002; s->mm_regs[MDREFR >> 2] = 0x03ca4000; s->mm_regs[MECR >> 2] = 0x00000001; /* Two PC Card sockets */ iomemtype = cpu_register_io_memory(0, pxa2xx_mm_readfn, pxa2xx_mm_writefn, s); cpu_register_physical_memory(s->mm_base, 0xfff, iomemtype); register_savevm("pxa2xx_mm", 0, 0, pxa2xx_mm_save, pxa2xx_mm_load, s); for (i = 0; pxa27x_ssp[i].io_base; i ++); s->ssp = (struct pxa2xx_ssp_s **) qemu_mallocz(sizeof(struct pxa2xx_ssp_s *) * i); ssp = (struct pxa2xx_ssp_s *) qemu_mallocz(sizeof(struct pxa2xx_ssp_s) * i); for (i = 0; pxa27x_ssp[i].io_base; i ++) { s->ssp[i] = &ssp[i]; ssp[i].base = pxa27x_ssp[i].io_base; ssp[i].irq = s->pic[pxa27x_ssp[i].irqn]; iomemtype = cpu_register_io_memory(0, pxa2xx_ssp_readfn, pxa2xx_ssp_writefn, &ssp[i]); cpu_register_physical_memory(ssp[i].base, 0xfff, iomemtype); register_savevm("pxa2xx_ssp", i, 0, pxa2xx_ssp_save, pxa2xx_ssp_load, s); } if (usb_enabled) { usb_ohci_init_pxa(0x4c000000, 3, -1, s->pic[PXA2XX_PIC_USBH1]); } s->pcmcia[0] = pxa2xx_pcmcia_init(0x20000000); s->pcmcia[1] = pxa2xx_pcmcia_init(0x30000000); s->rtc_base = 0x40900000; iomemtype = cpu_register_io_memory(0, pxa2xx_rtc_readfn, pxa2xx_rtc_writefn, s); cpu_register_physical_memory(s->rtc_base, 0xfff, iomemtype); pxa2xx_rtc_init(s); register_savevm("pxa2xx_rtc", 0, 0, pxa2xx_rtc_save, pxa2xx_rtc_load, s); /* Note that PM registers are in the same page with PWRI2C registers. * As a workaround we don't map PWRI2C into memory and we expect * PM handlers to call PWRI2C handlers when appropriate. */ s->i2c[0] = pxa2xx_i2c_init(0x40301600, s->pic[PXA2XX_PIC_I2C], 1); s->i2c[1] = pxa2xx_i2c_init(0x40f00100, s->pic[PXA2XX_PIC_PWRI2C], 0); s->pm_base = 0x40f00000; iomemtype = cpu_register_io_memory(0, pxa2xx_pm_readfn, pxa2xx_pm_writefn, s); cpu_register_physical_memory(s->pm_base, 0xfff, iomemtype); register_savevm("pxa2xx_pm", 0, 0, pxa2xx_pm_save, pxa2xx_pm_load, s); s->i2s = pxa2xx_i2s_init(0x40400000, s->pic[PXA2XX_PIC_I2S], s->dma); /* GPIO1 resets the processor */ /* The handler can be overriden by board-specific code */ pxa2xx_gpio_handler_set(s->gpio, 1, pxa2xx_reset, s); return s; }
false
qemu
2a1639291bf9f3c88c62d10459fedaa677536ff5
struct pxa2xx_state_s *pxa270_init(unsigned int sdram_size, DisplayState *ds, const char *revision) { struct pxa2xx_state_s *s; struct pxa2xx_ssp_s *ssp; int iomemtype, i; s = (struct pxa2xx_state_s *) qemu_mallocz(sizeof(struct pxa2xx_state_s)); if (revision && strncmp(revision, "pxa27", 5)) { fprintf(stderr, "Machine requires a PXA27x processor.\n"); exit(1); } s->env = cpu_init(); cpu_arm_set_model(s->env, revision ?: "pxa270"); register_savevm("cpu", 0, 0, cpu_save, cpu_load, s->env); cpu_register_physical_memory(PXA2XX_SDRAM_BASE, sdram_size, qemu_ram_alloc(sdram_size) | IO_MEM_RAM); cpu_register_physical_memory(PXA2XX_INTERNAL_BASE, 0x40000, qemu_ram_alloc(0x40000) | IO_MEM_RAM); s->pic = pxa2xx_pic_init(0x40d00000, s->env); s->dma = pxa27x_dma_init(0x40000000, s->pic[PXA2XX_PIC_DMA]); pxa27x_timer_init(0x40a00000, &s->pic[PXA2XX_PIC_OST_0], s->pic[PXA27X_PIC_OST_4_11]); s->gpio = pxa2xx_gpio_init(0x40e00000, s->env, s->pic, 121); s->mmc = pxa2xx_mmci_init(0x41100000, s->pic[PXA2XX_PIC_MMC], s->dma); for (i = 0; pxa270_serial[i].io_base; i ++) if (serial_hds[i]) serial_mm_init(pxa270_serial[i].io_base, 2, s->pic[pxa270_serial[i].irqn], serial_hds[i], 1); else break; if (serial_hds[i]) s->fir = pxa2xx_fir_init(0x40800000, s->pic[PXA2XX_PIC_ICP], s->dma, serial_hds[i]); if (ds) s->lcd = pxa2xx_lcdc_init(0x44000000, s->pic[PXA2XX_PIC_LCD], ds); s->cm_base = 0x41300000; s->cm_regs[CCCR >> 4] = 0x02000210; s->clkcfg = 0x00000009; iomemtype = cpu_register_io_memory(0, pxa2xx_cm_readfn, pxa2xx_cm_writefn, s); cpu_register_physical_memory(s->cm_base, 0xfff, iomemtype); register_savevm("pxa2xx_cm", 0, 0, pxa2xx_cm_save, pxa2xx_cm_load, s); cpu_arm_set_cp_io(s->env, 14, pxa2xx_cp14_read, pxa2xx_cp14_write, s); s->mm_base = 0x48000000; s->mm_regs[MDMRS >> 2] = 0x00020002; s->mm_regs[MDREFR >> 2] = 0x03ca4000; s->mm_regs[MECR >> 2] = 0x00000001; iomemtype = cpu_register_io_memory(0, pxa2xx_mm_readfn, pxa2xx_mm_writefn, s); cpu_register_physical_memory(s->mm_base, 0xfff, iomemtype); register_savevm("pxa2xx_mm", 0, 0, pxa2xx_mm_save, pxa2xx_mm_load, s); for (i = 0; pxa27x_ssp[i].io_base; i ++); s->ssp = (struct pxa2xx_ssp_s **) qemu_mallocz(sizeof(struct pxa2xx_ssp_s *) * i); ssp = (struct pxa2xx_ssp_s *) qemu_mallocz(sizeof(struct pxa2xx_ssp_s) * i); for (i = 0; pxa27x_ssp[i].io_base; i ++) { s->ssp[i] = &ssp[i]; ssp[i].base = pxa27x_ssp[i].io_base; ssp[i].irq = s->pic[pxa27x_ssp[i].irqn]; iomemtype = cpu_register_io_memory(0, pxa2xx_ssp_readfn, pxa2xx_ssp_writefn, &ssp[i]); cpu_register_physical_memory(ssp[i].base, 0xfff, iomemtype); register_savevm("pxa2xx_ssp", i, 0, pxa2xx_ssp_save, pxa2xx_ssp_load, s); } if (usb_enabled) { usb_ohci_init_pxa(0x4c000000, 3, -1, s->pic[PXA2XX_PIC_USBH1]); } s->pcmcia[0] = pxa2xx_pcmcia_init(0x20000000); s->pcmcia[1] = pxa2xx_pcmcia_init(0x30000000); s->rtc_base = 0x40900000; iomemtype = cpu_register_io_memory(0, pxa2xx_rtc_readfn, pxa2xx_rtc_writefn, s); cpu_register_physical_memory(s->rtc_base, 0xfff, iomemtype); pxa2xx_rtc_init(s); register_savevm("pxa2xx_rtc", 0, 0, pxa2xx_rtc_save, pxa2xx_rtc_load, s); s->i2c[0] = pxa2xx_i2c_init(0x40301600, s->pic[PXA2XX_PIC_I2C], 1); s->i2c[1] = pxa2xx_i2c_init(0x40f00100, s->pic[PXA2XX_PIC_PWRI2C], 0); s->pm_base = 0x40f00000; iomemtype = cpu_register_io_memory(0, pxa2xx_pm_readfn, pxa2xx_pm_writefn, s); cpu_register_physical_memory(s->pm_base, 0xfff, iomemtype); register_savevm("pxa2xx_pm", 0, 0, pxa2xx_pm_save, pxa2xx_pm_load, s); s->i2s = pxa2xx_i2s_init(0x40400000, s->pic[PXA2XX_PIC_I2S], s->dma); pxa2xx_gpio_handler_set(s->gpio, 1, pxa2xx_reset, s); return s; }
{ "code": [], "line_no": [] }
struct pxa2xx_state_s *FUNC_0(unsigned int VAR_0, DisplayState *VAR_1, const char *VAR_2) { struct pxa2xx_state_s *VAR_3; struct pxa2xx_ssp_s *VAR_4; int VAR_5, VAR_6; VAR_3 = (struct pxa2xx_state_s *) qemu_mallocz(sizeof(struct pxa2xx_state_s)); if (VAR_2 && strncmp(VAR_2, "pxa27", 5)) { fprintf(stderr, "Machine requires a PXA27x processor.\n"); exit(1); } VAR_3->env = cpu_init(); cpu_arm_set_model(VAR_3->env, VAR_2 ?: "pxa270"); register_savevm("cpu", 0, 0, cpu_save, cpu_load, VAR_3->env); cpu_register_physical_memory(PXA2XX_SDRAM_BASE, VAR_0, qemu_ram_alloc(VAR_0) | IO_MEM_RAM); cpu_register_physical_memory(PXA2XX_INTERNAL_BASE, 0x40000, qemu_ram_alloc(0x40000) | IO_MEM_RAM); VAR_3->pic = pxa2xx_pic_init(0x40d00000, VAR_3->env); VAR_3->dma = pxa27x_dma_init(0x40000000, VAR_3->pic[PXA2XX_PIC_DMA]); pxa27x_timer_init(0x40a00000, &VAR_3->pic[PXA2XX_PIC_OST_0], VAR_3->pic[PXA27X_PIC_OST_4_11]); VAR_3->gpio = pxa2xx_gpio_init(0x40e00000, VAR_3->env, VAR_3->pic, 121); VAR_3->mmc = pxa2xx_mmci_init(0x41100000, VAR_3->pic[PXA2XX_PIC_MMC], VAR_3->dma); for (VAR_6 = 0; pxa270_serial[VAR_6].io_base; VAR_6 ++) if (serial_hds[VAR_6]) serial_mm_init(pxa270_serial[VAR_6].io_base, 2, VAR_3->pic[pxa270_serial[VAR_6].irqn], serial_hds[VAR_6], 1); else break; if (serial_hds[VAR_6]) VAR_3->fir = pxa2xx_fir_init(0x40800000, VAR_3->pic[PXA2XX_PIC_ICP], VAR_3->dma, serial_hds[VAR_6]); if (VAR_1) VAR_3->lcd = pxa2xx_lcdc_init(0x44000000, VAR_3->pic[PXA2XX_PIC_LCD], VAR_1); VAR_3->cm_base = 0x41300000; VAR_3->cm_regs[CCCR >> 4] = 0x02000210; VAR_3->clkcfg = 0x00000009; VAR_5 = cpu_register_io_memory(0, pxa2xx_cm_readfn, pxa2xx_cm_writefn, VAR_3); cpu_register_physical_memory(VAR_3->cm_base, 0xfff, VAR_5); register_savevm("pxa2xx_cm", 0, 0, pxa2xx_cm_save, pxa2xx_cm_load, VAR_3); cpu_arm_set_cp_io(VAR_3->env, 14, pxa2xx_cp14_read, pxa2xx_cp14_write, VAR_3); VAR_3->mm_base = 0x48000000; VAR_3->mm_regs[MDMRS >> 2] = 0x00020002; VAR_3->mm_regs[MDREFR >> 2] = 0x03ca4000; VAR_3->mm_regs[MECR >> 2] = 0x00000001; VAR_5 = cpu_register_io_memory(0, pxa2xx_mm_readfn, pxa2xx_mm_writefn, VAR_3); cpu_register_physical_memory(VAR_3->mm_base, 0xfff, VAR_5); register_savevm("pxa2xx_mm", 0, 0, pxa2xx_mm_save, pxa2xx_mm_load, VAR_3); for (VAR_6 = 0; pxa27x_ssp[VAR_6].io_base; VAR_6 ++); VAR_3->VAR_4 = (struct pxa2xx_ssp_s **) qemu_mallocz(sizeof(struct pxa2xx_ssp_s *) * VAR_6); VAR_4 = (struct pxa2xx_ssp_s *) qemu_mallocz(sizeof(struct pxa2xx_ssp_s) * VAR_6); for (VAR_6 = 0; pxa27x_ssp[VAR_6].io_base; VAR_6 ++) { VAR_3->VAR_4[VAR_6] = &VAR_4[VAR_6]; VAR_4[VAR_6].base = pxa27x_ssp[VAR_6].io_base; VAR_4[VAR_6].irq = VAR_3->pic[pxa27x_ssp[VAR_6].irqn]; VAR_5 = cpu_register_io_memory(0, pxa2xx_ssp_readfn, pxa2xx_ssp_writefn, &VAR_4[VAR_6]); cpu_register_physical_memory(VAR_4[VAR_6].base, 0xfff, VAR_5); register_savevm("pxa2xx_ssp", VAR_6, 0, pxa2xx_ssp_save, pxa2xx_ssp_load, VAR_3); } if (usb_enabled) { usb_ohci_init_pxa(0x4c000000, 3, -1, VAR_3->pic[PXA2XX_PIC_USBH1]); } VAR_3->pcmcia[0] = pxa2xx_pcmcia_init(0x20000000); VAR_3->pcmcia[1] = pxa2xx_pcmcia_init(0x30000000); VAR_3->rtc_base = 0x40900000; VAR_5 = cpu_register_io_memory(0, pxa2xx_rtc_readfn, pxa2xx_rtc_writefn, VAR_3); cpu_register_physical_memory(VAR_3->rtc_base, 0xfff, VAR_5); pxa2xx_rtc_init(VAR_3); register_savevm("pxa2xx_rtc", 0, 0, pxa2xx_rtc_save, pxa2xx_rtc_load, VAR_3); VAR_3->i2c[0] = pxa2xx_i2c_init(0x40301600, VAR_3->pic[PXA2XX_PIC_I2C], 1); VAR_3->i2c[1] = pxa2xx_i2c_init(0x40f00100, VAR_3->pic[PXA2XX_PIC_PWRI2C], 0); VAR_3->pm_base = 0x40f00000; VAR_5 = cpu_register_io_memory(0, pxa2xx_pm_readfn, pxa2xx_pm_writefn, VAR_3); cpu_register_physical_memory(VAR_3->pm_base, 0xfff, VAR_5); register_savevm("pxa2xx_pm", 0, 0, pxa2xx_pm_save, pxa2xx_pm_load, VAR_3); VAR_3->i2s = pxa2xx_i2s_init(0x40400000, VAR_3->pic[PXA2XX_PIC_I2S], VAR_3->dma); pxa2xx_gpio_handler_set(VAR_3->gpio, 1, pxa2xx_reset, VAR_3); return VAR_3; }
[ "struct pxa2xx_state_s *FUNC_0(unsigned int VAR_0,\nDisplayState *VAR_1, const char *VAR_2)\n{", "struct pxa2xx_state_s *VAR_3;", "struct pxa2xx_ssp_s *VAR_4;", "int VAR_5, VAR_6;", "VAR_3 = (struct pxa2xx_state_s *) qemu_mallocz(sizeof(struct pxa2xx_state_s));", "if (VAR_2 && strncmp(VAR_2, \"pxa27\", 5)) {", "fprintf(stderr, \"Machine requires a PXA27x processor.\\n\");", "exit(1);", "}", "VAR_3->env = cpu_init();", "cpu_arm_set_model(VAR_3->env, VAR_2 ?: \"pxa270\");", "register_savevm(\"cpu\", 0, 0, cpu_save, cpu_load, VAR_3->env);", "cpu_register_physical_memory(PXA2XX_SDRAM_BASE,\nVAR_0, qemu_ram_alloc(VAR_0) | IO_MEM_RAM);", "cpu_register_physical_memory(PXA2XX_INTERNAL_BASE,\n0x40000, qemu_ram_alloc(0x40000) | IO_MEM_RAM);", "VAR_3->pic = pxa2xx_pic_init(0x40d00000, VAR_3->env);", "VAR_3->dma = pxa27x_dma_init(0x40000000, VAR_3->pic[PXA2XX_PIC_DMA]);", "pxa27x_timer_init(0x40a00000, &VAR_3->pic[PXA2XX_PIC_OST_0],\nVAR_3->pic[PXA27X_PIC_OST_4_11]);", "VAR_3->gpio = pxa2xx_gpio_init(0x40e00000, VAR_3->env, VAR_3->pic, 121);", "VAR_3->mmc = pxa2xx_mmci_init(0x41100000, VAR_3->pic[PXA2XX_PIC_MMC], VAR_3->dma);", "for (VAR_6 = 0; pxa270_serial[VAR_6].io_base; VAR_6 ++)", "if (serial_hds[VAR_6])\nserial_mm_init(pxa270_serial[VAR_6].io_base, 2,\nVAR_3->pic[pxa270_serial[VAR_6].irqn], serial_hds[VAR_6], 1);", "else\nbreak;", "if (serial_hds[VAR_6])\nVAR_3->fir = pxa2xx_fir_init(0x40800000, VAR_3->pic[PXA2XX_PIC_ICP],\nVAR_3->dma, serial_hds[VAR_6]);", "if (VAR_1)\nVAR_3->lcd = pxa2xx_lcdc_init(0x44000000, VAR_3->pic[PXA2XX_PIC_LCD], VAR_1);", "VAR_3->cm_base = 0x41300000;", "VAR_3->cm_regs[CCCR >> 4] = 0x02000210;", "VAR_3->clkcfg = 0x00000009;", "VAR_5 = cpu_register_io_memory(0, pxa2xx_cm_readfn,\npxa2xx_cm_writefn, VAR_3);", "cpu_register_physical_memory(VAR_3->cm_base, 0xfff, VAR_5);", "register_savevm(\"pxa2xx_cm\", 0, 0, pxa2xx_cm_save, pxa2xx_cm_load, VAR_3);", "cpu_arm_set_cp_io(VAR_3->env, 14, pxa2xx_cp14_read, pxa2xx_cp14_write, VAR_3);", "VAR_3->mm_base = 0x48000000;", "VAR_3->mm_regs[MDMRS >> 2] = 0x00020002;", "VAR_3->mm_regs[MDREFR >> 2] = 0x03ca4000;", "VAR_3->mm_regs[MECR >> 2] = 0x00000001;", "VAR_5 = cpu_register_io_memory(0, pxa2xx_mm_readfn,\npxa2xx_mm_writefn, VAR_3);", "cpu_register_physical_memory(VAR_3->mm_base, 0xfff, VAR_5);", "register_savevm(\"pxa2xx_mm\", 0, 0, pxa2xx_mm_save, pxa2xx_mm_load, VAR_3);", "for (VAR_6 = 0; pxa27x_ssp[VAR_6].io_base; VAR_6 ++);", "VAR_3->VAR_4 = (struct pxa2xx_ssp_s **)\nqemu_mallocz(sizeof(struct pxa2xx_ssp_s *) * VAR_6);", "VAR_4 = (struct pxa2xx_ssp_s *)\nqemu_mallocz(sizeof(struct pxa2xx_ssp_s) * VAR_6);", "for (VAR_6 = 0; pxa27x_ssp[VAR_6].io_base; VAR_6 ++) {", "VAR_3->VAR_4[VAR_6] = &VAR_4[VAR_6];", "VAR_4[VAR_6].base = pxa27x_ssp[VAR_6].io_base;", "VAR_4[VAR_6].irq = VAR_3->pic[pxa27x_ssp[VAR_6].irqn];", "VAR_5 = cpu_register_io_memory(0, pxa2xx_ssp_readfn,\npxa2xx_ssp_writefn, &VAR_4[VAR_6]);", "cpu_register_physical_memory(VAR_4[VAR_6].base, 0xfff, VAR_5);", "register_savevm(\"pxa2xx_ssp\", VAR_6, 0,\npxa2xx_ssp_save, pxa2xx_ssp_load, VAR_3);", "}", "if (usb_enabled) {", "usb_ohci_init_pxa(0x4c000000, 3, -1, VAR_3->pic[PXA2XX_PIC_USBH1]);", "}", "VAR_3->pcmcia[0] = pxa2xx_pcmcia_init(0x20000000);", "VAR_3->pcmcia[1] = pxa2xx_pcmcia_init(0x30000000);", "VAR_3->rtc_base = 0x40900000;", "VAR_5 = cpu_register_io_memory(0, pxa2xx_rtc_readfn,\npxa2xx_rtc_writefn, VAR_3);", "cpu_register_physical_memory(VAR_3->rtc_base, 0xfff, VAR_5);", "pxa2xx_rtc_init(VAR_3);", "register_savevm(\"pxa2xx_rtc\", 0, 0, pxa2xx_rtc_save, pxa2xx_rtc_load, VAR_3);", "VAR_3->i2c[0] = pxa2xx_i2c_init(0x40301600, VAR_3->pic[PXA2XX_PIC_I2C], 1);", "VAR_3->i2c[1] = pxa2xx_i2c_init(0x40f00100, VAR_3->pic[PXA2XX_PIC_PWRI2C], 0);", "VAR_3->pm_base = 0x40f00000;", "VAR_5 = cpu_register_io_memory(0, pxa2xx_pm_readfn,\npxa2xx_pm_writefn, VAR_3);", "cpu_register_physical_memory(VAR_3->pm_base, 0xfff, VAR_5);", "register_savevm(\"pxa2xx_pm\", 0, 0, pxa2xx_pm_save, pxa2xx_pm_load, VAR_3);", "VAR_3->i2s = pxa2xx_i2s_init(0x40400000, VAR_3->pic[PXA2XX_PIC_I2S], VAR_3->dma);", "pxa2xx_gpio_handler_set(VAR_3->gpio, 1, pxa2xx_reset, VAR_3);", "return VAR_3;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 37, 39 ], [ 41, 43 ], [ 47 ], [ 51 ], [ 55, 57 ], [ 61 ], [ 65 ], [ 69 ], [ 71, 73, 75 ], [ 77, 79 ], [ 81, 83, 85 ], [ 89, 91 ], [ 95 ], [ 97 ], [ 99 ], [ 101, 103 ], [ 105 ], [ 107 ], [ 111 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123, 125 ], [ 127 ], [ 129 ], [ 133 ], [ 135, 137 ], [ 139, 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 153, 155 ], [ 157 ], [ 159, 161 ], [ 163 ], [ 167 ], [ 169 ], [ 171 ], [ 175 ], [ 177 ], [ 181 ], [ 183, 185 ], [ 187 ], [ 189 ], [ 191 ], [ 201 ], [ 203 ], [ 207 ], [ 209, 211 ], [ 213 ], [ 215 ], [ 219 ], [ 227 ], [ 229 ], [ 231 ] ]
17,967
static int qemu_rbd_snap_rollback(BlockDriverState *bs, const char *snapshot_name) { BDRVRBDState *s = bs->opaque; int r; r = rbd_snap_rollback(s->image, snapshot_name); return r; }
false
qemu
9be385980d37e8f4fd33f605f5fb1c3d144170a8
static int qemu_rbd_snap_rollback(BlockDriverState *bs, const char *snapshot_name) { BDRVRBDState *s = bs->opaque; int r; r = rbd_snap_rollback(s->image, snapshot_name); return r; }
{ "code": [], "line_no": [] }
static int FUNC_0(BlockDriverState *VAR_0, const char *VAR_1) { BDRVRBDState *s = VAR_0->opaque; int VAR_2; VAR_2 = rbd_snap_rollback(s->image, VAR_1); return VAR_2; }
[ "static int FUNC_0(BlockDriverState *VAR_0,\nconst char *VAR_1)\n{", "BDRVRBDState *s = VAR_0->opaque;", "int VAR_2;", "VAR_2 = rbd_snap_rollback(s->image, VAR_1);", "return VAR_2;", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ] ]
17,968
static void test_visitor_out_empty(TestOutputVisitorData *data, const void *unused) { QObject *arg; arg = qmp_output_get_qobject(data->qov); g_assert(qobject_type(arg) == QTYPE_QNULL); /* Check that qnull reference counting is sane */ g_assert(arg->refcnt == 2); qobject_decref(arg); }
false
qemu
7d7a337ec32c77f11ba04da412752b35e18d3c5c
static void test_visitor_out_empty(TestOutputVisitorData *data, const void *unused) { QObject *arg; arg = qmp_output_get_qobject(data->qov); g_assert(qobject_type(arg) == QTYPE_QNULL); g_assert(arg->refcnt == 2); qobject_decref(arg); }
{ "code": [], "line_no": [] }
static void FUNC_0(TestOutputVisitorData *VAR_0, const void *VAR_1) { QObject *arg; arg = qmp_output_get_qobject(VAR_0->qov); g_assert(qobject_type(arg) == QTYPE_QNULL); g_assert(arg->refcnt == 2); qobject_decref(arg); }
[ "static void FUNC_0(TestOutputVisitorData *VAR_0,\nconst void *VAR_1)\n{", "QObject *arg;", "arg = qmp_output_get_qobject(VAR_0->qov);", "g_assert(qobject_type(arg) == QTYPE_QNULL);", "g_assert(arg->refcnt == 2);", "qobject_decref(arg);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ] ]
17,969
void qio_dns_resolver_lookup_result(QIODNSResolver *resolver, QIOTask *task, size_t *naddrs, SocketAddressLegacy ***addrs) { struct QIODNSResolverLookupData *data = qio_task_get_result_pointer(task); size_t i; *naddrs = 0; *addrs = NULL; if (!data) { return; } *naddrs = data->naddrs; *addrs = g_new0(SocketAddressLegacy *, data->naddrs); for (i = 0; i < data->naddrs; i++) { (*addrs)[i] = QAPI_CLONE(SocketAddressLegacy, data->addrs[i]); } }
false
qemu
bd269ebc82fbaa5fe7ce5bc7c1770ac8acecd884
void qio_dns_resolver_lookup_result(QIODNSResolver *resolver, QIOTask *task, size_t *naddrs, SocketAddressLegacy ***addrs) { struct QIODNSResolverLookupData *data = qio_task_get_result_pointer(task); size_t i; *naddrs = 0; *addrs = NULL; if (!data) { return; } *naddrs = data->naddrs; *addrs = g_new0(SocketAddressLegacy *, data->naddrs); for (i = 0; i < data->naddrs; i++) { (*addrs)[i] = QAPI_CLONE(SocketAddressLegacy, data->addrs[i]); } }
{ "code": [], "line_no": [] }
void FUNC_0(QIODNSResolver *VAR_0, QIOTask *VAR_1, size_t *VAR_2, SocketAddressLegacy ***VAR_3) { struct QIODNSResolverLookupData *VAR_4 = qio_task_get_result_pointer(VAR_1); size_t i; *VAR_2 = 0; *VAR_3 = NULL; if (!VAR_4) { return; } *VAR_2 = VAR_4->VAR_2; *VAR_3 = g_new0(SocketAddressLegacy *, VAR_4->VAR_2); for (i = 0; i < VAR_4->VAR_2; i++) { (*VAR_3)[i] = QAPI_CLONE(SocketAddressLegacy, VAR_4->VAR_3[i]); } }
[ "void FUNC_0(QIODNSResolver *VAR_0,\nQIOTask *VAR_1,\nsize_t *VAR_2,\nSocketAddressLegacy ***VAR_3)\n{", "struct QIODNSResolverLookupData *VAR_4 =\nqio_task_get_result_pointer(VAR_1);", "size_t i;", "*VAR_2 = 0;", "*VAR_3 = NULL;", "if (!VAR_4) {", "return;", "}", "*VAR_2 = VAR_4->VAR_2;", "*VAR_3 = g_new0(SocketAddressLegacy *, VAR_4->VAR_2);", "for (i = 0; i < VAR_4->VAR_2; i++) {", "(*VAR_3)[i] = QAPI_CLONE(SocketAddressLegacy, VAR_4->VAR_3[i]);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11, 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ] ]
17,970
iscsi_co_generic_cb(struct iscsi_context *iscsi, int status, void *command_data, void *opaque) { struct IscsiTask *iTask = opaque; struct scsi_task *task = command_data; iTask->status = status; iTask->do_retry = 0; iTask->task = task; if (status != SCSI_STATUS_GOOD) { if (iTask->retries++ < ISCSI_CMD_RETRIES) { if (status == SCSI_STATUS_CHECK_CONDITION && task->sense.key == SCSI_SENSE_UNIT_ATTENTION) { error_report("iSCSI CheckCondition: %s", iscsi_get_error(iscsi)); iTask->do_retry = 1; goto out; } if (status == SCSI_STATUS_BUSY || status == SCSI_STATUS_TIMEOUT || status == SCSI_STATUS_TASK_SET_FULL) { unsigned retry_time = exp_random(iscsi_retry_times[iTask->retries - 1]); if (status == SCSI_STATUS_TIMEOUT) { /* make sure the request is rescheduled AFTER the * reconnect is initiated */ retry_time = EVENT_INTERVAL * 2; iTask->iscsilun->request_timed_out = true; } error_report("iSCSI Busy/TaskSetFull/TimeOut" " (retry #%u in %u ms): %s", iTask->retries, retry_time, iscsi_get_error(iscsi)); aio_timer_init(iTask->iscsilun->aio_context, &iTask->retry_timer, QEMU_CLOCK_REALTIME, SCALE_MS, iscsi_retry_timer_expired, iTask); timer_mod(&iTask->retry_timer, qemu_clock_get_ms(QEMU_CLOCK_REALTIME) + retry_time); iTask->do_retry = 1; return; } } iTask->err_code = iscsi_translate_sense(&task->sense); error_report("iSCSI Failure: %s", iscsi_get_error(iscsi)); } else { iTask->iscsilun->force_next_flush |= iTask->force_next_flush; } out: if (iTask->co) { iTask->bh = aio_bh_new(iTask->iscsilun->aio_context, iscsi_co_generic_bh_cb, iTask); qemu_bh_schedule(iTask->bh); } else { iTask->complete = 1; } }
false
qemu
9f0eb9e129398d8907ec990b18c03f20ee0de15e
iscsi_co_generic_cb(struct iscsi_context *iscsi, int status, void *command_data, void *opaque) { struct IscsiTask *iTask = opaque; struct scsi_task *task = command_data; iTask->status = status; iTask->do_retry = 0; iTask->task = task; if (status != SCSI_STATUS_GOOD) { if (iTask->retries++ < ISCSI_CMD_RETRIES) { if (status == SCSI_STATUS_CHECK_CONDITION && task->sense.key == SCSI_SENSE_UNIT_ATTENTION) { error_report("iSCSI CheckCondition: %s", iscsi_get_error(iscsi)); iTask->do_retry = 1; goto out; } if (status == SCSI_STATUS_BUSY || status == SCSI_STATUS_TIMEOUT || status == SCSI_STATUS_TASK_SET_FULL) { unsigned retry_time = exp_random(iscsi_retry_times[iTask->retries - 1]); if (status == SCSI_STATUS_TIMEOUT) { retry_time = EVENT_INTERVAL * 2; iTask->iscsilun->request_timed_out = true; } error_report("iSCSI Busy/TaskSetFull/TimeOut" " (retry #%u in %u ms): %s", iTask->retries, retry_time, iscsi_get_error(iscsi)); aio_timer_init(iTask->iscsilun->aio_context, &iTask->retry_timer, QEMU_CLOCK_REALTIME, SCALE_MS, iscsi_retry_timer_expired, iTask); timer_mod(&iTask->retry_timer, qemu_clock_get_ms(QEMU_CLOCK_REALTIME) + retry_time); iTask->do_retry = 1; return; } } iTask->err_code = iscsi_translate_sense(&task->sense); error_report("iSCSI Failure: %s", iscsi_get_error(iscsi)); } else { iTask->iscsilun->force_next_flush |= iTask->force_next_flush; } out: if (iTask->co) { iTask->bh = aio_bh_new(iTask->iscsilun->aio_context, iscsi_co_generic_bh_cb, iTask); qemu_bh_schedule(iTask->bh); } else { iTask->complete = 1; } }
{ "code": [], "line_no": [] }
FUNC_0(struct iscsi_context *VAR_0, int VAR_1, void *VAR_2, void *VAR_3) { struct IscsiTask *VAR_4 = VAR_3; struct scsi_task *VAR_5 = VAR_2; VAR_4->VAR_1 = VAR_1; VAR_4->do_retry = 0; VAR_4->VAR_5 = VAR_5; if (VAR_1 != SCSI_STATUS_GOOD) { if (VAR_4->retries++ < ISCSI_CMD_RETRIES) { if (VAR_1 == SCSI_STATUS_CHECK_CONDITION && VAR_5->sense.key == SCSI_SENSE_UNIT_ATTENTION) { error_report("iSCSI CheckCondition: %s", iscsi_get_error(VAR_0)); VAR_4->do_retry = 1; goto out; } if (VAR_1 == SCSI_STATUS_BUSY || VAR_1 == SCSI_STATUS_TIMEOUT || VAR_1 == SCSI_STATUS_TASK_SET_FULL) { unsigned VAR_6 = exp_random(iscsi_retry_times[VAR_4->retries - 1]); if (VAR_1 == SCSI_STATUS_TIMEOUT) { VAR_6 = EVENT_INTERVAL * 2; VAR_4->iscsilun->request_timed_out = true; } error_report("iSCSI Busy/TaskSetFull/TimeOut" " (retry #%u in %u ms): %s", VAR_4->retries, VAR_6, iscsi_get_error(VAR_0)); aio_timer_init(VAR_4->iscsilun->aio_context, &VAR_4->retry_timer, QEMU_CLOCK_REALTIME, SCALE_MS, iscsi_retry_timer_expired, VAR_4); timer_mod(&VAR_4->retry_timer, qemu_clock_get_ms(QEMU_CLOCK_REALTIME) + VAR_6); VAR_4->do_retry = 1; return; } } VAR_4->err_code = iscsi_translate_sense(&VAR_5->sense); error_report("iSCSI Failure: %s", iscsi_get_error(VAR_0)); } else { VAR_4->iscsilun->force_next_flush |= VAR_4->force_next_flush; } out: if (VAR_4->co) { VAR_4->bh = aio_bh_new(VAR_4->iscsilun->aio_context, iscsi_co_generic_bh_cb, VAR_4); qemu_bh_schedule(VAR_4->bh); } else { VAR_4->complete = 1; } }
[ "FUNC_0(struct iscsi_context *VAR_0, int VAR_1,\nvoid *VAR_2, void *VAR_3)\n{", "struct IscsiTask *VAR_4 = VAR_3;", "struct scsi_task *VAR_5 = VAR_2;", "VAR_4->VAR_1 = VAR_1;", "VAR_4->do_retry = 0;", "VAR_4->VAR_5 = VAR_5;", "if (VAR_1 != SCSI_STATUS_GOOD) {", "if (VAR_4->retries++ < ISCSI_CMD_RETRIES) {", "if (VAR_1 == SCSI_STATUS_CHECK_CONDITION\n&& VAR_5->sense.key == SCSI_SENSE_UNIT_ATTENTION) {", "error_report(\"iSCSI CheckCondition: %s\",\niscsi_get_error(VAR_0));", "VAR_4->do_retry = 1;", "goto out;", "}", "if (VAR_1 == SCSI_STATUS_BUSY ||\nVAR_1 == SCSI_STATUS_TIMEOUT ||\nVAR_1 == SCSI_STATUS_TASK_SET_FULL) {", "unsigned VAR_6 =\nexp_random(iscsi_retry_times[VAR_4->retries - 1]);", "if (VAR_1 == SCSI_STATUS_TIMEOUT) {", "VAR_6 = EVENT_INTERVAL * 2;", "VAR_4->iscsilun->request_timed_out = true;", "}", "error_report(\"iSCSI Busy/TaskSetFull/TimeOut\"\n\" (retry #%u in %u ms): %s\",\nVAR_4->retries, VAR_6,\niscsi_get_error(VAR_0));", "aio_timer_init(VAR_4->iscsilun->aio_context,\n&VAR_4->retry_timer, QEMU_CLOCK_REALTIME,\nSCALE_MS, iscsi_retry_timer_expired, VAR_4);", "timer_mod(&VAR_4->retry_timer,\nqemu_clock_get_ms(QEMU_CLOCK_REALTIME) + VAR_6);", "VAR_4->do_retry = 1;", "return;", "}", "}", "VAR_4->err_code = iscsi_translate_sense(&VAR_5->sense);", "error_report(\"iSCSI Failure: %s\", iscsi_get_error(VAR_0));", "} else {", "VAR_4->iscsilun->force_next_flush |= VAR_4->force_next_flush;", "}", "out:\nif (VAR_4->co) {", "VAR_4->bh = aio_bh_new(VAR_4->iscsilun->aio_context,\niscsi_co_generic_bh_cb, VAR_4);", "qemu_bh_schedule(VAR_4->bh);", "} else {", "VAR_4->complete = 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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25, 27 ], [ 29, 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39, 41, 43 ], [ 45, 47 ], [ 49 ], [ 55 ], [ 57 ], [ 59 ], [ 61, 63, 65, 67 ], [ 69, 71, 73 ], [ 75, 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99, 101 ], [ 103, 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ] ]
17,971
void cpu_exec_exit(CPUState *cpu) { if (cpu->cpu_index == -1) { /* cpu_index was never allocated by this @cpu or was already freed. */ return; } bitmap_clear(cpu_index_map, cpu->cpu_index, 1); cpu->cpu_index = -1; }
false
qemu
1c59eb39cf75e660b1ac4ea95ef789c84021a1c4
void cpu_exec_exit(CPUState *cpu) { if (cpu->cpu_index == -1) { return; } bitmap_clear(cpu_index_map, cpu->cpu_index, 1); cpu->cpu_index = -1; }
{ "code": [], "line_no": [] }
void FUNC_0(CPUState *VAR_0) { if (VAR_0->cpu_index == -1) { return; } bitmap_clear(cpu_index_map, VAR_0->cpu_index, 1); VAR_0->cpu_index = -1; }
[ "void FUNC_0(CPUState *VAR_0)\n{", "if (VAR_0->cpu_index == -1) {", "return;", "}", "bitmap_clear(cpu_index_map, VAR_0->cpu_index, 1);", "VAR_0->cpu_index = -1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ] ]
17,973
build_header(GArray *linker, GArray *table_data, AcpiTableHeader *h, const char *sig, int len, uint8_t rev, const char *oem_id, const char *oem_table_id) { memcpy(&h->signature, sig, 4); h->length = cpu_to_le32(len); h->revision = rev; if (oem_id) { strncpy((char *)h->oem_id, oem_id, sizeof h->oem_id); } else { memcpy(h->oem_id, ACPI_BUILD_APPNAME6, 6); } if (oem_table_id) { strncpy((char *)h->oem_table_id, oem_table_id, sizeof(h->oem_table_id)); } else { memcpy(h->oem_table_id, ACPI_BUILD_APPNAME4, 4); memcpy(h->oem_table_id + 4, sig, 4); } h->oem_revision = cpu_to_le32(1); memcpy(h->asl_compiler_id, ACPI_BUILD_APPNAME4, 4); h->asl_compiler_revision = cpu_to_le32(1); h->checksum = 0; /* Checksum to be filled in by Guest linker */ bios_linker_loader_add_checksum(linker, ACPI_BUILD_TABLE_FILE, table_data, h, len, &h->checksum); }
false
qemu
0e9b9edae7bebfd31fdbead4ccbbce03876a7edd
build_header(GArray *linker, GArray *table_data, AcpiTableHeader *h, const char *sig, int len, uint8_t rev, const char *oem_id, const char *oem_table_id) { memcpy(&h->signature, sig, 4); h->length = cpu_to_le32(len); h->revision = rev; if (oem_id) { strncpy((char *)h->oem_id, oem_id, sizeof h->oem_id); } else { memcpy(h->oem_id, ACPI_BUILD_APPNAME6, 6); } if (oem_table_id) { strncpy((char *)h->oem_table_id, oem_table_id, sizeof(h->oem_table_id)); } else { memcpy(h->oem_table_id, ACPI_BUILD_APPNAME4, 4); memcpy(h->oem_table_id + 4, sig, 4); } h->oem_revision = cpu_to_le32(1); memcpy(h->asl_compiler_id, ACPI_BUILD_APPNAME4, 4); h->asl_compiler_revision = cpu_to_le32(1); h->checksum = 0; bios_linker_loader_add_checksum(linker, ACPI_BUILD_TABLE_FILE, table_data, h, len, &h->checksum); }
{ "code": [], "line_no": [] }
FUNC_0(GArray *VAR_0, GArray *VAR_1, AcpiTableHeader *VAR_2, const char *VAR_3, int VAR_4, uint8_t VAR_5, const char *VAR_6, const char *VAR_7) { memcpy(&VAR_2->signature, VAR_3, 4); VAR_2->length = cpu_to_le32(VAR_4); VAR_2->revision = VAR_5; if (VAR_6) { strncpy((char *)VAR_2->VAR_6, VAR_6, sizeof VAR_2->VAR_6); } else { memcpy(VAR_2->VAR_6, ACPI_BUILD_APPNAME6, 6); } if (VAR_7) { strncpy((char *)VAR_2->VAR_7, VAR_7, sizeof(VAR_2->VAR_7)); } else { memcpy(VAR_2->VAR_7, ACPI_BUILD_APPNAME4, 4); memcpy(VAR_2->VAR_7 + 4, VAR_3, 4); } VAR_2->oem_revision = cpu_to_le32(1); memcpy(VAR_2->asl_compiler_id, ACPI_BUILD_APPNAME4, 4); VAR_2->asl_compiler_revision = cpu_to_le32(1); VAR_2->checksum = 0; bios_linker_loader_add_checksum(VAR_0, ACPI_BUILD_TABLE_FILE, VAR_1, VAR_2, VAR_4, &VAR_2->checksum); }
[ "FUNC_0(GArray *VAR_0, GArray *VAR_1,\nAcpiTableHeader *VAR_2, const char *VAR_3, int VAR_4, uint8_t VAR_5,\nconst char *VAR_6, const char *VAR_7)\n{", "memcpy(&VAR_2->signature, VAR_3, 4);", "VAR_2->length = cpu_to_le32(VAR_4);", "VAR_2->revision = VAR_5;", "if (VAR_6) {", "strncpy((char *)VAR_2->VAR_6, VAR_6, sizeof VAR_2->VAR_6);", "} else {", "memcpy(VAR_2->VAR_6, ACPI_BUILD_APPNAME6, 6);", "}", "if (VAR_7) {", "strncpy((char *)VAR_2->VAR_7, VAR_7, sizeof(VAR_2->VAR_7));", "} else {", "memcpy(VAR_2->VAR_7, ACPI_BUILD_APPNAME4, 4);", "memcpy(VAR_2->VAR_7 + 4, VAR_3, 4);", "}", "VAR_2->oem_revision = cpu_to_le32(1);", "memcpy(VAR_2->asl_compiler_id, ACPI_BUILD_APPNAME4, 4);", "VAR_2->asl_compiler_revision = cpu_to_le32(1);", "VAR_2->checksum = 0;", "bios_linker_loader_add_checksum(VAR_0, ACPI_BUILD_TABLE_FILE,\nVAR_1, VAR_2, VAR_4, &VAR_2->checksum);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53, 55 ], [ 57 ] ]
17,974
static int kvm_has_msr_hsave_pa(CPUState *env) { kvm_supported_msrs(env); return has_msr_hsave_pa; }
false
qemu
c3a3a7d356c4df2fe145037172ae52cba5f545a5
static int kvm_has_msr_hsave_pa(CPUState *env) { kvm_supported_msrs(env); return has_msr_hsave_pa; }
{ "code": [], "line_no": [] }
static int FUNC_0(CPUState *VAR_0) { kvm_supported_msrs(VAR_0); return has_msr_hsave_pa; }
[ "static int FUNC_0(CPUState *VAR_0)\n{", "kvm_supported_msrs(VAR_0);", "return has_msr_hsave_pa;", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
17,975
static void sd_cardchange(void *opaque, bool load) { SDState *sd = opaque; qemu_set_irq(sd->inserted_cb, blk_is_inserted(sd->blk)); if (blk_is_inserted(sd->blk)) { sd_reset(DEVICE(sd)); qemu_set_irq(sd->readonly_cb, sd->wp_switch); } }
false
qemu
c759a790b672b0c5bfc50520dcc93565b55732b3
static void sd_cardchange(void *opaque, bool load) { SDState *sd = opaque; qemu_set_irq(sd->inserted_cb, blk_is_inserted(sd->blk)); if (blk_is_inserted(sd->blk)) { sd_reset(DEVICE(sd)); qemu_set_irq(sd->readonly_cb, sd->wp_switch); } }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, bool VAR_1) { SDState *sd = VAR_0; qemu_set_irq(sd->inserted_cb, blk_is_inserted(sd->blk)); if (blk_is_inserted(sd->blk)) { sd_reset(DEVICE(sd)); qemu_set_irq(sd->readonly_cb, sd->wp_switch); } }
[ "static void FUNC_0(void *VAR_0, bool VAR_1)\n{", "SDState *sd = VAR_0;", "qemu_set_irq(sd->inserted_cb, blk_is_inserted(sd->blk));", "if (blk_is_inserted(sd->blk)) {", "sd_reset(DEVICE(sd));", "qemu_set_irq(sd->readonly_cb, sd->wp_switch);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ] ]
17,976
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *pkt) { GetBitContext gb; VimaContext *vima = avctx->priv_data; int16_t pcm_data[2]; uint32_t samples; int8_t channel_hint[2]; int ret, chan, channels = 1; init_get_bits(&gb, pkt->data, pkt->size * 8); if (pkt->size < 13) return AVERROR_INVALIDDATA; samples = get_bits_long(&gb, 32); if (samples == 0xffffffff) { skip_bits_long(&gb, 32); samples = get_bits_long(&gb, 32); } if (samples > pkt->size * 2) return AVERROR_INVALIDDATA; channel_hint[0] = get_sbits(&gb, 8); if (channel_hint[0] & 0x80) { channel_hint[0] = ~channel_hint[0]; channels = 2; } avctx->channels = channels; avctx->channel_layout = (channels == 2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO; pcm_data[0] = get_sbits(&gb, 16); if (channels > 1) { channel_hint[1] = get_sbits(&gb, 8); pcm_data[1] = get_sbits(&gb, 16); } vima->frame.nb_samples = samples; if ((ret = avctx->get_buffer(avctx, &vima->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } for (chan = 0; chan < channels; chan++) { uint16_t *dest = (uint16_t*)vima->frame.data[0] + chan; int step_index = channel_hint[chan]; int output = pcm_data[chan]; int sample; for (sample = 0; sample < samples; sample++) { int lookup_size, lookup, highbit, lowbits; step_index = av_clip(step_index, 0, 88); lookup_size = size_table[step_index]; lookup = get_bits(&gb, lookup_size); highbit = 1 << (lookup_size - 1); lowbits = highbit - 1; if (lookup & highbit) lookup ^= highbit; else highbit = 0; if (lookup == lowbits) { output = get_sbits(&gb, 16); } else { int predict_index, diff; predict_index = (lookup << (7 - lookup_size)) | (step_index << 6); predict_index = av_clip(predict_index, 0, 5785); diff = vima->predict_table[predict_index]; if (lookup) diff += ff_adpcm_step_table[step_index] >> (lookup_size - 1); if (highbit) diff = -diff; output = av_clip_int16(output + diff); } *dest = output; dest += channels; step_index += step_index_tables[lookup_size - 2][lookup]; } } *got_frame_ptr = 1; *(AVFrame *)data = vima->frame; return pkt->size; }
false
FFmpeg
857797bc1455468f9d70565ac087c3f57d8e67ff
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *pkt) { GetBitContext gb; VimaContext *vima = avctx->priv_data; int16_t pcm_data[2]; uint32_t samples; int8_t channel_hint[2]; int ret, chan, channels = 1; init_get_bits(&gb, pkt->data, pkt->size * 8); if (pkt->size < 13) return AVERROR_INVALIDDATA; samples = get_bits_long(&gb, 32); if (samples == 0xffffffff) { skip_bits_long(&gb, 32); samples = get_bits_long(&gb, 32); } if (samples > pkt->size * 2) return AVERROR_INVALIDDATA; channel_hint[0] = get_sbits(&gb, 8); if (channel_hint[0] & 0x80) { channel_hint[0] = ~channel_hint[0]; channels = 2; } avctx->channels = channels; avctx->channel_layout = (channels == 2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO; pcm_data[0] = get_sbits(&gb, 16); if (channels > 1) { channel_hint[1] = get_sbits(&gb, 8); pcm_data[1] = get_sbits(&gb, 16); } vima->frame.nb_samples = samples; if ((ret = avctx->get_buffer(avctx, &vima->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } for (chan = 0; chan < channels; chan++) { uint16_t *dest = (uint16_t*)vima->frame.data[0] + chan; int step_index = channel_hint[chan]; int output = pcm_data[chan]; int sample; for (sample = 0; sample < samples; sample++) { int lookup_size, lookup, highbit, lowbits; step_index = av_clip(step_index, 0, 88); lookup_size = size_table[step_index]; lookup = get_bits(&gb, lookup_size); highbit = 1 << (lookup_size - 1); lowbits = highbit - 1; if (lookup & highbit) lookup ^= highbit; else highbit = 0; if (lookup == lowbits) { output = get_sbits(&gb, 16); } else { int predict_index, diff; predict_index = (lookup << (7 - lookup_size)) | (step_index << 6); predict_index = av_clip(predict_index, 0, 5785); diff = vima->predict_table[predict_index]; if (lookup) diff += ff_adpcm_step_table[step_index] >> (lookup_size - 1); if (highbit) diff = -diff; output = av_clip_int16(output + diff); } *dest = output; dest += channels; step_index += step_index_tables[lookup_size - 2][lookup]; } } *got_frame_ptr = 1; *(AVFrame *)data = vima->frame; return pkt->size; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3) { GetBitContext gb; VimaContext *vima = VAR_0->priv_data; int16_t pcm_data[2]; uint32_t samples; int8_t channel_hint[2]; int VAR_4, VAR_5, VAR_6 = 1; init_get_bits(&gb, VAR_3->VAR_1, VAR_3->size * 8); if (VAR_3->size < 13) return AVERROR_INVALIDDATA; samples = get_bits_long(&gb, 32); if (samples == 0xffffffff) { skip_bits_long(&gb, 32); samples = get_bits_long(&gb, 32); } if (samples > VAR_3->size * 2) return AVERROR_INVALIDDATA; channel_hint[0] = get_sbits(&gb, 8); if (channel_hint[0] & 0x80) { channel_hint[0] = ~channel_hint[0]; VAR_6 = 2; } VAR_0->VAR_6 = VAR_6; VAR_0->channel_layout = (VAR_6 == 2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO; pcm_data[0] = get_sbits(&gb, 16); if (VAR_6 > 1) { channel_hint[1] = get_sbits(&gb, 8); pcm_data[1] = get_sbits(&gb, 16); } vima->frame.nb_samples = samples; if ((VAR_4 = VAR_0->get_buffer(VAR_0, &vima->frame)) < 0) { av_log(VAR_0, AV_LOG_ERROR, "get_buffer() failed\n"); return VAR_4; } for (VAR_5 = 0; VAR_5 < VAR_6; VAR_5++) { uint16_t *dest = (uint16_t*)vima->frame.VAR_1[0] + VAR_5; int VAR_7 = channel_hint[VAR_5]; int VAR_8 = pcm_data[VAR_5]; int VAR_9; for (VAR_9 = 0; VAR_9 < samples; VAR_9++) { int lookup_size, lookup, highbit, lowbits; VAR_7 = av_clip(VAR_7, 0, 88); lookup_size = size_table[VAR_7]; lookup = get_bits(&gb, lookup_size); highbit = 1 << (lookup_size - 1); lowbits = highbit - 1; if (lookup & highbit) lookup ^= highbit; else highbit = 0; if (lookup == lowbits) { VAR_8 = get_sbits(&gb, 16); } else { int predict_index, diff; predict_index = (lookup << (7 - lookup_size)) | (VAR_7 << 6); predict_index = av_clip(predict_index, 0, 5785); diff = vima->predict_table[predict_index]; if (lookup) diff += ff_adpcm_step_table[VAR_7] >> (lookup_size - 1); if (highbit) diff = -diff; VAR_8 = av_clip_int16(VAR_8 + diff); } *dest = VAR_8; dest += VAR_6; VAR_7 += step_index_tables[lookup_size - 2][lookup]; } } *VAR_2 = 1; *(AVFrame *)VAR_1 = vima->frame; return VAR_3->size; }
[ "static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1,\nint *VAR_2, AVPacket *VAR_3)\n{", "GetBitContext gb;", "VimaContext *vima = VAR_0->priv_data;", "int16_t pcm_data[2];", "uint32_t samples;", "int8_t channel_hint[2];", "int VAR_4, VAR_5, VAR_6 = 1;", "init_get_bits(&gb, VAR_3->VAR_1, VAR_3->size * 8);", "if (VAR_3->size < 13)\nreturn AVERROR_INVALIDDATA;", "samples = get_bits_long(&gb, 32);", "if (samples == 0xffffffff) {", "skip_bits_long(&gb, 32);", "samples = get_bits_long(&gb, 32);", "}", "if (samples > VAR_3->size * 2)\nreturn AVERROR_INVALIDDATA;", "channel_hint[0] = get_sbits(&gb, 8);", "if (channel_hint[0] & 0x80) {", "channel_hint[0] = ~channel_hint[0];", "VAR_6 = 2;", "}", "VAR_0->VAR_6 = VAR_6;", "VAR_0->channel_layout = (VAR_6 == 2) ? AV_CH_LAYOUT_STEREO :\nAV_CH_LAYOUT_MONO;", "pcm_data[0] = get_sbits(&gb, 16);", "if (VAR_6 > 1) {", "channel_hint[1] = get_sbits(&gb, 8);", "pcm_data[1] = get_sbits(&gb, 16);", "}", "vima->frame.nb_samples = samples;", "if ((VAR_4 = VAR_0->get_buffer(VAR_0, &vima->frame)) < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"get_buffer() failed\\n\");", "return VAR_4;", "}", "for (VAR_5 = 0; VAR_5 < VAR_6; VAR_5++) {", "uint16_t *dest = (uint16_t*)vima->frame.VAR_1[0] + VAR_5;", "int VAR_7 = channel_hint[VAR_5];", "int VAR_8 = pcm_data[VAR_5];", "int VAR_9;", "for (VAR_9 = 0; VAR_9 < samples; VAR_9++) {", "int lookup_size, lookup, highbit, lowbits;", "VAR_7 = av_clip(VAR_7, 0, 88);", "lookup_size = size_table[VAR_7];", "lookup = get_bits(&gb, lookup_size);", "highbit = 1 << (lookup_size - 1);", "lowbits = highbit - 1;", "if (lookup & highbit)\nlookup ^= highbit;", "else\nhighbit = 0;", "if (lookup == lowbits) {", "VAR_8 = get_sbits(&gb, 16);", "} else {", "int predict_index, diff;", "predict_index = (lookup << (7 - lookup_size)) | (VAR_7 << 6);", "predict_index = av_clip(predict_index, 0, 5785);", "diff = vima->predict_table[predict_index];", "if (lookup)\ndiff += ff_adpcm_step_table[VAR_7] >> (lookup_size - 1);", "if (highbit)\ndiff = -diff;", "VAR_8 = av_clip_int16(VAR_8 + diff);", "}", "*dest = VAR_8;", "dest += VAR_6;", "VAR_7 += step_index_tables[lookup_size - 2][lookup];", "}", "}", "*VAR_2 = 1;", "*(AVFrame *)VAR_1 = vima->frame;", "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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 25, 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43, 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61, 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 101 ], [ 103 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 119, 121 ], [ 123, 125 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 139 ], [ 141 ], [ 143 ], [ 145, 147 ], [ 149, 151 ], [ 155 ], [ 157 ], [ 161 ], [ 163 ], [ 167 ], [ 169 ], [ 171 ], [ 175 ], [ 177 ], [ 181 ], [ 183 ] ]
17,977
sPAPRTCETable *spapr_tce_find_by_liobn(uint32_t liobn) { sPAPRTCETable *tcet; if (liobn & 0xFFFFFFFF00000000ULL) { hcall_dprintf("Request for out-of-bounds LIOBN 0x" TARGET_FMT_lx "\n", liobn); return NULL; } QLIST_FOREACH(tcet, &spapr_tce_tables, list) { if (tcet->liobn == liobn) { return tcet; } } return NULL; }
false
qemu
f9ce8e0aa3fb55ae7a8ea34d3169e73e87feb337
sPAPRTCETable *spapr_tce_find_by_liobn(uint32_t liobn) { sPAPRTCETable *tcet; if (liobn & 0xFFFFFFFF00000000ULL) { hcall_dprintf("Request for out-of-bounds LIOBN 0x" TARGET_FMT_lx "\n", liobn); return NULL; } QLIST_FOREACH(tcet, &spapr_tce_tables, list) { if (tcet->liobn == liobn) { return tcet; } } return NULL; }
{ "code": [], "line_no": [] }
sPAPRTCETable *FUNC_0(uint32_t liobn) { sPAPRTCETable *tcet; if (liobn & 0xFFFFFFFF00000000ULL) { hcall_dprintf("Request for out-of-bounds LIOBN 0x" TARGET_FMT_lx "\n", liobn); return NULL; } QLIST_FOREACH(tcet, &spapr_tce_tables, list) { if (tcet->liobn == liobn) { return tcet; } } return NULL; }
[ "sPAPRTCETable *FUNC_0(uint32_t liobn)\n{", "sPAPRTCETable *tcet;", "if (liobn & 0xFFFFFFFF00000000ULL) {", "hcall_dprintf(\"Request for out-of-bounds LIOBN 0x\" TARGET_FMT_lx \"\\n\",\nliobn);", "return NULL;", "}", "QLIST_FOREACH(tcet, &spapr_tce_tables, list) {", "if (tcet->liobn == liobn) {", "return tcet;", "}", "}", "return NULL;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11, 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ] ]