id
int32
0
27.3k
func
stringlengths
26
142k
target
bool
2 classes
project
stringclasses
2 values
commit_id
stringlengths
40
40
func_clean
stringlengths
26
131k
vul_lines
dict
normalized_func
stringlengths
24
132k
lines
sequencelengths
1
2.8k
label
sequencelengths
1
2.8k
line_no
sequencelengths
1
2.8k
18,369
static int encode_block(SVQ1Context *s, uint8_t *src, uint8_t *ref, uint8_t *decoded, int stride, int level, int threshold, int lambda, int intra){ int count, y, x, i, j, split, best_mean, best_score, best_count; int best_vector[6]; int block_sum[7]= {0, 0, 0, 0, 0, 0}; int w= 2<<((level+2)>>1); int h= 2<<((level+1)>>1); int size=w*h; int16_t block[7][256]; const int8_t *codebook_sum, *codebook; const uint16_t (*mean_vlc)[2]; const uint8_t (*multistage_vlc)[2]; best_score=0; //FIXME optimize, this doenst need to be done multiple times if(intra){ codebook_sum= svq1_intra_codebook_sum[level]; codebook= svq1_intra_codebooks[level]; mean_vlc= svq1_intra_mean_vlc; multistage_vlc= svq1_intra_multistage_vlc[level]; for(y=0; y<h; y++){ for(x=0; x<w; x++){ int v= src[x + y*stride]; block[0][x + w*y]= v; best_score += v*v; block_sum[0] += v; } } }else{ codebook_sum= svq1_inter_codebook_sum[level]; codebook= svq1_inter_codebooks[level]; mean_vlc= svq1_inter_mean_vlc + 256; multistage_vlc= svq1_inter_multistage_vlc[level]; for(y=0; y<h; y++){ for(x=0; x<w; x++){ int v= src[x + y*stride] - ref[x + y*stride]; block[0][x + w*y]= v; best_score += v*v; block_sum[0] += v; } } } best_count=0; best_score -= ((block_sum[0]*block_sum[0])>>(level+3)); best_mean= (block_sum[0] + (size>>1)) >> (level+3); if(level<4){ for(count=1; count<7; count++){ int best_vector_score= INT_MAX; int best_vector_sum=-999, best_vector_mean=-999; const int stage= count-1; const int8_t *vector; for(i=0; i<16; i++){ int sum= codebook_sum[stage*16 + i]; int sqr, diff, mean, score; vector = codebook + stage*size*16 + i*size; sqr = s->dsp.ssd_int8_vs_int16(vector, block[stage], size); diff= block_sum[stage] - sum; mean= (diff + (size>>1)) >> (level+3); assert(mean >-300 && mean<300); if(intra) mean= av_clip(mean, 0, 255); else mean= av_clip(mean, -256, 255); score= sqr - ((diff*(int64_t)diff)>>(level+3)); //FIXME 64bit slooow if(score < best_vector_score){ best_vector_score= score; best_vector[stage]= i; best_vector_sum= sum; best_vector_mean= mean; } } assert(best_vector_mean != -999); vector= codebook + stage*size*16 + best_vector[stage]*size; for(j=0; j<size; j++){ block[stage+1][j] = block[stage][j] - vector[j]; } block_sum[stage+1]= block_sum[stage] - best_vector_sum; best_vector_score += lambda*(+ 1 + 4*count + multistage_vlc[1+count][1] + mean_vlc[best_vector_mean][1]); if(best_vector_score < best_score){ best_score= best_vector_score; best_count= count; best_mean= best_vector_mean; } } } split=0; if(best_score > threshold && level){ int score=0; int offset= (level&1) ? stride*h/2 : w/2; PutBitContext backup[6]; for(i=level-1; i>=0; i--){ backup[i]= s->reorder_pb[i]; } score += encode_block(s, src , ref , decoded , stride, level-1, threshold>>1, lambda, intra); score += encode_block(s, src + offset, ref + offset, decoded + offset, stride, level-1, threshold>>1, lambda, intra); score += lambda; if(score < best_score){ best_score= score; split=1; }else{ for(i=level-1; i>=0; i--){ s->reorder_pb[i]= backup[i]; } } } if (level > 0) put_bits(&s->reorder_pb[level], 1, split); if(!split){ assert((best_mean >= 0 && best_mean<256) || !intra); assert(best_mean >= -256 && best_mean<256); assert(best_count >=0 && best_count<7); assert(level<4 || best_count==0); /* output the encoding */ put_bits(&s->reorder_pb[level], multistage_vlc[1 + best_count][1], multistage_vlc[1 + best_count][0]); put_bits(&s->reorder_pb[level], mean_vlc[best_mean][1], mean_vlc[best_mean][0]); for (i = 0; i < best_count; i++){ assert(best_vector[i]>=0 && best_vector[i]<16); put_bits(&s->reorder_pb[level], 4, best_vector[i]); } for(y=0; y<h; y++){ for(x=0; x<w; x++){ decoded[x + y*stride]= src[x + y*stride] - block[best_count][x + w*y] + best_mean; } } } return best_score; }
false
FFmpeg
e62b3dd210f19c337fc541758079fceeadabc208
static int encode_block(SVQ1Context *s, uint8_t *src, uint8_t *ref, uint8_t *decoded, int stride, int level, int threshold, int lambda, int intra){ int count, y, x, i, j, split, best_mean, best_score, best_count; int best_vector[6]; int block_sum[7]= {0, 0, 0, 0, 0, 0}; int w= 2<<((level+2)>>1); int h= 2<<((level+1)>>1); int size=w*h; int16_t block[7][256]; const int8_t *codebook_sum, *codebook; const uint16_t (*mean_vlc)[2]; const uint8_t (*multistage_vlc)[2]; best_score=0; if(intra){ codebook_sum= svq1_intra_codebook_sum[level]; codebook= svq1_intra_codebooks[level]; mean_vlc= svq1_intra_mean_vlc; multistage_vlc= svq1_intra_multistage_vlc[level]; for(y=0; y<h; y++){ for(x=0; x<w; x++){ int v= src[x + y*stride]; block[0][x + w*y]= v; best_score += v*v; block_sum[0] += v; } } }else{ codebook_sum= svq1_inter_codebook_sum[level]; codebook= svq1_inter_codebooks[level]; mean_vlc= svq1_inter_mean_vlc + 256; multistage_vlc= svq1_inter_multistage_vlc[level]; for(y=0; y<h; y++){ for(x=0; x<w; x++){ int v= src[x + y*stride] - ref[x + y*stride]; block[0][x + w*y]= v; best_score += v*v; block_sum[0] += v; } } } best_count=0; best_score -= ((block_sum[0]*block_sum[0])>>(level+3)); best_mean= (block_sum[0] + (size>>1)) >> (level+3); if(level<4){ for(count=1; count<7; count++){ int best_vector_score= INT_MAX; int best_vector_sum=-999, best_vector_mean=-999; const int stage= count-1; const int8_t *vector; for(i=0; i<16; i++){ int sum= codebook_sum[stage*16 + i]; int sqr, diff, mean, score; vector = codebook + stage*size*16 + i*size; sqr = s->dsp.ssd_int8_vs_int16(vector, block[stage], size); diff= block_sum[stage] - sum; mean= (diff + (size>>1)) >> (level+3); assert(mean >-300 && mean<300); if(intra) mean= av_clip(mean, 0, 255); else mean= av_clip(mean, -256, 255); score= sqr - ((diff*(int64_t)diff)>>(level+3)); if(score < best_vector_score){ best_vector_score= score; best_vector[stage]= i; best_vector_sum= sum; best_vector_mean= mean; } } assert(best_vector_mean != -999); vector= codebook + stage*size*16 + best_vector[stage]*size; for(j=0; j<size; j++){ block[stage+1][j] = block[stage][j] - vector[j]; } block_sum[stage+1]= block_sum[stage] - best_vector_sum; best_vector_score += lambda*(+ 1 + 4*count + multistage_vlc[1+count][1] + mean_vlc[best_vector_mean][1]); if(best_vector_score < best_score){ best_score= best_vector_score; best_count= count; best_mean= best_vector_mean; } } } split=0; if(best_score > threshold && level){ int score=0; int offset= (level&1) ? stride*h/2 : w/2; PutBitContext backup[6]; for(i=level-1; i>=0; i--){ backup[i]= s->reorder_pb[i]; } score += encode_block(s, src , ref , decoded , stride, level-1, threshold>>1, lambda, intra); score += encode_block(s, src + offset, ref + offset, decoded + offset, stride, level-1, threshold>>1, lambda, intra); score += lambda; if(score < best_score){ best_score= score; split=1; }else{ for(i=level-1; i>=0; i--){ s->reorder_pb[i]= backup[i]; } } } if (level > 0) put_bits(&s->reorder_pb[level], 1, split); if(!split){ assert((best_mean >= 0 && best_mean<256) || !intra); assert(best_mean >= -256 && best_mean<256); assert(best_count >=0 && best_count<7); assert(level<4 || best_count==0); put_bits(&s->reorder_pb[level], multistage_vlc[1 + best_count][1], multistage_vlc[1 + best_count][0]); put_bits(&s->reorder_pb[level], mean_vlc[best_mean][1], mean_vlc[best_mean][0]); for (i = 0; i < best_count; i++){ assert(best_vector[i]>=0 && best_vector[i]<16); put_bits(&s->reorder_pb[level], 4, best_vector[i]); } for(y=0; y<h; y++){ for(x=0; x<w; x++){ decoded[x + y*stride]= src[x + y*stride] - block[best_count][x + w*y] + best_mean; } } } return best_score; }
{ "code": [], "line_no": [] }
static int FUNC_0(SVQ1Context *VAR_0, FUNC_2 *VAR_1, FUNC_2 *VAR_2, FUNC_2 *VAR_3, int VAR_4, int VAR_5, int VAR_6, int VAR_7, int VAR_8){ int VAR_9, VAR_10, VAR_11, VAR_12, VAR_13, VAR_14, VAR_15, VAR_16, VAR_17; int VAR_18[6]; int VAR_19[7]= {0, 0, 0, 0, 0, 0}; int VAR_20= 2<<((VAR_5+2)>>1); int VAR_21= 2<<((VAR_5+1)>>1); int VAR_22=VAR_20*VAR_21; int16_t block[7][256]; const int8_t *VAR_23, *codebook; const FUNC_1 (*mean_vlc)[2]; const FUNC_2 (*multistage_vlc)[2]; VAR_16=0; if(VAR_8){ VAR_23= svq1_intra_codebook_sum[VAR_5]; codebook= svq1_intra_codebooks[VAR_5]; mean_vlc= svq1_intra_mean_vlc; multistage_vlc= svq1_intra_multistage_vlc[VAR_5]; for(VAR_10=0; VAR_10<VAR_21; VAR_10++){ for(VAR_11=0; VAR_11<VAR_20; VAR_11++){ int VAR_25= VAR_1[VAR_11 + VAR_10*VAR_4]; block[0][VAR_11 + VAR_20*VAR_10]= VAR_25; VAR_16 += VAR_25*VAR_25; VAR_19[0] += VAR_25; } } }else{ VAR_23= svq1_inter_codebook_sum[VAR_5]; codebook= svq1_inter_codebooks[VAR_5]; mean_vlc= svq1_inter_mean_vlc + 256; multistage_vlc= svq1_inter_multistage_vlc[VAR_5]; for(VAR_10=0; VAR_10<VAR_21; VAR_10++){ for(VAR_11=0; VAR_11<VAR_20; VAR_11++){ int VAR_25= VAR_1[VAR_11 + VAR_10*VAR_4] - VAR_2[VAR_11 + VAR_10*VAR_4]; block[0][VAR_11 + VAR_20*VAR_10]= VAR_25; VAR_16 += VAR_25*VAR_25; VAR_19[0] += VAR_25; } } } VAR_17=0; VAR_16 -= ((VAR_19[0]*VAR_19[0])>>(VAR_5+3)); VAR_15= (VAR_19[0] + (VAR_22>>1)) >> (VAR_5+3); if(VAR_5<4){ for(VAR_9=1; VAR_9<7; VAR_9++){ int VAR_25= INT_MAX; int VAR_26=-999, VAR_27=-999; const int VAR_28= VAR_9-1; const int8_t *VAR_29; for(VAR_12=0; VAR_12<16; VAR_12++){ int VAR_30= VAR_23[VAR_28*16 + VAR_12]; int VAR_31, VAR_32, VAR_33, VAR_35; VAR_29 = codebook + VAR_28*VAR_22*16 + VAR_12*VAR_22; VAR_31 = VAR_0->dsp.ssd_int8_vs_int16(VAR_29, block[VAR_28], VAR_22); VAR_32= VAR_19[VAR_28] - VAR_30; VAR_33= (VAR_32 + (VAR_22>>1)) >> (VAR_5+3); assert(VAR_33 >-300 && VAR_33<300); if(VAR_8) VAR_33= av_clip(VAR_33, 0, 255); else VAR_33= av_clip(VAR_33, -256, 255); VAR_35= VAR_31 - ((VAR_32*(int64_t)VAR_32)>>(VAR_5+3)); if(VAR_35 < VAR_25){ VAR_25= VAR_35; VAR_18[VAR_28]= VAR_12; VAR_26= VAR_30; VAR_27= VAR_33; } } assert(VAR_27 != -999); VAR_29= codebook + VAR_28*VAR_22*16 + VAR_18[VAR_28]*VAR_22; for(VAR_13=0; VAR_13<VAR_22; VAR_13++){ block[VAR_28+1][VAR_13] = block[VAR_28][VAR_13] - VAR_29[VAR_13]; } VAR_19[VAR_28+1]= VAR_19[VAR_28] - VAR_26; VAR_25 += VAR_7*(+ 1 + 4*VAR_9 + multistage_vlc[1+VAR_9][1] + mean_vlc[VAR_27][1]); if(VAR_25 < VAR_16){ VAR_16= VAR_25; VAR_17= VAR_9; VAR_15= VAR_27; } } } VAR_14=0; if(VAR_16 > VAR_6 && VAR_5){ int VAR_35=0; int VAR_35= (VAR_5&1) ? VAR_4*VAR_21/2 : VAR_20/2; PutBitContext backup[6]; for(VAR_12=VAR_5-1; VAR_12>=0; VAR_12--){ backup[VAR_12]= VAR_0->reorder_pb[VAR_12]; } VAR_35 += FUNC_0(VAR_0, VAR_1 , VAR_2 , VAR_3 , VAR_4, VAR_5-1, VAR_6>>1, VAR_7, VAR_8); VAR_35 += FUNC_0(VAR_0, VAR_1 + VAR_35, VAR_2 + VAR_35, VAR_3 + VAR_35, VAR_4, VAR_5-1, VAR_6>>1, VAR_7, VAR_8); VAR_35 += VAR_7; if(VAR_35 < VAR_16){ VAR_16= VAR_35; VAR_14=1; }else{ for(VAR_12=VAR_5-1; VAR_12>=0; VAR_12--){ VAR_0->reorder_pb[VAR_12]= backup[VAR_12]; } } } if (VAR_5 > 0) put_bits(&VAR_0->reorder_pb[VAR_5], 1, VAR_14); if(!VAR_14){ assert((VAR_15 >= 0 && VAR_15<256) || !VAR_8); assert(VAR_15 >= -256 && VAR_15<256); assert(VAR_17 >=0 && VAR_17<7); assert(VAR_5<4 || VAR_17==0); put_bits(&VAR_0->reorder_pb[VAR_5], multistage_vlc[1 + VAR_17][1], multistage_vlc[1 + VAR_17][0]); put_bits(&VAR_0->reorder_pb[VAR_5], mean_vlc[VAR_15][1], mean_vlc[VAR_15][0]); for (VAR_12 = 0; VAR_12 < VAR_17; VAR_12++){ assert(VAR_18[VAR_12]>=0 && VAR_18[VAR_12]<16); put_bits(&VAR_0->reorder_pb[VAR_5], 4, VAR_18[VAR_12]); } for(VAR_10=0; VAR_10<VAR_21; VAR_10++){ for(VAR_11=0; VAR_11<VAR_20; VAR_11++){ VAR_3[VAR_11 + VAR_10*VAR_4]= VAR_1[VAR_11 + VAR_10*VAR_4] - block[VAR_17][VAR_11 + VAR_20*VAR_10] + VAR_15; } } } return VAR_16; }
[ "static int FUNC_0(SVQ1Context *VAR_0, FUNC_2 *VAR_1, FUNC_2 *VAR_2, FUNC_2 *VAR_3, int VAR_4, int VAR_5, int VAR_6, int VAR_7, int VAR_8){", "int VAR_9, VAR_10, VAR_11, VAR_12, VAR_13, VAR_14, VAR_15, VAR_16, VAR_17;", "int VAR_18[6];", "int VAR_19[7]= {0, 0, 0, 0, 0, 0};", "int VAR_20= 2<<((VAR_5+2)>>1);", "int VAR_21= 2<<((VAR_5+1)>>1);", "int VAR_22=VAR_20*VAR_21;", "int16_t block[7][256];", "const int8_t *VAR_23, *codebook;", "const FUNC_1 (*mean_vlc)[2];", "const FUNC_2 (*multistage_vlc)[2];", "VAR_16=0;", "if(VAR_8){", "VAR_23= svq1_intra_codebook_sum[VAR_5];", "codebook= svq1_intra_codebooks[VAR_5];", "mean_vlc= svq1_intra_mean_vlc;", "multistage_vlc= svq1_intra_multistage_vlc[VAR_5];", "for(VAR_10=0; VAR_10<VAR_21; VAR_10++){", "for(VAR_11=0; VAR_11<VAR_20; VAR_11++){", "int VAR_25= VAR_1[VAR_11 + VAR_10*VAR_4];", "block[0][VAR_11 + VAR_20*VAR_10]= VAR_25;", "VAR_16 += VAR_25*VAR_25;", "VAR_19[0] += VAR_25;", "}", "}", "}else{", "VAR_23= svq1_inter_codebook_sum[VAR_5];", "codebook= svq1_inter_codebooks[VAR_5];", "mean_vlc= svq1_inter_mean_vlc + 256;", "multistage_vlc= svq1_inter_multistage_vlc[VAR_5];", "for(VAR_10=0; VAR_10<VAR_21; VAR_10++){", "for(VAR_11=0; VAR_11<VAR_20; VAR_11++){", "int VAR_25= VAR_1[VAR_11 + VAR_10*VAR_4] - VAR_2[VAR_11 + VAR_10*VAR_4];", "block[0][VAR_11 + VAR_20*VAR_10]= VAR_25;", "VAR_16 += VAR_25*VAR_25;", "VAR_19[0] += VAR_25;", "}", "}", "}", "VAR_17=0;", "VAR_16 -= ((VAR_19[0]*VAR_19[0])>>(VAR_5+3));", "VAR_15= (VAR_19[0] + (VAR_22>>1)) >> (VAR_5+3);", "if(VAR_5<4){", "for(VAR_9=1; VAR_9<7; VAR_9++){", "int VAR_25= INT_MAX;", "int VAR_26=-999, VAR_27=-999;", "const int VAR_28= VAR_9-1;", "const int8_t *VAR_29;", "for(VAR_12=0; VAR_12<16; VAR_12++){", "int VAR_30= VAR_23[VAR_28*16 + VAR_12];", "int VAR_31, VAR_32, VAR_33, VAR_35;", "VAR_29 = codebook + VAR_28*VAR_22*16 + VAR_12*VAR_22;", "VAR_31 = VAR_0->dsp.ssd_int8_vs_int16(VAR_29, block[VAR_28], VAR_22);", "VAR_32= VAR_19[VAR_28] - VAR_30;", "VAR_33= (VAR_32 + (VAR_22>>1)) >> (VAR_5+3);", "assert(VAR_33 >-300 && VAR_33<300);", "if(VAR_8) VAR_33= av_clip(VAR_33, 0, 255);", "else VAR_33= av_clip(VAR_33, -256, 255);", "VAR_35= VAR_31 - ((VAR_32*(int64_t)VAR_32)>>(VAR_5+3));", "if(VAR_35 < VAR_25){", "VAR_25= VAR_35;", "VAR_18[VAR_28]= VAR_12;", "VAR_26= VAR_30;", "VAR_27= VAR_33;", "}", "}", "assert(VAR_27 != -999);", "VAR_29= codebook + VAR_28*VAR_22*16 + VAR_18[VAR_28]*VAR_22;", "for(VAR_13=0; VAR_13<VAR_22; VAR_13++){", "block[VAR_28+1][VAR_13] = block[VAR_28][VAR_13] - VAR_29[VAR_13];", "}", "VAR_19[VAR_28+1]= VAR_19[VAR_28] - VAR_26;", "VAR_25 +=\nVAR_7*(+ 1 + 4*VAR_9\n+ multistage_vlc[1+VAR_9][1]\n+ mean_vlc[VAR_27][1]);", "if(VAR_25 < VAR_16){", "VAR_16= VAR_25;", "VAR_17= VAR_9;", "VAR_15= VAR_27;", "}", "}", "}", "VAR_14=0;", "if(VAR_16 > VAR_6 && VAR_5){", "int VAR_35=0;", "int VAR_35= (VAR_5&1) ? VAR_4*VAR_21/2 : VAR_20/2;", "PutBitContext backup[6];", "for(VAR_12=VAR_5-1; VAR_12>=0; VAR_12--){", "backup[VAR_12]= VAR_0->reorder_pb[VAR_12];", "}", "VAR_35 += FUNC_0(VAR_0, VAR_1 , VAR_2 , VAR_3 , VAR_4, VAR_5-1, VAR_6>>1, VAR_7, VAR_8);", "VAR_35 += FUNC_0(VAR_0, VAR_1 + VAR_35, VAR_2 + VAR_35, VAR_3 + VAR_35, VAR_4, VAR_5-1, VAR_6>>1, VAR_7, VAR_8);", "VAR_35 += VAR_7;", "if(VAR_35 < VAR_16){", "VAR_16= VAR_35;", "VAR_14=1;", "}else{", "for(VAR_12=VAR_5-1; VAR_12>=0; VAR_12--){", "VAR_0->reorder_pb[VAR_12]= backup[VAR_12];", "}", "}", "}", "if (VAR_5 > 0)\nput_bits(&VAR_0->reorder_pb[VAR_5], 1, VAR_14);", "if(!VAR_14){", "assert((VAR_15 >= 0 && VAR_15<256) || !VAR_8);", "assert(VAR_15 >= -256 && VAR_15<256);", "assert(VAR_17 >=0 && VAR_17<7);", "assert(VAR_5<4 || VAR_17==0);", "put_bits(&VAR_0->reorder_pb[VAR_5],\nmultistage_vlc[1 + VAR_17][1],\nmultistage_vlc[1 + VAR_17][0]);", "put_bits(&VAR_0->reorder_pb[VAR_5], mean_vlc[VAR_15][1],\nmean_vlc[VAR_15][0]);", "for (VAR_12 = 0; VAR_12 < VAR_17; VAR_12++){", "assert(VAR_18[VAR_12]>=0 && VAR_18[VAR_12]<16);", "put_bits(&VAR_0->reorder_pb[VAR_5], 4, VAR_18[VAR_12]);", "}", "for(VAR_10=0; VAR_10<VAR_21; VAR_10++){", "for(VAR_11=0; VAR_11<VAR_20; VAR_11++){", "VAR_3[VAR_11 + VAR_10*VAR_4]= VAR_1[VAR_11 + VAR_10*VAR_4] - block[VAR_17][VAR_11 + VAR_20*VAR_10] + VAR_15;", "}", "}", "}", "return VAR_16;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 85 ], [ 87 ], [ 89 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 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 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227, 229 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 247, 249, 251 ], [ 253, 255 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277 ], [ 279 ], [ 283 ], [ 285 ] ]
18,370
int ff_v4l2_context_dequeue_frame(V4L2Context* ctx, AVFrame* frame) { V4L2Buffer* avbuf = NULL; /* if we are draining, we are no longer inputing data, therefore enable a * timeout so we can dequeue and flag the last valid buffer. * * blocks until: * 1. decoded frame available * 2. an input buffer is ready to be dequeued */ avbuf = v4l2_dequeue_v4l2buf(ctx, ctx_to_m2mctx(ctx)->draining ? 200 : -1); if (!avbuf) { if (ctx->done) return AVERROR_EOF; return AVERROR(EAGAIN); } return ff_v4l2_buffer_buf_to_avframe(frame, avbuf); }
false
FFmpeg
5d5de3eba4c7890c2e8077f5b4ae569671d11cf8
int ff_v4l2_context_dequeue_frame(V4L2Context* ctx, AVFrame* frame) { V4L2Buffer* avbuf = NULL; avbuf = v4l2_dequeue_v4l2buf(ctx, ctx_to_m2mctx(ctx)->draining ? 200 : -1); if (!avbuf) { if (ctx->done) return AVERROR_EOF; return AVERROR(EAGAIN); } return ff_v4l2_buffer_buf_to_avframe(frame, avbuf); }
{ "code": [], "line_no": [] }
int FUNC_0(V4L2Context* VAR_0, AVFrame* VAR_1) { V4L2Buffer* avbuf = NULL; avbuf = v4l2_dequeue_v4l2buf(VAR_0, ctx_to_m2mctx(VAR_0)->draining ? 200 : -1); if (!avbuf) { if (VAR_0->done) return AVERROR_EOF; return AVERROR(EAGAIN); } return ff_v4l2_buffer_buf_to_avframe(VAR_1, avbuf); }
[ "int FUNC_0(V4L2Context* VAR_0, AVFrame* VAR_1)\n{", "V4L2Buffer* avbuf = NULL;", "avbuf = v4l2_dequeue_v4l2buf(VAR_0, ctx_to_m2mctx(VAR_0)->draining ? 200 : -1);", "if (!avbuf) {", "if (VAR_0->done)\nreturn AVERROR_EOF;", "return AVERROR(EAGAIN);", "}", "return ff_v4l2_buffer_buf_to_avframe(VAR_1, avbuf);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 23 ], [ 25 ], [ 27, 29 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ] ]
18,372
int ff_h264_decode_mb_cabac(H264Context *h) { MpegEncContext * const s = &h->s; int mb_xy; int mb_type, partition_count, cbp = 0; int dct8x8_allowed= h->pps.transform_8x8_mode; mb_xy = h->mb_xy = s->mb_x + s->mb_y*s->mb_stride; tprintf(s->avctx, "pic:%d mb:%d/%d\n", h->frame_num, s->mb_x, s->mb_y); if( h->slice_type_nos != FF_I_TYPE ) { int skip; /* a skipped mb needs the aff flag from the following mb */ if( FRAME_MBAFF && s->mb_x==0 && (s->mb_y&1)==0 ) predict_field_decoding_flag(h); if( FRAME_MBAFF && (s->mb_y&1)==1 && h->prev_mb_skipped ) skip = h->next_mb_skipped; else skip = decode_cabac_mb_skip( h, s->mb_x, s->mb_y ); /* read skip flags */ if( skip ) { if( FRAME_MBAFF && (s->mb_y&1)==0 ){ s->current_picture.mb_type[mb_xy] = MB_TYPE_SKIP; h->next_mb_skipped = decode_cabac_mb_skip( h, s->mb_x, s->mb_y+1 ); if(!h->next_mb_skipped) h->mb_mbaff = h->mb_field_decoding_flag = decode_cabac_field_decoding_flag(h); } decode_mb_skip(h); h->cbp_table[mb_xy] = 0; h->chroma_pred_mode_table[mb_xy] = 0; h->last_qscale_diff = 0; return 0; } } if(FRAME_MBAFF){ if( (s->mb_y&1) == 0 ) h->mb_mbaff = h->mb_field_decoding_flag = decode_cabac_field_decoding_flag(h); } h->prev_mb_skipped = 0; compute_mb_neighbors(h); if( h->slice_type_nos == FF_B_TYPE ) { mb_type = decode_cabac_mb_type_b( h ); 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( get_cabac_noinline( &h->cabac, &h->cabac_state[14] ) == 0 ) { /* P-type */ if( get_cabac_noinline( &h->cabac, &h->cabac_state[15] ) == 0 ) { /* P_L0_D16x16, P_8x8 */ mb_type= 3 * get_cabac_noinline( &h->cabac, &h->cabac_state[16] ); } else { /* P_L0_D8x16, P_L0_D16x8 */ mb_type= 2 - get_cabac_noinline( &h->cabac, &h->cabac_state[17] ); } partition_count= p_mb_type_info[mb_type].partition_count; mb_type= p_mb_type_info[mb_type].type; } else { mb_type= decode_cabac_intra_mb_type(h, 17, 0); goto decode_intra_mb; } } else { mb_type= decode_cabac_intra_mb_type(h, 3, 1); if(h->slice_type == FF_SI_TYPE && mb_type) mb_type--; assert(h->slice_type_nos == FF_I_TYPE); decode_intra_mb: partition_count = 0; cbp= i_mb_type_info[mb_type].cbp; h->intra16x16_pred_mode= i_mb_type_info[mb_type].pred_mode; mb_type= i_mb_type_info[mb_type].type; } if(MB_FIELD) mb_type |= MB_TYPE_INTERLACED; h->slice_table[ mb_xy ]= h->slice_num; if(IS_INTRA_PCM(mb_type)) { const uint8_t *ptr; // We assume these blocks are very rare so we do not optimize it. // FIXME The two following lines get the bitstream position in the cabac // decode, I think it should be done by a function in cabac.h (or cabac.c). ptr= h->cabac.bytestream; if(h->cabac.low&0x1) ptr--; if(CABAC_BITS==16){ if(h->cabac.low&0x1FF) ptr--; } // The pixels are stored in the same order as levels in h->mb array. memcpy(h->mb, ptr, 256); ptr+=256; if(CHROMA){ memcpy(h->mb+128, ptr, 128); ptr+=128; } ff_init_cabac_decoder(&h->cabac, ptr, h->cabac.bytestream_end - ptr); // All blocks are present h->cbp_table[mb_xy] = 0x1ef; h->chroma_pred_mode_table[mb_xy] = 0; // In deblocking, the quantizer is 0 s->current_picture.qscale_table[mb_xy]= 0; // All coeffs are present memset(h->non_zero_count[mb_xy], 16, 16); s->current_picture.mb_type[mb_xy]= mb_type; h->last_qscale_diff = 0; return 0; } if(MB_MBAFF){ h->ref_count[0] <<= 1; h->ref_count[1] <<= 1; } fill_caches(h, mb_type, 0); if( IS_INTRA( mb_type ) ) { int i, pred_mode; if( IS_INTRA4x4( mb_type ) ) { if( dct8x8_allowed && decode_cabac_mb_transform_size( h ) ) { mb_type |= MB_TYPE_8x8DCT; for( i = 0; i < 16; i+=4 ) { int pred = pred_intra_mode( h, i ); int mode = decode_cabac_mb_intra4x4_pred_mode( h, pred ); fill_rectangle( &h->intra4x4_pred_mode_cache[ scan8[i] ], 2, 2, 8, mode, 1 ); } } else { for( i = 0; i < 16; i++ ) { int pred = pred_intra_mode( h, i ); h->intra4x4_pred_mode_cache[ scan8[i] ] = decode_cabac_mb_intra4x4_pred_mode( h, pred ); //av_log( s->avctx, AV_LOG_ERROR, "i4x4 pred=%d mode=%d\n", pred, h->intra4x4_pred_mode_cache[ scan8[i] ] ); } } ff_h264_write_back_intra_pred_mode(h); if( ff_h264_check_intra4x4_pred_mode(h) < 0 ) return -1; } else { h->intra16x16_pred_mode= ff_h264_check_intra_pred_mode( h, h->intra16x16_pred_mode ); if( h->intra16x16_pred_mode < 0 ) return -1; } if(CHROMA){ h->chroma_pred_mode_table[mb_xy] = pred_mode = decode_cabac_mb_chroma_pre_mode( h ); pred_mode= ff_h264_check_intra_pred_mode( h, pred_mode ); if( pred_mode < 0 ) return -1; h->chroma_pred_mode= pred_mode; } } else if( partition_count == 4 ) { int i, j, sub_partition_count[4], list, ref[2][4]; if( h->slice_type_nos == FF_B_TYPE ) { for( i = 0; i < 4; i++ ) { h->sub_mb_type[i] = decode_cabac_b_mb_sub_type( h ); sub_partition_count[i]= b_sub_mb_type_info[ h->sub_mb_type[i] ].partition_count; h->sub_mb_type[i]= b_sub_mb_type_info[ h->sub_mb_type[i] ].type; } if( IS_DIRECT(h->sub_mb_type[0] | h->sub_mb_type[1] | h->sub_mb_type[2] | h->sub_mb_type[3]) ) { ff_h264_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; if( h->ref_count[0] > 1 || h->ref_count[1] > 1 ) { for( i = 0; i < 4; i++ ) if( IS_DIRECT(h->sub_mb_type[i]) ) fill_rectangle( &h->direct_cache[scan8[4*i]], 2, 2, 8, 1, 1 ); } } } else { for( i = 0; i < 4; i++ ) { h->sub_mb_type[i] = decode_cabac_p_mb_sub_type( h ); sub_partition_count[i]= p_sub_mb_type_info[ h->sub_mb_type[i] ].partition_count; h->sub_mb_type[i]= p_sub_mb_type_info[ h->sub_mb_type[i] ].type; } } for( list = 0; list < h->list_count; list++ ) { for( i = 0; i < 4; i++ ) { if(IS_DIRECT(h->sub_mb_type[i])) continue; if(IS_DIR(h->sub_mb_type[i], 0, list)){ if( h->ref_count[list] > 1 ){ ref[list][i] = decode_cabac_mb_ref( h, list, 4*i ); if(ref[list][i] >= (unsigned)h->ref_count[list]){ av_log(s->avctx, AV_LOG_ERROR, "Reference %d >= %d\n", ref[list][i], h->ref_count[list]); return -1; } }else ref[list][i] = 0; } else { ref[list][i] = -1; } h->ref_cache[list][ scan8[4*i]+1 ]= h->ref_cache[list][ scan8[4*i]+8 ]=h->ref_cache[list][ scan8[4*i]+9 ]= ref[list][i]; } } if(dct8x8_allowed) dct8x8_allowed = get_dct8x8_allowed(h); for(list=0; list<h->list_count; list++){ for(i=0; i<4; i++){ h->ref_cache[list][ scan8[4*i] ]=h->ref_cache[list][ scan8[4*i]+1 ]; if(IS_DIRECT(h->sub_mb_type[i])){ fill_rectangle(h->mvd_cache[list][scan8[4*i]], 2, 2, 8, 0, 4); continue; } if(IS_DIR(h->sub_mb_type[i], 0, list) && !IS_DIRECT(h->sub_mb_type[i])){ const int sub_mb_type= h->sub_mb_type[i]; const int block_width= (sub_mb_type & (MB_TYPE_16x16|MB_TYPE_16x8)) ? 2 : 1; for(j=0; j<sub_partition_count[i]; j++){ int mpx, mpy; int mx, my; const int index= 4*i + block_width*j; int16_t (* mv_cache)[2]= &h->mv_cache[list][ scan8[index] ]; int16_t (* mvd_cache)[2]= &h->mvd_cache[list][ scan8[index] ]; pred_motion(h, index, block_width, list, h->ref_cache[list][ scan8[index] ], &mpx, &mpy); mx = mpx + decode_cabac_mb_mvd( h, list, index, 0 ); my = mpy + decode_cabac_mb_mvd( h, list, index, 1 ); tprintf(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; mvd_cache[ 1 ][0]= mvd_cache[ 8 ][0]= mvd_cache[ 9 ][0]= mx - mpx; mvd_cache[ 1 ][1]= mvd_cache[ 8 ][1]= mvd_cache[ 9 ][1]= my - mpy; }else if(IS_SUB_8X4(sub_mb_type)){ mv_cache[ 1 ][0]= mx; mv_cache[ 1 ][1]= my; mvd_cache[ 1 ][0]= mx - mpx; mvd_cache[ 1 ][1]= my - mpy; }else if(IS_SUB_4X8(sub_mb_type)){ mv_cache[ 8 ][0]= mx; mv_cache[ 8 ][1]= my; mvd_cache[ 8 ][0]= mx - mpx; mvd_cache[ 8 ][1]= my - mpy; } mv_cache[ 0 ][0]= mx; mv_cache[ 0 ][1]= my; mvd_cache[ 0 ][0]= mx - mpx; mvd_cache[ 0 ][1]= my - mpy; } }else{ uint32_t *p= (uint32_t *)&h->mv_cache[list][ scan8[4*i] ][0]; uint32_t *pd= (uint32_t *)&h->mvd_cache[list][ scan8[4*i] ][0]; p[0] = p[1] = p[8] = p[9] = 0; pd[0]= pd[1]= pd[8]= pd[9]= 0; } } } } else if( IS_DIRECT(mb_type) ) { ff_h264_pred_direct_motion(h, &mb_type); fill_rectangle(h->mvd_cache[0][scan8[0]], 4, 4, 8, 0, 4); fill_rectangle(h->mvd_cache[1][scan8[0]], 4, 4, 8, 0, 4); dct8x8_allowed &= h->sps.direct_8x8_inference_flag; } else { int list, mx, my, i, mpx, mpy; if(IS_16X16(mb_type)){ for(list=0; list<h->list_count; list++){ if(IS_DIR(mb_type, 0, list)){ int ref; if(h->ref_count[list] > 1){ ref= decode_cabac_mb_ref(h, list, 0); if(ref >= (unsigned)h->ref_count[list]){ av_log(s->avctx, AV_LOG_ERROR, "Reference %d >= %d\n", ref, h->ref_count[list]); return -1; } }else ref=0; fill_rectangle(&h->ref_cache[list][ scan8[0] ], 4, 4, 8, ref, 1); }else fill_rectangle(&h->ref_cache[list][ scan8[0] ], 4, 4, 8, (uint8_t)LIST_NOT_USED, 1); //FIXME factorize and the other fill_rect below too } for(list=0; list<h->list_count; list++){ if(IS_DIR(mb_type, 0, list)){ pred_motion(h, 0, 4, list, h->ref_cache[list][ scan8[0] ], &mpx, &mpy); mx = mpx + decode_cabac_mb_mvd( h, list, 0, 0 ); my = mpy + decode_cabac_mb_mvd( h, list, 0, 1 ); tprintf(s->avctx, "final mv:%d %d\n", mx, my); fill_rectangle(h->mvd_cache[list][ scan8[0] ], 4, 4, 8, pack16to32(mx-mpx,my-mpy), 4); fill_rectangle(h->mv_cache[list][ scan8[0] ], 4, 4, 8, pack16to32(mx,my), 4); }else fill_rectangle(h->mv_cache[list][ scan8[0] ], 4, 4, 8, 0, 4); } } else if(IS_16X8(mb_type)){ for(list=0; list<h->list_count; list++){ for(i=0; i<2; i++){ if(IS_DIR(mb_type, i, list)){ int ref; if(h->ref_count[list] > 1){ ref= decode_cabac_mb_ref( h, list, 8*i ); if(ref >= (unsigned)h->ref_count[list]){ av_log(s->avctx, AV_LOG_ERROR, "Reference %d >= %d\n", ref, h->ref_count[list]); return -1; } }else ref=0; fill_rectangle(&h->ref_cache[list][ scan8[0] + 16*i ], 4, 2, 8, ref, 1); }else fill_rectangle(&h->ref_cache[list][ scan8[0] + 16*i ], 4, 2, 8, (LIST_NOT_USED&0xFF), 1); } } for(list=0; list<h->list_count; list++){ for(i=0; i<2; i++){ if(IS_DIR(mb_type, i, list)){ pred_16x8_motion(h, 8*i, list, h->ref_cache[list][scan8[0] + 16*i], &mpx, &mpy); mx = mpx + decode_cabac_mb_mvd( h, list, 8*i, 0 ); my = mpy + decode_cabac_mb_mvd( h, list, 8*i, 1 ); tprintf(s->avctx, "final mv:%d %d\n", mx, my); fill_rectangle(h->mvd_cache[list][ scan8[0] + 16*i ], 4, 2, 8, pack16to32(mx-mpx,my-mpy), 4); fill_rectangle(h->mv_cache[list][ scan8[0] + 16*i ], 4, 2, 8, pack16to32(mx,my), 4); }else{ fill_rectangle(h->mvd_cache[list][ scan8[0] + 16*i ], 4, 2, 8, 0, 4); fill_rectangle(h-> mv_cache[list][ scan8[0] + 16*i ], 4, 2, 8, 0, 4); } } } }else{ assert(IS_8X16(mb_type)); for(list=0; list<h->list_count; list++){ for(i=0; i<2; i++){ if(IS_DIR(mb_type, i, list)){ //FIXME optimize int ref; if(h->ref_count[list] > 1){ ref= decode_cabac_mb_ref( h, list, 4*i ); if(ref >= (unsigned)h->ref_count[list]){ av_log(s->avctx, AV_LOG_ERROR, "Reference %d >= %d\n", ref, h->ref_count[list]); return -1; } }else ref=0; fill_rectangle(&h->ref_cache[list][ scan8[0] + 2*i ], 2, 4, 8, ref, 1); }else fill_rectangle(&h->ref_cache[list][ scan8[0] + 2*i ], 2, 4, 8, (LIST_NOT_USED&0xFF), 1); } } for(list=0; list<h->list_count; list++){ for(i=0; i<2; i++){ if(IS_DIR(mb_type, i, list)){ pred_8x16_motion(h, i*4, list, h->ref_cache[list][ scan8[0] + 2*i ], &mpx, &mpy); mx = mpx + decode_cabac_mb_mvd( h, list, 4*i, 0 ); my = mpy + decode_cabac_mb_mvd( h, list, 4*i, 1 ); tprintf(s->avctx, "final mv:%d %d\n", mx, my); fill_rectangle(h->mvd_cache[list][ scan8[0] + 2*i ], 2, 4, 8, pack16to32(mx-mpx,my-mpy), 4); fill_rectangle(h->mv_cache[list][ scan8[0] + 2*i ], 2, 4, 8, pack16to32(mx,my), 4); }else{ fill_rectangle(h->mvd_cache[list][ scan8[0] + 2*i ], 2, 4, 8, 0, 4); fill_rectangle(h-> mv_cache[list][ scan8[0] + 2*i ], 2, 4, 8, 0, 4); } } } } } if( IS_INTER( mb_type ) ) { h->chroma_pred_mode_table[mb_xy] = 0; write_back_motion( h, mb_type ); } if( !IS_INTRA16x16( mb_type ) ) { cbp = decode_cabac_mb_cbp_luma( h ); if(CHROMA) cbp |= decode_cabac_mb_cbp_chroma( h ) << 4; } h->cbp_table[mb_xy] = h->cbp = cbp; if( dct8x8_allowed && (cbp&15) && !IS_INTRA( mb_type ) ) { if( decode_cabac_mb_transform_size( h ) ) mb_type |= MB_TYPE_8x8DCT; } s->current_picture.mb_type[mb_xy]= mb_type; if( cbp || IS_INTRA16x16( mb_type ) ) { const uint8_t *scan, *scan8x8, *dc_scan; const uint32_t *qmul; int dqp; if(IS_INTERLACED(mb_type)){ scan8x8= s->qscale ? h->field_scan8x8 : h->field_scan8x8_q0; scan= s->qscale ? h->field_scan : h->field_scan_q0; dc_scan= luma_dc_field_scan; }else{ scan8x8= s->qscale ? h->zigzag_scan8x8 : h->zigzag_scan8x8_q0; scan= s->qscale ? h->zigzag_scan : h->zigzag_scan_q0; dc_scan= luma_dc_zigzag_scan; } h->last_qscale_diff = dqp = decode_cabac_mb_dqp( h ); if( dqp == INT_MIN ){ av_log(h->s.avctx, AV_LOG_ERROR, "cabac decode of qscale diff failed at %d %d\n", s->mb_x, s->mb_y); return -1; } s->qscale += dqp; if(((unsigned)s->qscale) > 51){ if(s->qscale<0) s->qscale+= 52; else s->qscale-= 52; } h->chroma_qp[0] = get_chroma_qp(h, 0, s->qscale); h->chroma_qp[1] = get_chroma_qp(h, 1, s->qscale); if( IS_INTRA16x16( mb_type ) ) { int i; //av_log( s->avctx, AV_LOG_ERROR, "INTRA16x16 DC\n" ); decode_cabac_residual( h, h->mb, 0, 0, dc_scan, NULL, 16); if( cbp&15 ) { qmul = h->dequant4_coeff[0][s->qscale]; for( i = 0; i < 16; i++ ) { //av_log( s->avctx, AV_LOG_ERROR, "INTRA16x16 AC:%d\n", i ); decode_cabac_residual(h, h->mb + 16*i, 1, i, scan + 1, qmul, 15); } } else { fill_rectangle(&h->non_zero_count_cache[scan8[0]], 4, 4, 8, 0, 1); } } else { int i8x8, i4x4; for( i8x8 = 0; i8x8 < 4; i8x8++ ) { if( cbp & (1<<i8x8) ) { if( IS_8x8DCT(mb_type) ) { decode_cabac_residual(h, h->mb + 64*i8x8, 5, 4*i8x8, scan8x8, h->dequant8_coeff[IS_INTRA( mb_type ) ? 0:1][s->qscale], 64); } else { qmul = h->dequant4_coeff[IS_INTRA( mb_type ) ? 0:3][s->qscale]; for( i4x4 = 0; i4x4 < 4; i4x4++ ) { const int index = 4*i8x8 + i4x4; //av_log( s->avctx, AV_LOG_ERROR, "Luma4x4: %d\n", index ); //START_TIMER decode_cabac_residual(h, h->mb + 16*index, 2, index, scan, qmul, 16); //STOP_TIMER("decode_residual") } } } else { uint8_t * const nnz= &h->non_zero_count_cache[ scan8[4*i8x8] ]; nnz[0] = nnz[1] = nnz[8] = nnz[9] = 0; } } } if( cbp&0x30 ){ int c; for( c = 0; c < 2; c++ ) { //av_log( s->avctx, AV_LOG_ERROR, "INTRA C%d-DC\n",c ); decode_cabac_residual(h, h->mb + 256 + 16*4*c, 3, c, chroma_dc_scan, NULL, 4); } } if( cbp&0x20 ) { int c, i; for( c = 0; c < 2; c++ ) { qmul = h->dequant4_coeff[c+1+(IS_INTRA( mb_type ) ? 0:3)][h->chroma_qp[c]]; for( i = 0; i < 4; i++ ) { const int index = 16 + 4 * c + i; //av_log( s->avctx, AV_LOG_ERROR, "INTRA C%d-AC %d\n",c, index - 16 ); decode_cabac_residual(h, h->mb + 16*index, 4, index, scan + 1, qmul, 15); } } } else { uint8_t * const nnz= &h->non_zero_count_cache[0]; nnz[ scan8[16]+0 ] = nnz[ scan8[16]+1 ] =nnz[ scan8[16]+8 ] =nnz[ scan8[16]+9 ] = nnz[ scan8[20]+0 ] = nnz[ scan8[20]+1 ] =nnz[ scan8[20]+8 ] =nnz[ scan8[20]+9 ] = 0; } } else { uint8_t * const nnz= &h->non_zero_count_cache[0]; fill_rectangle(&nnz[scan8[0]], 4, 4, 8, 0, 1); nnz[ scan8[16]+0 ] = nnz[ scan8[16]+1 ] =nnz[ scan8[16]+8 ] =nnz[ scan8[16]+9 ] = nnz[ scan8[20]+0 ] = nnz[ scan8[20]+1 ] =nnz[ scan8[20]+8 ] =nnz[ scan8[20]+9 ] = 0; h->last_qscale_diff = 0; } s->current_picture.qscale_table[mb_xy]= s->qscale; write_back_non_zero_count(h); if(MB_MBAFF){ h->ref_count[0] >>= 1; h->ref_count[1] >>= 1; } return 0; }
false
FFmpeg
c988f97566cdf536ba0dcbc0d77d885456852060
int ff_h264_decode_mb_cabac(H264Context *h) { MpegEncContext * const s = &h->s; int mb_xy; int mb_type, partition_count, cbp = 0; int dct8x8_allowed= h->pps.transform_8x8_mode; mb_xy = h->mb_xy = s->mb_x + s->mb_y*s->mb_stride; tprintf(s->avctx, "pic:%d mb:%d/%d\n", h->frame_num, s->mb_x, s->mb_y); if( h->slice_type_nos != FF_I_TYPE ) { int skip; if( FRAME_MBAFF && s->mb_x==0 && (s->mb_y&1)==0 ) predict_field_decoding_flag(h); if( FRAME_MBAFF && (s->mb_y&1)==1 && h->prev_mb_skipped ) skip = h->next_mb_skipped; else skip = decode_cabac_mb_skip( h, s->mb_x, s->mb_y ); if( skip ) { if( FRAME_MBAFF && (s->mb_y&1)==0 ){ s->current_picture.mb_type[mb_xy] = MB_TYPE_SKIP; h->next_mb_skipped = decode_cabac_mb_skip( h, s->mb_x, s->mb_y+1 ); if(!h->next_mb_skipped) h->mb_mbaff = h->mb_field_decoding_flag = decode_cabac_field_decoding_flag(h); } decode_mb_skip(h); h->cbp_table[mb_xy] = 0; h->chroma_pred_mode_table[mb_xy] = 0; h->last_qscale_diff = 0; return 0; } } if(FRAME_MBAFF){ if( (s->mb_y&1) == 0 ) h->mb_mbaff = h->mb_field_decoding_flag = decode_cabac_field_decoding_flag(h); } h->prev_mb_skipped = 0; compute_mb_neighbors(h); if( h->slice_type_nos == FF_B_TYPE ) { mb_type = decode_cabac_mb_type_b( h ); 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( get_cabac_noinline( &h->cabac, &h->cabac_state[14] ) == 0 ) { if( get_cabac_noinline( &h->cabac, &h->cabac_state[15] ) == 0 ) { mb_type= 3 * get_cabac_noinline( &h->cabac, &h->cabac_state[16] ); } else { mb_type= 2 - get_cabac_noinline( &h->cabac, &h->cabac_state[17] ); } partition_count= p_mb_type_info[mb_type].partition_count; mb_type= p_mb_type_info[mb_type].type; } else { mb_type= decode_cabac_intra_mb_type(h, 17, 0); goto decode_intra_mb; } } else { mb_type= decode_cabac_intra_mb_type(h, 3, 1); if(h->slice_type == FF_SI_TYPE && mb_type) mb_type--; assert(h->slice_type_nos == FF_I_TYPE); decode_intra_mb: partition_count = 0; cbp= i_mb_type_info[mb_type].cbp; h->intra16x16_pred_mode= i_mb_type_info[mb_type].pred_mode; mb_type= i_mb_type_info[mb_type].type; } if(MB_FIELD) mb_type |= MB_TYPE_INTERLACED; h->slice_table[ mb_xy ]= h->slice_num; if(IS_INTRA_PCM(mb_type)) { const uint8_t *ptr; ptr= h->cabac.bytestream; if(h->cabac.low&0x1) ptr--; if(CABAC_BITS==16){ if(h->cabac.low&0x1FF) ptr--; } memcpy(h->mb, ptr, 256); ptr+=256; if(CHROMA){ memcpy(h->mb+128, ptr, 128); ptr+=128; } ff_init_cabac_decoder(&h->cabac, ptr, h->cabac.bytestream_end - ptr); h->cbp_table[mb_xy] = 0x1ef; h->chroma_pred_mode_table[mb_xy] = 0; s->current_picture.qscale_table[mb_xy]= 0; memset(h->non_zero_count[mb_xy], 16, 16); s->current_picture.mb_type[mb_xy]= mb_type; h->last_qscale_diff = 0; return 0; } if(MB_MBAFF){ h->ref_count[0] <<= 1; h->ref_count[1] <<= 1; } fill_caches(h, mb_type, 0); if( IS_INTRA( mb_type ) ) { int i, pred_mode; if( IS_INTRA4x4( mb_type ) ) { if( dct8x8_allowed && decode_cabac_mb_transform_size( h ) ) { mb_type |= MB_TYPE_8x8DCT; for( i = 0; i < 16; i+=4 ) { int pred = pred_intra_mode( h, i ); int mode = decode_cabac_mb_intra4x4_pred_mode( h, pred ); fill_rectangle( &h->intra4x4_pred_mode_cache[ scan8[i] ], 2, 2, 8, mode, 1 ); } } else { for( i = 0; i < 16; i++ ) { int pred = pred_intra_mode( h, i ); h->intra4x4_pred_mode_cache[ scan8[i] ] = decode_cabac_mb_intra4x4_pred_mode( h, pred ); } } ff_h264_write_back_intra_pred_mode(h); if( ff_h264_check_intra4x4_pred_mode(h) < 0 ) return -1; } else { h->intra16x16_pred_mode= ff_h264_check_intra_pred_mode( h, h->intra16x16_pred_mode ); if( h->intra16x16_pred_mode < 0 ) return -1; } if(CHROMA){ h->chroma_pred_mode_table[mb_xy] = pred_mode = decode_cabac_mb_chroma_pre_mode( h ); pred_mode= ff_h264_check_intra_pred_mode( h, pred_mode ); if( pred_mode < 0 ) return -1; h->chroma_pred_mode= pred_mode; } } else if( partition_count == 4 ) { int i, j, sub_partition_count[4], list, ref[2][4]; if( h->slice_type_nos == FF_B_TYPE ) { for( i = 0; i < 4; i++ ) { h->sub_mb_type[i] = decode_cabac_b_mb_sub_type( h ); sub_partition_count[i]= b_sub_mb_type_info[ h->sub_mb_type[i] ].partition_count; h->sub_mb_type[i]= b_sub_mb_type_info[ h->sub_mb_type[i] ].type; } if( IS_DIRECT(h->sub_mb_type[0] | h->sub_mb_type[1] | h->sub_mb_type[2] | h->sub_mb_type[3]) ) { ff_h264_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; if( h->ref_count[0] > 1 || h->ref_count[1] > 1 ) { for( i = 0; i < 4; i++ ) if( IS_DIRECT(h->sub_mb_type[i]) ) fill_rectangle( &h->direct_cache[scan8[4*i]], 2, 2, 8, 1, 1 ); } } } else { for( i = 0; i < 4; i++ ) { h->sub_mb_type[i] = decode_cabac_p_mb_sub_type( h ); sub_partition_count[i]= p_sub_mb_type_info[ h->sub_mb_type[i] ].partition_count; h->sub_mb_type[i]= p_sub_mb_type_info[ h->sub_mb_type[i] ].type; } } for( list = 0; list < h->list_count; list++ ) { for( i = 0; i < 4; i++ ) { if(IS_DIRECT(h->sub_mb_type[i])) continue; if(IS_DIR(h->sub_mb_type[i], 0, list)){ if( h->ref_count[list] > 1 ){ ref[list][i] = decode_cabac_mb_ref( h, list, 4*i ); if(ref[list][i] >= (unsigned)h->ref_count[list]){ av_log(s->avctx, AV_LOG_ERROR, "Reference %d >= %d\n", ref[list][i], h->ref_count[list]); return -1; } }else ref[list][i] = 0; } else { ref[list][i] = -1; } h->ref_cache[list][ scan8[4*i]+1 ]= h->ref_cache[list][ scan8[4*i]+8 ]=h->ref_cache[list][ scan8[4*i]+9 ]= ref[list][i]; } } if(dct8x8_allowed) dct8x8_allowed = get_dct8x8_allowed(h); for(list=0; list<h->list_count; list++){ for(i=0; i<4; i++){ h->ref_cache[list][ scan8[4*i] ]=h->ref_cache[list][ scan8[4*i]+1 ]; if(IS_DIRECT(h->sub_mb_type[i])){ fill_rectangle(h->mvd_cache[list][scan8[4*i]], 2, 2, 8, 0, 4); continue; } if(IS_DIR(h->sub_mb_type[i], 0, list) && !IS_DIRECT(h->sub_mb_type[i])){ const int sub_mb_type= h->sub_mb_type[i]; const int block_width= (sub_mb_type & (MB_TYPE_16x16|MB_TYPE_16x8)) ? 2 : 1; for(j=0; j<sub_partition_count[i]; j++){ int mpx, mpy; int mx, my; const int index= 4*i + block_width*j; int16_t (* mv_cache)[2]= &h->mv_cache[list][ scan8[index] ]; int16_t (* mvd_cache)[2]= &h->mvd_cache[list][ scan8[index] ]; pred_motion(h, index, block_width, list, h->ref_cache[list][ scan8[index] ], &mpx, &mpy); mx = mpx + decode_cabac_mb_mvd( h, list, index, 0 ); my = mpy + decode_cabac_mb_mvd( h, list, index, 1 ); tprintf(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; mvd_cache[ 1 ][0]= mvd_cache[ 8 ][0]= mvd_cache[ 9 ][0]= mx - mpx; mvd_cache[ 1 ][1]= mvd_cache[ 8 ][1]= mvd_cache[ 9 ][1]= my - mpy; }else if(IS_SUB_8X4(sub_mb_type)){ mv_cache[ 1 ][0]= mx; mv_cache[ 1 ][1]= my; mvd_cache[ 1 ][0]= mx - mpx; mvd_cache[ 1 ][1]= my - mpy; }else if(IS_SUB_4X8(sub_mb_type)){ mv_cache[ 8 ][0]= mx; mv_cache[ 8 ][1]= my; mvd_cache[ 8 ][0]= mx - mpx; mvd_cache[ 8 ][1]= my - mpy; } mv_cache[ 0 ][0]= mx; mv_cache[ 0 ][1]= my; mvd_cache[ 0 ][0]= mx - mpx; mvd_cache[ 0 ][1]= my - mpy; } }else{ uint32_t *p= (uint32_t *)&h->mv_cache[list][ scan8[4*i] ][0]; uint32_t *pd= (uint32_t *)&h->mvd_cache[list][ scan8[4*i] ][0]; p[0] = p[1] = p[8] = p[9] = 0; pd[0]= pd[1]= pd[8]= pd[9]= 0; } } } } else if( IS_DIRECT(mb_type) ) { ff_h264_pred_direct_motion(h, &mb_type); fill_rectangle(h->mvd_cache[0][scan8[0]], 4, 4, 8, 0, 4); fill_rectangle(h->mvd_cache[1][scan8[0]], 4, 4, 8, 0, 4); dct8x8_allowed &= h->sps.direct_8x8_inference_flag; } else { int list, mx, my, i, mpx, mpy; if(IS_16X16(mb_type)){ for(list=0; list<h->list_count; list++){ if(IS_DIR(mb_type, 0, list)){ int ref; if(h->ref_count[list] > 1){ ref= decode_cabac_mb_ref(h, list, 0); if(ref >= (unsigned)h->ref_count[list]){ av_log(s->avctx, AV_LOG_ERROR, "Reference %d >= %d\n", ref, h->ref_count[list]); return -1; } }else ref=0; fill_rectangle(&h->ref_cache[list][ scan8[0] ], 4, 4, 8, ref, 1); }else fill_rectangle(&h->ref_cache[list][ scan8[0] ], 4, 4, 8, (uint8_t)LIST_NOT_USED, 1); } for(list=0; list<h->list_count; list++){ if(IS_DIR(mb_type, 0, list)){ pred_motion(h, 0, 4, list, h->ref_cache[list][ scan8[0] ], &mpx, &mpy); mx = mpx + decode_cabac_mb_mvd( h, list, 0, 0 ); my = mpy + decode_cabac_mb_mvd( h, list, 0, 1 ); tprintf(s->avctx, "final mv:%d %d\n", mx, my); fill_rectangle(h->mvd_cache[list][ scan8[0] ], 4, 4, 8, pack16to32(mx-mpx,my-mpy), 4); fill_rectangle(h->mv_cache[list][ scan8[0] ], 4, 4, 8, pack16to32(mx,my), 4); }else fill_rectangle(h->mv_cache[list][ scan8[0] ], 4, 4, 8, 0, 4); } } else if(IS_16X8(mb_type)){ for(list=0; list<h->list_count; list++){ for(i=0; i<2; i++){ if(IS_DIR(mb_type, i, list)){ int ref; if(h->ref_count[list] > 1){ ref= decode_cabac_mb_ref( h, list, 8*i ); if(ref >= (unsigned)h->ref_count[list]){ av_log(s->avctx, AV_LOG_ERROR, "Reference %d >= %d\n", ref, h->ref_count[list]); return -1; } }else ref=0; fill_rectangle(&h->ref_cache[list][ scan8[0] + 16*i ], 4, 2, 8, ref, 1); }else fill_rectangle(&h->ref_cache[list][ scan8[0] + 16*i ], 4, 2, 8, (LIST_NOT_USED&0xFF), 1); } } for(list=0; list<h->list_count; list++){ for(i=0; i<2; i++){ if(IS_DIR(mb_type, i, list)){ pred_16x8_motion(h, 8*i, list, h->ref_cache[list][scan8[0] + 16*i], &mpx, &mpy); mx = mpx + decode_cabac_mb_mvd( h, list, 8*i, 0 ); my = mpy + decode_cabac_mb_mvd( h, list, 8*i, 1 ); tprintf(s->avctx, "final mv:%d %d\n", mx, my); fill_rectangle(h->mvd_cache[list][ scan8[0] + 16*i ], 4, 2, 8, pack16to32(mx-mpx,my-mpy), 4); fill_rectangle(h->mv_cache[list][ scan8[0] + 16*i ], 4, 2, 8, pack16to32(mx,my), 4); }else{ fill_rectangle(h->mvd_cache[list][ scan8[0] + 16*i ], 4, 2, 8, 0, 4); fill_rectangle(h-> mv_cache[list][ scan8[0] + 16*i ], 4, 2, 8, 0, 4); } } } }else{ assert(IS_8X16(mb_type)); for(list=0; list<h->list_count; list++){ for(i=0; i<2; i++){ if(IS_DIR(mb_type, i, list)){ int ref; if(h->ref_count[list] > 1){ ref= decode_cabac_mb_ref( h, list, 4*i ); if(ref >= (unsigned)h->ref_count[list]){ av_log(s->avctx, AV_LOG_ERROR, "Reference %d >= %d\n", ref, h->ref_count[list]); return -1; } }else ref=0; fill_rectangle(&h->ref_cache[list][ scan8[0] + 2*i ], 2, 4, 8, ref, 1); }else fill_rectangle(&h->ref_cache[list][ scan8[0] + 2*i ], 2, 4, 8, (LIST_NOT_USED&0xFF), 1); } } for(list=0; list<h->list_count; list++){ for(i=0; i<2; i++){ if(IS_DIR(mb_type, i, list)){ pred_8x16_motion(h, i*4, list, h->ref_cache[list][ scan8[0] + 2*i ], &mpx, &mpy); mx = mpx + decode_cabac_mb_mvd( h, list, 4*i, 0 ); my = mpy + decode_cabac_mb_mvd( h, list, 4*i, 1 ); tprintf(s->avctx, "final mv:%d %d\n", mx, my); fill_rectangle(h->mvd_cache[list][ scan8[0] + 2*i ], 2, 4, 8, pack16to32(mx-mpx,my-mpy), 4); fill_rectangle(h->mv_cache[list][ scan8[0] + 2*i ], 2, 4, 8, pack16to32(mx,my), 4); }else{ fill_rectangle(h->mvd_cache[list][ scan8[0] + 2*i ], 2, 4, 8, 0, 4); fill_rectangle(h-> mv_cache[list][ scan8[0] + 2*i ], 2, 4, 8, 0, 4); } } } } } if( IS_INTER( mb_type ) ) { h->chroma_pred_mode_table[mb_xy] = 0; write_back_motion( h, mb_type ); } if( !IS_INTRA16x16( mb_type ) ) { cbp = decode_cabac_mb_cbp_luma( h ); if(CHROMA) cbp |= decode_cabac_mb_cbp_chroma( h ) << 4; } h->cbp_table[mb_xy] = h->cbp = cbp; if( dct8x8_allowed && (cbp&15) && !IS_INTRA( mb_type ) ) { if( decode_cabac_mb_transform_size( h ) ) mb_type |= MB_TYPE_8x8DCT; } s->current_picture.mb_type[mb_xy]= mb_type; if( cbp || IS_INTRA16x16( mb_type ) ) { const uint8_t *scan, *scan8x8, *dc_scan; const uint32_t *qmul; int dqp; if(IS_INTERLACED(mb_type)){ scan8x8= s->qscale ? h->field_scan8x8 : h->field_scan8x8_q0; scan= s->qscale ? h->field_scan : h->field_scan_q0; dc_scan= luma_dc_field_scan; }else{ scan8x8= s->qscale ? h->zigzag_scan8x8 : h->zigzag_scan8x8_q0; scan= s->qscale ? h->zigzag_scan : h->zigzag_scan_q0; dc_scan= luma_dc_zigzag_scan; } h->last_qscale_diff = dqp = decode_cabac_mb_dqp( h ); if( dqp == INT_MIN ){ av_log(h->s.avctx, AV_LOG_ERROR, "cabac decode of qscale diff failed at %d %d\n", s->mb_x, s->mb_y); return -1; } s->qscale += dqp; if(((unsigned)s->qscale) > 51){ if(s->qscale<0) s->qscale+= 52; else s->qscale-= 52; } h->chroma_qp[0] = get_chroma_qp(h, 0, s->qscale); h->chroma_qp[1] = get_chroma_qp(h, 1, s->qscale); if( IS_INTRA16x16( mb_type ) ) { int i; decode_cabac_residual( h, h->mb, 0, 0, dc_scan, NULL, 16); if( cbp&15 ) { qmul = h->dequant4_coeff[0][s->qscale]; for( i = 0; i < 16; i++ ) { decode_cabac_residual(h, h->mb + 16*i, 1, i, scan + 1, qmul, 15); } } else { fill_rectangle(&h->non_zero_count_cache[scan8[0]], 4, 4, 8, 0, 1); } } else { int i8x8, i4x4; for( i8x8 = 0; i8x8 < 4; i8x8++ ) { if( cbp & (1<<i8x8) ) { if( IS_8x8DCT(mb_type) ) { decode_cabac_residual(h, h->mb + 64*i8x8, 5, 4*i8x8, scan8x8, h->dequant8_coeff[IS_INTRA( mb_type ) ? 0:1][s->qscale], 64); } else { qmul = h->dequant4_coeff[IS_INTRA( mb_type ) ? 0:3][s->qscale]; for( i4x4 = 0; i4x4 < 4; i4x4++ ) { const int index = 4*i8x8 + i4x4; decode_cabac_residual(h, h->mb + 16*index, 2, index, scan, qmul, 16); } } } else { uint8_t * const nnz= &h->non_zero_count_cache[ scan8[4*i8x8] ]; nnz[0] = nnz[1] = nnz[8] = nnz[9] = 0; } } } if( cbp&0x30 ){ int c; for( c = 0; c < 2; c++ ) { decode_cabac_residual(h, h->mb + 256 + 16*4*c, 3, c, chroma_dc_scan, NULL, 4); } } if( cbp&0x20 ) { int c, i; for( c = 0; c < 2; c++ ) { qmul = h->dequant4_coeff[c+1+(IS_INTRA( mb_type ) ? 0:3)][h->chroma_qp[c]]; for( i = 0; i < 4; i++ ) { const int index = 16 + 4 * c + i; decode_cabac_residual(h, h->mb + 16*index, 4, index, scan + 1, qmul, 15); } } } else { uint8_t * const nnz= &h->non_zero_count_cache[0]; nnz[ scan8[16]+0 ] = nnz[ scan8[16]+1 ] =nnz[ scan8[16]+8 ] =nnz[ scan8[16]+9 ] = nnz[ scan8[20]+0 ] = nnz[ scan8[20]+1 ] =nnz[ scan8[20]+8 ] =nnz[ scan8[20]+9 ] = 0; } } else { uint8_t * const nnz= &h->non_zero_count_cache[0]; fill_rectangle(&nnz[scan8[0]], 4, 4, 8, 0, 1); nnz[ scan8[16]+0 ] = nnz[ scan8[16]+1 ] =nnz[ scan8[16]+8 ] =nnz[ scan8[16]+9 ] = nnz[ scan8[20]+0 ] = nnz[ scan8[20]+1 ] =nnz[ scan8[20]+8 ] =nnz[ scan8[20]+9 ] = 0; h->last_qscale_diff = 0; } s->current_picture.qscale_table[mb_xy]= s->qscale; write_back_non_zero_count(h); if(MB_MBAFF){ h->ref_count[0] >>= 1; h->ref_count[1] >>= 1; } return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(H264Context *VAR_0) { MpegEncContext * const s = &VAR_0->s; int VAR_1; int VAR_2, VAR_3, VAR_4 = 0; int VAR_5= VAR_0->pps.transform_8x8_mode; VAR_1 = VAR_0->VAR_1 = s->mb_x + s->mb_y*s->mb_stride; tprintf(s->avctx, "pic:%d mb:%d/%d\n", VAR_0->frame_num, s->mb_x, s->mb_y); if( VAR_0->slice_type_nos != FF_I_TYPE ) { int VAR_6; if( FRAME_MBAFF && s->mb_x==0 && (s->mb_y&1)==0 ) predict_field_decoding_flag(VAR_0); if( FRAME_MBAFF && (s->mb_y&1)==1 && VAR_0->prev_mb_skipped ) VAR_6 = VAR_0->next_mb_skipped; else VAR_6 = decode_cabac_mb_skip( VAR_0, s->mb_x, s->mb_y ); if( VAR_6 ) { if( FRAME_MBAFF && (s->mb_y&1)==0 ){ s->current_picture.VAR_2[VAR_1] = MB_TYPE_SKIP; VAR_0->next_mb_skipped = decode_cabac_mb_skip( VAR_0, s->mb_x, s->mb_y+1 ); if(!VAR_0->next_mb_skipped) VAR_0->mb_mbaff = VAR_0->mb_field_decoding_flag = decode_cabac_field_decoding_flag(VAR_0); } decode_mb_skip(VAR_0); VAR_0->cbp_table[VAR_1] = 0; VAR_0->chroma_pred_mode_table[VAR_1] = 0; VAR_0->last_qscale_diff = 0; return 0; } } if(FRAME_MBAFF){ if( (s->mb_y&1) == 0 ) VAR_0->mb_mbaff = VAR_0->mb_field_decoding_flag = decode_cabac_field_decoding_flag(VAR_0); } VAR_0->prev_mb_skipped = 0; compute_mb_neighbors(VAR_0); if( VAR_0->slice_type_nos == FF_B_TYPE ) { VAR_2 = decode_cabac_mb_type_b( VAR_0 ); if( VAR_2 < 23 ){ VAR_3= b_mb_type_info[VAR_2].VAR_3; VAR_2= b_mb_type_info[VAR_2].type; }else{ VAR_2 -= 23; goto decode_intra_mb; } } else if( VAR_0->slice_type_nos == FF_P_TYPE ) { if( get_cabac_noinline( &VAR_0->cabac, &VAR_0->cabac_state[14] ) == 0 ) { if( get_cabac_noinline( &VAR_0->cabac, &VAR_0->cabac_state[15] ) == 0 ) { VAR_2= 3 * get_cabac_noinline( &VAR_0->cabac, &VAR_0->cabac_state[16] ); } else { VAR_2= 2 - get_cabac_noinline( &VAR_0->cabac, &VAR_0->cabac_state[17] ); } VAR_3= p_mb_type_info[VAR_2].VAR_3; VAR_2= p_mb_type_info[VAR_2].type; } else { VAR_2= decode_cabac_intra_mb_type(VAR_0, 17, 0); goto decode_intra_mb; } } else { VAR_2= decode_cabac_intra_mb_type(VAR_0, 3, 1); if(VAR_0->slice_type == FF_SI_TYPE && VAR_2) VAR_2--; assert(VAR_0->slice_type_nos == FF_I_TYPE); decode_intra_mb: VAR_3 = 0; VAR_4= i_mb_type_info[VAR_2].VAR_4; VAR_0->intra16x16_pred_mode= i_mb_type_info[VAR_2].VAR_9; VAR_2= i_mb_type_info[VAR_2].type; } if(MB_FIELD) VAR_2 |= MB_TYPE_INTERLACED; VAR_0->slice_table[ VAR_1 ]= VAR_0->slice_num; if(IS_INTRA_PCM(VAR_2)) { const uint8_t *VAR_7; VAR_7= VAR_0->cabac.bytestream; if(VAR_0->cabac.low&0x1) VAR_7--; if(CABAC_BITS==16){ if(VAR_0->cabac.low&0x1FF) VAR_7--; } memcpy(VAR_0->mb, VAR_7, 256); VAR_7+=256; if(CHROMA){ memcpy(VAR_0->mb+128, VAR_7, 128); VAR_7+=128; } ff_init_cabac_decoder(&VAR_0->cabac, VAR_7, VAR_0->cabac.bytestream_end - VAR_7); VAR_0->cbp_table[VAR_1] = 0x1ef; VAR_0->chroma_pred_mode_table[VAR_1] = 0; s->current_picture.qscale_table[VAR_1]= 0; memset(VAR_0->non_zero_count[VAR_1], 16, 16); s->current_picture.VAR_2[VAR_1]= VAR_2; VAR_0->last_qscale_diff = 0; return 0; } if(MB_MBAFF){ VAR_0->ref_count[0] <<= 1; VAR_0->ref_count[1] <<= 1; } fill_caches(VAR_0, VAR_2, 0); if( IS_INTRA( VAR_2 ) ) { int VAR_27, VAR_9; if( IS_INTRA4x4( VAR_2 ) ) { if( VAR_5 && decode_cabac_mb_transform_size( VAR_0 ) ) { VAR_2 |= MB_TYPE_8x8DCT; for( VAR_27 = 0; VAR_27 < 16; VAR_27+=4 ) { int VAR_12 = pred_intra_mode( VAR_0, VAR_27 ); int VAR_11 = decode_cabac_mb_intra4x4_pred_mode( VAR_0, VAR_12 ); fill_rectangle( &VAR_0->intra4x4_pred_mode_cache[ scan8[VAR_27] ], 2, 2, 8, VAR_11, 1 ); } } else { for( VAR_27 = 0; VAR_27 < 16; VAR_27++ ) { int VAR_12 = pred_intra_mode( VAR_0, VAR_27 ); VAR_0->intra4x4_pred_mode_cache[ scan8[VAR_27] ] = decode_cabac_mb_intra4x4_pred_mode( VAR_0, VAR_12 ); } } ff_h264_write_back_intra_pred_mode(VAR_0); if( ff_h264_check_intra4x4_pred_mode(VAR_0) < 0 ) return -1; } else { VAR_0->intra16x16_pred_mode= ff_h264_check_intra_pred_mode( VAR_0, VAR_0->intra16x16_pred_mode ); if( VAR_0->intra16x16_pred_mode < 0 ) return -1; } if(CHROMA){ VAR_0->chroma_pred_mode_table[VAR_1] = VAR_9 = decode_cabac_mb_chroma_pre_mode( VAR_0 ); VAR_9= ff_h264_check_intra_pred_mode( VAR_0, VAR_9 ); if( VAR_9 < 0 ) return -1; VAR_0->chroma_pred_mode= VAR_9; } } else if( VAR_3 == 4 ) { int VAR_27, VAR_12, VAR_13[4], VAR_16, VAR_15[2][4]; if( VAR_0->slice_type_nos == FF_B_TYPE ) { for( VAR_27 = 0; VAR_27 < 4; VAR_27++ ) { VAR_0->sub_mb_type[VAR_27] = decode_cabac_b_mb_sub_type( VAR_0 ); VAR_13[VAR_27]= b_sub_mb_type_info[ VAR_0->sub_mb_type[VAR_27] ].VAR_3; VAR_0->sub_mb_type[VAR_27]= b_sub_mb_type_info[ VAR_0->sub_mb_type[VAR_27] ].type; } if( IS_DIRECT(VAR_0->sub_mb_type[0] | VAR_0->sub_mb_type[1] | VAR_0->sub_mb_type[2] | VAR_0->sub_mb_type[3]) ) { ff_h264_pred_direct_motion(VAR_0, &VAR_2); 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; if( VAR_0->ref_count[0] > 1 || VAR_0->ref_count[1] > 1 ) { for( VAR_27 = 0; VAR_27 < 4; VAR_27++ ) if( IS_DIRECT(VAR_0->sub_mb_type[VAR_27]) ) fill_rectangle( &VAR_0->direct_cache[scan8[4*VAR_27]], 2, 2, 8, 1, 1 ); } } } else { for( VAR_27 = 0; VAR_27 < 4; VAR_27++ ) { VAR_0->sub_mb_type[VAR_27] = decode_cabac_p_mb_sub_type( VAR_0 ); VAR_13[VAR_27]= p_sub_mb_type_info[ VAR_0->sub_mb_type[VAR_27] ].VAR_3; VAR_0->sub_mb_type[VAR_27]= p_sub_mb_type_info[ VAR_0->sub_mb_type[VAR_27] ].type; } } for( VAR_16 = 0; VAR_16 < VAR_0->list_count; VAR_16++ ) { for( VAR_27 = 0; VAR_27 < 4; VAR_27++ ) { if(IS_DIRECT(VAR_0->sub_mb_type[VAR_27])) continue; if(IS_DIR(VAR_0->sub_mb_type[VAR_27], 0, VAR_16)){ if( VAR_0->ref_count[VAR_16] > 1 ){ VAR_15[VAR_16][VAR_27] = decode_cabac_mb_ref( VAR_0, VAR_16, 4*VAR_27 ); if(VAR_15[VAR_16][VAR_27] >= (unsigned)VAR_0->ref_count[VAR_16]){ av_log(s->avctx, AV_LOG_ERROR, "Reference %d >= %d\n", VAR_15[VAR_16][VAR_27], VAR_0->ref_count[VAR_16]); return -1; } }else VAR_15[VAR_16][VAR_27] = 0; } else { VAR_15[VAR_16][VAR_27] = -1; } VAR_0->ref_cache[VAR_16][ scan8[4*VAR_27]+1 ]= VAR_0->ref_cache[VAR_16][ scan8[4*VAR_27]+8 ]=VAR_0->ref_cache[VAR_16][ scan8[4*VAR_27]+9 ]= VAR_15[VAR_16][VAR_27]; } } if(VAR_5) VAR_5 = get_dct8x8_allowed(VAR_0); for(VAR_16=0; VAR_16<VAR_0->list_count; VAR_16++){ for(VAR_27=0; VAR_27<4; VAR_27++){ VAR_0->ref_cache[VAR_16][ scan8[4*VAR_27] ]=VAR_0->ref_cache[VAR_16][ scan8[4*VAR_27]+1 ]; if(IS_DIRECT(VAR_0->sub_mb_type[VAR_27])){ fill_rectangle(VAR_0->mvd_cache[VAR_16][scan8[4*VAR_27]], 2, 2, 8, 0, 4); continue; } if(IS_DIR(VAR_0->sub_mb_type[VAR_27], 0, VAR_16) && !IS_DIRECT(VAR_0->sub_mb_type[VAR_27])){ const int sub_mb_type= VAR_0->sub_mb_type[VAR_27]; const int block_width= (sub_mb_type & (MB_TYPE_16x16|MB_TYPE_16x8)) ? 2 : 1; for(VAR_12=0; VAR_12<VAR_13[VAR_27]; VAR_12++){ int VAR_18, VAR_19; int VAR_16, VAR_17; const int VAR_27= 4*VAR_27 + block_width*VAR_12; int16_t (* mv_cache)[2]= &VAR_0->mv_cache[VAR_16][ scan8[VAR_27] ]; int16_t (* mvd_cache)[2]= &VAR_0->mvd_cache[VAR_16][ scan8[VAR_27] ]; pred_motion(VAR_0, VAR_27, block_width, VAR_16, VAR_0->ref_cache[VAR_16][ scan8[VAR_27] ], &VAR_18, &VAR_19); VAR_16 = VAR_18 + decode_cabac_mb_mvd( VAR_0, VAR_16, VAR_27, 0 ); VAR_17 = VAR_19 + decode_cabac_mb_mvd( VAR_0, VAR_16, VAR_27, 1 ); tprintf(s->avctx, "final mv:%d %d\n", VAR_16, VAR_17); if(IS_SUB_8X8(sub_mb_type)){ mv_cache[ 1 ][0]= mv_cache[ 8 ][0]= mv_cache[ 9 ][0]= VAR_16; mv_cache[ 1 ][1]= mv_cache[ 8 ][1]= mv_cache[ 9 ][1]= VAR_17; mvd_cache[ 1 ][0]= mvd_cache[ 8 ][0]= mvd_cache[ 9 ][0]= VAR_16 - VAR_18; mvd_cache[ 1 ][1]= mvd_cache[ 8 ][1]= mvd_cache[ 9 ][1]= VAR_17 - VAR_19; }else if(IS_SUB_8X4(sub_mb_type)){ mv_cache[ 1 ][0]= VAR_16; mv_cache[ 1 ][1]= VAR_17; mvd_cache[ 1 ][0]= VAR_16 - VAR_18; mvd_cache[ 1 ][1]= VAR_17 - VAR_19; }else if(IS_SUB_4X8(sub_mb_type)){ mv_cache[ 8 ][0]= VAR_16; mv_cache[ 8 ][1]= VAR_17; mvd_cache[ 8 ][0]= VAR_16 - VAR_18; mvd_cache[ 8 ][1]= VAR_17 - VAR_19; } mv_cache[ 0 ][0]= VAR_16; mv_cache[ 0 ][1]= VAR_17; mvd_cache[ 0 ][0]= VAR_16 - VAR_18; mvd_cache[ 0 ][1]= VAR_17 - VAR_19; } }else{ uint32_t *p= (uint32_t *)&VAR_0->mv_cache[VAR_16][ scan8[4*VAR_27] ][0]; uint32_t *pd= (uint32_t *)&VAR_0->mvd_cache[VAR_16][ scan8[4*VAR_27] ][0]; p[0] = p[1] = p[8] = p[9] = 0; pd[0]= pd[1]= pd[8]= pd[9]= 0; } } } } else if( IS_DIRECT(VAR_2) ) { ff_h264_pred_direct_motion(VAR_0, &VAR_2); fill_rectangle(VAR_0->mvd_cache[0][scan8[0]], 4, 4, 8, 0, 4); fill_rectangle(VAR_0->mvd_cache[1][scan8[0]], 4, 4, 8, 0, 4); VAR_5 &= VAR_0->sps.direct_8x8_inference_flag; } else { int VAR_16, VAR_16, VAR_17, VAR_27, VAR_18, VAR_19; if(IS_16X16(VAR_2)){ for(VAR_16=0; VAR_16<VAR_0->list_count; VAR_16++){ if(IS_DIR(VAR_2, 0, VAR_16)){ int VAR_15; if(VAR_0->ref_count[VAR_16] > 1){ VAR_15= decode_cabac_mb_ref(VAR_0, VAR_16, 0); if(VAR_15 >= (unsigned)VAR_0->ref_count[VAR_16]){ av_log(s->avctx, AV_LOG_ERROR, "Reference %d >= %d\n", VAR_15, VAR_0->ref_count[VAR_16]); return -1; } }else VAR_15=0; fill_rectangle(&VAR_0->ref_cache[VAR_16][ scan8[0] ], 4, 4, 8, VAR_15, 1); }else fill_rectangle(&VAR_0->ref_cache[VAR_16][ scan8[0] ], 4, 4, 8, (uint8_t)LIST_NOT_USED, 1); } for(VAR_16=0; VAR_16<VAR_0->list_count; VAR_16++){ if(IS_DIR(VAR_2, 0, VAR_16)){ pred_motion(VAR_0, 0, 4, VAR_16, VAR_0->ref_cache[VAR_16][ scan8[0] ], &VAR_18, &VAR_19); VAR_16 = VAR_18 + decode_cabac_mb_mvd( VAR_0, VAR_16, 0, 0 ); VAR_17 = VAR_19 + decode_cabac_mb_mvd( VAR_0, VAR_16, 0, 1 ); tprintf(s->avctx, "final mv:%d %d\n", VAR_16, VAR_17); fill_rectangle(VAR_0->mvd_cache[VAR_16][ scan8[0] ], 4, 4, 8, pack16to32(VAR_16-VAR_18,VAR_17-VAR_19), 4); fill_rectangle(VAR_0->mv_cache[VAR_16][ scan8[0] ], 4, 4, 8, pack16to32(VAR_16,VAR_17), 4); }else fill_rectangle(VAR_0->mv_cache[VAR_16][ scan8[0] ], 4, 4, 8, 0, 4); } } else if(IS_16X8(VAR_2)){ for(VAR_16=0; VAR_16<VAR_0->list_count; VAR_16++){ for(VAR_27=0; VAR_27<2; VAR_27++){ if(IS_DIR(VAR_2, VAR_27, VAR_16)){ int VAR_15; if(VAR_0->ref_count[VAR_16] > 1){ VAR_15= decode_cabac_mb_ref( VAR_0, VAR_16, 8*VAR_27 ); if(VAR_15 >= (unsigned)VAR_0->ref_count[VAR_16]){ av_log(s->avctx, AV_LOG_ERROR, "Reference %d >= %d\n", VAR_15, VAR_0->ref_count[VAR_16]); return -1; } }else VAR_15=0; fill_rectangle(&VAR_0->ref_cache[VAR_16][ scan8[0] + 16*VAR_27 ], 4, 2, 8, VAR_15, 1); }else fill_rectangle(&VAR_0->ref_cache[VAR_16][ scan8[0] + 16*VAR_27 ], 4, 2, 8, (LIST_NOT_USED&0xFF), 1); } } for(VAR_16=0; VAR_16<VAR_0->list_count; VAR_16++){ for(VAR_27=0; VAR_27<2; VAR_27++){ if(IS_DIR(VAR_2, VAR_27, VAR_16)){ pred_16x8_motion(VAR_0, 8*VAR_27, VAR_16, VAR_0->ref_cache[VAR_16][scan8[0] + 16*VAR_27], &VAR_18, &VAR_19); VAR_16 = VAR_18 + decode_cabac_mb_mvd( VAR_0, VAR_16, 8*VAR_27, 0 ); VAR_17 = VAR_19 + decode_cabac_mb_mvd( VAR_0, VAR_16, 8*VAR_27, 1 ); tprintf(s->avctx, "final mv:%d %d\n", VAR_16, VAR_17); fill_rectangle(VAR_0->mvd_cache[VAR_16][ scan8[0] + 16*VAR_27 ], 4, 2, 8, pack16to32(VAR_16-VAR_18,VAR_17-VAR_19), 4); fill_rectangle(VAR_0->mv_cache[VAR_16][ scan8[0] + 16*VAR_27 ], 4, 2, 8, pack16to32(VAR_16,VAR_17), 4); }else{ fill_rectangle(VAR_0->mvd_cache[VAR_16][ scan8[0] + 16*VAR_27 ], 4, 2, 8, 0, 4); fill_rectangle(VAR_0-> mv_cache[VAR_16][ scan8[0] + 16*VAR_27 ], 4, 2, 8, 0, 4); } } } }else{ assert(IS_8X16(VAR_2)); for(VAR_16=0; VAR_16<VAR_0->list_count; VAR_16++){ for(VAR_27=0; VAR_27<2; VAR_27++){ if(IS_DIR(VAR_2, VAR_27, VAR_16)){ int VAR_15; if(VAR_0->ref_count[VAR_16] > 1){ VAR_15= decode_cabac_mb_ref( VAR_0, VAR_16, 4*VAR_27 ); if(VAR_15 >= (unsigned)VAR_0->ref_count[VAR_16]){ av_log(s->avctx, AV_LOG_ERROR, "Reference %d >= %d\n", VAR_15, VAR_0->ref_count[VAR_16]); return -1; } }else VAR_15=0; fill_rectangle(&VAR_0->ref_cache[VAR_16][ scan8[0] + 2*VAR_27 ], 2, 4, 8, VAR_15, 1); }else fill_rectangle(&VAR_0->ref_cache[VAR_16][ scan8[0] + 2*VAR_27 ], 2, 4, 8, (LIST_NOT_USED&0xFF), 1); } } for(VAR_16=0; VAR_16<VAR_0->list_count; VAR_16++){ for(VAR_27=0; VAR_27<2; VAR_27++){ if(IS_DIR(VAR_2, VAR_27, VAR_16)){ pred_8x16_motion(VAR_0, VAR_27*4, VAR_16, VAR_0->ref_cache[VAR_16][ scan8[0] + 2*VAR_27 ], &VAR_18, &VAR_19); VAR_16 = VAR_18 + decode_cabac_mb_mvd( VAR_0, VAR_16, 4*VAR_27, 0 ); VAR_17 = VAR_19 + decode_cabac_mb_mvd( VAR_0, VAR_16, 4*VAR_27, 1 ); tprintf(s->avctx, "final mv:%d %d\n", VAR_16, VAR_17); fill_rectangle(VAR_0->mvd_cache[VAR_16][ scan8[0] + 2*VAR_27 ], 2, 4, 8, pack16to32(VAR_16-VAR_18,VAR_17-VAR_19), 4); fill_rectangle(VAR_0->mv_cache[VAR_16][ scan8[0] + 2*VAR_27 ], 2, 4, 8, pack16to32(VAR_16,VAR_17), 4); }else{ fill_rectangle(VAR_0->mvd_cache[VAR_16][ scan8[0] + 2*VAR_27 ], 2, 4, 8, 0, 4); fill_rectangle(VAR_0-> mv_cache[VAR_16][ scan8[0] + 2*VAR_27 ], 2, 4, 8, 0, 4); } } } } } if( IS_INTER( VAR_2 ) ) { VAR_0->chroma_pred_mode_table[VAR_1] = 0; write_back_motion( VAR_0, VAR_2 ); } if( !IS_INTRA16x16( VAR_2 ) ) { VAR_4 = decode_cabac_mb_cbp_luma( VAR_0 ); if(CHROMA) VAR_4 |= decode_cabac_mb_cbp_chroma( VAR_0 ) << 4; } VAR_0->cbp_table[VAR_1] = VAR_0->VAR_4 = VAR_4; if( VAR_5 && (VAR_4&15) && !IS_INTRA( VAR_2 ) ) { if( decode_cabac_mb_transform_size( VAR_0 ) ) VAR_2 |= MB_TYPE_8x8DCT; } s->current_picture.VAR_2[VAR_1]= VAR_2; if( VAR_4 || IS_INTRA16x16( VAR_2 ) ) { const uint8_t *VAR_20, *scan8x8, *dc_scan; const uint32_t *VAR_21; int VAR_22; if(IS_INTERLACED(VAR_2)){ scan8x8= s->qscale ? VAR_0->field_scan8x8 : VAR_0->field_scan8x8_q0; VAR_20= s->qscale ? VAR_0->field_scan : VAR_0->field_scan_q0; dc_scan= luma_dc_field_scan; }else{ scan8x8= s->qscale ? VAR_0->zigzag_scan8x8 : VAR_0->zigzag_scan8x8_q0; VAR_20= s->qscale ? VAR_0->zigzag_scan : VAR_0->zigzag_scan_q0; dc_scan= luma_dc_zigzag_scan; } VAR_0->last_qscale_diff = VAR_22 = decode_cabac_mb_dqp( VAR_0 ); if( VAR_22 == INT_MIN ){ av_log(VAR_0->s.avctx, AV_LOG_ERROR, "cabac decode of qscale diff failed at %d %d\n", s->mb_x, s->mb_y); return -1; } s->qscale += VAR_22; 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_2 ) ) { int VAR_27; decode_cabac_residual( VAR_0, VAR_0->mb, 0, 0, dc_scan, NULL, 16); if( VAR_4&15 ) { VAR_21 = VAR_0->dequant4_coeff[0][s->qscale]; for( VAR_27 = 0; VAR_27 < 16; VAR_27++ ) { decode_cabac_residual(VAR_0, VAR_0->mb + 16*VAR_27, 1, VAR_27, VAR_20 + 1, VAR_21, 15); } } else { fill_rectangle(&VAR_0->non_zero_count_cache[scan8[0]], 4, 4, 8, 0, 1); } } else { int VAR_23, VAR_24; for( VAR_23 = 0; VAR_23 < 4; VAR_23++ ) { if( VAR_4 & (1<<VAR_23) ) { if( IS_8x8DCT(VAR_2) ) { decode_cabac_residual(VAR_0, VAR_0->mb + 64*VAR_23, 5, 4*VAR_23, scan8x8, VAR_0->dequant8_coeff[IS_INTRA( VAR_2 ) ? 0:1][s->qscale], 64); } else { VAR_21 = VAR_0->dequant4_coeff[IS_INTRA( VAR_2 ) ? 0:3][s->qscale]; for( VAR_24 = 0; VAR_24 < 4; VAR_24++ ) { const int VAR_27 = 4*VAR_23 + VAR_24; decode_cabac_residual(VAR_0, VAR_0->mb + 16*VAR_27, 2, VAR_27, VAR_20, VAR_21, 16); } } } else { uint8_t * const nnz= &VAR_0->non_zero_count_cache[ scan8[4*VAR_23] ]; nnz[0] = nnz[1] = nnz[8] = nnz[9] = 0; } } } if( VAR_4&0x30 ){ int VAR_27; for( VAR_27 = 0; VAR_27 < 2; VAR_27++ ) { decode_cabac_residual(VAR_0, VAR_0->mb + 256 + 16*4*VAR_27, 3, VAR_27, chroma_dc_scan, NULL, 4); } } if( VAR_4&0x20 ) { int VAR_27, VAR_27; for( VAR_27 = 0; VAR_27 < 2; VAR_27++ ) { VAR_21 = VAR_0->dequant4_coeff[VAR_27+1+(IS_INTRA( VAR_2 ) ? 0:3)][VAR_0->chroma_qp[VAR_27]]; for( VAR_27 = 0; VAR_27 < 4; VAR_27++ ) { const int VAR_27 = 16 + 4 * VAR_27 + VAR_27; decode_cabac_residual(VAR_0, VAR_0->mb + 16*VAR_27, 4, VAR_27, VAR_20 + 1, VAR_21, 15); } } } else { uint8_t * const nnz= &VAR_0->non_zero_count_cache[0]; nnz[ scan8[16]+0 ] = nnz[ scan8[16]+1 ] =nnz[ scan8[16]+8 ] =nnz[ scan8[16]+9 ] = nnz[ scan8[20]+0 ] = nnz[ scan8[20]+1 ] =nnz[ scan8[20]+8 ] =nnz[ scan8[20]+9 ] = 0; } } else { uint8_t * const nnz= &VAR_0->non_zero_count_cache[0]; fill_rectangle(&nnz[scan8[0]], 4, 4, 8, 0, 1); nnz[ scan8[16]+0 ] = nnz[ scan8[16]+1 ] =nnz[ scan8[16]+8 ] =nnz[ scan8[16]+9 ] = nnz[ scan8[20]+0 ] = nnz[ scan8[20]+1 ] =nnz[ scan8[20]+8 ] =nnz[ scan8[20]+9 ] = 0; VAR_0->last_qscale_diff = 0; } s->current_picture.qscale_table[VAR_1]= s->qscale; write_back_non_zero_count(VAR_0); if(MB_MBAFF){ VAR_0->ref_count[0] >>= 1; VAR_0->ref_count[1] >>= 1; } return 0; }
[ "int FUNC_0(H264Context *VAR_0) {", "MpegEncContext * const s = &VAR_0->s;", "int VAR_1;", "int VAR_2, VAR_3, VAR_4 = 0;", "int VAR_5= VAR_0->pps.transform_8x8_mode;", "VAR_1 = VAR_0->VAR_1 = s->mb_x + s->mb_y*s->mb_stride;", "tprintf(s->avctx, \"pic:%d mb:%d/%d\\n\", VAR_0->frame_num, s->mb_x, s->mb_y);", "if( VAR_0->slice_type_nos != FF_I_TYPE ) {", "int VAR_6;", "if( FRAME_MBAFF && s->mb_x==0 && (s->mb_y&1)==0 )\npredict_field_decoding_flag(VAR_0);", "if( FRAME_MBAFF && (s->mb_y&1)==1 && VAR_0->prev_mb_skipped )\nVAR_6 = VAR_0->next_mb_skipped;", "else\nVAR_6 = decode_cabac_mb_skip( VAR_0, s->mb_x, s->mb_y );", "if( VAR_6 ) {", "if( FRAME_MBAFF && (s->mb_y&1)==0 ){", "s->current_picture.VAR_2[VAR_1] = MB_TYPE_SKIP;", "VAR_0->next_mb_skipped = decode_cabac_mb_skip( VAR_0, s->mb_x, s->mb_y+1 );", "if(!VAR_0->next_mb_skipped)\nVAR_0->mb_mbaff = VAR_0->mb_field_decoding_flag = decode_cabac_field_decoding_flag(VAR_0);", "}", "decode_mb_skip(VAR_0);", "VAR_0->cbp_table[VAR_1] = 0;", "VAR_0->chroma_pred_mode_table[VAR_1] = 0;", "VAR_0->last_qscale_diff = 0;", "return 0;", "}", "}", "if(FRAME_MBAFF){", "if( (s->mb_y&1) == 0 )\nVAR_0->mb_mbaff =\nVAR_0->mb_field_decoding_flag = decode_cabac_field_decoding_flag(VAR_0);", "}", "VAR_0->prev_mb_skipped = 0;", "compute_mb_neighbors(VAR_0);", "if( VAR_0->slice_type_nos == FF_B_TYPE ) {", "VAR_2 = decode_cabac_mb_type_b( VAR_0 );", "if( VAR_2 < 23 ){", "VAR_3= b_mb_type_info[VAR_2].VAR_3;", "VAR_2= b_mb_type_info[VAR_2].type;", "}else{", "VAR_2 -= 23;", "goto decode_intra_mb;", "}", "} else if( VAR_0->slice_type_nos == FF_P_TYPE ) {", "if( get_cabac_noinline( &VAR_0->cabac, &VAR_0->cabac_state[14] ) == 0 ) {", "if( get_cabac_noinline( &VAR_0->cabac, &VAR_0->cabac_state[15] ) == 0 ) {", "VAR_2= 3 * get_cabac_noinline( &VAR_0->cabac, &VAR_0->cabac_state[16] );", "} else {", "VAR_2= 2 - get_cabac_noinline( &VAR_0->cabac, &VAR_0->cabac_state[17] );", "}", "VAR_3= p_mb_type_info[VAR_2].VAR_3;", "VAR_2= p_mb_type_info[VAR_2].type;", "} else {", "VAR_2= decode_cabac_intra_mb_type(VAR_0, 17, 0);", "goto decode_intra_mb;", "}", "} else {", "VAR_2= decode_cabac_intra_mb_type(VAR_0, 3, 1);", "if(VAR_0->slice_type == FF_SI_TYPE && VAR_2)\nVAR_2--;", "assert(VAR_0->slice_type_nos == FF_I_TYPE);", "decode_intra_mb:\nVAR_3 = 0;", "VAR_4= i_mb_type_info[VAR_2].VAR_4;", "VAR_0->intra16x16_pred_mode= i_mb_type_info[VAR_2].VAR_9;", "VAR_2= i_mb_type_info[VAR_2].type;", "}", "if(MB_FIELD)\nVAR_2 |= MB_TYPE_INTERLACED;", "VAR_0->slice_table[ VAR_1 ]= VAR_0->slice_num;", "if(IS_INTRA_PCM(VAR_2)) {", "const uint8_t *VAR_7;", "VAR_7= VAR_0->cabac.bytestream;", "if(VAR_0->cabac.low&0x1) VAR_7--;", "if(CABAC_BITS==16){", "if(VAR_0->cabac.low&0x1FF) VAR_7--;", "}", "memcpy(VAR_0->mb, VAR_7, 256); VAR_7+=256;", "if(CHROMA){", "memcpy(VAR_0->mb+128, VAR_7, 128); VAR_7+=128;", "}", "ff_init_cabac_decoder(&VAR_0->cabac, VAR_7, VAR_0->cabac.bytestream_end - VAR_7);", "VAR_0->cbp_table[VAR_1] = 0x1ef;", "VAR_0->chroma_pred_mode_table[VAR_1] = 0;", "s->current_picture.qscale_table[VAR_1]= 0;", "memset(VAR_0->non_zero_count[VAR_1], 16, 16);", "s->current_picture.VAR_2[VAR_1]= VAR_2;", "VAR_0->last_qscale_diff = 0;", "return 0;", "}", "if(MB_MBAFF){", "VAR_0->ref_count[0] <<= 1;", "VAR_0->ref_count[1] <<= 1;", "}", "fill_caches(VAR_0, VAR_2, 0);", "if( IS_INTRA( VAR_2 ) ) {", "int VAR_27, VAR_9;", "if( IS_INTRA4x4( VAR_2 ) ) {", "if( VAR_5 && decode_cabac_mb_transform_size( VAR_0 ) ) {", "VAR_2 |= MB_TYPE_8x8DCT;", "for( VAR_27 = 0; VAR_27 < 16; VAR_27+=4 ) {", "int VAR_12 = pred_intra_mode( VAR_0, VAR_27 );", "int VAR_11 = decode_cabac_mb_intra4x4_pred_mode( VAR_0, VAR_12 );", "fill_rectangle( &VAR_0->intra4x4_pred_mode_cache[ scan8[VAR_27] ], 2, 2, 8, VAR_11, 1 );", "}", "} else {", "for( VAR_27 = 0; VAR_27 < 16; VAR_27++ ) {", "int VAR_12 = pred_intra_mode( VAR_0, VAR_27 );", "VAR_0->intra4x4_pred_mode_cache[ scan8[VAR_27] ] = decode_cabac_mb_intra4x4_pred_mode( VAR_0, VAR_12 );", "}", "}", "ff_h264_write_back_intra_pred_mode(VAR_0);", "if( ff_h264_check_intra4x4_pred_mode(VAR_0) < 0 ) return -1;", "} else {", "VAR_0->intra16x16_pred_mode= ff_h264_check_intra_pred_mode( VAR_0, VAR_0->intra16x16_pred_mode );", "if( VAR_0->intra16x16_pred_mode < 0 ) return -1;", "}", "if(CHROMA){", "VAR_0->chroma_pred_mode_table[VAR_1] =\nVAR_9 = decode_cabac_mb_chroma_pre_mode( VAR_0 );", "VAR_9= ff_h264_check_intra_pred_mode( VAR_0, VAR_9 );", "if( VAR_9 < 0 ) return -1;", "VAR_0->chroma_pred_mode= VAR_9;", "}", "} else if( VAR_3 == 4 ) {", "int VAR_27, VAR_12, VAR_13[4], VAR_16, VAR_15[2][4];", "if( VAR_0->slice_type_nos == FF_B_TYPE ) {", "for( VAR_27 = 0; VAR_27 < 4; VAR_27++ ) {", "VAR_0->sub_mb_type[VAR_27] = decode_cabac_b_mb_sub_type( VAR_0 );", "VAR_13[VAR_27]= b_sub_mb_type_info[ VAR_0->sub_mb_type[VAR_27] ].VAR_3;", "VAR_0->sub_mb_type[VAR_27]= b_sub_mb_type_info[ VAR_0->sub_mb_type[VAR_27] ].type;", "}", "if( IS_DIRECT(VAR_0->sub_mb_type[0] | VAR_0->sub_mb_type[1] |\nVAR_0->sub_mb_type[2] | VAR_0->sub_mb_type[3]) ) {", "ff_h264_pred_direct_motion(VAR_0, &VAR_2);", "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;", "if( VAR_0->ref_count[0] > 1 || VAR_0->ref_count[1] > 1 ) {", "for( VAR_27 = 0; VAR_27 < 4; VAR_27++ )", "if( IS_DIRECT(VAR_0->sub_mb_type[VAR_27]) )\nfill_rectangle( &VAR_0->direct_cache[scan8[4*VAR_27]], 2, 2, 8, 1, 1 );", "}", "}", "} else {", "for( VAR_27 = 0; VAR_27 < 4; VAR_27++ ) {", "VAR_0->sub_mb_type[VAR_27] = decode_cabac_p_mb_sub_type( VAR_0 );", "VAR_13[VAR_27]= p_sub_mb_type_info[ VAR_0->sub_mb_type[VAR_27] ].VAR_3;", "VAR_0->sub_mb_type[VAR_27]= p_sub_mb_type_info[ VAR_0->sub_mb_type[VAR_27] ].type;", "}", "}", "for( VAR_16 = 0; VAR_16 < VAR_0->list_count; VAR_16++ ) {", "for( VAR_27 = 0; VAR_27 < 4; VAR_27++ ) {", "if(IS_DIRECT(VAR_0->sub_mb_type[VAR_27])) continue;", "if(IS_DIR(VAR_0->sub_mb_type[VAR_27], 0, VAR_16)){", "if( VAR_0->ref_count[VAR_16] > 1 ){", "VAR_15[VAR_16][VAR_27] = decode_cabac_mb_ref( VAR_0, VAR_16, 4*VAR_27 );", "if(VAR_15[VAR_16][VAR_27] >= (unsigned)VAR_0->ref_count[VAR_16]){", "av_log(s->avctx, AV_LOG_ERROR, \"Reference %d >= %d\\n\", VAR_15[VAR_16][VAR_27], VAR_0->ref_count[VAR_16]);", "return -1;", "}", "}else", "VAR_15[VAR_16][VAR_27] = 0;", "} else {", "VAR_15[VAR_16][VAR_27] = -1;", "}", "VAR_0->ref_cache[VAR_16][ scan8[4*VAR_27]+1 ]=\nVAR_0->ref_cache[VAR_16][ scan8[4*VAR_27]+8 ]=VAR_0->ref_cache[VAR_16][ scan8[4*VAR_27]+9 ]= VAR_15[VAR_16][VAR_27];", "}", "}", "if(VAR_5)\nVAR_5 = get_dct8x8_allowed(VAR_0);", "for(VAR_16=0; VAR_16<VAR_0->list_count; VAR_16++){", "for(VAR_27=0; VAR_27<4; VAR_27++){", "VAR_0->ref_cache[VAR_16][ scan8[4*VAR_27] ]=VAR_0->ref_cache[VAR_16][ scan8[4*VAR_27]+1 ];", "if(IS_DIRECT(VAR_0->sub_mb_type[VAR_27])){", "fill_rectangle(VAR_0->mvd_cache[VAR_16][scan8[4*VAR_27]], 2, 2, 8, 0, 4);", "continue;", "}", "if(IS_DIR(VAR_0->sub_mb_type[VAR_27], 0, VAR_16) && !IS_DIRECT(VAR_0->sub_mb_type[VAR_27])){", "const int sub_mb_type= VAR_0->sub_mb_type[VAR_27];", "const int block_width= (sub_mb_type & (MB_TYPE_16x16|MB_TYPE_16x8)) ? 2 : 1;", "for(VAR_12=0; VAR_12<VAR_13[VAR_27]; VAR_12++){", "int VAR_18, VAR_19;", "int VAR_16, VAR_17;", "const int VAR_27= 4*VAR_27 + block_width*VAR_12;", "int16_t (* mv_cache)[2]= &VAR_0->mv_cache[VAR_16][ scan8[VAR_27] ];", "int16_t (* mvd_cache)[2]= &VAR_0->mvd_cache[VAR_16][ scan8[VAR_27] ];", "pred_motion(VAR_0, VAR_27, block_width, VAR_16, VAR_0->ref_cache[VAR_16][ scan8[VAR_27] ], &VAR_18, &VAR_19);", "VAR_16 = VAR_18 + decode_cabac_mb_mvd( VAR_0, VAR_16, VAR_27, 0 );", "VAR_17 = VAR_19 + decode_cabac_mb_mvd( VAR_0, VAR_16, VAR_27, 1 );", "tprintf(s->avctx, \"final mv:%d %d\\n\", VAR_16, VAR_17);", "if(IS_SUB_8X8(sub_mb_type)){", "mv_cache[ 1 ][0]=\nmv_cache[ 8 ][0]= mv_cache[ 9 ][0]= VAR_16;", "mv_cache[ 1 ][1]=\nmv_cache[ 8 ][1]= mv_cache[ 9 ][1]= VAR_17;", "mvd_cache[ 1 ][0]=\nmvd_cache[ 8 ][0]= mvd_cache[ 9 ][0]= VAR_16 - VAR_18;", "mvd_cache[ 1 ][1]=\nmvd_cache[ 8 ][1]= mvd_cache[ 9 ][1]= VAR_17 - VAR_19;", "}else if(IS_SUB_8X4(sub_mb_type)){", "mv_cache[ 1 ][0]= VAR_16;", "mv_cache[ 1 ][1]= VAR_17;", "mvd_cache[ 1 ][0]= VAR_16 - VAR_18;", "mvd_cache[ 1 ][1]= VAR_17 - VAR_19;", "}else if(IS_SUB_4X8(sub_mb_type)){", "mv_cache[ 8 ][0]= VAR_16;", "mv_cache[ 8 ][1]= VAR_17;", "mvd_cache[ 8 ][0]= VAR_16 - VAR_18;", "mvd_cache[ 8 ][1]= VAR_17 - VAR_19;", "}", "mv_cache[ 0 ][0]= VAR_16;", "mv_cache[ 0 ][1]= VAR_17;", "mvd_cache[ 0 ][0]= VAR_16 - VAR_18;", "mvd_cache[ 0 ][1]= VAR_17 - VAR_19;", "}", "}else{", "uint32_t *p= (uint32_t *)&VAR_0->mv_cache[VAR_16][ scan8[4*VAR_27] ][0];", "uint32_t *pd= (uint32_t *)&VAR_0->mvd_cache[VAR_16][ scan8[4*VAR_27] ][0];", "p[0] = p[1] = p[8] = p[9] = 0;", "pd[0]= pd[1]= pd[8]= pd[9]= 0;", "}", "}", "}", "} else if( IS_DIRECT(VAR_2) ) {", "ff_h264_pred_direct_motion(VAR_0, &VAR_2);", "fill_rectangle(VAR_0->mvd_cache[0][scan8[0]], 4, 4, 8, 0, 4);", "fill_rectangle(VAR_0->mvd_cache[1][scan8[0]], 4, 4, 8, 0, 4);", "VAR_5 &= VAR_0->sps.direct_8x8_inference_flag;", "} else {", "int VAR_16, VAR_16, VAR_17, VAR_27, VAR_18, VAR_19;", "if(IS_16X16(VAR_2)){", "for(VAR_16=0; VAR_16<VAR_0->list_count; VAR_16++){", "if(IS_DIR(VAR_2, 0, VAR_16)){", "int VAR_15;", "if(VAR_0->ref_count[VAR_16] > 1){", "VAR_15= decode_cabac_mb_ref(VAR_0, VAR_16, 0);", "if(VAR_15 >= (unsigned)VAR_0->ref_count[VAR_16]){", "av_log(s->avctx, AV_LOG_ERROR, \"Reference %d >= %d\\n\", VAR_15, VAR_0->ref_count[VAR_16]);", "return -1;", "}", "}else", "VAR_15=0;", "fill_rectangle(&VAR_0->ref_cache[VAR_16][ scan8[0] ], 4, 4, 8, VAR_15, 1);", "}else", "fill_rectangle(&VAR_0->ref_cache[VAR_16][ scan8[0] ], 4, 4, 8, (uint8_t)LIST_NOT_USED, 1);", "}", "for(VAR_16=0; VAR_16<VAR_0->list_count; VAR_16++){", "if(IS_DIR(VAR_2, 0, VAR_16)){", "pred_motion(VAR_0, 0, 4, VAR_16, VAR_0->ref_cache[VAR_16][ scan8[0] ], &VAR_18, &VAR_19);", "VAR_16 = VAR_18 + decode_cabac_mb_mvd( VAR_0, VAR_16, 0, 0 );", "VAR_17 = VAR_19 + decode_cabac_mb_mvd( VAR_0, VAR_16, 0, 1 );", "tprintf(s->avctx, \"final mv:%d %d\\n\", VAR_16, VAR_17);", "fill_rectangle(VAR_0->mvd_cache[VAR_16][ scan8[0] ], 4, 4, 8, pack16to32(VAR_16-VAR_18,VAR_17-VAR_19), 4);", "fill_rectangle(VAR_0->mv_cache[VAR_16][ scan8[0] ], 4, 4, 8, pack16to32(VAR_16,VAR_17), 4);", "}else", "fill_rectangle(VAR_0->mv_cache[VAR_16][ scan8[0] ], 4, 4, 8, 0, 4);", "}", "}", "else if(IS_16X8(VAR_2)){", "for(VAR_16=0; VAR_16<VAR_0->list_count; VAR_16++){", "for(VAR_27=0; VAR_27<2; VAR_27++){", "if(IS_DIR(VAR_2, VAR_27, VAR_16)){", "int VAR_15;", "if(VAR_0->ref_count[VAR_16] > 1){", "VAR_15= decode_cabac_mb_ref( VAR_0, VAR_16, 8*VAR_27 );", "if(VAR_15 >= (unsigned)VAR_0->ref_count[VAR_16]){", "av_log(s->avctx, AV_LOG_ERROR, \"Reference %d >= %d\\n\", VAR_15, VAR_0->ref_count[VAR_16]);", "return -1;", "}", "}else", "VAR_15=0;", "fill_rectangle(&VAR_0->ref_cache[VAR_16][ scan8[0] + 16*VAR_27 ], 4, 2, 8, VAR_15, 1);", "}else", "fill_rectangle(&VAR_0->ref_cache[VAR_16][ scan8[0] + 16*VAR_27 ], 4, 2, 8, (LIST_NOT_USED&0xFF), 1);", "}", "}", "for(VAR_16=0; VAR_16<VAR_0->list_count; VAR_16++){", "for(VAR_27=0; VAR_27<2; VAR_27++){", "if(IS_DIR(VAR_2, VAR_27, VAR_16)){", "pred_16x8_motion(VAR_0, 8*VAR_27, VAR_16, VAR_0->ref_cache[VAR_16][scan8[0] + 16*VAR_27], &VAR_18, &VAR_19);", "VAR_16 = VAR_18 + decode_cabac_mb_mvd( VAR_0, VAR_16, 8*VAR_27, 0 );", "VAR_17 = VAR_19 + decode_cabac_mb_mvd( VAR_0, VAR_16, 8*VAR_27, 1 );", "tprintf(s->avctx, \"final mv:%d %d\\n\", VAR_16, VAR_17);", "fill_rectangle(VAR_0->mvd_cache[VAR_16][ scan8[0] + 16*VAR_27 ], 4, 2, 8, pack16to32(VAR_16-VAR_18,VAR_17-VAR_19), 4);", "fill_rectangle(VAR_0->mv_cache[VAR_16][ scan8[0] + 16*VAR_27 ], 4, 2, 8, pack16to32(VAR_16,VAR_17), 4);", "}else{", "fill_rectangle(VAR_0->mvd_cache[VAR_16][ scan8[0] + 16*VAR_27 ], 4, 2, 8, 0, 4);", "fill_rectangle(VAR_0-> mv_cache[VAR_16][ scan8[0] + 16*VAR_27 ], 4, 2, 8, 0, 4);", "}", "}", "}", "}else{", "assert(IS_8X16(VAR_2));", "for(VAR_16=0; VAR_16<VAR_0->list_count; VAR_16++){", "for(VAR_27=0; VAR_27<2; VAR_27++){", "if(IS_DIR(VAR_2, VAR_27, VAR_16)){", "int VAR_15;", "if(VAR_0->ref_count[VAR_16] > 1){", "VAR_15= decode_cabac_mb_ref( VAR_0, VAR_16, 4*VAR_27 );", "if(VAR_15 >= (unsigned)VAR_0->ref_count[VAR_16]){", "av_log(s->avctx, AV_LOG_ERROR, \"Reference %d >= %d\\n\", VAR_15, VAR_0->ref_count[VAR_16]);", "return -1;", "}", "}else", "VAR_15=0;", "fill_rectangle(&VAR_0->ref_cache[VAR_16][ scan8[0] + 2*VAR_27 ], 2, 4, 8, VAR_15, 1);", "}else", "fill_rectangle(&VAR_0->ref_cache[VAR_16][ scan8[0] + 2*VAR_27 ], 2, 4, 8, (LIST_NOT_USED&0xFF), 1);", "}", "}", "for(VAR_16=0; VAR_16<VAR_0->list_count; VAR_16++){", "for(VAR_27=0; VAR_27<2; VAR_27++){", "if(IS_DIR(VAR_2, VAR_27, VAR_16)){", "pred_8x16_motion(VAR_0, VAR_27*4, VAR_16, VAR_0->ref_cache[VAR_16][ scan8[0] + 2*VAR_27 ], &VAR_18, &VAR_19);", "VAR_16 = VAR_18 + decode_cabac_mb_mvd( VAR_0, VAR_16, 4*VAR_27, 0 );", "VAR_17 = VAR_19 + decode_cabac_mb_mvd( VAR_0, VAR_16, 4*VAR_27, 1 );", "tprintf(s->avctx, \"final mv:%d %d\\n\", VAR_16, VAR_17);", "fill_rectangle(VAR_0->mvd_cache[VAR_16][ scan8[0] + 2*VAR_27 ], 2, 4, 8, pack16to32(VAR_16-VAR_18,VAR_17-VAR_19), 4);", "fill_rectangle(VAR_0->mv_cache[VAR_16][ scan8[0] + 2*VAR_27 ], 2, 4, 8, pack16to32(VAR_16,VAR_17), 4);", "}else{", "fill_rectangle(VAR_0->mvd_cache[VAR_16][ scan8[0] + 2*VAR_27 ], 2, 4, 8, 0, 4);", "fill_rectangle(VAR_0-> mv_cache[VAR_16][ scan8[0] + 2*VAR_27 ], 2, 4, 8, 0, 4);", "}", "}", "}", "}", "}", "if( IS_INTER( VAR_2 ) ) {", "VAR_0->chroma_pred_mode_table[VAR_1] = 0;", "write_back_motion( VAR_0, VAR_2 );", "}", "if( !IS_INTRA16x16( VAR_2 ) ) {", "VAR_4 = decode_cabac_mb_cbp_luma( VAR_0 );", "if(CHROMA)\nVAR_4 |= decode_cabac_mb_cbp_chroma( VAR_0 ) << 4;", "}", "VAR_0->cbp_table[VAR_1] = VAR_0->VAR_4 = VAR_4;", "if( VAR_5 && (VAR_4&15) && !IS_INTRA( VAR_2 ) ) {", "if( decode_cabac_mb_transform_size( VAR_0 ) )\nVAR_2 |= MB_TYPE_8x8DCT;", "}", "s->current_picture.VAR_2[VAR_1]= VAR_2;", "if( VAR_4 || IS_INTRA16x16( VAR_2 ) ) {", "const uint8_t *VAR_20, *scan8x8, *dc_scan;", "const uint32_t *VAR_21;", "int VAR_22;", "if(IS_INTERLACED(VAR_2)){", "scan8x8= s->qscale ? VAR_0->field_scan8x8 : VAR_0->field_scan8x8_q0;", "VAR_20= s->qscale ? VAR_0->field_scan : VAR_0->field_scan_q0;", "dc_scan= luma_dc_field_scan;", "}else{", "scan8x8= s->qscale ? VAR_0->zigzag_scan8x8 : VAR_0->zigzag_scan8x8_q0;", "VAR_20= s->qscale ? VAR_0->zigzag_scan : VAR_0->zigzag_scan_q0;", "dc_scan= luma_dc_zigzag_scan;", "}", "VAR_0->last_qscale_diff = VAR_22 = decode_cabac_mb_dqp( VAR_0 );", "if( VAR_22 == INT_MIN ){", "av_log(VAR_0->s.avctx, AV_LOG_ERROR, \"cabac decode of qscale diff failed at %d %d\\n\", s->mb_x, s->mb_y);", "return -1;", "}", "s->qscale += VAR_22;", "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_2 ) ) {", "int VAR_27;", "decode_cabac_residual( VAR_0, VAR_0->mb, 0, 0, dc_scan, NULL, 16);", "if( VAR_4&15 ) {", "VAR_21 = VAR_0->dequant4_coeff[0][s->qscale];", "for( VAR_27 = 0; VAR_27 < 16; VAR_27++ ) {", "decode_cabac_residual(VAR_0, VAR_0->mb + 16*VAR_27, 1, VAR_27, VAR_20 + 1, VAR_21, 15);", "}", "} else {", "fill_rectangle(&VAR_0->non_zero_count_cache[scan8[0]], 4, 4, 8, 0, 1);", "}", "} else {", "int VAR_23, VAR_24;", "for( VAR_23 = 0; VAR_23 < 4; VAR_23++ ) {", "if( VAR_4 & (1<<VAR_23) ) {", "if( IS_8x8DCT(VAR_2) ) {", "decode_cabac_residual(VAR_0, VAR_0->mb + 64*VAR_23, 5, 4*VAR_23,\nscan8x8, VAR_0->dequant8_coeff[IS_INTRA( VAR_2 ) ? 0:1][s->qscale], 64);", "} else {", "VAR_21 = VAR_0->dequant4_coeff[IS_INTRA( VAR_2 ) ? 0:3][s->qscale];", "for( VAR_24 = 0; VAR_24 < 4; VAR_24++ ) {", "const int VAR_27 = 4*VAR_23 + VAR_24;", "decode_cabac_residual(VAR_0, VAR_0->mb + 16*VAR_27, 2, VAR_27, VAR_20, VAR_21, 16);", "}", "}", "} else {", "uint8_t * const nnz= &VAR_0->non_zero_count_cache[ scan8[4*VAR_23] ];", "nnz[0] = nnz[1] = nnz[8] = nnz[9] = 0;", "}", "}", "}", "if( VAR_4&0x30 ){", "int VAR_27;", "for( VAR_27 = 0; VAR_27 < 2; VAR_27++ ) {", "decode_cabac_residual(VAR_0, VAR_0->mb + 256 + 16*4*VAR_27, 3, VAR_27, chroma_dc_scan, NULL, 4);", "}", "}", "if( VAR_4&0x20 ) {", "int VAR_27, VAR_27;", "for( VAR_27 = 0; VAR_27 < 2; VAR_27++ ) {", "VAR_21 = VAR_0->dequant4_coeff[VAR_27+1+(IS_INTRA( VAR_2 ) ? 0:3)][VAR_0->chroma_qp[VAR_27]];", "for( VAR_27 = 0; VAR_27 < 4; VAR_27++ ) {", "const int VAR_27 = 16 + 4 * VAR_27 + VAR_27;", "decode_cabac_residual(VAR_0, VAR_0->mb + 16*VAR_27, 4, VAR_27, VAR_20 + 1, VAR_21, 15);", "}", "}", "} else {", "uint8_t * const nnz= &VAR_0->non_zero_count_cache[0];", "nnz[ scan8[16]+0 ] = nnz[ scan8[16]+1 ] =nnz[ scan8[16]+8 ] =nnz[ scan8[16]+9 ] =\nnnz[ scan8[20]+0 ] = nnz[ scan8[20]+1 ] =nnz[ scan8[20]+8 ] =nnz[ scan8[20]+9 ] = 0;", "}", "} else {", "uint8_t * const nnz= &VAR_0->non_zero_count_cache[0];", "fill_rectangle(&nnz[scan8[0]], 4, 4, 8, 0, 1);", "nnz[ scan8[16]+0 ] = nnz[ scan8[16]+1 ] =nnz[ scan8[16]+8 ] =nnz[ scan8[16]+9 ] =\nnnz[ scan8[20]+0 ] = nnz[ scan8[20]+1 ] =nnz[ scan8[20]+8 ] =nnz[ scan8[20]+9 ] = 0;", "VAR_0->last_qscale_diff = 0;", "}", "s->current_picture.qscale_table[VAR_1]= s->qscale;", "write_back_non_zero_count(VAR_0);", "if(MB_MBAFF){", "VAR_0->ref_count[0] >>= 1;", "VAR_0->ref_count[1] >>= 1;", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 25, 27 ], [ 29, 31 ], [ 33, 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47, 49 ], [ 51 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77, 79, 81 ], [ 83 ], [ 87 ], [ 91 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 119 ], [ 123 ], [ 125 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149, 151 ], [ 153 ], [ 155, 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167, 169 ], [ 173 ], [ 177 ], [ 179 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 213 ], [ 219 ], [ 221 ], [ 225 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 251 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277 ], [ 279 ], [ 281 ], [ 287 ], [ 289 ], [ 291 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305, 307 ], [ 311 ], [ 313 ], [ 315 ], [ 317 ], [ 319 ], [ 321 ], [ 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 ], [ 379 ], [ 381 ], [ 383 ], [ 385 ], [ 387 ], [ 389 ], [ 391 ], [ 393 ], [ 395 ], [ 397 ], [ 399 ], [ 401 ], [ 403 ], [ 405 ], [ 407 ], [ 409, 411 ], [ 413 ], [ 415 ], [ 419, 421 ], [ 425 ], [ 427 ], [ 429 ], [ 431 ], [ 433 ], [ 435 ], [ 437 ], [ 441 ], [ 443 ], [ 445 ], [ 447 ], [ 449 ], [ 451 ], [ 453 ], [ 455 ], [ 457 ], [ 459 ], [ 463 ], [ 465 ], [ 467 ], [ 471 ], [ 473, 475 ], [ 477, 479 ], [ 483, 485 ], [ 487, 489 ], [ 491 ], [ 493 ], [ 495 ], [ 499 ], [ 501 ], [ 503 ], [ 505 ], [ 507 ], [ 511 ], [ 513 ], [ 515 ], [ 517 ], [ 519 ], [ 523 ], [ 525 ], [ 527 ], [ 529 ], [ 531 ], [ 533 ], [ 535 ], [ 537 ], [ 539 ], [ 541 ], [ 543 ], [ 545 ], [ 547 ], [ 549 ], [ 551 ], [ 553 ], [ 555 ], [ 557 ], [ 559 ], [ 561 ], [ 563 ], [ 565 ], [ 567 ], [ 569 ], [ 571 ], [ 573 ], [ 575 ], [ 577 ], [ 579 ], [ 581 ], [ 583 ], [ 585 ], [ 587 ], [ 589 ], [ 591 ], [ 593 ], [ 595 ], [ 599 ], [ 601 ], [ 603 ], [ 607 ], [ 609 ], [ 611 ], [ 613 ], [ 615 ], [ 617 ], [ 619 ], [ 621 ], [ 623 ], [ 625 ], [ 627 ], [ 629 ], [ 631 ], [ 633 ], [ 635 ], [ 637 ], [ 639 ], [ 641 ], [ 643 ], [ 645 ], [ 647 ], [ 649 ], [ 651 ], [ 653 ], [ 655 ], [ 657 ], [ 659 ], [ 661 ], [ 663 ], [ 665 ], [ 667 ], [ 671 ], [ 673 ], [ 675 ], [ 677 ], [ 679 ], [ 681 ], [ 683 ], [ 685 ], [ 687 ], [ 689 ], [ 691 ], [ 693 ], [ 695 ], [ 697 ], [ 699 ], [ 701 ], [ 703 ], [ 705 ], [ 707 ], [ 709 ], [ 711 ], [ 713 ], [ 715 ], [ 717 ], [ 719 ], [ 721 ], [ 723 ], [ 725 ], [ 727 ], [ 729 ], [ 731 ], [ 733 ], [ 735 ], [ 739 ], [ 741 ], [ 743 ], [ 745 ], [ 747 ], [ 749 ], [ 751 ], [ 753 ], [ 755 ], [ 757 ], [ 759 ], [ 763 ], [ 765 ], [ 767 ], [ 769 ], [ 773 ], [ 775 ], [ 777, 779 ], [ 781 ], [ 785 ], [ 789 ], [ 791, 793 ], [ 795 ], [ 797 ], [ 801 ], [ 803 ], [ 805 ], [ 807 ], [ 811 ], [ 813 ], [ 815 ], [ 817 ], [ 819 ], [ 821 ], [ 823 ], [ 825 ], [ 827 ], [ 831 ], [ 833 ], [ 835 ], [ 837 ], [ 839 ], [ 841 ], [ 843 ], [ 845 ], [ 847 ], [ 849 ], [ 851 ], [ 853 ], [ 857 ], [ 859 ], [ 863 ], [ 867 ], [ 869 ], [ 871 ], [ 875 ], [ 877 ], [ 879 ], [ 881 ], [ 883 ], [ 885 ], [ 887 ], [ 889 ], [ 891 ], [ 893 ], [ 895, 897 ], [ 899 ], [ 901 ], [ 903 ], [ 905 ], [ 911 ], [ 915 ], [ 917 ], [ 919 ], [ 921 ], [ 923 ], [ 925 ], [ 927 ], [ 929 ], [ 933 ], [ 935 ], [ 937 ], [ 941 ], [ 943 ], [ 945 ], [ 949 ], [ 951 ], [ 953 ], [ 955 ], [ 957 ], [ 959 ], [ 963 ], [ 965 ], [ 967 ], [ 969 ], [ 971 ], [ 973, 975 ], [ 977 ], [ 979 ], [ 981 ], [ 983 ], [ 985, 987 ], [ 989 ], [ 991 ], [ 995 ], [ 997 ], [ 1001 ], [ 1003 ], [ 1005 ], [ 1007 ], [ 1011 ], [ 1013 ] ]
18,373
static int parse_read_interval(const char *interval_spec, ReadInterval *interval) { int ret = 0; char *next, *p, *spec = av_strdup(interval_spec); if (!spec) return AVERROR(ENOMEM); if (!*spec) { av_log(NULL, AV_LOG_ERROR, "Invalid empty interval specification\n"); ret = AVERROR(EINVAL); goto end; } p = spec; next = strchr(spec, '%'); if (next) *next++ = 0; /* parse first part */ if (*p) { interval->has_start = 1; if (*p == '+') { interval->start_is_offset = 1; p++; } else { interval->start_is_offset = 0; } ret = av_parse_time(&interval->start, p, 1); if (ret < 0) { av_log(NULL, AV_LOG_ERROR, "Invalid interval start specification '%s'\n", p); goto end; } } else { interval->has_start = 0; } /* parse second part */ p = next; if (p && *p) { int64_t us; interval->has_end = 1; if (*p == '+') { interval->end_is_offset = 1; p++; } else { interval->end_is_offset = 0; } if (interval->end_is_offset && *p == '#') { long long int lli; char *tail; interval->duration_frames = 1; p++; lli = strtoll(p, &tail, 10); if (*tail || lli < 0) { av_log(NULL, AV_LOG_ERROR, "Invalid or negative value '%s' for duration number of frames\n", p); goto end; } interval->end = lli; } else { ret = av_parse_time(&us, p, 1); if (ret < 0) { av_log(NULL, AV_LOG_ERROR, "Invalid interval end/duration specification '%s'\n", p); goto end; } interval->end = us; } } else { interval->has_end = 0; } end: av_free(spec); return ret; }
true
FFmpeg
7fb4b0368de18fc150e72a9190a4c87827d2d9d2
static int parse_read_interval(const char *interval_spec, ReadInterval *interval) { int ret = 0; char *next, *p, *spec = av_strdup(interval_spec); if (!spec) return AVERROR(ENOMEM); if (!*spec) { av_log(NULL, AV_LOG_ERROR, "Invalid empty interval specification\n"); ret = AVERROR(EINVAL); goto end; } p = spec; next = strchr(spec, '%'); if (next) *next++ = 0; if (*p) { interval->has_start = 1; if (*p == '+') { interval->start_is_offset = 1; p++; } else { interval->start_is_offset = 0; } ret = av_parse_time(&interval->start, p, 1); if (ret < 0) { av_log(NULL, AV_LOG_ERROR, "Invalid interval start specification '%s'\n", p); goto end; } } else { interval->has_start = 0; } p = next; if (p && *p) { int64_t us; interval->has_end = 1; if (*p == '+') { interval->end_is_offset = 1; p++; } else { interval->end_is_offset = 0; } if (interval->end_is_offset && *p == '#') { long long int lli; char *tail; interval->duration_frames = 1; p++; lli = strtoll(p, &tail, 10); if (*tail || lli < 0) { av_log(NULL, AV_LOG_ERROR, "Invalid or negative value '%s' for duration number of frames\n", p); goto end; } interval->end = lli; } else { ret = av_parse_time(&us, p, 1); if (ret < 0) { av_log(NULL, AV_LOG_ERROR, "Invalid interval end/duration specification '%s'\n", p); goto end; } interval->end = us; } } else { interval->has_end = 0; } end: av_free(spec); return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(const char *VAR_0, ReadInterval *VAR_1) { int VAR_2 = 0; char *VAR_3, *VAR_4, *VAR_5 = av_strdup(VAR_0); if (!VAR_5) return AVERROR(ENOMEM); if (!*VAR_5) { av_log(NULL, AV_LOG_ERROR, "Invalid empty VAR_1 specification\n"); VAR_2 = AVERROR(EINVAL); goto end; } VAR_4 = VAR_5; VAR_3 = strchr(VAR_5, '%'); if (VAR_3) *VAR_3++ = 0; if (*VAR_4) { VAR_1->has_start = 1; if (*VAR_4 == '+') { VAR_1->start_is_offset = 1; VAR_4++; } else { VAR_1->start_is_offset = 0; } VAR_2 = av_parse_time(&VAR_1->start, VAR_4, 1); if (VAR_2 < 0) { av_log(NULL, AV_LOG_ERROR, "Invalid VAR_1 start specification '%s'\n", VAR_4); goto end; } } else { VAR_1->has_start = 0; } VAR_4 = VAR_3; if (VAR_4 && *VAR_4) { int64_t us; VAR_1->has_end = 1; if (*VAR_4 == '+') { VAR_1->end_is_offset = 1; VAR_4++; } else { VAR_1->end_is_offset = 0; } if (VAR_1->end_is_offset && *VAR_4 == '#') { long long int VAR_6; char *VAR_7; VAR_1->duration_frames = 1; VAR_4++; VAR_6 = strtoll(VAR_4, &VAR_7, 10); if (*VAR_7 || VAR_6 < 0) { av_log(NULL, AV_LOG_ERROR, "Invalid or negative value '%s' for duration number of frames\n", VAR_4); goto end; } VAR_1->end = VAR_6; } else { VAR_2 = av_parse_time(&us, VAR_4, 1); if (VAR_2 < 0) { av_log(NULL, AV_LOG_ERROR, "Invalid VAR_1 end/duration specification '%s'\n", VAR_4); goto end; } VAR_1->end = us; } } else { VAR_1->has_end = 0; } end: av_free(VAR_5); return VAR_2; }
[ "static int FUNC_0(const char *VAR_0,\nReadInterval *VAR_1)\n{", "int VAR_2 = 0;", "char *VAR_3, *VAR_4, *VAR_5 = av_strdup(VAR_0);", "if (!VAR_5)\nreturn AVERROR(ENOMEM);", "if (!*VAR_5) {", "av_log(NULL, AV_LOG_ERROR, \"Invalid empty VAR_1 specification\\n\");", "VAR_2 = AVERROR(EINVAL);", "goto end;", "}", "VAR_4 = VAR_5;", "VAR_3 = strchr(VAR_5, '%');", "if (VAR_3)\n*VAR_3++ = 0;", "if (*VAR_4) {", "VAR_1->has_start = 1;", "if (*VAR_4 == '+') {", "VAR_1->start_is_offset = 1;", "VAR_4++;", "} else {", "VAR_1->start_is_offset = 0;", "}", "VAR_2 = av_parse_time(&VAR_1->start, VAR_4, 1);", "if (VAR_2 < 0) {", "av_log(NULL, AV_LOG_ERROR, \"Invalid VAR_1 start specification '%s'\\n\", VAR_4);", "goto end;", "}", "} else {", "VAR_1->has_start = 0;", "}", "VAR_4 = VAR_3;", "if (VAR_4 && *VAR_4) {", "int64_t us;", "VAR_1->has_end = 1;", "if (*VAR_4 == '+') {", "VAR_1->end_is_offset = 1;", "VAR_4++;", "} else {", "VAR_1->end_is_offset = 0;", "}", "if (VAR_1->end_is_offset && *VAR_4 == '#') {", "long long int VAR_6;", "char *VAR_7;", "VAR_1->duration_frames = 1;", "VAR_4++;", "VAR_6 = strtoll(VAR_4, &VAR_7, 10);", "if (*VAR_7 || VAR_6 < 0) {", "av_log(NULL, AV_LOG_ERROR,\n\"Invalid or negative value '%s' for duration number of frames\\n\", VAR_4);", "goto end;", "}", "VAR_1->end = VAR_6;", "} else {", "VAR_2 = av_parse_time(&us, VAR_4, 1);", "if (VAR_2 < 0) {", "av_log(NULL, AV_LOG_ERROR, \"Invalid VAR_1 end/duration specification '%s'\\n\", VAR_4);", "goto end;", "}", "VAR_1->end = us;", "}", "} else {", "VAR_1->has_end = 0;", "}", "end:\nav_free(VAR_5);", "return VAR_2;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11, 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33, 35 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119, 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 132 ], [ 134 ], [ 136 ], [ 138 ], [ 140 ], [ 142 ], [ 144 ], [ 146 ], [ 148 ], [ 150 ], [ 154, 156 ], [ 158 ], [ 160 ] ]
18,374
static uint32_t qvirtio_pci_get_guest_features(QVirtioDevice *d) { QVirtioPCIDevice *dev = (QVirtioPCIDevice *)d; return qpci_io_readl(dev->pdev, dev->addr + VIRTIO_PCI_GUEST_FEATURES); }
true
qemu
b4ba67d9a702507793c2724e56f98e9b0f7be02b
static uint32_t qvirtio_pci_get_guest_features(QVirtioDevice *d) { QVirtioPCIDevice *dev = (QVirtioPCIDevice *)d; return qpci_io_readl(dev->pdev, dev->addr + VIRTIO_PCI_GUEST_FEATURES); }
{ "code": [ " return qpci_io_readl(dev->pdev, dev->addr + VIRTIO_PCI_GUEST_FEATURES);" ], "line_no": [ 7 ] }
static uint32_t FUNC_0(QVirtioDevice *d) { QVirtioPCIDevice *dev = (QVirtioPCIDevice *)d; return qpci_io_readl(dev->pdev, dev->addr + VIRTIO_PCI_GUEST_FEATURES); }
[ "static uint32_t FUNC_0(QVirtioDevice *d)\n{", "QVirtioPCIDevice *dev = (QVirtioPCIDevice *)d;", "return qpci_io_readl(dev->pdev, dev->addr + VIRTIO_PCI_GUEST_FEATURES);", "}" ]
[ 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
18,375
bool virtio_scsi_handle_cmd_req_prepare(VirtIOSCSI *s, VirtIOSCSIReq *req) { VirtIOSCSICommon *vs = &s->parent_obj; SCSIDevice *d; int rc; rc = virtio_scsi_parse_req(req, sizeof(VirtIOSCSICmdReq) + vs->cdb_size, sizeof(VirtIOSCSICmdResp) + vs->sense_size); if (rc < 0) { if (rc == -ENOTSUP) { virtio_scsi_fail_cmd_req(req); } else { virtio_scsi_bad_req(); } return false; } d = virtio_scsi_device_find(s, req->req.cmd.lun); if (!d) { req->resp.cmd.response = VIRTIO_SCSI_S_BAD_TARGET; virtio_scsi_complete_cmd_req(req); return false; } if (s->dataplane_started) { assert(blk_get_aio_context(d->conf.blk) == s->ctx); } req->sreq = scsi_req_new(d, req->req.cmd.tag, virtio_scsi_get_lun(req->req.cmd.lun), req->req.cmd.cdb, req); if (req->sreq->cmd.mode != SCSI_XFER_NONE && (req->sreq->cmd.mode != req->mode || req->sreq->cmd.xfer > req->qsgl.size)) { req->resp.cmd.response = VIRTIO_SCSI_S_OVERRUN; virtio_scsi_complete_cmd_req(req); return false; } scsi_req_ref(req->sreq); blk_io_plug(d->conf.blk); return true; }
true
qemu
a8f2e5c8fffbaf7fbd4f0efc8efbeebade78008f
bool virtio_scsi_handle_cmd_req_prepare(VirtIOSCSI *s, VirtIOSCSIReq *req) { VirtIOSCSICommon *vs = &s->parent_obj; SCSIDevice *d; int rc; rc = virtio_scsi_parse_req(req, sizeof(VirtIOSCSICmdReq) + vs->cdb_size, sizeof(VirtIOSCSICmdResp) + vs->sense_size); if (rc < 0) { if (rc == -ENOTSUP) { virtio_scsi_fail_cmd_req(req); } else { virtio_scsi_bad_req(); } return false; } d = virtio_scsi_device_find(s, req->req.cmd.lun); if (!d) { req->resp.cmd.response = VIRTIO_SCSI_S_BAD_TARGET; virtio_scsi_complete_cmd_req(req); return false; } if (s->dataplane_started) { assert(blk_get_aio_context(d->conf.blk) == s->ctx); } req->sreq = scsi_req_new(d, req->req.cmd.tag, virtio_scsi_get_lun(req->req.cmd.lun), req->req.cmd.cdb, req); if (req->sreq->cmd.mode != SCSI_XFER_NONE && (req->sreq->cmd.mode != req->mode || req->sreq->cmd.xfer > req->qsgl.size)) { req->resp.cmd.response = VIRTIO_SCSI_S_OVERRUN; virtio_scsi_complete_cmd_req(req); return false; } scsi_req_ref(req->sreq); blk_io_plug(d->conf.blk); return true; }
{ "code": [ "bool virtio_scsi_handle_cmd_req_prepare(VirtIOSCSI *s, VirtIOSCSIReq *req)" ], "line_no": [ 1 ] }
bool FUNC_0(VirtIOSCSI *s, VirtIOSCSIReq *req) { VirtIOSCSICommon *vs = &s->parent_obj; SCSIDevice *d; int VAR_0; VAR_0 = virtio_scsi_parse_req(req, sizeof(VirtIOSCSICmdReq) + vs->cdb_size, sizeof(VirtIOSCSICmdResp) + vs->sense_size); if (VAR_0 < 0) { if (VAR_0 == -ENOTSUP) { virtio_scsi_fail_cmd_req(req); } else { virtio_scsi_bad_req(); } return false; } d = virtio_scsi_device_find(s, req->req.cmd.lun); if (!d) { req->resp.cmd.response = VIRTIO_SCSI_S_BAD_TARGET; virtio_scsi_complete_cmd_req(req); return false; } if (s->dataplane_started) { assert(blk_get_aio_context(d->conf.blk) == s->ctx); } req->sreq = scsi_req_new(d, req->req.cmd.tag, virtio_scsi_get_lun(req->req.cmd.lun), req->req.cmd.cdb, req); if (req->sreq->cmd.mode != SCSI_XFER_NONE && (req->sreq->cmd.mode != req->mode || req->sreq->cmd.xfer > req->qsgl.size)) { req->resp.cmd.response = VIRTIO_SCSI_S_OVERRUN; virtio_scsi_complete_cmd_req(req); return false; } scsi_req_ref(req->sreq); blk_io_plug(d->conf.blk); return true; }
[ "bool FUNC_0(VirtIOSCSI *s, VirtIOSCSIReq *req)\n{", "VirtIOSCSICommon *vs = &s->parent_obj;", "SCSIDevice *d;", "int VAR_0;", "VAR_0 = virtio_scsi_parse_req(req, sizeof(VirtIOSCSICmdReq) + vs->cdb_size,\nsizeof(VirtIOSCSICmdResp) + vs->sense_size);", "if (VAR_0 < 0) {", "if (VAR_0 == -ENOTSUP) {", "virtio_scsi_fail_cmd_req(req);", "} else {", "virtio_scsi_bad_req();", "}", "return false;", "}", "d = virtio_scsi_device_find(s, req->req.cmd.lun);", "if (!d) {", "req->resp.cmd.response = VIRTIO_SCSI_S_BAD_TARGET;", "virtio_scsi_complete_cmd_req(req);", "return false;", "}", "if (s->dataplane_started) {", "assert(blk_get_aio_context(d->conf.blk) == s->ctx);", "}", "req->sreq = scsi_req_new(d, req->req.cmd.tag,\nvirtio_scsi_get_lun(req->req.cmd.lun),\nreq->req.cmd.cdb, req);", "if (req->sreq->cmd.mode != SCSI_XFER_NONE\n&& (req->sreq->cmd.mode != req->mode ||\nreq->sreq->cmd.xfer > req->qsgl.size)) {", "req->resp.cmd.response = VIRTIO_SCSI_S_OVERRUN;", "virtio_scsi_complete_cmd_req(req);", "return false;", "}", "scsi_req_ref(req->sreq);", "blk_io_plug(d->conf.blk);", "return true;", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53, 55, 57 ], [ 61, 63, 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ] ]
18,376
static int mxf_read_primer_pack(void *arg, AVIOContext *pb, int tag, int size, UID uid) { MXFContext *mxf = arg; int item_num = avio_rb32(pb); int item_len = avio_rb32(pb); if (item_len != 18) { av_log(mxf->fc, AV_LOG_ERROR, "unsupported primer pack item length\n"); return -1; } if (item_num > UINT_MAX / item_len) return -1; mxf->local_tags_count = item_num; mxf->local_tags = av_malloc(item_num*item_len); if (!mxf->local_tags) return -1; avio_read(pb, mxf->local_tags, item_num*item_len); return 0; }
true
FFmpeg
fd34dbea58e097609ff09cf7dcc59f74930195d3
static int mxf_read_primer_pack(void *arg, AVIOContext *pb, int tag, int size, UID uid) { MXFContext *mxf = arg; int item_num = avio_rb32(pb); int item_len = avio_rb32(pb); if (item_len != 18) { av_log(mxf->fc, AV_LOG_ERROR, "unsupported primer pack item length\n"); return -1; } if (item_num > UINT_MAX / item_len) return -1; mxf->local_tags_count = item_num; mxf->local_tags = av_malloc(item_num*item_len); if (!mxf->local_tags) return -1; avio_read(pb, mxf->local_tags, item_num*item_len); return 0; }
{ "code": [ "static int mxf_read_primer_pack(void *arg, AVIOContext *pb, int tag, int size, UID uid)" ], "line_no": [ 1 ] }
static int FUNC_0(void *VAR_0, AVIOContext *VAR_1, int VAR_2, int VAR_3, UID VAR_4) { MXFContext *mxf = VAR_0; int VAR_5 = avio_rb32(VAR_1); int VAR_6 = avio_rb32(VAR_1); if (VAR_6 != 18) { av_log(mxf->fc, AV_LOG_ERROR, "unsupported primer pack item length\n"); return -1; } if (VAR_5 > UINT_MAX / VAR_6) return -1; mxf->local_tags_count = VAR_5; mxf->local_tags = av_malloc(VAR_5*VAR_6); if (!mxf->local_tags) return -1; avio_read(VAR_1, mxf->local_tags, VAR_5*VAR_6); return 0; }
[ "static int FUNC_0(void *VAR_0, AVIOContext *VAR_1, int VAR_2, int VAR_3, UID VAR_4)\n{", "MXFContext *mxf = VAR_0;", "int VAR_5 = avio_rb32(VAR_1);", "int VAR_6 = avio_rb32(VAR_1);", "if (VAR_6 != 18) {", "av_log(mxf->fc, AV_LOG_ERROR, \"unsupported primer pack item length\\n\");", "return -1;", "}", "if (VAR_5 > UINT_MAX / VAR_6)\nreturn -1;", "mxf->local_tags_count = VAR_5;", "mxf->local_tags = av_malloc(VAR_5*VAR_6);", "if (!mxf->local_tags)\nreturn -1;", "avio_read(VAR_1, mxf->local_tags, VAR_5*VAR_6);", "return 0;", "}" ]
[ 1, 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 ] ]
18,377
void qmp_transaction(BlockdevActionList *dev_list, Error **errp) { int ret = 0; BlockdevActionList *dev_entry = dev_list; BlkTransactionStates *states, *next; QSIMPLEQ_HEAD(snap_bdrv_states, BlkTransactionStates) snap_bdrv_states; QSIMPLEQ_INIT(&snap_bdrv_states); /* drain all i/o before any snapshots */ bdrv_drain_all(); /* We don't do anything in this loop that commits us to the snapshot */ while (NULL != dev_entry) { BlockdevAction *dev_info = NULL; BlockDriver *proto_drv; BlockDriver *drv; int flags; enum NewImageMode mode; const char *new_image_file; const char *device; const char *format = "qcow2"; dev_info = dev_entry->value; dev_entry = dev_entry->next; states = g_malloc0(sizeof(BlkTransactionStates)); QSIMPLEQ_INSERT_TAIL(&snap_bdrv_states, states, entry); switch (dev_info->kind) { case BLOCKDEV_ACTION_KIND_BLOCKDEV_SNAPSHOT_SYNC: device = dev_info->blockdev_snapshot_sync->device; if (!dev_info->blockdev_snapshot_sync->has_mode) { dev_info->blockdev_snapshot_sync->mode = NEW_IMAGE_MODE_ABSOLUTE_PATHS; } new_image_file = dev_info->blockdev_snapshot_sync->snapshot_file; if (dev_info->blockdev_snapshot_sync->has_format) { format = dev_info->blockdev_snapshot_sync->format; } mode = dev_info->blockdev_snapshot_sync->mode; break; default: abort(); } drv = bdrv_find_format(format); if (!drv) { error_set(errp, QERR_INVALID_BLOCK_FORMAT, format); goto delete_and_fail; } states->old_bs = bdrv_find(device); if (!states->old_bs) { error_set(errp, QERR_DEVICE_NOT_FOUND, device); goto delete_and_fail; } if (!bdrv_is_inserted(states->old_bs)) { error_set(errp, QERR_DEVICE_HAS_NO_MEDIUM, device); goto delete_and_fail; } if (bdrv_in_use(states->old_bs)) { error_set(errp, QERR_DEVICE_IN_USE, device); goto delete_and_fail; } if (!bdrv_is_read_only(states->old_bs)) { if (bdrv_flush(states->old_bs)) { error_set(errp, QERR_IO_ERROR); goto delete_and_fail; } } flags = states->old_bs->open_flags; proto_drv = bdrv_find_protocol(new_image_file); if (!proto_drv) { error_set(errp, QERR_INVALID_BLOCK_FORMAT, format); goto delete_and_fail; } /* create new image w/backing file */ if (mode != NEW_IMAGE_MODE_EXISTING) { ret = bdrv_img_create(new_image_file, format, states->old_bs->filename, states->old_bs->drv->format_name, NULL, -1, flags); if (ret) { error_set(errp, QERR_OPEN_FILE_FAILED, new_image_file); goto delete_and_fail; } } /* We will manually add the backing_hd field to the bs later */ states->new_bs = bdrv_new(""); ret = bdrv_open(states->new_bs, new_image_file, flags | BDRV_O_NO_BACKING, drv); if (ret != 0) { error_set(errp, QERR_OPEN_FILE_FAILED, new_image_file); goto delete_and_fail; } } /* Now we are going to do the actual pivot. Everything up to this point * is reversible, but we are committed at this point */ QSIMPLEQ_FOREACH(states, &snap_bdrv_states, entry) { /* This removes our old bs from the bdrv_states, and adds the new bs */ bdrv_append(states->new_bs, states->old_bs); } /* success */ goto exit; delete_and_fail: /* * failure, and it is all-or-none; abandon each new bs, and keep using * the original bs for all images */ QSIMPLEQ_FOREACH(states, &snap_bdrv_states, entry) { if (states->new_bs) { bdrv_delete(states->new_bs); } } exit: QSIMPLEQ_FOREACH_SAFE(states, &snap_bdrv_states, entry, next) { g_free(states); } return; }
true
qemu
870f5681c9dbafc738082b1fd48e0cc013bf43c7
void qmp_transaction(BlockdevActionList *dev_list, Error **errp) { int ret = 0; BlockdevActionList *dev_entry = dev_list; BlkTransactionStates *states, *next; QSIMPLEQ_HEAD(snap_bdrv_states, BlkTransactionStates) snap_bdrv_states; QSIMPLEQ_INIT(&snap_bdrv_states); bdrv_drain_all(); while (NULL != dev_entry) { BlockdevAction *dev_info = NULL; BlockDriver *proto_drv; BlockDriver *drv; int flags; enum NewImageMode mode; const char *new_image_file; const char *device; const char *format = "qcow2"; dev_info = dev_entry->value; dev_entry = dev_entry->next; states = g_malloc0(sizeof(BlkTransactionStates)); QSIMPLEQ_INSERT_TAIL(&snap_bdrv_states, states, entry); switch (dev_info->kind) { case BLOCKDEV_ACTION_KIND_BLOCKDEV_SNAPSHOT_SYNC: device = dev_info->blockdev_snapshot_sync->device; if (!dev_info->blockdev_snapshot_sync->has_mode) { dev_info->blockdev_snapshot_sync->mode = NEW_IMAGE_MODE_ABSOLUTE_PATHS; } new_image_file = dev_info->blockdev_snapshot_sync->snapshot_file; if (dev_info->blockdev_snapshot_sync->has_format) { format = dev_info->blockdev_snapshot_sync->format; } mode = dev_info->blockdev_snapshot_sync->mode; break; default: abort(); } drv = bdrv_find_format(format); if (!drv) { error_set(errp, QERR_INVALID_BLOCK_FORMAT, format); goto delete_and_fail; } states->old_bs = bdrv_find(device); if (!states->old_bs) { error_set(errp, QERR_DEVICE_NOT_FOUND, device); goto delete_and_fail; } if (!bdrv_is_inserted(states->old_bs)) { error_set(errp, QERR_DEVICE_HAS_NO_MEDIUM, device); goto delete_and_fail; } if (bdrv_in_use(states->old_bs)) { error_set(errp, QERR_DEVICE_IN_USE, device); goto delete_and_fail; } if (!bdrv_is_read_only(states->old_bs)) { if (bdrv_flush(states->old_bs)) { error_set(errp, QERR_IO_ERROR); goto delete_and_fail; } } flags = states->old_bs->open_flags; proto_drv = bdrv_find_protocol(new_image_file); if (!proto_drv) { error_set(errp, QERR_INVALID_BLOCK_FORMAT, format); goto delete_and_fail; } if (mode != NEW_IMAGE_MODE_EXISTING) { ret = bdrv_img_create(new_image_file, format, states->old_bs->filename, states->old_bs->drv->format_name, NULL, -1, flags); if (ret) { error_set(errp, QERR_OPEN_FILE_FAILED, new_image_file); goto delete_and_fail; } } states->new_bs = bdrv_new(""); ret = bdrv_open(states->new_bs, new_image_file, flags | BDRV_O_NO_BACKING, drv); if (ret != 0) { error_set(errp, QERR_OPEN_FILE_FAILED, new_image_file); goto delete_and_fail; } } QSIMPLEQ_FOREACH(states, &snap_bdrv_states, entry) { bdrv_append(states->new_bs, states->old_bs); } goto exit; delete_and_fail: QSIMPLEQ_FOREACH(states, &snap_bdrv_states, entry) { if (states->new_bs) { bdrv_delete(states->new_bs); } } exit: QSIMPLEQ_FOREACH_SAFE(states, &snap_bdrv_states, entry, next) { g_free(states); } return; }
{ "code": [], "line_no": [] }
void FUNC_0(BlockdevActionList *VAR_0, Error **VAR_1) { int VAR_2 = 0; BlockdevActionList *dev_entry = VAR_0; BlkTransactionStates *states, *next; QSIMPLEQ_HEAD(snap_bdrv_states, BlkTransactionStates) snap_bdrv_states; QSIMPLEQ_INIT(&snap_bdrv_states); bdrv_drain_all(); while (NULL != dev_entry) { BlockdevAction *dev_info = NULL; BlockDriver *proto_drv; BlockDriver *drv; int VAR_3; enum NewImageMode VAR_4; const char *VAR_5; const char *VAR_6; const char *VAR_7 = "qcow2"; dev_info = dev_entry->value; dev_entry = dev_entry->next; states = g_malloc0(sizeof(BlkTransactionStates)); QSIMPLEQ_INSERT_TAIL(&snap_bdrv_states, states, entry); switch (dev_info->kind) { case BLOCKDEV_ACTION_KIND_BLOCKDEV_SNAPSHOT_SYNC: VAR_6 = dev_info->blockdev_snapshot_sync->VAR_6; if (!dev_info->blockdev_snapshot_sync->has_mode) { dev_info->blockdev_snapshot_sync->VAR_4 = NEW_IMAGE_MODE_ABSOLUTE_PATHS; } VAR_5 = dev_info->blockdev_snapshot_sync->snapshot_file; if (dev_info->blockdev_snapshot_sync->has_format) { VAR_7 = dev_info->blockdev_snapshot_sync->VAR_7; } VAR_4 = dev_info->blockdev_snapshot_sync->VAR_4; break; default: abort(); } drv = bdrv_find_format(VAR_7); if (!drv) { error_set(VAR_1, QERR_INVALID_BLOCK_FORMAT, VAR_7); goto delete_and_fail; } states->old_bs = bdrv_find(VAR_6); if (!states->old_bs) { error_set(VAR_1, QERR_DEVICE_NOT_FOUND, VAR_6); goto delete_and_fail; } if (!bdrv_is_inserted(states->old_bs)) { error_set(VAR_1, QERR_DEVICE_HAS_NO_MEDIUM, VAR_6); goto delete_and_fail; } if (bdrv_in_use(states->old_bs)) { error_set(VAR_1, QERR_DEVICE_IN_USE, VAR_6); goto delete_and_fail; } if (!bdrv_is_read_only(states->old_bs)) { if (bdrv_flush(states->old_bs)) { error_set(VAR_1, QERR_IO_ERROR); goto delete_and_fail; } } VAR_3 = states->old_bs->open_flags; proto_drv = bdrv_find_protocol(VAR_5); if (!proto_drv) { error_set(VAR_1, QERR_INVALID_BLOCK_FORMAT, VAR_7); goto delete_and_fail; } if (VAR_4 != NEW_IMAGE_MODE_EXISTING) { VAR_2 = bdrv_img_create(VAR_5, VAR_7, states->old_bs->filename, states->old_bs->drv->format_name, NULL, -1, VAR_3); if (VAR_2) { error_set(VAR_1, QERR_OPEN_FILE_FAILED, VAR_5); goto delete_and_fail; } } states->new_bs = bdrv_new(""); VAR_2 = bdrv_open(states->new_bs, VAR_5, VAR_3 | BDRV_O_NO_BACKING, drv); if (VAR_2 != 0) { error_set(VAR_1, QERR_OPEN_FILE_FAILED, VAR_5); goto delete_and_fail; } } QSIMPLEQ_FOREACH(states, &snap_bdrv_states, entry) { bdrv_append(states->new_bs, states->old_bs); } goto exit; delete_and_fail: QSIMPLEQ_FOREACH(states, &snap_bdrv_states, entry) { if (states->new_bs) { bdrv_delete(states->new_bs); } } exit: QSIMPLEQ_FOREACH_SAFE(states, &snap_bdrv_states, entry, next) { g_free(states); } return; }
[ "void FUNC_0(BlockdevActionList *VAR_0, Error **VAR_1)\n{", "int VAR_2 = 0;", "BlockdevActionList *dev_entry = VAR_0;", "BlkTransactionStates *states, *next;", "QSIMPLEQ_HEAD(snap_bdrv_states, BlkTransactionStates) snap_bdrv_states;", "QSIMPLEQ_INIT(&snap_bdrv_states);", "bdrv_drain_all();", "while (NULL != dev_entry) {", "BlockdevAction *dev_info = NULL;", "BlockDriver *proto_drv;", "BlockDriver *drv;", "int VAR_3;", "enum NewImageMode VAR_4;", "const char *VAR_5;", "const char *VAR_6;", "const char *VAR_7 = \"qcow2\";", "dev_info = dev_entry->value;", "dev_entry = dev_entry->next;", "states = g_malloc0(sizeof(BlkTransactionStates));", "QSIMPLEQ_INSERT_TAIL(&snap_bdrv_states, states, entry);", "switch (dev_info->kind) {", "case BLOCKDEV_ACTION_KIND_BLOCKDEV_SNAPSHOT_SYNC:\nVAR_6 = dev_info->blockdev_snapshot_sync->VAR_6;", "if (!dev_info->blockdev_snapshot_sync->has_mode) {", "dev_info->blockdev_snapshot_sync->VAR_4 = NEW_IMAGE_MODE_ABSOLUTE_PATHS;", "}", "VAR_5 = dev_info->blockdev_snapshot_sync->snapshot_file;", "if (dev_info->blockdev_snapshot_sync->has_format) {", "VAR_7 = dev_info->blockdev_snapshot_sync->VAR_7;", "}", "VAR_4 = dev_info->blockdev_snapshot_sync->VAR_4;", "break;", "default:\nabort();", "}", "drv = bdrv_find_format(VAR_7);", "if (!drv) {", "error_set(VAR_1, QERR_INVALID_BLOCK_FORMAT, VAR_7);", "goto delete_and_fail;", "}", "states->old_bs = bdrv_find(VAR_6);", "if (!states->old_bs) {", "error_set(VAR_1, QERR_DEVICE_NOT_FOUND, VAR_6);", "goto delete_and_fail;", "}", "if (!bdrv_is_inserted(states->old_bs)) {", "error_set(VAR_1, QERR_DEVICE_HAS_NO_MEDIUM, VAR_6);", "goto delete_and_fail;", "}", "if (bdrv_in_use(states->old_bs)) {", "error_set(VAR_1, QERR_DEVICE_IN_USE, VAR_6);", "goto delete_and_fail;", "}", "if (!bdrv_is_read_only(states->old_bs)) {", "if (bdrv_flush(states->old_bs)) {", "error_set(VAR_1, QERR_IO_ERROR);", "goto delete_and_fail;", "}", "}", "VAR_3 = states->old_bs->open_flags;", "proto_drv = bdrv_find_protocol(VAR_5);", "if (!proto_drv) {", "error_set(VAR_1, QERR_INVALID_BLOCK_FORMAT, VAR_7);", "goto delete_and_fail;", "}", "if (VAR_4 != NEW_IMAGE_MODE_EXISTING) {", "VAR_2 = bdrv_img_create(VAR_5, VAR_7,\nstates->old_bs->filename,\nstates->old_bs->drv->format_name,\nNULL, -1, VAR_3);", "if (VAR_2) {", "error_set(VAR_1, QERR_OPEN_FILE_FAILED, VAR_5);", "goto delete_and_fail;", "}", "}", "states->new_bs = bdrv_new(\"\");", "VAR_2 = bdrv_open(states->new_bs, VAR_5,\nVAR_3 | BDRV_O_NO_BACKING, drv);", "if (VAR_2 != 0) {", "error_set(VAR_1, QERR_OPEN_FILE_FAILED, VAR_5);", "goto delete_and_fail;", "}", "}", "QSIMPLEQ_FOREACH(states, &snap_bdrv_states, entry) {", "bdrv_append(states->new_bs, states->old_bs);", "}", "goto exit;", "delete_and_fail:\nQSIMPLEQ_FOREACH(states, &snap_bdrv_states, entry) {", "if (states->new_bs) {", "bdrv_delete(states->new_bs);", "}", "}", "exit:\nQSIMPLEQ_FOREACH_SAFE(states, &snap_bdrv_states, entry, next) {", "g_free(states);", "}", "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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 21 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 59 ], [ 61, 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83, 85 ], [ 87 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 149 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 167 ], [ 169, 171, 173, 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 191 ], [ 193, 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 215 ], [ 219 ], [ 226 ], [ 232 ], [ 236, 246 ], [ 248 ], [ 250 ], [ 252 ], [ 254 ], [ 256, 258 ], [ 260 ], [ 262 ], [ 264 ], [ 266 ] ]
18,378
static int genh_read_header(AVFormatContext *s) { unsigned start_offset, header_size, codec, coef_type, coef[2]; GENHDemuxContext *c = s->priv_data; av_unused unsigned coef_splitted[2]; int align, ch, ret; AVStream *st; avio_skip(s->pb, 4); st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; st->codecpar->channels = avio_rl32(s->pb); if (st->codecpar->channels <= 0) return AVERROR_INVALIDDATA; if (st->codecpar->channels == 1) st->codecpar->channel_layout = AV_CH_LAYOUT_MONO; else if (st->codecpar->channels == 2) st->codecpar->channel_layout = AV_CH_LAYOUT_STEREO; align = c->interleave_size = avio_rl32(s->pb); if (align < 0 || align > INT_MAX / st->codecpar->channels) return AVERROR_INVALIDDATA; st->codecpar->block_align = align * st->codecpar->channels; st->codecpar->sample_rate = avio_rl32(s->pb); avio_skip(s->pb, 4); st->duration = avio_rl32(s->pb); codec = avio_rl32(s->pb); switch (codec) { case 0: st->codecpar->codec_id = AV_CODEC_ID_ADPCM_PSX; break; case 1: case 11: st->codecpar->bits_per_coded_sample = 4; st->codecpar->block_align = 36 * st->codecpar->channels; st->codecpar->codec_id = AV_CODEC_ID_ADPCM_IMA_WAV; break; case 2: st->codecpar->codec_id = AV_CODEC_ID_ADPCM_DTK; break; case 3: st->codecpar->codec_id = st->codecpar->block_align > 0 ? AV_CODEC_ID_PCM_S16BE_PLANAR : AV_CODEC_ID_PCM_S16BE; break; case 4: st->codecpar->codec_id = st->codecpar->block_align > 0 ? AV_CODEC_ID_PCM_S16LE_PLANAR : AV_CODEC_ID_PCM_S16LE; break; case 5: st->codecpar->codec_id = st->codecpar->block_align > 0 ? AV_CODEC_ID_PCM_S8_PLANAR : AV_CODEC_ID_PCM_S8; break; case 6: st->codecpar->codec_id = AV_CODEC_ID_SDX2_DPCM; break; case 7: ret = ff_alloc_extradata(st->codecpar, 2); if (ret < 0) return ret; AV_WL16(st->codecpar->extradata, 3); st->codecpar->codec_id = AV_CODEC_ID_ADPCM_IMA_WS; break; case 10: st->codecpar->codec_id = AV_CODEC_ID_ADPCM_AICA; break; case 12: st->codecpar->codec_id = AV_CODEC_ID_ADPCM_THP; break; case 13: st->codecpar->codec_id = AV_CODEC_ID_PCM_U8; break; case 17: st->codecpar->codec_id = AV_CODEC_ID_ADPCM_IMA_QT; break; default: avpriv_request_sample(s, "codec %d", codec); return AVERROR_PATCHWELCOME; } start_offset = avio_rl32(s->pb); header_size = avio_rl32(s->pb); if (header_size > start_offset) return AVERROR_INVALIDDATA; if (header_size == 0) start_offset = 0x800; coef[0] = avio_rl32(s->pb); coef[1] = avio_rl32(s->pb); c->dsp_int_type = avio_rl32(s->pb); coef_type = avio_rl32(s->pb); coef_splitted[0] = avio_rl32(s->pb); coef_splitted[1] = avio_rl32(s->pb); if (st->codecpar->codec_id == AV_CODEC_ID_ADPCM_THP) { if (st->codecpar->channels > 2) { avpriv_request_sample(s, "channels %d>2", st->codecpar->channels); return AVERROR_PATCHWELCOME; } ff_alloc_extradata(st->codecpar, 32 * st->codecpar->channels); for (ch = 0; ch < st->codecpar->channels; ch++) { if (coef_type & 1) { avpriv_request_sample(s, "coef_type & 1"); return AVERROR_PATCHWELCOME; } else { avio_seek(s->pb, coef[ch], SEEK_SET); avio_read(s->pb, st->codecpar->extradata + 32 * ch, 32); } } if (c->dsp_int_type == 1) { st->codecpar->block_align = 8 * st->codecpar->channels; if (c->interleave_size != 1 && c->interleave_size != 2 && c->interleave_size != 4) return AVERROR_INVALIDDATA; } } avio_skip(s->pb, start_offset - avio_tell(s->pb)); avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate); return 0; }
true
FFmpeg
5b0ae88ca6b3eb85dbda1762f16f1b5e7c3aa014
static int genh_read_header(AVFormatContext *s) { unsigned start_offset, header_size, codec, coef_type, coef[2]; GENHDemuxContext *c = s->priv_data; av_unused unsigned coef_splitted[2]; int align, ch, ret; AVStream *st; avio_skip(s->pb, 4); st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; st->codecpar->channels = avio_rl32(s->pb); if (st->codecpar->channels <= 0) return AVERROR_INVALIDDATA; if (st->codecpar->channels == 1) st->codecpar->channel_layout = AV_CH_LAYOUT_MONO; else if (st->codecpar->channels == 2) st->codecpar->channel_layout = AV_CH_LAYOUT_STEREO; align = c->interleave_size = avio_rl32(s->pb); if (align < 0 || align > INT_MAX / st->codecpar->channels) return AVERROR_INVALIDDATA; st->codecpar->block_align = align * st->codecpar->channels; st->codecpar->sample_rate = avio_rl32(s->pb); avio_skip(s->pb, 4); st->duration = avio_rl32(s->pb); codec = avio_rl32(s->pb); switch (codec) { case 0: st->codecpar->codec_id = AV_CODEC_ID_ADPCM_PSX; break; case 1: case 11: st->codecpar->bits_per_coded_sample = 4; st->codecpar->block_align = 36 * st->codecpar->channels; st->codecpar->codec_id = AV_CODEC_ID_ADPCM_IMA_WAV; break; case 2: st->codecpar->codec_id = AV_CODEC_ID_ADPCM_DTK; break; case 3: st->codecpar->codec_id = st->codecpar->block_align > 0 ? AV_CODEC_ID_PCM_S16BE_PLANAR : AV_CODEC_ID_PCM_S16BE; break; case 4: st->codecpar->codec_id = st->codecpar->block_align > 0 ? AV_CODEC_ID_PCM_S16LE_PLANAR : AV_CODEC_ID_PCM_S16LE; break; case 5: st->codecpar->codec_id = st->codecpar->block_align > 0 ? AV_CODEC_ID_PCM_S8_PLANAR : AV_CODEC_ID_PCM_S8; break; case 6: st->codecpar->codec_id = AV_CODEC_ID_SDX2_DPCM; break; case 7: ret = ff_alloc_extradata(st->codecpar, 2); if (ret < 0) return ret; AV_WL16(st->codecpar->extradata, 3); st->codecpar->codec_id = AV_CODEC_ID_ADPCM_IMA_WS; break; case 10: st->codecpar->codec_id = AV_CODEC_ID_ADPCM_AICA; break; case 12: st->codecpar->codec_id = AV_CODEC_ID_ADPCM_THP; break; case 13: st->codecpar->codec_id = AV_CODEC_ID_PCM_U8; break; case 17: st->codecpar->codec_id = AV_CODEC_ID_ADPCM_IMA_QT; break; default: avpriv_request_sample(s, "codec %d", codec); return AVERROR_PATCHWELCOME; } start_offset = avio_rl32(s->pb); header_size = avio_rl32(s->pb); if (header_size > start_offset) return AVERROR_INVALIDDATA; if (header_size == 0) start_offset = 0x800; coef[0] = avio_rl32(s->pb); coef[1] = avio_rl32(s->pb); c->dsp_int_type = avio_rl32(s->pb); coef_type = avio_rl32(s->pb); coef_splitted[0] = avio_rl32(s->pb); coef_splitted[1] = avio_rl32(s->pb); if (st->codecpar->codec_id == AV_CODEC_ID_ADPCM_THP) { if (st->codecpar->channels > 2) { avpriv_request_sample(s, "channels %d>2", st->codecpar->channels); return AVERROR_PATCHWELCOME; } ff_alloc_extradata(st->codecpar, 32 * st->codecpar->channels); for (ch = 0; ch < st->codecpar->channels; ch++) { if (coef_type & 1) { avpriv_request_sample(s, "coef_type & 1"); return AVERROR_PATCHWELCOME; } else { avio_seek(s->pb, coef[ch], SEEK_SET); avio_read(s->pb, st->codecpar->extradata + 32 * ch, 32); } } if (c->dsp_int_type == 1) { st->codecpar->block_align = 8 * st->codecpar->channels; if (c->interleave_size != 1 && c->interleave_size != 2 && c->interleave_size != 4) return AVERROR_INVALIDDATA; } } avio_skip(s->pb, start_offset - avio_tell(s->pb)); avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate); return 0; }
{ "code": [ " if (st->codecpar->channels <= 0)" ], "line_no": [ 33 ] }
static int FUNC_0(AVFormatContext *VAR_0) { unsigned VAR_1, VAR_2, VAR_3, VAR_4, VAR_5[2]; GENHDemuxContext *c = VAR_0->priv_data; av_unused unsigned coef_splitted[2]; int VAR_6, VAR_7, VAR_8; AVStream *st; avio_skip(VAR_0->pb, 4); st = avformat_new_stream(VAR_0, NULL); if (!st) return AVERROR(ENOMEM); st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; st->codecpar->channels = avio_rl32(VAR_0->pb); if (st->codecpar->channels <= 0) return AVERROR_INVALIDDATA; if (st->codecpar->channels == 1) st->codecpar->channel_layout = AV_CH_LAYOUT_MONO; else if (st->codecpar->channels == 2) st->codecpar->channel_layout = AV_CH_LAYOUT_STEREO; VAR_6 = c->interleave_size = avio_rl32(VAR_0->pb); if (VAR_6 < 0 || VAR_6 > INT_MAX / st->codecpar->channels) return AVERROR_INVALIDDATA; st->codecpar->block_align = VAR_6 * st->codecpar->channels; st->codecpar->sample_rate = avio_rl32(VAR_0->pb); avio_skip(VAR_0->pb, 4); st->duration = avio_rl32(VAR_0->pb); VAR_3 = avio_rl32(VAR_0->pb); switch (VAR_3) { case 0: st->codecpar->codec_id = AV_CODEC_ID_ADPCM_PSX; break; case 1: case 11: st->codecpar->bits_per_coded_sample = 4; st->codecpar->block_align = 36 * st->codecpar->channels; st->codecpar->codec_id = AV_CODEC_ID_ADPCM_IMA_WAV; break; case 2: st->codecpar->codec_id = AV_CODEC_ID_ADPCM_DTK; break; case 3: st->codecpar->codec_id = st->codecpar->block_align > 0 ? AV_CODEC_ID_PCM_S16BE_PLANAR : AV_CODEC_ID_PCM_S16BE; break; case 4: st->codecpar->codec_id = st->codecpar->block_align > 0 ? AV_CODEC_ID_PCM_S16LE_PLANAR : AV_CODEC_ID_PCM_S16LE; break; case 5: st->codecpar->codec_id = st->codecpar->block_align > 0 ? AV_CODEC_ID_PCM_S8_PLANAR : AV_CODEC_ID_PCM_S8; break; case 6: st->codecpar->codec_id = AV_CODEC_ID_SDX2_DPCM; break; case 7: VAR_8 = ff_alloc_extradata(st->codecpar, 2); if (VAR_8 < 0) return VAR_8; AV_WL16(st->codecpar->extradata, 3); st->codecpar->codec_id = AV_CODEC_ID_ADPCM_IMA_WS; break; case 10: st->codecpar->codec_id = AV_CODEC_ID_ADPCM_AICA; break; case 12: st->codecpar->codec_id = AV_CODEC_ID_ADPCM_THP; break; case 13: st->codecpar->codec_id = AV_CODEC_ID_PCM_U8; break; case 17: st->codecpar->codec_id = AV_CODEC_ID_ADPCM_IMA_QT; break; default: avpriv_request_sample(VAR_0, "VAR_3 %d", VAR_3); return AVERROR_PATCHWELCOME; } VAR_1 = avio_rl32(VAR_0->pb); VAR_2 = avio_rl32(VAR_0->pb); if (VAR_2 > VAR_1) return AVERROR_INVALIDDATA; if (VAR_2 == 0) VAR_1 = 0x800; VAR_5[0] = avio_rl32(VAR_0->pb); VAR_5[1] = avio_rl32(VAR_0->pb); c->dsp_int_type = avio_rl32(VAR_0->pb); VAR_4 = avio_rl32(VAR_0->pb); coef_splitted[0] = avio_rl32(VAR_0->pb); coef_splitted[1] = avio_rl32(VAR_0->pb); if (st->codecpar->codec_id == AV_CODEC_ID_ADPCM_THP) { if (st->codecpar->channels > 2) { avpriv_request_sample(VAR_0, "channels %d>2", st->codecpar->channels); return AVERROR_PATCHWELCOME; } ff_alloc_extradata(st->codecpar, 32 * st->codecpar->channels); for (VAR_7 = 0; VAR_7 < st->codecpar->channels; VAR_7++) { if (VAR_4 & 1) { avpriv_request_sample(VAR_0, "VAR_4 & 1"); return AVERROR_PATCHWELCOME; } else { avio_seek(VAR_0->pb, VAR_5[VAR_7], SEEK_SET); avio_read(VAR_0->pb, st->codecpar->extradata + 32 * VAR_7, 32); } } if (c->dsp_int_type == 1) { st->codecpar->block_align = 8 * st->codecpar->channels; if (c->interleave_size != 1 && c->interleave_size != 2 && c->interleave_size != 4) return AVERROR_INVALIDDATA; } } avio_skip(VAR_0->pb, VAR_1 - avio_tell(VAR_0->pb)); avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate); return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0)\n{", "unsigned VAR_1, VAR_2, VAR_3, VAR_4, VAR_5[2];", "GENHDemuxContext *c = VAR_0->priv_data;", "av_unused unsigned coef_splitted[2];", "int VAR_6, VAR_7, VAR_8;", "AVStream *st;", "avio_skip(VAR_0->pb, 4);", "st = avformat_new_stream(VAR_0, NULL);", "if (!st)\nreturn AVERROR(ENOMEM);", "st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;", "st->codecpar->channels = avio_rl32(VAR_0->pb);", "if (st->codecpar->channels <= 0)\nreturn AVERROR_INVALIDDATA;", "if (st->codecpar->channels == 1)\nst->codecpar->channel_layout = AV_CH_LAYOUT_MONO;", "else if (st->codecpar->channels == 2)\nst->codecpar->channel_layout = AV_CH_LAYOUT_STEREO;", "VAR_6 =\nc->interleave_size = avio_rl32(VAR_0->pb);", "if (VAR_6 < 0 || VAR_6 > INT_MAX / st->codecpar->channels)\nreturn AVERROR_INVALIDDATA;", "st->codecpar->block_align = VAR_6 * st->codecpar->channels;", "st->codecpar->sample_rate = avio_rl32(VAR_0->pb);", "avio_skip(VAR_0->pb, 4);", "st->duration = avio_rl32(VAR_0->pb);", "VAR_3 = avio_rl32(VAR_0->pb);", "switch (VAR_3) {", "case 0: st->codecpar->codec_id = AV_CODEC_ID_ADPCM_PSX; break;", "case 1:\ncase 11: st->codecpar->bits_per_coded_sample = 4;", "st->codecpar->block_align = 36 * st->codecpar->channels;", "st->codecpar->codec_id = AV_CODEC_ID_ADPCM_IMA_WAV; break;", "case 2: st->codecpar->codec_id = AV_CODEC_ID_ADPCM_DTK; break;", "case 3: st->codecpar->codec_id = st->codecpar->block_align > 0 ?\nAV_CODEC_ID_PCM_S16BE_PLANAR :\nAV_CODEC_ID_PCM_S16BE; break;", "case 4: st->codecpar->codec_id = st->codecpar->block_align > 0 ?\nAV_CODEC_ID_PCM_S16LE_PLANAR :\nAV_CODEC_ID_PCM_S16LE; break;", "case 5: st->codecpar->codec_id = st->codecpar->block_align > 0 ?\nAV_CODEC_ID_PCM_S8_PLANAR :\nAV_CODEC_ID_PCM_S8; break;", "case 6: st->codecpar->codec_id = AV_CODEC_ID_SDX2_DPCM; break;", "case 7: VAR_8 = ff_alloc_extradata(st->codecpar, 2);", "if (VAR_8 < 0)\nreturn VAR_8;", "AV_WL16(st->codecpar->extradata, 3);", "st->codecpar->codec_id = AV_CODEC_ID_ADPCM_IMA_WS; break;", "case 10: st->codecpar->codec_id = AV_CODEC_ID_ADPCM_AICA; break;", "case 12: st->codecpar->codec_id = AV_CODEC_ID_ADPCM_THP; break;", "case 13: st->codecpar->codec_id = AV_CODEC_ID_PCM_U8; break;", "case 17: st->codecpar->codec_id = AV_CODEC_ID_ADPCM_IMA_QT; break;", "default:\navpriv_request_sample(VAR_0, \"VAR_3 %d\", VAR_3);", "return AVERROR_PATCHWELCOME;", "}", "VAR_1 = avio_rl32(VAR_0->pb);", "VAR_2 = avio_rl32(VAR_0->pb);", "if (VAR_2 > VAR_1)\nreturn AVERROR_INVALIDDATA;", "if (VAR_2 == 0)\nVAR_1 = 0x800;", "VAR_5[0] = avio_rl32(VAR_0->pb);", "VAR_5[1] = avio_rl32(VAR_0->pb);", "c->dsp_int_type = avio_rl32(VAR_0->pb);", "VAR_4 = avio_rl32(VAR_0->pb);", "coef_splitted[0] = avio_rl32(VAR_0->pb);", "coef_splitted[1] = avio_rl32(VAR_0->pb);", "if (st->codecpar->codec_id == AV_CODEC_ID_ADPCM_THP) {", "if (st->codecpar->channels > 2) {", "avpriv_request_sample(VAR_0, \"channels %d>2\", st->codecpar->channels);", "return AVERROR_PATCHWELCOME;", "}", "ff_alloc_extradata(st->codecpar, 32 * st->codecpar->channels);", "for (VAR_7 = 0; VAR_7 < st->codecpar->channels; VAR_7++) {", "if (VAR_4 & 1) {", "avpriv_request_sample(VAR_0, \"VAR_4 & 1\");", "return AVERROR_PATCHWELCOME;", "} else {", "avio_seek(VAR_0->pb, VAR_5[VAR_7], SEEK_SET);", "avio_read(VAR_0->pb, st->codecpar->extradata + 32 * VAR_7, 32);", "}", "}", "if (c->dsp_int_type == 1) {", "st->codecpar->block_align = 8 * st->codecpar->channels;", "if (c->interleave_size != 1 &&\nc->interleave_size != 2 &&\nc->interleave_size != 4)\nreturn AVERROR_INVALIDDATA;", "}", "}", "avio_skip(VAR_0->pb, VAR_1 - avio_tell(VAR_0->pb));", "avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate);", "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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 21 ], [ 23, 25 ], [ 29 ], [ 31 ], [ 33, 35 ], [ 37, 39 ], [ 41, 43 ], [ 45, 47 ], [ 49, 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69, 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79, 81, 83 ], [ 85, 87, 89 ], [ 91, 93, 95 ], [ 97 ], [ 99 ], [ 101, 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117, 119 ], [ 121 ], [ 123 ], [ 127 ], [ 129 ], [ 133, 135 ], [ 139, 141 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 193 ], [ 195 ], [ 197, 199, 201, 203 ], [ 205 ], [ 207 ], [ 211 ], [ 215 ], [ 219 ], [ 221 ] ]
18,379
static void virtio_scsi_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass); dc->exit = virtio_scsi_device_exit; dc->props = virtio_scsi_properties; set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); vdc->init = virtio_scsi_device_init; vdc->set_config = virtio_scsi_set_config; vdc->get_features = virtio_scsi_get_features; vdc->reset = virtio_scsi_reset; }
true
qemu
e3c9d76acc984218264bbc6435b0c09f959ed9b8
static void virtio_scsi_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass); dc->exit = virtio_scsi_device_exit; dc->props = virtio_scsi_properties; set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); vdc->init = virtio_scsi_device_init; vdc->set_config = virtio_scsi_set_config; vdc->get_features = virtio_scsi_get_features; vdc->reset = virtio_scsi_reset; }
{ "code": [ " dc->exit = virtio_scsi_device_exit;" ], "line_no": [ 9 ] }
static void FUNC_0(ObjectClass *VAR_0, void *VAR_1) { DeviceClass *dc = DEVICE_CLASS(VAR_0); VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(VAR_0); dc->exit = virtio_scsi_device_exit; dc->props = virtio_scsi_properties; set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); vdc->init = virtio_scsi_device_init; vdc->set_config = virtio_scsi_set_config; vdc->get_features = virtio_scsi_get_features; vdc->reset = virtio_scsi_reset; }
[ "static void FUNC_0(ObjectClass *VAR_0, void *VAR_1)\n{", "DeviceClass *dc = DEVICE_CLASS(VAR_0);", "VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(VAR_0);", "dc->exit = virtio_scsi_device_exit;", "dc->props = virtio_scsi_properties;", "set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);", "vdc->init = virtio_scsi_device_init;", "vdc->set_config = virtio_scsi_set_config;", "vdc->get_features = virtio_scsi_get_features;", "vdc->reset = virtio_scsi_reset;", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ] ]
18,380
static int jpeg2000_decode_packet(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *codsty, Jpeg2000ResLevel *rlevel, int precno, int layno, uint8_t *expn, int numgbits) { int bandno, cblkno, ret, nb_code_blocks; if (!(ret = get_bits(s, 1))) { jpeg2000_flush(s); return 0; } else if (ret < 0) return ret; for (bandno = 0; bandno < rlevel->nbands; bandno++) { Jpeg2000Band *band = rlevel->band + bandno; Jpeg2000Prec *prec = band->prec + precno; if (band->coord[0][0] == band->coord[0][1] || band->coord[1][0] == band->coord[1][1]) continue; nb_code_blocks = prec->nb_codeblocks_height * prec->nb_codeblocks_width; for (cblkno = 0; cblkno < nb_code_blocks; cblkno++) { Jpeg2000Cblk *cblk = prec->cblk + cblkno; int incl, newpasses, llen; if (cblk->npasses) incl = get_bits(s, 1); else incl = tag_tree_decode(s, prec->cblkincl + cblkno, layno + 1) == layno; if (!incl) continue; else if (incl < 0) return incl; if (!cblk->npasses) cblk->nonzerobits = expn[bandno] + numgbits - 1 - tag_tree_decode(s, prec->zerobits + cblkno, 100); if ((newpasses = getnpasses(s)) < 0) return newpasses; if ((llen = getlblockinc(s)) < 0) return llen; cblk->lblock += llen; if ((ret = get_bits(s, av_log2(newpasses) + cblk->lblock)) < 0) return ret; cblk->lengthinc = ret; cblk->npasses += newpasses; } } jpeg2000_flush(s); if (codsty->csty & JPEG2000_CSTY_EPH) { if (bytestream2_peek_be16(&s->g) == JPEG2000_EPH) bytestream2_skip(&s->g, 2); else av_log(s->avctx, AV_LOG_ERROR, "EPH marker not found.\n"); } for (bandno = 0; bandno < rlevel->nbands; bandno++) { Jpeg2000Band *band = rlevel->band + bandno; Jpeg2000Prec *prec = band->prec + precno; nb_code_blocks = prec->nb_codeblocks_height * prec->nb_codeblocks_width; for (cblkno = 0; cblkno < nb_code_blocks; cblkno++) { Jpeg2000Cblk *cblk = prec->cblk + cblkno; if ( bytestream2_get_bytes_left(&s->g) < cblk->lengthinc || sizeof(cblk->data) < cblk->lengthinc ) return AVERROR(EINVAL); /* Code-block data can be empty. In that case initialize data * with 0xFFFF. */ if (cblk->lengthinc > 0) { bytestream2_get_bufferu(&s->g, cblk->data, cblk->lengthinc); } else { cblk->data[0] = 0xFF; cblk->data[1] = 0xFF; } cblk->length += cblk->lengthinc; cblk->lengthinc = 0; } } return 0; }
true
FFmpeg
3b8617429014301b26b587a5e537910746d3377a
static int jpeg2000_decode_packet(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *codsty, Jpeg2000ResLevel *rlevel, int precno, int layno, uint8_t *expn, int numgbits) { int bandno, cblkno, ret, nb_code_blocks; if (!(ret = get_bits(s, 1))) { jpeg2000_flush(s); return 0; } else if (ret < 0) return ret; for (bandno = 0; bandno < rlevel->nbands; bandno++) { Jpeg2000Band *band = rlevel->band + bandno; Jpeg2000Prec *prec = band->prec + precno; if (band->coord[0][0] == band->coord[0][1] || band->coord[1][0] == band->coord[1][1]) continue; nb_code_blocks = prec->nb_codeblocks_height * prec->nb_codeblocks_width; for (cblkno = 0; cblkno < nb_code_blocks; cblkno++) { Jpeg2000Cblk *cblk = prec->cblk + cblkno; int incl, newpasses, llen; if (cblk->npasses) incl = get_bits(s, 1); else incl = tag_tree_decode(s, prec->cblkincl + cblkno, layno + 1) == layno; if (!incl) continue; else if (incl < 0) return incl; if (!cblk->npasses) cblk->nonzerobits = expn[bandno] + numgbits - 1 - tag_tree_decode(s, prec->zerobits + cblkno, 100); if ((newpasses = getnpasses(s)) < 0) return newpasses; if ((llen = getlblockinc(s)) < 0) return llen; cblk->lblock += llen; if ((ret = get_bits(s, av_log2(newpasses) + cblk->lblock)) < 0) return ret; cblk->lengthinc = ret; cblk->npasses += newpasses; } } jpeg2000_flush(s); if (codsty->csty & JPEG2000_CSTY_EPH) { if (bytestream2_peek_be16(&s->g) == JPEG2000_EPH) bytestream2_skip(&s->g, 2); else av_log(s->avctx, AV_LOG_ERROR, "EPH marker not found.\n"); } for (bandno = 0; bandno < rlevel->nbands; bandno++) { Jpeg2000Band *band = rlevel->band + bandno; Jpeg2000Prec *prec = band->prec + precno; nb_code_blocks = prec->nb_codeblocks_height * prec->nb_codeblocks_width; for (cblkno = 0; cblkno < nb_code_blocks; cblkno++) { Jpeg2000Cblk *cblk = prec->cblk + cblkno; if ( bytestream2_get_bytes_left(&s->g) < cblk->lengthinc || sizeof(cblk->data) < cblk->lengthinc ) return AVERROR(EINVAL); if (cblk->lengthinc > 0) { bytestream2_get_bufferu(&s->g, cblk->data, cblk->lengthinc); } else { cblk->data[0] = 0xFF; cblk->data[1] = 0xFF; } cblk->length += cblk->lengthinc; cblk->lengthinc = 0; } } return 0; }
{ "code": [ " if (!cblk->npasses)", " cblk->nonzerobits = expn[bandno] + numgbits - 1 -" ], "line_no": [ 73, 75 ] }
static int FUNC_0(Jpeg2000DecoderContext *VAR_0, Jpeg2000CodingStyle *VAR_1, Jpeg2000ResLevel *VAR_2, int VAR_3, int VAR_4, uint8_t *VAR_5, int VAR_6) { int VAR_7, VAR_8, VAR_9, VAR_10; if (!(VAR_9 = get_bits(VAR_0, 1))) { jpeg2000_flush(VAR_0); return 0; } else if (VAR_9 < 0) return VAR_9; for (VAR_7 = 0; VAR_7 < VAR_2->nbands; VAR_7++) { Jpeg2000Band *band = VAR_2->band + VAR_7; Jpeg2000Prec *prec = band->prec + VAR_3; if (band->coord[0][0] == band->coord[0][1] || band->coord[1][0] == band->coord[1][1]) continue; VAR_10 = prec->nb_codeblocks_height * prec->nb_codeblocks_width; for (VAR_8 = 0; VAR_8 < VAR_10; VAR_8++) { Jpeg2000Cblk *cblk = prec->cblk + VAR_8; int incl, newpasses, llen; if (cblk->npasses) incl = get_bits(VAR_0, 1); else incl = tag_tree_decode(VAR_0, prec->cblkincl + VAR_8, VAR_4 + 1) == VAR_4; if (!incl) continue; else if (incl < 0) return incl; if (!cblk->npasses) cblk->nonzerobits = VAR_5[VAR_7] + VAR_6 - 1 - tag_tree_decode(VAR_0, prec->zerobits + VAR_8, 100); if ((newpasses = getnpasses(VAR_0)) < 0) return newpasses; if ((llen = getlblockinc(VAR_0)) < 0) return llen; cblk->lblock += llen; if ((VAR_9 = get_bits(VAR_0, av_log2(newpasses) + cblk->lblock)) < 0) return VAR_9; cblk->lengthinc = VAR_9; cblk->npasses += newpasses; } } jpeg2000_flush(VAR_0); if (VAR_1->csty & JPEG2000_CSTY_EPH) { if (bytestream2_peek_be16(&VAR_0->g) == JPEG2000_EPH) bytestream2_skip(&VAR_0->g, 2); else av_log(VAR_0->avctx, AV_LOG_ERROR, "EPH marker not found.\n"); } for (VAR_7 = 0; VAR_7 < VAR_2->nbands; VAR_7++) { Jpeg2000Band *band = VAR_2->band + VAR_7; Jpeg2000Prec *prec = band->prec + VAR_3; VAR_10 = prec->nb_codeblocks_height * prec->nb_codeblocks_width; for (VAR_8 = 0; VAR_8 < VAR_10; VAR_8++) { Jpeg2000Cblk *cblk = prec->cblk + VAR_8; if ( bytestream2_get_bytes_left(&VAR_0->g) < cblk->lengthinc || sizeof(cblk->data) < cblk->lengthinc ) return AVERROR(EINVAL); if (cblk->lengthinc > 0) { bytestream2_get_bufferu(&VAR_0->g, cblk->data, cblk->lengthinc); } else { cblk->data[0] = 0xFF; cblk->data[1] = 0xFF; } cblk->length += cblk->lengthinc; cblk->lengthinc = 0; } } return 0; }
[ "static int FUNC_0(Jpeg2000DecoderContext *VAR_0,\nJpeg2000CodingStyle *VAR_1,\nJpeg2000ResLevel *VAR_2, int VAR_3,\nint VAR_4, uint8_t *VAR_5, int VAR_6)\n{", "int VAR_7, VAR_8, VAR_9, VAR_10;", "if (!(VAR_9 = get_bits(VAR_0, 1))) {", "jpeg2000_flush(VAR_0);", "return 0;", "} else if (VAR_9 < 0)", "return VAR_9;", "for (VAR_7 = 0; VAR_7 < VAR_2->nbands; VAR_7++) {", "Jpeg2000Band *band = VAR_2->band + VAR_7;", "Jpeg2000Prec *prec = band->prec + VAR_3;", "if (band->coord[0][0] == band->coord[0][1] ||\nband->coord[1][0] == band->coord[1][1])\ncontinue;", "VAR_10 = prec->nb_codeblocks_height *\nprec->nb_codeblocks_width;", "for (VAR_8 = 0; VAR_8 < VAR_10; VAR_8++) {", "Jpeg2000Cblk *cblk = prec->cblk + VAR_8;", "int incl, newpasses, llen;", "if (cblk->npasses)\nincl = get_bits(VAR_0, 1);", "else\nincl = tag_tree_decode(VAR_0, prec->cblkincl + VAR_8, VAR_4 + 1) == VAR_4;", "if (!incl)\ncontinue;", "else if (incl < 0)\nreturn incl;", "if (!cblk->npasses)\ncblk->nonzerobits = VAR_5[VAR_7] + VAR_6 - 1 -\ntag_tree_decode(VAR_0, prec->zerobits + VAR_8,\n100);", "if ((newpasses = getnpasses(VAR_0)) < 0)\nreturn newpasses;", "if ((llen = getlblockinc(VAR_0)) < 0)\nreturn llen;", "cblk->lblock += llen;", "if ((VAR_9 = get_bits(VAR_0, av_log2(newpasses) + cblk->lblock)) < 0)\nreturn VAR_9;", "cblk->lengthinc = VAR_9;", "cblk->npasses += newpasses;", "}", "}", "jpeg2000_flush(VAR_0);", "if (VAR_1->csty & JPEG2000_CSTY_EPH) {", "if (bytestream2_peek_be16(&VAR_0->g) == JPEG2000_EPH)\nbytestream2_skip(&VAR_0->g, 2);", "else\nav_log(VAR_0->avctx, AV_LOG_ERROR, \"EPH marker not found.\\n\");", "}", "for (VAR_7 = 0; VAR_7 < VAR_2->nbands; VAR_7++) {", "Jpeg2000Band *band = VAR_2->band + VAR_7;", "Jpeg2000Prec *prec = band->prec + VAR_3;", "VAR_10 = prec->nb_codeblocks_height * prec->nb_codeblocks_width;", "for (VAR_8 = 0; VAR_8 < VAR_10; VAR_8++) {", "Jpeg2000Cblk *cblk = prec->cblk + VAR_8;", "if ( bytestream2_get_bytes_left(&VAR_0->g) < cblk->lengthinc\n|| sizeof(cblk->data) < cblk->lengthinc\n)\nreturn AVERROR(EINVAL);", "if (cblk->lengthinc > 0) {", "bytestream2_get_bufferu(&VAR_0->g, cblk->data, cblk->lengthinc);", "} else {", "cblk->data[0] = 0xFF;", "cblk->data[1] = 0xFF;", "}", "cblk->length += cblk->lengthinc;", "cblk->lengthinc = 0;", "}", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 35, 37, 39 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55, 57 ], [ 59, 61 ], [ 63, 65 ], [ 67, 69 ], [ 73, 75, 77, 79 ], [ 81, 83 ], [ 85, 87 ], [ 89 ], [ 91, 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 107 ], [ 109, 111 ], [ 113, 115 ], [ 117 ], [ 121 ], [ 123 ], [ 125 ], [ 129 ], [ 131 ], [ 133 ], [ 135, 137, 139, 141 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ] ]
18,381
void v9fs_device_unrealize_common(V9fsState *s, Error **errp) { g_free(s->tag); g_free(s->ctx.fs_root);
true
qemu
702dbcc274e2ca43be20ba64c758c0ca57dab91d
void v9fs_device_unrealize_common(V9fsState *s, Error **errp) { g_free(s->tag); g_free(s->ctx.fs_root);
{ "code": [], "line_no": [] }
void FUNC_0(V9fsState *VAR_0, Error **VAR_1) { g_free(VAR_0->tag); g_free(VAR_0->ctx.fs_root);
[ "void FUNC_0(V9fsState *VAR_0, Error **VAR_1)\n{", "g_free(VAR_0->tag);", "g_free(VAR_0->ctx.fs_root);" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 8 ], [ 10 ] ]
18,382
void virtio_scsi_common_realize(DeviceState *dev, Error **errp, HandleOutput ctrl, HandleOutput evt, HandleOutput cmd) { VirtIODevice *vdev = VIRTIO_DEVICE(dev); VirtIOSCSICommon *s = VIRTIO_SCSI_COMMON(dev); int i; virtio_init(vdev, "virtio-scsi", VIRTIO_ID_SCSI, sizeof(VirtIOSCSIConfig)); if (s->conf.num_queues <= 0 || s->conf.num_queues > VIRTIO_PCI_QUEUE_MAX) { error_setg(errp, "Invalid number of queues (= %" PRId32 "), " "must be a positive integer less than %d.", s->conf.num_queues, VIRTIO_PCI_QUEUE_MAX); return; } s->cmd_vqs = g_malloc0(s->conf.num_queues * sizeof(VirtQueue *)); s->sense_size = VIRTIO_SCSI_SENSE_SIZE; s->cdb_size = VIRTIO_SCSI_CDB_SIZE; s->ctrl_vq = virtio_add_queue(vdev, VIRTIO_SCSI_VQ_SIZE, ctrl); s->event_vq = virtio_add_queue(vdev, VIRTIO_SCSI_VQ_SIZE, evt); for (i = 0; i < s->conf.num_queues; i++) { s->cmd_vqs[i] = virtio_add_queue(vdev, VIRTIO_SCSI_VQ_SIZE, cmd); } if (s->conf.iothread) { virtio_scsi_set_iothread(VIRTIO_SCSI(s), s->conf.iothread); } }
true
qemu
93bd49aff9081bbe9440192db9da3676941f77a3
void virtio_scsi_common_realize(DeviceState *dev, Error **errp, HandleOutput ctrl, HandleOutput evt, HandleOutput cmd) { VirtIODevice *vdev = VIRTIO_DEVICE(dev); VirtIOSCSICommon *s = VIRTIO_SCSI_COMMON(dev); int i; virtio_init(vdev, "virtio-scsi", VIRTIO_ID_SCSI, sizeof(VirtIOSCSIConfig)); if (s->conf.num_queues <= 0 || s->conf.num_queues > VIRTIO_PCI_QUEUE_MAX) { error_setg(errp, "Invalid number of queues (= %" PRId32 "), " "must be a positive integer less than %d.", s->conf.num_queues, VIRTIO_PCI_QUEUE_MAX); return; } s->cmd_vqs = g_malloc0(s->conf.num_queues * sizeof(VirtQueue *)); s->sense_size = VIRTIO_SCSI_SENSE_SIZE; s->cdb_size = VIRTIO_SCSI_CDB_SIZE; s->ctrl_vq = virtio_add_queue(vdev, VIRTIO_SCSI_VQ_SIZE, ctrl); s->event_vq = virtio_add_queue(vdev, VIRTIO_SCSI_VQ_SIZE, evt); for (i = 0; i < s->conf.num_queues; i++) { s->cmd_vqs[i] = virtio_add_queue(vdev, VIRTIO_SCSI_VQ_SIZE, cmd); } if (s->conf.iothread) { virtio_scsi_set_iothread(VIRTIO_SCSI(s), s->conf.iothread); } }
{ "code": [], "line_no": [] }
void FUNC_0(DeviceState *VAR_0, Error **VAR_1, HandleOutput VAR_2, HandleOutput VAR_3, HandleOutput VAR_4) { VirtIODevice *vdev = VIRTIO_DEVICE(VAR_0); VirtIOSCSICommon *s = VIRTIO_SCSI_COMMON(VAR_0); int VAR_5; virtio_init(vdev, "virtio-scsi", VIRTIO_ID_SCSI, sizeof(VirtIOSCSIConfig)); if (s->conf.num_queues <= 0 || s->conf.num_queues > VIRTIO_PCI_QUEUE_MAX) { error_setg(VAR_1, "Invalid number of queues (= %" PRId32 "), " "must be a positive integer less than %d.", s->conf.num_queues, VIRTIO_PCI_QUEUE_MAX); return; } s->cmd_vqs = g_malloc0(s->conf.num_queues * sizeof(VirtQueue *)); s->sense_size = VIRTIO_SCSI_SENSE_SIZE; s->cdb_size = VIRTIO_SCSI_CDB_SIZE; s->ctrl_vq = virtio_add_queue(vdev, VIRTIO_SCSI_VQ_SIZE, VAR_2); s->event_vq = virtio_add_queue(vdev, VIRTIO_SCSI_VQ_SIZE, VAR_3); for (VAR_5 = 0; VAR_5 < s->conf.num_queues; VAR_5++) { s->cmd_vqs[VAR_5] = virtio_add_queue(vdev, VIRTIO_SCSI_VQ_SIZE, VAR_4); } if (s->conf.iothread) { virtio_scsi_set_iothread(VIRTIO_SCSI(s), s->conf.iothread); } }
[ "void FUNC_0(DeviceState *VAR_0, Error **VAR_1,\nHandleOutput VAR_2, HandleOutput VAR_3,\nHandleOutput VAR_4)\n{", "VirtIODevice *vdev = VIRTIO_DEVICE(VAR_0);", "VirtIOSCSICommon *s = VIRTIO_SCSI_COMMON(VAR_0);", "int VAR_5;", "virtio_init(vdev, \"virtio-scsi\", VIRTIO_ID_SCSI,\nsizeof(VirtIOSCSIConfig));", "if (s->conf.num_queues <= 0 || s->conf.num_queues > VIRTIO_PCI_QUEUE_MAX) {", "error_setg(VAR_1, \"Invalid number of queues (= %\" PRId32 \"), \"\n\"must be a positive integer less than %d.\",\ns->conf.num_queues, VIRTIO_PCI_QUEUE_MAX);", "return;", "}", "s->cmd_vqs = g_malloc0(s->conf.num_queues * sizeof(VirtQueue *));", "s->sense_size = VIRTIO_SCSI_SENSE_SIZE;", "s->cdb_size = VIRTIO_SCSI_CDB_SIZE;", "s->ctrl_vq = virtio_add_queue(vdev, VIRTIO_SCSI_VQ_SIZE,\nVAR_2);", "s->event_vq = virtio_add_queue(vdev, VIRTIO_SCSI_VQ_SIZE,\nVAR_3);", "for (VAR_5 = 0; VAR_5 < s->conf.num_queues; VAR_5++) {", "s->cmd_vqs[VAR_5] = virtio_add_queue(vdev, VIRTIO_SCSI_VQ_SIZE,\nVAR_4);", "}", "if (s->conf.iothread) {", "virtio_scsi_set_iothread(VIRTIO_SCSI(s), s->conf.iothread);", "}", "}" ]
[ 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 ], [ 32 ], [ 34 ], [ 36 ], [ 38 ], [ 40 ], [ 44, 46 ], [ 48, 50 ], [ 52 ], [ 54, 56 ], [ 58 ], [ 62 ], [ 64 ], [ 66 ], [ 68 ] ]
18,383
static int rpza_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { RpzaContext *s = avctx->priv_data; int ret; bytestream2_init(&s->gb, avpkt->data, avpkt->size); if ((ret = ff_reget_buffer(avctx, s->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); return ret; } rpza_decode_stream(s); if ((ret = av_frame_ref(data, s->frame)) < 0) return ret; *got_frame = 1; /* always report that the buffer was completely consumed */ return avpkt->size; }
false
FFmpeg
60f50374f1955442dc987abc4a6c61c2109620c2
static int rpza_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { RpzaContext *s = avctx->priv_data; int ret; bytestream2_init(&s->gb, avpkt->data, avpkt->size); if ((ret = ff_reget_buffer(avctx, s->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); return ret; } rpza_decode_stream(s); if ((ret = av_frame_ref(data, s->frame)) < 0) return ret; *got_frame = 1; return avpkt->size; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3) { RpzaContext *s = VAR_0->priv_data; int VAR_4; bytestream2_init(&s->gb, VAR_3->VAR_1, VAR_3->size); if ((VAR_4 = ff_reget_buffer(VAR_0, s->frame)) < 0) { av_log(VAR_0, AV_LOG_ERROR, "reget_buffer() failed\n"); return VAR_4; } rpza_decode_stream(s); if ((VAR_4 = av_frame_ref(VAR_1, s->frame)) < 0) return VAR_4; *VAR_2 = 1; return VAR_3->size; }
[ "static int FUNC_0(AVCodecContext *VAR_0,\nvoid *VAR_1, int *VAR_2,\nAVPacket *VAR_3)\n{", "RpzaContext *s = VAR_0->priv_data;", "int VAR_4;", "bytestream2_init(&s->gb, VAR_3->VAR_1, VAR_3->size);", "if ((VAR_4 = ff_reget_buffer(VAR_0, s->frame)) < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"reget_buffer() failed\\n\");", "return VAR_4;", "}", "rpza_decode_stream(s);", "if ((VAR_4 = av_frame_ref(VAR_1, s->frame)) < 0)\nreturn VAR_4;", "*VAR_2 = 1;", "return VAR_3->size;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 33, 35 ], [ 39 ], [ 45 ], [ 47 ] ]
18,385
static int decode_cell_data(Cell *cell, uint8_t *block, uint8_t *ref_block, int pitch, int h_zoom, int v_zoom, int mode, const vqEntry *delta[2], int swap_quads[2], const uint8_t **data_ptr, const uint8_t *last_ptr) { int x, y, line, num_lines; int rle_blocks = 0; uint8_t code, *dst, *ref; const vqEntry *delta_tab; unsigned int dyad1, dyad2; uint64_t pix64; int skip_flag = 0, is_top_of_cell, is_first_row = 1; int row_offset, blk_row_offset, line_offset; row_offset = pitch; blk_row_offset = (row_offset << (2 + v_zoom)) - (cell->width << 2); line_offset = v_zoom ? row_offset : 0; for (y = 0; y < cell->height; is_first_row = 0, y += 1 + v_zoom) { for (x = 0; x < cell->width; x += 1 + h_zoom) { ref = ref_block; dst = block; if (rle_blocks > 0) { if (mode <= 4) { RLE_BLOCK_COPY; } else if (mode == 10 && !cell->mv_ptr) { RLE_BLOCK_COPY_8; } rle_blocks--; } else { for (line = 0; line < 4;) { num_lines = 1; is_top_of_cell = is_first_row && !line; /* select primary VQ table for odd, secondary for even lines */ if (mode <= 4) delta_tab = delta[line & 1]; else delta_tab = delta[1]; BUFFER_PRECHECK; code = bytestream_get_byte(data_ptr); if (code < 248) { if (code < delta_tab->num_dyads) { BUFFER_PRECHECK; dyad1 = bytestream_get_byte(data_ptr); dyad2 = code; if (dyad1 >= delta_tab->num_dyads || dyad1 >= 248) } else { /* process QUADS */ code -= delta_tab->num_dyads; dyad1 = code / delta_tab->quad_exp; dyad2 = code % delta_tab->quad_exp; if (swap_quads[line & 1]) FFSWAP(unsigned int, dyad1, dyad2); } if (mode <= 4) { APPLY_DELTA_4; } else if (mode == 10 && !cell->mv_ptr) { APPLY_DELTA_8; } else { APPLY_DELTA_1011_INTER; } } else { /* process RLE codes */ switch (code) { case RLE_ESC_FC: skip_flag = 0; rle_blocks = 1; code = 253; /* FALLTHROUGH */ case RLE_ESC_FF: case RLE_ESC_FE: case RLE_ESC_FD: num_lines = 257 - code - line; if (num_lines <= 0) return IV3_BAD_RLE; if (mode <= 4) { RLE_LINES_COPY; } else if (mode == 10 && !cell->mv_ptr) { RLE_LINES_COPY_M10; } break; case RLE_ESC_FB: BUFFER_PRECHECK; code = bytestream_get_byte(data_ptr); rle_blocks = (code & 0x1F) - 1; /* set block counter */ if (code >= 64 || rle_blocks < 0) return IV3_BAD_COUNTER; skip_flag = code & 0x20; num_lines = 4 - line; /* enforce next block processing */ if (mode >= 10 || (cell->mv_ptr || !skip_flag)) { if (mode <= 4) { RLE_LINES_COPY; } else if (mode == 10 && !cell->mv_ptr) { RLE_LINES_COPY_M10; } } break; case RLE_ESC_F9: skip_flag = 1; rle_blocks = 1; /* FALLTHROUGH */ case RLE_ESC_FA: if (line) return IV3_BAD_RLE; num_lines = 4; /* enforce next block processing */ if (cell->mv_ptr) { if (mode <= 4) { RLE_LINES_COPY; } else if (mode == 10 && !cell->mv_ptr) { RLE_LINES_COPY_M10; } } break; default: return IV3_UNSUPPORTED; } } line += num_lines; ref += row_offset * (num_lines << v_zoom); dst += row_offset * (num_lines << v_zoom); } } /* move to next horizontal block */ block += 4 << h_zoom; ref_block += 4 << h_zoom; } /* move to next line of blocks */ ref_block += blk_row_offset; block += blk_row_offset; } return IV3_NOERR; }
true
FFmpeg
e4d4044339b9c3b0f45f7203cd026eda3c0414c0
static int decode_cell_data(Cell *cell, uint8_t *block, uint8_t *ref_block, int pitch, int h_zoom, int v_zoom, int mode, const vqEntry *delta[2], int swap_quads[2], const uint8_t **data_ptr, const uint8_t *last_ptr) { int x, y, line, num_lines; int rle_blocks = 0; uint8_t code, *dst, *ref; const vqEntry *delta_tab; unsigned int dyad1, dyad2; uint64_t pix64; int skip_flag = 0, is_top_of_cell, is_first_row = 1; int row_offset, blk_row_offset, line_offset; row_offset = pitch; blk_row_offset = (row_offset << (2 + v_zoom)) - (cell->width << 2); line_offset = v_zoom ? row_offset : 0; for (y = 0; y < cell->height; is_first_row = 0, y += 1 + v_zoom) { for (x = 0; x < cell->width; x += 1 + h_zoom) { ref = ref_block; dst = block; if (rle_blocks > 0) { if (mode <= 4) { RLE_BLOCK_COPY; } else if (mode == 10 && !cell->mv_ptr) { RLE_BLOCK_COPY_8; } rle_blocks--; } else { for (line = 0; line < 4;) { num_lines = 1; is_top_of_cell = is_first_row && !line; if (mode <= 4) delta_tab = delta[line & 1]; else delta_tab = delta[1]; BUFFER_PRECHECK; code = bytestream_get_byte(data_ptr); if (code < 248) { if (code < delta_tab->num_dyads) { BUFFER_PRECHECK; dyad1 = bytestream_get_byte(data_ptr); dyad2 = code; if (dyad1 >= delta_tab->num_dyads || dyad1 >= 248) } else { code -= delta_tab->num_dyads; dyad1 = code / delta_tab->quad_exp; dyad2 = code % delta_tab->quad_exp; if (swap_quads[line & 1]) FFSWAP(unsigned int, dyad1, dyad2); } if (mode <= 4) { APPLY_DELTA_4; } else if (mode == 10 && !cell->mv_ptr) { APPLY_DELTA_8; } else { APPLY_DELTA_1011_INTER; } } else { switch (code) { case RLE_ESC_FC: skip_flag = 0; rle_blocks = 1; code = 253; case RLE_ESC_FF: case RLE_ESC_FE: case RLE_ESC_FD: num_lines = 257 - code - line; if (num_lines <= 0) return IV3_BAD_RLE; if (mode <= 4) { RLE_LINES_COPY; } else if (mode == 10 && !cell->mv_ptr) { RLE_LINES_COPY_M10; } break; case RLE_ESC_FB: BUFFER_PRECHECK; code = bytestream_get_byte(data_ptr); rle_blocks = (code & 0x1F) - 1; if (code >= 64 || rle_blocks < 0) return IV3_BAD_COUNTER; skip_flag = code & 0x20; num_lines = 4 - line; if (mode >= 10 || (cell->mv_ptr || !skip_flag)) { if (mode <= 4) { RLE_LINES_COPY; } else if (mode == 10 && !cell->mv_ptr) { RLE_LINES_COPY_M10; } } break; case RLE_ESC_F9: skip_flag = 1; rle_blocks = 1; case RLE_ESC_FA: if (line) return IV3_BAD_RLE; num_lines = 4; if (cell->mv_ptr) { if (mode <= 4) { RLE_LINES_COPY; } else if (mode == 10 && !cell->mv_ptr) { RLE_LINES_COPY_M10; } } break; default: return IV3_UNSUPPORTED; } } line += num_lines; ref += row_offset * (num_lines << v_zoom); dst += row_offset * (num_lines << v_zoom); } } block += 4 << h_zoom; ref_block += 4 << h_zoom; } ref_block += blk_row_offset; block += blk_row_offset; } return IV3_NOERR; }
{ "code": [], "line_no": [] }
static int FUNC_0(Cell *VAR_0, uint8_t *VAR_1, uint8_t *VAR_2, int VAR_3, int VAR_4, int VAR_5, int VAR_6, const vqEntry *VAR_7[2], int VAR_8[2], const uint8_t **VAR_9, const uint8_t *VAR_10) { int VAR_11, VAR_12, VAR_13, VAR_14; int VAR_15 = 0; uint8_t code, *dst, *ref; const vqEntry *VAR_16; unsigned int VAR_17, VAR_18; uint64_t pix64; int VAR_19 = 0, VAR_20, VAR_21 = 1; int VAR_22, VAR_23, VAR_24; VAR_22 = VAR_3; VAR_23 = (VAR_22 << (2 + VAR_5)) - (VAR_0->width << 2); VAR_24 = VAR_5 ? VAR_22 : 0; for (VAR_12 = 0; VAR_12 < VAR_0->height; VAR_21 = 0, VAR_12 += 1 + VAR_5) { for (VAR_11 = 0; VAR_11 < VAR_0->width; VAR_11 += 1 + VAR_4) { ref = VAR_2; dst = VAR_1; if (VAR_15 > 0) { if (VAR_6 <= 4) { RLE_BLOCK_COPY; } else if (VAR_6 == 10 && !VAR_0->mv_ptr) { RLE_BLOCK_COPY_8; } VAR_15--; } else { for (VAR_13 = 0; VAR_13 < 4;) { VAR_14 = 1; VAR_20 = VAR_21 && !VAR_13; if (VAR_6 <= 4) VAR_16 = VAR_7[VAR_13 & 1]; else VAR_16 = VAR_7[1]; BUFFER_PRECHECK; code = bytestream_get_byte(VAR_9); if (code < 248) { if (code < VAR_16->num_dyads) { BUFFER_PRECHECK; VAR_17 = bytestream_get_byte(VAR_9); VAR_18 = code; if (VAR_17 >= VAR_16->num_dyads || VAR_17 >= 248) } else { code -= VAR_16->num_dyads; VAR_17 = code / VAR_16->quad_exp; VAR_18 = code % VAR_16->quad_exp; if (VAR_8[VAR_13 & 1]) FFSWAP(unsigned int, VAR_17, VAR_18); } if (VAR_6 <= 4) { APPLY_DELTA_4; } else if (VAR_6 == 10 && !VAR_0->mv_ptr) { APPLY_DELTA_8; } else { APPLY_DELTA_1011_INTER; } } else { switch (code) { case RLE_ESC_FC: VAR_19 = 0; VAR_15 = 1; code = 253; case RLE_ESC_FF: case RLE_ESC_FE: case RLE_ESC_FD: VAR_14 = 257 - code - VAR_13; if (VAR_14 <= 0) return IV3_BAD_RLE; if (VAR_6 <= 4) { RLE_LINES_COPY; } else if (VAR_6 == 10 && !VAR_0->mv_ptr) { RLE_LINES_COPY_M10; } break; case RLE_ESC_FB: BUFFER_PRECHECK; code = bytestream_get_byte(VAR_9); VAR_15 = (code & 0x1F) - 1; if (code >= 64 || VAR_15 < 0) return IV3_BAD_COUNTER; VAR_19 = code & 0x20; VAR_14 = 4 - VAR_13; if (VAR_6 >= 10 || (VAR_0->mv_ptr || !VAR_19)) { if (VAR_6 <= 4) { RLE_LINES_COPY; } else if (VAR_6 == 10 && !VAR_0->mv_ptr) { RLE_LINES_COPY_M10; } } break; case RLE_ESC_F9: VAR_19 = 1; VAR_15 = 1; case RLE_ESC_FA: if (VAR_13) return IV3_BAD_RLE; VAR_14 = 4; if (VAR_0->mv_ptr) { if (VAR_6 <= 4) { RLE_LINES_COPY; } else if (VAR_6 == 10 && !VAR_0->mv_ptr) { RLE_LINES_COPY_M10; } } break; default: return IV3_UNSUPPORTED; } } VAR_13 += VAR_14; ref += VAR_22 * (VAR_14 << VAR_5); dst += VAR_22 * (VAR_14 << VAR_5); } } VAR_1 += 4 << VAR_4; VAR_2 += 4 << VAR_4; } VAR_2 += VAR_23; VAR_1 += VAR_23; } return IV3_NOERR; }
[ "static int FUNC_0(Cell *VAR_0, uint8_t *VAR_1, uint8_t *VAR_2,\nint VAR_3, int VAR_4, int VAR_5, int VAR_6,\nconst vqEntry *VAR_7[2], int VAR_8[2],\nconst uint8_t **VAR_9, const uint8_t *VAR_10)\n{", "int VAR_11, VAR_12, VAR_13, VAR_14;", "int VAR_15 = 0;", "uint8_t code, *dst, *ref;", "const vqEntry *VAR_16;", "unsigned int VAR_17, VAR_18;", "uint64_t pix64;", "int VAR_19 = 0, VAR_20, VAR_21 = 1;", "int VAR_22, VAR_23, VAR_24;", "VAR_22 = VAR_3;", "VAR_23 = (VAR_22 << (2 + VAR_5)) - (VAR_0->width << 2);", "VAR_24 = VAR_5 ? VAR_22 : 0;", "for (VAR_12 = 0; VAR_12 < VAR_0->height; VAR_21 = 0, VAR_12 += 1 + VAR_5) {", "for (VAR_11 = 0; VAR_11 < VAR_0->width; VAR_11 += 1 + VAR_4) {", "ref = VAR_2;", "dst = VAR_1;", "if (VAR_15 > 0) {", "if (VAR_6 <= 4) {", "RLE_BLOCK_COPY;", "} else if (VAR_6 == 10 && !VAR_0->mv_ptr) {", "RLE_BLOCK_COPY_8;", "}", "VAR_15--;", "} else {", "for (VAR_13 = 0; VAR_13 < 4;) {", "VAR_14 = 1;", "VAR_20 = VAR_21 && !VAR_13;", "if (VAR_6 <= 4)\nVAR_16 = VAR_7[VAR_13 & 1];", "else\nVAR_16 = VAR_7[1];", "BUFFER_PRECHECK;", "code = bytestream_get_byte(VAR_9);", "if (code < 248) {", "if (code < VAR_16->num_dyads) {", "BUFFER_PRECHECK;", "VAR_17 = bytestream_get_byte(VAR_9);", "VAR_18 = code;", "if (VAR_17 >= VAR_16->num_dyads || VAR_17 >= 248)\n} else {", "code -= VAR_16->num_dyads;", "VAR_17 = code / VAR_16->quad_exp;", "VAR_18 = code % VAR_16->quad_exp;", "if (VAR_8[VAR_13 & 1])\nFFSWAP(unsigned int, VAR_17, VAR_18);", "}", "if (VAR_6 <= 4) {", "APPLY_DELTA_4;", "} else if (VAR_6 == 10 && !VAR_0->mv_ptr) {", "APPLY_DELTA_8;", "} else {", "APPLY_DELTA_1011_INTER;", "}", "} else {", "switch (code) {", "case RLE_ESC_FC:\nVAR_19 = 0;", "VAR_15 = 1;", "code = 253;", "case RLE_ESC_FF:\ncase RLE_ESC_FE:\ncase RLE_ESC_FD:\nVAR_14 = 257 - code - VAR_13;", "if (VAR_14 <= 0)\nreturn IV3_BAD_RLE;", "if (VAR_6 <= 4) {", "RLE_LINES_COPY;", "} else if (VAR_6 == 10 && !VAR_0->mv_ptr) {", "RLE_LINES_COPY_M10;", "}", "break;", "case RLE_ESC_FB:\nBUFFER_PRECHECK;", "code = bytestream_get_byte(VAR_9);", "VAR_15 = (code & 0x1F) - 1;", "if (code >= 64 || VAR_15 < 0)\nreturn IV3_BAD_COUNTER;", "VAR_19 = code & 0x20;", "VAR_14 = 4 - VAR_13;", "if (VAR_6 >= 10 || (VAR_0->mv_ptr || !VAR_19)) {", "if (VAR_6 <= 4) {", "RLE_LINES_COPY;", "} else if (VAR_6 == 10 && !VAR_0->mv_ptr) {", "RLE_LINES_COPY_M10;", "}", "}", "break;", "case RLE_ESC_F9:\nVAR_19 = 1;", "VAR_15 = 1;", "case RLE_ESC_FA:\nif (VAR_13)\nreturn IV3_BAD_RLE;", "VAR_14 = 4;", "if (VAR_0->mv_ptr) {", "if (VAR_6 <= 4) {", "RLE_LINES_COPY;", "} else if (VAR_6 == 10 && !VAR_0->mv_ptr) {", "RLE_LINES_COPY_M10;", "}", "}", "break;", "default:\nreturn IV3_UNSUPPORTED;", "}", "}", "VAR_13 += VAR_14;", "ref += VAR_22 * (VAR_14 << VAR_5);", "dst += VAR_22 * (VAR_14 << VAR_5);", "}", "}", "VAR_1 += 4 << VAR_4;", "VAR_2 += 4 << VAR_4;", "}", "VAR_2 += VAR_23;", "VAR_1 += VAR_23;", "}", "return IV3_NOERR;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2, 3, 4, 5 ], [ 6 ], [ 7 ], [ 8 ], [ 9 ], [ 10 ], [ 11 ], [ 12 ], [ 13 ], [ 14 ], [ 15 ], [ 16 ], [ 17 ], [ 18 ], [ 19 ], [ 20 ], [ 21 ], [ 22 ], [ 23 ], [ 24 ], [ 25 ], [ 26 ], [ 27 ], [ 28 ], [ 29 ], [ 30 ], [ 31 ], [ 33, 34 ], [ 35, 36 ], [ 37 ], [ 38 ], [ 39 ], [ 40 ], [ 41 ], [ 42 ], [ 43 ], [ 44, 45 ], [ 47 ], [ 48 ], [ 49 ], [ 50, 51 ], [ 52 ], [ 53 ], [ 54 ], [ 55 ], [ 56 ], [ 57 ], [ 58 ], [ 59 ], [ 60 ], [ 62 ], [ 63, 64 ], [ 65 ], [ 66 ], [ 68, 69, 70, 71 ], [ 72, 73 ], [ 74 ], [ 75 ], [ 76 ], [ 77 ], [ 78 ], [ 79 ], [ 80, 81 ], [ 82 ], [ 83 ], [ 84, 85 ], [ 86 ], [ 87 ], [ 88 ], [ 89 ], [ 90 ], [ 91 ], [ 92 ], [ 93 ], [ 94 ], [ 95 ], [ 96, 97 ], [ 98 ], [ 100, 101, 102 ], [ 103 ], [ 104 ], [ 105 ], [ 106 ], [ 107 ], [ 108 ], [ 109 ], [ 110 ], [ 111 ], [ 112, 113 ], [ 114 ], [ 115 ], [ 116 ], [ 117 ], [ 118 ], [ 119 ], [ 120 ], [ 122 ], [ 123 ], [ 124 ], [ 126 ], [ 127 ], [ 128 ], [ 129 ], [ 130 ] ]
18,386
static void superh_cpu_realizefn(DeviceState *dev, Error **errp) { SuperHCPU *cpu = SUPERH_CPU(dev); SuperHCPUClass *scc = SUPERH_CPU_GET_CLASS(dev); cpu_reset(CPU(cpu)); scc->parent_realize(dev, errp); }
true
qemu
14a10fc39923b3af07c8c46d22cb20843bee3a72
static void superh_cpu_realizefn(DeviceState *dev, Error **errp) { SuperHCPU *cpu = SUPERH_CPU(dev); SuperHCPUClass *scc = SUPERH_CPU_GET_CLASS(dev); cpu_reset(CPU(cpu)); scc->parent_realize(dev, errp); }
{ "code": [ " cpu_reset(CPU(cpu));", " cpu_reset(CPU(cpu));", " cpu_reset(CPU(cpu));", " cpu_reset(CPU(cpu));", " cpu_reset(CPU(cpu));", " cpu_reset(CPU(cpu));", " cpu_reset(CPU(cpu));", " cpu_reset(CPU(cpu));", " cpu_reset(CPU(cpu));", " cpu_reset(CPU(cpu));", " SuperHCPU *cpu = SUPERH_CPU(dev);", " cpu_reset(CPU(cpu));" ], "line_no": [ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 5, 11 ] }
static void FUNC_0(DeviceState *VAR_0, Error **VAR_1) { SuperHCPU *cpu = SUPERH_CPU(VAR_0); SuperHCPUClass *scc = SUPERH_CPU_GET_CLASS(VAR_0); cpu_reset(CPU(cpu)); scc->parent_realize(VAR_0, VAR_1); }
[ "static void FUNC_0(DeviceState *VAR_0, Error **VAR_1)\n{", "SuperHCPU *cpu = SUPERH_CPU(VAR_0);", "SuperHCPUClass *scc = SUPERH_CPU_GET_CLASS(VAR_0);", "cpu_reset(CPU(cpu));", "scc->parent_realize(VAR_0, VAR_1);", "}" ]
[ 0, 1, 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 15 ], [ 17 ] ]
18,387
static void http_log(char *fmt, ...) { va_list ap; va_start(ap, fmt); if (logfile) vfprintf(logfile, fmt, ap); va_end(ap); }
true
FFmpeg
7434ba6d53b9a8858a6f965d9a4e60b5eb1316fe
static void http_log(char *fmt, ...) { va_list ap; va_start(ap, fmt); if (logfile) vfprintf(logfile, fmt, ap); va_end(ap); }
{ "code": [ " if (logfile)" ], "line_no": [ 11 ] }
static void FUNC_0(char *VAR_0, ...) { va_list ap; va_start(ap, VAR_0); if (logfile) vfprintf(logfile, VAR_0, ap); va_end(ap); }
[ "static void FUNC_0(char *VAR_0, ...)\n{", "va_list ap;", "va_start(ap, VAR_0);", "if (logfile)\nvfprintf(logfile, VAR_0, ap);", "va_end(ap);", "}" ]
[ 0, 0, 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11, 13 ], [ 15 ], [ 17 ] ]
18,388
void HELPER(access_check_cp_reg)(CPUARMState *env, void *rip) { const ARMCPRegInfo *ri = rip; switch (ri->accessfn(env, ri)) { case CP_ACCESS_OK: return; case CP_ACCESS_TRAP: case CP_ACCESS_TRAP_UNCATEGORIZED: /* These cases will eventually need to generate different * syndrome information. */ break; default: g_assert_not_reached(); } raise_exception(env, EXCP_UDEF); }
true
qemu
8bcbf37caa87ba89bc391bad70039f942a98c7e3
void HELPER(access_check_cp_reg)(CPUARMState *env, void *rip) { const ARMCPRegInfo *ri = rip; switch (ri->accessfn(env, ri)) { case CP_ACCESS_OK: return; case CP_ACCESS_TRAP: case CP_ACCESS_TRAP_UNCATEGORIZED: break; default: g_assert_not_reached(); } raise_exception(env, EXCP_UDEF); }
{ "code": [ "void HELPER(access_check_cp_reg)(CPUARMState *env, void *rip)" ], "line_no": [ 1 ] }
void FUNC_0(access_check_cp_reg)(CPUARMState *env, void *rip) { const ARMCPRegInfo *VAR_0 = rip; switch (VAR_0->accessfn(env, VAR_0)) { case CP_ACCESS_OK: return; case CP_ACCESS_TRAP: case CP_ACCESS_TRAP_UNCATEGORIZED: break; default: g_assert_not_reached(); } raise_exception(env, EXCP_UDEF); }
[ "void FUNC_0(access_check_cp_reg)(CPUARMState *env, void *rip)\n{", "const ARMCPRegInfo *VAR_0 = rip;", "switch (VAR_0->accessfn(env, VAR_0)) {", "case CP_ACCESS_OK:\nreturn;", "case CP_ACCESS_TRAP:\ncase CP_ACCESS_TRAP_UNCATEGORIZED:\nbreak;", "default:\ng_assert_not_reached();", "}", "raise_exception(env, EXCP_UDEF);", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9, 11 ], [ 13, 15, 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33 ] ]
18,389
static void skip_block (uint8_t *current, uint8_t *previous, int pitch, int x, int y) { uint8_t *src; uint8_t *dst; int i; src = &previous[x + y*pitch]; dst = current; for (i=0; i < 16; i++) { memcpy (dst, src, 16); src += pitch; dst += pitch; } }
false
FFmpeg
82dd7d0dec29ee59af91ce18c29eb151b363ff37
static void skip_block (uint8_t *current, uint8_t *previous, int pitch, int x, int y) { uint8_t *src; uint8_t *dst; int i; src = &previous[x + y*pitch]; dst = current; for (i=0; i < 16; i++) { memcpy (dst, src, 16); src += pitch; dst += pitch; } }
{ "code": [], "line_no": [] }
static void FUNC_0 (uint8_t *VAR_0, uint8_t *VAR_1, int VAR_2, int VAR_3, int VAR_4) { uint8_t *src; uint8_t *dst; int VAR_5; src = &VAR_1[VAR_3 + VAR_4*VAR_2]; dst = VAR_0; for (VAR_5=0; VAR_5 < 16; VAR_5++) { memcpy (dst, src, 16); src += VAR_2; dst += VAR_2; } }
[ "static void FUNC_0 (uint8_t *VAR_0, uint8_t *VAR_1, int VAR_2, int VAR_3, int VAR_4) {", "uint8_t *src;", "uint8_t *dst;", "int\t VAR_5;", "src = &VAR_1[VAR_3 + VAR_4*VAR_2];", "dst = VAR_0;", "for (VAR_5=0; VAR_5 < 16; VAR_5++) {", "memcpy (dst, src, 16);", "src += VAR_2;", "dst += VAR_2;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ] ]
18,391
static int mlp_parse(AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size) { MLPParseContext *mp = s->priv_data; int sync_present; uint8_t parity_bits; int next; int i, p = 0; *poutbuf_size = 0; if (buf_size == 0) return 0; if (!mp->in_sync) { // Not in sync - find a major sync header for (i = 0; i < buf_size; i++) { mp->pc.state = (mp->pc.state << 8) | buf[i]; if ((mp->pc.state & 0xfffffffe) == 0xf8726fba && // ignore if we do not have the data for the start of header mp->pc.index + i >= 7) { mp->in_sync = 1; mp->bytes_left = 0; break; } } if (!mp->in_sync) { ff_combine_frame(&mp->pc, END_NOT_FOUND, &buf, &buf_size); return buf_size; } ff_combine_frame(&mp->pc, i - 7, &buf, &buf_size); return i - 7; } if (mp->bytes_left == 0) { // Find length of this packet /* Copy overread bytes from last frame into buffer. */ for(; mp->pc.overread>0; mp->pc.overread--) { mp->pc.buffer[mp->pc.index++]= mp->pc.buffer[mp->pc.overread_index++]; } if (mp->pc.index + buf_size < 2) { ff_combine_frame(&mp->pc, END_NOT_FOUND, &buf, &buf_size); return buf_size; } mp->bytes_left = ((mp->pc.index > 0 ? mp->pc.buffer[0] : buf[0]) << 8) | (mp->pc.index > 1 ? mp->pc.buffer[1] : buf[1-mp->pc.index]); mp->bytes_left = (mp->bytes_left & 0xfff) * 2; if (mp->bytes_left <= 0) { // prevent infinite loop goto lost_sync; } mp->bytes_left -= mp->pc.index; } next = (mp->bytes_left > buf_size) ? END_NOT_FOUND : mp->bytes_left; if (ff_combine_frame(&mp->pc, next, &buf, &buf_size) < 0) { mp->bytes_left -= buf_size; return buf_size; } mp->bytes_left = 0; sync_present = (AV_RB32(buf + 4) & 0xfffffffe) == 0xf8726fba; if (!sync_present) { /* The first nibble of a frame is a parity check of the 4-byte * access unit header and all the 2- or 4-byte substream headers. */ // Only check when this isn't a sync frame - syncs have a checksum. parity_bits = 0; for (i = -1; i < mp->num_substreams; i++) { parity_bits ^= buf[p++]; parity_bits ^= buf[p++]; if (i < 0 || buf[p-2] & 0x80) { parity_bits ^= buf[p++]; parity_bits ^= buf[p++]; } } if ((((parity_bits >> 4) ^ parity_bits) & 0xF) != 0xF) { av_log(avctx, AV_LOG_INFO, "mlpparse: Parity check failed.\n"); goto lost_sync; } } else { GetBitContext gb; MLPHeaderInfo mh; init_get_bits(&gb, buf + 4, (buf_size - 4) << 3); if (ff_mlp_read_major_sync(avctx, &mh, &gb) < 0) goto lost_sync; avctx->bits_per_raw_sample = mh.group1_bits; if (avctx->bits_per_raw_sample > 16) avctx->sample_fmt = AV_SAMPLE_FMT_S32; else avctx->sample_fmt = AV_SAMPLE_FMT_S16; avctx->sample_rate = mh.group1_samplerate; s->duration = mh.access_unit_size; if (mh.stream_type == 0xbb) { /* MLP stream */ avctx->channels = mlp_channels[mh.channels_mlp]; avctx->channel_layout = ff_mlp_layout[mh.channels_mlp]; } else { /* mh.stream_type == 0xba */ /* TrueHD stream */ if (mh.channels_thd_stream2) { avctx->channels = truehd_channels(mh.channels_thd_stream2); avctx->channel_layout = ff_truehd_layout(mh.channels_thd_stream2); } else { avctx->channels = truehd_channels(mh.channels_thd_stream1); avctx->channel_layout = ff_truehd_layout(mh.channels_thd_stream1); } } } if (!mh.is_vbr) /* Stream is CBR */ avctx->bit_rate = mh.peak_bitrate; mp->num_substreams = mh.num_substreams; } *poutbuf = buf; *poutbuf_size = buf_size; return next; lost_sync: mp->in_sync = 0; return 1; }
true
FFmpeg
2a672652bb70fe6ae1c711f80678f9a513732ee1
static int mlp_parse(AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size) { MLPParseContext *mp = s->priv_data; int sync_present; uint8_t parity_bits; int next; int i, p = 0; *poutbuf_size = 0; if (buf_size == 0) return 0; if (!mp->in_sync) { for (i = 0; i < buf_size; i++) { mp->pc.state = (mp->pc.state << 8) | buf[i]; if ((mp->pc.state & 0xfffffffe) == 0xf8726fba && mp->pc.index + i >= 7) { mp->in_sync = 1; mp->bytes_left = 0; break; } } if (!mp->in_sync) { ff_combine_frame(&mp->pc, END_NOT_FOUND, &buf, &buf_size); return buf_size; } ff_combine_frame(&mp->pc, i - 7, &buf, &buf_size); return i - 7; } if (mp->bytes_left == 0) { for(; mp->pc.overread>0; mp->pc.overread--) { mp->pc.buffer[mp->pc.index++]= mp->pc.buffer[mp->pc.overread_index++]; } if (mp->pc.index + buf_size < 2) { ff_combine_frame(&mp->pc, END_NOT_FOUND, &buf, &buf_size); return buf_size; } mp->bytes_left = ((mp->pc.index > 0 ? mp->pc.buffer[0] : buf[0]) << 8) | (mp->pc.index > 1 ? mp->pc.buffer[1] : buf[1-mp->pc.index]); mp->bytes_left = (mp->bytes_left & 0xfff) * 2; if (mp->bytes_left <= 0) { goto lost_sync; } mp->bytes_left -= mp->pc.index; } next = (mp->bytes_left > buf_size) ? END_NOT_FOUND : mp->bytes_left; if (ff_combine_frame(&mp->pc, next, &buf, &buf_size) < 0) { mp->bytes_left -= buf_size; return buf_size; } mp->bytes_left = 0; sync_present = (AV_RB32(buf + 4) & 0xfffffffe) == 0xf8726fba; if (!sync_present) { parity_bits = 0; for (i = -1; i < mp->num_substreams; i++) { parity_bits ^= buf[p++]; parity_bits ^= buf[p++]; if (i < 0 || buf[p-2] & 0x80) { parity_bits ^= buf[p++]; parity_bits ^= buf[p++]; } } if ((((parity_bits >> 4) ^ parity_bits) & 0xF) != 0xF) { av_log(avctx, AV_LOG_INFO, "mlpparse: Parity check failed.\n"); goto lost_sync; } } else { GetBitContext gb; MLPHeaderInfo mh; init_get_bits(&gb, buf + 4, (buf_size - 4) << 3); if (ff_mlp_read_major_sync(avctx, &mh, &gb) < 0) goto lost_sync; avctx->bits_per_raw_sample = mh.group1_bits; if (avctx->bits_per_raw_sample > 16) avctx->sample_fmt = AV_SAMPLE_FMT_S32; else avctx->sample_fmt = AV_SAMPLE_FMT_S16; avctx->sample_rate = mh.group1_samplerate; s->duration = mh.access_unit_size; if (mh.stream_type == 0xbb) { avctx->channels = mlp_channels[mh.channels_mlp]; avctx->channel_layout = ff_mlp_layout[mh.channels_mlp]; } else { if (mh.channels_thd_stream2) { avctx->channels = truehd_channels(mh.channels_thd_stream2); avctx->channel_layout = ff_truehd_layout(mh.channels_thd_stream2); } else { avctx->channels = truehd_channels(mh.channels_thd_stream1); avctx->channel_layout = ff_truehd_layout(mh.channels_thd_stream1); } } } if (!mh.is_vbr) avctx->bit_rate = mh.peak_bitrate; mp->num_substreams = mh.num_substreams; } *poutbuf = buf; *poutbuf_size = buf_size; return next; lost_sync: mp->in_sync = 0; return 1; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecParserContext *VAR_0, AVCodecContext *VAR_1, const uint8_t **VAR_10, int *VAR_10, const uint8_t *VAR_4, int VAR_5) { MLPParseContext *mp = VAR_0->priv_data; int VAR_6; uint8_t parity_bits; int VAR_7; int VAR_8, VAR_9 = 0; *VAR_10 = 0; if (VAR_5 == 0) return 0; if (!mp->in_sync) { for (VAR_8 = 0; VAR_8 < VAR_5; VAR_8++) { mp->pc.state = (mp->pc.state << 8) | VAR_4[VAR_8]; if ((mp->pc.state & 0xfffffffe) == 0xf8726fba && mp->pc.index + VAR_8 >= 7) { mp->in_sync = 1; mp->bytes_left = 0; break; } } if (!mp->in_sync) { ff_combine_frame(&mp->pc, END_NOT_FOUND, &VAR_4, &VAR_5); return VAR_5; } ff_combine_frame(&mp->pc, VAR_8 - 7, &VAR_4, &VAR_5); return VAR_8 - 7; } if (mp->bytes_left == 0) { for(; mp->pc.overread>0; mp->pc.overread--) { mp->pc.buffer[mp->pc.index++]= mp->pc.buffer[mp->pc.overread_index++]; } if (mp->pc.index + VAR_5 < 2) { ff_combine_frame(&mp->pc, END_NOT_FOUND, &VAR_4, &VAR_5); return VAR_5; } mp->bytes_left = ((mp->pc.index > 0 ? mp->pc.buffer[0] : VAR_4[0]) << 8) | (mp->pc.index > 1 ? mp->pc.buffer[1] : VAR_4[1-mp->pc.index]); mp->bytes_left = (mp->bytes_left & 0xfff) * 2; if (mp->bytes_left <= 0) { goto VAR_10; } mp->bytes_left -= mp->pc.index; } VAR_7 = (mp->bytes_left > VAR_5) ? END_NOT_FOUND : mp->bytes_left; if (ff_combine_frame(&mp->pc, VAR_7, &VAR_4, &VAR_5) < 0) { mp->bytes_left -= VAR_5; return VAR_5; } mp->bytes_left = 0; VAR_6 = (AV_RB32(VAR_4 + 4) & 0xfffffffe) == 0xf8726fba; if (!VAR_6) { parity_bits = 0; for (VAR_8 = -1; VAR_8 < mp->num_substreams; VAR_8++) { parity_bits ^= VAR_4[VAR_9++]; parity_bits ^= VAR_4[VAR_9++]; if (VAR_8 < 0 || VAR_4[VAR_9-2] & 0x80) { parity_bits ^= VAR_4[VAR_9++]; parity_bits ^= VAR_4[VAR_9++]; } } if ((((parity_bits >> 4) ^ parity_bits) & 0xF) != 0xF) { av_log(VAR_1, AV_LOG_INFO, "mlpparse: Parity check failed.\n"); goto VAR_10; } } else { GetBitContext gb; MLPHeaderInfo mh; init_get_bits(&gb, VAR_4 + 4, (VAR_5 - 4) << 3); if (ff_mlp_read_major_sync(VAR_1, &mh, &gb) < 0) goto VAR_10; VAR_1->bits_per_raw_sample = mh.group1_bits; if (VAR_1->bits_per_raw_sample > 16) VAR_1->sample_fmt = AV_SAMPLE_FMT_S32; else VAR_1->sample_fmt = AV_SAMPLE_FMT_S16; VAR_1->sample_rate = mh.group1_samplerate; VAR_0->duration = mh.access_unit_size; if (mh.stream_type == 0xbb) { VAR_1->channels = mlp_channels[mh.channels_mlp]; VAR_1->channel_layout = ff_mlp_layout[mh.channels_mlp]; } else { if (mh.channels_thd_stream2) { VAR_1->channels = truehd_channels(mh.channels_thd_stream2); VAR_1->channel_layout = ff_truehd_layout(mh.channels_thd_stream2); } else { VAR_1->channels = truehd_channels(mh.channels_thd_stream1); VAR_1->channel_layout = ff_truehd_layout(mh.channels_thd_stream1); } } } if (!mh.is_vbr) VAR_1->bit_rate = mh.peak_bitrate; mp->num_substreams = mh.num_substreams; } *VAR_10 = VAR_4; *VAR_10 = VAR_5; return VAR_7; VAR_10: mp->in_sync = 0; return 1; }
[ "static int FUNC_0(AVCodecParserContext *VAR_0,\nAVCodecContext *VAR_1,\nconst uint8_t **VAR_10, int *VAR_10,\nconst uint8_t *VAR_4, int VAR_5)\n{", "MLPParseContext *mp = VAR_0->priv_data;", "int VAR_6;", "uint8_t parity_bits;", "int VAR_7;", "int VAR_8, VAR_9 = 0;", "*VAR_10 = 0;", "if (VAR_5 == 0)\nreturn 0;", "if (!mp->in_sync) {", "for (VAR_8 = 0; VAR_8 < VAR_5; VAR_8++) {", "mp->pc.state = (mp->pc.state << 8) | VAR_4[VAR_8];", "if ((mp->pc.state & 0xfffffffe) == 0xf8726fba &&\nmp->pc.index + VAR_8 >= 7) {", "mp->in_sync = 1;", "mp->bytes_left = 0;", "break;", "}", "}", "if (!mp->in_sync) {", "ff_combine_frame(&mp->pc, END_NOT_FOUND, &VAR_4, &VAR_5);", "return VAR_5;", "}", "ff_combine_frame(&mp->pc, VAR_8 - 7, &VAR_4, &VAR_5);", "return VAR_8 - 7;", "}", "if (mp->bytes_left == 0) {", "for(; mp->pc.overread>0; mp->pc.overread--) {", "mp->pc.buffer[mp->pc.index++]= mp->pc.buffer[mp->pc.overread_index++];", "}", "if (mp->pc.index + VAR_5 < 2) {", "ff_combine_frame(&mp->pc, END_NOT_FOUND, &VAR_4, &VAR_5);", "return VAR_5;", "}", "mp->bytes_left = ((mp->pc.index > 0 ? mp->pc.buffer[0] : VAR_4[0]) << 8)\n| (mp->pc.index > 1 ? mp->pc.buffer[1] : VAR_4[1-mp->pc.index]);", "mp->bytes_left = (mp->bytes_left & 0xfff) * 2;", "if (mp->bytes_left <= 0) {", "goto VAR_10;", "}", "mp->bytes_left -= mp->pc.index;", "}", "VAR_7 = (mp->bytes_left > VAR_5) ? END_NOT_FOUND : mp->bytes_left;", "if (ff_combine_frame(&mp->pc, VAR_7, &VAR_4, &VAR_5) < 0) {", "mp->bytes_left -= VAR_5;", "return VAR_5;", "}", "mp->bytes_left = 0;", "VAR_6 = (AV_RB32(VAR_4 + 4) & 0xfffffffe) == 0xf8726fba;", "if (!VAR_6) {", "parity_bits = 0;", "for (VAR_8 = -1; VAR_8 < mp->num_substreams; VAR_8++) {", "parity_bits ^= VAR_4[VAR_9++];", "parity_bits ^= VAR_4[VAR_9++];", "if (VAR_8 < 0 || VAR_4[VAR_9-2] & 0x80) {", "parity_bits ^= VAR_4[VAR_9++];", "parity_bits ^= VAR_4[VAR_9++];", "}", "}", "if ((((parity_bits >> 4) ^ parity_bits) & 0xF) != 0xF) {", "av_log(VAR_1, AV_LOG_INFO, \"mlpparse: Parity check failed.\\n\");", "goto VAR_10;", "}", "} else {", "GetBitContext gb;", "MLPHeaderInfo mh;", "init_get_bits(&gb, VAR_4 + 4, (VAR_5 - 4) << 3);", "if (ff_mlp_read_major_sync(VAR_1, &mh, &gb) < 0)\ngoto VAR_10;", "VAR_1->bits_per_raw_sample = mh.group1_bits;", "if (VAR_1->bits_per_raw_sample > 16)\nVAR_1->sample_fmt = AV_SAMPLE_FMT_S32;", "else\nVAR_1->sample_fmt = AV_SAMPLE_FMT_S16;", "VAR_1->sample_rate = mh.group1_samplerate;", "VAR_0->duration = mh.access_unit_size;", "if (mh.stream_type == 0xbb) {", "VAR_1->channels = mlp_channels[mh.channels_mlp];", "VAR_1->channel_layout = ff_mlp_layout[mh.channels_mlp];", "} else {", "if (mh.channels_thd_stream2) {", "VAR_1->channels = truehd_channels(mh.channels_thd_stream2);", "VAR_1->channel_layout = ff_truehd_layout(mh.channels_thd_stream2);", "} else {", "VAR_1->channels = truehd_channels(mh.channels_thd_stream1);", "VAR_1->channel_layout = ff_truehd_layout(mh.channels_thd_stream1);", "}", "}", "}", "if (!mh.is_vbr)\nVAR_1->bit_rate = mh.peak_bitrate;", "mp->num_substreams = mh.num_substreams;", "}", "*VAR_10 = VAR_4;", "*VAR_10 = VAR_5;", "return VAR_7;", "VAR_10:\nmp->in_sync = 0;", "return 1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25, 27 ], [ 31 ], [ 37 ], [ 39 ], [ 41, 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 73 ], [ 75 ], [ 79 ], [ 87 ], [ 89 ], [ 91 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 105, 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 123 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 137 ], [ 141 ], [ 145 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 193 ], [ 195, 197 ], [ 201 ], [ 203, 205 ], [ 207, 209 ], [ 211 ], [ 213 ], [ 218 ], [ 222 ], [ 224 ], [ 226 ], [ 230 ], [ 232 ], [ 234 ], [ 236 ], [ 238 ], [ 240 ], [ 242 ], [ 244 ], [ 246 ], [ 250, 252 ], [ 256 ], [ 258 ], [ 262 ], [ 264 ], [ 268 ], [ 272, 274 ], [ 276 ], [ 278 ] ]
18,392
void ppc_translate_init(void) { int i; char* p; size_t cpu_reg_names_size; static int done_init = 0; if (done_init) return; cpu_env = tcg_global_reg_new_ptr(TCG_AREG0, "env"); p = cpu_reg_names; cpu_reg_names_size = sizeof(cpu_reg_names); for (i = 0; i < 8; i++) { snprintf(p, cpu_reg_names_size, "crf%d", i); cpu_crf[i] = tcg_global_mem_new_i32(TCG_AREG0, offsetof(CPUState, crf[i]), p); p += 5; cpu_reg_names_size -= 5; } for (i = 0; i < 32; i++) { snprintf(p, cpu_reg_names_size, "r%d", i); cpu_gpr[i] = tcg_global_mem_new(TCG_AREG0, offsetof(CPUState, gpr[i]), p); p += (i < 10) ? 3 : 4; cpu_reg_names_size -= (i < 10) ? 3 : 4; #if !defined(TARGET_PPC64) snprintf(p, cpu_reg_names_size, "r%dH", i); cpu_gprh[i] = tcg_global_mem_new_i32(TCG_AREG0, offsetof(CPUState, gprh[i]), p); p += (i < 10) ? 4 : 5; cpu_reg_names_size -= (i < 10) ? 4 : 5; snprintf(p, cpu_reg_names_size, "fp%d", i); cpu_fpr[i] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUState, fpr[i]), p); p += (i < 10) ? 4 : 5; cpu_reg_names_size -= (i < 10) ? 4 : 5; snprintf(p, cpu_reg_names_size, "avr%dH", i); #ifdef HOST_WORDS_BIGENDIAN cpu_avrh[i] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUState, avr[i].u64[0]), p); #else cpu_avrh[i] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUState, avr[i].u64[1]), p); p += (i < 10) ? 6 : 7; cpu_reg_names_size -= (i < 10) ? 6 : 7; snprintf(p, cpu_reg_names_size, "avr%dL", i); #ifdef HOST_WORDS_BIGENDIAN cpu_avrl[i] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUState, avr[i].u64[1]), p); #else cpu_avrl[i] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUState, avr[i].u64[0]), p); p += (i < 10) ? 6 : 7; cpu_reg_names_size -= (i < 10) ? 6 : 7; } cpu_nip = tcg_global_mem_new(TCG_AREG0, offsetof(CPUState, nip), "nip"); cpu_msr = tcg_global_mem_new(TCG_AREG0, offsetof(CPUState, msr), "msr"); cpu_ctr = tcg_global_mem_new(TCG_AREG0, offsetof(CPUState, ctr), "ctr"); cpu_lr = tcg_global_mem_new(TCG_AREG0, offsetof(CPUState, lr), "lr"); cpu_xer = tcg_global_mem_new(TCG_AREG0, offsetof(CPUState, xer), "xer"); cpu_reserve = tcg_global_mem_new(TCG_AREG0, offsetof(CPUState, reserve_addr), "reserve_addr"); cpu_fpscr = tcg_global_mem_new_i32(TCG_AREG0, offsetof(CPUState, fpscr), "fpscr"); cpu_access_type = tcg_global_mem_new_i32(TCG_AREG0, offsetof(CPUState, access_type), "access_type"); /* register helpers */ #define GEN_HELPER 2 #include "helper.h" done_init = 1; }
true
qemu
697ab892786d47008807a49f57b2fd86adfcd098
void ppc_translate_init(void) { int i; char* p; size_t cpu_reg_names_size; static int done_init = 0; if (done_init) return; cpu_env = tcg_global_reg_new_ptr(TCG_AREG0, "env"); p = cpu_reg_names; cpu_reg_names_size = sizeof(cpu_reg_names); for (i = 0; i < 8; i++) { snprintf(p, cpu_reg_names_size, "crf%d", i); cpu_crf[i] = tcg_global_mem_new_i32(TCG_AREG0, offsetof(CPUState, crf[i]), p); p += 5; cpu_reg_names_size -= 5; } for (i = 0; i < 32; i++) { snprintf(p, cpu_reg_names_size, "r%d", i); cpu_gpr[i] = tcg_global_mem_new(TCG_AREG0, offsetof(CPUState, gpr[i]), p); p += (i < 10) ? 3 : 4; cpu_reg_names_size -= (i < 10) ? 3 : 4; #if !defined(TARGET_PPC64) snprintf(p, cpu_reg_names_size, "r%dH", i); cpu_gprh[i] = tcg_global_mem_new_i32(TCG_AREG0, offsetof(CPUState, gprh[i]), p); p += (i < 10) ? 4 : 5; cpu_reg_names_size -= (i < 10) ? 4 : 5; snprintf(p, cpu_reg_names_size, "fp%d", i); cpu_fpr[i] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUState, fpr[i]), p); p += (i < 10) ? 4 : 5; cpu_reg_names_size -= (i < 10) ? 4 : 5; snprintf(p, cpu_reg_names_size, "avr%dH", i); #ifdef HOST_WORDS_BIGENDIAN cpu_avrh[i] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUState, avr[i].u64[0]), p); #else cpu_avrh[i] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUState, avr[i].u64[1]), p); p += (i < 10) ? 6 : 7; cpu_reg_names_size -= (i < 10) ? 6 : 7; snprintf(p, cpu_reg_names_size, "avr%dL", i); #ifdef HOST_WORDS_BIGENDIAN cpu_avrl[i] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUState, avr[i].u64[1]), p); #else cpu_avrl[i] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUState, avr[i].u64[0]), p); p += (i < 10) ? 6 : 7; cpu_reg_names_size -= (i < 10) ? 6 : 7; } cpu_nip = tcg_global_mem_new(TCG_AREG0, offsetof(CPUState, nip), "nip"); cpu_msr = tcg_global_mem_new(TCG_AREG0, offsetof(CPUState, msr), "msr"); cpu_ctr = tcg_global_mem_new(TCG_AREG0, offsetof(CPUState, ctr), "ctr"); cpu_lr = tcg_global_mem_new(TCG_AREG0, offsetof(CPUState, lr), "lr"); cpu_xer = tcg_global_mem_new(TCG_AREG0, offsetof(CPUState, xer), "xer"); cpu_reserve = tcg_global_mem_new(TCG_AREG0, offsetof(CPUState, reserve_addr), "reserve_addr"); cpu_fpscr = tcg_global_mem_new_i32(TCG_AREG0, offsetof(CPUState, fpscr), "fpscr"); cpu_access_type = tcg_global_mem_new_i32(TCG_AREG0, offsetof(CPUState, access_type), "access_type"); #define GEN_HELPER 2 #include "helper.h" done_init = 1; }
{ "code": [], "line_no": [] }
void FUNC_0(void) { int VAR_0; char* VAR_1; size_t cpu_reg_names_size; static int VAR_2 = 0; if (VAR_2) return; cpu_env = tcg_global_reg_new_ptr(TCG_AREG0, "env"); VAR_1 = cpu_reg_names; cpu_reg_names_size = sizeof(cpu_reg_names); for (VAR_0 = 0; VAR_0 < 8; VAR_0++) { snprintf(VAR_1, cpu_reg_names_size, "crf%d", VAR_0); cpu_crf[VAR_0] = tcg_global_mem_new_i32(TCG_AREG0, offsetof(CPUState, crf[VAR_0]), VAR_1); VAR_1 += 5; cpu_reg_names_size -= 5; } for (VAR_0 = 0; VAR_0 < 32; VAR_0++) { snprintf(VAR_1, cpu_reg_names_size, "r%d", VAR_0); cpu_gpr[VAR_0] = tcg_global_mem_new(TCG_AREG0, offsetof(CPUState, gpr[VAR_0]), VAR_1); VAR_1 += (VAR_0 < 10) ? 3 : 4; cpu_reg_names_size -= (VAR_0 < 10) ? 3 : 4; #if !defined(TARGET_PPC64) snprintf(VAR_1, cpu_reg_names_size, "r%dH", VAR_0); cpu_gprh[VAR_0] = tcg_global_mem_new_i32(TCG_AREG0, offsetof(CPUState, gprh[VAR_0]), VAR_1); VAR_1 += (VAR_0 < 10) ? 4 : 5; cpu_reg_names_size -= (VAR_0 < 10) ? 4 : 5; snprintf(VAR_1, cpu_reg_names_size, "fp%d", VAR_0); cpu_fpr[VAR_0] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUState, fpr[VAR_0]), VAR_1); VAR_1 += (VAR_0 < 10) ? 4 : 5; cpu_reg_names_size -= (VAR_0 < 10) ? 4 : 5; snprintf(VAR_1, cpu_reg_names_size, "avr%dH", VAR_0); #ifdef HOST_WORDS_BIGENDIAN cpu_avrh[VAR_0] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUState, avr[VAR_0].u64[0]), VAR_1); #else cpu_avrh[VAR_0] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUState, avr[VAR_0].u64[1]), VAR_1); VAR_1 += (VAR_0 < 10) ? 6 : 7; cpu_reg_names_size -= (VAR_0 < 10) ? 6 : 7; snprintf(VAR_1, cpu_reg_names_size, "avr%dL", VAR_0); #ifdef HOST_WORDS_BIGENDIAN cpu_avrl[VAR_0] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUState, avr[VAR_0].u64[1]), VAR_1); #else cpu_avrl[VAR_0] = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUState, avr[VAR_0].u64[0]), VAR_1); VAR_1 += (VAR_0 < 10) ? 6 : 7; cpu_reg_names_size -= (VAR_0 < 10) ? 6 : 7; } cpu_nip = tcg_global_mem_new(TCG_AREG0, offsetof(CPUState, nip), "nip"); cpu_msr = tcg_global_mem_new(TCG_AREG0, offsetof(CPUState, msr), "msr"); cpu_ctr = tcg_global_mem_new(TCG_AREG0, offsetof(CPUState, ctr), "ctr"); cpu_lr = tcg_global_mem_new(TCG_AREG0, offsetof(CPUState, lr), "lr"); cpu_xer = tcg_global_mem_new(TCG_AREG0, offsetof(CPUState, xer), "xer"); cpu_reserve = tcg_global_mem_new(TCG_AREG0, offsetof(CPUState, reserve_addr), "reserve_addr"); cpu_fpscr = tcg_global_mem_new_i32(TCG_AREG0, offsetof(CPUState, fpscr), "fpscr"); cpu_access_type = tcg_global_mem_new_i32(TCG_AREG0, offsetof(CPUState, access_type), "access_type"); #define GEN_HELPER 2 #include "helper.h" VAR_2 = 1; }
[ "void FUNC_0(void)\n{", "int VAR_0;", "char* VAR_1;", "size_t cpu_reg_names_size;", "static int VAR_2 = 0;", "if (VAR_2)\nreturn;", "cpu_env = tcg_global_reg_new_ptr(TCG_AREG0, \"env\");", "VAR_1 = cpu_reg_names;", "cpu_reg_names_size = sizeof(cpu_reg_names);", "for (VAR_0 = 0; VAR_0 < 8; VAR_0++) {", "snprintf(VAR_1, cpu_reg_names_size, \"crf%d\", VAR_0);", "cpu_crf[VAR_0] = tcg_global_mem_new_i32(TCG_AREG0,\noffsetof(CPUState, crf[VAR_0]), VAR_1);", "VAR_1 += 5;", "cpu_reg_names_size -= 5;", "}", "for (VAR_0 = 0; VAR_0 < 32; VAR_0++) {", "snprintf(VAR_1, cpu_reg_names_size, \"r%d\", VAR_0);", "cpu_gpr[VAR_0] = tcg_global_mem_new(TCG_AREG0,\noffsetof(CPUState, gpr[VAR_0]), VAR_1);", "VAR_1 += (VAR_0 < 10) ? 3 : 4;", "cpu_reg_names_size -= (VAR_0 < 10) ? 3 : 4;", "#if !defined(TARGET_PPC64)\nsnprintf(VAR_1, cpu_reg_names_size, \"r%dH\", VAR_0);", "cpu_gprh[VAR_0] = tcg_global_mem_new_i32(TCG_AREG0,\noffsetof(CPUState, gprh[VAR_0]), VAR_1);", "VAR_1 += (VAR_0 < 10) ? 4 : 5;", "cpu_reg_names_size -= (VAR_0 < 10) ? 4 : 5;", "snprintf(VAR_1, cpu_reg_names_size, \"fp%d\", VAR_0);", "cpu_fpr[VAR_0] = tcg_global_mem_new_i64(TCG_AREG0,\noffsetof(CPUState, fpr[VAR_0]), VAR_1);", "VAR_1 += (VAR_0 < 10) ? 4 : 5;", "cpu_reg_names_size -= (VAR_0 < 10) ? 4 : 5;", "snprintf(VAR_1, cpu_reg_names_size, \"avr%dH\", VAR_0);", "#ifdef HOST_WORDS_BIGENDIAN\ncpu_avrh[VAR_0] = tcg_global_mem_new_i64(TCG_AREG0,\noffsetof(CPUState, avr[VAR_0].u64[0]), VAR_1);", "#else\ncpu_avrh[VAR_0] = tcg_global_mem_new_i64(TCG_AREG0,\noffsetof(CPUState, avr[VAR_0].u64[1]), VAR_1);", "VAR_1 += (VAR_0 < 10) ? 6 : 7;", "cpu_reg_names_size -= (VAR_0 < 10) ? 6 : 7;", "snprintf(VAR_1, cpu_reg_names_size, \"avr%dL\", VAR_0);", "#ifdef HOST_WORDS_BIGENDIAN\ncpu_avrl[VAR_0] = tcg_global_mem_new_i64(TCG_AREG0,\noffsetof(CPUState, avr[VAR_0].u64[1]), VAR_1);", "#else\ncpu_avrl[VAR_0] = tcg_global_mem_new_i64(TCG_AREG0,\noffsetof(CPUState, avr[VAR_0].u64[0]), VAR_1);", "VAR_1 += (VAR_0 < 10) ? 6 : 7;", "cpu_reg_names_size -= (VAR_0 < 10) ? 6 : 7;", "}", "cpu_nip = tcg_global_mem_new(TCG_AREG0,\noffsetof(CPUState, nip), \"nip\");", "cpu_msr = tcg_global_mem_new(TCG_AREG0,\noffsetof(CPUState, msr), \"msr\");", "cpu_ctr = tcg_global_mem_new(TCG_AREG0,\noffsetof(CPUState, ctr), \"ctr\");", "cpu_lr = tcg_global_mem_new(TCG_AREG0,\noffsetof(CPUState, lr), \"lr\");", "cpu_xer = tcg_global_mem_new(TCG_AREG0,\noffsetof(CPUState, xer), \"xer\");", "cpu_reserve = tcg_global_mem_new(TCG_AREG0,\noffsetof(CPUState, reserve_addr),\n\"reserve_addr\");", "cpu_fpscr = tcg_global_mem_new_i32(TCG_AREG0,\noffsetof(CPUState, fpscr), \"fpscr\");", "cpu_access_type = tcg_global_mem_new_i32(TCG_AREG0,\noffsetof(CPUState, access_type), \"access_type\");", "#define GEN_HELPER 2\n#include \"helper.h\"\nVAR_2 = 1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2 ], [ 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7, 8 ], [ 9 ], [ 10 ], [ 11 ], [ 12 ], [ 13 ], [ 14, 15 ], [ 16 ], [ 17 ], [ 18 ], [ 19 ], [ 20 ], [ 21, 22 ], [ 23 ], [ 24 ], [ 25, 26 ], [ 27, 28 ], [ 29 ], [ 30 ], [ 31 ], [ 32, 33 ], [ 34 ], [ 35 ], [ 36 ], [ 37, 38, 39 ], [ 40, 41, 42 ], [ 43 ], [ 44 ], [ 45 ], [ 46, 47, 48 ], [ 49, 50, 51 ], [ 52 ], [ 53 ], [ 54 ], [ 55, 56 ], [ 57, 58 ], [ 59, 60 ], [ 61, 62 ], [ 63, 64 ], [ 65, 66, 67 ], [ 68, 69 ], [ 70, 71 ], [ 73, 74, 75 ], [ 76 ] ]
18,393
void qusb_pci_init_one(QPCIBus *pcibus, struct qhc *hc, uint32_t devfn, int bar) { hc->dev = qpci_device_find(pcibus, devfn); g_assert(hc->dev != NULL); qpci_device_enable(hc->dev); hc->base = qpci_iomap(hc->dev, bar, NULL); g_assert(hc->base != NULL); }
true
qemu
b4ba67d9a702507793c2724e56f98e9b0f7be02b
void qusb_pci_init_one(QPCIBus *pcibus, struct qhc *hc, uint32_t devfn, int bar) { hc->dev = qpci_device_find(pcibus, devfn); g_assert(hc->dev != NULL); qpci_device_enable(hc->dev); hc->base = qpci_iomap(hc->dev, bar, NULL); g_assert(hc->base != NULL); }
{ "code": [ " hc->base = qpci_iomap(hc->dev, bar, NULL);", " g_assert(hc->base != NULL);" ], "line_no": [ 11, 13 ] }
void FUNC_0(QPCIBus *VAR_0, struct qhc *VAR_1, uint32_t VAR_2, int VAR_3) { VAR_1->dev = qpci_device_find(VAR_0, VAR_2); g_assert(VAR_1->dev != NULL); qpci_device_enable(VAR_1->dev); VAR_1->base = qpci_iomap(VAR_1->dev, VAR_3, NULL); g_assert(VAR_1->base != NULL); }
[ "void FUNC_0(QPCIBus *VAR_0, struct qhc *VAR_1, uint32_t VAR_2, int VAR_3)\n{", "VAR_1->dev = qpci_device_find(VAR_0, VAR_2);", "g_assert(VAR_1->dev != NULL);", "qpci_device_enable(VAR_1->dev);", "VAR_1->base = qpci_iomap(VAR_1->dev, VAR_3, NULL);", "g_assert(VAR_1->base != NULL);", "}" ]
[ 0, 0, 0, 0, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ] ]
18,394
static int mov_write_hdlr_tag(AVIOContext *pb, MOVTrack *track) { const char *hdlr, *descr = NULL, *hdlr_type = NULL; int64_t pos = avio_tell(pb); if (!track) { /* no media --> data handler */ hdlr = (track->mode == MODE_MOV) ? "mhlr" : "\0\0\0\0"; if (track->enc->codec_type == AVMEDIA_TYPE_VIDEO) { hdlr_type = "vide"; descr = "VideoHandler"; } else if (track->enc->codec_type == AVMEDIA_TYPE_AUDIO) { hdlr_type = "soun"; descr = "SoundHandler"; } else if (track->enc->codec_type == AVMEDIA_TYPE_SUBTITLE) { if (track->tag == MKTAG('t','x','3','g')) hdlr_type = "sbtl"; else hdlr_type = "text"; descr = "SubtitleHandler"; } else if (track->enc->codec_tag == MKTAG('r','t','p',' ')) { hdlr_type = "hint"; descr = "HintHandler"; } } avio_wb32(pb, 0); /* size */ ffio_wfourcc(pb, "hdlr"); avio_wb32(pb, 0); /* Version & flags */ avio_write(pb, hdlr, 4); /* handler */ ffio_wfourcc(pb, hdlr_type); /* handler type */ avio_wb32(pb ,0); /* reserved */ avio_wb32(pb ,0); /* reserved */ avio_wb32(pb ,0); /* reserved */ if (!track || track->mode == MODE_MOV) avio_w8(pb, strlen(descr)); /* pascal string */ avio_write(pb, descr, strlen(descr)); /* handler description */ if (track && track->mode != MODE_MOV) avio_w8(pb, 0); /* c string */ return update_size(pb, pos); }
true
FFmpeg
40393ac568db345b0388e1c99fc89f41a5b08037
static int mov_write_hdlr_tag(AVIOContext *pb, MOVTrack *track) { const char *hdlr, *descr = NULL, *hdlr_type = NULL; int64_t pos = avio_tell(pb); if (!track) { hdlr = (track->mode == MODE_MOV) ? "mhlr" : "\0\0\0\0"; if (track->enc->codec_type == AVMEDIA_TYPE_VIDEO) { hdlr_type = "vide"; descr = "VideoHandler"; } else if (track->enc->codec_type == AVMEDIA_TYPE_AUDIO) { hdlr_type = "soun"; descr = "SoundHandler"; } else if (track->enc->codec_type == AVMEDIA_TYPE_SUBTITLE) { if (track->tag == MKTAG('t','x','3','g')) hdlr_type = "sbtl"; else hdlr_type = "text"; descr = "SubtitleHandler"; } else if (track->enc->codec_tag == MKTAG('r','t','p',' ')) { hdlr_type = "hint"; descr = "HintHandler"; } } avio_wb32(pb, 0); ffio_wfourcc(pb, "hdlr"); avio_wb32(pb, 0); avio_write(pb, hdlr, 4); ffio_wfourcc(pb, hdlr_type); avio_wb32(pb ,0); avio_wb32(pb ,0); avio_wb32(pb ,0); if (!track || track->mode == MODE_MOV) avio_w8(pb, strlen(descr)); avio_write(pb, descr, strlen(descr)); if (track && track->mode != MODE_MOV) avio_w8(pb, 0); return update_size(pb, pos); }
{ "code": [], "line_no": [] }
static int FUNC_0(AVIOContext *VAR_0, MOVTrack *VAR_1) { const char *VAR_2, *VAR_3 = NULL, *VAR_4 = NULL; int64_t pos = avio_tell(VAR_0); if (!VAR_1) { VAR_2 = (VAR_1->mode == MODE_MOV) ? "mhlr" : "\0\0\0\0"; if (VAR_1->enc->codec_type == AVMEDIA_TYPE_VIDEO) { VAR_4 = "vide"; VAR_3 = "VideoHandler"; } else if (VAR_1->enc->codec_type == AVMEDIA_TYPE_AUDIO) { VAR_4 = "soun"; VAR_3 = "SoundHandler"; } else if (VAR_1->enc->codec_type == AVMEDIA_TYPE_SUBTITLE) { if (VAR_1->tag == MKTAG('t','x','3','g')) VAR_4 = "sbtl"; else VAR_4 = "text"; VAR_3 = "SubtitleHandler"; } else if (VAR_1->enc->codec_tag == MKTAG('r','t','p',' ')) { VAR_4 = "hint"; VAR_3 = "HintHandler"; } } avio_wb32(VAR_0, 0); ffio_wfourcc(VAR_0, "VAR_2"); avio_wb32(VAR_0, 0); avio_write(VAR_0, VAR_2, 4); ffio_wfourcc(VAR_0, VAR_4); avio_wb32(VAR_0 ,0); avio_wb32(VAR_0 ,0); avio_wb32(VAR_0 ,0); if (!VAR_1 || VAR_1->mode == MODE_MOV) avio_w8(VAR_0, strlen(VAR_3)); avio_write(VAR_0, VAR_3, strlen(VAR_3)); if (VAR_1 && VAR_1->mode != MODE_MOV) avio_w8(VAR_0, 0); return update_size(VAR_0, pos); }
[ "static int FUNC_0(AVIOContext *VAR_0, MOVTrack *VAR_1)\n{", "const char *VAR_2, *VAR_3 = NULL, *VAR_4 = NULL;", "int64_t pos = avio_tell(VAR_0);", "if (!VAR_1) {", "VAR_2 = (VAR_1->mode == MODE_MOV) ? \"mhlr\" : \"\\0\\0\\0\\0\";", "if (VAR_1->enc->codec_type == AVMEDIA_TYPE_VIDEO) {", "VAR_4 = \"vide\";", "VAR_3 = \"VideoHandler\";", "} else if (VAR_1->enc->codec_type == AVMEDIA_TYPE_AUDIO) {", "VAR_4 = \"soun\";", "VAR_3 = \"SoundHandler\";", "} else if (VAR_1->enc->codec_type == AVMEDIA_TYPE_SUBTITLE) {", "if (VAR_1->tag == MKTAG('t','x','3','g')) VAR_4 = \"sbtl\";", "else VAR_4 = \"text\";", "VAR_3 = \"SubtitleHandler\";", "} else if (VAR_1->enc->codec_tag == MKTAG('r','t','p',' ')) {", "VAR_4 = \"hint\";", "VAR_3 = \"HintHandler\";", "}", "}", "avio_wb32(VAR_0, 0);", "ffio_wfourcc(VAR_0, \"VAR_2\");", "avio_wb32(VAR_0, 0);", "avio_write(VAR_0, VAR_2, 4);", "ffio_wfourcc(VAR_0, VAR_4);", "avio_wb32(VAR_0 ,0);", "avio_wb32(VAR_0 ,0);", "avio_wb32(VAR_0 ,0);", "if (!VAR_1 || VAR_1->mode == MODE_MOV)\navio_w8(VAR_0, strlen(VAR_3));", "avio_write(VAR_0, VAR_3, strlen(VAR_3));", "if (VAR_1 && VAR_1->mode != MODE_MOV)\navio_w8(VAR_0, 0);", "return update_size(VAR_0, pos);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71, 73 ], [ 75 ], [ 77, 79 ], [ 81 ], [ 83 ] ]
18,395
static coroutine_fn void nbd_co_client_start(void *opaque) { NBDClientNewData *data = opaque; NBDClient *client = data->client; NBDExport *exp = client->exp; if (exp) { nbd_export_get(exp); QTAILQ_INSERT_TAIL(&exp->clients, client, next); } qemu_co_mutex_init(&client->send_lock); if (nbd_negotiate(data)) { client_close(client); goto out; } nbd_client_receive_next_request(client); out: g_free(data); }
true
qemu
0c9390d978cbf61e8f16c9f580fa96b305c43568
static coroutine_fn void nbd_co_client_start(void *opaque) { NBDClientNewData *data = opaque; NBDClient *client = data->client; NBDExport *exp = client->exp; if (exp) { nbd_export_get(exp); QTAILQ_INSERT_TAIL(&exp->clients, client, next); } qemu_co_mutex_init(&client->send_lock); if (nbd_negotiate(data)) { client_close(client); goto out; } nbd_client_receive_next_request(client); out: g_free(data); }
{ "code": [ " client_close(client);", " client_close(client);" ], "line_no": [ 27, 27 ] }
static coroutine_fn void FUNC_0(void *opaque) { NBDClientNewData *data = opaque; NBDClient *client = data->client; NBDExport *exp = client->exp; if (exp) { nbd_export_get(exp); QTAILQ_INSERT_TAIL(&exp->clients, client, next); } qemu_co_mutex_init(&client->send_lock); if (nbd_negotiate(data)) { client_close(client); goto out; } nbd_client_receive_next_request(client); out: g_free(data); }
[ "static coroutine_fn void FUNC_0(void *opaque)\n{", "NBDClientNewData *data = opaque;", "NBDClient *client = data->client;", "NBDExport *exp = client->exp;", "if (exp) {", "nbd_export_get(exp);", "QTAILQ_INSERT_TAIL(&exp->clients, client, next);", "}", "qemu_co_mutex_init(&client->send_lock);", "if (nbd_negotiate(data)) {", "client_close(client);", "goto out;", "}", "nbd_client_receive_next_request(client);", "out:\ng_free(data);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 39, 41 ], [ 43 ] ]
18,396
static inline int vfp_exceptbits_from_host(int host_bits) { int target_bits = 0; if (host_bits & float_flag_invalid) target_bits |= 1; if (host_bits & float_flag_divbyzero) target_bits |= 2; if (host_bits & float_flag_overflow) target_bits |= 4; if (host_bits & float_flag_underflow) target_bits |= 8; if (host_bits & float_flag_inexact) target_bits |= 0x10; if (host_bits & float_flag_input_denormal) target_bits |= 0x80; return target_bits; }
true
qemu
36802b6b1ed7887aeae5d027f86a969400f8824a
static inline int vfp_exceptbits_from_host(int host_bits) { int target_bits = 0; if (host_bits & float_flag_invalid) target_bits |= 1; if (host_bits & float_flag_divbyzero) target_bits |= 2; if (host_bits & float_flag_overflow) target_bits |= 4; if (host_bits & float_flag_underflow) target_bits |= 8; if (host_bits & float_flag_inexact) target_bits |= 0x10; if (host_bits & float_flag_input_denormal) target_bits |= 0x80; return target_bits; }
{ "code": [ " if (host_bits & float_flag_underflow)" ], "line_no": [ 21 ] }
static inline int FUNC_0(int VAR_0) { int VAR_1 = 0; if (VAR_0 & float_flag_invalid) VAR_1 |= 1; if (VAR_0 & float_flag_divbyzero) VAR_1 |= 2; if (VAR_0 & float_flag_overflow) VAR_1 |= 4; if (VAR_0 & float_flag_underflow) VAR_1 |= 8; if (VAR_0 & float_flag_inexact) VAR_1 |= 0x10; if (VAR_0 & float_flag_input_denormal) VAR_1 |= 0x80; return VAR_1; }
[ "static inline int FUNC_0(int VAR_0)\n{", "int VAR_1 = 0;", "if (VAR_0 & float_flag_invalid)\nVAR_1 |= 1;", "if (VAR_0 & float_flag_divbyzero)\nVAR_1 |= 2;", "if (VAR_0 & float_flag_overflow)\nVAR_1 |= 4;", "if (VAR_0 & float_flag_underflow)\nVAR_1 |= 8;", "if (VAR_0 & float_flag_inexact)\nVAR_1 |= 0x10;", "if (VAR_0 & float_flag_input_denormal)\nVAR_1 |= 0x80;", "return VAR_1;", "}" ]
[ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11 ], [ 13, 15 ], [ 17, 19 ], [ 21, 23 ], [ 25, 27 ], [ 29, 31 ], [ 33 ], [ 35 ] ]
18,397
const char *memory_region_name(const MemoryRegion *mr) { return object_get_canonical_path_component(OBJECT(mr)); }
true
qemu
302fa283789a2f9b1199c327047cfad2258a23a2
const char *memory_region_name(const MemoryRegion *mr) { return object_get_canonical_path_component(OBJECT(mr)); }
{ "code": [ " return object_get_canonical_path_component(OBJECT(mr));" ], "line_no": [ 5 ] }
const char *FUNC_0(const MemoryRegion *VAR_0) { return object_get_canonical_path_component(OBJECT(VAR_0)); }
[ "const char *FUNC_0(const MemoryRegion *VAR_0)\n{", "return object_get_canonical_path_component(OBJECT(VAR_0));", "}" ]
[ 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
18,398
static int dnxhd_decode_macroblock(const DNXHDContext *ctx, RowContext *row, AVFrame *frame, int x, int y) { int shift1 = ctx->bit_depth == 10; int dct_linesize_luma = frame->linesize[0]; int dct_linesize_chroma = frame->linesize[1]; uint8_t *dest_y, *dest_u, *dest_v; int dct_y_offset, dct_x_offset; int qscale, i, act; int interlaced_mb = 0; if (ctx->mbaff) { interlaced_mb = get_bits1(&row->gb); qscale = get_bits(&row->gb, 10); } else qscale = get_bits(&row->gb, 11); act = get_bits1(&row->gb); if (act) { static int warned = 0; if (!warned) { warned = 1; av_log(ctx->avctx, AV_LOG_ERROR, "Unsupported adaptive color transform, patch welcome.\n"); } } if (qscale != row->last_qscale) { for (i = 0; i < 64; i++) { row->luma_scale[i] = qscale * ctx->cid_table->luma_weight[i]; row->chroma_scale[i] = qscale * ctx->cid_table->chroma_weight[i]; } row->last_qscale = qscale; } for (i = 0; i < 8 + 4 * ctx->is_444; i++) { ctx->decode_dct_block(ctx, row, i); } if (frame->interlaced_frame) { dct_linesize_luma <<= 1; dct_linesize_chroma <<= 1; } dest_y = frame->data[0] + ((y * dct_linesize_luma) << 4) + (x << (4 + shift1)); dest_u = frame->data[1] + ((y * dct_linesize_chroma) << 4) + (x << (3 + shift1 + ctx->is_444)); dest_v = frame->data[2] + ((y * dct_linesize_chroma) << 4) + (x << (3 + shift1 + ctx->is_444)); if (frame->interlaced_frame && ctx->cur_field) { dest_y += frame->linesize[0]; dest_u += frame->linesize[1]; dest_v += frame->linesize[2]; } if (interlaced_mb) { dct_linesize_luma <<= 1; dct_linesize_chroma <<= 1; } dct_y_offset = interlaced_mb ? frame->linesize[0] : (dct_linesize_luma << 3); dct_x_offset = 8 << shift1; if (!ctx->is_444) { ctx->idsp.idct_put(dest_y, dct_linesize_luma, row->blocks[0]); ctx->idsp.idct_put(dest_y + dct_x_offset, dct_linesize_luma, row->blocks[1]); ctx->idsp.idct_put(dest_y + dct_y_offset, dct_linesize_luma, row->blocks[4]); ctx->idsp.idct_put(dest_y + dct_y_offset + dct_x_offset, dct_linesize_luma, row->blocks[5]); if (!(ctx->avctx->flags & AV_CODEC_FLAG_GRAY)) { dct_y_offset = interlaced_mb ? frame->linesize[1] : (dct_linesize_chroma << 3); ctx->idsp.idct_put(dest_u, dct_linesize_chroma, row->blocks[2]); ctx->idsp.idct_put(dest_v, dct_linesize_chroma, row->blocks[3]); ctx->idsp.idct_put(dest_u + dct_y_offset, dct_linesize_chroma, row->blocks[6]); ctx->idsp.idct_put(dest_v + dct_y_offset, dct_linesize_chroma, row->blocks[7]); } } else { ctx->idsp.idct_put(dest_y, dct_linesize_luma, row->blocks[0]); ctx->idsp.idct_put(dest_y + dct_x_offset, dct_linesize_luma, row->blocks[1]); ctx->idsp.idct_put(dest_y + dct_y_offset, dct_linesize_luma, row->blocks[6]); ctx->idsp.idct_put(dest_y + dct_y_offset + dct_x_offset, dct_linesize_luma, row->blocks[7]); if (!(ctx->avctx->flags & AV_CODEC_FLAG_GRAY)) { dct_y_offset = interlaced_mb ? frame->linesize[1] : (dct_linesize_chroma << 3); ctx->idsp.idct_put(dest_u, dct_linesize_chroma, row->blocks[2]); ctx->idsp.idct_put(dest_u + dct_x_offset, dct_linesize_chroma, row->blocks[3]); ctx->idsp.idct_put(dest_u + dct_y_offset, dct_linesize_chroma, row->blocks[8]); ctx->idsp.idct_put(dest_u + dct_y_offset + dct_x_offset, dct_linesize_chroma, row->blocks[9]); ctx->idsp.idct_put(dest_v, dct_linesize_chroma, row->blocks[4]); ctx->idsp.idct_put(dest_v + dct_x_offset, dct_linesize_chroma, row->blocks[5]); ctx->idsp.idct_put(dest_v + dct_y_offset, dct_linesize_chroma, row->blocks[10]); ctx->idsp.idct_put(dest_v + dct_y_offset + dct_x_offset, dct_linesize_chroma, row->blocks[11]); } } return 0; }
true
FFmpeg
b8b8e82ea14016b2cb04b49ecea57f836e6ee7f8
static int dnxhd_decode_macroblock(const DNXHDContext *ctx, RowContext *row, AVFrame *frame, int x, int y) { int shift1 = ctx->bit_depth == 10; int dct_linesize_luma = frame->linesize[0]; int dct_linesize_chroma = frame->linesize[1]; uint8_t *dest_y, *dest_u, *dest_v; int dct_y_offset, dct_x_offset; int qscale, i, act; int interlaced_mb = 0; if (ctx->mbaff) { interlaced_mb = get_bits1(&row->gb); qscale = get_bits(&row->gb, 10); } else qscale = get_bits(&row->gb, 11); act = get_bits1(&row->gb); if (act) { static int warned = 0; if (!warned) { warned = 1; av_log(ctx->avctx, AV_LOG_ERROR, "Unsupported adaptive color transform, patch welcome.\n"); } } if (qscale != row->last_qscale) { for (i = 0; i < 64; i++) { row->luma_scale[i] = qscale * ctx->cid_table->luma_weight[i]; row->chroma_scale[i] = qscale * ctx->cid_table->chroma_weight[i]; } row->last_qscale = qscale; } for (i = 0; i < 8 + 4 * ctx->is_444; i++) { ctx->decode_dct_block(ctx, row, i); } if (frame->interlaced_frame) { dct_linesize_luma <<= 1; dct_linesize_chroma <<= 1; } dest_y = frame->data[0] + ((y * dct_linesize_luma) << 4) + (x << (4 + shift1)); dest_u = frame->data[1] + ((y * dct_linesize_chroma) << 4) + (x << (3 + shift1 + ctx->is_444)); dest_v = frame->data[2] + ((y * dct_linesize_chroma) << 4) + (x << (3 + shift1 + ctx->is_444)); if (frame->interlaced_frame && ctx->cur_field) { dest_y += frame->linesize[0]; dest_u += frame->linesize[1]; dest_v += frame->linesize[2]; } if (interlaced_mb) { dct_linesize_luma <<= 1; dct_linesize_chroma <<= 1; } dct_y_offset = interlaced_mb ? frame->linesize[0] : (dct_linesize_luma << 3); dct_x_offset = 8 << shift1; if (!ctx->is_444) { ctx->idsp.idct_put(dest_y, dct_linesize_luma, row->blocks[0]); ctx->idsp.idct_put(dest_y + dct_x_offset, dct_linesize_luma, row->blocks[1]); ctx->idsp.idct_put(dest_y + dct_y_offset, dct_linesize_luma, row->blocks[4]); ctx->idsp.idct_put(dest_y + dct_y_offset + dct_x_offset, dct_linesize_luma, row->blocks[5]); if (!(ctx->avctx->flags & AV_CODEC_FLAG_GRAY)) { dct_y_offset = interlaced_mb ? frame->linesize[1] : (dct_linesize_chroma << 3); ctx->idsp.idct_put(dest_u, dct_linesize_chroma, row->blocks[2]); ctx->idsp.idct_put(dest_v, dct_linesize_chroma, row->blocks[3]); ctx->idsp.idct_put(dest_u + dct_y_offset, dct_linesize_chroma, row->blocks[6]); ctx->idsp.idct_put(dest_v + dct_y_offset, dct_linesize_chroma, row->blocks[7]); } } else { ctx->idsp.idct_put(dest_y, dct_linesize_luma, row->blocks[0]); ctx->idsp.idct_put(dest_y + dct_x_offset, dct_linesize_luma, row->blocks[1]); ctx->idsp.idct_put(dest_y + dct_y_offset, dct_linesize_luma, row->blocks[6]); ctx->idsp.idct_put(dest_y + dct_y_offset + dct_x_offset, dct_linesize_luma, row->blocks[7]); if (!(ctx->avctx->flags & AV_CODEC_FLAG_GRAY)) { dct_y_offset = interlaced_mb ? frame->linesize[1] : (dct_linesize_chroma << 3); ctx->idsp.idct_put(dest_u, dct_linesize_chroma, row->blocks[2]); ctx->idsp.idct_put(dest_u + dct_x_offset, dct_linesize_chroma, row->blocks[3]); ctx->idsp.idct_put(dest_u + dct_y_offset, dct_linesize_chroma, row->blocks[8]); ctx->idsp.idct_put(dest_u + dct_y_offset + dct_x_offset, dct_linesize_chroma, row->blocks[9]); ctx->idsp.idct_put(dest_v, dct_linesize_chroma, row->blocks[4]); ctx->idsp.idct_put(dest_v + dct_x_offset, dct_linesize_chroma, row->blocks[5]); ctx->idsp.idct_put(dest_v + dct_y_offset, dct_linesize_chroma, row->blocks[10]); ctx->idsp.idct_put(dest_v + dct_y_offset + dct_x_offset, dct_linesize_chroma, row->blocks[11]); } } return 0; }
{ "code": [ " ctx->decode_dct_block(ctx, row, i);" ], "line_no": [ 71 ] }
static int FUNC_0(const DNXHDContext *VAR_0, RowContext *VAR_1, AVFrame *VAR_2, int VAR_3, int VAR_4) { int VAR_5 = VAR_0->bit_depth == 10; int VAR_6 = VAR_2->linesize[0]; int VAR_7 = VAR_2->linesize[1]; uint8_t *dest_y, *dest_u, *dest_v; int VAR_8, VAR_9; int VAR_10, VAR_11, VAR_12; int VAR_13 = 0; if (VAR_0->mbaff) { VAR_13 = get_bits1(&VAR_1->gb); VAR_10 = get_bits(&VAR_1->gb, 10); } else VAR_10 = get_bits(&VAR_1->gb, 11); VAR_12 = get_bits1(&VAR_1->gb); if (VAR_12) { static int VAR_14 = 0; if (!VAR_14) { VAR_14 = 1; av_log(VAR_0->avctx, AV_LOG_ERROR, "Unsupported adaptive color transform, patch welcome.\n"); } } if (VAR_10 != VAR_1->last_qscale) { for (VAR_11 = 0; VAR_11 < 64; VAR_11++) { VAR_1->luma_scale[VAR_11] = VAR_10 * VAR_0->cid_table->luma_weight[VAR_11]; VAR_1->chroma_scale[VAR_11] = VAR_10 * VAR_0->cid_table->chroma_weight[VAR_11]; } VAR_1->last_qscale = VAR_10; } for (VAR_11 = 0; VAR_11 < 8 + 4 * VAR_0->is_444; VAR_11++) { VAR_0->decode_dct_block(VAR_0, VAR_1, VAR_11); } if (VAR_2->interlaced_frame) { VAR_6 <<= 1; VAR_7 <<= 1; } dest_y = VAR_2->data[0] + ((VAR_4 * VAR_6) << 4) + (VAR_3 << (4 + VAR_5)); dest_u = VAR_2->data[1] + ((VAR_4 * VAR_7) << 4) + (VAR_3 << (3 + VAR_5 + VAR_0->is_444)); dest_v = VAR_2->data[2] + ((VAR_4 * VAR_7) << 4) + (VAR_3 << (3 + VAR_5 + VAR_0->is_444)); if (VAR_2->interlaced_frame && VAR_0->cur_field) { dest_y += VAR_2->linesize[0]; dest_u += VAR_2->linesize[1]; dest_v += VAR_2->linesize[2]; } if (VAR_13) { VAR_6 <<= 1; VAR_7 <<= 1; } VAR_8 = VAR_13 ? VAR_2->linesize[0] : (VAR_6 << 3); VAR_9 = 8 << VAR_5; if (!VAR_0->is_444) { VAR_0->idsp.idct_put(dest_y, VAR_6, VAR_1->blocks[0]); VAR_0->idsp.idct_put(dest_y + VAR_9, VAR_6, VAR_1->blocks[1]); VAR_0->idsp.idct_put(dest_y + VAR_8, VAR_6, VAR_1->blocks[4]); VAR_0->idsp.idct_put(dest_y + VAR_8 + VAR_9, VAR_6, VAR_1->blocks[5]); if (!(VAR_0->avctx->flags & AV_CODEC_FLAG_GRAY)) { VAR_8 = VAR_13 ? VAR_2->linesize[1] : (VAR_7 << 3); VAR_0->idsp.idct_put(dest_u, VAR_7, VAR_1->blocks[2]); VAR_0->idsp.idct_put(dest_v, VAR_7, VAR_1->blocks[3]); VAR_0->idsp.idct_put(dest_u + VAR_8, VAR_7, VAR_1->blocks[6]); VAR_0->idsp.idct_put(dest_v + VAR_8, VAR_7, VAR_1->blocks[7]); } } else { VAR_0->idsp.idct_put(dest_y, VAR_6, VAR_1->blocks[0]); VAR_0->idsp.idct_put(dest_y + VAR_9, VAR_6, VAR_1->blocks[1]); VAR_0->idsp.idct_put(dest_y + VAR_8, VAR_6, VAR_1->blocks[6]); VAR_0->idsp.idct_put(dest_y + VAR_8 + VAR_9, VAR_6, VAR_1->blocks[7]); if (!(VAR_0->avctx->flags & AV_CODEC_FLAG_GRAY)) { VAR_8 = VAR_13 ? VAR_2->linesize[1] : (VAR_7 << 3); VAR_0->idsp.idct_put(dest_u, VAR_7, VAR_1->blocks[2]); VAR_0->idsp.idct_put(dest_u + VAR_9, VAR_7, VAR_1->blocks[3]); VAR_0->idsp.idct_put(dest_u + VAR_8, VAR_7, VAR_1->blocks[8]); VAR_0->idsp.idct_put(dest_u + VAR_8 + VAR_9, VAR_7, VAR_1->blocks[9]); VAR_0->idsp.idct_put(dest_v, VAR_7, VAR_1->blocks[4]); VAR_0->idsp.idct_put(dest_v + VAR_9, VAR_7, VAR_1->blocks[5]); VAR_0->idsp.idct_put(dest_v + VAR_8, VAR_7, VAR_1->blocks[10]); VAR_0->idsp.idct_put(dest_v + VAR_8 + VAR_9, VAR_7, VAR_1->blocks[11]); } } return 0; }
[ "static int FUNC_0(const DNXHDContext *VAR_0, RowContext *VAR_1,\nAVFrame *VAR_2, int VAR_3, int VAR_4)\n{", "int VAR_5 = VAR_0->bit_depth == 10;", "int VAR_6 = VAR_2->linesize[0];", "int VAR_7 = VAR_2->linesize[1];", "uint8_t *dest_y, *dest_u, *dest_v;", "int VAR_8, VAR_9;", "int VAR_10, VAR_11, VAR_12;", "int VAR_13 = 0;", "if (VAR_0->mbaff) {", "VAR_13 = get_bits1(&VAR_1->gb);", "VAR_10 = get_bits(&VAR_1->gb, 10);", "} else", "VAR_10 = get_bits(&VAR_1->gb, 11);", "VAR_12 = get_bits1(&VAR_1->gb);", "if (VAR_12) {", "static int VAR_14 = 0;", "if (!VAR_14) {", "VAR_14 = 1;", "av_log(VAR_0->avctx, AV_LOG_ERROR,\n\"Unsupported adaptive color transform, patch welcome.\\n\");", "}", "}", "if (VAR_10 != VAR_1->last_qscale) {", "for (VAR_11 = 0; VAR_11 < 64; VAR_11++) {", "VAR_1->luma_scale[VAR_11] = VAR_10 * VAR_0->cid_table->luma_weight[VAR_11];", "VAR_1->chroma_scale[VAR_11] = VAR_10 * VAR_0->cid_table->chroma_weight[VAR_11];", "}", "VAR_1->last_qscale = VAR_10;", "}", "for (VAR_11 = 0; VAR_11 < 8 + 4 * VAR_0->is_444; VAR_11++) {", "VAR_0->decode_dct_block(VAR_0, VAR_1, VAR_11);", "}", "if (VAR_2->interlaced_frame) {", "VAR_6 <<= 1;", "VAR_7 <<= 1;", "}", "dest_y = VAR_2->data[0] + ((VAR_4 * VAR_6) << 4) + (VAR_3 << (4 + VAR_5));", "dest_u = VAR_2->data[1] + ((VAR_4 * VAR_7) << 4) + (VAR_3 << (3 + VAR_5 + VAR_0->is_444));", "dest_v = VAR_2->data[2] + ((VAR_4 * VAR_7) << 4) + (VAR_3 << (3 + VAR_5 + VAR_0->is_444));", "if (VAR_2->interlaced_frame && VAR_0->cur_field) {", "dest_y += VAR_2->linesize[0];", "dest_u += VAR_2->linesize[1];", "dest_v += VAR_2->linesize[2];", "}", "if (VAR_13) {", "VAR_6 <<= 1;", "VAR_7 <<= 1;", "}", "VAR_8 = VAR_13 ? VAR_2->linesize[0] : (VAR_6 << 3);", "VAR_9 = 8 << VAR_5;", "if (!VAR_0->is_444) {", "VAR_0->idsp.idct_put(dest_y, VAR_6, VAR_1->blocks[0]);", "VAR_0->idsp.idct_put(dest_y + VAR_9, VAR_6, VAR_1->blocks[1]);", "VAR_0->idsp.idct_put(dest_y + VAR_8, VAR_6, VAR_1->blocks[4]);", "VAR_0->idsp.idct_put(dest_y + VAR_8 + VAR_9, VAR_6, VAR_1->blocks[5]);", "if (!(VAR_0->avctx->flags & AV_CODEC_FLAG_GRAY)) {", "VAR_8 = VAR_13 ? VAR_2->linesize[1] : (VAR_7 << 3);", "VAR_0->idsp.idct_put(dest_u, VAR_7, VAR_1->blocks[2]);", "VAR_0->idsp.idct_put(dest_v, VAR_7, VAR_1->blocks[3]);", "VAR_0->idsp.idct_put(dest_u + VAR_8, VAR_7, VAR_1->blocks[6]);", "VAR_0->idsp.idct_put(dest_v + VAR_8, VAR_7, VAR_1->blocks[7]);", "}", "} else {", "VAR_0->idsp.idct_put(dest_y, VAR_6, VAR_1->blocks[0]);", "VAR_0->idsp.idct_put(dest_y + VAR_9, VAR_6, VAR_1->blocks[1]);", "VAR_0->idsp.idct_put(dest_y + VAR_8, VAR_6, VAR_1->blocks[6]);", "VAR_0->idsp.idct_put(dest_y + VAR_8 + VAR_9, VAR_6, VAR_1->blocks[7]);", "if (!(VAR_0->avctx->flags & AV_CODEC_FLAG_GRAY)) {", "VAR_8 = VAR_13 ? VAR_2->linesize[1] : (VAR_7 << 3);", "VAR_0->idsp.idct_put(dest_u, VAR_7, VAR_1->blocks[2]);", "VAR_0->idsp.idct_put(dest_u + VAR_9, VAR_7, VAR_1->blocks[3]);", "VAR_0->idsp.idct_put(dest_u + VAR_8, VAR_7, VAR_1->blocks[8]);", "VAR_0->idsp.idct_put(dest_u + VAR_8 + VAR_9, VAR_7, VAR_1->blocks[9]);", "VAR_0->idsp.idct_put(dest_v, VAR_7, VAR_1->blocks[4]);", "VAR_0->idsp.idct_put(dest_v + VAR_9, VAR_7, VAR_1->blocks[5]);", "VAR_0->idsp.idct_put(dest_v + VAR_8, VAR_7, VAR_1->blocks[10]);", "VAR_0->idsp.idct_put(dest_v + VAR_8 + VAR_9, VAR_7, VAR_1->blocks[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, 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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 87 ], [ 89 ], [ 91 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 183 ], [ 185 ] ]
18,399
static void wmv2_idct_col(short * b) { int s1,s2; int a0,a1,a2,a3,a4,a5,a6,a7; /*step 1, with extended precision*/ a1 = (W1*b[8*1]+W7*b[8*7] + 4)>>3; a7 = (W7*b[8*1]-W1*b[8*7] + 4)>>3; a5 = (W5*b[8*5]+W3*b[8*3] + 4)>>3; a3 = (W3*b[8*5]-W5*b[8*3] + 4)>>3; a2 = (W2*b[8*2]+W6*b[8*6] + 4)>>3; a6 = (W6*b[8*2]-W2*b[8*6] + 4)>>3; a0 = (W0*b[8*0]+W0*b[8*4] )>>3; a4 = (W0*b[8*0]-W0*b[8*4] )>>3; /*step 2*/ s1 = (181*(a1-a5+a7-a3)+128)>>8; s2 = (181*(a1-a5-a7+a3)+128)>>8; /*step 3*/ b[8*0] = (a0+a2+a1+a5 + (1<<13))>>14; b[8*1] = (a4+a6 +s1 + (1<<13))>>14; b[8*2] = (a4-a6 +s2 + (1<<13))>>14; b[8*3] = (a0-a2+a7+a3 + (1<<13))>>14; b[8*4] = (a0-a2-a7-a3 + (1<<13))>>14; b[8*5] = (a4-a6 -s2 + (1<<13))>>14; b[8*6] = (a4+a6 -s1 + (1<<13))>>14; b[8*7] = (a0+a2-a1-a5 + (1<<13))>>14; }
true
FFmpeg
e6bc38fd49c94726b45d5d5cc2b756ad8ec49ee0
static void wmv2_idct_col(short * b) { int s1,s2; int a0,a1,a2,a3,a4,a5,a6,a7; a1 = (W1*b[8*1]+W7*b[8*7] + 4)>>3; a7 = (W7*b[8*1]-W1*b[8*7] + 4)>>3; a5 = (W5*b[8*5]+W3*b[8*3] + 4)>>3; a3 = (W3*b[8*5]-W5*b[8*3] + 4)>>3; a2 = (W2*b[8*2]+W6*b[8*6] + 4)>>3; a6 = (W6*b[8*2]-W2*b[8*6] + 4)>>3; a0 = (W0*b[8*0]+W0*b[8*4] )>>3; a4 = (W0*b[8*0]-W0*b[8*4] )>>3; s1 = (181*(a1-a5+a7-a3)+128)>>8; s2 = (181*(a1-a5-a7+a3)+128)>>8; b[8*0] = (a0+a2+a1+a5 + (1<<13))>>14; b[8*1] = (a4+a6 +s1 + (1<<13))>>14; b[8*2] = (a4-a6 +s2 + (1<<13))>>14; b[8*3] = (a0-a2+a7+a3 + (1<<13))>>14; b[8*4] = (a0-a2-a7-a3 + (1<<13))>>14; b[8*5] = (a4-a6 -s2 + (1<<13))>>14; b[8*6] = (a4+a6 -s1 + (1<<13))>>14; b[8*7] = (a0+a2-a1-a5 + (1<<13))>>14; }
{ "code": [ " int s1,s2;", " int a0,a1,a2,a3,a4,a5,a6,a7;", " s2 = (181*(a1-a5-a7+a3)+128)>>8;", "static void wmv2_idct_col(short * b)", " int s1,s2;", " int a0,a1,a2,a3,a4,a5,a6,a7;", " a1 = (W1*b[8*1]+W7*b[8*7] + 4)>>3;", " a7 = (W7*b[8*1]-W1*b[8*7] + 4)>>3;", " a5 = (W5*b[8*5]+W3*b[8*3] + 4)>>3;", " a3 = (W3*b[8*5]-W5*b[8*3] + 4)>>3;", " a2 = (W2*b[8*2]+W6*b[8*6] + 4)>>3;", " a6 = (W6*b[8*2]-W2*b[8*6] + 4)>>3;", " a0 = (W0*b[8*0]+W0*b[8*4] )>>3;", " a4 = (W0*b[8*0]-W0*b[8*4] )>>3;", " s1 = (181*(a1-a5+a7-a3)+128)>>8;", " s2 = (181*(a1-a5-a7+a3)+128)>>8;", " b[8*0] = (a0+a2+a1+a5 + (1<<13))>>14;", " b[8*1] = (a4+a6 +s1 + (1<<13))>>14;", " b[8*2] = (a4-a6 +s2 + (1<<13))>>14;", " b[8*3] = (a0-a2+a7+a3 + (1<<13))>>14;", " b[8*4] = (a0-a2-a7-a3 + (1<<13))>>14;", " b[8*5] = (a4-a6 -s2 + (1<<13))>>14;", " b[8*6] = (a4+a6 -s1 + (1<<13))>>14;", " b[8*7] = (a0+a2-a1-a5 + (1<<13))>>14;" ], "line_no": [ 5, 7, 31, 1, 5, 7, 11, 13, 15, 17, 19, 21, 23, 25, 29, 31, 35, 37, 39, 41, 45, 47, 49, 51 ] }
static void FUNC_0(short * VAR_0) { int VAR_1,VAR_2; int VAR_3,VAR_4,VAR_5,VAR_6,VAR_7,VAR_8,VAR_9,VAR_10; VAR_4 = (W1*VAR_0[8*1]+W7*VAR_0[8*7] + 4)>>3; VAR_10 = (W7*VAR_0[8*1]-W1*VAR_0[8*7] + 4)>>3; VAR_8 = (W5*VAR_0[8*5]+W3*VAR_0[8*3] + 4)>>3; VAR_6 = (W3*VAR_0[8*5]-W5*VAR_0[8*3] + 4)>>3; VAR_5 = (W2*VAR_0[8*2]+W6*VAR_0[8*6] + 4)>>3; VAR_9 = (W6*VAR_0[8*2]-W2*VAR_0[8*6] + 4)>>3; VAR_3 = (W0*VAR_0[8*0]+W0*VAR_0[8*4] )>>3; VAR_7 = (W0*VAR_0[8*0]-W0*VAR_0[8*4] )>>3; VAR_1 = (181*(VAR_4-VAR_8+VAR_10-VAR_6)+128)>>8; VAR_2 = (181*(VAR_4-VAR_8-VAR_10+VAR_6)+128)>>8; VAR_0[8*0] = (VAR_3+VAR_5+VAR_4+VAR_8 + (1<<13))>>14; VAR_0[8*1] = (VAR_7+VAR_9 +VAR_1 + (1<<13))>>14; VAR_0[8*2] = (VAR_7-VAR_9 +VAR_2 + (1<<13))>>14; VAR_0[8*3] = (VAR_3-VAR_5+VAR_10+VAR_6 + (1<<13))>>14; VAR_0[8*4] = (VAR_3-VAR_5-VAR_10-VAR_6 + (1<<13))>>14; VAR_0[8*5] = (VAR_7-VAR_9 -VAR_2 + (1<<13))>>14; VAR_0[8*6] = (VAR_7+VAR_9 -VAR_1 + (1<<13))>>14; VAR_0[8*7] = (VAR_3+VAR_5-VAR_4-VAR_8 + (1<<13))>>14; }
[ "static void FUNC_0(short * VAR_0)\n{", "int VAR_1,VAR_2;", "int VAR_3,VAR_4,VAR_5,VAR_6,VAR_7,VAR_8,VAR_9,VAR_10;", "VAR_4 = (W1*VAR_0[8*1]+W7*VAR_0[8*7] + 4)>>3;", "VAR_10 = (W7*VAR_0[8*1]-W1*VAR_0[8*7] + 4)>>3;", "VAR_8 = (W5*VAR_0[8*5]+W3*VAR_0[8*3] + 4)>>3;", "VAR_6 = (W3*VAR_0[8*5]-W5*VAR_0[8*3] + 4)>>3;", "VAR_5 = (W2*VAR_0[8*2]+W6*VAR_0[8*6] + 4)>>3;", "VAR_9 = (W6*VAR_0[8*2]-W2*VAR_0[8*6] + 4)>>3;", "VAR_3 = (W0*VAR_0[8*0]+W0*VAR_0[8*4] )>>3;", "VAR_7 = (W0*VAR_0[8*0]-W0*VAR_0[8*4] )>>3;", "VAR_1 = (181*(VAR_4-VAR_8+VAR_10-VAR_6)+128)>>8;", "VAR_2 = (181*(VAR_4-VAR_8-VAR_10+VAR_6)+128)>>8;", "VAR_0[8*0] = (VAR_3+VAR_5+VAR_4+VAR_8 + (1<<13))>>14;", "VAR_0[8*1] = (VAR_7+VAR_9 +VAR_1 + (1<<13))>>14;", "VAR_0[8*2] = (VAR_7-VAR_9 +VAR_2 + (1<<13))>>14;", "VAR_0[8*3] = (VAR_3-VAR_5+VAR_10+VAR_6 + (1<<13))>>14;", "VAR_0[8*4] = (VAR_3-VAR_5-VAR_10-VAR_6 + (1<<13))>>14;", "VAR_0[8*5] = (VAR_7-VAR_9 -VAR_2 + (1<<13))>>14;", "VAR_0[8*6] = (VAR_7+VAR_9 -VAR_1 + (1<<13))>>14;", "VAR_0[8*7] = (VAR_3+VAR_5-VAR_4-VAR_8 + (1<<13))>>14;", "}" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ] ]
18,400
static void bonito_writel(void *opaque, hwaddr addr, uint64_t val, unsigned size) { PCIBonitoState *s = opaque; uint32_t saddr; int reset = 0; saddr = (addr - BONITO_REGBASE) >> 2; DPRINTF("bonito_writel "TARGET_FMT_plx" val %x saddr %x\n", addr, val, saddr); switch (saddr) { case BONITO_BONPONCFG: case BONITO_IODEVCFG: case BONITO_SDCFG: case BONITO_PCIMAP: case BONITO_PCIMEMBASECFG: case BONITO_PCIMAP_CFG: case BONITO_GPIODATA: case BONITO_GPIOIE: case BONITO_INTEDGE: case BONITO_INTSTEER: case BONITO_INTPOL: case BONITO_PCIMAIL0: case BONITO_PCIMAIL1: case BONITO_PCIMAIL2: case BONITO_PCIMAIL3: case BONITO_PCICACHECTRL: case BONITO_PCICACHETAG: case BONITO_PCIBADADDR: case BONITO_PCIMSTAT: case BONITO_TIMECFG: case BONITO_CPUCFG: case BONITO_DQCFG: case BONITO_MEMSIZE: s->regs[saddr] = val; break; case BONITO_BONGENCFG: if (!(s->regs[saddr] & 0x04) && (val & 0x04)) { reset = 1; /* bit 2 jump from 0 to 1 cause reset */ } s->regs[saddr] = val; if (reset) { qemu_system_reset_request(); } break; case BONITO_INTENSET: s->regs[BONITO_INTENSET] = val; s->regs[BONITO_INTEN] |= val; break; case BONITO_INTENCLR: s->regs[BONITO_INTENCLR] = val; s->regs[BONITO_INTEN] &= ~val; break; case BONITO_INTEN: case BONITO_INTISR: DPRINTF("write to readonly bonito register %x\n", saddr); break; default: DPRINTF("write to unknown bonito register %x\n", saddr); break; } }
true
qemu
0ca4f94195cce77b624edc6d9abcf14a3bf01f06
static void bonito_writel(void *opaque, hwaddr addr, uint64_t val, unsigned size) { PCIBonitoState *s = opaque; uint32_t saddr; int reset = 0; saddr = (addr - BONITO_REGBASE) >> 2; DPRINTF("bonito_writel "TARGET_FMT_plx" val %x saddr %x\n", addr, val, saddr); switch (saddr) { case BONITO_BONPONCFG: case BONITO_IODEVCFG: case BONITO_SDCFG: case BONITO_PCIMAP: case BONITO_PCIMEMBASECFG: case BONITO_PCIMAP_CFG: case BONITO_GPIODATA: case BONITO_GPIOIE: case BONITO_INTEDGE: case BONITO_INTSTEER: case BONITO_INTPOL: case BONITO_PCIMAIL0: case BONITO_PCIMAIL1: case BONITO_PCIMAIL2: case BONITO_PCIMAIL3: case BONITO_PCICACHECTRL: case BONITO_PCICACHETAG: case BONITO_PCIBADADDR: case BONITO_PCIMSTAT: case BONITO_TIMECFG: case BONITO_CPUCFG: case BONITO_DQCFG: case BONITO_MEMSIZE: s->regs[saddr] = val; break; case BONITO_BONGENCFG: if (!(s->regs[saddr] & 0x04) && (val & 0x04)) { reset = 1; } s->regs[saddr] = val; if (reset) { qemu_system_reset_request(); } break; case BONITO_INTENSET: s->regs[BONITO_INTENSET] = val; s->regs[BONITO_INTEN] |= val; break; case BONITO_INTENCLR: s->regs[BONITO_INTENCLR] = val; s->regs[BONITO_INTEN] &= ~val; break; case BONITO_INTEN: case BONITO_INTISR: DPRINTF("write to readonly bonito register %x\n", saddr); break; default: DPRINTF("write to unknown bonito register %x\n", saddr); break; } }
{ "code": [ " saddr = (addr - BONITO_REGBASE) >> 2;", " saddr = (addr - BONITO_REGBASE) >> 2;" ], "line_no": [ 15, 15 ] }
static void FUNC_0(void *VAR_0, hwaddr VAR_1, uint64_t VAR_2, unsigned VAR_3) { PCIBonitoState *s = VAR_0; uint32_t saddr; int VAR_4 = 0; saddr = (VAR_1 - BONITO_REGBASE) >> 2; DPRINTF("FUNC_0 "TARGET_FMT_plx" VAR_2 %x saddr %x\n", VAR_1, VAR_2, saddr); switch (saddr) { case BONITO_BONPONCFG: case BONITO_IODEVCFG: case BONITO_SDCFG: case BONITO_PCIMAP: case BONITO_PCIMEMBASECFG: case BONITO_PCIMAP_CFG: case BONITO_GPIODATA: case BONITO_GPIOIE: case BONITO_INTEDGE: case BONITO_INTSTEER: case BONITO_INTPOL: case BONITO_PCIMAIL0: case BONITO_PCIMAIL1: case BONITO_PCIMAIL2: case BONITO_PCIMAIL3: case BONITO_PCICACHECTRL: case BONITO_PCICACHETAG: case BONITO_PCIBADADDR: case BONITO_PCIMSTAT: case BONITO_TIMECFG: case BONITO_CPUCFG: case BONITO_DQCFG: case BONITO_MEMSIZE: s->regs[saddr] = VAR_2; break; case BONITO_BONGENCFG: if (!(s->regs[saddr] & 0x04) && (VAR_2 & 0x04)) { VAR_4 = 1; } s->regs[saddr] = VAR_2; if (VAR_4) { qemu_system_reset_request(); } break; case BONITO_INTENSET: s->regs[BONITO_INTENSET] = VAR_2; s->regs[BONITO_INTEN] |= VAR_2; break; case BONITO_INTENCLR: s->regs[BONITO_INTENCLR] = VAR_2; s->regs[BONITO_INTEN] &= ~VAR_2; break; case BONITO_INTEN: case BONITO_INTISR: DPRINTF("write to readonly bonito register %x\n", saddr); break; default: DPRINTF("write to unknown bonito register %x\n", saddr); break; } }
[ "static void FUNC_0(void *VAR_0, hwaddr VAR_1,\nuint64_t VAR_2, unsigned VAR_3)\n{", "PCIBonitoState *s = VAR_0;", "uint32_t saddr;", "int VAR_4 = 0;", "saddr = (VAR_1 - BONITO_REGBASE) >> 2;", "DPRINTF(\"FUNC_0 \"TARGET_FMT_plx\" VAR_2 %x saddr %x\\n\", VAR_1, VAR_2, saddr);", "switch (saddr) {", "case BONITO_BONPONCFG:\ncase BONITO_IODEVCFG:\ncase BONITO_SDCFG:\ncase BONITO_PCIMAP:\ncase BONITO_PCIMEMBASECFG:\ncase BONITO_PCIMAP_CFG:\ncase BONITO_GPIODATA:\ncase BONITO_GPIOIE:\ncase BONITO_INTEDGE:\ncase BONITO_INTSTEER:\ncase BONITO_INTPOL:\ncase BONITO_PCIMAIL0:\ncase BONITO_PCIMAIL1:\ncase BONITO_PCIMAIL2:\ncase BONITO_PCIMAIL3:\ncase BONITO_PCICACHECTRL:\ncase BONITO_PCICACHETAG:\ncase BONITO_PCIBADADDR:\ncase BONITO_PCIMSTAT:\ncase BONITO_TIMECFG:\ncase BONITO_CPUCFG:\ncase BONITO_DQCFG:\ncase BONITO_MEMSIZE:\ns->regs[saddr] = VAR_2;", "break;", "case BONITO_BONGENCFG:\nif (!(s->regs[saddr] & 0x04) && (VAR_2 & 0x04)) {", "VAR_4 = 1;", "}", "s->regs[saddr] = VAR_2;", "if (VAR_4) {", "qemu_system_reset_request();", "}", "break;", "case BONITO_INTENSET:\ns->regs[BONITO_INTENSET] = VAR_2;", "s->regs[BONITO_INTEN] |= VAR_2;", "break;", "case BONITO_INTENCLR:\ns->regs[BONITO_INTENCLR] = VAR_2;", "s->regs[BONITO_INTEN] &= ~VAR_2;", "break;", "case BONITO_INTEN:\ncase BONITO_INTISR:\nDPRINTF(\"write to readonly bonito register %x\\n\", saddr);", "break;", "default:\nDPRINTF(\"write to unknown bonito register %x\\n\", saddr);", "break;", "}", "}" ]
[ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 19 ], [ 21 ], [ 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 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 ] ]
18,401
static int init_resampler(AVCodecContext *input_codec_context, AVCodecContext *output_codec_context, SwrContext **resample_context) { /** * Only initialize the resampler if it is necessary, i.e., * if and only if the sample formats differ. */ if (input_codec_context->sample_fmt != output_codec_context->sample_fmt || input_codec_context->channels != output_codec_context->channels) { int error; /** * Create a resampler context for the conversion. * Set the conversion parameters. * Default channel layouts based on the number of channels * are assumed for simplicity (they are sometimes not detected * properly by the demuxer and/or decoder). */ *resample_context = swr_alloc_set_opts(NULL, av_get_default_channel_layout(output_codec_context->channels), output_codec_context->sample_fmt, output_codec_context->sample_rate, av_get_default_channel_layout(input_codec_context->channels), input_codec_context->sample_fmt, input_codec_context->sample_rate, 0, NULL); if (!*resample_context) { fprintf(stderr, "Could not allocate resample context\n"); return AVERROR(ENOMEM); } /** * Perform a sanity check so that the number of converted samples is * not greater than the number of samples to be converted. * If the sample rates differ, this case has to be handled differently */ av_assert0(output_codec_context->sample_rate == input_codec_context->sample_rate); /** Open the resampler with the specified parameters. */ if ((error = swr_init(*resample_context)) < 0) { fprintf(stderr, "Could not open resample context\n"); swr_free(resample_context); return error; } } return 0; }
true
FFmpeg
ba728c1a2527a02f239fdfaf118a618b758721db
static int init_resampler(AVCodecContext *input_codec_context, AVCodecContext *output_codec_context, SwrContext **resample_context) { if (input_codec_context->sample_fmt != output_codec_context->sample_fmt || input_codec_context->channels != output_codec_context->channels) { int error; *resample_context = swr_alloc_set_opts(NULL, av_get_default_channel_layout(output_codec_context->channels), output_codec_context->sample_fmt, output_codec_context->sample_rate, av_get_default_channel_layout(input_codec_context->channels), input_codec_context->sample_fmt, input_codec_context->sample_rate, 0, NULL); if (!*resample_context) { fprintf(stderr, "Could not allocate resample context\n"); return AVERROR(ENOMEM); } av_assert0(output_codec_context->sample_rate == input_codec_context->sample_rate); if ((error = swr_init(*resample_context)) < 0) { fprintf(stderr, "Could not open resample context\n"); swr_free(resample_context); return error; } } return 0; }
{ "code": [ " if (input_codec_context->sample_fmt != output_codec_context->sample_fmt ||", " input_codec_context->channels != output_codec_context->channels) {" ], "line_no": [ 17, 19 ] }
static int FUNC_0(AVCodecContext *VAR_0, AVCodecContext *VAR_1, SwrContext **VAR_2) { if (VAR_0->sample_fmt != VAR_1->sample_fmt || VAR_0->channels != VAR_1->channels) { int VAR_3; *VAR_2 = swr_alloc_set_opts(NULL, av_get_default_channel_layout(VAR_1->channels), VAR_1->sample_fmt, VAR_1->sample_rate, av_get_default_channel_layout(VAR_0->channels), VAR_0->sample_fmt, VAR_0->sample_rate, 0, NULL); if (!*VAR_2) { fprintf(stderr, "Could not allocate resample context\n"); return AVERROR(ENOMEM); } av_assert0(VAR_1->sample_rate == VAR_0->sample_rate); if ((VAR_3 = swr_init(*VAR_2)) < 0) { fprintf(stderr, "Could not open resample context\n"); swr_free(VAR_2); return VAR_3; } } return 0; }
[ "static int FUNC_0(AVCodecContext *VAR_0,\nAVCodecContext *VAR_1,\nSwrContext **VAR_2)\n{", "if (VAR_0->sample_fmt != VAR_1->sample_fmt ||\nVAR_0->channels != VAR_1->channels) {", "int VAR_3;", "*VAR_2 = swr_alloc_set_opts(NULL,\nav_get_default_channel_layout(VAR_1->channels),\nVAR_1->sample_fmt,\nVAR_1->sample_rate,\nav_get_default_channel_layout(VAR_0->channels),\nVAR_0->sample_fmt,\nVAR_0->sample_rate,\n0, NULL);", "if (!*VAR_2) {", "fprintf(stderr, \"Could not allocate resample context\\n\");", "return AVERROR(ENOMEM);", "}", "av_assert0(VAR_1->sample_rate == VAR_0->sample_rate);", "if ((VAR_3 = swr_init(*VAR_2)) < 0) {", "fprintf(stderr, \"Could not open resample context\\n\");", "swr_free(VAR_2);", "return VAR_3;", "}", "}", "return 0;", "}" ]
[ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 17, 19 ], [ 21 ], [ 39, 41, 43, 45, 47, 49, 51, 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 73 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ] ]
18,403
static int qemu_rdma_dest_init(RDMAContext *rdma, Error **errp) { int ret = -EINVAL, idx; struct rdma_cm_id *listen_id; char ip[40] = "unknown"; struct addrinfo *res; char port_str[16]; for (idx = 0; idx < RDMA_WRID_MAX; idx++) { rdma->wr_data[idx].control_len = 0; rdma->wr_data[idx].control_curr = NULL; } if (rdma->host == NULL) { ERROR(errp, "RDMA host is not set!"); rdma->error_state = -EINVAL; return -1; } /* create CM channel */ rdma->channel = rdma_create_event_channel(); if (!rdma->channel) { ERROR(errp, "could not create rdma event channel"); rdma->error_state = -EINVAL; return -1; } /* create CM id */ ret = rdma_create_id(rdma->channel, &listen_id, NULL, RDMA_PS_TCP); if (ret) { ERROR(errp, "could not create cm_id!"); goto err_dest_init_create_listen_id; } snprintf(port_str, 16, "%d", rdma->port); port_str[15] = '\0'; if (rdma->host && strcmp("", rdma->host)) { struct addrinfo *e; ret = getaddrinfo(rdma->host, port_str, NULL, &res); if (ret < 0) { ERROR(errp, "could not getaddrinfo address %s", rdma->host); goto err_dest_init_bind_addr; } for (e = res; e != NULL; e = e->ai_next) { inet_ntop(e->ai_family, &((struct sockaddr_in *) e->ai_addr)->sin_addr, ip, sizeof ip); DPRINTF("Trying %s => %s\n", rdma->host, ip); ret = rdma_bind_addr(listen_id, e->ai_addr); if (!ret) { goto listen; } } ERROR(errp, "Error: could not rdma_bind_addr!"); goto err_dest_init_bind_addr; } else { ERROR(errp, "migration host and port not specified!"); ret = -EINVAL; goto err_dest_init_bind_addr; } listen: rdma->listen_id = listen_id; qemu_rdma_dump_gid("dest_init", listen_id); return 0; err_dest_init_bind_addr: rdma_destroy_id(listen_id); err_dest_init_create_listen_id: rdma_destroy_event_channel(rdma->channel); rdma->channel = NULL; rdma->error_state = ret; return ret; }
true
qemu
7fc5b13fd7b05babc7bcad9dcb8281ae202a9494
static int qemu_rdma_dest_init(RDMAContext *rdma, Error **errp) { int ret = -EINVAL, idx; struct rdma_cm_id *listen_id; char ip[40] = "unknown"; struct addrinfo *res; char port_str[16]; for (idx = 0; idx < RDMA_WRID_MAX; idx++) { rdma->wr_data[idx].control_len = 0; rdma->wr_data[idx].control_curr = NULL; } if (rdma->host == NULL) { ERROR(errp, "RDMA host is not set!"); rdma->error_state = -EINVAL; return -1; } rdma->channel = rdma_create_event_channel(); if (!rdma->channel) { ERROR(errp, "could not create rdma event channel"); rdma->error_state = -EINVAL; return -1; } ret = rdma_create_id(rdma->channel, &listen_id, NULL, RDMA_PS_TCP); if (ret) { ERROR(errp, "could not create cm_id!"); goto err_dest_init_create_listen_id; } snprintf(port_str, 16, "%d", rdma->port); port_str[15] = '\0'; if (rdma->host && strcmp("", rdma->host)) { struct addrinfo *e; ret = getaddrinfo(rdma->host, port_str, NULL, &res); if (ret < 0) { ERROR(errp, "could not getaddrinfo address %s", rdma->host); goto err_dest_init_bind_addr; } for (e = res; e != NULL; e = e->ai_next) { inet_ntop(e->ai_family, &((struct sockaddr_in *) e->ai_addr)->sin_addr, ip, sizeof ip); DPRINTF("Trying %s => %s\n", rdma->host, ip); ret = rdma_bind_addr(listen_id, e->ai_addr); if (!ret) { goto listen; } } ERROR(errp, "Error: could not rdma_bind_addr!"); goto err_dest_init_bind_addr; } else { ERROR(errp, "migration host and port not specified!"); ret = -EINVAL; goto err_dest_init_bind_addr; } listen: rdma->listen_id = listen_id; qemu_rdma_dump_gid("dest_init", listen_id); return 0; err_dest_init_bind_addr: rdma_destroy_id(listen_id); err_dest_init_create_listen_id: rdma_destroy_event_channel(rdma->channel); rdma->channel = NULL; rdma->error_state = ret; return ret; }
{ "code": [ " struct addrinfo *res;", " return -1;", " return -1;", " struct addrinfo *res;", " struct addrinfo *e;", " ret = getaddrinfo(rdma->host, port_str, NULL, &res);", " ERROR(errp, \"could not getaddrinfo address %s\", rdma->host);", " &((struct sockaddr_in *) e->ai_addr)->sin_addr, ip, sizeof ip);", " ret = rdma_bind_addr(listen_id, e->ai_addr);" ], "line_no": [ 11, 33, 33, 11, 75, 79, 83, 95, 99 ] }
static int FUNC_0(RDMAContext *VAR_0, Error **VAR_1) { int VAR_2 = -EINVAL, VAR_3; struct rdma_cm_id *VAR_4; char VAR_5[40] = "unknown"; struct addrinfo *VAR_6; char VAR_7[16]; for (VAR_3 = 0; VAR_3 < RDMA_WRID_MAX; VAR_3++) { VAR_0->wr_data[VAR_3].control_len = 0; VAR_0->wr_data[VAR_3].control_curr = NULL; } if (VAR_0->host == NULL) { ERROR(VAR_1, "RDMA host is not set!"); VAR_0->error_state = -EINVAL; return -1; } VAR_0->channel = rdma_create_event_channel(); if (!VAR_0->channel) { ERROR(VAR_1, "could not create VAR_0 event channel"); VAR_0->error_state = -EINVAL; return -1; } VAR_2 = rdma_create_id(VAR_0->channel, &VAR_4, NULL, RDMA_PS_TCP); if (VAR_2) { ERROR(VAR_1, "could not create cm_id!"); goto err_dest_init_create_listen_id; } snprintf(VAR_7, 16, "%d", VAR_0->port); VAR_7[15] = '\0'; if (VAR_0->host && strcmp("", VAR_0->host)) { struct addrinfo *VAR_8; VAR_2 = getaddrinfo(VAR_0->host, VAR_7, NULL, &VAR_6); if (VAR_2 < 0) { ERROR(VAR_1, "could not getaddrinfo address %s", VAR_0->host); goto err_dest_init_bind_addr; } for (VAR_8 = VAR_6; VAR_8 != NULL; VAR_8 = VAR_8->ai_next) { inet_ntop(VAR_8->ai_family, &((struct sockaddr_in *) VAR_8->ai_addr)->sin_addr, VAR_5, sizeof VAR_5); DPRINTF("Trying %s => %s\n", VAR_0->host, VAR_5); VAR_2 = rdma_bind_addr(VAR_4, VAR_8->ai_addr); if (!VAR_2) { goto listen; } } ERROR(VAR_1, "Error: could not rdma_bind_addr!"); goto err_dest_init_bind_addr; } else { ERROR(VAR_1, "migration host and port not specified!"); VAR_2 = -EINVAL; goto err_dest_init_bind_addr; } listen: VAR_0->VAR_4 = VAR_4; qemu_rdma_dump_gid("dest_init", VAR_4); return 0; err_dest_init_bind_addr: rdma_destroy_id(VAR_4); err_dest_init_create_listen_id: rdma_destroy_event_channel(VAR_0->channel); VAR_0->channel = NULL; VAR_0->error_state = VAR_2; return VAR_2; }
[ "static int FUNC_0(RDMAContext *VAR_0, Error **VAR_1)\n{", "int VAR_2 = -EINVAL, VAR_3;", "struct rdma_cm_id *VAR_4;", "char VAR_5[40] = \"unknown\";", "struct addrinfo *VAR_6;", "char VAR_7[16];", "for (VAR_3 = 0; VAR_3 < RDMA_WRID_MAX; VAR_3++) {", "VAR_0->wr_data[VAR_3].control_len = 0;", "VAR_0->wr_data[VAR_3].control_curr = NULL;", "}", "if (VAR_0->host == NULL) {", "ERROR(VAR_1, \"RDMA host is not set!\");", "VAR_0->error_state = -EINVAL;", "return -1;", "}", "VAR_0->channel = rdma_create_event_channel();", "if (!VAR_0->channel) {", "ERROR(VAR_1, \"could not create VAR_0 event channel\");", "VAR_0->error_state = -EINVAL;", "return -1;", "}", "VAR_2 = rdma_create_id(VAR_0->channel, &VAR_4, NULL, RDMA_PS_TCP);", "if (VAR_2) {", "ERROR(VAR_1, \"could not create cm_id!\");", "goto err_dest_init_create_listen_id;", "}", "snprintf(VAR_7, 16, \"%d\", VAR_0->port);", "VAR_7[15] = '\\0';", "if (VAR_0->host && strcmp(\"\", VAR_0->host)) {", "struct addrinfo *VAR_8;", "VAR_2 = getaddrinfo(VAR_0->host, VAR_7, NULL, &VAR_6);", "if (VAR_2 < 0) {", "ERROR(VAR_1, \"could not getaddrinfo address %s\", VAR_0->host);", "goto err_dest_init_bind_addr;", "}", "for (VAR_8 = VAR_6; VAR_8 != NULL; VAR_8 = VAR_8->ai_next) {", "inet_ntop(VAR_8->ai_family,\n&((struct sockaddr_in *) VAR_8->ai_addr)->sin_addr, VAR_5, sizeof VAR_5);", "DPRINTF(\"Trying %s => %s\\n\", VAR_0->host, VAR_5);", "VAR_2 = rdma_bind_addr(VAR_4, VAR_8->ai_addr);", "if (!VAR_2) {", "goto listen;", "}", "}", "ERROR(VAR_1, \"Error: could not rdma_bind_addr!\");", "goto err_dest_init_bind_addr;", "} else {", "ERROR(VAR_1, \"migration host and port not specified!\");", "VAR_2 = -EINVAL;", "goto err_dest_init_bind_addr;", "}", "listen:\nVAR_0->VAR_4 = VAR_4;", "qemu_rdma_dump_gid(\"dest_init\", VAR_4);", "return 0;", "err_dest_init_bind_addr:\nrdma_destroy_id(VAR_4);", "err_dest_init_create_listen_id:\nrdma_destroy_event_channel(VAR_0->channel);", "VAR_0->channel = NULL;", "VAR_0->error_state = VAR_2;", "return VAR_2;", "}" ]
[ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 91 ], [ 93, 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125, 129 ], [ 131 ], [ 133 ], [ 137, 139 ], [ 141, 143 ], [ 145 ], [ 147 ], [ 149 ], [ 153 ] ]
18,404
static int msmpeg4v12_decode_mb(MpegEncContext *s, int16_t block[6][64]) { int cbp, code, i; uint32_t * const mb_type_ptr = &s->current_picture.mb_type[s->mb_x + s->mb_y*s->mb_stride]; if (s->pict_type == AV_PICTURE_TYPE_P) { if (s->use_skip_mb_code) { if (get_bits1(&s->gb)) { /* skip mb */ s->mb_intra = 0; for(i=0;i<6;i++) s->block_last_index[i] = -1; s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_16X16; s->mv[0][0][0] = 0; s->mv[0][0][1] = 0; s->mb_skipped = 1; *mb_type_ptr = MB_TYPE_SKIP | MB_TYPE_L0 | MB_TYPE_16x16; return 0; } } if(s->msmpeg4_version==2) code = get_vlc2(&s->gb, v2_mb_type_vlc.table, V2_MB_TYPE_VLC_BITS, 1); else code = get_vlc2(&s->gb, ff_h263_inter_MCBPC_vlc.table, INTER_MCBPC_VLC_BITS, 2); if(code<0 || code>7){ av_log(s->avctx, AV_LOG_ERROR, "cbpc %d invalid at %d %d\n", code, s->mb_x, s->mb_y); return -1; } s->mb_intra = code >>2; cbp = code & 0x3; } else { s->mb_intra = 1; if(s->msmpeg4_version==2) cbp= get_vlc2(&s->gb, v2_intra_cbpc_vlc.table, V2_INTRA_CBPC_VLC_BITS, 1); else cbp= get_vlc2(&s->gb, ff_h263_intra_MCBPC_vlc.table, INTRA_MCBPC_VLC_BITS, 1); if(cbp<0 || cbp>3){ av_log(s->avctx, AV_LOG_ERROR, "cbpc %d invalid at %d %d\n", cbp, s->mb_x, s->mb_y); return -1; } } if (!s->mb_intra) { int mx, my, cbpy; cbpy= get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1); if(cbpy<0){ av_log(s->avctx, AV_LOG_ERROR, "cbpy %d invalid at %d %d\n", cbp, s->mb_x, s->mb_y); return -1; } cbp|= cbpy<<2; if(s->msmpeg4_version==1 || (cbp&3) != 3) cbp^= 0x3C; ff_h263_pred_motion(s, 0, 0, &mx, &my); mx= msmpeg4v2_decode_motion(s, mx, 1); my= msmpeg4v2_decode_motion(s, my, 1); s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_16X16; s->mv[0][0][0] = mx; s->mv[0][0][1] = my; *mb_type_ptr = MB_TYPE_L0 | MB_TYPE_16x16; } else { if(s->msmpeg4_version==2){ s->ac_pred = get_bits1(&s->gb); cbp|= get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1)<<2; //FIXME check errors } else{ s->ac_pred = 0; cbp|= get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1)<<2; //FIXME check errors if(s->pict_type==AV_PICTURE_TYPE_P) cbp^=0x3C; } *mb_type_ptr = MB_TYPE_INTRA; } s->bdsp.clear_blocks(s->block[0]); for (i = 0; i < 6; i++) { if (ff_msmpeg4_decode_block(s, block[i], i, (cbp >> (5 - i)) & 1, NULL) < 0) { av_log(s->avctx, AV_LOG_ERROR, "\nerror while decoding block: %d x %d (%d)\n", s->mb_x, s->mb_y, i); return -1; } } return 0; }
true
FFmpeg
1121d9270783b284a70af317d8785eac7df1b72f
static int msmpeg4v12_decode_mb(MpegEncContext *s, int16_t block[6][64]) { int cbp, code, i; uint32_t * const mb_type_ptr = &s->current_picture.mb_type[s->mb_x + s->mb_y*s->mb_stride]; if (s->pict_type == AV_PICTURE_TYPE_P) { if (s->use_skip_mb_code) { if (get_bits1(&s->gb)) { s->mb_intra = 0; for(i=0;i<6;i++) s->block_last_index[i] = -1; s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_16X16; s->mv[0][0][0] = 0; s->mv[0][0][1] = 0; s->mb_skipped = 1; *mb_type_ptr = MB_TYPE_SKIP | MB_TYPE_L0 | MB_TYPE_16x16; return 0; } } if(s->msmpeg4_version==2) code = get_vlc2(&s->gb, v2_mb_type_vlc.table, V2_MB_TYPE_VLC_BITS, 1); else code = get_vlc2(&s->gb, ff_h263_inter_MCBPC_vlc.table, INTER_MCBPC_VLC_BITS, 2); if(code<0 || code>7){ av_log(s->avctx, AV_LOG_ERROR, "cbpc %d invalid at %d %d\n", code, s->mb_x, s->mb_y); return -1; } s->mb_intra = code >>2; cbp = code & 0x3; } else { s->mb_intra = 1; if(s->msmpeg4_version==2) cbp= get_vlc2(&s->gb, v2_intra_cbpc_vlc.table, V2_INTRA_CBPC_VLC_BITS, 1); else cbp= get_vlc2(&s->gb, ff_h263_intra_MCBPC_vlc.table, INTRA_MCBPC_VLC_BITS, 1); if(cbp<0 || cbp>3){ av_log(s->avctx, AV_LOG_ERROR, "cbpc %d invalid at %d %d\n", cbp, s->mb_x, s->mb_y); return -1; } } if (!s->mb_intra) { int mx, my, cbpy; cbpy= get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1); if(cbpy<0){ av_log(s->avctx, AV_LOG_ERROR, "cbpy %d invalid at %d %d\n", cbp, s->mb_x, s->mb_y); return -1; } cbp|= cbpy<<2; if(s->msmpeg4_version==1 || (cbp&3) != 3) cbp^= 0x3C; ff_h263_pred_motion(s, 0, 0, &mx, &my); mx= msmpeg4v2_decode_motion(s, mx, 1); my= msmpeg4v2_decode_motion(s, my, 1); s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_16X16; s->mv[0][0][0] = mx; s->mv[0][0][1] = my; *mb_type_ptr = MB_TYPE_L0 | MB_TYPE_16x16; } else { if(s->msmpeg4_version==2){ s->ac_pred = get_bits1(&s->gb); cbp|= get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1)<<2; } else{ s->ac_pred = 0; cbp|= get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1)<<2; if(s->pict_type==AV_PICTURE_TYPE_P) cbp^=0x3C; } *mb_type_ptr = MB_TYPE_INTRA; } s->bdsp.clear_blocks(s->block[0]); for (i = 0; i < 6; i++) { if (ff_msmpeg4_decode_block(s, block[i], i, (cbp >> (5 - i)) & 1, NULL) < 0) { av_log(s->avctx, AV_LOG_ERROR, "\nerror while decoding block: %d x %d (%d)\n", s->mb_x, s->mb_y, i); return -1; } } return 0; }
{ "code": [ " cbp= get_vlc2(&s->gb, ff_h263_intra_MCBPC_vlc.table, INTRA_MCBPC_VLC_BITS, 1);" ], "line_no": [ 79 ] }
static int FUNC_0(MpegEncContext *VAR_0, int16_t VAR_1[6][64]) { int VAR_2, VAR_3, VAR_4; uint32_t * const mb_type_ptr = &VAR_0->current_picture.mb_type[VAR_0->mb_x + VAR_0->mb_y*VAR_0->mb_stride]; if (VAR_0->pict_type == AV_PICTURE_TYPE_P) { if (VAR_0->use_skip_mb_code) { if (get_bits1(&VAR_0->gb)) { VAR_0->mb_intra = 0; for(VAR_4=0;VAR_4<6;VAR_4++) VAR_0->block_last_index[VAR_4] = -1; VAR_0->mv_dir = MV_DIR_FORWARD; VAR_0->mv_type = MV_TYPE_16X16; VAR_0->mv[0][0][0] = 0; VAR_0->mv[0][0][1] = 0; VAR_0->mb_skipped = 1; *mb_type_ptr = MB_TYPE_SKIP | MB_TYPE_L0 | MB_TYPE_16x16; return 0; } } if(VAR_0->msmpeg4_version==2) VAR_3 = get_vlc2(&VAR_0->gb, v2_mb_type_vlc.table, V2_MB_TYPE_VLC_BITS, 1); else VAR_3 = get_vlc2(&VAR_0->gb, ff_h263_inter_MCBPC_vlc.table, INTER_MCBPC_VLC_BITS, 2); if(VAR_3<0 || VAR_3>7){ av_log(VAR_0->avctx, AV_LOG_ERROR, "cbpc %d invalid at %d %d\n", VAR_3, VAR_0->mb_x, VAR_0->mb_y); return -1; } VAR_0->mb_intra = VAR_3 >>2; VAR_2 = VAR_3 & 0x3; } else { VAR_0->mb_intra = 1; if(VAR_0->msmpeg4_version==2) VAR_2= get_vlc2(&VAR_0->gb, v2_intra_cbpc_vlc.table, V2_INTRA_CBPC_VLC_BITS, 1); else VAR_2= get_vlc2(&VAR_0->gb, ff_h263_intra_MCBPC_vlc.table, INTRA_MCBPC_VLC_BITS, 1); if(VAR_2<0 || VAR_2>3){ av_log(VAR_0->avctx, AV_LOG_ERROR, "cbpc %d invalid at %d %d\n", VAR_2, VAR_0->mb_x, VAR_0->mb_y); return -1; } } if (!VAR_0->mb_intra) { int VAR_5, VAR_6, VAR_7; VAR_7= get_vlc2(&VAR_0->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1); if(VAR_7<0){ av_log(VAR_0->avctx, AV_LOG_ERROR, "VAR_7 %d invalid at %d %d\n", VAR_2, VAR_0->mb_x, VAR_0->mb_y); return -1; } VAR_2|= VAR_7<<2; if(VAR_0->msmpeg4_version==1 || (VAR_2&3) != 3) VAR_2^= 0x3C; ff_h263_pred_motion(VAR_0, 0, 0, &VAR_5, &VAR_6); VAR_5= msmpeg4v2_decode_motion(VAR_0, VAR_5, 1); VAR_6= msmpeg4v2_decode_motion(VAR_0, VAR_6, 1); VAR_0->mv_dir = MV_DIR_FORWARD; VAR_0->mv_type = MV_TYPE_16X16; VAR_0->mv[0][0][0] = VAR_5; VAR_0->mv[0][0][1] = VAR_6; *mb_type_ptr = MB_TYPE_L0 | MB_TYPE_16x16; } else { if(VAR_0->msmpeg4_version==2){ VAR_0->ac_pred = get_bits1(&VAR_0->gb); VAR_2|= get_vlc2(&VAR_0->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1)<<2; } else{ VAR_0->ac_pred = 0; VAR_2|= get_vlc2(&VAR_0->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1)<<2; if(VAR_0->pict_type==AV_PICTURE_TYPE_P) VAR_2^=0x3C; } *mb_type_ptr = MB_TYPE_INTRA; } VAR_0->bdsp.clear_blocks(VAR_0->VAR_1[0]); for (VAR_4 = 0; VAR_4 < 6; VAR_4++) { if (ff_msmpeg4_decode_block(VAR_0, VAR_1[VAR_4], VAR_4, (VAR_2 >> (5 - VAR_4)) & 1, NULL) < 0) { av_log(VAR_0->avctx, AV_LOG_ERROR, "\nerror while decoding VAR_1: %d x %d (%d)\n", VAR_0->mb_x, VAR_0->mb_y, VAR_4); return -1; } } return 0; }
[ "static int FUNC_0(MpegEncContext *VAR_0, int16_t VAR_1[6][64])\n{", "int VAR_2, VAR_3, VAR_4;", "uint32_t * const mb_type_ptr = &VAR_0->current_picture.mb_type[VAR_0->mb_x + VAR_0->mb_y*VAR_0->mb_stride];", "if (VAR_0->pict_type == AV_PICTURE_TYPE_P) {", "if (VAR_0->use_skip_mb_code) {", "if (get_bits1(&VAR_0->gb)) {", "VAR_0->mb_intra = 0;", "for(VAR_4=0;VAR_4<6;VAR_4++)", "VAR_0->block_last_index[VAR_4] = -1;", "VAR_0->mv_dir = MV_DIR_FORWARD;", "VAR_0->mv_type = MV_TYPE_16X16;", "VAR_0->mv[0][0][0] = 0;", "VAR_0->mv[0][0][1] = 0;", "VAR_0->mb_skipped = 1;", "*mb_type_ptr = MB_TYPE_SKIP | MB_TYPE_L0 | MB_TYPE_16x16;", "return 0;", "}", "}", "if(VAR_0->msmpeg4_version==2)\nVAR_3 = get_vlc2(&VAR_0->gb, v2_mb_type_vlc.table, V2_MB_TYPE_VLC_BITS, 1);", "else\nVAR_3 = get_vlc2(&VAR_0->gb, ff_h263_inter_MCBPC_vlc.table, INTER_MCBPC_VLC_BITS, 2);", "if(VAR_3<0 || VAR_3>7){", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"cbpc %d invalid at %d %d\\n\", VAR_3, VAR_0->mb_x, VAR_0->mb_y);", "return -1;", "}", "VAR_0->mb_intra = VAR_3 >>2;", "VAR_2 = VAR_3 & 0x3;", "} else {", "VAR_0->mb_intra = 1;", "if(VAR_0->msmpeg4_version==2)\nVAR_2= get_vlc2(&VAR_0->gb, v2_intra_cbpc_vlc.table, V2_INTRA_CBPC_VLC_BITS, 1);", "else\nVAR_2= get_vlc2(&VAR_0->gb, ff_h263_intra_MCBPC_vlc.table, INTRA_MCBPC_VLC_BITS, 1);", "if(VAR_2<0 || VAR_2>3){", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"cbpc %d invalid at %d %d\\n\", VAR_2, VAR_0->mb_x, VAR_0->mb_y);", "return -1;", "}", "}", "if (!VAR_0->mb_intra) {", "int VAR_5, VAR_6, VAR_7;", "VAR_7= get_vlc2(&VAR_0->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1);", "if(VAR_7<0){", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"VAR_7 %d invalid at %d %d\\n\", VAR_2, VAR_0->mb_x, VAR_0->mb_y);", "return -1;", "}", "VAR_2|= VAR_7<<2;", "if(VAR_0->msmpeg4_version==1 || (VAR_2&3) != 3) VAR_2^= 0x3C;", "ff_h263_pred_motion(VAR_0, 0, 0, &VAR_5, &VAR_6);", "VAR_5= msmpeg4v2_decode_motion(VAR_0, VAR_5, 1);", "VAR_6= msmpeg4v2_decode_motion(VAR_0, VAR_6, 1);", "VAR_0->mv_dir = MV_DIR_FORWARD;", "VAR_0->mv_type = MV_TYPE_16X16;", "VAR_0->mv[0][0][0] = VAR_5;", "VAR_0->mv[0][0][1] = VAR_6;", "*mb_type_ptr = MB_TYPE_L0 | MB_TYPE_16x16;", "} else {", "if(VAR_0->msmpeg4_version==2){", "VAR_0->ac_pred = get_bits1(&VAR_0->gb);", "VAR_2|= get_vlc2(&VAR_0->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1)<<2;", "} else{", "VAR_0->ac_pred = 0;", "VAR_2|= get_vlc2(&VAR_0->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1)<<2;", "if(VAR_0->pict_type==AV_PICTURE_TYPE_P) VAR_2^=0x3C;", "}", "*mb_type_ptr = MB_TYPE_INTRA;", "}", "VAR_0->bdsp.clear_blocks(VAR_0->VAR_1[0]);", "for (VAR_4 = 0; VAR_4 < 6; VAR_4++) {", "if (ff_msmpeg4_decode_block(VAR_0, VAR_1[VAR_4], VAR_4, (VAR_2 >> (5 - VAR_4)) & 1, NULL) < 0)\n{", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"\\nerror while decoding VAR_1: %d x %d (%d)\\n\", VAR_0->mb_x, VAR_0->mb_y, VAR_4);", "return -1;", "}", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45, 47 ], [ 49, 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 67 ], [ 69 ], [ 71 ], [ 73, 75 ], [ 77, 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 93 ], [ 95 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 111 ], [ 113 ], [ 117 ], [ 119 ], [ 121 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 159 ], [ 161 ], [ 163, 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ] ]
18,406
static int decode_tsw1(GetByteContext *gb, uint8_t *frame, int width, int height) { const uint8_t *frame_start = frame; const uint8_t *frame_end = frame + width * height; int mask = 0x10000, bitbuf = 0; int v, count, segments; unsigned offset; segments = bytestream2_get_le32(gb); offset = bytestream2_get_le32(gb); if (segments == 0 && offset == frame_end - frame) return 0; // skip frame if (frame_end - frame <= offset) return AVERROR_INVALIDDATA; frame += offset; while (segments--) { if (bytestream2_get_bytes_left(gb) < 2) return AVERROR_INVALIDDATA; if (mask == 0x10000) { bitbuf = bytestream2_get_le16u(gb); mask = 1; } if (frame_end - frame < 2) return AVERROR_INVALIDDATA; if (bitbuf & mask) { v = bytestream2_get_le16(gb); offset = (v & 0x1FFF) << 1; count = ((v >> 13) + 2) << 1; if (frame - frame_start < offset || frame_end - frame < count) return AVERROR_INVALIDDATA; av_memcpy_backptr(frame, offset, count); frame += count; } else { *frame++ = bytestream2_get_byte(gb); *frame++ = bytestream2_get_byte(gb); } mask <<= 1; } return 0; }
true
FFmpeg
12936a4585bc293c0f88327d6840f49e8e744b62
static int decode_tsw1(GetByteContext *gb, uint8_t *frame, int width, int height) { const uint8_t *frame_start = frame; const uint8_t *frame_end = frame + width * height; int mask = 0x10000, bitbuf = 0; int v, count, segments; unsigned offset; segments = bytestream2_get_le32(gb); offset = bytestream2_get_le32(gb); if (segments == 0 && offset == frame_end - frame) return 0; if (frame_end - frame <= offset) return AVERROR_INVALIDDATA; frame += offset; while (segments--) { if (bytestream2_get_bytes_left(gb) < 2) return AVERROR_INVALIDDATA; if (mask == 0x10000) { bitbuf = bytestream2_get_le16u(gb); mask = 1; } if (frame_end - frame < 2) return AVERROR_INVALIDDATA; if (bitbuf & mask) { v = bytestream2_get_le16(gb); offset = (v & 0x1FFF) << 1; count = ((v >> 13) + 2) << 1; if (frame - frame_start < offset || frame_end - frame < count) return AVERROR_INVALIDDATA; av_memcpy_backptr(frame, offset, count); frame += count; } else { *frame++ = bytestream2_get_byte(gb); *frame++ = bytestream2_get_byte(gb); } mask <<= 1; } return 0; }
{ "code": [ " int v, count, segments;" ], "line_no": [ 11 ] }
static int FUNC_0(GetByteContext *VAR_0, uint8_t *VAR_1, int VAR_2, int VAR_3) { const uint8_t *VAR_4 = VAR_1; const uint8_t *VAR_5 = VAR_1 + VAR_2 * VAR_3; int VAR_6 = 0x10000, VAR_7 = 0; int VAR_8, VAR_9, VAR_10; unsigned VAR_11; VAR_10 = bytestream2_get_le32(VAR_0); VAR_11 = bytestream2_get_le32(VAR_0); if (VAR_10 == 0 && VAR_11 == VAR_5 - VAR_1) return 0; if (VAR_5 - VAR_1 <= VAR_11) return AVERROR_INVALIDDATA; VAR_1 += VAR_11; while (VAR_10--) { if (bytestream2_get_bytes_left(VAR_0) < 2) return AVERROR_INVALIDDATA; if (VAR_6 == 0x10000) { VAR_7 = bytestream2_get_le16u(VAR_0); VAR_6 = 1; } if (VAR_5 - VAR_1 < 2) return AVERROR_INVALIDDATA; if (VAR_7 & VAR_6) { VAR_8 = bytestream2_get_le16(VAR_0); VAR_11 = (VAR_8 & 0x1FFF) << 1; VAR_9 = ((VAR_8 >> 13) + 2) << 1; if (VAR_1 - VAR_4 < VAR_11 || VAR_5 - VAR_1 < VAR_9) return AVERROR_INVALIDDATA; av_memcpy_backptr(VAR_1, VAR_11, VAR_9); VAR_1 += VAR_9; } else { *VAR_1++ = bytestream2_get_byte(VAR_0); *VAR_1++ = bytestream2_get_byte(VAR_0); } VAR_6 <<= 1; } return 0; }
[ "static int FUNC_0(GetByteContext *VAR_0, uint8_t *VAR_1, int VAR_2, int VAR_3)\n{", "const uint8_t *VAR_4 = VAR_1;", "const uint8_t *VAR_5 = VAR_1 + VAR_2 * VAR_3;", "int VAR_6 = 0x10000, VAR_7 = 0;", "int VAR_8, VAR_9, VAR_10;", "unsigned VAR_11;", "VAR_10 = bytestream2_get_le32(VAR_0);", "VAR_11 = bytestream2_get_le32(VAR_0);", "if (VAR_10 == 0 && VAR_11 == VAR_5 - VAR_1)\nreturn 0;", "if (VAR_5 - VAR_1 <= VAR_11)\nreturn AVERROR_INVALIDDATA;", "VAR_1 += VAR_11;", "while (VAR_10--) {", "if (bytestream2_get_bytes_left(VAR_0) < 2)\nreturn AVERROR_INVALIDDATA;", "if (VAR_6 == 0x10000) {", "VAR_7 = bytestream2_get_le16u(VAR_0);", "VAR_6 = 1;", "}", "if (VAR_5 - VAR_1 < 2)\nreturn AVERROR_INVALIDDATA;", "if (VAR_7 & VAR_6) {", "VAR_8 = bytestream2_get_le16(VAR_0);", "VAR_11 = (VAR_8 & 0x1FFF) << 1;", "VAR_9 = ((VAR_8 >> 13) + 2) << 1;", "if (VAR_1 - VAR_4 < VAR_11 || VAR_5 - VAR_1 < VAR_9)\nreturn AVERROR_INVALIDDATA;", "av_memcpy_backptr(VAR_1, VAR_11, VAR_9);", "VAR_1 += VAR_9;", "} else {", "*VAR_1++ = bytestream2_get_byte(VAR_0);", "*VAR_1++ = bytestream2_get_byte(VAR_0);", "}", "VAR_6 <<= 1;", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 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 ], [ 79 ], [ 81 ] ]
18,407
static int qpel_motion_search(MpegEncContext * s, int *mx_ptr, int *my_ptr, int dmin, int src_index, int ref_index, int size, int h) { MotionEstContext * const c= &s->me; const int mx = *mx_ptr; const int my = *my_ptr; const int penalty_factor= c->sub_penalty_factor; const int map_generation= c->map_generation; const int subpel_quality= c->avctx->me_subpel_quality; uint32_t *map= c->map; me_cmp_func cmpf, chroma_cmpf; me_cmp_func cmp_sub, chroma_cmp_sub; LOAD_COMMON int flags= c->sub_flags; cmpf= s->dsp.me_cmp[size]; chroma_cmpf= s->dsp.me_cmp[size+1]; //factorize FIXME //FIXME factorize cmp_sub= s->dsp.me_sub_cmp[size]; chroma_cmp_sub= s->dsp.me_sub_cmp[size+1]; if(c->skip){ //FIXME somehow move up (benchmark) *mx_ptr = 0; *my_ptr = 0; return dmin; } if(c->avctx->me_cmp != c->avctx->me_sub_cmp){ dmin= cmp(s, mx, my, 0, 0, size, h, ref_index, src_index, cmp_sub, chroma_cmp_sub, flags); if(mx || my || size>0) dmin += (mv_penalty[4*mx - pred_x] + mv_penalty[4*my - pred_y])*penalty_factor; } if (mx > xmin && mx < xmax && my > ymin && my < ymax) { int bx=4*mx, by=4*my; int d= dmin; int i, nx, ny; const int index= (my<<ME_MAP_SHIFT) + mx; const int t= score_map[(index-(1<<ME_MAP_SHIFT) )&(ME_MAP_SIZE-1)]; const int l= score_map[(index- 1 )&(ME_MAP_SIZE-1)]; const int r= score_map[(index+ 1 )&(ME_MAP_SIZE-1)]; const int b= score_map[(index+(1<<ME_MAP_SHIFT) )&(ME_MAP_SIZE-1)]; const int c= score_map[(index )&(ME_MAP_SIZE-1)]; int best[8]; int best_pos[8][2]; memset(best, 64, sizeof(int)*8); #if 1 if(s->me.dia_size>=2){ const int tl= score_map[(index-(1<<ME_MAP_SHIFT)-1)&(ME_MAP_SIZE-1)]; const int bl= score_map[(index+(1<<ME_MAP_SHIFT)-1)&(ME_MAP_SIZE-1)]; const int tr= score_map[(index-(1<<ME_MAP_SHIFT)+1)&(ME_MAP_SIZE-1)]; const int br= score_map[(index+(1<<ME_MAP_SHIFT)+1)&(ME_MAP_SIZE-1)]; for(ny= -3; ny <= 3; ny++){ for(nx= -3; nx <= 3; nx++){ const int t2= nx*nx*(tr + tl - 2*t) + 4*nx*(tr-tl) + 32*t; const int c2= nx*nx*( r + l - 2*c) + 4*nx*( r- l) + 32*c; const int b2= nx*nx*(br + bl - 2*b) + 4*nx*(br-bl) + 32*b; int score= ny*ny*(b2 + t2 - 2*c2) + 4*ny*(b2 - t2) + 32*c2; int i; if((nx&3)==0 && (ny&3)==0) continue; score += 1024*(mv_penalty[4*mx + nx - pred_x] + mv_penalty[4*my + ny - pred_y])*penalty_factor; // if(nx&1) score-=1024*c->penalty_factor; // if(ny&1) score-=1024*c->penalty_factor; for(i=0; i<8; i++){ if(score < best[i]){ memmove(&best[i+1], &best[i], sizeof(int)*(7-i)); memmove(&best_pos[i+1][0], &best_pos[i][0], sizeof(int)*2*(7-i)); best[i]= score; best_pos[i][0]= nx + 4*mx; best_pos[i][1]= ny + 4*my; break; } } } } }else{ int tl; const int cx = 4*(r - l); const int cx2= r + l - 2*c; const int cy = 4*(b - t); const int cy2= b + t - 2*c; int cxy; if(map[(index-(1<<ME_MAP_SHIFT)-1)&(ME_MAP_SIZE-1)] == (my<<ME_MAP_MV_BITS) + mx + map_generation && 0){ //FIXME tl= score_map[(index-(1<<ME_MAP_SHIFT)-1)&(ME_MAP_SIZE-1)]; }else{ tl= cmp(s, mx-1, my-1, 0, 0, size, h, ref_index, src_index, cmpf, chroma_cmpf, flags);//FIXME wrong if chroma me is different } cxy= 2*tl + (cx + cy)/4 - (cx2 + cy2) - 2*c; assert(16*cx2 + 4*cx + 32*c == 32*r); assert(16*cx2 - 4*cx + 32*c == 32*l); assert(16*cy2 + 4*cy + 32*c == 32*b); assert(16*cy2 - 4*cy + 32*c == 32*t); assert(16*cxy + 16*cy2 + 16*cx2 - 4*cy - 4*cx + 32*c == 32*tl); for(ny= -3; ny <= 3; ny++){ for(nx= -3; nx <= 3; nx++){ int score= ny*nx*cxy + nx*nx*cx2 + ny*ny*cy2 + nx*cx + ny*cy + 32*c; //FIXME factor int i; if((nx&3)==0 && (ny&3)==0) continue; score += 32*(mv_penalty[4*mx + nx - pred_x] + mv_penalty[4*my + ny - pred_y])*penalty_factor; // if(nx&1) score-=32*c->penalty_factor; // if(ny&1) score-=32*c->penalty_factor; for(i=0; i<8; i++){ if(score < best[i]){ memmove(&best[i+1], &best[i], sizeof(int)*(7-i)); memmove(&best_pos[i+1][0], &best_pos[i][0], sizeof(int)*2*(7-i)); best[i]= score; best_pos[i][0]= nx + 4*mx; best_pos[i][1]= ny + 4*my; break; } } } } } for(i=0; i<subpel_quality; i++){ nx= best_pos[i][0]; ny= best_pos[i][1]; CHECK_QUARTER_MV(nx&3, ny&3, nx>>2, ny>>2) } #if 0 const int tl= score_map[(index-(1<<ME_MAP_SHIFT)-1)&(ME_MAP_SIZE-1)]; const int bl= score_map[(index+(1<<ME_MAP_SHIFT)-1)&(ME_MAP_SIZE-1)]; const int tr= score_map[(index-(1<<ME_MAP_SHIFT)+1)&(ME_MAP_SIZE-1)]; const int br= score_map[(index+(1<<ME_MAP_SHIFT)+1)&(ME_MAP_SIZE-1)]; // if(l < r && l < t && l < b && l < tl && l < bl && l < tr && l < br && bl < tl){ if(tl<br){ // nx= FFMAX(4*mx - bx, bx - 4*mx); // ny= FFMAX(4*my - by, by - 4*my); static int stats[7][7], count; count++; stats[4*mx - bx + 3][4*my - by + 3]++; if(256*256*256*64 % count ==0){ for(i=0; i<49; i++){ if((i%7)==0) printf("\n"); printf("%6d ", stats[0][i]); } printf("\n"); } } #endif #else CHECK_QUARTER_MV(2, 2, mx-1, my-1) CHECK_QUARTER_MV(0, 2, mx , my-1) CHECK_QUARTER_MV(2, 2, mx , my-1) CHECK_QUARTER_MV(2, 0, mx , my ) CHECK_QUARTER_MV(2, 2, mx , my ) CHECK_QUARTER_MV(0, 2, mx , my ) CHECK_QUARTER_MV(2, 2, mx-1, my ) CHECK_QUARTER_MV(2, 0, mx-1, my ) nx= bx; ny= by; for(i=0; i<8; i++){ int ox[8]= {0, 1, 1, 1, 0,-1,-1,-1}; int oy[8]= {1, 1, 0,-1,-1,-1, 0, 1}; CHECK_QUARTER_MV((nx + ox[i])&3, (ny + oy[i])&3, (nx + ox[i])>>2, (ny + oy[i])>>2) } #endif #if 0 //outer ring CHECK_QUARTER_MV(1, 3, mx-1, my-1) CHECK_QUARTER_MV(1, 2, mx-1, my-1) CHECK_QUARTER_MV(1, 1, mx-1, my-1) CHECK_QUARTER_MV(2, 1, mx-1, my-1) CHECK_QUARTER_MV(3, 1, mx-1, my-1) CHECK_QUARTER_MV(0, 1, mx , my-1) CHECK_QUARTER_MV(1, 1, mx , my-1) CHECK_QUARTER_MV(2, 1, mx , my-1) CHECK_QUARTER_MV(3, 1, mx , my-1) CHECK_QUARTER_MV(3, 2, mx , my-1) CHECK_QUARTER_MV(3, 3, mx , my-1) CHECK_QUARTER_MV(3, 0, mx , my ) CHECK_QUARTER_MV(3, 1, mx , my ) CHECK_QUARTER_MV(3, 2, mx , my ) CHECK_QUARTER_MV(3, 3, mx , my ) CHECK_QUARTER_MV(2, 3, mx , my ) CHECK_QUARTER_MV(1, 3, mx , my ) CHECK_QUARTER_MV(0, 3, mx , my ) CHECK_QUARTER_MV(3, 3, mx-1, my ) CHECK_QUARTER_MV(2, 3, mx-1, my ) CHECK_QUARTER_MV(1, 3, mx-1, my ) CHECK_QUARTER_MV(1, 2, mx-1, my ) CHECK_QUARTER_MV(1, 1, mx-1, my ) CHECK_QUARTER_MV(1, 0, mx-1, my ) #endif assert(bx >= xmin*4 && bx <= xmax*4 && by >= ymin*4 && by <= ymax*4); *mx_ptr = bx; *my_ptr = by; }else{ *mx_ptr =4*mx; *my_ptr =4*my; } return dmin; }
true
FFmpeg
0da6315a70396572319e6e8726159b6f4f3ead3f
static int qpel_motion_search(MpegEncContext * s, int *mx_ptr, int *my_ptr, int dmin, int src_index, int ref_index, int size, int h) { MotionEstContext * const c= &s->me; const int mx = *mx_ptr; const int my = *my_ptr; const int penalty_factor= c->sub_penalty_factor; const int map_generation= c->map_generation; const int subpel_quality= c->avctx->me_subpel_quality; uint32_t *map= c->map; me_cmp_func cmpf, chroma_cmpf; me_cmp_func cmp_sub, chroma_cmp_sub; LOAD_COMMON int flags= c->sub_flags; cmpf= s->dsp.me_cmp[size]; chroma_cmpf= s->dsp.me_cmp[size+1]; cmp_sub= s->dsp.me_sub_cmp[size]; chroma_cmp_sub= s->dsp.me_sub_cmp[size+1]; if(c->skip){ *mx_ptr = 0; *my_ptr = 0; return dmin; } if(c->avctx->me_cmp != c->avctx->me_sub_cmp){ dmin= cmp(s, mx, my, 0, 0, size, h, ref_index, src_index, cmp_sub, chroma_cmp_sub, flags); if(mx || my || size>0) dmin += (mv_penalty[4*mx - pred_x] + mv_penalty[4*my - pred_y])*penalty_factor; } if (mx > xmin && mx < xmax && my > ymin && my < ymax) { int bx=4*mx, by=4*my; int d= dmin; int i, nx, ny; const int index= (my<<ME_MAP_SHIFT) + mx; const int t= score_map[(index-(1<<ME_MAP_SHIFT) )&(ME_MAP_SIZE-1)]; const int l= score_map[(index- 1 )&(ME_MAP_SIZE-1)]; const int r= score_map[(index+ 1 )&(ME_MAP_SIZE-1)]; const int b= score_map[(index+(1<<ME_MAP_SHIFT) )&(ME_MAP_SIZE-1)]; const int c= score_map[(index )&(ME_MAP_SIZE-1)]; int best[8]; int best_pos[8][2]; memset(best, 64, sizeof(int)*8); #if 1 if(s->me.dia_size>=2){ const int tl= score_map[(index-(1<<ME_MAP_SHIFT)-1)&(ME_MAP_SIZE-1)]; const int bl= score_map[(index+(1<<ME_MAP_SHIFT)-1)&(ME_MAP_SIZE-1)]; const int tr= score_map[(index-(1<<ME_MAP_SHIFT)+1)&(ME_MAP_SIZE-1)]; const int br= score_map[(index+(1<<ME_MAP_SHIFT)+1)&(ME_MAP_SIZE-1)]; for(ny= -3; ny <= 3; ny++){ for(nx= -3; nx <= 3; nx++){ const int t2= nx*nx*(tr + tl - 2*t) + 4*nx*(tr-tl) + 32*t; const int c2= nx*nx*( r + l - 2*c) + 4*nx*( r- l) + 32*c; const int b2= nx*nx*(br + bl - 2*b) + 4*nx*(br-bl) + 32*b; int score= ny*ny*(b2 + t2 - 2*c2) + 4*ny*(b2 - t2) + 32*c2; int i; if((nx&3)==0 && (ny&3)==0) continue; score += 1024*(mv_penalty[4*mx + nx - pred_x] + mv_penalty[4*my + ny - pred_y])*penalty_factor; for(i=0; i<8; i++){ if(score < best[i]){ memmove(&best[i+1], &best[i], sizeof(int)*(7-i)); memmove(&best_pos[i+1][0], &best_pos[i][0], sizeof(int)*2*(7-i)); best[i]= score; best_pos[i][0]= nx + 4*mx; best_pos[i][1]= ny + 4*my; break; } } } } }else{ int tl; const int cx = 4*(r - l); const int cx2= r + l - 2*c; const int cy = 4*(b - t); const int cy2= b + t - 2*c; int cxy; if(map[(index-(1<<ME_MAP_SHIFT)-1)&(ME_MAP_SIZE-1)] == (my<<ME_MAP_MV_BITS) + mx + map_generation && 0){ tl= score_map[(index-(1<<ME_MAP_SHIFT)-1)&(ME_MAP_SIZE-1)]; }else{ tl= cmp(s, mx-1, my-1, 0, 0, size, h, ref_index, src_index, cmpf, chroma_cmpf, flags); wrong if chroma me is different } cxy= 2*tl + (cx + cy)/4 - (cx2 + cy2) - 2*c; assert(16*cx2 + 4*cx + 32*c == 32*r); assert(16*cx2 - 4*cx + 32*c == 32*l); assert(16*cy2 + 4*cy + 32*c == 32*b); assert(16*cy2 - 4*cy + 32*c == 32*t); assert(16*cxy + 16*cy2 + 16*cx2 - 4*cy - 4*cx + 32*c == 32*tl); for(ny= -3; ny <= 3; ny++){ for(nx= -3; nx <= 3; nx++){ int score= ny*nx*cxy + nx*nx*cx2 + ny*ny*cy2 + nx*cx + ny*cy + 32*c; factor int i; if((nx&3)==0 && (ny&3)==0) continue; score += 32*(mv_penalty[4*mx + nx - pred_x] + mv_penalty[4*my + ny - pred_y])*penalty_factor; for(i=0; i<8; i++){ if(score < best[i]){ memmove(&best[i+1], &best[i], sizeof(int)*(7-i)); memmove(&best_pos[i+1][0], &best_pos[i][0], sizeof(int)*2*(7-i)); best[i]= score; best_pos[i][0]= nx + 4*mx; best_pos[i][1]= ny + 4*my; break; } } } } } for(i=0; i<subpel_quality; i++){ nx= best_pos[i][0]; ny= best_pos[i][1]; CHECK_QUARTER_MV(nx&3, ny&3, nx>>2, ny>>2) } #if 0 const int tl= score_map[(index-(1<<ME_MAP_SHIFT)-1)&(ME_MAP_SIZE-1)]; const int bl= score_map[(index+(1<<ME_MAP_SHIFT)-1)&(ME_MAP_SIZE-1)]; const int tr= score_map[(index-(1<<ME_MAP_SHIFT)+1)&(ME_MAP_SIZE-1)]; const int br= score_map[(index+(1<<ME_MAP_SHIFT)+1)&(ME_MAP_SIZE-1)]; if(tl<br){ static int stats[7][7], count; count++; stats[4*mx - bx + 3][4*my - by + 3]++; if(256*256*256*64 % count ==0){ for(i=0; i<49; i++){ if((i%7)==0) printf("\n"); printf("%6d ", stats[0][i]); } printf("\n"); } } #endif #else CHECK_QUARTER_MV(2, 2, mx-1, my-1) CHECK_QUARTER_MV(0, 2, mx , my-1) CHECK_QUARTER_MV(2, 2, mx , my-1) CHECK_QUARTER_MV(2, 0, mx , my ) CHECK_QUARTER_MV(2, 2, mx , my ) CHECK_QUARTER_MV(0, 2, mx , my ) CHECK_QUARTER_MV(2, 2, mx-1, my ) CHECK_QUARTER_MV(2, 0, mx-1, my ) nx= bx; ny= by; for(i=0; i<8; i++){ int ox[8]= {0, 1, 1, 1, 0,-1,-1,-1}; int oy[8]= {1, 1, 0,-1,-1,-1, 0, 1}; CHECK_QUARTER_MV((nx + ox[i])&3, (ny + oy[i])&3, (nx + ox[i])>>2, (ny + oy[i])>>2) } #endif #if 0 CHECK_QUARTER_MV(1, 3, mx-1, my-1) CHECK_QUARTER_MV(1, 2, mx-1, my-1) CHECK_QUARTER_MV(1, 1, mx-1, my-1) CHECK_QUARTER_MV(2, 1, mx-1, my-1) CHECK_QUARTER_MV(3, 1, mx-1, my-1) CHECK_QUARTER_MV(0, 1, mx , my-1) CHECK_QUARTER_MV(1, 1, mx , my-1) CHECK_QUARTER_MV(2, 1, mx , my-1) CHECK_QUARTER_MV(3, 1, mx , my-1) CHECK_QUARTER_MV(3, 2, mx , my-1) CHECK_QUARTER_MV(3, 3, mx , my-1) CHECK_QUARTER_MV(3, 0, mx , my ) CHECK_QUARTER_MV(3, 1, mx , my ) CHECK_QUARTER_MV(3, 2, mx , my ) CHECK_QUARTER_MV(3, 3, mx , my ) CHECK_QUARTER_MV(2, 3, mx , my ) CHECK_QUARTER_MV(1, 3, mx , my ) CHECK_QUARTER_MV(0, 3, mx , my ) CHECK_QUARTER_MV(3, 3, mx-1, my ) CHECK_QUARTER_MV(2, 3, mx-1, my ) CHECK_QUARTER_MV(1, 3, mx-1, my ) CHECK_QUARTER_MV(1, 2, mx-1, my ) CHECK_QUARTER_MV(1, 1, mx-1, my ) CHECK_QUARTER_MV(1, 0, mx-1, my ) #endif assert(bx >= xmin*4 && bx <= xmax*4 && by >= ymin*4 && by <= ymax*4); *mx_ptr = bx; *my_ptr = by; }else{ *mx_ptr =4*mx; *my_ptr =4*my; } return dmin; }
{ "code": [ " const int t2= nx*nx*(tr + tl - 2*t) + 4*nx*(tr-tl) + 32*t;", " const int c2= nx*nx*( r + l - 2*c) + 4*nx*( r- l) + 32*c;", " const int b2= nx*nx*(br + bl - 2*b) + 4*nx*(br-bl) + 32*b;", " int score= ny*ny*(b2 + t2 - 2*c2) + 4*ny*(b2 - t2) + 32*c2;", " score += 1024*(mv_penalty[4*mx + nx - pred_x] + mv_penalty[4*my + ny - pred_y])*penalty_factor;" ], "line_no": [ 123, 125, 127, 129, 139 ] }
static int FUNC_0(MpegEncContext * VAR_0, int *VAR_1, int *VAR_2, int VAR_3, int VAR_4, int VAR_5, int VAR_6, int VAR_7) { MotionEstContext * const VAR_24= &VAR_0->me; const int VAR_8 = *VAR_1; const int VAR_9 = *VAR_2; const int VAR_10= VAR_24->sub_penalty_factor; const int VAR_11= VAR_24->VAR_11; const int VAR_12= VAR_24->avctx->me_subpel_quality; uint32_t *map= VAR_24->map; me_cmp_func cmpf, chroma_cmpf; me_cmp_func cmp_sub, chroma_cmp_sub; LOAD_COMMON int flags= VAR_24->sub_flags; cmpf= VAR_0->dsp.me_cmp[VAR_6]; chroma_cmpf= VAR_0->dsp.me_cmp[VAR_6+1]; cmp_sub= VAR_0->dsp.me_sub_cmp[VAR_6]; chroma_cmp_sub= VAR_0->dsp.me_sub_cmp[VAR_6+1]; if(VAR_24->skip){ *VAR_1 = 0; *VAR_2 = 0; return VAR_3; } if(VAR_24->avctx->me_cmp != VAR_24->avctx->me_sub_cmp){ VAR_3= cmp(VAR_0, VAR_8, VAR_9, 0, 0, VAR_6, VAR_7, VAR_5, VAR_4, cmp_sub, chroma_cmp_sub, flags); if(VAR_8 || VAR_9 || VAR_6>0) VAR_3 += (mv_penalty[4*VAR_8 - pred_x] + mv_penalty[4*VAR_9 - pred_y])*VAR_10; } if (VAR_8 > xmin && VAR_8 < xmax && VAR_9 > ymin && VAR_9 < ymax) { int VAR_13=4*VAR_8, VAR_14=4*VAR_9; int VAR_15= VAR_3; int VAR_35, VAR_17, VAR_18; const int VAR_19= (VAR_9<<ME_MAP_SHIFT) + VAR_8; const int VAR_20= score_map[(VAR_19-(1<<ME_MAP_SHIFT) )&(ME_MAP_SIZE-1)]; const int VAR_21= score_map[(VAR_19- 1 )&(ME_MAP_SIZE-1)]; const int VAR_22= score_map[(VAR_19+ 1 )&(ME_MAP_SIZE-1)]; const int VAR_23= score_map[(VAR_19+(1<<ME_MAP_SHIFT) )&(ME_MAP_SIZE-1)]; const int VAR_24= score_map[(VAR_19 )&(ME_MAP_SIZE-1)]; int VAR_25[8]; int VAR_26[8][2]; memset(VAR_25, 64, sizeof(int)*8); #if 1 if(VAR_0->me.dia_size>=2){ const int VAR_35= score_map[(VAR_19-(1<<ME_MAP_SHIFT)-1)&(ME_MAP_SIZE-1)]; const int VAR_28= score_map[(VAR_19+(1<<ME_MAP_SHIFT)-1)&(ME_MAP_SIZE-1)]; const int VAR_29= score_map[(VAR_19-(1<<ME_MAP_SHIFT)+1)&(ME_MAP_SIZE-1)]; const int VAR_30= score_map[(VAR_19+(1<<ME_MAP_SHIFT)+1)&(ME_MAP_SIZE-1)]; for(VAR_18= -3; VAR_18 <= 3; VAR_18++){ for(VAR_17= -3; VAR_17 <= 3; VAR_17++){ const int VAR_31= VAR_17*VAR_17*(VAR_29 + VAR_35 - 2*VAR_20) + 4*VAR_17*(VAR_29-VAR_35) + 32*VAR_20; const int VAR_32= VAR_17*VAR_17*( VAR_22 + VAR_21 - 2*VAR_24) + 4*VAR_17*( VAR_22- VAR_21) + 32*VAR_24; const int VAR_33= VAR_17*VAR_17*(VAR_30 + VAR_28 - 2*VAR_23) + 4*VAR_17*(VAR_30-VAR_28) + 32*VAR_23; int VAR_40= VAR_18*VAR_18*(VAR_33 + VAR_31 - 2*VAR_32) + 4*VAR_18*(VAR_33 - VAR_31) + 32*VAR_32; int VAR_35; if((VAR_17&3)==0 && (VAR_18&3)==0) continue; VAR_40 += 1024*(mv_penalty[4*VAR_8 + VAR_17 - pred_x] + mv_penalty[4*VAR_9 + VAR_18 - pred_y])*VAR_10; for(VAR_35=0; VAR_35<8; VAR_35++){ if(VAR_40 < VAR_25[VAR_35]){ memmove(&VAR_25[VAR_35+1], &VAR_25[VAR_35], sizeof(int)*(7-VAR_35)); memmove(&VAR_26[VAR_35+1][0], &VAR_26[VAR_35][0], sizeof(int)*2*(7-VAR_35)); VAR_25[VAR_35]= VAR_40; VAR_26[VAR_35][0]= VAR_17 + 4*VAR_8; VAR_26[VAR_35][1]= VAR_18 + 4*VAR_9; break; } } } } }else{ int VAR_35; const int VAR_35 = 4*(VAR_22 - VAR_21); const int VAR_36= VAR_22 + VAR_21 - 2*VAR_24; const int VAR_37 = 4*(VAR_23 - VAR_20); const int VAR_38= VAR_23 + VAR_20 - 2*VAR_24; int VAR_39; if(map[(VAR_19-(1<<ME_MAP_SHIFT)-1)&(ME_MAP_SIZE-1)] == (VAR_9<<ME_MAP_MV_BITS) + VAR_8 + VAR_11 && 0){ VAR_35= score_map[(VAR_19-(1<<ME_MAP_SHIFT)-1)&(ME_MAP_SIZE-1)]; }else{ VAR_35= cmp(VAR_0, VAR_8-1, VAR_9-1, 0, 0, VAR_6, VAR_7, VAR_5, VAR_4, cmpf, chroma_cmpf, flags); wrong if chroma me is different } VAR_39= 2*VAR_35 + (VAR_35 + VAR_37)/4 - (VAR_36 + VAR_38) - 2*VAR_24; assert(16*VAR_36 + 4*VAR_35 + 32*VAR_24 == 32*VAR_22); assert(16*VAR_36 - 4*VAR_35 + 32*VAR_24 == 32*VAR_21); assert(16*VAR_38 + 4*VAR_37 + 32*VAR_24 == 32*VAR_23); assert(16*VAR_38 - 4*VAR_37 + 32*VAR_24 == 32*VAR_20); assert(16*VAR_39 + 16*VAR_38 + 16*VAR_36 - 4*VAR_37 - 4*VAR_35 + 32*VAR_24 == 32*VAR_35); for(VAR_18= -3; VAR_18 <= 3; VAR_18++){ for(VAR_17= -3; VAR_17 <= 3; VAR_17++){ int VAR_40= VAR_18*VAR_17*VAR_39 + VAR_17*VAR_17*VAR_36 + VAR_18*VAR_18*VAR_38 + VAR_17*VAR_35 + VAR_18*VAR_37 + 32*VAR_24; factor int VAR_35; if((VAR_17&3)==0 && (VAR_18&3)==0) continue; VAR_40 += 32*(mv_penalty[4*VAR_8 + VAR_17 - pred_x] + mv_penalty[4*VAR_9 + VAR_18 - pred_y])*VAR_10; for(VAR_35=0; VAR_35<8; VAR_35++){ if(VAR_40 < VAR_25[VAR_35]){ memmove(&VAR_25[VAR_35+1], &VAR_25[VAR_35], sizeof(int)*(7-VAR_35)); memmove(&VAR_26[VAR_35+1][0], &VAR_26[VAR_35][0], sizeof(int)*2*(7-VAR_35)); VAR_25[VAR_35]= VAR_40; VAR_26[VAR_35][0]= VAR_17 + 4*VAR_8; VAR_26[VAR_35][1]= VAR_18 + 4*VAR_9; break; } } } } } for(VAR_35=0; VAR_35<VAR_12; VAR_35++){ VAR_17= VAR_26[VAR_35][0]; VAR_18= VAR_26[VAR_35][1]; CHECK_QUARTER_MV(VAR_17&3, VAR_18&3, VAR_17>>2, VAR_18>>2) } #if 0 const int VAR_35= score_map[(VAR_19-(1<<ME_MAP_SHIFT)-1)&(ME_MAP_SIZE-1)]; const int VAR_28= score_map[(VAR_19+(1<<ME_MAP_SHIFT)-1)&(ME_MAP_SIZE-1)]; const int VAR_29= score_map[(VAR_19-(1<<ME_MAP_SHIFT)+1)&(ME_MAP_SIZE-1)]; const int VAR_30= score_map[(VAR_19+(1<<ME_MAP_SHIFT)+1)&(ME_MAP_SIZE-1)]; if(VAR_35<VAR_30){ static int stats[7][7], count; count++; stats[4*VAR_8 - VAR_13 + 3][4*VAR_9 - VAR_14 + 3]++; if(256*256*256*64 % count ==0){ for(VAR_35=0; VAR_35<49; VAR_35++){ if((VAR_35%7)==0) printf("\n"); printf("%6d ", stats[0][VAR_35]); } printf("\n"); } } #endif #else CHECK_QUARTER_MV(2, 2, VAR_8-1, VAR_9-1) CHECK_QUARTER_MV(0, 2, VAR_8 , VAR_9-1) CHECK_QUARTER_MV(2, 2, VAR_8 , VAR_9-1) CHECK_QUARTER_MV(2, 0, VAR_8 , VAR_9 ) CHECK_QUARTER_MV(2, 2, VAR_8 , VAR_9 ) CHECK_QUARTER_MV(0, 2, VAR_8 , VAR_9 ) CHECK_QUARTER_MV(2, 2, VAR_8-1, VAR_9 ) CHECK_QUARTER_MV(2, 0, VAR_8-1, VAR_9 ) VAR_17= VAR_13; VAR_18= VAR_14; for(VAR_35=0; VAR_35<8; VAR_35++){ int ox[8]= {0, 1, 1, 1, 0,-1,-1,-1}; int oy[8]= {1, 1, 0,-1,-1,-1, 0, 1}; CHECK_QUARTER_MV((VAR_17 + ox[VAR_35])&3, (VAR_18 + oy[VAR_35])&3, (VAR_17 + ox[VAR_35])>>2, (VAR_18 + oy[VAR_35])>>2) } #endif #if 0 CHECK_QUARTER_MV(1, 3, VAR_8-1, VAR_9-1) CHECK_QUARTER_MV(1, 2, VAR_8-1, VAR_9-1) CHECK_QUARTER_MV(1, 1, VAR_8-1, VAR_9-1) CHECK_QUARTER_MV(2, 1, VAR_8-1, VAR_9-1) CHECK_QUARTER_MV(3, 1, VAR_8-1, VAR_9-1) CHECK_QUARTER_MV(0, 1, VAR_8 , VAR_9-1) CHECK_QUARTER_MV(1, 1, VAR_8 , VAR_9-1) CHECK_QUARTER_MV(2, 1, VAR_8 , VAR_9-1) CHECK_QUARTER_MV(3, 1, VAR_8 , VAR_9-1) CHECK_QUARTER_MV(3, 2, VAR_8 , VAR_9-1) CHECK_QUARTER_MV(3, 3, VAR_8 , VAR_9-1) CHECK_QUARTER_MV(3, 0, VAR_8 , VAR_9 ) CHECK_QUARTER_MV(3, 1, VAR_8 , VAR_9 ) CHECK_QUARTER_MV(3, 2, VAR_8 , VAR_9 ) CHECK_QUARTER_MV(3, 3, VAR_8 , VAR_9 ) CHECK_QUARTER_MV(2, 3, VAR_8 , VAR_9 ) CHECK_QUARTER_MV(1, 3, VAR_8 , VAR_9 ) CHECK_QUARTER_MV(0, 3, VAR_8 , VAR_9 ) CHECK_QUARTER_MV(3, 3, VAR_8-1, VAR_9 ) CHECK_QUARTER_MV(2, 3, VAR_8-1, VAR_9 ) CHECK_QUARTER_MV(1, 3, VAR_8-1, VAR_9 ) CHECK_QUARTER_MV(1, 2, VAR_8-1, VAR_9 ) CHECK_QUARTER_MV(1, 1, VAR_8-1, VAR_9 ) CHECK_QUARTER_MV(1, 0, VAR_8-1, VAR_9 ) #endif assert(VAR_13 >= xmin*4 && VAR_13 <= xmax*4 && VAR_14 >= ymin*4 && VAR_14 <= ymax*4); *VAR_1 = VAR_13; *VAR_2 = VAR_14; }else{ *VAR_1 =4*VAR_8; *VAR_2 =4*VAR_9; } return VAR_3; }
[ "static int FUNC_0(MpegEncContext * VAR_0,\nint *VAR_1, int *VAR_2, int VAR_3,\nint VAR_4, int VAR_5,\nint VAR_6, int VAR_7)\n{", "MotionEstContext * const VAR_24= &VAR_0->me;", "const int VAR_8 = *VAR_1;", "const int VAR_9 = *VAR_2;", "const int VAR_10= VAR_24->sub_penalty_factor;", "const int VAR_11= VAR_24->VAR_11;", "const int VAR_12= VAR_24->avctx->me_subpel_quality;", "uint32_t *map= VAR_24->map;", "me_cmp_func cmpf, chroma_cmpf;", "me_cmp_func cmp_sub, chroma_cmp_sub;", "LOAD_COMMON\nint flags= VAR_24->sub_flags;", "cmpf= VAR_0->dsp.me_cmp[VAR_6];", "chroma_cmpf= VAR_0->dsp.me_cmp[VAR_6+1];", "cmp_sub= VAR_0->dsp.me_sub_cmp[VAR_6];", "chroma_cmp_sub= VAR_0->dsp.me_sub_cmp[VAR_6+1];", "if(VAR_24->skip){", "*VAR_1 = 0;", "*VAR_2 = 0;", "return VAR_3;", "}", "if(VAR_24->avctx->me_cmp != VAR_24->avctx->me_sub_cmp){", "VAR_3= cmp(VAR_0, VAR_8, VAR_9, 0, 0, VAR_6, VAR_7, VAR_5, VAR_4, cmp_sub, chroma_cmp_sub, flags);", "if(VAR_8 || VAR_9 || VAR_6>0)\nVAR_3 += (mv_penalty[4*VAR_8 - pred_x] + mv_penalty[4*VAR_9 - pred_y])*VAR_10;", "}", "if (VAR_8 > xmin && VAR_8 < xmax &&\nVAR_9 > ymin && VAR_9 < ymax) {", "int VAR_13=4*VAR_8, VAR_14=4*VAR_9;", "int VAR_15= VAR_3;", "int VAR_35, VAR_17, VAR_18;", "const int VAR_19= (VAR_9<<ME_MAP_SHIFT) + VAR_8;", "const int VAR_20= score_map[(VAR_19-(1<<ME_MAP_SHIFT) )&(ME_MAP_SIZE-1)];", "const int VAR_21= score_map[(VAR_19- 1 )&(ME_MAP_SIZE-1)];", "const int VAR_22= score_map[(VAR_19+ 1 )&(ME_MAP_SIZE-1)];", "const int VAR_23= score_map[(VAR_19+(1<<ME_MAP_SHIFT) )&(ME_MAP_SIZE-1)];", "const int VAR_24= score_map[(VAR_19 )&(ME_MAP_SIZE-1)];", "int VAR_25[8];", "int VAR_26[8][2];", "memset(VAR_25, 64, sizeof(int)*8);", "#if 1\nif(VAR_0->me.dia_size>=2){", "const int VAR_35= score_map[(VAR_19-(1<<ME_MAP_SHIFT)-1)&(ME_MAP_SIZE-1)];", "const int VAR_28= score_map[(VAR_19+(1<<ME_MAP_SHIFT)-1)&(ME_MAP_SIZE-1)];", "const int VAR_29= score_map[(VAR_19-(1<<ME_MAP_SHIFT)+1)&(ME_MAP_SIZE-1)];", "const int VAR_30= score_map[(VAR_19+(1<<ME_MAP_SHIFT)+1)&(ME_MAP_SIZE-1)];", "for(VAR_18= -3; VAR_18 <= 3; VAR_18++){", "for(VAR_17= -3; VAR_17 <= 3; VAR_17++){", "const int VAR_31= VAR_17*VAR_17*(VAR_29 + VAR_35 - 2*VAR_20) + 4*VAR_17*(VAR_29-VAR_35) + 32*VAR_20;", "const int VAR_32= VAR_17*VAR_17*( VAR_22 + VAR_21 - 2*VAR_24) + 4*VAR_17*( VAR_22- VAR_21) + 32*VAR_24;", "const int VAR_33= VAR_17*VAR_17*(VAR_30 + VAR_28 - 2*VAR_23) + 4*VAR_17*(VAR_30-VAR_28) + 32*VAR_23;", "int VAR_40= VAR_18*VAR_18*(VAR_33 + VAR_31 - 2*VAR_32) + 4*VAR_18*(VAR_33 - VAR_31) + 32*VAR_32;", "int VAR_35;", "if((VAR_17&3)==0 && (VAR_18&3)==0) continue;", "VAR_40 += 1024*(mv_penalty[4*VAR_8 + VAR_17 - pred_x] + mv_penalty[4*VAR_9 + VAR_18 - pred_y])*VAR_10;", "for(VAR_35=0; VAR_35<8; VAR_35++){", "if(VAR_40 < VAR_25[VAR_35]){", "memmove(&VAR_25[VAR_35+1], &VAR_25[VAR_35], sizeof(int)*(7-VAR_35));", "memmove(&VAR_26[VAR_35+1][0], &VAR_26[VAR_35][0], sizeof(int)*2*(7-VAR_35));", "VAR_25[VAR_35]= VAR_40;", "VAR_26[VAR_35][0]= VAR_17 + 4*VAR_8;", "VAR_26[VAR_35][1]= VAR_18 + 4*VAR_9;", "break;", "}", "}", "}", "}", "}else{", "int VAR_35;", "const int VAR_35 = 4*(VAR_22 - VAR_21);", "const int VAR_36= VAR_22 + VAR_21 - 2*VAR_24;", "const int VAR_37 = 4*(VAR_23 - VAR_20);", "const int VAR_38= VAR_23 + VAR_20 - 2*VAR_24;", "int VAR_39;", "if(map[(VAR_19-(1<<ME_MAP_SHIFT)-1)&(ME_MAP_SIZE-1)] == (VAR_9<<ME_MAP_MV_BITS) + VAR_8 + VAR_11 && 0){", "VAR_35= score_map[(VAR_19-(1<<ME_MAP_SHIFT)-1)&(ME_MAP_SIZE-1)];", "}else{", "VAR_35= cmp(VAR_0, VAR_8-1, VAR_9-1, 0, 0, VAR_6, VAR_7, VAR_5, VAR_4, cmpf, chroma_cmpf, flags); wrong if chroma me is different", "}", "VAR_39= 2*VAR_35 + (VAR_35 + VAR_37)/4 - (VAR_36 + VAR_38) - 2*VAR_24;", "assert(16*VAR_36 + 4*VAR_35 + 32*VAR_24 == 32*VAR_22);", "assert(16*VAR_36 - 4*VAR_35 + 32*VAR_24 == 32*VAR_21);", "assert(16*VAR_38 + 4*VAR_37 + 32*VAR_24 == 32*VAR_23);", "assert(16*VAR_38 - 4*VAR_37 + 32*VAR_24 == 32*VAR_20);", "assert(16*VAR_39 + 16*VAR_38 + 16*VAR_36 - 4*VAR_37 - 4*VAR_35 + 32*VAR_24 == 32*VAR_35);", "for(VAR_18= -3; VAR_18 <= 3; VAR_18++){", "for(VAR_17= -3; VAR_17 <= 3; VAR_17++){", "int VAR_40= VAR_18*VAR_17*VAR_39 + VAR_17*VAR_17*VAR_36 + VAR_18*VAR_18*VAR_38 + VAR_17*VAR_35 + VAR_18*VAR_37 + 32*VAR_24; factor", "int VAR_35;", "if((VAR_17&3)==0 && (VAR_18&3)==0) continue;", "VAR_40 += 32*(mv_penalty[4*VAR_8 + VAR_17 - pred_x] + mv_penalty[4*VAR_9 + VAR_18 - pred_y])*VAR_10;", "for(VAR_35=0; VAR_35<8; VAR_35++){", "if(VAR_40 < VAR_25[VAR_35]){", "memmove(&VAR_25[VAR_35+1], &VAR_25[VAR_35], sizeof(int)*(7-VAR_35));", "memmove(&VAR_26[VAR_35+1][0], &VAR_26[VAR_35][0], sizeof(int)*2*(7-VAR_35));", "VAR_25[VAR_35]= VAR_40;", "VAR_26[VAR_35][0]= VAR_17 + 4*VAR_8;", "VAR_26[VAR_35][1]= VAR_18 + 4*VAR_9;", "break;", "}", "}", "}", "}", "}", "for(VAR_35=0; VAR_35<VAR_12; VAR_35++){", "VAR_17= VAR_26[VAR_35][0];", "VAR_18= VAR_26[VAR_35][1];", "CHECK_QUARTER_MV(VAR_17&3, VAR_18&3, VAR_17>>2, VAR_18>>2)\n}", "#if 0\nconst int VAR_35= score_map[(VAR_19-(1<<ME_MAP_SHIFT)-1)&(ME_MAP_SIZE-1)];", "const int VAR_28= score_map[(VAR_19+(1<<ME_MAP_SHIFT)-1)&(ME_MAP_SIZE-1)];", "const int VAR_29= score_map[(VAR_19-(1<<ME_MAP_SHIFT)+1)&(ME_MAP_SIZE-1)];", "const int VAR_30= score_map[(VAR_19+(1<<ME_MAP_SHIFT)+1)&(ME_MAP_SIZE-1)];", "if(VAR_35<VAR_30){", "static int stats[7][7], count;", "count++;", "stats[4*VAR_8 - VAR_13 + 3][4*VAR_9 - VAR_14 + 3]++;", "if(256*256*256*64 % count ==0){", "for(VAR_35=0; VAR_35<49; VAR_35++){", "if((VAR_35%7)==0) printf(\"\\n\");", "printf(\"%6d \", stats[0][VAR_35]);", "}", "printf(\"\\n\");", "}", "}", "#endif\n#else\nCHECK_QUARTER_MV(2, 2, VAR_8-1, VAR_9-1)\nCHECK_QUARTER_MV(0, 2, VAR_8 , VAR_9-1)\nCHECK_QUARTER_MV(2, 2, VAR_8 , VAR_9-1)\nCHECK_QUARTER_MV(2, 0, VAR_8 , VAR_9 )\nCHECK_QUARTER_MV(2, 2, VAR_8 , VAR_9 )\nCHECK_QUARTER_MV(0, 2, VAR_8 , VAR_9 )\nCHECK_QUARTER_MV(2, 2, VAR_8-1, VAR_9 )\nCHECK_QUARTER_MV(2, 0, VAR_8-1, VAR_9 )\nVAR_17= VAR_13;", "VAR_18= VAR_14;", "for(VAR_35=0; VAR_35<8; VAR_35++){", "int ox[8]= {0, 1, 1, 1, 0,-1,-1,-1};", "int oy[8]= {1, 1, 0,-1,-1,-1, 0, 1};", "CHECK_QUARTER_MV((VAR_17 + ox[VAR_35])&3, (VAR_18 + oy[VAR_35])&3, (VAR_17 + ox[VAR_35])>>2, (VAR_18 + oy[VAR_35])>>2)\n}", "#endif\n#if 0\nCHECK_QUARTER_MV(1, 3, VAR_8-1, VAR_9-1)\nCHECK_QUARTER_MV(1, 2, VAR_8-1, VAR_9-1)\nCHECK_QUARTER_MV(1, 1, VAR_8-1, VAR_9-1)\nCHECK_QUARTER_MV(2, 1, VAR_8-1, VAR_9-1)\nCHECK_QUARTER_MV(3, 1, VAR_8-1, VAR_9-1)\nCHECK_QUARTER_MV(0, 1, VAR_8 , VAR_9-1)\nCHECK_QUARTER_MV(1, 1, VAR_8 , VAR_9-1)\nCHECK_QUARTER_MV(2, 1, VAR_8 , VAR_9-1)\nCHECK_QUARTER_MV(3, 1, VAR_8 , VAR_9-1)\nCHECK_QUARTER_MV(3, 2, VAR_8 , VAR_9-1)\nCHECK_QUARTER_MV(3, 3, VAR_8 , VAR_9-1)\nCHECK_QUARTER_MV(3, 0, VAR_8 , VAR_9 )\nCHECK_QUARTER_MV(3, 1, VAR_8 , VAR_9 )\nCHECK_QUARTER_MV(3, 2, VAR_8 , VAR_9 )\nCHECK_QUARTER_MV(3, 3, VAR_8 , VAR_9 )\nCHECK_QUARTER_MV(2, 3, VAR_8 , VAR_9 )\nCHECK_QUARTER_MV(1, 3, VAR_8 , VAR_9 )\nCHECK_QUARTER_MV(0, 3, VAR_8 , VAR_9 )\nCHECK_QUARTER_MV(3, 3, VAR_8-1, VAR_9 )\nCHECK_QUARTER_MV(2, 3, VAR_8-1, VAR_9 )\nCHECK_QUARTER_MV(1, 3, VAR_8-1, VAR_9 )\nCHECK_QUARTER_MV(1, 2, VAR_8-1, VAR_9 )\nCHECK_QUARTER_MV(1, 1, VAR_8-1, VAR_9 )\nCHECK_QUARTER_MV(1, 0, VAR_8-1, VAR_9 )\n#endif\nassert(VAR_13 >= xmin*4 && VAR_13 <= xmax*4 && VAR_14 >= ymin*4 && VAR_14 <= ymax*4);", "*VAR_1 = VAR_13;", "*VAR_2 = VAR_14;", "}else{", "*VAR_1 =4*VAR_8;", "*VAR_2 =4*VAR_9;", "}", "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, 1, 1, 1, 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 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31, 33 ], [ 37 ], [ 39 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67, 69 ], [ 71 ], [ 75, 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 103 ], [ 105, 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 135 ], [ 139 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 201 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 227 ], [ 231 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271, 273 ], [ 277, 279 ], [ 281 ], [ 283 ], [ 285 ], [ 289 ], [ 299 ], [ 301 ], [ 303 ], [ 305 ], [ 307 ], [ 309 ], [ 311 ], [ 313 ], [ 315 ], [ 317 ], [ 319 ], [ 321, 323, 327, 329, 331, 333, 335, 337, 339, 341, 345 ], [ 347 ], [ 351 ], [ 353 ], [ 355 ], [ 357, 359 ], [ 361, 363, 367, 369, 371, 373, 375, 377, 379, 381, 383, 385, 387, 389, 391, 393, 395, 397, 399, 401, 403, 405, 407, 409, 411, 413, 415, 417 ], [ 421 ], [ 423 ], [ 425 ], [ 427 ], [ 429 ], [ 431 ], [ 435 ], [ 437 ] ]
18,408
void migrate_fd_error(MigrationState *s) { trace_migrate_fd_error(); assert(s->to_dst_file == NULL); migrate_set_state(&s->state, MIGRATION_STATUS_SETUP, MIGRATION_STATUS_FAILED); notifier_list_notify(&migration_state_notifiers, s); }
true
qemu
d59ce6f34434bf47a9b26138c908650bf9a24be1
void migrate_fd_error(MigrationState *s) { trace_migrate_fd_error(); assert(s->to_dst_file == NULL); migrate_set_state(&s->state, MIGRATION_STATUS_SETUP, MIGRATION_STATUS_FAILED); notifier_list_notify(&migration_state_notifiers, s); }
{ "code": [ "void migrate_fd_error(MigrationState *s)", " trace_migrate_fd_error();" ], "line_no": [ 1, 5 ] }
void FUNC_0(MigrationState *VAR_0) { trace_migrate_fd_error(); assert(VAR_0->to_dst_file == NULL); migrate_set_state(&VAR_0->state, MIGRATION_STATUS_SETUP, MIGRATION_STATUS_FAILED); notifier_list_notify(&migration_state_notifiers, VAR_0); }
[ "void FUNC_0(MigrationState *VAR_0)\n{", "trace_migrate_fd_error();", "assert(VAR_0->to_dst_file == NULL);", "migrate_set_state(&VAR_0->state, MIGRATION_STATUS_SETUP,\nMIGRATION_STATUS_FAILED);", "notifier_list_notify(&migration_state_notifiers, VAR_0);", "}" ]
[ 1, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9, 11 ], [ 13 ], [ 15 ] ]
18,410
static uint32_t rtl8139_TxStatus_read(RTL8139State *s, uint8_t addr, int size) { uint32_t reg = (addr - TxStatus0) / 4; uint32_t offset = addr & 0x3; uint32_t ret = 0; if (addr & (size - 1)) { DPRINTF("not implemented read for TxStatus addr=0x%x size=0x%x\n", addr, size); return ret; } switch (size) { case 1: /* fall through */ case 2: /* fall through */ case 4: ret = (s->TxStatus[reg] >> offset * 8) & ((1 << (size * 8)) - 1); DPRINTF("TxStatus[%d] read addr=0x%x size=0x%x val=0x%08x\n", reg, addr, size, ret); break; default: DPRINTF("unsupported size 0x%x of TxStatus reading\n", size); break; } return ret; }
true
qemu
3e48dd4a2d48aabafe22ce3611d65544d0234a69
static uint32_t rtl8139_TxStatus_read(RTL8139State *s, uint8_t addr, int size) { uint32_t reg = (addr - TxStatus0) / 4; uint32_t offset = addr & 0x3; uint32_t ret = 0; if (addr & (size - 1)) { DPRINTF("not implemented read for TxStatus addr=0x%x size=0x%x\n", addr, size); return ret; } switch (size) { case 1: case 2: case 4: ret = (s->TxStatus[reg] >> offset * 8) & ((1 << (size * 8)) - 1); DPRINTF("TxStatus[%d] read addr=0x%x size=0x%x val=0x%08x\n", reg, addr, size, ret); break; default: DPRINTF("unsupported size 0x%x of TxStatus reading\n", size); break; } return ret; }
{ "code": [ "static uint32_t rtl8139_TxStatus_read(RTL8139State *s, uint8_t addr, int size)", " uint32_t reg = (addr - TxStatus0) / 4;", " DPRINTF(\"not implemented read for TxStatus addr=0x%x size=0x%x\\n\", addr,", " size);", " ret = (s->TxStatus[reg] >> offset * 8) & ((1 << (size * 8)) - 1);", " DPRINTF(\"TxStatus[%d] read addr=0x%x size=0x%x val=0x%08x\\n\", reg, addr,", " size, ret);", " DPRINTF(\"unsupported size 0x%x of TxStatus reading\\n\", size);" ], "line_no": [ 1, 5, 15, 17, 33, 35, 37, 43 ] }
static uint32_t FUNC_0(RTL8139State *s, uint8_t addr, int size) { uint32_t reg = (addr - TxStatus0) / 4; uint32_t offset = addr & 0x3; uint32_t ret = 0; if (addr & (size - 1)) { DPRINTF("not implemented read for TxStatus addr=0x%x size=0x%x\n", addr, size); return ret; } switch (size) { case 1: case 2: case 4: ret = (s->TxStatus[reg] >> offset * 8) & ((1 << (size * 8)) - 1); DPRINTF("TxStatus[%d] read addr=0x%x size=0x%x val=0x%08x\n", reg, addr, size, ret); break; default: DPRINTF("unsupported size 0x%x of TxStatus reading\n", size); break; } return ret; }
[ "static uint32_t FUNC_0(RTL8139State *s, uint8_t addr, int size)\n{", "uint32_t reg = (addr - TxStatus0) / 4;", "uint32_t offset = addr & 0x3;", "uint32_t ret = 0;", "if (addr & (size - 1)) {", "DPRINTF(\"not implemented read for TxStatus addr=0x%x size=0x%x\\n\", addr,\nsize);", "return ret;", "}", "switch (size) {", "case 1:\ncase 2:\ncase 4:\nret = (s->TxStatus[reg] >> offset * 8) & ((1 << (size * 8)) - 1);", "DPRINTF(\"TxStatus[%d] read addr=0x%x size=0x%x val=0x%08x\\n\", reg, addr,\nsize, ret);", "break;", "default:\nDPRINTF(\"unsupported size 0x%x of TxStatus reading\\n\", size);", "break;", "}", "return ret;", "}" ]
[ 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15, 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27, 29, 31, 33 ], [ 35, 37 ], [ 39 ], [ 41, 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ] ]
18,414
static int decode_gop_header(IVI45DecContext *ctx, AVCodecContext *avctx) { int result, i, p, tile_size, pic_size_indx, mb_size, blk_size, is_scalable; int quant_mat, blk_size_changed = 0; IVIBandDesc *band, *band1, *band2; IVIPicConfig pic_conf; ctx->gop_flags = get_bits(&ctx->gb, 8); ctx->gop_hdr_size = (ctx->gop_flags & 1) ? get_bits(&ctx->gb, 16) : 0; if (ctx->gop_flags & IVI5_IS_PROTECTED) ctx->lock_word = get_bits_long(&ctx->gb, 32); tile_size = (ctx->gop_flags & 0x40) ? 64 << get_bits(&ctx->gb, 2) : 0; if (tile_size > 256) { av_log(avctx, AV_LOG_ERROR, "Invalid tile size: %d\n", tile_size); return AVERROR_INVALIDDATA; } /* decode number of wavelet bands */ /* num_levels * 3 + 1 */ pic_conf.luma_bands = get_bits(&ctx->gb, 2) * 3 + 1; pic_conf.chroma_bands = get_bits1(&ctx->gb) * 3 + 1; is_scalable = pic_conf.luma_bands != 1 || pic_conf.chroma_bands != 1; if (is_scalable && (pic_conf.luma_bands != 4 || pic_conf.chroma_bands != 1)) { av_log(avctx, AV_LOG_ERROR, "Scalability: unsupported subdivision! Luma bands: %d, chroma bands: %d\n", pic_conf.luma_bands, pic_conf.chroma_bands); return AVERROR_INVALIDDATA; } pic_size_indx = get_bits(&ctx->gb, 4); if (pic_size_indx == IVI5_PIC_SIZE_ESC) { pic_conf.pic_height = get_bits(&ctx->gb, 13); pic_conf.pic_width = get_bits(&ctx->gb, 13); } else { pic_conf.pic_height = ivi5_common_pic_sizes[pic_size_indx * 2 + 1] << 2; pic_conf.pic_width = ivi5_common_pic_sizes[pic_size_indx * 2 ] << 2; } if (ctx->gop_flags & 2) { avpriv_report_missing_feature(avctx, "YV12 picture format"); return AVERROR_PATCHWELCOME; } pic_conf.chroma_height = (pic_conf.pic_height + 3) >> 2; pic_conf.chroma_width = (pic_conf.pic_width + 3) >> 2; if (!tile_size) { pic_conf.tile_height = pic_conf.pic_height; pic_conf.tile_width = pic_conf.pic_width; } else { pic_conf.tile_height = pic_conf.tile_width = tile_size; } /* check if picture layout was changed and reallocate buffers */ if (ivi_pic_config_cmp(&pic_conf, &ctx->pic_conf) || ctx->gop_invalid) { result = ff_ivi_init_planes(ctx->planes, &pic_conf, 0); if (result < 0) { av_log(avctx, AV_LOG_ERROR, "Couldn't reallocate color planes!\n"); return result; } ctx->pic_conf = pic_conf; ctx->is_scalable = is_scalable; blk_size_changed = 1; /* force reallocation of the internal structures */ } for (p = 0; p <= 1; p++) { for (i = 0; i < (!p ? pic_conf.luma_bands : pic_conf.chroma_bands); i++) { band = &ctx->planes[p].bands[i]; band->is_halfpel = get_bits1(&ctx->gb); mb_size = get_bits1(&ctx->gb); blk_size = 8 >> get_bits1(&ctx->gb); mb_size = blk_size << !mb_size; if (p==0 && blk_size==4) { av_log(avctx, AV_LOG_ERROR, "4x4 luma blocks are unsupported!\n"); return AVERROR_PATCHWELCOME; } blk_size_changed = mb_size != band->mb_size || blk_size != band->blk_size; if (blk_size_changed) { band->mb_size = mb_size; band->blk_size = blk_size; } if (get_bits1(&ctx->gb)) { avpriv_report_missing_feature(avctx, "Extended transform info"); return AVERROR_PATCHWELCOME; } /* select transform function and scan pattern according to plane and band number */ switch ((p << 2) + i) { case 0: band->inv_transform = ff_ivi_inverse_slant_8x8; band->dc_transform = ff_ivi_dc_slant_2d; band->scan = ff_zigzag_direct; band->transform_size = 8; break; case 1: band->inv_transform = ff_ivi_row_slant8; band->dc_transform = ff_ivi_dc_row_slant; band->scan = ff_ivi_vertical_scan_8x8; band->transform_size = 8; break; case 2: band->inv_transform = ff_ivi_col_slant8; band->dc_transform = ff_ivi_dc_col_slant; band->scan = ff_ivi_horizontal_scan_8x8; band->transform_size = 8; break; case 3: band->inv_transform = ff_ivi_put_pixels_8x8; band->dc_transform = ff_ivi_put_dc_pixel_8x8; band->scan = ff_ivi_horizontal_scan_8x8; band->transform_size = 8; break; case 4: band->inv_transform = ff_ivi_inverse_slant_4x4; band->dc_transform = ff_ivi_dc_slant_2d; band->scan = ff_ivi_direct_scan_4x4; band->transform_size = 4; break; } band->is_2d_trans = band->inv_transform == ff_ivi_inverse_slant_8x8 || band->inv_transform == ff_ivi_inverse_slant_4x4; if (band->transform_size != band->blk_size) { av_log(avctx, AV_LOG_ERROR, "transform and block size mismatch (%d != %d)\n", band->transform_size, band->blk_size); return AVERROR_INVALIDDATA; } /* select dequant matrix according to plane and band number */ if (!p) { quant_mat = (pic_conf.luma_bands > 1) ? i+1 : 0; } else { quant_mat = 5; } if (band->blk_size == 8) { if(quant_mat >= 5){ av_log(avctx, AV_LOG_ERROR, "quant_mat %d too large!\n", quant_mat); return -1; } band->intra_base = &ivi5_base_quant_8x8_intra[quant_mat][0]; band->inter_base = &ivi5_base_quant_8x8_inter[quant_mat][0]; band->intra_scale = &ivi5_scale_quant_8x8_intra[quant_mat][0]; band->inter_scale = &ivi5_scale_quant_8x8_inter[quant_mat][0]; } else { band->intra_base = ivi5_base_quant_4x4_intra; band->inter_base = ivi5_base_quant_4x4_inter; band->intra_scale = ivi5_scale_quant_4x4_intra; band->inter_scale = ivi5_scale_quant_4x4_inter; } if (get_bits(&ctx->gb, 2)) { av_log(avctx, AV_LOG_ERROR, "End marker missing!\n"); return AVERROR_INVALIDDATA; } } } /* copy chroma parameters into the 2nd chroma plane */ for (i = 0; i < pic_conf.chroma_bands; i++) { band1 = &ctx->planes[1].bands[i]; band2 = &ctx->planes[2].bands[i]; band2->width = band1->width; band2->height = band1->height; band2->mb_size = band1->mb_size; band2->blk_size = band1->blk_size; band2->is_halfpel = band1->is_halfpel; band2->intra_base = band1->intra_base; band2->inter_base = band1->inter_base; band2->intra_scale = band1->intra_scale; band2->inter_scale = band1->inter_scale; band2->scan = band1->scan; band2->inv_transform = band1->inv_transform; band2->dc_transform = band1->dc_transform; band2->is_2d_trans = band1->is_2d_trans; band2->transform_size= band1->transform_size; } /* reallocate internal structures if needed */ if (blk_size_changed) { result = ff_ivi_init_tiles(ctx->planes, pic_conf.tile_width, pic_conf.tile_height); if (result < 0) { av_log(avctx, AV_LOG_ERROR, "Couldn't reallocate internal structures!\n"); return result; } } if (ctx->gop_flags & 8) { if (get_bits(&ctx->gb, 3)) { av_log(avctx, AV_LOG_ERROR, "Alignment bits are not zero!\n"); return AVERROR_INVALIDDATA; } if (get_bits1(&ctx->gb)) skip_bits_long(&ctx->gb, 24); /* skip transparency fill color */ } align_get_bits(&ctx->gb); skip_bits(&ctx->gb, 23); /* FIXME: unknown meaning */ /* skip GOP extension if any */ if (get_bits1(&ctx->gb)) { do { i = get_bits(&ctx->gb, 16); } while (i & 0x8000); } align_get_bits(&ctx->gb); return 0; }
true
FFmpeg
a82468514048fb87d9bf38689866bc3b9aaccd02
static int decode_gop_header(IVI45DecContext *ctx, AVCodecContext *avctx) { int result, i, p, tile_size, pic_size_indx, mb_size, blk_size, is_scalable; int quant_mat, blk_size_changed = 0; IVIBandDesc *band, *band1, *band2; IVIPicConfig pic_conf; ctx->gop_flags = get_bits(&ctx->gb, 8); ctx->gop_hdr_size = (ctx->gop_flags & 1) ? get_bits(&ctx->gb, 16) : 0; if (ctx->gop_flags & IVI5_IS_PROTECTED) ctx->lock_word = get_bits_long(&ctx->gb, 32); tile_size = (ctx->gop_flags & 0x40) ? 64 << get_bits(&ctx->gb, 2) : 0; if (tile_size > 256) { av_log(avctx, AV_LOG_ERROR, "Invalid tile size: %d\n", tile_size); return AVERROR_INVALIDDATA; } pic_conf.luma_bands = get_bits(&ctx->gb, 2) * 3 + 1; pic_conf.chroma_bands = get_bits1(&ctx->gb) * 3 + 1; is_scalable = pic_conf.luma_bands != 1 || pic_conf.chroma_bands != 1; if (is_scalable && (pic_conf.luma_bands != 4 || pic_conf.chroma_bands != 1)) { av_log(avctx, AV_LOG_ERROR, "Scalability: unsupported subdivision! Luma bands: %d, chroma bands: %d\n", pic_conf.luma_bands, pic_conf.chroma_bands); return AVERROR_INVALIDDATA; } pic_size_indx = get_bits(&ctx->gb, 4); if (pic_size_indx == IVI5_PIC_SIZE_ESC) { pic_conf.pic_height = get_bits(&ctx->gb, 13); pic_conf.pic_width = get_bits(&ctx->gb, 13); } else { pic_conf.pic_height = ivi5_common_pic_sizes[pic_size_indx * 2 + 1] << 2; pic_conf.pic_width = ivi5_common_pic_sizes[pic_size_indx * 2 ] << 2; } if (ctx->gop_flags & 2) { avpriv_report_missing_feature(avctx, "YV12 picture format"); return AVERROR_PATCHWELCOME; } pic_conf.chroma_height = (pic_conf.pic_height + 3) >> 2; pic_conf.chroma_width = (pic_conf.pic_width + 3) >> 2; if (!tile_size) { pic_conf.tile_height = pic_conf.pic_height; pic_conf.tile_width = pic_conf.pic_width; } else { pic_conf.tile_height = pic_conf.tile_width = tile_size; } if (ivi_pic_config_cmp(&pic_conf, &ctx->pic_conf) || ctx->gop_invalid) { result = ff_ivi_init_planes(ctx->planes, &pic_conf, 0); if (result < 0) { av_log(avctx, AV_LOG_ERROR, "Couldn't reallocate color planes!\n"); return result; } ctx->pic_conf = pic_conf; ctx->is_scalable = is_scalable; blk_size_changed = 1; } for (p = 0; p <= 1; p++) { for (i = 0; i < (!p ? pic_conf.luma_bands : pic_conf.chroma_bands); i++) { band = &ctx->planes[p].bands[i]; band->is_halfpel = get_bits1(&ctx->gb); mb_size = get_bits1(&ctx->gb); blk_size = 8 >> get_bits1(&ctx->gb); mb_size = blk_size << !mb_size; if (p==0 && blk_size==4) { av_log(avctx, AV_LOG_ERROR, "4x4 luma blocks are unsupported!\n"); return AVERROR_PATCHWELCOME; } blk_size_changed = mb_size != band->mb_size || blk_size != band->blk_size; if (blk_size_changed) { band->mb_size = mb_size; band->blk_size = blk_size; } if (get_bits1(&ctx->gb)) { avpriv_report_missing_feature(avctx, "Extended transform info"); return AVERROR_PATCHWELCOME; } switch ((p << 2) + i) { case 0: band->inv_transform = ff_ivi_inverse_slant_8x8; band->dc_transform = ff_ivi_dc_slant_2d; band->scan = ff_zigzag_direct; band->transform_size = 8; break; case 1: band->inv_transform = ff_ivi_row_slant8; band->dc_transform = ff_ivi_dc_row_slant; band->scan = ff_ivi_vertical_scan_8x8; band->transform_size = 8; break; case 2: band->inv_transform = ff_ivi_col_slant8; band->dc_transform = ff_ivi_dc_col_slant; band->scan = ff_ivi_horizontal_scan_8x8; band->transform_size = 8; break; case 3: band->inv_transform = ff_ivi_put_pixels_8x8; band->dc_transform = ff_ivi_put_dc_pixel_8x8; band->scan = ff_ivi_horizontal_scan_8x8; band->transform_size = 8; break; case 4: band->inv_transform = ff_ivi_inverse_slant_4x4; band->dc_transform = ff_ivi_dc_slant_2d; band->scan = ff_ivi_direct_scan_4x4; band->transform_size = 4; break; } band->is_2d_trans = band->inv_transform == ff_ivi_inverse_slant_8x8 || band->inv_transform == ff_ivi_inverse_slant_4x4; if (band->transform_size != band->blk_size) { av_log(avctx, AV_LOG_ERROR, "transform and block size mismatch (%d != %d)\n", band->transform_size, band->blk_size); return AVERROR_INVALIDDATA; } if (!p) { quant_mat = (pic_conf.luma_bands > 1) ? i+1 : 0; } else { quant_mat = 5; } if (band->blk_size == 8) { if(quant_mat >= 5){ av_log(avctx, AV_LOG_ERROR, "quant_mat %d too large!\n", quant_mat); return -1; } band->intra_base = &ivi5_base_quant_8x8_intra[quant_mat][0]; band->inter_base = &ivi5_base_quant_8x8_inter[quant_mat][0]; band->intra_scale = &ivi5_scale_quant_8x8_intra[quant_mat][0]; band->inter_scale = &ivi5_scale_quant_8x8_inter[quant_mat][0]; } else { band->intra_base = ivi5_base_quant_4x4_intra; band->inter_base = ivi5_base_quant_4x4_inter; band->intra_scale = ivi5_scale_quant_4x4_intra; band->inter_scale = ivi5_scale_quant_4x4_inter; } if (get_bits(&ctx->gb, 2)) { av_log(avctx, AV_LOG_ERROR, "End marker missing!\n"); return AVERROR_INVALIDDATA; } } } for (i = 0; i < pic_conf.chroma_bands; i++) { band1 = &ctx->planes[1].bands[i]; band2 = &ctx->planes[2].bands[i]; band2->width = band1->width; band2->height = band1->height; band2->mb_size = band1->mb_size; band2->blk_size = band1->blk_size; band2->is_halfpel = band1->is_halfpel; band2->intra_base = band1->intra_base; band2->inter_base = band1->inter_base; band2->intra_scale = band1->intra_scale; band2->inter_scale = band1->inter_scale; band2->scan = band1->scan; band2->inv_transform = band1->inv_transform; band2->dc_transform = band1->dc_transform; band2->is_2d_trans = band1->is_2d_trans; band2->transform_size= band1->transform_size; } if (blk_size_changed) { result = ff_ivi_init_tiles(ctx->planes, pic_conf.tile_width, pic_conf.tile_height); if (result < 0) { av_log(avctx, AV_LOG_ERROR, "Couldn't reallocate internal structures!\n"); return result; } } if (ctx->gop_flags & 8) { if (get_bits(&ctx->gb, 3)) { av_log(avctx, AV_LOG_ERROR, "Alignment bits are not zero!\n"); return AVERROR_INVALIDDATA; } if (get_bits1(&ctx->gb)) skip_bits_long(&ctx->gb, 24); } align_get_bits(&ctx->gb); skip_bits(&ctx->gb, 23); if (get_bits1(&ctx->gb)) { do { i = get_bits(&ctx->gb, 16); } while (i & 0x8000); } align_get_bits(&ctx->gb); return 0; }
{ "code": [ " result = ff_ivi_init_planes(ctx->planes, &pic_conf, 0);" ], "line_no": [ 115 ] }
static int FUNC_0(IVI45DecContext *VAR_0, AVCodecContext *VAR_1) { int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9; int VAR_10, VAR_11 = 0; IVIBandDesc *band, *band1, *band2; IVIPicConfig pic_conf; VAR_0->gop_flags = get_bits(&VAR_0->gb, 8); VAR_0->gop_hdr_size = (VAR_0->gop_flags & 1) ? get_bits(&VAR_0->gb, 16) : 0; if (VAR_0->gop_flags & IVI5_IS_PROTECTED) VAR_0->lock_word = get_bits_long(&VAR_0->gb, 32); VAR_5 = (VAR_0->gop_flags & 0x40) ? 64 << get_bits(&VAR_0->gb, 2) : 0; if (VAR_5 > 256) { av_log(VAR_1, AV_LOG_ERROR, "Invalid tile size: %d\n", VAR_5); return AVERROR_INVALIDDATA; } pic_conf.luma_bands = get_bits(&VAR_0->gb, 2) * 3 + 1; pic_conf.chroma_bands = get_bits1(&VAR_0->gb) * 3 + 1; VAR_9 = pic_conf.luma_bands != 1 || pic_conf.chroma_bands != 1; if (VAR_9 && (pic_conf.luma_bands != 4 || pic_conf.chroma_bands != 1)) { av_log(VAR_1, AV_LOG_ERROR, "Scalability: unsupported subdivision! Luma bands: %d, chroma bands: %d\n", pic_conf.luma_bands, pic_conf.chroma_bands); return AVERROR_INVALIDDATA; } VAR_6 = get_bits(&VAR_0->gb, 4); if (VAR_6 == IVI5_PIC_SIZE_ESC) { pic_conf.pic_height = get_bits(&VAR_0->gb, 13); pic_conf.pic_width = get_bits(&VAR_0->gb, 13); } else { pic_conf.pic_height = ivi5_common_pic_sizes[VAR_6 * 2 + 1] << 2; pic_conf.pic_width = ivi5_common_pic_sizes[VAR_6 * 2 ] << 2; } if (VAR_0->gop_flags & 2) { avpriv_report_missing_feature(VAR_1, "YV12 picture format"); return AVERROR_PATCHWELCOME; } pic_conf.chroma_height = (pic_conf.pic_height + 3) >> 2; pic_conf.chroma_width = (pic_conf.pic_width + 3) >> 2; if (!VAR_5) { pic_conf.tile_height = pic_conf.pic_height; pic_conf.tile_width = pic_conf.pic_width; } else { pic_conf.tile_height = pic_conf.tile_width = VAR_5; } if (ivi_pic_config_cmp(&pic_conf, &VAR_0->pic_conf) || VAR_0->gop_invalid) { VAR_2 = ff_ivi_init_planes(VAR_0->planes, &pic_conf, 0); if (VAR_2 < 0) { av_log(VAR_1, AV_LOG_ERROR, "Couldn't reallocate color planes!\n"); return VAR_2; } VAR_0->pic_conf = pic_conf; VAR_0->VAR_9 = VAR_9; VAR_11 = 1; } for (VAR_4 = 0; VAR_4 <= 1; VAR_4++) { for (VAR_3 = 0; VAR_3 < (!VAR_4 ? pic_conf.luma_bands : pic_conf.chroma_bands); VAR_3++) { band = &VAR_0->planes[VAR_4].bands[VAR_3]; band->is_halfpel = get_bits1(&VAR_0->gb); VAR_7 = get_bits1(&VAR_0->gb); VAR_8 = 8 >> get_bits1(&VAR_0->gb); VAR_7 = VAR_8 << !VAR_7; if (VAR_4==0 && VAR_8==4) { av_log(VAR_1, AV_LOG_ERROR, "4x4 luma blocks are unsupported!\n"); return AVERROR_PATCHWELCOME; } VAR_11 = VAR_7 != band->VAR_7 || VAR_8 != band->VAR_8; if (VAR_11) { band->VAR_7 = VAR_7; band->VAR_8 = VAR_8; } if (get_bits1(&VAR_0->gb)) { avpriv_report_missing_feature(VAR_1, "Extended transform info"); return AVERROR_PATCHWELCOME; } switch ((VAR_4 << 2) + VAR_3) { case 0: band->inv_transform = ff_ivi_inverse_slant_8x8; band->dc_transform = ff_ivi_dc_slant_2d; band->scan = ff_zigzag_direct; band->transform_size = 8; break; case 1: band->inv_transform = ff_ivi_row_slant8; band->dc_transform = ff_ivi_dc_row_slant; band->scan = ff_ivi_vertical_scan_8x8; band->transform_size = 8; break; case 2: band->inv_transform = ff_ivi_col_slant8; band->dc_transform = ff_ivi_dc_col_slant; band->scan = ff_ivi_horizontal_scan_8x8; band->transform_size = 8; break; case 3: band->inv_transform = ff_ivi_put_pixels_8x8; band->dc_transform = ff_ivi_put_dc_pixel_8x8; band->scan = ff_ivi_horizontal_scan_8x8; band->transform_size = 8; break; case 4: band->inv_transform = ff_ivi_inverse_slant_4x4; band->dc_transform = ff_ivi_dc_slant_2d; band->scan = ff_ivi_direct_scan_4x4; band->transform_size = 4; break; } band->is_2d_trans = band->inv_transform == ff_ivi_inverse_slant_8x8 || band->inv_transform == ff_ivi_inverse_slant_4x4; if (band->transform_size != band->VAR_8) { av_log(VAR_1, AV_LOG_ERROR, "transform and block size mismatch (%d != %d)\n", band->transform_size, band->VAR_8); return AVERROR_INVALIDDATA; } if (!VAR_4) { VAR_10 = (pic_conf.luma_bands > 1) ? VAR_3+1 : 0; } else { VAR_10 = 5; } if (band->VAR_8 == 8) { if(VAR_10 >= 5){ av_log(VAR_1, AV_LOG_ERROR, "VAR_10 %d too large!\n", VAR_10); return -1; } band->intra_base = &ivi5_base_quant_8x8_intra[VAR_10][0]; band->inter_base = &ivi5_base_quant_8x8_inter[VAR_10][0]; band->intra_scale = &ivi5_scale_quant_8x8_intra[VAR_10][0]; band->inter_scale = &ivi5_scale_quant_8x8_inter[VAR_10][0]; } else { band->intra_base = ivi5_base_quant_4x4_intra; band->inter_base = ivi5_base_quant_4x4_inter; band->intra_scale = ivi5_scale_quant_4x4_intra; band->inter_scale = ivi5_scale_quant_4x4_inter; } if (get_bits(&VAR_0->gb, 2)) { av_log(VAR_1, AV_LOG_ERROR, "End marker missing!\n"); return AVERROR_INVALIDDATA; } } } for (VAR_3 = 0; VAR_3 < pic_conf.chroma_bands; VAR_3++) { band1 = &VAR_0->planes[1].bands[VAR_3]; band2 = &VAR_0->planes[2].bands[VAR_3]; band2->width = band1->width; band2->height = band1->height; band2->VAR_7 = band1->VAR_7; band2->VAR_8 = band1->VAR_8; band2->is_halfpel = band1->is_halfpel; band2->intra_base = band1->intra_base; band2->inter_base = band1->inter_base; band2->intra_scale = band1->intra_scale; band2->inter_scale = band1->inter_scale; band2->scan = band1->scan; band2->inv_transform = band1->inv_transform; band2->dc_transform = band1->dc_transform; band2->is_2d_trans = band1->is_2d_trans; band2->transform_size= band1->transform_size; } if (VAR_11) { VAR_2 = ff_ivi_init_tiles(VAR_0->planes, pic_conf.tile_width, pic_conf.tile_height); if (VAR_2 < 0) { av_log(VAR_1, AV_LOG_ERROR, "Couldn't reallocate internal structures!\n"); return VAR_2; } } if (VAR_0->gop_flags & 8) { if (get_bits(&VAR_0->gb, 3)) { av_log(VAR_1, AV_LOG_ERROR, "Alignment bits are not zero!\n"); return AVERROR_INVALIDDATA; } if (get_bits1(&VAR_0->gb)) skip_bits_long(&VAR_0->gb, 24); } align_get_bits(&VAR_0->gb); skip_bits(&VAR_0->gb, 23); if (get_bits1(&VAR_0->gb)) { do { VAR_3 = get_bits(&VAR_0->gb, 16); } while (VAR_3 & 0x8000); } align_get_bits(&VAR_0->gb); return 0; }
[ "static int FUNC_0(IVI45DecContext *VAR_0, AVCodecContext *VAR_1)\n{", "int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9;", "int VAR_10, VAR_11 = 0;", "IVIBandDesc *band, *band1, *band2;", "IVIPicConfig pic_conf;", "VAR_0->gop_flags = get_bits(&VAR_0->gb, 8);", "VAR_0->gop_hdr_size = (VAR_0->gop_flags & 1) ? get_bits(&VAR_0->gb, 16) : 0;", "if (VAR_0->gop_flags & IVI5_IS_PROTECTED)\nVAR_0->lock_word = get_bits_long(&VAR_0->gb, 32);", "VAR_5 = (VAR_0->gop_flags & 0x40) ? 64 << get_bits(&VAR_0->gb, 2) : 0;", "if (VAR_5 > 256) {", "av_log(VAR_1, AV_LOG_ERROR, \"Invalid tile size: %d\\n\", VAR_5);", "return AVERROR_INVALIDDATA;", "}", "pic_conf.luma_bands = get_bits(&VAR_0->gb, 2) * 3 + 1;", "pic_conf.chroma_bands = get_bits1(&VAR_0->gb) * 3 + 1;", "VAR_9 = pic_conf.luma_bands != 1 || pic_conf.chroma_bands != 1;", "if (VAR_9 && (pic_conf.luma_bands != 4 || pic_conf.chroma_bands != 1)) {", "av_log(VAR_1, AV_LOG_ERROR, \"Scalability: unsupported subdivision! Luma bands: %d, chroma bands: %d\\n\",\npic_conf.luma_bands, pic_conf.chroma_bands);", "return AVERROR_INVALIDDATA;", "}", "VAR_6 = get_bits(&VAR_0->gb, 4);", "if (VAR_6 == IVI5_PIC_SIZE_ESC) {", "pic_conf.pic_height = get_bits(&VAR_0->gb, 13);", "pic_conf.pic_width = get_bits(&VAR_0->gb, 13);", "} else {", "pic_conf.pic_height = ivi5_common_pic_sizes[VAR_6 * 2 + 1] << 2;", "pic_conf.pic_width = ivi5_common_pic_sizes[VAR_6 * 2 ] << 2;", "}", "if (VAR_0->gop_flags & 2) {", "avpriv_report_missing_feature(VAR_1, \"YV12 picture format\");", "return AVERROR_PATCHWELCOME;", "}", "pic_conf.chroma_height = (pic_conf.pic_height + 3) >> 2;", "pic_conf.chroma_width = (pic_conf.pic_width + 3) >> 2;", "if (!VAR_5) {", "pic_conf.tile_height = pic_conf.pic_height;", "pic_conf.tile_width = pic_conf.pic_width;", "} else {", "pic_conf.tile_height = pic_conf.tile_width = VAR_5;", "}", "if (ivi_pic_config_cmp(&pic_conf, &VAR_0->pic_conf) || VAR_0->gop_invalid) {", "VAR_2 = ff_ivi_init_planes(VAR_0->planes, &pic_conf, 0);", "if (VAR_2 < 0) {", "av_log(VAR_1, AV_LOG_ERROR, \"Couldn't reallocate color planes!\\n\");", "return VAR_2;", "}", "VAR_0->pic_conf = pic_conf;", "VAR_0->VAR_9 = VAR_9;", "VAR_11 = 1;", "}", "for (VAR_4 = 0; VAR_4 <= 1; VAR_4++) {", "for (VAR_3 = 0; VAR_3 < (!VAR_4 ? pic_conf.luma_bands : pic_conf.chroma_bands); VAR_3++) {", "band = &VAR_0->planes[VAR_4].bands[VAR_3];", "band->is_halfpel = get_bits1(&VAR_0->gb);", "VAR_7 = get_bits1(&VAR_0->gb);", "VAR_8 = 8 >> get_bits1(&VAR_0->gb);", "VAR_7 = VAR_8 << !VAR_7;", "if (VAR_4==0 && VAR_8==4) {", "av_log(VAR_1, AV_LOG_ERROR, \"4x4 luma blocks are unsupported!\\n\");", "return AVERROR_PATCHWELCOME;", "}", "VAR_11 = VAR_7 != band->VAR_7 || VAR_8 != band->VAR_8;", "if (VAR_11) {", "band->VAR_7 = VAR_7;", "band->VAR_8 = VAR_8;", "}", "if (get_bits1(&VAR_0->gb)) {", "avpriv_report_missing_feature(VAR_1, \"Extended transform info\");", "return AVERROR_PATCHWELCOME;", "}", "switch ((VAR_4 << 2) + VAR_3) {", "case 0:\nband->inv_transform = ff_ivi_inverse_slant_8x8;", "band->dc_transform = ff_ivi_dc_slant_2d;", "band->scan = ff_zigzag_direct;", "band->transform_size = 8;", "break;", "case 1:\nband->inv_transform = ff_ivi_row_slant8;", "band->dc_transform = ff_ivi_dc_row_slant;", "band->scan = ff_ivi_vertical_scan_8x8;", "band->transform_size = 8;", "break;", "case 2:\nband->inv_transform = ff_ivi_col_slant8;", "band->dc_transform = ff_ivi_dc_col_slant;", "band->scan = ff_ivi_horizontal_scan_8x8;", "band->transform_size = 8;", "break;", "case 3:\nband->inv_transform = ff_ivi_put_pixels_8x8;", "band->dc_transform = ff_ivi_put_dc_pixel_8x8;", "band->scan = ff_ivi_horizontal_scan_8x8;", "band->transform_size = 8;", "break;", "case 4:\nband->inv_transform = ff_ivi_inverse_slant_4x4;", "band->dc_transform = ff_ivi_dc_slant_2d;", "band->scan = ff_ivi_direct_scan_4x4;", "band->transform_size = 4;", "break;", "}", "band->is_2d_trans = band->inv_transform == ff_ivi_inverse_slant_8x8 ||\nband->inv_transform == ff_ivi_inverse_slant_4x4;", "if (band->transform_size != band->VAR_8) {", "av_log(VAR_1, AV_LOG_ERROR, \"transform and block size mismatch (%d != %d)\\n\", band->transform_size, band->VAR_8);", "return AVERROR_INVALIDDATA;", "}", "if (!VAR_4) {", "VAR_10 = (pic_conf.luma_bands > 1) ? VAR_3+1 : 0;", "} else {", "VAR_10 = 5;", "}", "if (band->VAR_8 == 8) {", "if(VAR_10 >= 5){", "av_log(VAR_1, AV_LOG_ERROR, \"VAR_10 %d too large!\\n\", VAR_10);", "return -1;", "}", "band->intra_base = &ivi5_base_quant_8x8_intra[VAR_10][0];", "band->inter_base = &ivi5_base_quant_8x8_inter[VAR_10][0];", "band->intra_scale = &ivi5_scale_quant_8x8_intra[VAR_10][0];", "band->inter_scale = &ivi5_scale_quant_8x8_inter[VAR_10][0];", "} else {", "band->intra_base = ivi5_base_quant_4x4_intra;", "band->inter_base = ivi5_base_quant_4x4_inter;", "band->intra_scale = ivi5_scale_quant_4x4_intra;", "band->inter_scale = ivi5_scale_quant_4x4_inter;", "}", "if (get_bits(&VAR_0->gb, 2)) {", "av_log(VAR_1, AV_LOG_ERROR, \"End marker missing!\\n\");", "return AVERROR_INVALIDDATA;", "}", "}", "}", "for (VAR_3 = 0; VAR_3 < pic_conf.chroma_bands; VAR_3++) {", "band1 = &VAR_0->planes[1].bands[VAR_3];", "band2 = &VAR_0->planes[2].bands[VAR_3];", "band2->width = band1->width;", "band2->height = band1->height;", "band2->VAR_7 = band1->VAR_7;", "band2->VAR_8 = band1->VAR_8;", "band2->is_halfpel = band1->is_halfpel;", "band2->intra_base = band1->intra_base;", "band2->inter_base = band1->inter_base;", "band2->intra_scale = band1->intra_scale;", "band2->inter_scale = band1->inter_scale;", "band2->scan = band1->scan;", "band2->inv_transform = band1->inv_transform;", "band2->dc_transform = band1->dc_transform;", "band2->is_2d_trans = band1->is_2d_trans;", "band2->transform_size= band1->transform_size;", "}", "if (VAR_11) {", "VAR_2 = ff_ivi_init_tiles(VAR_0->planes, pic_conf.tile_width,\npic_conf.tile_height);", "if (VAR_2 < 0) {", "av_log(VAR_1, AV_LOG_ERROR,\n\"Couldn't reallocate internal structures!\\n\");", "return VAR_2;", "}", "}", "if (VAR_0->gop_flags & 8) {", "if (get_bits(&VAR_0->gb, 3)) {", "av_log(VAR_1, AV_LOG_ERROR, \"Alignment bits are not zero!\\n\");", "return AVERROR_INVALIDDATA;", "}", "if (get_bits1(&VAR_0->gb))\nskip_bits_long(&VAR_0->gb, 24);", "}", "align_get_bits(&VAR_0->gb);", "skip_bits(&VAR_0->gb, 23);", "if (get_bits1(&VAR_0->gb)) {", "do {", "VAR_3 = get_bits(&VAR_0->gb, 16);", "} while (VAR_3 & 0x8000);", "}", "align_get_bits(&VAR_0->gb);", "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, 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 19 ], [ 23, 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53, 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 91 ], [ 93 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 135 ], [ 137 ], [ 139 ], [ 143 ], [ 147 ], [ 149 ], [ 151 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 189 ], [ 191, 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 205, 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 219, 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 233, 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 247, 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 263, 265 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 281 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305 ], [ 307 ], [ 309 ], [ 311 ], [ 313 ], [ 315 ], [ 317 ], [ 319 ], [ 321 ], [ 325 ], [ 327 ], [ 329 ], [ 331 ], [ 333 ], [ 335 ], [ 341 ], [ 343 ], [ 345 ], [ 349 ], [ 351 ], [ 353 ], [ 355 ], [ 357 ], [ 359 ], [ 361 ], [ 363 ], [ 365 ], [ 367 ], [ 369 ], [ 371 ], [ 373 ], [ 375 ], [ 377 ], [ 383 ], [ 385, 387 ], [ 389 ], [ 391, 393 ], [ 395 ], [ 397 ], [ 399 ], [ 403 ], [ 405 ], [ 407 ], [ 409 ], [ 411 ], [ 415, 417 ], [ 419 ], [ 423 ], [ 427 ], [ 433 ], [ 435 ], [ 437 ], [ 439 ], [ 441 ], [ 445 ], [ 449 ], [ 451 ] ]
18,415
static void virtio_gpu_cleanup_mapping(struct virtio_gpu_simple_resource *res) { virtio_gpu_cleanup_mapping_iov(res->iov, res->iov_cnt); g_free(res->iov); res->iov = NULL; res->iov_cnt = 0; }
true
qemu
7f3be0f20ff8d976ab982cc06026cac0600f1fb6
static void virtio_gpu_cleanup_mapping(struct virtio_gpu_simple_resource *res) { virtio_gpu_cleanup_mapping_iov(res->iov, res->iov_cnt); g_free(res->iov); res->iov = NULL; res->iov_cnt = 0; }
{ "code": [ " g_free(res->iov);" ], "line_no": [ 7 ] }
static void FUNC_0(struct virtio_gpu_simple_resource *VAR_0) { virtio_gpu_cleanup_mapping_iov(VAR_0->iov, VAR_0->iov_cnt); g_free(VAR_0->iov); VAR_0->iov = NULL; VAR_0->iov_cnt = 0; }
[ "static void FUNC_0(struct virtio_gpu_simple_resource *VAR_0)\n{", "virtio_gpu_cleanup_mapping_iov(VAR_0->iov, VAR_0->iov_cnt);", "g_free(VAR_0->iov);", "VAR_0->iov = NULL;", "VAR_0->iov_cnt = 0;", "}" ]
[ 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ] ]
18,416
static int get_packet(URLContext *s, int for_header) { RTMPContext *rt = s->priv_data; int ret; uint8_t *p; const uint8_t *next; uint32_t data_size; uint32_t ts, cts, pts=0; if (rt->state == STATE_STOPPED) return AVERROR_EOF; for (;;) { RTMPPacket rpkt = { 0 }; if ((ret = ff_rtmp_packet_read(rt->stream, &rpkt, rt->chunk_size, rt->prev_pkt[0])) <= 0) { if (ret == 0) { return AVERROR(EAGAIN); } else { return AVERROR(EIO); } } rt->bytes_read += ret; if (rt->bytes_read > rt->last_bytes_read + rt->client_report_size) { av_log(s, AV_LOG_DEBUG, "Sending bytes read report\n"); gen_bytes_read(s, rt, rpkt.timestamp + 1); rt->last_bytes_read = rt->bytes_read; } ret = rtmp_parse_result(s, rt, &rpkt); if (ret < 0) {//serious error in current packet ff_rtmp_packet_destroy(&rpkt); return -1; } if (rt->state == STATE_STOPPED) { ff_rtmp_packet_destroy(&rpkt); return AVERROR_EOF; } if (for_header && (rt->state == STATE_PLAYING || rt->state == STATE_PUBLISHING)) { ff_rtmp_packet_destroy(&rpkt); return 0; } if (!rpkt.data_size || !rt->is_input) { ff_rtmp_packet_destroy(&rpkt); continue; } if (rpkt.type == RTMP_PT_VIDEO || rpkt.type == RTMP_PT_AUDIO || (rpkt.type == RTMP_PT_NOTIFY && !memcmp("\002\000\012onMetaData", rpkt.data, 13))) { ts = rpkt.timestamp; // generate packet header and put data into buffer for FLV demuxer rt->flv_off = 0; rt->flv_size = rpkt.data_size + 15; rt->flv_data = p = av_realloc(rt->flv_data, rt->flv_size); bytestream_put_byte(&p, rpkt.type); bytestream_put_be24(&p, rpkt.data_size); bytestream_put_be24(&p, ts); bytestream_put_byte(&p, ts >> 24); bytestream_put_be24(&p, 0); bytestream_put_buffer(&p, rpkt.data, rpkt.data_size); bytestream_put_be32(&p, 0); ff_rtmp_packet_destroy(&rpkt); return 0; } else if (rpkt.type == RTMP_PT_METADATA) { // we got raw FLV data, make it available for FLV demuxer rt->flv_off = 0; rt->flv_size = rpkt.data_size; rt->flv_data = av_realloc(rt->flv_data, rt->flv_size); /* rewrite timestamps */ next = rpkt.data; ts = rpkt.timestamp; while (next - rpkt.data < rpkt.data_size - 11) { next++; data_size = bytestream_get_be24(&next); p=next; cts = bytestream_get_be24(&next); cts |= bytestream_get_byte(&next) << 24; if (pts==0) pts=cts; ts += cts - pts; pts = cts; bytestream_put_be24(&p, ts); bytestream_put_byte(&p, ts >> 24); next += data_size + 3 + 4; } memcpy(rt->flv_data, rpkt.data, rpkt.data_size); ff_rtmp_packet_destroy(&rpkt); return 0; } ff_rtmp_packet_destroy(&rpkt); } return 0; }
false
FFmpeg
add41decd94b2d3581a3715ba10f27168b8cdb1b
static int get_packet(URLContext *s, int for_header) { RTMPContext *rt = s->priv_data; int ret; uint8_t *p; const uint8_t *next; uint32_t data_size; uint32_t ts, cts, pts=0; if (rt->state == STATE_STOPPED) return AVERROR_EOF; for (;;) { RTMPPacket rpkt = { 0 }; if ((ret = ff_rtmp_packet_read(rt->stream, &rpkt, rt->chunk_size, rt->prev_pkt[0])) <= 0) { if (ret == 0) { return AVERROR(EAGAIN); } else { return AVERROR(EIO); } } rt->bytes_read += ret; if (rt->bytes_read > rt->last_bytes_read + rt->client_report_size) { av_log(s, AV_LOG_DEBUG, "Sending bytes read report\n"); gen_bytes_read(s, rt, rpkt.timestamp + 1); rt->last_bytes_read = rt->bytes_read; } ret = rtmp_parse_result(s, rt, &rpkt); if (ret < 0) { ff_rtmp_packet_destroy(&rpkt); return -1; } if (rt->state == STATE_STOPPED) { ff_rtmp_packet_destroy(&rpkt); return AVERROR_EOF; } if (for_header && (rt->state == STATE_PLAYING || rt->state == STATE_PUBLISHING)) { ff_rtmp_packet_destroy(&rpkt); return 0; } if (!rpkt.data_size || !rt->is_input) { ff_rtmp_packet_destroy(&rpkt); continue; } if (rpkt.type == RTMP_PT_VIDEO || rpkt.type == RTMP_PT_AUDIO || (rpkt.type == RTMP_PT_NOTIFY && !memcmp("\002\000\012onMetaData", rpkt.data, 13))) { ts = rpkt.timestamp; rt->flv_off = 0; rt->flv_size = rpkt.data_size + 15; rt->flv_data = p = av_realloc(rt->flv_data, rt->flv_size); bytestream_put_byte(&p, rpkt.type); bytestream_put_be24(&p, rpkt.data_size); bytestream_put_be24(&p, ts); bytestream_put_byte(&p, ts >> 24); bytestream_put_be24(&p, 0); bytestream_put_buffer(&p, rpkt.data, rpkt.data_size); bytestream_put_be32(&p, 0); ff_rtmp_packet_destroy(&rpkt); return 0; } else if (rpkt.type == RTMP_PT_METADATA) { rt->flv_off = 0; rt->flv_size = rpkt.data_size; rt->flv_data = av_realloc(rt->flv_data, rt->flv_size); next = rpkt.data; ts = rpkt.timestamp; while (next - rpkt.data < rpkt.data_size - 11) { next++; data_size = bytestream_get_be24(&next); p=next; cts = bytestream_get_be24(&next); cts |= bytestream_get_byte(&next) << 24; if (pts==0) pts=cts; ts += cts - pts; pts = cts; bytestream_put_be24(&p, ts); bytestream_put_byte(&p, ts >> 24); next += data_size + 3 + 4; } memcpy(rt->flv_data, rpkt.data, rpkt.data_size); ff_rtmp_packet_destroy(&rpkt); return 0; } ff_rtmp_packet_destroy(&rpkt); } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(URLContext *VAR_0, int VAR_1) { RTMPContext *rt = VAR_0->priv_data; int VAR_2; uint8_t *p; const uint8_t *VAR_3; uint32_t data_size; uint32_t ts, cts, pts=0; if (rt->state == STATE_STOPPED) return AVERROR_EOF; for (;;) { RTMPPacket rpkt = { 0 }; if ((VAR_2 = ff_rtmp_packet_read(rt->stream, &rpkt, rt->chunk_size, rt->prev_pkt[0])) <= 0) { if (VAR_2 == 0) { return AVERROR(EAGAIN); } else { return AVERROR(EIO); } } rt->bytes_read += VAR_2; if (rt->bytes_read > rt->last_bytes_read + rt->client_report_size) { av_log(VAR_0, AV_LOG_DEBUG, "Sending bytes read report\n"); gen_bytes_read(VAR_0, rt, rpkt.timestamp + 1); rt->last_bytes_read = rt->bytes_read; } VAR_2 = rtmp_parse_result(VAR_0, rt, &rpkt); if (VAR_2 < 0) { ff_rtmp_packet_destroy(&rpkt); return -1; } if (rt->state == STATE_STOPPED) { ff_rtmp_packet_destroy(&rpkt); return AVERROR_EOF; } if (VAR_1 && (rt->state == STATE_PLAYING || rt->state == STATE_PUBLISHING)) { ff_rtmp_packet_destroy(&rpkt); return 0; } if (!rpkt.data_size || !rt->is_input) { ff_rtmp_packet_destroy(&rpkt); continue; } if (rpkt.type == RTMP_PT_VIDEO || rpkt.type == RTMP_PT_AUDIO || (rpkt.type == RTMP_PT_NOTIFY && !memcmp("\002\000\012onMetaData", rpkt.data, 13))) { ts = rpkt.timestamp; rt->flv_off = 0; rt->flv_size = rpkt.data_size + 15; rt->flv_data = p = av_realloc(rt->flv_data, rt->flv_size); bytestream_put_byte(&p, rpkt.type); bytestream_put_be24(&p, rpkt.data_size); bytestream_put_be24(&p, ts); bytestream_put_byte(&p, ts >> 24); bytestream_put_be24(&p, 0); bytestream_put_buffer(&p, rpkt.data, rpkt.data_size); bytestream_put_be32(&p, 0); ff_rtmp_packet_destroy(&rpkt); return 0; } else if (rpkt.type == RTMP_PT_METADATA) { rt->flv_off = 0; rt->flv_size = rpkt.data_size; rt->flv_data = av_realloc(rt->flv_data, rt->flv_size); VAR_3 = rpkt.data; ts = rpkt.timestamp; while (VAR_3 - rpkt.data < rpkt.data_size - 11) { VAR_3++; data_size = bytestream_get_be24(&VAR_3); p=VAR_3; cts = bytestream_get_be24(&VAR_3); cts |= bytestream_get_byte(&VAR_3) << 24; if (pts==0) pts=cts; ts += cts - pts; pts = cts; bytestream_put_be24(&p, ts); bytestream_put_byte(&p, ts >> 24); VAR_3 += data_size + 3 + 4; } memcpy(rt->flv_data, rpkt.data, rpkt.data_size); ff_rtmp_packet_destroy(&rpkt); return 0; } ff_rtmp_packet_destroy(&rpkt); } return 0; }
[ "static int FUNC_0(URLContext *VAR_0, int VAR_1)\n{", "RTMPContext *rt = VAR_0->priv_data;", "int VAR_2;", "uint8_t *p;", "const uint8_t *VAR_3;", "uint32_t data_size;", "uint32_t ts, cts, pts=0;", "if (rt->state == STATE_STOPPED)\nreturn AVERROR_EOF;", "for (;;) {", "RTMPPacket rpkt = { 0 };", "if ((VAR_2 = ff_rtmp_packet_read(rt->stream, &rpkt,\nrt->chunk_size, rt->prev_pkt[0])) <= 0) {", "if (VAR_2 == 0) {", "return AVERROR(EAGAIN);", "} else {", "return AVERROR(EIO);", "}", "}", "rt->bytes_read += VAR_2;", "if (rt->bytes_read > rt->last_bytes_read + rt->client_report_size) {", "av_log(VAR_0, AV_LOG_DEBUG, \"Sending bytes read report\\n\");", "gen_bytes_read(VAR_0, rt, rpkt.timestamp + 1);", "rt->last_bytes_read = rt->bytes_read;", "}", "VAR_2 = rtmp_parse_result(VAR_0, rt, &rpkt);", "if (VAR_2 < 0) {", "ff_rtmp_packet_destroy(&rpkt);", "return -1;", "}", "if (rt->state == STATE_STOPPED) {", "ff_rtmp_packet_destroy(&rpkt);", "return AVERROR_EOF;", "}", "if (VAR_1 && (rt->state == STATE_PLAYING || rt->state == STATE_PUBLISHING)) {", "ff_rtmp_packet_destroy(&rpkt);", "return 0;", "}", "if (!rpkt.data_size || !rt->is_input) {", "ff_rtmp_packet_destroy(&rpkt);", "continue;", "}", "if (rpkt.type == RTMP_PT_VIDEO || rpkt.type == RTMP_PT_AUDIO ||\n(rpkt.type == RTMP_PT_NOTIFY && !memcmp(\"\\002\\000\\012onMetaData\", rpkt.data, 13))) {", "ts = rpkt.timestamp;", "rt->flv_off = 0;", "rt->flv_size = rpkt.data_size + 15;", "rt->flv_data = p = av_realloc(rt->flv_data, rt->flv_size);", "bytestream_put_byte(&p, rpkt.type);", "bytestream_put_be24(&p, rpkt.data_size);", "bytestream_put_be24(&p, ts);", "bytestream_put_byte(&p, ts >> 24);", "bytestream_put_be24(&p, 0);", "bytestream_put_buffer(&p, rpkt.data, rpkt.data_size);", "bytestream_put_be32(&p, 0);", "ff_rtmp_packet_destroy(&rpkt);", "return 0;", "} else if (rpkt.type == RTMP_PT_METADATA) {", "rt->flv_off = 0;", "rt->flv_size = rpkt.data_size;", "rt->flv_data = av_realloc(rt->flv_data, rt->flv_size);", "VAR_3 = rpkt.data;", "ts = rpkt.timestamp;", "while (VAR_3 - rpkt.data < rpkt.data_size - 11) {", "VAR_3++;", "data_size = bytestream_get_be24(&VAR_3);", "p=VAR_3;", "cts = bytestream_get_be24(&VAR_3);", "cts |= bytestream_get_byte(&VAR_3) << 24;", "if (pts==0)\npts=cts;", "ts += cts - pts;", "pts = cts;", "bytestream_put_be24(&p, ts);", "bytestream_put_byte(&p, ts >> 24);", "VAR_3 += data_size + 3 + 4;", "}", "memcpy(rt->flv_data, rpkt.data, rpkt.data_size);", "ff_rtmp_packet_destroy(&rpkt);", "return 0;", "}", "ff_rtmp_packet_destroy(&rpkt);", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19, 21 ], [ 25 ], [ 27 ], [ 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 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93, 95 ], [ 97 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 131 ], [ 133 ], [ 135 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155, 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ] ]
18,417
static int pcm_encode_frame(AVCodecContext *avctx, unsigned char *frame, int buf_size, void *data) { int n, sample_size, v; const short *samples; unsigned char *dst; const uint8_t *srcu8; const int16_t *samples_int16_t; const int32_t *samples_int32_t; const int64_t *samples_int64_t; const uint16_t *samples_uint16_t; const uint32_t *samples_uint32_t; sample_size = av_get_bits_per_sample(avctx->codec->id)/8; n = buf_size / sample_size; samples = data; dst = frame; if (avctx->sample_fmt!=avctx->codec->sample_fmts[0]) { av_log(avctx, AV_LOG_ERROR, "invalid sample_fmt\n"); return -1; } switch(avctx->codec->id) { case CODEC_ID_PCM_U32LE: ENCODE(uint32_t, le32, samples, dst, n, 0, 0x80000000) break; case CODEC_ID_PCM_U32BE: ENCODE(uint32_t, be32, samples, dst, n, 0, 0x80000000) break; case CODEC_ID_PCM_S24LE: ENCODE(int32_t, le24, samples, dst, n, 8, 0) break; case CODEC_ID_PCM_S24BE: ENCODE(int32_t, be24, samples, dst, n, 8, 0) break; case CODEC_ID_PCM_U24LE: ENCODE(uint32_t, le24, samples, dst, n, 8, 0x800000) break; case CODEC_ID_PCM_U24BE: ENCODE(uint32_t, be24, samples, dst, n, 8, 0x800000) break; case CODEC_ID_PCM_S24DAUD: for(;n>0;n--) { uint32_t tmp = av_reverse[(*samples >> 8) & 0xff] + (av_reverse[*samples & 0xff] << 8); tmp <<= 4; // sync flags would go here bytestream_put_be24(&dst, tmp); samples++; } break; case CODEC_ID_PCM_U16LE: ENCODE(uint16_t, le16, samples, dst, n, 0, 0x8000) break; case CODEC_ID_PCM_U16BE: ENCODE(uint16_t, be16, samples, dst, n, 0, 0x8000) break; case CODEC_ID_PCM_S8: srcu8= data; for(;n>0;n--) { v = *srcu8++; *dst++ = v - 128; } break; #if HAVE_BIGENDIAN case CODEC_ID_PCM_F64LE: ENCODE(int64_t, le64, samples, dst, n, 0, 0) break; case CODEC_ID_PCM_S32LE: case CODEC_ID_PCM_F32LE: ENCODE(int32_t, le32, samples, dst, n, 0, 0) break; case CODEC_ID_PCM_S16LE: ENCODE(int16_t, le16, samples, dst, n, 0, 0) break; case CODEC_ID_PCM_F64BE: case CODEC_ID_PCM_F32BE: case CODEC_ID_PCM_S32BE: case CODEC_ID_PCM_S16BE: #else case CODEC_ID_PCM_F64BE: ENCODE(int64_t, be64, samples, dst, n, 0, 0) break; case CODEC_ID_PCM_F32BE: case CODEC_ID_PCM_S32BE: ENCODE(int32_t, be32, samples, dst, n, 0, 0) break; case CODEC_ID_PCM_S16BE: ENCODE(int16_t, be16, samples, dst, n, 0, 0) break; case CODEC_ID_PCM_F64LE: case CODEC_ID_PCM_F32LE: case CODEC_ID_PCM_S32LE: case CODEC_ID_PCM_S16LE: #endif /* HAVE_BIGENDIAN */ case CODEC_ID_PCM_U8: memcpy(dst, samples, n*sample_size); dst += n*sample_size; break; case CODEC_ID_PCM_ZORK: for(;n>0;n--) { v= *samples++ >> 8; if(v<0) v = -v; else v+= 128; *dst++ = v; } break; case CODEC_ID_PCM_ALAW: for(;n>0;n--) { v = *samples++; *dst++ = linear_to_alaw[(v + 32768) >> 2]; } break; case CODEC_ID_PCM_MULAW: for(;n>0;n--) { v = *samples++; *dst++ = linear_to_ulaw[(v + 32768) >> 2]; } break; default: return -1; } //avctx->frame_size = (dst - frame) / (sample_size * avctx->channels); return dst - frame; }
false
FFmpeg
06af335a33a771bad05dc1873c3f9d8e84abfb45
static int pcm_encode_frame(AVCodecContext *avctx, unsigned char *frame, int buf_size, void *data) { int n, sample_size, v; const short *samples; unsigned char *dst; const uint8_t *srcu8; const int16_t *samples_int16_t; const int32_t *samples_int32_t; const int64_t *samples_int64_t; const uint16_t *samples_uint16_t; const uint32_t *samples_uint32_t; sample_size = av_get_bits_per_sample(avctx->codec->id)/8; n = buf_size / sample_size; samples = data; dst = frame; if (avctx->sample_fmt!=avctx->codec->sample_fmts[0]) { av_log(avctx, AV_LOG_ERROR, "invalid sample_fmt\n"); return -1; } switch(avctx->codec->id) { case CODEC_ID_PCM_U32LE: ENCODE(uint32_t, le32, samples, dst, n, 0, 0x80000000) break; case CODEC_ID_PCM_U32BE: ENCODE(uint32_t, be32, samples, dst, n, 0, 0x80000000) break; case CODEC_ID_PCM_S24LE: ENCODE(int32_t, le24, samples, dst, n, 8, 0) break; case CODEC_ID_PCM_S24BE: ENCODE(int32_t, be24, samples, dst, n, 8, 0) break; case CODEC_ID_PCM_U24LE: ENCODE(uint32_t, le24, samples, dst, n, 8, 0x800000) break; case CODEC_ID_PCM_U24BE: ENCODE(uint32_t, be24, samples, dst, n, 8, 0x800000) break; case CODEC_ID_PCM_S24DAUD: for(;n>0;n--) { uint32_t tmp = av_reverse[(*samples >> 8) & 0xff] + (av_reverse[*samples & 0xff] << 8); tmp <<= 4; bytestream_put_be24(&dst, tmp); samples++; } break; case CODEC_ID_PCM_U16LE: ENCODE(uint16_t, le16, samples, dst, n, 0, 0x8000) break; case CODEC_ID_PCM_U16BE: ENCODE(uint16_t, be16, samples, dst, n, 0, 0x8000) break; case CODEC_ID_PCM_S8: srcu8= data; for(;n>0;n--) { v = *srcu8++; *dst++ = v - 128; } break; #if HAVE_BIGENDIAN case CODEC_ID_PCM_F64LE: ENCODE(int64_t, le64, samples, dst, n, 0, 0) break; case CODEC_ID_PCM_S32LE: case CODEC_ID_PCM_F32LE: ENCODE(int32_t, le32, samples, dst, n, 0, 0) break; case CODEC_ID_PCM_S16LE: ENCODE(int16_t, le16, samples, dst, n, 0, 0) break; case CODEC_ID_PCM_F64BE: case CODEC_ID_PCM_F32BE: case CODEC_ID_PCM_S32BE: case CODEC_ID_PCM_S16BE: #else case CODEC_ID_PCM_F64BE: ENCODE(int64_t, be64, samples, dst, n, 0, 0) break; case CODEC_ID_PCM_F32BE: case CODEC_ID_PCM_S32BE: ENCODE(int32_t, be32, samples, dst, n, 0, 0) break; case CODEC_ID_PCM_S16BE: ENCODE(int16_t, be16, samples, dst, n, 0, 0) break; case CODEC_ID_PCM_F64LE: case CODEC_ID_PCM_F32LE: case CODEC_ID_PCM_S32LE: case CODEC_ID_PCM_S16LE: #endif case CODEC_ID_PCM_U8: memcpy(dst, samples, n*sample_size); dst += n*sample_size; break; case CODEC_ID_PCM_ZORK: for(;n>0;n--) { v= *samples++ >> 8; if(v<0) v = -v; else v+= 128; *dst++ = v; } break; case CODEC_ID_PCM_ALAW: for(;n>0;n--) { v = *samples++; *dst++ = linear_to_alaw[(v + 32768) >> 2]; } break; case CODEC_ID_PCM_MULAW: for(;n>0;n--) { v = *samples++; *dst++ = linear_to_ulaw[(v + 32768) >> 2]; } break; default: return -1; } return dst - frame; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, unsigned char *VAR_1, int VAR_2, void *VAR_3) { int VAR_4, VAR_5, VAR_6; const short *VAR_7; unsigned char *VAR_8; const uint8_t *VAR_9; const int16_t *VAR_10; const int32_t *VAR_11; const int64_t *VAR_12; const uint16_t *VAR_13; const uint32_t *VAR_14; VAR_5 = av_get_bits_per_sample(VAR_0->codec->id)/8; VAR_4 = VAR_2 / VAR_5; VAR_7 = VAR_3; VAR_8 = VAR_1; if (VAR_0->sample_fmt!=VAR_0->codec->sample_fmts[0]) { av_log(VAR_0, AV_LOG_ERROR, "invalid sample_fmt\VAR_4"); return -1; } switch(VAR_0->codec->id) { case CODEC_ID_PCM_U32LE: ENCODE(uint32_t, le32, VAR_7, VAR_8, VAR_4, 0, 0x80000000) break; case CODEC_ID_PCM_U32BE: ENCODE(uint32_t, be32, VAR_7, VAR_8, VAR_4, 0, 0x80000000) break; case CODEC_ID_PCM_S24LE: ENCODE(int32_t, le24, VAR_7, VAR_8, VAR_4, 8, 0) break; case CODEC_ID_PCM_S24BE: ENCODE(int32_t, be24, VAR_7, VAR_8, VAR_4, 8, 0) break; case CODEC_ID_PCM_U24LE: ENCODE(uint32_t, le24, VAR_7, VAR_8, VAR_4, 8, 0x800000) break; case CODEC_ID_PCM_U24BE: ENCODE(uint32_t, be24, VAR_7, VAR_8, VAR_4, 8, 0x800000) break; case CODEC_ID_PCM_S24DAUD: for(;VAR_4>0;VAR_4--) { uint32_t tmp = av_reverse[(*VAR_7 >> 8) & 0xff] + (av_reverse[*VAR_7 & 0xff] << 8); tmp <<= 4; bytestream_put_be24(&VAR_8, tmp); VAR_7++; } break; case CODEC_ID_PCM_U16LE: ENCODE(uint16_t, le16, VAR_7, VAR_8, VAR_4, 0, 0x8000) break; case CODEC_ID_PCM_U16BE: ENCODE(uint16_t, be16, VAR_7, VAR_8, VAR_4, 0, 0x8000) break; case CODEC_ID_PCM_S8: VAR_9= VAR_3; for(;VAR_4>0;VAR_4--) { VAR_6 = *VAR_9++; *VAR_8++ = VAR_6 - 128; } break; #if HAVE_BIGENDIAN case CODEC_ID_PCM_F64LE: ENCODE(int64_t, le64, VAR_7, VAR_8, VAR_4, 0, 0) break; case CODEC_ID_PCM_S32LE: case CODEC_ID_PCM_F32LE: ENCODE(int32_t, le32, VAR_7, VAR_8, VAR_4, 0, 0) break; case CODEC_ID_PCM_S16LE: ENCODE(int16_t, le16, VAR_7, VAR_8, VAR_4, 0, 0) break; case CODEC_ID_PCM_F64BE: case CODEC_ID_PCM_F32BE: case CODEC_ID_PCM_S32BE: case CODEC_ID_PCM_S16BE: #else case CODEC_ID_PCM_F64BE: ENCODE(int64_t, be64, VAR_7, VAR_8, VAR_4, 0, 0) break; case CODEC_ID_PCM_F32BE: case CODEC_ID_PCM_S32BE: ENCODE(int32_t, be32, VAR_7, VAR_8, VAR_4, 0, 0) break; case CODEC_ID_PCM_S16BE: ENCODE(int16_t, be16, VAR_7, VAR_8, VAR_4, 0, 0) break; case CODEC_ID_PCM_F64LE: case CODEC_ID_PCM_F32LE: case CODEC_ID_PCM_S32LE: case CODEC_ID_PCM_S16LE: #endif case CODEC_ID_PCM_U8: memcpy(VAR_8, VAR_7, VAR_4*VAR_5); VAR_8 += VAR_4*VAR_5; break; case CODEC_ID_PCM_ZORK: for(;VAR_4>0;VAR_4--) { VAR_6= *VAR_7++ >> 8; if(VAR_6<0) VAR_6 = -VAR_6; else VAR_6+= 128; *VAR_8++ = VAR_6; } break; case CODEC_ID_PCM_ALAW: for(;VAR_4>0;VAR_4--) { VAR_6 = *VAR_7++; *VAR_8++ = linear_to_alaw[(VAR_6 + 32768) >> 2]; } break; case CODEC_ID_PCM_MULAW: for(;VAR_4>0;VAR_4--) { VAR_6 = *VAR_7++; *VAR_8++ = linear_to_ulaw[(VAR_6 + 32768) >> 2]; } break; default: return -1; } return VAR_8 - VAR_1; }
[ "static int FUNC_0(AVCodecContext *VAR_0,\nunsigned char *VAR_1, int VAR_2, void *VAR_3)\n{", "int VAR_4, VAR_5, VAR_6;", "const short *VAR_7;", "unsigned char *VAR_8;", "const uint8_t *VAR_9;", "const int16_t *VAR_10;", "const int32_t *VAR_11;", "const int64_t *VAR_12;", "const uint16_t *VAR_13;", "const uint32_t *VAR_14;", "VAR_5 = av_get_bits_per_sample(VAR_0->codec->id)/8;", "VAR_4 = VAR_2 / VAR_5;", "VAR_7 = VAR_3;", "VAR_8 = VAR_1;", "if (VAR_0->sample_fmt!=VAR_0->codec->sample_fmts[0]) {", "av_log(VAR_0, AV_LOG_ERROR, \"invalid sample_fmt\\VAR_4\");", "return -1;", "}", "switch(VAR_0->codec->id) {", "case CODEC_ID_PCM_U32LE:\nENCODE(uint32_t, le32, VAR_7, VAR_8, VAR_4, 0, 0x80000000)\nbreak;", "case CODEC_ID_PCM_U32BE:\nENCODE(uint32_t, be32, VAR_7, VAR_8, VAR_4, 0, 0x80000000)\nbreak;", "case CODEC_ID_PCM_S24LE:\nENCODE(int32_t, le24, VAR_7, VAR_8, VAR_4, 8, 0)\nbreak;", "case CODEC_ID_PCM_S24BE:\nENCODE(int32_t, be24, VAR_7, VAR_8, VAR_4, 8, 0)\nbreak;", "case CODEC_ID_PCM_U24LE:\nENCODE(uint32_t, le24, VAR_7, VAR_8, VAR_4, 8, 0x800000)\nbreak;", "case CODEC_ID_PCM_U24BE:\nENCODE(uint32_t, be24, VAR_7, VAR_8, VAR_4, 8, 0x800000)\nbreak;", "case CODEC_ID_PCM_S24DAUD:\nfor(;VAR_4>0;VAR_4--) {", "uint32_t tmp = av_reverse[(*VAR_7 >> 8) & 0xff] +\n(av_reverse[*VAR_7 & 0xff] << 8);", "tmp <<= 4;", "bytestream_put_be24(&VAR_8, tmp);", "VAR_7++;", "}", "break;", "case CODEC_ID_PCM_U16LE:\nENCODE(uint16_t, le16, VAR_7, VAR_8, VAR_4, 0, 0x8000)\nbreak;", "case CODEC_ID_PCM_U16BE:\nENCODE(uint16_t, be16, VAR_7, VAR_8, VAR_4, 0, 0x8000)\nbreak;", "case CODEC_ID_PCM_S8:\nVAR_9= VAR_3;", "for(;VAR_4>0;VAR_4--) {", "VAR_6 = *VAR_9++;", "*VAR_8++ = VAR_6 - 128;", "}", "break;", "#if HAVE_BIGENDIAN\ncase CODEC_ID_PCM_F64LE:\nENCODE(int64_t, le64, VAR_7, VAR_8, VAR_4, 0, 0)\nbreak;", "case CODEC_ID_PCM_S32LE:\ncase CODEC_ID_PCM_F32LE:\nENCODE(int32_t, le32, VAR_7, VAR_8, VAR_4, 0, 0)\nbreak;", "case CODEC_ID_PCM_S16LE:\nENCODE(int16_t, le16, VAR_7, VAR_8, VAR_4, 0, 0)\nbreak;", "case CODEC_ID_PCM_F64BE:\ncase CODEC_ID_PCM_F32BE:\ncase CODEC_ID_PCM_S32BE:\ncase CODEC_ID_PCM_S16BE:\n#else\ncase CODEC_ID_PCM_F64BE:\nENCODE(int64_t, be64, VAR_7, VAR_8, VAR_4, 0, 0)\nbreak;", "case CODEC_ID_PCM_F32BE:\ncase CODEC_ID_PCM_S32BE:\nENCODE(int32_t, be32, VAR_7, VAR_8, VAR_4, 0, 0)\nbreak;", "case CODEC_ID_PCM_S16BE:\nENCODE(int16_t, be16, VAR_7, VAR_8, VAR_4, 0, 0)\nbreak;", "case CODEC_ID_PCM_F64LE:\ncase CODEC_ID_PCM_F32LE:\ncase CODEC_ID_PCM_S32LE:\ncase CODEC_ID_PCM_S16LE:\n#endif\ncase CODEC_ID_PCM_U8:\nmemcpy(VAR_8, VAR_7, VAR_4*VAR_5);", "VAR_8 += VAR_4*VAR_5;", "break;", "case CODEC_ID_PCM_ZORK:\nfor(;VAR_4>0;VAR_4--) {", "VAR_6= *VAR_7++ >> 8;", "if(VAR_6<0) VAR_6 = -VAR_6;", "else VAR_6+= 128;", "*VAR_8++ = VAR_6;", "}", "break;", "case CODEC_ID_PCM_ALAW:\nfor(;VAR_4>0;VAR_4--) {", "VAR_6 = *VAR_7++;", "*VAR_8++ = linear_to_alaw[(VAR_6 + 32768) >> 2];", "}", "break;", "case CODEC_ID_PCM_MULAW:\nfor(;VAR_4>0;VAR_4--) {", "VAR_6 = *VAR_7++;", "*VAR_8++ = linear_to_ulaw[(VAR_6 + 32768) >> 2];", "}", "break;", "default:\nreturn -1;", "}", "return VAR_8 - VAR_1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 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, 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 ], [ 249 ], [ 251 ] ]
18,418
static int exif_add_metadata(AVCodecContext *avctx, int count, int type, const char *name, const char *sep, GetByteContext *gb, int le, AVDictionary **metadata) { switch(type) { case 0: av_log(avctx, AV_LOG_WARNING, "Invalid TIFF tag type 0 found for %s with size %d\n", name, count); return 0; case TIFF_DOUBLE : return ff_tadd_doubles_metadata(count, name, sep, gb, le, metadata); case TIFF_SSHORT : return ff_tadd_shorts_metadata(count, name, sep, gb, le, 1, metadata); case TIFF_SHORT : return ff_tadd_shorts_metadata(count, name, sep, gb, le, 0, metadata); case TIFF_SBYTE : return ff_tadd_bytes_metadata(count, name, sep, gb, le, 1, metadata); case TIFF_BYTE : case TIFF_UNDEFINED: return ff_tadd_bytes_metadata(count, name, sep, gb, le, 0, metadata); case TIFF_STRING : return ff_tadd_string_metadata(count, name, gb, le, metadata); case TIFF_SRATIONAL: case TIFF_RATIONAL : return ff_tadd_rational_metadata(count, name, sep, gb, le, metadata); case TIFF_SLONG : case TIFF_LONG : return ff_tadd_long_metadata(count, name, sep, gb, le, metadata); default: avpriv_request_sample(avctx, "TIFF tag type (%u)", type); return 0; }; }
false
FFmpeg
ce87711df563a9d2d0537a062b86bb91b15ea1a0
static int exif_add_metadata(AVCodecContext *avctx, int count, int type, const char *name, const char *sep, GetByteContext *gb, int le, AVDictionary **metadata) { switch(type) { case 0: av_log(avctx, AV_LOG_WARNING, "Invalid TIFF tag type 0 found for %s with size %d\n", name, count); return 0; case TIFF_DOUBLE : return ff_tadd_doubles_metadata(count, name, sep, gb, le, metadata); case TIFF_SSHORT : return ff_tadd_shorts_metadata(count, name, sep, gb, le, 1, metadata); case TIFF_SHORT : return ff_tadd_shorts_metadata(count, name, sep, gb, le, 0, metadata); case TIFF_SBYTE : return ff_tadd_bytes_metadata(count, name, sep, gb, le, 1, metadata); case TIFF_BYTE : case TIFF_UNDEFINED: return ff_tadd_bytes_metadata(count, name, sep, gb, le, 0, metadata); case TIFF_STRING : return ff_tadd_string_metadata(count, name, gb, le, metadata); case TIFF_SRATIONAL: case TIFF_RATIONAL : return ff_tadd_rational_metadata(count, name, sep, gb, le, metadata); case TIFF_SLONG : case TIFF_LONG : return ff_tadd_long_metadata(count, name, sep, gb, le, metadata); default: avpriv_request_sample(avctx, "TIFF tag type (%u)", type); return 0; }; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, int VAR_1, int VAR_2, const char *VAR_3, const char *VAR_4, GetByteContext *VAR_5, int VAR_6, AVDictionary **VAR_7) { switch(VAR_2) { case 0: av_log(VAR_0, AV_LOG_WARNING, "Invalid TIFF tag VAR_2 0 found for %s with size %d\n", VAR_3, VAR_1); return 0; case TIFF_DOUBLE : return ff_tadd_doubles_metadata(VAR_1, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7); case TIFF_SSHORT : return ff_tadd_shorts_metadata(VAR_1, VAR_3, VAR_4, VAR_5, VAR_6, 1, VAR_7); case TIFF_SHORT : return ff_tadd_shorts_metadata(VAR_1, VAR_3, VAR_4, VAR_5, VAR_6, 0, VAR_7); case TIFF_SBYTE : return ff_tadd_bytes_metadata(VAR_1, VAR_3, VAR_4, VAR_5, VAR_6, 1, VAR_7); case TIFF_BYTE : case TIFF_UNDEFINED: return ff_tadd_bytes_metadata(VAR_1, VAR_3, VAR_4, VAR_5, VAR_6, 0, VAR_7); case TIFF_STRING : return ff_tadd_string_metadata(VAR_1, VAR_3, VAR_5, VAR_6, VAR_7); case TIFF_SRATIONAL: case TIFF_RATIONAL : return ff_tadd_rational_metadata(VAR_1, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7); case TIFF_SLONG : case TIFF_LONG : return ff_tadd_long_metadata(VAR_1, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7); default: avpriv_request_sample(VAR_0, "TIFF tag VAR_2 (%u)", VAR_2); return 0; }; }
[ "static int FUNC_0(AVCodecContext *VAR_0, int VAR_1, int VAR_2,\nconst char *VAR_3, const char *VAR_4,\nGetByteContext *VAR_5, int VAR_6,\nAVDictionary **VAR_7)\n{", "switch(VAR_2) {", "case 0:\nav_log(VAR_0, AV_LOG_WARNING,\n\"Invalid TIFF tag VAR_2 0 found for %s with size %d\\n\",\nVAR_3, VAR_1);", "return 0;", "case TIFF_DOUBLE : return ff_tadd_doubles_metadata(VAR_1, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7);", "case TIFF_SSHORT : return ff_tadd_shorts_metadata(VAR_1, VAR_3, VAR_4, VAR_5, VAR_6, 1, VAR_7);", "case TIFF_SHORT : return ff_tadd_shorts_metadata(VAR_1, VAR_3, VAR_4, VAR_5, VAR_6, 0, VAR_7);", "case TIFF_SBYTE : return ff_tadd_bytes_metadata(VAR_1, VAR_3, VAR_4, VAR_5, VAR_6, 1, VAR_7);", "case TIFF_BYTE :\ncase TIFF_UNDEFINED: return ff_tadd_bytes_metadata(VAR_1, VAR_3, VAR_4, VAR_5, VAR_6, 0, VAR_7);", "case TIFF_STRING : return ff_tadd_string_metadata(VAR_1, VAR_3, VAR_5, VAR_6, VAR_7);", "case TIFF_SRATIONAL:\ncase TIFF_RATIONAL : return ff_tadd_rational_metadata(VAR_1, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7);", "case TIFF_SLONG :\ncase TIFF_LONG : return ff_tadd_long_metadata(VAR_1, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7);", "default:\navpriv_request_sample(VAR_0, \"TIFF tag VAR_2 (%u)\", VAR_2);", "return 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 ] ]
18,420
static int mtv_probe(AVProbeData *p) { if(p->buf_size < 3) return 0; /* Magic is 'AMV' */ if(*(p->buf) != 'A' || *(p->buf+1) != 'M' || *(p->buf+2) != 'V') return 0; return AVPROBE_SCORE_MAX; }
false
FFmpeg
87e8788680e16c51f6048af26f3f7830c35207a5
static int mtv_probe(AVProbeData *p) { if(p->buf_size < 3) return 0; if(*(p->buf) != 'A' || *(p->buf+1) != 'M' || *(p->buf+2) != 'V') return 0; return AVPROBE_SCORE_MAX; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVProbeData *VAR_0) { if(VAR_0->buf_size < 3) return 0; if(*(VAR_0->buf) != 'A' || *(VAR_0->buf+1) != 'M' || *(VAR_0->buf+2) != 'V') return 0; return AVPROBE_SCORE_MAX; }
[ "static int FUNC_0(AVProbeData *VAR_0)\n{", "if(VAR_0->buf_size < 3)\nreturn 0;", "if(*(VAR_0->buf) != 'A' || *(VAR_0->buf+1) != 'M' || *(VAR_0->buf+2) != 'V')\nreturn 0;", "return AVPROBE_SCORE_MAX;", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 15, 17 ], [ 21 ], [ 23 ] ]
18,421
static int vmd_probe(AVProbeData *p) { if (p->buf_size < 2) return 0; /* check if the first 2 bytes of the file contain the appropriate size * of a VMD header chunk */ if (AV_RL16(&p->buf[0]) != VMD_HEADER_SIZE - 2) return 0; /* only return half certainty since this check is a bit sketchy */ return AVPROBE_SCORE_MAX / 2; }
false
FFmpeg
87e8788680e16c51f6048af26f3f7830c35207a5
static int vmd_probe(AVProbeData *p) { if (p->buf_size < 2) return 0; if (AV_RL16(&p->buf[0]) != VMD_HEADER_SIZE - 2) return 0; return AVPROBE_SCORE_MAX / 2; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVProbeData *VAR_0) { if (VAR_0->buf_size < 2) return 0; if (AV_RL16(&VAR_0->buf[0]) != VMD_HEADER_SIZE - 2) return 0; return AVPROBE_SCORE_MAX / 2; }
[ "static int FUNC_0(AVProbeData *VAR_0)\n{", "if (VAR_0->buf_size < 2)\nreturn 0;", "if (AV_RL16(&VAR_0->buf[0]) != VMD_HEADER_SIZE - 2)\nreturn 0;", "return AVPROBE_SCORE_MAX / 2;", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 15, 17 ], [ 23 ], [ 25 ] ]
18,422
voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size) { VocDecContext *voc = s->priv_data; AVCodecContext *dec = st->codec; ByteIOContext *pb = s->pb; VocType type; int size, tmp_codec; int sample_rate = 0; int channels = 1; while (!voc->remaining_size) { type = get_byte(pb); if (type == VOC_TYPE_EOF) return AVERROR(EIO); voc->remaining_size = get_le24(pb); if (!voc->remaining_size) { if (url_is_streamed(s->pb)) return AVERROR(EIO); voc->remaining_size = url_fsize(pb) - url_ftell(pb); } max_size -= 4; switch (type) { case VOC_TYPE_VOICE_DATA: dec->sample_rate = 1000000 / (256 - get_byte(pb)); if (sample_rate) dec->sample_rate = sample_rate; dec->channels = channels; tmp_codec = ff_codec_get_id(ff_voc_codec_tags, get_byte(pb)); if (dec->codec_id == CODEC_ID_NONE) dec->codec_id = tmp_codec; else if (dec->codec_id != tmp_codec) av_log(s, AV_LOG_WARNING, "Ignoring mid-stream change in audio codec\n"); dec->bits_per_coded_sample = av_get_bits_per_sample(dec->codec_id); voc->remaining_size -= 2; max_size -= 2; channels = 1; break; case VOC_TYPE_VOICE_DATA_CONT: break; case VOC_TYPE_EXTENDED: sample_rate = get_le16(pb); get_byte(pb); channels = get_byte(pb) + 1; sample_rate = 256000000 / (channels * (65536 - sample_rate)); voc->remaining_size = 0; max_size -= 4; break; case VOC_TYPE_NEW_VOICE_DATA: dec->sample_rate = get_le32(pb); dec->bits_per_coded_sample = get_byte(pb); dec->channels = get_byte(pb); tmp_codec = ff_codec_get_id(ff_voc_codec_tags, get_le16(pb)); if (dec->codec_id == CODEC_ID_NONE) dec->codec_id = tmp_codec; else if (dec->codec_id != tmp_codec) av_log(s, AV_LOG_WARNING, "Ignoring mid-stream change in audio codec\n"); url_fskip(pb, 4); voc->remaining_size -= 12; max_size -= 12; break; default: url_fskip(pb, voc->remaining_size); max_size -= voc->remaining_size; voc->remaining_size = 0; break; } if (dec->codec_id == CODEC_ID_NONE) { av_log(s, AV_LOG_ERROR, "Invalid codec_id\n"); if (s->audio_codec_id == CODEC_ID_NONE) return AVERROR(EINVAL); } } dec->bit_rate = dec->sample_rate * dec->bits_per_coded_sample; if (max_size <= 0) max_size = 2048; size = FFMIN(voc->remaining_size, max_size); voc->remaining_size -= size; return av_get_packet(pb, pkt, size); }
false
FFmpeg
f61cbc22d3ce8ec0e2644d0fa565413c057deaa0
voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size) { VocDecContext *voc = s->priv_data; AVCodecContext *dec = st->codec; ByteIOContext *pb = s->pb; VocType type; int size, tmp_codec; int sample_rate = 0; int channels = 1; while (!voc->remaining_size) { type = get_byte(pb); if (type == VOC_TYPE_EOF) return AVERROR(EIO); voc->remaining_size = get_le24(pb); if (!voc->remaining_size) { if (url_is_streamed(s->pb)) return AVERROR(EIO); voc->remaining_size = url_fsize(pb) - url_ftell(pb); } max_size -= 4; switch (type) { case VOC_TYPE_VOICE_DATA: dec->sample_rate = 1000000 / (256 - get_byte(pb)); if (sample_rate) dec->sample_rate = sample_rate; dec->channels = channels; tmp_codec = ff_codec_get_id(ff_voc_codec_tags, get_byte(pb)); if (dec->codec_id == CODEC_ID_NONE) dec->codec_id = tmp_codec; else if (dec->codec_id != tmp_codec) av_log(s, AV_LOG_WARNING, "Ignoring mid-stream change in audio codec\n"); dec->bits_per_coded_sample = av_get_bits_per_sample(dec->codec_id); voc->remaining_size -= 2; max_size -= 2; channels = 1; break; case VOC_TYPE_VOICE_DATA_CONT: break; case VOC_TYPE_EXTENDED: sample_rate = get_le16(pb); get_byte(pb); channels = get_byte(pb) + 1; sample_rate = 256000000 / (channels * (65536 - sample_rate)); voc->remaining_size = 0; max_size -= 4; break; case VOC_TYPE_NEW_VOICE_DATA: dec->sample_rate = get_le32(pb); dec->bits_per_coded_sample = get_byte(pb); dec->channels = get_byte(pb); tmp_codec = ff_codec_get_id(ff_voc_codec_tags, get_le16(pb)); if (dec->codec_id == CODEC_ID_NONE) dec->codec_id = tmp_codec; else if (dec->codec_id != tmp_codec) av_log(s, AV_LOG_WARNING, "Ignoring mid-stream change in audio codec\n"); url_fskip(pb, 4); voc->remaining_size -= 12; max_size -= 12; break; default: url_fskip(pb, voc->remaining_size); max_size -= voc->remaining_size; voc->remaining_size = 0; break; } if (dec->codec_id == CODEC_ID_NONE) { av_log(s, AV_LOG_ERROR, "Invalid codec_id\n"); if (s->audio_codec_id == CODEC_ID_NONE) return AVERROR(EINVAL); } } dec->bit_rate = dec->sample_rate * dec->bits_per_coded_sample; if (max_size <= 0) max_size = 2048; size = FFMIN(voc->remaining_size, max_size); voc->remaining_size -= size; return av_get_packet(pb, pkt, size); }
{ "code": [], "line_no": [] }
FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1, AVStream *VAR_2, int VAR_3) { VocDecContext *voc = VAR_0->priv_data; AVCodecContext *dec = VAR_2->codec; ByteIOContext *pb = VAR_0->pb; VocType type; int VAR_4, VAR_5; int VAR_6 = 0; int VAR_7 = 1; while (!voc->remaining_size) { type = get_byte(pb); if (type == VOC_TYPE_EOF) return AVERROR(EIO); voc->remaining_size = get_le24(pb); if (!voc->remaining_size) { if (url_is_streamed(VAR_0->pb)) return AVERROR(EIO); voc->remaining_size = url_fsize(pb) - url_ftell(pb); } VAR_3 -= 4; switch (type) { case VOC_TYPE_VOICE_DATA: dec->VAR_6 = 1000000 / (256 - get_byte(pb)); if (VAR_6) dec->VAR_6 = VAR_6; dec->VAR_7 = VAR_7; VAR_5 = ff_codec_get_id(ff_voc_codec_tags, get_byte(pb)); if (dec->codec_id == CODEC_ID_NONE) dec->codec_id = VAR_5; else if (dec->codec_id != VAR_5) av_log(VAR_0, AV_LOG_WARNING, "Ignoring mid-stream change in audio codec\n"); dec->bits_per_coded_sample = av_get_bits_per_sample(dec->codec_id); voc->remaining_size -= 2; VAR_3 -= 2; VAR_7 = 1; break; case VOC_TYPE_VOICE_DATA_CONT: break; case VOC_TYPE_EXTENDED: VAR_6 = get_le16(pb); get_byte(pb); VAR_7 = get_byte(pb) + 1; VAR_6 = 256000000 / (VAR_7 * (65536 - VAR_6)); voc->remaining_size = 0; VAR_3 -= 4; break; case VOC_TYPE_NEW_VOICE_DATA: dec->VAR_6 = get_le32(pb); dec->bits_per_coded_sample = get_byte(pb); dec->VAR_7 = get_byte(pb); VAR_5 = ff_codec_get_id(ff_voc_codec_tags, get_le16(pb)); if (dec->codec_id == CODEC_ID_NONE) dec->codec_id = VAR_5; else if (dec->codec_id != VAR_5) av_log(VAR_0, AV_LOG_WARNING, "Ignoring mid-stream change in audio codec\n"); url_fskip(pb, 4); voc->remaining_size -= 12; VAR_3 -= 12; break; default: url_fskip(pb, voc->remaining_size); VAR_3 -= voc->remaining_size; voc->remaining_size = 0; break; } if (dec->codec_id == CODEC_ID_NONE) { av_log(VAR_0, AV_LOG_ERROR, "Invalid codec_id\n"); if (VAR_0->audio_codec_id == CODEC_ID_NONE) return AVERROR(EINVAL); } } dec->bit_rate = dec->VAR_6 * dec->bits_per_coded_sample; if (VAR_3 <= 0) VAR_3 = 2048; VAR_4 = FFMIN(voc->remaining_size, VAR_3); voc->remaining_size -= VAR_4; return av_get_packet(pb, VAR_1, VAR_4); }
[ "FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1, AVStream *VAR_2, int VAR_3)\n{", "VocDecContext *voc = VAR_0->priv_data;", "AVCodecContext *dec = VAR_2->codec;", "ByteIOContext *pb = VAR_0->pb;", "VocType type;", "int VAR_4, VAR_5;", "int VAR_6 = 0;", "int VAR_7 = 1;", "while (!voc->remaining_size) {", "type = get_byte(pb);", "if (type == VOC_TYPE_EOF)\nreturn AVERROR(EIO);", "voc->remaining_size = get_le24(pb);", "if (!voc->remaining_size) {", "if (url_is_streamed(VAR_0->pb))\nreturn AVERROR(EIO);", "voc->remaining_size = url_fsize(pb) - url_ftell(pb);", "}", "VAR_3 -= 4;", "switch (type) {", "case VOC_TYPE_VOICE_DATA:\ndec->VAR_6 = 1000000 / (256 - get_byte(pb));", "if (VAR_6)\ndec->VAR_6 = VAR_6;", "dec->VAR_7 = VAR_7;", "VAR_5 = ff_codec_get_id(ff_voc_codec_tags, get_byte(pb));", "if (dec->codec_id == CODEC_ID_NONE)\ndec->codec_id = VAR_5;", "else if (dec->codec_id != VAR_5)\nav_log(VAR_0, AV_LOG_WARNING, \"Ignoring mid-stream change in audio codec\\n\");", "dec->bits_per_coded_sample = av_get_bits_per_sample(dec->codec_id);", "voc->remaining_size -= 2;", "VAR_3 -= 2;", "VAR_7 = 1;", "break;", "case VOC_TYPE_VOICE_DATA_CONT:\nbreak;", "case VOC_TYPE_EXTENDED:\nVAR_6 = get_le16(pb);", "get_byte(pb);", "VAR_7 = get_byte(pb) + 1;", "VAR_6 = 256000000 / (VAR_7 * (65536 - VAR_6));", "voc->remaining_size = 0;", "VAR_3 -= 4;", "break;", "case VOC_TYPE_NEW_VOICE_DATA:\ndec->VAR_6 = get_le32(pb);", "dec->bits_per_coded_sample = get_byte(pb);", "dec->VAR_7 = get_byte(pb);", "VAR_5 = ff_codec_get_id(ff_voc_codec_tags, get_le16(pb));", "if (dec->codec_id == CODEC_ID_NONE)\ndec->codec_id = VAR_5;", "else if (dec->codec_id != VAR_5)\nav_log(VAR_0, AV_LOG_WARNING, \"Ignoring mid-stream change in audio codec\\n\");", "url_fskip(pb, 4);", "voc->remaining_size -= 12;", "VAR_3 -= 12;", "break;", "default:\nurl_fskip(pb, voc->remaining_size);", "VAR_3 -= voc->remaining_size;", "voc->remaining_size = 0;", "break;", "}", "if (dec->codec_id == CODEC_ID_NONE) {", "av_log(VAR_0, AV_LOG_ERROR, \"Invalid codec_id\\n\");", "if (VAR_0->audio_codec_id == CODEC_ID_NONE) return AVERROR(EINVAL);", "}", "}", "dec->bit_rate = dec->VAR_6 * dec->bits_per_coded_sample;", "if (VAR_3 <= 0)\nVAR_3 = 2048;", "VAR_4 = FFMIN(voc->remaining_size, VAR_3);", "voc->remaining_size -= VAR_4;", "return av_get_packet(pb, VAR_1, VAR_4);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47, 49 ], [ 51, 53 ], [ 55 ], [ 57 ], [ 59, 61 ], [ 63, 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79, 81 ], [ 85, 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 103, 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113, 115 ], [ 117, 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 131, 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 155 ], [ 159, 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ] ]
18,423
static inline int mjpeg_decode_dc(MJpegDecodeContext *s, int dc_index) { int code; code = get_vlc2(&s->gb, s->vlcs[0][dc_index].table, 9, 2); if (code < 0) { av_log(s->avctx, AV_LOG_WARNING, "mjpeg_decode_dc: bad vlc: %d:%d (%p)\n", 0, dc_index, &s->vlcs[0][dc_index]); return 0xffff; } if (code) return get_xbits(&s->gb, code); else return 0; }
true
FFmpeg
6d6eabd399eb20b69d10234ef746f2d3d4c72dcb
static inline int mjpeg_decode_dc(MJpegDecodeContext *s, int dc_index) { int code; code = get_vlc2(&s->gb, s->vlcs[0][dc_index].table, 9, 2); if (code < 0) { av_log(s->avctx, AV_LOG_WARNING, "mjpeg_decode_dc: bad vlc: %d:%d (%p)\n", 0, dc_index, &s->vlcs[0][dc_index]); return 0xffff; } if (code) return get_xbits(&s->gb, code); else return 0; }
{ "code": [ " if (code < 0) {" ], "line_no": [ 9 ] }
static inline int FUNC_0(MJpegDecodeContext *VAR_0, int VAR_1) { int VAR_2; VAR_2 = get_vlc2(&VAR_0->gb, VAR_0->vlcs[0][VAR_1].table, 9, 2); if (VAR_2 < 0) { av_log(VAR_0->avctx, AV_LOG_WARNING, "FUNC_0: bad vlc: %d:%d (%p)\n", 0, VAR_1, &VAR_0->vlcs[0][VAR_1]); return 0xffff; } if (VAR_2) return get_xbits(&VAR_0->gb, VAR_2); else return 0; }
[ "static inline int FUNC_0(MJpegDecodeContext *VAR_0, int VAR_1)\n{", "int VAR_2;", "VAR_2 = get_vlc2(&VAR_0->gb, VAR_0->vlcs[0][VAR_1].table, 9, 2);", "if (VAR_2 < 0) {", "av_log(VAR_0->avctx, AV_LOG_WARNING,\n\"FUNC_0: bad vlc: %d:%d (%p)\\n\",\n0, VAR_1, &VAR_0->vlcs[0][VAR_1]);", "return 0xffff;", "}", "if (VAR_2)\nreturn get_xbits(&VAR_0->gb, VAR_2);", "else\nreturn 0;", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11, 13, 15 ], [ 17 ], [ 19 ], [ 23, 25 ], [ 27, 29 ], [ 31 ] ]
18,424
static void palmte_init(MachineState *machine) { const char *cpu_model = machine->cpu_model; const char *kernel_filename = machine->kernel_filename; const char *kernel_cmdline = machine->kernel_cmdline; const char *initrd_filename = machine->initrd_filename; MemoryRegion *address_space_mem = get_system_memory(); struct omap_mpu_state_s *mpu; int flash_size = 0x00800000; int sdram_size = palmte_binfo.ram_size; static uint32_t cs0val = 0xffffffff; static uint32_t cs1val = 0x0000e1a0; static uint32_t cs2val = 0x0000e1a0; static uint32_t cs3val = 0xe1a0e1a0; int rom_size, rom_loaded = 0; MemoryRegion *flash = g_new(MemoryRegion, 1); MemoryRegion *cs = g_new(MemoryRegion, 4); mpu = omap310_mpu_init(address_space_mem, sdram_size, cpu_model); /* External Flash (EMIFS) */ memory_region_init_ram(flash, NULL, "palmte.flash", flash_size, &error_abort); vmstate_register_ram_global(flash); memory_region_set_readonly(flash, true); memory_region_add_subregion(address_space_mem, OMAP_CS0_BASE, flash); memory_region_init_io(&cs[0], NULL, &static_ops, &cs0val, "palmte-cs0", OMAP_CS0_SIZE - flash_size); memory_region_add_subregion(address_space_mem, OMAP_CS0_BASE + flash_size, &cs[0]); memory_region_init_io(&cs[1], NULL, &static_ops, &cs1val, "palmte-cs1", OMAP_CS1_SIZE); memory_region_add_subregion(address_space_mem, OMAP_CS1_BASE, &cs[1]); memory_region_init_io(&cs[2], NULL, &static_ops, &cs2val, "palmte-cs2", OMAP_CS2_SIZE); memory_region_add_subregion(address_space_mem, OMAP_CS2_BASE, &cs[2]); memory_region_init_io(&cs[3], NULL, &static_ops, &cs3val, "palmte-cs3", OMAP_CS3_SIZE); memory_region_add_subregion(address_space_mem, OMAP_CS3_BASE, &cs[3]); palmte_microwire_setup(mpu); qemu_add_kbd_event_handler(palmte_button_event, mpu); palmte_gpio_setup(mpu); /* Setup initial (reset) machine state */ if (nb_option_roms) { rom_size = get_image_size(option_rom[0].name); if (rom_size > flash_size) { fprintf(stderr, "%s: ROM image too big (%x > %x)\n", __FUNCTION__, rom_size, flash_size); rom_size = 0; } if (rom_size > 0) { rom_size = load_image_targphys(option_rom[0].name, OMAP_CS0_BASE, flash_size); rom_loaded = 1; } if (rom_size < 0) { fprintf(stderr, "%s: error loading '%s'\n", __FUNCTION__, option_rom[0].name); } } if (!rom_loaded && !kernel_filename && !qtest_enabled()) { fprintf(stderr, "Kernel or ROM image must be specified\n"); exit(1); } /* Load the kernel. */ palmte_binfo.kernel_filename = kernel_filename; palmte_binfo.kernel_cmdline = kernel_cmdline; palmte_binfo.initrd_filename = initrd_filename; arm_load_kernel(mpu->cpu, &palmte_binfo); }
true
qemu
f8ed85ac992c48814d916d5df4d44f9a971c5de4
static void palmte_init(MachineState *machine) { const char *cpu_model = machine->cpu_model; const char *kernel_filename = machine->kernel_filename; const char *kernel_cmdline = machine->kernel_cmdline; const char *initrd_filename = machine->initrd_filename; MemoryRegion *address_space_mem = get_system_memory(); struct omap_mpu_state_s *mpu; int flash_size = 0x00800000; int sdram_size = palmte_binfo.ram_size; static uint32_t cs0val = 0xffffffff; static uint32_t cs1val = 0x0000e1a0; static uint32_t cs2val = 0x0000e1a0; static uint32_t cs3val = 0xe1a0e1a0; int rom_size, rom_loaded = 0; MemoryRegion *flash = g_new(MemoryRegion, 1); MemoryRegion *cs = g_new(MemoryRegion, 4); mpu = omap310_mpu_init(address_space_mem, sdram_size, cpu_model); memory_region_init_ram(flash, NULL, "palmte.flash", flash_size, &error_abort); vmstate_register_ram_global(flash); memory_region_set_readonly(flash, true); memory_region_add_subregion(address_space_mem, OMAP_CS0_BASE, flash); memory_region_init_io(&cs[0], NULL, &static_ops, &cs0val, "palmte-cs0", OMAP_CS0_SIZE - flash_size); memory_region_add_subregion(address_space_mem, OMAP_CS0_BASE + flash_size, &cs[0]); memory_region_init_io(&cs[1], NULL, &static_ops, &cs1val, "palmte-cs1", OMAP_CS1_SIZE); memory_region_add_subregion(address_space_mem, OMAP_CS1_BASE, &cs[1]); memory_region_init_io(&cs[2], NULL, &static_ops, &cs2val, "palmte-cs2", OMAP_CS2_SIZE); memory_region_add_subregion(address_space_mem, OMAP_CS2_BASE, &cs[2]); memory_region_init_io(&cs[3], NULL, &static_ops, &cs3val, "palmte-cs3", OMAP_CS3_SIZE); memory_region_add_subregion(address_space_mem, OMAP_CS3_BASE, &cs[3]); palmte_microwire_setup(mpu); qemu_add_kbd_event_handler(palmte_button_event, mpu); palmte_gpio_setup(mpu); if (nb_option_roms) { rom_size = get_image_size(option_rom[0].name); if (rom_size > flash_size) { fprintf(stderr, "%s: ROM image too big (%x > %x)\n", __FUNCTION__, rom_size, flash_size); rom_size = 0; } if (rom_size > 0) { rom_size = load_image_targphys(option_rom[0].name, OMAP_CS0_BASE, flash_size); rom_loaded = 1; } if (rom_size < 0) { fprintf(stderr, "%s: error loading '%s'\n", __FUNCTION__, option_rom[0].name); } } if (!rom_loaded && !kernel_filename && !qtest_enabled()) { fprintf(stderr, "Kernel or ROM image must be specified\n"); exit(1); } palmte_binfo.kernel_filename = kernel_filename; palmte_binfo.kernel_cmdline = kernel_cmdline; palmte_binfo.initrd_filename = initrd_filename; arm_load_kernel(mpu->cpu, &palmte_binfo); }
{ "code": [ " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);" ], "line_no": [ 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45 ] }
static void FUNC_0(MachineState *VAR_0) { const char *VAR_1 = VAR_0->VAR_1; const char *VAR_2 = VAR_0->VAR_2; const char *VAR_3 = VAR_0->VAR_3; const char *VAR_4 = VAR_0->VAR_4; MemoryRegion *address_space_mem = get_system_memory(); struct omap_mpu_state_s *VAR_5; int VAR_6 = 0x00800000; int VAR_7 = palmte_binfo.ram_size; static uint32_t VAR_8 = 0xffffffff; static uint32_t VAR_9 = 0x0000e1a0; static uint32_t VAR_10 = 0x0000e1a0; static uint32_t VAR_11 = 0xe1a0e1a0; int VAR_12, VAR_13 = 0; MemoryRegion *flash = g_new(MemoryRegion, 1); MemoryRegion *cs = g_new(MemoryRegion, 4); VAR_5 = omap310_mpu_init(address_space_mem, VAR_7, VAR_1); memory_region_init_ram(flash, NULL, "palmte.flash", VAR_6, &error_abort); vmstate_register_ram_global(flash); memory_region_set_readonly(flash, true); memory_region_add_subregion(address_space_mem, OMAP_CS0_BASE, flash); memory_region_init_io(&cs[0], NULL, &static_ops, &VAR_8, "palmte-cs0", OMAP_CS0_SIZE - VAR_6); memory_region_add_subregion(address_space_mem, OMAP_CS0_BASE + VAR_6, &cs[0]); memory_region_init_io(&cs[1], NULL, &static_ops, &VAR_9, "palmte-cs1", OMAP_CS1_SIZE); memory_region_add_subregion(address_space_mem, OMAP_CS1_BASE, &cs[1]); memory_region_init_io(&cs[2], NULL, &static_ops, &VAR_10, "palmte-cs2", OMAP_CS2_SIZE); memory_region_add_subregion(address_space_mem, OMAP_CS2_BASE, &cs[2]); memory_region_init_io(&cs[3], NULL, &static_ops, &VAR_11, "palmte-cs3", OMAP_CS3_SIZE); memory_region_add_subregion(address_space_mem, OMAP_CS3_BASE, &cs[3]); palmte_microwire_setup(VAR_5); qemu_add_kbd_event_handler(palmte_button_event, VAR_5); palmte_gpio_setup(VAR_5); if (nb_option_roms) { VAR_12 = get_image_size(option_rom[0].name); if (VAR_12 > VAR_6) { fprintf(stderr, "%s: ROM image too big (%x > %x)\n", __FUNCTION__, VAR_12, VAR_6); VAR_12 = 0; } if (VAR_12 > 0) { VAR_12 = load_image_targphys(option_rom[0].name, OMAP_CS0_BASE, VAR_6); VAR_13 = 1; } if (VAR_12 < 0) { fprintf(stderr, "%s: error loading '%s'\n", __FUNCTION__, option_rom[0].name); } } if (!VAR_13 && !VAR_2 && !qtest_enabled()) { fprintf(stderr, "Kernel or ROM image must be specified\n"); exit(1); } palmte_binfo.VAR_2 = VAR_2; palmte_binfo.VAR_3 = VAR_3; palmte_binfo.VAR_4 = VAR_4; arm_load_kernel(VAR_5->cpu, &palmte_binfo); }
[ "static void FUNC_0(MachineState *VAR_0)\n{", "const char *VAR_1 = VAR_0->VAR_1;", "const char *VAR_2 = VAR_0->VAR_2;", "const char *VAR_3 = VAR_0->VAR_3;", "const char *VAR_4 = VAR_0->VAR_4;", "MemoryRegion *address_space_mem = get_system_memory();", "struct omap_mpu_state_s *VAR_5;", "int VAR_6 = 0x00800000;", "int VAR_7 = palmte_binfo.ram_size;", "static uint32_t VAR_8 = 0xffffffff;", "static uint32_t VAR_9 = 0x0000e1a0;", "static uint32_t VAR_10 = 0x0000e1a0;", "static uint32_t VAR_11 = 0xe1a0e1a0;", "int VAR_12, VAR_13 = 0;", "MemoryRegion *flash = g_new(MemoryRegion, 1);", "MemoryRegion *cs = g_new(MemoryRegion, 4);", "VAR_5 = omap310_mpu_init(address_space_mem, VAR_7, VAR_1);", "memory_region_init_ram(flash, NULL, \"palmte.flash\", VAR_6,\n&error_abort);", "vmstate_register_ram_global(flash);", "memory_region_set_readonly(flash, true);", "memory_region_add_subregion(address_space_mem, OMAP_CS0_BASE, flash);", "memory_region_init_io(&cs[0], NULL, &static_ops, &VAR_8, \"palmte-cs0\",\nOMAP_CS0_SIZE - VAR_6);", "memory_region_add_subregion(address_space_mem, OMAP_CS0_BASE + VAR_6,\n&cs[0]);", "memory_region_init_io(&cs[1], NULL, &static_ops, &VAR_9, \"palmte-cs1\",\nOMAP_CS1_SIZE);", "memory_region_add_subregion(address_space_mem, OMAP_CS1_BASE, &cs[1]);", "memory_region_init_io(&cs[2], NULL, &static_ops, &VAR_10, \"palmte-cs2\",\nOMAP_CS2_SIZE);", "memory_region_add_subregion(address_space_mem, OMAP_CS2_BASE, &cs[2]);", "memory_region_init_io(&cs[3], NULL, &static_ops, &VAR_11, \"palmte-cs3\",\nOMAP_CS3_SIZE);", "memory_region_add_subregion(address_space_mem, OMAP_CS3_BASE, &cs[3]);", "palmte_microwire_setup(VAR_5);", "qemu_add_kbd_event_handler(palmte_button_event, VAR_5);", "palmte_gpio_setup(VAR_5);", "if (nb_option_roms) {", "VAR_12 = get_image_size(option_rom[0].name);", "if (VAR_12 > VAR_6) {", "fprintf(stderr, \"%s: ROM image too big (%x > %x)\\n\",\n__FUNCTION__, VAR_12, VAR_6);", "VAR_12 = 0;", "}", "if (VAR_12 > 0) {", "VAR_12 = load_image_targphys(option_rom[0].name, OMAP_CS0_BASE,\nVAR_6);", "VAR_13 = 1;", "}", "if (VAR_12 < 0) {", "fprintf(stderr, \"%s: error loading '%s'\\n\",\n__FUNCTION__, option_rom[0].name);", "}", "}", "if (!VAR_13 && !VAR_2 && !qtest_enabled()) {", "fprintf(stderr, \"Kernel or ROM image must be specified\\n\");", "exit(1);", "}", "palmte_binfo.VAR_2 = VAR_2;", "palmte_binfo.VAR_3 = VAR_3;", "palmte_binfo.VAR_4 = VAR_4;", "arm_load_kernel(VAR_5->cpu, &palmte_binfo);", "}" ]
[ 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55, 57 ], [ 59, 61 ], [ 63, 65 ], [ 67 ], [ 69, 71 ], [ 73 ], [ 75, 77 ], [ 79 ], [ 83 ], [ 87 ], [ 91 ], [ 97 ], [ 99 ], [ 101 ], [ 103, 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113, 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123, 125 ], [ 127 ], [ 129 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ] ]
18,428
static void aio_signal_handler(int signum) { #if !defined(QEMU_IMG) && !defined(QEMU_NBD) CPUState *env = cpu_single_env; if (env) { /* stop the currently executing cpu because a timer occured */ cpu_interrupt(env, CPU_INTERRUPT_EXIT); #ifdef USE_KQEMU if (env->kqemu_enabled) { kqemu_cpu_interrupt(env); } #endif } #endif }
true
qemu
baf35cb90204d75404892aa4e52628ae7a00669b
static void aio_signal_handler(int signum) { #if !defined(QEMU_IMG) && !defined(QEMU_NBD) CPUState *env = cpu_single_env; if (env) { cpu_interrupt(env, CPU_INTERRUPT_EXIT); #ifdef USE_KQEMU if (env->kqemu_enabled) { kqemu_cpu_interrupt(env); } #endif } #endif }
{ "code": [ "static void aio_signal_handler(int signum)", "#if !defined(QEMU_IMG) && !defined(QEMU_NBD)", " CPUState *env = cpu_single_env;", " if (env) {", " cpu_interrupt(env, CPU_INTERRUPT_EXIT);", "#ifdef USE_KQEMU", " if (env->kqemu_enabled) {", " kqemu_cpu_interrupt(env);", "#endif", "#endif", "#endif" ], "line_no": [ 1, 5, 7, 9, 13, 15, 17, 19, 23, 23, 23 ] }
static void FUNC_0(int VAR_0) { #if !defined(QEMU_IMG) && !defined(QEMU_NBD) CPUState *env = cpu_single_env; if (env) { cpu_interrupt(env, CPU_INTERRUPT_EXIT); #ifdef USE_KQEMU if (env->kqemu_enabled) { kqemu_cpu_interrupt(env); } #endif } #endif }
[ "static void FUNC_0(int VAR_0)\n{", "#if !defined(QEMU_IMG) && !defined(QEMU_NBD)\nCPUState *env = cpu_single_env;", "if (env) {", "cpu_interrupt(env, CPU_INTERRUPT_EXIT);", "#ifdef USE_KQEMU\nif (env->kqemu_enabled) {", "kqemu_cpu_interrupt(env);", "}", "#endif\n}", "#endif\n}" ]
[ 1, 1, 1, 1, 1, 1, 0, 1, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9 ], [ 13 ], [ 15, 17 ], [ 19 ], [ 21 ], [ 23, 25 ], [ 27, 29 ] ]
18,429
static int mov_read_mfra(MOVContext *c, AVIOContext *f) { int64_t stream_size = avio_size(f); int64_t original_pos = avio_tell(f); int64_t seek_ret; int32_t mfra_size; int ret = -1; if ((seek_ret = avio_seek(f, stream_size - 4, SEEK_SET)) < 0) { ret = seek_ret; goto fail; } mfra_size = avio_rb32(f); if (mfra_size < 0 || mfra_size > stream_size) { av_log(c->fc, AV_LOG_DEBUG, "doesn't look like mfra (unreasonable size)\n"); goto fail; } if ((seek_ret = avio_seek(f, -mfra_size, SEEK_CUR)) < 0) { ret = seek_ret; goto fail; } if (avio_rb32(f) != mfra_size) { av_log(c->fc, AV_LOG_DEBUG, "doesn't look like mfra (size mismatch)\n"); goto fail; } if (avio_rb32(f) != MKBETAG('m', 'f', 'r', 'a')) { av_log(c->fc, AV_LOG_DEBUG, "doesn't look like mfra (tag mismatch)\n"); goto fail; } ret = 0; av_log(c->fc, AV_LOG_VERBOSE, "stream has mfra\n"); while (!read_tfra(c, f)) { /* Empty */ } fail: seek_ret = avio_seek(f, original_pos, SEEK_SET); if (seek_ret < 0) { av_log(c->fc, AV_LOG_ERROR, "failed to seek back after looking for mfra\n"); ret = seek_ret; } return ret; }
true
FFmpeg
db42d93a61be26873be6115c57f5921b4dfdec14
static int mov_read_mfra(MOVContext *c, AVIOContext *f) { int64_t stream_size = avio_size(f); int64_t original_pos = avio_tell(f); int64_t seek_ret; int32_t mfra_size; int ret = -1; if ((seek_ret = avio_seek(f, stream_size - 4, SEEK_SET)) < 0) { ret = seek_ret; goto fail; } mfra_size = avio_rb32(f); if (mfra_size < 0 || mfra_size > stream_size) { av_log(c->fc, AV_LOG_DEBUG, "doesn't look like mfra (unreasonable size)\n"); goto fail; } if ((seek_ret = avio_seek(f, -mfra_size, SEEK_CUR)) < 0) { ret = seek_ret; goto fail; } if (avio_rb32(f) != mfra_size) { av_log(c->fc, AV_LOG_DEBUG, "doesn't look like mfra (size mismatch)\n"); goto fail; } if (avio_rb32(f) != MKBETAG('m', 'f', 'r', 'a')) { av_log(c->fc, AV_LOG_DEBUG, "doesn't look like mfra (tag mismatch)\n"); goto fail; } ret = 0; av_log(c->fc, AV_LOG_VERBOSE, "stream has mfra\n"); while (!read_tfra(c, f)) { } fail: seek_ret = avio_seek(f, original_pos, SEEK_SET); if (seek_ret < 0) { av_log(c->fc, AV_LOG_ERROR, "failed to seek back after looking for mfra\n"); ret = seek_ret; } return ret; }
{ "code": [ " ret = 0;", " while (!read_tfra(c, f)) {" ], "line_no": [ 57, 61 ] }
static int FUNC_0(MOVContext *VAR_0, AVIOContext *VAR_1) { int64_t stream_size = avio_size(VAR_1); int64_t original_pos = avio_tell(VAR_1); int64_t seek_ret; int32_t mfra_size; int VAR_2 = -1; if ((seek_ret = avio_seek(VAR_1, stream_size - 4, SEEK_SET)) < 0) { VAR_2 = seek_ret; goto fail; } mfra_size = avio_rb32(VAR_1); if (mfra_size < 0 || mfra_size > stream_size) { av_log(VAR_0->fc, AV_LOG_DEBUG, "doesn't look like mfra (unreasonable size)\n"); goto fail; } if ((seek_ret = avio_seek(VAR_1, -mfra_size, SEEK_CUR)) < 0) { VAR_2 = seek_ret; goto fail; } if (avio_rb32(VAR_1) != mfra_size) { av_log(VAR_0->fc, AV_LOG_DEBUG, "doesn't look like mfra (size mismatch)\n"); goto fail; } if (avio_rb32(VAR_1) != MKBETAG('m', 'VAR_1', 'r', 'a')) { av_log(VAR_0->fc, AV_LOG_DEBUG, "doesn't look like mfra (tag mismatch)\n"); goto fail; } VAR_2 = 0; av_log(VAR_0->fc, AV_LOG_VERBOSE, "stream has mfra\n"); while (!read_tfra(VAR_0, VAR_1)) { } fail: seek_ret = avio_seek(VAR_1, original_pos, SEEK_SET); if (seek_ret < 0) { av_log(VAR_0->fc, AV_LOG_ERROR, "failed to seek back after looking for mfra\n"); VAR_2 = seek_ret; } return VAR_2; }
[ "static int FUNC_0(MOVContext *VAR_0, AVIOContext *VAR_1)\n{", "int64_t stream_size = avio_size(VAR_1);", "int64_t original_pos = avio_tell(VAR_1);", "int64_t seek_ret;", "int32_t mfra_size;", "int VAR_2 = -1;", "if ((seek_ret = avio_seek(VAR_1, stream_size - 4, SEEK_SET)) < 0) {", "VAR_2 = seek_ret;", "goto fail;", "}", "mfra_size = avio_rb32(VAR_1);", "if (mfra_size < 0 || mfra_size > stream_size) {", "av_log(VAR_0->fc, AV_LOG_DEBUG, \"doesn't look like mfra (unreasonable size)\\n\");", "goto fail;", "}", "if ((seek_ret = avio_seek(VAR_1, -mfra_size, SEEK_CUR)) < 0) {", "VAR_2 = seek_ret;", "goto fail;", "}", "if (avio_rb32(VAR_1) != mfra_size) {", "av_log(VAR_0->fc, AV_LOG_DEBUG, \"doesn't look like mfra (size mismatch)\\n\");", "goto fail;", "}", "if (avio_rb32(VAR_1) != MKBETAG('m', 'VAR_1', 'r', 'a')) {", "av_log(VAR_0->fc, AV_LOG_DEBUG, \"doesn't look like mfra (tag mismatch)\\n\");", "goto fail;", "}", "VAR_2 = 0;", "av_log(VAR_0->fc, AV_LOG_VERBOSE, \"stream has mfra\\n\");", "while (!read_tfra(VAR_0, VAR_1)) {", "}", "fail:\nseek_ret = avio_seek(VAR_1, original_pos, SEEK_SET);", "if (seek_ret < 0) {", "av_log(VAR_0->fc, AV_LOG_ERROR,\n\"failed to seek back after looking for mfra\\n\");", "VAR_2 = seek_ret;", "}", "return VAR_2;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 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 ], [ 65 ], [ 67, 69 ], [ 71 ], [ 73, 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ] ]
18,430
static int qemu_save_device_state(QEMUFile *f) { SaveStateEntry *se; qemu_put_be32(f, QEMU_VM_FILE_MAGIC); qemu_put_be32(f, QEMU_VM_FILE_VERSION); cpu_synchronize_all_states(); QTAILQ_FOREACH(se, &savevm_state.handlers, entry) { if (se->is_ram) { continue; } if ((!se->ops || !se->ops->save_state) && !se->vmsd) { continue; } save_section_header(f, se, QEMU_VM_SECTION_FULL); vmstate_save(f, se, NULL); } qemu_put_byte(f, QEMU_VM_EOF); return qemu_file_get_error(f); }
true
qemu
f68945d42bab700d95b87f62e0898606ce2421ed
static int qemu_save_device_state(QEMUFile *f) { SaveStateEntry *se; qemu_put_be32(f, QEMU_VM_FILE_MAGIC); qemu_put_be32(f, QEMU_VM_FILE_VERSION); cpu_synchronize_all_states(); QTAILQ_FOREACH(se, &savevm_state.handlers, entry) { if (se->is_ram) { continue; } if ((!se->ops || !se->ops->save_state) && !se->vmsd) { continue; } save_section_header(f, se, QEMU_VM_SECTION_FULL); vmstate_save(f, se, NULL); } qemu_put_byte(f, QEMU_VM_EOF); return qemu_file_get_error(f); }
{ "code": [], "line_no": [] }
static int FUNC_0(QEMUFile *VAR_0) { SaveStateEntry *se; qemu_put_be32(VAR_0, QEMU_VM_FILE_MAGIC); qemu_put_be32(VAR_0, QEMU_VM_FILE_VERSION); cpu_synchronize_all_states(); QTAILQ_FOREACH(se, &savevm_state.handlers, entry) { if (se->is_ram) { continue; } if ((!se->ops || !se->ops->save_state) && !se->vmsd) { continue; } save_section_header(VAR_0, se, QEMU_VM_SECTION_FULL); vmstate_save(VAR_0, se, NULL); } qemu_put_byte(VAR_0, QEMU_VM_EOF); return qemu_file_get_error(VAR_0); }
[ "static int FUNC_0(QEMUFile *VAR_0)\n{", "SaveStateEntry *se;", "qemu_put_be32(VAR_0, QEMU_VM_FILE_MAGIC);", "qemu_put_be32(VAR_0, QEMU_VM_FILE_VERSION);", "cpu_synchronize_all_states();", "QTAILQ_FOREACH(se, &savevm_state.handlers, entry) {", "if (se->is_ram) {", "continue;", "}", "if ((!se->ops || !se->ops->save_state) && !se->vmsd) {", "continue;", "}", "save_section_header(VAR_0, se, QEMU_VM_SECTION_FULL);", "vmstate_save(VAR_0, se, NULL);", "}", "qemu_put_byte(VAR_0, QEMU_VM_EOF);", "return qemu_file_get_error(VAR_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 ] ]
18,431
void PREFIX_h264_chroma_mc8_altivec(uint8_t * dst, uint8_t * src, int stride, int h, int x, int y) { POWERPC_PERF_DECLARE(PREFIX_h264_chroma_mc8_num, 1); DECLARE_ALIGNED_16(signed int, ABCD[4]) = {((8 - x) * (8 - y)), (( x) * (8 - y)), ((8 - x) * ( y)), (( x) * ( y))}; register int i; vec_u8 fperm; const vec_s32 vABCD = vec_ld(0, ABCD); const vec_s16 vA = vec_splat((vec_s16)vABCD, 1); const vec_s16 vB = vec_splat((vec_s16)vABCD, 3); const vec_s16 vC = vec_splat((vec_s16)vABCD, 5); const vec_s16 vD = vec_splat((vec_s16)vABCD, 7); LOAD_ZERO; const vec_s16 v32ss = vec_sl(vec_splat_s16(1),vec_splat_u16(5)); const vec_u16 v6us = vec_splat_u16(6); register int loadSecond = (((unsigned long)src) % 16) <= 7 ? 0 : 1; register int reallyBadAlign = (((unsigned long)src) % 16) == 15 ? 1 : 0; vec_u8 vsrcAuc, vsrcBuc, vsrcperm0, vsrcperm1; vec_u8 vsrc0uc, vsrc1uc; vec_s16 vsrc0ssH, vsrc1ssH; vec_u8 vsrcCuc, vsrc2uc, vsrc3uc; vec_s16 vsrc2ssH, vsrc3ssH, psum; vec_u8 vdst, ppsum, vfdst, fsum; POWERPC_PERF_START_COUNT(PREFIX_h264_chroma_mc8_num, 1); if (((unsigned long)dst) % 16 == 0) { fperm = (vec_u8){0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F}; } else { fperm = (vec_u8){0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F}; } vsrcAuc = vec_ld(0, src); if (loadSecond) vsrcBuc = vec_ld(16, src); vsrcperm0 = vec_lvsl(0, src); vsrcperm1 = vec_lvsl(1, src); vsrc0uc = vec_perm(vsrcAuc, vsrcBuc, vsrcperm0); if (reallyBadAlign) vsrc1uc = vsrcBuc; else vsrc1uc = vec_perm(vsrcAuc, vsrcBuc, vsrcperm1); vsrc0ssH = (vec_s16)vec_mergeh(zero_u8v,(vec_u8)vsrc0uc); vsrc1ssH = (vec_s16)vec_mergeh(zero_u8v,(vec_u8)vsrc1uc); if (ABCD[3]) { if (!loadSecond) {// -> !reallyBadAlign for (i = 0 ; i < h ; i++) { vsrcCuc = vec_ld(stride + 0, src); vsrc2uc = vec_perm(vsrcCuc, vsrcCuc, vsrcperm0); vsrc3uc = vec_perm(vsrcCuc, vsrcCuc, vsrcperm1); CHROMA_MC8_ALTIVEC_CORE } } else { vec_u8 vsrcDuc; for (i = 0 ; i < h ; i++) { vsrcCuc = vec_ld(stride + 0, src); vsrcDuc = vec_ld(stride + 16, src); vsrc2uc = vec_perm(vsrcCuc, vsrcDuc, vsrcperm0); if (reallyBadAlign) vsrc3uc = vsrcDuc; else vsrc3uc = vec_perm(vsrcCuc, vsrcDuc, vsrcperm1); CHROMA_MC8_ALTIVEC_CORE } } } else { const vec_s16 vE = vec_add(vB, vC); if (ABCD[2]) { // x == 0 B == 0 if (!loadSecond) {// -> !reallyBadAlign for (i = 0 ; i < h ; i++) { vsrcCuc = vec_ld(stride + 0, src); vsrc1uc = vec_perm(vsrcCuc, vsrcCuc, vsrcperm0); CHROMA_MC8_ALTIVEC_CORE_SIMPLE vsrc0uc = vsrc1uc; } } else { vec_u8 vsrcDuc; for (i = 0 ; i < h ; i++) { vsrcCuc = vec_ld(stride + 0, src); vsrcDuc = vec_ld(stride + 15, src); vsrc1uc = vec_perm(vsrcCuc, vsrcDuc, vsrcperm0); CHROMA_MC8_ALTIVEC_CORE_SIMPLE vsrc0uc = vsrc1uc; } } } else { // y == 0 C == 0 if (!loadSecond) {// -> !reallyBadAlign for (i = 0 ; i < h ; i++) { vsrcCuc = vec_ld(0, src); vsrc0uc = vec_perm(vsrcCuc, vsrcCuc, vsrcperm0); vsrc1uc = vec_perm(vsrcCuc, vsrcCuc, vsrcperm1); CHROMA_MC8_ALTIVEC_CORE_SIMPLE } } else { vec_u8 vsrcDuc; for (i = 0 ; i < h ; i++) { vsrcCuc = vec_ld(0, src); vsrcDuc = vec_ld(15, src); vsrc0uc = vec_perm(vsrcCuc, vsrcDuc, vsrcperm0); if (reallyBadAlign) vsrc1uc = vsrcDuc; else vsrc1uc = vec_perm(vsrcCuc, vsrcDuc, vsrcperm1); CHROMA_MC8_ALTIVEC_CORE_SIMPLE } } } } POWERPC_PERF_STOP_COUNT(PREFIX_h264_chroma_mc8_num, 1); }
true
FFmpeg
f5b2476fd322a4d36fde912cb2a30a850bd77f43
void PREFIX_h264_chroma_mc8_altivec(uint8_t * dst, uint8_t * src, int stride, int h, int x, int y) { POWERPC_PERF_DECLARE(PREFIX_h264_chroma_mc8_num, 1); DECLARE_ALIGNED_16(signed int, ABCD[4]) = {((8 - x) * (8 - y)), (( x) * (8 - y)), ((8 - x) * ( y)), (( x) * ( y))}; register int i; vec_u8 fperm; const vec_s32 vABCD = vec_ld(0, ABCD); const vec_s16 vA = vec_splat((vec_s16)vABCD, 1); const vec_s16 vB = vec_splat((vec_s16)vABCD, 3); const vec_s16 vC = vec_splat((vec_s16)vABCD, 5); const vec_s16 vD = vec_splat((vec_s16)vABCD, 7); LOAD_ZERO; const vec_s16 v32ss = vec_sl(vec_splat_s16(1),vec_splat_u16(5)); const vec_u16 v6us = vec_splat_u16(6); register int loadSecond = (((unsigned long)src) % 16) <= 7 ? 0 : 1; register int reallyBadAlign = (((unsigned long)src) % 16) == 15 ? 1 : 0; vec_u8 vsrcAuc, vsrcBuc, vsrcperm0, vsrcperm1; vec_u8 vsrc0uc, vsrc1uc; vec_s16 vsrc0ssH, vsrc1ssH; vec_u8 vsrcCuc, vsrc2uc, vsrc3uc; vec_s16 vsrc2ssH, vsrc3ssH, psum; vec_u8 vdst, ppsum, vfdst, fsum; POWERPC_PERF_START_COUNT(PREFIX_h264_chroma_mc8_num, 1); if (((unsigned long)dst) % 16 == 0) { fperm = (vec_u8){0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F}; } else { fperm = (vec_u8){0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F}; } vsrcAuc = vec_ld(0, src); if (loadSecond) vsrcBuc = vec_ld(16, src); vsrcperm0 = vec_lvsl(0, src); vsrcperm1 = vec_lvsl(1, src); vsrc0uc = vec_perm(vsrcAuc, vsrcBuc, vsrcperm0); if (reallyBadAlign) vsrc1uc = vsrcBuc; else vsrc1uc = vec_perm(vsrcAuc, vsrcBuc, vsrcperm1); vsrc0ssH = (vec_s16)vec_mergeh(zero_u8v,(vec_u8)vsrc0uc); vsrc1ssH = (vec_s16)vec_mergeh(zero_u8v,(vec_u8)vsrc1uc); if (ABCD[3]) { if (!loadSecond) { for (i = 0 ; i < h ; i++) { vsrcCuc = vec_ld(stride + 0, src); vsrc2uc = vec_perm(vsrcCuc, vsrcCuc, vsrcperm0); vsrc3uc = vec_perm(vsrcCuc, vsrcCuc, vsrcperm1); CHROMA_MC8_ALTIVEC_CORE } } else { vec_u8 vsrcDuc; for (i = 0 ; i < h ; i++) { vsrcCuc = vec_ld(stride + 0, src); vsrcDuc = vec_ld(stride + 16, src); vsrc2uc = vec_perm(vsrcCuc, vsrcDuc, vsrcperm0); if (reallyBadAlign) vsrc3uc = vsrcDuc; else vsrc3uc = vec_perm(vsrcCuc, vsrcDuc, vsrcperm1); CHROMA_MC8_ALTIVEC_CORE } } } else { const vec_s16 vE = vec_add(vB, vC); if (ABCD[2]) { if (!loadSecond) { for (i = 0 ; i < h ; i++) { vsrcCuc = vec_ld(stride + 0, src); vsrc1uc = vec_perm(vsrcCuc, vsrcCuc, vsrcperm0); CHROMA_MC8_ALTIVEC_CORE_SIMPLE vsrc0uc = vsrc1uc; } } else { vec_u8 vsrcDuc; for (i = 0 ; i < h ; i++) { vsrcCuc = vec_ld(stride + 0, src); vsrcDuc = vec_ld(stride + 15, src); vsrc1uc = vec_perm(vsrcCuc, vsrcDuc, vsrcperm0); CHROMA_MC8_ALTIVEC_CORE_SIMPLE vsrc0uc = vsrc1uc; } } } else { if (!loadSecond) { for (i = 0 ; i < h ; i++) { vsrcCuc = vec_ld(0, src); vsrc0uc = vec_perm(vsrcCuc, vsrcCuc, vsrcperm0); vsrc1uc = vec_perm(vsrcCuc, vsrcCuc, vsrcperm1); CHROMA_MC8_ALTIVEC_CORE_SIMPLE } } else { vec_u8 vsrcDuc; for (i = 0 ; i < h ; i++) { vsrcCuc = vec_ld(0, src); vsrcDuc = vec_ld(15, src); vsrc0uc = vec_perm(vsrcCuc, vsrcDuc, vsrcperm0); if (reallyBadAlign) vsrc1uc = vsrcDuc; else vsrc1uc = vec_perm(vsrcCuc, vsrcDuc, vsrcperm1); CHROMA_MC8_ALTIVEC_CORE_SIMPLE } } } } POWERPC_PERF_STOP_COUNT(PREFIX_h264_chroma_mc8_num, 1); }
{ "code": [ " vec_u8 vsrcAuc, vsrcBuc, vsrcperm0, vsrcperm1;", " vec_u8 vsrcAuc, vsrcBuc, vsrcperm0, vsrcperm1;" ], "line_no": [ 43, 43 ] }
void FUNC_0(uint8_t * VAR_0, uint8_t * VAR_1, int VAR_2, int VAR_3, int VAR_4, int VAR_5) { POWERPC_PERF_DECLARE(PREFIX_h264_chroma_mc8_num, 1); DECLARE_ALIGNED_16(signed int, ABCD[4]) = {((8 - VAR_4) * (8 - VAR_5)), (( VAR_4) * (8 - VAR_5)), ((8 - VAR_4) * ( VAR_5)), (( VAR_4) * ( VAR_5))}; register int VAR_6; vec_u8 fperm; const vec_s32 VAR_7 = vec_ld(0, ABCD); const vec_s16 VAR_8 = vec_splat((vec_s16)VAR_7, 1); const vec_s16 VAR_9 = vec_splat((vec_s16)VAR_7, 3); const vec_s16 VAR_10 = vec_splat((vec_s16)VAR_7, 5); const vec_s16 VAR_11 = vec_splat((vec_s16)VAR_7, 7); LOAD_ZERO; const vec_s16 VAR_12 = vec_sl(vec_splat_s16(1),vec_splat_u16(5)); const vec_u16 VAR_13 = vec_splat_u16(6); register int VAR_14 = (((unsigned long)VAR_1) % 16) <= 7 ? 0 : 1; register int VAR_15 = (((unsigned long)VAR_1) % 16) == 15 ? 1 : 0; vec_u8 vsrcAuc, vsrcBuc, vsrcperm0, vsrcperm1; vec_u8 vsrc0uc, vsrc1uc; vec_s16 vsrc0ssH, vsrc1ssH; vec_u8 vsrcCuc, vsrc2uc, vsrc3uc; vec_s16 vsrc2ssH, vsrc3ssH, psum; vec_u8 vdst, ppsum, vfdst, fsum; POWERPC_PERF_START_COUNT(PREFIX_h264_chroma_mc8_num, 1); if (((unsigned long)VAR_0) % 16 == 0) { fperm = (vec_u8){0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F}; } else { fperm = (vec_u8){0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F}; } vsrcAuc = vec_ld(0, VAR_1); if (VAR_14) vsrcBuc = vec_ld(16, VAR_1); vsrcperm0 = vec_lvsl(0, VAR_1); vsrcperm1 = vec_lvsl(1, VAR_1); vsrc0uc = vec_perm(vsrcAuc, vsrcBuc, vsrcperm0); if (VAR_15) vsrc1uc = vsrcBuc; else vsrc1uc = vec_perm(vsrcAuc, vsrcBuc, vsrcperm1); vsrc0ssH = (vec_s16)vec_mergeh(zero_u8v,(vec_u8)vsrc0uc); vsrc1ssH = (vec_s16)vec_mergeh(zero_u8v,(vec_u8)vsrc1uc); if (ABCD[3]) { if (!VAR_14) { for (VAR_6 = 0 ; VAR_6 < VAR_3 ; VAR_6++) { vsrcCuc = vec_ld(VAR_2 + 0, VAR_1); vsrc2uc = vec_perm(vsrcCuc, vsrcCuc, vsrcperm0); vsrc3uc = vec_perm(vsrcCuc, vsrcCuc, vsrcperm1); CHROMA_MC8_ALTIVEC_CORE } } else { vec_u8 vsrcDuc; for (VAR_6 = 0 ; VAR_6 < VAR_3 ; VAR_6++) { vsrcCuc = vec_ld(VAR_2 + 0, VAR_1); vsrcDuc = vec_ld(VAR_2 + 16, VAR_1); vsrc2uc = vec_perm(vsrcCuc, vsrcDuc, vsrcperm0); if (VAR_15) vsrc3uc = vsrcDuc; else vsrc3uc = vec_perm(vsrcCuc, vsrcDuc, vsrcperm1); CHROMA_MC8_ALTIVEC_CORE } } } else { const vec_s16 VAR_16 = vec_add(VAR_9, VAR_10); if (ABCD[2]) { if (!VAR_14) { for (VAR_6 = 0 ; VAR_6 < VAR_3 ; VAR_6++) { vsrcCuc = vec_ld(VAR_2 + 0, VAR_1); vsrc1uc = vec_perm(vsrcCuc, vsrcCuc, vsrcperm0); CHROMA_MC8_ALTIVEC_CORE_SIMPLE vsrc0uc = vsrc1uc; } } else { vec_u8 vsrcDuc; for (VAR_6 = 0 ; VAR_6 < VAR_3 ; VAR_6++) { vsrcCuc = vec_ld(VAR_2 + 0, VAR_1); vsrcDuc = vec_ld(VAR_2 + 15, VAR_1); vsrc1uc = vec_perm(vsrcCuc, vsrcDuc, vsrcperm0); CHROMA_MC8_ALTIVEC_CORE_SIMPLE vsrc0uc = vsrc1uc; } } } else { if (!VAR_14) { for (VAR_6 = 0 ; VAR_6 < VAR_3 ; VAR_6++) { vsrcCuc = vec_ld(0, VAR_1); vsrc0uc = vec_perm(vsrcCuc, vsrcCuc, vsrcperm0); vsrc1uc = vec_perm(vsrcCuc, vsrcCuc, vsrcperm1); CHROMA_MC8_ALTIVEC_CORE_SIMPLE } } else { vec_u8 vsrcDuc; for (VAR_6 = 0 ; VAR_6 < VAR_3 ; VAR_6++) { vsrcCuc = vec_ld(0, VAR_1); vsrcDuc = vec_ld(15, VAR_1); vsrc0uc = vec_perm(vsrcCuc, vsrcDuc, vsrcperm0); if (VAR_15) vsrc1uc = vsrcDuc; else vsrc1uc = vec_perm(vsrcCuc, vsrcDuc, vsrcperm1); CHROMA_MC8_ALTIVEC_CORE_SIMPLE } } } } POWERPC_PERF_STOP_COUNT(PREFIX_h264_chroma_mc8_num, 1); }
[ "void FUNC_0(uint8_t * VAR_0, uint8_t * VAR_1,\nint VAR_2, int VAR_3, int VAR_4, int VAR_5) {", "POWERPC_PERF_DECLARE(PREFIX_h264_chroma_mc8_num, 1);", "DECLARE_ALIGNED_16(signed int, ABCD[4]) =\n{((8 - VAR_4) * (8 - VAR_5)),", "(( VAR_4) * (8 - VAR_5)),\n((8 - VAR_4) * ( VAR_5)),\n(( VAR_4) * ( VAR_5))};", "register int VAR_6;", "vec_u8 fperm;", "const vec_s32 VAR_7 = vec_ld(0, ABCD);", "const vec_s16 VAR_8 = vec_splat((vec_s16)VAR_7, 1);", "const vec_s16 VAR_9 = vec_splat((vec_s16)VAR_7, 3);", "const vec_s16 VAR_10 = vec_splat((vec_s16)VAR_7, 5);", "const vec_s16 VAR_11 = vec_splat((vec_s16)VAR_7, 7);", "LOAD_ZERO;", "const vec_s16 VAR_12 = vec_sl(vec_splat_s16(1),vec_splat_u16(5));", "const vec_u16 VAR_13 = vec_splat_u16(6);", "register int VAR_14 = (((unsigned long)VAR_1) % 16) <= 7 ? 0 : 1;", "register int VAR_15 = (((unsigned long)VAR_1) % 16) == 15 ? 1 : 0;", "vec_u8 vsrcAuc, vsrcBuc, vsrcperm0, vsrcperm1;", "vec_u8 vsrc0uc, vsrc1uc;", "vec_s16 vsrc0ssH, vsrc1ssH;", "vec_u8 vsrcCuc, vsrc2uc, vsrc3uc;", "vec_s16 vsrc2ssH, vsrc3ssH, psum;", "vec_u8 vdst, ppsum, vfdst, fsum;", "POWERPC_PERF_START_COUNT(PREFIX_h264_chroma_mc8_num, 1);", "if (((unsigned long)VAR_0) % 16 == 0) {", "fperm = (vec_u8){0x10, 0x11, 0x12, 0x13,", "0x14, 0x15, 0x16, 0x17,\n0x08, 0x09, 0x0A, 0x0B,\n0x0C, 0x0D, 0x0E, 0x0F};", "} else {", "fperm = (vec_u8){0x00, 0x01, 0x02, 0x03,", "0x04, 0x05, 0x06, 0x07,\n0x18, 0x19, 0x1A, 0x1B,\n0x1C, 0x1D, 0x1E, 0x1F};", "}", "vsrcAuc = vec_ld(0, VAR_1);", "if (VAR_14)\nvsrcBuc = vec_ld(16, VAR_1);", "vsrcperm0 = vec_lvsl(0, VAR_1);", "vsrcperm1 = vec_lvsl(1, VAR_1);", "vsrc0uc = vec_perm(vsrcAuc, vsrcBuc, vsrcperm0);", "if (VAR_15)\nvsrc1uc = vsrcBuc;", "else\nvsrc1uc = vec_perm(vsrcAuc, vsrcBuc, vsrcperm1);", "vsrc0ssH = (vec_s16)vec_mergeh(zero_u8v,(vec_u8)vsrc0uc);", "vsrc1ssH = (vec_s16)vec_mergeh(zero_u8v,(vec_u8)vsrc1uc);", "if (ABCD[3]) {", "if (!VAR_14) {", "for (VAR_6 = 0 ; VAR_6 < VAR_3 ; VAR_6++) {", "vsrcCuc = vec_ld(VAR_2 + 0, VAR_1);", "vsrc2uc = vec_perm(vsrcCuc, vsrcCuc, vsrcperm0);", "vsrc3uc = vec_perm(vsrcCuc, vsrcCuc, vsrcperm1);", "CHROMA_MC8_ALTIVEC_CORE\n}", "} else {", "vec_u8 vsrcDuc;", "for (VAR_6 = 0 ; VAR_6 < VAR_3 ; VAR_6++) {", "vsrcCuc = vec_ld(VAR_2 + 0, VAR_1);", "vsrcDuc = vec_ld(VAR_2 + 16, VAR_1);", "vsrc2uc = vec_perm(vsrcCuc, vsrcDuc, vsrcperm0);", "if (VAR_15)\nvsrc3uc = vsrcDuc;", "else\nvsrc3uc = vec_perm(vsrcCuc, vsrcDuc, vsrcperm1);", "CHROMA_MC8_ALTIVEC_CORE\n}", "}", "} else {", "const vec_s16 VAR_16 = vec_add(VAR_9, VAR_10);", "if (ABCD[2]) {", "if (!VAR_14) {", "for (VAR_6 = 0 ; VAR_6 < VAR_3 ; VAR_6++) {", "vsrcCuc = vec_ld(VAR_2 + 0, VAR_1);", "vsrc1uc = vec_perm(vsrcCuc, vsrcCuc, vsrcperm0);", "CHROMA_MC8_ALTIVEC_CORE_SIMPLE\nvsrc0uc = vsrc1uc;", "}", "} else {", "vec_u8 vsrcDuc;", "for (VAR_6 = 0 ; VAR_6 < VAR_3 ; VAR_6++) {", "vsrcCuc = vec_ld(VAR_2 + 0, VAR_1);", "vsrcDuc = vec_ld(VAR_2 + 15, VAR_1);", "vsrc1uc = vec_perm(vsrcCuc, vsrcDuc, vsrcperm0);", "CHROMA_MC8_ALTIVEC_CORE_SIMPLE\nvsrc0uc = vsrc1uc;", "}", "}", "} else {", "if (!VAR_14) {", "for (VAR_6 = 0 ; VAR_6 < VAR_3 ; VAR_6++) {", "vsrcCuc = vec_ld(0, VAR_1);", "vsrc0uc = vec_perm(vsrcCuc, vsrcCuc, vsrcperm0);", "vsrc1uc = vec_perm(vsrcCuc, vsrcCuc, vsrcperm1);", "CHROMA_MC8_ALTIVEC_CORE_SIMPLE\n}", "} else {", "vec_u8 vsrcDuc;", "for (VAR_6 = 0 ; VAR_6 < VAR_3 ; VAR_6++) {", "vsrcCuc = vec_ld(0, VAR_1);", "vsrcDuc = vec_ld(15, VAR_1);", "vsrc0uc = vec_perm(vsrcCuc, vsrcDuc, vsrcperm0);", "if (VAR_15)\nvsrc1uc = vsrcDuc;", "else\nvsrc1uc = vec_perm(vsrcCuc, vsrcDuc, vsrcperm1);", "CHROMA_MC8_ALTIVEC_CORE_SIMPLE\n}", "}", "}", "}", "POWERPC_PERF_STOP_COUNT(PREFIX_h264_chroma_mc8_num, 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, 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 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 61 ], [ 63 ], [ 65, 67, 69 ], [ 71 ], [ 73 ], [ 75, 77, 79 ], [ 81 ], [ 85 ], [ 89, 91 ], [ 93 ], [ 95 ], [ 99 ], [ 101, 103 ], [ 105, 107 ], [ 111 ], [ 113 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 131, 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147, 149 ], [ 151, 153 ], [ 157, 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177, 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197, 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 221, 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237, 239 ], [ 241, 243 ], [ 247, 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ] ]
18,432
static int ffserver_parse_config_stream(FFServerConfig *config, const char *cmd, const char **p, int line_num, FFServerStream **pstream) { char arg[1024], arg2[1024]; FFServerStream *stream; int val; av_assert0(pstream); stream = *pstream; if (!av_strcasecmp(cmd, "<Stream")) { char *q; FFServerStream *s; stream = av_mallocz(sizeof(FFServerStream)); if (!stream) return AVERROR(ENOMEM); config->dummy_actx = avcodec_alloc_context3(NULL); config->dummy_vctx = avcodec_alloc_context3(NULL); if (!config->dummy_vctx || !config->dummy_actx) { av_free(stream); avcodec_free_context(&config->dummy_vctx); avcodec_free_context(&config->dummy_actx); return AVERROR(ENOMEM); } config->dummy_actx->codec_type = AVMEDIA_TYPE_AUDIO; config->dummy_vctx->codec_type = AVMEDIA_TYPE_VIDEO; ffserver_get_arg(stream->filename, sizeof(stream->filename), p); q = strrchr(stream->filename, '>'); if (q) *q = '\0'; for (s = config->first_stream; s; s = s->next) { if (!strcmp(stream->filename, s->filename)) ERROR("Stream '%s' already registered\n", s->filename); } stream->fmt = ffserver_guess_format(NULL, stream->filename, NULL); if (stream->fmt) { config->guessed_audio_codec_id = stream->fmt->audio_codec; config->guessed_video_codec_id = stream->fmt->video_codec; } else { config->guessed_audio_codec_id = AV_CODEC_ID_NONE; config->guessed_video_codec_id = AV_CODEC_ID_NONE; } *pstream = stream; return 0; } av_assert0(stream); if (!av_strcasecmp(cmd, "Feed")) { FFServerStream *sfeed; ffserver_get_arg(arg, sizeof(arg), p); sfeed = config->first_feed; while (sfeed) { if (!strcmp(sfeed->filename, arg)) break; sfeed = sfeed->next_feed; } if (!sfeed) ERROR("Feed with name '%s' for stream '%s' is not defined\n", arg, stream->filename); else stream->feed = sfeed; } else if (!av_strcasecmp(cmd, "Format")) { ffserver_get_arg(arg, sizeof(arg), p); if (!strcmp(arg, "status")) { stream->stream_type = STREAM_TYPE_STATUS; stream->fmt = NULL; } else { stream->stream_type = STREAM_TYPE_LIVE; /* JPEG cannot be used here, so use single frame MJPEG */ if (!strcmp(arg, "jpeg")) strcpy(arg, "mjpeg"); stream->fmt = ffserver_guess_format(arg, NULL, NULL); if (!stream->fmt) ERROR("Unknown Format: %s\n", arg); } if (stream->fmt) { config->guessed_audio_codec_id = stream->fmt->audio_codec; config->guessed_video_codec_id = stream->fmt->video_codec; } } else if (!av_strcasecmp(cmd, "InputFormat")) { ffserver_get_arg(arg, sizeof(arg), p); stream->ifmt = av_find_input_format(arg); if (!stream->ifmt) ERROR("Unknown input format: %s\n", arg); } else if (!av_strcasecmp(cmd, "FaviconURL")) { if (stream->stream_type == STREAM_TYPE_STATUS) ffserver_get_arg(stream->feed_filename, sizeof(stream->feed_filename), p); else ERROR("FaviconURL only permitted for status streams\n"); } else if (!av_strcasecmp(cmd, "Author") || !av_strcasecmp(cmd, "Comment") || !av_strcasecmp(cmd, "Copyright") || !av_strcasecmp(cmd, "Title")) { char key[32]; int i; ffserver_get_arg(arg, sizeof(arg), p); for (i = 0; i < strlen(cmd); i++) key[i] = av_tolower(cmd[i]); key[i] = 0; WARNING("'%s' option in configuration file is deprecated, " "use 'Metadata %s VALUE' instead\n", cmd, key); if (av_dict_set(&stream->metadata, key, arg, 0) < 0) goto nomem; } else if (!av_strcasecmp(cmd, "Metadata")) { ffserver_get_arg(arg, sizeof(arg), p); ffserver_get_arg(arg2, sizeof(arg2), p); if (av_dict_set(&stream->metadata, arg, arg2, 0) < 0) goto nomem; } else if (!av_strcasecmp(cmd, "Preroll")) { ffserver_get_arg(arg, sizeof(arg), p); stream->prebuffer = atof(arg) * 1000; } else if (!av_strcasecmp(cmd, "StartSendOnKey")) { stream->send_on_key = 1; } else if (!av_strcasecmp(cmd, "AudioCodec")) { ffserver_get_arg(arg, sizeof(arg), p); ffserver_set_codec(config->dummy_actx, arg, config, line_num); } else if (!av_strcasecmp(cmd, "VideoCodec")) { ffserver_get_arg(arg, sizeof(arg), p); ffserver_set_codec(config->dummy_vctx, arg, config, line_num); } else if (!av_strcasecmp(cmd, "MaxTime")) { ffserver_get_arg(arg, sizeof(arg), p); stream->max_time = atof(arg) * 1000; } else if (!av_strcasecmp(cmd, "AudioBitRate")) { float f; ffserver_get_arg(arg, sizeof(arg), p); ffserver_set_float_param(&f, arg, 1000, 0, FLT_MAX, config, line_num, "Invalid %s: %s\n", cmd, arg); if (av_dict_set_int(&config->audio_conf, cmd, lrintf(f), 0) < 0) goto nomem; } else if (!av_strcasecmp(cmd, "AudioChannels")) { ffserver_get_arg(arg, sizeof(arg), p); ffserver_set_int_param(NULL, arg, 0, 1, 8, config, line_num, "Invalid %s: %s, valid range is 1-8.", cmd, arg); if (av_dict_set(&config->audio_conf, cmd, arg, 0) < 0) goto nomem; } else if (!av_strcasecmp(cmd, "AudioSampleRate")) { ffserver_get_arg(arg, sizeof(arg), p); ffserver_set_int_param(NULL, arg, 0, 0, INT_MAX, config, line_num, "Invalid %s: %s", cmd, arg); if (av_dict_set(&config->audio_conf, cmd, arg, 0) < 0) goto nomem; } else if (!av_strcasecmp(cmd, "VideoBitRateRange")) { int minrate, maxrate; ffserver_get_arg(arg, sizeof(arg), p); if (sscanf(arg, "%d-%d", &minrate, &maxrate) == 2) { if (av_dict_set_int(&config->video_conf, "VideoBitRateRangeMin", minrate, 0) < 0 || av_dict_set_int(&config->video_conf, "VideoBitRateRangeMax", maxrate, 0) < 0) goto nomem; } else ERROR("Incorrect format for VideoBitRateRange -- should be " "<min>-<max>: %s\n", arg); } else if (!av_strcasecmp(cmd, "Debug")) { ffserver_get_arg(arg, sizeof(arg), p); ffserver_set_int_param(NULL, arg, 0, INT_MIN, INT_MAX, config, line_num, "Invalid %s: %s", cmd, arg); if (av_dict_set(&config->video_conf, cmd, arg, 0) < 0) goto nomem; } else if (!av_strcasecmp(cmd, "Strict")) { ffserver_get_arg(arg, sizeof(arg), p); ffserver_set_int_param(NULL, arg, 0, INT_MIN, INT_MAX, config, line_num, "Invalid %s: %s", cmd, arg); if (av_dict_set(&config->video_conf, cmd, arg, 0) < 0) goto nomem; } else if (!av_strcasecmp(cmd, "VideoBufferSize")) { ffserver_get_arg(arg, sizeof(arg), p); ffserver_set_int_param(NULL, arg, 8*1024, 0, INT_MAX, config, line_num, "Invalid %s: %s", cmd, arg); if (av_dict_set(&config->video_conf, cmd, arg, 0) < 0) goto nomem; } else if (!av_strcasecmp(cmd, "VideoBitRateTolerance")) { ffserver_get_arg(arg, sizeof(arg), p); ffserver_set_int_param(NULL, arg, 1000, INT_MIN, INT_MAX, config, line_num, "Invalid %s: %s", cmd, arg); if (av_dict_set(&config->video_conf, cmd, arg, 0) < 0) goto nomem; } else if (!av_strcasecmp(cmd, "VideoBitRate")) { ffserver_get_arg(arg, sizeof(arg), p); ffserver_set_int_param(NULL, arg, 1000, 0, INT_MAX, config, line_num, "Invalid %s: %s", cmd, arg); if (av_dict_set(&config->video_conf, cmd, arg, 0) < 0) goto nomem; } else if (!av_strcasecmp(cmd, "VideoSize")) { int ret, w, h; ffserver_get_arg(arg, sizeof(arg), p); ret = av_parse_video_size(&w, &h, arg); if (ret < 0) ERROR("Invalid video size '%s'\n", arg); else if ((w % 2) || (h % 2)) WARNING("Image size is not a multiple of 2\n"); if (av_dict_set_int(&config->video_conf, "VideoSizeWidth", w, 0) < 0 || av_dict_set_int(&config->video_conf, "VideoSizeHeight", h, 0) < 0) goto nomem; } else if (!av_strcasecmp(cmd, "VideoFrameRate")) { AVRational frame_rate; ffserver_get_arg(arg, sizeof(arg), p); if (av_parse_video_rate(&frame_rate, arg) < 0) { ERROR("Incorrect frame rate: %s\n", arg); } else { if (av_dict_set_int(&config->video_conf, "VideoFrameRateNum", frame_rate.num, 0) < 0 || av_dict_set_int(&config->video_conf, "VideoFrameRateDen", frame_rate.den, 0) < 0) goto nomem; } } else if (!av_strcasecmp(cmd, "PixelFormat")) { enum AVPixelFormat pix_fmt; ffserver_get_arg(arg, sizeof(arg), p); pix_fmt = av_get_pix_fmt(arg); if (pix_fmt == AV_PIX_FMT_NONE) ERROR("Unknown pixel format: %s\n", arg); if (av_dict_set_int(&config->video_conf, cmd, pix_fmt, 0) < 0) goto nomem; } else if (!av_strcasecmp(cmd, "VideoGopSize")) { ffserver_get_arg(arg, sizeof(arg), p); ffserver_set_int_param(NULL, arg, 0, INT_MIN, INT_MAX, config, line_num, "Invalid %s: %s", cmd, arg); if (av_dict_set(&config->video_conf, cmd, arg, 0) < 0) goto nomem; } else if (!av_strcasecmp(cmd, "VideoIntraOnly")) { if (av_dict_set(&config->video_conf, cmd, "1", 0) < 0) goto nomem; } else if (!av_strcasecmp(cmd, "VideoHighQuality")) { if (av_dict_set(&config->video_conf, cmd, "", 0) < 0) goto nomem; } else if (!av_strcasecmp(cmd, "Video4MotionVector")) { if (av_dict_set(&config->video_conf, cmd, "", 0) < 0) goto nomem; } else if (!av_strcasecmp(cmd, "AVOptionVideo") || !av_strcasecmp(cmd, "AVOptionAudio")) { int ret; ffserver_get_arg(arg, sizeof(arg), p); ffserver_get_arg(arg2, sizeof(arg2), p); if (!av_strcasecmp(cmd, "AVOptionVideo")) ret = ffserver_save_avoption(config->dummy_vctx, arg, arg2, &config->video_opts, AV_OPT_FLAG_VIDEO_PARAM ,config, line_num); else ret = ffserver_save_avoption(config->dummy_actx, arg, arg2, &config->audio_opts, AV_OPT_FLAG_AUDIO_PARAM ,config, line_num); if (ret < 0) goto nomem; } else if (!av_strcasecmp(cmd, "AVPresetVideo") || !av_strcasecmp(cmd, "AVPresetAudio")) { ffserver_get_arg(arg, sizeof(arg), p); if (!av_strcasecmp(cmd, "AVPresetVideo")) ffserver_opt_preset(arg, config->dummy_vctx, config, line_num); else ffserver_opt_preset(arg, config->dummy_actx, config, line_num); } else if (!av_strcasecmp(cmd, "VideoTag")) { ffserver_get_arg(arg, sizeof(arg), p); if (strlen(arg) == 4) { if (av_dict_set(&config->video_conf, "VideoTag", "arg", 0) < 0) goto nomem; } } else if (!av_strcasecmp(cmd, "BitExact")) { if (av_dict_set(&config->video_conf, cmd, "", 0) < 0) goto nomem; } else if (!av_strcasecmp(cmd, "DctFastint")) { if (av_dict_set(&config->video_conf, cmd, "", 0) < 0) goto nomem; } else if (!av_strcasecmp(cmd, "IdctSimple")) { if (av_dict_set(&config->video_conf, cmd, "", 0) < 0) goto nomem; } else if (!av_strcasecmp(cmd, "Qscale")) { ffserver_get_arg(arg, sizeof(arg), p); if (av_dict_set(&config->video_conf, cmd, arg, 0) < 0) goto nomem; } else if (!av_strcasecmp(cmd, "VideoQDiff")) { ffserver_get_arg(arg, sizeof(arg), p); ffserver_set_int_param(NULL, arg, 0, 1, 31, config, line_num, "%s out of range\n", cmd); if (av_dict_set(&config->video_conf, cmd, arg, 0) < 0) goto nomem; } else if (!av_strcasecmp(cmd, "VideoQMax")) { ffserver_get_arg(arg, sizeof(arg), p); ffserver_set_int_param(NULL, arg, 0, 1, 31, config, line_num, "%s out of range\n", cmd); if (av_dict_set(&config->video_conf, cmd, arg, 0) < 0) goto nomem; } else if (!av_strcasecmp(cmd, "VideoQMin")) { ffserver_get_arg(arg, sizeof(arg), p); ffserver_set_int_param(NULL, arg, 0, 1, 31, config, line_num, "%s out of range\n", cmd); if (av_dict_set(&config->video_conf, cmd, arg, 0) < 0) goto nomem; } else if (!av_strcasecmp(cmd, "LumiMask")) { ffserver_get_arg(arg, sizeof(arg), p); ffserver_set_float_param(NULL, arg, 0, -FLT_MAX, FLT_MAX, config, line_num, "Invalid %s: %s", cmd, arg); if (av_dict_set(&config->video_conf, cmd, arg, 0) < 0) goto nomem; } else if (!av_strcasecmp(cmd, "DarkMask")) { ffserver_get_arg(arg, sizeof(arg), p); ffserver_set_float_param(NULL, arg, 0, -FLT_MAX, FLT_MAX, config, line_num, "Invalid %s: %s", cmd, arg); if (av_dict_set(&config->video_conf, cmd, arg, 0) < 0) goto nomem; } else if (!av_strcasecmp(cmd, "NoVideo")) { config->no_video = 1; } else if (!av_strcasecmp(cmd, "NoAudio")) { config->no_audio = 1; } else if (!av_strcasecmp(cmd, "ACL")) { ffserver_parse_acl_row(stream, NULL, NULL, *p, config->filename, line_num); } else if (!av_strcasecmp(cmd, "DynamicACL")) { ffserver_get_arg(stream->dynamic_acl, sizeof(stream->dynamic_acl), p); } else if (!av_strcasecmp(cmd, "RTSPOption")) { ffserver_get_arg(arg, sizeof(arg), p); av_freep(&stream->rtsp_option); stream->rtsp_option = av_strdup(arg); } else if (!av_strcasecmp(cmd, "MulticastAddress")) { ffserver_get_arg(arg, sizeof(arg), p); if (resolve_host(&stream->multicast_ip, arg)) ERROR("Invalid host/IP address: %s\n", arg); stream->is_multicast = 1; stream->loop = 1; /* default is looping */ } else if (!av_strcasecmp(cmd, "MulticastPort")) { ffserver_get_arg(arg, sizeof(arg), p); ffserver_set_int_param(&val, arg, 0, 1, 65535, config, line_num, "Invalid MulticastPort: %s\n", arg); stream->multicast_port = val; } else if (!av_strcasecmp(cmd, "MulticastTTL")) { ffserver_get_arg(arg, sizeof(arg), p); ffserver_set_int_param(&val, arg, 0, INT_MIN, INT_MAX, config, line_num, "Invalid MulticastTTL: %s\n", arg); stream->multicast_ttl = val; } else if (!av_strcasecmp(cmd, "NoLoop")) { stream->loop = 0; } else if (!av_strcasecmp(cmd, "</Stream>")) { if (stream->feed && stream->fmt && strcmp(stream->fmt->name, "ffm")) { if (config->dummy_actx->codec_id == AV_CODEC_ID_NONE) config->dummy_actx->codec_id = config->guessed_audio_codec_id; if (!config->no_audio && config->dummy_actx->codec_id != AV_CODEC_ID_NONE) { AVCodecContext *audio_enc = avcodec_alloc_context3(avcodec_find_encoder(config->dummy_actx->codec_id)); ffserver_apply_stream_config(audio_enc, config->audio_conf, &config->audio_opts); add_codec(stream, audio_enc); } if (config->dummy_vctx->codec_id == AV_CODEC_ID_NONE) config->dummy_vctx->codec_id = config->guessed_video_codec_id; if (!config->no_video && config->dummy_vctx->codec_id != AV_CODEC_ID_NONE) { AVCodecContext *video_enc = avcodec_alloc_context3(avcodec_find_encoder(config->dummy_vctx->codec_id)); ffserver_apply_stream_config(video_enc, config->video_conf, &config->video_opts); add_codec(stream, video_enc); } } av_dict_free(&config->video_opts); av_dict_free(&config->video_conf); av_dict_free(&config->audio_opts); av_dict_free(&config->audio_conf); avcodec_free_context(&config->dummy_vctx); avcodec_free_context(&config->dummy_actx); *pstream = NULL; } else if (!av_strcasecmp(cmd, "File") || !av_strcasecmp(cmd, "ReadOnlyFile")) { ffserver_get_arg(stream->feed_filename, sizeof(stream->feed_filename), p); } else { ERROR("Invalid entry '%s' inside <Stream></Stream>\n", cmd); } return 0; nomem: av_log(NULL, AV_LOG_ERROR, "Out of memory. Aborting.\n"); av_dict_free(&config->video_opts); av_dict_free(&config->video_conf); av_dict_free(&config->audio_opts); av_dict_free(&config->audio_conf); avcodec_free_context(&config->dummy_vctx); avcodec_free_context(&config->dummy_actx); return AVERROR(ENOMEM); }
true
FFmpeg
3f07dd6e392bf35a478203dc60fcbd36dfdd42aa
static int ffserver_parse_config_stream(FFServerConfig *config, const char *cmd, const char **p, int line_num, FFServerStream **pstream) { char arg[1024], arg2[1024]; FFServerStream *stream; int val; av_assert0(pstream); stream = *pstream; if (!av_strcasecmp(cmd, "<Stream")) { char *q; FFServerStream *s; stream = av_mallocz(sizeof(FFServerStream)); if (!stream) return AVERROR(ENOMEM); config->dummy_actx = avcodec_alloc_context3(NULL); config->dummy_vctx = avcodec_alloc_context3(NULL); if (!config->dummy_vctx || !config->dummy_actx) { av_free(stream); avcodec_free_context(&config->dummy_vctx); avcodec_free_context(&config->dummy_actx); return AVERROR(ENOMEM); } config->dummy_actx->codec_type = AVMEDIA_TYPE_AUDIO; config->dummy_vctx->codec_type = AVMEDIA_TYPE_VIDEO; ffserver_get_arg(stream->filename, sizeof(stream->filename), p); q = strrchr(stream->filename, '>'); if (q) *q = '\0'; for (s = config->first_stream; s; s = s->next) { if (!strcmp(stream->filename, s->filename)) ERROR("Stream '%s' already registered\n", s->filename); } stream->fmt = ffserver_guess_format(NULL, stream->filename, NULL); if (stream->fmt) { config->guessed_audio_codec_id = stream->fmt->audio_codec; config->guessed_video_codec_id = stream->fmt->video_codec; } else { config->guessed_audio_codec_id = AV_CODEC_ID_NONE; config->guessed_video_codec_id = AV_CODEC_ID_NONE; } *pstream = stream; return 0; } av_assert0(stream); if (!av_strcasecmp(cmd, "Feed")) { FFServerStream *sfeed; ffserver_get_arg(arg, sizeof(arg), p); sfeed = config->first_feed; while (sfeed) { if (!strcmp(sfeed->filename, arg)) break; sfeed = sfeed->next_feed; } if (!sfeed) ERROR("Feed with name '%s' for stream '%s' is not defined\n", arg, stream->filename); else stream->feed = sfeed; } else if (!av_strcasecmp(cmd, "Format")) { ffserver_get_arg(arg, sizeof(arg), p); if (!strcmp(arg, "status")) { stream->stream_type = STREAM_TYPE_STATUS; stream->fmt = NULL; } else { stream->stream_type = STREAM_TYPE_LIVE; if (!strcmp(arg, "jpeg")) strcpy(arg, "mjpeg"); stream->fmt = ffserver_guess_format(arg, NULL, NULL); if (!stream->fmt) ERROR("Unknown Format: %s\n", arg); } if (stream->fmt) { config->guessed_audio_codec_id = stream->fmt->audio_codec; config->guessed_video_codec_id = stream->fmt->video_codec; } } else if (!av_strcasecmp(cmd, "InputFormat")) { ffserver_get_arg(arg, sizeof(arg), p); stream->ifmt = av_find_input_format(arg); if (!stream->ifmt) ERROR("Unknown input format: %s\n", arg); } else if (!av_strcasecmp(cmd, "FaviconURL")) { if (stream->stream_type == STREAM_TYPE_STATUS) ffserver_get_arg(stream->feed_filename, sizeof(stream->feed_filename), p); else ERROR("FaviconURL only permitted for status streams\n"); } else if (!av_strcasecmp(cmd, "Author") || !av_strcasecmp(cmd, "Comment") || !av_strcasecmp(cmd, "Copyright") || !av_strcasecmp(cmd, "Title")) { char key[32]; int i; ffserver_get_arg(arg, sizeof(arg), p); for (i = 0; i < strlen(cmd); i++) key[i] = av_tolower(cmd[i]); key[i] = 0; WARNING("'%s' option in configuration file is deprecated, " "use 'Metadata %s VALUE' instead\n", cmd, key); if (av_dict_set(&stream->metadata, key, arg, 0) < 0) goto nomem; } else if (!av_strcasecmp(cmd, "Metadata")) { ffserver_get_arg(arg, sizeof(arg), p); ffserver_get_arg(arg2, sizeof(arg2), p); if (av_dict_set(&stream->metadata, arg, arg2, 0) < 0) goto nomem; } else if (!av_strcasecmp(cmd, "Preroll")) { ffserver_get_arg(arg, sizeof(arg), p); stream->prebuffer = atof(arg) * 1000; } else if (!av_strcasecmp(cmd, "StartSendOnKey")) { stream->send_on_key = 1; } else if (!av_strcasecmp(cmd, "AudioCodec")) { ffserver_get_arg(arg, sizeof(arg), p); ffserver_set_codec(config->dummy_actx, arg, config, line_num); } else if (!av_strcasecmp(cmd, "VideoCodec")) { ffserver_get_arg(arg, sizeof(arg), p); ffserver_set_codec(config->dummy_vctx, arg, config, line_num); } else if (!av_strcasecmp(cmd, "MaxTime")) { ffserver_get_arg(arg, sizeof(arg), p); stream->max_time = atof(arg) * 1000; } else if (!av_strcasecmp(cmd, "AudioBitRate")) { float f; ffserver_get_arg(arg, sizeof(arg), p); ffserver_set_float_param(&f, arg, 1000, 0, FLT_MAX, config, line_num, "Invalid %s: %s\n", cmd, arg); if (av_dict_set_int(&config->audio_conf, cmd, lrintf(f), 0) < 0) goto nomem; } else if (!av_strcasecmp(cmd, "AudioChannels")) { ffserver_get_arg(arg, sizeof(arg), p); ffserver_set_int_param(NULL, arg, 0, 1, 8, config, line_num, "Invalid %s: %s, valid range is 1-8.", cmd, arg); if (av_dict_set(&config->audio_conf, cmd, arg, 0) < 0) goto nomem; } else if (!av_strcasecmp(cmd, "AudioSampleRate")) { ffserver_get_arg(arg, sizeof(arg), p); ffserver_set_int_param(NULL, arg, 0, 0, INT_MAX, config, line_num, "Invalid %s: %s", cmd, arg); if (av_dict_set(&config->audio_conf, cmd, arg, 0) < 0) goto nomem; } else if (!av_strcasecmp(cmd, "VideoBitRateRange")) { int minrate, maxrate; ffserver_get_arg(arg, sizeof(arg), p); if (sscanf(arg, "%d-%d", &minrate, &maxrate) == 2) { if (av_dict_set_int(&config->video_conf, "VideoBitRateRangeMin", minrate, 0) < 0 || av_dict_set_int(&config->video_conf, "VideoBitRateRangeMax", maxrate, 0) < 0) goto nomem; } else ERROR("Incorrect format for VideoBitRateRange -- should be " "<min>-<max>: %s\n", arg); } else if (!av_strcasecmp(cmd, "Debug")) { ffserver_get_arg(arg, sizeof(arg), p); ffserver_set_int_param(NULL, arg, 0, INT_MIN, INT_MAX, config, line_num, "Invalid %s: %s", cmd, arg); if (av_dict_set(&config->video_conf, cmd, arg, 0) < 0) goto nomem; } else if (!av_strcasecmp(cmd, "Strict")) { ffserver_get_arg(arg, sizeof(arg), p); ffserver_set_int_param(NULL, arg, 0, INT_MIN, INT_MAX, config, line_num, "Invalid %s: %s", cmd, arg); if (av_dict_set(&config->video_conf, cmd, arg, 0) < 0) goto nomem; } else if (!av_strcasecmp(cmd, "VideoBufferSize")) { ffserver_get_arg(arg, sizeof(arg), p); ffserver_set_int_param(NULL, arg, 8*1024, 0, INT_MAX, config, line_num, "Invalid %s: %s", cmd, arg); if (av_dict_set(&config->video_conf, cmd, arg, 0) < 0) goto nomem; } else if (!av_strcasecmp(cmd, "VideoBitRateTolerance")) { ffserver_get_arg(arg, sizeof(arg), p); ffserver_set_int_param(NULL, arg, 1000, INT_MIN, INT_MAX, config, line_num, "Invalid %s: %s", cmd, arg); if (av_dict_set(&config->video_conf, cmd, arg, 0) < 0) goto nomem; } else if (!av_strcasecmp(cmd, "VideoBitRate")) { ffserver_get_arg(arg, sizeof(arg), p); ffserver_set_int_param(NULL, arg, 1000, 0, INT_MAX, config, line_num, "Invalid %s: %s", cmd, arg); if (av_dict_set(&config->video_conf, cmd, arg, 0) < 0) goto nomem; } else if (!av_strcasecmp(cmd, "VideoSize")) { int ret, w, h; ffserver_get_arg(arg, sizeof(arg), p); ret = av_parse_video_size(&w, &h, arg); if (ret < 0) ERROR("Invalid video size '%s'\n", arg); else if ((w % 2) || (h % 2)) WARNING("Image size is not a multiple of 2\n"); if (av_dict_set_int(&config->video_conf, "VideoSizeWidth", w, 0) < 0 || av_dict_set_int(&config->video_conf, "VideoSizeHeight", h, 0) < 0) goto nomem; } else if (!av_strcasecmp(cmd, "VideoFrameRate")) { AVRational frame_rate; ffserver_get_arg(arg, sizeof(arg), p); if (av_parse_video_rate(&frame_rate, arg) < 0) { ERROR("Incorrect frame rate: %s\n", arg); } else { if (av_dict_set_int(&config->video_conf, "VideoFrameRateNum", frame_rate.num, 0) < 0 || av_dict_set_int(&config->video_conf, "VideoFrameRateDen", frame_rate.den, 0) < 0) goto nomem; } } else if (!av_strcasecmp(cmd, "PixelFormat")) { enum AVPixelFormat pix_fmt; ffserver_get_arg(arg, sizeof(arg), p); pix_fmt = av_get_pix_fmt(arg); if (pix_fmt == AV_PIX_FMT_NONE) ERROR("Unknown pixel format: %s\n", arg); if (av_dict_set_int(&config->video_conf, cmd, pix_fmt, 0) < 0) goto nomem; } else if (!av_strcasecmp(cmd, "VideoGopSize")) { ffserver_get_arg(arg, sizeof(arg), p); ffserver_set_int_param(NULL, arg, 0, INT_MIN, INT_MAX, config, line_num, "Invalid %s: %s", cmd, arg); if (av_dict_set(&config->video_conf, cmd, arg, 0) < 0) goto nomem; } else if (!av_strcasecmp(cmd, "VideoIntraOnly")) { if (av_dict_set(&config->video_conf, cmd, "1", 0) < 0) goto nomem; } else if (!av_strcasecmp(cmd, "VideoHighQuality")) { if (av_dict_set(&config->video_conf, cmd, "", 0) < 0) goto nomem; } else if (!av_strcasecmp(cmd, "Video4MotionVector")) { if (av_dict_set(&config->video_conf, cmd, "", 0) < 0) goto nomem; } else if (!av_strcasecmp(cmd, "AVOptionVideo") || !av_strcasecmp(cmd, "AVOptionAudio")) { int ret; ffserver_get_arg(arg, sizeof(arg), p); ffserver_get_arg(arg2, sizeof(arg2), p); if (!av_strcasecmp(cmd, "AVOptionVideo")) ret = ffserver_save_avoption(config->dummy_vctx, arg, arg2, &config->video_opts, AV_OPT_FLAG_VIDEO_PARAM ,config, line_num); else ret = ffserver_save_avoption(config->dummy_actx, arg, arg2, &config->audio_opts, AV_OPT_FLAG_AUDIO_PARAM ,config, line_num); if (ret < 0) goto nomem; } else if (!av_strcasecmp(cmd, "AVPresetVideo") || !av_strcasecmp(cmd, "AVPresetAudio")) { ffserver_get_arg(arg, sizeof(arg), p); if (!av_strcasecmp(cmd, "AVPresetVideo")) ffserver_opt_preset(arg, config->dummy_vctx, config, line_num); else ffserver_opt_preset(arg, config->dummy_actx, config, line_num); } else if (!av_strcasecmp(cmd, "VideoTag")) { ffserver_get_arg(arg, sizeof(arg), p); if (strlen(arg) == 4) { if (av_dict_set(&config->video_conf, "VideoTag", "arg", 0) < 0) goto nomem; } } else if (!av_strcasecmp(cmd, "BitExact")) { if (av_dict_set(&config->video_conf, cmd, "", 0) < 0) goto nomem; } else if (!av_strcasecmp(cmd, "DctFastint")) { if (av_dict_set(&config->video_conf, cmd, "", 0) < 0) goto nomem; } else if (!av_strcasecmp(cmd, "IdctSimple")) { if (av_dict_set(&config->video_conf, cmd, "", 0) < 0) goto nomem; } else if (!av_strcasecmp(cmd, "Qscale")) { ffserver_get_arg(arg, sizeof(arg), p); if (av_dict_set(&config->video_conf, cmd, arg, 0) < 0) goto nomem; } else if (!av_strcasecmp(cmd, "VideoQDiff")) { ffserver_get_arg(arg, sizeof(arg), p); ffserver_set_int_param(NULL, arg, 0, 1, 31, config, line_num, "%s out of range\n", cmd); if (av_dict_set(&config->video_conf, cmd, arg, 0) < 0) goto nomem; } else if (!av_strcasecmp(cmd, "VideoQMax")) { ffserver_get_arg(arg, sizeof(arg), p); ffserver_set_int_param(NULL, arg, 0, 1, 31, config, line_num, "%s out of range\n", cmd); if (av_dict_set(&config->video_conf, cmd, arg, 0) < 0) goto nomem; } else if (!av_strcasecmp(cmd, "VideoQMin")) { ffserver_get_arg(arg, sizeof(arg), p); ffserver_set_int_param(NULL, arg, 0, 1, 31, config, line_num, "%s out of range\n", cmd); if (av_dict_set(&config->video_conf, cmd, arg, 0) < 0) goto nomem; } else if (!av_strcasecmp(cmd, "LumiMask")) { ffserver_get_arg(arg, sizeof(arg), p); ffserver_set_float_param(NULL, arg, 0, -FLT_MAX, FLT_MAX, config, line_num, "Invalid %s: %s", cmd, arg); if (av_dict_set(&config->video_conf, cmd, arg, 0) < 0) goto nomem; } else if (!av_strcasecmp(cmd, "DarkMask")) { ffserver_get_arg(arg, sizeof(arg), p); ffserver_set_float_param(NULL, arg, 0, -FLT_MAX, FLT_MAX, config, line_num, "Invalid %s: %s", cmd, arg); if (av_dict_set(&config->video_conf, cmd, arg, 0) < 0) goto nomem; } else if (!av_strcasecmp(cmd, "NoVideo")) { config->no_video = 1; } else if (!av_strcasecmp(cmd, "NoAudio")) { config->no_audio = 1; } else if (!av_strcasecmp(cmd, "ACL")) { ffserver_parse_acl_row(stream, NULL, NULL, *p, config->filename, line_num); } else if (!av_strcasecmp(cmd, "DynamicACL")) { ffserver_get_arg(stream->dynamic_acl, sizeof(stream->dynamic_acl), p); } else if (!av_strcasecmp(cmd, "RTSPOption")) { ffserver_get_arg(arg, sizeof(arg), p); av_freep(&stream->rtsp_option); stream->rtsp_option = av_strdup(arg); } else if (!av_strcasecmp(cmd, "MulticastAddress")) { ffserver_get_arg(arg, sizeof(arg), p); if (resolve_host(&stream->multicast_ip, arg)) ERROR("Invalid host/IP address: %s\n", arg); stream->is_multicast = 1; stream->loop = 1; } else if (!av_strcasecmp(cmd, "MulticastPort")) { ffserver_get_arg(arg, sizeof(arg), p); ffserver_set_int_param(&val, arg, 0, 1, 65535, config, line_num, "Invalid MulticastPort: %s\n", arg); stream->multicast_port = val; } else if (!av_strcasecmp(cmd, "MulticastTTL")) { ffserver_get_arg(arg, sizeof(arg), p); ffserver_set_int_param(&val, arg, 0, INT_MIN, INT_MAX, config, line_num, "Invalid MulticastTTL: %s\n", arg); stream->multicast_ttl = val; } else if (!av_strcasecmp(cmd, "NoLoop")) { stream->loop = 0; } else if (!av_strcasecmp(cmd, "</Stream>")) { if (stream->feed && stream->fmt && strcmp(stream->fmt->name, "ffm")) { if (config->dummy_actx->codec_id == AV_CODEC_ID_NONE) config->dummy_actx->codec_id = config->guessed_audio_codec_id; if (!config->no_audio && config->dummy_actx->codec_id != AV_CODEC_ID_NONE) { AVCodecContext *audio_enc = avcodec_alloc_context3(avcodec_find_encoder(config->dummy_actx->codec_id)); ffserver_apply_stream_config(audio_enc, config->audio_conf, &config->audio_opts); add_codec(stream, audio_enc); } if (config->dummy_vctx->codec_id == AV_CODEC_ID_NONE) config->dummy_vctx->codec_id = config->guessed_video_codec_id; if (!config->no_video && config->dummy_vctx->codec_id != AV_CODEC_ID_NONE) { AVCodecContext *video_enc = avcodec_alloc_context3(avcodec_find_encoder(config->dummy_vctx->codec_id)); ffserver_apply_stream_config(video_enc, config->video_conf, &config->video_opts); add_codec(stream, video_enc); } } av_dict_free(&config->video_opts); av_dict_free(&config->video_conf); av_dict_free(&config->audio_opts); av_dict_free(&config->audio_conf); avcodec_free_context(&config->dummy_vctx); avcodec_free_context(&config->dummy_actx); *pstream = NULL; } else if (!av_strcasecmp(cmd, "File") || !av_strcasecmp(cmd, "ReadOnlyFile")) { ffserver_get_arg(stream->feed_filename, sizeof(stream->feed_filename), p); } else { ERROR("Invalid entry '%s' inside <Stream></Stream>\n", cmd); } return 0; nomem: av_log(NULL, AV_LOG_ERROR, "Out of memory. Aborting.\n"); av_dict_free(&config->video_opts); av_dict_free(&config->video_conf); av_dict_free(&config->audio_opts); av_dict_free(&config->audio_conf); avcodec_free_context(&config->dummy_vctx); avcodec_free_context(&config->dummy_actx); return AVERROR(ENOMEM); }
{ "code": [ " if (av_dict_set(&config->video_conf, cmd, \"1\", 0) < 0)", " if (av_dict_set(&config->video_conf, \"VideoTag\", \"arg\", 0) < 0)" ], "line_no": [ 439, 501 ] }
static int FUNC_0(FFServerConfig *VAR_0, const char *VAR_1, const char **VAR_2, int VAR_3, FFServerStream **VAR_4) { char VAR_5[1024], VAR_6[1024]; FFServerStream *stream; int VAR_7; av_assert0(VAR_4); stream = *VAR_4; if (!av_strcasecmp(VAR_1, "<Stream")) { char *VAR_8; FFServerStream *s; stream = av_mallocz(sizeof(FFServerStream)); if (!stream) return AVERROR(ENOMEM); VAR_0->dummy_actx = avcodec_alloc_context3(NULL); VAR_0->dummy_vctx = avcodec_alloc_context3(NULL); if (!VAR_0->dummy_vctx || !VAR_0->dummy_actx) { av_free(stream); avcodec_free_context(&VAR_0->dummy_vctx); avcodec_free_context(&VAR_0->dummy_actx); return AVERROR(ENOMEM); } VAR_0->dummy_actx->codec_type = AVMEDIA_TYPE_AUDIO; VAR_0->dummy_vctx->codec_type = AVMEDIA_TYPE_VIDEO; ffserver_get_arg(stream->filename, sizeof(stream->filename), VAR_2); VAR_8 = strrchr(stream->filename, '>'); if (VAR_8) *VAR_8 = '\0'; for (s = VAR_0->first_stream; s; s = s->next) { if (!strcmp(stream->filename, s->filename)) ERROR("Stream '%s' already registered\n", s->filename); } stream->fmt = ffserver_guess_format(NULL, stream->filename, NULL); if (stream->fmt) { VAR_0->guessed_audio_codec_id = stream->fmt->audio_codec; VAR_0->guessed_video_codec_id = stream->fmt->video_codec; } else { VAR_0->guessed_audio_codec_id = AV_CODEC_ID_NONE; VAR_0->guessed_video_codec_id = AV_CODEC_ID_NONE; } *VAR_4 = stream; return 0; } av_assert0(stream); if (!av_strcasecmp(VAR_1, "Feed")) { FFServerStream *sfeed; ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2); sfeed = VAR_0->first_feed; while (sfeed) { if (!strcmp(sfeed->filename, VAR_5)) break; sfeed = sfeed->next_feed; } if (!sfeed) ERROR("Feed with name '%s' for stream '%s' is not defined\n", VAR_5, stream->filename); else stream->feed = sfeed; } else if (!av_strcasecmp(VAR_1, "Format")) { ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2); if (!strcmp(VAR_5, "status")) { stream->stream_type = STREAM_TYPE_STATUS; stream->fmt = NULL; } else { stream->stream_type = STREAM_TYPE_LIVE; if (!strcmp(VAR_5, "jpeg")) strcpy(VAR_5, "mjpeg"); stream->fmt = ffserver_guess_format(VAR_5, NULL, NULL); if (!stream->fmt) ERROR("Unknown Format: %s\n", VAR_5); } if (stream->fmt) { VAR_0->guessed_audio_codec_id = stream->fmt->audio_codec; VAR_0->guessed_video_codec_id = stream->fmt->video_codec; } } else if (!av_strcasecmp(VAR_1, "InputFormat")) { ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2); stream->ifmt = av_find_input_format(VAR_5); if (!stream->ifmt) ERROR("Unknown input format: %s\n", VAR_5); } else if (!av_strcasecmp(VAR_1, "FaviconURL")) { if (stream->stream_type == STREAM_TYPE_STATUS) ffserver_get_arg(stream->feed_filename, sizeof(stream->feed_filename), VAR_2); else ERROR("FaviconURL only permitted for status streams\n"); } else if (!av_strcasecmp(VAR_1, "Author") || !av_strcasecmp(VAR_1, "Comment") || !av_strcasecmp(VAR_1, "Copyright") || !av_strcasecmp(VAR_1, "Title")) { char VAR_9[32]; int VAR_10; ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2); for (VAR_10 = 0; VAR_10 < strlen(VAR_1); VAR_10++) VAR_9[VAR_10] = av_tolower(VAR_1[VAR_10]); VAR_9[VAR_10] = 0; WARNING("'%s' option in configuration file is deprecated, " "use 'Metadata %s VALUE' instead\n", VAR_1, VAR_9); if (av_dict_set(&stream->metadata, VAR_9, VAR_5, 0) < 0) goto nomem; } else if (!av_strcasecmp(VAR_1, "Metadata")) { ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2); ffserver_get_arg(VAR_6, sizeof(VAR_6), VAR_2); if (av_dict_set(&stream->metadata, VAR_5, VAR_6, 0) < 0) goto nomem; } else if (!av_strcasecmp(VAR_1, "Preroll")) { ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2); stream->prebuffer = atof(VAR_5) * 1000; } else if (!av_strcasecmp(VAR_1, "StartSendOnKey")) { stream->send_on_key = 1; } else if (!av_strcasecmp(VAR_1, "AudioCodec")) { ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2); ffserver_set_codec(VAR_0->dummy_actx, VAR_5, VAR_0, VAR_3); } else if (!av_strcasecmp(VAR_1, "VideoCodec")) { ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2); ffserver_set_codec(VAR_0->dummy_vctx, VAR_5, VAR_0, VAR_3); } else if (!av_strcasecmp(VAR_1, "MaxTime")) { ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2); stream->max_time = atof(VAR_5) * 1000; } else if (!av_strcasecmp(VAR_1, "AudioBitRate")) { float VAR_11; ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2); ffserver_set_float_param(&VAR_11, VAR_5, 1000, 0, FLT_MAX, VAR_0, VAR_3, "Invalid %s: %s\n", VAR_1, VAR_5); if (av_dict_set_int(&VAR_0->audio_conf, VAR_1, lrintf(VAR_11), 0) < 0) goto nomem; } else if (!av_strcasecmp(VAR_1, "AudioChannels")) { ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2); ffserver_set_int_param(NULL, VAR_5, 0, 1, 8, VAR_0, VAR_3, "Invalid %s: %s, valid range is 1-8.", VAR_1, VAR_5); if (av_dict_set(&VAR_0->audio_conf, VAR_1, VAR_5, 0) < 0) goto nomem; } else if (!av_strcasecmp(VAR_1, "AudioSampleRate")) { ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2); ffserver_set_int_param(NULL, VAR_5, 0, 0, INT_MAX, VAR_0, VAR_3, "Invalid %s: %s", VAR_1, VAR_5); if (av_dict_set(&VAR_0->audio_conf, VAR_1, VAR_5, 0) < 0) goto nomem; } else if (!av_strcasecmp(VAR_1, "VideoBitRateRange")) { int VAR_12, VAR_13; ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2); if (sscanf(VAR_5, "%d-%d", &VAR_12, &VAR_13) == 2) { if (av_dict_set_int(&VAR_0->video_conf, "VideoBitRateRangeMin", VAR_12, 0) < 0 || av_dict_set_int(&VAR_0->video_conf, "VideoBitRateRangeMax", VAR_13, 0) < 0) goto nomem; } else ERROR("Incorrect format for VideoBitRateRange -- should be " "<min>-<max>: %s\n", VAR_5); } else if (!av_strcasecmp(VAR_1, "Debug")) { ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2); ffserver_set_int_param(NULL, VAR_5, 0, INT_MIN, INT_MAX, VAR_0, VAR_3, "Invalid %s: %s", VAR_1, VAR_5); if (av_dict_set(&VAR_0->video_conf, VAR_1, VAR_5, 0) < 0) goto nomem; } else if (!av_strcasecmp(VAR_1, "Strict")) { ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2); ffserver_set_int_param(NULL, VAR_5, 0, INT_MIN, INT_MAX, VAR_0, VAR_3, "Invalid %s: %s", VAR_1, VAR_5); if (av_dict_set(&VAR_0->video_conf, VAR_1, VAR_5, 0) < 0) goto nomem; } else if (!av_strcasecmp(VAR_1, "VideoBufferSize")) { ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2); ffserver_set_int_param(NULL, VAR_5, 8*1024, 0, INT_MAX, VAR_0, VAR_3, "Invalid %s: %s", VAR_1, VAR_5); if (av_dict_set(&VAR_0->video_conf, VAR_1, VAR_5, 0) < 0) goto nomem; } else if (!av_strcasecmp(VAR_1, "VideoBitRateTolerance")) { ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2); ffserver_set_int_param(NULL, VAR_5, 1000, INT_MIN, INT_MAX, VAR_0, VAR_3, "Invalid %s: %s", VAR_1, VAR_5); if (av_dict_set(&VAR_0->video_conf, VAR_1, VAR_5, 0) < 0) goto nomem; } else if (!av_strcasecmp(VAR_1, "VideoBitRate")) { ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2); ffserver_set_int_param(NULL, VAR_5, 1000, 0, INT_MAX, VAR_0, VAR_3, "Invalid %s: %s", VAR_1, VAR_5); if (av_dict_set(&VAR_0->video_conf, VAR_1, VAR_5, 0) < 0) goto nomem; } else if (!av_strcasecmp(VAR_1, "VideoSize")) { int VAR_18, VAR_15, VAR_16; ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2); VAR_18 = av_parse_video_size(&VAR_15, &VAR_16, VAR_5); if (VAR_18 < 0) ERROR("Invalid video size '%s'\n", VAR_5); else if ((VAR_15 % 2) || (VAR_16 % 2)) WARNING("Image size is not a multiple of 2\n"); if (av_dict_set_int(&VAR_0->video_conf, "VideoSizeWidth", VAR_15, 0) < 0 || av_dict_set_int(&VAR_0->video_conf, "VideoSizeHeight", VAR_16, 0) < 0) goto nomem; } else if (!av_strcasecmp(VAR_1, "VideoFrameRate")) { AVRational frame_rate; ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2); if (av_parse_video_rate(&frame_rate, VAR_5) < 0) { ERROR("Incorrect frame rate: %s\n", VAR_5); } else { if (av_dict_set_int(&VAR_0->video_conf, "VideoFrameRateNum", frame_rate.num, 0) < 0 || av_dict_set_int(&VAR_0->video_conf, "VideoFrameRateDen", frame_rate.den, 0) < 0) goto nomem; } } else if (!av_strcasecmp(VAR_1, "PixelFormat")) { enum AVPixelFormat VAR_17; ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2); VAR_17 = av_get_pix_fmt(VAR_5); if (VAR_17 == AV_PIX_FMT_NONE) ERROR("Unknown pixel format: %s\n", VAR_5); if (av_dict_set_int(&VAR_0->video_conf, VAR_1, VAR_17, 0) < 0) goto nomem; } else if (!av_strcasecmp(VAR_1, "VideoGopSize")) { ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2); ffserver_set_int_param(NULL, VAR_5, 0, INT_MIN, INT_MAX, VAR_0, VAR_3, "Invalid %s: %s", VAR_1, VAR_5); if (av_dict_set(&VAR_0->video_conf, VAR_1, VAR_5, 0) < 0) goto nomem; } else if (!av_strcasecmp(VAR_1, "VideoIntraOnly")) { if (av_dict_set(&VAR_0->video_conf, VAR_1, "1", 0) < 0) goto nomem; } else if (!av_strcasecmp(VAR_1, "VideoHighQuality")) { if (av_dict_set(&VAR_0->video_conf, VAR_1, "", 0) < 0) goto nomem; } else if (!av_strcasecmp(VAR_1, "Video4MotionVector")) { if (av_dict_set(&VAR_0->video_conf, VAR_1, "", 0) < 0) goto nomem; } else if (!av_strcasecmp(VAR_1, "AVOptionVideo") || !av_strcasecmp(VAR_1, "AVOptionAudio")) { int VAR_18; ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2); ffserver_get_arg(VAR_6, sizeof(VAR_6), VAR_2); if (!av_strcasecmp(VAR_1, "AVOptionVideo")) VAR_18 = ffserver_save_avoption(VAR_0->dummy_vctx, VAR_5, VAR_6, &VAR_0->video_opts, AV_OPT_FLAG_VIDEO_PARAM ,VAR_0, VAR_3); else VAR_18 = ffserver_save_avoption(VAR_0->dummy_actx, VAR_5, VAR_6, &VAR_0->audio_opts, AV_OPT_FLAG_AUDIO_PARAM ,VAR_0, VAR_3); if (VAR_18 < 0) goto nomem; } else if (!av_strcasecmp(VAR_1, "AVPresetVideo") || !av_strcasecmp(VAR_1, "AVPresetAudio")) { ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2); if (!av_strcasecmp(VAR_1, "AVPresetVideo")) ffserver_opt_preset(VAR_5, VAR_0->dummy_vctx, VAR_0, VAR_3); else ffserver_opt_preset(VAR_5, VAR_0->dummy_actx, VAR_0, VAR_3); } else if (!av_strcasecmp(VAR_1, "VideoTag")) { ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2); if (strlen(VAR_5) == 4) { if (av_dict_set(&VAR_0->video_conf, "VideoTag", "VAR_5", 0) < 0) goto nomem; } } else if (!av_strcasecmp(VAR_1, "BitExact")) { if (av_dict_set(&VAR_0->video_conf, VAR_1, "", 0) < 0) goto nomem; } else if (!av_strcasecmp(VAR_1, "DctFastint")) { if (av_dict_set(&VAR_0->video_conf, VAR_1, "", 0) < 0) goto nomem; } else if (!av_strcasecmp(VAR_1, "IdctSimple")) { if (av_dict_set(&VAR_0->video_conf, VAR_1, "", 0) < 0) goto nomem; } else if (!av_strcasecmp(VAR_1, "Qscale")) { ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2); if (av_dict_set(&VAR_0->video_conf, VAR_1, VAR_5, 0) < 0) goto nomem; } else if (!av_strcasecmp(VAR_1, "VideoQDiff")) { ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2); ffserver_set_int_param(NULL, VAR_5, 0, 1, 31, VAR_0, VAR_3, "%s out of range\n", VAR_1); if (av_dict_set(&VAR_0->video_conf, VAR_1, VAR_5, 0) < 0) goto nomem; } else if (!av_strcasecmp(VAR_1, "VideoQMax")) { ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2); ffserver_set_int_param(NULL, VAR_5, 0, 1, 31, VAR_0, VAR_3, "%s out of range\n", VAR_1); if (av_dict_set(&VAR_0->video_conf, VAR_1, VAR_5, 0) < 0) goto nomem; } else if (!av_strcasecmp(VAR_1, "VideoQMin")) { ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2); ffserver_set_int_param(NULL, VAR_5, 0, 1, 31, VAR_0, VAR_3, "%s out of range\n", VAR_1); if (av_dict_set(&VAR_0->video_conf, VAR_1, VAR_5, 0) < 0) goto nomem; } else if (!av_strcasecmp(VAR_1, "LumiMask")) { ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2); ffserver_set_float_param(NULL, VAR_5, 0, -FLT_MAX, FLT_MAX, VAR_0, VAR_3, "Invalid %s: %s", VAR_1, VAR_5); if (av_dict_set(&VAR_0->video_conf, VAR_1, VAR_5, 0) < 0) goto nomem; } else if (!av_strcasecmp(VAR_1, "DarkMask")) { ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2); ffserver_set_float_param(NULL, VAR_5, 0, -FLT_MAX, FLT_MAX, VAR_0, VAR_3, "Invalid %s: %s", VAR_1, VAR_5); if (av_dict_set(&VAR_0->video_conf, VAR_1, VAR_5, 0) < 0) goto nomem; } else if (!av_strcasecmp(VAR_1, "NoVideo")) { VAR_0->no_video = 1; } else if (!av_strcasecmp(VAR_1, "NoAudio")) { VAR_0->no_audio = 1; } else if (!av_strcasecmp(VAR_1, "ACL")) { ffserver_parse_acl_row(stream, NULL, NULL, *VAR_2, VAR_0->filename, VAR_3); } else if (!av_strcasecmp(VAR_1, "DynamicACL")) { ffserver_get_arg(stream->dynamic_acl, sizeof(stream->dynamic_acl), VAR_2); } else if (!av_strcasecmp(VAR_1, "RTSPOption")) { ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2); av_freep(&stream->rtsp_option); stream->rtsp_option = av_strdup(VAR_5); } else if (!av_strcasecmp(VAR_1, "MulticastAddress")) { ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2); if (resolve_host(&stream->multicast_ip, VAR_5)) ERROR("Invalid host/IP address: %s\n", VAR_5); stream->is_multicast = 1; stream->loop = 1; } else if (!av_strcasecmp(VAR_1, "MulticastPort")) { ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2); ffserver_set_int_param(&VAR_7, VAR_5, 0, 1, 65535, VAR_0, VAR_3, "Invalid MulticastPort: %s\n", VAR_5); stream->multicast_port = VAR_7; } else if (!av_strcasecmp(VAR_1, "MulticastTTL")) { ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2); ffserver_set_int_param(&VAR_7, VAR_5, 0, INT_MIN, INT_MAX, VAR_0, VAR_3, "Invalid MulticastTTL: %s\n", VAR_5); stream->multicast_ttl = VAR_7; } else if (!av_strcasecmp(VAR_1, "NoLoop")) { stream->loop = 0; } else if (!av_strcasecmp(VAR_1, "</Stream>")) { if (stream->feed && stream->fmt && strcmp(stream->fmt->name, "ffm")) { if (VAR_0->dummy_actx->codec_id == AV_CODEC_ID_NONE) VAR_0->dummy_actx->codec_id = VAR_0->guessed_audio_codec_id; if (!VAR_0->no_audio && VAR_0->dummy_actx->codec_id != AV_CODEC_ID_NONE) { AVCodecContext *audio_enc = avcodec_alloc_context3(avcodec_find_encoder(VAR_0->dummy_actx->codec_id)); ffserver_apply_stream_config(audio_enc, VAR_0->audio_conf, &VAR_0->audio_opts); add_codec(stream, audio_enc); } if (VAR_0->dummy_vctx->codec_id == AV_CODEC_ID_NONE) VAR_0->dummy_vctx->codec_id = VAR_0->guessed_video_codec_id; if (!VAR_0->no_video && VAR_0->dummy_vctx->codec_id != AV_CODEC_ID_NONE) { AVCodecContext *video_enc = avcodec_alloc_context3(avcodec_find_encoder(VAR_0->dummy_vctx->codec_id)); ffserver_apply_stream_config(video_enc, VAR_0->video_conf, &VAR_0->video_opts); add_codec(stream, video_enc); } } av_dict_free(&VAR_0->video_opts); av_dict_free(&VAR_0->video_conf); av_dict_free(&VAR_0->audio_opts); av_dict_free(&VAR_0->audio_conf); avcodec_free_context(&VAR_0->dummy_vctx); avcodec_free_context(&VAR_0->dummy_actx); *VAR_4 = NULL; } else if (!av_strcasecmp(VAR_1, "File") || !av_strcasecmp(VAR_1, "ReadOnlyFile")) { ffserver_get_arg(stream->feed_filename, sizeof(stream->feed_filename), VAR_2); } else { ERROR("Invalid entry '%s' inside <Stream></Stream>\n", VAR_1); } return 0; nomem: av_log(NULL, AV_LOG_ERROR, "Out of memory. Aborting.\n"); av_dict_free(&VAR_0->video_opts); av_dict_free(&VAR_0->video_conf); av_dict_free(&VAR_0->audio_opts); av_dict_free(&VAR_0->audio_conf); avcodec_free_context(&VAR_0->dummy_vctx); avcodec_free_context(&VAR_0->dummy_actx); return AVERROR(ENOMEM); }
[ "static int FUNC_0(FFServerConfig *VAR_0, const char *VAR_1, const char **VAR_2,\nint VAR_3, FFServerStream **VAR_4)\n{", "char VAR_5[1024], VAR_6[1024];", "FFServerStream *stream;", "int VAR_7;", "av_assert0(VAR_4);", "stream = *VAR_4;", "if (!av_strcasecmp(VAR_1, \"<Stream\")) {", "char *VAR_8;", "FFServerStream *s;", "stream = av_mallocz(sizeof(FFServerStream));", "if (!stream)\nreturn AVERROR(ENOMEM);", "VAR_0->dummy_actx = avcodec_alloc_context3(NULL);", "VAR_0->dummy_vctx = avcodec_alloc_context3(NULL);", "if (!VAR_0->dummy_vctx || !VAR_0->dummy_actx) {", "av_free(stream);", "avcodec_free_context(&VAR_0->dummy_vctx);", "avcodec_free_context(&VAR_0->dummy_actx);", "return AVERROR(ENOMEM);", "}", "VAR_0->dummy_actx->codec_type = AVMEDIA_TYPE_AUDIO;", "VAR_0->dummy_vctx->codec_type = AVMEDIA_TYPE_VIDEO;", "ffserver_get_arg(stream->filename, sizeof(stream->filename), VAR_2);", "VAR_8 = strrchr(stream->filename, '>');", "if (VAR_8)\n*VAR_8 = '\\0';", "for (s = VAR_0->first_stream; s; s = s->next) {", "if (!strcmp(stream->filename, s->filename))\nERROR(\"Stream '%s' already registered\\n\", s->filename);", "}", "stream->fmt = ffserver_guess_format(NULL, stream->filename, NULL);", "if (stream->fmt) {", "VAR_0->guessed_audio_codec_id = stream->fmt->audio_codec;", "VAR_0->guessed_video_codec_id = stream->fmt->video_codec;", "} else {", "VAR_0->guessed_audio_codec_id = AV_CODEC_ID_NONE;", "VAR_0->guessed_video_codec_id = AV_CODEC_ID_NONE;", "}", "*VAR_4 = stream;", "return 0;", "}", "av_assert0(stream);", "if (!av_strcasecmp(VAR_1, \"Feed\")) {", "FFServerStream *sfeed;", "ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2);", "sfeed = VAR_0->first_feed;", "while (sfeed) {", "if (!strcmp(sfeed->filename, VAR_5))\nbreak;", "sfeed = sfeed->next_feed;", "}", "if (!sfeed)\nERROR(\"Feed with name '%s' for stream '%s' is not defined\\n\", VAR_5,\nstream->filename);", "else\nstream->feed = sfeed;", "} else if (!av_strcasecmp(VAR_1, \"Format\")) {", "ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2);", "if (!strcmp(VAR_5, \"status\")) {", "stream->stream_type = STREAM_TYPE_STATUS;", "stream->fmt = NULL;", "} else {", "stream->stream_type = STREAM_TYPE_LIVE;", "if (!strcmp(VAR_5, \"jpeg\"))\nstrcpy(VAR_5, \"mjpeg\");", "stream->fmt = ffserver_guess_format(VAR_5, NULL, NULL);", "if (!stream->fmt)\nERROR(\"Unknown Format: %s\\n\", VAR_5);", "}", "if (stream->fmt) {", "VAR_0->guessed_audio_codec_id = stream->fmt->audio_codec;", "VAR_0->guessed_video_codec_id = stream->fmt->video_codec;", "}", "} else if (!av_strcasecmp(VAR_1, \"InputFormat\")) {", "ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2);", "stream->ifmt = av_find_input_format(VAR_5);", "if (!stream->ifmt)\nERROR(\"Unknown input format: %s\\n\", VAR_5);", "} else if (!av_strcasecmp(VAR_1, \"FaviconURL\")) {", "if (stream->stream_type == STREAM_TYPE_STATUS)\nffserver_get_arg(stream->feed_filename,\nsizeof(stream->feed_filename), VAR_2);", "else\nERROR(\"FaviconURL only permitted for status streams\\n\");", "} else if (!av_strcasecmp(VAR_1, \"Author\") ||", "!av_strcasecmp(VAR_1, \"Comment\") ||\n!av_strcasecmp(VAR_1, \"Copyright\") ||\n!av_strcasecmp(VAR_1, \"Title\")) {", "char VAR_9[32];", "int VAR_10;", "ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2);", "for (VAR_10 = 0; VAR_10 < strlen(VAR_1); VAR_10++)", "VAR_9[VAR_10] = av_tolower(VAR_1[VAR_10]);", "VAR_9[VAR_10] = 0;", "WARNING(\"'%s' option in configuration file is deprecated, \"\n\"use 'Metadata %s VALUE' instead\\n\", VAR_1, VAR_9);", "if (av_dict_set(&stream->metadata, VAR_9, VAR_5, 0) < 0)\ngoto nomem;", "} else if (!av_strcasecmp(VAR_1, \"Metadata\")) {", "ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2);", "ffserver_get_arg(VAR_6, sizeof(VAR_6), VAR_2);", "if (av_dict_set(&stream->metadata, VAR_5, VAR_6, 0) < 0)\ngoto nomem;", "} else if (!av_strcasecmp(VAR_1, \"Preroll\")) {", "ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2);", "stream->prebuffer = atof(VAR_5) * 1000;", "} else if (!av_strcasecmp(VAR_1, \"StartSendOnKey\")) {", "stream->send_on_key = 1;", "} else if (!av_strcasecmp(VAR_1, \"AudioCodec\")) {", "ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2);", "ffserver_set_codec(VAR_0->dummy_actx, VAR_5, VAR_0, VAR_3);", "} else if (!av_strcasecmp(VAR_1, \"VideoCodec\")) {", "ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2);", "ffserver_set_codec(VAR_0->dummy_vctx, VAR_5, VAR_0, VAR_3);", "} else if (!av_strcasecmp(VAR_1, \"MaxTime\")) {", "ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2);", "stream->max_time = atof(VAR_5) * 1000;", "} else if (!av_strcasecmp(VAR_1, \"AudioBitRate\")) {", "float VAR_11;", "ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2);", "ffserver_set_float_param(&VAR_11, VAR_5, 1000, 0, FLT_MAX, VAR_0, VAR_3,\n\"Invalid %s: %s\\n\", VAR_1, VAR_5);", "if (av_dict_set_int(&VAR_0->audio_conf, VAR_1, lrintf(VAR_11), 0) < 0)\ngoto nomem;", "} else if (!av_strcasecmp(VAR_1, \"AudioChannels\")) {", "ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2);", "ffserver_set_int_param(NULL, VAR_5, 0, 1, 8, VAR_0, VAR_3,\n\"Invalid %s: %s, valid range is 1-8.\", VAR_1, VAR_5);", "if (av_dict_set(&VAR_0->audio_conf, VAR_1, VAR_5, 0) < 0)\ngoto nomem;", "} else if (!av_strcasecmp(VAR_1, \"AudioSampleRate\")) {", "ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2);", "ffserver_set_int_param(NULL, VAR_5, 0, 0, INT_MAX, VAR_0, VAR_3,\n\"Invalid %s: %s\", VAR_1, VAR_5);", "if (av_dict_set(&VAR_0->audio_conf, VAR_1, VAR_5, 0) < 0)\ngoto nomem;", "} else if (!av_strcasecmp(VAR_1, \"VideoBitRateRange\")) {", "int VAR_12, VAR_13;", "ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2);", "if (sscanf(VAR_5, \"%d-%d\", &VAR_12, &VAR_13) == 2) {", "if (av_dict_set_int(&VAR_0->video_conf, \"VideoBitRateRangeMin\", VAR_12, 0) < 0 ||\nav_dict_set_int(&VAR_0->video_conf, \"VideoBitRateRangeMax\", VAR_13, 0) < 0)\ngoto nomem;", "} else", "ERROR(\"Incorrect format for VideoBitRateRange -- should be \"\n\"<min>-<max>: %s\\n\", VAR_5);", "} else if (!av_strcasecmp(VAR_1, \"Debug\")) {", "ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2);", "ffserver_set_int_param(NULL, VAR_5, 0, INT_MIN, INT_MAX, VAR_0, VAR_3,\n\"Invalid %s: %s\", VAR_1, VAR_5);", "if (av_dict_set(&VAR_0->video_conf, VAR_1, VAR_5, 0) < 0)\ngoto nomem;", "} else if (!av_strcasecmp(VAR_1, \"Strict\")) {", "ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2);", "ffserver_set_int_param(NULL, VAR_5, 0, INT_MIN, INT_MAX, VAR_0, VAR_3,\n\"Invalid %s: %s\", VAR_1, VAR_5);", "if (av_dict_set(&VAR_0->video_conf, VAR_1, VAR_5, 0) < 0)\ngoto nomem;", "} else if (!av_strcasecmp(VAR_1, \"VideoBufferSize\")) {", "ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2);", "ffserver_set_int_param(NULL, VAR_5, 8*1024, 0, INT_MAX, VAR_0, VAR_3,\n\"Invalid %s: %s\", VAR_1, VAR_5);", "if (av_dict_set(&VAR_0->video_conf, VAR_1, VAR_5, 0) < 0)\ngoto nomem;", "} else if (!av_strcasecmp(VAR_1, \"VideoBitRateTolerance\")) {", "ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2);", "ffserver_set_int_param(NULL, VAR_5, 1000, INT_MIN, INT_MAX, VAR_0,\nVAR_3, \"Invalid %s: %s\", VAR_1, VAR_5);", "if (av_dict_set(&VAR_0->video_conf, VAR_1, VAR_5, 0) < 0)\ngoto nomem;", "} else if (!av_strcasecmp(VAR_1, \"VideoBitRate\")) {", "ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2);", "ffserver_set_int_param(NULL, VAR_5, 1000, 0, INT_MAX, VAR_0, VAR_3,\n\"Invalid %s: %s\", VAR_1, VAR_5);", "if (av_dict_set(&VAR_0->video_conf, VAR_1, VAR_5, 0) < 0)\ngoto nomem;", "} else if (!av_strcasecmp(VAR_1, \"VideoSize\")) {", "int VAR_18, VAR_15, VAR_16;", "ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2);", "VAR_18 = av_parse_video_size(&VAR_15, &VAR_16, VAR_5);", "if (VAR_18 < 0)\nERROR(\"Invalid video size '%s'\\n\", VAR_5);", "else if ((VAR_15 % 2) || (VAR_16 % 2))\nWARNING(\"Image size is not a multiple of 2\\n\");", "if (av_dict_set_int(&VAR_0->video_conf, \"VideoSizeWidth\", VAR_15, 0) < 0 ||\nav_dict_set_int(&VAR_0->video_conf, \"VideoSizeHeight\", VAR_16, 0) < 0)\ngoto nomem;", "} else if (!av_strcasecmp(VAR_1, \"VideoFrameRate\")) {", "AVRational frame_rate;", "ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2);", "if (av_parse_video_rate(&frame_rate, VAR_5) < 0) {", "ERROR(\"Incorrect frame rate: %s\\n\", VAR_5);", "} else {", "if (av_dict_set_int(&VAR_0->video_conf, \"VideoFrameRateNum\", frame_rate.num, 0) < 0 ||\nav_dict_set_int(&VAR_0->video_conf, \"VideoFrameRateDen\", frame_rate.den, 0) < 0)\ngoto nomem;", "}", "} else if (!av_strcasecmp(VAR_1, \"PixelFormat\")) {", "enum AVPixelFormat VAR_17;", "ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2);", "VAR_17 = av_get_pix_fmt(VAR_5);", "if (VAR_17 == AV_PIX_FMT_NONE)\nERROR(\"Unknown pixel format: %s\\n\", VAR_5);", "if (av_dict_set_int(&VAR_0->video_conf, VAR_1, VAR_17, 0) < 0)\ngoto nomem;", "} else if (!av_strcasecmp(VAR_1, \"VideoGopSize\")) {", "ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2);", "ffserver_set_int_param(NULL, VAR_5, 0, INT_MIN, INT_MAX, VAR_0, VAR_3,\n\"Invalid %s: %s\", VAR_1, VAR_5);", "if (av_dict_set(&VAR_0->video_conf, VAR_1, VAR_5, 0) < 0)\ngoto nomem;", "} else if (!av_strcasecmp(VAR_1, \"VideoIntraOnly\")) {", "if (av_dict_set(&VAR_0->video_conf, VAR_1, \"1\", 0) < 0)\ngoto nomem;", "} else if (!av_strcasecmp(VAR_1, \"VideoHighQuality\")) {", "if (av_dict_set(&VAR_0->video_conf, VAR_1, \"\", 0) < 0)\ngoto nomem;", "} else if (!av_strcasecmp(VAR_1, \"Video4MotionVector\")) {", "if (av_dict_set(&VAR_0->video_conf, VAR_1, \"\", 0) < 0)\ngoto nomem;", "} else if (!av_strcasecmp(VAR_1, \"AVOptionVideo\") ||", "!av_strcasecmp(VAR_1, \"AVOptionAudio\")) {", "int VAR_18;", "ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2);", "ffserver_get_arg(VAR_6, sizeof(VAR_6), VAR_2);", "if (!av_strcasecmp(VAR_1, \"AVOptionVideo\"))\nVAR_18 = ffserver_save_avoption(VAR_0->dummy_vctx, VAR_5, VAR_6, &VAR_0->video_opts,\nAV_OPT_FLAG_VIDEO_PARAM ,VAR_0, VAR_3);", "else\nVAR_18 = ffserver_save_avoption(VAR_0->dummy_actx, VAR_5, VAR_6, &VAR_0->audio_opts,\nAV_OPT_FLAG_AUDIO_PARAM ,VAR_0, VAR_3);", "if (VAR_18 < 0)\ngoto nomem;", "} else if (!av_strcasecmp(VAR_1, \"AVPresetVideo\") ||", "!av_strcasecmp(VAR_1, \"AVPresetAudio\")) {", "ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2);", "if (!av_strcasecmp(VAR_1, \"AVPresetVideo\"))\nffserver_opt_preset(VAR_5, VAR_0->dummy_vctx, VAR_0, VAR_3);", "else\nffserver_opt_preset(VAR_5, VAR_0->dummy_actx, VAR_0, VAR_3);", "} else if (!av_strcasecmp(VAR_1, \"VideoTag\")) {", "ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2);", "if (strlen(VAR_5) == 4) {", "if (av_dict_set(&VAR_0->video_conf, \"VideoTag\", \"VAR_5\", 0) < 0)\ngoto nomem;", "}", "} else if (!av_strcasecmp(VAR_1, \"BitExact\")) {", "if (av_dict_set(&VAR_0->video_conf, VAR_1, \"\", 0) < 0)\ngoto nomem;", "} else if (!av_strcasecmp(VAR_1, \"DctFastint\")) {", "if (av_dict_set(&VAR_0->video_conf, VAR_1, \"\", 0) < 0)\ngoto nomem;", "} else if (!av_strcasecmp(VAR_1, \"IdctSimple\")) {", "if (av_dict_set(&VAR_0->video_conf, VAR_1, \"\", 0) < 0)\ngoto nomem;", "} else if (!av_strcasecmp(VAR_1, \"Qscale\")) {", "ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2);", "if (av_dict_set(&VAR_0->video_conf, VAR_1, VAR_5, 0) < 0)\ngoto nomem;", "} else if (!av_strcasecmp(VAR_1, \"VideoQDiff\")) {", "ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2);", "ffserver_set_int_param(NULL, VAR_5, 0, 1, 31, VAR_0, VAR_3,\n\"%s out of range\\n\", VAR_1);", "if (av_dict_set(&VAR_0->video_conf, VAR_1, VAR_5, 0) < 0)\ngoto nomem;", "} else if (!av_strcasecmp(VAR_1, \"VideoQMax\")) {", "ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2);", "ffserver_set_int_param(NULL, VAR_5, 0, 1, 31, VAR_0, VAR_3,\n\"%s out of range\\n\", VAR_1);", "if (av_dict_set(&VAR_0->video_conf, VAR_1, VAR_5, 0) < 0)\ngoto nomem;", "} else if (!av_strcasecmp(VAR_1, \"VideoQMin\")) {", "ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2);", "ffserver_set_int_param(NULL, VAR_5, 0, 1, 31, VAR_0, VAR_3,\n\"%s out of range\\n\", VAR_1);", "if (av_dict_set(&VAR_0->video_conf, VAR_1, VAR_5, 0) < 0)\ngoto nomem;", "} else if (!av_strcasecmp(VAR_1, \"LumiMask\")) {", "ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2);", "ffserver_set_float_param(NULL, VAR_5, 0, -FLT_MAX, FLT_MAX, VAR_0,\nVAR_3, \"Invalid %s: %s\", VAR_1, VAR_5);", "if (av_dict_set(&VAR_0->video_conf, VAR_1, VAR_5, 0) < 0)\ngoto nomem;", "} else if (!av_strcasecmp(VAR_1, \"DarkMask\")) {", "ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2);", "ffserver_set_float_param(NULL, VAR_5, 0, -FLT_MAX, FLT_MAX, VAR_0,\nVAR_3, \"Invalid %s: %s\", VAR_1, VAR_5);", "if (av_dict_set(&VAR_0->video_conf, VAR_1, VAR_5, 0) < 0)\ngoto nomem;", "} else if (!av_strcasecmp(VAR_1, \"NoVideo\")) {", "VAR_0->no_video = 1;", "} else if (!av_strcasecmp(VAR_1, \"NoAudio\")) {", "VAR_0->no_audio = 1;", "} else if (!av_strcasecmp(VAR_1, \"ACL\")) {", "ffserver_parse_acl_row(stream, NULL, NULL, *VAR_2, VAR_0->filename,\nVAR_3);", "} else if (!av_strcasecmp(VAR_1, \"DynamicACL\")) {", "ffserver_get_arg(stream->dynamic_acl, sizeof(stream->dynamic_acl), VAR_2);", "} else if (!av_strcasecmp(VAR_1, \"RTSPOption\")) {", "ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2);", "av_freep(&stream->rtsp_option);", "stream->rtsp_option = av_strdup(VAR_5);", "} else if (!av_strcasecmp(VAR_1, \"MulticastAddress\")) {", "ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2);", "if (resolve_host(&stream->multicast_ip, VAR_5))\nERROR(\"Invalid host/IP address: %s\\n\", VAR_5);", "stream->is_multicast = 1;", "stream->loop = 1;", "} else if (!av_strcasecmp(VAR_1, \"MulticastPort\")) {", "ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2);", "ffserver_set_int_param(&VAR_7, VAR_5, 0, 1, 65535, VAR_0, VAR_3,\n\"Invalid MulticastPort: %s\\n\", VAR_5);", "stream->multicast_port = VAR_7;", "} else if (!av_strcasecmp(VAR_1, \"MulticastTTL\")) {", "ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2);", "ffserver_set_int_param(&VAR_7, VAR_5, 0, INT_MIN, INT_MAX, VAR_0,\nVAR_3, \"Invalid MulticastTTL: %s\\n\", VAR_5);", "stream->multicast_ttl = VAR_7;", "} else if (!av_strcasecmp(VAR_1, \"NoLoop\")) {", "stream->loop = 0;", "} else if (!av_strcasecmp(VAR_1, \"</Stream>\")) {", "if (stream->feed && stream->fmt && strcmp(stream->fmt->name, \"ffm\")) {", "if (VAR_0->dummy_actx->codec_id == AV_CODEC_ID_NONE)\nVAR_0->dummy_actx->codec_id = VAR_0->guessed_audio_codec_id;", "if (!VAR_0->no_audio && VAR_0->dummy_actx->codec_id != AV_CODEC_ID_NONE) {", "AVCodecContext *audio_enc = avcodec_alloc_context3(avcodec_find_encoder(VAR_0->dummy_actx->codec_id));", "ffserver_apply_stream_config(audio_enc, VAR_0->audio_conf, &VAR_0->audio_opts);", "add_codec(stream, audio_enc);", "}", "if (VAR_0->dummy_vctx->codec_id == AV_CODEC_ID_NONE)\nVAR_0->dummy_vctx->codec_id = VAR_0->guessed_video_codec_id;", "if (!VAR_0->no_video && VAR_0->dummy_vctx->codec_id != AV_CODEC_ID_NONE) {", "AVCodecContext *video_enc = avcodec_alloc_context3(avcodec_find_encoder(VAR_0->dummy_vctx->codec_id));", "ffserver_apply_stream_config(video_enc, VAR_0->video_conf, &VAR_0->video_opts);", "add_codec(stream, video_enc);", "}", "}", "av_dict_free(&VAR_0->video_opts);", "av_dict_free(&VAR_0->video_conf);", "av_dict_free(&VAR_0->audio_opts);", "av_dict_free(&VAR_0->audio_conf);", "avcodec_free_context(&VAR_0->dummy_vctx);", "avcodec_free_context(&VAR_0->dummy_actx);", "*VAR_4 = NULL;", "} else if (!av_strcasecmp(VAR_1, \"File\") || !av_strcasecmp(VAR_1, \"ReadOnlyFile\")) {", "ffserver_get_arg(stream->feed_filename, sizeof(stream->feed_filename),\nVAR_2);", "} else {", "ERROR(\"Invalid entry '%s' inside <Stream></Stream>\\n\", VAR_1);", "}", "return 0;", "nomem:\nav_log(NULL, AV_LOG_ERROR, \"Out of memory. Aborting.\\n\");", "av_dict_free(&VAR_0->video_opts);", "av_dict_free(&VAR_0->video_conf);", "av_dict_free(&VAR_0->audio_opts);", "av_dict_free(&VAR_0->audio_conf);", "avcodec_free_context(&VAR_0->dummy_vctx);", "avcodec_free_context(&VAR_0->dummy_actx);", "return AVERROR(ENOMEM);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 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 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29, 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57, 59 ], [ 63 ], [ 65, 67 ], [ 69 ], [ 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 ], [ 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, 381 ], [ 383, 385, 387 ], [ 389 ], [ 391 ], [ 393 ], [ 395 ], [ 397 ], [ 399 ], [ 401, 403, 405 ], [ 407 ], [ 409 ], [ 411 ], [ 413 ], [ 415 ], [ 417, 419 ], [ 421, 423 ], [ 425 ], [ 427 ], [ 429, 431 ], [ 433, 435 ], [ 437 ], [ 439, 441 ], [ 443 ], [ 445, 447 ], [ 449 ], [ 451, 453 ], [ 455 ], [ 457 ], [ 459 ], [ 461 ], [ 463 ], [ 465, 467, 469 ], [ 471, 473, 475 ], [ 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 ], [ 565, 567 ], [ 569 ], [ 571 ], [ 573, 575 ], [ 577, 579 ], [ 581 ], [ 583 ], [ 585, 587 ], [ 589, 591 ], [ 593 ], [ 595 ], [ 597 ], [ 599 ], [ 601 ], [ 603, 605 ], [ 607 ], [ 609 ], [ 611 ], [ 613 ], [ 615 ], [ 617 ], [ 619 ], [ 621 ], [ 623, 625 ], [ 627 ], [ 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 ], [ 687 ], [ 689 ], [ 691 ], [ 693 ], [ 695 ], [ 697 ], [ 699 ], [ 701 ], [ 703 ], [ 705, 707 ], [ 709 ], [ 711 ], [ 713 ], [ 715 ], [ 717, 719 ], [ 721 ], [ 723 ], [ 725 ], [ 727 ], [ 729 ], [ 731 ], [ 733 ], [ 735 ] ]
18,433
static inline abi_long host_to_target_sockaddr(abi_ulong target_addr, struct sockaddr *addr, socklen_t len) { struct target_sockaddr *target_saddr; if (len == 0) { return 0; } target_saddr = lock_user(VERIFY_WRITE, target_addr, len, 0); if (!target_saddr) return -TARGET_EFAULT; memcpy(target_saddr, addr, len); if (len >= offsetof(struct target_sockaddr, sa_family) + sizeof(target_saddr->sa_family)) { target_saddr->sa_family = tswap16(addr->sa_family); } if (addr->sa_family == AF_NETLINK && len >= sizeof(struct sockaddr_nl)) { struct sockaddr_nl *target_nl = (struct sockaddr_nl *)target_saddr; target_nl->nl_pid = tswap32(target_nl->nl_pid); target_nl->nl_groups = tswap32(target_nl->nl_groups); } else if (addr->sa_family == AF_PACKET) { struct sockaddr_ll *target_ll = (struct sockaddr_ll *)target_saddr; target_ll->sll_ifindex = tswap32(target_ll->sll_ifindex); target_ll->sll_hatype = tswap16(target_ll->sll_hatype); } else if (addr->sa_family == AF_INET6 && len >= sizeof(struct target_sockaddr_in6)) { struct target_sockaddr_in6 *target_in6 = (struct target_sockaddr_in6 *)target_saddr; target_in6->sin6_scope_id = tswap16(target_in6->sin6_scope_id); } unlock_user(target_saddr, target_addr, len); return 0; }
true
qemu
6860710cc3864382a898c847d722f950b5e01a6e
static inline abi_long host_to_target_sockaddr(abi_ulong target_addr, struct sockaddr *addr, socklen_t len) { struct target_sockaddr *target_saddr; if (len == 0) { return 0; } target_saddr = lock_user(VERIFY_WRITE, target_addr, len, 0); if (!target_saddr) return -TARGET_EFAULT; memcpy(target_saddr, addr, len); if (len >= offsetof(struct target_sockaddr, sa_family) + sizeof(target_saddr->sa_family)) { target_saddr->sa_family = tswap16(addr->sa_family); } if (addr->sa_family == AF_NETLINK && len >= sizeof(struct sockaddr_nl)) { struct sockaddr_nl *target_nl = (struct sockaddr_nl *)target_saddr; target_nl->nl_pid = tswap32(target_nl->nl_pid); target_nl->nl_groups = tswap32(target_nl->nl_groups); } else if (addr->sa_family == AF_PACKET) { struct sockaddr_ll *target_ll = (struct sockaddr_ll *)target_saddr; target_ll->sll_ifindex = tswap32(target_ll->sll_ifindex); target_ll->sll_hatype = tswap16(target_ll->sll_hatype); } else if (addr->sa_family == AF_INET6 && len >= sizeof(struct target_sockaddr_in6)) { struct target_sockaddr_in6 *target_in6 = (struct target_sockaddr_in6 *)target_saddr; target_in6->sin6_scope_id = tswap16(target_in6->sin6_scope_id); } unlock_user(target_saddr, target_addr, len); return 0; }
{ "code": [], "line_no": [] }
static inline abi_long FUNC_0(abi_ulong target_addr, struct sockaddr *addr, socklen_t len) { struct target_sockaddr *VAR_0; if (len == 0) { return 0; } VAR_0 = lock_user(VERIFY_WRITE, target_addr, len, 0); if (!VAR_0) return -TARGET_EFAULT; memcpy(VAR_0, addr, len); if (len >= offsetof(struct target_sockaddr, sa_family) + sizeof(VAR_0->sa_family)) { VAR_0->sa_family = tswap16(addr->sa_family); } if (addr->sa_family == AF_NETLINK && len >= sizeof(struct sockaddr_nl)) { struct sockaddr_nl *VAR_1 = (struct sockaddr_nl *)VAR_0; VAR_1->nl_pid = tswap32(VAR_1->nl_pid); VAR_1->nl_groups = tswap32(VAR_1->nl_groups); } else if (addr->sa_family == AF_PACKET) { struct sockaddr_ll *VAR_2 = (struct sockaddr_ll *)VAR_0; VAR_2->sll_ifindex = tswap32(VAR_2->sll_ifindex); VAR_2->sll_hatype = tswap16(VAR_2->sll_hatype); } else if (addr->sa_family == AF_INET6 && len >= sizeof(struct target_sockaddr_in6)) { struct target_sockaddr_in6 *VAR_3 = (struct target_sockaddr_in6 *)VAR_0; VAR_3->sin6_scope_id = tswap16(VAR_3->sin6_scope_id); } unlock_user(VAR_0, target_addr, len); return 0; }
[ "static inline abi_long FUNC_0(abi_ulong target_addr,\nstruct sockaddr *addr,\nsocklen_t len)\n{", "struct target_sockaddr *VAR_0;", "if (len == 0) {", "return 0;", "}", "VAR_0 = lock_user(VERIFY_WRITE, target_addr, len, 0);", "if (!VAR_0)\nreturn -TARGET_EFAULT;", "memcpy(VAR_0, addr, len);", "if (len >= offsetof(struct target_sockaddr, sa_family) +\nsizeof(VAR_0->sa_family)) {", "VAR_0->sa_family = tswap16(addr->sa_family);", "}", "if (addr->sa_family == AF_NETLINK && len >= sizeof(struct sockaddr_nl)) {", "struct sockaddr_nl *VAR_1 = (struct sockaddr_nl *)VAR_0;", "VAR_1->nl_pid = tswap32(VAR_1->nl_pid);", "VAR_1->nl_groups = tswap32(VAR_1->nl_groups);", "} else if (addr->sa_family == AF_PACKET) {", "struct sockaddr_ll *VAR_2 = (struct sockaddr_ll *)VAR_0;", "VAR_2->sll_ifindex = tswap32(VAR_2->sll_ifindex);", "VAR_2->sll_hatype = tswap16(VAR_2->sll_hatype);", "} else if (addr->sa_family == AF_INET6 &&", "len >= sizeof(struct target_sockaddr_in6)) {", "struct target_sockaddr_in6 *VAR_3 =\n(struct target_sockaddr_in6 *)VAR_0;", "VAR_3->sin6_scope_id = tswap16(VAR_3->sin6_scope_id);", "}", "unlock_user(VAR_0, target_addr, len);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 22 ], [ 24, 26 ], [ 28 ], [ 30, 32 ], [ 34 ], [ 36 ], [ 38 ], [ 40 ], [ 42 ], [ 44 ], [ 46 ], [ 48 ], [ 50 ], [ 52 ], [ 54 ], [ 56 ], [ 58, 60 ], [ 62 ], [ 64 ], [ 66 ], [ 70 ], [ 72 ] ]
18,434
void kvm_set_phys_mem(target_phys_addr_t start_addr, ram_addr_t size, ram_addr_t phys_offset) { KVMState *s = kvm_state; ram_addr_t flags = phys_offset & ~TARGET_PAGE_MASK; KVMSlot *mem; if (start_addr & ~TARGET_PAGE_MASK) { fprintf(stderr, "Only page-aligned memory slots supported\n"); abort(); } /* KVM does not support read-only slots */ phys_offset &= ~IO_MEM_ROM; mem = kvm_lookup_slot(s, start_addr); if (mem) { if (flags >= IO_MEM_UNASSIGNED) { mem->memory_size = 0; mem->start_addr = start_addr; mem->phys_offset = 0; mem->flags = 0; kvm_set_user_memory_region(s, mem); } else if (start_addr >= mem->start_addr && (start_addr + size) <= (mem->start_addr + mem->memory_size)) { KVMSlot slot; target_phys_addr_t mem_start; ram_addr_t mem_size, mem_offset; /* Not splitting */ if ((phys_offset - (start_addr - mem->start_addr)) == mem->phys_offset) return; /* unregister whole slot */ memcpy(&slot, mem, sizeof(slot)); mem->memory_size = 0; kvm_set_user_memory_region(s, mem); /* register prefix slot */ mem_start = slot.start_addr; mem_size = start_addr - slot.start_addr; mem_offset = slot.phys_offset; if (mem_size) kvm_set_phys_mem(mem_start, mem_size, mem_offset); /* register new slot */ kvm_set_phys_mem(start_addr, size, phys_offset); /* register suffix slot */ mem_start = start_addr + size; mem_offset += mem_size + size; mem_size = slot.memory_size - mem_size - size; if (mem_size) kvm_set_phys_mem(mem_start, mem_size, mem_offset); return; } else { printf("Registering overlapping slot\n"); abort(); } } /* KVM does not need to know about this memory */ if (flags >= IO_MEM_UNASSIGNED) return; mem = kvm_alloc_slot(s); mem->memory_size = size; mem->start_addr = start_addr; mem->phys_offset = phys_offset; mem->flags = 0; kvm_set_user_memory_region(s, mem); /* FIXME deal with errors */ }
true
qemu
6152e2ae4344ec8c849393da3f76f2263cc55766
void kvm_set_phys_mem(target_phys_addr_t start_addr, ram_addr_t size, ram_addr_t phys_offset) { KVMState *s = kvm_state; ram_addr_t flags = phys_offset & ~TARGET_PAGE_MASK; KVMSlot *mem; if (start_addr & ~TARGET_PAGE_MASK) { fprintf(stderr, "Only page-aligned memory slots supported\n"); abort(); } phys_offset &= ~IO_MEM_ROM; mem = kvm_lookup_slot(s, start_addr); if (mem) { if (flags >= IO_MEM_UNASSIGNED) { mem->memory_size = 0; mem->start_addr = start_addr; mem->phys_offset = 0; mem->flags = 0; kvm_set_user_memory_region(s, mem); } else if (start_addr >= mem->start_addr && (start_addr + size) <= (mem->start_addr + mem->memory_size)) { KVMSlot slot; target_phys_addr_t mem_start; ram_addr_t mem_size, mem_offset; if ((phys_offset - (start_addr - mem->start_addr)) == mem->phys_offset) return; memcpy(&slot, mem, sizeof(slot)); mem->memory_size = 0; kvm_set_user_memory_region(s, mem); mem_start = slot.start_addr; mem_size = start_addr - slot.start_addr; mem_offset = slot.phys_offset; if (mem_size) kvm_set_phys_mem(mem_start, mem_size, mem_offset); kvm_set_phys_mem(start_addr, size, phys_offset); mem_start = start_addr + size; mem_offset += mem_size + size; mem_size = slot.memory_size - mem_size - size; if (mem_size) kvm_set_phys_mem(mem_start, mem_size, mem_offset); return; } else { printf("Registering overlapping slot\n"); abort(); } } if (flags >= IO_MEM_UNASSIGNED) return; mem = kvm_alloc_slot(s); mem->memory_size = size; mem->start_addr = start_addr; mem->phys_offset = phys_offset; mem->flags = 0; kvm_set_user_memory_region(s, mem); }
{ "code": [ " KVMSlot *mem;", " mem = kvm_lookup_slot(s, start_addr);", " if (mem) {", " if (flags >= IO_MEM_UNASSIGNED) {", " mem->memory_size = 0;", " mem->start_addr = start_addr;", " mem->phys_offset = 0;", " mem->flags = 0;", " kvm_set_user_memory_region(s, mem);", " } else if (start_addr >= mem->start_addr &&", " (start_addr + size) <= (mem->start_addr +", " mem->memory_size)) {", " KVMSlot slot;", " target_phys_addr_t mem_start;", " ram_addr_t mem_size, mem_offset;", " if ((phys_offset - (start_addr - mem->start_addr)) == ", " mem->phys_offset)", " memcpy(&slot, mem, sizeof(slot));", " mem->memory_size = 0;", " kvm_set_user_memory_region(s, mem);", " mem_start = slot.start_addr;", " mem_size = start_addr - slot.start_addr;", " mem_offset = slot.phys_offset;", " if (mem_size)", " kvm_set_phys_mem(mem_start, mem_size, mem_offset);", " kvm_set_phys_mem(start_addr, size, phys_offset);", " mem_start = start_addr + size;", " mem_offset += mem_size + size;", " mem_size = slot.memory_size - mem_size - size;", " if (mem_size)", " kvm_set_phys_mem(mem_start, mem_size, mem_offset);", " } else {", " printf(\"Registering overlapping slot\\n\");", " kvm_set_user_memory_region(s, mem);" ], "line_no": [ 13, 33, 35, 37, 39, 41, 43, 45, 49, 51, 53, 55, 57, 59, 61, 67, 69, 77, 39, 49, 87, 89, 91, 93, 95, 101, 107, 109, 111, 93, 95, 121, 123, 151 ] }
void FUNC_0(target_phys_addr_t VAR_0, ram_addr_t VAR_1, ram_addr_t VAR_2) { KVMState *s = kvm_state; ram_addr_t flags = VAR_2 & ~TARGET_PAGE_MASK; KVMSlot *mem; if (VAR_0 & ~TARGET_PAGE_MASK) { fprintf(stderr, "Only page-aligned memory slots supported\n"); abort(); } VAR_2 &= ~IO_MEM_ROM; mem = kvm_lookup_slot(s, VAR_0); if (mem) { if (flags >= IO_MEM_UNASSIGNED) { mem->memory_size = 0; mem->VAR_0 = VAR_0; mem->VAR_2 = 0; mem->flags = 0; kvm_set_user_memory_region(s, mem); } else if (VAR_0 >= mem->VAR_0 && (VAR_0 + VAR_1) <= (mem->VAR_0 + mem->memory_size)) { KVMSlot slot; target_phys_addr_t mem_start; ram_addr_t mem_size, mem_offset; if ((VAR_2 - (VAR_0 - mem->VAR_0)) == mem->VAR_2) return; memcpy(&slot, mem, sizeof(slot)); mem->memory_size = 0; kvm_set_user_memory_region(s, mem); mem_start = slot.VAR_0; mem_size = VAR_0 - slot.VAR_0; mem_offset = slot.VAR_2; if (mem_size) FUNC_0(mem_start, mem_size, mem_offset); FUNC_0(VAR_0, VAR_1, VAR_2); mem_start = VAR_0 + VAR_1; mem_offset += mem_size + VAR_1; mem_size = slot.memory_size - mem_size - VAR_1; if (mem_size) FUNC_0(mem_start, mem_size, mem_offset); return; } else { printf("Registering overlapping slot\n"); abort(); } } if (flags >= IO_MEM_UNASSIGNED) return; mem = kvm_alloc_slot(s); mem->memory_size = VAR_1; mem->VAR_0 = VAR_0; mem->VAR_2 = VAR_2; mem->flags = 0; kvm_set_user_memory_region(s, mem); }
[ "void FUNC_0(target_phys_addr_t VAR_0,\nram_addr_t VAR_1,\nram_addr_t VAR_2)\n{", "KVMState *s = kvm_state;", "ram_addr_t flags = VAR_2 & ~TARGET_PAGE_MASK;", "KVMSlot *mem;", "if (VAR_0 & ~TARGET_PAGE_MASK) {", "fprintf(stderr, \"Only page-aligned memory slots supported\\n\");", "abort();", "}", "VAR_2 &= ~IO_MEM_ROM;", "mem = kvm_lookup_slot(s, VAR_0);", "if (mem) {", "if (flags >= IO_MEM_UNASSIGNED) {", "mem->memory_size = 0;", "mem->VAR_0 = VAR_0;", "mem->VAR_2 = 0;", "mem->flags = 0;", "kvm_set_user_memory_region(s, mem);", "} else if (VAR_0 >= mem->VAR_0 &&", "(VAR_0 + VAR_1) <= (mem->VAR_0 +\nmem->memory_size)) {", "KVMSlot slot;", "target_phys_addr_t mem_start;", "ram_addr_t mem_size, mem_offset;", "if ((VAR_2 - (VAR_0 - mem->VAR_0)) ==\nmem->VAR_2)\nreturn;", "memcpy(&slot, mem, sizeof(slot));", "mem->memory_size = 0;", "kvm_set_user_memory_region(s, mem);", "mem_start = slot.VAR_0;", "mem_size = VAR_0 - slot.VAR_0;", "mem_offset = slot.VAR_2;", "if (mem_size)\nFUNC_0(mem_start, mem_size, mem_offset);", "FUNC_0(VAR_0, VAR_1, VAR_2);", "mem_start = VAR_0 + VAR_1;", "mem_offset += mem_size + VAR_1;", "mem_size = slot.memory_size - mem_size - VAR_1;", "if (mem_size)\nFUNC_0(mem_start, mem_size, mem_offset);", "return;", "} else {", "printf(\"Registering overlapping slot\\n\");", "abort();", "}", "}", "if (flags >= IO_MEM_UNASSIGNED)\nreturn;", "mem = kvm_alloc_slot(s);", "mem->memory_size = VAR_1;", "mem->VAR_0 = VAR_0;", "mem->VAR_2 = VAR_2;", "mem->flags = 0;", "kvm_set_user_memory_region(s, mem);", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53, 55 ], [ 57 ], [ 59 ], [ 61 ], [ 67, 69, 71 ], [ 77 ], [ 79 ], [ 81 ], [ 87 ], [ 89 ], [ 91 ], [ 93, 95 ], [ 101 ], [ 107 ], [ 109 ], [ 111 ], [ 113, 115 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 133, 135 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 151 ], [ 155 ] ]
18,435
static void vfio_put_device(VFIOPCIDevice *vdev) { g_free(vdev->vbasedev.name); if (vdev->msix) { g_free(vdev->msix); vdev->msix = NULL; } vfio_put_base_device(&vdev->vbasedev); }
true
qemu
3a4dbe6aa934370a92372528c1255ee1504965ee
static void vfio_put_device(VFIOPCIDevice *vdev) { g_free(vdev->vbasedev.name); if (vdev->msix) { g_free(vdev->msix); vdev->msix = NULL; } vfio_put_base_device(&vdev->vbasedev); }
{ "code": [], "line_no": [] }
static void FUNC_0(VFIOPCIDevice *VAR_0) { g_free(VAR_0->vbasedev.name); if (VAR_0->msix) { g_free(VAR_0->msix); VAR_0->msix = NULL; } vfio_put_base_device(&VAR_0->vbasedev); }
[ "static void FUNC_0(VFIOPCIDevice *VAR_0)\n{", "g_free(VAR_0->vbasedev.name);", "if (VAR_0->msix) {", "g_free(VAR_0->msix);", "VAR_0->msix = NULL;", "}", "vfio_put_base_device(&VAR_0->vbasedev);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 10 ], [ 12 ], [ 14 ], [ 16 ], [ 18 ] ]
18,436
static void net_init_tap_one(const NetdevTapOptions *tap, NetClientState *peer, const char *model, const char *name, const char *ifname, const char *script, const char *downscript, const char *vhostfdname, int vnet_hdr, int fd, Error **errp) { Error *err = NULL; TAPState *s = net_tap_fd_init(peer, model, name, fd, vnet_hdr); int vhostfd; tap_set_sndbuf(s->fd, tap, &err); if (err) { error_propagate(errp, err); return; } if (tap->has_fd || tap->has_fds) { snprintf(s->nc.info_str, sizeof(s->nc.info_str), "fd=%d", fd); } else if (tap->has_helper) { snprintf(s->nc.info_str, sizeof(s->nc.info_str), "helper=%s", tap->helper); } else { snprintf(s->nc.info_str, sizeof(s->nc.info_str), "ifname=%s,script=%s,downscript=%s", ifname, script, downscript); if (strcmp(downscript, "no") != 0) { snprintf(s->down_script, sizeof(s->down_script), "%s", downscript); snprintf(s->down_script_arg, sizeof(s->down_script_arg), "%s", ifname); } } if (tap->has_vhost ? tap->vhost : vhostfdname || (tap->has_vhostforce && tap->vhostforce)) { VhostNetOptions options; options.backend_type = VHOST_BACKEND_TYPE_KERNEL; options.net_backend = &s->nc; options.force = tap->has_vhostforce && tap->vhostforce; if (tap->has_vhostfd || tap->has_vhostfds) { vhostfd = monitor_fd_param(cur_mon, vhostfdname, &err); if (vhostfd == -1) { error_propagate(errp, err); return; } } else { vhostfd = open("/dev/vhost-net", O_RDWR); if (vhostfd < 0) { error_setg_errno(errp, errno, "tap: open vhost char device failed"); return; } } options.opaque = (void *)(uintptr_t)vhostfd; s->vhost_net = vhost_net_init(&options); if (!s->vhost_net) { error_setg(errp, "vhost-net requested but could not be initialized"); return; } } else if (tap->has_vhostfd || tap->has_vhostfds) { error_setg(errp, "vhostfd= is not valid without vhost"); } }
true
qemu
1e7398a140f7a6bd9f5a438e7ad0f1ef50990e25
static void net_init_tap_one(const NetdevTapOptions *tap, NetClientState *peer, const char *model, const char *name, const char *ifname, const char *script, const char *downscript, const char *vhostfdname, int vnet_hdr, int fd, Error **errp) { Error *err = NULL; TAPState *s = net_tap_fd_init(peer, model, name, fd, vnet_hdr); int vhostfd; tap_set_sndbuf(s->fd, tap, &err); if (err) { error_propagate(errp, err); return; } if (tap->has_fd || tap->has_fds) { snprintf(s->nc.info_str, sizeof(s->nc.info_str), "fd=%d", fd); } else if (tap->has_helper) { snprintf(s->nc.info_str, sizeof(s->nc.info_str), "helper=%s", tap->helper); } else { snprintf(s->nc.info_str, sizeof(s->nc.info_str), "ifname=%s,script=%s,downscript=%s", ifname, script, downscript); if (strcmp(downscript, "no") != 0) { snprintf(s->down_script, sizeof(s->down_script), "%s", downscript); snprintf(s->down_script_arg, sizeof(s->down_script_arg), "%s", ifname); } } if (tap->has_vhost ? tap->vhost : vhostfdname || (tap->has_vhostforce && tap->vhostforce)) { VhostNetOptions options; options.backend_type = VHOST_BACKEND_TYPE_KERNEL; options.net_backend = &s->nc; options.force = tap->has_vhostforce && tap->vhostforce; if (tap->has_vhostfd || tap->has_vhostfds) { vhostfd = monitor_fd_param(cur_mon, vhostfdname, &err); if (vhostfd == -1) { error_propagate(errp, err); return; } } else { vhostfd = open("/dev/vhost-net", O_RDWR); if (vhostfd < 0) { error_setg_errno(errp, errno, "tap: open vhost char device failed"); return; } } options.opaque = (void *)(uintptr_t)vhostfd; s->vhost_net = vhost_net_init(&options); if (!s->vhost_net) { error_setg(errp, "vhost-net requested but could not be initialized"); return; } } else if (tap->has_vhostfd || tap->has_vhostfds) { error_setg(errp, "vhostfd= is not valid without vhost"); } }
{ "code": [ " options.force = tap->has_vhostforce && tap->vhostforce;" ], "line_no": [ 79 ] }
static void FUNC_0(const NetdevTapOptions *VAR_0, NetClientState *VAR_1, const char *VAR_2, const char *VAR_3, const char *VAR_4, const char *VAR_5, const char *VAR_6, const char *VAR_7, int VAR_8, int VAR_9, Error **VAR_10) { Error *err = NULL; TAPState *s = net_tap_fd_init(VAR_1, VAR_2, VAR_3, VAR_9, VAR_8); int VAR_11; tap_set_sndbuf(s->VAR_9, VAR_0, &err); if (err) { error_propagate(VAR_10, err); return; } if (VAR_0->has_fd || VAR_0->has_fds) { snprintf(s->nc.info_str, sizeof(s->nc.info_str), "VAR_9=%d", VAR_9); } else if (VAR_0->has_helper) { snprintf(s->nc.info_str, sizeof(s->nc.info_str), "helper=%s", VAR_0->helper); } else { snprintf(s->nc.info_str, sizeof(s->nc.info_str), "VAR_4=%s,VAR_5=%s,VAR_6=%s", VAR_4, VAR_5, VAR_6); if (strcmp(VAR_6, "no") != 0) { snprintf(s->down_script, sizeof(s->down_script), "%s", VAR_6); snprintf(s->down_script_arg, sizeof(s->down_script_arg), "%s", VAR_4); } } if (VAR_0->has_vhost ? VAR_0->vhost : VAR_7 || (VAR_0->has_vhostforce && VAR_0->vhostforce)) { VhostNetOptions options; options.backend_type = VHOST_BACKEND_TYPE_KERNEL; options.net_backend = &s->nc; options.force = VAR_0->has_vhostforce && VAR_0->vhostforce; if (VAR_0->has_vhostfd || VAR_0->has_vhostfds) { VAR_11 = monitor_fd_param(cur_mon, VAR_7, &err); if (VAR_11 == -1) { error_propagate(VAR_10, err); return; } } else { VAR_11 = open("/dev/vhost-net", O_RDWR); if (VAR_11 < 0) { error_setg_errno(VAR_10, errno, "VAR_0: open vhost char device failed"); return; } } options.opaque = (void *)(uintptr_t)VAR_11; s->vhost_net = vhost_net_init(&options); if (!s->vhost_net) { error_setg(VAR_10, "vhost-net requested but could not be initialized"); return; } } else if (VAR_0->has_vhostfd || VAR_0->has_vhostfds) { error_setg(VAR_10, "VAR_11= is not valid without vhost"); } }
[ "static void FUNC_0(const NetdevTapOptions *VAR_0, NetClientState *VAR_1,\nconst char *VAR_2, const char *VAR_3,\nconst char *VAR_4, const char *VAR_5,\nconst char *VAR_6, const char *VAR_7,\nint VAR_8, int VAR_9, Error **VAR_10)\n{", "Error *err = NULL;", "TAPState *s = net_tap_fd_init(VAR_1, VAR_2, VAR_3, VAR_9, VAR_8);", "int VAR_11;", "tap_set_sndbuf(s->VAR_9, VAR_0, &err);", "if (err) {", "error_propagate(VAR_10, err);", "return;", "}", "if (VAR_0->has_fd || VAR_0->has_fds) {", "snprintf(s->nc.info_str, sizeof(s->nc.info_str), \"VAR_9=%d\", VAR_9);", "} else if (VAR_0->has_helper) {", "snprintf(s->nc.info_str, sizeof(s->nc.info_str), \"helper=%s\",\nVAR_0->helper);", "} else {", "snprintf(s->nc.info_str, sizeof(s->nc.info_str),\n\"VAR_4=%s,VAR_5=%s,VAR_6=%s\", VAR_4, VAR_5,\nVAR_6);", "if (strcmp(VAR_6, \"no\") != 0) {", "snprintf(s->down_script, sizeof(s->down_script), \"%s\", VAR_6);", "snprintf(s->down_script_arg, sizeof(s->down_script_arg),\n\"%s\", VAR_4);", "}", "}", "if (VAR_0->has_vhost ? VAR_0->vhost :\nVAR_7 || (VAR_0->has_vhostforce && VAR_0->vhostforce)) {", "VhostNetOptions options;", "options.backend_type = VHOST_BACKEND_TYPE_KERNEL;", "options.net_backend = &s->nc;", "options.force = VAR_0->has_vhostforce && VAR_0->vhostforce;", "if (VAR_0->has_vhostfd || VAR_0->has_vhostfds) {", "VAR_11 = monitor_fd_param(cur_mon, VAR_7, &err);", "if (VAR_11 == -1) {", "error_propagate(VAR_10, err);", "return;", "}", "} else {", "VAR_11 = open(\"/dev/vhost-net\", O_RDWR);", "if (VAR_11 < 0) {", "error_setg_errno(VAR_10, errno,\n\"VAR_0: open vhost char device failed\");", "return;", "}", "}", "options.opaque = (void *)(uintptr_t)VAR_11;", "s->vhost_net = vhost_net_init(&options);", "if (!s->vhost_net) {", "error_setg(VAR_10,\n\"vhost-net requested but could not be initialized\");", "return;", "}", "} else if (VAR_0->has_vhostfd || VAR_0->has_vhostfds) {", "error_setg(VAR_10, \"VAR_11= is not valid without vhost\");", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45, 47, 49 ], [ 53 ], [ 55 ], [ 57, 59 ], [ 61 ], [ 63 ], [ 67, 69 ], [ 71 ], [ 75 ], [ 77 ], [ 79 ], [ 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 ] ]
18,440
void qemu_iovec_concat_iov(QEMUIOVector *dst, struct iovec *src_iov, unsigned int src_cnt, size_t soffset, size_t sbytes) { int i; size_t done; assert(dst->nalloc != -1); for (i = 0, done = 0; done < sbytes && i < src_cnt; i++) { if (soffset < src_iov[i].iov_len) { size_t len = MIN(src_iov[i].iov_len - soffset, sbytes - done); qemu_iovec_add(dst, src_iov[i].iov_base + soffset, len); done += len; soffset = 0; } else { soffset -= src_iov[i].iov_len; assert(soffset == 0); /* offset beyond end of src */
true
qemu
facf98ad987a38d97e12511f81375380b407a828
void qemu_iovec_concat_iov(QEMUIOVector *dst, struct iovec *src_iov, unsigned int src_cnt, size_t soffset, size_t sbytes) { int i; size_t done; assert(dst->nalloc != -1); for (i = 0, done = 0; done < sbytes && i < src_cnt; i++) { if (soffset < src_iov[i].iov_len) { size_t len = MIN(src_iov[i].iov_len - soffset, sbytes - done); qemu_iovec_add(dst, src_iov[i].iov_base + soffset, len); done += len; soffset = 0; } else { soffset -= src_iov[i].iov_len; assert(soffset == 0);
{ "code": [], "line_no": [] }
void FUNC_0(QEMUIOVector *VAR_0, struct iovec *VAR_1, unsigned int VAR_2, size_t VAR_3, size_t VAR_4) { int VAR_5; size_t done; assert(VAR_0->nalloc != -1); for (VAR_5 = 0, done = 0; done < VAR_4 && VAR_5 < VAR_2; VAR_5++) { if (VAR_3 < VAR_1[VAR_5].iov_len) { size_t len = MIN(VAR_1[VAR_5].iov_len - VAR_3, VAR_4 - done); qemu_iovec_add(VAR_0, VAR_1[VAR_5].iov_base + VAR_3, len); done += len; VAR_3 = 0; } else { VAR_3 -= VAR_1[VAR_5].iov_len; assert(VAR_3 == 0);
[ "void FUNC_0(QEMUIOVector *VAR_0,\nstruct iovec *VAR_1, unsigned int VAR_2,\nsize_t VAR_3, size_t VAR_4)\n{", "int VAR_5;", "size_t done;", "assert(VAR_0->nalloc != -1);", "for (VAR_5 = 0, done = 0; done < VAR_4 && VAR_5 < VAR_2; VAR_5++) {", "if (VAR_3 < VAR_1[VAR_5].iov_len) {", "size_t len = MIN(VAR_1[VAR_5].iov_len - VAR_3, VAR_4 - done);", "qemu_iovec_add(VAR_0, VAR_1[VAR_5].iov_base + VAR_3, len);", "done += len;", "VAR_3 = 0;", "} else {", "VAR_3 -= VAR_1[VAR_5].iov_len;", "assert(VAR_3 == 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,441
void hmp_dump_guest_memory(Monitor *mon, const QDict *qdict) { Error *errp = NULL; int paging = qdict_get_try_bool(qdict, "paging", 0); const char *file = qdict_get_str(qdict, "filename"); bool has_begin = qdict_haskey(qdict, "begin"); bool has_length = qdict_haskey(qdict, "length"); int64_t begin = 0; int64_t length = 0; char *prot; if (has_begin) { begin = qdict_get_int(qdict, "begin"); } if (has_length) { length = qdict_get_int(qdict, "length"); } prot = g_strconcat("file:", file, NULL); qmp_dump_guest_memory(paging, prot, has_begin, begin, has_length, length, &errp); hmp_handle_error(mon, &errp); g_free(prot); }
true
qemu
b53ccc30c40df52d192e469a86c188a8649c6df3
void hmp_dump_guest_memory(Monitor *mon, const QDict *qdict) { Error *errp = NULL; int paging = qdict_get_try_bool(qdict, "paging", 0); const char *file = qdict_get_str(qdict, "filename"); bool has_begin = qdict_haskey(qdict, "begin"); bool has_length = qdict_haskey(qdict, "length"); int64_t begin = 0; int64_t length = 0; char *prot; if (has_begin) { begin = qdict_get_int(qdict, "begin"); } if (has_length) { length = qdict_get_int(qdict, "length"); } prot = g_strconcat("file:", file, NULL); qmp_dump_guest_memory(paging, prot, has_begin, begin, has_length, length, &errp); hmp_handle_error(mon, &errp); g_free(prot); }
{ "code": [ " &errp);" ], "line_no": [ 43 ] }
void FUNC_0(Monitor *VAR_0, const QDict *VAR_1) { Error *errp = NULL; int VAR_2 = qdict_get_try_bool(VAR_1, "VAR_2", 0); const char *VAR_3 = qdict_get_str(VAR_1, "filename"); bool has_begin = qdict_haskey(VAR_1, "begin"); bool has_length = qdict_haskey(VAR_1, "length"); int64_t begin = 0; int64_t length = 0; char *VAR_4; if (has_begin) { begin = qdict_get_int(VAR_1, "begin"); } if (has_length) { length = qdict_get_int(VAR_1, "length"); } VAR_4 = g_strconcat("VAR_3:", VAR_3, NULL); qmp_dump_guest_memory(VAR_2, VAR_4, has_begin, begin, has_length, length, &errp); hmp_handle_error(VAR_0, &errp); g_free(VAR_4); }
[ "void FUNC_0(Monitor *VAR_0, const QDict *VAR_1)\n{", "Error *errp = NULL;", "int VAR_2 = qdict_get_try_bool(VAR_1, \"VAR_2\", 0);", "const char *VAR_3 = qdict_get_str(VAR_1, \"filename\");", "bool has_begin = qdict_haskey(VAR_1, \"begin\");", "bool has_length = qdict_haskey(VAR_1, \"length\");", "int64_t begin = 0;", "int64_t length = 0;", "char *VAR_4;", "if (has_begin) {", "begin = qdict_get_int(VAR_1, \"begin\");", "}", "if (has_length) {", "length = qdict_get_int(VAR_1, \"length\");", "}", "VAR_4 = g_strconcat(\"VAR_3:\", VAR_3, NULL);", "qmp_dump_guest_memory(VAR_2, VAR_4, has_begin, begin, has_length, length,\n&errp);", "hmp_handle_error(VAR_0, &errp);", "g_free(VAR_4);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 41, 43 ], [ 45 ], [ 47 ], [ 49 ] ]
18,442
static int encode_picture_ls(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data){ JpeglsContext * const s = avctx->priv_data; AVFrame *pict = data; AVFrame * const p= (AVFrame*)&s->picture; const int near = avctx->prediction_method; PutBitContext pb, pb2; GetBitContext gb; uint8_t *buf2, *zero, *cur, *last; JLSState *state; int i, size; int comps; buf2 = av_malloc(buf_size); init_put_bits(&pb, buf, buf_size); init_put_bits(&pb2, buf2, buf_size); *p = *pict; p->pict_type= FF_I_TYPE; p->key_frame= 1; if(avctx->pix_fmt == PIX_FMT_GRAY8 || avctx->pix_fmt == PIX_FMT_GRAY16) comps = 1; else comps = 3; /* write our own JPEG header, can't use mjpeg_picture_header */ put_marker(&pb, SOI); put_marker(&pb, SOF48); put_bits(&pb, 16, 8 + comps * 3); // header size depends on components put_bits(&pb, 8, (avctx->pix_fmt == PIX_FMT_GRAY16) ? 16 : 8); // bpp put_bits(&pb, 16, avctx->height); put_bits(&pb, 16, avctx->width); put_bits(&pb, 8, comps); // components for(i = 1; i <= comps; i++) { put_bits(&pb, 8, i); // component ID put_bits(&pb, 8, 0x11); // subsampling: none put_bits(&pb, 8, 0); // Tiq, used by JPEG-LS ext } put_marker(&pb, SOS); put_bits(&pb, 16, 6 + comps * 2); put_bits(&pb, 8, comps); for(i = 1; i <= comps; i++) { put_bits(&pb, 8, i); // component ID put_bits(&pb, 8, 0); // mapping index: none } put_bits(&pb, 8, near); put_bits(&pb, 8, (comps > 1) ? 1 : 0); // interleaving: 0 - plane, 1 - line put_bits(&pb, 8, 0); // point transform: none state = av_mallocz(sizeof(JLSState)); /* initialize JPEG-LS state from JPEG parameters */ state->near = near; state->bpp = (avctx->pix_fmt == PIX_FMT_GRAY16) ? 16 : 8; reset_ls_coding_parameters(state, 0); ls_init_state(state); ls_store_lse(state, &pb); zero = av_mallocz(p->linesize[0]); last = zero; cur = p->data[0]; if(avctx->pix_fmt == PIX_FMT_GRAY8){ int t = 0; for(i = 0; i < avctx->height; i++) { ls_encode_line(state, &pb2, last, cur, t, avctx->width, 1, 0, 8); t = last[0]; last = cur; cur += p->linesize[0]; } }else if(avctx->pix_fmt == PIX_FMT_GRAY16){ int t = 0; for(i = 0; i < avctx->height; i++) { ls_encode_line(state, &pb2, last, cur, t, avctx->width, 1, 0, 16); t = *((uint16_t*)last); last = cur; cur += p->linesize[0]; } }else if(avctx->pix_fmt == PIX_FMT_RGB24){ int j, width; int Rc[3] = {0, 0, 0}; width = avctx->width * 3; for(i = 0; i < avctx->height; i++) { for(j = 0; j < 3; j++) { ls_encode_line(state, &pb2, last + j, cur + j, Rc[j], width, 3, j, 8); Rc[j] = last[j]; } last = cur; cur += s->picture.linesize[0]; } }else if(avctx->pix_fmt == PIX_FMT_BGR24){ int j, width; int Rc[3] = {0, 0, 0}; width = avctx->width * 3; for(i = 0; i < avctx->height; i++) { for(j = 2; j >= 0; j--) { ls_encode_line(state, &pb2, last + j, cur + j, Rc[j], width, 3, j, 8); Rc[j] = last[j]; } last = cur; cur += s->picture.linesize[0]; } } av_free(zero); av_free(state); flush_put_bits(&pb2); /* do escape coding */ size = put_bits_count(&pb2) >> 3; init_get_bits(&gb, buf2, size); while(get_bits_count(&gb) < size * 8){ int v; v = get_bits(&gb, 8); put_bits(&pb, 8, v); if(v == 0xFF){ v = get_bits(&gb, 7); put_bits(&pb, 8, v); } } align_put_bits(&pb); av_free(buf2); /* End of image */ put_marker(&pb, EOI); flush_put_bits(&pb); emms_c(); return put_bits_count(&pb) >> 3; }
true
FFmpeg
c8aee695c50f879186ca5f9cbaefb076a0d0343f
static int encode_picture_ls(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data){ JpeglsContext * const s = avctx->priv_data; AVFrame *pict = data; AVFrame * const p= (AVFrame*)&s->picture; const int near = avctx->prediction_method; PutBitContext pb, pb2; GetBitContext gb; uint8_t *buf2, *zero, *cur, *last; JLSState *state; int i, size; int comps; buf2 = av_malloc(buf_size); init_put_bits(&pb, buf, buf_size); init_put_bits(&pb2, buf2, buf_size); *p = *pict; p->pict_type= FF_I_TYPE; p->key_frame= 1; if(avctx->pix_fmt == PIX_FMT_GRAY8 || avctx->pix_fmt == PIX_FMT_GRAY16) comps = 1; else comps = 3; put_marker(&pb, SOI); put_marker(&pb, SOF48); put_bits(&pb, 16, 8 + comps * 3); put_bits(&pb, 8, (avctx->pix_fmt == PIX_FMT_GRAY16) ? 16 : 8); put_bits(&pb, 16, avctx->height); put_bits(&pb, 16, avctx->width); put_bits(&pb, 8, comps); for(i = 1; i <= comps; i++) { put_bits(&pb, 8, i); put_bits(&pb, 8, 0x11); put_bits(&pb, 8, 0); } put_marker(&pb, SOS); put_bits(&pb, 16, 6 + comps * 2); put_bits(&pb, 8, comps); for(i = 1; i <= comps; i++) { put_bits(&pb, 8, i); put_bits(&pb, 8, 0); } put_bits(&pb, 8, near); put_bits(&pb, 8, (comps > 1) ? 1 : 0); put_bits(&pb, 8, 0); state = av_mallocz(sizeof(JLSState)); state->near = near; state->bpp = (avctx->pix_fmt == PIX_FMT_GRAY16) ? 16 : 8; reset_ls_coding_parameters(state, 0); ls_init_state(state); ls_store_lse(state, &pb); zero = av_mallocz(p->linesize[0]); last = zero; cur = p->data[0]; if(avctx->pix_fmt == PIX_FMT_GRAY8){ int t = 0; for(i = 0; i < avctx->height; i++) { ls_encode_line(state, &pb2, last, cur, t, avctx->width, 1, 0, 8); t = last[0]; last = cur; cur += p->linesize[0]; } }else if(avctx->pix_fmt == PIX_FMT_GRAY16){ int t = 0; for(i = 0; i < avctx->height; i++) { ls_encode_line(state, &pb2, last, cur, t, avctx->width, 1, 0, 16); t = *((uint16_t*)last); last = cur; cur += p->linesize[0]; } }else if(avctx->pix_fmt == PIX_FMT_RGB24){ int j, width; int Rc[3] = {0, 0, 0}; width = avctx->width * 3; for(i = 0; i < avctx->height; i++) { for(j = 0; j < 3; j++) { ls_encode_line(state, &pb2, last + j, cur + j, Rc[j], width, 3, j, 8); Rc[j] = last[j]; } last = cur; cur += s->picture.linesize[0]; } }else if(avctx->pix_fmt == PIX_FMT_BGR24){ int j, width; int Rc[3] = {0, 0, 0}; width = avctx->width * 3; for(i = 0; i < avctx->height; i++) { for(j = 2; j >= 0; j--) { ls_encode_line(state, &pb2, last + j, cur + j, Rc[j], width, 3, j, 8); Rc[j] = last[j]; } last = cur; cur += s->picture.linesize[0]; } } av_free(zero); av_free(state); flush_put_bits(&pb2); size = put_bits_count(&pb2) >> 3; init_get_bits(&gb, buf2, size); while(get_bits_count(&gb) < size * 8){ int v; v = get_bits(&gb, 8); put_bits(&pb, 8, v); if(v == 0xFF){ v = get_bits(&gb, 7); put_bits(&pb, 8, v); } } align_put_bits(&pb); av_free(buf2); put_marker(&pb, EOI); flush_put_bits(&pb); emms_c(); return put_bits_count(&pb) >> 3; }
{ "code": [ " size = put_bits_count(&pb2) >> 3;", " while(get_bits_count(&gb) < size * 8){" ], "line_no": [ 229, 233 ] }
static int FUNC_0(AVCodecContext *VAR_0, unsigned char *VAR_1, int VAR_2, void *VAR_3){ JpeglsContext * const s = VAR_0->priv_data; AVFrame *pict = VAR_3; AVFrame * const p= (AVFrame*)&s->picture; const int VAR_4 = VAR_0->prediction_method; PutBitContext pb, pb2; GetBitContext gb; uint8_t *buf2, *zero, *cur, *last; JLSState *state; int VAR_5, VAR_6; int VAR_7; buf2 = av_malloc(VAR_2); init_put_bits(&pb, VAR_1, VAR_2); init_put_bits(&pb2, buf2, VAR_2); *p = *pict; p->pict_type= FF_I_TYPE; p->key_frame= 1; if(VAR_0->pix_fmt == PIX_FMT_GRAY8 || VAR_0->pix_fmt == PIX_FMT_GRAY16) VAR_7 = 1; else VAR_7 = 3; put_marker(&pb, SOI); put_marker(&pb, SOF48); put_bits(&pb, 16, 8 + VAR_7 * 3); put_bits(&pb, 8, (VAR_0->pix_fmt == PIX_FMT_GRAY16) ? 16 : 8); put_bits(&pb, 16, VAR_0->height); put_bits(&pb, 16, VAR_0->VAR_12); put_bits(&pb, 8, VAR_7); for(VAR_5 = 1; VAR_5 <= VAR_7; VAR_5++) { put_bits(&pb, 8, VAR_5); put_bits(&pb, 8, 0x11); put_bits(&pb, 8, 0); } put_marker(&pb, SOS); put_bits(&pb, 16, 6 + VAR_7 * 2); put_bits(&pb, 8, VAR_7); for(VAR_5 = 1; VAR_5 <= VAR_7; VAR_5++) { put_bits(&pb, 8, VAR_5); put_bits(&pb, 8, 0); } put_bits(&pb, 8, VAR_4); put_bits(&pb, 8, (VAR_7 > 1) ? 1 : 0); put_bits(&pb, 8, 0); state = av_mallocz(sizeof(JLSState)); state->VAR_4 = VAR_4; state->bpp = (VAR_0->pix_fmt == PIX_FMT_GRAY16) ? 16 : 8; reset_ls_coding_parameters(state, 0); ls_init_state(state); ls_store_lse(state, &pb); zero = av_mallocz(p->linesize[0]); last = zero; cur = p->VAR_3[0]; if(VAR_0->pix_fmt == PIX_FMT_GRAY8){ int VAR_9 = 0; for(VAR_5 = 0; VAR_5 < VAR_0->height; VAR_5++) { ls_encode_line(state, &pb2, last, cur, VAR_9, VAR_0->VAR_12, 1, 0, 8); VAR_9 = last[0]; last = cur; cur += p->linesize[0]; } }else if(VAR_0->pix_fmt == PIX_FMT_GRAY16){ int VAR_9 = 0; for(VAR_5 = 0; VAR_5 < VAR_0->height; VAR_5++) { ls_encode_line(state, &pb2, last, cur, VAR_9, VAR_0->VAR_12, 1, 0, 16); VAR_9 = *((uint16_t*)last); last = cur; cur += p->linesize[0]; } }else if(VAR_0->pix_fmt == PIX_FMT_RGB24){ int VAR_12, VAR_12; int VAR_12[3] = {0, 0, 0}; VAR_12 = VAR_0->VAR_12 * 3; for(VAR_5 = 0; VAR_5 < VAR_0->height; VAR_5++) { for(VAR_12 = 0; VAR_12 < 3; VAR_12++) { ls_encode_line(state, &pb2, last + VAR_12, cur + VAR_12, VAR_12[VAR_12], VAR_12, 3, VAR_12, 8); VAR_12[VAR_12] = last[VAR_12]; } last = cur; cur += s->picture.linesize[0]; } }else if(VAR_0->pix_fmt == PIX_FMT_BGR24){ int VAR_12, VAR_12; int VAR_12[3] = {0, 0, 0}; VAR_12 = VAR_0->VAR_12 * 3; for(VAR_5 = 0; VAR_5 < VAR_0->height; VAR_5++) { for(VAR_12 = 2; VAR_12 >= 0; VAR_12--) { ls_encode_line(state, &pb2, last + VAR_12, cur + VAR_12, VAR_12[VAR_12], VAR_12, 3, VAR_12, 8); VAR_12[VAR_12] = last[VAR_12]; } last = cur; cur += s->picture.linesize[0]; } } av_free(zero); av_free(state); flush_put_bits(&pb2); VAR_6 = put_bits_count(&pb2) >> 3; init_get_bits(&gb, buf2, VAR_6); while(get_bits_count(&gb) < VAR_6 * 8){ int VAR_12; VAR_12 = get_bits(&gb, 8); put_bits(&pb, 8, VAR_12); if(VAR_12 == 0xFF){ VAR_12 = get_bits(&gb, 7); put_bits(&pb, 8, VAR_12); } } align_put_bits(&pb); av_free(buf2); put_marker(&pb, EOI); flush_put_bits(&pb); emms_c(); return put_bits_count(&pb) >> 3; }
[ "static int FUNC_0(AVCodecContext *VAR_0, unsigned char *VAR_1, int VAR_2, void *VAR_3){", "JpeglsContext * const s = VAR_0->priv_data;", "AVFrame *pict = VAR_3;", "AVFrame * const p= (AVFrame*)&s->picture;", "const int VAR_4 = VAR_0->prediction_method;", "PutBitContext pb, pb2;", "GetBitContext gb;", "uint8_t *buf2, *zero, *cur, *last;", "JLSState *state;", "int VAR_5, VAR_6;", "int VAR_7;", "buf2 = av_malloc(VAR_2);", "init_put_bits(&pb, VAR_1, VAR_2);", "init_put_bits(&pb2, buf2, VAR_2);", "*p = *pict;", "p->pict_type= FF_I_TYPE;", "p->key_frame= 1;", "if(VAR_0->pix_fmt == PIX_FMT_GRAY8 || VAR_0->pix_fmt == PIX_FMT_GRAY16)\nVAR_7 = 1;", "else\nVAR_7 = 3;", "put_marker(&pb, SOI);", "put_marker(&pb, SOF48);", "put_bits(&pb, 16, 8 + VAR_7 * 3);", "put_bits(&pb, 8, (VAR_0->pix_fmt == PIX_FMT_GRAY16) ? 16 : 8);", "put_bits(&pb, 16, VAR_0->height);", "put_bits(&pb, 16, VAR_0->VAR_12);", "put_bits(&pb, 8, VAR_7);", "for(VAR_5 = 1; VAR_5 <= VAR_7; VAR_5++) {", "put_bits(&pb, 8, VAR_5);", "put_bits(&pb, 8, 0x11);", "put_bits(&pb, 8, 0);", "}", "put_marker(&pb, SOS);", "put_bits(&pb, 16, 6 + VAR_7 * 2);", "put_bits(&pb, 8, VAR_7);", "for(VAR_5 = 1; VAR_5 <= VAR_7; VAR_5++) {", "put_bits(&pb, 8, VAR_5);", "put_bits(&pb, 8, 0);", "}", "put_bits(&pb, 8, VAR_4);", "put_bits(&pb, 8, (VAR_7 > 1) ? 1 : 0);", "put_bits(&pb, 8, 0);", "state = av_mallocz(sizeof(JLSState));", "state->VAR_4 = VAR_4;", "state->bpp = (VAR_0->pix_fmt == PIX_FMT_GRAY16) ? 16 : 8;", "reset_ls_coding_parameters(state, 0);", "ls_init_state(state);", "ls_store_lse(state, &pb);", "zero = av_mallocz(p->linesize[0]);", "last = zero;", "cur = p->VAR_3[0];", "if(VAR_0->pix_fmt == PIX_FMT_GRAY8){", "int VAR_9 = 0;", "for(VAR_5 = 0; VAR_5 < VAR_0->height; VAR_5++) {", "ls_encode_line(state, &pb2, last, cur, VAR_9, VAR_0->VAR_12, 1, 0, 8);", "VAR_9 = last[0];", "last = cur;", "cur += p->linesize[0];", "}", "}else if(VAR_0->pix_fmt == PIX_FMT_GRAY16){", "int VAR_9 = 0;", "for(VAR_5 = 0; VAR_5 < VAR_0->height; VAR_5++) {", "ls_encode_line(state, &pb2, last, cur, VAR_9, VAR_0->VAR_12, 1, 0, 16);", "VAR_9 = *((uint16_t*)last);", "last = cur;", "cur += p->linesize[0];", "}", "}else if(VAR_0->pix_fmt == PIX_FMT_RGB24){", "int VAR_12, VAR_12;", "int VAR_12[3] = {0, 0, 0};", "VAR_12 = VAR_0->VAR_12 * 3;", "for(VAR_5 = 0; VAR_5 < VAR_0->height; VAR_5++) {", "for(VAR_12 = 0; VAR_12 < 3; VAR_12++) {", "ls_encode_line(state, &pb2, last + VAR_12, cur + VAR_12, VAR_12[VAR_12], VAR_12, 3, VAR_12, 8);", "VAR_12[VAR_12] = last[VAR_12];", "}", "last = cur;", "cur += s->picture.linesize[0];", "}", "}else if(VAR_0->pix_fmt == PIX_FMT_BGR24){", "int VAR_12, VAR_12;", "int VAR_12[3] = {0, 0, 0};", "VAR_12 = VAR_0->VAR_12 * 3;", "for(VAR_5 = 0; VAR_5 < VAR_0->height; VAR_5++) {", "for(VAR_12 = 2; VAR_12 >= 0; VAR_12--) {", "ls_encode_line(state, &pb2, last + VAR_12, cur + VAR_12, VAR_12[VAR_12], VAR_12, 3, VAR_12, 8);", "VAR_12[VAR_12] = last[VAR_12];", "}", "last = cur;", "cur += s->picture.linesize[0];", "}", "}", "av_free(zero);", "av_free(state);", "flush_put_bits(&pb2);", "VAR_6 = put_bits_count(&pb2) >> 3;", "init_get_bits(&gb, buf2, VAR_6);", "while(get_bits_count(&gb) < VAR_6 * 8){", "int VAR_12;", "VAR_12 = get_bits(&gb, 8);", "put_bits(&pb, 8, VAR_12);", "if(VAR_12 == 0xFF){", "VAR_12 = get_bits(&gb, 7);", "put_bits(&pb, 8, VAR_12);", "}", "}", "align_put_bits(&pb);", "av_free(buf2);", "put_marker(&pb, EOI);", "flush_put_bits(&pb);", "emms_c();", "return put_bits_count(&pb) >> 3;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 43, 45 ], [ 47, 49 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 103 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 117 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 219 ], [ 221 ], [ 225 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 259 ], [ 261 ], [ 265 ], [ 269 ], [ 271 ] ]
18,443
void ff_er_add_slice(MpegEncContext *s, int startx, int starty, int endx, int endy, int status){ const int start_i= clip(startx + starty * s->mb_width , 0, s->mb_num-1); const int end_i = clip(endx + endy * s->mb_width , 0, s->mb_num); const int start_xy= s->mb_index2xy[start_i]; const int end_xy = s->mb_index2xy[end_i]; int mask= -1; if(!s->error_resilience) return; mask &= ~VP_START; if(status & (AC_ERROR|AC_END)){ mask &= ~(AC_ERROR|AC_END); s->error_count -= end_i - start_i + 1; if(status & (DC_ERROR|DC_END)){ mask &= ~(DC_ERROR|DC_END); s->error_count -= end_i - start_i + 1; if(status & (MV_ERROR|MV_END)){ mask &= ~(MV_ERROR|MV_END); s->error_count -= end_i - start_i + 1; if(status & (AC_ERROR|DC_ERROR|MV_ERROR)) s->error_count= INT_MAX; if(mask == ~0x7F){ memset(&s->error_status_table[start_xy], 0, (end_xy - start_xy) * sizeof(uint8_t)); }else{ int i; for(i=start_xy; i<end_xy; i++){ s->error_status_table[ i ] &= mask; if(end_i == s->mb_num) s->error_count= INT_MAX; else{ s->error_status_table[end_xy] &= mask; s->error_status_table[end_xy] |= status; s->error_status_table[start_xy] |= VP_START; if(start_xy > 0 && s->avctx->thread_count <= 1 && s->avctx->skip_top*s->mb_width < start_i){ int prev_status= s->error_status_table[ s->mb_index2xy[start_i - 1] ]; prev_status &= ~ VP_START; if(prev_status != (MV_END|DC_END|AC_END)) s->error_count= INT_MAX;
true
FFmpeg
04cfef21ff25e30005d3b2a42bc145324e580a2f
void ff_er_add_slice(MpegEncContext *s, int startx, int starty, int endx, int endy, int status){ const int start_i= clip(startx + starty * s->mb_width , 0, s->mb_num-1); const int end_i = clip(endx + endy * s->mb_width , 0, s->mb_num); const int start_xy= s->mb_index2xy[start_i]; const int end_xy = s->mb_index2xy[end_i]; int mask= -1; if(!s->error_resilience) return; mask &= ~VP_START; if(status & (AC_ERROR|AC_END)){ mask &= ~(AC_ERROR|AC_END); s->error_count -= end_i - start_i + 1; if(status & (DC_ERROR|DC_END)){ mask &= ~(DC_ERROR|DC_END); s->error_count -= end_i - start_i + 1; if(status & (MV_ERROR|MV_END)){ mask &= ~(MV_ERROR|MV_END); s->error_count -= end_i - start_i + 1; if(status & (AC_ERROR|DC_ERROR|MV_ERROR)) s->error_count= INT_MAX; if(mask == ~0x7F){ memset(&s->error_status_table[start_xy], 0, (end_xy - start_xy) * sizeof(uint8_t)); }else{ int i; for(i=start_xy; i<end_xy; i++){ s->error_status_table[ i ] &= mask; if(end_i == s->mb_num) s->error_count= INT_MAX; else{ s->error_status_table[end_xy] &= mask; s->error_status_table[end_xy] |= status; s->error_status_table[start_xy] |= VP_START; if(start_xy > 0 && s->avctx->thread_count <= 1 && s->avctx->skip_top*s->mb_width < start_i){ int prev_status= s->error_status_table[ s->mb_index2xy[start_i - 1] ]; prev_status &= ~ VP_START; if(prev_status != (MV_END|DC_END|AC_END)) s->error_count= INT_MAX;
{ "code": [], "line_no": [] }
void FUNC_0(MpegEncContext *VAR_0, int VAR_1, int VAR_2, int VAR_3, int VAR_4, int VAR_5){ const int VAR_6= clip(VAR_1 + VAR_2 * VAR_0->mb_width , 0, VAR_0->mb_num-1); const int VAR_7 = clip(VAR_3 + VAR_4 * VAR_0->mb_width , 0, VAR_0->mb_num); const int VAR_8= VAR_0->mb_index2xy[VAR_6]; const int VAR_9 = VAR_0->mb_index2xy[VAR_7]; int VAR_10= -1; if(!VAR_0->error_resilience) return; VAR_10 &= ~VP_START; if(VAR_5 & (AC_ERROR|AC_END)){ VAR_10 &= ~(AC_ERROR|AC_END); VAR_0->error_count -= VAR_7 - VAR_6 + 1; if(VAR_5 & (DC_ERROR|DC_END)){ VAR_10 &= ~(DC_ERROR|DC_END); VAR_0->error_count -= VAR_7 - VAR_6 + 1; if(VAR_5 & (MV_ERROR|MV_END)){ VAR_10 &= ~(MV_ERROR|MV_END); VAR_0->error_count -= VAR_7 - VAR_6 + 1; if(VAR_5 & (AC_ERROR|DC_ERROR|MV_ERROR)) VAR_0->error_count= INT_MAX; if(VAR_10 == ~0x7F){ memset(&VAR_0->error_status_table[VAR_8], 0, (VAR_9 - VAR_8) * sizeof(uint8_t)); }else{ int VAR_11; for(VAR_11=VAR_8; VAR_11<VAR_9; VAR_11++){ VAR_0->error_status_table[ VAR_11 ] &= VAR_10; if(VAR_7 == VAR_0->mb_num) VAR_0->error_count= INT_MAX; else{ VAR_0->error_status_table[VAR_9] &= VAR_10; VAR_0->error_status_table[VAR_9] |= VAR_5; VAR_0->error_status_table[VAR_8] |= VP_START; if(VAR_8 > 0 && VAR_0->avctx->thread_count <= 1 && VAR_0->avctx->skip_top*VAR_0->mb_width < VAR_6){ int VAR_12= VAR_0->error_status_table[ VAR_0->mb_index2xy[VAR_6 - 1] ]; VAR_12 &= ~ VP_START; if(VAR_12 != (MV_END|DC_END|AC_END)) VAR_0->error_count= INT_MAX;
[ "void FUNC_0(MpegEncContext *VAR_0, int VAR_1, int VAR_2, int VAR_3, int VAR_4, int VAR_5){", "const int VAR_6= clip(VAR_1 + VAR_2 * VAR_0->mb_width , 0, VAR_0->mb_num-1);", "const int VAR_7 = clip(VAR_3 + VAR_4 * VAR_0->mb_width , 0, VAR_0->mb_num);", "const int VAR_8= VAR_0->mb_index2xy[VAR_6];", "const int VAR_9 = VAR_0->mb_index2xy[VAR_7];", "int VAR_10= -1;", "if(!VAR_0->error_resilience) return;", "VAR_10 &= ~VP_START;", "if(VAR_5 & (AC_ERROR|AC_END)){", "VAR_10 &= ~(AC_ERROR|AC_END);", "VAR_0->error_count -= VAR_7 - VAR_6 + 1;", "if(VAR_5 & (DC_ERROR|DC_END)){", "VAR_10 &= ~(DC_ERROR|DC_END);", "VAR_0->error_count -= VAR_7 - VAR_6 + 1;", "if(VAR_5 & (MV_ERROR|MV_END)){", "VAR_10 &= ~(MV_ERROR|MV_END);", "VAR_0->error_count -= VAR_7 - VAR_6 + 1;", "if(VAR_5 & (AC_ERROR|DC_ERROR|MV_ERROR)) VAR_0->error_count= INT_MAX;", "if(VAR_10 == ~0x7F){", "memset(&VAR_0->error_status_table[VAR_8], 0, (VAR_9 - VAR_8) * sizeof(uint8_t));", "}else{", "int VAR_11;", "for(VAR_11=VAR_8; VAR_11<VAR_9; VAR_11++){", "VAR_0->error_status_table[ VAR_11 ] &= VAR_10;", "if(VAR_7 == VAR_0->mb_num)\nVAR_0->error_count= INT_MAX;", "else{", "VAR_0->error_status_table[VAR_9] &= VAR_10;", "VAR_0->error_status_table[VAR_9] |= VAR_5;", "VAR_0->error_status_table[VAR_8] |= VP_START;", "if(VAR_8 > 0 && VAR_0->avctx->thread_count <= 1 && VAR_0->avctx->skip_top*VAR_0->mb_width < VAR_6){", "int VAR_12= VAR_0->error_status_table[ VAR_0->mb_index2xy[VAR_6 - 1] ];", "VAR_12 &= ~ VP_START;", "if(VAR_12 != (MV_END|DC_END|AC_END)) VAR_0->error_count= INT_MAX;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 2 ], [ 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ], [ 8 ], [ 9 ], [ 10 ], [ 11 ], [ 12 ], [ 13 ], [ 14 ], [ 15 ], [ 16 ], [ 17 ], [ 18 ], [ 19 ], [ 20 ], [ 21 ], [ 22 ], [ 23 ], [ 24 ], [ 25, 26 ], [ 27 ], [ 28 ], [ 29 ], [ 30 ], [ 31 ], [ 32 ], [ 33 ], [ 34 ] ]
18,444
static int rtsp_parse_request(HTTPContext *c) { const char *p, *p1, *p2; char cmd[32]; char url[1024]; char protocol[32]; char line[1024]; int len; RTSPMessageHeader header1 = { 0 }, *header = &header1; c->buffer_ptr[0] = '\0'; p = c->buffer; get_word(cmd, sizeof(cmd), &p); get_word(url, sizeof(url), &p); get_word(protocol, sizeof(protocol), &p); av_strlcpy(c->method, cmd, sizeof(c->method)); av_strlcpy(c->url, url, sizeof(c->url)); av_strlcpy(c->protocol, protocol, sizeof(c->protocol)); if (avio_open_dyn_buf(&c->pb) < 0) { /* XXX: cannot do more */ c->pb = NULL; /* safety */ return -1; } /* check version name */ if (strcmp(protocol, "RTSP/1.0") != 0) { rtsp_reply_error(c, RTSP_STATUS_VERSION); goto the_end; } /* parse each header line */ /* skip to next line */ while (*p != '\n' && *p != '\0') p++; if (*p == '\n') p++; while (*p != '\0') { p1 = memchr(p, '\n', (char *)c->buffer_ptr - p); if (!p1) break; p2 = p1; if (p2 > p && p2[-1] == '\r') p2--; /* skip empty line */ if (p2 == p) break; len = p2 - p; if (len > sizeof(line) - 1) len = sizeof(line) - 1; memcpy(line, p, len); line[len] = '\0'; ff_rtsp_parse_line(header, line, NULL, NULL); p = p1 + 1; } /* handle sequence number */ c->seq = header->seq; if (!strcmp(cmd, "DESCRIBE")) rtsp_cmd_describe(c, url); else if (!strcmp(cmd, "OPTIONS")) rtsp_cmd_options(c, url); else if (!strcmp(cmd, "SETUP")) rtsp_cmd_setup(c, url, header); else if (!strcmp(cmd, "PLAY")) rtsp_cmd_play(c, url, header); else if (!strcmp(cmd, "PAUSE")) rtsp_cmd_interrupt(c, url, header, 1); else if (!strcmp(cmd, "TEARDOWN")) rtsp_cmd_interrupt(c, url, header, 0); else rtsp_reply_error(c, RTSP_STATUS_METHOD); the_end: len = avio_close_dyn_buf(c->pb, &c->pb_buffer); c->pb = NULL; /* safety */ if (len < 0) { /* XXX: cannot do more */ return -1; } c->buffer_ptr = c->pb_buffer; c->buffer_end = c->pb_buffer + len; c->state = RTSPSTATE_SEND_REPLY; return 0; }
false
FFmpeg
33d6f90e3e0241939ea0be9ca9e1f335942081c8
static int rtsp_parse_request(HTTPContext *c) { const char *p, *p1, *p2; char cmd[32]; char url[1024]; char protocol[32]; char line[1024]; int len; RTSPMessageHeader header1 = { 0 }, *header = &header1; c->buffer_ptr[0] = '\0'; p = c->buffer; get_word(cmd, sizeof(cmd), &p); get_word(url, sizeof(url), &p); get_word(protocol, sizeof(protocol), &p); av_strlcpy(c->method, cmd, sizeof(c->method)); av_strlcpy(c->url, url, sizeof(c->url)); av_strlcpy(c->protocol, protocol, sizeof(c->protocol)); if (avio_open_dyn_buf(&c->pb) < 0) { c->pb = NULL; return -1; } if (strcmp(protocol, "RTSP/1.0") != 0) { rtsp_reply_error(c, RTSP_STATUS_VERSION); goto the_end; } while (*p != '\n' && *p != '\0') p++; if (*p == '\n') p++; while (*p != '\0') { p1 = memchr(p, '\n', (char *)c->buffer_ptr - p); if (!p1) break; p2 = p1; if (p2 > p && p2[-1] == '\r') p2--; if (p2 == p) break; len = p2 - p; if (len > sizeof(line) - 1) len = sizeof(line) - 1; memcpy(line, p, len); line[len] = '\0'; ff_rtsp_parse_line(header, line, NULL, NULL); p = p1 + 1; } c->seq = header->seq; if (!strcmp(cmd, "DESCRIBE")) rtsp_cmd_describe(c, url); else if (!strcmp(cmd, "OPTIONS")) rtsp_cmd_options(c, url); else if (!strcmp(cmd, "SETUP")) rtsp_cmd_setup(c, url, header); else if (!strcmp(cmd, "PLAY")) rtsp_cmd_play(c, url, header); else if (!strcmp(cmd, "PAUSE")) rtsp_cmd_interrupt(c, url, header, 1); else if (!strcmp(cmd, "TEARDOWN")) rtsp_cmd_interrupt(c, url, header, 0); else rtsp_reply_error(c, RTSP_STATUS_METHOD); the_end: len = avio_close_dyn_buf(c->pb, &c->pb_buffer); c->pb = NULL; if (len < 0) { return -1; } c->buffer_ptr = c->pb_buffer; c->buffer_end = c->pb_buffer + len; c->state = RTSPSTATE_SEND_REPLY; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(HTTPContext *VAR_0) { const char *VAR_1, *VAR_2, *VAR_3; char VAR_4[32]; char VAR_5[1024]; char VAR_6[32]; char VAR_7[1024]; int VAR_8; RTSPMessageHeader header1 = { 0 }, *header = &header1; VAR_0->buffer_ptr[0] = '\0'; VAR_1 = VAR_0->buffer; get_word(VAR_4, sizeof(VAR_4), &VAR_1); get_word(VAR_5, sizeof(VAR_5), &VAR_1); get_word(VAR_6, sizeof(VAR_6), &VAR_1); av_strlcpy(VAR_0->method, VAR_4, sizeof(VAR_0->method)); av_strlcpy(VAR_0->VAR_5, VAR_5, sizeof(VAR_0->VAR_5)); av_strlcpy(VAR_0->VAR_6, VAR_6, sizeof(VAR_0->VAR_6)); if (avio_open_dyn_buf(&VAR_0->pb) < 0) { VAR_0->pb = NULL; return -1; } if (strcmp(VAR_6, "RTSP/1.0") != 0) { rtsp_reply_error(VAR_0, RTSP_STATUS_VERSION); goto the_end; } while (*VAR_1 != '\n' && *VAR_1 != '\0') VAR_1++; if (*VAR_1 == '\n') VAR_1++; while (*VAR_1 != '\0') { VAR_2 = memchr(VAR_1, '\n', (char *)VAR_0->buffer_ptr - VAR_1); if (!VAR_2) break; VAR_3 = VAR_2; if (VAR_3 > VAR_1 && VAR_3[-1] == '\r') VAR_3--; if (VAR_3 == VAR_1) break; VAR_8 = VAR_3 - VAR_1; if (VAR_8 > sizeof(VAR_7) - 1) VAR_8 = sizeof(VAR_7) - 1; memcpy(VAR_7, VAR_1, VAR_8); VAR_7[VAR_8] = '\0'; ff_rtsp_parse_line(header, VAR_7, NULL, NULL); VAR_1 = VAR_2 + 1; } VAR_0->seq = header->seq; if (!strcmp(VAR_4, "DESCRIBE")) rtsp_cmd_describe(VAR_0, VAR_5); else if (!strcmp(VAR_4, "OPTIONS")) rtsp_cmd_options(VAR_0, VAR_5); else if (!strcmp(VAR_4, "SETUP")) rtsp_cmd_setup(VAR_0, VAR_5, header); else if (!strcmp(VAR_4, "PLAY")) rtsp_cmd_play(VAR_0, VAR_5, header); else if (!strcmp(VAR_4, "PAUSE")) rtsp_cmd_interrupt(VAR_0, VAR_5, header, 1); else if (!strcmp(VAR_4, "TEARDOWN")) rtsp_cmd_interrupt(VAR_0, VAR_5, header, 0); else rtsp_reply_error(VAR_0, RTSP_STATUS_METHOD); the_end: VAR_8 = avio_close_dyn_buf(VAR_0->pb, &VAR_0->pb_buffer); VAR_0->pb = NULL; if (VAR_8 < 0) { return -1; } VAR_0->buffer_ptr = VAR_0->pb_buffer; VAR_0->buffer_end = VAR_0->pb_buffer + VAR_8; VAR_0->state = RTSPSTATE_SEND_REPLY; return 0; }
[ "static int FUNC_0(HTTPContext *VAR_0)\n{", "const char *VAR_1, *VAR_2, *VAR_3;", "char VAR_4[32];", "char VAR_5[1024];", "char VAR_6[32];", "char VAR_7[1024];", "int VAR_8;", "RTSPMessageHeader header1 = { 0 }, *header = &header1;", "VAR_0->buffer_ptr[0] = '\\0';", "VAR_1 = VAR_0->buffer;", "get_word(VAR_4, sizeof(VAR_4), &VAR_1);", "get_word(VAR_5, sizeof(VAR_5), &VAR_1);", "get_word(VAR_6, sizeof(VAR_6), &VAR_1);", "av_strlcpy(VAR_0->method, VAR_4, sizeof(VAR_0->method));", "av_strlcpy(VAR_0->VAR_5, VAR_5, sizeof(VAR_0->VAR_5));", "av_strlcpy(VAR_0->VAR_6, VAR_6, sizeof(VAR_0->VAR_6));", "if (avio_open_dyn_buf(&VAR_0->pb) < 0) {", "VAR_0->pb = NULL;", "return -1;", "}", "if (strcmp(VAR_6, \"RTSP/1.0\") != 0) {", "rtsp_reply_error(VAR_0, RTSP_STATUS_VERSION);", "goto the_end;", "}", "while (*VAR_1 != '\\n' && *VAR_1 != '\\0')\nVAR_1++;", "if (*VAR_1 == '\\n')\nVAR_1++;", "while (*VAR_1 != '\\0') {", "VAR_2 = memchr(VAR_1, '\\n', (char *)VAR_0->buffer_ptr - VAR_1);", "if (!VAR_2)\nbreak;", "VAR_3 = VAR_2;", "if (VAR_3 > VAR_1 && VAR_3[-1] == '\\r')\nVAR_3--;", "if (VAR_3 == VAR_1)\nbreak;", "VAR_8 = VAR_3 - VAR_1;", "if (VAR_8 > sizeof(VAR_7) - 1)\nVAR_8 = sizeof(VAR_7) - 1;", "memcpy(VAR_7, VAR_1, VAR_8);", "VAR_7[VAR_8] = '\\0';", "ff_rtsp_parse_line(header, VAR_7, NULL, NULL);", "VAR_1 = VAR_2 + 1;", "}", "VAR_0->seq = header->seq;", "if (!strcmp(VAR_4, \"DESCRIBE\"))\nrtsp_cmd_describe(VAR_0, VAR_5);", "else if (!strcmp(VAR_4, \"OPTIONS\"))\nrtsp_cmd_options(VAR_0, VAR_5);", "else if (!strcmp(VAR_4, \"SETUP\"))\nrtsp_cmd_setup(VAR_0, VAR_5, header);", "else if (!strcmp(VAR_4, \"PLAY\"))\nrtsp_cmd_play(VAR_0, VAR_5, header);", "else if (!strcmp(VAR_4, \"PAUSE\"))\nrtsp_cmd_interrupt(VAR_0, VAR_5, header, 1);", "else if (!strcmp(VAR_4, \"TEARDOWN\"))\nrtsp_cmd_interrupt(VAR_0, VAR_5, header, 0);", "else\nrtsp_reply_error(VAR_0, RTSP_STATUS_METHOD);", "the_end:\nVAR_8 = avio_close_dyn_buf(VAR_0->pb, &VAR_0->pb_buffer);", "VAR_0->pb = NULL;", "if (VAR_8 < 0) {", "return -1;", "}", "VAR_0->buffer_ptr = VAR_0->pb_buffer;", "VAR_0->buffer_end = VAR_0->pb_buffer + VAR_8;", "VAR_0->state = RTSPSTATE_SEND_REPLY;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 71, 73 ], [ 75, 77 ], [ 79 ], [ 81 ], [ 83, 85 ], [ 87 ], [ 89, 91 ], [ 95, 97 ], [ 99 ], [ 101, 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 119 ], [ 123, 125 ], [ 127, 129 ], [ 131, 133 ], [ 135, 137 ], [ 139, 141 ], [ 143, 145 ], [ 147, 149 ], [ 153, 155 ], [ 157 ], [ 159 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ] ]
18,445
bdrv_acct_done(BlockDriverState *bs, BlockAcctCookie *cookie) { assert(cookie->type < BDRV_MAX_IOTYPE); bs->stats.nr_bytes[cookie->type] += cookie->bytes; bs->stats.nr_ops[cookie->type]++; bs->stats.total_time_ns[cookie->type] += get_clock() - cookie->start_time_ns; }
true
qemu
5e5a94b60518002e8ecc7afa78a9e7565b23e38f
bdrv_acct_done(BlockDriverState *bs, BlockAcctCookie *cookie) { assert(cookie->type < BDRV_MAX_IOTYPE); bs->stats.nr_bytes[cookie->type] += cookie->bytes; bs->stats.nr_ops[cookie->type]++; bs->stats.total_time_ns[cookie->type] += get_clock() - cookie->start_time_ns; }
{ "code": [ "bdrv_acct_done(BlockDriverState *bs, BlockAcctCookie *cookie)", " assert(cookie->type < BDRV_MAX_IOTYPE);", " bs->stats.nr_bytes[cookie->type] += cookie->bytes;", " bs->stats.nr_ops[cookie->type]++;", " bs->stats.total_time_ns[cookie->type] += get_clock() -", " cookie->start_time_ns;" ], "line_no": [ 1, 5, 9, 11, 13, 15 ] }
FUNC_0(BlockDriverState *VAR_0, BlockAcctCookie *VAR_1) { assert(VAR_1->type < BDRV_MAX_IOTYPE); VAR_0->stats.nr_bytes[VAR_1->type] += VAR_1->bytes; VAR_0->stats.nr_ops[VAR_1->type]++; VAR_0->stats.total_time_ns[VAR_1->type] += get_clock() - VAR_1->start_time_ns; }
[ "FUNC_0(BlockDriverState *VAR_0, BlockAcctCookie *VAR_1)\n{", "assert(VAR_1->type < BDRV_MAX_IOTYPE);", "VAR_0->stats.nr_bytes[VAR_1->type] += VAR_1->bytes;", "VAR_0->stats.nr_ops[VAR_1->type]++;", "VAR_0->stats.total_time_ns[VAR_1->type] += get_clock() -\nVAR_1->start_time_ns;", "}" ]
[ 1, 1, 1, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13, 15 ], [ 17 ] ]
18,446
static inline void idct4row(DCTELEM *row) { int c0, c1, c2, c3, a0, a1, a2, a3; //const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; a0 = row[0]; a1 = row[1]; a2 = row[2]; a3 = row[3]; c0 = (a0 + a2)*R3 + (1 << (R_SHIFT - 1)); c2 = (a0 - a2)*R3 + (1 << (R_SHIFT - 1)); c1 = a1 * R1 + a3 * R2; c3 = a1 * R2 - a3 * R1; row[0]= (c0 + c1) >> R_SHIFT; row[1]= (c2 + c3) >> R_SHIFT; row[2]= (c2 - c3) >> R_SHIFT; row[3]= (c0 - c1) >> R_SHIFT; }
true
FFmpeg
c23acbaed40101c677dfcfbbfe0d2c230a8e8f44
static inline void idct4row(DCTELEM *row) { int c0, c1, c2, c3, a0, a1, a2, a3; a0 = row[0]; a1 = row[1]; a2 = row[2]; a3 = row[3]; c0 = (a0 + a2)*R3 + (1 << (R_SHIFT - 1)); c2 = (a0 - a2)*R3 + (1 << (R_SHIFT - 1)); c1 = a1 * R1 + a3 * R2; c3 = a1 * R2 - a3 * R1; row[0]= (c0 + c1) >> R_SHIFT; row[1]= (c2 + c3) >> R_SHIFT; row[2]= (c2 - c3) >> R_SHIFT; row[3]= (c0 - c1) >> R_SHIFT; }
{ "code": [], "line_no": [] }
static inline void FUNC_0(DCTELEM *VAR_0) { int VAR_1, VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8; VAR_5 = VAR_0[0]; VAR_6 = VAR_0[1]; VAR_7 = VAR_0[2]; VAR_8 = VAR_0[3]; VAR_1 = (VAR_5 + VAR_7)*R3 + (1 << (R_SHIFT - 1)); VAR_3 = (VAR_5 - VAR_7)*R3 + (1 << (R_SHIFT - 1)); VAR_2 = VAR_6 * R1 + VAR_8 * R2; VAR_4 = VAR_6 * R2 - VAR_8 * R1; VAR_0[0]= (VAR_1 + VAR_2) >> R_SHIFT; VAR_0[1]= (VAR_3 + VAR_4) >> R_SHIFT; VAR_0[2]= (VAR_3 - VAR_4) >> R_SHIFT; VAR_0[3]= (VAR_1 - VAR_2) >> R_SHIFT; }
[ "static inline void FUNC_0(DCTELEM *VAR_0)\n{", "int VAR_1, VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8;", "VAR_5 = VAR_0[0];", "VAR_6 = VAR_0[1];", "VAR_7 = VAR_0[2];", "VAR_8 = VAR_0[3];", "VAR_1 = (VAR_5 + VAR_7)*R3 + (1 << (R_SHIFT - 1));", "VAR_3 = (VAR_5 - VAR_7)*R3 + (1 << (R_SHIFT - 1));", "VAR_2 = VAR_6 * R1 + VAR_8 * R2;", "VAR_4 = VAR_6 * R2 - VAR_8 * R1;", "VAR_0[0]= (VAR_1 + VAR_2) >> R_SHIFT;", "VAR_0[1]= (VAR_3 + VAR_4) >> R_SHIFT;", "VAR_0[2]= (VAR_3 - VAR_4) >> R_SHIFT;", "VAR_0[3]= (VAR_1 - VAR_2) >> R_SHIFT;", "}" ]
[ 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 ] ]
18,448
static void dump_stream_format(AVFormatContext *ic, int i, int index, int is_output) { char buf[256]; int flags = (is_output ? ic->oformat->flags : ic->iformat->flags); AVStream *st = ic->streams[i]; int g = av_gcd(st->time_base.num, st->time_base.den); AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL, 0); avcodec_string(buf, sizeof(buf), st->codec, is_output); av_log(NULL, AV_LOG_INFO, " Stream #%d:%d", index, i); /* the pid is an important information, so we display it */ /* XXX: add a generic system */ if (flags & AVFMT_SHOW_IDS) av_log(NULL, AV_LOG_INFO, "[0x%x]", st->id); if (lang) av_log(NULL, AV_LOG_INFO, "(%s)", lang->value); av_log(NULL, AV_LOG_DEBUG, ", %d, %d/%d", st->codec_info_nb_frames, st->time_base.num / g, st->time_base.den / g); av_log(NULL, AV_LOG_INFO, ": %s", buf); if (st->sample_aspect_ratio.num && // default av_cmp_q(st->sample_aspect_ratio, st->codec->sample_aspect_ratio)) { AVRational display_aspect_ratio; av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den, st->codec->width * st->sample_aspect_ratio.num, st->codec->height * st->sample_aspect_ratio.den, 1024 * 1024); av_log(NULL, AV_LOG_INFO, ", SAR %d:%d DAR %d:%d", st->sample_aspect_ratio.num, st->sample_aspect_ratio.den, display_aspect_ratio.num, display_aspect_ratio.den); } if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) { if (st->avg_frame_rate.den && st->avg_frame_rate.num) print_fps(av_q2d(st->avg_frame_rate), "fps"); #if FF_API_R_FRAME_RATE if (st->r_frame_rate.den && st->r_frame_rate.num) print_fps(av_q2d(st->r_frame_rate), "tbr"); #endif if (st->time_base.den && st->time_base.num) print_fps(1 / av_q2d(st->time_base), "tbn"); if (st->codec->time_base.den && st->codec->time_base.num) print_fps(1 / av_q2d(st->codec->time_base), "tbc"); } if (st->disposition & AV_DISPOSITION_DEFAULT) av_log(NULL, AV_LOG_INFO, " (default)"); if (st->disposition & AV_DISPOSITION_DUB) av_log(NULL, AV_LOG_INFO, " (dub)"); if (st->disposition & AV_DISPOSITION_ORIGINAL) av_log(NULL, AV_LOG_INFO, " (original)"); if (st->disposition & AV_DISPOSITION_COMMENT) av_log(NULL, AV_LOG_INFO, " (comment)"); if (st->disposition & AV_DISPOSITION_LYRICS) av_log(NULL, AV_LOG_INFO, " (lyrics)"); if (st->disposition & AV_DISPOSITION_KARAOKE) av_log(NULL, AV_LOG_INFO, " (karaoke)"); if (st->disposition & AV_DISPOSITION_FORCED) av_log(NULL, AV_LOG_INFO, " (forced)"); if (st->disposition & AV_DISPOSITION_HEARING_IMPAIRED) av_log(NULL, AV_LOG_INFO, " (hearing impaired)"); if (st->disposition & AV_DISPOSITION_VISUAL_IMPAIRED) av_log(NULL, AV_LOG_INFO, " (visual impaired)"); if (st->disposition & AV_DISPOSITION_CLEAN_EFFECTS) av_log(NULL, AV_LOG_INFO, " (clean effects)"); av_log(NULL, AV_LOG_INFO, "\n"); dump_metadata(NULL, st->metadata, " "); dump_sidedata(NULL, st, " "); }
true
FFmpeg
75511c293add07db1cca58dcd8b08c33fc2f1075
static void dump_stream_format(AVFormatContext *ic, int i, int index, int is_output) { char buf[256]; int flags = (is_output ? ic->oformat->flags : ic->iformat->flags); AVStream *st = ic->streams[i]; int g = av_gcd(st->time_base.num, st->time_base.den); AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL, 0); avcodec_string(buf, sizeof(buf), st->codec, is_output); av_log(NULL, AV_LOG_INFO, " Stream #%d:%d", index, i); if (flags & AVFMT_SHOW_IDS) av_log(NULL, AV_LOG_INFO, "[0x%x]", st->id); if (lang) av_log(NULL, AV_LOG_INFO, "(%s)", lang->value); av_log(NULL, AV_LOG_DEBUG, ", %d, %d/%d", st->codec_info_nb_frames, st->time_base.num / g, st->time_base.den / g); av_log(NULL, AV_LOG_INFO, ": %s", buf); if (st->sample_aspect_ratio.num && av_cmp_q(st->sample_aspect_ratio, st->codec->sample_aspect_ratio)) { AVRational display_aspect_ratio; av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den, st->codec->width * st->sample_aspect_ratio.num, st->codec->height * st->sample_aspect_ratio.den, 1024 * 1024); av_log(NULL, AV_LOG_INFO, ", SAR %d:%d DAR %d:%d", st->sample_aspect_ratio.num, st->sample_aspect_ratio.den, display_aspect_ratio.num, display_aspect_ratio.den); } if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) { if (st->avg_frame_rate.den && st->avg_frame_rate.num) print_fps(av_q2d(st->avg_frame_rate), "fps"); #if FF_API_R_FRAME_RATE if (st->r_frame_rate.den && st->r_frame_rate.num) print_fps(av_q2d(st->r_frame_rate), "tbr"); #endif if (st->time_base.den && st->time_base.num) print_fps(1 / av_q2d(st->time_base), "tbn"); if (st->codec->time_base.den && st->codec->time_base.num) print_fps(1 / av_q2d(st->codec->time_base), "tbc"); } if (st->disposition & AV_DISPOSITION_DEFAULT) av_log(NULL, AV_LOG_INFO, " (default)"); if (st->disposition & AV_DISPOSITION_DUB) av_log(NULL, AV_LOG_INFO, " (dub)"); if (st->disposition & AV_DISPOSITION_ORIGINAL) av_log(NULL, AV_LOG_INFO, " (original)"); if (st->disposition & AV_DISPOSITION_COMMENT) av_log(NULL, AV_LOG_INFO, " (comment)"); if (st->disposition & AV_DISPOSITION_LYRICS) av_log(NULL, AV_LOG_INFO, " (lyrics)"); if (st->disposition & AV_DISPOSITION_KARAOKE) av_log(NULL, AV_LOG_INFO, " (karaoke)"); if (st->disposition & AV_DISPOSITION_FORCED) av_log(NULL, AV_LOG_INFO, " (forced)"); if (st->disposition & AV_DISPOSITION_HEARING_IMPAIRED) av_log(NULL, AV_LOG_INFO, " (hearing impaired)"); if (st->disposition & AV_DISPOSITION_VISUAL_IMPAIRED) av_log(NULL, AV_LOG_INFO, " (visual impaired)"); if (st->disposition & AV_DISPOSITION_CLEAN_EFFECTS) av_log(NULL, AV_LOG_INFO, " (clean effects)"); av_log(NULL, AV_LOG_INFO, "\n"); dump_metadata(NULL, st->metadata, " "); dump_sidedata(NULL, st, " "); }
{ "code": [], "line_no": [] }
static void FUNC_0(AVFormatContext *VAR_0, int VAR_1, int VAR_2, int VAR_3) { char VAR_4[256]; int VAR_5 = (VAR_3 ? VAR_0->oformat->VAR_5 : VAR_0->iformat->VAR_5); AVStream *st = VAR_0->streams[VAR_1]; int VAR_6 = av_gcd(st->time_base.num, st->time_base.den); AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL, 0); avcodec_string(VAR_4, sizeof(VAR_4), st->codec, VAR_3); av_log(NULL, AV_LOG_INFO, " Stream #%d:%d", VAR_2, VAR_1); if (VAR_5 & AVFMT_SHOW_IDS) av_log(NULL, AV_LOG_INFO, "[0x%x]", st->id); if (lang) av_log(NULL, AV_LOG_INFO, "(%s)", lang->value); av_log(NULL, AV_LOG_DEBUG, ", %d, %d/%d", st->codec_info_nb_frames, st->time_base.num / VAR_6, st->time_base.den / VAR_6); av_log(NULL, AV_LOG_INFO, ": %s", VAR_4); if (st->sample_aspect_ratio.num && av_cmp_q(st->sample_aspect_ratio, st->codec->sample_aspect_ratio)) { AVRational display_aspect_ratio; av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den, st->codec->width * st->sample_aspect_ratio.num, st->codec->height * st->sample_aspect_ratio.den, 1024 * 1024); av_log(NULL, AV_LOG_INFO, ", SAR %d:%d DAR %d:%d", st->sample_aspect_ratio.num, st->sample_aspect_ratio.den, display_aspect_ratio.num, display_aspect_ratio.den); } if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) { if (st->avg_frame_rate.den && st->avg_frame_rate.num) print_fps(av_q2d(st->avg_frame_rate), "fps"); #if FF_API_R_FRAME_RATE if (st->r_frame_rate.den && st->r_frame_rate.num) print_fps(av_q2d(st->r_frame_rate), "tbr"); #endif if (st->time_base.den && st->time_base.num) print_fps(1 / av_q2d(st->time_base), "tbn"); if (st->codec->time_base.den && st->codec->time_base.num) print_fps(1 / av_q2d(st->codec->time_base), "tbc"); } if (st->disposition & AV_DISPOSITION_DEFAULT) av_log(NULL, AV_LOG_INFO, " (default)"); if (st->disposition & AV_DISPOSITION_DUB) av_log(NULL, AV_LOG_INFO, " (dub)"); if (st->disposition & AV_DISPOSITION_ORIGINAL) av_log(NULL, AV_LOG_INFO, " (original)"); if (st->disposition & AV_DISPOSITION_COMMENT) av_log(NULL, AV_LOG_INFO, " (comment)"); if (st->disposition & AV_DISPOSITION_LYRICS) av_log(NULL, AV_LOG_INFO, " (lyrics)"); if (st->disposition & AV_DISPOSITION_KARAOKE) av_log(NULL, AV_LOG_INFO, " (karaoke)"); if (st->disposition & AV_DISPOSITION_FORCED) av_log(NULL, AV_LOG_INFO, " (forced)"); if (st->disposition & AV_DISPOSITION_HEARING_IMPAIRED) av_log(NULL, AV_LOG_INFO, " (hearing impaired)"); if (st->disposition & AV_DISPOSITION_VISUAL_IMPAIRED) av_log(NULL, AV_LOG_INFO, " (visual impaired)"); if (st->disposition & AV_DISPOSITION_CLEAN_EFFECTS) av_log(NULL, AV_LOG_INFO, " (clean effects)"); av_log(NULL, AV_LOG_INFO, "\n"); dump_metadata(NULL, st->metadata, " "); dump_sidedata(NULL, st, " "); }
[ "static void FUNC_0(AVFormatContext *VAR_0, int VAR_1,\nint VAR_2, int VAR_3)\n{", "char VAR_4[256];", "int VAR_5 = (VAR_3 ? VAR_0->oformat->VAR_5 : VAR_0->iformat->VAR_5);", "AVStream *st = VAR_0->streams[VAR_1];", "int VAR_6 = av_gcd(st->time_base.num, st->time_base.den);", "AVDictionaryEntry *lang = av_dict_get(st->metadata, \"language\", NULL, 0);", "avcodec_string(VAR_4, sizeof(VAR_4), st->codec, VAR_3);", "av_log(NULL, AV_LOG_INFO, \" Stream #%d:%d\", VAR_2, VAR_1);", "if (VAR_5 & AVFMT_SHOW_IDS)\nav_log(NULL, AV_LOG_INFO, \"[0x%x]\", st->id);", "if (lang)\nav_log(NULL, AV_LOG_INFO, \"(%s)\", lang->value);", "av_log(NULL, AV_LOG_DEBUG, \", %d, %d/%d\", st->codec_info_nb_frames,\nst->time_base.num / VAR_6, st->time_base.den / VAR_6);", "av_log(NULL, AV_LOG_INFO, \": %s\", VAR_4);", "if (st->sample_aspect_ratio.num &&\nav_cmp_q(st->sample_aspect_ratio, st->codec->sample_aspect_ratio)) {", "AVRational display_aspect_ratio;", "av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den,\nst->codec->width * st->sample_aspect_ratio.num,\nst->codec->height * st->sample_aspect_ratio.den,\n1024 * 1024);", "av_log(NULL, AV_LOG_INFO, \", SAR %d:%d DAR %d:%d\",\nst->sample_aspect_ratio.num, st->sample_aspect_ratio.den,\ndisplay_aspect_ratio.num, display_aspect_ratio.den);", "}", "if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {", "if (st->avg_frame_rate.den && st->avg_frame_rate.num)\nprint_fps(av_q2d(st->avg_frame_rate), \"fps\");", "#if FF_API_R_FRAME_RATE\nif (st->r_frame_rate.den && st->r_frame_rate.num)\nprint_fps(av_q2d(st->r_frame_rate), \"tbr\");", "#endif\nif (st->time_base.den && st->time_base.num)\nprint_fps(1 / av_q2d(st->time_base), \"tbn\");", "if (st->codec->time_base.den && st->codec->time_base.num)\nprint_fps(1 / av_q2d(st->codec->time_base), \"tbc\");", "}", "if (st->disposition & AV_DISPOSITION_DEFAULT)\nav_log(NULL, AV_LOG_INFO, \" (default)\");", "if (st->disposition & AV_DISPOSITION_DUB)\nav_log(NULL, AV_LOG_INFO, \" (dub)\");", "if (st->disposition & AV_DISPOSITION_ORIGINAL)\nav_log(NULL, AV_LOG_INFO, \" (original)\");", "if (st->disposition & AV_DISPOSITION_COMMENT)\nav_log(NULL, AV_LOG_INFO, \" (comment)\");", "if (st->disposition & AV_DISPOSITION_LYRICS)\nav_log(NULL, AV_LOG_INFO, \" (lyrics)\");", "if (st->disposition & AV_DISPOSITION_KARAOKE)\nav_log(NULL, AV_LOG_INFO, \" (karaoke)\");", "if (st->disposition & AV_DISPOSITION_FORCED)\nav_log(NULL, AV_LOG_INFO, \" (forced)\");", "if (st->disposition & AV_DISPOSITION_HEARING_IMPAIRED)\nav_log(NULL, AV_LOG_INFO, \" (hearing impaired)\");", "if (st->disposition & AV_DISPOSITION_VISUAL_IMPAIRED)\nav_log(NULL, AV_LOG_INFO, \" (visual impaired)\");", "if (st->disposition & AV_DISPOSITION_CLEAN_EFFECTS)\nav_log(NULL, AV_LOG_INFO, \" (clean effects)\");", "av_log(NULL, AV_LOG_INFO, \"\\n\");", "dump_metadata(NULL, st->metadata, \" \");", "dump_sidedata(NULL, st, \" \");", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2, 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ], [ 8 ], [ 9 ], [ 10 ], [ 13, 14 ], [ 15, 16 ], [ 17, 18 ], [ 19 ], [ 20, 21 ], [ 22 ], [ 23, 24, 25, 26 ], [ 27, 28, 29 ], [ 30 ], [ 31 ], [ 32, 33 ], [ 34, 35, 36 ], [ 37, 38, 39 ], [ 40, 41 ], [ 42 ], [ 43, 44 ], [ 45, 46 ], [ 47, 48 ], [ 49, 50 ], [ 51, 52 ], [ 53, 54 ], [ 55, 56 ], [ 57, 58 ], [ 59, 60 ], [ 61, 62 ], [ 63 ], [ 64 ], [ 65 ], [ 66 ] ]
18,449
int rom_load_all(void) { target_phys_addr_t addr = 0; int memtype; Rom *rom; QTAILQ_FOREACH(rom, &roms, next) { if (addr < rom->min) addr = rom->min; if (rom->max) { /* load address range */ if (rom->align) { addr += (rom->align-1); addr &= ~(rom->align-1); } if (addr + rom->romsize > rom->max) { fprintf(stderr, "rom: out of memory (rom %s, " "addr 0x" TARGET_FMT_plx ", size 0x%zx, max 0x" TARGET_FMT_plx ")\n", rom->name, addr, rom->romsize, rom->max); return -1; } } else { /* fixed address requested */ if (addr != rom->min) { fprintf(stderr, "rom: requested regions overlap " "(rom %s. free=0x" TARGET_FMT_plx ", addr=0x" TARGET_FMT_plx ")\n", rom->name, addr, rom->min); return -1; } } rom->addr = addr; addr += rom->romsize; memtype = cpu_get_physical_page_desc(rom->addr) & (3 << IO_MEM_SHIFT); if (memtype == IO_MEM_ROM) rom->isrom = 1; } qemu_register_reset(rom_reset, NULL); roms_loaded = 1; return 0; }
true
qemu
15ff7705444ab9663189946d6d648431e0649df1
int rom_load_all(void) { target_phys_addr_t addr = 0; int memtype; Rom *rom; QTAILQ_FOREACH(rom, &roms, next) { if (addr < rom->min) addr = rom->min; if (rom->max) { if (rom->align) { addr += (rom->align-1); addr &= ~(rom->align-1); } if (addr + rom->romsize > rom->max) { fprintf(stderr, "rom: out of memory (rom %s, " "addr 0x" TARGET_FMT_plx ", size 0x%zx, max 0x" TARGET_FMT_plx ")\n", rom->name, addr, rom->romsize, rom->max); return -1; } } else { if (addr != rom->min) { fprintf(stderr, "rom: requested regions overlap " "(rom %s. free=0x" TARGET_FMT_plx ", addr=0x" TARGET_FMT_plx ")\n", rom->name, addr, rom->min); return -1; } } rom->addr = addr; addr += rom->romsize; memtype = cpu_get_physical_page_desc(rom->addr) & (3 << IO_MEM_SHIFT); if (memtype == IO_MEM_ROM) rom->isrom = 1; } qemu_register_reset(rom_reset, NULL); roms_loaded = 1; return 0; }
{ "code": [ " return -1;" ], "line_no": [ 41 ] }
int FUNC_0(void) { target_phys_addr_t addr = 0; int VAR_0; Rom *rom; QTAILQ_FOREACH(rom, &roms, next) { if (addr < rom->min) addr = rom->min; if (rom->max) { if (rom->align) { addr += (rom->align-1); addr &= ~(rom->align-1); } if (addr + rom->romsize > rom->max) { fprintf(stderr, "rom: out of memory (rom %s, " "addr 0x" TARGET_FMT_plx ", size 0x%zx, max 0x" TARGET_FMT_plx ")\n", rom->name, addr, rom->romsize, rom->max); return -1; } } else { if (addr != rom->min) { fprintf(stderr, "rom: requested regions overlap " "(rom %s. free=0x" TARGET_FMT_plx ", addr=0x" TARGET_FMT_plx ")\n", rom->name, addr, rom->min); return -1; } } rom->addr = addr; addr += rom->romsize; VAR_0 = cpu_get_physical_page_desc(rom->addr) & (3 << IO_MEM_SHIFT); if (VAR_0 == IO_MEM_ROM) rom->isrom = 1; } qemu_register_reset(rom_reset, NULL); roms_loaded = 1; return 0; }
[ "int FUNC_0(void)\n{", "target_phys_addr_t addr = 0;", "int VAR_0;", "Rom *rom;", "QTAILQ_FOREACH(rom, &roms, next) {", "if (addr < rom->min)\naddr = rom->min;", "if (rom->max) {", "if (rom->align) {", "addr += (rom->align-1);", "addr &= ~(rom->align-1);", "}", "if (addr + rom->romsize > rom->max) {", "fprintf(stderr, \"rom: out of memory (rom %s, \"\n\"addr 0x\" TARGET_FMT_plx\n\", size 0x%zx, max 0x\" TARGET_FMT_plx \")\\n\",\nrom->name, addr, rom->romsize, rom->max);", "return -1;", "}", "} else {", "if (addr != rom->min) {", "fprintf(stderr, \"rom: requested regions overlap \"\n\"(rom %s. free=0x\" TARGET_FMT_plx\n\", addr=0x\" TARGET_FMT_plx \")\\n\",\nrom->name, addr, rom->min);", "return -1;", "}", "}", "rom->addr = addr;", "addr += rom->romsize;", "VAR_0 = cpu_get_physical_page_desc(rom->addr) & (3 << IO_MEM_SHIFT);", "if (VAR_0 == IO_MEM_ROM)\nrom->isrom = 1;", "}", "qemu_register_reset(rom_reset, NULL);", "roms_loaded = 1;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15, 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33, 35, 37, 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51, 53, 55, 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71, 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ] ]
18,450
static uint32_t vmsvga_value_read(void *opaque, uint32_t address) { uint32_t caps; struct vmsvga_state_s *s = opaque; DisplaySurface *surface = qemu_console_surface(s->vga.con); uint32_t ret; switch (s->index) { case SVGA_REG_ID: ret = s->svgaid; break; case SVGA_REG_ENABLE: ret = s->enable; break; case SVGA_REG_WIDTH: ret = surface_width(surface); break; case SVGA_REG_HEIGHT: ret = surface_height(surface); break; case SVGA_REG_MAX_WIDTH: ret = SVGA_MAX_WIDTH; break; case SVGA_REG_MAX_HEIGHT: ret = SVGA_MAX_HEIGHT; break; case SVGA_REG_DEPTH: ret = s->depth; break; case SVGA_REG_BITS_PER_PIXEL: ret = (s->depth + 7) & ~7; break; case SVGA_REG_PSEUDOCOLOR: ret = 0x0; break; case SVGA_REG_RED_MASK: ret = surface->pf.rmask; break; case SVGA_REG_GREEN_MASK: ret = surface->pf.gmask; break; case SVGA_REG_BLUE_MASK: ret = surface->pf.bmask; break; case SVGA_REG_BYTES_PER_LINE: ret = s->bypp * s->new_width; break; case SVGA_REG_FB_START: { struct pci_vmsvga_state_s *pci_vmsvga = container_of(s, struct pci_vmsvga_state_s, chip); ret = pci_get_bar_addr(&pci_vmsvga->card, 1); break; } case SVGA_REG_FB_OFFSET: ret = 0x0; break; case SVGA_REG_VRAM_SIZE: ret = s->vga.vram_size; /* No physical VRAM besides the framebuffer */ break; case SVGA_REG_FB_SIZE: ret = s->vga.vram_size; break; case SVGA_REG_CAPABILITIES: caps = SVGA_CAP_NONE; #ifdef HW_RECT_ACCEL caps |= SVGA_CAP_RECT_COPY; #endif #ifdef HW_FILL_ACCEL caps |= SVGA_CAP_RECT_FILL; #endif #ifdef HW_MOUSE_ACCEL if (dpy_cursor_define_supported(s->vga.con)) { caps |= SVGA_CAP_CURSOR | SVGA_CAP_CURSOR_BYPASS_2 | SVGA_CAP_CURSOR_BYPASS; } #endif ret = caps; break; case SVGA_REG_MEM_START: { struct pci_vmsvga_state_s *pci_vmsvga = container_of(s, struct pci_vmsvga_state_s, chip); ret = pci_get_bar_addr(&pci_vmsvga->card, 2); break; } case SVGA_REG_MEM_SIZE: ret = s->fifo_size; break; case SVGA_REG_CONFIG_DONE: ret = s->config; break; case SVGA_REG_SYNC: case SVGA_REG_BUSY: ret = s->syncing; break; case SVGA_REG_GUEST_ID: ret = s->guest; break; case SVGA_REG_CURSOR_ID: ret = s->cursor.id; break; case SVGA_REG_CURSOR_X: ret = s->cursor.x; break; case SVGA_REG_CURSOR_Y: ret = s->cursor.x; break; case SVGA_REG_CURSOR_ON: ret = s->cursor.on; break; case SVGA_REG_HOST_BITS_PER_PIXEL: ret = (s->depth + 7) & ~7; break; case SVGA_REG_SCRATCH_SIZE: ret = s->scratch_size; break; case SVGA_REG_MEM_REGS: case SVGA_REG_NUM_DISPLAYS: case SVGA_REG_PITCHLOCK: case SVGA_PALETTE_BASE ... SVGA_PALETTE_END: ret = 0; break; default: if (s->index >= SVGA_SCRATCH_BASE && s->index < SVGA_SCRATCH_BASE + s->scratch_size) { ret = s->scratch[s->index - SVGA_SCRATCH_BASE]; break; } printf("%s: Bad register %02x\n", __func__, s->index); ret = 0; break; } if (s->index >= SVGA_SCRATCH_BASE) { trace_vmware_scratch_read(s->index, ret); } else if (s->index >= SVGA_PALETTE_BASE) { trace_vmware_palette_read(s->index, ret); } else { trace_vmware_value_read(s->index, ret); } return ret; }
true
qemu
eb2f9b024d68884a3b25e63e4dbf90b67f8da236
static uint32_t vmsvga_value_read(void *opaque, uint32_t address) { uint32_t caps; struct vmsvga_state_s *s = opaque; DisplaySurface *surface = qemu_console_surface(s->vga.con); uint32_t ret; switch (s->index) { case SVGA_REG_ID: ret = s->svgaid; break; case SVGA_REG_ENABLE: ret = s->enable; break; case SVGA_REG_WIDTH: ret = surface_width(surface); break; case SVGA_REG_HEIGHT: ret = surface_height(surface); break; case SVGA_REG_MAX_WIDTH: ret = SVGA_MAX_WIDTH; break; case SVGA_REG_MAX_HEIGHT: ret = SVGA_MAX_HEIGHT; break; case SVGA_REG_DEPTH: ret = s->depth; break; case SVGA_REG_BITS_PER_PIXEL: ret = (s->depth + 7) & ~7; break; case SVGA_REG_PSEUDOCOLOR: ret = 0x0; break; case SVGA_REG_RED_MASK: ret = surface->pf.rmask; break; case SVGA_REG_GREEN_MASK: ret = surface->pf.gmask; break; case SVGA_REG_BLUE_MASK: ret = surface->pf.bmask; break; case SVGA_REG_BYTES_PER_LINE: ret = s->bypp * s->new_width; break; case SVGA_REG_FB_START: { struct pci_vmsvga_state_s *pci_vmsvga = container_of(s, struct pci_vmsvga_state_s, chip); ret = pci_get_bar_addr(&pci_vmsvga->card, 1); break; } case SVGA_REG_FB_OFFSET: ret = 0x0; break; case SVGA_REG_VRAM_SIZE: ret = s->vga.vram_size; break; case SVGA_REG_FB_SIZE: ret = s->vga.vram_size; break; case SVGA_REG_CAPABILITIES: caps = SVGA_CAP_NONE; #ifdef HW_RECT_ACCEL caps |= SVGA_CAP_RECT_COPY; #endif #ifdef HW_FILL_ACCEL caps |= SVGA_CAP_RECT_FILL; #endif #ifdef HW_MOUSE_ACCEL if (dpy_cursor_define_supported(s->vga.con)) { caps |= SVGA_CAP_CURSOR | SVGA_CAP_CURSOR_BYPASS_2 | SVGA_CAP_CURSOR_BYPASS; } #endif ret = caps; break; case SVGA_REG_MEM_START: { struct pci_vmsvga_state_s *pci_vmsvga = container_of(s, struct pci_vmsvga_state_s, chip); ret = pci_get_bar_addr(&pci_vmsvga->card, 2); break; } case SVGA_REG_MEM_SIZE: ret = s->fifo_size; break; case SVGA_REG_CONFIG_DONE: ret = s->config; break; case SVGA_REG_SYNC: case SVGA_REG_BUSY: ret = s->syncing; break; case SVGA_REG_GUEST_ID: ret = s->guest; break; case SVGA_REG_CURSOR_ID: ret = s->cursor.id; break; case SVGA_REG_CURSOR_X: ret = s->cursor.x; break; case SVGA_REG_CURSOR_Y: ret = s->cursor.x; break; case SVGA_REG_CURSOR_ON: ret = s->cursor.on; break; case SVGA_REG_HOST_BITS_PER_PIXEL: ret = (s->depth + 7) & ~7; break; case SVGA_REG_SCRATCH_SIZE: ret = s->scratch_size; break; case SVGA_REG_MEM_REGS: case SVGA_REG_NUM_DISPLAYS: case SVGA_REG_PITCHLOCK: case SVGA_PALETTE_BASE ... SVGA_PALETTE_END: ret = 0; break; default: if (s->index >= SVGA_SCRATCH_BASE && s->index < SVGA_SCRATCH_BASE + s->scratch_size) { ret = s->scratch[s->index - SVGA_SCRATCH_BASE]; break; } printf("%s: Bad register %02x\n", __func__, s->index); ret = 0; break; } if (s->index >= SVGA_SCRATCH_BASE) { trace_vmware_scratch_read(s->index, ret); } else if (s->index >= SVGA_PALETTE_BASE) { trace_vmware_palette_read(s->index, ret); } else { trace_vmware_value_read(s->index, ret); } return ret; }
{ "code": [ " ret = surface_width(surface);", " ret = surface_height(surface);", " ret = s->depth;", " ret = (s->depth + 7) & ~7;", " ret = surface->pf.rmask;", " ret = surface->pf.gmask;", " ret = surface->pf.bmask;", " ret = s->bypp * s->new_width;", " case SVGA_REG_HOST_BITS_PER_PIXEL:", " ret = (s->depth + 7) & ~7;", " break;" ], "line_no": [ 35, 43, 67, 75, 91, 99, 107, 115, 273, 75, 21 ] }
static uint32_t FUNC_0(void *opaque, uint32_t address) { uint32_t caps; struct vmsvga_state_s *VAR_0 = opaque; DisplaySurface *surface = qemu_console_surface(VAR_0->vga.con); uint32_t ret; switch (VAR_0->index) { case SVGA_REG_ID: ret = VAR_0->svgaid; break; case SVGA_REG_ENABLE: ret = VAR_0->enable; break; case SVGA_REG_WIDTH: ret = surface_width(surface); break; case SVGA_REG_HEIGHT: ret = surface_height(surface); break; case SVGA_REG_MAX_WIDTH: ret = SVGA_MAX_WIDTH; break; case SVGA_REG_MAX_HEIGHT: ret = SVGA_MAX_HEIGHT; break; case SVGA_REG_DEPTH: ret = VAR_0->depth; break; case SVGA_REG_BITS_PER_PIXEL: ret = (VAR_0->depth + 7) & ~7; break; case SVGA_REG_PSEUDOCOLOR: ret = 0x0; break; case SVGA_REG_RED_MASK: ret = surface->pf.rmask; break; case SVGA_REG_GREEN_MASK: ret = surface->pf.gmask; break; case SVGA_REG_BLUE_MASK: ret = surface->pf.bmask; break; case SVGA_REG_BYTES_PER_LINE: ret = VAR_0->bypp * VAR_0->new_width; break; case SVGA_REG_FB_START: { struct pci_vmsvga_state_s *VAR_2 = container_of(VAR_0, struct pci_vmsvga_state_s, chip); ret = pci_get_bar_addr(&VAR_2->card, 1); break; } case SVGA_REG_FB_OFFSET: ret = 0x0; break; case SVGA_REG_VRAM_SIZE: ret = VAR_0->vga.vram_size; break; case SVGA_REG_FB_SIZE: ret = VAR_0->vga.vram_size; break; case SVGA_REG_CAPABILITIES: caps = SVGA_CAP_NONE; #ifdef HW_RECT_ACCEL caps |= SVGA_CAP_RECT_COPY; #endif #ifdef HW_FILL_ACCEL caps |= SVGA_CAP_RECT_FILL; #endif #ifdef HW_MOUSE_ACCEL if (dpy_cursor_define_supported(VAR_0->vga.con)) { caps |= SVGA_CAP_CURSOR | SVGA_CAP_CURSOR_BYPASS_2 | SVGA_CAP_CURSOR_BYPASS; } #endif ret = caps; break; case SVGA_REG_MEM_START: { struct pci_vmsvga_state_s *VAR_2 = container_of(VAR_0, struct pci_vmsvga_state_s, chip); ret = pci_get_bar_addr(&VAR_2->card, 2); break; } case SVGA_REG_MEM_SIZE: ret = VAR_0->fifo_size; break; case SVGA_REG_CONFIG_DONE: ret = VAR_0->config; break; case SVGA_REG_SYNC: case SVGA_REG_BUSY: ret = VAR_0->syncing; break; case SVGA_REG_GUEST_ID: ret = VAR_0->guest; break; case SVGA_REG_CURSOR_ID: ret = VAR_0->cursor.id; break; case SVGA_REG_CURSOR_X: ret = VAR_0->cursor.x; break; case SVGA_REG_CURSOR_Y: ret = VAR_0->cursor.x; break; case SVGA_REG_CURSOR_ON: ret = VAR_0->cursor.on; break; case SVGA_REG_HOST_BITS_PER_PIXEL: ret = (VAR_0->depth + 7) & ~7; break; case SVGA_REG_SCRATCH_SIZE: ret = VAR_0->scratch_size; break; case SVGA_REG_MEM_REGS: case SVGA_REG_NUM_DISPLAYS: case SVGA_REG_PITCHLOCK: case SVGA_PALETTE_BASE ... SVGA_PALETTE_END: ret = 0; break; default: if (VAR_0->index >= SVGA_SCRATCH_BASE && VAR_0->index < SVGA_SCRATCH_BASE + VAR_0->scratch_size) { ret = VAR_0->scratch[VAR_0->index - SVGA_SCRATCH_BASE]; break; } printf("%VAR_0: Bad register %02x\n", __func__, VAR_0->index); ret = 0; break; } if (VAR_0->index >= SVGA_SCRATCH_BASE) { trace_vmware_scratch_read(VAR_0->index, ret); } else if (VAR_0->index >= SVGA_PALETTE_BASE) { trace_vmware_palette_read(VAR_0->index, ret); } else { trace_vmware_value_read(VAR_0->index, ret); } return ret; }
[ "static uint32_t FUNC_0(void *opaque, uint32_t address)\n{", "uint32_t caps;", "struct vmsvga_state_s *VAR_0 = opaque;", "DisplaySurface *surface = qemu_console_surface(VAR_0->vga.con);", "uint32_t ret;", "switch (VAR_0->index) {", "case SVGA_REG_ID:\nret = VAR_0->svgaid;", "break;", "case SVGA_REG_ENABLE:\nret = VAR_0->enable;", "break;", "case SVGA_REG_WIDTH:\nret = surface_width(surface);", "break;", "case SVGA_REG_HEIGHT:\nret = surface_height(surface);", "break;", "case SVGA_REG_MAX_WIDTH:\nret = SVGA_MAX_WIDTH;", "break;", "case SVGA_REG_MAX_HEIGHT:\nret = SVGA_MAX_HEIGHT;", "break;", "case SVGA_REG_DEPTH:\nret = VAR_0->depth;", "break;", "case SVGA_REG_BITS_PER_PIXEL:\nret = (VAR_0->depth + 7) & ~7;", "break;", "case SVGA_REG_PSEUDOCOLOR:\nret = 0x0;", "break;", "case SVGA_REG_RED_MASK:\nret = surface->pf.rmask;", "break;", "case SVGA_REG_GREEN_MASK:\nret = surface->pf.gmask;", "break;", "case SVGA_REG_BLUE_MASK:\nret = surface->pf.bmask;", "break;", "case SVGA_REG_BYTES_PER_LINE:\nret = VAR_0->bypp * VAR_0->new_width;", "break;", "case SVGA_REG_FB_START: {", "struct pci_vmsvga_state_s *VAR_2\n= container_of(VAR_0, struct pci_vmsvga_state_s, chip);", "ret = pci_get_bar_addr(&VAR_2->card, 1);", "break;", "}", "case SVGA_REG_FB_OFFSET:\nret = 0x0;", "break;", "case SVGA_REG_VRAM_SIZE:\nret = VAR_0->vga.vram_size;", "break;", "case SVGA_REG_FB_SIZE:\nret = VAR_0->vga.vram_size;", "break;", "case SVGA_REG_CAPABILITIES:\ncaps = SVGA_CAP_NONE;", "#ifdef HW_RECT_ACCEL\ncaps |= SVGA_CAP_RECT_COPY;", "#endif\n#ifdef HW_FILL_ACCEL\ncaps |= SVGA_CAP_RECT_FILL;", "#endif\n#ifdef HW_MOUSE_ACCEL\nif (dpy_cursor_define_supported(VAR_0->vga.con)) {", "caps |= SVGA_CAP_CURSOR | SVGA_CAP_CURSOR_BYPASS_2 |\nSVGA_CAP_CURSOR_BYPASS;", "}", "#endif\nret = caps;", "break;", "case SVGA_REG_MEM_START: {", "struct pci_vmsvga_state_s *VAR_2\n= container_of(VAR_0, struct pci_vmsvga_state_s, chip);", "ret = pci_get_bar_addr(&VAR_2->card, 2);", "break;", "}", "case SVGA_REG_MEM_SIZE:\nret = VAR_0->fifo_size;", "break;", "case SVGA_REG_CONFIG_DONE:\nret = VAR_0->config;", "break;", "case SVGA_REG_SYNC:\ncase SVGA_REG_BUSY:\nret = VAR_0->syncing;", "break;", "case SVGA_REG_GUEST_ID:\nret = VAR_0->guest;", "break;", "case SVGA_REG_CURSOR_ID:\nret = VAR_0->cursor.id;", "break;", "case SVGA_REG_CURSOR_X:\nret = VAR_0->cursor.x;", "break;", "case SVGA_REG_CURSOR_Y:\nret = VAR_0->cursor.x;", "break;", "case SVGA_REG_CURSOR_ON:\nret = VAR_0->cursor.on;", "break;", "case SVGA_REG_HOST_BITS_PER_PIXEL:\nret = (VAR_0->depth + 7) & ~7;", "break;", "case SVGA_REG_SCRATCH_SIZE:\nret = VAR_0->scratch_size;", "break;", "case SVGA_REG_MEM_REGS:\ncase SVGA_REG_NUM_DISPLAYS:\ncase SVGA_REG_PITCHLOCK:\ncase SVGA_PALETTE_BASE ... SVGA_PALETTE_END:\nret = 0;", "break;", "default:\nif (VAR_0->index >= SVGA_SCRATCH_BASE &&\nVAR_0->index < SVGA_SCRATCH_BASE + VAR_0->scratch_size) {", "ret = VAR_0->scratch[VAR_0->index - SVGA_SCRATCH_BASE];", "break;", "}", "printf(\"%VAR_0: Bad register %02x\\n\", __func__, VAR_0->index);", "ret = 0;", "break;", "}", "if (VAR_0->index >= SVGA_SCRATCH_BASE) {", "trace_vmware_scratch_read(VAR_0->index, ret);", "} else if (VAR_0->index >= SVGA_PALETTE_BASE) {", "trace_vmware_palette_read(VAR_0->index, ret);", "} else {", "trace_vmware_value_read(VAR_0->index, ret);", "}", "return ret;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17, 19 ], [ 21 ], [ 25, 27 ], [ 29 ], [ 33, 35 ], [ 37 ], [ 41, 43 ], [ 45 ], [ 49, 51 ], [ 53 ], [ 57, 59 ], [ 61 ], [ 65, 67 ], [ 69 ], [ 73, 75 ], [ 77 ], [ 81, 83 ], [ 85 ], [ 89, 91 ], [ 93 ], [ 97, 99 ], [ 101 ], [ 105, 107 ], [ 109 ], [ 113, 115 ], [ 117 ], [ 121 ], [ 123, 125 ], [ 127 ], [ 129 ], [ 131 ], [ 135, 137 ], [ 139 ], [ 143, 145 ], [ 147 ], [ 151, 153 ], [ 155 ], [ 159, 161 ], [ 163, 165 ], [ 167, 169, 171 ], [ 173, 175, 177 ], [ 179, 181 ], [ 183 ], [ 185, 187 ], [ 189 ], [ 193 ], [ 195, 197 ], [ 199 ], [ 201 ], [ 203 ], [ 207, 209 ], [ 211 ], [ 215, 217 ], [ 219 ], [ 223, 225, 227 ], [ 229 ], [ 233, 235 ], [ 237 ], [ 241, 243 ], [ 245 ], [ 249, 251 ], [ 253 ], [ 257, 259 ], [ 261 ], [ 265, 267 ], [ 269 ], [ 273, 275 ], [ 277 ], [ 281, 283 ], [ 285 ], [ 289, 291, 293, 295, 297 ], [ 299 ], [ 303, 305, 307 ], [ 309 ], [ 311 ], [ 313 ], [ 315 ], [ 317 ], [ 319 ], [ 321 ], [ 325 ], [ 327 ], [ 329 ], [ 331 ], [ 333 ], [ 335 ], [ 337 ], [ 339 ], [ 341 ] ]
18,452
static uint32_t pxa2xx_gpio_read(void *opaque, target_phys_addr_t offset) { struct pxa2xx_gpio_info_s *s = (struct pxa2xx_gpio_info_s *) opaque; uint32_t ret; int bank; offset -= s->base; if (offset >= 0x200) return 0; bank = pxa2xx_gpio_regs[offset].bank; switch (pxa2xx_gpio_regs[offset].reg) { case GPDR: /* GPIO Pin-Direction registers */ return s->dir[bank]; case GRER: /* GPIO Rising-Edge Detect Enable registers */ return s->rising[bank]; case GFER: /* GPIO Falling-Edge Detect Enable registers */ return s->falling[bank]; case GAFR_L: /* GPIO Alternate Function registers */ return s->gafr[bank * 2]; case GAFR_U: /* GPIO Alternate Function registers */ return s->gafr[bank * 2 + 1]; case GPLR: /* GPIO Pin-Level registers */ ret = (s->olevel[bank] & s->dir[bank]) | (s->ilevel[bank] & ~s->dir[bank]); if (s->read_notify) s->read_notify(s->opaque); return ret; case GEDR: /* GPIO Edge Detect Status registers */ return s->status[bank]; default: cpu_abort(cpu_single_env, "%s: Bad offset " REG_FMT "\n", __FUNCTION__, offset); } return 0; }
true
qemu
2b76bdc965ba7b4f27133cb345101d9535ddaa79
static uint32_t pxa2xx_gpio_read(void *opaque, target_phys_addr_t offset) { struct pxa2xx_gpio_info_s *s = (struct pxa2xx_gpio_info_s *) opaque; uint32_t ret; int bank; offset -= s->base; if (offset >= 0x200) return 0; bank = pxa2xx_gpio_regs[offset].bank; switch (pxa2xx_gpio_regs[offset].reg) { case GPDR: return s->dir[bank]; case GRER: return s->rising[bank]; case GFER: return s->falling[bank]; case GAFR_L: return s->gafr[bank * 2]; case GAFR_U: return s->gafr[bank * 2 + 1]; case GPLR: ret = (s->olevel[bank] & s->dir[bank]) | (s->ilevel[bank] & ~s->dir[bank]); if (s->read_notify) s->read_notify(s->opaque); return ret; case GEDR: return s->status[bank]; default: cpu_abort(cpu_single_env, "%s: Bad offset " REG_FMT "\n", __FUNCTION__, offset); } return 0; }
{ "code": [], "line_no": [] }
static uint32_t FUNC_0(void *opaque, target_phys_addr_t offset) { struct pxa2xx_gpio_info_s *VAR_0 = (struct pxa2xx_gpio_info_s *) opaque; uint32_t ret; int VAR_1; offset -= VAR_0->base; if (offset >= 0x200) return 0; VAR_1 = pxa2xx_gpio_regs[offset].VAR_1; switch (pxa2xx_gpio_regs[offset].reg) { case GPDR: return VAR_0->dir[VAR_1]; case GRER: return VAR_0->rising[VAR_1]; case GFER: return VAR_0->falling[VAR_1]; case GAFR_L: return VAR_0->gafr[VAR_1 * 2]; case GAFR_U: return VAR_0->gafr[VAR_1 * 2 + 1]; case GPLR: ret = (VAR_0->olevel[VAR_1] & VAR_0->dir[VAR_1]) | (VAR_0->ilevel[VAR_1] & ~VAR_0->dir[VAR_1]); if (VAR_0->read_notify) VAR_0->read_notify(VAR_0->opaque); return ret; case GEDR: return VAR_0->status[VAR_1]; default: cpu_abort(cpu_single_env, "%VAR_0: Bad offset " REG_FMT "\n", __FUNCTION__, offset); } return 0; }
[ "static uint32_t FUNC_0(void *opaque, target_phys_addr_t offset)\n{", "struct pxa2xx_gpio_info_s *VAR_0 = (struct pxa2xx_gpio_info_s *) opaque;", "uint32_t ret;", "int VAR_1;", "offset -= VAR_0->base;", "if (offset >= 0x200)\nreturn 0;", "VAR_1 = pxa2xx_gpio_regs[offset].VAR_1;", "switch (pxa2xx_gpio_regs[offset].reg) {", "case GPDR:\nreturn VAR_0->dir[VAR_1];", "case GRER:\nreturn VAR_0->rising[VAR_1];", "case GFER:\nreturn VAR_0->falling[VAR_1];", "case GAFR_L:\nreturn VAR_0->gafr[VAR_1 * 2];", "case GAFR_U:\nreturn VAR_0->gafr[VAR_1 * 2 + 1];", "case GPLR:\nret = (VAR_0->olevel[VAR_1] & VAR_0->dir[VAR_1]) |\n(VAR_0->ilevel[VAR_1] & ~VAR_0->dir[VAR_1]);", "if (VAR_0->read_notify)\nVAR_0->read_notify(VAR_0->opaque);", "return ret;", "case GEDR:\nreturn VAR_0->status[VAR_1];", "default:\ncpu_abort(cpu_single_env,\n\"%VAR_0: Bad offset \" REG_FMT \"\\n\", __FUNCTION__, offset);", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2 ], [ 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7, 8 ], [ 9 ], [ 10 ], [ 11, 12 ], [ 13, 14 ], [ 15, 16 ], [ 17, 18 ], [ 19, 20 ], [ 21, 22, 23 ], [ 24, 25 ], [ 26 ], [ 27, 28 ], [ 29, 30, 31 ], [ 32 ], [ 33 ], [ 34 ] ]
18,453
void rgb24tobgr32(const uint8_t *src, uint8_t *dst, unsigned int src_size) { unsigned i; for(i=0; 3*i<src_size; i++) { dst[4*i + 0] = src[3*i + 2]; dst[4*i + 1] = src[3*i + 1]; dst[4*i + 2] = src[3*i + 0]; dst[4*i + 3] = 0; } }
true
FFmpeg
7f526efd17973ec6d2204f7a47b6923e2be31363
void rgb24tobgr32(const uint8_t *src, uint8_t *dst, unsigned int src_size) { unsigned i; for(i=0; 3*i<src_size; i++) { dst[4*i + 0] = src[3*i + 2]; dst[4*i + 1] = src[3*i + 1]; dst[4*i + 2] = src[3*i + 0]; dst[4*i + 3] = 0; } }
{ "code": [ "\tunsigned i;", "\tunsigned i;", "\tunsigned i;", "\tunsigned i;", "\tunsigned i;", "\tunsigned i;", "\tunsigned i;", "\tunsigned i;", "\tunsigned i;", "void rgb24tobgr32(const uint8_t *src, uint8_t *dst, unsigned int src_size)", "\tunsigned i;", "\tunsigned i;", "\tunsigned i;", "\tunsigned i;", "\tunsigned i;", "\tunsigned i;" ], "line_no": [ 5, 5, 5, 5, 5, 5, 5, 5, 5, 1, 5, 5, 5, 5, 5, 5 ] }
void FUNC_0(const uint8_t *VAR_0, uint8_t *VAR_1, unsigned int VAR_2) { unsigned VAR_3; for(VAR_3=0; 3*VAR_3<VAR_2; VAR_3++) { VAR_1[4*VAR_3 + 0] = VAR_0[3*VAR_3 + 2]; VAR_1[4*VAR_3 + 1] = VAR_0[3*VAR_3 + 1]; VAR_1[4*VAR_3 + 2] = VAR_0[3*VAR_3 + 0]; VAR_1[4*VAR_3 + 3] = 0; } }
[ "void FUNC_0(const uint8_t *VAR_0, uint8_t *VAR_1, unsigned int VAR_2)\n{", "unsigned VAR_3;", "for(VAR_3=0; 3*VAR_3<VAR_2; VAR_3++)", "{", "VAR_1[4*VAR_3 + 0] = VAR_0[3*VAR_3 + 2];", "VAR_1[4*VAR_3 + 1] = VAR_0[3*VAR_3 + 1];", "VAR_1[4*VAR_3 + 2] = VAR_0[3*VAR_3 + 0];", "VAR_1[4*VAR_3 + 3] = 0;", "}", "}" ]
[ 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
18,454
int qcrypto_init(Error **errp) { #ifdef CONFIG_GNUTLS int ret; ret = gnutls_global_init(); if (ret < 0) { error_setg(errp, "Unable to initialize GNUTLS library: %s", gnutls_strerror(ret)); return -1; } #ifdef DEBUG_GNUTLS gnutls_global_set_log_level(10); gnutls_global_set_log_function(qcrypto_gnutls_log); #endif #endif #ifdef CONFIG_GCRYPT if (!gcry_check_version(GCRYPT_VERSION)) { error_setg(errp, "Unable to initialize gcrypt"); return -1; } #ifdef QCRYPTO_INIT_GCRYPT_THREADS gcry_control(GCRYCTL_SET_THREAD_CBS, &qcrypto_gcrypt_thread_impl); #endif /* QCRYPTO_INIT_GCRYPT_THREADS */ gcry_control(GCRYCTL_INITIALIZATION_FINISHED, 0); #endif return 0; }
true
qemu
373166636b9f07c60d7c32610bd346acf7d143e9
int qcrypto_init(Error **errp) { #ifdef CONFIG_GNUTLS int ret; ret = gnutls_global_init(); if (ret < 0) { error_setg(errp, "Unable to initialize GNUTLS library: %s", gnutls_strerror(ret)); return -1; } #ifdef DEBUG_GNUTLS gnutls_global_set_log_level(10); gnutls_global_set_log_function(qcrypto_gnutls_log); #endif #endif #ifdef CONFIG_GCRYPT if (!gcry_check_version(GCRYPT_VERSION)) { error_setg(errp, "Unable to initialize gcrypt"); return -1; } #ifdef QCRYPTO_INIT_GCRYPT_THREADS gcry_control(GCRYCTL_SET_THREAD_CBS, &qcrypto_gcrypt_thread_impl); #endif gcry_control(GCRYCTL_INITIALIZATION_FINISHED, 0); #endif return 0; }
{ "code": [ "#ifdef QCRYPTO_INIT_GCRYPT_THREADS", " gcry_control(GCRYCTL_SET_THREAD_CBS, &qcrypto_gcrypt_thread_impl);" ], "line_no": [ 45, 47 ] }
int FUNC_0(Error **VAR_0) { #ifdef CONFIG_GNUTLS int ret; ret = gnutls_global_init(); if (ret < 0) { error_setg(VAR_0, "Unable to initialize GNUTLS library: %s", gnutls_strerror(ret)); return -1; } #ifdef DEBUG_GNUTLS gnutls_global_set_log_level(10); gnutls_global_set_log_function(qcrypto_gnutls_log); #endif #endif #ifdef CONFIG_GCRYPT if (!gcry_check_version(GCRYPT_VERSION)) { error_setg(VAR_0, "Unable to initialize gcrypt"); return -1; } #ifdef QCRYPTO_INIT_GCRYPT_THREADS gcry_control(GCRYCTL_SET_THREAD_CBS, &qcrypto_gcrypt_thread_impl); #endif gcry_control(GCRYCTL_INITIALIZATION_FINISHED, 0); #endif return 0; }
[ "int FUNC_0(Error **VAR_0)\n{", "#ifdef CONFIG_GNUTLS\nint ret;", "ret = gnutls_global_init();", "if (ret < 0) {", "error_setg(VAR_0,\n\"Unable to initialize GNUTLS library: %s\",\ngnutls_strerror(ret));", "return -1;", "}", "#ifdef DEBUG_GNUTLS\ngnutls_global_set_log_level(10);", "gnutls_global_set_log_function(qcrypto_gnutls_log);", "#endif\n#endif\n#ifdef CONFIG_GCRYPT\nif (!gcry_check_version(GCRYPT_VERSION)) {", "error_setg(VAR_0, \"Unable to initialize gcrypt\");", "return -1;", "}", "#ifdef QCRYPTO_INIT_GCRYPT_THREADS\ngcry_control(GCRYCTL_SET_THREAD_CBS, &qcrypto_gcrypt_thread_impl);", "#endif\ngcry_control(GCRYCTL_INITIALIZATION_FINISHED, 0);", "#endif\nreturn 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9 ], [ 11 ], [ 13, 15, 17 ], [ 19 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 29, 31, 35, 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45, 47 ], [ 49, 51 ], [ 53, 57 ], [ 59 ] ]
18,455
libAVFilter_QueryVendorInfo(libAVFilter *this, wchar_t **info) { dshowdebug("libAVFilter_QueryVendorInfo(%p)\n", this); if (!info) return E_POINTER; *info = wcsdup(L"libAV"); return S_OK; }
true
FFmpeg
18ce63a60e1bffc35b4df5d8a4f9a1ff1a96cb9a
libAVFilter_QueryVendorInfo(libAVFilter *this, wchar_t **info) { dshowdebug("libAVFilter_QueryVendorInfo(%p)\n", this); if (!info) return E_POINTER; *info = wcsdup(L"libAV"); return S_OK; }
{ "code": [ " *info = wcsdup(L\"libAV\");", " return S_OK;" ], "line_no": [ 13, 17 ] }
FUNC_0(libAVFilter *VAR_0, wchar_t **VAR_1) { dshowdebug("FUNC_0(%p)\n", VAR_0); if (!VAR_1) return E_POINTER; *VAR_1 = wcsdup(L"libAV"); return S_OK; }
[ "FUNC_0(libAVFilter *VAR_0, wchar_t **VAR_1)\n{", "dshowdebug(\"FUNC_0(%p)\\n\", VAR_0);", "if (!VAR_1)\nreturn E_POINTER;", "*VAR_1 = wcsdup(L\"libAV\");", "return S_OK;", "}" ]
[ 0, 0, 0, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11 ], [ 13 ], [ 17 ], [ 19 ] ]
18,456
static int compute_mb_distortion(CinepakEncContext *s, AVPicture *a, AVPicture *b) { int x, y, p, d, ret = 0; for(y = 0; y < MB_SIZE; y++) { for(x = 0; x < MB_SIZE; x++) { d = a->data[0][x + y*a->linesize[0]] - b->data[0][x + y*b->linesize[0]]; ret += d*d; } } if(s->pix_fmt == AV_PIX_FMT_YUV420P) { for(p = 1; p <= 2; p++) { for(y = 0; y < MB_SIZE/2; y++) { for(x = 0; x < MB_SIZE/2; x++) { d = a->data[p][x + y*a->linesize[p]] - b->data[p][x + y*b->linesize[p]]; ret += d*d; } } } } return ret; }
true
FFmpeg
7da9f4523159670d577a2808d4481e64008a8894
static int compute_mb_distortion(CinepakEncContext *s, AVPicture *a, AVPicture *b) { int x, y, p, d, ret = 0; for(y = 0; y < MB_SIZE; y++) { for(x = 0; x < MB_SIZE; x++) { d = a->data[0][x + y*a->linesize[0]] - b->data[0][x + y*b->linesize[0]]; ret += d*d; } } if(s->pix_fmt == AV_PIX_FMT_YUV420P) { for(p = 1; p <= 2; p++) { for(y = 0; y < MB_SIZE/2; y++) { for(x = 0; x < MB_SIZE/2; x++) { d = a->data[p][x + y*a->linesize[p]] - b->data[p][x + y*b->linesize[p]]; ret += d*d; } } } } return ret; }
{ "code": [ " if(s->pix_fmt == AV_PIX_FMT_YUV420P) {", " if(s->pix_fmt == AV_PIX_FMT_YUV420P) {", " if(s->pix_fmt == AV_PIX_FMT_YUV420P) {", " if(s->pix_fmt == AV_PIX_FMT_YUV420P) {", " return ret;" ], "line_no": [ 23, 23, 23, 23, 45 ] }
static int FUNC_0(CinepakEncContext *VAR_0, AVPicture *VAR_1, AVPicture *VAR_2) { int VAR_3, VAR_4, VAR_5, VAR_6, VAR_7 = 0; for(VAR_4 = 0; VAR_4 < MB_SIZE; VAR_4++) { for(VAR_3 = 0; VAR_3 < MB_SIZE; VAR_3++) { VAR_6 = VAR_1->data[0][VAR_3 + VAR_4*VAR_1->linesize[0]] - VAR_2->data[0][VAR_3 + VAR_4*VAR_2->linesize[0]]; VAR_7 += VAR_6*VAR_6; } } if(VAR_0->pix_fmt == AV_PIX_FMT_YUV420P) { for(VAR_5 = 1; VAR_5 <= 2; VAR_5++) { for(VAR_4 = 0; VAR_4 < MB_SIZE/2; VAR_4++) { for(VAR_3 = 0; VAR_3 < MB_SIZE/2; VAR_3++) { VAR_6 = VAR_1->data[VAR_5][VAR_3 + VAR_4*VAR_1->linesize[VAR_5]] - VAR_2->data[VAR_5][VAR_3 + VAR_4*VAR_2->linesize[VAR_5]]; VAR_7 += VAR_6*VAR_6; } } } } return VAR_7; }
[ "static int FUNC_0(CinepakEncContext *VAR_0, AVPicture *VAR_1, AVPicture *VAR_2)\n{", "int VAR_3, VAR_4, VAR_5, VAR_6, VAR_7 = 0;", "for(VAR_4 = 0; VAR_4 < MB_SIZE; VAR_4++) {", "for(VAR_3 = 0; VAR_3 < MB_SIZE; VAR_3++) {", "VAR_6 = VAR_1->data[0][VAR_3 + VAR_4*VAR_1->linesize[0]] - VAR_2->data[0][VAR_3 + VAR_4*VAR_2->linesize[0]];", "VAR_7 += VAR_6*VAR_6;", "}", "}", "if(VAR_0->pix_fmt == AV_PIX_FMT_YUV420P) {", "for(VAR_5 = 1; VAR_5 <= 2; VAR_5++) {", "for(VAR_4 = 0; VAR_4 < MB_SIZE/2; VAR_4++) {", "for(VAR_3 = 0; VAR_3 < MB_SIZE/2; VAR_3++) {", "VAR_6 = VAR_1->data[VAR_5][VAR_3 + VAR_4*VAR_1->linesize[VAR_5]] - VAR_2->data[VAR_5][VAR_3 + VAR_4*VAR_2->linesize[VAR_5]];", "VAR_7 += VAR_6*VAR_6;", "}", "}", "}", "}", "return VAR_7;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ] ]
18,458
static VirtIOSerialBus *virtser_bus_new(DeviceState *dev) { VirtIOSerialBus *bus; bus = FROM_QBUS(VirtIOSerialBus, qbus_create(&virtser_bus_info, dev, NULL)); bus->qbus.allow_hotplug = 1; return bus; }
true
qemu
5e52e5f903b2648c59030637e1610b32e965d615
static VirtIOSerialBus *virtser_bus_new(DeviceState *dev) { VirtIOSerialBus *bus; bus = FROM_QBUS(VirtIOSerialBus, qbus_create(&virtser_bus_info, dev, NULL)); bus->qbus.allow_hotplug = 1; return bus; }
{ "code": [ " VirtIOSerialBus *bus;", "static VirtIOSerialBus *virtser_bus_new(DeviceState *dev)", " VirtIOSerialBus *bus;", " bus = FROM_QBUS(VirtIOSerialBus, qbus_create(&virtser_bus_info, dev, NULL));", " bus->qbus.allow_hotplug = 1;", " return bus;" ], "line_no": [ 5, 1, 5, 9, 11, 15 ] }
static VirtIOSerialBus *FUNC_0(DeviceState *dev) { VirtIOSerialBus *bus; bus = FROM_QBUS(VirtIOSerialBus, qbus_create(&virtser_bus_info, dev, NULL)); bus->qbus.allow_hotplug = 1; return bus; }
[ "static VirtIOSerialBus *FUNC_0(DeviceState *dev)\n{", "VirtIOSerialBus *bus;", "bus = FROM_QBUS(VirtIOSerialBus, qbus_create(&virtser_bus_info, dev, NULL));", "bus->qbus.allow_hotplug = 1;", "return bus;", "}" ]
[ 1, 1, 1, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ] ]
18,459
static int vp8_decode_mb_row_sliced(AVCodecContext *avctx, void *tdata, int jobnr, int threadnr) { VP8Context *s = avctx->priv_data; VP8ThreadData *td = &s->thread_data[jobnr]; VP8ThreadData *next_td = NULL, *prev_td = NULL; VP8Frame *curframe = s->curframe; int mb_y, num_jobs = s->num_jobs; td->thread_nr = threadnr; for (mb_y = jobnr; mb_y < s->mb_height; mb_y += num_jobs) { if (mb_y >= s->mb_height) break; td->thread_mb_pos = mb_y << 16; vp8_decode_mb_row_no_filter(avctx, tdata, jobnr, threadnr); if (s->deblock_filter) vp8_filter_mb_row(avctx, tdata, jobnr, threadnr); update_pos(td, mb_y, INT_MAX & 0xFFFF); s->mv_min.y -= 64; s->mv_max.y -= 64; if (avctx->active_thread_type == FF_THREAD_FRAME) ff_thread_report_progress(&curframe->tf, mb_y, 0); } return 0; }
true
FFmpeg
ac4b32df71bd932838043a4838b86d11e169707f
static int vp8_decode_mb_row_sliced(AVCodecContext *avctx, void *tdata, int jobnr, int threadnr) { VP8Context *s = avctx->priv_data; VP8ThreadData *td = &s->thread_data[jobnr]; VP8ThreadData *next_td = NULL, *prev_td = NULL; VP8Frame *curframe = s->curframe; int mb_y, num_jobs = s->num_jobs; td->thread_nr = threadnr; for (mb_y = jobnr; mb_y < s->mb_height; mb_y += num_jobs) { if (mb_y >= s->mb_height) break; td->thread_mb_pos = mb_y << 16; vp8_decode_mb_row_no_filter(avctx, tdata, jobnr, threadnr); if (s->deblock_filter) vp8_filter_mb_row(avctx, tdata, jobnr, threadnr); update_pos(td, mb_y, INT_MAX & 0xFFFF); s->mv_min.y -= 64; s->mv_max.y -= 64; if (avctx->active_thread_type == FF_THREAD_FRAME) ff_thread_report_progress(&curframe->tf, mb_y, 0); } return 0; }
{ "code": [ "static int vp8_decode_mb_row_sliced(AVCodecContext *avctx, void *tdata,", " int jobnr, int threadnr)", " vp8_decode_mb_row_no_filter(avctx, tdata, jobnr, threadnr);", " vp8_filter_mb_row(avctx, tdata, jobnr, threadnr);", " break;" ], "line_no": [ 1, 3, 29, 33, 25 ] }
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int VAR_2, int VAR_3) { VP8Context *s = VAR_0->priv_data; VP8ThreadData *td = &s->thread_data[VAR_2]; VP8ThreadData *next_td = NULL, *prev_td = NULL; VP8Frame *curframe = s->curframe; int VAR_4, VAR_5 = s->VAR_5; td->thread_nr = VAR_3; for (VAR_4 = VAR_2; VAR_4 < s->mb_height; VAR_4 += VAR_5) { if (VAR_4 >= s->mb_height) break; td->thread_mb_pos = VAR_4 << 16; vp8_decode_mb_row_no_filter(VAR_0, VAR_1, VAR_2, VAR_3); if (s->deblock_filter) vp8_filter_mb_row(VAR_0, VAR_1, VAR_2, VAR_3); update_pos(td, VAR_4, INT_MAX & 0xFFFF); s->mv_min.y -= 64; s->mv_max.y -= 64; if (VAR_0->active_thread_type == FF_THREAD_FRAME) ff_thread_report_progress(&curframe->tf, VAR_4, 0); } return 0; }
[ "static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1,\nint VAR_2, int VAR_3)\n{", "VP8Context *s = VAR_0->priv_data;", "VP8ThreadData *td = &s->thread_data[VAR_2];", "VP8ThreadData *next_td = NULL, *prev_td = NULL;", "VP8Frame *curframe = s->curframe;", "int VAR_4, VAR_5 = s->VAR_5;", "td->thread_nr = VAR_3;", "for (VAR_4 = VAR_2; VAR_4 < s->mb_height; VAR_4 += VAR_5) {", "if (VAR_4 >= s->mb_height)\nbreak;", "td->thread_mb_pos = VAR_4 << 16;", "vp8_decode_mb_row_no_filter(VAR_0, VAR_1, VAR_2, VAR_3);", "if (s->deblock_filter)\nvp8_filter_mb_row(VAR_0, VAR_1, VAR_2, VAR_3);", "update_pos(td, VAR_4, INT_MAX & 0xFFFF);", "s->mv_min.y -= 64;", "s->mv_max.y -= 64;", "if (VAR_0->active_thread_type == FF_THREAD_FRAME)\nff_thread_report_progress(&curframe->tf, VAR_4, 0);", "}", "return 0;", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 39 ], [ 41 ], [ 45, 47 ], [ 49 ], [ 53 ], [ 55 ] ]
18,460
void rgb24tobgr32(const uint8_t *src, uint8_t *dst, long src_size) { long i; for(i=0; 3*i<src_size; i++) { #ifdef WORDS_BIGENDIAN /* RGB24 (= R,G,B) -> BGR32 (= A,R,G,B) */ dst[4*i + 0] = 0; dst[4*i + 1] = src[3*i + 0]; dst[4*i + 2] = src[3*i + 1]; dst[4*i + 3] = src[3*i + 2]; #else dst[4*i + 0] = src[3*i + 2]; dst[4*i + 1] = src[3*i + 1]; dst[4*i + 2] = src[3*i + 0]; dst[4*i + 3] = 0; #endif } }
true
FFmpeg
6e42e6c4b410dbef8b593c2d796a5dad95f89ee4
void rgb24tobgr32(const uint8_t *src, uint8_t *dst, long src_size) { long i; for(i=0; 3*i<src_size; i++) { #ifdef WORDS_BIGENDIAN dst[4*i + 0] = 0; dst[4*i + 1] = src[3*i + 0]; dst[4*i + 2] = src[3*i + 1]; dst[4*i + 3] = src[3*i + 2]; #else dst[4*i + 0] = src[3*i + 2]; dst[4*i + 1] = src[3*i + 1]; dst[4*i + 2] = src[3*i + 0]; dst[4*i + 3] = 0; #endif } }
{ "code": [ "\tlong i;", "\t\t#ifdef WORDS_BIGENDIAN", "\t\t#else", "\t\t#endif", "\tlong i;", "\t\t#ifdef WORDS_BIGENDIAN", "\t\t#else", "\t\t#endif", "\tlong i;", "\tlong i;", "\tlong i;", "\tlong i;", "\tlong i;", "\tlong i;", "\tlong i;", "\t\t#ifdef WORDS_BIGENDIAN", "\t\t#else", "\t\t#endif", "\tlong i;", "\tfor(i=0; 3*i<src_size; i++)", "\t\t#ifdef WORDS_BIGENDIAN", "\t\t\tdst[4*i + 0] = 0;", "\t\t\tdst[4*i + 1] = src[3*i + 0];", "\t\t\tdst[4*i + 2] = src[3*i + 1];", "\t\t\tdst[4*i + 3] = src[3*i + 2];", "\t\t#else", "\t\t\tdst[4*i + 0] = src[3*i + 2];", "\t\t\tdst[4*i + 1] = src[3*i + 1];", "\t\t\tdst[4*i + 2] = src[3*i + 0];", "\t\t\tdst[4*i + 3] = 0;", "\t\t#endif", "\t\t#ifdef WORDS_BIGENDIAN", "\t\t#else", "\t\t#endif", "\tlong i;", "\tlong i;", "\t\t#ifdef WORDS_BIGENDIAN", "\t\t#else", "\t\t#endif", "\tlong i;", "\tlong i;", "\tlong i;" ], "line_no": [ 5, 11, 23, 33, 5, 11, 23, 33, 5, 5, 5, 5, 5, 5, 5, 11, 23, 33, 5, 7, 11, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 11, 23, 33, 5, 5, 11, 23, 33, 5, 5, 5 ] }
void FUNC_0(const uint8_t *VAR_0, uint8_t *VAR_1, long VAR_2) { long VAR_3; for(VAR_3=0; 3*VAR_3<VAR_2; VAR_3++) { #ifdef WORDS_BIGENDIAN VAR_1[4*VAR_3 + 0] = 0; VAR_1[4*VAR_3 + 1] = VAR_0[3*VAR_3 + 0]; VAR_1[4*VAR_3 + 2] = VAR_0[3*VAR_3 + 1]; VAR_1[4*VAR_3 + 3] = VAR_0[3*VAR_3 + 2]; #else VAR_1[4*VAR_3 + 0] = VAR_0[3*VAR_3 + 2]; VAR_1[4*VAR_3 + 1] = VAR_0[3*VAR_3 + 1]; VAR_1[4*VAR_3 + 2] = VAR_0[3*VAR_3 + 0]; VAR_1[4*VAR_3 + 3] = 0; #endif } }
[ "void FUNC_0(const uint8_t *VAR_0, uint8_t *VAR_1, long VAR_2)\n{", "long VAR_3;", "for(VAR_3=0; 3*VAR_3<VAR_2; VAR_3++)", "{", "#ifdef WORDS_BIGENDIAN\nVAR_1[4*VAR_3 + 0] = 0;", "VAR_1[4*VAR_3 + 1] = VAR_0[3*VAR_3 + 0];", "VAR_1[4*VAR_3 + 2] = VAR_0[3*VAR_3 + 1];", "VAR_1[4*VAR_3 + 3] = VAR_0[3*VAR_3 + 2];", "#else\nVAR_1[4*VAR_3 + 0] = VAR_0[3*VAR_3 + 2];", "VAR_1[4*VAR_3 + 1] = VAR_0[3*VAR_3 + 1];", "VAR_1[4*VAR_3 + 2] = VAR_0[3*VAR_3 + 0];", "VAR_1[4*VAR_3 + 3] = 0;", "#endif\n}", "}" ]
[ 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11, 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33, 35 ], [ 37 ] ]
18,461
static int ea_read_packet(AVFormatContext *s, AVPacket *pkt) { EaDemuxContext *ea = s->priv_data; ByteIOContext *pb = s->pb; int ret = 0; int packet_read = 0; unsigned int chunk_type, chunk_size; int key = 0; int av_uninit(num_samples); while (!packet_read) { chunk_type = get_le32(pb); chunk_size = (ea->big_endian ? get_be32(pb) : get_le32(pb)) - 8; switch (chunk_type) { /* audio data */ case ISNh_TAG: /* header chunk also contains data; skip over the header portion*/ url_fskip(pb, 32); chunk_size -= 32; case ISNd_TAG: case SCDl_TAG: case SNDC_TAG: case SDEN_TAG: if (!ea->audio_codec) { url_fskip(pb, chunk_size); break; } else if (ea->audio_codec == CODEC_ID_PCM_S16LE_PLANAR || ea->audio_codec == CODEC_ID_MP3) { num_samples = get_le32(pb); url_fskip(pb, 8); chunk_size -= 12; } ret = av_get_packet(pb, pkt, chunk_size); if (ret != chunk_size) ret = AVERROR(EIO); else { pkt->stream_index = ea->audio_stream_index; pkt->pts = 90000; pkt->pts *= ea->audio_frame_counter; pkt->pts /= ea->sample_rate; switch (ea->audio_codec) { case CODEC_ID_ADPCM_EA: /* 2 samples/byte, 1 or 2 samples per frame depending * on stereo; chunk also has 12-byte header */ ea->audio_frame_counter += ((chunk_size - 12) * 2) / ea->num_channels; break; case CODEC_ID_PCM_S16LE_PLANAR: case CODEC_ID_MP3: ea->audio_frame_counter += num_samples; break; default: ea->audio_frame_counter += chunk_size / (ea->bytes * ea->num_channels); } } packet_read = 1; break; /* ending tag */ case 0: case ISNe_TAG: case SCEl_TAG: case SEND_TAG: case SEEN_TAG: ret = AVERROR(EIO); packet_read = 1; break; case MVIh_TAG: case kVGT_TAG: case pQGT_TAG: case TGQs_TAG: key = PKT_FLAG_KEY; case MVIf_TAG: case fVGT_TAG: url_fseek(pb, -8, SEEK_CUR); // include chunk preamble chunk_size += 8; goto get_video_packet; case mTCD_TAG: url_fseek(pb, 8, SEEK_CUR); // skip ea dct header chunk_size -= 8; goto get_video_packet; case MV0K_TAG: case MPCh_TAG: case pIQT_TAG: key = PKT_FLAG_KEY; case MV0F_TAG: get_video_packet: ret = av_get_packet(pb, pkt, chunk_size); if (ret != chunk_size) ret = AVERROR_IO; else { pkt->stream_index = ea->video_stream_index; pkt->flags |= key; } packet_read = 1; break; default: url_fseek(pb, chunk_size, SEEK_CUR); break; } } return ret; }
true
FFmpeg
f772b7fa7d57cba2e81727c7af29110f9556f06f
static int ea_read_packet(AVFormatContext *s, AVPacket *pkt) { EaDemuxContext *ea = s->priv_data; ByteIOContext *pb = s->pb; int ret = 0; int packet_read = 0; unsigned int chunk_type, chunk_size; int key = 0; int av_uninit(num_samples); while (!packet_read) { chunk_type = get_le32(pb); chunk_size = (ea->big_endian ? get_be32(pb) : get_le32(pb)) - 8; switch (chunk_type) { case ISNh_TAG: url_fskip(pb, 32); chunk_size -= 32; case ISNd_TAG: case SCDl_TAG: case SNDC_TAG: case SDEN_TAG: if (!ea->audio_codec) { url_fskip(pb, chunk_size); break; } else if (ea->audio_codec == CODEC_ID_PCM_S16LE_PLANAR || ea->audio_codec == CODEC_ID_MP3) { num_samples = get_le32(pb); url_fskip(pb, 8); chunk_size -= 12; } ret = av_get_packet(pb, pkt, chunk_size); if (ret != chunk_size) ret = AVERROR(EIO); else { pkt->stream_index = ea->audio_stream_index; pkt->pts = 90000; pkt->pts *= ea->audio_frame_counter; pkt->pts /= ea->sample_rate; switch (ea->audio_codec) { case CODEC_ID_ADPCM_EA: ea->audio_frame_counter += ((chunk_size - 12) * 2) / ea->num_channels; break; case CODEC_ID_PCM_S16LE_PLANAR: case CODEC_ID_MP3: ea->audio_frame_counter += num_samples; break; default: ea->audio_frame_counter += chunk_size / (ea->bytes * ea->num_channels); } } packet_read = 1; break; case 0: case ISNe_TAG: case SCEl_TAG: case SEND_TAG: case SEEN_TAG: ret = AVERROR(EIO); packet_read = 1; break; case MVIh_TAG: case kVGT_TAG: case pQGT_TAG: case TGQs_TAG: key = PKT_FLAG_KEY; case MVIf_TAG: case fVGT_TAG: url_fseek(pb, -8, SEEK_CUR); chunk_size += 8; goto get_video_packet; case mTCD_TAG: url_fseek(pb, 8, SEEK_CUR); chunk_size -= 8; goto get_video_packet; case MV0K_TAG: case MPCh_TAG: case pIQT_TAG: key = PKT_FLAG_KEY; case MV0F_TAG: get_video_packet: ret = av_get_packet(pb, pkt, chunk_size); if (ret != chunk_size) ret = AVERROR_IO; else { pkt->stream_index = ea->video_stream_index; pkt->flags |= key; } packet_read = 1; break; default: url_fseek(pb, chunk_size, SEEK_CUR); break; } } return ret; }
{ "code": [ " if (ret != chunk_size)", " ret = AVERROR(EIO);", " else {", " if (ret != chunk_size)", " ret = AVERROR_IO;", " else {" ], "line_no": [ 71, 73, 75, 71, 195, 75 ] }
static int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1) { EaDemuxContext *ea = VAR_0->priv_data; ByteIOContext *pb = VAR_0->pb; int VAR_2 = 0; int VAR_3 = 0; unsigned int VAR_4, VAR_5; int VAR_6 = 0; int FUNC_1(num_samples); while (!VAR_3) { VAR_4 = get_le32(pb); VAR_5 = (ea->big_endian ? get_be32(pb) : get_le32(pb)) - 8; switch (VAR_4) { case ISNh_TAG: url_fskip(pb, 32); VAR_5 -= 32; case ISNd_TAG: case SCDl_TAG: case SNDC_TAG: case SDEN_TAG: if (!ea->audio_codec) { url_fskip(pb, VAR_5); break; } else if (ea->audio_codec == CODEC_ID_PCM_S16LE_PLANAR || ea->audio_codec == CODEC_ID_MP3) { num_samples = get_le32(pb); url_fskip(pb, 8); VAR_5 -= 12; } VAR_2 = av_get_packet(pb, VAR_1, VAR_5); if (VAR_2 != VAR_5) VAR_2 = AVERROR(EIO); else { VAR_1->stream_index = ea->audio_stream_index; VAR_1->pts = 90000; VAR_1->pts *= ea->audio_frame_counter; VAR_1->pts /= ea->sample_rate; switch (ea->audio_codec) { case CODEC_ID_ADPCM_EA: ea->audio_frame_counter += ((VAR_5 - 12) * 2) / ea->num_channels; break; case CODEC_ID_PCM_S16LE_PLANAR: case CODEC_ID_MP3: ea->audio_frame_counter += num_samples; break; default: ea->audio_frame_counter += VAR_5 / (ea->bytes * ea->num_channels); } } VAR_3 = 1; break; case 0: case ISNe_TAG: case SCEl_TAG: case SEND_TAG: case SEEN_TAG: VAR_2 = AVERROR(EIO); VAR_3 = 1; break; case MVIh_TAG: case kVGT_TAG: case pQGT_TAG: case TGQs_TAG: VAR_6 = PKT_FLAG_KEY; case MVIf_TAG: case fVGT_TAG: url_fseek(pb, -8, SEEK_CUR); VAR_5 += 8; goto get_video_packet; case mTCD_TAG: url_fseek(pb, 8, SEEK_CUR); VAR_5 -= 8; goto get_video_packet; case MV0K_TAG: case MPCh_TAG: case pIQT_TAG: VAR_6 = PKT_FLAG_KEY; case MV0F_TAG: get_video_packet: VAR_2 = av_get_packet(pb, VAR_1, VAR_5); if (VAR_2 != VAR_5) VAR_2 = AVERROR_IO; else { VAR_1->stream_index = ea->video_stream_index; VAR_1->flags |= VAR_6; } VAR_3 = 1; break; default: url_fseek(pb, VAR_5, SEEK_CUR); break; } } return VAR_2; }
[ "static int FUNC_0(AVFormatContext *VAR_0,\nAVPacket *VAR_1)\n{", "EaDemuxContext *ea = VAR_0->priv_data;", "ByteIOContext *pb = VAR_0->pb;", "int VAR_2 = 0;", "int VAR_3 = 0;", "unsigned int VAR_4, VAR_5;", "int VAR_6 = 0;", "int FUNC_1(num_samples);", "while (!VAR_3) {", "VAR_4 = get_le32(pb);", "VAR_5 = (ea->big_endian ? get_be32(pb) : get_le32(pb)) - 8;", "switch (VAR_4) {", "case ISNh_TAG:\nurl_fskip(pb, 32);", "VAR_5 -= 32;", "case ISNd_TAG:\ncase SCDl_TAG:\ncase SNDC_TAG:\ncase SDEN_TAG:\nif (!ea->audio_codec) {", "url_fskip(pb, VAR_5);", "break;", "} else if (ea->audio_codec == CODEC_ID_PCM_S16LE_PLANAR ||", "ea->audio_codec == CODEC_ID_MP3) {", "num_samples = get_le32(pb);", "url_fskip(pb, 8);", "VAR_5 -= 12;", "}", "VAR_2 = av_get_packet(pb, VAR_1, VAR_5);", "if (VAR_2 != VAR_5)\nVAR_2 = AVERROR(EIO);", "else {", "VAR_1->stream_index = ea->audio_stream_index;", "VAR_1->pts = 90000;", "VAR_1->pts *= ea->audio_frame_counter;", "VAR_1->pts /= ea->sample_rate;", "switch (ea->audio_codec) {", "case CODEC_ID_ADPCM_EA:\nea->audio_frame_counter += ((VAR_5 - 12) * 2) /\nea->num_channels;", "break;", "case CODEC_ID_PCM_S16LE_PLANAR:\ncase CODEC_ID_MP3:\nea->audio_frame_counter += num_samples;", "break;", "default:\nea->audio_frame_counter += VAR_5 /\n(ea->bytes * ea->num_channels);", "}", "}", "VAR_3 = 1;", "break;", "case 0:\ncase ISNe_TAG:\ncase SCEl_TAG:\ncase SEND_TAG:\ncase SEEN_TAG:\nVAR_2 = AVERROR(EIO);", "VAR_3 = 1;", "break;", "case MVIh_TAG:\ncase kVGT_TAG:\ncase pQGT_TAG:\ncase TGQs_TAG:\nVAR_6 = PKT_FLAG_KEY;", "case MVIf_TAG:\ncase fVGT_TAG:\nurl_fseek(pb, -8, SEEK_CUR);", "VAR_5 += 8;", "goto get_video_packet;", "case mTCD_TAG:\nurl_fseek(pb, 8, SEEK_CUR);", "VAR_5 -= 8;", "goto get_video_packet;", "case MV0K_TAG:\ncase MPCh_TAG:\ncase pIQT_TAG:\nVAR_6 = PKT_FLAG_KEY;", "case MV0F_TAG:\nget_video_packet:\nVAR_2 = av_get_packet(pb, VAR_1, VAR_5);", "if (VAR_2 != VAR_5)\nVAR_2 = AVERROR_IO;", "else {", "VAR_1->stream_index = ea->video_stream_index;", "VAR_1->flags |= VAR_6;", "}", "VAR_3 = 1;", "break;", "default:\nurl_fseek(pb, VAR_5, SEEK_CUR);", "break;", "}", "}", "return VAR_2;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 35, 39 ], [ 41 ], [ 43, 45, 47, 49, 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71, 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 87 ], [ 89, 95, 97 ], [ 99 ], [ 101, 103, 105 ], [ 107 ], [ 109, 111, 113 ], [ 115 ], [ 117 ], [ 121 ], [ 123 ], [ 129, 131, 133, 135, 137, 139 ], [ 141 ], [ 143 ], [ 147, 149, 151, 153, 155 ], [ 157, 159, 161 ], [ 163 ], [ 165 ], [ 169, 171 ], [ 173 ], [ 175 ], [ 179, 181, 183, 185 ], [ 187, 189, 191 ], [ 193, 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 211, 213 ], [ 215 ], [ 217 ], [ 219 ], [ 223 ], [ 225 ] ]
18,463
static void decode_interframe_v4a(AVCodecContext *avctx, uint8_t *src, uint32_t size) { Hnm4VideoContext *hnm = avctx->priv_data; GetByteContext gb; uint32_t writeoffset = 0, offset; uint8_t tag, count, previous, delta; bytestream2_init(&gb, src, size); while (bytestream2_tell(&gb) < size) { count = bytestream2_peek_byte(&gb) & 0x3F; if (count == 0) { tag = bytestream2_get_byte(&gb) & 0xC0; tag = tag >> 6; if (tag == 0) { writeoffset += bytestream2_get_byte(&gb); } else if (tag == 1) { if (writeoffset + hnm->width >= hnm->width * hnm->height) { av_log(avctx, AV_LOG_ERROR, "writeoffset out of bounds\n"); break; } hnm->current[writeoffset] = bytestream2_get_byte(&gb); hnm->current[writeoffset + hnm->width] = bytestream2_get_byte(&gb); writeoffset++; } else if (tag == 2) { writeoffset += hnm->width; } else if (tag == 3) { break; } if (writeoffset > hnm->width * hnm->height) { av_log(avctx, AV_LOG_ERROR, "writeoffset out of bounds\n"); break; } } else { delta = bytestream2_peek_byte(&gb) & 0x80; previous = bytestream2_peek_byte(&gb) & 0x40; bytestream2_skip(&gb, 1); offset = writeoffset; offset += bytestream2_get_le16(&gb); if (delta) offset -= 0x10000; if (offset + hnm->width + count >= hnm->width * hnm->height) { av_log(avctx, AV_LOG_ERROR, "Attempting to read out of bounds\n"); break; } else if (writeoffset + hnm->width + count >= hnm->width * hnm->height) { av_log(avctx, AV_LOG_ERROR, "Attempting to write out of bounds\n"); break; } if (previous) { while (count > 0) { hnm->current[writeoffset] = hnm->previous[offset]; hnm->current[writeoffset + hnm->width] = hnm->previous[offset + hnm->width]; writeoffset++; offset++; count--; } } else { while (count > 0) { hnm->current[writeoffset] = hnm->current[offset]; hnm->current[writeoffset + hnm->width] = hnm->current[offset + hnm->width]; writeoffset++; offset++; count--; } } } } }
false
FFmpeg
4d7d9a57825ee7a6394d361b5c5b6f16422b361c
static void decode_interframe_v4a(AVCodecContext *avctx, uint8_t *src, uint32_t size) { Hnm4VideoContext *hnm = avctx->priv_data; GetByteContext gb; uint32_t writeoffset = 0, offset; uint8_t tag, count, previous, delta; bytestream2_init(&gb, src, size); while (bytestream2_tell(&gb) < size) { count = bytestream2_peek_byte(&gb) & 0x3F; if (count == 0) { tag = bytestream2_get_byte(&gb) & 0xC0; tag = tag >> 6; if (tag == 0) { writeoffset += bytestream2_get_byte(&gb); } else if (tag == 1) { if (writeoffset + hnm->width >= hnm->width * hnm->height) { av_log(avctx, AV_LOG_ERROR, "writeoffset out of bounds\n"); break; } hnm->current[writeoffset] = bytestream2_get_byte(&gb); hnm->current[writeoffset + hnm->width] = bytestream2_get_byte(&gb); writeoffset++; } else if (tag == 2) { writeoffset += hnm->width; } else if (tag == 3) { break; } if (writeoffset > hnm->width * hnm->height) { av_log(avctx, AV_LOG_ERROR, "writeoffset out of bounds\n"); break; } } else { delta = bytestream2_peek_byte(&gb) & 0x80; previous = bytestream2_peek_byte(&gb) & 0x40; bytestream2_skip(&gb, 1); offset = writeoffset; offset += bytestream2_get_le16(&gb); if (delta) offset -= 0x10000; if (offset + hnm->width + count >= hnm->width * hnm->height) { av_log(avctx, AV_LOG_ERROR, "Attempting to read out of bounds\n"); break; } else if (writeoffset + hnm->width + count >= hnm->width * hnm->height) { av_log(avctx, AV_LOG_ERROR, "Attempting to write out of bounds\n"); break; } if (previous) { while (count > 0) { hnm->current[writeoffset] = hnm->previous[offset]; hnm->current[writeoffset + hnm->width] = hnm->previous[offset + hnm->width]; writeoffset++; offset++; count--; } } else { while (count > 0) { hnm->current[writeoffset] = hnm->current[offset]; hnm->current[writeoffset + hnm->width] = hnm->current[offset + hnm->width]; writeoffset++; offset++; count--; } } } } }
{ "code": [], "line_no": [] }
static void FUNC_0(AVCodecContext *VAR_0, uint8_t *VAR_1, uint32_t VAR_2) { Hnm4VideoContext *hnm = VAR_0->priv_data; GetByteContext gb; uint32_t writeoffset = 0, offset; uint8_t tag, count, previous, delta; bytestream2_init(&gb, VAR_1, VAR_2); while (bytestream2_tell(&gb) < VAR_2) { count = bytestream2_peek_byte(&gb) & 0x3F; if (count == 0) { tag = bytestream2_get_byte(&gb) & 0xC0; tag = tag >> 6; if (tag == 0) { writeoffset += bytestream2_get_byte(&gb); } else if (tag == 1) { if (writeoffset + hnm->width >= hnm->width * hnm->height) { av_log(VAR_0, AV_LOG_ERROR, "writeoffset out of bounds\n"); break; } hnm->current[writeoffset] = bytestream2_get_byte(&gb); hnm->current[writeoffset + hnm->width] = bytestream2_get_byte(&gb); writeoffset++; } else if (tag == 2) { writeoffset += hnm->width; } else if (tag == 3) { break; } if (writeoffset > hnm->width * hnm->height) { av_log(VAR_0, AV_LOG_ERROR, "writeoffset out of bounds\n"); break; } } else { delta = bytestream2_peek_byte(&gb) & 0x80; previous = bytestream2_peek_byte(&gb) & 0x40; bytestream2_skip(&gb, 1); offset = writeoffset; offset += bytestream2_get_le16(&gb); if (delta) offset -= 0x10000; if (offset + hnm->width + count >= hnm->width * hnm->height) { av_log(VAR_0, AV_LOG_ERROR, "Attempting to read out of bounds\n"); break; } else if (writeoffset + hnm->width + count >= hnm->width * hnm->height) { av_log(VAR_0, AV_LOG_ERROR, "Attempting to write out of bounds\n"); break; } if (previous) { while (count > 0) { hnm->current[writeoffset] = hnm->previous[offset]; hnm->current[writeoffset + hnm->width] = hnm->previous[offset + hnm->width]; writeoffset++; offset++; count--; } } else { while (count > 0) { hnm->current[writeoffset] = hnm->current[offset]; hnm->current[writeoffset + hnm->width] = hnm->current[offset + hnm->width]; writeoffset++; offset++; count--; } } } } }
[ "static void FUNC_0(AVCodecContext *VAR_0, uint8_t *VAR_1,\nuint32_t VAR_2)\n{", "Hnm4VideoContext *hnm = VAR_0->priv_data;", "GetByteContext gb;", "uint32_t writeoffset = 0, offset;", "uint8_t tag, count, previous, delta;", "bytestream2_init(&gb, VAR_1, VAR_2);", "while (bytestream2_tell(&gb) < VAR_2) {", "count = bytestream2_peek_byte(&gb) & 0x3F;", "if (count == 0) {", "tag = bytestream2_get_byte(&gb) & 0xC0;", "tag = tag >> 6;", "if (tag == 0) {", "writeoffset += bytestream2_get_byte(&gb);", "} else if (tag == 1) {", "if (writeoffset + hnm->width >= hnm->width * hnm->height) {", "av_log(VAR_0, AV_LOG_ERROR, \"writeoffset out of bounds\\n\");", "break;", "}", "hnm->current[writeoffset] = bytestream2_get_byte(&gb);", "hnm->current[writeoffset + hnm->width] = bytestream2_get_byte(&gb);", "writeoffset++;", "} else if (tag == 2) {", "writeoffset += hnm->width;", "} else if (tag == 3) {", "break;", "}", "if (writeoffset > hnm->width * hnm->height) {", "av_log(VAR_0, AV_LOG_ERROR, \"writeoffset out of bounds\\n\");", "break;", "}", "} else {", "delta = bytestream2_peek_byte(&gb) & 0x80;", "previous = bytestream2_peek_byte(&gb) & 0x40;", "bytestream2_skip(&gb, 1);", "offset = writeoffset;", "offset += bytestream2_get_le16(&gb);", "if (delta)\noffset -= 0x10000;", "if (offset + hnm->width + count >= hnm->width * hnm->height) {", "av_log(VAR_0, AV_LOG_ERROR, \"Attempting to read out of bounds\\n\");", "break;", "} else if (writeoffset + hnm->width + count >= hnm->width * hnm->height) {", "av_log(VAR_0, AV_LOG_ERROR, \"Attempting to write out of bounds\\n\");", "break;", "}", "if (previous) {", "while (count > 0) {", "hnm->current[writeoffset] = hnm->previous[offset];", "hnm->current[writeoffset + hnm->width] = hnm->previous[offset + hnm->width];", "writeoffset++;", "offset++;", "count--;", "}", "} else {", "while (count > 0) {", "hnm->current[writeoffset] = hnm->current[offset];", "hnm->current[writeoffset + hnm->width] = hnm->current[offset + hnm->width];", "writeoffset++;", "offset++;", "count--;", "}", "}", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ], [ 85, 87 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ] ]
18,465
static void roqvideo_decode_frame(RoqContext *ri) { unsigned int chunk_id = 0, chunk_arg = 0; unsigned long chunk_size = 0; int i, j, k, nv1, nv2, vqflg = 0, vqflg_pos = -1; int vqid, bpos, xpos, ypos, xp, yp, x, y, mx, my; int frame_stats[2][4] = {{0},{0}}; roq_qcell *qcell; const unsigned char *buf = ri->buf; const unsigned char *buf_end = ri->buf + ri->size; while (buf < buf_end) { chunk_id = bytestream_get_le16(&buf); chunk_size = bytestream_get_le32(&buf); chunk_arg = bytestream_get_le16(&buf); if(chunk_id == RoQ_QUAD_VQ) break; if(chunk_id == RoQ_QUAD_CODEBOOK) { if((nv1 = chunk_arg >> 8) == 0) nv1 = 256; if((nv2 = chunk_arg & 0xff) == 0 && nv1 * 6 < chunk_size) nv2 = 256; for(i = 0; i < nv1; i++) { ri->cb2x2[i].y[0] = *buf++; ri->cb2x2[i].y[1] = *buf++; ri->cb2x2[i].y[2] = *buf++; ri->cb2x2[i].y[3] = *buf++; ri->cb2x2[i].u = *buf++; ri->cb2x2[i].v = *buf++; } for(i = 0; i < nv2; i++) for(j = 0; j < 4; j++) ri->cb4x4[i].idx[j] = *buf++; } } bpos = xpos = ypos = 0; if (chunk_size > buf_end - buf) { av_log(ri->avctx, AV_LOG_ERROR, "Chunk does not fit in input buffer\n"); chunk_size = buf_end - buf; } while(bpos < chunk_size) { for (yp = ypos; yp < ypos + 16; yp += 8) for (xp = xpos; xp < xpos + 16; xp += 8) { if (bpos >= chunk_size) { av_log(ri->avctx, AV_LOG_ERROR, "Input buffer too small\n"); return; } if (vqflg_pos < 0) { vqflg = buf[bpos++]; vqflg |= (buf[bpos++] << 8); vqflg_pos = 7; } vqid = (vqflg >> (vqflg_pos * 2)) & 0x3; frame_stats[0][vqid]++; vqflg_pos--; switch(vqid) { case RoQ_ID_MOT: break; case RoQ_ID_FCC: mx = 8 - (buf[bpos] >> 4) - ((signed char) (chunk_arg >> 8)); my = 8 - (buf[bpos++] & 0xf) - ((signed char) chunk_arg); ff_apply_motion_8x8(ri, xp, yp, mx, my); break; case RoQ_ID_SLD: qcell = ri->cb4x4 + buf[bpos++]; ff_apply_vector_4x4(ri, xp, yp, ri->cb2x2 + qcell->idx[0]); ff_apply_vector_4x4(ri, xp+4, yp, ri->cb2x2 + qcell->idx[1]); ff_apply_vector_4x4(ri, xp, yp+4, ri->cb2x2 + qcell->idx[2]); ff_apply_vector_4x4(ri, xp+4, yp+4, ri->cb2x2 + qcell->idx[3]); break; case RoQ_ID_CCC: for (k = 0; k < 4; k++) { x = xp; y = yp; if(k & 0x01) x += 4; if(k & 0x02) y += 4; if (bpos >= chunk_size) { av_log(ri->avctx, AV_LOG_ERROR, "Input buffer too small\n"); return; } if (vqflg_pos < 0) { vqflg = buf[bpos++]; vqflg |= (buf[bpos++] << 8); vqflg_pos = 7; } vqid = (vqflg >> (vqflg_pos * 2)) & 0x3; frame_stats[1][vqid]++; vqflg_pos--; switch(vqid) { case RoQ_ID_MOT: break; case RoQ_ID_FCC: mx = 8 - (buf[bpos] >> 4) - ((signed char) (chunk_arg >> 8)); my = 8 - (buf[bpos++] & 0xf) - ((signed char) chunk_arg); ff_apply_motion_4x4(ri, x, y, mx, my); break; case RoQ_ID_SLD: qcell = ri->cb4x4 + buf[bpos++]; ff_apply_vector_2x2(ri, x, y, ri->cb2x2 + qcell->idx[0]); ff_apply_vector_2x2(ri, x+2, y, ri->cb2x2 + qcell->idx[1]); ff_apply_vector_2x2(ri, x, y+2, ri->cb2x2 + qcell->idx[2]); ff_apply_vector_2x2(ri, x+2, y+2, ri->cb2x2 + qcell->idx[3]); break; case RoQ_ID_CCC: ff_apply_vector_2x2(ri, x, y, ri->cb2x2 + buf[bpos]); ff_apply_vector_2x2(ri, x+2, y, ri->cb2x2 + buf[bpos+1]); ff_apply_vector_2x2(ri, x, y+2, ri->cb2x2 + buf[bpos+2]); ff_apply_vector_2x2(ri, x+2, y+2, ri->cb2x2 + buf[bpos+3]); bpos += 4; break; } } break; default: av_log(ri->avctx, AV_LOG_ERROR, "Unknown vq code: %d\n", vqid); } } xpos += 16; if (xpos >= ri->width) { xpos -= ri->width; ypos += 16; } if(ypos >= ri->height) break; } }
false
FFmpeg
7a7b1f5c4d4127ff78bed67e786d03560a9cc199
static void roqvideo_decode_frame(RoqContext *ri) { unsigned int chunk_id = 0, chunk_arg = 0; unsigned long chunk_size = 0; int i, j, k, nv1, nv2, vqflg = 0, vqflg_pos = -1; int vqid, bpos, xpos, ypos, xp, yp, x, y, mx, my; int frame_stats[2][4] = {{0},{0}}; roq_qcell *qcell; const unsigned char *buf = ri->buf; const unsigned char *buf_end = ri->buf + ri->size; while (buf < buf_end) { chunk_id = bytestream_get_le16(&buf); chunk_size = bytestream_get_le32(&buf); chunk_arg = bytestream_get_le16(&buf); if(chunk_id == RoQ_QUAD_VQ) break; if(chunk_id == RoQ_QUAD_CODEBOOK) { if((nv1 = chunk_arg >> 8) == 0) nv1 = 256; if((nv2 = chunk_arg & 0xff) == 0 && nv1 * 6 < chunk_size) nv2 = 256; for(i = 0; i < nv1; i++) { ri->cb2x2[i].y[0] = *buf++; ri->cb2x2[i].y[1] = *buf++; ri->cb2x2[i].y[2] = *buf++; ri->cb2x2[i].y[3] = *buf++; ri->cb2x2[i].u = *buf++; ri->cb2x2[i].v = *buf++; } for(i = 0; i < nv2; i++) for(j = 0; j < 4; j++) ri->cb4x4[i].idx[j] = *buf++; } } bpos = xpos = ypos = 0; if (chunk_size > buf_end - buf) { av_log(ri->avctx, AV_LOG_ERROR, "Chunk does not fit in input buffer\n"); chunk_size = buf_end - buf; } while(bpos < chunk_size) { for (yp = ypos; yp < ypos + 16; yp += 8) for (xp = xpos; xp < xpos + 16; xp += 8) { if (bpos >= chunk_size) { av_log(ri->avctx, AV_LOG_ERROR, "Input buffer too small\n"); return; } if (vqflg_pos < 0) { vqflg = buf[bpos++]; vqflg |= (buf[bpos++] << 8); vqflg_pos = 7; } vqid = (vqflg >> (vqflg_pos * 2)) & 0x3; frame_stats[0][vqid]++; vqflg_pos--; switch(vqid) { case RoQ_ID_MOT: break; case RoQ_ID_FCC: mx = 8 - (buf[bpos] >> 4) - ((signed char) (chunk_arg >> 8)); my = 8 - (buf[bpos++] & 0xf) - ((signed char) chunk_arg); ff_apply_motion_8x8(ri, xp, yp, mx, my); break; case RoQ_ID_SLD: qcell = ri->cb4x4 + buf[bpos++]; ff_apply_vector_4x4(ri, xp, yp, ri->cb2x2 + qcell->idx[0]); ff_apply_vector_4x4(ri, xp+4, yp, ri->cb2x2 + qcell->idx[1]); ff_apply_vector_4x4(ri, xp, yp+4, ri->cb2x2 + qcell->idx[2]); ff_apply_vector_4x4(ri, xp+4, yp+4, ri->cb2x2 + qcell->idx[3]); break; case RoQ_ID_CCC: for (k = 0; k < 4; k++) { x = xp; y = yp; if(k & 0x01) x += 4; if(k & 0x02) y += 4; if (bpos >= chunk_size) { av_log(ri->avctx, AV_LOG_ERROR, "Input buffer too small\n"); return; } if (vqflg_pos < 0) { vqflg = buf[bpos++]; vqflg |= (buf[bpos++] << 8); vqflg_pos = 7; } vqid = (vqflg >> (vqflg_pos * 2)) & 0x3; frame_stats[1][vqid]++; vqflg_pos--; switch(vqid) { case RoQ_ID_MOT: break; case RoQ_ID_FCC: mx = 8 - (buf[bpos] >> 4) - ((signed char) (chunk_arg >> 8)); my = 8 - (buf[bpos++] & 0xf) - ((signed char) chunk_arg); ff_apply_motion_4x4(ri, x, y, mx, my); break; case RoQ_ID_SLD: qcell = ri->cb4x4 + buf[bpos++]; ff_apply_vector_2x2(ri, x, y, ri->cb2x2 + qcell->idx[0]); ff_apply_vector_2x2(ri, x+2, y, ri->cb2x2 + qcell->idx[1]); ff_apply_vector_2x2(ri, x, y+2, ri->cb2x2 + qcell->idx[2]); ff_apply_vector_2x2(ri, x+2, y+2, ri->cb2x2 + qcell->idx[3]); break; case RoQ_ID_CCC: ff_apply_vector_2x2(ri, x, y, ri->cb2x2 + buf[bpos]); ff_apply_vector_2x2(ri, x+2, y, ri->cb2x2 + buf[bpos+1]); ff_apply_vector_2x2(ri, x, y+2, ri->cb2x2 + buf[bpos+2]); ff_apply_vector_2x2(ri, x+2, y+2, ri->cb2x2 + buf[bpos+3]); bpos += 4; break; } } break; default: av_log(ri->avctx, AV_LOG_ERROR, "Unknown vq code: %d\n", vqid); } } xpos += 16; if (xpos >= ri->width) { xpos -= ri->width; ypos += 16; } if(ypos >= ri->height) break; } }
{ "code": [], "line_no": [] }
static void FUNC_0(RoqContext *VAR_0) { unsigned int VAR_1 = 0, VAR_2 = 0; unsigned long VAR_3 = 0; int VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9 = 0, VAR_10 = -1; int VAR_11, VAR_12, VAR_13, VAR_14, VAR_15, VAR_16, VAR_17, VAR_18, VAR_19, VAR_20; int VAR_21[2][4] = {{0},{0}}; roq_qcell *qcell; const unsigned char *VAR_22 = VAR_0->VAR_22; const unsigned char *VAR_23 = VAR_0->VAR_22 + VAR_0->size; while (VAR_22 < VAR_23) { VAR_1 = bytestream_get_le16(&VAR_22); VAR_3 = bytestream_get_le32(&VAR_22); VAR_2 = bytestream_get_le16(&VAR_22); if(VAR_1 == RoQ_QUAD_VQ) break; if(VAR_1 == RoQ_QUAD_CODEBOOK) { if((VAR_7 = VAR_2 >> 8) == 0) VAR_7 = 256; if((VAR_8 = VAR_2 & 0xff) == 0 && VAR_7 * 6 < VAR_3) VAR_8 = 256; for(VAR_4 = 0; VAR_4 < VAR_7; VAR_4++) { VAR_0->cb2x2[VAR_4].VAR_18[0] = *VAR_22++; VAR_0->cb2x2[VAR_4].VAR_18[1] = *VAR_22++; VAR_0->cb2x2[VAR_4].VAR_18[2] = *VAR_22++; VAR_0->cb2x2[VAR_4].VAR_18[3] = *VAR_22++; VAR_0->cb2x2[VAR_4].u = *VAR_22++; VAR_0->cb2x2[VAR_4].v = *VAR_22++; } for(VAR_4 = 0; VAR_4 < VAR_8; VAR_4++) for(VAR_5 = 0; VAR_5 < 4; VAR_5++) VAR_0->cb4x4[VAR_4].idx[VAR_5] = *VAR_22++; } } VAR_12 = VAR_13 = VAR_14 = 0; if (VAR_3 > VAR_23 - VAR_22) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Chunk does not fit in input buffer\n"); VAR_3 = VAR_23 - VAR_22; } while(VAR_12 < VAR_3) { for (VAR_16 = VAR_14; VAR_16 < VAR_14 + 16; VAR_16 += 8) for (VAR_15 = VAR_13; VAR_15 < VAR_13 + 16; VAR_15 += 8) { if (VAR_12 >= VAR_3) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Input buffer too small\n"); return; } if (VAR_10 < 0) { VAR_9 = VAR_22[VAR_12++]; VAR_9 |= (VAR_22[VAR_12++] << 8); VAR_10 = 7; } VAR_11 = (VAR_9 >> (VAR_10 * 2)) & 0x3; VAR_21[0][VAR_11]++; VAR_10--; switch(VAR_11) { case RoQ_ID_MOT: break; case RoQ_ID_FCC: VAR_19 = 8 - (VAR_22[VAR_12] >> 4) - ((signed char) (VAR_2 >> 8)); VAR_20 = 8 - (VAR_22[VAR_12++] & 0xf) - ((signed char) VAR_2); ff_apply_motion_8x8(VAR_0, VAR_15, VAR_16, VAR_19, VAR_20); break; case RoQ_ID_SLD: qcell = VAR_0->cb4x4 + VAR_22[VAR_12++]; ff_apply_vector_4x4(VAR_0, VAR_15, VAR_16, VAR_0->cb2x2 + qcell->idx[0]); ff_apply_vector_4x4(VAR_0, VAR_15+4, VAR_16, VAR_0->cb2x2 + qcell->idx[1]); ff_apply_vector_4x4(VAR_0, VAR_15, VAR_16+4, VAR_0->cb2x2 + qcell->idx[2]); ff_apply_vector_4x4(VAR_0, VAR_15+4, VAR_16+4, VAR_0->cb2x2 + qcell->idx[3]); break; case RoQ_ID_CCC: for (VAR_6 = 0; VAR_6 < 4; VAR_6++) { VAR_17 = VAR_15; VAR_18 = VAR_16; if(VAR_6 & 0x01) VAR_17 += 4; if(VAR_6 & 0x02) VAR_18 += 4; if (VAR_12 >= VAR_3) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Input buffer too small\n"); return; } if (VAR_10 < 0) { VAR_9 = VAR_22[VAR_12++]; VAR_9 |= (VAR_22[VAR_12++] << 8); VAR_10 = 7; } VAR_11 = (VAR_9 >> (VAR_10 * 2)) & 0x3; VAR_21[1][VAR_11]++; VAR_10--; switch(VAR_11) { case RoQ_ID_MOT: break; case RoQ_ID_FCC: VAR_19 = 8 - (VAR_22[VAR_12] >> 4) - ((signed char) (VAR_2 >> 8)); VAR_20 = 8 - (VAR_22[VAR_12++] & 0xf) - ((signed char) VAR_2); ff_apply_motion_4x4(VAR_0, VAR_17, VAR_18, VAR_19, VAR_20); break; case RoQ_ID_SLD: qcell = VAR_0->cb4x4 + VAR_22[VAR_12++]; ff_apply_vector_2x2(VAR_0, VAR_17, VAR_18, VAR_0->cb2x2 + qcell->idx[0]); ff_apply_vector_2x2(VAR_0, VAR_17+2, VAR_18, VAR_0->cb2x2 + qcell->idx[1]); ff_apply_vector_2x2(VAR_0, VAR_17, VAR_18+2, VAR_0->cb2x2 + qcell->idx[2]); ff_apply_vector_2x2(VAR_0, VAR_17+2, VAR_18+2, VAR_0->cb2x2 + qcell->idx[3]); break; case RoQ_ID_CCC: ff_apply_vector_2x2(VAR_0, VAR_17, VAR_18, VAR_0->cb2x2 + VAR_22[VAR_12]); ff_apply_vector_2x2(VAR_0, VAR_17+2, VAR_18, VAR_0->cb2x2 + VAR_22[VAR_12+1]); ff_apply_vector_2x2(VAR_0, VAR_17, VAR_18+2, VAR_0->cb2x2 + VAR_22[VAR_12+2]); ff_apply_vector_2x2(VAR_0, VAR_17+2, VAR_18+2, VAR_0->cb2x2 + VAR_22[VAR_12+3]); VAR_12 += 4; break; } } break; default: av_log(VAR_0->avctx, AV_LOG_ERROR, "Unknown vq code: %d\n", VAR_11); } } VAR_13 += 16; if (VAR_13 >= VAR_0->width) { VAR_13 -= VAR_0->width; VAR_14 += 16; } if(VAR_14 >= VAR_0->height) break; } }
[ "static void FUNC_0(RoqContext *VAR_0)\n{", "unsigned int VAR_1 = 0, VAR_2 = 0;", "unsigned long VAR_3 = 0;", "int VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9 = 0, VAR_10 = -1;", "int VAR_11, VAR_12, VAR_13, VAR_14, VAR_15, VAR_16, VAR_17, VAR_18, VAR_19, VAR_20;", "int VAR_21[2][4] = {{0},{0}};", "roq_qcell *qcell;", "const unsigned char *VAR_22 = VAR_0->VAR_22;", "const unsigned char *VAR_23 = VAR_0->VAR_22 + VAR_0->size;", "while (VAR_22 < VAR_23) {", "VAR_1 = bytestream_get_le16(&VAR_22);", "VAR_3 = bytestream_get_le32(&VAR_22);", "VAR_2 = bytestream_get_le16(&VAR_22);", "if(VAR_1 == RoQ_QUAD_VQ)\nbreak;", "if(VAR_1 == RoQ_QUAD_CODEBOOK) {", "if((VAR_7 = VAR_2 >> 8) == 0)\nVAR_7 = 256;", "if((VAR_8 = VAR_2 & 0xff) == 0 && VAR_7 * 6 < VAR_3)\nVAR_8 = 256;", "for(VAR_4 = 0; VAR_4 < VAR_7; VAR_4++) {", "VAR_0->cb2x2[VAR_4].VAR_18[0] = *VAR_22++;", "VAR_0->cb2x2[VAR_4].VAR_18[1] = *VAR_22++;", "VAR_0->cb2x2[VAR_4].VAR_18[2] = *VAR_22++;", "VAR_0->cb2x2[VAR_4].VAR_18[3] = *VAR_22++;", "VAR_0->cb2x2[VAR_4].u = *VAR_22++;", "VAR_0->cb2x2[VAR_4].v = *VAR_22++;", "}", "for(VAR_4 = 0; VAR_4 < VAR_8; VAR_4++)", "for(VAR_5 = 0; VAR_5 < 4; VAR_5++)", "VAR_0->cb4x4[VAR_4].idx[VAR_5] = *VAR_22++;", "}", "}", "VAR_12 = VAR_13 = VAR_14 = 0;", "if (VAR_3 > VAR_23 - VAR_22) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Chunk does not fit in input buffer\\n\");", "VAR_3 = VAR_23 - VAR_22;", "}", "while(VAR_12 < VAR_3) {", "for (VAR_16 = VAR_14; VAR_16 < VAR_14 + 16; VAR_16 += 8)", "for (VAR_15 = VAR_13; VAR_15 < VAR_13 + 16; VAR_15 += 8) {", "if (VAR_12 >= VAR_3) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Input buffer too small\\n\");", "return;", "}", "if (VAR_10 < 0) {", "VAR_9 = VAR_22[VAR_12++]; VAR_9 |= (VAR_22[VAR_12++] << 8);", "VAR_10 = 7;", "}", "VAR_11 = (VAR_9 >> (VAR_10 * 2)) & 0x3;", "VAR_21[0][VAR_11]++;", "VAR_10--;", "switch(VAR_11) {", "case RoQ_ID_MOT:\nbreak;", "case RoQ_ID_FCC:\nVAR_19 = 8 - (VAR_22[VAR_12] >> 4) - ((signed char) (VAR_2 >> 8));", "VAR_20 = 8 - (VAR_22[VAR_12++] & 0xf) - ((signed char) VAR_2);", "ff_apply_motion_8x8(VAR_0, VAR_15, VAR_16, VAR_19, VAR_20);", "break;", "case RoQ_ID_SLD:\nqcell = VAR_0->cb4x4 + VAR_22[VAR_12++];", "ff_apply_vector_4x4(VAR_0, VAR_15, VAR_16, VAR_0->cb2x2 + qcell->idx[0]);", "ff_apply_vector_4x4(VAR_0, VAR_15+4, VAR_16, VAR_0->cb2x2 + qcell->idx[1]);", "ff_apply_vector_4x4(VAR_0, VAR_15, VAR_16+4, VAR_0->cb2x2 + qcell->idx[2]);", "ff_apply_vector_4x4(VAR_0, VAR_15+4, VAR_16+4, VAR_0->cb2x2 + qcell->idx[3]);", "break;", "case RoQ_ID_CCC:\nfor (VAR_6 = 0; VAR_6 < 4; VAR_6++) {", "VAR_17 = VAR_15; VAR_18 = VAR_16;", "if(VAR_6 & 0x01) VAR_17 += 4;", "if(VAR_6 & 0x02) VAR_18 += 4;", "if (VAR_12 >= VAR_3) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Input buffer too small\\n\");", "return;", "}", "if (VAR_10 < 0) {", "VAR_9 = VAR_22[VAR_12++];", "VAR_9 |= (VAR_22[VAR_12++] << 8);", "VAR_10 = 7;", "}", "VAR_11 = (VAR_9 >> (VAR_10 * 2)) & 0x3;", "VAR_21[1][VAR_11]++;", "VAR_10--;", "switch(VAR_11) {", "case RoQ_ID_MOT:\nbreak;", "case RoQ_ID_FCC:\nVAR_19 = 8 - (VAR_22[VAR_12] >> 4) - ((signed char) (VAR_2 >> 8));", "VAR_20 = 8 - (VAR_22[VAR_12++] & 0xf) - ((signed char) VAR_2);", "ff_apply_motion_4x4(VAR_0, VAR_17, VAR_18, VAR_19, VAR_20);", "break;", "case RoQ_ID_SLD:\nqcell = VAR_0->cb4x4 + VAR_22[VAR_12++];", "ff_apply_vector_2x2(VAR_0, VAR_17, VAR_18, VAR_0->cb2x2 + qcell->idx[0]);", "ff_apply_vector_2x2(VAR_0, VAR_17+2, VAR_18, VAR_0->cb2x2 + qcell->idx[1]);", "ff_apply_vector_2x2(VAR_0, VAR_17, VAR_18+2, VAR_0->cb2x2 + qcell->idx[2]);", "ff_apply_vector_2x2(VAR_0, VAR_17+2, VAR_18+2, VAR_0->cb2x2 + qcell->idx[3]);", "break;", "case RoQ_ID_CCC:\nff_apply_vector_2x2(VAR_0, VAR_17, VAR_18, VAR_0->cb2x2 + VAR_22[VAR_12]);", "ff_apply_vector_2x2(VAR_0, VAR_17+2, VAR_18, VAR_0->cb2x2 + VAR_22[VAR_12+1]);", "ff_apply_vector_2x2(VAR_0, VAR_17, VAR_18+2, VAR_0->cb2x2 + VAR_22[VAR_12+2]);", "ff_apply_vector_2x2(VAR_0, VAR_17+2, VAR_18+2, VAR_0->cb2x2 + VAR_22[VAR_12+3]);", "VAR_12 += 4;", "break;", "}", "}", "break;", "default:\nav_log(VAR_0->avctx, AV_LOG_ERROR, \"Unknown vq code: %d\\n\", VAR_11);", "}", "}", "VAR_13 += 16;", "if (VAR_13 >= VAR_0->width) {", "VAR_13 -= VAR_0->width;", "VAR_14 += 16;", "}", "if(VAR_14 >= VAR_0->height)\nbreak;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33, 35 ], [ 37 ], [ 39, 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 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 ], [ 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 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251, 253 ], [ 255 ], [ 257 ] ]
18,466
static void build_udp_url(char *buf, int buf_size, const char *hostname, int port, int local_port, int ttl) { snprintf(buf, buf_size, "udp://%s:%d", hostname, port); if (local_port >= 0) url_add_option(buf, buf_size, "localport=%d", local_port); if (ttl >= 0) url_add_option(buf, buf_size, "ttl=%d", ttl); }
false
FFmpeg
fc9b22dd2e5de851a89245b5357e710b93587278
static void build_udp_url(char *buf, int buf_size, const char *hostname, int port, int local_port, int ttl) { snprintf(buf, buf_size, "udp: if (local_port >= 0) url_add_option(buf, buf_size, "localport=%d", local_port); if (ttl >= 0) url_add_option(buf, buf_size, "ttl=%d", ttl); }
{ "code": [], "line_no": [] }
static void FUNC_0(char *VAR_0, int VAR_1, const char *VAR_2, int VAR_3, int VAR_4, int VAR_5) { snprintf(VAR_0, VAR_1, "udp: if (VAR_4 >= 0) url_add_option(VAR_0, VAR_1, "localport=%d", VAR_4); if (VAR_5 >= 0) url_add_option(VAR_0, VAR_1, "VAR_5=%d", VAR_5); }
[ "static void FUNC_0(char *VAR_0, int VAR_1,\nconst char *VAR_2, int VAR_3,\nint VAR_4, int VAR_5)\n{", "snprintf(VAR_0, VAR_1, \"udp:\nif (VAR_4 >= 0)\nurl_add_option(VAR_0, VAR_1, \"localport=%d\", VAR_4);", "if (VAR_5 >= 0)\nurl_add_option(VAR_0, VAR_1, \"VAR_5=%d\", VAR_5);", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9, 11, 13 ], [ 15, 17 ], [ 19 ] ]
18,467
static av_cold int wavpack_encode_init(AVCodecContext *avctx) { WavPackEncodeContext *s = avctx->priv_data; s->avctx = avctx; if (!avctx->frame_size) { int block_samples; if (!(avctx->sample_rate & 1)) block_samples = avctx->sample_rate / 2; else block_samples = avctx->sample_rate; while (block_samples * avctx->channels > 150000) block_samples /= 2; while (block_samples * avctx->channels < 40000) block_samples *= 2; avctx->frame_size = block_samples; } else if (avctx->frame_size && (avctx->frame_size < 128 || avctx->frame_size > WV_MAX_SAMPLES)) { av_log(avctx, AV_LOG_ERROR, "invalid block size: %d\n", avctx->frame_size); return AVERROR(EINVAL); } if (avctx->compression_level != FF_COMPRESSION_DEFAULT) { if (avctx->compression_level >= 3) { s->decorr_filter = 3; s->num_passes = 9; if (avctx->compression_level >= 8) { s->num_branches = 4; s->extra_flags = EXTRA_TRY_DELTAS|EXTRA_ADJUST_DELTAS|EXTRA_SORT_FIRST|EXTRA_SORT_LAST|EXTRA_BRANCHES; } else if (avctx->compression_level >= 7) { s->num_branches = 3; s->extra_flags = EXTRA_TRY_DELTAS|EXTRA_ADJUST_DELTAS|EXTRA_SORT_FIRST|EXTRA_BRANCHES; } else if (avctx->compression_level >= 6) { s->num_branches = 2; s->extra_flags = EXTRA_TRY_DELTAS|EXTRA_ADJUST_DELTAS|EXTRA_SORT_FIRST|EXTRA_BRANCHES; } else if (avctx->compression_level >= 5) { s->num_branches = 1; s->extra_flags = EXTRA_TRY_DELTAS|EXTRA_ADJUST_DELTAS|EXTRA_SORT_FIRST|EXTRA_BRANCHES; } else if (avctx->compression_level >= 4) { s->num_branches = 1; s->extra_flags = EXTRA_TRY_DELTAS|EXTRA_ADJUST_DELTAS|EXTRA_BRANCHES; } } else if (avctx->compression_level == 2) { s->decorr_filter = 2; s->num_passes = 4; } else if (avctx->compression_level == 1) { s->decorr_filter = 1; s->num_passes = 2; } else if (avctx->compression_level < 1) { s->decorr_filter = 0; s->num_passes = 0; } } s->num_decorrs = decorr_filter_sizes[s->decorr_filter]; s->decorr_specs = decorr_filters[s->decorr_filter]; s->delta_decay = 2.0; return 0; }
false
FFmpeg
ddad09397247f523d7cc66c7f4ed7ea6894cc40e
static av_cold int wavpack_encode_init(AVCodecContext *avctx) { WavPackEncodeContext *s = avctx->priv_data; s->avctx = avctx; if (!avctx->frame_size) { int block_samples; if (!(avctx->sample_rate & 1)) block_samples = avctx->sample_rate / 2; else block_samples = avctx->sample_rate; while (block_samples * avctx->channels > 150000) block_samples /= 2; while (block_samples * avctx->channels < 40000) block_samples *= 2; avctx->frame_size = block_samples; } else if (avctx->frame_size && (avctx->frame_size < 128 || avctx->frame_size > WV_MAX_SAMPLES)) { av_log(avctx, AV_LOG_ERROR, "invalid block size: %d\n", avctx->frame_size); return AVERROR(EINVAL); } if (avctx->compression_level != FF_COMPRESSION_DEFAULT) { if (avctx->compression_level >= 3) { s->decorr_filter = 3; s->num_passes = 9; if (avctx->compression_level >= 8) { s->num_branches = 4; s->extra_flags = EXTRA_TRY_DELTAS|EXTRA_ADJUST_DELTAS|EXTRA_SORT_FIRST|EXTRA_SORT_LAST|EXTRA_BRANCHES; } else if (avctx->compression_level >= 7) { s->num_branches = 3; s->extra_flags = EXTRA_TRY_DELTAS|EXTRA_ADJUST_DELTAS|EXTRA_SORT_FIRST|EXTRA_BRANCHES; } else if (avctx->compression_level >= 6) { s->num_branches = 2; s->extra_flags = EXTRA_TRY_DELTAS|EXTRA_ADJUST_DELTAS|EXTRA_SORT_FIRST|EXTRA_BRANCHES; } else if (avctx->compression_level >= 5) { s->num_branches = 1; s->extra_flags = EXTRA_TRY_DELTAS|EXTRA_ADJUST_DELTAS|EXTRA_SORT_FIRST|EXTRA_BRANCHES; } else if (avctx->compression_level >= 4) { s->num_branches = 1; s->extra_flags = EXTRA_TRY_DELTAS|EXTRA_ADJUST_DELTAS|EXTRA_BRANCHES; } } else if (avctx->compression_level == 2) { s->decorr_filter = 2; s->num_passes = 4; } else if (avctx->compression_level == 1) { s->decorr_filter = 1; s->num_passes = 2; } else if (avctx->compression_level < 1) { s->decorr_filter = 0; s->num_passes = 0; } } s->num_decorrs = decorr_filter_sizes[s->decorr_filter]; s->decorr_specs = decorr_filters[s->decorr_filter]; s->delta_decay = 2.0; return 0; }
{ "code": [], "line_no": [] }
static av_cold int FUNC_0(AVCodecContext *avctx) { WavPackEncodeContext *s = avctx->priv_data; s->avctx = avctx; if (!avctx->frame_size) { int VAR_0; if (!(avctx->sample_rate & 1)) VAR_0 = avctx->sample_rate / 2; else VAR_0 = avctx->sample_rate; while (VAR_0 * avctx->channels > 150000) VAR_0 /= 2; while (VAR_0 * avctx->channels < 40000) VAR_0 *= 2; avctx->frame_size = VAR_0; } else if (avctx->frame_size && (avctx->frame_size < 128 || avctx->frame_size > WV_MAX_SAMPLES)) { av_log(avctx, AV_LOG_ERROR, "invalid block size: %d\n", avctx->frame_size); return AVERROR(EINVAL); } if (avctx->compression_level != FF_COMPRESSION_DEFAULT) { if (avctx->compression_level >= 3) { s->decorr_filter = 3; s->num_passes = 9; if (avctx->compression_level >= 8) { s->num_branches = 4; s->extra_flags = EXTRA_TRY_DELTAS|EXTRA_ADJUST_DELTAS|EXTRA_SORT_FIRST|EXTRA_SORT_LAST|EXTRA_BRANCHES; } else if (avctx->compression_level >= 7) { s->num_branches = 3; s->extra_flags = EXTRA_TRY_DELTAS|EXTRA_ADJUST_DELTAS|EXTRA_SORT_FIRST|EXTRA_BRANCHES; } else if (avctx->compression_level >= 6) { s->num_branches = 2; s->extra_flags = EXTRA_TRY_DELTAS|EXTRA_ADJUST_DELTAS|EXTRA_SORT_FIRST|EXTRA_BRANCHES; } else if (avctx->compression_level >= 5) { s->num_branches = 1; s->extra_flags = EXTRA_TRY_DELTAS|EXTRA_ADJUST_DELTAS|EXTRA_SORT_FIRST|EXTRA_BRANCHES; } else if (avctx->compression_level >= 4) { s->num_branches = 1; s->extra_flags = EXTRA_TRY_DELTAS|EXTRA_ADJUST_DELTAS|EXTRA_BRANCHES; } } else if (avctx->compression_level == 2) { s->decorr_filter = 2; s->num_passes = 4; } else if (avctx->compression_level == 1) { s->decorr_filter = 1; s->num_passes = 2; } else if (avctx->compression_level < 1) { s->decorr_filter = 0; s->num_passes = 0; } } s->num_decorrs = decorr_filter_sizes[s->decorr_filter]; s->decorr_specs = decorr_filters[s->decorr_filter]; s->delta_decay = 2.0; return 0; }
[ "static av_cold int FUNC_0(AVCodecContext *avctx)\n{", "WavPackEncodeContext *s = avctx->priv_data;", "s->avctx = avctx;", "if (!avctx->frame_size) {", "int VAR_0;", "if (!(avctx->sample_rate & 1))\nVAR_0 = avctx->sample_rate / 2;", "else\nVAR_0 = avctx->sample_rate;", "while (VAR_0 * avctx->channels > 150000)\nVAR_0 /= 2;", "while (VAR_0 * avctx->channels < 40000)\nVAR_0 *= 2;", "avctx->frame_size = VAR_0;", "} else if (avctx->frame_size && (avctx->frame_size < 128 ||", "avctx->frame_size > WV_MAX_SAMPLES)) {", "av_log(avctx, AV_LOG_ERROR, \"invalid block size: %d\\n\", avctx->frame_size);", "return AVERROR(EINVAL);", "}", "if (avctx->compression_level != FF_COMPRESSION_DEFAULT) {", "if (avctx->compression_level >= 3) {", "s->decorr_filter = 3;", "s->num_passes = 9;", "if (avctx->compression_level >= 8) {", "s->num_branches = 4;", "s->extra_flags = EXTRA_TRY_DELTAS|EXTRA_ADJUST_DELTAS|EXTRA_SORT_FIRST|EXTRA_SORT_LAST|EXTRA_BRANCHES;", "} else if (avctx->compression_level >= 7) {", "s->num_branches = 3;", "s->extra_flags = EXTRA_TRY_DELTAS|EXTRA_ADJUST_DELTAS|EXTRA_SORT_FIRST|EXTRA_BRANCHES;", "} else if (avctx->compression_level >= 6) {", "s->num_branches = 2;", "s->extra_flags = EXTRA_TRY_DELTAS|EXTRA_ADJUST_DELTAS|EXTRA_SORT_FIRST|EXTRA_BRANCHES;", "} else if (avctx->compression_level >= 5) {", "s->num_branches = 1;", "s->extra_flags = EXTRA_TRY_DELTAS|EXTRA_ADJUST_DELTAS|EXTRA_SORT_FIRST|EXTRA_BRANCHES;", "} else if (avctx->compression_level >= 4) {", "s->num_branches = 1;", "s->extra_flags = EXTRA_TRY_DELTAS|EXTRA_ADJUST_DELTAS|EXTRA_BRANCHES;", "}", "} else if (avctx->compression_level == 2) {", "s->decorr_filter = 2;", "s->num_passes = 4;", "} else if (avctx->compression_level == 1) {", "s->decorr_filter = 1;", "s->num_passes = 2;", "} else if (avctx->compression_level < 1) {", "s->decorr_filter = 0;", "s->num_passes = 0;", "}", "}", "s->num_decorrs = decorr_filter_sizes[s->decorr_filter];", "s->decorr_specs = decorr_filters[s->decorr_filter];", "s->delta_decay = 2.0;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 13 ], [ 15 ], [ 17, 19 ], [ 21, 23 ], [ 27, 29 ], [ 33, 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 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 ], [ 115 ], [ 117 ], [ 121 ], [ 125 ], [ 127 ] ]
18,468
static int sub2video_prepare(InputStream *ist) { AVFormatContext *avf = input_files[ist->file_index]->ctx; int i, w, h; /* Compute the size of the canvas for the subtitles stream. If the subtitles codec has set a size, use it. Otherwise use the maximum dimensions of the video streams in the same file. */ w = ist->dec_ctx->width; h = ist->dec_ctx->height; if (!(w && h)) { for (i = 0; i < avf->nb_streams; i++) { if (avf->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO) { w = FFMAX(w, avf->streams[i]->codec->width); h = FFMAX(h, avf->streams[i]->codec->height); } } if (!(w && h)) { w = FFMAX(w, 720); h = FFMAX(h, 576); } av_log(avf, AV_LOG_INFO, "sub2video: using %dx%d canvas\n", w, h); } ist->sub2video.w = ist->dec_ctx->width = ist->resample_width = w; ist->sub2video.h = ist->dec_ctx->height = ist->resample_height = h; /* rectangles are AV_PIX_FMT_PAL8, but we have no guarantee that the palettes for all rectangles are identical or compatible */ ist->resample_pix_fmt = ist->dec_ctx->pix_fmt = AV_PIX_FMT_RGB32; ist->sub2video.frame = av_frame_alloc(); if (!ist->sub2video.frame) return AVERROR(ENOMEM); ist->sub2video.last_pts = INT64_MIN; return 0; }
false
FFmpeg
72237ef6e933527be7855cb266a2a4df4dcb8096
static int sub2video_prepare(InputStream *ist) { AVFormatContext *avf = input_files[ist->file_index]->ctx; int i, w, h; w = ist->dec_ctx->width; h = ist->dec_ctx->height; if (!(w && h)) { for (i = 0; i < avf->nb_streams; i++) { if (avf->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO) { w = FFMAX(w, avf->streams[i]->codec->width); h = FFMAX(h, avf->streams[i]->codec->height); } } if (!(w && h)) { w = FFMAX(w, 720); h = FFMAX(h, 576); } av_log(avf, AV_LOG_INFO, "sub2video: using %dx%d canvas\n", w, h); } ist->sub2video.w = ist->dec_ctx->width = ist->resample_width = w; ist->sub2video.h = ist->dec_ctx->height = ist->resample_height = h; ist->resample_pix_fmt = ist->dec_ctx->pix_fmt = AV_PIX_FMT_RGB32; ist->sub2video.frame = av_frame_alloc(); if (!ist->sub2video.frame) return AVERROR(ENOMEM); ist->sub2video.last_pts = INT64_MIN; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(InputStream *VAR_0) { AVFormatContext *avf = input_files[VAR_0->file_index]->ctx; int VAR_1, VAR_2, VAR_3; VAR_2 = VAR_0->dec_ctx->width; VAR_3 = VAR_0->dec_ctx->height; if (!(VAR_2 && VAR_3)) { for (VAR_1 = 0; VAR_1 < avf->nb_streams; VAR_1++) { if (avf->streams[VAR_1]->codec->codec_type == AVMEDIA_TYPE_VIDEO) { VAR_2 = FFMAX(VAR_2, avf->streams[VAR_1]->codec->width); VAR_3 = FFMAX(VAR_3, avf->streams[VAR_1]->codec->height); } } if (!(VAR_2 && VAR_3)) { VAR_2 = FFMAX(VAR_2, 720); VAR_3 = FFMAX(VAR_3, 576); } av_log(avf, AV_LOG_INFO, "sub2video: using %dx%d canvas\n", VAR_2, VAR_3); } VAR_0->sub2video.VAR_2 = VAR_0->dec_ctx->width = VAR_0->resample_width = VAR_2; VAR_0->sub2video.VAR_3 = VAR_0->dec_ctx->height = VAR_0->resample_height = VAR_3; VAR_0->resample_pix_fmt = VAR_0->dec_ctx->pix_fmt = AV_PIX_FMT_RGB32; VAR_0->sub2video.frame = av_frame_alloc(); if (!VAR_0->sub2video.frame) return AVERROR(ENOMEM); VAR_0->sub2video.last_pts = INT64_MIN; return 0; }
[ "static int FUNC_0(InputStream *VAR_0)\n{", "AVFormatContext *avf = input_files[VAR_0->file_index]->ctx;", "int VAR_1, VAR_2, VAR_3;", "VAR_2 = VAR_0->dec_ctx->width;", "VAR_3 = VAR_0->dec_ctx->height;", "if (!(VAR_2 && VAR_3)) {", "for (VAR_1 = 0; VAR_1 < avf->nb_streams; VAR_1++) {", "if (avf->streams[VAR_1]->codec->codec_type == AVMEDIA_TYPE_VIDEO) {", "VAR_2 = FFMAX(VAR_2, avf->streams[VAR_1]->codec->width);", "VAR_3 = FFMAX(VAR_3, avf->streams[VAR_1]->codec->height);", "}", "}", "if (!(VAR_2 && VAR_3)) {", "VAR_2 = FFMAX(VAR_2, 720);", "VAR_3 = FFMAX(VAR_3, 576);", "}", "av_log(avf, AV_LOG_INFO, \"sub2video: using %dx%d canvas\\n\", VAR_2, VAR_3);", "}", "VAR_0->sub2video.VAR_2 = VAR_0->dec_ctx->width = VAR_0->resample_width = VAR_2;", "VAR_0->sub2video.VAR_3 = VAR_0->dec_ctx->height = VAR_0->resample_height = VAR_3;", "VAR_0->resample_pix_fmt = VAR_0->dec_ctx->pix_fmt = AV_PIX_FMT_RGB32;", "VAR_0->sub2video.frame = av_frame_alloc();", "if (!VAR_0->sub2video.frame)\nreturn AVERROR(ENOMEM);", "VAR_0->sub2video.last_pts = INT64_MIN;", "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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 57 ], [ 61 ], [ 63, 65 ], [ 67 ], [ 69 ], [ 71 ] ]
18,469
static int arm946_prbs_read(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t *value) { if (ri->crm > 8) { return EXCP_UDEF; } *value = env->cp15.c6_region[ri->crm]; return 0; }
true
qemu
599d64f6dc10f267a45e7abebfcafd8e7626585b
static int arm946_prbs_read(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t *value) { if (ri->crm > 8) { return EXCP_UDEF; } *value = env->cp15.c6_region[ri->crm]; return 0; }
{ "code": [ " if (ri->crm > 8) {", " if (ri->crm > 8) {" ], "line_no": [ 7, 7 ] }
static int FUNC_0(CPUARMState *VAR_0, const ARMCPRegInfo *VAR_1, uint64_t *VAR_2) { if (VAR_1->crm > 8) { return EXCP_UDEF; } *VAR_2 = VAR_0->cp15.c6_region[VAR_1->crm]; return 0; }
[ "static int FUNC_0(CPUARMState *VAR_0, const ARMCPRegInfo *VAR_1,\nuint64_t *VAR_2)\n{", "if (VAR_1->crm > 8) {", "return EXCP_UDEF;", "}", "*VAR_2 = VAR_0->cp15.c6_region[VAR_1->crm];", "return 0;", "}" ]
[ 0, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ] ]
18,470
static int compat_read(AVFilterContext *ctx, AVFilterBufferRef **pbuf, int nb_samples) { AVFilterBufferRef *buf; AVFrame *frame; int ret; if (!pbuf) return ff_poll_frame(ctx->inputs[0]); frame = av_frame_alloc(); if (!frame) return AVERROR(ENOMEM); if (!nb_samples) ret = av_buffersink_get_frame(ctx, frame); else ret = av_buffersink_get_samples(ctx, frame, nb_samples); if (ret < 0) goto fail; if (ctx->inputs[0]->type == AVMEDIA_TYPE_VIDEO) { buf = avfilter_get_video_buffer_ref_from_arrays(frame->data, frame->linesize, AV_PERM_READ, frame->width, frame->height, frame->format); } else { buf = avfilter_get_audio_buffer_ref_from_arrays(frame->extended_data, frame->linesize[0], AV_PERM_READ, frame->nb_samples, frame->format, frame->channel_layout); } if (!buf) { ret = AVERROR(ENOMEM); goto fail; } avfilter_copy_frame_props(buf, frame); buf->buf->priv = frame; buf->buf->free = compat_free_buffer; *pbuf = buf; return 0; fail: av_frame_free(&frame); return ret; }
true
FFmpeg
20c86571ccc71412781d4a4813e4693e0c42aec6
static int compat_read(AVFilterContext *ctx, AVFilterBufferRef **pbuf, int nb_samples) { AVFilterBufferRef *buf; AVFrame *frame; int ret; if (!pbuf) return ff_poll_frame(ctx->inputs[0]); frame = av_frame_alloc(); if (!frame) return AVERROR(ENOMEM); if (!nb_samples) ret = av_buffersink_get_frame(ctx, frame); else ret = av_buffersink_get_samples(ctx, frame, nb_samples); if (ret < 0) goto fail; if (ctx->inputs[0]->type == AVMEDIA_TYPE_VIDEO) { buf = avfilter_get_video_buffer_ref_from_arrays(frame->data, frame->linesize, AV_PERM_READ, frame->width, frame->height, frame->format); } else { buf = avfilter_get_audio_buffer_ref_from_arrays(frame->extended_data, frame->linesize[0], AV_PERM_READ, frame->nb_samples, frame->format, frame->channel_layout); } if (!buf) { ret = AVERROR(ENOMEM); goto fail; } avfilter_copy_frame_props(buf, frame); buf->buf->priv = frame; buf->buf->free = compat_free_buffer; *pbuf = buf; return 0; fail: av_frame_free(&frame); return ret; }
{ "code": [ "static int compat_read(AVFilterContext *ctx, AVFilterBufferRef **pbuf, int nb_samples)" ], "line_no": [ 1 ] }
static int FUNC_0(AVFilterContext *VAR_0, AVFilterBufferRef **VAR_1, int VAR_2) { AVFilterBufferRef *buf; AVFrame *frame; int VAR_3; if (!VAR_1) return ff_poll_frame(VAR_0->inputs[0]); frame = av_frame_alloc(); if (!frame) return AVERROR(ENOMEM); if (!VAR_2) VAR_3 = av_buffersink_get_frame(VAR_0, frame); else VAR_3 = av_buffersink_get_samples(VAR_0, frame, VAR_2); if (VAR_3 < 0) goto fail; if (VAR_0->inputs[0]->type == AVMEDIA_TYPE_VIDEO) { buf = avfilter_get_video_buffer_ref_from_arrays(frame->data, frame->linesize, AV_PERM_READ, frame->width, frame->height, frame->format); } else { buf = avfilter_get_audio_buffer_ref_from_arrays(frame->extended_data, frame->linesize[0], AV_PERM_READ, frame->VAR_2, frame->format, frame->channel_layout); } if (!buf) { VAR_3 = AVERROR(ENOMEM); goto fail; } avfilter_copy_frame_props(buf, frame); buf->buf->priv = frame; buf->buf->free = compat_free_buffer; *VAR_1 = buf; return 0; fail: av_frame_free(&frame); return VAR_3; }
[ "static int FUNC_0(AVFilterContext *VAR_0, AVFilterBufferRef **VAR_1, int VAR_2)\n{", "AVFilterBufferRef *buf;", "AVFrame *frame;", "int VAR_3;", "if (!VAR_1)\nreturn ff_poll_frame(VAR_0->inputs[0]);", "frame = av_frame_alloc();", "if (!frame)\nreturn AVERROR(ENOMEM);", "if (!VAR_2)\nVAR_3 = av_buffersink_get_frame(VAR_0, frame);", "else\nVAR_3 = av_buffersink_get_samples(VAR_0, frame, VAR_2);", "if (VAR_3 < 0)\ngoto fail;", "if (VAR_0->inputs[0]->type == AVMEDIA_TYPE_VIDEO) {", "buf = avfilter_get_video_buffer_ref_from_arrays(frame->data, frame->linesize,\nAV_PERM_READ,\nframe->width, frame->height,\nframe->format);", "} else {", "buf = avfilter_get_audio_buffer_ref_from_arrays(frame->extended_data,\nframe->linesize[0], AV_PERM_READ,\nframe->VAR_2,\nframe->format,\nframe->channel_layout);", "}", "if (!buf) {", "VAR_3 = AVERROR(ENOMEM);", "goto fail;", "}", "avfilter_copy_frame_props(buf, frame);", "buf->buf->priv = frame;", "buf->buf->free = compat_free_buffer;", "*VAR_1 = buf;", "return 0;", "fail:\nav_frame_free(&frame);", "return VAR_3;", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13, 15 ], [ 19 ], [ 21, 23 ], [ 27, 29 ], [ 31, 33 ], [ 37, 39 ], [ 43 ], [ 45, 47, 49, 51 ], [ 53 ], [ 55, 57, 59, 61, 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 81 ], [ 83 ], [ 87 ], [ 91 ], [ 93, 95 ], [ 97 ], [ 99 ] ]
18,471
int cpu_ppc_register (CPUPPCState *env, ppc_def_t *def) { env->msr_mask = def->msr_mask; env->mmu_model = def->mmu_model; env->excp_model = def->excp_model; env->bus_model = def->bus_model; env->bfd_mach = def->bfd_mach; if (create_ppc_opcodes(env, def) < 0) return -1; init_ppc_proc(env, def); #if defined(PPC_DUMP_CPU) { const unsigned char *mmu_model, *excp_model, *bus_model; switch (env->mmu_model) { case POWERPC_MMU_32B: mmu_model = "PowerPC 32"; break; case POWERPC_MMU_601: mmu_model = "PowerPC 601"; break; case POWERPC_MMU_SOFT_6xx: mmu_model = "PowerPC 6xx/7xx with software driven TLBs"; break; case POWERPC_MMU_SOFT_74xx: mmu_model = "PowerPC 74xx with software driven TLBs"; break; case POWERPC_MMU_SOFT_4xx: mmu_model = "PowerPC 4xx with software driven TLBs"; break; case POWERPC_MMU_SOFT_4xx_Z: mmu_model = "PowerPC 4xx with software driven TLBs " "and zones protections"; break; case POWERPC_MMU_REAL_4xx: mmu_model = "PowerPC 4xx real mode only"; break; case POWERPC_MMU_BOOKE: mmu_model = "PowerPC BookE"; break; case POWERPC_MMU_BOOKE_FSL: mmu_model = "PowerPC BookE FSL"; break; #if defined (TARGET_PPC64) case POWERPC_MMU_64B: mmu_model = "PowerPC 64"; break; case POWERPC_MMU_64BRIDGE: mmu_model = "PowerPC 64 bridge"; break; #endif default: mmu_model = "Unknown or invalid"; break; } switch (env->excp_model) { case POWERPC_EXCP_STD: excp_model = "PowerPC"; break; case POWERPC_EXCP_40x: excp_model = "PowerPC 40x"; break; case POWERPC_EXCP_601: excp_model = "PowerPC 601"; break; case POWERPC_EXCP_602: excp_model = "PowerPC 602"; break; case POWERPC_EXCP_603: excp_model = "PowerPC 603"; break; case POWERPC_EXCP_603E: excp_model = "PowerPC 603e"; break; case POWERPC_EXCP_604: excp_model = "PowerPC 604"; break; case POWERPC_EXCP_7x0: excp_model = "PowerPC 740/750"; break; case POWERPC_EXCP_7x5: excp_model = "PowerPC 745/755"; break; case POWERPC_EXCP_74xx: excp_model = "PowerPC 74xx"; break; case POWERPC_EXCP_BOOKE: excp_model = "PowerPC BookE"; break; #if defined (TARGET_PPC64) case POWERPC_EXCP_970: excp_model = "PowerPC 970"; break; #endif default: excp_model = "Unknown or invalid"; break; } switch (env->bus_model) { case PPC_FLAGS_INPUT_6xx: bus_model = "PowerPC 6xx"; break; case PPC_FLAGS_INPUT_BookE: bus_model = "PowerPC BookE"; break; case PPC_FLAGS_INPUT_405: bus_model = "PowerPC 405"; break; case PPC_FLAGS_INPUT_401: bus_model = "PowerPC 401/403"; break; #if defined (TARGET_PPC64) case PPC_FLAGS_INPUT_970: bus_model = "PowerPC 970"; break; #endif default: bus_model = "Unknown or invalid"; break; } printf("PowerPC %-12s : PVR %08x MSR %016" PRIx64 "\n" " MMU model : %s\n", def->name, def->pvr, def->msr_mask, mmu_model); if (env->tlb != NULL) { printf(" %d %s TLB in %d ways\n", env->nb_tlb, env->id_tlbs ? "splitted" : "merged", env->nb_ways); } printf(" Exceptions model : %s\n" " Bus model : %s\n", excp_model, bus_model); } dump_ppc_insns(env); dump_ppc_sprs(env); fflush(stdout); #endif return 0; }
true
qemu
12de9a396acbc95e25c5d60ed097cc55777eaaed
int cpu_ppc_register (CPUPPCState *env, ppc_def_t *def) { env->msr_mask = def->msr_mask; env->mmu_model = def->mmu_model; env->excp_model = def->excp_model; env->bus_model = def->bus_model; env->bfd_mach = def->bfd_mach; if (create_ppc_opcodes(env, def) < 0) return -1; init_ppc_proc(env, def); #if defined(PPC_DUMP_CPU) { const unsigned char *mmu_model, *excp_model, *bus_model; switch (env->mmu_model) { case POWERPC_MMU_32B: mmu_model = "PowerPC 32"; break; case POWERPC_MMU_601: mmu_model = "PowerPC 601"; break; case POWERPC_MMU_SOFT_6xx: mmu_model = "PowerPC 6xx/7xx with software driven TLBs"; break; case POWERPC_MMU_SOFT_74xx: mmu_model = "PowerPC 74xx with software driven TLBs"; break; case POWERPC_MMU_SOFT_4xx: mmu_model = "PowerPC 4xx with software driven TLBs"; break; case POWERPC_MMU_SOFT_4xx_Z: mmu_model = "PowerPC 4xx with software driven TLBs " "and zones protections"; break; case POWERPC_MMU_REAL_4xx: mmu_model = "PowerPC 4xx real mode only"; break; case POWERPC_MMU_BOOKE: mmu_model = "PowerPC BookE"; break; case POWERPC_MMU_BOOKE_FSL: mmu_model = "PowerPC BookE FSL"; break; #if defined (TARGET_PPC64) case POWERPC_MMU_64B: mmu_model = "PowerPC 64"; break; case POWERPC_MMU_64BRIDGE: mmu_model = "PowerPC 64 bridge"; break; #endif default: mmu_model = "Unknown or invalid"; break; } switch (env->excp_model) { case POWERPC_EXCP_STD: excp_model = "PowerPC"; break; case POWERPC_EXCP_40x: excp_model = "PowerPC 40x"; break; case POWERPC_EXCP_601: excp_model = "PowerPC 601"; break; case POWERPC_EXCP_602: excp_model = "PowerPC 602"; break; case POWERPC_EXCP_603: excp_model = "PowerPC 603"; break; case POWERPC_EXCP_603E: excp_model = "PowerPC 603e"; break; case POWERPC_EXCP_604: excp_model = "PowerPC 604"; break; case POWERPC_EXCP_7x0: excp_model = "PowerPC 740/750"; break; case POWERPC_EXCP_7x5: excp_model = "PowerPC 745/755"; break; case POWERPC_EXCP_74xx: excp_model = "PowerPC 74xx"; break; case POWERPC_EXCP_BOOKE: excp_model = "PowerPC BookE"; break; #if defined (TARGET_PPC64) case POWERPC_EXCP_970: excp_model = "PowerPC 970"; break; #endif default: excp_model = "Unknown or invalid"; break; } switch (env->bus_model) { case PPC_FLAGS_INPUT_6xx: bus_model = "PowerPC 6xx"; break; case PPC_FLAGS_INPUT_BookE: bus_model = "PowerPC BookE"; break; case PPC_FLAGS_INPUT_405: bus_model = "PowerPC 405"; break; case PPC_FLAGS_INPUT_401: bus_model = "PowerPC 401/403"; break; #if defined (TARGET_PPC64) case PPC_FLAGS_INPUT_970: bus_model = "PowerPC 970"; break; #endif default: bus_model = "Unknown or invalid"; break; } printf("PowerPC %-12s : PVR %08x MSR %016" PRIx64 "\n" " MMU model : %s\n", def->name, def->pvr, def->msr_mask, mmu_model); if (env->tlb != NULL) { printf(" %d %s TLB in %d ways\n", env->nb_tlb, env->id_tlbs ? "splitted" : "merged", env->nb_ways); } printf(" Exceptions model : %s\n" " Bus model : %s\n", excp_model, bus_model); } dump_ppc_insns(env); dump_ppc_sprs(env); fflush(stdout); #endif return 0; }
{ "code": [ "#endif", "#endif", " case POWERPC_MMU_64BRIDGE:", " case POWERPC_MMU_64BRIDGE:", " mmu_model = \"PowerPC 64 bridge\";", " break;" ], "line_no": [ 99, 99, 93, 93, 95, 33 ] }
int FUNC_0 (CPUPPCState *VAR_0, ppc_def_t *VAR_1) { VAR_0->msr_mask = VAR_1->msr_mask; VAR_0->mmu_model = VAR_1->mmu_model; VAR_0->excp_model = VAR_1->excp_model; VAR_0->bus_model = VAR_1->bus_model; VAR_0->bfd_mach = VAR_1->bfd_mach; if (create_ppc_opcodes(VAR_0, VAR_1) < 0) return -1; init_ppc_proc(VAR_0, VAR_1); #if defined(PPC_DUMP_CPU) { const unsigned char *mmu_model, *excp_model, *bus_model; switch (VAR_0->mmu_model) { case POWERPC_MMU_32B: mmu_model = "PowerPC 32"; break; case POWERPC_MMU_601: mmu_model = "PowerPC 601"; break; case POWERPC_MMU_SOFT_6xx: mmu_model = "PowerPC 6xx/7xx with software driven TLBs"; break; case POWERPC_MMU_SOFT_74xx: mmu_model = "PowerPC 74xx with software driven TLBs"; break; case POWERPC_MMU_SOFT_4xx: mmu_model = "PowerPC 4xx with software driven TLBs"; break; case POWERPC_MMU_SOFT_4xx_Z: mmu_model = "PowerPC 4xx with software driven TLBs " "and zones protections"; break; case POWERPC_MMU_REAL_4xx: mmu_model = "PowerPC 4xx real mode only"; break; case POWERPC_MMU_BOOKE: mmu_model = "PowerPC BookE"; break; case POWERPC_MMU_BOOKE_FSL: mmu_model = "PowerPC BookE FSL"; break; #if defined (TARGET_PPC64) case POWERPC_MMU_64B: mmu_model = "PowerPC 64"; break; case POWERPC_MMU_64BRIDGE: mmu_model = "PowerPC 64 bridge"; break; #endif default: mmu_model = "Unknown or invalid"; break; } switch (VAR_0->excp_model) { case POWERPC_EXCP_STD: excp_model = "PowerPC"; break; case POWERPC_EXCP_40x: excp_model = "PowerPC 40x"; break; case POWERPC_EXCP_601: excp_model = "PowerPC 601"; break; case POWERPC_EXCP_602: excp_model = "PowerPC 602"; break; case POWERPC_EXCP_603: excp_model = "PowerPC 603"; break; case POWERPC_EXCP_603E: excp_model = "PowerPC 603e"; break; case POWERPC_EXCP_604: excp_model = "PowerPC 604"; break; case POWERPC_EXCP_7x0: excp_model = "PowerPC 740/750"; break; case POWERPC_EXCP_7x5: excp_model = "PowerPC 745/755"; break; case POWERPC_EXCP_74xx: excp_model = "PowerPC 74xx"; break; case POWERPC_EXCP_BOOKE: excp_model = "PowerPC BookE"; break; #if defined (TARGET_PPC64) case POWERPC_EXCP_970: excp_model = "PowerPC 970"; break; #endif default: excp_model = "Unknown or invalid"; break; } switch (VAR_0->bus_model) { case PPC_FLAGS_INPUT_6xx: bus_model = "PowerPC 6xx"; break; case PPC_FLAGS_INPUT_BookE: bus_model = "PowerPC BookE"; break; case PPC_FLAGS_INPUT_405: bus_model = "PowerPC 405"; break; case PPC_FLAGS_INPUT_401: bus_model = "PowerPC 401/403"; break; #if defined (TARGET_PPC64) case PPC_FLAGS_INPUT_970: bus_model = "PowerPC 970"; break; #endif default: bus_model = "Unknown or invalid"; break; } printf("PowerPC %-12s : PVR %08x MSR %016" PRIx64 "\n" " MMU model : %s\n", VAR_1->name, VAR_1->pvr, VAR_1->msr_mask, mmu_model); if (VAR_0->tlb != NULL) { printf(" %d %s TLB in %d ways\n", VAR_0->nb_tlb, VAR_0->id_tlbs ? "splitted" : "merged", VAR_0->nb_ways); } printf(" Exceptions model : %s\n" " Bus model : %s\n", excp_model, bus_model); } dump_ppc_insns(VAR_0); dump_ppc_sprs(VAR_0); fflush(stdout); #endif return 0; }
[ "int FUNC_0 (CPUPPCState *VAR_0, ppc_def_t *VAR_1)\n{", "VAR_0->msr_mask = VAR_1->msr_mask;", "VAR_0->mmu_model = VAR_1->mmu_model;", "VAR_0->excp_model = VAR_1->excp_model;", "VAR_0->bus_model = VAR_1->bus_model;", "VAR_0->bfd_mach = VAR_1->bfd_mach;", "if (create_ppc_opcodes(VAR_0, VAR_1) < 0)\nreturn -1;", "init_ppc_proc(VAR_0, VAR_1);", "#if defined(PPC_DUMP_CPU)\n{", "const unsigned char *mmu_model, *excp_model, *bus_model;", "switch (VAR_0->mmu_model) {", "case POWERPC_MMU_32B:\nmmu_model = \"PowerPC 32\";", "break;", "case POWERPC_MMU_601:\nmmu_model = \"PowerPC 601\";", "break;", "case POWERPC_MMU_SOFT_6xx:\nmmu_model = \"PowerPC 6xx/7xx with software driven TLBs\";", "break;", "case POWERPC_MMU_SOFT_74xx:\nmmu_model = \"PowerPC 74xx with software driven TLBs\";", "break;", "case POWERPC_MMU_SOFT_4xx:\nmmu_model = \"PowerPC 4xx with software driven TLBs\";", "break;", "case POWERPC_MMU_SOFT_4xx_Z:\nmmu_model = \"PowerPC 4xx with software driven TLBs \"\n\"and zones protections\";", "break;", "case POWERPC_MMU_REAL_4xx:\nmmu_model = \"PowerPC 4xx real mode only\";", "break;", "case POWERPC_MMU_BOOKE:\nmmu_model = \"PowerPC BookE\";", "break;", "case POWERPC_MMU_BOOKE_FSL:\nmmu_model = \"PowerPC BookE FSL\";", "break;", "#if defined (TARGET_PPC64)\ncase POWERPC_MMU_64B:\nmmu_model = \"PowerPC 64\";", "break;", "case POWERPC_MMU_64BRIDGE:\nmmu_model = \"PowerPC 64 bridge\";", "break;", "#endif\ndefault:\nmmu_model = \"Unknown or invalid\";", "break;", "}", "switch (VAR_0->excp_model) {", "case POWERPC_EXCP_STD:\nexcp_model = \"PowerPC\";", "break;", "case POWERPC_EXCP_40x:\nexcp_model = \"PowerPC 40x\";", "break;", "case POWERPC_EXCP_601:\nexcp_model = \"PowerPC 601\";", "break;", "case POWERPC_EXCP_602:\nexcp_model = \"PowerPC 602\";", "break;", "case POWERPC_EXCP_603:\nexcp_model = \"PowerPC 603\";", "break;", "case POWERPC_EXCP_603E:\nexcp_model = \"PowerPC 603e\";", "break;", "case POWERPC_EXCP_604:\nexcp_model = \"PowerPC 604\";", "break;", "case POWERPC_EXCP_7x0:\nexcp_model = \"PowerPC 740/750\";", "break;", "case POWERPC_EXCP_7x5:\nexcp_model = \"PowerPC 745/755\";", "break;", "case POWERPC_EXCP_74xx:\nexcp_model = \"PowerPC 74xx\";", "break;", "case POWERPC_EXCP_BOOKE:\nexcp_model = \"PowerPC BookE\";", "break;", "#if defined (TARGET_PPC64)\ncase POWERPC_EXCP_970:\nexcp_model = \"PowerPC 970\";", "break;", "#endif\ndefault:\nexcp_model = \"Unknown or invalid\";", "break;", "}", "switch (VAR_0->bus_model) {", "case PPC_FLAGS_INPUT_6xx:\nbus_model = \"PowerPC 6xx\";", "break;", "case PPC_FLAGS_INPUT_BookE:\nbus_model = \"PowerPC BookE\";", "break;", "case PPC_FLAGS_INPUT_405:\nbus_model = \"PowerPC 405\";", "break;", "case PPC_FLAGS_INPUT_401:\nbus_model = \"PowerPC 401/403\";", "break;", "#if defined (TARGET_PPC64)\ncase PPC_FLAGS_INPUT_970:\nbus_model = \"PowerPC 970\";", "break;", "#endif\ndefault:\nbus_model = \"Unknown or invalid\";", "break;", "}", "printf(\"PowerPC %-12s : PVR %08x MSR %016\" PRIx64 \"\\n\"\n\" MMU model : %s\\n\",\nVAR_1->name, VAR_1->pvr, VAR_1->msr_mask, mmu_model);", "if (VAR_0->tlb != NULL) {", "printf(\" %d %s TLB in %d ways\\n\",\nVAR_0->nb_tlb, VAR_0->id_tlbs ? \"splitted\" : \"merged\",\nVAR_0->nb_ways);", "}", "printf(\" Exceptions model : %s\\n\"\n\" Bus model : %s\\n\",\nexcp_model, bus_model);", "}", "dump_ppc_insns(VAR_0);", "dump_ppc_sprs(VAR_0);", "fflush(stdout);", "#endif\nreturn 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 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 ], [ 35, 37 ], [ 39 ], [ 41, 43 ], [ 45 ], [ 47, 49 ], [ 51 ], [ 53, 55 ], [ 57 ], [ 59, 61, 63 ], [ 65 ], [ 67, 69 ], [ 71 ], [ 73, 75 ], [ 77 ], [ 79, 81 ], [ 83 ], [ 85, 87, 89 ], [ 91 ], [ 93, 95 ], [ 97 ], [ 99, 101, 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111, 113 ], [ 115 ], [ 117, 119 ], [ 121 ], [ 123, 125 ], [ 127 ], [ 129, 131 ], [ 133 ], [ 135, 137 ], [ 139 ], [ 141, 143 ], [ 145 ], [ 147, 149 ], [ 151 ], [ 153, 155 ], [ 157 ], [ 159, 161 ], [ 163 ], [ 165, 167 ], [ 169 ], [ 171, 173 ], [ 175 ], [ 177, 179, 181 ], [ 183 ], [ 185, 187, 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197, 199 ], [ 201 ], [ 203, 205 ], [ 207 ], [ 209, 211 ], [ 213 ], [ 215, 217 ], [ 219 ], [ 221, 223, 225 ], [ 227 ], [ 229, 231, 233 ], [ 235 ], [ 237 ], [ 239, 241, 243 ], [ 245 ], [ 247, 249, 251 ], [ 253 ], [ 255, 257, 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269, 273 ], [ 275 ] ]
18,473
static uint64_t unin_data_read(void *opaque, hwaddr addr, unsigned len) { UNINState *s = opaque; PCIHostState *phb = PCI_HOST_BRIDGE(s); uint32_t val; val = pci_data_read(phb->bus, unin_get_config_reg(phb->config_reg, addr), len); UNIN_DPRINTF("read addr %" TARGET_FMT_plx " len %d val %x\n", addr, len, val); return val; }
true
qemu
2f448e415f364d0ec4c5556993e44ca183e31c5c
static uint64_t unin_data_read(void *opaque, hwaddr addr, unsigned len) { UNINState *s = opaque; PCIHostState *phb = PCI_HOST_BRIDGE(s); uint32_t val; val = pci_data_read(phb->bus, unin_get_config_reg(phb->config_reg, addr), len); UNIN_DPRINTF("read addr %" TARGET_FMT_plx " len %d val %x\n", addr, len, val); return val; }
{ "code": [ " UNIN_DPRINTF(\"read addr %\" TARGET_FMT_plx \" len %d val %x\\n\"," ], "line_no": [ 21 ] }
static uint64_t FUNC_0(void *opaque, hwaddr addr, unsigned len) { UNINState *s = opaque; PCIHostState *phb = PCI_HOST_BRIDGE(s); uint32_t val; val = pci_data_read(phb->bus, unin_get_config_reg(phb->config_reg, addr), len); UNIN_DPRINTF("read addr %" TARGET_FMT_plx " len %d val %x\n", addr, len, val); return val; }
[ "static uint64_t FUNC_0(void *opaque, hwaddr addr,\nunsigned len)\n{", "UNINState *s = opaque;", "PCIHostState *phb = PCI_HOST_BRIDGE(s);", "uint32_t val;", "val = pci_data_read(phb->bus,\nunin_get_config_reg(phb->config_reg, addr),\nlen);", "UNIN_DPRINTF(\"read addr %\" TARGET_FMT_plx \" len %d val %x\\n\",\naddr, len, val);", "return val;", "}" ]
[ 0, 0, 0, 0, 0, 1, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15, 17, 19 ], [ 21, 23 ], [ 25 ], [ 27 ] ]
18,475
static void pc_fw_cfg_guest_info(PcGuestInfo *guest_info) { PcRomPciInfo *info; if (!guest_info->has_pci_info || !guest_info->fw_cfg) { return; } info = g_malloc(sizeof *info); info->w32_min = cpu_to_le64(guest_info->pci_info.w32.begin); info->w32_max = cpu_to_le64(guest_info->pci_info.w32.end); info->w64_min = cpu_to_le64(guest_info->pci_info.w64.begin); info->w64_max = cpu_to_le64(guest_info->pci_info.w64.end); /* Pass PCI hole info to guest via a side channel. * Required so guest PCI enumeration does the right thing. */ fw_cfg_add_file(guest_info->fw_cfg, "etc/pci-info", info, sizeof *info); }
true
qemu
398489018183d613306ab022653552247d93919f
static void pc_fw_cfg_guest_info(PcGuestInfo *guest_info) { PcRomPciInfo *info; if (!guest_info->has_pci_info || !guest_info->fw_cfg) { return; } info = g_malloc(sizeof *info); info->w32_min = cpu_to_le64(guest_info->pci_info.w32.begin); info->w32_max = cpu_to_le64(guest_info->pci_info.w32.end); info->w64_min = cpu_to_le64(guest_info->pci_info.w64.begin); info->w64_max = cpu_to_le64(guest_info->pci_info.w64.end); fw_cfg_add_file(guest_info->fw_cfg, "etc/pci-info", info, sizeof *info); }
{ "code": [ " info->w32_min = cpu_to_le64(guest_info->pci_info.w32.begin);", " info->w32_max = cpu_to_le64(guest_info->pci_info.w32.end);", " info->w64_min = cpu_to_le64(guest_info->pci_info.w64.begin);", " info->w64_max = cpu_to_le64(guest_info->pci_info.w64.end);" ], "line_no": [ 17, 19, 21, 23 ] }
static void FUNC_0(PcGuestInfo *VAR_0) { PcRomPciInfo *info; if (!VAR_0->has_pci_info || !VAR_0->fw_cfg) { return; } info = g_malloc(sizeof *info); info->w32_min = cpu_to_le64(VAR_0->pci_info.w32.begin); info->w32_max = cpu_to_le64(VAR_0->pci_info.w32.end); info->w64_min = cpu_to_le64(VAR_0->pci_info.w64.begin); info->w64_max = cpu_to_le64(VAR_0->pci_info.w64.end); fw_cfg_add_file(VAR_0->fw_cfg, "etc/pci-info", info, sizeof *info); }
[ "static void FUNC_0(PcGuestInfo *VAR_0)\n{", "PcRomPciInfo *info;", "if (!VAR_0->has_pci_info || !VAR_0->fw_cfg) {", "return;", "}", "info = g_malloc(sizeof *info);", "info->w32_min = cpu_to_le64(VAR_0->pci_info.w32.begin);", "info->w32_max = cpu_to_le64(VAR_0->pci_info.w32.end);", "info->w64_min = cpu_to_le64(VAR_0->pci_info.w64.begin);", "info->w64_max = cpu_to_le64(VAR_0->pci_info.w64.end);", "fw_cfg_add_file(VAR_0->fw_cfg, \"etc/pci-info\", info, sizeof *info);", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 29 ], [ 31 ] ]
18,476
static void set_sel_time(IPMIBmcSim *ibs, uint8_t *cmd, unsigned int cmd_len, uint8_t *rsp, unsigned int *rsp_len, unsigned int max_rsp_len) { uint32_t val; struct ipmi_time now; IPMI_CHECK_CMD_LEN(6); val = cmd[2] | (cmd[3] << 8) | (cmd[4] << 16) | (cmd[5] << 24); ipmi_gettime(&now); ibs->sel.time_offset = now.tv_sec - ((long) val); }
true
qemu
4f298a4b2957b7833bc607c951ca27c458d98d88
static void set_sel_time(IPMIBmcSim *ibs, uint8_t *cmd, unsigned int cmd_len, uint8_t *rsp, unsigned int *rsp_len, unsigned int max_rsp_len) { uint32_t val; struct ipmi_time now; IPMI_CHECK_CMD_LEN(6); val = cmd[2] | (cmd[3] << 8) | (cmd[4] << 16) | (cmd[5] << 24); ipmi_gettime(&now); ibs->sel.time_offset = now.tv_sec - ((long) val); }
{ "code": [ " IPMI_CHECK_CMD_LEN(6);" ], "line_no": [ 17 ] }
static void FUNC_0(IPMIBmcSim *VAR_0, uint8_t *VAR_1, unsigned int VAR_2, uint8_t *VAR_3, unsigned int *VAR_4, unsigned int VAR_5) { uint32_t val; struct ipmi_time VAR_6; IPMI_CHECK_CMD_LEN(6); val = VAR_1[2] | (VAR_1[3] << 8) | (VAR_1[4] << 16) | (VAR_1[5] << 24); ipmi_gettime(&VAR_6); VAR_0->sel.time_offset = VAR_6.tv_sec - ((long) val); }
[ "static void FUNC_0(IPMIBmcSim *VAR_0,\nuint8_t *VAR_1, unsigned int VAR_2,\nuint8_t *VAR_3, unsigned int *VAR_4,\nunsigned int VAR_5)\n{", "uint32_t val;", "struct ipmi_time VAR_6;", "IPMI_CHECK_CMD_LEN(6);", "val = VAR_1[2] | (VAR_1[3] << 8) | (VAR_1[4] << 16) | (VAR_1[5] << 24);", "ipmi_gettime(&VAR_6);", "VAR_0->sel.time_offset = VAR_6.tv_sec - ((long) val);", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ] ]
18,478
static inline void vring_used_write(VirtQueue *vq, VRingUsedElem *uelem, int i) { VRingMemoryRegionCaches *caches = atomic_rcu_read(&vq->vring.caches); hwaddr pa = offsetof(VRingUsed, ring[i]); virtio_tswap32s(vq->vdev, &uelem->id); virtio_tswap32s(vq->vdev, &uelem->len); address_space_write_cached(&caches->used, pa, uelem, sizeof(VRingUsedElem)); address_space_cache_invalidate(&caches->used, pa, sizeof(VRingUsedElem)); }
true
qemu
e0e2d644096c79a71099b176d08f465f6803a8b1
static inline void vring_used_write(VirtQueue *vq, VRingUsedElem *uelem, int i) { VRingMemoryRegionCaches *caches = atomic_rcu_read(&vq->vring.caches); hwaddr pa = offsetof(VRingUsed, ring[i]); virtio_tswap32s(vq->vdev, &uelem->id); virtio_tswap32s(vq->vdev, &uelem->len); address_space_write_cached(&caches->used, pa, uelem, sizeof(VRingUsedElem)); address_space_cache_invalidate(&caches->used, pa, sizeof(VRingUsedElem)); }
{ "code": [ " VRingMemoryRegionCaches *caches = atomic_rcu_read(&vq->vring.caches);", " VRingMemoryRegionCaches *caches = atomic_rcu_read(&vq->vring.caches);", " VRingMemoryRegionCaches *caches = atomic_rcu_read(&vq->vring.caches);", " VRingMemoryRegionCaches *caches = atomic_rcu_read(&vq->vring.caches);", " VRingMemoryRegionCaches *caches = atomic_rcu_read(&vq->vring.caches);", " VRingMemoryRegionCaches *caches = atomic_rcu_read(&vq->vring.caches);", " VRingMemoryRegionCaches *caches = atomic_rcu_read(&vq->vring.caches);", " VRingMemoryRegionCaches *caches = atomic_rcu_read(&vq->vring.caches);" ], "line_no": [ 7, 7, 7, 7, 7, 7, 7, 7 ] }
static inline void FUNC_0(VirtQueue *VAR_0, VRingUsedElem *VAR_1, int VAR_2) { VRingMemoryRegionCaches *caches = atomic_rcu_read(&VAR_0->vring.caches); hwaddr pa = offsetof(VRingUsed, ring[VAR_2]); virtio_tswap32s(VAR_0->vdev, &VAR_1->id); virtio_tswap32s(VAR_0->vdev, &VAR_1->len); address_space_write_cached(&caches->used, pa, VAR_1, sizeof(VRingUsedElem)); address_space_cache_invalidate(&caches->used, pa, sizeof(VRingUsedElem)); }
[ "static inline void FUNC_0(VirtQueue *VAR_0, VRingUsedElem *VAR_1,\nint VAR_2)\n{", "VRingMemoryRegionCaches *caches = atomic_rcu_read(&VAR_0->vring.caches);", "hwaddr pa = offsetof(VRingUsed, ring[VAR_2]);", "virtio_tswap32s(VAR_0->vdev, &VAR_1->id);", "virtio_tswap32s(VAR_0->vdev, &VAR_1->len);", "address_space_write_cached(&caches->used, pa, VAR_1, sizeof(VRingUsedElem));", "address_space_cache_invalidate(&caches->used, pa, sizeof(VRingUsedElem));", "}" ]
[ 0, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ] ]
18,479
static void integratorcm_init(int memsz, uint32_t flash_offset) { int iomemtype; integratorcm_state *s; s = (integratorcm_state *)qemu_mallocz(sizeof(integratorcm_state)); s->cm_osc = 0x01000048; /* ??? What should the high bits of this value be? */ s->cm_auxosc = 0x0007feff; s->cm_sdram = 0x00011122; if (memsz >= 256) { integrator_spd[31] = 64; s->cm_sdram |= 0x10; } else if (memsz >= 128) { integrator_spd[31] = 32; s->cm_sdram |= 0x0c; } else if (memsz >= 64) { integrator_spd[31] = 16; s->cm_sdram |= 0x08; } else if (memsz >= 32) { integrator_spd[31] = 4; s->cm_sdram |= 0x04; } else { integrator_spd[31] = 2; } memcpy(integrator_spd + 73, "QEMU-MEMORY", 11); s->cm_init = 0x00000112; s->flash_offset = flash_offset; iomemtype = cpu_register_io_memory(0, integratorcm_readfn, integratorcm_writefn, s); cpu_register_physical_memory(0x10000000, 0x007fffff, iomemtype); integratorcm_do_remap(s, 1); /* ??? Save/restore. */ }
true
qemu
187337f8b0ec0813dd3876d1efe37d415fb81c2e
static void integratorcm_init(int memsz, uint32_t flash_offset) { int iomemtype; integratorcm_state *s; s = (integratorcm_state *)qemu_mallocz(sizeof(integratorcm_state)); s->cm_osc = 0x01000048; s->cm_auxosc = 0x0007feff; s->cm_sdram = 0x00011122; if (memsz >= 256) { integrator_spd[31] = 64; s->cm_sdram |= 0x10; } else if (memsz >= 128) { integrator_spd[31] = 32; s->cm_sdram |= 0x0c; } else if (memsz >= 64) { integrator_spd[31] = 16; s->cm_sdram |= 0x08; } else if (memsz >= 32) { integrator_spd[31] = 4; s->cm_sdram |= 0x04; } else { integrator_spd[31] = 2; } memcpy(integrator_spd + 73, "QEMU-MEMORY", 11); s->cm_init = 0x00000112; s->flash_offset = flash_offset; iomemtype = cpu_register_io_memory(0, integratorcm_readfn, integratorcm_writefn, s); cpu_register_physical_memory(0x10000000, 0x007fffff, iomemtype); integratorcm_do_remap(s, 1); }
{ "code": [ " cpu_register_physical_memory(0x10000000, 0x007fffff, iomemtype);" ], "line_no": [ 63 ] }
static void FUNC_0(int VAR_0, uint32_t VAR_1) { int VAR_2; integratorcm_state *s; s = (integratorcm_state *)qemu_mallocz(sizeof(integratorcm_state)); s->cm_osc = 0x01000048; s->cm_auxosc = 0x0007feff; s->cm_sdram = 0x00011122; if (VAR_0 >= 256) { integrator_spd[31] = 64; s->cm_sdram |= 0x10; } else if (VAR_0 >= 128) { integrator_spd[31] = 32; s->cm_sdram |= 0x0c; } else if (VAR_0 >= 64) { integrator_spd[31] = 16; s->cm_sdram |= 0x08; } else if (VAR_0 >= 32) { integrator_spd[31] = 4; s->cm_sdram |= 0x04; } else { integrator_spd[31] = 2; } memcpy(integrator_spd + 73, "QEMU-MEMORY", 11); s->cm_init = 0x00000112; s->VAR_1 = VAR_1; VAR_2 = cpu_register_io_memory(0, integratorcm_readfn, integratorcm_writefn, s); cpu_register_physical_memory(0x10000000, 0x007fffff, VAR_2); integratorcm_do_remap(s, 1); }
[ "static void FUNC_0(int VAR_0, uint32_t VAR_1)\n{", "int VAR_2;", "integratorcm_state *s;", "s = (integratorcm_state *)qemu_mallocz(sizeof(integratorcm_state));", "s->cm_osc = 0x01000048;", "s->cm_auxosc = 0x0007feff;", "s->cm_sdram = 0x00011122;", "if (VAR_0 >= 256) {", "integrator_spd[31] = 64;", "s->cm_sdram |= 0x10;", "} else if (VAR_0 >= 128) {", "integrator_spd[31] = 32;", "s->cm_sdram |= 0x0c;", "} else if (VAR_0 >= 64) {", "integrator_spd[31] = 16;", "s->cm_sdram |= 0x08;", "} else if (VAR_0 >= 32) {", "integrator_spd[31] = 4;", "s->cm_sdram |= 0x04;", "} else {", "integrator_spd[31] = 2;", "}", "memcpy(integrator_spd + 73, \"QEMU-MEMORY\", 11);", "s->cm_init = 0x00000112;", "s->VAR_1 = VAR_1;", "VAR_2 = cpu_register_io_memory(0, integratorcm_readfn,\nintegratorcm_writefn, s);", "cpu_register_physical_memory(0x10000000, 0x007fffff, VAR_2);", "integratorcm_do_remap(s, 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, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59, 61 ], [ 63 ], [ 65 ], [ 69 ] ]
18,480
static int mlib_YUV2ARGB420_32(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t* dst[], int dstStride[]){ if(c->srcFormat == PIX_FMT_YUV422P){ srcStride[1] *= 2; srcStride[2] *= 2; } assert(srcStride[1] == srcStride[2]); mlib_VideoColorYUV2ARGB420(dst[0]+srcSliceY*dstStride[0], src[0], src[1], src[2], c->dstW, srcSliceH, dstStride[0], srcStride[0], srcStride[1]); return srcSliceH; }
true
FFmpeg
428098165de4c3edfe42c1b7f00627d287015863
static int mlib_YUV2ARGB420_32(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t* dst[], int dstStride[]){ if(c->srcFormat == PIX_FMT_YUV422P){ srcStride[1] *= 2; srcStride[2] *= 2; } assert(srcStride[1] == srcStride[2]); mlib_VideoColorYUV2ARGB420(dst[0]+srcSliceY*dstStride[0], src[0], src[1], src[2], c->dstW, srcSliceH, dstStride[0], srcStride[0], srcStride[1]); return srcSliceH; }
{ "code": [ " int srcSliceH, uint8_t* dst[], int dstStride[]){", "\tsrcStride[1] *= 2;", "\tsrcStride[2] *= 2;", "\t\t\t srcSliceH, dstStride[0], srcStride[0], srcStride[1]);", " int srcSliceH, uint8_t* dst[], int dstStride[]){", "\tsrcStride[1] *= 2;", "\tsrcStride[2] *= 2;", "\t\t\t srcSliceH, dstStride[0], srcStride[0], srcStride[1]);", " int srcSliceH, uint8_t* dst[], int dstStride[]){", "\tsrcStride[1] *= 2;", "\tsrcStride[2] *= 2;", "\t\t\t srcSliceH, dstStride[0], srcStride[0], srcStride[1]);", " int srcSliceH, uint8_t* dst[], int dstStride[]){", "\tsrcStride[1] *= 2;", "\tsrcStride[2] *= 2;", " int srcSliceH, uint8_t* dst[], int dstStride[]){", "\tsrcStride[1] *= 2;", "\tsrcStride[2] *= 2;", " int srcSliceH, uint8_t* dst[], int dstStride[]){", "\tsrcStride[1] *= 2;", "\tsrcStride[2] *= 2;", " int srcSliceH, uint8_t* dst[], int dstStride[]){", "\tsrcStride[1] *= 2;", "\tsrcStride[2] *= 2;" ], "line_no": [ 3, 7, 9, 21, 3, 7, 9, 21, 3, 7, 9, 21, 3, 7, 9, 3, 7, 9, 3, 7, 9, 3, 7, 9 ] }
static int FUNC_0(SwsContext *VAR_0, uint8_t* VAR_1[], int VAR_2[], int VAR_3, int VAR_4, uint8_t* VAR_5[], int VAR_6[]){ if(VAR_0->srcFormat == PIX_FMT_YUV422P){ VAR_2[1] *= 2; VAR_2[2] *= 2; } assert(VAR_2[1] == VAR_2[2]); mlib_VideoColorYUV2ARGB420(VAR_5[0]+VAR_3*VAR_6[0], VAR_1[0], VAR_1[1], VAR_1[2], VAR_0->dstW, VAR_4, VAR_6[0], VAR_2[0], VAR_2[1]); return VAR_4; }
[ "static int FUNC_0(SwsContext *VAR_0, uint8_t* VAR_1[], int VAR_2[], int VAR_3,\nint VAR_4, uint8_t* VAR_5[], int VAR_6[]){", "if(VAR_0->srcFormat == PIX_FMT_YUV422P){", "VAR_2[1] *= 2;", "VAR_2[2] *= 2;", "}", "assert(VAR_2[1] == VAR_2[2]);", "mlib_VideoColorYUV2ARGB420(VAR_5[0]+VAR_3*VAR_6[0], VAR_1[0], VAR_1[1], VAR_1[2], VAR_0->dstW,\nVAR_4, VAR_6[0], VAR_2[0], VAR_2[1]);", "return VAR_4;", "}" ]
[ 1, 0, 1, 1, 0, 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 19, 21 ], [ 23 ], [ 25 ] ]
18,482
int vp78_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt, int is_vp7) { VP8Context *s = avctx->priv_data; int ret, i, referenced, num_jobs; enum AVDiscard skip_thresh; VP8Frame *av_uninit(curframe), *prev_frame; if (is_vp7) ret = vp7_decode_frame_header(s, avpkt->data, avpkt->size); else ret = vp8_decode_frame_header(s, avpkt->data, avpkt->size); if (ret < 0) goto err; prev_frame = s->framep[VP56_FRAME_CURRENT]; referenced = s->update_last || s->update_golden == VP56_FRAME_CURRENT || s->update_altref == VP56_FRAME_CURRENT; skip_thresh = !referenced ? AVDISCARD_NONREF : !s->keyframe ? AVDISCARD_NONKEY : AVDISCARD_ALL; if (avctx->skip_frame >= skip_thresh) { s->invisible = 1; memcpy(&s->next_framep[0], &s->framep[0], sizeof(s->framep[0]) * 4); goto skip_decode; } s->deblock_filter = s->filter.level && avctx->skip_loop_filter < skip_thresh; // release no longer referenced frames for (i = 0; i < 5; i++) if (s->frames[i].tf.f->data[0] && &s->frames[i] != prev_frame && &s->frames[i] != s->framep[VP56_FRAME_PREVIOUS] && &s->frames[i] != s->framep[VP56_FRAME_GOLDEN] && &s->frames[i] != s->framep[VP56_FRAME_GOLDEN2]) vp8_release_frame(s, &s->frames[i]); curframe = s->framep[VP56_FRAME_CURRENT] = vp8_find_free_buffer(s); if (!s->colorspace) avctx->colorspace = AVCOL_SPC_BT470BG; if (s->fullrange) avctx->color_range = AVCOL_RANGE_JPEG; else avctx->color_range = AVCOL_RANGE_MPEG; /* Given that arithmetic probabilities are updated every frame, it's quite * likely that the values we have on a random interframe are complete * junk if we didn't start decode on a keyframe. So just don't display * anything rather than junk. */ if (!s->keyframe && (!s->framep[VP56_FRAME_PREVIOUS] || !s->framep[VP56_FRAME_GOLDEN] || !s->framep[VP56_FRAME_GOLDEN2])) { av_log(avctx, AV_LOG_WARNING, "Discarding interframe without a prior keyframe!\n"); ret = AVERROR_INVALIDDATA; goto err; } curframe->tf.f->key_frame = s->keyframe; curframe->tf.f->pict_type = s->keyframe ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P; if ((ret = vp8_alloc_frame(s, curframe, referenced)) < 0) goto err; // check if golden and altref are swapped if (s->update_altref != VP56_FRAME_NONE) s->next_framep[VP56_FRAME_GOLDEN2] = s->framep[s->update_altref]; else s->next_framep[VP56_FRAME_GOLDEN2] = s->framep[VP56_FRAME_GOLDEN2]; if (s->update_golden != VP56_FRAME_NONE) s->next_framep[VP56_FRAME_GOLDEN] = s->framep[s->update_golden]; else s->next_framep[VP56_FRAME_GOLDEN] = s->framep[VP56_FRAME_GOLDEN]; if (s->update_last) s->next_framep[VP56_FRAME_PREVIOUS] = curframe; else s->next_framep[VP56_FRAME_PREVIOUS] = s->framep[VP56_FRAME_PREVIOUS]; s->next_framep[VP56_FRAME_CURRENT] = curframe; if (avctx->codec->update_thread_context) ff_thread_finish_setup(avctx); s->linesize = curframe->tf.f->linesize[0]; s->uvlinesize = curframe->tf.f->linesize[1]; memset(s->top_nnz, 0, s->mb_width * sizeof(*s->top_nnz)); /* Zero macroblock structures for top/top-left prediction * from outside the frame. */ if (!s->mb_layout) memset(s->macroblocks + s->mb_height * 2 - 1, 0, (s->mb_width + 1) * sizeof(*s->macroblocks)); if (!s->mb_layout && s->keyframe) memset(s->intra4x4_pred_mode_top, DC_PRED, s->mb_width * 4); memset(s->ref_count, 0, sizeof(s->ref_count)); if (s->mb_layout == 1) { // Make sure the previous frame has read its segmentation map, // if we re-use the same map. if (prev_frame && s->segmentation.enabled && !s->segmentation.update_map) ff_thread_await_progress(&prev_frame->tf, 1, 0); if (is_vp7) vp7_decode_mv_mb_modes(avctx, curframe, prev_frame); else vp8_decode_mv_mb_modes(avctx, curframe, prev_frame); } if (avctx->active_thread_type == FF_THREAD_FRAME) num_jobs = 1; else num_jobs = FFMIN(s->num_coeff_partitions, avctx->thread_count); s->num_jobs = num_jobs; s->curframe = curframe; s->prev_frame = prev_frame; s->mv_bounds.mv_min.y = -MARGIN; s->mv_bounds.mv_max.y = ((s->mb_height - 1) << 6) + MARGIN; for (i = 0; i < MAX_THREADS; i++) { VP8ThreadData *td = &s->thread_data[i]; atomic_init(&td->thread_mb_pos, 0); atomic_init(&td->wait_mb_pos, INT_MAX); } if (is_vp7) avctx->execute2(avctx, vp7_decode_mb_row_sliced, s->thread_data, NULL, num_jobs); else avctx->execute2(avctx, vp8_decode_mb_row_sliced, s->thread_data, NULL, num_jobs); ff_thread_report_progress(&curframe->tf, INT_MAX, 0); memcpy(&s->framep[0], &s->next_framep[0], sizeof(s->framep[0]) * 4); skip_decode: // if future frames don't use the updated probabilities, // reset them to the values we saved if (!s->update_probabilities) s->prob[0] = s->prob[1]; if (!s->invisible) { if ((ret = av_frame_ref(data, curframe->tf.f)) < 0) return ret; *got_frame = 1; } return avpkt->size; err: memcpy(&s->next_framep[0], &s->framep[0], sizeof(s->framep[0]) * 4); return ret; }
true
FFmpeg
6b5d3fb26fb4be48e4966e4b1d97c2165538d4ef
int vp78_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt, int is_vp7) { VP8Context *s = avctx->priv_data; int ret, i, referenced, num_jobs; enum AVDiscard skip_thresh; VP8Frame *av_uninit(curframe), *prev_frame; if (is_vp7) ret = vp7_decode_frame_header(s, avpkt->data, avpkt->size); else ret = vp8_decode_frame_header(s, avpkt->data, avpkt->size); if (ret < 0) goto err; prev_frame = s->framep[VP56_FRAME_CURRENT]; referenced = s->update_last || s->update_golden == VP56_FRAME_CURRENT || s->update_altref == VP56_FRAME_CURRENT; skip_thresh = !referenced ? AVDISCARD_NONREF : !s->keyframe ? AVDISCARD_NONKEY : AVDISCARD_ALL; if (avctx->skip_frame >= skip_thresh) { s->invisible = 1; memcpy(&s->next_framep[0], &s->framep[0], sizeof(s->framep[0]) * 4); goto skip_decode; } s->deblock_filter = s->filter.level && avctx->skip_loop_filter < skip_thresh; for (i = 0; i < 5; i++) if (s->frames[i].tf.f->data[0] && &s->frames[i] != prev_frame && &s->frames[i] != s->framep[VP56_FRAME_PREVIOUS] && &s->frames[i] != s->framep[VP56_FRAME_GOLDEN] && &s->frames[i] != s->framep[VP56_FRAME_GOLDEN2]) vp8_release_frame(s, &s->frames[i]); curframe = s->framep[VP56_FRAME_CURRENT] = vp8_find_free_buffer(s); if (!s->colorspace) avctx->colorspace = AVCOL_SPC_BT470BG; if (s->fullrange) avctx->color_range = AVCOL_RANGE_JPEG; else avctx->color_range = AVCOL_RANGE_MPEG; if (!s->keyframe && (!s->framep[VP56_FRAME_PREVIOUS] || !s->framep[VP56_FRAME_GOLDEN] || !s->framep[VP56_FRAME_GOLDEN2])) { av_log(avctx, AV_LOG_WARNING, "Discarding interframe without a prior keyframe!\n"); ret = AVERROR_INVALIDDATA; goto err; } curframe->tf.f->key_frame = s->keyframe; curframe->tf.f->pict_type = s->keyframe ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P; if ((ret = vp8_alloc_frame(s, curframe, referenced)) < 0) goto err; if (s->update_altref != VP56_FRAME_NONE) s->next_framep[VP56_FRAME_GOLDEN2] = s->framep[s->update_altref]; else s->next_framep[VP56_FRAME_GOLDEN2] = s->framep[VP56_FRAME_GOLDEN2]; if (s->update_golden != VP56_FRAME_NONE) s->next_framep[VP56_FRAME_GOLDEN] = s->framep[s->update_golden]; else s->next_framep[VP56_FRAME_GOLDEN] = s->framep[VP56_FRAME_GOLDEN]; if (s->update_last) s->next_framep[VP56_FRAME_PREVIOUS] = curframe; else s->next_framep[VP56_FRAME_PREVIOUS] = s->framep[VP56_FRAME_PREVIOUS]; s->next_framep[VP56_FRAME_CURRENT] = curframe; if (avctx->codec->update_thread_context) ff_thread_finish_setup(avctx); s->linesize = curframe->tf.f->linesize[0]; s->uvlinesize = curframe->tf.f->linesize[1]; memset(s->top_nnz, 0, s->mb_width * sizeof(*s->top_nnz)); if (!s->mb_layout) memset(s->macroblocks + s->mb_height * 2 - 1, 0, (s->mb_width + 1) * sizeof(*s->macroblocks)); if (!s->mb_layout && s->keyframe) memset(s->intra4x4_pred_mode_top, DC_PRED, s->mb_width * 4); memset(s->ref_count, 0, sizeof(s->ref_count)); if (s->mb_layout == 1) { if (prev_frame && s->segmentation.enabled && !s->segmentation.update_map) ff_thread_await_progress(&prev_frame->tf, 1, 0); if (is_vp7) vp7_decode_mv_mb_modes(avctx, curframe, prev_frame); else vp8_decode_mv_mb_modes(avctx, curframe, prev_frame); } if (avctx->active_thread_type == FF_THREAD_FRAME) num_jobs = 1; else num_jobs = FFMIN(s->num_coeff_partitions, avctx->thread_count); s->num_jobs = num_jobs; s->curframe = curframe; s->prev_frame = prev_frame; s->mv_bounds.mv_min.y = -MARGIN; s->mv_bounds.mv_max.y = ((s->mb_height - 1) << 6) + MARGIN; for (i = 0; i < MAX_THREADS; i++) { VP8ThreadData *td = &s->thread_data[i]; atomic_init(&td->thread_mb_pos, 0); atomic_init(&td->wait_mb_pos, INT_MAX); } if (is_vp7) avctx->execute2(avctx, vp7_decode_mb_row_sliced, s->thread_data, NULL, num_jobs); else avctx->execute2(avctx, vp8_decode_mb_row_sliced, s->thread_data, NULL, num_jobs); ff_thread_report_progress(&curframe->tf, INT_MAX, 0); memcpy(&s->framep[0], &s->next_framep[0], sizeof(s->framep[0]) * 4); skip_decode: if (!s->update_probabilities) s->prob[0] = s->prob[1]; if (!s->invisible) { if ((ret = av_frame_ref(data, curframe->tf.f)) < 0) return ret; *got_frame = 1; } return avpkt->size; err: memcpy(&s->next_framep[0], &s->framep[0], sizeof(s->framep[0]) * 4); return ret; }
{ "code": [], "line_no": [] }
int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3, int VAR_4) { VP8Context *s = VAR_0->priv_data; int VAR_5, VAR_6, VAR_7, VAR_8; enum AVDiscard VAR_9; VP8Frame *av_uninit(curframe), *prev_frame; if (VAR_4) VAR_5 = vp7_decode_frame_header(s, VAR_3->VAR_1, VAR_3->size); else VAR_5 = vp8_decode_frame_header(s, VAR_3->VAR_1, VAR_3->size); if (VAR_5 < 0) goto err; prev_frame = s->framep[VP56_FRAME_CURRENT]; VAR_7 = s->update_last || s->update_golden == VP56_FRAME_CURRENT || s->update_altref == VP56_FRAME_CURRENT; VAR_9 = !VAR_7 ? AVDISCARD_NONREF : !s->keyframe ? AVDISCARD_NONKEY : AVDISCARD_ALL; if (VAR_0->skip_frame >= VAR_9) { s->invisible = 1; memcpy(&s->next_framep[0], &s->framep[0], sizeof(s->framep[0]) * 4); goto skip_decode; } s->deblock_filter = s->filter.level && VAR_0->skip_loop_filter < VAR_9; for (VAR_6 = 0; VAR_6 < 5; VAR_6++) if (s->frames[VAR_6].tf.f->VAR_1[0] && &s->frames[VAR_6] != prev_frame && &s->frames[VAR_6] != s->framep[VP56_FRAME_PREVIOUS] && &s->frames[VAR_6] != s->framep[VP56_FRAME_GOLDEN] && &s->frames[VAR_6] != s->framep[VP56_FRAME_GOLDEN2]) vp8_release_frame(s, &s->frames[VAR_6]); curframe = s->framep[VP56_FRAME_CURRENT] = vp8_find_free_buffer(s); if (!s->colorspace) VAR_0->colorspace = AVCOL_SPC_BT470BG; if (s->fullrange) VAR_0->color_range = AVCOL_RANGE_JPEG; else VAR_0->color_range = AVCOL_RANGE_MPEG; if (!s->keyframe && (!s->framep[VP56_FRAME_PREVIOUS] || !s->framep[VP56_FRAME_GOLDEN] || !s->framep[VP56_FRAME_GOLDEN2])) { av_log(VAR_0, AV_LOG_WARNING, "Discarding interframe without a prior keyframe!\n"); VAR_5 = AVERROR_INVALIDDATA; goto err; } curframe->tf.f->key_frame = s->keyframe; curframe->tf.f->pict_type = s->keyframe ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P; if ((VAR_5 = vp8_alloc_frame(s, curframe, VAR_7)) < 0) goto err; if (s->update_altref != VP56_FRAME_NONE) s->next_framep[VP56_FRAME_GOLDEN2] = s->framep[s->update_altref]; else s->next_framep[VP56_FRAME_GOLDEN2] = s->framep[VP56_FRAME_GOLDEN2]; if (s->update_golden != VP56_FRAME_NONE) s->next_framep[VP56_FRAME_GOLDEN] = s->framep[s->update_golden]; else s->next_framep[VP56_FRAME_GOLDEN] = s->framep[VP56_FRAME_GOLDEN]; if (s->update_last) s->next_framep[VP56_FRAME_PREVIOUS] = curframe; else s->next_framep[VP56_FRAME_PREVIOUS] = s->framep[VP56_FRAME_PREVIOUS]; s->next_framep[VP56_FRAME_CURRENT] = curframe; if (VAR_0->codec->update_thread_context) ff_thread_finish_setup(VAR_0); s->linesize = curframe->tf.f->linesize[0]; s->uvlinesize = curframe->tf.f->linesize[1]; memset(s->top_nnz, 0, s->mb_width * sizeof(*s->top_nnz)); if (!s->mb_layout) memset(s->macroblocks + s->mb_height * 2 - 1, 0, (s->mb_width + 1) * sizeof(*s->macroblocks)); if (!s->mb_layout && s->keyframe) memset(s->intra4x4_pred_mode_top, DC_PRED, s->mb_width * 4); memset(s->ref_count, 0, sizeof(s->ref_count)); if (s->mb_layout == 1) { if (prev_frame && s->segmentation.enabled && !s->segmentation.update_map) ff_thread_await_progress(&prev_frame->tf, 1, 0); if (VAR_4) vp7_decode_mv_mb_modes(VAR_0, curframe, prev_frame); else vp8_decode_mv_mb_modes(VAR_0, curframe, prev_frame); } if (VAR_0->active_thread_type == FF_THREAD_FRAME) VAR_8 = 1; else VAR_8 = FFMIN(s->num_coeff_partitions, VAR_0->thread_count); s->VAR_8 = VAR_8; s->curframe = curframe; s->prev_frame = prev_frame; s->mv_bounds.mv_min.y = -MARGIN; s->mv_bounds.mv_max.y = ((s->mb_height - 1) << 6) + MARGIN; for (VAR_6 = 0; VAR_6 < MAX_THREADS; VAR_6++) { VP8ThreadData *td = &s->thread_data[VAR_6]; atomic_init(&td->thread_mb_pos, 0); atomic_init(&td->wait_mb_pos, INT_MAX); } if (VAR_4) VAR_0->execute2(VAR_0, vp7_decode_mb_row_sliced, s->thread_data, NULL, VAR_8); else VAR_0->execute2(VAR_0, vp8_decode_mb_row_sliced, s->thread_data, NULL, VAR_8); ff_thread_report_progress(&curframe->tf, INT_MAX, 0); memcpy(&s->framep[0], &s->next_framep[0], sizeof(s->framep[0]) * 4); skip_decode: if (!s->update_probabilities) s->prob[0] = s->prob[1]; if (!s->invisible) { if ((VAR_5 = av_frame_ref(VAR_1, curframe->tf.f)) < 0) return VAR_5; *VAR_2 = 1; } return VAR_3->size; err: memcpy(&s->next_framep[0], &s->framep[0], sizeof(s->framep[0]) * 4); return VAR_5; }
[ "int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2,\nAVPacket *VAR_3, int VAR_4)\n{", "VP8Context *s = VAR_0->priv_data;", "int VAR_5, VAR_6, VAR_7, VAR_8;", "enum AVDiscard VAR_9;", "VP8Frame *av_uninit(curframe), *prev_frame;", "if (VAR_4)\nVAR_5 = vp7_decode_frame_header(s, VAR_3->VAR_1, VAR_3->size);", "else\nVAR_5 = vp8_decode_frame_header(s, VAR_3->VAR_1, VAR_3->size);", "if (VAR_5 < 0)\ngoto err;", "prev_frame = s->framep[VP56_FRAME_CURRENT];", "VAR_7 = s->update_last || s->update_golden == VP56_FRAME_CURRENT ||\ns->update_altref == VP56_FRAME_CURRENT;", "VAR_9 = !VAR_7 ? AVDISCARD_NONREF\n: !s->keyframe ? AVDISCARD_NONKEY\n: AVDISCARD_ALL;", "if (VAR_0->skip_frame >= VAR_9) {", "s->invisible = 1;", "memcpy(&s->next_framep[0], &s->framep[0], sizeof(s->framep[0]) * 4);", "goto skip_decode;", "}", "s->deblock_filter = s->filter.level && VAR_0->skip_loop_filter < VAR_9;", "for (VAR_6 = 0; VAR_6 < 5; VAR_6++)", "if (s->frames[VAR_6].tf.f->VAR_1[0] &&\n&s->frames[VAR_6] != prev_frame &&\n&s->frames[VAR_6] != s->framep[VP56_FRAME_PREVIOUS] &&\n&s->frames[VAR_6] != s->framep[VP56_FRAME_GOLDEN] &&\n&s->frames[VAR_6] != s->framep[VP56_FRAME_GOLDEN2])\nvp8_release_frame(s, &s->frames[VAR_6]);", "curframe = s->framep[VP56_FRAME_CURRENT] = vp8_find_free_buffer(s);", "if (!s->colorspace)\nVAR_0->colorspace = AVCOL_SPC_BT470BG;", "if (s->fullrange)\nVAR_0->color_range = AVCOL_RANGE_JPEG;", "else\nVAR_0->color_range = AVCOL_RANGE_MPEG;", "if (!s->keyframe && (!s->framep[VP56_FRAME_PREVIOUS] ||\n!s->framep[VP56_FRAME_GOLDEN] ||\n!s->framep[VP56_FRAME_GOLDEN2])) {", "av_log(VAR_0, AV_LOG_WARNING,\n\"Discarding interframe without a prior keyframe!\\n\");", "VAR_5 = AVERROR_INVALIDDATA;", "goto err;", "}", "curframe->tf.f->key_frame = s->keyframe;", "curframe->tf.f->pict_type = s->keyframe ? AV_PICTURE_TYPE_I\n: AV_PICTURE_TYPE_P;", "if ((VAR_5 = vp8_alloc_frame(s, curframe, VAR_7)) < 0)\ngoto err;", "if (s->update_altref != VP56_FRAME_NONE)\ns->next_framep[VP56_FRAME_GOLDEN2] = s->framep[s->update_altref];", "else\ns->next_framep[VP56_FRAME_GOLDEN2] = s->framep[VP56_FRAME_GOLDEN2];", "if (s->update_golden != VP56_FRAME_NONE)\ns->next_framep[VP56_FRAME_GOLDEN] = s->framep[s->update_golden];", "else\ns->next_framep[VP56_FRAME_GOLDEN] = s->framep[VP56_FRAME_GOLDEN];", "if (s->update_last)\ns->next_framep[VP56_FRAME_PREVIOUS] = curframe;", "else\ns->next_framep[VP56_FRAME_PREVIOUS] = s->framep[VP56_FRAME_PREVIOUS];", "s->next_framep[VP56_FRAME_CURRENT] = curframe;", "if (VAR_0->codec->update_thread_context)\nff_thread_finish_setup(VAR_0);", "s->linesize = curframe->tf.f->linesize[0];", "s->uvlinesize = curframe->tf.f->linesize[1];", "memset(s->top_nnz, 0, s->mb_width * sizeof(*s->top_nnz));", "if (!s->mb_layout)\nmemset(s->macroblocks + s->mb_height * 2 - 1, 0,\n(s->mb_width + 1) * sizeof(*s->macroblocks));", "if (!s->mb_layout && s->keyframe)\nmemset(s->intra4x4_pred_mode_top, DC_PRED, s->mb_width * 4);", "memset(s->ref_count, 0, sizeof(s->ref_count));", "if (s->mb_layout == 1) {", "if (prev_frame && s->segmentation.enabled &&\n!s->segmentation.update_map)\nff_thread_await_progress(&prev_frame->tf, 1, 0);", "if (VAR_4)\nvp7_decode_mv_mb_modes(VAR_0, curframe, prev_frame);", "else\nvp8_decode_mv_mb_modes(VAR_0, curframe, prev_frame);", "}", "if (VAR_0->active_thread_type == FF_THREAD_FRAME)\nVAR_8 = 1;", "else\nVAR_8 = FFMIN(s->num_coeff_partitions, VAR_0->thread_count);", "s->VAR_8 = VAR_8;", "s->curframe = curframe;", "s->prev_frame = prev_frame;", "s->mv_bounds.mv_min.y = -MARGIN;", "s->mv_bounds.mv_max.y = ((s->mb_height - 1) << 6) + MARGIN;", "for (VAR_6 = 0; VAR_6 < MAX_THREADS; VAR_6++) {", "VP8ThreadData *td = &s->thread_data[VAR_6];", "atomic_init(&td->thread_mb_pos, 0);", "atomic_init(&td->wait_mb_pos, INT_MAX);", "}", "if (VAR_4)\nVAR_0->execute2(VAR_0, vp7_decode_mb_row_sliced, s->thread_data, NULL,\nVAR_8);", "else\nVAR_0->execute2(VAR_0, vp8_decode_mb_row_sliced, s->thread_data, NULL,\nVAR_8);", "ff_thread_report_progress(&curframe->tf, INT_MAX, 0);", "memcpy(&s->framep[0], &s->next_framep[0], sizeof(s->framep[0]) * 4);", "skip_decode:\nif (!s->update_probabilities)\ns->prob[0] = s->prob[1];", "if (!s->invisible) {", "if ((VAR_5 = av_frame_ref(VAR_1, curframe->tf.f)) < 0)\nreturn VAR_5;", "*VAR_2 = 1;", "}", "return VAR_3->size;", "err:\nmemcpy(&s->next_framep[0], &s->framep[0], sizeof(s->framep[0]) * 4);", "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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2, 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ], [ 8, 9 ], [ 10, 11 ], [ 12, 13 ], [ 14 ], [ 15, 16 ], [ 17, 18, 19 ], [ 20 ], [ 21 ], [ 22 ], [ 23 ], [ 24 ], [ 25 ], [ 27 ], [ 28, 29, 30, 31, 32, 33 ], [ 34 ], [ 35, 36 ], [ 37, 38 ], [ 39, 40 ], [ 45, 46, 47 ], [ 48, 49 ], [ 50 ], [ 51 ], [ 52 ], [ 53 ], [ 54, 55 ], [ 56, 57 ], [ 59, 60 ], [ 61, 62 ], [ 63, 64 ], [ 65, 66 ], [ 67, 68 ], [ 69, 70 ], [ 71 ], [ 72, 73 ], [ 74 ], [ 75 ], [ 76 ], [ 79, 80, 81 ], [ 82, 83 ], [ 84 ], [ 85 ], [ 88, 89, 90 ], [ 91, 92 ], [ 93, 94 ], [ 95 ], [ 96, 97 ], [ 98, 99 ], [ 100 ], [ 101 ], [ 102 ], [ 103 ], [ 104 ], [ 105 ], [ 106 ], [ 107 ], [ 108 ], [ 109 ], [ 110, 111, 112 ], [ 113, 114, 115 ], [ 116 ], [ 117 ], [ 118, 121, 122 ], [ 123 ], [ 124, 125 ], [ 126 ], [ 127 ], [ 128 ], [ 129, 130 ], [ 131 ], [ 132 ] ]
18,483
static void execute_async(DWORD WINAPI (*func)(LPVOID), LPVOID opaque, Error **errp) { Error *local_err = NULL; if (error_is_set(errp)) { return; } HANDLE thread = CreateThread(NULL, 0, func, opaque, 0, NULL); if (!thread) { error_set(&local_err, QERR_QGA_COMMAND_FAILED, "failed to dispatch asynchronous command"); error_propagate(errp, local_err); } }
true
qemu
5e54769c921a3d8cd8858444f5a3fa62cc44260e
static void execute_async(DWORD WINAPI (*func)(LPVOID), LPVOID opaque, Error **errp) { Error *local_err = NULL; if (error_is_set(errp)) { return; } HANDLE thread = CreateThread(NULL, 0, func, opaque, 0, NULL); if (!thread) { error_set(&local_err, QERR_QGA_COMMAND_FAILED, "failed to dispatch asynchronous command"); error_propagate(errp, local_err); } }
{ "code": [ " if (error_is_set(errp)) {", " if (error_is_set(errp)) {", " if (error_is_set(errp)) {" ], "line_no": [ 11, 11, 11 ] }
static void FUNC_0(DWORD VAR_0 (*func)(LPVOID), LPVOID VAR_1, Error **VAR_2) { Error *local_err = NULL; if (error_is_set(VAR_2)) { return; } HANDLE thread = CreateThread(NULL, 0, func, VAR_1, 0, NULL); if (!thread) { error_set(&local_err, QERR_QGA_COMMAND_FAILED, "failed to dispatch asynchronous command"); error_propagate(VAR_2, local_err); } }
[ "static void FUNC_0(DWORD VAR_0 (*func)(LPVOID), LPVOID VAR_1,\nError **VAR_2)\n{", "Error *local_err = NULL;", "if (error_is_set(VAR_2)) {", "return;", "}", "HANDLE thread = CreateThread(NULL, 0, func, VAR_1, 0, NULL);", "if (!thread) {", "error_set(&local_err, QERR_QGA_COMMAND_FAILED,\n\"failed to dispatch asynchronous command\");", "error_propagate(VAR_2, local_err);", "}", "}" ]
[ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21, 23 ], [ 25 ], [ 27 ], [ 29 ] ]
18,484
static void spr_read_tbu(DisasContext *ctx, int gprn, int sprn) { if (ctx->tb->cflags & CF_USE_ICOUNT) { gen_io_start(); } gen_helper_load_tbu(cpu_gpr[gprn], cpu_env); if (ctx->tb->cflags & CF_USE_ICOUNT) { gen_io_end(); gen_stop_exception(ctx); } }
true
qemu
c5a49c63fa26e8825ad101dfe86339ae4c216539
static void spr_read_tbu(DisasContext *ctx, int gprn, int sprn) { if (ctx->tb->cflags & CF_USE_ICOUNT) { gen_io_start(); } gen_helper_load_tbu(cpu_gpr[gprn], cpu_env); if (ctx->tb->cflags & CF_USE_ICOUNT) { gen_io_end(); gen_stop_exception(ctx); } }
{ "code": [ " if (ctx->tb->cflags & CF_USE_ICOUNT) {", " if (ctx->tb->cflags & CF_USE_ICOUNT) {", " if (ctx->tb->cflags & CF_USE_ICOUNT) {", " if (ctx->tb->cflags & CF_USE_ICOUNT) {", " if (ctx->tb->cflags & CF_USE_ICOUNT) {", " if (ctx->tb->cflags & CF_USE_ICOUNT) {", " if (ctx->tb->cflags & CF_USE_ICOUNT) {", " if (ctx->tb->cflags & CF_USE_ICOUNT) {", " if (ctx->tb->cflags & CF_USE_ICOUNT) {", " if (ctx->tb->cflags & CF_USE_ICOUNT) {", " if (ctx->tb->cflags & CF_USE_ICOUNT) {", " if (ctx->tb->cflags & CF_USE_ICOUNT) {", " if (ctx->tb->cflags & CF_USE_ICOUNT) {", " if (ctx->tb->cflags & CF_USE_ICOUNT) {", " if (ctx->tb->cflags & CF_USE_ICOUNT) {", " if (ctx->tb->cflags & CF_USE_ICOUNT) {", " if (ctx->tb->cflags & CF_USE_ICOUNT) {", " if (ctx->tb->cflags & CF_USE_ICOUNT) {", " if (ctx->tb->cflags & CF_USE_ICOUNT) {", " if (ctx->tb->cflags & CF_USE_ICOUNT) {" ], "line_no": [ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 ] }
static void FUNC_0(DisasContext *VAR_0, int VAR_1, int VAR_2) { if (VAR_0->tb->cflags & CF_USE_ICOUNT) { gen_io_start(); } gen_helper_load_tbu(cpu_gpr[VAR_1], cpu_env); if (VAR_0->tb->cflags & CF_USE_ICOUNT) { gen_io_end(); gen_stop_exception(VAR_0); } }
[ "static void FUNC_0(DisasContext *VAR_0, int VAR_1, int VAR_2)\n{", "if (VAR_0->tb->cflags & CF_USE_ICOUNT) {", "gen_io_start();", "}", "gen_helper_load_tbu(cpu_gpr[VAR_1], cpu_env);", "if (VAR_0->tb->cflags & CF_USE_ICOUNT) {", "gen_io_end();", "gen_stop_exception(VAR_0);", "}", "}" ]
[ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
18,485
static void vector_fmul_window_mips(float *dst, const float *src0, const float *src1, const float *win, int len) { int i, j; /* * variables used in inline assembler */ float * dst_i, * dst_j, * dst_i2, * dst_j2; float temp, temp1, temp2, temp3, temp4, temp5, temp6, temp7; dst += len; win += len; src0 += len; for (i = -len, j = len - 1; i < 0; i += 8, j -= 8) { dst_i = dst + i; dst_j = dst + j; dst_i2 = dst + i + 4; dst_j2 = dst + j - 4; __asm__ volatile ( "mul.s %[temp], %[s1], %[wi] \n\t" "mul.s %[temp1], %[s1], %[wj] \n\t" "mul.s %[temp2], %[s11], %[wi1] \n\t" "mul.s %[temp3], %[s11], %[wj1] \n\t" "msub.s %[temp], %[temp], %[s0], %[wj] \n\t" "madd.s %[temp1], %[temp1], %[s0], %[wi] \n\t" "msub.s %[temp2], %[temp2], %[s01], %[wj1] \n\t" "madd.s %[temp3], %[temp3], %[s01], %[wi1] \n\t" "swc1 %[temp], 0(%[dst_i]) \n\t" /* dst[i] = s0*wj - s1*wi; */ "swc1 %[temp1], 0(%[dst_j]) \n\t" /* dst[j] = s0*wi + s1*wj; */ "swc1 %[temp2], 4(%[dst_i]) \n\t" /* dst[i+1] = s01*wj1 - s11*wi1; */ "swc1 %[temp3], -4(%[dst_j]) \n\t" /* dst[j-1] = s01*wi1 + s11*wj1; */ "mul.s %[temp4], %[s12], %[wi2] \n\t" "mul.s %[temp5], %[s12], %[wj2] \n\t" "mul.s %[temp6], %[s13], %[wi3] \n\t" "mul.s %[temp7], %[s13], %[wj3] \n\t" "msub.s %[temp4], %[temp4], %[s02], %[wj2] \n\t" "madd.s %[temp5], %[temp5], %[s02], %[wi2] \n\t" "msub.s %[temp6], %[temp6], %[s03], %[wj3] \n\t" "madd.s %[temp7], %[temp7], %[s03], %[wi3] \n\t" "swc1 %[temp4], 8(%[dst_i]) \n\t" /* dst[i+2] = s02*wj2 - s12*wi2; */ "swc1 %[temp5], -8(%[dst_j]) \n\t" /* dst[j-2] = s02*wi2 + s12*wj2; */ "swc1 %[temp6], 12(%[dst_i]) \n\t" /* dst[i+2] = s03*wj3 - s13*wi3; */ "swc1 %[temp7], -12(%[dst_j]) \n\t" /* dst[j-3] = s03*wi3 + s13*wj3; */ : [temp]"=&f"(temp), [temp1]"=&f"(temp1), [temp2]"=&f"(temp2), [temp3]"=&f"(temp3), [temp4]"=&f"(temp4), [temp5]"=&f"(temp5), [temp6]"=&f"(temp6), [temp7]"=&f"(temp7) : [dst_j]"r"(dst_j), [dst_i]"r" (dst_i), [s0] "f"(src0[i]), [wj] "f"(win[j]), [s1] "f"(src1[j]), [wi] "f"(win[i]), [s01]"f"(src0[i + 1]),[wj1]"f"(win[j - 1]), [s11]"f"(src1[j - 1]), [wi1]"f"(win[i + 1]), [s02]"f"(src0[i + 2]), [wj2]"f"(win[j - 2]), [s12]"f"(src1[j - 2]),[wi2]"f"(win[i + 2]), [s03]"f"(src0[i + 3]), [wj3]"f"(win[j - 3]), [s13]"f"(src1[j - 3]), [wi3]"f"(win[i + 3]) : "memory" ); __asm__ volatile ( "mul.s %[temp], %[s1], %[wi] \n\t" "mul.s %[temp1], %[s1], %[wj] \n\t" "mul.s %[temp2], %[s11], %[wi1] \n\t" "mul.s %[temp3], %[s11], %[wj1] \n\t" "msub.s %[temp], %[temp], %[s0], %[wj] \n\t" "madd.s %[temp1], %[temp1], %[s0], %[wi] \n\t" "msub.s %[temp2], %[temp2], %[s01], %[wj1] \n\t" "madd.s %[temp3], %[temp3], %[s01], %[wi1] \n\t" "swc1 %[temp], 0(%[dst_i2]) \n\t" /* dst[i] = s0*wj - s1*wi; */ "swc1 %[temp1], 0(%[dst_j2]) \n\t" /* dst[j] = s0*wi + s1*wj; */ "swc1 %[temp2], 4(%[dst_i2]) \n\t" /* dst[i+1] = s01*wj1 - s11*wi1; */ "swc1 %[temp3], -4(%[dst_j2]) \n\t" /* dst[j-1] = s01*wi1 + s11*wj1; */ "mul.s %[temp4], %[s12], %[wi2] \n\t" "mul.s %[temp5], %[s12], %[wj2] \n\t" "mul.s %[temp6], %[s13], %[wi3] \n\t" "mul.s %[temp7], %[s13], %[wj3] \n\t" "msub.s %[temp4], %[temp4], %[s02], %[wj2] \n\t" "madd.s %[temp5], %[temp5], %[s02], %[wi2] \n\t" "msub.s %[temp6], %[temp6], %[s03], %[wj3] \n\t" "madd.s %[temp7], %[temp7], %[s03], %[wi3] \n\t" "swc1 %[temp4], 8(%[dst_i2]) \n\t" /* dst[i+2] = s02*wj2 - s12*wi2; */ "swc1 %[temp5], -8(%[dst_j2]) \n\t" /* dst[j-2] = s02*wi2 + s12*wj2; */ "swc1 %[temp6], 12(%[dst_i2]) \n\t" /* dst[i+2] = s03*wj3 - s13*wi3; */ "swc1 %[temp7], -12(%[dst_j2]) \n\t" /* dst[j-3] = s03*wi3 + s13*wj3; */ : [temp]"=&f"(temp), [temp1]"=&f"(temp1), [temp2]"=&f"(temp2), [temp3]"=&f"(temp3), [temp4]"=&f"(temp4), [temp5]"=&f"(temp5), [temp6]"=&f"(temp6), [temp7] "=&f" (temp7) : [dst_j2]"r"(dst_j2), [dst_i2]"r"(dst_i2), [s0] "f"(src0[i + 4]), [wj] "f"(win[j - 4]), [s1] "f"(src1[j - 4]), [wi] "f"(win[i + 4]), [s01]"f"(src0[i + 5]),[wj1]"f"(win[j - 5]), [s11]"f"(src1[j - 5]), [wi1]"f"(win[i + 5]), [s02]"f"(src0[i + 6]), [wj2]"f"(win[j - 6]), [s12]"f"(src1[j - 6]),[wi2]"f"(win[i + 6]), [s03]"f"(src0[i + 7]), [wj3]"f"(win[j - 7]), [s13]"f"(src1[j - 7]), [wi3]"f"(win[i + 7]) : "memory" ); } }
true
FFmpeg
dfa920807494f0bc505aa090e036b531daa604ad
static void vector_fmul_window_mips(float *dst, const float *src0, const float *src1, const float *win, int len) { int i, j; float * dst_i, * dst_j, * dst_i2, * dst_j2; float temp, temp1, temp2, temp3, temp4, temp5, temp6, temp7; dst += len; win += len; src0 += len; for (i = -len, j = len - 1; i < 0; i += 8, j -= 8) { dst_i = dst + i; dst_j = dst + j; dst_i2 = dst + i + 4; dst_j2 = dst + j - 4; __asm__ volatile ( "mul.s %[temp], %[s1], %[wi] \n\t" "mul.s %[temp1], %[s1], %[wj] \n\t" "mul.s %[temp2], %[s11], %[wi1] \n\t" "mul.s %[temp3], %[s11], %[wj1] \n\t" "msub.s %[temp], %[temp], %[s0], %[wj] \n\t" "madd.s %[temp1], %[temp1], %[s0], %[wi] \n\t" "msub.s %[temp2], %[temp2], %[s01], %[wj1] \n\t" "madd.s %[temp3], %[temp3], %[s01], %[wi1] \n\t" "swc1 %[temp], 0(%[dst_i]) \n\t" "swc1 %[temp1], 0(%[dst_j]) \n\t" "swc1 %[temp2], 4(%[dst_i]) \n\t" "swc1 %[temp3], -4(%[dst_j]) \n\t" "mul.s %[temp4], %[s12], %[wi2] \n\t" "mul.s %[temp5], %[s12], %[wj2] \n\t" "mul.s %[temp6], %[s13], %[wi3] \n\t" "mul.s %[temp7], %[s13], %[wj3] \n\t" "msub.s %[temp4], %[temp4], %[s02], %[wj2] \n\t" "madd.s %[temp5], %[temp5], %[s02], %[wi2] \n\t" "msub.s %[temp6], %[temp6], %[s03], %[wj3] \n\t" "madd.s %[temp7], %[temp7], %[s03], %[wi3] \n\t" "swc1 %[temp4], 8(%[dst_i]) \n\t" "swc1 %[temp5], -8(%[dst_j]) \n\t" "swc1 %[temp6], 12(%[dst_i]) \n\t" "swc1 %[temp7], -12(%[dst_j]) \n\t" : [temp]"=&f"(temp), [temp1]"=&f"(temp1), [temp2]"=&f"(temp2), [temp3]"=&f"(temp3), [temp4]"=&f"(temp4), [temp5]"=&f"(temp5), [temp6]"=&f"(temp6), [temp7]"=&f"(temp7) : [dst_j]"r"(dst_j), [dst_i]"r" (dst_i), [s0] "f"(src0[i]), [wj] "f"(win[j]), [s1] "f"(src1[j]), [wi] "f"(win[i]), [s01]"f"(src0[i + 1]),[wj1]"f"(win[j - 1]), [s11]"f"(src1[j - 1]), [wi1]"f"(win[i + 1]), [s02]"f"(src0[i + 2]), [wj2]"f"(win[j - 2]), [s12]"f"(src1[j - 2]),[wi2]"f"(win[i + 2]), [s03]"f"(src0[i + 3]), [wj3]"f"(win[j - 3]), [s13]"f"(src1[j - 3]), [wi3]"f"(win[i + 3]) : "memory" ); __asm__ volatile ( "mul.s %[temp], %[s1], %[wi] \n\t" "mul.s %[temp1], %[s1], %[wj] \n\t" "mul.s %[temp2], %[s11], %[wi1] \n\t" "mul.s %[temp3], %[s11], %[wj1] \n\t" "msub.s %[temp], %[temp], %[s0], %[wj] \n\t" "madd.s %[temp1], %[temp1], %[s0], %[wi] \n\t" "msub.s %[temp2], %[temp2], %[s01], %[wj1] \n\t" "madd.s %[temp3], %[temp3], %[s01], %[wi1] \n\t" "swc1 %[temp], 0(%[dst_i2]) \n\t" "swc1 %[temp1], 0(%[dst_j2]) \n\t" "swc1 %[temp2], 4(%[dst_i2]) \n\t" "swc1 %[temp3], -4(%[dst_j2]) \n\t" "mul.s %[temp4], %[s12], %[wi2] \n\t" "mul.s %[temp5], %[s12], %[wj2] \n\t" "mul.s %[temp6], %[s13], %[wi3] \n\t" "mul.s %[temp7], %[s13], %[wj3] \n\t" "msub.s %[temp4], %[temp4], %[s02], %[wj2] \n\t" "madd.s %[temp5], %[temp5], %[s02], %[wi2] \n\t" "msub.s %[temp6], %[temp6], %[s03], %[wj3] \n\t" "madd.s %[temp7], %[temp7], %[s03], %[wi3] \n\t" "swc1 %[temp4], 8(%[dst_i2]) \n\t" "swc1 %[temp5], -8(%[dst_j2]) \n\t" "swc1 %[temp6], 12(%[dst_i2]) \n\t" "swc1 %[temp7], -12(%[dst_j2]) \n\t" : [temp]"=&f"(temp), [temp1]"=&f"(temp1), [temp2]"=&f"(temp2), [temp3]"=&f"(temp3), [temp4]"=&f"(temp4), [temp5]"=&f"(temp5), [temp6]"=&f"(temp6), [temp7] "=&f" (temp7) : [dst_j2]"r"(dst_j2), [dst_i2]"r"(dst_i2), [s0] "f"(src0[i + 4]), [wj] "f"(win[j - 4]), [s1] "f"(src1[j - 4]), [wi] "f"(win[i + 4]), [s01]"f"(src0[i + 5]),[wj1]"f"(win[j - 5]), [s11]"f"(src1[j - 5]), [wi1]"f"(win[i + 5]), [s02]"f"(src0[i + 6]), [wj2]"f"(win[j - 6]), [s12]"f"(src1[j - 6]),[wi2]"f"(win[i + 6]), [s03]"f"(src0[i + 7]), [wj3]"f"(win[j - 7]), [s13]"f"(src1[j - 7]), [wi3]"f"(win[i + 7]) : "memory" ); } }
{ "code": [ " const float *src1, const float *win, int len)", " int i, j;", " float * dst_i, * dst_j, * dst_i2, * dst_j2;", " float temp, temp1, temp2, temp3, temp4, temp5, temp6, temp7;", " dst += len;", " win += len;", " src0 += len;", " for (i = -len, j = len - 1; i < 0; i += 8, j -= 8) {", " dst_i = dst + i;", " dst_j = dst + j;", " dst_i2 = dst + i + 4;", " dst_j2 = dst + j - 4;", " __asm__ volatile (", " \"mul.s %[temp], %[s1], %[wi] \\n\\t\"", " \"mul.s %[temp1], %[s1], %[wj] \\n\\t\"", " \"mul.s %[temp2], %[s11], %[wi1] \\n\\t\"", " \"mul.s %[temp3], %[s11], %[wj1] \\n\\t\"", " \"msub.s %[temp], %[temp], %[s0], %[wj] \\n\\t\"", " \"madd.s %[temp1], %[temp1], %[s0], %[wi] \\n\\t\"", " \"msub.s %[temp2], %[temp2], %[s01], %[wj1] \\n\\t\"", " \"madd.s %[temp3], %[temp3], %[s01], %[wi1] \\n\\t\"", " \"mul.s %[temp4], %[s12], %[wi2] \\n\\t\"", " \"mul.s %[temp5], %[s12], %[wj2] \\n\\t\"", " \"mul.s %[temp6], %[s13], %[wi3] \\n\\t\"", " \"mul.s %[temp7], %[s13], %[wj3] \\n\\t\"", " \"msub.s %[temp4], %[temp4], %[s02], %[wj2] \\n\\t\"", " \"madd.s %[temp5], %[temp5], %[s02], %[wi2] \\n\\t\"", " \"msub.s %[temp6], %[temp6], %[s03], %[wj3] \\n\\t\"", " \"madd.s %[temp7], %[temp7], %[s03], %[wi3] \\n\\t\"", " : [temp]\"=&f\"(temp), [temp1]\"=&f\"(temp1), [temp2]\"=&f\"(temp2),", " [temp3]\"=&f\"(temp3), [temp4]\"=&f\"(temp4), [temp5]\"=&f\"(temp5),", " [temp6]\"=&f\"(temp6), [temp7]\"=&f\"(temp7)", " : [dst_j]\"r\"(dst_j), [dst_i]\"r\" (dst_i),", " [s0] \"f\"(src0[i]), [wj] \"f\"(win[j]), [s1] \"f\"(src1[j]),", " [wi] \"f\"(win[i]), [s01]\"f\"(src0[i + 1]),[wj1]\"f\"(win[j - 1]),", " [s11]\"f\"(src1[j - 1]), [wi1]\"f\"(win[i + 1]), [s02]\"f\"(src0[i + 2]),", " [wj2]\"f\"(win[j - 2]), [s12]\"f\"(src1[j - 2]),[wi2]\"f\"(win[i + 2]),", " [s03]\"f\"(src0[i + 3]), [wj3]\"f\"(win[j - 3]), [s13]\"f\"(src1[j - 3]),", " [wi3]\"f\"(win[i + 3])", " : \"memory\"", " );", " __asm__ volatile (", " \"mul.s %[temp], %[s1], %[wi] \\n\\t\"", " \"mul.s %[temp1], %[s1], %[wj] \\n\\t\"", " \"mul.s %[temp2], %[s11], %[wi1] \\n\\t\"", " \"mul.s %[temp3], %[s11], %[wj1] \\n\\t\"", " \"msub.s %[temp], %[temp], %[s0], %[wj] \\n\\t\"", " \"madd.s %[temp1], %[temp1], %[s0], %[wi] \\n\\t\"", " \"msub.s %[temp2], %[temp2], %[s01], %[wj1] \\n\\t\"", " \"madd.s %[temp3], %[temp3], %[s01], %[wi1] \\n\\t\"", " \"mul.s %[temp4], %[s12], %[wi2] \\n\\t\"", " \"mul.s %[temp5], %[s12], %[wj2] \\n\\t\"", " \"mul.s %[temp6], %[s13], %[wi3] \\n\\t\"", " \"mul.s %[temp7], %[s13], %[wj3] \\n\\t\"", " \"msub.s %[temp4], %[temp4], %[s02], %[wj2] \\n\\t\"", " \"madd.s %[temp5], %[temp5], %[s02], %[wi2] \\n\\t\"", " \"msub.s %[temp6], %[temp6], %[s03], %[wj3] \\n\\t\"", " \"madd.s %[temp7], %[temp7], %[s03], %[wi3] \\n\\t\"", " : [temp]\"=&f\"(temp),", " [temp1]\"=&f\"(temp1), [temp2]\"=&f\"(temp2), [temp3]\"=&f\"(temp3),", " [temp4]\"=&f\"(temp4), [temp5]\"=&f\"(temp5), [temp6]\"=&f\"(temp6),", " [temp7] \"=&f\" (temp7)", " : [dst_j2]\"r\"(dst_j2), [dst_i2]\"r\"(dst_i2),", " [s0] \"f\"(src0[i + 4]), [wj] \"f\"(win[j - 4]), [s1] \"f\"(src1[j - 4]),", " [wi] \"f\"(win[i + 4]), [s01]\"f\"(src0[i + 5]),[wj1]\"f\"(win[j - 5]),", " [s11]\"f\"(src1[j - 5]), [wi1]\"f\"(win[i + 5]), [s02]\"f\"(src0[i + 6]),", " [wj2]\"f\"(win[j - 6]), [s12]\"f\"(src1[j - 6]),[wi2]\"f\"(win[i + 6]),", " [s03]\"f\"(src0[i + 7]), [wj3]\"f\"(win[j - 7]), [s13]\"f\"(src1[j - 7]),", " [wi3]\"f\"(win[i + 7])", " : \"memory\"", " );" ], "line_no": [ 3, 7, 15, 17, 21, 23, 25, 29, 33, 35, 39, 41, 45, 47, 49, 51, 53, 57, 59, 61, 63, 77, 79, 81, 83, 87, 89, 91, 93, 105, 107, 109, 111, 113, 115, 117, 119, 121, 123, 125, 127, 45, 133, 135, 137, 139, 143, 145, 147, 149, 163, 165, 167, 169, 173, 175, 177, 179, 191, 193, 195, 197, 199, 201, 203, 205, 207, 209, 211, 125, 127 ] }
static void FUNC_0(float *VAR_0, const float *VAR_1, const float *VAR_2, const float *VAR_3, int VAR_4) { int VAR_5, VAR_6; float * VAR_7, * VAR_8, * VAR_9, * VAR_10; float VAR_11, VAR_12, VAR_13, VAR_14, VAR_15, VAR_16, VAR_17, VAR_18; VAR_0 += VAR_4; VAR_3 += VAR_4; VAR_1 += VAR_4; for (VAR_5 = -VAR_4, VAR_6 = VAR_4 - 1; VAR_5 < 0; VAR_5 += 8, VAR_6 -= 8) { VAR_7 = VAR_0 + VAR_5; VAR_8 = VAR_0 + VAR_6; VAR_9 = VAR_0 + VAR_5 + 4; VAR_10 = VAR_0 + VAR_6 - 4; __asm__ volatile ( "mul.s %[VAR_11], %[s1], %[wi] \n\t" "mul.s %[VAR_12], %[s1], %[wj] \n\t" "mul.s %[VAR_13], %[s11], %[wi1] \n\t" "mul.s %[VAR_14], %[s11], %[wj1] \n\t" "msub.s %[VAR_11], %[VAR_11], %[s0], %[wj] \n\t" "madd.s %[VAR_12], %[VAR_12], %[s0], %[wi] \n\t" "msub.s %[VAR_13], %[VAR_13], %[s01], %[wj1] \n\t" "madd.s %[VAR_14], %[VAR_14], %[s01], %[wi1] \n\t" "swc1 %[VAR_11], 0(%[VAR_7]) \n\t" "swc1 %[VAR_12], 0(%[VAR_8]) \n\t" "swc1 %[VAR_13], 4(%[VAR_7]) \n\t" "swc1 %[VAR_14], -4(%[VAR_8]) \n\t" "mul.s %[VAR_15], %[s12], %[wi2] \n\t" "mul.s %[VAR_16], %[s12], %[wj2] \n\t" "mul.s %[VAR_17], %[s13], %[wi3] \n\t" "mul.s %[VAR_18], %[s13], %[wj3] \n\t" "msub.s %[VAR_15], %[VAR_15], %[s02], %[wj2] \n\t" "madd.s %[VAR_16], %[VAR_16], %[s02], %[wi2] \n\t" "msub.s %[VAR_17], %[VAR_17], %[s03], %[wj3] \n\t" "madd.s %[VAR_18], %[VAR_18], %[s03], %[wi3] \n\t" "swc1 %[VAR_15], 8(%[VAR_7]) \n\t" "swc1 %[VAR_16], -8(%[VAR_8]) \n\t" "swc1 %[VAR_17], 12(%[VAR_7]) \n\t" "swc1 %[VAR_18], -12(%[VAR_8]) \n\t" : [VAR_11]"=&f"(VAR_11), [VAR_12]"=&f"(VAR_12), [VAR_13]"=&f"(VAR_13), [VAR_14]"=&f"(VAR_14), [VAR_15]"=&f"(VAR_15), [VAR_16]"=&f"(VAR_16), [VAR_17]"=&f"(VAR_17), [VAR_18]"=&f"(VAR_18) : [VAR_8]"r"(VAR_8), [VAR_7]"r" (VAR_7), [s0] "f"(VAR_1[VAR_5]), [wj] "f"(VAR_3[VAR_6]), [s1] "f"(VAR_2[VAR_6]), [wi] "f"(VAR_3[VAR_5]), [s01]"f"(VAR_1[VAR_5 + 1]),[wj1]"f"(VAR_3[VAR_6 - 1]), [s11]"f"(VAR_2[VAR_6 - 1]), [wi1]"f"(VAR_3[VAR_5 + 1]), [s02]"f"(VAR_1[VAR_5 + 2]), [wj2]"f"(VAR_3[VAR_6 - 2]), [s12]"f"(VAR_2[VAR_6 - 2]),[wi2]"f"(VAR_3[VAR_5 + 2]), [s03]"f"(VAR_1[VAR_5 + 3]), [wj3]"f"(VAR_3[VAR_6 - 3]), [s13]"f"(VAR_2[VAR_6 - 3]), [wi3]"f"(VAR_3[VAR_5 + 3]) : "memory" ); __asm__ volatile ( "mul.s %[VAR_11], %[s1], %[wi] \n\t" "mul.s %[VAR_12], %[s1], %[wj] \n\t" "mul.s %[VAR_13], %[s11], %[wi1] \n\t" "mul.s %[VAR_14], %[s11], %[wj1] \n\t" "msub.s %[VAR_11], %[VAR_11], %[s0], %[wj] \n\t" "madd.s %[VAR_12], %[VAR_12], %[s0], %[wi] \n\t" "msub.s %[VAR_13], %[VAR_13], %[s01], %[wj1] \n\t" "madd.s %[VAR_14], %[VAR_14], %[s01], %[wi1] \n\t" "swc1 %[VAR_11], 0(%[VAR_9]) \n\t" "swc1 %[VAR_12], 0(%[VAR_10]) \n\t" "swc1 %[VAR_13], 4(%[VAR_9]) \n\t" "swc1 %[VAR_14], -4(%[VAR_10]) \n\t" "mul.s %[VAR_15], %[s12], %[wi2] \n\t" "mul.s %[VAR_16], %[s12], %[wj2] \n\t" "mul.s %[VAR_17], %[s13], %[wi3] \n\t" "mul.s %[VAR_18], %[s13], %[wj3] \n\t" "msub.s %[VAR_15], %[VAR_15], %[s02], %[wj2] \n\t" "madd.s %[VAR_16], %[VAR_16], %[s02], %[wi2] \n\t" "msub.s %[VAR_17], %[VAR_17], %[s03], %[wj3] \n\t" "madd.s %[VAR_18], %[VAR_18], %[s03], %[wi3] \n\t" "swc1 %[VAR_15], 8(%[VAR_9]) \n\t" "swc1 %[VAR_16], -8(%[VAR_10]) \n\t" "swc1 %[VAR_17], 12(%[VAR_9]) \n\t" "swc1 %[VAR_18], -12(%[VAR_10]) \n\t" : [VAR_11]"=&f"(VAR_11), [VAR_12]"=&f"(VAR_12), [VAR_13]"=&f"(VAR_13), [VAR_14]"=&f"(VAR_14), [VAR_15]"=&f"(VAR_15), [VAR_16]"=&f"(VAR_16), [VAR_17]"=&f"(VAR_17), [VAR_18] "=&f" (VAR_18) : [VAR_10]"r"(VAR_10), [VAR_9]"r"(VAR_9), [s0] "f"(VAR_1[VAR_5 + 4]), [wj] "f"(VAR_3[VAR_6 - 4]), [s1] "f"(VAR_2[VAR_6 - 4]), [wi] "f"(VAR_3[VAR_5 + 4]), [s01]"f"(VAR_1[VAR_5 + 5]),[wj1]"f"(VAR_3[VAR_6 - 5]), [s11]"f"(VAR_2[VAR_6 - 5]), [wi1]"f"(VAR_3[VAR_5 + 5]), [s02]"f"(VAR_1[VAR_5 + 6]), [wj2]"f"(VAR_3[VAR_6 - 6]), [s12]"f"(VAR_2[VAR_6 - 6]),[wi2]"f"(VAR_3[VAR_5 + 6]), [s03]"f"(VAR_1[VAR_5 + 7]), [wj3]"f"(VAR_3[VAR_6 - 7]), [s13]"f"(VAR_2[VAR_6 - 7]), [wi3]"f"(VAR_3[VAR_5 + 7]) : "memory" ); } }
[ "static void FUNC_0(float *VAR_0, const float *VAR_1,\nconst float *VAR_2, const float *VAR_3, int VAR_4)\n{", "int VAR_5, VAR_6;", "float * VAR_7, * VAR_8, * VAR_9, * VAR_10;", "float VAR_11, VAR_12, VAR_13, VAR_14, VAR_15, VAR_16, VAR_17, VAR_18;", "VAR_0 += VAR_4;", "VAR_3 += VAR_4;", "VAR_1 += VAR_4;", "for (VAR_5 = -VAR_4, VAR_6 = VAR_4 - 1; VAR_5 < 0; VAR_5 += 8, VAR_6 -= 8) {", "VAR_7 = VAR_0 + VAR_5;", "VAR_8 = VAR_0 + VAR_6;", "VAR_9 = VAR_0 + VAR_5 + 4;", "VAR_10 = VAR_0 + VAR_6 - 4;", "__asm__ volatile (\n\"mul.s %[VAR_11], %[s1], %[wi] \\n\\t\"\n\"mul.s %[VAR_12], %[s1], %[wj] \\n\\t\"\n\"mul.s %[VAR_13], %[s11], %[wi1] \\n\\t\"\n\"mul.s %[VAR_14], %[s11], %[wj1] \\n\\t\"\n\"msub.s %[VAR_11], %[VAR_11], %[s0], %[wj] \\n\\t\"\n\"madd.s %[VAR_12], %[VAR_12], %[s0], %[wi] \\n\\t\"\n\"msub.s %[VAR_13], %[VAR_13], %[s01], %[wj1] \\n\\t\"\n\"madd.s %[VAR_14], %[VAR_14], %[s01], %[wi1] \\n\\t\"\n\"swc1 %[VAR_11], 0(%[VAR_7]) \\n\\t\"\n\"swc1 %[VAR_12], 0(%[VAR_8]) \\n\\t\"\n\"swc1 %[VAR_13], 4(%[VAR_7]) \\n\\t\"\n\"swc1 %[VAR_14], -4(%[VAR_8]) \\n\\t\"\n\"mul.s %[VAR_15], %[s12], %[wi2] \\n\\t\"\n\"mul.s %[VAR_16], %[s12], %[wj2] \\n\\t\"\n\"mul.s %[VAR_17], %[s13], %[wi3] \\n\\t\"\n\"mul.s %[VAR_18], %[s13], %[wj3] \\n\\t\"\n\"msub.s %[VAR_15], %[VAR_15], %[s02], %[wj2] \\n\\t\"\n\"madd.s %[VAR_16], %[VAR_16], %[s02], %[wi2] \\n\\t\"\n\"msub.s %[VAR_17], %[VAR_17], %[s03], %[wj3] \\n\\t\"\n\"madd.s %[VAR_18], %[VAR_18], %[s03], %[wi3] \\n\\t\"\n\"swc1 %[VAR_15], 8(%[VAR_7]) \\n\\t\"\n\"swc1 %[VAR_16], -8(%[VAR_8]) \\n\\t\"\n\"swc1 %[VAR_17], 12(%[VAR_7]) \\n\\t\"\n\"swc1 %[VAR_18], -12(%[VAR_8]) \\n\\t\"\n: [VAR_11]\"=&f\"(VAR_11), [VAR_12]\"=&f\"(VAR_12), [VAR_13]\"=&f\"(VAR_13),\n[VAR_14]\"=&f\"(VAR_14), [VAR_15]\"=&f\"(VAR_15), [VAR_16]\"=&f\"(VAR_16),\n[VAR_17]\"=&f\"(VAR_17), [VAR_18]\"=&f\"(VAR_18)\n: [VAR_8]\"r\"(VAR_8), [VAR_7]\"r\" (VAR_7),\n[s0] \"f\"(VAR_1[VAR_5]), [wj] \"f\"(VAR_3[VAR_6]), [s1] \"f\"(VAR_2[VAR_6]),\n[wi] \"f\"(VAR_3[VAR_5]), [s01]\"f\"(VAR_1[VAR_5 + 1]),[wj1]\"f\"(VAR_3[VAR_6 - 1]),\n[s11]\"f\"(VAR_2[VAR_6 - 1]), [wi1]\"f\"(VAR_3[VAR_5 + 1]), [s02]\"f\"(VAR_1[VAR_5 + 2]),\n[wj2]\"f\"(VAR_3[VAR_6 - 2]), [s12]\"f\"(VAR_2[VAR_6 - 2]),[wi2]\"f\"(VAR_3[VAR_5 + 2]),\n[s03]\"f\"(VAR_1[VAR_5 + 3]), [wj3]\"f\"(VAR_3[VAR_6 - 3]), [s13]\"f\"(VAR_2[VAR_6 - 3]),\n[wi3]\"f\"(VAR_3[VAR_5 + 3])\n: \"memory\"\n);", "__asm__ volatile (\n\"mul.s %[VAR_11], %[s1], %[wi] \\n\\t\"\n\"mul.s %[VAR_12], %[s1], %[wj] \\n\\t\"\n\"mul.s %[VAR_13], %[s11], %[wi1] \\n\\t\"\n\"mul.s %[VAR_14], %[s11], %[wj1] \\n\\t\"\n\"msub.s %[VAR_11], %[VAR_11], %[s0], %[wj] \\n\\t\"\n\"madd.s %[VAR_12], %[VAR_12], %[s0], %[wi] \\n\\t\"\n\"msub.s %[VAR_13], %[VAR_13], %[s01], %[wj1] \\n\\t\"\n\"madd.s %[VAR_14], %[VAR_14], %[s01], %[wi1] \\n\\t\"\n\"swc1 %[VAR_11], 0(%[VAR_9]) \\n\\t\"\n\"swc1 %[VAR_12], 0(%[VAR_10]) \\n\\t\"\n\"swc1 %[VAR_13], 4(%[VAR_9]) \\n\\t\"\n\"swc1 %[VAR_14], -4(%[VAR_10]) \\n\\t\"\n\"mul.s %[VAR_15], %[s12], %[wi2] \\n\\t\"\n\"mul.s %[VAR_16], %[s12], %[wj2] \\n\\t\"\n\"mul.s %[VAR_17], %[s13], %[wi3] \\n\\t\"\n\"mul.s %[VAR_18], %[s13], %[wj3] \\n\\t\"\n\"msub.s %[VAR_15], %[VAR_15], %[s02], %[wj2] \\n\\t\"\n\"madd.s %[VAR_16], %[VAR_16], %[s02], %[wi2] \\n\\t\"\n\"msub.s %[VAR_17], %[VAR_17], %[s03], %[wj3] \\n\\t\"\n\"madd.s %[VAR_18], %[VAR_18], %[s03], %[wi3] \\n\\t\"\n\"swc1 %[VAR_15], 8(%[VAR_9]) \\n\\t\"\n\"swc1 %[VAR_16], -8(%[VAR_10]) \\n\\t\"\n\"swc1 %[VAR_17], 12(%[VAR_9]) \\n\\t\"\n\"swc1 %[VAR_18], -12(%[VAR_10]) \\n\\t\"\n: [VAR_11]\"=&f\"(VAR_11),\n[VAR_12]\"=&f\"(VAR_12), [VAR_13]\"=&f\"(VAR_13), [VAR_14]\"=&f\"(VAR_14),\n[VAR_15]\"=&f\"(VAR_15), [VAR_16]\"=&f\"(VAR_16), [VAR_17]\"=&f\"(VAR_17),\n[VAR_18] \"=&f\" (VAR_18)\n: [VAR_10]\"r\"(VAR_10), [VAR_9]\"r\"(VAR_9),\n[s0] \"f\"(VAR_1[VAR_5 + 4]), [wj] \"f\"(VAR_3[VAR_6 - 4]), [s1] \"f\"(VAR_2[VAR_6 - 4]),\n[wi] \"f\"(VAR_3[VAR_5 + 4]), [s01]\"f\"(VAR_1[VAR_5 + 5]),[wj1]\"f\"(VAR_3[VAR_6 - 5]),\n[s11]\"f\"(VAR_2[VAR_6 - 5]), [wi1]\"f\"(VAR_3[VAR_5 + 5]), [s02]\"f\"(VAR_1[VAR_5 + 6]),\n[wj2]\"f\"(VAR_3[VAR_6 - 6]), [s12]\"f\"(VAR_2[VAR_6 - 6]),[wi2]\"f\"(VAR_3[VAR_5 + 6]),\n[s03]\"f\"(VAR_1[VAR_5 + 7]), [wj3]\"f\"(VAR_3[VAR_6 - 7]), [s13]\"f\"(VAR_2[VAR_6 - 7]),\n[wi3]\"f\"(VAR_3[VAR_5 + 7])\n: \"memory\"\n);", "}", "}" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 45, 47, 49, 51, 53, 57, 59, 61, 63, 67, 69, 71, 73, 77, 79, 81, 83, 87, 89, 91, 93, 97, 99, 101, 103, 105, 107, 109, 111, 113, 115, 117, 119, 121, 123, 125, 127 ], [ 131, 133, 135, 137, 139, 143, 145, 147, 149, 153, 155, 157, 159, 163, 165, 167, 169, 173, 175, 177, 179, 183, 185, 187, 189, 191, 193, 195, 197, 199, 201, 203, 205, 207, 209, 211, 213, 215 ], [ 217 ], [ 219 ] ]
18,486
static CodeBook unpack_codebook(GetBitContext* gb, unsigned depth, unsigned size) { unsigned i, j; CodeBook cb = { 0 }; if (!can_safely_read(gb, size * 34)) return cb; if (size >= INT_MAX / sizeof(MacroBlock)) return cb; cb.blocks = av_malloc(size ? size * sizeof(MacroBlock) : 1); if (!cb.blocks) return cb; cb.depth = depth; cb.size = size; for (i = 0; i < size; i++) { unsigned mask_bits = get_bits(gb, 4); unsigned color0 = get_bits(gb, 15); unsigned color1 = get_bits(gb, 15); for (j = 0; j < 4; j++) { if (mask_bits & (1 << j)) cb.blocks[i].pixels[j] = color1; else cb.blocks[i].pixels[j] = color0; } } return cb; }
true
FFmpeg
3d7817048cb387de87600f2152075f78b37b60a6
static CodeBook unpack_codebook(GetBitContext* gb, unsigned depth, unsigned size) { unsigned i, j; CodeBook cb = { 0 }; if (!can_safely_read(gb, size * 34)) return cb; if (size >= INT_MAX / sizeof(MacroBlock)) return cb; cb.blocks = av_malloc(size ? size * sizeof(MacroBlock) : 1); if (!cb.blocks) return cb; cb.depth = depth; cb.size = size; for (i = 0; i < size; i++) { unsigned mask_bits = get_bits(gb, 4); unsigned color0 = get_bits(gb, 15); unsigned color1 = get_bits(gb, 15); for (j = 0; j < 4; j++) { if (mask_bits & (1 << j)) cb.blocks[i].pixels[j] = color1; else cb.blocks[i].pixels[j] = color0; } } return cb; }
{ "code": [ " if (!can_safely_read(gb, size * 34))" ], "line_no": [ 13 ] }
static CodeBook FUNC_0(GetBitContext* gb, unsigned depth, unsigned size) { unsigned VAR_0, VAR_1; CodeBook cb = { 0 }; if (!can_safely_read(gb, size * 34)) return cb; if (size >= INT_MAX / sizeof(MacroBlock)) return cb; cb.blocks = av_malloc(size ? size * sizeof(MacroBlock) : 1); if (!cb.blocks) return cb; cb.depth = depth; cb.size = size; for (VAR_0 = 0; VAR_0 < size; VAR_0++) { unsigned VAR_2 = get_bits(gb, 4); unsigned VAR_3 = get_bits(gb, 15); unsigned VAR_4 = get_bits(gb, 15); for (VAR_1 = 0; VAR_1 < 4; VAR_1++) { if (VAR_2 & (1 << VAR_1)) cb.blocks[VAR_0].pixels[VAR_1] = VAR_4; else cb.blocks[VAR_0].pixels[VAR_1] = VAR_3; } } return cb; }
[ "static CodeBook FUNC_0(GetBitContext* gb, unsigned depth,\nunsigned size)\n{", "unsigned VAR_0, VAR_1;", "CodeBook cb = { 0 };", "if (!can_safely_read(gb, size * 34))\nreturn cb;", "if (size >= INT_MAX / sizeof(MacroBlock))\nreturn cb;", "cb.blocks = av_malloc(size ? size * sizeof(MacroBlock) : 1);", "if (!cb.blocks)\nreturn cb;", "cb.depth = depth;", "cb.size = size;", "for (VAR_0 = 0; VAR_0 < size; VAR_0++) {", "unsigned VAR_2 = get_bits(gb, 4);", "unsigned VAR_3 = get_bits(gb, 15);", "unsigned VAR_4 = get_bits(gb, 15);", "for (VAR_1 = 0; VAR_1 < 4; VAR_1++) {", "if (VAR_2 & (1 << VAR_1))\ncb.blocks[VAR_0].pixels[VAR_1] = VAR_4;", "else\ncb.blocks[VAR_0].pixels[VAR_1] = VAR_3;", "}", "}", "return cb;", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13, 15 ], [ 19, 21 ], [ 23 ], [ 25, 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47, 49 ], [ 51, 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ] ]
18,487
static inline void RENAME(hScale)(int16_t *dst, int dstW, const uint8_t *src, int srcW, int xInc, const int16_t *filter, const int16_t *filterPos, int filterSize) { #if COMPILE_TEMPLATE_MMX assert(filterSize % 4 == 0 && filterSize>0); if (filterSize==4) { // Always true for upscaling, sometimes for down, too. x86_reg counter= -2*dstW; filter-= counter*2; filterPos-= counter/2; dst-= counter/2; __asm__ volatile( #if defined(PIC) "push %%"REG_b" \n\t" #endif "pxor %%mm7, %%mm7 \n\t" "push %%"REG_BP" \n\t" // we use 7 regs here ... "mov %%"REG_a", %%"REG_BP" \n\t" ASMALIGN(4) "1: \n\t" "movzwl (%2, %%"REG_BP"), %%eax \n\t" "movzwl 2(%2, %%"REG_BP"), %%ebx \n\t" "movq (%1, %%"REG_BP", 4), %%mm1 \n\t" "movq 8(%1, %%"REG_BP", 4), %%mm3 \n\t" "movd (%3, %%"REG_a"), %%mm0 \n\t" "movd (%3, %%"REG_b"), %%mm2 \n\t" "punpcklbw %%mm7, %%mm0 \n\t" "punpcklbw %%mm7, %%mm2 \n\t" "pmaddwd %%mm1, %%mm0 \n\t" "pmaddwd %%mm2, %%mm3 \n\t" "movq %%mm0, %%mm4 \n\t" "punpckldq %%mm3, %%mm0 \n\t" "punpckhdq %%mm3, %%mm4 \n\t" "paddd %%mm4, %%mm0 \n\t" "psrad $7, %%mm0 \n\t" "packssdw %%mm0, %%mm0 \n\t" "movd %%mm0, (%4, %%"REG_BP") \n\t" "add $4, %%"REG_BP" \n\t" " jnc 1b \n\t" "pop %%"REG_BP" \n\t" #if defined(PIC) "pop %%"REG_b" \n\t" #endif : "+a" (counter) : "c" (filter), "d" (filterPos), "S" (src), "D" (dst) #if !defined(PIC) : "%"REG_b #endif ); } else if (filterSize==8) { x86_reg counter= -2*dstW; filter-= counter*4; filterPos-= counter/2; dst-= counter/2; __asm__ volatile( #if defined(PIC) "push %%"REG_b" \n\t" #endif "pxor %%mm7, %%mm7 \n\t" "push %%"REG_BP" \n\t" // we use 7 regs here ... "mov %%"REG_a", %%"REG_BP" \n\t" ASMALIGN(4) "1: \n\t" "movzwl (%2, %%"REG_BP"), %%eax \n\t" "movzwl 2(%2, %%"REG_BP"), %%ebx \n\t" "movq (%1, %%"REG_BP", 8), %%mm1 \n\t" "movq 16(%1, %%"REG_BP", 8), %%mm3 \n\t" "movd (%3, %%"REG_a"), %%mm0 \n\t" "movd (%3, %%"REG_b"), %%mm2 \n\t" "punpcklbw %%mm7, %%mm0 \n\t" "punpcklbw %%mm7, %%mm2 \n\t" "pmaddwd %%mm1, %%mm0 \n\t" "pmaddwd %%mm2, %%mm3 \n\t" "movq 8(%1, %%"REG_BP", 8), %%mm1 \n\t" "movq 24(%1, %%"REG_BP", 8), %%mm5 \n\t" "movd 4(%3, %%"REG_a"), %%mm4 \n\t" "movd 4(%3, %%"REG_b"), %%mm2 \n\t" "punpcklbw %%mm7, %%mm4 \n\t" "punpcklbw %%mm7, %%mm2 \n\t" "pmaddwd %%mm1, %%mm4 \n\t" "pmaddwd %%mm2, %%mm5 \n\t" "paddd %%mm4, %%mm0 \n\t" "paddd %%mm5, %%mm3 \n\t" "movq %%mm0, %%mm4 \n\t" "punpckldq %%mm3, %%mm0 \n\t" "punpckhdq %%mm3, %%mm4 \n\t" "paddd %%mm4, %%mm0 \n\t" "psrad $7, %%mm0 \n\t" "packssdw %%mm0, %%mm0 \n\t" "movd %%mm0, (%4, %%"REG_BP") \n\t" "add $4, %%"REG_BP" \n\t" " jnc 1b \n\t" "pop %%"REG_BP" \n\t" #if defined(PIC) "pop %%"REG_b" \n\t" #endif : "+a" (counter) : "c" (filter), "d" (filterPos), "S" (src), "D" (dst) #if !defined(PIC) : "%"REG_b #endif ); } else { const uint8_t *offset = src+filterSize; x86_reg counter= -2*dstW; //filter-= counter*filterSize/2; filterPos-= counter/2; dst-= counter/2; __asm__ volatile( "pxor %%mm7, %%mm7 \n\t" ASMALIGN(4) "1: \n\t" "mov %2, %%"REG_c" \n\t" "movzwl (%%"REG_c", %0), %%eax \n\t" "movzwl 2(%%"REG_c", %0), %%edx \n\t" "mov %5, %%"REG_c" \n\t" "pxor %%mm4, %%mm4 \n\t" "pxor %%mm5, %%mm5 \n\t" "2: \n\t" "movq (%1), %%mm1 \n\t" "movq (%1, %6), %%mm3 \n\t" "movd (%%"REG_c", %%"REG_a"), %%mm0 \n\t" "movd (%%"REG_c", %%"REG_d"), %%mm2 \n\t" "punpcklbw %%mm7, %%mm0 \n\t" "punpcklbw %%mm7, %%mm2 \n\t" "pmaddwd %%mm1, %%mm0 \n\t" "pmaddwd %%mm2, %%mm3 \n\t" "paddd %%mm3, %%mm5 \n\t" "paddd %%mm0, %%mm4 \n\t" "add $8, %1 \n\t" "add $4, %%"REG_c" \n\t" "cmp %4, %%"REG_c" \n\t" " jb 2b \n\t" "add %6, %1 \n\t" "movq %%mm4, %%mm0 \n\t" "punpckldq %%mm5, %%mm4 \n\t" "punpckhdq %%mm5, %%mm0 \n\t" "paddd %%mm0, %%mm4 \n\t" "psrad $7, %%mm4 \n\t" "packssdw %%mm4, %%mm4 \n\t" "mov %3, %%"REG_a" \n\t" "movd %%mm4, (%%"REG_a", %0) \n\t" "add $4, %0 \n\t" " jnc 1b \n\t" : "+r" (counter), "+r" (filter) : "m" (filterPos), "m" (dst), "m"(offset), "m" (src), "r" ((x86_reg)filterSize*2) : "%"REG_a, "%"REG_c, "%"REG_d ); } #else #if COMPILE_TEMPLATE_ALTIVEC hScale_altivec_real(dst, dstW, src, srcW, xInc, filter, filterPos, filterSize); #else int i; for (i=0; i<dstW; i++) { int j; int srcPos= filterPos[i]; int val=0; //printf("filterPos: %d\n", filterPos[i]); for (j=0; j<filterSize; j++) { //printf("filter: %d, src: %d\n", filter[i], src[srcPos + j]); val += ((int)src[srcPos + j])*filter[filterSize*i + j]; } //filter += hFilterSize; dst[i] = FFMIN(val>>7, (1<<15)-1); // the cubic equation does overflow ... //dst[i] = val>>7; } #endif /* COMPILE_TEMPLATE_ALTIVEC */ #endif /* COMPILE_MMX */ }
true
FFmpeg
c3ab0004ae4dffc32494ae84dd15cfaa909a7884
static inline void RENAME(hScale)(int16_t *dst, int dstW, const uint8_t *src, int srcW, int xInc, const int16_t *filter, const int16_t *filterPos, int filterSize) { #if COMPILE_TEMPLATE_MMX assert(filterSize % 4 == 0 && filterSize>0); if (filterSize==4) { x86_reg counter= -2*dstW; filter-= counter*2; filterPos-= counter/2; dst-= counter/2; __asm__ volatile( #if defined(PIC) "push %%"REG_b" \n\t" #endif "pxor %%mm7, %%mm7 \n\t" "push %%"REG_BP" \n\t" "mov %%"REG_a", %%"REG_BP" \n\t" ASMALIGN(4) "1: \n\t" "movzwl (%2, %%"REG_BP"), %%eax \n\t" "movzwl 2(%2, %%"REG_BP"), %%ebx \n\t" "movq (%1, %%"REG_BP", 4), %%mm1 \n\t" "movq 8(%1, %%"REG_BP", 4), %%mm3 \n\t" "movd (%3, %%"REG_a"), %%mm0 \n\t" "movd (%3, %%"REG_b"), %%mm2 \n\t" "punpcklbw %%mm7, %%mm0 \n\t" "punpcklbw %%mm7, %%mm2 \n\t" "pmaddwd %%mm1, %%mm0 \n\t" "pmaddwd %%mm2, %%mm3 \n\t" "movq %%mm0, %%mm4 \n\t" "punpckldq %%mm3, %%mm0 \n\t" "punpckhdq %%mm3, %%mm4 \n\t" "paddd %%mm4, %%mm0 \n\t" "psrad $7, %%mm0 \n\t" "packssdw %%mm0, %%mm0 \n\t" "movd %%mm0, (%4, %%"REG_BP") \n\t" "add $4, %%"REG_BP" \n\t" " jnc 1b \n\t" "pop %%"REG_BP" \n\t" #if defined(PIC) "pop %%"REG_b" \n\t" #endif : "+a" (counter) : "c" (filter), "d" (filterPos), "S" (src), "D" (dst) #if !defined(PIC) : "%"REG_b #endif ); } else if (filterSize==8) { x86_reg counter= -2*dstW; filter-= counter*4; filterPos-= counter/2; dst-= counter/2; __asm__ volatile( #if defined(PIC) "push %%"REG_b" \n\t" #endif "pxor %%mm7, %%mm7 \n\t" "push %%"REG_BP" \n\t" "mov %%"REG_a", %%"REG_BP" \n\t" ASMALIGN(4) "1: \n\t" "movzwl (%2, %%"REG_BP"), %%eax \n\t" "movzwl 2(%2, %%"REG_BP"), %%ebx \n\t" "movq (%1, %%"REG_BP", 8), %%mm1 \n\t" "movq 16(%1, %%"REG_BP", 8), %%mm3 \n\t" "movd (%3, %%"REG_a"), %%mm0 \n\t" "movd (%3, %%"REG_b"), %%mm2 \n\t" "punpcklbw %%mm7, %%mm0 \n\t" "punpcklbw %%mm7, %%mm2 \n\t" "pmaddwd %%mm1, %%mm0 \n\t" "pmaddwd %%mm2, %%mm3 \n\t" "movq 8(%1, %%"REG_BP", 8), %%mm1 \n\t" "movq 24(%1, %%"REG_BP", 8), %%mm5 \n\t" "movd 4(%3, %%"REG_a"), %%mm4 \n\t" "movd 4(%3, %%"REG_b"), %%mm2 \n\t" "punpcklbw %%mm7, %%mm4 \n\t" "punpcklbw %%mm7, %%mm2 \n\t" "pmaddwd %%mm1, %%mm4 \n\t" "pmaddwd %%mm2, %%mm5 \n\t" "paddd %%mm4, %%mm0 \n\t" "paddd %%mm5, %%mm3 \n\t" "movq %%mm0, %%mm4 \n\t" "punpckldq %%mm3, %%mm0 \n\t" "punpckhdq %%mm3, %%mm4 \n\t" "paddd %%mm4, %%mm0 \n\t" "psrad $7, %%mm0 \n\t" "packssdw %%mm0, %%mm0 \n\t" "movd %%mm0, (%4, %%"REG_BP") \n\t" "add $4, %%"REG_BP" \n\t" " jnc 1b \n\t" "pop %%"REG_BP" \n\t" #if defined(PIC) "pop %%"REG_b" \n\t" #endif : "+a" (counter) : "c" (filter), "d" (filterPos), "S" (src), "D" (dst) #if !defined(PIC) : "%"REG_b #endif ); } else { const uint8_t *offset = src+filterSize; x86_reg counter= -2*dstW; filterPos-= counter/2; dst-= counter/2; __asm__ volatile( "pxor %%mm7, %%mm7 \n\t" ASMALIGN(4) "1: \n\t" "mov %2, %%"REG_c" \n\t" "movzwl (%%"REG_c", %0), %%eax \n\t" "movzwl 2(%%"REG_c", %0), %%edx \n\t" "mov %5, %%"REG_c" \n\t" "pxor %%mm4, %%mm4 \n\t" "pxor %%mm5, %%mm5 \n\t" "2: \n\t" "movq (%1), %%mm1 \n\t" "movq (%1, %6), %%mm3 \n\t" "movd (%%"REG_c", %%"REG_a"), %%mm0 \n\t" "movd (%%"REG_c", %%"REG_d"), %%mm2 \n\t" "punpcklbw %%mm7, %%mm0 \n\t" "punpcklbw %%mm7, %%mm2 \n\t" "pmaddwd %%mm1, %%mm0 \n\t" "pmaddwd %%mm2, %%mm3 \n\t" "paddd %%mm3, %%mm5 \n\t" "paddd %%mm0, %%mm4 \n\t" "add $8, %1 \n\t" "add $4, %%"REG_c" \n\t" "cmp %4, %%"REG_c" \n\t" " jb 2b \n\t" "add %6, %1 \n\t" "movq %%mm4, %%mm0 \n\t" "punpckldq %%mm5, %%mm4 \n\t" "punpckhdq %%mm5, %%mm0 \n\t" "paddd %%mm0, %%mm4 \n\t" "psrad $7, %%mm4 \n\t" "packssdw %%mm4, %%mm4 \n\t" "mov %3, %%"REG_a" \n\t" "movd %%mm4, (%%"REG_a", %0) \n\t" "add $4, %0 \n\t" " jnc 1b \n\t" : "+r" (counter), "+r" (filter) : "m" (filterPos), "m" (dst), "m"(offset), "m" (src), "r" ((x86_reg)filterSize*2) : "%"REG_a, "%"REG_c, "%"REG_d ); } #else #if COMPILE_TEMPLATE_ALTIVEC hScale_altivec_real(dst, dstW, src, srcW, xInc, filter, filterPos, filterSize); #else int i; for (i=0; i<dstW; i++) { int j; int srcPos= filterPos[i]; int val=0; for (j=0; j<filterSize; j++) { val += ((int)src[srcPos + j])*filter[filterSize*i + j]; } dst[i] = FFMIN(val>>7, (1<<15)-1); } #endif #endif }
{ "code": [ " const int16_t *filter, const int16_t *filterPos, int filterSize)" ], "line_no": [ 3 ] }
static inline void FUNC_0(hScale)(int16_t *dst, int dstW, const uint8_t *src, int srcW, int xInc, const int16_t *filter, const int16_t *filterPos, int filterSize) { #if COMPILE_TEMPLATE_MMX assert(filterSize % 4 == 0 && filterSize>0); if (filterSize==4) { x86_reg counter= -2*dstW; filter-= counter*2; filterPos-= counter/2; dst-= counter/2; __asm__ volatile( #if defined(PIC) "push %%"REG_b" \n\t" #endif "pxor %%mm7, %%mm7 \n\t" "push %%"REG_BP" \n\t" "mov %%"REG_a", %%"REG_BP" \n\t" ASMALIGN(4) "1: \n\t" "movzwl (%2, %%"REG_BP"), %%eax \n\t" "movzwl 2(%2, %%"REG_BP"), %%ebx \n\t" "movq (%1, %%"REG_BP", 4), %%mm1 \n\t" "movq 8(%1, %%"REG_BP", 4), %%mm3 \n\t" "movd (%3, %%"REG_a"), %%mm0 \n\t" "movd (%3, %%"REG_b"), %%mm2 \n\t" "punpcklbw %%mm7, %%mm0 \n\t" "punpcklbw %%mm7, %%mm2 \n\t" "pmaddwd %%mm1, %%mm0 \n\t" "pmaddwd %%mm2, %%mm3 \n\t" "movq %%mm0, %%mm4 \n\t" "punpckldq %%mm3, %%mm0 \n\t" "punpckhdq %%mm3, %%mm4 \n\t" "paddd %%mm4, %%mm0 \n\t" "psrad $7, %%mm0 \n\t" "packssdw %%mm0, %%mm0 \n\t" "movd %%mm0, (%4, %%"REG_BP") \n\t" "add $4, %%"REG_BP" \n\t" " jnc 1b \n\t" "pop %%"REG_BP" \n\t" #if defined(PIC) "pop %%"REG_b" \n\t" #endif : "+a" (counter) : "c" (filter), "d" (filterPos), "S" (src), "D" (dst) #if !defined(PIC) : "%"REG_b #endif ); } else if (filterSize==8) { x86_reg counter= -2*dstW; filter-= counter*4; filterPos-= counter/2; dst-= counter/2; __asm__ volatile( #if defined(PIC) "push %%"REG_b" \n\t" #endif "pxor %%mm7, %%mm7 \n\t" "push %%"REG_BP" \n\t" "mov %%"REG_a", %%"REG_BP" \n\t" ASMALIGN(4) "1: \n\t" "movzwl (%2, %%"REG_BP"), %%eax \n\t" "movzwl 2(%2, %%"REG_BP"), %%ebx \n\t" "movq (%1, %%"REG_BP", 8), %%mm1 \n\t" "movq 16(%1, %%"REG_BP", 8), %%mm3 \n\t" "movd (%3, %%"REG_a"), %%mm0 \n\t" "movd (%3, %%"REG_b"), %%mm2 \n\t" "punpcklbw %%mm7, %%mm0 \n\t" "punpcklbw %%mm7, %%mm2 \n\t" "pmaddwd %%mm1, %%mm0 \n\t" "pmaddwd %%mm2, %%mm3 \n\t" "movq 8(%1, %%"REG_BP", 8), %%mm1 \n\t" "movq 24(%1, %%"REG_BP", 8), %%mm5 \n\t" "movd 4(%3, %%"REG_a"), %%mm4 \n\t" "movd 4(%3, %%"REG_b"), %%mm2 \n\t" "punpcklbw %%mm7, %%mm4 \n\t" "punpcklbw %%mm7, %%mm2 \n\t" "pmaddwd %%mm1, %%mm4 \n\t" "pmaddwd %%mm2, %%mm5 \n\t" "paddd %%mm4, %%mm0 \n\t" "paddd %%mm5, %%mm3 \n\t" "movq %%mm0, %%mm4 \n\t" "punpckldq %%mm3, %%mm0 \n\t" "punpckhdq %%mm3, %%mm4 \n\t" "paddd %%mm4, %%mm0 \n\t" "psrad $7, %%mm0 \n\t" "packssdw %%mm0, %%mm0 \n\t" "movd %%mm0, (%4, %%"REG_BP") \n\t" "add $4, %%"REG_BP" \n\t" " jnc 1b \n\t" "pop %%"REG_BP" \n\t" #if defined(PIC) "pop %%"REG_b" \n\t" #endif : "+a" (counter) : "c" (filter), "d" (filterPos), "S" (src), "D" (dst) #if !defined(PIC) : "%"REG_b #endif ); } else { const uint8_t *offset = src+filterSize; x86_reg counter= -2*dstW; filterPos-= counter/2; dst-= counter/2; __asm__ volatile( "pxor %%mm7, %%mm7 \n\t" ASMALIGN(4) "1: \n\t" "mov %2, %%"REG_c" \n\t" "movzwl (%%"REG_c", %0), %%eax \n\t" "movzwl 2(%%"REG_c", %0), %%edx \n\t" "mov %5, %%"REG_c" \n\t" "pxor %%mm4, %%mm4 \n\t" "pxor %%mm5, %%mm5 \n\t" "2: \n\t" "movq (%1), %%mm1 \n\t" "movq (%1, %6), %%mm3 \n\t" "movd (%%"REG_c", %%"REG_a"), %%mm0 \n\t" "movd (%%"REG_c", %%"REG_d"), %%mm2 \n\t" "punpcklbw %%mm7, %%mm0 \n\t" "punpcklbw %%mm7, %%mm2 \n\t" "pmaddwd %%mm1, %%mm0 \n\t" "pmaddwd %%mm2, %%mm3 \n\t" "paddd %%mm3, %%mm5 \n\t" "paddd %%mm0, %%mm4 \n\t" "add $8, %1 \n\t" "add $4, %%"REG_c" \n\t" "cmp %4, %%"REG_c" \n\t" " jb 2b \n\t" "add %6, %1 \n\t" "movq %%mm4, %%mm0 \n\t" "punpckldq %%mm5, %%mm4 \n\t" "punpckhdq %%mm5, %%mm0 \n\t" "paddd %%mm0, %%mm4 \n\t" "psrad $7, %%mm4 \n\t" "packssdw %%mm4, %%mm4 \n\t" "mov %3, %%"REG_a" \n\t" "movd %%mm4, (%%"REG_a", %0) \n\t" "add $4, %0 \n\t" " jnc 1b \n\t" : "+r" (counter), "+r" (filter) : "m" (filterPos), "m" (dst), "m"(offset), "m" (src), "r" ((x86_reg)filterSize*2) : "%"REG_a, "%"REG_c, "%"REG_d ); } #else #if COMPILE_TEMPLATE_ALTIVEC hScale_altivec_real(dst, dstW, src, srcW, xInc, filter, filterPos, filterSize); #else int VAR_0; for (VAR_0=0; VAR_0<dstW; VAR_0++) { int j; int srcPos= filterPos[VAR_0]; int val=0; for (j=0; j<filterSize; j++) { val += ((int)src[srcPos + j])*filter[filterSize*VAR_0 + j]; } dst[VAR_0] = FFMIN(val>>7, (1<<15)-1); } #endif #endif }
[ "static inline void FUNC_0(hScale)(int16_t *dst, int dstW, const uint8_t *src, int srcW, int xInc,\nconst int16_t *filter, const int16_t *filterPos, int filterSize)\n{", "#if COMPILE_TEMPLATE_MMX\nassert(filterSize % 4 == 0 && filterSize>0);", "if (filterSize==4) {", "x86_reg counter= -2*dstW;", "filter-= counter*2;", "filterPos-= counter/2;", "dst-= counter/2;", "__asm__ volatile(\n#if defined(PIC)\n\"push %%\"REG_b\" \\n\\t\"\n#endif\n\"pxor %%mm7, %%mm7 \\n\\t\"\n\"push %%\"REG_BP\" \\n\\t\"\n\"mov %%\"REG_a\", %%\"REG_BP\" \\n\\t\"\nASMALIGN(4)\n\"1: \\n\\t\"\n\"movzwl (%2, %%\"REG_BP\"), %%eax \\n\\t\"\n\"movzwl 2(%2, %%\"REG_BP\"), %%ebx \\n\\t\"\n\"movq (%1, %%\"REG_BP\", 4), %%mm1 \\n\\t\"\n\"movq 8(%1, %%\"REG_BP\", 4), %%mm3 \\n\\t\"\n\"movd (%3, %%\"REG_a\"), %%mm0 \\n\\t\"\n\"movd (%3, %%\"REG_b\"), %%mm2 \\n\\t\"\n\"punpcklbw %%mm7, %%mm0 \\n\\t\"\n\"punpcklbw %%mm7, %%mm2 \\n\\t\"\n\"pmaddwd %%mm1, %%mm0 \\n\\t\"\n\"pmaddwd %%mm2, %%mm3 \\n\\t\"\n\"movq %%mm0, %%mm4 \\n\\t\"\n\"punpckldq %%mm3, %%mm0 \\n\\t\"\n\"punpckhdq %%mm3, %%mm4 \\n\\t\"\n\"paddd %%mm4, %%mm0 \\n\\t\"\n\"psrad $7, %%mm0 \\n\\t\"\n\"packssdw %%mm0, %%mm0 \\n\\t\"\n\"movd %%mm0, (%4, %%\"REG_BP\") \\n\\t\"\n\"add $4, %%\"REG_BP\" \\n\\t\"\n\" jnc 1b \\n\\t\"\n\"pop %%\"REG_BP\" \\n\\t\"\n#if defined(PIC)\n\"pop %%\"REG_b\" \\n\\t\"\n#endif\n: \"+a\" (counter)\n: \"c\" (filter), \"d\" (filterPos), \"S\" (src), \"D\" (dst)\n#if !defined(PIC)\n: \"%\"REG_b\n#endif\n);", "} else if (filterSize==8) {", "x86_reg counter= -2*dstW;", "filter-= counter*4;", "filterPos-= counter/2;", "dst-= counter/2;", "__asm__ volatile(\n#if defined(PIC)\n\"push %%\"REG_b\" \\n\\t\"\n#endif\n\"pxor %%mm7, %%mm7 \\n\\t\"\n\"push %%\"REG_BP\" \\n\\t\"\n\"mov %%\"REG_a\", %%\"REG_BP\" \\n\\t\"\nASMALIGN(4)\n\"1: \\n\\t\"\n\"movzwl (%2, %%\"REG_BP\"), %%eax \\n\\t\"\n\"movzwl 2(%2, %%\"REG_BP\"), %%ebx \\n\\t\"\n\"movq (%1, %%\"REG_BP\", 8), %%mm1 \\n\\t\"\n\"movq 16(%1, %%\"REG_BP\", 8), %%mm3 \\n\\t\"\n\"movd (%3, %%\"REG_a\"), %%mm0 \\n\\t\"\n\"movd (%3, %%\"REG_b\"), %%mm2 \\n\\t\"\n\"punpcklbw %%mm7, %%mm0 \\n\\t\"\n\"punpcklbw %%mm7, %%mm2 \\n\\t\"\n\"pmaddwd %%mm1, %%mm0 \\n\\t\"\n\"pmaddwd %%mm2, %%mm3 \\n\\t\"\n\"movq 8(%1, %%\"REG_BP\", 8), %%mm1 \\n\\t\"\n\"movq 24(%1, %%\"REG_BP\", 8), %%mm5 \\n\\t\"\n\"movd 4(%3, %%\"REG_a\"), %%mm4 \\n\\t\"\n\"movd 4(%3, %%\"REG_b\"), %%mm2 \\n\\t\"\n\"punpcklbw %%mm7, %%mm4 \\n\\t\"\n\"punpcklbw %%mm7, %%mm2 \\n\\t\"\n\"pmaddwd %%mm1, %%mm4 \\n\\t\"\n\"pmaddwd %%mm2, %%mm5 \\n\\t\"\n\"paddd %%mm4, %%mm0 \\n\\t\"\n\"paddd %%mm5, %%mm3 \\n\\t\"\n\"movq %%mm0, %%mm4 \\n\\t\"\n\"punpckldq %%mm3, %%mm0 \\n\\t\"\n\"punpckhdq %%mm3, %%mm4 \\n\\t\"\n\"paddd %%mm4, %%mm0 \\n\\t\"\n\"psrad $7, %%mm0 \\n\\t\"\n\"packssdw %%mm0, %%mm0 \\n\\t\"\n\"movd %%mm0, (%4, %%\"REG_BP\") \\n\\t\"\n\"add $4, %%\"REG_BP\" \\n\\t\"\n\" jnc 1b \\n\\t\"\n\"pop %%\"REG_BP\" \\n\\t\"\n#if defined(PIC)\n\"pop %%\"REG_b\" \\n\\t\"\n#endif\n: \"+a\" (counter)\n: \"c\" (filter), \"d\" (filterPos), \"S\" (src), \"D\" (dst)\n#if !defined(PIC)\n: \"%\"REG_b\n#endif\n);", "} else {", "const uint8_t *offset = src+filterSize;", "x86_reg counter= -2*dstW;", "filterPos-= counter/2;", "dst-= counter/2;", "__asm__ volatile(\n\"pxor %%mm7, %%mm7 \\n\\t\"\nASMALIGN(4)\n\"1: \\n\\t\"\n\"mov %2, %%\"REG_c\" \\n\\t\"\n\"movzwl (%%\"REG_c\", %0), %%eax \\n\\t\"\n\"movzwl 2(%%\"REG_c\", %0), %%edx \\n\\t\"\n\"mov %5, %%\"REG_c\" \\n\\t\"\n\"pxor %%mm4, %%mm4 \\n\\t\"\n\"pxor %%mm5, %%mm5 \\n\\t\"\n\"2: \\n\\t\"\n\"movq (%1), %%mm1 \\n\\t\"\n\"movq (%1, %6), %%mm3 \\n\\t\"\n\"movd (%%\"REG_c\", %%\"REG_a\"), %%mm0 \\n\\t\"\n\"movd (%%\"REG_c\", %%\"REG_d\"), %%mm2 \\n\\t\"\n\"punpcklbw %%mm7, %%mm0 \\n\\t\"\n\"punpcklbw %%mm7, %%mm2 \\n\\t\"\n\"pmaddwd %%mm1, %%mm0 \\n\\t\"\n\"pmaddwd %%mm2, %%mm3 \\n\\t\"\n\"paddd %%mm3, %%mm5 \\n\\t\"\n\"paddd %%mm0, %%mm4 \\n\\t\"\n\"add $8, %1 \\n\\t\"\n\"add $4, %%\"REG_c\" \\n\\t\"\n\"cmp %4, %%\"REG_c\" \\n\\t\"\n\" jb 2b \\n\\t\"\n\"add %6, %1 \\n\\t\"\n\"movq %%mm4, %%mm0 \\n\\t\"\n\"punpckldq %%mm5, %%mm4 \\n\\t\"\n\"punpckhdq %%mm5, %%mm0 \\n\\t\"\n\"paddd %%mm0, %%mm4 \\n\\t\"\n\"psrad $7, %%mm4 \\n\\t\"\n\"packssdw %%mm4, %%mm4 \\n\\t\"\n\"mov %3, %%\"REG_a\" \\n\\t\"\n\"movd %%mm4, (%%\"REG_a\", %0) \\n\\t\"\n\"add $4, %0 \\n\\t\"\n\" jnc 1b \\n\\t\"\n: \"+r\" (counter), \"+r\" (filter)\n: \"m\" (filterPos), \"m\" (dst), \"m\"(offset),\n\"m\" (src), \"r\" ((x86_reg)filterSize*2)\n: \"%\"REG_a, \"%\"REG_c, \"%\"REG_d\n);", "}", "#else\n#if COMPILE_TEMPLATE_ALTIVEC\nhScale_altivec_real(dst, dstW, src, srcW, xInc, filter, filterPos, filterSize);", "#else\nint VAR_0;", "for (VAR_0=0; VAR_0<dstW; VAR_0++) {", "int j;", "int srcPos= filterPos[VAR_0];", "int val=0;", "for (j=0; j<filterSize; j++) {", "val += ((int)src[srcPos + j])*filter[filterSize*VAR_0 + j];", "}", "dst[VAR_0] = FFMIN(val>>7, (1<<15)-1);", "}", "#endif\n#endif\n}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 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, 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, 149, 151, 153, 155, 157, 159, 161, 163, 165, 167, 169, 171, 173, 175, 177, 179, 181, 183, 185, 189, 191, 193, 195, 197, 199, 201, 203, 205, 207 ], [ 209 ], [ 211 ], [ 213 ], [ 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, 295, 297, 299, 301, 303 ], [ 305 ], [ 307, 309, 311 ], [ 313, 315 ], [ 317 ], [ 319 ], [ 321 ], [ 323 ], [ 327 ], [ 331 ], [ 333 ], [ 337 ], [ 341 ], [ 343, 345, 347 ] ]
18,489
YUV2PACKED16WRAPPER(yuv2, rgb48, rgb48be, PIX_FMT_RGB48BE) YUV2PACKED16WRAPPER(yuv2, rgb48, rgb48le, PIX_FMT_RGB48LE) YUV2PACKED16WRAPPER(yuv2, rgb48, bgr48be, PIX_FMT_BGR48BE) YUV2PACKED16WRAPPER(yuv2, rgb48, bgr48le, PIX_FMT_BGR48LE) static av_always_inline void yuv2rgb_write(uint8_t *_dest, int i, int Y1, int Y2, int U, int V, int A1, int A2, const void *_r, const void *_g, const void *_b, int y, enum PixelFormat target, int hasAlpha) { if (target == PIX_FMT_ARGB || target == PIX_FMT_RGBA || target == PIX_FMT_ABGR || target == PIX_FMT_BGRA) { uint32_t *dest = (uint32_t *) _dest; const uint32_t *r = (const uint32_t *) _r; const uint32_t *g = (const uint32_t *) _g; const uint32_t *b = (const uint32_t *) _b; #if CONFIG_SMALL int sh = hasAlpha ? ((target == PIX_FMT_RGB32_1 || target == PIX_FMT_BGR32_1) ? 0 : 24) : 0; dest[i * 2 + 0] = r[Y1] + g[Y1] + b[Y1] + (hasAlpha ? A1 << sh : 0); dest[i * 2 + 1] = r[Y2] + g[Y2] + b[Y2] + (hasAlpha ? A2 << sh : 0); #else if (hasAlpha) { int sh = (target == PIX_FMT_RGB32_1 || target == PIX_FMT_BGR32_1) ? 0 : 24; dest[i * 2 + 0] = r[Y1] + g[Y1] + b[Y1] + (A1 << sh); dest[i * 2 + 1] = r[Y2] + g[Y2] + b[Y2] + (A2 << sh); } else { dest[i * 2 + 0] = r[Y1] + g[Y1] + b[Y1]; dest[i * 2 + 1] = r[Y2] + g[Y2] + b[Y2]; } #endif } else if (target == PIX_FMT_RGB24 || target == PIX_FMT_BGR24) { uint8_t *dest = (uint8_t *) _dest; const uint8_t *r = (const uint8_t *) _r; const uint8_t *g = (const uint8_t *) _g; const uint8_t *b = (const uint8_t *) _b; #define r_b ((target == PIX_FMT_RGB24) ? r : b) #define b_r ((target == PIX_FMT_RGB24) ? b : r) dest[i * 6 + 0] = r_b[Y1]; dest[i * 6 + 1] = g[Y1]; dest[i * 6 + 2] = b_r[Y1]; dest[i * 6 + 3] = r_b[Y2]; dest[i * 6 + 4] = g[Y2]; dest[i * 6 + 5] = b_r[Y2]; #undef r_b #undef b_r } else if (target == PIX_FMT_RGB565 || target == PIX_FMT_BGR565 || target == PIX_FMT_RGB555 || target == PIX_FMT_BGR555 || target == PIX_FMT_RGB444 || target == PIX_FMT_BGR444) { uint16_t *dest = (uint16_t *) _dest; const uint16_t *r = (const uint16_t *) _r; const uint16_t *g = (const uint16_t *) _g; const uint16_t *b = (const uint16_t *) _b; int dr1, dg1, db1, dr2, dg2, db2; if (target == PIX_FMT_RGB565 || target == PIX_FMT_BGR565) { dr1 = dither_2x2_8[ y & 1 ][0]; dg1 = dither_2x2_4[ y & 1 ][0]; db1 = dither_2x2_8[(y & 1) ^ 1][0]; dr2 = dither_2x2_8[ y & 1 ][1]; dg2 = dither_2x2_4[ y & 1 ][1]; db2 = dither_2x2_8[(y & 1) ^ 1][1]; } else if (target == PIX_FMT_RGB555 || target == PIX_FMT_BGR555) { dr1 = dither_2x2_8[ y & 1 ][0]; dg1 = dither_2x2_8[ y & 1 ][1]; db1 = dither_2x2_8[(y & 1) ^ 1][0]; dr2 = dither_2x2_8[ y & 1 ][1]; dg2 = dither_2x2_8[ y & 1 ][0]; db2 = dither_2x2_8[(y & 1) ^ 1][1]; } else { dr1 = dither_4x4_16[ y & 3 ][0]; dg1 = dither_4x4_16[ y & 3 ][1]; db1 = dither_4x4_16[(y & 3) ^ 3][0]; dr2 = dither_4x4_16[ y & 3 ][1]; dg2 = dither_4x4_16[ y & 3 ][0]; db2 = dither_4x4_16[(y & 3) ^ 3][1]; } dest[i * 2 + 0] = r[Y1 + dr1] + g[Y1 + dg1] + b[Y1 + db1]; dest[i * 2 + 1] = r[Y2 + dr2] + g[Y2 + dg2] + b[Y2 + db2]; } else /* 8/4-bit */ { uint8_t *dest = (uint8_t *) _dest; const uint8_t *r = (const uint8_t *) _r; const uint8_t *g = (const uint8_t *) _g; const uint8_t *b = (const uint8_t *) _b; int dr1, dg1, db1, dr2, dg2, db2; if (target == PIX_FMT_RGB8 || target == PIX_FMT_BGR8) { const uint8_t * const d64 = dither_8x8_73[y & 7]; const uint8_t * const d32 = dither_8x8_32[y & 7]; dr1 = dg1 = d32[(i * 2 + 0) & 7]; db1 = d64[(i * 2 + 0) & 7]; dr2 = dg2 = d32[(i * 2 + 1) & 7]; db2 = d64[(i * 2 + 1) & 7]; } else { const uint8_t * const d64 = dither_8x8_73 [y & 7]; const uint8_t * const d128 = dither_8x8_220[y & 7]; dr1 = db1 = d128[(i * 2 + 0) & 7]; dg1 = d64[(i * 2 + 0) & 7]; dr2 = db2 = d128[(i * 2 + 1) & 7]; dg2 = d64[(i * 2 + 1) & 7]; } if (target == PIX_FMT_RGB4 || target == PIX_FMT_BGR4) { dest[i] = r[Y1 + dr1] + g[Y1 + dg1] + b[Y1 + db1] + ((r[Y2 + dr2] + g[Y2 + dg2] + b[Y2 + db2]) << 4); } else { dest[i * 2 + 0] = r[Y1 + dr1] + g[Y1 + dg1] + b[Y1 + db1]; dest[i * 2 + 1] = r[Y2 + dr2] + g[Y2 + dg2] + b[Y2 + db2]; } } }
true
FFmpeg
77d88b872d8cbb42738ede2d4fc098c16f204236
YUV2PACKED16WRAPPER(yuv2, rgb48, rgb48be, PIX_FMT_RGB48BE) YUV2PACKED16WRAPPER(yuv2, rgb48, rgb48le, PIX_FMT_RGB48LE) YUV2PACKED16WRAPPER(yuv2, rgb48, bgr48be, PIX_FMT_BGR48BE) YUV2PACKED16WRAPPER(yuv2, rgb48, bgr48le, PIX_FMT_BGR48LE) static av_always_inline void yuv2rgb_write(uint8_t *_dest, int i, int Y1, int Y2, int U, int V, int A1, int A2, const void *_r, const void *_g, const void *_b, int y, enum PixelFormat target, int hasAlpha) { if (target == PIX_FMT_ARGB || target == PIX_FMT_RGBA || target == PIX_FMT_ABGR || target == PIX_FMT_BGRA) { uint32_t *dest = (uint32_t *) _dest; const uint32_t *r = (const uint32_t *) _r; const uint32_t *g = (const uint32_t *) _g; const uint32_t *b = (const uint32_t *) _b; #if CONFIG_SMALL int sh = hasAlpha ? ((target == PIX_FMT_RGB32_1 || target == PIX_FMT_BGR32_1) ? 0 : 24) : 0; dest[i * 2 + 0] = r[Y1] + g[Y1] + b[Y1] + (hasAlpha ? A1 << sh : 0); dest[i * 2 + 1] = r[Y2] + g[Y2] + b[Y2] + (hasAlpha ? A2 << sh : 0); #else if (hasAlpha) { int sh = (target == PIX_FMT_RGB32_1 || target == PIX_FMT_BGR32_1) ? 0 : 24; dest[i * 2 + 0] = r[Y1] + g[Y1] + b[Y1] + (A1 << sh); dest[i * 2 + 1] = r[Y2] + g[Y2] + b[Y2] + (A2 << sh); } else { dest[i * 2 + 0] = r[Y1] + g[Y1] + b[Y1]; dest[i * 2 + 1] = r[Y2] + g[Y2] + b[Y2]; } #endif } else if (target == PIX_FMT_RGB24 || target == PIX_FMT_BGR24) { uint8_t *dest = (uint8_t *) _dest; const uint8_t *r = (const uint8_t *) _r; const uint8_t *g = (const uint8_t *) _g; const uint8_t *b = (const uint8_t *) _b; #define r_b ((target == PIX_FMT_RGB24) ? r : b) #define b_r ((target == PIX_FMT_RGB24) ? b : r) dest[i * 6 + 0] = r_b[Y1]; dest[i * 6 + 1] = g[Y1]; dest[i * 6 + 2] = b_r[Y1]; dest[i * 6 + 3] = r_b[Y2]; dest[i * 6 + 4] = g[Y2]; dest[i * 6 + 5] = b_r[Y2]; #undef r_b #undef b_r } else if (target == PIX_FMT_RGB565 || target == PIX_FMT_BGR565 || target == PIX_FMT_RGB555 || target == PIX_FMT_BGR555 || target == PIX_FMT_RGB444 || target == PIX_FMT_BGR444) { uint16_t *dest = (uint16_t *) _dest; const uint16_t *r = (const uint16_t *) _r; const uint16_t *g = (const uint16_t *) _g; const uint16_t *b = (const uint16_t *) _b; int dr1, dg1, db1, dr2, dg2, db2; if (target == PIX_FMT_RGB565 || target == PIX_FMT_BGR565) { dr1 = dither_2x2_8[ y & 1 ][0]; dg1 = dither_2x2_4[ y & 1 ][0]; db1 = dither_2x2_8[(y & 1) ^ 1][0]; dr2 = dither_2x2_8[ y & 1 ][1]; dg2 = dither_2x2_4[ y & 1 ][1]; db2 = dither_2x2_8[(y & 1) ^ 1][1]; } else if (target == PIX_FMT_RGB555 || target == PIX_FMT_BGR555) { dr1 = dither_2x2_8[ y & 1 ][0]; dg1 = dither_2x2_8[ y & 1 ][1]; db1 = dither_2x2_8[(y & 1) ^ 1][0]; dr2 = dither_2x2_8[ y & 1 ][1]; dg2 = dither_2x2_8[ y & 1 ][0]; db2 = dither_2x2_8[(y & 1) ^ 1][1]; } else { dr1 = dither_4x4_16[ y & 3 ][0]; dg1 = dither_4x4_16[ y & 3 ][1]; db1 = dither_4x4_16[(y & 3) ^ 3][0]; dr2 = dither_4x4_16[ y & 3 ][1]; dg2 = dither_4x4_16[ y & 3 ][0]; db2 = dither_4x4_16[(y & 3) ^ 3][1]; } dest[i * 2 + 0] = r[Y1 + dr1] + g[Y1 + dg1] + b[Y1 + db1]; dest[i * 2 + 1] = r[Y2 + dr2] + g[Y2 + dg2] + b[Y2 + db2]; } else { uint8_t *dest = (uint8_t *) _dest; const uint8_t *r = (const uint8_t *) _r; const uint8_t *g = (const uint8_t *) _g; const uint8_t *b = (const uint8_t *) _b; int dr1, dg1, db1, dr2, dg2, db2; if (target == PIX_FMT_RGB8 || target == PIX_FMT_BGR8) { const uint8_t * const d64 = dither_8x8_73[y & 7]; const uint8_t * const d32 = dither_8x8_32[y & 7]; dr1 = dg1 = d32[(i * 2 + 0) & 7]; db1 = d64[(i * 2 + 0) & 7]; dr2 = dg2 = d32[(i * 2 + 1) & 7]; db2 = d64[(i * 2 + 1) & 7]; } else { const uint8_t * const d64 = dither_8x8_73 [y & 7]; const uint8_t * const d128 = dither_8x8_220[y & 7]; dr1 = db1 = d128[(i * 2 + 0) & 7]; dg1 = d64[(i * 2 + 0) & 7]; dr2 = db2 = d128[(i * 2 + 1) & 7]; dg2 = d64[(i * 2 + 1) & 7]; } if (target == PIX_FMT_RGB4 || target == PIX_FMT_BGR4) { dest[i] = r[Y1 + dr1] + g[Y1 + dg1] + b[Y1 + db1] + ((r[Y2 + dr2] + g[Y2 + dg2] + b[Y2 + db2]) << 4); } else { dest[i * 2 + 0] = r[Y1 + dr1] + g[Y1 + dg1] + b[Y1 + db1]; dest[i * 2 + 1] = r[Y2 + dr2] + g[Y2 + dg2] + b[Y2 + db2]; } } }
{ "code": [ "yuv2rgb_write(uint8_t *_dest, int i, int Y1, int Y2,", " int U, int V, int A1, int A2," ], "line_no": [ 13, 15 ] }
YUV2PACKED16WRAPPER(yuv2, rgb48, rgb48be, PIX_FMT_RGB48BE) YUV2PACKED16WRAPPER(yuv2, rgb48, rgb48le, PIX_FMT_RGB48LE) YUV2PACKED16WRAPPER(yuv2, rgb48, bgr48be, PIX_FMT_BGR48BE) YUV2PACKED16WRAPPER(yuv2, rgb48, bgr48le, PIX_FMT_BGR48LE) static av_always_inline void yuv2rgb_write(uint8_t *_dest, int i, int Y1, int Y2, int U, int V, int A1, int A2, const void *_r, const void *_g, const void *_b, int y, enum PixelFormat target, int hasAlpha) { if (target == PIX_FMT_ARGB || target == PIX_FMT_RGBA || target == PIX_FMT_ABGR || target == PIX_FMT_BGRA) { uint32_t *dest = (uint32_t *) _dest; const uint32_t *r = (const uint32_t *) _r; const uint32_t *g = (const uint32_t *) _g; const uint32_t *b = (const uint32_t *) _b; #if CONFIG_SMALL int sh = hasAlpha ? ((target == PIX_FMT_RGB32_1 || target == PIX_FMT_BGR32_1) ? 0 : 24) : 0; dest[i * 2 + 0] = r[Y1] + g[Y1] + b[Y1] + (hasAlpha ? A1 << sh : 0); dest[i * 2 + 1] = r[Y2] + g[Y2] + b[Y2] + (hasAlpha ? A2 << sh : 0); #else if (hasAlpha) { int sh = (target == PIX_FMT_RGB32_1 || target == PIX_FMT_BGR32_1) ? 0 : 24; dest[i * 2 + 0] = r[Y1] + g[Y1] + b[Y1] + (A1 << sh); dest[i * 2 + 1] = r[Y2] + g[Y2] + b[Y2] + (A2 << sh); } else { dest[i * 2 + 0] = r[Y1] + g[Y1] + b[Y1]; dest[i * 2 + 1] = r[Y2] + g[Y2] + b[Y2]; } #endif } else if (target == PIX_FMT_RGB24 || target == PIX_FMT_BGR24) { uint8_t *dest = (uint8_t *) _dest; const uint8_t *r = (const uint8_t *) _r; const uint8_t *g = (const uint8_t *) _g; const uint8_t *b = (const uint8_t *) _b; #define r_b ((target == PIX_FMT_RGB24) ? r : b) #define b_r ((target == PIX_FMT_RGB24) ? b : r) dest[i * 6 + 0] = r_b[Y1]; dest[i * 6 + 1] = g[Y1]; dest[i * 6 + 2] = b_r[Y1]; dest[i * 6 + 3] = r_b[Y2]; dest[i * 6 + 4] = g[Y2]; dest[i * 6 + 5] = b_r[Y2]; #undef r_b #undef b_r } else if (target == PIX_FMT_RGB565 || target == PIX_FMT_BGR565 || target == PIX_FMT_RGB555 || target == PIX_FMT_BGR555 || target == PIX_FMT_RGB444 || target == PIX_FMT_BGR444) { uint16_t *dest = (uint16_t *) _dest; const uint16_t *r = (const uint16_t *) _r; const uint16_t *g = (const uint16_t *) _g; const uint16_t *b = (const uint16_t *) _b; int dr1, dg1, db1, dr2, dg2, db2; if (target == PIX_FMT_RGB565 || target == PIX_FMT_BGR565) { dr1 = dither_2x2_8[ y & 1 ][0]; dg1 = dither_2x2_4[ y & 1 ][0]; db1 = dither_2x2_8[(y & 1) ^ 1][0]; dr2 = dither_2x2_8[ y & 1 ][1]; dg2 = dither_2x2_4[ y & 1 ][1]; db2 = dither_2x2_8[(y & 1) ^ 1][1]; } else if (target == PIX_FMT_RGB555 || target == PIX_FMT_BGR555) { dr1 = dither_2x2_8[ y & 1 ][0]; dg1 = dither_2x2_8[ y & 1 ][1]; db1 = dither_2x2_8[(y & 1) ^ 1][0]; dr2 = dither_2x2_8[ y & 1 ][1]; dg2 = dither_2x2_8[ y & 1 ][0]; db2 = dither_2x2_8[(y & 1) ^ 1][1]; } else { dr1 = dither_4x4_16[ y & 3 ][0]; dg1 = dither_4x4_16[ y & 3 ][1]; db1 = dither_4x4_16[(y & 3) ^ 3][0]; dr2 = dither_4x4_16[ y & 3 ][1]; dg2 = dither_4x4_16[ y & 3 ][0]; db2 = dither_4x4_16[(y & 3) ^ 3][1]; } dest[i * 2 + 0] = r[Y1 + dr1] + g[Y1 + dg1] + b[Y1 + db1]; dest[i * 2 + 1] = r[Y2 + dr2] + g[Y2 + dg2] + b[Y2 + db2]; } else { uint8_t *dest = (uint8_t *) _dest; const uint8_t *r = (const uint8_t *) _r; const uint8_t *g = (const uint8_t *) _g; const uint8_t *b = (const uint8_t *) _b; int dr1, dg1, db1, dr2, dg2, db2; if (target == PIX_FMT_RGB8 || target == PIX_FMT_BGR8) { const uint8_t * const d64 = dither_8x8_73[y & 7]; const uint8_t * const d32 = dither_8x8_32[y & 7]; dr1 = dg1 = d32[(i * 2 + 0) & 7]; db1 = d64[(i * 2 + 0) & 7]; dr2 = dg2 = d32[(i * 2 + 1) & 7]; db2 = d64[(i * 2 + 1) & 7]; } else { const uint8_t * const d64 = dither_8x8_73 [y & 7]; const uint8_t * const d128 = dither_8x8_220[y & 7]; dr1 = db1 = d128[(i * 2 + 0) & 7]; dg1 = d64[(i * 2 + 0) & 7]; dr2 = db2 = d128[(i * 2 + 1) & 7]; dg2 = d64[(i * 2 + 1) & 7]; } if (target == PIX_FMT_RGB4 || target == PIX_FMT_BGR4) { dest[i] = r[Y1 + dr1] + g[Y1 + dg1] + b[Y1 + db1] + ((r[Y2 + dr2] + g[Y2 + dg2] + b[Y2 + db2]) << 4); } else { dest[i * 2 + 0] = r[Y1 + dr1] + g[Y1 + dg1] + b[Y1 + db1]; dest[i * 2 + 1] = r[Y2 + dr2] + g[Y2 + dg2] + b[Y2 + db2]; } } }
[ "YUV2PACKED16WRAPPER(yuv2, rgb48, rgb48be, PIX_FMT_RGB48BE)\nYUV2PACKED16WRAPPER(yuv2, rgb48, rgb48le, PIX_FMT_RGB48LE)\nYUV2PACKED16WRAPPER(yuv2, rgb48, bgr48be, PIX_FMT_BGR48BE)\nYUV2PACKED16WRAPPER(yuv2, rgb48, bgr48le, PIX_FMT_BGR48LE)\nstatic av_always_inline void\nyuv2rgb_write(uint8_t *_dest, int i, int Y1, int Y2,\nint U, int V, int A1, int A2,\nconst void *_r, const void *_g, const void *_b, int y,\nenum PixelFormat target, int hasAlpha)\n{", "if (target == PIX_FMT_ARGB || target == PIX_FMT_RGBA ||\ntarget == PIX_FMT_ABGR || target == PIX_FMT_BGRA) {", "uint32_t *dest = (uint32_t *) _dest;", "const uint32_t *r = (const uint32_t *) _r;", "const uint32_t *g = (const uint32_t *) _g;", "const uint32_t *b = (const uint32_t *) _b;", "#if CONFIG_SMALL\nint sh = hasAlpha ? ((target == PIX_FMT_RGB32_1 || target == PIX_FMT_BGR32_1) ? 0 : 24) : 0;", "dest[i * 2 + 0] = r[Y1] + g[Y1] + b[Y1] + (hasAlpha ? A1 << sh : 0);", "dest[i * 2 + 1] = r[Y2] + g[Y2] + b[Y2] + (hasAlpha ? A2 << sh : 0);", "#else\nif (hasAlpha) {", "int sh = (target == PIX_FMT_RGB32_1 || target == PIX_FMT_BGR32_1) ? 0 : 24;", "dest[i * 2 + 0] = r[Y1] + g[Y1] + b[Y1] + (A1 << sh);", "dest[i * 2 + 1] = r[Y2] + g[Y2] + b[Y2] + (A2 << sh);", "} else {", "dest[i * 2 + 0] = r[Y1] + g[Y1] + b[Y1];", "dest[i * 2 + 1] = r[Y2] + g[Y2] + b[Y2];", "}", "#endif\n} else if (target == PIX_FMT_RGB24 || target == PIX_FMT_BGR24) {", "uint8_t *dest = (uint8_t *) _dest;", "const uint8_t *r = (const uint8_t *) _r;", "const uint8_t *g = (const uint8_t *) _g;", "const uint8_t *b = (const uint8_t *) _b;", "#define r_b ((target == PIX_FMT_RGB24) ? r : b)\n#define b_r ((target == PIX_FMT_RGB24) ? b : r)\ndest[i * 6 + 0] = r_b[Y1];", "dest[i * 6 + 1] = g[Y1];", "dest[i * 6 + 2] = b_r[Y1];", "dest[i * 6 + 3] = r_b[Y2];", "dest[i * 6 + 4] = g[Y2];", "dest[i * 6 + 5] = b_r[Y2];", "#undef r_b\n#undef b_r\n} else if (target == PIX_FMT_RGB565 || target == PIX_FMT_BGR565 ||", "target == PIX_FMT_RGB555 || target == PIX_FMT_BGR555 ||\ntarget == PIX_FMT_RGB444 || target == PIX_FMT_BGR444) {", "uint16_t *dest = (uint16_t *) _dest;", "const uint16_t *r = (const uint16_t *) _r;", "const uint16_t *g = (const uint16_t *) _g;", "const uint16_t *b = (const uint16_t *) _b;", "int dr1, dg1, db1, dr2, dg2, db2;", "if (target == PIX_FMT_RGB565 || target == PIX_FMT_BGR565) {", "dr1 = dither_2x2_8[ y & 1 ][0];", "dg1 = dither_2x2_4[ y & 1 ][0];", "db1 = dither_2x2_8[(y & 1) ^ 1][0];", "dr2 = dither_2x2_8[ y & 1 ][1];", "dg2 = dither_2x2_4[ y & 1 ][1];", "db2 = dither_2x2_8[(y & 1) ^ 1][1];", "} else if (target == PIX_FMT_RGB555 || target == PIX_FMT_BGR555) {", "dr1 = dither_2x2_8[ y & 1 ][0];", "dg1 = dither_2x2_8[ y & 1 ][1];", "db1 = dither_2x2_8[(y & 1) ^ 1][0];", "dr2 = dither_2x2_8[ y & 1 ][1];", "dg2 = dither_2x2_8[ y & 1 ][0];", "db2 = dither_2x2_8[(y & 1) ^ 1][1];", "} else {", "dr1 = dither_4x4_16[ y & 3 ][0];", "dg1 = dither_4x4_16[ y & 3 ][1];", "db1 = dither_4x4_16[(y & 3) ^ 3][0];", "dr2 = dither_4x4_16[ y & 3 ][1];", "dg2 = dither_4x4_16[ y & 3 ][0];", "db2 = dither_4x4_16[(y & 3) ^ 3][1];", "}", "dest[i * 2 + 0] = r[Y1 + dr1] + g[Y1 + dg1] + b[Y1 + db1];", "dest[i * 2 + 1] = r[Y2 + dr2] + g[Y2 + dg2] + b[Y2 + db2];", "} else {", "uint8_t *dest = (uint8_t *) _dest;", "const uint8_t *r = (const uint8_t *) _r;", "const uint8_t *g = (const uint8_t *) _g;", "const uint8_t *b = (const uint8_t *) _b;", "int dr1, dg1, db1, dr2, dg2, db2;", "if (target == PIX_FMT_RGB8 || target == PIX_FMT_BGR8) {", "const uint8_t * const d64 = dither_8x8_73[y & 7];", "const uint8_t * const d32 = dither_8x8_32[y & 7];", "dr1 = dg1 = d32[(i * 2 + 0) & 7];", "db1 = d64[(i * 2 + 0) & 7];", "dr2 = dg2 = d32[(i * 2 + 1) & 7];", "db2 = d64[(i * 2 + 1) & 7];", "} else {", "const uint8_t * const d64 = dither_8x8_73 [y & 7];", "const uint8_t * const d128 = dither_8x8_220[y & 7];", "dr1 = db1 = d128[(i * 2 + 0) & 7];", "dg1 = d64[(i * 2 + 0) & 7];", "dr2 = db2 = d128[(i * 2 + 1) & 7];", "dg2 = d64[(i * 2 + 1) & 7];", "}", "if (target == PIX_FMT_RGB4 || target == PIX_FMT_BGR4) {", "dest[i] = r[Y1 + dr1] + g[Y1 + dg1] + b[Y1 + db1] +\n((r[Y2 + dr2] + g[Y2 + dg2] + b[Y2 + db2]) << 4);", "} else {", "dest[i * 2 + 0] = r[Y1 + dr1] + g[Y1 + dg1] + b[Y1 + db1];", "dest[i * 2 + 1] = r[Y2 + dr2] + g[Y2 + dg2] + b[Y2 + db2];", "}", "}", "}" ]
[ 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 ]
[ [ 1, 3, 5, 7, 11, 13, 15, 17, 19, 21 ], [ 23, 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37, 39 ], [ 43 ], [ 45 ], [ 47, 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67, 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81, 83, 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97, 99, 101 ], [ 103, 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 215 ], [ 217, 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ] ]
18,490
static void musb_rx_packet_complete(USBPacket *packey, void *opaque) { /* Unfortunately we can't use packey->devep because that's the remote * endpoint number and may be different than our local. */ MUSBEndPoint *ep = (MUSBEndPoint *) opaque; int epnum = ep->epnum; MUSBState *s = ep->musb; ep->fifostart[1] = 0; ep->fifolen[1] = 0; #ifdef CLEAR_NAK if (ep->status[1] != USB_RET_NAK) { #endif ep->csr[1] &= ~MGC_M_RXCSR_H_REQPKT; if (!epnum) ep->csr[0] &= ~MGC_M_CSR0_H_REQPKT; #ifdef CLEAR_NAK } #endif /* Clear all of the imaginable error bits first */ ep->csr[1] &= ~(MGC_M_RXCSR_H_ERROR | MGC_M_RXCSR_H_RXSTALL | MGC_M_RXCSR_DATAERROR); if (!epnum) ep->csr[0] &= ~(MGC_M_CSR0_H_ERROR | MGC_M_CSR0_H_RXSTALL | MGC_M_CSR0_H_NAKTIMEOUT | MGC_M_CSR0_H_NO_PING); if (ep->status[1] == USB_RET_STALL) { ep->status[1] = 0; packey->len = 0; ep->csr[1] |= MGC_M_RXCSR_H_RXSTALL; if (!epnum) ep->csr[0] |= MGC_M_CSR0_H_RXSTALL; } if (ep->status[1] == USB_RET_NAK) { ep->status[1] = 0; /* NAK timeouts are only generated in Bulk transfers and * Data-errors in Isochronous. */ if (ep->interrupt[1]) return musb_packet(s, ep, epnum, USB_TOKEN_IN, packey->len, musb_rx_packet_complete, 1); ep->csr[1] |= MGC_M_RXCSR_DATAERROR; if (!epnum) ep->csr[0] |= MGC_M_CSR0_H_NAKTIMEOUT; } if (ep->status[1] < 0) { if (ep->status[1] == USB_RET_BABBLE) { musb_intr_set(s, musb_irq_rst_babble, 1); return; } /* Pretend we've tried three times already and failed (in * case of a control transfer). */ ep->csr[1] |= MGC_M_RXCSR_H_ERROR; if (!epnum) ep->csr[0] |= MGC_M_CSR0_H_ERROR; musb_rx_intr_set(s, epnum, 1); return; } /* TODO: check len for over/underruns of an OUT packet? */ /* TODO: perhaps make use of e->ext_size[1] here. */ packey->len = ep->status[1]; if (!(ep->csr[1] & (MGC_M_RXCSR_H_RXSTALL | MGC_M_RXCSR_DATAERROR))) { ep->csr[1] |= MGC_M_RXCSR_FIFOFULL | MGC_M_RXCSR_RXPKTRDY; if (!epnum) ep->csr[0] |= MGC_M_CSR0_RXPKTRDY; ep->rxcount = packey->len; /* XXX: MIN(packey->len, ep->maxp[1]); */ /* In DMA mode: assert DMA request for this EP */ } /* Only if DMA has not been asserted */ musb_rx_intr_set(s, epnum, 1); }
true
qemu
4f4321c11ff6e98583846bfd6f0e81954924b003
static void musb_rx_packet_complete(USBPacket *packey, void *opaque) { MUSBEndPoint *ep = (MUSBEndPoint *) opaque; int epnum = ep->epnum; MUSBState *s = ep->musb; ep->fifostart[1] = 0; ep->fifolen[1] = 0; #ifdef CLEAR_NAK if (ep->status[1] != USB_RET_NAK) { #endif ep->csr[1] &= ~MGC_M_RXCSR_H_REQPKT; if (!epnum) ep->csr[0] &= ~MGC_M_CSR0_H_REQPKT; #ifdef CLEAR_NAK } #endif ep->csr[1] &= ~(MGC_M_RXCSR_H_ERROR | MGC_M_RXCSR_H_RXSTALL | MGC_M_RXCSR_DATAERROR); if (!epnum) ep->csr[0] &= ~(MGC_M_CSR0_H_ERROR | MGC_M_CSR0_H_RXSTALL | MGC_M_CSR0_H_NAKTIMEOUT | MGC_M_CSR0_H_NO_PING); if (ep->status[1] == USB_RET_STALL) { ep->status[1] = 0; packey->len = 0; ep->csr[1] |= MGC_M_RXCSR_H_RXSTALL; if (!epnum) ep->csr[0] |= MGC_M_CSR0_H_RXSTALL; } if (ep->status[1] == USB_RET_NAK) { ep->status[1] = 0; if (ep->interrupt[1]) return musb_packet(s, ep, epnum, USB_TOKEN_IN, packey->len, musb_rx_packet_complete, 1); ep->csr[1] |= MGC_M_RXCSR_DATAERROR; if (!epnum) ep->csr[0] |= MGC_M_CSR0_H_NAKTIMEOUT; } if (ep->status[1] < 0) { if (ep->status[1] == USB_RET_BABBLE) { musb_intr_set(s, musb_irq_rst_babble, 1); return; } ep->csr[1] |= MGC_M_RXCSR_H_ERROR; if (!epnum) ep->csr[0] |= MGC_M_CSR0_H_ERROR; musb_rx_intr_set(s, epnum, 1); return; } packey->len = ep->status[1]; if (!(ep->csr[1] & (MGC_M_RXCSR_H_RXSTALL | MGC_M_RXCSR_DATAERROR))) { ep->csr[1] |= MGC_M_RXCSR_FIFOFULL | MGC_M_RXCSR_RXPKTRDY; if (!epnum) ep->csr[0] |= MGC_M_CSR0_RXPKTRDY; ep->rxcount = packey->len; } musb_rx_intr_set(s, epnum, 1); }
{ "code": [ " packey->len = 0;", " packey->len, musb_rx_packet_complete, 1);", " packey->len = ep->status[1];" ], "line_no": [ 61, 89, 139 ] }
static void FUNC_0(USBPacket *VAR_0, void *VAR_1) { MUSBEndPoint *ep = (MUSBEndPoint *) VAR_1; int VAR_2 = ep->VAR_2; MUSBState *s = ep->musb; ep->fifostart[1] = 0; ep->fifolen[1] = 0; #ifdef CLEAR_NAK if (ep->status[1] != USB_RET_NAK) { #endif ep->csr[1] &= ~MGC_M_RXCSR_H_REQPKT; if (!VAR_2) ep->csr[0] &= ~MGC_M_CSR0_H_REQPKT; #ifdef CLEAR_NAK } #endif ep->csr[1] &= ~(MGC_M_RXCSR_H_ERROR | MGC_M_RXCSR_H_RXSTALL | MGC_M_RXCSR_DATAERROR); if (!VAR_2) ep->csr[0] &= ~(MGC_M_CSR0_H_ERROR | MGC_M_CSR0_H_RXSTALL | MGC_M_CSR0_H_NAKTIMEOUT | MGC_M_CSR0_H_NO_PING); if (ep->status[1] == USB_RET_STALL) { ep->status[1] = 0; VAR_0->len = 0; ep->csr[1] |= MGC_M_RXCSR_H_RXSTALL; if (!VAR_2) ep->csr[0] |= MGC_M_CSR0_H_RXSTALL; } if (ep->status[1] == USB_RET_NAK) { ep->status[1] = 0; if (ep->interrupt[1]) return musb_packet(s, ep, VAR_2, USB_TOKEN_IN, VAR_0->len, FUNC_0, 1); ep->csr[1] |= MGC_M_RXCSR_DATAERROR; if (!VAR_2) ep->csr[0] |= MGC_M_CSR0_H_NAKTIMEOUT; } if (ep->status[1] < 0) { if (ep->status[1] == USB_RET_BABBLE) { musb_intr_set(s, musb_irq_rst_babble, 1); return; } ep->csr[1] |= MGC_M_RXCSR_H_ERROR; if (!VAR_2) ep->csr[0] |= MGC_M_CSR0_H_ERROR; musb_rx_intr_set(s, VAR_2, 1); return; } VAR_0->len = ep->status[1]; if (!(ep->csr[1] & (MGC_M_RXCSR_H_RXSTALL | MGC_M_RXCSR_DATAERROR))) { ep->csr[1] |= MGC_M_RXCSR_FIFOFULL | MGC_M_RXCSR_RXPKTRDY; if (!VAR_2) ep->csr[0] |= MGC_M_CSR0_RXPKTRDY; ep->rxcount = VAR_0->len; } musb_rx_intr_set(s, VAR_2, 1); }
[ "static void FUNC_0(USBPacket *VAR_0, void *VAR_1)\n{", "MUSBEndPoint *ep = (MUSBEndPoint *) VAR_1;", "int VAR_2 = ep->VAR_2;", "MUSBState *s = ep->musb;", "ep->fifostart[1] = 0;", "ep->fifolen[1] = 0;", "#ifdef CLEAR_NAK\nif (ep->status[1] != USB_RET_NAK) {", "#endif\nep->csr[1] &= ~MGC_M_RXCSR_H_REQPKT;", "if (!VAR_2)\nep->csr[0] &= ~MGC_M_CSR0_H_REQPKT;", "#ifdef CLEAR_NAK\n}", "#endif\nep->csr[1] &= ~(MGC_M_RXCSR_H_ERROR | MGC_M_RXCSR_H_RXSTALL |\nMGC_M_RXCSR_DATAERROR);", "if (!VAR_2)\nep->csr[0] &= ~(MGC_M_CSR0_H_ERROR | MGC_M_CSR0_H_RXSTALL |\nMGC_M_CSR0_H_NAKTIMEOUT | MGC_M_CSR0_H_NO_PING);", "if (ep->status[1] == USB_RET_STALL) {", "ep->status[1] = 0;", "VAR_0->len = 0;", "ep->csr[1] |= MGC_M_RXCSR_H_RXSTALL;", "if (!VAR_2)\nep->csr[0] |= MGC_M_CSR0_H_RXSTALL;", "}", "if (ep->status[1] == USB_RET_NAK) {", "ep->status[1] = 0;", "if (ep->interrupt[1])\nreturn musb_packet(s, ep, VAR_2, USB_TOKEN_IN,\nVAR_0->len, FUNC_0, 1);", "ep->csr[1] |= MGC_M_RXCSR_DATAERROR;", "if (!VAR_2)\nep->csr[0] |= MGC_M_CSR0_H_NAKTIMEOUT;", "}", "if (ep->status[1] < 0) {", "if (ep->status[1] == USB_RET_BABBLE) {", "musb_intr_set(s, musb_irq_rst_babble, 1);", "return;", "}", "ep->csr[1] |= MGC_M_RXCSR_H_ERROR;", "if (!VAR_2)\nep->csr[0] |= MGC_M_CSR0_H_ERROR;", "musb_rx_intr_set(s, VAR_2, 1);", "return;", "}", "VAR_0->len = ep->status[1];", "if (!(ep->csr[1] & (MGC_M_RXCSR_H_RXSTALL | MGC_M_RXCSR_DATAERROR))) {", "ep->csr[1] |= MGC_M_RXCSR_FIFOFULL | MGC_M_RXCSR_RXPKTRDY;", "if (!VAR_2)\nep->csr[0] |= MGC_M_CSR0_RXPKTRDY;", "ep->rxcount = VAR_0->len;", "}", "musb_rx_intr_set(s, VAR_2, 1);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 23, 25 ], [ 27, 29 ], [ 31, 33 ], [ 35, 37 ], [ 39, 45, 47 ], [ 49, 51, 53 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67, 69 ], [ 71 ], [ 75 ], [ 77 ], [ 85, 87, 89 ], [ 93 ], [ 95, 97 ], [ 99 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 119 ], [ 121, 123 ], [ 127 ], [ 129 ], [ 131 ], [ 139 ], [ 143 ], [ 145 ], [ 147, 149 ], [ 153 ], [ 157 ], [ 163 ], [ 165 ] ]
18,491
static int process_requests(int sock) { int flags; int size = 0; int retval = 0; uint64_t offset; ProxyHeader header; int mode, uid, gid; V9fsString name, value; struct timespec spec[2]; V9fsString oldpath, path; struct iovec in_iovec, out_iovec; in_iovec.iov_base = g_malloc(PROXY_MAX_IO_SZ + PROXY_HDR_SZ); in_iovec.iov_len = PROXY_MAX_IO_SZ + PROXY_HDR_SZ; out_iovec.iov_base = g_malloc(PROXY_MAX_IO_SZ + PROXY_HDR_SZ); out_iovec.iov_len = PROXY_MAX_IO_SZ + PROXY_HDR_SZ; while (1) { /* * initialize the header type, so that we send * response to proper request type. */ header.type = 0; retval = read_request(sock, &in_iovec, &header); if (retval < 0) { goto err_out; } switch (header.type) { case T_OPEN: retval = do_open(&in_iovec); break; case T_CREATE: retval = do_create(&in_iovec); break; case T_MKNOD: case T_MKDIR: case T_SYMLINK: retval = do_create_others(header.type, &in_iovec); break; case T_LINK: v9fs_string_init(&path); v9fs_string_init(&oldpath); retval = proxy_unmarshal(&in_iovec, PROXY_HDR_SZ, "ss", &oldpath, &path); if (retval > 0) { retval = link(oldpath.data, path.data); if (retval < 0) { retval = -errno; } } v9fs_string_free(&oldpath); v9fs_string_free(&path); break; case T_LSTAT: case T_STATFS: retval = do_stat(header.type, &in_iovec, &out_iovec); break; case T_READLINK: retval = do_readlink(&in_iovec, &out_iovec); break; case T_CHMOD: v9fs_string_init(&path); retval = proxy_unmarshal(&in_iovec, PROXY_HDR_SZ, "sd", &path, &mode); if (retval > 0) { retval = chmod(path.data, mode); if (retval < 0) { retval = -errno; } } v9fs_string_free(&path); break; case T_CHOWN: v9fs_string_init(&path); retval = proxy_unmarshal(&in_iovec, PROXY_HDR_SZ, "sdd", &path, &uid, &gid); if (retval > 0) { retval = lchown(path.data, uid, gid); if (retval < 0) { retval = -errno; } } v9fs_string_free(&path); break; case T_TRUNCATE: v9fs_string_init(&path); retval = proxy_unmarshal(&in_iovec, PROXY_HDR_SZ, "sq", &path, &offset); if (retval > 0) { retval = truncate(path.data, offset); if (retval < 0) { retval = -errno; } } v9fs_string_free(&path); break; case T_UTIME: v9fs_string_init(&path); retval = proxy_unmarshal(&in_iovec, PROXY_HDR_SZ, "sqqqq", &path, &spec[0].tv_sec, &spec[0].tv_nsec, &spec[1].tv_sec, &spec[1].tv_nsec); if (retval > 0) { retval = qemu_utimens(path.data, spec); if (retval < 0) { retval = -errno; } } v9fs_string_free(&path); break; case T_RENAME: v9fs_string_init(&path); v9fs_string_init(&oldpath); retval = proxy_unmarshal(&in_iovec, PROXY_HDR_SZ, "ss", &oldpath, &path); if (retval > 0) { retval = rename(oldpath.data, path.data); if (retval < 0) { retval = -errno; } } v9fs_string_free(&oldpath); v9fs_string_free(&path); break; case T_REMOVE: v9fs_string_init(&path); retval = proxy_unmarshal(&in_iovec, PROXY_HDR_SZ, "s", &path); if (retval > 0) { retval = remove(path.data); if (retval < 0) { retval = -errno; } } v9fs_string_free(&path); break; case T_LGETXATTR: case T_LLISTXATTR: retval = do_getxattr(header.type, &in_iovec, &out_iovec); break; case T_LSETXATTR: v9fs_string_init(&path); v9fs_string_init(&name); v9fs_string_init(&value); retval = proxy_unmarshal(&in_iovec, PROXY_HDR_SZ, "sssdd", &path, &name, &value, &size, &flags); if (retval > 0) { retval = lsetxattr(path.data, name.data, value.data, size, flags); if (retval < 0) { retval = -errno; } } v9fs_string_free(&path); v9fs_string_free(&name); v9fs_string_free(&value); break; case T_LREMOVEXATTR: v9fs_string_init(&path); v9fs_string_init(&name); retval = proxy_unmarshal(&in_iovec, PROXY_HDR_SZ, "ss", &path, &name); if (retval > 0) { retval = lremovexattr(path.data, name.data); if (retval < 0) { retval = -errno; } } v9fs_string_free(&path); v9fs_string_free(&name); break; case T_GETVERSION: retval = do_getversion(&in_iovec, &out_iovec); break; default: goto err_out; break; } if (process_reply(sock, header.type, &out_iovec, retval) < 0) { goto err_out; } } err_out: g_free(in_iovec.iov_base); g_free(out_iovec.iov_base); return -1; }
true
qemu
24df3371d97a7516605aef8abbc253a8c162b211
static int process_requests(int sock) { int flags; int size = 0; int retval = 0; uint64_t offset; ProxyHeader header; int mode, uid, gid; V9fsString name, value; struct timespec spec[2]; V9fsString oldpath, path; struct iovec in_iovec, out_iovec; in_iovec.iov_base = g_malloc(PROXY_MAX_IO_SZ + PROXY_HDR_SZ); in_iovec.iov_len = PROXY_MAX_IO_SZ + PROXY_HDR_SZ; out_iovec.iov_base = g_malloc(PROXY_MAX_IO_SZ + PROXY_HDR_SZ); out_iovec.iov_len = PROXY_MAX_IO_SZ + PROXY_HDR_SZ; while (1) { header.type = 0; retval = read_request(sock, &in_iovec, &header); if (retval < 0) { goto err_out; } switch (header.type) { case T_OPEN: retval = do_open(&in_iovec); break; case T_CREATE: retval = do_create(&in_iovec); break; case T_MKNOD: case T_MKDIR: case T_SYMLINK: retval = do_create_others(header.type, &in_iovec); break; case T_LINK: v9fs_string_init(&path); v9fs_string_init(&oldpath); retval = proxy_unmarshal(&in_iovec, PROXY_HDR_SZ, "ss", &oldpath, &path); if (retval > 0) { retval = link(oldpath.data, path.data); if (retval < 0) { retval = -errno; } } v9fs_string_free(&oldpath); v9fs_string_free(&path); break; case T_LSTAT: case T_STATFS: retval = do_stat(header.type, &in_iovec, &out_iovec); break; case T_READLINK: retval = do_readlink(&in_iovec, &out_iovec); break; case T_CHMOD: v9fs_string_init(&path); retval = proxy_unmarshal(&in_iovec, PROXY_HDR_SZ, "sd", &path, &mode); if (retval > 0) { retval = chmod(path.data, mode); if (retval < 0) { retval = -errno; } } v9fs_string_free(&path); break; case T_CHOWN: v9fs_string_init(&path); retval = proxy_unmarshal(&in_iovec, PROXY_HDR_SZ, "sdd", &path, &uid, &gid); if (retval > 0) { retval = lchown(path.data, uid, gid); if (retval < 0) { retval = -errno; } } v9fs_string_free(&path); break; case T_TRUNCATE: v9fs_string_init(&path); retval = proxy_unmarshal(&in_iovec, PROXY_HDR_SZ, "sq", &path, &offset); if (retval > 0) { retval = truncate(path.data, offset); if (retval < 0) { retval = -errno; } } v9fs_string_free(&path); break; case T_UTIME: v9fs_string_init(&path); retval = proxy_unmarshal(&in_iovec, PROXY_HDR_SZ, "sqqqq", &path, &spec[0].tv_sec, &spec[0].tv_nsec, &spec[1].tv_sec, &spec[1].tv_nsec); if (retval > 0) { retval = qemu_utimens(path.data, spec); if (retval < 0) { retval = -errno; } } v9fs_string_free(&path); break; case T_RENAME: v9fs_string_init(&path); v9fs_string_init(&oldpath); retval = proxy_unmarshal(&in_iovec, PROXY_HDR_SZ, "ss", &oldpath, &path); if (retval > 0) { retval = rename(oldpath.data, path.data); if (retval < 0) { retval = -errno; } } v9fs_string_free(&oldpath); v9fs_string_free(&path); break; case T_REMOVE: v9fs_string_init(&path); retval = proxy_unmarshal(&in_iovec, PROXY_HDR_SZ, "s", &path); if (retval > 0) { retval = remove(path.data); if (retval < 0) { retval = -errno; } } v9fs_string_free(&path); break; case T_LGETXATTR: case T_LLISTXATTR: retval = do_getxattr(header.type, &in_iovec, &out_iovec); break; case T_LSETXATTR: v9fs_string_init(&path); v9fs_string_init(&name); v9fs_string_init(&value); retval = proxy_unmarshal(&in_iovec, PROXY_HDR_SZ, "sssdd", &path, &name, &value, &size, &flags); if (retval > 0) { retval = lsetxattr(path.data, name.data, value.data, size, flags); if (retval < 0) { retval = -errno; } } v9fs_string_free(&path); v9fs_string_free(&name); v9fs_string_free(&value); break; case T_LREMOVEXATTR: v9fs_string_init(&path); v9fs_string_init(&name); retval = proxy_unmarshal(&in_iovec, PROXY_HDR_SZ, "ss", &path, &name); if (retval > 0) { retval = lremovexattr(path.data, name.data); if (retval < 0) { retval = -errno; } } v9fs_string_free(&path); v9fs_string_free(&name); break; case T_GETVERSION: retval = do_getversion(&in_iovec, &out_iovec); break; default: goto err_out; break; } if (process_reply(sock, header.type, &out_iovec, retval) < 0) { goto err_out; } } err_out: g_free(in_iovec.iov_base); g_free(out_iovec.iov_base); return -1; }
{ "code": [ " retval = qemu_utimens(path.data, spec);" ], "line_no": [ 209 ] }
static int FUNC_0(int VAR_0) { int VAR_1; int VAR_2 = 0; int VAR_3 = 0; uint64_t offset; ProxyHeader header; int VAR_4, VAR_5, VAR_6; V9fsString name, value; struct timespec VAR_7[2]; V9fsString oldpath, path; struct iovec VAR_8, VAR_9; VAR_8.iov_base = g_malloc(PROXY_MAX_IO_SZ + PROXY_HDR_SZ); VAR_8.iov_len = PROXY_MAX_IO_SZ + PROXY_HDR_SZ; VAR_9.iov_base = g_malloc(PROXY_MAX_IO_SZ + PROXY_HDR_SZ); VAR_9.iov_len = PROXY_MAX_IO_SZ + PROXY_HDR_SZ; while (1) { header.type = 0; VAR_3 = read_request(VAR_0, &VAR_8, &header); if (VAR_3 < 0) { goto err_out; } switch (header.type) { case T_OPEN: VAR_3 = do_open(&VAR_8); break; case T_CREATE: VAR_3 = do_create(&VAR_8); break; case T_MKNOD: case T_MKDIR: case T_SYMLINK: VAR_3 = do_create_others(header.type, &VAR_8); break; case T_LINK: v9fs_string_init(&path); v9fs_string_init(&oldpath); VAR_3 = proxy_unmarshal(&VAR_8, PROXY_HDR_SZ, "ss", &oldpath, &path); if (VAR_3 > 0) { VAR_3 = link(oldpath.data, path.data); if (VAR_3 < 0) { VAR_3 = -errno; } } v9fs_string_free(&oldpath); v9fs_string_free(&path); break; case T_LSTAT: case T_STATFS: VAR_3 = do_stat(header.type, &VAR_8, &VAR_9); break; case T_READLINK: VAR_3 = do_readlink(&VAR_8, &VAR_9); break; case T_CHMOD: v9fs_string_init(&path); VAR_3 = proxy_unmarshal(&VAR_8, PROXY_HDR_SZ, "sd", &path, &VAR_4); if (VAR_3 > 0) { VAR_3 = chmod(path.data, VAR_4); if (VAR_3 < 0) { VAR_3 = -errno; } } v9fs_string_free(&path); break; case T_CHOWN: v9fs_string_init(&path); VAR_3 = proxy_unmarshal(&VAR_8, PROXY_HDR_SZ, "sdd", &path, &VAR_5, &VAR_6); if (VAR_3 > 0) { VAR_3 = lchown(path.data, VAR_5, VAR_6); if (VAR_3 < 0) { VAR_3 = -errno; } } v9fs_string_free(&path); break; case T_TRUNCATE: v9fs_string_init(&path); VAR_3 = proxy_unmarshal(&VAR_8, PROXY_HDR_SZ, "sq", &path, &offset); if (VAR_3 > 0) { VAR_3 = truncate(path.data, offset); if (VAR_3 < 0) { VAR_3 = -errno; } } v9fs_string_free(&path); break; case T_UTIME: v9fs_string_init(&path); VAR_3 = proxy_unmarshal(&VAR_8, PROXY_HDR_SZ, "sqqqq", &path, &VAR_7[0].tv_sec, &VAR_7[0].tv_nsec, &VAR_7[1].tv_sec, &VAR_7[1].tv_nsec); if (VAR_3 > 0) { VAR_3 = qemu_utimens(path.data, VAR_7); if (VAR_3 < 0) { VAR_3 = -errno; } } v9fs_string_free(&path); break; case T_RENAME: v9fs_string_init(&path); v9fs_string_init(&oldpath); VAR_3 = proxy_unmarshal(&VAR_8, PROXY_HDR_SZ, "ss", &oldpath, &path); if (VAR_3 > 0) { VAR_3 = rename(oldpath.data, path.data); if (VAR_3 < 0) { VAR_3 = -errno; } } v9fs_string_free(&oldpath); v9fs_string_free(&path); break; case T_REMOVE: v9fs_string_init(&path); VAR_3 = proxy_unmarshal(&VAR_8, PROXY_HDR_SZ, "s", &path); if (VAR_3 > 0) { VAR_3 = remove(path.data); if (VAR_3 < 0) { VAR_3 = -errno; } } v9fs_string_free(&path); break; case T_LGETXATTR: case T_LLISTXATTR: VAR_3 = do_getxattr(header.type, &VAR_8, &VAR_9); break; case T_LSETXATTR: v9fs_string_init(&path); v9fs_string_init(&name); v9fs_string_init(&value); VAR_3 = proxy_unmarshal(&VAR_8, PROXY_HDR_SZ, "sssdd", &path, &name, &value, &VAR_2, &VAR_1); if (VAR_3 > 0) { VAR_3 = lsetxattr(path.data, name.data, value.data, VAR_2, VAR_1); if (VAR_3 < 0) { VAR_3 = -errno; } } v9fs_string_free(&path); v9fs_string_free(&name); v9fs_string_free(&value); break; case T_LREMOVEXATTR: v9fs_string_init(&path); v9fs_string_init(&name); VAR_3 = proxy_unmarshal(&VAR_8, PROXY_HDR_SZ, "ss", &path, &name); if (VAR_3 > 0) { VAR_3 = lremovexattr(path.data, name.data); if (VAR_3 < 0) { VAR_3 = -errno; } } v9fs_string_free(&path); v9fs_string_free(&name); break; case T_GETVERSION: VAR_3 = do_getversion(&VAR_8, &VAR_9); break; default: goto err_out; break; } if (process_reply(VAR_0, header.type, &VAR_9, VAR_3) < 0) { goto err_out; } } err_out: g_free(VAR_8.iov_base); g_free(VAR_9.iov_base); return -1; }
[ "static int FUNC_0(int VAR_0)\n{", "int VAR_1;", "int VAR_2 = 0;", "int VAR_3 = 0;", "uint64_t offset;", "ProxyHeader header;", "int VAR_4, VAR_5, VAR_6;", "V9fsString name, value;", "struct timespec VAR_7[2];", "V9fsString oldpath, path;", "struct iovec VAR_8, VAR_9;", "VAR_8.iov_base = g_malloc(PROXY_MAX_IO_SZ + PROXY_HDR_SZ);", "VAR_8.iov_len = PROXY_MAX_IO_SZ + PROXY_HDR_SZ;", "VAR_9.iov_base = g_malloc(PROXY_MAX_IO_SZ + PROXY_HDR_SZ);", "VAR_9.iov_len = PROXY_MAX_IO_SZ + PROXY_HDR_SZ;", "while (1) {", "header.type = 0;", "VAR_3 = read_request(VAR_0, &VAR_8, &header);", "if (VAR_3 < 0) {", "goto err_out;", "}", "switch (header.type) {", "case T_OPEN:\nVAR_3 = do_open(&VAR_8);", "break;", "case T_CREATE:\nVAR_3 = do_create(&VAR_8);", "break;", "case T_MKNOD:\ncase T_MKDIR:\ncase T_SYMLINK:\nVAR_3 = do_create_others(header.type, &VAR_8);", "break;", "case T_LINK:\nv9fs_string_init(&path);", "v9fs_string_init(&oldpath);", "VAR_3 = proxy_unmarshal(&VAR_8, PROXY_HDR_SZ,\n\"ss\", &oldpath, &path);", "if (VAR_3 > 0) {", "VAR_3 = link(oldpath.data, path.data);", "if (VAR_3 < 0) {", "VAR_3 = -errno;", "}", "}", "v9fs_string_free(&oldpath);", "v9fs_string_free(&path);", "break;", "case T_LSTAT:\ncase T_STATFS:\nVAR_3 = do_stat(header.type, &VAR_8, &VAR_9);", "break;", "case T_READLINK:\nVAR_3 = do_readlink(&VAR_8, &VAR_9);", "break;", "case T_CHMOD:\nv9fs_string_init(&path);", "VAR_3 = proxy_unmarshal(&VAR_8, PROXY_HDR_SZ,\n\"sd\", &path, &VAR_4);", "if (VAR_3 > 0) {", "VAR_3 = chmod(path.data, VAR_4);", "if (VAR_3 < 0) {", "VAR_3 = -errno;", "}", "}", "v9fs_string_free(&path);", "break;", "case T_CHOWN:\nv9fs_string_init(&path);", "VAR_3 = proxy_unmarshal(&VAR_8, PROXY_HDR_SZ, \"sdd\", &path,\n&VAR_5, &VAR_6);", "if (VAR_3 > 0) {", "VAR_3 = lchown(path.data, VAR_5, VAR_6);", "if (VAR_3 < 0) {", "VAR_3 = -errno;", "}", "}", "v9fs_string_free(&path);", "break;", "case T_TRUNCATE:\nv9fs_string_init(&path);", "VAR_3 = proxy_unmarshal(&VAR_8, PROXY_HDR_SZ, \"sq\",\n&path, &offset);", "if (VAR_3 > 0) {", "VAR_3 = truncate(path.data, offset);", "if (VAR_3 < 0) {", "VAR_3 = -errno;", "}", "}", "v9fs_string_free(&path);", "break;", "case T_UTIME:\nv9fs_string_init(&path);", "VAR_3 = proxy_unmarshal(&VAR_8, PROXY_HDR_SZ, \"sqqqq\", &path,\n&VAR_7[0].tv_sec, &VAR_7[0].tv_nsec,\n&VAR_7[1].tv_sec, &VAR_7[1].tv_nsec);", "if (VAR_3 > 0) {", "VAR_3 = qemu_utimens(path.data, VAR_7);", "if (VAR_3 < 0) {", "VAR_3 = -errno;", "}", "}", "v9fs_string_free(&path);", "break;", "case T_RENAME:\nv9fs_string_init(&path);", "v9fs_string_init(&oldpath);", "VAR_3 = proxy_unmarshal(&VAR_8, PROXY_HDR_SZ,\n\"ss\", &oldpath, &path);", "if (VAR_3 > 0) {", "VAR_3 = rename(oldpath.data, path.data);", "if (VAR_3 < 0) {", "VAR_3 = -errno;", "}", "}", "v9fs_string_free(&oldpath);", "v9fs_string_free(&path);", "break;", "case T_REMOVE:\nv9fs_string_init(&path);", "VAR_3 = proxy_unmarshal(&VAR_8, PROXY_HDR_SZ, \"s\", &path);", "if (VAR_3 > 0) {", "VAR_3 = remove(path.data);", "if (VAR_3 < 0) {", "VAR_3 = -errno;", "}", "}", "v9fs_string_free(&path);", "break;", "case T_LGETXATTR:\ncase T_LLISTXATTR:\nVAR_3 = do_getxattr(header.type, &VAR_8, &VAR_9);", "break;", "case T_LSETXATTR:\nv9fs_string_init(&path);", "v9fs_string_init(&name);", "v9fs_string_init(&value);", "VAR_3 = proxy_unmarshal(&VAR_8, PROXY_HDR_SZ, \"sssdd\", &path,\n&name, &value, &VAR_2, &VAR_1);", "if (VAR_3 > 0) {", "VAR_3 = lsetxattr(path.data,\nname.data, value.data, VAR_2, VAR_1);", "if (VAR_3 < 0) {", "VAR_3 = -errno;", "}", "}", "v9fs_string_free(&path);", "v9fs_string_free(&name);", "v9fs_string_free(&value);", "break;", "case T_LREMOVEXATTR:\nv9fs_string_init(&path);", "v9fs_string_init(&name);", "VAR_3 = proxy_unmarshal(&VAR_8,\nPROXY_HDR_SZ, \"ss\", &path, &name);", "if (VAR_3 > 0) {", "VAR_3 = lremovexattr(path.data, name.data);", "if (VAR_3 < 0) {", "VAR_3 = -errno;", "}", "}", "v9fs_string_free(&path);", "v9fs_string_free(&name);", "break;", "case T_GETVERSION:\nVAR_3 = do_getversion(&VAR_8, &VAR_9);", "break;", "default:\ngoto err_out;", "break;", "}", "if (process_reply(VAR_0, header.type, &VAR_9, VAR_3) < 0) {", "goto err_out;", "}", "}", "err_out:\ng_free(VAR_8.iov_base);", "g_free(VAR_9.iov_base);", "return -1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61, 63 ], [ 65 ], [ 67, 69 ], [ 71 ], [ 73, 75, 77, 79 ], [ 81 ], [ 83, 85 ], [ 87 ], [ 89, 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111, 113, 115 ], [ 117 ], [ 119, 121 ], [ 123 ], [ 125, 127 ], [ 129, 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149, 151 ], [ 153, 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173, 175 ], [ 177, 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197, 199 ], [ 201, 203, 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223, 225 ], [ 227 ], [ 229, 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251, 253 ], [ 255 ], [ 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 ], [ 359 ], [ 361 ], [ 363 ], [ 365 ], [ 367, 369 ], [ 371 ], [ 373 ], [ 375 ] ]
18,492
static av_cold int pcx_init(AVCodecContext *avctx) { PCXContext *s = avctx->priv_data; avcodec_get_frame_defaults(&s->picture); avctx->coded_frame= &s->picture; return 0; }
true
FFmpeg
8cd1c0febe88b757e915e9af15559575c21ca728
static av_cold int pcx_init(AVCodecContext *avctx) { PCXContext *s = avctx->priv_data; avcodec_get_frame_defaults(&s->picture); avctx->coded_frame= &s->picture; return 0; }
{ "code": [ "static av_cold int pcx_init(AVCodecContext *avctx) {" ], "line_no": [ 1 ] }
static av_cold int FUNC_0(AVCodecContext *avctx) { PCXContext *s = avctx->priv_data; avcodec_get_frame_defaults(&s->picture); avctx->coded_frame= &s->picture; return 0; }
[ "static av_cold int FUNC_0(AVCodecContext *avctx) {", "PCXContext *s = avctx->priv_data;", "avcodec_get_frame_defaults(&s->picture);", "avctx->coded_frame= &s->picture;", "return 0;", "}" ]
[ 1, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ] ]
18,494
static void find_compressor(char * compressor_name, int len, MOVTrack *track) { AVDictionaryEntry *encoder; int xdcam_res = (track->par->width == 1280 && track->par->height == 720) || (track->par->width == 1440 && track->par->height == 1080) || (track->par->width == 1920 && track->par->height == 1080); if (track->mode == MODE_MOV && (encoder = av_dict_get(track->st->metadata, "encoder", NULL, 0))) { av_strlcpy(compressor_name, encoder->value, 32); } else if (track->par->codec_id == AV_CODEC_ID_MPEG2VIDEO && xdcam_res) { int interlaced = track->par->field_order > AV_FIELD_PROGRESSIVE; AVStream *st = track->st; int rate = av_q2d(find_fps(NULL, st)); av_strlcatf(compressor_name, len, "XDCAM"); if (track->par->format == AV_PIX_FMT_YUV422P) { av_strlcatf(compressor_name, len, " HD422"); } else if(track->par->width == 1440) { av_strlcatf(compressor_name, len, " HD"); } else av_strlcatf(compressor_name, len, " EX"); av_strlcatf(compressor_name, len, " %d%c", track->par->height, interlaced ? 'i' : 'p'); av_strlcatf(compressor_name, len, "%d", rate * (interlaced + 1)); } }
true
FFmpeg
77bc507f6f001b9f5fa75c664106261bd8f2c971
static void find_compressor(char * compressor_name, int len, MOVTrack *track) { AVDictionaryEntry *encoder; int xdcam_res = (track->par->width == 1280 && track->par->height == 720) || (track->par->width == 1440 && track->par->height == 1080) || (track->par->width == 1920 && track->par->height == 1080); if (track->mode == MODE_MOV && (encoder = av_dict_get(track->st->metadata, "encoder", NULL, 0))) { av_strlcpy(compressor_name, encoder->value, 32); } else if (track->par->codec_id == AV_CODEC_ID_MPEG2VIDEO && xdcam_res) { int interlaced = track->par->field_order > AV_FIELD_PROGRESSIVE; AVStream *st = track->st; int rate = av_q2d(find_fps(NULL, st)); av_strlcatf(compressor_name, len, "XDCAM"); if (track->par->format == AV_PIX_FMT_YUV422P) { av_strlcatf(compressor_name, len, " HD422"); } else if(track->par->width == 1440) { av_strlcatf(compressor_name, len, " HD"); } else av_strlcatf(compressor_name, len, " EX"); av_strlcatf(compressor_name, len, " %d%c", track->par->height, interlaced ? 'i' : 'p'); av_strlcatf(compressor_name, len, "%d", rate * (interlaced + 1)); } }
{ "code": [ " int rate = av_q2d(find_fps(NULL, st));" ], "line_no": [ 27 ] }
static void FUNC_0(char * VAR_0, int VAR_1, MOVTrack *VAR_2) { AVDictionaryEntry *encoder; int VAR_3 = (VAR_2->par->width == 1280 && VAR_2->par->height == 720) || (VAR_2->par->width == 1440 && VAR_2->par->height == 1080) || (VAR_2->par->width == 1920 && VAR_2->par->height == 1080); if (VAR_2->mode == MODE_MOV && (encoder = av_dict_get(VAR_2->st->metadata, "encoder", NULL, 0))) { av_strlcpy(VAR_0, encoder->value, 32); } else if (VAR_2->par->codec_id == AV_CODEC_ID_MPEG2VIDEO && VAR_3) { int VAR_4 = VAR_2->par->field_order > AV_FIELD_PROGRESSIVE; AVStream *st = VAR_2->st; int VAR_5 = av_q2d(find_fps(NULL, st)); av_strlcatf(VAR_0, VAR_1, "XDCAM"); if (VAR_2->par->format == AV_PIX_FMT_YUV422P) { av_strlcatf(VAR_0, VAR_1, " HD422"); } else if(VAR_2->par->width == 1440) { av_strlcatf(VAR_0, VAR_1, " HD"); } else av_strlcatf(VAR_0, VAR_1, " EX"); av_strlcatf(VAR_0, VAR_1, " %d%c", VAR_2->par->height, VAR_4 ? 'i' : 'p'); av_strlcatf(VAR_0, VAR_1, "%d", VAR_5 * (VAR_4 + 1)); } }
[ "static void FUNC_0(char * VAR_0, int VAR_1, MOVTrack *VAR_2)\n{", "AVDictionaryEntry *encoder;", "int VAR_3 = (VAR_2->par->width == 1280 && VAR_2->par->height == 720)\n|| (VAR_2->par->width == 1440 && VAR_2->par->height == 1080)\n|| (VAR_2->par->width == 1920 && VAR_2->par->height == 1080);", "if (VAR_2->mode == MODE_MOV &&\n(encoder = av_dict_get(VAR_2->st->metadata, \"encoder\", NULL, 0))) {", "av_strlcpy(VAR_0, encoder->value, 32);", "} else if (VAR_2->par->codec_id == AV_CODEC_ID_MPEG2VIDEO && VAR_3) {", "int VAR_4 = VAR_2->par->field_order > AV_FIELD_PROGRESSIVE;", "AVStream *st = VAR_2->st;", "int VAR_5 = av_q2d(find_fps(NULL, st));", "av_strlcatf(VAR_0, VAR_1, \"XDCAM\");", "if (VAR_2->par->format == AV_PIX_FMT_YUV422P) {", "av_strlcatf(VAR_0, VAR_1, \" HD422\");", "} else if(VAR_2->par->width == 1440) {", "av_strlcatf(VAR_0, VAR_1, \" HD\");", "} else", "av_strlcatf(VAR_0, VAR_1, \" EX\");", "av_strlcatf(VAR_0, VAR_1, \" %d%c\", VAR_2->par->height, VAR_4 ? 'i' : 'p');", "av_strlcatf(VAR_0, VAR_1, \"%d\", VAR_5 * (VAR_4 + 1));", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9, 11 ], [ 15, 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ] ]
18,495
const char *print_wrid(int wrid) { if (wrid >= RDMA_WRID_RECV_CONTROL) { return wrid_desc[RDMA_WRID_RECV_CONTROL]; } return wrid_desc[wrid]; }
true
qemu
60fe637bf0e4d7989e21e50f52526444765c63b4
const char *print_wrid(int wrid) { if (wrid >= RDMA_WRID_RECV_CONTROL) { return wrid_desc[RDMA_WRID_RECV_CONTROL]; } return wrid_desc[wrid]; }
{ "code": [], "line_no": [] }
const char *FUNC_0(int VAR_0) { if (VAR_0 >= RDMA_WRID_RECV_CONTROL) { return wrid_desc[RDMA_WRID_RECV_CONTROL]; } return wrid_desc[VAR_0]; }
[ "const char *FUNC_0(int VAR_0)\n{", "if (VAR_0 >= RDMA_WRID_RECV_CONTROL) {", "return wrid_desc[RDMA_WRID_RECV_CONTROL];", "}", "return wrid_desc[VAR_0];", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ] ]