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,752
static int parse_tag(AVFormatContext *s, const uint8_t *buf) { int genre; if (!(buf[0] == 'T' && buf[1] == 'A' && buf[2] == 'G')) return -1; get_string(s, "title", buf + 3, 30); get_string(s, "artist", buf + 33, 30); get_string(s, "album", buf + 63, 30); get_string(s, "date", buf + 93, 4); get_string(s, "comment", buf + 97, 30); if (buf[125] == 0 && buf[126] != 0) av_metadata_set2(&s->metadata, "track", av_d2str(buf[126]), AV_METADATA_DONT_STRDUP_VAL); genre = buf[127]; if (genre <= ID3v1_GENRE_MAX) av_metadata_set2(&s->metadata, "genre", ff_id3v1_genre_str[genre], 0); return 0; }
false
FFmpeg
82f19afefe4f28db0e2eefbc2d06eee0def74a53
static int parse_tag(AVFormatContext *s, const uint8_t *buf) { int genre; if (!(buf[0] == 'T' && buf[1] == 'A' && buf[2] == 'G')) return -1; get_string(s, "title", buf + 3, 30); get_string(s, "artist", buf + 33, 30); get_string(s, "album", buf + 63, 30); get_string(s, "date", buf + 93, 4); get_string(s, "comment", buf + 97, 30); if (buf[125] == 0 && buf[126] != 0) av_metadata_set2(&s->metadata, "track", av_d2str(buf[126]), AV_METADATA_DONT_STRDUP_VAL); genre = buf[127]; if (genre <= ID3v1_GENRE_MAX) av_metadata_set2(&s->metadata, "genre", ff_id3v1_genre_str[genre], 0); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0, const uint8_t *VAR_1) { int VAR_2; if (!(VAR_1[0] == 'T' && VAR_1[1] == 'A' && VAR_1[2] == 'G')) return -1; get_string(VAR_0, "title", VAR_1 + 3, 30); get_string(VAR_0, "artist", VAR_1 + 33, 30); get_string(VAR_0, "album", VAR_1 + 63, 30); get_string(VAR_0, "date", VAR_1 + 93, 4); get_string(VAR_0, "comment", VAR_1 + 97, 30); if (VAR_1[125] == 0 && VAR_1[126] != 0) av_metadata_set2(&VAR_0->metadata, "track", av_d2str(VAR_1[126]), AV_METADATA_DONT_STRDUP_VAL); VAR_2 = VAR_1[127]; if (VAR_2 <= ID3v1_GENRE_MAX) av_metadata_set2(&VAR_0->metadata, "VAR_2", ff_id3v1_genre_str[VAR_2], 0); return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0, const uint8_t *VAR_1)\n{", "int VAR_2;", "if (!(VAR_1[0] == 'T' &&\nVAR_1[1] == 'A' &&\nVAR_1[2] == 'G'))\nreturn -1;", "get_string(VAR_0, \"title\", VAR_1 + 3, 30);", "get_string(VAR_0, \"artist\", VAR_1 + 33, 30);", "get_string(VAR_0, \"album\", VAR_1 + 63, 30);", "get_string(VAR_0, \"date\", VAR_1 + 93, 4);", "get_string(VAR_0, \"comment\", VAR_1 + 97, 30);", "if (VAR_1[125] == 0 && VAR_1[126] != 0)\nav_metadata_set2(&VAR_0->metadata, \"track\", av_d2str(VAR_1[126]), AV_METADATA_DONT_STRDUP_VAL);", "VAR_2 = VAR_1[127];", "if (VAR_2 <= ID3v1_GENRE_MAX)\nav_metadata_set2(&VAR_0->metadata, \"VAR_2\", ff_id3v1_genre_str[VAR_2], 0);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11, 13, 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 39 ] ]
18,754
static void vnc_update(VncState *vs, int x, int y, int w, int h) { int i; h += y; /* round x down to ensure the loop only spans one 16-pixel block per, iteration. otherwise, if (x % 16) != 0, the last iteration may span two 16-pixel blocks but we only mark the first as dirty */ w += (x % 16); x -= (x % 16); x = MIN(x, vs->serverds.width); y = MIN(y, vs->serverds.height); w = MIN(x + w, vs->serverds.width) - x; h = MIN(h, vs->serverds.height); for (; y < h; y++) for (i = 0; i < w; i += 16) vnc_set_bit(vs->dirty_row[y], (x + i) / 16); }
true
qemu
6baebed7698a37a0ac5168faf26023426b0ac940
static void vnc_update(VncState *vs, int x, int y, int w, int h) { int i; h += y; w += (x % 16); x -= (x % 16); x = MIN(x, vs->serverds.width); y = MIN(y, vs->serverds.height); w = MIN(x + w, vs->serverds.width) - x; h = MIN(h, vs->serverds.height); for (; y < h; y++) for (i = 0; i < w; i += 16) vnc_set_bit(vs->dirty_row[y], (x + i) / 16); }
{ "code": [ " x = MIN(x, vs->serverds.width);", " y = MIN(y, vs->serverds.height);", " w = MIN(x + w, vs->serverds.width) - x;", " h = MIN(h, vs->serverds.height);", " vnc_set_bit(vs->dirty_row[y], (x + i) / 16);" ], "line_no": [ 27, 29, 31, 33, 41 ] }
static void FUNC_0(VncState *VAR_0, int VAR_1, int VAR_2, int VAR_3, int VAR_4) { int VAR_5; VAR_4 += VAR_2; VAR_3 += (VAR_1 % 16); VAR_1 -= (VAR_1 % 16); VAR_1 = MIN(VAR_1, VAR_0->serverds.width); VAR_2 = MIN(VAR_2, VAR_0->serverds.height); VAR_3 = MIN(VAR_1 + VAR_3, VAR_0->serverds.width) - VAR_1; VAR_4 = MIN(VAR_4, VAR_0->serverds.height); for (; VAR_2 < VAR_4; VAR_2++) for (VAR_5 = 0; VAR_5 < VAR_3; VAR_5 += 16) vnc_set_bit(VAR_0->dirty_row[VAR_2], (VAR_1 + VAR_5) / 16); }
[ "static void FUNC_0(VncState *VAR_0, int VAR_1, int VAR_2, int VAR_3, int VAR_4)\n{", "int VAR_5;", "VAR_4 += VAR_2;", "VAR_3 += (VAR_1 % 16);", "VAR_1 -= (VAR_1 % 16);", "VAR_1 = MIN(VAR_1, VAR_0->serverds.width);", "VAR_2 = MIN(VAR_2, VAR_0->serverds.height);", "VAR_3 = MIN(VAR_1 + VAR_3, VAR_0->serverds.width) - VAR_1;", "VAR_4 = MIN(VAR_4, VAR_0->serverds.height);", "for (; VAR_2 < VAR_4; VAR_2++)", "for (VAR_5 = 0; VAR_5 < VAR_3; VAR_5 += 16)", "vnc_set_bit(VAR_0->dirty_row[VAR_2], (VAR_1 + VAR_5) / 16);", "}" ]
[ 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ] ]
18,755
int qemu_ftruncate64(int fd, int64_t length) { LARGE_INTEGER li; LONG high; HANDLE h; BOOL res; if ((GetVersion() & 0x80000000UL) && (length >> 32) != 0) return -1; h = (HANDLE)_get_osfhandle(fd); /* get current position, ftruncate do not change position */ li.HighPart = 0; li.LowPart = SetFilePointer (h, 0, &li.HighPart, FILE_CURRENT); if (li.LowPart == 0xffffffffUL && GetLastError() != NO_ERROR) return -1; high = length >> 32; if (!SetFilePointer(h, (DWORD) length, &high, FILE_BEGIN)) return -1; res = SetEndOfFile(h); /* back to old position */ SetFilePointer(h, li.LowPart, &li.HighPart, FILE_BEGIN); return res ? 0 : -1; }
true
qemu
2c993ec294893af31deed27e5d79610ce71642e1
int qemu_ftruncate64(int fd, int64_t length) { LARGE_INTEGER li; LONG high; HANDLE h; BOOL res; if ((GetVersion() & 0x80000000UL) && (length >> 32) != 0) return -1; h = (HANDLE)_get_osfhandle(fd); li.HighPart = 0; li.LowPart = SetFilePointer (h, 0, &li.HighPart, FILE_CURRENT); if (li.LowPart == 0xffffffffUL && GetLastError() != NO_ERROR) return -1; high = length >> 32; if (!SetFilePointer(h, (DWORD) length, &high, FILE_BEGIN)) return -1; res = SetEndOfFile(h); SetFilePointer(h, li.LowPart, &li.HighPart, FILE_BEGIN); return res ? 0 : -1; }
{ "code": [ " if (li.LowPart == 0xffffffffUL && GetLastError() != NO_ERROR)", " if (!SetFilePointer(h, (DWORD) length, &high, FILE_BEGIN))" ], "line_no": [ 31, 39 ] }
int FUNC_0(int VAR_0, int64_t VAR_1) { LARGE_INTEGER li; LONG high; HANDLE h; BOOL res; if ((GetVersion() & 0x80000000UL) && (VAR_1 >> 32) != 0) return -1; h = (HANDLE)_get_osfhandle(VAR_0); li.HighPart = 0; li.LowPart = SetFilePointer (h, 0, &li.HighPart, FILE_CURRENT); if (li.LowPart == 0xffffffffUL && GetLastError() != NO_ERROR) return -1; high = VAR_1 >> 32; if (!SetFilePointer(h, (DWORD) VAR_1, &high, FILE_BEGIN)) return -1; res = SetEndOfFile(h); SetFilePointer(h, li.LowPart, &li.HighPart, FILE_BEGIN); return res ? 0 : -1; }
[ "int FUNC_0(int VAR_0, int64_t VAR_1)\n{", "LARGE_INTEGER li;", "LONG high;", "HANDLE h;", "BOOL res;", "if ((GetVersion() & 0x80000000UL) && (VAR_1 >> 32) != 0)\nreturn -1;", "h = (HANDLE)_get_osfhandle(VAR_0);", "li.HighPart = 0;", "li.LowPart = SetFilePointer (h, 0, &li.HighPart, FILE_CURRENT);", "if (li.LowPart == 0xffffffffUL && GetLastError() != NO_ERROR)\nreturn -1;", "high = VAR_1 >> 32;", "if (!SetFilePointer(h, (DWORD) VAR_1, &high, FILE_BEGIN))\nreturn -1;", "res = SetEndOfFile(h);", "SetFilePointer(h, li.LowPart, &li.HighPart, FILE_BEGIN);", "return res ? 0 : -1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15, 17 ], [ 21 ], [ 27 ], [ 29 ], [ 31, 33 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 49 ], [ 51 ], [ 53 ] ]
18,757
I2CBus *aux_get_i2c_bus(AUXBus *bus) { return aux_bridge_get_i2c_bus(bus->bridge); }
true
qemu
e0dadc1e9ef1f35208e5d2af9c7740c18a0b769f
I2CBus *aux_get_i2c_bus(AUXBus *bus) { return aux_bridge_get_i2c_bus(bus->bridge); }
{ "code": [], "line_no": [] }
I2CBus *FUNC_0(AUXBus *bus) { return aux_bridge_get_i2c_bus(bus->bridge); }
[ "I2CBus *FUNC_0(AUXBus *bus)\n{", "return aux_bridge_get_i2c_bus(bus->bridge);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
18,758
static void lame_window_init(AacPsyContext *ctx, AVCodecContext *avctx) { int i; for (i = 0; i < avctx->channels; i++) { AacPsyChannel *pch = &ctx->ch[i]; if (avctx->flags & CODEC_FLAG_QSCALE) pch->attack_threshold = psy_vbr_map[avctx->global_quality / FF_QP2LAMBDA].st_lrm; else pch->attack_threshold = lame_calc_attack_threshold(avctx->bit_rate / avctx->channels / 1000); for (i = 0; i < AAC_NUM_BLOCKS_SHORT * PSY_LAME_NUM_SUBBLOCKS; i++) pch->prev_energy_subshort[i] = 10.0f; } }
true
FFmpeg
276df9d8210121f6d59b7876e1724ebe7a11f5e5
static void lame_window_init(AacPsyContext *ctx, AVCodecContext *avctx) { int i; for (i = 0; i < avctx->channels; i++) { AacPsyChannel *pch = &ctx->ch[i]; if (avctx->flags & CODEC_FLAG_QSCALE) pch->attack_threshold = psy_vbr_map[avctx->global_quality / FF_QP2LAMBDA].st_lrm; else pch->attack_threshold = lame_calc_attack_threshold(avctx->bit_rate / avctx->channels / 1000); for (i = 0; i < AAC_NUM_BLOCKS_SHORT * PSY_LAME_NUM_SUBBLOCKS; i++) pch->prev_energy_subshort[i] = 10.0f; } }
{ "code": [ " int i;", " for (i = 0; i < AAC_NUM_BLOCKS_SHORT * PSY_LAME_NUM_SUBBLOCKS; i++)", " pch->prev_energy_subshort[i] = 10.0f;" ], "line_no": [ 3, 23, 25 ] }
static void FUNC_0(AacPsyContext *VAR_0, AVCodecContext *VAR_1) { int VAR_2; for (VAR_2 = 0; VAR_2 < VAR_1->channels; VAR_2++) { AacPsyChannel *pch = &VAR_0->ch[VAR_2]; if (VAR_1->flags & CODEC_FLAG_QSCALE) pch->attack_threshold = psy_vbr_map[VAR_1->global_quality / FF_QP2LAMBDA].st_lrm; else pch->attack_threshold = lame_calc_attack_threshold(VAR_1->bit_rate / VAR_1->channels / 1000); for (VAR_2 = 0; VAR_2 < AAC_NUM_BLOCKS_SHORT * PSY_LAME_NUM_SUBBLOCKS; VAR_2++) pch->prev_energy_subshort[VAR_2] = 10.0f; } }
[ "static void FUNC_0(AacPsyContext *VAR_0, AVCodecContext *VAR_1) {", "int VAR_2;", "for (VAR_2 = 0; VAR_2 < VAR_1->channels; VAR_2++) {", "AacPsyChannel *pch = &VAR_0->ch[VAR_2];", "if (VAR_1->flags & CODEC_FLAG_QSCALE)\npch->attack_threshold = psy_vbr_map[VAR_1->global_quality / FF_QP2LAMBDA].st_lrm;", "else\npch->attack_threshold = lame_calc_attack_threshold(VAR_1->bit_rate / VAR_1->channels / 1000);", "for (VAR_2 = 0; VAR_2 < AAC_NUM_BLOCKS_SHORT * PSY_LAME_NUM_SUBBLOCKS; VAR_2++)", "pch->prev_energy_subshort[VAR_2] = 10.0f;", "}", "}" ]
[ 0, 1, 0, 0, 0, 0, 1, 1, 0, 0 ]
[ [ 1 ], [ 3 ], [ 7 ], [ 9 ], [ 13, 15 ], [ 17, 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ] ]
18,760
static void pflash_cfi01_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); dc->realize = pflash_cfi01_realize; dc->props = pflash_cfi01_properties; dc->vmsd = &vmstate_pflash; set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); }
true
qemu
e4f4fb1eca795e36f363b4647724221e774523c1
static void pflash_cfi01_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); dc->realize = pflash_cfi01_realize; dc->props = pflash_cfi01_properties; dc->vmsd = &vmstate_pflash; set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); }
{ "code": [], "line_no": [] }
static void FUNC_0(ObjectClass *VAR_0, void *VAR_1) { DeviceClass *dc = DEVICE_CLASS(VAR_0); dc->realize = pflash_cfi01_realize; dc->props = pflash_cfi01_properties; dc->vmsd = &vmstate_pflash; set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); }
[ "static void FUNC_0(ObjectClass *VAR_0, void *VAR_1)\n{", "DeviceClass *dc = DEVICE_CLASS(VAR_0);", "dc->realize = pflash_cfi01_realize;", "dc->props = pflash_cfi01_properties;", "dc->vmsd = &vmstate_pflash;", "set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 22 ] ]
18,761
static void mc_block(uint8_t *dst, uint8_t *src, uint8_t *tmp, int stride, int b_w, int b_h, int dx, int dy){ int x, y; START_TIMER for(y=0; y < b_h+5; y++){ for(x=0; x < b_w; x++){ int a0= src[x ]; int a1= src[x + 1]; int a2= src[x + 2]; int a3= src[x + 3]; int a4= src[x + 4]; int a5= src[x + 5]; // int am= 9*(a1+a2) - (a0+a3); int am= 20*(a2+a3) - 5*(a1+a4) + (a0+a5); // int am= 18*(a2+a3) - 2*(a1+a4); // int aL= (-7*a0 + 105*a1 + 35*a2 - 5*a3)>>3; // int aR= (-7*a3 + 105*a2 + 35*a1 - 5*a0)>>3; // if(b_w==16) am= 8*(a1+a2); if(dx<8) tmp[x]= (32*a2*( 8-dx) + am* dx + 128)>>8; else tmp[x]= ( am*(16-dx) + 32*a3*(dx-8) + 128)>>8; /* if (dx< 4) tmp[x + y*stride]= (16*a1*( 4-dx) + aL* dx + 32)>>6; else if(dx< 8) tmp[x + y*stride]= ( aL*( 8-dx) + am*(dx- 4) + 32)>>6; else if(dx<12) tmp[x + y*stride]= ( am*(12-dx) + aR*(dx- 8) + 32)>>6; else tmp[x + y*stride]= ( aR*(16-dx) + 16*a2*(dx-12) + 32)>>6;*/ } tmp += stride; src += stride; } tmp -= (b_h+5)*stride; for(y=0; y < b_h; y++){ for(x=0; x < b_w; x++){ int a0= tmp[x + 0*stride]; int a1= tmp[x + 1*stride]; int a2= tmp[x + 2*stride]; int a3= tmp[x + 3*stride]; int a4= tmp[x + 4*stride]; int a5= tmp[x + 5*stride]; int am= 20*(a2+a3) - 5*(a1+a4) + (a0+a5); // int am= 18*(a2+a3) - 2*(a1+a4); /* int aL= (-7*a0 + 105*a1 + 35*a2 - 5*a3)>>3; int aR= (-7*a3 + 105*a2 + 35*a1 - 5*a0)>>3;*/ // if(b_w==16) am= 8*(a1+a2); if(dy<8) dst[x]= (32*a2*( 8-dy) + am* dy + 128)>>8; else dst[x]= ( am*(16-dy) + 32*a3*(dy-8) + 128)>>8; /* if (dy< 4) tmp[x + y*stride]= (16*a1*( 4-dy) + aL* dy + 32)>>6; else if(dy< 8) tmp[x + y*stride]= ( aL*( 8-dy) + am*(dy- 4) + 32)>>6; else if(dy<12) tmp[x + y*stride]= ( am*(12-dy) + aR*(dy- 8) + 32)>>6; else tmp[x + y*stride]= ( aR*(16-dy) + 16*a2*(dy-12) + 32)>>6;*/ } dst += stride; tmp += stride; } STOP_TIMER("mc_block") }
true
FFmpeg
8c2515bbb9800a3cdcc28aa19133302ba5f2da45
static void mc_block(uint8_t *dst, uint8_t *src, uint8_t *tmp, int stride, int b_w, int b_h, int dx, int dy){ int x, y; START_TIMER for(y=0; y < b_h+5; y++){ for(x=0; x < b_w; x++){ int a0= src[x ]; int a1= src[x + 1]; int a2= src[x + 2]; int a3= src[x + 3]; int a4= src[x + 4]; int a5= src[x + 5]; int am= 20*(a2+a3) - 5*(a1+a4) + (a0+a5); if(dx<8) tmp[x]= (32*a2*( 8-dx) + am* dx + 128)>>8; else tmp[x]= ( am*(16-dx) + 32*a3*(dx-8) + 128)>>8; } tmp += stride; src += stride; } tmp -= (b_h+5)*stride; for(y=0; y < b_h; y++){ for(x=0; x < b_w; x++){ int a0= tmp[x + 0*stride]; int a1= tmp[x + 1*stride]; int a2= tmp[x + 2*stride]; int a3= tmp[x + 3*stride]; int a4= tmp[x + 4*stride]; int a5= tmp[x + 5*stride]; int am= 20*(a2+a3) - 5*(a1+a4) + (a0+a5); if(dy<8) dst[x]= (32*a2*( 8-dy) + am* dy + 128)>>8; else dst[x]= ( am*(16-dy) + 32*a3*(dy-8) + 128)>>8; } dst += stride; tmp += stride; } STOP_TIMER("mc_block") }
{ "code": [ " if(dx<8) tmp[x]= (32*a2*( 8-dx) + am* dx + 128)>>8;", " else tmp[x]= ( am*(16-dx) + 32*a3*(dx-8) + 128)>>8;", " if(dy<8) dst[x]= (32*a2*( 8-dy) + am* dy + 128)>>8;", " else dst[x]= ( am*(16-dy) + 32*a3*(dy-8) + 128)>>8;" ], "line_no": [ 39, 41, 95, 97 ] }
static void FUNC_0(uint8_t *VAR_0, uint8_t *VAR_1, uint8_t *VAR_2, int VAR_3, int VAR_4, int VAR_5, int VAR_6, int VAR_7){ int VAR_8, VAR_9; START_TIMER for(VAR_9=0; VAR_9 < VAR_5+5; VAR_9++){ for(VAR_8=0; VAR_8 < VAR_4; VAR_8++){ int VAR_10= VAR_1[VAR_8 ]; int VAR_11= VAR_1[VAR_8 + 1]; int VAR_12= VAR_1[VAR_8 + 2]; int VAR_13= VAR_1[VAR_8 + 3]; int VAR_14= VAR_1[VAR_8 + 4]; int VAR_15= VAR_1[VAR_8 + 5]; int VAR_16= 20*(VAR_12+VAR_13) - 5*(VAR_11+VAR_14) + (VAR_10+VAR_15); if(VAR_6<8) VAR_2[VAR_8]= (32*VAR_12*( 8-VAR_6) + VAR_16* VAR_6 + 128)>>8; else VAR_2[VAR_8]= ( VAR_16*(16-VAR_6) + 32*VAR_13*(VAR_6-8) + 128)>>8; } VAR_2 += VAR_3; VAR_1 += VAR_3; } VAR_2 -= (VAR_5+5)*VAR_3; for(VAR_9=0; VAR_9 < VAR_5; VAR_9++){ for(VAR_8=0; VAR_8 < VAR_4; VAR_8++){ int VAR_10= VAR_2[VAR_8 + 0*VAR_3]; int VAR_11= VAR_2[VAR_8 + 1*VAR_3]; int VAR_12= VAR_2[VAR_8 + 2*VAR_3]; int VAR_13= VAR_2[VAR_8 + 3*VAR_3]; int VAR_14= VAR_2[VAR_8 + 4*VAR_3]; int VAR_15= VAR_2[VAR_8 + 5*VAR_3]; int VAR_16= 20*(VAR_12+VAR_13) - 5*(VAR_11+VAR_14) + (VAR_10+VAR_15); if(VAR_7<8) VAR_0[VAR_8]= (32*VAR_12*( 8-VAR_7) + VAR_16* VAR_7 + 128)>>8; else VAR_0[VAR_8]= ( VAR_16*(16-VAR_7) + 32*VAR_13*(VAR_7-8) + 128)>>8; } VAR_0 += VAR_3; VAR_2 += VAR_3; } STOP_TIMER("FUNC_0") }
[ "static void FUNC_0(uint8_t *VAR_0, uint8_t *VAR_1, uint8_t *VAR_2, int VAR_3, int VAR_4, int VAR_5, int VAR_6, int VAR_7){", "int VAR_8, VAR_9;", "START_TIMER\nfor(VAR_9=0; VAR_9 < VAR_5+5; VAR_9++){", "for(VAR_8=0; VAR_8 < VAR_4; VAR_8++){", "int VAR_10= VAR_1[VAR_8 ];", "int VAR_11= VAR_1[VAR_8 + 1];", "int VAR_12= VAR_1[VAR_8 + 2];", "int VAR_13= VAR_1[VAR_8 + 3];", "int VAR_14= VAR_1[VAR_8 + 4];", "int VAR_15= VAR_1[VAR_8 + 5];", "int VAR_16= 20*(VAR_12+VAR_13) - 5*(VAR_11+VAR_14) + (VAR_10+VAR_15);", "if(VAR_6<8) VAR_2[VAR_8]= (32*VAR_12*( 8-VAR_6) + VAR_16* VAR_6 + 128)>>8;", "else VAR_2[VAR_8]= ( VAR_16*(16-VAR_6) + 32*VAR_13*(VAR_6-8) + 128)>>8;", "}", "VAR_2 += VAR_3;", "VAR_1 += VAR_3;", "}", "VAR_2 -= (VAR_5+5)*VAR_3;", "for(VAR_9=0; VAR_9 < VAR_5; VAR_9++){", "for(VAR_8=0; VAR_8 < VAR_4; VAR_8++){", "int VAR_10= VAR_2[VAR_8 + 0*VAR_3];", "int VAR_11= VAR_2[VAR_8 + 1*VAR_3];", "int VAR_12= VAR_2[VAR_8 + 2*VAR_3];", "int VAR_13= VAR_2[VAR_8 + 3*VAR_3];", "int VAR_14= VAR_2[VAR_8 + 4*VAR_3];", "int VAR_15= VAR_2[VAR_8 + 5*VAR_3];", "int VAR_16= 20*(VAR_12+VAR_13) - 5*(VAR_11+VAR_14) + (VAR_10+VAR_15);", "if(VAR_7<8) VAR_0[VAR_8]= (32*VAR_12*( 8-VAR_7) + VAR_16* VAR_7 + 128)>>8;", "else VAR_0[VAR_8]= ( VAR_16*(16-VAR_7) + 32*VAR_13*(VAR_7-8) + 128)>>8;", "}", "VAR_0 += VAR_3;", "VAR_2 += VAR_3;", "}", "STOP_TIMER(\"FUNC_0\")\n}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 39 ], [ 41 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 95 ], [ 97 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117, 119 ] ]
18,762
static BlockDriverAIOCB *rbd_start_aio(BlockDriverState *bs, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, BlockDriverCompletionFunc *cb, void *opaque, RBDAIOCmd cmd) { RBDAIOCB *acb; RADOSCB *rcb; rbd_completion_t c; int64_t off, size; char *buf; int r; BDRVRBDState *s = bs->opaque; acb = qemu_aio_get(&rbd_aiocb_info, bs, cb, opaque); acb->cmd = cmd; acb->qiov = qiov; if (cmd == RBD_AIO_DISCARD || cmd == RBD_AIO_FLUSH) { acb->bounce = NULL; } else { acb->bounce = qemu_blockalign(bs, qiov->size); } acb->ret = 0; acb->error = 0; acb->s = s; acb->cancelled = 0; acb->bh = NULL; acb->status = -EINPROGRESS; if (cmd == RBD_AIO_WRITE) { qemu_iovec_to_buf(acb->qiov, 0, acb->bounce, qiov->size); } buf = acb->bounce; off = sector_num * BDRV_SECTOR_SIZE; size = nb_sectors * BDRV_SECTOR_SIZE; rcb = g_malloc(sizeof(RADOSCB)); rcb->done = 0; rcb->acb = acb; rcb->buf = buf; rcb->s = acb->s; rcb->size = size; r = rbd_aio_create_completion(rcb, (rbd_callback_t) rbd_finish_aiocb, &c); if (r < 0) { goto failed; } switch (cmd) { case RBD_AIO_WRITE: r = rbd_aio_write(s->image, off, size, buf, c); break; case RBD_AIO_READ: r = rbd_aio_read(s->image, off, size, buf, c); break; case RBD_AIO_DISCARD: r = rbd_aio_discard_wrapper(s->image, off, size, c); break; case RBD_AIO_FLUSH: r = rbd_aio_flush_wrapper(s->image, c); break; default: r = -EINVAL; } if (r < 0) { goto failed; } return &acb->common; failed: g_free(rcb); qemu_aio_release(acb); return NULL; }
true
qemu
405a27640b33c31ccef4001b3f3936b8c9d2218f
static BlockDriverAIOCB *rbd_start_aio(BlockDriverState *bs, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, BlockDriverCompletionFunc *cb, void *opaque, RBDAIOCmd cmd) { RBDAIOCB *acb; RADOSCB *rcb; rbd_completion_t c; int64_t off, size; char *buf; int r; BDRVRBDState *s = bs->opaque; acb = qemu_aio_get(&rbd_aiocb_info, bs, cb, opaque); acb->cmd = cmd; acb->qiov = qiov; if (cmd == RBD_AIO_DISCARD || cmd == RBD_AIO_FLUSH) { acb->bounce = NULL; } else { acb->bounce = qemu_blockalign(bs, qiov->size); } acb->ret = 0; acb->error = 0; acb->s = s; acb->cancelled = 0; acb->bh = NULL; acb->status = -EINPROGRESS; if (cmd == RBD_AIO_WRITE) { qemu_iovec_to_buf(acb->qiov, 0, acb->bounce, qiov->size); } buf = acb->bounce; off = sector_num * BDRV_SECTOR_SIZE; size = nb_sectors * BDRV_SECTOR_SIZE; rcb = g_malloc(sizeof(RADOSCB)); rcb->done = 0; rcb->acb = acb; rcb->buf = buf; rcb->s = acb->s; rcb->size = size; r = rbd_aio_create_completion(rcb, (rbd_callback_t) rbd_finish_aiocb, &c); if (r < 0) { goto failed; } switch (cmd) { case RBD_AIO_WRITE: r = rbd_aio_write(s->image, off, size, buf, c); break; case RBD_AIO_READ: r = rbd_aio_read(s->image, off, size, buf, c); break; case RBD_AIO_DISCARD: r = rbd_aio_discard_wrapper(s->image, off, size, c); break; case RBD_AIO_FLUSH: r = rbd_aio_flush_wrapper(s->image, c); break; default: r = -EINVAL; } if (r < 0) { goto failed; } return &acb->common; failed: g_free(rcb); qemu_aio_release(acb); return NULL; }
{ "code": [ " goto failed;" ], "line_no": [ 99 ] }
static BlockDriverAIOCB *FUNC_0(BlockDriverState *bs, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, BlockDriverCompletionFunc *cb, void *opaque, RBDAIOCmd cmd) { RBDAIOCB *acb; RADOSCB *rcb; rbd_completion_t c; int64_t off, size; char *VAR_0; int VAR_1; BDRVRBDState *s = bs->opaque; acb = qemu_aio_get(&rbd_aiocb_info, bs, cb, opaque); acb->cmd = cmd; acb->qiov = qiov; if (cmd == RBD_AIO_DISCARD || cmd == RBD_AIO_FLUSH) { acb->bounce = NULL; } else { acb->bounce = qemu_blockalign(bs, qiov->size); } acb->ret = 0; acb->error = 0; acb->s = s; acb->cancelled = 0; acb->bh = NULL; acb->status = -EINPROGRESS; if (cmd == RBD_AIO_WRITE) { qemu_iovec_to_buf(acb->qiov, 0, acb->bounce, qiov->size); } VAR_0 = acb->bounce; off = sector_num * BDRV_SECTOR_SIZE; size = nb_sectors * BDRV_SECTOR_SIZE; rcb = g_malloc(sizeof(RADOSCB)); rcb->done = 0; rcb->acb = acb; rcb->VAR_0 = VAR_0; rcb->s = acb->s; rcb->size = size; VAR_1 = rbd_aio_create_completion(rcb, (rbd_callback_t) rbd_finish_aiocb, &c); if (VAR_1 < 0) { goto failed; } switch (cmd) { case RBD_AIO_WRITE: VAR_1 = rbd_aio_write(s->image, off, size, VAR_0, c); break; case RBD_AIO_READ: VAR_1 = rbd_aio_read(s->image, off, size, VAR_0, c); break; case RBD_AIO_DISCARD: VAR_1 = rbd_aio_discard_wrapper(s->image, off, size, c); break; case RBD_AIO_FLUSH: VAR_1 = rbd_aio_flush_wrapper(s->image, c); break; default: VAR_1 = -EINVAL; } if (VAR_1 < 0) { goto failed; } return &acb->common; failed: g_free(rcb); qemu_aio_release(acb); return NULL; }
[ "static BlockDriverAIOCB *FUNC_0(BlockDriverState *bs,\nint64_t sector_num,\nQEMUIOVector *qiov,\nint nb_sectors,\nBlockDriverCompletionFunc *cb,\nvoid *opaque,\nRBDAIOCmd cmd)\n{", "RBDAIOCB *acb;", "RADOSCB *rcb;", "rbd_completion_t c;", "int64_t off, size;", "char *VAR_0;", "int VAR_1;", "BDRVRBDState *s = bs->opaque;", "acb = qemu_aio_get(&rbd_aiocb_info, bs, cb, opaque);", "acb->cmd = cmd;", "acb->qiov = qiov;", "if (cmd == RBD_AIO_DISCARD || cmd == RBD_AIO_FLUSH) {", "acb->bounce = NULL;", "} else {", "acb->bounce = qemu_blockalign(bs, qiov->size);", "}", "acb->ret = 0;", "acb->error = 0;", "acb->s = s;", "acb->cancelled = 0;", "acb->bh = NULL;", "acb->status = -EINPROGRESS;", "if (cmd == RBD_AIO_WRITE) {", "qemu_iovec_to_buf(acb->qiov, 0, acb->bounce, qiov->size);", "}", "VAR_0 = acb->bounce;", "off = sector_num * BDRV_SECTOR_SIZE;", "size = nb_sectors * BDRV_SECTOR_SIZE;", "rcb = g_malloc(sizeof(RADOSCB));", "rcb->done = 0;", "rcb->acb = acb;", "rcb->VAR_0 = VAR_0;", "rcb->s = acb->s;", "rcb->size = size;", "VAR_1 = rbd_aio_create_completion(rcb, (rbd_callback_t) rbd_finish_aiocb, &c);", "if (VAR_1 < 0) {", "goto failed;", "}", "switch (cmd) {", "case RBD_AIO_WRITE:\nVAR_1 = rbd_aio_write(s->image, off, size, VAR_0, c);", "break;", "case RBD_AIO_READ:\nVAR_1 = rbd_aio_read(s->image, off, size, VAR_0, c);", "break;", "case RBD_AIO_DISCARD:\nVAR_1 = rbd_aio_discard_wrapper(s->image, off, size, c);", "break;", "case RBD_AIO_FLUSH:\nVAR_1 = rbd_aio_flush_wrapper(s->image, c);", "break;", "default:\nVAR_1 = -EINVAL;", "}", "if (VAR_1 < 0) {", "goto failed;", "}", "return &acb->common;", "failed:\ng_free(rcb);", "qemu_aio_release(acb);", "return NULL;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11, 13, 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ], [ 73 ], [ 77 ], [ 79 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 105 ], [ 107, 109 ], [ 111 ], [ 113, 115 ], [ 117 ], [ 119, 121 ], [ 123 ], [ 125, 127 ], [ 129 ], [ 131, 133 ], [ 135 ], [ 139 ], [ 141 ], [ 143 ], [ 147 ], [ 151, 153 ], [ 155 ], [ 157 ], [ 159 ] ]
18,763
static inline void RENAME(initFilter)(int16_t *filter, int16_t *filterPos, int *filterSize, int xInc, int srcW, int dstW, int filterAlign, int one) { int i; #ifdef HAVE_MMX asm volatile("emms\n\t"::: "memory"); //FIXME this shouldnt be required but it IS (even for non mmx versions) #endif if(ABS(xInc - 0x10000) <10) // unscaled { int i; *filterSize= (1 +(filterAlign-1)) & (~(filterAlign-1)); // 1 or 4 normaly for(i=0; i<dstW*(*filterSize); i++) filter[i]=0; for(i=0; i<dstW; i++) { filter[i*(*filterSize)]=1; filterPos[i]=i; } } else if(xInc <= (1<<16) || sws_flags==SWS_FAST_BILINEAR) // upscale { int i; int xDstInSrc; if(sws_flags==SWS_BICUBIC) *filterSize= 4; else *filterSize= 2; // printf("%d %d %d\n", filterSize, srcW, dstW); *filterSize= (*filterSize +(filterAlign-1)) & (~(filterAlign-1)); xDstInSrc= xInc - 0x8000; for(i=0; i<dstW; i++) { int xx= (xDstInSrc>>16) - (*filterSize>>1) + 1; int j; filterPos[i]= xx; if(sws_flags == SWS_BICUBIC) { double d= ABS(((xx+1)<<16) - xDstInSrc)/(double)(1<<16); // int coeff; int y1,y2,y3,y4; double A= -0.75; // Equation is from VirtualDub y1 = (int)floor(0.5 + ( + A*d - 2.0*A*d*d + A*d*d*d) * 16384.0); y2 = (int)floor(0.5 + (+ 1.0 - (A+3.0)*d*d + (A+2.0)*d*d*d) * 16384.0); y3 = (int)floor(0.5 + ( - A*d + (2.0*A+3.0)*d*d - (A+2.0)*d*d*d) * 16384.0); y4 = (int)floor(0.5 + ( + A*d*d - A*d*d*d) * 16384.0); // printf("%d %d %d \n", coeff, (int)d, xDstInSrc); filter[i*(*filterSize) + 0]= y1; filter[i*(*filterSize) + 1]= y2; filter[i*(*filterSize) + 2]= y3; filter[i*(*filterSize) + 3]= y4; // printf("%1.3f %d, %d, %d, %d\n",d , y1, y2, y3, y4); } else { for(j=0; j<*filterSize; j++) { double d= ABS((xx<<16) - xDstInSrc)/(double)(1<<16); int coeff; coeff= (int)(0.5 + (1.0 - d)*(1<<14)); if(coeff<0) coeff=0; // printf("%d %d %d \n", coeff, (int)d, xDstInSrc); filter[i*(*filterSize) + j]= coeff; xx++; } } xDstInSrc+= xInc; } } else // downscale { int xDstInSrc; if(sws_flags==SWS_BICUBIC) *filterSize= (int)ceil(1 + 4.0*srcW / (double)dstW); else *filterSize= (int)ceil(1 + 2.0*srcW / (double)dstW); // printf("%d %d %d\n", *filterSize, srcW, dstW); *filterSize= (*filterSize +(filterAlign-1)) & (~(filterAlign-1)); xDstInSrc= xInc - 0x8000; for(i=0; i<dstW; i++) { int xx= (int)((double)xDstInSrc/(double)(1<<16) - *filterSize*0.5 + 0.5); int j; filterPos[i]= xx; for(j=0; j<*filterSize; j++) { double d= ABS((xx<<16) - xDstInSrc)/(double)xInc; int coeff; if(sws_flags == SWS_BICUBIC) { double A= -0.75; // d*=2; // Equation is from VirtualDub if(d<1.0) coeff = (int)floor(0.5 + (1.0 - (A+3.0)*d*d + (A+2.0)*d*d*d) * (1<<14)); else if(d<2.0) coeff = (int)floor(0.5 + (-4.0*A + 8.0*A*d - 5.0*A*d*d + A*d*d*d) * (1<<14)); else coeff=0; } else { coeff= (int)(0.5 + (1.0 - d)*(1<<14)); if(coeff<0) coeff=0; } // if(filterAlign==1) printf("%d %d %d \n", coeff, (int)d, xDstInSrc); filter[i*(*filterSize) + j]= coeff; xx++; } xDstInSrc+= xInc; } } //fix borders for(i=0; i<dstW; i++) { int j; if(filterPos[i] < 0) { // Move filter coeffs left to compensate for filterPos for(j=1; j<*filterSize; j++) { int left= MAX(j + filterPos[i], 0); filter[i*(*filterSize) + left] += filter[i*(*filterSize) + j]; filter[i*(*filterSize) + j]=0; } filterPos[i]= 0; } if(filterPos[i] + *filterSize > srcW) { int shift= filterPos[i] + *filterSize - srcW; // Move filter coeffs right to compensate for filterPos for(j=*filterSize-2; j>=0; j--) { int right= MIN(j + shift, *filterSize-1); filter[i*(*filterSize) +right] += filter[i*(*filterSize) +j]; filter[i*(*filterSize) +j]=0; } filterPos[i]= srcW - *filterSize; } } //FIXME try to align filterpos if possible / try to shift filterpos to put zeros at the end // and skip these than later //Normalize for(i=0; i<dstW; i++) { int j; double sum=0; double scale= one; for(j=0; j<*filterSize; j++) { sum+= filter[i*(*filterSize) + j]; } scale/= sum; for(j=0; j<*filterSize; j++) { filter[i*(*filterSize) + j]= (int)(filter[i*(*filterSize) + j]*scale); } } }
true
FFmpeg
e3d2500fe498289a878b956f6efb4995438c9515
static inline void RENAME(initFilter)(int16_t *filter, int16_t *filterPos, int *filterSize, int xInc, int srcW, int dstW, int filterAlign, int one) { int i; #ifdef HAVE_MMX asm volatile("emms\n\t"::: "memory"); #endif if(ABS(xInc - 0x10000) <10) { int i; *filterSize= (1 +(filterAlign-1)) & (~(filterAlign-1)); for(i=0; i<dstW*(*filterSize); i++) filter[i]=0; for(i=0; i<dstW; i++) { filter[i*(*filterSize)]=1; filterPos[i]=i; } } else if(xInc <= (1<<16) || sws_flags==SWS_FAST_BILINEAR) { int i; int xDstInSrc; if(sws_flags==SWS_BICUBIC) *filterSize= 4; else *filterSize= 2; *filterSize= (*filterSize +(filterAlign-1)) & (~(filterAlign-1)); xDstInSrc= xInc - 0x8000; for(i=0; i<dstW; i++) { int xx= (xDstInSrc>>16) - (*filterSize>>1) + 1; int j; filterPos[i]= xx; if(sws_flags == SWS_BICUBIC) { double d= ABS(((xx+1)<<16) - xDstInSrc)/(double)(1<<16); int y1,y2,y3,y4; double A= -0.75; y1 = (int)floor(0.5 + ( + A*d - 2.0*A*d*d + A*d*d*d) * 16384.0); y2 = (int)floor(0.5 + (+ 1.0 - (A+3.0)*d*d + (A+2.0)*d*d*d) * 16384.0); y3 = (int)floor(0.5 + ( - A*d + (2.0*A+3.0)*d*d - (A+2.0)*d*d*d) * 16384.0); y4 = (int)floor(0.5 + ( + A*d*d - A*d*d*d) * 16384.0); filter[i*(*filterSize) + 0]= y1; filter[i*(*filterSize) + 1]= y2; filter[i*(*filterSize) + 2]= y3; filter[i*(*filterSize) + 3]= y4; } else { for(j=0; j<*filterSize; j++) { double d= ABS((xx<<16) - xDstInSrc)/(double)(1<<16); int coeff; coeff= (int)(0.5 + (1.0 - d)*(1<<14)); if(coeff<0) coeff=0; filter[i*(*filterSize) + j]= coeff; xx++; } } xDstInSrc+= xInc; } } else { int xDstInSrc; if(sws_flags==SWS_BICUBIC) *filterSize= (int)ceil(1 + 4.0*srcW / (double)dstW); else *filterSize= (int)ceil(1 + 2.0*srcW / (double)dstW); *filterSize= (*filterSize +(filterAlign-1)) & (~(filterAlign-1)); xDstInSrc= xInc - 0x8000; for(i=0; i<dstW; i++) { int xx= (int)((double)xDstInSrc/(double)(1<<16) - *filterSize*0.5 + 0.5); int j; filterPos[i]= xx; for(j=0; j<*filterSize; j++) { double d= ABS((xx<<16) - xDstInSrc)/(double)xInc; int coeff; if(sws_flags == SWS_BICUBIC) { double A= -0.75; if(d<1.0) coeff = (int)floor(0.5 + (1.0 - (A+3.0)*d*d + (A+2.0)*d*d*d) * (1<<14)); else if(d<2.0) coeff = (int)floor(0.5 + (-4.0*A + 8.0*A*d - 5.0*A*d*d + A*d*d*d) * (1<<14)); else coeff=0; } else { coeff= (int)(0.5 + (1.0 - d)*(1<<14)); if(coeff<0) coeff=0; } filter[i*(*filterSize) + j]= coeff; xx++; } xDstInSrc+= xInc; } } for(i=0; i<dstW; i++) { int j; if(filterPos[i] < 0) { for(j=1; j<*filterSize; j++) { int left= MAX(j + filterPos[i], 0); filter[i*(*filterSize) + left] += filter[i*(*filterSize) + j]; filter[i*(*filterSize) + j]=0; } filterPos[i]= 0; } if(filterPos[i] + *filterSize > srcW) { int shift= filterPos[i] + *filterSize - srcW; for(j=*filterSize-2; j>=0; j--) { int right= MIN(j + shift, *filterSize-1); filter[i*(*filterSize) +right] += filter[i*(*filterSize) +j]; filter[i*(*filterSize) +j]=0; } filterPos[i]= srcW - *filterSize; } } for(i=0; i<dstW; i++) { int j; double sum=0; double scale= one; for(j=0; j<*filterSize; j++) { sum+= filter[i*(*filterSize) + j]; } scale/= sum; for(j=0; j<*filterSize; j++) { filter[i*(*filterSize) + j]= (int)(filter[i*(*filterSize) + j]*scale); } } }
{ "code": [ "\tint i;", "\tfor(i=0; i<dstW; i++)", "\t\tint j;", "\t\t\tint j;", "static inline void RENAME(initFilter)(int16_t *filter, int16_t *filterPos, int *filterSize, int xInc,", "\t\t\t\tint y1,y2,y3,y4;", "\t\ty1 = (int)floor(0.5 + ( + A*d - 2.0*A*d*d + A*d*d*d) * 16384.0);", "\t\ty2 = (int)floor(0.5 + (+ 1.0 - (A+3.0)*d*d + (A+2.0)*d*d*d) * 16384.0);", "\t\ty3 = (int)floor(0.5 + ( - A*d + (2.0*A+3.0)*d*d - (A+2.0)*d*d*d) * 16384.0);", "\t\ty4 = (int)floor(0.5 + ( + A*d*d - A*d*d*d) * 16384.0);", "\t\t\t\t\tint coeff;", "\t\t\t\t\tcoeff= (int)(0.5 + (1.0 - d)*(1<<14));", "\t\t\t\tint coeff;", "\t\t\t\t\t\tcoeff = (int)floor(0.5 + (1.0 - (A+3.0)*d*d", "\t\t\t\t\t\t + (A+2.0)*d*d*d) * (1<<14));", "\t\t\t\t\t\tcoeff = (int)floor(0.5 + (-4.0*A + 8.0*A*d", "\t\t\t\t\t\t - 5.0*A*d*d + A*d*d*d) * (1<<14));", "\t\t\t\t\t\tcoeff=0;", "\t\t\t\t\tcoeff= (int)(0.5 + (1.0 - d)*(1<<14));", "\t\tif(filterPos[i] + *filterSize > srcW)", "\t\t\tint shift= filterPos[i] + *filterSize - srcW;", "\t\t\tfor(j=*filterSize-2; j>=0; j--)", "\t\t\t\tint right= MIN(j + shift, *filterSize-1);", "\t\t\tfilterPos[i]= srcW - *filterSize;", "\t\t\tfilter[i*(*filterSize) + j]= (int)(filter[i*(*filterSize) + j]*scale);" ], "line_no": [ 7, 239, 243, 69, 1, 83, 89, 91, 93, 95, 123, 125, 181, 195, 197, 201, 203, 207, 125, 269, 273, 277, 281, 289, 329 ] }
static inline void FUNC_0(initFilter)(int16_t *filter, int16_t *filterPos, int *filterSize, int xInc, int srcW, int dstW, int filterAlign, int one) { int VAR_1; #ifdef HAVE_MMX asm volatile("emms\n\t"::: "memory"); #endif if(ABS(xInc - 0x10000) <10) { int VAR_1; *filterSize= (1 +(filterAlign-1)) & (~(filterAlign-1)); for(VAR_1=0; VAR_1<dstW*(*filterSize); VAR_1++) filter[VAR_1]=0; for(VAR_1=0; VAR_1<dstW; VAR_1++) { filter[VAR_1*(*filterSize)]=1; filterPos[VAR_1]=VAR_1; } } else if(xInc <= (1<<16) || sws_flags==SWS_FAST_BILINEAR) { int VAR_1; int VAR_2; if(sws_flags==SWS_BICUBIC) *filterSize= 4; else *filterSize= 2; *filterSize= (*filterSize +(filterAlign-1)) & (~(filterAlign-1)); VAR_2= xInc - 0x8000; for(VAR_1=0; VAR_1<dstW; VAR_1++) { int xx= (VAR_2>>16) - (*filterSize>>1) + 1; int j; filterPos[VAR_1]= xx; if(sws_flags == SWS_BICUBIC) { double d= ABS(((xx+1)<<16) - VAR_2)/(double)(1<<16); int y1,y2,y3,y4; double A= -0.75; y1 = (int)floor(0.5 + ( + A*d - 2.0*A*d*d + A*d*d*d) * 16384.0); y2 = (int)floor(0.5 + (+ 1.0 - (A+3.0)*d*d + (A+2.0)*d*d*d) * 16384.0); y3 = (int)floor(0.5 + ( - A*d + (2.0*A+3.0)*d*d - (A+2.0)*d*d*d) * 16384.0); y4 = (int)floor(0.5 + ( + A*d*d - A*d*d*d) * 16384.0); filter[VAR_1*(*filterSize) + 0]= y1; filter[VAR_1*(*filterSize) + 1]= y2; filter[VAR_1*(*filterSize) + 2]= y3; filter[VAR_1*(*filterSize) + 3]= y4; } else { for(j=0; j<*filterSize; j++) { double d= ABS((xx<<16) - VAR_2)/(double)(1<<16); int coeff; coeff= (int)(0.5 + (1.0 - d)*(1<<14)); if(coeff<0) coeff=0; filter[VAR_1*(*filterSize) + j]= coeff; xx++; } } VAR_2+= xInc; } } else { int VAR_2; if(sws_flags==SWS_BICUBIC) *filterSize= (int)ceil(1 + 4.0*srcW / (double)dstW); else *filterSize= (int)ceil(1 + 2.0*srcW / (double)dstW); *filterSize= (*filterSize +(filterAlign-1)) & (~(filterAlign-1)); VAR_2= xInc - 0x8000; for(VAR_1=0; VAR_1<dstW; VAR_1++) { int xx= (int)((double)VAR_2/(double)(1<<16) - *filterSize*0.5 + 0.5); int j; filterPos[VAR_1]= xx; for(j=0; j<*filterSize; j++) { double d= ABS((xx<<16) - VAR_2)/(double)xInc; int coeff; if(sws_flags == SWS_BICUBIC) { double A= -0.75; if(d<1.0) coeff = (int)floor(0.5 + (1.0 - (A+3.0)*d*d + (A+2.0)*d*d*d) * (1<<14)); else if(d<2.0) coeff = (int)floor(0.5 + (-4.0*A + 8.0*A*d - 5.0*A*d*d + A*d*d*d) * (1<<14)); else coeff=0; } else { coeff= (int)(0.5 + (1.0 - d)*(1<<14)); if(coeff<0) coeff=0; } filter[VAR_1*(*filterSize) + j]= coeff; xx++; } VAR_2+= xInc; } } for(VAR_1=0; VAR_1<dstW; VAR_1++) { int j; if(filterPos[VAR_1] < 0) { for(j=1; j<*filterSize; j++) { int left= MAX(j + filterPos[VAR_1], 0); filter[VAR_1*(*filterSize) + left] += filter[VAR_1*(*filterSize) + j]; filter[VAR_1*(*filterSize) + j]=0; } filterPos[VAR_1]= 0; } if(filterPos[VAR_1] + *filterSize > srcW) { int shift= filterPos[VAR_1] + *filterSize - srcW; for(j=*filterSize-2; j>=0; j--) { int right= MIN(j + shift, *filterSize-1); filter[VAR_1*(*filterSize) +right] += filter[VAR_1*(*filterSize) +j]; filter[VAR_1*(*filterSize) +j]=0; } filterPos[VAR_1]= srcW - *filterSize; } } for(VAR_1=0; VAR_1<dstW; VAR_1++) { int j; double sum=0; double scale= one; for(j=0; j<*filterSize; j++) { sum+= filter[VAR_1*(*filterSize) + j]; } scale/= sum; for(j=0; j<*filterSize; j++) { filter[VAR_1*(*filterSize) + j]= (int)(filter[VAR_1*(*filterSize) + j]*scale); } } }
[ "static inline void FUNC_0(initFilter)(int16_t *filter, int16_t *filterPos, int *filterSize, int xInc,\nint srcW, int dstW, int filterAlign, int one)\n{", "int VAR_1;", "#ifdef HAVE_MMX\nasm volatile(\"emms\\n\\t\"::: \"memory\");", "#endif\nif(ABS(xInc - 0x10000) <10)\n{", "int VAR_1;", "*filterSize= (1 +(filterAlign-1)) & (~(filterAlign-1));", "for(VAR_1=0; VAR_1<dstW*(*filterSize); VAR_1++) filter[VAR_1]=0;", "for(VAR_1=0; VAR_1<dstW; VAR_1++)", "{", "filter[VAR_1*(*filterSize)]=1;", "filterPos[VAR_1]=VAR_1;", "}", "}", "else if(xInc <= (1<<16) || sws_flags==SWS_FAST_BILINEAR)\n{", "int VAR_1;", "int VAR_2;", "if(sws_flags==SWS_BICUBIC) *filterSize= 4;", "else\t\t\t *filterSize= 2;", "*filterSize= (*filterSize +(filterAlign-1)) & (~(filterAlign-1));", "VAR_2= xInc - 0x8000;", "for(VAR_1=0; VAR_1<dstW; VAR_1++)", "{", "int xx= (VAR_2>>16) - (*filterSize>>1) + 1;", "int j;", "filterPos[VAR_1]= xx;", "if(sws_flags == SWS_BICUBIC)\n{", "double d= ABS(((xx+1)<<16) - VAR_2)/(double)(1<<16);", "int y1,y2,y3,y4;", "double A= -0.75;", "y1 = (int)floor(0.5 + ( + A*d - 2.0*A*d*d + A*d*d*d) * 16384.0);", "y2 = (int)floor(0.5 + (+ 1.0 - (A+3.0)*d*d + (A+2.0)*d*d*d) * 16384.0);", "y3 = (int)floor(0.5 + ( - A*d + (2.0*A+3.0)*d*d - (A+2.0)*d*d*d) * 16384.0);", "y4 = (int)floor(0.5 + ( + A*d*d - A*d*d*d) * 16384.0);", "filter[VAR_1*(*filterSize) + 0]= y1;", "filter[VAR_1*(*filterSize) + 1]= y2;", "filter[VAR_1*(*filterSize) + 2]= y3;", "filter[VAR_1*(*filterSize) + 3]= y4;", "}", "else\n{", "for(j=0; j<*filterSize; j++)", "{", "double d= ABS((xx<<16) - VAR_2)/(double)(1<<16);", "int coeff;", "coeff= (int)(0.5 + (1.0 - d)*(1<<14));", "if(coeff<0) coeff=0;", "filter[VAR_1*(*filterSize) + j]= coeff;", "xx++;", "}", "}", "VAR_2+= xInc;", "}", "}", "else\n{", "int VAR_2;", "if(sws_flags==SWS_BICUBIC) *filterSize= (int)ceil(1 + 4.0*srcW / (double)dstW);", "else\t\t\t *filterSize= (int)ceil(1 + 2.0*srcW / (double)dstW);", "*filterSize= (*filterSize +(filterAlign-1)) & (~(filterAlign-1));", "VAR_2= xInc - 0x8000;", "for(VAR_1=0; VAR_1<dstW; VAR_1++)", "{", "int xx= (int)((double)VAR_2/(double)(1<<16) - *filterSize*0.5 + 0.5);", "int j;", "filterPos[VAR_1]= xx;", "for(j=0; j<*filterSize; j++)", "{", "double d= ABS((xx<<16) - VAR_2)/(double)xInc;", "int coeff;", "if(sws_flags == SWS_BICUBIC)\n{", "double A= -0.75;", "if(d<1.0)\ncoeff = (int)floor(0.5 + (1.0 - (A+3.0)*d*d\n+ (A+2.0)*d*d*d) * (1<<14));", "else if(d<2.0)\ncoeff = (int)floor(0.5 + (-4.0*A + 8.0*A*d\n- 5.0*A*d*d + A*d*d*d) * (1<<14));", "else\ncoeff=0;", "}", "else\n{", "coeff= (int)(0.5 + (1.0 - d)*(1<<14));", "if(coeff<0) coeff=0;", "}", "filter[VAR_1*(*filterSize) + j]= coeff;", "xx++;", "}", "VAR_2+= xInc;", "}", "}", "for(VAR_1=0; VAR_1<dstW; VAR_1++)", "{", "int j;", "if(filterPos[VAR_1] < 0)\n{", "for(j=1; j<*filterSize; j++)", "{", "int left= MAX(j + filterPos[VAR_1], 0);", "filter[VAR_1*(*filterSize) + left] += filter[VAR_1*(*filterSize) + j];", "filter[VAR_1*(*filterSize) + j]=0;", "}", "filterPos[VAR_1]= 0;", "}", "if(filterPos[VAR_1] + *filterSize > srcW)\n{", "int shift= filterPos[VAR_1] + *filterSize - srcW;", "for(j=*filterSize-2; j>=0; j--)", "{", "int right= MIN(j + shift, *filterSize-1);", "filter[VAR_1*(*filterSize) +right] += filter[VAR_1*(*filterSize) +j];", "filter[VAR_1*(*filterSize) +j]=0;", "}", "filterPos[VAR_1]= srcW - *filterSize;", "}", "}", "for(VAR_1=0; VAR_1<dstW; VAR_1++)", "{", "int j;", "double sum=0;", "double scale= one;", "for(j=0; j<*filterSize; j++)", "{", "sum+= filter[VAR_1*(*filterSize) + j];", "}", "scale/= sum;", "for(j=0; j<*filterSize; j++)", "{", "filter[VAR_1*(*filterSize) + j]= (int)(filter[VAR_1*(*filterSize) + j]*scale);", "}", "}", "}" ]
[ 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9, 11 ], [ 13, 17, 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 73 ], [ 75, 77 ], [ 79 ], [ 83 ], [ 85 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 111 ], [ 113, 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145, 147 ], [ 149 ], [ 151 ], [ 153 ], [ 157 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183, 185 ], [ 187 ], [ 193, 195, 197 ], [ 199, 201, 203 ], [ 205, 207 ], [ 209 ], [ 211, 213 ], [ 215 ], [ 217 ], [ 219 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 239 ], [ 241 ], [ 243 ], [ 245, 247 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 269, 271 ], [ 273 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ], [ 291 ], [ 293 ], [ 305 ], [ 307 ], [ 309 ], [ 311 ], [ 313 ], [ 315 ], [ 317 ], [ 319 ], [ 321 ], [ 323 ], [ 325 ], [ 327 ], [ 329 ], [ 331 ], [ 333 ], [ 335 ] ]
18,764
static void latm_write_frame_header(AVFormatContext *s, PutBitContext *bs) { LATMContext *ctx = s->priv_data; AVCodecContext *avctx = s->streams[0]->codec; GetBitContext gb; int header_size; /* AudioMuxElement */ put_bits(bs, 1, !!ctx->counter); if (!ctx->counter) { init_get_bits(&gb, avctx->extradata, avctx->extradata_size * 8); /* StreamMuxConfig */ put_bits(bs, 1, 0); /* audioMuxVersion */ put_bits(bs, 1, 1); /* allStreamsSameTimeFraming */ put_bits(bs, 6, 0); /* numSubFrames */ put_bits(bs, 4, 0); /* numProgram */ put_bits(bs, 3, 0); /* numLayer */ /* AudioSpecificConfig */ if (ctx->object_type == AOT_ALS) { header_size = avctx->extradata_size-(ctx->off + 7) >> 3; avpriv_copy_bits(bs, &avctx->extradata[ctx->off], header_size); } else { avpriv_copy_bits(bs, avctx->extradata, ctx->off + 3); if (!ctx->channel_conf) { avpriv_copy_pce_data(bs, &gb); } } put_bits(bs, 3, 0); /* frameLengthType */ put_bits(bs, 8, 0xff); /* latmBufferFullness */ put_bits(bs, 1, 0); /* otherDataPresent */ put_bits(bs, 1, 0); /* crcCheckPresent */ } ctx->counter++; ctx->counter %= ctx->mod; }
true
FFmpeg
a736eb4a605f46d5ff96c7b32e55710ecd9cce89
static void latm_write_frame_header(AVFormatContext *s, PutBitContext *bs) { LATMContext *ctx = s->priv_data; AVCodecContext *avctx = s->streams[0]->codec; GetBitContext gb; int header_size; put_bits(bs, 1, !!ctx->counter); if (!ctx->counter) { init_get_bits(&gb, avctx->extradata, avctx->extradata_size * 8); put_bits(bs, 1, 0); put_bits(bs, 1, 1); put_bits(bs, 6, 0); put_bits(bs, 4, 0); put_bits(bs, 3, 0); if (ctx->object_type == AOT_ALS) { header_size = avctx->extradata_size-(ctx->off + 7) >> 3; avpriv_copy_bits(bs, &avctx->extradata[ctx->off], header_size); } else { avpriv_copy_bits(bs, avctx->extradata, ctx->off + 3); if (!ctx->channel_conf) { avpriv_copy_pce_data(bs, &gb); } } put_bits(bs, 3, 0); put_bits(bs, 8, 0xff); put_bits(bs, 1, 0); put_bits(bs, 1, 0); } ctx->counter++; ctx->counter %= ctx->mod; }
{ "code": [ " header_size = avctx->extradata_size-(ctx->off + 7) >> 3;", " avpriv_copy_bits(bs, &avctx->extradata[ctx->off], header_size);" ], "line_no": [ 45, 47 ] }
static void FUNC_0(AVFormatContext *VAR_0, PutBitContext *VAR_1) { LATMContext *ctx = VAR_0->priv_data; AVCodecContext *avctx = VAR_0->streams[0]->codec; GetBitContext gb; int VAR_2; put_bits(VAR_1, 1, !!ctx->counter); if (!ctx->counter) { init_get_bits(&gb, avctx->extradata, avctx->extradata_size * 8); put_bits(VAR_1, 1, 0); put_bits(VAR_1, 1, 1); put_bits(VAR_1, 6, 0); put_bits(VAR_1, 4, 0); put_bits(VAR_1, 3, 0); if (ctx->object_type == AOT_ALS) { VAR_2 = avctx->extradata_size-(ctx->off + 7) >> 3; avpriv_copy_bits(VAR_1, &avctx->extradata[ctx->off], VAR_2); } else { avpriv_copy_bits(VAR_1, avctx->extradata, ctx->off + 3); if (!ctx->channel_conf) { avpriv_copy_pce_data(VAR_1, &gb); } } put_bits(VAR_1, 3, 0); put_bits(VAR_1, 8, 0xff); put_bits(VAR_1, 1, 0); put_bits(VAR_1, 1, 0); } ctx->counter++; ctx->counter %= ctx->mod; }
[ "static void FUNC_0(AVFormatContext *VAR_0, PutBitContext *VAR_1)\n{", "LATMContext *ctx = VAR_0->priv_data;", "AVCodecContext *avctx = VAR_0->streams[0]->codec;", "GetBitContext gb;", "int VAR_2;", "put_bits(VAR_1, 1, !!ctx->counter);", "if (!ctx->counter) {", "init_get_bits(&gb, avctx->extradata, avctx->extradata_size * 8);", "put_bits(VAR_1, 1, 0);", "put_bits(VAR_1, 1, 1);", "put_bits(VAR_1, 6, 0);", "put_bits(VAR_1, 4, 0);", "put_bits(VAR_1, 3, 0);", "if (ctx->object_type == AOT_ALS) {", "VAR_2 = avctx->extradata_size-(ctx->off + 7) >> 3;", "avpriv_copy_bits(VAR_1, &avctx->extradata[ctx->off], VAR_2);", "} else {", "avpriv_copy_bits(VAR_1, avctx->extradata, ctx->off + 3);", "if (!ctx->channel_conf) {", "avpriv_copy_pce_data(VAR_1, &gb);", "}", "}", "put_bits(VAR_1, 3, 0);", "put_bits(VAR_1, 8, 0xff);", "put_bits(VAR_1, 1, 0);", "put_bits(VAR_1, 1, 0);", "}", "ctx->counter++;", "ctx->counter %= ctx->mod;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 17 ], [ 21 ], [ 23 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ], [ 83 ] ]
18,765
static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; TM2Context * const l = avctx->priv_data; AVFrame * const p= (AVFrame*)&l->pic; int i, skip, t; uint8_t *swbuf; swbuf = av_malloc(buf_size + FF_INPUT_BUFFER_PADDING_SIZE); if(!swbuf){ av_log(avctx, AV_LOG_ERROR, "Cannot allocate temporary buffer\n"); return -1; } p->reference = 1; p->buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE; if(avctx->reget_buffer(avctx, p) < 0){ av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); av_free(swbuf); return -1; } l->dsp.bswap_buf((uint32_t*)swbuf, (const uint32_t*)buf, buf_size >> 2); skip = tm2_read_header(l, swbuf); if(skip == -1){ av_free(swbuf); return -1; } for(i = 0; i < TM2_NUM_STREAMS; i++){ t = tm2_read_stream(l, swbuf + skip, tm2_stream_order[i]); if(t == -1){ av_free(swbuf); return -1; } skip += t; } p->key_frame = tm2_decode_blocks(l, p); if(p->key_frame) p->pict_type = FF_I_TYPE; else p->pict_type = FF_P_TYPE; l->cur = !l->cur; *data_size = sizeof(AVFrame); *(AVFrame*)data = l->pic; av_free(swbuf); return buf_size; }
true
FFmpeg
b89f4fb1908f26d2704b9496952131fffd4dafae
static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; TM2Context * const l = avctx->priv_data; AVFrame * const p= (AVFrame*)&l->pic; int i, skip, t; uint8_t *swbuf; swbuf = av_malloc(buf_size + FF_INPUT_BUFFER_PADDING_SIZE); if(!swbuf){ av_log(avctx, AV_LOG_ERROR, "Cannot allocate temporary buffer\n"); return -1; } p->reference = 1; p->buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE; if(avctx->reget_buffer(avctx, p) < 0){ av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); av_free(swbuf); return -1; } l->dsp.bswap_buf((uint32_t*)swbuf, (const uint32_t*)buf, buf_size >> 2); skip = tm2_read_header(l, swbuf); if(skip == -1){ av_free(swbuf); return -1; } for(i = 0; i < TM2_NUM_STREAMS; i++){ t = tm2_read_stream(l, swbuf + skip, tm2_stream_order[i]); if(t == -1){ av_free(swbuf); return -1; } skip += t; } p->key_frame = tm2_decode_blocks(l, p); if(p->key_frame) p->pict_type = FF_I_TYPE; else p->pict_type = FF_P_TYPE; l->cur = !l->cur; *data_size = sizeof(AVFrame); *(AVFrame*)data = l->pic; av_free(swbuf); return buf_size; }
{ "code": [ " t = tm2_read_stream(l, swbuf + skip, tm2_stream_order[i]);" ], "line_no": [ 67 ] }
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3) { const uint8_t *VAR_4 = VAR_3->VAR_1; int VAR_5 = VAR_3->size; TM2Context * const l = VAR_0->priv_data; AVFrame * const p= (AVFrame*)&l->pic; int VAR_6, VAR_7, VAR_8; uint8_t *swbuf; swbuf = av_malloc(VAR_5 + FF_INPUT_BUFFER_PADDING_SIZE); if(!swbuf){ av_log(VAR_0, AV_LOG_ERROR, "Cannot allocate temporary buffer\n"); return -1; } p->reference = 1; p->buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE; if(VAR_0->reget_buffer(VAR_0, p) < 0){ av_log(VAR_0, AV_LOG_ERROR, "get_buffer() failed\n"); av_free(swbuf); return -1; } l->dsp.bswap_buf((uint32_t*)swbuf, (const uint32_t*)VAR_4, VAR_5 >> 2); VAR_7 = tm2_read_header(l, swbuf); if(VAR_7 == -1){ av_free(swbuf); return -1; } for(VAR_6 = 0; VAR_6 < TM2_NUM_STREAMS; VAR_6++){ VAR_8 = tm2_read_stream(l, swbuf + VAR_7, tm2_stream_order[VAR_6]); if(VAR_8 == -1){ av_free(swbuf); return -1; } VAR_7 += VAR_8; } p->key_frame = tm2_decode_blocks(l, p); if(p->key_frame) p->pict_type = FF_I_TYPE; else p->pict_type = FF_P_TYPE; l->cur = !l->cur; *VAR_2 = sizeof(AVFrame); *(AVFrame*)VAR_1 = l->pic; av_free(swbuf); return VAR_5; }
[ "static int FUNC_0(AVCodecContext *VAR_0,\nvoid *VAR_1, int *VAR_2,\nAVPacket *VAR_3)\n{", "const uint8_t *VAR_4 = VAR_3->VAR_1;", "int VAR_5 = VAR_3->size;", "TM2Context * const l = VAR_0->priv_data;", "AVFrame * const p= (AVFrame*)&l->pic;", "int VAR_6, VAR_7, VAR_8;", "uint8_t *swbuf;", "swbuf = av_malloc(VAR_5 + FF_INPUT_BUFFER_PADDING_SIZE);", "if(!swbuf){", "av_log(VAR_0, AV_LOG_ERROR, \"Cannot allocate temporary buffer\\n\");", "return -1;", "}", "p->reference = 1;", "p->buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;", "if(VAR_0->reget_buffer(VAR_0, p) < 0){", "av_log(VAR_0, AV_LOG_ERROR, \"get_buffer() failed\\n\");", "av_free(swbuf);", "return -1;", "}", "l->dsp.bswap_buf((uint32_t*)swbuf, (const uint32_t*)VAR_4, VAR_5 >> 2);", "VAR_7 = tm2_read_header(l, swbuf);", "if(VAR_7 == -1){", "av_free(swbuf);", "return -1;", "}", "for(VAR_6 = 0; VAR_6 < TM2_NUM_STREAMS; VAR_6++){", "VAR_8 = tm2_read_stream(l, swbuf + VAR_7, tm2_stream_order[VAR_6]);", "if(VAR_8 == -1){", "av_free(swbuf);", "return -1;", "}", "VAR_7 += VAR_8;", "}", "p->key_frame = tm2_decode_blocks(l, p);", "if(p->key_frame)\np->pict_type = FF_I_TYPE;", "else\np->pict_type = FF_P_TYPE;", "l->cur = !l->cur;", "*VAR_2 = sizeof(AVFrame);", "*(AVFrame*)VAR_1 = l->pic;", "av_free(swbuf);", "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, 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 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83, 85 ], [ 87, 89 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 103 ], [ 105 ] ]
18,767
static void apply_loop_filter(Vp3DecodeContext *s, int plane, int ystart, int yend) { int x, y; int *bounding_values= s->bounding_values_array+127; int width = s->fragment_width[!!plane]; int height = s->fragment_height[!!plane]; int fragment = s->fragment_start [plane] + ystart * width; int stride = s->current_frame.linesize[plane]; uint8_t *plane_data = s->current_frame.data [plane]; if (!s->flipped_image) stride = -stride; plane_data += s->data_offset[plane] + 8*ystart*stride; for (y = ystart; y < yend; y++) { for (x = 0; x < width; x++) { /* This code basically just deblocks on the edges of coded blocks. * However, it has to be much more complicated because of the * braindamaged deblock ordering used in VP3/Theora. Order matters * because some pixels get filtered twice. */ if( s->all_fragments[fragment].coding_method != MODE_COPY ) { /* do not perform left edge filter for left columns frags */ if (x > 0) { s->dsp.vp3_h_loop_filter( plane_data + 8*x, stride, bounding_values); } /* do not perform top edge filter for top row fragments */ if (y > 0) { s->dsp.vp3_v_loop_filter( plane_data + 8*x, stride, bounding_values); } /* do not perform right edge filter for right column * fragments or if right fragment neighbor is also coded * in this frame (it will be filtered in next iteration) */ if ((x < width - 1) && (s->all_fragments[fragment + 1].coding_method == MODE_COPY)) { s->dsp.vp3_h_loop_filter( plane_data + 8*x + 8, stride, bounding_values); } /* do not perform bottom edge filter for bottom row * fragments or if bottom fragment neighbor is also coded * in this frame (it will be filtered in the next row) */ if ((y < height - 1) && (s->all_fragments[fragment + width].coding_method == MODE_COPY)) { s->dsp.vp3_v_loop_filter( plane_data + 8*x + 8*stride, stride, bounding_values); } } fragment++; } plane_data += 8*stride; } }
false
FFmpeg
28f9ab7029bd1a02f659995919f899f84ee7361b
static void apply_loop_filter(Vp3DecodeContext *s, int plane, int ystart, int yend) { int x, y; int *bounding_values= s->bounding_values_array+127; int width = s->fragment_width[!!plane]; int height = s->fragment_height[!!plane]; int fragment = s->fragment_start [plane] + ystart * width; int stride = s->current_frame.linesize[plane]; uint8_t *plane_data = s->current_frame.data [plane]; if (!s->flipped_image) stride = -stride; plane_data += s->data_offset[plane] + 8*ystart*stride; for (y = ystart; y < yend; y++) { for (x = 0; x < width; x++) { if( s->all_fragments[fragment].coding_method != MODE_COPY ) { if (x > 0) { s->dsp.vp3_h_loop_filter( plane_data + 8*x, stride, bounding_values); } if (y > 0) { s->dsp.vp3_v_loop_filter( plane_data + 8*x, stride, bounding_values); } if ((x < width - 1) && (s->all_fragments[fragment + 1].coding_method == MODE_COPY)) { s->dsp.vp3_h_loop_filter( plane_data + 8*x + 8, stride, bounding_values); } if ((y < height - 1) && (s->all_fragments[fragment + width].coding_method == MODE_COPY)) { s->dsp.vp3_v_loop_filter( plane_data + 8*x + 8*stride, stride, bounding_values); } } fragment++; } plane_data += 8*stride; } }
{ "code": [], "line_no": [] }
static void FUNC_0(Vp3DecodeContext *VAR_0, int VAR_1, int VAR_2, int VAR_3) { int VAR_4, VAR_5; int *VAR_6= VAR_0->bounding_values_array+127; int VAR_7 = VAR_0->fragment_width[!!VAR_1]; int VAR_8 = VAR_0->fragment_height[!!VAR_1]; int VAR_9 = VAR_0->fragment_start [VAR_1] + VAR_2 * VAR_7; int VAR_10 = VAR_0->current_frame.linesize[VAR_1]; uint8_t *plane_data = VAR_0->current_frame.data [VAR_1]; if (!VAR_0->flipped_image) VAR_10 = -VAR_10; plane_data += VAR_0->data_offset[VAR_1] + 8*VAR_2*VAR_10; for (VAR_5 = VAR_2; VAR_5 < VAR_3; VAR_5++) { for (VAR_4 = 0; VAR_4 < VAR_7; VAR_4++) { if( VAR_0->all_fragments[VAR_9].coding_method != MODE_COPY ) { if (VAR_4 > 0) { VAR_0->dsp.vp3_h_loop_filter( plane_data + 8*VAR_4, VAR_10, VAR_6); } if (VAR_5 > 0) { VAR_0->dsp.vp3_v_loop_filter( plane_data + 8*VAR_4, VAR_10, VAR_6); } if ((VAR_4 < VAR_7 - 1) && (VAR_0->all_fragments[VAR_9 + 1].coding_method == MODE_COPY)) { VAR_0->dsp.vp3_h_loop_filter( plane_data + 8*VAR_4 + 8, VAR_10, VAR_6); } if ((VAR_5 < VAR_8 - 1) && (VAR_0->all_fragments[VAR_9 + VAR_7].coding_method == MODE_COPY)) { VAR_0->dsp.vp3_v_loop_filter( plane_data + 8*VAR_4 + 8*VAR_10, VAR_10, VAR_6); } } VAR_9++; } plane_data += 8*VAR_10; } }
[ "static void FUNC_0(Vp3DecodeContext *VAR_0, int VAR_1, int VAR_2, int VAR_3)\n{", "int VAR_4, VAR_5;", "int *VAR_6= VAR_0->bounding_values_array+127;", "int VAR_7 = VAR_0->fragment_width[!!VAR_1];", "int VAR_8 = VAR_0->fragment_height[!!VAR_1];", "int VAR_9 = VAR_0->fragment_start [VAR_1] + VAR_2 * VAR_7;", "int VAR_10 = VAR_0->current_frame.linesize[VAR_1];", "uint8_t *plane_data = VAR_0->current_frame.data [VAR_1];", "if (!VAR_0->flipped_image) VAR_10 = -VAR_10;", "plane_data += VAR_0->data_offset[VAR_1] + 8*VAR_2*VAR_10;", "for (VAR_5 = VAR_2; VAR_5 < VAR_3; VAR_5++) {", "for (VAR_4 = 0; VAR_4 < VAR_7; VAR_4++) {", "if( VAR_0->all_fragments[VAR_9].coding_method != MODE_COPY )\n{", "if (VAR_4 > 0) {", "VAR_0->dsp.vp3_h_loop_filter(\nplane_data + 8*VAR_4,\nVAR_10, VAR_6);", "}", "if (VAR_5 > 0) {", "VAR_0->dsp.vp3_v_loop_filter(\nplane_data + 8*VAR_4,\nVAR_10, VAR_6);", "}", "if ((VAR_4 < VAR_7 - 1) &&\n(VAR_0->all_fragments[VAR_9 + 1].coding_method == MODE_COPY)) {", "VAR_0->dsp.vp3_h_loop_filter(\nplane_data + 8*VAR_4 + 8,\nVAR_10, VAR_6);", "}", "if ((VAR_5 < VAR_8 - 1) &&\n(VAR_0->all_fragments[VAR_9 + VAR_7].coding_method == MODE_COPY)) {", "VAR_0->dsp.vp3_v_loop_filter(\nplane_data + 8*VAR_4 + 8*VAR_10,\nVAR_10, VAR_6);", "}", "}", "VAR_9++;", "}", "plane_data += 8*VAR_10;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 31 ], [ 41, 43 ], [ 47 ], [ 49, 51, 53 ], [ 55 ], [ 61 ], [ 63, 65, 67 ], [ 69 ], [ 79, 81 ], [ 83, 85, 87 ], [ 89 ], [ 99, 101 ], [ 103, 105, 107 ], [ 109 ], [ 111 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ] ]
18,768
static int matroska_probe(AVProbeData *p) { uint64_t total = 0; int len_mask = 0x80, size = 1, n = 1, i; /* EBML header? */ if (AV_RB32(p->buf) != EBML_ID_HEADER) return 0; /* length of header */ total = p->buf[4]; while (size <= 8 && !(total & len_mask)) { size++; len_mask >>= 1; } if (size > 8) return 0; total &= (len_mask - 1); while (n < size) total = (total << 8) | p->buf[4 + n++]; /* Does the probe data contain the whole header? */ if (p->buf_size < 4 + size + total) return 0; /* The header should contain a known document type. For now, * we don't parse the whole header but simply check for the * availability of that array of characters inside the header. * Not fully fool-proof, but good enough. */ for (i = 0; i < FF_ARRAY_ELEMS(matroska_doctypes); i++) { int probelen = strlen(matroska_doctypes[i]); for (n = 4+size; n <= 4+size+total-probelen; n++) if (!memcmp(p->buf+n, matroska_doctypes[i], probelen)) return AVPROBE_SCORE_MAX; } // probably valid EBML header but no recognized doctype return AVPROBE_SCORE_MAX/2; }
true
FFmpeg
69619a13c3fef940cba545cf0a283ff22771dd71
static int matroska_probe(AVProbeData *p) { uint64_t total = 0; int len_mask = 0x80, size = 1, n = 1, i; if (AV_RB32(p->buf) != EBML_ID_HEADER) return 0; total = p->buf[4]; while (size <= 8 && !(total & len_mask)) { size++; len_mask >>= 1; } if (size > 8) return 0; total &= (len_mask - 1); while (n < size) total = (total << 8) | p->buf[4 + n++]; if (p->buf_size < 4 + size + total) return 0; for (i = 0; i < FF_ARRAY_ELEMS(matroska_doctypes); i++) { int probelen = strlen(matroska_doctypes[i]); for (n = 4+size; n <= 4+size+total-probelen; n++) if (!memcmp(p->buf+n, matroska_doctypes[i], probelen)) return AVPROBE_SCORE_MAX; } return AVPROBE_SCORE_MAX/2; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVProbeData *VAR_0) { uint64_t total = 0; int VAR_1 = 0x80, VAR_2 = 1, VAR_3 = 1, VAR_4; if (AV_RB32(VAR_0->buf) != EBML_ID_HEADER) return 0; total = VAR_0->buf[4]; while (VAR_2 <= 8 && !(total & VAR_1)) { VAR_2++; VAR_1 >>= 1; } if (VAR_2 > 8) return 0; total &= (VAR_1 - 1); while (VAR_3 < VAR_2) total = (total << 8) | VAR_0->buf[4 + VAR_3++]; if (VAR_0->buf_size < 4 + VAR_2 + total) return 0; for (VAR_4 = 0; VAR_4 < FF_ARRAY_ELEMS(matroska_doctypes); VAR_4++) { int probelen = strlen(matroska_doctypes[VAR_4]); for (VAR_3 = 4+VAR_2; VAR_3 <= 4+VAR_2+total-probelen; VAR_3++) if (!memcmp(VAR_0->buf+VAR_3, matroska_doctypes[VAR_4], probelen)) return AVPROBE_SCORE_MAX; } return AVPROBE_SCORE_MAX/2; }
[ "static int FUNC_0(AVProbeData *VAR_0)\n{", "uint64_t total = 0;", "int VAR_1 = 0x80, VAR_2 = 1, VAR_3 = 1, VAR_4;", "if (AV_RB32(VAR_0->buf) != EBML_ID_HEADER)\nreturn 0;", "total = VAR_0->buf[4];", "while (VAR_2 <= 8 && !(total & VAR_1)) {", "VAR_2++;", "VAR_1 >>= 1;", "}", "if (VAR_2 > 8)\nreturn 0;", "total &= (VAR_1 - 1);", "while (VAR_3 < VAR_2)\ntotal = (total << 8) | VAR_0->buf[4 + VAR_3++];", "if (VAR_0->buf_size < 4 + VAR_2 + total)\nreturn 0;", "for (VAR_4 = 0; VAR_4 < FF_ARRAY_ELEMS(matroska_doctypes); VAR_4++) {", "int probelen = strlen(matroska_doctypes[VAR_4]);", "for (VAR_3 = 4+VAR_2; VAR_3 <= 4+VAR_2+total-probelen; VAR_3++)", "if (!memcmp(VAR_0->buf+VAR_3, matroska_doctypes[VAR_4], probelen))\nreturn AVPROBE_SCORE_MAX;", "}", "return AVPROBE_SCORE_MAX/2;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 13, 15 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 37, 39 ], [ 45, 47 ], [ 59 ], [ 61 ], [ 65 ], [ 67, 69 ], [ 71 ], [ 77 ], [ 79 ] ]
18,769
void palette8torgb32(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette) { unsigned i; /* for(i=0; i<num_pixels; i++) ((unsigned *)dst)[i] = ((unsigned *)palette)[ src[i] ]; */ for(i=0; i<num_pixels; i++) { #ifdef WORDS_BIGENDIAN dst[3]= palette[ src[i]*4+2 ]; dst[2]= palette[ src[i]*4+1 ]; dst[1]= palette[ src[i]*4+0 ]; #else //FIXME slow? dst[0]= palette[ src[i]*4+2 ]; dst[1]= palette[ src[i]*4+1 ]; dst[2]= palette[ src[i]*4+0 ]; // dst[3]= 0; /* do we need this cleansing? */ #endif dst+= 4; } }
true
FFmpeg
7f526efd17973ec6d2204f7a47b6923e2be31363
void palette8torgb32(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette) { unsigned i; for(i=0; i<num_pixels; i++) { #ifdef WORDS_BIGENDIAN dst[3]= palette[ src[i]*4+2 ]; dst[2]= palette[ src[i]*4+1 ]; dst[1]= palette[ src[i]*4+0 ]; #else dst[0]= palette[ src[i]*4+2 ]; dst[1]= palette[ src[i]*4+1 ]; dst[2]= palette[ src[i]*4+0 ]; #endif dst+= 4; } }
{ "code": [ "void palette8torgb32(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette)", "\tunsigned i;", "\tunsigned i;", "\tunsigned i;", "\tunsigned i;", "\tunsigned i;", "\tunsigned i;", "\tunsigned i;", "\tunsigned i;", "\tunsigned i;", "\tunsigned i;", "\tunsigned i;", "\tunsigned i;", "\tunsigned i;", "\tunsigned i;", "\tunsigned i;" ], "line_no": [ 1, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 ] }
void FUNC_0(const uint8_t *VAR_0, uint8_t *VAR_1, unsigned VAR_2, const uint8_t *VAR_3) { unsigned VAR_4; for(VAR_4=0; VAR_4<VAR_2; VAR_4++) { #ifdef WORDS_BIGENDIAN VAR_1[3]= VAR_3[ VAR_0[VAR_4]*4+2 ]; VAR_1[2]= VAR_3[ VAR_0[VAR_4]*4+1 ]; VAR_1[1]= VAR_3[ VAR_0[VAR_4]*4+0 ]; #else VAR_1[0]= VAR_3[ VAR_0[VAR_4]*4+2 ]; VAR_1[1]= VAR_3[ VAR_0[VAR_4]*4+1 ]; VAR_1[2]= VAR_3[ VAR_0[VAR_4]*4+0 ]; #endif VAR_1+= 4; } }
[ "void FUNC_0(const uint8_t *VAR_0, uint8_t *VAR_1, unsigned VAR_2, const uint8_t *VAR_3)\n{", "unsigned VAR_4;", "for(VAR_4=0; VAR_4<VAR_2; VAR_4++)", "{", "#ifdef WORDS_BIGENDIAN\nVAR_1[3]= VAR_3[ VAR_0[VAR_4]*4+2 ];", "VAR_1[2]= VAR_3[ VAR_0[VAR_4]*4+1 ];", "VAR_1[1]= VAR_3[ VAR_0[VAR_4]*4+0 ];", "#else\nVAR_1[0]= VAR_3[ VAR_0[VAR_4]*4+2 ];", "VAR_1[1]= VAR_3[ VAR_0[VAR_4]*4+1 ];", "VAR_1[2]= VAR_3[ VAR_0[VAR_4]*4+0 ];", "#endif\nVAR_1+= 4;", "}", "}" ]
[ 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 19 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 29 ], [ 31, 35 ], [ 37 ], [ 39 ], [ 43, 45 ], [ 47 ], [ 49 ] ]
18,770
void visit_get_next_type(Visitor *v, int *obj, const int *qtypes, const char *name, Error **errp) { if (v->get_next_type) { v->get_next_type(v, obj, qtypes, name, errp); } }
true
qemu
0426d53c6530606bf7641b83f2b755fe61c280ee
void visit_get_next_type(Visitor *v, int *obj, const int *qtypes, const char *name, Error **errp) { if (v->get_next_type) { v->get_next_type(v, obj, qtypes, name, errp); } }
{ "code": [ "void visit_get_next_type(Visitor *v, int *obj, const int *qtypes,", "void visit_get_next_type(Visitor *v, int *obj, const int *qtypes,", " v->get_next_type(v, obj, qtypes, name, errp);" ], "line_no": [ 1, 1, 9 ] }
void FUNC_0(Visitor *VAR_0, int *VAR_1, const int *VAR_2, const char *VAR_3, Error **VAR_4) { if (VAR_0->get_next_type) { VAR_0->get_next_type(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4); } }
[ "void FUNC_0(Visitor *VAR_0, int *VAR_1, const int *VAR_2,\nconst char *VAR_3, Error **VAR_4)\n{", "if (VAR_0->get_next_type) {", "VAR_0->get_next_type(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4);", "}", "}" ]
[ 1, 0, 1, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ] ]
18,771
static int bad_mode_switch(CPUARMState *env, int mode, CPSRWriteType write_type) { /* Return true if it is not valid for us to switch to * this CPU mode (ie all the UNPREDICTABLE cases in * the ARM ARM CPSRWriteByInstr pseudocode). /* Changes to or from Hyp via MSR and CPS are illegal. */ ((env->uncached_cpsr & CPSR_M) == ARM_CPU_MODE_HYP || mode == ARM_CPU_MODE_HYP)) { switch (mode) { case ARM_CPU_MODE_USR: return 0; case ARM_CPU_MODE_SYS: case ARM_CPU_MODE_SVC: case ARM_CPU_MODE_ABT: case ARM_CPU_MODE_UND: case ARM_CPU_MODE_IRQ: case ARM_CPU_MODE_FIQ: /* Note that we don't implement the IMPDEF NSACR.RFR which in v7 * allows FIQ mode to be Secure-only. (In v8 this doesn't exist.) return 0; case ARM_CPU_MODE_HYP: return !arm_feature(env, ARM_FEATURE_EL2) || arm_current_el(env) < 2 || arm_is_secure(env); case ARM_CPU_MODE_MON: return arm_current_el(env) < 3; default:
true
qemu
10eacda787ac9990dc22d4437b289200c819712c
static int bad_mode_switch(CPUARMState *env, int mode, CPSRWriteType write_type) { ((env->uncached_cpsr & CPSR_M) == ARM_CPU_MODE_HYP || mode == ARM_CPU_MODE_HYP)) { switch (mode) { case ARM_CPU_MODE_USR: return 0; case ARM_CPU_MODE_SYS: case ARM_CPU_MODE_SVC: case ARM_CPU_MODE_ABT: case ARM_CPU_MODE_UND: case ARM_CPU_MODE_IRQ: case ARM_CPU_MODE_FIQ: /* Note that we don't implement the IMPDEF NSACR.RFR which in v7 * allows FIQ mode to be Secure-only. (In v8 this doesn't exist.) return 0; case ARM_CPU_MODE_HYP: return !arm_feature(env, ARM_FEATURE_EL2) || arm_current_el(env) < 2 || arm_is_secure(env); case ARM_CPU_MODE_MON: return arm_current_el(env) < 3; default:
{ "code": [], "line_no": [] }
static int FUNC_0(CPUARMState *VAR_0, int VAR_1, CPSRWriteType VAR_2) { ((VAR_0->uncached_cpsr & CPSR_M) == ARM_CPU_MODE_HYP || VAR_1 == ARM_CPU_MODE_HYP)) { switch (VAR_1) { case ARM_CPU_MODE_USR: return 0; case ARM_CPU_MODE_SYS: case ARM_CPU_MODE_SVC: case ARM_CPU_MODE_ABT: case ARM_CPU_MODE_UND: case ARM_CPU_MODE_IRQ: case ARM_CPU_MODE_FIQ: /* Note that we don't implement the IMPDEF NSACR.RFR which in v7 * allows FIQ VAR_1 to be Secure-only. (In v8 this doesn't exist.) return 0; case ARM_CPU_MODE_HYP: return !arm_feature(VAR_0, ARM_FEATURE_EL2) || arm_current_el(VAR_0) < 2 || arm_is_secure(VAR_0); case ARM_CPU_MODE_MON: return arm_current_el(VAR_0) < 3; default:
[ "static int FUNC_0(CPUARMState *VAR_0, int VAR_1, CPSRWriteType VAR_2)\n{", "((VAR_0->uncached_cpsr & CPSR_M) == ARM_CPU_MODE_HYP ||\nVAR_1 == ARM_CPU_MODE_HYP)) {", "switch (VAR_1) {", "case ARM_CPU_MODE_USR:\nreturn 0;", "case ARM_CPU_MODE_SYS:\ncase ARM_CPU_MODE_SVC:\ncase ARM_CPU_MODE_ABT:\ncase ARM_CPU_MODE_UND:\ncase ARM_CPU_MODE_IRQ:\ncase ARM_CPU_MODE_FIQ:\n/* Note that we don't implement the IMPDEF NSACR.RFR which in v7\n* allows FIQ VAR_1 to be Secure-only. (In v8 this doesn't exist.)\nreturn 0;", "case ARM_CPU_MODE_HYP:\nreturn !arm_feature(VAR_0, ARM_FEATURE_EL2)\n|| arm_current_el(VAR_0) < 2 || arm_is_secure(VAR_0);", "case ARM_CPU_MODE_MON:\nreturn arm_current_el(VAR_0) < 3;" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 17, 19 ], [ 25 ], [ 27, 29 ], [ 31, 33, 35, 37, 39, 41, 43, 45, 57 ], [ 59, 61, 63 ], [ 65, 67 ] ]
18,772
static int mxf_read_source_clip(void *arg, AVIOContext *pb, int tag, int size, UID uid) { MXFStructuralComponent *source_clip = arg; switch(tag) { case 0x0202: source_clip->duration = avio_rb64(pb); break; case 0x1201: source_clip->start_position = avio_rb64(pb); break; case 0x1101: /* UMID, only get last 16 bytes */ avio_skip(pb, 16); avio_read(pb, source_clip->source_package_uid, 16); break; case 0x1102: source_clip->source_track_id = avio_rb32(pb); break; } return 0; }
true
FFmpeg
fd34dbea58e097609ff09cf7dcc59f74930195d3
static int mxf_read_source_clip(void *arg, AVIOContext *pb, int tag, int size, UID uid) { MXFStructuralComponent *source_clip = arg; switch(tag) { case 0x0202: source_clip->duration = avio_rb64(pb); break; case 0x1201: source_clip->start_position = avio_rb64(pb); break; case 0x1101: avio_skip(pb, 16); avio_read(pb, source_clip->source_package_uid, 16); break; case 0x1102: source_clip->source_track_id = avio_rb32(pb); break; } return 0; }
{ "code": [ "static int mxf_read_source_clip(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) { MXFStructuralComponent *source_clip = VAR_0; switch(VAR_2) { case 0x0202: source_clip->duration = avio_rb64(VAR_1); break; case 0x1201: source_clip->start_position = avio_rb64(VAR_1); break; case 0x1101: avio_skip(VAR_1, 16); avio_read(VAR_1, source_clip->source_package_uid, 16); break; case 0x1102: source_clip->source_track_id = avio_rb32(VAR_1); break; } return 0; }
[ "static int FUNC_0(void *VAR_0, AVIOContext *VAR_1, int VAR_2, int VAR_3, UID VAR_4)\n{", "MXFStructuralComponent *source_clip = VAR_0;", "switch(VAR_2) {", "case 0x0202:\nsource_clip->duration = avio_rb64(VAR_1);", "break;", "case 0x1201:\nsource_clip->start_position = avio_rb64(VAR_1);", "break;", "case 0x1101:\navio_skip(VAR_1, 16);", "avio_read(VAR_1, source_clip->source_package_uid, 16);", "break;", "case 0x1102:\nsource_clip->source_track_id = avio_rb32(VAR_1);", "break;", "}", "return 0;", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9, 11 ], [ 13 ], [ 15, 17 ], [ 19 ], [ 21, 25 ], [ 27 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ] ]
18,774
static void print_report(int is_last_report, int64_t timer_start, int64_t cur_time) { char buf[1024]; AVBPrint buf_script; OutputStream *ost; AVFormatContext *oc; int64_t total_size; AVCodecContext *enc; int frame_number, vid, i; double bitrate; double speed; int64_t pts = INT64_MIN + 1; static int64_t last_time = -1; static int qp_histogram[52]; int hours, mins, secs, us; float t; if (!print_stats && !is_last_report && !progress_avio) return; if (!is_last_report) { if (last_time == -1) { last_time = cur_time; return; } if ((cur_time - last_time) < 500000) return; last_time = cur_time; } t = (cur_time-timer_start) / 1000000.0; oc = output_files[0]->ctx; total_size = avio_size(oc->pb); if (total_size <= 0) // FIXME improve avio_size() so it works with non seekable output too total_size = avio_tell(oc->pb); buf[0] = '\0'; vid = 0; av_bprint_init(&buf_script, 0, 1); for (i = 0; i < nb_output_streams; i++) { float q = -1; ost = output_streams[i]; enc = ost->enc_ctx; if (!ost->stream_copy) q = ost->quality / (float) FF_QP2LAMBDA; if (vid && enc->codec_type == AVMEDIA_TYPE_VIDEO) { snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "q=%2.1f ", q); av_bprintf(&buf_script, "stream_%d_%d_q=%.1f\n", ost->file_index, ost->index, q); } if (!vid && enc->codec_type == AVMEDIA_TYPE_VIDEO) { float fps; frame_number = ost->frame_number; fps = t > 1 ? frame_number / t : 0; snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "frame=%5d fps=%3.*f q=%3.1f ", frame_number, fps < 9.95, fps, q); av_bprintf(&buf_script, "frame=%d\n", frame_number); av_bprintf(&buf_script, "fps=%.1f\n", fps); av_bprintf(&buf_script, "stream_%d_%d_q=%.1f\n", ost->file_index, ost->index, q); if (is_last_report) snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "L"); if (qp_hist) { int j; int qp = lrintf(q); if (qp >= 0 && qp < FF_ARRAY_ELEMS(qp_histogram)) qp_histogram[qp]++; for (j = 0; j < 32; j++) snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%X", (int)lrintf(log2(qp_histogram[j] + 1))); } if ((enc->flags & AV_CODEC_FLAG_PSNR) && (ost->pict_type != AV_PICTURE_TYPE_NONE || is_last_report)) { int j; double error, error_sum = 0; double scale, scale_sum = 0; double p; char type[3] = { 'Y','U','V' }; snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "PSNR="); for (j = 0; j < 3; j++) { if (is_last_report) { error = enc->error[j]; scale = enc->width * enc->height * 255.0 * 255.0 * frame_number; } else { error = ost->error[j]; scale = enc->width * enc->height * 255.0 * 255.0; } if (j) scale /= 4; error_sum += error; scale_sum += scale; p = psnr(error / scale); snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%c:%2.2f ", type[j], p); av_bprintf(&buf_script, "stream_%d_%d_psnr_%c=%2.2f\n", ost->file_index, ost->index, type[j] | 32, p); } p = psnr(error_sum / scale_sum); snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "*:%2.2f ", psnr(error_sum / scale_sum)); av_bprintf(&buf_script, "stream_%d_%d_psnr_all=%2.2f\n", ost->file_index, ost->index, p); } vid = 1; } /* compute min output value */ if (av_stream_get_end_pts(ost->st) != AV_NOPTS_VALUE) pts = FFMAX(pts, av_rescale_q(av_stream_get_end_pts(ost->st), ost->st->time_base, AV_TIME_BASE_Q)); if (is_last_report) nb_frames_drop += ost->last_dropped; } secs = FFABS(pts) / AV_TIME_BASE; us = FFABS(pts) % AV_TIME_BASE; mins = secs / 60; secs %= 60; hours = mins / 60; mins %= 60; bitrate = pts && total_size >= 0 ? total_size * 8 / (pts / 1000.0) : -1; speed = t != 0.0 ? (double)pts / AV_TIME_BASE / t : -1; if (total_size < 0) snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "size=N/A time="); else snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "size=%8.0fkB time=", total_size / 1024.0); if (pts < 0) snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "-"); snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%02d:%02d:%02d.%02d ", hours, mins, secs, (100 * us) / AV_TIME_BASE); if (bitrate < 0) { snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),"bitrate=N/A"); av_bprintf(&buf_script, "bitrate=N/A\n"); }else{ snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),"bitrate=%6.1fkbits/s", bitrate); av_bprintf(&buf_script, "bitrate=%6.1fkbits/s\n", bitrate); } if (total_size < 0) av_bprintf(&buf_script, "total_size=N/A\n"); else av_bprintf(&buf_script, "total_size=%"PRId64"\n", total_size); av_bprintf(&buf_script, "out_time_ms=%"PRId64"\n", pts); av_bprintf(&buf_script, "out_time=%02d:%02d:%02d.%06d\n", hours, mins, secs, us); if (nb_frames_dup || nb_frames_drop) snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " dup=%d drop=%d", nb_frames_dup, nb_frames_drop); av_bprintf(&buf_script, "dup_frames=%d\n", nb_frames_dup); av_bprintf(&buf_script, "drop_frames=%d\n", nb_frames_drop); if (speed < 0) { snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf)," speed=N/A"); av_bprintf(&buf_script, "speed=N/A\n"); } else { snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf)," speed=%4.3gx", speed); av_bprintf(&buf_script, "speed=%4.3gx\n", speed); } if (print_stats || is_last_report) { const char end = is_last_report ? '\n' : '\r'; if (print_stats==1 && AV_LOG_INFO > av_log_get_level()) { fprintf(stderr, "%s %c", buf, end); } else av_log(NULL, AV_LOG_INFO, "%s %c", buf, end); fflush(stderr); } if (progress_avio) { av_bprintf(&buf_script, "progress=%s\n", is_last_report ? "end" : "continue"); avio_write(progress_avio, buf_script.str, FFMIN(buf_script.len, buf_script.size - 1)); avio_flush(progress_avio); av_bprint_finalize(&buf_script, NULL); if (is_last_report) { avio_closep(&progress_avio); } } if (is_last_report) print_final_stats(total_size); }
true
FFmpeg
a956840cbcf89d709c4bd5980808ac0b5c8aeedf
static void print_report(int is_last_report, int64_t timer_start, int64_t cur_time) { char buf[1024]; AVBPrint buf_script; OutputStream *ost; AVFormatContext *oc; int64_t total_size; AVCodecContext *enc; int frame_number, vid, i; double bitrate; double speed; int64_t pts = INT64_MIN + 1; static int64_t last_time = -1; static int qp_histogram[52]; int hours, mins, secs, us; float t; if (!print_stats && !is_last_report && !progress_avio) return; if (!is_last_report) { if (last_time == -1) { last_time = cur_time; return; } if ((cur_time - last_time) < 500000) return; last_time = cur_time; } t = (cur_time-timer_start) / 1000000.0; oc = output_files[0]->ctx; total_size = avio_size(oc->pb); if (total_size <= 0) total_size = avio_tell(oc->pb); buf[0] = '\0'; vid = 0; av_bprint_init(&buf_script, 0, 1); for (i = 0; i < nb_output_streams; i++) { float q = -1; ost = output_streams[i]; enc = ost->enc_ctx; if (!ost->stream_copy) q = ost->quality / (float) FF_QP2LAMBDA; if (vid && enc->codec_type == AVMEDIA_TYPE_VIDEO) { snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "q=%2.1f ", q); av_bprintf(&buf_script, "stream_%d_%d_q=%.1f\n", ost->file_index, ost->index, q); } if (!vid && enc->codec_type == AVMEDIA_TYPE_VIDEO) { float fps; frame_number = ost->frame_number; fps = t > 1 ? frame_number / t : 0; snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "frame=%5d fps=%3.*f q=%3.1f ", frame_number, fps < 9.95, fps, q); av_bprintf(&buf_script, "frame=%d\n", frame_number); av_bprintf(&buf_script, "fps=%.1f\n", fps); av_bprintf(&buf_script, "stream_%d_%d_q=%.1f\n", ost->file_index, ost->index, q); if (is_last_report) snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "L"); if (qp_hist) { int j; int qp = lrintf(q); if (qp >= 0 && qp < FF_ARRAY_ELEMS(qp_histogram)) qp_histogram[qp]++; for (j = 0; j < 32; j++) snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%X", (int)lrintf(log2(qp_histogram[j] + 1))); } if ((enc->flags & AV_CODEC_FLAG_PSNR) && (ost->pict_type != AV_PICTURE_TYPE_NONE || is_last_report)) { int j; double error, error_sum = 0; double scale, scale_sum = 0; double p; char type[3] = { 'Y','U','V' }; snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "PSNR="); for (j = 0; j < 3; j++) { if (is_last_report) { error = enc->error[j]; scale = enc->width * enc->height * 255.0 * 255.0 * frame_number; } else { error = ost->error[j]; scale = enc->width * enc->height * 255.0 * 255.0; } if (j) scale /= 4; error_sum += error; scale_sum += scale; p = psnr(error / scale); snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%c:%2.2f ", type[j], p); av_bprintf(&buf_script, "stream_%d_%d_psnr_%c=%2.2f\n", ost->file_index, ost->index, type[j] | 32, p); } p = psnr(error_sum / scale_sum); snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "*:%2.2f ", psnr(error_sum / scale_sum)); av_bprintf(&buf_script, "stream_%d_%d_psnr_all=%2.2f\n", ost->file_index, ost->index, p); } vid = 1; } if (av_stream_get_end_pts(ost->st) != AV_NOPTS_VALUE) pts = FFMAX(pts, av_rescale_q(av_stream_get_end_pts(ost->st), ost->st->time_base, AV_TIME_BASE_Q)); if (is_last_report) nb_frames_drop += ost->last_dropped; } secs = FFABS(pts) / AV_TIME_BASE; us = FFABS(pts) % AV_TIME_BASE; mins = secs / 60; secs %= 60; hours = mins / 60; mins %= 60; bitrate = pts && total_size >= 0 ? total_size * 8 / (pts / 1000.0) : -1; speed = t != 0.0 ? (double)pts / AV_TIME_BASE / t : -1; if (total_size < 0) snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "size=N/A time="); else snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "size=%8.0fkB time=", total_size / 1024.0); if (pts < 0) snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "-"); snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%02d:%02d:%02d.%02d ", hours, mins, secs, (100 * us) / AV_TIME_BASE); if (bitrate < 0) { snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),"bitrate=N/A"); av_bprintf(&buf_script, "bitrate=N/A\n"); }else{ snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),"bitrate=%6.1fkbits/s", bitrate); av_bprintf(&buf_script, "bitrate=%6.1fkbits/s\n", bitrate); } if (total_size < 0) av_bprintf(&buf_script, "total_size=N/A\n"); else av_bprintf(&buf_script, "total_size=%"PRId64"\n", total_size); av_bprintf(&buf_script, "out_time_ms=%"PRId64"\n", pts); av_bprintf(&buf_script, "out_time=%02d:%02d:%02d.%06d\n", hours, mins, secs, us); if (nb_frames_dup || nb_frames_drop) snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " dup=%d drop=%d", nb_frames_dup, nb_frames_drop); av_bprintf(&buf_script, "dup_frames=%d\n", nb_frames_dup); av_bprintf(&buf_script, "drop_frames=%d\n", nb_frames_drop); if (speed < 0) { snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf)," speed=N/A"); av_bprintf(&buf_script, "speed=N/A\n"); } else { snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf)," speed=%4.3gx", speed); av_bprintf(&buf_script, "speed=%4.3gx\n", speed); } if (print_stats || is_last_report) { const char end = is_last_report ? '\n' : '\r'; if (print_stats==1 && AV_LOG_INFO > av_log_get_level()) { fprintf(stderr, "%s %c", buf, end); } else av_log(NULL, AV_LOG_INFO, "%s %c", buf, end); fflush(stderr); } if (progress_avio) { av_bprintf(&buf_script, "progress=%s\n", is_last_report ? "end" : "continue"); avio_write(progress_avio, buf_script.str, FFMIN(buf_script.len, buf_script.size - 1)); avio_flush(progress_avio); av_bprint_finalize(&buf_script, NULL); if (is_last_report) { avio_closep(&progress_avio); } } if (is_last_report) print_final_stats(total_size); }
{ "code": [ " avio_closep(&progress_avio);" ], "line_no": [ 363 ] }
static void FUNC_0(int VAR_0, int64_t VAR_1, int64_t VAR_2) { char VAR_3[1024]; AVBPrint buf_script; OutputStream *ost; AVFormatContext *oc; int64_t total_size; AVCodecContext *enc; int VAR_4, VAR_5, VAR_6; double VAR_7; double VAR_8; int64_t pts = INT64_MIN + 1; static int64_t VAR_9 = -1; static int VAR_10[52]; int VAR_11, VAR_12, VAR_13, VAR_14; float VAR_15; if (!print_stats && !VAR_0 && !progress_avio) return; if (!VAR_0) { if (VAR_9 == -1) { VAR_9 = VAR_2; return; } if ((VAR_2 - VAR_9) < 500000) return; VAR_9 = VAR_2; } VAR_15 = (VAR_2-VAR_1) / 1000000.0; oc = output_files[0]->ctx; total_size = avio_size(oc->pb); if (total_size <= 0) total_size = avio_tell(oc->pb); VAR_3[0] = '\0'; VAR_5 = 0; av_bprint_init(&buf_script, 0, 1); for (VAR_6 = 0; VAR_6 < nb_output_streams; VAR_6++) { float q = -1; ost = output_streams[VAR_6]; enc = ost->enc_ctx; if (!ost->stream_copy) q = ost->quality / (float) FF_QP2LAMBDA; if (VAR_5 && enc->codec_type == AVMEDIA_TYPE_VIDEO) { snprintf(VAR_3 + strlen(VAR_3), sizeof(VAR_3) - strlen(VAR_3), "q=%2.1f ", q); av_bprintf(&buf_script, "stream_%d_%d_q=%.1f\n", ost->file_index, ost->index, q); } if (!VAR_5 && enc->codec_type == AVMEDIA_TYPE_VIDEO) { float fps; VAR_4 = ost->VAR_4; fps = VAR_15 > 1 ? VAR_4 / VAR_15 : 0; snprintf(VAR_3 + strlen(VAR_3), sizeof(VAR_3) - strlen(VAR_3), "frame=%5d fps=%3.*f q=%3.1f ", VAR_4, fps < 9.95, fps, q); av_bprintf(&buf_script, "frame=%d\n", VAR_4); av_bprintf(&buf_script, "fps=%.1f\n", fps); av_bprintf(&buf_script, "stream_%d_%d_q=%.1f\n", ost->file_index, ost->index, q); if (VAR_0) snprintf(VAR_3 + strlen(VAR_3), sizeof(VAR_3) - strlen(VAR_3), "L"); if (qp_hist) { int j; int qp = lrintf(q); if (qp >= 0 && qp < FF_ARRAY_ELEMS(VAR_10)) VAR_10[qp]++; for (j = 0; j < 32; j++) snprintf(VAR_3 + strlen(VAR_3), sizeof(VAR_3) - strlen(VAR_3), "%X", (int)lrintf(log2(VAR_10[j] + 1))); } if ((enc->flags & AV_CODEC_FLAG_PSNR) && (ost->pict_type != AV_PICTURE_TYPE_NONE || VAR_0)) { int j; double error, error_sum = 0; double scale, scale_sum = 0; double p; char type[3] = { 'Y','U','V' }; snprintf(VAR_3 + strlen(VAR_3), sizeof(VAR_3) - strlen(VAR_3), "PSNR="); for (j = 0; j < 3; j++) { if (VAR_0) { error = enc->error[j]; scale = enc->width * enc->height * 255.0 * 255.0 * VAR_4; } else { error = ost->error[j]; scale = enc->width * enc->height * 255.0 * 255.0; } if (j) scale /= 4; error_sum += error; scale_sum += scale; p = psnr(error / scale); snprintf(VAR_3 + strlen(VAR_3), sizeof(VAR_3) - strlen(VAR_3), "%c:%2.2f ", type[j], p); av_bprintf(&buf_script, "stream_%d_%d_psnr_%c=%2.2f\n", ost->file_index, ost->index, type[j] | 32, p); } p = psnr(error_sum / scale_sum); snprintf(VAR_3 + strlen(VAR_3), sizeof(VAR_3) - strlen(VAR_3), "*:%2.2f ", psnr(error_sum / scale_sum)); av_bprintf(&buf_script, "stream_%d_%d_psnr_all=%2.2f\n", ost->file_index, ost->index, p); } VAR_5 = 1; } if (av_stream_get_end_pts(ost->st) != AV_NOPTS_VALUE) pts = FFMAX(pts, av_rescale_q(av_stream_get_end_pts(ost->st), ost->st->time_base, AV_TIME_BASE_Q)); if (VAR_0) nb_frames_drop += ost->last_dropped; } VAR_13 = FFABS(pts) / AV_TIME_BASE; VAR_14 = FFABS(pts) % AV_TIME_BASE; VAR_12 = VAR_13 / 60; VAR_13 %= 60; VAR_11 = VAR_12 / 60; VAR_12 %= 60; VAR_7 = pts && total_size >= 0 ? total_size * 8 / (pts / 1000.0) : -1; VAR_8 = VAR_15 != 0.0 ? (double)pts / AV_TIME_BASE / VAR_15 : -1; if (total_size < 0) snprintf(VAR_3 + strlen(VAR_3), sizeof(VAR_3) - strlen(VAR_3), "size=N/A time="); else snprintf(VAR_3 + strlen(VAR_3), sizeof(VAR_3) - strlen(VAR_3), "size=%8.0fkB time=", total_size / 1024.0); if (pts < 0) snprintf(VAR_3 + strlen(VAR_3), sizeof(VAR_3) - strlen(VAR_3), "-"); snprintf(VAR_3 + strlen(VAR_3), sizeof(VAR_3) - strlen(VAR_3), "%02d:%02d:%02d.%02d ", VAR_11, VAR_12, VAR_13, (100 * VAR_14) / AV_TIME_BASE); if (VAR_7 < 0) { snprintf(VAR_3 + strlen(VAR_3), sizeof(VAR_3) - strlen(VAR_3),"VAR_7=N/A"); av_bprintf(&buf_script, "VAR_7=N/A\n"); }else{ snprintf(VAR_3 + strlen(VAR_3), sizeof(VAR_3) - strlen(VAR_3),"VAR_7=%6.1fkbits/s", VAR_7); av_bprintf(&buf_script, "VAR_7=%6.1fkbits/s\n", VAR_7); } if (total_size < 0) av_bprintf(&buf_script, "total_size=N/A\n"); else av_bprintf(&buf_script, "total_size=%"PRId64"\n", total_size); av_bprintf(&buf_script, "out_time_ms=%"PRId64"\n", pts); av_bprintf(&buf_script, "out_time=%02d:%02d:%02d.%06d\n", VAR_11, VAR_12, VAR_13, VAR_14); if (nb_frames_dup || nb_frames_drop) snprintf(VAR_3 + strlen(VAR_3), sizeof(VAR_3) - strlen(VAR_3), " dup=%d drop=%d", nb_frames_dup, nb_frames_drop); av_bprintf(&buf_script, "dup_frames=%d\n", nb_frames_dup); av_bprintf(&buf_script, "drop_frames=%d\n", nb_frames_drop); if (VAR_8 < 0) { snprintf(VAR_3 + strlen(VAR_3), sizeof(VAR_3) - strlen(VAR_3)," VAR_8=N/A"); av_bprintf(&buf_script, "VAR_8=N/A\n"); } else { snprintf(VAR_3 + strlen(VAR_3), sizeof(VAR_3) - strlen(VAR_3)," VAR_8=%4.3gx", VAR_8); av_bprintf(&buf_script, "VAR_8=%4.3gx\n", VAR_8); } if (print_stats || VAR_0) { const char VAR_16 = VAR_0 ? '\n' : '\r'; if (print_stats==1 && AV_LOG_INFO > av_log_get_level()) { fprintf(stderr, "%s %c", VAR_3, VAR_16); } else av_log(NULL, AV_LOG_INFO, "%s %c", VAR_3, VAR_16); fflush(stderr); } if (progress_avio) { av_bprintf(&buf_script, "progress=%s\n", VAR_0 ? "VAR_16" : "continue"); avio_write(progress_avio, buf_script.str, FFMIN(buf_script.len, buf_script.size - 1)); avio_flush(progress_avio); av_bprint_finalize(&buf_script, NULL); if (VAR_0) { avio_closep(&progress_avio); } } if (VAR_0) print_final_stats(total_size); }
[ "static void FUNC_0(int VAR_0, int64_t VAR_1, int64_t VAR_2)\n{", "char VAR_3[1024];", "AVBPrint buf_script;", "OutputStream *ost;", "AVFormatContext *oc;", "int64_t total_size;", "AVCodecContext *enc;", "int VAR_4, VAR_5, VAR_6;", "double VAR_7;", "double VAR_8;", "int64_t pts = INT64_MIN + 1;", "static int64_t VAR_9 = -1;", "static int VAR_10[52];", "int VAR_11, VAR_12, VAR_13, VAR_14;", "float VAR_15;", "if (!print_stats && !VAR_0 && !progress_avio)\nreturn;", "if (!VAR_0) {", "if (VAR_9 == -1) {", "VAR_9 = VAR_2;", "return;", "}", "if ((VAR_2 - VAR_9) < 500000)\nreturn;", "VAR_9 = VAR_2;", "}", "VAR_15 = (VAR_2-VAR_1) / 1000000.0;", "oc = output_files[0]->ctx;", "total_size = avio_size(oc->pb);", "if (total_size <= 0)\ntotal_size = avio_tell(oc->pb);", "VAR_3[0] = '\\0';", "VAR_5 = 0;", "av_bprint_init(&buf_script, 0, 1);", "for (VAR_6 = 0; VAR_6 < nb_output_streams; VAR_6++) {", "float q = -1;", "ost = output_streams[VAR_6];", "enc = ost->enc_ctx;", "if (!ost->stream_copy)\nq = ost->quality / (float) FF_QP2LAMBDA;", "if (VAR_5 && enc->codec_type == AVMEDIA_TYPE_VIDEO) {", "snprintf(VAR_3 + strlen(VAR_3), sizeof(VAR_3) - strlen(VAR_3), \"q=%2.1f \", q);", "av_bprintf(&buf_script, \"stream_%d_%d_q=%.1f\\n\",\nost->file_index, ost->index, q);", "}", "if (!VAR_5 && enc->codec_type == AVMEDIA_TYPE_VIDEO) {", "float fps;", "VAR_4 = ost->VAR_4;", "fps = VAR_15 > 1 ? VAR_4 / VAR_15 : 0;", "snprintf(VAR_3 + strlen(VAR_3), sizeof(VAR_3) - strlen(VAR_3), \"frame=%5d fps=%3.*f q=%3.1f \",\nVAR_4, fps < 9.95, fps, q);", "av_bprintf(&buf_script, \"frame=%d\\n\", VAR_4);", "av_bprintf(&buf_script, \"fps=%.1f\\n\", fps);", "av_bprintf(&buf_script, \"stream_%d_%d_q=%.1f\\n\",\nost->file_index, ost->index, q);", "if (VAR_0)\nsnprintf(VAR_3 + strlen(VAR_3), sizeof(VAR_3) - strlen(VAR_3), \"L\");", "if (qp_hist) {", "int j;", "int qp = lrintf(q);", "if (qp >= 0 && qp < FF_ARRAY_ELEMS(VAR_10))\nVAR_10[qp]++;", "for (j = 0; j < 32; j++)", "snprintf(VAR_3 + strlen(VAR_3), sizeof(VAR_3) - strlen(VAR_3), \"%X\", (int)lrintf(log2(VAR_10[j] + 1)));", "}", "if ((enc->flags & AV_CODEC_FLAG_PSNR) && (ost->pict_type != AV_PICTURE_TYPE_NONE || VAR_0)) {", "int j;", "double error, error_sum = 0;", "double scale, scale_sum = 0;", "double p;", "char type[3] = { 'Y','U','V' };", "snprintf(VAR_3 + strlen(VAR_3), sizeof(VAR_3) - strlen(VAR_3), \"PSNR=\");", "for (j = 0; j < 3; j++) {", "if (VAR_0) {", "error = enc->error[j];", "scale = enc->width * enc->height * 255.0 * 255.0 * VAR_4;", "} else {", "error = ost->error[j];", "scale = enc->width * enc->height * 255.0 * 255.0;", "}", "if (j)\nscale /= 4;", "error_sum += error;", "scale_sum += scale;", "p = psnr(error / scale);", "snprintf(VAR_3 + strlen(VAR_3), sizeof(VAR_3) - strlen(VAR_3), \"%c:%2.2f \", type[j], p);", "av_bprintf(&buf_script, \"stream_%d_%d_psnr_%c=%2.2f\\n\",\nost->file_index, ost->index, type[j] | 32, p);", "}", "p = psnr(error_sum / scale_sum);", "snprintf(VAR_3 + strlen(VAR_3), sizeof(VAR_3) - strlen(VAR_3), \"*:%2.2f \", psnr(error_sum / scale_sum));", "av_bprintf(&buf_script, \"stream_%d_%d_psnr_all=%2.2f\\n\",\nost->file_index, ost->index, p);", "}", "VAR_5 = 1;", "}", "if (av_stream_get_end_pts(ost->st) != AV_NOPTS_VALUE)\npts = FFMAX(pts, av_rescale_q(av_stream_get_end_pts(ost->st),\nost->st->time_base, AV_TIME_BASE_Q));", "if (VAR_0)\nnb_frames_drop += ost->last_dropped;", "}", "VAR_13 = FFABS(pts) / AV_TIME_BASE;", "VAR_14 = FFABS(pts) % AV_TIME_BASE;", "VAR_12 = VAR_13 / 60;", "VAR_13 %= 60;", "VAR_11 = VAR_12 / 60;", "VAR_12 %= 60;", "VAR_7 = pts && total_size >= 0 ? total_size * 8 / (pts / 1000.0) : -1;", "VAR_8 = VAR_15 != 0.0 ? (double)pts / AV_TIME_BASE / VAR_15 : -1;", "if (total_size < 0) snprintf(VAR_3 + strlen(VAR_3), sizeof(VAR_3) - strlen(VAR_3),\n\"size=N/A time=\");", "else snprintf(VAR_3 + strlen(VAR_3), sizeof(VAR_3) - strlen(VAR_3),\n\"size=%8.0fkB time=\", total_size / 1024.0);", "if (pts < 0)\nsnprintf(VAR_3 + strlen(VAR_3), sizeof(VAR_3) - strlen(VAR_3), \"-\");", "snprintf(VAR_3 + strlen(VAR_3), sizeof(VAR_3) - strlen(VAR_3),\n\"%02d:%02d:%02d.%02d \", VAR_11, VAR_12, VAR_13,\n(100 * VAR_14) / AV_TIME_BASE);", "if (VAR_7 < 0) {", "snprintf(VAR_3 + strlen(VAR_3), sizeof(VAR_3) - strlen(VAR_3),\"VAR_7=N/A\");", "av_bprintf(&buf_script, \"VAR_7=N/A\\n\");", "}else{", "snprintf(VAR_3 + strlen(VAR_3), sizeof(VAR_3) - strlen(VAR_3),\"VAR_7=%6.1fkbits/s\", VAR_7);", "av_bprintf(&buf_script, \"VAR_7=%6.1fkbits/s\\n\", VAR_7);", "}", "if (total_size < 0) av_bprintf(&buf_script, \"total_size=N/A\\n\");", "else av_bprintf(&buf_script, \"total_size=%\"PRId64\"\\n\", total_size);", "av_bprintf(&buf_script, \"out_time_ms=%\"PRId64\"\\n\", pts);", "av_bprintf(&buf_script, \"out_time=%02d:%02d:%02d.%06d\\n\",\nVAR_11, VAR_12, VAR_13, VAR_14);", "if (nb_frames_dup || nb_frames_drop)\nsnprintf(VAR_3 + strlen(VAR_3), sizeof(VAR_3) - strlen(VAR_3), \" dup=%d drop=%d\",\nnb_frames_dup, nb_frames_drop);", "av_bprintf(&buf_script, \"dup_frames=%d\\n\", nb_frames_dup);", "av_bprintf(&buf_script, \"drop_frames=%d\\n\", nb_frames_drop);", "if (VAR_8 < 0) {", "snprintf(VAR_3 + strlen(VAR_3), sizeof(VAR_3) - strlen(VAR_3),\" VAR_8=N/A\");", "av_bprintf(&buf_script, \"VAR_8=N/A\\n\");", "} else {", "snprintf(VAR_3 + strlen(VAR_3), sizeof(VAR_3) - strlen(VAR_3),\" VAR_8=%4.3gx\", VAR_8);", "av_bprintf(&buf_script, \"VAR_8=%4.3gx\\n\", VAR_8);", "}", "if (print_stats || VAR_0) {", "const char VAR_16 = VAR_0 ? '\\n' : '\\r';", "if (print_stats==1 && AV_LOG_INFO > av_log_get_level()) {", "fprintf(stderr, \"%s %c\", VAR_3, VAR_16);", "} else", "av_log(NULL, AV_LOG_INFO, \"%s %c\", VAR_3, VAR_16);", "fflush(stderr);", "}", "if (progress_avio) {", "av_bprintf(&buf_script, \"progress=%s\\n\",\nVAR_0 ? \"VAR_16\" : \"continue\");", "avio_write(progress_avio, buf_script.str,\nFFMIN(buf_script.len, buf_script.size - 1));", "avio_flush(progress_avio);", "av_bprint_finalize(&buf_script, NULL);", "if (VAR_0) {", "avio_closep(&progress_avio);", "}", "}", "if (VAR_0)\nprint_final_stats(total_size);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35, 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51, 53 ], [ 55 ], [ 57 ], [ 61 ], [ 67 ], [ 71 ], [ 73, 75 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93, 95 ], [ 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 ], [ 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 ], [ 217, 219, 221 ], [ 223, 225 ], [ 227 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 245 ], [ 247 ], [ 251, 253 ], [ 255, 257 ], [ 259, 261 ], [ 263, 265, 267 ], [ 271 ], [ 273 ], [ 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 287 ], [ 289 ], [ 291 ], [ 293, 295 ], [ 299, 301, 303 ], [ 305 ], [ 307 ], [ 311 ], [ 313 ], [ 315 ], [ 317 ], [ 319 ], [ 321 ], [ 323 ], [ 327 ], [ 329 ], [ 331 ], [ 333 ], [ 335 ], [ 337 ], [ 341 ], [ 343 ], [ 347 ], [ 349, 351 ], [ 353, 355 ], [ 357 ], [ 359 ], [ 361 ], [ 363 ], [ 365 ], [ 367 ], [ 371, 373 ], [ 375 ] ]
18,775
static int htab_load(QEMUFile *f, void *opaque, int version_id) { sPAPRMachineState *spapr = opaque; uint32_t section_hdr; int fd = -1; if (version_id < 1 || version_id > 1) { error_report("htab_load() bad version"); return -EINVAL; } section_hdr = qemu_get_be32(f); if (section_hdr) { Error *local_err; /* First section gives the htab size */ spapr_reallocate_hpt(spapr, section_hdr, &local_err); if (local_err) { error_report_err(local_err); return -EINVAL; } return 0; } if (!spapr->htab) { assert(kvm_enabled()); fd = kvmppc_get_htab_fd(true); if (fd < 0) { error_report("Unable to open fd to restore KVM hash table: %s", strerror(errno)); } } while (true) { uint32_t index; uint16_t n_valid, n_invalid; index = qemu_get_be32(f); n_valid = qemu_get_be16(f); n_invalid = qemu_get_be16(f); if ((index == 0) && (n_valid == 0) && (n_invalid == 0)) { /* End of Stream */ break; } if ((index + n_valid + n_invalid) > (HTAB_SIZE(spapr) / HASH_PTE_SIZE_64)) { /* Bad index in stream */ error_report( "htab_load() bad index %d (%hd+%hd entries) in htab stream (htab_shift=%d)", index, n_valid, n_invalid, spapr->htab_shift); return -EINVAL; } if (spapr->htab) { if (n_valid) { qemu_get_buffer(f, HPTE(spapr->htab, index), HASH_PTE_SIZE_64 * n_valid); } if (n_invalid) { memset(HPTE(spapr->htab, index + n_valid), 0, HASH_PTE_SIZE_64 * n_invalid); } } else { int rc; assert(fd >= 0); rc = kvmppc_load_htab_chunk(f, fd, index, n_valid, n_invalid); if (rc < 0) { return rc; } } } if (!spapr->htab) { assert(fd >= 0); close(fd); } return 0; }
true
qemu
9897e462645fb8d91a4cef2a1ea3a74cc9149c13
static int htab_load(QEMUFile *f, void *opaque, int version_id) { sPAPRMachineState *spapr = opaque; uint32_t section_hdr; int fd = -1; if (version_id < 1 || version_id > 1) { error_report("htab_load() bad version"); return -EINVAL; } section_hdr = qemu_get_be32(f); if (section_hdr) { Error *local_err; spapr_reallocate_hpt(spapr, section_hdr, &local_err); if (local_err) { error_report_err(local_err); return -EINVAL; } return 0; } if (!spapr->htab) { assert(kvm_enabled()); fd = kvmppc_get_htab_fd(true); if (fd < 0) { error_report("Unable to open fd to restore KVM hash table: %s", strerror(errno)); } } while (true) { uint32_t index; uint16_t n_valid, n_invalid; index = qemu_get_be32(f); n_valid = qemu_get_be16(f); n_invalid = qemu_get_be16(f); if ((index == 0) && (n_valid == 0) && (n_invalid == 0)) { break; } if ((index + n_valid + n_invalid) > (HTAB_SIZE(spapr) / HASH_PTE_SIZE_64)) { error_report( "htab_load() bad index %d (%hd+%hd entries) in htab stream (htab_shift=%d)", index, n_valid, n_invalid, spapr->htab_shift); return -EINVAL; } if (spapr->htab) { if (n_valid) { qemu_get_buffer(f, HPTE(spapr->htab, index), HASH_PTE_SIZE_64 * n_valid); } if (n_invalid) { memset(HPTE(spapr->htab, index + n_valid), 0, HASH_PTE_SIZE_64 * n_invalid); } } else { int rc; assert(fd >= 0); rc = kvmppc_load_htab_chunk(f, fd, index, n_valid, n_invalid); if (rc < 0) { return rc; } } } if (!spapr->htab) { assert(fd >= 0); close(fd); } return 0; }
{ "code": [ " Error *local_err;" ], "line_no": [ 29 ] }
static int FUNC_0(QEMUFile *VAR_0, void *VAR_1, int VAR_2) { sPAPRMachineState *spapr = VAR_1; uint32_t section_hdr; int VAR_3 = -1; if (VAR_2 < 1 || VAR_2 > 1) { error_report("FUNC_0() bad version"); return -EINVAL; } section_hdr = qemu_get_be32(VAR_0); if (section_hdr) { Error *local_err; spapr_reallocate_hpt(spapr, section_hdr, &local_err); if (local_err) { error_report_err(local_err); return -EINVAL; } return 0; } if (!spapr->htab) { assert(kvm_enabled()); VAR_3 = kvmppc_get_htab_fd(true); if (VAR_3 < 0) { error_report("Unable to open VAR_3 to restore KVM hash table: %s", strerror(errno)); } } while (true) { uint32_t index; uint16_t n_valid, n_invalid; index = qemu_get_be32(VAR_0); n_valid = qemu_get_be16(VAR_0); n_invalid = qemu_get_be16(VAR_0); if ((index == 0) && (n_valid == 0) && (n_invalid == 0)) { break; } if ((index + n_valid + n_invalid) > (HTAB_SIZE(spapr) / HASH_PTE_SIZE_64)) { error_report( "FUNC_0() bad index %d (%hd+%hd entries) in htab stream (htab_shift=%d)", index, n_valid, n_invalid, spapr->htab_shift); return -EINVAL; } if (spapr->htab) { if (n_valid) { qemu_get_buffer(VAR_0, HPTE(spapr->htab, index), HASH_PTE_SIZE_64 * n_valid); } if (n_invalid) { memset(HPTE(spapr->htab, index + n_valid), 0, HASH_PTE_SIZE_64 * n_invalid); } } else { int VAR_4; assert(VAR_3 >= 0); VAR_4 = kvmppc_load_htab_chunk(VAR_0, VAR_3, index, n_valid, n_invalid); if (VAR_4 < 0) { return VAR_4; } } } if (!spapr->htab) { assert(VAR_3 >= 0); close(VAR_3); } return 0; }
[ "static int FUNC_0(QEMUFile *VAR_0, void *VAR_1, int VAR_2)\n{", "sPAPRMachineState *spapr = VAR_1;", "uint32_t section_hdr;", "int VAR_3 = -1;", "if (VAR_2 < 1 || VAR_2 > 1) {", "error_report(\"FUNC_0() bad version\");", "return -EINVAL;", "}", "section_hdr = qemu_get_be32(VAR_0);", "if (section_hdr) {", "Error *local_err;", "spapr_reallocate_hpt(spapr, section_hdr, &local_err);", "if (local_err) {", "error_report_err(local_err);", "return -EINVAL;", "}", "return 0;", "}", "if (!spapr->htab) {", "assert(kvm_enabled());", "VAR_3 = kvmppc_get_htab_fd(true);", "if (VAR_3 < 0) {", "error_report(\"Unable to open VAR_3 to restore KVM hash table: %s\",\nstrerror(errno));", "}", "}", "while (true) {", "uint32_t index;", "uint16_t n_valid, n_invalid;", "index = qemu_get_be32(VAR_0);", "n_valid = qemu_get_be16(VAR_0);", "n_invalid = qemu_get_be16(VAR_0);", "if ((index == 0) && (n_valid == 0) && (n_invalid == 0)) {", "break;", "}", "if ((index + n_valid + n_invalid) >\n(HTAB_SIZE(spapr) / HASH_PTE_SIZE_64)) {", "error_report(\n\"FUNC_0() bad index %d (%hd+%hd entries) in htab stream (htab_shift=%d)\",\nindex, n_valid, n_invalid, spapr->htab_shift);", "return -EINVAL;", "}", "if (spapr->htab) {", "if (n_valid) {", "qemu_get_buffer(VAR_0, HPTE(spapr->htab, index),\nHASH_PTE_SIZE_64 * n_valid);", "}", "if (n_invalid) {", "memset(HPTE(spapr->htab, index + n_valid), 0,\nHASH_PTE_SIZE_64 * n_invalid);", "}", "} else {", "int VAR_4;", "assert(VAR_3 >= 0);", "VAR_4 = kvmppc_load_htab_chunk(VAR_0, VAR_3, index, n_valid, n_invalid);", "if (VAR_4 < 0) {", "return VAR_4;", "}", "}", "}", "if (!spapr->htab) {", "assert(VAR_3 >= 0);", "close(VAR_3);", "}", "return 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 27 ], [ 29 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61, 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ], [ 83 ], [ 87 ], [ 91 ], [ 93 ], [ 97, 99 ], [ 103, 105, 107 ], [ 109 ], [ 111 ], [ 115 ], [ 117 ], [ 119, 121 ], [ 123 ], [ 125 ], [ 127, 129 ], [ 131 ], [ 133 ], [ 135 ], [ 139 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 167 ], [ 169 ] ]
18,777
static av_cold void dump_enc_cfg(AVCodecContext *avctx, const struct vpx_codec_enc_cfg *cfg) { int width = -30; int level = AV_LOG_DEBUG; av_log(avctx, level, "vpx_codec_enc_cfg\n"); av_log(avctx, level, "generic settings\n" " %*s%u\n %*s%u\n %*s%u\n %*s%u\n %*s%u\n" #if CONFIG_LIBVPX_VP9_ENCODER && defined(VPX_IMG_FMT_HIGHBITDEPTH) " %*s%u\n %*s%u\n" #endif " %*s{%u/%u}\n %*s%u\n %*s%d\n %*s%u\n", width, "g_usage:", cfg->g_usage, width, "g_threads:", cfg->g_threads, width, "g_profile:", cfg->g_profile, width, "g_w:", cfg->g_w, width, "g_h:", cfg->g_h, #if CONFIG_LIBVPX_VP9_ENCODER && defined(VPX_IMG_FMT_HIGHBITDEPTH) width, "g_bit_depth:", cfg->g_bit_depth, width, "g_input_bit_depth:", cfg->g_input_bit_depth, #endif width, "g_timebase:", cfg->g_timebase.num, cfg->g_timebase.den, width, "g_error_resilient:", cfg->g_error_resilient, width, "g_pass:", cfg->g_pass, width, "g_lag_in_frames:", cfg->g_lag_in_frames); av_log(avctx, level, "rate control settings\n" " %*s%u\n %*s%u\n %*s%u\n %*s%u\n" " %*s%d\n %*s%p(%"SIZE_SPECIFIER")\n %*s%u\n", width, "rc_dropframe_thresh:", cfg->rc_dropframe_thresh, width, "rc_resize_allowed:", cfg->rc_resize_allowed, width, "rc_resize_up_thresh:", cfg->rc_resize_up_thresh, width, "rc_resize_down_thresh:", cfg->rc_resize_down_thresh, width, "rc_end_usage:", cfg->rc_end_usage, width, "rc_twopass_stats_in:", cfg->rc_twopass_stats_in.buf, cfg->rc_twopass_stats_in.sz, width, "rc_target_bitrate:", cfg->rc_target_bitrate); av_log(avctx, level, "quantizer settings\n" " %*s%u\n %*s%u\n", width, "rc_min_quantizer:", cfg->rc_min_quantizer, width, "rc_max_quantizer:", cfg->rc_max_quantizer); av_log(avctx, level, "bitrate tolerance\n" " %*s%u\n %*s%u\n", width, "rc_undershoot_pct:", cfg->rc_undershoot_pct, width, "rc_overshoot_pct:", cfg->rc_overshoot_pct); av_log(avctx, level, "decoder buffer model\n" " %*s%u\n %*s%u\n %*s%u\n", width, "rc_buf_sz:", cfg->rc_buf_sz, width, "rc_buf_initial_sz:", cfg->rc_buf_initial_sz, width, "rc_buf_optimal_sz:", cfg->rc_buf_optimal_sz); av_log(avctx, level, "2 pass rate control settings\n" " %*s%u\n %*s%u\n %*s%u\n", width, "rc_2pass_vbr_bias_pct:", cfg->rc_2pass_vbr_bias_pct, width, "rc_2pass_vbr_minsection_pct:", cfg->rc_2pass_vbr_minsection_pct, width, "rc_2pass_vbr_maxsection_pct:", cfg->rc_2pass_vbr_maxsection_pct); av_log(avctx, level, "keyframing settings\n" " %*s%d\n %*s%u\n %*s%u\n", width, "kf_mode:", cfg->kf_mode, width, "kf_min_dist:", cfg->kf_min_dist, width, "kf_max_dist:", cfg->kf_max_dist); av_log(avctx, level, "\n"); }
false
FFmpeg
753074721bd414874d18c372c491bdc6323fa3bf
static av_cold void dump_enc_cfg(AVCodecContext *avctx, const struct vpx_codec_enc_cfg *cfg) { int width = -30; int level = AV_LOG_DEBUG; av_log(avctx, level, "vpx_codec_enc_cfg\n"); av_log(avctx, level, "generic settings\n" " %*s%u\n %*s%u\n %*s%u\n %*s%u\n %*s%u\n" #if CONFIG_LIBVPX_VP9_ENCODER && defined(VPX_IMG_FMT_HIGHBITDEPTH) " %*s%u\n %*s%u\n" #endif " %*s{%u/%u}\n %*s%u\n %*s%d\n %*s%u\n", width, "g_usage:", cfg->g_usage, width, "g_threads:", cfg->g_threads, width, "g_profile:", cfg->g_profile, width, "g_w:", cfg->g_w, width, "g_h:", cfg->g_h, #if CONFIG_LIBVPX_VP9_ENCODER && defined(VPX_IMG_FMT_HIGHBITDEPTH) width, "g_bit_depth:", cfg->g_bit_depth, width, "g_input_bit_depth:", cfg->g_input_bit_depth, #endif width, "g_timebase:", cfg->g_timebase.num, cfg->g_timebase.den, width, "g_error_resilient:", cfg->g_error_resilient, width, "g_pass:", cfg->g_pass, width, "g_lag_in_frames:", cfg->g_lag_in_frames); av_log(avctx, level, "rate control settings\n" " %*s%u\n %*s%u\n %*s%u\n %*s%u\n" " %*s%d\n %*s%p(%"SIZE_SPECIFIER")\n %*s%u\n", width, "rc_dropframe_thresh:", cfg->rc_dropframe_thresh, width, "rc_resize_allowed:", cfg->rc_resize_allowed, width, "rc_resize_up_thresh:", cfg->rc_resize_up_thresh, width, "rc_resize_down_thresh:", cfg->rc_resize_down_thresh, width, "rc_end_usage:", cfg->rc_end_usage, width, "rc_twopass_stats_in:", cfg->rc_twopass_stats_in.buf, cfg->rc_twopass_stats_in.sz, width, "rc_target_bitrate:", cfg->rc_target_bitrate); av_log(avctx, level, "quantizer settings\n" " %*s%u\n %*s%u\n", width, "rc_min_quantizer:", cfg->rc_min_quantizer, width, "rc_max_quantizer:", cfg->rc_max_quantizer); av_log(avctx, level, "bitrate tolerance\n" " %*s%u\n %*s%u\n", width, "rc_undershoot_pct:", cfg->rc_undershoot_pct, width, "rc_overshoot_pct:", cfg->rc_overshoot_pct); av_log(avctx, level, "decoder buffer model\n" " %*s%u\n %*s%u\n %*s%u\n", width, "rc_buf_sz:", cfg->rc_buf_sz, width, "rc_buf_initial_sz:", cfg->rc_buf_initial_sz, width, "rc_buf_optimal_sz:", cfg->rc_buf_optimal_sz); av_log(avctx, level, "2 pass rate control settings\n" " %*s%u\n %*s%u\n %*s%u\n", width, "rc_2pass_vbr_bias_pct:", cfg->rc_2pass_vbr_bias_pct, width, "rc_2pass_vbr_minsection_pct:", cfg->rc_2pass_vbr_minsection_pct, width, "rc_2pass_vbr_maxsection_pct:", cfg->rc_2pass_vbr_maxsection_pct); av_log(avctx, level, "keyframing settings\n" " %*s%d\n %*s%u\n %*s%u\n", width, "kf_mode:", cfg->kf_mode, width, "kf_min_dist:", cfg->kf_min_dist, width, "kf_max_dist:", cfg->kf_max_dist); av_log(avctx, level, "\n"); }
{ "code": [], "line_no": [] }
static av_cold void FUNC_0(AVCodecContext *avctx, const struct vpx_codec_enc_cfg *cfg) { int VAR_0 = -30; int VAR_1 = AV_LOG_DEBUG; av_log(avctx, VAR_1, "vpx_codec_enc_cfg\n"); av_log(avctx, VAR_1, "generic settings\n" " %*s%u\n %*s%u\n %*s%u\n %*s%u\n %*s%u\n" #if CONFIG_LIBVPX_VP9_ENCODER && defined(VPX_IMG_FMT_HIGHBITDEPTH) " %*s%u\n %*s%u\n" #endif " %*s{%u/%u}\n %*s%u\n %*s%d\n %*s%u\n", VAR_0, "g_usage:", cfg->g_usage, VAR_0, "g_threads:", cfg->g_threads, VAR_0, "g_profile:", cfg->g_profile, VAR_0, "g_w:", cfg->g_w, VAR_0, "g_h:", cfg->g_h, #if CONFIG_LIBVPX_VP9_ENCODER && defined(VPX_IMG_FMT_HIGHBITDEPTH) VAR_0, "g_bit_depth:", cfg->g_bit_depth, VAR_0, "g_input_bit_depth:", cfg->g_input_bit_depth, #endif VAR_0, "g_timebase:", cfg->g_timebase.num, cfg->g_timebase.den, VAR_0, "g_error_resilient:", cfg->g_error_resilient, VAR_0, "g_pass:", cfg->g_pass, VAR_0, "g_lag_in_frames:", cfg->g_lag_in_frames); av_log(avctx, VAR_1, "rate control settings\n" " %*s%u\n %*s%u\n %*s%u\n %*s%u\n" " %*s%d\n %*s%p(%"SIZE_SPECIFIER")\n %*s%u\n", VAR_0, "rc_dropframe_thresh:", cfg->rc_dropframe_thresh, VAR_0, "rc_resize_allowed:", cfg->rc_resize_allowed, VAR_0, "rc_resize_up_thresh:", cfg->rc_resize_up_thresh, VAR_0, "rc_resize_down_thresh:", cfg->rc_resize_down_thresh, VAR_0, "rc_end_usage:", cfg->rc_end_usage, VAR_0, "rc_twopass_stats_in:", cfg->rc_twopass_stats_in.buf, cfg->rc_twopass_stats_in.sz, VAR_0, "rc_target_bitrate:", cfg->rc_target_bitrate); av_log(avctx, VAR_1, "quantizer settings\n" " %*s%u\n %*s%u\n", VAR_0, "rc_min_quantizer:", cfg->rc_min_quantizer, VAR_0, "rc_max_quantizer:", cfg->rc_max_quantizer); av_log(avctx, VAR_1, "bitrate tolerance\n" " %*s%u\n %*s%u\n", VAR_0, "rc_undershoot_pct:", cfg->rc_undershoot_pct, VAR_0, "rc_overshoot_pct:", cfg->rc_overshoot_pct); av_log(avctx, VAR_1, "decoder buffer model\n" " %*s%u\n %*s%u\n %*s%u\n", VAR_0, "rc_buf_sz:", cfg->rc_buf_sz, VAR_0, "rc_buf_initial_sz:", cfg->rc_buf_initial_sz, VAR_0, "rc_buf_optimal_sz:", cfg->rc_buf_optimal_sz); av_log(avctx, VAR_1, "2 pass rate control settings\n" " %*s%u\n %*s%u\n %*s%u\n", VAR_0, "rc_2pass_vbr_bias_pct:", cfg->rc_2pass_vbr_bias_pct, VAR_0, "rc_2pass_vbr_minsection_pct:", cfg->rc_2pass_vbr_minsection_pct, VAR_0, "rc_2pass_vbr_maxsection_pct:", cfg->rc_2pass_vbr_maxsection_pct); av_log(avctx, VAR_1, "keyframing settings\n" " %*s%d\n %*s%u\n %*s%u\n", VAR_0, "kf_mode:", cfg->kf_mode, VAR_0, "kf_min_dist:", cfg->kf_min_dist, VAR_0, "kf_max_dist:", cfg->kf_max_dist); av_log(avctx, VAR_1, "\n"); }
[ "static av_cold void FUNC_0(AVCodecContext *avctx,\nconst struct vpx_codec_enc_cfg *cfg)\n{", "int VAR_0 = -30;", "int VAR_1 = AV_LOG_DEBUG;", "av_log(avctx, VAR_1, \"vpx_codec_enc_cfg\\n\");", "av_log(avctx, VAR_1, \"generic settings\\n\"\n\" %*s%u\\n %*s%u\\n %*s%u\\n %*s%u\\n %*s%u\\n\"\n#if CONFIG_LIBVPX_VP9_ENCODER && defined(VPX_IMG_FMT_HIGHBITDEPTH)\n\" %*s%u\\n %*s%u\\n\"\n#endif\n\" %*s{%u/%u}\\n %*s%u\\n %*s%d\\n %*s%u\\n\",", "VAR_0, \"g_usage:\", cfg->g_usage,\nVAR_0, \"g_threads:\", cfg->g_threads,\nVAR_0, \"g_profile:\", cfg->g_profile,\nVAR_0, \"g_w:\", cfg->g_w,\nVAR_0, \"g_h:\", cfg->g_h,\n#if CONFIG_LIBVPX_VP9_ENCODER && defined(VPX_IMG_FMT_HIGHBITDEPTH)\nVAR_0, \"g_bit_depth:\", cfg->g_bit_depth,\nVAR_0, \"g_input_bit_depth:\", cfg->g_input_bit_depth,\n#endif\nVAR_0, \"g_timebase:\", cfg->g_timebase.num, cfg->g_timebase.den,\nVAR_0, \"g_error_resilient:\", cfg->g_error_resilient,\nVAR_0, \"g_pass:\", cfg->g_pass,\nVAR_0, \"g_lag_in_frames:\", cfg->g_lag_in_frames);", "av_log(avctx, VAR_1, \"rate control settings\\n\"\n\" %*s%u\\n %*s%u\\n %*s%u\\n %*s%u\\n\"\n\" %*s%d\\n %*s%p(%\"SIZE_SPECIFIER\")\\n %*s%u\\n\",\nVAR_0, \"rc_dropframe_thresh:\", cfg->rc_dropframe_thresh,\nVAR_0, \"rc_resize_allowed:\", cfg->rc_resize_allowed,\nVAR_0, \"rc_resize_up_thresh:\", cfg->rc_resize_up_thresh,\nVAR_0, \"rc_resize_down_thresh:\", cfg->rc_resize_down_thresh,\nVAR_0, \"rc_end_usage:\", cfg->rc_end_usage,\nVAR_0, \"rc_twopass_stats_in:\", cfg->rc_twopass_stats_in.buf, cfg->rc_twopass_stats_in.sz,\nVAR_0, \"rc_target_bitrate:\", cfg->rc_target_bitrate);", "av_log(avctx, VAR_1, \"quantizer settings\\n\"\n\" %*s%u\\n %*s%u\\n\",\nVAR_0, \"rc_min_quantizer:\", cfg->rc_min_quantizer,\nVAR_0, \"rc_max_quantizer:\", cfg->rc_max_quantizer);", "av_log(avctx, VAR_1, \"bitrate tolerance\\n\"\n\" %*s%u\\n %*s%u\\n\",\nVAR_0, \"rc_undershoot_pct:\", cfg->rc_undershoot_pct,\nVAR_0, \"rc_overshoot_pct:\", cfg->rc_overshoot_pct);", "av_log(avctx, VAR_1, \"decoder buffer model\\n\"\n\" %*s%u\\n %*s%u\\n %*s%u\\n\",\nVAR_0, \"rc_buf_sz:\", cfg->rc_buf_sz,\nVAR_0, \"rc_buf_initial_sz:\", cfg->rc_buf_initial_sz,\nVAR_0, \"rc_buf_optimal_sz:\", cfg->rc_buf_optimal_sz);", "av_log(avctx, VAR_1, \"2 pass rate control settings\\n\"\n\" %*s%u\\n %*s%u\\n %*s%u\\n\",\nVAR_0, \"rc_2pass_vbr_bias_pct:\", cfg->rc_2pass_vbr_bias_pct,\nVAR_0, \"rc_2pass_vbr_minsection_pct:\", cfg->rc_2pass_vbr_minsection_pct,\nVAR_0, \"rc_2pass_vbr_maxsection_pct:\", cfg->rc_2pass_vbr_maxsection_pct);", "av_log(avctx, VAR_1, \"keyframing settings\\n\"\n\" %*s%d\\n %*s%u\\n %*s%u\\n\",\nVAR_0, \"kf_mode:\", cfg->kf_mode,\nVAR_0, \"kf_min_dist:\", cfg->kf_min_dist,\nVAR_0, \"kf_max_dist:\", cfg->kf_max_dist);", "av_log(avctx, VAR_1, \"\\n\");", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15, 17, 19, 21, 23, 25 ], [ 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51 ], [ 53, 55, 57, 59, 61, 63, 65, 67, 69, 71 ], [ 73, 75, 77, 79 ], [ 81, 83, 85, 87 ], [ 89, 91, 93, 95, 97 ], [ 99, 101, 103, 105, 107 ], [ 109, 111, 113, 115, 117 ], [ 119 ], [ 121 ] ]
18,778
static int mpegps_read_packet(AVFormatContext *s, AVPacket *pkt) { AVStream *st; int len, startcode, i, type, codec_id; int64_t pts, dts; redo: len = mpegps_read_pes_header(s, NULL, &startcode, &pts, &dts, 1); if (len < 0) return len; /* now find stream */ for(i=0;i<s->nb_streams;i++) { st = s->streams[i]; if (st->id == startcode) goto found; } if (startcode >= 0x1e0 && startcode <= 0x1ef) { type = CODEC_TYPE_VIDEO; codec_id = CODEC_ID_MPEG2VIDEO; } else if (startcode >= 0x1c0 && startcode <= 0x1df) { type = CODEC_TYPE_AUDIO; codec_id = CODEC_ID_MP2; } else if (startcode >= 0x80 && startcode <= 0x9f) { type = CODEC_TYPE_AUDIO; codec_id = CODEC_ID_AC3; } else if (startcode >= 0xa0 && startcode <= 0xbf) { type = CODEC_TYPE_AUDIO; codec_id = CODEC_ID_PCM_S16BE; } else { skip: /* skip packet */ url_fskip(&s->pb, len); goto redo; } /* no stream found: add a new stream */ st = av_new_stream(s, startcode); if (!st) goto skip; st->codec.codec_type = type; st->codec.codec_id = codec_id; if (codec_id != CODEC_ID_PCM_S16BE) st->need_parsing = 1; found: if (startcode >= 0xa0 && startcode <= 0xbf) { int b1, freq; /* for LPCM, we just skip the header and consider it is raw audio data */ if (len <= 3) goto skip; get_byte(&s->pb); /* emphasis (1), muse(1), reserved(1), frame number(5) */ b1 = get_byte(&s->pb); /* quant (2), freq(2), reserved(1), channels(3) */ get_byte(&s->pb); /* dynamic range control (0x80 = off) */ len -= 3; freq = (b1 >> 4) & 3; st->codec.sample_rate = lpcm_freq_tab[freq]; st->codec.channels = 1 + (b1 & 7); st->codec.bit_rate = st->codec.channels * st->codec.sample_rate * 2; } av_new_packet(pkt, len); get_buffer(&s->pb, pkt->data, pkt->size); pkt->pts = pts; pkt->dts = dts; pkt->stream_index = st->index; #if 0 printf("%d: pts=%0.3f dts=%0.3f\n", pkt->stream_index, pkt->pts / 90000.0, pkt->dts / 90000.0); #endif return 0; }
false
FFmpeg
b754978a3b0aa17e7794f64c69bf4491762797fd
static int mpegps_read_packet(AVFormatContext *s, AVPacket *pkt) { AVStream *st; int len, startcode, i, type, codec_id; int64_t pts, dts; redo: len = mpegps_read_pes_header(s, NULL, &startcode, &pts, &dts, 1); if (len < 0) return len; for(i=0;i<s->nb_streams;i++) { st = s->streams[i]; if (st->id == startcode) goto found; } if (startcode >= 0x1e0 && startcode <= 0x1ef) { type = CODEC_TYPE_VIDEO; codec_id = CODEC_ID_MPEG2VIDEO; } else if (startcode >= 0x1c0 && startcode <= 0x1df) { type = CODEC_TYPE_AUDIO; codec_id = CODEC_ID_MP2; } else if (startcode >= 0x80 && startcode <= 0x9f) { type = CODEC_TYPE_AUDIO; codec_id = CODEC_ID_AC3; } else if (startcode >= 0xa0 && startcode <= 0xbf) { type = CODEC_TYPE_AUDIO; codec_id = CODEC_ID_PCM_S16BE; } else { skip: url_fskip(&s->pb, len); goto redo; } st = av_new_stream(s, startcode); if (!st) goto skip; st->codec.codec_type = type; st->codec.codec_id = codec_id; if (codec_id != CODEC_ID_PCM_S16BE) st->need_parsing = 1; found: if (startcode >= 0xa0 && startcode <= 0xbf) { int b1, freq; if (len <= 3) goto skip; get_byte(&s->pb); b1 = get_byte(&s->pb); get_byte(&s->pb); len -= 3; freq = (b1 >> 4) & 3; st->codec.sample_rate = lpcm_freq_tab[freq]; st->codec.channels = 1 + (b1 & 7); st->codec.bit_rate = st->codec.channels * st->codec.sample_rate * 2; } av_new_packet(pkt, len); get_buffer(&s->pb, pkt->data, pkt->size); pkt->pts = pts; pkt->dts = dts; pkt->stream_index = st->index; #if 0 printf("%d: pts=%0.3f dts=%0.3f\n", pkt->stream_index, pkt->pts / 90000.0, pkt->dts / 90000.0); #endif return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1) { AVStream *st; int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6; int64_t pts, dts; redo: VAR_2 = mpegps_read_pes_header(VAR_0, NULL, &VAR_3, &pts, &dts, 1); if (VAR_2 < 0) return VAR_2; for(VAR_4=0;VAR_4<VAR_0->nb_streams;VAR_4++) { st = VAR_0->streams[VAR_4]; if (st->id == VAR_3) goto found; } if (VAR_3 >= 0x1e0 && VAR_3 <= 0x1ef) { VAR_5 = CODEC_TYPE_VIDEO; VAR_6 = CODEC_ID_MPEG2VIDEO; } else if (VAR_3 >= 0x1c0 && VAR_3 <= 0x1df) { VAR_5 = CODEC_TYPE_AUDIO; VAR_6 = CODEC_ID_MP2; } else if (VAR_3 >= 0x80 && VAR_3 <= 0x9f) { VAR_5 = CODEC_TYPE_AUDIO; VAR_6 = CODEC_ID_AC3; } else if (VAR_3 >= 0xa0 && VAR_3 <= 0xbf) { VAR_5 = CODEC_TYPE_AUDIO; VAR_6 = CODEC_ID_PCM_S16BE; } else { skip: url_fskip(&VAR_0->pb, VAR_2); goto redo; } st = av_new_stream(VAR_0, VAR_3); if (!st) goto skip; st->codec.codec_type = VAR_5; st->codec.VAR_6 = VAR_6; if (VAR_6 != CODEC_ID_PCM_S16BE) st->need_parsing = 1; found: if (VAR_3 >= 0xa0 && VAR_3 <= 0xbf) { int VAR_7, VAR_8; if (VAR_2 <= 3) goto skip; get_byte(&VAR_0->pb); VAR_7 = get_byte(&VAR_0->pb); get_byte(&VAR_0->pb); VAR_2 -= 3; VAR_8 = (VAR_7 >> 4) & 3; st->codec.sample_rate = lpcm_freq_tab[VAR_8]; st->codec.channels = 1 + (VAR_7 & 7); st->codec.bit_rate = st->codec.channels * st->codec.sample_rate * 2; } av_new_packet(VAR_1, VAR_2); get_buffer(&VAR_0->pb, VAR_1->data, VAR_1->size); VAR_1->pts = pts; VAR_1->dts = dts; VAR_1->stream_index = st->index; #if 0 printf("%d: pts=%0.3f dts=%0.3f\n", VAR_1->stream_index, VAR_1->pts / 90000.0, VAR_1->dts / 90000.0); #endif return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0,\nAVPacket *VAR_1)\n{", "AVStream *st;", "int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6;", "int64_t pts, dts;", "redo:\nVAR_2 = mpegps_read_pes_header(VAR_0, NULL, &VAR_3, &pts, &dts, 1);", "if (VAR_2 < 0)\nreturn VAR_2;", "for(VAR_4=0;VAR_4<VAR_0->nb_streams;VAR_4++) {", "st = VAR_0->streams[VAR_4];", "if (st->id == VAR_3)\ngoto found;", "}", "if (VAR_3 >= 0x1e0 && VAR_3 <= 0x1ef) {", "VAR_5 = CODEC_TYPE_VIDEO;", "VAR_6 = CODEC_ID_MPEG2VIDEO;", "} else if (VAR_3 >= 0x1c0 && VAR_3 <= 0x1df) {", "VAR_5 = CODEC_TYPE_AUDIO;", "VAR_6 = CODEC_ID_MP2;", "} else if (VAR_3 >= 0x80 && VAR_3 <= 0x9f) {", "VAR_5 = CODEC_TYPE_AUDIO;", "VAR_6 = CODEC_ID_AC3;", "} else if (VAR_3 >= 0xa0 && VAR_3 <= 0xbf) {", "VAR_5 = CODEC_TYPE_AUDIO;", "VAR_6 = CODEC_ID_PCM_S16BE;", "} else {", "skip:\nurl_fskip(&VAR_0->pb, VAR_2);", "goto redo;", "}", "st = av_new_stream(VAR_0, VAR_3);", "if (!st)\ngoto skip;", "st->codec.codec_type = VAR_5;", "st->codec.VAR_6 = VAR_6;", "if (VAR_6 != CODEC_ID_PCM_S16BE)\nst->need_parsing = 1;", "found:\nif (VAR_3 >= 0xa0 && VAR_3 <= 0xbf) {", "int VAR_7, VAR_8;", "if (VAR_2 <= 3)\ngoto skip;", "get_byte(&VAR_0->pb);", "VAR_7 = get_byte(&VAR_0->pb);", "get_byte(&VAR_0->pb);", "VAR_2 -= 3;", "VAR_8 = (VAR_7 >> 4) & 3;", "st->codec.sample_rate = lpcm_freq_tab[VAR_8];", "st->codec.channels = 1 + (VAR_7 & 7);", "st->codec.bit_rate = st->codec.channels * st->codec.sample_rate * 2;", "}", "av_new_packet(VAR_1, VAR_2);", "get_buffer(&VAR_0->pb, VAR_1->data, VAR_1->size);", "VAR_1->pts = pts;", "VAR_1->dts = dts;", "VAR_1->stream_index = st->index;", "#if 0\nprintf(\"%d: pts=%0.3f dts=%0.3f\\n\",\nVAR_1->stream_index, VAR_1->pts / 90000.0, VAR_1->dts / 90000.0);", "#endif\nreturn 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 27 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63, 67 ], [ 69 ], [ 71 ], [ 75 ], [ 77, 79 ], [ 81 ], [ 83 ], [ 85, 87 ], [ 89, 91 ], [ 93 ], [ 101, 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133, 135, 137 ], [ 139, 141 ], [ 143 ] ]
18,779
static void get_downmix_coeffs(AC3DecodeContext *ctx) { int from = ctx->bsi.acmod; int to = ctx->output; float clev = clevs[ctx->bsi.cmixlev]; float slev = slevs[ctx->bsi.surmixlev]; ac3_audio_block *ab = &ctx->audio_block; if (to == AC3_OUTPUT_UNMODIFIED) return 0; switch (from) { case AC3_INPUT_DUALMONO: switch (to) { case AC3_OUTPUT_MONO: case AC3_OUTPUT_STEREO: /* We Assume that sum of both mono channels is requested */ ab->chcoeffs[0] *= LEVEL_MINUS_6DB; ab->chcoeffs[1] *= LEVEL_MINUS_6DB; break; } break; case AC3_INPUT_MONO: switch (to) { case AC3_OUTPUT_STEREO: ab->chcoeffs[0] *= LEVEL_MINUS_3DB; break; } break; case AC3_INPUT_STEREO: switch (to) { case AC3_OUTPUT_MONO: ab->chcoeffs[0] *= LEVEL_MINUS_3DB; ab->chcoeffs[1] *= LEVEL_MINUS_3DB; break; } break; case AC3_INPUT_3F: switch (to) { case AC3_OUTPUT_MONO: ab->chcoeffs[0] *= LEVEL_MINUS_3DB; ab->chcoeffs[2] *= LEVEL_MINUS_3DB; ab->chcoeffs[1] *= clev * LEVEL_PLUS_3DB; break; case AC3_OUTPUT_STEREO: ab->chcoeffs[1] *= clev; break; } break; case AC3_INPUT_2F_1R: switch (to) { case AC3_OUTPUT_MONO: ab->chcoeffs[0] *= LEVEL_MINUS_3DB; ab->chcoeffs[1] *= LEVEL_MINUS_3DB; ab->chcoeffs[2] *= slev * LEVEL_MINUS_3DB; break; case AC3_OUTPUT_STEREO: ab->chcoeffs[2] *= slev * LEVEL_MINUS_3DB; break; case AC3_OUTPUT_DOLBY: ab->chcoeffs[2] *= LEVEL_MINUS_3DB; break; } break; case AC3_INPUT_3F_1R: switch (to) { case AC3_OUTPUT_MONO: ab->chcoeffs[0] *= LEVEL_MINUS_3DB; ab->chcoeffs[2] *= LEVEL_MINUS_3DB; ab->chcoeffs[1] *= clev * LEVEL_PLUS_3DB; ab->chcoeffs[3] *= slev * LEVEL_MINUS_3DB; break; case AC3_OUTPUT_STEREO: ab->chcoeffs[1] *= clev; ab->chcoeffs[3] *= slev * LEVEL_MINUS_3DB; break; case AC3_OUTPUT_DOLBY: ab->chcoeffs[1] *= LEVEL_MINUS_3DB; ab->chcoeffs[3] *= LEVEL_MINUS_3DB; break; } break; case AC3_INPUT_2F_2R: switch (to) { case AC3_OUTPUT_MONO: ab->chcoeffs[0] *= LEVEL_MINUS_3DB; ab->chcoeffs[1] *= LEVEL_MINUS_3DB; ab->chcoeffs[2] *= slev * LEVEL_MINUS_3DB; ab->chcoeffs[3] *= slev * LEVEL_MINUS_3DB; break; case AC3_OUTPUT_STEREO: ab->chcoeffs[2] *= slev; ab->chcoeffs[3] *= slev; break; case AC3_OUTPUT_DOLBY: ab->chcoeffs[2] *= LEVEL_MINUS_3DB; ab->chcoeffs[3] *= LEVEL_MINUS_3DB; break; } break; case AC3_INPUT_3F_2R: switch (to) { case AC3_OUTPUT_MONO: ab->chcoeffs[0] *= LEVEL_MINUS_3DB; ab->chcoeffs[2] *= LEVEL_MINUS_3DB; ab->chcoeffs[1] *= clev * LEVEL_PLUS_3DB; ab->chcoeffs[3] *= slev * LEVEL_MINUS_3DB; ab->chcoeffs[4] *= slev * LEVEL_MINUS_3DB; break; case AC3_OUTPUT_STEREO: ab->chcoeffs[1] *= clev; ab->chcoeffs[3] *= slev; ab->chcoeffs[4] *= slev; break; case AC3_OUTPUT_DOLBY: ab->chcoeffs[1] *= LEVEL_MINUS_3DB; ab->chcoeffs[3] *= LEVEL_MINUS_3DB; ab->chcoeffs[4] *= LEVEL_MINUS_3DB; break; } break; } }
false
FFmpeg
0058584580b87feb47898e60e4b80c7f425882ad
static void get_downmix_coeffs(AC3DecodeContext *ctx) { int from = ctx->bsi.acmod; int to = ctx->output; float clev = clevs[ctx->bsi.cmixlev]; float slev = slevs[ctx->bsi.surmixlev]; ac3_audio_block *ab = &ctx->audio_block; if (to == AC3_OUTPUT_UNMODIFIED) return 0; switch (from) { case AC3_INPUT_DUALMONO: switch (to) { case AC3_OUTPUT_MONO: case AC3_OUTPUT_STEREO: ab->chcoeffs[0] *= LEVEL_MINUS_6DB; ab->chcoeffs[1] *= LEVEL_MINUS_6DB; break; } break; case AC3_INPUT_MONO: switch (to) { case AC3_OUTPUT_STEREO: ab->chcoeffs[0] *= LEVEL_MINUS_3DB; break; } break; case AC3_INPUT_STEREO: switch (to) { case AC3_OUTPUT_MONO: ab->chcoeffs[0] *= LEVEL_MINUS_3DB; ab->chcoeffs[1] *= LEVEL_MINUS_3DB; break; } break; case AC3_INPUT_3F: switch (to) { case AC3_OUTPUT_MONO: ab->chcoeffs[0] *= LEVEL_MINUS_3DB; ab->chcoeffs[2] *= LEVEL_MINUS_3DB; ab->chcoeffs[1] *= clev * LEVEL_PLUS_3DB; break; case AC3_OUTPUT_STEREO: ab->chcoeffs[1] *= clev; break; } break; case AC3_INPUT_2F_1R: switch (to) { case AC3_OUTPUT_MONO: ab->chcoeffs[0] *= LEVEL_MINUS_3DB; ab->chcoeffs[1] *= LEVEL_MINUS_3DB; ab->chcoeffs[2] *= slev * LEVEL_MINUS_3DB; break; case AC3_OUTPUT_STEREO: ab->chcoeffs[2] *= slev * LEVEL_MINUS_3DB; break; case AC3_OUTPUT_DOLBY: ab->chcoeffs[2] *= LEVEL_MINUS_3DB; break; } break; case AC3_INPUT_3F_1R: switch (to) { case AC3_OUTPUT_MONO: ab->chcoeffs[0] *= LEVEL_MINUS_3DB; ab->chcoeffs[2] *= LEVEL_MINUS_3DB; ab->chcoeffs[1] *= clev * LEVEL_PLUS_3DB; ab->chcoeffs[3] *= slev * LEVEL_MINUS_3DB; break; case AC3_OUTPUT_STEREO: ab->chcoeffs[1] *= clev; ab->chcoeffs[3] *= slev * LEVEL_MINUS_3DB; break; case AC3_OUTPUT_DOLBY: ab->chcoeffs[1] *= LEVEL_MINUS_3DB; ab->chcoeffs[3] *= LEVEL_MINUS_3DB; break; } break; case AC3_INPUT_2F_2R: switch (to) { case AC3_OUTPUT_MONO: ab->chcoeffs[0] *= LEVEL_MINUS_3DB; ab->chcoeffs[1] *= LEVEL_MINUS_3DB; ab->chcoeffs[2] *= slev * LEVEL_MINUS_3DB; ab->chcoeffs[3] *= slev * LEVEL_MINUS_3DB; break; case AC3_OUTPUT_STEREO: ab->chcoeffs[2] *= slev; ab->chcoeffs[3] *= slev; break; case AC3_OUTPUT_DOLBY: ab->chcoeffs[2] *= LEVEL_MINUS_3DB; ab->chcoeffs[3] *= LEVEL_MINUS_3DB; break; } break; case AC3_INPUT_3F_2R: switch (to) { case AC3_OUTPUT_MONO: ab->chcoeffs[0] *= LEVEL_MINUS_3DB; ab->chcoeffs[2] *= LEVEL_MINUS_3DB; ab->chcoeffs[1] *= clev * LEVEL_PLUS_3DB; ab->chcoeffs[3] *= slev * LEVEL_MINUS_3DB; ab->chcoeffs[4] *= slev * LEVEL_MINUS_3DB; break; case AC3_OUTPUT_STEREO: ab->chcoeffs[1] *= clev; ab->chcoeffs[3] *= slev; ab->chcoeffs[4] *= slev; break; case AC3_OUTPUT_DOLBY: ab->chcoeffs[1] *= LEVEL_MINUS_3DB; ab->chcoeffs[3] *= LEVEL_MINUS_3DB; ab->chcoeffs[4] *= LEVEL_MINUS_3DB; break; } break; } }
{ "code": [], "line_no": [] }
static void FUNC_0(AC3DecodeContext *VAR_0) { int VAR_1 = VAR_0->bsi.acmod; int VAR_2 = VAR_0->output; float VAR_3 = clevs[VAR_0->bsi.cmixlev]; float VAR_4 = slevs[VAR_0->bsi.surmixlev]; ac3_audio_block *ab = &VAR_0->audio_block; if (VAR_2 == AC3_OUTPUT_UNMODIFIED) return 0; switch (VAR_1) { case AC3_INPUT_DUALMONO: switch (VAR_2) { case AC3_OUTPUT_MONO: case AC3_OUTPUT_STEREO: ab->chcoeffs[0] *= LEVEL_MINUS_6DB; ab->chcoeffs[1] *= LEVEL_MINUS_6DB; break; } break; case AC3_INPUT_MONO: switch (VAR_2) { case AC3_OUTPUT_STEREO: ab->chcoeffs[0] *= LEVEL_MINUS_3DB; break; } break; case AC3_INPUT_STEREO: switch (VAR_2) { case AC3_OUTPUT_MONO: ab->chcoeffs[0] *= LEVEL_MINUS_3DB; ab->chcoeffs[1] *= LEVEL_MINUS_3DB; break; } break; case AC3_INPUT_3F: switch (VAR_2) { case AC3_OUTPUT_MONO: ab->chcoeffs[0] *= LEVEL_MINUS_3DB; ab->chcoeffs[2] *= LEVEL_MINUS_3DB; ab->chcoeffs[1] *= VAR_3 * LEVEL_PLUS_3DB; break; case AC3_OUTPUT_STEREO: ab->chcoeffs[1] *= VAR_3; break; } break; case AC3_INPUT_2F_1R: switch (VAR_2) { case AC3_OUTPUT_MONO: ab->chcoeffs[0] *= LEVEL_MINUS_3DB; ab->chcoeffs[1] *= LEVEL_MINUS_3DB; ab->chcoeffs[2] *= VAR_4 * LEVEL_MINUS_3DB; break; case AC3_OUTPUT_STEREO: ab->chcoeffs[2] *= VAR_4 * LEVEL_MINUS_3DB; break; case AC3_OUTPUT_DOLBY: ab->chcoeffs[2] *= LEVEL_MINUS_3DB; break; } break; case AC3_INPUT_3F_1R: switch (VAR_2) { case AC3_OUTPUT_MONO: ab->chcoeffs[0] *= LEVEL_MINUS_3DB; ab->chcoeffs[2] *= LEVEL_MINUS_3DB; ab->chcoeffs[1] *= VAR_3 * LEVEL_PLUS_3DB; ab->chcoeffs[3] *= VAR_4 * LEVEL_MINUS_3DB; break; case AC3_OUTPUT_STEREO: ab->chcoeffs[1] *= VAR_3; ab->chcoeffs[3] *= VAR_4 * LEVEL_MINUS_3DB; break; case AC3_OUTPUT_DOLBY: ab->chcoeffs[1] *= LEVEL_MINUS_3DB; ab->chcoeffs[3] *= LEVEL_MINUS_3DB; break; } break; case AC3_INPUT_2F_2R: switch (VAR_2) { case AC3_OUTPUT_MONO: ab->chcoeffs[0] *= LEVEL_MINUS_3DB; ab->chcoeffs[1] *= LEVEL_MINUS_3DB; ab->chcoeffs[2] *= VAR_4 * LEVEL_MINUS_3DB; ab->chcoeffs[3] *= VAR_4 * LEVEL_MINUS_3DB; break; case AC3_OUTPUT_STEREO: ab->chcoeffs[2] *= VAR_4; ab->chcoeffs[3] *= VAR_4; break; case AC3_OUTPUT_DOLBY: ab->chcoeffs[2] *= LEVEL_MINUS_3DB; ab->chcoeffs[3] *= LEVEL_MINUS_3DB; break; } break; case AC3_INPUT_3F_2R: switch (VAR_2) { case AC3_OUTPUT_MONO: ab->chcoeffs[0] *= LEVEL_MINUS_3DB; ab->chcoeffs[2] *= LEVEL_MINUS_3DB; ab->chcoeffs[1] *= VAR_3 * LEVEL_PLUS_3DB; ab->chcoeffs[3] *= VAR_4 * LEVEL_MINUS_3DB; ab->chcoeffs[4] *= VAR_4 * LEVEL_MINUS_3DB; break; case AC3_OUTPUT_STEREO: ab->chcoeffs[1] *= VAR_3; ab->chcoeffs[3] *= VAR_4; ab->chcoeffs[4] *= VAR_4; break; case AC3_OUTPUT_DOLBY: ab->chcoeffs[1] *= LEVEL_MINUS_3DB; ab->chcoeffs[3] *= LEVEL_MINUS_3DB; ab->chcoeffs[4] *= LEVEL_MINUS_3DB; break; } break; } }
[ "static void FUNC_0(AC3DecodeContext *VAR_0)\n{", "int VAR_1 = VAR_0->bsi.acmod;", "int VAR_2 = VAR_0->output;", "float VAR_3 = clevs[VAR_0->bsi.cmixlev];", "float VAR_4 = slevs[VAR_0->bsi.surmixlev];", "ac3_audio_block *ab = &VAR_0->audio_block;", "if (VAR_2 == AC3_OUTPUT_UNMODIFIED)\nreturn 0;", "switch (VAR_1) {", "case AC3_INPUT_DUALMONO:\nswitch (VAR_2) {", "case AC3_OUTPUT_MONO:\ncase AC3_OUTPUT_STEREO:\nab->chcoeffs[0] *= LEVEL_MINUS_6DB;", "ab->chcoeffs[1] *= LEVEL_MINUS_6DB;", "break;", "}", "break;", "case AC3_INPUT_MONO:\nswitch (VAR_2) {", "case AC3_OUTPUT_STEREO:\nab->chcoeffs[0] *= LEVEL_MINUS_3DB;", "break;", "}", "break;", "case AC3_INPUT_STEREO:\nswitch (VAR_2) {", "case AC3_OUTPUT_MONO:\nab->chcoeffs[0] *= LEVEL_MINUS_3DB;", "ab->chcoeffs[1] *= LEVEL_MINUS_3DB;", "break;", "}", "break;", "case AC3_INPUT_3F:\nswitch (VAR_2) {", "case AC3_OUTPUT_MONO:\nab->chcoeffs[0] *= LEVEL_MINUS_3DB;", "ab->chcoeffs[2] *= LEVEL_MINUS_3DB;", "ab->chcoeffs[1] *= VAR_3 * LEVEL_PLUS_3DB;", "break;", "case AC3_OUTPUT_STEREO:\nab->chcoeffs[1] *= VAR_3;", "break;", "}", "break;", "case AC3_INPUT_2F_1R:\nswitch (VAR_2) {", "case AC3_OUTPUT_MONO:\nab->chcoeffs[0] *= LEVEL_MINUS_3DB;", "ab->chcoeffs[1] *= LEVEL_MINUS_3DB;", "ab->chcoeffs[2] *= VAR_4 * LEVEL_MINUS_3DB;", "break;", "case AC3_OUTPUT_STEREO:\nab->chcoeffs[2] *= VAR_4 * LEVEL_MINUS_3DB;", "break;", "case AC3_OUTPUT_DOLBY:\nab->chcoeffs[2] *= LEVEL_MINUS_3DB;", "break;", "}", "break;", "case AC3_INPUT_3F_1R:\nswitch (VAR_2) {", "case AC3_OUTPUT_MONO:\nab->chcoeffs[0] *= LEVEL_MINUS_3DB;", "ab->chcoeffs[2] *= LEVEL_MINUS_3DB;", "ab->chcoeffs[1] *= VAR_3 * LEVEL_PLUS_3DB;", "ab->chcoeffs[3] *= VAR_4 * LEVEL_MINUS_3DB;", "break;", "case AC3_OUTPUT_STEREO:\nab->chcoeffs[1] *= VAR_3;", "ab->chcoeffs[3] *= VAR_4 * LEVEL_MINUS_3DB;", "break;", "case AC3_OUTPUT_DOLBY:\nab->chcoeffs[1] *= LEVEL_MINUS_3DB;", "ab->chcoeffs[3] *= LEVEL_MINUS_3DB;", "break;", "}", "break;", "case AC3_INPUT_2F_2R:\nswitch (VAR_2) {", "case AC3_OUTPUT_MONO:\nab->chcoeffs[0] *= LEVEL_MINUS_3DB;", "ab->chcoeffs[1] *= LEVEL_MINUS_3DB;", "ab->chcoeffs[2] *= VAR_4 * LEVEL_MINUS_3DB;", "ab->chcoeffs[3] *= VAR_4 * LEVEL_MINUS_3DB;", "break;", "case AC3_OUTPUT_STEREO:\nab->chcoeffs[2] *= VAR_4;", "ab->chcoeffs[3] *= VAR_4;", "break;", "case AC3_OUTPUT_DOLBY:\nab->chcoeffs[2] *= LEVEL_MINUS_3DB;", "ab->chcoeffs[3] *= LEVEL_MINUS_3DB;", "break;", "}", "break;", "case AC3_INPUT_3F_2R:\nswitch (VAR_2) {", "case AC3_OUTPUT_MONO:\nab->chcoeffs[0] *= LEVEL_MINUS_3DB;", "ab->chcoeffs[2] *= LEVEL_MINUS_3DB;", "ab->chcoeffs[1] *= VAR_3 * LEVEL_PLUS_3DB;", "ab->chcoeffs[3] *= VAR_4 * LEVEL_MINUS_3DB;", "ab->chcoeffs[4] *= VAR_4 * LEVEL_MINUS_3DB;", "break;", "case AC3_OUTPUT_STEREO:\nab->chcoeffs[1] *= VAR_3;", "ab->chcoeffs[3] *= VAR_4;", "ab->chcoeffs[4] *= VAR_4;", "break;", "case AC3_OUTPUT_DOLBY:\nab->chcoeffs[1] *= LEVEL_MINUS_3DB;", "ab->chcoeffs[3] *= LEVEL_MINUS_3DB;", "ab->chcoeffs[4] *= LEVEL_MINUS_3DB;", "break;", "}", "break;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17, 19 ], [ 23 ], [ 25, 27 ], [ 29, 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 47, 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57, 59 ], [ 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 ] ]
18,780
static av_cold void dsputil_init_mmx(DSPContext *c, AVCodecContext *avctx, int mm_flags) { const int high_bit_depth = avctx->bits_per_raw_sample > 8; #if HAVE_INLINE_ASM c->put_pixels_clamped = ff_put_pixels_clamped_mmx; c->put_signed_pixels_clamped = ff_put_signed_pixels_clamped_mmx; c->add_pixels_clamped = ff_add_pixels_clamped_mmx; if (!high_bit_depth) { c->clear_block = clear_block_mmx; c->clear_blocks = clear_blocks_mmx; c->draw_edges = draw_edges_mmx; SET_HPEL_FUNCS(put, [0], 16, mmx); SET_HPEL_FUNCS(put_no_rnd, [0], 16, mmx); SET_HPEL_FUNCS(avg, [0], 16, mmx); SET_HPEL_FUNCS(avg_no_rnd, , 16, mmx); SET_HPEL_FUNCS(put, [1], 8, mmx); SET_HPEL_FUNCS(put_no_rnd, [1], 8, mmx); SET_HPEL_FUNCS(avg, [1], 8, mmx); switch (avctx->idct_algo) { case FF_IDCT_AUTO: case FF_IDCT_SIMPLEMMX: c->idct_put = ff_simple_idct_put_mmx; c->idct_add = ff_simple_idct_add_mmx; c->idct = ff_simple_idct_mmx; c->idct_permutation_type = FF_SIMPLE_IDCT_PERM; break; case FF_IDCT_XVIDMMX: c->idct_put = ff_idct_xvid_mmx_put; c->idct_add = ff_idct_xvid_mmx_add; c->idct = ff_idct_xvid_mmx; break; } } c->gmc = gmc_mmx; c->add_bytes = add_bytes_mmx; if (CONFIG_H263_DECODER || CONFIG_H263_ENCODER) { c->h263_v_loop_filter = h263_v_loop_filter_mmx; c->h263_h_loop_filter = h263_h_loop_filter_mmx; } #endif /* HAVE_INLINE_ASM */ #if HAVE_YASM c->vector_clip_int32 = ff_vector_clip_int32_mmx; #endif }
false
FFmpeg
659d4ba5af5d72716ee370bb367c741bd15e75b4
static av_cold void dsputil_init_mmx(DSPContext *c, AVCodecContext *avctx, int mm_flags) { const int high_bit_depth = avctx->bits_per_raw_sample > 8; #if HAVE_INLINE_ASM c->put_pixels_clamped = ff_put_pixels_clamped_mmx; c->put_signed_pixels_clamped = ff_put_signed_pixels_clamped_mmx; c->add_pixels_clamped = ff_add_pixels_clamped_mmx; if (!high_bit_depth) { c->clear_block = clear_block_mmx; c->clear_blocks = clear_blocks_mmx; c->draw_edges = draw_edges_mmx; SET_HPEL_FUNCS(put, [0], 16, mmx); SET_HPEL_FUNCS(put_no_rnd, [0], 16, mmx); SET_HPEL_FUNCS(avg, [0], 16, mmx); SET_HPEL_FUNCS(avg_no_rnd, , 16, mmx); SET_HPEL_FUNCS(put, [1], 8, mmx); SET_HPEL_FUNCS(put_no_rnd, [1], 8, mmx); SET_HPEL_FUNCS(avg, [1], 8, mmx); switch (avctx->idct_algo) { case FF_IDCT_AUTO: case FF_IDCT_SIMPLEMMX: c->idct_put = ff_simple_idct_put_mmx; c->idct_add = ff_simple_idct_add_mmx; c->idct = ff_simple_idct_mmx; c->idct_permutation_type = FF_SIMPLE_IDCT_PERM; break; case FF_IDCT_XVIDMMX: c->idct_put = ff_idct_xvid_mmx_put; c->idct_add = ff_idct_xvid_mmx_add; c->idct = ff_idct_xvid_mmx; break; } } c->gmc = gmc_mmx; c->add_bytes = add_bytes_mmx; if (CONFIG_H263_DECODER || CONFIG_H263_ENCODER) { c->h263_v_loop_filter = h263_v_loop_filter_mmx; c->h263_h_loop_filter = h263_h_loop_filter_mmx; } #endif #if HAVE_YASM c->vector_clip_int32 = ff_vector_clip_int32_mmx; #endif }
{ "code": [], "line_no": [] }
static av_cold void FUNC_0(DSPContext *c, AVCodecContext *avctx, int mm_flags) { const int VAR_0 = avctx->bits_per_raw_sample > 8; #if HAVE_INLINE_ASM c->put_pixels_clamped = ff_put_pixels_clamped_mmx; c->put_signed_pixels_clamped = ff_put_signed_pixels_clamped_mmx; c->add_pixels_clamped = ff_add_pixels_clamped_mmx; if (!VAR_0) { c->clear_block = clear_block_mmx; c->clear_blocks = clear_blocks_mmx; c->draw_edges = draw_edges_mmx; SET_HPEL_FUNCS(put, [0], 16, mmx); SET_HPEL_FUNCS(put_no_rnd, [0], 16, mmx); SET_HPEL_FUNCS(avg, [0], 16, mmx); SET_HPEL_FUNCS(avg_no_rnd, , 16, mmx); SET_HPEL_FUNCS(put, [1], 8, mmx); SET_HPEL_FUNCS(put_no_rnd, [1], 8, mmx); SET_HPEL_FUNCS(avg, [1], 8, mmx); switch (avctx->idct_algo) { case FF_IDCT_AUTO: case FF_IDCT_SIMPLEMMX: c->idct_put = ff_simple_idct_put_mmx; c->idct_add = ff_simple_idct_add_mmx; c->idct = ff_simple_idct_mmx; c->idct_permutation_type = FF_SIMPLE_IDCT_PERM; break; case FF_IDCT_XVIDMMX: c->idct_put = ff_idct_xvid_mmx_put; c->idct_add = ff_idct_xvid_mmx_add; c->idct = ff_idct_xvid_mmx; break; } } c->gmc = gmc_mmx; c->add_bytes = add_bytes_mmx; if (CONFIG_H263_DECODER || CONFIG_H263_ENCODER) { c->h263_v_loop_filter = h263_v_loop_filter_mmx; c->h263_h_loop_filter = h263_h_loop_filter_mmx; } #endif #if HAVE_YASM c->vector_clip_int32 = ff_vector_clip_int32_mmx; #endif }
[ "static av_cold void FUNC_0(DSPContext *c, AVCodecContext *avctx,\nint mm_flags)\n{", "const int VAR_0 = avctx->bits_per_raw_sample > 8;", "#if HAVE_INLINE_ASM\nc->put_pixels_clamped = ff_put_pixels_clamped_mmx;", "c->put_signed_pixels_clamped = ff_put_signed_pixels_clamped_mmx;", "c->add_pixels_clamped = ff_add_pixels_clamped_mmx;", "if (!VAR_0) {", "c->clear_block = clear_block_mmx;", "c->clear_blocks = clear_blocks_mmx;", "c->draw_edges = draw_edges_mmx;", "SET_HPEL_FUNCS(put, [0], 16, mmx);", "SET_HPEL_FUNCS(put_no_rnd, [0], 16, mmx);", "SET_HPEL_FUNCS(avg, [0], 16, mmx);", "SET_HPEL_FUNCS(avg_no_rnd, , 16, mmx);", "SET_HPEL_FUNCS(put, [1], 8, mmx);", "SET_HPEL_FUNCS(put_no_rnd, [1], 8, mmx);", "SET_HPEL_FUNCS(avg, [1], 8, mmx);", "switch (avctx->idct_algo) {", "case FF_IDCT_AUTO:\ncase FF_IDCT_SIMPLEMMX:\nc->idct_put = ff_simple_idct_put_mmx;", "c->idct_add = ff_simple_idct_add_mmx;", "c->idct = ff_simple_idct_mmx;", "c->idct_permutation_type = FF_SIMPLE_IDCT_PERM;", "break;", "case FF_IDCT_XVIDMMX:\nc->idct_put = ff_idct_xvid_mmx_put;", "c->idct_add = ff_idct_xvid_mmx_add;", "c->idct = ff_idct_xvid_mmx;", "break;", "}", "}", "c->gmc = gmc_mmx;", "c->add_bytes = add_bytes_mmx;", "if (CONFIG_H263_DECODER || CONFIG_H263_ENCODER) {", "c->h263_v_loop_filter = h263_v_loop_filter_mmx;", "c->h263_h_loop_filter = h263_h_loop_filter_mmx;", "}", "#endif\n#if HAVE_YASM\nc->vector_clip_int32 = ff_vector_clip_int32_mmx;", "#endif\n}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11, 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49, 51, 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63, 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 83 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95, 99, 101 ], [ 103, 107 ] ]
18,782
static int pci_nic_uninit(PCIDevice *dev) { PCIEEPRO100State *d = DO_UPCAST(PCIEEPRO100State, dev, dev); EEPRO100State *s = &d->eepro100; cpu_unregister_io_memory(s->mmio_index); return 0; }
false
qemu
273a2142176098fe2c27f263d86ad66b133b43cb
static int pci_nic_uninit(PCIDevice *dev) { PCIEEPRO100State *d = DO_UPCAST(PCIEEPRO100State, dev, dev); EEPRO100State *s = &d->eepro100; cpu_unregister_io_memory(s->mmio_index); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(PCIDevice *VAR_0) { PCIEEPRO100State *d = DO_UPCAST(PCIEEPRO100State, VAR_0, VAR_0); EEPRO100State *s = &d->eepro100; cpu_unregister_io_memory(s->mmio_index); return 0; }
[ "static int FUNC_0(PCIDevice *VAR_0)\n{", "PCIEEPRO100State *d = DO_UPCAST(PCIEEPRO100State, VAR_0, VAR_0);", "EEPRO100State *s = &d->eepro100;", "cpu_unregister_io_memory(s->mmio_index);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 15 ], [ 17 ] ]
18,783
static int kvm_getput_regs(CPUState *env, int set) { struct kvm_regs regs; int ret = 0; if (!set) { ret = kvm_vcpu_ioctl(env, KVM_GET_REGS, &regs); if (ret < 0) return ret; } kvm_getput_reg(&regs.rax, &env->regs[R_EAX], set); kvm_getput_reg(&regs.rbx, &env->regs[R_EBX], set); kvm_getput_reg(&regs.rcx, &env->regs[R_ECX], set); kvm_getput_reg(&regs.rdx, &env->regs[R_EDX], set); kvm_getput_reg(&regs.rsi, &env->regs[R_ESI], set); kvm_getput_reg(&regs.rdi, &env->regs[R_EDI], set); kvm_getput_reg(&regs.rsp, &env->regs[R_ESP], set); kvm_getput_reg(&regs.rbp, &env->regs[R_EBP], set); #ifdef TARGET_X86_64 kvm_getput_reg(&regs.r8, &env->regs[8], set); kvm_getput_reg(&regs.r9, &env->regs[9], set); kvm_getput_reg(&regs.r10, &env->regs[10], set); kvm_getput_reg(&regs.r11, &env->regs[11], set); kvm_getput_reg(&regs.r12, &env->regs[12], set); kvm_getput_reg(&regs.r13, &env->regs[13], set); kvm_getput_reg(&regs.r14, &env->regs[14], set); kvm_getput_reg(&regs.r15, &env->regs[15], set); #endif kvm_getput_reg(&regs.rflags, &env->eflags, set); kvm_getput_reg(&regs.rip, &env->eip, set); if (set) ret = kvm_vcpu_ioctl(env, KVM_SET_REGS, &regs); return ret; }
false
qemu
b9bec74bcb16519a876ec21cd5277c526a9b512d
static int kvm_getput_regs(CPUState *env, int set) { struct kvm_regs regs; int ret = 0; if (!set) { ret = kvm_vcpu_ioctl(env, KVM_GET_REGS, &regs); if (ret < 0) return ret; } kvm_getput_reg(&regs.rax, &env->regs[R_EAX], set); kvm_getput_reg(&regs.rbx, &env->regs[R_EBX], set); kvm_getput_reg(&regs.rcx, &env->regs[R_ECX], set); kvm_getput_reg(&regs.rdx, &env->regs[R_EDX], set); kvm_getput_reg(&regs.rsi, &env->regs[R_ESI], set); kvm_getput_reg(&regs.rdi, &env->regs[R_EDI], set); kvm_getput_reg(&regs.rsp, &env->regs[R_ESP], set); kvm_getput_reg(&regs.rbp, &env->regs[R_EBP], set); #ifdef TARGET_X86_64 kvm_getput_reg(&regs.r8, &env->regs[8], set); kvm_getput_reg(&regs.r9, &env->regs[9], set); kvm_getput_reg(&regs.r10, &env->regs[10], set); kvm_getput_reg(&regs.r11, &env->regs[11], set); kvm_getput_reg(&regs.r12, &env->regs[12], set); kvm_getput_reg(&regs.r13, &env->regs[13], set); kvm_getput_reg(&regs.r14, &env->regs[14], set); kvm_getput_reg(&regs.r15, &env->regs[15], set); #endif kvm_getput_reg(&regs.rflags, &env->eflags, set); kvm_getput_reg(&regs.rip, &env->eip, set); if (set) ret = kvm_vcpu_ioctl(env, KVM_SET_REGS, &regs); return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(CPUState *VAR_0, int VAR_1) { struct kvm_regs VAR_2; int VAR_3 = 0; if (!VAR_1) { VAR_3 = kvm_vcpu_ioctl(VAR_0, KVM_GET_REGS, &VAR_2); if (VAR_3 < 0) return VAR_3; } kvm_getput_reg(&VAR_2.rax, &VAR_0->VAR_2[R_EAX], VAR_1); kvm_getput_reg(&VAR_2.rbx, &VAR_0->VAR_2[R_EBX], VAR_1); kvm_getput_reg(&VAR_2.rcx, &VAR_0->VAR_2[R_ECX], VAR_1); kvm_getput_reg(&VAR_2.rdx, &VAR_0->VAR_2[R_EDX], VAR_1); kvm_getput_reg(&VAR_2.rsi, &VAR_0->VAR_2[R_ESI], VAR_1); kvm_getput_reg(&VAR_2.rdi, &VAR_0->VAR_2[R_EDI], VAR_1); kvm_getput_reg(&VAR_2.rsp, &VAR_0->VAR_2[R_ESP], VAR_1); kvm_getput_reg(&VAR_2.rbp, &VAR_0->VAR_2[R_EBP], VAR_1); #ifdef TARGET_X86_64 kvm_getput_reg(&VAR_2.r8, &VAR_0->VAR_2[8], VAR_1); kvm_getput_reg(&VAR_2.r9, &VAR_0->VAR_2[9], VAR_1); kvm_getput_reg(&VAR_2.r10, &VAR_0->VAR_2[10], VAR_1); kvm_getput_reg(&VAR_2.r11, &VAR_0->VAR_2[11], VAR_1); kvm_getput_reg(&VAR_2.r12, &VAR_0->VAR_2[12], VAR_1); kvm_getput_reg(&VAR_2.r13, &VAR_0->VAR_2[13], VAR_1); kvm_getput_reg(&VAR_2.r14, &VAR_0->VAR_2[14], VAR_1); kvm_getput_reg(&VAR_2.r15, &VAR_0->VAR_2[15], VAR_1); #endif kvm_getput_reg(&VAR_2.rflags, &VAR_0->eflags, VAR_1); kvm_getput_reg(&VAR_2.rip, &VAR_0->eip, VAR_1); if (VAR_1) VAR_3 = kvm_vcpu_ioctl(VAR_0, KVM_SET_REGS, &VAR_2); return VAR_3; }
[ "static int FUNC_0(CPUState *VAR_0, int VAR_1)\n{", "struct kvm_regs VAR_2;", "int VAR_3 = 0;", "if (!VAR_1) {", "VAR_3 = kvm_vcpu_ioctl(VAR_0, KVM_GET_REGS, &VAR_2);", "if (VAR_3 < 0)\nreturn VAR_3;", "}", "kvm_getput_reg(&VAR_2.rax, &VAR_0->VAR_2[R_EAX], VAR_1);", "kvm_getput_reg(&VAR_2.rbx, &VAR_0->VAR_2[R_EBX], VAR_1);", "kvm_getput_reg(&VAR_2.rcx, &VAR_0->VAR_2[R_ECX], VAR_1);", "kvm_getput_reg(&VAR_2.rdx, &VAR_0->VAR_2[R_EDX], VAR_1);", "kvm_getput_reg(&VAR_2.rsi, &VAR_0->VAR_2[R_ESI], VAR_1);", "kvm_getput_reg(&VAR_2.rdi, &VAR_0->VAR_2[R_EDI], VAR_1);", "kvm_getput_reg(&VAR_2.rsp, &VAR_0->VAR_2[R_ESP], VAR_1);", "kvm_getput_reg(&VAR_2.rbp, &VAR_0->VAR_2[R_EBP], VAR_1);", "#ifdef TARGET_X86_64\nkvm_getput_reg(&VAR_2.r8, &VAR_0->VAR_2[8], VAR_1);", "kvm_getput_reg(&VAR_2.r9, &VAR_0->VAR_2[9], VAR_1);", "kvm_getput_reg(&VAR_2.r10, &VAR_0->VAR_2[10], VAR_1);", "kvm_getput_reg(&VAR_2.r11, &VAR_0->VAR_2[11], VAR_1);", "kvm_getput_reg(&VAR_2.r12, &VAR_0->VAR_2[12], VAR_1);", "kvm_getput_reg(&VAR_2.r13, &VAR_0->VAR_2[13], VAR_1);", "kvm_getput_reg(&VAR_2.r14, &VAR_0->VAR_2[14], VAR_1);", "kvm_getput_reg(&VAR_2.r15, &VAR_0->VAR_2[15], VAR_1);", "#endif\nkvm_getput_reg(&VAR_2.rflags, &VAR_0->eflags, VAR_1);", "kvm_getput_reg(&VAR_2.rip, &VAR_0->eip, VAR_1);", "if (VAR_1)\nVAR_3 = kvm_vcpu_ioctl(VAR_0, KVM_SET_REGS, &VAR_2);", "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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15, 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57, 61 ], [ 63 ], [ 67, 69 ], [ 73 ], [ 75 ] ]
18,784
static void visitor_reset(TestOutputVisitorData *data) { visitor_output_teardown(data, NULL); visitor_output_setup(data, NULL); }
false
qemu
b3db211f3c80bb996a704d665fe275619f728bd4
static void visitor_reset(TestOutputVisitorData *data) { visitor_output_teardown(data, NULL); visitor_output_setup(data, NULL); }
{ "code": [], "line_no": [] }
static void FUNC_0(TestOutputVisitorData *VAR_0) { visitor_output_teardown(VAR_0, NULL); visitor_output_setup(VAR_0, NULL); }
[ "static void FUNC_0(TestOutputVisitorData *VAR_0)\n{", "visitor_output_teardown(VAR_0, NULL);", "visitor_output_setup(VAR_0, NULL);", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
18,785
static int qemu_reset_requested(void) { int r = reset_requested; reset_requested = 0; return r; }
false
qemu
8bd7f71d794b93ce027b856f5b79a98f4f82e44c
static int qemu_reset_requested(void) { int r = reset_requested; reset_requested = 0; return r; }
{ "code": [], "line_no": [] }
static int FUNC_0(void) { int VAR_0 = reset_requested; reset_requested = 0; return VAR_0; }
[ "static int FUNC_0(void)\n{", "int VAR_0 = reset_requested;", "reset_requested = 0;", "return VAR_0;", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ] ]
18,786
void cpu_interrupt(CPUState *s) { s->interrupt_request = 1; }
false
qemu
83479e770d31e171232a82f4eee7dab06d3b219c
void cpu_interrupt(CPUState *s) { s->interrupt_request = 1; }
{ "code": [], "line_no": [] }
void FUNC_0(CPUState *VAR_0) { VAR_0->interrupt_request = 1; }
[ "void FUNC_0(CPUState *VAR_0)\n{", "VAR_0->interrupt_request = 1;", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
18,787
static void test_io_channel_setup_async(SocketAddressLegacy *listen_addr, SocketAddressLegacy *connect_addr, QIOChannel **src, QIOChannel **dst) { QIOChannelSocket *lioc; struct TestIOChannelData data; data.loop = g_main_loop_new(g_main_context_default(), TRUE); lioc = qio_channel_socket_new(); qio_channel_socket_listen_async( lioc, listen_addr, test_io_channel_complete, &data, NULL); g_main_loop_run(data.loop); g_main_context_iteration(g_main_context_default(), FALSE); g_assert(!data.err); if (listen_addr->type == SOCKET_ADDRESS_LEGACY_KIND_INET) { SocketAddressLegacy *laddr = qio_channel_socket_get_local_address( lioc, &error_abort); g_free(connect_addr->u.inet.data->port); connect_addr->u.inet.data->port = g_strdup(laddr->u.inet.data->port); qapi_free_SocketAddressLegacy(laddr); } *src = QIO_CHANNEL(qio_channel_socket_new()); qio_channel_socket_connect_async( QIO_CHANNEL_SOCKET(*src), connect_addr, test_io_channel_complete, &data, NULL); g_main_loop_run(data.loop); g_main_context_iteration(g_main_context_default(), FALSE); g_assert(!data.err); qio_channel_wait(QIO_CHANNEL(lioc), G_IO_IN); *dst = QIO_CHANNEL(qio_channel_socket_accept(lioc, &error_abort)); g_assert(*dst); qio_channel_set_delay(*src, false); test_io_channel_set_socket_bufs(*src, *dst); object_unref(OBJECT(lioc)); g_main_loop_unref(data.loop); }
false
qemu
bd269ebc82fbaa5fe7ce5bc7c1770ac8acecd884
static void test_io_channel_setup_async(SocketAddressLegacy *listen_addr, SocketAddressLegacy *connect_addr, QIOChannel **src, QIOChannel **dst) { QIOChannelSocket *lioc; struct TestIOChannelData data; data.loop = g_main_loop_new(g_main_context_default(), TRUE); lioc = qio_channel_socket_new(); qio_channel_socket_listen_async( lioc, listen_addr, test_io_channel_complete, &data, NULL); g_main_loop_run(data.loop); g_main_context_iteration(g_main_context_default(), FALSE); g_assert(!data.err); if (listen_addr->type == SOCKET_ADDRESS_LEGACY_KIND_INET) { SocketAddressLegacy *laddr = qio_channel_socket_get_local_address( lioc, &error_abort); g_free(connect_addr->u.inet.data->port); connect_addr->u.inet.data->port = g_strdup(laddr->u.inet.data->port); qapi_free_SocketAddressLegacy(laddr); } *src = QIO_CHANNEL(qio_channel_socket_new()); qio_channel_socket_connect_async( QIO_CHANNEL_SOCKET(*src), connect_addr, test_io_channel_complete, &data, NULL); g_main_loop_run(data.loop); g_main_context_iteration(g_main_context_default(), FALSE); g_assert(!data.err); qio_channel_wait(QIO_CHANNEL(lioc), G_IO_IN); *dst = QIO_CHANNEL(qio_channel_socket_accept(lioc, &error_abort)); g_assert(*dst); qio_channel_set_delay(*src, false); test_io_channel_set_socket_bufs(*src, *dst); object_unref(OBJECT(lioc)); g_main_loop_unref(data.loop); }
{ "code": [], "line_no": [] }
static void FUNC_0(SocketAddressLegacy *VAR_0, SocketAddressLegacy *VAR_1, QIOChannel **VAR_2, QIOChannel **VAR_3) { QIOChannelSocket *lioc; struct TestIOChannelData VAR_4; VAR_4.loop = g_main_loop_new(g_main_context_default(), TRUE); lioc = qio_channel_socket_new(); qio_channel_socket_listen_async( lioc, VAR_0, test_io_channel_complete, &VAR_4, NULL); g_main_loop_run(VAR_4.loop); g_main_context_iteration(g_main_context_default(), FALSE); g_assert(!VAR_4.err); if (VAR_0->type == SOCKET_ADDRESS_LEGACY_KIND_INET) { SocketAddressLegacy *laddr = qio_channel_socket_get_local_address( lioc, &error_abort); g_free(VAR_1->u.inet.VAR_4->port); VAR_1->u.inet.VAR_4->port = g_strdup(laddr->u.inet.VAR_4->port); qapi_free_SocketAddressLegacy(laddr); } *VAR_2 = QIO_CHANNEL(qio_channel_socket_new()); qio_channel_socket_connect_async( QIO_CHANNEL_SOCKET(*VAR_2), VAR_1, test_io_channel_complete, &VAR_4, NULL); g_main_loop_run(VAR_4.loop); g_main_context_iteration(g_main_context_default(), FALSE); g_assert(!VAR_4.err); qio_channel_wait(QIO_CHANNEL(lioc), G_IO_IN); *VAR_3 = QIO_CHANNEL(qio_channel_socket_accept(lioc, &error_abort)); g_assert(*VAR_3); qio_channel_set_delay(*VAR_2, false); test_io_channel_set_socket_bufs(*VAR_2, *VAR_3); object_unref(OBJECT(lioc)); g_main_loop_unref(VAR_4.loop); }
[ "static void FUNC_0(SocketAddressLegacy *VAR_0,\nSocketAddressLegacy *VAR_1,\nQIOChannel **VAR_2,\nQIOChannel **VAR_3)\n{", "QIOChannelSocket *lioc;", "struct TestIOChannelData VAR_4;", "VAR_4.loop = g_main_loop_new(g_main_context_default(),\nTRUE);", "lioc = qio_channel_socket_new();", "qio_channel_socket_listen_async(\nlioc, VAR_0,\ntest_io_channel_complete, &VAR_4, NULL);", "g_main_loop_run(VAR_4.loop);", "g_main_context_iteration(g_main_context_default(), FALSE);", "g_assert(!VAR_4.err);", "if (VAR_0->type == SOCKET_ADDRESS_LEGACY_KIND_INET) {", "SocketAddressLegacy *laddr = qio_channel_socket_get_local_address(\nlioc, &error_abort);", "g_free(VAR_1->u.inet.VAR_4->port);", "VAR_1->u.inet.VAR_4->port = g_strdup(laddr->u.inet.VAR_4->port);", "qapi_free_SocketAddressLegacy(laddr);", "}", "*VAR_2 = QIO_CHANNEL(qio_channel_socket_new());", "qio_channel_socket_connect_async(\nQIO_CHANNEL_SOCKET(*VAR_2), VAR_1,\ntest_io_channel_complete, &VAR_4, NULL);", "g_main_loop_run(VAR_4.loop);", "g_main_context_iteration(g_main_context_default(), FALSE);", "g_assert(!VAR_4.err);", "qio_channel_wait(QIO_CHANNEL(lioc), G_IO_IN);", "*VAR_3 = QIO_CHANNEL(qio_channel_socket_accept(lioc, &error_abort));", "g_assert(*VAR_3);", "qio_channel_set_delay(*VAR_2, false);", "test_io_channel_set_socket_bufs(*VAR_2, *VAR_3);", "object_unref(OBJECT(lioc));", "g_main_loop_unref(VAR_4.loop);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 17, 19 ], [ 23 ], [ 25, 27, 29 ], [ 33 ], [ 35 ], [ 39 ], [ 43 ], [ 45, 47 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 63 ], [ 67, 69, 71 ], [ 75 ], [ 77 ], [ 81 ], [ 85 ], [ 87 ], [ 89 ], [ 93 ], [ 95 ], [ 99 ], [ 103 ], [ 105 ] ]
18,788
static int send_palette_rect(VncState *vs, int w, int h, struct QDict *palette) { int stream = 2; int level = tight_conf[vs->tight_compression].idx_zlib_level; int colors; size_t bytes; colors = qdict_size(palette); vnc_write_u8(vs, (stream | VNC_TIGHT_EXPLICIT_FILTER) << 4); vnc_write_u8(vs, VNC_TIGHT_FILTER_PALETTE); vnc_write_u8(vs, colors - 1); switch(vs->clientds.pf.bytes_per_pixel) { case 4: { size_t old_offset, offset; uint32_t header[qdict_size(palette)]; struct palette_cb_priv priv = { vs, (uint8_t *)header }; old_offset = vs->output.offset; qdict_iter(palette, write_palette, &priv); vnc_write(vs, header, sizeof(header)); if (vs->tight_pixel24) { tight_pack24(vs, vs->output.buffer + old_offset, colors, &offset); vs->output.offset = old_offset + offset; } tight_encode_indexed_rect32(vs->tight.buffer, w * h, palette); break; } case 2: { uint16_t header[qdict_size(palette)]; struct palette_cb_priv priv = { vs, (uint8_t *)header }; qdict_iter(palette, write_palette, &priv); vnc_write(vs, header, sizeof(header)); tight_encode_indexed_rect16(vs->tight.buffer, w * h, palette); break; } default: return -1; /* No palette for 8bits colors */ break; } bytes = w * h; vs->tight.offset = bytes; bytes = tight_compress_data(vs, stream, bytes, level, Z_DEFAULT_STRATEGY); return (bytes >= 0); }
false
qemu
245f7b51c0ea04fb2224b1127430a096c91aee70
static int send_palette_rect(VncState *vs, int w, int h, struct QDict *palette) { int stream = 2; int level = tight_conf[vs->tight_compression].idx_zlib_level; int colors; size_t bytes; colors = qdict_size(palette); vnc_write_u8(vs, (stream | VNC_TIGHT_EXPLICIT_FILTER) << 4); vnc_write_u8(vs, VNC_TIGHT_FILTER_PALETTE); vnc_write_u8(vs, colors - 1); switch(vs->clientds.pf.bytes_per_pixel) { case 4: { size_t old_offset, offset; uint32_t header[qdict_size(palette)]; struct palette_cb_priv priv = { vs, (uint8_t *)header }; old_offset = vs->output.offset; qdict_iter(palette, write_palette, &priv); vnc_write(vs, header, sizeof(header)); if (vs->tight_pixel24) { tight_pack24(vs, vs->output.buffer + old_offset, colors, &offset); vs->output.offset = old_offset + offset; } tight_encode_indexed_rect32(vs->tight.buffer, w * h, palette); break; } case 2: { uint16_t header[qdict_size(palette)]; struct palette_cb_priv priv = { vs, (uint8_t *)header }; qdict_iter(palette, write_palette, &priv); vnc_write(vs, header, sizeof(header)); tight_encode_indexed_rect16(vs->tight.buffer, w * h, palette); break; } default: return -1; break; } bytes = w * h; vs->tight.offset = bytes; bytes = tight_compress_data(vs, stream, bytes, level, Z_DEFAULT_STRATEGY); return (bytes >= 0); }
{ "code": [], "line_no": [] }
static int FUNC_0(VncState *VAR_0, int VAR_1, int VAR_2, struct QDict *VAR_3) { int VAR_4 = 2; int VAR_5 = tight_conf[VAR_0->tight_compression].idx_zlib_level; int VAR_6; size_t bytes; VAR_6 = qdict_size(VAR_3); vnc_write_u8(VAR_0, (VAR_4 | VNC_TIGHT_EXPLICIT_FILTER) << 4); vnc_write_u8(VAR_0, VNC_TIGHT_FILTER_PALETTE); vnc_write_u8(VAR_0, VAR_6 - 1); switch(VAR_0->clientds.pf.bytes_per_pixel) { case 4: { size_t old_offset, offset; uint32_t header[qdict_size(VAR_3)]; struct palette_cb_priv VAR_8 = { VAR_0, (uint8_t *)header }; old_offset = VAR_0->output.offset; qdict_iter(VAR_3, write_palette, &VAR_8); vnc_write(VAR_0, header, sizeof(header)); if (VAR_0->tight_pixel24) { tight_pack24(VAR_0, VAR_0->output.buffer + old_offset, VAR_6, &offset); VAR_0->output.offset = old_offset + offset; } tight_encode_indexed_rect32(VAR_0->tight.buffer, VAR_1 * VAR_2, VAR_3); break; } case 2: { uint16_t header[qdict_size(VAR_3)]; struct palette_cb_priv VAR_8 = { VAR_0, (uint8_t *)header }; qdict_iter(VAR_3, write_palette, &VAR_8); vnc_write(VAR_0, header, sizeof(header)); tight_encode_indexed_rect16(VAR_0->tight.buffer, VAR_1 * VAR_2, VAR_3); break; } default: return -1; break; } bytes = VAR_1 * VAR_2; VAR_0->tight.offset = bytes; bytes = tight_compress_data(VAR_0, VAR_4, bytes, VAR_5, Z_DEFAULT_STRATEGY); return (bytes >= 0); }
[ "static int FUNC_0(VncState *VAR_0, int VAR_1, int VAR_2, struct QDict *VAR_3)\n{", "int VAR_4 = 2;", "int VAR_5 = tight_conf[VAR_0->tight_compression].idx_zlib_level;", "int VAR_6;", "size_t bytes;", "VAR_6 = qdict_size(VAR_3);", "vnc_write_u8(VAR_0, (VAR_4 | VNC_TIGHT_EXPLICIT_FILTER) << 4);", "vnc_write_u8(VAR_0, VNC_TIGHT_FILTER_PALETTE);", "vnc_write_u8(VAR_0, VAR_6 - 1);", "switch(VAR_0->clientds.pf.bytes_per_pixel) {", "case 4:\n{", "size_t old_offset, offset;", "uint32_t header[qdict_size(VAR_3)];", "struct palette_cb_priv VAR_8 = { VAR_0, (uint8_t *)header };", "old_offset = VAR_0->output.offset;", "qdict_iter(VAR_3, write_palette, &VAR_8);", "vnc_write(VAR_0, header, sizeof(header));", "if (VAR_0->tight_pixel24) {", "tight_pack24(VAR_0, VAR_0->output.buffer + old_offset, VAR_6, &offset);", "VAR_0->output.offset = old_offset + offset;", "}", "tight_encode_indexed_rect32(VAR_0->tight.buffer, VAR_1 * VAR_2, VAR_3);", "break;", "}", "case 2:\n{", "uint16_t header[qdict_size(VAR_3)];", "struct palette_cb_priv VAR_8 = { VAR_0, (uint8_t *)header };", "qdict_iter(VAR_3, write_palette, &VAR_8);", "vnc_write(VAR_0, header, sizeof(header));", "tight_encode_indexed_rect16(VAR_0->tight.buffer, VAR_1 * VAR_2, VAR_3);", "break;", "}", "default:\nreturn -1;", "break;", "}", "bytes = VAR_1 * VAR_2;", "VAR_0->tight.offset = bytes;", "bytes = tight_compress_data(VAR_0, VAR_4, bytes,\nVAR_5, Z_DEFAULT_STRATEGY);", "return (bytes >= 0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 27 ], [ 29, 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65, 67 ], [ 69 ], [ 71 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85, 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99, 101 ], [ 103 ], [ 105 ] ]
18,789
static inline ioreq_t *xen_vcpu_ioreq(shared_iopage_t *shared_page, int vcpu) { return &shared_page->vcpu_iodata[vcpu].vp_ioreq; }
false
qemu
47d3df2387ed6927732584ffa4159c26d9f4dee8
static inline ioreq_t *xen_vcpu_ioreq(shared_iopage_t *shared_page, int vcpu) { return &shared_page->vcpu_iodata[vcpu].vp_ioreq; }
{ "code": [], "line_no": [] }
static inline ioreq_t *FUNC_0(shared_iopage_t *shared_page, int vcpu) { return &shared_page->vcpu_iodata[vcpu].vp_ioreq; }
[ "static inline ioreq_t *FUNC_0(shared_iopage_t *shared_page, int vcpu)\n{", "return &shared_page->vcpu_iodata[vcpu].vp_ioreq;", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
18,790
static void cirrus_bitblt_fill_nop(CirrusVGAState *s, uint8_t *dst, int dstpitch, int bltwidth,int bltheight) { }
false
qemu
026aeffcb4752054830ba203020ed6eb05bcaba8
static void cirrus_bitblt_fill_nop(CirrusVGAState *s, uint8_t *dst, int dstpitch, int bltwidth,int bltheight) { }
{ "code": [], "line_no": [] }
static void FUNC_0(CirrusVGAState *VAR_0, uint8_t *VAR_1, int VAR_2, int VAR_3,int VAR_4) { }
[ "static void FUNC_0(CirrusVGAState *VAR_0,\nuint8_t *VAR_1,\nint VAR_2, int VAR_3,int VAR_4)\n{", "}" ]
[ 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ] ]
18,791
static int copy_parameter_set(void **to, void **from, int count, int size) { int i; for (i = 0; i < count; i++) { if (to[i] && !from[i]) { av_freep(&to[i]); } else if (from[i] && !to[i]) { to[i] = av_malloc(size); if (!to[i]) return AVERROR(ENOMEM); } if (from[i]) memcpy(to[i], from[i], size); } return 0; }
false
FFmpeg
3176217c60ca7828712985092d9102d331ea4f3d
static int copy_parameter_set(void **to, void **from, int count, int size) { int i; for (i = 0; i < count; i++) { if (to[i] && !from[i]) { av_freep(&to[i]); } else if (from[i] && !to[i]) { to[i] = av_malloc(size); if (!to[i]) return AVERROR(ENOMEM); } if (from[i]) memcpy(to[i], from[i], size); } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(void **VAR_0, void **VAR_1, int VAR_2, int VAR_3) { int VAR_4; for (VAR_4 = 0; VAR_4 < VAR_2; VAR_4++) { if (VAR_0[VAR_4] && !VAR_1[VAR_4]) { av_freep(&VAR_0[VAR_4]); } else if (VAR_1[VAR_4] && !VAR_0[VAR_4]) { VAR_0[VAR_4] = av_malloc(VAR_3); if (!VAR_0[VAR_4]) return AVERROR(ENOMEM); } if (VAR_1[VAR_4]) memcpy(VAR_0[VAR_4], VAR_1[VAR_4], VAR_3); } return 0; }
[ "static int FUNC_0(void **VAR_0, void **VAR_1, int VAR_2, int VAR_3)\n{", "int VAR_4;", "for (VAR_4 = 0; VAR_4 < VAR_2; VAR_4++) {", "if (VAR_0[VAR_4] && !VAR_1[VAR_4]) {", "av_freep(&VAR_0[VAR_4]);", "} else if (VAR_1[VAR_4] && !VAR_0[VAR_4]) {", "VAR_0[VAR_4] = av_malloc(VAR_3);", "if (!VAR_0[VAR_4])\nreturn AVERROR(ENOMEM);", "}", "if (VAR_1[VAR_4])\nmemcpy(VAR_0[VAR_4], VAR_1[VAR_4], VAR_3);", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19, 21 ], [ 23 ], [ 27, 29 ], [ 31 ], [ 35 ], [ 37 ] ]
18,792
static int i2c_slave_qdev_init(DeviceState *dev) { I2CSlave *s = I2C_SLAVE(dev); I2CSlaveClass *sc = I2C_SLAVE_GET_CLASS(s); return sc->init(s); }
false
qemu
9e41bade85ef338afd983c109368d1bbbe931f80
static int i2c_slave_qdev_init(DeviceState *dev) { I2CSlave *s = I2C_SLAVE(dev); I2CSlaveClass *sc = I2C_SLAVE_GET_CLASS(s); return sc->init(s); }
{ "code": [], "line_no": [] }
static int FUNC_0(DeviceState *VAR_0) { I2CSlave *s = I2C_SLAVE(VAR_0); I2CSlaveClass *sc = I2C_SLAVE_GET_CLASS(s); return sc->init(s); }
[ "static int FUNC_0(DeviceState *VAR_0)\n{", "I2CSlave *s = I2C_SLAVE(VAR_0);", "I2CSlaveClass *sc = I2C_SLAVE_GET_CLASS(s);", "return sc->init(s);", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ] ]
18,793
static void vtd_iommu_replay(MemoryRegion *mr, IOMMUNotifier *n) { VTDAddressSpace *vtd_as = container_of(mr, VTDAddressSpace, iommu); IntelIOMMUState *s = vtd_as->iommu_state; uint8_t bus_n = pci_bus_num(vtd_as->bus); VTDContextEntry ce; if (vtd_dev_to_context_entry(s, bus_n, vtd_as->devfn, &ce) == 0) { /* * Scanned a valid context entry, walk over the pages and * notify when needed. */ trace_vtd_replay_ce_valid(bus_n, PCI_SLOT(vtd_as->devfn), PCI_FUNC(vtd_as->devfn), VTD_CONTEXT_ENTRY_DID(ce.hi), ce.hi, ce.lo); vtd_page_walk(&ce, 0, ~0ULL, vtd_replay_hook, (void *)n); } else { trace_vtd_replay_ce_invalid(bus_n, PCI_SLOT(vtd_as->devfn), PCI_FUNC(vtd_as->devfn)); } return; }
false
qemu
dd4d607e40dcd2cb7646b510504880a70939d91b
static void vtd_iommu_replay(MemoryRegion *mr, IOMMUNotifier *n) { VTDAddressSpace *vtd_as = container_of(mr, VTDAddressSpace, iommu); IntelIOMMUState *s = vtd_as->iommu_state; uint8_t bus_n = pci_bus_num(vtd_as->bus); VTDContextEntry ce; if (vtd_dev_to_context_entry(s, bus_n, vtd_as->devfn, &ce) == 0) { trace_vtd_replay_ce_valid(bus_n, PCI_SLOT(vtd_as->devfn), PCI_FUNC(vtd_as->devfn), VTD_CONTEXT_ENTRY_DID(ce.hi), ce.hi, ce.lo); vtd_page_walk(&ce, 0, ~0ULL, vtd_replay_hook, (void *)n); } else { trace_vtd_replay_ce_invalid(bus_n, PCI_SLOT(vtd_as->devfn), PCI_FUNC(vtd_as->devfn)); } return; }
{ "code": [], "line_no": [] }
static void FUNC_0(MemoryRegion *VAR_0, IOMMUNotifier *VAR_1) { VTDAddressSpace *vtd_as = container_of(VAR_0, VTDAddressSpace, iommu); IntelIOMMUState *s = vtd_as->iommu_state; uint8_t bus_n = pci_bus_num(vtd_as->bus); VTDContextEntry ce; if (vtd_dev_to_context_entry(s, bus_n, vtd_as->devfn, &ce) == 0) { trace_vtd_replay_ce_valid(bus_n, PCI_SLOT(vtd_as->devfn), PCI_FUNC(vtd_as->devfn), VTD_CONTEXT_ENTRY_DID(ce.hi), ce.hi, ce.lo); vtd_page_walk(&ce, 0, ~0ULL, vtd_replay_hook, (void *)VAR_1); } else { trace_vtd_replay_ce_invalid(bus_n, PCI_SLOT(vtd_as->devfn), PCI_FUNC(vtd_as->devfn)); } return; }
[ "static void FUNC_0(MemoryRegion *VAR_0, IOMMUNotifier *VAR_1)\n{", "VTDAddressSpace *vtd_as = container_of(VAR_0, VTDAddressSpace, iommu);", "IntelIOMMUState *s = vtd_as->iommu_state;", "uint8_t bus_n = pci_bus_num(vtd_as->bus);", "VTDContextEntry ce;", "if (vtd_dev_to_context_entry(s, bus_n, vtd_as->devfn, &ce) == 0) {", "trace_vtd_replay_ce_valid(bus_n, PCI_SLOT(vtd_as->devfn),\nPCI_FUNC(vtd_as->devfn),\nVTD_CONTEXT_ENTRY_DID(ce.hi),\nce.hi, ce.lo);", "vtd_page_walk(&ce, 0, ~0ULL, vtd_replay_hook, (void *)VAR_1);", "} else {", "trace_vtd_replay_ce_invalid(bus_n, PCI_SLOT(vtd_as->devfn),\nPCI_FUNC(vtd_as->devfn));", "}", "return;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 25, 27, 29, 31 ], [ 33 ], [ 35 ], [ 37, 39 ], [ 41 ], [ 45 ], [ 47 ] ]
18,794
static void monitor_protocol_emitter(Monitor *mon, QObject *data, QError *err) { QDict *qmp; trace_monitor_protocol_emitter(mon); if (!err) { /* success response */ qmp = qdict_new(); if (data) { qobject_incref(data); qdict_put_obj(qmp, "return", data); } else { /* return an empty QDict by default */ qdict_put(qmp, "return", qdict_new()); } } else { /* error response */ qmp = build_qmp_error_dict(err); } if (mon->mc->id) { qdict_put_obj(qmp, "id", mon->mc->id); mon->mc->id = NULL; } monitor_json_emitter(mon, QOBJECT(qmp)); QDECREF(qmp); }
false
qemu
710aec915d208246891b68e2ba61b54951edc508
static void monitor_protocol_emitter(Monitor *mon, QObject *data, QError *err) { QDict *qmp; trace_monitor_protocol_emitter(mon); if (!err) { qmp = qdict_new(); if (data) { qobject_incref(data); qdict_put_obj(qmp, "return", data); } else { qdict_put(qmp, "return", qdict_new()); } } else { qmp = build_qmp_error_dict(err); } if (mon->mc->id) { qdict_put_obj(qmp, "id", mon->mc->id); mon->mc->id = NULL; } monitor_json_emitter(mon, QOBJECT(qmp)); QDECREF(qmp); }
{ "code": [], "line_no": [] }
static void FUNC_0(Monitor *VAR_0, QObject *VAR_1, QError *VAR_2) { QDict *qmp; trace_monitor_protocol_emitter(VAR_0); if (!VAR_2) { qmp = qdict_new(); if (VAR_1) { qobject_incref(VAR_1); qdict_put_obj(qmp, "return", VAR_1); } else { qdict_put(qmp, "return", qdict_new()); } } else { qmp = build_qmp_error_dict(VAR_2); } if (VAR_0->mc->id) { qdict_put_obj(qmp, "id", VAR_0->mc->id); VAR_0->mc->id = NULL; } monitor_json_emitter(VAR_0, QOBJECT(qmp)); QDECREF(qmp); }
[ "static void FUNC_0(Monitor *VAR_0, QObject *VAR_1,\nQError *VAR_2)\n{", "QDict *qmp;", "trace_monitor_protocol_emitter(VAR_0);", "if (!VAR_2) {", "qmp = qdict_new();", "if (VAR_1) {", "qobject_incref(VAR_1);", "qdict_put_obj(qmp, \"return\", VAR_1);", "} else {", "qdict_put(qmp, \"return\", qdict_new());", "}", "} else {", "qmp = build_qmp_error_dict(VAR_2);", "}", "if (VAR_0->mc->id) {", "qdict_put_obj(qmp, \"id\", VAR_0->mc->id);", "VAR_0->mc->id = NULL;", "}", "monitor_json_emitter(VAR_0, QOBJECT(qmp));", "QDECREF(qmp);", "}" ]
[ 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 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ] ]
18,796
static int msi_msix_setup(XenPCIPassthroughState *s, uint64_t addr, uint32_t data, int *ppirq, bool is_msix, int msix_entry, bool is_not_mapped) { uint8_t gvec = msi_vector(data); int rc = 0; assert((!is_msix && msix_entry == 0) || is_msix); if (gvec == 0) { /* if gvec is 0, the guest is asking for a particular pirq that * is passed as dest_id */ *ppirq = msi_ext_dest_id(addr >> 32) | msi_dest_id(addr); if (!*ppirq) { /* this probably identifies an misconfiguration of the guest, * try the emulated path */ *ppirq = XEN_PT_UNASSIGNED_PIRQ; } else { XEN_PT_LOG(&s->dev, "requested pirq %d for MSI%s" " (vec: %#x, entry: %#x)\n", *ppirq, is_msix ? "-X" : "", gvec, msix_entry); } } if (is_not_mapped) { uint64_t table_base = 0; if (is_msix) { table_base = s->msix->table_base; } rc = xc_physdev_map_pirq_msi(xen_xc, xen_domid, XEN_PT_AUTO_ASSIGN, ppirq, PCI_DEVFN(s->real_device.dev, s->real_device.func), s->real_device.bus, msix_entry, table_base); if (rc) { XEN_PT_ERR(&s->dev, "Mapping of MSI%s (err: %i, vec: %#x, entry %#x)\n", is_msix ? "-X" : "", errno, gvec, msix_entry); return rc; } } return 0; }
false
qemu
428c3ece97179557f2753071fb0ca97a03437267
static int msi_msix_setup(XenPCIPassthroughState *s, uint64_t addr, uint32_t data, int *ppirq, bool is_msix, int msix_entry, bool is_not_mapped) { uint8_t gvec = msi_vector(data); int rc = 0; assert((!is_msix && msix_entry == 0) || is_msix); if (gvec == 0) { *ppirq = msi_ext_dest_id(addr >> 32) | msi_dest_id(addr); if (!*ppirq) { *ppirq = XEN_PT_UNASSIGNED_PIRQ; } else { XEN_PT_LOG(&s->dev, "requested pirq %d for MSI%s" " (vec: %#x, entry: %#x)\n", *ppirq, is_msix ? "-X" : "", gvec, msix_entry); } } if (is_not_mapped) { uint64_t table_base = 0; if (is_msix) { table_base = s->msix->table_base; } rc = xc_physdev_map_pirq_msi(xen_xc, xen_domid, XEN_PT_AUTO_ASSIGN, ppirq, PCI_DEVFN(s->real_device.dev, s->real_device.func), s->real_device.bus, msix_entry, table_base); if (rc) { XEN_PT_ERR(&s->dev, "Mapping of MSI%s (err: %i, vec: %#x, entry %#x)\n", is_msix ? "-X" : "", errno, gvec, msix_entry); return rc; } } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(XenPCIPassthroughState *VAR_0, uint64_t VAR_1, uint32_t VAR_2, int *VAR_3, bool VAR_4, int VAR_5, bool VAR_6) { uint8_t gvec = msi_vector(VAR_2); int VAR_7 = 0; assert((!VAR_4 && VAR_5 == 0) || VAR_4); if (gvec == 0) { *VAR_3 = msi_ext_dest_id(VAR_1 >> 32) | msi_dest_id(VAR_1); if (!*VAR_3) { *VAR_3 = XEN_PT_UNASSIGNED_PIRQ; } else { XEN_PT_LOG(&VAR_0->dev, "requested pirq %d for MSI%VAR_0" " (vec: %#x, entry: %#x)\n", *VAR_3, VAR_4 ? "-X" : "", gvec, VAR_5); } } if (VAR_6) { uint64_t table_base = 0; if (VAR_4) { table_base = VAR_0->msix->table_base; } VAR_7 = xc_physdev_map_pirq_msi(xen_xc, xen_domid, XEN_PT_AUTO_ASSIGN, VAR_3, PCI_DEVFN(VAR_0->real_device.dev, VAR_0->real_device.func), VAR_0->real_device.bus, VAR_5, table_base); if (VAR_7) { XEN_PT_ERR(&VAR_0->dev, "Mapping of MSI%VAR_0 (err: %i, vec: %#x, entry %#x)\n", VAR_4 ? "-X" : "", errno, gvec, VAR_5); return VAR_7; } } return 0; }
[ "static int FUNC_0(XenPCIPassthroughState *VAR_0,\nuint64_t VAR_1,\nuint32_t VAR_2,\nint *VAR_3,\nbool VAR_4,\nint VAR_5,\nbool VAR_6)\n{", "uint8_t gvec = msi_vector(VAR_2);", "int VAR_7 = 0;", "assert((!VAR_4 && VAR_5 == 0) || VAR_4);", "if (gvec == 0) {", "*VAR_3 = msi_ext_dest_id(VAR_1 >> 32) | msi_dest_id(VAR_1);", "if (!*VAR_3) {", "*VAR_3 = XEN_PT_UNASSIGNED_PIRQ;", "} else {", "XEN_PT_LOG(&VAR_0->dev, \"requested pirq %d for MSI%VAR_0\"\n\" (vec: %#x, entry: %#x)\\n\",\n*VAR_3, VAR_4 ? \"-X\" : \"\", gvec, VAR_5);", "}", "}", "if (VAR_6) {", "uint64_t table_base = 0;", "if (VAR_4) {", "table_base = VAR_0->msix->table_base;", "}", "VAR_7 = xc_physdev_map_pirq_msi(xen_xc, xen_domid, XEN_PT_AUTO_ASSIGN,\nVAR_3, PCI_DEVFN(VAR_0->real_device.dev,\nVAR_0->real_device.func),\nVAR_0->real_device.bus,\nVAR_5, table_base);", "if (VAR_7) {", "XEN_PT_ERR(&VAR_0->dev,\n\"Mapping of MSI%VAR_0 (err: %i, vec: %#x, entry %#x)\\n\",\nVAR_4 ? \"-X\" : \"\", errno, gvec, VAR_5);", "return VAR_7;", "}", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11, 13, 15 ], [ 17 ], [ 19 ], [ 23 ], [ 27 ], [ 33 ], [ 35 ], [ 41 ], [ 43 ], [ 45, 47, 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 71, 73, 75, 77, 79 ], [ 81 ], [ 83, 85, 87 ], [ 89 ], [ 91 ], [ 93 ], [ 97 ], [ 99 ] ]
18,797
void virtio_net_set_config_size(VirtIONet *n, uint32_t host_features) { int i, config_size = 0; host_features |= (1 << VIRTIO_NET_F_MAC); for (i = 0; feature_sizes[i].flags != 0; i++) { if (host_features & feature_sizes[i].flags) { config_size = MAX(feature_sizes[i].end, config_size); } } n->config_size = config_size; }
false
qemu
0cd09c3a6cc2230ba38c462fc410b4acce59eb6f
void virtio_net_set_config_size(VirtIONet *n, uint32_t host_features) { int i, config_size = 0; host_features |= (1 << VIRTIO_NET_F_MAC); for (i = 0; feature_sizes[i].flags != 0; i++) { if (host_features & feature_sizes[i].flags) { config_size = MAX(feature_sizes[i].end, config_size); } } n->config_size = config_size; }
{ "code": [], "line_no": [] }
void FUNC_0(VirtIONet *VAR_0, uint32_t VAR_1) { int VAR_2, VAR_3 = 0; VAR_1 |= (1 << VIRTIO_NET_F_MAC); for (VAR_2 = 0; feature_sizes[VAR_2].flags != 0; VAR_2++) { if (VAR_1 & feature_sizes[VAR_2].flags) { VAR_3 = MAX(feature_sizes[VAR_2].end, VAR_3); } } VAR_0->VAR_3 = VAR_3; }
[ "void FUNC_0(VirtIONet *VAR_0, uint32_t VAR_1)\n{", "int VAR_2, VAR_3 = 0;", "VAR_1 |= (1 << VIRTIO_NET_F_MAC);", "for (VAR_2 = 0; feature_sizes[VAR_2].flags != 0; VAR_2++) {", "if (VAR_1 & feature_sizes[VAR_2].flags) {", "VAR_3 = MAX(feature_sizes[VAR_2].end, VAR_3);", "}", "}", "VAR_0->VAR_3 = VAR_3;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
18,798
static void virtio_pci_vmstate_change(DeviceState *d, bool running) { VirtIOPCIProxy *proxy = to_virtio_pci_proxy(d); VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus); if (running) { /* Try to find out if the guest has bus master disabled, but is in ready state. Then we have a buggy guest OS. */ if ((vdev->status & VIRTIO_CONFIG_S_DRIVER_OK) && !(proxy->pci_dev.config[PCI_COMMAND] & PCI_COMMAND_MASTER)) { proxy->flags |= VIRTIO_PCI_FLAG_BUS_MASTER_BUG; } virtio_pci_start_ioeventfd(proxy); } else { virtio_pci_stop_ioeventfd(proxy); } }
false
qemu
4d43d3f3c8147ade184df9a1e9e82826edd39e19
static void virtio_pci_vmstate_change(DeviceState *d, bool running) { VirtIOPCIProxy *proxy = to_virtio_pci_proxy(d); VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus); if (running) { if ((vdev->status & VIRTIO_CONFIG_S_DRIVER_OK) && !(proxy->pci_dev.config[PCI_COMMAND] & PCI_COMMAND_MASTER)) { proxy->flags |= VIRTIO_PCI_FLAG_BUS_MASTER_BUG; } virtio_pci_start_ioeventfd(proxy); } else { virtio_pci_stop_ioeventfd(proxy); } }
{ "code": [], "line_no": [] }
static void FUNC_0(DeviceState *VAR_0, bool VAR_1) { VirtIOPCIProxy *proxy = to_virtio_pci_proxy(VAR_0); VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus); if (VAR_1) { if ((vdev->status & VIRTIO_CONFIG_S_DRIVER_OK) && !(proxy->pci_dev.config[PCI_COMMAND] & PCI_COMMAND_MASTER)) { proxy->flags |= VIRTIO_PCI_FLAG_BUS_MASTER_BUG; } virtio_pci_start_ioeventfd(proxy); } else { virtio_pci_stop_ioeventfd(proxy); } }
[ "static void FUNC_0(DeviceState *VAR_0, bool VAR_1)\n{", "VirtIOPCIProxy *proxy = to_virtio_pci_proxy(VAR_0);", "VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus);", "if (VAR_1) {", "if ((vdev->status & VIRTIO_CONFIG_S_DRIVER_OK) &&\n!(proxy->pci_dev.config[PCI_COMMAND] & PCI_COMMAND_MASTER)) {", "proxy->flags |= VIRTIO_PCI_FLAG_BUS_MASTER_BUG;", "}", "virtio_pci_start_ioeventfd(proxy);", "} else {", "virtio_pci_stop_ioeventfd(proxy);", "}", "}" ]
[ 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 ] ]
18,800
static void ide_dma_cb(void *opaque, int ret) { IDEState *s = opaque; int n; int64_t sector_num; uint64_t offset; bool stay_active = false; if (ret == -ECANCELED) { return; } if (ret < 0) { if (ide_handle_rw_error(s, -ret, ide_dma_cmd_to_retry(s->dma_cmd))) { s->bus->dma->aiocb = NULL; dma_buf_commit(s, 0); return; } } n = s->io_buffer_size >> 9; if (n > s->nsector) { /* The PRDs were longer than needed for this request. Shorten them so * we don't get a negative remainder. The Active bit must remain set * after the request completes. */ n = s->nsector; stay_active = true; } sector_num = ide_get_sector(s); if (n > 0) { assert(n * 512 == s->sg.size); dma_buf_commit(s, s->sg.size); sector_num += n; ide_set_sector(s, sector_num); s->nsector -= n; } /* end of transfer ? */ if (s->nsector == 0) { s->status = READY_STAT | SEEK_STAT; ide_set_irq(s->bus); goto eot; } /* launch next transfer */ n = s->nsector; s->io_buffer_index = 0; s->io_buffer_size = n * 512; if (s->bus->dma->ops->prepare_buf(s->bus->dma, s->io_buffer_size) < 512) { /* The PRDs were too short. Reset the Active bit, but don't raise an * interrupt. */ s->status = READY_STAT | SEEK_STAT; dma_buf_commit(s, 0); goto eot; } trace_ide_dma_cb(s, sector_num, n, IDE_DMA_CMD_str(s->dma_cmd)); if ((s->dma_cmd == IDE_DMA_READ || s->dma_cmd == IDE_DMA_WRITE) && !ide_sect_range_ok(s, sector_num, n)) { ide_dma_error(s); block_acct_invalid(blk_get_stats(s->blk), s->acct.type); return; } offset = sector_num << BDRV_SECTOR_BITS; switch (s->dma_cmd) { case IDE_DMA_READ: s->bus->dma->aiocb = dma_blk_read(s->blk, &s->sg, offset, BDRV_SECTOR_SIZE, ide_dma_cb, s); break; case IDE_DMA_WRITE: s->bus->dma->aiocb = dma_blk_write(s->blk, &s->sg, offset, BDRV_SECTOR_SIZE, ide_dma_cb, s); break; case IDE_DMA_TRIM: s->bus->dma->aiocb = dma_blk_io(blk_get_aio_context(s->blk), &s->sg, offset, BDRV_SECTOR_SIZE, ide_issue_trim, s->blk, ide_dma_cb, s, DMA_DIRECTION_TO_DEVICE); break; default: abort(); } return; eot: if (s->dma_cmd == IDE_DMA_READ || s->dma_cmd == IDE_DMA_WRITE) { block_acct_done(blk_get_stats(s->blk), &s->acct); } ide_set_inactive(s, stay_active); }
false
qemu
ef0e64a9838c0a20b5cb8a0bd2dcbcc59b0b812d
static void ide_dma_cb(void *opaque, int ret) { IDEState *s = opaque; int n; int64_t sector_num; uint64_t offset; bool stay_active = false; if (ret == -ECANCELED) { return; } if (ret < 0) { if (ide_handle_rw_error(s, -ret, ide_dma_cmd_to_retry(s->dma_cmd))) { s->bus->dma->aiocb = NULL; dma_buf_commit(s, 0); return; } } n = s->io_buffer_size >> 9; if (n > s->nsector) { n = s->nsector; stay_active = true; } sector_num = ide_get_sector(s); if (n > 0) { assert(n * 512 == s->sg.size); dma_buf_commit(s, s->sg.size); sector_num += n; ide_set_sector(s, sector_num); s->nsector -= n; } if (s->nsector == 0) { s->status = READY_STAT | SEEK_STAT; ide_set_irq(s->bus); goto eot; } n = s->nsector; s->io_buffer_index = 0; s->io_buffer_size = n * 512; if (s->bus->dma->ops->prepare_buf(s->bus->dma, s->io_buffer_size) < 512) { s->status = READY_STAT | SEEK_STAT; dma_buf_commit(s, 0); goto eot; } trace_ide_dma_cb(s, sector_num, n, IDE_DMA_CMD_str(s->dma_cmd)); if ((s->dma_cmd == IDE_DMA_READ || s->dma_cmd == IDE_DMA_WRITE) && !ide_sect_range_ok(s, sector_num, n)) { ide_dma_error(s); block_acct_invalid(blk_get_stats(s->blk), s->acct.type); return; } offset = sector_num << BDRV_SECTOR_BITS; switch (s->dma_cmd) { case IDE_DMA_READ: s->bus->dma->aiocb = dma_blk_read(s->blk, &s->sg, offset, BDRV_SECTOR_SIZE, ide_dma_cb, s); break; case IDE_DMA_WRITE: s->bus->dma->aiocb = dma_blk_write(s->blk, &s->sg, offset, BDRV_SECTOR_SIZE, ide_dma_cb, s); break; case IDE_DMA_TRIM: s->bus->dma->aiocb = dma_blk_io(blk_get_aio_context(s->blk), &s->sg, offset, BDRV_SECTOR_SIZE, ide_issue_trim, s->blk, ide_dma_cb, s, DMA_DIRECTION_TO_DEVICE); break; default: abort(); } return; eot: if (s->dma_cmd == IDE_DMA_READ || s->dma_cmd == IDE_DMA_WRITE) { block_acct_done(blk_get_stats(s->blk), &s->acct); } ide_set_inactive(s, stay_active); }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, int VAR_1) { IDEState *s = VAR_0; int VAR_2; int64_t sector_num; uint64_t offset; bool stay_active = false; if (VAR_1 == -ECANCELED) { return; } if (VAR_1 < 0) { if (ide_handle_rw_error(s, -VAR_1, ide_dma_cmd_to_retry(s->dma_cmd))) { s->bus->dma->aiocb = NULL; dma_buf_commit(s, 0); return; } } VAR_2 = s->io_buffer_size >> 9; if (VAR_2 > s->nsector) { VAR_2 = s->nsector; stay_active = true; } sector_num = ide_get_sector(s); if (VAR_2 > 0) { assert(VAR_2 * 512 == s->sg.size); dma_buf_commit(s, s->sg.size); sector_num += VAR_2; ide_set_sector(s, sector_num); s->nsector -= VAR_2; } if (s->nsector == 0) { s->status = READY_STAT | SEEK_STAT; ide_set_irq(s->bus); goto eot; } VAR_2 = s->nsector; s->io_buffer_index = 0; s->io_buffer_size = VAR_2 * 512; if (s->bus->dma->ops->prepare_buf(s->bus->dma, s->io_buffer_size) < 512) { s->status = READY_STAT | SEEK_STAT; dma_buf_commit(s, 0); goto eot; } trace_ide_dma_cb(s, sector_num, VAR_2, IDE_DMA_CMD_str(s->dma_cmd)); if ((s->dma_cmd == IDE_DMA_READ || s->dma_cmd == IDE_DMA_WRITE) && !ide_sect_range_ok(s, sector_num, VAR_2)) { ide_dma_error(s); block_acct_invalid(blk_get_stats(s->blk), s->acct.type); return; } offset = sector_num << BDRV_SECTOR_BITS; switch (s->dma_cmd) { case IDE_DMA_READ: s->bus->dma->aiocb = dma_blk_read(s->blk, &s->sg, offset, BDRV_SECTOR_SIZE, FUNC_0, s); break; case IDE_DMA_WRITE: s->bus->dma->aiocb = dma_blk_write(s->blk, &s->sg, offset, BDRV_SECTOR_SIZE, FUNC_0, s); break; case IDE_DMA_TRIM: s->bus->dma->aiocb = dma_blk_io(blk_get_aio_context(s->blk), &s->sg, offset, BDRV_SECTOR_SIZE, ide_issue_trim, s->blk, FUNC_0, s, DMA_DIRECTION_TO_DEVICE); break; default: abort(); } return; eot: if (s->dma_cmd == IDE_DMA_READ || s->dma_cmd == IDE_DMA_WRITE) { block_acct_done(blk_get_stats(s->blk), &s->acct); } ide_set_inactive(s, stay_active); }
[ "static void FUNC_0(void *VAR_0, int VAR_1)\n{", "IDEState *s = VAR_0;", "int VAR_2;", "int64_t sector_num;", "uint64_t offset;", "bool stay_active = false;", "if (VAR_1 == -ECANCELED) {", "return;", "}", "if (VAR_1 < 0) {", "if (ide_handle_rw_error(s, -VAR_1, ide_dma_cmd_to_retry(s->dma_cmd))) {", "s->bus->dma->aiocb = NULL;", "dma_buf_commit(s, 0);", "return;", "}", "}", "VAR_2 = s->io_buffer_size >> 9;", "if (VAR_2 > s->nsector) {", "VAR_2 = s->nsector;", "stay_active = true;", "}", "sector_num = ide_get_sector(s);", "if (VAR_2 > 0) {", "assert(VAR_2 * 512 == s->sg.size);", "dma_buf_commit(s, s->sg.size);", "sector_num += VAR_2;", "ide_set_sector(s, sector_num);", "s->nsector -= VAR_2;", "}", "if (s->nsector == 0) {", "s->status = READY_STAT | SEEK_STAT;", "ide_set_irq(s->bus);", "goto eot;", "}", "VAR_2 = s->nsector;", "s->io_buffer_index = 0;", "s->io_buffer_size = VAR_2 * 512;", "if (s->bus->dma->ops->prepare_buf(s->bus->dma, s->io_buffer_size) < 512) {", "s->status = READY_STAT | SEEK_STAT;", "dma_buf_commit(s, 0);", "goto eot;", "}", "trace_ide_dma_cb(s, sector_num, VAR_2, IDE_DMA_CMD_str(s->dma_cmd));", "if ((s->dma_cmd == IDE_DMA_READ || s->dma_cmd == IDE_DMA_WRITE) &&\n!ide_sect_range_ok(s, sector_num, VAR_2)) {", "ide_dma_error(s);", "block_acct_invalid(blk_get_stats(s->blk), s->acct.type);", "return;", "}", "offset = sector_num << BDRV_SECTOR_BITS;", "switch (s->dma_cmd) {", "case IDE_DMA_READ:\ns->bus->dma->aiocb = dma_blk_read(s->blk, &s->sg, offset,\nBDRV_SECTOR_SIZE, FUNC_0, s);", "break;", "case IDE_DMA_WRITE:\ns->bus->dma->aiocb = dma_blk_write(s->blk, &s->sg, offset,\nBDRV_SECTOR_SIZE, FUNC_0, s);", "break;", "case IDE_DMA_TRIM:\ns->bus->dma->aiocb = dma_blk_io(blk_get_aio_context(s->blk),\n&s->sg, offset, BDRV_SECTOR_SIZE,\nide_issue_trim, s->blk, FUNC_0, s,\nDMA_DIRECTION_TO_DEVICE);", "break;", "default:\nabort();", "}", "return;", "eot:\nif (s->dma_cmd == IDE_DMA_READ || s->dma_cmd == IDE_DMA_WRITE) {", "block_acct_done(blk_get_stats(s->blk), &s->acct);", "}", "ide_set_inactive(s, stay_active);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 113 ], [ 117, 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 131 ], [ 133 ], [ 135, 137, 139 ], [ 141 ], [ 143, 145, 147 ], [ 149 ], [ 151, 153, 155, 157, 159 ], [ 161 ], [ 163, 165 ], [ 167 ], [ 169 ], [ 173, 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ] ]
18,801
SSIBus *ssi_create_bus(DeviceState *parent, const char *name) { BusState *bus; bus = qbus_create(BUS_TYPE_SSI, sizeof(SSIBus), parent, name); return FROM_QBUS(SSIBus, bus); }
false
qemu
10c4c98ab7dc18169b37b76f6ea5e60ebe65222b
SSIBus *ssi_create_bus(DeviceState *parent, const char *name) { BusState *bus; bus = qbus_create(BUS_TYPE_SSI, sizeof(SSIBus), parent, name); return FROM_QBUS(SSIBus, bus); }
{ "code": [], "line_no": [] }
SSIBus *FUNC_0(DeviceState *parent, const char *name) { BusState *bus; bus = qbus_create(BUS_TYPE_SSI, sizeof(SSIBus), parent, name); return FROM_QBUS(SSIBus, bus); }
[ "SSIBus *FUNC_0(DeviceState *parent, const char *name)\n{", "BusState *bus;", "bus = qbus_create(BUS_TYPE_SSI, sizeof(SSIBus), parent, name);", "return FROM_QBUS(SSIBus, bus);", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ] ]
18,802
int ff_celp_lp_synthesis_filter(int16_t *out, const int16_t* filter_coeffs, const int16_t* in, int buffer_length, int filter_length, int stop_on_overflow, int rounder) { int i,n; // Avoids a +1 in the inner loop. filter_length++; for (n = 0; n < buffer_length; n++) { int sum = rounder; for (i = 1; i < filter_length; i++) sum -= filter_coeffs[i-1] * out[n-i]; sum = (sum >> 12) + in[n]; if (sum + 0x8000 > 0xFFFFU) { if (stop_on_overflow) return 1; sum = (sum >> 31) ^ 32767; } out[n] = sum; } return 0; }
false
FFmpeg
b1ade3d1821a29174963b28cd0caa5f7ed394998
int ff_celp_lp_synthesis_filter(int16_t *out, const int16_t* filter_coeffs, const int16_t* in, int buffer_length, int filter_length, int stop_on_overflow, int rounder) { int i,n; filter_length++; for (n = 0; n < buffer_length; n++) { int sum = rounder; for (i = 1; i < filter_length; i++) sum -= filter_coeffs[i-1] * out[n-i]; sum = (sum >> 12) + in[n]; if (sum + 0x8000 > 0xFFFFU) { if (stop_on_overflow) return 1; sum = (sum >> 31) ^ 32767; } out[n] = sum; } return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(int16_t *VAR_0, const int16_t* VAR_1, const int16_t* VAR_2, int VAR_3, int VAR_4, int VAR_5, int VAR_6) { int VAR_7,VAR_8; VAR_4++; for (VAR_8 = 0; VAR_8 < VAR_3; VAR_8++) { int VAR_9 = VAR_6; for (VAR_7 = 1; VAR_7 < VAR_4; VAR_7++) VAR_9 -= VAR_1[VAR_7-1] * VAR_0[VAR_8-VAR_7]; VAR_9 = (VAR_9 >> 12) + VAR_2[VAR_8]; if (VAR_9 + 0x8000 > 0xFFFFU) { if (VAR_5) return 1; VAR_9 = (VAR_9 >> 31) ^ 32767; } VAR_0[VAR_8] = VAR_9; } return 0; }
[ "int FUNC_0(int16_t *VAR_0,\nconst int16_t* VAR_1,\nconst int16_t* VAR_2,\nint VAR_3,\nint VAR_4,\nint VAR_5,\nint VAR_6)\n{", "int VAR_7,VAR_8;", "VAR_4++;", "for (VAR_8 = 0; VAR_8 < VAR_3; VAR_8++) {", "int VAR_9 = VAR_6;", "for (VAR_7 = 1; VAR_7 < VAR_4; VAR_7++)", "VAR_9 -= VAR_1[VAR_7-1] * VAR_0[VAR_8-VAR_7];", "VAR_9 = (VAR_9 >> 12) + VAR_2[VAR_8];", "if (VAR_9 + 0x8000 > 0xFFFFU) {", "if (VAR_5)\nreturn 1;", "VAR_9 = (VAR_9 >> 31) ^ 32767;", "}", "VAR_0[VAR_8] = VAR_9;", "}", "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 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ] ]
18,803
ff_rm_parse_packet (AVFormatContext *s, AVIOContext *pb, AVStream *st, RMStream *ast, int len, AVPacket *pkt, int *seq, int flags, int64_t timestamp) { RMDemuxContext *rm = s->priv_data; int ret; if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) { rm->current_stream= st->id; ret = rm_assemble_video_frame(s, pb, rm, ast, pkt, len, seq, &timestamp); if(ret) return ret < 0 ? ret : -1; //got partial frame or error } else if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) { if ((ast->deint_id == DEINT_ID_GENR) || (ast->deint_id == DEINT_ID_INT4) || (ast->deint_id == DEINT_ID_SIPR)) { int x; int sps = ast->sub_packet_size; int cfs = ast->coded_framesize; int h = ast->sub_packet_h; int y = ast->sub_packet_cnt; int w = ast->audio_framesize; if (flags & 2) y = ast->sub_packet_cnt = 0; if (!y) ast->audiotimestamp = timestamp; switch (ast->deint_id) { case DEINT_ID_INT4: for (x = 0; x < h/2; x++) readfull(s, pb, ast->pkt.data+x*2*w+y*cfs, cfs); break; case DEINT_ID_GENR: for (x = 0; x < w/sps; x++) readfull(s, pb, ast->pkt.data+sps*(h*x+((h+1)/2)*(y&1)+(y>>1)), sps); break; case DEINT_ID_SIPR: readfull(s, pb, ast->pkt.data + y * w, w); break; } if (++(ast->sub_packet_cnt) < h) return -1; if (ast->deint_id == DEINT_ID_SIPR) ff_rm_reorder_sipr_data(ast->pkt.data, h, w); ast->sub_packet_cnt = 0; rm->audio_stream_num = st->index; rm->audio_pkt_cnt = h * w / st->codec->block_align; } else if ((ast->deint_id == DEINT_ID_VBRF) || (ast->deint_id == DEINT_ID_VBRS)) { int x; rm->audio_stream_num = st->index; ast->sub_packet_cnt = (avio_rb16(pb) & 0xf0) >> 4; if (ast->sub_packet_cnt) { for (x = 0; x < ast->sub_packet_cnt; x++) ast->sub_packet_lengths[x] = avio_rb16(pb); rm->audio_pkt_cnt = ast->sub_packet_cnt; ast->audiotimestamp = timestamp; } else return -1; } else { av_get_packet(pb, pkt, len); rm_ac3_swap_bytes(st, pkt); } } else av_get_packet(pb, pkt, len); pkt->stream_index = st->index; #if 0 if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) { if(st->codec->codec_id == AV_CODEC_ID_RV20){ int seq= 128*(pkt->data[2]&0x7F) + (pkt->data[3]>>1); av_log(s, AV_LOG_DEBUG, "%d %"PRId64" %d\n", *timestamp, *timestamp*512LL/25, seq); seq |= (timestamp&~0x3FFF); if(seq - timestamp > 0x2000) seq -= 0x4000; if(seq - timestamp < -0x2000) seq += 0x4000; } } #endif pkt->pts = timestamp; if (flags & 2) pkt->flags |= AV_PKT_FLAG_KEY; return st->codec->codec_type == AVMEDIA_TYPE_AUDIO ? rm->audio_pkt_cnt : 0; }
false
FFmpeg
65b83ce01b94eae944290c11257799a9288f2d4c
ff_rm_parse_packet (AVFormatContext *s, AVIOContext *pb, AVStream *st, RMStream *ast, int len, AVPacket *pkt, int *seq, int flags, int64_t timestamp) { RMDemuxContext *rm = s->priv_data; int ret; if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) { rm->current_stream= st->id; ret = rm_assemble_video_frame(s, pb, rm, ast, pkt, len, seq, &timestamp); if(ret) return ret < 0 ? ret : -1; } else if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) { if ((ast->deint_id == DEINT_ID_GENR) || (ast->deint_id == DEINT_ID_INT4) || (ast->deint_id == DEINT_ID_SIPR)) { int x; int sps = ast->sub_packet_size; int cfs = ast->coded_framesize; int h = ast->sub_packet_h; int y = ast->sub_packet_cnt; int w = ast->audio_framesize; if (flags & 2) y = ast->sub_packet_cnt = 0; if (!y) ast->audiotimestamp = timestamp; switch (ast->deint_id) { case DEINT_ID_INT4: for (x = 0; x < h/2; x++) readfull(s, pb, ast->pkt.data+x*2*w+y*cfs, cfs); break; case DEINT_ID_GENR: for (x = 0; x < w/sps; x++) readfull(s, pb, ast->pkt.data+sps*(h*x+((h+1)/2)*(y&1)+(y>>1)), sps); break; case DEINT_ID_SIPR: readfull(s, pb, ast->pkt.data + y * w, w); break; } if (++(ast->sub_packet_cnt) < h) return -1; if (ast->deint_id == DEINT_ID_SIPR) ff_rm_reorder_sipr_data(ast->pkt.data, h, w); ast->sub_packet_cnt = 0; rm->audio_stream_num = st->index; rm->audio_pkt_cnt = h * w / st->codec->block_align; } else if ((ast->deint_id == DEINT_ID_VBRF) || (ast->deint_id == DEINT_ID_VBRS)) { int x; rm->audio_stream_num = st->index; ast->sub_packet_cnt = (avio_rb16(pb) & 0xf0) >> 4; if (ast->sub_packet_cnt) { for (x = 0; x < ast->sub_packet_cnt; x++) ast->sub_packet_lengths[x] = avio_rb16(pb); rm->audio_pkt_cnt = ast->sub_packet_cnt; ast->audiotimestamp = timestamp; } else return -1; } else { av_get_packet(pb, pkt, len); rm_ac3_swap_bytes(st, pkt); } } else av_get_packet(pb, pkt, len); pkt->stream_index = st->index; #if 0 if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) { if(st->codec->codec_id == AV_CODEC_ID_RV20){ int seq= 128*(pkt->data[2]&0x7F) + (pkt->data[3]>>1); av_log(s, AV_LOG_DEBUG, "%d %"PRId64" %d\n", *timestamp, *timestamp*512LL/25, seq); seq |= (timestamp&~0x3FFF); if(seq - timestamp > 0x2000) seq -= 0x4000; if(seq - timestamp < -0x2000) seq += 0x4000; } } #endif pkt->pts = timestamp; if (flags & 2) pkt->flags |= AV_PKT_FLAG_KEY; return st->codec->codec_type == AVMEDIA_TYPE_AUDIO ? rm->audio_pkt_cnt : 0; }
{ "code": [], "line_no": [] }
FUNC_0 (AVFormatContext *VAR_0, AVIOContext *VAR_1, AVStream *VAR_2, RMStream *VAR_3, int VAR_4, AVPacket *VAR_5, int *VAR_6, int VAR_7, int64_t VAR_8) { RMDemuxContext *rm = VAR_0->priv_data; int VAR_9; if (VAR_2->codec->codec_type == AVMEDIA_TYPE_VIDEO) { rm->current_stream= VAR_2->id; VAR_9 = rm_assemble_video_frame(VAR_0, VAR_1, rm, VAR_3, VAR_5, VAR_4, VAR_6, &VAR_8); if(VAR_9) return VAR_9 < 0 ? VAR_9 : -1; } else if (VAR_2->codec->codec_type == AVMEDIA_TYPE_AUDIO) { if ((VAR_3->deint_id == DEINT_ID_GENR) || (VAR_3->deint_id == DEINT_ID_INT4) || (VAR_3->deint_id == DEINT_ID_SIPR)) { int VAR_16; int VAR_11 = VAR_3->sub_packet_size; int VAR_12 = VAR_3->coded_framesize; int VAR_13 = VAR_3->sub_packet_h; int VAR_14 = VAR_3->sub_packet_cnt; int VAR_15 = VAR_3->audio_framesize; if (VAR_7 & 2) VAR_14 = VAR_3->sub_packet_cnt = 0; if (!VAR_14) VAR_3->audiotimestamp = VAR_8; switch (VAR_3->deint_id) { case DEINT_ID_INT4: for (VAR_16 = 0; VAR_16 < VAR_13/2; VAR_16++) readfull(VAR_0, VAR_1, VAR_3->VAR_5.data+VAR_16*2*VAR_15+VAR_14*VAR_12, VAR_12); break; case DEINT_ID_GENR: for (VAR_16 = 0; VAR_16 < VAR_15/VAR_11; VAR_16++) readfull(VAR_0, VAR_1, VAR_3->VAR_5.data+VAR_11*(VAR_13*VAR_16+((VAR_13+1)/2)*(VAR_14&1)+(VAR_14>>1)), VAR_11); break; case DEINT_ID_SIPR: readfull(VAR_0, VAR_1, VAR_3->VAR_5.data + VAR_14 * VAR_15, VAR_15); break; } if (++(VAR_3->sub_packet_cnt) < VAR_13) return -1; if (VAR_3->deint_id == DEINT_ID_SIPR) ff_rm_reorder_sipr_data(VAR_3->VAR_5.data, VAR_13, VAR_15); VAR_3->sub_packet_cnt = 0; rm->audio_stream_num = VAR_2->index; rm->audio_pkt_cnt = VAR_13 * VAR_15 / VAR_2->codec->block_align; } else if ((VAR_3->deint_id == DEINT_ID_VBRF) || (VAR_3->deint_id == DEINT_ID_VBRS)) { int VAR_16; rm->audio_stream_num = VAR_2->index; VAR_3->sub_packet_cnt = (avio_rb16(VAR_1) & 0xf0) >> 4; if (VAR_3->sub_packet_cnt) { for (VAR_16 = 0; VAR_16 < VAR_3->sub_packet_cnt; VAR_16++) VAR_3->sub_packet_lengths[VAR_16] = avio_rb16(VAR_1); rm->audio_pkt_cnt = VAR_3->sub_packet_cnt; VAR_3->audiotimestamp = VAR_8; } else return -1; } else { av_get_packet(VAR_1, VAR_5, VAR_4); rm_ac3_swap_bytes(VAR_2, VAR_5); } } else av_get_packet(VAR_1, VAR_5, VAR_4); VAR_5->stream_index = VAR_2->index; #if 0 if (VAR_2->codec->codec_type == AVMEDIA_TYPE_VIDEO) { if(VAR_2->codec->codec_id == AV_CODEC_ID_RV20){ int VAR_6= 128*(VAR_5->data[2]&0x7F) + (VAR_5->data[3]>>1); av_log(VAR_0, AV_LOG_DEBUG, "%d %"PRId64" %d\n", *VAR_8, *VAR_8*512LL/25, VAR_6); VAR_6 |= (VAR_8&~0x3FFF); if(VAR_6 - VAR_8 > 0x2000) VAR_6 -= 0x4000; if(VAR_6 - VAR_8 < -0x2000) VAR_6 += 0x4000; } } #endif VAR_5->pts = VAR_8; if (VAR_7 & 2) VAR_5->VAR_7 |= AV_PKT_FLAG_KEY; return VAR_2->codec->codec_type == AVMEDIA_TYPE_AUDIO ? rm->audio_pkt_cnt : 0; }
[ "FUNC_0 (AVFormatContext *VAR_0, AVIOContext *VAR_1,\nAVStream *VAR_2, RMStream *VAR_3, int VAR_4, AVPacket *VAR_5,\nint *VAR_6, int VAR_7, int64_t VAR_8)\n{", "RMDemuxContext *rm = VAR_0->priv_data;", "int VAR_9;", "if (VAR_2->codec->codec_type == AVMEDIA_TYPE_VIDEO) {", "rm->current_stream= VAR_2->id;", "VAR_9 = rm_assemble_video_frame(VAR_0, VAR_1, rm, VAR_3, VAR_5, VAR_4, VAR_6, &VAR_8);", "if(VAR_9)\nreturn VAR_9 < 0 ? VAR_9 : -1;", "} else if (VAR_2->codec->codec_type == AVMEDIA_TYPE_AUDIO) {", "if ((VAR_3->deint_id == DEINT_ID_GENR) ||\n(VAR_3->deint_id == DEINT_ID_INT4) ||\n(VAR_3->deint_id == DEINT_ID_SIPR)) {", "int VAR_16;", "int VAR_11 = VAR_3->sub_packet_size;", "int VAR_12 = VAR_3->coded_framesize;", "int VAR_13 = VAR_3->sub_packet_h;", "int VAR_14 = VAR_3->sub_packet_cnt;", "int VAR_15 = VAR_3->audio_framesize;", "if (VAR_7 & 2)\nVAR_14 = VAR_3->sub_packet_cnt = 0;", "if (!VAR_14)\nVAR_3->audiotimestamp = VAR_8;", "switch (VAR_3->deint_id) {", "case DEINT_ID_INT4:\nfor (VAR_16 = 0; VAR_16 < VAR_13/2; VAR_16++)", "readfull(VAR_0, VAR_1, VAR_3->VAR_5.data+VAR_16*2*VAR_15+VAR_14*VAR_12, VAR_12);", "break;", "case DEINT_ID_GENR:\nfor (VAR_16 = 0; VAR_16 < VAR_15/VAR_11; VAR_16++)", "readfull(VAR_0, VAR_1, VAR_3->VAR_5.data+VAR_11*(VAR_13*VAR_16+((VAR_13+1)/2)*(VAR_14&1)+(VAR_14>>1)), VAR_11);", "break;", "case DEINT_ID_SIPR:\nreadfull(VAR_0, VAR_1, VAR_3->VAR_5.data + VAR_14 * VAR_15, VAR_15);", "break;", "}", "if (++(VAR_3->sub_packet_cnt) < VAR_13)\nreturn -1;", "if (VAR_3->deint_id == DEINT_ID_SIPR)\nff_rm_reorder_sipr_data(VAR_3->VAR_5.data, VAR_13, VAR_15);", "VAR_3->sub_packet_cnt = 0;", "rm->audio_stream_num = VAR_2->index;", "rm->audio_pkt_cnt = VAR_13 * VAR_15 / VAR_2->codec->block_align;", "} else if ((VAR_3->deint_id == DEINT_ID_VBRF) ||", "(VAR_3->deint_id == DEINT_ID_VBRS)) {", "int VAR_16;", "rm->audio_stream_num = VAR_2->index;", "VAR_3->sub_packet_cnt = (avio_rb16(VAR_1) & 0xf0) >> 4;", "if (VAR_3->sub_packet_cnt) {", "for (VAR_16 = 0; VAR_16 < VAR_3->sub_packet_cnt; VAR_16++)", "VAR_3->sub_packet_lengths[VAR_16] = avio_rb16(VAR_1);", "rm->audio_pkt_cnt = VAR_3->sub_packet_cnt;", "VAR_3->audiotimestamp = VAR_8;", "} else", "return -1;", "} else {", "av_get_packet(VAR_1, VAR_5, VAR_4);", "rm_ac3_swap_bytes(VAR_2, VAR_5);", "}", "} else", "av_get_packet(VAR_1, VAR_5, VAR_4);", "VAR_5->stream_index = VAR_2->index;", "#if 0\nif (VAR_2->codec->codec_type == AVMEDIA_TYPE_VIDEO) {", "if(VAR_2->codec->codec_id == AV_CODEC_ID_RV20){", "int VAR_6= 128*(VAR_5->data[2]&0x7F) + (VAR_5->data[3]>>1);", "av_log(VAR_0, AV_LOG_DEBUG, \"%d %\"PRId64\" %d\\n\", *VAR_8, *VAR_8*512LL/25, VAR_6);", "VAR_6 |= (VAR_8&~0x3FFF);", "if(VAR_6 - VAR_8 > 0x2000) VAR_6 -= 0x4000;", "if(VAR_6 - VAR_8 < -0x2000) VAR_6 += 0x4000;", "}", "}", "#endif\nVAR_5->pts = VAR_8;", "if (VAR_7 & 2)\nVAR_5->VAR_7 |= AV_PKT_FLAG_KEY;", "return VAR_2->codec->codec_type == AVMEDIA_TYPE_AUDIO ? rm->audio_pkt_cnt : 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21, 23 ], [ 25 ], [ 27, 29, 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47, 49 ], [ 51, 53 ], [ 57 ], [ 59, 61 ], [ 63 ], [ 65 ], [ 67, 69 ], [ 71 ], [ 73 ], [ 75, 77 ], [ 79 ], [ 81 ], [ 85, 87 ], [ 89, 91 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 139 ], [ 143, 145 ], [ 147 ], [ 149 ], [ 151 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165, 169 ], [ 171, 173 ], [ 177 ], [ 179 ] ]
18,804
static int read_var_block_data(ALSDecContext *ctx, ALSBlockData *bd) { ALSSpecificConfig *sconf = &ctx->sconf; AVCodecContext *avctx = ctx->avctx; GetBitContext *gb = &ctx->gb; unsigned int k; unsigned int s[8]; unsigned int sx[8]; unsigned int sub_blocks, log2_sub_blocks, sb_length; unsigned int start = 0; unsigned int opt_order; int sb; int32_t *quant_cof = bd->quant_cof; int32_t *current_res; // ensure variable block decoding by reusing this field bd->const_block = 0; bd->opt_order = 1; bd->js_blocks = get_bits1(gb); opt_order = bd->opt_order; // determine the number of subblocks for entropy decoding if (!sconf->bgmc && !sconf->sb_part) { log2_sub_blocks = 0; } else { if (sconf->bgmc && sconf->sb_part) log2_sub_blocks = get_bits(gb, 2); else log2_sub_blocks = 2 * get_bits1(gb); } sub_blocks = 1 << log2_sub_blocks; // do not continue in case of a damaged stream since // block_length must be evenly divisible by sub_blocks if (bd->block_length & (sub_blocks - 1)) { av_log(avctx, AV_LOG_WARNING, "Block length is not evenly divisible by the number of subblocks.\n"); return -1; } sb_length = bd->block_length >> log2_sub_blocks; if (sconf->bgmc) { s[0] = get_bits(gb, 8 + (sconf->resolution > 1)); for (k = 1; k < sub_blocks; k++) s[k] = s[k - 1] + decode_rice(gb, 2); for (k = 0; k < sub_blocks; k++) { sx[k] = s[k] & 0x0F; s [k] >>= 4; } } else { s[0] = get_bits(gb, 4 + (sconf->resolution > 1)); for (k = 1; k < sub_blocks; k++) s[k] = s[k - 1] + decode_rice(gb, 0); } if (get_bits1(gb)) bd->shift_lsbs = get_bits(gb, 4) + 1; bd->store_prev_samples = (bd->js_blocks && bd->raw_other) || bd->shift_lsbs; if (!sconf->rlslms) { if (sconf->adapt_order) { int opt_order_length = av_ceil_log2(av_clip((bd->block_length >> 3) - 1, 2, sconf->max_order + 1)); bd->opt_order = get_bits(gb, opt_order_length); } else { bd->opt_order = sconf->max_order; } opt_order = bd->opt_order; if (opt_order) { int add_base; if (sconf->coef_table == 3) { add_base = 0x7F; // read coefficient 0 quant_cof[0] = 32 * parcor_scaled_values[get_bits(gb, 7)]; // read coefficient 1 if (opt_order > 1) quant_cof[1] = -32 * parcor_scaled_values[get_bits(gb, 7)]; // read coefficients 2 to opt_order for (k = 2; k < opt_order; k++) quant_cof[k] = get_bits(gb, 7); } else { int k_max; add_base = 1; // read coefficient 0 to 19 k_max = FFMIN(opt_order, 20); for (k = 0; k < k_max; k++) { int rice_param = parcor_rice_table[sconf->coef_table][k][1]; int offset = parcor_rice_table[sconf->coef_table][k][0]; quant_cof[k] = decode_rice(gb, rice_param) + offset; } // read coefficients 20 to 126 k_max = FFMIN(opt_order, 127); for (; k < k_max; k++) quant_cof[k] = decode_rice(gb, 2) + (k & 1); // read coefficients 127 to opt_order for (; k < opt_order; k++) quant_cof[k] = decode_rice(gb, 1); quant_cof[0] = 32 * parcor_scaled_values[quant_cof[0] + 64]; if (opt_order > 1) quant_cof[1] = -32 * parcor_scaled_values[quant_cof[1] + 64]; } for (k = 2; k < opt_order; k++) quant_cof[k] = (quant_cof[k] << 14) + (add_base << 13); } } // read LTP gain and lag values if (sconf->long_term_prediction) { *bd->use_ltp = get_bits1(gb); if (*bd->use_ltp) { bd->ltp_gain[0] = decode_rice(gb, 1) << 3; bd->ltp_gain[1] = decode_rice(gb, 2) << 3; bd->ltp_gain[2] = ltp_gain_values[get_unary(gb, 0, 4)][get_bits(gb, 2)]; bd->ltp_gain[3] = decode_rice(gb, 2) << 3; bd->ltp_gain[4] = decode_rice(gb, 1) << 3; *bd->ltp_lag = get_bits(gb, ctx->ltp_lag_length); *bd->ltp_lag += FFMAX(4, opt_order + 1); } } // read first value and residuals in case of a random access block if (bd->ra_block) { if (opt_order) bd->raw_samples[0] = decode_rice(gb, avctx->bits_per_raw_sample - 4); if (opt_order > 1) bd->raw_samples[1] = decode_rice(gb, s[0] + 3); if (opt_order > 2) bd->raw_samples[2] = decode_rice(gb, s[0] + 1); start = FFMIN(opt_order, 3); } // read all residuals if (sconf->bgmc) { unsigned int delta[sub_blocks]; unsigned int k [sub_blocks]; unsigned int b = av_clip((av_ceil_log2(bd->block_length) - 3) >> 1, 0, 5); unsigned int i = start; // read most significant bits unsigned int high; unsigned int low; unsigned int value; ff_bgmc_decode_init(gb, &high, &low, &value); current_res = bd->raw_samples + start; for (sb = 0; sb < sub_blocks; sb++, i = 0) { k [sb] = s[sb] > b ? s[sb] - b : 0; delta[sb] = 5 - s[sb] + k[sb]; ff_bgmc_decode(gb, sb_length, current_res, delta[sb], sx[sb], &high, &low, &value, ctx->bgmc_lut, ctx->bgmc_lut_status); current_res += sb_length; } ff_bgmc_decode_end(gb); // read least significant bits and tails i = start; current_res = bd->raw_samples + start; for (sb = 0; sb < sub_blocks; sb++, i = 0) { unsigned int cur_tail_code = tail_code[sx[sb]][delta[sb]]; unsigned int cur_k = k[sb]; unsigned int cur_s = s[sb]; for (; i < sb_length; i++) { int32_t res = *current_res; if (res == cur_tail_code) { unsigned int max_msb = (2 + (sx[sb] > 2) + (sx[sb] > 10)) << (5 - delta[sb]); res = decode_rice(gb, cur_s); if (res >= 0) { res += (max_msb ) << cur_k; } else { res -= (max_msb - 1) << cur_k; } } else { if (res > cur_tail_code) res--; if (res & 1) res = -res; res >>= 1; if (cur_k) { res <<= cur_k; res |= get_bits_long(gb, cur_k); } } *current_res++ = res; } } } else { current_res = bd->raw_samples + start; for (sb = 0; sb < sub_blocks; sb++, start = 0) for (; start < sb_length; start++) *current_res++ = decode_rice(gb, s[sb]); } if (!sconf->mc_coding || ctx->js_switch) align_get_bits(gb); return 0; }
false
FFmpeg
114315994bc08812eeef51eaace455d86b5098d5
static int read_var_block_data(ALSDecContext *ctx, ALSBlockData *bd) { ALSSpecificConfig *sconf = &ctx->sconf; AVCodecContext *avctx = ctx->avctx; GetBitContext *gb = &ctx->gb; unsigned int k; unsigned int s[8]; unsigned int sx[8]; unsigned int sub_blocks, log2_sub_blocks, sb_length; unsigned int start = 0; unsigned int opt_order; int sb; int32_t *quant_cof = bd->quant_cof; int32_t *current_res; bd->const_block = 0; bd->opt_order = 1; bd->js_blocks = get_bits1(gb); opt_order = bd->opt_order; if (!sconf->bgmc && !sconf->sb_part) { log2_sub_blocks = 0; } else { if (sconf->bgmc && sconf->sb_part) log2_sub_blocks = get_bits(gb, 2); else log2_sub_blocks = 2 * get_bits1(gb); } sub_blocks = 1 << log2_sub_blocks; if (bd->block_length & (sub_blocks - 1)) { av_log(avctx, AV_LOG_WARNING, "Block length is not evenly divisible by the number of subblocks.\n"); return -1; } sb_length = bd->block_length >> log2_sub_blocks; if (sconf->bgmc) { s[0] = get_bits(gb, 8 + (sconf->resolution > 1)); for (k = 1; k < sub_blocks; k++) s[k] = s[k - 1] + decode_rice(gb, 2); for (k = 0; k < sub_blocks; k++) { sx[k] = s[k] & 0x0F; s [k] >>= 4; } } else { s[0] = get_bits(gb, 4 + (sconf->resolution > 1)); for (k = 1; k < sub_blocks; k++) s[k] = s[k - 1] + decode_rice(gb, 0); } if (get_bits1(gb)) bd->shift_lsbs = get_bits(gb, 4) + 1; bd->store_prev_samples = (bd->js_blocks && bd->raw_other) || bd->shift_lsbs; if (!sconf->rlslms) { if (sconf->adapt_order) { int opt_order_length = av_ceil_log2(av_clip((bd->block_length >> 3) - 1, 2, sconf->max_order + 1)); bd->opt_order = get_bits(gb, opt_order_length); } else { bd->opt_order = sconf->max_order; } opt_order = bd->opt_order; if (opt_order) { int add_base; if (sconf->coef_table == 3) { add_base = 0x7F; quant_cof[0] = 32 * parcor_scaled_values[get_bits(gb, 7)]; if (opt_order > 1) quant_cof[1] = -32 * parcor_scaled_values[get_bits(gb, 7)]; for (k = 2; k < opt_order; k++) quant_cof[k] = get_bits(gb, 7); } else { int k_max; add_base = 1; to 19 k_max = FFMIN(opt_order, 20); for (k = 0; k < k_max; k++) { int rice_param = parcor_rice_table[sconf->coef_table][k][1]; int offset = parcor_rice_table[sconf->coef_table][k][0]; quant_cof[k] = decode_rice(gb, rice_param) + offset; } k_max = FFMIN(opt_order, 127); for (; k < k_max; k++) quant_cof[k] = decode_rice(gb, 2) + (k & 1); for (; k < opt_order; k++) quant_cof[k] = decode_rice(gb, 1); quant_cof[0] = 32 * parcor_scaled_values[quant_cof[0] + 64]; if (opt_order > 1) quant_cof[1] = -32 * parcor_scaled_values[quant_cof[1] + 64]; } for (k = 2; k < opt_order; k++) quant_cof[k] = (quant_cof[k] << 14) + (add_base << 13); } } if (sconf->long_term_prediction) { *bd->use_ltp = get_bits1(gb); if (*bd->use_ltp) { bd->ltp_gain[0] = decode_rice(gb, 1) << 3; bd->ltp_gain[1] = decode_rice(gb, 2) << 3; bd->ltp_gain[2] = ltp_gain_values[get_unary(gb, 0, 4)][get_bits(gb, 2)]; bd->ltp_gain[3] = decode_rice(gb, 2) << 3; bd->ltp_gain[4] = decode_rice(gb, 1) << 3; *bd->ltp_lag = get_bits(gb, ctx->ltp_lag_length); *bd->ltp_lag += FFMAX(4, opt_order + 1); } } if (bd->ra_block) { if (opt_order) bd->raw_samples[0] = decode_rice(gb, avctx->bits_per_raw_sample - 4); if (opt_order > 1) bd->raw_samples[1] = decode_rice(gb, s[0] + 3); if (opt_order > 2) bd->raw_samples[2] = decode_rice(gb, s[0] + 1); start = FFMIN(opt_order, 3); } if (sconf->bgmc) { unsigned int delta[sub_blocks]; unsigned int k [sub_blocks]; unsigned int b = av_clip((av_ceil_log2(bd->block_length) - 3) >> 1, 0, 5); unsigned int i = start; unsigned int high; unsigned int low; unsigned int value; ff_bgmc_decode_init(gb, &high, &low, &value); current_res = bd->raw_samples + start; for (sb = 0; sb < sub_blocks; sb++, i = 0) { k [sb] = s[sb] > b ? s[sb] - b : 0; delta[sb] = 5 - s[sb] + k[sb]; ff_bgmc_decode(gb, sb_length, current_res, delta[sb], sx[sb], &high, &low, &value, ctx->bgmc_lut, ctx->bgmc_lut_status); current_res += sb_length; } ff_bgmc_decode_end(gb); i = start; current_res = bd->raw_samples + start; for (sb = 0; sb < sub_blocks; sb++, i = 0) { unsigned int cur_tail_code = tail_code[sx[sb]][delta[sb]]; unsigned int cur_k = k[sb]; unsigned int cur_s = s[sb]; for (; i < sb_length; i++) { int32_t res = *current_res; if (res == cur_tail_code) { unsigned int max_msb = (2 + (sx[sb] > 2) + (sx[sb] > 10)) << (5 - delta[sb]); res = decode_rice(gb, cur_s); if (res >= 0) { res += (max_msb ) << cur_k; } else { res -= (max_msb - 1) << cur_k; } } else { if (res > cur_tail_code) res--; if (res & 1) res = -res; res >>= 1; if (cur_k) { res <<= cur_k; res |= get_bits_long(gb, cur_k); } } *current_res++ = res; } } } else { current_res = bd->raw_samples + start; for (sb = 0; sb < sub_blocks; sb++, start = 0) for (; start < sb_length; start++) *current_res++ = decode_rice(gb, s[sb]); } if (!sconf->mc_coding || ctx->js_switch) align_get_bits(gb); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(ALSDecContext *VAR_0, ALSBlockData *VAR_1) { ALSSpecificConfig *sconf = &VAR_0->sconf; AVCodecContext *avctx = VAR_0->avctx; GetBitContext *gb = &VAR_0->gb; unsigned int VAR_17; unsigned int VAR_3[8]; unsigned int VAR_4[8]; unsigned int VAR_5, VAR_6, VAR_7; unsigned int VAR_8 = 0; unsigned int VAR_9; int VAR_10; int32_t *quant_cof = VAR_1->quant_cof; int32_t *current_res; VAR_1->const_block = 0; VAR_1->VAR_9 = 1; VAR_1->js_blocks = get_bits1(gb); VAR_9 = VAR_1->VAR_9; if (!sconf->bgmc && !sconf->sb_part) { VAR_6 = 0; } else { if (sconf->bgmc && sconf->sb_part) VAR_6 = get_bits(gb, 2); else VAR_6 = 2 * get_bits1(gb); } VAR_5 = 1 << VAR_6; if (VAR_1->block_length & (VAR_5 - 1)) { av_log(avctx, AV_LOG_WARNING, "Block length is not evenly divisible by the number of subblocks.\n"); return -1; } VAR_7 = VAR_1->block_length >> VAR_6; if (sconf->bgmc) { VAR_3[0] = get_bits(gb, 8 + (sconf->resolution > 1)); for (VAR_17 = 1; VAR_17 < VAR_5; VAR_17++) VAR_3[VAR_17] = VAR_3[VAR_17 - 1] + decode_rice(gb, 2); for (VAR_17 = 0; VAR_17 < VAR_5; VAR_17++) { VAR_4[VAR_17] = VAR_3[VAR_17] & 0x0F; VAR_3 [VAR_17] >>= 4; } } else { VAR_3[0] = get_bits(gb, 4 + (sconf->resolution > 1)); for (VAR_17 = 1; VAR_17 < VAR_5; VAR_17++) VAR_3[VAR_17] = VAR_3[VAR_17 - 1] + decode_rice(gb, 0); } if (get_bits1(gb)) VAR_1->shift_lsbs = get_bits(gb, 4) + 1; VAR_1->store_prev_samples = (VAR_1->js_blocks && VAR_1->raw_other) || VAR_1->shift_lsbs; if (!sconf->rlslms) { if (sconf->adapt_order) { int VAR_11 = av_ceil_log2(av_clip((VAR_1->block_length >> 3) - 1, 2, sconf->max_order + 1)); VAR_1->VAR_9 = get_bits(gb, VAR_11); } else { VAR_1->VAR_9 = sconf->max_order; } VAR_9 = VAR_1->VAR_9; if (VAR_9) { int VAR_12; if (sconf->coef_table == 3) { VAR_12 = 0x7F; quant_cof[0] = 32 * parcor_scaled_values[get_bits(gb, 7)]; if (VAR_9 > 1) quant_cof[1] = -32 * parcor_scaled_values[get_bits(gb, 7)]; for (VAR_17 = 2; VAR_17 < VAR_9; VAR_17++) quant_cof[VAR_17] = get_bits(gb, 7); } else { int VAR_13; VAR_12 = 1; to 19 VAR_13 = FFMIN(VAR_9, 20); for (VAR_17 = 0; VAR_17 < VAR_13; VAR_17++) { int VAR_14 = parcor_rice_table[sconf->coef_table][VAR_17][1]; int VAR_15 = parcor_rice_table[sconf->coef_table][VAR_17][0]; quant_cof[VAR_17] = decode_rice(gb, VAR_14) + VAR_15; } VAR_13 = FFMIN(VAR_9, 127); for (; VAR_17 < VAR_13; VAR_17++) quant_cof[VAR_17] = decode_rice(gb, 2) + (VAR_17 & 1); for (; VAR_17 < VAR_9; VAR_17++) quant_cof[VAR_17] = decode_rice(gb, 1); quant_cof[0] = 32 * parcor_scaled_values[quant_cof[0] + 64]; if (VAR_9 > 1) quant_cof[1] = -32 * parcor_scaled_values[quant_cof[1] + 64]; } for (VAR_17 = 2; VAR_17 < VAR_9; VAR_17++) quant_cof[VAR_17] = (quant_cof[VAR_17] << 14) + (VAR_12 << 13); } } if (sconf->long_term_prediction) { *VAR_1->use_ltp = get_bits1(gb); if (*VAR_1->use_ltp) { VAR_1->ltp_gain[0] = decode_rice(gb, 1) << 3; VAR_1->ltp_gain[1] = decode_rice(gb, 2) << 3; VAR_1->ltp_gain[2] = ltp_gain_values[get_unary(gb, 0, 4)][get_bits(gb, 2)]; VAR_1->ltp_gain[3] = decode_rice(gb, 2) << 3; VAR_1->ltp_gain[4] = decode_rice(gb, 1) << 3; *VAR_1->ltp_lag = get_bits(gb, VAR_0->ltp_lag_length); *VAR_1->ltp_lag += FFMAX(4, VAR_9 + 1); } } if (VAR_1->ra_block) { if (VAR_9) VAR_1->raw_samples[0] = decode_rice(gb, avctx->bits_per_raw_sample - 4); if (VAR_9 > 1) VAR_1->raw_samples[1] = decode_rice(gb, VAR_3[0] + 3); if (VAR_9 > 2) VAR_1->raw_samples[2] = decode_rice(gb, VAR_3[0] + 1); VAR_8 = FFMIN(VAR_9, 3); } if (sconf->bgmc) { unsigned int VAR_16[VAR_5]; unsigned int VAR_17 [VAR_5]; unsigned int VAR_17 = av_clip((av_ceil_log2(VAR_1->block_length) - 3) >> 1, 0, 5); unsigned int VAR_18 = VAR_8; unsigned int VAR_19; unsigned int VAR_20; unsigned int VAR_21; ff_bgmc_decode_init(gb, &VAR_19, &VAR_20, &VAR_21); current_res = VAR_1->raw_samples + VAR_8; for (VAR_10 = 0; VAR_10 < VAR_5; VAR_10++, VAR_18 = 0) { VAR_17 [VAR_10] = VAR_3[VAR_10] > VAR_17 ? VAR_3[VAR_10] - VAR_17 : 0; VAR_16[VAR_10] = 5 - VAR_3[VAR_10] + VAR_17[VAR_10]; ff_bgmc_decode(gb, VAR_7, current_res, VAR_16[VAR_10], VAR_4[VAR_10], &VAR_19, &VAR_20, &VAR_21, VAR_0->bgmc_lut, VAR_0->bgmc_lut_status); current_res += VAR_7; } ff_bgmc_decode_end(gb); VAR_18 = VAR_8; current_res = VAR_1->raw_samples + VAR_8; for (VAR_10 = 0; VAR_10 < VAR_5; VAR_10++, VAR_18 = 0) { unsigned int VAR_22 = tail_code[VAR_4[VAR_10]][VAR_16[VAR_10]]; unsigned int VAR_23 = VAR_17[VAR_10]; unsigned int VAR_24 = VAR_3[VAR_10]; for (; VAR_18 < VAR_7; VAR_18++) { int32_t res = *current_res; if (res == VAR_22) { unsigned int VAR_25 = (2 + (VAR_4[VAR_10] > 2) + (VAR_4[VAR_10] > 10)) << (5 - VAR_16[VAR_10]); res = decode_rice(gb, VAR_24); if (res >= 0) { res += (VAR_25 ) << VAR_23; } else { res -= (VAR_25 - 1) << VAR_23; } } else { if (res > VAR_22) res--; if (res & 1) res = -res; res >>= 1; if (VAR_23) { res <<= VAR_23; res |= get_bits_long(gb, VAR_23); } } *current_res++ = res; } } } else { current_res = VAR_1->raw_samples + VAR_8; for (VAR_10 = 0; VAR_10 < VAR_5; VAR_10++, VAR_8 = 0) for (; VAR_8 < VAR_7; VAR_8++) *current_res++ = decode_rice(gb, VAR_3[VAR_10]); } if (!sconf->mc_coding || VAR_0->js_switch) align_get_bits(gb); return 0; }
[ "static int FUNC_0(ALSDecContext *VAR_0, ALSBlockData *VAR_1)\n{", "ALSSpecificConfig *sconf = &VAR_0->sconf;", "AVCodecContext *avctx = VAR_0->avctx;", "GetBitContext *gb = &VAR_0->gb;", "unsigned int VAR_17;", "unsigned int VAR_3[8];", "unsigned int VAR_4[8];", "unsigned int VAR_5, VAR_6, VAR_7;", "unsigned int VAR_8 = 0;", "unsigned int VAR_9;", "int VAR_10;", "int32_t *quant_cof = VAR_1->quant_cof;", "int32_t *current_res;", "VAR_1->const_block = 0;", "VAR_1->VAR_9 = 1;", "VAR_1->js_blocks = get_bits1(gb);", "VAR_9 = VAR_1->VAR_9;", "if (!sconf->bgmc && !sconf->sb_part) {", "VAR_6 = 0;", "} else {", "if (sconf->bgmc && sconf->sb_part)\nVAR_6 = get_bits(gb, 2);", "else\nVAR_6 = 2 * get_bits1(gb);", "}", "VAR_5 = 1 << VAR_6;", "if (VAR_1->block_length & (VAR_5 - 1)) {", "av_log(avctx, AV_LOG_WARNING,\n\"Block length is not evenly divisible by the number of subblocks.\\n\");", "return -1;", "}", "VAR_7 = VAR_1->block_length >> VAR_6;", "if (sconf->bgmc) {", "VAR_3[0] = get_bits(gb, 8 + (sconf->resolution > 1));", "for (VAR_17 = 1; VAR_17 < VAR_5; VAR_17++)", "VAR_3[VAR_17] = VAR_3[VAR_17 - 1] + decode_rice(gb, 2);", "for (VAR_17 = 0; VAR_17 < VAR_5; VAR_17++) {", "VAR_4[VAR_17] = VAR_3[VAR_17] & 0x0F;", "VAR_3 [VAR_17] >>= 4;", "}", "} else {", "VAR_3[0] = get_bits(gb, 4 + (sconf->resolution > 1));", "for (VAR_17 = 1; VAR_17 < VAR_5; VAR_17++)", "VAR_3[VAR_17] = VAR_3[VAR_17 - 1] + decode_rice(gb, 0);", "}", "if (get_bits1(gb))\nVAR_1->shift_lsbs = get_bits(gb, 4) + 1;", "VAR_1->store_prev_samples = (VAR_1->js_blocks && VAR_1->raw_other) || VAR_1->shift_lsbs;", "if (!sconf->rlslms) {", "if (sconf->adapt_order) {", "int VAR_11 = av_ceil_log2(av_clip((VAR_1->block_length >> 3) - 1,\n2, sconf->max_order + 1));", "VAR_1->VAR_9 = get_bits(gb, VAR_11);", "} else {", "VAR_1->VAR_9 = sconf->max_order;", "}", "VAR_9 = VAR_1->VAR_9;", "if (VAR_9) {", "int VAR_12;", "if (sconf->coef_table == 3) {", "VAR_12 = 0x7F;", "quant_cof[0] = 32 * parcor_scaled_values[get_bits(gb, 7)];", "if (VAR_9 > 1)\nquant_cof[1] = -32 * parcor_scaled_values[get_bits(gb, 7)];", "for (VAR_17 = 2; VAR_17 < VAR_9; VAR_17++)", "quant_cof[VAR_17] = get_bits(gb, 7);", "} else {", "int VAR_13;", "VAR_12 = 1;", "to 19\nVAR_13 = FFMIN(VAR_9, 20);", "for (VAR_17 = 0; VAR_17 < VAR_13; VAR_17++) {", "int VAR_14 = parcor_rice_table[sconf->coef_table][VAR_17][1];", "int VAR_15 = parcor_rice_table[sconf->coef_table][VAR_17][0];", "quant_cof[VAR_17] = decode_rice(gb, VAR_14) + VAR_15;", "}", "VAR_13 = FFMIN(VAR_9, 127);", "for (; VAR_17 < VAR_13; VAR_17++)", "quant_cof[VAR_17] = decode_rice(gb, 2) + (VAR_17 & 1);", "for (; VAR_17 < VAR_9; VAR_17++)", "quant_cof[VAR_17] = decode_rice(gb, 1);", "quant_cof[0] = 32 * parcor_scaled_values[quant_cof[0] + 64];", "if (VAR_9 > 1)\nquant_cof[1] = -32 * parcor_scaled_values[quant_cof[1] + 64];", "}", "for (VAR_17 = 2; VAR_17 < VAR_9; VAR_17++)", "quant_cof[VAR_17] = (quant_cof[VAR_17] << 14) + (VAR_12 << 13);", "}", "}", "if (sconf->long_term_prediction) {", "*VAR_1->use_ltp = get_bits1(gb);", "if (*VAR_1->use_ltp) {", "VAR_1->ltp_gain[0] = decode_rice(gb, 1) << 3;", "VAR_1->ltp_gain[1] = decode_rice(gb, 2) << 3;", "VAR_1->ltp_gain[2] = ltp_gain_values[get_unary(gb, 0, 4)][get_bits(gb, 2)];", "VAR_1->ltp_gain[3] = decode_rice(gb, 2) << 3;", "VAR_1->ltp_gain[4] = decode_rice(gb, 1) << 3;", "*VAR_1->ltp_lag = get_bits(gb, VAR_0->ltp_lag_length);", "*VAR_1->ltp_lag += FFMAX(4, VAR_9 + 1);", "}", "}", "if (VAR_1->ra_block) {", "if (VAR_9)\nVAR_1->raw_samples[0] = decode_rice(gb, avctx->bits_per_raw_sample - 4);", "if (VAR_9 > 1)\nVAR_1->raw_samples[1] = decode_rice(gb, VAR_3[0] + 3);", "if (VAR_9 > 2)\nVAR_1->raw_samples[2] = decode_rice(gb, VAR_3[0] + 1);", "VAR_8 = FFMIN(VAR_9, 3);", "}", "if (sconf->bgmc) {", "unsigned int VAR_16[VAR_5];", "unsigned int VAR_17 [VAR_5];", "unsigned int VAR_17 = av_clip((av_ceil_log2(VAR_1->block_length) - 3) >> 1, 0, 5);", "unsigned int VAR_18 = VAR_8;", "unsigned int VAR_19;", "unsigned int VAR_20;", "unsigned int VAR_21;", "ff_bgmc_decode_init(gb, &VAR_19, &VAR_20, &VAR_21);", "current_res = VAR_1->raw_samples + VAR_8;", "for (VAR_10 = 0; VAR_10 < VAR_5; VAR_10++, VAR_18 = 0) {", "VAR_17 [VAR_10] = VAR_3[VAR_10] > VAR_17 ? VAR_3[VAR_10] - VAR_17 : 0;", "VAR_16[VAR_10] = 5 - VAR_3[VAR_10] + VAR_17[VAR_10];", "ff_bgmc_decode(gb, VAR_7, current_res,\nVAR_16[VAR_10], VAR_4[VAR_10], &VAR_19, &VAR_20, &VAR_21, VAR_0->bgmc_lut, VAR_0->bgmc_lut_status);", "current_res += VAR_7;", "}", "ff_bgmc_decode_end(gb);", "VAR_18 = VAR_8;", "current_res = VAR_1->raw_samples + VAR_8;", "for (VAR_10 = 0; VAR_10 < VAR_5; VAR_10++, VAR_18 = 0) {", "unsigned int VAR_22 = tail_code[VAR_4[VAR_10]][VAR_16[VAR_10]];", "unsigned int VAR_23 = VAR_17[VAR_10];", "unsigned int VAR_24 = VAR_3[VAR_10];", "for (; VAR_18 < VAR_7; VAR_18++) {", "int32_t res = *current_res;", "if (res == VAR_22) {", "unsigned int VAR_25 = (2 + (VAR_4[VAR_10] > 2) + (VAR_4[VAR_10] > 10))\n<< (5 - VAR_16[VAR_10]);", "res = decode_rice(gb, VAR_24);", "if (res >= 0) {", "res += (VAR_25 ) << VAR_23;", "} else {", "res -= (VAR_25 - 1) << VAR_23;", "}", "} else {", "if (res > VAR_22)\nres--;", "if (res & 1)\nres = -res;", "res >>= 1;", "if (VAR_23) {", "res <<= VAR_23;", "res |= get_bits_long(gb, VAR_23);", "}", "}", "*current_res++ = res;", "}", "}", "} else {", "current_res = VAR_1->raw_samples + VAR_8;", "for (VAR_10 = 0; VAR_10 < VAR_5; VAR_10++, VAR_8 = 0)", "for (; VAR_8 < VAR_7; VAR_8++)", "*current_res++ = decode_rice(gb, VAR_3[VAR_10]);", "}", "if (!sconf->mc_coding || VAR_0->js_switch)\nalign_get_bits(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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 35 ], [ 39 ], [ 41 ], [ 45 ], [ 51 ], [ 53 ], [ 55 ], [ 57, 59 ], [ 61, 63 ], [ 65 ], [ 69 ], [ 77 ], [ 79, 81 ], [ 83 ], [ 85 ], [ 89 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 123, 125 ], [ 129 ], [ 135 ], [ 137 ], [ 139, 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 153 ], [ 157 ], [ 159 ], [ 163 ], [ 165 ], [ 171 ], [ 177, 179 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 197, 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 215 ], [ 217 ], [ 219 ], [ 225 ], [ 227 ], [ 231 ], [ 235, 237 ], [ 239 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 255 ], [ 257 ], [ 261 ], [ 263 ], [ 265 ], [ 269 ], [ 273 ], [ 275 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 291 ], [ 293, 295 ], [ 297, 299 ], [ 301, 303 ], [ 307 ], [ 309 ], [ 315 ], [ 317 ], [ 319 ], [ 321 ], [ 323 ], [ 329 ], [ 331 ], [ 333 ], [ 337 ], [ 341 ], [ 345 ], [ 347 ], [ 349 ], [ 353, 355 ], [ 359 ], [ 361 ], [ 365 ], [ 373 ], [ 375 ], [ 379 ], [ 381 ], [ 383 ], [ 385 ], [ 389 ], [ 391 ], [ 395 ], [ 397, 399 ], [ 403 ], [ 407 ], [ 409 ], [ 411 ], [ 413 ], [ 415 ], [ 417 ], [ 419, 421 ], [ 425, 427 ], [ 431 ], [ 435 ], [ 437 ], [ 439 ], [ 441 ], [ 443 ], [ 447 ], [ 449 ], [ 451 ], [ 453 ], [ 455 ], [ 459 ], [ 461 ], [ 463 ], [ 465 ], [ 469, 471 ], [ 475 ], [ 477 ] ]
18,805
static inline void RENAME(yuv2packed1)(SwsContext *c, const uint16_t *buf0, const uint16_t *uvbuf0, const uint16_t *uvbuf1, const uint16_t *abuf0, uint8_t *dest, int dstW, int uvalpha, enum PixelFormat dstFormat, int flags, int y) { const int yalpha1=0; int i; const uint16_t *buf1= buf0; //FIXME needed for RGB1/BGR1 const int yalpha= 4096; //FIXME ... if (flags&SWS_FULL_CHR_H_INT) { c->yuv2packed2(c, buf0, buf0, uvbuf0, uvbuf1, abuf0, abuf0, dest, dstW, 0, uvalpha, y); return; } #if COMPILE_TEMPLATE_MMX if(!(flags & SWS_BITEXACT)) { if (uvalpha < 2048) { // note this is not correct (shifts chrominance by 0.5 pixels) but it is a bit faster switch(dstFormat) { case PIX_FMT_RGB32: if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) { __asm__ volatile( "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" "mov %4, %%"REG_b" \n\t" "push %%"REG_BP" \n\t" YSCALEYUV2RGB1(%%REGBP, %5) YSCALEYUV2RGB1_ALPHA(%%REGBP) WRITEBGR32(%%REGb, 8280(%5), %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (abuf0), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), "a" (&c->redDither) ); } else { __asm__ volatile( "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" "mov %4, %%"REG_b" \n\t" "push %%"REG_BP" \n\t" YSCALEYUV2RGB1(%%REGBP, %5) "pcmpeqd %%mm7, %%mm7 \n\t" WRITEBGR32(%%REGb, 8280(%5), %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), "a" (&c->redDither) ); } return; case PIX_FMT_BGR24: __asm__ volatile( "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" "mov %4, %%"REG_b" \n\t" "push %%"REG_BP" \n\t" YSCALEYUV2RGB1(%%REGBP, %5) "pxor %%mm7, %%mm7 \n\t" WRITEBGR24(%%REGb, 8280(%5), %%REGBP) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), "a" (&c->redDither) ); return; case PIX_FMT_RGB555: __asm__ volatile( "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" "mov %4, %%"REG_b" \n\t" "push %%"REG_BP" \n\t" YSCALEYUV2RGB1(%%REGBP, %5) "pxor %%mm7, %%mm7 \n\t" /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */ #ifdef DITHER1XBPP "paddusb "BLUE_DITHER"(%5), %%mm2 \n\t" "paddusb "GREEN_DITHER"(%5), %%mm4 \n\t" "paddusb "RED_DITHER"(%5), %%mm5 \n\t" #endif WRITERGB15(%%REGb, 8280(%5), %%REGBP) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), "a" (&c->redDither) ); return; case PIX_FMT_RGB565: __asm__ volatile( "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" "mov %4, %%"REG_b" \n\t" "push %%"REG_BP" \n\t" YSCALEYUV2RGB1(%%REGBP, %5) "pxor %%mm7, %%mm7 \n\t" /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */ #ifdef DITHER1XBPP "paddusb "BLUE_DITHER"(%5), %%mm2 \n\t" "paddusb "GREEN_DITHER"(%5), %%mm4 \n\t" "paddusb "RED_DITHER"(%5), %%mm5 \n\t" #endif WRITERGB16(%%REGb, 8280(%5), %%REGBP) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), "a" (&c->redDither) ); return; case PIX_FMT_YUYV422: __asm__ volatile( "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" "mov %4, %%"REG_b" \n\t" "push %%"REG_BP" \n\t" YSCALEYUV2PACKED1(%%REGBP, %5) WRITEYUY2(%%REGb, 8280(%5), %%REGBP) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), "a" (&c->redDither) ); return; } } else { switch(dstFormat) { case PIX_FMT_RGB32: if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) { __asm__ volatile( "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" "mov %4, %%"REG_b" \n\t" "push %%"REG_BP" \n\t" YSCALEYUV2RGB1b(%%REGBP, %5) YSCALEYUV2RGB1_ALPHA(%%REGBP) WRITEBGR32(%%REGb, 8280(%5), %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (abuf0), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), "a" (&c->redDither) ); } else { __asm__ volatile( "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" "mov %4, %%"REG_b" \n\t" "push %%"REG_BP" \n\t" YSCALEYUV2RGB1b(%%REGBP, %5) "pcmpeqd %%mm7, %%mm7 \n\t" WRITEBGR32(%%REGb, 8280(%5), %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), "a" (&c->redDither) ); } return; case PIX_FMT_BGR24: __asm__ volatile( "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" "mov %4, %%"REG_b" \n\t" "push %%"REG_BP" \n\t" YSCALEYUV2RGB1b(%%REGBP, %5) "pxor %%mm7, %%mm7 \n\t" WRITEBGR24(%%REGb, 8280(%5), %%REGBP) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), "a" (&c->redDither) ); return; case PIX_FMT_RGB555: __asm__ volatile( "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" "mov %4, %%"REG_b" \n\t" "push %%"REG_BP" \n\t" YSCALEYUV2RGB1b(%%REGBP, %5) "pxor %%mm7, %%mm7 \n\t" /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */ #ifdef DITHER1XBPP "paddusb "BLUE_DITHER"(%5), %%mm2 \n\t" "paddusb "GREEN_DITHER"(%5), %%mm4 \n\t" "paddusb "RED_DITHER"(%5), %%mm5 \n\t" #endif WRITERGB15(%%REGb, 8280(%5), %%REGBP) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), "a" (&c->redDither) ); return; case PIX_FMT_RGB565: __asm__ volatile( "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" "mov %4, %%"REG_b" \n\t" "push %%"REG_BP" \n\t" YSCALEYUV2RGB1b(%%REGBP, %5) "pxor %%mm7, %%mm7 \n\t" /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */ #ifdef DITHER1XBPP "paddusb "BLUE_DITHER"(%5), %%mm2 \n\t" "paddusb "GREEN_DITHER"(%5), %%mm4 \n\t" "paddusb "RED_DITHER"(%5), %%mm5 \n\t" #endif WRITERGB16(%%REGb, 8280(%5), %%REGBP) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), "a" (&c->redDither) ); return; case PIX_FMT_YUYV422: __asm__ volatile( "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" "mov %4, %%"REG_b" \n\t" "push %%"REG_BP" \n\t" YSCALEYUV2PACKED1b(%%REGBP, %5) WRITEYUY2(%%REGb, 8280(%5), %%REGBP) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), "a" (&c->redDither) ); return; } } } #endif /* COMPILE_TEMPLATE_MMX */ if (uvalpha < 2048) { YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGB1_C, YSCALE_YUV_2_PACKED1_C(void,0), YSCALE_YUV_2_GRAY16_1_C, YSCALE_YUV_2_MONO2_C) } else { YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGB1B_C, YSCALE_YUV_2_PACKED1B_C(void,0), YSCALE_YUV_2_GRAY16_1_C, YSCALE_YUV_2_MONO2_C) } }
false
FFmpeg
d1adad3cca407f493c3637e20ecd4f7124e69212
static inline void RENAME(yuv2packed1)(SwsContext *c, const uint16_t *buf0, const uint16_t *uvbuf0, const uint16_t *uvbuf1, const uint16_t *abuf0, uint8_t *dest, int dstW, int uvalpha, enum PixelFormat dstFormat, int flags, int y) { const int yalpha1=0; int i; const uint16_t *buf1= buf0; const int yalpha= 4096; if (flags&SWS_FULL_CHR_H_INT) { c->yuv2packed2(c, buf0, buf0, uvbuf0, uvbuf1, abuf0, abuf0, dest, dstW, 0, uvalpha, y); return; } #if COMPILE_TEMPLATE_MMX if(!(flags & SWS_BITEXACT)) { if (uvalpha < 2048) { switch(dstFormat) { case PIX_FMT_RGB32: if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) { __asm__ volatile( "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" "mov %4, %%"REG_b" \n\t" "push %%"REG_BP" \n\t" YSCALEYUV2RGB1(%%REGBP, %5) YSCALEYUV2RGB1_ALPHA(%%REGBP) WRITEBGR32(%%REGb, 8280(%5), %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (abuf0), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), "a" (&c->redDither) ); } else { __asm__ volatile( "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" "mov %4, %%"REG_b" \n\t" "push %%"REG_BP" \n\t" YSCALEYUV2RGB1(%%REGBP, %5) "pcmpeqd %%mm7, %%mm7 \n\t" WRITEBGR32(%%REGb, 8280(%5), %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), "a" (&c->redDither) ); } return; case PIX_FMT_BGR24: __asm__ volatile( "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" "mov %4, %%"REG_b" \n\t" "push %%"REG_BP" \n\t" YSCALEYUV2RGB1(%%REGBP, %5) "pxor %%mm7, %%mm7 \n\t" WRITEBGR24(%%REGb, 8280(%5), %%REGBP) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), "a" (&c->redDither) ); return; case PIX_FMT_RGB555: __asm__ volatile( "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" "mov %4, %%"REG_b" \n\t" "push %%"REG_BP" \n\t" YSCALEYUV2RGB1(%%REGBP, %5) "pxor %%mm7, %%mm7 \n\t" #ifdef DITHER1XBPP "paddusb "BLUE_DITHER"(%5), %%mm2 \n\t" "paddusb "GREEN_DITHER"(%5), %%mm4 \n\t" "paddusb "RED_DITHER"(%5), %%mm5 \n\t" #endif WRITERGB15(%%REGb, 8280(%5), %%REGBP) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), "a" (&c->redDither) ); return; case PIX_FMT_RGB565: __asm__ volatile( "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" "mov %4, %%"REG_b" \n\t" "push %%"REG_BP" \n\t" YSCALEYUV2RGB1(%%REGBP, %5) "pxor %%mm7, %%mm7 \n\t" #ifdef DITHER1XBPP "paddusb "BLUE_DITHER"(%5), %%mm2 \n\t" "paddusb "GREEN_DITHER"(%5), %%mm4 \n\t" "paddusb "RED_DITHER"(%5), %%mm5 \n\t" #endif WRITERGB16(%%REGb, 8280(%5), %%REGBP) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), "a" (&c->redDither) ); return; case PIX_FMT_YUYV422: __asm__ volatile( "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" "mov %4, %%"REG_b" \n\t" "push %%"REG_BP" \n\t" YSCALEYUV2PACKED1(%%REGBP, %5) WRITEYUY2(%%REGb, 8280(%5), %%REGBP) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), "a" (&c->redDither) ); return; } } else { switch(dstFormat) { case PIX_FMT_RGB32: if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) { __asm__ volatile( "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" "mov %4, %%"REG_b" \n\t" "push %%"REG_BP" \n\t" YSCALEYUV2RGB1b(%%REGBP, %5) YSCALEYUV2RGB1_ALPHA(%%REGBP) WRITEBGR32(%%REGb, 8280(%5), %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (abuf0), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), "a" (&c->redDither) ); } else { __asm__ volatile( "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" "mov %4, %%"REG_b" \n\t" "push %%"REG_BP" \n\t" YSCALEYUV2RGB1b(%%REGBP, %5) "pcmpeqd %%mm7, %%mm7 \n\t" WRITEBGR32(%%REGb, 8280(%5), %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), "a" (&c->redDither) ); } return; case PIX_FMT_BGR24: __asm__ volatile( "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" "mov %4, %%"REG_b" \n\t" "push %%"REG_BP" \n\t" YSCALEYUV2RGB1b(%%REGBP, %5) "pxor %%mm7, %%mm7 \n\t" WRITEBGR24(%%REGb, 8280(%5), %%REGBP) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), "a" (&c->redDither) ); return; case PIX_FMT_RGB555: __asm__ volatile( "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" "mov %4, %%"REG_b" \n\t" "push %%"REG_BP" \n\t" YSCALEYUV2RGB1b(%%REGBP, %5) "pxor %%mm7, %%mm7 \n\t" #ifdef DITHER1XBPP "paddusb "BLUE_DITHER"(%5), %%mm2 \n\t" "paddusb "GREEN_DITHER"(%5), %%mm4 \n\t" "paddusb "RED_DITHER"(%5), %%mm5 \n\t" #endif WRITERGB15(%%REGb, 8280(%5), %%REGBP) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), "a" (&c->redDither) ); return; case PIX_FMT_RGB565: __asm__ volatile( "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" "mov %4, %%"REG_b" \n\t" "push %%"REG_BP" \n\t" YSCALEYUV2RGB1b(%%REGBP, %5) "pxor %%mm7, %%mm7 \n\t" #ifdef DITHER1XBPP "paddusb "BLUE_DITHER"(%5), %%mm2 \n\t" "paddusb "GREEN_DITHER"(%5), %%mm4 \n\t" "paddusb "RED_DITHER"(%5), %%mm5 \n\t" #endif WRITERGB16(%%REGb, 8280(%5), %%REGBP) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), "a" (&c->redDither) ); return; case PIX_FMT_YUYV422: __asm__ volatile( "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" "mov %4, %%"REG_b" \n\t" "push %%"REG_BP" \n\t" YSCALEYUV2PACKED1b(%%REGBP, %5) WRITEYUY2(%%REGb, 8280(%5), %%REGBP) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), "a" (&c->redDither) ); return; } } } #endif if (uvalpha < 2048) { YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGB1_C, YSCALE_YUV_2_PACKED1_C(void,0), YSCALE_YUV_2_GRAY16_1_C, YSCALE_YUV_2_MONO2_C) } else { YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGB1B_C, YSCALE_YUV_2_PACKED1B_C(void,0), YSCALE_YUV_2_GRAY16_1_C, YSCALE_YUV_2_MONO2_C) } }
{ "code": [], "line_no": [] }
static inline void FUNC_0(yuv2packed1)(SwsContext *c, const uint16_t *buf0, const uint16_t *uvbuf0, const uint16_t *uvbuf1, const uint16_t *abuf0, uint8_t *dest, int dstW, int uvalpha, enum PixelFormat dstFormat, int flags, int y) { const int VAR_0=0; int VAR_1; const uint16_t *VAR_2= buf0; const int VAR_3= 4096; if (flags&SWS_FULL_CHR_H_INT) { c->yuv2packed2(c, buf0, buf0, uvbuf0, uvbuf1, abuf0, abuf0, dest, dstW, 0, uvalpha, y); return; } #if COMPILE_TEMPLATE_MMX if(!(flags & SWS_BITEXACT)) { if (uvalpha < 2048) { switch(dstFormat) { case PIX_FMT_RGB32: if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) { __asm__ volatile( "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" "mov %4, %%"REG_b" \n\t" "push %%"REG_BP" \n\t" YSCALEYUV2RGB1(%%REGBP, %5) YSCALEYUV2RGB1_ALPHA(%%REGBP) WRITEBGR32(%%REGb, 8280(%5), %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (abuf0), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), "a" (&c->redDither) ); } else { __asm__ volatile( "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" "mov %4, %%"REG_b" \n\t" "push %%"REG_BP" \n\t" YSCALEYUV2RGB1(%%REGBP, %5) "pcmpeqd %%mm7, %%mm7 \n\t" WRITEBGR32(%%REGb, 8280(%5), %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (VAR_2), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), "a" (&c->redDither) ); } return; case PIX_FMT_BGR24: __asm__ volatile( "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" "mov %4, %%"REG_b" \n\t" "push %%"REG_BP" \n\t" YSCALEYUV2RGB1(%%REGBP, %5) "pxor %%mm7, %%mm7 \n\t" WRITEBGR24(%%REGb, 8280(%5), %%REGBP) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (VAR_2), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), "a" (&c->redDither) ); return; case PIX_FMT_RGB555: __asm__ volatile( "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" "mov %4, %%"REG_b" \n\t" "push %%"REG_BP" \n\t" YSCALEYUV2RGB1(%%REGBP, %5) "pxor %%mm7, %%mm7 \n\t" #ifdef DITHER1XBPP "paddusb "BLUE_DITHER"(%5), %%mm2 \n\t" "paddusb "GREEN_DITHER"(%5), %%mm4 \n\t" "paddusb "RED_DITHER"(%5), %%mm5 \n\t" #endif WRITERGB15(%%REGb, 8280(%5), %%REGBP) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (VAR_2), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), "a" (&c->redDither) ); return; case PIX_FMT_RGB565: __asm__ volatile( "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" "mov %4, %%"REG_b" \n\t" "push %%"REG_BP" \n\t" YSCALEYUV2RGB1(%%REGBP, %5) "pxor %%mm7, %%mm7 \n\t" #ifdef DITHER1XBPP "paddusb "BLUE_DITHER"(%5), %%mm2 \n\t" "paddusb "GREEN_DITHER"(%5), %%mm4 \n\t" "paddusb "RED_DITHER"(%5), %%mm5 \n\t" #endif WRITERGB16(%%REGb, 8280(%5), %%REGBP) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (VAR_2), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), "a" (&c->redDither) ); return; case PIX_FMT_YUYV422: __asm__ volatile( "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" "mov %4, %%"REG_b" \n\t" "push %%"REG_BP" \n\t" YSCALEYUV2PACKED1(%%REGBP, %5) WRITEYUY2(%%REGb, 8280(%5), %%REGBP) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (VAR_2), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), "a" (&c->redDither) ); return; } } else { switch(dstFormat) { case PIX_FMT_RGB32: if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) { __asm__ volatile( "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" "mov %4, %%"REG_b" \n\t" "push %%"REG_BP" \n\t" YSCALEYUV2RGB1b(%%REGBP, %5) YSCALEYUV2RGB1_ALPHA(%%REGBP) WRITEBGR32(%%REGb, 8280(%5), %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (abuf0), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), "a" (&c->redDither) ); } else { __asm__ volatile( "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" "mov %4, %%"REG_b" \n\t" "push %%"REG_BP" \n\t" YSCALEYUV2RGB1b(%%REGBP, %5) "pcmpeqd %%mm7, %%mm7 \n\t" WRITEBGR32(%%REGb, 8280(%5), %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (VAR_2), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), "a" (&c->redDither) ); } return; case PIX_FMT_BGR24: __asm__ volatile( "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" "mov %4, %%"REG_b" \n\t" "push %%"REG_BP" \n\t" YSCALEYUV2RGB1b(%%REGBP, %5) "pxor %%mm7, %%mm7 \n\t" WRITEBGR24(%%REGb, 8280(%5), %%REGBP) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (VAR_2), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), "a" (&c->redDither) ); return; case PIX_FMT_RGB555: __asm__ volatile( "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" "mov %4, %%"REG_b" \n\t" "push %%"REG_BP" \n\t" YSCALEYUV2RGB1b(%%REGBP, %5) "pxor %%mm7, %%mm7 \n\t" #ifdef DITHER1XBPP "paddusb "BLUE_DITHER"(%5), %%mm2 \n\t" "paddusb "GREEN_DITHER"(%5), %%mm4 \n\t" "paddusb "RED_DITHER"(%5), %%mm5 \n\t" #endif WRITERGB15(%%REGb, 8280(%5), %%REGBP) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (VAR_2), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), "a" (&c->redDither) ); return; case PIX_FMT_RGB565: __asm__ volatile( "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" "mov %4, %%"REG_b" \n\t" "push %%"REG_BP" \n\t" YSCALEYUV2RGB1b(%%REGBP, %5) "pxor %%mm7, %%mm7 \n\t" #ifdef DITHER1XBPP "paddusb "BLUE_DITHER"(%5), %%mm2 \n\t" "paddusb "GREEN_DITHER"(%5), %%mm4 \n\t" "paddusb "RED_DITHER"(%5), %%mm5 \n\t" #endif WRITERGB16(%%REGb, 8280(%5), %%REGBP) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (VAR_2), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), "a" (&c->redDither) ); return; case PIX_FMT_YUYV422: __asm__ volatile( "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" "mov %4, %%"REG_b" \n\t" "push %%"REG_BP" \n\t" YSCALEYUV2PACKED1b(%%REGBP, %5) WRITEYUY2(%%REGb, 8280(%5), %%REGBP) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (VAR_2), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), "a" (&c->redDither) ); return; } } } #endif if (uvalpha < 2048) { YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGB1_C, YSCALE_YUV_2_PACKED1_C(void,0), YSCALE_YUV_2_GRAY16_1_C, YSCALE_YUV_2_MONO2_C) } else { YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGB1B_C, YSCALE_YUV_2_PACKED1B_C(void,0), YSCALE_YUV_2_GRAY16_1_C, YSCALE_YUV_2_MONO2_C) } }
[ "static inline void FUNC_0(yuv2packed1)(SwsContext *c, const uint16_t *buf0, const uint16_t *uvbuf0, const uint16_t *uvbuf1,\nconst uint16_t *abuf0, uint8_t *dest, int dstW, int uvalpha, enum PixelFormat dstFormat, int flags, int y)\n{", "const int VAR_0=0;", "int VAR_1;", "const uint16_t *VAR_2= buf0;", "const int VAR_3= 4096;", "if (flags&SWS_FULL_CHR_H_INT) {", "c->yuv2packed2(c, buf0, buf0, uvbuf0, uvbuf1, abuf0, abuf0, dest, dstW, 0, uvalpha, y);", "return;", "}", "#if COMPILE_TEMPLATE_MMX\nif(!(flags & SWS_BITEXACT)) {", "if (uvalpha < 2048) {", "switch(dstFormat) {", "case PIX_FMT_RGB32:\nif (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) {", "__asm__ volatile(\n\"mov %%\"REG_b\", \"ESP_OFFSET\"(%5) \\n\\t\"\n\"mov %4, %%\"REG_b\" \\n\\t\"\n\"push %%\"REG_BP\" \\n\\t\"\nYSCALEYUV2RGB1(%%REGBP, %5)\nYSCALEYUV2RGB1_ALPHA(%%REGBP)\nWRITEBGR32(%%REGb, 8280(%5), %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6)\n\"pop %%\"REG_BP\" \\n\\t\"\n\"mov \"ESP_OFFSET\"(%5), %%\"REG_b\" \\n\\t\"\n:: \"c\" (buf0), \"d\" (abuf0), \"S\" (uvbuf0), \"D\" (uvbuf1), \"m\" (dest),\n\"a\" (&c->redDither)\n);", "} else {", "__asm__ volatile(\n\"mov %%\"REG_b\", \"ESP_OFFSET\"(%5) \\n\\t\"\n\"mov %4, %%\"REG_b\" \\n\\t\"\n\"push %%\"REG_BP\" \\n\\t\"\nYSCALEYUV2RGB1(%%REGBP, %5)\n\"pcmpeqd %%mm7, %%mm7 \\n\\t\"\nWRITEBGR32(%%REGb, 8280(%5), %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6)\n\"pop %%\"REG_BP\" \\n\\t\"\n\"mov \"ESP_OFFSET\"(%5), %%\"REG_b\" \\n\\t\"\n:: \"c\" (buf0), \"d\" (VAR_2), \"S\" (uvbuf0), \"D\" (uvbuf1), \"m\" (dest),\n\"a\" (&c->redDither)\n);", "}", "return;", "case PIX_FMT_BGR24:\n__asm__ volatile(\n\"mov %%\"REG_b\", \"ESP_OFFSET\"(%5) \\n\\t\"\n\"mov %4, %%\"REG_b\" \\n\\t\"\n\"push %%\"REG_BP\" \\n\\t\"\nYSCALEYUV2RGB1(%%REGBP, %5)\n\"pxor %%mm7, %%mm7 \\n\\t\"\nWRITEBGR24(%%REGb, 8280(%5), %%REGBP)\n\"pop %%\"REG_BP\" \\n\\t\"\n\"mov \"ESP_OFFSET\"(%5), %%\"REG_b\" \\n\\t\"\n:: \"c\" (buf0), \"d\" (VAR_2), \"S\" (uvbuf0), \"D\" (uvbuf1), \"m\" (dest),\n\"a\" (&c->redDither)\n);", "return;", "case PIX_FMT_RGB555:\n__asm__ volatile(\n\"mov %%\"REG_b\", \"ESP_OFFSET\"(%5) \\n\\t\"\n\"mov %4, %%\"REG_b\" \\n\\t\"\n\"push %%\"REG_BP\" \\n\\t\"\nYSCALEYUV2RGB1(%%REGBP, %5)\n\"pxor %%mm7, %%mm7 \\n\\t\"\n#ifdef DITHER1XBPP\n\"paddusb \"BLUE_DITHER\"(%5), %%mm2 \\n\\t\"\n\"paddusb \"GREEN_DITHER\"(%5), %%mm4 \\n\\t\"\n\"paddusb \"RED_DITHER\"(%5), %%mm5 \\n\\t\"\n#endif\nWRITERGB15(%%REGb, 8280(%5), %%REGBP)\n\"pop %%\"REG_BP\" \\n\\t\"\n\"mov \"ESP_OFFSET\"(%5), %%\"REG_b\" \\n\\t\"\n:: \"c\" (buf0), \"d\" (VAR_2), \"S\" (uvbuf0), \"D\" (uvbuf1), \"m\" (dest),\n\"a\" (&c->redDither)\n);", "return;", "case PIX_FMT_RGB565:\n__asm__ volatile(\n\"mov %%\"REG_b\", \"ESP_OFFSET\"(%5) \\n\\t\"\n\"mov %4, %%\"REG_b\" \\n\\t\"\n\"push %%\"REG_BP\" \\n\\t\"\nYSCALEYUV2RGB1(%%REGBP, %5)\n\"pxor %%mm7, %%mm7 \\n\\t\"\n#ifdef DITHER1XBPP\n\"paddusb \"BLUE_DITHER\"(%5), %%mm2 \\n\\t\"\n\"paddusb \"GREEN_DITHER\"(%5), %%mm4 \\n\\t\"\n\"paddusb \"RED_DITHER\"(%5), %%mm5 \\n\\t\"\n#endif\nWRITERGB16(%%REGb, 8280(%5), %%REGBP)\n\"pop %%\"REG_BP\" \\n\\t\"\n\"mov \"ESP_OFFSET\"(%5), %%\"REG_b\" \\n\\t\"\n:: \"c\" (buf0), \"d\" (VAR_2), \"S\" (uvbuf0), \"D\" (uvbuf1), \"m\" (dest),\n\"a\" (&c->redDither)\n);", "return;", "case PIX_FMT_YUYV422:\n__asm__ volatile(\n\"mov %%\"REG_b\", \"ESP_OFFSET\"(%5) \\n\\t\"\n\"mov %4, %%\"REG_b\" \\n\\t\"\n\"push %%\"REG_BP\" \\n\\t\"\nYSCALEYUV2PACKED1(%%REGBP, %5)\nWRITEYUY2(%%REGb, 8280(%5), %%REGBP)\n\"pop %%\"REG_BP\" \\n\\t\"\n\"mov \"ESP_OFFSET\"(%5), %%\"REG_b\" \\n\\t\"\n:: \"c\" (buf0), \"d\" (VAR_2), \"S\" (uvbuf0), \"D\" (uvbuf1), \"m\" (dest),\n\"a\" (&c->redDither)\n);", "return;", "}", "} else {", "switch(dstFormat) {", "case PIX_FMT_RGB32:\nif (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) {", "__asm__ volatile(\n\"mov %%\"REG_b\", \"ESP_OFFSET\"(%5) \\n\\t\"\n\"mov %4, %%\"REG_b\" \\n\\t\"\n\"push %%\"REG_BP\" \\n\\t\"\nYSCALEYUV2RGB1b(%%REGBP, %5)\nYSCALEYUV2RGB1_ALPHA(%%REGBP)\nWRITEBGR32(%%REGb, 8280(%5), %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6)\n\"pop %%\"REG_BP\" \\n\\t\"\n\"mov \"ESP_OFFSET\"(%5), %%\"REG_b\" \\n\\t\"\n:: \"c\" (buf0), \"d\" (abuf0), \"S\" (uvbuf0), \"D\" (uvbuf1), \"m\" (dest),\n\"a\" (&c->redDither)\n);", "} else {", "__asm__ volatile(\n\"mov %%\"REG_b\", \"ESP_OFFSET\"(%5) \\n\\t\"\n\"mov %4, %%\"REG_b\" \\n\\t\"\n\"push %%\"REG_BP\" \\n\\t\"\nYSCALEYUV2RGB1b(%%REGBP, %5)\n\"pcmpeqd %%mm7, %%mm7 \\n\\t\"\nWRITEBGR32(%%REGb, 8280(%5), %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6)\n\"pop %%\"REG_BP\" \\n\\t\"\n\"mov \"ESP_OFFSET\"(%5), %%\"REG_b\" \\n\\t\"\n:: \"c\" (buf0), \"d\" (VAR_2), \"S\" (uvbuf0), \"D\" (uvbuf1), \"m\" (dest),\n\"a\" (&c->redDither)\n);", "}", "return;", "case PIX_FMT_BGR24:\n__asm__ volatile(\n\"mov %%\"REG_b\", \"ESP_OFFSET\"(%5) \\n\\t\"\n\"mov %4, %%\"REG_b\" \\n\\t\"\n\"push %%\"REG_BP\" \\n\\t\"\nYSCALEYUV2RGB1b(%%REGBP, %5)\n\"pxor %%mm7, %%mm7 \\n\\t\"\nWRITEBGR24(%%REGb, 8280(%5), %%REGBP)\n\"pop %%\"REG_BP\" \\n\\t\"\n\"mov \"ESP_OFFSET\"(%5), %%\"REG_b\" \\n\\t\"\n:: \"c\" (buf0), \"d\" (VAR_2), \"S\" (uvbuf0), \"D\" (uvbuf1), \"m\" (dest),\n\"a\" (&c->redDither)\n);", "return;", "case PIX_FMT_RGB555:\n__asm__ volatile(\n\"mov %%\"REG_b\", \"ESP_OFFSET\"(%5) \\n\\t\"\n\"mov %4, %%\"REG_b\" \\n\\t\"\n\"push %%\"REG_BP\" \\n\\t\"\nYSCALEYUV2RGB1b(%%REGBP, %5)\n\"pxor %%mm7, %%mm7 \\n\\t\"\n#ifdef DITHER1XBPP\n\"paddusb \"BLUE_DITHER\"(%5), %%mm2 \\n\\t\"\n\"paddusb \"GREEN_DITHER\"(%5), %%mm4 \\n\\t\"\n\"paddusb \"RED_DITHER\"(%5), %%mm5 \\n\\t\"\n#endif\nWRITERGB15(%%REGb, 8280(%5), %%REGBP)\n\"pop %%\"REG_BP\" \\n\\t\"\n\"mov \"ESP_OFFSET\"(%5), %%\"REG_b\" \\n\\t\"\n:: \"c\" (buf0), \"d\" (VAR_2), \"S\" (uvbuf0), \"D\" (uvbuf1), \"m\" (dest),\n\"a\" (&c->redDither)\n);", "return;", "case PIX_FMT_RGB565:\n__asm__ volatile(\n\"mov %%\"REG_b\", \"ESP_OFFSET\"(%5) \\n\\t\"\n\"mov %4, %%\"REG_b\" \\n\\t\"\n\"push %%\"REG_BP\" \\n\\t\"\nYSCALEYUV2RGB1b(%%REGBP, %5)\n\"pxor %%mm7, %%mm7 \\n\\t\"\n#ifdef DITHER1XBPP\n\"paddusb \"BLUE_DITHER\"(%5), %%mm2 \\n\\t\"\n\"paddusb \"GREEN_DITHER\"(%5), %%mm4 \\n\\t\"\n\"paddusb \"RED_DITHER\"(%5), %%mm5 \\n\\t\"\n#endif\nWRITERGB16(%%REGb, 8280(%5), %%REGBP)\n\"pop %%\"REG_BP\" \\n\\t\"\n\"mov \"ESP_OFFSET\"(%5), %%\"REG_b\" \\n\\t\"\n:: \"c\" (buf0), \"d\" (VAR_2), \"S\" (uvbuf0), \"D\" (uvbuf1), \"m\" (dest),\n\"a\" (&c->redDither)\n);", "return;", "case PIX_FMT_YUYV422:\n__asm__ volatile(\n\"mov %%\"REG_b\", \"ESP_OFFSET\"(%5) \\n\\t\"\n\"mov %4, %%\"REG_b\" \\n\\t\"\n\"push %%\"REG_BP\" \\n\\t\"\nYSCALEYUV2PACKED1b(%%REGBP, %5)\nWRITEYUY2(%%REGb, 8280(%5), %%REGBP)\n\"pop %%\"REG_BP\" \\n\\t\"\n\"mov \"ESP_OFFSET\"(%5), %%\"REG_b\" \\n\\t\"\n:: \"c\" (buf0), \"d\" (VAR_2), \"S\" (uvbuf0), \"D\" (uvbuf1), \"m\" (dest),\n\"a\" (&c->redDither)\n);", "return;", "}", "}", "}", "#endif\nif (uvalpha < 2048) {", "YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGB1_C, YSCALE_YUV_2_PACKED1_C(void,0), YSCALE_YUV_2_GRAY16_1_C, YSCALE_YUV_2_MONO2_C)\n} else {", "YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGB1B_C, YSCALE_YUV_2_PACKED1B_C(void,0), YSCALE_YUV_2_GRAY16_1_C, YSCALE_YUV_2_MONO2_C)\n}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29, 31 ], [ 33 ], [ 35 ], [ 37, 39 ], [ 41, 43, 45, 47, 49, 51, 53, 55, 57, 61, 63, 65 ], [ 67 ], [ 69, 71, 73, 75, 77, 79, 81, 83, 85, 89, 91, 93 ], [ 95 ], [ 97 ], [ 99, 101, 103, 105, 107, 109, 111, 113, 115, 117, 121, 123, 125 ], [ 127 ], [ 129, 131, 133, 135, 137, 139, 141, 145, 147, 149, 151, 153, 155, 157, 159, 163, 165, 167 ], [ 169 ], [ 171, 173, 175, 177, 179, 181, 183, 187, 189, 191, 193, 195, 199, 201, 203, 207, 209, 211 ], [ 213 ], [ 215, 217, 219, 221, 223, 225, 227, 229, 231, 235, 237, 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249, 251 ], [ 253, 255, 257, 259, 261, 263, 265, 267, 269, 273, 275, 277 ], [ 279 ], [ 281, 283, 285, 287, 289, 291, 293, 295, 297, 301, 303, 305 ], [ 307 ], [ 309 ], [ 311, 313, 315, 317, 319, 321, 323, 325, 327, 329, 333, 335, 337 ], [ 339 ], [ 341, 343, 345, 347, 349, 351, 353, 357, 359, 361, 363, 365, 367, 369, 371, 375, 377, 379 ], [ 381 ], [ 383, 385, 387, 389, 391, 393, 395, 399, 401, 403, 405, 407, 411, 413, 415, 419, 421, 423 ], [ 425 ], [ 427, 429, 431, 433, 435, 437, 439, 441, 443, 447, 449, 451 ], [ 453 ], [ 455 ], [ 457 ], [ 459 ], [ 461, 463 ], [ 465, 467 ], [ 469, 471 ], [ 473 ] ]
18,807
static int flic_read_header(AVFormatContext *s, AVFormatParameters *ap) { FlicDemuxContext *flic = s->priv_data; ByteIOContext *pb = &s->pb; unsigned char header[FLIC_HEADER_SIZE]; AVStream *st; int speed; int magic_number; flic->pts = 0; /* load the whole header and pull out the width and height */ if (get_buffer(pb, header, FLIC_HEADER_SIZE) != FLIC_HEADER_SIZE) return AVERROR(EIO); magic_number = AV_RL16(&header[4]); speed = AV_RL32(&header[0x10]); /* initialize the decoder streams */ st = av_new_stream(s, 0); if (!st) return AVERROR(ENOMEM); flic->video_stream_index = st->index; st->codec->codec_type = CODEC_TYPE_VIDEO; st->codec->codec_id = CODEC_ID_FLIC; st->codec->codec_tag = 0; /* no fourcc */ st->codec->width = AV_RL16(&header[0x08]); st->codec->height = AV_RL16(&header[0x0A]); if (!st->codec->width || !st->codec->height) return AVERROR_INVALIDDATA; /* send over the whole 128-byte FLIC header */ st->codec->extradata_size = FLIC_HEADER_SIZE; st->codec->extradata = av_malloc(FLIC_HEADER_SIZE); memcpy(st->codec->extradata, header, FLIC_HEADER_SIZE); av_set_pts_info(st, 33, 1, 90000); /* Time to figure out the framerate: If there is a FLIC chunk magic * number at offset 0x10, assume this is from the Bullfrog game, * Magic Carpet. */ if (AV_RL16(&header[0x10]) == FLIC_CHUNK_MAGIC_1) { flic->frame_pts_inc = FLIC_MC_PTS_INC; /* rewind the stream since the first chunk is at offset 12 */ url_fseek(pb, 12, SEEK_SET); /* send over abbreviated FLIC header chunk */ av_free(st->codec->extradata); st->codec->extradata_size = 12; st->codec->extradata = av_malloc(12); memcpy(st->codec->extradata, header, 12); } else if (magic_number == FLIC_FILE_MAGIC_1) { /* * in this case, the speed (n) is number of 1/70s ticks between frames: * * pts n * frame # * -------- = ----------- => pts = n * (90000/70) * frame # * 90000 70 * * therefore, the frame pts increment = n * 1285.7 */ flic->frame_pts_inc = speed * 1285.7; } else if ((magic_number == FLIC_FILE_MAGIC_2) || (magic_number == FLIC_FILE_MAGIC_3)) { /* * in this case, the speed (n) is number of milliseconds between frames: * * pts n * frame # * -------- = ----------- => pts = n * 90 * frame # * 90000 1000 * * therefore, the frame pts increment = n * 90 */ flic->frame_pts_inc = speed * 90; } else { av_log(s, AV_LOG_INFO, "Invalid or unsupported magic chunk in file\n"); return AVERROR_INVALIDDATA; } if (flic->frame_pts_inc == 0) flic->frame_pts_inc = FLIC_DEFAULT_PTS_INC; return 0; }
false
FFmpeg
77cb22fa7b3f632c16aa3d4e7aa7d47f9cd99f2c
static int flic_read_header(AVFormatContext *s, AVFormatParameters *ap) { FlicDemuxContext *flic = s->priv_data; ByteIOContext *pb = &s->pb; unsigned char header[FLIC_HEADER_SIZE]; AVStream *st; int speed; int magic_number; flic->pts = 0; if (get_buffer(pb, header, FLIC_HEADER_SIZE) != FLIC_HEADER_SIZE) return AVERROR(EIO); magic_number = AV_RL16(&header[4]); speed = AV_RL32(&header[0x10]); st = av_new_stream(s, 0); if (!st) return AVERROR(ENOMEM); flic->video_stream_index = st->index; st->codec->codec_type = CODEC_TYPE_VIDEO; st->codec->codec_id = CODEC_ID_FLIC; st->codec->codec_tag = 0; st->codec->width = AV_RL16(&header[0x08]); st->codec->height = AV_RL16(&header[0x0A]); if (!st->codec->width || !st->codec->height) return AVERROR_INVALIDDATA; st->codec->extradata_size = FLIC_HEADER_SIZE; st->codec->extradata = av_malloc(FLIC_HEADER_SIZE); memcpy(st->codec->extradata, header, FLIC_HEADER_SIZE); av_set_pts_info(st, 33, 1, 90000); if (AV_RL16(&header[0x10]) == FLIC_CHUNK_MAGIC_1) { flic->frame_pts_inc = FLIC_MC_PTS_INC; url_fseek(pb, 12, SEEK_SET); av_free(st->codec->extradata); st->codec->extradata_size = 12; st->codec->extradata = av_malloc(12); memcpy(st->codec->extradata, header, 12); } else if (magic_number == FLIC_FILE_MAGIC_1) { flic->frame_pts_inc = speed * 1285.7; } else if ((magic_number == FLIC_FILE_MAGIC_2) || (magic_number == FLIC_FILE_MAGIC_3)) { flic->frame_pts_inc = speed * 90; } else { av_log(s, AV_LOG_INFO, "Invalid or unsupported magic chunk in file\n"); return AVERROR_INVALIDDATA; } if (flic->frame_pts_inc == 0) flic->frame_pts_inc = FLIC_DEFAULT_PTS_INC; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0, AVFormatParameters *VAR_1) { FlicDemuxContext *flic = VAR_0->priv_data; ByteIOContext *pb = &VAR_0->pb; unsigned char VAR_2[FLIC_HEADER_SIZE]; AVStream *st; int VAR_3; int VAR_4; flic->pts = 0; if (get_buffer(pb, VAR_2, FLIC_HEADER_SIZE) != FLIC_HEADER_SIZE) return AVERROR(EIO); VAR_4 = AV_RL16(&VAR_2[4]); VAR_3 = AV_RL32(&VAR_2[0x10]); st = av_new_stream(VAR_0, 0); if (!st) return AVERROR(ENOMEM); flic->video_stream_index = st->index; st->codec->codec_type = CODEC_TYPE_VIDEO; st->codec->codec_id = CODEC_ID_FLIC; st->codec->codec_tag = 0; st->codec->width = AV_RL16(&VAR_2[0x08]); st->codec->height = AV_RL16(&VAR_2[0x0A]); if (!st->codec->width || !st->codec->height) return AVERROR_INVALIDDATA; st->codec->extradata_size = FLIC_HEADER_SIZE; st->codec->extradata = av_malloc(FLIC_HEADER_SIZE); memcpy(st->codec->extradata, VAR_2, FLIC_HEADER_SIZE); av_set_pts_info(st, 33, 1, 90000); if (AV_RL16(&VAR_2[0x10]) == FLIC_CHUNK_MAGIC_1) { flic->frame_pts_inc = FLIC_MC_PTS_INC; url_fseek(pb, 12, SEEK_SET); av_free(st->codec->extradata); st->codec->extradata_size = 12; st->codec->extradata = av_malloc(12); memcpy(st->codec->extradata, VAR_2, 12); } else if (VAR_4 == FLIC_FILE_MAGIC_1) { flic->frame_pts_inc = VAR_3 * 1285.7; } else if ((VAR_4 == FLIC_FILE_MAGIC_2) || (VAR_4 == FLIC_FILE_MAGIC_3)) { flic->frame_pts_inc = VAR_3 * 90; } else { av_log(VAR_0, AV_LOG_INFO, "Invalid or unsupported magic chunk in file\n"); return AVERROR_INVALIDDATA; } if (flic->frame_pts_inc == 0) flic->frame_pts_inc = FLIC_DEFAULT_PTS_INC; return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0,\nAVFormatParameters *VAR_1)\n{", "FlicDemuxContext *flic = VAR_0->priv_data;", "ByteIOContext *pb = &VAR_0->pb;", "unsigned char VAR_2[FLIC_HEADER_SIZE];", "AVStream *st;", "int VAR_3;", "int VAR_4;", "flic->pts = 0;", "if (get_buffer(pb, VAR_2, FLIC_HEADER_SIZE) != FLIC_HEADER_SIZE)\nreturn AVERROR(EIO);", "VAR_4 = AV_RL16(&VAR_2[4]);", "VAR_3 = AV_RL32(&VAR_2[0x10]);", "st = av_new_stream(VAR_0, 0);", "if (!st)\nreturn AVERROR(ENOMEM);", "flic->video_stream_index = st->index;", "st->codec->codec_type = CODEC_TYPE_VIDEO;", "st->codec->codec_id = CODEC_ID_FLIC;", "st->codec->codec_tag = 0;", "st->codec->width = AV_RL16(&VAR_2[0x08]);", "st->codec->height = AV_RL16(&VAR_2[0x0A]);", "if (!st->codec->width || !st->codec->height)\nreturn AVERROR_INVALIDDATA;", "st->codec->extradata_size = FLIC_HEADER_SIZE;", "st->codec->extradata = av_malloc(FLIC_HEADER_SIZE);", "memcpy(st->codec->extradata, VAR_2, FLIC_HEADER_SIZE);", "av_set_pts_info(st, 33, 1, 90000);", "if (AV_RL16(&VAR_2[0x10]) == FLIC_CHUNK_MAGIC_1) {", "flic->frame_pts_inc = FLIC_MC_PTS_INC;", "url_fseek(pb, 12, SEEK_SET);", "av_free(st->codec->extradata);", "st->codec->extradata_size = 12;", "st->codec->extradata = av_malloc(12);", "memcpy(st->codec->extradata, VAR_2, 12);", "} else if (VAR_4 == FLIC_FILE_MAGIC_1) {", "flic->frame_pts_inc = VAR_3 * 1285.7;", "} else if ((VAR_4 == FLIC_FILE_MAGIC_2) ||", "(VAR_4 == FLIC_FILE_MAGIC_3)) {", "flic->frame_pts_inc = VAR_3 * 90;", "} else {", "av_log(VAR_0, AV_LOG_INFO, \"Invalid or unsupported magic chunk in file\\n\");", "return AVERROR_INVALIDDATA;", "}", "if (flic->frame_pts_inc == 0)\nflic->frame_pts_inc = FLIC_DEFAULT_PTS_INC;", "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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 27, 29 ], [ 33 ], [ 35 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61, 63 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 87 ], [ 91 ], [ 97 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 113 ], [ 133 ], [ 135 ], [ 137 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 169, 171 ], [ 175 ], [ 177 ] ]
18,808
static void show_format(WriterContext *w, AVFormatContext *fmt_ctx) { char val_str[128]; int64_t size = fmt_ctx->pb ? avio_size(fmt_ctx->pb) : -1; writer_print_section_header(w, SECTION_ID_FORMAT); print_str("filename", fmt_ctx->filename); print_int("nb_streams", fmt_ctx->nb_streams); print_int("nb_programs", fmt_ctx->nb_programs); print_str("format_name", fmt_ctx->iformat->name); if (!do_bitexact) { if (fmt_ctx->iformat->long_name) print_str ("format_long_name", fmt_ctx->iformat->long_name); else print_str_opt("format_long_name", "unknown"); } print_time("start_time", fmt_ctx->start_time, &AV_TIME_BASE_Q); print_time("duration", fmt_ctx->duration, &AV_TIME_BASE_Q); if (size >= 0) print_val ("size", size, unit_byte_str); else print_str_opt("size", "N/A"); if (fmt_ctx->bit_rate > 0) print_val ("bit_rate", fmt_ctx->bit_rate, unit_bit_per_second_str); else print_str_opt("bit_rate", "N/A"); print_int("probe_score", av_format_get_probe_score(fmt_ctx)); show_tags(w, fmt_ctx->metadata, SECTION_ID_FORMAT_TAGS); writer_print_section_footer(w); fflush(stdout); }
false
FFmpeg
e87190f5d20d380608f792ceb14d0def1d80e24b
static void show_format(WriterContext *w, AVFormatContext *fmt_ctx) { char val_str[128]; int64_t size = fmt_ctx->pb ? avio_size(fmt_ctx->pb) : -1; writer_print_section_header(w, SECTION_ID_FORMAT); print_str("filename", fmt_ctx->filename); print_int("nb_streams", fmt_ctx->nb_streams); print_int("nb_programs", fmt_ctx->nb_programs); print_str("format_name", fmt_ctx->iformat->name); if (!do_bitexact) { if (fmt_ctx->iformat->long_name) print_str ("format_long_name", fmt_ctx->iformat->long_name); else print_str_opt("format_long_name", "unknown"); } print_time("start_time", fmt_ctx->start_time, &AV_TIME_BASE_Q); print_time("duration", fmt_ctx->duration, &AV_TIME_BASE_Q); if (size >= 0) print_val ("size", size, unit_byte_str); else print_str_opt("size", "N/A"); if (fmt_ctx->bit_rate > 0) print_val ("bit_rate", fmt_ctx->bit_rate, unit_bit_per_second_str); else print_str_opt("bit_rate", "N/A"); print_int("probe_score", av_format_get_probe_score(fmt_ctx)); show_tags(w, fmt_ctx->metadata, SECTION_ID_FORMAT_TAGS); writer_print_section_footer(w); fflush(stdout); }
{ "code": [], "line_no": [] }
static void FUNC_0(WriterContext *VAR_0, AVFormatContext *VAR_1) { char VAR_2[128]; int64_t size = VAR_1->pb ? avio_size(VAR_1->pb) : -1; writer_print_section_header(VAR_0, SECTION_ID_FORMAT); print_str("filename", VAR_1->filename); print_int("nb_streams", VAR_1->nb_streams); print_int("nb_programs", VAR_1->nb_programs); print_str("format_name", VAR_1->iformat->name); if (!do_bitexact) { if (VAR_1->iformat->long_name) print_str ("format_long_name", VAR_1->iformat->long_name); else print_str_opt("format_long_name", "unknown"); } print_time("start_time", VAR_1->start_time, &AV_TIME_BASE_Q); print_time("duration", VAR_1->duration, &AV_TIME_BASE_Q); if (size >= 0) print_val ("size", size, unit_byte_str); else print_str_opt("size", "N/A"); if (VAR_1->bit_rate > 0) print_val ("bit_rate", VAR_1->bit_rate, unit_bit_per_second_str); else print_str_opt("bit_rate", "N/A"); print_int("probe_score", av_format_get_probe_score(VAR_1)); show_tags(VAR_0, VAR_1->metadata, SECTION_ID_FORMAT_TAGS); writer_print_section_footer(VAR_0); fflush(stdout); }
[ "static void FUNC_0(WriterContext *VAR_0, AVFormatContext *VAR_1)\n{", "char VAR_2[128];", "int64_t size = VAR_1->pb ? avio_size(VAR_1->pb) : -1;", "writer_print_section_header(VAR_0, SECTION_ID_FORMAT);", "print_str(\"filename\", VAR_1->filename);", "print_int(\"nb_streams\", VAR_1->nb_streams);", "print_int(\"nb_programs\", VAR_1->nb_programs);", "print_str(\"format_name\", VAR_1->iformat->name);", "if (!do_bitexact) {", "if (VAR_1->iformat->long_name) print_str (\"format_long_name\", VAR_1->iformat->long_name);", "else print_str_opt(\"format_long_name\", \"unknown\");", "}", "print_time(\"start_time\", VAR_1->start_time, &AV_TIME_BASE_Q);", "print_time(\"duration\", VAR_1->duration, &AV_TIME_BASE_Q);", "if (size >= 0) print_val (\"size\", size, unit_byte_str);", "else print_str_opt(\"size\", \"N/A\");", "if (VAR_1->bit_rate > 0) print_val (\"bit_rate\", VAR_1->bit_rate, unit_bit_per_second_str);", "else print_str_opt(\"bit_rate\", \"N/A\");", "print_int(\"probe_score\", av_format_get_probe_score(VAR_1));", "show_tags(VAR_0, VAR_1->metadata, SECTION_ID_FORMAT_TAGS);", "writer_print_section_footer(VAR_0);", "fflush(stdout);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ] ]
18,809
static void flush_encoders(OutputStream *ost_table, int nb_ostreams) { int i, ret; for (i = 0; i < nb_ostreams; i++) { OutputStream *ost = &ost_table[i]; AVCodecContext *enc = ost->st->codec; AVFormatContext *os = output_files[ost->file_index].ctx; if (!ost->encoding_needed) continue; if (ost->st->codec->codec_type == AVMEDIA_TYPE_AUDIO && enc->frame_size <=1) continue; if (ost->st->codec->codec_type == AVMEDIA_TYPE_VIDEO && (os->oformat->flags & AVFMT_RAWPICTURE)) continue; for(;;) { AVPacket pkt; int fifo_bytes; av_init_packet(&pkt); pkt.stream_index= ost->index; switch (ost->st->codec->codec_type) { case AVMEDIA_TYPE_AUDIO: fifo_bytes = av_fifo_size(ost->fifo); ret = 0; /* encode any samples remaining in fifo */ if (fifo_bytes > 0) { int osize = av_get_bytes_per_sample(enc->sample_fmt); int fs_tmp = enc->frame_size; av_fifo_generic_read(ost->fifo, audio_buf, fifo_bytes, NULL); if (enc->codec->capabilities & CODEC_CAP_SMALL_LAST_FRAME) { enc->frame_size = fifo_bytes / (osize * enc->channels); } else { /* pad */ int frame_bytes = enc->frame_size*osize*enc->channels; if (allocated_audio_buf_size < frame_bytes) exit_program(1); generate_silence(audio_buf+fifo_bytes, enc->sample_fmt, frame_bytes - fifo_bytes); } ret = avcodec_encode_audio(enc, bit_buffer, bit_buffer_size, (short *)audio_buf); pkt.duration = av_rescale((int64_t)enc->frame_size*ost->st->time_base.den, ost->st->time_base.num, enc->sample_rate); enc->frame_size = fs_tmp; } if (ret <= 0) { ret = avcodec_encode_audio(enc, bit_buffer, bit_buffer_size, NULL); } if (ret < 0) { av_log(NULL, AV_LOG_FATAL, "Audio encoding failed\n"); exit_program(1); } audio_size += ret; pkt.flags |= AV_PKT_FLAG_KEY; break; case AVMEDIA_TYPE_VIDEO: ret = avcodec_encode_video(enc, bit_buffer, bit_buffer_size, NULL); if (ret < 0) { av_log(NULL, AV_LOG_FATAL, "Video encoding failed\n"); exit_program(1); } video_size += ret; if(enc->coded_frame && enc->coded_frame->key_frame) pkt.flags |= AV_PKT_FLAG_KEY; if (ost->logfile && enc->stats_out) { fprintf(ost->logfile, "%s", enc->stats_out); } break; default: ret=-1; } if (ret <= 0) break; pkt.data = bit_buffer; pkt.size = ret; if (enc->coded_frame && enc->coded_frame->pts != AV_NOPTS_VALUE) pkt.pts= av_rescale_q(enc->coded_frame->pts, enc->time_base, ost->st->time_base); write_frame(os, &pkt, ost->st->codec, ost->bitstream_filters); } } }
false
FFmpeg
150ddbc1482c65b9aac803f011d7fcd734f776ec
static void flush_encoders(OutputStream *ost_table, int nb_ostreams) { int i, ret; for (i = 0; i < nb_ostreams; i++) { OutputStream *ost = &ost_table[i]; AVCodecContext *enc = ost->st->codec; AVFormatContext *os = output_files[ost->file_index].ctx; if (!ost->encoding_needed) continue; if (ost->st->codec->codec_type == AVMEDIA_TYPE_AUDIO && enc->frame_size <=1) continue; if (ost->st->codec->codec_type == AVMEDIA_TYPE_VIDEO && (os->oformat->flags & AVFMT_RAWPICTURE)) continue; for(;;) { AVPacket pkt; int fifo_bytes; av_init_packet(&pkt); pkt.stream_index= ost->index; switch (ost->st->codec->codec_type) { case AVMEDIA_TYPE_AUDIO: fifo_bytes = av_fifo_size(ost->fifo); ret = 0; if (fifo_bytes > 0) { int osize = av_get_bytes_per_sample(enc->sample_fmt); int fs_tmp = enc->frame_size; av_fifo_generic_read(ost->fifo, audio_buf, fifo_bytes, NULL); if (enc->codec->capabilities & CODEC_CAP_SMALL_LAST_FRAME) { enc->frame_size = fifo_bytes / (osize * enc->channels); } else { int frame_bytes = enc->frame_size*osize*enc->channels; if (allocated_audio_buf_size < frame_bytes) exit_program(1); generate_silence(audio_buf+fifo_bytes, enc->sample_fmt, frame_bytes - fifo_bytes); } ret = avcodec_encode_audio(enc, bit_buffer, bit_buffer_size, (short *)audio_buf); pkt.duration = av_rescale((int64_t)enc->frame_size*ost->st->time_base.den, ost->st->time_base.num, enc->sample_rate); enc->frame_size = fs_tmp; } if (ret <= 0) { ret = avcodec_encode_audio(enc, bit_buffer, bit_buffer_size, NULL); } if (ret < 0) { av_log(NULL, AV_LOG_FATAL, "Audio encoding failed\n"); exit_program(1); } audio_size += ret; pkt.flags |= AV_PKT_FLAG_KEY; break; case AVMEDIA_TYPE_VIDEO: ret = avcodec_encode_video(enc, bit_buffer, bit_buffer_size, NULL); if (ret < 0) { av_log(NULL, AV_LOG_FATAL, "Video encoding failed\n"); exit_program(1); } video_size += ret; if(enc->coded_frame && enc->coded_frame->key_frame) pkt.flags |= AV_PKT_FLAG_KEY; if (ost->logfile && enc->stats_out) { fprintf(ost->logfile, "%s", enc->stats_out); } break; default: ret=-1; } if (ret <= 0) break; pkt.data = bit_buffer; pkt.size = ret; if (enc->coded_frame && enc->coded_frame->pts != AV_NOPTS_VALUE) pkt.pts= av_rescale_q(enc->coded_frame->pts, enc->time_base, ost->st->time_base); write_frame(os, &pkt, ost->st->codec, ost->bitstream_filters); } } }
{ "code": [], "line_no": [] }
static void FUNC_0(OutputStream *VAR_0, int VAR_1) { int VAR_2, VAR_3; for (VAR_2 = 0; VAR_2 < VAR_1; VAR_2++) { OutputStream *ost = &VAR_0[VAR_2]; AVCodecContext *enc = ost->st->codec; AVFormatContext *os = output_files[ost->file_index].ctx; if (!ost->encoding_needed) continue; if (ost->st->codec->codec_type == AVMEDIA_TYPE_AUDIO && enc->frame_size <=1) continue; if (ost->st->codec->codec_type == AVMEDIA_TYPE_VIDEO && (os->oformat->flags & AVFMT_RAWPICTURE)) continue; for(;;) { AVPacket pkt; int VAR_4; av_init_packet(&pkt); pkt.stream_index= ost->index; switch (ost->st->codec->codec_type) { case AVMEDIA_TYPE_AUDIO: VAR_4 = av_fifo_size(ost->fifo); VAR_3 = 0; if (VAR_4 > 0) { int VAR_5 = av_get_bytes_per_sample(enc->sample_fmt); int VAR_6 = enc->frame_size; av_fifo_generic_read(ost->fifo, audio_buf, VAR_4, NULL); if (enc->codec->capabilities & CODEC_CAP_SMALL_LAST_FRAME) { enc->frame_size = VAR_4 / (VAR_5 * enc->channels); } else { int VAR_7 = enc->frame_size*VAR_5*enc->channels; if (allocated_audio_buf_size < VAR_7) exit_program(1); generate_silence(audio_buf+VAR_4, enc->sample_fmt, VAR_7 - VAR_4); } VAR_3 = avcodec_encode_audio(enc, bit_buffer, bit_buffer_size, (short *)audio_buf); pkt.duration = av_rescale((int64_t)enc->frame_size*ost->st->time_base.den, ost->st->time_base.num, enc->sample_rate); enc->frame_size = VAR_6; } if (VAR_3 <= 0) { VAR_3 = avcodec_encode_audio(enc, bit_buffer, bit_buffer_size, NULL); } if (VAR_3 < 0) { av_log(NULL, AV_LOG_FATAL, "Audio encoding failed\n"); exit_program(1); } audio_size += VAR_3; pkt.flags |= AV_PKT_FLAG_KEY; break; case AVMEDIA_TYPE_VIDEO: VAR_3 = avcodec_encode_video(enc, bit_buffer, bit_buffer_size, NULL); if (VAR_3 < 0) { av_log(NULL, AV_LOG_FATAL, "Video encoding failed\n"); exit_program(1); } video_size += VAR_3; if(enc->coded_frame && enc->coded_frame->key_frame) pkt.flags |= AV_PKT_FLAG_KEY; if (ost->logfile && enc->stats_out) { fprintf(ost->logfile, "%s", enc->stats_out); } break; default: VAR_3=-1; } if (VAR_3 <= 0) break; pkt.data = bit_buffer; pkt.size = VAR_3; if (enc->coded_frame && enc->coded_frame->pts != AV_NOPTS_VALUE) pkt.pts= av_rescale_q(enc->coded_frame->pts, enc->time_base, ost->st->time_base); write_frame(os, &pkt, ost->st->codec, ost->bitstream_filters); } } }
[ "static void FUNC_0(OutputStream *VAR_0, int VAR_1)\n{", "int VAR_2, VAR_3;", "for (VAR_2 = 0; VAR_2 < VAR_1; VAR_2++) {", "OutputStream *ost = &VAR_0[VAR_2];", "AVCodecContext *enc = ost->st->codec;", "AVFormatContext *os = output_files[ost->file_index].ctx;", "if (!ost->encoding_needed)\ncontinue;", "if (ost->st->codec->codec_type == AVMEDIA_TYPE_AUDIO && enc->frame_size <=1)\ncontinue;", "if (ost->st->codec->codec_type == AVMEDIA_TYPE_VIDEO && (os->oformat->flags & AVFMT_RAWPICTURE))\ncontinue;", "for(;;) {", "AVPacket pkt;", "int VAR_4;", "av_init_packet(&pkt);", "pkt.stream_index= ost->index;", "switch (ost->st->codec->codec_type) {", "case AVMEDIA_TYPE_AUDIO:\nVAR_4 = av_fifo_size(ost->fifo);", "VAR_3 = 0;", "if (VAR_4 > 0) {", "int VAR_5 = av_get_bytes_per_sample(enc->sample_fmt);", "int VAR_6 = enc->frame_size;", "av_fifo_generic_read(ost->fifo, audio_buf, VAR_4, NULL);", "if (enc->codec->capabilities & CODEC_CAP_SMALL_LAST_FRAME) {", "enc->frame_size = VAR_4 / (VAR_5 * enc->channels);", "} else {", "int VAR_7 = enc->frame_size*VAR_5*enc->channels;", "if (allocated_audio_buf_size < VAR_7)\nexit_program(1);", "generate_silence(audio_buf+VAR_4, enc->sample_fmt, VAR_7 - VAR_4);", "}", "VAR_3 = avcodec_encode_audio(enc, bit_buffer, bit_buffer_size, (short *)audio_buf);", "pkt.duration = av_rescale((int64_t)enc->frame_size*ost->st->time_base.den,\nost->st->time_base.num, enc->sample_rate);", "enc->frame_size = VAR_6;", "}", "if (VAR_3 <= 0) {", "VAR_3 = avcodec_encode_audio(enc, bit_buffer, bit_buffer_size, NULL);", "}", "if (VAR_3 < 0) {", "av_log(NULL, AV_LOG_FATAL, \"Audio encoding failed\\n\");", "exit_program(1);", "}", "audio_size += VAR_3;", "pkt.flags |= AV_PKT_FLAG_KEY;", "break;", "case AVMEDIA_TYPE_VIDEO:\nVAR_3 = avcodec_encode_video(enc, bit_buffer, bit_buffer_size, NULL);", "if (VAR_3 < 0) {", "av_log(NULL, AV_LOG_FATAL, \"Video encoding failed\\n\");", "exit_program(1);", "}", "video_size += VAR_3;", "if(enc->coded_frame && enc->coded_frame->key_frame)\npkt.flags |= AV_PKT_FLAG_KEY;", "if (ost->logfile && enc->stats_out) {", "fprintf(ost->logfile, \"%s\", enc->stats_out);", "}", "break;", "default:\nVAR_3=-1;", "}", "if (VAR_3 <= 0)\nbreak;", "pkt.data = bit_buffer;", "pkt.size = VAR_3;", "if (enc->coded_frame && enc->coded_frame->pts != AV_NOPTS_VALUE)\npkt.pts= av_rescale_q(enc->coded_frame->pts, enc->time_base, ost->st->time_base);", "write_frame(os, &pkt, ost->st->codec, ost->bitstream_filters);", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19, 21 ], [ 25, 27 ], [ 29, 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49, 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75, 77 ], [ 79 ], [ 81 ], [ 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 ] ]
18,810
static int mkv_write_chapters(AVFormatContext *s) { MatroskaMuxContext *mkv = s->priv_data; AVIOContext *pb = s->pb; ebml_master chapters, editionentry; AVRational scale = {1, 1E9}; int i, ret; if (!s->nb_chapters || mkv->wrote_chapters) return 0; ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_CHAPTERS, avio_tell(pb)); if (ret < 0) return ret; chapters = start_ebml_master(pb, MATROSKA_ID_CHAPTERS , 0); editionentry = start_ebml_master(pb, MATROSKA_ID_EDITIONENTRY, 0); put_ebml_uint(pb, MATROSKA_ID_EDITIONFLAGDEFAULT, 1); put_ebml_uint(pb, MATROSKA_ID_EDITIONFLAGHIDDEN , 0); for (i = 0; i < s->nb_chapters; i++) { ebml_master chapteratom, chapterdisplay; AVChapter *c = s->chapters[i]; AVDictionaryEntry *t = NULL; chapteratom = start_ebml_master(pb, MATROSKA_ID_CHAPTERATOM, 0); put_ebml_uint(pb, MATROSKA_ID_CHAPTERUID, c->id); put_ebml_uint(pb, MATROSKA_ID_CHAPTERTIMESTART, av_rescale_q(c->start, c->time_base, scale)); put_ebml_uint(pb, MATROSKA_ID_CHAPTERTIMEEND, av_rescale_q(c->end, c->time_base, scale)); put_ebml_uint(pb, MATROSKA_ID_CHAPTERFLAGHIDDEN , 0); put_ebml_uint(pb, MATROSKA_ID_CHAPTERFLAGENABLED, 1); if ((t = av_dict_get(c->metadata, "title", NULL, 0))) { chapterdisplay = start_ebml_master(pb, MATROSKA_ID_CHAPTERDISPLAY, 0); put_ebml_string(pb, MATROSKA_ID_CHAPSTRING, t->value); put_ebml_string(pb, MATROSKA_ID_CHAPLANG , "und"); end_ebml_master(pb, chapterdisplay); } end_ebml_master(pb, chapteratom); } end_ebml_master(pb, editionentry); end_ebml_master(pb, chapters); mkv->wrote_chapters = 1; return 0; }
false
FFmpeg
5dc47a2bd52e375ed742c45d08356b45098f458d
static int mkv_write_chapters(AVFormatContext *s) { MatroskaMuxContext *mkv = s->priv_data; AVIOContext *pb = s->pb; ebml_master chapters, editionentry; AVRational scale = {1, 1E9}; int i, ret; if (!s->nb_chapters || mkv->wrote_chapters) return 0; ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_CHAPTERS, avio_tell(pb)); if (ret < 0) return ret; chapters = start_ebml_master(pb, MATROSKA_ID_CHAPTERS , 0); editionentry = start_ebml_master(pb, MATROSKA_ID_EDITIONENTRY, 0); put_ebml_uint(pb, MATROSKA_ID_EDITIONFLAGDEFAULT, 1); put_ebml_uint(pb, MATROSKA_ID_EDITIONFLAGHIDDEN , 0); for (i = 0; i < s->nb_chapters; i++) { ebml_master chapteratom, chapterdisplay; AVChapter *c = s->chapters[i]; AVDictionaryEntry *t = NULL; chapteratom = start_ebml_master(pb, MATROSKA_ID_CHAPTERATOM, 0); put_ebml_uint(pb, MATROSKA_ID_CHAPTERUID, c->id); put_ebml_uint(pb, MATROSKA_ID_CHAPTERTIMESTART, av_rescale_q(c->start, c->time_base, scale)); put_ebml_uint(pb, MATROSKA_ID_CHAPTERTIMEEND, av_rescale_q(c->end, c->time_base, scale)); put_ebml_uint(pb, MATROSKA_ID_CHAPTERFLAGHIDDEN , 0); put_ebml_uint(pb, MATROSKA_ID_CHAPTERFLAGENABLED, 1); if ((t = av_dict_get(c->metadata, "title", NULL, 0))) { chapterdisplay = start_ebml_master(pb, MATROSKA_ID_CHAPTERDISPLAY, 0); put_ebml_string(pb, MATROSKA_ID_CHAPSTRING, t->value); put_ebml_string(pb, MATROSKA_ID_CHAPLANG , "und"); end_ebml_master(pb, chapterdisplay); } end_ebml_master(pb, chapteratom); } end_ebml_master(pb, editionentry); end_ebml_master(pb, chapters); mkv->wrote_chapters = 1; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0) { MatroskaMuxContext *mkv = VAR_0->priv_data; AVIOContext *pb = VAR_0->pb; ebml_master chapters, editionentry; AVRational scale = {1, 1E9}; int VAR_1, VAR_2; if (!VAR_0->nb_chapters || mkv->wrote_chapters) return 0; VAR_2 = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_CHAPTERS, avio_tell(pb)); if (VAR_2 < 0) return VAR_2; chapters = start_ebml_master(pb, MATROSKA_ID_CHAPTERS , 0); editionentry = start_ebml_master(pb, MATROSKA_ID_EDITIONENTRY, 0); put_ebml_uint(pb, MATROSKA_ID_EDITIONFLAGDEFAULT, 1); put_ebml_uint(pb, MATROSKA_ID_EDITIONFLAGHIDDEN , 0); for (VAR_1 = 0; VAR_1 < VAR_0->nb_chapters; VAR_1++) { ebml_master chapteratom, chapterdisplay; AVChapter *c = VAR_0->chapters[VAR_1]; AVDictionaryEntry *t = NULL; chapteratom = start_ebml_master(pb, MATROSKA_ID_CHAPTERATOM, 0); put_ebml_uint(pb, MATROSKA_ID_CHAPTERUID, c->id); put_ebml_uint(pb, MATROSKA_ID_CHAPTERTIMESTART, av_rescale_q(c->start, c->time_base, scale)); put_ebml_uint(pb, MATROSKA_ID_CHAPTERTIMEEND, av_rescale_q(c->end, c->time_base, scale)); put_ebml_uint(pb, MATROSKA_ID_CHAPTERFLAGHIDDEN , 0); put_ebml_uint(pb, MATROSKA_ID_CHAPTERFLAGENABLED, 1); if ((t = av_dict_get(c->metadata, "title", NULL, 0))) { chapterdisplay = start_ebml_master(pb, MATROSKA_ID_CHAPTERDISPLAY, 0); put_ebml_string(pb, MATROSKA_ID_CHAPSTRING, t->value); put_ebml_string(pb, MATROSKA_ID_CHAPLANG , "und"); end_ebml_master(pb, chapterdisplay); } end_ebml_master(pb, chapteratom); } end_ebml_master(pb, editionentry); end_ebml_master(pb, chapters); mkv->wrote_chapters = 1; return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0)\n{", "MatroskaMuxContext *mkv = VAR_0->priv_data;", "AVIOContext *pb = VAR_0->pb;", "ebml_master chapters, editionentry;", "AVRational scale = {1, 1E9};", "int VAR_1, VAR_2;", "if (!VAR_0->nb_chapters || mkv->wrote_chapters)\nreturn 0;", "VAR_2 = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_CHAPTERS, avio_tell(pb));", "if (VAR_2 < 0) return VAR_2;", "chapters = start_ebml_master(pb, MATROSKA_ID_CHAPTERS , 0);", "editionentry = start_ebml_master(pb, MATROSKA_ID_EDITIONENTRY, 0);", "put_ebml_uint(pb, MATROSKA_ID_EDITIONFLAGDEFAULT, 1);", "put_ebml_uint(pb, MATROSKA_ID_EDITIONFLAGHIDDEN , 0);", "for (VAR_1 = 0; VAR_1 < VAR_0->nb_chapters; VAR_1++) {", "ebml_master chapteratom, chapterdisplay;", "AVChapter *c = VAR_0->chapters[VAR_1];", "AVDictionaryEntry *t = NULL;", "chapteratom = start_ebml_master(pb, MATROSKA_ID_CHAPTERATOM, 0);", "put_ebml_uint(pb, MATROSKA_ID_CHAPTERUID, c->id);", "put_ebml_uint(pb, MATROSKA_ID_CHAPTERTIMESTART,\nav_rescale_q(c->start, c->time_base, scale));", "put_ebml_uint(pb, MATROSKA_ID_CHAPTERTIMEEND,\nav_rescale_q(c->end, c->time_base, scale));", "put_ebml_uint(pb, MATROSKA_ID_CHAPTERFLAGHIDDEN , 0);", "put_ebml_uint(pb, MATROSKA_ID_CHAPTERFLAGENABLED, 1);", "if ((t = av_dict_get(c->metadata, \"title\", NULL, 0))) {", "chapterdisplay = start_ebml_master(pb, MATROSKA_ID_CHAPTERDISPLAY, 0);", "put_ebml_string(pb, MATROSKA_ID_CHAPSTRING, t->value);", "put_ebml_string(pb, MATROSKA_ID_CHAPLANG , \"und\");", "end_ebml_master(pb, chapterdisplay);", "}", "end_ebml_master(pb, chapteratom);", "}", "end_ebml_master(pb, editionentry);", "end_ebml_master(pb, chapters);", "mkv->wrote_chapters = 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17, 19 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51, 53 ], [ 55, 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 85 ], [ 87 ], [ 89 ] ]
18,811
static uint64_t ppc_hash64_page_shift(ppc_slb_t *slb) { uint64_t epnshift; /* Page size according to the SLB, which we use to generate the * EPN for hash table lookup.. When we implement more recent MMU * extensions this might be different from the actual page size * encoded in the PTE */ if ((slb->vsid & SLB_VSID_LLP_MASK) == SLB_VSID_4K) { epnshift = TARGET_PAGE_BITS; } else if ((slb->vsid & SLB_VSID_LLP_MASK) == SLB_VSID_64K) { epnshift = TARGET_PAGE_BITS_64K; } else { epnshift = TARGET_PAGE_BITS_16M; } return epnshift; }
true
qemu
cd6a9bb6e977864b1b7ec21b983fa0678b4b82e9
static uint64_t ppc_hash64_page_shift(ppc_slb_t *slb) { uint64_t epnshift; if ((slb->vsid & SLB_VSID_LLP_MASK) == SLB_VSID_4K) { epnshift = TARGET_PAGE_BITS; } else if ((slb->vsid & SLB_VSID_LLP_MASK) == SLB_VSID_64K) { epnshift = TARGET_PAGE_BITS_64K; } else { epnshift = TARGET_PAGE_BITS_16M; } return epnshift; }
{ "code": [ "static uint64_t ppc_hash64_page_shift(ppc_slb_t *slb)", " uint64_t epnshift;", " if ((slb->vsid & SLB_VSID_LLP_MASK) == SLB_VSID_4K) {", " epnshift = TARGET_PAGE_BITS;", " } else if ((slb->vsid & SLB_VSID_LLP_MASK) == SLB_VSID_64K) {", " epnshift = TARGET_PAGE_BITS_64K;", " } else {", " epnshift = TARGET_PAGE_BITS_16M;", " return epnshift;" ], "line_no": [ 1, 5, 17, 19, 21, 23, 25, 27, 31 ] }
static uint64_t FUNC_0(ppc_slb_t *slb) { uint64_t epnshift; if ((slb->vsid & SLB_VSID_LLP_MASK) == SLB_VSID_4K) { epnshift = TARGET_PAGE_BITS; } else if ((slb->vsid & SLB_VSID_LLP_MASK) == SLB_VSID_64K) { epnshift = TARGET_PAGE_BITS_64K; } else { epnshift = TARGET_PAGE_BITS_16M; } return epnshift; }
[ "static uint64_t FUNC_0(ppc_slb_t *slb)\n{", "uint64_t epnshift;", "if ((slb->vsid & SLB_VSID_LLP_MASK) == SLB_VSID_4K) {", "epnshift = TARGET_PAGE_BITS;", "} else if ((slb->vsid & SLB_VSID_LLP_MASK) == SLB_VSID_64K) {", "epnshift = TARGET_PAGE_BITS_64K;", "} else {", "epnshift = TARGET_PAGE_BITS_16M;", "}", "return epnshift;", "}" ]
[ 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ] ]
18,813
static av_always_inline void filter_mb_row(AVCodecContext *avctx, void *tdata, int jobnr, int threadnr, int is_vp7) { VP8Context *s = avctx->priv_data; VP8ThreadData *td = &s->thread_data[threadnr]; int mb_x, mb_y = td->thread_mb_pos >> 16, num_jobs = s->num_jobs; AVFrame *curframe = s->curframe->tf.f; VP8Macroblock *mb; VP8ThreadData *prev_td, *next_td; uint8_t *dst[3] = { curframe->data[0] + 16 * mb_y * s->linesize, curframe->data[1] + 8 * mb_y * s->uvlinesize, curframe->data[2] + 8 * mb_y * s->uvlinesize }; if (s->mb_layout == 1) mb = s->macroblocks_base + ((s->mb_width + 1) * (mb_y + 1) + 1); else mb = s->macroblocks + (s->mb_height - mb_y - 1) * 2; if (mb_y == 0) prev_td = td; else prev_td = &s->thread_data[(jobnr + num_jobs - 1) % num_jobs]; if (mb_y == s->mb_height - 1) next_td = td; else next_td = &s->thread_data[(jobnr + 1) % num_jobs]; for (mb_x = 0; mb_x < s->mb_width; mb_x++, mb++) { VP8FilterStrength *f = &td->filter_strength[mb_x]; if (prev_td != td) check_thread_pos(td, prev_td, (mb_x + 1) + (s->mb_width + 3), mb_y - 1); if (next_td != td) if (next_td != &s->thread_data[0]) check_thread_pos(td, next_td, mb_x + 1, mb_y + 1); if (num_jobs == 1) { if (s->filter.simple) backup_mb_border(s->top_border[mb_x + 1], dst[0], NULL, NULL, s->linesize, 0, 1); else backup_mb_border(s->top_border[mb_x + 1], dst[0], dst[1], dst[2], s->linesize, s->uvlinesize, 0); } if (s->filter.simple) filter_mb_simple(s, dst[0], f, mb_x, mb_y); else filter_mb(s, dst, f, mb_x, mb_y, is_vp7); dst[0] += 16; dst[1] += 8; dst[2] += 8; update_pos(td, mb_y, (s->mb_width + 3) + mb_x); } }
true
FFmpeg
9a54c6f243412f62bae498ddcac337cb18ae6290
static av_always_inline void filter_mb_row(AVCodecContext *avctx, void *tdata, int jobnr, int threadnr, int is_vp7) { VP8Context *s = avctx->priv_data; VP8ThreadData *td = &s->thread_data[threadnr]; int mb_x, mb_y = td->thread_mb_pos >> 16, num_jobs = s->num_jobs; AVFrame *curframe = s->curframe->tf.f; VP8Macroblock *mb; VP8ThreadData *prev_td, *next_td; uint8_t *dst[3] = { curframe->data[0] + 16 * mb_y * s->linesize, curframe->data[1] + 8 * mb_y * s->uvlinesize, curframe->data[2] + 8 * mb_y * s->uvlinesize }; if (s->mb_layout == 1) mb = s->macroblocks_base + ((s->mb_width + 1) * (mb_y + 1) + 1); else mb = s->macroblocks + (s->mb_height - mb_y - 1) * 2; if (mb_y == 0) prev_td = td; else prev_td = &s->thread_data[(jobnr + num_jobs - 1) % num_jobs]; if (mb_y == s->mb_height - 1) next_td = td; else next_td = &s->thread_data[(jobnr + 1) % num_jobs]; for (mb_x = 0; mb_x < s->mb_width; mb_x++, mb++) { VP8FilterStrength *f = &td->filter_strength[mb_x]; if (prev_td != td) check_thread_pos(td, prev_td, (mb_x + 1) + (s->mb_width + 3), mb_y - 1); if (next_td != td) if (next_td != &s->thread_data[0]) check_thread_pos(td, next_td, mb_x + 1, mb_y + 1); if (num_jobs == 1) { if (s->filter.simple) backup_mb_border(s->top_border[mb_x + 1], dst[0], NULL, NULL, s->linesize, 0, 1); else backup_mb_border(s->top_border[mb_x + 1], dst[0], dst[1], dst[2], s->linesize, s->uvlinesize, 0); } if (s->filter.simple) filter_mb_simple(s, dst[0], f, mb_x, mb_y); else filter_mb(s, dst, f, mb_x, mb_y, is_vp7); dst[0] += 16; dst[1] += 8; dst[2] += 8; update_pos(td, mb_y, (s->mb_width + 3) + mb_x); } }
{ "code": [ " int mb_x, mb_y = td->thread_mb_pos >> 16, num_jobs = s->num_jobs;" ], "line_no": [ 11 ] }
static av_always_inline void FUNC_0(AVCodecContext *avctx, void *tdata, int jobnr, int threadnr, int is_vp7) { VP8Context *s = avctx->priv_data; VP8ThreadData *td = &s->thread_data[threadnr]; int VAR_0, VAR_1 = td->thread_mb_pos >> 16, VAR_2 = s->VAR_2; AVFrame *curframe = s->curframe->tf.f; VP8Macroblock *mb; VP8ThreadData *prev_td, *next_td; uint8_t *dst[3] = { curframe->data[0] + 16 * VAR_1 * s->linesize, curframe->data[1] + 8 * VAR_1 * s->uvlinesize, curframe->data[2] + 8 * VAR_1 * s->uvlinesize }; if (s->mb_layout == 1) mb = s->macroblocks_base + ((s->mb_width + 1) * (VAR_1 + 1) + 1); else mb = s->macroblocks + (s->mb_height - VAR_1 - 1) * 2; if (VAR_1 == 0) prev_td = td; else prev_td = &s->thread_data[(jobnr + VAR_2 - 1) % VAR_2]; if (VAR_1 == s->mb_height - 1) next_td = td; else next_td = &s->thread_data[(jobnr + 1) % VAR_2]; for (VAR_0 = 0; VAR_0 < s->mb_width; VAR_0++, mb++) { VP8FilterStrength *f = &td->filter_strength[VAR_0]; if (prev_td != td) check_thread_pos(td, prev_td, (VAR_0 + 1) + (s->mb_width + 3), VAR_1 - 1); if (next_td != td) if (next_td != &s->thread_data[0]) check_thread_pos(td, next_td, VAR_0 + 1, VAR_1 + 1); if (VAR_2 == 1) { if (s->filter.simple) backup_mb_border(s->top_border[VAR_0 + 1], dst[0], NULL, NULL, s->linesize, 0, 1); else backup_mb_border(s->top_border[VAR_0 + 1], dst[0], dst[1], dst[2], s->linesize, s->uvlinesize, 0); } if (s->filter.simple) filter_mb_simple(s, dst[0], f, VAR_0, VAR_1); else filter_mb(s, dst, f, VAR_0, VAR_1, is_vp7); dst[0] += 16; dst[1] += 8; dst[2] += 8; update_pos(td, VAR_1, (s->mb_width + 3) + VAR_0); } }
[ "static av_always_inline void FUNC_0(AVCodecContext *avctx, void *tdata,\nint jobnr, int threadnr, int is_vp7)\n{", "VP8Context *s = avctx->priv_data;", "VP8ThreadData *td = &s->thread_data[threadnr];", "int VAR_0, VAR_1 = td->thread_mb_pos >> 16, VAR_2 = s->VAR_2;", "AVFrame *curframe = s->curframe->tf.f;", "VP8Macroblock *mb;", "VP8ThreadData *prev_td, *next_td;", "uint8_t *dst[3] = {", "curframe->data[0] + 16 * VAR_1 * s->linesize,\ncurframe->data[1] + 8 * VAR_1 * s->uvlinesize,\ncurframe->data[2] + 8 * VAR_1 * s->uvlinesize\n};", "if (s->mb_layout == 1)\nmb = s->macroblocks_base + ((s->mb_width + 1) * (VAR_1 + 1) + 1);", "else\nmb = s->macroblocks + (s->mb_height - VAR_1 - 1) * 2;", "if (VAR_1 == 0)\nprev_td = td;", "else\nprev_td = &s->thread_data[(jobnr + VAR_2 - 1) % VAR_2];", "if (VAR_1 == s->mb_height - 1)\nnext_td = td;", "else\nnext_td = &s->thread_data[(jobnr + 1) % VAR_2];", "for (VAR_0 = 0; VAR_0 < s->mb_width; VAR_0++, mb++) {", "VP8FilterStrength *f = &td->filter_strength[VAR_0];", "if (prev_td != td)\ncheck_thread_pos(td, prev_td,\n(VAR_0 + 1) + (s->mb_width + 3), VAR_1 - 1);", "if (next_td != td)\nif (next_td != &s->thread_data[0])\ncheck_thread_pos(td, next_td, VAR_0 + 1, VAR_1 + 1);", "if (VAR_2 == 1) {", "if (s->filter.simple)\nbackup_mb_border(s->top_border[VAR_0 + 1], dst[0],\nNULL, NULL, s->linesize, 0, 1);", "else\nbackup_mb_border(s->top_border[VAR_0 + 1], dst[0],\ndst[1], dst[2], s->linesize, s->uvlinesize, 0);", "}", "if (s->filter.simple)\nfilter_mb_simple(s, dst[0], f, VAR_0, VAR_1);", "else\nfilter_mb(s, dst, f, VAR_0, VAR_1, is_vp7);", "dst[0] += 16;", "dst[1] += 8;", "dst[2] += 8;", "update_pos(td, VAR_1, (s->mb_width + 3) + VAR_0);", "}", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21, 23, 25, 27 ], [ 31, 33 ], [ 35, 37 ], [ 41, 43 ], [ 45, 47 ], [ 49, 51 ], [ 53, 55 ], [ 59 ], [ 61 ], [ 63, 65, 67 ], [ 69, 71, 73 ], [ 77 ], [ 79, 81, 83 ], [ 85, 87, 89 ], [ 91 ], [ 95, 97 ], [ 99, 101 ], [ 103 ], [ 105 ], [ 107 ], [ 111 ], [ 113 ], [ 115 ] ]
18,815
static int decode_frame(FLACContext *s) { int i, ret; GetBitContext *gb = &s->gb; FLACFrameInfo fi; if ((ret = ff_flac_decode_frame_header(s->avctx, gb, &fi, 0)) < 0) { av_log(s->avctx, AV_LOG_ERROR, "invalid frame header\n"); return ret; } if (s->channels && fi.channels != s->channels && s->got_streaminfo) { s->channels = s->avctx->channels = fi.channels; ff_flac_set_channel_layout(s->avctx); ret = allocate_buffers(s); if (ret < 0) return ret; } s->channels = s->avctx->channels = fi.channels; if (!s->avctx->channel_layout) ff_flac_set_channel_layout(s->avctx); s->ch_mode = fi.ch_mode; if (!s->bps && !fi.bps) { av_log(s->avctx, AV_LOG_ERROR, "bps not found in STREAMINFO or frame header\n"); return AVERROR_INVALIDDATA; } if (!fi.bps) { fi.bps = s->bps; } else if (s->bps && fi.bps != s->bps) { av_log(s->avctx, AV_LOG_ERROR, "switching bps mid-stream is not " "supported\n"); return AVERROR_INVALIDDATA; } if (!s->bps) { s->bps = s->avctx->bits_per_raw_sample = fi.bps; flac_set_bps(s); } if (!s->max_blocksize) s->max_blocksize = FLAC_MAX_BLOCKSIZE; if (fi.blocksize > s->max_blocksize) { av_log(s->avctx, AV_LOG_ERROR, "blocksize %d > %d\n", fi.blocksize, s->max_blocksize); return AVERROR_INVALIDDATA; } s->blocksize = fi.blocksize; if (!s->samplerate && !fi.samplerate) { av_log(s->avctx, AV_LOG_ERROR, "sample rate not found in STREAMINFO" " or frame header\n"); return AVERROR_INVALIDDATA; } if (fi.samplerate == 0) fi.samplerate = s->samplerate; s->samplerate = s->avctx->sample_rate = fi.samplerate; if (!s->got_streaminfo) { ret = allocate_buffers(s); if (ret < 0) return ret; ff_flacdsp_init(&s->dsp, s->avctx->sample_fmt, s->channels, s->bps); s->got_streaminfo = 1; dump_headers(s->avctx, (FLACStreaminfo *)s); } // dump_headers(s->avctx, (FLACStreaminfo *)s); /* subframes */ for (i = 0; i < s->channels; i++) { if ((ret = decode_subframe(s, i)) < 0) return ret; } align_get_bits(gb); /* frame footer */ skip_bits(gb, 16); /* data crc */ return 0; }
false
FFmpeg
e5c01ccdf5a9a330d4c51a9b9ea721fd8f1fb70b
static int decode_frame(FLACContext *s) { int i, ret; GetBitContext *gb = &s->gb; FLACFrameInfo fi; if ((ret = ff_flac_decode_frame_header(s->avctx, gb, &fi, 0)) < 0) { av_log(s->avctx, AV_LOG_ERROR, "invalid frame header\n"); return ret; } if (s->channels && fi.channels != s->channels && s->got_streaminfo) { s->channels = s->avctx->channels = fi.channels; ff_flac_set_channel_layout(s->avctx); ret = allocate_buffers(s); if (ret < 0) return ret; } s->channels = s->avctx->channels = fi.channels; if (!s->avctx->channel_layout) ff_flac_set_channel_layout(s->avctx); s->ch_mode = fi.ch_mode; if (!s->bps && !fi.bps) { av_log(s->avctx, AV_LOG_ERROR, "bps not found in STREAMINFO or frame header\n"); return AVERROR_INVALIDDATA; } if (!fi.bps) { fi.bps = s->bps; } else if (s->bps && fi.bps != s->bps) { av_log(s->avctx, AV_LOG_ERROR, "switching bps mid-stream is not " "supported\n"); return AVERROR_INVALIDDATA; } if (!s->bps) { s->bps = s->avctx->bits_per_raw_sample = fi.bps; flac_set_bps(s); } if (!s->max_blocksize) s->max_blocksize = FLAC_MAX_BLOCKSIZE; if (fi.blocksize > s->max_blocksize) { av_log(s->avctx, AV_LOG_ERROR, "blocksize %d > %d\n", fi.blocksize, s->max_blocksize); return AVERROR_INVALIDDATA; } s->blocksize = fi.blocksize; if (!s->samplerate && !fi.samplerate) { av_log(s->avctx, AV_LOG_ERROR, "sample rate not found in STREAMINFO" " or frame header\n"); return AVERROR_INVALIDDATA; } if (fi.samplerate == 0) fi.samplerate = s->samplerate; s->samplerate = s->avctx->sample_rate = fi.samplerate; if (!s->got_streaminfo) { ret = allocate_buffers(s); if (ret < 0) return ret; ff_flacdsp_init(&s->dsp, s->avctx->sample_fmt, s->channels, s->bps); s->got_streaminfo = 1; dump_headers(s->avctx, (FLACStreaminfo *)s); } for (i = 0; i < s->channels; i++) { if ((ret = decode_subframe(s, i)) < 0) return ret; } align_get_bits(gb); skip_bits(gb, 16); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(FLACContext *VAR_0) { int VAR_1, VAR_2; GetBitContext *gb = &VAR_0->gb; FLACFrameInfo fi; if ((VAR_2 = ff_flac_decode_frame_header(VAR_0->avctx, gb, &fi, 0)) < 0) { av_log(VAR_0->avctx, AV_LOG_ERROR, "invalid frame header\n"); return VAR_2; } if (VAR_0->channels && fi.channels != VAR_0->channels && VAR_0->got_streaminfo) { VAR_0->channels = VAR_0->avctx->channels = fi.channels; ff_flac_set_channel_layout(VAR_0->avctx); VAR_2 = allocate_buffers(VAR_0); if (VAR_2 < 0) return VAR_2; } VAR_0->channels = VAR_0->avctx->channels = fi.channels; if (!VAR_0->avctx->channel_layout) ff_flac_set_channel_layout(VAR_0->avctx); VAR_0->ch_mode = fi.ch_mode; if (!VAR_0->bps && !fi.bps) { av_log(VAR_0->avctx, AV_LOG_ERROR, "bps not found in STREAMINFO or frame header\n"); return AVERROR_INVALIDDATA; } if (!fi.bps) { fi.bps = VAR_0->bps; } else if (VAR_0->bps && fi.bps != VAR_0->bps) { av_log(VAR_0->avctx, AV_LOG_ERROR, "switching bps mid-stream is not " "supported\n"); return AVERROR_INVALIDDATA; } if (!VAR_0->bps) { VAR_0->bps = VAR_0->avctx->bits_per_raw_sample = fi.bps; flac_set_bps(VAR_0); } if (!VAR_0->max_blocksize) VAR_0->max_blocksize = FLAC_MAX_BLOCKSIZE; if (fi.blocksize > VAR_0->max_blocksize) { av_log(VAR_0->avctx, AV_LOG_ERROR, "blocksize %d > %d\n", fi.blocksize, VAR_0->max_blocksize); return AVERROR_INVALIDDATA; } VAR_0->blocksize = fi.blocksize; if (!VAR_0->samplerate && !fi.samplerate) { av_log(VAR_0->avctx, AV_LOG_ERROR, "sample rate not found in STREAMINFO" " or frame header\n"); return AVERROR_INVALIDDATA; } if (fi.samplerate == 0) fi.samplerate = VAR_0->samplerate; VAR_0->samplerate = VAR_0->avctx->sample_rate = fi.samplerate; if (!VAR_0->got_streaminfo) { VAR_2 = allocate_buffers(VAR_0); if (VAR_2 < 0) return VAR_2; ff_flacdsp_init(&VAR_0->dsp, VAR_0->avctx->sample_fmt, VAR_0->channels, VAR_0->bps); VAR_0->got_streaminfo = 1; dump_headers(VAR_0->avctx, (FLACStreaminfo *)VAR_0); } for (VAR_1 = 0; VAR_1 < VAR_0->channels; VAR_1++) { if ((VAR_2 = decode_subframe(VAR_0, VAR_1)) < 0) return VAR_2; } align_get_bits(gb); skip_bits(gb, 16); return 0; }
[ "static int FUNC_0(FLACContext *VAR_0)\n{", "int VAR_1, VAR_2;", "GetBitContext *gb = &VAR_0->gb;", "FLACFrameInfo fi;", "if ((VAR_2 = ff_flac_decode_frame_header(VAR_0->avctx, gb, &fi, 0)) < 0) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"invalid frame header\\n\");", "return VAR_2;", "}", "if (VAR_0->channels && fi.channels != VAR_0->channels && VAR_0->got_streaminfo) {", "VAR_0->channels = VAR_0->avctx->channels = fi.channels;", "ff_flac_set_channel_layout(VAR_0->avctx);", "VAR_2 = allocate_buffers(VAR_0);", "if (VAR_2 < 0)\nreturn VAR_2;", "}", "VAR_0->channels = VAR_0->avctx->channels = fi.channels;", "if (!VAR_0->avctx->channel_layout)\nff_flac_set_channel_layout(VAR_0->avctx);", "VAR_0->ch_mode = fi.ch_mode;", "if (!VAR_0->bps && !fi.bps) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"bps not found in STREAMINFO or frame header\\n\");", "return AVERROR_INVALIDDATA;", "}", "if (!fi.bps) {", "fi.bps = VAR_0->bps;", "} else if (VAR_0->bps && fi.bps != VAR_0->bps) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"switching bps mid-stream is not \"\n\"supported\\n\");", "return AVERROR_INVALIDDATA;", "}", "if (!VAR_0->bps) {", "VAR_0->bps = VAR_0->avctx->bits_per_raw_sample = fi.bps;", "flac_set_bps(VAR_0);", "}", "if (!VAR_0->max_blocksize)\nVAR_0->max_blocksize = FLAC_MAX_BLOCKSIZE;", "if (fi.blocksize > VAR_0->max_blocksize) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"blocksize %d > %d\\n\", fi.blocksize,\nVAR_0->max_blocksize);", "return AVERROR_INVALIDDATA;", "}", "VAR_0->blocksize = fi.blocksize;", "if (!VAR_0->samplerate && !fi.samplerate) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"sample rate not found in STREAMINFO\"\n\" or frame header\\n\");", "return AVERROR_INVALIDDATA;", "}", "if (fi.samplerate == 0)\nfi.samplerate = VAR_0->samplerate;", "VAR_0->samplerate = VAR_0->avctx->sample_rate = fi.samplerate;", "if (!VAR_0->got_streaminfo) {", "VAR_2 = allocate_buffers(VAR_0);", "if (VAR_2 < 0)\nreturn VAR_2;", "ff_flacdsp_init(&VAR_0->dsp, VAR_0->avctx->sample_fmt, VAR_0->channels, VAR_0->bps);", "VAR_0->got_streaminfo = 1;", "dump_headers(VAR_0->avctx, (FLACStreaminfo *)VAR_0);", "}", "for (VAR_1 = 0; VAR_1 < VAR_0->channels; VAR_1++) {", "if ((VAR_2 = decode_subframe(VAR_0, VAR_1)) < 0)\nreturn VAR_2;", "}", "align_get_bits(gb);", "skip_bits(gb, 16);", "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 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61, 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81, 83 ], [ 85 ], [ 87, 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99 ], [ 101, 103 ], [ 105 ], [ 107 ], [ 109, 111 ], [ 113 ], [ 117 ], [ 119 ], [ 121, 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 141 ], [ 143, 145 ], [ 147 ], [ 151 ], [ 157 ], [ 161 ], [ 163 ] ]
18,816
static void invalid_array_comma(void) { QObject *obj = qobject_from_json("[32,}", NULL); g_assert(obj == NULL); }
true
qemu
aec4b054ea36c53c8b887da99f20010133b84378
static void invalid_array_comma(void) { QObject *obj = qobject_from_json("[32,}", NULL); g_assert(obj == NULL); }
{ "code": [ " QObject *obj = qobject_from_json(\"[32,}\", NULL);" ], "line_no": [ 5 ] }
static void FUNC_0(void) { QObject *obj = qobject_from_json("[32,}", NULL); g_assert(obj == NULL); }
[ "static void FUNC_0(void)\n{", "QObject *obj = qobject_from_json(\"[32,}\", NULL);", "g_assert(obj == NULL);", "}" ]
[ 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
18,817
static void vmxnet3_ack_events(VMXNET3State *s, uint32_t val) { uint32_t events; VMW_CBPRN("Clearing events: 0x%x", val); events = VMXNET3_READ_DRV_SHARED32(s->drv_shmem, ecr) & ~val; VMXNET3_WRITE_DRV_SHARED32(s->drv_shmem, ecr, events); }
true
qemu
c508277335e3b6b20cf18e6ea3a35c1fa835c64a
static void vmxnet3_ack_events(VMXNET3State *s, uint32_t val) { uint32_t events; VMW_CBPRN("Clearing events: 0x%x", val); events = VMXNET3_READ_DRV_SHARED32(s->drv_shmem, ecr) & ~val; VMXNET3_WRITE_DRV_SHARED32(s->drv_shmem, ecr, events); }
{ "code": [ " VMXNET3_WRITE_DRV_SHARED32(s->drv_shmem, ecr, events);", " events = VMXNET3_READ_DRV_SHARED32(s->drv_shmem, ecr) & ~val;", " VMXNET3_WRITE_DRV_SHARED32(s->drv_shmem, ecr, events);" ], "line_no": [ 13, 11, 13 ] }
static void FUNC_0(VMXNET3State *VAR_0, uint32_t VAR_1) { uint32_t events; VMW_CBPRN("Clearing events: 0x%x", VAR_1); events = VMXNET3_READ_DRV_SHARED32(VAR_0->drv_shmem, ecr) & ~VAR_1; VMXNET3_WRITE_DRV_SHARED32(VAR_0->drv_shmem, ecr, events); }
[ "static void FUNC_0(VMXNET3State *VAR_0, uint32_t VAR_1)\n{", "uint32_t events;", "VMW_CBPRN(\"Clearing events: 0x%x\", VAR_1);", "events = VMXNET3_READ_DRV_SHARED32(VAR_0->drv_shmem, ecr) & ~VAR_1;", "VMXNET3_WRITE_DRV_SHARED32(VAR_0->drv_shmem, ecr, events);", "}" ]
[ 0, 0, 0, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ] ]
18,818
static void grlib_gptimer_enable(GPTimer *timer) { assert(timer != NULL); ptimer_stop(timer->ptimer); if (!(timer->config & GPTIMER_ENABLE)) { /* Timer disabled */ trace_grlib_gptimer_disabled(timer->id, timer->config); return; } /* ptimer is triggered when the counter reach 0 but GPTimer is triggered at underflow. Set count + 1 to simulate the GPTimer behavior. */ trace_grlib_gptimer_enable(timer->id, timer->counter + 1); ptimer_set_count(timer->ptimer, timer->counter + 1); ptimer_run(timer->ptimer, 1); }
true
qemu
9d5614d582d23ec96b167583557bf3f25f64f050
static void grlib_gptimer_enable(GPTimer *timer) { assert(timer != NULL); ptimer_stop(timer->ptimer); if (!(timer->config & GPTIMER_ENABLE)) { trace_grlib_gptimer_disabled(timer->id, timer->config); return; } trace_grlib_gptimer_enable(timer->id, timer->counter + 1); ptimer_set_count(timer->ptimer, timer->counter + 1); ptimer_run(timer->ptimer, 1); }
{ "code": [ " trace_grlib_gptimer_enable(timer->id, timer->counter + 1);", " ptimer_set_count(timer->ptimer, timer->counter + 1);" ], "line_no": [ 33, 37 ] }
static void FUNC_0(GPTimer *VAR_0) { assert(VAR_0 != NULL); ptimer_stop(VAR_0->ptimer); if (!(VAR_0->config & GPTIMER_ENABLE)) { trace_grlib_gptimer_disabled(VAR_0->id, VAR_0->config); return; } trace_grlib_gptimer_enable(VAR_0->id, VAR_0->counter + 1); ptimer_set_count(VAR_0->ptimer, VAR_0->counter + 1); ptimer_run(VAR_0->ptimer, 1); }
[ "static void FUNC_0(GPTimer *VAR_0)\n{", "assert(VAR_0 != NULL);", "ptimer_stop(VAR_0->ptimer);", "if (!(VAR_0->config & GPTIMER_ENABLE)) {", "trace_grlib_gptimer_disabled(VAR_0->id, VAR_0->config);", "return;", "}", "trace_grlib_gptimer_enable(VAR_0->id, VAR_0->counter + 1);", "ptimer_set_count(VAR_0->ptimer, VAR_0->counter + 1);", "ptimer_run(VAR_0->ptimer, 1);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 11 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ] ]
18,821
static int mov_read_mac_string(MOVContext *c, AVIOContext *pb, int len, char *dst, int dstlen) { char *p = dst; char *end = dst+dstlen-1; int i; for (i = 0; i < len; i++) { uint8_t t, c = avio_r8(pb); if (c < 0x80 && p < end) *p++ = c; else PUT_UTF8(mac_to_unicode[c-0x80], t, if (p < end) *p++ = t;); } *p = 0; return p - dst; }
true
FFmpeg
46191a2da16f751e53d93646ae1388d421d12bee
static int mov_read_mac_string(MOVContext *c, AVIOContext *pb, int len, char *dst, int dstlen) { char *p = dst; char *end = dst+dstlen-1; int i; for (i = 0; i < len; i++) { uint8_t t, c = avio_r8(pb); if (c < 0x80 && p < end) *p++ = c; else PUT_UTF8(mac_to_unicode[c-0x80], t, if (p < end) *p++ = t;); } *p = 0; return p - dst; }
{ "code": [ " if (c < 0x80 && p < end)" ], "line_no": [ 19 ] }
static int FUNC_0(MOVContext *VAR_0, AVIOContext *VAR_1, int VAR_2, char *VAR_3, int VAR_4) { char *VAR_5 = VAR_3; char *VAR_6 = VAR_3+VAR_4-1; int VAR_7; for (VAR_7 = 0; VAR_7 < VAR_2; VAR_7++) { uint8_t t, VAR_0 = avio_r8(VAR_1); if (VAR_0 < 0x80 && VAR_5 < VAR_6) *VAR_5++ = VAR_0; else PUT_UTF8(mac_to_unicode[VAR_0-0x80], t, if (VAR_5 < VAR_6) *VAR_5++ = t;); } *VAR_5 = 0; return VAR_5 - VAR_3; }
[ "static int FUNC_0(MOVContext *VAR_0, AVIOContext *VAR_1, int VAR_2,\nchar *VAR_3, int VAR_4)\n{", "char *VAR_5 = VAR_3;", "char *VAR_6 = VAR_3+VAR_4-1;", "int VAR_7;", "for (VAR_7 = 0; VAR_7 < VAR_2; VAR_7++) {", "uint8_t t, VAR_0 = avio_r8(VAR_1);", "if (VAR_0 < 0x80 && VAR_5 < VAR_6)\n*VAR_5++ = VAR_0;", "else\nPUT_UTF8(mac_to_unicode[VAR_0-0x80], t, if (VAR_5 < VAR_6) *VAR_5++ = t;);", "}", "*VAR_5 = 0;", "return VAR_5 - VAR_3;", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19, 21 ], [ 23, 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ] ]
18,822
altivec_yuv2packedX (SwsContext *c, int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize, int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize, uint8_t *dest, int dstW, int dstY) { int i,j; vector signed short X,X0,X1,Y0,U0,V0,Y1,U1,V1,U,V; vector signed short R0,G0,B0,R1,G1,B1; vector unsigned char R,G,B; vector unsigned char *out,*nout; vector signed short RND = vec_splat_s16(1<<3); vector unsigned short SCL = vec_splat_u16(4); unsigned long scratch[16] __attribute__ ((aligned (16))); vector signed short *YCoeffs, *CCoeffs; YCoeffs = c->vYCoeffsBank+dstY*lumFilterSize; CCoeffs = c->vCCoeffsBank+dstY*chrFilterSize; out = (vector unsigned char *)dest; for(i=0; i<dstW; i+=16){ Y0 = RND; Y1 = RND; /* extract 16 coeffs from lumSrc */ for(j=0; j<lumFilterSize; j++) { X0 = vec_ld (0, &lumSrc[j][i]); X1 = vec_ld (16, &lumSrc[j][i]); Y0 = vec_mradds (X0, YCoeffs[j], Y0); Y1 = vec_mradds (X1, YCoeffs[j], Y1); } U = RND; V = RND; /* extract 8 coeffs from U,V */ for(j=0; j<chrFilterSize; j++) { X = vec_ld (0, &chrSrc[j][i/2]); U = vec_mradds (X, CCoeffs[j], U); X = vec_ld (0, &chrSrc[j][i/2+2048]); V = vec_mradds (X, CCoeffs[j], V); } /* scale and clip signals */ Y0 = vec_sra (Y0, SCL); Y1 = vec_sra (Y1, SCL); U = vec_sra (U, SCL); V = vec_sra (V, SCL); Y0 = vec_clip_s16 (Y0); Y1 = vec_clip_s16 (Y1); U = vec_clip_s16 (U); V = vec_clip_s16 (V); /* now we have Y0= y0 y1 y2 y3 y4 y5 y6 y7 Y1= y8 y9 y10 y11 y12 y13 y14 y15 U= u0 u1 u2 u3 u4 u5 u6 u7 V= v0 v1 v2 v3 v4 v5 v6 v7 Y0= y0 y1 y2 y3 y4 y5 y6 y7 Y1= y8 y9 y10 y11 y12 y13 y14 y15 U0= u0 u0 u1 u1 u2 u2 u3 u3 U1= u4 u4 u5 u5 u6 u6 u7 u7 V0= v0 v0 v1 v1 v2 v2 v3 v3 V1= v4 v4 v5 v5 v6 v6 v7 v7 */ U0 = vec_mergeh (U,U); V0 = vec_mergeh (V,V); U1 = vec_mergel (U,U); V1 = vec_mergel (V,V); cvtyuvtoRGB (c, Y0,U0,V0,&R0,&G0,&B0); cvtyuvtoRGB (c, Y1,U1,V1,&R1,&G1,&B1); R = vec_packclp (R0,R1); G = vec_packclp (G0,G1); B = vec_packclp (B0,B1); switch(c->dstFormat) { case PIX_FMT_ABGR: out_abgr (R,G,B,out); break; case PIX_FMT_BGRA: out_bgra (R,G,B,out); break; case PIX_FMT_RGBA: out_rgba (R,G,B,out); break; case PIX_FMT_ARGB: out_argb (R,G,B,out); break; case PIX_FMT_RGB24: out_rgb24 (R,G,B,out); break; case PIX_FMT_BGR24: out_bgr24 (R,G,B,out); break; default: { /* If this is reached, the caller should have called yuv2packedXinC instead. */ static int printed_error_message; if(!printed_error_message) { av_log(c, AV_LOG_ERROR, "altivec_yuv2packedX doesn't support %s output\n", sws_format_name(c->dstFormat)); printed_error_message=1; } return; } } } if (i < dstW) { i -= 16; Y0 = RND; Y1 = RND; /* extract 16 coeffs from lumSrc */ for(j=0; j<lumFilterSize; j++) { X0 = vec_ld (0, &lumSrc[j][i]); X1 = vec_ld (16, &lumSrc[j][i]); Y0 = vec_mradds (X0, YCoeffs[j], Y0); Y1 = vec_mradds (X1, YCoeffs[j], Y1); } U = RND; V = RND; /* extract 8 coeffs from U,V */ for(j=0; j<chrFilterSize; j++) { X = vec_ld (0, &chrSrc[j][i/2]); U = vec_mradds (X, CCoeffs[j], U); X = vec_ld (0, &chrSrc[j][i/2+2048]); V = vec_mradds (X, CCoeffs[j], V); } /* scale and clip signals */ Y0 = vec_sra (Y0, SCL); Y1 = vec_sra (Y1, SCL); U = vec_sra (U, SCL); V = vec_sra (V, SCL); Y0 = vec_clip_s16 (Y0); Y1 = vec_clip_s16 (Y1); U = vec_clip_s16 (U); V = vec_clip_s16 (V); /* now we have Y0= y0 y1 y2 y3 y4 y5 y6 y7 Y1= y8 y9 y10 y11 y12 y13 y14 y15 U= u0 u1 u2 u3 u4 u5 u6 u7 V= v0 v1 v2 v3 v4 v5 v6 v7 Y0= y0 y1 y2 y3 y4 y5 y6 y7 Y1= y8 y9 y10 y11 y12 y13 y14 y15 U0= u0 u0 u1 u1 u2 u2 u3 u3 U1= u4 u4 u5 u5 u6 u6 u7 u7 V0= v0 v0 v1 v1 v2 v2 v3 v3 V1= v4 v4 v5 v5 v6 v6 v7 v7 */ U0 = vec_mergeh (U,U); V0 = vec_mergeh (V,V); U1 = vec_mergel (U,U); V1 = vec_mergel (V,V); cvtyuvtoRGB (c, Y0,U0,V0,&R0,&G0,&B0); cvtyuvtoRGB (c, Y1,U1,V1,&R1,&G1,&B1); R = vec_packclp (R0,R1); G = vec_packclp (G0,G1); B = vec_packclp (B0,B1); nout = (vector unsigned char *)scratch; switch(c->dstFormat) { case PIX_FMT_ABGR: out_abgr (R,G,B,nout); break; case PIX_FMT_BGRA: out_bgra (R,G,B,nout); break; case PIX_FMT_RGBA: out_rgba (R,G,B,nout); break; case PIX_FMT_ARGB: out_argb (R,G,B,nout); break; case PIX_FMT_RGB24: out_rgb24 (R,G,B,nout); break; case PIX_FMT_BGR24: out_bgr24 (R,G,B,nout); break; default: /* Unreachable, I think. */ av_log(c, AV_LOG_ERROR, "altivec_yuv2packedX doesn't support %s output\n", sws_format_name(c->dstFormat)); return; } memcpy (&((uint32_t*)dest)[i], scratch, (dstW-i)/4); } }
true
FFmpeg
428098165de4c3edfe42c1b7f00627d287015863
altivec_yuv2packedX (SwsContext *c, int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize, int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize, uint8_t *dest, int dstW, int dstY) { int i,j; vector signed short X,X0,X1,Y0,U0,V0,Y1,U1,V1,U,V; vector signed short R0,G0,B0,R1,G1,B1; vector unsigned char R,G,B; vector unsigned char *out,*nout; vector signed short RND = vec_splat_s16(1<<3); vector unsigned short SCL = vec_splat_u16(4); unsigned long scratch[16] __attribute__ ((aligned (16))); vector signed short *YCoeffs, *CCoeffs; YCoeffs = c->vYCoeffsBank+dstY*lumFilterSize; CCoeffs = c->vCCoeffsBank+dstY*chrFilterSize; out = (vector unsigned char *)dest; for(i=0; i<dstW; i+=16){ Y0 = RND; Y1 = RND; for(j=0; j<lumFilterSize; j++) { X0 = vec_ld (0, &lumSrc[j][i]); X1 = vec_ld (16, &lumSrc[j][i]); Y0 = vec_mradds (X0, YCoeffs[j], Y0); Y1 = vec_mradds (X1, YCoeffs[j], Y1); } U = RND; V = RND; for(j=0; j<chrFilterSize; j++) { X = vec_ld (0, &chrSrc[j][i/2]); U = vec_mradds (X, CCoeffs[j], U); X = vec_ld (0, &chrSrc[j][i/2+2048]); V = vec_mradds (X, CCoeffs[j], V); } Y0 = vec_sra (Y0, SCL); Y1 = vec_sra (Y1, SCL); U = vec_sra (U, SCL); V = vec_sra (V, SCL); Y0 = vec_clip_s16 (Y0); Y1 = vec_clip_s16 (Y1); U = vec_clip_s16 (U); V = vec_clip_s16 (V); U0 = vec_mergeh (U,U); V0 = vec_mergeh (V,V); U1 = vec_mergel (U,U); V1 = vec_mergel (V,V); cvtyuvtoRGB (c, Y0,U0,V0,&R0,&G0,&B0); cvtyuvtoRGB (c, Y1,U1,V1,&R1,&G1,&B1); R = vec_packclp (R0,R1); G = vec_packclp (G0,G1); B = vec_packclp (B0,B1); switch(c->dstFormat) { case PIX_FMT_ABGR: out_abgr (R,G,B,out); break; case PIX_FMT_BGRA: out_bgra (R,G,B,out); break; case PIX_FMT_RGBA: out_rgba (R,G,B,out); break; case PIX_FMT_ARGB: out_argb (R,G,B,out); break; case PIX_FMT_RGB24: out_rgb24 (R,G,B,out); break; case PIX_FMT_BGR24: out_bgr24 (R,G,B,out); break; default: { static int printed_error_message; if(!printed_error_message) { av_log(c, AV_LOG_ERROR, "altivec_yuv2packedX doesn't support %s output\n", sws_format_name(c->dstFormat)); printed_error_message=1; } return; } } } if (i < dstW) { i -= 16; Y0 = RND; Y1 = RND; for(j=0; j<lumFilterSize; j++) { X0 = vec_ld (0, &lumSrc[j][i]); X1 = vec_ld (16, &lumSrc[j][i]); Y0 = vec_mradds (X0, YCoeffs[j], Y0); Y1 = vec_mradds (X1, YCoeffs[j], Y1); } U = RND; V = RND; for(j=0; j<chrFilterSize; j++) { X = vec_ld (0, &chrSrc[j][i/2]); U = vec_mradds (X, CCoeffs[j], U); X = vec_ld (0, &chrSrc[j][i/2+2048]); V = vec_mradds (X, CCoeffs[j], V); } Y0 = vec_sra (Y0, SCL); Y1 = vec_sra (Y1, SCL); U = vec_sra (U, SCL); V = vec_sra (V, SCL); Y0 = vec_clip_s16 (Y0); Y1 = vec_clip_s16 (Y1); U = vec_clip_s16 (U); V = vec_clip_s16 (V); U0 = vec_mergeh (U,U); V0 = vec_mergeh (V,V); U1 = vec_mergel (U,U); V1 = vec_mergel (V,V); cvtyuvtoRGB (c, Y0,U0,V0,&R0,&G0,&B0); cvtyuvtoRGB (c, Y1,U1,V1,&R1,&G1,&B1); R = vec_packclp (R0,R1); G = vec_packclp (G0,G1); B = vec_packclp (B0,B1); nout = (vector unsigned char *)scratch; switch(c->dstFormat) { case PIX_FMT_ABGR: out_abgr (R,G,B,nout); break; case PIX_FMT_BGRA: out_bgra (R,G,B,nout); break; case PIX_FMT_RGBA: out_rgba (R,G,B,nout); break; case PIX_FMT_ARGB: out_argb (R,G,B,nout); break; case PIX_FMT_RGB24: out_rgb24 (R,G,B,nout); break; case PIX_FMT_BGR24: out_bgr24 (R,G,B,nout); break; default: av_log(c, AV_LOG_ERROR, "altivec_yuv2packedX doesn't support %s output\n", sws_format_name(c->dstFormat)); return; } memcpy (&((uint32_t*)dest)[i], scratch, (dstW-i)/4); } }
{ "code": [ " int i,j;", " vector unsigned char R,G,B;", " int i,j;", "\t\t int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize,", "\t\t int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize,", "\t\t uint8_t *dest, int dstW, int dstY)", " int i,j;", " vector signed short X,X0,X1,Y0,U0,V0,Y1,U1,V1,U,V;", " vector signed short R0,G0,B0,R1,G1,B1;", " vector unsigned char R,G,B;", " vector unsigned char *out,*nout;", " vector signed short RND = vec_splat_s16(1<<3);", " vector unsigned short SCL = vec_splat_u16(4);", " unsigned long scratch[16] __attribute__ ((aligned (16)));", " vector signed short *YCoeffs, *CCoeffs;", " YCoeffs = c->vYCoeffsBank+dstY*lumFilterSize;", " CCoeffs = c->vCCoeffsBank+dstY*chrFilterSize;", " out = (vector unsigned char *)dest;", " for(i=0; i<dstW; i+=16){", " Y0 = RND;", " Y1 = RND;", " for(j=0; j<lumFilterSize; j++) {", " X0 = vec_ld (0, &lumSrc[j][i]);", " X1 = vec_ld (16, &lumSrc[j][i]);", " Y0 = vec_mradds (X0, YCoeffs[j], Y0);", " Y1 = vec_mradds (X1, YCoeffs[j], Y1);", " U = RND;", " V = RND;", " for(j=0; j<chrFilterSize; j++) {", " X = vec_ld (0, &chrSrc[j][i/2]);", " U = vec_mradds (X, CCoeffs[j], U);", " X = vec_ld (0, &chrSrc[j][i/2+2048]);", " V = vec_mradds (X, CCoeffs[j], V);", " Y0 = vec_sra (Y0, SCL);", " Y1 = vec_sra (Y1, SCL);", " U = vec_sra (U, SCL);", " V = vec_sra (V, SCL);", " Y0 = vec_clip_s16 (Y0);", " Y1 = vec_clip_s16 (Y1);", " U = vec_clip_s16 (U);", " V = vec_clip_s16 (V);", " U0 = vec_mergeh (U,U);", " V0 = vec_mergeh (V,V);", " U1 = vec_mergel (U,U);", " V1 = vec_mergel (V,V);", " cvtyuvtoRGB (c, Y0,U0,V0,&R0,&G0,&B0);", " cvtyuvtoRGB (c, Y1,U1,V1,&R1,&G1,&B1);", " R = vec_packclp (R0,R1);", " G = vec_packclp (G0,G1);", " B = vec_packclp (B0,B1);", " switch(c->dstFormat) {", " case PIX_FMT_ABGR: out_abgr (R,G,B,out); break;", " case PIX_FMT_BGRA: out_bgra (R,G,B,out); break;", " case PIX_FMT_RGBA: out_rgba (R,G,B,out); break;", " case PIX_FMT_ARGB: out_argb (R,G,B,out); break;", " case PIX_FMT_RGB24: out_rgb24 (R,G,B,out); break;", " case PIX_FMT_BGR24: out_bgr24 (R,G,B,out); break;", " default:", " static int printed_error_message;", " if(!printed_error_message) {", " av_log(c, AV_LOG_ERROR, \"altivec_yuv2packedX doesn't support %s output\\n\",", " sws_format_name(c->dstFormat));", " printed_error_message=1;", " if (i < dstW) {", " i -= 16;", " Y0 = RND;", " Y1 = RND;", " for(j=0; j<lumFilterSize; j++) {", " X0 = vec_ld (0, &lumSrc[j][i]);", " X1 = vec_ld (16, &lumSrc[j][i]);", " Y0 = vec_mradds (X0, YCoeffs[j], Y0);", " Y1 = vec_mradds (X1, YCoeffs[j], Y1);", " U = RND;", " V = RND;", " for(j=0; j<chrFilterSize; j++) {", " X = vec_ld (0, &chrSrc[j][i/2]);", " U = vec_mradds (X, CCoeffs[j], U);", " X = vec_ld (0, &chrSrc[j][i/2+2048]);", " V = vec_mradds (X, CCoeffs[j], V);", " Y0 = vec_sra (Y0, SCL);", " Y1 = vec_sra (Y1, SCL);", " U = vec_sra (U, SCL);", " V = vec_sra (V, SCL);", " Y0 = vec_clip_s16 (Y0);", " Y1 = vec_clip_s16 (Y1);", " U = vec_clip_s16 (U);", " V = vec_clip_s16 (V);", " U0 = vec_mergeh (U,U);", " V0 = vec_mergeh (V,V);", " U1 = vec_mergel (U,U);", " V1 = vec_mergel (V,V);", " cvtyuvtoRGB (c, Y0,U0,V0,&R0,&G0,&B0);", " cvtyuvtoRGB (c, Y1,U1,V1,&R1,&G1,&B1);", " R = vec_packclp (R0,R1);", " G = vec_packclp (G0,G1);", " B = vec_packclp (B0,B1);", " nout = (vector unsigned char *)scratch;", " switch(c->dstFormat) {", " case PIX_FMT_ABGR: out_abgr (R,G,B,nout); break;", " case PIX_FMT_BGRA: out_bgra (R,G,B,nout); break;", " case PIX_FMT_RGBA: out_rgba (R,G,B,nout); break;", " case PIX_FMT_ARGB: out_argb (R,G,B,nout); break;", " case PIX_FMT_RGB24: out_rgb24 (R,G,B,nout); break;", " case PIX_FMT_BGR24: out_bgr24 (R,G,B,nout); break;", " default:", " av_log(c, AV_LOG_ERROR, \"altivec_yuv2packedX doesn't support %s output\\n\",", " sws_format_name(c->dstFormat));", " memcpy (&((uint32_t*)dest)[i], scratch, (dstW-i)/4);" ], "line_no": [ 11, 19, 11, 3, 5, 7, 11, 13, 15, 19, 21, 25, 27, 29, 33, 37, 39, 43, 47, 49, 51, 55, 57, 59, 61, 63, 69, 71, 75, 77, 79, 81, 83, 91, 93, 95, 97, 101, 103, 105, 107, 129, 131, 135, 137, 141, 143, 147, 149, 151, 155, 157, 159, 161, 163, 165, 167, 169, 177, 179, 181, 183, 185, 199, 201, 49, 51, 55, 57, 59, 61, 63, 69, 71, 75, 77, 79, 81, 83, 91, 93, 95, 97, 101, 103, 105, 107, 129, 131, 135, 137, 141, 143, 147, 149, 151, 311, 155, 315, 317, 319, 321, 323, 325, 169, 331, 333, 341 ] }
FUNC_0 (SwsContext *VAR_0, int16_t *VAR_1, int16_t **VAR_2, int VAR_3, int16_t *VAR_4, int16_t **VAR_5, int VAR_6, uint8_t *VAR_7, int VAR_8, int VAR_9) { int VAR_10,VAR_11; vector signed short X,X0,X1,Y0,U0,V0,Y1,U1,V1,U,V; vector signed short R0,G0,B0,R1,G1,B1; vector unsigned char R,G,B; vector unsigned char *out,*nout; vector signed short RND = vec_splat_s16(1<<3); vector unsigned short SCL = vec_splat_u16(4); unsigned long VAR_12[16] __attribute__ ((aligned (16))); vector signed short *YCoeffs, *CCoeffs; YCoeffs = VAR_0->vYCoeffsBank+VAR_9*VAR_3; CCoeffs = VAR_0->vCCoeffsBank+VAR_9*VAR_6; out = (vector unsigned char *)VAR_7; for(VAR_10=0; VAR_10<VAR_8; VAR_10+=16){ Y0 = RND; Y1 = RND; for(VAR_11=0; VAR_11<VAR_3; VAR_11++) { X0 = vec_ld (0, &VAR_2[VAR_11][VAR_10]); X1 = vec_ld (16, &VAR_2[VAR_11][VAR_10]); Y0 = vec_mradds (X0, YCoeffs[VAR_11], Y0); Y1 = vec_mradds (X1, YCoeffs[VAR_11], Y1); } U = RND; V = RND; for(VAR_11=0; VAR_11<VAR_6; VAR_11++) { X = vec_ld (0, &VAR_5[VAR_11][VAR_10/2]); U = vec_mradds (X, CCoeffs[VAR_11], U); X = vec_ld (0, &VAR_5[VAR_11][VAR_10/2+2048]); V = vec_mradds (X, CCoeffs[VAR_11], V); } Y0 = vec_sra (Y0, SCL); Y1 = vec_sra (Y1, SCL); U = vec_sra (U, SCL); V = vec_sra (V, SCL); Y0 = vec_clip_s16 (Y0); Y1 = vec_clip_s16 (Y1); U = vec_clip_s16 (U); V = vec_clip_s16 (V); U0 = vec_mergeh (U,U); V0 = vec_mergeh (V,V); U1 = vec_mergel (U,U); V1 = vec_mergel (V,V); cvtyuvtoRGB (VAR_0, Y0,U0,V0,&R0,&G0,&B0); cvtyuvtoRGB (VAR_0, Y1,U1,V1,&R1,&G1,&B1); R = vec_packclp (R0,R1); G = vec_packclp (G0,G1); B = vec_packclp (B0,B1); switch(VAR_0->dstFormat) { case PIX_FMT_ABGR: out_abgr (R,G,B,out); break; case PIX_FMT_BGRA: out_bgra (R,G,B,out); break; case PIX_FMT_RGBA: out_rgba (R,G,B,out); break; case PIX_FMT_ARGB: out_argb (R,G,B,out); break; case PIX_FMT_RGB24: out_rgb24 (R,G,B,out); break; case PIX_FMT_BGR24: out_bgr24 (R,G,B,out); break; default: { static int VAR_13; if(!VAR_13) { av_log(VAR_0, AV_LOG_ERROR, "FUNC_0 doesn't support %s output\n", sws_format_name(VAR_0->dstFormat)); VAR_13=1; } return; } } } if (VAR_10 < VAR_8) { VAR_10 -= 16; Y0 = RND; Y1 = RND; for(VAR_11=0; VAR_11<VAR_3; VAR_11++) { X0 = vec_ld (0, &VAR_2[VAR_11][VAR_10]); X1 = vec_ld (16, &VAR_2[VAR_11][VAR_10]); Y0 = vec_mradds (X0, YCoeffs[VAR_11], Y0); Y1 = vec_mradds (X1, YCoeffs[VAR_11], Y1); } U = RND; V = RND; for(VAR_11=0; VAR_11<VAR_6; VAR_11++) { X = vec_ld (0, &VAR_5[VAR_11][VAR_10/2]); U = vec_mradds (X, CCoeffs[VAR_11], U); X = vec_ld (0, &VAR_5[VAR_11][VAR_10/2+2048]); V = vec_mradds (X, CCoeffs[VAR_11], V); } Y0 = vec_sra (Y0, SCL); Y1 = vec_sra (Y1, SCL); U = vec_sra (U, SCL); V = vec_sra (V, SCL); Y0 = vec_clip_s16 (Y0); Y1 = vec_clip_s16 (Y1); U = vec_clip_s16 (U); V = vec_clip_s16 (V); U0 = vec_mergeh (U,U); V0 = vec_mergeh (V,V); U1 = vec_mergel (U,U); V1 = vec_mergel (V,V); cvtyuvtoRGB (VAR_0, Y0,U0,V0,&R0,&G0,&B0); cvtyuvtoRGB (VAR_0, Y1,U1,V1,&R1,&G1,&B1); R = vec_packclp (R0,R1); G = vec_packclp (G0,G1); B = vec_packclp (B0,B1); nout = (vector unsigned char *)VAR_12; switch(VAR_0->dstFormat) { case PIX_FMT_ABGR: out_abgr (R,G,B,nout); break; case PIX_FMT_BGRA: out_bgra (R,G,B,nout); break; case PIX_FMT_RGBA: out_rgba (R,G,B,nout); break; case PIX_FMT_ARGB: out_argb (R,G,B,nout); break; case PIX_FMT_RGB24: out_rgb24 (R,G,B,nout); break; case PIX_FMT_BGR24: out_bgr24 (R,G,B,nout); break; default: av_log(VAR_0, AV_LOG_ERROR, "FUNC_0 doesn't support %s output\n", sws_format_name(VAR_0->dstFormat)); return; } memcpy (&((uint32_t*)VAR_7)[VAR_10], VAR_12, (VAR_8-VAR_10)/4); } }
[ "FUNC_0 (SwsContext *VAR_0,\nint16_t *VAR_1, int16_t **VAR_2, int VAR_3,\nint16_t *VAR_4, int16_t **VAR_5, int VAR_6,\nuint8_t *VAR_7, int VAR_8, int VAR_9)\n{", "int VAR_10,VAR_11;", "vector signed short X,X0,X1,Y0,U0,V0,Y1,U1,V1,U,V;", "vector signed short R0,G0,B0,R1,G1,B1;", "vector unsigned char R,G,B;", "vector unsigned char *out,*nout;", "vector signed short RND = vec_splat_s16(1<<3);", "vector unsigned short SCL = vec_splat_u16(4);", "unsigned long VAR_12[16] __attribute__ ((aligned (16)));", "vector signed short *YCoeffs, *CCoeffs;", "YCoeffs = VAR_0->vYCoeffsBank+VAR_9*VAR_3;", "CCoeffs = VAR_0->vCCoeffsBank+VAR_9*VAR_6;", "out = (vector unsigned char *)VAR_7;", "for(VAR_10=0; VAR_10<VAR_8; VAR_10+=16){", "Y0 = RND;", "Y1 = RND;", "for(VAR_11=0; VAR_11<VAR_3; VAR_11++) {", "X0 = vec_ld (0, &VAR_2[VAR_11][VAR_10]);", "X1 = vec_ld (16, &VAR_2[VAR_11][VAR_10]);", "Y0 = vec_mradds (X0, YCoeffs[VAR_11], Y0);", "Y1 = vec_mradds (X1, YCoeffs[VAR_11], Y1);", "}", "U = RND;", "V = RND;", "for(VAR_11=0; VAR_11<VAR_6; VAR_11++) {", "X = vec_ld (0, &VAR_5[VAR_11][VAR_10/2]);", "U = vec_mradds (X, CCoeffs[VAR_11], U);", "X = vec_ld (0, &VAR_5[VAR_11][VAR_10/2+2048]);", "V = vec_mradds (X, CCoeffs[VAR_11], V);", "}", "Y0 = vec_sra (Y0, SCL);", "Y1 = vec_sra (Y1, SCL);", "U = vec_sra (U, SCL);", "V = vec_sra (V, SCL);", "Y0 = vec_clip_s16 (Y0);", "Y1 = vec_clip_s16 (Y1);", "U = vec_clip_s16 (U);", "V = vec_clip_s16 (V);", "U0 = vec_mergeh (U,U);", "V0 = vec_mergeh (V,V);", "U1 = vec_mergel (U,U);", "V1 = vec_mergel (V,V);", "cvtyuvtoRGB (VAR_0, Y0,U0,V0,&R0,&G0,&B0);", "cvtyuvtoRGB (VAR_0, Y1,U1,V1,&R1,&G1,&B1);", "R = vec_packclp (R0,R1);", "G = vec_packclp (G0,G1);", "B = vec_packclp (B0,B1);", "switch(VAR_0->dstFormat) {", "case PIX_FMT_ABGR: out_abgr (R,G,B,out); break;", "case PIX_FMT_BGRA: out_bgra (R,G,B,out); break;", "case PIX_FMT_RGBA: out_rgba (R,G,B,out); break;", "case PIX_FMT_ARGB: out_argb (R,G,B,out); break;", "case PIX_FMT_RGB24: out_rgb24 (R,G,B,out); break;", "case PIX_FMT_BGR24: out_bgr24 (R,G,B,out); break;", "default:\n{", "static int VAR_13;", "if(!VAR_13) {", "av_log(VAR_0, AV_LOG_ERROR, \"FUNC_0 doesn't support %s output\\n\",\nsws_format_name(VAR_0->dstFormat));", "VAR_13=1;", "}", "return;", "}", "}", "}", "if (VAR_10 < VAR_8) {", "VAR_10 -= 16;", "Y0 = RND;", "Y1 = RND;", "for(VAR_11=0; VAR_11<VAR_3; VAR_11++) {", "X0 = vec_ld (0, &VAR_2[VAR_11][VAR_10]);", "X1 = vec_ld (16, &VAR_2[VAR_11][VAR_10]);", "Y0 = vec_mradds (X0, YCoeffs[VAR_11], Y0);", "Y1 = vec_mradds (X1, YCoeffs[VAR_11], Y1);", "}", "U = RND;", "V = RND;", "for(VAR_11=0; VAR_11<VAR_6; VAR_11++) {", "X = vec_ld (0, &VAR_5[VAR_11][VAR_10/2]);", "U = vec_mradds (X, CCoeffs[VAR_11], U);", "X = vec_ld (0, &VAR_5[VAR_11][VAR_10/2+2048]);", "V = vec_mradds (X, CCoeffs[VAR_11], V);", "}", "Y0 = vec_sra (Y0, SCL);", "Y1 = vec_sra (Y1, SCL);", "U = vec_sra (U, SCL);", "V = vec_sra (V, SCL);", "Y0 = vec_clip_s16 (Y0);", "Y1 = vec_clip_s16 (Y1);", "U = vec_clip_s16 (U);", "V = vec_clip_s16 (V);", "U0 = vec_mergeh (U,U);", "V0 = vec_mergeh (V,V);", "U1 = vec_mergel (U,U);", "V1 = vec_mergel (V,V);", "cvtyuvtoRGB (VAR_0, Y0,U0,V0,&R0,&G0,&B0);", "cvtyuvtoRGB (VAR_0, Y1,U1,V1,&R1,&G1,&B1);", "R = vec_packclp (R0,R1);", "G = vec_packclp (G0,G1);", "B = vec_packclp (B0,B1);", "nout = (vector unsigned char *)VAR_12;", "switch(VAR_0->dstFormat) {", "case PIX_FMT_ABGR: out_abgr (R,G,B,nout); break;", "case PIX_FMT_BGRA: out_bgra (R,G,B,nout); break;", "case PIX_FMT_RGBA: out_rgba (R,G,B,nout); break;", "case PIX_FMT_ARGB: out_argb (R,G,B,nout); break;", "case PIX_FMT_RGB24: out_rgb24 (R,G,B,nout); break;", "case PIX_FMT_BGR24: out_bgr24 (R,G,B,nout); break;", "default:\nav_log(VAR_0, AV_LOG_ERROR, \"FUNC_0 doesn't support %s output\\n\",\nsws_format_name(VAR_0->dstFormat));", "return;", "}", "memcpy (&((uint32_t*)VAR_7)[VAR_10], VAR_12, (VAR_8-VAR_10)/4);", "}", "}" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 37 ], [ 39 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 129 ], [ 131 ], [ 135 ], [ 137 ], [ 141 ], [ 143 ], [ 147 ], [ 149 ], [ 151 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169, 171 ], [ 177 ], [ 179 ], [ 181, 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 199 ], [ 201 ], [ 205 ], [ 207 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 225 ], [ 227 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 285 ], [ 287 ], [ 291 ], [ 293 ], [ 297 ], [ 299 ], [ 303 ], [ 305 ], [ 307 ], [ 311 ], [ 313 ], [ 315 ], [ 317 ], [ 319 ], [ 321 ], [ 323 ], [ 325 ], [ 327, 331, 333 ], [ 335 ], [ 337 ], [ 341 ], [ 343 ], [ 347 ] ]
18,823
int unix_listen_opts(QemuOpts *opts, Error **errp) { struct sockaddr_un un; const char *path = qemu_opt_get(opts, "path"); int sock, fd; sock = qemu_socket(PF_UNIX, SOCK_STREAM, 0); if (sock < 0) { error_setg_errno(errp, errno, "Failed to create Unix socket"); return -1; } memset(&un, 0, sizeof(un)); un.sun_family = AF_UNIX; if (path && strlen(path)) { snprintf(un.sun_path, sizeof(un.sun_path), "%s", path); } else { const char *tmpdir = getenv("TMPDIR"); tmpdir = tmpdir ? tmpdir : "/tmp"; if (snprintf(un.sun_path, sizeof(un.sun_path), "%s/qemu-socket-XXXXXX", tmpdir) >= sizeof(un.sun_path)) { error_setg_errno(errp, errno, "TMPDIR environment variable (%s) too large", tmpdir); goto err; } /* * This dummy fd usage silences the mktemp() unsecure warning. * Using mkstemp() doesn't make things more secure here * though. bind() complains about existing files, so we have * to unlink first and thus re-open the race window. The * worst case possible is bind() failing, i.e. a DoS attack. */ fd = mkstemp(un.sun_path); if (fd < 0) { error_setg_errno(errp, errno, "Failed to make a temporary socket name in %s", tmpdir); goto err; } close(fd); qemu_opt_set(opts, "path", un.sun_path, &error_abort); } if ((access(un.sun_path, F_OK) == 0) && unlink(un.sun_path) < 0) { error_setg_errno(errp, errno, "Failed to unlink socket %s", un.sun_path); goto err; } if (bind(sock, (struct sockaddr*) &un, sizeof(un)) < 0) { error_setg_errno(errp, errno, "Failed to bind socket to %s", un.sun_path); goto err; } if (listen(sock, 1) < 0) { error_setg_errno(errp, errno, "Failed to listen on socket"); goto err; } return sock; err: closesocket(sock); return -1; }
true
qemu
a2f31f180499593b5edb8ac5ab8ac1b92f0abcd4
int unix_listen_opts(QemuOpts *opts, Error **errp) { struct sockaddr_un un; const char *path = qemu_opt_get(opts, "path"); int sock, fd; sock = qemu_socket(PF_UNIX, SOCK_STREAM, 0); if (sock < 0) { error_setg_errno(errp, errno, "Failed to create Unix socket"); return -1; } memset(&un, 0, sizeof(un)); un.sun_family = AF_UNIX; if (path && strlen(path)) { snprintf(un.sun_path, sizeof(un.sun_path), "%s", path); } else { const char *tmpdir = getenv("TMPDIR"); tmpdir = tmpdir ? tmpdir : "/tmp"; if (snprintf(un.sun_path, sizeof(un.sun_path), "%s/qemu-socket-XXXXXX", tmpdir) >= sizeof(un.sun_path)) { error_setg_errno(errp, errno, "TMPDIR environment variable (%s) too large", tmpdir); goto err; } fd = mkstemp(un.sun_path); if (fd < 0) { error_setg_errno(errp, errno, "Failed to make a temporary socket name in %s", tmpdir); goto err; } close(fd); qemu_opt_set(opts, "path", un.sun_path, &error_abort); } if ((access(un.sun_path, F_OK) == 0) && unlink(un.sun_path) < 0) { error_setg_errno(errp, errno, "Failed to unlink socket %s", un.sun_path); goto err; } if (bind(sock, (struct sockaddr*) &un, sizeof(un)) < 0) { error_setg_errno(errp, errno, "Failed to bind socket to %s", un.sun_path); goto err; } if (listen(sock, 1) < 0) { error_setg_errno(errp, errno, "Failed to listen on socket"); goto err; } return sock; err: closesocket(sock); return -1; }
{ "code": [ " if ((access(un.sun_path, F_OK) == 0) &&", " unlink(un.sun_path) < 0) {" ], "line_no": [ 87, 89 ] }
int FUNC_0(QemuOpts *VAR_0, Error **VAR_1) { struct sockaddr_un VAR_2; const char *VAR_3 = qemu_opt_get(VAR_0, "VAR_3"); int VAR_4, VAR_5; VAR_4 = qemu_socket(PF_UNIX, SOCK_STREAM, 0); if (VAR_4 < 0) { error_setg_errno(VAR_1, errno, "Failed to create Unix socket"); return -1; } memset(&VAR_2, 0, sizeof(VAR_2)); VAR_2.sun_family = AF_UNIX; if (VAR_3 && strlen(VAR_3)) { snprintf(VAR_2.sun_path, sizeof(VAR_2.sun_path), "%s", VAR_3); } else { const char *VAR_6 = getenv("TMPDIR"); VAR_6 = VAR_6 ? VAR_6 : "/tmp"; if (snprintf(VAR_2.sun_path, sizeof(VAR_2.sun_path), "%s/qemu-socket-XXXXXX", VAR_6) >= sizeof(VAR_2.sun_path)) { error_setg_errno(VAR_1, errno, "TMPDIR environment variable (%s) too large", VAR_6); goto err; } VAR_5 = mkstemp(VAR_2.sun_path); if (VAR_5 < 0) { error_setg_errno(VAR_1, errno, "Failed to make a temporary socket name in %s", VAR_6); goto err; } close(VAR_5); qemu_opt_set(VAR_0, "VAR_3", VAR_2.sun_path, &error_abort); } if ((access(VAR_2.sun_path, F_OK) == 0) && unlink(VAR_2.sun_path) < 0) { error_setg_errno(VAR_1, errno, "Failed to unlink socket %s", VAR_2.sun_path); goto err; } if (bind(VAR_4, (struct sockaddr*) &VAR_2, sizeof(VAR_2)) < 0) { error_setg_errno(VAR_1, errno, "Failed to bind socket to %s", VAR_2.sun_path); goto err; } if (listen(VAR_4, 1) < 0) { error_setg_errno(VAR_1, errno, "Failed to listen on socket"); goto err; } return VAR_4; err: closesocket(VAR_4); return -1; }
[ "int FUNC_0(QemuOpts *VAR_0, Error **VAR_1)\n{", "struct sockaddr_un VAR_2;", "const char *VAR_3 = qemu_opt_get(VAR_0, \"VAR_3\");", "int VAR_4, VAR_5;", "VAR_4 = qemu_socket(PF_UNIX, SOCK_STREAM, 0);", "if (VAR_4 < 0) {", "error_setg_errno(VAR_1, errno, \"Failed to create Unix socket\");", "return -1;", "}", "memset(&VAR_2, 0, sizeof(VAR_2));", "VAR_2.sun_family = AF_UNIX;", "if (VAR_3 && strlen(VAR_3)) {", "snprintf(VAR_2.sun_path, sizeof(VAR_2.sun_path), \"%s\", VAR_3);", "} else {", "const char *VAR_6 = getenv(\"TMPDIR\");", "VAR_6 = VAR_6 ? VAR_6 : \"/tmp\";", "if (snprintf(VAR_2.sun_path, sizeof(VAR_2.sun_path), \"%s/qemu-socket-XXXXXX\",\nVAR_6) >= sizeof(VAR_2.sun_path)) {", "error_setg_errno(VAR_1, errno,\n\"TMPDIR environment variable (%s) too large\", VAR_6);", "goto err;", "}", "VAR_5 = mkstemp(VAR_2.sun_path);", "if (VAR_5 < 0) {", "error_setg_errno(VAR_1, errno,\n\"Failed to make a temporary socket name in %s\", VAR_6);", "goto err;", "}", "close(VAR_5);", "qemu_opt_set(VAR_0, \"VAR_3\", VAR_2.sun_path, &error_abort);", "}", "if ((access(VAR_2.sun_path, F_OK) == 0) &&\nunlink(VAR_2.sun_path) < 0) {", "error_setg_errno(VAR_1, errno,\n\"Failed to unlink socket %s\", VAR_2.sun_path);", "goto err;", "}", "if (bind(VAR_4, (struct sockaddr*) &VAR_2, sizeof(VAR_2)) < 0) {", "error_setg_errno(VAR_1, errno, \"Failed to bind socket to %s\", VAR_2.sun_path);", "goto err;", "}", "if (listen(VAR_4, 1) < 0) {", "error_setg_errno(VAR_1, errno, \"Failed to listen on socket\");", "goto err;", "}", "return VAR_4;", "err:\nclosesocket(VAR_4);", "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, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39, 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 67 ], [ 69 ], [ 71, 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 87, 89 ], [ 91, 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 117 ], [ 121, 123 ], [ 125 ], [ 127 ] ]
18,824
static void rv40_h_strong_loop_filter(uint8_t *src, const int stride, const int alpha, const int lims, const int dmode, const int chroma) { rv40_strong_loop_filter(src, stride, 1, alpha, lims, dmode, chroma); }
true
FFmpeg
3ab9a2a5577d445252724af4067d2a7c8a378efa
static void rv40_h_strong_loop_filter(uint8_t *src, const int stride, const int alpha, const int lims, const int dmode, const int chroma) { rv40_strong_loop_filter(src, stride, 1, alpha, lims, dmode, chroma); }
{ "code": [ "static void rv40_h_strong_loop_filter(uint8_t *src, const int stride," ], "line_no": [ 1 ] }
static void FUNC_0(uint8_t *VAR_0, const int VAR_1, const int VAR_2, const int VAR_3, const int VAR_4, const int VAR_5) { rv40_strong_loop_filter(VAR_0, VAR_1, 1, VAR_2, VAR_3, VAR_4, VAR_5); }
[ "static void FUNC_0(uint8_t *VAR_0, const int VAR_1,\nconst int VAR_2, const int VAR_3,\nconst int VAR_4, const int VAR_5)\n{", "rv40_strong_loop_filter(VAR_0, VAR_1, 1, VAR_2, VAR_3, VAR_4, VAR_5);", "}" ]
[ 1, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ] ]
18,825
static void copy_frame(J2kEncoderContext *s) { int tileno, compno, i, y, x; uint8_t *line; for (tileno = 0; tileno < s->numXtiles * s->numYtiles; tileno++){ J2kTile *tile = s->tile + tileno; if (s->planar){ for (compno = 0; compno < s->ncomponents; compno++){ J2kComponent *comp = tile->comp + compno; int *dst = comp->data; line = s->picture->data[compno] + comp->coord[1][0] * s->picture->linesize[compno] + comp->coord[0][0]; for (y = comp->coord[1][0]; y < comp->coord[1][1]; y++){ uint8_t *ptr = line; for (x = comp->coord[0][0]; x < comp->coord[0][1]; x++) *dst++ = *ptr++ - (1 << 7); line += s->picture->linesize[compno]; } } } else{ line = s->picture->data[0] + tile->comp[0].coord[1][0] * s->picture->linesize[0] + tile->comp[0].coord[0][0] * s->ncomponents; i = 0; for (y = tile->comp[0].coord[1][0]; y < tile->comp[0].coord[1][1]; y++){ uint8_t *ptr = line; for (x = tile->comp[0].coord[0][0]; x < tile->comp[0].coord[0][1]; x++, i++){ for (compno = 0; compno < s->ncomponents; compno++){ tile->comp[compno].data[i] = *ptr++ - (1 << 7); } } line += s->picture->linesize[0]; } } } }
true
FFmpeg
e6aed5f404a0983b2971c90e9022f6964a75de0b
static void copy_frame(J2kEncoderContext *s) { int tileno, compno, i, y, x; uint8_t *line; for (tileno = 0; tileno < s->numXtiles * s->numYtiles; tileno++){ J2kTile *tile = s->tile + tileno; if (s->planar){ for (compno = 0; compno < s->ncomponents; compno++){ J2kComponent *comp = tile->comp + compno; int *dst = comp->data; line = s->picture->data[compno] + comp->coord[1][0] * s->picture->linesize[compno] + comp->coord[0][0]; for (y = comp->coord[1][0]; y < comp->coord[1][1]; y++){ uint8_t *ptr = line; for (x = comp->coord[0][0]; x < comp->coord[0][1]; x++) *dst++ = *ptr++ - (1 << 7); line += s->picture->linesize[compno]; } } } else{ line = s->picture->data[0] + tile->comp[0].coord[1][0] * s->picture->linesize[0] + tile->comp[0].coord[0][0] * s->ncomponents; i = 0; for (y = tile->comp[0].coord[1][0]; y < tile->comp[0].coord[1][1]; y++){ uint8_t *ptr = line; for (x = tile->comp[0].coord[0][0]; x < tile->comp[0].coord[0][1]; x++, i++){ for (compno = 0; compno < s->ncomponents; compno++){ tile->comp[compno].data[i] = *ptr++ - (1 << 7); } } line += s->picture->linesize[0]; } } } }
{ "code": [ " line = s->picture->data[compno]", " + comp->coord[1][0] * s->picture->linesize[compno]", " line += s->picture->linesize[compno];", " line = s->picture->data[0] + tile->comp[0].coord[1][0] * s->picture->linesize[0]", " line += s->picture->linesize[0];" ], "line_no": [ 21, 23, 35, 43, 65 ] }
static void FUNC_0(J2kEncoderContext *VAR_0) { int VAR_1, VAR_2, VAR_3, VAR_4, VAR_5; uint8_t *line; for (VAR_1 = 0; VAR_1 < VAR_0->numXtiles * VAR_0->numYtiles; VAR_1++){ J2kTile *tile = VAR_0->tile + VAR_1; if (VAR_0->planar){ for (VAR_2 = 0; VAR_2 < VAR_0->ncomponents; VAR_2++){ J2kComponent *comp = tile->comp + VAR_2; int *dst = comp->data; line = VAR_0->picture->data[VAR_2] + comp->coord[1][0] * VAR_0->picture->linesize[VAR_2] + comp->coord[0][0]; for (VAR_4 = comp->coord[1][0]; VAR_4 < comp->coord[1][1]; VAR_4++){ uint8_t *ptr = line; for (VAR_5 = comp->coord[0][0]; VAR_5 < comp->coord[0][1]; VAR_5++) *dst++ = *ptr++ - (1 << 7); line += VAR_0->picture->linesize[VAR_2]; } } } else{ line = VAR_0->picture->data[0] + tile->comp[0].coord[1][0] * VAR_0->picture->linesize[0] + tile->comp[0].coord[0][0] * VAR_0->ncomponents; VAR_3 = 0; for (VAR_4 = tile->comp[0].coord[1][0]; VAR_4 < tile->comp[0].coord[1][1]; VAR_4++){ uint8_t *ptr = line; for (VAR_5 = tile->comp[0].coord[0][0]; VAR_5 < tile->comp[0].coord[0][1]; VAR_5++, VAR_3++){ for (VAR_2 = 0; VAR_2 < VAR_0->ncomponents; VAR_2++){ tile->comp[VAR_2].data[VAR_3] = *ptr++ - (1 << 7); } } line += VAR_0->picture->linesize[0]; } } } }
[ "static void FUNC_0(J2kEncoderContext *VAR_0)\n{", "int VAR_1, VAR_2, VAR_3, VAR_4, VAR_5;", "uint8_t *line;", "for (VAR_1 = 0; VAR_1 < VAR_0->numXtiles * VAR_0->numYtiles; VAR_1++){", "J2kTile *tile = VAR_0->tile + VAR_1;", "if (VAR_0->planar){", "for (VAR_2 = 0; VAR_2 < VAR_0->ncomponents; VAR_2++){", "J2kComponent *comp = tile->comp + VAR_2;", "int *dst = comp->data;", "line = VAR_0->picture->data[VAR_2]\n+ comp->coord[1][0] * VAR_0->picture->linesize[VAR_2]\n+ comp->coord[0][0];", "for (VAR_4 = comp->coord[1][0]; VAR_4 < comp->coord[1][1]; VAR_4++){", "uint8_t *ptr = line;", "for (VAR_5 = comp->coord[0][0]; VAR_5 < comp->coord[0][1]; VAR_5++)", "*dst++ = *ptr++ - (1 << 7);", "line += VAR_0->picture->linesize[VAR_2];", "}", "}", "} else{", "line = VAR_0->picture->data[0] + tile->comp[0].coord[1][0] * VAR_0->picture->linesize[0]\n+ tile->comp[0].coord[0][0] * VAR_0->ncomponents;", "VAR_3 = 0;", "for (VAR_4 = tile->comp[0].coord[1][0]; VAR_4 < tile->comp[0].coord[1][1]; VAR_4++){", "uint8_t *ptr = line;", "for (VAR_5 = tile->comp[0].coord[0][0]; VAR_5 < tile->comp[0].coord[0][1]; VAR_5++, VAR_3++){", "for (VAR_2 = 0; VAR_2 < VAR_0->ncomponents; VAR_2++){", "tile->comp[VAR_2].data[VAR_3] = *ptr++ - (1 << 7);", "}", "}", "line += VAR_0->picture->linesize[0];", "}", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21, 23, 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ] ]
18,826
static void migrate_fd_cleanup(void *opaque) { MigrationState *s = opaque; qemu_bh_delete(s->cleanup_bh); s->cleanup_bh = NULL; if (s->file) { trace_migrate_fd_cleanup(); qemu_mutex_unlock_iothread(); qemu_thread_join(&s->thread); qemu_mutex_lock_iothread(); qemu_fclose(s->file); s->file = NULL; } assert(s->state != MIG_STATE_ACTIVE); if (s->state != MIG_STATE_COMPLETED) { qemu_savevm_state_cancel(); if (s->state == MIG_STATE_CANCELLING) { migrate_set_state(s, MIG_STATE_CANCELLING, MIG_STATE_CANCELLED); } } notifier_list_notify(&migration_state_notifiers, s); }
true
qemu
60fe637bf0e4d7989e21e50f52526444765c63b4
static void migrate_fd_cleanup(void *opaque) { MigrationState *s = opaque; qemu_bh_delete(s->cleanup_bh); s->cleanup_bh = NULL; if (s->file) { trace_migrate_fd_cleanup(); qemu_mutex_unlock_iothread(); qemu_thread_join(&s->thread); qemu_mutex_lock_iothread(); qemu_fclose(s->file); s->file = NULL; } assert(s->state != MIG_STATE_ACTIVE); if (s->state != MIG_STATE_COMPLETED) { qemu_savevm_state_cancel(); if (s->state == MIG_STATE_CANCELLING) { migrate_set_state(s, MIG_STATE_CANCELLING, MIG_STATE_CANCELLED); } } notifier_list_notify(&migration_state_notifiers, s); }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0) { MigrationState *s = VAR_0; qemu_bh_delete(s->cleanup_bh); s->cleanup_bh = NULL; if (s->file) { trace_migrate_fd_cleanup(); qemu_mutex_unlock_iothread(); qemu_thread_join(&s->thread); qemu_mutex_lock_iothread(); qemu_fclose(s->file); s->file = NULL; } assert(s->state != MIG_STATE_ACTIVE); if (s->state != MIG_STATE_COMPLETED) { qemu_savevm_state_cancel(); if (s->state == MIG_STATE_CANCELLING) { migrate_set_state(s, MIG_STATE_CANCELLING, MIG_STATE_CANCELLED); } } notifier_list_notify(&migration_state_notifiers, s); }
[ "static void FUNC_0(void *VAR_0)\n{", "MigrationState *s = VAR_0;", "qemu_bh_delete(s->cleanup_bh);", "s->cleanup_bh = NULL;", "if (s->file) {", "trace_migrate_fd_cleanup();", "qemu_mutex_unlock_iothread();", "qemu_thread_join(&s->thread);", "qemu_mutex_lock_iothread();", "qemu_fclose(s->file);", "s->file = NULL;", "}", "assert(s->state != MIG_STATE_ACTIVE);", "if (s->state != MIG_STATE_COMPLETED) {", "qemu_savevm_state_cancel();", "if (s->state == MIG_STATE_CANCELLING) {", "migrate_set_state(s, MIG_STATE_CANCELLING, MIG_STATE_CANCELLED);", "}", "}", "notifier_list_notify(&migration_state_notifiers, s);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ] ]
18,827
static void uhci_async_cancel_device(UHCIState *s, USBDevice *dev) { UHCIAsync *curr, *n; QTAILQ_FOREACH_SAFE(curr, &s->async_pending, next, n) { if (curr->packet.owner == NULL || curr->packet.owner->dev != dev) { continue; } uhci_async_unlink(s, curr); uhci_async_cancel(s, curr); } }
true
qemu
f53c398aa603cea135ee58fd15249aeff7b9c7ea
static void uhci_async_cancel_device(UHCIState *s, USBDevice *dev) { UHCIAsync *curr, *n; QTAILQ_FOREACH_SAFE(curr, &s->async_pending, next, n) { if (curr->packet.owner == NULL || curr->packet.owner->dev != dev) { continue; } uhci_async_unlink(s, curr); uhci_async_cancel(s, curr); } }
{ "code": [ " if (curr->packet.owner == NULL ||", " curr->packet.owner->dev != dev) {" ], "line_no": [ 11, 13 ] }
static void FUNC_0(UHCIState *VAR_0, USBDevice *VAR_1) { UHCIAsync *curr, *n; QTAILQ_FOREACH_SAFE(curr, &VAR_0->async_pending, next, n) { if (curr->packet.owner == NULL || curr->packet.owner->VAR_1 != VAR_1) { continue; } uhci_async_unlink(VAR_0, curr); uhci_async_cancel(VAR_0, curr); } }
[ "static void FUNC_0(UHCIState *VAR_0, USBDevice *VAR_1)\n{", "UHCIAsync *curr, *n;", "QTAILQ_FOREACH_SAFE(curr, &VAR_0->async_pending, next, n) {", "if (curr->packet.owner == NULL ||\ncurr->packet.owner->VAR_1 != VAR_1) {", "continue;", "}", "uhci_async_unlink(VAR_0, curr);", "uhci_async_cancel(VAR_0, curr);", "}", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11, 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ] ]
18,829
static TraceEvent* find_trace_event_by_name(const char *tname) { unsigned int i; if (!tname) { return NULL; } for (i = 0; i < NR_TRACE_EVENTS; i++) { if (!strcmp(trace_list[i].tp_name, tname)) { return &trace_list[i]; } } return NULL; /* indicates end of list reached without a match */ }
true
qemu
0b5538c300a56c3cfb33022840fe0b4968147e7a
static TraceEvent* find_trace_event_by_name(const char *tname) { unsigned int i; if (!tname) { return NULL; } for (i = 0; i < NR_TRACE_EVENTS; i++) { if (!strcmp(trace_list[i].tp_name, tname)) { return &trace_list[i]; } } return NULL; }
{ "code": [ "static TraceEvent* find_trace_event_by_name(const char *tname)", " if (!tname) {", " return NULL;", " if (!strcmp(trace_list[i].tp_name, tname)) {", " return &trace_list[i];" ], "line_no": [ 1, 9, 11, 19, 21 ] }
static TraceEvent* FUNC_0(const char *tname) { unsigned int VAR_0; if (!tname) { return NULL; } for (VAR_0 = 0; VAR_0 < NR_TRACE_EVENTS; VAR_0++) { if (!strcmp(trace_list[VAR_0].tp_name, tname)) { return &trace_list[VAR_0]; } } return NULL; }
[ "static TraceEvent* FUNC_0(const char *tname)\n{", "unsigned int VAR_0;", "if (!tname) {", "return NULL;", "}", "for (VAR_0 = 0; VAR_0 < NR_TRACE_EVENTS; VAR_0++) {", "if (!strcmp(trace_list[VAR_0].tp_name, tname)) {", "return &trace_list[VAR_0];", "}", "}", "return NULL;", "}" ]
[ 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ] ]
18,831
i2c_slave *twl92230_init(i2c_bus *bus, qemu_irq irq) { struct menelaus_s *s = (struct menelaus_s *) i2c_slave_init(bus, 0, sizeof(struct menelaus_s)); s->i2c.event = menelaus_event; s->i2c.recv = menelaus_rx; s->i2c.send = menelaus_tx; s->irq = irq; s->rtc.hz = qemu_new_timer(rt_clock, menelaus_rtc_hz, s); s->in = qemu_allocate_irqs(menelaus_gpio_set, s, 3); s->pwrbtn = qemu_allocate_irqs(menelaus_pwrbtn_set, s, 1)[0]; menelaus_reset(&s->i2c); register_savevm("menelaus", -1, 0, menelaus_save, menelaus_load, s); return &s->i2c; }
true
qemu
b0f74c87a1dbd6b0c5e4de7f1c5cb40197e3fbe9
i2c_slave *twl92230_init(i2c_bus *bus, qemu_irq irq) { struct menelaus_s *s = (struct menelaus_s *) i2c_slave_init(bus, 0, sizeof(struct menelaus_s)); s->i2c.event = menelaus_event; s->i2c.recv = menelaus_rx; s->i2c.send = menelaus_tx; s->irq = irq; s->rtc.hz = qemu_new_timer(rt_clock, menelaus_rtc_hz, s); s->in = qemu_allocate_irqs(menelaus_gpio_set, s, 3); s->pwrbtn = qemu_allocate_irqs(menelaus_pwrbtn_set, s, 1)[0]; menelaus_reset(&s->i2c); register_savevm("menelaus", -1, 0, menelaus_save, menelaus_load, s); return &s->i2c; }
{ "code": [ " s->rtc.hz = qemu_new_timer(rt_clock, menelaus_rtc_hz, s);" ], "line_no": [ 21 ] }
i2c_slave *FUNC_0(i2c_bus *bus, qemu_irq irq) { struct menelaus_s *VAR_0 = (struct menelaus_s *) i2c_slave_init(bus, 0, sizeof(struct menelaus_s)); VAR_0->i2c.event = menelaus_event; VAR_0->i2c.recv = menelaus_rx; VAR_0->i2c.send = menelaus_tx; VAR_0->irq = irq; VAR_0->rtc.hz = qemu_new_timer(rt_clock, menelaus_rtc_hz, VAR_0); VAR_0->in = qemu_allocate_irqs(menelaus_gpio_set, VAR_0, 3); VAR_0->pwrbtn = qemu_allocate_irqs(menelaus_pwrbtn_set, VAR_0, 1)[0]; menelaus_reset(&VAR_0->i2c); register_savevm("menelaus", -1, 0, menelaus_save, menelaus_load, VAR_0); return &VAR_0->i2c; }
[ "i2c_slave *FUNC_0(i2c_bus *bus, qemu_irq irq)\n{", "struct menelaus_s *VAR_0 = (struct menelaus_s *)\ni2c_slave_init(bus, 0, sizeof(struct menelaus_s));", "VAR_0->i2c.event = menelaus_event;", "VAR_0->i2c.recv = menelaus_rx;", "VAR_0->i2c.send = menelaus_tx;", "VAR_0->irq = irq;", "VAR_0->rtc.hz = qemu_new_timer(rt_clock, menelaus_rtc_hz, VAR_0);", "VAR_0->in = qemu_allocate_irqs(menelaus_gpio_set, VAR_0, 3);", "VAR_0->pwrbtn = qemu_allocate_irqs(menelaus_pwrbtn_set, VAR_0, 1)[0];", "menelaus_reset(&VAR_0->i2c);", "register_savevm(\"menelaus\", -1, 0, menelaus_save, menelaus_load, VAR_0);", "return &VAR_0->i2c;", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 33 ], [ 37 ], [ 39 ] ]
18,832
static int av_seek_frame_generic(AVFormatContext *s, int stream_index, int64_t timestamp, int flags) { int index; AVStream *st; AVIndexEntry *ie; st = s->streams[stream_index]; index = av_index_search_timestamp(st, timestamp, flags); if(index < 0 || index==st->nb_index_entries-1){ int i; AVPacket pkt; if(st->nb_index_entries){ assert(st->index_entries); ie= &st->index_entries[st->nb_index_entries-1]; url_fseek(s->pb, ie->pos, SEEK_SET); av_update_cur_dts(s, st, ie->timestamp); }else url_fseek(s->pb, 0, SEEK_SET); for(i=0;; i++) { int ret = av_read_frame(s, &pkt); if(ret<0) break; av_free_packet(&pkt); if(stream_index == pkt.stream_index){ if((pkt.flags & PKT_FLAG_KEY) && pkt.dts > timestamp) break; } } index = av_index_search_timestamp(st, timestamp, flags); } if (index < 0) return -1; av_read_frame_flush(s); if (s->iformat->read_seek){ if(s->iformat->read_seek(s, stream_index, timestamp, flags) >= 0) return 0; } ie = &st->index_entries[index]; url_fseek(s->pb, ie->pos, SEEK_SET); av_update_cur_dts(s, st, ie->timestamp); return 0; }
false
FFmpeg
aaec4e03e91f3f301d5720429a5da99b44e7e1bb
static int av_seek_frame_generic(AVFormatContext *s, int stream_index, int64_t timestamp, int flags) { int index; AVStream *st; AVIndexEntry *ie; st = s->streams[stream_index]; index = av_index_search_timestamp(st, timestamp, flags); if(index < 0 || index==st->nb_index_entries-1){ int i; AVPacket pkt; if(st->nb_index_entries){ assert(st->index_entries); ie= &st->index_entries[st->nb_index_entries-1]; url_fseek(s->pb, ie->pos, SEEK_SET); av_update_cur_dts(s, st, ie->timestamp); }else url_fseek(s->pb, 0, SEEK_SET); for(i=0;; i++) { int ret = av_read_frame(s, &pkt); if(ret<0) break; av_free_packet(&pkt); if(stream_index == pkt.stream_index){ if((pkt.flags & PKT_FLAG_KEY) && pkt.dts > timestamp) break; } } index = av_index_search_timestamp(st, timestamp, flags); } if (index < 0) return -1; av_read_frame_flush(s); if (s->iformat->read_seek){ if(s->iformat->read_seek(s, stream_index, timestamp, flags) >= 0) return 0; } ie = &st->index_entries[index]; url_fseek(s->pb, ie->pos, SEEK_SET); av_update_cur_dts(s, st, ie->timestamp); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0, int VAR_1, int64_t VAR_2, int VAR_3) { int VAR_4; AVStream *st; AVIndexEntry *ie; st = VAR_0->streams[VAR_1]; VAR_4 = av_index_search_timestamp(st, VAR_2, VAR_3); if(VAR_4 < 0 || VAR_4==st->nb_index_entries-1){ int VAR_5; AVPacket pkt; if(st->nb_index_entries){ assert(st->index_entries); ie= &st->index_entries[st->nb_index_entries-1]; url_fseek(VAR_0->pb, ie->pos, SEEK_SET); av_update_cur_dts(VAR_0, st, ie->VAR_2); }else url_fseek(VAR_0->pb, 0, SEEK_SET); for(VAR_5=0;; VAR_5++) { int VAR_6 = av_read_frame(VAR_0, &pkt); if(VAR_6<0) break; av_free_packet(&pkt); if(VAR_1 == pkt.VAR_1){ if((pkt.VAR_3 & PKT_FLAG_KEY) && pkt.dts > VAR_2) break; } } VAR_4 = av_index_search_timestamp(st, VAR_2, VAR_3); } if (VAR_4 < 0) return -1; av_read_frame_flush(VAR_0); if (VAR_0->iformat->read_seek){ if(VAR_0->iformat->read_seek(VAR_0, VAR_1, VAR_2, VAR_3) >= 0) return 0; } ie = &st->index_entries[VAR_4]; url_fseek(VAR_0->pb, ie->pos, SEEK_SET); av_update_cur_dts(VAR_0, st, ie->VAR_2); return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0,\nint VAR_1, int64_t VAR_2, int VAR_3)\n{", "int VAR_4;", "AVStream *st;", "AVIndexEntry *ie;", "st = VAR_0->streams[VAR_1];", "VAR_4 = av_index_search_timestamp(st, VAR_2, VAR_3);", "if(VAR_4 < 0 || VAR_4==st->nb_index_entries-1){", "int VAR_5;", "AVPacket pkt;", "if(st->nb_index_entries){", "assert(st->index_entries);", "ie= &st->index_entries[st->nb_index_entries-1];", "url_fseek(VAR_0->pb, ie->pos, SEEK_SET);", "av_update_cur_dts(VAR_0, st, ie->VAR_2);", "}else", "url_fseek(VAR_0->pb, 0, SEEK_SET);", "for(VAR_5=0;; VAR_5++) {", "int VAR_6 = av_read_frame(VAR_0, &pkt);", "if(VAR_6<0)\nbreak;", "av_free_packet(&pkt);", "if(VAR_1 == pkt.VAR_1){", "if((pkt.VAR_3 & PKT_FLAG_KEY) && pkt.dts > VAR_2)\nbreak;", "}", "}", "VAR_4 = av_index_search_timestamp(st, VAR_2, VAR_3);", "}", "if (VAR_4 < 0)\nreturn -1;", "av_read_frame_flush(VAR_0);", "if (VAR_0->iformat->read_seek){", "if(VAR_0->iformat->read_seek(VAR_0, VAR_1, VAR_2, VAR_3) >= 0)\nreturn 0;", "}", "ie = &st->index_entries[VAR_4];", "url_fseek(VAR_0->pb, ie->pos, SEEK_SET);", "av_update_cur_dts(VAR_0, st, ie->VAR_2);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51, 53 ], [ 55 ], [ 57 ], [ 59, 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71, 73 ], [ 77 ], [ 79 ], [ 81, 83 ], [ 85 ], [ 87 ], [ 89 ], [ 93 ], [ 97 ], [ 99 ] ]
18,835
static int ogg_read_packet(AVFormatContext *s, AVPacket *pkt) { struct ogg *ogg; struct ogg_stream *os; int idx, ret; int pstart, psize; int64_t fpos, pts, dts; if (s->io_repositioned) { ogg_reset(s); s->io_repositioned = 0; //Get an ogg packet retry: do { ret = ogg_packet(s, &idx, &pstart, &psize, &fpos); if (ret < 0) return ret; } while (idx < 0 || !s->streams[idx]); ogg = s->priv_data; os = ogg->streams + idx; // pflags might not be set until after this pts = ogg_calc_pts(s, idx, &dts); ogg_validate_keyframe(s, idx, pstart, psize); if (os->keyframe_seek && !(os->pflags & AV_PKT_FLAG_KEY)) goto retry; os->keyframe_seek = 0; //Alloc a pkt ret = av_new_packet(pkt, psize); if (ret < 0) return ret; pkt->stream_index = idx; memcpy(pkt->data, os->buf + pstart, psize); pkt->pts = pts; pkt->dts = dts; pkt->flags = os->pflags; pkt->duration = os->pduration; pkt->pos = fpos; if (os->end_trimming) { uint8_t *side_data = av_packet_new_side_data(pkt, AV_PKT_DATA_SKIP_SAMPLES, 10); AV_WL32(side_data + 4, os->end_trimming); os->end_trimming = 0; if (os->new_metadata) { uint8_t *side_data = av_packet_new_side_data(pkt, AV_PKT_DATA_METADATA_UPDATE, os->new_metadata_size); memcpy(side_data, os->new_metadata, os->new_metadata_size); av_freep(&os->new_metadata); os->new_metadata_size = 0; return psize;
true
FFmpeg
c1b24ca762cba20236190cd7b24e84a9ad788bcb
static int ogg_read_packet(AVFormatContext *s, AVPacket *pkt) { struct ogg *ogg; struct ogg_stream *os; int idx, ret; int pstart, psize; int64_t fpos, pts, dts; if (s->io_repositioned) { ogg_reset(s); s->io_repositioned = 0; retry: do { ret = ogg_packet(s, &idx, &pstart, &psize, &fpos); if (ret < 0) return ret; } while (idx < 0 || !s->streams[idx]); ogg = s->priv_data; os = ogg->streams + idx; pts = ogg_calc_pts(s, idx, &dts); ogg_validate_keyframe(s, idx, pstart, psize); if (os->keyframe_seek && !(os->pflags & AV_PKT_FLAG_KEY)) goto retry; os->keyframe_seek = 0; ret = av_new_packet(pkt, psize); if (ret < 0) return ret; pkt->stream_index = idx; memcpy(pkt->data, os->buf + pstart, psize); pkt->pts = pts; pkt->dts = dts; pkt->flags = os->pflags; pkt->duration = os->pduration; pkt->pos = fpos; if (os->end_trimming) { uint8_t *side_data = av_packet_new_side_data(pkt, AV_PKT_DATA_SKIP_SAMPLES, 10); AV_WL32(side_data + 4, os->end_trimming); os->end_trimming = 0; if (os->new_metadata) { uint8_t *side_data = av_packet_new_side_data(pkt, AV_PKT_DATA_METADATA_UPDATE, os->new_metadata_size); memcpy(side_data, os->new_metadata, os->new_metadata_size); av_freep(&os->new_metadata); os->new_metadata_size = 0; return psize;
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1) { struct VAR_2 *VAR_2; struct ogg_stream *VAR_3; int VAR_4, VAR_5; int VAR_6, VAR_7; int64_t fpos, pts, dts; if (VAR_0->io_repositioned) { ogg_reset(VAR_0); VAR_0->io_repositioned = 0; retry: do { VAR_5 = ogg_packet(VAR_0, &VAR_4, &VAR_6, &VAR_7, &fpos); if (VAR_5 < 0) return VAR_5; } while (VAR_4 < 0 || !VAR_0->streams[VAR_4]); VAR_2 = VAR_0->priv_data; VAR_3 = VAR_2->streams + VAR_4; pts = ogg_calc_pts(VAR_0, VAR_4, &dts); ogg_validate_keyframe(VAR_0, VAR_4, VAR_6, VAR_7); if (VAR_3->keyframe_seek && !(VAR_3->pflags & AV_PKT_FLAG_KEY)) goto retry; VAR_3->keyframe_seek = 0; VAR_5 = av_new_packet(VAR_1, VAR_7); if (VAR_5 < 0) return VAR_5; VAR_1->stream_index = VAR_4; memcpy(VAR_1->data, VAR_3->buf + VAR_6, VAR_7); VAR_1->pts = pts; VAR_1->dts = dts; VAR_1->flags = VAR_3->pflags; VAR_1->duration = VAR_3->pduration; VAR_1->pos = fpos; if (VAR_3->end_trimming) { uint8_t *side_data = av_packet_new_side_data(VAR_1, AV_PKT_DATA_SKIP_SAMPLES, 10); AV_WL32(side_data + 4, VAR_3->end_trimming); VAR_3->end_trimming = 0; if (VAR_3->new_metadata) { uint8_t *side_data = av_packet_new_side_data(VAR_1, AV_PKT_DATA_METADATA_UPDATE, VAR_3->new_metadata_size); memcpy(side_data, VAR_3->new_metadata, VAR_3->new_metadata_size); av_freep(&VAR_3->new_metadata); VAR_3->new_metadata_size = 0; return VAR_7;
[ "static int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1)\n{", "struct VAR_2 *VAR_2;", "struct ogg_stream *VAR_3;", "int VAR_4, VAR_5;", "int VAR_6, VAR_7;", "int64_t fpos, pts, dts;", "if (VAR_0->io_repositioned) {", "ogg_reset(VAR_0);", "VAR_0->io_repositioned = 0;", "retry:\ndo {", "VAR_5 = ogg_packet(VAR_0, &VAR_4, &VAR_6, &VAR_7, &fpos);", "if (VAR_5 < 0)\nreturn VAR_5;", "} while (VAR_4 < 0 || !VAR_0->streams[VAR_4]);", "VAR_2 = VAR_0->priv_data;", "VAR_3 = VAR_2->streams + VAR_4;", "pts = ogg_calc_pts(VAR_0, VAR_4, &dts);", "ogg_validate_keyframe(VAR_0, VAR_4, VAR_6, VAR_7);", "if (VAR_3->keyframe_seek && !(VAR_3->pflags & AV_PKT_FLAG_KEY))\ngoto retry;", "VAR_3->keyframe_seek = 0;", "VAR_5 = av_new_packet(VAR_1, VAR_7);", "if (VAR_5 < 0)\nreturn VAR_5;", "VAR_1->stream_index = VAR_4;", "memcpy(VAR_1->data, VAR_3->buf + VAR_6, VAR_7);", "VAR_1->pts = pts;", "VAR_1->dts = dts;", "VAR_1->flags = VAR_3->pflags;", "VAR_1->duration = VAR_3->pduration;", "VAR_1->pos = fpos;", "if (VAR_3->end_trimming) {", "uint8_t *side_data = av_packet_new_side_data(VAR_1,\nAV_PKT_DATA_SKIP_SAMPLES,\n10);", "AV_WL32(side_data + 4, VAR_3->end_trimming);", "VAR_3->end_trimming = 0;", "if (VAR_3->new_metadata) {", "uint8_t *side_data = av_packet_new_side_data(VAR_1,\nAV_PKT_DATA_METADATA_UPDATE,\nVAR_3->new_metadata_size);", "memcpy(side_data, VAR_3->new_metadata, VAR_3->new_metadata_size);", "av_freep(&VAR_3->new_metadata);", "VAR_3->new_metadata_size = 0;", "return VAR_7;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 28, 30 ], [ 32 ], [ 34, 36 ], [ 38 ], [ 42 ], [ 44 ], [ 50 ], [ 52 ], [ 56, 58 ], [ 60 ], [ 66 ], [ 68, 70 ], [ 72 ], [ 74 ], [ 78 ], [ 80 ], [ 82 ], [ 84 ], [ 86 ], [ 90 ], [ 92, 94, 96 ], [ 103 ], [ 105 ], [ 110 ], [ 112, 114, 116 ], [ 123 ], [ 125 ], [ 127 ], [ 132 ] ]
18,836
static void slirp_cleanup(void) { WSACleanup(); }
true
qemu
df46189412567906312684eb72ba87c6a86a4cdb
static void slirp_cleanup(void) { WSACleanup(); }
{ "code": [ "static void slirp_cleanup(void)", " WSACleanup();" ], "line_no": [ 1, 5 ] }
static void FUNC_0(void) { WSACleanup(); }
[ "static void FUNC_0(void)\n{", "WSACleanup();", "}" ]
[ 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
18,837
static int read_sl_header(PESContext *pes, SLConfigDescr *sl, const uint8_t *buf, int buf_size) { GetBitContext gb; int au_start_flag = 0, au_end_flag = 0, ocr_flag = 0, idle_flag = 0; int padding_flag = 0, padding_bits = 0, inst_bitrate_flag = 0; int dts_flag = -1, cts_flag = -1; int64_t dts = AV_NOPTS_VALUE, cts = AV_NOPTS_VALUE; init_get_bits(&gb, buf, buf_size * 8); if (sl->use_au_start) au_start_flag = get_bits1(&gb); if (sl->use_au_end) au_end_flag = get_bits1(&gb); if (!sl->use_au_start && !sl->use_au_end) au_start_flag = au_end_flag = 1; if (sl->ocr_len > 0) ocr_flag = get_bits1(&gb); if (sl->use_idle) idle_flag = get_bits1(&gb); if (sl->use_padding) padding_flag = get_bits1(&gb); if (padding_flag) padding_bits = get_bits(&gb, 3); if (!idle_flag && (!padding_flag || padding_bits != 0)) { if (sl->packet_seq_num_len) skip_bits_long(&gb, sl->packet_seq_num_len); if (sl->degr_prior_len) if (get_bits1(&gb)) skip_bits(&gb, sl->degr_prior_len); if (ocr_flag) skip_bits_long(&gb, sl->ocr_len); if (au_start_flag) { if (sl->use_rand_acc_pt) get_bits1(&gb); if (sl->au_seq_num_len > 0) skip_bits_long(&gb, sl->au_seq_num_len); if (sl->use_timestamps) { dts_flag = get_bits1(&gb); cts_flag = get_bits1(&gb); } } if (sl->inst_bitrate_len) inst_bitrate_flag = get_bits1(&gb); if (dts_flag == 1) dts = get_ts64(&gb, sl->timestamp_len); if (cts_flag == 1) cts = get_ts64(&gb, sl->timestamp_len); if (sl->au_len > 0) skip_bits_long(&gb, sl->au_len); if (inst_bitrate_flag) skip_bits_long(&gb, sl->inst_bitrate_len); } if (dts != AV_NOPTS_VALUE) pes->dts = dts; if (cts != AV_NOPTS_VALUE) pes->pts = cts; if (sl->timestamp_len && sl->timestamp_res) avpriv_set_pts_info(pes->st, sl->timestamp_len, 1, sl->timestamp_res); return (get_bits_count(&gb) + 7) >> 3; }
true
FFmpeg
27f6da292118850ca7900de64d06b56e0ebb5070
static int read_sl_header(PESContext *pes, SLConfigDescr *sl, const uint8_t *buf, int buf_size) { GetBitContext gb; int au_start_flag = 0, au_end_flag = 0, ocr_flag = 0, idle_flag = 0; int padding_flag = 0, padding_bits = 0, inst_bitrate_flag = 0; int dts_flag = -1, cts_flag = -1; int64_t dts = AV_NOPTS_VALUE, cts = AV_NOPTS_VALUE; init_get_bits(&gb, buf, buf_size * 8); if (sl->use_au_start) au_start_flag = get_bits1(&gb); if (sl->use_au_end) au_end_flag = get_bits1(&gb); if (!sl->use_au_start && !sl->use_au_end) au_start_flag = au_end_flag = 1; if (sl->ocr_len > 0) ocr_flag = get_bits1(&gb); if (sl->use_idle) idle_flag = get_bits1(&gb); if (sl->use_padding) padding_flag = get_bits1(&gb); if (padding_flag) padding_bits = get_bits(&gb, 3); if (!idle_flag && (!padding_flag || padding_bits != 0)) { if (sl->packet_seq_num_len) skip_bits_long(&gb, sl->packet_seq_num_len); if (sl->degr_prior_len) if (get_bits1(&gb)) skip_bits(&gb, sl->degr_prior_len); if (ocr_flag) skip_bits_long(&gb, sl->ocr_len); if (au_start_flag) { if (sl->use_rand_acc_pt) get_bits1(&gb); if (sl->au_seq_num_len > 0) skip_bits_long(&gb, sl->au_seq_num_len); if (sl->use_timestamps) { dts_flag = get_bits1(&gb); cts_flag = get_bits1(&gb); } } if (sl->inst_bitrate_len) inst_bitrate_flag = get_bits1(&gb); if (dts_flag == 1) dts = get_ts64(&gb, sl->timestamp_len); if (cts_flag == 1) cts = get_ts64(&gb, sl->timestamp_len); if (sl->au_len > 0) skip_bits_long(&gb, sl->au_len); if (inst_bitrate_flag) skip_bits_long(&gb, sl->inst_bitrate_len); } if (dts != AV_NOPTS_VALUE) pes->dts = dts; if (cts != AV_NOPTS_VALUE) pes->pts = cts; if (sl->timestamp_len && sl->timestamp_res) avpriv_set_pts_info(pes->st, sl->timestamp_len, 1, sl->timestamp_res); return (get_bits_count(&gb) + 7) >> 3; }
{ "code": [ " init_get_bits(&gb, buf, buf_size * 8);" ], "line_no": [ 19 ] }
static int FUNC_0(PESContext *VAR_0, SLConfigDescr *VAR_1, const uint8_t *VAR_2, int VAR_3) { GetBitContext gb; int VAR_4 = 0, VAR_5 = 0, VAR_6 = 0, VAR_7 = 0; int VAR_8 = 0, VAR_9 = 0, VAR_10 = 0; int VAR_11 = -1, VAR_12 = -1; int64_t dts = AV_NOPTS_VALUE, cts = AV_NOPTS_VALUE; init_get_bits(&gb, VAR_2, VAR_3 * 8); if (VAR_1->use_au_start) VAR_4 = get_bits1(&gb); if (VAR_1->use_au_end) VAR_5 = get_bits1(&gb); if (!VAR_1->use_au_start && !VAR_1->use_au_end) VAR_4 = VAR_5 = 1; if (VAR_1->ocr_len > 0) VAR_6 = get_bits1(&gb); if (VAR_1->use_idle) VAR_7 = get_bits1(&gb); if (VAR_1->use_padding) VAR_8 = get_bits1(&gb); if (VAR_8) VAR_9 = get_bits(&gb, 3); if (!VAR_7 && (!VAR_8 || VAR_9 != 0)) { if (VAR_1->packet_seq_num_len) skip_bits_long(&gb, VAR_1->packet_seq_num_len); if (VAR_1->degr_prior_len) if (get_bits1(&gb)) skip_bits(&gb, VAR_1->degr_prior_len); if (VAR_6) skip_bits_long(&gb, VAR_1->ocr_len); if (VAR_4) { if (VAR_1->use_rand_acc_pt) get_bits1(&gb); if (VAR_1->au_seq_num_len > 0) skip_bits_long(&gb, VAR_1->au_seq_num_len); if (VAR_1->use_timestamps) { VAR_11 = get_bits1(&gb); VAR_12 = get_bits1(&gb); } } if (VAR_1->inst_bitrate_len) VAR_10 = get_bits1(&gb); if (VAR_11 == 1) dts = get_ts64(&gb, VAR_1->timestamp_len); if (VAR_12 == 1) cts = get_ts64(&gb, VAR_1->timestamp_len); if (VAR_1->au_len > 0) skip_bits_long(&gb, VAR_1->au_len); if (VAR_10) skip_bits_long(&gb, VAR_1->inst_bitrate_len); } if (dts != AV_NOPTS_VALUE) VAR_0->dts = dts; if (cts != AV_NOPTS_VALUE) VAR_0->pts = cts; if (VAR_1->timestamp_len && VAR_1->timestamp_res) avpriv_set_pts_info(VAR_0->st, VAR_1->timestamp_len, 1, VAR_1->timestamp_res); return (get_bits_count(&gb) + 7) >> 3; }
[ "static int FUNC_0(PESContext *VAR_0, SLConfigDescr *VAR_1,\nconst uint8_t *VAR_2, int VAR_3)\n{", "GetBitContext gb;", "int VAR_4 = 0, VAR_5 = 0, VAR_6 = 0, VAR_7 = 0;", "int VAR_8 = 0, VAR_9 = 0, VAR_10 = 0;", "int VAR_11 = -1, VAR_12 = -1;", "int64_t dts = AV_NOPTS_VALUE, cts = AV_NOPTS_VALUE;", "init_get_bits(&gb, VAR_2, VAR_3 * 8);", "if (VAR_1->use_au_start)\nVAR_4 = get_bits1(&gb);", "if (VAR_1->use_au_end)\nVAR_5 = get_bits1(&gb);", "if (!VAR_1->use_au_start && !VAR_1->use_au_end)\nVAR_4 = VAR_5 = 1;", "if (VAR_1->ocr_len > 0)\nVAR_6 = get_bits1(&gb);", "if (VAR_1->use_idle)\nVAR_7 = get_bits1(&gb);", "if (VAR_1->use_padding)\nVAR_8 = get_bits1(&gb);", "if (VAR_8)\nVAR_9 = get_bits(&gb, 3);", "if (!VAR_7 && (!VAR_8 || VAR_9 != 0)) {", "if (VAR_1->packet_seq_num_len)\nskip_bits_long(&gb, VAR_1->packet_seq_num_len);", "if (VAR_1->degr_prior_len)\nif (get_bits1(&gb))\nskip_bits(&gb, VAR_1->degr_prior_len);", "if (VAR_6)\nskip_bits_long(&gb, VAR_1->ocr_len);", "if (VAR_4) {", "if (VAR_1->use_rand_acc_pt)\nget_bits1(&gb);", "if (VAR_1->au_seq_num_len > 0)\nskip_bits_long(&gb, VAR_1->au_seq_num_len);", "if (VAR_1->use_timestamps) {", "VAR_11 = get_bits1(&gb);", "VAR_12 = get_bits1(&gb);", "}", "}", "if (VAR_1->inst_bitrate_len)\nVAR_10 = get_bits1(&gb);", "if (VAR_11 == 1)\ndts = get_ts64(&gb, VAR_1->timestamp_len);", "if (VAR_12 == 1)\ncts = get_ts64(&gb, VAR_1->timestamp_len);", "if (VAR_1->au_len > 0)\nskip_bits_long(&gb, VAR_1->au_len);", "if (VAR_10)\nskip_bits_long(&gb, VAR_1->inst_bitrate_len);", "}", "if (dts != AV_NOPTS_VALUE)\nVAR_0->dts = dts;", "if (cts != AV_NOPTS_VALUE)\nVAR_0->pts = cts;", "if (VAR_1->timestamp_len && VAR_1->timestamp_res)\navpriv_set_pts_info(VAR_0->st, VAR_1->timestamp_len, 1, VAR_1->timestamp_res);", "return (get_bits_count(&gb) + 7) >> 3;", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 23, 25 ], [ 27, 29 ], [ 31, 33 ], [ 35, 37 ], [ 39, 41 ], [ 43, 45 ], [ 47, 49 ], [ 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 ], [ 113, 115 ], [ 117, 119 ], [ 123, 125 ], [ 129 ], [ 131 ] ]
18,839
static int decode_nal_unit(HEVCContext *s, const H2645NAL *nal) { HEVCLocalContext *lc = s->HEVClc; GetBitContext *gb = &lc->gb; int ctb_addr_ts, ret; *gb = nal->gb; s->nal_unit_type = nal->type; s->temporal_id = nal->temporal_id; switch (s->nal_unit_type) { case HEVC_NAL_VPS: ret = ff_hevc_decode_nal_vps(gb, s->avctx, &s->ps); if (ret < 0) goto fail; break; case HEVC_NAL_SPS: ret = ff_hevc_decode_nal_sps(gb, s->avctx, &s->ps, s->apply_defdispwin); if (ret < 0) goto fail; break; case HEVC_NAL_PPS: ret = ff_hevc_decode_nal_pps(gb, s->avctx, &s->ps); if (ret < 0) goto fail; break; case HEVC_NAL_SEI_PREFIX: case HEVC_NAL_SEI_SUFFIX: ret = ff_hevc_decode_nal_sei(s); if (ret < 0) goto fail; break; case HEVC_NAL_TRAIL_R: case HEVC_NAL_TRAIL_N: case HEVC_NAL_TSA_N: case HEVC_NAL_TSA_R: case HEVC_NAL_STSA_N: case HEVC_NAL_STSA_R: case HEVC_NAL_BLA_W_LP: case HEVC_NAL_BLA_W_RADL: case HEVC_NAL_BLA_N_LP: case HEVC_NAL_IDR_W_RADL: case HEVC_NAL_IDR_N_LP: case HEVC_NAL_CRA_NUT: case HEVC_NAL_RADL_N: case HEVC_NAL_RADL_R: case HEVC_NAL_RASL_N: case HEVC_NAL_RASL_R: ret = hls_slice_header(s); if (ret < 0) return ret; if (s->max_ra == INT_MAX) { if (s->nal_unit_type == HEVC_NAL_CRA_NUT || IS_BLA(s)) { s->max_ra = s->poc; } else { if (IS_IDR(s)) s->max_ra = INT_MIN; } } if ((s->nal_unit_type == HEVC_NAL_RASL_R || s->nal_unit_type == HEVC_NAL_RASL_N) && s->poc <= s->max_ra) { s->is_decoded = 0; break; } else { if (s->nal_unit_type == HEVC_NAL_RASL_R && s->poc > s->max_ra) s->max_ra = INT_MIN; } if (s->sh.first_slice_in_pic_flag) { ret = hevc_frame_start(s); if (ret < 0) return ret; } else if (!s->ref) { av_log(s->avctx, AV_LOG_ERROR, "First slice in a frame missing.\n"); goto fail; } if (s->nal_unit_type != s->first_nal_type) { av_log(s->avctx, AV_LOG_ERROR, "Non-matching NAL types of the VCL NALUs: %d %d\n", s->first_nal_type, s->nal_unit_type); return AVERROR_INVALIDDATA; } if (!s->sh.dependent_slice_segment_flag && s->sh.slice_type != HEVC_SLICE_I) { ret = ff_hevc_slice_rpl(s); if (ret < 0) { av_log(s->avctx, AV_LOG_WARNING, "Error constructing the reference lists for the current slice.\n"); goto fail; } } if (s->sh.first_slice_in_pic_flag && s->avctx->hwaccel) { ret = s->avctx->hwaccel->start_frame(s->avctx, NULL, 0); if (ret < 0) goto fail; } if (s->avctx->hwaccel) { ret = s->avctx->hwaccel->decode_slice(s->avctx, nal->raw_data, nal->raw_size); if (ret < 0) goto fail; } else { if (s->threads_number > 1 && s->sh.num_entry_point_offsets > 0) ctb_addr_ts = hls_slice_data_wpp(s, nal); else ctb_addr_ts = hls_slice_data(s); if (ctb_addr_ts >= (s->ps.sps->ctb_width * s->ps.sps->ctb_height)) { s->is_decoded = 1; } if (ctb_addr_ts < 0) { ret = ctb_addr_ts; goto fail; } } break; case HEVC_NAL_EOS_NUT: case HEVC_NAL_EOB_NUT: s->seq_decode = (s->seq_decode + 1) & 0xff; s->max_ra = INT_MAX; break; case HEVC_NAL_AUD: case HEVC_NAL_FD_NUT: break; default: av_log(s->avctx, AV_LOG_INFO, "Skipping NAL unit %d\n", s->nal_unit_type); } return 0; fail: if (s->avctx->err_recognition & AV_EF_EXPLODE) return ret; return 0; }
true
FFmpeg
1f50baa2b2da7fdbfccf0662883f38a763ff6619
static int decode_nal_unit(HEVCContext *s, const H2645NAL *nal) { HEVCLocalContext *lc = s->HEVClc; GetBitContext *gb = &lc->gb; int ctb_addr_ts, ret; *gb = nal->gb; s->nal_unit_type = nal->type; s->temporal_id = nal->temporal_id; switch (s->nal_unit_type) { case HEVC_NAL_VPS: ret = ff_hevc_decode_nal_vps(gb, s->avctx, &s->ps); if (ret < 0) goto fail; break; case HEVC_NAL_SPS: ret = ff_hevc_decode_nal_sps(gb, s->avctx, &s->ps, s->apply_defdispwin); if (ret < 0) goto fail; break; case HEVC_NAL_PPS: ret = ff_hevc_decode_nal_pps(gb, s->avctx, &s->ps); if (ret < 0) goto fail; break; case HEVC_NAL_SEI_PREFIX: case HEVC_NAL_SEI_SUFFIX: ret = ff_hevc_decode_nal_sei(s); if (ret < 0) goto fail; break; case HEVC_NAL_TRAIL_R: case HEVC_NAL_TRAIL_N: case HEVC_NAL_TSA_N: case HEVC_NAL_TSA_R: case HEVC_NAL_STSA_N: case HEVC_NAL_STSA_R: case HEVC_NAL_BLA_W_LP: case HEVC_NAL_BLA_W_RADL: case HEVC_NAL_BLA_N_LP: case HEVC_NAL_IDR_W_RADL: case HEVC_NAL_IDR_N_LP: case HEVC_NAL_CRA_NUT: case HEVC_NAL_RADL_N: case HEVC_NAL_RADL_R: case HEVC_NAL_RASL_N: case HEVC_NAL_RASL_R: ret = hls_slice_header(s); if (ret < 0) return ret; if (s->max_ra == INT_MAX) { if (s->nal_unit_type == HEVC_NAL_CRA_NUT || IS_BLA(s)) { s->max_ra = s->poc; } else { if (IS_IDR(s)) s->max_ra = INT_MIN; } } if ((s->nal_unit_type == HEVC_NAL_RASL_R || s->nal_unit_type == HEVC_NAL_RASL_N) && s->poc <= s->max_ra) { s->is_decoded = 0; break; } else { if (s->nal_unit_type == HEVC_NAL_RASL_R && s->poc > s->max_ra) s->max_ra = INT_MIN; } if (s->sh.first_slice_in_pic_flag) { ret = hevc_frame_start(s); if (ret < 0) return ret; } else if (!s->ref) { av_log(s->avctx, AV_LOG_ERROR, "First slice in a frame missing.\n"); goto fail; } if (s->nal_unit_type != s->first_nal_type) { av_log(s->avctx, AV_LOG_ERROR, "Non-matching NAL types of the VCL NALUs: %d %d\n", s->first_nal_type, s->nal_unit_type); return AVERROR_INVALIDDATA; } if (!s->sh.dependent_slice_segment_flag && s->sh.slice_type != HEVC_SLICE_I) { ret = ff_hevc_slice_rpl(s); if (ret < 0) { av_log(s->avctx, AV_LOG_WARNING, "Error constructing the reference lists for the current slice.\n"); goto fail; } } if (s->sh.first_slice_in_pic_flag && s->avctx->hwaccel) { ret = s->avctx->hwaccel->start_frame(s->avctx, NULL, 0); if (ret < 0) goto fail; } if (s->avctx->hwaccel) { ret = s->avctx->hwaccel->decode_slice(s->avctx, nal->raw_data, nal->raw_size); if (ret < 0) goto fail; } else { if (s->threads_number > 1 && s->sh.num_entry_point_offsets > 0) ctb_addr_ts = hls_slice_data_wpp(s, nal); else ctb_addr_ts = hls_slice_data(s); if (ctb_addr_ts >= (s->ps.sps->ctb_width * s->ps.sps->ctb_height)) { s->is_decoded = 1; } if (ctb_addr_ts < 0) { ret = ctb_addr_ts; goto fail; } } break; case HEVC_NAL_EOS_NUT: case HEVC_NAL_EOB_NUT: s->seq_decode = (s->seq_decode + 1) & 0xff; s->max_ra = INT_MAX; break; case HEVC_NAL_AUD: case HEVC_NAL_FD_NUT: break; default: av_log(s->avctx, AV_LOG_INFO, "Skipping NAL unit %d\n", s->nal_unit_type); } return 0; fail: if (s->avctx->err_recognition & AV_EF_EXPLODE) return ret; return 0; }
{ "code": [ " if (s->max_ra == INT_MAX) {", " if (s->nal_unit_type == HEVC_NAL_CRA_NUT || IS_BLA(s)) {", " s->max_ra = s->poc;", " if (IS_IDR(s))", " if ((s->nal_unit_type == HEVC_NAL_RASL_R || s->nal_unit_type == HEVC_NAL_RASL_N) &&", " s->poc <= s->max_ra) {", " s->is_decoded = 0;", " break;", " } else {", " if (s->nal_unit_type == HEVC_NAL_RASL_R && s->poc > s->max_ra)", " s->max_ra = INT_MIN;", " if (s->sh.first_slice_in_pic_flag) {" ], "line_no": [ 107, 109, 111, 115, 125, 127, 129, 131, 133, 135, 137, 143 ] }
static int FUNC_0(HEVCContext *VAR_0, const H2645NAL *VAR_1) { HEVCLocalContext *lc = VAR_0->HEVClc; GetBitContext *gb = &lc->gb; int VAR_2, VAR_3; *gb = VAR_1->gb; VAR_0->nal_unit_type = VAR_1->type; VAR_0->temporal_id = VAR_1->temporal_id; switch (VAR_0->nal_unit_type) { case HEVC_NAL_VPS: VAR_3 = ff_hevc_decode_nal_vps(gb, VAR_0->avctx, &VAR_0->ps); if (VAR_3 < 0) goto fail; break; case HEVC_NAL_SPS: VAR_3 = ff_hevc_decode_nal_sps(gb, VAR_0->avctx, &VAR_0->ps, VAR_0->apply_defdispwin); if (VAR_3 < 0) goto fail; break; case HEVC_NAL_PPS: VAR_3 = ff_hevc_decode_nal_pps(gb, VAR_0->avctx, &VAR_0->ps); if (VAR_3 < 0) goto fail; break; case HEVC_NAL_SEI_PREFIX: case HEVC_NAL_SEI_SUFFIX: VAR_3 = ff_hevc_decode_nal_sei(VAR_0); if (VAR_3 < 0) goto fail; break; case HEVC_NAL_TRAIL_R: case HEVC_NAL_TRAIL_N: case HEVC_NAL_TSA_N: case HEVC_NAL_TSA_R: case HEVC_NAL_STSA_N: case HEVC_NAL_STSA_R: case HEVC_NAL_BLA_W_LP: case HEVC_NAL_BLA_W_RADL: case HEVC_NAL_BLA_N_LP: case HEVC_NAL_IDR_W_RADL: case HEVC_NAL_IDR_N_LP: case HEVC_NAL_CRA_NUT: case HEVC_NAL_RADL_N: case HEVC_NAL_RADL_R: case HEVC_NAL_RASL_N: case HEVC_NAL_RASL_R: VAR_3 = hls_slice_header(VAR_0); if (VAR_3 < 0) return VAR_3; if (VAR_0->max_ra == INT_MAX) { if (VAR_0->nal_unit_type == HEVC_NAL_CRA_NUT || IS_BLA(VAR_0)) { VAR_0->max_ra = VAR_0->poc; } else { if (IS_IDR(VAR_0)) VAR_0->max_ra = INT_MIN; } } if ((VAR_0->nal_unit_type == HEVC_NAL_RASL_R || VAR_0->nal_unit_type == HEVC_NAL_RASL_N) && VAR_0->poc <= VAR_0->max_ra) { VAR_0->is_decoded = 0; break; } else { if (VAR_0->nal_unit_type == HEVC_NAL_RASL_R && VAR_0->poc > VAR_0->max_ra) VAR_0->max_ra = INT_MIN; } if (VAR_0->sh.first_slice_in_pic_flag) { VAR_3 = hevc_frame_start(VAR_0); if (VAR_3 < 0) return VAR_3; } else if (!VAR_0->ref) { av_log(VAR_0->avctx, AV_LOG_ERROR, "First slice in a frame missing.\n"); goto fail; } if (VAR_0->nal_unit_type != VAR_0->first_nal_type) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Non-matching NAL types of the VCL NALUs: %d %d\n", VAR_0->first_nal_type, VAR_0->nal_unit_type); return AVERROR_INVALIDDATA; } if (!VAR_0->sh.dependent_slice_segment_flag && VAR_0->sh.slice_type != HEVC_SLICE_I) { VAR_3 = ff_hevc_slice_rpl(VAR_0); if (VAR_3 < 0) { av_log(VAR_0->avctx, AV_LOG_WARNING, "Error constructing the reference lists for the current slice.\n"); goto fail; } } if (VAR_0->sh.first_slice_in_pic_flag && VAR_0->avctx->hwaccel) { VAR_3 = VAR_0->avctx->hwaccel->start_frame(VAR_0->avctx, NULL, 0); if (VAR_3 < 0) goto fail; } if (VAR_0->avctx->hwaccel) { VAR_3 = VAR_0->avctx->hwaccel->decode_slice(VAR_0->avctx, VAR_1->raw_data, VAR_1->raw_size); if (VAR_3 < 0) goto fail; } else { if (VAR_0->threads_number > 1 && VAR_0->sh.num_entry_point_offsets > 0) VAR_2 = hls_slice_data_wpp(VAR_0, VAR_1); else VAR_2 = hls_slice_data(VAR_0); if (VAR_2 >= (VAR_0->ps.sps->ctb_width * VAR_0->ps.sps->ctb_height)) { VAR_0->is_decoded = 1; } if (VAR_2 < 0) { VAR_3 = VAR_2; goto fail; } } break; case HEVC_NAL_EOS_NUT: case HEVC_NAL_EOB_NUT: VAR_0->seq_decode = (VAR_0->seq_decode + 1) & 0xff; VAR_0->max_ra = INT_MAX; break; case HEVC_NAL_AUD: case HEVC_NAL_FD_NUT: break; default: av_log(VAR_0->avctx, AV_LOG_INFO, "Skipping NAL unit %d\n", VAR_0->nal_unit_type); } return 0; fail: if (VAR_0->avctx->err_recognition & AV_EF_EXPLODE) return VAR_3; return 0; }
[ "static int FUNC_0(HEVCContext *VAR_0, const H2645NAL *VAR_1)\n{", "HEVCLocalContext *lc = VAR_0->HEVClc;", "GetBitContext *gb = &lc->gb;", "int VAR_2, VAR_3;", "*gb = VAR_1->gb;", "VAR_0->nal_unit_type = VAR_1->type;", "VAR_0->temporal_id = VAR_1->temporal_id;", "switch (VAR_0->nal_unit_type) {", "case HEVC_NAL_VPS:\nVAR_3 = ff_hevc_decode_nal_vps(gb, VAR_0->avctx, &VAR_0->ps);", "if (VAR_3 < 0)\ngoto fail;", "break;", "case HEVC_NAL_SPS:\nVAR_3 = ff_hevc_decode_nal_sps(gb, VAR_0->avctx, &VAR_0->ps,\nVAR_0->apply_defdispwin);", "if (VAR_3 < 0)\ngoto fail;", "break;", "case HEVC_NAL_PPS:\nVAR_3 = ff_hevc_decode_nal_pps(gb, VAR_0->avctx, &VAR_0->ps);", "if (VAR_3 < 0)\ngoto fail;", "break;", "case HEVC_NAL_SEI_PREFIX:\ncase HEVC_NAL_SEI_SUFFIX:\nVAR_3 = ff_hevc_decode_nal_sei(VAR_0);", "if (VAR_3 < 0)\ngoto fail;", "break;", "case HEVC_NAL_TRAIL_R:\ncase HEVC_NAL_TRAIL_N:\ncase HEVC_NAL_TSA_N:\ncase HEVC_NAL_TSA_R:\ncase HEVC_NAL_STSA_N:\ncase HEVC_NAL_STSA_R:\ncase HEVC_NAL_BLA_W_LP:\ncase HEVC_NAL_BLA_W_RADL:\ncase HEVC_NAL_BLA_N_LP:\ncase HEVC_NAL_IDR_W_RADL:\ncase HEVC_NAL_IDR_N_LP:\ncase HEVC_NAL_CRA_NUT:\ncase HEVC_NAL_RADL_N:\ncase HEVC_NAL_RADL_R:\ncase HEVC_NAL_RASL_N:\ncase HEVC_NAL_RASL_R:\nVAR_3 = hls_slice_header(VAR_0);", "if (VAR_3 < 0)\nreturn VAR_3;", "if (VAR_0->max_ra == INT_MAX) {", "if (VAR_0->nal_unit_type == HEVC_NAL_CRA_NUT || IS_BLA(VAR_0)) {", "VAR_0->max_ra = VAR_0->poc;", "} else {", "if (IS_IDR(VAR_0))\nVAR_0->max_ra = INT_MIN;", "}", "}", "if ((VAR_0->nal_unit_type == HEVC_NAL_RASL_R || VAR_0->nal_unit_type == HEVC_NAL_RASL_N) &&\nVAR_0->poc <= VAR_0->max_ra) {", "VAR_0->is_decoded = 0;", "break;", "} else {", "if (VAR_0->nal_unit_type == HEVC_NAL_RASL_R && VAR_0->poc > VAR_0->max_ra)\nVAR_0->max_ra = INT_MIN;", "}", "if (VAR_0->sh.first_slice_in_pic_flag) {", "VAR_3 = hevc_frame_start(VAR_0);", "if (VAR_3 < 0)\nreturn VAR_3;", "} else if (!VAR_0->ref) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"First slice in a frame missing.\\n\");", "goto fail;", "}", "if (VAR_0->nal_unit_type != VAR_0->first_nal_type) {", "av_log(VAR_0->avctx, AV_LOG_ERROR,\n\"Non-matching NAL types of the VCL NALUs: %d %d\\n\",\nVAR_0->first_nal_type, VAR_0->nal_unit_type);", "return AVERROR_INVALIDDATA;", "}", "if (!VAR_0->sh.dependent_slice_segment_flag &&\nVAR_0->sh.slice_type != HEVC_SLICE_I) {", "VAR_3 = ff_hevc_slice_rpl(VAR_0);", "if (VAR_3 < 0) {", "av_log(VAR_0->avctx, AV_LOG_WARNING,\n\"Error constructing the reference lists for the current slice.\\n\");", "goto fail;", "}", "}", "if (VAR_0->sh.first_slice_in_pic_flag && VAR_0->avctx->hwaccel) {", "VAR_3 = VAR_0->avctx->hwaccel->start_frame(VAR_0->avctx, NULL, 0);", "if (VAR_3 < 0)\ngoto fail;", "}", "if (VAR_0->avctx->hwaccel) {", "VAR_3 = VAR_0->avctx->hwaccel->decode_slice(VAR_0->avctx, VAR_1->raw_data, VAR_1->raw_size);", "if (VAR_3 < 0)\ngoto fail;", "} else {", "if (VAR_0->threads_number > 1 && VAR_0->sh.num_entry_point_offsets > 0)\nVAR_2 = hls_slice_data_wpp(VAR_0, VAR_1);", "else\nVAR_2 = hls_slice_data(VAR_0);", "if (VAR_2 >= (VAR_0->ps.sps->ctb_width * VAR_0->ps.sps->ctb_height)) {", "VAR_0->is_decoded = 1;", "}", "if (VAR_2 < 0) {", "VAR_3 = VAR_2;", "goto fail;", "}", "}", "break;", "case HEVC_NAL_EOS_NUT:\ncase HEVC_NAL_EOB_NUT:\nVAR_0->seq_decode = (VAR_0->seq_decode + 1) & 0xff;", "VAR_0->max_ra = INT_MAX;", "break;", "case HEVC_NAL_AUD:\ncase HEVC_NAL_FD_NUT:\nbreak;", "default:\nav_log(VAR_0->avctx, AV_LOG_INFO,\n\"Skipping NAL unit %d\\n\", VAR_0->nal_unit_type);", "}", "return 0;", "fail:\nif (VAR_0->avctx->err_recognition & AV_EF_EXPLODE)\nreturn VAR_3;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 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, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23, 25 ], [ 27, 29 ], [ 31 ], [ 33, 35, 37 ], [ 39, 41 ], [ 43 ], [ 45, 47 ], [ 49, 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 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115, 117 ], [ 119 ], [ 121 ], [ 125, 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135, 137 ], [ 139 ], [ 143 ], [ 145 ], [ 147, 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 161 ], [ 163, 165, 167 ], [ 169 ], [ 171 ], [ 175, 177 ], [ 179 ], [ 181 ], [ 183, 185 ], [ 187 ], [ 189 ], [ 191 ], [ 195 ], [ 197 ], [ 199, 201 ], [ 203 ], [ 207 ], [ 209 ], [ 211, 213 ], [ 215 ], [ 217, 219 ], [ 221, 223 ], [ 225 ], [ 227 ], [ 229 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245, 247, 249 ], [ 251 ], [ 253 ], [ 255, 257, 259 ], [ 261, 263, 265 ], [ 267 ], [ 271 ], [ 273, 275, 277 ], [ 279 ], [ 281 ] ]
18,840
static bool gen_rsr_ccount(DisasContext *dc, TCGv_i32 d, uint32_t sr) { if (dc->tb->cflags & CF_USE_ICOUNT) { gen_io_start(); } gen_helper_update_ccount(cpu_env); tcg_gen_mov_i32(d, cpu_SR[sr]); if (dc->tb->cflags & CF_USE_ICOUNT) { gen_io_end(); return true; } return false; }
true
qemu
c5a49c63fa26e8825ad101dfe86339ae4c216539
static bool gen_rsr_ccount(DisasContext *dc, TCGv_i32 d, uint32_t sr) { if (dc->tb->cflags & CF_USE_ICOUNT) { gen_io_start(); } gen_helper_update_ccount(cpu_env); tcg_gen_mov_i32(d, cpu_SR[sr]); if (dc->tb->cflags & CF_USE_ICOUNT) { gen_io_end(); return true; } return false; }
{ "code": [ " if (dc->tb->cflags & CF_USE_ICOUNT) {", " if (dc->tb->cflags & CF_USE_ICOUNT) {", " if (dc->tb->cflags & CF_USE_ICOUNT) {", " if (dc->tb->cflags & CF_USE_ICOUNT) {", " if (dc->tb->cflags & CF_USE_ICOUNT) {", " if (dc->tb->cflags & CF_USE_ICOUNT) {", " if (dc->tb->cflags & CF_USE_ICOUNT) {", " if (dc->tb->cflags & CF_USE_ICOUNT) {" ], "line_no": [ 5, 5, 5, 5, 5, 5, 5, 5 ] }
static bool FUNC_0(DisasContext *dc, TCGv_i32 d, uint32_t sr) { if (dc->tb->cflags & CF_USE_ICOUNT) { gen_io_start(); } gen_helper_update_ccount(cpu_env); tcg_gen_mov_i32(d, cpu_SR[sr]); if (dc->tb->cflags & CF_USE_ICOUNT) { gen_io_end(); return true; } return false; }
[ "static bool FUNC_0(DisasContext *dc, TCGv_i32 d, uint32_t sr)\n{", "if (dc->tb->cflags & CF_USE_ICOUNT) {", "gen_io_start();", "}", "gen_helper_update_ccount(cpu_env);", "tcg_gen_mov_i32(d, cpu_SR[sr]);", "if (dc->tb->cflags & CF_USE_ICOUNT) {", "gen_io_end();", "return true;", "}", "return false;", "}" ]
[ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ] ]
18,841
static int adpcm_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; ADPCMDecodeContext *c = avctx->priv_data; ADPCMChannelStatus *cs; int n, m, channel, i; short *samples; const uint8_t *src; int st; /* stereo */ int count1, count2; int nb_samples, coded_samples, ret; nb_samples = get_nb_samples(avctx, buf, buf_size, &coded_samples); if (nb_samples <= 0) { av_log(avctx, AV_LOG_ERROR, "invalid number of samples in packet\n"); return AVERROR_INVALIDDATA; } /* get output buffer */ c->frame.nb_samples = nb_samples; if ((ret = avctx->get_buffer(avctx, &c->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } samples = (short *)c->frame.data[0]; /* use coded_samples when applicable */ /* it is always <= nb_samples, so the output buffer will be large enough */ if (coded_samples) { if (coded_samples != nb_samples) av_log(avctx, AV_LOG_WARNING, "mismatch in coded sample count\n"); c->frame.nb_samples = nb_samples = coded_samples; } src = buf; st = avctx->channels == 2 ? 1 : 0; switch(avctx->codec->id) { case CODEC_ID_ADPCM_IMA_QT: /* In QuickTime, IMA is encoded by chunks of 34 bytes (=64 samples). Channel data is interleaved per-chunk. */ for (channel = 0; channel < avctx->channels; channel++) { int16_t predictor; int step_index; cs = &(c->status[channel]); /* (pppppp) (piiiiiii) */ /* Bits 15-7 are the _top_ 9 bits of the 16-bit initial predictor value */ predictor = AV_RB16(src); step_index = predictor & 0x7F; predictor &= 0xFF80; src += 2; if (cs->step_index == step_index) { int diff = (int)predictor - cs->predictor; if (diff < 0) diff = - diff; if (diff > 0x7f) goto update; } else { update: cs->step_index = step_index; cs->predictor = predictor; } if (cs->step_index > 88){ av_log(avctx, AV_LOG_ERROR, "ERROR: step_index = %i\n", cs->step_index); cs->step_index = 88; } samples = (short *)c->frame.data[0] + channel; for (m = 0; m < 32; m++) { *samples = adpcm_ima_qt_expand_nibble(cs, src[0] & 0x0F, 3); samples += avctx->channels; *samples = adpcm_ima_qt_expand_nibble(cs, src[0] >> 4 , 3); samples += avctx->channels; src ++; } } break; case CODEC_ID_ADPCM_IMA_WAV: if (avctx->block_align != 0 && buf_size > avctx->block_align) buf_size = avctx->block_align; for(i=0; i<avctx->channels; i++){ cs = &(c->status[i]); cs->predictor = *samples++ = (int16_t)bytestream_get_le16(&src); cs->step_index = *src++; if (cs->step_index > 88){ av_log(avctx, AV_LOG_ERROR, "ERROR: step_index = %i\n", cs->step_index); cs->step_index = 88; } if (*src++) av_log(avctx, AV_LOG_ERROR, "unused byte should be null but is %d!!\n", src[-1]); /* unused */ } for (n = (nb_samples - 1) / 8; n > 0; n--) { for (i = 0; i < avctx->channels; i++) { cs = &c->status[i]; for (m = 0; m < 4; m++) { uint8_t v = *src++; *samples = adpcm_ima_expand_nibble(cs, v & 0x0F, 3); samples += avctx->channels; *samples = adpcm_ima_expand_nibble(cs, v >> 4 , 3); samples += avctx->channels; } samples -= 8 * avctx->channels - 1; } samples += 7 * avctx->channels; } break; case CODEC_ID_ADPCM_4XM: for (i = 0; i < avctx->channels; i++) c->status[i].predictor= (int16_t)bytestream_get_le16(&src); for (i = 0; i < avctx->channels; i++) { c->status[i].step_index= (int16_t)bytestream_get_le16(&src); c->status[i].step_index = av_clip(c->status[i].step_index, 0, 88); } for (i = 0; i < avctx->channels; i++) { samples = (short *)c->frame.data[0] + i; cs = &c->status[i]; for (n = nb_samples >> 1; n > 0; n--, src++) { uint8_t v = *src; *samples = adpcm_ima_expand_nibble(cs, v & 0x0F, 4); samples += avctx->channels; *samples = adpcm_ima_expand_nibble(cs, v >> 4 , 4); samples += avctx->channels; } } break; case CODEC_ID_ADPCM_MS: { int block_predictor; if (avctx->block_align != 0 && buf_size > avctx->block_align) buf_size = avctx->block_align; block_predictor = av_clip(*src++, 0, 6); c->status[0].coeff1 = ff_adpcm_AdaptCoeff1[block_predictor]; c->status[0].coeff2 = ff_adpcm_AdaptCoeff2[block_predictor]; if (st) { block_predictor = av_clip(*src++, 0, 6); c->status[1].coeff1 = ff_adpcm_AdaptCoeff1[block_predictor]; c->status[1].coeff2 = ff_adpcm_AdaptCoeff2[block_predictor]; } c->status[0].idelta = (int16_t)bytestream_get_le16(&src); if (st){ c->status[1].idelta = (int16_t)bytestream_get_le16(&src); } c->status[0].sample1 = bytestream_get_le16(&src); if (st) c->status[1].sample1 = bytestream_get_le16(&src); c->status[0].sample2 = bytestream_get_le16(&src); if (st) c->status[1].sample2 = bytestream_get_le16(&src); *samples++ = c->status[0].sample2; if (st) *samples++ = c->status[1].sample2; *samples++ = c->status[0].sample1; if (st) *samples++ = c->status[1].sample1; for(n = (nb_samples - 2) >> (1 - st); n > 0; n--, src++) { *samples++ = adpcm_ms_expand_nibble(&c->status[0 ], src[0] >> 4 ); *samples++ = adpcm_ms_expand_nibble(&c->status[st], src[0] & 0x0F); } break; } case CODEC_ID_ADPCM_IMA_DK4: if (avctx->block_align != 0 && buf_size > avctx->block_align) buf_size = avctx->block_align; for (channel = 0; channel < avctx->channels; channel++) { cs = &c->status[channel]; cs->predictor = (int16_t)bytestream_get_le16(&src); cs->step_index = av_clip(*src++, 0, 88); src++; *samples++ = cs->predictor; } for (n = nb_samples >> (1 - st); n > 0; n--, src++) { uint8_t v = *src; *samples++ = adpcm_ima_expand_nibble(&c->status[0 ], v >> 4 , 3); *samples++ = adpcm_ima_expand_nibble(&c->status[st], v & 0x0F, 3); } break; case CODEC_ID_ADPCM_IMA_DK3: { unsigned char last_byte = 0; unsigned char nibble; int decode_top_nibble_next = 0; int end_of_packet = 0; int diff_channel; if (avctx->block_align != 0 && buf_size > avctx->block_align) buf_size = avctx->block_align; c->status[0].predictor = (int16_t)AV_RL16(src + 10); c->status[1].predictor = (int16_t)AV_RL16(src + 12); c->status[0].step_index = av_clip(src[14], 0, 88); c->status[1].step_index = av_clip(src[15], 0, 88); /* sign extend the predictors */ src += 16; diff_channel = c->status[1].predictor; /* the DK3_GET_NEXT_NIBBLE macro issues the break statement when * the buffer is consumed */ while (1) { /* for this algorithm, c->status[0] is the sum channel and * c->status[1] is the diff channel */ /* process the first predictor of the sum channel */ DK3_GET_NEXT_NIBBLE(); adpcm_ima_expand_nibble(&c->status[0], nibble, 3); /* process the diff channel predictor */ DK3_GET_NEXT_NIBBLE(); adpcm_ima_expand_nibble(&c->status[1], nibble, 3); /* process the first pair of stereo PCM samples */ diff_channel = (diff_channel + c->status[1].predictor) / 2; *samples++ = c->status[0].predictor + c->status[1].predictor; *samples++ = c->status[0].predictor - c->status[1].predictor; /* process the second predictor of the sum channel */ DK3_GET_NEXT_NIBBLE(); adpcm_ima_expand_nibble(&c->status[0], nibble, 3); /* process the second pair of stereo PCM samples */ diff_channel = (diff_channel + c->status[1].predictor) / 2; *samples++ = c->status[0].predictor + c->status[1].predictor; *samples++ = c->status[0].predictor - c->status[1].predictor; } break; } case CODEC_ID_ADPCM_IMA_ISS: for (channel = 0; channel < avctx->channels; channel++) { cs = &c->status[channel]; cs->predictor = (int16_t)bytestream_get_le16(&src); cs->step_index = av_clip(*src++, 0, 88); src++; } for (n = nb_samples >> (1 - st); n > 0; n--, src++) { uint8_t v1, v2; uint8_t v = *src; /* nibbles are swapped for mono */ if (st) { v1 = v >> 4; v2 = v & 0x0F; } else { v2 = v >> 4; v1 = v & 0x0F; } *samples++ = adpcm_ima_expand_nibble(&c->status[0 ], v1, 3); *samples++ = adpcm_ima_expand_nibble(&c->status[st], v2, 3); } break; case CODEC_ID_ADPCM_IMA_APC: while (src < buf + buf_size) { uint8_t v = *src++; *samples++ = adpcm_ima_expand_nibble(&c->status[0], v >> 4 , 3); *samples++ = adpcm_ima_expand_nibble(&c->status[st], v & 0x0F, 3); } break; case CODEC_ID_ADPCM_IMA_WS: for (channel = 0; channel < avctx->channels; channel++) { const uint8_t *src0; int src_stride; int16_t *smp = samples + channel; if (c->vqa_version == 3) { src0 = src + channel * buf_size / 2; src_stride = 1; } else { src0 = src + channel; src_stride = avctx->channels; } for (n = nb_samples / 2; n > 0; n--) { uint8_t v = *src0; src0 += src_stride; *smp = adpcm_ima_expand_nibble(&c->status[channel], v >> 4 , 3); smp += avctx->channels; *smp = adpcm_ima_expand_nibble(&c->status[channel], v & 0x0F, 3); smp += avctx->channels; } } src = buf + buf_size; break; case CODEC_ID_ADPCM_XA: while (buf_size >= 128) { xa_decode(samples, src, &c->status[0], &c->status[1], avctx->channels); src += 128; samples += 28 * 8; buf_size -= 128; } break; case CODEC_ID_ADPCM_IMA_EA_EACS: src += 4; // skip sample count (already read) for (i=0; i<=st; i++) c->status[i].step_index = av_clip(bytestream_get_le32(&src), 0, 88); for (i=0; i<=st; i++) c->status[i].predictor = bytestream_get_le32(&src); for (n = nb_samples >> (1 - st); n > 0; n--, src++) { *samples++ = adpcm_ima_expand_nibble(&c->status[0], *src>>4, 3); *samples++ = adpcm_ima_expand_nibble(&c->status[st], *src&0x0F, 3); } break; case CODEC_ID_ADPCM_IMA_EA_SEAD: for (n = nb_samples >> (1 - st); n > 0; n--, src++) { *samples++ = adpcm_ima_expand_nibble(&c->status[0], src[0] >> 4, 6); *samples++ = adpcm_ima_expand_nibble(&c->status[st],src[0]&0x0F, 6); } break; case CODEC_ID_ADPCM_EA: { int32_t previous_left_sample, previous_right_sample; int32_t current_left_sample, current_right_sample; int32_t next_left_sample, next_right_sample; int32_t coeff1l, coeff2l, coeff1r, coeff2r; uint8_t shift_left, shift_right; /* Each EA ADPCM frame has a 12-byte header followed by 30-byte pieces, each coding 28 stereo samples. */ src += 4; // skip sample count (already read) current_left_sample = (int16_t)bytestream_get_le16(&src); previous_left_sample = (int16_t)bytestream_get_le16(&src); current_right_sample = (int16_t)bytestream_get_le16(&src); previous_right_sample = (int16_t)bytestream_get_le16(&src); for (count1 = 0; count1 < nb_samples / 28; count1++) { coeff1l = ea_adpcm_table[ *src >> 4 ]; coeff2l = ea_adpcm_table[(*src >> 4 ) + 4]; coeff1r = ea_adpcm_table[*src & 0x0F]; coeff2r = ea_adpcm_table[(*src & 0x0F) + 4]; src++; shift_left = 20 - (*src >> 4); shift_right = 20 - (*src & 0x0F); src++; for (count2 = 0; count2 < 28; count2++) { next_left_sample = sign_extend(*src >> 4, 4) << shift_left; next_right_sample = sign_extend(*src, 4) << shift_right; src++; next_left_sample = (next_left_sample + (current_left_sample * coeff1l) + (previous_left_sample * coeff2l) + 0x80) >> 8; next_right_sample = (next_right_sample + (current_right_sample * coeff1r) + (previous_right_sample * coeff2r) + 0x80) >> 8; previous_left_sample = current_left_sample; current_left_sample = av_clip_int16(next_left_sample); previous_right_sample = current_right_sample; current_right_sample = av_clip_int16(next_right_sample); *samples++ = (unsigned short)current_left_sample; *samples++ = (unsigned short)current_right_sample; } } if (src - buf == buf_size - 2) src += 2; // Skip terminating 0x0000 break; } case CODEC_ID_ADPCM_EA_MAXIS_XA: { int coeff[2][2], shift[2]; for(channel = 0; channel < avctx->channels; channel++) { for (i=0; i<2; i++) coeff[channel][i] = ea_adpcm_table[(*src >> 4) + 4*i]; shift[channel] = 20 - (*src & 0x0F); src++; } for (count1 = 0; count1 < nb_samples / 2; count1++) { for(i = 4; i >= 0; i-=4) { /* Pairwise samples LL RR (st) or LL LL (mono) */ for(channel = 0; channel < avctx->channels; channel++) { int32_t sample = sign_extend(src[channel] >> i, 4) << shift[channel]; sample = (sample + c->status[channel].sample1 * coeff[channel][0] + c->status[channel].sample2 * coeff[channel][1] + 0x80) >> 8; c->status[channel].sample2 = c->status[channel].sample1; c->status[channel].sample1 = av_clip_int16(sample); *samples++ = c->status[channel].sample1; } } src+=avctx->channels; } /* consume whole packet */ src = buf + buf_size; break; } case CODEC_ID_ADPCM_EA_R1: case CODEC_ID_ADPCM_EA_R2: case CODEC_ID_ADPCM_EA_R3: { /* channel numbering 2chan: 0=fl, 1=fr 4chan: 0=fl, 1=rl, 2=fr, 3=rr 6chan: 0=fl, 1=c, 2=fr, 3=rl, 4=rr, 5=sub */ const int big_endian = avctx->codec->id == CODEC_ID_ADPCM_EA_R3; int32_t previous_sample, current_sample, next_sample; int32_t coeff1, coeff2; uint8_t shift; unsigned int channel; uint16_t *samplesC; const uint8_t *srcC; const uint8_t *src_end = buf + buf_size; int count = 0; src += 4; // skip sample count (already read) for (channel=0; channel<avctx->channels; channel++) { int32_t offset = (big_endian ? bytestream_get_be32(&src) : bytestream_get_le32(&src)) + (avctx->channels-channel-1) * 4; if ((offset < 0) || (offset >= src_end - src - 4)) break; srcC = src + offset; samplesC = samples + channel; if (avctx->codec->id == CODEC_ID_ADPCM_EA_R1) { current_sample = (int16_t)bytestream_get_le16(&srcC); previous_sample = (int16_t)bytestream_get_le16(&srcC); } else { current_sample = c->status[channel].predictor; previous_sample = c->status[channel].prev_sample; } for (count1 = 0; count1 < nb_samples / 28; count1++) { if (*srcC == 0xEE) { /* only seen in R2 and R3 */ srcC++; if (srcC > src_end - 30*2) break; current_sample = (int16_t)bytestream_get_be16(&srcC); previous_sample = (int16_t)bytestream_get_be16(&srcC); for (count2=0; count2<28; count2++) { *samplesC = (int16_t)bytestream_get_be16(&srcC); samplesC += avctx->channels; } } else { coeff1 = ea_adpcm_table[ *srcC>>4 ]; coeff2 = ea_adpcm_table[(*srcC>>4) + 4]; shift = 20 - (*srcC++ & 0x0F); if (srcC > src_end - 14) break; for (count2=0; count2<28; count2++) { if (count2 & 1) next_sample = sign_extend(*srcC++, 4) << shift; else next_sample = sign_extend(*srcC >> 4, 4) << shift; next_sample += (current_sample * coeff1) + (previous_sample * coeff2); next_sample = av_clip_int16(next_sample >> 8); previous_sample = current_sample; current_sample = next_sample; *samplesC = current_sample; samplesC += avctx->channels; } } } if (!count) { count = count1; } else if (count != count1) { av_log(avctx, AV_LOG_WARNING, "per-channel sample count mismatch\n"); count = FFMAX(count, count1); } if (avctx->codec->id != CODEC_ID_ADPCM_EA_R1) { c->status[channel].predictor = current_sample; c->status[channel].prev_sample = previous_sample; } } c->frame.nb_samples = count * 28; src = src_end; break; } case CODEC_ID_ADPCM_EA_XAS: for (channel=0; channel<avctx->channels; channel++) { int coeff[2][4], shift[4]; short *s2, *s = &samples[channel]; for (n=0; n<4; n++, s+=32*avctx->channels) { for (i=0; i<2; i++) coeff[i][n] = ea_adpcm_table[(src[0]&0x0F)+4*i]; shift[n] = 20 - (src[2] & 0x0F); for (s2=s, i=0; i<2; i++, src+=2, s2+=avctx->channels) s2[0] = (src[0]&0xF0) + (src[1]<<8); } for (m=2; m<32; m+=2) { s = &samples[m*avctx->channels + channel]; for (n=0; n<4; n++, src++, s+=32*avctx->channels) { for (s2=s, i=0; i<8; i+=4, s2+=avctx->channels) { int level = sign_extend(*src >> (4 - i), 4) << shift[n]; int pred = s2[-1*avctx->channels] * coeff[0][n] + s2[-2*avctx->channels] * coeff[1][n]; s2[0] = av_clip_int16((level + pred + 0x80) >> 8); } } } } break; case CODEC_ID_ADPCM_IMA_AMV: case CODEC_ID_ADPCM_IMA_SMJPEG: if (avctx->codec->id == CODEC_ID_ADPCM_IMA_AMV) { c->status[0].predictor = sign_extend(bytestream_get_le16(&src), 16); c->status[0].step_index = av_clip(bytestream_get_le16(&src), 0, 88); src += 4; } else { c->status[0].predictor = sign_extend(bytestream_get_be16(&src), 16); c->status[0].step_index = av_clip(bytestream_get_byte(&src), 0, 88); src += 1; } for (n = nb_samples >> (1 - st); n > 0; n--, src++) { char hi, lo; lo = *src & 0x0F; hi = *src >> 4; if (avctx->codec->id == CODEC_ID_ADPCM_IMA_AMV) FFSWAP(char, hi, lo); *samples++ = adpcm_ima_expand_nibble(&c->status[0], lo, 3); *samples++ = adpcm_ima_expand_nibble(&c->status[0], hi, 3); } break; case CODEC_ID_ADPCM_CT: for (n = nb_samples >> (1 - st); n > 0; n--, src++) { uint8_t v = *src; *samples++ = adpcm_ct_expand_nibble(&c->status[0 ], v >> 4 ); *samples++ = adpcm_ct_expand_nibble(&c->status[st], v & 0x0F); } break; case CODEC_ID_ADPCM_SBPRO_4: case CODEC_ID_ADPCM_SBPRO_3: case CODEC_ID_ADPCM_SBPRO_2: if (!c->status[0].step_index) { /* the first byte is a raw sample */ *samples++ = 128 * (*src++ - 0x80); if (st) *samples++ = 128 * (*src++ - 0x80); c->status[0].step_index = 1; nb_samples--; } if (avctx->codec->id == CODEC_ID_ADPCM_SBPRO_4) { for (n = nb_samples >> (1 - st); n > 0; n--, src++) { *samples++ = adpcm_sbpro_expand_nibble(&c->status[0], src[0] >> 4, 4, 0); *samples++ = adpcm_sbpro_expand_nibble(&c->status[st], src[0] & 0x0F, 4, 0); } } else if (avctx->codec->id == CODEC_ID_ADPCM_SBPRO_3) { for (n = nb_samples / 3; n > 0; n--, src++) { *samples++ = adpcm_sbpro_expand_nibble(&c->status[0], src[0] >> 5 , 3, 0); *samples++ = adpcm_sbpro_expand_nibble(&c->status[0], (src[0] >> 2) & 0x07, 3, 0); *samples++ = adpcm_sbpro_expand_nibble(&c->status[0], src[0] & 0x03, 2, 0); } } else { for (n = nb_samples >> (2 - st); n > 0; n--, src++) { *samples++ = adpcm_sbpro_expand_nibble(&c->status[0], src[0] >> 6 , 2, 2); *samples++ = adpcm_sbpro_expand_nibble(&c->status[st], (src[0] >> 4) & 0x03, 2, 2); *samples++ = adpcm_sbpro_expand_nibble(&c->status[0], (src[0] >> 2) & 0x03, 2, 2); *samples++ = adpcm_sbpro_expand_nibble(&c->status[st], src[0] & 0x03, 2, 2); } } break; case CODEC_ID_ADPCM_SWF: { GetBitContext gb; const int *table; int k0, signmask, nb_bits, count; int size = buf_size*8; init_get_bits(&gb, buf, size); //read bits & initial values nb_bits = get_bits(&gb, 2)+2; //av_log(NULL,AV_LOG_INFO,"nb_bits: %d\n", nb_bits); table = swf_index_tables[nb_bits-2]; k0 = 1 << (nb_bits-2); signmask = 1 << (nb_bits-1); while (get_bits_count(&gb) <= size - 22*avctx->channels) { for (i = 0; i < avctx->channels; i++) { *samples++ = c->status[i].predictor = get_sbits(&gb, 16); c->status[i].step_index = get_bits(&gb, 6); } for (count = 0; get_bits_count(&gb) <= size - nb_bits*avctx->channels && count < 4095; count++) { int i; for (i = 0; i < avctx->channels; i++) { // similar to IMA adpcm int delta = get_bits(&gb, nb_bits); int step = ff_adpcm_step_table[c->status[i].step_index]; long vpdiff = 0; // vpdiff = (delta+0.5)*step/4 int k = k0; do { if (delta & k) vpdiff += step; step >>= 1; k >>= 1; } while(k); vpdiff += step; if (delta & signmask) c->status[i].predictor -= vpdiff; else c->status[i].predictor += vpdiff; c->status[i].step_index += table[delta & (~signmask)]; c->status[i].step_index = av_clip(c->status[i].step_index, 0, 88); c->status[i].predictor = av_clip_int16(c->status[i].predictor); *samples++ = c->status[i].predictor; } } } src += buf_size; break; } case CODEC_ID_ADPCM_YAMAHA: for (n = nb_samples >> (1 - st); n > 0; n--, src++) { uint8_t v = *src; *samples++ = adpcm_yamaha_expand_nibble(&c->status[0 ], v & 0x0F); *samples++ = adpcm_yamaha_expand_nibble(&c->status[st], v >> 4 ); } break; case CODEC_ID_ADPCM_THP: { int table[2][16]; int prev[2][2]; int ch; src += 4; // skip channel size src += 4; // skip number of samples (already read) for (i = 0; i < 32; i++) table[0][i] = (int16_t)bytestream_get_be16(&src); /* Initialize the previous sample. */ for (i = 0; i < 4; i++) prev[0][i] = (int16_t)bytestream_get_be16(&src); for (ch = 0; ch <= st; ch++) { samples = (short *)c->frame.data[0] + ch; /* Read in every sample for this channel. */ for (i = 0; i < nb_samples / 14; i++) { int index = (*src >> 4) & 7; unsigned int exp = *src++ & 15; int factor1 = table[ch][index * 2]; int factor2 = table[ch][index * 2 + 1]; /* Decode 14 samples. */ for (n = 0; n < 14; n++) { int32_t sampledat; if(n&1) sampledat = sign_extend(*src++, 4); else sampledat = sign_extend(*src >> 4, 4); sampledat = ((prev[ch][0]*factor1 + prev[ch][1]*factor2) >> 11) + (sampledat << exp); *samples = av_clip_int16(sampledat); prev[ch][1] = prev[ch][0]; prev[ch][0] = *samples++; /* In case of stereo, skip one sample, this sample is for the other channel. */ samples += st; } } } break; } default: return -1; } *got_frame_ptr = 1; *(AVFrame *)data = c->frame; return src - buf; }
true
FFmpeg
86020073dbb9a3a9d1fbb76345b2ca29ba1f13d2
static int adpcm_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; ADPCMDecodeContext *c = avctx->priv_data; ADPCMChannelStatus *cs; int n, m, channel, i; short *samples; const uint8_t *src; int st; int count1, count2; int nb_samples, coded_samples, ret; nb_samples = get_nb_samples(avctx, buf, buf_size, &coded_samples); if (nb_samples <= 0) { av_log(avctx, AV_LOG_ERROR, "invalid number of samples in packet\n"); return AVERROR_INVALIDDATA; } c->frame.nb_samples = nb_samples; if ((ret = avctx->get_buffer(avctx, &c->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } samples = (short *)c->frame.data[0]; if (coded_samples) { if (coded_samples != nb_samples) av_log(avctx, AV_LOG_WARNING, "mismatch in coded sample count\n"); c->frame.nb_samples = nb_samples = coded_samples; } src = buf; st = avctx->channels == 2 ? 1 : 0; switch(avctx->codec->id) { case CODEC_ID_ADPCM_IMA_QT: for (channel = 0; channel < avctx->channels; channel++) { int16_t predictor; int step_index; cs = &(c->status[channel]); predictor = AV_RB16(src); step_index = predictor & 0x7F; predictor &= 0xFF80; src += 2; if (cs->step_index == step_index) { int diff = (int)predictor - cs->predictor; if (diff < 0) diff = - diff; if (diff > 0x7f) goto update; } else { update: cs->step_index = step_index; cs->predictor = predictor; } if (cs->step_index > 88){ av_log(avctx, AV_LOG_ERROR, "ERROR: step_index = %i\n", cs->step_index); cs->step_index = 88; } samples = (short *)c->frame.data[0] + channel; for (m = 0; m < 32; m++) { *samples = adpcm_ima_qt_expand_nibble(cs, src[0] & 0x0F, 3); samples += avctx->channels; *samples = adpcm_ima_qt_expand_nibble(cs, src[0] >> 4 , 3); samples += avctx->channels; src ++; } } break; case CODEC_ID_ADPCM_IMA_WAV: if (avctx->block_align != 0 && buf_size > avctx->block_align) buf_size = avctx->block_align; for(i=0; i<avctx->channels; i++){ cs = &(c->status[i]); cs->predictor = *samples++ = (int16_t)bytestream_get_le16(&src); cs->step_index = *src++; if (cs->step_index > 88){ av_log(avctx, AV_LOG_ERROR, "ERROR: step_index = %i\n", cs->step_index); cs->step_index = 88; } if (*src++) av_log(avctx, AV_LOG_ERROR, "unused byte should be null but is %d!!\n", src[-1]); } for (n = (nb_samples - 1) / 8; n > 0; n--) { for (i = 0; i < avctx->channels; i++) { cs = &c->status[i]; for (m = 0; m < 4; m++) { uint8_t v = *src++; *samples = adpcm_ima_expand_nibble(cs, v & 0x0F, 3); samples += avctx->channels; *samples = adpcm_ima_expand_nibble(cs, v >> 4 , 3); samples += avctx->channels; } samples -= 8 * avctx->channels - 1; } samples += 7 * avctx->channels; } break; case CODEC_ID_ADPCM_4XM: for (i = 0; i < avctx->channels; i++) c->status[i].predictor= (int16_t)bytestream_get_le16(&src); for (i = 0; i < avctx->channels; i++) { c->status[i].step_index= (int16_t)bytestream_get_le16(&src); c->status[i].step_index = av_clip(c->status[i].step_index, 0, 88); } for (i = 0; i < avctx->channels; i++) { samples = (short *)c->frame.data[0] + i; cs = &c->status[i]; for (n = nb_samples >> 1; n > 0; n--, src++) { uint8_t v = *src; *samples = adpcm_ima_expand_nibble(cs, v & 0x0F, 4); samples += avctx->channels; *samples = adpcm_ima_expand_nibble(cs, v >> 4 , 4); samples += avctx->channels; } } break; case CODEC_ID_ADPCM_MS: { int block_predictor; if (avctx->block_align != 0 && buf_size > avctx->block_align) buf_size = avctx->block_align; block_predictor = av_clip(*src++, 0, 6); c->status[0].coeff1 = ff_adpcm_AdaptCoeff1[block_predictor]; c->status[0].coeff2 = ff_adpcm_AdaptCoeff2[block_predictor]; if (st) { block_predictor = av_clip(*src++, 0, 6); c->status[1].coeff1 = ff_adpcm_AdaptCoeff1[block_predictor]; c->status[1].coeff2 = ff_adpcm_AdaptCoeff2[block_predictor]; } c->status[0].idelta = (int16_t)bytestream_get_le16(&src); if (st){ c->status[1].idelta = (int16_t)bytestream_get_le16(&src); } c->status[0].sample1 = bytestream_get_le16(&src); if (st) c->status[1].sample1 = bytestream_get_le16(&src); c->status[0].sample2 = bytestream_get_le16(&src); if (st) c->status[1].sample2 = bytestream_get_le16(&src); *samples++ = c->status[0].sample2; if (st) *samples++ = c->status[1].sample2; *samples++ = c->status[0].sample1; if (st) *samples++ = c->status[1].sample1; for(n = (nb_samples - 2) >> (1 - st); n > 0; n--, src++) { *samples++ = adpcm_ms_expand_nibble(&c->status[0 ], src[0] >> 4 ); *samples++ = adpcm_ms_expand_nibble(&c->status[st], src[0] & 0x0F); } break; } case CODEC_ID_ADPCM_IMA_DK4: if (avctx->block_align != 0 && buf_size > avctx->block_align) buf_size = avctx->block_align; for (channel = 0; channel < avctx->channels; channel++) { cs = &c->status[channel]; cs->predictor = (int16_t)bytestream_get_le16(&src); cs->step_index = av_clip(*src++, 0, 88); src++; *samples++ = cs->predictor; } for (n = nb_samples >> (1 - st); n > 0; n--, src++) { uint8_t v = *src; *samples++ = adpcm_ima_expand_nibble(&c->status[0 ], v >> 4 , 3); *samples++ = adpcm_ima_expand_nibble(&c->status[st], v & 0x0F, 3); } break; case CODEC_ID_ADPCM_IMA_DK3: { unsigned char last_byte = 0; unsigned char nibble; int decode_top_nibble_next = 0; int end_of_packet = 0; int diff_channel; if (avctx->block_align != 0 && buf_size > avctx->block_align) buf_size = avctx->block_align; c->status[0].predictor = (int16_t)AV_RL16(src + 10); c->status[1].predictor = (int16_t)AV_RL16(src + 12); c->status[0].step_index = av_clip(src[14], 0, 88); c->status[1].step_index = av_clip(src[15], 0, 88); src += 16; diff_channel = c->status[1].predictor; while (1) { DK3_GET_NEXT_NIBBLE(); adpcm_ima_expand_nibble(&c->status[0], nibble, 3); DK3_GET_NEXT_NIBBLE(); adpcm_ima_expand_nibble(&c->status[1], nibble, 3); diff_channel = (diff_channel + c->status[1].predictor) / 2; *samples++ = c->status[0].predictor + c->status[1].predictor; *samples++ = c->status[0].predictor - c->status[1].predictor; DK3_GET_NEXT_NIBBLE(); adpcm_ima_expand_nibble(&c->status[0], nibble, 3); diff_channel = (diff_channel + c->status[1].predictor) / 2; *samples++ = c->status[0].predictor + c->status[1].predictor; *samples++ = c->status[0].predictor - c->status[1].predictor; } break; } case CODEC_ID_ADPCM_IMA_ISS: for (channel = 0; channel < avctx->channels; channel++) { cs = &c->status[channel]; cs->predictor = (int16_t)bytestream_get_le16(&src); cs->step_index = av_clip(*src++, 0, 88); src++; } for (n = nb_samples >> (1 - st); n > 0; n--, src++) { uint8_t v1, v2; uint8_t v = *src; if (st) { v1 = v >> 4; v2 = v & 0x0F; } else { v2 = v >> 4; v1 = v & 0x0F; } *samples++ = adpcm_ima_expand_nibble(&c->status[0 ], v1, 3); *samples++ = adpcm_ima_expand_nibble(&c->status[st], v2, 3); } break; case CODEC_ID_ADPCM_IMA_APC: while (src < buf + buf_size) { uint8_t v = *src++; *samples++ = adpcm_ima_expand_nibble(&c->status[0], v >> 4 , 3); *samples++ = adpcm_ima_expand_nibble(&c->status[st], v & 0x0F, 3); } break; case CODEC_ID_ADPCM_IMA_WS: for (channel = 0; channel < avctx->channels; channel++) { const uint8_t *src0; int src_stride; int16_t *smp = samples + channel; if (c->vqa_version == 3) { src0 = src + channel * buf_size / 2; src_stride = 1; } else { src0 = src + channel; src_stride = avctx->channels; } for (n = nb_samples / 2; n > 0; n--) { uint8_t v = *src0; src0 += src_stride; *smp = adpcm_ima_expand_nibble(&c->status[channel], v >> 4 , 3); smp += avctx->channels; *smp = adpcm_ima_expand_nibble(&c->status[channel], v & 0x0F, 3); smp += avctx->channels; } } src = buf + buf_size; break; case CODEC_ID_ADPCM_XA: while (buf_size >= 128) { xa_decode(samples, src, &c->status[0], &c->status[1], avctx->channels); src += 128; samples += 28 * 8; buf_size -= 128; } break; case CODEC_ID_ADPCM_IMA_EA_EACS: src += 4; for (i=0; i<=st; i++) c->status[i].step_index = av_clip(bytestream_get_le32(&src), 0, 88); for (i=0; i<=st; i++) c->status[i].predictor = bytestream_get_le32(&src); for (n = nb_samples >> (1 - st); n > 0; n--, src++) { *samples++ = adpcm_ima_expand_nibble(&c->status[0], *src>>4, 3); *samples++ = adpcm_ima_expand_nibble(&c->status[st], *src&0x0F, 3); } break; case CODEC_ID_ADPCM_IMA_EA_SEAD: for (n = nb_samples >> (1 - st); n > 0; n--, src++) { *samples++ = adpcm_ima_expand_nibble(&c->status[0], src[0] >> 4, 6); *samples++ = adpcm_ima_expand_nibble(&c->status[st],src[0]&0x0F, 6); } break; case CODEC_ID_ADPCM_EA: { int32_t previous_left_sample, previous_right_sample; int32_t current_left_sample, current_right_sample; int32_t next_left_sample, next_right_sample; int32_t coeff1l, coeff2l, coeff1r, coeff2r; uint8_t shift_left, shift_right; src += 4; current_left_sample = (int16_t)bytestream_get_le16(&src); previous_left_sample = (int16_t)bytestream_get_le16(&src); current_right_sample = (int16_t)bytestream_get_le16(&src); previous_right_sample = (int16_t)bytestream_get_le16(&src); for (count1 = 0; count1 < nb_samples / 28; count1++) { coeff1l = ea_adpcm_table[ *src >> 4 ]; coeff2l = ea_adpcm_table[(*src >> 4 ) + 4]; coeff1r = ea_adpcm_table[*src & 0x0F]; coeff2r = ea_adpcm_table[(*src & 0x0F) + 4]; src++; shift_left = 20 - (*src >> 4); shift_right = 20 - (*src & 0x0F); src++; for (count2 = 0; count2 < 28; count2++) { next_left_sample = sign_extend(*src >> 4, 4) << shift_left; next_right_sample = sign_extend(*src, 4) << shift_right; src++; next_left_sample = (next_left_sample + (current_left_sample * coeff1l) + (previous_left_sample * coeff2l) + 0x80) >> 8; next_right_sample = (next_right_sample + (current_right_sample * coeff1r) + (previous_right_sample * coeff2r) + 0x80) >> 8; previous_left_sample = current_left_sample; current_left_sample = av_clip_int16(next_left_sample); previous_right_sample = current_right_sample; current_right_sample = av_clip_int16(next_right_sample); *samples++ = (unsigned short)current_left_sample; *samples++ = (unsigned short)current_right_sample; } } if (src - buf == buf_size - 2) src += 2; break; } case CODEC_ID_ADPCM_EA_MAXIS_XA: { int coeff[2][2], shift[2]; for(channel = 0; channel < avctx->channels; channel++) { for (i=0; i<2; i++) coeff[channel][i] = ea_adpcm_table[(*src >> 4) + 4*i]; shift[channel] = 20 - (*src & 0x0F); src++; } for (count1 = 0; count1 < nb_samples / 2; count1++) { for(i = 4; i >= 0; i-=4) { for(channel = 0; channel < avctx->channels; channel++) { int32_t sample = sign_extend(src[channel] >> i, 4) << shift[channel]; sample = (sample + c->status[channel].sample1 * coeff[channel][0] + c->status[channel].sample2 * coeff[channel][1] + 0x80) >> 8; c->status[channel].sample2 = c->status[channel].sample1; c->status[channel].sample1 = av_clip_int16(sample); *samples++ = c->status[channel].sample1; } } src+=avctx->channels; } src = buf + buf_size; break; } case CODEC_ID_ADPCM_EA_R1: case CODEC_ID_ADPCM_EA_R2: case CODEC_ID_ADPCM_EA_R3: { const int big_endian = avctx->codec->id == CODEC_ID_ADPCM_EA_R3; int32_t previous_sample, current_sample, next_sample; int32_t coeff1, coeff2; uint8_t shift; unsigned int channel; uint16_t *samplesC; const uint8_t *srcC; const uint8_t *src_end = buf + buf_size; int count = 0; src += 4; for (channel=0; channel<avctx->channels; channel++) { int32_t offset = (big_endian ? bytestream_get_be32(&src) : bytestream_get_le32(&src)) + (avctx->channels-channel-1) * 4; if ((offset < 0) || (offset >= src_end - src - 4)) break; srcC = src + offset; samplesC = samples + channel; if (avctx->codec->id == CODEC_ID_ADPCM_EA_R1) { current_sample = (int16_t)bytestream_get_le16(&srcC); previous_sample = (int16_t)bytestream_get_le16(&srcC); } else { current_sample = c->status[channel].predictor; previous_sample = c->status[channel].prev_sample; } for (count1 = 0; count1 < nb_samples / 28; count1++) { if (*srcC == 0xEE) { srcC++; if (srcC > src_end - 30*2) break; current_sample = (int16_t)bytestream_get_be16(&srcC); previous_sample = (int16_t)bytestream_get_be16(&srcC); for (count2=0; count2<28; count2++) { *samplesC = (int16_t)bytestream_get_be16(&srcC); samplesC += avctx->channels; } } else { coeff1 = ea_adpcm_table[ *srcC>>4 ]; coeff2 = ea_adpcm_table[(*srcC>>4) + 4]; shift = 20 - (*srcC++ & 0x0F); if (srcC > src_end - 14) break; for (count2=0; count2<28; count2++) { if (count2 & 1) next_sample = sign_extend(*srcC++, 4) << shift; else next_sample = sign_extend(*srcC >> 4, 4) << shift; next_sample += (current_sample * coeff1) + (previous_sample * coeff2); next_sample = av_clip_int16(next_sample >> 8); previous_sample = current_sample; current_sample = next_sample; *samplesC = current_sample; samplesC += avctx->channels; } } } if (!count) { count = count1; } else if (count != count1) { av_log(avctx, AV_LOG_WARNING, "per-channel sample count mismatch\n"); count = FFMAX(count, count1); } if (avctx->codec->id != CODEC_ID_ADPCM_EA_R1) { c->status[channel].predictor = current_sample; c->status[channel].prev_sample = previous_sample; } } c->frame.nb_samples = count * 28; src = src_end; break; } case CODEC_ID_ADPCM_EA_XAS: for (channel=0; channel<avctx->channels; channel++) { int coeff[2][4], shift[4]; short *s2, *s = &samples[channel]; for (n=0; n<4; n++, s+=32*avctx->channels) { for (i=0; i<2; i++) coeff[i][n] = ea_adpcm_table[(src[0]&0x0F)+4*i]; shift[n] = 20 - (src[2] & 0x0F); for (s2=s, i=0; i<2; i++, src+=2, s2+=avctx->channels) s2[0] = (src[0]&0xF0) + (src[1]<<8); } for (m=2; m<32; m+=2) { s = &samples[m*avctx->channels + channel]; for (n=0; n<4; n++, src++, s+=32*avctx->channels) { for (s2=s, i=0; i<8; i+=4, s2+=avctx->channels) { int level = sign_extend(*src >> (4 - i), 4) << shift[n]; int pred = s2[-1*avctx->channels] * coeff[0][n] + s2[-2*avctx->channels] * coeff[1][n]; s2[0] = av_clip_int16((level + pred + 0x80) >> 8); } } } } break; case CODEC_ID_ADPCM_IMA_AMV: case CODEC_ID_ADPCM_IMA_SMJPEG: if (avctx->codec->id == CODEC_ID_ADPCM_IMA_AMV) { c->status[0].predictor = sign_extend(bytestream_get_le16(&src), 16); c->status[0].step_index = av_clip(bytestream_get_le16(&src), 0, 88); src += 4; } else { c->status[0].predictor = sign_extend(bytestream_get_be16(&src), 16); c->status[0].step_index = av_clip(bytestream_get_byte(&src), 0, 88); src += 1; } for (n = nb_samples >> (1 - st); n > 0; n--, src++) { char hi, lo; lo = *src & 0x0F; hi = *src >> 4; if (avctx->codec->id == CODEC_ID_ADPCM_IMA_AMV) FFSWAP(char, hi, lo); *samples++ = adpcm_ima_expand_nibble(&c->status[0], lo, 3); *samples++ = adpcm_ima_expand_nibble(&c->status[0], hi, 3); } break; case CODEC_ID_ADPCM_CT: for (n = nb_samples >> (1 - st); n > 0; n--, src++) { uint8_t v = *src; *samples++ = adpcm_ct_expand_nibble(&c->status[0 ], v >> 4 ); *samples++ = adpcm_ct_expand_nibble(&c->status[st], v & 0x0F); } break; case CODEC_ID_ADPCM_SBPRO_4: case CODEC_ID_ADPCM_SBPRO_3: case CODEC_ID_ADPCM_SBPRO_2: if (!c->status[0].step_index) { *samples++ = 128 * (*src++ - 0x80); if (st) *samples++ = 128 * (*src++ - 0x80); c->status[0].step_index = 1; nb_samples--; } if (avctx->codec->id == CODEC_ID_ADPCM_SBPRO_4) { for (n = nb_samples >> (1 - st); n > 0; n--, src++) { *samples++ = adpcm_sbpro_expand_nibble(&c->status[0], src[0] >> 4, 4, 0); *samples++ = adpcm_sbpro_expand_nibble(&c->status[st], src[0] & 0x0F, 4, 0); } } else if (avctx->codec->id == CODEC_ID_ADPCM_SBPRO_3) { for (n = nb_samples / 3; n > 0; n--, src++) { *samples++ = adpcm_sbpro_expand_nibble(&c->status[0], src[0] >> 5 , 3, 0); *samples++ = adpcm_sbpro_expand_nibble(&c->status[0], (src[0] >> 2) & 0x07, 3, 0); *samples++ = adpcm_sbpro_expand_nibble(&c->status[0], src[0] & 0x03, 2, 0); } } else { for (n = nb_samples >> (2 - st); n > 0; n--, src++) { *samples++ = adpcm_sbpro_expand_nibble(&c->status[0], src[0] >> 6 , 2, 2); *samples++ = adpcm_sbpro_expand_nibble(&c->status[st], (src[0] >> 4) & 0x03, 2, 2); *samples++ = adpcm_sbpro_expand_nibble(&c->status[0], (src[0] >> 2) & 0x03, 2, 2); *samples++ = adpcm_sbpro_expand_nibble(&c->status[st], src[0] & 0x03, 2, 2); } } break; case CODEC_ID_ADPCM_SWF: { GetBitContext gb; const int *table; int k0, signmask, nb_bits, count; int size = buf_size*8; init_get_bits(&gb, buf, size); nb_bits = get_bits(&gb, 2)+2; table = swf_index_tables[nb_bits-2]; k0 = 1 << (nb_bits-2); signmask = 1 << (nb_bits-1); while (get_bits_count(&gb) <= size - 22*avctx->channels) { for (i = 0; i < avctx->channels; i++) { *samples++ = c->status[i].predictor = get_sbits(&gb, 16); c->status[i].step_index = get_bits(&gb, 6); } for (count = 0; get_bits_count(&gb) <= size - nb_bits*avctx->channels && count < 4095; count++) { int i; for (i = 0; i < avctx->channels; i++) { int delta = get_bits(&gb, nb_bits); int step = ff_adpcm_step_table[c->status[i].step_index]; long vpdiff = 0; int k = k0; do { if (delta & k) vpdiff += step; step >>= 1; k >>= 1; } while(k); vpdiff += step; if (delta & signmask) c->status[i].predictor -= vpdiff; else c->status[i].predictor += vpdiff; c->status[i].step_index += table[delta & (~signmask)]; c->status[i].step_index = av_clip(c->status[i].step_index, 0, 88); c->status[i].predictor = av_clip_int16(c->status[i].predictor); *samples++ = c->status[i].predictor; } } } src += buf_size; break; } case CODEC_ID_ADPCM_YAMAHA: for (n = nb_samples >> (1 - st); n > 0; n--, src++) { uint8_t v = *src; *samples++ = adpcm_yamaha_expand_nibble(&c->status[0 ], v & 0x0F); *samples++ = adpcm_yamaha_expand_nibble(&c->status[st], v >> 4 ); } break; case CODEC_ID_ADPCM_THP: { int table[2][16]; int prev[2][2]; int ch; src += 4; src += 4; for (i = 0; i < 32; i++) table[0][i] = (int16_t)bytestream_get_be16(&src); for (i = 0; i < 4; i++) prev[0][i] = (int16_t)bytestream_get_be16(&src); for (ch = 0; ch <= st; ch++) { samples = (short *)c->frame.data[0] + ch; for (i = 0; i < nb_samples / 14; i++) { int index = (*src >> 4) & 7; unsigned int exp = *src++ & 15; int factor1 = table[ch][index * 2]; int factor2 = table[ch][index * 2 + 1]; for (n = 0; n < 14; n++) { int32_t sampledat; if(n&1) sampledat = sign_extend(*src++, 4); else sampledat = sign_extend(*src >> 4, 4); sampledat = ((prev[ch][0]*factor1 + prev[ch][1]*factor2) >> 11) + (sampledat << exp); *samples = av_clip_int16(sampledat); prev[ch][1] = prev[ch][0]; prev[ch][0] = *samples++; samples += st; } } } break; } default: return -1; } *got_frame_ptr = 1; *(AVFrame *)data = c->frame; return src - buf; }
{ "code": [ " xa_decode(samples, src, &c->status[0], &c->status[1],", " avctx->channels);" ], "line_no": [ 591, 593 ] }
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3) { const uint8_t *VAR_4 = VAR_3->VAR_1; int VAR_5 = VAR_3->VAR_36; ADPCMDecodeContext *c = VAR_0->priv_data; ADPCMChannelStatus *cs; int VAR_6, VAR_7, VAR_27, VAR_9; short *VAR_10; const uint8_t *VAR_11; int VAR_12; int VAR_13, VAR_14; int VAR_15, VAR_16, VAR_17; VAR_15 = get_nb_samples(VAR_0, VAR_4, VAR_5, &VAR_16); if (VAR_15 <= 0) { av_log(VAR_0, AV_LOG_ERROR, "invalid number of VAR_10 in packet\VAR_6"); return AVERROR_INVALIDDATA; } c->frame.VAR_15 = VAR_15; if ((VAR_17 = VAR_0->get_buffer(VAR_0, &c->frame)) < 0) { av_log(VAR_0, AV_LOG_ERROR, "get_buffer() failed\VAR_6"); return VAR_17; } VAR_10 = (short *)c->frame.VAR_1[0]; if (VAR_16) { if (VAR_16 != VAR_15) av_log(VAR_0, AV_LOG_WARNING, "mismatch in coded sample VAR_36\VAR_6"); c->frame.VAR_15 = VAR_15 = VAR_16; } VAR_11 = VAR_4; VAR_12 = VAR_0->channels == 2 ? 1 : 0; switch(VAR_0->codec->id) { case CODEC_ID_ADPCM_IMA_QT: for (VAR_27 = 0; VAR_27 < VAR_0->channels; VAR_27++) { int16_t predictor; int step_index; cs = &(c->status[VAR_27]); predictor = AV_RB16(VAR_11); step_index = predictor & 0x7F; predictor &= 0xFF80; VAR_11 += 2; if (cs->step_index == step_index) { int diff = (int)predictor - cs->predictor; if (diff < 0) diff = - diff; if (diff > 0x7f) goto update; } else { update: cs->step_index = step_index; cs->predictor = predictor; } if (cs->step_index > 88){ av_log(VAR_0, AV_LOG_ERROR, "ERROR: step_index = %VAR_9\VAR_6", cs->step_index); cs->step_index = 88; } VAR_10 = (short *)c->frame.VAR_1[0] + VAR_27; for (VAR_7 = 0; VAR_7 < 32; VAR_7++) { *VAR_10 = adpcm_ima_qt_expand_nibble(cs, VAR_11[0] & 0x0F, 3); VAR_10 += VAR_0->channels; *VAR_10 = adpcm_ima_qt_expand_nibble(cs, VAR_11[0] >> 4 , 3); VAR_10 += VAR_0->channels; VAR_11 ++; } } break; case CODEC_ID_ADPCM_IMA_WAV: if (VAR_0->block_align != 0 && VAR_5 > VAR_0->block_align) VAR_5 = VAR_0->block_align; for(VAR_9=0; VAR_9<VAR_0->channels; VAR_9++){ cs = &(c->status[VAR_9]); cs->predictor = *VAR_10++ = (int16_t)bytestream_get_le16(&VAR_11); cs->step_index = *VAR_11++; if (cs->step_index > 88){ av_log(VAR_0, AV_LOG_ERROR, "ERROR: step_index = %VAR_9\VAR_6", cs->step_index); cs->step_index = 88; } if (*VAR_11++) av_log(VAR_0, AV_LOG_ERROR, "unused byte should be null but is %d!!\VAR_6", VAR_11[-1]); } for (VAR_6 = (VAR_15 - 1) / 8; VAR_6 > 0; VAR_6--) { for (VAR_9 = 0; VAR_9 < VAR_0->channels; VAR_9++) { cs = &c->status[VAR_9]; for (VAR_7 = 0; VAR_7 < 4; VAR_7++) { uint8_t v = *VAR_11++; *VAR_10 = adpcm_ima_expand_nibble(cs, v & 0x0F, 3); VAR_10 += VAR_0->channels; *VAR_10 = adpcm_ima_expand_nibble(cs, v >> 4 , 3); VAR_10 += VAR_0->channels; } VAR_10 -= 8 * VAR_0->channels - 1; } VAR_10 += 7 * VAR_0->channels; } break; case CODEC_ID_ADPCM_4XM: for (VAR_9 = 0; VAR_9 < VAR_0->channels; VAR_9++) c->status[VAR_9].predictor= (int16_t)bytestream_get_le16(&VAR_11); for (VAR_9 = 0; VAR_9 < VAR_0->channels; VAR_9++) { c->status[VAR_9].step_index= (int16_t)bytestream_get_le16(&VAR_11); c->status[VAR_9].step_index = av_clip(c->status[VAR_9].step_index, 0, 88); } for (VAR_9 = 0; VAR_9 < VAR_0->channels; VAR_9++) { VAR_10 = (short *)c->frame.VAR_1[0] + VAR_9; cs = &c->status[VAR_9]; for (VAR_6 = VAR_15 >> 1; VAR_6 > 0; VAR_6--, VAR_11++) { uint8_t v = *VAR_11; *VAR_10 = adpcm_ima_expand_nibble(cs, v & 0x0F, 4); VAR_10 += VAR_0->channels; *VAR_10 = adpcm_ima_expand_nibble(cs, v >> 4 , 4); VAR_10 += VAR_0->channels; } } break; case CODEC_ID_ADPCM_MS: { int VAR_18; if (VAR_0->block_align != 0 && VAR_5 > VAR_0->block_align) VAR_5 = VAR_0->block_align; VAR_18 = av_clip(*VAR_11++, 0, 6); c->status[0].coeff1 = ff_adpcm_AdaptCoeff1[VAR_18]; c->status[0].coeff2 = ff_adpcm_AdaptCoeff2[VAR_18]; if (VAR_12) { VAR_18 = av_clip(*VAR_11++, 0, 6); c->status[1].coeff1 = ff_adpcm_AdaptCoeff1[VAR_18]; c->status[1].coeff2 = ff_adpcm_AdaptCoeff2[VAR_18]; } c->status[0].idelta = (int16_t)bytestream_get_le16(&VAR_11); if (VAR_12){ c->status[1].idelta = (int16_t)bytestream_get_le16(&VAR_11); } c->status[0].sample1 = bytestream_get_le16(&VAR_11); if (VAR_12) c->status[1].sample1 = bytestream_get_le16(&VAR_11); c->status[0].sample2 = bytestream_get_le16(&VAR_11); if (VAR_12) c->status[1].sample2 = bytestream_get_le16(&VAR_11); *VAR_10++ = c->status[0].sample2; if (VAR_12) *VAR_10++ = c->status[1].sample2; *VAR_10++ = c->status[0].sample1; if (VAR_12) *VAR_10++ = c->status[1].sample1; for(VAR_6 = (VAR_15 - 2) >> (1 - VAR_12); VAR_6 > 0; VAR_6--, VAR_11++) { *VAR_10++ = adpcm_ms_expand_nibble(&c->status[0 ], VAR_11[0] >> 4 ); *VAR_10++ = adpcm_ms_expand_nibble(&c->status[VAR_12], VAR_11[0] & 0x0F); } break; } case CODEC_ID_ADPCM_IMA_DK4: if (VAR_0->block_align != 0 && VAR_5 > VAR_0->block_align) VAR_5 = VAR_0->block_align; for (VAR_27 = 0; VAR_27 < VAR_0->channels; VAR_27++) { cs = &c->status[VAR_27]; cs->predictor = (int16_t)bytestream_get_le16(&VAR_11); cs->step_index = av_clip(*VAR_11++, 0, 88); VAR_11++; *VAR_10++ = cs->predictor; } for (VAR_6 = VAR_15 >> (1 - VAR_12); VAR_6 > 0; VAR_6--, VAR_11++) { uint8_t v = *VAR_11; *VAR_10++ = adpcm_ima_expand_nibble(&c->status[0 ], v >> 4 , 3); *VAR_10++ = adpcm_ima_expand_nibble(&c->status[VAR_12], v & 0x0F, 3); } break; case CODEC_ID_ADPCM_IMA_DK3: { unsigned char VAR_19 = 0; unsigned char VAR_20; int VAR_21 = 0; int VAR_22 = 0; int VAR_23; if (VAR_0->block_align != 0 && VAR_5 > VAR_0->block_align) VAR_5 = VAR_0->block_align; c->status[0].predictor = (int16_t)AV_RL16(VAR_11 + 10); c->status[1].predictor = (int16_t)AV_RL16(VAR_11 + 12); c->status[0].step_index = av_clip(VAR_11[14], 0, 88); c->status[1].step_index = av_clip(VAR_11[15], 0, 88); VAR_11 += 16; VAR_23 = c->status[1].predictor; while (1) { DK3_GET_NEXT_NIBBLE(); adpcm_ima_expand_nibble(&c->status[0], VAR_20, 3); DK3_GET_NEXT_NIBBLE(); adpcm_ima_expand_nibble(&c->status[1], VAR_20, 3); VAR_23 = (VAR_23 + c->status[1].predictor) / 2; *VAR_10++ = c->status[0].predictor + c->status[1].predictor; *VAR_10++ = c->status[0].predictor - c->status[1].predictor; DK3_GET_NEXT_NIBBLE(); adpcm_ima_expand_nibble(&c->status[0], VAR_20, 3); VAR_23 = (VAR_23 + c->status[1].predictor) / 2; *VAR_10++ = c->status[0].predictor + c->status[1].predictor; *VAR_10++ = c->status[0].predictor - c->status[1].predictor; } break; } case CODEC_ID_ADPCM_IMA_ISS: for (VAR_27 = 0; VAR_27 < VAR_0->channels; VAR_27++) { cs = &c->status[VAR_27]; cs->predictor = (int16_t)bytestream_get_le16(&VAR_11); cs->step_index = av_clip(*VAR_11++, 0, 88); VAR_11++; } for (VAR_6 = VAR_15 >> (1 - VAR_12); VAR_6 > 0; VAR_6--, VAR_11++) { uint8_t v1, v2; uint8_t v = *VAR_11; if (VAR_12) { v1 = v >> 4; v2 = v & 0x0F; } else { v2 = v >> 4; v1 = v & 0x0F; } *VAR_10++ = adpcm_ima_expand_nibble(&c->status[0 ], v1, 3); *VAR_10++ = adpcm_ima_expand_nibble(&c->status[VAR_12], v2, 3); } break; case CODEC_ID_ADPCM_IMA_APC: while (VAR_11 < VAR_4 + VAR_5) { uint8_t v = *VAR_11++; *VAR_10++ = adpcm_ima_expand_nibble(&c->status[0], v >> 4 , 3); *VAR_10++ = adpcm_ima_expand_nibble(&c->status[VAR_12], v & 0x0F, 3); } break; case CODEC_ID_ADPCM_IMA_WS: for (VAR_27 = 0; VAR_27 < VAR_0->channels; VAR_27++) { const uint8_t *src0; int src_stride; int16_t *smp = VAR_10 + VAR_27; if (c->vqa_version == 3) { src0 = VAR_11 + VAR_27 * VAR_5 / 2; src_stride = 1; } else { src0 = VAR_11 + VAR_27; src_stride = VAR_0->channels; } for (VAR_6 = VAR_15 / 2; VAR_6 > 0; VAR_6--) { uint8_t v = *src0; src0 += src_stride; *smp = adpcm_ima_expand_nibble(&c->status[VAR_27], v >> 4 , 3); smp += VAR_0->channels; *smp = adpcm_ima_expand_nibble(&c->status[VAR_27], v & 0x0F, 3); smp += VAR_0->channels; } } VAR_11 = VAR_4 + VAR_5; break; case CODEC_ID_ADPCM_XA: while (VAR_5 >= 128) { xa_decode(VAR_10, VAR_11, &c->status[0], &c->status[1], VAR_0->channels); VAR_11 += 128; VAR_10 += 28 * 8; VAR_5 -= 128; } break; case CODEC_ID_ADPCM_IMA_EA_EACS: VAR_11 += 4; for (VAR_9=0; VAR_9<=VAR_12; VAR_9++) c->status[VAR_9].step_index = av_clip(bytestream_get_le32(&VAR_11), 0, 88); for (VAR_9=0; VAR_9<=VAR_12; VAR_9++) c->status[VAR_9].predictor = bytestream_get_le32(&VAR_11); for (VAR_6 = VAR_15 >> (1 - VAR_12); VAR_6 > 0; VAR_6--, VAR_11++) { *VAR_10++ = adpcm_ima_expand_nibble(&c->status[0], *VAR_11>>4, 3); *VAR_10++ = adpcm_ima_expand_nibble(&c->status[VAR_12], *VAR_11&0x0F, 3); } break; case CODEC_ID_ADPCM_IMA_EA_SEAD: for (VAR_6 = VAR_15 >> (1 - VAR_12); VAR_6 > 0; VAR_6--, VAR_11++) { *VAR_10++ = adpcm_ima_expand_nibble(&c->status[0], VAR_11[0] >> 4, 6); *VAR_10++ = adpcm_ima_expand_nibble(&c->status[VAR_12],VAR_11[0]&0x0F, 6); } break; case CODEC_ID_ADPCM_EA: { int32_t previous_left_sample, previous_right_sample; int32_t current_left_sample, current_right_sample; int32_t next_left_sample, next_right_sample; int32_t coeff1l, coeff2l, coeff1r, coeff2r; uint8_t shift_left, shift_right; VAR_11 += 4; current_left_sample = (int16_t)bytestream_get_le16(&VAR_11); previous_left_sample = (int16_t)bytestream_get_le16(&VAR_11); current_right_sample = (int16_t)bytestream_get_le16(&VAR_11); previous_right_sample = (int16_t)bytestream_get_le16(&VAR_11); for (VAR_13 = 0; VAR_13 < VAR_15 / 28; VAR_13++) { coeff1l = ea_adpcm_table[ *VAR_11 >> 4 ]; coeff2l = ea_adpcm_table[(*VAR_11 >> 4 ) + 4]; coeff1r = ea_adpcm_table[*VAR_11 & 0x0F]; coeff2r = ea_adpcm_table[(*VAR_11 & 0x0F) + 4]; VAR_11++; shift_left = 20 - (*VAR_11 >> 4); shift_right = 20 - (*VAR_11 & 0x0F); VAR_11++; for (VAR_14 = 0; VAR_14 < 28; VAR_14++) { next_left_sample = sign_extend(*VAR_11 >> 4, 4) << shift_left; next_right_sample = sign_extend(*VAR_11, 4) << shift_right; VAR_11++; next_left_sample = (next_left_sample + (current_left_sample * coeff1l) + (previous_left_sample * coeff2l) + 0x80) >> 8; next_right_sample = (next_right_sample + (current_right_sample * coeff1r) + (previous_right_sample * coeff2r) + 0x80) >> 8; previous_left_sample = current_left_sample; current_left_sample = av_clip_int16(next_left_sample); previous_right_sample = current_right_sample; current_right_sample = av_clip_int16(next_right_sample); *VAR_10++ = (unsigned short)current_left_sample; *VAR_10++ = (unsigned short)current_right_sample; } } if (VAR_11 - VAR_4 == VAR_5 - 2) VAR_11 += 2; break; } case CODEC_ID_ADPCM_EA_MAXIS_XA: { int VAR_24[2][2], VAR_25[2]; for(VAR_27 = 0; VAR_27 < VAR_0->channels; VAR_27++) { for (VAR_9=0; VAR_9<2; VAR_9++) VAR_24[VAR_27][VAR_9] = ea_adpcm_table[(*VAR_11 >> 4) + 4*VAR_9]; VAR_25[VAR_27] = 20 - (*VAR_11 & 0x0F); VAR_11++; } for (VAR_13 = 0; VAR_13 < VAR_15 / 2; VAR_13++) { for(VAR_9 = 4; VAR_9 >= 0; VAR_9-=4) { for(VAR_27 = 0; VAR_27 < VAR_0->channels; VAR_27++) { int32_t sample = sign_extend(VAR_11[VAR_27] >> VAR_9, 4) << VAR_25[VAR_27]; sample = (sample + c->status[VAR_27].sample1 * VAR_24[VAR_27][0] + c->status[VAR_27].sample2 * VAR_24[VAR_27][1] + 0x80) >> 8; c->status[VAR_27].sample2 = c->status[VAR_27].sample1; c->status[VAR_27].sample1 = av_clip_int16(sample); *VAR_10++ = c->status[VAR_27].sample1; } } VAR_11+=VAR_0->channels; } VAR_11 = VAR_4 + VAR_5; break; } case CODEC_ID_ADPCM_EA_R1: case CODEC_ID_ADPCM_EA_R2: case CODEC_ID_ADPCM_EA_R3: { const int VAR_26 = VAR_0->codec->id == CODEC_ID_ADPCM_EA_R3; int32_t previous_sample, current_sample, next_sample; int32_t coeff1, coeff2; uint8_t VAR_25; unsigned int VAR_27; uint16_t *samplesC; const uint8_t *VAR_27; const uint8_t *VAR_28 = VAR_4 + VAR_5; int VAR_36 = 0; VAR_11 += 4; for (VAR_27=0; VAR_27<VAR_0->channels; VAR_27++) { int32_t offset = (VAR_26 ? bytestream_get_be32(&VAR_11) : bytestream_get_le32(&VAR_11)) + (VAR_0->channels-VAR_27-1) * 4; if ((offset < 0) || (offset >= VAR_28 - VAR_11 - 4)) break; VAR_27 = VAR_11 + offset; samplesC = VAR_10 + VAR_27; if (VAR_0->codec->id == CODEC_ID_ADPCM_EA_R1) { current_sample = (int16_t)bytestream_get_le16(&VAR_27); previous_sample = (int16_t)bytestream_get_le16(&VAR_27); } else { current_sample = c->status[VAR_27].predictor; previous_sample = c->status[VAR_27].prev_sample; } for (VAR_13 = 0; VAR_13 < VAR_15 / 28; VAR_13++) { if (*VAR_27 == 0xEE) { VAR_27++; if (VAR_27 > VAR_28 - 30*2) break; current_sample = (int16_t)bytestream_get_be16(&VAR_27); previous_sample = (int16_t)bytestream_get_be16(&VAR_27); for (VAR_14=0; VAR_14<28; VAR_14++) { *samplesC = (int16_t)bytestream_get_be16(&VAR_27); samplesC += VAR_0->channels; } } else { coeff1 = ea_adpcm_table[ *VAR_27>>4 ]; coeff2 = ea_adpcm_table[(*VAR_27>>4) + 4]; VAR_25 = 20 - (*VAR_27++ & 0x0F); if (VAR_27 > VAR_28 - 14) break; for (VAR_14=0; VAR_14<28; VAR_14++) { if (VAR_14 & 1) next_sample = sign_extend(*VAR_27++, 4) << VAR_25; else next_sample = sign_extend(*VAR_27 >> 4, 4) << VAR_25; next_sample += (current_sample * coeff1) + (previous_sample * coeff2); next_sample = av_clip_int16(next_sample >> 8); previous_sample = current_sample; current_sample = next_sample; *samplesC = current_sample; samplesC += VAR_0->channels; } } } if (!VAR_36) { VAR_36 = VAR_13; } else if (VAR_36 != VAR_13) { av_log(VAR_0, AV_LOG_WARNING, "per-VAR_27 sample VAR_36 mismatch\VAR_6"); VAR_36 = FFMAX(VAR_36, VAR_13); } if (VAR_0->codec->id != CODEC_ID_ADPCM_EA_R1) { c->status[VAR_27].predictor = current_sample; c->status[VAR_27].prev_sample = previous_sample; } } c->frame.VAR_15 = VAR_36 * 28; VAR_11 = VAR_28; break; } case CODEC_ID_ADPCM_EA_XAS: for (VAR_27=0; VAR_27<VAR_0->channels; VAR_27++) { int VAR_24[2][4], VAR_25[4]; short *s2, *s = &VAR_10[VAR_27]; for (VAR_6=0; VAR_6<4; VAR_6++, s+=32*VAR_0->channels) { for (VAR_9=0; VAR_9<2; VAR_9++) VAR_24[VAR_9][VAR_6] = ea_adpcm_table[(VAR_11[0]&0x0F)+4*VAR_9]; VAR_25[VAR_6] = 20 - (VAR_11[2] & 0x0F); for (s2=s, VAR_9=0; VAR_9<2; VAR_9++, VAR_11+=2, s2+=VAR_0->channels) s2[0] = (VAR_11[0]&0xF0) + (VAR_11[1]<<8); } for (VAR_7=2; VAR_7<32; VAR_7+=2) { s = &VAR_10[VAR_7*VAR_0->channels + VAR_27]; for (VAR_6=0; VAR_6<4; VAR_6++, VAR_11++, s+=32*VAR_0->channels) { for (s2=s, VAR_9=0; VAR_9<8; VAR_9+=4, s2+=VAR_0->channels) { int level = sign_extend(*VAR_11 >> (4 - VAR_9), 4) << VAR_25[VAR_6]; int pred = s2[-1*VAR_0->channels] * VAR_24[0][VAR_6] + s2[-2*VAR_0->channels] * VAR_24[1][VAR_6]; s2[0] = av_clip_int16((level + pred + 0x80) >> 8); } } } } break; case CODEC_ID_ADPCM_IMA_AMV: case CODEC_ID_ADPCM_IMA_SMJPEG: if (VAR_0->codec->id == CODEC_ID_ADPCM_IMA_AMV) { c->status[0].predictor = sign_extend(bytestream_get_le16(&VAR_11), 16); c->status[0].step_index = av_clip(bytestream_get_le16(&VAR_11), 0, 88); VAR_11 += 4; } else { c->status[0].predictor = sign_extend(bytestream_get_be16(&VAR_11), 16); c->status[0].step_index = av_clip(bytestream_get_byte(&VAR_11), 0, 88); VAR_11 += 1; } for (VAR_6 = VAR_15 >> (1 - VAR_12); VAR_6 > 0; VAR_6--, VAR_11++) { char VAR_30, VAR_31; VAR_31 = *VAR_11 & 0x0F; VAR_30 = *VAR_11 >> 4; if (VAR_0->codec->id == CODEC_ID_ADPCM_IMA_AMV) FFSWAP(char, VAR_30, VAR_31); *VAR_10++ = adpcm_ima_expand_nibble(&c->status[0], VAR_31, 3); *VAR_10++ = adpcm_ima_expand_nibble(&c->status[0], VAR_30, 3); } break; case CODEC_ID_ADPCM_CT: for (VAR_6 = VAR_15 >> (1 - VAR_12); VAR_6 > 0; VAR_6--, VAR_11++) { uint8_t v = *VAR_11; *VAR_10++ = adpcm_ct_expand_nibble(&c->status[0 ], v >> 4 ); *VAR_10++ = adpcm_ct_expand_nibble(&c->status[VAR_12], v & 0x0F); } break; case CODEC_ID_ADPCM_SBPRO_4: case CODEC_ID_ADPCM_SBPRO_3: case CODEC_ID_ADPCM_SBPRO_2: if (!c->status[0].step_index) { *VAR_10++ = 128 * (*VAR_11++ - 0x80); if (VAR_12) *VAR_10++ = 128 * (*VAR_11++ - 0x80); c->status[0].step_index = 1; VAR_15--; } if (VAR_0->codec->id == CODEC_ID_ADPCM_SBPRO_4) { for (VAR_6 = VAR_15 >> (1 - VAR_12); VAR_6 > 0; VAR_6--, VAR_11++) { *VAR_10++ = adpcm_sbpro_expand_nibble(&c->status[0], VAR_11[0] >> 4, 4, 0); *VAR_10++ = adpcm_sbpro_expand_nibble(&c->status[VAR_12], VAR_11[0] & 0x0F, 4, 0); } } else if (VAR_0->codec->id == CODEC_ID_ADPCM_SBPRO_3) { for (VAR_6 = VAR_15 / 3; VAR_6 > 0; VAR_6--, VAR_11++) { *VAR_10++ = adpcm_sbpro_expand_nibble(&c->status[0], VAR_11[0] >> 5 , 3, 0); *VAR_10++ = adpcm_sbpro_expand_nibble(&c->status[0], (VAR_11[0] >> 2) & 0x07, 3, 0); *VAR_10++ = adpcm_sbpro_expand_nibble(&c->status[0], VAR_11[0] & 0x03, 2, 0); } } else { for (VAR_6 = VAR_15 >> (2 - VAR_12); VAR_6 > 0; VAR_6--, VAR_11++) { *VAR_10++ = adpcm_sbpro_expand_nibble(&c->status[0], VAR_11[0] >> 6 , 2, 2); *VAR_10++ = adpcm_sbpro_expand_nibble(&c->status[VAR_12], (VAR_11[0] >> 4) & 0x03, 2, 2); *VAR_10++ = adpcm_sbpro_expand_nibble(&c->status[0], (VAR_11[0] >> 2) & 0x03, 2, 2); *VAR_10++ = adpcm_sbpro_expand_nibble(&c->status[VAR_12], VAR_11[0] & 0x03, 2, 2); } } break; case CODEC_ID_ADPCM_SWF: { GetBitContext gb; const int *VAR_37; int VAR_33, VAR_34, VAR_35, VAR_36; int VAR_36 = VAR_5*8; init_get_bits(&gb, VAR_4, VAR_36); VAR_35 = get_bits(&gb, 2)+2; VAR_37 = swf_index_tables[VAR_35-2]; VAR_33 = 1 << (VAR_35-2); VAR_34 = 1 << (VAR_35-1); while (get_bits_count(&gb) <= VAR_36 - 22*VAR_0->channels) { for (VAR_9 = 0; VAR_9 < VAR_0->channels; VAR_9++) { *VAR_10++ = c->status[VAR_9].predictor = get_sbits(&gb, 16); c->status[VAR_9].step_index = get_bits(&gb, 6); } for (VAR_36 = 0; get_bits_count(&gb) <= VAR_36 - VAR_35*VAR_0->channels && VAR_36 < 4095; VAR_36++) { int VAR_9; for (VAR_9 = 0; VAR_9 < VAR_0->channels; VAR_9++) { int delta = get_bits(&gb, VAR_35); int step = ff_adpcm_step_table[c->status[VAR_9].step_index]; long vpdiff = 0; int k = VAR_33; do { if (delta & k) vpdiff += step; step >>= 1; k >>= 1; } while(k); vpdiff += step; if (delta & VAR_34) c->status[VAR_9].predictor -= vpdiff; else c->status[VAR_9].predictor += vpdiff; c->status[VAR_9].step_index += VAR_37[delta & (~VAR_34)]; c->status[VAR_9].step_index = av_clip(c->status[VAR_9].step_index, 0, 88); c->status[VAR_9].predictor = av_clip_int16(c->status[VAR_9].predictor); *VAR_10++ = c->status[VAR_9].predictor; } } } VAR_11 += VAR_5; break; } case CODEC_ID_ADPCM_YAMAHA: for (VAR_6 = VAR_15 >> (1 - VAR_12); VAR_6 > 0; VAR_6--, VAR_11++) { uint8_t v = *VAR_11; *VAR_10++ = adpcm_yamaha_expand_nibble(&c->status[0 ], v & 0x0F); *VAR_10++ = adpcm_yamaha_expand_nibble(&c->status[VAR_12], v >> 4 ); } break; case CODEC_ID_ADPCM_THP: { int VAR_37[2][16]; int VAR_37[2][2]; int VAR_38; VAR_11 += 4; VAR_11 += 4; for (VAR_9 = 0; VAR_9 < 32; VAR_9++) VAR_37[0][VAR_9] = (int16_t)bytestream_get_be16(&VAR_11); for (VAR_9 = 0; VAR_9 < 4; VAR_9++) VAR_37[0][VAR_9] = (int16_t)bytestream_get_be16(&VAR_11); for (VAR_38 = 0; VAR_38 <= VAR_12; VAR_38++) { VAR_10 = (short *)c->frame.VAR_1[0] + VAR_38; for (VAR_9 = 0; VAR_9 < VAR_15 / 14; VAR_9++) { int VAR_39 = (*VAR_11 >> 4) & 7; unsigned int VAR_40 = *VAR_11++ & 15; int VAR_41 = VAR_37[VAR_38][VAR_39 * 2]; int VAR_42 = VAR_37[VAR_38][VAR_39 * 2 + 1]; for (VAR_6 = 0; VAR_6 < 14; VAR_6++) { int32_t sampledat; if(VAR_6&1) sampledat = sign_extend(*VAR_11++, 4); else sampledat = sign_extend(*VAR_11 >> 4, 4); sampledat = ((VAR_37[VAR_38][0]*VAR_41 + VAR_37[VAR_38][1]*VAR_42) >> 11) + (sampledat << VAR_40); *VAR_10 = av_clip_int16(sampledat); VAR_37[VAR_38][1] = VAR_37[VAR_38][0]; VAR_37[VAR_38][0] = *VAR_10++; VAR_10 += VAR_12; } } } break; } default: return -1; } *VAR_2 = 1; *(AVFrame *)VAR_1 = c->frame; return VAR_11 - VAR_4; }
[ "static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1,\nint *VAR_2, AVPacket *VAR_3)\n{", "const uint8_t *VAR_4 = VAR_3->VAR_1;", "int VAR_5 = VAR_3->VAR_36;", "ADPCMDecodeContext *c = VAR_0->priv_data;", "ADPCMChannelStatus *cs;", "int VAR_6, VAR_7, VAR_27, VAR_9;", "short *VAR_10;", "const uint8_t *VAR_11;", "int VAR_12;", "int VAR_13, VAR_14;", "int VAR_15, VAR_16, VAR_17;", "VAR_15 = get_nb_samples(VAR_0, VAR_4, VAR_5, &VAR_16);", "if (VAR_15 <= 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"invalid number of VAR_10 in packet\\VAR_6\");", "return AVERROR_INVALIDDATA;", "}", "c->frame.VAR_15 = VAR_15;", "if ((VAR_17 = VAR_0->get_buffer(VAR_0, &c->frame)) < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"get_buffer() failed\\VAR_6\");", "return VAR_17;", "}", "VAR_10 = (short *)c->frame.VAR_1[0];", "if (VAR_16) {", "if (VAR_16 != VAR_15)\nav_log(VAR_0, AV_LOG_WARNING, \"mismatch in coded sample VAR_36\\VAR_6\");", "c->frame.VAR_15 = VAR_15 = VAR_16;", "}", "VAR_11 = VAR_4;", "VAR_12 = VAR_0->channels == 2 ? 1 : 0;", "switch(VAR_0->codec->id) {", "case CODEC_ID_ADPCM_IMA_QT:\nfor (VAR_27 = 0; VAR_27 < VAR_0->channels; VAR_27++) {", "int16_t predictor;", "int step_index;", "cs = &(c->status[VAR_27]);", "predictor = AV_RB16(VAR_11);", "step_index = predictor & 0x7F;", "predictor &= 0xFF80;", "VAR_11 += 2;", "if (cs->step_index == step_index) {", "int diff = (int)predictor - cs->predictor;", "if (diff < 0)\ndiff = - diff;", "if (diff > 0x7f)\ngoto update;", "} else {", "update:\ncs->step_index = step_index;", "cs->predictor = predictor;", "}", "if (cs->step_index > 88){", "av_log(VAR_0, AV_LOG_ERROR, \"ERROR: step_index = %VAR_9\\VAR_6\", cs->step_index);", "cs->step_index = 88;", "}", "VAR_10 = (short *)c->frame.VAR_1[0] + VAR_27;", "for (VAR_7 = 0; VAR_7 < 32; VAR_7++) {", "*VAR_10 = adpcm_ima_qt_expand_nibble(cs, VAR_11[0] & 0x0F, 3);", "VAR_10 += VAR_0->channels;", "*VAR_10 = adpcm_ima_qt_expand_nibble(cs, VAR_11[0] >> 4 , 3);", "VAR_10 += VAR_0->channels;", "VAR_11 ++;", "}", "}", "break;", "case CODEC_ID_ADPCM_IMA_WAV:\nif (VAR_0->block_align != 0 && VAR_5 > VAR_0->block_align)\nVAR_5 = VAR_0->block_align;", "for(VAR_9=0; VAR_9<VAR_0->channels; VAR_9++){", "cs = &(c->status[VAR_9]);", "cs->predictor = *VAR_10++ = (int16_t)bytestream_get_le16(&VAR_11);", "cs->step_index = *VAR_11++;", "if (cs->step_index > 88){", "av_log(VAR_0, AV_LOG_ERROR, \"ERROR: step_index = %VAR_9\\VAR_6\", cs->step_index);", "cs->step_index = 88;", "}", "if (*VAR_11++) av_log(VAR_0, AV_LOG_ERROR, \"unused byte should be null but is %d!!\\VAR_6\", VAR_11[-1]);", "}", "for (VAR_6 = (VAR_15 - 1) / 8; VAR_6 > 0; VAR_6--) {", "for (VAR_9 = 0; VAR_9 < VAR_0->channels; VAR_9++) {", "cs = &c->status[VAR_9];", "for (VAR_7 = 0; VAR_7 < 4; VAR_7++) {", "uint8_t v = *VAR_11++;", "*VAR_10 = adpcm_ima_expand_nibble(cs, v & 0x0F, 3);", "VAR_10 += VAR_0->channels;", "*VAR_10 = adpcm_ima_expand_nibble(cs, v >> 4 , 3);", "VAR_10 += VAR_0->channels;", "}", "VAR_10 -= 8 * VAR_0->channels - 1;", "}", "VAR_10 += 7 * VAR_0->channels;", "}", "break;", "case CODEC_ID_ADPCM_4XM:\nfor (VAR_9 = 0; VAR_9 < VAR_0->channels; VAR_9++)", "c->status[VAR_9].predictor= (int16_t)bytestream_get_le16(&VAR_11);", "for (VAR_9 = 0; VAR_9 < VAR_0->channels; VAR_9++) {", "c->status[VAR_9].step_index= (int16_t)bytestream_get_le16(&VAR_11);", "c->status[VAR_9].step_index = av_clip(c->status[VAR_9].step_index, 0, 88);", "}", "for (VAR_9 = 0; VAR_9 < VAR_0->channels; VAR_9++) {", "VAR_10 = (short *)c->frame.VAR_1[0] + VAR_9;", "cs = &c->status[VAR_9];", "for (VAR_6 = VAR_15 >> 1; VAR_6 > 0; VAR_6--, VAR_11++) {", "uint8_t v = *VAR_11;", "*VAR_10 = adpcm_ima_expand_nibble(cs, v & 0x0F, 4);", "VAR_10 += VAR_0->channels;", "*VAR_10 = adpcm_ima_expand_nibble(cs, v >> 4 , 4);", "VAR_10 += VAR_0->channels;", "}", "}", "break;", "case CODEC_ID_ADPCM_MS:\n{", "int VAR_18;", "if (VAR_0->block_align != 0 && VAR_5 > VAR_0->block_align)\nVAR_5 = VAR_0->block_align;", "VAR_18 = av_clip(*VAR_11++, 0, 6);", "c->status[0].coeff1 = ff_adpcm_AdaptCoeff1[VAR_18];", "c->status[0].coeff2 = ff_adpcm_AdaptCoeff2[VAR_18];", "if (VAR_12) {", "VAR_18 = av_clip(*VAR_11++, 0, 6);", "c->status[1].coeff1 = ff_adpcm_AdaptCoeff1[VAR_18];", "c->status[1].coeff2 = ff_adpcm_AdaptCoeff2[VAR_18];", "}", "c->status[0].idelta = (int16_t)bytestream_get_le16(&VAR_11);", "if (VAR_12){", "c->status[1].idelta = (int16_t)bytestream_get_le16(&VAR_11);", "}", "c->status[0].sample1 = bytestream_get_le16(&VAR_11);", "if (VAR_12) c->status[1].sample1 = bytestream_get_le16(&VAR_11);", "c->status[0].sample2 = bytestream_get_le16(&VAR_11);", "if (VAR_12) c->status[1].sample2 = bytestream_get_le16(&VAR_11);", "*VAR_10++ = c->status[0].sample2;", "if (VAR_12) *VAR_10++ = c->status[1].sample2;", "*VAR_10++ = c->status[0].sample1;", "if (VAR_12) *VAR_10++ = c->status[1].sample1;", "for(VAR_6 = (VAR_15 - 2) >> (1 - VAR_12); VAR_6 > 0; VAR_6--, VAR_11++) {", "*VAR_10++ = adpcm_ms_expand_nibble(&c->status[0 ], VAR_11[0] >> 4 );", "*VAR_10++ = adpcm_ms_expand_nibble(&c->status[VAR_12], VAR_11[0] & 0x0F);", "}", "break;", "}", "case CODEC_ID_ADPCM_IMA_DK4:\nif (VAR_0->block_align != 0 && VAR_5 > VAR_0->block_align)\nVAR_5 = VAR_0->block_align;", "for (VAR_27 = 0; VAR_27 < VAR_0->channels; VAR_27++) {", "cs = &c->status[VAR_27];", "cs->predictor = (int16_t)bytestream_get_le16(&VAR_11);", "cs->step_index = av_clip(*VAR_11++, 0, 88);", "VAR_11++;", "*VAR_10++ = cs->predictor;", "}", "for (VAR_6 = VAR_15 >> (1 - VAR_12); VAR_6 > 0; VAR_6--, VAR_11++) {", "uint8_t v = *VAR_11;", "*VAR_10++ = adpcm_ima_expand_nibble(&c->status[0 ], v >> 4 , 3);", "*VAR_10++ = adpcm_ima_expand_nibble(&c->status[VAR_12], v & 0x0F, 3);", "}", "break;", "case CODEC_ID_ADPCM_IMA_DK3:\n{", "unsigned char VAR_19 = 0;", "unsigned char VAR_20;", "int VAR_21 = 0;", "int VAR_22 = 0;", "int VAR_23;", "if (VAR_0->block_align != 0 && VAR_5 > VAR_0->block_align)\nVAR_5 = VAR_0->block_align;", "c->status[0].predictor = (int16_t)AV_RL16(VAR_11 + 10);", "c->status[1].predictor = (int16_t)AV_RL16(VAR_11 + 12);", "c->status[0].step_index = av_clip(VAR_11[14], 0, 88);", "c->status[1].step_index = av_clip(VAR_11[15], 0, 88);", "VAR_11 += 16;", "VAR_23 = c->status[1].predictor;", "while (1) {", "DK3_GET_NEXT_NIBBLE();", "adpcm_ima_expand_nibble(&c->status[0], VAR_20, 3);", "DK3_GET_NEXT_NIBBLE();", "adpcm_ima_expand_nibble(&c->status[1], VAR_20, 3);", "VAR_23 = (VAR_23 + c->status[1].predictor) / 2;", "*VAR_10++ = c->status[0].predictor + c->status[1].predictor;", "*VAR_10++ = c->status[0].predictor - c->status[1].predictor;", "DK3_GET_NEXT_NIBBLE();", "adpcm_ima_expand_nibble(&c->status[0], VAR_20, 3);", "VAR_23 = (VAR_23 + c->status[1].predictor) / 2;", "*VAR_10++ = c->status[0].predictor + c->status[1].predictor;", "*VAR_10++ = c->status[0].predictor - c->status[1].predictor;", "}", "break;", "}", "case CODEC_ID_ADPCM_IMA_ISS:\nfor (VAR_27 = 0; VAR_27 < VAR_0->channels; VAR_27++) {", "cs = &c->status[VAR_27];", "cs->predictor = (int16_t)bytestream_get_le16(&VAR_11);", "cs->step_index = av_clip(*VAR_11++, 0, 88);", "VAR_11++;", "}", "for (VAR_6 = VAR_15 >> (1 - VAR_12); VAR_6 > 0; VAR_6--, VAR_11++) {", "uint8_t v1, v2;", "uint8_t v = *VAR_11;", "if (VAR_12) {", "v1 = v >> 4;", "v2 = v & 0x0F;", "} else {", "v2 = v >> 4;", "v1 = v & 0x0F;", "}", "*VAR_10++ = adpcm_ima_expand_nibble(&c->status[0 ], v1, 3);", "*VAR_10++ = adpcm_ima_expand_nibble(&c->status[VAR_12], v2, 3);", "}", "break;", "case CODEC_ID_ADPCM_IMA_APC:\nwhile (VAR_11 < VAR_4 + VAR_5) {", "uint8_t v = *VAR_11++;", "*VAR_10++ = adpcm_ima_expand_nibble(&c->status[0], v >> 4 , 3);", "*VAR_10++ = adpcm_ima_expand_nibble(&c->status[VAR_12], v & 0x0F, 3);", "}", "break;", "case CODEC_ID_ADPCM_IMA_WS:\nfor (VAR_27 = 0; VAR_27 < VAR_0->channels; VAR_27++) {", "const uint8_t *src0;", "int src_stride;", "int16_t *smp = VAR_10 + VAR_27;", "if (c->vqa_version == 3) {", "src0 = VAR_11 + VAR_27 * VAR_5 / 2;", "src_stride = 1;", "} else {", "src0 = VAR_11 + VAR_27;", "src_stride = VAR_0->channels;", "}", "for (VAR_6 = VAR_15 / 2; VAR_6 > 0; VAR_6--) {", "uint8_t v = *src0;", "src0 += src_stride;", "*smp = adpcm_ima_expand_nibble(&c->status[VAR_27], v >> 4 , 3);", "smp += VAR_0->channels;", "*smp = adpcm_ima_expand_nibble(&c->status[VAR_27], v & 0x0F, 3);", "smp += VAR_0->channels;", "}", "}", "VAR_11 = VAR_4 + VAR_5;", "break;", "case CODEC_ID_ADPCM_XA:\nwhile (VAR_5 >= 128) {", "xa_decode(VAR_10, VAR_11, &c->status[0], &c->status[1],\nVAR_0->channels);", "VAR_11 += 128;", "VAR_10 += 28 * 8;", "VAR_5 -= 128;", "}", "break;", "case CODEC_ID_ADPCM_IMA_EA_EACS:\nVAR_11 += 4;", "for (VAR_9=0; VAR_9<=VAR_12; VAR_9++)", "c->status[VAR_9].step_index = av_clip(bytestream_get_le32(&VAR_11), 0, 88);", "for (VAR_9=0; VAR_9<=VAR_12; VAR_9++)", "c->status[VAR_9].predictor = bytestream_get_le32(&VAR_11);", "for (VAR_6 = VAR_15 >> (1 - VAR_12); VAR_6 > 0; VAR_6--, VAR_11++) {", "*VAR_10++ = adpcm_ima_expand_nibble(&c->status[0], *VAR_11>>4, 3);", "*VAR_10++ = adpcm_ima_expand_nibble(&c->status[VAR_12], *VAR_11&0x0F, 3);", "}", "break;", "case CODEC_ID_ADPCM_IMA_EA_SEAD:\nfor (VAR_6 = VAR_15 >> (1 - VAR_12); VAR_6 > 0; VAR_6--, VAR_11++) {", "*VAR_10++ = adpcm_ima_expand_nibble(&c->status[0], VAR_11[0] >> 4, 6);", "*VAR_10++ = adpcm_ima_expand_nibble(&c->status[VAR_12],VAR_11[0]&0x0F, 6);", "}", "break;", "case CODEC_ID_ADPCM_EA:\n{", "int32_t previous_left_sample, previous_right_sample;", "int32_t current_left_sample, current_right_sample;", "int32_t next_left_sample, next_right_sample;", "int32_t coeff1l, coeff2l, coeff1r, coeff2r;", "uint8_t shift_left, shift_right;", "VAR_11 += 4;", "current_left_sample = (int16_t)bytestream_get_le16(&VAR_11);", "previous_left_sample = (int16_t)bytestream_get_le16(&VAR_11);", "current_right_sample = (int16_t)bytestream_get_le16(&VAR_11);", "previous_right_sample = (int16_t)bytestream_get_le16(&VAR_11);", "for (VAR_13 = 0; VAR_13 < VAR_15 / 28; VAR_13++) {", "coeff1l = ea_adpcm_table[ *VAR_11 >> 4 ];", "coeff2l = ea_adpcm_table[(*VAR_11 >> 4 ) + 4];", "coeff1r = ea_adpcm_table[*VAR_11 & 0x0F];", "coeff2r = ea_adpcm_table[(*VAR_11 & 0x0F) + 4];", "VAR_11++;", "shift_left = 20 - (*VAR_11 >> 4);", "shift_right = 20 - (*VAR_11 & 0x0F);", "VAR_11++;", "for (VAR_14 = 0; VAR_14 < 28; VAR_14++) {", "next_left_sample = sign_extend(*VAR_11 >> 4, 4) << shift_left;", "next_right_sample = sign_extend(*VAR_11, 4) << shift_right;", "VAR_11++;", "next_left_sample = (next_left_sample +\n(current_left_sample * coeff1l) +\n(previous_left_sample * coeff2l) + 0x80) >> 8;", "next_right_sample = (next_right_sample +\n(current_right_sample * coeff1r) +\n(previous_right_sample * coeff2r) + 0x80) >> 8;", "previous_left_sample = current_left_sample;", "current_left_sample = av_clip_int16(next_left_sample);", "previous_right_sample = current_right_sample;", "current_right_sample = av_clip_int16(next_right_sample);", "*VAR_10++ = (unsigned short)current_left_sample;", "*VAR_10++ = (unsigned short)current_right_sample;", "}", "}", "if (VAR_11 - VAR_4 == VAR_5 - 2)\nVAR_11 += 2;", "break;", "}", "case CODEC_ID_ADPCM_EA_MAXIS_XA:\n{", "int VAR_24[2][2], VAR_25[2];", "for(VAR_27 = 0; VAR_27 < VAR_0->channels; VAR_27++) {", "for (VAR_9=0; VAR_9<2; VAR_9++)", "VAR_24[VAR_27][VAR_9] = ea_adpcm_table[(*VAR_11 >> 4) + 4*VAR_9];", "VAR_25[VAR_27] = 20 - (*VAR_11 & 0x0F);", "VAR_11++;", "}", "for (VAR_13 = 0; VAR_13 < VAR_15 / 2; VAR_13++) {", "for(VAR_9 = 4; VAR_9 >= 0; VAR_9-=4) {", "for(VAR_27 = 0; VAR_27 < VAR_0->channels; VAR_27++) {", "int32_t sample = sign_extend(VAR_11[VAR_27] >> VAR_9, 4) << VAR_25[VAR_27];", "sample = (sample +\nc->status[VAR_27].sample1 * VAR_24[VAR_27][0] +\nc->status[VAR_27].sample2 * VAR_24[VAR_27][1] + 0x80) >> 8;", "c->status[VAR_27].sample2 = c->status[VAR_27].sample1;", "c->status[VAR_27].sample1 = av_clip_int16(sample);", "*VAR_10++ = c->status[VAR_27].sample1;", "}", "}", "VAR_11+=VAR_0->channels;", "}", "VAR_11 = VAR_4 + VAR_5;", "break;", "}", "case CODEC_ID_ADPCM_EA_R1:\ncase CODEC_ID_ADPCM_EA_R2:\ncase CODEC_ID_ADPCM_EA_R3: {", "const int VAR_26 = VAR_0->codec->id == CODEC_ID_ADPCM_EA_R3;", "int32_t previous_sample, current_sample, next_sample;", "int32_t coeff1, coeff2;", "uint8_t VAR_25;", "unsigned int VAR_27;", "uint16_t *samplesC;", "const uint8_t *VAR_27;", "const uint8_t *VAR_28 = VAR_4 + VAR_5;", "int VAR_36 = 0;", "VAR_11 += 4;", "for (VAR_27=0; VAR_27<VAR_0->channels; VAR_27++) {", "int32_t offset = (VAR_26 ? bytestream_get_be32(&VAR_11)\n: bytestream_get_le32(&VAR_11))\n+ (VAR_0->channels-VAR_27-1) * 4;", "if ((offset < 0) || (offset >= VAR_28 - VAR_11 - 4)) break;", "VAR_27 = VAR_11 + offset;", "samplesC = VAR_10 + VAR_27;", "if (VAR_0->codec->id == CODEC_ID_ADPCM_EA_R1) {", "current_sample = (int16_t)bytestream_get_le16(&VAR_27);", "previous_sample = (int16_t)bytestream_get_le16(&VAR_27);", "} else {", "current_sample = c->status[VAR_27].predictor;", "previous_sample = c->status[VAR_27].prev_sample;", "}", "for (VAR_13 = 0; VAR_13 < VAR_15 / 28; VAR_13++) {", "if (*VAR_27 == 0xEE) {", "VAR_27++;", "if (VAR_27 > VAR_28 - 30*2) break;", "current_sample = (int16_t)bytestream_get_be16(&VAR_27);", "previous_sample = (int16_t)bytestream_get_be16(&VAR_27);", "for (VAR_14=0; VAR_14<28; VAR_14++) {", "*samplesC = (int16_t)bytestream_get_be16(&VAR_27);", "samplesC += VAR_0->channels;", "}", "} else {", "coeff1 = ea_adpcm_table[ *VAR_27>>4 ];", "coeff2 = ea_adpcm_table[(*VAR_27>>4) + 4];", "VAR_25 = 20 - (*VAR_27++ & 0x0F);", "if (VAR_27 > VAR_28 - 14) break;", "for (VAR_14=0; VAR_14<28; VAR_14++) {", "if (VAR_14 & 1)\nnext_sample = sign_extend(*VAR_27++, 4) << VAR_25;", "else\nnext_sample = sign_extend(*VAR_27 >> 4, 4) << VAR_25;", "next_sample += (current_sample * coeff1) +\n(previous_sample * coeff2);", "next_sample = av_clip_int16(next_sample >> 8);", "previous_sample = current_sample;", "current_sample = next_sample;", "*samplesC = current_sample;", "samplesC += VAR_0->channels;", "}", "}", "}", "if (!VAR_36) {", "VAR_36 = VAR_13;", "} else if (VAR_36 != VAR_13) {", "av_log(VAR_0, AV_LOG_WARNING, \"per-VAR_27 sample VAR_36 mismatch\\VAR_6\");", "VAR_36 = FFMAX(VAR_36, VAR_13);", "}", "if (VAR_0->codec->id != CODEC_ID_ADPCM_EA_R1) {", "c->status[VAR_27].predictor = current_sample;", "c->status[VAR_27].prev_sample = previous_sample;", "}", "}", "c->frame.VAR_15 = VAR_36 * 28;", "VAR_11 = VAR_28;", "break;", "}", "case CODEC_ID_ADPCM_EA_XAS:\nfor (VAR_27=0; VAR_27<VAR_0->channels; VAR_27++) {", "int VAR_24[2][4], VAR_25[4];", "short *s2, *s = &VAR_10[VAR_27];", "for (VAR_6=0; VAR_6<4; VAR_6++, s+=32*VAR_0->channels) {", "for (VAR_9=0; VAR_9<2; VAR_9++)", "VAR_24[VAR_9][VAR_6] = ea_adpcm_table[(VAR_11[0]&0x0F)+4*VAR_9];", "VAR_25[VAR_6] = 20 - (VAR_11[2] & 0x0F);", "for (s2=s, VAR_9=0; VAR_9<2; VAR_9++, VAR_11+=2, s2+=VAR_0->channels)", "s2[0] = (VAR_11[0]&0xF0) + (VAR_11[1]<<8);", "}", "for (VAR_7=2; VAR_7<32; VAR_7+=2) {", "s = &VAR_10[VAR_7*VAR_0->channels + VAR_27];", "for (VAR_6=0; VAR_6<4; VAR_6++, VAR_11++, s+=32*VAR_0->channels) {", "for (s2=s, VAR_9=0; VAR_9<8; VAR_9+=4, s2+=VAR_0->channels) {", "int level = sign_extend(*VAR_11 >> (4 - VAR_9), 4) << VAR_25[VAR_6];", "int pred = s2[-1*VAR_0->channels] * VAR_24[0][VAR_6]\n+ s2[-2*VAR_0->channels] * VAR_24[1][VAR_6];", "s2[0] = av_clip_int16((level + pred + 0x80) >> 8);", "}", "}", "}", "}", "break;", "case CODEC_ID_ADPCM_IMA_AMV:\ncase CODEC_ID_ADPCM_IMA_SMJPEG:\nif (VAR_0->codec->id == CODEC_ID_ADPCM_IMA_AMV) {", "c->status[0].predictor = sign_extend(bytestream_get_le16(&VAR_11), 16);", "c->status[0].step_index = av_clip(bytestream_get_le16(&VAR_11), 0, 88);", "VAR_11 += 4;", "} else {", "c->status[0].predictor = sign_extend(bytestream_get_be16(&VAR_11), 16);", "c->status[0].step_index = av_clip(bytestream_get_byte(&VAR_11), 0, 88);", "VAR_11 += 1;", "}", "for (VAR_6 = VAR_15 >> (1 - VAR_12); VAR_6 > 0; VAR_6--, VAR_11++) {", "char VAR_30, VAR_31;", "VAR_31 = *VAR_11 & 0x0F;", "VAR_30 = *VAR_11 >> 4;", "if (VAR_0->codec->id == CODEC_ID_ADPCM_IMA_AMV)\nFFSWAP(char, VAR_30, VAR_31);", "*VAR_10++ = adpcm_ima_expand_nibble(&c->status[0],\nVAR_31, 3);", "*VAR_10++ = adpcm_ima_expand_nibble(&c->status[0],\nVAR_30, 3);", "}", "break;", "case CODEC_ID_ADPCM_CT:\nfor (VAR_6 = VAR_15 >> (1 - VAR_12); VAR_6 > 0; VAR_6--, VAR_11++) {", "uint8_t v = *VAR_11;", "*VAR_10++ = adpcm_ct_expand_nibble(&c->status[0 ], v >> 4 );", "*VAR_10++ = adpcm_ct_expand_nibble(&c->status[VAR_12], v & 0x0F);", "}", "break;", "case CODEC_ID_ADPCM_SBPRO_4:\ncase CODEC_ID_ADPCM_SBPRO_3:\ncase CODEC_ID_ADPCM_SBPRO_2:\nif (!c->status[0].step_index) {", "*VAR_10++ = 128 * (*VAR_11++ - 0x80);", "if (VAR_12)\n*VAR_10++ = 128 * (*VAR_11++ - 0x80);", "c->status[0].step_index = 1;", "VAR_15--;", "}", "if (VAR_0->codec->id == CODEC_ID_ADPCM_SBPRO_4) {", "for (VAR_6 = VAR_15 >> (1 - VAR_12); VAR_6 > 0; VAR_6--, VAR_11++) {", "*VAR_10++ = adpcm_sbpro_expand_nibble(&c->status[0],\nVAR_11[0] >> 4, 4, 0);", "*VAR_10++ = adpcm_sbpro_expand_nibble(&c->status[VAR_12],\nVAR_11[0] & 0x0F, 4, 0);", "}", "} else if (VAR_0->codec->id == CODEC_ID_ADPCM_SBPRO_3) {", "for (VAR_6 = VAR_15 / 3; VAR_6 > 0; VAR_6--, VAR_11++) {", "*VAR_10++ = adpcm_sbpro_expand_nibble(&c->status[0],\nVAR_11[0] >> 5 , 3, 0);", "*VAR_10++ = adpcm_sbpro_expand_nibble(&c->status[0],\n(VAR_11[0] >> 2) & 0x07, 3, 0);", "*VAR_10++ = adpcm_sbpro_expand_nibble(&c->status[0],\nVAR_11[0] & 0x03, 2, 0);", "}", "} else {", "for (VAR_6 = VAR_15 >> (2 - VAR_12); VAR_6 > 0; VAR_6--, VAR_11++) {", "*VAR_10++ = adpcm_sbpro_expand_nibble(&c->status[0],\nVAR_11[0] >> 6 , 2, 2);", "*VAR_10++ = adpcm_sbpro_expand_nibble(&c->status[VAR_12],\n(VAR_11[0] >> 4) & 0x03, 2, 2);", "*VAR_10++ = adpcm_sbpro_expand_nibble(&c->status[0],\n(VAR_11[0] >> 2) & 0x03, 2, 2);", "*VAR_10++ = adpcm_sbpro_expand_nibble(&c->status[VAR_12],\nVAR_11[0] & 0x03, 2, 2);", "}", "}", "break;", "case CODEC_ID_ADPCM_SWF:\n{", "GetBitContext gb;", "const int *VAR_37;", "int VAR_33, VAR_34, VAR_35, VAR_36;", "int VAR_36 = VAR_5*8;", "init_get_bits(&gb, VAR_4, VAR_36);", "VAR_35 = get_bits(&gb, 2)+2;", "VAR_37 = swf_index_tables[VAR_35-2];", "VAR_33 = 1 << (VAR_35-2);", "VAR_34 = 1 << (VAR_35-1);", "while (get_bits_count(&gb) <= VAR_36 - 22*VAR_0->channels) {", "for (VAR_9 = 0; VAR_9 < VAR_0->channels; VAR_9++) {", "*VAR_10++ = c->status[VAR_9].predictor = get_sbits(&gb, 16);", "c->status[VAR_9].step_index = get_bits(&gb, 6);", "}", "for (VAR_36 = 0; get_bits_count(&gb) <= VAR_36 - VAR_35*VAR_0->channels && VAR_36 < 4095; VAR_36++) {", "int VAR_9;", "for (VAR_9 = 0; VAR_9 < VAR_0->channels; VAR_9++) {", "int delta = get_bits(&gb, VAR_35);", "int step = ff_adpcm_step_table[c->status[VAR_9].step_index];", "long vpdiff = 0;", "int k = VAR_33;", "do {", "if (delta & k)\nvpdiff += step;", "step >>= 1;", "k >>= 1;", "} while(k);", "vpdiff += step;", "if (delta & VAR_34)\nc->status[VAR_9].predictor -= vpdiff;", "else\nc->status[VAR_9].predictor += vpdiff;", "c->status[VAR_9].step_index += VAR_37[delta & (~VAR_34)];", "c->status[VAR_9].step_index = av_clip(c->status[VAR_9].step_index, 0, 88);", "c->status[VAR_9].predictor = av_clip_int16(c->status[VAR_9].predictor);", "*VAR_10++ = c->status[VAR_9].predictor;", "}", "}", "}", "VAR_11 += VAR_5;", "break;", "}", "case CODEC_ID_ADPCM_YAMAHA:\nfor (VAR_6 = VAR_15 >> (1 - VAR_12); VAR_6 > 0; VAR_6--, VAR_11++) {", "uint8_t v = *VAR_11;", "*VAR_10++ = adpcm_yamaha_expand_nibble(&c->status[0 ], v & 0x0F);", "*VAR_10++ = adpcm_yamaha_expand_nibble(&c->status[VAR_12], v >> 4 );", "}", "break;", "case CODEC_ID_ADPCM_THP:\n{", "int VAR_37[2][16];", "int VAR_37[2][2];", "int VAR_38;", "VAR_11 += 4;", "VAR_11 += 4;", "for (VAR_9 = 0; VAR_9 < 32; VAR_9++)", "VAR_37[0][VAR_9] = (int16_t)bytestream_get_be16(&VAR_11);", "for (VAR_9 = 0; VAR_9 < 4; VAR_9++)", "VAR_37[0][VAR_9] = (int16_t)bytestream_get_be16(&VAR_11);", "for (VAR_38 = 0; VAR_38 <= VAR_12; VAR_38++) {", "VAR_10 = (short *)c->frame.VAR_1[0] + VAR_38;", "for (VAR_9 = 0; VAR_9 < VAR_15 / 14; VAR_9++) {", "int VAR_39 = (*VAR_11 >> 4) & 7;", "unsigned int VAR_40 = *VAR_11++ & 15;", "int VAR_41 = VAR_37[VAR_38][VAR_39 * 2];", "int VAR_42 = VAR_37[VAR_38][VAR_39 * 2 + 1];", "for (VAR_6 = 0; VAR_6 < 14; VAR_6++) {", "int32_t sampledat;", "if(VAR_6&1) sampledat = sign_extend(*VAR_11++, 4);", "else sampledat = sign_extend(*VAR_11 >> 4, 4);", "sampledat = ((VAR_37[VAR_38][0]*VAR_41\n+ VAR_37[VAR_38][1]*VAR_42) >> 11) + (sampledat << VAR_40);", "*VAR_10 = av_clip_int16(sampledat);", "VAR_37[VAR_38][1] = VAR_37[VAR_38][0];", "VAR_37[VAR_38][0] = *VAR_10++;", "VAR_10 += VAR_12;", "}", "}", "}", "break;", "}", "default:\nreturn -1;", "}", "*VAR_2 = 1;", "*(AVFrame *)VAR_1 = c->frame;", "return VAR_11 - VAR_4;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 61 ], [ 63, 65 ], [ 67 ], [ 69 ], [ 73 ], [ 77 ], [ 81 ], [ 83, 89 ], [ 91 ], [ 93 ], [ 95 ], [ 103 ], [ 105 ], [ 107 ], [ 111 ], [ 115 ], [ 117 ], [ 119, 121 ], [ 123, 125 ], [ 127 ], [ 129, 131 ], [ 133 ], [ 135 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 149 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171, 173, 175 ], [ 179 ], [ 181 ], [ 183 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233, 235 ], [ 237 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275, 277 ], [ 279 ], [ 283, 285 ], [ 289 ], [ 291 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305 ], [ 307 ], [ 309 ], [ 311 ], [ 315 ], [ 317 ], [ 319 ], [ 321 ], [ 325 ], [ 327 ], [ 329 ], [ 331 ], [ 333 ], [ 335 ], [ 337 ], [ 339 ], [ 341 ], [ 343 ], [ 345, 347, 349 ], [ 353 ], [ 355 ], [ 357 ], [ 359 ], [ 361 ], [ 363 ], [ 365 ], [ 367 ], [ 369 ], [ 371 ], [ 373 ], [ 375 ], [ 377 ], [ 379, 381 ], [ 383 ], [ 385 ], [ 387 ], [ 389 ], [ 391 ], [ 395, 397 ], [ 401 ], [ 403 ], [ 405 ], [ 407 ], [ 411 ], [ 413 ], [ 421 ], [ 433 ], [ 435 ], [ 441 ], [ 443 ], [ 449 ], [ 451 ], [ 453 ], [ 459 ], [ 461 ], [ 467 ], [ 469 ], [ 471 ], [ 473 ], [ 475 ], [ 477 ], [ 479, 481 ], [ 483 ], [ 485 ], [ 487 ], [ 489 ], [ 491 ], [ 495 ], [ 497 ], [ 499 ], [ 503 ], [ 505 ], [ 507 ], [ 509 ], [ 511 ], [ 513 ], [ 515 ], [ 517 ], [ 519 ], [ 521 ], [ 523 ], [ 525, 527 ], [ 529 ], [ 531 ], [ 533 ], [ 535 ], [ 537 ], [ 539, 541 ], [ 543 ], [ 545 ], [ 547 ], [ 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 ], [ 611 ], [ 613 ], [ 615 ], [ 617 ], [ 621 ], [ 623 ], [ 625 ], [ 627 ], [ 629 ], [ 631, 633 ], [ 635 ], [ 637 ], [ 639 ], [ 641 ], [ 643, 645 ], [ 647 ], [ 649 ], [ 651 ], [ 653 ], [ 655 ], [ 665 ], [ 669 ], [ 671 ], [ 673 ], [ 675 ], [ 679 ], [ 681 ], [ 683 ], [ 685 ], [ 687 ], [ 689 ], [ 693 ], [ 695 ], [ 697 ], [ 701 ], [ 703 ], [ 705 ], [ 707 ], [ 711, 713, 715 ], [ 717, 719, 721 ], [ 725 ], [ 727 ], [ 729 ], [ 731 ], [ 733 ], [ 735 ], [ 737 ], [ 739 ], [ 743, 745 ], [ 749 ], [ 751 ], [ 753, 755 ], [ 757 ], [ 761 ], [ 763 ], [ 765 ], [ 767 ], [ 769 ], [ 771 ], [ 773 ], [ 775 ], [ 777 ], [ 779 ], [ 781, 783, 785 ], [ 787 ], [ 789 ], [ 791 ], [ 793 ], [ 795 ], [ 797 ], [ 799 ], [ 803 ], [ 805 ], [ 807 ], [ 809, 811, 813 ], [ 823 ], [ 825 ], [ 827 ], [ 829 ], [ 831 ], [ 833 ], [ 835 ], [ 837 ], [ 839 ], [ 843 ], [ 847 ], [ 849, 851, 853 ], [ 857 ], [ 859 ], [ 861 ], [ 865 ], [ 867 ], [ 869 ], [ 871 ], [ 873 ], [ 875 ], [ 877 ], [ 881 ], [ 883 ], [ 885 ], [ 887 ], [ 889 ], [ 891 ], [ 895 ], [ 897 ], [ 899 ], [ 901 ], [ 903 ], [ 905 ], [ 907 ], [ 909 ], [ 913 ], [ 915 ], [ 917, 919 ], [ 921, 923 ], [ 927, 929 ], [ 931 ], [ 935 ], [ 937 ], [ 939 ], [ 941 ], [ 943 ], [ 945 ], [ 947 ], [ 949 ], [ 951 ], [ 953 ], [ 955 ], [ 957 ], [ 959 ], [ 963 ], [ 965 ], [ 967 ], [ 969 ], [ 971 ], [ 975 ], [ 977 ], [ 979 ], [ 981 ], [ 983, 985 ], [ 987 ], [ 989 ], [ 991 ], [ 993 ], [ 995 ], [ 997 ], [ 999 ], [ 1001 ], [ 1003 ], [ 1007 ], [ 1009 ], [ 1011 ], [ 1013 ], [ 1015 ], [ 1017, 1019 ], [ 1021 ], [ 1023 ], [ 1025 ], [ 1027 ], [ 1029 ], [ 1031 ], [ 1033, 1035, 1037 ], [ 1039 ], [ 1041 ], [ 1043 ], [ 1045 ], [ 1047 ], [ 1049 ], [ 1051 ], [ 1053 ], [ 1057 ], [ 1059 ], [ 1061 ], [ 1063 ], [ 1067, 1069 ], [ 1073, 1075 ], [ 1077, 1079 ], [ 1081 ], [ 1083 ], [ 1085, 1087 ], [ 1089 ], [ 1091 ], [ 1093 ], [ 1095 ], [ 1097 ], [ 1099, 1101, 1103, 1105 ], [ 1109 ], [ 1111, 1113 ], [ 1115 ], [ 1117 ], [ 1119 ], [ 1121 ], [ 1123 ], [ 1125, 1127 ], [ 1129, 1131 ], [ 1133 ], [ 1135 ], [ 1137 ], [ 1139, 1141 ], [ 1143, 1145 ], [ 1147, 1149 ], [ 1151 ], [ 1153 ], [ 1155 ], [ 1157, 1159 ], [ 1161, 1163 ], [ 1165, 1167 ], [ 1169, 1171 ], [ 1173 ], [ 1175 ], [ 1177 ], [ 1179, 1181 ], [ 1183 ], [ 1185 ], [ 1187 ], [ 1189 ], [ 1193 ], [ 1199 ], [ 1203 ], [ 1205 ], [ 1207 ], [ 1211 ], [ 1213 ], [ 1215 ], [ 1217 ], [ 1219 ], [ 1223 ], [ 1225 ], [ 1229 ], [ 1233 ], [ 1235 ], [ 1237 ], [ 1239 ], [ 1243 ], [ 1245, 1247 ], [ 1249 ], [ 1251 ], [ 1253 ], [ 1255 ], [ 1259, 1261 ], [ 1263, 1265 ], [ 1269 ], [ 1273 ], [ 1275 ], [ 1279 ], [ 1281 ], [ 1283 ], [ 1285 ], [ 1287 ], [ 1289 ], [ 1291 ], [ 1293, 1295 ], [ 1297 ], [ 1299 ], [ 1301 ], [ 1303 ], [ 1305 ], [ 1307, 1309 ], [ 1311 ], [ 1313 ], [ 1315 ], [ 1319 ], [ 1321 ], [ 1325 ], [ 1327 ], [ 1333 ], [ 1335 ], [ 1339 ], [ 1341 ], [ 1347 ], [ 1349 ], [ 1351 ], [ 1353 ], [ 1355 ], [ 1361 ], [ 1363 ], [ 1365 ], [ 1367 ], [ 1371, 1373 ], [ 1375 ], [ 1377 ], [ 1379 ], [ 1387 ], [ 1389 ], [ 1391 ], [ 1393 ], [ 1395 ], [ 1397 ], [ 1401, 1403 ], [ 1405 ], [ 1409 ], [ 1411 ], [ 1415 ], [ 1417 ] ]
18,842
static void noise_scale(int *coefs, int scale, int band_energy, int len) { int ssign = scale < 0 ? -1 : 1; int s = FFABS(scale); unsigned int round; int i, out, c = exp2tab[s & 3]; int nlz = 0; while (band_energy > 0x7fff) { band_energy >>= 1; nlz++; } c /= band_energy; s = 21 + nlz - (s >> 2); if (s > 0) { round = 1 << (s-1); for (i=0; i<len; i++) { out = (int)(((int64_t)coefs[i] * c) >> 32); coefs[i] = ((int)(out+round) >> s) * ssign; } } else { s = s + 32; round = 1 << (s-1); for (i=0; i<len; i++) { out = (int)((int64_t)((int64_t)coefs[i] * c + round) >> s); coefs[i] = out * ssign; } } }
true
FFmpeg
b5228e44c7f3a5eba537c8a39a45cfbf2961a28d
static void noise_scale(int *coefs, int scale, int band_energy, int len) { int ssign = scale < 0 ? -1 : 1; int s = FFABS(scale); unsigned int round; int i, out, c = exp2tab[s & 3]; int nlz = 0; while (band_energy > 0x7fff) { band_energy >>= 1; nlz++; } c /= band_energy; s = 21 + nlz - (s >> 2); if (s > 0) { round = 1 << (s-1); for (i=0; i<len; i++) { out = (int)(((int64_t)coefs[i] * c) >> 32); coefs[i] = ((int)(out+round) >> s) * ssign; } } else { s = s + 32; round = 1 << (s-1); for (i=0; i<len; i++) { out = (int)((int64_t)((int64_t)coefs[i] * c + round) >> s); coefs[i] = out * ssign; } } }
{ "code": [ " if (s > 0) {" ], "line_no": [ 31 ] }
static void FUNC_0(int *VAR_0, int VAR_1, int VAR_2, int VAR_3) { int VAR_4 = VAR_1 < 0 ? -1 : 1; int VAR_5 = FFABS(VAR_1); unsigned int VAR_6; int VAR_7, VAR_8, VAR_9 = exp2tab[VAR_5 & 3]; int VAR_10 = 0; while (VAR_2 > 0x7fff) { VAR_2 >>= 1; VAR_10++; } VAR_9 /= VAR_2; VAR_5 = 21 + VAR_10 - (VAR_5 >> 2); if (VAR_5 > 0) { VAR_6 = 1 << (VAR_5-1); for (VAR_7=0; VAR_7<VAR_3; VAR_7++) { VAR_8 = (int)(((int64_t)VAR_0[VAR_7] * VAR_9) >> 32); VAR_0[VAR_7] = ((int)(VAR_8+VAR_6) >> VAR_5) * VAR_4; } } else { VAR_5 = VAR_5 + 32; VAR_6 = 1 << (VAR_5-1); for (VAR_7=0; VAR_7<VAR_3; VAR_7++) { VAR_8 = (int)((int64_t)((int64_t)VAR_0[VAR_7] * VAR_9 + VAR_6) >> VAR_5); VAR_0[VAR_7] = VAR_8 * VAR_4; } } }
[ "static void FUNC_0(int *VAR_0, int VAR_1, int VAR_2, int VAR_3)\n{", "int VAR_4 = VAR_1 < 0 ? -1 : 1;", "int VAR_5 = FFABS(VAR_1);", "unsigned int VAR_6;", "int VAR_7, VAR_8, VAR_9 = exp2tab[VAR_5 & 3];", "int VAR_10 = 0;", "while (VAR_2 > 0x7fff) {", "VAR_2 >>= 1;", "VAR_10++;", "}", "VAR_9 /= VAR_2;", "VAR_5 = 21 + VAR_10 - (VAR_5 >> 2);", "if (VAR_5 > 0) {", "VAR_6 = 1 << (VAR_5-1);", "for (VAR_7=0; VAR_7<VAR_3; VAR_7++) {", "VAR_8 = (int)(((int64_t)VAR_0[VAR_7] * VAR_9) >> 32);", "VAR_0[VAR_7] = ((int)(VAR_8+VAR_6) >> VAR_5) * VAR_4;", "}", "}", "else {", "VAR_5 = VAR_5 + 32;", "VAR_6 = 1 << (VAR_5-1);", "for (VAR_7=0; VAR_7<VAR_3; VAR_7++) {", "VAR_8 = (int)((int64_t)((int64_t)VAR_0[VAR_7] * VAR_9 + VAR_6) >> VAR_5);", "VAR_0[VAR_7] = VAR_8 * VAR_4;", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ] ]
18,843
int kvm_arch_insert_hw_breakpoint(target_ulong addr, target_ulong len, int type) { return -EINVAL; }
true
qemu
88365d17d586bcf0d9f4432447db345f72278a2a
int kvm_arch_insert_hw_breakpoint(target_ulong addr, target_ulong len, int type) { return -EINVAL; }
{ "code": [ "int kvm_arch_insert_hw_breakpoint(target_ulong addr, target_ulong len, int type)", " return -EINVAL;", " return -EINVAL;" ], "line_no": [ 1, 5, 5 ] }
int FUNC_0(target_ulong VAR_0, target_ulong VAR_1, int VAR_2) { return -EINVAL; }
[ "int FUNC_0(target_ulong VAR_0, target_ulong VAR_1, int VAR_2)\n{", "return -EINVAL;", "}" ]
[ 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
18,844
void *g_malloc(size_t size) { char * p; size += 16; p = bsd_vmalloc(size); *(size_t *)p = size; return p + 16; }
true
qemu
b7b5233ad7fdd9985bb6d05b7919f3a20723ff2c
void *g_malloc(size_t size) { char * p; size += 16; p = bsd_vmalloc(size); *(size_t *)p = size; return p + 16; }
{ "code": [ "void *g_malloc(size_t size)", " char * p;", " size += 16;", " p = bsd_vmalloc(size);", " *(size_t *)p = size;", " return p + 16;" ], "line_no": [ 1, 5, 7, 9, 11, 13 ] }
void *FUNC_0(size_t VAR_0) { char * VAR_1; VAR_0 += 16; VAR_1 = bsd_vmalloc(VAR_0); *(size_t *)VAR_1 = VAR_0; return VAR_1 + 16; }
[ "void *FUNC_0(size_t VAR_0)\n{", "char * VAR_1;", "VAR_0 += 16;", "VAR_1 = bsd_vmalloc(VAR_0);", "*(size_t *)VAR_1 = VAR_0;", "return VAR_1 + 16;", "}" ]
[ 1, 1, 1, 1, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ] ]
18,845
int ff_dirac_golomb_read_16bit(DiracGolombLUT *lut_ctx, const uint8_t *buf, int bytes, uint8_t *_dst, int coeffs) { int i, b, c_idx = 0; int16_t *dst = (int16_t *)_dst; DiracGolombLUT *future[4], *l = &lut_ctx[2*LUT_SIZE + buf[0]]; INIT_RESIDUE(res, 0, 0); #define APPEND_RESIDUE(N, M) \ N |= M >> (N ## _bits); \ N ## _bits += (M ## _bits) for (b = 1; b <= bytes; b++) { future[0] = &lut_ctx[buf[b]]; future[1] = future[0] + 1*LUT_SIZE; future[2] = future[0] + 2*LUT_SIZE; future[3] = future[0] + 3*LUT_SIZE; if ((c_idx + 1) > coeffs) return c_idx; if (res_bits && l->sign) { int32_t coeff = 1; APPEND_RESIDUE(res, l->preamble); for (i = 0; i < (res_bits >> 1) - 1; i++) { coeff <<= 1; coeff |= (res >> (RSIZE_BITS - 2*i - 2)) & 1; } dst[c_idx++] = l->sign * (coeff - 1); res_bits = res = 0; } for (i = 0; i < LUT_BITS; i++) dst[c_idx + i] = l->ready[i]; c_idx += l->ready_num; APPEND_RESIDUE(res, l->leftover); l = future[l->need_s ? 3 : !res_bits ? 2 : res_bits & 1]; } return c_idx; }
true
FFmpeg
e24c31b656254b2516befbde78aeaca0122a6010
int ff_dirac_golomb_read_16bit(DiracGolombLUT *lut_ctx, const uint8_t *buf, int bytes, uint8_t *_dst, int coeffs) { int i, b, c_idx = 0; int16_t *dst = (int16_t *)_dst; DiracGolombLUT *future[4], *l = &lut_ctx[2*LUT_SIZE + buf[0]]; INIT_RESIDUE(res, 0, 0); #define APPEND_RESIDUE(N, M) \ N |= M >> (N ## _bits); \ N ## _bits += (M ## _bits) for (b = 1; b <= bytes; b++) { future[0] = &lut_ctx[buf[b]]; future[1] = future[0] + 1*LUT_SIZE; future[2] = future[0] + 2*LUT_SIZE; future[3] = future[0] + 3*LUT_SIZE; if ((c_idx + 1) > coeffs) return c_idx; if (res_bits && l->sign) { int32_t coeff = 1; APPEND_RESIDUE(res, l->preamble); for (i = 0; i < (res_bits >> 1) - 1; i++) { coeff <<= 1; coeff |= (res >> (RSIZE_BITS - 2*i - 2)) & 1; } dst[c_idx++] = l->sign * (coeff - 1); res_bits = res = 0; } for (i = 0; i < LUT_BITS; i++) dst[c_idx + i] = l->ready[i]; c_idx += l->ready_num; APPEND_RESIDUE(res, l->leftover); l = future[l->need_s ? 3 : !res_bits ? 2 : res_bits & 1]; } return c_idx; }
{ "code": [ " INIT_RESIDUE(res, 0, 0);", " INIT_RESIDUE(res, 0, 0);" ], "line_no": [ 13, 13 ] }
int FUNC_0(DiracGolombLUT *VAR_0, const uint8_t *VAR_1, int VAR_2, uint8_t *VAR_3, int VAR_4) { int VAR_5, VAR_6, VAR_7 = 0; int16_t *dst = (int16_t *)VAR_3; DiracGolombLUT *future[4], *l = &VAR_0[2*LUT_SIZE + VAR_1[0]]; INIT_RESIDUE(res, 0, 0); #define APPEND_RESIDUE(N, M) \ N |= M >> (N ## _bits); \ N ## _bits += (M ## _bits) for (VAR_6 = 1; VAR_6 <= VAR_2; VAR_6++) { future[0] = &VAR_0[VAR_1[VAR_6]]; future[1] = future[0] + 1*LUT_SIZE; future[2] = future[0] + 2*LUT_SIZE; future[3] = future[0] + 3*LUT_SIZE; if ((VAR_7 + 1) > VAR_4) return VAR_7; if (res_bits && l->sign) { int32_t coeff = 1; APPEND_RESIDUE(res, l->preamble); for (VAR_5 = 0; VAR_5 < (res_bits >> 1) - 1; VAR_5++) { coeff <<= 1; coeff |= (res >> (RSIZE_BITS - 2*VAR_5 - 2)) & 1; } dst[VAR_7++] = l->sign * (coeff - 1); res_bits = res = 0; } for (VAR_5 = 0; VAR_5 < LUT_BITS; VAR_5++) dst[VAR_7 + VAR_5] = l->ready[VAR_5]; VAR_7 += l->ready_num; APPEND_RESIDUE(res, l->leftover); l = future[l->need_s ? 3 : !res_bits ? 2 : res_bits & 1]; } return VAR_7; }
[ "int FUNC_0(DiracGolombLUT *VAR_0, const uint8_t *VAR_1,\nint VAR_2, uint8_t *VAR_3, int VAR_4)\n{", "int VAR_5, VAR_6, VAR_7 = 0;", "int16_t *dst = (int16_t *)VAR_3;", "DiracGolombLUT *future[4], *l = &VAR_0[2*LUT_SIZE + VAR_1[0]];", "INIT_RESIDUE(res, 0, 0);", "#define APPEND_RESIDUE(N, M) \\\nN |= M >> (N ## _bits); \\", "N ## _bits += (M ## _bits)\nfor (VAR_6 = 1; VAR_6 <= VAR_2; VAR_6++) {", "future[0] = &VAR_0[VAR_1[VAR_6]];", "future[1] = future[0] + 1*LUT_SIZE;", "future[2] = future[0] + 2*LUT_SIZE;", "future[3] = future[0] + 3*LUT_SIZE;", "if ((VAR_7 + 1) > VAR_4)\nreturn VAR_7;", "if (res_bits && l->sign) {", "int32_t coeff = 1;", "APPEND_RESIDUE(res, l->preamble);", "for (VAR_5 = 0; VAR_5 < (res_bits >> 1) - 1; VAR_5++) {", "coeff <<= 1;", "coeff |= (res >> (RSIZE_BITS - 2*VAR_5 - 2)) & 1;", "}", "dst[VAR_7++] = l->sign * (coeff - 1);", "res_bits = res = 0;", "}", "for (VAR_5 = 0; VAR_5 < LUT_BITS; VAR_5++)", "dst[VAR_7 + VAR_5] = l->ready[VAR_5];", "VAR_7 += l->ready_num;", "APPEND_RESIDUE(res, l->leftover);", "l = future[l->need_s ? 3 : !res_bits ? 2 : res_bits & 1];", "}", "return VAR_7;", "}" ]
[ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17, 19 ], [ 21, 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37, 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ], [ 73 ], [ 77 ], [ 79 ], [ 83 ], [ 85 ] ]
18,846
static void spapr_tce_table_finalize(Object *obj) { sPAPRTCETable *tcet = SPAPR_TCE_TABLE(obj); QLIST_REMOVE(tcet, list); if (!kvm_enabled() || (kvmppc_remove_spapr_tce(tcet->table, tcet->fd, tcet->nb_table) != 0)) { g_free(tcet->table); } }
true
qemu
5f9490de566c5b092a6cfedc3c7a37a9c9dee917
static void spapr_tce_table_finalize(Object *obj) { sPAPRTCETable *tcet = SPAPR_TCE_TABLE(obj); QLIST_REMOVE(tcet, list); if (!kvm_enabled() || (kvmppc_remove_spapr_tce(tcet->table, tcet->fd, tcet->nb_table) != 0)) { g_free(tcet->table); } }
{ "code": [ "static void spapr_tce_table_finalize(Object *obj)", " sPAPRTCETable *tcet = SPAPR_TCE_TABLE(obj);" ], "line_no": [ 1, 5 ] }
static void FUNC_0(Object *VAR_0) { sPAPRTCETable *tcet = SPAPR_TCE_TABLE(VAR_0); QLIST_REMOVE(tcet, list); if (!kvm_enabled() || (kvmppc_remove_spapr_tce(tcet->table, tcet->fd, tcet->nb_table) != 0)) { g_free(tcet->table); } }
[ "static void FUNC_0(Object *VAR_0)\n{", "sPAPRTCETable *tcet = SPAPR_TCE_TABLE(VAR_0);", "QLIST_REMOVE(tcet, list);", "if (!kvm_enabled() ||\n(kvmppc_remove_spapr_tce(tcet->table, tcet->fd,\ntcet->nb_table) != 0)) {", "g_free(tcet->table);", "}", "}" ]
[ 1, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 13, 15, 17 ], [ 19 ], [ 21 ], [ 23 ] ]
18,847
int ff_draw_slice(AVFilterLink *link, int y, int h, int slice_dir) { uint8_t *src[4], *dst[4]; int i, j, vsub, ret; int (*draw_slice)(AVFilterLink *, int, int, int); FF_TPRINTF_START(NULL, draw_slice); ff_tlog_link(NULL, link, 0); ff_tlog(NULL, " y:%d h:%d dir:%d\n", y, h, slice_dir); /* copy the slice if needed for permission reasons */ if (link->src_buf) { vsub = av_pix_fmt_descriptors[link->format].log2_chroma_h; for (i = 0; i < 4; i++) { if (link->src_buf->data[i]) { src[i] = link->src_buf-> data[i] + (y >> (i==1 || i==2 ? vsub : 0)) * link->src_buf-> linesize[i]; dst[i] = link->cur_buf->data[i] + (y >> (i==1 || i==2 ? vsub : 0)) * link->cur_buf->linesize[i]; } else src[i] = dst[i] = NULL; } for (i = 0; i < 4; i++) { int planew = av_image_get_linesize(link->format, link->cur_buf->video->w, i); if (!src[i]) continue; for (j = 0; j < h >> (i==1 || i==2 ? vsub : 0); j++) { memcpy(dst[i], src[i], planew); src[i] += link->src_buf->linesize[i]; dst[i] += link->cur_buf->linesize[i]; } } } if (!(draw_slice = link->dstpad->draw_slice)) draw_slice = default_draw_slice; ret = draw_slice(link, y, h, slice_dir); if (ret < 0) clear_link(link); return ret; }
false
FFmpeg
8ef740ce01abff3bc7df0f79803a3dc781d89daa
int ff_draw_slice(AVFilterLink *link, int y, int h, int slice_dir) { uint8_t *src[4], *dst[4]; int i, j, vsub, ret; int (*draw_slice)(AVFilterLink *, int, int, int); FF_TPRINTF_START(NULL, draw_slice); ff_tlog_link(NULL, link, 0); ff_tlog(NULL, " y:%d h:%d dir:%d\n", y, h, slice_dir); if (link->src_buf) { vsub = av_pix_fmt_descriptors[link->format].log2_chroma_h; for (i = 0; i < 4; i++) { if (link->src_buf->data[i]) { src[i] = link->src_buf-> data[i] + (y >> (i==1 || i==2 ? vsub : 0)) * link->src_buf-> linesize[i]; dst[i] = link->cur_buf->data[i] + (y >> (i==1 || i==2 ? vsub : 0)) * link->cur_buf->linesize[i]; } else src[i] = dst[i] = NULL; } for (i = 0; i < 4; i++) { int planew = av_image_get_linesize(link->format, link->cur_buf->video->w, i); if (!src[i]) continue; for (j = 0; j < h >> (i==1 || i==2 ? vsub : 0); j++) { memcpy(dst[i], src[i], planew); src[i] += link->src_buf->linesize[i]; dst[i] += link->cur_buf->linesize[i]; } } } if (!(draw_slice = link->dstpad->draw_slice)) draw_slice = default_draw_slice; ret = draw_slice(link, y, h, slice_dir); if (ret < 0) clear_link(link); return ret; }
{ "code": [], "line_no": [] }
VAR_10intVAR_10 VAR_10ff_draw_sliceVAR_10(VAR_10AVFilterLinkVAR_10 *VAR_10VAR_0VAR_10, VAR_10intVAR_10 VAR_10VAR_1VAR_10, VAR_10intVAR_10 VAR_10VAR_2VAR_10, VAR_10intVAR_10 VAR_10VAR_3VAR_10) { VAR_10uint8_tVAR_10 *VAR_10srcVAR_10[VAR_104VAR_10], *VAR_10dstVAR_10[VAR_104VAR_10]; VAR_10intVAR_10 VAR_10VAR_4VAR_10, VAR_10VAR_5VAR_10, VAR_10VAR_6VAR_10, VAR_10VAR_7VAR_10; VAR_10intVAR_10 (*VAR_10VAR_8VAR_10)(VAR_10AVFilterLinkVAR_10 *, VAR_10intVAR_10, VAR_10intVAR_10, VAR_10intVAR_10); VAR_10FF_TPRINTF_STARTVAR_10(VAR_10NULLVAR_10, VAR_10VAR_8VAR_10); VAR_10ff_tlog_linkVAR_10(VAR_10NULLVAR_10, VAR_10VAR_0VAR_10, VAR_100VAR_10); VAR_10ff_tlogVAR_10(VAR_10NULLVAR_10, " VAR_10VAR_1VAR_10:%VAR_10dVAR_10 VAR_10VAR_2VAR_10:%VAR_10dVAR_10 VAR_10dirVAR_10:%VAR_10dVAR_10\VAR_10nVAR_10", VAR_10VAR_1VAR_10, VAR_10VAR_2VAR_10, VAR_10VAR_3VAR_10); VAR_10ifVAR_10 (VAR_10VAR_0VAR_10->VAR_10src_bufVAR_10) { VAR_10VAR_6VAR_10 = VAR_10av_pix_fmt_descriptorsVAR_10[VAR_10VAR_0VAR_10->VAR_10formatVAR_10].VAR_10log2_chroma_hVAR_10; VAR_10forVAR_10 (VAR_10VAR_4VAR_10 = VAR_100VAR_10; VAR_10VAR_4VAR_10 < VAR_104VAR_10; VAR_10VAR_4VAR_10++) { VAR_10ifVAR_10 (VAR_10VAR_0VAR_10->VAR_10src_bufVAR_10->VAR_10dataVAR_10[VAR_10VAR_4VAR_10]) { VAR_10srcVAR_10[VAR_10VAR_4VAR_10] = VAR_10VAR_0VAR_10->VAR_10src_bufVAR_10-> VAR_10dataVAR_10[VAR_10VAR_4VAR_10] + (VAR_10VAR_1VAR_10 >> (VAR_10VAR_4VAR_10==VAR_101VAR_10 || VAR_10VAR_4VAR_10==VAR_102VAR_10 ? VAR_10VAR_6VAR_10 : VAR_100VAR_10)) * VAR_10VAR_0VAR_10->VAR_10src_bufVAR_10-> VAR_10linesizeVAR_10[VAR_10VAR_4VAR_10]; VAR_10dstVAR_10[VAR_10VAR_4VAR_10] = VAR_10VAR_0VAR_10->VAR_10cur_bufVAR_10->VAR_10dataVAR_10[VAR_10VAR_4VAR_10] + (VAR_10VAR_1VAR_10 >> (VAR_10VAR_4VAR_10==VAR_101VAR_10 || VAR_10VAR_4VAR_10==VAR_102VAR_10 ? VAR_10VAR_6VAR_10 : VAR_100VAR_10)) * VAR_10VAR_0VAR_10->VAR_10cur_bufVAR_10->VAR_10linesizeVAR_10[VAR_10VAR_4VAR_10]; } VAR_10elseVAR_10 VAR_10srcVAR_10[VAR_10VAR_4VAR_10] = VAR_10dstVAR_10[VAR_10VAR_4VAR_10] = VAR_10NULLVAR_10; } VAR_10forVAR_10 (VAR_10VAR_4VAR_10 = VAR_100VAR_10; VAR_10VAR_4VAR_10 < VAR_104VAR_10; VAR_10VAR_4VAR_10++) { VAR_10intVAR_10 VAR_10planewVAR_10 = VAR_10av_image_get_linesizeVAR_10(VAR_10VAR_0VAR_10->VAR_10formatVAR_10, VAR_10VAR_0VAR_10->VAR_10cur_bufVAR_10->VAR_10videoVAR_10->VAR_10wVAR_10, VAR_10VAR_4VAR_10); VAR_10ifVAR_10 (!VAR_10srcVAR_10[VAR_10VAR_4VAR_10]) VAR_10continueVAR_10; VAR_10forVAR_10 (VAR_10VAR_5VAR_10 = VAR_100VAR_10; VAR_10VAR_5VAR_10 < VAR_10VAR_2VAR_10 >> (VAR_10VAR_4VAR_10==VAR_101VAR_10 || VAR_10VAR_4VAR_10==VAR_102VAR_10 ? VAR_10VAR_6VAR_10 : VAR_100VAR_10); VAR_10VAR_5VAR_10++) { VAR_10memcpyVAR_10(VAR_10dstVAR_10[VAR_10VAR_4VAR_10], VAR_10srcVAR_10[VAR_10VAR_4VAR_10], VAR_10planewVAR_10); VAR_10srcVAR_10[VAR_10VAR_4VAR_10] += VAR_10VAR_0VAR_10->VAR_10src_bufVAR_10->VAR_10linesizeVAR_10[VAR_10VAR_4VAR_10]; VAR_10dstVAR_10[VAR_10VAR_4VAR_10] += VAR_10VAR_0VAR_10->VAR_10cur_bufVAR_10->VAR_10linesizeVAR_10[VAR_10VAR_4VAR_10]; } } } VAR_10ifVAR_10 (!(VAR_10VAR_8VAR_10 = VAR_10VAR_0VAR_10->VAR_10dstpadVAR_10->VAR_10VAR_8VAR_10)) VAR_10VAR_8VAR_10 = VAR_10default_draw_sliceVAR_10; VAR_10VAR_7VAR_10 = VAR_10VAR_8VAR_10(VAR_10VAR_0VAR_10, VAR_10VAR_1VAR_10, VAR_10VAR_2VAR_10, VAR_10VAR_3VAR_10); VAR_10ifVAR_10 (VAR_10VAR_7VAR_10 < VAR_100VAR_10) VAR_10clear_linkVAR_10(VAR_10VAR_0VAR_10); VAR_10returnVAR_10 VAR_10VAR_7VAR_10; }
[ "VAR_10intVAR_10 VAR_10ff_draw_sliceVAR_10(VAR_10AVFilterLinkVAR_10 *VAR_10VAR_0VAR_10, VAR_10intVAR_10 VAR_10VAR_1VAR_10, VAR_10intVAR_10 VAR_10VAR_2VAR_10, VAR_10intVAR_10 VAR_10VAR_3VAR_10)\n{", "VAR_10uint8_tVAR_10 *VAR_10srcVAR_10[VAR_104VAR_10], *VAR_10dstVAR_10[VAR_104VAR_10];", "VAR_10intVAR_10 VAR_10VAR_4VAR_10, VAR_10VAR_5VAR_10, VAR_10VAR_6VAR_10, VAR_10VAR_7VAR_10;", "VAR_10intVAR_10 (*VAR_10VAR_8VAR_10)(VAR_10AVFilterLinkVAR_10 *, VAR_10intVAR_10, VAR_10intVAR_10, VAR_10intVAR_10);", "VAR_10FF_TPRINTF_STARTVAR_10(VAR_10NULLVAR_10, VAR_10VAR_8VAR_10); VAR_10ff_tlog_linkVAR_10(VAR_10NULLVAR_10, VAR_10VAR_0VAR_10, VAR_100VAR_10); VAR_10ff_tlogVAR_10(VAR_10NULLVAR_10, \" VAR_10VAR_1VAR_10:%VAR_10dVAR_10 VAR_10VAR_2VAR_10:%VAR_10dVAR_10 VAR_10dirVAR_10:%VAR_10dVAR_10\\VAR_10nVAR_10\", VAR_10VAR_1VAR_10, VAR_10VAR_2VAR_10, VAR_10VAR_3VAR_10);", "VAR_10ifVAR_10 (VAR_10VAR_0VAR_10->VAR_10src_bufVAR_10) {", "VAR_10VAR_6VAR_10 = VAR_10av_pix_fmt_descriptorsVAR_10[VAR_10VAR_0VAR_10->VAR_10formatVAR_10].VAR_10log2_chroma_hVAR_10;", "VAR_10forVAR_10 (VAR_10VAR_4VAR_10 = VAR_100VAR_10; VAR_10VAR_4VAR_10 < VAR_104VAR_10; VAR_10VAR_4VAR_10++) {", "VAR_10ifVAR_10 (VAR_10VAR_0VAR_10->VAR_10src_bufVAR_10->VAR_10dataVAR_10[VAR_10VAR_4VAR_10]) {", "VAR_10srcVAR_10[VAR_10VAR_4VAR_10] = VAR_10VAR_0VAR_10->VAR_10src_bufVAR_10-> VAR_10dataVAR_10[VAR_10VAR_4VAR_10] +\n(VAR_10VAR_1VAR_10 >> (VAR_10VAR_4VAR_10==VAR_101VAR_10 || VAR_10VAR_4VAR_10==VAR_102VAR_10 ? VAR_10VAR_6VAR_10 : VAR_100VAR_10)) * VAR_10VAR_0VAR_10->VAR_10src_bufVAR_10-> VAR_10linesizeVAR_10[VAR_10VAR_4VAR_10];", "VAR_10dstVAR_10[VAR_10VAR_4VAR_10] = VAR_10VAR_0VAR_10->VAR_10cur_bufVAR_10->VAR_10dataVAR_10[VAR_10VAR_4VAR_10] +\n(VAR_10VAR_1VAR_10 >> (VAR_10VAR_4VAR_10==VAR_101VAR_10 || VAR_10VAR_4VAR_10==VAR_102VAR_10 ? VAR_10VAR_6VAR_10 : VAR_100VAR_10)) * VAR_10VAR_0VAR_10->VAR_10cur_bufVAR_10->VAR_10linesizeVAR_10[VAR_10VAR_4VAR_10];", "} VAR_10elseVAR_10", "VAR_10srcVAR_10[VAR_10VAR_4VAR_10] = VAR_10dstVAR_10[VAR_10VAR_4VAR_10] = VAR_10NULLVAR_10;", "}", "VAR_10forVAR_10 (VAR_10VAR_4VAR_10 = VAR_100VAR_10; VAR_10VAR_4VAR_10 < VAR_104VAR_10; VAR_10VAR_4VAR_10++) {", "VAR_10intVAR_10 VAR_10planewVAR_10 =\nVAR_10av_image_get_linesizeVAR_10(VAR_10VAR_0VAR_10->VAR_10formatVAR_10, VAR_10VAR_0VAR_10->VAR_10cur_bufVAR_10->VAR_10videoVAR_10->VAR_10wVAR_10, VAR_10VAR_4VAR_10);", "VAR_10ifVAR_10 (!VAR_10srcVAR_10[VAR_10VAR_4VAR_10]) VAR_10continueVAR_10;", "VAR_10forVAR_10 (VAR_10VAR_5VAR_10 = VAR_100VAR_10; VAR_10VAR_5VAR_10 < VAR_10VAR_2VAR_10 >> (VAR_10VAR_4VAR_10==VAR_101VAR_10 || VAR_10VAR_4VAR_10==VAR_102VAR_10 ? VAR_10VAR_6VAR_10 : VAR_100VAR_10); VAR_10VAR_5VAR_10++) {", "VAR_10memcpyVAR_10(VAR_10dstVAR_10[VAR_10VAR_4VAR_10], VAR_10srcVAR_10[VAR_10VAR_4VAR_10], VAR_10planewVAR_10);", "VAR_10srcVAR_10[VAR_10VAR_4VAR_10] += VAR_10VAR_0VAR_10->VAR_10src_bufVAR_10->VAR_10linesizeVAR_10[VAR_10VAR_4VAR_10];", "VAR_10dstVAR_10[VAR_10VAR_4VAR_10] += VAR_10VAR_0VAR_10->VAR_10cur_bufVAR_10->VAR_10linesizeVAR_10[VAR_10VAR_4VAR_10];", "}", "}", "}", "VAR_10ifVAR_10 (!(VAR_10VAR_8VAR_10 = VAR_10VAR_0VAR_10->VAR_10dstpadVAR_10->VAR_10VAR_8VAR_10))\nVAR_10VAR_8VAR_10 = VAR_10default_draw_sliceVAR_10;", "VAR_10VAR_7VAR_10 = VAR_10VAR_8VAR_10(VAR_10VAR_0VAR_10, VAR_10VAR_1VAR_10, VAR_10VAR_2VAR_10, VAR_10VAR_3VAR_10);", "VAR_10ifVAR_10 (VAR_10VAR_7VAR_10 < VAR_100VAR_10)\nVAR_10clear_linkVAR_10(VAR_10VAR_0VAR_10);", "VAR_10returnVAR_10 VAR_10VAR_7VAR_10;", "}" ]
[ 0, 0, 0, 0, 0, 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 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29, 31 ], [ 33, 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47, 49 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 73, 75 ], [ 77 ], [ 79, 81 ], [ 83 ], [ 85 ] ]
18,848
int qcrypto_cipher_encrypt(QCryptoCipher *cipher, const void *in, void *out, size_t len, Error **errp) { QCryptoCipherBuiltin *ctxt = cipher->opaque; return ctxt->encrypt(cipher, in, out, len, errp);
true
qemu
3a661f1eabf7e8db66e28489884d9b54aacb94ea
int qcrypto_cipher_encrypt(QCryptoCipher *cipher, const void *in, void *out, size_t len, Error **errp) { QCryptoCipherBuiltin *ctxt = cipher->opaque; return ctxt->encrypt(cipher, in, out, len, errp);
{ "code": [], "line_no": [] }
int FUNC_0(QCryptoCipher *VAR_0, const void *VAR_1, void *VAR_2, size_t VAR_3, Error **VAR_4) { QCryptoCipherBuiltin *ctxt = VAR_0->opaque; return ctxt->encrypt(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4);
[ "int FUNC_0(QCryptoCipher *VAR_0,\nconst void *VAR_1,\nvoid *VAR_2,\nsize_t VAR_3,\nError **VAR_4)\n{", "QCryptoCipherBuiltin *ctxt = VAR_0->opaque;", "return ctxt->encrypt(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4);" ]
[ 0, 0, 0 ]
[ [ 1, 2, 3, 4, 5, 6 ], [ 7 ], [ 8 ] ]
18,849
static void e1000e_pci_foreach_callback(QPCIDevice *dev, int devfn, void *data) { *(QPCIDevice **) data = dev; }
true
qemu
448fe3c1349b540c66e048788dd98b9c80775c53
static void e1000e_pci_foreach_callback(QPCIDevice *dev, int devfn, void *data) { *(QPCIDevice **) data = dev; }
{ "code": [ " *(QPCIDevice **) data = dev;" ], "line_no": [ 5 ] }
static void FUNC_0(QPCIDevice *VAR_0, int VAR_1, void *VAR_2) { *(QPCIDevice **) VAR_2 = VAR_0; }
[ "static void FUNC_0(QPCIDevice *VAR_0, int VAR_1, void *VAR_2)\n{", "*(QPCIDevice **) VAR_2 = VAR_0;", "}" ]
[ 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
18,850
static int rm_read_index(AVFormatContext *s) { AVIOContext *pb = s->pb; unsigned int size, n_pkts, str_id, next_off, n, pos, pts; AVStream *st; do { if (avio_rl32(pb) != MKTAG('I','N','D','X')) return -1; size = avio_rb32(pb); if (size < 20) return -1; avio_skip(pb, 2); n_pkts = avio_rb32(pb); str_id = avio_rb16(pb); next_off = avio_rb32(pb); for (n = 0; n < s->nb_streams; n++) if (s->streams[n]->id == str_id) { st = s->streams[n]; break; } if (n == s->nb_streams) goto skip; for (n = 0; n < n_pkts; n++) { avio_skip(pb, 2); pts = avio_rb32(pb); pos = avio_rb32(pb); avio_skip(pb, 4); /* packet no. */ av_add_index_entry(st, pos, pts, 0, 0, AVINDEX_KEYFRAME); } skip: if (next_off && avio_tell(pb) != next_off && avio_seek(pb, next_off, SEEK_SET) < 0) return -1; } while (next_off); return 0; }
false
FFmpeg
aac07a7a4c2c7a4a29cf6dbc88c1b9fdd191b99d
static int rm_read_index(AVFormatContext *s) { AVIOContext *pb = s->pb; unsigned int size, n_pkts, str_id, next_off, n, pos, pts; AVStream *st; do { if (avio_rl32(pb) != MKTAG('I','N','D','X')) return -1; size = avio_rb32(pb); if (size < 20) return -1; avio_skip(pb, 2); n_pkts = avio_rb32(pb); str_id = avio_rb16(pb); next_off = avio_rb32(pb); for (n = 0; n < s->nb_streams; n++) if (s->streams[n]->id == str_id) { st = s->streams[n]; break; } if (n == s->nb_streams) goto skip; for (n = 0; n < n_pkts; n++) { avio_skip(pb, 2); pts = avio_rb32(pb); pos = avio_rb32(pb); avio_skip(pb, 4); av_add_index_entry(st, pos, pts, 0, 0, AVINDEX_KEYFRAME); } skip: if (next_off && avio_tell(pb) != next_off && avio_seek(pb, next_off, SEEK_SET) < 0) return -1; } while (next_off); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0) { AVIOContext *pb = VAR_0->pb; unsigned int VAR_1, VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7; AVStream *st; do { if (avio_rl32(pb) != MKTAG('I','N','D','X')) return -1; VAR_1 = avio_rb32(pb); if (VAR_1 < 20) return -1; avio_skip(pb, 2); VAR_2 = avio_rb32(pb); VAR_3 = avio_rb16(pb); VAR_4 = avio_rb32(pb); for (VAR_5 = 0; VAR_5 < VAR_0->nb_streams; VAR_5++) if (VAR_0->streams[VAR_5]->id == VAR_3) { st = VAR_0->streams[VAR_5]; break; } if (VAR_5 == VAR_0->nb_streams) goto skip; for (VAR_5 = 0; VAR_5 < VAR_2; VAR_5++) { avio_skip(pb, 2); VAR_7 = avio_rb32(pb); VAR_6 = avio_rb32(pb); avio_skip(pb, 4); av_add_index_entry(st, VAR_6, VAR_7, 0, 0, AVINDEX_KEYFRAME); } skip: if (VAR_4 && avio_tell(pb) != VAR_4 && avio_seek(pb, VAR_4, SEEK_SET) < 0) return -1; } while (VAR_4); return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0)\n{", "AVIOContext *pb = VAR_0->pb;", "unsigned int VAR_1, VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7;", "AVStream *st;", "do {", "if (avio_rl32(pb) != MKTAG('I','N','D','X'))\nreturn -1;", "VAR_1 = avio_rb32(pb);", "if (VAR_1 < 20)\nreturn -1;", "avio_skip(pb, 2);", "VAR_2 = avio_rb32(pb);", "VAR_3 = avio_rb16(pb);", "VAR_4 = avio_rb32(pb);", "for (VAR_5 = 0; VAR_5 < VAR_0->nb_streams; VAR_5++)", "if (VAR_0->streams[VAR_5]->id == VAR_3) {", "st = VAR_0->streams[VAR_5];", "break;", "}", "if (VAR_5 == VAR_0->nb_streams)\ngoto skip;", "for (VAR_5 = 0; VAR_5 < VAR_2; VAR_5++) {", "avio_skip(pb, 2);", "VAR_7 = avio_rb32(pb);", "VAR_6 = avio_rb32(pb);", "avio_skip(pb, 4);", "av_add_index_entry(st, VAR_6, VAR_7, 0, 0, AVINDEX_KEYFRAME);", "}", "skip:\nif (VAR_4 && avio_tell(pb) != VAR_4 &&\navio_seek(pb, VAR_4, SEEK_SET) < 0)\nreturn -1;", "} while (VAR_4);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15, 17 ], [ 19 ], [ 21, 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 67, 69, 71, 73 ], [ 75 ], [ 79 ], [ 81 ] ]
18,851
int ff_huff_gen_len_table(uint8_t *dst, const uint64_t *stats, int stats_size, int skip0) { HeapElem *h = av_malloc_array(sizeof(*h), stats_size); int *up = av_malloc_array(sizeof(*up) * 2, stats_size); uint8_t *len = av_malloc_array(sizeof(*len) * 2, stats_size); uint16_t *map= av_malloc_array(sizeof(*map), stats_size); int offset, i, next; int size = 0; int ret = 0; if (!h || !up || !len) { ret = AVERROR(ENOMEM); goto end; } for (i = 0; i<stats_size; i++) { dst[i] = 255; if (stats[i] || !skip0) map[size++] = i; } for (offset = 1; ; offset <<= 1) { for (i=0; i < size; i++) { h[i].name = i; h[i].val = (stats[map[i]] << 14) + offset; } for (i = size / 2 - 1; i >= 0; i--) heap_sift(h, i, size); for (next = size; next < size * 2 - 1; next++) { // merge the two smallest entries, and put it back in the heap uint64_t min1v = h[0].val; up[h[0].name] = next; h[0].val = INT64_MAX; heap_sift(h, 0, size); up[h[0].name] = next; h[0].name = next; h[0].val += min1v; heap_sift(h, 0, size); } len[2 * size - 2] = 0; for (i = 2 * size - 3; i >= size; i--) len[i] = len[up[i]] + 1; for (i = 0; i < size; i++) { dst[map[i]] = len[up[i]] + 1; if (dst[map[i]] >= 32) break; } if (i==size) break; } end: av_free(h); av_free(up); av_free(len); av_free(map); return ret; }
false
FFmpeg
fd6768a4b8e2ce9e25a447aec9194b2bcdd1ac35
int ff_huff_gen_len_table(uint8_t *dst, const uint64_t *stats, int stats_size, int skip0) { HeapElem *h = av_malloc_array(sizeof(*h), stats_size); int *up = av_malloc_array(sizeof(*up) * 2, stats_size); uint8_t *len = av_malloc_array(sizeof(*len) * 2, stats_size); uint16_t *map= av_malloc_array(sizeof(*map), stats_size); int offset, i, next; int size = 0; int ret = 0; if (!h || !up || !len) { ret = AVERROR(ENOMEM); goto end; } for (i = 0; i<stats_size; i++) { dst[i] = 255; if (stats[i] || !skip0) map[size++] = i; } for (offset = 1; ; offset <<= 1) { for (i=0; i < size; i++) { h[i].name = i; h[i].val = (stats[map[i]] << 14) + offset; } for (i = size / 2 - 1; i >= 0; i--) heap_sift(h, i, size); for (next = size; next < size * 2 - 1; next++) { uint64_t min1v = h[0].val; up[h[0].name] = next; h[0].val = INT64_MAX; heap_sift(h, 0, size); up[h[0].name] = next; h[0].name = next; h[0].val += min1v; heap_sift(h, 0, size); } len[2 * size - 2] = 0; for (i = 2 * size - 3; i >= size; i--) len[i] = len[up[i]] + 1; for (i = 0; i < size; i++) { dst[map[i]] = len[up[i]] + 1; if (dst[map[i]] >= 32) break; } if (i==size) break; } end: av_free(h); av_free(up); av_free(len); av_free(map); return ret; }
{ "code": [], "line_no": [] }
int FUNC_0(uint8_t *VAR_0, const uint64_t *VAR_1, int VAR_2, int VAR_3) { HeapElem *h = av_malloc_array(sizeof(*h), VAR_2); int *VAR_4 = av_malloc_array(sizeof(*VAR_4) * 2, VAR_2); uint8_t *len = av_malloc_array(sizeof(*len) * 2, VAR_2); uint16_t *map= av_malloc_array(sizeof(*map), VAR_2); int VAR_5, VAR_6, VAR_7; int VAR_8 = 0; int VAR_9 = 0; if (!h || !VAR_4 || !len) { VAR_9 = AVERROR(ENOMEM); goto end; } for (VAR_6 = 0; VAR_6<VAR_2; VAR_6++) { VAR_0[VAR_6] = 255; if (VAR_1[VAR_6] || !VAR_3) map[VAR_8++] = VAR_6; } for (VAR_5 = 1; ; VAR_5 <<= 1) { for (VAR_6=0; VAR_6 < VAR_8; VAR_6++) { h[VAR_6].name = VAR_6; h[VAR_6].val = (VAR_1[map[VAR_6]] << 14) + VAR_5; } for (VAR_6 = VAR_8 / 2 - 1; VAR_6 >= 0; VAR_6--) heap_sift(h, VAR_6, VAR_8); for (VAR_7 = VAR_8; VAR_7 < VAR_8 * 2 - 1; VAR_7++) { uint64_t min1v = h[0].val; VAR_4[h[0].name] = VAR_7; h[0].val = INT64_MAX; heap_sift(h, 0, VAR_8); VAR_4[h[0].name] = VAR_7; h[0].name = VAR_7; h[0].val += min1v; heap_sift(h, 0, VAR_8); } len[2 * VAR_8 - 2] = 0; for (VAR_6 = 2 * VAR_8 - 3; VAR_6 >= VAR_8; VAR_6--) len[VAR_6] = len[VAR_4[VAR_6]] + 1; for (VAR_6 = 0; VAR_6 < VAR_8; VAR_6++) { VAR_0[map[VAR_6]] = len[VAR_4[VAR_6]] + 1; if (VAR_0[map[VAR_6]] >= 32) break; } if (VAR_6==VAR_8) break; } end: av_free(h); av_free(VAR_4); av_free(len); av_free(map); return VAR_9; }
[ "int FUNC_0(uint8_t *VAR_0, const uint64_t *VAR_1, int VAR_2, int VAR_3)\n{", "HeapElem *h = av_malloc_array(sizeof(*h), VAR_2);", "int *VAR_4 = av_malloc_array(sizeof(*VAR_4) * 2, VAR_2);", "uint8_t *len = av_malloc_array(sizeof(*len) * 2, VAR_2);", "uint16_t *map= av_malloc_array(sizeof(*map), VAR_2);", "int VAR_5, VAR_6, VAR_7;", "int VAR_8 = 0;", "int VAR_9 = 0;", "if (!h || !VAR_4 || !len) {", "VAR_9 = AVERROR(ENOMEM);", "goto end;", "}", "for (VAR_6 = 0; VAR_6<VAR_2; VAR_6++) {", "VAR_0[VAR_6] = 255;", "if (VAR_1[VAR_6] || !VAR_3)\nmap[VAR_8++] = VAR_6;", "}", "for (VAR_5 = 1; ; VAR_5 <<= 1) {", "for (VAR_6=0; VAR_6 < VAR_8; VAR_6++) {", "h[VAR_6].name = VAR_6;", "h[VAR_6].val = (VAR_1[map[VAR_6]] << 14) + VAR_5;", "}", "for (VAR_6 = VAR_8 / 2 - 1; VAR_6 >= 0; VAR_6--)", "heap_sift(h, VAR_6, VAR_8);", "for (VAR_7 = VAR_8; VAR_7 < VAR_8 * 2 - 1; VAR_7++) {", "uint64_t min1v = h[0].val;", "VAR_4[h[0].name] = VAR_7;", "h[0].val = INT64_MAX;", "heap_sift(h, 0, VAR_8);", "VAR_4[h[0].name] = VAR_7;", "h[0].name = VAR_7;", "h[0].val += min1v;", "heap_sift(h, 0, VAR_8);", "}", "len[2 * VAR_8 - 2] = 0;", "for (VAR_6 = 2 * VAR_8 - 3; VAR_6 >= VAR_8; VAR_6--)", "len[VAR_6] = len[VAR_4[VAR_6]] + 1;", "for (VAR_6 = 0; VAR_6 < VAR_8; VAR_6++) {", "VAR_0[map[VAR_6]] = len[VAR_4[VAR_6]] + 1;", "if (VAR_0[map[VAR_6]] >= 32) break;", "}", "if (VAR_6==VAR_8) break;", "}", "end:\nav_free(h);", "av_free(VAR_4);", "av_free(len);", "av_free(map);", "return VAR_9;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35, 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101, 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ] ]
18,854
static int dec_scc_r(CPUCRISState *env, DisasContext *dc) { int cond = dc->op2; LOG_DIS("s%s $r%u\n", cc_name(cond), dc->op1); if (cond != CC_A) { int l1; gen_tst_cc(dc, cpu_R[dc->op1], cond); l1 = gen_new_label(); tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_R[dc->op1], 0, l1); tcg_gen_movi_tl(cpu_R[dc->op1], 1); gen_set_label(l1); } else { tcg_gen_movi_tl(cpu_R[dc->op1], 1); } cris_cc_mask(dc, 0); return 2; }
false
qemu
42a268c241183877192c376d03bd9b6d527407c7
static int dec_scc_r(CPUCRISState *env, DisasContext *dc) { int cond = dc->op2; LOG_DIS("s%s $r%u\n", cc_name(cond), dc->op1); if (cond != CC_A) { int l1; gen_tst_cc(dc, cpu_R[dc->op1], cond); l1 = gen_new_label(); tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_R[dc->op1], 0, l1); tcg_gen_movi_tl(cpu_R[dc->op1], 1); gen_set_label(l1); } else { tcg_gen_movi_tl(cpu_R[dc->op1], 1); } cris_cc_mask(dc, 0); return 2; }
{ "code": [], "line_no": [] }
static int FUNC_0(CPUCRISState *VAR_0, DisasContext *VAR_1) { int VAR_2 = VAR_1->op2; LOG_DIS("s%s $r%u\n", cc_name(VAR_2), VAR_1->op1); if (VAR_2 != CC_A) { int VAR_3; gen_tst_cc(VAR_1, cpu_R[VAR_1->op1], VAR_2); VAR_3 = gen_new_label(); tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_R[VAR_1->op1], 0, VAR_3); tcg_gen_movi_tl(cpu_R[VAR_1->op1], 1); gen_set_label(VAR_3); } else { tcg_gen_movi_tl(cpu_R[VAR_1->op1], 1); } cris_cc_mask(VAR_1, 0); return 2; }
[ "static int FUNC_0(CPUCRISState *VAR_0, DisasContext *VAR_1)\n{", "int VAR_2 = VAR_1->op2;", "LOG_DIS(\"s%s $r%u\\n\",\ncc_name(VAR_2), VAR_1->op1);", "if (VAR_2 != CC_A) {", "int VAR_3;", "gen_tst_cc(VAR_1, cpu_R[VAR_1->op1], VAR_2);", "VAR_3 = gen_new_label();", "tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_R[VAR_1->op1], 0, VAR_3);", "tcg_gen_movi_tl(cpu_R[VAR_1->op1], 1);", "gen_set_label(VAR_3);", "} else {", "tcg_gen_movi_tl(cpu_R[VAR_1->op1], 1);", "}", "cris_cc_mask(VAR_1, 0);", "return 2;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ] ]
18,855
static BlockAIOCB *bdrv_aio_rw_vector(BlockDriverState *bs, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, BlockCompletionFunc *cb, void *opaque, int is_write) { BlockAIOCBSync *acb; acb = qemu_aio_get(&bdrv_em_aiocb_info, bs, cb, opaque); acb->is_write = is_write; acb->qiov = qiov; acb->bounce = qemu_try_blockalign(bs, qiov->size); acb->bh = aio_bh_new(bdrv_get_aio_context(bs), bdrv_aio_bh_cb, acb); if (acb->bounce == NULL) { acb->ret = -ENOMEM; } else if (is_write) { qemu_iovec_to_buf(acb->qiov, 0, acb->bounce, qiov->size); acb->ret = bs->drv->bdrv_write(bs, sector_num, acb->bounce, nb_sectors); } else { acb->ret = bs->drv->bdrv_read(bs, sector_num, acb->bounce, nb_sectors); } qemu_bh_schedule(acb->bh); return &acb->common; }
false
qemu
61007b316cd71ee7333ff7a0a749a8949527575f
static BlockAIOCB *bdrv_aio_rw_vector(BlockDriverState *bs, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, BlockCompletionFunc *cb, void *opaque, int is_write) { BlockAIOCBSync *acb; acb = qemu_aio_get(&bdrv_em_aiocb_info, bs, cb, opaque); acb->is_write = is_write; acb->qiov = qiov; acb->bounce = qemu_try_blockalign(bs, qiov->size); acb->bh = aio_bh_new(bdrv_get_aio_context(bs), bdrv_aio_bh_cb, acb); if (acb->bounce == NULL) { acb->ret = -ENOMEM; } else if (is_write) { qemu_iovec_to_buf(acb->qiov, 0, acb->bounce, qiov->size); acb->ret = bs->drv->bdrv_write(bs, sector_num, acb->bounce, nb_sectors); } else { acb->ret = bs->drv->bdrv_read(bs, sector_num, acb->bounce, nb_sectors); } qemu_bh_schedule(acb->bh); return &acb->common; }
{ "code": [], "line_no": [] }
static BlockAIOCB *FUNC_0(BlockDriverState *bs, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, BlockCompletionFunc *cb, void *opaque, int is_write) { BlockAIOCBSync *acb; acb = qemu_aio_get(&bdrv_em_aiocb_info, bs, cb, opaque); acb->is_write = is_write; acb->qiov = qiov; acb->bounce = qemu_try_blockalign(bs, qiov->size); acb->bh = aio_bh_new(bdrv_get_aio_context(bs), bdrv_aio_bh_cb, acb); if (acb->bounce == NULL) { acb->ret = -ENOMEM; } else if (is_write) { qemu_iovec_to_buf(acb->qiov, 0, acb->bounce, qiov->size); acb->ret = bs->drv->bdrv_write(bs, sector_num, acb->bounce, nb_sectors); } else { acb->ret = bs->drv->bdrv_read(bs, sector_num, acb->bounce, nb_sectors); } qemu_bh_schedule(acb->bh); return &acb->common; }
[ "static BlockAIOCB *FUNC_0(BlockDriverState *bs,\nint64_t sector_num,\nQEMUIOVector *qiov,\nint nb_sectors,\nBlockCompletionFunc *cb,\nvoid *opaque,\nint is_write)\n{", "BlockAIOCBSync *acb;", "acb = qemu_aio_get(&bdrv_em_aiocb_info, bs, cb, opaque);", "acb->is_write = is_write;", "acb->qiov = qiov;", "acb->bounce = qemu_try_blockalign(bs, qiov->size);", "acb->bh = aio_bh_new(bdrv_get_aio_context(bs), bdrv_aio_bh_cb, acb);", "if (acb->bounce == NULL) {", "acb->ret = -ENOMEM;", "} else if (is_write) {", "qemu_iovec_to_buf(acb->qiov, 0, acb->bounce, qiov->size);", "acb->ret = bs->drv->bdrv_write(bs, sector_num, acb->bounce, nb_sectors);", "} else {", "acb->ret = bs->drv->bdrv_read(bs, sector_num, acb->bounce, nb_sectors);", "}", "qemu_bh_schedule(acb->bh);", "return &acb->common;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11, 13, 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 57 ], [ 59 ] ]
18,856
static int elf_core_dump(int signr, const CPUState *env) { const TaskState *ts = (const TaskState *)env->opaque; struct vm_area_struct *vma = NULL; char corefile[PATH_MAX]; struct elf_note_info info; struct elfhdr elf; struct elf_phdr phdr; struct rlimit dumpsize; struct mm_struct *mm = NULL; off_t offset = 0, data_offset = 0; int segs = 0; int fd = -1; errno = 0; getrlimit(RLIMIT_CORE, &dumpsize); if (dumpsize.rlim_cur == 0) return 0; if (core_dump_filename(ts, corefile, sizeof (corefile)) < 0) return (-errno); if ((fd = open(corefile, O_WRONLY | O_CREAT, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH)) < 0) return (-errno); /* * Walk through target process memory mappings and * set up structure containing this information. After * this point vma_xxx functions can be used. */ if ((mm = vma_init()) == NULL) goto out; walk_memory_regions(mm, vma_walker); segs = vma_get_mapping_count(mm); /* * Construct valid coredump ELF header. We also * add one more segment for notes. */ fill_elf_header(&elf, segs + 1, ELF_MACHINE, 0); if (dump_write(fd, &elf, sizeof (elf)) != 0) goto out; /* fill in in-memory version of notes */ if (fill_note_info(&info, signr, env) < 0) goto out; offset += sizeof (elf); /* elf header */ offset += (segs + 1) * sizeof (struct elf_phdr); /* program headers */ /* write out notes program header */ fill_elf_note_phdr(&phdr, info.notes_size, offset); offset += info.notes_size; if (dump_write(fd, &phdr, sizeof (phdr)) != 0) goto out; /* * ELF specification wants data to start at page boundary so * we align it here. */ offset = roundup(offset, ELF_EXEC_PAGESIZE); /* * Write program headers for memory regions mapped in * the target process. */ for (vma = vma_first(mm); vma != NULL; vma = vma_next(vma)) { (void) memset(&phdr, 0, sizeof (phdr)); phdr.p_type = PT_LOAD; phdr.p_offset = offset; phdr.p_vaddr = vma->vma_start; phdr.p_paddr = 0; phdr.p_filesz = vma_dump_size(vma); offset += phdr.p_filesz; phdr.p_memsz = vma->vma_end - vma->vma_start; phdr.p_flags = vma->vma_flags & PROT_READ ? PF_R : 0; if (vma->vma_flags & PROT_WRITE) phdr.p_flags |= PF_W; if (vma->vma_flags & PROT_EXEC) phdr.p_flags |= PF_X; phdr.p_align = ELF_EXEC_PAGESIZE; dump_write(fd, &phdr, sizeof (phdr)); } /* * Next we write notes just after program headers. No * alignment needed here. */ if (write_note_info(&info, fd) < 0) goto out; /* align data to page boundary */ data_offset = lseek(fd, 0, SEEK_CUR); data_offset = TARGET_PAGE_ALIGN(data_offset); if (lseek(fd, data_offset, SEEK_SET) != data_offset) goto out; /* * Finally we can dump process memory into corefile as well. */ for (vma = vma_first(mm); vma != NULL; vma = vma_next(vma)) { abi_ulong addr; abi_ulong end; end = vma->vma_start + vma_dump_size(vma); for (addr = vma->vma_start; addr < end; addr += TARGET_PAGE_SIZE) { char page[TARGET_PAGE_SIZE]; int error; /* * Read in page from target process memory and * write it to coredump file. */ error = copy_from_user(page, addr, sizeof (page)); if (error != 0) { (void) fprintf(stderr, "unable to dump " TARGET_ABI_FMT_lx "\n", addr); errno = -error; goto out; } if (dump_write(fd, page, TARGET_PAGE_SIZE) < 0) goto out; } } out: free_note_info(&info); if (mm != NULL) vma_delete(mm); (void) close(fd); if (errno != 0) return (-errno); return (0); }
false
qemu
80f5ce758ac277e76c016dd7c0b246e40d4fca2d
static int elf_core_dump(int signr, const CPUState *env) { const TaskState *ts = (const TaskState *)env->opaque; struct vm_area_struct *vma = NULL; char corefile[PATH_MAX]; struct elf_note_info info; struct elfhdr elf; struct elf_phdr phdr; struct rlimit dumpsize; struct mm_struct *mm = NULL; off_t offset = 0, data_offset = 0; int segs = 0; int fd = -1; errno = 0; getrlimit(RLIMIT_CORE, &dumpsize); if (dumpsize.rlim_cur == 0) return 0; if (core_dump_filename(ts, corefile, sizeof (corefile)) < 0) return (-errno); if ((fd = open(corefile, O_WRONLY | O_CREAT, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH)) < 0) return (-errno); if ((mm = vma_init()) == NULL) goto out; walk_memory_regions(mm, vma_walker); segs = vma_get_mapping_count(mm); fill_elf_header(&elf, segs + 1, ELF_MACHINE, 0); if (dump_write(fd, &elf, sizeof (elf)) != 0) goto out; if (fill_note_info(&info, signr, env) < 0) goto out; offset += sizeof (elf); offset += (segs + 1) * sizeof (struct elf_phdr); fill_elf_note_phdr(&phdr, info.notes_size, offset); offset += info.notes_size; if (dump_write(fd, &phdr, sizeof (phdr)) != 0) goto out; offset = roundup(offset, ELF_EXEC_PAGESIZE); for (vma = vma_first(mm); vma != NULL; vma = vma_next(vma)) { (void) memset(&phdr, 0, sizeof (phdr)); phdr.p_type = PT_LOAD; phdr.p_offset = offset; phdr.p_vaddr = vma->vma_start; phdr.p_paddr = 0; phdr.p_filesz = vma_dump_size(vma); offset += phdr.p_filesz; phdr.p_memsz = vma->vma_end - vma->vma_start; phdr.p_flags = vma->vma_flags & PROT_READ ? PF_R : 0; if (vma->vma_flags & PROT_WRITE) phdr.p_flags |= PF_W; if (vma->vma_flags & PROT_EXEC) phdr.p_flags |= PF_X; phdr.p_align = ELF_EXEC_PAGESIZE; dump_write(fd, &phdr, sizeof (phdr)); } if (write_note_info(&info, fd) < 0) goto out; data_offset = lseek(fd, 0, SEEK_CUR); data_offset = TARGET_PAGE_ALIGN(data_offset); if (lseek(fd, data_offset, SEEK_SET) != data_offset) goto out; for (vma = vma_first(mm); vma != NULL; vma = vma_next(vma)) { abi_ulong addr; abi_ulong end; end = vma->vma_start + vma_dump_size(vma); for (addr = vma->vma_start; addr < end; addr += TARGET_PAGE_SIZE) { char page[TARGET_PAGE_SIZE]; int error; error = copy_from_user(page, addr, sizeof (page)); if (error != 0) { (void) fprintf(stderr, "unable to dump " TARGET_ABI_FMT_lx "\n", addr); errno = -error; goto out; } if (dump_write(fd, page, TARGET_PAGE_SIZE) < 0) goto out; } } out: free_note_info(&info); if (mm != NULL) vma_delete(mm); (void) close(fd); if (errno != 0) return (-errno); return (0); }
{ "code": [], "line_no": [] }
static int FUNC_0(int VAR_0, const CPUState *VAR_1) { const TaskState *VAR_2 = (const TaskState *)VAR_1->opaque; struct vm_area_struct *VAR_3 = NULL; char VAR_4[PATH_MAX]; struct elf_note_info VAR_5; struct elfhdr VAR_6; struct elf_phdr VAR_7; struct rlimit VAR_8; struct mm_struct *VAR_9 = NULL; off_t offset = 0, data_offset = 0; int VAR_10 = 0; int VAR_11 = -1; errno = 0; getrlimit(RLIMIT_CORE, &VAR_8); if (VAR_8.rlim_cur == 0) return 0; if (core_dump_filename(VAR_2, VAR_4, sizeof (VAR_4)) < 0) return (-errno); if ((VAR_11 = open(VAR_4, O_WRONLY | O_CREAT, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH)) < 0) return (-errno); if ((VAR_9 = vma_init()) == NULL) goto out; walk_memory_regions(VAR_9, vma_walker); VAR_10 = vma_get_mapping_count(VAR_9); fill_elf_header(&VAR_6, VAR_10 + 1, ELF_MACHINE, 0); if (dump_write(VAR_11, &VAR_6, sizeof (VAR_6)) != 0) goto out; if (fill_note_info(&VAR_5, VAR_0, VAR_1) < 0) goto out; offset += sizeof (VAR_6); offset += (VAR_10 + 1) * sizeof (struct elf_phdr); fill_elf_note_phdr(&VAR_7, VAR_5.notes_size, offset); offset += VAR_5.notes_size; if (dump_write(VAR_11, &VAR_7, sizeof (VAR_7)) != 0) goto out; offset = roundup(offset, ELF_EXEC_PAGESIZE); for (VAR_3 = vma_first(VAR_9); VAR_3 != NULL; VAR_3 = vma_next(VAR_3)) { (void) memset(&VAR_7, 0, sizeof (VAR_7)); VAR_7.p_type = PT_LOAD; VAR_7.p_offset = offset; VAR_7.p_vaddr = VAR_3->vma_start; VAR_7.p_paddr = 0; VAR_7.p_filesz = vma_dump_size(VAR_3); offset += VAR_7.p_filesz; VAR_7.p_memsz = VAR_3->vma_end - VAR_3->vma_start; VAR_7.p_flags = VAR_3->vma_flags & PROT_READ ? PF_R : 0; if (VAR_3->vma_flags & PROT_WRITE) VAR_7.p_flags |= PF_W; if (VAR_3->vma_flags & PROT_EXEC) VAR_7.p_flags |= PF_X; VAR_7.p_align = ELF_EXEC_PAGESIZE; dump_write(VAR_11, &VAR_7, sizeof (VAR_7)); } if (write_note_info(&VAR_5, VAR_11) < 0) goto out; data_offset = lseek(VAR_11, 0, SEEK_CUR); data_offset = TARGET_PAGE_ALIGN(data_offset); if (lseek(VAR_11, data_offset, SEEK_SET) != data_offset) goto out; for (VAR_3 = vma_first(VAR_9); VAR_3 != NULL; VAR_3 = vma_next(VAR_3)) { abi_ulong addr; abi_ulong end; end = VAR_3->vma_start + vma_dump_size(VAR_3); for (addr = VAR_3->vma_start; addr < end; addr += TARGET_PAGE_SIZE) { char page[TARGET_PAGE_SIZE]; int error; error = copy_from_user(page, addr, sizeof (page)); if (error != 0) { (void) fprintf(stderr, "unable to dump " TARGET_ABI_FMT_lx "\n", addr); errno = -error; goto out; } if (dump_write(VAR_11, page, TARGET_PAGE_SIZE) < 0) goto out; } } out: free_note_info(&VAR_5); if (VAR_9 != NULL) vma_delete(VAR_9); (void) close(VAR_11); if (errno != 0) return (-errno); return (0); }
[ "static int FUNC_0(int VAR_0, const CPUState *VAR_1)\n{", "const TaskState *VAR_2 = (const TaskState *)VAR_1->opaque;", "struct vm_area_struct *VAR_3 = NULL;", "char VAR_4[PATH_MAX];", "struct elf_note_info VAR_5;", "struct elfhdr VAR_6;", "struct elf_phdr VAR_7;", "struct rlimit VAR_8;", "struct mm_struct *VAR_9 = NULL;", "off_t offset = 0, data_offset = 0;", "int VAR_10 = 0;", "int VAR_11 = -1;", "errno = 0;", "getrlimit(RLIMIT_CORE, &VAR_8);", "if (VAR_8.rlim_cur == 0)\nreturn 0;", "if (core_dump_filename(VAR_2, VAR_4, sizeof (VAR_4)) < 0)\nreturn (-errno);", "if ((VAR_11 = open(VAR_4, O_WRONLY | O_CREAT,\nS_IRUSR|S_IWUSR|S_IRGRP|S_IROTH)) < 0)\nreturn (-errno);", "if ((VAR_9 = vma_init()) == NULL)\ngoto out;", "walk_memory_regions(VAR_9, vma_walker);", "VAR_10 = vma_get_mapping_count(VAR_9);", "fill_elf_header(&VAR_6, VAR_10 + 1, ELF_MACHINE, 0);", "if (dump_write(VAR_11, &VAR_6, sizeof (VAR_6)) != 0)\ngoto out;", "if (fill_note_info(&VAR_5, VAR_0, VAR_1) < 0)\ngoto out;", "offset += sizeof (VAR_6);", "offset += (VAR_10 + 1) * sizeof (struct elf_phdr);", "fill_elf_note_phdr(&VAR_7, VAR_5.notes_size, offset);", "offset += VAR_5.notes_size;", "if (dump_write(VAR_11, &VAR_7, sizeof (VAR_7)) != 0)\ngoto out;", "offset = roundup(offset, ELF_EXEC_PAGESIZE);", "for (VAR_3 = vma_first(VAR_9); VAR_3 != NULL; VAR_3 = vma_next(VAR_3)) {", "(void) memset(&VAR_7, 0, sizeof (VAR_7));", "VAR_7.p_type = PT_LOAD;", "VAR_7.p_offset = offset;", "VAR_7.p_vaddr = VAR_3->vma_start;", "VAR_7.p_paddr = 0;", "VAR_7.p_filesz = vma_dump_size(VAR_3);", "offset += VAR_7.p_filesz;", "VAR_7.p_memsz = VAR_3->vma_end - VAR_3->vma_start;", "VAR_7.p_flags = VAR_3->vma_flags & PROT_READ ? PF_R : 0;", "if (VAR_3->vma_flags & PROT_WRITE)\nVAR_7.p_flags |= PF_W;", "if (VAR_3->vma_flags & PROT_EXEC)\nVAR_7.p_flags |= PF_X;", "VAR_7.p_align = ELF_EXEC_PAGESIZE;", "dump_write(VAR_11, &VAR_7, sizeof (VAR_7));", "}", "if (write_note_info(&VAR_5, VAR_11) < 0)\ngoto out;", "data_offset = lseek(VAR_11, 0, SEEK_CUR);", "data_offset = TARGET_PAGE_ALIGN(data_offset);", "if (lseek(VAR_11, data_offset, SEEK_SET) != data_offset)\ngoto out;", "for (VAR_3 = vma_first(VAR_9); VAR_3 != NULL; VAR_3 = vma_next(VAR_3)) {", "abi_ulong addr;", "abi_ulong end;", "end = VAR_3->vma_start + vma_dump_size(VAR_3);", "for (addr = VAR_3->vma_start; addr < end;", "addr += TARGET_PAGE_SIZE) {", "char page[TARGET_PAGE_SIZE];", "int error;", "error = copy_from_user(page, addr, sizeof (page));", "if (error != 0) {", "(void) fprintf(stderr, \"unable to dump \" TARGET_ABI_FMT_lx \"\\n\",\naddr);", "errno = -error;", "goto out;", "}", "if (dump_write(VAR_11, page, TARGET_PAGE_SIZE) < 0)\ngoto out;", "}", "}", "out:\nfree_note_info(&VAR_5);", "if (VAR_9 != NULL)\nvma_delete(VAR_9);", "(void) close(VAR_11);", "if (errno != 0)\nreturn (-errno);", "return (0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33, 35 ], [ 39, 41 ], [ 45, 47, 49 ], [ 63, 65 ], [ 69 ], [ 71 ], [ 83 ], [ 85, 87 ], [ 93, 95 ], [ 99 ], [ 101 ], [ 107 ], [ 111 ], [ 113, 115 ], [ 127 ], [ 139 ], [ 141 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161, 163 ], [ 165, 167 ], [ 169 ], [ 173 ], [ 175 ], [ 187, 189 ], [ 195 ], [ 197 ], [ 199, 201 ], [ 211 ], [ 213 ], [ 215 ], [ 219 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 241 ], [ 243 ], [ 245, 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255, 257 ], [ 259 ], [ 261 ], [ 265, 267 ], [ 269, 271 ], [ 273 ], [ 277, 279 ], [ 281 ], [ 283 ] ]
18,857
int net_init_vhost_user(const NetClientOptions *opts, const char *name, NetClientState *peer, Error **errp) { const NetdevVhostUserOptions *vhost_user_opts; CharDriverState *chr; assert(opts->kind == NET_CLIENT_OPTIONS_KIND_VHOST_USER); vhost_user_opts = opts->vhost_user; chr = net_vhost_parse_chardev(vhost_user_opts, errp); if (!chr) { return -1; } /* verify net frontend */ if (qemu_opts_foreach(qemu_find_opts("device"), net_vhost_check_net, (char *)name, errp)) { return -1; } return net_vhost_user_init(peer, "vhost_user", name, chr); }
false
qemu
b931bfbf042983f311b3b09894d8030b2755a638
int net_init_vhost_user(const NetClientOptions *opts, const char *name, NetClientState *peer, Error **errp) { const NetdevVhostUserOptions *vhost_user_opts; CharDriverState *chr; assert(opts->kind == NET_CLIENT_OPTIONS_KIND_VHOST_USER); vhost_user_opts = opts->vhost_user; chr = net_vhost_parse_chardev(vhost_user_opts, errp); if (!chr) { return -1; } if (qemu_opts_foreach(qemu_find_opts("device"), net_vhost_check_net, (char *)name, errp)) { return -1; } return net_vhost_user_init(peer, "vhost_user", name, chr); }
{ "code": [], "line_no": [] }
int FUNC_0(const NetClientOptions *VAR_0, const char *VAR_1, NetClientState *VAR_2, Error **VAR_3) { const NetdevVhostUserOptions *VAR_4; CharDriverState *chr; assert(VAR_0->kind == NET_CLIENT_OPTIONS_KIND_VHOST_USER); VAR_4 = VAR_0->vhost_user; chr = net_vhost_parse_chardev(VAR_4, VAR_3); if (!chr) { return -1; } if (qemu_opts_foreach(qemu_find_opts("device"), net_vhost_check_net, (char *)VAR_1, VAR_3)) { return -1; } return net_vhost_user_init(VAR_2, "vhost_user", VAR_1, chr); }
[ "int FUNC_0(const NetClientOptions *VAR_0, const char *VAR_1,\nNetClientState *VAR_2, Error **VAR_3)\n{", "const NetdevVhostUserOptions *VAR_4;", "CharDriverState *chr;", "assert(VAR_0->kind == NET_CLIENT_OPTIONS_KIND_VHOST_USER);", "VAR_4 = VAR_0->vhost_user;", "chr = net_vhost_parse_chardev(VAR_4, VAR_3);", "if (!chr) {", "return -1;", "}", "if (qemu_opts_foreach(qemu_find_opts(\"device\"), net_vhost_check_net,\n(char *)VAR_1, VAR_3)) {", "return -1;", "}", "return net_vhost_user_init(VAR_2, \"vhost_user\", VAR_1, chr);", "}" ]
[ 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 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 43 ], [ 45 ] ]
18,858
static void *tcg_cpu_thread_fn(void *arg) { CPUState *env = arg; qemu_tcg_init_cpu_signals(); qemu_thread_self(env->thread); /* signal CPU creation */ qemu_mutex_lock(&qemu_global_mutex); for (env = first_cpu; env != NULL; env = env->next_cpu) env->created = 1; qemu_cond_signal(&qemu_cpu_cond); /* and wait for machine initialization */ while (!qemu_system_ready) qemu_cond_timedwait(&qemu_system_cond, &qemu_global_mutex, 100); while (1) { cpu_exec_all(); qemu_tcg_wait_io_event(); } return NULL; }
false
qemu
7e97cd88148876bad36ee7c66d526dcaed328d0d
static void *tcg_cpu_thread_fn(void *arg) { CPUState *env = arg; qemu_tcg_init_cpu_signals(); qemu_thread_self(env->thread); qemu_mutex_lock(&qemu_global_mutex); for (env = first_cpu; env != NULL; env = env->next_cpu) env->created = 1; qemu_cond_signal(&qemu_cpu_cond); while (!qemu_system_ready) qemu_cond_timedwait(&qemu_system_cond, &qemu_global_mutex, 100); while (1) { cpu_exec_all(); qemu_tcg_wait_io_event(); } return NULL; }
{ "code": [], "line_no": [] }
static void *FUNC_0(void *VAR_0) { CPUState *env = VAR_0; qemu_tcg_init_cpu_signals(); qemu_thread_self(env->thread); qemu_mutex_lock(&qemu_global_mutex); for (env = first_cpu; env != NULL; env = env->next_cpu) env->created = 1; qemu_cond_signal(&qemu_cpu_cond); while (!qemu_system_ready) qemu_cond_timedwait(&qemu_system_cond, &qemu_global_mutex, 100); while (1) { cpu_exec_all(); qemu_tcg_wait_io_event(); } return NULL; }
[ "static void *FUNC_0(void *VAR_0)\n{", "CPUState *env = VAR_0;", "qemu_tcg_init_cpu_signals();", "qemu_thread_self(env->thread);", "qemu_mutex_lock(&qemu_global_mutex);", "for (env = first_cpu; env != NULL; env = env->next_cpu)", "env->created = 1;", "qemu_cond_signal(&qemu_cpu_cond);", "while (!qemu_system_ready)\nqemu_cond_timedwait(&qemu_system_cond, &qemu_global_mutex, 100);", "while (1) {", "cpu_exec_all();", "qemu_tcg_wait_io_event();", "}", "return NULL;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 29, 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ] ]
18,859
static inline void gen_op_mulscc(TCGv dst, TCGv src1, TCGv src2) { TCGv r_temp, zero; r_temp = tcg_temp_new(); /* old op: if (!(env->y & 1)) T1 = 0; */ zero = tcg_const_tl(0); tcg_gen_andi_tl(cpu_cc_src, src1, 0xffffffff); tcg_gen_andi_tl(r_temp, cpu_y, 0x1); tcg_gen_andi_tl(cpu_cc_src2, src2, 0xffffffff); tcg_gen_movcond_tl(TCG_COND_EQ, cpu_cc_src2, r_temp, zero, zero, cpu_cc_src2); tcg_temp_free(zero); // b2 = T0 & 1; // env->y = (b2 << 31) | (env->y >> 1); tcg_gen_andi_tl(r_temp, cpu_cc_src, 0x1); tcg_gen_shli_tl(r_temp, r_temp, 31); tcg_gen_shri_tl(cpu_tmp0, cpu_y, 1); tcg_gen_andi_tl(cpu_tmp0, cpu_tmp0, 0x7fffffff); tcg_gen_or_tl(cpu_tmp0, cpu_tmp0, r_temp); tcg_gen_andi_tl(cpu_y, cpu_tmp0, 0xffffffff); // b1 = N ^ V; gen_mov_reg_N(cpu_tmp0, cpu_psr); gen_mov_reg_V(r_temp, cpu_psr); tcg_gen_xor_tl(cpu_tmp0, cpu_tmp0, r_temp); tcg_temp_free(r_temp); // T0 = (b1 << 31) | (T0 >> 1); // src1 = T0; tcg_gen_shli_tl(cpu_tmp0, cpu_tmp0, 31); tcg_gen_shri_tl(cpu_cc_src, cpu_cc_src, 1); tcg_gen_or_tl(cpu_cc_src, cpu_cc_src, cpu_tmp0); tcg_gen_add_tl(cpu_cc_dst, cpu_cc_src, cpu_cc_src2); tcg_gen_mov_tl(dst, cpu_cc_dst); }
false
qemu
de9e9d9f17a36ff76c1a02a5348835e5e0a081b0
static inline void gen_op_mulscc(TCGv dst, TCGv src1, TCGv src2) { TCGv r_temp, zero; r_temp = tcg_temp_new(); zero = tcg_const_tl(0); tcg_gen_andi_tl(cpu_cc_src, src1, 0xffffffff); tcg_gen_andi_tl(r_temp, cpu_y, 0x1); tcg_gen_andi_tl(cpu_cc_src2, src2, 0xffffffff); tcg_gen_movcond_tl(TCG_COND_EQ, cpu_cc_src2, r_temp, zero, zero, cpu_cc_src2); tcg_temp_free(zero); tcg_gen_andi_tl(r_temp, cpu_cc_src, 0x1); tcg_gen_shli_tl(r_temp, r_temp, 31); tcg_gen_shri_tl(cpu_tmp0, cpu_y, 1); tcg_gen_andi_tl(cpu_tmp0, cpu_tmp0, 0x7fffffff); tcg_gen_or_tl(cpu_tmp0, cpu_tmp0, r_temp); tcg_gen_andi_tl(cpu_y, cpu_tmp0, 0xffffffff); gen_mov_reg_N(cpu_tmp0, cpu_psr); gen_mov_reg_V(r_temp, cpu_psr); tcg_gen_xor_tl(cpu_tmp0, cpu_tmp0, r_temp); tcg_temp_free(r_temp); tcg_gen_shli_tl(cpu_tmp0, cpu_tmp0, 31); tcg_gen_shri_tl(cpu_cc_src, cpu_cc_src, 1); tcg_gen_or_tl(cpu_cc_src, cpu_cc_src, cpu_tmp0); tcg_gen_add_tl(cpu_cc_dst, cpu_cc_src, cpu_cc_src2); tcg_gen_mov_tl(dst, cpu_cc_dst); }
{ "code": [], "line_no": [] }
static inline void FUNC_0(TCGv VAR_0, TCGv VAR_1, TCGv VAR_2) { TCGv r_temp, zero; r_temp = tcg_temp_new(); zero = tcg_const_tl(0); tcg_gen_andi_tl(cpu_cc_src, VAR_1, 0xffffffff); tcg_gen_andi_tl(r_temp, cpu_y, 0x1); tcg_gen_andi_tl(cpu_cc_src2, VAR_2, 0xffffffff); tcg_gen_movcond_tl(TCG_COND_EQ, cpu_cc_src2, r_temp, zero, zero, cpu_cc_src2); tcg_temp_free(zero); tcg_gen_andi_tl(r_temp, cpu_cc_src, 0x1); tcg_gen_shli_tl(r_temp, r_temp, 31); tcg_gen_shri_tl(cpu_tmp0, cpu_y, 1); tcg_gen_andi_tl(cpu_tmp0, cpu_tmp0, 0x7fffffff); tcg_gen_or_tl(cpu_tmp0, cpu_tmp0, r_temp); tcg_gen_andi_tl(cpu_y, cpu_tmp0, 0xffffffff); gen_mov_reg_N(cpu_tmp0, cpu_psr); gen_mov_reg_V(r_temp, cpu_psr); tcg_gen_xor_tl(cpu_tmp0, cpu_tmp0, r_temp); tcg_temp_free(r_temp); tcg_gen_shli_tl(cpu_tmp0, cpu_tmp0, 31); tcg_gen_shri_tl(cpu_cc_src, cpu_cc_src, 1); tcg_gen_or_tl(cpu_cc_src, cpu_cc_src, cpu_tmp0); tcg_gen_add_tl(cpu_cc_dst, cpu_cc_src, cpu_cc_src2); tcg_gen_mov_tl(VAR_0, cpu_cc_dst); }
[ "static inline void FUNC_0(TCGv VAR_0, TCGv VAR_1, TCGv VAR_2)\n{", "TCGv r_temp, zero;", "r_temp = tcg_temp_new();", "zero = tcg_const_tl(0);", "tcg_gen_andi_tl(cpu_cc_src, VAR_1, 0xffffffff);", "tcg_gen_andi_tl(r_temp, cpu_y, 0x1);", "tcg_gen_andi_tl(cpu_cc_src2, VAR_2, 0xffffffff);", "tcg_gen_movcond_tl(TCG_COND_EQ, cpu_cc_src2, r_temp, zero,\nzero, cpu_cc_src2);", "tcg_temp_free(zero);", "tcg_gen_andi_tl(r_temp, cpu_cc_src, 0x1);", "tcg_gen_shli_tl(r_temp, r_temp, 31);", "tcg_gen_shri_tl(cpu_tmp0, cpu_y, 1);", "tcg_gen_andi_tl(cpu_tmp0, cpu_tmp0, 0x7fffffff);", "tcg_gen_or_tl(cpu_tmp0, cpu_tmp0, r_temp);", "tcg_gen_andi_tl(cpu_y, cpu_tmp0, 0xffffffff);", "gen_mov_reg_N(cpu_tmp0, cpu_psr);", "gen_mov_reg_V(r_temp, cpu_psr);", "tcg_gen_xor_tl(cpu_tmp0, cpu_tmp0, r_temp);", "tcg_temp_free(r_temp);", "tcg_gen_shli_tl(cpu_tmp0, cpu_tmp0, 31);", "tcg_gen_shri_tl(cpu_cc_src, cpu_cc_src, 1);", "tcg_gen_or_tl(cpu_cc_src, cpu_cc_src, cpu_tmp0);", "tcg_gen_add_tl(cpu_cc_dst, cpu_cc_src, cpu_cc_src2);", "tcg_gen_mov_tl(VAR_0, cpu_cc_dst);", "}" ]
[ 0, 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 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29, 31 ], [ 33 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 83 ], [ 85 ] ]
18,860
dshow_cycle_pins(AVFormatContext *avctx, enum dshowDeviceType devtype, IBaseFilter *device_filter, IPin **ppin) { IEnumPins *pins = 0; IPin *device_pin = NULL; IPin *pin; int r; const GUID *mediatype[2] = { &MEDIATYPE_Video, &MEDIATYPE_Audio }; const char *devtypename = (devtype == VideoDevice) ? "video" : "audio"; r = IBaseFilter_EnumPins(device_filter, &pins); if (r != S_OK) { av_log(avctx, AV_LOG_ERROR, "Could not enumerate pins.\n"); return AVERROR(EIO); } while (IEnumPins_Next(pins, 1, &pin, NULL) == S_OK && !device_pin) { IKsPropertySet *p = NULL; IEnumMediaTypes *types; PIN_INFO info = {0}; AM_MEDIA_TYPE *type; GUID category; DWORD r2; IPin_QueryPinInfo(pin, &info); IBaseFilter_Release(info.pFilter); if (info.dir != PINDIR_OUTPUT) goto next; if (IPin_QueryInterface(pin, &IID_IKsPropertySet, (void **) &p) != S_OK) goto next; if (IKsPropertySet_Get(p, &AMPROPSETID_Pin, AMPROPERTY_PIN_CATEGORY, NULL, 0, &category, sizeof(GUID), &r2) != S_OK) goto next; if (!IsEqualGUID(&category, &PIN_CATEGORY_CAPTURE)) goto next; if (IPin_EnumMediaTypes(pin, &types) != S_OK) goto next; IEnumMediaTypes_Reset(types); while (IEnumMediaTypes_Next(types, 1, &type, NULL) == S_OK && !device_pin) { if (IsEqualGUID(&type->majortype, mediatype[devtype])) { device_pin = pin; goto next; } CoTaskMemFree(type); } next: if (types) IEnumMediaTypes_Release(types); if (p) IKsPropertySet_Release(p); if (device_pin != pin) IPin_Release(pin); } IEnumPins_Release(pins); if (!device_pin) { av_log(avctx, AV_LOG_ERROR, "Could not find output pin from %s capture device.\n", devtypename); return AVERROR(EIO); } *ppin = device_pin; return 0; }
false
FFmpeg
d0da310317cae25c0c533f6862fb25dc81ec3d4b
dshow_cycle_pins(AVFormatContext *avctx, enum dshowDeviceType devtype, IBaseFilter *device_filter, IPin **ppin) { IEnumPins *pins = 0; IPin *device_pin = NULL; IPin *pin; int r; const GUID *mediatype[2] = { &MEDIATYPE_Video, &MEDIATYPE_Audio }; const char *devtypename = (devtype == VideoDevice) ? "video" : "audio"; r = IBaseFilter_EnumPins(device_filter, &pins); if (r != S_OK) { av_log(avctx, AV_LOG_ERROR, "Could not enumerate pins.\n"); return AVERROR(EIO); } while (IEnumPins_Next(pins, 1, &pin, NULL) == S_OK && !device_pin) { IKsPropertySet *p = NULL; IEnumMediaTypes *types; PIN_INFO info = {0}; AM_MEDIA_TYPE *type; GUID category; DWORD r2; IPin_QueryPinInfo(pin, &info); IBaseFilter_Release(info.pFilter); if (info.dir != PINDIR_OUTPUT) goto next; if (IPin_QueryInterface(pin, &IID_IKsPropertySet, (void **) &p) != S_OK) goto next; if (IKsPropertySet_Get(p, &AMPROPSETID_Pin, AMPROPERTY_PIN_CATEGORY, NULL, 0, &category, sizeof(GUID), &r2) != S_OK) goto next; if (!IsEqualGUID(&category, &PIN_CATEGORY_CAPTURE)) goto next; if (IPin_EnumMediaTypes(pin, &types) != S_OK) goto next; IEnumMediaTypes_Reset(types); while (IEnumMediaTypes_Next(types, 1, &type, NULL) == S_OK && !device_pin) { if (IsEqualGUID(&type->majortype, mediatype[devtype])) { device_pin = pin; goto next; } CoTaskMemFree(type); } next: if (types) IEnumMediaTypes_Release(types); if (p) IKsPropertySet_Release(p); if (device_pin != pin) IPin_Release(pin); } IEnumPins_Release(pins); if (!device_pin) { av_log(avctx, AV_LOG_ERROR, "Could not find output pin from %s capture device.\n", devtypename); return AVERROR(EIO); } *ppin = device_pin; return 0; }
{ "code": [], "line_no": [] }
FUNC_0(AVFormatContext *VAR_0, enum dshowDeviceType VAR_1, IBaseFilter *VAR_2, IPin **VAR_3) { IEnumPins *pins = 0; IPin *device_pin = NULL; IPin *pin; int VAR_4; const GUID *VAR_5[2] = { &MEDIATYPE_Video, &MEDIATYPE_Audio }; const char *VAR_6 = (VAR_1 == VideoDevice) ? "video" : "audio"; VAR_4 = IBaseFilter_EnumPins(VAR_2, &pins); if (VAR_4 != S_OK) { av_log(VAR_0, AV_LOG_ERROR, "Could not enumerate pins.\n"); return AVERROR(EIO); } while (IEnumPins_Next(pins, 1, &pin, NULL) == S_OK && !device_pin) { IKsPropertySet *p = NULL; IEnumMediaTypes *types; PIN_INFO info = {0}; AM_MEDIA_TYPE *type; GUID category; DWORD r2; IPin_QueryPinInfo(pin, &info); IBaseFilter_Release(info.pFilter); if (info.dir != PINDIR_OUTPUT) goto next; if (IPin_QueryInterface(pin, &IID_IKsPropertySet, (void **) &p) != S_OK) goto next; if (IKsPropertySet_Get(p, &AMPROPSETID_Pin, AMPROPERTY_PIN_CATEGORY, NULL, 0, &category, sizeof(GUID), &r2) != S_OK) goto next; if (!IsEqualGUID(&category, &PIN_CATEGORY_CAPTURE)) goto next; if (IPin_EnumMediaTypes(pin, &types) != S_OK) goto next; IEnumMediaTypes_Reset(types); while (IEnumMediaTypes_Next(types, 1, &type, NULL) == S_OK && !device_pin) { if (IsEqualGUID(&type->majortype, VAR_5[VAR_1])) { device_pin = pin; goto next; } CoTaskMemFree(type); } next: if (types) IEnumMediaTypes_Release(types); if (p) IKsPropertySet_Release(p); if (device_pin != pin) IPin_Release(pin); } IEnumPins_Release(pins); if (!device_pin) { av_log(VAR_0, AV_LOG_ERROR, "Could not find output pin from %s capture device.\n", VAR_6); return AVERROR(EIO); } *VAR_3 = device_pin; return 0; }
[ "FUNC_0(AVFormatContext *VAR_0, enum dshowDeviceType VAR_1,\nIBaseFilter *VAR_2, IPin **VAR_3)\n{", "IEnumPins *pins = 0;", "IPin *device_pin = NULL;", "IPin *pin;", "int VAR_4;", "const GUID *VAR_5[2] = { &MEDIATYPE_Video, &MEDIATYPE_Audio };", "const char *VAR_6 = (VAR_1 == VideoDevice) ? \"video\" : \"audio\";", "VAR_4 = IBaseFilter_EnumPins(VAR_2, &pins);", "if (VAR_4 != S_OK) {", "av_log(VAR_0, AV_LOG_ERROR, \"Could not enumerate pins.\\n\");", "return AVERROR(EIO);", "}", "while (IEnumPins_Next(pins, 1, &pin, NULL) == S_OK && !device_pin) {", "IKsPropertySet *p = NULL;", "IEnumMediaTypes *types;", "PIN_INFO info = {0};", "AM_MEDIA_TYPE *type;", "GUID category;", "DWORD r2;", "IPin_QueryPinInfo(pin, &info);", "IBaseFilter_Release(info.pFilter);", "if (info.dir != PINDIR_OUTPUT)\ngoto next;", "if (IPin_QueryInterface(pin, &IID_IKsPropertySet, (void **) &p) != S_OK)\ngoto next;", "if (IKsPropertySet_Get(p, &AMPROPSETID_Pin, AMPROPERTY_PIN_CATEGORY,\nNULL, 0, &category, sizeof(GUID), &r2) != S_OK)\ngoto next;", "if (!IsEqualGUID(&category, &PIN_CATEGORY_CAPTURE))\ngoto next;", "if (IPin_EnumMediaTypes(pin, &types) != S_OK)\ngoto next;", "IEnumMediaTypes_Reset(types);", "while (IEnumMediaTypes_Next(types, 1, &type, NULL) == S_OK && !device_pin) {", "if (IsEqualGUID(&type->majortype, VAR_5[VAR_1])) {", "device_pin = pin;", "goto next;", "}", "CoTaskMemFree(type);", "}", "next:\nif (types)\nIEnumMediaTypes_Release(types);", "if (p)\nIKsPropertySet_Release(p);", "if (device_pin != pin)\nIPin_Release(pin);", "}", "IEnumPins_Release(pins);", "if (!device_pin) {", "av_log(VAR_0, AV_LOG_ERROR,\n\"Could not find output pin from %s capture device.\\n\", VAR_6);", "return AVERROR(EIO);", "}", "*VAR_3 = device_pin;", "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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 57, 59 ], [ 61, 63 ], [ 65, 67, 69 ], [ 71, 73 ], [ 77, 79 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 101, 103, 105 ], [ 107, 109 ], [ 111, 113 ], [ 115 ], [ 119 ], [ 123 ], [ 125, 127 ], [ 129 ], [ 131 ], [ 133 ], [ 137 ], [ 139 ] ]
18,861
static int coroutine_fn blkreplay_co_pwrite_zeroes(BlockDriverState *bs, int64_t offset, int count, BdrvRequestFlags flags) { uint64_t reqid = request_id++; int ret = bdrv_co_pwrite_zeroes(bs->file->bs, offset, count, flags); block_request_create(reqid, bs, qemu_coroutine_self()); qemu_coroutine_yield(); return ret; }
false
qemu
a03ef88f77af045a2eb9629b5ce774a3fb973c5e
static int coroutine_fn blkreplay_co_pwrite_zeroes(BlockDriverState *bs, int64_t offset, int count, BdrvRequestFlags flags) { uint64_t reqid = request_id++; int ret = bdrv_co_pwrite_zeroes(bs->file->bs, offset, count, flags); block_request_create(reqid, bs, qemu_coroutine_self()); qemu_coroutine_yield(); return ret; }
{ "code": [], "line_no": [] }
static int VAR_0 blkreplay_co_pwrite_zeroes(BlockDriverState *bs, int64_t offset, int count, BdrvRequestFlags flags) { uint64_t reqid = request_id++; int ret = bdrv_co_pwrite_zeroes(bs->file->bs, offset, count, flags); block_request_create(reqid, bs, qemu_coroutine_self()); qemu_coroutine_yield(); return ret; }
[ "static int VAR_0 blkreplay_co_pwrite_zeroes(BlockDriverState *bs,\nint64_t offset, int count, BdrvRequestFlags flags)\n{", "uint64_t reqid = request_id++;", "int ret = bdrv_co_pwrite_zeroes(bs->file->bs, offset, count, flags);", "block_request_create(reqid, bs, qemu_coroutine_self());", "qemu_coroutine_yield();", "return ret;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ] ]
18,862
static void tcg_target_qemu_prologue (TCGContext *s) { int i, frame_size; #ifndef __APPLE__ uint64_t addr; #endif frame_size = 0 + 8 /* back chain */ + 8 /* CR */ + 8 /* LR */ + 8 /* compiler doubleword */ + 8 /* link editor doubleword */ + 8 /* TOC save area */ + TCG_STATIC_CALL_ARGS_SIZE + ARRAY_SIZE (tcg_target_callee_save_regs) * 8 ; frame_size = (frame_size + 15) & ~15; #ifndef __APPLE__ /* First emit adhoc function descriptor */ addr = (uint64_t) s->code_ptr + 24; tcg_out32 (s, addr >> 32); tcg_out32 (s, addr); /* entry point */ s->code_ptr += 16; /* skip TOC and environment pointer */ #endif /* Prologue */ tcg_out32 (s, MFSPR | RT (0) | LR); tcg_out32 (s, STDU | RS (1) | RA (1) | (-frame_size & 0xffff)); for (i = 0; i < ARRAY_SIZE (tcg_target_callee_save_regs); ++i) tcg_out32 (s, (STD | RS (tcg_target_callee_save_regs[i]) | RA (1) | (i * 8 + 48 + TCG_STATIC_CALL_ARGS_SIZE) ) ); tcg_out32 (s, STD | RS (0) | RA (1) | (frame_size + 16)); #ifdef CONFIG_USE_GUEST_BASE if (GUEST_BASE) { tcg_out_movi (s, TCG_TYPE_I64, TCG_GUEST_BASE_REG, GUEST_BASE); tcg_regset_set_reg(s->reserved_regs, TCG_GUEST_BASE_REG); } #endif tcg_out32 (s, MTSPR | RS (3) | CTR); tcg_out32 (s, BCCTR | BO_ALWAYS); /* Epilogue */ tb_ret_addr = s->code_ptr; for (i = 0; i < ARRAY_SIZE (tcg_target_callee_save_regs); ++i) tcg_out32 (s, (LD | RT (tcg_target_callee_save_regs[i]) | RA (1) | (i * 8 + 48 + TCG_STATIC_CALL_ARGS_SIZE) ) ); tcg_out32 (s, LD | RT (0) | RA (1) | (frame_size + 16)); tcg_out32 (s, MTSPR | RS (0) | LR); tcg_out32 (s, ADDI | RT (1) | RA (1) | frame_size); tcg_out32 (s, BCLR | BO_ALWAYS); }
false
qemu
cea5f9a28faa528b6b1b117c9ab2d8828f473fef
static void tcg_target_qemu_prologue (TCGContext *s) { int i, frame_size; #ifndef __APPLE__ uint64_t addr; #endif frame_size = 0 + 8 + 8 + 8 + 8 + 8 + 8 + TCG_STATIC_CALL_ARGS_SIZE + ARRAY_SIZE (tcg_target_callee_save_regs) * 8 ; frame_size = (frame_size + 15) & ~15; #ifndef __APPLE__ addr = (uint64_t) s->code_ptr + 24; tcg_out32 (s, addr >> 32); tcg_out32 (s, addr); s->code_ptr += 16; #endif tcg_out32 (s, MFSPR | RT (0) | LR); tcg_out32 (s, STDU | RS (1) | RA (1) | (-frame_size & 0xffff)); for (i = 0; i < ARRAY_SIZE (tcg_target_callee_save_regs); ++i) tcg_out32 (s, (STD | RS (tcg_target_callee_save_regs[i]) | RA (1) | (i * 8 + 48 + TCG_STATIC_CALL_ARGS_SIZE) ) ); tcg_out32 (s, STD | RS (0) | RA (1) | (frame_size + 16)); #ifdef CONFIG_USE_GUEST_BASE if (GUEST_BASE) { tcg_out_movi (s, TCG_TYPE_I64, TCG_GUEST_BASE_REG, GUEST_BASE); tcg_regset_set_reg(s->reserved_regs, TCG_GUEST_BASE_REG); } #endif tcg_out32 (s, MTSPR | RS (3) | CTR); tcg_out32 (s, BCCTR | BO_ALWAYS); tb_ret_addr = s->code_ptr; for (i = 0; i < ARRAY_SIZE (tcg_target_callee_save_regs); ++i) tcg_out32 (s, (LD | RT (tcg_target_callee_save_regs[i]) | RA (1) | (i * 8 + 48 + TCG_STATIC_CALL_ARGS_SIZE) ) ); tcg_out32 (s, LD | RT (0) | RA (1) | (frame_size + 16)); tcg_out32 (s, MTSPR | RS (0) | LR); tcg_out32 (s, ADDI | RT (1) | RA (1) | frame_size); tcg_out32 (s, BCLR | BO_ALWAYS); }
{ "code": [], "line_no": [] }
static void FUNC_0 (TCGContext *VAR_0) { int VAR_1, VAR_2; #ifndef __APPLE__ uint64_t addr; #endif VAR_2 = 0 + 8 + 8 + 8 + 8 + 8 + 8 + TCG_STATIC_CALL_ARGS_SIZE + ARRAY_SIZE (tcg_target_callee_save_regs) * 8 ; VAR_2 = (VAR_2 + 15) & ~15; #ifndef __APPLE__ addr = (uint64_t) VAR_0->code_ptr + 24; tcg_out32 (VAR_0, addr >> 32); tcg_out32 (VAR_0, addr); VAR_0->code_ptr += 16; #endif tcg_out32 (VAR_0, MFSPR | RT (0) | LR); tcg_out32 (VAR_0, STDU | RS (1) | RA (1) | (-VAR_2 & 0xffff)); for (VAR_1 = 0; VAR_1 < ARRAY_SIZE (tcg_target_callee_save_regs); ++VAR_1) tcg_out32 (VAR_0, (STD | RS (tcg_target_callee_save_regs[VAR_1]) | RA (1) | (VAR_1 * 8 + 48 + TCG_STATIC_CALL_ARGS_SIZE) ) ); tcg_out32 (VAR_0, STD | RS (0) | RA (1) | (VAR_2 + 16)); #ifdef CONFIG_USE_GUEST_BASE if (GUEST_BASE) { tcg_out_movi (VAR_0, TCG_TYPE_I64, TCG_GUEST_BASE_REG, GUEST_BASE); tcg_regset_set_reg(VAR_0->reserved_regs, TCG_GUEST_BASE_REG); } #endif tcg_out32 (VAR_0, MTSPR | RS (3) | CTR); tcg_out32 (VAR_0, BCCTR | BO_ALWAYS); tb_ret_addr = VAR_0->code_ptr; for (VAR_1 = 0; VAR_1 < ARRAY_SIZE (tcg_target_callee_save_regs); ++VAR_1) tcg_out32 (VAR_0, (LD | RT (tcg_target_callee_save_regs[VAR_1]) | RA (1) | (VAR_1 * 8 + 48 + TCG_STATIC_CALL_ARGS_SIZE) ) ); tcg_out32 (VAR_0, LD | RT (0) | RA (1) | (VAR_2 + 16)); tcg_out32 (VAR_0, MTSPR | RS (0) | LR); tcg_out32 (VAR_0, ADDI | RT (1) | RA (1) | VAR_2); tcg_out32 (VAR_0, BCLR | BO_ALWAYS); }
[ "static void FUNC_0 (TCGContext *VAR_0)\n{", "int VAR_1, VAR_2;", "#ifndef __APPLE__\nuint64_t addr;", "#endif\nVAR_2 = 0\n+ 8\n+ 8\n+ 8\n+ 8\n+ 8\n+ 8\n+ TCG_STATIC_CALL_ARGS_SIZE\n+ ARRAY_SIZE (tcg_target_callee_save_regs) * 8\n;", "VAR_2 = (VAR_2 + 15) & ~15;", "#ifndef __APPLE__\naddr = (uint64_t) VAR_0->code_ptr + 24;", "tcg_out32 (VAR_0, addr >> 32); tcg_out32 (VAR_0, addr);", "VAR_0->code_ptr += 16;", "#endif\ntcg_out32 (VAR_0, MFSPR | RT (0) | LR);", "tcg_out32 (VAR_0, STDU | RS (1) | RA (1) | (-VAR_2 & 0xffff));", "for (VAR_1 = 0; VAR_1 < ARRAY_SIZE (tcg_target_callee_save_regs); ++VAR_1)", "tcg_out32 (VAR_0, (STD\n| RS (tcg_target_callee_save_regs[VAR_1])\n| RA (1)\n| (VAR_1 * 8 + 48 + TCG_STATIC_CALL_ARGS_SIZE)\n)\n);", "tcg_out32 (VAR_0, STD | RS (0) | RA (1) | (VAR_2 + 16));", "#ifdef CONFIG_USE_GUEST_BASE\nif (GUEST_BASE) {", "tcg_out_movi (VAR_0, TCG_TYPE_I64, TCG_GUEST_BASE_REG, GUEST_BASE);", "tcg_regset_set_reg(VAR_0->reserved_regs, TCG_GUEST_BASE_REG);", "}", "#endif\ntcg_out32 (VAR_0, MTSPR | RS (3) | CTR);", "tcg_out32 (VAR_0, BCCTR | BO_ALWAYS);", "tb_ret_addr = VAR_0->code_ptr;", "for (VAR_1 = 0; VAR_1 < ARRAY_SIZE (tcg_target_callee_save_regs); ++VAR_1)", "tcg_out32 (VAR_0, (LD\n| RT (tcg_target_callee_save_regs[VAR_1])\n| RA (1)\n| (VAR_1 * 8 + 48 + TCG_STATIC_CALL_ARGS_SIZE)\n)\n);", "tcg_out32 (VAR_0, LD | RT (0) | RA (1) | (VAR_2 + 16));", "tcg_out32 (VAR_0, MTSPR | RS (0) | LR);", "tcg_out32 (VAR_0, ADDI | RT (1) | RA (1) | VAR_2);", "tcg_out32 (VAR_0, BCLR | BO_ALWAYS);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 11, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33 ], [ 35 ], [ 39, 43 ], [ 45 ], [ 47 ], [ 49, 55 ], [ 57 ], [ 59 ], [ 61, 63, 65, 67, 69, 71 ], [ 73 ], [ 77, 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87, 91 ], [ 93 ], [ 99 ], [ 103 ], [ 105, 107, 109, 111, 113, 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ] ]
18,863
int blk_co_discard(BlockBackend *blk, int64_t sector_num, int nb_sectors) { int ret = blk_check_request(blk, sector_num, nb_sectors); if (ret < 0) { return ret; } return bdrv_co_discard(blk_bs(blk), sector_num, nb_sectors); }
false
qemu
9f1963b3f72521f75a549f8afd61b19e7da63c6f
int blk_co_discard(BlockBackend *blk, int64_t sector_num, int nb_sectors) { int ret = blk_check_request(blk, sector_num, nb_sectors); if (ret < 0) { return ret; } return bdrv_co_discard(blk_bs(blk), sector_num, nb_sectors); }
{ "code": [], "line_no": [] }
int FUNC_0(BlockBackend *VAR_0, int64_t VAR_1, int VAR_2) { int VAR_3 = blk_check_request(VAR_0, VAR_1, VAR_2); if (VAR_3 < 0) { return VAR_3; } return bdrv_co_discard(blk_bs(VAR_0), VAR_1, VAR_2); }
[ "int FUNC_0(BlockBackend *VAR_0, int64_t VAR_1, int VAR_2)\n{", "int VAR_3 = blk_check_request(VAR_0, VAR_1, VAR_2);", "if (VAR_3 < 0) {", "return VAR_3;", "}", "return bdrv_co_discard(blk_bs(VAR_0), VAR_1, VAR_2);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ] ]
18,864
GList *range_list_insert(GList *list, Range *data) { GList *l; /* Range lists require no empty ranges */ assert(data->begin < data->end || (data->begin && !data->end)); /* Skip all list elements strictly less than data */ for (l = list; l && range_compare(l->data, data) < 0; l = l->next) { } if (!l || range_compare(l->data, data) > 0) { /* Rest of the list (if any) is strictly greater than @data */ return g_list_insert_before(list, l, data); } /* Current list element overlaps @data, merge the two */ range_extend(l->data, data); g_free(data); /* Merge any subsequent list elements that now also overlap */ while (l->next && range_compare(l->data, l->next->data) == 0) { GList *new_l; range_extend(l->data, l->next->data); g_free(l->next->data); new_l = g_list_delete_link(list, l->next); assert(new_l == list); } return list; }
false
qemu
a0efbf16604770b9d805bcf210ec29942321134f
GList *range_list_insert(GList *list, Range *data) { GList *l; assert(data->begin < data->end || (data->begin && !data->end)); for (l = list; l && range_compare(l->data, data) < 0; l = l->next) { } if (!l || range_compare(l->data, data) > 0) { return g_list_insert_before(list, l, data); } range_extend(l->data, data); g_free(data); while (l->next && range_compare(l->data, l->next->data) == 0) { GList *new_l; range_extend(l->data, l->next->data); g_free(l->next->data); new_l = g_list_delete_link(list, l->next); assert(new_l == list); } return list; }
{ "code": [], "line_no": [] }
GList *FUNC_0(GList *list, Range *data) { GList *l; assert(data->begin < data->end || (data->begin && !data->end)); for (l = list; l && range_compare(l->data, data) < 0; l = l->next) { } if (!l || range_compare(l->data, data) > 0) { return g_list_insert_before(list, l, data); } range_extend(l->data, data); g_free(data); while (l->next && range_compare(l->data, l->next->data) == 0) { GList *new_l; range_extend(l->data, l->next->data); g_free(l->next->data); new_l = g_list_delete_link(list, l->next); assert(new_l == list); } return list; }
[ "GList *FUNC_0(GList *list, Range *data)\n{", "GList *l;", "assert(data->begin < data->end || (data->begin && !data->end));", "for (l = list; l && range_compare(l->data, data) < 0; l = l->next) {", "}", "if (!l || range_compare(l->data, data) > 0) {", "return g_list_insert_before(list, l, data);", "}", "range_extend(l->data, data);", "g_free(data);", "while (l->next && range_compare(l->data, l->next->data) == 0) {", "GList *new_l;", "range_extend(l->data, l->next->data);", "g_free(l->next->data);", "new_l = g_list_delete_link(list, l->next);", "assert(new_l == list);", "}", "return list;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 11 ], [ 17 ], [ 19 ], [ 23 ], [ 27 ], [ 29 ], [ 35 ], [ 37 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ] ]
18,865
SCSIRequest *scsi_req_new(SCSIDevice *d, uint32_t tag, uint32_t lun, void *hba_private) { return d->info->alloc_req(d, tag, lun, hba_private); }
false
qemu
c39ce112b60ffafbaf700853e32bea74cbb2c148
SCSIRequest *scsi_req_new(SCSIDevice *d, uint32_t tag, uint32_t lun, void *hba_private) { return d->info->alloc_req(d, tag, lun, hba_private); }
{ "code": [], "line_no": [] }
SCSIRequest *FUNC_0(SCSIDevice *d, uint32_t tag, uint32_t lun, void *hba_private) { return d->info->alloc_req(d, tag, lun, hba_private); }
[ "SCSIRequest *FUNC_0(SCSIDevice *d, uint32_t tag, uint32_t lun,\nvoid *hba_private)\n{", "return d->info->alloc_req(d, tag, lun, hba_private);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ] ]
18,866
static int nbd_send_negotiate(int csock, off_t size, uint32_t flags) { char buf[8 + 8 + 8 + 128]; /* Negotiate [ 0 .. 7] passwd ("NBDMAGIC") [ 8 .. 15] magic (0x00420281861253) [16 .. 23] size [24 .. 27] flags [28 .. 151] reserved (0) */ TRACE("Beginning negotiation."); memcpy(buf, "NBDMAGIC", 8); cpu_to_be64w((uint64_t*)(buf + 8), 0x00420281861253LL); cpu_to_be64w((uint64_t*)(buf + 16), size); cpu_to_be32w((uint32_t*)(buf + 24), flags | NBD_FLAG_HAS_FLAGS | NBD_FLAG_SEND_TRIM | NBD_FLAG_SEND_FLUSH | NBD_FLAG_SEND_FUA); memset(buf + 28, 0, 124); if (write_sync(csock, buf, sizeof(buf)) != sizeof(buf)) { LOG("write failed"); errno = EINVAL; return -1; } TRACE("Negotiation succeeded."); return 0; }
false
qemu
185b43386ad999c80bdc58e41b87f05e5b3e8463
static int nbd_send_negotiate(int csock, off_t size, uint32_t flags) { char buf[8 + 8 + 8 + 128]; TRACE("Beginning negotiation."); memcpy(buf, "NBDMAGIC", 8); cpu_to_be64w((uint64_t*)(buf + 8), 0x00420281861253LL); cpu_to_be64w((uint64_t*)(buf + 16), size); cpu_to_be32w((uint32_t*)(buf + 24), flags | NBD_FLAG_HAS_FLAGS | NBD_FLAG_SEND_TRIM | NBD_FLAG_SEND_FLUSH | NBD_FLAG_SEND_FUA); memset(buf + 28, 0, 124); if (write_sync(csock, buf, sizeof(buf)) != sizeof(buf)) { LOG("write failed"); errno = EINVAL; return -1; } TRACE("Negotiation succeeded."); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(int VAR_0, off_t VAR_1, uint32_t VAR_2) { char VAR_3[8 + 8 + 8 + 128]; TRACE("Beginning negotiation."); memcpy(VAR_3, "NBDMAGIC", 8); cpu_to_be64w((uint64_t*)(VAR_3 + 8), 0x00420281861253LL); cpu_to_be64w((uint64_t*)(VAR_3 + 16), VAR_1); cpu_to_be32w((uint32_t*)(VAR_3 + 24), VAR_2 | NBD_FLAG_HAS_FLAGS | NBD_FLAG_SEND_TRIM | NBD_FLAG_SEND_FLUSH | NBD_FLAG_SEND_FUA); memset(VAR_3 + 28, 0, 124); if (write_sync(VAR_0, VAR_3, sizeof(VAR_3)) != sizeof(VAR_3)) { LOG("write failed"); errno = EINVAL; return -1; } TRACE("Negotiation succeeded."); return 0; }
[ "static int FUNC_0(int VAR_0, off_t VAR_1, uint32_t VAR_2)\n{", "char VAR_3[8 + 8 + 8 + 128];", "TRACE(\"Beginning negotiation.\");", "memcpy(VAR_3, \"NBDMAGIC\", 8);", "cpu_to_be64w((uint64_t*)(VAR_3 + 8), 0x00420281861253LL);", "cpu_to_be64w((uint64_t*)(VAR_3 + 16), VAR_1);", "cpu_to_be32w((uint32_t*)(VAR_3 + 24),\nVAR_2 | NBD_FLAG_HAS_FLAGS | NBD_FLAG_SEND_TRIM |\nNBD_FLAG_SEND_FLUSH | NBD_FLAG_SEND_FUA);", "memset(VAR_3 + 28, 0, 124);", "if (write_sync(VAR_0, VAR_3, sizeof(VAR_3)) != sizeof(VAR_3)) {", "LOG(\"write failed\");", "errno = EINVAL;", "return -1;", "}", "TRACE(\"Negotiation succeeded.\");", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33, 35, 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 59 ], [ 61 ] ]
18,867
static int find_pte32(CPUPPCState *env, struct mmu_ctx_hash32 *ctx, int h, int rw, int type, int target_page_bits) { hwaddr pteg_off; target_ulong pte0, pte1; int i, good = -1; int ret, r; ret = -1; /* No entry found */ pteg_off = get_pteg_offset32(env, ctx->hash[h]); for (i = 0; i < HPTES_PER_GROUP; i++) { pte0 = ppc_hash32_load_hpte0(env, pteg_off + i*HASH_PTE_SIZE_32); pte1 = ppc_hash32_load_hpte1(env, pteg_off + i*HASH_PTE_SIZE_32); r = pte_check_hash32(ctx, pte0, pte1, h, rw, type); LOG_MMU("Load pte from %08" HWADDR_PRIx " => " TARGET_FMT_lx " " TARGET_FMT_lx " %d %d %d " TARGET_FMT_lx "\n", pteg_off + (i * 8), pte0, pte1, (int)(pte0 >> 31), h, (int)((pte0 >> 6) & 1), ctx->ptem); switch (r) { case -3: /* PTE inconsistency */ return -1; case -2: /* Access violation */ ret = -2; good = i; break; case -1: default: /* No PTE match */ break; case 0: /* access granted */ /* XXX: we should go on looping to check all PTEs consistency * but if we can speed-up the whole thing as the * result would be undefined if PTEs are not consistent. */ ret = 0; good = i; goto done; } } if (good != -1) { done: LOG_MMU("found PTE at addr %08" HWADDR_PRIx " prot=%01x ret=%d\n", ctx->raddr, ctx->prot, ret); /* Update page flags */ pte1 = ctx->raddr; if (ppc_hash32_pte_update_flags(ctx, &pte1, ret, rw) == 1) { ppc_hash32_store_hpte1(env, pteg_off + good * HASH_PTE_SIZE_32, pte1); } } /* We have a TLB that saves 4K pages, so let's * split a huge page to 4k chunks */ if (target_page_bits != TARGET_PAGE_BITS) { ctx->raddr |= (ctx->eaddr & ((1 << target_page_bits) - 1)) & TARGET_PAGE_MASK; } return ret; }
false
qemu
91cda45b69e45a089f9989979a65db3f710c9925
static int find_pte32(CPUPPCState *env, struct mmu_ctx_hash32 *ctx, int h, int rw, int type, int target_page_bits) { hwaddr pteg_off; target_ulong pte0, pte1; int i, good = -1; int ret, r; ret = -1; pteg_off = get_pteg_offset32(env, ctx->hash[h]); for (i = 0; i < HPTES_PER_GROUP; i++) { pte0 = ppc_hash32_load_hpte0(env, pteg_off + i*HASH_PTE_SIZE_32); pte1 = ppc_hash32_load_hpte1(env, pteg_off + i*HASH_PTE_SIZE_32); r = pte_check_hash32(ctx, pte0, pte1, h, rw, type); LOG_MMU("Load pte from %08" HWADDR_PRIx " => " TARGET_FMT_lx " " TARGET_FMT_lx " %d %d %d " TARGET_FMT_lx "\n", pteg_off + (i * 8), pte0, pte1, (int)(pte0 >> 31), h, (int)((pte0 >> 6) & 1), ctx->ptem); switch (r) { case -3: return -1; case -2: ret = -2; good = i; break; case -1: default: break; case 0: ret = 0; good = i; goto done; } } if (good != -1) { done: LOG_MMU("found PTE at addr %08" HWADDR_PRIx " prot=%01x ret=%d\n", ctx->raddr, ctx->prot, ret); pte1 = ctx->raddr; if (ppc_hash32_pte_update_flags(ctx, &pte1, ret, rw) == 1) { ppc_hash32_store_hpte1(env, pteg_off + good * HASH_PTE_SIZE_32, pte1); } } if (target_page_bits != TARGET_PAGE_BITS) { ctx->raddr |= (ctx->eaddr & ((1 << target_page_bits) - 1)) & TARGET_PAGE_MASK; } return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(CPUPPCState *VAR_0, struct mmu_ctx_hash32 *VAR_1, int VAR_2, int VAR_3, int VAR_4, int VAR_5) { hwaddr pteg_off; target_ulong pte0, pte1; int VAR_6, VAR_7 = -1; int VAR_8, VAR_9; VAR_8 = -1; pteg_off = get_pteg_offset32(VAR_0, VAR_1->hash[VAR_2]); for (VAR_6 = 0; VAR_6 < HPTES_PER_GROUP; VAR_6++) { pte0 = ppc_hash32_load_hpte0(VAR_0, pteg_off + VAR_6*HASH_PTE_SIZE_32); pte1 = ppc_hash32_load_hpte1(VAR_0, pteg_off + VAR_6*HASH_PTE_SIZE_32); VAR_9 = pte_check_hash32(VAR_1, pte0, pte1, VAR_2, VAR_3, VAR_4); LOG_MMU("Load pte from %08" HWADDR_PRIx " => " TARGET_FMT_lx " " TARGET_FMT_lx " %d %d %d " TARGET_FMT_lx "\n", pteg_off + (VAR_6 * 8), pte0, pte1, (int)(pte0 >> 31), VAR_2, (int)((pte0 >> 6) & 1), VAR_1->ptem); switch (VAR_9) { case -3: return -1; case -2: VAR_8 = -2; VAR_7 = VAR_6; break; case -1: default: break; case 0: VAR_8 = 0; VAR_7 = VAR_6; goto done; } } if (VAR_7 != -1) { done: LOG_MMU("found PTE at addr %08" HWADDR_PRIx " prot=%01x VAR_8=%d\n", VAR_1->raddr, VAR_1->prot, VAR_8); pte1 = VAR_1->raddr; if (ppc_hash32_pte_update_flags(VAR_1, &pte1, VAR_8, VAR_3) == 1) { ppc_hash32_store_hpte1(VAR_0, pteg_off + VAR_7 * HASH_PTE_SIZE_32, pte1); } } if (VAR_5 != TARGET_PAGE_BITS) { VAR_1->raddr |= (VAR_1->eaddr & ((1 << VAR_5) - 1)) & TARGET_PAGE_MASK; } return VAR_8; }
[ "static int FUNC_0(CPUPPCState *VAR_0, struct mmu_ctx_hash32 *VAR_1, int VAR_2,\nint VAR_3, int VAR_4, int VAR_5)\n{", "hwaddr pteg_off;", "target_ulong pte0, pte1;", "int VAR_6, VAR_7 = -1;", "int VAR_8, VAR_9;", "VAR_8 = -1;", "pteg_off = get_pteg_offset32(VAR_0, VAR_1->hash[VAR_2]);", "for (VAR_6 = 0; VAR_6 < HPTES_PER_GROUP; VAR_6++) {", "pte0 = ppc_hash32_load_hpte0(VAR_0, pteg_off + VAR_6*HASH_PTE_SIZE_32);", "pte1 = ppc_hash32_load_hpte1(VAR_0, pteg_off + VAR_6*HASH_PTE_SIZE_32);", "VAR_9 = pte_check_hash32(VAR_1, pte0, pte1, VAR_2, VAR_3, VAR_4);", "LOG_MMU(\"Load pte from %08\" HWADDR_PRIx \" => \" TARGET_FMT_lx \" \"\nTARGET_FMT_lx \" %d %d %d \" TARGET_FMT_lx \"\\n\",\npteg_off + (VAR_6 * 8), pte0, pte1, (int)(pte0 >> 31), VAR_2,\n(int)((pte0 >> 6) & 1), VAR_1->ptem);", "switch (VAR_9) {", "case -3:\nreturn -1;", "case -2:\nVAR_8 = -2;", "VAR_7 = VAR_6;", "break;", "case -1:\ndefault:\nbreak;", "case 0:\nVAR_8 = 0;", "VAR_7 = VAR_6;", "goto done;", "}", "}", "if (VAR_7 != -1) {", "done:\nLOG_MMU(\"found PTE at addr %08\" HWADDR_PRIx \" prot=%01x VAR_8=%d\\n\",\nVAR_1->raddr, VAR_1->prot, VAR_8);", "pte1 = VAR_1->raddr;", "if (ppc_hash32_pte_update_flags(VAR_1, &pte1, VAR_8, VAR_3) == 1) {", "ppc_hash32_store_hpte1(VAR_0, pteg_off + VAR_7 * HASH_PTE_SIZE_32,\npte1);", "}", "}", "if (VAR_5 != TARGET_PAGE_BITS) {", "VAR_1->raddr |= (VAR_1->eaddr & ((1 << VAR_5) - 1))\n& TARGET_PAGE_MASK;", "}", "return VAR_8;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29, 31, 33, 35 ], [ 37 ], [ 39, 43 ], [ 45, 49 ], [ 51 ], [ 53 ], [ 55, 57, 61 ], [ 63, 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87, 89, 91 ], [ 95 ], [ 97 ], [ 99, 101 ], [ 103 ], [ 105 ], [ 113 ], [ 115, 117 ], [ 119 ], [ 121 ], [ 123 ] ]
18,868
static void __attribute__((constructor)) coroutine_pool_init(void) { qemu_mutex_init(&pool_lock); }
false
qemu
4d68e86bb10159099da0798f74e7512955f15eec
static void __attribute__((constructor)) coroutine_pool_init(void) { qemu_mutex_init(&pool_lock); }
{ "code": [], "line_no": [] }
static void __attribute__((constructor)) FUNC_0(void) { qemu_mutex_init(&pool_lock); }
[ "static void __attribute__((constructor)) FUNC_0(void)\n{", "qemu_mutex_init(&pool_lock);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
18,869
static void nvdimm_dsm_root(NvdimmDsmIn *in, hwaddr dsm_mem_addr) { /* * function 0 is called to inquire which functions are supported by * OSPM */ if (!in->function) { nvdimm_dsm_function0(0 /* No function supported other than function 0 */, dsm_mem_addr); return; } /* No function except function 0 is supported yet. */ nvdimm_dsm_no_payload(1 /* Not Supported */, dsm_mem_addr); }
false
qemu
c2fa30757a2ba1bb5b053883773a9a61fbdd7082
static void nvdimm_dsm_root(NvdimmDsmIn *in, hwaddr dsm_mem_addr) { if (!in->function) { nvdimm_dsm_function0(0 , dsm_mem_addr); return; } nvdimm_dsm_no_payload(1 , dsm_mem_addr); }
{ "code": [], "line_no": [] }
static void FUNC_0(NvdimmDsmIn *VAR_0, hwaddr VAR_1) { if (!VAR_0->function) { nvdimm_dsm_function0(0 , VAR_1); return; } nvdimm_dsm_no_payload(1 , VAR_1); }
[ "static void FUNC_0(NvdimmDsmIn *VAR_0, hwaddr VAR_1)\n{", "if (!VAR_0->function) {", "nvdimm_dsm_function0(0\n, VAR_1);", "return;", "}", "nvdimm_dsm_no_payload(1 , VAR_1);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 13 ], [ 15, 17 ], [ 19 ], [ 21 ], [ 27 ], [ 29 ] ]
18,870
static int spapr_phb_vfio_eeh_set_option(sPAPRPHBState *sphb, unsigned int addr, int option) { sPAPRPHBVFIOState *svphb = SPAPR_PCI_VFIO_HOST_BRIDGE(sphb); struct vfio_eeh_pe_op op = { .argsz = sizeof(op) }; int ret; switch (option) { case RTAS_EEH_DISABLE: op.op = VFIO_EEH_PE_DISABLE; break; case RTAS_EEH_ENABLE: { PCIHostState *phb; PCIDevice *pdev; /* * The EEH functionality is enabled on basis of PCI device, * instead of PE. We need check the validity of the PCI * device address. */ phb = PCI_HOST_BRIDGE(sphb); pdev = pci_find_device(phb->bus, (addr >> 16) & 0xFF, (addr >> 8) & 0xFF); if (!pdev) { return RTAS_OUT_PARAM_ERROR; } op.op = VFIO_EEH_PE_ENABLE; break; } case RTAS_EEH_THAW_IO: op.op = VFIO_EEH_PE_UNFREEZE_IO; break; case RTAS_EEH_THAW_DMA: op.op = VFIO_EEH_PE_UNFREEZE_DMA; break; default: return RTAS_OUT_PARAM_ERROR; } ret = vfio_container_ioctl(&svphb->phb.iommu_as, svphb->iommugroupid, VFIO_EEH_PE_OP, &op); if (ret < 0) { return RTAS_OUT_HW_ERROR; } return RTAS_OUT_SUCCESS; }
false
qemu
d76548a98f4e18d3c65a3d921bbb70caf9be6138
static int spapr_phb_vfio_eeh_set_option(sPAPRPHBState *sphb, unsigned int addr, int option) { sPAPRPHBVFIOState *svphb = SPAPR_PCI_VFIO_HOST_BRIDGE(sphb); struct vfio_eeh_pe_op op = { .argsz = sizeof(op) }; int ret; switch (option) { case RTAS_EEH_DISABLE: op.op = VFIO_EEH_PE_DISABLE; break; case RTAS_EEH_ENABLE: { PCIHostState *phb; PCIDevice *pdev; phb = PCI_HOST_BRIDGE(sphb); pdev = pci_find_device(phb->bus, (addr >> 16) & 0xFF, (addr >> 8) & 0xFF); if (!pdev) { return RTAS_OUT_PARAM_ERROR; } op.op = VFIO_EEH_PE_ENABLE; break; } case RTAS_EEH_THAW_IO: op.op = VFIO_EEH_PE_UNFREEZE_IO; break; case RTAS_EEH_THAW_DMA: op.op = VFIO_EEH_PE_UNFREEZE_DMA; break; default: return RTAS_OUT_PARAM_ERROR; } ret = vfio_container_ioctl(&svphb->phb.iommu_as, svphb->iommugroupid, VFIO_EEH_PE_OP, &op); if (ret < 0) { return RTAS_OUT_HW_ERROR; } return RTAS_OUT_SUCCESS; }
{ "code": [], "line_no": [] }
static int FUNC_0(sPAPRPHBState *VAR_0, unsigned int VAR_1, int VAR_2) { sPAPRPHBVFIOState *svphb = SPAPR_PCI_VFIO_HOST_BRIDGE(VAR_0); struct vfio_eeh_pe_op VAR_3 = { .argsz = sizeof(VAR_3) }; int VAR_4; switch (VAR_2) { case RTAS_EEH_DISABLE: VAR_3.VAR_3 = VFIO_EEH_PE_DISABLE; break; case RTAS_EEH_ENABLE: { PCIHostState *phb; PCIDevice *pdev; phb = PCI_HOST_BRIDGE(VAR_0); pdev = pci_find_device(phb->bus, (VAR_1 >> 16) & 0xFF, (VAR_1 >> 8) & 0xFF); if (!pdev) { return RTAS_OUT_PARAM_ERROR; } VAR_3.VAR_3 = VFIO_EEH_PE_ENABLE; break; } case RTAS_EEH_THAW_IO: VAR_3.VAR_3 = VFIO_EEH_PE_UNFREEZE_IO; break; case RTAS_EEH_THAW_DMA: VAR_3.VAR_3 = VFIO_EEH_PE_UNFREEZE_DMA; break; default: return RTAS_OUT_PARAM_ERROR; } VAR_4 = vfio_container_ioctl(&svphb->phb.iommu_as, svphb->iommugroupid, VFIO_EEH_PE_OP, &VAR_3); if (VAR_4 < 0) { return RTAS_OUT_HW_ERROR; } return RTAS_OUT_SUCCESS; }
[ "static int FUNC_0(sPAPRPHBState *VAR_0,\nunsigned int VAR_1, int VAR_2)\n{", "sPAPRPHBVFIOState *svphb = SPAPR_PCI_VFIO_HOST_BRIDGE(VAR_0);", "struct vfio_eeh_pe_op VAR_3 = { .argsz = sizeof(VAR_3) };", "int VAR_4;", "switch (VAR_2) {", "case RTAS_EEH_DISABLE:\nVAR_3.VAR_3 = VFIO_EEH_PE_DISABLE;", "break;", "case RTAS_EEH_ENABLE: {", "PCIHostState *phb;", "PCIDevice *pdev;", "phb = PCI_HOST_BRIDGE(VAR_0);", "pdev = pci_find_device(phb->bus,\n(VAR_1 >> 16) & 0xFF, (VAR_1 >> 8) & 0xFF);", "if (!pdev) {", "return RTAS_OUT_PARAM_ERROR;", "}", "VAR_3.VAR_3 = VFIO_EEH_PE_ENABLE;", "break;", "}", "case RTAS_EEH_THAW_IO:\nVAR_3.VAR_3 = VFIO_EEH_PE_UNFREEZE_IO;", "break;", "case RTAS_EEH_THAW_DMA:\nVAR_3.VAR_3 = VFIO_EEH_PE_UNFREEZE_DMA;", "break;", "default:\nreturn RTAS_OUT_PARAM_ERROR;", "}", "VAR_4 = vfio_container_ioctl(&svphb->phb.iommu_as, svphb->iommugroupid,\nVFIO_EEH_PE_OP, &VAR_3);", "if (VAR_4 < 0) {", "return RTAS_OUT_HW_ERROR;", "}", "return RTAS_OUT_SUCCESS;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17, 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61, 63 ], [ 65 ], [ 67, 69 ], [ 71 ], [ 73, 75 ], [ 77 ], [ 81, 83 ], [ 85 ], [ 87 ], [ 89 ], [ 93 ], [ 95 ] ]
18,871
static int vaapi_h264_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size) { H264Context * const h = avctx->priv_data; struct vaapi_context * const vactx = avctx->hwaccel_context; VAPictureParameterBufferH264 *pic_param; VAIQMatrixBufferH264 *iq_matrix; ff_dlog(avctx, "vaapi_h264_start_frame()\n"); vactx->slice_param_size = sizeof(VASliceParameterBufferH264); /* Fill in VAPictureParameterBufferH264. */ pic_param = ff_vaapi_alloc_pic_param(vactx, sizeof(VAPictureParameterBufferH264)); if (!pic_param) return -1; fill_vaapi_pic(&pic_param->CurrPic, h->cur_pic_ptr, h->picture_structure); if (fill_vaapi_ReferenceFrames(pic_param, h) < 0) return -1; pic_param->picture_width_in_mbs_minus1 = h->mb_width - 1; pic_param->picture_height_in_mbs_minus1 = h->mb_height - 1; pic_param->bit_depth_luma_minus8 = h->sps.bit_depth_luma - 8; pic_param->bit_depth_chroma_minus8 = h->sps.bit_depth_chroma - 8; pic_param->num_ref_frames = h->sps.ref_frame_count; pic_param->seq_fields.value = 0; /* reset all bits */ pic_param->seq_fields.bits.chroma_format_idc = h->sps.chroma_format_idc; pic_param->seq_fields.bits.residual_colour_transform_flag = h->sps.residual_color_transform_flag; /* XXX: only for 4:4:4 high profile? */ pic_param->seq_fields.bits.gaps_in_frame_num_value_allowed_flag = h->sps.gaps_in_frame_num_allowed_flag; pic_param->seq_fields.bits.frame_mbs_only_flag = h->sps.frame_mbs_only_flag; pic_param->seq_fields.bits.mb_adaptive_frame_field_flag = h->sps.mb_aff; pic_param->seq_fields.bits.direct_8x8_inference_flag = h->sps.direct_8x8_inference_flag; pic_param->seq_fields.bits.MinLumaBiPredSize8x8 = h->sps.level_idc >= 31; /* A.3.3.2 */ pic_param->seq_fields.bits.log2_max_frame_num_minus4 = h->sps.log2_max_frame_num - 4; pic_param->seq_fields.bits.pic_order_cnt_type = h->sps.poc_type; pic_param->seq_fields.bits.log2_max_pic_order_cnt_lsb_minus4 = h->sps.log2_max_poc_lsb - 4; pic_param->seq_fields.bits.delta_pic_order_always_zero_flag = h->sps.delta_pic_order_always_zero_flag; pic_param->num_slice_groups_minus1 = h->pps.slice_group_count - 1; pic_param->slice_group_map_type = h->pps.mb_slice_group_map_type; pic_param->slice_group_change_rate_minus1 = 0; /* XXX: unimplemented in Libav */ pic_param->pic_init_qp_minus26 = h->pps.init_qp - 26; pic_param->pic_init_qs_minus26 = h->pps.init_qs - 26; pic_param->chroma_qp_index_offset = h->pps.chroma_qp_index_offset[0]; pic_param->second_chroma_qp_index_offset = h->pps.chroma_qp_index_offset[1]; pic_param->pic_fields.value = 0; /* reset all bits */ pic_param->pic_fields.bits.entropy_coding_mode_flag = h->pps.cabac; pic_param->pic_fields.bits.weighted_pred_flag = h->pps.weighted_pred; pic_param->pic_fields.bits.weighted_bipred_idc = h->pps.weighted_bipred_idc; pic_param->pic_fields.bits.transform_8x8_mode_flag = h->pps.transform_8x8_mode; pic_param->pic_fields.bits.field_pic_flag = h->picture_structure != PICT_FRAME; pic_param->pic_fields.bits.constrained_intra_pred_flag = h->pps.constrained_intra_pred; pic_param->pic_fields.bits.pic_order_present_flag = h->pps.pic_order_present; pic_param->pic_fields.bits.deblocking_filter_control_present_flag = h->pps.deblocking_filter_parameters_present; pic_param->pic_fields.bits.redundant_pic_cnt_present_flag = h->pps.redundant_pic_cnt_present; pic_param->pic_fields.bits.reference_pic_flag = h->nal_ref_idc != 0; pic_param->frame_num = h->frame_num; /* Fill in VAIQMatrixBufferH264. */ iq_matrix = ff_vaapi_alloc_iq_matrix(vactx, sizeof(VAIQMatrixBufferH264)); if (!iq_matrix) return -1; memcpy(iq_matrix->ScalingList4x4, h->pps.scaling_matrix4, sizeof(iq_matrix->ScalingList4x4)); memcpy(iq_matrix->ScalingList8x8[0], h->pps.scaling_matrix8[0], sizeof(iq_matrix->ScalingList8x8[0])); memcpy(iq_matrix->ScalingList8x8[1], h->pps.scaling_matrix8[3], sizeof(iq_matrix->ScalingList8x8[0])); return 0; }
false
FFmpeg
3176217c60ca7828712985092d9102d331ea4f3d
static int vaapi_h264_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size) { H264Context * const h = avctx->priv_data; struct vaapi_context * const vactx = avctx->hwaccel_context; VAPictureParameterBufferH264 *pic_param; VAIQMatrixBufferH264 *iq_matrix; ff_dlog(avctx, "vaapi_h264_start_frame()\n"); vactx->slice_param_size = sizeof(VASliceParameterBufferH264); pic_param = ff_vaapi_alloc_pic_param(vactx, sizeof(VAPictureParameterBufferH264)); if (!pic_param) return -1; fill_vaapi_pic(&pic_param->CurrPic, h->cur_pic_ptr, h->picture_structure); if (fill_vaapi_ReferenceFrames(pic_param, h) < 0) return -1; pic_param->picture_width_in_mbs_minus1 = h->mb_width - 1; pic_param->picture_height_in_mbs_minus1 = h->mb_height - 1; pic_param->bit_depth_luma_minus8 = h->sps.bit_depth_luma - 8; pic_param->bit_depth_chroma_minus8 = h->sps.bit_depth_chroma - 8; pic_param->num_ref_frames = h->sps.ref_frame_count; pic_param->seq_fields.value = 0; pic_param->seq_fields.bits.chroma_format_idc = h->sps.chroma_format_idc; pic_param->seq_fields.bits.residual_colour_transform_flag = h->sps.residual_color_transform_flag; pic_param->seq_fields.bits.gaps_in_frame_num_value_allowed_flag = h->sps.gaps_in_frame_num_allowed_flag; pic_param->seq_fields.bits.frame_mbs_only_flag = h->sps.frame_mbs_only_flag; pic_param->seq_fields.bits.mb_adaptive_frame_field_flag = h->sps.mb_aff; pic_param->seq_fields.bits.direct_8x8_inference_flag = h->sps.direct_8x8_inference_flag; pic_param->seq_fields.bits.MinLumaBiPredSize8x8 = h->sps.level_idc >= 31; pic_param->seq_fields.bits.log2_max_frame_num_minus4 = h->sps.log2_max_frame_num - 4; pic_param->seq_fields.bits.pic_order_cnt_type = h->sps.poc_type; pic_param->seq_fields.bits.log2_max_pic_order_cnt_lsb_minus4 = h->sps.log2_max_poc_lsb - 4; pic_param->seq_fields.bits.delta_pic_order_always_zero_flag = h->sps.delta_pic_order_always_zero_flag; pic_param->num_slice_groups_minus1 = h->pps.slice_group_count - 1; pic_param->slice_group_map_type = h->pps.mb_slice_group_map_type; pic_param->slice_group_change_rate_minus1 = 0; pic_param->pic_init_qp_minus26 = h->pps.init_qp - 26; pic_param->pic_init_qs_minus26 = h->pps.init_qs - 26; pic_param->chroma_qp_index_offset = h->pps.chroma_qp_index_offset[0]; pic_param->second_chroma_qp_index_offset = h->pps.chroma_qp_index_offset[1]; pic_param->pic_fields.value = 0; pic_param->pic_fields.bits.entropy_coding_mode_flag = h->pps.cabac; pic_param->pic_fields.bits.weighted_pred_flag = h->pps.weighted_pred; pic_param->pic_fields.bits.weighted_bipred_idc = h->pps.weighted_bipred_idc; pic_param->pic_fields.bits.transform_8x8_mode_flag = h->pps.transform_8x8_mode; pic_param->pic_fields.bits.field_pic_flag = h->picture_structure != PICT_FRAME; pic_param->pic_fields.bits.constrained_intra_pred_flag = h->pps.constrained_intra_pred; pic_param->pic_fields.bits.pic_order_present_flag = h->pps.pic_order_present; pic_param->pic_fields.bits.deblocking_filter_control_present_flag = h->pps.deblocking_filter_parameters_present; pic_param->pic_fields.bits.redundant_pic_cnt_present_flag = h->pps.redundant_pic_cnt_present; pic_param->pic_fields.bits.reference_pic_flag = h->nal_ref_idc != 0; pic_param->frame_num = h->frame_num; iq_matrix = ff_vaapi_alloc_iq_matrix(vactx, sizeof(VAIQMatrixBufferH264)); if (!iq_matrix) return -1; memcpy(iq_matrix->ScalingList4x4, h->pps.scaling_matrix4, sizeof(iq_matrix->ScalingList4x4)); memcpy(iq_matrix->ScalingList8x8[0], h->pps.scaling_matrix8[0], sizeof(iq_matrix->ScalingList8x8[0])); memcpy(iq_matrix->ScalingList8x8[1], h->pps.scaling_matrix8[3], sizeof(iq_matrix->ScalingList8x8[0])); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, av_unused const VAR_1 *buffer, av_unused uint32_t size) { H264Context * const h = VAR_0->priv_data; struct vaapi_context * const VAR_2 = VAR_0->hwaccel_context; VAPictureParameterBufferH264 *pic_param; VAIQMatrixBufferH264 *iq_matrix; ff_dlog(VAR_0, "FUNC_0()\n"); VAR_2->slice_param_size = sizeof(VASliceParameterBufferH264); pic_param = ff_vaapi_alloc_pic_param(VAR_2, sizeof(VAPictureParameterBufferH264)); if (!pic_param) return -1; fill_vaapi_pic(&pic_param->CurrPic, h->cur_pic_ptr, h->picture_structure); if (fill_vaapi_ReferenceFrames(pic_param, h) < 0) return -1; pic_param->picture_width_in_mbs_minus1 = h->mb_width - 1; pic_param->picture_height_in_mbs_minus1 = h->mb_height - 1; pic_param->bit_depth_luma_minus8 = h->sps.bit_depth_luma - 8; pic_param->bit_depth_chroma_minus8 = h->sps.bit_depth_chroma - 8; pic_param->num_ref_frames = h->sps.ref_frame_count; pic_param->seq_fields.value = 0; pic_param->seq_fields.bits.chroma_format_idc = h->sps.chroma_format_idc; pic_param->seq_fields.bits.residual_colour_transform_flag = h->sps.residual_color_transform_flag; pic_param->seq_fields.bits.gaps_in_frame_num_value_allowed_flag = h->sps.gaps_in_frame_num_allowed_flag; pic_param->seq_fields.bits.frame_mbs_only_flag = h->sps.frame_mbs_only_flag; pic_param->seq_fields.bits.mb_adaptive_frame_field_flag = h->sps.mb_aff; pic_param->seq_fields.bits.direct_8x8_inference_flag = h->sps.direct_8x8_inference_flag; pic_param->seq_fields.bits.MinLumaBiPredSize8x8 = h->sps.level_idc >= 31; pic_param->seq_fields.bits.log2_max_frame_num_minus4 = h->sps.log2_max_frame_num - 4; pic_param->seq_fields.bits.pic_order_cnt_type = h->sps.poc_type; pic_param->seq_fields.bits.log2_max_pic_order_cnt_lsb_minus4 = h->sps.log2_max_poc_lsb - 4; pic_param->seq_fields.bits.delta_pic_order_always_zero_flag = h->sps.delta_pic_order_always_zero_flag; pic_param->num_slice_groups_minus1 = h->pps.slice_group_count - 1; pic_param->slice_group_map_type = h->pps.mb_slice_group_map_type; pic_param->slice_group_change_rate_minus1 = 0; pic_param->pic_init_qp_minus26 = h->pps.init_qp - 26; pic_param->pic_init_qs_minus26 = h->pps.init_qs - 26; pic_param->chroma_qp_index_offset = h->pps.chroma_qp_index_offset[0]; pic_param->second_chroma_qp_index_offset = h->pps.chroma_qp_index_offset[1]; pic_param->pic_fields.value = 0; pic_param->pic_fields.bits.entropy_coding_mode_flag = h->pps.cabac; pic_param->pic_fields.bits.weighted_pred_flag = h->pps.weighted_pred; pic_param->pic_fields.bits.weighted_bipred_idc = h->pps.weighted_bipred_idc; pic_param->pic_fields.bits.transform_8x8_mode_flag = h->pps.transform_8x8_mode; pic_param->pic_fields.bits.field_pic_flag = h->picture_structure != PICT_FRAME; pic_param->pic_fields.bits.constrained_intra_pred_flag = h->pps.constrained_intra_pred; pic_param->pic_fields.bits.pic_order_present_flag = h->pps.pic_order_present; pic_param->pic_fields.bits.deblocking_filter_control_present_flag = h->pps.deblocking_filter_parameters_present; pic_param->pic_fields.bits.redundant_pic_cnt_present_flag = h->pps.redundant_pic_cnt_present; pic_param->pic_fields.bits.reference_pic_flag = h->nal_ref_idc != 0; pic_param->frame_num = h->frame_num; iq_matrix = ff_vaapi_alloc_iq_matrix(VAR_2, sizeof(VAIQMatrixBufferH264)); if (!iq_matrix) return -1; memcpy(iq_matrix->ScalingList4x4, h->pps.scaling_matrix4, sizeof(iq_matrix->ScalingList4x4)); memcpy(iq_matrix->ScalingList8x8[0], h->pps.scaling_matrix8[0], sizeof(iq_matrix->ScalingList8x8[0])); memcpy(iq_matrix->ScalingList8x8[1], h->pps.scaling_matrix8[3], sizeof(iq_matrix->ScalingList8x8[0])); return 0; }
[ "static int FUNC_0(AVCodecContext *VAR_0,\nav_unused const VAR_1 *buffer,\nav_unused uint32_t size)\n{", "H264Context * const h = VAR_0->priv_data;", "struct vaapi_context * const VAR_2 = VAR_0->hwaccel_context;", "VAPictureParameterBufferH264 *pic_param;", "VAIQMatrixBufferH264 *iq_matrix;", "ff_dlog(VAR_0, \"FUNC_0()\\n\");", "VAR_2->slice_param_size = sizeof(VASliceParameterBufferH264);", "pic_param = ff_vaapi_alloc_pic_param(VAR_2, sizeof(VAPictureParameterBufferH264));", "if (!pic_param)\nreturn -1;", "fill_vaapi_pic(&pic_param->CurrPic, h->cur_pic_ptr, h->picture_structure);", "if (fill_vaapi_ReferenceFrames(pic_param, h) < 0)\nreturn -1;", "pic_param->picture_width_in_mbs_minus1 = h->mb_width - 1;", "pic_param->picture_height_in_mbs_minus1 = h->mb_height - 1;", "pic_param->bit_depth_luma_minus8 = h->sps.bit_depth_luma - 8;", "pic_param->bit_depth_chroma_minus8 = h->sps.bit_depth_chroma - 8;", "pic_param->num_ref_frames = h->sps.ref_frame_count;", "pic_param->seq_fields.value = 0;", "pic_param->seq_fields.bits.chroma_format_idc = h->sps.chroma_format_idc;", "pic_param->seq_fields.bits.residual_colour_transform_flag = h->sps.residual_color_transform_flag;", "pic_param->seq_fields.bits.gaps_in_frame_num_value_allowed_flag = h->sps.gaps_in_frame_num_allowed_flag;", "pic_param->seq_fields.bits.frame_mbs_only_flag = h->sps.frame_mbs_only_flag;", "pic_param->seq_fields.bits.mb_adaptive_frame_field_flag = h->sps.mb_aff;", "pic_param->seq_fields.bits.direct_8x8_inference_flag = h->sps.direct_8x8_inference_flag;", "pic_param->seq_fields.bits.MinLumaBiPredSize8x8 = h->sps.level_idc >= 31;", "pic_param->seq_fields.bits.log2_max_frame_num_minus4 = h->sps.log2_max_frame_num - 4;", "pic_param->seq_fields.bits.pic_order_cnt_type = h->sps.poc_type;", "pic_param->seq_fields.bits.log2_max_pic_order_cnt_lsb_minus4 = h->sps.log2_max_poc_lsb - 4;", "pic_param->seq_fields.bits.delta_pic_order_always_zero_flag = h->sps.delta_pic_order_always_zero_flag;", "pic_param->num_slice_groups_minus1 = h->pps.slice_group_count - 1;", "pic_param->slice_group_map_type = h->pps.mb_slice_group_map_type;", "pic_param->slice_group_change_rate_minus1 = 0;", "pic_param->pic_init_qp_minus26 = h->pps.init_qp - 26;", "pic_param->pic_init_qs_minus26 = h->pps.init_qs - 26;", "pic_param->chroma_qp_index_offset = h->pps.chroma_qp_index_offset[0];", "pic_param->second_chroma_qp_index_offset = h->pps.chroma_qp_index_offset[1];", "pic_param->pic_fields.value = 0;", "pic_param->pic_fields.bits.entropy_coding_mode_flag = h->pps.cabac;", "pic_param->pic_fields.bits.weighted_pred_flag = h->pps.weighted_pred;", "pic_param->pic_fields.bits.weighted_bipred_idc = h->pps.weighted_bipred_idc;", "pic_param->pic_fields.bits.transform_8x8_mode_flag = h->pps.transform_8x8_mode;", "pic_param->pic_fields.bits.field_pic_flag = h->picture_structure != PICT_FRAME;", "pic_param->pic_fields.bits.constrained_intra_pred_flag = h->pps.constrained_intra_pred;", "pic_param->pic_fields.bits.pic_order_present_flag = h->pps.pic_order_present;", "pic_param->pic_fields.bits.deblocking_filter_control_present_flag = h->pps.deblocking_filter_parameters_present;", "pic_param->pic_fields.bits.redundant_pic_cnt_present_flag = h->pps.redundant_pic_cnt_present;", "pic_param->pic_fields.bits.reference_pic_flag = h->nal_ref_idc != 0;", "pic_param->frame_num = h->frame_num;", "iq_matrix = ff_vaapi_alloc_iq_matrix(VAR_2, sizeof(VAIQMatrixBufferH264));", "if (!iq_matrix)\nreturn -1;", "memcpy(iq_matrix->ScalingList4x4, h->pps.scaling_matrix4, sizeof(iq_matrix->ScalingList4x4));", "memcpy(iq_matrix->ScalingList8x8[0], h->pps.scaling_matrix8[0], sizeof(iq_matrix->ScalingList8x8[0]));", "memcpy(iq_matrix->ScalingList8x8[1], h->pps.scaling_matrix8[3], sizeof(iq_matrix->ScalingList8x8[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, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 23 ], [ 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 ], [ 117 ], [ 119, 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ] ]
18,873
void cpu_outb(pio_addr_t addr, uint8_t val) { LOG_IOPORT("outb: %04"FMT_pioaddr" %02"PRIx8"\n", addr, val); trace_cpu_out(addr, val); ioport_write(0, addr, val); }
false
qemu
b40acf99bef69fa8ab0f9092ff162fde945eec12
void cpu_outb(pio_addr_t addr, uint8_t val) { LOG_IOPORT("outb: %04"FMT_pioaddr" %02"PRIx8"\n", addr, val); trace_cpu_out(addr, val); ioport_write(0, addr, val); }
{ "code": [], "line_no": [] }
void FUNC_0(pio_addr_t VAR_0, uint8_t VAR_1) { LOG_IOPORT("outb: %04"FMT_pioaddr" %02"PRIx8"\n", VAR_0, VAR_1); trace_cpu_out(VAR_0, VAR_1); ioport_write(0, VAR_0, VAR_1); }
[ "void FUNC_0(pio_addr_t VAR_0, uint8_t VAR_1)\n{", "LOG_IOPORT(\"outb: %04\"FMT_pioaddr\" %02\"PRIx8\"\\n\", VAR_0, VAR_1);", "trace_cpu_out(VAR_0, VAR_1);", "ioport_write(0, VAR_0, VAR_1);", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ] ]