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
5,447
static void ff_h264_idct_add8_sse2(uint8_t **dest, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){ int i; for(i=16; i<16+8; i+=2){ if(nnzc[ scan8[i+0] ]|nnzc[ scan8[i+1] ]) ff_x264_add8x4_idct_sse2 (dest[(i&4)>>2] + block_offset[i], block + i*16, stride); else if(block[i*16]|block[i*16+16]) ff_h264_idct_dc_add8_mmx2(dest[(i&4)>>2] + block_offset[i], block + i*16, stride); } }
false
FFmpeg
1d16a1cf99488f16492b1bb48e023f4da8377e07
static void ff_h264_idct_add8_sse2(uint8_t **dest, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){ int i; for(i=16; i<16+8; i+=2){ if(nnzc[ scan8[i+0] ]|nnzc[ scan8[i+1] ]) ff_x264_add8x4_idct_sse2 (dest[(i&4)>>2] + block_offset[i], block + i*16, stride); else if(block[i*16]|block[i*16+16]) ff_h264_idct_dc_add8_mmx2(dest[(i&4)>>2] + block_offset[i], block + i*16, stride); } }
{ "code": [], "line_no": [] }
static void FUNC_0(uint8_t **VAR_0, const int *VAR_1, DCTELEM *VAR_2, int VAR_3, const uint8_t VAR_4[6*8]){ int VAR_5; for(VAR_5=16; VAR_5<16+8; VAR_5+=2){ if(VAR_4[ scan8[VAR_5+0] ]|VAR_4[ scan8[VAR_5+1] ]) ff_x264_add8x4_idct_sse2 (VAR_0[(VAR_5&4)>>2] + VAR_1[VAR_5], VAR_2 + VAR_5*16, VAR_3); else if(VAR_2[VAR_5*16]|VAR_2[VAR_5*16+16]) ff_h264_idct_dc_add8_mmx2(VAR_0[(VAR_5&4)>>2] + VAR_1[VAR_5], VAR_2 + VAR_5*16, VAR_3); } }
[ "static void FUNC_0(uint8_t **VAR_0, const int *VAR_1, DCTELEM *VAR_2, int VAR_3, const uint8_t VAR_4[6*8]){", "int VAR_5;", "for(VAR_5=16; VAR_5<16+8; VAR_5+=2){", "if(VAR_4[ scan8[VAR_5+0] ]|VAR_4[ scan8[VAR_5+1] ])\nff_x264_add8x4_idct_sse2 (VAR_0[(VAR_5&4)>>2] + VAR_1[VAR_5], VAR_2 + VAR_5*16, VAR_3);", "else if(VAR_2[VAR_5*16]|VAR_2[VAR_5*16+16])\nff_h264_idct_dc_add8_mmx2(VAR_0[(VAR_5&4)>>2] + VAR_1[VAR_5], VAR_2 + VAR_5*16, VAR_3);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7, 9 ], [ 11, 13 ], [ 15 ], [ 17 ] ]
5,448
static int mov_read_dref(MOVContext *c, ByteIOContext *pb, MOVAtom atom) { AVStream *st = c->fc->streams[c->fc->nb_streams-1]; MOVStreamContext *sc = st->priv_data; int entries, i, j; get_be32(pb); // version + flags entries = get_be32(pb); if (entries >= UINT_MAX / sizeof(*sc->drefs)) return -1; sc->drefs = av_mallocz(entries * sizeof(*sc->drefs)); if (!sc->drefs) return AVERROR(ENOMEM); sc->drefs_count = entries; for (i = 0; i < sc->drefs_count; i++) { MOVDref *dref = &sc->drefs[i]; uint32_t size = get_be32(pb); int64_t next = url_ftell(pb) + size - 4; dref->type = get_le32(pb); get_be32(pb); // version + flags dprintf(c->fc, "type %.4s size %d\n", (char*)&dref->type, size); if (dref->type == MKTAG('a','l','i','s') && size > 150) { /* macintosh alias record */ uint16_t volume_len, len; char volume[28]; int16_t type; url_fskip(pb, 10); volume_len = get_byte(pb); volume_len = FFMIN(volume_len, 27); get_buffer(pb, volume, 27); volume[volume_len] = 0; av_log(c->fc, AV_LOG_DEBUG, "volume %s, len %d\n", volume, volume_len); url_fskip(pb, 112); for (type = 0; type != -1 && url_ftell(pb) < next; ) { type = get_be16(pb); len = get_be16(pb); av_log(c->fc, AV_LOG_DEBUG, "type %d, len %d\n", type, len); if (len&1) len += 1; if (type == 2) { // absolute path av_free(dref->path); dref->path = av_mallocz(len+1); if (!dref->path) return AVERROR(ENOMEM); get_buffer(pb, dref->path, len); if (len > volume_len && !strncmp(dref->path, volume, volume_len)) { len -= volume_len; memmove(dref->path, dref->path+volume_len, len); dref->path[len] = 0; } for (j = 0; j < len; j++) if (dref->path[j] == ':') dref->path[j] = '/'; av_log(c->fc, AV_LOG_DEBUG, "path %s\n", dref->path); } else url_fskip(pb, len); } } url_fseek(pb, next, SEEK_SET); } return 0; }
false
FFmpeg
6a63ff19b6a7fe3bc32c7fb4a62fca8f65786432
static int mov_read_dref(MOVContext *c, ByteIOContext *pb, MOVAtom atom) { AVStream *st = c->fc->streams[c->fc->nb_streams-1]; MOVStreamContext *sc = st->priv_data; int entries, i, j; get_be32(pb); entries = get_be32(pb); if (entries >= UINT_MAX / sizeof(*sc->drefs)) return -1; sc->drefs = av_mallocz(entries * sizeof(*sc->drefs)); if (!sc->drefs) return AVERROR(ENOMEM); sc->drefs_count = entries; for (i = 0; i < sc->drefs_count; i++) { MOVDref *dref = &sc->drefs[i]; uint32_t size = get_be32(pb); int64_t next = url_ftell(pb) + size - 4; dref->type = get_le32(pb); get_be32(pb); dprintf(c->fc, "type %.4s size %d\n", (char*)&dref->type, size); if (dref->type == MKTAG('a','l','i','s') && size > 150) { uint16_t volume_len, len; char volume[28]; int16_t type; url_fskip(pb, 10); volume_len = get_byte(pb); volume_len = FFMIN(volume_len, 27); get_buffer(pb, volume, 27); volume[volume_len] = 0; av_log(c->fc, AV_LOG_DEBUG, "volume %s, len %d\n", volume, volume_len); url_fskip(pb, 112); for (type = 0; type != -1 && url_ftell(pb) < next; ) { type = get_be16(pb); len = get_be16(pb); av_log(c->fc, AV_LOG_DEBUG, "type %d, len %d\n", type, len); if (len&1) len += 1; if (type == 2) { av_free(dref->path); dref->path = av_mallocz(len+1); if (!dref->path) return AVERROR(ENOMEM); get_buffer(pb, dref->path, len); if (len > volume_len && !strncmp(dref->path, volume, volume_len)) { len -= volume_len; memmove(dref->path, dref->path+volume_len, len); dref->path[len] = 0; } for (j = 0; j < len; j++) if (dref->path[j] == ':') dref->path[j] = '/'; av_log(c->fc, AV_LOG_DEBUG, "path %s\n", dref->path); } else url_fskip(pb, len); } } url_fseek(pb, next, SEEK_SET); } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(MOVContext *VAR_0, ByteIOContext *VAR_1, MOVAtom VAR_2) { AVStream *st = VAR_0->fc->streams[VAR_0->fc->nb_streams-1]; MOVStreamContext *sc = st->priv_data; int VAR_3, VAR_4, VAR_5; get_be32(VAR_1); VAR_3 = get_be32(VAR_1); if (VAR_3 >= UINT_MAX / sizeof(*sc->drefs)) return -1; sc->drefs = av_mallocz(VAR_3 * sizeof(*sc->drefs)); if (!sc->drefs) return AVERROR(ENOMEM); sc->drefs_count = VAR_3; for (VAR_4 = 0; VAR_4 < sc->drefs_count; VAR_4++) { MOVDref *dref = &sc->drefs[VAR_4]; uint32_t size = get_be32(VAR_1); int64_t next = url_ftell(VAR_1) + size - 4; dref->type = get_le32(VAR_1); get_be32(VAR_1); dprintf(VAR_0->fc, "type %.4s size %d\n", (char*)&dref->type, size); if (dref->type == MKTAG('a','l','VAR_4','s') && size > 150) { uint16_t volume_len, len; char volume[28]; int16_t type; url_fskip(VAR_1, 10); volume_len = get_byte(VAR_1); volume_len = FFMIN(volume_len, 27); get_buffer(VAR_1, volume, 27); volume[volume_len] = 0; av_log(VAR_0->fc, AV_LOG_DEBUG, "volume %s, len %d\n", volume, volume_len); url_fskip(VAR_1, 112); for (type = 0; type != -1 && url_ftell(VAR_1) < next; ) { type = get_be16(VAR_1); len = get_be16(VAR_1); av_log(VAR_0->fc, AV_LOG_DEBUG, "type %d, len %d\n", type, len); if (len&1) len += 1; if (type == 2) { av_free(dref->path); dref->path = av_mallocz(len+1); if (!dref->path) return AVERROR(ENOMEM); get_buffer(VAR_1, dref->path, len); if (len > volume_len && !strncmp(dref->path, volume, volume_len)) { len -= volume_len; memmove(dref->path, dref->path+volume_len, len); dref->path[len] = 0; } for (VAR_5 = 0; VAR_5 < len; VAR_5++) if (dref->path[VAR_5] == ':') dref->path[VAR_5] = '/'; av_log(VAR_0->fc, AV_LOG_DEBUG, "path %s\n", dref->path); } else url_fskip(VAR_1, len); } } url_fseek(VAR_1, next, SEEK_SET); } return 0; }
[ "static int FUNC_0(MOVContext *VAR_0, ByteIOContext *VAR_1, MOVAtom VAR_2)\n{", "AVStream *st = VAR_0->fc->streams[VAR_0->fc->nb_streams-1];", "MOVStreamContext *sc = st->priv_data;", "int VAR_3, VAR_4, VAR_5;", "get_be32(VAR_1);", "VAR_3 = get_be32(VAR_1);", "if (VAR_3 >= UINT_MAX / sizeof(*sc->drefs))\nreturn -1;", "sc->drefs = av_mallocz(VAR_3 * sizeof(*sc->drefs));", "if (!sc->drefs)\nreturn AVERROR(ENOMEM);", "sc->drefs_count = VAR_3;", "for (VAR_4 = 0; VAR_4 < sc->drefs_count; VAR_4++) {", "MOVDref *dref = &sc->drefs[VAR_4];", "uint32_t size = get_be32(VAR_1);", "int64_t next = url_ftell(VAR_1) + size - 4;", "dref->type = get_le32(VAR_1);", "get_be32(VAR_1);", "dprintf(VAR_0->fc, \"type %.4s size %d\\n\", (char*)&dref->type, size);", "if (dref->type == MKTAG('a','l','VAR_4','s') && size > 150) {", "uint16_t volume_len, len;", "char volume[28];", "int16_t type;", "url_fskip(VAR_1, 10);", "volume_len = get_byte(VAR_1);", "volume_len = FFMIN(volume_len, 27);", "get_buffer(VAR_1, volume, 27);", "volume[volume_len] = 0;", "av_log(VAR_0->fc, AV_LOG_DEBUG, \"volume %s, len %d\\n\", volume, volume_len);", "url_fskip(VAR_1, 112);", "for (type = 0; type != -1 && url_ftell(VAR_1) < next; ) {", "type = get_be16(VAR_1);", "len = get_be16(VAR_1);", "av_log(VAR_0->fc, AV_LOG_DEBUG, \"type %d, len %d\\n\", type, len);", "if (len&1)\nlen += 1;", "if (type == 2) {", "av_free(dref->path);", "dref->path = av_mallocz(len+1);", "if (!dref->path)\nreturn AVERROR(ENOMEM);", "get_buffer(VAR_1, dref->path, len);", "if (len > volume_len && !strncmp(dref->path, volume, volume_len)) {", "len -= volume_len;", "memmove(dref->path, dref->path+volume_len, len);", "dref->path[len] = 0;", "}", "for (VAR_5 = 0; VAR_5 < len; VAR_5++)", "if (dref->path[VAR_5] == ':')\ndref->path[VAR_5] = '/';", "av_log(VAR_0->fc, AV_LOG_DEBUG, \"path %s\\n\", dref->path);", "} else", "url_fskip(VAR_1, len);", "}", "}", "url_fseek(VAR_1, next, SEEK_SET);", "}", "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 ], [ 13 ], [ 15 ], [ 17, 19 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89, 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99, 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117, 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ] ]
5,449
void yuv2rgb_altivec_init_tables (SwsContext *c, const int inv_table[4]) { vector signed short CY, CRV, CBU, CGU, CGV, OY, Y0; int64_t crv __attribute__ ((aligned(16))) = inv_table[0]; int64_t cbu __attribute__ ((aligned(16))) = inv_table[1]; int64_t cgu __attribute__ ((aligned(16))) = inv_table[2]; int64_t cgv __attribute__ ((aligned(16))) = inv_table[3]; int64_t cy = (1<<16)-1; int64_t oy = 0; short tmp __attribute__ ((aligned(16))); if ((c->flags & SWS_CPU_CAPS_ALTIVEC) == 0) return; cy = (cy *c->contrast )>>17; crv= (crv*c->contrast * c->saturation)>>32; cbu= (cbu*c->contrast * c->saturation)>>32; cgu= (cgu*c->contrast * c->saturation)>>32; cgv= (cgv*c->contrast * c->saturation)>>32; oy -= 256*c->brightness; tmp = cy; CY = vec_lde (0, &tmp); CY = vec_splat (CY, 0); tmp = oy; OY = vec_lde (0, &tmp); OY = vec_splat (OY, 0); tmp = crv>>3; CRV = vec_lde (0, &tmp); CRV = vec_splat (CRV, 0); tmp = cbu>>3; CBU = vec_lde (0, &tmp); CBU = vec_splat (CBU, 0); tmp = -(cgu>>1); CGU = vec_lde (0, &tmp); CGU = vec_splat (CGU, 0); tmp = -(cgv>>1); CGV = vec_lde (0, &tmp); CGV = vec_splat (CGV, 0); c->CSHIFT = (vector unsigned short)(2); c->CY = CY; c->OY = OY; c->CRV = CRV; c->CBU = CBU; c->CGU = CGU; c->CGV = CGV; #if 0 printf ("cy: %hvx\n", CY); printf ("oy: %hvx\n", OY); printf ("crv: %hvx\n", CRV); printf ("cbu: %hvx\n", CBU); printf ("cgv: %hvx\n", CGV); printf ("cgu: %hvx\n", CGU); #endif return; }
false
FFmpeg
582552fb56ba6559cb1d094a7e7ae5dde3073c5c
void yuv2rgb_altivec_init_tables (SwsContext *c, const int inv_table[4]) { vector signed short CY, CRV, CBU, CGU, CGV, OY, Y0; int64_t crv __attribute__ ((aligned(16))) = inv_table[0]; int64_t cbu __attribute__ ((aligned(16))) = inv_table[1]; int64_t cgu __attribute__ ((aligned(16))) = inv_table[2]; int64_t cgv __attribute__ ((aligned(16))) = inv_table[3]; int64_t cy = (1<<16)-1; int64_t oy = 0; short tmp __attribute__ ((aligned(16))); if ((c->flags & SWS_CPU_CAPS_ALTIVEC) == 0) return; cy = (cy *c->contrast )>>17; crv= (crv*c->contrast * c->saturation)>>32; cbu= (cbu*c->contrast * c->saturation)>>32; cgu= (cgu*c->contrast * c->saturation)>>32; cgv= (cgv*c->contrast * c->saturation)>>32; oy -= 256*c->brightness; tmp = cy; CY = vec_lde (0, &tmp); CY = vec_splat (CY, 0); tmp = oy; OY = vec_lde (0, &tmp); OY = vec_splat (OY, 0); tmp = crv>>3; CRV = vec_lde (0, &tmp); CRV = vec_splat (CRV, 0); tmp = cbu>>3; CBU = vec_lde (0, &tmp); CBU = vec_splat (CBU, 0); tmp = -(cgu>>1); CGU = vec_lde (0, &tmp); CGU = vec_splat (CGU, 0); tmp = -(cgv>>1); CGV = vec_lde (0, &tmp); CGV = vec_splat (CGV, 0); c->CSHIFT = (vector unsigned short)(2); c->CY = CY; c->OY = OY; c->CRV = CRV; c->CBU = CBU; c->CGU = CGU; c->CGV = CGV; #if 0 printf ("cy: %hvx\n", CY); printf ("oy: %hvx\n", OY); printf ("crv: %hvx\n", CRV); printf ("cbu: %hvx\n", CBU); printf ("cgv: %hvx\n", CGV); printf ("cgu: %hvx\n", CGU); #endif return; }
{ "code": [], "line_no": [] }
void FUNC_0 (SwsContext *VAR_0, const int VAR_1[4]) { vector signed short CY, CRV, CBU, CGU, CGV, OY, Y0; int64_t crv __attribute__ ((aligned(16))) = VAR_1[0]; int64_t cbu __attribute__ ((aligned(16))) = VAR_1[1]; int64_t cgu __attribute__ ((aligned(16))) = VAR_1[2]; int64_t cgv __attribute__ ((aligned(16))) = VAR_1[3]; int64_t cy = (1<<16)-1; int64_t oy = 0; short VAR_2 __attribute__ ((aligned(16))); if ((VAR_0->flags & SWS_CPU_CAPS_ALTIVEC) == 0) return; cy = (cy *VAR_0->contrast )>>17; crv= (crv*VAR_0->contrast * VAR_0->saturation)>>32; cbu= (cbu*VAR_0->contrast * VAR_0->saturation)>>32; cgu= (cgu*VAR_0->contrast * VAR_0->saturation)>>32; cgv= (cgv*VAR_0->contrast * VAR_0->saturation)>>32; oy -= 256*VAR_0->brightness; VAR_2 = cy; CY = vec_lde (0, &VAR_2); CY = vec_splat (CY, 0); VAR_2 = oy; OY = vec_lde (0, &VAR_2); OY = vec_splat (OY, 0); VAR_2 = crv>>3; CRV = vec_lde (0, &VAR_2); CRV = vec_splat (CRV, 0); VAR_2 = cbu>>3; CBU = vec_lde (0, &VAR_2); CBU = vec_splat (CBU, 0); VAR_2 = -(cgu>>1); CGU = vec_lde (0, &VAR_2); CGU = vec_splat (CGU, 0); VAR_2 = -(cgv>>1); CGV = vec_lde (0, &VAR_2); CGV = vec_splat (CGV, 0); VAR_0->CSHIFT = (vector unsigned short)(2); VAR_0->CY = CY; VAR_0->OY = OY; VAR_0->CRV = CRV; VAR_0->CBU = CBU; VAR_0->CGU = CGU; VAR_0->CGV = CGV; #if 0 printf ("cy: %hvx\n", CY); printf ("oy: %hvx\n", OY); printf ("crv: %hvx\n", CRV); printf ("cbu: %hvx\n", CBU); printf ("cgv: %hvx\n", CGV); printf ("cgu: %hvx\n", CGU); #endif return; }
[ "void FUNC_0 (SwsContext *VAR_0, const int VAR_1[4])\n{", "vector signed short CY, CRV, CBU, CGU, CGV, OY, Y0;", "int64_t crv __attribute__ ((aligned(16))) = VAR_1[0];", "int64_t cbu __attribute__ ((aligned(16))) = VAR_1[1];", "int64_t cgu __attribute__ ((aligned(16))) = VAR_1[2];", "int64_t cgv __attribute__ ((aligned(16))) = VAR_1[3];", "int64_t cy = (1<<16)-1;", "int64_t oy = 0;", "short VAR_2 __attribute__ ((aligned(16)));", "if ((VAR_0->flags & SWS_CPU_CAPS_ALTIVEC) == 0)\nreturn;", "cy = (cy *VAR_0->contrast )>>17;", "crv= (crv*VAR_0->contrast * VAR_0->saturation)>>32;", "cbu= (cbu*VAR_0->contrast * VAR_0->saturation)>>32;", "cgu= (cgu*VAR_0->contrast * VAR_0->saturation)>>32;", "cgv= (cgv*VAR_0->contrast * VAR_0->saturation)>>32;", "oy -= 256*VAR_0->brightness;", "VAR_2 = cy;", "CY = vec_lde (0, &VAR_2);", "CY = vec_splat (CY, 0);", "VAR_2 = oy;", "OY = vec_lde (0, &VAR_2);", "OY = vec_splat (OY, 0);", "VAR_2 = crv>>3;", "CRV = vec_lde (0, &VAR_2);", "CRV = vec_splat (CRV, 0);", "VAR_2 = cbu>>3;", "CBU = vec_lde (0, &VAR_2);", "CBU = vec_splat (CBU, 0);", "VAR_2 = -(cgu>>1);", "CGU = vec_lde (0, &VAR_2);", "CGU = vec_splat (CGU, 0);", "VAR_2 = -(cgv>>1);", "CGV = vec_lde (0, &VAR_2);", "CGV = vec_splat (CGV, 0);", "VAR_0->CSHIFT = (vector unsigned short)(2);", "VAR_0->CY = CY;", "VAR_0->OY = OY;", "VAR_0->CRV = CRV;", "VAR_0->CBU = CBU;", "VAR_0->CGU = CGU;", "VAR_0->CGV = CGV;", "#if 0\nprintf (\"cy: %hvx\\n\", CY);", "printf (\"oy: %hvx\\n\", OY);", "printf (\"crv: %hvx\\n\", CRV);", "printf (\"cbu: %hvx\\n\", CBU);", "printf (\"cgv: %hvx\\n\", CGV);", "printf (\"cgu: %hvx\\n\", CGU);", "#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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23, 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 105, 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119, 123 ], [ 125 ] ]
5,450
void mipsnet_init (int base, qemu_irq irq, NICInfo *nd) { MIPSnetState *s; qemu_check_nic_model(nd, "mipsnet"); s = qemu_mallocz(sizeof(MIPSnetState)); register_ioport_write(base, 36, 1, mipsnet_ioport_write, s); register_ioport_read(base, 36, 1, mipsnet_ioport_read, s); register_ioport_write(base, 36, 2, mipsnet_ioport_write, s); register_ioport_read(base, 36, 2, mipsnet_ioport_read, s); register_ioport_write(base, 36, 4, mipsnet_ioport_write, s); register_ioport_read(base, 36, 4, mipsnet_ioport_read, s); s->io_base = base; s->irq = irq; if (nd && nd->vlan) { s->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name, mipsnet_can_receive, mipsnet_receive, NULL, mipsnet_cleanup, s); } else { s->vc = NULL; } qemu_format_nic_info_str(s->vc, nd->macaddr); mipsnet_reset(s); register_savevm("mipsnet", 0, 0, mipsnet_save, mipsnet_load, s); }
true
qemu
ae50b2747f77944faa79eb914272b54eb30b63b3
void mipsnet_init (int base, qemu_irq irq, NICInfo *nd) { MIPSnetState *s; qemu_check_nic_model(nd, "mipsnet"); s = qemu_mallocz(sizeof(MIPSnetState)); register_ioport_write(base, 36, 1, mipsnet_ioport_write, s); register_ioport_read(base, 36, 1, mipsnet_ioport_read, s); register_ioport_write(base, 36, 2, mipsnet_ioport_write, s); register_ioport_read(base, 36, 2, mipsnet_ioport_read, s); register_ioport_write(base, 36, 4, mipsnet_ioport_write, s); register_ioport_read(base, 36, 4, mipsnet_ioport_read, s); s->io_base = base; s->irq = irq; if (nd && nd->vlan) { s->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name, mipsnet_can_receive, mipsnet_receive, NULL, mipsnet_cleanup, s); } else { s->vc = NULL; } qemu_format_nic_info_str(s->vc, nd->macaddr); mipsnet_reset(s); register_savevm("mipsnet", 0, 0, mipsnet_save, mipsnet_load, s); }
{ "code": [ " s->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name,", " mipsnet_can_receive, mipsnet_receive, NULL,", " mipsnet_cleanup, s);" ], "line_no": [ 37, 39, 41 ] }
void FUNC_0 (int VAR_0, qemu_irq VAR_1, NICInfo *VAR_2) { MIPSnetState *s; qemu_check_nic_model(VAR_2, "mipsnet"); s = qemu_mallocz(sizeof(MIPSnetState)); register_ioport_write(VAR_0, 36, 1, mipsnet_ioport_write, s); register_ioport_read(VAR_0, 36, 1, mipsnet_ioport_read, s); register_ioport_write(VAR_0, 36, 2, mipsnet_ioport_write, s); register_ioport_read(VAR_0, 36, 2, mipsnet_ioport_read, s); register_ioport_write(VAR_0, 36, 4, mipsnet_ioport_write, s); register_ioport_read(VAR_0, 36, 4, mipsnet_ioport_read, s); s->io_base = VAR_0; s->VAR_1 = VAR_1; if (VAR_2 && VAR_2->vlan) { s->vc = qemu_new_vlan_client(VAR_2->vlan, VAR_2->model, VAR_2->name, mipsnet_can_receive, mipsnet_receive, NULL, mipsnet_cleanup, s); } else { s->vc = NULL; } qemu_format_nic_info_str(s->vc, VAR_2->macaddr); mipsnet_reset(s); register_savevm("mipsnet", 0, 0, mipsnet_save, mipsnet_load, s); }
[ "void FUNC_0 (int VAR_0, qemu_irq VAR_1, NICInfo *VAR_2)\n{", "MIPSnetState *s;", "qemu_check_nic_model(VAR_2, \"mipsnet\");", "s = qemu_mallocz(sizeof(MIPSnetState));", "register_ioport_write(VAR_0, 36, 1, mipsnet_ioport_write, s);", "register_ioport_read(VAR_0, 36, 1, mipsnet_ioport_read, s);", "register_ioport_write(VAR_0, 36, 2, mipsnet_ioport_write, s);", "register_ioport_read(VAR_0, 36, 2, mipsnet_ioport_read, s);", "register_ioport_write(VAR_0, 36, 4, mipsnet_ioport_write, s);", "register_ioport_read(VAR_0, 36, 4, mipsnet_ioport_read, s);", "s->io_base = VAR_0;", "s->VAR_1 = VAR_1;", "if (VAR_2 && VAR_2->vlan) {", "s->vc = qemu_new_vlan_client(VAR_2->vlan, VAR_2->model, VAR_2->name,\nmipsnet_can_receive, mipsnet_receive, NULL,\nmipsnet_cleanup, s);", "} else {", "s->vc = NULL;", "}", "qemu_format_nic_info_str(s->vc, VAR_2->macaddr);", "mipsnet_reset(s);", "register_savevm(\"mipsnet\", 0, 0, mipsnet_save, mipsnet_load, s);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37, 39, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ] ]
5,451
static inline void hcscale_fast_c(SwsContext *c, int16_t *dst1, int16_t *dst2, int dstWidth, const uint8_t *src1, const uint8_t *src2, int srcW, int xInc) { int i; unsigned int xpos=0; for (i=0;i<dstWidth;i++) { register unsigned int xx=xpos>>16; register unsigned int xalpha=(xpos&0xFFFF)>>9; dst1[i]=(src1[xx]*(xalpha^127)+src1[xx+1]*xalpha); dst2[i]=(src2[xx]*(xalpha^127)+src2[xx+1]*xalpha); xpos+=xInc;
true
FFmpeg
877f76ad33bb9b0b0d09565dd9ec1cf8e91096f1
static inline void hcscale_fast_c(SwsContext *c, int16_t *dst1, int16_t *dst2, int dstWidth, const uint8_t *src1, const uint8_t *src2, int srcW, int xInc) { int i; unsigned int xpos=0; for (i=0;i<dstWidth;i++) { register unsigned int xx=xpos>>16; register unsigned int xalpha=(xpos&0xFFFF)>>9; dst1[i]=(src1[xx]*(xalpha^127)+src1[xx+1]*xalpha); dst2[i]=(src2[xx]*(xalpha^127)+src2[xx+1]*xalpha); xpos+=xInc;
{ "code": [], "line_no": [] }
static inline void FUNC_0(SwsContext *VAR_0, int16_t *VAR_1, int16_t *VAR_2, int VAR_3, const uint8_t *VAR_4, const uint8_t *VAR_5, int VAR_6, int VAR_7) { int VAR_8; unsigned int VAR_9=0; for (VAR_8=0;VAR_8<VAR_3;VAR_8++) { register unsigned int VAR_10=VAR_9>>16; register unsigned int VAR_11=(VAR_9&0xFFFF)>>9; VAR_1[VAR_8]=(VAR_4[VAR_10]*(VAR_11^127)+VAR_4[VAR_10+1]*VAR_11); VAR_2[VAR_8]=(VAR_5[VAR_10]*(VAR_11^127)+VAR_5[VAR_10+1]*VAR_11); VAR_9+=VAR_7;
[ "static inline void FUNC_0(SwsContext *VAR_0, int16_t *VAR_1, int16_t *VAR_2,\nint VAR_3, const uint8_t *VAR_4,\nconst uint8_t *VAR_5, int VAR_6, int VAR_7)\n{", "int VAR_8;", "unsigned int VAR_9=0;", "for (VAR_8=0;VAR_8<VAR_3;VAR_8++) {", "register unsigned int VAR_10=VAR_9>>16;", "register unsigned int VAR_11=(VAR_9&0xFFFF)>>9;", "VAR_1[VAR_8]=(VAR_4[VAR_10]*(VAR_11^127)+VAR_4[VAR_10+1]*VAR_11);", "VAR_2[VAR_8]=(VAR_5[VAR_10]*(VAR_11^127)+VAR_5[VAR_10+1]*VAR_11);", "VAR_9+=VAR_7;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ] ]
5,453
static void apply_window_and_mdct(AACEncContext *s, SingleChannelElement *sce, float *audio) { int i; float *output = sce->ret_buf; apply_window[sce->ics.window_sequence[0]](s->fdsp, sce, audio); if (sce->ics.window_sequence[0] != EIGHT_SHORT_SEQUENCE) s->mdct1024.mdct_calc(&s->mdct1024, sce->coeffs, output); else for (i = 0; i < 1024; i += 128) s->mdct128.mdct_calc(&s->mdct128, sce->coeffs + i, output + i*2); memcpy(audio, audio + 1024, sizeof(audio[0]) * 1024); memcpy(sce->pcoeffs, sce->coeffs, sizeof(sce->pcoeffs)); }
true
FFmpeg
32be264cea542b4dc721b10092bf1dfe511a28ee
static void apply_window_and_mdct(AACEncContext *s, SingleChannelElement *sce, float *audio) { int i; float *output = sce->ret_buf; apply_window[sce->ics.window_sequence[0]](s->fdsp, sce, audio); if (sce->ics.window_sequence[0] != EIGHT_SHORT_SEQUENCE) s->mdct1024.mdct_calc(&s->mdct1024, sce->coeffs, output); else for (i = 0; i < 1024; i += 128) s->mdct128.mdct_calc(&s->mdct128, sce->coeffs + i, output + i*2); memcpy(audio, audio + 1024, sizeof(audio[0]) * 1024); memcpy(sce->pcoeffs, sce->coeffs, sizeof(sce->pcoeffs)); }
{ "code": [ " s->mdct128.mdct_calc(&s->mdct128, sce->coeffs + i, output + i*2);" ], "line_no": [ 25 ] }
static void FUNC_0(AACEncContext *VAR_0, SingleChannelElement *VAR_1, float *VAR_2) { int VAR_3; float *VAR_4 = VAR_1->ret_buf; apply_window[VAR_1->ics.window_sequence[0]](VAR_0->fdsp, VAR_1, VAR_2); if (VAR_1->ics.window_sequence[0] != EIGHT_SHORT_SEQUENCE) VAR_0->mdct1024.mdct_calc(&VAR_0->mdct1024, VAR_1->coeffs, VAR_4); else for (VAR_3 = 0; VAR_3 < 1024; VAR_3 += 128) VAR_0->mdct128.mdct_calc(&VAR_0->mdct128, VAR_1->coeffs + VAR_3, VAR_4 + VAR_3*2); memcpy(VAR_2, VAR_2 + 1024, sizeof(VAR_2[0]) * 1024); memcpy(VAR_1->pcoeffs, VAR_1->coeffs, sizeof(VAR_1->pcoeffs)); }
[ "static void FUNC_0(AACEncContext *VAR_0, SingleChannelElement *VAR_1,\nfloat *VAR_2)\n{", "int VAR_3;", "float *VAR_4 = VAR_1->ret_buf;", "apply_window[VAR_1->ics.window_sequence[0]](VAR_0->fdsp, VAR_1, VAR_2);", "if (VAR_1->ics.window_sequence[0] != EIGHT_SHORT_SEQUENCE)\nVAR_0->mdct1024.mdct_calc(&VAR_0->mdct1024, VAR_1->coeffs, VAR_4);", "else\nfor (VAR_3 = 0; VAR_3 < 1024; VAR_3 += 128)", "VAR_0->mdct128.mdct_calc(&VAR_0->mdct128, VAR_1->coeffs + VAR_3, VAR_4 + VAR_3*2);", "memcpy(VAR_2, VAR_2 + 1024, sizeof(VAR_2[0]) * 1024);", "memcpy(VAR_1->pcoeffs, VAR_1->coeffs, sizeof(VAR_1->pcoeffs));", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17, 19 ], [ 21, 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ] ]
5,454
TPMVersion tpm_tis_get_tpm_version(Object *obj) { TPMState *s = TPM(obj); return tpm_backend_get_tpm_version(s->be_driver);
true
qemu
ad4aca69bbd40663ca93a3eb1d8042c023b9b407
TPMVersion tpm_tis_get_tpm_version(Object *obj) { TPMState *s = TPM(obj); return tpm_backend_get_tpm_version(s->be_driver);
{ "code": [], "line_no": [] }
TPMVersion FUNC_0(Object *obj) { TPMState *s = TPM(obj); return tpm_backend_get_tpm_version(s->be_driver);
[ "TPMVersion FUNC_0(Object *obj)\n{", "TPMState *s = TPM(obj);", "return tpm_backend_get_tpm_version(s->be_driver);" ]
[ 0, 0, 0 ]
[ [ 1, 2 ], [ 3 ], [ 4 ] ]
5,455
vmxnet3_indicate_packet(VMXNET3State *s) { struct Vmxnet3_RxDesc rxd; bool is_head = true; uint32_t rxd_idx; uint32_t rx_ridx; struct Vmxnet3_RxCompDesc rxcd; uint32_t new_rxcd_gen = VMXNET3_INIT_GEN; hwaddr new_rxcd_pa = 0; hwaddr ready_rxcd_pa = 0; struct iovec *data = vmxnet_rx_pkt_get_iovec(s->rx_pkt); size_t bytes_copied = 0; size_t bytes_left = vmxnet_rx_pkt_get_total_len(s->rx_pkt); uint16_t num_frags = 0; size_t chunk_size; vmxnet_rx_pkt_dump(s->rx_pkt); while (bytes_left > 0) { /* cannot add more frags to packet */ if (num_frags == s->max_rx_frags) { break; } new_rxcd_pa = vmxnet3_pop_rxc_descr(s, RXQ_IDX, &new_rxcd_gen); if (!new_rxcd_pa) { break; } if (!vmxnet3_get_next_rx_descr(s, is_head, &rxd, &rxd_idx, &rx_ridx)) { break; } chunk_size = MIN(bytes_left, rxd.len); vmxnet3_physical_memory_writev(data, bytes_copied, le64_to_cpu(rxd.addr), chunk_size); bytes_copied += chunk_size; bytes_left -= chunk_size; vmxnet3_dump_rx_descr(&rxd); if (0 != ready_rxcd_pa) { cpu_physical_memory_write(ready_rxcd_pa, &rxcd, sizeof(rxcd)); } memset(&rxcd, 0, sizeof(struct Vmxnet3_RxCompDesc)); rxcd.rxdIdx = rxd_idx; rxcd.len = chunk_size; rxcd.sop = is_head; rxcd.gen = new_rxcd_gen; rxcd.rqID = RXQ_IDX + rx_ridx * s->rxq_num; if (0 == bytes_left) { vmxnet3_rx_update_descr(s->rx_pkt, &rxcd); } VMW_RIPRN("RX Completion descriptor: rxRing: %lu rxIdx %lu len %lu " "sop %d csum_correct %lu", (unsigned long) rx_ridx, (unsigned long) rxcd.rxdIdx, (unsigned long) rxcd.len, (int) rxcd.sop, (unsigned long) rxcd.tuc); is_head = false; ready_rxcd_pa = new_rxcd_pa; new_rxcd_pa = 0; } if (0 != ready_rxcd_pa) { rxcd.eop = 1; rxcd.err = (0 != bytes_left); cpu_physical_memory_write(ready_rxcd_pa, &rxcd, sizeof(rxcd)); /* Flush RX descriptor changes */ smp_wmb(); } if (0 != new_rxcd_pa) { vmxnet3_revert_rxc_descr(s, RXQ_IDX); } vmxnet3_trigger_interrupt(s, s->rxq_descr[RXQ_IDX].intr_idx); if (bytes_left == 0) { vmxnet3_on_rx_done_update_stats(s, RXQ_IDX, VMXNET3_PKT_STATUS_OK); return true; } else if (num_frags == s->max_rx_frags) { vmxnet3_on_rx_done_update_stats(s, RXQ_IDX, VMXNET3_PKT_STATUS_ERROR); return false; } else { vmxnet3_on_rx_done_update_stats(s, RXQ_IDX, VMXNET3_PKT_STATUS_OUT_OF_BUF); return false; } }
true
qemu
c707582b78d01d81fe4e470fd812334be145882d
vmxnet3_indicate_packet(VMXNET3State *s) { struct Vmxnet3_RxDesc rxd; bool is_head = true; uint32_t rxd_idx; uint32_t rx_ridx; struct Vmxnet3_RxCompDesc rxcd; uint32_t new_rxcd_gen = VMXNET3_INIT_GEN; hwaddr new_rxcd_pa = 0; hwaddr ready_rxcd_pa = 0; struct iovec *data = vmxnet_rx_pkt_get_iovec(s->rx_pkt); size_t bytes_copied = 0; size_t bytes_left = vmxnet_rx_pkt_get_total_len(s->rx_pkt); uint16_t num_frags = 0; size_t chunk_size; vmxnet_rx_pkt_dump(s->rx_pkt); while (bytes_left > 0) { if (num_frags == s->max_rx_frags) { break; } new_rxcd_pa = vmxnet3_pop_rxc_descr(s, RXQ_IDX, &new_rxcd_gen); if (!new_rxcd_pa) { break; } if (!vmxnet3_get_next_rx_descr(s, is_head, &rxd, &rxd_idx, &rx_ridx)) { break; } chunk_size = MIN(bytes_left, rxd.len); vmxnet3_physical_memory_writev(data, bytes_copied, le64_to_cpu(rxd.addr), chunk_size); bytes_copied += chunk_size; bytes_left -= chunk_size; vmxnet3_dump_rx_descr(&rxd); if (0 != ready_rxcd_pa) { cpu_physical_memory_write(ready_rxcd_pa, &rxcd, sizeof(rxcd)); } memset(&rxcd, 0, sizeof(struct Vmxnet3_RxCompDesc)); rxcd.rxdIdx = rxd_idx; rxcd.len = chunk_size; rxcd.sop = is_head; rxcd.gen = new_rxcd_gen; rxcd.rqID = RXQ_IDX + rx_ridx * s->rxq_num; if (0 == bytes_left) { vmxnet3_rx_update_descr(s->rx_pkt, &rxcd); } VMW_RIPRN("RX Completion descriptor: rxRing: %lu rxIdx %lu len %lu " "sop %d csum_correct %lu", (unsigned long) rx_ridx, (unsigned long) rxcd.rxdIdx, (unsigned long) rxcd.len, (int) rxcd.sop, (unsigned long) rxcd.tuc); is_head = false; ready_rxcd_pa = new_rxcd_pa; new_rxcd_pa = 0; } if (0 != ready_rxcd_pa) { rxcd.eop = 1; rxcd.err = (0 != bytes_left); cpu_physical_memory_write(ready_rxcd_pa, &rxcd, sizeof(rxcd)); smp_wmb(); } if (0 != new_rxcd_pa) { vmxnet3_revert_rxc_descr(s, RXQ_IDX); } vmxnet3_trigger_interrupt(s, s->rxq_descr[RXQ_IDX].intr_idx); if (bytes_left == 0) { vmxnet3_on_rx_done_update_stats(s, RXQ_IDX, VMXNET3_PKT_STATUS_OK); return true; } else if (num_frags == s->max_rx_frags) { vmxnet3_on_rx_done_update_stats(s, RXQ_IDX, VMXNET3_PKT_STATUS_ERROR); return false; } else { vmxnet3_on_rx_done_update_stats(s, RXQ_IDX, VMXNET3_PKT_STATUS_OUT_OF_BUF); return false; } }
{ "code": [ " uint32_t rx_ridx;" ], "line_no": [ 11 ] }
FUNC_0(VMXNET3State *VAR_0) { struct Vmxnet3_RxDesc VAR_1; bool is_head = true; uint32_t rxd_idx; uint32_t rx_ridx; struct Vmxnet3_RxCompDesc VAR_2; uint32_t new_rxcd_gen = VMXNET3_INIT_GEN; hwaddr new_rxcd_pa = 0; hwaddr ready_rxcd_pa = 0; struct iovec *VAR_3 = vmxnet_rx_pkt_get_iovec(VAR_0->rx_pkt); size_t bytes_copied = 0; size_t bytes_left = vmxnet_rx_pkt_get_total_len(VAR_0->rx_pkt); uint16_t num_frags = 0; size_t chunk_size; vmxnet_rx_pkt_dump(VAR_0->rx_pkt); while (bytes_left > 0) { if (num_frags == VAR_0->max_rx_frags) { break; } new_rxcd_pa = vmxnet3_pop_rxc_descr(VAR_0, RXQ_IDX, &new_rxcd_gen); if (!new_rxcd_pa) { break; } if (!vmxnet3_get_next_rx_descr(VAR_0, is_head, &VAR_1, &rxd_idx, &rx_ridx)) { break; } chunk_size = MIN(bytes_left, VAR_1.len); vmxnet3_physical_memory_writev(VAR_3, bytes_copied, le64_to_cpu(VAR_1.addr), chunk_size); bytes_copied += chunk_size; bytes_left -= chunk_size; vmxnet3_dump_rx_descr(&VAR_1); if (0 != ready_rxcd_pa) { cpu_physical_memory_write(ready_rxcd_pa, &VAR_2, sizeof(VAR_2)); } memset(&VAR_2, 0, sizeof(struct Vmxnet3_RxCompDesc)); VAR_2.rxdIdx = rxd_idx; VAR_2.len = chunk_size; VAR_2.sop = is_head; VAR_2.gen = new_rxcd_gen; VAR_2.rqID = RXQ_IDX + rx_ridx * VAR_0->rxq_num; if (0 == bytes_left) { vmxnet3_rx_update_descr(VAR_0->rx_pkt, &VAR_2); } VMW_RIPRN("RX Completion descriptor: rxRing: %lu rxIdx %lu len %lu " "sop %d csum_correct %lu", (unsigned long) rx_ridx, (unsigned long) VAR_2.rxdIdx, (unsigned long) VAR_2.len, (int) VAR_2.sop, (unsigned long) VAR_2.tuc); is_head = false; ready_rxcd_pa = new_rxcd_pa; new_rxcd_pa = 0; } if (0 != ready_rxcd_pa) { VAR_2.eop = 1; VAR_2.err = (0 != bytes_left); cpu_physical_memory_write(ready_rxcd_pa, &VAR_2, sizeof(VAR_2)); smp_wmb(); } if (0 != new_rxcd_pa) { vmxnet3_revert_rxc_descr(VAR_0, RXQ_IDX); } vmxnet3_trigger_interrupt(VAR_0, VAR_0->rxq_descr[RXQ_IDX].intr_idx); if (bytes_left == 0) { vmxnet3_on_rx_done_update_stats(VAR_0, RXQ_IDX, VMXNET3_PKT_STATUS_OK); return true; } else if (num_frags == VAR_0->max_rx_frags) { vmxnet3_on_rx_done_update_stats(VAR_0, RXQ_IDX, VMXNET3_PKT_STATUS_ERROR); return false; } else { vmxnet3_on_rx_done_update_stats(VAR_0, RXQ_IDX, VMXNET3_PKT_STATUS_OUT_OF_BUF); return false; } }
[ "FUNC_0(VMXNET3State *VAR_0)\n{", "struct Vmxnet3_RxDesc VAR_1;", "bool is_head = true;", "uint32_t rxd_idx;", "uint32_t rx_ridx;", "struct Vmxnet3_RxCompDesc VAR_2;", "uint32_t new_rxcd_gen = VMXNET3_INIT_GEN;", "hwaddr new_rxcd_pa = 0;", "hwaddr ready_rxcd_pa = 0;", "struct iovec *VAR_3 = vmxnet_rx_pkt_get_iovec(VAR_0->rx_pkt);", "size_t bytes_copied = 0;", "size_t bytes_left = vmxnet_rx_pkt_get_total_len(VAR_0->rx_pkt);", "uint16_t num_frags = 0;", "size_t chunk_size;", "vmxnet_rx_pkt_dump(VAR_0->rx_pkt);", "while (bytes_left > 0) {", "if (num_frags == VAR_0->max_rx_frags) {", "break;", "}", "new_rxcd_pa = vmxnet3_pop_rxc_descr(VAR_0, RXQ_IDX, &new_rxcd_gen);", "if (!new_rxcd_pa) {", "break;", "}", "if (!vmxnet3_get_next_rx_descr(VAR_0, is_head, &VAR_1, &rxd_idx, &rx_ridx)) {", "break;", "}", "chunk_size = MIN(bytes_left, VAR_1.len);", "vmxnet3_physical_memory_writev(VAR_3, bytes_copied,\nle64_to_cpu(VAR_1.addr), chunk_size);", "bytes_copied += chunk_size;", "bytes_left -= chunk_size;", "vmxnet3_dump_rx_descr(&VAR_1);", "if (0 != ready_rxcd_pa) {", "cpu_physical_memory_write(ready_rxcd_pa, &VAR_2, sizeof(VAR_2));", "}", "memset(&VAR_2, 0, sizeof(struct Vmxnet3_RxCompDesc));", "VAR_2.rxdIdx = rxd_idx;", "VAR_2.len = chunk_size;", "VAR_2.sop = is_head;", "VAR_2.gen = new_rxcd_gen;", "VAR_2.rqID = RXQ_IDX + rx_ridx * VAR_0->rxq_num;", "if (0 == bytes_left) {", "vmxnet3_rx_update_descr(VAR_0->rx_pkt, &VAR_2);", "}", "VMW_RIPRN(\"RX Completion descriptor: rxRing: %lu rxIdx %lu len %lu \"\n\"sop %d csum_correct %lu\",\n(unsigned long) rx_ridx,\n(unsigned long) VAR_2.rxdIdx,\n(unsigned long) VAR_2.len,\n(int) VAR_2.sop,\n(unsigned long) VAR_2.tuc);", "is_head = false;", "ready_rxcd_pa = new_rxcd_pa;", "new_rxcd_pa = 0;", "}", "if (0 != ready_rxcd_pa) {", "VAR_2.eop = 1;", "VAR_2.err = (0 != bytes_left);", "cpu_physical_memory_write(ready_rxcd_pa, &VAR_2, sizeof(VAR_2));", "smp_wmb();", "}", "if (0 != new_rxcd_pa) {", "vmxnet3_revert_rxc_descr(VAR_0, RXQ_IDX);", "}", "vmxnet3_trigger_interrupt(VAR_0, VAR_0->rxq_descr[RXQ_IDX].intr_idx);", "if (bytes_left == 0) {", "vmxnet3_on_rx_done_update_stats(VAR_0, RXQ_IDX, VMXNET3_PKT_STATUS_OK);", "return true;", "} else if (num_frags == VAR_0->max_rx_frags) {", "vmxnet3_on_rx_done_update_stats(VAR_0, RXQ_IDX, VMXNET3_PKT_STATUS_ERROR);", "return false;", "} else {", "vmxnet3_on_rx_done_update_stats(VAR_0, RXQ_IDX,\nVMXNET3_PKT_STATUS_OUT_OF_BUF);", "return false;", "}", "}" ]
[ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 39 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73, 75 ], [ 77 ], [ 79 ], [ 83 ], [ 87 ], [ 89 ], [ 91 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 109 ], [ 111 ], [ 113 ], [ 117, 119, 121, 123, 125, 127, 129 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 155 ], [ 157 ], [ 161 ], [ 163 ], [ 165 ], [ 169 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187, 189 ], [ 191 ], [ 193 ], [ 195 ] ]
5,456
static void sp804_write(void *opaque, target_phys_addr_t offset, uint64_t value, unsigned size) { sp804_state *s = (sp804_state *)opaque; if (offset < 0x20) { arm_timer_write(s->timer[0], offset, value); return; } if (offset < 0x40) { arm_timer_write(s->timer[1], offset - 0x20, value); return; } /* Technically we could be writing to the Test Registers, but not likely */ hw_error("%s: Bad offset %x\n", __func__, (int)offset); }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static void sp804_write(void *opaque, target_phys_addr_t offset, uint64_t value, unsigned size) { sp804_state *s = (sp804_state *)opaque; if (offset < 0x20) { arm_timer_write(s->timer[0], offset, value); return; } if (offset < 0x40) { arm_timer_write(s->timer[1], offset - 0x20, value); return; } hw_error("%s: Bad offset %x\n", __func__, (int)offset); }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1, uint64_t VAR_2, unsigned VAR_3) { sp804_state *s = (sp804_state *)VAR_0; if (VAR_1 < 0x20) { arm_timer_write(s->timer[0], VAR_1, VAR_2); return; } if (VAR_1 < 0x40) { arm_timer_write(s->timer[1], VAR_1 - 0x20, VAR_2); return; } hw_error("%s: Bad VAR_1 %x\n", __func__, (int)VAR_1); }
[ "static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1,\nuint64_t VAR_2, unsigned VAR_3)\n{", "sp804_state *s = (sp804_state *)VAR_0;", "if (VAR_1 < 0x20) {", "arm_timer_write(s->timer[0], VAR_1, VAR_2);", "return;", "}", "if (VAR_1 < 0x40) {", "arm_timer_write(s->timer[1], VAR_1 - 0x20, VAR_2);", "return;", "}", "hw_error(\"%s: Bad VAR_1 %x\\n\", __func__, (int)VAR_1);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 33 ], [ 35 ] ]
5,458
static void cmd_start_stop_unit(IDEState *s, uint8_t* buf) { int sense; bool start = buf[4] & 1; bool loej = buf[4] & 2; /* load on start, eject on !start */ int pwrcnd = buf[4] & 0xf0; if (pwrcnd) { /* eject/load only happens for power condition == 0 */ return; } if (loej) { if (!start && !s->tray_open && s->tray_locked) { sense = bdrv_is_inserted(s->bs) ? NOT_READY : ILLEGAL_REQUEST; ide_atapi_cmd_error(s, sense, ASC_MEDIA_REMOVAL_PREVENTED); return; } if (s->tray_open != !start) { bdrv_eject(s->bs, !start); s->tray_open = !start; } } ide_atapi_cmd_ok(s); }
false
qemu
4be746345f13e99e468c60acbd3a355e8183e3ce
static void cmd_start_stop_unit(IDEState *s, uint8_t* buf) { int sense; bool start = buf[4] & 1; bool loej = buf[4] & 2; int pwrcnd = buf[4] & 0xf0; if (pwrcnd) { return; } if (loej) { if (!start && !s->tray_open && s->tray_locked) { sense = bdrv_is_inserted(s->bs) ? NOT_READY : ILLEGAL_REQUEST; ide_atapi_cmd_error(s, sense, ASC_MEDIA_REMOVAL_PREVENTED); return; } if (s->tray_open != !start) { bdrv_eject(s->bs, !start); s->tray_open = !start; } } ide_atapi_cmd_ok(s); }
{ "code": [], "line_no": [] }
static void FUNC_0(IDEState *VAR_0, uint8_t* VAR_1) { int VAR_2; bool start = VAR_1[4] & 1; bool loej = VAR_1[4] & 2; int VAR_3 = VAR_1[4] & 0xf0; if (VAR_3) { return; } if (loej) { if (!start && !VAR_0->tray_open && VAR_0->tray_locked) { VAR_2 = bdrv_is_inserted(VAR_0->bs) ? NOT_READY : ILLEGAL_REQUEST; ide_atapi_cmd_error(VAR_0, VAR_2, ASC_MEDIA_REMOVAL_PREVENTED); return; } if (VAR_0->tray_open != !start) { bdrv_eject(VAR_0->bs, !start); VAR_0->tray_open = !start; } } ide_atapi_cmd_ok(VAR_0); }
[ "static void FUNC_0(IDEState *VAR_0, uint8_t* VAR_1)\n{", "int VAR_2;", "bool start = VAR_1[4] & 1;", "bool loej = VAR_1[4] & 2;", "int VAR_3 = VAR_1[4] & 0xf0;", "if (VAR_3) {", "return;", "}", "if (loej) {", "if (!start && !VAR_0->tray_open && VAR_0->tray_locked) {", "VAR_2 = bdrv_is_inserted(VAR_0->bs)\n? NOT_READY : ILLEGAL_REQUEST;", "ide_atapi_cmd_error(VAR_0, VAR_2, ASC_MEDIA_REMOVAL_PREVENTED);", "return;", "}", "if (VAR_0->tray_open != !start) {", "bdrv_eject(VAR_0->bs, !start);", "VAR_0->tray_open = !start;", "}", "}", "ide_atapi_cmd_ok(VAR_0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29, 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ] ]
5,461
void migration_tls_channel_connect(MigrationState *s, QIOChannel *ioc, const char *hostname, Error **errp) { QCryptoTLSCreds *creds; QIOChannelTLS *tioc; creds = migration_tls_get_creds( s, QCRYPTO_TLS_CREDS_ENDPOINT_CLIENT, errp); if (!creds) { return; } if (s->parameters.tls_hostname) { hostname = s->parameters.tls_hostname; } if (!hostname) { error_setg(errp, "No hostname available for TLS"); return; } tioc = qio_channel_tls_new_client( ioc, creds, hostname, errp); if (!tioc) { return; } trace_migration_tls_outgoing_handshake_start(hostname); qio_channel_set_name(QIO_CHANNEL(tioc), "migration-tls-outgoing"); qio_channel_tls_handshake(tioc, migration_tls_outgoing_handshake, s, NULL); }
false
qemu
4af245dc3e6e5c96405b3edb9d75657504256469
void migration_tls_channel_connect(MigrationState *s, QIOChannel *ioc, const char *hostname, Error **errp) { QCryptoTLSCreds *creds; QIOChannelTLS *tioc; creds = migration_tls_get_creds( s, QCRYPTO_TLS_CREDS_ENDPOINT_CLIENT, errp); if (!creds) { return; } if (s->parameters.tls_hostname) { hostname = s->parameters.tls_hostname; } if (!hostname) { error_setg(errp, "No hostname available for TLS"); return; } tioc = qio_channel_tls_new_client( ioc, creds, hostname, errp); if (!tioc) { return; } trace_migration_tls_outgoing_handshake_start(hostname); qio_channel_set_name(QIO_CHANNEL(tioc), "migration-tls-outgoing"); qio_channel_tls_handshake(tioc, migration_tls_outgoing_handshake, s, NULL); }
{ "code": [], "line_no": [] }
void FUNC_0(MigrationState *VAR_0, QIOChannel *VAR_1, const char *VAR_2, Error **VAR_3) { QCryptoTLSCreds *creds; QIOChannelTLS *tioc; creds = migration_tls_get_creds( VAR_0, QCRYPTO_TLS_CREDS_ENDPOINT_CLIENT, VAR_3); if (!creds) { return; } if (VAR_0->parameters.tls_hostname) { VAR_2 = VAR_0->parameters.tls_hostname; } if (!VAR_2) { error_setg(VAR_3, "No VAR_2 available for TLS"); return; } tioc = qio_channel_tls_new_client( VAR_1, creds, VAR_2, VAR_3); if (!tioc) { return; } trace_migration_tls_outgoing_handshake_start(VAR_2); qio_channel_set_name(QIO_CHANNEL(tioc), "migration-tls-outgoing"); qio_channel_tls_handshake(tioc, migration_tls_outgoing_handshake, VAR_0, NULL); }
[ "void FUNC_0(MigrationState *VAR_0,\nQIOChannel *VAR_1,\nconst char *VAR_2,\nError **VAR_3)\n{", "QCryptoTLSCreds *creds;", "QIOChannelTLS *tioc;", "creds = migration_tls_get_creds(\nVAR_0, QCRYPTO_TLS_CREDS_ENDPOINT_CLIENT, VAR_3);", "if (!creds) {", "return;", "}", "if (VAR_0->parameters.tls_hostname) {", "VAR_2 = VAR_0->parameters.tls_hostname;", "}", "if (!VAR_2) {", "error_setg(VAR_3, \"No VAR_2 available for TLS\");", "return;", "}", "tioc = qio_channel_tls_new_client(\nVAR_1, creds, VAR_2, VAR_3);", "if (!tioc) {", "return;", "}", "trace_migration_tls_outgoing_handshake_start(VAR_2);", "qio_channel_set_name(QIO_CHANNEL(tioc), \"migration-tls-outgoing\");", "qio_channel_tls_handshake(tioc,\nmigration_tls_outgoing_handshake,\nVAR_0,\nNULL);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 17, 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45, 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61, 63, 65, 67 ], [ 69 ] ]
5,462
void bdrv_add_before_write_notifier(BlockDriverState *bs, NotifierWithReturn *notifier) { notifier_with_return_list_add(&bs->before_write_notifiers, notifier); }
false
qemu
61007b316cd71ee7333ff7a0a749a8949527575f
void bdrv_add_before_write_notifier(BlockDriverState *bs, NotifierWithReturn *notifier) { notifier_with_return_list_add(&bs->before_write_notifiers, notifier); }
{ "code": [], "line_no": [] }
void FUNC_0(BlockDriverState *VAR_0, NotifierWithReturn *VAR_1) { notifier_with_return_list_add(&VAR_0->before_write_notifiers, VAR_1); }
[ "void FUNC_0(BlockDriverState *VAR_0,\nNotifierWithReturn *VAR_1)\n{", "notifier_with_return_list_add(&VAR_0->before_write_notifiers, VAR_1);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ] ]
5,463
static int qemu_savevm_state(Monitor *mon, QEMUFile *f) { int ret; if (qemu_savevm_state_blocked(mon)) { ret = -EINVAL; goto out; } ret = qemu_savevm_state_begin(f, 0, 0); if (ret < 0) goto out; do { ret = qemu_savevm_state_iterate(f); if (ret < 0) goto out; } while (ret == 0); ret = qemu_savevm_state_complete(f); out: if (ret == 0) { ret = qemu_file_get_error(f); } return ret; }
false
qemu
e1c37d0e94048502f9874e6356ce7136d4b05bdb
static int qemu_savevm_state(Monitor *mon, QEMUFile *f) { int ret; if (qemu_savevm_state_blocked(mon)) { ret = -EINVAL; goto out; } ret = qemu_savevm_state_begin(f, 0, 0); if (ret < 0) goto out; do { ret = qemu_savevm_state_iterate(f); if (ret < 0) goto out; } while (ret == 0); ret = qemu_savevm_state_complete(f); out: if (ret == 0) { ret = qemu_file_get_error(f); } return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(Monitor *VAR_0, QEMUFile *VAR_1) { int VAR_2; if (qemu_savevm_state_blocked(VAR_0)) { VAR_2 = -EINVAL; goto out; } VAR_2 = qemu_savevm_state_begin(VAR_1, 0, 0); if (VAR_2 < 0) goto out; do { VAR_2 = qemu_savevm_state_iterate(VAR_1); if (VAR_2 < 0) goto out; } while (VAR_2 == 0); VAR_2 = qemu_savevm_state_complete(VAR_1); out: if (VAR_2 == 0) { VAR_2 = qemu_file_get_error(VAR_1); } return VAR_2; }
[ "static int FUNC_0(Monitor *VAR_0, QEMUFile *VAR_1)\n{", "int VAR_2;", "if (qemu_savevm_state_blocked(VAR_0)) {", "VAR_2 = -EINVAL;", "goto out;", "}", "VAR_2 = qemu_savevm_state_begin(VAR_1, 0, 0);", "if (VAR_2 < 0)\ngoto out;", "do {", "VAR_2 = qemu_savevm_state_iterate(VAR_1);", "if (VAR_2 < 0)\ngoto out;", "} while (VAR_2 == 0);", "VAR_2 = qemu_savevm_state_complete(VAR_1);", "out:\nif (VAR_2 == 0) {", "VAR_2 = qemu_file_get_error(VAR_1);", "}", "return VAR_2;", "}" ]
[ 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, 23 ], [ 27 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 39 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ] ]
5,465
static void s390_virtio_net_realize(VirtIOS390Device *s390_dev, Error **errp) { DeviceState *qdev = DEVICE(s390_dev); VirtIONetS390 *dev = VIRTIO_NET_S390(s390_dev); DeviceState *vdev = DEVICE(&dev->vdev); Error *err = NULL; virtio_net_set_config_size(&dev->vdev, s390_dev->host_features); virtio_net_set_netclient_name(&dev->vdev, qdev->id, object_get_typename(OBJECT(qdev))); qdev_set_parent_bus(vdev, BUS(&s390_dev->bus)); object_property_set_bool(OBJECT(vdev), true, "realized", &err); if (err) { error_propagate(errp, err); return; } s390_virtio_device_init(s390_dev, VIRTIO_DEVICE(vdev)); }
false
qemu
da3e8a23492dbc13c4b70d90b6ae42970624e63a
static void s390_virtio_net_realize(VirtIOS390Device *s390_dev, Error **errp) { DeviceState *qdev = DEVICE(s390_dev); VirtIONetS390 *dev = VIRTIO_NET_S390(s390_dev); DeviceState *vdev = DEVICE(&dev->vdev); Error *err = NULL; virtio_net_set_config_size(&dev->vdev, s390_dev->host_features); virtio_net_set_netclient_name(&dev->vdev, qdev->id, object_get_typename(OBJECT(qdev))); qdev_set_parent_bus(vdev, BUS(&s390_dev->bus)); object_property_set_bool(OBJECT(vdev), true, "realized", &err); if (err) { error_propagate(errp, err); return; } s390_virtio_device_init(s390_dev, VIRTIO_DEVICE(vdev)); }
{ "code": [], "line_no": [] }
static void FUNC_0(VirtIOS390Device *VAR_0, Error **VAR_1) { DeviceState *qdev = DEVICE(VAR_0); VirtIONetS390 *dev = VIRTIO_NET_S390(VAR_0); DeviceState *vdev = DEVICE(&dev->vdev); Error *err = NULL; virtio_net_set_config_size(&dev->vdev, VAR_0->host_features); virtio_net_set_netclient_name(&dev->vdev, qdev->id, object_get_typename(OBJECT(qdev))); qdev_set_parent_bus(vdev, BUS(&VAR_0->bus)); object_property_set_bool(OBJECT(vdev), true, "realized", &err); if (err) { error_propagate(VAR_1, err); return; } s390_virtio_device_init(VAR_0, VIRTIO_DEVICE(vdev)); }
[ "static void FUNC_0(VirtIOS390Device *VAR_0, Error **VAR_1)\n{", "DeviceState *qdev = DEVICE(VAR_0);", "VirtIONetS390 *dev = VIRTIO_NET_S390(VAR_0);", "DeviceState *vdev = DEVICE(&dev->vdev);", "Error *err = NULL;", "virtio_net_set_config_size(&dev->vdev, VAR_0->host_features);", "virtio_net_set_netclient_name(&dev->vdev, qdev->id,\nobject_get_typename(OBJECT(qdev)));", "qdev_set_parent_bus(vdev, BUS(&VAR_0->bus));", "object_property_set_bool(OBJECT(vdev), true, \"realized\", &err);", "if (err) {", "error_propagate(VAR_1, err);", "return;", "}", "s390_virtio_device_init(VAR_0, VIRTIO_DEVICE(vdev));", "}" ]
[ 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 ], [ 35 ], [ 37 ] ]
5,466
static void nvdimm_build_ssdt(GSList *device_list, GArray *table_offsets, GArray *table_data, BIOSLinker *linker, GArray *dsm_dma_arrea) { Aml *ssdt, *sb_scope, *dev; int mem_addr_offset, nvdimm_ssdt; acpi_add_table(table_offsets, table_data); ssdt = init_aml_allocator(); acpi_data_push(ssdt->buf, sizeof(AcpiTableHeader)); sb_scope = aml_scope("\\_SB"); dev = aml_device("NVDR"); /* * ACPI 6.0: 9.20 NVDIMM Devices: * * The ACPI Name Space device uses _HID of ACPI0012 to identify the root * NVDIMM interface device. Platform firmware is required to contain one * such device in _SB scope if NVDIMMs support is exposed by platform to * OSPM. * For each NVDIMM present or intended to be supported by platform, * platform firmware also exposes an ACPI Namespace Device under the * root device. */ aml_append(dev, aml_name_decl("_HID", aml_string("ACPI0012"))); nvdimm_build_common_dsm(dev); /* 0 is reserved for root device. */ nvdimm_build_device_dsm(dev, 0); nvdimm_build_nvdimm_devices(device_list, dev); aml_append(sb_scope, dev); aml_append(ssdt, sb_scope); nvdimm_ssdt = table_data->len; /* copy AML table into ACPI tables blob and patch header there */ g_array_append_vals(table_data, ssdt->buf->data, ssdt->buf->len); mem_addr_offset = build_append_named_dword(table_data, NVDIMM_ACPI_MEM_ADDR); bios_linker_loader_alloc(linker, NVDIMM_DSM_MEM_FILE, dsm_dma_arrea, sizeof(NvdimmDsmIn), false /* high memory */); bios_linker_loader_add_pointer(linker, ACPI_BUILD_TABLE_FILE, mem_addr_offset, sizeof(uint32_t), NVDIMM_DSM_MEM_FILE, 0); build_header(linker, table_data, (void *)(table_data->data + nvdimm_ssdt), "SSDT", table_data->len - nvdimm_ssdt, 1, NULL, "NVDIMM"); free_aml_allocator(); }
false
qemu
bdfd065b1f75cacca21af0b8d4811c64cc48d04c
static void nvdimm_build_ssdt(GSList *device_list, GArray *table_offsets, GArray *table_data, BIOSLinker *linker, GArray *dsm_dma_arrea) { Aml *ssdt, *sb_scope, *dev; int mem_addr_offset, nvdimm_ssdt; acpi_add_table(table_offsets, table_data); ssdt = init_aml_allocator(); acpi_data_push(ssdt->buf, sizeof(AcpiTableHeader)); sb_scope = aml_scope("\\_SB"); dev = aml_device("NVDR"); aml_append(dev, aml_name_decl("_HID", aml_string("ACPI0012"))); nvdimm_build_common_dsm(dev); nvdimm_build_device_dsm(dev, 0); nvdimm_build_nvdimm_devices(device_list, dev); aml_append(sb_scope, dev); aml_append(ssdt, sb_scope); nvdimm_ssdt = table_data->len; g_array_append_vals(table_data, ssdt->buf->data, ssdt->buf->len); mem_addr_offset = build_append_named_dword(table_data, NVDIMM_ACPI_MEM_ADDR); bios_linker_loader_alloc(linker, NVDIMM_DSM_MEM_FILE, dsm_dma_arrea, sizeof(NvdimmDsmIn), false ); bios_linker_loader_add_pointer(linker, ACPI_BUILD_TABLE_FILE, mem_addr_offset, sizeof(uint32_t), NVDIMM_DSM_MEM_FILE, 0); build_header(linker, table_data, (void *)(table_data->data + nvdimm_ssdt), "SSDT", table_data->len - nvdimm_ssdt, 1, NULL, "NVDIMM"); free_aml_allocator(); }
{ "code": [], "line_no": [] }
static void FUNC_0(GSList *VAR_0, GArray *VAR_1, GArray *VAR_2, BIOSLinker *VAR_3, GArray *VAR_4) { Aml *ssdt, *sb_scope, *dev; int VAR_5, VAR_6; acpi_add_table(VAR_1, VAR_2); ssdt = init_aml_allocator(); acpi_data_push(ssdt->buf, sizeof(AcpiTableHeader)); sb_scope = aml_scope("\\_SB"); dev = aml_device("NVDR"); aml_append(dev, aml_name_decl("_HID", aml_string("ACPI0012"))); nvdimm_build_common_dsm(dev); nvdimm_build_device_dsm(dev, 0); nvdimm_build_nvdimm_devices(VAR_0, dev); aml_append(sb_scope, dev); aml_append(ssdt, sb_scope); VAR_6 = VAR_2->len; g_array_append_vals(VAR_2, ssdt->buf->data, ssdt->buf->len); VAR_5 = build_append_named_dword(VAR_2, NVDIMM_ACPI_MEM_ADDR); bios_linker_loader_alloc(VAR_3, NVDIMM_DSM_MEM_FILE, VAR_4, sizeof(NvdimmDsmIn), false ); bios_linker_loader_add_pointer(VAR_3, ACPI_BUILD_TABLE_FILE, VAR_5, sizeof(uint32_t), NVDIMM_DSM_MEM_FILE, 0); build_header(VAR_3, VAR_2, (void *)(VAR_2->data + VAR_6), "SSDT", VAR_2->len - VAR_6, 1, NULL, "NVDIMM"); free_aml_allocator(); }
[ "static void FUNC_0(GSList *VAR_0, GArray *VAR_1,\nGArray *VAR_2, BIOSLinker *VAR_3,\nGArray *VAR_4)\n{", "Aml *ssdt, *sb_scope, *dev;", "int VAR_5, VAR_6;", "acpi_add_table(VAR_1, VAR_2);", "ssdt = init_aml_allocator();", "acpi_data_push(ssdt->buf, sizeof(AcpiTableHeader));", "sb_scope = aml_scope(\"\\\\_SB\");", "dev = aml_device(\"NVDR\");", "aml_append(dev, aml_name_decl(\"_HID\", aml_string(\"ACPI0012\")));", "nvdimm_build_common_dsm(dev);", "nvdimm_build_device_dsm(dev, 0);", "nvdimm_build_nvdimm_devices(VAR_0, dev);", "aml_append(sb_scope, dev);", "aml_append(ssdt, sb_scope);", "VAR_6 = VAR_2->len;", "g_array_append_vals(VAR_2, ssdt->buf->data, ssdt->buf->len);", "VAR_5 = build_append_named_dword(VAR_2,\nNVDIMM_ACPI_MEM_ADDR);", "bios_linker_loader_alloc(VAR_3,\nNVDIMM_DSM_MEM_FILE, VAR_4,\nsizeof(NvdimmDsmIn), false );", "bios_linker_loader_add_pointer(VAR_3,\nACPI_BUILD_TABLE_FILE, VAR_5, sizeof(uint32_t),\nNVDIMM_DSM_MEM_FILE, 0);", "build_header(VAR_3, VAR_2,\n(void *)(VAR_2->data + VAR_6),\n\"SSDT\", VAR_2->len - VAR_6, 1, NULL, \"NVDIMM\");", "free_aml_allocator();", "}" ]
[ 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 ], [ 25 ], [ 29 ], [ 55 ], [ 59 ], [ 65 ], [ 69 ], [ 73 ], [ 75 ], [ 79 ], [ 85 ], [ 87, 89 ], [ 93, 95, 97 ], [ 99, 101, 103 ], [ 105, 107, 109 ], [ 111 ], [ 113 ] ]
5,468
static av_cold int eightsvx_decode_init(AVCodecContext *avctx) { EightSvxContext *esc = avctx->priv_data; if (avctx->channels < 1 || avctx->channels > 2) { av_log(avctx, AV_LOG_ERROR, "8SVX does not support more than 2 channels\n"); return AVERROR_INVALIDDATA; } switch (avctx->codec->id) { case AV_CODEC_ID_8SVX_FIB: esc->table = fibonacci; break; case AV_CODEC_ID_8SVX_EXP: esc->table = exponential; break; case AV_CODEC_ID_PCM_S8_PLANAR: case AV_CODEC_ID_8SVX_RAW: esc->table = NULL; break; default: av_log(avctx, AV_LOG_ERROR, "Invalid codec id %d.\n", avctx->codec->id); return AVERROR_INVALIDDATA; } avctx->sample_fmt = AV_SAMPLE_FMT_U8P; avcodec_get_frame_defaults(&esc->frame); avctx->coded_frame = &esc->frame; return 0; }
false
FFmpeg
da8242e2d6f85d95239082efd0e5e2345e685a2c
static av_cold int eightsvx_decode_init(AVCodecContext *avctx) { EightSvxContext *esc = avctx->priv_data; if (avctx->channels < 1 || avctx->channels > 2) { av_log(avctx, AV_LOG_ERROR, "8SVX does not support more than 2 channels\n"); return AVERROR_INVALIDDATA; } switch (avctx->codec->id) { case AV_CODEC_ID_8SVX_FIB: esc->table = fibonacci; break; case AV_CODEC_ID_8SVX_EXP: esc->table = exponential; break; case AV_CODEC_ID_PCM_S8_PLANAR: case AV_CODEC_ID_8SVX_RAW: esc->table = NULL; break; default: av_log(avctx, AV_LOG_ERROR, "Invalid codec id %d.\n", avctx->codec->id); return AVERROR_INVALIDDATA; } avctx->sample_fmt = AV_SAMPLE_FMT_U8P; avcodec_get_frame_defaults(&esc->frame); avctx->coded_frame = &esc->frame; return 0; }
{ "code": [], "line_no": [] }
static av_cold int FUNC_0(AVCodecContext *avctx) { EightSvxContext *esc = avctx->priv_data; if (avctx->channels < 1 || avctx->channels > 2) { av_log(avctx, AV_LOG_ERROR, "8SVX does not support more than 2 channels\n"); return AVERROR_INVALIDDATA; } switch (avctx->codec->id) { case AV_CODEC_ID_8SVX_FIB: esc->table = fibonacci; break; case AV_CODEC_ID_8SVX_EXP: esc->table = exponential; break; case AV_CODEC_ID_PCM_S8_PLANAR: case AV_CODEC_ID_8SVX_RAW: esc->table = NULL; break; default: av_log(avctx, AV_LOG_ERROR, "Invalid codec id %d.\n", avctx->codec->id); return AVERROR_INVALIDDATA; } avctx->sample_fmt = AV_SAMPLE_FMT_U8P; avcodec_get_frame_defaults(&esc->frame); avctx->coded_frame = &esc->frame; return 0; }
[ "static av_cold int FUNC_0(AVCodecContext *avctx)\n{", "EightSvxContext *esc = avctx->priv_data;", "if (avctx->channels < 1 || avctx->channels > 2) {", "av_log(avctx, AV_LOG_ERROR, \"8SVX does not support more than 2 channels\\n\");", "return AVERROR_INVALIDDATA;", "}", "switch (avctx->codec->id) {", "case AV_CODEC_ID_8SVX_FIB: esc->table = fibonacci; break;", "case AV_CODEC_ID_8SVX_EXP: esc->table = exponential; break;", "case AV_CODEC_ID_PCM_S8_PLANAR:\ncase AV_CODEC_ID_8SVX_RAW: esc->table = NULL; break;", "default:\nav_log(avctx, AV_LOG_ERROR, \"Invalid codec id %d.\\n\", avctx->codec->id);", "return AVERROR_INVALIDDATA;", "}", "avctx->sample_fmt = AV_SAMPLE_FMT_U8P;", "avcodec_get_frame_defaults(&esc->frame);", "avctx->coded_frame = &esc->frame;", "return 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 ], [ 23 ], [ 25, 27 ], [ 29, 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ] ]
5,469
static av_cold int opus_encode_init(AVCodecContext *avctx) { int i, ch, ret; OpusEncContext *s = avctx->priv_data; s->avctx = avctx; s->channels = avctx->channels; /* Opus allows us to change the framesize on each packet (and each packet may * have multiple frames in it) but we can't change the codec's frame size on * runtime, so fix it to the lowest possible number of samples and use a queue * to accumulate AVFrames until we have enough to encode whatever the encoder * decides is the best */ avctx->frame_size = 120; /* Initial padding will change if SILK is ever supported */ avctx->initial_padding = 120; avctx->cutoff = !avctx->cutoff ? 20000 : avctx->cutoff; if (!avctx->bit_rate) { int coupled = ff_opus_default_coupled_streams[s->channels - 1]; avctx->bit_rate = coupled*(96000) + (s->channels - coupled*2)*(48000); } else if (avctx->bit_rate < 6000 || avctx->bit_rate > 255000 * s->channels) { int64_t clipped_rate = av_clip(avctx->bit_rate, 6000, 255000 * s->channels); av_log(avctx, AV_LOG_ERROR, "Unsupported bitrate %"PRId64" kbps, clipping to %"PRId64" kbps\n", avctx->bit_rate/1000, clipped_rate/1000); avctx->bit_rate = clipped_rate; } /* Frame structs and range coder buffers */ s->frame = av_malloc(OPUS_MAX_FRAMES_PER_PACKET*sizeof(CeltFrame)); if (!s->frame) return AVERROR(ENOMEM); s->rc = av_malloc(OPUS_MAX_FRAMES_PER_PACKET*sizeof(OpusRangeCoder)); if (!s->rc) return AVERROR(ENOMEM); /* Extradata */ avctx->extradata_size = 19; avctx->extradata = av_malloc(avctx->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE); if (!avctx->extradata) return AVERROR(ENOMEM); opus_write_extradata(avctx); ff_af_queue_init(avctx, &s->afq); if (!(s->dsp = avpriv_float_dsp_alloc(avctx->flags & AV_CODEC_FLAG_BITEXACT))) return AVERROR(ENOMEM); /* I have no idea why a base scaling factor of 68 works, could be the twiddles */ for (i = 0; i < CELT_BLOCK_NB; i++) if ((ret = ff_mdct15_init(&s->mdct[i], 0, i + 3, 68 << (CELT_BLOCK_NB - 1 - i)))) return AVERROR(ENOMEM); for (i = 0; i < OPUS_MAX_FRAMES_PER_PACKET; i++) s->frame[i].block[0].emph_coeff = s->frame[i].block[1].emph_coeff = 0.0f; /* Zero out previous energy (matters for inter first frame) */ for (ch = 0; ch < s->channels; ch++) for (i = 0; i < CELT_MAX_BANDS; i++) s->last_quantized_energy[ch][i] = 0.0f; /* Allocate an empty frame to use as overlap for the first frame of audio */ ff_bufqueue_add(avctx, &s->bufqueue, spawn_empty_frame(s)); if (!ff_bufqueue_peek(&s->bufqueue, 0)) return AVERROR(ENOMEM); return 0; }
false
FFmpeg
e6ec482b429b241de0fb3088d87e28777d70ded5
static av_cold int opus_encode_init(AVCodecContext *avctx) { int i, ch, ret; OpusEncContext *s = avctx->priv_data; s->avctx = avctx; s->channels = avctx->channels; avctx->frame_size = 120; avctx->initial_padding = 120; avctx->cutoff = !avctx->cutoff ? 20000 : avctx->cutoff; if (!avctx->bit_rate) { int coupled = ff_opus_default_coupled_streams[s->channels - 1]; avctx->bit_rate = coupled*(96000) + (s->channels - coupled*2)*(48000); } else if (avctx->bit_rate < 6000 || avctx->bit_rate > 255000 * s->channels) { int64_t clipped_rate = av_clip(avctx->bit_rate, 6000, 255000 * s->channels); av_log(avctx, AV_LOG_ERROR, "Unsupported bitrate %"PRId64" kbps, clipping to %"PRId64" kbps\n", avctx->bit_rate/1000, clipped_rate/1000); avctx->bit_rate = clipped_rate; } s->frame = av_malloc(OPUS_MAX_FRAMES_PER_PACKET*sizeof(CeltFrame)); if (!s->frame) return AVERROR(ENOMEM); s->rc = av_malloc(OPUS_MAX_FRAMES_PER_PACKET*sizeof(OpusRangeCoder)); if (!s->rc) return AVERROR(ENOMEM); avctx->extradata_size = 19; avctx->extradata = av_malloc(avctx->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE); if (!avctx->extradata) return AVERROR(ENOMEM); opus_write_extradata(avctx); ff_af_queue_init(avctx, &s->afq); if (!(s->dsp = avpriv_float_dsp_alloc(avctx->flags & AV_CODEC_FLAG_BITEXACT))) return AVERROR(ENOMEM); for (i = 0; i < CELT_BLOCK_NB; i++) if ((ret = ff_mdct15_init(&s->mdct[i], 0, i + 3, 68 << (CELT_BLOCK_NB - 1 - i)))) return AVERROR(ENOMEM); for (i = 0; i < OPUS_MAX_FRAMES_PER_PACKET; i++) s->frame[i].block[0].emph_coeff = s->frame[i].block[1].emph_coeff = 0.0f; for (ch = 0; ch < s->channels; ch++) for (i = 0; i < CELT_MAX_BANDS; i++) s->last_quantized_energy[ch][i] = 0.0f; ff_bufqueue_add(avctx, &s->bufqueue, spawn_empty_frame(s)); if (!ff_bufqueue_peek(&s->bufqueue, 0)) return AVERROR(ENOMEM); return 0; }
{ "code": [], "line_no": [] }
static av_cold int FUNC_0(AVCodecContext *avctx) { int VAR_0, VAR_1, VAR_2; OpusEncContext *s = avctx->priv_data; s->avctx = avctx; s->channels = avctx->channels; avctx->frame_size = 120; avctx->initial_padding = 120; avctx->cutoff = !avctx->cutoff ? 20000 : avctx->cutoff; if (!avctx->bit_rate) { int VAR_3 = ff_opus_default_coupled_streams[s->channels - 1]; avctx->bit_rate = VAR_3*(96000) + (s->channels - VAR_3*2)*(48000); } else if (avctx->bit_rate < 6000 || avctx->bit_rate > 255000 * s->channels) { int64_t clipped_rate = av_clip(avctx->bit_rate, 6000, 255000 * s->channels); av_log(avctx, AV_LOG_ERROR, "Unsupported bitrate %"PRId64" kbps, clipping to %"PRId64" kbps\n", avctx->bit_rate/1000, clipped_rate/1000); avctx->bit_rate = clipped_rate; } s->frame = av_malloc(OPUS_MAX_FRAMES_PER_PACKET*sizeof(CeltFrame)); if (!s->frame) return AVERROR(ENOMEM); s->rc = av_malloc(OPUS_MAX_FRAMES_PER_PACKET*sizeof(OpusRangeCoder)); if (!s->rc) return AVERROR(ENOMEM); avctx->extradata_size = 19; avctx->extradata = av_malloc(avctx->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE); if (!avctx->extradata) return AVERROR(ENOMEM); opus_write_extradata(avctx); ff_af_queue_init(avctx, &s->afq); if (!(s->dsp = avpriv_float_dsp_alloc(avctx->flags & AV_CODEC_FLAG_BITEXACT))) return AVERROR(ENOMEM); for (VAR_0 = 0; VAR_0 < CELT_BLOCK_NB; VAR_0++) if ((VAR_2 = ff_mdct15_init(&s->mdct[VAR_0], 0, VAR_0 + 3, 68 << (CELT_BLOCK_NB - 1 - VAR_0)))) return AVERROR(ENOMEM); for (VAR_0 = 0; VAR_0 < OPUS_MAX_FRAMES_PER_PACKET; VAR_0++) s->frame[VAR_0].block[0].emph_coeff = s->frame[VAR_0].block[1].emph_coeff = 0.0f; for (VAR_1 = 0; VAR_1 < s->channels; VAR_1++) for (VAR_0 = 0; VAR_0 < CELT_MAX_BANDS; VAR_0++) s->last_quantized_energy[VAR_1][VAR_0] = 0.0f; ff_bufqueue_add(avctx, &s->bufqueue, spawn_empty_frame(s)); if (!ff_bufqueue_peek(&s->bufqueue, 0)) return AVERROR(ENOMEM); return 0; }
[ "static av_cold int FUNC_0(AVCodecContext *avctx)\n{", "int VAR_0, VAR_1, VAR_2;", "OpusEncContext *s = avctx->priv_data;", "s->avctx = avctx;", "s->channels = avctx->channels;", "avctx->frame_size = 120;", "avctx->initial_padding = 120;", "avctx->cutoff = !avctx->cutoff ? 20000 : avctx->cutoff;", "if (!avctx->bit_rate) {", "int VAR_3 = ff_opus_default_coupled_streams[s->channels - 1];", "avctx->bit_rate = VAR_3*(96000) + (s->channels - VAR_3*2)*(48000);", "} else if (avctx->bit_rate < 6000 || avctx->bit_rate > 255000 * s->channels) {", "int64_t clipped_rate = av_clip(avctx->bit_rate, 6000, 255000 * s->channels);", "av_log(avctx, AV_LOG_ERROR, \"Unsupported bitrate %\"PRId64\" kbps, clipping to %\"PRId64\" kbps\\n\",\navctx->bit_rate/1000, clipped_rate/1000);", "avctx->bit_rate = clipped_rate;", "}", "s->frame = av_malloc(OPUS_MAX_FRAMES_PER_PACKET*sizeof(CeltFrame));", "if (!s->frame)\nreturn AVERROR(ENOMEM);", "s->rc = av_malloc(OPUS_MAX_FRAMES_PER_PACKET*sizeof(OpusRangeCoder));", "if (!s->rc)\nreturn AVERROR(ENOMEM);", "avctx->extradata_size = 19;", "avctx->extradata = av_malloc(avctx->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);", "if (!avctx->extradata)\nreturn AVERROR(ENOMEM);", "opus_write_extradata(avctx);", "ff_af_queue_init(avctx, &s->afq);", "if (!(s->dsp = avpriv_float_dsp_alloc(avctx->flags & AV_CODEC_FLAG_BITEXACT)))\nreturn AVERROR(ENOMEM);", "for (VAR_0 = 0; VAR_0 < CELT_BLOCK_NB; VAR_0++)", "if ((VAR_2 = ff_mdct15_init(&s->mdct[VAR_0], 0, VAR_0 + 3, 68 << (CELT_BLOCK_NB - 1 - VAR_0))))\nreturn AVERROR(ENOMEM);", "for (VAR_0 = 0; VAR_0 < OPUS_MAX_FRAMES_PER_PACKET; VAR_0++)", "s->frame[VAR_0].block[0].emph_coeff = s->frame[VAR_0].block[1].emph_coeff = 0.0f;", "for (VAR_1 = 0; VAR_1 < s->channels; VAR_1++)", "for (VAR_0 = 0; VAR_0 < CELT_MAX_BANDS; VAR_0++)", "s->last_quantized_energy[VAR_1][VAR_0] = 0.0f;", "ff_bufqueue_add(avctx, &s->bufqueue, spawn_empty_frame(s));", "if (!ff_bufqueue_peek(&s->bufqueue, 0))\nreturn AVERROR(ENOMEM);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 27 ], [ 31 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49, 51 ], [ 53 ], [ 55 ], [ 61 ], [ 63, 65 ], [ 67 ], [ 69, 71 ], [ 77 ], [ 79 ], [ 81, 83 ], [ 85 ], [ 89 ], [ 93, 95 ], [ 101 ], [ 103, 105 ], [ 109 ], [ 111 ], [ 117 ], [ 119 ], [ 121 ], [ 127 ], [ 129, 131 ], [ 135 ], [ 137 ] ]
5,471
static void scsi_destroy(SCSIDevice *s) { scsi_device_purge_requests(s, SENSE_CODE(NO_SENSE)); blockdev_mark_auto_del(s->conf.bs); }
false
qemu
a818a4b69d47ca3826dee36878074395aeac2083
static void scsi_destroy(SCSIDevice *s) { scsi_device_purge_requests(s, SENSE_CODE(NO_SENSE)); blockdev_mark_auto_del(s->conf.bs); }
{ "code": [], "line_no": [] }
static void FUNC_0(SCSIDevice *VAR_0) { scsi_device_purge_requests(VAR_0, SENSE_CODE(NO_SENSE)); blockdev_mark_auto_del(VAR_0->conf.bs); }
[ "static void FUNC_0(SCSIDevice *VAR_0)\n{", "scsi_device_purge_requests(VAR_0, SENSE_CODE(NO_SENSE));", "blockdev_mark_auto_del(VAR_0->conf.bs);", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
5,472
static void init_event_facility_class(ObjectClass *klass, void *data) { SysBusDeviceClass *sbdc = SYS_BUS_DEVICE_CLASS(klass); DeviceClass *dc = DEVICE_CLASS(sbdc); SCLPEventFacilityClass *k = EVENT_FACILITY_CLASS(dc); dc->reset = reset_event_facility; dc->vmsd = &vmstate_event_facility; set_bit(DEVICE_CATEGORY_MISC, dc->categories); k->init = init_event_facility; k->command_handler = command_handler; k->event_pending = event_pending; }
false
qemu
f6102c329c43d7d5e0bee1fc2fe4043e05f9810c
static void init_event_facility_class(ObjectClass *klass, void *data) { SysBusDeviceClass *sbdc = SYS_BUS_DEVICE_CLASS(klass); DeviceClass *dc = DEVICE_CLASS(sbdc); SCLPEventFacilityClass *k = EVENT_FACILITY_CLASS(dc); dc->reset = reset_event_facility; dc->vmsd = &vmstate_event_facility; set_bit(DEVICE_CATEGORY_MISC, dc->categories); k->init = init_event_facility; k->command_handler = command_handler; k->event_pending = event_pending; }
{ "code": [], "line_no": [] }
static void FUNC_0(ObjectClass *VAR_0, void *VAR_1) { SysBusDeviceClass *sbdc = SYS_BUS_DEVICE_CLASS(VAR_0); DeviceClass *dc = DEVICE_CLASS(sbdc); SCLPEventFacilityClass *k = EVENT_FACILITY_CLASS(dc); dc->reset = reset_event_facility; dc->vmsd = &vmstate_event_facility; set_bit(DEVICE_CATEGORY_MISC, dc->categories); k->init = init_event_facility; k->command_handler = command_handler; k->event_pending = event_pending; }
[ "static void FUNC_0(ObjectClass *VAR_0, void *VAR_1)\n{", "SysBusDeviceClass *sbdc = SYS_BUS_DEVICE_CLASS(VAR_0);", "DeviceClass *dc = DEVICE_CLASS(sbdc);", "SCLPEventFacilityClass *k = EVENT_FACILITY_CLASS(dc);", "dc->reset = reset_event_facility;", "dc->vmsd = &vmstate_event_facility;", "set_bit(DEVICE_CATEGORY_MISC, dc->categories);", "k->init = init_event_facility;", "k->command_handler = command_handler;", "k->event_pending = event_pending;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ] ]
5,473
static void set_pixel_format(VncState *vs, int bits_per_pixel, int depth, int big_endian_flag, int true_color_flag, int red_max, int green_max, int blue_max, int red_shift, int green_shift, int blue_shift) { int host_big_endian_flag; #ifdef WORDS_BIGENDIAN host_big_endian_flag = 1; #else host_big_endian_flag = 0; #endif if (!true_color_flag) { fail: vnc_client_error(vs); return; } if (bits_per_pixel == 32 && host_big_endian_flag == big_endian_flag && red_max == 0xff && green_max == 0xff && blue_max == 0xff && red_shift == 16 && green_shift == 8 && blue_shift == 0) { vs->depth = 4; vs->write_pixels = vnc_write_pixels_copy; vs->send_hextile_tile = send_hextile_tile_32; } else if (bits_per_pixel == 16 && host_big_endian_flag == big_endian_flag && red_max == 31 && green_max == 63 && blue_max == 31 && red_shift == 11 && green_shift == 5 && blue_shift == 0) { vs->depth = 2; vs->write_pixels = vnc_write_pixels_copy; vs->send_hextile_tile = send_hextile_tile_16; } else if (bits_per_pixel == 8 && red_max == 7 && green_max == 7 && blue_max == 3 && red_shift == 5 && green_shift == 2 && blue_shift == 0) { vs->depth = 1; vs->write_pixels = vnc_write_pixels_copy; vs->send_hextile_tile = send_hextile_tile_8; } else { /* generic and slower case */ if (bits_per_pixel != 8 && bits_per_pixel != 16 && bits_per_pixel != 32) goto fail; vs->depth = 4; vs->red_shift = red_shift; vs->red_max = red_max; vs->red_shift1 = 24 - compute_nbits(red_max); vs->green_shift = green_shift; vs->green_max = green_max; vs->green_shift1 = 16 - compute_nbits(green_max); vs->blue_shift = blue_shift; vs->blue_max = blue_max; vs->blue_shift1 = 8 - compute_nbits(blue_max); vs->pix_bpp = bits_per_pixel / 8; vs->pix_big_endian = big_endian_flag; vs->write_pixels = vnc_write_pixels_generic; vs->send_hextile_tile = send_hextile_tile_generic; } vnc_dpy_resize(vs->ds, vs->ds->width, vs->ds->height); memset(vs->dirty_row, 0xFF, sizeof(vs->dirty_row)); memset(vs->old_data, 42, vs->ds->linesize * vs->ds->height); vga_hw_invalidate(); vga_hw_update(); }
false
qemu
8bba5c81b1febeb20cdd60f1c18eb0e695cad6d6
static void set_pixel_format(VncState *vs, int bits_per_pixel, int depth, int big_endian_flag, int true_color_flag, int red_max, int green_max, int blue_max, int red_shift, int green_shift, int blue_shift) { int host_big_endian_flag; #ifdef WORDS_BIGENDIAN host_big_endian_flag = 1; #else host_big_endian_flag = 0; #endif if (!true_color_flag) { fail: vnc_client_error(vs); return; } if (bits_per_pixel == 32 && host_big_endian_flag == big_endian_flag && red_max == 0xff && green_max == 0xff && blue_max == 0xff && red_shift == 16 && green_shift == 8 && blue_shift == 0) { vs->depth = 4; vs->write_pixels = vnc_write_pixels_copy; vs->send_hextile_tile = send_hextile_tile_32; } else if (bits_per_pixel == 16 && host_big_endian_flag == big_endian_flag && red_max == 31 && green_max == 63 && blue_max == 31 && red_shift == 11 && green_shift == 5 && blue_shift == 0) { vs->depth = 2; vs->write_pixels = vnc_write_pixels_copy; vs->send_hextile_tile = send_hextile_tile_16; } else if (bits_per_pixel == 8 && red_max == 7 && green_max == 7 && blue_max == 3 && red_shift == 5 && green_shift == 2 && blue_shift == 0) { vs->depth = 1; vs->write_pixels = vnc_write_pixels_copy; vs->send_hextile_tile = send_hextile_tile_8; } else { if (bits_per_pixel != 8 && bits_per_pixel != 16 && bits_per_pixel != 32) goto fail; vs->depth = 4; vs->red_shift = red_shift; vs->red_max = red_max; vs->red_shift1 = 24 - compute_nbits(red_max); vs->green_shift = green_shift; vs->green_max = green_max; vs->green_shift1 = 16 - compute_nbits(green_max); vs->blue_shift = blue_shift; vs->blue_max = blue_max; vs->blue_shift1 = 8 - compute_nbits(blue_max); vs->pix_bpp = bits_per_pixel / 8; vs->pix_big_endian = big_endian_flag; vs->write_pixels = vnc_write_pixels_generic; vs->send_hextile_tile = send_hextile_tile_generic; } vnc_dpy_resize(vs->ds, vs->ds->width, vs->ds->height); memset(vs->dirty_row, 0xFF, sizeof(vs->dirty_row)); memset(vs->old_data, 42, vs->ds->linesize * vs->ds->height); vga_hw_invalidate(); vga_hw_update(); }
{ "code": [], "line_no": [] }
static void FUNC_0(VncState *VAR_0, int VAR_1, int VAR_2, int VAR_3, int VAR_4, int VAR_5, int VAR_6, int VAR_7, int VAR_8, int VAR_9, int VAR_10) { int VAR_11; #ifdef WORDS_BIGENDIAN VAR_11 = 1; #else VAR_11 = 0; #endif if (!VAR_4) { fail: vnc_client_error(VAR_0); return; } if (VAR_1 == 32 && VAR_11 == VAR_3 && VAR_5 == 0xff && VAR_6 == 0xff && VAR_7 == 0xff && VAR_8 == 16 && VAR_9 == 8 && VAR_10 == 0) { VAR_0->VAR_2 = 4; VAR_0->write_pixels = vnc_write_pixels_copy; VAR_0->send_hextile_tile = send_hextile_tile_32; } else if (VAR_1 == 16 && VAR_11 == VAR_3 && VAR_5 == 31 && VAR_6 == 63 && VAR_7 == 31 && VAR_8 == 11 && VAR_9 == 5 && VAR_10 == 0) { VAR_0->VAR_2 = 2; VAR_0->write_pixels = vnc_write_pixels_copy; VAR_0->send_hextile_tile = send_hextile_tile_16; } else if (VAR_1 == 8 && VAR_5 == 7 && VAR_6 == 7 && VAR_7 == 3 && VAR_8 == 5 && VAR_9 == 2 && VAR_10 == 0) { VAR_0->VAR_2 = 1; VAR_0->write_pixels = vnc_write_pixels_copy; VAR_0->send_hextile_tile = send_hextile_tile_8; } else { if (VAR_1 != 8 && VAR_1 != 16 && VAR_1 != 32) goto fail; VAR_0->VAR_2 = 4; VAR_0->VAR_8 = VAR_8; VAR_0->VAR_5 = VAR_5; VAR_0->red_shift1 = 24 - compute_nbits(VAR_5); VAR_0->VAR_9 = VAR_9; VAR_0->VAR_6 = VAR_6; VAR_0->green_shift1 = 16 - compute_nbits(VAR_6); VAR_0->VAR_10 = VAR_10; VAR_0->VAR_7 = VAR_7; VAR_0->blue_shift1 = 8 - compute_nbits(VAR_7); VAR_0->pix_bpp = VAR_1 / 8; VAR_0->pix_big_endian = VAR_3; VAR_0->write_pixels = vnc_write_pixels_generic; VAR_0->send_hextile_tile = send_hextile_tile_generic; } vnc_dpy_resize(VAR_0->ds, VAR_0->ds->width, VAR_0->ds->height); memset(VAR_0->dirty_row, 0xFF, sizeof(VAR_0->dirty_row)); memset(VAR_0->old_data, 42, VAR_0->ds->linesize * VAR_0->ds->height); vga_hw_invalidate(); vga_hw_update(); }
[ "static void FUNC_0(VncState *VAR_0,\nint VAR_1, int VAR_2,\nint VAR_3, int VAR_4,\nint VAR_5, int VAR_6, int VAR_7,\nint VAR_8, int VAR_9, int VAR_10)\n{", "int VAR_11;", "#ifdef WORDS_BIGENDIAN\nVAR_11 = 1;", "#else\nVAR_11 = 0;", "#endif\nif (!VAR_4) {", "fail:\nvnc_client_error(VAR_0);", "return;", "}", "if (VAR_1 == 32 &&\nVAR_11 == VAR_3 &&\nVAR_5 == 0xff && VAR_6 == 0xff && VAR_7 == 0xff &&\nVAR_8 == 16 && VAR_9 == 8 && VAR_10 == 0) {", "VAR_0->VAR_2 = 4;", "VAR_0->write_pixels = vnc_write_pixels_copy;", "VAR_0->send_hextile_tile = send_hextile_tile_32;", "} else", "if (VAR_1 == 16 &&\nVAR_11 == VAR_3 &&\nVAR_5 == 31 && VAR_6 == 63 && VAR_7 == 31 &&\nVAR_8 == 11 && VAR_9 == 5 && VAR_10 == 0) {", "VAR_0->VAR_2 = 2;", "VAR_0->write_pixels = vnc_write_pixels_copy;", "VAR_0->send_hextile_tile = send_hextile_tile_16;", "} else", "if (VAR_1 == 8 &&\nVAR_5 == 7 && VAR_6 == 7 && VAR_7 == 3 &&\nVAR_8 == 5 && VAR_9 == 2 && VAR_10 == 0) {", "VAR_0->VAR_2 = 1;", "VAR_0->write_pixels = vnc_write_pixels_copy;", "VAR_0->send_hextile_tile = send_hextile_tile_8;", "} else", "{", "if (VAR_1 != 8 &&\nVAR_1 != 16 &&\nVAR_1 != 32)\ngoto fail;", "VAR_0->VAR_2 = 4;", "VAR_0->VAR_8 = VAR_8;", "VAR_0->VAR_5 = VAR_5;", "VAR_0->red_shift1 = 24 - compute_nbits(VAR_5);", "VAR_0->VAR_9 = VAR_9;", "VAR_0->VAR_6 = VAR_6;", "VAR_0->green_shift1 = 16 - compute_nbits(VAR_6);", "VAR_0->VAR_10 = VAR_10;", "VAR_0->VAR_7 = VAR_7;", "VAR_0->blue_shift1 = 8 - compute_nbits(VAR_7);", "VAR_0->pix_bpp = VAR_1 / 8;", "VAR_0->pix_big_endian = VAR_3;", "VAR_0->write_pixels = vnc_write_pixels_generic;", "VAR_0->send_hextile_tile = send_hextile_tile_generic;", "}", "vnc_dpy_resize(VAR_0->ds, VAR_0->ds->width, VAR_0->ds->height);", "memset(VAR_0->dirty_row, 0xFF, sizeof(VAR_0->dirty_row));", "memset(VAR_0->old_data, 42, VAR_0->ds->linesize * VAR_0->ds->height);", "vga_hw_invalidate();", "vga_hw_update();", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11 ], [ 13 ], [ 17, 19 ], [ 21, 23 ], [ 25, 27 ], [ 29, 31 ], [ 33 ], [ 35 ], [ 37, 39, 41, 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53, 55, 57, 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69, 71, 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 87, 89, 91, 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 127 ], [ 129 ], [ 131 ], [ 135 ], [ 137 ], [ 139 ] ]
5,474
void do_info_vnc(Monitor *mon) { if (vnc_display == NULL || vnc_display->display == NULL) monitor_printf(mon, "VNC server disabled\n"); else { monitor_printf(mon, "VNC server active on: "); monitor_print_filename(mon, vnc_display->display); monitor_printf(mon, "\n"); if (vnc_display->clients == NULL) monitor_printf(mon, "No client connected\n"); else monitor_printf(mon, "Client connected\n"); } }
false
qemu
1ff7df1a848044f58d0f3540f1447db4bb1d2d20
void do_info_vnc(Monitor *mon) { if (vnc_display == NULL || vnc_display->display == NULL) monitor_printf(mon, "VNC server disabled\n"); else { monitor_printf(mon, "VNC server active on: "); monitor_print_filename(mon, vnc_display->display); monitor_printf(mon, "\n"); if (vnc_display->clients == NULL) monitor_printf(mon, "No client connected\n"); else monitor_printf(mon, "Client connected\n"); } }
{ "code": [], "line_no": [] }
void FUNC_0(Monitor *VAR_0) { if (vnc_display == NULL || vnc_display->display == NULL) monitor_printf(VAR_0, "VNC server disabled\n"); else { monitor_printf(VAR_0, "VNC server active on: "); monitor_print_filename(VAR_0, vnc_display->display); monitor_printf(VAR_0, "\n"); if (vnc_display->clients == NULL) monitor_printf(VAR_0, "No client connected\n"); else monitor_printf(VAR_0, "Client connected\n"); } }
[ "void FUNC_0(Monitor *VAR_0)\n{", "if (vnc_display == NULL || vnc_display->display == NULL)\nmonitor_printf(VAR_0, \"VNC server disabled\\n\");", "else {", "monitor_printf(VAR_0, \"VNC server active on: \");", "monitor_print_filename(VAR_0, vnc_display->display);", "monitor_printf(VAR_0, \"\\n\");", "if (vnc_display->clients == NULL)\nmonitor_printf(VAR_0, \"No client connected\\n\");", "else\nmonitor_printf(VAR_0, \"Client connected\\n\");", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19, 21 ], [ 23, 25 ], [ 27 ], [ 29 ] ]
5,475
void qemu_chr_generic_open(CharDriverState *s) { if (s->open_timer == NULL) { s->open_timer = qemu_new_timer_ms(rt_clock, qemu_chr_fire_open_event, s); qemu_mod_timer(s->open_timer, qemu_get_clock_ms(rt_clock) - 1); } }
false
qemu
9f939df955a4152aad69a19a77e0898631bb2c18
void qemu_chr_generic_open(CharDriverState *s) { if (s->open_timer == NULL) { s->open_timer = qemu_new_timer_ms(rt_clock, qemu_chr_fire_open_event, s); qemu_mod_timer(s->open_timer, qemu_get_clock_ms(rt_clock) - 1); } }
{ "code": [], "line_no": [] }
void FUNC_0(CharDriverState *VAR_0) { if (VAR_0->open_timer == NULL) { VAR_0->open_timer = qemu_new_timer_ms(rt_clock, qemu_chr_fire_open_event, VAR_0); qemu_mod_timer(VAR_0->open_timer, qemu_get_clock_ms(rt_clock) - 1); } }
[ "void FUNC_0(CharDriverState *VAR_0)\n{", "if (VAR_0->open_timer == NULL) {", "VAR_0->open_timer = qemu_new_timer_ms(rt_clock,\nqemu_chr_fire_open_event, VAR_0);", "qemu_mod_timer(VAR_0->open_timer, qemu_get_clock_ms(rt_clock) - 1);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 11 ], [ 13 ], [ 15 ] ]
5,476
static int pci_piix4_ide_initfn(PCIDevice *dev) { PCIIDEState *d = DO_UPCAST(PCIIDEState, dev, dev); pci_config_set_vendor_id(d->dev.config, PCI_VENDOR_ID_INTEL); pci_config_set_device_id(d->dev.config, PCI_DEVICE_ID_INTEL_82371AB); return pci_piix_ide_initfn(d); }
false
qemu
25f8e2f512d87f0a77fc5c0b367dd200a7834d21
static int pci_piix4_ide_initfn(PCIDevice *dev) { PCIIDEState *d = DO_UPCAST(PCIIDEState, dev, dev); pci_config_set_vendor_id(d->dev.config, PCI_VENDOR_ID_INTEL); pci_config_set_device_id(d->dev.config, PCI_DEVICE_ID_INTEL_82371AB); return pci_piix_ide_initfn(d); }
{ "code": [], "line_no": [] }
static int FUNC_0(PCIDevice *VAR_0) { PCIIDEState *d = DO_UPCAST(PCIIDEState, VAR_0, VAR_0); pci_config_set_vendor_id(d->VAR_0.config, PCI_VENDOR_ID_INTEL); pci_config_set_device_id(d->VAR_0.config, PCI_DEVICE_ID_INTEL_82371AB); return pci_piix_ide_initfn(d); }
[ "static int FUNC_0(PCIDevice *VAR_0)\n{", "PCIIDEState *d = DO_UPCAST(PCIIDEState, VAR_0, VAR_0);", "pci_config_set_vendor_id(d->VAR_0.config, PCI_VENDOR_ID_INTEL);", "pci_config_set_device_id(d->VAR_0.config, PCI_DEVICE_ID_INTEL_82371AB);", "return pci_piix_ide_initfn(d);", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ] ]
5,477
static void block_job_defer_to_main_loop_bh(void *opaque) { BlockJobDeferToMainLoopData *data = opaque; AioContext *aio_context; /* Prevent race with block_job_defer_to_main_loop() */ aio_context_acquire(data->aio_context); /* Fetch BDS AioContext again, in case it has changed */ aio_context = blk_get_aio_context(data->job->blk); if (aio_context != data->aio_context) { aio_context_acquire(aio_context); } data->job->deferred_to_main_loop = false; data->fn(data->job, data->opaque); if (aio_context != data->aio_context) { aio_context_release(aio_context); } aio_context_release(data->aio_context); g_free(data); }
false
qemu
eb05e011e248c6fb6baee295e14fd206e136028c
static void block_job_defer_to_main_loop_bh(void *opaque) { BlockJobDeferToMainLoopData *data = opaque; AioContext *aio_context; aio_context_acquire(data->aio_context); aio_context = blk_get_aio_context(data->job->blk); if (aio_context != data->aio_context) { aio_context_acquire(aio_context); } data->job->deferred_to_main_loop = false; data->fn(data->job, data->opaque); if (aio_context != data->aio_context) { aio_context_release(aio_context); } aio_context_release(data->aio_context); g_free(data); }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0) { BlockJobDeferToMainLoopData *data = VAR_0; AioContext *aio_context; aio_context_acquire(data->aio_context); aio_context = blk_get_aio_context(data->job->blk); if (aio_context != data->aio_context) { aio_context_acquire(aio_context); } data->job->deferred_to_main_loop = false; data->fn(data->job, data->VAR_0); if (aio_context != data->aio_context) { aio_context_release(aio_context); } aio_context_release(data->aio_context); g_free(data); }
[ "static void FUNC_0(void *VAR_0)\n{", "BlockJobDeferToMainLoopData *data = VAR_0;", "AioContext *aio_context;", "aio_context_acquire(data->aio_context);", "aio_context = blk_get_aio_context(data->job->blk);", "if (aio_context != data->aio_context) {", "aio_context_acquire(aio_context);", "}", "data->job->deferred_to_main_loop = false;", "data->fn(data->job, data->VAR_0);", "if (aio_context != data->aio_context) {", "aio_context_release(aio_context);", "}", "aio_context_release(data->aio_context);", "g_free(data);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 13 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 47 ], [ 49 ] ]
5,478
static void virtio_blk_handle_read(VirtIOBlockReq *req) { uint64_t sector; sector = virtio_ldq_p(VIRTIO_DEVICE(req->dev), &req->out.sector); bdrv_acct_start(req->dev->bs, &req->acct, req->qiov.size, BDRV_ACCT_READ); trace_virtio_blk_handle_read(req, sector, req->qiov.size / 512); if (sector & req->dev->sector_mask) { virtio_blk_rw_complete(req, -EIO); return; } if (req->qiov.size % req->dev->conf->logical_block_size) { virtio_blk_rw_complete(req, -EIO); return; } bdrv_aio_readv(req->dev->bs, sector, &req->qiov, req->qiov.size / BDRV_SECTOR_SIZE, virtio_blk_rw_complete, req); }
false
qemu
d0e14376eefc40b07c8fb42c132c2202c66dcb0b
static void virtio_blk_handle_read(VirtIOBlockReq *req) { uint64_t sector; sector = virtio_ldq_p(VIRTIO_DEVICE(req->dev), &req->out.sector); bdrv_acct_start(req->dev->bs, &req->acct, req->qiov.size, BDRV_ACCT_READ); trace_virtio_blk_handle_read(req, sector, req->qiov.size / 512); if (sector & req->dev->sector_mask) { virtio_blk_rw_complete(req, -EIO); return; } if (req->qiov.size % req->dev->conf->logical_block_size) { virtio_blk_rw_complete(req, -EIO); return; } bdrv_aio_readv(req->dev->bs, sector, &req->qiov, req->qiov.size / BDRV_SECTOR_SIZE, virtio_blk_rw_complete, req); }
{ "code": [], "line_no": [] }
static void FUNC_0(VirtIOBlockReq *VAR_0) { uint64_t sector; sector = virtio_ldq_p(VIRTIO_DEVICE(VAR_0->dev), &VAR_0->out.sector); bdrv_acct_start(VAR_0->dev->bs, &VAR_0->acct, VAR_0->qiov.size, BDRV_ACCT_READ); trace_virtio_blk_handle_read(VAR_0, sector, VAR_0->qiov.size / 512); if (sector & VAR_0->dev->sector_mask) { virtio_blk_rw_complete(VAR_0, -EIO); return; } if (VAR_0->qiov.size % VAR_0->dev->conf->logical_block_size) { virtio_blk_rw_complete(VAR_0, -EIO); return; } bdrv_aio_readv(VAR_0->dev->bs, sector, &VAR_0->qiov, VAR_0->qiov.size / BDRV_SECTOR_SIZE, virtio_blk_rw_complete, VAR_0); }
[ "static void FUNC_0(VirtIOBlockReq *VAR_0)\n{", "uint64_t sector;", "sector = virtio_ldq_p(VIRTIO_DEVICE(VAR_0->dev), &VAR_0->out.sector);", "bdrv_acct_start(VAR_0->dev->bs, &VAR_0->acct, VAR_0->qiov.size, BDRV_ACCT_READ);", "trace_virtio_blk_handle_read(VAR_0, sector, VAR_0->qiov.size / 512);", "if (sector & VAR_0->dev->sector_mask) {", "virtio_blk_rw_complete(VAR_0, -EIO);", "return;", "}", "if (VAR_0->qiov.size % VAR_0->dev->conf->logical_block_size) {", "virtio_blk_rw_complete(VAR_0, -EIO);", "return;", "}", "bdrv_aio_readv(VAR_0->dev->bs, sector, &VAR_0->qiov,\nVAR_0->qiov.size / BDRV_SECTOR_SIZE,\nvirtio_blk_rw_complete, VAR_0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 13 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37, 39, 41 ], [ 43 ] ]
5,479
envlist_unsetenv(envlist_t *envlist, const char *env) { struct envlist_entry *entry; size_t envname_len; if ((envlist == NULL) || (env == NULL)) return (EINVAL); /* env is not allowed to contain '=' */ if (strchr(env, '=') != NULL) return (EINVAL); /* * Find out the requested entry and remove * it from the list. */ envname_len = strlen(env); for (entry = envlist->el_entries.lh_first; entry != NULL; entry = entry->ev_link.le_next) { if (strncmp(entry->ev_var, env, envname_len) == 0) break; } if (entry != NULL) { LIST_REMOVE(entry, ev_link); free((char *)entry->ev_var); free(entry); envlist->el_count--; } return (0); }
false
qemu
72cf2d4f0e181d0d3a3122e04129c58a95da713e
envlist_unsetenv(envlist_t *envlist, const char *env) { struct envlist_entry *entry; size_t envname_len; if ((envlist == NULL) || (env == NULL)) return (EINVAL); if (strchr(env, '=') != NULL) return (EINVAL); envname_len = strlen(env); for (entry = envlist->el_entries.lh_first; entry != NULL; entry = entry->ev_link.le_next) { if (strncmp(entry->ev_var, env, envname_len) == 0) break; } if (entry != NULL) { LIST_REMOVE(entry, ev_link); free((char *)entry->ev_var); free(entry); envlist->el_count--; } return (0); }
{ "code": [], "line_no": [] }
FUNC_0(envlist_t *VAR_0, const char *VAR_1) { struct envlist_entry *VAR_2; size_t envname_len; if ((VAR_0 == NULL) || (VAR_1 == NULL)) return (EINVAL); if (strchr(VAR_1, '=') != NULL) return (EINVAL); envname_len = strlen(VAR_1); for (VAR_2 = VAR_0->el_entries.lh_first; VAR_2 != NULL; VAR_2 = VAR_2->ev_link.le_next) { if (strncmp(VAR_2->ev_var, VAR_1, envname_len) == 0) break; } if (VAR_2 != NULL) { LIST_REMOVE(VAR_2, ev_link); free((char *)VAR_2->ev_var); free(VAR_2); VAR_0->el_count--; } return (0); }
[ "FUNC_0(envlist_t *VAR_0, const char *VAR_1)\n{", "struct envlist_entry *VAR_2;", "size_t envname_len;", "if ((VAR_0 == NULL) || (VAR_1 == NULL))\nreturn (EINVAL);", "if (strchr(VAR_1, '=') != NULL)\nreturn (EINVAL);", "envname_len = strlen(VAR_1);", "for (VAR_2 = VAR_0->el_entries.lh_first; VAR_2 != NULL;", "VAR_2 = VAR_2->ev_link.le_next) {", "if (strncmp(VAR_2->ev_var, VAR_1, envname_len) == 0)\nbreak;", "}", "if (VAR_2 != NULL) {", "LIST_REMOVE(VAR_2, ev_link);", "free((char *)VAR_2->ev_var);", "free(VAR_2);", "VAR_0->el_count--;", "}", "return (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 ], [ 19, 21 ], [ 33 ], [ 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ] ]
5,480
static int ehci_state_fetchitd(EHCIState *ehci, int async) { uint32_t entry; EHCIitd itd; assert(!async); entry = ehci_get_fetch_addr(ehci, async); get_dwords(NLPTR_GET(entry),(uint32_t *) &itd, sizeof(EHCIitd) >> 2); ehci_trace_itd(ehci, entry, &itd); if (ehci_process_itd(ehci, &itd) != 0) { return -1; } put_dwords(NLPTR_GET(entry), (uint32_t *) &itd, sizeof(EHCIitd) >> 2); ehci_set_fetch_addr(ehci, async, itd.next); ehci_set_state(ehci, async, EST_FETCHENTRY); return 1; }
false
qemu
68d553587c0aa271c3eb2902921b503740d775b6
static int ehci_state_fetchitd(EHCIState *ehci, int async) { uint32_t entry; EHCIitd itd; assert(!async); entry = ehci_get_fetch_addr(ehci, async); get_dwords(NLPTR_GET(entry),(uint32_t *) &itd, sizeof(EHCIitd) >> 2); ehci_trace_itd(ehci, entry, &itd); if (ehci_process_itd(ehci, &itd) != 0) { return -1; } put_dwords(NLPTR_GET(entry), (uint32_t *) &itd, sizeof(EHCIitd) >> 2); ehci_set_fetch_addr(ehci, async, itd.next); ehci_set_state(ehci, async, EST_FETCHENTRY); return 1; }
{ "code": [], "line_no": [] }
static int FUNC_0(EHCIState *VAR_0, int VAR_1) { uint32_t entry; EHCIitd itd; assert(!VAR_1); entry = ehci_get_fetch_addr(VAR_0, VAR_1); get_dwords(NLPTR_GET(entry),(uint32_t *) &itd, sizeof(EHCIitd) >> 2); ehci_trace_itd(VAR_0, entry, &itd); if (ehci_process_itd(VAR_0, &itd) != 0) { return -1; } put_dwords(NLPTR_GET(entry), (uint32_t *) &itd, sizeof(EHCIitd) >> 2); ehci_set_fetch_addr(VAR_0, VAR_1, itd.next); ehci_set_state(VAR_0, VAR_1, EST_FETCHENTRY); return 1; }
[ "static int FUNC_0(EHCIState *VAR_0, int VAR_1)\n{", "uint32_t entry;", "EHCIitd itd;", "assert(!VAR_1);", "entry = ehci_get_fetch_addr(VAR_0, VAR_1);", "get_dwords(NLPTR_GET(entry),(uint32_t *) &itd,\nsizeof(EHCIitd) >> 2);", "ehci_trace_itd(VAR_0, entry, &itd);", "if (ehci_process_itd(VAR_0, &itd) != 0) {", "return -1;", "}", "put_dwords(NLPTR_GET(entry), (uint32_t *) &itd,\nsizeof(EHCIitd) >> 2);", "ehci_set_fetch_addr(VAR_0, VAR_1, itd.next);", "ehci_set_state(VAR_0, VAR_1, EST_FETCHENTRY);", "return 1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 17, 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 33, 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ] ]
5,481
static int decode_b_mbs(VC9Context *v) { int x, y, current_mb = 0 , last_mb = v->height_mb*v->width_mb, i /* MB / B postion information */; int direct_b_bit = 0, skip_mb_bit = 0; int ac_pred; int b_mv1 = 0, b_mv2 = 0, b_mv_type = 0; int mquant, mqdiff; /* MB quant stuff */ int tt_block; /* Block transform type */ for (y=0; y<v->height_mb; y++) { for (x=0; x<v->width_mb; x++) { if (v->direct_mb_plane[current_mb]) direct_b_bit = get_bits(&v->gb, 1); if (1 /* Skip mode is raw */) { /* FIXME getting tired commenting */ #if 0 skip_mb_bit = get_bits(&v->gb, n); //vlc #endif } if (!direct_b_bit) { if (skip_mb_bit) { /* FIXME getting tired commenting */ #if 0 b_mv_type = get_bits(&v->gb, n); //vlc #endif } else { /* FIXME getting tired commenting */ #if 0 b_mv1 = get_bits(&v->gb, n); //VLC #endif if (1 /* b_mv1 isn't intra */) { /* FIXME: actually read it */ b_mv_type = 0; //vlc } } } if (!skip_mb_bit) { if (b_mv1 != last_mb) { GET_MQUANT(); if (1 /* intra mb */) ac_pred = get_bits(&v->gb, 1); } else { if (1 /* forward_mb is interpolate */) { /* FIXME: actually read it */ b_mv2 = 0; //vlc } if (1 /* b_mv2 isn't the last */) { if (1 /* intra_mb */) ac_pred = get_bits(&v->gb, 1); GET_MQUANT(); } } } //End1 /* FIXME getting tired, commenting */ #if 0 if (v->ttmbf) v->ttmb = get_bits(&v->gb, n); //vlc #endif } //End2 for (i=0; i<6; i++) { /* FIXME: process the block */ } current_mb++; } return 0; }
false
FFmpeg
e5540b3fd30367ce3cc33b2f34a04b660dbc4b38
static int decode_b_mbs(VC9Context *v) { int x, y, current_mb = 0 , last_mb = v->height_mb*v->width_mb, i ; int direct_b_bit = 0, skip_mb_bit = 0; int ac_pred; int b_mv1 = 0, b_mv2 = 0, b_mv_type = 0; int mquant, mqdiff; int tt_block; for (y=0; y<v->height_mb; y++) { for (x=0; x<v->width_mb; x++) { if (v->direct_mb_plane[current_mb]) direct_b_bit = get_bits(&v->gb, 1); if (1 ) { #if 0 skip_mb_bit = get_bits(&v->gb, n); #endif } if (!direct_b_bit) { if (skip_mb_bit) { #if 0 b_mv_type = get_bits(&v->gb, n); #endif } else { #if 0 b_mv1 = get_bits(&v->gb, n); #endif if (1 ) { b_mv_type = 0; } } } if (!skip_mb_bit) { if (b_mv1 != last_mb) { GET_MQUANT(); if (1 ) ac_pred = get_bits(&v->gb, 1); } else { if (1 ) { b_mv2 = 0; } if (1 ) { if (1 ) ac_pred = get_bits(&v->gb, 1); GET_MQUANT(); } } } #if 0 if (v->ttmbf) v->ttmb = get_bits(&v->gb, n); #endif } for (i=0; i<6; i++) { } current_mb++; } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(VC9Context *VAR_0) { int VAR_1, VAR_2, VAR_3 = 0 , VAR_4 = VAR_0->height_mb*VAR_0->width_mb, VAR_5 ; int VAR_6 = 0, VAR_7 = 0; int VAR_8; int VAR_9 = 0, VAR_10 = 0, VAR_11 = 0; int VAR_12, VAR_13; int VAR_14; for (VAR_2=0; VAR_2<VAR_0->height_mb; VAR_2++) { for (VAR_1=0; VAR_1<VAR_0->width_mb; VAR_1++) { if (VAR_0->direct_mb_plane[VAR_3]) VAR_6 = get_bits(&VAR_0->gb, 1); if (1 ) { #if 0 VAR_7 = get_bits(&VAR_0->gb, n); #endif } if (!VAR_6) { if (VAR_7) { #if 0 VAR_11 = get_bits(&VAR_0->gb, n); #endif } else { #if 0 VAR_9 = get_bits(&VAR_0->gb, n); #endif if (1 ) { VAR_11 = 0; } } } if (!VAR_7) { if (VAR_9 != VAR_4) { GET_MQUANT(); if (1 ) VAR_8 = get_bits(&VAR_0->gb, 1); } else { if (1 ) { VAR_10 = 0; } if (1 ) { if (1 ) VAR_8 = get_bits(&VAR_0->gb, 1); GET_MQUANT(); } } } #if 0 if (VAR_0->ttmbf) VAR_0->ttmb = get_bits(&VAR_0->gb, n); #endif } for (VAR_5=0; VAR_5<6; VAR_5++) { } VAR_3++; } return 0; }
[ "static int FUNC_0(VC9Context *VAR_0)\n{", "int VAR_1, VAR_2, VAR_3 = 0 , VAR_4 = VAR_0->height_mb*VAR_0->width_mb,\nVAR_5 ;", "int VAR_6 = 0, VAR_7 = 0;", "int VAR_8;", "int VAR_9 = 0, VAR_10 = 0, VAR_11 = 0;", "int VAR_12, VAR_13;", "int VAR_14;", "for (VAR_2=0; VAR_2<VAR_0->height_mb; VAR_2++)", "{", "for (VAR_1=0; VAR_1<VAR_0->width_mb; VAR_1++)", "{", "if (VAR_0->direct_mb_plane[VAR_3])\nVAR_6 = get_bits(&VAR_0->gb, 1);", "if (1 )\n{", "#if 0\nVAR_7 = get_bits(&VAR_0->gb, n);", "#endif\n}", "if (!VAR_6)\n{", "if (VAR_7)\n{", "#if 0\nVAR_11 = get_bits(&VAR_0->gb, n);", "#endif\n}", "else\n{", "#if 0\nVAR_9 = get_bits(&VAR_0->gb, n);", "#endif\nif (1 )\n{", "VAR_11 = 0;", "}", "}", "}", "if (!VAR_7)\n{", "if (VAR_9 != VAR_4)\n{", "GET_MQUANT();", "if (1 )\nVAR_8 = get_bits(&VAR_0->gb, 1);", "}", "else\n{", "if (1 )\n{", "VAR_10 = 0;", "}", "if (1 )\n{", "if (1 )\nVAR_8 = get_bits(&VAR_0->gb, 1);", "GET_MQUANT();", "}", "}", "}", "#if 0\nif (VAR_0->ttmbf)\nVAR_0->ttmb = get_bits(&VAR_0->gb, n);", "#endif\n}", "for (VAR_5=0; VAR_5<6; VAR_5++)", "{", "}", "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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29, 31 ], [ 33, 35 ], [ 39, 41 ], [ 43, 45 ], [ 47, 49 ], [ 51, 53 ], [ 57, 59 ], [ 61, 63 ], [ 65, 67 ], [ 71, 73 ], [ 75, 77, 79 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91, 93 ], [ 95, 97 ], [ 99 ], [ 101, 103 ], [ 105 ], [ 107, 109 ], [ 111, 113 ], [ 117 ], [ 119 ], [ 121, 123 ], [ 125, 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 141, 143, 145 ], [ 147, 149 ], [ 153 ], [ 155 ], [ 159 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ] ]
5,483
static int ram_save_iterate(QEMUFile *f, void *opaque) { int ret; int i; int64_t t0; int total_sent = 0; qemu_mutex_lock_ramlist(); if (ram_list.version != last_version) { reset_ram_globals(); } ram_control_before_iterate(f, RAM_CONTROL_ROUND); t0 = qemu_clock_get_ns(QEMU_CLOCK_REALTIME); i = 0; while ((ret = qemu_file_rate_limit(f)) == 0) { int bytes_sent; bytes_sent = ram_save_block(f, false); /* no more blocks to sent */ if (bytes_sent == 0) { break; } total_sent += bytes_sent; acct_info.iterations++; check_guest_throttling(); /* we want to check in the 1st loop, just in case it was the 1st time and we had to sync the dirty bitmap. qemu_get_clock_ns() is a bit expensive, so we only check each some iterations */ if ((i & 63) == 0) { uint64_t t1 = (qemu_clock_get_ns(QEMU_CLOCK_REALTIME) - t0) / 1000000; if (t1 > MAX_WAIT) { DPRINTF("big wait: %" PRIu64 " milliseconds, %d iterations\n", t1, i); break; } } i++; } qemu_mutex_unlock_ramlist(); /* * Must occur before EOS (or any QEMUFile operation) * because of RDMA protocol. */ ram_control_after_iterate(f, RAM_CONTROL_ROUND); if (ret < 0) { bytes_transferred += total_sent; return ret; } qemu_put_be64(f, RAM_SAVE_FLAG_EOS); total_sent += 8; bytes_transferred += total_sent; return total_sent; }
false
qemu
6cd0beda2c3c21fd7575e944764f392be7ef50c1
static int ram_save_iterate(QEMUFile *f, void *opaque) { int ret; int i; int64_t t0; int total_sent = 0; qemu_mutex_lock_ramlist(); if (ram_list.version != last_version) { reset_ram_globals(); } ram_control_before_iterate(f, RAM_CONTROL_ROUND); t0 = qemu_clock_get_ns(QEMU_CLOCK_REALTIME); i = 0; while ((ret = qemu_file_rate_limit(f)) == 0) { int bytes_sent; bytes_sent = ram_save_block(f, false); if (bytes_sent == 0) { break; } total_sent += bytes_sent; acct_info.iterations++; check_guest_throttling(); if ((i & 63) == 0) { uint64_t t1 = (qemu_clock_get_ns(QEMU_CLOCK_REALTIME) - t0) / 1000000; if (t1 > MAX_WAIT) { DPRINTF("big wait: %" PRIu64 " milliseconds, %d iterations\n", t1, i); break; } } i++; } qemu_mutex_unlock_ramlist(); ram_control_after_iterate(f, RAM_CONTROL_ROUND); if (ret < 0) { bytes_transferred += total_sent; return ret; } qemu_put_be64(f, RAM_SAVE_FLAG_EOS); total_sent += 8; bytes_transferred += total_sent; return total_sent; }
{ "code": [], "line_no": [] }
static int FUNC_0(QEMUFile *VAR_0, void *VAR_1) { int VAR_2; int VAR_3; int64_t t0; int VAR_4 = 0; qemu_mutex_lock_ramlist(); if (ram_list.version != last_version) { reset_ram_globals(); } ram_control_before_iterate(VAR_0, RAM_CONTROL_ROUND); t0 = qemu_clock_get_ns(QEMU_CLOCK_REALTIME); VAR_3 = 0; while ((VAR_2 = qemu_file_rate_limit(VAR_0)) == 0) { int VAR_5; VAR_5 = ram_save_block(VAR_0, false); if (VAR_5 == 0) { break; } VAR_4 += VAR_5; acct_info.iterations++; check_guest_throttling(); if ((VAR_3 & 63) == 0) { uint64_t t1 = (qemu_clock_get_ns(QEMU_CLOCK_REALTIME) - t0) / 1000000; if (t1 > MAX_WAIT) { DPRINTF("big wait: %" PRIu64 " milliseconds, %d iterations\n", t1, VAR_3); break; } } VAR_3++; } qemu_mutex_unlock_ramlist(); ram_control_after_iterate(VAR_0, RAM_CONTROL_ROUND); if (VAR_2 < 0) { bytes_transferred += VAR_4; return VAR_2; } qemu_put_be64(VAR_0, RAM_SAVE_FLAG_EOS); VAR_4 += 8; bytes_transferred += VAR_4; return VAR_4; }
[ "static int FUNC_0(QEMUFile *VAR_0, void *VAR_1)\n{", "int VAR_2;", "int VAR_3;", "int64_t t0;", "int VAR_4 = 0;", "qemu_mutex_lock_ramlist();", "if (ram_list.version != last_version) {", "reset_ram_globals();", "}", "ram_control_before_iterate(VAR_0, RAM_CONTROL_ROUND);", "t0 = qemu_clock_get_ns(QEMU_CLOCK_REALTIME);", "VAR_3 = 0;", "while ((VAR_2 = qemu_file_rate_limit(VAR_0)) == 0) {", "int VAR_5;", "VAR_5 = ram_save_block(VAR_0, false);", "if (VAR_5 == 0) {", "break;", "}", "VAR_4 += VAR_5;", "acct_info.iterations++;", "check_guest_throttling();", "if ((VAR_3 & 63) == 0) {", "uint64_t t1 = (qemu_clock_get_ns(QEMU_CLOCK_REALTIME) - t0) / 1000000;", "if (t1 > MAX_WAIT) {", "DPRINTF(\"big wait: %\" PRIu64 \" milliseconds, %d iterations\\n\",\nt1, VAR_3);", "break;", "}", "}", "VAR_3++;", "}", "qemu_mutex_unlock_ramlist();", "ram_control_after_iterate(VAR_0, RAM_CONTROL_ROUND);", "if (VAR_2 < 0) {", "bytes_transferred += VAR_4;", "return VAR_2;", "}", "qemu_put_be64(VAR_0, RAM_SAVE_FLAG_EOS);", "VAR_4 += 8;", "bytes_transferred += VAR_4;", "return VAR_4;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 67 ], [ 69 ], [ 71 ], [ 73, 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 89 ], [ 101 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 115 ], [ 117 ], [ 119 ], [ 123 ], [ 125 ] ]
5,485
static void *file_ram_alloc(RAMBlock *block, ram_addr_t memory, const char *path, Error **errp) { char *filename; char *sanitized_name; char *c; void *area; int fd; uint64_t hpagesize; Error *local_err = NULL; hpagesize = gethugepagesize(path, &local_err); if (local_err) { error_propagate(errp, local_err); goto error; } block->mr->align = hpagesize; if (memory < hpagesize) { error_setg(errp, "memory size 0x" RAM_ADDR_FMT " must be equal to " "or larger than huge page size 0x%" PRIx64, memory, hpagesize); goto error; } if (kvm_enabled() && !kvm_has_sync_mmu()) { error_setg(errp, "host lacks kvm mmu notifiers, -mem-path unsupported"); goto error; } /* Make name safe to use with mkstemp by replacing '/' with '_'. */ sanitized_name = g_strdup(memory_region_name(block->mr)); for (c = sanitized_name; *c != '\0'; c++) { if (*c == '/') *c = '_'; } filename = g_strdup_printf("%s/qemu_back_mem.%s.XXXXXX", path, sanitized_name); g_free(sanitized_name); fd = mkstemp(filename); if (fd < 0) { error_setg_errno(errp, errno, "unable to create backing store for hugepages"); g_free(filename); goto error; } unlink(filename); g_free(filename); memory = ROUND_UP(memory, hpagesize); /* * ftruncate is not supported by hugetlbfs in older * hosts, so don't bother bailing out on errors. * If anything goes wrong with it under other filesystems, * mmap will fail. */ if (ftruncate(fd, memory)) { perror("ftruncate"); } area = qemu_ram_mmap(fd, memory, hpagesize, block->flags & RAM_SHARED); if (area == MAP_FAILED) { error_setg_errno(errp, errno, "unable to map backing store for hugepages"); close(fd); goto error; } if (mem_prealloc) { os_mem_prealloc(fd, area, memory); } block->fd = fd; return area; error: return NULL; }
false
qemu
8d31d6b65a7448582c7bd320fd1b8cfc6cca2720
static void *file_ram_alloc(RAMBlock *block, ram_addr_t memory, const char *path, Error **errp) { char *filename; char *sanitized_name; char *c; void *area; int fd; uint64_t hpagesize; Error *local_err = NULL; hpagesize = gethugepagesize(path, &local_err); if (local_err) { error_propagate(errp, local_err); goto error; } block->mr->align = hpagesize; if (memory < hpagesize) { error_setg(errp, "memory size 0x" RAM_ADDR_FMT " must be equal to " "or larger than huge page size 0x%" PRIx64, memory, hpagesize); goto error; } if (kvm_enabled() && !kvm_has_sync_mmu()) { error_setg(errp, "host lacks kvm mmu notifiers, -mem-path unsupported"); goto error; } sanitized_name = g_strdup(memory_region_name(block->mr)); for (c = sanitized_name; *c != '\0'; c++) { if (*c == '/') *c = '_'; } filename = g_strdup_printf("%s/qemu_back_mem.%s.XXXXXX", path, sanitized_name); g_free(sanitized_name); fd = mkstemp(filename); if (fd < 0) { error_setg_errno(errp, errno, "unable to create backing store for hugepages"); g_free(filename); goto error; } unlink(filename); g_free(filename); memory = ROUND_UP(memory, hpagesize); if (ftruncate(fd, memory)) { perror("ftruncate"); } area = qemu_ram_mmap(fd, memory, hpagesize, block->flags & RAM_SHARED); if (area == MAP_FAILED) { error_setg_errno(errp, errno, "unable to map backing store for hugepages"); close(fd); goto error; } if (mem_prealloc) { os_mem_prealloc(fd, area, memory); } block->fd = fd; return area; error: return NULL; }
{ "code": [], "line_no": [] }
static void *FUNC_0(RAMBlock *VAR_0, ram_addr_t VAR_1, const char *VAR_2, Error **VAR_3) { char *VAR_4; char *VAR_5; char *VAR_6; void *VAR_7; int VAR_8; uint64_t hpagesize; Error *local_err = NULL; hpagesize = gethugepagesize(VAR_2, &local_err); if (local_err) { error_propagate(VAR_3, local_err); goto error; } VAR_0->mr->align = hpagesize; if (VAR_1 < hpagesize) { error_setg(VAR_3, "VAR_1 size 0x" RAM_ADDR_FMT " must be equal to " "or larger than huge page size 0x%" PRIx64, VAR_1, hpagesize); goto error; } if (kvm_enabled() && !kvm_has_sync_mmu()) { error_setg(VAR_3, "host lacks kvm mmu notifiers, -mem-VAR_2 unsupported"); goto error; } VAR_5 = g_strdup(memory_region_name(VAR_0->mr)); for (VAR_6 = VAR_5; *VAR_6 != '\0'; VAR_6++) { if (*VAR_6 == '/') *VAR_6 = '_'; } VAR_4 = g_strdup_printf("%s/qemu_back_mem.%s.XXXXXX", VAR_2, VAR_5); g_free(VAR_5); VAR_8 = mkstemp(VAR_4); if (VAR_8 < 0) { error_setg_errno(VAR_3, errno, "unable to create backing store for hugepages"); g_free(VAR_4); goto error; } unlink(VAR_4); g_free(VAR_4); VAR_1 = ROUND_UP(VAR_1, hpagesize); if (ftruncate(VAR_8, VAR_1)) { perror("ftruncate"); } VAR_7 = qemu_ram_mmap(VAR_8, VAR_1, hpagesize, VAR_0->flags & RAM_SHARED); if (VAR_7 == MAP_FAILED) { error_setg_errno(VAR_3, errno, "unable to map backing store for hugepages"); close(VAR_8); goto error; } if (mem_prealloc) { os_mem_prealloc(VAR_8, VAR_7, VAR_1); } VAR_0->VAR_8 = VAR_8; return VAR_7; error: return NULL; }
[ "static void *FUNC_0(RAMBlock *VAR_0,\nram_addr_t VAR_1,\nconst char *VAR_2,\nError **VAR_3)\n{", "char *VAR_4;", "char *VAR_5;", "char *VAR_6;", "void *VAR_7;", "int VAR_8;", "uint64_t hpagesize;", "Error *local_err = NULL;", "hpagesize = gethugepagesize(VAR_2, &local_err);", "if (local_err) {", "error_propagate(VAR_3, local_err);", "goto error;", "}", "VAR_0->mr->align = hpagesize;", "if (VAR_1 < hpagesize) {", "error_setg(VAR_3, \"VAR_1 size 0x\" RAM_ADDR_FMT \" must be equal to \"\n\"or larger than huge page size 0x%\" PRIx64,\nVAR_1, hpagesize);", "goto error;", "}", "if (kvm_enabled() && !kvm_has_sync_mmu()) {", "error_setg(VAR_3,\n\"host lacks kvm mmu notifiers, -mem-VAR_2 unsupported\");", "goto error;", "}", "VAR_5 = g_strdup(memory_region_name(VAR_0->mr));", "for (VAR_6 = VAR_5; *VAR_6 != '\\0'; VAR_6++) {", "if (*VAR_6 == '/')\n*VAR_6 = '_';", "}", "VAR_4 = g_strdup_printf(\"%s/qemu_back_mem.%s.XXXXXX\", VAR_2,\nVAR_5);", "g_free(VAR_5);", "VAR_8 = mkstemp(VAR_4);", "if (VAR_8 < 0) {", "error_setg_errno(VAR_3, errno,\n\"unable to create backing store for hugepages\");", "g_free(VAR_4);", "goto error;", "}", "unlink(VAR_4);", "g_free(VAR_4);", "VAR_1 = ROUND_UP(VAR_1, hpagesize);", "if (ftruncate(VAR_8, VAR_1)) {", "perror(\"ftruncate\");", "}", "VAR_7 = qemu_ram_mmap(VAR_8, VAR_1, hpagesize, VAR_0->flags & RAM_SHARED);", "if (VAR_7 == MAP_FAILED) {", "error_setg_errno(VAR_3, errno,\n\"unable to map backing store for hugepages\");", "close(VAR_8);", "goto error;", "}", "if (mem_prealloc) {", "os_mem_prealloc(VAR_8, VAR_7, VAR_1);", "}", "VAR_0->VAR_8 = VAR_8;", "return VAR_7;", "error:\nreturn NULL;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43, 45, 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57, 59 ], [ 61 ], [ 63 ], [ 69 ], [ 71 ], [ 73, 75 ], [ 77 ], [ 81, 83 ], [ 85 ], [ 89 ], [ 91 ], [ 93, 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 109 ], [ 125 ], [ 127 ], [ 129 ], [ 133 ], [ 135 ], [ 137, 139 ], [ 141 ], [ 143 ], [ 145 ], [ 149 ], [ 151 ], [ 153 ], [ 157 ], [ 159 ], [ 163, 165 ], [ 167 ] ]
5,486
static BlockDriverAIOCB *raw_aio_readv(BlockDriverState *bs, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, BlockDriverCompletionFunc *cb, void *opaque) { RawAIOCB *acb; acb = raw_aio_setup(bs, sector_num, qiov, nb_sectors, cb, opaque); if (!acb) return NULL; if (qemu_paio_read(&acb->aiocb) < 0) { raw_aio_remove(acb); return NULL; } return &acb->common; }
false
qemu
9ef91a677110ec200d7b2904fc4bcae5a77329ad
static BlockDriverAIOCB *raw_aio_readv(BlockDriverState *bs, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, BlockDriverCompletionFunc *cb, void *opaque) { RawAIOCB *acb; acb = raw_aio_setup(bs, sector_num, qiov, nb_sectors, cb, opaque); if (!acb) return NULL; if (qemu_paio_read(&acb->aiocb) < 0) { raw_aio_remove(acb); return NULL; } return &acb->common; }
{ "code": [], "line_no": [] }
static BlockDriverAIOCB *FUNC_0(BlockDriverState *bs, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, BlockDriverCompletionFunc *cb, void *opaque) { RawAIOCB *acb; acb = raw_aio_setup(bs, sector_num, qiov, nb_sectors, cb, opaque); if (!acb) return NULL; if (qemu_paio_read(&acb->aiocb) < 0) { raw_aio_remove(acb); return NULL; } return &acb->common; }
[ "static BlockDriverAIOCB *FUNC_0(BlockDriverState *bs,\nint64_t sector_num, QEMUIOVector *qiov, int nb_sectors,\nBlockDriverCompletionFunc *cb, void *opaque)\n{", "RawAIOCB *acb;", "acb = raw_aio_setup(bs, sector_num, qiov, nb_sectors, cb, opaque);", "if (!acb)\nreturn NULL;", "if (qemu_paio_read(&acb->aiocb) < 0) {", "raw_aio_remove(acb);", "return NULL;", "}", "return &acb->common;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 13 ], [ 15, 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ] ]
5,488
void ff_ivi_inverse_haar_8x8(const int32_t *in, int16_t *out, ptrdiff_t pitch, const uint8_t *flags) { int i, shift, sp1, sp2, sp3, sp4; const int32_t *src; int32_t *dst; int tmp[64]; int t0, t1, t2, t3, t4, t5, t6, t7, t8; /* apply the InvHaar8 to all columns */ #define COMPENSATE(x) (x) src = in; dst = tmp; for (i = 0; i < 8; i++) { if (flags[i]) { /* pre-scaling */ shift = !(i & 4); sp1 = src[ 0] << shift; sp2 = src[ 8] << shift; sp3 = src[16] << shift; sp4 = src[24] << shift; INV_HAAR8( sp1, sp2, sp3, sp4, src[32], src[40], src[48], src[56], dst[ 0], dst[ 8], dst[16], dst[24], dst[32], dst[40], dst[48], dst[56], t0, t1, t2, t3, t4, t5, t6, t7, t8); } else dst[ 0] = dst[ 8] = dst[16] = dst[24] = dst[32] = dst[40] = dst[48] = dst[56] = 0; src++; dst++; } #undef COMPENSATE /* apply the InvHaar8 to all rows */ #define COMPENSATE(x) (x) src = tmp; for (i = 0; i < 8; i++) { if ( !src[0] && !src[1] && !src[2] && !src[3] && !src[4] && !src[5] && !src[6] && !src[7]) { memset(out, 0, 8 * sizeof(out[0])); } else { INV_HAAR8(src[0], src[1], src[2], src[3], src[4], src[5], src[6], src[7], out[0], out[1], out[2], out[3], out[4], out[5], out[6], out[7], t0, t1, t2, t3, t4, t5, t6, t7, t8); } src += 8; out += pitch; } #undef COMPENSATE }
true
FFmpeg
9e88cc94e58e9e4d1293f9f56c973510e30495fd
void ff_ivi_inverse_haar_8x8(const int32_t *in, int16_t *out, ptrdiff_t pitch, const uint8_t *flags) { int i, shift, sp1, sp2, sp3, sp4; const int32_t *src; int32_t *dst; int tmp[64]; int t0, t1, t2, t3, t4, t5, t6, t7, t8; #define COMPENSATE(x) (x) src = in; dst = tmp; for (i = 0; i < 8; i++) { if (flags[i]) { shift = !(i & 4); sp1 = src[ 0] << shift; sp2 = src[ 8] << shift; sp3 = src[16] << shift; sp4 = src[24] << shift; INV_HAAR8( sp1, sp2, sp3, sp4, src[32], src[40], src[48], src[56], dst[ 0], dst[ 8], dst[16], dst[24], dst[32], dst[40], dst[48], dst[56], t0, t1, t2, t3, t4, t5, t6, t7, t8); } else dst[ 0] = dst[ 8] = dst[16] = dst[24] = dst[32] = dst[40] = dst[48] = dst[56] = 0; src++; dst++; } #undef COMPENSATE #define COMPENSATE(x) (x) src = tmp; for (i = 0; i < 8; i++) { if ( !src[0] && !src[1] && !src[2] && !src[3] && !src[4] && !src[5] && !src[6] && !src[7]) { memset(out, 0, 8 * sizeof(out[0])); } else { INV_HAAR8(src[0], src[1], src[2], src[3], src[4], src[5], src[6], src[7], out[0], out[1], out[2], out[3], out[4], out[5], out[6], out[7], t0, t1, t2, t3, t4, t5, t6, t7, t8); } src += 8; out += pitch; } #undef COMPENSATE }
{ "code": [ " sp1 = src[ 0] << shift;", " sp2 = src[ 8] << shift;", " sp3 = src[16] << shift;", " sp4 = src[24] << shift;" ], "line_no": [ 35, 37, 39, 41 ] }
void FUNC_0(const int32_t *VAR_0, int16_t *VAR_1, ptrdiff_t VAR_2, const uint8_t *VAR_3) { int VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9; const int32_t *VAR_10; int32_t *dst; int VAR_11[64]; int VAR_12, VAR_13, VAR_14, VAR_15, VAR_16, VAR_17, VAR_18, VAR_19, VAR_20; #define COMPENSATE(x) (x) VAR_10 = VAR_0; dst = VAR_11; for (VAR_4 = 0; VAR_4 < 8; VAR_4++) { if (VAR_3[VAR_4]) { VAR_5 = !(VAR_4 & 4); VAR_6 = VAR_10[ 0] << VAR_5; VAR_7 = VAR_10[ 8] << VAR_5; VAR_8 = VAR_10[16] << VAR_5; VAR_9 = VAR_10[24] << VAR_5; INV_HAAR8( VAR_6, VAR_7, VAR_8, VAR_9, VAR_10[32], VAR_10[40], VAR_10[48], VAR_10[56], dst[ 0], dst[ 8], dst[16], dst[24], dst[32], dst[40], dst[48], dst[56], VAR_12, VAR_13, VAR_14, VAR_15, VAR_16, VAR_17, VAR_18, VAR_19, VAR_20); } else dst[ 0] = dst[ 8] = dst[16] = dst[24] = dst[32] = dst[40] = dst[48] = dst[56] = 0; VAR_10++; dst++; } #undef COMPENSATE #define COMPENSATE(x) (x) VAR_10 = VAR_11; for (VAR_4 = 0; VAR_4 < 8; VAR_4++) { if ( !VAR_10[0] && !VAR_10[1] && !VAR_10[2] && !VAR_10[3] && !VAR_10[4] && !VAR_10[5] && !VAR_10[6] && !VAR_10[7]) { memset(VAR_1, 0, 8 * sizeof(VAR_1[0])); } else { INV_HAAR8(VAR_10[0], VAR_10[1], VAR_10[2], VAR_10[3], VAR_10[4], VAR_10[5], VAR_10[6], VAR_10[7], VAR_1[0], VAR_1[1], VAR_1[2], VAR_1[3], VAR_1[4], VAR_1[5], VAR_1[6], VAR_1[7], VAR_12, VAR_13, VAR_14, VAR_15, VAR_16, VAR_17, VAR_18, VAR_19, VAR_20); } VAR_10 += 8; VAR_1 += VAR_2; } #undef COMPENSATE }
[ "void FUNC_0(const int32_t *VAR_0, int16_t *VAR_1, ptrdiff_t VAR_2,\nconst uint8_t *VAR_3)\n{", "int VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9;", "const int32_t *VAR_10;", "int32_t *dst;", "int VAR_11[64];", "int VAR_12, VAR_13, VAR_14, VAR_15, VAR_16, VAR_17, VAR_18, VAR_19, VAR_20;", "#define COMPENSATE(x) (x)\nVAR_10 = VAR_0;", "dst = VAR_11;", "for (VAR_4 = 0; VAR_4 < 8; VAR_4++) {", "if (VAR_3[VAR_4]) {", "VAR_5 = !(VAR_4 & 4);", "VAR_6 = VAR_10[ 0] << VAR_5;", "VAR_7 = VAR_10[ 8] << VAR_5;", "VAR_8 = VAR_10[16] << VAR_5;", "VAR_9 = VAR_10[24] << VAR_5;", "INV_HAAR8( VAR_6, VAR_7, VAR_8, VAR_9,\nVAR_10[32], VAR_10[40], VAR_10[48], VAR_10[56],\ndst[ 0], dst[ 8], dst[16], dst[24],\ndst[32], dst[40], dst[48], dst[56],\nVAR_12, VAR_13, VAR_14, VAR_15, VAR_16, VAR_17, VAR_18, VAR_19, VAR_20);", "} else", "dst[ 0] = dst[ 8] = dst[16] = dst[24] =\ndst[32] = dst[40] = dst[48] = dst[56] = 0;", "VAR_10++;", "dst++;", "}", "#undef COMPENSATE\n#define COMPENSATE(x) (x)\nVAR_10 = VAR_11;", "for (VAR_4 = 0; VAR_4 < 8; VAR_4++) {", "if ( !VAR_10[0] && !VAR_10[1] && !VAR_10[2] && !VAR_10[3]\n&& !VAR_10[4] && !VAR_10[5] && !VAR_10[6] && !VAR_10[7]) {", "memset(VAR_1, 0, 8 * sizeof(VAR_1[0]));", "} else {", "INV_HAAR8(VAR_10[0], VAR_10[1], VAR_10[2], VAR_10[3],\nVAR_10[4], VAR_10[5], VAR_10[6], VAR_10[7],\nVAR_1[0], VAR_1[1], VAR_1[2], VAR_1[3],\nVAR_1[4], VAR_1[5], VAR_1[6], VAR_1[7],\nVAR_12, VAR_13, VAR_14, VAR_15, VAR_16, VAR_17, VAR_18, VAR_19, VAR_20);", "}", "VAR_10 += 8;", "VAR_1 += VAR_2;", "}", "#undef COMPENSATE\n}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 21, 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43, 45, 47, 49, 51 ], [ 53 ], [ 55, 57 ], [ 61 ], [ 63 ], [ 65 ], [ 67, 73, 75 ], [ 77 ], [ 79, 81 ], [ 83 ], [ 85 ], [ 87, 89, 91, 93, 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105, 107 ] ]
5,489
av_cold void ff_flacdsp_init_x86(FLACDSPContext *c, enum AVSampleFormat fmt, int bps) { #if HAVE_YASM int cpu_flags = av_get_cpu_flags(); if (EXTERNAL_SSE4(cpu_flags)) { if (bps > 16 && CONFIG_FLAC_DECODER) c->lpc = ff_flac_lpc_32_sse4; } if (EXTERNAL_XOP(cpu_flags)) { if (bps > 16) c->lpc = ff_flac_lpc_32_xop; } #endif }
false
FFmpeg
ec482e738ddcb90b156cf306eb1911f7038efa19
av_cold void ff_flacdsp_init_x86(FLACDSPContext *c, enum AVSampleFormat fmt, int bps) { #if HAVE_YASM int cpu_flags = av_get_cpu_flags(); if (EXTERNAL_SSE4(cpu_flags)) { if (bps > 16 && CONFIG_FLAC_DECODER) c->lpc = ff_flac_lpc_32_sse4; } if (EXTERNAL_XOP(cpu_flags)) { if (bps > 16) c->lpc = ff_flac_lpc_32_xop; } #endif }
{ "code": [], "line_no": [] }
av_cold void FUNC_0(FLACDSPContext *c, enum AVSampleFormat fmt, int bps) { #if HAVE_YASM int cpu_flags = av_get_cpu_flags(); if (EXTERNAL_SSE4(cpu_flags)) { if (bps > 16 && CONFIG_FLAC_DECODER) c->lpc = ff_flac_lpc_32_sse4; } if (EXTERNAL_XOP(cpu_flags)) { if (bps > 16) c->lpc = ff_flac_lpc_32_xop; } #endif }
[ "av_cold void FUNC_0(FLACDSPContext *c, enum AVSampleFormat fmt,\nint bps)\n{", "#if HAVE_YASM\nint cpu_flags = av_get_cpu_flags();", "if (EXTERNAL_SSE4(cpu_flags)) {", "if (bps > 16 && CONFIG_FLAC_DECODER)\nc->lpc = ff_flac_lpc_32_sse4;", "}", "if (EXTERNAL_XOP(cpu_flags)) {", "if (bps > 16)\nc->lpc = ff_flac_lpc_32_xop;", "}", "#endif\n}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7, 9 ], [ 13 ], [ 15, 17 ], [ 19 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 29, 31 ] ]
5,491
static void up_heap(uint32_t val, uint32_t *heap, uint32_t *weights) { uint32_t initial_val = heap[val]; while (weights[initial_val] < weights[heap[val >> 1]]) { heap[val] = heap[val >> 1]; val >>= 1; } heap[val] = initial_val; }
true
FFmpeg
f92f4935acd7d974adfd1deebdf1bb06cbe107ca
static void up_heap(uint32_t val, uint32_t *heap, uint32_t *weights) { uint32_t initial_val = heap[val]; while (weights[initial_val] < weights[heap[val >> 1]]) { heap[val] = heap[val >> 1]; val >>= 1; } heap[val] = initial_val; }
{ "code": [ "static void up_heap(uint32_t val, uint32_t *heap, uint32_t *weights)", " uint32_t initial_val = heap[val];", " while (weights[initial_val] < weights[heap[val >> 1]]) {", " heap[val] = heap[val >> 1];", " val >>= 1;", " heap[val] = initial_val;", " uint32_t initial_val = heap[val];", " heap[val] = initial_val;" ], "line_no": [ 1, 5, 9, 11, 13, 19, 5, 19 ] }
static void FUNC_0(uint32_t VAR_0, uint32_t *VAR_1, uint32_t *VAR_2) { uint32_t initial_val = VAR_1[VAR_0]; while (VAR_2[initial_val] < VAR_2[VAR_1[VAR_0 >> 1]]) { VAR_1[VAR_0] = VAR_1[VAR_0 >> 1]; VAR_0 >>= 1; } VAR_1[VAR_0] = initial_val; }
[ "static void FUNC_0(uint32_t VAR_0, uint32_t *VAR_1, uint32_t *VAR_2)\n{", "uint32_t initial_val = VAR_1[VAR_0];", "while (VAR_2[initial_val] < VAR_2[VAR_1[VAR_0 >> 1]]) {", "VAR_1[VAR_0] = VAR_1[VAR_0 >> 1];", "VAR_0 >>= 1;", "}", "VAR_1[VAR_0] = initial_val;", "}" ]
[ 1, 1, 1, 1, 1, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ] ]
5,492
static int vmstate_size(void *opaque, VMStateField *field) { int size = field->size; if (field->flags & VMS_VBUFFER) { size = *(int32_t *)(opaque+field->size_offset); if (field->flags & VMS_MULTIPLY) { size *= field->size; } } return size; }
true
qemu
60fe637bf0e4d7989e21e50f52526444765c63b4
static int vmstate_size(void *opaque, VMStateField *field) { int size = field->size; if (field->flags & VMS_VBUFFER) { size = *(int32_t *)(opaque+field->size_offset); if (field->flags & VMS_MULTIPLY) { size *= field->size; } } return size; }
{ "code": [], "line_no": [] }
static int FUNC_0(void *VAR_0, VMStateField *VAR_1) { int VAR_2 = VAR_1->VAR_2; if (VAR_1->flags & VMS_VBUFFER) { VAR_2 = *(int32_t *)(VAR_0+VAR_1->size_offset); if (VAR_1->flags & VMS_MULTIPLY) { VAR_2 *= VAR_1->VAR_2; } } return VAR_2; }
[ "static int FUNC_0(void *VAR_0, VMStateField *VAR_1)\n{", "int VAR_2 = VAR_1->VAR_2;", "if (VAR_1->flags & VMS_VBUFFER) {", "VAR_2 = *(int32_t *)(VAR_0+VAR_1->size_offset);", "if (VAR_1->flags & VMS_MULTIPLY) {", "VAR_2 *= VAR_1->VAR_2;", "}", "}", "return VAR_2;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ] ]
5,493
void ff_simple_idct84_add(uint8_t *dest, int line_size, DCTELEM *block) { int i; /* IDCT8 on each line */ for(i=0; i<4; i++) { idctRowCondDC_8(block + i*8); } /* IDCT4 and store */ for(i=0;i<8;i++) { idct4col_add(dest + i, line_size, block + i); } }
true
FFmpeg
f78cd0c243b9149c7f604ecf1006d78e344aa6ca
void ff_simple_idct84_add(uint8_t *dest, int line_size, DCTELEM *block) { int i; for(i=0; i<4; i++) { idctRowCondDC_8(block + i*8); } for(i=0;i<8;i++) { idct4col_add(dest + i, line_size, block + i); } }
{ "code": [ " idctRowCondDC_8(block + i*8);", " idctRowCondDC_8(block + i*8);" ], "line_no": [ 13, 13 ] }
void FUNC_0(uint8_t *VAR_0, int VAR_1, DCTELEM *VAR_2) { int VAR_3; for(VAR_3=0; VAR_3<4; VAR_3++) { idctRowCondDC_8(VAR_2 + VAR_3*8); } for(VAR_3=0;VAR_3<8;VAR_3++) { idct4col_add(VAR_0 + VAR_3, VAR_1, VAR_2 + VAR_3); } }
[ "void FUNC_0(uint8_t *VAR_0, int VAR_1, DCTELEM *VAR_2)\n{", "int VAR_3;", "for(VAR_3=0; VAR_3<4; VAR_3++) {", "idctRowCondDC_8(VAR_2 + VAR_3*8);", "}", "for(VAR_3=0;VAR_3<8;VAR_3++) {", "idct4col_add(VAR_0 + VAR_3, VAR_1, VAR_2 + VAR_3);", "}", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 11 ], [ 13 ], [ 15 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ] ]
5,494
int net_handle_fd_param(Monitor *mon, const char *param) { if (!qemu_isdigit(param[0])) { int fd; fd = monitor_get_fd(mon, param); if (fd == -1) { error_report("No file descriptor named %s found", param); return -1; } return fd; } else { return strtol(param, NULL, 0); } }
true
qemu
f7c31d6381f2cbac03e82fc23133f6863606edd8
int net_handle_fd_param(Monitor *mon, const char *param) { if (!qemu_isdigit(param[0])) { int fd; fd = monitor_get_fd(mon, param); if (fd == -1) { error_report("No file descriptor named %s found", param); return -1; } return fd; } else { return strtol(param, NULL, 0); } }
{ "code": [ " if (!qemu_isdigit(param[0])) {", " int fd;", " return fd;", " return strtol(param, NULL, 0);" ], "line_no": [ 5, 7, 23, 27 ] }
int FUNC_0(Monitor *VAR_0, const char *VAR_1) { if (!qemu_isdigit(VAR_1[0])) { int VAR_2; VAR_2 = monitor_get_fd(VAR_0, VAR_1); if (VAR_2 == -1) { error_report("No file descriptor named %s found", VAR_1); return -1; } return VAR_2; } else { return strtol(VAR_1, NULL, 0); } }
[ "int FUNC_0(Monitor *VAR_0, const char *VAR_1)\n{", "if (!qemu_isdigit(VAR_1[0])) {", "int VAR_2;", "VAR_2 = monitor_get_fd(VAR_0, VAR_1);", "if (VAR_2 == -1) {", "error_report(\"No file descriptor named %s found\", VAR_1);", "return -1;", "}", "return VAR_2;", "} else {", "return strtol(VAR_1, NULL, 0);", "}", "}" ]
[ 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ] ]
5,495
static int tee_write_trailer(AVFormatContext *avf) { TeeContext *tee = avf->priv_data; AVFormatContext *avf2; int ret_all = 0, ret; unsigned i; for (i = 0; i < tee->nb_slaves; i++) { avf2 = tee->slaves[i].avf; if ((ret = av_write_trailer(avf2)) < 0) if (!ret_all) ret_all = ret; if (!(avf2->oformat->flags & AVFMT_NOFILE)) ff_format_io_close(avf2, &avf2->pb); } close_slaves(avf); return ret_all; }
true
FFmpeg
f9d7e9feec2a0fd7f7930d01876a70a9b8a4a3b9
static int tee_write_trailer(AVFormatContext *avf) { TeeContext *tee = avf->priv_data; AVFormatContext *avf2; int ret_all = 0, ret; unsigned i; for (i = 0; i < tee->nb_slaves; i++) { avf2 = tee->slaves[i].avf; if ((ret = av_write_trailer(avf2)) < 0) if (!ret_all) ret_all = ret; if (!(avf2->oformat->flags & AVFMT_NOFILE)) ff_format_io_close(avf2, &avf2->pb); } close_slaves(avf); return ret_all; }
{ "code": [ " AVFormatContext *avf2;", " avf2 = tee->slaves[i].avf;", " if ((ret = av_write_trailer(avf2)) < 0)", " if (!(avf2->oformat->flags & AVFMT_NOFILE))", " ff_format_io_close(avf2, &avf2->pb);", " close_slaves(avf);" ], "line_no": [ 7, 17, 19, 25, 27, 31 ] }
static int FUNC_0(AVFormatContext *VAR_0) { TeeContext *tee = VAR_0->priv_data; AVFormatContext *avf2; int VAR_1 = 0, VAR_2; unsigned VAR_3; for (VAR_3 = 0; VAR_3 < tee->nb_slaves; VAR_3++) { avf2 = tee->slaves[VAR_3].VAR_0; if ((VAR_2 = av_write_trailer(avf2)) < 0) if (!VAR_1) VAR_1 = VAR_2; if (!(avf2->oformat->flags & AVFMT_NOFILE)) ff_format_io_close(avf2, &avf2->pb); } close_slaves(VAR_0); return VAR_1; }
[ "static int FUNC_0(AVFormatContext *VAR_0)\n{", "TeeContext *tee = VAR_0->priv_data;", "AVFormatContext *avf2;", "int VAR_1 = 0, VAR_2;", "unsigned VAR_3;", "for (VAR_3 = 0; VAR_3 < tee->nb_slaves; VAR_3++) {", "avf2 = tee->slaves[VAR_3].VAR_0;", "if ((VAR_2 = av_write_trailer(avf2)) < 0)\nif (!VAR_1)\nVAR_1 = VAR_2;", "if (!(avf2->oformat->flags & AVFMT_NOFILE))\nff_format_io_close(avf2, &avf2->pb);", "}", "close_slaves(VAR_0);", "return VAR_1;", "}" ]
[ 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19, 21, 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ] ]
5,496
static int write_trailer(AVFormatContext *s){ NUTContext *nut= s->priv_data; AVIOContext *bc= s->pb; while(nut->header_count<3) write_headers(s, bc); avio_flush(bc); ff_nut_free_sp(nut); av_freep(&nut->stream); av_freep(&nut->time_base); return 0; }
true
FFmpeg
2cface71ca58b1ab811efae7d22f3264f362f672
static int write_trailer(AVFormatContext *s){ NUTContext *nut= s->priv_data; AVIOContext *bc= s->pb; while(nut->header_count<3) write_headers(s, bc); avio_flush(bc); ff_nut_free_sp(nut); av_freep(&nut->stream); av_freep(&nut->time_base); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0){ NUTContext *nut= VAR_0->priv_data; AVIOContext *bc= VAR_0->pb; while(nut->header_count<3) write_headers(VAR_0, bc); avio_flush(bc); ff_nut_free_sp(nut); av_freep(&nut->stream); av_freep(&nut->time_base); return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0){", "NUTContext *nut= VAR_0->priv_data;", "AVIOContext *bc= VAR_0->pb;", "while(nut->header_count<3)\nwrite_headers(VAR_0, bc);", "avio_flush(bc);", "ff_nut_free_sp(nut);", "av_freep(&nut->stream);", "av_freep(&nut->time_base);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 9, 11 ], [ 13 ], [ 15 ], [ 17 ], [ 20 ], [ 24 ], [ 26 ] ]
5,497
static void vmgenid_set_guid_test(void) { QemuUUID expected, measured; gchar *cmd; g_assert(qemu_uuid_parse(VGID_GUID, &expected) == 0); cmd = g_strdup_printf("-machine accel=tcg -device vmgenid,id=testvgid," "guid=%s", VGID_GUID); qtest_start(cmd); /* Read the GUID from accessing guest memory */ read_guid_from_memory(&measured); g_assert(memcmp(measured.data, expected.data, sizeof(measured.data)) == 0); qtest_quit(global_qtest); g_free(cmd); }
true
qemu
4871b51b9241b10f4fd8e04bbb21577886795e25
static void vmgenid_set_guid_test(void) { QemuUUID expected, measured; gchar *cmd; g_assert(qemu_uuid_parse(VGID_GUID, &expected) == 0); cmd = g_strdup_printf("-machine accel=tcg -device vmgenid,id=testvgid," "guid=%s", VGID_GUID); qtest_start(cmd); read_guid_from_memory(&measured); g_assert(memcmp(measured.data, expected.data, sizeof(measured.data)) == 0); qtest_quit(global_qtest); g_free(cmd); }
{ "code": [ " cmd = g_strdup_printf(\"-machine accel=tcg -device vmgenid,id=testvgid,\"", " \"guid=%s\", VGID_GUID);", " cmd = g_strdup_printf(\"-machine accel=tcg -device vmgenid,id=testvgid,\"", " \"guid=%s\", VGID_GUID);" ], "line_no": [ 15, 17, 15, 17 ] }
static void FUNC_0(void) { QemuUUID expected, measured; gchar *cmd; g_assert(qemu_uuid_parse(VGID_GUID, &expected) == 0); cmd = g_strdup_printf("-machine accel=tcg -device vmgenid,id=testvgid," "guid=%s", VGID_GUID); qtest_start(cmd); read_guid_from_memory(&measured); g_assert(memcmp(measured.data, expected.data, sizeof(measured.data)) == 0); qtest_quit(global_qtest); g_free(cmd); }
[ "static void FUNC_0(void)\n{", "QemuUUID expected, measured;", "gchar *cmd;", "g_assert(qemu_uuid_parse(VGID_GUID, &expected) == 0);", "cmd = g_strdup_printf(\"-machine accel=tcg -device vmgenid,id=testvgid,\"\n\"guid=%s\", VGID_GUID);", "qtest_start(cmd);", "read_guid_from_memory(&measured);", "g_assert(memcmp(measured.data, expected.data, sizeof(measured.data)) == 0);", "qtest_quit(global_qtest);", "g_free(cmd);", "}" ]
[ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 15, 17 ], [ 19 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ] ]
5,498
static int rtp_write(URLContext *h, const uint8_t *buf, int size) { RTPContext *s = h->priv_data; int ret; URLContext *hd; if (RTP_PT_IS_RTCP(buf[1])) { /* RTCP payload type */ hd = s->rtcp_hd; } else { /* RTP payload type */ hd = s->rtp_hd; } ret = ffurl_write(hd, buf, size); return ret; }
true
FFmpeg
1851e1d05d06f6ef3436c667e4354da0f407b226
static int rtp_write(URLContext *h, const uint8_t *buf, int size) { RTPContext *s = h->priv_data; int ret; URLContext *hd; if (RTP_PT_IS_RTCP(buf[1])) { hd = s->rtcp_hd; } else { hd = s->rtp_hd; } ret = ffurl_write(hd, buf, size); return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(URLContext *VAR_0, const uint8_t *VAR_1, int VAR_2) { RTPContext *s = VAR_0->priv_data; int VAR_3; URLContext *hd; if (RTP_PT_IS_RTCP(VAR_1[1])) { hd = s->rtcp_hd; } else { hd = s->rtp_hd; } VAR_3 = ffurl_write(hd, VAR_1, VAR_2); return VAR_3; }
[ "static int FUNC_0(URLContext *VAR_0, const uint8_t *VAR_1, int VAR_2)\n{", "RTPContext *s = VAR_0->priv_data;", "int VAR_3;", "URLContext *hd;", "if (RTP_PT_IS_RTCP(VAR_1[1])) {", "hd = s->rtcp_hd;", "} else {", "hd = s->rtp_hd;", "}", "VAR_3 = ffurl_write(hd, VAR_1, VAR_2);", "return VAR_3;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2 ], [ 3 ], [ 4 ], [ 5 ], [ 6 ], [ 8 ], [ 9 ], [ 11 ], [ 12 ], [ 13 ], [ 14 ], [ 15 ] ]
5,499
static unsigned int dec_addi_acr(DisasContext *dc) { TCGv t0; DIS(fprintf (logfile, "addi.%c $r%u, $r%u, $acr\n", memsize_char(memsize_zz(dc)), dc->op2, dc->op1)); cris_cc_mask(dc, 0); t0 = tcg_temp_new(TCG_TYPE_TL); tcg_gen_shl_tl(t0, cpu_R[dc->op2], tcg_const_tl(dc->zzsize)); tcg_gen_add_tl(cpu_R[R_ACR], cpu_R[dc->op1], t0); return 2; }
true
qemu
f4b147f6701f6f5127b70b82f41757a52dfa4aae
static unsigned int dec_addi_acr(DisasContext *dc) { TCGv t0; DIS(fprintf (logfile, "addi.%c $r%u, $r%u, $acr\n", memsize_char(memsize_zz(dc)), dc->op2, dc->op1)); cris_cc_mask(dc, 0); t0 = tcg_temp_new(TCG_TYPE_TL); tcg_gen_shl_tl(t0, cpu_R[dc->op2], tcg_const_tl(dc->zzsize)); tcg_gen_add_tl(cpu_R[R_ACR], cpu_R[dc->op1], t0); return 2; }
{ "code": [], "line_no": [] }
static unsigned int FUNC_0(DisasContext *VAR_0) { TCGv t0; DIS(fprintf (logfile, "addi.%c $r%u, $r%u, $acr\n", memsize_char(memsize_zz(VAR_0)), VAR_0->op2, VAR_0->op1)); cris_cc_mask(VAR_0, 0); t0 = tcg_temp_new(TCG_TYPE_TL); tcg_gen_shl_tl(t0, cpu_R[VAR_0->op2], tcg_const_tl(VAR_0->zzsize)); tcg_gen_add_tl(cpu_R[R_ACR], cpu_R[VAR_0->op1], t0); return 2; }
[ "static unsigned int FUNC_0(DisasContext *VAR_0)\n{", "TCGv t0;", "DIS(fprintf (logfile, \"addi.%c $r%u, $r%u, $acr\\n\",\nmemsize_char(memsize_zz(VAR_0)), VAR_0->op2, VAR_0->op1));", "cris_cc_mask(VAR_0, 0);", "t0 = tcg_temp_new(TCG_TYPE_TL);", "tcg_gen_shl_tl(t0, cpu_R[VAR_0->op2], tcg_const_tl(VAR_0->zzsize));", "tcg_gen_add_tl(cpu_R[R_ACR], cpu_R[VAR_0->op1], t0);", "return 2;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ] ]
5,501
int ff_insert_pad(unsigned idx, unsigned *count, size_t padidx_off, AVFilterPad **pads, AVFilterLink ***links, AVFilterPad *newpad) { AVFilterLink **newlinks; AVFilterPad *newpads; unsigned i; idx = FFMIN(idx, *count); newpads = av_realloc_array(*pads, *count + 1, sizeof(AVFilterPad)); newlinks = av_realloc_array(*links, *count + 1, sizeof(AVFilterLink*)); if (newpads) *pads = newpads; if (newlinks) *links = newlinks; if (!newpads || !newlinks) return AVERROR(ENOMEM); memmove(*pads + idx + 1, *pads + idx, sizeof(AVFilterPad) * (*count - idx)); memmove(*links + idx + 1, *links + idx, sizeof(AVFilterLink*) * (*count - idx)); memcpy(*pads + idx, newpad, sizeof(AVFilterPad)); (*links)[idx] = NULL; (*count)++; for (i = idx + 1; i < *count; i++) if (*links[i]) (*(unsigned *)((uint8_t *) *links[i] + padidx_off))++; return 0; }
true
FFmpeg
ab2bfb85d49b2f8aa505816f93e75fd18ad0a361
int ff_insert_pad(unsigned idx, unsigned *count, size_t padidx_off, AVFilterPad **pads, AVFilterLink ***links, AVFilterPad *newpad) { AVFilterLink **newlinks; AVFilterPad *newpads; unsigned i; idx = FFMIN(idx, *count); newpads = av_realloc_array(*pads, *count + 1, sizeof(AVFilterPad)); newlinks = av_realloc_array(*links, *count + 1, sizeof(AVFilterLink*)); if (newpads) *pads = newpads; if (newlinks) *links = newlinks; if (!newpads || !newlinks) return AVERROR(ENOMEM); memmove(*pads + idx + 1, *pads + idx, sizeof(AVFilterPad) * (*count - idx)); memmove(*links + idx + 1, *links + idx, sizeof(AVFilterLink*) * (*count - idx)); memcpy(*pads + idx, newpad, sizeof(AVFilterPad)); (*links)[idx] = NULL; (*count)++; for (i = idx + 1; i < *count; i++) if (*links[i]) (*(unsigned *)((uint8_t *) *links[i] + padidx_off))++; return 0; }
{ "code": [ " if (*links[i])", " (*(unsigned *)((uint8_t *) *links[i] + padidx_off))++;" ], "line_no": [ 53, 55 ] }
int FUNC_0(unsigned VAR_0, unsigned *VAR_1, size_t VAR_2, AVFilterPad **VAR_3, AVFilterLink ***VAR_4, AVFilterPad *VAR_5) { AVFilterLink **newlinks; AVFilterPad *newpads; unsigned VAR_6; VAR_0 = FFMIN(VAR_0, *VAR_1); newpads = av_realloc_array(*VAR_3, *VAR_1 + 1, sizeof(AVFilterPad)); newlinks = av_realloc_array(*VAR_4, *VAR_1 + 1, sizeof(AVFilterLink*)); if (newpads) *VAR_3 = newpads; if (newlinks) *VAR_4 = newlinks; if (!newpads || !newlinks) return AVERROR(ENOMEM); memmove(*VAR_3 + VAR_0 + 1, *VAR_3 + VAR_0, sizeof(AVFilterPad) * (*VAR_1 - VAR_0)); memmove(*VAR_4 + VAR_0 + 1, *VAR_4 + VAR_0, sizeof(AVFilterLink*) * (*VAR_1 - VAR_0)); memcpy(*VAR_3 + VAR_0, VAR_5, sizeof(AVFilterPad)); (*VAR_4)[VAR_0] = NULL; (*VAR_1)++; for (VAR_6 = VAR_0 + 1; VAR_6 < *VAR_1; VAR_6++) if (*VAR_4[VAR_6]) (*(unsigned *)((uint8_t *) *VAR_4[VAR_6] + VAR_2))++; return 0; }
[ "int FUNC_0(unsigned VAR_0, unsigned *VAR_1, size_t VAR_2,\nAVFilterPad **VAR_3, AVFilterLink ***VAR_4,\nAVFilterPad *VAR_5)\n{", "AVFilterLink **newlinks;", "AVFilterPad *newpads;", "unsigned VAR_6;", "VAR_0 = FFMIN(VAR_0, *VAR_1);", "newpads = av_realloc_array(*VAR_3, *VAR_1 + 1, sizeof(AVFilterPad));", "newlinks = av_realloc_array(*VAR_4, *VAR_1 + 1, sizeof(AVFilterLink*));", "if (newpads)\n*VAR_3 = newpads;", "if (newlinks)\n*VAR_4 = newlinks;", "if (!newpads || !newlinks)\nreturn AVERROR(ENOMEM);", "memmove(*VAR_3 + VAR_0 + 1, *VAR_3 + VAR_0, sizeof(AVFilterPad) * (*VAR_1 - VAR_0));", "memmove(*VAR_4 + VAR_0 + 1, *VAR_4 + VAR_0, sizeof(AVFilterLink*) * (*VAR_1 - VAR_0));", "memcpy(*VAR_3 + VAR_0, VAR_5, sizeof(AVFilterPad));", "(*VAR_4)[VAR_0] = NULL;", "(*VAR_1)++;", "for (VAR_6 = VAR_0 + 1; VAR_6 < *VAR_1; VAR_6++)", "if (*VAR_4[VAR_6])\n(*(unsigned *)((uint8_t *) *VAR_4[VAR_6] + VAR_2))++;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 21 ], [ 23 ], [ 25, 27 ], [ 29, 31 ], [ 33, 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53, 55 ], [ 59 ], [ 61 ] ]
5,502
sbappend(struct socket *so, struct mbuf *m) { int ret = 0; DEBUG_CALL("sbappend"); DEBUG_ARG("so = %p", so); DEBUG_ARG("m = %p", m); DEBUG_ARG("m->m_len = %d", m->m_len); /* Shouldn't happen, but... e.g. foreign host closes connection */ if (m->m_len <= 0) { m_free(m); return; } /* * If there is urgent data, call sosendoob * if not all was sent, sowrite will take care of the rest * (The rest of this function is just an optimisation) */ if (so->so_urgc) { sbappendsb(&so->so_rcv, m); m_free(m); sosendoob(so); return; } /* * We only write if there's nothing in the buffer, * ottherwise it'll arrive out of order, and hence corrupt */ if (!so->so_rcv.sb_cc) ret = slirp_send(so, m->m_data, m->m_len, 0); if (ret <= 0) { /* * Nothing was written * It's possible that the socket has closed, but * we don't need to check because if it has closed, * it will be detected in the normal way by soread() */ sbappendsb(&so->so_rcv, m); } else if (ret != m->m_len) { /* * Something was written, but not everything.. * sbappendsb the rest */ m->m_len -= ret; m->m_data += ret; sbappendsb(&so->so_rcv, m); } /* else */ /* Whatever happened, we free the mbuf */ m_free(m); }
true
qemu
75cb298d905030fca897ea1d80e409c7f7e3e5ea
sbappend(struct socket *so, struct mbuf *m) { int ret = 0; DEBUG_CALL("sbappend"); DEBUG_ARG("so = %p", so); DEBUG_ARG("m = %p", m); DEBUG_ARG("m->m_len = %d", m->m_len); if (m->m_len <= 0) { m_free(m); return; } if (so->so_urgc) { sbappendsb(&so->so_rcv, m); m_free(m); sosendoob(so); return; } if (!so->so_rcv.sb_cc) ret = slirp_send(so, m->m_data, m->m_len, 0); if (ret <= 0) { sbappendsb(&so->so_rcv, m); } else if (ret != m->m_len) { m->m_len -= ret; m->m_data += ret; sbappendsb(&so->so_rcv, m); } m_free(m); }
{ "code": [ "\t\tsosendoob(so);", "\t\tsosendoob(so);" ], "line_no": [ 47, 47 ] }
FUNC_0(struct socket *VAR_0, struct mbuf *VAR_1) { int VAR_2 = 0; DEBUG_CALL("FUNC_0"); DEBUG_ARG("VAR_0 = %p", VAR_0); DEBUG_ARG("VAR_1 = %p", VAR_1); DEBUG_ARG("VAR_1->m_len = %d", VAR_1->m_len); if (VAR_1->m_len <= 0) { m_free(VAR_1); return; } if (VAR_0->so_urgc) { sbappendsb(&VAR_0->so_rcv, VAR_1); m_free(VAR_1); sosendoob(VAR_0); return; } if (!VAR_0->so_rcv.sb_cc) VAR_2 = slirp_send(VAR_0, VAR_1->m_data, VAR_1->m_len, 0); if (VAR_2 <= 0) { sbappendsb(&VAR_0->so_rcv, VAR_1); } else if (VAR_2 != VAR_1->m_len) { VAR_1->m_len -= VAR_2; VAR_1->m_data += VAR_2; sbappendsb(&VAR_0->so_rcv, VAR_1); } m_free(VAR_1); }
[ "FUNC_0(struct socket *VAR_0, struct mbuf *VAR_1)\n{", "int VAR_2 = 0;", "DEBUG_CALL(\"FUNC_0\");", "DEBUG_ARG(\"VAR_0 = %p\", VAR_0);", "DEBUG_ARG(\"VAR_1 = %p\", VAR_1);", "DEBUG_ARG(\"VAR_1->m_len = %d\", VAR_1->m_len);", "if (VAR_1->m_len <= 0) {", "m_free(VAR_1);", "return;", "}", "if (VAR_0->so_urgc) {", "sbappendsb(&VAR_0->so_rcv, VAR_1);", "m_free(VAR_1);", "sosendoob(VAR_0);", "return;", "}", "if (!VAR_0->so_rcv.sb_cc)\nVAR_2 = slirp_send(VAR_0, VAR_1->m_data, VAR_1->m_len, 0);", "if (VAR_2 <= 0) {", "sbappendsb(&VAR_0->so_rcv, VAR_1);", "} else if (VAR_2 != VAR_1->m_len) {", "VAR_1->m_len -= VAR_2;", "VAR_1->m_data += VAR_2;", "sbappendsb(&VAR_0->so_rcv, VAR_1);", "}", "m_free(VAR_1);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 63, 65 ], [ 69 ], [ 83 ], [ 85 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 105 ], [ 107 ] ]
5,504
static int xan_decode_chroma(AVCodecContext *avctx, unsigned chroma_off) { XanContext *s = avctx->priv_data; uint8_t *U, *V; int val, uval, vval; int i, j; const uint8_t *src, *src_end; const uint8_t *table; int mode, offset, dec_size; if (!chroma_off) return 0; if (chroma_off + 4 >= bytestream2_get_bytes_left(&s->gb)) { av_log(avctx, AV_LOG_ERROR, "Invalid chroma block position\n"); return -1; } bytestream2_seek(&s->gb, chroma_off + 4, SEEK_SET); mode = bytestream2_get_le16(&s->gb); table = s->gb.buffer; offset = bytestream2_get_le16(&s->gb) * 2; if (offset >= bytestream2_get_bytes_left(&s->gb)) { av_log(avctx, AV_LOG_ERROR, "Invalid chroma block offset\n"); return -1; } bytestream2_skip(&s->gb, offset); memset(s->scratch_buffer, 0, s->buffer_size); dec_size = xan_unpack(s, s->scratch_buffer, s->buffer_size); if (dec_size < 0) { av_log(avctx, AV_LOG_ERROR, "Chroma unpacking failed\n"); return -1; } U = s->pic.data[1]; V = s->pic.data[2]; src = s->scratch_buffer; src_end = src + dec_size; if (mode) { for (j = 0; j < avctx->height >> 1; j++) { for (i = 0; i < avctx->width >> 1; i++) { val = *src++; if (val) { val = AV_RL16(table + (val << 1)); uval = (val >> 3) & 0xF8; vval = (val >> 8) & 0xF8; U[i] = uval | (uval >> 5); V[i] = vval | (vval >> 5); } if (src == src_end) return 0; } U += s->pic.linesize[1]; V += s->pic.linesize[2]; } } else { uint8_t *U2 = U + s->pic.linesize[1]; uint8_t *V2 = V + s->pic.linesize[2]; for (j = 0; j < avctx->height >> 2; j++) { for (i = 0; i < avctx->width >> 1; i += 2) { val = *src++; if (val) { val = AV_RL16(table + (val << 1)); uval = (val >> 3) & 0xF8; vval = (val >> 8) & 0xF8; U[i] = U[i+1] = U2[i] = U2[i+1] = uval | (uval >> 5); V[i] = V[i+1] = V2[i] = V2[i+1] = vval | (vval >> 5); } } U += s->pic.linesize[1] * 2; V += s->pic.linesize[2] * 2; U2 += s->pic.linesize[1] * 2; V2 += s->pic.linesize[2] * 2; } } return 0; }
true
FFmpeg
f77bfa837636a99a4034d31916a76f7d1688cf5a
static int xan_decode_chroma(AVCodecContext *avctx, unsigned chroma_off) { XanContext *s = avctx->priv_data; uint8_t *U, *V; int val, uval, vval; int i, j; const uint8_t *src, *src_end; const uint8_t *table; int mode, offset, dec_size; if (!chroma_off) return 0; if (chroma_off + 4 >= bytestream2_get_bytes_left(&s->gb)) { av_log(avctx, AV_LOG_ERROR, "Invalid chroma block position\n"); return -1; } bytestream2_seek(&s->gb, chroma_off + 4, SEEK_SET); mode = bytestream2_get_le16(&s->gb); table = s->gb.buffer; offset = bytestream2_get_le16(&s->gb) * 2; if (offset >= bytestream2_get_bytes_left(&s->gb)) { av_log(avctx, AV_LOG_ERROR, "Invalid chroma block offset\n"); return -1; } bytestream2_skip(&s->gb, offset); memset(s->scratch_buffer, 0, s->buffer_size); dec_size = xan_unpack(s, s->scratch_buffer, s->buffer_size); if (dec_size < 0) { av_log(avctx, AV_LOG_ERROR, "Chroma unpacking failed\n"); return -1; } U = s->pic.data[1]; V = s->pic.data[2]; src = s->scratch_buffer; src_end = src + dec_size; if (mode) { for (j = 0; j < avctx->height >> 1; j++) { for (i = 0; i < avctx->width >> 1; i++) { val = *src++; if (val) { val = AV_RL16(table + (val << 1)); uval = (val >> 3) & 0xF8; vval = (val >> 8) & 0xF8; U[i] = uval | (uval >> 5); V[i] = vval | (vval >> 5); } if (src == src_end) return 0; } U += s->pic.linesize[1]; V += s->pic.linesize[2]; } } else { uint8_t *U2 = U + s->pic.linesize[1]; uint8_t *V2 = V + s->pic.linesize[2]; for (j = 0; j < avctx->height >> 2; j++) { for (i = 0; i < avctx->width >> 1; i += 2) { val = *src++; if (val) { val = AV_RL16(table + (val << 1)); uval = (val >> 3) & 0xF8; vval = (val >> 8) & 0xF8; U[i] = U[i+1] = U2[i] = U2[i+1] = uval | (uval >> 5); V[i] = V[i+1] = V2[i] = V2[i+1] = vval | (vval >> 5); } } U += s->pic.linesize[1] * 2; V += s->pic.linesize[2] * 2; U2 += s->pic.linesize[1] * 2; V2 += s->pic.linesize[2] * 2; } } return 0; }
{ "code": [ " int mode, offset, dec_size;", " mode = bytestream2_get_le16(&s->gb);", " table = s->gb.buffer;", " offset = bytestream2_get_le16(&s->gb) * 2;", " if (val) {", " if (val) {" ], "line_no": [ 17, 35, 37, 39, 85, 85 ] }
static int FUNC_0(AVCodecContext *VAR_0, unsigned VAR_1) { XanContext *s = VAR_0->priv_data; uint8_t *U, *V; int VAR_2, VAR_3, VAR_4; int VAR_5, VAR_6; const uint8_t *VAR_7, *src_end; const uint8_t *VAR_8; int VAR_9, VAR_10, VAR_11; if (!VAR_1) return 0; if (VAR_1 + 4 >= bytestream2_get_bytes_left(&s->gb)) { av_log(VAR_0, AV_LOG_ERROR, "Invalid chroma block position\n"); return -1; } bytestream2_seek(&s->gb, VAR_1 + 4, SEEK_SET); VAR_9 = bytestream2_get_le16(&s->gb); VAR_8 = s->gb.buffer; VAR_10 = bytestream2_get_le16(&s->gb) * 2; if (VAR_10 >= bytestream2_get_bytes_left(&s->gb)) { av_log(VAR_0, AV_LOG_ERROR, "Invalid chroma block VAR_10\n"); return -1; } bytestream2_skip(&s->gb, VAR_10); memset(s->scratch_buffer, 0, s->buffer_size); VAR_11 = xan_unpack(s, s->scratch_buffer, s->buffer_size); if (VAR_11 < 0) { av_log(VAR_0, AV_LOG_ERROR, "Chroma unpacking failed\n"); return -1; } U = s->pic.data[1]; V = s->pic.data[2]; VAR_7 = s->scratch_buffer; src_end = VAR_7 + VAR_11; if (VAR_9) { for (VAR_6 = 0; VAR_6 < VAR_0->height >> 1; VAR_6++) { for (VAR_5 = 0; VAR_5 < VAR_0->width >> 1; VAR_5++) { VAR_2 = *VAR_7++; if (VAR_2) { VAR_2 = AV_RL16(VAR_8 + (VAR_2 << 1)); VAR_3 = (VAR_2 >> 3) & 0xF8; VAR_4 = (VAR_2 >> 8) & 0xF8; U[VAR_5] = VAR_3 | (VAR_3 >> 5); V[VAR_5] = VAR_4 | (VAR_4 >> 5); } if (VAR_7 == src_end) return 0; } U += s->pic.linesize[1]; V += s->pic.linesize[2]; } } else { uint8_t *U2 = U + s->pic.linesize[1]; uint8_t *V2 = V + s->pic.linesize[2]; for (VAR_6 = 0; VAR_6 < VAR_0->height >> 2; VAR_6++) { for (VAR_5 = 0; VAR_5 < VAR_0->width >> 1; VAR_5 += 2) { VAR_2 = *VAR_7++; if (VAR_2) { VAR_2 = AV_RL16(VAR_8 + (VAR_2 << 1)); VAR_3 = (VAR_2 >> 3) & 0xF8; VAR_4 = (VAR_2 >> 8) & 0xF8; U[VAR_5] = U[VAR_5+1] = U2[VAR_5] = U2[VAR_5+1] = VAR_3 | (VAR_3 >> 5); V[VAR_5] = V[VAR_5+1] = V2[VAR_5] = V2[VAR_5+1] = VAR_4 | (VAR_4 >> 5); } } U += s->pic.linesize[1] * 2; V += s->pic.linesize[2] * 2; U2 += s->pic.linesize[1] * 2; V2 += s->pic.linesize[2] * 2; } } return 0; }
[ "static int FUNC_0(AVCodecContext *VAR_0, unsigned VAR_1)\n{", "XanContext *s = VAR_0->priv_data;", "uint8_t *U, *V;", "int VAR_2, VAR_3, VAR_4;", "int VAR_5, VAR_6;", "const uint8_t *VAR_7, *src_end;", "const uint8_t *VAR_8;", "int VAR_9, VAR_10, VAR_11;", "if (!VAR_1)\nreturn 0;", "if (VAR_1 + 4 >= bytestream2_get_bytes_left(&s->gb)) {", "av_log(VAR_0, AV_LOG_ERROR, \"Invalid chroma block position\\n\");", "return -1;", "}", "bytestream2_seek(&s->gb, VAR_1 + 4, SEEK_SET);", "VAR_9 = bytestream2_get_le16(&s->gb);", "VAR_8 = s->gb.buffer;", "VAR_10 = bytestream2_get_le16(&s->gb) * 2;", "if (VAR_10 >= bytestream2_get_bytes_left(&s->gb)) {", "av_log(VAR_0, AV_LOG_ERROR, \"Invalid chroma block VAR_10\\n\");", "return -1;", "}", "bytestream2_skip(&s->gb, VAR_10);", "memset(s->scratch_buffer, 0, s->buffer_size);", "VAR_11 = xan_unpack(s, s->scratch_buffer, s->buffer_size);", "if (VAR_11 < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"Chroma unpacking failed\\n\");", "return -1;", "}", "U = s->pic.data[1];", "V = s->pic.data[2];", "VAR_7 = s->scratch_buffer;", "src_end = VAR_7 + VAR_11;", "if (VAR_9) {", "for (VAR_6 = 0; VAR_6 < VAR_0->height >> 1; VAR_6++) {", "for (VAR_5 = 0; VAR_5 < VAR_0->width >> 1; VAR_5++) {", "VAR_2 = *VAR_7++;", "if (VAR_2) {", "VAR_2 = AV_RL16(VAR_8 + (VAR_2 << 1));", "VAR_3 = (VAR_2 >> 3) & 0xF8;", "VAR_4 = (VAR_2 >> 8) & 0xF8;", "U[VAR_5] = VAR_3 | (VAR_3 >> 5);", "V[VAR_5] = VAR_4 | (VAR_4 >> 5);", "}", "if (VAR_7 == src_end)\nreturn 0;", "}", "U += s->pic.linesize[1];", "V += s->pic.linesize[2];", "}", "} else {", "uint8_t *U2 = U + s->pic.linesize[1];", "uint8_t *V2 = V + s->pic.linesize[2];", "for (VAR_6 = 0; VAR_6 < VAR_0->height >> 2; VAR_6++) {", "for (VAR_5 = 0; VAR_5 < VAR_0->width >> 1; VAR_5 += 2) {", "VAR_2 = *VAR_7++;", "if (VAR_2) {", "VAR_2 = AV_RL16(VAR_8 + (VAR_2 << 1));", "VAR_3 = (VAR_2 >> 3) & 0xF8;", "VAR_4 = (VAR_2 >> 8) & 0xF8;", "U[VAR_5] = U[VAR_5+1] = U2[VAR_5] = U2[VAR_5+1] = VAR_3 | (VAR_3 >> 5);", "V[VAR_5] = V[VAR_5+1] = V2[VAR_5] = V2[VAR_5+1] = VAR_4 | (VAR_4 >> 5);", "}", "}", "U += s->pic.linesize[1] * 2;", "V += s->pic.linesize[2] * 2;", "U2 += s->pic.linesize[1] * 2;", "V2 += s->pic.linesize[2] * 2;", "}", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21, 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99, 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 155 ], [ 157 ] ]
5,505
void filter_mb(VP8Context *s, uint8_t *dst[3], VP8FilterStrength *f, int mb_x, int mb_y) { int mbedge_lim, bedge_lim, hev_thresh; int filter_level = f->filter_level; int inner_limit = f->inner_limit; int inner_filter = f->inner_filter; int linesize = s->linesize; int uvlinesize = s->uvlinesize; static const uint8_t hev_thresh_lut[2][64] = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 } }; if (!filter_level) return; bedge_lim = 2 * filter_level + inner_limit; mbedge_lim = bedge_lim + 4; hev_thresh = hev_thresh_lut[s->keyframe][filter_level]; if (mb_x) { s->vp8dsp.vp8_h_loop_filter16y(dst[0], linesize, mbedge_lim, inner_limit, hev_thresh); s->vp8dsp.vp8_h_loop_filter8uv(dst[1], dst[2], uvlinesize, mbedge_lim, inner_limit, hev_thresh); } if (inner_filter) { s->vp8dsp.vp8_h_loop_filter16y_inner(dst[0] + 4, linesize, bedge_lim, inner_limit, hev_thresh); s->vp8dsp.vp8_h_loop_filter16y_inner(dst[0] + 8, linesize, bedge_lim, inner_limit, hev_thresh); s->vp8dsp.vp8_h_loop_filter16y_inner(dst[0] + 12, linesize, bedge_lim, inner_limit, hev_thresh); s->vp8dsp.vp8_h_loop_filter8uv_inner(dst[1] + 4, dst[2] + 4, uvlinesize, bedge_lim, inner_limit, hev_thresh); } if (mb_y) { s->vp8dsp.vp8_v_loop_filter16y(dst[0], linesize, mbedge_lim, inner_limit, hev_thresh); s->vp8dsp.vp8_v_loop_filter8uv(dst[1], dst[2], uvlinesize, mbedge_lim, inner_limit, hev_thresh); } if (inner_filter) { s->vp8dsp.vp8_v_loop_filter16y_inner(dst[0] + 4 * linesize, linesize, bedge_lim, inner_limit, hev_thresh); s->vp8dsp.vp8_v_loop_filter16y_inner(dst[0] + 8 * linesize, linesize, bedge_lim, inner_limit, hev_thresh); s->vp8dsp.vp8_v_loop_filter16y_inner(dst[0] + 12 * linesize, linesize, bedge_lim, inner_limit, hev_thresh); s->vp8dsp.vp8_v_loop_filter8uv_inner(dst[1] + 4 * uvlinesize, dst[2] + 4 * uvlinesize, uvlinesize, bedge_lim, inner_limit, hev_thresh); } }
true
FFmpeg
ac4b32df71bd932838043a4838b86d11e169707f
void filter_mb(VP8Context *s, uint8_t *dst[3], VP8FilterStrength *f, int mb_x, int mb_y) { int mbedge_lim, bedge_lim, hev_thresh; int filter_level = f->filter_level; int inner_limit = f->inner_limit; int inner_filter = f->inner_filter; int linesize = s->linesize; int uvlinesize = s->uvlinesize; static const uint8_t hev_thresh_lut[2][64] = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 } }; if (!filter_level) return; bedge_lim = 2 * filter_level + inner_limit; mbedge_lim = bedge_lim + 4; hev_thresh = hev_thresh_lut[s->keyframe][filter_level]; if (mb_x) { s->vp8dsp.vp8_h_loop_filter16y(dst[0], linesize, mbedge_lim, inner_limit, hev_thresh); s->vp8dsp.vp8_h_loop_filter8uv(dst[1], dst[2], uvlinesize, mbedge_lim, inner_limit, hev_thresh); } if (inner_filter) { s->vp8dsp.vp8_h_loop_filter16y_inner(dst[0] + 4, linesize, bedge_lim, inner_limit, hev_thresh); s->vp8dsp.vp8_h_loop_filter16y_inner(dst[0] + 8, linesize, bedge_lim, inner_limit, hev_thresh); s->vp8dsp.vp8_h_loop_filter16y_inner(dst[0] + 12, linesize, bedge_lim, inner_limit, hev_thresh); s->vp8dsp.vp8_h_loop_filter8uv_inner(dst[1] + 4, dst[2] + 4, uvlinesize, bedge_lim, inner_limit, hev_thresh); } if (mb_y) { s->vp8dsp.vp8_v_loop_filter16y(dst[0], linesize, mbedge_lim, inner_limit, hev_thresh); s->vp8dsp.vp8_v_loop_filter8uv(dst[1], dst[2], uvlinesize, mbedge_lim, inner_limit, hev_thresh); } if (inner_filter) { s->vp8dsp.vp8_v_loop_filter16y_inner(dst[0] + 4 * linesize, linesize, bedge_lim, inner_limit, hev_thresh); s->vp8dsp.vp8_v_loop_filter16y_inner(dst[0] + 8 * linesize, linesize, bedge_lim, inner_limit, hev_thresh); s->vp8dsp.vp8_v_loop_filter16y_inner(dst[0] + 12 * linesize, linesize, bedge_lim, inner_limit, hev_thresh); s->vp8dsp.vp8_v_loop_filter8uv_inner(dst[1] + 4 * uvlinesize, dst[2] + 4 * uvlinesize, uvlinesize, bedge_lim, inner_limit, hev_thresh); } }
{ "code": [ " int mb_x, int mb_y)", " int mbedge_lim, bedge_lim, hev_thresh;", " bedge_lim = 2 * filter_level + inner_limit;", " mbedge_lim = bedge_lim + 4;", " if (inner_filter) {", " s->vp8dsp.vp8_h_loop_filter16y_inner(dst[0] + 4, linesize, bedge_lim,", " inner_limit, hev_thresh);", " s->vp8dsp.vp8_h_loop_filter16y_inner(dst[0] + 8, linesize, bedge_lim,", " inner_limit, hev_thresh);", " s->vp8dsp.vp8_h_loop_filter16y_inner(dst[0] + 12, linesize, bedge_lim,", " inner_limit, hev_thresh);", " s->vp8dsp.vp8_h_loop_filter8uv_inner(dst[1] + 4, dst[2] + 4,", " uvlinesize, bedge_lim,", " inner_limit, hev_thresh);", " linesize, bedge_lim,", " linesize, bedge_lim,", " linesize, bedge_lim,", " uvlinesize, bedge_lim," ], "line_no": [ 3, 7, 47, 49, 71, 73, 75, 77, 75, 81, 75, 85, 87, 75, 113, 113, 113, 87 ] }
void FUNC_0(VP8Context *VAR_0, uint8_t *VAR_1[3], VP8FilterStrength *VAR_2, int VAR_3, int VAR_4) { int VAR_5, VAR_6, VAR_7; int VAR_8 = VAR_2->VAR_8; int VAR_9 = VAR_2->VAR_9; int VAR_10 = VAR_2->VAR_10; int VAR_11 = VAR_0->VAR_11; int VAR_12 = VAR_0->VAR_12; static const uint8_t VAR_13[2][64] = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 } }; if (!VAR_8) return; VAR_6 = 2 * VAR_8 + VAR_9; VAR_5 = VAR_6 + 4; VAR_7 = VAR_13[VAR_0->keyframe][VAR_8]; if (VAR_3) { VAR_0->vp8dsp.vp8_h_loop_filter16y(VAR_1[0], VAR_11, VAR_5, VAR_9, VAR_7); VAR_0->vp8dsp.vp8_h_loop_filter8uv(VAR_1[1], VAR_1[2], VAR_12, VAR_5, VAR_9, VAR_7); } if (VAR_10) { VAR_0->vp8dsp.vp8_h_loop_filter16y_inner(VAR_1[0] + 4, VAR_11, VAR_6, VAR_9, VAR_7); VAR_0->vp8dsp.vp8_h_loop_filter16y_inner(VAR_1[0] + 8, VAR_11, VAR_6, VAR_9, VAR_7); VAR_0->vp8dsp.vp8_h_loop_filter16y_inner(VAR_1[0] + 12, VAR_11, VAR_6, VAR_9, VAR_7); VAR_0->vp8dsp.vp8_h_loop_filter8uv_inner(VAR_1[1] + 4, VAR_1[2] + 4, VAR_12, VAR_6, VAR_9, VAR_7); } if (VAR_4) { VAR_0->vp8dsp.vp8_v_loop_filter16y(VAR_1[0], VAR_11, VAR_5, VAR_9, VAR_7); VAR_0->vp8dsp.vp8_v_loop_filter8uv(VAR_1[1], VAR_1[2], VAR_12, VAR_5, VAR_9, VAR_7); } if (VAR_10) { VAR_0->vp8dsp.vp8_v_loop_filter16y_inner(VAR_1[0] + 4 * VAR_11, VAR_11, VAR_6, VAR_9, VAR_7); VAR_0->vp8dsp.vp8_v_loop_filter16y_inner(VAR_1[0] + 8 * VAR_11, VAR_11, VAR_6, VAR_9, VAR_7); VAR_0->vp8dsp.vp8_v_loop_filter16y_inner(VAR_1[0] + 12 * VAR_11, VAR_11, VAR_6, VAR_9, VAR_7); VAR_0->vp8dsp.vp8_v_loop_filter8uv_inner(VAR_1[1] + 4 * VAR_12, VAR_1[2] + 4 * VAR_12, VAR_12, VAR_6, VAR_9, VAR_7); } }
[ "void FUNC_0(VP8Context *VAR_0, uint8_t *VAR_1[3], VP8FilterStrength *VAR_2,\nint VAR_3, int VAR_4)\n{", "int VAR_5, VAR_6, VAR_7;", "int VAR_8 = VAR_2->VAR_8;", "int VAR_9 = VAR_2->VAR_9;", "int VAR_10 = VAR_2->VAR_10;", "int VAR_11 = VAR_0->VAR_11;", "int VAR_12 = VAR_0->VAR_12;", "static const uint8_t VAR_13[2][64] = {", "{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1,", "2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,\n3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,\n3, 3, 3, 3 },", "{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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,\n2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,\n2, 2, 2, 2 }", "};", "if (!VAR_8)\nreturn;", "VAR_6 = 2 * VAR_8 + VAR_9;", "VAR_5 = VAR_6 + 4;", "VAR_7 = VAR_13[VAR_0->keyframe][VAR_8];", "if (VAR_3) {", "VAR_0->vp8dsp.vp8_h_loop_filter16y(VAR_1[0], VAR_11,\nVAR_5, VAR_9, VAR_7);", "VAR_0->vp8dsp.vp8_h_loop_filter8uv(VAR_1[1], VAR_1[2], VAR_12,\nVAR_5, VAR_9, VAR_7);", "}", "if (VAR_10) {", "VAR_0->vp8dsp.vp8_h_loop_filter16y_inner(VAR_1[0] + 4, VAR_11, VAR_6,\nVAR_9, VAR_7);", "VAR_0->vp8dsp.vp8_h_loop_filter16y_inner(VAR_1[0] + 8, VAR_11, VAR_6,\nVAR_9, VAR_7);", "VAR_0->vp8dsp.vp8_h_loop_filter16y_inner(VAR_1[0] + 12, VAR_11, VAR_6,\nVAR_9, VAR_7);", "VAR_0->vp8dsp.vp8_h_loop_filter8uv_inner(VAR_1[1] + 4, VAR_1[2] + 4,\nVAR_12, VAR_6,\nVAR_9, VAR_7);", "}", "if (VAR_4) {", "VAR_0->vp8dsp.vp8_v_loop_filter16y(VAR_1[0], VAR_11,\nVAR_5, VAR_9, VAR_7);", "VAR_0->vp8dsp.vp8_v_loop_filter8uv(VAR_1[1], VAR_1[2], VAR_12,\nVAR_5, VAR_9, VAR_7);", "}", "if (VAR_10) {", "VAR_0->vp8dsp.vp8_v_loop_filter16y_inner(VAR_1[0] + 4 * VAR_11,\nVAR_11, VAR_6,\nVAR_9, VAR_7);", "VAR_0->vp8dsp.vp8_v_loop_filter16y_inner(VAR_1[0] + 8 * VAR_11,\nVAR_11, VAR_6,\nVAR_9, VAR_7);", "VAR_0->vp8dsp.vp8_v_loop_filter16y_inner(VAR_1[0] + 12 * VAR_11,\nVAR_11, VAR_6,\nVAR_9, VAR_7);", "VAR_0->vp8dsp.vp8_v_loop_filter8uv_inner(VAR_1[1] + 4 * VAR_12,\nVAR_1[2] + 4 * VAR_12,\nVAR_12, VAR_6,\nVAR_9, VAR_7);", "}", "}" ]
[ 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23, 25, 27 ], [ 29 ], [ 31, 33, 35 ], [ 37 ], [ 41, 43 ], [ 47 ], [ 49 ], [ 53 ], [ 57 ], [ 59, 61 ], [ 63, 65 ], [ 67 ], [ 71 ], [ 73, 75 ], [ 77, 79 ], [ 81, 83 ], [ 85, 87, 89 ], [ 91 ], [ 95 ], [ 97, 99 ], [ 101, 103 ], [ 105 ], [ 109 ], [ 111, 113, 115 ], [ 117, 119, 121 ], [ 123, 125, 127 ], [ 129, 131, 133, 135 ], [ 137 ], [ 139 ] ]
5,506
static void migrate_check_parameter(QTestState *who, const char *parameter, const char *value) { QDict *rsp, *rsp_return; const char *result; rsp = wait_command(who, "{ 'execute': 'query-migrate-parameters' }"); rsp_return = qdict_get_qdict(rsp, "return"); result = g_strdup_printf("%" PRId64, qdict_get_try_int(rsp_return, parameter, -1)); g_assert_cmpstr(result, ==, value); QDECREF(rsp); }
true
qemu
890241ab6942a0186eaf485dabf266a5a7aac428
static void migrate_check_parameter(QTestState *who, const char *parameter, const char *value) { QDict *rsp, *rsp_return; const char *result; rsp = wait_command(who, "{ 'execute': 'query-migrate-parameters' }"); rsp_return = qdict_get_qdict(rsp, "return"); result = g_strdup_printf("%" PRId64, qdict_get_try_int(rsp_return, parameter, -1)); g_assert_cmpstr(result, ==, value); QDECREF(rsp); }
{ "code": [ " const char *result;" ], "line_no": [ 9 ] }
static void FUNC_0(QTestState *VAR_0, const char *VAR_1, const char *VAR_2) { QDict *rsp, *rsp_return; const char *VAR_3; rsp = wait_command(VAR_0, "{ 'execute': 'query-migrate-parameters' }"); rsp_return = qdict_get_qdict(rsp, "return"); VAR_3 = g_strdup_printf("%" PRId64, qdict_get_try_int(rsp_return, VAR_1, -1)); g_assert_cmpstr(VAR_3, ==, VAR_2); QDECREF(rsp); }
[ "static void FUNC_0(QTestState *VAR_0, const char *VAR_1,\nconst char *VAR_2)\n{", "QDict *rsp, *rsp_return;", "const char *VAR_3;", "rsp = wait_command(VAR_0, \"{ 'execute': 'query-migrate-parameters' }\");", "rsp_return = qdict_get_qdict(rsp, \"return\");", "VAR_3 = g_strdup_printf(\"%\" PRId64,\nqdict_get_try_int(rsp_return, VAR_1, -1));", "g_assert_cmpstr(VAR_3, ==, VAR_2);", "QDECREF(rsp);", "}" ]
[ 0, 0, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17, 19 ], [ 21 ], [ 23 ], [ 25 ] ]
5,507
int ff_h264_decode_extradata(H264Context *h, const uint8_t *buf, int size) { AVCodecContext *avctx = h->s.avctx; if (!buf || size <= 0) return -1; if (buf[0] == 1) { int i, cnt, nalsize; const unsigned char *p = buf; h->is_avc = 1; if (size < 7) { av_log(avctx, AV_LOG_ERROR, "avcC too short\n"); return -1; } /* sps and pps in the avcC always have length coded with 2 bytes, * so put a fake nal_length_size = 2 while parsing them */ h->nal_length_size = 2; // Decode sps from avcC cnt = *(p + 5) & 0x1f; // Number of sps p += 6; for (i = 0; i < cnt; i++) { nalsize = AV_RB16(p) + 2; if(nalsize > size - (p-buf)) return -1; if (decode_nal_units(h, p, nalsize) < 0) { av_log(avctx, AV_LOG_ERROR, "Decoding sps %d from avcC failed\n", i); return -1; } p += nalsize; } // Decode pps from avcC cnt = *(p++); // Number of pps for (i = 0; i < cnt; i++) { nalsize = AV_RB16(p) + 2; if(nalsize > size - (p-buf)) return -1; if (decode_nal_units(h, p, nalsize) < 0) { av_log(avctx, AV_LOG_ERROR, "Decoding pps %d from avcC failed\n", i); return -1; } p += nalsize; } // Now store right nal length size, that will be used to parse all other nals h->nal_length_size = (buf[4] & 0x03) + 1; } else { h->is_avc = 0; if (decode_nal_units(h, buf, size) < 0) return -1; } return size; }
true
FFmpeg
4fecc3cf0998927456a9f8d8334587dd64154ec5
int ff_h264_decode_extradata(H264Context *h, const uint8_t *buf, int size) { AVCodecContext *avctx = h->s.avctx; if (!buf || size <= 0) return -1; if (buf[0] == 1) { int i, cnt, nalsize; const unsigned char *p = buf; h->is_avc = 1; if (size < 7) { av_log(avctx, AV_LOG_ERROR, "avcC too short\n"); return -1; } h->nal_length_size = 2; cnt = *(p + 5) & 0x1f; p += 6; for (i = 0; i < cnt; i++) { nalsize = AV_RB16(p) + 2; if(nalsize > size - (p-buf)) return -1; if (decode_nal_units(h, p, nalsize) < 0) { av_log(avctx, AV_LOG_ERROR, "Decoding sps %d from avcC failed\n", i); return -1; } p += nalsize; } cnt = *(p++); for (i = 0; i < cnt; i++) { nalsize = AV_RB16(p) + 2; if(nalsize > size - (p-buf)) return -1; if (decode_nal_units(h, p, nalsize) < 0) { av_log(avctx, AV_LOG_ERROR, "Decoding pps %d from avcC failed\n", i); return -1; } p += nalsize; } h->nal_length_size = (buf[4] & 0x03) + 1; } else { h->is_avc = 0; if (decode_nal_units(h, buf, size) < 0) return -1; } return size; }
{ "code": [ "int ff_h264_decode_extradata(H264Context *h, const uint8_t *buf, int size)" ], "line_no": [ 1 ] }
int FUNC_0(H264Context *VAR_0, const uint8_t *VAR_1, int VAR_2) { AVCodecContext *avctx = VAR_0->s.avctx; if (!VAR_1 || VAR_2 <= 0) return -1; if (VAR_1[0] == 1) { int VAR_3, VAR_4, VAR_5; const unsigned char *VAR_6 = VAR_1; VAR_0->is_avc = 1; if (VAR_2 < 7) { av_log(avctx, AV_LOG_ERROR, "avcC too short\n"); return -1; } VAR_0->nal_length_size = 2; VAR_4 = *(VAR_6 + 5) & 0x1f; VAR_6 += 6; for (VAR_3 = 0; VAR_3 < VAR_4; VAR_3++) { VAR_5 = AV_RB16(VAR_6) + 2; if(VAR_5 > VAR_2 - (VAR_6-VAR_1)) return -1; if (decode_nal_units(VAR_0, VAR_6, VAR_5) < 0) { av_log(avctx, AV_LOG_ERROR, "Decoding sps %d from avcC failed\n", VAR_3); return -1; } VAR_6 += VAR_5; } VAR_4 = *(VAR_6++); for (VAR_3 = 0; VAR_3 < VAR_4; VAR_3++) { VAR_5 = AV_RB16(VAR_6) + 2; if(VAR_5 > VAR_2 - (VAR_6-VAR_1)) return -1; if (decode_nal_units(VAR_0, VAR_6, VAR_5) < 0) { av_log(avctx, AV_LOG_ERROR, "Decoding pps %d from avcC failed\n", VAR_3); return -1; } VAR_6 += VAR_5; } VAR_0->nal_length_size = (VAR_1[4] & 0x03) + 1; } else { VAR_0->is_avc = 0; if (decode_nal_units(VAR_0, VAR_1, VAR_2) < 0) return -1; } return VAR_2; }
[ "int FUNC_0(H264Context *VAR_0, const uint8_t *VAR_1, int VAR_2)\n{", "AVCodecContext *avctx = VAR_0->s.avctx;", "if (!VAR_1 || VAR_2 <= 0)\nreturn -1;", "if (VAR_1[0] == 1) {", "int VAR_3, VAR_4, VAR_5;", "const unsigned char *VAR_6 = VAR_1;", "VAR_0->is_avc = 1;", "if (VAR_2 < 7) {", "av_log(avctx, AV_LOG_ERROR, \"avcC too short\\n\");", "return -1;", "}", "VAR_0->nal_length_size = 2;", "VAR_4 = *(VAR_6 + 5) & 0x1f;", "VAR_6 += 6;", "for (VAR_3 = 0; VAR_3 < VAR_4; VAR_3++) {", "VAR_5 = AV_RB16(VAR_6) + 2;", "if(VAR_5 > VAR_2 - (VAR_6-VAR_1))\nreturn -1;", "if (decode_nal_units(VAR_0, VAR_6, VAR_5) < 0) {", "av_log(avctx, AV_LOG_ERROR,\n\"Decoding sps %d from avcC failed\\n\", VAR_3);", "return -1;", "}", "VAR_6 += VAR_5;", "}", "VAR_4 = *(VAR_6++);", "for (VAR_3 = 0; VAR_3 < VAR_4; VAR_3++) {", "VAR_5 = AV_RB16(VAR_6) + 2;", "if(VAR_5 > VAR_2 - (VAR_6-VAR_1))\nreturn -1;", "if (decode_nal_units(VAR_0, VAR_6, VAR_5) < 0) {", "av_log(avctx, AV_LOG_ERROR,\n\"Decoding pps %d from avcC failed\\n\", VAR_3);", "return -1;", "}", "VAR_6 += VAR_5;", "}", "VAR_0->nal_length_size = (VAR_1[4] & 0x03) + 1;", "} else {", "VAR_0->is_avc = 0;", "if (decode_nal_units(VAR_0, VAR_1, VAR_2) < 0)\nreturn -1;", "}", "return VAR_2;", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51, 53 ], [ 55 ], [ 57, 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77, 79 ], [ 81 ], [ 83, 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 97 ], [ 99 ], [ 101 ], [ 103, 105 ], [ 107 ], [ 109 ], [ 111 ] ]
5,511
static void spr_write_hdecr(DisasContext *ctx, int sprn, int gprn) { if (ctx->tb->cflags & CF_USE_ICOUNT) { gen_io_start(); } gen_helper_store_hdecr(cpu_env, cpu_gpr[gprn]); if (ctx->tb->cflags & CF_USE_ICOUNT) { gen_io_end(); gen_stop_exception(ctx); } }
true
qemu
c5a49c63fa26e8825ad101dfe86339ae4c216539
static void spr_write_hdecr(DisasContext *ctx, int sprn, int gprn) { if (ctx->tb->cflags & CF_USE_ICOUNT) { gen_io_start(); } gen_helper_store_hdecr(cpu_env, cpu_gpr[gprn]); if (ctx->tb->cflags & CF_USE_ICOUNT) { gen_io_end(); gen_stop_exception(ctx); } }
{ "code": [ " if (ctx->tb->cflags & CF_USE_ICOUNT) {", " if (ctx->tb->cflags & CF_USE_ICOUNT) {", " if (ctx->tb->cflags & CF_USE_ICOUNT) {", " if (ctx->tb->cflags & CF_USE_ICOUNT) {", " if (ctx->tb->cflags & CF_USE_ICOUNT) {", " if (ctx->tb->cflags & CF_USE_ICOUNT) {", " if (ctx->tb->cflags & CF_USE_ICOUNT) {", " if (ctx->tb->cflags & CF_USE_ICOUNT) {", " if (ctx->tb->cflags & CF_USE_ICOUNT) {", " if (ctx->tb->cflags & CF_USE_ICOUNT) {", " if (ctx->tb->cflags & CF_USE_ICOUNT) {", " if (ctx->tb->cflags & CF_USE_ICOUNT) {", " if (ctx->tb->cflags & CF_USE_ICOUNT) {", " if (ctx->tb->cflags & CF_USE_ICOUNT) {", " if (ctx->tb->cflags & CF_USE_ICOUNT) {", " if (ctx->tb->cflags & CF_USE_ICOUNT) {", " if (ctx->tb->cflags & CF_USE_ICOUNT) {", " if (ctx->tb->cflags & CF_USE_ICOUNT) {", " if (ctx->tb->cflags & CF_USE_ICOUNT) {", " if (ctx->tb->cflags & CF_USE_ICOUNT) {" ], "line_no": [ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 ] }
static void FUNC_0(DisasContext *VAR_0, int VAR_1, int VAR_2) { if (VAR_0->tb->cflags & CF_USE_ICOUNT) { gen_io_start(); } gen_helper_store_hdecr(cpu_env, cpu_gpr[VAR_2]); if (VAR_0->tb->cflags & CF_USE_ICOUNT) { gen_io_end(); gen_stop_exception(VAR_0); } }
[ "static void FUNC_0(DisasContext *VAR_0, int VAR_1, int VAR_2)\n{", "if (VAR_0->tb->cflags & CF_USE_ICOUNT) {", "gen_io_start();", "}", "gen_helper_store_hdecr(cpu_env, cpu_gpr[VAR_2]);", "if (VAR_0->tb->cflags & CF_USE_ICOUNT) {", "gen_io_end();", "gen_stop_exception(VAR_0);", "}", "}" ]
[ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
5,512
static int ioreq_parse(struct ioreq *ioreq) { struct XenBlkDev *blkdev = ioreq->blkdev; uintptr_t mem; size_t len; int i; xen_be_printf(&blkdev->xendev, 3, "op %d, nr %d, handle %d, id %" PRId64 ", sector %" PRId64 "\n", ioreq->req.operation, ioreq->req.nr_segments, ioreq->req.handle, ioreq->req.id, ioreq->req.sector_number); switch (ioreq->req.operation) { case BLKIF_OP_READ: ioreq->prot = PROT_WRITE; /* to memory */ if (ioreq->req.operation != BLKIF_OP_READ && blkdev->mode[0] != 'w') { xen_be_printf(&blkdev->xendev, 0, "error: write req for ro device\n"); goto err; } break; case BLKIF_OP_WRITE_BARRIER: if (!syncwrite) ioreq->presync = ioreq->postsync = 1; /* fall through */ case BLKIF_OP_WRITE: ioreq->prot = PROT_READ; /* from memory */ if (syncwrite) ioreq->postsync = 1; break; default: xen_be_printf(&blkdev->xendev, 0, "error: unknown operation (%d)\n", ioreq->req.operation); goto err; }; ioreq->start = ioreq->req.sector_number * blkdev->file_blk; for (i = 0; i < ioreq->req.nr_segments; i++) { if (i == BLKIF_MAX_SEGMENTS_PER_REQUEST) { xen_be_printf(&blkdev->xendev, 0, "error: nr_segments too big\n"); goto err; } if (ioreq->req.seg[i].first_sect > ioreq->req.seg[i].last_sect) { xen_be_printf(&blkdev->xendev, 0, "error: first > last sector\n"); goto err; } if (ioreq->req.seg[i].last_sect * BLOCK_SIZE >= XC_PAGE_SIZE) { xen_be_printf(&blkdev->xendev, 0, "error: page crossing\n"); goto err; } ioreq->domids[i] = blkdev->xendev.dom; ioreq->refs[i] = ioreq->req.seg[i].gref; mem = ioreq->req.seg[i].first_sect * blkdev->file_blk; len = (ioreq->req.seg[i].last_sect - ioreq->req.seg[i].first_sect + 1) * blkdev->file_blk; qemu_iovec_add(&ioreq->v, (void*)mem, len); } if (ioreq->start + ioreq->v.size > blkdev->file_size) { xen_be_printf(&blkdev->xendev, 0, "error: access beyond end of file\n"); goto err; } return 0; err: ioreq->status = BLKIF_RSP_ERROR; return -1; }
true
qemu
908c7b9f788b6faed2fbfdf19920770614f8e853
static int ioreq_parse(struct ioreq *ioreq) { struct XenBlkDev *blkdev = ioreq->blkdev; uintptr_t mem; size_t len; int i; xen_be_printf(&blkdev->xendev, 3, "op %d, nr %d, handle %d, id %" PRId64 ", sector %" PRId64 "\n", ioreq->req.operation, ioreq->req.nr_segments, ioreq->req.handle, ioreq->req.id, ioreq->req.sector_number); switch (ioreq->req.operation) { case BLKIF_OP_READ: ioreq->prot = PROT_WRITE; if (ioreq->req.operation != BLKIF_OP_READ && blkdev->mode[0] != 'w') { xen_be_printf(&blkdev->xendev, 0, "error: write req for ro device\n"); goto err; } break; case BLKIF_OP_WRITE_BARRIER: if (!syncwrite) ioreq->presync = ioreq->postsync = 1; case BLKIF_OP_WRITE: ioreq->prot = PROT_READ; if (syncwrite) ioreq->postsync = 1; break; default: xen_be_printf(&blkdev->xendev, 0, "error: unknown operation (%d)\n", ioreq->req.operation); goto err; }; ioreq->start = ioreq->req.sector_number * blkdev->file_blk; for (i = 0; i < ioreq->req.nr_segments; i++) { if (i == BLKIF_MAX_SEGMENTS_PER_REQUEST) { xen_be_printf(&blkdev->xendev, 0, "error: nr_segments too big\n"); goto err; } if (ioreq->req.seg[i].first_sect > ioreq->req.seg[i].last_sect) { xen_be_printf(&blkdev->xendev, 0, "error: first > last sector\n"); goto err; } if (ioreq->req.seg[i].last_sect * BLOCK_SIZE >= XC_PAGE_SIZE) { xen_be_printf(&blkdev->xendev, 0, "error: page crossing\n"); goto err; } ioreq->domids[i] = blkdev->xendev.dom; ioreq->refs[i] = ioreq->req.seg[i].gref; mem = ioreq->req.seg[i].first_sect * blkdev->file_blk; len = (ioreq->req.seg[i].last_sect - ioreq->req.seg[i].first_sect + 1) * blkdev->file_blk; qemu_iovec_add(&ioreq->v, (void*)mem, len); } if (ioreq->start + ioreq->v.size > blkdev->file_size) { xen_be_printf(&blkdev->xendev, 0, "error: access beyond end of file\n"); goto err; } return 0; err: ioreq->status = BLKIF_RSP_ERROR; return -1; }
{ "code": [ " if (ioreq->req.operation != BLKIF_OP_READ && blkdev->mode[0] != 'w') {", "\t xen_be_printf(&blkdev->xendev, 0, \"error: write req for ro device\\n\");", "\t goto err;" ], "line_no": [ 29, 31, 33 ] }
static int FUNC_0(struct VAR_0 *VAR_0) { struct XenBlkDev *VAR_1 = VAR_0->VAR_1; uintptr_t mem; size_t len; int VAR_2; xen_be_printf(&VAR_1->xendev, 3, "op %d, nr %d, handle %d, id %" PRId64 ", sector %" PRId64 "\n", VAR_0->req.operation, VAR_0->req.nr_segments, VAR_0->req.handle, VAR_0->req.id, VAR_0->req.sector_number); switch (VAR_0->req.operation) { case BLKIF_OP_READ: VAR_0->prot = PROT_WRITE; if (VAR_0->req.operation != BLKIF_OP_READ && VAR_1->mode[0] != 'w') { xen_be_printf(&VAR_1->xendev, 0, "error: write req for ro device\n"); goto err; } break; case BLKIF_OP_WRITE_BARRIER: if (!syncwrite) VAR_0->presync = VAR_0->postsync = 1; case BLKIF_OP_WRITE: VAR_0->prot = PROT_READ; if (syncwrite) VAR_0->postsync = 1; break; default: xen_be_printf(&VAR_1->xendev, 0, "error: unknown operation (%d)\n", VAR_0->req.operation); goto err; }; VAR_0->start = VAR_0->req.sector_number * VAR_1->file_blk; for (VAR_2 = 0; VAR_2 < VAR_0->req.nr_segments; VAR_2++) { if (VAR_2 == BLKIF_MAX_SEGMENTS_PER_REQUEST) { xen_be_printf(&VAR_1->xendev, 0, "error: nr_segments too big\n"); goto err; } if (VAR_0->req.seg[VAR_2].first_sect > VAR_0->req.seg[VAR_2].last_sect) { xen_be_printf(&VAR_1->xendev, 0, "error: first > last sector\n"); goto err; } if (VAR_0->req.seg[VAR_2].last_sect * BLOCK_SIZE >= XC_PAGE_SIZE) { xen_be_printf(&VAR_1->xendev, 0, "error: page crossing\n"); goto err; } VAR_0->domids[VAR_2] = VAR_1->xendev.dom; VAR_0->refs[VAR_2] = VAR_0->req.seg[VAR_2].gref; mem = VAR_0->req.seg[VAR_2].first_sect * VAR_1->file_blk; len = (VAR_0->req.seg[VAR_2].last_sect - VAR_0->req.seg[VAR_2].first_sect + 1) * VAR_1->file_blk; qemu_iovec_add(&VAR_0->v, (void*)mem, len); } if (VAR_0->start + VAR_0->v.size > VAR_1->file_size) { xen_be_printf(&VAR_1->xendev, 0, "error: access beyond end of file\n"); goto err; } return 0; err: VAR_0->status = BLKIF_RSP_ERROR; return -1; }
[ "static int FUNC_0(struct VAR_0 *VAR_0)\n{", "struct XenBlkDev *VAR_1 = VAR_0->VAR_1;", "uintptr_t mem;", "size_t len;", "int VAR_2;", "xen_be_printf(&VAR_1->xendev, 3,\n\"op %d, nr %d, handle %d, id %\" PRId64 \", sector %\" PRId64 \"\\n\",\nVAR_0->req.operation, VAR_0->req.nr_segments,\nVAR_0->req.handle, VAR_0->req.id, VAR_0->req.sector_number);", "switch (VAR_0->req.operation) {", "case BLKIF_OP_READ:\nVAR_0->prot = PROT_WRITE;", "if (VAR_0->req.operation != BLKIF_OP_READ && VAR_1->mode[0] != 'w') {", "xen_be_printf(&VAR_1->xendev, 0, \"error: write req for ro device\\n\");", "goto err;", "}", "break;", "case BLKIF_OP_WRITE_BARRIER:\nif (!syncwrite)\nVAR_0->presync = VAR_0->postsync = 1;", "case BLKIF_OP_WRITE:\nVAR_0->prot = PROT_READ;", "if (syncwrite)\nVAR_0->postsync = 1;", "break;", "default:\nxen_be_printf(&VAR_1->xendev, 0, \"error: unknown operation (%d)\\n\",\nVAR_0->req.operation);", "goto err;", "};", "VAR_0->start = VAR_0->req.sector_number * VAR_1->file_blk;", "for (VAR_2 = 0; VAR_2 < VAR_0->req.nr_segments; VAR_2++) {", "if (VAR_2 == BLKIF_MAX_SEGMENTS_PER_REQUEST) {", "xen_be_printf(&VAR_1->xendev, 0, \"error: nr_segments too big\\n\");", "goto err;", "}", "if (VAR_0->req.seg[VAR_2].first_sect > VAR_0->req.seg[VAR_2].last_sect) {", "xen_be_printf(&VAR_1->xendev, 0, \"error: first > last sector\\n\");", "goto err;", "}", "if (VAR_0->req.seg[VAR_2].last_sect * BLOCK_SIZE >= XC_PAGE_SIZE) {", "xen_be_printf(&VAR_1->xendev, 0, \"error: page crossing\\n\");", "goto err;", "}", "VAR_0->domids[VAR_2] = VAR_1->xendev.dom;", "VAR_0->refs[VAR_2] = VAR_0->req.seg[VAR_2].gref;", "mem = VAR_0->req.seg[VAR_2].first_sect * VAR_1->file_blk;", "len = (VAR_0->req.seg[VAR_2].last_sect - VAR_0->req.seg[VAR_2].first_sect + 1) * VAR_1->file_blk;", "qemu_iovec_add(&VAR_0->v, (void*)mem, len);", "}", "if (VAR_0->start + VAR_0->v.size > VAR_1->file_size) {", "xen_be_printf(&VAR_1->xendev, 0, \"error: access beyond end of file\\n\");", "goto err;", "}", "return 0;", "err:\nVAR_0->status = BLKIF_RSP_ERROR;", "return -1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 55 ], [ 57, 59, 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99 ], [ 101 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 125, 127 ], [ 129 ], [ 131 ] ]
5,513
static void test_qemu_strtoul_full_empty(void) { const char *str = ""; unsigned long res = 999; int err; err = qemu_strtoul(str, NULL, 0, &res); g_assert_cmpint(err, ==, 0); g_assert_cmpint(res, ==, 0); }
true
qemu
47d4be12c3997343e436c6cca89aefbbbeb70863
static void test_qemu_strtoul_full_empty(void) { const char *str = ""; unsigned long res = 999; int err; err = qemu_strtoul(str, NULL, 0, &res); g_assert_cmpint(err, ==, 0); g_assert_cmpint(res, ==, 0); }
{ "code": [ " g_assert_cmpint(err, ==, 0);", " g_assert_cmpint(res, ==, 0);", " g_assert_cmpint(err, ==, 0);", " g_assert_cmpint(res, ==, 0);", " g_assert_cmpint(err, ==, 0);", " g_assert_cmpint(res, ==, 0);", " g_assert_cmpint(err, ==, 0);", " g_assert_cmpint(res, ==, 0);", " g_assert_cmpint(err, ==, 0);", " g_assert_cmpint(res, ==, 0);", " g_assert_cmpint(err, ==, 0);", " g_assert_cmpint(res, ==, 0);", " g_assert_cmpint(err, ==, 0);", " g_assert_cmpint(err, ==, 0);", " g_assert_cmpint(res, ==, 0);", " g_assert_cmpint(err, ==, 0);", " g_assert_cmpint(res, ==, 0);", " g_assert_cmpint(err, ==, 0);", " g_assert_cmpint(res, ==, 0);", " g_assert_cmpint(err, ==, 0);", " g_assert_cmpint(err, ==, 0);", " g_assert_cmpint(res, ==, 0);", " g_assert_cmpint(err, ==, 0);", " g_assert_cmpint(res, ==, 0);", " g_assert_cmpint(err, ==, 0);", " g_assert_cmpint(res, ==, 0);", " g_assert_cmpint(err, ==, 0);", " g_assert_cmpint(err, ==, 0);", " g_assert_cmpint(res, ==, 0);" ], "line_no": [ 17, 19, 17, 19, 17, 19, 17, 19, 17, 19, 17, 19, 17, 17, 19, 17, 19, 17, 19, 17, 17, 19, 17, 19, 17, 19, 17, 17, 19 ] }
static void FUNC_0(void) { const char *VAR_0 = ""; unsigned long VAR_1 = 999; int VAR_2; VAR_2 = qemu_strtoul(VAR_0, NULL, 0, &VAR_1); g_assert_cmpint(VAR_2, ==, 0); g_assert_cmpint(VAR_1, ==, 0); }
[ "static void FUNC_0(void)\n{", "const char *VAR_0 = \"\";", "unsigned long VAR_1 = 999;", "int VAR_2;", "VAR_2 = qemu_strtoul(VAR_0, NULL, 0, &VAR_1);", "g_assert_cmpint(VAR_2, ==, 0);", "g_assert_cmpint(VAR_1, ==, 0);", "}" ]
[ 0, 0, 0, 0, 0, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ] ]
5,514
static void xen_sysdev_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); k->init = xen_sysdev_init; dc->props = xen_sysdev_properties; dc->bus_type = TYPE_XENSYSBUS; }
true
qemu
e4f4fb1eca795e36f363b4647724221e774523c1
static void xen_sysdev_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); k->init = xen_sysdev_init; dc->props = xen_sysdev_properties; dc->bus_type = TYPE_XENSYSBUS; }
{ "code": [], "line_no": [] }
static void FUNC_0(ObjectClass *VAR_0, void *VAR_1) { DeviceClass *dc = DEVICE_CLASS(VAR_0); SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(VAR_0); k->init = xen_sysdev_init; dc->props = xen_sysdev_properties; dc->bus_type = TYPE_XENSYSBUS; }
[ "static void FUNC_0(ObjectClass *VAR_0, void *VAR_1)\n{", "DeviceClass *dc = DEVICE_CLASS(VAR_0);", "SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(VAR_0);", "k->init = xen_sysdev_init;", "dc->props = xen_sysdev_properties;", "dc->bus_type = TYPE_XENSYSBUS;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 22 ] ]
5,515
static int vqf_read_header(AVFormatContext *s) { VqfContext *c = s->priv_data; AVStream *st = avformat_new_stream(s, NULL); int chunk_tag; int rate_flag = -1; int header_size; int read_bitrate = 0; int size; uint8_t comm_chunk[12]; if (!st) return AVERROR(ENOMEM); avio_skip(s->pb, 12); header_size = avio_rb32(s->pb); st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_id = AV_CODEC_ID_TWINVQ; st->start_time = 0; do { int len; chunk_tag = avio_rl32(s->pb); if (chunk_tag == MKTAG('D','A','T','A')) break; len = avio_rb32(s->pb); if ((unsigned) len > INT_MAX/2) { av_log(s, AV_LOG_ERROR, "Malformed header\n"); header_size -= 8; switch(chunk_tag){ case MKTAG('C','O','M','M'): avio_read(s->pb, comm_chunk, 12); st->codec->channels = AV_RB32(comm_chunk ) + 1; read_bitrate = AV_RB32(comm_chunk + 4); rate_flag = AV_RB32(comm_chunk + 8); avio_skip(s->pb, len-12); st->codec->bit_rate = read_bitrate*1000; break; case MKTAG('D','S','I','Z'): // size of compressed data { char buf[8] = {0}; int size = avio_rb32(s->pb); snprintf(buf, sizeof(buf), "%d", size); av_dict_set(&s->metadata, "size", buf, 0); break; case MKTAG('Y','E','A','R'): // recording date case MKTAG('E','N','C','D'): // compression date case MKTAG('E','X','T','R'): // reserved case MKTAG('_','Y','M','H'): // reserved case MKTAG('_','N','T','T'): // reserved case MKTAG('_','I','D','3'): // reserved for ID3 tags avio_skip(s->pb, FFMIN(len, header_size)); break; default: add_metadata(s, chunk_tag, len, header_size); break; header_size -= len; } while (header_size >= 0); switch (rate_flag) { case -1: av_log(s, AV_LOG_ERROR, "COMM tag not found!\n"); case 44: st->codec->sample_rate = 44100; break; case 22: st->codec->sample_rate = 22050; break; case 11: st->codec->sample_rate = 11025; break; default: st->codec->sample_rate = rate_flag*1000; break; switch (((st->codec->sample_rate/1000) << 8) + read_bitrate/st->codec->channels) { case (11<<8) + 8 : case (8 <<8) + 8 : case (11<<8) + 10: case (22<<8) + 32: size = 512; break; case (16<<8) + 16: case (22<<8) + 20: case (22<<8) + 24: size = 1024; break; case (44<<8) + 40: case (44<<8) + 48: size = 2048; break; default: av_log(s, AV_LOG_ERROR, "Mode not suported: %d Hz, %d kb/s.\n", st->codec->sample_rate, st->codec->bit_rate); c->frame_bit_len = st->codec->bit_rate*size/st->codec->sample_rate; avpriv_set_pts_info(st, 64, size, st->codec->sample_rate); /* put first 12 bytes of COMM chunk in extradata */ if (!(st->codec->extradata = av_malloc(12 + FF_INPUT_BUFFER_PADDING_SIZE))) return AVERROR(ENOMEM); st->codec->extradata_size = 12; memcpy(st->codec->extradata, comm_chunk, 12); ff_metadata_conv_ctx(s, NULL, vqf_metadata_conv); return 0;
true
FFmpeg
e481ba2ed79421d82ed631d187c05c03260c6561
static int vqf_read_header(AVFormatContext *s) { VqfContext *c = s->priv_data; AVStream *st = avformat_new_stream(s, NULL); int chunk_tag; int rate_flag = -1; int header_size; int read_bitrate = 0; int size; uint8_t comm_chunk[12]; if (!st) return AVERROR(ENOMEM); avio_skip(s->pb, 12); header_size = avio_rb32(s->pb); st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_id = AV_CODEC_ID_TWINVQ; st->start_time = 0; do { int len; chunk_tag = avio_rl32(s->pb); if (chunk_tag == MKTAG('D','A','T','A')) break; len = avio_rb32(s->pb); if ((unsigned) len > INT_MAX/2) { av_log(s, AV_LOG_ERROR, "Malformed header\n"); header_size -= 8; switch(chunk_tag){ case MKTAG('C','O','M','M'): avio_read(s->pb, comm_chunk, 12); st->codec->channels = AV_RB32(comm_chunk ) + 1; read_bitrate = AV_RB32(comm_chunk + 4); rate_flag = AV_RB32(comm_chunk + 8); avio_skip(s->pb, len-12); st->codec->bit_rate = read_bitrate*1000; break; case MKTAG('D','S','I','Z'): { char buf[8] = {0}; int size = avio_rb32(s->pb); snprintf(buf, sizeof(buf), "%d", size); av_dict_set(&s->metadata, "size", buf, 0); break; case MKTAG('Y','E','A','R'): case MKTAG('E','N','C','D'): case MKTAG('E','X','T','R'): case MKTAG('_','Y','M','H'): case MKTAG('_','N','T','T'): case MKTAG('_','I','D','3'): for ID3 tags avio_skip(s->pb, FFMIN(len, header_size)); break; default: add_metadata(s, chunk_tag, len, header_size); break; header_size -= len; } while (header_size >= 0); switch (rate_flag) { case -1: av_log(s, AV_LOG_ERROR, "COMM tag not found!\n"); case 44: st->codec->sample_rate = 44100; break; case 22: st->codec->sample_rate = 22050; break; case 11: st->codec->sample_rate = 11025; break; default: st->codec->sample_rate = rate_flag*1000; break; switch (((st->codec->sample_rate/1000) << 8) + read_bitrate/st->codec->channels) { case (11<<8) + 8 : case (8 <<8) + 8 : case (11<<8) + 10: case (22<<8) + 32: size = 512; break; case (16<<8) + 16: case (22<<8) + 20: case (22<<8) + 24: size = 1024; break; case (44<<8) + 40: case (44<<8) + 48: size = 2048; break; default: av_log(s, AV_LOG_ERROR, "Mode not suported: %d Hz, %d kb/s.\n", st->codec->sample_rate, st->codec->bit_rate); c->frame_bit_len = st->codec->bit_rate*size/st->codec->sample_rate; avpriv_set_pts_info(st, 64, size, st->codec->sample_rate); if (!(st->codec->extradata = av_malloc(12 + FF_INPUT_BUFFER_PADDING_SIZE))) return AVERROR(ENOMEM); st->codec->extradata_size = 12; memcpy(st->codec->extradata, comm_chunk, 12); ff_metadata_conv_ctx(s, NULL, vqf_metadata_conv); return 0;
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0) { VqfContext *c = VAR_0->priv_data; AVStream *st = avformat_new_stream(VAR_0, NULL); int VAR_1; int VAR_2 = -1; int VAR_3; int VAR_4 = 0; int VAR_5; uint8_t comm_chunk[12]; if (!st) return AVERROR(ENOMEM); avio_skip(VAR_0->pb, 12); VAR_3 = avio_rb32(VAR_0->pb); st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_id = AV_CODEC_ID_TWINVQ; st->start_time = 0; do { int len; VAR_1 = avio_rl32(VAR_0->pb); if (VAR_1 == MKTAG('D','A','T','A')) break; len = avio_rb32(VAR_0->pb); if ((unsigned) len > INT_MAX/2) { av_log(VAR_0, AV_LOG_ERROR, "Malformed header\n"); VAR_3 -= 8; switch(VAR_1){ case MKTAG('C','O','M','M'): avio_read(VAR_0->pb, comm_chunk, 12); st->codec->channels = AV_RB32(comm_chunk ) + 1; VAR_4 = AV_RB32(comm_chunk + 4); VAR_2 = AV_RB32(comm_chunk + 8); avio_skip(VAR_0->pb, len-12); st->codec->bit_rate = VAR_4*1000; break; case MKTAG('D','S','I','Z'): { char buf[8] = {0}; int VAR_5 = avio_rb32(VAR_0->pb); snprintf(buf, sizeof(buf), "%d", VAR_5); av_dict_set(&VAR_0->metadata, "VAR_5", buf, 0); break; case MKTAG('Y','E','A','R'): case MKTAG('E','N','C','D'): case MKTAG('E','X','T','R'): case MKTAG('_','Y','M','H'): case MKTAG('_','N','T','T'): case MKTAG('_','I','D','3'): for ID3 tags avio_skip(VAR_0->pb, FFMIN(len, VAR_3)); break; default: add_metadata(VAR_0, VAR_1, len, VAR_3); break; VAR_3 -= len; } while (VAR_3 >= 0); switch (VAR_2) { case -1: av_log(VAR_0, AV_LOG_ERROR, "COMM tag not found!\n"); case 44: st->codec->sample_rate = 44100; break; case 22: st->codec->sample_rate = 22050; break; case 11: st->codec->sample_rate = 11025; break; default: st->codec->sample_rate = VAR_2*1000; break; switch (((st->codec->sample_rate/1000) << 8) + VAR_4/st->codec->channels) { case (11<<8) + 8 : case (8 <<8) + 8 : case (11<<8) + 10: case (22<<8) + 32: VAR_5 = 512; break; case (16<<8) + 16: case (22<<8) + 20: case (22<<8) + 24: VAR_5 = 1024; break; case (44<<8) + 40: case (44<<8) + 48: VAR_5 = 2048; break; default: av_log(VAR_0, AV_LOG_ERROR, "Mode not suported: %d Hz, %d kb/VAR_0.\n", st->codec->sample_rate, st->codec->bit_rate); c->frame_bit_len = st->codec->bit_rate*VAR_5/st->codec->sample_rate; avpriv_set_pts_info(st, 64, VAR_5, st->codec->sample_rate); if (!(st->codec->extradata = av_malloc(12 + FF_INPUT_BUFFER_PADDING_SIZE))) return AVERROR(ENOMEM); st->codec->extradata_size = 12; memcpy(st->codec->extradata, comm_chunk, 12); ff_metadata_conv_ctx(VAR_0, NULL, vqf_metadata_conv); return 0;
[ "static int FUNC_0(AVFormatContext *VAR_0)\n{", "VqfContext *c = VAR_0->priv_data;", "AVStream *st = avformat_new_stream(VAR_0, NULL);", "int VAR_1;", "int VAR_2 = -1;", "int VAR_3;", "int VAR_4 = 0;", "int VAR_5;", "uint8_t comm_chunk[12];", "if (!st)\nreturn AVERROR(ENOMEM);", "avio_skip(VAR_0->pb, 12);", "VAR_3 = avio_rb32(VAR_0->pb);", "st->codec->codec_type = AVMEDIA_TYPE_AUDIO;", "st->codec->codec_id = AV_CODEC_ID_TWINVQ;", "st->start_time = 0;", "do {", "int len;", "VAR_1 = avio_rl32(VAR_0->pb);", "if (VAR_1 == MKTAG('D','A','T','A'))\nbreak;", "len = avio_rb32(VAR_0->pb);", "if ((unsigned) len > INT_MAX/2) {", "av_log(VAR_0, AV_LOG_ERROR, \"Malformed header\\n\");", "VAR_3 -= 8;", "switch(VAR_1){", "case MKTAG('C','O','M','M'):\navio_read(VAR_0->pb, comm_chunk, 12);", "st->codec->channels = AV_RB32(comm_chunk ) + 1;", "VAR_4 = AV_RB32(comm_chunk + 4);", "VAR_2 = AV_RB32(comm_chunk + 8);", "avio_skip(VAR_0->pb, len-12);", "st->codec->bit_rate = VAR_4*1000;", "break;", "case MKTAG('D','S','I','Z'):\n{", "char buf[8] = {0};", "int VAR_5 = avio_rb32(VAR_0->pb);", "snprintf(buf, sizeof(buf), \"%d\", VAR_5);", "av_dict_set(&VAR_0->metadata, \"VAR_5\", buf, 0);", "break;", "case MKTAG('Y','E','A','R'):\ncase MKTAG('E','N','C','D'):\ncase MKTAG('E','X','T','R'):\ncase MKTAG('_','Y','M','H'):\ncase MKTAG('_','N','T','T'):\ncase MKTAG('_','I','D','3'): for ID3 tags\navio_skip(VAR_0->pb, FFMIN(len, VAR_3));", "break;", "default:\nadd_metadata(VAR_0, VAR_1, len, VAR_3);", "break;", "VAR_3 -= len;", "} while (VAR_3 >= 0);", "switch (VAR_2) {", "case -1:\nav_log(VAR_0, AV_LOG_ERROR, \"COMM tag not found!\\n\");", "case 44:\nst->codec->sample_rate = 44100;", "break;", "case 22:\nst->codec->sample_rate = 22050;", "break;", "case 11:\nst->codec->sample_rate = 11025;", "break;", "default:\nst->codec->sample_rate = VAR_2*1000;", "break;", "switch (((st->codec->sample_rate/1000) << 8) +\nVAR_4/st->codec->channels) {", "case (11<<8) + 8 :\ncase (8 <<8) + 8 :\ncase (11<<8) + 10:\ncase (22<<8) + 32:\nVAR_5 = 512;", "break;", "case (16<<8) + 16:\ncase (22<<8) + 20:\ncase (22<<8) + 24:\nVAR_5 = 1024;", "break;", "case (44<<8) + 40:\ncase (44<<8) + 48:\nVAR_5 = 2048;", "break;", "default:\nav_log(VAR_0, AV_LOG_ERROR, \"Mode not suported: %d Hz, %d kb/VAR_0.\\n\",\nst->codec->sample_rate, st->codec->bit_rate);", "c->frame_bit_len = st->codec->bit_rate*VAR_5/st->codec->sample_rate;", "avpriv_set_pts_info(st, 64, VAR_5, st->codec->sample_rate);", "if (!(st->codec->extradata = av_malloc(12 + FF_INPUT_BUFFER_PADDING_SIZE)))\nreturn AVERROR(ENOMEM);", "st->codec->extradata_size = 12;", "memcpy(st->codec->extradata, comm_chunk, 12);", "ff_metadata_conv_ctx(VAR_0, NULL, vqf_metadata_conv);", "return 0;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23, 25 ], [ 29 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 53, 55 ], [ 59 ], [ 63 ], [ 65 ], [ 71 ], [ 75 ], [ 77, 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 91 ], [ 93 ], [ 95, 97 ], [ 99 ], [ 101 ], [ 105 ], [ 107 ], [ 110 ], [ 112, 114, 116, 118, 120, 122, 124 ], [ 126 ], [ 128, 130 ], [ 132 ], [ 137 ], [ 141 ], [ 145 ], [ 147, 149 ], [ 152, 154 ], [ 156 ], [ 158, 160 ], [ 162 ], [ 164, 166 ], [ 168 ], [ 170, 172 ], [ 178 ], [ 183, 185 ], [ 187, 189, 191, 193, 195 ], [ 197 ], [ 199, 201, 203, 205 ], [ 207 ], [ 209, 211, 213 ], [ 215 ], [ 217, 219, 221 ], [ 225 ], [ 227 ], [ 233, 235 ], [ 237 ], [ 239 ], [ 243 ], [ 247 ] ]
5,516
int qemu_sendv(int sockfd, struct iovec *iov, int len, int iov_offset) { return do_sendv_recvv(sockfd, iov, len, iov_offset, 1); }
true
qemu
3e80bf9351f8fec9085c46df6da075efd5e71003
int qemu_sendv(int sockfd, struct iovec *iov, int len, int iov_offset) { return do_sendv_recvv(sockfd, iov, len, iov_offset, 1); }
{ "code": [ "int qemu_sendv(int sockfd, struct iovec *iov, int len, int iov_offset)", " return do_sendv_recvv(sockfd, iov, len, iov_offset, 1);" ], "line_no": [ 1, 5 ] }
int FUNC_0(int VAR_0, struct iovec *VAR_1, int VAR_2, int VAR_3) { return do_sendv_recvv(VAR_0, VAR_1, VAR_2, VAR_3, 1); }
[ "int FUNC_0(int VAR_0, struct iovec *VAR_1, int VAR_2, int VAR_3)\n{", "return do_sendv_recvv(VAR_0, VAR_1, VAR_2, VAR_3, 1);", "}" ]
[ 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
5,518
static int gdb_handle_vcont(GDBState *s, const char *p) { int res, idx, signal = 0; char cur_action; char *newstates; unsigned long tmp; CPUState *cpu; #ifdef CONFIG_USER_ONLY int max_cpus = 1; /* global variable max_cpus exists only in system mode */ CPU_FOREACH(cpu) { max_cpus = max_cpus <= cpu->cpu_index ? cpu->cpu_index + 1 : max_cpus; } #endif /* uninitialised CPUs stay 0 */ newstates = g_new0(char, max_cpus); /* mark valid CPUs with 1 */ CPU_FOREACH(cpu) { newstates[cpu->cpu_index] = 1; } /* * res keeps track of what error we are returning, with -ENOTSUP meaning * that the command is unknown or unsupported, thus returning an empty * packet, while -EINVAL and -ERANGE cause an E22 packet, due to invalid, * or incorrect parameters passed. */ res = 0; while (*p) { if (*p++ != ';') { res = -ENOTSUP; goto out; } cur_action = *p++; if (cur_action == 'C' || cur_action == 'S') { cur_action = tolower(cur_action); res = qemu_strtoul(p + 1, &p, 16, &tmp); if (res) { goto out; } signal = gdb_signal_to_target(tmp); } else if (cur_action != 'c' && cur_action != 's') { /* unknown/invalid/unsupported command */ res = -ENOTSUP; goto out; } /* thread specification. special values: (none), -1 = all; 0 = any */ if ((p[0] == ':' && p[1] == '-' && p[2] == '1') || (p[0] != ':')) { if (*p == ':') { p += 3; } for (idx = 0; idx < max_cpus; idx++) { if (newstates[idx] == 1) { newstates[idx] = cur_action; } } } else if (*p == ':') { p++; res = qemu_strtoul(p, &p, 16, &tmp); if (res) { goto out; } /* 0 means any thread, so we pick the first valid CPU */ cpu = tmp ? find_cpu(tmp) : first_cpu; /* invalid CPU/thread specified */ if (!cpu) { res = -EINVAL; goto out; } /* only use if no previous match occourred */ if (newstates[cpu->cpu_index] == 1) { newstates[cpu->cpu_index] = cur_action; } } } s->signal = signal; gdb_continue_partial(s, newstates); out: g_free(newstates); return res; }
true
qemu
95a5befc2f8b359e72926f89cd661d063c2cf06c
static int gdb_handle_vcont(GDBState *s, const char *p) { int res, idx, signal = 0; char cur_action; char *newstates; unsigned long tmp; CPUState *cpu; #ifdef CONFIG_USER_ONLY int max_cpus = 1; CPU_FOREACH(cpu) { max_cpus = max_cpus <= cpu->cpu_index ? cpu->cpu_index + 1 : max_cpus; } #endif newstates = g_new0(char, max_cpus); CPU_FOREACH(cpu) { newstates[cpu->cpu_index] = 1; } res = 0; while (*p) { if (*p++ != ';') { res = -ENOTSUP; goto out; } cur_action = *p++; if (cur_action == 'C' || cur_action == 'S') { cur_action = tolower(cur_action); res = qemu_strtoul(p + 1, &p, 16, &tmp); if (res) { goto out; } signal = gdb_signal_to_target(tmp); } else if (cur_action != 'c' && cur_action != 's') { res = -ENOTSUP; goto out; } if ((p[0] == ':' && p[1] == '-' && p[2] == '1') || (p[0] != ':')) { if (*p == ':') { p += 3; } for (idx = 0; idx < max_cpus; idx++) { if (newstates[idx] == 1) { newstates[idx] = cur_action; } } } else if (*p == ':') { p++; res = qemu_strtoul(p, &p, 16, &tmp); if (res) { goto out; } cpu = tmp ? find_cpu(tmp) : first_cpu; if (!cpu) { res = -EINVAL; goto out; } if (newstates[cpu->cpu_index] == 1) { newstates[cpu->cpu_index] = cur_action; } } } s->signal = signal; gdb_continue_partial(s, newstates); out: g_free(newstates); return res; }
{ "code": [ " cur_action = tolower(cur_action);" ], "line_no": [ 75 ] }
static int FUNC_0(GDBState *VAR_0, const char *VAR_1) { int VAR_2, VAR_3, VAR_4 = 0; char VAR_5; char *VAR_6; unsigned long VAR_7; CPUState *cpu; #ifdef CONFIG_USER_ONLY int max_cpus = 1; CPU_FOREACH(cpu) { max_cpus = max_cpus <= cpu->cpu_index ? cpu->cpu_index + 1 : max_cpus; } #endif VAR_6 = g_new0(char, max_cpus); CPU_FOREACH(cpu) { VAR_6[cpu->cpu_index] = 1; } VAR_2 = 0; while (*VAR_1) { if (*VAR_1++ != ';') { VAR_2 = -ENOTSUP; goto out; } VAR_5 = *VAR_1++; if (VAR_5 == 'C' || VAR_5 == 'S') { VAR_5 = tolower(VAR_5); VAR_2 = qemu_strtoul(VAR_1 + 1, &VAR_1, 16, &VAR_7); if (VAR_2) { goto out; } VAR_4 = gdb_signal_to_target(VAR_7); } else if (VAR_5 != 'c' && VAR_5 != 'VAR_0') { VAR_2 = -ENOTSUP; goto out; } if ((VAR_1[0] == ':' && VAR_1[1] == '-' && VAR_1[2] == '1') || (VAR_1[0] != ':')) { if (*VAR_1 == ':') { VAR_1 += 3; } for (VAR_3 = 0; VAR_3 < max_cpus; VAR_3++) { if (VAR_6[VAR_3] == 1) { VAR_6[VAR_3] = VAR_5; } } } else if (*VAR_1 == ':') { VAR_1++; VAR_2 = qemu_strtoul(VAR_1, &VAR_1, 16, &VAR_7); if (VAR_2) { goto out; } cpu = VAR_7 ? find_cpu(VAR_7) : first_cpu; if (!cpu) { VAR_2 = -EINVAL; goto out; } if (VAR_6[cpu->cpu_index] == 1) { VAR_6[cpu->cpu_index] = VAR_5; } } } VAR_0->VAR_4 = VAR_4; gdb_continue_partial(VAR_0, VAR_6); out: g_free(VAR_6); return VAR_2; }
[ "static int FUNC_0(GDBState *VAR_0, const char *VAR_1)\n{", "int VAR_2, VAR_3, VAR_4 = 0;", "char VAR_5;", "char *VAR_6;", "unsigned long VAR_7;", "CPUState *cpu;", "#ifdef CONFIG_USER_ONLY\nint max_cpus = 1;", "CPU_FOREACH(cpu) {", "max_cpus = max_cpus <= cpu->cpu_index ? cpu->cpu_index + 1 : max_cpus;", "}", "#endif\nVAR_6 = g_new0(char, max_cpus);", "CPU_FOREACH(cpu) {", "VAR_6[cpu->cpu_index] = 1;", "}", "VAR_2 = 0;", "while (*VAR_1) {", "if (*VAR_1++ != ';') {", "VAR_2 = -ENOTSUP;", "goto out;", "}", "VAR_5 = *VAR_1++;", "if (VAR_5 == 'C' || VAR_5 == 'S') {", "VAR_5 = tolower(VAR_5);", "VAR_2 = qemu_strtoul(VAR_1 + 1, &VAR_1, 16, &VAR_7);", "if (VAR_2) {", "goto out;", "}", "VAR_4 = gdb_signal_to_target(VAR_7);", "} else if (VAR_5 != 'c' && VAR_5 != 'VAR_0') {", "VAR_2 = -ENOTSUP;", "goto out;", "}", "if ((VAR_1[0] == ':' && VAR_1[1] == '-' && VAR_1[2] == '1') || (VAR_1[0] != ':')) {", "if (*VAR_1 == ':') {", "VAR_1 += 3;", "}", "for (VAR_3 = 0; VAR_3 < max_cpus; VAR_3++) {", "if (VAR_6[VAR_3] == 1) {", "VAR_6[VAR_3] = VAR_5;", "}", "}", "} else if (*VAR_1 == ':') {", "VAR_1++;", "VAR_2 = qemu_strtoul(VAR_1, &VAR_1, 16, &VAR_7);", "if (VAR_2) {", "goto out;", "}", "cpu = VAR_7 ? find_cpu(VAR_7) : first_cpu;", "if (!cpu) {", "VAR_2 = -EINVAL;", "goto out;", "}", "if (VAR_6[cpu->cpu_index] == 1) {", "VAR_6[cpu->cpu_index] = VAR_5;", "}", "}", "}", "VAR_0->VAR_4 = VAR_4;", "gdb_continue_partial(VAR_0, VAR_6);", "out:\ng_free(VAR_6);", "return VAR_2;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15, 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27, 31 ], [ 37 ], [ 39 ], [ 41 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 91 ], [ 93 ], [ 95 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 133 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 167, 169 ], [ 173 ], [ 175 ] ]
5,519
static void write_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost) { AVFormatContext *s = of->ctx; AVStream *st = ost->st; int ret; if (!of->header_written) { AVPacket tmp_pkt; /* the muxer is not initialized yet, buffer the packet */ if (!av_fifo_space(ost->muxing_queue)) { int new_size = FFMIN(2 * av_fifo_size(ost->muxing_queue), ost->max_muxing_queue_size); if (new_size <= av_fifo_size(ost->muxing_queue)) { av_log(NULL, AV_LOG_ERROR, "Too many packets buffered for output stream %d:%d.\n", ost->file_index, ost->st->index); exit_program(1); } ret = av_fifo_realloc2(ost->muxing_queue, new_size); if (ret < 0) exit_program(1); } av_packet_move_ref(&tmp_pkt, pkt); av_fifo_generic_write(ost->muxing_queue, &tmp_pkt, sizeof(tmp_pkt), NULL); return; } if ((st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && video_sync_method == VSYNC_DROP) || (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && audio_sync_method < 0)) pkt->pts = pkt->dts = AV_NOPTS_VALUE; /* * Audio encoders may split the packets -- #frames in != #packets out. * But there is no reordering, so we can limit the number of output packets * by simply dropping them here. * Counting encoded video frames needs to be done separately because of * reordering, see do_video_out() */ if (!(st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && ost->encoding_needed)) { if (ost->frame_number >= ost->max_frames) { av_packet_unref(pkt); return; } ost->frame_number++; } if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) { int i; uint8_t *sd = av_packet_get_side_data(pkt, AV_PKT_DATA_QUALITY_STATS, NULL); ost->quality = sd ? AV_RL32(sd) : -1; ost->pict_type = sd ? sd[4] : AV_PICTURE_TYPE_NONE; for (i = 0; i<FF_ARRAY_ELEMS(ost->error); i++) { if (sd && i < sd[5]) ost->error[i] = AV_RL64(sd + 8 + 8*i); else ost->error[i] = -1; } if (ost->frame_rate.num && ost->is_cfr) { if (pkt->duration > 0) av_log(NULL, AV_LOG_WARNING, "Overriding packet duration by frame rate, this should not happen\n"); pkt->duration = av_rescale_q(1, av_inv_q(ost->frame_rate), ost->st->time_base); } } if (!(s->oformat->flags & AVFMT_NOTIMESTAMPS)) { if (pkt->dts != AV_NOPTS_VALUE && pkt->pts != AV_NOPTS_VALUE && pkt->dts > pkt->pts) { av_log(s, AV_LOG_WARNING, "Invalid DTS: %"PRId64" PTS: %"PRId64" in output stream %d:%d, replacing by guess\n", pkt->dts, pkt->pts, ost->file_index, ost->st->index); pkt->pts = pkt->dts = pkt->pts + pkt->dts + ost->last_mux_dts + 1 - FFMIN3(pkt->pts, pkt->dts, ost->last_mux_dts + 1) - FFMAX3(pkt->pts, pkt->dts, ost->last_mux_dts + 1); } if ((st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO || st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) && pkt->dts != AV_NOPTS_VALUE && !(st->codecpar->codec_id == AV_CODEC_ID_VP9 && ost->stream_copy) && ost->last_mux_dts != AV_NOPTS_VALUE) { int64_t max = ost->last_mux_dts + !(s->oformat->flags & AVFMT_TS_NONSTRICT); if (pkt->dts < max) { int loglevel = max - pkt->dts > 2 || st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO ? AV_LOG_WARNING : AV_LOG_DEBUG; av_log(s, loglevel, "Non-monotonous DTS in output stream " "%d:%d; previous: %"PRId64", current: %"PRId64"; ", ost->file_index, ost->st->index, ost->last_mux_dts, pkt->dts); if (exit_on_error) { av_log(NULL, AV_LOG_FATAL, "aborting.\n"); exit_program(1); } av_log(s, loglevel, "changing to %"PRId64". This may result " "in incorrect timestamps in the output file.\n", max); if (pkt->pts >= pkt->dts) pkt->pts = FFMAX(pkt->pts, max); pkt->dts = max; } } } ost->last_mux_dts = pkt->dts; ost->data_size += pkt->size; ost->packets_written++; pkt->stream_index = ost->index; if (debug_ts) { av_log(NULL, AV_LOG_INFO, "muxer <- type:%s " "pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s size:%d\n", av_get_media_type_string(ost->enc_ctx->codec_type), av_ts2str(pkt->pts), av_ts2timestr(pkt->pts, &ost->st->time_base), av_ts2str(pkt->dts), av_ts2timestr(pkt->dts, &ost->st->time_base), pkt->size ); } ret = av_interleaved_write_frame(s, pkt); if (ret < 0) { print_error("av_interleaved_write_frame()", ret); main_return_code = 1; close_all_output_streams(ost, MUXER_FINISHED | ENCODER_FINISHED, ENCODER_FINISHED); } av_packet_unref(pkt); }
true
FFmpeg
33580a8625c77591919b6155a48da04dccc8d398
static void write_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost) { AVFormatContext *s = of->ctx; AVStream *st = ost->st; int ret; if (!of->header_written) { AVPacket tmp_pkt; if (!av_fifo_space(ost->muxing_queue)) { int new_size = FFMIN(2 * av_fifo_size(ost->muxing_queue), ost->max_muxing_queue_size); if (new_size <= av_fifo_size(ost->muxing_queue)) { av_log(NULL, AV_LOG_ERROR, "Too many packets buffered for output stream %d:%d.\n", ost->file_index, ost->st->index); exit_program(1); } ret = av_fifo_realloc2(ost->muxing_queue, new_size); if (ret < 0) exit_program(1); } av_packet_move_ref(&tmp_pkt, pkt); av_fifo_generic_write(ost->muxing_queue, &tmp_pkt, sizeof(tmp_pkt), NULL); return; } if ((st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && video_sync_method == VSYNC_DROP) || (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && audio_sync_method < 0)) pkt->pts = pkt->dts = AV_NOPTS_VALUE; if (!(st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && ost->encoding_needed)) { if (ost->frame_number >= ost->max_frames) { av_packet_unref(pkt); return; } ost->frame_number++; } if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) { int i; uint8_t *sd = av_packet_get_side_data(pkt, AV_PKT_DATA_QUALITY_STATS, NULL); ost->quality = sd ? AV_RL32(sd) : -1; ost->pict_type = sd ? sd[4] : AV_PICTURE_TYPE_NONE; for (i = 0; i<FF_ARRAY_ELEMS(ost->error); i++) { if (sd && i < sd[5]) ost->error[i] = AV_RL64(sd + 8 + 8*i); else ost->error[i] = -1; } if (ost->frame_rate.num && ost->is_cfr) { if (pkt->duration > 0) av_log(NULL, AV_LOG_WARNING, "Overriding packet duration by frame rate, this should not happen\n"); pkt->duration = av_rescale_q(1, av_inv_q(ost->frame_rate), ost->st->time_base); } } if (!(s->oformat->flags & AVFMT_NOTIMESTAMPS)) { if (pkt->dts != AV_NOPTS_VALUE && pkt->pts != AV_NOPTS_VALUE && pkt->dts > pkt->pts) { av_log(s, AV_LOG_WARNING, "Invalid DTS: %"PRId64" PTS: %"PRId64" in output stream %d:%d, replacing by guess\n", pkt->dts, pkt->pts, ost->file_index, ost->st->index); pkt->pts = pkt->dts = pkt->pts + pkt->dts + ost->last_mux_dts + 1 - FFMIN3(pkt->pts, pkt->dts, ost->last_mux_dts + 1) - FFMAX3(pkt->pts, pkt->dts, ost->last_mux_dts + 1); } if ((st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO || st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) && pkt->dts != AV_NOPTS_VALUE && !(st->codecpar->codec_id == AV_CODEC_ID_VP9 && ost->stream_copy) && ost->last_mux_dts != AV_NOPTS_VALUE) { int64_t max = ost->last_mux_dts + !(s->oformat->flags & AVFMT_TS_NONSTRICT); if (pkt->dts < max) { int loglevel = max - pkt->dts > 2 || st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO ? AV_LOG_WARNING : AV_LOG_DEBUG; av_log(s, loglevel, "Non-monotonous DTS in output stream " "%d:%d; previous: %"PRId64", current: %"PRId64"; ", ost->file_index, ost->st->index, ost->last_mux_dts, pkt->dts); if (exit_on_error) { av_log(NULL, AV_LOG_FATAL, "aborting.\n"); exit_program(1); } av_log(s, loglevel, "changing to %"PRId64". This may result " "in incorrect timestamps in the output file.\n", max); if (pkt->pts >= pkt->dts) pkt->pts = FFMAX(pkt->pts, max); pkt->dts = max; } } } ost->last_mux_dts = pkt->dts; ost->data_size += pkt->size; ost->packets_written++; pkt->stream_index = ost->index; if (debug_ts) { av_log(NULL, AV_LOG_INFO, "muxer <- type:%s " "pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s size:%d\n", av_get_media_type_string(ost->enc_ctx->codec_type), av_ts2str(pkt->pts), av_ts2timestr(pkt->pts, &ost->st->time_base), av_ts2str(pkt->dts), av_ts2timestr(pkt->dts, &ost->st->time_base), pkt->size ); } ret = av_interleaved_write_frame(s, pkt); if (ret < 0) { print_error("av_interleaved_write_frame()", ret); main_return_code = 1; close_all_output_streams(ost, MUXER_FINISHED | ENCODER_FINISHED, ENCODER_FINISHED); } av_packet_unref(pkt); }
{ "code": [ " AVPacket tmp_pkt;", " av_packet_move_ref(&tmp_pkt, pkt);" ], "line_no": [ 15, 45 ] }
static void FUNC_0(OutputFile *VAR_0, AVPacket *VAR_1, OutputStream *VAR_2) { AVFormatContext *s = VAR_0->ctx; AVStream *st = VAR_2->st; int VAR_3; if (!VAR_0->header_written) { AVPacket tmp_pkt; if (!av_fifo_space(VAR_2->muxing_queue)) { int VAR_4 = FFMIN(2 * av_fifo_size(VAR_2->muxing_queue), VAR_2->max_muxing_queue_size); if (VAR_4 <= av_fifo_size(VAR_2->muxing_queue)) { av_log(NULL, AV_LOG_ERROR, "Too many packets buffered for output stream %d:%d.\n", VAR_2->file_index, VAR_2->st->index); exit_program(1); } VAR_3 = av_fifo_realloc2(VAR_2->muxing_queue, VAR_4); if (VAR_3 < 0) exit_program(1); } av_packet_move_ref(&tmp_pkt, VAR_1); av_fifo_generic_write(VAR_2->muxing_queue, &tmp_pkt, sizeof(tmp_pkt), NULL); return; } if ((st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && video_sync_method == VSYNC_DROP) || (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && audio_sync_method < 0)) VAR_1->pts = VAR_1->dts = AV_NOPTS_VALUE; if (!(st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && VAR_2->encoding_needed)) { if (VAR_2->frame_number >= VAR_2->max_frames) { av_packet_unref(VAR_1); return; } VAR_2->frame_number++; } if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) { int VAR_5; uint8_t *sd = av_packet_get_side_data(VAR_1, AV_PKT_DATA_QUALITY_STATS, NULL); VAR_2->quality = sd ? AV_RL32(sd) : -1; VAR_2->pict_type = sd ? sd[4] : AV_PICTURE_TYPE_NONE; for (VAR_5 = 0; VAR_5<FF_ARRAY_ELEMS(VAR_2->error); VAR_5++) { if (sd && VAR_5 < sd[5]) VAR_2->error[VAR_5] = AV_RL64(sd + 8 + 8*VAR_5); else VAR_2->error[VAR_5] = -1; } if (VAR_2->frame_rate.num && VAR_2->is_cfr) { if (VAR_1->duration > 0) av_log(NULL, AV_LOG_WARNING, "Overriding packet duration by frame rate, this should not happen\n"); VAR_1->duration = av_rescale_q(1, av_inv_q(VAR_2->frame_rate), VAR_2->st->time_base); } } if (!(s->oformat->flags & AVFMT_NOTIMESTAMPS)) { if (VAR_1->dts != AV_NOPTS_VALUE && VAR_1->pts != AV_NOPTS_VALUE && VAR_1->dts > VAR_1->pts) { av_log(s, AV_LOG_WARNING, "Invalid DTS: %"PRId64" PTS: %"PRId64" in output stream %d:%d, replacing by guess\n", VAR_1->dts, VAR_1->pts, VAR_2->file_index, VAR_2->st->index); VAR_1->pts = VAR_1->dts = VAR_1->pts + VAR_1->dts + VAR_2->last_mux_dts + 1 - FFMIN3(VAR_1->pts, VAR_1->dts, VAR_2->last_mux_dts + 1) - FFMAX3(VAR_1->pts, VAR_1->dts, VAR_2->last_mux_dts + 1); } if ((st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO || st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) && VAR_1->dts != AV_NOPTS_VALUE && !(st->codecpar->codec_id == AV_CODEC_ID_VP9 && VAR_2->stream_copy) && VAR_2->last_mux_dts != AV_NOPTS_VALUE) { int64_t max = VAR_2->last_mux_dts + !(s->oformat->flags & AVFMT_TS_NONSTRICT); if (VAR_1->dts < max) { int VAR_6 = max - VAR_1->dts > 2 || st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO ? AV_LOG_WARNING : AV_LOG_DEBUG; av_log(s, VAR_6, "Non-monotonous DTS in output stream " "%d:%d; previous: %"PRId64", current: %"PRId64"; ", VAR_2->file_index, VAR_2->st->index, VAR_2->last_mux_dts, VAR_1->dts); if (exit_on_error) { av_log(NULL, AV_LOG_FATAL, "aborting.\n"); exit_program(1); } av_log(s, VAR_6, "changing to %"PRId64". This may result " "in incorrect timestamps in the output file.\n", max); if (VAR_1->pts >= VAR_1->dts) VAR_1->pts = FFMAX(VAR_1->pts, max); VAR_1->dts = max; } } } VAR_2->last_mux_dts = VAR_1->dts; VAR_2->data_size += VAR_1->size; VAR_2->packets_written++; VAR_1->stream_index = VAR_2->index; if (debug_ts) { av_log(NULL, AV_LOG_INFO, "muxer <- type:%s " "pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s size:%d\n", av_get_media_type_string(VAR_2->enc_ctx->codec_type), av_ts2str(VAR_1->pts), av_ts2timestr(VAR_1->pts, &VAR_2->st->time_base), av_ts2str(VAR_1->dts), av_ts2timestr(VAR_1->dts, &VAR_2->st->time_base), VAR_1->size ); } VAR_3 = av_interleaved_write_frame(s, VAR_1); if (VAR_3 < 0) { print_error("av_interleaved_write_frame()", VAR_3); main_return_code = 1; close_all_output_streams(VAR_2, MUXER_FINISHED | ENCODER_FINISHED, ENCODER_FINISHED); } av_packet_unref(VAR_1); }
[ "static void FUNC_0(OutputFile *VAR_0, AVPacket *VAR_1, OutputStream *VAR_2)\n{", "AVFormatContext *s = VAR_0->ctx;", "AVStream *st = VAR_2->st;", "int VAR_3;", "if (!VAR_0->header_written) {", "AVPacket tmp_pkt;", "if (!av_fifo_space(VAR_2->muxing_queue)) {", "int VAR_4 = FFMIN(2 * av_fifo_size(VAR_2->muxing_queue),\nVAR_2->max_muxing_queue_size);", "if (VAR_4 <= av_fifo_size(VAR_2->muxing_queue)) {", "av_log(NULL, AV_LOG_ERROR,\n\"Too many packets buffered for output stream %d:%d.\\n\",\nVAR_2->file_index, VAR_2->st->index);", "exit_program(1);", "}", "VAR_3 = av_fifo_realloc2(VAR_2->muxing_queue, VAR_4);", "if (VAR_3 < 0)\nexit_program(1);", "}", "av_packet_move_ref(&tmp_pkt, VAR_1);", "av_fifo_generic_write(VAR_2->muxing_queue, &tmp_pkt, sizeof(tmp_pkt), NULL);", "return;", "}", "if ((st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && video_sync_method == VSYNC_DROP) ||\n(st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && audio_sync_method < 0))\nVAR_1->pts = VAR_1->dts = AV_NOPTS_VALUE;", "if (!(st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && VAR_2->encoding_needed)) {", "if (VAR_2->frame_number >= VAR_2->max_frames) {", "av_packet_unref(VAR_1);", "return;", "}", "VAR_2->frame_number++;", "}", "if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {", "int VAR_5;", "uint8_t *sd = av_packet_get_side_data(VAR_1, AV_PKT_DATA_QUALITY_STATS,\nNULL);", "VAR_2->quality = sd ? AV_RL32(sd) : -1;", "VAR_2->pict_type = sd ? sd[4] : AV_PICTURE_TYPE_NONE;", "for (VAR_5 = 0; VAR_5<FF_ARRAY_ELEMS(VAR_2->error); VAR_5++) {", "if (sd && VAR_5 < sd[5])\nVAR_2->error[VAR_5] = AV_RL64(sd + 8 + 8*VAR_5);", "else\nVAR_2->error[VAR_5] = -1;", "}", "if (VAR_2->frame_rate.num && VAR_2->is_cfr) {", "if (VAR_1->duration > 0)\nav_log(NULL, AV_LOG_WARNING, \"Overriding packet duration by frame rate, this should not happen\\n\");", "VAR_1->duration = av_rescale_q(1, av_inv_q(VAR_2->frame_rate),\nVAR_2->st->time_base);", "}", "}", "if (!(s->oformat->flags & AVFMT_NOTIMESTAMPS)) {", "if (VAR_1->dts != AV_NOPTS_VALUE &&\nVAR_1->pts != AV_NOPTS_VALUE &&\nVAR_1->dts > VAR_1->pts) {", "av_log(s, AV_LOG_WARNING, \"Invalid DTS: %\"PRId64\" PTS: %\"PRId64\" in output stream %d:%d, replacing by guess\\n\",\nVAR_1->dts, VAR_1->pts,\nVAR_2->file_index, VAR_2->st->index);", "VAR_1->pts =\nVAR_1->dts = VAR_1->pts + VAR_1->dts + VAR_2->last_mux_dts + 1\n- FFMIN3(VAR_1->pts, VAR_1->dts, VAR_2->last_mux_dts + 1)\n- FFMAX3(VAR_1->pts, VAR_1->dts, VAR_2->last_mux_dts + 1);", "}", "if ((st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO || st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) &&\nVAR_1->dts != AV_NOPTS_VALUE &&\n!(st->codecpar->codec_id == AV_CODEC_ID_VP9 && VAR_2->stream_copy) &&\nVAR_2->last_mux_dts != AV_NOPTS_VALUE) {", "int64_t max = VAR_2->last_mux_dts + !(s->oformat->flags & AVFMT_TS_NONSTRICT);", "if (VAR_1->dts < max) {", "int VAR_6 = max - VAR_1->dts > 2 || st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO ? AV_LOG_WARNING : AV_LOG_DEBUG;", "av_log(s, VAR_6, \"Non-monotonous DTS in output stream \"\n\"%d:%d; previous: %\"PRId64\", current: %\"PRId64\"; \",", "VAR_2->file_index, VAR_2->st->index, VAR_2->last_mux_dts, VAR_1->dts);", "if (exit_on_error) {", "av_log(NULL, AV_LOG_FATAL, \"aborting.\\n\");", "exit_program(1);", "}", "av_log(s, VAR_6, \"changing to %\"PRId64\". This may result \"\n\"in incorrect timestamps in the output file.\\n\",\nmax);", "if (VAR_1->pts >= VAR_1->dts)\nVAR_1->pts = FFMAX(VAR_1->pts, max);", "VAR_1->dts = max;", "}", "}", "}", "VAR_2->last_mux_dts = VAR_1->dts;", "VAR_2->data_size += VAR_1->size;", "VAR_2->packets_written++;", "VAR_1->stream_index = VAR_2->index;", "if (debug_ts) {", "av_log(NULL, AV_LOG_INFO, \"muxer <- type:%s \"\n\"pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s size:%d\\n\",\nav_get_media_type_string(VAR_2->enc_ctx->codec_type),\nav_ts2str(VAR_1->pts), av_ts2timestr(VAR_1->pts, &VAR_2->st->time_base),\nav_ts2str(VAR_1->dts), av_ts2timestr(VAR_1->dts, &VAR_2->st->time_base),\nVAR_1->size\n);", "}", "VAR_3 = av_interleaved_write_frame(s, VAR_1);", "if (VAR_3 < 0) {", "print_error(\"av_interleaved_write_frame()\", VAR_3);", "main_return_code = 1;", "close_all_output_streams(VAR_2, MUXER_FINISHED | ENCODER_FINISHED, ENCODER_FINISHED);", "}", "av_packet_unref(VAR_1);", "}" ]
[ 0, 0, 0, 0, 0, 1, 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 19 ], [ 21, 23 ], [ 25 ], [ 27, 29, 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55, 57, 59 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95, 97 ], [ 99 ], [ 101 ], [ 105 ], [ 107, 109 ], [ 111, 113 ], [ 115 ], [ 119 ], [ 121, 123 ], [ 125, 127 ], [ 129 ], [ 131 ], [ 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 ], [ 209 ], [ 211 ], [ 215 ], [ 219 ], [ 221, 223, 225, 227, 229, 231, 233 ], [ 235 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ] ]
5,520
void bdrv_commit_all(void) { BlockDriverState *bs; QTAILQ_FOREACH(bs, &bdrv_states, list) { bdrv_commit(bs); } }
true
qemu
e88774971c33671477c9eb4a4cf1e65a047c9838
void bdrv_commit_all(void) { BlockDriverState *bs; QTAILQ_FOREACH(bs, &bdrv_states, list) { bdrv_commit(bs); } }
{ "code": [ "void bdrv_commit_all(void)", " bdrv_commit(bs);" ], "line_no": [ 1, 11 ] }
void FUNC_0(void) { BlockDriverState *bs; QTAILQ_FOREACH(bs, &bdrv_states, list) { bdrv_commit(bs); } }
[ "void FUNC_0(void)\n{", "BlockDriverState *bs;", "QTAILQ_FOREACH(bs, &bdrv_states, list) {", "bdrv_commit(bs);", "}", "}" ]
[ 1, 0, 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ] ]
5,522
static int event_qdev_exit(DeviceState *qdev) { SCLPEvent *event = DO_UPCAST(SCLPEvent, qdev, qdev); SCLPEventClass *child = SCLP_EVENT_GET_CLASS(event); if (child->exit) { child->exit(event); } return 0; }
true
qemu
c804c2a71752dd1e150cde768d8c54b02fa8bad9
static int event_qdev_exit(DeviceState *qdev) { SCLPEvent *event = DO_UPCAST(SCLPEvent, qdev, qdev); SCLPEventClass *child = SCLP_EVENT_GET_CLASS(event); if (child->exit) { child->exit(event); } return 0; }
{ "code": [ " SCLPEvent *event = DO_UPCAST(SCLPEvent, qdev, qdev);", "static int event_qdev_exit(DeviceState *qdev)", " SCLPEvent *event = DO_UPCAST(SCLPEvent, qdev, qdev);", " child->exit(event);", " return 0;" ], "line_no": [ 5, 1, 5, 11, 15 ] }
static int FUNC_0(DeviceState *VAR_0) { SCLPEvent *event = DO_UPCAST(SCLPEvent, VAR_0, VAR_0); SCLPEventClass *child = SCLP_EVENT_GET_CLASS(event); if (child->exit) { child->exit(event); } return 0; }
[ "static int FUNC_0(DeviceState *VAR_0)\n{", "SCLPEvent *event = DO_UPCAST(SCLPEvent, VAR_0, VAR_0);", "SCLPEventClass *child = SCLP_EVENT_GET_CLASS(event);", "if (child->exit) {", "child->exit(event);", "}", "return 0;", "}" ]
[ 1, 1, 0, 0, 1, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ] ]
5,524
static av_cold int amr_wb_encode_init(AVCodecContext *avctx) { AMRWBContext *s = avctx->priv_data; if (avctx->sample_rate != 16000) { av_log(avctx, AV_LOG_ERROR, "Only 16000Hz sample rate supported\n"); return AVERROR(ENOSYS); } if (avctx->channels != 1) { av_log(avctx, AV_LOG_ERROR, "Only mono supported\n"); return AVERROR(ENOSYS); } s->mode = get_wb_bitrate_mode(avctx->bit_rate, avctx); s->last_bitrate = avctx->bit_rate; avctx->frame_size = 320; avctx->delay = 80; s->state = E_IF_init(); return 0; }
false
FFmpeg
2df0c32ea12ddfa72ba88309812bfb13b674130f
static av_cold int amr_wb_encode_init(AVCodecContext *avctx) { AMRWBContext *s = avctx->priv_data; if (avctx->sample_rate != 16000) { av_log(avctx, AV_LOG_ERROR, "Only 16000Hz sample rate supported\n"); return AVERROR(ENOSYS); } if (avctx->channels != 1) { av_log(avctx, AV_LOG_ERROR, "Only mono supported\n"); return AVERROR(ENOSYS); } s->mode = get_wb_bitrate_mode(avctx->bit_rate, avctx); s->last_bitrate = avctx->bit_rate; avctx->frame_size = 320; avctx->delay = 80; s->state = E_IF_init(); return 0; }
{ "code": [], "line_no": [] }
static av_cold int FUNC_0(AVCodecContext *avctx) { AMRWBContext *s = avctx->priv_data; if (avctx->sample_rate != 16000) { av_log(avctx, AV_LOG_ERROR, "Only 16000Hz sample rate supported\n"); return AVERROR(ENOSYS); } if (avctx->channels != 1) { av_log(avctx, AV_LOG_ERROR, "Only mono supported\n"); return AVERROR(ENOSYS); } s->mode = get_wb_bitrate_mode(avctx->bit_rate, avctx); s->last_bitrate = avctx->bit_rate; avctx->frame_size = 320; avctx->delay = 80; s->state = E_IF_init(); return 0; }
[ "static av_cold int FUNC_0(AVCodecContext *avctx)\n{", "AMRWBContext *s = avctx->priv_data;", "if (avctx->sample_rate != 16000) {", "av_log(avctx, AV_LOG_ERROR, \"Only 16000Hz sample rate supported\\n\");", "return AVERROR(ENOSYS);", "}", "if (avctx->channels != 1) {", "av_log(avctx, AV_LOG_ERROR, \"Only mono supported\\n\");", "return AVERROR(ENOSYS);", "}", "s->mode = get_wb_bitrate_mode(avctx->bit_rate, avctx);", "s->last_bitrate = avctx->bit_rate;", "avctx->frame_size = 320;", "avctx->delay = 80;", "s->state = E_IF_init();", "return 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 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 41 ], [ 45 ], [ 47 ] ]
5,525
static void filter_mb_fast( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize) { MpegEncContext * const s = &h->s; int mb_y_firstrow = s->picture_structure == PICT_BOTTOM_FIELD; int mb_xy, mb_type; int qp, qp0, qp1, qpc, qpc0, qpc1, qp_thresh; mb_xy = h->mb_xy; if(mb_x==0 || mb_y==mb_y_firstrow || !s->dsp.h264_loop_filter_strength || h->pps.chroma_qp_diff || !(s->flags2 & CODEC_FLAG2_FAST) || //FIXME filter_mb_fast is broken, thus hasto be, but should not under CODEC_FLAG2_FAST (h->deblocking_filter == 2 && (h->slice_table[mb_xy] != h->slice_table[h->top_mb_xy] || h->slice_table[mb_xy] != h->slice_table[mb_xy - 1]))) { filter_mb(h, mb_x, mb_y, img_y, img_cb, img_cr, linesize, uvlinesize); return; } assert(!FRAME_MBAFF); mb_type = s->current_picture.mb_type[mb_xy]; qp = s->current_picture.qscale_table[mb_xy]; qp0 = s->current_picture.qscale_table[mb_xy-1]; qp1 = s->current_picture.qscale_table[h->top_mb_xy]; qpc = get_chroma_qp( h, 0, qp ); qpc0 = get_chroma_qp( h, 0, qp0 ); qpc1 = get_chroma_qp( h, 0, qp1 ); qp0 = (qp + qp0 + 1) >> 1; qp1 = (qp + qp1 + 1) >> 1; qpc0 = (qpc + qpc0 + 1) >> 1; qpc1 = (qpc + qpc1 + 1) >> 1; qp_thresh = 15 - h->slice_alpha_c0_offset; if(qp <= qp_thresh && qp0 <= qp_thresh && qp1 <= qp_thresh && qpc <= qp_thresh && qpc0 <= qp_thresh && qpc1 <= qp_thresh) return; if( IS_INTRA(mb_type) ) { int16_t bS4[4] = {4,4,4,4}; int16_t bS3[4] = {3,3,3,3}; int16_t *bSH = FIELD_PICTURE ? bS3 : bS4; if( IS_8x8DCT(mb_type) ) { filter_mb_edgev( h, &img_y[4*0], linesize, bS4, qp0 ); filter_mb_edgev( h, &img_y[4*2], linesize, bS3, qp ); filter_mb_edgeh( h, &img_y[4*0*linesize], linesize, bSH, qp1 ); filter_mb_edgeh( h, &img_y[4*2*linesize], linesize, bS3, qp ); } else { filter_mb_edgev( h, &img_y[4*0], linesize, bS4, qp0 ); filter_mb_edgev( h, &img_y[4*1], linesize, bS3, qp ); filter_mb_edgev( h, &img_y[4*2], linesize, bS3, qp ); filter_mb_edgev( h, &img_y[4*3], linesize, bS3, qp ); filter_mb_edgeh( h, &img_y[4*0*linesize], linesize, bSH, qp1 ); filter_mb_edgeh( h, &img_y[4*1*linesize], linesize, bS3, qp ); filter_mb_edgeh( h, &img_y[4*2*linesize], linesize, bS3, qp ); filter_mb_edgeh( h, &img_y[4*3*linesize], linesize, bS3, qp ); } filter_mb_edgecv( h, &img_cb[2*0], uvlinesize, bS4, qpc0 ); filter_mb_edgecv( h, &img_cb[2*2], uvlinesize, bS3, qpc ); filter_mb_edgecv( h, &img_cr[2*0], uvlinesize, bS4, qpc0 ); filter_mb_edgecv( h, &img_cr[2*2], uvlinesize, bS3, qpc ); filter_mb_edgech( h, &img_cb[2*0*uvlinesize], uvlinesize, bSH, qpc1 ); filter_mb_edgech( h, &img_cb[2*2*uvlinesize], uvlinesize, bS3, qpc ); filter_mb_edgech( h, &img_cr[2*0*uvlinesize], uvlinesize, bSH, qpc1 ); filter_mb_edgech( h, &img_cr[2*2*uvlinesize], uvlinesize, bS3, qpc ); return; } else { DECLARE_ALIGNED_8(int16_t, bS[2][4][4]); uint64_t (*bSv)[4] = (uint64_t(*)[4])bS; int edges; if( IS_8x8DCT(mb_type) && (h->cbp&7) == 7 ) { edges = 4; bSv[0][0] = bSv[0][2] = bSv[1][0] = bSv[1][2] = 0x0002000200020002ULL; } else { int mask_edge1 = (mb_type & (MB_TYPE_16x16 | MB_TYPE_8x16)) ? 3 : (mb_type & MB_TYPE_16x8) ? 1 : 0; int mask_edge0 = (mb_type & (MB_TYPE_16x16 | MB_TYPE_8x16)) && (s->current_picture.mb_type[mb_xy-1] & (MB_TYPE_16x16 | MB_TYPE_8x16)) ? 3 : 0; int step = IS_8x8DCT(mb_type) ? 2 : 1; edges = (mb_type & MB_TYPE_16x16) && !(h->cbp & 15) ? 1 : 4; s->dsp.h264_loop_filter_strength( bS, h->non_zero_count_cache, h->ref_cache, h->mv_cache, (h->slice_type_nos == FF_B_TYPE), edges, step, mask_edge0, mask_edge1, FIELD_PICTURE); } if( IS_INTRA(s->current_picture.mb_type[mb_xy-1]) ) bSv[0][0] = 0x0004000400040004ULL; if( IS_INTRA(s->current_picture.mb_type[h->top_mb_xy]) ) bSv[1][0] = FIELD_PICTURE ? 0x0003000300030003ULL : 0x0004000400040004ULL; #define FILTER(hv,dir,edge)\ if(bSv[dir][edge]) {\ filter_mb_edge##hv( h, &img_y[4*edge*(dir?linesize:1)], linesize, bS[dir][edge], edge ? qp : qp##dir );\ if(!(edge&1)) {\ filter_mb_edgec##hv( h, &img_cb[2*edge*(dir?uvlinesize:1)], uvlinesize, bS[dir][edge], edge ? qpc : qpc##dir );\ filter_mb_edgec##hv( h, &img_cr[2*edge*(dir?uvlinesize:1)], uvlinesize, bS[dir][edge], edge ? qpc : qpc##dir );\ }\ } if( edges == 1 ) { FILTER(v,0,0); FILTER(h,1,0); } else if( IS_8x8DCT(mb_type) ) { FILTER(v,0,0); FILTER(v,0,2); FILTER(h,1,0); FILTER(h,1,2); } else { FILTER(v,0,0); FILTER(v,0,1); FILTER(v,0,2); FILTER(v,0,3); FILTER(h,1,0); FILTER(h,1,1); FILTER(h,1,2); FILTER(h,1,3); } #undef FILTER } }
false
FFmpeg
082cf97106e2e94a969877d4f8c05c1e526acf54
static void filter_mb_fast( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize) { MpegEncContext * const s = &h->s; int mb_y_firstrow = s->picture_structure == PICT_BOTTOM_FIELD; int mb_xy, mb_type; int qp, qp0, qp1, qpc, qpc0, qpc1, qp_thresh; mb_xy = h->mb_xy; if(mb_x==0 || mb_y==mb_y_firstrow || !s->dsp.h264_loop_filter_strength || h->pps.chroma_qp_diff || !(s->flags2 & CODEC_FLAG2_FAST) || (h->deblocking_filter == 2 && (h->slice_table[mb_xy] != h->slice_table[h->top_mb_xy] || h->slice_table[mb_xy] != h->slice_table[mb_xy - 1]))) { filter_mb(h, mb_x, mb_y, img_y, img_cb, img_cr, linesize, uvlinesize); return; } assert(!FRAME_MBAFF); mb_type = s->current_picture.mb_type[mb_xy]; qp = s->current_picture.qscale_table[mb_xy]; qp0 = s->current_picture.qscale_table[mb_xy-1]; qp1 = s->current_picture.qscale_table[h->top_mb_xy]; qpc = get_chroma_qp( h, 0, qp ); qpc0 = get_chroma_qp( h, 0, qp0 ); qpc1 = get_chroma_qp( h, 0, qp1 ); qp0 = (qp + qp0 + 1) >> 1; qp1 = (qp + qp1 + 1) >> 1; qpc0 = (qpc + qpc0 + 1) >> 1; qpc1 = (qpc + qpc1 + 1) >> 1; qp_thresh = 15 - h->slice_alpha_c0_offset; if(qp <= qp_thresh && qp0 <= qp_thresh && qp1 <= qp_thresh && qpc <= qp_thresh && qpc0 <= qp_thresh && qpc1 <= qp_thresh) return; if( IS_INTRA(mb_type) ) { int16_t bS4[4] = {4,4,4,4}; int16_t bS3[4] = {3,3,3,3}; int16_t *bSH = FIELD_PICTURE ? bS3 : bS4; if( IS_8x8DCT(mb_type) ) { filter_mb_edgev( h, &img_y[4*0], linesize, bS4, qp0 ); filter_mb_edgev( h, &img_y[4*2], linesize, bS3, qp ); filter_mb_edgeh( h, &img_y[4*0*linesize], linesize, bSH, qp1 ); filter_mb_edgeh( h, &img_y[4*2*linesize], linesize, bS3, qp ); } else { filter_mb_edgev( h, &img_y[4*0], linesize, bS4, qp0 ); filter_mb_edgev( h, &img_y[4*1], linesize, bS3, qp ); filter_mb_edgev( h, &img_y[4*2], linesize, bS3, qp ); filter_mb_edgev( h, &img_y[4*3], linesize, bS3, qp ); filter_mb_edgeh( h, &img_y[4*0*linesize], linesize, bSH, qp1 ); filter_mb_edgeh( h, &img_y[4*1*linesize], linesize, bS3, qp ); filter_mb_edgeh( h, &img_y[4*2*linesize], linesize, bS3, qp ); filter_mb_edgeh( h, &img_y[4*3*linesize], linesize, bS3, qp ); } filter_mb_edgecv( h, &img_cb[2*0], uvlinesize, bS4, qpc0 ); filter_mb_edgecv( h, &img_cb[2*2], uvlinesize, bS3, qpc ); filter_mb_edgecv( h, &img_cr[2*0], uvlinesize, bS4, qpc0 ); filter_mb_edgecv( h, &img_cr[2*2], uvlinesize, bS3, qpc ); filter_mb_edgech( h, &img_cb[2*0*uvlinesize], uvlinesize, bSH, qpc1 ); filter_mb_edgech( h, &img_cb[2*2*uvlinesize], uvlinesize, bS3, qpc ); filter_mb_edgech( h, &img_cr[2*0*uvlinesize], uvlinesize, bSH, qpc1 ); filter_mb_edgech( h, &img_cr[2*2*uvlinesize], uvlinesize, bS3, qpc ); return; } else { DECLARE_ALIGNED_8(int16_t, bS[2][4][4]); uint64_t (*bSv)[4] = (uint64_t(*)[4])bS; int edges; if( IS_8x8DCT(mb_type) && (h->cbp&7) == 7 ) { edges = 4; bSv[0][0] = bSv[0][2] = bSv[1][0] = bSv[1][2] = 0x0002000200020002ULL; } else { int mask_edge1 = (mb_type & (MB_TYPE_16x16 | MB_TYPE_8x16)) ? 3 : (mb_type & MB_TYPE_16x8) ? 1 : 0; int mask_edge0 = (mb_type & (MB_TYPE_16x16 | MB_TYPE_8x16)) && (s->current_picture.mb_type[mb_xy-1] & (MB_TYPE_16x16 | MB_TYPE_8x16)) ? 3 : 0; int step = IS_8x8DCT(mb_type) ? 2 : 1; edges = (mb_type & MB_TYPE_16x16) && !(h->cbp & 15) ? 1 : 4; s->dsp.h264_loop_filter_strength( bS, h->non_zero_count_cache, h->ref_cache, h->mv_cache, (h->slice_type_nos == FF_B_TYPE), edges, step, mask_edge0, mask_edge1, FIELD_PICTURE); } if( IS_INTRA(s->current_picture.mb_type[mb_xy-1]) ) bSv[0][0] = 0x0004000400040004ULL; if( IS_INTRA(s->current_picture.mb_type[h->top_mb_xy]) ) bSv[1][0] = FIELD_PICTURE ? 0x0003000300030003ULL : 0x0004000400040004ULL; #define FILTER(hv,dir,edge)\ if(bSv[dir][edge]) {\ filter_mb_edge##hv( h, &img_y[4*edge*(dir?linesize:1)], linesize, bS[dir][edge], edge ? qp : qp##dir );\ if(!(edge&1)) {\ filter_mb_edgec##hv( h, &img_cb[2*edge*(dir?uvlinesize:1)], uvlinesize, bS[dir][edge], edge ? qpc : qpc##dir );\ filter_mb_edgec##hv( h, &img_cr[2*edge*(dir?uvlinesize:1)], uvlinesize, bS[dir][edge], edge ? qpc : qpc##dir );\ }\ } if( edges == 1 ) { FILTER(v,0,0); FILTER(h,1,0); } else if( IS_8x8DCT(mb_type) ) { FILTER(v,0,0); FILTER(v,0,2); FILTER(h,1,0); FILTER(h,1,2); } else { FILTER(v,0,0); FILTER(v,0,1); FILTER(v,0,2); FILTER(v,0,3); FILTER(h,1,0); FILTER(h,1,1); FILTER(h,1,2); FILTER(h,1,3); } #undef FILTER } }
{ "code": [], "line_no": [] }
static void FUNC_0( H264Context *VAR_0, int VAR_1, int VAR_2, uint8_t *VAR_3, uint8_t *VAR_4, uint8_t *VAR_5, unsigned int VAR_6, unsigned int VAR_7) { MpegEncContext * const s = &VAR_0->s; int VAR_8 = s->picture_structure == PICT_BOTTOM_FIELD; int VAR_9, VAR_10; int VAR_11, VAR_12, VAR_13, VAR_14, VAR_15, VAR_16, VAR_17; VAR_9 = VAR_0->VAR_9; if(VAR_1==0 || VAR_2==VAR_8 || !s->dsp.h264_loop_filter_strength || VAR_0->pps.chroma_qp_diff || !(s->flags2 & CODEC_FLAG2_FAST) || (VAR_0->deblocking_filter == 2 && (VAR_0->slice_table[VAR_9] != VAR_0->slice_table[VAR_0->top_mb_xy] || VAR_0->slice_table[VAR_9] != VAR_0->slice_table[VAR_9 - 1]))) { filter_mb(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7); return; } assert(!FRAME_MBAFF); VAR_10 = s->current_picture.VAR_10[VAR_9]; VAR_11 = s->current_picture.qscale_table[VAR_9]; VAR_12 = s->current_picture.qscale_table[VAR_9-1]; VAR_13 = s->current_picture.qscale_table[VAR_0->top_mb_xy]; VAR_14 = get_chroma_qp( VAR_0, 0, VAR_11 ); VAR_15 = get_chroma_qp( VAR_0, 0, VAR_12 ); VAR_16 = get_chroma_qp( VAR_0, 0, VAR_13 ); VAR_12 = (VAR_11 + VAR_12 + 1) >> 1; VAR_13 = (VAR_11 + VAR_13 + 1) >> 1; VAR_15 = (VAR_14 + VAR_15 + 1) >> 1; VAR_16 = (VAR_14 + VAR_16 + 1) >> 1; VAR_17 = 15 - VAR_0->slice_alpha_c0_offset; if(VAR_11 <= VAR_17 && VAR_12 <= VAR_17 && VAR_13 <= VAR_17 && VAR_14 <= VAR_17 && VAR_15 <= VAR_17 && VAR_16 <= VAR_17) return; if( IS_INTRA(VAR_10) ) { int16_t bS4[4] = {4,4,4,4}; int16_t bS3[4] = {3,3,3,3}; int16_t *bSH = FIELD_PICTURE ? bS3 : bS4; if( IS_8x8DCT(VAR_10) ) { filter_mb_edgev( VAR_0, &VAR_3[4*0], VAR_6, bS4, VAR_12 ); filter_mb_edgev( VAR_0, &VAR_3[4*2], VAR_6, bS3, VAR_11 ); filter_mb_edgeh( VAR_0, &VAR_3[4*0*VAR_6], VAR_6, bSH, VAR_13 ); filter_mb_edgeh( VAR_0, &VAR_3[4*2*VAR_6], VAR_6, bS3, VAR_11 ); } else { filter_mb_edgev( VAR_0, &VAR_3[4*0], VAR_6, bS4, VAR_12 ); filter_mb_edgev( VAR_0, &VAR_3[4*1], VAR_6, bS3, VAR_11 ); filter_mb_edgev( VAR_0, &VAR_3[4*2], VAR_6, bS3, VAR_11 ); filter_mb_edgev( VAR_0, &VAR_3[4*3], VAR_6, bS3, VAR_11 ); filter_mb_edgeh( VAR_0, &VAR_3[4*0*VAR_6], VAR_6, bSH, VAR_13 ); filter_mb_edgeh( VAR_0, &VAR_3[4*1*VAR_6], VAR_6, bS3, VAR_11 ); filter_mb_edgeh( VAR_0, &VAR_3[4*2*VAR_6], VAR_6, bS3, VAR_11 ); filter_mb_edgeh( VAR_0, &VAR_3[4*3*VAR_6], VAR_6, bS3, VAR_11 ); } filter_mb_edgecv( VAR_0, &VAR_4[2*0], VAR_7, bS4, VAR_15 ); filter_mb_edgecv( VAR_0, &VAR_4[2*2], VAR_7, bS3, VAR_14 ); filter_mb_edgecv( VAR_0, &VAR_5[2*0], VAR_7, bS4, VAR_15 ); filter_mb_edgecv( VAR_0, &VAR_5[2*2], VAR_7, bS3, VAR_14 ); filter_mb_edgech( VAR_0, &VAR_4[2*0*VAR_7], VAR_7, bSH, VAR_16 ); filter_mb_edgech( VAR_0, &VAR_4[2*2*VAR_7], VAR_7, bS3, VAR_14 ); filter_mb_edgech( VAR_0, &VAR_5[2*0*VAR_7], VAR_7, bSH, VAR_16 ); filter_mb_edgech( VAR_0, &VAR_5[2*2*VAR_7], VAR_7, bS3, VAR_14 ); return; } else { DECLARE_ALIGNED_8(int16_t, bS[2][4][4]); uint64_t (*bSv)[4] = (uint64_t(*)[4])bS; int VAR_18; if( IS_8x8DCT(VAR_10) && (VAR_0->cbp&7) == 7 ) { VAR_18 = 4; bSv[0][0] = bSv[0][2] = bSv[1][0] = bSv[1][2] = 0x0002000200020002ULL; } else { int VAR_19 = (VAR_10 & (MB_TYPE_16x16 | MB_TYPE_8x16)) ? 3 : (VAR_10 & MB_TYPE_16x8) ? 1 : 0; int VAR_20 = (VAR_10 & (MB_TYPE_16x16 | MB_TYPE_8x16)) && (s->current_picture.VAR_10[VAR_9-1] & (MB_TYPE_16x16 | MB_TYPE_8x16)) ? 3 : 0; int VAR_21 = IS_8x8DCT(VAR_10) ? 2 : 1; VAR_18 = (VAR_10 & MB_TYPE_16x16) && !(VAR_0->cbp & 15) ? 1 : 4; s->dsp.h264_loop_filter_strength( bS, VAR_0->non_zero_count_cache, VAR_0->ref_cache, VAR_0->mv_cache, (VAR_0->slice_type_nos == FF_B_TYPE), VAR_18, VAR_21, VAR_20, VAR_19, FIELD_PICTURE); } if( IS_INTRA(s->current_picture.VAR_10[VAR_9-1]) ) bSv[0][0] = 0x0004000400040004ULL; if( IS_INTRA(s->current_picture.VAR_10[VAR_0->top_mb_xy]) ) bSv[1][0] = FIELD_PICTURE ? 0x0003000300030003ULL : 0x0004000400040004ULL; #define FILTER(hv,dir,edge)\ if(bSv[dir][edge]) {\ filter_mb_edge##hv( VAR_0, &VAR_3[4*edge*(dir?VAR_6:1)], VAR_6, bS[dir][edge], edge ? VAR_11 : VAR_11##dir );\ if(!(edge&1)) {\ filter_mb_edgec##hv( VAR_0, &VAR_4[2*edge*(dir?VAR_7:1)], VAR_7, bS[dir][edge], edge ? VAR_14 : VAR_14##dir );\ filter_mb_edgec##hv( VAR_0, &VAR_5[2*edge*(dir?VAR_7:1)], VAR_7, bS[dir][edge], edge ? VAR_14 : VAR_14##dir );\ }\ } if( VAR_18 == 1 ) { FILTER(v,0,0); FILTER(VAR_0,1,0); } else if( IS_8x8DCT(VAR_10) ) { FILTER(v,0,0); FILTER(v,0,2); FILTER(VAR_0,1,0); FILTER(VAR_0,1,2); } else { FILTER(v,0,0); FILTER(v,0,1); FILTER(v,0,2); FILTER(v,0,3); FILTER(VAR_0,1,0); FILTER(VAR_0,1,1); FILTER(VAR_0,1,2); FILTER(VAR_0,1,3); } #undef FILTER } }
[ "static void FUNC_0( H264Context *VAR_0, int VAR_1, int VAR_2, uint8_t *VAR_3, uint8_t *VAR_4, uint8_t *VAR_5, unsigned int VAR_6, unsigned int VAR_7) {", "MpegEncContext * const s = &VAR_0->s;", "int VAR_8 = s->picture_structure == PICT_BOTTOM_FIELD;", "int VAR_9, VAR_10;", "int VAR_11, VAR_12, VAR_13, VAR_14, VAR_15, VAR_16, VAR_17;", "VAR_9 = VAR_0->VAR_9;", "if(VAR_1==0 || VAR_2==VAR_8 || !s->dsp.h264_loop_filter_strength || VAR_0->pps.chroma_qp_diff ||\n!(s->flags2 & CODEC_FLAG2_FAST) ||\n(VAR_0->deblocking_filter == 2 && (VAR_0->slice_table[VAR_9] != VAR_0->slice_table[VAR_0->top_mb_xy] ||\nVAR_0->slice_table[VAR_9] != VAR_0->slice_table[VAR_9 - 1]))) {", "filter_mb(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7);", "return;", "}", "assert(!FRAME_MBAFF);", "VAR_10 = s->current_picture.VAR_10[VAR_9];", "VAR_11 = s->current_picture.qscale_table[VAR_9];", "VAR_12 = s->current_picture.qscale_table[VAR_9-1];", "VAR_13 = s->current_picture.qscale_table[VAR_0->top_mb_xy];", "VAR_14 = get_chroma_qp( VAR_0, 0, VAR_11 );", "VAR_15 = get_chroma_qp( VAR_0, 0, VAR_12 );", "VAR_16 = get_chroma_qp( VAR_0, 0, VAR_13 );", "VAR_12 = (VAR_11 + VAR_12 + 1) >> 1;", "VAR_13 = (VAR_11 + VAR_13 + 1) >> 1;", "VAR_15 = (VAR_14 + VAR_15 + 1) >> 1;", "VAR_16 = (VAR_14 + VAR_16 + 1) >> 1;", "VAR_17 = 15 - VAR_0->slice_alpha_c0_offset;", "if(VAR_11 <= VAR_17 && VAR_12 <= VAR_17 && VAR_13 <= VAR_17 &&\nVAR_14 <= VAR_17 && VAR_15 <= VAR_17 && VAR_16 <= VAR_17)\nreturn;", "if( IS_INTRA(VAR_10) ) {", "int16_t bS4[4] = {4,4,4,4};", "int16_t bS3[4] = {3,3,3,3};", "int16_t *bSH = FIELD_PICTURE ? bS3 : bS4;", "if( IS_8x8DCT(VAR_10) ) {", "filter_mb_edgev( VAR_0, &VAR_3[4*0], VAR_6, bS4, VAR_12 );", "filter_mb_edgev( VAR_0, &VAR_3[4*2], VAR_6, bS3, VAR_11 );", "filter_mb_edgeh( VAR_0, &VAR_3[4*0*VAR_6], VAR_6, bSH, VAR_13 );", "filter_mb_edgeh( VAR_0, &VAR_3[4*2*VAR_6], VAR_6, bS3, VAR_11 );", "} else {", "filter_mb_edgev( VAR_0, &VAR_3[4*0], VAR_6, bS4, VAR_12 );", "filter_mb_edgev( VAR_0, &VAR_3[4*1], VAR_6, bS3, VAR_11 );", "filter_mb_edgev( VAR_0, &VAR_3[4*2], VAR_6, bS3, VAR_11 );", "filter_mb_edgev( VAR_0, &VAR_3[4*3], VAR_6, bS3, VAR_11 );", "filter_mb_edgeh( VAR_0, &VAR_3[4*0*VAR_6], VAR_6, bSH, VAR_13 );", "filter_mb_edgeh( VAR_0, &VAR_3[4*1*VAR_6], VAR_6, bS3, VAR_11 );", "filter_mb_edgeh( VAR_0, &VAR_3[4*2*VAR_6], VAR_6, bS3, VAR_11 );", "filter_mb_edgeh( VAR_0, &VAR_3[4*3*VAR_6], VAR_6, bS3, VAR_11 );", "}", "filter_mb_edgecv( VAR_0, &VAR_4[2*0], VAR_7, bS4, VAR_15 );", "filter_mb_edgecv( VAR_0, &VAR_4[2*2], VAR_7, bS3, VAR_14 );", "filter_mb_edgecv( VAR_0, &VAR_5[2*0], VAR_7, bS4, VAR_15 );", "filter_mb_edgecv( VAR_0, &VAR_5[2*2], VAR_7, bS3, VAR_14 );", "filter_mb_edgech( VAR_0, &VAR_4[2*0*VAR_7], VAR_7, bSH, VAR_16 );", "filter_mb_edgech( VAR_0, &VAR_4[2*2*VAR_7], VAR_7, bS3, VAR_14 );", "filter_mb_edgech( VAR_0, &VAR_5[2*0*VAR_7], VAR_7, bSH, VAR_16 );", "filter_mb_edgech( VAR_0, &VAR_5[2*2*VAR_7], VAR_7, bS3, VAR_14 );", "return;", "} else {", "DECLARE_ALIGNED_8(int16_t, bS[2][4][4]);", "uint64_t (*bSv)[4] = (uint64_t(*)[4])bS;", "int VAR_18;", "if( IS_8x8DCT(VAR_10) && (VAR_0->cbp&7) == 7 ) {", "VAR_18 = 4;", "bSv[0][0] = bSv[0][2] = bSv[1][0] = bSv[1][2] = 0x0002000200020002ULL;", "} else {", "int VAR_19 = (VAR_10 & (MB_TYPE_16x16 | MB_TYPE_8x16)) ? 3 :\n(VAR_10 & MB_TYPE_16x8) ? 1 : 0;", "int VAR_20 = (VAR_10 & (MB_TYPE_16x16 | MB_TYPE_8x16))\n&& (s->current_picture.VAR_10[VAR_9-1] & (MB_TYPE_16x16 | MB_TYPE_8x16))\n? 3 : 0;", "int VAR_21 = IS_8x8DCT(VAR_10) ? 2 : 1;", "VAR_18 = (VAR_10 & MB_TYPE_16x16) && !(VAR_0->cbp & 15) ? 1 : 4;", "s->dsp.h264_loop_filter_strength( bS, VAR_0->non_zero_count_cache, VAR_0->ref_cache, VAR_0->mv_cache,\n(VAR_0->slice_type_nos == FF_B_TYPE), VAR_18, VAR_21, VAR_20, VAR_19, FIELD_PICTURE);", "}", "if( IS_INTRA(s->current_picture.VAR_10[VAR_9-1]) )\nbSv[0][0] = 0x0004000400040004ULL;", "if( IS_INTRA(s->current_picture.VAR_10[VAR_0->top_mb_xy]) )\nbSv[1][0] = FIELD_PICTURE ? 0x0003000300030003ULL : 0x0004000400040004ULL;", "#define FILTER(hv,dir,edge)\\\nif(bSv[dir][edge]) {\\", "filter_mb_edge##hv( VAR_0, &VAR_3[4*edge*(dir?VAR_6:1)], VAR_6, bS[dir][edge], edge ? VAR_11 : VAR_11##dir );\\", "if(!(edge&1)) {\\", "filter_mb_edgec##hv( VAR_0, &VAR_4[2*edge*(dir?VAR_7:1)], VAR_7, bS[dir][edge], edge ? VAR_14 : VAR_14##dir );\\", "filter_mb_edgec##hv( VAR_0, &VAR_5[2*edge*(dir?VAR_7:1)], VAR_7, bS[dir][edge], edge ? VAR_14 : VAR_14##dir );\\", "}\\", "}", "if( VAR_18 == 1 ) {", "FILTER(v,0,0);", "FILTER(VAR_0,1,0);", "} else if( IS_8x8DCT(VAR_10) ) {", "FILTER(v,0,0);", "FILTER(v,0,2);", "FILTER(VAR_0,1,0);", "FILTER(VAR_0,1,2);", "} else {", "FILTER(v,0,0);", "FILTER(v,0,1);", "FILTER(v,0,2);", "FILTER(v,0,3);", "FILTER(VAR_0,1,0);", "FILTER(VAR_0,1,1);", "FILTER(VAR_0,1,2);", "FILTER(VAR_0,1,3);", "}", "#undef FILTER\n}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17, 19, 21, 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59, 61, 63 ], [ 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 ], [ 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 ] ]
5,527
static int read_ffserver_streams(OptionsContext *o, AVFormatContext *s, const char *filename) { int i, err; AVFormatContext *ic = avformat_alloc_context(); ic->interrupt_callback = int_cb; err = avformat_open_input(&ic, filename, NULL, NULL); if (err < 0) return err; /* copy stream format */ for(i=0;i<ic->nb_streams;i++) { AVStream *st; OutputStream *ost; AVCodec *codec; const char *enc_config; codec = avcodec_find_encoder(ic->streams[i]->codecpar->codec_id); if (!codec) { av_log(s, AV_LOG_ERROR, "no encoder found for codec id %i\n", ic->streams[i]->codecpar->codec_id); return AVERROR(EINVAL); } if (codec->type == AVMEDIA_TYPE_AUDIO) opt_audio_codec(o, "c:a", codec->name); else if (codec->type == AVMEDIA_TYPE_VIDEO) opt_video_codec(o, "c:v", codec->name); ost = new_output_stream(o, s, codec->type, -1); st = ost->st; avcodec_get_context_defaults3(st->codec, codec); enc_config = av_stream_get_recommended_encoder_configuration(ic->streams[i]); if (enc_config) { AVDictionary *opts = NULL; av_dict_parse_string(&opts, enc_config, "=", ",", 0); av_opt_set_dict2(st->codec, &opts, AV_OPT_SEARCH_CHILDREN); av_dict_free(&opts); } if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && !ost->stream_copy) choose_sample_fmt(st, codec); else if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && !ost->stream_copy) choose_pixel_fmt(st, st->codec, codec, st->codecpar->format); avcodec_copy_context(ost->enc_ctx, st->codec); if (enc_config) av_dict_parse_string(&ost->encoder_opts, enc_config, "=", ",", 0); } avformat_close_input(&ic); return err; }
true
FFmpeg
2ba6d7cb8278970bb9971448706c1e44ba043a81
static int read_ffserver_streams(OptionsContext *o, AVFormatContext *s, const char *filename) { int i, err; AVFormatContext *ic = avformat_alloc_context(); ic->interrupt_callback = int_cb; err = avformat_open_input(&ic, filename, NULL, NULL); if (err < 0) return err; for(i=0;i<ic->nb_streams;i++) { AVStream *st; OutputStream *ost; AVCodec *codec; const char *enc_config; codec = avcodec_find_encoder(ic->streams[i]->codecpar->codec_id); if (!codec) { av_log(s, AV_LOG_ERROR, "no encoder found for codec id %i\n", ic->streams[i]->codecpar->codec_id); return AVERROR(EINVAL); } if (codec->type == AVMEDIA_TYPE_AUDIO) opt_audio_codec(o, "c:a", codec->name); else if (codec->type == AVMEDIA_TYPE_VIDEO) opt_video_codec(o, "c:v", codec->name); ost = new_output_stream(o, s, codec->type, -1); st = ost->st; avcodec_get_context_defaults3(st->codec, codec); enc_config = av_stream_get_recommended_encoder_configuration(ic->streams[i]); if (enc_config) { AVDictionary *opts = NULL; av_dict_parse_string(&opts, enc_config, "=", ",", 0); av_opt_set_dict2(st->codec, &opts, AV_OPT_SEARCH_CHILDREN); av_dict_free(&opts); } if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && !ost->stream_copy) choose_sample_fmt(st, codec); else if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && !ost->stream_copy) choose_pixel_fmt(st, st->codec, codec, st->codecpar->format); avcodec_copy_context(ost->enc_ctx, st->codec); if (enc_config) av_dict_parse_string(&ost->encoder_opts, enc_config, "=", ",", 0); } avformat_close_input(&ic); return err; }
{ "code": [], "line_no": [] }
static int FUNC_0(OptionsContext *VAR_0, AVFormatContext *VAR_1, const char *VAR_2) { int VAR_3, VAR_4; AVFormatContext *ic = avformat_alloc_context(); ic->interrupt_callback = int_cb; VAR_4 = avformat_open_input(&ic, VAR_2, NULL, NULL); if (VAR_4 < 0) return VAR_4; for(VAR_3=0;VAR_3<ic->nb_streams;VAR_3++) { AVStream *st; OutputStream *ost; AVCodec *codec; const char *enc_config; codec = avcodec_find_encoder(ic->streams[VAR_3]->codecpar->codec_id); if (!codec) { av_log(VAR_1, AV_LOG_ERROR, "no encoder found for codec id %VAR_3\n", ic->streams[VAR_3]->codecpar->codec_id); return AVERROR(EINVAL); } if (codec->type == AVMEDIA_TYPE_AUDIO) opt_audio_codec(VAR_0, "c:a", codec->name); else if (codec->type == AVMEDIA_TYPE_VIDEO) opt_video_codec(VAR_0, "c:v", codec->name); ost = new_output_stream(VAR_0, VAR_1, codec->type, -1); st = ost->st; avcodec_get_context_defaults3(st->codec, codec); enc_config = av_stream_get_recommended_encoder_configuration(ic->streams[VAR_3]); if (enc_config) { AVDictionary *opts = NULL; av_dict_parse_string(&opts, enc_config, "=", ",", 0); av_opt_set_dict2(st->codec, &opts, AV_OPT_SEARCH_CHILDREN); av_dict_free(&opts); } if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && !ost->stream_copy) choose_sample_fmt(st, codec); else if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && !ost->stream_copy) choose_pixel_fmt(st, st->codec, codec, st->codecpar->format); avcodec_copy_context(ost->enc_ctx, st->codec); if (enc_config) av_dict_parse_string(&ost->encoder_opts, enc_config, "=", ",", 0); } avformat_close_input(&ic); return VAR_4; }
[ "static int FUNC_0(OptionsContext *VAR_0, AVFormatContext *VAR_1, const char *VAR_2)\n{", "int VAR_3, VAR_4;", "AVFormatContext *ic = avformat_alloc_context();", "ic->interrupt_callback = int_cb;", "VAR_4 = avformat_open_input(&ic, VAR_2, NULL, NULL);", "if (VAR_4 < 0)\nreturn VAR_4;", "for(VAR_3=0;VAR_3<ic->nb_streams;VAR_3++) {", "AVStream *st;", "OutputStream *ost;", "AVCodec *codec;", "const char *enc_config;", "codec = avcodec_find_encoder(ic->streams[VAR_3]->codecpar->codec_id);", "if (!codec) {", "av_log(VAR_1, AV_LOG_ERROR, \"no encoder found for codec id %VAR_3\\n\", ic->streams[VAR_3]->codecpar->codec_id);", "return AVERROR(EINVAL);", "}", "if (codec->type == AVMEDIA_TYPE_AUDIO)\nopt_audio_codec(VAR_0, \"c:a\", codec->name);", "else if (codec->type == AVMEDIA_TYPE_VIDEO)\nopt_video_codec(VAR_0, \"c:v\", codec->name);", "ost = new_output_stream(VAR_0, VAR_1, codec->type, -1);", "st = ost->st;", "avcodec_get_context_defaults3(st->codec, codec);", "enc_config = av_stream_get_recommended_encoder_configuration(ic->streams[VAR_3]);", "if (enc_config) {", "AVDictionary *opts = NULL;", "av_dict_parse_string(&opts, enc_config, \"=\", \",\", 0);", "av_opt_set_dict2(st->codec, &opts, AV_OPT_SEARCH_CHILDREN);", "av_dict_free(&opts);", "}", "if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && !ost->stream_copy)\nchoose_sample_fmt(st, codec);", "else if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && !ost->stream_copy)\nchoose_pixel_fmt(st, st->codec, codec, st->codecpar->format);", "avcodec_copy_context(ost->enc_ctx, st->codec);", "if (enc_config)\nav_dict_parse_string(&ost->encoder_opts, enc_config, \"=\", \",\", 0);", "}", "avformat_close_input(&ic);", "return VAR_4;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 13 ], [ 15 ], [ 17, 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 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 ] ]
5,528
VirtIODevice *virtio_balloon_init(DeviceState *dev) { VirtIOBalloon *s; s = (VirtIOBalloon *)virtio_common_init("virtio-balloon", VIRTIO_ID_BALLOON, 8, sizeof(VirtIOBalloon)); s->vdev.get_config = virtio_balloon_get_config; s->vdev.set_config = virtio_balloon_set_config; s->vdev.get_features = virtio_balloon_get_features; s->ivq = virtio_add_queue(&s->vdev, 128, virtio_balloon_handle_output); s->dvq = virtio_add_queue(&s->vdev, 128, virtio_balloon_handle_output); s->svq = virtio_add_queue(&s->vdev, 128, virtio_balloon_receive_stats); reset_stats(s); qemu_add_balloon_handler(virtio_balloon_to_target, s); register_savevm(dev, "virtio-balloon", -1, 1, virtio_balloon_save, virtio_balloon_load, s); return &s->vdev; }
true
qemu
30fb2ca603e8b8d0f02630ef18bc0d0637a88ffa
VirtIODevice *virtio_balloon_init(DeviceState *dev) { VirtIOBalloon *s; s = (VirtIOBalloon *)virtio_common_init("virtio-balloon", VIRTIO_ID_BALLOON, 8, sizeof(VirtIOBalloon)); s->vdev.get_config = virtio_balloon_get_config; s->vdev.set_config = virtio_balloon_set_config; s->vdev.get_features = virtio_balloon_get_features; s->ivq = virtio_add_queue(&s->vdev, 128, virtio_balloon_handle_output); s->dvq = virtio_add_queue(&s->vdev, 128, virtio_balloon_handle_output); s->svq = virtio_add_queue(&s->vdev, 128, virtio_balloon_receive_stats); reset_stats(s); qemu_add_balloon_handler(virtio_balloon_to_target, s); register_savevm(dev, "virtio-balloon", -1, 1, virtio_balloon_save, virtio_balloon_load, s); return &s->vdev; }
{ "code": [ " qemu_add_balloon_handler(virtio_balloon_to_target, s);" ], "line_no": [ 35 ] }
VirtIODevice *FUNC_0(DeviceState *dev) { VirtIOBalloon *s; s = (VirtIOBalloon *)virtio_common_init("virtio-balloon", VIRTIO_ID_BALLOON, 8, sizeof(VirtIOBalloon)); s->vdev.get_config = virtio_balloon_get_config; s->vdev.set_config = virtio_balloon_set_config; s->vdev.get_features = virtio_balloon_get_features; s->ivq = virtio_add_queue(&s->vdev, 128, virtio_balloon_handle_output); s->dvq = virtio_add_queue(&s->vdev, 128, virtio_balloon_handle_output); s->svq = virtio_add_queue(&s->vdev, 128, virtio_balloon_receive_stats); reset_stats(s); qemu_add_balloon_handler(virtio_balloon_to_target, s); register_savevm(dev, "virtio-balloon", -1, 1, virtio_balloon_save, virtio_balloon_load, s); return &s->vdev; }
[ "VirtIODevice *FUNC_0(DeviceState *dev)\n{", "VirtIOBalloon *s;", "s = (VirtIOBalloon *)virtio_common_init(\"virtio-balloon\",\nVIRTIO_ID_BALLOON,\n8, sizeof(VirtIOBalloon));", "s->vdev.get_config = virtio_balloon_get_config;", "s->vdev.set_config = virtio_balloon_set_config;", "s->vdev.get_features = virtio_balloon_get_features;", "s->ivq = virtio_add_queue(&s->vdev, 128, virtio_balloon_handle_output);", "s->dvq = virtio_add_queue(&s->vdev, 128, virtio_balloon_handle_output);", "s->svq = virtio_add_queue(&s->vdev, 128, virtio_balloon_receive_stats);", "reset_stats(s);", "qemu_add_balloon_handler(virtio_balloon_to_target, s);", "register_savevm(dev, \"virtio-balloon\", -1, 1,\nvirtio_balloon_save, virtio_balloon_load, s);", "return &s->vdev;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11, 13 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 39, 41 ], [ 45 ], [ 47 ] ]
5,530
static int decode_audio(InputStream *ist, AVPacket *pkt, int *got_output) { AVFrame *decoded_frame, *f; AVCodecContext *avctx = ist->dec_ctx; int i, ret, err = 0; if (!ist->decoded_frame && !(ist->decoded_frame = av_frame_alloc())) return AVERROR(ENOMEM); if (!ist->filter_frame && !(ist->filter_frame = av_frame_alloc())) return AVERROR(ENOMEM); decoded_frame = ist->decoded_frame; ret = decode(avctx, decoded_frame, got_output, pkt); if (!*got_output || ret < 0) return ret; ist->samples_decoded += decoded_frame->nb_samples; ist->frames_decoded++; /* if the decoder provides a pts, use it instead of the last packet pts. the decoder could be delaying output by a packet or more. */ if (decoded_frame->pts != AV_NOPTS_VALUE) ist->next_dts = decoded_frame->pts; else if (pkt && pkt->pts != AV_NOPTS_VALUE) { decoded_frame->pts = pkt->pts; } if (decoded_frame->pts != AV_NOPTS_VALUE) decoded_frame->pts = av_rescale_q(decoded_frame->pts, ist->st->time_base, (AVRational){1, avctx->sample_rate}); ist->nb_samples = decoded_frame->nb_samples; for (i = 0; i < ist->nb_filters; i++) { if (i < ist->nb_filters - 1) { f = ist->filter_frame; err = av_frame_ref(f, decoded_frame); if (err < 0) break; } else f = decoded_frame; err = ifilter_send_frame(ist->filters[i], f); if (err < 0) break; } av_frame_unref(ist->filter_frame); av_frame_unref(decoded_frame); return err < 0 ? err : ret; }
true
FFmpeg
27085d1b47c3741cc0fac284c916127c4066d049
static int decode_audio(InputStream *ist, AVPacket *pkt, int *got_output) { AVFrame *decoded_frame, *f; AVCodecContext *avctx = ist->dec_ctx; int i, ret, err = 0; if (!ist->decoded_frame && !(ist->decoded_frame = av_frame_alloc())) return AVERROR(ENOMEM); if (!ist->filter_frame && !(ist->filter_frame = av_frame_alloc())) return AVERROR(ENOMEM); decoded_frame = ist->decoded_frame; ret = decode(avctx, decoded_frame, got_output, pkt); if (!*got_output || ret < 0) return ret; ist->samples_decoded += decoded_frame->nb_samples; ist->frames_decoded++; if (decoded_frame->pts != AV_NOPTS_VALUE) ist->next_dts = decoded_frame->pts; else if (pkt && pkt->pts != AV_NOPTS_VALUE) { decoded_frame->pts = pkt->pts; } if (decoded_frame->pts != AV_NOPTS_VALUE) decoded_frame->pts = av_rescale_q(decoded_frame->pts, ist->st->time_base, (AVRational){1, avctx->sample_rate}); ist->nb_samples = decoded_frame->nb_samples; for (i = 0; i < ist->nb_filters; i++) { if (i < ist->nb_filters - 1) { f = ist->filter_frame; err = av_frame_ref(f, decoded_frame); if (err < 0) break; } else f = decoded_frame; err = ifilter_send_frame(ist->filters[i], f); if (err < 0) break; } av_frame_unref(ist->filter_frame); av_frame_unref(decoded_frame); return err < 0 ? err : ret; }
{ "code": [ "static int decode_audio(InputStream *ist, AVPacket *pkt, int *got_output)" ], "line_no": [ 1 ] }
static int FUNC_0(InputStream *VAR_0, AVPacket *VAR_1, int *VAR_2) { AVFrame *decoded_frame, *f; AVCodecContext *avctx = VAR_0->dec_ctx; int VAR_3, VAR_4, VAR_5 = 0; if (!VAR_0->decoded_frame && !(VAR_0->decoded_frame = av_frame_alloc())) return AVERROR(ENOMEM); if (!VAR_0->filter_frame && !(VAR_0->filter_frame = av_frame_alloc())) return AVERROR(ENOMEM); decoded_frame = VAR_0->decoded_frame; VAR_4 = decode(avctx, decoded_frame, VAR_2, VAR_1); if (!*VAR_2 || VAR_4 < 0) return VAR_4; VAR_0->samples_decoded += decoded_frame->nb_samples; VAR_0->frames_decoded++; if (decoded_frame->pts != AV_NOPTS_VALUE) VAR_0->next_dts = decoded_frame->pts; else if (VAR_1 && VAR_1->pts != AV_NOPTS_VALUE) { decoded_frame->pts = VAR_1->pts; } if (decoded_frame->pts != AV_NOPTS_VALUE) decoded_frame->pts = av_rescale_q(decoded_frame->pts, VAR_0->st->time_base, (AVRational){1, avctx->sample_rate}); VAR_0->nb_samples = decoded_frame->nb_samples; for (VAR_3 = 0; VAR_3 < VAR_0->nb_filters; VAR_3++) { if (VAR_3 < VAR_0->nb_filters - 1) { f = VAR_0->filter_frame; VAR_5 = av_frame_ref(f, decoded_frame); if (VAR_5 < 0) break; } else f = decoded_frame; VAR_5 = ifilter_send_frame(VAR_0->filters[VAR_3], f); if (VAR_5 < 0) break; } av_frame_unref(VAR_0->filter_frame); av_frame_unref(decoded_frame); return VAR_5 < 0 ? VAR_5 : VAR_4; }
[ "static int FUNC_0(InputStream *VAR_0, AVPacket *VAR_1, int *VAR_2)\n{", "AVFrame *decoded_frame, *f;", "AVCodecContext *avctx = VAR_0->dec_ctx;", "int VAR_3, VAR_4, VAR_5 = 0;", "if (!VAR_0->decoded_frame && !(VAR_0->decoded_frame = av_frame_alloc()))\nreturn AVERROR(ENOMEM);", "if (!VAR_0->filter_frame && !(VAR_0->filter_frame = av_frame_alloc()))\nreturn AVERROR(ENOMEM);", "decoded_frame = VAR_0->decoded_frame;", "VAR_4 = decode(avctx, decoded_frame, VAR_2, VAR_1);", "if (!*VAR_2 || VAR_4 < 0)\nreturn VAR_4;", "VAR_0->samples_decoded += decoded_frame->nb_samples;", "VAR_0->frames_decoded++;", "if (decoded_frame->pts != AV_NOPTS_VALUE)\nVAR_0->next_dts = decoded_frame->pts;", "else if (VAR_1 && VAR_1->pts != AV_NOPTS_VALUE) {", "decoded_frame->pts = VAR_1->pts;", "}", "if (decoded_frame->pts != AV_NOPTS_VALUE)\ndecoded_frame->pts = av_rescale_q(decoded_frame->pts,\nVAR_0->st->time_base,\n(AVRational){1, avctx->sample_rate});", "VAR_0->nb_samples = decoded_frame->nb_samples;", "for (VAR_3 = 0; VAR_3 < VAR_0->nb_filters; VAR_3++) {", "if (VAR_3 < VAR_0->nb_filters - 1) {", "f = VAR_0->filter_frame;", "VAR_5 = av_frame_ref(f, decoded_frame);", "if (VAR_5 < 0)\nbreak;", "} else", "f = decoded_frame;", "VAR_5 = ifilter_send_frame(VAR_0->filters[VAR_3], f);", "if (VAR_5 < 0)\nbreak;", "}", "av_frame_unref(VAR_0->filter_frame);", "av_frame_unref(decoded_frame);", "return VAR_5 < 0 ? VAR_5 : VAR_4;", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13, 15 ], [ 17, 19 ], [ 21 ], [ 25 ], [ 27, 29 ], [ 33 ], [ 35 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55, 57, 59, 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73, 75 ], [ 77 ], [ 79 ], [ 83 ], [ 85, 87 ], [ 89 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ] ]
5,531
static void test_port(int port) { struct qhc uhci; g_assert(port > 0); qusb_pci_init_one(qs->pcibus, &uhci, QPCI_DEVFN(0x1d, 0), 4); uhci_port_test(&uhci, port - 1, UHCI_PORT_CCS); }
true
qemu
62030ed135e4cfb960cb626510cbb3ea77bb9ef9
static void test_port(int port) { struct qhc uhci; g_assert(port > 0); qusb_pci_init_one(qs->pcibus, &uhci, QPCI_DEVFN(0x1d, 0), 4); uhci_port_test(&uhci, port - 1, UHCI_PORT_CCS); }
{ "code": [], "line_no": [] }
static void FUNC_0(int VAR_0) { struct qhc VAR_1; g_assert(VAR_0 > 0); qusb_pci_init_one(qs->pcibus, &VAR_1, QPCI_DEVFN(0x1d, 0), 4); uhci_port_test(&VAR_1, VAR_0 - 1, UHCI_PORT_CCS); }
[ "static void FUNC_0(int VAR_0)\n{", "struct qhc VAR_1;", "g_assert(VAR_0 > 0);", "qusb_pci_init_one(qs->pcibus, &VAR_1, QPCI_DEVFN(0x1d, 0), 4);", "uhci_port_test(&VAR_1, VAR_0 - 1, UHCI_PORT_CCS);", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 16 ] ]
5,532
rgb16_32ToUV_c_template(uint8_t *dstU, uint8_t *dstV, const uint8_t *src, int width, enum PixelFormat origin, int shr, int shg, int shb, int shp, int maskr, int maskg, int maskb, int rsh, int gsh, int bsh, int S) { const int ru = RU << rsh, gu = GU << gsh, bu = BU << bsh, rv = RV << rsh, gv = GV << gsh, bv = BV << bsh, rnd = 257 << (S - 1); int i; for (i = 0; i < width; i++) { int px = input_pixel(i) >> shp; int b = (px & maskb) >> shb; int g = (px & maskg) >> shg; int r = (px & maskr) >> shr; dstU[i] = (ru * r + gu * g + bu * b + rnd) >> S; dstV[i] = (rv * r + gv * g + bv * b + rnd) >> S; } }
true
FFmpeg
4391805916a1557278351f25428d0145b1073520
rgb16_32ToUV_c_template(uint8_t *dstU, uint8_t *dstV, const uint8_t *src, int width, enum PixelFormat origin, int shr, int shg, int shb, int shp, int maskr, int maskg, int maskb, int rsh, int gsh, int bsh, int S) { const int ru = RU << rsh, gu = GU << gsh, bu = BU << bsh, rv = RV << rsh, gv = GV << gsh, bv = BV << bsh, rnd = 257 << (S - 1); int i; for (i = 0; i < width; i++) { int px = input_pixel(i) >> shp; int b = (px & maskb) >> shb; int g = (px & maskg) >> shg; int r = (px & maskr) >> shr; dstU[i] = (ru * r + gu * g + bu * b + rnd) >> S; dstV[i] = (rv * r + gv * g + bv * b + rnd) >> S; } }
{ "code": [ " rv = RV << rsh, gv = GV << gsh, bv = BV << bsh,", " rnd = 257 << (S - 1);" ], "line_no": [ 17, 19 ] }
FUNC_0(uint8_t *VAR_0, uint8_t *VAR_1, const uint8_t *VAR_2, int VAR_3, enum PixelFormat VAR_4, int VAR_5, int VAR_6, int VAR_7, int VAR_8, int VAR_9, int VAR_10, int VAR_11, int VAR_12, int VAR_13, int VAR_14, int VAR_15) { const int VAR_16 = RU << VAR_12, VAR_17 = GU << VAR_13, VAR_18 = BU << VAR_14, VAR_19 = RV << VAR_12, VAR_20 = GV << VAR_13, VAR_21 = BV << VAR_14, VAR_22 = 257 << (VAR_15 - 1); int VAR_23; for (VAR_23 = 0; VAR_23 < VAR_3; VAR_23++) { int VAR_24 = input_pixel(VAR_23) >> VAR_8; int VAR_25 = (VAR_24 & VAR_11) >> VAR_7; int VAR_26 = (VAR_24 & VAR_10) >> VAR_6; int VAR_27 = (VAR_24 & VAR_9) >> VAR_5; VAR_0[VAR_23] = (VAR_16 * VAR_27 + VAR_17 * VAR_26 + VAR_18 * VAR_25 + VAR_22) >> VAR_15; VAR_1[VAR_23] = (VAR_19 * VAR_27 + VAR_20 * VAR_26 + VAR_21 * VAR_25 + VAR_22) >> VAR_15; } }
[ "FUNC_0(uint8_t *VAR_0, uint8_t *VAR_1,\nconst uint8_t *VAR_2, int VAR_3,\nenum PixelFormat VAR_4,\nint VAR_5, int VAR_6, int VAR_7, int VAR_8,\nint VAR_9, int VAR_10, int VAR_11,\nint VAR_12, int VAR_13, int VAR_14, int VAR_15)\n{", "const int VAR_16 = RU << VAR_12, VAR_17 = GU << VAR_13, VAR_18 = BU << VAR_14,\nVAR_19 = RV << VAR_12, VAR_20 = GV << VAR_13, VAR_21 = BV << VAR_14,\nVAR_22 = 257 << (VAR_15 - 1);", "int VAR_23;", "for (VAR_23 = 0; VAR_23 < VAR_3; VAR_23++) {", "int VAR_24 = input_pixel(VAR_23) >> VAR_8;", "int VAR_25 = (VAR_24 & VAR_11) >> VAR_7;", "int VAR_26 = (VAR_24 & VAR_10) >> VAR_6;", "int VAR_27 = (VAR_24 & VAR_9) >> VAR_5;", "VAR_0[VAR_23] = (VAR_16 * VAR_27 + VAR_17 * VAR_26 + VAR_18 * VAR_25 + VAR_22) >> VAR_15;", "VAR_1[VAR_23] = (VAR_19 * VAR_27 + VAR_20 * VAR_26 + VAR_21 * VAR_25 + VAR_22) >> VAR_15;", "}", "}" ]
[ 0, 1, 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 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ] ]
5,533
void hmp_block_set_io_throttle(Monitor *mon, const QDict *qdict) { Error *err = NULL; qmp_block_set_io_throttle(qdict_get_str(qdict, "device"), qdict_get_int(qdict, "bps"), qdict_get_int(qdict, "bps_rd"), qdict_get_int(qdict, "bps_wr"), qdict_get_int(qdict, "iops"), qdict_get_int(qdict, "iops_rd"), qdict_get_int(qdict, "iops_wr"), &err); hmp_handle_error(mon, &err); }
true
qemu
3e9fab690d59ac15956c3733fe0794ce1ae4c4af
void hmp_block_set_io_throttle(Monitor *mon, const QDict *qdict) { Error *err = NULL; qmp_block_set_io_throttle(qdict_get_str(qdict, "device"), qdict_get_int(qdict, "bps"), qdict_get_int(qdict, "bps_rd"), qdict_get_int(qdict, "bps_wr"), qdict_get_int(qdict, "iops"), qdict_get_int(qdict, "iops_rd"), qdict_get_int(qdict, "iops_wr"), &err); hmp_handle_error(mon, &err); }
{ "code": [ " qdict_get_int(qdict, \"iops_wr\"), &err);" ], "line_no": [ 21 ] }
void FUNC_0(Monitor *VAR_0, const QDict *VAR_1) { Error *err = NULL; qmp_block_set_io_throttle(qdict_get_str(VAR_1, "device"), qdict_get_int(VAR_1, "bps"), qdict_get_int(VAR_1, "bps_rd"), qdict_get_int(VAR_1, "bps_wr"), qdict_get_int(VAR_1, "iops"), qdict_get_int(VAR_1, "iops_rd"), qdict_get_int(VAR_1, "iops_wr"), &err); hmp_handle_error(VAR_0, &err); }
[ "void FUNC_0(Monitor *VAR_0, const QDict *VAR_1)\n{", "Error *err = NULL;", "qmp_block_set_io_throttle(qdict_get_str(VAR_1, \"device\"),\nqdict_get_int(VAR_1, \"bps\"),\nqdict_get_int(VAR_1, \"bps_rd\"),\nqdict_get_int(VAR_1, \"bps_wr\"),\nqdict_get_int(VAR_1, \"iops\"),\nqdict_get_int(VAR_1, \"iops_rd\"),\nqdict_get_int(VAR_1, \"iops_wr\"), &err);", "hmp_handle_error(VAR_0, &err);", "}" ]
[ 0, 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11, 13, 15, 17, 19, 21 ], [ 23 ], [ 25 ] ]
5,534
void qemu_system_shutdown_request(void) { trace_qemu_system_shutdown_request(); replay_shutdown_request(); shutdown_requested = 1; qemu_notify_event(); }
true
qemu
aedbe19297907143f17b733a7ff0e0534377bed1
void qemu_system_shutdown_request(void) { trace_qemu_system_shutdown_request(); replay_shutdown_request(); shutdown_requested = 1; qemu_notify_event(); }
{ "code": [ " shutdown_requested = 1;", " shutdown_requested = 1;" ], "line_no": [ 9, 9 ] }
void FUNC_0(void) { trace_qemu_system_shutdown_request(); replay_shutdown_request(); shutdown_requested = 1; qemu_notify_event(); }
[ "void FUNC_0(void)\n{", "trace_qemu_system_shutdown_request();", "replay_shutdown_request();", "shutdown_requested = 1;", "qemu_notify_event();", "}" ]
[ 0, 0, 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ] ]
5,535
size_t mptsas_config_ioc_0(MPTSASState *s, uint8_t **data, int address) { PCIDeviceClass *pcic = PCI_DEVICE_GET_CLASS(s); return MPTSAS_CONFIG_PACK(0, MPI_CONFIG_PAGETYPE_IOC, 0x01, "*l*lwwb*b*b*blww", pcic->vendor_id, pcic->device_id, pcic->revision, pcic->subsystem_vendor_id, pcic->subsystem_id); }
true
qemu
65a8e1f6413a0f6f79894da710b5d6d43361d27d
size_t mptsas_config_ioc_0(MPTSASState *s, uint8_t **data, int address) { PCIDeviceClass *pcic = PCI_DEVICE_GET_CLASS(s); return MPTSAS_CONFIG_PACK(0, MPI_CONFIG_PAGETYPE_IOC, 0x01, "*l*lwwb*b*b*blww", pcic->vendor_id, pcic->device_id, pcic->revision, pcic->subsystem_vendor_id, pcic->subsystem_id); }
{ "code": [ " pcic->subsystem_vendor_id," ], "line_no": [ 15 ] }
size_t FUNC_0(MPTSASState *s, uint8_t **data, int address) { PCIDeviceClass *pcic = PCI_DEVICE_GET_CLASS(s); return MPTSAS_CONFIG_PACK(0, MPI_CONFIG_PAGETYPE_IOC, 0x01, "*l*lwwb*b*b*blww", pcic->vendor_id, pcic->device_id, pcic->revision, pcic->subsystem_vendor_id, pcic->subsystem_id); }
[ "size_t FUNC_0(MPTSASState *s, uint8_t **data, int address)\n{", "PCIDeviceClass *pcic = PCI_DEVICE_GET_CLASS(s);", "return MPTSAS_CONFIG_PACK(0, MPI_CONFIG_PAGETYPE_IOC, 0x01,\n\"*l*lwwb*b*b*blww\",\npcic->vendor_id, pcic->device_id, pcic->revision,\npcic->subsystem_vendor_id,\npcic->subsystem_id);", "}" ]
[ 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11, 13, 15, 17 ], [ 19 ] ]
5,536
static uint32_t sh_serial_ioport_read(void *opaque, uint32_t offs) { sh_serial_state *s = opaque; uint32_t ret = ~0; #if 0 switch(offs) { case 0x00: ret = s->smr; break; case 0x04: ret = s->brr; break; case 0x08: ret = s->scr; break; case 0x14: ret = 0; break; } #endif if (s->feat & SH_SERIAL_FEAT_SCIF) { switch(offs) { case 0x00: /* SMR */ ret = s->smr; break; case 0x08: /* SCR */ ret = s->scr; break; case 0x10: /* FSR */ ret = 0; if (s->flags & SH_SERIAL_FLAG_TEND) ret |= (1 << 6); if (s->flags & SH_SERIAL_FLAG_TDE) ret |= (1 << 5); if (s->flags & SH_SERIAL_FLAG_BRK) ret |= (1 << 4); if (s->flags & SH_SERIAL_FLAG_RDF) ret |= (1 << 1); if (s->flags & SH_SERIAL_FLAG_DR) ret |= (1 << 0); if (s->scr & (1 << 5)) s->flags |= SH_SERIAL_FLAG_TDE | SH_SERIAL_FLAG_TEND; break; case 0x14: if (s->rx_cnt > 0) { ret = s->rx_fifo[s->rx_tail++]; s->rx_cnt--; if (s->rx_tail == SH_RX_FIFO_LENGTH) s->rx_tail = 0; if (s->rx_cnt < s->rtrg) s->flags &= ~SH_SERIAL_FLAG_RDF; } break; #if 0 case 0x18: ret = s->fcr; break; #endif case 0x1c: ret = s->rx_cnt; break; case 0x20: ret = s->sptr; break; case 0x24: ret = 0; break; } } else { #if 0 switch(offs) { case 0x0c: ret = s->dr; break; case 0x10: ret = 0; break; case 0x14: ret = s->rx_fifo[0]; break; case 0x1c: ret = s->sptr; break; } #endif } #ifdef DEBUG_SERIAL printf("sh_serial: read offs=0x%02x val=0x%x\n", offs, ret); #endif if (ret & ~((1 << 16) - 1)) { fprintf(stderr, "sh_serial: unsupported read from 0x%02x\n", offs); assert(0); } return ret; }
true
qemu
d1f193b0edb919ab109f88c53469ec9073f2e142
static uint32_t sh_serial_ioport_read(void *opaque, uint32_t offs) { sh_serial_state *s = opaque; uint32_t ret = ~0; #if 0 switch(offs) { case 0x00: ret = s->smr; break; case 0x04: ret = s->brr; break; case 0x08: ret = s->scr; break; case 0x14: ret = 0; break; } #endif if (s->feat & SH_SERIAL_FEAT_SCIF) { switch(offs) { case 0x00: ret = s->smr; break; case 0x08: ret = s->scr; break; case 0x10: ret = 0; if (s->flags & SH_SERIAL_FLAG_TEND) ret |= (1 << 6); if (s->flags & SH_SERIAL_FLAG_TDE) ret |= (1 << 5); if (s->flags & SH_SERIAL_FLAG_BRK) ret |= (1 << 4); if (s->flags & SH_SERIAL_FLAG_RDF) ret |= (1 << 1); if (s->flags & SH_SERIAL_FLAG_DR) ret |= (1 << 0); if (s->scr & (1 << 5)) s->flags |= SH_SERIAL_FLAG_TDE | SH_SERIAL_FLAG_TEND; break; case 0x14: if (s->rx_cnt > 0) { ret = s->rx_fifo[s->rx_tail++]; s->rx_cnt--; if (s->rx_tail == SH_RX_FIFO_LENGTH) s->rx_tail = 0; if (s->rx_cnt < s->rtrg) s->flags &= ~SH_SERIAL_FLAG_RDF; } break; #if 0 case 0x18: ret = s->fcr; break; #endif case 0x1c: ret = s->rx_cnt; break; case 0x20: ret = s->sptr; break; case 0x24: ret = 0; break; } } else { #if 0 switch(offs) { case 0x0c: ret = s->dr; break; case 0x10: ret = 0; break; case 0x14: ret = s->rx_fifo[0]; break; case 0x1c: ret = s->sptr; break; } #endif } #ifdef DEBUG_SERIAL printf("sh_serial: read offs=0x%02x val=0x%x\n", offs, ret); #endif if (ret & ~((1 << 16) - 1)) { fprintf(stderr, "sh_serial: unsupported read from 0x%02x\n", offs); assert(0); } return ret; }
{ "code": [ "#if 0", " ret = s->sptr;", " break;", "#endif", "#if 0", "#endif" ], "line_no": [ 11, 131, 51, 41, 11, 41 ] }
static uint32_t FUNC_0(void *opaque, uint32_t offs) { sh_serial_state *s = opaque; uint32_t ret = ~0; #if 0 switch(offs) { case 0x00: ret = s->smr; break; case 0x04: ret = s->brr; break; case 0x08: ret = s->scr; break; case 0x14: ret = 0; break; } #endif if (s->feat & SH_SERIAL_FEAT_SCIF) { switch(offs) { case 0x00: ret = s->smr; break; case 0x08: ret = s->scr; break; case 0x10: ret = 0; if (s->flags & SH_SERIAL_FLAG_TEND) ret |= (1 << 6); if (s->flags & SH_SERIAL_FLAG_TDE) ret |= (1 << 5); if (s->flags & SH_SERIAL_FLAG_BRK) ret |= (1 << 4); if (s->flags & SH_SERIAL_FLAG_RDF) ret |= (1 << 1); if (s->flags & SH_SERIAL_FLAG_DR) ret |= (1 << 0); if (s->scr & (1 << 5)) s->flags |= SH_SERIAL_FLAG_TDE | SH_SERIAL_FLAG_TEND; break; case 0x14: if (s->rx_cnt > 0) { ret = s->rx_fifo[s->rx_tail++]; s->rx_cnt--; if (s->rx_tail == SH_RX_FIFO_LENGTH) s->rx_tail = 0; if (s->rx_cnt < s->rtrg) s->flags &= ~SH_SERIAL_FLAG_RDF; } break; #if 0 case 0x18: ret = s->fcr; break; #endif case 0x1c: ret = s->rx_cnt; break; case 0x20: ret = s->sptr; break; case 0x24: ret = 0; break; } } else { #if 0 switch(offs) { case 0x0c: ret = s->dr; break; case 0x10: ret = 0; break; case 0x14: ret = s->rx_fifo[0]; break; case 0x1c: ret = s->sptr; break; } #endif } #ifdef DEBUG_SERIAL printf("sh_serial: read offs=0x%02x val=0x%x\n", offs, ret); #endif if (ret & ~((1 << 16) - 1)) { fprintf(stderr, "sh_serial: unsupported read from 0x%02x\n", offs); assert(0); } return ret; }
[ "static uint32_t FUNC_0(void *opaque, uint32_t offs)\n{", "sh_serial_state *s = opaque;", "uint32_t ret = ~0;", "#if 0\nswitch(offs) {", "case 0x00:\nret = s->smr;", "break;", "case 0x04:\nret = s->brr;", "break;", "case 0x08:\nret = s->scr;", "break;", "case 0x14:\nret = 0;", "break;", "}", "#endif\nif (s->feat & SH_SERIAL_FEAT_SCIF) {", "switch(offs) {", "case 0x00:\nret = s->smr;", "break;", "case 0x08:\nret = s->scr;", "break;", "case 0x10:\nret = 0;", "if (s->flags & SH_SERIAL_FLAG_TEND)\nret |= (1 << 6);", "if (s->flags & SH_SERIAL_FLAG_TDE)\nret |= (1 << 5);", "if (s->flags & SH_SERIAL_FLAG_BRK)\nret |= (1 << 4);", "if (s->flags & SH_SERIAL_FLAG_RDF)\nret |= (1 << 1);", "if (s->flags & SH_SERIAL_FLAG_DR)\nret |= (1 << 0);", "if (s->scr & (1 << 5))\ns->flags |= SH_SERIAL_FLAG_TDE | SH_SERIAL_FLAG_TEND;", "break;", "case 0x14:\nif (s->rx_cnt > 0) {", "ret = s->rx_fifo[s->rx_tail++];", "s->rx_cnt--;", "if (s->rx_tail == SH_RX_FIFO_LENGTH)\ns->rx_tail = 0;", "if (s->rx_cnt < s->rtrg)\ns->flags &= ~SH_SERIAL_FLAG_RDF;", "}", "break;", "#if 0\ncase 0x18:\nret = s->fcr;", "break;", "#endif\ncase 0x1c:\nret = s->rx_cnt;", "break;", "case 0x20:\nret = s->sptr;", "break;", "case 0x24:\nret = 0;", "break;", "}", "}", "else {", "#if 0\nswitch(offs) {", "case 0x0c:\nret = s->dr;", "break;", "case 0x10:\nret = 0;", "break;", "case 0x14:\nret = s->rx_fifo[0];", "break;", "case 0x1c:\nret = s->sptr;", "break;", "}", "#endif\n}", "#ifdef DEBUG_SERIAL\nprintf(\"sh_serial: read offs=0x%02x val=0x%x\\n\",\noffs, ret);", "#endif\nif (ret & ~((1 << 16) - 1)) {", "fprintf(stderr, \"sh_serial: unsupported read from 0x%02x\\n\", offs);", "assert(0);", "}", "return ret;", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11, 13 ], [ 15, 17 ], [ 19 ], [ 21, 23 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 39 ], [ 41, 43 ], [ 45 ], [ 47, 49 ], [ 51 ], [ 53, 55 ], [ 57 ], [ 59, 61 ], [ 63, 65 ], [ 67, 69 ], [ 71, 73 ], [ 75, 77 ], [ 79, 81 ], [ 85, 87 ], [ 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, 191 ], [ 193 ], [ 195 ], [ 197 ], [ 201 ], [ 203 ] ]
5,537
void ide_dma_cb(void *opaque, int ret) { IDEState *s = opaque; int n; int64_t sector_num; bool stay_active = false; if (ret < 0) { int op = BM_STATUS_DMA_RETRY; if (s->dma_cmd == IDE_DMA_READ) op |= BM_STATUS_RETRY_READ; else if (s->dma_cmd == IDE_DMA_TRIM) op |= BM_STATUS_RETRY_TRIM; if (ide_handle_rw_error(s, -ret, op)) { 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) { dma_buf_commit(s); 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, ide_cmd_is_read(s)) == 0) { /* The PRDs were too short. Reset the Active bit, but don't raise an * interrupt. */ goto eot; #ifdef DEBUG_AIO printf("ide_dma_cb: sector_num=%" PRId64 " n=%d, cmd_cmd=%d\n", sector_num, n, s->dma_cmd); #endif switch (s->dma_cmd) { case IDE_DMA_READ: s->bus->dma->aiocb = dma_bdrv_read(s->bs, &s->sg, sector_num, ide_dma_cb, s); break; case IDE_DMA_WRITE: s->bus->dma->aiocb = dma_bdrv_write(s->bs, &s->sg, sector_num, ide_dma_cb, s); break; case IDE_DMA_TRIM: s->bus->dma->aiocb = dma_bdrv_io(s->bs, &s->sg, sector_num, ide_issue_trim, ide_dma_cb, s, DMA_DIRECTION_TO_DEVICE); break; return; eot: if (s->dma_cmd == IDE_DMA_READ || s->dma_cmd == IDE_DMA_WRITE) { bdrv_acct_done(s->bs, &s->acct); ide_set_inactive(s);
true
qemu
038268e2e8087ee2fd8987a77ba580e15f14c147
void ide_dma_cb(void *opaque, int ret) { IDEState *s = opaque; int n; int64_t sector_num; bool stay_active = false; if (ret < 0) { int op = BM_STATUS_DMA_RETRY; if (s->dma_cmd == IDE_DMA_READ) op |= BM_STATUS_RETRY_READ; else if (s->dma_cmd == IDE_DMA_TRIM) op |= BM_STATUS_RETRY_TRIM; if (ide_handle_rw_error(s, -ret, op)) { 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) { dma_buf_commit(s); 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, ide_cmd_is_read(s)) == 0) { goto eot; #ifdef DEBUG_AIO printf("ide_dma_cb: sector_num=%" PRId64 " n=%d, cmd_cmd=%d\n", sector_num, n, s->dma_cmd); #endif switch (s->dma_cmd) { case IDE_DMA_READ: s->bus->dma->aiocb = dma_bdrv_read(s->bs, &s->sg, sector_num, ide_dma_cb, s); break; case IDE_DMA_WRITE: s->bus->dma->aiocb = dma_bdrv_write(s->bs, &s->sg, sector_num, ide_dma_cb, s); break; case IDE_DMA_TRIM: s->bus->dma->aiocb = dma_bdrv_io(s->bs, &s->sg, sector_num, ide_issue_trim, ide_dma_cb, s, DMA_DIRECTION_TO_DEVICE); break; return; eot: if (s->dma_cmd == IDE_DMA_READ || s->dma_cmd == IDE_DMA_WRITE) { bdrv_acct_done(s->bs, &s->acct); ide_set_inactive(s);
{ "code": [], "line_no": [] }
void FUNC_0(void *VAR_0, int VAR_1) { IDEState *s = VAR_0; int VAR_2; int64_t sector_num; bool stay_active = false; if (VAR_1 < 0) { int VAR_3 = BM_STATUS_DMA_RETRY; if (s->dma_cmd == IDE_DMA_READ) VAR_3 |= BM_STATUS_RETRY_READ; else if (s->dma_cmd == IDE_DMA_TRIM) VAR_3 |= BM_STATUS_RETRY_TRIM; if (ide_handle_rw_error(s, -VAR_1, VAR_3)) { 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) { dma_buf_commit(s); 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, ide_cmd_is_read(s)) == 0) { goto eot; #ifdef DEBUG_AIO printf("FUNC_0: sector_num=%" PRId64 " VAR_2=%d, cmd_cmd=%d\VAR_2", sector_num, VAR_2, s->dma_cmd); #endif switch (s->dma_cmd) { case IDE_DMA_READ: s->bus->dma->aiocb = dma_bdrv_read(s->bs, &s->sg, sector_num, FUNC_0, s); break; case IDE_DMA_WRITE: s->bus->dma->aiocb = dma_bdrv_write(s->bs, &s->sg, sector_num, FUNC_0, s); break; case IDE_DMA_TRIM: s->bus->dma->aiocb = dma_bdrv_io(s->bs, &s->sg, sector_num, ide_issue_trim, FUNC_0, s, DMA_DIRECTION_TO_DEVICE); break; return; eot: if (s->dma_cmd == IDE_DMA_READ || s->dma_cmd == IDE_DMA_WRITE) { bdrv_acct_done(s->bs, &s->acct); ide_set_inactive(s);
[ "void FUNC_0(void *VAR_0, int VAR_1)\n{", "IDEState *s = VAR_0;", "int VAR_2;", "int64_t sector_num;", "bool stay_active = false;", "if (VAR_1 < 0) {", "int VAR_3 = BM_STATUS_DMA_RETRY;", "if (s->dma_cmd == IDE_DMA_READ)\nVAR_3 |= BM_STATUS_RETRY_READ;", "else if (s->dma_cmd == IDE_DMA_TRIM)\nVAR_3 |= BM_STATUS_RETRY_TRIM;", "if (ide_handle_rw_error(s, -VAR_1, VAR_3)) {", "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) {", "dma_buf_commit(s);", "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, ide_cmd_is_read(s)) == 0) {", "goto eot;", "#ifdef DEBUG_AIO\nprintf(\"FUNC_0: sector_num=%\" PRId64 \" VAR_2=%d, cmd_cmd=%d\\VAR_2\",\nsector_num, VAR_2, s->dma_cmd);", "#endif\nswitch (s->dma_cmd) {", "case IDE_DMA_READ:\ns->bus->dma->aiocb = dma_bdrv_read(s->bs, &s->sg, sector_num,\nFUNC_0, s);", "break;", "case IDE_DMA_WRITE:\ns->bus->dma->aiocb = dma_bdrv_write(s->bs, &s->sg, sector_num,\nFUNC_0, s);", "break;", "case IDE_DMA_TRIM:\ns->bus->dma->aiocb = dma_bdrv_io(s->bs, &s->sg, sector_num,\nide_issue_trim, FUNC_0, s,\nDMA_DIRECTION_TO_DEVICE);", "break;", "return;", "eot:\nif (s->dma_cmd == IDE_DMA_READ || s->dma_cmd == IDE_DMA_WRITE) {", "bdrv_acct_done(s->bs, &s->acct);", "ide_set_inactive(s);" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 21, 23 ], [ 25, 27 ], [ 31 ], [ 33 ], [ 39 ], [ 41 ], [ 49 ], [ 51 ], [ 56 ], [ 58 ], [ 60 ], [ 62 ], [ 64 ], [ 66 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 86 ], [ 88 ], [ 90 ], [ 92 ], [ 98 ], [ 103, 105, 107 ], [ 109, 113 ], [ 115, 117, 119 ], [ 121 ], [ 123, 125, 127 ], [ 129 ], [ 131, 133, 135, 137 ], [ 139 ], [ 142 ], [ 146, 148 ], [ 150 ], [ 153 ] ]
5,538
static void icp_realize(DeviceState *dev, Error **errp) { ICPState *icp = ICP(dev); ICPStateClass *icpc = ICP_GET_CLASS(dev); PowerPCCPU *cpu; CPUPPCState *env; Object *obj; Error *err = NULL; obj = object_property_get_link(OBJECT(dev), ICP_PROP_XICS, &err); if (!obj) { error_setg(errp, "%s: required link '" ICP_PROP_XICS "' not found: %s", __func__, error_get_pretty(err)); return; } icp->xics = XICS_FABRIC(obj); obj = object_property_get_link(OBJECT(dev), ICP_PROP_CPU, &err); if (!obj) { error_setg(errp, "%s: required link '" ICP_PROP_CPU "' not found: %s", __func__, error_get_pretty(err)); return; } cpu = POWERPC_CPU(obj); cpu->intc = OBJECT(icp); icp->cs = CPU(obj); env = &cpu->env; switch (PPC_INPUT(env)) { case PPC_FLAGS_INPUT_POWER7: icp->output = env->irq_inputs[POWER7_INPUT_INT]; break; case PPC_FLAGS_INPUT_970: icp->output = env->irq_inputs[PPC970_INPUT_INT]; break; default: error_setg(errp, "XICS interrupt controller does not support this CPU bus model"); return; } if (icpc->realize) { icpc->realize(icp, errp); } qemu_register_reset(icp_reset, dev); vmstate_register(NULL, icp->cs->cpu_index, &vmstate_icp_server, icp); }
true
qemu
a1a6bbde4f6a29368f8f605cea2e73630ec1bc7c
static void icp_realize(DeviceState *dev, Error **errp) { ICPState *icp = ICP(dev); ICPStateClass *icpc = ICP_GET_CLASS(dev); PowerPCCPU *cpu; CPUPPCState *env; Object *obj; Error *err = NULL; obj = object_property_get_link(OBJECT(dev), ICP_PROP_XICS, &err); if (!obj) { error_setg(errp, "%s: required link '" ICP_PROP_XICS "' not found: %s", __func__, error_get_pretty(err)); return; } icp->xics = XICS_FABRIC(obj); obj = object_property_get_link(OBJECT(dev), ICP_PROP_CPU, &err); if (!obj) { error_setg(errp, "%s: required link '" ICP_PROP_CPU "' not found: %s", __func__, error_get_pretty(err)); return; } cpu = POWERPC_CPU(obj); cpu->intc = OBJECT(icp); icp->cs = CPU(obj); env = &cpu->env; switch (PPC_INPUT(env)) { case PPC_FLAGS_INPUT_POWER7: icp->output = env->irq_inputs[POWER7_INPUT_INT]; break; case PPC_FLAGS_INPUT_970: icp->output = env->irq_inputs[PPC970_INPUT_INT]; break; default: error_setg(errp, "XICS interrupt controller does not support this CPU bus model"); return; } if (icpc->realize) { icpc->realize(icp, errp); } qemu_register_reset(icp_reset, dev); vmstate_register(NULL, icp->cs->cpu_index, &vmstate_icp_server, icp); }
{ "code": [ " error_setg(errp, \"%s: required link '\" ICP_PROP_XICS \"' not found: %s\",", " __func__, error_get_pretty(err));", " error_setg(errp, \"%s: required link '\" ICP_PROP_CPU \"' not found: %s\",", " __func__, error_get_pretty(err));", " __func__, error_get_pretty(err));" ], "line_no": [ 23, 25, 41, 25, 25 ] }
static void FUNC_0(DeviceState *VAR_0, Error **VAR_1) { ICPState *icp = ICP(VAR_0); ICPStateClass *icpc = ICP_GET_CLASS(VAR_0); PowerPCCPU *cpu; CPUPPCState *env; Object *obj; Error *err = NULL; obj = object_property_get_link(OBJECT(VAR_0), ICP_PROP_XICS, &err); if (!obj) { error_setg(VAR_1, "%s: required link '" ICP_PROP_XICS "' not found: %s", __func__, error_get_pretty(err)); return; } icp->xics = XICS_FABRIC(obj); obj = object_property_get_link(OBJECT(VAR_0), ICP_PROP_CPU, &err); if (!obj) { error_setg(VAR_1, "%s: required link '" ICP_PROP_CPU "' not found: %s", __func__, error_get_pretty(err)); return; } cpu = POWERPC_CPU(obj); cpu->intc = OBJECT(icp); icp->cs = CPU(obj); env = &cpu->env; switch (PPC_INPUT(env)) { case PPC_FLAGS_INPUT_POWER7: icp->output = env->irq_inputs[POWER7_INPUT_INT]; break; case PPC_FLAGS_INPUT_970: icp->output = env->irq_inputs[PPC970_INPUT_INT]; break; default: error_setg(VAR_1, "XICS interrupt controller does not support this CPU bus model"); return; } if (icpc->realize) { icpc->realize(icp, VAR_1); } qemu_register_reset(icp_reset, VAR_0); vmstate_register(NULL, icp->cs->cpu_index, &vmstate_icp_server, icp); }
[ "static void FUNC_0(DeviceState *VAR_0, Error **VAR_1)\n{", "ICPState *icp = ICP(VAR_0);", "ICPStateClass *icpc = ICP_GET_CLASS(VAR_0);", "PowerPCCPU *cpu;", "CPUPPCState *env;", "Object *obj;", "Error *err = NULL;", "obj = object_property_get_link(OBJECT(VAR_0), ICP_PROP_XICS, &err);", "if (!obj) {", "error_setg(VAR_1, \"%s: required link '\" ICP_PROP_XICS \"' not found: %s\",\n__func__, error_get_pretty(err));", "return;", "}", "icp->xics = XICS_FABRIC(obj);", "obj = object_property_get_link(OBJECT(VAR_0), ICP_PROP_CPU, &err);", "if (!obj) {", "error_setg(VAR_1, \"%s: required link '\" ICP_PROP_CPU \"' not found: %s\",\n__func__, error_get_pretty(err));", "return;", "}", "cpu = POWERPC_CPU(obj);", "cpu->intc = OBJECT(icp);", "icp->cs = CPU(obj);", "env = &cpu->env;", "switch (PPC_INPUT(env)) {", "case PPC_FLAGS_INPUT_POWER7:\nicp->output = env->irq_inputs[POWER7_INPUT_INT];", "break;", "case PPC_FLAGS_INPUT_970:\nicp->output = env->irq_inputs[PPC970_INPUT_INT];", "break;", "default:\nerror_setg(VAR_1, \"XICS interrupt controller does not support this CPU bus model\");", "return;", "}", "if (icpc->realize) {", "icpc->realize(icp, VAR_1);", "}", "qemu_register_reset(icp_reset, VAR_0);", "vmstate_register(NULL, icp->cs->cpu_index, &vmstate_icp_server, icp);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 29 ], [ 33 ], [ 37 ], [ 39 ], [ 41, 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63, 65 ], [ 67 ], [ 71, 73 ], [ 75 ], [ 79, 81 ], [ 83 ], [ 85 ], [ 89 ], [ 91 ], [ 93 ], [ 97 ], [ 99 ], [ 101 ] ]
5,540
static inline void gen_st8(TCGv val, TCGv addr, int index) { tcg_gen_qemu_st8(val, addr, index); dead_tmp(val); }
true
qemu
7d1b0095bff7157e856d1d0e6c4295641ced2752
static inline void gen_st8(TCGv val, TCGv addr, int index) { tcg_gen_qemu_st8(val, addr, index); dead_tmp(val); }
{ "code": [ " dead_tmp(val);", " dead_tmp(val);", " dead_tmp(val);" ], "line_no": [ 7, 7, 7 ] }
static inline void FUNC_0(TCGv VAR_0, TCGv VAR_1, int VAR_2) { tcg_gen_qemu_st8(VAR_0, VAR_1, VAR_2); dead_tmp(VAR_0); }
[ "static inline void FUNC_0(TCGv VAR_0, TCGv VAR_1, int VAR_2)\n{", "tcg_gen_qemu_st8(VAR_0, VAR_1, VAR_2);", "dead_tmp(VAR_0);", "}" ]
[ 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
5,541
static int show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_idx, InputStream *ist, int in_program) { AVStream *stream = ist->st; AVCodecParameters *par; AVCodecContext *dec_ctx; char val_str[128]; const char *s; AVRational sar, dar; AVBPrint pbuf; const AVCodecDescriptor *cd; int ret = 0; const char *profile = NULL; av_bprint_init(&pbuf, 1, AV_BPRINT_SIZE_UNLIMITED); writer_print_section_header(w, in_program ? SECTION_ID_PROGRAM_STREAM : SECTION_ID_STREAM); print_int("index", stream->index); par = stream->codecpar; dec_ctx = ist->dec_ctx; if (cd = avcodec_descriptor_get(par->codec_id)) { print_str("codec_name", cd->name); if (!do_bitexact) { print_str("codec_long_name", cd->long_name ? cd->long_name : "unknown"); } } else { print_str_opt("codec_name", "unknown"); if (!do_bitexact) { print_str_opt("codec_long_name", "unknown"); } } if (!do_bitexact && (profile = avcodec_profile_name(par->codec_id, par->profile))) print_str("profile", profile); else { if (par->profile != FF_PROFILE_UNKNOWN) { char profile_num[12]; snprintf(profile_num, sizeof(profile_num), "%d", par->profile); print_str("profile", profile_num); } else print_str_opt("profile", "unknown"); } s = av_get_media_type_string(par->codec_type); if (s) print_str ("codec_type", s); else print_str_opt("codec_type", "unknown"); #if FF_API_LAVF_AVCTX print_q("codec_time_base", dec_ctx->time_base, '/'); #endif /* print AVI/FourCC tag */ av_get_codec_tag_string(val_str, sizeof(val_str), par->codec_tag); print_str("codec_tag_string", val_str); print_fmt("codec_tag", "0x%04x", par->codec_tag); switch (par->codec_type) { case AVMEDIA_TYPE_VIDEO: print_int("width", par->width); print_int("height", par->height); if (dec_ctx) { print_int("coded_width", dec_ctx->coded_width); print_int("coded_height", dec_ctx->coded_height); } print_int("has_b_frames", par->video_delay); sar = av_guess_sample_aspect_ratio(fmt_ctx, stream, NULL); if (sar.den) { print_q("sample_aspect_ratio", sar, ':'); av_reduce(&dar.num, &dar.den, par->width * sar.num, par->height * sar.den, 1024*1024); print_q("display_aspect_ratio", dar, ':'); } else { print_str_opt("sample_aspect_ratio", "N/A"); print_str_opt("display_aspect_ratio", "N/A"); } s = av_get_pix_fmt_name(par->format); if (s) print_str ("pix_fmt", s); else print_str_opt("pix_fmt", "unknown"); print_int("level", par->level); if (par->color_range != AVCOL_RANGE_UNSPECIFIED) print_str ("color_range", av_color_range_name(par->color_range)); else print_str_opt("color_range", "N/A"); s = av_get_colorspace_name(par->color_space); if (s) print_str ("color_space", s); else print_str_opt("color_space", "unknown"); if (par->color_trc != AVCOL_TRC_UNSPECIFIED) print_str("color_transfer", av_color_transfer_name(par->color_trc)); else print_str_opt("color_transfer", av_color_transfer_name(par->color_trc)); if (par->color_primaries != AVCOL_PRI_UNSPECIFIED) print_str("color_primaries", av_color_primaries_name(par->color_primaries)); else print_str_opt("color_primaries", av_color_primaries_name(par->color_primaries)); if (par->chroma_location != AVCHROMA_LOC_UNSPECIFIED) print_str("chroma_location", av_chroma_location_name(par->chroma_location)); else print_str_opt("chroma_location", av_chroma_location_name(par->chroma_location)); #if FF_API_PRIVATE_OPT if (dec_ctx && dec_ctx->timecode_frame_start >= 0) { char tcbuf[AV_TIMECODE_STR_SIZE]; av_timecode_make_mpeg_tc_string(tcbuf, dec_ctx->timecode_frame_start); print_str("timecode", tcbuf); } else { print_str_opt("timecode", "N/A"); } #endif if (dec_ctx) print_int("refs", dec_ctx->refs); break; case AVMEDIA_TYPE_AUDIO: s = av_get_sample_fmt_name(par->format); if (s) print_str ("sample_fmt", s); else print_str_opt("sample_fmt", "unknown"); print_val("sample_rate", par->sample_rate, unit_hertz_str); print_int("channels", par->channels); if (par->channel_layout) { av_bprint_clear(&pbuf); av_bprint_channel_layout(&pbuf, par->channels, par->channel_layout); print_str ("channel_layout", pbuf.str); } else { print_str_opt("channel_layout", "unknown"); } print_int("bits_per_sample", av_get_bits_per_sample(par->codec_id)); break; case AVMEDIA_TYPE_SUBTITLE: if (par->width) print_int("width", par->width); else print_str_opt("width", "N/A"); if (par->height) print_int("height", par->height); else print_str_opt("height", "N/A"); break; } if (dec_ctx && dec_ctx->codec && dec_ctx->codec->priv_class && show_private_data) { const AVOption *opt = NULL; while (opt = av_opt_next(dec_ctx->priv_data,opt)) { uint8_t *str; if (opt->flags) continue; if (av_opt_get(dec_ctx->priv_data, opt->name, 0, &str) >= 0) { print_str(opt->name, str); av_free(str); } } } if (fmt_ctx->iformat->flags & AVFMT_SHOW_IDS) print_fmt ("id", "0x%x", stream->id); else print_str_opt("id", "N/A"); print_q("r_frame_rate", stream->r_frame_rate, '/'); print_q("avg_frame_rate", stream->avg_frame_rate, '/'); print_q("time_base", stream->time_base, '/'); print_ts ("start_pts", stream->start_time); print_time("start_time", stream->start_time, &stream->time_base); print_ts ("duration_ts", stream->duration); print_time("duration", stream->duration, &stream->time_base); if (par->bit_rate > 0) print_val ("bit_rate", par->bit_rate, unit_bit_per_second_str); else print_str_opt("bit_rate", "N/A"); #if FF_API_LAVF_AVCTX if (stream->codec->rc_max_rate > 0) print_val ("max_bit_rate", stream->codec->rc_max_rate, unit_bit_per_second_str); else print_str_opt("max_bit_rate", "N/A"); #endif if (dec_ctx && dec_ctx->bits_per_raw_sample > 0) print_fmt("bits_per_raw_sample", "%d", dec_ctx->bits_per_raw_sample); else print_str_opt("bits_per_raw_sample", "N/A"); if (stream->nb_frames) print_fmt ("nb_frames", "%"PRId64, stream->nb_frames); else print_str_opt("nb_frames", "N/A"); if (nb_streams_frames[stream_idx]) print_fmt ("nb_read_frames", "%"PRIu64, nb_streams_frames[stream_idx]); else print_str_opt("nb_read_frames", "N/A"); if (nb_streams_packets[stream_idx]) print_fmt ("nb_read_packets", "%"PRIu64, nb_streams_packets[stream_idx]); else print_str_opt("nb_read_packets", "N/A"); if (do_show_data) writer_print_data(w, "extradata", par->extradata, par->extradata_size); writer_print_data_hash(w, "extradata_hash", par->extradata, par->extradata_size); /* Print disposition information */ #define PRINT_DISPOSITION(flagname, name) do { \ print_int(name, !!(stream->disposition & AV_DISPOSITION_##flagname)); \ } while (0) if (do_show_stream_disposition) { writer_print_section_header(w, in_program ? SECTION_ID_PROGRAM_STREAM_DISPOSITION : SECTION_ID_STREAM_DISPOSITION); PRINT_DISPOSITION(DEFAULT, "default"); PRINT_DISPOSITION(DUB, "dub"); PRINT_DISPOSITION(ORIGINAL, "original"); PRINT_DISPOSITION(COMMENT, "comment"); PRINT_DISPOSITION(LYRICS, "lyrics"); PRINT_DISPOSITION(KARAOKE, "karaoke"); PRINT_DISPOSITION(FORCED, "forced"); PRINT_DISPOSITION(HEARING_IMPAIRED, "hearing_impaired"); PRINT_DISPOSITION(VISUAL_IMPAIRED, "visual_impaired"); PRINT_DISPOSITION(CLEAN_EFFECTS, "clean_effects"); PRINT_DISPOSITION(ATTACHED_PIC, "attached_pic"); writer_print_section_footer(w); } if (do_show_stream_tags) ret = show_tags(w, stream->metadata, in_program ? SECTION_ID_PROGRAM_STREAM_TAGS : SECTION_ID_STREAM_TAGS); if (stream->nb_side_data) { int i; writer_print_section_header(w, SECTION_ID_STREAM_SIDE_DATA_LIST); for (i = 0; i < stream->nb_side_data; i++) { AVPacketSideData *sd = &stream->side_data[i]; const char *name = av_packet_side_data_name(sd->type); writer_print_section_header(w, SECTION_ID_STREAM_SIDE_DATA); print_str("side_data_type", name ? name : "unknown"); print_int("side_data_size", sd->size); if (sd->type == AV_PKT_DATA_DISPLAYMATRIX && sd->size >= 9*4) { writer_print_integers(w, "displaymatrix", sd->data, 9, " %11d", 3, 4, 1); print_int("rotation", av_display_rotation_get((int32_t *)sd->data)); } writer_print_section_footer(w); } writer_print_section_footer(w); } writer_print_section_footer(w); av_bprint_finalize(&pbuf, NULL); fflush(stdout); return ret; }
false
FFmpeg
9cb1ed5735ec03f6331f9777e25aa2f736a9d60f
static int show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_idx, InputStream *ist, int in_program) { AVStream *stream = ist->st; AVCodecParameters *par; AVCodecContext *dec_ctx; char val_str[128]; const char *s; AVRational sar, dar; AVBPrint pbuf; const AVCodecDescriptor *cd; int ret = 0; const char *profile = NULL; av_bprint_init(&pbuf, 1, AV_BPRINT_SIZE_UNLIMITED); writer_print_section_header(w, in_program ? SECTION_ID_PROGRAM_STREAM : SECTION_ID_STREAM); print_int("index", stream->index); par = stream->codecpar; dec_ctx = ist->dec_ctx; if (cd = avcodec_descriptor_get(par->codec_id)) { print_str("codec_name", cd->name); if (!do_bitexact) { print_str("codec_long_name", cd->long_name ? cd->long_name : "unknown"); } } else { print_str_opt("codec_name", "unknown"); if (!do_bitexact) { print_str_opt("codec_long_name", "unknown"); } } if (!do_bitexact && (profile = avcodec_profile_name(par->codec_id, par->profile))) print_str("profile", profile); else { if (par->profile != FF_PROFILE_UNKNOWN) { char profile_num[12]; snprintf(profile_num, sizeof(profile_num), "%d", par->profile); print_str("profile", profile_num); } else print_str_opt("profile", "unknown"); } s = av_get_media_type_string(par->codec_type); if (s) print_str ("codec_type", s); else print_str_opt("codec_type", "unknown"); #if FF_API_LAVF_AVCTX print_q("codec_time_base", dec_ctx->time_base, '/'); #endif av_get_codec_tag_string(val_str, sizeof(val_str), par->codec_tag); print_str("codec_tag_string", val_str); print_fmt("codec_tag", "0x%04x", par->codec_tag); switch (par->codec_type) { case AVMEDIA_TYPE_VIDEO: print_int("width", par->width); print_int("height", par->height); if (dec_ctx) { print_int("coded_width", dec_ctx->coded_width); print_int("coded_height", dec_ctx->coded_height); } print_int("has_b_frames", par->video_delay); sar = av_guess_sample_aspect_ratio(fmt_ctx, stream, NULL); if (sar.den) { print_q("sample_aspect_ratio", sar, ':'); av_reduce(&dar.num, &dar.den, par->width * sar.num, par->height * sar.den, 1024*1024); print_q("display_aspect_ratio", dar, ':'); } else { print_str_opt("sample_aspect_ratio", "N/A"); print_str_opt("display_aspect_ratio", "N/A"); } s = av_get_pix_fmt_name(par->format); if (s) print_str ("pix_fmt", s); else print_str_opt("pix_fmt", "unknown"); print_int("level", par->level); if (par->color_range != AVCOL_RANGE_UNSPECIFIED) print_str ("color_range", av_color_range_name(par->color_range)); else print_str_opt("color_range", "N/A"); s = av_get_colorspace_name(par->color_space); if (s) print_str ("color_space", s); else print_str_opt("color_space", "unknown"); if (par->color_trc != AVCOL_TRC_UNSPECIFIED) print_str("color_transfer", av_color_transfer_name(par->color_trc)); else print_str_opt("color_transfer", av_color_transfer_name(par->color_trc)); if (par->color_primaries != AVCOL_PRI_UNSPECIFIED) print_str("color_primaries", av_color_primaries_name(par->color_primaries)); else print_str_opt("color_primaries", av_color_primaries_name(par->color_primaries)); if (par->chroma_location != AVCHROMA_LOC_UNSPECIFIED) print_str("chroma_location", av_chroma_location_name(par->chroma_location)); else print_str_opt("chroma_location", av_chroma_location_name(par->chroma_location)); #if FF_API_PRIVATE_OPT if (dec_ctx && dec_ctx->timecode_frame_start >= 0) { char tcbuf[AV_TIMECODE_STR_SIZE]; av_timecode_make_mpeg_tc_string(tcbuf, dec_ctx->timecode_frame_start); print_str("timecode", tcbuf); } else { print_str_opt("timecode", "N/A"); } #endif if (dec_ctx) print_int("refs", dec_ctx->refs); break; case AVMEDIA_TYPE_AUDIO: s = av_get_sample_fmt_name(par->format); if (s) print_str ("sample_fmt", s); else print_str_opt("sample_fmt", "unknown"); print_val("sample_rate", par->sample_rate, unit_hertz_str); print_int("channels", par->channels); if (par->channel_layout) { av_bprint_clear(&pbuf); av_bprint_channel_layout(&pbuf, par->channels, par->channel_layout); print_str ("channel_layout", pbuf.str); } else { print_str_opt("channel_layout", "unknown"); } print_int("bits_per_sample", av_get_bits_per_sample(par->codec_id)); break; case AVMEDIA_TYPE_SUBTITLE: if (par->width) print_int("width", par->width); else print_str_opt("width", "N/A"); if (par->height) print_int("height", par->height); else print_str_opt("height", "N/A"); break; } if (dec_ctx && dec_ctx->codec && dec_ctx->codec->priv_class && show_private_data) { const AVOption *opt = NULL; while (opt = av_opt_next(dec_ctx->priv_data,opt)) { uint8_t *str; if (opt->flags) continue; if (av_opt_get(dec_ctx->priv_data, opt->name, 0, &str) >= 0) { print_str(opt->name, str); av_free(str); } } } if (fmt_ctx->iformat->flags & AVFMT_SHOW_IDS) print_fmt ("id", "0x%x", stream->id); else print_str_opt("id", "N/A"); print_q("r_frame_rate", stream->r_frame_rate, '/'); print_q("avg_frame_rate", stream->avg_frame_rate, '/'); print_q("time_base", stream->time_base, '/'); print_ts ("start_pts", stream->start_time); print_time("start_time", stream->start_time, &stream->time_base); print_ts ("duration_ts", stream->duration); print_time("duration", stream->duration, &stream->time_base); if (par->bit_rate > 0) print_val ("bit_rate", par->bit_rate, unit_bit_per_second_str); else print_str_opt("bit_rate", "N/A"); #if FF_API_LAVF_AVCTX if (stream->codec->rc_max_rate > 0) print_val ("max_bit_rate", stream->codec->rc_max_rate, unit_bit_per_second_str); else print_str_opt("max_bit_rate", "N/A"); #endif if (dec_ctx && dec_ctx->bits_per_raw_sample > 0) print_fmt("bits_per_raw_sample", "%d", dec_ctx->bits_per_raw_sample); else print_str_opt("bits_per_raw_sample", "N/A"); if (stream->nb_frames) print_fmt ("nb_frames", "%"PRId64, stream->nb_frames); else print_str_opt("nb_frames", "N/A"); if (nb_streams_frames[stream_idx]) print_fmt ("nb_read_frames", "%"PRIu64, nb_streams_frames[stream_idx]); else print_str_opt("nb_read_frames", "N/A"); if (nb_streams_packets[stream_idx]) print_fmt ("nb_read_packets", "%"PRIu64, nb_streams_packets[stream_idx]); else print_str_opt("nb_read_packets", "N/A"); if (do_show_data) writer_print_data(w, "extradata", par->extradata, par->extradata_size); writer_print_data_hash(w, "extradata_hash", par->extradata, par->extradata_size); #define PRINT_DISPOSITION(flagname, name) do { \ print_int(name, !!(stream->disposition & AV_DISPOSITION_##flagname)); \ } while (0) if (do_show_stream_disposition) { writer_print_section_header(w, in_program ? SECTION_ID_PROGRAM_STREAM_DISPOSITION : SECTION_ID_STREAM_DISPOSITION); PRINT_DISPOSITION(DEFAULT, "default"); PRINT_DISPOSITION(DUB, "dub"); PRINT_DISPOSITION(ORIGINAL, "original"); PRINT_DISPOSITION(COMMENT, "comment"); PRINT_DISPOSITION(LYRICS, "lyrics"); PRINT_DISPOSITION(KARAOKE, "karaoke"); PRINT_DISPOSITION(FORCED, "forced"); PRINT_DISPOSITION(HEARING_IMPAIRED, "hearing_impaired"); PRINT_DISPOSITION(VISUAL_IMPAIRED, "visual_impaired"); PRINT_DISPOSITION(CLEAN_EFFECTS, "clean_effects"); PRINT_DISPOSITION(ATTACHED_PIC, "attached_pic"); writer_print_section_footer(w); } if (do_show_stream_tags) ret = show_tags(w, stream->metadata, in_program ? SECTION_ID_PROGRAM_STREAM_TAGS : SECTION_ID_STREAM_TAGS); if (stream->nb_side_data) { int i; writer_print_section_header(w, SECTION_ID_STREAM_SIDE_DATA_LIST); for (i = 0; i < stream->nb_side_data; i++) { AVPacketSideData *sd = &stream->side_data[i]; const char *name = av_packet_side_data_name(sd->type); writer_print_section_header(w, SECTION_ID_STREAM_SIDE_DATA); print_str("side_data_type", name ? name : "unknown"); print_int("side_data_size", sd->size); if (sd->type == AV_PKT_DATA_DISPLAYMATRIX && sd->size >= 9*4) { writer_print_integers(w, "displaymatrix", sd->data, 9, " %11d", 3, 4, 1); print_int("rotation", av_display_rotation_get((int32_t *)sd->data)); } writer_print_section_footer(w); } writer_print_section_footer(w); } writer_print_section_footer(w); av_bprint_finalize(&pbuf, NULL); fflush(stdout); return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(WriterContext *VAR_0, AVFormatContext *VAR_1, int VAR_2, InputStream *VAR_3, int VAR_4) { AVStream *stream = VAR_3->st; AVCodecParameters *par; AVCodecContext *dec_ctx; char VAR_5[128]; const char *VAR_6; AVRational sar, dar; AVBPrint pbuf; const AVCodecDescriptor *VAR_7; int VAR_8 = 0; const char *VAR_9 = NULL; av_bprint_init(&pbuf, 1, AV_BPRINT_SIZE_UNLIMITED); writer_print_section_header(VAR_0, VAR_4 ? SECTION_ID_PROGRAM_STREAM : SECTION_ID_STREAM); print_int("index", stream->index); par = stream->codecpar; dec_ctx = VAR_3->dec_ctx; if (VAR_7 = avcodec_descriptor_get(par->codec_id)) { print_str("codec_name", VAR_7->name); if (!do_bitexact) { print_str("codec_long_name", VAR_7->long_name ? VAR_7->long_name : "unknown"); } } else { print_str_opt("codec_name", "unknown"); if (!do_bitexact) { print_str_opt("codec_long_name", "unknown"); } } if (!do_bitexact && (VAR_9 = avcodec_profile_name(par->codec_id, par->VAR_9))) print_str("VAR_9", VAR_9); else { if (par->VAR_9 != FF_PROFILE_UNKNOWN) { char VAR_10[12]; snprintf(VAR_10, sizeof(VAR_10), "%d", par->VAR_9); print_str("VAR_9", VAR_10); } else print_str_opt("VAR_9", "unknown"); } VAR_6 = av_get_media_type_string(par->codec_type); if (VAR_6) print_str ("codec_type", VAR_6); else print_str_opt("codec_type", "unknown"); #if FF_API_LAVF_AVCTX print_q("codec_time_base", dec_ctx->time_base, '/'); #endif av_get_codec_tag_string(VAR_5, sizeof(VAR_5), par->codec_tag); print_str("codec_tag_string", VAR_5); print_fmt("codec_tag", "0x%04x", par->codec_tag); switch (par->codec_type) { case AVMEDIA_TYPE_VIDEO: print_int("width", par->width); print_int("height", par->height); if (dec_ctx) { print_int("coded_width", dec_ctx->coded_width); print_int("coded_height", dec_ctx->coded_height); } print_int("has_b_frames", par->video_delay); sar = av_guess_sample_aspect_ratio(VAR_1, stream, NULL); if (sar.den) { print_q("sample_aspect_ratio", sar, ':'); av_reduce(&dar.num, &dar.den, par->width * sar.num, par->height * sar.den, 1024*1024); print_q("display_aspect_ratio", dar, ':'); } else { print_str_opt("sample_aspect_ratio", "N/A"); print_str_opt("display_aspect_ratio", "N/A"); } VAR_6 = av_get_pix_fmt_name(par->format); if (VAR_6) print_str ("pix_fmt", VAR_6); else print_str_opt("pix_fmt", "unknown"); print_int("level", par->level); if (par->color_range != AVCOL_RANGE_UNSPECIFIED) print_str ("color_range", av_color_range_name(par->color_range)); else print_str_opt("color_range", "N/A"); VAR_6 = av_get_colorspace_name(par->color_space); if (VAR_6) print_str ("color_space", VAR_6); else print_str_opt("color_space", "unknown"); if (par->color_trc != AVCOL_TRC_UNSPECIFIED) print_str("color_transfer", av_color_transfer_name(par->color_trc)); else print_str_opt("color_transfer", av_color_transfer_name(par->color_trc)); if (par->color_primaries != AVCOL_PRI_UNSPECIFIED) print_str("color_primaries", av_color_primaries_name(par->color_primaries)); else print_str_opt("color_primaries", av_color_primaries_name(par->color_primaries)); if (par->chroma_location != AVCHROMA_LOC_UNSPECIFIED) print_str("chroma_location", av_chroma_location_name(par->chroma_location)); else print_str_opt("chroma_location", av_chroma_location_name(par->chroma_location)); #if FF_API_PRIVATE_OPT if (dec_ctx && dec_ctx->timecode_frame_start >= 0) { char tcbuf[AV_TIMECODE_STR_SIZE]; av_timecode_make_mpeg_tc_string(tcbuf, dec_ctx->timecode_frame_start); print_str("timecode", tcbuf); } else { print_str_opt("timecode", "N/A"); } #endif if (dec_ctx) print_int("refs", dec_ctx->refs); break; case AVMEDIA_TYPE_AUDIO: VAR_6 = av_get_sample_fmt_name(par->format); if (VAR_6) print_str ("sample_fmt", VAR_6); else print_str_opt("sample_fmt", "unknown"); print_val("sample_rate", par->sample_rate, unit_hertz_str); print_int("channels", par->channels); if (par->channel_layout) { av_bprint_clear(&pbuf); av_bprint_channel_layout(&pbuf, par->channels, par->channel_layout); print_str ("channel_layout", pbuf.str); } else { print_str_opt("channel_layout", "unknown"); } print_int("bits_per_sample", av_get_bits_per_sample(par->codec_id)); break; case AVMEDIA_TYPE_SUBTITLE: if (par->width) print_int("width", par->width); else print_str_opt("width", "N/A"); if (par->height) print_int("height", par->height); else print_str_opt("height", "N/A"); break; } if (dec_ctx && dec_ctx->codec && dec_ctx->codec->priv_class && show_private_data) { const AVOption *VAR_11 = NULL; while (VAR_11 = av_opt_next(dec_ctx->priv_data,VAR_11)) { uint8_t *str; if (VAR_11->flags) continue; if (av_opt_get(dec_ctx->priv_data, VAR_11->name, 0, &str) >= 0) { print_str(VAR_11->name, str); av_free(str); } } } if (VAR_1->iformat->flags & AVFMT_SHOW_IDS) print_fmt ("id", "0x%x", stream->id); else print_str_opt("id", "N/A"); print_q("r_frame_rate", stream->r_frame_rate, '/'); print_q("avg_frame_rate", stream->avg_frame_rate, '/'); print_q("time_base", stream->time_base, '/'); print_ts ("start_pts", stream->start_time); print_time("start_time", stream->start_time, &stream->time_base); print_ts ("duration_ts", stream->duration); print_time("duration", stream->duration, &stream->time_base); if (par->bit_rate > 0) print_val ("bit_rate", par->bit_rate, unit_bit_per_second_str); else print_str_opt("bit_rate", "N/A"); #if FF_API_LAVF_AVCTX if (stream->codec->rc_max_rate > 0) print_val ("max_bit_rate", stream->codec->rc_max_rate, unit_bit_per_second_str); else print_str_opt("max_bit_rate", "N/A"); #endif if (dec_ctx && dec_ctx->bits_per_raw_sample > 0) print_fmt("bits_per_raw_sample", "%d", dec_ctx->bits_per_raw_sample); else print_str_opt("bits_per_raw_sample", "N/A"); if (stream->nb_frames) print_fmt ("nb_frames", "%"PRId64, stream->nb_frames); else print_str_opt("nb_frames", "N/A"); if (nb_streams_frames[VAR_2]) print_fmt ("nb_read_frames", "%"PRIu64, nb_streams_frames[VAR_2]); else print_str_opt("nb_read_frames", "N/A"); if (nb_streams_packets[VAR_2]) print_fmt ("nb_read_packets", "%"PRIu64, nb_streams_packets[VAR_2]); else print_str_opt("nb_read_packets", "N/A"); if (do_show_data) writer_print_data(VAR_0, "extradata", par->extradata, par->extradata_size); writer_print_data_hash(VAR_0, "extradata_hash", par->extradata, par->extradata_size); #define PRINT_DISPOSITION(flagname, name) do { \ print_int(name, !!(stream->disposition & AV_DISPOSITION_##flagname)); \ } while (0) if (do_show_stream_disposition) { writer_print_section_header(VAR_0, VAR_4 ? SECTION_ID_PROGRAM_STREAM_DISPOSITION : SECTION_ID_STREAM_DISPOSITION); PRINT_DISPOSITION(DEFAULT, "default"); PRINT_DISPOSITION(DUB, "dub"); PRINT_DISPOSITION(ORIGINAL, "original"); PRINT_DISPOSITION(COMMENT, "comment"); PRINT_DISPOSITION(LYRICS, "lyrics"); PRINT_DISPOSITION(KARAOKE, "karaoke"); PRINT_DISPOSITION(FORCED, "forced"); PRINT_DISPOSITION(HEARING_IMPAIRED, "hearing_impaired"); PRINT_DISPOSITION(VISUAL_IMPAIRED, "visual_impaired"); PRINT_DISPOSITION(CLEAN_EFFECTS, "clean_effects"); PRINT_DISPOSITION(ATTACHED_PIC, "attached_pic"); writer_print_section_footer(VAR_0); } if (do_show_stream_tags) VAR_8 = show_tags(VAR_0, stream->metadata, VAR_4 ? SECTION_ID_PROGRAM_STREAM_TAGS : SECTION_ID_STREAM_TAGS); if (stream->nb_side_data) { int i; writer_print_section_header(VAR_0, SECTION_ID_STREAM_SIDE_DATA_LIST); for (i = 0; i < stream->nb_side_data; i++) { AVPacketSideData *sd = &stream->side_data[i]; const char *name = av_packet_side_data_name(sd->type); writer_print_section_header(VAR_0, SECTION_ID_STREAM_SIDE_DATA); print_str("side_data_type", name ? name : "unknown"); print_int("side_data_size", sd->size); if (sd->type == AV_PKT_DATA_DISPLAYMATRIX && sd->size >= 9*4) { writer_print_integers(VAR_0, "displaymatrix", sd->data, 9, " %11d", 3, 4, 1); print_int("rotation", av_display_rotation_get((int32_t *)sd->data)); } writer_print_section_footer(VAR_0); } writer_print_section_footer(VAR_0); } writer_print_section_footer(VAR_0); av_bprint_finalize(&pbuf, NULL); fflush(stdout); return VAR_8; }
[ "static int FUNC_0(WriterContext *VAR_0, AVFormatContext *VAR_1, int VAR_2, InputStream *VAR_3, int VAR_4)\n{", "AVStream *stream = VAR_3->st;", "AVCodecParameters *par;", "AVCodecContext *dec_ctx;", "char VAR_5[128];", "const char *VAR_6;", "AVRational sar, dar;", "AVBPrint pbuf;", "const AVCodecDescriptor *VAR_7;", "int VAR_8 = 0;", "const char *VAR_9 = NULL;", "av_bprint_init(&pbuf, 1, AV_BPRINT_SIZE_UNLIMITED);", "writer_print_section_header(VAR_0, VAR_4 ? SECTION_ID_PROGRAM_STREAM : SECTION_ID_STREAM);", "print_int(\"index\", stream->index);", "par = stream->codecpar;", "dec_ctx = VAR_3->dec_ctx;", "if (VAR_7 = avcodec_descriptor_get(par->codec_id)) {", "print_str(\"codec_name\", VAR_7->name);", "if (!do_bitexact) {", "print_str(\"codec_long_name\",\nVAR_7->long_name ? VAR_7->long_name : \"unknown\");", "}", "} else {", "print_str_opt(\"codec_name\", \"unknown\");", "if (!do_bitexact) {", "print_str_opt(\"codec_long_name\", \"unknown\");", "}", "}", "if (!do_bitexact && (VAR_9 = avcodec_profile_name(par->codec_id, par->VAR_9)))\nprint_str(\"VAR_9\", VAR_9);", "else {", "if (par->VAR_9 != FF_PROFILE_UNKNOWN) {", "char VAR_10[12];", "snprintf(VAR_10, sizeof(VAR_10), \"%d\", par->VAR_9);", "print_str(\"VAR_9\", VAR_10);", "} else", "print_str_opt(\"VAR_9\", \"unknown\");", "}", "VAR_6 = av_get_media_type_string(par->codec_type);", "if (VAR_6) print_str (\"codec_type\", VAR_6);", "else print_str_opt(\"codec_type\", \"unknown\");", "#if FF_API_LAVF_AVCTX\nprint_q(\"codec_time_base\", dec_ctx->time_base, '/');", "#endif\nav_get_codec_tag_string(VAR_5, sizeof(VAR_5), par->codec_tag);", "print_str(\"codec_tag_string\", VAR_5);", "print_fmt(\"codec_tag\", \"0x%04x\", par->codec_tag);", "switch (par->codec_type) {", "case AVMEDIA_TYPE_VIDEO:\nprint_int(\"width\", par->width);", "print_int(\"height\", par->height);", "if (dec_ctx) {", "print_int(\"coded_width\", dec_ctx->coded_width);", "print_int(\"coded_height\", dec_ctx->coded_height);", "}", "print_int(\"has_b_frames\", par->video_delay);", "sar = av_guess_sample_aspect_ratio(VAR_1, stream, NULL);", "if (sar.den) {", "print_q(\"sample_aspect_ratio\", sar, ':');", "av_reduce(&dar.num, &dar.den,\npar->width * sar.num,\npar->height * sar.den,\n1024*1024);", "print_q(\"display_aspect_ratio\", dar, ':');", "} else {", "print_str_opt(\"sample_aspect_ratio\", \"N/A\");", "print_str_opt(\"display_aspect_ratio\", \"N/A\");", "}", "VAR_6 = av_get_pix_fmt_name(par->format);", "if (VAR_6) print_str (\"pix_fmt\", VAR_6);", "else print_str_opt(\"pix_fmt\", \"unknown\");", "print_int(\"level\", par->level);", "if (par->color_range != AVCOL_RANGE_UNSPECIFIED)\nprint_str (\"color_range\", av_color_range_name(par->color_range));", "else\nprint_str_opt(\"color_range\", \"N/A\");", "VAR_6 = av_get_colorspace_name(par->color_space);", "if (VAR_6) print_str (\"color_space\", VAR_6);", "else print_str_opt(\"color_space\", \"unknown\");", "if (par->color_trc != AVCOL_TRC_UNSPECIFIED)\nprint_str(\"color_transfer\", av_color_transfer_name(par->color_trc));", "else\nprint_str_opt(\"color_transfer\", av_color_transfer_name(par->color_trc));", "if (par->color_primaries != AVCOL_PRI_UNSPECIFIED)\nprint_str(\"color_primaries\", av_color_primaries_name(par->color_primaries));", "else\nprint_str_opt(\"color_primaries\", av_color_primaries_name(par->color_primaries));", "if (par->chroma_location != AVCHROMA_LOC_UNSPECIFIED)\nprint_str(\"chroma_location\", av_chroma_location_name(par->chroma_location));", "else\nprint_str_opt(\"chroma_location\", av_chroma_location_name(par->chroma_location));", "#if FF_API_PRIVATE_OPT\nif (dec_ctx && dec_ctx->timecode_frame_start >= 0) {", "char tcbuf[AV_TIMECODE_STR_SIZE];", "av_timecode_make_mpeg_tc_string(tcbuf, dec_ctx->timecode_frame_start);", "print_str(\"timecode\", tcbuf);", "} else {", "print_str_opt(\"timecode\", \"N/A\");", "}", "#endif\nif (dec_ctx)\nprint_int(\"refs\", dec_ctx->refs);", "break;", "case AVMEDIA_TYPE_AUDIO:\nVAR_6 = av_get_sample_fmt_name(par->format);", "if (VAR_6) print_str (\"sample_fmt\", VAR_6);", "else print_str_opt(\"sample_fmt\", \"unknown\");", "print_val(\"sample_rate\", par->sample_rate, unit_hertz_str);", "print_int(\"channels\", par->channels);", "if (par->channel_layout) {", "av_bprint_clear(&pbuf);", "av_bprint_channel_layout(&pbuf, par->channels, par->channel_layout);", "print_str (\"channel_layout\", pbuf.str);", "} else {", "print_str_opt(\"channel_layout\", \"unknown\");", "}", "print_int(\"bits_per_sample\", av_get_bits_per_sample(par->codec_id));", "break;", "case AVMEDIA_TYPE_SUBTITLE:\nif (par->width)\nprint_int(\"width\", par->width);", "else\nprint_str_opt(\"width\", \"N/A\");", "if (par->height)\nprint_int(\"height\", par->height);", "else\nprint_str_opt(\"height\", \"N/A\");", "break;", "}", "if (dec_ctx && dec_ctx->codec && dec_ctx->codec->priv_class && show_private_data) {", "const AVOption *VAR_11 = NULL;", "while (VAR_11 = av_opt_next(dec_ctx->priv_data,VAR_11)) {", "uint8_t *str;", "if (VAR_11->flags) continue;", "if (av_opt_get(dec_ctx->priv_data, VAR_11->name, 0, &str) >= 0) {", "print_str(VAR_11->name, str);", "av_free(str);", "}", "}", "}", "if (VAR_1->iformat->flags & AVFMT_SHOW_IDS) print_fmt (\"id\", \"0x%x\", stream->id);", "else print_str_opt(\"id\", \"N/A\");", "print_q(\"r_frame_rate\", stream->r_frame_rate, '/');", "print_q(\"avg_frame_rate\", stream->avg_frame_rate, '/');", "print_q(\"time_base\", stream->time_base, '/');", "print_ts (\"start_pts\", stream->start_time);", "print_time(\"start_time\", stream->start_time, &stream->time_base);", "print_ts (\"duration_ts\", stream->duration);", "print_time(\"duration\", stream->duration, &stream->time_base);", "if (par->bit_rate > 0) print_val (\"bit_rate\", par->bit_rate, unit_bit_per_second_str);", "else print_str_opt(\"bit_rate\", \"N/A\");", "#if FF_API_LAVF_AVCTX\nif (stream->codec->rc_max_rate > 0) print_val (\"max_bit_rate\", stream->codec->rc_max_rate, unit_bit_per_second_str);", "else print_str_opt(\"max_bit_rate\", \"N/A\");", "#endif\nif (dec_ctx && dec_ctx->bits_per_raw_sample > 0) print_fmt(\"bits_per_raw_sample\", \"%d\", dec_ctx->bits_per_raw_sample);", "else print_str_opt(\"bits_per_raw_sample\", \"N/A\");", "if (stream->nb_frames) print_fmt (\"nb_frames\", \"%\"PRId64, stream->nb_frames);", "else print_str_opt(\"nb_frames\", \"N/A\");", "if (nb_streams_frames[VAR_2]) print_fmt (\"nb_read_frames\", \"%\"PRIu64, nb_streams_frames[VAR_2]);", "else print_str_opt(\"nb_read_frames\", \"N/A\");", "if (nb_streams_packets[VAR_2]) print_fmt (\"nb_read_packets\", \"%\"PRIu64, nb_streams_packets[VAR_2]);", "else print_str_opt(\"nb_read_packets\", \"N/A\");", "if (do_show_data)\nwriter_print_data(VAR_0, \"extradata\", par->extradata,\npar->extradata_size);", "writer_print_data_hash(VAR_0, \"extradata_hash\", par->extradata,\npar->extradata_size);", "#define PRINT_DISPOSITION(flagname, name) do { \\", "print_int(name, !!(stream->disposition & AV_DISPOSITION_##flagname)); \\", "} while (0)", "if (do_show_stream_disposition) {", "writer_print_section_header(VAR_0, VAR_4 ? SECTION_ID_PROGRAM_STREAM_DISPOSITION : SECTION_ID_STREAM_DISPOSITION);", "PRINT_DISPOSITION(DEFAULT, \"default\");", "PRINT_DISPOSITION(DUB, \"dub\");", "PRINT_DISPOSITION(ORIGINAL, \"original\");", "PRINT_DISPOSITION(COMMENT, \"comment\");", "PRINT_DISPOSITION(LYRICS, \"lyrics\");", "PRINT_DISPOSITION(KARAOKE, \"karaoke\");", "PRINT_DISPOSITION(FORCED, \"forced\");", "PRINT_DISPOSITION(HEARING_IMPAIRED, \"hearing_impaired\");", "PRINT_DISPOSITION(VISUAL_IMPAIRED, \"visual_impaired\");", "PRINT_DISPOSITION(CLEAN_EFFECTS, \"clean_effects\");", "PRINT_DISPOSITION(ATTACHED_PIC, \"attached_pic\");", "writer_print_section_footer(VAR_0);", "}", "if (do_show_stream_tags)\nVAR_8 = show_tags(VAR_0, stream->metadata, VAR_4 ? SECTION_ID_PROGRAM_STREAM_TAGS : SECTION_ID_STREAM_TAGS);", "if (stream->nb_side_data) {", "int i;", "writer_print_section_header(VAR_0, SECTION_ID_STREAM_SIDE_DATA_LIST);", "for (i = 0; i < stream->nb_side_data; i++) {", "AVPacketSideData *sd = &stream->side_data[i];", "const char *name = av_packet_side_data_name(sd->type);", "writer_print_section_header(VAR_0, SECTION_ID_STREAM_SIDE_DATA);", "print_str(\"side_data_type\", name ? name : \"unknown\");", "print_int(\"side_data_size\", sd->size);", "if (sd->type == AV_PKT_DATA_DISPLAYMATRIX && sd->size >= 9*4) {", "writer_print_integers(VAR_0, \"displaymatrix\", sd->data, 9, \" %11d\", 3, 4, 1);", "print_int(\"rotation\", av_display_rotation_get((int32_t *)sd->data));", "}", "writer_print_section_footer(VAR_0);", "}", "writer_print_section_footer(VAR_0);", "}", "writer_print_section_footer(VAR_0);", "av_bprint_finalize(&pbuf, NULL);", "fflush(stdout);", "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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 31 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49, 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69, 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 91 ], [ 93 ], [ 95 ], [ 97, 99 ], [ 101, 107 ], [ 109 ], [ 111 ], [ 115 ], [ 117, 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139, 141, 143, 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165, 167 ], [ 169, 171 ], [ 175 ], [ 177 ], [ 179 ], [ 183, 185 ], [ 187, 189 ], [ 193, 195 ], [ 197, 199 ], [ 203, 205 ], [ 207, 209 ], [ 213, 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229, 231, 233 ], [ 235 ], [ 239, 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 269 ], [ 271 ], [ 275, 277, 279 ], [ 281, 283 ], [ 285, 287 ], [ 289, 291 ], [ 293 ], [ 295 ], [ 299 ], [ 301 ], [ 303 ], [ 305 ], [ 307 ], [ 309 ], [ 311 ], [ 313 ], [ 315 ], [ 317 ], [ 319 ], [ 323 ], [ 325 ], [ 327 ], [ 329 ], [ 331 ], [ 333 ], [ 335 ], [ 337 ], [ 339 ], [ 341 ], [ 343 ], [ 345, 347 ], [ 349 ], [ 351, 353 ], [ 355 ], [ 357 ], [ 359 ], [ 361 ], [ 363 ], [ 365 ], [ 367 ], [ 369, 371, 373 ], [ 375, 377 ], [ 383 ], [ 385 ], [ 387 ], [ 391 ], [ 393 ], [ 395 ], [ 397 ], [ 399 ], [ 401 ], [ 403 ], [ 405 ], [ 407 ], [ 409 ], [ 411 ], [ 413 ], [ 415 ], [ 417 ], [ 419 ], [ 423, 425 ], [ 429 ], [ 431 ], [ 433 ], [ 435 ], [ 437 ], [ 439 ], [ 443 ], [ 445 ], [ 447 ], [ 449 ], [ 451 ], [ 453 ], [ 455 ], [ 457 ], [ 459 ], [ 461 ], [ 463 ], [ 467 ], [ 469 ], [ 471 ], [ 475 ], [ 477 ] ]
5,542
static int build_filter(ResampleContext *c, void *filter, double factor, int tap_count, int alloc, int phase_count, int scale, int filter_type, int kaiser_beta){ int ph, i; double x, y, w; double *tab = av_malloc_array(tap_count+1, sizeof(*tab)); const int center= (tap_count-1)/2; if (!tab) return AVERROR(ENOMEM); /* if upsampling, only need to interpolate, no filter */ if (factor > 1.0) factor = 1.0; av_assert0(phase_count == 1 || phase_count % 2 == 0); for(ph = 0; ph <= phase_count / 2; ph++) { double norm = 0; for(i=0;i<=tap_count;i++) { x = M_PI * ((double)(i - center) - (double)ph / phase_count) * factor; if (x == 0) y = 1.0; else y = sin(x) / x; switch(filter_type){ case SWR_FILTER_TYPE_CUBIC:{ const float d= -0.5; //first order derivative = -0.5 x = fabs(((double)(i - center) - (double)ph / phase_count) * factor); if(x<1.0) y= 1 - 3*x*x + 2*x*x*x + d*( -x*x + x*x*x); else y= d*(-4 + 8*x - 5*x*x + x*x*x); break;} case SWR_FILTER_TYPE_BLACKMAN_NUTTALL: w = 2.0*x / (factor*tap_count) + M_PI; y *= 0.3635819 - 0.4891775 * cos(w) + 0.1365995 * cos(2*w) - 0.0106411 * cos(3*w); break; case SWR_FILTER_TYPE_KAISER: w = 2.0*x / (factor*tap_count*M_PI); y *= bessel(kaiser_beta*sqrt(FFMAX(1-w*w, 0))); break; default: av_assert0(0); } tab[i] = y; if (i < tap_count) norm += y; } /* normalize so that an uniform color remains the same */ switch(c->format){ case AV_SAMPLE_FMT_S16P: for(i=0;i<tap_count;i++) ((int16_t*)filter)[ph * alloc + i] = av_clip(lrintf(tab[i] * scale / norm), INT16_MIN, INT16_MAX); if (tap_count % 2 == 0) { for (i = 0; i < tap_count; i++) ((int16_t*)filter)[(phase_count-ph) * alloc + tap_count-1-i] = ((int16_t*)filter)[ph * alloc + i]; } else { for (i = 1; i <= tap_count; i++) ((int16_t*)filter)[(phase_count-ph) * alloc + tap_count-i] = av_clip(lrintf(tab[i] * scale / (norm - tab[0] + tab[tap_count])), INT16_MIN, INT16_MAX); } break; case AV_SAMPLE_FMT_S32P: for(i=0;i<tap_count;i++) ((int32_t*)filter)[ph * alloc + i] = av_clipl_int32(llrint(tab[i] * scale / norm)); if (tap_count % 2 == 0) { for (i = 0; i < tap_count; i++) ((int32_t*)filter)[(phase_count-ph) * alloc + tap_count-1-i] = ((int32_t*)filter)[ph * alloc + i]; } else { for (i = 1; i <= tap_count; i++) ((int32_t*)filter)[(phase_count-ph) * alloc + tap_count-i] = av_clipl_int32(llrint(tab[i] * scale / (norm - tab[0] + tab[tap_count]))); } break; case AV_SAMPLE_FMT_FLTP: for(i=0;i<tap_count;i++) ((float*)filter)[ph * alloc + i] = tab[i] * scale / norm; if (tap_count % 2 == 0) { for (i = 0; i < tap_count; i++) ((float*)filter)[(phase_count-ph) * alloc + tap_count-1-i] = ((float*)filter)[ph * alloc + i]; } else { for (i = 1; i <= tap_count; i++) ((float*)filter)[(phase_count-ph) * alloc + tap_count-i] = tab[i] * scale / (norm - tab[0] + tab[tap_count]); } break; case AV_SAMPLE_FMT_DBLP: for(i=0;i<tap_count;i++) ((double*)filter)[ph * alloc + i] = tab[i] * scale / norm; if (tap_count % 2 == 0) { for (i = 0; i < tap_count; i++) ((double*)filter)[(phase_count-ph) * alloc + tap_count-1-i] = ((double*)filter)[ph * alloc + i]; } else { for (i = 1; i <= tap_count; i++) ((double*)filter)[(phase_count-ph) * alloc + tap_count-i] = tab[i] * scale / (norm - tab[0] + tab[tap_count]); } break; } } #if 0 { #define LEN 1024 int j,k; double sine[LEN + tap_count]; double filtered[LEN]; double maxff=-2, minff=2, maxsf=-2, minsf=2; for(i=0; i<LEN; i++){ double ss=0, sf=0, ff=0; for(j=0; j<LEN+tap_count; j++) sine[j]= cos(i*j*M_PI/LEN); for(j=0; j<LEN; j++){ double sum=0; ph=0; for(k=0; k<tap_count; k++) sum += filter[ph * tap_count + k] * sine[k+j]; filtered[j]= sum / (1<<FILTER_SHIFT); ss+= sine[j + center] * sine[j + center]; ff+= filtered[j] * filtered[j]; sf+= sine[j + center] * filtered[j]; } ss= sqrt(2*ss/LEN); ff= sqrt(2*ff/LEN); sf= 2*sf/LEN; maxff= FFMAX(maxff, ff); minff= FFMIN(minff, ff); maxsf= FFMAX(maxsf, sf); minsf= FFMIN(minsf, sf); if(i%11==0){ av_log(NULL, AV_LOG_ERROR, "i:%4d ss:%f ff:%13.6e-%13.6e sf:%13.6e-%13.6e\n", i, ss, maxff, minff, maxsf, minsf); minff=minsf= 2; maxff=maxsf= -2; } } } #endif av_free(tab); return 0; }
false
FFmpeg
c8780822bacc38a8d84c882d564b07dd152366ed
static int build_filter(ResampleContext *c, void *filter, double factor, int tap_count, int alloc, int phase_count, int scale, int filter_type, int kaiser_beta){ int ph, i; double x, y, w; double *tab = av_malloc_array(tap_count+1, sizeof(*tab)); const int center= (tap_count-1)/2; if (!tab) return AVERROR(ENOMEM); if (factor > 1.0) factor = 1.0; av_assert0(phase_count == 1 || phase_count % 2 == 0); for(ph = 0; ph <= phase_count / 2; ph++) { double norm = 0; for(i=0;i<=tap_count;i++) { x = M_PI * ((double)(i - center) - (double)ph / phase_count) * factor; if (x == 0) y = 1.0; else y = sin(x) / x; switch(filter_type){ case SWR_FILTER_TYPE_CUBIC:{ const float d= -0.5; x = fabs(((double)(i - center) - (double)ph / phase_count) * factor); if(x<1.0) y= 1 - 3*x*x + 2*x*x*x + d*( -x*x + x*x*x); else y= d*(-4 + 8*x - 5*x*x + x*x*x); break;} case SWR_FILTER_TYPE_BLACKMAN_NUTTALL: w = 2.0*x / (factor*tap_count) + M_PI; y *= 0.3635819 - 0.4891775 * cos(w) + 0.1365995 * cos(2*w) - 0.0106411 * cos(3*w); break; case SWR_FILTER_TYPE_KAISER: w = 2.0*x / (factor*tap_count*M_PI); y *= bessel(kaiser_beta*sqrt(FFMAX(1-w*w, 0))); break; default: av_assert0(0); } tab[i] = y; if (i < tap_count) norm += y; } switch(c->format){ case AV_SAMPLE_FMT_S16P: for(i=0;i<tap_count;i++) ((int16_t*)filter)[ph * alloc + i] = av_clip(lrintf(tab[i] * scale / norm), INT16_MIN, INT16_MAX); if (tap_count % 2 == 0) { for (i = 0; i < tap_count; i++) ((int16_t*)filter)[(phase_count-ph) * alloc + tap_count-1-i] = ((int16_t*)filter)[ph * alloc + i]; } else { for (i = 1; i <= tap_count; i++) ((int16_t*)filter)[(phase_count-ph) * alloc + tap_count-i] = av_clip(lrintf(tab[i] * scale / (norm - tab[0] + tab[tap_count])), INT16_MIN, INT16_MAX); } break; case AV_SAMPLE_FMT_S32P: for(i=0;i<tap_count;i++) ((int32_t*)filter)[ph * alloc + i] = av_clipl_int32(llrint(tab[i] * scale / norm)); if (tap_count % 2 == 0) { for (i = 0; i < tap_count; i++) ((int32_t*)filter)[(phase_count-ph) * alloc + tap_count-1-i] = ((int32_t*)filter)[ph * alloc + i]; } else { for (i = 1; i <= tap_count; i++) ((int32_t*)filter)[(phase_count-ph) * alloc + tap_count-i] = av_clipl_int32(llrint(tab[i] * scale / (norm - tab[0] + tab[tap_count]))); } break; case AV_SAMPLE_FMT_FLTP: for(i=0;i<tap_count;i++) ((float*)filter)[ph * alloc + i] = tab[i] * scale / norm; if (tap_count % 2 == 0) { for (i = 0; i < tap_count; i++) ((float*)filter)[(phase_count-ph) * alloc + tap_count-1-i] = ((float*)filter)[ph * alloc + i]; } else { for (i = 1; i <= tap_count; i++) ((float*)filter)[(phase_count-ph) * alloc + tap_count-i] = tab[i] * scale / (norm - tab[0] + tab[tap_count]); } break; case AV_SAMPLE_FMT_DBLP: for(i=0;i<tap_count;i++) ((double*)filter)[ph * alloc + i] = tab[i] * scale / norm; if (tap_count % 2 == 0) { for (i = 0; i < tap_count; i++) ((double*)filter)[(phase_count-ph) * alloc + tap_count-1-i] = ((double*)filter)[ph * alloc + i]; } else { for (i = 1; i <= tap_count; i++) ((double*)filter)[(phase_count-ph) * alloc + tap_count-i] = tab[i] * scale / (norm - tab[0] + tab[tap_count]); } break; } } #if 0 { #define LEN 1024 int j,k; double sine[LEN + tap_count]; double filtered[LEN]; double maxff=-2, minff=2, maxsf=-2, minsf=2; for(i=0; i<LEN; i++){ double ss=0, sf=0, ff=0; for(j=0; j<LEN+tap_count; j++) sine[j]= cos(i*j*M_PI/LEN); for(j=0; j<LEN; j++){ double sum=0; ph=0; for(k=0; k<tap_count; k++) sum += filter[ph * tap_count + k] * sine[k+j]; filtered[j]= sum / (1<<FILTER_SHIFT); ss+= sine[j + center] * sine[j + center]; ff+= filtered[j] * filtered[j]; sf+= sine[j + center] * filtered[j]; } ss= sqrt(2*ss/LEN); ff= sqrt(2*ff/LEN); sf= 2*sf/LEN; maxff= FFMAX(maxff, ff); minff= FFMIN(minff, ff); maxsf= FFMAX(maxsf, sf); minsf= FFMIN(minsf, sf); if(i%11==0){ av_log(NULL, AV_LOG_ERROR, "i:%4d ss:%f ff:%13.6e-%13.6e sf:%13.6e-%13.6e\n", i, ss, maxff, minff, maxsf, minsf); minff=minsf= 2; maxff=maxsf= -2; } } } #endif av_free(tab); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(ResampleContext *VAR_0, void *VAR_1, double VAR_2, int VAR_3, int VAR_4, int VAR_5, int VAR_6, int VAR_7, int VAR_8){ int VAR_9, VAR_10; double VAR_11, VAR_12, VAR_13; double *VAR_14 = av_malloc_array(VAR_3+1, sizeof(*VAR_14)); const int VAR_15= (VAR_3-1)/2; if (!VAR_14) return AVERROR(ENOMEM); if (VAR_2 > 1.0) VAR_2 = 1.0; av_assert0(VAR_5 == 1 || VAR_5 % 2 == 0); for(VAR_9 = 0; VAR_9 <= VAR_5 / 2; VAR_9++) { double VAR_16 = 0; for(VAR_10=0;VAR_10<=VAR_3;VAR_10++) { VAR_11 = M_PI * ((double)(VAR_10 - VAR_15) - (double)VAR_9 / VAR_5) * VAR_2; if (VAR_11 == 0) VAR_12 = 1.0; else VAR_12 = sin(VAR_11) / VAR_11; switch(VAR_7){ case SWR_FILTER_TYPE_CUBIC:{ const float VAR_17= -0.5; VAR_11 = fabs(((double)(VAR_10 - VAR_15) - (double)VAR_9 / VAR_5) * VAR_2); if(VAR_11<1.0) VAR_12= 1 - 3*VAR_11*VAR_11 + 2*VAR_11*VAR_11*VAR_11 + VAR_17*( -VAR_11*VAR_11 + VAR_11*VAR_11*VAR_11); else VAR_12= VAR_17*(-4 + 8*VAR_11 - 5*VAR_11*VAR_11 + VAR_11*VAR_11*VAR_11); break;} case SWR_FILTER_TYPE_BLACKMAN_NUTTALL: VAR_13 = 2.0*VAR_11 / (VAR_2*VAR_3) + M_PI; VAR_12 *= 0.3635819 - 0.4891775 * cos(VAR_13) + 0.1365995 * cos(2*VAR_13) - 0.0106411 * cos(3*VAR_13); break; case SWR_FILTER_TYPE_KAISER: VAR_13 = 2.0*VAR_11 / (VAR_2*VAR_3*M_PI); VAR_12 *= bessel(VAR_8*sqrt(FFMAX(1-VAR_13*VAR_13, 0))); break; default: av_assert0(0); } VAR_14[VAR_10] = VAR_12; if (VAR_10 < VAR_3) VAR_16 += VAR_12; } switch(VAR_0->format){ case AV_SAMPLE_FMT_S16P: for(VAR_10=0;VAR_10<VAR_3;VAR_10++) ((int16_t*)VAR_1)[VAR_9 * VAR_4 + VAR_10] = av_clip(lrintf(VAR_14[VAR_10] * VAR_6 / VAR_16), INT16_MIN, INT16_MAX); if (VAR_3 % 2 == 0) { for (VAR_10 = 0; VAR_10 < VAR_3; VAR_10++) ((int16_t*)VAR_1)[(VAR_5-VAR_9) * VAR_4 + VAR_3-1-VAR_10] = ((int16_t*)VAR_1)[VAR_9 * VAR_4 + VAR_10]; } else { for (VAR_10 = 1; VAR_10 <= VAR_3; VAR_10++) ((int16_t*)VAR_1)[(VAR_5-VAR_9) * VAR_4 + VAR_3-VAR_10] = av_clip(lrintf(VAR_14[VAR_10] * VAR_6 / (VAR_16 - VAR_14[0] + VAR_14[VAR_3])), INT16_MIN, INT16_MAX); } break; case AV_SAMPLE_FMT_S32P: for(VAR_10=0;VAR_10<VAR_3;VAR_10++) ((int32_t*)VAR_1)[VAR_9 * VAR_4 + VAR_10] = av_clipl_int32(llrint(VAR_14[VAR_10] * VAR_6 / VAR_16)); if (VAR_3 % 2 == 0) { for (VAR_10 = 0; VAR_10 < VAR_3; VAR_10++) ((int32_t*)VAR_1)[(VAR_5-VAR_9) * VAR_4 + VAR_3-1-VAR_10] = ((int32_t*)VAR_1)[VAR_9 * VAR_4 + VAR_10]; } else { for (VAR_10 = 1; VAR_10 <= VAR_3; VAR_10++) ((int32_t*)VAR_1)[(VAR_5-VAR_9) * VAR_4 + VAR_3-VAR_10] = av_clipl_int32(llrint(VAR_14[VAR_10] * VAR_6 / (VAR_16 - VAR_14[0] + VAR_14[VAR_3]))); } break; case AV_SAMPLE_FMT_FLTP: for(VAR_10=0;VAR_10<VAR_3;VAR_10++) ((float*)VAR_1)[VAR_9 * VAR_4 + VAR_10] = VAR_14[VAR_10] * VAR_6 / VAR_16; if (VAR_3 % 2 == 0) { for (VAR_10 = 0; VAR_10 < VAR_3; VAR_10++) ((float*)VAR_1)[(VAR_5-VAR_9) * VAR_4 + VAR_3-1-VAR_10] = ((float*)VAR_1)[VAR_9 * VAR_4 + VAR_10]; } else { for (VAR_10 = 1; VAR_10 <= VAR_3; VAR_10++) ((float*)VAR_1)[(VAR_5-VAR_9) * VAR_4 + VAR_3-VAR_10] = VAR_14[VAR_10] * VAR_6 / (VAR_16 - VAR_14[0] + VAR_14[VAR_3]); } break; case AV_SAMPLE_FMT_DBLP: for(VAR_10=0;VAR_10<VAR_3;VAR_10++) ((double*)VAR_1)[VAR_9 * VAR_4 + VAR_10] = VAR_14[VAR_10] * VAR_6 / VAR_16; if (VAR_3 % 2 == 0) { for (VAR_10 = 0; VAR_10 < VAR_3; VAR_10++) ((double*)VAR_1)[(VAR_5-VAR_9) * VAR_4 + VAR_3-1-VAR_10] = ((double*)VAR_1)[VAR_9 * VAR_4 + VAR_10]; } else { for (VAR_10 = 1; VAR_10 <= VAR_3; VAR_10++) ((double*)VAR_1)[(VAR_5-VAR_9) * VAR_4 + VAR_3-VAR_10] = VAR_14[VAR_10] * VAR_6 / (VAR_16 - VAR_14[0] + VAR_14[VAR_3]); } break; } } #if 0 { #define LEN 1024 int j,k; double sine[LEN + VAR_3]; double filtered[LEN]; double maxff=-2, minff=2, maxsf=-2, minsf=2; for(VAR_10=0; VAR_10<LEN; VAR_10++){ double ss=0, sf=0, ff=0; for(j=0; j<LEN+VAR_3; j++) sine[j]= cos(VAR_10*j*M_PI/LEN); for(j=0; j<LEN; j++){ double sum=0; VAR_9=0; for(k=0; k<VAR_3; k++) sum += VAR_1[VAR_9 * VAR_3 + k] * sine[k+j]; filtered[j]= sum / (1<<FILTER_SHIFT); ss+= sine[j + VAR_15] * sine[j + VAR_15]; ff+= filtered[j] * filtered[j]; sf+= sine[j + VAR_15] * filtered[j]; } ss= sqrt(2*ss/LEN); ff= sqrt(2*ff/LEN); sf= 2*sf/LEN; maxff= FFMAX(maxff, ff); minff= FFMIN(minff, ff); maxsf= FFMAX(maxsf, sf); minsf= FFMIN(minsf, sf); if(VAR_10%11==0){ av_log(NULL, AV_LOG_ERROR, "VAR_10:%4d ss:%f ff:%13.6e-%13.6e sf:%13.6e-%13.6e\n", VAR_10, ss, maxff, minff, maxsf, minsf); minff=minsf= 2; maxff=maxsf= -2; } } } #endif av_free(VAR_14); return 0; }
[ "static int FUNC_0(ResampleContext *VAR_0, void *VAR_1, double VAR_2, int VAR_3, int VAR_4, int VAR_5, int VAR_6,\nint VAR_7, int VAR_8){", "int VAR_9, VAR_10;", "double VAR_11, VAR_12, VAR_13;", "double *VAR_14 = av_malloc_array(VAR_3+1, sizeof(*VAR_14));", "const int VAR_15= (VAR_3-1)/2;", "if (!VAR_14)\nreturn AVERROR(ENOMEM);", "if (VAR_2 > 1.0)\nVAR_2 = 1.0;", "av_assert0(VAR_5 == 1 || VAR_5 % 2 == 0);", "for(VAR_9 = 0; VAR_9 <= VAR_5 / 2; VAR_9++) {", "double VAR_16 = 0;", "for(VAR_10=0;VAR_10<=VAR_3;VAR_10++) {", "VAR_11 = M_PI * ((double)(VAR_10 - VAR_15) - (double)VAR_9 / VAR_5) * VAR_2;", "if (VAR_11 == 0) VAR_12 = 1.0;", "else VAR_12 = sin(VAR_11) / VAR_11;", "switch(VAR_7){", "case SWR_FILTER_TYPE_CUBIC:{", "const float VAR_17= -0.5;", "VAR_11 = fabs(((double)(VAR_10 - VAR_15) - (double)VAR_9 / VAR_5) * VAR_2);", "if(VAR_11<1.0) VAR_12= 1 - 3*VAR_11*VAR_11 + 2*VAR_11*VAR_11*VAR_11 + VAR_17*( -VAR_11*VAR_11 + VAR_11*VAR_11*VAR_11);", "else VAR_12= VAR_17*(-4 + 8*VAR_11 - 5*VAR_11*VAR_11 + VAR_11*VAR_11*VAR_11);", "break;}", "case SWR_FILTER_TYPE_BLACKMAN_NUTTALL:\nVAR_13 = 2.0*VAR_11 / (VAR_2*VAR_3) + M_PI;", "VAR_12 *= 0.3635819 - 0.4891775 * cos(VAR_13) + 0.1365995 * cos(2*VAR_13) - 0.0106411 * cos(3*VAR_13);", "break;", "case SWR_FILTER_TYPE_KAISER:\nVAR_13 = 2.0*VAR_11 / (VAR_2*VAR_3*M_PI);", "VAR_12 *= bessel(VAR_8*sqrt(FFMAX(1-VAR_13*VAR_13, 0)));", "break;", "default:\nav_assert0(0);", "}", "VAR_14[VAR_10] = VAR_12;", "if (VAR_10 < VAR_3)\nVAR_16 += VAR_12;", "}", "switch(VAR_0->format){", "case AV_SAMPLE_FMT_S16P:\nfor(VAR_10=0;VAR_10<VAR_3;VAR_10++)", "((int16_t*)VAR_1)[VAR_9 * VAR_4 + VAR_10] = av_clip(lrintf(VAR_14[VAR_10] * VAR_6 / VAR_16), INT16_MIN, INT16_MAX);", "if (VAR_3 % 2 == 0) {", "for (VAR_10 = 0; VAR_10 < VAR_3; VAR_10++)", "((int16_t*)VAR_1)[(VAR_5-VAR_9) * VAR_4 + VAR_3-1-VAR_10] = ((int16_t*)VAR_1)[VAR_9 * VAR_4 + VAR_10];", "}", "else {", "for (VAR_10 = 1; VAR_10 <= VAR_3; VAR_10++)", "((int16_t*)VAR_1)[(VAR_5-VAR_9) * VAR_4 + VAR_3-VAR_10] =\nav_clip(lrintf(VAR_14[VAR_10] * VAR_6 / (VAR_16 - VAR_14[0] + VAR_14[VAR_3])), INT16_MIN, INT16_MAX);", "}", "break;", "case AV_SAMPLE_FMT_S32P:\nfor(VAR_10=0;VAR_10<VAR_3;VAR_10++)", "((int32_t*)VAR_1)[VAR_9 * VAR_4 + VAR_10] = av_clipl_int32(llrint(VAR_14[VAR_10] * VAR_6 / VAR_16));", "if (VAR_3 % 2 == 0) {", "for (VAR_10 = 0; VAR_10 < VAR_3; VAR_10++)", "((int32_t*)VAR_1)[(VAR_5-VAR_9) * VAR_4 + VAR_3-1-VAR_10] = ((int32_t*)VAR_1)[VAR_9 * VAR_4 + VAR_10];", "}", "else {", "for (VAR_10 = 1; VAR_10 <= VAR_3; VAR_10++)", "((int32_t*)VAR_1)[(VAR_5-VAR_9) * VAR_4 + VAR_3-VAR_10] =\nav_clipl_int32(llrint(VAR_14[VAR_10] * VAR_6 / (VAR_16 - VAR_14[0] + VAR_14[VAR_3])));", "}", "break;", "case AV_SAMPLE_FMT_FLTP:\nfor(VAR_10=0;VAR_10<VAR_3;VAR_10++)", "((float*)VAR_1)[VAR_9 * VAR_4 + VAR_10] = VAR_14[VAR_10] * VAR_6 / VAR_16;", "if (VAR_3 % 2 == 0) {", "for (VAR_10 = 0; VAR_10 < VAR_3; VAR_10++)", "((float*)VAR_1)[(VAR_5-VAR_9) * VAR_4 + VAR_3-1-VAR_10] = ((float*)VAR_1)[VAR_9 * VAR_4 + VAR_10];", "}", "else {", "for (VAR_10 = 1; VAR_10 <= VAR_3; VAR_10++)", "((float*)VAR_1)[(VAR_5-VAR_9) * VAR_4 + VAR_3-VAR_10] = VAR_14[VAR_10] * VAR_6 / (VAR_16 - VAR_14[0] + VAR_14[VAR_3]);", "}", "break;", "case AV_SAMPLE_FMT_DBLP:\nfor(VAR_10=0;VAR_10<VAR_3;VAR_10++)", "((double*)VAR_1)[VAR_9 * VAR_4 + VAR_10] = VAR_14[VAR_10] * VAR_6 / VAR_16;", "if (VAR_3 % 2 == 0) {", "for (VAR_10 = 0; VAR_10 < VAR_3; VAR_10++)", "((double*)VAR_1)[(VAR_5-VAR_9) * VAR_4 + VAR_3-1-VAR_10] = ((double*)VAR_1)[VAR_9 * VAR_4 + VAR_10];", "}", "else {", "for (VAR_10 = 1; VAR_10 <= VAR_3; VAR_10++)", "((double*)VAR_1)[(VAR_5-VAR_9) * VAR_4 + VAR_3-VAR_10] = VAR_14[VAR_10] * VAR_6 / (VAR_16 - VAR_14[0] + VAR_14[VAR_3]);", "}", "break;", "}", "}", "#if 0\n{", "#define LEN 1024\nint j,k;", "double sine[LEN + VAR_3];", "double filtered[LEN];", "double maxff=-2, minff=2, maxsf=-2, minsf=2;", "for(VAR_10=0; VAR_10<LEN; VAR_10++){", "double ss=0, sf=0, ff=0;", "for(j=0; j<LEN+VAR_3; j++)", "sine[j]= cos(VAR_10*j*M_PI/LEN);", "for(j=0; j<LEN; j++){", "double sum=0;", "VAR_9=0;", "for(k=0; k<VAR_3; k++)", "sum += VAR_1[VAR_9 * VAR_3 + k] * sine[k+j];", "filtered[j]= sum / (1<<FILTER_SHIFT);", "ss+= sine[j + VAR_15] * sine[j + VAR_15];", "ff+= filtered[j] * filtered[j];", "sf+= sine[j + VAR_15] * filtered[j];", "}", "ss= sqrt(2*ss/LEN);", "ff= sqrt(2*ff/LEN);", "sf= 2*sf/LEN;", "maxff= FFMAX(maxff, ff);", "minff= FFMIN(minff, ff);", "maxsf= FFMAX(maxsf, sf);", "minsf= FFMIN(minsf, sf);", "if(VAR_10%11==0){", "av_log(NULL, AV_LOG_ERROR, \"VAR_10:%4d ss:%f ff:%13.6e-%13.6e sf:%13.6e-%13.6e\\n\", VAR_10, ss, maxff, minff, maxsf, minsf);", "minff=minsf= 2;", "maxff=maxsf= -2;", "}", "}", "}", "#endif\nav_free(VAR_14);", "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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15, 17 ], [ 23, 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57, 59 ], [ 61 ], [ 63 ], [ 65, 67 ], [ 69 ], [ 71 ], [ 73, 75 ], [ 77 ], [ 81 ], [ 83, 85 ], [ 87 ], [ 93 ], [ 95, 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113, 115 ], [ 117 ], [ 119 ], [ 121, 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139, 141 ], [ 143 ], [ 145 ], [ 147, 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171, 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199, 201 ], [ 203, 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269, 273 ], [ 275 ], [ 277 ] ]
5,543
e1000e_write_ps_rx_descr(E1000ECore *core, uint8_t *desc, struct NetRxPkt *pkt, const E1000E_RSSInfo *rss_info, size_t ps_hdr_len, uint16_t(*written)[MAX_PS_BUFFERS]) { int i; union e1000_rx_desc_packet_split *d = (union e1000_rx_desc_packet_split *) desc; memset(d, 0, sizeof(*d)); d->wb.middle.length0 = cpu_to_le16((*written)[0]); for (i = 0; i < PS_PAGE_BUFFERS; i++) { d->wb.upper.length[i] = cpu_to_le16((*written)[i + 1]); } e1000e_build_rx_metadata(core, pkt, pkt != NULL, rss_info, &d->wb.lower.hi_dword.rss, &d->wb.lower.mrq, &d->wb.middle.status_error, &d->wb.lower.hi_dword.csum_ip.ip_id, &d->wb.middle.vlan); d->wb.upper.header_status = cpu_to_le16(ps_hdr_len | (ps_hdr_len ? E1000_RXDPS_HDRSTAT_HDRSP : 0)); trace_e1000e_rx_desc_ps_write((*written)[0], (*written)[1], (*written)[2], (*written)[3]); }
true
qemu
c89d416a2b0fb6a21224186b10af4c4a3feee31b
e1000e_write_ps_rx_descr(E1000ECore *core, uint8_t *desc, struct NetRxPkt *pkt, const E1000E_RSSInfo *rss_info, size_t ps_hdr_len, uint16_t(*written)[MAX_PS_BUFFERS]) { int i; union e1000_rx_desc_packet_split *d = (union e1000_rx_desc_packet_split *) desc; memset(d, 0, sizeof(*d)); d->wb.middle.length0 = cpu_to_le16((*written)[0]); for (i = 0; i < PS_PAGE_BUFFERS; i++) { d->wb.upper.length[i] = cpu_to_le16((*written)[i + 1]); } e1000e_build_rx_metadata(core, pkt, pkt != NULL, rss_info, &d->wb.lower.hi_dword.rss, &d->wb.lower.mrq, &d->wb.middle.status_error, &d->wb.lower.hi_dword.csum_ip.ip_id, &d->wb.middle.vlan); d->wb.upper.header_status = cpu_to_le16(ps_hdr_len | (ps_hdr_len ? E1000_RXDPS_HDRSTAT_HDRSP : 0)); trace_e1000e_rx_desc_ps_write((*written)[0], (*written)[1], (*written)[2], (*written)[3]); }
{ "code": [ " memset(d, 0, sizeof(*d));", " memset(d, 0, sizeof(*d));", " memset(d, 0, sizeof(*d));" ], "line_no": [ 21, 21, 21 ] }
FUNC_0(E1000ECore *VAR_0, uint8_t *VAR_1, struct NetRxPkt *VAR_2, const E1000E_RSSInfo *VAR_3, size_t VAR_4, VAR_5(*written)[MAX_PS_BUFFERS]) { int VAR_6; union e1000_rx_desc_packet_split *VAR_7 = (union e1000_rx_desc_packet_split *) VAR_1; memset(VAR_7, 0, sizeof(*VAR_7)); VAR_7->wb.middle.length0 = cpu_to_le16((*written)[0]); for (VAR_6 = 0; VAR_6 < PS_PAGE_BUFFERS; VAR_6++) { VAR_7->wb.upper.length[VAR_6] = cpu_to_le16((*written)[VAR_6 + 1]); } e1000e_build_rx_metadata(VAR_0, VAR_2, VAR_2 != NULL, VAR_3, &VAR_7->wb.lower.hi_dword.rss, &VAR_7->wb.lower.mrq, &VAR_7->wb.middle.status_error, &VAR_7->wb.lower.hi_dword.csum_ip.ip_id, &VAR_7->wb.middle.vlan); VAR_7->wb.upper.header_status = cpu_to_le16(VAR_4 | (VAR_4 ? E1000_RXDPS_HDRSTAT_HDRSP : 0)); trace_e1000e_rx_desc_ps_write((*written)[0], (*written)[1], (*written)[2], (*written)[3]); }
[ "FUNC_0(E1000ECore *VAR_0, uint8_t *VAR_1,\nstruct NetRxPkt *VAR_2,\nconst E1000E_RSSInfo *VAR_3,\nsize_t VAR_4,\nVAR_5(*written)[MAX_PS_BUFFERS])\n{", "int VAR_6;", "union e1000_rx_desc_packet_split *VAR_7 =\n(union e1000_rx_desc_packet_split *) VAR_1;", "memset(VAR_7, 0, sizeof(*VAR_7));", "VAR_7->wb.middle.length0 = cpu_to_le16((*written)[0]);", "for (VAR_6 = 0; VAR_6 < PS_PAGE_BUFFERS; VAR_6++) {", "VAR_7->wb.upper.length[VAR_6] = cpu_to_le16((*written)[VAR_6 + 1]);", "}", "e1000e_build_rx_metadata(VAR_0, VAR_2, VAR_2 != NULL,\nVAR_3,\n&VAR_7->wb.lower.hi_dword.rss,\n&VAR_7->wb.lower.mrq,\n&VAR_7->wb.middle.status_error,\n&VAR_7->wb.lower.hi_dword.csum_ip.ip_id,\n&VAR_7->wb.middle.vlan);", "VAR_7->wb.upper.header_status =\ncpu_to_le16(VAR_4 | (VAR_4 ? E1000_RXDPS_HDRSTAT_HDRSP : 0));", "trace_e1000e_rx_desc_ps_write((*written)[0], (*written)[1],\n(*written)[2], (*written)[3]);", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11 ], [ 13 ], [ 15, 17 ], [ 21 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 37, 39, 41, 43, 45, 47, 49 ], [ 53, 55 ], [ 59, 61 ], [ 63 ] ]
5,544
static void print_track_chunks(FILE *out, struct Tracks *tracks, int main, const char *type) { int i, j; struct Track *track = tracks->tracks[main]; for (i = 0; i < track->chunks; i++) { for (j = main + 1; j < tracks->nb_tracks; j++) { if (tracks->tracks[j]->is_audio == track->is_audio && track->offsets[i].duration != tracks->tracks[j]->offsets[i].duration) fprintf(stderr, "Mismatched duration of %s chunk %d in %s and %s\n", type, i, track->name, tracks->tracks[j]->name); } fprintf(out, "\t\t<c n=\"%d\" d=\"%d\" />\n", i, track->offsets[i].duration); } }
true
FFmpeg
a4435f9235eefac8a25f1cda471486e2c37b21b5
static void print_track_chunks(FILE *out, struct Tracks *tracks, int main, const char *type) { int i, j; struct Track *track = tracks->tracks[main]; for (i = 0; i < track->chunks; i++) { for (j = main + 1; j < tracks->nb_tracks; j++) { if (tracks->tracks[j]->is_audio == track->is_audio && track->offsets[i].duration != tracks->tracks[j]->offsets[i].duration) fprintf(stderr, "Mismatched duration of %s chunk %d in %s and %s\n", type, i, track->name, tracks->tracks[j]->name); } fprintf(out, "\t\t<c n=\"%d\" d=\"%d\" />\n", i, track->offsets[i].duration); } }
{ "code": [ " fprintf(out, \"\\t\\t<c n=\\\"%d\\\" d=\\\"%d\\\" />\\n\"," ], "line_no": [ 25 ] }
static void FUNC_0(FILE *VAR_0, struct Tracks *VAR_1, int VAR_2, const char *VAR_3) { int VAR_4, VAR_5; struct Track *VAR_6 = VAR_1->VAR_1[VAR_2]; for (VAR_4 = 0; VAR_4 < VAR_6->chunks; VAR_4++) { for (VAR_5 = VAR_2 + 1; VAR_5 < VAR_1->nb_tracks; VAR_5++) { if (VAR_1->VAR_1[VAR_5]->is_audio == VAR_6->is_audio && VAR_6->offsets[VAR_4].duration != VAR_1->VAR_1[VAR_5]->offsets[VAR_4].duration) fprintf(stderr, "Mismatched duration of %s chunk %d in %s and %s\n", VAR_3, VAR_4, VAR_6->name, VAR_1->VAR_1[VAR_5]->name); } fprintf(VAR_0, "\t\t<c n=\"%d\" d=\"%d\" />\n", VAR_4, VAR_6->offsets[VAR_4].duration); } }
[ "static void FUNC_0(FILE *VAR_0, struct Tracks *VAR_1, int VAR_2,\nconst char *VAR_3)\n{", "int VAR_4, VAR_5;", "struct Track *VAR_6 = VAR_1->VAR_1[VAR_2];", "for (VAR_4 = 0; VAR_4 < VAR_6->chunks; VAR_4++) {", "for (VAR_5 = VAR_2 + 1; VAR_5 < VAR_1->nb_tracks; VAR_5++) {", "if (VAR_1->VAR_1[VAR_5]->is_audio == VAR_6->is_audio &&\nVAR_6->offsets[VAR_4].duration != VAR_1->VAR_1[VAR_5]->offsets[VAR_4].duration)\nfprintf(stderr, \"Mismatched duration of %s chunk %d in %s and %s\\n\",\nVAR_3, VAR_4, VAR_6->name, VAR_1->VAR_1[VAR_5]->name);", "}", "fprintf(VAR_0, \"\\t\\t<c n=\\\"%d\\\" d=\\\"%d\\\" />\\n\",\nVAR_4, VAR_6->offsets[VAR_4].duration);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15, 17, 19, 21 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31 ] ]
5,545
void vncws_handshake_read(void *opaque) { VncState *vs = opaque; uint8_t *handshake_end; long ret; buffer_reserve(&vs->ws_input, 4096); ret = vnc_client_read_buf(vs, buffer_end(&vs->ws_input), 4096); if (!ret) { if (vs->csock == -1) { vnc_disconnect_finish(vs); } return; } vs->ws_input.offset += ret; handshake_end = (uint8_t *)g_strstr_len((char *)vs->ws_input.buffer, vs->ws_input.offset, WS_HANDSHAKE_END); if (handshake_end) { qemu_set_fd_handler2(vs->csock, NULL, vnc_client_read, NULL, vs); vncws_process_handshake(vs, vs->ws_input.buffer, vs->ws_input.offset); buffer_advance(&vs->ws_input, handshake_end - vs->ws_input.buffer + strlen(WS_HANDSHAKE_END)); } }
true
qemu
2cdb5e142fb93e875fa53c52864ef5eb8d5d8b41
void vncws_handshake_read(void *opaque) { VncState *vs = opaque; uint8_t *handshake_end; long ret; buffer_reserve(&vs->ws_input, 4096); ret = vnc_client_read_buf(vs, buffer_end(&vs->ws_input), 4096); if (!ret) { if (vs->csock == -1) { vnc_disconnect_finish(vs); } return; } vs->ws_input.offset += ret; handshake_end = (uint8_t *)g_strstr_len((char *)vs->ws_input.buffer, vs->ws_input.offset, WS_HANDSHAKE_END); if (handshake_end) { qemu_set_fd_handler2(vs->csock, NULL, vnc_client_read, NULL, vs); vncws_process_handshake(vs, vs->ws_input.buffer, vs->ws_input.offset); buffer_advance(&vs->ws_input, handshake_end - vs->ws_input.buffer + strlen(WS_HANDSHAKE_END)); } }
{ "code": [ " buffer_reserve(&vs->ws_input, 4096);", " ret = vnc_client_read_buf(vs, buffer_end(&vs->ws_input), 4096);" ], "line_no": [ 11, 13 ] }
void FUNC_0(void *VAR_0) { VncState *vs = VAR_0; uint8_t *handshake_end; long VAR_1; buffer_reserve(&vs->ws_input, 4096); VAR_1 = vnc_client_read_buf(vs, buffer_end(&vs->ws_input), 4096); if (!VAR_1) { if (vs->csock == -1) { vnc_disconnect_finish(vs); } return; } vs->ws_input.offset += VAR_1; handshake_end = (uint8_t *)g_strstr_len((char *)vs->ws_input.buffer, vs->ws_input.offset, WS_HANDSHAKE_END); if (handshake_end) { qemu_set_fd_handler2(vs->csock, NULL, vnc_client_read, NULL, vs); vncws_process_handshake(vs, vs->ws_input.buffer, vs->ws_input.offset); buffer_advance(&vs->ws_input, handshake_end - vs->ws_input.buffer + strlen(WS_HANDSHAKE_END)); } }
[ "void FUNC_0(void *VAR_0)\n{", "VncState *vs = VAR_0;", "uint8_t *handshake_end;", "long VAR_1;", "buffer_reserve(&vs->ws_input, 4096);", "VAR_1 = vnc_client_read_buf(vs, buffer_end(&vs->ws_input), 4096);", "if (!VAR_1) {", "if (vs->csock == -1) {", "vnc_disconnect_finish(vs);", "}", "return;", "}", "vs->ws_input.offset += VAR_1;", "handshake_end = (uint8_t *)g_strstr_len((char *)vs->ws_input.buffer,\nvs->ws_input.offset, WS_HANDSHAKE_END);", "if (handshake_end) {", "qemu_set_fd_handler2(vs->csock, NULL, vnc_client_read, NULL, vs);", "vncws_process_handshake(vs, vs->ws_input.buffer, vs->ws_input.offset);", "buffer_advance(&vs->ws_input, handshake_end - vs->ws_input.buffer +\nstrlen(WS_HANDSHAKE_END));", "}", "}" ]
[ 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 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33, 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49 ] ]
5,546
void helper_rfmci(CPUPPCState *env) { do_rfi(env, env->spr[SPR_BOOKE_MCSRR0], SPR_BOOKE_MCSRR1, ~((target_ulong)0x3FFF0000), 0); }
true
qemu
a1bb73849fbd7d992b6ac2cf30c034244fb2299d
void helper_rfmci(CPUPPCState *env) { do_rfi(env, env->spr[SPR_BOOKE_MCSRR0], SPR_BOOKE_MCSRR1, ~((target_ulong)0x3FFF0000), 0); }
{ "code": [ " ~((target_ulong)0x3FFF0000), 0);", " ~((target_ulong)0x3FFF0000), 0);", " do_rfi(env, env->spr[SPR_BOOKE_MCSRR0], SPR_BOOKE_MCSRR1,", " ~((target_ulong)0x3FFF0000), 0);" ], "line_no": [ 7, 7, 5, 7 ] }
void FUNC_0(CPUPPCState *VAR_0) { do_rfi(VAR_0, VAR_0->spr[SPR_BOOKE_MCSRR0], SPR_BOOKE_MCSRR1, ~((target_ulong)0x3FFF0000), 0); }
[ "void FUNC_0(CPUPPCState *VAR_0)\n{", "do_rfi(VAR_0, VAR_0->spr[SPR_BOOKE_MCSRR0], SPR_BOOKE_MCSRR1,\n~((target_ulong)0x3FFF0000), 0);", "}" ]
[ 0, 1, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9 ] ]
5,547
static int get_phys_addr_lpae(CPUARMState *env, target_ulong address, int access_type, int is_user, hwaddr *phys_ptr, int *prot, target_ulong *page_size_ptr) { CPUState *cs = CPU(arm_env_get_cpu(env)); /* Read an LPAE long-descriptor translation table. */ MMUFaultType fault_type = translation_fault; uint32_t level = 1; uint32_t epd; int32_t tsz; uint32_t tg; uint64_t ttbr; int ttbr_select; hwaddr descaddr, descmask; uint32_t tableattrs; target_ulong page_size; uint32_t attrs; int32_t granule_sz = 9; int32_t va_size = 32; int32_t tbi = 0; if (arm_el_is_aa64(env, 1)) { va_size = 64; if (extract64(address, 55, 1)) tbi = extract64(env->cp15.c2_control, 38, 1); else tbi = extract64(env->cp15.c2_control, 37, 1); tbi *= 8; } /* Determine whether this address is in the region controlled by * TTBR0 or TTBR1 (or if it is in neither region and should fault). * This is a Non-secure PL0/1 stage 1 translation, so controlled by * TTBCR/TTBR0/TTBR1 in accordance with ARM ARM DDI0406C table B-32: */ uint32_t t0sz = extract32(env->cp15.c2_control, 0, 6); if (arm_el_is_aa64(env, 1)) { t0sz = MIN(t0sz, 39); t0sz = MAX(t0sz, 16); } uint32_t t1sz = extract32(env->cp15.c2_control, 16, 6); if (arm_el_is_aa64(env, 1)) { t1sz = MIN(t1sz, 39); t1sz = MAX(t1sz, 16); } if (t0sz && !extract64(address, va_size - t0sz, t0sz - tbi)) { /* there is a ttbr0 region and we are in it (high bits all zero) */ ttbr_select = 0; } else if (t1sz && !extract64(~address, va_size - t1sz, t1sz - tbi)) { /* there is a ttbr1 region and we are in it (high bits all one) */ ttbr_select = 1; } else if (!t0sz) { /* ttbr0 region is "everything not in the ttbr1 region" */ ttbr_select = 0; } else if (!t1sz) { /* ttbr1 region is "everything not in the ttbr0 region" */ ttbr_select = 1; } else { /* in the gap between the two regions, this is a Translation fault */ fault_type = translation_fault; goto do_fault; } /* Note that QEMU ignores shareability and cacheability attributes, * so we don't need to do anything with the SH, ORGN, IRGN fields * in the TTBCR. Similarly, TTBCR:A1 selects whether we get the * ASID from TTBR0 or TTBR1, but QEMU's TLB doesn't currently * implement any ASID-like capability so we can ignore it (instead * we will always flush the TLB any time the ASID is changed). */ if (ttbr_select == 0) { ttbr = env->cp15.ttbr0_el1; epd = extract32(env->cp15.c2_control, 7, 1); tsz = t0sz; tg = extract32(env->cp15.c2_control, 14, 2); if (tg == 1) { /* 64KB pages */ granule_sz = 13; } if (tg == 2) { /* 16KB pages */ granule_sz = 11; } } else { ttbr = env->cp15.ttbr1_el1; epd = extract32(env->cp15.c2_control, 23, 1); tsz = t1sz; tg = extract32(env->cp15.c2_control, 30, 2); if (tg == 3) { /* 64KB pages */ granule_sz = 13; } if (tg == 1) { /* 16KB pages */ granule_sz = 11; } } if (epd) { /* Translation table walk disabled => Translation fault on TLB miss */ goto do_fault; } /* The starting level depends on the virtual address size which can be * up to 48-bits and the translation granule size. */ if ((va_size - tsz) > (granule_sz * 4 + 3)) { level = 0; } else if ((va_size - tsz) > (granule_sz * 3 + 3)) { level = 1; } else { level = 2; } /* Clear the vaddr bits which aren't part of the within-region address, * so that we don't have to special case things when calculating the * first descriptor address. */ if (tsz) { address &= (1ULL << (va_size - tsz)) - 1; } descmask = (1ULL << (granule_sz + 3)) - 1; /* Now we can extract the actual base address from the TTBR */ descaddr = extract64(ttbr, 0, 48); descaddr &= ~((1ULL << (va_size - tsz - (granule_sz * (4 - level)))) - 1); tableattrs = 0; for (;;) { uint64_t descriptor; descaddr |= (address >> (granule_sz * (4 - level))) & descmask; descaddr &= ~7ULL; descriptor = ldq_phys(cs->as, descaddr); if (!(descriptor & 1) || (!(descriptor & 2) && (level == 3))) { /* Invalid, or the Reserved level 3 encoding */ goto do_fault; } descaddr = descriptor & 0xfffffff000ULL; if ((descriptor & 2) && (level < 3)) { /* Table entry. The top five bits are attributes which may * propagate down through lower levels of the table (and * which are all arranged so that 0 means "no effect", so * we can gather them up by ORing in the bits at each level). */ tableattrs |= extract64(descriptor, 59, 5); level++; continue; } /* Block entry at level 1 or 2, or page entry at level 3. * These are basically the same thing, although the number * of bits we pull in from the vaddr varies. */ page_size = (1 << ((granule_sz * (4 - level)) + 3)); descaddr |= (address & (page_size - 1)); /* Extract attributes from the descriptor and merge with table attrs */ if (arm_feature(env, ARM_FEATURE_V8)) { attrs = extract64(descriptor, 2, 10) | (extract64(descriptor, 53, 11) << 10); } else { attrs = extract64(descriptor, 2, 10) | (extract64(descriptor, 52, 12) << 10); } attrs |= extract32(tableattrs, 0, 2) << 11; /* XN, PXN */ attrs |= extract32(tableattrs, 3, 1) << 5; /* APTable[1] => AP[2] */ /* The sense of AP[1] vs APTable[0] is reversed, as APTable[0] == 1 * means "force PL1 access only", which means forcing AP[1] to 0. */ if (extract32(tableattrs, 2, 1)) { attrs &= ~(1 << 4); } /* Since we're always in the Non-secure state, NSTable is ignored. */ break; } /* Here descaddr is the final physical address, and attributes * are all in attrs. */ fault_type = access_fault; if ((attrs & (1 << 8)) == 0) { /* Access flag */ goto do_fault; } fault_type = permission_fault; if (is_user && !(attrs & (1 << 4))) { /* Unprivileged access not enabled */ goto do_fault; } *prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC; if (attrs & (1 << 12) || (!is_user && (attrs & (1 << 11)))) { /* XN or PXN */ if (access_type == 2) { goto do_fault; } *prot &= ~PAGE_EXEC; } if (attrs & (1 << 5)) { /* Write access forbidden */ if (access_type == 1) { goto do_fault; } *prot &= ~PAGE_WRITE; } *phys_ptr = descaddr; *page_size_ptr = page_size; return 0; do_fault: /* Long-descriptor format IFSR/DFSR value */ return (1 << 9) | (fault_type << 2) | level; }
true
qemu
d615efac7c4dc0984de31791c5c7d6b06408aadb
static int get_phys_addr_lpae(CPUARMState *env, target_ulong address, int access_type, int is_user, hwaddr *phys_ptr, int *prot, target_ulong *page_size_ptr) { CPUState *cs = CPU(arm_env_get_cpu(env)); MMUFaultType fault_type = translation_fault; uint32_t level = 1; uint32_t epd; int32_t tsz; uint32_t tg; uint64_t ttbr; int ttbr_select; hwaddr descaddr, descmask; uint32_t tableattrs; target_ulong page_size; uint32_t attrs; int32_t granule_sz = 9; int32_t va_size = 32; int32_t tbi = 0; if (arm_el_is_aa64(env, 1)) { va_size = 64; if (extract64(address, 55, 1)) tbi = extract64(env->cp15.c2_control, 38, 1); else tbi = extract64(env->cp15.c2_control, 37, 1); tbi *= 8; } uint32_t t0sz = extract32(env->cp15.c2_control, 0, 6); if (arm_el_is_aa64(env, 1)) { t0sz = MIN(t0sz, 39); t0sz = MAX(t0sz, 16); } uint32_t t1sz = extract32(env->cp15.c2_control, 16, 6); if (arm_el_is_aa64(env, 1)) { t1sz = MIN(t1sz, 39); t1sz = MAX(t1sz, 16); } if (t0sz && !extract64(address, va_size - t0sz, t0sz - tbi)) { ttbr_select = 0; } else if (t1sz && !extract64(~address, va_size - t1sz, t1sz - tbi)) { ttbr_select = 1; } else if (!t0sz) { ttbr_select = 0; } else if (!t1sz) { ttbr_select = 1; } else { fault_type = translation_fault; goto do_fault; } if (ttbr_select == 0) { ttbr = env->cp15.ttbr0_el1; epd = extract32(env->cp15.c2_control, 7, 1); tsz = t0sz; tg = extract32(env->cp15.c2_control, 14, 2); if (tg == 1) { granule_sz = 13; } if (tg == 2) { granule_sz = 11; } } else { ttbr = env->cp15.ttbr1_el1; epd = extract32(env->cp15.c2_control, 23, 1); tsz = t1sz; tg = extract32(env->cp15.c2_control, 30, 2); if (tg == 3) { granule_sz = 13; } if (tg == 1) { granule_sz = 11; } } if (epd) { goto do_fault; } if ((va_size - tsz) > (granule_sz * 4 + 3)) { level = 0; } else if ((va_size - tsz) > (granule_sz * 3 + 3)) { level = 1; } else { level = 2; } if (tsz) { address &= (1ULL << (va_size - tsz)) - 1; } descmask = (1ULL << (granule_sz + 3)) - 1; descaddr = extract64(ttbr, 0, 48); descaddr &= ~((1ULL << (va_size - tsz - (granule_sz * (4 - level)))) - 1); tableattrs = 0; for (;;) { uint64_t descriptor; descaddr |= (address >> (granule_sz * (4 - level))) & descmask; descaddr &= ~7ULL; descriptor = ldq_phys(cs->as, descaddr); if (!(descriptor & 1) || (!(descriptor & 2) && (level == 3))) { goto do_fault; } descaddr = descriptor & 0xfffffff000ULL; if ((descriptor & 2) && (level < 3)) { tableattrs |= extract64(descriptor, 59, 5); level++; continue; } page_size = (1 << ((granule_sz * (4 - level)) + 3)); descaddr |= (address & (page_size - 1)); if (arm_feature(env, ARM_FEATURE_V8)) { attrs = extract64(descriptor, 2, 10) | (extract64(descriptor, 53, 11) << 10); } else { attrs = extract64(descriptor, 2, 10) | (extract64(descriptor, 52, 12) << 10); } attrs |= extract32(tableattrs, 0, 2) << 11; attrs |= extract32(tableattrs, 3, 1) << 5; if (extract32(tableattrs, 2, 1)) { attrs &= ~(1 << 4); } break; } fault_type = access_fault; if ((attrs & (1 << 8)) == 0) { goto do_fault; } fault_type = permission_fault; if (is_user && !(attrs & (1 << 4))) { goto do_fault; } *prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC; if (attrs & (1 << 12) || (!is_user && (attrs & (1 << 11)))) { if (access_type == 2) { goto do_fault; } *prot &= ~PAGE_EXEC; } if (attrs & (1 << 5)) { if (access_type == 1) { goto do_fault; } *prot &= ~PAGE_WRITE; } *phys_ptr = descaddr; *page_size_ptr = page_size; return 0; do_fault: return (1 << 9) | (fault_type << 2) | level; }
{ "code": [ " if (arm_feature(env, ARM_FEATURE_V8)) {", " attrs = extract64(descriptor, 2, 10)", " | (extract64(descriptor, 53, 11) << 10);", " } else {", " attrs = extract64(descriptor, 2, 10)", " | (extract64(descriptor, 52, 12) << 10);", " if (attrs & (1 << 12) || (!is_user && (attrs & (1 << 11)))) {" ], "line_no": [ 317, 319, 321, 323, 319, 327, 381 ] }
static int FUNC_0(CPUARMState *VAR_0, target_ulong VAR_1, int VAR_2, int VAR_3, hwaddr *VAR_4, int *VAR_5, target_ulong *VAR_6) { CPUState *cs = CPU(arm_env_get_cpu(VAR_0)); MMUFaultType fault_type = translation_fault; uint32_t level = 1; uint32_t epd; int32_t tsz; uint32_t tg; uint64_t ttbr; int VAR_7; hwaddr descaddr, descmask; uint32_t tableattrs; target_ulong page_size; uint32_t attrs; int32_t granule_sz = 9; int32_t va_size = 32; int32_t tbi = 0; if (arm_el_is_aa64(VAR_0, 1)) { va_size = 64; if (extract64(VAR_1, 55, 1)) tbi = extract64(VAR_0->cp15.c2_control, 38, 1); else tbi = extract64(VAR_0->cp15.c2_control, 37, 1); tbi *= 8; } uint32_t t0sz = extract32(VAR_0->cp15.c2_control, 0, 6); if (arm_el_is_aa64(VAR_0, 1)) { t0sz = MIN(t0sz, 39); t0sz = MAX(t0sz, 16); } uint32_t t1sz = extract32(VAR_0->cp15.c2_control, 16, 6); if (arm_el_is_aa64(VAR_0, 1)) { t1sz = MIN(t1sz, 39); t1sz = MAX(t1sz, 16); } if (t0sz && !extract64(VAR_1, va_size - t0sz, t0sz - tbi)) { VAR_7 = 0; } else if (t1sz && !extract64(~VAR_1, va_size - t1sz, t1sz - tbi)) { VAR_7 = 1; } else if (!t0sz) { VAR_7 = 0; } else if (!t1sz) { VAR_7 = 1; } else { fault_type = translation_fault; goto do_fault; } if (VAR_7 == 0) { ttbr = VAR_0->cp15.ttbr0_el1; epd = extract32(VAR_0->cp15.c2_control, 7, 1); tsz = t0sz; tg = extract32(VAR_0->cp15.c2_control, 14, 2); if (tg == 1) { granule_sz = 13; } if (tg == 2) { granule_sz = 11; } } else { ttbr = VAR_0->cp15.ttbr1_el1; epd = extract32(VAR_0->cp15.c2_control, 23, 1); tsz = t1sz; tg = extract32(VAR_0->cp15.c2_control, 30, 2); if (tg == 3) { granule_sz = 13; } if (tg == 1) { granule_sz = 11; } } if (epd) { goto do_fault; } if ((va_size - tsz) > (granule_sz * 4 + 3)) { level = 0; } else if ((va_size - tsz) > (granule_sz * 3 + 3)) { level = 1; } else { level = 2; } if (tsz) { VAR_1 &= (1ULL << (va_size - tsz)) - 1; } descmask = (1ULL << (granule_sz + 3)) - 1; descaddr = extract64(ttbr, 0, 48); descaddr &= ~((1ULL << (va_size - tsz - (granule_sz * (4 - level)))) - 1); tableattrs = 0; for (;;) { uint64_t descriptor; descaddr |= (VAR_1 >> (granule_sz * (4 - level))) & descmask; descaddr &= ~7ULL; descriptor = ldq_phys(cs->as, descaddr); if (!(descriptor & 1) || (!(descriptor & 2) && (level == 3))) { goto do_fault; } descaddr = descriptor & 0xfffffff000ULL; if ((descriptor & 2) && (level < 3)) { tableattrs |= extract64(descriptor, 59, 5); level++; continue; } page_size = (1 << ((granule_sz * (4 - level)) + 3)); descaddr |= (VAR_1 & (page_size - 1)); if (arm_feature(VAR_0, ARM_FEATURE_V8)) { attrs = extract64(descriptor, 2, 10) | (extract64(descriptor, 53, 11) << 10); } else { attrs = extract64(descriptor, 2, 10) | (extract64(descriptor, 52, 12) << 10); } attrs |= extract32(tableattrs, 0, 2) << 11; attrs |= extract32(tableattrs, 3, 1) << 5; if (extract32(tableattrs, 2, 1)) { attrs &= ~(1 << 4); } break; } fault_type = access_fault; if ((attrs & (1 << 8)) == 0) { goto do_fault; } fault_type = permission_fault; if (VAR_3 && !(attrs & (1 << 4))) { goto do_fault; } *VAR_5 = PAGE_READ | PAGE_WRITE | PAGE_EXEC; if (attrs & (1 << 12) || (!VAR_3 && (attrs & (1 << 11)))) { if (VAR_2 == 2) { goto do_fault; } *VAR_5 &= ~PAGE_EXEC; } if (attrs & (1 << 5)) { if (VAR_2 == 1) { goto do_fault; } *VAR_5 &= ~PAGE_WRITE; } *VAR_4 = descaddr; *VAR_6 = page_size; return 0; do_fault: return (1 << 9) | (fault_type << 2) | level; }
[ "static int FUNC_0(CPUARMState *VAR_0, target_ulong VAR_1,\nint VAR_2, int VAR_3,\nhwaddr *VAR_4, int *VAR_5,\ntarget_ulong *VAR_6)\n{", "CPUState *cs = CPU(arm_env_get_cpu(VAR_0));", "MMUFaultType fault_type = translation_fault;", "uint32_t level = 1;", "uint32_t epd;", "int32_t tsz;", "uint32_t tg;", "uint64_t ttbr;", "int VAR_7;", "hwaddr descaddr, descmask;", "uint32_t tableattrs;", "target_ulong page_size;", "uint32_t attrs;", "int32_t granule_sz = 9;", "int32_t va_size = 32;", "int32_t tbi = 0;", "if (arm_el_is_aa64(VAR_0, 1)) {", "va_size = 64;", "if (extract64(VAR_1, 55, 1))\ntbi = extract64(VAR_0->cp15.c2_control, 38, 1);", "else\ntbi = extract64(VAR_0->cp15.c2_control, 37, 1);", "tbi *= 8;", "}", "uint32_t t0sz = extract32(VAR_0->cp15.c2_control, 0, 6);", "if (arm_el_is_aa64(VAR_0, 1)) {", "t0sz = MIN(t0sz, 39);", "t0sz = MAX(t0sz, 16);", "}", "uint32_t t1sz = extract32(VAR_0->cp15.c2_control, 16, 6);", "if (arm_el_is_aa64(VAR_0, 1)) {", "t1sz = MIN(t1sz, 39);", "t1sz = MAX(t1sz, 16);", "}", "if (t0sz && !extract64(VAR_1, va_size - t0sz, t0sz - tbi)) {", "VAR_7 = 0;", "} else if (t1sz && !extract64(~VAR_1, va_size - t1sz, t1sz - tbi)) {", "VAR_7 = 1;", "} else if (!t0sz) {", "VAR_7 = 0;", "} else if (!t1sz) {", "VAR_7 = 1;", "} else {", "fault_type = translation_fault;", "goto do_fault;", "}", "if (VAR_7 == 0) {", "ttbr = VAR_0->cp15.ttbr0_el1;", "epd = extract32(VAR_0->cp15.c2_control, 7, 1);", "tsz = t0sz;", "tg = extract32(VAR_0->cp15.c2_control, 14, 2);", "if (tg == 1) {", "granule_sz = 13;", "}", "if (tg == 2) {", "granule_sz = 11;", "}", "} else {", "ttbr = VAR_0->cp15.ttbr1_el1;", "epd = extract32(VAR_0->cp15.c2_control, 23, 1);", "tsz = t1sz;", "tg = extract32(VAR_0->cp15.c2_control, 30, 2);", "if (tg == 3) {", "granule_sz = 13;", "}", "if (tg == 1) {", "granule_sz = 11;", "}", "}", "if (epd) {", "goto do_fault;", "}", "if ((va_size - tsz) > (granule_sz * 4 + 3)) {", "level = 0;", "} else if ((va_size - tsz) > (granule_sz * 3 + 3)) {", "level = 1;", "} else {", "level = 2;", "}", "if (tsz) {", "VAR_1 &= (1ULL << (va_size - tsz)) - 1;", "}", "descmask = (1ULL << (granule_sz + 3)) - 1;", "descaddr = extract64(ttbr, 0, 48);", "descaddr &= ~((1ULL << (va_size - tsz - (granule_sz * (4 - level)))) - 1);", "tableattrs = 0;", "for (;;) {", "uint64_t descriptor;", "descaddr |= (VAR_1 >> (granule_sz * (4 - level))) & descmask;", "descaddr &= ~7ULL;", "descriptor = ldq_phys(cs->as, descaddr);", "if (!(descriptor & 1) ||\n(!(descriptor & 2) && (level == 3))) {", "goto do_fault;", "}", "descaddr = descriptor & 0xfffffff000ULL;", "if ((descriptor & 2) && (level < 3)) {", "tableattrs |= extract64(descriptor, 59, 5);", "level++;", "continue;", "}", "page_size = (1 << ((granule_sz * (4 - level)) + 3));", "descaddr |= (VAR_1 & (page_size - 1));", "if (arm_feature(VAR_0, ARM_FEATURE_V8)) {", "attrs = extract64(descriptor, 2, 10)\n| (extract64(descriptor, 53, 11) << 10);", "} else {", "attrs = extract64(descriptor, 2, 10)\n| (extract64(descriptor, 52, 12) << 10);", "}", "attrs |= extract32(tableattrs, 0, 2) << 11;", "attrs |= extract32(tableattrs, 3, 1) << 5;", "if (extract32(tableattrs, 2, 1)) {", "attrs &= ~(1 << 4);", "}", "break;", "}", "fault_type = access_fault;", "if ((attrs & (1 << 8)) == 0) {", "goto do_fault;", "}", "fault_type = permission_fault;", "if (VAR_3 && !(attrs & (1 << 4))) {", "goto do_fault;", "}", "*VAR_5 = PAGE_READ | PAGE_WRITE | PAGE_EXEC;", "if (attrs & (1 << 12) || (!VAR_3 && (attrs & (1 << 11)))) {", "if (VAR_2 == 2) {", "goto do_fault;", "}", "*VAR_5 &= ~PAGE_EXEC;", "}", "if (attrs & (1 << 5)) {", "if (VAR_2 == 1) {", "goto do_fault;", "}", "*VAR_5 &= ~PAGE_WRITE;", "}", "*VAR_4 = descaddr;", "*VAR_6 = page_size;", "return 0;", "do_fault:\nreturn (1 << 9) | (fault_type << 2) | level;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49, 51 ], [ 53, 55 ], [ 57 ], [ 59 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 97 ], [ 99 ], [ 103 ], [ 105 ], [ 109 ], [ 111 ], [ 115 ], [ 117 ], [ 121 ], [ 123 ], [ 125 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 195 ], [ 199 ], [ 201 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 235 ], [ 237 ], [ 239 ], [ 243 ], [ 249 ], [ 251 ], [ 255 ], [ 257 ], [ 259 ], [ 263 ], [ 265 ], [ 267 ], [ 269, 271 ], [ 275 ], [ 277 ], [ 279 ], [ 283 ], [ 295 ], [ 297 ], [ 299 ], [ 301 ], [ 311 ], [ 313 ], [ 317 ], [ 319, 321 ], [ 323 ], [ 325, 327 ], [ 329 ], [ 331 ], [ 333 ], [ 341 ], [ 343 ], [ 345 ], [ 349 ], [ 351 ], [ 359 ], [ 361 ], [ 365 ], [ 367 ], [ 369 ], [ 371 ], [ 375 ], [ 377 ], [ 379 ], [ 381 ], [ 385 ], [ 387 ], [ 389 ], [ 391 ], [ 393 ], [ 395 ], [ 399 ], [ 401 ], [ 403 ], [ 405 ], [ 407 ], [ 411 ], [ 413 ], [ 415 ], [ 419, 423 ], [ 425 ] ]
5,548
av_cold void ff_diracdsp_init(DiracDSPContext *c) { c->dirac_hpel_filter = dirac_hpel_filter; c->add_rect_clamped = add_rect_clamped_c; c->put_signed_rect_clamped[0] = put_signed_rect_clamped_8bit_c; c->put_signed_rect_clamped[1] = put_signed_rect_clamped_10bit_c; c->add_dirac_obmc[0] = add_obmc8_c; c->add_dirac_obmc[1] = add_obmc16_c; c->add_dirac_obmc[2] = add_obmc32_c; c->weight_dirac_pixels_tab[0] = weight_dirac_pixels8_c; c->weight_dirac_pixels_tab[1] = weight_dirac_pixels16_c; c->weight_dirac_pixels_tab[2] = weight_dirac_pixels32_c; c->biweight_dirac_pixels_tab[0] = biweight_dirac_pixels8_c; c->biweight_dirac_pixels_tab[1] = biweight_dirac_pixels16_c; c->biweight_dirac_pixels_tab[2] = biweight_dirac_pixels32_c; PIXFUNC(put, 8); PIXFUNC(put, 16); PIXFUNC(put, 32); PIXFUNC(avg, 8); PIXFUNC(avg, 16); PIXFUNC(avg, 32); if (HAVE_MMX && HAVE_YASM) ff_diracdsp_init_mmx(c); }
true
FFmpeg
8248b51e0b94f0151b6a2057ee639d6e0db29f5f
av_cold void ff_diracdsp_init(DiracDSPContext *c) { c->dirac_hpel_filter = dirac_hpel_filter; c->add_rect_clamped = add_rect_clamped_c; c->put_signed_rect_clamped[0] = put_signed_rect_clamped_8bit_c; c->put_signed_rect_clamped[1] = put_signed_rect_clamped_10bit_c; c->add_dirac_obmc[0] = add_obmc8_c; c->add_dirac_obmc[1] = add_obmc16_c; c->add_dirac_obmc[2] = add_obmc32_c; c->weight_dirac_pixels_tab[0] = weight_dirac_pixels8_c; c->weight_dirac_pixels_tab[1] = weight_dirac_pixels16_c; c->weight_dirac_pixels_tab[2] = weight_dirac_pixels32_c; c->biweight_dirac_pixels_tab[0] = biweight_dirac_pixels8_c; c->biweight_dirac_pixels_tab[1] = biweight_dirac_pixels16_c; c->biweight_dirac_pixels_tab[2] = biweight_dirac_pixels32_c; PIXFUNC(put, 8); PIXFUNC(put, 16); PIXFUNC(put, 32); PIXFUNC(avg, 8); PIXFUNC(avg, 16); PIXFUNC(avg, 32); if (HAVE_MMX && HAVE_YASM) ff_diracdsp_init_mmx(c); }
{ "code": [], "line_no": [] }
av_cold void FUNC_0(DiracDSPContext *c) { c->dirac_hpel_filter = dirac_hpel_filter; c->add_rect_clamped = add_rect_clamped_c; c->put_signed_rect_clamped[0] = put_signed_rect_clamped_8bit_c; c->put_signed_rect_clamped[1] = put_signed_rect_clamped_10bit_c; c->add_dirac_obmc[0] = add_obmc8_c; c->add_dirac_obmc[1] = add_obmc16_c; c->add_dirac_obmc[2] = add_obmc32_c; c->weight_dirac_pixels_tab[0] = weight_dirac_pixels8_c; c->weight_dirac_pixels_tab[1] = weight_dirac_pixels16_c; c->weight_dirac_pixels_tab[2] = weight_dirac_pixels32_c; c->biweight_dirac_pixels_tab[0] = biweight_dirac_pixels8_c; c->biweight_dirac_pixels_tab[1] = biweight_dirac_pixels16_c; c->biweight_dirac_pixels_tab[2] = biweight_dirac_pixels32_c; PIXFUNC(put, 8); PIXFUNC(put, 16); PIXFUNC(put, 32); PIXFUNC(avg, 8); PIXFUNC(avg, 16); PIXFUNC(avg, 32); if (HAVE_MMX && HAVE_YASM) ff_diracdsp_init_mmx(c); }
[ "av_cold void FUNC_0(DiracDSPContext *c)\n{", "c->dirac_hpel_filter = dirac_hpel_filter;", "c->add_rect_clamped = add_rect_clamped_c;", "c->put_signed_rect_clamped[0] = put_signed_rect_clamped_8bit_c;", "c->put_signed_rect_clamped[1] = put_signed_rect_clamped_10bit_c;", "c->add_dirac_obmc[0] = add_obmc8_c;", "c->add_dirac_obmc[1] = add_obmc16_c;", "c->add_dirac_obmc[2] = add_obmc32_c;", "c->weight_dirac_pixels_tab[0] = weight_dirac_pixels8_c;", "c->weight_dirac_pixels_tab[1] = weight_dirac_pixels16_c;", "c->weight_dirac_pixels_tab[2] = weight_dirac_pixels32_c;", "c->biweight_dirac_pixels_tab[0] = biweight_dirac_pixels8_c;", "c->biweight_dirac_pixels_tab[1] = biweight_dirac_pixels16_c;", "c->biweight_dirac_pixels_tab[2] = biweight_dirac_pixels32_c;", "PIXFUNC(put, 8);", "PIXFUNC(put, 16);", "PIXFUNC(put, 32);", "PIXFUNC(avg, 8);", "PIXFUNC(avg, 16);", "PIXFUNC(avg, 32);", "if (HAVE_MMX && HAVE_YASM) ff_diracdsp_init_mmx(c);", "}" ]
[ 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 ], [ 16 ], [ 18 ], [ 20 ], [ 24 ], [ 26 ], [ 28 ], [ 30 ], [ 32 ], [ 34 ], [ 38 ], [ 40 ], [ 42 ], [ 44 ], [ 46 ], [ 48 ], [ 52 ], [ 54 ] ]
5,549
static int encode_block(SVQ1Context *s, uint8_t *src, uint8_t *ref, uint8_t *decoded, int stride, int level, int threshold, int lambda, int intra){ int count, y, x, i, j, split, best_mean, best_score, best_count; int best_vector[6]; int block_sum[7]= {0, 0, 0, 0, 0, 0}; int w= 2<<((level+2)>>1); int h= 2<<((level+1)>>1); int size=w*h; int16_t block[7][256]; const int8_t *codebook_sum, *codebook; const uint16_t (*mean_vlc)[2]; const uint8_t (*multistage_vlc)[2]; best_score=0; //FIXME optimize, this doenst need to be done multiple times if(intra){ codebook_sum= svq1_intra_codebook_sum[level]; codebook= ff_svq1_intra_codebooks[level]; mean_vlc= ff_svq1_intra_mean_vlc; multistage_vlc= ff_svq1_intra_multistage_vlc[level]; for(y=0; y<h; y++){ for(x=0; x<w; x++){ int v= src[x + y*stride]; block[0][x + w*y]= v; best_score += v*v; block_sum[0] += v; } } }else{ codebook_sum= svq1_inter_codebook_sum[level]; codebook= ff_svq1_inter_codebooks[level]; mean_vlc= ff_svq1_inter_mean_vlc + 256; multistage_vlc= ff_svq1_inter_multistage_vlc[level]; for(y=0; y<h; y++){ for(x=0; x<w; x++){ int v= src[x + y*stride] - ref[x + y*stride]; block[0][x + w*y]= v; best_score += v*v; block_sum[0] += v; } } } best_count=0; best_score -= ((block_sum[0]*block_sum[0])>>(level+3)); best_mean= (block_sum[0] + (size>>1)) >> (level+3); if(level<4){ for(count=1; count<7; count++){ int best_vector_score= INT_MAX; int best_vector_sum=-999, best_vector_mean=-999; const int stage= count-1; const int8_t *vector; for(i=0; i<16; i++){ int sum= codebook_sum[stage*16 + i]; int sqr, diff, score; vector = codebook + stage*size*16 + i*size; sqr = s->dsp.ssd_int8_vs_int16(vector, block[stage], size); diff= block_sum[stage] - sum; score= sqr - ((diff*(int64_t)diff)>>(level+3)); //FIXME 64bit slooow if(score < best_vector_score){ int mean= (diff + (size>>1)) >> (level+3); assert(mean >-300 && mean<300); mean= av_clip(mean, intra?0:-256, 255); best_vector_score= score; best_vector[stage]= i; best_vector_sum= sum; best_vector_mean= mean; } } assert(best_vector_mean != -999); vector= codebook + stage*size*16 + best_vector[stage]*size; for(j=0; j<size; j++){ block[stage+1][j] = block[stage][j] - vector[j]; } block_sum[stage+1]= block_sum[stage] - best_vector_sum; best_vector_score += lambda*(+ 1 + 4*count + multistage_vlc[1+count][1] + mean_vlc[best_vector_mean][1]); if(best_vector_score < best_score){ best_score= best_vector_score; best_count= count; best_mean= best_vector_mean; } } } split=0; if(best_score > threshold && level){ int score=0; int offset= (level&1) ? stride*h/2 : w/2; PutBitContext backup[6]; for(i=level-1; i>=0; i--){ backup[i]= s->reorder_pb[i]; } score += encode_block(s, src , ref , decoded , stride, level-1, threshold>>1, lambda, intra); score += encode_block(s, src + offset, ref + offset, decoded + offset, stride, level-1, threshold>>1, lambda, intra); score += lambda; if(score < best_score){ best_score= score; split=1; }else{ for(i=level-1; i>=0; i--){ s->reorder_pb[i]= backup[i]; } } } if (level > 0) put_bits(&s->reorder_pb[level], 1, split); if(!split){ assert((best_mean >= 0 && best_mean<256) || !intra); assert(best_mean >= -256 && best_mean<256); assert(best_count >=0 && best_count<7); assert(level<4 || best_count==0); /* output the encoding */ put_bits(&s->reorder_pb[level], multistage_vlc[1 + best_count][1], multistage_vlc[1 + best_count][0]); put_bits(&s->reorder_pb[level], mean_vlc[best_mean][1], mean_vlc[best_mean][0]); for (i = 0; i < best_count; i++){ assert(best_vector[i]>=0 && best_vector[i]<16); put_bits(&s->reorder_pb[level], 4, best_vector[i]); } for(y=0; y<h; y++){ for(x=0; x<w; x++){ decoded[x + y*stride]= src[x + y*stride] - block[best_count][x + w*y] + best_mean; } } } return best_score; }
true
FFmpeg
f7f892e4d5bded48b08e7b776a5fb7c350496f2b
static int encode_block(SVQ1Context *s, uint8_t *src, uint8_t *ref, uint8_t *decoded, int stride, int level, int threshold, int lambda, int intra){ int count, y, x, i, j, split, best_mean, best_score, best_count; int best_vector[6]; int block_sum[7]= {0, 0, 0, 0, 0, 0}; int w= 2<<((level+2)>>1); int h= 2<<((level+1)>>1); int size=w*h; int16_t block[7][256]; const int8_t *codebook_sum, *codebook; const uint16_t (*mean_vlc)[2]; const uint8_t (*multistage_vlc)[2]; best_score=0; if(intra){ codebook_sum= svq1_intra_codebook_sum[level]; codebook= ff_svq1_intra_codebooks[level]; mean_vlc= ff_svq1_intra_mean_vlc; multistage_vlc= ff_svq1_intra_multistage_vlc[level]; for(y=0; y<h; y++){ for(x=0; x<w; x++){ int v= src[x + y*stride]; block[0][x + w*y]= v; best_score += v*v; block_sum[0] += v; } } }else{ codebook_sum= svq1_inter_codebook_sum[level]; codebook= ff_svq1_inter_codebooks[level]; mean_vlc= ff_svq1_inter_mean_vlc + 256; multistage_vlc= ff_svq1_inter_multistage_vlc[level]; for(y=0; y<h; y++){ for(x=0; x<w; x++){ int v= src[x + y*stride] - ref[x + y*stride]; block[0][x + w*y]= v; best_score += v*v; block_sum[0] += v; } } } best_count=0; best_score -= ((block_sum[0]*block_sum[0])>>(level+3)); best_mean= (block_sum[0] + (size>>1)) >> (level+3); if(level<4){ for(count=1; count<7; count++){ int best_vector_score= INT_MAX; int best_vector_sum=-999, best_vector_mean=-999; const int stage= count-1; const int8_t *vector; for(i=0; i<16; i++){ int sum= codebook_sum[stage*16 + i]; int sqr, diff, score; vector = codebook + stage*size*16 + i*size; sqr = s->dsp.ssd_int8_vs_int16(vector, block[stage], size); diff= block_sum[stage] - sum; score= sqr - ((diff*(int64_t)diff)>>(level+3)); if(score < best_vector_score){ int mean= (diff + (size>>1)) >> (level+3); assert(mean >-300 && mean<300); mean= av_clip(mean, intra?0:-256, 255); best_vector_score= score; best_vector[stage]= i; best_vector_sum= sum; best_vector_mean= mean; } } assert(best_vector_mean != -999); vector= codebook + stage*size*16 + best_vector[stage]*size; for(j=0; j<size; j++){ block[stage+1][j] = block[stage][j] - vector[j]; } block_sum[stage+1]= block_sum[stage] - best_vector_sum; best_vector_score += lambda*(+ 1 + 4*count + multistage_vlc[1+count][1] + mean_vlc[best_vector_mean][1]); if(best_vector_score < best_score){ best_score= best_vector_score; best_count= count; best_mean= best_vector_mean; } } } split=0; if(best_score > threshold && level){ int score=0; int offset= (level&1) ? stride*h/2 : w/2; PutBitContext backup[6]; for(i=level-1; i>=0; i--){ backup[i]= s->reorder_pb[i]; } score += encode_block(s, src , ref , decoded , stride, level-1, threshold>>1, lambda, intra); score += encode_block(s, src + offset, ref + offset, decoded + offset, stride, level-1, threshold>>1, lambda, intra); score += lambda; if(score < best_score){ best_score= score; split=1; }else{ for(i=level-1; i>=0; i--){ s->reorder_pb[i]= backup[i]; } } } if (level > 0) put_bits(&s->reorder_pb[level], 1, split); if(!split){ assert((best_mean >= 0 && best_mean<256) || !intra); assert(best_mean >= -256 && best_mean<256); assert(best_count >=0 && best_count<7); assert(level<4 || best_count==0); put_bits(&s->reorder_pb[level], multistage_vlc[1 + best_count][1], multistage_vlc[1 + best_count][0]); put_bits(&s->reorder_pb[level], mean_vlc[best_mean][1], mean_vlc[best_mean][0]); for (i = 0; i < best_count; i++){ assert(best_vector[i]>=0 && best_vector[i]<16); put_bits(&s->reorder_pb[level], 4, best_vector[i]); } for(y=0; y<h; y++){ for(x=0; x<w; x++){ decoded[x + y*stride]= src[x + y*stride] - block[best_count][x + w*y] + best_mean; } } } return best_score; }
{ "code": [ " best_score -= ((block_sum[0]*block_sum[0])>>(level+3));" ], "line_no": [ 87 ] }
static int FUNC_0(SVQ1Context *VAR_0, FUNC_2 *VAR_1, FUNC_2 *VAR_2, FUNC_2 *VAR_3, int VAR_4, int VAR_5, int VAR_6, int VAR_7, int VAR_8){ int VAR_9, VAR_10, VAR_11, VAR_12, VAR_13, VAR_14, VAR_15, VAR_16, VAR_17; int VAR_18[6]; int VAR_19[7]= {0, 0, 0, 0, 0, 0}; int VAR_20= 2<<((VAR_5+2)>>1); int VAR_21= 2<<((VAR_5+1)>>1); int VAR_22=VAR_20*VAR_21; int16_t block[7][256]; const int8_t *VAR_23, *codebook; const FUNC_1 (*mean_vlc)[2]; const FUNC_2 (*multistage_vlc)[2]; VAR_16=0; if(VAR_8){ VAR_23= svq1_intra_codebook_sum[VAR_5]; codebook= ff_svq1_intra_codebooks[VAR_5]; mean_vlc= ff_svq1_intra_mean_vlc; multistage_vlc= ff_svq1_intra_multistage_vlc[VAR_5]; for(VAR_10=0; VAR_10<VAR_21; VAR_10++){ for(VAR_11=0; VAR_11<VAR_20; VAR_11++){ int VAR_25= VAR_1[VAR_11 + VAR_10*VAR_4]; block[0][VAR_11 + VAR_20*VAR_10]= VAR_25; VAR_16 += VAR_25*VAR_25; VAR_19[0] += VAR_25; } } }else{ VAR_23= svq1_inter_codebook_sum[VAR_5]; codebook= ff_svq1_inter_codebooks[VAR_5]; mean_vlc= ff_svq1_inter_mean_vlc + 256; multistage_vlc= ff_svq1_inter_multistage_vlc[VAR_5]; for(VAR_10=0; VAR_10<VAR_21; VAR_10++){ for(VAR_11=0; VAR_11<VAR_20; VAR_11++){ int VAR_25= VAR_1[VAR_11 + VAR_10*VAR_4] - VAR_2[VAR_11 + VAR_10*VAR_4]; block[0][VAR_11 + VAR_20*VAR_10]= VAR_25; VAR_16 += VAR_25*VAR_25; VAR_19[0] += VAR_25; } } } VAR_17=0; VAR_16 -= ((VAR_19[0]*VAR_19[0])>>(VAR_5+3)); VAR_15= (VAR_19[0] + (VAR_22>>1)) >> (VAR_5+3); if(VAR_5<4){ for(VAR_9=1; VAR_9<7; VAR_9++){ int VAR_25= INT_MAX; int VAR_26=-999, VAR_27=-999; const int VAR_28= VAR_9-1; const int8_t *VAR_29; for(VAR_12=0; VAR_12<16; VAR_12++){ int VAR_30= VAR_23[VAR_28*16 + VAR_12]; int VAR_31, VAR_32, VAR_35; VAR_29 = codebook + VAR_28*VAR_22*16 + VAR_12*VAR_22; VAR_31 = VAR_0->dsp.ssd_int8_vs_int16(VAR_29, block[VAR_28], VAR_22); VAR_32= VAR_19[VAR_28] - VAR_30; VAR_35= VAR_31 - ((VAR_32*(int64_t)VAR_32)>>(VAR_5+3)); if(VAR_35 < VAR_25){ int VAR_34= (VAR_32 + (VAR_22>>1)) >> (VAR_5+3); assert(VAR_34 >-300 && VAR_34<300); VAR_34= av_clip(VAR_34, VAR_8?0:-256, 255); VAR_25= VAR_35; VAR_18[VAR_28]= VAR_12; VAR_26= VAR_30; VAR_27= VAR_34; } } assert(VAR_27 != -999); VAR_29= codebook + VAR_28*VAR_22*16 + VAR_18[VAR_28]*VAR_22; for(VAR_13=0; VAR_13<VAR_22; VAR_13++){ block[VAR_28+1][VAR_13] = block[VAR_28][VAR_13] - VAR_29[VAR_13]; } VAR_19[VAR_28+1]= VAR_19[VAR_28] - VAR_26; VAR_25 += VAR_7*(+ 1 + 4*VAR_9 + multistage_vlc[1+VAR_9][1] + mean_vlc[VAR_27][1]); if(VAR_25 < VAR_16){ VAR_16= VAR_25; VAR_17= VAR_9; VAR_15= VAR_27; } } } VAR_14=0; if(VAR_16 > VAR_6 && VAR_5){ int VAR_35=0; int VAR_35= (VAR_5&1) ? VAR_4*VAR_21/2 : VAR_20/2; PutBitContext backup[6]; for(VAR_12=VAR_5-1; VAR_12>=0; VAR_12--){ backup[VAR_12]= VAR_0->reorder_pb[VAR_12]; } VAR_35 += FUNC_0(VAR_0, VAR_1 , VAR_2 , VAR_3 , VAR_4, VAR_5-1, VAR_6>>1, VAR_7, VAR_8); VAR_35 += FUNC_0(VAR_0, VAR_1 + VAR_35, VAR_2 + VAR_35, VAR_3 + VAR_35, VAR_4, VAR_5-1, VAR_6>>1, VAR_7, VAR_8); VAR_35 += VAR_7; if(VAR_35 < VAR_16){ VAR_16= VAR_35; VAR_14=1; }else{ for(VAR_12=VAR_5-1; VAR_12>=0; VAR_12--){ VAR_0->reorder_pb[VAR_12]= backup[VAR_12]; } } } if (VAR_5 > 0) put_bits(&VAR_0->reorder_pb[VAR_5], 1, VAR_14); if(!VAR_14){ assert((VAR_15 >= 0 && VAR_15<256) || !VAR_8); assert(VAR_15 >= -256 && VAR_15<256); assert(VAR_17 >=0 && VAR_17<7); assert(VAR_5<4 || VAR_17==0); put_bits(&VAR_0->reorder_pb[VAR_5], multistage_vlc[1 + VAR_17][1], multistage_vlc[1 + VAR_17][0]); put_bits(&VAR_0->reorder_pb[VAR_5], mean_vlc[VAR_15][1], mean_vlc[VAR_15][0]); for (VAR_12 = 0; VAR_12 < VAR_17; VAR_12++){ assert(VAR_18[VAR_12]>=0 && VAR_18[VAR_12]<16); put_bits(&VAR_0->reorder_pb[VAR_5], 4, VAR_18[VAR_12]); } for(VAR_10=0; VAR_10<VAR_21; VAR_10++){ for(VAR_11=0; VAR_11<VAR_20; VAR_11++){ VAR_3[VAR_11 + VAR_10*VAR_4]= VAR_1[VAR_11 + VAR_10*VAR_4] - block[VAR_17][VAR_11 + VAR_20*VAR_10] + VAR_15; } } } return VAR_16; }
[ "static int FUNC_0(SVQ1Context *VAR_0, FUNC_2 *VAR_1, FUNC_2 *VAR_2, FUNC_2 *VAR_3, int VAR_4, int VAR_5, int VAR_6, int VAR_7, int VAR_8){", "int VAR_9, VAR_10, VAR_11, VAR_12, VAR_13, VAR_14, VAR_15, VAR_16, VAR_17;", "int VAR_18[6];", "int VAR_19[7]= {0, 0, 0, 0, 0, 0};", "int VAR_20= 2<<((VAR_5+2)>>1);", "int VAR_21= 2<<((VAR_5+1)>>1);", "int VAR_22=VAR_20*VAR_21;", "int16_t block[7][256];", "const int8_t *VAR_23, *codebook;", "const FUNC_1 (*mean_vlc)[2];", "const FUNC_2 (*multistage_vlc)[2];", "VAR_16=0;", "if(VAR_8){", "VAR_23= svq1_intra_codebook_sum[VAR_5];", "codebook= ff_svq1_intra_codebooks[VAR_5];", "mean_vlc= ff_svq1_intra_mean_vlc;", "multistage_vlc= ff_svq1_intra_multistage_vlc[VAR_5];", "for(VAR_10=0; VAR_10<VAR_21; VAR_10++){", "for(VAR_11=0; VAR_11<VAR_20; VAR_11++){", "int VAR_25= VAR_1[VAR_11 + VAR_10*VAR_4];", "block[0][VAR_11 + VAR_20*VAR_10]= VAR_25;", "VAR_16 += VAR_25*VAR_25;", "VAR_19[0] += VAR_25;", "}", "}", "}else{", "VAR_23= svq1_inter_codebook_sum[VAR_5];", "codebook= ff_svq1_inter_codebooks[VAR_5];", "mean_vlc= ff_svq1_inter_mean_vlc + 256;", "multistage_vlc= ff_svq1_inter_multistage_vlc[VAR_5];", "for(VAR_10=0; VAR_10<VAR_21; VAR_10++){", "for(VAR_11=0; VAR_11<VAR_20; VAR_11++){", "int VAR_25= VAR_1[VAR_11 + VAR_10*VAR_4] - VAR_2[VAR_11 + VAR_10*VAR_4];", "block[0][VAR_11 + VAR_20*VAR_10]= VAR_25;", "VAR_16 += VAR_25*VAR_25;", "VAR_19[0] += VAR_25;", "}", "}", "}", "VAR_17=0;", "VAR_16 -= ((VAR_19[0]*VAR_19[0])>>(VAR_5+3));", "VAR_15= (VAR_19[0] + (VAR_22>>1)) >> (VAR_5+3);", "if(VAR_5<4){", "for(VAR_9=1; VAR_9<7; VAR_9++){", "int VAR_25= INT_MAX;", "int VAR_26=-999, VAR_27=-999;", "const int VAR_28= VAR_9-1;", "const int8_t *VAR_29;", "for(VAR_12=0; VAR_12<16; VAR_12++){", "int VAR_30= VAR_23[VAR_28*16 + VAR_12];", "int VAR_31, VAR_32, VAR_35;", "VAR_29 = codebook + VAR_28*VAR_22*16 + VAR_12*VAR_22;", "VAR_31 = VAR_0->dsp.ssd_int8_vs_int16(VAR_29, block[VAR_28], VAR_22);", "VAR_32= VAR_19[VAR_28] - VAR_30;", "VAR_35= VAR_31 - ((VAR_32*(int64_t)VAR_32)>>(VAR_5+3));", "if(VAR_35 < VAR_25){", "int VAR_34= (VAR_32 + (VAR_22>>1)) >> (VAR_5+3);", "assert(VAR_34 >-300 && VAR_34<300);", "VAR_34= av_clip(VAR_34, VAR_8?0:-256, 255);", "VAR_25= VAR_35;", "VAR_18[VAR_28]= VAR_12;", "VAR_26= VAR_30;", "VAR_27= VAR_34;", "}", "}", "assert(VAR_27 != -999);", "VAR_29= codebook + VAR_28*VAR_22*16 + VAR_18[VAR_28]*VAR_22;", "for(VAR_13=0; VAR_13<VAR_22; VAR_13++){", "block[VAR_28+1][VAR_13] = block[VAR_28][VAR_13] - VAR_29[VAR_13];", "}", "VAR_19[VAR_28+1]= VAR_19[VAR_28] - VAR_26;", "VAR_25 +=\nVAR_7*(+ 1 + 4*VAR_9\n+ multistage_vlc[1+VAR_9][1]\n+ mean_vlc[VAR_27][1]);", "if(VAR_25 < VAR_16){", "VAR_16= VAR_25;", "VAR_17= VAR_9;", "VAR_15= VAR_27;", "}", "}", "}", "VAR_14=0;", "if(VAR_16 > VAR_6 && VAR_5){", "int VAR_35=0;", "int VAR_35= (VAR_5&1) ? VAR_4*VAR_21/2 : VAR_20/2;", "PutBitContext backup[6];", "for(VAR_12=VAR_5-1; VAR_12>=0; VAR_12--){", "backup[VAR_12]= VAR_0->reorder_pb[VAR_12];", "}", "VAR_35 += FUNC_0(VAR_0, VAR_1 , VAR_2 , VAR_3 , VAR_4, VAR_5-1, VAR_6>>1, VAR_7, VAR_8);", "VAR_35 += FUNC_0(VAR_0, VAR_1 + VAR_35, VAR_2 + VAR_35, VAR_3 + VAR_35, VAR_4, VAR_5-1, VAR_6>>1, VAR_7, VAR_8);", "VAR_35 += VAR_7;", "if(VAR_35 < VAR_16){", "VAR_16= VAR_35;", "VAR_14=1;", "}else{", "for(VAR_12=VAR_5-1; VAR_12>=0; VAR_12--){", "VAR_0->reorder_pb[VAR_12]= backup[VAR_12];", "}", "}", "}", "if (VAR_5 > 0)\nput_bits(&VAR_0->reorder_pb[VAR_5], 1, VAR_14);", "if(!VAR_14){", "assert((VAR_15 >= 0 && VAR_15<256) || !VAR_8);", "assert(VAR_15 >= -256 && VAR_15<256);", "assert(VAR_17 >=0 && VAR_17<7);", "assert(VAR_5<4 || VAR_17==0);", "put_bits(&VAR_0->reorder_pb[VAR_5],\nmultistage_vlc[1 + VAR_17][1],\nmultistage_vlc[1 + VAR_17][0]);", "put_bits(&VAR_0->reorder_pb[VAR_5], mean_vlc[VAR_15][1],\nmean_vlc[VAR_15][0]);", "for (VAR_12 = 0; VAR_12 < VAR_17; VAR_12++){", "assert(VAR_18[VAR_12]>=0 && VAR_18[VAR_12]<16);", "put_bits(&VAR_0->reorder_pb[VAR_5], 4, VAR_18[VAR_12]);", "}", "for(VAR_10=0; VAR_10<VAR_21; VAR_10++){", "for(VAR_11=0; VAR_11<VAR_20; VAR_11++){", "VAR_3[VAR_11 + VAR_10*VAR_4]= VAR_1[VAR_11 + VAR_10*VAR_4] - block[VAR_17][VAR_11 + VAR_20*VAR_10] + VAR_15;", "}", "}", "}", "return VAR_16;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 85 ], [ 87 ], [ 89 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 107 ], [ 109 ], [ 111 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155, 157, 159, 161 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225, 227 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 245, 247, 249 ], [ 251, 253 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277 ], [ 281 ], [ 283 ] ]
5,550
void object_property_set_link(Object *obj, Object *value, const char *name, Error **errp) { object_property_set_str(obj, object_get_canonical_path(value), name, errp); }
true
qemu
2d3aa28cc2cf382aa04cd577e0be542175eea9bd
void object_property_set_link(Object *obj, Object *value, const char *name, Error **errp) { object_property_set_str(obj, object_get_canonical_path(value), name, errp); }
{ "code": [ " object_property_set_str(obj, object_get_canonical_path(value),", " name, errp);" ], "line_no": [ 7, 9 ] }
void FUNC_0(Object *VAR_0, Object *VAR_1, const char *VAR_2, Error **VAR_3) { object_property_set_str(VAR_0, object_get_canonical_path(VAR_1), VAR_2, VAR_3); }
[ "void FUNC_0(Object *VAR_0, Object *VAR_1,\nconst char *VAR_2, Error **VAR_3)\n{", "object_property_set_str(VAR_0, object_get_canonical_path(VAR_1),\nVAR_2, VAR_3);", "}" ]
[ 0, 1, 0 ]
[ [ 1, 3, 5 ], [ 7, 9 ], [ 11 ] ]
5,551
static int qcow2_cache_entry_flush(BlockDriverState *bs, Qcow2Cache *c, int i) { BDRVQcowState *s = bs->opaque; int ret = 0; if (!c->entries[i].dirty || !c->entries[i].offset) { return 0; } trace_qcow2_cache_entry_flush(qemu_coroutine_self(), c == s->l2_table_cache, i); if (c->depends) { ret = qcow2_cache_flush_dependency(bs, c); } else if (c->depends_on_flush) { ret = bdrv_flush(bs->file); if (ret >= 0) { c->depends_on_flush = false; } } if (ret < 0) { return ret; } if (c == s->refcount_block_cache) { ret = qcow2_pre_write_overlap_check(bs, QCOW2_OL_DEFAULT & ~QCOW2_OL_REFCOUNT_BLOCK, c->entries[i].offset, s->cluster_size); } else if (c == s->l2_table_cache) { ret = qcow2_pre_write_overlap_check(bs, QCOW2_OL_DEFAULT & ~QCOW2_OL_ACTIVE_L2, c->entries[i].offset, s->cluster_size); } else { ret = qcow2_pre_write_overlap_check(bs, QCOW2_OL_DEFAULT, c->entries[i].offset, s->cluster_size); } if (ret < 0) { return ret; } if (c == s->refcount_block_cache) { BLKDBG_EVENT(bs->file, BLKDBG_REFBLOCK_UPDATE_PART); } else if (c == s->l2_table_cache) { BLKDBG_EVENT(bs->file, BLKDBG_L2_UPDATE); } ret = bdrv_pwrite(bs->file, c->entries[i].offset, c->entries[i].table, s->cluster_size); if (ret < 0) { return ret; } c->entries[i].dirty = false; return 0; }
true
qemu
231bb267644ee3a9ebfd9c7f42d5d41610194b45
static int qcow2_cache_entry_flush(BlockDriverState *bs, Qcow2Cache *c, int i) { BDRVQcowState *s = bs->opaque; int ret = 0; if (!c->entries[i].dirty || !c->entries[i].offset) { return 0; } trace_qcow2_cache_entry_flush(qemu_coroutine_self(), c == s->l2_table_cache, i); if (c->depends) { ret = qcow2_cache_flush_dependency(bs, c); } else if (c->depends_on_flush) { ret = bdrv_flush(bs->file); if (ret >= 0) { c->depends_on_flush = false; } } if (ret < 0) { return ret; } if (c == s->refcount_block_cache) { ret = qcow2_pre_write_overlap_check(bs, QCOW2_OL_DEFAULT & ~QCOW2_OL_REFCOUNT_BLOCK, c->entries[i].offset, s->cluster_size); } else if (c == s->l2_table_cache) { ret = qcow2_pre_write_overlap_check(bs, QCOW2_OL_DEFAULT & ~QCOW2_OL_ACTIVE_L2, c->entries[i].offset, s->cluster_size); } else { ret = qcow2_pre_write_overlap_check(bs, QCOW2_OL_DEFAULT, c->entries[i].offset, s->cluster_size); } if (ret < 0) { return ret; } if (c == s->refcount_block_cache) { BLKDBG_EVENT(bs->file, BLKDBG_REFBLOCK_UPDATE_PART); } else if (c == s->l2_table_cache) { BLKDBG_EVENT(bs->file, BLKDBG_L2_UPDATE); } ret = bdrv_pwrite(bs->file, c->entries[i].offset, c->entries[i].table, s->cluster_size); if (ret < 0) { return ret; } c->entries[i].dirty = false; return 0; }
{ "code": [ " ret = qcow2_pre_write_overlap_check(bs,", " QCOW2_OL_DEFAULT & ~QCOW2_OL_REFCOUNT_BLOCK,", " ret = qcow2_pre_write_overlap_check(bs,", " QCOW2_OL_DEFAULT & ~QCOW2_OL_ACTIVE_L2,", " ret = qcow2_pre_write_overlap_check(bs, QCOW2_OL_DEFAULT,", " ret = qcow2_pre_write_overlap_check(bs, QCOW2_OL_DEFAULT,", " ret = qcow2_pre_write_overlap_check(bs, QCOW2_OL_DEFAULT," ], "line_no": [ 53, 55, 53, 63, 69, 69, 69 ] }
static int FUNC_0(BlockDriverState *VAR_0, Qcow2Cache *VAR_1, int VAR_2) { BDRVQcowState *s = VAR_0->opaque; int VAR_3 = 0; if (!VAR_1->entries[VAR_2].dirty || !VAR_1->entries[VAR_2].offset) { return 0; } trace_qcow2_cache_entry_flush(qemu_coroutine_self(), VAR_1 == s->l2_table_cache, VAR_2); if (VAR_1->depends) { VAR_3 = qcow2_cache_flush_dependency(VAR_0, VAR_1); } else if (VAR_1->depends_on_flush) { VAR_3 = bdrv_flush(VAR_0->file); if (VAR_3 >= 0) { VAR_1->depends_on_flush = false; } } if (VAR_3 < 0) { return VAR_3; } if (VAR_1 == s->refcount_block_cache) { VAR_3 = qcow2_pre_write_overlap_check(VAR_0, QCOW2_OL_DEFAULT & ~QCOW2_OL_REFCOUNT_BLOCK, VAR_1->entries[VAR_2].offset, s->cluster_size); } else if (VAR_1 == s->l2_table_cache) { VAR_3 = qcow2_pre_write_overlap_check(VAR_0, QCOW2_OL_DEFAULT & ~QCOW2_OL_ACTIVE_L2, VAR_1->entries[VAR_2].offset, s->cluster_size); } else { VAR_3 = qcow2_pre_write_overlap_check(VAR_0, QCOW2_OL_DEFAULT, VAR_1->entries[VAR_2].offset, s->cluster_size); } if (VAR_3 < 0) { return VAR_3; } if (VAR_1 == s->refcount_block_cache) { BLKDBG_EVENT(VAR_0->file, BLKDBG_REFBLOCK_UPDATE_PART); } else if (VAR_1 == s->l2_table_cache) { BLKDBG_EVENT(VAR_0->file, BLKDBG_L2_UPDATE); } VAR_3 = bdrv_pwrite(VAR_0->file, VAR_1->entries[VAR_2].offset, VAR_1->entries[VAR_2].table, s->cluster_size); if (VAR_3 < 0) { return VAR_3; } VAR_1->entries[VAR_2].dirty = false; return 0; }
[ "static int FUNC_0(BlockDriverState *VAR_0, Qcow2Cache *VAR_1, int VAR_2)\n{", "BDRVQcowState *s = VAR_0->opaque;", "int VAR_3 = 0;", "if (!VAR_1->entries[VAR_2].dirty || !VAR_1->entries[VAR_2].offset) {", "return 0;", "}", "trace_qcow2_cache_entry_flush(qemu_coroutine_self(),\nVAR_1 == s->l2_table_cache, VAR_2);", "if (VAR_1->depends) {", "VAR_3 = qcow2_cache_flush_dependency(VAR_0, VAR_1);", "} else if (VAR_1->depends_on_flush) {", "VAR_3 = bdrv_flush(VAR_0->file);", "if (VAR_3 >= 0) {", "VAR_1->depends_on_flush = false;", "}", "}", "if (VAR_3 < 0) {", "return VAR_3;", "}", "if (VAR_1 == s->refcount_block_cache) {", "VAR_3 = qcow2_pre_write_overlap_check(VAR_0,\nQCOW2_OL_DEFAULT & ~QCOW2_OL_REFCOUNT_BLOCK,\nVAR_1->entries[VAR_2].offset, s->cluster_size);", "} else if (VAR_1 == s->l2_table_cache) {", "VAR_3 = qcow2_pre_write_overlap_check(VAR_0,\nQCOW2_OL_DEFAULT & ~QCOW2_OL_ACTIVE_L2,\nVAR_1->entries[VAR_2].offset, s->cluster_size);", "} else {", "VAR_3 = qcow2_pre_write_overlap_check(VAR_0, QCOW2_OL_DEFAULT,\nVAR_1->entries[VAR_2].offset, s->cluster_size);", "}", "if (VAR_3 < 0) {", "return VAR_3;", "}", "if (VAR_1 == s->refcount_block_cache) {", "BLKDBG_EVENT(VAR_0->file, BLKDBG_REFBLOCK_UPDATE_PART);", "} else if (VAR_1 == s->l2_table_cache) {", "BLKDBG_EVENT(VAR_0->file, BLKDBG_L2_UPDATE);", "}", "VAR_3 = bdrv_pwrite(VAR_0->file, VAR_1->entries[VAR_2].offset, VAR_1->entries[VAR_2].table,\ns->cluster_size);", "if (VAR_3 < 0) {", "return VAR_3;", "}", "VAR_1->entries[VAR_2].dirty = false;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 19, 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53, 55, 57 ], [ 59 ], [ 61, 63, 65 ], [ 67 ], [ 69, 71 ], [ 73 ], [ 77 ], [ 79 ], [ 81 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 97, 99 ], [ 101 ], [ 103 ], [ 105 ], [ 109 ], [ 113 ], [ 115 ] ]
5,552
USBBus *usb_bus_new(DeviceState *host) { USBBus *bus; bus = FROM_QBUS(USBBus, qbus_create(&usb_bus_info, host, NULL)); bus->busnr = next_usb_bus++; TAILQ_INIT(&bus->free); TAILQ_INIT(&bus->used); TAILQ_INSERT_TAIL(&busses, bus, next); return bus; }
false
qemu
72cf2d4f0e181d0d3a3122e04129c58a95da713e
USBBus *usb_bus_new(DeviceState *host) { USBBus *bus; bus = FROM_QBUS(USBBus, qbus_create(&usb_bus_info, host, NULL)); bus->busnr = next_usb_bus++; TAILQ_INIT(&bus->free); TAILQ_INIT(&bus->used); TAILQ_INSERT_TAIL(&busses, bus, next); return bus; }
{ "code": [], "line_no": [] }
USBBus *FUNC_0(DeviceState *host) { USBBus *bus; bus = FROM_QBUS(USBBus, qbus_create(&usb_bus_info, host, NULL)); bus->busnr = next_usb_bus++; TAILQ_INIT(&bus->free); TAILQ_INIT(&bus->used); TAILQ_INSERT_TAIL(&busses, bus, next); return bus; }
[ "USBBus *FUNC_0(DeviceState *host)\n{", "USBBus *bus;", "bus = FROM_QBUS(USBBus, qbus_create(&usb_bus_info, host, NULL));", "bus->busnr = next_usb_bus++;", "TAILQ_INIT(&bus->free);", "TAILQ_INIT(&bus->used);", "TAILQ_INSERT_TAIL(&busses, bus, next);", "return bus;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
5,553
sPAPRTCETable *spapr_tce_new_table(DeviceState *owner, uint32_t liobn) { sPAPRTCETable *tcet; char tmp[32]; if (spapr_tce_find_by_liobn(liobn)) { error_report("Attempted to create TCE table with duplicate" " LIOBN 0x%x", liobn); return NULL; } tcet = SPAPR_TCE_TABLE(object_new(TYPE_SPAPR_TCE_TABLE)); tcet->liobn = liobn; snprintf(tmp, sizeof(tmp), "tce-table-%x", liobn); object_property_add_child(OBJECT(owner), tmp, OBJECT(tcet), NULL); object_property_set_bool(OBJECT(tcet), true, "realized", NULL); return tcet; }
false
qemu
a205a053dcfd89c7ab57aef48d26cd9349388933
sPAPRTCETable *spapr_tce_new_table(DeviceState *owner, uint32_t liobn) { sPAPRTCETable *tcet; char tmp[32]; if (spapr_tce_find_by_liobn(liobn)) { error_report("Attempted to create TCE table with duplicate" " LIOBN 0x%x", liobn); return NULL; } tcet = SPAPR_TCE_TABLE(object_new(TYPE_SPAPR_TCE_TABLE)); tcet->liobn = liobn; snprintf(tmp, sizeof(tmp), "tce-table-%x", liobn); object_property_add_child(OBJECT(owner), tmp, OBJECT(tcet), NULL); object_property_set_bool(OBJECT(tcet), true, "realized", NULL); return tcet; }
{ "code": [], "line_no": [] }
sPAPRTCETable *FUNC_0(DeviceState *owner, uint32_t liobn) { sPAPRTCETable *tcet; char VAR_0[32]; if (spapr_tce_find_by_liobn(liobn)) { error_report("Attempted to create TCE table with duplicate" " LIOBN 0x%x", liobn); return NULL; } tcet = SPAPR_TCE_TABLE(object_new(TYPE_SPAPR_TCE_TABLE)); tcet->liobn = liobn; snprintf(VAR_0, sizeof(VAR_0), "tce-table-%x", liobn); object_property_add_child(OBJECT(owner), VAR_0, OBJECT(tcet), NULL); object_property_set_bool(OBJECT(tcet), true, "realized", NULL); return tcet; }
[ "sPAPRTCETable *FUNC_0(DeviceState *owner, uint32_t liobn)\n{", "sPAPRTCETable *tcet;", "char VAR_0[32];", "if (spapr_tce_find_by_liobn(liobn)) {", "error_report(\"Attempted to create TCE table with duplicate\"\n\" LIOBN 0x%x\", liobn);", "return NULL;", "}", "tcet = SPAPR_TCE_TABLE(object_new(TYPE_SPAPR_TCE_TABLE));", "tcet->liobn = liobn;", "snprintf(VAR_0, sizeof(VAR_0), \"tce-table-%x\", liobn);", "object_property_add_child(OBJECT(owner), VAR_0, OBJECT(tcet), NULL);", "object_property_set_bool(OBJECT(tcet), true, \"realized\", NULL);", "return tcet;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 35 ], [ 39 ], [ 41 ] ]
5,554
bool arm_regime_using_lpae_format(CPUARMState *env, ARMMMUIdx mmu_idx) { return regime_using_lpae_format(env, mmu_idx); }
false
qemu
deb2db996cbb9470b39ae1e383791ef34c4eb3c2
bool arm_regime_using_lpae_format(CPUARMState *env, ARMMMUIdx mmu_idx) { return regime_using_lpae_format(env, mmu_idx); }
{ "code": [], "line_no": [] }
bool FUNC_0(CPUARMState *env, ARMMMUIdx mmu_idx) { return regime_using_lpae_format(env, mmu_idx); }
[ "bool FUNC_0(CPUARMState *env, ARMMMUIdx mmu_idx)\n{", "return regime_using_lpae_format(env, mmu_idx);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
5,555
static int usb_hub_initfn(USBDevice *dev) { USBHubState *s = DO_UPCAST(USBHubState, dev, dev); USBHubPort *port; int i; s->dev.speed = USB_SPEED_FULL; for (i = 0; i < NUM_PORTS; i++) { port = &s->ports[i]; usb_register_port(usb_bus_from_device(dev), &port->port, s, i, &s->dev, usb_hub_attach); port->wPortStatus = PORT_STAT_POWER; port->wPortChange = 0; } return 0; }
false
qemu
a980a065fb5e86d6dec337e6cb6ff432f1a143c9
static int usb_hub_initfn(USBDevice *dev) { USBHubState *s = DO_UPCAST(USBHubState, dev, dev); USBHubPort *port; int i; s->dev.speed = USB_SPEED_FULL; for (i = 0; i < NUM_PORTS; i++) { port = &s->ports[i]; usb_register_port(usb_bus_from_device(dev), &port->port, s, i, &s->dev, usb_hub_attach); port->wPortStatus = PORT_STAT_POWER; port->wPortChange = 0; } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(USBDevice *VAR_0) { USBHubState *s = DO_UPCAST(USBHubState, VAR_0, VAR_0); USBHubPort *port; int VAR_1; s->VAR_0.speed = USB_SPEED_FULL; for (VAR_1 = 0; VAR_1 < NUM_PORTS; VAR_1++) { port = &s->ports[VAR_1]; usb_register_port(usb_bus_from_device(VAR_0), &port->port, s, VAR_1, &s->VAR_0, usb_hub_attach); port->wPortStatus = PORT_STAT_POWER; port->wPortChange = 0; } return 0; }
[ "static int FUNC_0(USBDevice *VAR_0)\n{", "USBHubState *s = DO_UPCAST(USBHubState, VAR_0, VAR_0);", "USBHubPort *port;", "int VAR_1;", "s->VAR_0.speed = USB_SPEED_FULL;", "for (VAR_1 = 0; VAR_1 < NUM_PORTS; VAR_1++) {", "port = &s->ports[VAR_1];", "usb_register_port(usb_bus_from_device(VAR_0),\n&port->port, s, VAR_1, &s->VAR_0, usb_hub_attach);", "port->wPortStatus = PORT_STAT_POWER;", "port->wPortChange = 0;", "}", "return 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 ] ]
5,556
static void horizontal_filter(unsigned char *first_pixel, int stride, int *bounding_values) { unsigned char *end; int filter_value; for (end= first_pixel + 8*stride; first_pixel < end; first_pixel += stride) { filter_value = (first_pixel[-2] - first_pixel[ 1]) +3*(first_pixel[ 0] - first_pixel[-1]); filter_value = bounding_values[(filter_value + 4) >> 3]; first_pixel[-1] = clip_uint8(first_pixel[-1] + filter_value); first_pixel[ 0] = clip_uint8(first_pixel[ 0] - filter_value); } }
false
FFmpeg
1af5f60f6aafa5f2653e7ea7cd054b0a4f31c103
static void horizontal_filter(unsigned char *first_pixel, int stride, int *bounding_values) { unsigned char *end; int filter_value; for (end= first_pixel + 8*stride; first_pixel < end; first_pixel += stride) { filter_value = (first_pixel[-2] - first_pixel[ 1]) +3*(first_pixel[ 0] - first_pixel[-1]); filter_value = bounding_values[(filter_value + 4) >> 3]; first_pixel[-1] = clip_uint8(first_pixel[-1] + filter_value); first_pixel[ 0] = clip_uint8(first_pixel[ 0] - filter_value); } }
{ "code": [], "line_no": [] }
static void FUNC_0(unsigned char *VAR_0, int VAR_1, int *VAR_2) { unsigned char *VAR_3; int VAR_4; for (VAR_3= VAR_0 + 8*VAR_1; VAR_0 < VAR_3; VAR_0 += VAR_1) { VAR_4 = (VAR_0[-2] - VAR_0[ 1]) +3*(VAR_0[ 0] - VAR_0[-1]); VAR_4 = VAR_2[(VAR_4 + 4) >> 3]; VAR_0[-1] = clip_uint8(VAR_0[-1] + VAR_4); VAR_0[ 0] = clip_uint8(VAR_0[ 0] - VAR_4); } }
[ "static void FUNC_0(unsigned char *VAR_0, int VAR_1,\nint *VAR_2)\n{", "unsigned char *VAR_3;", "int VAR_4;", "for (VAR_3= VAR_0 + 8*VAR_1; VAR_0 < VAR_3; VAR_0 += VAR_1) {", "VAR_4 =\n(VAR_0[-2] - VAR_0[ 1])\n+3*(VAR_0[ 0] - VAR_0[-1]);", "VAR_4 = VAR_2[(VAR_4 + 4) >> 3];", "VAR_0[-1] = clip_uint8(VAR_0[-1] + VAR_4);", "VAR_0[ 0] = clip_uint8(VAR_0[ 0] - VAR_4);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15, 17, 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ] ]
5,557
build_dmar_q35(GArray *table_data, BIOSLinker *linker) { int dmar_start = table_data->len; AcpiTableDmar *dmar; AcpiDmarHardwareUnit *drhd; AcpiDmarRootPortATS *atsr; uint8_t dmar_flags = 0; X86IOMMUState *iommu = x86_iommu_get_default(); AcpiDmarDeviceScope *scope = NULL; /* Root complex IOAPIC use one path[0] only */ size_t ioapic_scope_size = sizeof(*scope) + sizeof(scope->path[0]); assert(iommu); if (iommu->intr_supported) { dmar_flags |= 0x1; /* Flags: 0x1: INT_REMAP */ } dmar = acpi_data_push(table_data, sizeof(*dmar)); dmar->host_address_width = VTD_HOST_ADDRESS_WIDTH - 1; dmar->flags = dmar_flags; /* DMAR Remapping Hardware Unit Definition structure */ drhd = acpi_data_push(table_data, sizeof(*drhd) + ioapic_scope_size); drhd->type = cpu_to_le16(ACPI_DMAR_TYPE_HARDWARE_UNIT); drhd->length = cpu_to_le16(sizeof(*drhd) + ioapic_scope_size); drhd->flags = ACPI_DMAR_INCLUDE_PCI_ALL; drhd->pci_segment = cpu_to_le16(0); drhd->address = cpu_to_le64(Q35_HOST_BRIDGE_IOMMU_ADDR); /* Scope definition for the root-complex IOAPIC. See VT-d spec * 8.3.1 (version Oct. 2014 or later). */ scope = &drhd->scope[0]; scope->entry_type = 0x03; /* Type: 0x03 for IOAPIC */ scope->length = ioapic_scope_size; scope->enumeration_id = ACPI_BUILD_IOAPIC_ID; scope->bus = Q35_PSEUDO_BUS_PLATFORM; scope->path[0].device = PCI_SLOT(Q35_PSEUDO_DEVFN_IOAPIC); scope->path[0].function = PCI_FUNC(Q35_PSEUDO_DEVFN_IOAPIC); if (iommu->dt_supported) { atsr = acpi_data_push(table_data, sizeof(*atsr)); atsr->type = cpu_to_le16(ACPI_DMAR_TYPE_ATSR); atsr->length = cpu_to_le16(sizeof(*atsr)); atsr->flags = ACPI_DMAR_ATSR_ALL_PORTS; atsr->pci_segment = cpu_to_le16(0); } build_header(linker, table_data, (void *)(table_data->data + dmar_start), "DMAR", table_data->len - dmar_start, 1, NULL, NULL); }
false
qemu
37f51384ae05bd50f83308339dbffa3e78404874
build_dmar_q35(GArray *table_data, BIOSLinker *linker) { int dmar_start = table_data->len; AcpiTableDmar *dmar; AcpiDmarHardwareUnit *drhd; AcpiDmarRootPortATS *atsr; uint8_t dmar_flags = 0; X86IOMMUState *iommu = x86_iommu_get_default(); AcpiDmarDeviceScope *scope = NULL; size_t ioapic_scope_size = sizeof(*scope) + sizeof(scope->path[0]); assert(iommu); if (iommu->intr_supported) { dmar_flags |= 0x1; } dmar = acpi_data_push(table_data, sizeof(*dmar)); dmar->host_address_width = VTD_HOST_ADDRESS_WIDTH - 1; dmar->flags = dmar_flags; drhd = acpi_data_push(table_data, sizeof(*drhd) + ioapic_scope_size); drhd->type = cpu_to_le16(ACPI_DMAR_TYPE_HARDWARE_UNIT); drhd->length = cpu_to_le16(sizeof(*drhd) + ioapic_scope_size); drhd->flags = ACPI_DMAR_INCLUDE_PCI_ALL; drhd->pci_segment = cpu_to_le16(0); drhd->address = cpu_to_le64(Q35_HOST_BRIDGE_IOMMU_ADDR); scope = &drhd->scope[0]; scope->entry_type = 0x03; scope->length = ioapic_scope_size; scope->enumeration_id = ACPI_BUILD_IOAPIC_ID; scope->bus = Q35_PSEUDO_BUS_PLATFORM; scope->path[0].device = PCI_SLOT(Q35_PSEUDO_DEVFN_IOAPIC); scope->path[0].function = PCI_FUNC(Q35_PSEUDO_DEVFN_IOAPIC); if (iommu->dt_supported) { atsr = acpi_data_push(table_data, sizeof(*atsr)); atsr->type = cpu_to_le16(ACPI_DMAR_TYPE_ATSR); atsr->length = cpu_to_le16(sizeof(*atsr)); atsr->flags = ACPI_DMAR_ATSR_ALL_PORTS; atsr->pci_segment = cpu_to_le16(0); } build_header(linker, table_data, (void *)(table_data->data + dmar_start), "DMAR", table_data->len - dmar_start, 1, NULL, NULL); }
{ "code": [], "line_no": [] }
FUNC_0(GArray *VAR_0, BIOSLinker *VAR_1) { int VAR_2 = VAR_0->len; AcpiTableDmar *dmar; AcpiDmarHardwareUnit *drhd; AcpiDmarRootPortATS *atsr; uint8_t dmar_flags = 0; X86IOMMUState *iommu = x86_iommu_get_default(); AcpiDmarDeviceScope *scope = NULL; size_t ioapic_scope_size = sizeof(*scope) + sizeof(scope->path[0]); assert(iommu); if (iommu->intr_supported) { dmar_flags |= 0x1; } dmar = acpi_data_push(VAR_0, sizeof(*dmar)); dmar->host_address_width = VTD_HOST_ADDRESS_WIDTH - 1; dmar->flags = dmar_flags; drhd = acpi_data_push(VAR_0, sizeof(*drhd) + ioapic_scope_size); drhd->type = cpu_to_le16(ACPI_DMAR_TYPE_HARDWARE_UNIT); drhd->length = cpu_to_le16(sizeof(*drhd) + ioapic_scope_size); drhd->flags = ACPI_DMAR_INCLUDE_PCI_ALL; drhd->pci_segment = cpu_to_le16(0); drhd->address = cpu_to_le64(Q35_HOST_BRIDGE_IOMMU_ADDR); scope = &drhd->scope[0]; scope->entry_type = 0x03; scope->length = ioapic_scope_size; scope->enumeration_id = ACPI_BUILD_IOAPIC_ID; scope->bus = Q35_PSEUDO_BUS_PLATFORM; scope->path[0].device = PCI_SLOT(Q35_PSEUDO_DEVFN_IOAPIC); scope->path[0].function = PCI_FUNC(Q35_PSEUDO_DEVFN_IOAPIC); if (iommu->dt_supported) { atsr = acpi_data_push(VAR_0, sizeof(*atsr)); atsr->type = cpu_to_le16(ACPI_DMAR_TYPE_ATSR); atsr->length = cpu_to_le16(sizeof(*atsr)); atsr->flags = ACPI_DMAR_ATSR_ALL_PORTS; atsr->pci_segment = cpu_to_le16(0); } build_header(VAR_1, VAR_0, (void *)(VAR_0->data + VAR_2), "DMAR", VAR_0->len - VAR_2, 1, NULL, NULL); }
[ "FUNC_0(GArray *VAR_0, BIOSLinker *VAR_1)\n{", "int VAR_2 = VAR_0->len;", "AcpiTableDmar *dmar;", "AcpiDmarHardwareUnit *drhd;", "AcpiDmarRootPortATS *atsr;", "uint8_t dmar_flags = 0;", "X86IOMMUState *iommu = x86_iommu_get_default();", "AcpiDmarDeviceScope *scope = NULL;", "size_t ioapic_scope_size = sizeof(*scope) + sizeof(scope->path[0]);", "assert(iommu);", "if (iommu->intr_supported) {", "dmar_flags |= 0x1;", "}", "dmar = acpi_data_push(VAR_0, sizeof(*dmar));", "dmar->host_address_width = VTD_HOST_ADDRESS_WIDTH - 1;", "dmar->flags = dmar_flags;", "drhd = acpi_data_push(VAR_0, sizeof(*drhd) + ioapic_scope_size);", "drhd->type = cpu_to_le16(ACPI_DMAR_TYPE_HARDWARE_UNIT);", "drhd->length = cpu_to_le16(sizeof(*drhd) + ioapic_scope_size);", "drhd->flags = ACPI_DMAR_INCLUDE_PCI_ALL;", "drhd->pci_segment = cpu_to_le16(0);", "drhd->address = cpu_to_le64(Q35_HOST_BRIDGE_IOMMU_ADDR);", "scope = &drhd->scope[0];", "scope->entry_type = 0x03;", "scope->length = ioapic_scope_size;", "scope->enumeration_id = ACPI_BUILD_IOAPIC_ID;", "scope->bus = Q35_PSEUDO_BUS_PLATFORM;", "scope->path[0].device = PCI_SLOT(Q35_PSEUDO_DEVFN_IOAPIC);", "scope->path[0].function = PCI_FUNC(Q35_PSEUDO_DEVFN_IOAPIC);", "if (iommu->dt_supported) {", "atsr = acpi_data_push(VAR_0, sizeof(*atsr));", "atsr->type = cpu_to_le16(ACPI_DMAR_TYPE_ATSR);", "atsr->length = cpu_to_le16(sizeof(*atsr));", "atsr->flags = ACPI_DMAR_ATSR_ALL_PORTS;", "atsr->pci_segment = cpu_to_le16(0);", "}", "build_header(VAR_1, VAR_0, (void *)(VAR_0->data + VAR_2),\n\"DMAR\", VAR_0->len - VAR_2, 1, NULL, NULL);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 97, 99 ], [ 101 ] ]
5,558
static void spapr_dr_connector_class_init(ObjectClass *k, void *data) { DeviceClass *dk = DEVICE_CLASS(k); sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_CLASS(k); dk->reset = reset; dk->realize = realize; dk->unrealize = unrealize; drck->set_isolation_state = set_isolation_state; drck->set_allocation_state = set_allocation_state; drck->release_pending = release_pending; drck->set_signalled = set_signalled; /* * Reason: it crashes FIXME find and document the real reason */ dk->user_creatable = false; }
false
qemu
307b7715d0256c95444cada36a02882e46bada2f
static void spapr_dr_connector_class_init(ObjectClass *k, void *data) { DeviceClass *dk = DEVICE_CLASS(k); sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_CLASS(k); dk->reset = reset; dk->realize = realize; dk->unrealize = unrealize; drck->set_isolation_state = set_isolation_state; drck->set_allocation_state = set_allocation_state; drck->release_pending = release_pending; drck->set_signalled = set_signalled; dk->user_creatable = false; }
{ "code": [], "line_no": [] }
static void FUNC_0(ObjectClass *VAR_0, void *VAR_1) { DeviceClass *dk = DEVICE_CLASS(VAR_0); sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_CLASS(VAR_0); dk->reset = reset; dk->realize = realize; dk->unrealize = unrealize; drck->set_isolation_state = set_isolation_state; drck->set_allocation_state = set_allocation_state; drck->release_pending = release_pending; drck->set_signalled = set_signalled; dk->user_creatable = false; }
[ "static void FUNC_0(ObjectClass *VAR_0, void *VAR_1)\n{", "DeviceClass *dk = DEVICE_CLASS(VAR_0);", "sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_CLASS(VAR_0);", "dk->reset = reset;", "dk->realize = realize;", "dk->unrealize = unrealize;", "drck->set_isolation_state = set_isolation_state;", "drck->set_allocation_state = set_allocation_state;", "drck->release_pending = release_pending;", "drck->set_signalled = set_signalled;", "dk->user_creatable = false;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 31 ], [ 33 ] ]
5,559
static void smbios_validate_table(void) { if (smbios_type4_count && smbios_type4_count != smp_cpus) { fprintf(stderr, "Number of SMBIOS Type 4 tables must match cpu count.\n"); exit(1); } }
false
qemu
5bb95e41868b461f37159efb48908828ebd7ab36
static void smbios_validate_table(void) { if (smbios_type4_count && smbios_type4_count != smp_cpus) { fprintf(stderr, "Number of SMBIOS Type 4 tables must match cpu count.\n"); exit(1); } }
{ "code": [], "line_no": [] }
static void FUNC_0(void) { if (smbios_type4_count && smbios_type4_count != smp_cpus) { fprintf(stderr, "Number of SMBIOS Type 4 tables must match cpu count.\n"); exit(1); } }
[ "static void FUNC_0(void)\n{", "if (smbios_type4_count && smbios_type4_count != smp_cpus) {", "fprintf(stderr,\n\"Number of SMBIOS Type 4 tables must match cpu count.\\n\");", "exit(1);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 11 ], [ 13 ], [ 15 ] ]
5,560
static int xen_pt_bar_reg_write(XenPCIPassthroughState *s, XenPTReg *cfg_entry, uint32_t *val, uint32_t dev_value, uint32_t valid_mask) { XenPTRegInfo *reg = cfg_entry->reg; XenPTRegion *base = NULL; PCIDevice *d = &s->dev; const PCIIORegion *r; uint32_t writable_mask = 0; uint32_t bar_emu_mask = 0; uint32_t bar_ro_mask = 0; uint32_t r_size = 0; int index = 0; index = xen_pt_bar_offset_to_index(reg->offset); if (index < 0 || index >= PCI_NUM_REGIONS) { XEN_PT_ERR(d, "Internal error: Invalid BAR index [%d].\n", index); return -1; } r = &d->io_regions[index]; base = &s->bases[index]; r_size = xen_pt_get_emul_size(base->bar_flag, r->size); /* set emulate mask and read-only mask values depend on the BAR flag */ switch (s->bases[index].bar_flag) { case XEN_PT_BAR_FLAG_MEM: bar_emu_mask = XEN_PT_BAR_MEM_EMU_MASK; if (!r_size) { /* low 32 bits mask for 64 bit bars */ bar_ro_mask = XEN_PT_BAR_ALLF; } else { bar_ro_mask = XEN_PT_BAR_MEM_RO_MASK | (r_size - 1); } break; case XEN_PT_BAR_FLAG_IO: bar_emu_mask = XEN_PT_BAR_IO_EMU_MASK; bar_ro_mask = XEN_PT_BAR_IO_RO_MASK | (r_size - 1); break; case XEN_PT_BAR_FLAG_UPPER: bar_emu_mask = XEN_PT_BAR_ALLF; bar_ro_mask = r_size ? r_size - 1 : 0; break; default: break; } /* modify emulate register */ writable_mask = bar_emu_mask & ~bar_ro_mask & valid_mask; cfg_entry->data = XEN_PT_MERGE_VALUE(*val, cfg_entry->data, writable_mask); /* check whether we need to update the virtual region address or not */ switch (s->bases[index].bar_flag) { case XEN_PT_BAR_FLAG_UPPER: case XEN_PT_BAR_FLAG_MEM: /* nothing to do */ break; case XEN_PT_BAR_FLAG_IO: /* nothing to do */ break; default: break; } /* create value for writing to I/O device register */ *val = XEN_PT_MERGE_VALUE(*val, dev_value, 0); return 0; }
false
qemu
e2779de053b64f023de382fd87b3596613d47d1e
static int xen_pt_bar_reg_write(XenPCIPassthroughState *s, XenPTReg *cfg_entry, uint32_t *val, uint32_t dev_value, uint32_t valid_mask) { XenPTRegInfo *reg = cfg_entry->reg; XenPTRegion *base = NULL; PCIDevice *d = &s->dev; const PCIIORegion *r; uint32_t writable_mask = 0; uint32_t bar_emu_mask = 0; uint32_t bar_ro_mask = 0; uint32_t r_size = 0; int index = 0; index = xen_pt_bar_offset_to_index(reg->offset); if (index < 0 || index >= PCI_NUM_REGIONS) { XEN_PT_ERR(d, "Internal error: Invalid BAR index [%d].\n", index); return -1; } r = &d->io_regions[index]; base = &s->bases[index]; r_size = xen_pt_get_emul_size(base->bar_flag, r->size); switch (s->bases[index].bar_flag) { case XEN_PT_BAR_FLAG_MEM: bar_emu_mask = XEN_PT_BAR_MEM_EMU_MASK; if (!r_size) { bar_ro_mask = XEN_PT_BAR_ALLF; } else { bar_ro_mask = XEN_PT_BAR_MEM_RO_MASK | (r_size - 1); } break; case XEN_PT_BAR_FLAG_IO: bar_emu_mask = XEN_PT_BAR_IO_EMU_MASK; bar_ro_mask = XEN_PT_BAR_IO_RO_MASK | (r_size - 1); break; case XEN_PT_BAR_FLAG_UPPER: bar_emu_mask = XEN_PT_BAR_ALLF; bar_ro_mask = r_size ? r_size - 1 : 0; break; default: break; } writable_mask = bar_emu_mask & ~bar_ro_mask & valid_mask; cfg_entry->data = XEN_PT_MERGE_VALUE(*val, cfg_entry->data, writable_mask); switch (s->bases[index].bar_flag) { case XEN_PT_BAR_FLAG_UPPER: case XEN_PT_BAR_FLAG_MEM: break; case XEN_PT_BAR_FLAG_IO: break; default: break; } *val = XEN_PT_MERGE_VALUE(*val, dev_value, 0); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(XenPCIPassthroughState *VAR_0, XenPTReg *VAR_1, uint32_t *VAR_2, uint32_t VAR_3, uint32_t VAR_4) { XenPTRegInfo *reg = VAR_1->reg; XenPTRegion *base = NULL; PCIDevice *d = &VAR_0->dev; const PCIIORegion *VAR_5; uint32_t writable_mask = 0; uint32_t bar_emu_mask = 0; uint32_t bar_ro_mask = 0; uint32_t r_size = 0; int VAR_6 = 0; VAR_6 = xen_pt_bar_offset_to_index(reg->offset); if (VAR_6 < 0 || VAR_6 >= PCI_NUM_REGIONS) { XEN_PT_ERR(d, "Internal error: Invalid BAR VAR_6 [%d].\n", VAR_6); return -1; } VAR_5 = &d->io_regions[VAR_6]; base = &VAR_0->bases[VAR_6]; r_size = xen_pt_get_emul_size(base->bar_flag, VAR_5->size); switch (VAR_0->bases[VAR_6].bar_flag) { case XEN_PT_BAR_FLAG_MEM: bar_emu_mask = XEN_PT_BAR_MEM_EMU_MASK; if (!r_size) { bar_ro_mask = XEN_PT_BAR_ALLF; } else { bar_ro_mask = XEN_PT_BAR_MEM_RO_MASK | (r_size - 1); } break; case XEN_PT_BAR_FLAG_IO: bar_emu_mask = XEN_PT_BAR_IO_EMU_MASK; bar_ro_mask = XEN_PT_BAR_IO_RO_MASK | (r_size - 1); break; case XEN_PT_BAR_FLAG_UPPER: bar_emu_mask = XEN_PT_BAR_ALLF; bar_ro_mask = r_size ? r_size - 1 : 0; break; default: break; } writable_mask = bar_emu_mask & ~bar_ro_mask & VAR_4; VAR_1->data = XEN_PT_MERGE_VALUE(*VAR_2, VAR_1->data, writable_mask); switch (VAR_0->bases[VAR_6].bar_flag) { case XEN_PT_BAR_FLAG_UPPER: case XEN_PT_BAR_FLAG_MEM: break; case XEN_PT_BAR_FLAG_IO: break; default: break; } *VAR_2 = XEN_PT_MERGE_VALUE(*VAR_2, VAR_3, 0); return 0; }
[ "static int FUNC_0(XenPCIPassthroughState *VAR_0, XenPTReg *VAR_1,\nuint32_t *VAR_2, uint32_t VAR_3,\nuint32_t VAR_4)\n{", "XenPTRegInfo *reg = VAR_1->reg;", "XenPTRegion *base = NULL;", "PCIDevice *d = &VAR_0->dev;", "const PCIIORegion *VAR_5;", "uint32_t writable_mask = 0;", "uint32_t bar_emu_mask = 0;", "uint32_t bar_ro_mask = 0;", "uint32_t r_size = 0;", "int VAR_6 = 0;", "VAR_6 = xen_pt_bar_offset_to_index(reg->offset);", "if (VAR_6 < 0 || VAR_6 >= PCI_NUM_REGIONS) {", "XEN_PT_ERR(d, \"Internal error: Invalid BAR VAR_6 [%d].\\n\", VAR_6);", "return -1;", "}", "VAR_5 = &d->io_regions[VAR_6];", "base = &VAR_0->bases[VAR_6];", "r_size = xen_pt_get_emul_size(base->bar_flag, VAR_5->size);", "switch (VAR_0->bases[VAR_6].bar_flag) {", "case XEN_PT_BAR_FLAG_MEM:\nbar_emu_mask = XEN_PT_BAR_MEM_EMU_MASK;", "if (!r_size) {", "bar_ro_mask = XEN_PT_BAR_ALLF;", "} else {", "bar_ro_mask = XEN_PT_BAR_MEM_RO_MASK | (r_size - 1);", "}", "break;", "case XEN_PT_BAR_FLAG_IO:\nbar_emu_mask = XEN_PT_BAR_IO_EMU_MASK;", "bar_ro_mask = XEN_PT_BAR_IO_RO_MASK | (r_size - 1);", "break;", "case XEN_PT_BAR_FLAG_UPPER:\nbar_emu_mask = XEN_PT_BAR_ALLF;", "bar_ro_mask = r_size ? r_size - 1 : 0;", "break;", "default:\nbreak;", "}", "writable_mask = bar_emu_mask & ~bar_ro_mask & VAR_4;", "VAR_1->data = XEN_PT_MERGE_VALUE(*VAR_2, VAR_1->data, writable_mask);", "switch (VAR_0->bases[VAR_6].bar_flag) {", "case XEN_PT_BAR_FLAG_UPPER:\ncase XEN_PT_BAR_FLAG_MEM:\nbreak;", "case XEN_PT_BAR_FLAG_IO:\nbreak;", "default:\nbreak;", "}", "*VAR_2 = XEN_PT_MERGE_VALUE(*VAR_2, VAR_3, 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 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 51 ], [ 53, 55 ], [ 57 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71, 73 ], [ 75 ], [ 77 ], [ 79, 81 ], [ 83 ], [ 85 ], [ 87, 89 ], [ 91 ], [ 97 ], [ 99 ], [ 105 ], [ 107, 109, 113 ], [ 115, 119 ], [ 121, 123 ], [ 125 ], [ 131 ], [ 135 ], [ 137 ] ]
5,561
static void v9fs_write(void *opaque) { ssize_t err; int32_t fid; uint64_t off; uint32_t count; int32_t len = 0; int32_t total = 0; size_t offset = 7; V9fsFidState *fidp; V9fsPDU *pdu = opaque; V9fsState *s = pdu->s; QEMUIOVector qiov_full; QEMUIOVector qiov; offset += pdu_unmarshal(pdu, offset, "dqd", &fid, &off, &count); v9fs_init_qiov_from_pdu(&qiov_full, pdu, offset, count, true); trace_v9fs_write(pdu->tag, pdu->id, fid, off, count, qiov_full.niov); fidp = get_fid(pdu, fid); if (fidp == NULL) { err = -EINVAL; goto out_nofid; } if (fidp->fid_type == P9_FID_FILE) { if (fidp->fs.fd == -1) { err = -EINVAL; goto out; } } else if (fidp->fid_type == P9_FID_XATTR) { /* * setxattr operation */ err = v9fs_xattr_write(s, pdu, fidp, off, count, qiov_full.iov, qiov_full.niov); goto out; } else { err = -EINVAL; goto out; } qemu_iovec_init(&qiov, qiov_full.niov); do { qemu_iovec_reset(&qiov); qemu_iovec_copy(&qiov, &qiov_full, total, qiov_full.size - total); if (0) { print_sg(qiov.iov, qiov.niov); } /* Loop in case of EINTR */ do { len = v9fs_co_pwritev(pdu, fidp, qiov.iov, qiov.niov, off); if (len >= 0) { off += len; total += len; } } while (len == -EINTR && !pdu->cancelled); if (len < 0) { /* IO error return the error */ err = len; goto out_qiov; } } while (total < count && len > 0); offset = 7; offset += pdu_marshal(pdu, offset, "d", total); err = offset; trace_v9fs_write_return(pdu->tag, pdu->id, total, err); out_qiov: qemu_iovec_destroy(&qiov); out: put_fid(pdu, fidp); out_nofid: qemu_iovec_destroy(&qiov_full); complete_pdu(s, pdu, err); }
false
qemu
ddca7f86ac022289840e0200fd4050b2b58e9176
static void v9fs_write(void *opaque) { ssize_t err; int32_t fid; uint64_t off; uint32_t count; int32_t len = 0; int32_t total = 0; size_t offset = 7; V9fsFidState *fidp; V9fsPDU *pdu = opaque; V9fsState *s = pdu->s; QEMUIOVector qiov_full; QEMUIOVector qiov; offset += pdu_unmarshal(pdu, offset, "dqd", &fid, &off, &count); v9fs_init_qiov_from_pdu(&qiov_full, pdu, offset, count, true); trace_v9fs_write(pdu->tag, pdu->id, fid, off, count, qiov_full.niov); fidp = get_fid(pdu, fid); if (fidp == NULL) { err = -EINVAL; goto out_nofid; } if (fidp->fid_type == P9_FID_FILE) { if (fidp->fs.fd == -1) { err = -EINVAL; goto out; } } else if (fidp->fid_type == P9_FID_XATTR) { err = v9fs_xattr_write(s, pdu, fidp, off, count, qiov_full.iov, qiov_full.niov); goto out; } else { err = -EINVAL; goto out; } qemu_iovec_init(&qiov, qiov_full.niov); do { qemu_iovec_reset(&qiov); qemu_iovec_copy(&qiov, &qiov_full, total, qiov_full.size - total); if (0) { print_sg(qiov.iov, qiov.niov); } do { len = v9fs_co_pwritev(pdu, fidp, qiov.iov, qiov.niov, off); if (len >= 0) { off += len; total += len; } } while (len == -EINTR && !pdu->cancelled); if (len < 0) { err = len; goto out_qiov; } } while (total < count && len > 0); offset = 7; offset += pdu_marshal(pdu, offset, "d", total); err = offset; trace_v9fs_write_return(pdu->tag, pdu->id, total, err); out_qiov: qemu_iovec_destroy(&qiov); out: put_fid(pdu, fidp); out_nofid: qemu_iovec_destroy(&qiov_full); complete_pdu(s, pdu, err); }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0) { ssize_t err; int32_t fid; uint64_t off; uint32_t count; int32_t len = 0; int32_t total = 0; size_t offset = 7; V9fsFidState *fidp; V9fsPDU *pdu = VAR_0; V9fsState *s = pdu->s; QEMUIOVector qiov_full; QEMUIOVector qiov; offset += pdu_unmarshal(pdu, offset, "dqd", &fid, &off, &count); v9fs_init_qiov_from_pdu(&qiov_full, pdu, offset, count, true); trace_v9fs_write(pdu->tag, pdu->id, fid, off, count, qiov_full.niov); fidp = get_fid(pdu, fid); if (fidp == NULL) { err = -EINVAL; goto out_nofid; } if (fidp->fid_type == P9_FID_FILE) { if (fidp->fs.fd == -1) { err = -EINVAL; goto out; } } else if (fidp->fid_type == P9_FID_XATTR) { err = v9fs_xattr_write(s, pdu, fidp, off, count, qiov_full.iov, qiov_full.niov); goto out; } else { err = -EINVAL; goto out; } qemu_iovec_init(&qiov, qiov_full.niov); do { qemu_iovec_reset(&qiov); qemu_iovec_copy(&qiov, &qiov_full, total, qiov_full.size - total); if (0) { print_sg(qiov.iov, qiov.niov); } do { len = v9fs_co_pwritev(pdu, fidp, qiov.iov, qiov.niov, off); if (len >= 0) { off += len; total += len; } } while (len == -EINTR && !pdu->cancelled); if (len < 0) { err = len; goto out_qiov; } } while (total < count && len > 0); offset = 7; offset += pdu_marshal(pdu, offset, "d", total); err = offset; trace_v9fs_write_return(pdu->tag, pdu->id, total, err); out_qiov: qemu_iovec_destroy(&qiov); out: put_fid(pdu, fidp); out_nofid: qemu_iovec_destroy(&qiov_full); complete_pdu(s, pdu, err); }
[ "static void FUNC_0(void *VAR_0)\n{", "ssize_t err;", "int32_t fid;", "uint64_t off;", "uint32_t count;", "int32_t len = 0;", "int32_t total = 0;", "size_t offset = 7;", "V9fsFidState *fidp;", "V9fsPDU *pdu = VAR_0;", "V9fsState *s = pdu->s;", "QEMUIOVector qiov_full;", "QEMUIOVector qiov;", "offset += pdu_unmarshal(pdu, offset, \"dqd\", &fid, &off, &count);", "v9fs_init_qiov_from_pdu(&qiov_full, pdu, offset, count, true);", "trace_v9fs_write(pdu->tag, pdu->id, fid, off, count, qiov_full.niov);", "fidp = get_fid(pdu, fid);", "if (fidp == NULL) {", "err = -EINVAL;", "goto out_nofid;", "}", "if (fidp->fid_type == P9_FID_FILE) {", "if (fidp->fs.fd == -1) {", "err = -EINVAL;", "goto out;", "}", "} else if (fidp->fid_type == P9_FID_XATTR) {", "err = v9fs_xattr_write(s, pdu, fidp, off, count,\nqiov_full.iov, qiov_full.niov);", "goto out;", "} else {", "err = -EINVAL;", "goto out;", "}", "qemu_iovec_init(&qiov, qiov_full.niov);", "do {", "qemu_iovec_reset(&qiov);", "qemu_iovec_copy(&qiov, &qiov_full, total, qiov_full.size - total);", "if (0) {", "print_sg(qiov.iov, qiov.niov);", "}", "do {", "len = v9fs_co_pwritev(pdu, fidp, qiov.iov, qiov.niov, off);", "if (len >= 0) {", "off += len;", "total += len;", "}", "} while (len == -EINTR && !pdu->cancelled);", "if (len < 0) {", "err = len;", "goto out_qiov;", "}", "} while (total < count && len > 0);", "offset = 7;", "offset += pdu_marshal(pdu, offset, \"d\", total);", "err = offset;", "trace_v9fs_write_return(pdu->tag, pdu->id, total, err);", "out_qiov:\nqemu_iovec_destroy(&qiov);", "out:\nput_fid(pdu, fidp);", "out_nofid:\nqemu_iovec_destroy(&qiov_full);", "complete_pdu(s, pdu, err);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 67, 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133, 135 ], [ 137, 139 ], [ 141, 143 ], [ 145 ], [ 147 ] ]
5,562
void machine_register_compat_props(MachineState *machine) { MachineClass *mc = MACHINE_GET_CLASS(machine); int i; GlobalProperty *p; if (!mc->compat_props) { return; } for (i = 0; i < mc->compat_props->len; i++) { p = g_array_index(mc->compat_props, GlobalProperty *, i); /* Machine compat_props must never cause errors: */ p->errp = &error_abort; qdev_prop_register_global(p); } }
false
qemu
0bcba41fe379e4c6834adcf1456d9099db31a5b2
void machine_register_compat_props(MachineState *machine) { MachineClass *mc = MACHINE_GET_CLASS(machine); int i; GlobalProperty *p; if (!mc->compat_props) { return; } for (i = 0; i < mc->compat_props->len; i++) { p = g_array_index(mc->compat_props, GlobalProperty *, i); p->errp = &error_abort; qdev_prop_register_global(p); } }
{ "code": [], "line_no": [] }
void FUNC_0(MachineState *VAR_0) { MachineClass *mc = MACHINE_GET_CLASS(VAR_0); int VAR_1; GlobalProperty *p; if (!mc->compat_props) { return; } for (VAR_1 = 0; VAR_1 < mc->compat_props->len; VAR_1++) { p = g_array_index(mc->compat_props, GlobalProperty *, VAR_1); p->errp = &error_abort; qdev_prop_register_global(p); } }
[ "void FUNC_0(MachineState *VAR_0)\n{", "MachineClass *mc = MACHINE_GET_CLASS(VAR_0);", "int VAR_1;", "GlobalProperty *p;", "if (!mc->compat_props) {", "return;", "}", "for (VAR_1 = 0; VAR_1 < mc->compat_props->len; VAR_1++) {", "p = g_array_index(mc->compat_props, GlobalProperty *, VAR_1);", "p->errp = &error_abort;", "qdev_prop_register_global(p);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ] ]
5,563
static int win_chr_pipe_init(CharDriverState *chr, const char *filename, Error **errp) { WinCharState *s = chr->opaque; OVERLAPPED ov; int ret; DWORD size; char openname[CHR_MAX_FILENAME_SIZE]; s->fpipe = TRUE; s->hsend = CreateEvent(NULL, TRUE, FALSE, NULL); if (!s->hsend) { error_setg(errp, "Failed CreateEvent"); goto fail; } s->hrecv = CreateEvent(NULL, TRUE, FALSE, NULL); if (!s->hrecv) { error_setg(errp, "Failed CreateEvent"); goto fail; } snprintf(openname, sizeof(openname), "\\\\.\\pipe\\%s", filename); s->hcom = CreateNamedPipe(openname, PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED, PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT, MAXCONNECT, NSENDBUF, NRECVBUF, NTIMEOUT, NULL); if (s->hcom == INVALID_HANDLE_VALUE) { error_setg(errp, "Failed CreateNamedPipe (%lu)", GetLastError()); s->hcom = NULL; goto fail; } ZeroMemory(&ov, sizeof(ov)); ov.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL); ret = ConnectNamedPipe(s->hcom, &ov); if (ret) { error_setg(errp, "Failed ConnectNamedPipe"); goto fail; } ret = GetOverlappedResult(s->hcom, &ov, &size, TRUE); if (!ret) { error_setg(errp, "Failed GetOverlappedResult"); if (ov.hEvent) { CloseHandle(ov.hEvent); ov.hEvent = NULL; } goto fail; } if (ov.hEvent) { CloseHandle(ov.hEvent); ov.hEvent = NULL; } qemu_add_polling_cb(win_chr_pipe_poll, chr); return 0; fail: win_chr_close(chr); return -1; }
false
qemu
0ff0fad23d3693ecf7a0c462cdb48f0e60f93808
static int win_chr_pipe_init(CharDriverState *chr, const char *filename, Error **errp) { WinCharState *s = chr->opaque; OVERLAPPED ov; int ret; DWORD size; char openname[CHR_MAX_FILENAME_SIZE]; s->fpipe = TRUE; s->hsend = CreateEvent(NULL, TRUE, FALSE, NULL); if (!s->hsend) { error_setg(errp, "Failed CreateEvent"); goto fail; } s->hrecv = CreateEvent(NULL, TRUE, FALSE, NULL); if (!s->hrecv) { error_setg(errp, "Failed CreateEvent"); goto fail; } snprintf(openname, sizeof(openname), "\\\\.\\pipe\\%s", filename); s->hcom = CreateNamedPipe(openname, PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED, PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT, MAXCONNECT, NSENDBUF, NRECVBUF, NTIMEOUT, NULL); if (s->hcom == INVALID_HANDLE_VALUE) { error_setg(errp, "Failed CreateNamedPipe (%lu)", GetLastError()); s->hcom = NULL; goto fail; } ZeroMemory(&ov, sizeof(ov)); ov.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL); ret = ConnectNamedPipe(s->hcom, &ov); if (ret) { error_setg(errp, "Failed ConnectNamedPipe"); goto fail; } ret = GetOverlappedResult(s->hcom, &ov, &size, TRUE); if (!ret) { error_setg(errp, "Failed GetOverlappedResult"); if (ov.hEvent) { CloseHandle(ov.hEvent); ov.hEvent = NULL; } goto fail; } if (ov.hEvent) { CloseHandle(ov.hEvent); ov.hEvent = NULL; } qemu_add_polling_cb(win_chr_pipe_poll, chr); return 0; fail: win_chr_close(chr); return -1; }
{ "code": [], "line_no": [] }
static int FUNC_0(CharDriverState *VAR_0, const char *VAR_1, Error **VAR_2) { WinCharState *s = VAR_0->opaque; OVERLAPPED ov; int VAR_3; DWORD size; char VAR_4[CHR_MAX_FILENAME_SIZE]; s->fpipe = TRUE; s->hsend = CreateEvent(NULL, TRUE, FALSE, NULL); if (!s->hsend) { error_setg(VAR_2, "Failed CreateEvent"); goto fail; } s->hrecv = CreateEvent(NULL, TRUE, FALSE, NULL); if (!s->hrecv) { error_setg(VAR_2, "Failed CreateEvent"); goto fail; } snprintf(VAR_4, sizeof(VAR_4), "\\\\.\\pipe\\%s", VAR_1); s->hcom = CreateNamedPipe(VAR_4, PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED, PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT, MAXCONNECT, NSENDBUF, NRECVBUF, NTIMEOUT, NULL); if (s->hcom == INVALID_HANDLE_VALUE) { error_setg(VAR_2, "Failed CreateNamedPipe (%lu)", GetLastError()); s->hcom = NULL; goto fail; } ZeroMemory(&ov, sizeof(ov)); ov.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL); VAR_3 = ConnectNamedPipe(s->hcom, &ov); if (VAR_3) { error_setg(VAR_2, "Failed ConnectNamedPipe"); goto fail; } VAR_3 = GetOverlappedResult(s->hcom, &ov, &size, TRUE); if (!VAR_3) { error_setg(VAR_2, "Failed GetOverlappedResult"); if (ov.hEvent) { CloseHandle(ov.hEvent); ov.hEvent = NULL; } goto fail; } if (ov.hEvent) { CloseHandle(ov.hEvent); ov.hEvent = NULL; } qemu_add_polling_cb(win_chr_pipe_poll, VAR_0); return 0; fail: win_chr_close(VAR_0); return -1; }
[ "static int FUNC_0(CharDriverState *VAR_0, const char *VAR_1,\nError **VAR_2)\n{", "WinCharState *s = VAR_0->opaque;", "OVERLAPPED ov;", "int VAR_3;", "DWORD size;", "char VAR_4[CHR_MAX_FILENAME_SIZE];", "s->fpipe = TRUE;", "s->hsend = CreateEvent(NULL, TRUE, FALSE, NULL);", "if (!s->hsend) {", "error_setg(VAR_2, \"Failed CreateEvent\");", "goto fail;", "}", "s->hrecv = CreateEvent(NULL, TRUE, FALSE, NULL);", "if (!s->hrecv) {", "error_setg(VAR_2, \"Failed CreateEvent\");", "goto fail;", "}", "snprintf(VAR_4, sizeof(VAR_4), \"\\\\\\\\.\\\\pipe\\\\%s\", VAR_1);", "s->hcom = CreateNamedPipe(VAR_4, PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED,\nPIPE_TYPE_BYTE | PIPE_READMODE_BYTE |\nPIPE_WAIT,\nMAXCONNECT, NSENDBUF, NRECVBUF, NTIMEOUT, NULL);", "if (s->hcom == INVALID_HANDLE_VALUE) {", "error_setg(VAR_2, \"Failed CreateNamedPipe (%lu)\", GetLastError());", "s->hcom = NULL;", "goto fail;", "}", "ZeroMemory(&ov, sizeof(ov));", "ov.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);", "VAR_3 = ConnectNamedPipe(s->hcom, &ov);", "if (VAR_3) {", "error_setg(VAR_2, \"Failed ConnectNamedPipe\");", "goto fail;", "}", "VAR_3 = GetOverlappedResult(s->hcom, &ov, &size, TRUE);", "if (!VAR_3) {", "error_setg(VAR_2, \"Failed GetOverlappedResult\");", "if (ov.hEvent) {", "CloseHandle(ov.hEvent);", "ov.hEvent = NULL;", "}", "goto fail;", "}", "if (ov.hEvent) {", "CloseHandle(ov.hEvent);", "ov.hEvent = NULL;", "}", "qemu_add_polling_cb(win_chr_pipe_poll, VAR_0);", "return 0;", "fail:\nwin_chr_close(VAR_0);", "return -1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47, 49, 51, 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 117, 119 ], [ 121 ], [ 123 ] ]
5,564
static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus, const char *name, int devfn, Error **errp) { PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(pci_dev); PCIConfigReadFunc *config_read = pc->config_read; PCIConfigWriteFunc *config_write = pc->config_write; Error *local_err = NULL; DeviceState *dev = DEVICE(pci_dev); pci_dev->bus = bus; /* Only pci bridges can be attached to extra PCI root buses */ if (pci_bus_is_root(bus) && bus->parent_dev && !pc->is_bridge) { error_setg(errp, "PCI: Only PCI/PCIe bridges can be plugged into %s", bus->parent_dev->name); return NULL; } if (devfn < 0) { for(devfn = bus->devfn_min ; devfn < ARRAY_SIZE(bus->devices); devfn += PCI_FUNC_MAX) { if (!bus->devices[devfn]) goto found; } error_setg(errp, "PCI: no slot/function available for %s, all in use", name); return NULL; found: ; } else if (bus->devices[devfn]) { error_setg(errp, "PCI: slot %d function %d not available for %s," " in use by %s", PCI_SLOT(devfn), PCI_FUNC(devfn), name, bus->devices[devfn]->name); return NULL; } else if (dev->hotplugged && pci_get_function_0(pci_dev)) { error_setg(errp, "PCI: slot %d function 0 already ocuppied by %s," " new func %s cannot be exposed to guest.", PCI_SLOT(pci_get_function_0(pci_dev)->devfn), pci_get_function_0(pci_dev)->name, name); return NULL; } pci_dev->devfn = devfn; pci_dev->requester_id_cache = pci_req_id_cache_get(pci_dev); memory_region_init(&pci_dev->bus_master_container_region, OBJECT(pci_dev), "bus master container", UINT64_MAX); address_space_init(&pci_dev->bus_master_as, &pci_dev->bus_master_container_region, pci_dev->name); if (qdev_hotplug) { pci_init_bus_master(pci_dev); } pstrcpy(pci_dev->name, sizeof(pci_dev->name), name); pci_dev->irq_state = 0; pci_config_alloc(pci_dev); pci_config_set_vendor_id(pci_dev->config, pc->vendor_id); pci_config_set_device_id(pci_dev->config, pc->device_id); pci_config_set_revision(pci_dev->config, pc->revision); pci_config_set_class(pci_dev->config, pc->class_id); if (!pc->is_bridge) { if (pc->subsystem_vendor_id || pc->subsystem_id) { pci_set_word(pci_dev->config + PCI_SUBSYSTEM_VENDOR_ID, pc->subsystem_vendor_id); pci_set_word(pci_dev->config + PCI_SUBSYSTEM_ID, pc->subsystem_id); } else { pci_set_default_subsystem_id(pci_dev); } } else { /* subsystem_vendor_id/subsystem_id are only for header type 0 */ assert(!pc->subsystem_vendor_id); assert(!pc->subsystem_id); } pci_init_cmask(pci_dev); pci_init_wmask(pci_dev); pci_init_w1cmask(pci_dev); if (pc->is_bridge) { pci_init_mask_bridge(pci_dev); } pci_init_multifunction(bus, pci_dev, &local_err); if (local_err) { error_propagate(errp, local_err); do_pci_unregister_device(pci_dev); return NULL; } if (!config_read) config_read = pci_default_read_config; if (!config_write) config_write = pci_default_write_config; pci_dev->config_read = config_read; pci_dev->config_write = config_write; bus->devices[devfn] = pci_dev; pci_dev->version_id = 2; /* Current pci device vmstate version */ return pci_dev; }
false
qemu
9b717a3a1318455afce761301fec114982ccbf1f
static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus, const char *name, int devfn, Error **errp) { PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(pci_dev); PCIConfigReadFunc *config_read = pc->config_read; PCIConfigWriteFunc *config_write = pc->config_write; Error *local_err = NULL; DeviceState *dev = DEVICE(pci_dev); pci_dev->bus = bus; if (pci_bus_is_root(bus) && bus->parent_dev && !pc->is_bridge) { error_setg(errp, "PCI: Only PCI/PCIe bridges can be plugged into %s", bus->parent_dev->name); return NULL; } if (devfn < 0) { for(devfn = bus->devfn_min ; devfn < ARRAY_SIZE(bus->devices); devfn += PCI_FUNC_MAX) { if (!bus->devices[devfn]) goto found; } error_setg(errp, "PCI: no slot/function available for %s, all in use", name); return NULL; found: ; } else if (bus->devices[devfn]) { error_setg(errp, "PCI: slot %d function %d not available for %s," " in use by %s", PCI_SLOT(devfn), PCI_FUNC(devfn), name, bus->devices[devfn]->name); return NULL; } else if (dev->hotplugged && pci_get_function_0(pci_dev)) { error_setg(errp, "PCI: slot %d function 0 already ocuppied by %s," " new func %s cannot be exposed to guest.", PCI_SLOT(pci_get_function_0(pci_dev)->devfn), pci_get_function_0(pci_dev)->name, name); return NULL; } pci_dev->devfn = devfn; pci_dev->requester_id_cache = pci_req_id_cache_get(pci_dev); memory_region_init(&pci_dev->bus_master_container_region, OBJECT(pci_dev), "bus master container", UINT64_MAX); address_space_init(&pci_dev->bus_master_as, &pci_dev->bus_master_container_region, pci_dev->name); if (qdev_hotplug) { pci_init_bus_master(pci_dev); } pstrcpy(pci_dev->name, sizeof(pci_dev->name), name); pci_dev->irq_state = 0; pci_config_alloc(pci_dev); pci_config_set_vendor_id(pci_dev->config, pc->vendor_id); pci_config_set_device_id(pci_dev->config, pc->device_id); pci_config_set_revision(pci_dev->config, pc->revision); pci_config_set_class(pci_dev->config, pc->class_id); if (!pc->is_bridge) { if (pc->subsystem_vendor_id || pc->subsystem_id) { pci_set_word(pci_dev->config + PCI_SUBSYSTEM_VENDOR_ID, pc->subsystem_vendor_id); pci_set_word(pci_dev->config + PCI_SUBSYSTEM_ID, pc->subsystem_id); } else { pci_set_default_subsystem_id(pci_dev); } } else { assert(!pc->subsystem_vendor_id); assert(!pc->subsystem_id); } pci_init_cmask(pci_dev); pci_init_wmask(pci_dev); pci_init_w1cmask(pci_dev); if (pc->is_bridge) { pci_init_mask_bridge(pci_dev); } pci_init_multifunction(bus, pci_dev, &local_err); if (local_err) { error_propagate(errp, local_err); do_pci_unregister_device(pci_dev); return NULL; } if (!config_read) config_read = pci_default_read_config; if (!config_write) config_write = pci_default_write_config; pci_dev->config_read = config_read; pci_dev->config_write = config_write; bus->devices[devfn] = pci_dev; pci_dev->version_id = 2; return pci_dev; }
{ "code": [], "line_no": [] }
static PCIDevice *FUNC_0(PCIDevice *pci_dev, PCIBus *bus, const char *name, int devfn, Error **errp) { PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(pci_dev); PCIConfigReadFunc *config_read = pc->config_read; PCIConfigWriteFunc *config_write = pc->config_write; Error *local_err = NULL; DeviceState *dev = DEVICE(pci_dev); pci_dev->bus = bus; if (pci_bus_is_root(bus) && bus->parent_dev && !pc->is_bridge) { error_setg(errp, "PCI: Only PCI/PCIe bridges can be plugged into %s", bus->parent_dev->name); return NULL; } if (devfn < 0) { for(devfn = bus->devfn_min ; devfn < ARRAY_SIZE(bus->devices); devfn += PCI_FUNC_MAX) { if (!bus->devices[devfn]) goto found; } error_setg(errp, "PCI: no slot/function available for %s, all in use", name); return NULL; found: ; } else if (bus->devices[devfn]) { error_setg(errp, "PCI: slot %d function %d not available for %s," " in use by %s", PCI_SLOT(devfn), PCI_FUNC(devfn), name, bus->devices[devfn]->name); return NULL; } else if (dev->hotplugged && pci_get_function_0(pci_dev)) { error_setg(errp, "PCI: slot %d function 0 already ocuppied by %s," " new func %s cannot be exposed to guest.", PCI_SLOT(pci_get_function_0(pci_dev)->devfn), pci_get_function_0(pci_dev)->name, name); return NULL; } pci_dev->devfn = devfn; pci_dev->requester_id_cache = pci_req_id_cache_get(pci_dev); memory_region_init(&pci_dev->bus_master_container_region, OBJECT(pci_dev), "bus master container", UINT64_MAX); address_space_init(&pci_dev->bus_master_as, &pci_dev->bus_master_container_region, pci_dev->name); if (qdev_hotplug) { pci_init_bus_master(pci_dev); } pstrcpy(pci_dev->name, sizeof(pci_dev->name), name); pci_dev->irq_state = 0; pci_config_alloc(pci_dev); pci_config_set_vendor_id(pci_dev->config, pc->vendor_id); pci_config_set_device_id(pci_dev->config, pc->device_id); pci_config_set_revision(pci_dev->config, pc->revision); pci_config_set_class(pci_dev->config, pc->class_id); if (!pc->is_bridge) { if (pc->subsystem_vendor_id || pc->subsystem_id) { pci_set_word(pci_dev->config + PCI_SUBSYSTEM_VENDOR_ID, pc->subsystem_vendor_id); pci_set_word(pci_dev->config + PCI_SUBSYSTEM_ID, pc->subsystem_id); } else { pci_set_default_subsystem_id(pci_dev); } } else { assert(!pc->subsystem_vendor_id); assert(!pc->subsystem_id); } pci_init_cmask(pci_dev); pci_init_wmask(pci_dev); pci_init_w1cmask(pci_dev); if (pc->is_bridge) { pci_init_mask_bridge(pci_dev); } pci_init_multifunction(bus, pci_dev, &local_err); if (local_err) { error_propagate(errp, local_err); do_pci_unregister_device(pci_dev); return NULL; } if (!config_read) config_read = pci_default_read_config; if (!config_write) config_write = pci_default_write_config; pci_dev->config_read = config_read; pci_dev->config_write = config_write; bus->devices[devfn] = pci_dev; pci_dev->version_id = 2; return pci_dev; }
[ "static PCIDevice *FUNC_0(PCIDevice *pci_dev, PCIBus *bus,\nconst char *name, int devfn,\nError **errp)\n{", "PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(pci_dev);", "PCIConfigReadFunc *config_read = pc->config_read;", "PCIConfigWriteFunc *config_write = pc->config_write;", "Error *local_err = NULL;", "DeviceState *dev = DEVICE(pci_dev);", "pci_dev->bus = bus;", "if (pci_bus_is_root(bus) && bus->parent_dev && !pc->is_bridge) {", "error_setg(errp,\n\"PCI: Only PCI/PCIe bridges can be plugged into %s\",\nbus->parent_dev->name);", "return NULL;", "}", "if (devfn < 0) {", "for(devfn = bus->devfn_min ; devfn < ARRAY_SIZE(bus->devices);", "devfn += PCI_FUNC_MAX) {", "if (!bus->devices[devfn])\ngoto found;", "}", "error_setg(errp, \"PCI: no slot/function available for %s, all in use\",\nname);", "return NULL;", "found: ;", "} else if (bus->devices[devfn]) {", "error_setg(errp, \"PCI: slot %d function %d not available for %s,\"\n\" in use by %s\",\nPCI_SLOT(devfn), PCI_FUNC(devfn), name,\nbus->devices[devfn]->name);", "return NULL;", "} else if (dev->hotplugged &&", "pci_get_function_0(pci_dev)) {", "error_setg(errp, \"PCI: slot %d function 0 already ocuppied by %s,\"\n\" new func %s cannot be exposed to guest.\",\nPCI_SLOT(pci_get_function_0(pci_dev)->devfn),\npci_get_function_0(pci_dev)->name,\nname);", "return NULL;", "}", "pci_dev->devfn = devfn;", "pci_dev->requester_id_cache = pci_req_id_cache_get(pci_dev);", "memory_region_init(&pci_dev->bus_master_container_region, OBJECT(pci_dev),\n\"bus master container\", UINT64_MAX);", "address_space_init(&pci_dev->bus_master_as,\n&pci_dev->bus_master_container_region, pci_dev->name);", "if (qdev_hotplug) {", "pci_init_bus_master(pci_dev);", "}", "pstrcpy(pci_dev->name, sizeof(pci_dev->name), name);", "pci_dev->irq_state = 0;", "pci_config_alloc(pci_dev);", "pci_config_set_vendor_id(pci_dev->config, pc->vendor_id);", "pci_config_set_device_id(pci_dev->config, pc->device_id);", "pci_config_set_revision(pci_dev->config, pc->revision);", "pci_config_set_class(pci_dev->config, pc->class_id);", "if (!pc->is_bridge) {", "if (pc->subsystem_vendor_id || pc->subsystem_id) {", "pci_set_word(pci_dev->config + PCI_SUBSYSTEM_VENDOR_ID,\npc->subsystem_vendor_id);", "pci_set_word(pci_dev->config + PCI_SUBSYSTEM_ID,\npc->subsystem_id);", "} else {", "pci_set_default_subsystem_id(pci_dev);", "}", "} else {", "assert(!pc->subsystem_vendor_id);", "assert(!pc->subsystem_id);", "}", "pci_init_cmask(pci_dev);", "pci_init_wmask(pci_dev);", "pci_init_w1cmask(pci_dev);", "if (pc->is_bridge) {", "pci_init_mask_bridge(pci_dev);", "}", "pci_init_multifunction(bus, pci_dev, &local_err);", "if (local_err) {", "error_propagate(errp, local_err);", "do_pci_unregister_device(pci_dev);", "return NULL;", "}", "if (!config_read)\nconfig_read = pci_default_read_config;", "if (!config_write)\nconfig_write = pci_default_write_config;", "pci_dev->config_read = config_read;", "pci_dev->config_write = config_write;", "bus->devices[devfn] = pci_dev;", "pci_dev->version_id = 2;", "return pci_dev;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 25 ], [ 27, 29, 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45, 47 ], [ 49 ], [ 51, 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61, 63, 65, 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75, 77, 79, 81, 83 ], [ 87 ], [ 89 ], [ 93 ], [ 95 ], [ 99, 101 ], [ 103, 105 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 133 ], [ 135 ], [ 137, 139 ], [ 141, 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 187, 189 ], [ 191, 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ] ]
5,565
int floatx80_lt(floatx80 a, floatx80 b, float_status *status) { flag aSign, bSign; if ( ( ( extractFloatx80Exp( a ) == 0x7FFF ) && (uint64_t) ( extractFloatx80Frac( a )<<1 ) ) || ( ( extractFloatx80Exp( b ) == 0x7FFF ) && (uint64_t) ( extractFloatx80Frac( b )<<1 ) ) ) { float_raise(float_flag_invalid, status); return 0; } aSign = extractFloatx80Sign( a ); bSign = extractFloatx80Sign( b ); if ( aSign != bSign ) { return aSign && ( ( ( (uint16_t) ( ( a.high | b.high )<<1 ) ) | a.low | b.low ) != 0 ); } return aSign ? lt128( b.high, b.low, a.high, a.low ) : lt128( a.high, a.low, b.high, b.low ); }
false
qemu
d1eb8f2acba579830cf3798c3c15ce51be852c56
int floatx80_lt(floatx80 a, floatx80 b, float_status *status) { flag aSign, bSign; if ( ( ( extractFloatx80Exp( a ) == 0x7FFF ) && (uint64_t) ( extractFloatx80Frac( a )<<1 ) ) || ( ( extractFloatx80Exp( b ) == 0x7FFF ) && (uint64_t) ( extractFloatx80Frac( b )<<1 ) ) ) { float_raise(float_flag_invalid, status); return 0; } aSign = extractFloatx80Sign( a ); bSign = extractFloatx80Sign( b ); if ( aSign != bSign ) { return aSign && ( ( ( (uint16_t) ( ( a.high | b.high )<<1 ) ) | a.low | b.low ) != 0 ); } return aSign ? lt128( b.high, b.low, a.high, a.low ) : lt128( a.high, a.low, b.high, b.low ); }
{ "code": [], "line_no": [] }
int FUNC_0(floatx80 VAR_0, floatx80 VAR_1, float_status *VAR_2) { flag aSign, bSign; if ( ( ( extractFloatx80Exp( VAR_0 ) == 0x7FFF ) && (uint64_t) ( extractFloatx80Frac( VAR_0 )<<1 ) ) || ( ( extractFloatx80Exp( VAR_1 ) == 0x7FFF ) && (uint64_t) ( extractFloatx80Frac( VAR_1 )<<1 ) ) ) { float_raise(float_flag_invalid, VAR_2); return 0; } aSign = extractFloatx80Sign( VAR_0 ); bSign = extractFloatx80Sign( VAR_1 ); if ( aSign != bSign ) { return aSign && ( ( ( (uint16_t) ( ( VAR_0.high | VAR_1.high )<<1 ) ) | VAR_0.low | VAR_1.low ) != 0 ); } return aSign ? lt128( VAR_1.high, VAR_1.low, VAR_0.high, VAR_0.low ) : lt128( VAR_0.high, VAR_0.low, VAR_1.high, VAR_1.low ); }
[ "int FUNC_0(floatx80 VAR_0, floatx80 VAR_1, float_status *VAR_2)\n{", "flag aSign, bSign;", "if ( ( ( extractFloatx80Exp( VAR_0 ) == 0x7FFF )\n&& (uint64_t) ( extractFloatx80Frac( VAR_0 )<<1 ) )\n|| ( ( extractFloatx80Exp( VAR_1 ) == 0x7FFF )\n&& (uint64_t) ( extractFloatx80Frac( VAR_1 )<<1 ) )\n) {", "float_raise(float_flag_invalid, VAR_2);", "return 0;", "}", "aSign = extractFloatx80Sign( VAR_0 );", "bSign = extractFloatx80Sign( VAR_1 );", "if ( aSign != bSign ) {", "return\naSign\n&& ( ( ( (uint16_t) ( ( VAR_0.high | VAR_1.high )<<1 ) ) | VAR_0.low | VAR_1.low )\n!= 0 );", "}", "return\naSign ? lt128( VAR_1.high, VAR_1.low, VAR_0.high, VAR_0.low )\n: lt128( VAR_0.high, VAR_0.low, VAR_1.high, VAR_1.low );", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11, 13, 15, 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31, 33, 35, 37 ], [ 39 ], [ 41, 43, 45 ], [ 49 ] ]
5,568
int bdrv_debug_breakpoint(BlockDriverState *bs, const char *event, const char *tag) { while (bs && bs->drv && !bs->drv->bdrv_debug_breakpoint) { bs = bs->file; } if (bs && bs->drv && bs->drv->bdrv_debug_breakpoint) { return bs->drv->bdrv_debug_breakpoint(bs, event, tag); } return -ENOTSUP; }
false
qemu
61007b316cd71ee7333ff7a0a749a8949527575f
int bdrv_debug_breakpoint(BlockDriverState *bs, const char *event, const char *tag) { while (bs && bs->drv && !bs->drv->bdrv_debug_breakpoint) { bs = bs->file; } if (bs && bs->drv && bs->drv->bdrv_debug_breakpoint) { return bs->drv->bdrv_debug_breakpoint(bs, event, tag); } return -ENOTSUP; }
{ "code": [], "line_no": [] }
int FUNC_0(BlockDriverState *VAR_0, const char *VAR_1, const char *VAR_2) { while (VAR_0 && VAR_0->drv && !VAR_0->drv->FUNC_0) { VAR_0 = VAR_0->file; } if (VAR_0 && VAR_0->drv && VAR_0->drv->FUNC_0) { return VAR_0->drv->FUNC_0(VAR_0, VAR_1, VAR_2); } return -ENOTSUP; }
[ "int FUNC_0(BlockDriverState *VAR_0, const char *VAR_1,\nconst char *VAR_2)\n{", "while (VAR_0 && VAR_0->drv && !VAR_0->drv->FUNC_0) {", "VAR_0 = VAR_0->file;", "}", "if (VAR_0 && VAR_0->drv && VAR_0->drv->FUNC_0) {", "return VAR_0->drv->FUNC_0(VAR_0, VAR_1, VAR_2);", "}", "return -ENOTSUP;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ] ]
5,569
static target_ulong h_add_logical_lan_buffer(PowerPCCPU *cpu, sPAPRMachineState *spapr, target_ulong opcode, target_ulong *args) { target_ulong reg = args[0]; target_ulong buf = args[1]; VIOsPAPRDevice *sdev = spapr_vio_find_by_reg(spapr->vio_bus, reg); VIOsPAPRVLANDevice *dev = VIO_SPAPR_VLAN_DEVICE(sdev); target_long ret; DPRINTF("H_ADD_LOGICAL_LAN_BUFFER(0x" TARGET_FMT_lx ", 0x" TARGET_FMT_lx ")\n", reg, buf); if (!sdev) { hcall_dprintf("Bad device\n"); return H_PARAMETER; } if ((check_bd(dev, buf, 4) < 0) || (VLAN_BD_LEN(buf) < 16)) { hcall_dprintf("Bad buffer enqueued\n"); return H_PARAMETER; } if (!dev->isopen) { return H_RESOURCE; } ret = spapr_vlan_add_rxbuf_to_page(dev, buf); if (ret) { return ret; } dev->rx_bufs++; qemu_flush_queued_packets(qemu_get_queue(dev->nic)); return H_SUCCESS; }
false
qemu
831e8822530bb511a24329494f9121ad1f8b94ab
static target_ulong h_add_logical_lan_buffer(PowerPCCPU *cpu, sPAPRMachineState *spapr, target_ulong opcode, target_ulong *args) { target_ulong reg = args[0]; target_ulong buf = args[1]; VIOsPAPRDevice *sdev = spapr_vio_find_by_reg(spapr->vio_bus, reg); VIOsPAPRVLANDevice *dev = VIO_SPAPR_VLAN_DEVICE(sdev); target_long ret; DPRINTF("H_ADD_LOGICAL_LAN_BUFFER(0x" TARGET_FMT_lx ", 0x" TARGET_FMT_lx ")\n", reg, buf); if (!sdev) { hcall_dprintf("Bad device\n"); return H_PARAMETER; } if ((check_bd(dev, buf, 4) < 0) || (VLAN_BD_LEN(buf) < 16)) { hcall_dprintf("Bad buffer enqueued\n"); return H_PARAMETER; } if (!dev->isopen) { return H_RESOURCE; } ret = spapr_vlan_add_rxbuf_to_page(dev, buf); if (ret) { return ret; } dev->rx_bufs++; qemu_flush_queued_packets(qemu_get_queue(dev->nic)); return H_SUCCESS; }
{ "code": [], "line_no": [] }
static target_ulong FUNC_0(PowerPCCPU *cpu, sPAPRMachineState *spapr, target_ulong opcode, target_ulong *args) { target_ulong reg = args[0]; target_ulong buf = args[1]; VIOsPAPRDevice *sdev = spapr_vio_find_by_reg(spapr->vio_bus, reg); VIOsPAPRVLANDevice *dev = VIO_SPAPR_VLAN_DEVICE(sdev); target_long ret; DPRINTF("H_ADD_LOGICAL_LAN_BUFFER(0x" TARGET_FMT_lx ", 0x" TARGET_FMT_lx ")\n", reg, buf); if (!sdev) { hcall_dprintf("Bad device\n"); return H_PARAMETER; } if ((check_bd(dev, buf, 4) < 0) || (VLAN_BD_LEN(buf) < 16)) { hcall_dprintf("Bad buffer enqueued\n"); return H_PARAMETER; } if (!dev->isopen) { return H_RESOURCE; } ret = spapr_vlan_add_rxbuf_to_page(dev, buf); if (ret) { return ret; } dev->rx_bufs++; qemu_flush_queued_packets(qemu_get_queue(dev->nic)); return H_SUCCESS; }
[ "static target_ulong FUNC_0(PowerPCCPU *cpu,\nsPAPRMachineState *spapr,\ntarget_ulong opcode,\ntarget_ulong *args)\n{", "target_ulong reg = args[0];", "target_ulong buf = args[1];", "VIOsPAPRDevice *sdev = spapr_vio_find_by_reg(spapr->vio_bus, reg);", "VIOsPAPRVLANDevice *dev = VIO_SPAPR_VLAN_DEVICE(sdev);", "target_long ret;", "DPRINTF(\"H_ADD_LOGICAL_LAN_BUFFER(0x\" TARGET_FMT_lx\n\", 0x\" TARGET_FMT_lx \")\\n\", reg, buf);", "if (!sdev) {", "hcall_dprintf(\"Bad device\\n\");", "return H_PARAMETER;", "}", "if ((check_bd(dev, buf, 4) < 0)\n|| (VLAN_BD_LEN(buf) < 16)) {", "hcall_dprintf(\"Bad buffer enqueued\\n\");", "return H_PARAMETER;", "}", "if (!dev->isopen) {", "return H_RESOURCE;", "}", "ret = spapr_vlan_add_rxbuf_to_page(dev, buf);", "if (ret) {", "return ret;", "}", "dev->rx_bufs++;", "qemu_flush_queued_packets(qemu_get_queue(dev->nic));", "return H_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 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23, 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 73 ], [ 77 ], [ 79 ] ]
5,571
static void openrisc_pic_cpu_handler(void *opaque, int irq, int level) { OpenRISCCPU *cpu = (OpenRISCCPU *)opaque; CPUState *cs = CPU(cpu); int i; uint32_t irq_bit = 1 << irq; if (irq > 31 || irq < 0) { return; } if (level) { cpu->env.picsr |= irq_bit; } else { cpu->env.picsr &= ~irq_bit; } for (i = 0; i < 32; i++) { if ((cpu->env.picsr && (1 << i)) && (cpu->env.picmr && (1 << i))) { cpu_interrupt(cs, CPU_INTERRUPT_HARD); } else { cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD); cpu->env.picsr &= ~(1 << i); } } }
false
qemu
ed396e2b2d256c1628de7c11841b509455a76c03
static void openrisc_pic_cpu_handler(void *opaque, int irq, int level) { OpenRISCCPU *cpu = (OpenRISCCPU *)opaque; CPUState *cs = CPU(cpu); int i; uint32_t irq_bit = 1 << irq; if (irq > 31 || irq < 0) { return; } if (level) { cpu->env.picsr |= irq_bit; } else { cpu->env.picsr &= ~irq_bit; } for (i = 0; i < 32; i++) { if ((cpu->env.picsr && (1 << i)) && (cpu->env.picmr && (1 << i))) { cpu_interrupt(cs, CPU_INTERRUPT_HARD); } else { cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD); cpu->env.picsr &= ~(1 << i); } } }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, int VAR_1, int VAR_2) { OpenRISCCPU *cpu = (OpenRISCCPU *)VAR_0; CPUState *cs = CPU(cpu); int VAR_3; uint32_t irq_bit = 1 << VAR_1; if (VAR_1 > 31 || VAR_1 < 0) { return; } if (VAR_2) { cpu->env.picsr |= irq_bit; } else { cpu->env.picsr &= ~irq_bit; } for (VAR_3 = 0; VAR_3 < 32; VAR_3++) { if ((cpu->env.picsr && (1 << VAR_3)) && (cpu->env.picmr && (1 << VAR_3))) { cpu_interrupt(cs, CPU_INTERRUPT_HARD); } else { cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD); cpu->env.picsr &= ~(1 << VAR_3); } } }
[ "static void FUNC_0(void *VAR_0, int VAR_1, int VAR_2)\n{", "OpenRISCCPU *cpu = (OpenRISCCPU *)VAR_0;", "CPUState *cs = CPU(cpu);", "int VAR_3;", "uint32_t irq_bit = 1 << VAR_1;", "if (VAR_1 > 31 || VAR_1 < 0) {", "return;", "}", "if (VAR_2) {", "cpu->env.picsr |= irq_bit;", "} else {", "cpu->env.picsr &= ~irq_bit;", "}", "for (VAR_3 = 0; VAR_3 < 32; VAR_3++) {", "if ((cpu->env.picsr && (1 << VAR_3)) && (cpu->env.picmr && (1 << VAR_3))) {", "cpu_interrupt(cs, CPU_INTERRUPT_HARD);", "} else {", "cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD);", "cpu->env.picsr &= ~(1 << VAR_3);", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ] ]