id
int32
0
27.3k
func
stringlengths
26
142k
target
bool
2 classes
project
stringclasses
2 values
commit_id
stringlengths
40
40
func_clean
stringlengths
26
131k
vul_lines
dict
normalized_func
stringlengths
24
132k
lines
listlengths
1
2.8k
label
listlengths
1
2.8k
line_no
listlengths
1
2.8k
13,954
void parse_options(int argc, char **argv, const OptionDef *options, void (* parse_arg_function)(const char*)) { const char *opt, *arg; int optindex, handleoptions=1; const OptionDef *po; /* parse options */ optindex = 1; while (optindex < argc) { opt = argv[optindex++]; if (handleoptions && opt[0] == '-' && opt[1] != '\0') { int bool_val = 1; if (opt[1] == '-' && opt[2] == '\0') { handleoptions = 0; continue; } opt++; po= find_option(options, opt); if (!po->name && opt[0] == 'n' && opt[1] == 'o') { /* handle 'no' bool option */ po = find_option(options, opt + 2); if (!(po->name && (po->flags & OPT_BOOL))) goto unknown_opt; bool_val = 0; } if (!po->name) po= find_option(options, "default"); if (!po->name) { unknown_opt: fprintf(stderr, "%s: unrecognized option '%s'\n", argv[0], opt); exit(1); } arg = NULL; if (po->flags & HAS_ARG) { arg = argv[optindex++]; if (!arg) { fprintf(stderr, "%s: missing argument for option '%s'\n", argv[0], opt); exit(1); } } if (po->flags & OPT_STRING) { char *str; str = av_strdup(arg); *po->u.str_arg = str; } else if (po->flags & OPT_BOOL) { *po->u.int_arg = bool_val; } else if (po->flags & OPT_INT) { *po->u.int_arg = parse_number_or_die(opt, arg, OPT_INT64, INT_MIN, INT_MAX); } else if (po->flags & OPT_INT64) { *po->u.int64_arg = parse_number_or_die(opt, arg, OPT_INT64, INT64_MIN, INT64_MAX); } else if (po->flags & OPT_FLOAT) { *po->u.float_arg = parse_number_or_die(opt, arg, OPT_FLOAT, -1.0/0.0, 1.0/0.0); } else if (po->flags & OPT_FUNC2) { if(po->u.func2_arg(opt, arg)<0) goto unknown_opt; } else { po->u.func_arg(arg); } if(po->flags & OPT_EXIT) exit(0); } else { if (parse_arg_function) parse_arg_function(opt); } } }
false
FFmpeg
9e5381a21b2106a012b92c1878886c5af4e1a932
void parse_options(int argc, char **argv, const OptionDef *options, void (* parse_arg_function)(const char*)) { const char *opt, *arg; int optindex, handleoptions=1; const OptionDef *po; optindex = 1; while (optindex < argc) { opt = argv[optindex++]; if (handleoptions && opt[0] == '-' && opt[1] != '\0') { int bool_val = 1; if (opt[1] == '-' && opt[2] == '\0') { handleoptions = 0; continue; } opt++; po= find_option(options, opt); if (!po->name && opt[0] == 'n' && opt[1] == 'o') { po = find_option(options, opt + 2); if (!(po->name && (po->flags & OPT_BOOL))) goto unknown_opt; bool_val = 0; } if (!po->name) po= find_option(options, "default"); if (!po->name) { unknown_opt: fprintf(stderr, "%s: unrecognized option '%s'\n", argv[0], opt); exit(1); } arg = NULL; if (po->flags & HAS_ARG) { arg = argv[optindex++]; if (!arg) { fprintf(stderr, "%s: missing argument for option '%s'\n", argv[0], opt); exit(1); } } if (po->flags & OPT_STRING) { char *str; str = av_strdup(arg); *po->u.str_arg = str; } else if (po->flags & OPT_BOOL) { *po->u.int_arg = bool_val; } else if (po->flags & OPT_INT) { *po->u.int_arg = parse_number_or_die(opt, arg, OPT_INT64, INT_MIN, INT_MAX); } else if (po->flags & OPT_INT64) { *po->u.int64_arg = parse_number_or_die(opt, arg, OPT_INT64, INT64_MIN, INT64_MAX); } else if (po->flags & OPT_FLOAT) { *po->u.float_arg = parse_number_or_die(opt, arg, OPT_FLOAT, -1.0/0.0, 1.0/0.0); } else if (po->flags & OPT_FUNC2) { if(po->u.func2_arg(opt, arg)<0) goto unknown_opt; } else { po->u.func_arg(arg); } if(po->flags & OPT_EXIT) exit(0); } else { if (parse_arg_function) parse_arg_function(opt); } } }
{ "code": [], "line_no": [] }
VAR_4voidVAR_4 VAR_4parse_optionsVAR_4(VAR_4intVAR_4 VAR_4VAR_0VAR_4, VAR_4charVAR_4 **VAR_4VAR_1VAR_4, VAR_4constVAR_4 VAR_4OptionDefVAR_4 *VAR_4VAR_2VAR_4, VAR_4voidVAR_4 (* VAR_4VAR_3VAR_4)(VAR_4constVAR_4 VAR_4charVAR_4*)) { VAR_4constVAR_4 VAR_4charVAR_4 *VAR_4optVAR_4, *VAR_4argVAR_4; VAR_4intVAR_4 VAR_4optindexVAR_4, VAR_4handleoptionsVAR_4=VAR_41VAR_4; VAR_4constVAR_4 VAR_4OptionDefVAR_4 *VAR_4poVAR_4; VAR_4optindexVAR_4 = VAR_41VAR_4; VAR_4whileVAR_4 (VAR_4optindexVAR_4 < VAR_4VAR_0VAR_4) { VAR_4optVAR_4 = VAR_4VAR_1VAR_4[VAR_4optindexVAR_4++]; VAR_4ifVAR_4 (VAR_4handleoptionsVAR_4 && VAR_4optVAR_4[VAR_40VAR_4] == '-' && VAR_4optVAR_4[VAR_41VAR_4] != '\VAR_40VAR_4') { VAR_4intVAR_4 VAR_4bool_valVAR_4 = VAR_41VAR_4; VAR_4ifVAR_4 (VAR_4optVAR_4[VAR_41VAR_4] == '-' && VAR_4optVAR_4[VAR_42VAR_4] == '\VAR_40VAR_4') { VAR_4handleoptionsVAR_4 = VAR_40VAR_4; VAR_4continueVAR_4; } VAR_4optVAR_4++; VAR_4poVAR_4= VAR_4find_optionVAR_4(VAR_4VAR_2VAR_4, VAR_4optVAR_4); VAR_4ifVAR_4 (!VAR_4poVAR_4->VAR_4nameVAR_4 && VAR_4optVAR_4[VAR_40VAR_4] == 'VAR_4nVAR_4' && VAR_4optVAR_4[VAR_41VAR_4] == 'VAR_4oVAR_4') { VAR_4poVAR_4 = VAR_4find_optionVAR_4(VAR_4VAR_2VAR_4, VAR_4optVAR_4 + VAR_42VAR_4); VAR_4ifVAR_4 (!(VAR_4poVAR_4->VAR_4nameVAR_4 && (VAR_4poVAR_4->VAR_4flagsVAR_4 & VAR_4OPT_BOOLVAR_4))) VAR_4gotoVAR_4 VAR_4unknown_optVAR_4; VAR_4bool_valVAR_4 = VAR_40VAR_4; } VAR_4ifVAR_4 (!VAR_4poVAR_4->VAR_4nameVAR_4) VAR_4poVAR_4= VAR_4find_optionVAR_4(VAR_4VAR_2VAR_4, "VAR_4defaultVAR_4"); VAR_4ifVAR_4 (!VAR_4poVAR_4->VAR_4nameVAR_4) { VAR_4unknown_optVAR_4: VAR_4fprintfVAR_4(VAR_4stderrVAR_4, "%VAR_4sVAR_4: VAR_4unrecognizedVAR_4 VAR_4optionVAR_4 '%VAR_4sVAR_4'\VAR_4nVAR_4", VAR_4VAR_1VAR_4[VAR_40VAR_4], VAR_4optVAR_4); VAR_4exitVAR_4(VAR_41VAR_4); } VAR_4argVAR_4 = VAR_4NULLVAR_4; VAR_4ifVAR_4 (VAR_4poVAR_4->VAR_4flagsVAR_4 & VAR_4HAS_ARGVAR_4) { VAR_4argVAR_4 = VAR_4VAR_1VAR_4[VAR_4optindexVAR_4++]; VAR_4ifVAR_4 (!VAR_4argVAR_4) { VAR_4fprintfVAR_4(VAR_4stderrVAR_4, "%VAR_4sVAR_4: VAR_4missingVAR_4 VAR_4argumentVAR_4 VAR_4forVAR_4 VAR_4optionVAR_4 '%VAR_4sVAR_4'\VAR_4nVAR_4", VAR_4VAR_1VAR_4[VAR_40VAR_4], VAR_4optVAR_4); VAR_4exitVAR_4(VAR_41VAR_4); } } VAR_4ifVAR_4 (VAR_4poVAR_4->VAR_4flagsVAR_4 & VAR_4OPT_STRINGVAR_4) { VAR_4charVAR_4 *VAR_4strVAR_4; VAR_4strVAR_4 = VAR_4av_strdupVAR_4(VAR_4argVAR_4); *VAR_4poVAR_4->VAR_4uVAR_4.VAR_4str_argVAR_4 = VAR_4strVAR_4; } VAR_4elseVAR_4 VAR_4ifVAR_4 (VAR_4poVAR_4->VAR_4flagsVAR_4 & VAR_4OPT_BOOLVAR_4) { *VAR_4poVAR_4->VAR_4uVAR_4.VAR_4int_argVAR_4 = VAR_4bool_valVAR_4; } VAR_4elseVAR_4 VAR_4ifVAR_4 (VAR_4poVAR_4->VAR_4flagsVAR_4 & VAR_4OPT_INTVAR_4) { *VAR_4poVAR_4->VAR_4uVAR_4.VAR_4int_argVAR_4 = VAR_4parse_number_or_dieVAR_4(VAR_4optVAR_4, VAR_4argVAR_4, VAR_4OPT_INT64VAR_4, VAR_4INT_MINVAR_4, VAR_4INT_MAXVAR_4); } VAR_4elseVAR_4 VAR_4ifVAR_4 (VAR_4poVAR_4->VAR_4flagsVAR_4 & VAR_4OPT_INT64VAR_4) { *VAR_4poVAR_4->VAR_4uVAR_4.VAR_4int64_argVAR_4 = VAR_4parse_number_or_dieVAR_4(VAR_4optVAR_4, VAR_4argVAR_4, VAR_4OPT_INT64VAR_4, VAR_4INT64_MINVAR_4, VAR_4INT64_MAXVAR_4); } VAR_4elseVAR_4 VAR_4ifVAR_4 (VAR_4poVAR_4->VAR_4flagsVAR_4 & VAR_4OPT_FLOATVAR_4) { *VAR_4poVAR_4->VAR_4uVAR_4.VAR_4float_argVAR_4 = VAR_4parse_number_or_dieVAR_4(VAR_4optVAR_4, VAR_4argVAR_4, VAR_4OPT_FLOATVAR_4, -VAR_41VAR_4.VAR_40VAR_4/VAR_40VAR_4.VAR_40VAR_4, VAR_41VAR_4.VAR_40VAR_4/VAR_40VAR_4.VAR_40VAR_4); } VAR_4elseVAR_4 VAR_4ifVAR_4 (VAR_4poVAR_4->VAR_4flagsVAR_4 & VAR_4OPT_FUNC2VAR_4) { VAR_4ifVAR_4(VAR_4poVAR_4->VAR_4uVAR_4.VAR_4func2_argVAR_4(VAR_4optVAR_4, VAR_4argVAR_4)<VAR_40VAR_4) VAR_4gotoVAR_4 VAR_4unknown_optVAR_4; } VAR_4elseVAR_4 { VAR_4poVAR_4->VAR_4uVAR_4.VAR_4func_argVAR_4(VAR_4argVAR_4); } VAR_4ifVAR_4(VAR_4poVAR_4->VAR_4flagsVAR_4 & VAR_4OPT_EXITVAR_4) VAR_4exitVAR_4(VAR_40VAR_4); } VAR_4elseVAR_4 { VAR_4ifVAR_4 (VAR_4VAR_3VAR_4) VAR_4VAR_3VAR_4(VAR_4optVAR_4); } } }
[ "VAR_4voidVAR_4 VAR_4parse_optionsVAR_4(VAR_4intVAR_4 VAR_4VAR_0VAR_4, VAR_4charVAR_4 **VAR_4VAR_1VAR_4, VAR_4constVAR_4 VAR_4OptionDefVAR_4 *VAR_4VAR_2VAR_4,\nVAR_4voidVAR_4 (* VAR_4VAR_3VAR_4)(VAR_4constVAR_4 VAR_4charVAR_4*))\n{", "VAR_4constVAR_4 VAR_4charVAR_4 *VAR_4optVAR_4, *VAR_4argVAR_4;", "VAR_4intVAR_4 VAR_4optindexVAR_4, VAR_4handleoptionsVAR_4=VAR_41VAR_4;", "VAR_4constVAR_4 VAR_4OptionDefVAR_4 *VAR_4poVAR_4;", "VAR_4optindexVAR_4 = VAR_41VAR_4;", "VAR_4whileVAR_4 (VAR_4optindexVAR_4 < VAR_4VAR_0VAR_4) {", "VAR_4optVAR_4 = VAR_4VAR_1VAR_4[VAR_4optindexVAR_4++];", "VAR_4ifVAR_4 (VAR_4handleoptionsVAR_4 && VAR_4optVAR_4[VAR_40VAR_4] == '-' && VAR_4optVAR_4[VAR_41VAR_4] != '\\VAR_40VAR_4') {", "VAR_4intVAR_4 VAR_4bool_valVAR_4 = VAR_41VAR_4;", "VAR_4ifVAR_4 (VAR_4optVAR_4[VAR_41VAR_4] == '-' && VAR_4optVAR_4[VAR_42VAR_4] == '\\VAR_40VAR_4') {", "VAR_4handleoptionsVAR_4 = VAR_40VAR_4;", "VAR_4continueVAR_4;", "}", "VAR_4optVAR_4++;", "VAR_4poVAR_4= VAR_4find_optionVAR_4(VAR_4VAR_2VAR_4, VAR_4optVAR_4);", "VAR_4ifVAR_4 (!VAR_4poVAR_4->VAR_4nameVAR_4 && VAR_4optVAR_4[VAR_40VAR_4] == 'VAR_4nVAR_4' && VAR_4optVAR_4[VAR_41VAR_4] == 'VAR_4oVAR_4') {", "VAR_4poVAR_4 = VAR_4find_optionVAR_4(VAR_4VAR_2VAR_4, VAR_4optVAR_4 + VAR_42VAR_4);", "VAR_4ifVAR_4 (!(VAR_4poVAR_4->VAR_4nameVAR_4 && (VAR_4poVAR_4->VAR_4flagsVAR_4 & VAR_4OPT_BOOLVAR_4)))\nVAR_4gotoVAR_4 VAR_4unknown_optVAR_4;", "VAR_4bool_valVAR_4 = VAR_40VAR_4;", "}", "VAR_4ifVAR_4 (!VAR_4poVAR_4->VAR_4nameVAR_4)\nVAR_4poVAR_4= VAR_4find_optionVAR_4(VAR_4VAR_2VAR_4, \"VAR_4defaultVAR_4\");", "VAR_4ifVAR_4 (!VAR_4poVAR_4->VAR_4nameVAR_4) {", "VAR_4unknown_optVAR_4:\nVAR_4fprintfVAR_4(VAR_4stderrVAR_4, \"%VAR_4sVAR_4: VAR_4unrecognizedVAR_4 VAR_4optionVAR_4 '%VAR_4sVAR_4'\\VAR_4nVAR_4\", VAR_4VAR_1VAR_4[VAR_40VAR_4], VAR_4optVAR_4);", "VAR_4exitVAR_4(VAR_41VAR_4);", "}", "VAR_4argVAR_4 = VAR_4NULLVAR_4;", "VAR_4ifVAR_4 (VAR_4poVAR_4->VAR_4flagsVAR_4 & VAR_4HAS_ARGVAR_4) {", "VAR_4argVAR_4 = VAR_4VAR_1VAR_4[VAR_4optindexVAR_4++];", "VAR_4ifVAR_4 (!VAR_4argVAR_4) {", "VAR_4fprintfVAR_4(VAR_4stderrVAR_4, \"%VAR_4sVAR_4: VAR_4missingVAR_4 VAR_4argumentVAR_4 VAR_4forVAR_4 VAR_4optionVAR_4 '%VAR_4sVAR_4'\\VAR_4nVAR_4\", VAR_4VAR_1VAR_4[VAR_40VAR_4], VAR_4optVAR_4);", "VAR_4exitVAR_4(VAR_41VAR_4);", "}", "}", "VAR_4ifVAR_4 (VAR_4poVAR_4->VAR_4flagsVAR_4 & VAR_4OPT_STRINGVAR_4) {", "VAR_4charVAR_4 *VAR_4strVAR_4;", "VAR_4strVAR_4 = VAR_4av_strdupVAR_4(VAR_4argVAR_4);", "*VAR_4poVAR_4->VAR_4uVAR_4.VAR_4str_argVAR_4 = VAR_4strVAR_4;", "} VAR_4elseVAR_4 VAR_4ifVAR_4 (VAR_4poVAR_4->VAR_4flagsVAR_4 & VAR_4OPT_BOOLVAR_4) {", "*VAR_4poVAR_4->VAR_4uVAR_4.VAR_4int_argVAR_4 = VAR_4bool_valVAR_4;", "} VAR_4elseVAR_4 VAR_4ifVAR_4 (VAR_4poVAR_4->VAR_4flagsVAR_4 & VAR_4OPT_INTVAR_4) {", "*VAR_4poVAR_4->VAR_4uVAR_4.VAR_4int_argVAR_4 = VAR_4parse_number_or_dieVAR_4(VAR_4optVAR_4, VAR_4argVAR_4, VAR_4OPT_INT64VAR_4, VAR_4INT_MINVAR_4, VAR_4INT_MAXVAR_4);", "} VAR_4elseVAR_4 VAR_4ifVAR_4 (VAR_4poVAR_4->VAR_4flagsVAR_4 & VAR_4OPT_INT64VAR_4) {", "*VAR_4poVAR_4->VAR_4uVAR_4.VAR_4int64_argVAR_4 = VAR_4parse_number_or_dieVAR_4(VAR_4optVAR_4, VAR_4argVAR_4, VAR_4OPT_INT64VAR_4, VAR_4INT64_MINVAR_4, VAR_4INT64_MAXVAR_4);", "} VAR_4elseVAR_4 VAR_4ifVAR_4 (VAR_4poVAR_4->VAR_4flagsVAR_4 & VAR_4OPT_FLOATVAR_4) {", "*VAR_4poVAR_4->VAR_4uVAR_4.VAR_4float_argVAR_4 = VAR_4parse_number_or_dieVAR_4(VAR_4optVAR_4, VAR_4argVAR_4, VAR_4OPT_FLOATVAR_4, -VAR_41VAR_4.VAR_40VAR_4/VAR_40VAR_4.VAR_40VAR_4, VAR_41VAR_4.VAR_40VAR_4/VAR_40VAR_4.VAR_40VAR_4);", "} VAR_4elseVAR_4 VAR_4ifVAR_4 (VAR_4poVAR_4->VAR_4flagsVAR_4 & VAR_4OPT_FUNC2VAR_4) {", "VAR_4ifVAR_4(VAR_4poVAR_4->VAR_4uVAR_4.VAR_4func2_argVAR_4(VAR_4optVAR_4, VAR_4argVAR_4)<VAR_40VAR_4)\nVAR_4gotoVAR_4 VAR_4unknown_optVAR_4;", "} VAR_4elseVAR_4 {", "VAR_4poVAR_4->VAR_4uVAR_4.VAR_4func_argVAR_4(VAR_4argVAR_4);", "}", "VAR_4ifVAR_4(VAR_4poVAR_4->VAR_4flagsVAR_4 & VAR_4OPT_EXITVAR_4)\nVAR_4exitVAR_4(VAR_40VAR_4);", "} VAR_4elseVAR_4 {", "VAR_4ifVAR_4 (VAR_4VAR_3VAR_4)\nVAR_4VAR_3VAR_4(VAR_4optVAR_4);", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47, 49 ], [ 51 ], [ 53 ], [ 55, 57 ], [ 59 ], [ 61, 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 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 ] ]
13,955
static int dma_buf_rw(BMDMAState *bm, int is_write) { IDEState *s = bmdma_active_if(bm); struct { uint32_t addr; uint32_t size; } prd; int l, len; for(;;) { l = s->io_buffer_size - s->io_buffer_index; if (l <= 0) break; if (bm->cur_prd_len == 0) { /* end of table (with a fail safe of one page) */ if (bm->cur_prd_last || (bm->cur_addr - bm->addr) >= 4096) return 0; cpu_physical_memory_read(bm->cur_addr, (uint8_t *)&prd, 8); bm->cur_addr += 8; prd.addr = le32_to_cpu(prd.addr); prd.size = le32_to_cpu(prd.size); len = prd.size & 0xfffe; if (len == 0) len = 0x10000; bm->cur_prd_len = len; bm->cur_prd_addr = prd.addr; bm->cur_prd_last = (prd.size & 0x80000000); } if (l > bm->cur_prd_len) l = bm->cur_prd_len; if (l > 0) { if (is_write) { cpu_physical_memory_write(bm->cur_prd_addr, s->io_buffer + s->io_buffer_index, l); } else { cpu_physical_memory_read(bm->cur_prd_addr, s->io_buffer + s->io_buffer_index, l); } bm->cur_prd_addr += l; bm->cur_prd_len -= l; s->io_buffer_index += l; } } return 1; }
false
qemu
f7736b91c40a617e93505e32dcbd2cb56aad8a23
static int dma_buf_rw(BMDMAState *bm, int is_write) { IDEState *s = bmdma_active_if(bm); struct { uint32_t addr; uint32_t size; } prd; int l, len; for(;;) { l = s->io_buffer_size - s->io_buffer_index; if (l <= 0) break; if (bm->cur_prd_len == 0) { if (bm->cur_prd_last || (bm->cur_addr - bm->addr) >= 4096) return 0; cpu_physical_memory_read(bm->cur_addr, (uint8_t *)&prd, 8); bm->cur_addr += 8; prd.addr = le32_to_cpu(prd.addr); prd.size = le32_to_cpu(prd.size); len = prd.size & 0xfffe; if (len == 0) len = 0x10000; bm->cur_prd_len = len; bm->cur_prd_addr = prd.addr; bm->cur_prd_last = (prd.size & 0x80000000); } if (l > bm->cur_prd_len) l = bm->cur_prd_len; if (l > 0) { if (is_write) { cpu_physical_memory_write(bm->cur_prd_addr, s->io_buffer + s->io_buffer_index, l); } else { cpu_physical_memory_read(bm->cur_prd_addr, s->io_buffer + s->io_buffer_index, l); } bm->cur_prd_addr += l; bm->cur_prd_len -= l; s->io_buffer_index += l; } } return 1; }
{ "code": [], "line_no": [] }
static int FUNC_0(BMDMAState *VAR_0, int VAR_1) { IDEState *s = bmdma_active_if(VAR_0); struct { uint32_t addr; uint32_t size; } VAR_2; int VAR_3, VAR_4; for(;;) { VAR_3 = s->io_buffer_size - s->io_buffer_index; if (VAR_3 <= 0) break; if (VAR_0->cur_prd_len == 0) { if (VAR_0->cur_prd_last || (VAR_0->cur_addr - VAR_0->addr) >= 4096) return 0; cpu_physical_memory_read(VAR_0->cur_addr, (uint8_t *)&VAR_2, 8); VAR_0->cur_addr += 8; VAR_2.addr = le32_to_cpu(VAR_2.addr); VAR_2.size = le32_to_cpu(VAR_2.size); VAR_4 = VAR_2.size & 0xfffe; if (VAR_4 == 0) VAR_4 = 0x10000; VAR_0->cur_prd_len = VAR_4; VAR_0->cur_prd_addr = VAR_2.addr; VAR_0->cur_prd_last = (VAR_2.size & 0x80000000); } if (VAR_3 > VAR_0->cur_prd_len) VAR_3 = VAR_0->cur_prd_len; if (VAR_3 > 0) { if (VAR_1) { cpu_physical_memory_write(VAR_0->cur_prd_addr, s->io_buffer + s->io_buffer_index, VAR_3); } else { cpu_physical_memory_read(VAR_0->cur_prd_addr, s->io_buffer + s->io_buffer_index, VAR_3); } VAR_0->cur_prd_addr += VAR_3; VAR_0->cur_prd_len -= VAR_3; s->io_buffer_index += VAR_3; } } return 1; }
[ "static int FUNC_0(BMDMAState *VAR_0, int VAR_1)\n{", "IDEState *s = bmdma_active_if(VAR_0);", "struct {", "uint32_t addr;", "uint32_t size;", "} VAR_2;", "int VAR_3, VAR_4;", "for(;;) {", "VAR_3 = s->io_buffer_size - s->io_buffer_index;", "if (VAR_3 <= 0)\nbreak;", "if (VAR_0->cur_prd_len == 0) {", "if (VAR_0->cur_prd_last ||\n(VAR_0->cur_addr - VAR_0->addr) >= 4096)\nreturn 0;", "cpu_physical_memory_read(VAR_0->cur_addr, (uint8_t *)&VAR_2, 8);", "VAR_0->cur_addr += 8;", "VAR_2.addr = le32_to_cpu(VAR_2.addr);", "VAR_2.size = le32_to_cpu(VAR_2.size);", "VAR_4 = VAR_2.size & 0xfffe;", "if (VAR_4 == 0)\nVAR_4 = 0x10000;", "VAR_0->cur_prd_len = VAR_4;", "VAR_0->cur_prd_addr = VAR_2.addr;", "VAR_0->cur_prd_last = (VAR_2.size & 0x80000000);", "}", "if (VAR_3 > VAR_0->cur_prd_len)\nVAR_3 = VAR_0->cur_prd_len;", "if (VAR_3 > 0) {", "if (VAR_1) {", "cpu_physical_memory_write(VAR_0->cur_prd_addr,\ns->io_buffer + s->io_buffer_index, VAR_3);", "} else {", "cpu_physical_memory_read(VAR_0->cur_prd_addr,\ns->io_buffer + s->io_buffer_index, VAR_3);", "}", "VAR_0->cur_prd_addr += VAR_3;", "VAR_0->cur_prd_len -= VAR_3;", "s->io_buffer_index += VAR_3;", "}", "}", "return 1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 31, 33, 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47, 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59, 61 ], [ 63 ], [ 65 ], [ 67, 69 ], [ 71 ], [ 73, 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ] ]
13,956
static void eepro100_cu_command(EEPRO100State * s, uint8_t val) { eepro100_tx_t tx; uint32_t cb_address; switch (val) { case CU_NOP: /* No operation. */ break; case CU_START: if (get_cu_state(s) != cu_idle) { /* Intel documentation says that CU must be idle for the CU * start command. Intel driver for Linux also starts the CU * from suspended state. */ logout("CU state is %u, should be %u\n", get_cu_state(s), cu_idle); //~ assert(!"wrong CU state"); } set_cu_state(s, cu_active); s->cu_offset = s->pointer; next_command: cb_address = s->cu_base + s->cu_offset; cpu_physical_memory_read(cb_address, (uint8_t *) & tx, sizeof(tx)); uint16_t status = le16_to_cpu(tx.status); uint16_t command = le16_to_cpu(tx.command); logout ("val=0x%02x (cu start), status=0x%04x, command=0x%04x, link=0x%08x\n", val, status, command, tx.link); bool bit_el = ((command & 0x8000) != 0); bool bit_s = ((command & 0x4000) != 0); bool bit_i = ((command & 0x2000) != 0); bool bit_nc = ((command & 0x0010) != 0); bool success = true; //~ bool bit_sf = ((command & 0x0008) != 0); uint16_t cmd = command & 0x0007; s->cu_offset = le32_to_cpu(tx.link); switch (cmd) { case CmdNOp: /* Do nothing. */ break; case CmdIASetup: cpu_physical_memory_read(cb_address + 8, &s->macaddr[0], 6); TRACE(OTHER, logout("macaddr: %s\n", nic_dump(&s->macaddr[0], 6))); break; case CmdConfigure: cpu_physical_memory_read(cb_address + 8, &s->configuration[0], sizeof(s->configuration)); TRACE(OTHER, logout("configuration: %s\n", nic_dump(&s->configuration[0], 16))); break; case CmdMulticastList: //~ missing("multicast list"); break; case CmdTx: (void)0; uint32_t tbd_array = le32_to_cpu(tx.tx_desc_addr); uint16_t tcb_bytes = (le16_to_cpu(tx.tcb_bytes) & 0x3fff); TRACE(RXTX, logout ("transmit, TBD array address 0x%08x, TCB byte count 0x%04x, TBD count %u\n", tbd_array, tcb_bytes, tx.tbd_count)); if (bit_nc) { missing("CmdTx: NC = 0"); success = false; break; } //~ assert(!bit_sf); if (tcb_bytes > 2600) { logout("TCB byte count too large, using 2600\n"); tcb_bytes = 2600; } /* Next assertion fails for local configuration. */ //~ assert((tcb_bytes > 0) || (tbd_array != 0xffffffff)); if (!((tcb_bytes > 0) || (tbd_array != 0xffffffff))) { logout ("illegal values of TBD array address and TCB byte count!\n"); } // sends larger than MAX_ETH_FRAME_SIZE are allowed, up to 2600 bytes uint8_t buf[2600]; uint16_t size = 0; uint32_t tbd_address = cb_address + 0x10; assert(tcb_bytes <= sizeof(buf)); while (size < tcb_bytes) { uint32_t tx_buffer_address = ldl_phys(tbd_address); uint16_t tx_buffer_size = lduw_phys(tbd_address + 4); //~ uint16_t tx_buffer_el = lduw_phys(tbd_address + 6); tbd_address += 8; TRACE(RXTX, logout ("TBD (simplified mode): buffer address 0x%08x, size 0x%04x\n", tx_buffer_address, tx_buffer_size)); tx_buffer_size = MIN(tx_buffer_size, sizeof(buf) - size); cpu_physical_memory_read(tx_buffer_address, &buf[size], tx_buffer_size); size += tx_buffer_size; } if (tbd_array == 0xffffffff) { /* Simplified mode. Was already handled by code above. */ } else { /* Flexible mode. */ uint8_t tbd_count = 0; if (device_supports_eTxCB(s) && !(s->configuration[6] & BIT(4))) { /* Extended Flexible TCB. */ for (; tbd_count < 2; tbd_count++) { uint32_t tx_buffer_address = ldl_phys(tbd_address); uint16_t tx_buffer_size = lduw_phys(tbd_address + 4); uint16_t tx_buffer_el = lduw_phys(tbd_address + 6); tbd_address += 8; TRACE(RXTX, logout ("TBD (extended flexible mode): buffer address 0x%08x, size 0x%04x\n", tx_buffer_address, tx_buffer_size)); tx_buffer_size = MIN(tx_buffer_size, sizeof(buf) - size); cpu_physical_memory_read(tx_buffer_address, &buf[size], tx_buffer_size); size += tx_buffer_size; if (tx_buffer_el & 1) { break; } } } tbd_address = tbd_array; for (; tbd_count < tx.tbd_count; tbd_count++) { uint32_t tx_buffer_address = ldl_phys(tbd_address); uint16_t tx_buffer_size = lduw_phys(tbd_address + 4); uint16_t tx_buffer_el = lduw_phys(tbd_address + 6); tbd_address += 8; TRACE(RXTX, logout ("TBD (flexible mode): buffer address 0x%08x, size 0x%04x\n", tx_buffer_address, tx_buffer_size)); tx_buffer_size = MIN(tx_buffer_size, sizeof(buf) - size); cpu_physical_memory_read(tx_buffer_address, &buf[size], tx_buffer_size); size += tx_buffer_size; if (tx_buffer_el & 1) { break; } } } TRACE(RXTX, logout("%p sending frame, len=%d,%s\n", s, size, nic_dump(buf, size))); qemu_send_packet(s->vc, buf, size); s->statistics.tx_good_frames++; /* Transmit with bad status would raise an CX/TNO interrupt. * (82557 only). Emulation never has bad status. */ //~ eepro100_cx_interrupt(s); break; case CmdTDR: TRACE(OTHER, logout("load microcode\n")); /* Starting with offset 8, the command contains * 64 dwords microcode which we just ignore here. */ break; default: missing("undefined command"); success = false; break; } /* Write new status. */ stw_phys(cb_address, status | 0x8000 | (success ? 0x2000 : 0)); if (bit_i) { /* CU completed action. */ eepro100_cx_interrupt(s); } if (bit_el) { /* CU becomes idle. Terminate command loop. */ set_cu_state(s, cu_idle); eepro100_cna_interrupt(s); } else if (bit_s) { /* CU becomes suspended. */ set_cu_state(s, cu_suspended); eepro100_cna_interrupt(s); } else { /* More entries in list. */ TRACE(OTHER, logout("CU list with at least one more entry\n")); goto next_command; } TRACE(OTHER, logout("CU list empty\n")); /* List is empty. Now CU is idle or suspended. */ break; case CU_RESUME: if (get_cu_state(s) != cu_suspended) { logout("bad CU resume from CU state %u\n", get_cu_state(s)); /* Workaround for bad Linux eepro100 driver which resumes * from idle state. */ //~ missing("cu resume"); set_cu_state(s, cu_suspended); } if (get_cu_state(s) == cu_suspended) { TRACE(OTHER, logout("CU resuming\n")); set_cu_state(s, cu_active); goto next_command; } break; case CU_STATSADDR: /* Load dump counters address. */ s->statsaddr = s->pointer; TRACE(OTHER, logout("val=0x%02x (status address)\n", val)); break; case CU_SHOWSTATS: /* Dump statistical counters. */ TRACE(OTHER, logout("val=0x%02x (dump stats)\n", val)); dump_statistics(s); break; case CU_CMD_BASE: /* Load CU base. */ TRACE(OTHER, logout("val=0x%02x (CU base address)\n", val)); s->cu_base = s->pointer; break; case CU_DUMPSTATS: /* Dump and reset statistical counters. */ TRACE(OTHER, logout("val=0x%02x (dump stats and reset)\n", val)); dump_statistics(s); memset(&s->statistics, 0, sizeof(s->statistics)); break; case CU_SRESUME: /* CU static resume. */ missing("CU static resume"); break; default: missing("Undefined CU command"); } }
false
qemu
5fa9a0ae49a01536a403f38e39222c3e8cc964c5
static void eepro100_cu_command(EEPRO100State * s, uint8_t val) { eepro100_tx_t tx; uint32_t cb_address; switch (val) { case CU_NOP: break; case CU_START: if (get_cu_state(s) != cu_idle) { logout("CU state is %u, should be %u\n", get_cu_state(s), cu_idle); } set_cu_state(s, cu_active); s->cu_offset = s->pointer; next_command: cb_address = s->cu_base + s->cu_offset; cpu_physical_memory_read(cb_address, (uint8_t *) & tx, sizeof(tx)); uint16_t status = le16_to_cpu(tx.status); uint16_t command = le16_to_cpu(tx.command); logout ("val=0x%02x (cu start), status=0x%04x, command=0x%04x, link=0x%08x\n", val, status, command, tx.link); bool bit_el = ((command & 0x8000) != 0); bool bit_s = ((command & 0x4000) != 0); bool bit_i = ((command & 0x2000) != 0); bool bit_nc = ((command & 0x0010) != 0); bool success = true; uint16_t cmd = command & 0x0007; s->cu_offset = le32_to_cpu(tx.link); switch (cmd) { case CmdNOp: break; case CmdIASetup: cpu_physical_memory_read(cb_address + 8, &s->macaddr[0], 6); TRACE(OTHER, logout("macaddr: %s\n", nic_dump(&s->macaddr[0], 6))); break; case CmdConfigure: cpu_physical_memory_read(cb_address + 8, &s->configuration[0], sizeof(s->configuration)); TRACE(OTHER, logout("configuration: %s\n", nic_dump(&s->configuration[0], 16))); break; case CmdMulticastList: break; case CmdTx: (void)0; uint32_t tbd_array = le32_to_cpu(tx.tx_desc_addr); uint16_t tcb_bytes = (le16_to_cpu(tx.tcb_bytes) & 0x3fff); TRACE(RXTX, logout ("transmit, TBD array address 0x%08x, TCB byte count 0x%04x, TBD count %u\n", tbd_array, tcb_bytes, tx.tbd_count)); if (bit_nc) { missing("CmdTx: NC = 0"); success = false; break; } if (tcb_bytes > 2600) { logout("TCB byte count too large, using 2600\n"); tcb_bytes = 2600; } if (!((tcb_bytes > 0) || (tbd_array != 0xffffffff))) { logout ("illegal values of TBD array address and TCB byte count!\n"); } uint8_t buf[2600]; uint16_t size = 0; uint32_t tbd_address = cb_address + 0x10; assert(tcb_bytes <= sizeof(buf)); while (size < tcb_bytes) { uint32_t tx_buffer_address = ldl_phys(tbd_address); uint16_t tx_buffer_size = lduw_phys(tbd_address + 4); tbd_address += 8; TRACE(RXTX, logout ("TBD (simplified mode): buffer address 0x%08x, size 0x%04x\n", tx_buffer_address, tx_buffer_size)); tx_buffer_size = MIN(tx_buffer_size, sizeof(buf) - size); cpu_physical_memory_read(tx_buffer_address, &buf[size], tx_buffer_size); size += tx_buffer_size; } if (tbd_array == 0xffffffff) { } else { uint8_t tbd_count = 0; if (device_supports_eTxCB(s) && !(s->configuration[6] & BIT(4))) { for (; tbd_count < 2; tbd_count++) { uint32_t tx_buffer_address = ldl_phys(tbd_address); uint16_t tx_buffer_size = lduw_phys(tbd_address + 4); uint16_t tx_buffer_el = lduw_phys(tbd_address + 6); tbd_address += 8; TRACE(RXTX, logout ("TBD (extended flexible mode): buffer address 0x%08x, size 0x%04x\n", tx_buffer_address, tx_buffer_size)); tx_buffer_size = MIN(tx_buffer_size, sizeof(buf) - size); cpu_physical_memory_read(tx_buffer_address, &buf[size], tx_buffer_size); size += tx_buffer_size; if (tx_buffer_el & 1) { break; } } } tbd_address = tbd_array; for (; tbd_count < tx.tbd_count; tbd_count++) { uint32_t tx_buffer_address = ldl_phys(tbd_address); uint16_t tx_buffer_size = lduw_phys(tbd_address + 4); uint16_t tx_buffer_el = lduw_phys(tbd_address + 6); tbd_address += 8; TRACE(RXTX, logout ("TBD (flexible mode): buffer address 0x%08x, size 0x%04x\n", tx_buffer_address, tx_buffer_size)); tx_buffer_size = MIN(tx_buffer_size, sizeof(buf) - size); cpu_physical_memory_read(tx_buffer_address, &buf[size], tx_buffer_size); size += tx_buffer_size; if (tx_buffer_el & 1) { break; } } } TRACE(RXTX, logout("%p sending frame, len=%d,%s\n", s, size, nic_dump(buf, size))); qemu_send_packet(s->vc, buf, size); s->statistics.tx_good_frames++; break; case CmdTDR: TRACE(OTHER, logout("load microcode\n")); break; default: missing("undefined command"); success = false; break; } stw_phys(cb_address, status | 0x8000 | (success ? 0x2000 : 0)); if (bit_i) { eepro100_cx_interrupt(s); } if (bit_el) { set_cu_state(s, cu_idle); eepro100_cna_interrupt(s); } else if (bit_s) { set_cu_state(s, cu_suspended); eepro100_cna_interrupt(s); } else { TRACE(OTHER, logout("CU list with at least one more entry\n")); goto next_command; } TRACE(OTHER, logout("CU list empty\n")); break; case CU_RESUME: if (get_cu_state(s) != cu_suspended) { logout("bad CU resume from CU state %u\n", get_cu_state(s)); set_cu_state(s, cu_suspended); } if (get_cu_state(s) == cu_suspended) { TRACE(OTHER, logout("CU resuming\n")); set_cu_state(s, cu_active); goto next_command; } break; case CU_STATSADDR: s->statsaddr = s->pointer; TRACE(OTHER, logout("val=0x%02x (status address)\n", val)); break; case CU_SHOWSTATS: TRACE(OTHER, logout("val=0x%02x (dump stats)\n", val)); dump_statistics(s); break; case CU_CMD_BASE: TRACE(OTHER, logout("val=0x%02x (CU base address)\n", val)); s->cu_base = s->pointer; break; case CU_DUMPSTATS: TRACE(OTHER, logout("val=0x%02x (dump stats and reset)\n", val)); dump_statistics(s); memset(&s->statistics, 0, sizeof(s->statistics)); break; case CU_SRESUME: missing("CU static resume"); break; default: missing("Undefined CU command"); } }
{ "code": [], "line_no": [] }
static void FUNC_0(EEPRO100State * VAR_0, uint8_t VAR_1) { eepro100_tx_t tx; uint32_t cb_address; switch (VAR_1) { case CU_NOP: break; case CU_START: if (get_cu_state(VAR_0) != cu_idle) { logout("CU state is %u, should be %u\n", get_cu_state(VAR_0), cu_idle); } set_cu_state(VAR_0, cu_active); VAR_0->cu_offset = VAR_0->pointer; next_command: cb_address = VAR_0->cu_base + VAR_0->cu_offset; cpu_physical_memory_read(cb_address, (uint8_t *) & tx, sizeof(tx)); uint16_t status = le16_to_cpu(tx.status); uint16_t command = le16_to_cpu(tx.command); logout ("VAR_1=0x%02x (cu start), status=0x%04x, command=0x%04x, link=0x%08x\n", VAR_1, status, command, tx.link); bool bit_el = ((command & 0x8000) != 0); bool bit_s = ((command & 0x4000) != 0); bool bit_i = ((command & 0x2000) != 0); bool bit_nc = ((command & 0x0010) != 0); bool success = true; uint16_t cmd = command & 0x0007; VAR_0->cu_offset = le32_to_cpu(tx.link); switch (cmd) { case CmdNOp: break; case CmdIASetup: cpu_physical_memory_read(cb_address + 8, &VAR_0->macaddr[0], 6); TRACE(OTHER, logout("macaddr: %VAR_0\n", nic_dump(&VAR_0->macaddr[0], 6))); break; case CmdConfigure: cpu_physical_memory_read(cb_address + 8, &VAR_0->configuration[0], sizeof(VAR_0->configuration)); TRACE(OTHER, logout("configuration: %VAR_0\n", nic_dump(&VAR_0->configuration[0], 16))); break; case CmdMulticastList: break; case CmdTx: (void)0; uint32_t tbd_array = le32_to_cpu(tx.tx_desc_addr); uint16_t tcb_bytes = (le16_to_cpu(tx.tcb_bytes) & 0x3fff); TRACE(RXTX, logout ("transmit, TBD array address 0x%08x, TCB byte count 0x%04x, TBD count %u\n", tbd_array, tcb_bytes, tx.tbd_count)); if (bit_nc) { missing("CmdTx: NC = 0"); success = false; break; } if (tcb_bytes > 2600) { logout("TCB byte count too large, using 2600\n"); tcb_bytes = 2600; } if (!((tcb_bytes > 0) || (tbd_array != 0xffffffff))) { logout ("illegal values of TBD array address and TCB byte count!\n"); } uint8_t buf[2600]; uint16_t size = 0; uint32_t tbd_address = cb_address + 0x10; assert(tcb_bytes <= sizeof(buf)); while (size < tcb_bytes) { uint32_t tx_buffer_address = ldl_phys(tbd_address); uint16_t tx_buffer_size = lduw_phys(tbd_address + 4); tbd_address += 8; TRACE(RXTX, logout ("TBD (simplified mode): buffer address 0x%08x, size 0x%04x\n", tx_buffer_address, tx_buffer_size)); tx_buffer_size = MIN(tx_buffer_size, sizeof(buf) - size); cpu_physical_memory_read(tx_buffer_address, &buf[size], tx_buffer_size); size += tx_buffer_size; } if (tbd_array == 0xffffffff) { } else { uint8_t tbd_count = 0; if (device_supports_eTxCB(VAR_0) && !(VAR_0->configuration[6] & BIT(4))) { for (; tbd_count < 2; tbd_count++) { uint32_t tx_buffer_address = ldl_phys(tbd_address); uint16_t tx_buffer_size = lduw_phys(tbd_address + 4); uint16_t tx_buffer_el = lduw_phys(tbd_address + 6); tbd_address += 8; TRACE(RXTX, logout ("TBD (extended flexible mode): buffer address 0x%08x, size 0x%04x\n", tx_buffer_address, tx_buffer_size)); tx_buffer_size = MIN(tx_buffer_size, sizeof(buf) - size); cpu_physical_memory_read(tx_buffer_address, &buf[size], tx_buffer_size); size += tx_buffer_size; if (tx_buffer_el & 1) { break; } } } tbd_address = tbd_array; for (; tbd_count < tx.tbd_count; tbd_count++) { uint32_t tx_buffer_address = ldl_phys(tbd_address); uint16_t tx_buffer_size = lduw_phys(tbd_address + 4); uint16_t tx_buffer_el = lduw_phys(tbd_address + 6); tbd_address += 8; TRACE(RXTX, logout ("TBD (flexible mode): buffer address 0x%08x, size 0x%04x\n", tx_buffer_address, tx_buffer_size)); tx_buffer_size = MIN(tx_buffer_size, sizeof(buf) - size); cpu_physical_memory_read(tx_buffer_address, &buf[size], tx_buffer_size); size += tx_buffer_size; if (tx_buffer_el & 1) { break; } } } TRACE(RXTX, logout("%p sending frame, len=%d,%VAR_0\n", VAR_0, size, nic_dump(buf, size))); qemu_send_packet(VAR_0->vc, buf, size); VAR_0->statistics.tx_good_frames++; break; case CmdTDR: TRACE(OTHER, logout("load microcode\n")); break; default: missing("undefined command"); success = false; break; } stw_phys(cb_address, status | 0x8000 | (success ? 0x2000 : 0)); if (bit_i) { eepro100_cx_interrupt(VAR_0); } if (bit_el) { set_cu_state(VAR_0, cu_idle); eepro100_cna_interrupt(VAR_0); } else if (bit_s) { set_cu_state(VAR_0, cu_suspended); eepro100_cna_interrupt(VAR_0); } else { TRACE(OTHER, logout("CU list with at least one more entry\n")); goto next_command; } TRACE(OTHER, logout("CU list empty\n")); break; case CU_RESUME: if (get_cu_state(VAR_0) != cu_suspended) { logout("bad CU resume from CU state %u\n", get_cu_state(VAR_0)); set_cu_state(VAR_0, cu_suspended); } if (get_cu_state(VAR_0) == cu_suspended) { TRACE(OTHER, logout("CU resuming\n")); set_cu_state(VAR_0, cu_active); goto next_command; } break; case CU_STATSADDR: VAR_0->statsaddr = VAR_0->pointer; TRACE(OTHER, logout("VAR_1=0x%02x (status address)\n", VAR_1)); break; case CU_SHOWSTATS: TRACE(OTHER, logout("VAR_1=0x%02x (dump stats)\n", VAR_1)); dump_statistics(VAR_0); break; case CU_CMD_BASE: TRACE(OTHER, logout("VAR_1=0x%02x (CU base address)\n", VAR_1)); VAR_0->cu_base = VAR_0->pointer; break; case CU_DUMPSTATS: TRACE(OTHER, logout("VAR_1=0x%02x (dump stats and reset)\n", VAR_1)); dump_statistics(VAR_0); memset(&VAR_0->statistics, 0, sizeof(VAR_0->statistics)); break; case CU_SRESUME: missing("CU static resume"); break; default: missing("Undefined CU command"); } }
[ "static void FUNC_0(EEPRO100State * VAR_0, uint8_t VAR_1)\n{", "eepro100_tx_t tx;", "uint32_t cb_address;", "switch (VAR_1) {", "case CU_NOP:\nbreak;", "case CU_START:\nif (get_cu_state(VAR_0) != cu_idle) {", "logout(\"CU state is %u, should be %u\\n\", get_cu_state(VAR_0), cu_idle);", "}", "set_cu_state(VAR_0, cu_active);", "VAR_0->cu_offset = VAR_0->pointer;", "next_command:\ncb_address = VAR_0->cu_base + VAR_0->cu_offset;", "cpu_physical_memory_read(cb_address, (uint8_t *) & tx, sizeof(tx));", "uint16_t status = le16_to_cpu(tx.status);", "uint16_t command = le16_to_cpu(tx.command);", "logout\n(\"VAR_1=0x%02x (cu start), status=0x%04x, command=0x%04x, link=0x%08x\\n\",\nVAR_1, status, command, tx.link);", "bool bit_el = ((command & 0x8000) != 0);", "bool bit_s = ((command & 0x4000) != 0);", "bool bit_i = ((command & 0x2000) != 0);", "bool bit_nc = ((command & 0x0010) != 0);", "bool success = true;", "uint16_t cmd = command & 0x0007;", "VAR_0->cu_offset = le32_to_cpu(tx.link);", "switch (cmd) {", "case CmdNOp:\nbreak;", "case CmdIASetup:\ncpu_physical_memory_read(cb_address + 8, &VAR_0->macaddr[0], 6);", "TRACE(OTHER, logout(\"macaddr: %VAR_0\\n\", nic_dump(&VAR_0->macaddr[0], 6)));", "break;", "case CmdConfigure:\ncpu_physical_memory_read(cb_address + 8, &VAR_0->configuration[0],\nsizeof(VAR_0->configuration));", "TRACE(OTHER, logout(\"configuration: %VAR_0\\n\", nic_dump(&VAR_0->configuration[0], 16)));", "break;", "case CmdMulticastList:\nbreak;", "case CmdTx:\n(void)0;", "uint32_t tbd_array = le32_to_cpu(tx.tx_desc_addr);", "uint16_t tcb_bytes = (le16_to_cpu(tx.tcb_bytes) & 0x3fff);", "TRACE(RXTX, logout\n(\"transmit, TBD array address 0x%08x, TCB byte count 0x%04x, TBD count %u\\n\",\ntbd_array, tcb_bytes, tx.tbd_count));", "if (bit_nc) {", "missing(\"CmdTx: NC = 0\");", "success = false;", "break;", "}", "if (tcb_bytes > 2600) {", "logout(\"TCB byte count too large, using 2600\\n\");", "tcb_bytes = 2600;", "}", "if (!((tcb_bytes > 0) || (tbd_array != 0xffffffff))) {", "logout\n(\"illegal values of TBD array address and TCB byte count!\\n\");", "}", "uint8_t buf[2600];", "uint16_t size = 0;", "uint32_t tbd_address = cb_address + 0x10;", "assert(tcb_bytes <= sizeof(buf));", "while (size < tcb_bytes) {", "uint32_t tx_buffer_address = ldl_phys(tbd_address);", "uint16_t tx_buffer_size = lduw_phys(tbd_address + 4);", "tbd_address += 8;", "TRACE(RXTX, logout\n(\"TBD (simplified mode): buffer address 0x%08x, size 0x%04x\\n\",\ntx_buffer_address, tx_buffer_size));", "tx_buffer_size = MIN(tx_buffer_size, sizeof(buf) - size);", "cpu_physical_memory_read(tx_buffer_address, &buf[size],\ntx_buffer_size);", "size += tx_buffer_size;", "}", "if (tbd_array == 0xffffffff) {", "} else {", "uint8_t tbd_count = 0;", "if (device_supports_eTxCB(VAR_0) && !(VAR_0->configuration[6] & BIT(4))) {", "for (; tbd_count < 2; tbd_count++) {", "uint32_t tx_buffer_address = ldl_phys(tbd_address);", "uint16_t tx_buffer_size = lduw_phys(tbd_address + 4);", "uint16_t tx_buffer_el = lduw_phys(tbd_address + 6);", "tbd_address += 8;", "TRACE(RXTX, logout\n(\"TBD (extended flexible mode): buffer address 0x%08x, size 0x%04x\\n\",\ntx_buffer_address, tx_buffer_size));", "tx_buffer_size = MIN(tx_buffer_size, sizeof(buf) - size);", "cpu_physical_memory_read(tx_buffer_address, &buf[size],\ntx_buffer_size);", "size += tx_buffer_size;", "if (tx_buffer_el & 1) {", "break;", "}", "}", "}", "tbd_address = tbd_array;", "for (; tbd_count < tx.tbd_count; tbd_count++) {", "uint32_t tx_buffer_address = ldl_phys(tbd_address);", "uint16_t tx_buffer_size = lduw_phys(tbd_address + 4);", "uint16_t tx_buffer_el = lduw_phys(tbd_address + 6);", "tbd_address += 8;", "TRACE(RXTX, logout\n(\"TBD (flexible mode): buffer address 0x%08x, size 0x%04x\\n\",\ntx_buffer_address, tx_buffer_size));", "tx_buffer_size = MIN(tx_buffer_size, sizeof(buf) - size);", "cpu_physical_memory_read(tx_buffer_address, &buf[size],\ntx_buffer_size);", "size += tx_buffer_size;", "if (tx_buffer_el & 1) {", "break;", "}", "}", "}", "TRACE(RXTX, logout(\"%p sending frame, len=%d,%VAR_0\\n\", VAR_0, size, nic_dump(buf, size)));", "qemu_send_packet(VAR_0->vc, buf, size);", "VAR_0->statistics.tx_good_frames++;", "break;", "case CmdTDR:\nTRACE(OTHER, logout(\"load microcode\\n\"));", "break;", "default:\nmissing(\"undefined command\");", "success = false;", "break;", "}", "stw_phys(cb_address, status | 0x8000 | (success ? 0x2000 : 0));", "if (bit_i) {", "eepro100_cx_interrupt(VAR_0);", "}", "if (bit_el) {", "set_cu_state(VAR_0, cu_idle);", "eepro100_cna_interrupt(VAR_0);", "} else if (bit_s) {", "set_cu_state(VAR_0, cu_suspended);", "eepro100_cna_interrupt(VAR_0);", "} else {", "TRACE(OTHER, logout(\"CU list with at least one more entry\\n\"));", "goto next_command;", "}", "TRACE(OTHER, logout(\"CU list empty\\n\"));", "break;", "case CU_RESUME:\nif (get_cu_state(VAR_0) != cu_suspended) {", "logout(\"bad CU resume from CU state %u\\n\", get_cu_state(VAR_0));", "set_cu_state(VAR_0, cu_suspended);", "}", "if (get_cu_state(VAR_0) == cu_suspended) {", "TRACE(OTHER, logout(\"CU resuming\\n\"));", "set_cu_state(VAR_0, cu_active);", "goto next_command;", "}", "break;", "case CU_STATSADDR:\nVAR_0->statsaddr = VAR_0->pointer;", "TRACE(OTHER, logout(\"VAR_1=0x%02x (status address)\\n\", VAR_1));", "break;", "case CU_SHOWSTATS:\nTRACE(OTHER, logout(\"VAR_1=0x%02x (dump stats)\\n\", VAR_1));", "dump_statistics(VAR_0);", "break;", "case CU_CMD_BASE:\nTRACE(OTHER, logout(\"VAR_1=0x%02x (CU base address)\\n\", VAR_1));", "VAR_0->cu_base = VAR_0->pointer;", "break;", "case CU_DUMPSTATS:\nTRACE(OTHER, logout(\"VAR_1=0x%02x (dump stats and reset)\\n\", VAR_1));", "dump_statistics(VAR_0);", "memset(&VAR_0->statistics, 0, sizeof(VAR_0->statistics));", "break;", "case CU_SRESUME:\nmissing(\"CU static resume\");", "break;", "default:\nmissing(\"Undefined CU command\");", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37, 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47, 49, 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ], [ 71, 75 ], [ 77, 79 ], [ 81 ], [ 83 ], [ 85, 87, 89 ], [ 91 ], [ 93 ], [ 95, 99 ], [ 101, 103 ], [ 105 ], [ 107 ], [ 109, 111, 113 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 141 ], [ 143, 145 ], [ 147 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 167 ], [ 169, 171, 173 ], [ 175 ], [ 177, 179 ], [ 181 ], [ 183 ], [ 185 ], [ 189 ], [ 193 ], [ 195 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209, 211, 213 ], [ 215 ], [ 217, 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245, 247, 249 ], [ 251 ], [ 253, 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 281 ], [ 283, 285 ], [ 291 ], [ 293, 295 ], [ 297 ], [ 299 ], [ 301 ], [ 305 ], [ 307 ], [ 311 ], [ 313 ], [ 315 ], [ 319 ], [ 321 ], [ 323 ], [ 327 ], [ 329 ], [ 331 ], [ 335 ], [ 337 ], [ 339 ], [ 341 ], [ 345 ], [ 347, 349 ], [ 351 ], [ 359 ], [ 361 ], [ 363 ], [ 365 ], [ 367 ], [ 369 ], [ 371 ], [ 373 ], [ 375, 379 ], [ 381 ], [ 383 ], [ 385, 389 ], [ 391 ], [ 393 ], [ 395, 399 ], [ 401 ], [ 403 ], [ 405, 409 ], [ 411 ], [ 413 ], [ 415 ], [ 417, 421 ], [ 423 ], [ 425, 427 ], [ 429 ], [ 431 ] ]
13,957
void HELPER(set_cp15)(CPUState *env, uint32_t insn, uint32_t val) { int op1; int op2; int crm; op1 = (insn >> 21) & 7; op2 = (insn >> 5) & 7; crm = insn & 0xf; switch ((insn >> 16) & 0xf) { case 0: /* ID codes. */ if (arm_feature(env, ARM_FEATURE_XSCALE)) break; if (arm_feature(env, ARM_FEATURE_OMAPCP)) break; if (arm_feature(env, ARM_FEATURE_V7) && op1 == 2 && crm == 0 && op2 == 0) { env->cp15.c0_cssel = val & 0xf; break; } goto bad_reg; case 1: /* System configuration. */ if (arm_feature(env, ARM_FEATURE_OMAPCP)) op2 = 0; switch (op2) { case 0: if (!arm_feature(env, ARM_FEATURE_XSCALE) || crm == 0) env->cp15.c1_sys = val; /* ??? Lots of these bits are not implemented. */ /* This may enable/disable the MMU, so do a TLB flush. */ tlb_flush(env, 1); break; case 1: /* Auxiliary cotrol register. */ if (arm_feature(env, ARM_FEATURE_XSCALE)) { env->cp15.c1_xscaleauxcr = val; break; } /* Not implemented. */ break; case 2: if (arm_feature(env, ARM_FEATURE_XSCALE)) goto bad_reg; if (env->cp15.c1_coproc != val) { env->cp15.c1_coproc = val; /* ??? Is this safe when called from within a TB? */ tb_flush(env); } break; default: goto bad_reg; } break; case 2: /* MMU Page table control / MPU cache control. */ if (arm_feature(env, ARM_FEATURE_MPU)) { switch (op2) { case 0: env->cp15.c2_data = val; break; case 1: env->cp15.c2_insn = val; break; default: goto bad_reg; } } else { switch (op2) { case 0: env->cp15.c2_base0 = val; break; case 1: env->cp15.c2_base1 = val; break; case 2: val &= 7; env->cp15.c2_control = val; env->cp15.c2_mask = ~(((uint32_t)0xffffffffu) >> val); env->cp15.c2_base_mask = ~((uint32_t)0x3fffu >> val); break; default: goto bad_reg; } } break; case 3: /* MMU Domain access control / MPU write buffer control. */ env->cp15.c3 = val; tlb_flush(env, 1); /* Flush TLB as domain not tracked in TLB */ break; case 4: /* Reserved. */ goto bad_reg; case 5: /* MMU Fault status / MPU access permission. */ if (arm_feature(env, ARM_FEATURE_OMAPCP)) op2 = 0; switch (op2) { case 0: if (arm_feature(env, ARM_FEATURE_MPU)) val = extended_mpu_ap_bits(val); env->cp15.c5_data = val; break; case 1: if (arm_feature(env, ARM_FEATURE_MPU)) val = extended_mpu_ap_bits(val); env->cp15.c5_insn = val; break; case 2: if (!arm_feature(env, ARM_FEATURE_MPU)) goto bad_reg; env->cp15.c5_data = val; break; case 3: if (!arm_feature(env, ARM_FEATURE_MPU)) goto bad_reg; env->cp15.c5_insn = val; break; default: goto bad_reg; } break; case 6: /* MMU Fault address / MPU base/size. */ if (arm_feature(env, ARM_FEATURE_MPU)) { if (crm >= 8) goto bad_reg; env->cp15.c6_region[crm] = val; } else { if (arm_feature(env, ARM_FEATURE_OMAPCP)) op2 = 0; switch (op2) { case 0: env->cp15.c6_data = val; break; case 1: /* ??? This is WFAR on armv6 */ case 2: env->cp15.c6_insn = val; break; default: goto bad_reg; } } break; case 7: /* Cache control. */ env->cp15.c15_i_max = 0x000; env->cp15.c15_i_min = 0xff0; /* No cache, so nothing to do. */ /* ??? MPCore has VA to PA translation functions. */ break; case 8: /* MMU TLB control. */ switch (op2) { case 0: /* Invalidate all. */ tlb_flush(env, 0); break; case 1: /* Invalidate single TLB entry. */ #if 0 /* ??? This is wrong for large pages and sections. */ /* As an ugly hack to make linux work we always flush a 4K pages. */ val &= 0xfffff000; tlb_flush_page(env, val); tlb_flush_page(env, val + 0x400); tlb_flush_page(env, val + 0x800); tlb_flush_page(env, val + 0xc00); #else tlb_flush(env, 1); #endif break; case 2: /* Invalidate on ASID. */ tlb_flush(env, val == 0); break; case 3: /* Invalidate single entry on MVA. */ /* ??? This is like case 1, but ignores ASID. */ tlb_flush(env, 1); break; default: goto bad_reg; } break; case 9: if (arm_feature(env, ARM_FEATURE_OMAPCP)) break; switch (crm) { case 0: /* Cache lockdown. */ switch (op1) { case 0: /* L1 cache. */ switch (op2) { case 0: env->cp15.c9_data = val; break; case 1: env->cp15.c9_insn = val; break; default: goto bad_reg; } break; case 1: /* L2 cache. */ /* Ignore writes to L2 lockdown/auxiliary registers. */ break; default: goto bad_reg; } break; case 1: /* TCM memory region registers. */ /* Not implemented. */ goto bad_reg; default: goto bad_reg; } break; case 10: /* MMU TLB lockdown. */ /* ??? TLB lockdown not implemented. */ break; case 12: /* Reserved. */ goto bad_reg; case 13: /* Process ID. */ switch (op2) { case 0: /* Unlike real hardware the qemu TLB uses virtual addresses, not modified virtual addresses, so this causes a TLB flush. */ if (env->cp15.c13_fcse != val) tlb_flush(env, 1); env->cp15.c13_fcse = val; break; case 1: /* This changes the ASID, so do a TLB flush. */ if (env->cp15.c13_context != val && !arm_feature(env, ARM_FEATURE_MPU)) tlb_flush(env, 0); env->cp15.c13_context = val; break; case 2: env->cp15.c13_tls1 = val; break; case 3: env->cp15.c13_tls2 = val; break; case 4: env->cp15.c13_tls3 = val; break; default: goto bad_reg; } break; case 14: /* Reserved. */ goto bad_reg; case 15: /* Implementation specific. */ if (arm_feature(env, ARM_FEATURE_XSCALE)) { if (op2 == 0 && crm == 1) { if (env->cp15.c15_cpar != (val & 0x3fff)) { /* Changes cp0 to cp13 behavior, so needs a TB flush. */ tb_flush(env); env->cp15.c15_cpar = val & 0x3fff; } break; } goto bad_reg; } if (arm_feature(env, ARM_FEATURE_OMAPCP)) { switch (crm) { case 0: break; case 1: /* Set TI925T configuration. */ env->cp15.c15_ticonfig = val & 0xe7; env->cp15.c0_cpuid = (val & (1 << 5)) ? /* OS_TYPE bit */ ARM_CPUID_TI915T : ARM_CPUID_TI925T; break; case 2: /* Set I_max. */ env->cp15.c15_i_max = val; break; case 3: /* Set I_min. */ env->cp15.c15_i_min = val; break; case 4: /* Set thread-ID. */ env->cp15.c15_threadid = val & 0xffff; break; case 8: /* Wait-for-interrupt (deprecated). */ cpu_interrupt(env, CPU_INTERRUPT_HALT); break; default: goto bad_reg; } } break; } return; bad_reg: /* ??? For debugging only. Should raise illegal instruction exception. */ cpu_abort(env, "Unimplemented cp15 register write (c%d, c%d, {%d, %d})\n", (insn >> 16) & 0xf, crm, op1, op2); }
false
qemu
f101cd885ec148761738638ae42f7c5162b6d445
void HELPER(set_cp15)(CPUState *env, uint32_t insn, uint32_t val) { int op1; int op2; int crm; op1 = (insn >> 21) & 7; op2 = (insn >> 5) & 7; crm = insn & 0xf; switch ((insn >> 16) & 0xf) { case 0: if (arm_feature(env, ARM_FEATURE_XSCALE)) break; if (arm_feature(env, ARM_FEATURE_OMAPCP)) break; if (arm_feature(env, ARM_FEATURE_V7) && op1 == 2 && crm == 0 && op2 == 0) { env->cp15.c0_cssel = val & 0xf; break; } goto bad_reg; case 1: if (arm_feature(env, ARM_FEATURE_OMAPCP)) op2 = 0; switch (op2) { case 0: if (!arm_feature(env, ARM_FEATURE_XSCALE) || crm == 0) env->cp15.c1_sys = val; tlb_flush(env, 1); break; case 1: if (arm_feature(env, ARM_FEATURE_XSCALE)) { env->cp15.c1_xscaleauxcr = val; break; } break; case 2: if (arm_feature(env, ARM_FEATURE_XSCALE)) goto bad_reg; if (env->cp15.c1_coproc != val) { env->cp15.c1_coproc = val; tb_flush(env); } break; default: goto bad_reg; } break; case 2: if (arm_feature(env, ARM_FEATURE_MPU)) { switch (op2) { case 0: env->cp15.c2_data = val; break; case 1: env->cp15.c2_insn = val; break; default: goto bad_reg; } } else { switch (op2) { case 0: env->cp15.c2_base0 = val; break; case 1: env->cp15.c2_base1 = val; break; case 2: val &= 7; env->cp15.c2_control = val; env->cp15.c2_mask = ~(((uint32_t)0xffffffffu) >> val); env->cp15.c2_base_mask = ~((uint32_t)0x3fffu >> val); break; default: goto bad_reg; } } break; case 3: env->cp15.c3 = val; tlb_flush(env, 1); break; case 4: goto bad_reg; case 5: if (arm_feature(env, ARM_FEATURE_OMAPCP)) op2 = 0; switch (op2) { case 0: if (arm_feature(env, ARM_FEATURE_MPU)) val = extended_mpu_ap_bits(val); env->cp15.c5_data = val; break; case 1: if (arm_feature(env, ARM_FEATURE_MPU)) val = extended_mpu_ap_bits(val); env->cp15.c5_insn = val; break; case 2: if (!arm_feature(env, ARM_FEATURE_MPU)) goto bad_reg; env->cp15.c5_data = val; break; case 3: if (!arm_feature(env, ARM_FEATURE_MPU)) goto bad_reg; env->cp15.c5_insn = val; break; default: goto bad_reg; } break; case 6: if (arm_feature(env, ARM_FEATURE_MPU)) { if (crm >= 8) goto bad_reg; env->cp15.c6_region[crm] = val; } else { if (arm_feature(env, ARM_FEATURE_OMAPCP)) op2 = 0; switch (op2) { case 0: env->cp15.c6_data = val; break; case 1: case 2: env->cp15.c6_insn = val; break; default: goto bad_reg; } } break; case 7: env->cp15.c15_i_max = 0x000; env->cp15.c15_i_min = 0xff0; break; case 8: switch (op2) { case 0: tlb_flush(env, 0); break; case 1: #if 0 val &= 0xfffff000; tlb_flush_page(env, val); tlb_flush_page(env, val + 0x400); tlb_flush_page(env, val + 0x800); tlb_flush_page(env, val + 0xc00); #else tlb_flush(env, 1); #endif break; case 2: tlb_flush(env, val == 0); break; case 3: tlb_flush(env, 1); break; default: goto bad_reg; } break; case 9: if (arm_feature(env, ARM_FEATURE_OMAPCP)) break; switch (crm) { case 0: switch (op1) { case 0: switch (op2) { case 0: env->cp15.c9_data = val; break; case 1: env->cp15.c9_insn = val; break; default: goto bad_reg; } break; case 1: break; default: goto bad_reg; } break; case 1: goto bad_reg; default: goto bad_reg; } break; case 10: break; case 12: goto bad_reg; case 13: switch (op2) { case 0: if (env->cp15.c13_fcse != val) tlb_flush(env, 1); env->cp15.c13_fcse = val; break; case 1: if (env->cp15.c13_context != val && !arm_feature(env, ARM_FEATURE_MPU)) tlb_flush(env, 0); env->cp15.c13_context = val; break; case 2: env->cp15.c13_tls1 = val; break; case 3: env->cp15.c13_tls2 = val; break; case 4: env->cp15.c13_tls3 = val; break; default: goto bad_reg; } break; case 14: goto bad_reg; case 15: if (arm_feature(env, ARM_FEATURE_XSCALE)) { if (op2 == 0 && crm == 1) { if (env->cp15.c15_cpar != (val & 0x3fff)) { tb_flush(env); env->cp15.c15_cpar = val & 0x3fff; } break; } goto bad_reg; } if (arm_feature(env, ARM_FEATURE_OMAPCP)) { switch (crm) { case 0: break; case 1: env->cp15.c15_ticonfig = val & 0xe7; env->cp15.c0_cpuid = (val & (1 << 5)) ? ARM_CPUID_TI915T : ARM_CPUID_TI925T; break; case 2: env->cp15.c15_i_max = val; break; case 3: env->cp15.c15_i_min = val; break; case 4: env->cp15.c15_threadid = val & 0xffff; break; case 8: cpu_interrupt(env, CPU_INTERRUPT_HALT); break; default: goto bad_reg; } } break; } return; bad_reg: cpu_abort(env, "Unimplemented cp15 register write (c%d, c%d, {%d, %d})\n", (insn >> 16) & 0xf, crm, op1, op2); }
{ "code": [], "line_no": [] }
void FUNC_0(set_cp15)(CPUState *env, uint32_t insn, uint32_t val) { int VAR_0; int VAR_1; int VAR_2; VAR_0 = (insn >> 21) & 7; VAR_1 = (insn >> 5) & 7; VAR_2 = insn & 0xf; switch ((insn >> 16) & 0xf) { case 0: if (arm_feature(env, ARM_FEATURE_XSCALE)) break; if (arm_feature(env, ARM_FEATURE_OMAPCP)) break; if (arm_feature(env, ARM_FEATURE_V7) && VAR_0 == 2 && VAR_2 == 0 && VAR_1 == 0) { env->cp15.c0_cssel = val & 0xf; break; } goto bad_reg; case 1: if (arm_feature(env, ARM_FEATURE_OMAPCP)) VAR_1 = 0; switch (VAR_1) { case 0: if (!arm_feature(env, ARM_FEATURE_XSCALE) || VAR_2 == 0) env->cp15.c1_sys = val; tlb_flush(env, 1); break; case 1: if (arm_feature(env, ARM_FEATURE_XSCALE)) { env->cp15.c1_xscaleauxcr = val; break; } break; case 2: if (arm_feature(env, ARM_FEATURE_XSCALE)) goto bad_reg; if (env->cp15.c1_coproc != val) { env->cp15.c1_coproc = val; tb_flush(env); } break; default: goto bad_reg; } break; case 2: if (arm_feature(env, ARM_FEATURE_MPU)) { switch (VAR_1) { case 0: env->cp15.c2_data = val; break; case 1: env->cp15.c2_insn = val; break; default: goto bad_reg; } } else { switch (VAR_1) { case 0: env->cp15.c2_base0 = val; break; case 1: env->cp15.c2_base1 = val; break; case 2: val &= 7; env->cp15.c2_control = val; env->cp15.c2_mask = ~(((uint32_t)0xffffffffu) >> val); env->cp15.c2_base_mask = ~((uint32_t)0x3fffu >> val); break; default: goto bad_reg; } } break; case 3: env->cp15.c3 = val; tlb_flush(env, 1); break; case 4: goto bad_reg; case 5: if (arm_feature(env, ARM_FEATURE_OMAPCP)) VAR_1 = 0; switch (VAR_1) { case 0: if (arm_feature(env, ARM_FEATURE_MPU)) val = extended_mpu_ap_bits(val); env->cp15.c5_data = val; break; case 1: if (arm_feature(env, ARM_FEATURE_MPU)) val = extended_mpu_ap_bits(val); env->cp15.c5_insn = val; break; case 2: if (!arm_feature(env, ARM_FEATURE_MPU)) goto bad_reg; env->cp15.c5_data = val; break; case 3: if (!arm_feature(env, ARM_FEATURE_MPU)) goto bad_reg; env->cp15.c5_insn = val; break; default: goto bad_reg; } break; case 6: if (arm_feature(env, ARM_FEATURE_MPU)) { if (VAR_2 >= 8) goto bad_reg; env->cp15.c6_region[VAR_2] = val; } else { if (arm_feature(env, ARM_FEATURE_OMAPCP)) VAR_1 = 0; switch (VAR_1) { case 0: env->cp15.c6_data = val; break; case 1: case 2: env->cp15.c6_insn = val; break; default: goto bad_reg; } } break; case 7: env->cp15.c15_i_max = 0x000; env->cp15.c15_i_min = 0xff0; break; case 8: switch (VAR_1) { case 0: tlb_flush(env, 0); break; case 1: #if 0 val &= 0xfffff000; tlb_flush_page(env, val); tlb_flush_page(env, val + 0x400); tlb_flush_page(env, val + 0x800); tlb_flush_page(env, val + 0xc00); #else tlb_flush(env, 1); #endif break; case 2: tlb_flush(env, val == 0); break; case 3: tlb_flush(env, 1); break; default: goto bad_reg; } break; case 9: if (arm_feature(env, ARM_FEATURE_OMAPCP)) break; switch (VAR_2) { case 0: switch (VAR_0) { case 0: switch (VAR_1) { case 0: env->cp15.c9_data = val; break; case 1: env->cp15.c9_insn = val; break; default: goto bad_reg; } break; case 1: break; default: goto bad_reg; } break; case 1: goto bad_reg; default: goto bad_reg; } break; case 10: break; case 12: goto bad_reg; case 13: switch (VAR_1) { case 0: if (env->cp15.c13_fcse != val) tlb_flush(env, 1); env->cp15.c13_fcse = val; break; case 1: if (env->cp15.c13_context != val && !arm_feature(env, ARM_FEATURE_MPU)) tlb_flush(env, 0); env->cp15.c13_context = val; break; case 2: env->cp15.c13_tls1 = val; break; case 3: env->cp15.c13_tls2 = val; break; case 4: env->cp15.c13_tls3 = val; break; default: goto bad_reg; } break; case 14: goto bad_reg; case 15: if (arm_feature(env, ARM_FEATURE_XSCALE)) { if (VAR_1 == 0 && VAR_2 == 1) { if (env->cp15.c15_cpar != (val & 0x3fff)) { tb_flush(env); env->cp15.c15_cpar = val & 0x3fff; } break; } goto bad_reg; } if (arm_feature(env, ARM_FEATURE_OMAPCP)) { switch (VAR_2) { case 0: break; case 1: env->cp15.c15_ticonfig = val & 0xe7; env->cp15.c0_cpuid = (val & (1 << 5)) ? ARM_CPUID_TI915T : ARM_CPUID_TI925T; break; case 2: env->cp15.c15_i_max = val; break; case 3: env->cp15.c15_i_min = val; break; case 4: env->cp15.c15_threadid = val & 0xffff; break; case 8: cpu_interrupt(env, CPU_INTERRUPT_HALT); break; default: goto bad_reg; } } break; } return; bad_reg: cpu_abort(env, "Unimplemented cp15 register write (c%d, c%d, {%d, %d})\n", (insn >> 16) & 0xf, VAR_2, VAR_0, VAR_1); }
[ "void FUNC_0(set_cp15)(CPUState *env, uint32_t insn, uint32_t val)\n{", "int VAR_0;", "int VAR_1;", "int VAR_2;", "VAR_0 = (insn >> 21) & 7;", "VAR_1 = (insn >> 5) & 7;", "VAR_2 = insn & 0xf;", "switch ((insn >> 16) & 0xf) {", "case 0:\nif (arm_feature(env, ARM_FEATURE_XSCALE))\nbreak;", "if (arm_feature(env, ARM_FEATURE_OMAPCP))\nbreak;", "if (arm_feature(env, ARM_FEATURE_V7)\n&& VAR_0 == 2 && VAR_2 == 0 && VAR_1 == 0) {", "env->cp15.c0_cssel = val & 0xf;", "break;", "}", "goto bad_reg;", "case 1:\nif (arm_feature(env, ARM_FEATURE_OMAPCP))\nVAR_1 = 0;", "switch (VAR_1) {", "case 0:\nif (!arm_feature(env, ARM_FEATURE_XSCALE) || VAR_2 == 0)\nenv->cp15.c1_sys = val;", "tlb_flush(env, 1);", "break;", "case 1:\nif (arm_feature(env, ARM_FEATURE_XSCALE)) {", "env->cp15.c1_xscaleauxcr = val;", "break;", "}", "break;", "case 2:\nif (arm_feature(env, ARM_FEATURE_XSCALE))\ngoto bad_reg;", "if (env->cp15.c1_coproc != val) {", "env->cp15.c1_coproc = val;", "tb_flush(env);", "}", "break;", "default:\ngoto bad_reg;", "}", "break;", "case 2:\nif (arm_feature(env, ARM_FEATURE_MPU)) {", "switch (VAR_1) {", "case 0:\nenv->cp15.c2_data = val;", "break;", "case 1:\nenv->cp15.c2_insn = val;", "break;", "default:\ngoto bad_reg;", "}", "} else {", "switch (VAR_1) {", "case 0:\nenv->cp15.c2_base0 = val;", "break;", "case 1:\nenv->cp15.c2_base1 = val;", "break;", "case 2:\nval &= 7;", "env->cp15.c2_control = val;", "env->cp15.c2_mask = ~(((uint32_t)0xffffffffu) >> val);", "env->cp15.c2_base_mask = ~((uint32_t)0x3fffu >> val);", "break;", "default:\ngoto bad_reg;", "}", "}", "break;", "case 3:\nenv->cp15.c3 = val;", "tlb_flush(env, 1);", "break;", "case 4:\ngoto bad_reg;", "case 5:\nif (arm_feature(env, ARM_FEATURE_OMAPCP))\nVAR_1 = 0;", "switch (VAR_1) {", "case 0:\nif (arm_feature(env, ARM_FEATURE_MPU))\nval = extended_mpu_ap_bits(val);", "env->cp15.c5_data = val;", "break;", "case 1:\nif (arm_feature(env, ARM_FEATURE_MPU))\nval = extended_mpu_ap_bits(val);", "env->cp15.c5_insn = val;", "break;", "case 2:\nif (!arm_feature(env, ARM_FEATURE_MPU))\ngoto bad_reg;", "env->cp15.c5_data = val;", "break;", "case 3:\nif (!arm_feature(env, ARM_FEATURE_MPU))\ngoto bad_reg;", "env->cp15.c5_insn = val;", "break;", "default:\ngoto bad_reg;", "}", "break;", "case 6:\nif (arm_feature(env, ARM_FEATURE_MPU)) {", "if (VAR_2 >= 8)\ngoto bad_reg;", "env->cp15.c6_region[VAR_2] = val;", "} else {", "if (arm_feature(env, ARM_FEATURE_OMAPCP))\nVAR_1 = 0;", "switch (VAR_1) {", "case 0:\nenv->cp15.c6_data = val;", "break;", "case 1:\ncase 2:\nenv->cp15.c6_insn = val;", "break;", "default:\ngoto bad_reg;", "}", "}", "break;", "case 7:\nenv->cp15.c15_i_max = 0x000;", "env->cp15.c15_i_min = 0xff0;", "break;", "case 8:\nswitch (VAR_1) {", "case 0:\ntlb_flush(env, 0);", "break;", "case 1:\n#if 0\nval &= 0xfffff000;", "tlb_flush_page(env, val);", "tlb_flush_page(env, val + 0x400);", "tlb_flush_page(env, val + 0x800);", "tlb_flush_page(env, val + 0xc00);", "#else\ntlb_flush(env, 1);", "#endif\nbreak;", "case 2:\ntlb_flush(env, val == 0);", "break;", "case 3:\ntlb_flush(env, 1);", "break;", "default:\ngoto bad_reg;", "}", "break;", "case 9:\nif (arm_feature(env, ARM_FEATURE_OMAPCP))\nbreak;", "switch (VAR_2) {", "case 0:\nswitch (VAR_0) {", "case 0:\nswitch (VAR_1) {", "case 0:\nenv->cp15.c9_data = val;", "break;", "case 1:\nenv->cp15.c9_insn = val;", "break;", "default:\ngoto bad_reg;", "}", "break;", "case 1:\nbreak;", "default:\ngoto bad_reg;", "}", "break;", "case 1:\ngoto bad_reg;", "default:\ngoto bad_reg;", "}", "break;", "case 10:\nbreak;", "case 12:\ngoto bad_reg;", "case 13:\nswitch (VAR_1) {", "case 0:\nif (env->cp15.c13_fcse != val)\ntlb_flush(env, 1);", "env->cp15.c13_fcse = val;", "break;", "case 1:\nif (env->cp15.c13_context != val\n&& !arm_feature(env, ARM_FEATURE_MPU))\ntlb_flush(env, 0);", "env->cp15.c13_context = val;", "break;", "case 2:\nenv->cp15.c13_tls1 = val;", "break;", "case 3:\nenv->cp15.c13_tls2 = val;", "break;", "case 4:\nenv->cp15.c13_tls3 = val;", "break;", "default:\ngoto bad_reg;", "}", "break;", "case 14:\ngoto bad_reg;", "case 15:\nif (arm_feature(env, ARM_FEATURE_XSCALE)) {", "if (VAR_1 == 0 && VAR_2 == 1) {", "if (env->cp15.c15_cpar != (val & 0x3fff)) {", "tb_flush(env);", "env->cp15.c15_cpar = val & 0x3fff;", "}", "break;", "}", "goto bad_reg;", "}", "if (arm_feature(env, ARM_FEATURE_OMAPCP)) {", "switch (VAR_2) {", "case 0:\nbreak;", "case 1:\nenv->cp15.c15_ticonfig = val & 0xe7;", "env->cp15.c0_cpuid = (val & (1 << 5)) ?\nARM_CPUID_TI915T : ARM_CPUID_TI925T;", "break;", "case 2:\nenv->cp15.c15_i_max = val;", "break;", "case 3:\nenv->cp15.c15_i_min = val;", "break;", "case 4:\nenv->cp15.c15_threadid = val & 0xffff;", "break;", "case 8:\ncpu_interrupt(env, CPU_INTERRUPT_HALT);", "break;", "default:\ngoto bad_reg;", "}", "}", "break;", "}", "return;", "bad_reg:\ncpu_abort(env, \"Unimplemented cp15 register write (c%d, c%d, {%d, %d})\\n\",", "(insn >> 16) & 0xf, VAR_2, VAR_0, VAR_1);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21, 25, 27 ], [ 29, 31 ], [ 33, 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45, 47, 49 ], [ 51 ], [ 53, 55, 57 ], [ 63 ], [ 65 ], [ 67, 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81, 83, 85 ], [ 87 ], [ 89 ], [ 93 ], [ 95 ], [ 97 ], [ 99, 101 ], [ 103 ], [ 105 ], [ 107, 109 ], [ 111 ], [ 113, 115 ], [ 117 ], [ 119, 121 ], [ 123 ], [ 125, 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135, 137 ], [ 139 ], [ 141, 143 ], [ 145 ], [ 147, 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159, 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169, 171 ], [ 173 ], [ 175 ], [ 177, 179 ], [ 181, 183, 185 ], [ 187 ], [ 189, 191, 193 ], [ 195 ], [ 197 ], [ 199, 201, 203 ], [ 205 ], [ 207 ], [ 209, 211, 213 ], [ 215 ], [ 217 ], [ 219, 221, 223 ], [ 225 ], [ 227 ], [ 229, 231 ], [ 233 ], [ 235 ], [ 237, 239 ], [ 241, 243 ], [ 245 ], [ 247 ], [ 249, 251 ], [ 253 ], [ 255, 257 ], [ 259 ], [ 261, 263, 265 ], [ 267 ], [ 269, 271 ], [ 273 ], [ 275 ], [ 277 ], [ 279, 281 ], [ 283 ], [ 289 ], [ 291, 293 ], [ 295, 297 ], [ 299 ], [ 301, 303, 311 ], [ 313 ], [ 315 ], [ 317 ], [ 319 ], [ 321, 323 ], [ 325, 327 ], [ 329, 331 ], [ 333 ], [ 335, 339 ], [ 341 ], [ 343, 345 ], [ 347 ], [ 349 ], [ 351, 353, 355 ], [ 357 ], [ 359, 361 ], [ 363, 365 ], [ 367, 369 ], [ 371 ], [ 373, 375 ], [ 377 ], [ 379, 381 ], [ 383 ], [ 385 ], [ 387, 391 ], [ 393, 395 ], [ 397 ], [ 399 ], [ 401, 405 ], [ 407, 409 ], [ 411 ], [ 413 ], [ 415, 419 ], [ 421, 423 ], [ 425, 427 ], [ 429, 437, 439 ], [ 441 ], [ 443 ], [ 445, 449, 451, 453 ], [ 455 ], [ 457 ], [ 459, 461 ], [ 463 ], [ 465, 467 ], [ 469 ], [ 471, 473 ], [ 475 ], [ 477, 479 ], [ 481 ], [ 483 ], [ 485, 487 ], [ 489, 491 ], [ 493 ], [ 495 ], [ 499 ], [ 501 ], [ 503 ], [ 505 ], [ 507 ], [ 509 ], [ 511 ], [ 513 ], [ 515 ], [ 517, 519 ], [ 521, 523 ], [ 525, 527 ], [ 529 ], [ 531, 533 ], [ 535 ], [ 537, 539 ], [ 541 ], [ 543, 545 ], [ 547 ], [ 549, 551 ], [ 553 ], [ 555, 557 ], [ 559 ], [ 561 ], [ 563 ], [ 565 ], [ 567 ], [ 569, 573 ], [ 575 ], [ 577 ] ]
13,958
static void pci_pcnet_cleanup(NetClientState *nc) { PCNetState *d = qemu_get_nic_opaque(nc); pcnet_common_cleanup(d); }
false
qemu
57407ea44cc0a3d630b9b89a2be011f1955ce5c1
static void pci_pcnet_cleanup(NetClientState *nc) { PCNetState *d = qemu_get_nic_opaque(nc); pcnet_common_cleanup(d); }
{ "code": [], "line_no": [] }
static void FUNC_0(NetClientState *VAR_0) { PCNetState *d = qemu_get_nic_opaque(VAR_0); pcnet_common_cleanup(d); }
[ "static void FUNC_0(NetClientState *VAR_0)\n{", "PCNetState *d = qemu_get_nic_opaque(VAR_0);", "pcnet_common_cleanup(d);", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ] ]
13,959
static void gen_mulo(DisasContext *ctx) { int l1 = gen_new_label(); TCGv_i64 t0 = tcg_temp_new_i64(); TCGv_i64 t1 = tcg_temp_new_i64(); TCGv t2 = tcg_temp_new(); /* Start with XER OV disabled, the most likely case */ tcg_gen_movi_tl(cpu_ov, 0); tcg_gen_extu_tl_i64(t0, cpu_gpr[rA(ctx->opcode)]); tcg_gen_extu_tl_i64(t1, cpu_gpr[rB(ctx->opcode)]); tcg_gen_mul_i64(t0, t0, t1); tcg_gen_trunc_i64_tl(t2, t0); gen_store_spr(SPR_MQ, t2); tcg_gen_shri_i64(t1, t0, 32); tcg_gen_trunc_i64_tl(cpu_gpr[rD(ctx->opcode)], t1); tcg_gen_ext32s_i64(t1, t0); tcg_gen_brcond_i64(TCG_COND_EQ, t0, t1, l1); tcg_gen_movi_tl(cpu_ov, 1); tcg_gen_movi_tl(cpu_so, 1); gen_set_label(l1); tcg_temp_free_i64(t0); tcg_temp_free_i64(t1); tcg_temp_free(t2); if (unlikely(Rc(ctx->opcode) != 0)) gen_set_Rc0(ctx, cpu_gpr[rD(ctx->opcode)]); }
false
qemu
42a268c241183877192c376d03bd9b6d527407c7
static void gen_mulo(DisasContext *ctx) { int l1 = gen_new_label(); TCGv_i64 t0 = tcg_temp_new_i64(); TCGv_i64 t1 = tcg_temp_new_i64(); TCGv t2 = tcg_temp_new(); tcg_gen_movi_tl(cpu_ov, 0); tcg_gen_extu_tl_i64(t0, cpu_gpr[rA(ctx->opcode)]); tcg_gen_extu_tl_i64(t1, cpu_gpr[rB(ctx->opcode)]); tcg_gen_mul_i64(t0, t0, t1); tcg_gen_trunc_i64_tl(t2, t0); gen_store_spr(SPR_MQ, t2); tcg_gen_shri_i64(t1, t0, 32); tcg_gen_trunc_i64_tl(cpu_gpr[rD(ctx->opcode)], t1); tcg_gen_ext32s_i64(t1, t0); tcg_gen_brcond_i64(TCG_COND_EQ, t0, t1, l1); tcg_gen_movi_tl(cpu_ov, 1); tcg_gen_movi_tl(cpu_so, 1); gen_set_label(l1); tcg_temp_free_i64(t0); tcg_temp_free_i64(t1); tcg_temp_free(t2); if (unlikely(Rc(ctx->opcode) != 0)) gen_set_Rc0(ctx, cpu_gpr[rD(ctx->opcode)]); }
{ "code": [], "line_no": [] }
static void FUNC_0(DisasContext *VAR_0) { int VAR_1 = gen_new_label(); TCGv_i64 t0 = tcg_temp_new_i64(); TCGv_i64 t1 = tcg_temp_new_i64(); TCGv t2 = tcg_temp_new(); tcg_gen_movi_tl(cpu_ov, 0); tcg_gen_extu_tl_i64(t0, cpu_gpr[rA(VAR_0->opcode)]); tcg_gen_extu_tl_i64(t1, cpu_gpr[rB(VAR_0->opcode)]); tcg_gen_mul_i64(t0, t0, t1); tcg_gen_trunc_i64_tl(t2, t0); gen_store_spr(SPR_MQ, t2); tcg_gen_shri_i64(t1, t0, 32); tcg_gen_trunc_i64_tl(cpu_gpr[rD(VAR_0->opcode)], t1); tcg_gen_ext32s_i64(t1, t0); tcg_gen_brcond_i64(TCG_COND_EQ, t0, t1, VAR_1); tcg_gen_movi_tl(cpu_ov, 1); tcg_gen_movi_tl(cpu_so, 1); gen_set_label(VAR_1); tcg_temp_free_i64(t0); tcg_temp_free_i64(t1); tcg_temp_free(t2); if (unlikely(Rc(VAR_0->opcode) != 0)) gen_set_Rc0(VAR_0, cpu_gpr[rD(VAR_0->opcode)]); }
[ "static void FUNC_0(DisasContext *VAR_0)\n{", "int VAR_1 = gen_new_label();", "TCGv_i64 t0 = tcg_temp_new_i64();", "TCGv_i64 t1 = tcg_temp_new_i64();", "TCGv t2 = tcg_temp_new();", "tcg_gen_movi_tl(cpu_ov, 0);", "tcg_gen_extu_tl_i64(t0, cpu_gpr[rA(VAR_0->opcode)]);", "tcg_gen_extu_tl_i64(t1, cpu_gpr[rB(VAR_0->opcode)]);", "tcg_gen_mul_i64(t0, t0, t1);", "tcg_gen_trunc_i64_tl(t2, t0);", "gen_store_spr(SPR_MQ, t2);", "tcg_gen_shri_i64(t1, t0, 32);", "tcg_gen_trunc_i64_tl(cpu_gpr[rD(VAR_0->opcode)], t1);", "tcg_gen_ext32s_i64(t1, t0);", "tcg_gen_brcond_i64(TCG_COND_EQ, t0, t1, VAR_1);", "tcg_gen_movi_tl(cpu_ov, 1);", "tcg_gen_movi_tl(cpu_so, 1);", "gen_set_label(VAR_1);", "tcg_temp_free_i64(t0);", "tcg_temp_free_i64(t1);", "tcg_temp_free(t2);", "if (unlikely(Rc(VAR_0->opcode) != 0))\ngen_set_Rc0(VAR_0, cpu_gpr[rD(VAR_0->opcode)]);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47, 49 ], [ 51 ] ]
13,960
static void test_source_flush_event_notifier(void) { EventNotifierTestData data = { .n = 0, .active = 10, .auto_set = true }; event_notifier_init(&data.e, false); aio_set_event_notifier(ctx, &data.e, event_ready_cb); g_assert(g_main_context_iteration(NULL, false)); g_assert_cmpint(data.n, ==, 0); g_assert_cmpint(data.active, ==, 10); event_notifier_set(&data.e); g_assert(g_main_context_iteration(NULL, false)); g_assert_cmpint(data.n, ==, 1); g_assert_cmpint(data.active, ==, 9); g_assert(g_main_context_iteration(NULL, false)); while (g_main_context_iteration(NULL, false)); g_assert_cmpint(data.n, ==, 10); g_assert_cmpint(data.active, ==, 0); g_assert(!g_main_context_iteration(NULL, false)); aio_set_event_notifier(ctx, &data.e, NULL); while (g_main_context_iteration(NULL, false)); event_notifier_cleanup(&data.e); }
false
qemu
12d69ac03b45156356b240424623719f15d8143e
static void test_source_flush_event_notifier(void) { EventNotifierTestData data = { .n = 0, .active = 10, .auto_set = true }; event_notifier_init(&data.e, false); aio_set_event_notifier(ctx, &data.e, event_ready_cb); g_assert(g_main_context_iteration(NULL, false)); g_assert_cmpint(data.n, ==, 0); g_assert_cmpint(data.active, ==, 10); event_notifier_set(&data.e); g_assert(g_main_context_iteration(NULL, false)); g_assert_cmpint(data.n, ==, 1); g_assert_cmpint(data.active, ==, 9); g_assert(g_main_context_iteration(NULL, false)); while (g_main_context_iteration(NULL, false)); g_assert_cmpint(data.n, ==, 10); g_assert_cmpint(data.active, ==, 0); g_assert(!g_main_context_iteration(NULL, false)); aio_set_event_notifier(ctx, &data.e, NULL); while (g_main_context_iteration(NULL, false)); event_notifier_cleanup(&data.e); }
{ "code": [], "line_no": [] }
static void FUNC_0(void) { EventNotifierTestData data = { .n = 0, .active = 10, .auto_set = true }; event_notifier_init(&data.e, false); aio_set_event_notifier(ctx, &data.e, event_ready_cb); g_assert(g_main_context_iteration(NULL, false)); g_assert_cmpint(data.n, ==, 0); g_assert_cmpint(data.active, ==, 10); event_notifier_set(&data.e); g_assert(g_main_context_iteration(NULL, false)); g_assert_cmpint(data.n, ==, 1); g_assert_cmpint(data.active, ==, 9); g_assert(g_main_context_iteration(NULL, false)); while (g_main_context_iteration(NULL, false)); g_assert_cmpint(data.n, ==, 10); g_assert_cmpint(data.active, ==, 0); g_assert(!g_main_context_iteration(NULL, false)); aio_set_event_notifier(ctx, &data.e, NULL); while (g_main_context_iteration(NULL, false)); event_notifier_cleanup(&data.e); }
[ "static void FUNC_0(void)\n{", "EventNotifierTestData data = { .n = 0, .active = 10, .auto_set = true };", "event_notifier_init(&data.e, false);", "aio_set_event_notifier(ctx, &data.e, event_ready_cb);", "g_assert(g_main_context_iteration(NULL, false));", "g_assert_cmpint(data.n, ==, 0);", "g_assert_cmpint(data.active, ==, 10);", "event_notifier_set(&data.e);", "g_assert(g_main_context_iteration(NULL, false));", "g_assert_cmpint(data.n, ==, 1);", "g_assert_cmpint(data.active, ==, 9);", "g_assert(g_main_context_iteration(NULL, false));", "while (g_main_context_iteration(NULL, false));", "g_assert_cmpint(data.n, ==, 10);", "g_assert_cmpint(data.active, ==, 0);", "g_assert(!g_main_context_iteration(NULL, false));", "aio_set_event_notifier(ctx, &data.e, NULL);", "while (g_main_context_iteration(NULL, false));", "event_notifier_cleanup(&data.e);", "}" ]
[ 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 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ] ]
13,961
uint32_t HELPER(v7m_mrs)(CPUARMState *env, uint32_t reg) { uint32_t mask; unsigned el = arm_current_el(env); /* First handle registers which unprivileged can read */ switch (reg) { case 0 ... 7: /* xPSR sub-fields */ mask = 0; if ((reg & 1) && el) { mask |= XPSR_EXCP; /* IPSR (unpriv. reads as zero) */ } if (!(reg & 4)) { mask |= XPSR_NZCV | XPSR_Q; /* APSR */ } /* EPSR reads as zero */ return xpsr_read(env) & mask; break; case 20: /* CONTROL */ return env->v7m.control; } if (el == 0) { return 0; /* unprivileged reads others as zero */ } switch (reg) { case 8: /* MSP */ return (env->v7m.control & R_V7M_CONTROL_SPSEL_MASK) ? env->v7m.other_sp : env->regs[13]; case 9: /* PSP */ return (env->v7m.control & R_V7M_CONTROL_SPSEL_MASK) ? env->regs[13] : env->v7m.other_sp; case 16: /* PRIMASK */ return env->v7m.primask[env->v7m.secure]; case 17: /* BASEPRI */ case 18: /* BASEPRI_MAX */ return env->v7m.basepri[env->v7m.secure]; case 19: /* FAULTMASK */ return env->v7m.faultmask[env->v7m.secure]; default: qemu_log_mask(LOG_GUEST_ERROR, "Attempt to read unknown special" " register %d\n", reg); return 0; } }
false
qemu
8bfc26ea302ec03585d7258a7cf8938f76512730
uint32_t HELPER(v7m_mrs)(CPUARMState *env, uint32_t reg) { uint32_t mask; unsigned el = arm_current_el(env); switch (reg) { case 0 ... 7: mask = 0; if ((reg & 1) && el) { mask |= XPSR_EXCP; } if (!(reg & 4)) { mask |= XPSR_NZCV | XPSR_Q; } return xpsr_read(env) & mask; break; case 20: return env->v7m.control; } if (el == 0) { return 0; } switch (reg) { case 8: return (env->v7m.control & R_V7M_CONTROL_SPSEL_MASK) ? env->v7m.other_sp : env->regs[13]; case 9: return (env->v7m.control & R_V7M_CONTROL_SPSEL_MASK) ? env->regs[13] : env->v7m.other_sp; case 16: return env->v7m.primask[env->v7m.secure]; case 17: case 18: return env->v7m.basepri[env->v7m.secure]; case 19: return env->v7m.faultmask[env->v7m.secure]; default: qemu_log_mask(LOG_GUEST_ERROR, "Attempt to read unknown special" " register %d\n", reg); return 0; } }
{ "code": [], "line_no": [] }
uint32_t FUNC_0(v7m_mrs)(CPUARMState *env, uint32_t reg) { uint32_t mask; unsigned VAR_0 = arm_current_el(env); switch (reg) { case 0 ... 7: mask = 0; if ((reg & 1) && VAR_0) { mask |= XPSR_EXCP; } if (!(reg & 4)) { mask |= XPSR_NZCV | XPSR_Q; } return xpsr_read(env) & mask; break; case 20: return env->v7m.control; } if (VAR_0 == 0) { return 0; } switch (reg) { case 8: return (env->v7m.control & R_V7M_CONTROL_SPSEL_MASK) ? env->v7m.other_sp : env->regs[13]; case 9: return (env->v7m.control & R_V7M_CONTROL_SPSEL_MASK) ? env->regs[13] : env->v7m.other_sp; case 16: return env->v7m.primask[env->v7m.secure]; case 17: case 18: return env->v7m.basepri[env->v7m.secure]; case 19: return env->v7m.faultmask[env->v7m.secure]; default: qemu_log_mask(LOG_GUEST_ERROR, "Attempt to read unknown special" " register %d\n", reg); return 0; } }
[ "uint32_t FUNC_0(v7m_mrs)(CPUARMState *env, uint32_t reg)\n{", "uint32_t mask;", "unsigned VAR_0 = arm_current_el(env);", "switch (reg) {", "case 0 ... 7:\nmask = 0;", "if ((reg & 1) && VAR_0) {", "mask |= XPSR_EXCP;", "}", "if (!(reg & 4)) {", "mask |= XPSR_NZCV | XPSR_Q;", "}", "return xpsr_read(env) & mask;", "break;", "case 20:\nreturn env->v7m.control;", "}", "if (VAR_0 == 0) {", "return 0;", "}", "switch (reg) {", "case 8:\nreturn (env->v7m.control & R_V7M_CONTROL_SPSEL_MASK) ?\nenv->v7m.other_sp : env->regs[13];", "case 9:\nreturn (env->v7m.control & R_V7M_CONTROL_SPSEL_MASK) ?\nenv->regs[13] : env->v7m.other_sp;", "case 16:\nreturn env->v7m.primask[env->v7m.secure];", "case 17:\ncase 18:\nreturn env->v7m.basepri[env->v7m.secure];", "case 19:\nreturn env->v7m.faultmask[env->v7m.secure];", "default:\nqemu_log_mask(LOG_GUEST_ERROR, \"Attempt to read unknown special\"\n\" register %d\\n\", reg);", "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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 15 ], [ 17, 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57, 59, 61 ], [ 63, 65, 67 ], [ 69, 71 ], [ 73, 75, 77 ], [ 79, 81 ], [ 83, 85, 87 ], [ 89 ], [ 91 ], [ 93 ] ]
13,962
static void usbredir_control_packet(void *priv, uint32_t id, struct usb_redir_control_packet_header *control_packet, uint8_t *data, int data_len) { USBRedirDevice *dev = priv; int len = control_packet->length; AsyncURB *aurb; DPRINTF("ctrl-in status %d len %d id %u\n", control_packet->status, len, id); aurb = async_find(dev, id); if (!aurb) { free(data); return; } aurb->control_packet.status = control_packet->status; aurb->control_packet.length = control_packet->length; if (memcmp(&aurb->control_packet, control_packet, sizeof(*control_packet))) { ERROR("return control packet mismatch, please report this!\n"); len = USB_RET_NAK; } if (aurb->packet) { len = usbredir_handle_status(dev, control_packet->status, len); if (len > 0) { usbredir_log_data(dev, "ctrl data in:", data, data_len); if (data_len <= sizeof(dev->dev.data_buf)) { memcpy(dev->dev.data_buf, data, data_len); } else { ERROR("ctrl buffer too small (%d > %zu)\n", data_len, sizeof(dev->dev.data_buf)); len = USB_RET_STALL; } } aurb->packet->result = len; usb_generic_async_ctrl_complete(&dev->dev, aurb->packet); } async_free(dev, aurb); free(data); }
false
qemu
104981d52b63dc3d68f39d4442881c667f44bbb9
static void usbredir_control_packet(void *priv, uint32_t id, struct usb_redir_control_packet_header *control_packet, uint8_t *data, int data_len) { USBRedirDevice *dev = priv; int len = control_packet->length; AsyncURB *aurb; DPRINTF("ctrl-in status %d len %d id %u\n", control_packet->status, len, id); aurb = async_find(dev, id); if (!aurb) { free(data); return; } aurb->control_packet.status = control_packet->status; aurb->control_packet.length = control_packet->length; if (memcmp(&aurb->control_packet, control_packet, sizeof(*control_packet))) { ERROR("return control packet mismatch, please report this!\n"); len = USB_RET_NAK; } if (aurb->packet) { len = usbredir_handle_status(dev, control_packet->status, len); if (len > 0) { usbredir_log_data(dev, "ctrl data in:", data, data_len); if (data_len <= sizeof(dev->dev.data_buf)) { memcpy(dev->dev.data_buf, data, data_len); } else { ERROR("ctrl buffer too small (%d > %zu)\n", data_len, sizeof(dev->dev.data_buf)); len = USB_RET_STALL; } } aurb->packet->result = len; usb_generic_async_ctrl_complete(&dev->dev, aurb->packet); } async_free(dev, aurb); free(data); }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, uint32_t VAR_1, struct usb_redir_control_packet_header *VAR_2, uint8_t *VAR_3, int VAR_4) { USBRedirDevice *dev = VAR_0; int VAR_5 = VAR_2->length; AsyncURB *aurb; DPRINTF("ctrl-in status %d VAR_5 %d VAR_1 %u\n", VAR_2->status, VAR_5, VAR_1); aurb = async_find(dev, VAR_1); if (!aurb) { free(VAR_3); return; } aurb->VAR_2.status = VAR_2->status; aurb->VAR_2.length = VAR_2->length; if (memcmp(&aurb->VAR_2, VAR_2, sizeof(*VAR_2))) { ERROR("return control packet mismatch, please report this!\n"); VAR_5 = USB_RET_NAK; } if (aurb->packet) { VAR_5 = usbredir_handle_status(dev, VAR_2->status, VAR_5); if (VAR_5 > 0) { usbredir_log_data(dev, "ctrl VAR_3 in:", VAR_3, VAR_4); if (VAR_4 <= sizeof(dev->dev.data_buf)) { memcpy(dev->dev.data_buf, VAR_3, VAR_4); } else { ERROR("ctrl buffer too small (%d > %zu)\n", VAR_4, sizeof(dev->dev.data_buf)); VAR_5 = USB_RET_STALL; } } aurb->packet->result = VAR_5; usb_generic_async_ctrl_complete(&dev->dev, aurb->packet); } async_free(dev, aurb); free(VAR_3); }
[ "static void FUNC_0(void *VAR_0, uint32_t VAR_1,\nstruct usb_redir_control_packet_header *VAR_2,\nuint8_t *VAR_3, int VAR_4)\n{", "USBRedirDevice *dev = VAR_0;", "int VAR_5 = VAR_2->length;", "AsyncURB *aurb;", "DPRINTF(\"ctrl-in status %d VAR_5 %d VAR_1 %u\\n\", VAR_2->status,\nVAR_5, VAR_1);", "aurb = async_find(dev, VAR_1);", "if (!aurb) {", "free(VAR_3);", "return;", "}", "aurb->VAR_2.status = VAR_2->status;", "aurb->VAR_2.length = VAR_2->length;", "if (memcmp(&aurb->VAR_2, VAR_2,\nsizeof(*VAR_2))) {", "ERROR(\"return control packet mismatch, please report this!\\n\");", "VAR_5 = USB_RET_NAK;", "}", "if (aurb->packet) {", "VAR_5 = usbredir_handle_status(dev, VAR_2->status, VAR_5);", "if (VAR_5 > 0) {", "usbredir_log_data(dev, \"ctrl VAR_3 in:\", VAR_3, VAR_4);", "if (VAR_4 <= sizeof(dev->dev.data_buf)) {", "memcpy(dev->dev.data_buf, VAR_3, VAR_4);", "} else {", "ERROR(\"ctrl buffer too small (%d > %zu)\\n\",\nVAR_4, sizeof(dev->dev.data_buf));", "VAR_5 = USB_RET_STALL;", "}", "}", "aurb->packet->result = VAR_5;", "usb_generic_async_ctrl_complete(&dev->dev, aurb->packet);", "}", "async_free(dev, aurb);", "free(VAR_3);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17, 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65, 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ] ]
13,963
static int qemu_paio_submit(struct qemu_paiocb *aiocb, int is_write) { aiocb->is_write = is_write; aiocb->ret = -EINPROGRESS; aiocb->active = 0; mutex_lock(&lock); if (idle_threads == 0 && cur_threads < max_threads) spawn_thread(); TAILQ_INSERT_TAIL(&request_list, aiocb, node); mutex_unlock(&lock); cond_broadcast(&cond); return 0; }
false
qemu
5d47e3728bbd589701f74bb494c9c9825ba23c88
static int qemu_paio_submit(struct qemu_paiocb *aiocb, int is_write) { aiocb->is_write = is_write; aiocb->ret = -EINPROGRESS; aiocb->active = 0; mutex_lock(&lock); if (idle_threads == 0 && cur_threads < max_threads) spawn_thread(); TAILQ_INSERT_TAIL(&request_list, aiocb, node); mutex_unlock(&lock); cond_broadcast(&cond); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(struct qemu_paiocb *VAR_0, int VAR_1) { VAR_0->VAR_1 = VAR_1; VAR_0->ret = -EINPROGRESS; VAR_0->active = 0; mutex_lock(&lock); if (idle_threads == 0 && cur_threads < max_threads) spawn_thread(); TAILQ_INSERT_TAIL(&request_list, VAR_0, node); mutex_unlock(&lock); cond_broadcast(&cond); return 0; }
[ "static int FUNC_0(struct qemu_paiocb *VAR_0, int VAR_1)\n{", "VAR_0->VAR_1 = VAR_1;", "VAR_0->ret = -EINPROGRESS;", "VAR_0->active = 0;", "mutex_lock(&lock);", "if (idle_threads == 0 && cur_threads < max_threads)\nspawn_thread();", "TAILQ_INSERT_TAIL(&request_list, VAR_0, node);", "mutex_unlock(&lock);", "cond_broadcast(&cond);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ] ]
13,964
static void input_linux_event_keyboard(void *opaque) { InputLinux *il = opaque; struct input_event event; int rc; for (;;) { rc = read(il->fd, &event, sizeof(event)); if (rc != sizeof(event)) { if (rc < 0 && errno != EAGAIN) { fprintf(stderr, "%s: read: %s\n", __func__, strerror(errno)); qemu_set_fd_handler(il->fd, NULL, NULL, NULL); close(il->fd); } break; } input_linux_handle_keyboard(il, &event); } }
false
qemu
2e6a64cb8d7506ad27d3b6c8000bc8d773936932
static void input_linux_event_keyboard(void *opaque) { InputLinux *il = opaque; struct input_event event; int rc; for (;;) { rc = read(il->fd, &event, sizeof(event)); if (rc != sizeof(event)) { if (rc < 0 && errno != EAGAIN) { fprintf(stderr, "%s: read: %s\n", __func__, strerror(errno)); qemu_set_fd_handler(il->fd, NULL, NULL, NULL); close(il->fd); } break; } input_linux_handle_keyboard(il, &event); } }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0) { InputLinux *il = VAR_0; struct input_event VAR_1; int VAR_2; for (;;) { VAR_2 = read(il->fd, &VAR_1, sizeof(VAR_1)); if (VAR_2 != sizeof(VAR_1)) { if (VAR_2 < 0 && errno != EAGAIN) { fprintf(stderr, "%s: read: %s\n", __func__, strerror(errno)); qemu_set_fd_handler(il->fd, NULL, NULL, NULL); close(il->fd); } break; } input_linux_handle_keyboard(il, &VAR_1); } }
[ "static void FUNC_0(void *VAR_0)\n{", "InputLinux *il = VAR_0;", "struct input_event VAR_1;", "int VAR_2;", "for (;;) {", "VAR_2 = read(il->fd, &VAR_1, sizeof(VAR_1));", "if (VAR_2 != sizeof(VAR_1)) {", "if (VAR_2 < 0 && errno != EAGAIN) {", "fprintf(stderr, \"%s: read: %s\\n\", __func__, strerror(errno));", "qemu_set_fd_handler(il->fd, NULL, NULL, NULL);", "close(il->fd);", "}", "break;", "}", "input_linux_handle_keyboard(il, &VAR_1);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ] ]
13,965
static void v9fs_create(void *opaque) { int32_t fid; int err = 0; size_t offset = 7; V9fsFidState *fidp; V9fsQID qid; int32_t perm; int8_t mode; V9fsPath path; struct stat stbuf; V9fsString name; V9fsString extension; int iounit; V9fsPDU *pdu = opaque; v9fs_path_init(&path); pdu_unmarshal(pdu, offset, "dsdbs", &fid, &name, &perm, &mode, &extension); trace_v9fs_create(pdu->tag, pdu->id, fid, name.data, perm, mode); fidp = get_fid(pdu, fid); if (fidp == NULL) { err = -EINVAL; goto out_nofid; } if (perm & P9_STAT_MODE_DIR) { err = v9fs_co_mkdir(pdu, fidp, &name, perm & 0777, fidp->uid, -1, &stbuf); if (err < 0) { goto out; } err = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path); if (err < 0) { goto out; } v9fs_path_copy(&fidp->path, &path); err = v9fs_co_opendir(pdu, fidp); if (err < 0) { goto out; } fidp->fid_type = P9_FID_DIR; } else if (perm & P9_STAT_MODE_SYMLINK) { err = v9fs_co_symlink(pdu, fidp, &name, extension.data, -1 , &stbuf); if (err < 0) { goto out; } err = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path); if (err < 0) { goto out; } v9fs_path_copy(&fidp->path, &path); } else if (perm & P9_STAT_MODE_LINK) { int32_t ofid = atoi(extension.data); V9fsFidState *ofidp = get_fid(pdu, ofid); if (ofidp == NULL) { err = -EINVAL; goto out; } err = v9fs_co_link(pdu, ofidp, fidp, &name); put_fid(pdu, ofidp); if (err < 0) { goto out; } err = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path); if (err < 0) { fidp->fid_type = P9_FID_NONE; goto out; } v9fs_path_copy(&fidp->path, &path); err = v9fs_co_lstat(pdu, &fidp->path, &stbuf); if (err < 0) { fidp->fid_type = P9_FID_NONE; goto out; } } else if (perm & P9_STAT_MODE_DEVICE) { char ctype; uint32_t major, minor; mode_t nmode = 0; if (sscanf(extension.data, "%c %u %u", &ctype, &major, &minor) != 3) { err = -errno; goto out; } switch (ctype) { case 'c': nmode = S_IFCHR; break; case 'b': nmode = S_IFBLK; break; default: err = -EIO; goto out; } nmode |= perm & 0777; err = v9fs_co_mknod(pdu, fidp, &name, fidp->uid, -1, makedev(major, minor), nmode, &stbuf); if (err < 0) { goto out; } err = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path); if (err < 0) { goto out; } v9fs_path_copy(&fidp->path, &path); } else if (perm & P9_STAT_MODE_NAMED_PIPE) { err = v9fs_co_mknod(pdu, fidp, &name, fidp->uid, -1, 0, S_IFIFO | (perm & 0777), &stbuf); if (err < 0) { goto out; } err = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path); if (err < 0) { goto out; } v9fs_path_copy(&fidp->path, &path); } else if (perm & P9_STAT_MODE_SOCKET) { err = v9fs_co_mknod(pdu, fidp, &name, fidp->uid, -1, 0, S_IFSOCK | (perm & 0777), &stbuf); if (err < 0) { goto out; } err = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path); if (err < 0) { goto out; } v9fs_path_copy(&fidp->path, &path); } else { err = v9fs_co_open2(pdu, fidp, &name, -1, omode_to_uflags(mode)|O_CREAT, perm, &stbuf); if (err < 0) { goto out; } fidp->fid_type = P9_FID_FILE; fidp->open_flags = omode_to_uflags(mode); if (fidp->open_flags & O_EXCL) { /* * We let the host file system do O_EXCL check * We should not reclaim such fd */ fidp->flags |= FID_NON_RECLAIMABLE; } } iounit = get_iounit(pdu, &fidp->path); stat_to_qid(&stbuf, &qid); offset += pdu_marshal(pdu, offset, "Qd", &qid, iounit); err = offset; out: put_fid(pdu, fidp); out_nofid: complete_pdu(pdu->s, pdu, err); v9fs_string_free(&name); v9fs_string_free(&extension); v9fs_path_free(&path); }
true
qemu
c572f23a3e7180dbeab5e86583e43ea2afed6271
static void v9fs_create(void *opaque) { int32_t fid; int err = 0; size_t offset = 7; V9fsFidState *fidp; V9fsQID qid; int32_t perm; int8_t mode; V9fsPath path; struct stat stbuf; V9fsString name; V9fsString extension; int iounit; V9fsPDU *pdu = opaque; v9fs_path_init(&path); pdu_unmarshal(pdu, offset, "dsdbs", &fid, &name, &perm, &mode, &extension); trace_v9fs_create(pdu->tag, pdu->id, fid, name.data, perm, mode); fidp = get_fid(pdu, fid); if (fidp == NULL) { err = -EINVAL; goto out_nofid; } if (perm & P9_STAT_MODE_DIR) { err = v9fs_co_mkdir(pdu, fidp, &name, perm & 0777, fidp->uid, -1, &stbuf); if (err < 0) { goto out; } err = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path); if (err < 0) { goto out; } v9fs_path_copy(&fidp->path, &path); err = v9fs_co_opendir(pdu, fidp); if (err < 0) { goto out; } fidp->fid_type = P9_FID_DIR; } else if (perm & P9_STAT_MODE_SYMLINK) { err = v9fs_co_symlink(pdu, fidp, &name, extension.data, -1 , &stbuf); if (err < 0) { goto out; } err = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path); if (err < 0) { goto out; } v9fs_path_copy(&fidp->path, &path); } else if (perm & P9_STAT_MODE_LINK) { int32_t ofid = atoi(extension.data); V9fsFidState *ofidp = get_fid(pdu, ofid); if (ofidp == NULL) { err = -EINVAL; goto out; } err = v9fs_co_link(pdu, ofidp, fidp, &name); put_fid(pdu, ofidp); if (err < 0) { goto out; } err = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path); if (err < 0) { fidp->fid_type = P9_FID_NONE; goto out; } v9fs_path_copy(&fidp->path, &path); err = v9fs_co_lstat(pdu, &fidp->path, &stbuf); if (err < 0) { fidp->fid_type = P9_FID_NONE; goto out; } } else if (perm & P9_STAT_MODE_DEVICE) { char ctype; uint32_t major, minor; mode_t nmode = 0; if (sscanf(extension.data, "%c %u %u", &ctype, &major, &minor) != 3) { err = -errno; goto out; } switch (ctype) { case 'c': nmode = S_IFCHR; break; case 'b': nmode = S_IFBLK; break; default: err = -EIO; goto out; } nmode |= perm & 0777; err = v9fs_co_mknod(pdu, fidp, &name, fidp->uid, -1, makedev(major, minor), nmode, &stbuf); if (err < 0) { goto out; } err = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path); if (err < 0) { goto out; } v9fs_path_copy(&fidp->path, &path); } else if (perm & P9_STAT_MODE_NAMED_PIPE) { err = v9fs_co_mknod(pdu, fidp, &name, fidp->uid, -1, 0, S_IFIFO | (perm & 0777), &stbuf); if (err < 0) { goto out; } err = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path); if (err < 0) { goto out; } v9fs_path_copy(&fidp->path, &path); } else if (perm & P9_STAT_MODE_SOCKET) { err = v9fs_co_mknod(pdu, fidp, &name, fidp->uid, -1, 0, S_IFSOCK | (perm & 0777), &stbuf); if (err < 0) { goto out; } err = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path); if (err < 0) { goto out; } v9fs_path_copy(&fidp->path, &path); } else { err = v9fs_co_open2(pdu, fidp, &name, -1, omode_to_uflags(mode)|O_CREAT, perm, &stbuf); if (err < 0) { goto out; } fidp->fid_type = P9_FID_FILE; fidp->open_flags = omode_to_uflags(mode); if (fidp->open_flags & O_EXCL) { fidp->flags |= FID_NON_RECLAIMABLE; } } iounit = get_iounit(pdu, &fidp->path); stat_to_qid(&stbuf, &qid); offset += pdu_marshal(pdu, offset, "Qd", &qid, iounit); err = offset; out: put_fid(pdu, fidp); out_nofid: complete_pdu(pdu->s, pdu, err); v9fs_string_free(&name); v9fs_string_free(&extension); v9fs_path_free(&path); }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0) { int32_t fid; int VAR_1 = 0; size_t offset = 7; V9fsFidState *fidp; V9fsQID qid; int32_t perm; int8_t mode; V9fsPath path; struct stat VAR_2; V9fsString name; V9fsString extension; int VAR_3; V9fsPDU *pdu = VAR_0; v9fs_path_init(&path); pdu_unmarshal(pdu, offset, "dsdbs", &fid, &name, &perm, &mode, &extension); trace_v9fs_create(pdu->tag, pdu->id, fid, name.data, perm, mode); fidp = get_fid(pdu, fid); if (fidp == NULL) { VAR_1 = -EINVAL; goto out_nofid; } if (perm & P9_STAT_MODE_DIR) { VAR_1 = v9fs_co_mkdir(pdu, fidp, &name, perm & 0777, fidp->uid, -1, &VAR_2); if (VAR_1 < 0) { goto out; } VAR_1 = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path); if (VAR_1 < 0) { goto out; } v9fs_path_copy(&fidp->path, &path); VAR_1 = v9fs_co_opendir(pdu, fidp); if (VAR_1 < 0) { goto out; } fidp->fid_type = P9_FID_DIR; } else if (perm & P9_STAT_MODE_SYMLINK) { VAR_1 = v9fs_co_symlink(pdu, fidp, &name, extension.data, -1 , &VAR_2); if (VAR_1 < 0) { goto out; } VAR_1 = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path); if (VAR_1 < 0) { goto out; } v9fs_path_copy(&fidp->path, &path); } else if (perm & P9_STAT_MODE_LINK) { int32_t ofid = atoi(extension.data); V9fsFidState *ofidp = get_fid(pdu, ofid); if (ofidp == NULL) { VAR_1 = -EINVAL; goto out; } VAR_1 = v9fs_co_link(pdu, ofidp, fidp, &name); put_fid(pdu, ofidp); if (VAR_1 < 0) { goto out; } VAR_1 = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path); if (VAR_1 < 0) { fidp->fid_type = P9_FID_NONE; goto out; } v9fs_path_copy(&fidp->path, &path); VAR_1 = v9fs_co_lstat(pdu, &fidp->path, &VAR_2); if (VAR_1 < 0) { fidp->fid_type = P9_FID_NONE; goto out; } } else if (perm & P9_STAT_MODE_DEVICE) { char VAR_4; uint32_t major, minor; mode_t nmode = 0; if (sscanf(extension.data, "%c %u %u", &VAR_4, &major, &minor) != 3) { VAR_1 = -errno; goto out; } switch (VAR_4) { case 'c': nmode = S_IFCHR; break; case 'b': nmode = S_IFBLK; break; default: VAR_1 = -EIO; goto out; } nmode |= perm & 0777; VAR_1 = v9fs_co_mknod(pdu, fidp, &name, fidp->uid, -1, makedev(major, minor), nmode, &VAR_2); if (VAR_1 < 0) { goto out; } VAR_1 = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path); if (VAR_1 < 0) { goto out; } v9fs_path_copy(&fidp->path, &path); } else if (perm & P9_STAT_MODE_NAMED_PIPE) { VAR_1 = v9fs_co_mknod(pdu, fidp, &name, fidp->uid, -1, 0, S_IFIFO | (perm & 0777), &VAR_2); if (VAR_1 < 0) { goto out; } VAR_1 = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path); if (VAR_1 < 0) { goto out; } v9fs_path_copy(&fidp->path, &path); } else if (perm & P9_STAT_MODE_SOCKET) { VAR_1 = v9fs_co_mknod(pdu, fidp, &name, fidp->uid, -1, 0, S_IFSOCK | (perm & 0777), &VAR_2); if (VAR_1 < 0) { goto out; } VAR_1 = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path); if (VAR_1 < 0) { goto out; } v9fs_path_copy(&fidp->path, &path); } else { VAR_1 = v9fs_co_open2(pdu, fidp, &name, -1, omode_to_uflags(mode)|O_CREAT, perm, &VAR_2); if (VAR_1 < 0) { goto out; } fidp->fid_type = P9_FID_FILE; fidp->open_flags = omode_to_uflags(mode); if (fidp->open_flags & O_EXCL) { fidp->flags |= FID_NON_RECLAIMABLE; } } VAR_3 = get_iounit(pdu, &fidp->path); stat_to_qid(&VAR_2, &qid); offset += pdu_marshal(pdu, offset, "Qd", &qid, VAR_3); VAR_1 = offset; out: put_fid(pdu, fidp); out_nofid: complete_pdu(pdu->s, pdu, VAR_1); v9fs_string_free(&name); v9fs_string_free(&extension); v9fs_path_free(&path); }
[ "static void FUNC_0(void *VAR_0)\n{", "int32_t fid;", "int VAR_1 = 0;", "size_t offset = 7;", "V9fsFidState *fidp;", "V9fsQID qid;", "int32_t perm;", "int8_t mode;", "V9fsPath path;", "struct stat VAR_2;", "V9fsString name;", "V9fsString extension;", "int VAR_3;", "V9fsPDU *pdu = VAR_0;", "v9fs_path_init(&path);", "pdu_unmarshal(pdu, offset, \"dsdbs\", &fid, &name,\n&perm, &mode, &extension);", "trace_v9fs_create(pdu->tag, pdu->id, fid, name.data, perm, mode);", "fidp = get_fid(pdu, fid);", "if (fidp == NULL) {", "VAR_1 = -EINVAL;", "goto out_nofid;", "}", "if (perm & P9_STAT_MODE_DIR) {", "VAR_1 = v9fs_co_mkdir(pdu, fidp, &name, perm & 0777,\nfidp->uid, -1, &VAR_2);", "if (VAR_1 < 0) {", "goto out;", "}", "VAR_1 = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path);", "if (VAR_1 < 0) {", "goto out;", "}", "v9fs_path_copy(&fidp->path, &path);", "VAR_1 = v9fs_co_opendir(pdu, fidp);", "if (VAR_1 < 0) {", "goto out;", "}", "fidp->fid_type = P9_FID_DIR;", "} else if (perm & P9_STAT_MODE_SYMLINK) {", "VAR_1 = v9fs_co_symlink(pdu, fidp, &name,\nextension.data, -1 , &VAR_2);", "if (VAR_1 < 0) {", "goto out;", "}", "VAR_1 = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path);", "if (VAR_1 < 0) {", "goto out;", "}", "v9fs_path_copy(&fidp->path, &path);", "} else if (perm & P9_STAT_MODE_LINK) {", "int32_t ofid = atoi(extension.data);", "V9fsFidState *ofidp = get_fid(pdu, ofid);", "if (ofidp == NULL) {", "VAR_1 = -EINVAL;", "goto out;", "}", "VAR_1 = v9fs_co_link(pdu, ofidp, fidp, &name);", "put_fid(pdu, ofidp);", "if (VAR_1 < 0) {", "goto out;", "}", "VAR_1 = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path);", "if (VAR_1 < 0) {", "fidp->fid_type = P9_FID_NONE;", "goto out;", "}", "v9fs_path_copy(&fidp->path, &path);", "VAR_1 = v9fs_co_lstat(pdu, &fidp->path, &VAR_2);", "if (VAR_1 < 0) {", "fidp->fid_type = P9_FID_NONE;", "goto out;", "}", "} else if (perm & P9_STAT_MODE_DEVICE) {", "char VAR_4;", "uint32_t major, minor;", "mode_t nmode = 0;", "if (sscanf(extension.data, \"%c %u %u\", &VAR_4, &major, &minor) != 3) {", "VAR_1 = -errno;", "goto out;", "}", "switch (VAR_4) {", "case 'c':\nnmode = S_IFCHR;", "break;", "case 'b':\nnmode = S_IFBLK;", "break;", "default:\nVAR_1 = -EIO;", "goto out;", "}", "nmode |= perm & 0777;", "VAR_1 = v9fs_co_mknod(pdu, fidp, &name, fidp->uid, -1,\nmakedev(major, minor), nmode, &VAR_2);", "if (VAR_1 < 0) {", "goto out;", "}", "VAR_1 = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path);", "if (VAR_1 < 0) {", "goto out;", "}", "v9fs_path_copy(&fidp->path, &path);", "} else if (perm & P9_STAT_MODE_NAMED_PIPE) {", "VAR_1 = v9fs_co_mknod(pdu, fidp, &name, fidp->uid, -1,\n0, S_IFIFO | (perm & 0777), &VAR_2);", "if (VAR_1 < 0) {", "goto out;", "}", "VAR_1 = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path);", "if (VAR_1 < 0) {", "goto out;", "}", "v9fs_path_copy(&fidp->path, &path);", "} else if (perm & P9_STAT_MODE_SOCKET) {", "VAR_1 = v9fs_co_mknod(pdu, fidp, &name, fidp->uid, -1,\n0, S_IFSOCK | (perm & 0777), &VAR_2);", "if (VAR_1 < 0) {", "goto out;", "}", "VAR_1 = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path);", "if (VAR_1 < 0) {", "goto out;", "}", "v9fs_path_copy(&fidp->path, &path);", "} else {", "VAR_1 = v9fs_co_open2(pdu, fidp, &name, -1,\nomode_to_uflags(mode)|O_CREAT, perm, &VAR_2);", "if (VAR_1 < 0) {", "goto out;", "}", "fidp->fid_type = P9_FID_FILE;", "fidp->open_flags = omode_to_uflags(mode);", "if (fidp->open_flags & O_EXCL) {", "fidp->flags |= FID_NON_RECLAIMABLE;", "}", "}", "VAR_3 = get_iounit(pdu, &fidp->path);", "stat_to_qid(&VAR_2, &qid);", "offset += pdu_marshal(pdu, offset, \"Qd\", &qid, VAR_3);", "VAR_1 = offset;", "out:\nput_fid(pdu, fidp);", "out_nofid:\ncomplete_pdu(pdu->s, pdu, VAR_1);", "v9fs_string_free(&name);", "v9fs_string_free(&extension);", "v9fs_path_free(&path);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 37, 39 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59, 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91, 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 177 ], [ 179, 181 ], [ 183 ], [ 185, 187 ], [ 189 ], [ 191, 193 ], [ 195 ], [ 197 ], [ 201 ], [ 203, 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225, 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247, 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269, 271 ], [ 273 ], [ 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305 ], [ 307, 309 ], [ 311, 315 ], [ 317 ], [ 319 ], [ 321 ], [ 323 ] ]
13,966
static int gen_neon_unzip(int rd, int rm, int size, int q) { TCGv tmp, tmp2; if (size == 3 || (!q && size == 2)) { return 1; } tmp = tcg_const_i32(rd); tmp2 = tcg_const_i32(rm); if (q) { switch (size) { case 0: gen_helper_neon_qunzip8(tmp, tmp2); break; case 1: gen_helper_neon_qunzip16(tmp, tmp2); break; case 2: gen_helper_neon_qunzip32(tmp, tmp2); break; default: abort(); } } else { switch (size) { case 0: gen_helper_neon_unzip8(tmp, tmp2); break; case 1: gen_helper_neon_unzip16(tmp, tmp2); break; default: abort(); } } tcg_temp_free_i32(tmp); tcg_temp_free_i32(tmp2); return 0; }
true
qemu
600b828c448f108b89e1f864f0420a49ccb70d43
static int gen_neon_unzip(int rd, int rm, int size, int q) { TCGv tmp, tmp2; if (size == 3 || (!q && size == 2)) { return 1; } tmp = tcg_const_i32(rd); tmp2 = tcg_const_i32(rm); if (q) { switch (size) { case 0: gen_helper_neon_qunzip8(tmp, tmp2); break; case 1: gen_helper_neon_qunzip16(tmp, tmp2); break; case 2: gen_helper_neon_qunzip32(tmp, tmp2); break; default: abort(); } } else { switch (size) { case 0: gen_helper_neon_unzip8(tmp, tmp2); break; case 1: gen_helper_neon_unzip16(tmp, tmp2); break; default: abort(); } } tcg_temp_free_i32(tmp); tcg_temp_free_i32(tmp2); return 0; }
{ "code": [ " if (size == 3 || (!q && size == 2)) {", " if (size == 3 || (!q && size == 2)) {" ], "line_no": [ 7, 7 ] }
static int FUNC_0(int VAR_0, int VAR_1, int VAR_2, int VAR_3) { TCGv tmp, tmp2; if (VAR_2 == 3 || (!VAR_3 && VAR_2 == 2)) { return 1; } tmp = tcg_const_i32(VAR_0); tmp2 = tcg_const_i32(VAR_1); if (VAR_3) { switch (VAR_2) { case 0: gen_helper_neon_qunzip8(tmp, tmp2); break; case 1: gen_helper_neon_qunzip16(tmp, tmp2); break; case 2: gen_helper_neon_qunzip32(tmp, tmp2); break; default: abort(); } } else { switch (VAR_2) { case 0: gen_helper_neon_unzip8(tmp, tmp2); break; case 1: gen_helper_neon_unzip16(tmp, tmp2); break; default: abort(); } } tcg_temp_free_i32(tmp); tcg_temp_free_i32(tmp2); return 0; }
[ "static int FUNC_0(int VAR_0, int VAR_1, int VAR_2, int VAR_3)\n{", "TCGv tmp, tmp2;", "if (VAR_2 == 3 || (!VAR_3 && VAR_2 == 2)) {", "return 1;", "}", "tmp = tcg_const_i32(VAR_0);", "tmp2 = tcg_const_i32(VAR_1);", "if (VAR_3) {", "switch (VAR_2) {", "case 0:\ngen_helper_neon_qunzip8(tmp, tmp2);", "break;", "case 1:\ngen_helper_neon_qunzip16(tmp, tmp2);", "break;", "case 2:\ngen_helper_neon_qunzip32(tmp, tmp2);", "break;", "default:\nabort();", "}", "} else {", "switch (VAR_2) {", "case 0:\ngen_helper_neon_unzip8(tmp, tmp2);", "break;", "case 1:\ngen_helper_neon_unzip16(tmp, tmp2);", "break;", "default:\nabort();", "}", "}", "tcg_temp_free_i32(tmp);", "tcg_temp_free_i32(tmp2);", "return 0;", "}" ]
[ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21, 23 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49, 51 ], [ 53 ], [ 55, 57 ], [ 59 ], [ 61, 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ] ]
13,967
static void gen_wait(DisasContext *ctx) { TCGv_i32 t0 = tcg_temp_new_i32(); tcg_gen_st_i32(t0, cpu_env, -offsetof(PowerPCCPU, env) + offsetof(CPUState, halted)); tcg_temp_free_i32(t0); /* Stop translation, as the CPU is supposed to sleep from now */ gen_exception_err(ctx, EXCP_HLT, 1); }
true
qemu
35b5066ea7c2c3051fbc5a24b3d463b9800063e2
static void gen_wait(DisasContext *ctx) { TCGv_i32 t0 = tcg_temp_new_i32(); tcg_gen_st_i32(t0, cpu_env, -offsetof(PowerPCCPU, env) + offsetof(CPUState, halted)); tcg_temp_free_i32(t0); gen_exception_err(ctx, EXCP_HLT, 1); }
{ "code": [ " TCGv_i32 t0 = tcg_temp_new_i32();" ], "line_no": [ 5 ] }
static void FUNC_0(DisasContext *VAR_0) { TCGv_i32 t0 = tcg_temp_new_i32(); tcg_gen_st_i32(t0, cpu_env, -offsetof(PowerPCCPU, env) + offsetof(CPUState, halted)); tcg_temp_free_i32(t0); gen_exception_err(VAR_0, EXCP_HLT, 1); }
[ "static void FUNC_0(DisasContext *VAR_0)\n{", "TCGv_i32 t0 = tcg_temp_new_i32();", "tcg_gen_st_i32(t0, cpu_env,\n-offsetof(PowerPCCPU, env) + offsetof(CPUState, halted));", "tcg_temp_free_i32(t0);", "gen_exception_err(VAR_0, EXCP_HLT, 1);", "}" ]
[ 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 11 ], [ 15 ], [ 17 ] ]
13,968
GuestExec *qmp_guest_exec(const char *path, bool has_arg, strList *arg, bool has_env, strList *env, bool has_input_data, const char *input_data, bool has_capture_output, bool capture_output, Error **err) { GPid pid; GuestExec *ge = NULL; GuestExecInfo *gei; char **argv, **envp; strList arglist; gboolean ret; GError *gerr = NULL; gint in_fd, out_fd, err_fd; GIOChannel *in_ch, *out_ch, *err_ch; GSpawnFlags flags; bool has_output = (has_capture_output && capture_output); uint8_t *input = NULL; size_t ninput = 0; arglist.value = (char *)path; arglist.next = has_arg ? arg : NULL; if (has_input_data) { input = qbase64_decode(input_data, -1, &ninput, err); if (!input) { return NULL; } } argv = guest_exec_get_args(&arglist, true); envp = has_env ? guest_exec_get_args(env, false) : NULL; flags = G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD; #if GLIB_CHECK_VERSION(2, 33, 2) flags |= G_SPAWN_SEARCH_PATH_FROM_ENVP; #endif if (!has_output) { flags |= G_SPAWN_STDOUT_TO_DEV_NULL | G_SPAWN_STDERR_TO_DEV_NULL; } ret = g_spawn_async_with_pipes(NULL, argv, envp, flags, guest_exec_task_setup, NULL, &pid, has_input_data ? &in_fd : NULL, has_output ? &out_fd : NULL, has_output ? &err_fd : NULL, &gerr); if (!ret) { error_setg(err, QERR_QGA_COMMAND_FAILED, gerr->message); g_error_free(gerr); goto done; } ge = g_new0(GuestExec, 1); ge->pid = gpid_to_int64(pid); gei = guest_exec_info_add(pid); gei->has_output = has_output; g_child_watch_add(pid, guest_exec_child_watch, gei); if (has_input_data) { gei->in.data = input; gei->in.size = ninput; #ifdef G_OS_WIN32 in_ch = g_io_channel_win32_new_fd(in_fd); #else in_ch = g_io_channel_unix_new(in_fd); #endif g_io_channel_set_encoding(in_ch, NULL, NULL); g_io_channel_set_buffered(in_ch, false); g_io_channel_set_flags(in_ch, G_IO_FLAG_NONBLOCK, NULL); g_io_add_watch(in_ch, G_IO_OUT, guest_exec_input_watch, &gei->in); } if (has_output) { #ifdef G_OS_WIN32 out_ch = g_io_channel_win32_new_fd(out_fd); err_ch = g_io_channel_win32_new_fd(err_fd); #else out_ch = g_io_channel_unix_new(out_fd); err_ch = g_io_channel_unix_new(err_fd); #endif g_io_channel_set_encoding(out_ch, NULL, NULL); g_io_channel_set_encoding(err_ch, NULL, NULL); g_io_channel_set_buffered(out_ch, false); g_io_channel_set_buffered(err_ch, false); g_io_channel_set_close_on_unref(out_ch, true); g_io_channel_set_close_on_unref(err_ch, true); g_io_add_watch(out_ch, G_IO_IN | G_IO_HUP, guest_exec_output_watch, &gei->out); g_io_add_watch(err_ch, G_IO_IN | G_IO_HUP, guest_exec_output_watch, &gei->err); } done: g_free(argv); g_free(envp); return ge; }
true
qemu
3005c2c2fa2875a3413af97e9db368856d3330fd
GuestExec *qmp_guest_exec(const char *path, bool has_arg, strList *arg, bool has_env, strList *env, bool has_input_data, const char *input_data, bool has_capture_output, bool capture_output, Error **err) { GPid pid; GuestExec *ge = NULL; GuestExecInfo *gei; char **argv, **envp; strList arglist; gboolean ret; GError *gerr = NULL; gint in_fd, out_fd, err_fd; GIOChannel *in_ch, *out_ch, *err_ch; GSpawnFlags flags; bool has_output = (has_capture_output && capture_output); uint8_t *input = NULL; size_t ninput = 0; arglist.value = (char *)path; arglist.next = has_arg ? arg : NULL; if (has_input_data) { input = qbase64_decode(input_data, -1, &ninput, err); if (!input) { return NULL; } } argv = guest_exec_get_args(&arglist, true); envp = has_env ? guest_exec_get_args(env, false) : NULL; flags = G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD; #if GLIB_CHECK_VERSION(2, 33, 2) flags |= G_SPAWN_SEARCH_PATH_FROM_ENVP; #endif if (!has_output) { flags |= G_SPAWN_STDOUT_TO_DEV_NULL | G_SPAWN_STDERR_TO_DEV_NULL; } ret = g_spawn_async_with_pipes(NULL, argv, envp, flags, guest_exec_task_setup, NULL, &pid, has_input_data ? &in_fd : NULL, has_output ? &out_fd : NULL, has_output ? &err_fd : NULL, &gerr); if (!ret) { error_setg(err, QERR_QGA_COMMAND_FAILED, gerr->message); g_error_free(gerr); goto done; } ge = g_new0(GuestExec, 1); ge->pid = gpid_to_int64(pid); gei = guest_exec_info_add(pid); gei->has_output = has_output; g_child_watch_add(pid, guest_exec_child_watch, gei); if (has_input_data) { gei->in.data = input; gei->in.size = ninput; #ifdef G_OS_WIN32 in_ch = g_io_channel_win32_new_fd(in_fd); #else in_ch = g_io_channel_unix_new(in_fd); #endif g_io_channel_set_encoding(in_ch, NULL, NULL); g_io_channel_set_buffered(in_ch, false); g_io_channel_set_flags(in_ch, G_IO_FLAG_NONBLOCK, NULL); g_io_add_watch(in_ch, G_IO_OUT, guest_exec_input_watch, &gei->in); } if (has_output) { #ifdef G_OS_WIN32 out_ch = g_io_channel_win32_new_fd(out_fd); err_ch = g_io_channel_win32_new_fd(err_fd); #else out_ch = g_io_channel_unix_new(out_fd); err_ch = g_io_channel_unix_new(err_fd); #endif g_io_channel_set_encoding(out_ch, NULL, NULL); g_io_channel_set_encoding(err_ch, NULL, NULL); g_io_channel_set_buffered(out_ch, false); g_io_channel_set_buffered(err_ch, false); g_io_channel_set_close_on_unref(out_ch, true); g_io_channel_set_close_on_unref(err_ch, true); g_io_add_watch(out_ch, G_IO_IN | G_IO_HUP, guest_exec_output_watch, &gei->out); g_io_add_watch(err_ch, G_IO_IN | G_IO_HUP, guest_exec_output_watch, &gei->err); } done: g_free(argv); g_free(envp); return ge; }
{ "code": [], "line_no": [] }
GuestExec *FUNC_0(const char *path, bool has_arg, strList *arg, bool has_env, strList *env, bool has_input_data, const char *input_data, bool has_capture_output, bool capture_output, Error **err) { GPid pid; GuestExec *ge = NULL; GuestExecInfo *gei; char **VAR_0, **VAR_1; strList arglist; gboolean ret; GError *gerr = NULL; gint in_fd, out_fd, err_fd; GIOChannel *in_ch, *out_ch, *err_ch; GSpawnFlags flags; bool has_output = (has_capture_output && capture_output); uint8_t *input = NULL; size_t ninput = 0; arglist.value = (char *)path; arglist.next = has_arg ? arg : NULL; if (has_input_data) { input = qbase64_decode(input_data, -1, &ninput, err); if (!input) { return NULL; } } VAR_0 = guest_exec_get_args(&arglist, true); VAR_1 = has_env ? guest_exec_get_args(env, false) : NULL; flags = G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD; #if GLIB_CHECK_VERSION(2, 33, 2) flags |= G_SPAWN_SEARCH_PATH_FROM_ENVP; #endif if (!has_output) { flags |= G_SPAWN_STDOUT_TO_DEV_NULL | G_SPAWN_STDERR_TO_DEV_NULL; } ret = g_spawn_async_with_pipes(NULL, VAR_0, VAR_1, flags, guest_exec_task_setup, NULL, &pid, has_input_data ? &in_fd : NULL, has_output ? &out_fd : NULL, has_output ? &err_fd : NULL, &gerr); if (!ret) { error_setg(err, QERR_QGA_COMMAND_FAILED, gerr->message); g_error_free(gerr); goto done; } ge = g_new0(GuestExec, 1); ge->pid = gpid_to_int64(pid); gei = guest_exec_info_add(pid); gei->has_output = has_output; g_child_watch_add(pid, guest_exec_child_watch, gei); if (has_input_data) { gei->in.data = input; gei->in.size = ninput; #ifdef G_OS_WIN32 in_ch = g_io_channel_win32_new_fd(in_fd); #else in_ch = g_io_channel_unix_new(in_fd); #endif g_io_channel_set_encoding(in_ch, NULL, NULL); g_io_channel_set_buffered(in_ch, false); g_io_channel_set_flags(in_ch, G_IO_FLAG_NONBLOCK, NULL); g_io_add_watch(in_ch, G_IO_OUT, guest_exec_input_watch, &gei->in); } if (has_output) { #ifdef G_OS_WIN32 out_ch = g_io_channel_win32_new_fd(out_fd); err_ch = g_io_channel_win32_new_fd(err_fd); #else out_ch = g_io_channel_unix_new(out_fd); err_ch = g_io_channel_unix_new(err_fd); #endif g_io_channel_set_encoding(out_ch, NULL, NULL); g_io_channel_set_encoding(err_ch, NULL, NULL); g_io_channel_set_buffered(out_ch, false); g_io_channel_set_buffered(err_ch, false); g_io_channel_set_close_on_unref(out_ch, true); g_io_channel_set_close_on_unref(err_ch, true); g_io_add_watch(out_ch, G_IO_IN | G_IO_HUP, guest_exec_output_watch, &gei->out); g_io_add_watch(err_ch, G_IO_IN | G_IO_HUP, guest_exec_output_watch, &gei->err); } done: g_free(VAR_0); g_free(VAR_1); return ge; }
[ "GuestExec *FUNC_0(const char *path,\nbool has_arg, strList *arg,\nbool has_env, strList *env,\nbool has_input_data, const char *input_data,\nbool has_capture_output, bool capture_output,\nError **err)\n{", "GPid pid;", "GuestExec *ge = NULL;", "GuestExecInfo *gei;", "char **VAR_0, **VAR_1;", "strList arglist;", "gboolean ret;", "GError *gerr = NULL;", "gint in_fd, out_fd, err_fd;", "GIOChannel *in_ch, *out_ch, *err_ch;", "GSpawnFlags flags;", "bool has_output = (has_capture_output && capture_output);", "uint8_t *input = NULL;", "size_t ninput = 0;", "arglist.value = (char *)path;", "arglist.next = has_arg ? arg : NULL;", "if (has_input_data) {", "input = qbase64_decode(input_data, -1, &ninput, err);", "if (!input) {", "return NULL;", "}", "}", "VAR_0 = guest_exec_get_args(&arglist, true);", "VAR_1 = has_env ? guest_exec_get_args(env, false) : NULL;", "flags = G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD;", "#if GLIB_CHECK_VERSION(2, 33, 2)\nflags |= G_SPAWN_SEARCH_PATH_FROM_ENVP;", "#endif\nif (!has_output) {", "flags |= G_SPAWN_STDOUT_TO_DEV_NULL | G_SPAWN_STDERR_TO_DEV_NULL;", "}", "ret = g_spawn_async_with_pipes(NULL, VAR_0, VAR_1, flags,\nguest_exec_task_setup, NULL, &pid, has_input_data ? &in_fd : NULL,\nhas_output ? &out_fd : NULL, has_output ? &err_fd : NULL, &gerr);", "if (!ret) {", "error_setg(err, QERR_QGA_COMMAND_FAILED, gerr->message);", "g_error_free(gerr);", "goto done;", "}", "ge = g_new0(GuestExec, 1);", "ge->pid = gpid_to_int64(pid);", "gei = guest_exec_info_add(pid);", "gei->has_output = has_output;", "g_child_watch_add(pid, guest_exec_child_watch, gei);", "if (has_input_data) {", "gei->in.data = input;", "gei->in.size = ninput;", "#ifdef G_OS_WIN32\nin_ch = g_io_channel_win32_new_fd(in_fd);", "#else\nin_ch = g_io_channel_unix_new(in_fd);", "#endif\ng_io_channel_set_encoding(in_ch, NULL, NULL);", "g_io_channel_set_buffered(in_ch, false);", "g_io_channel_set_flags(in_ch, G_IO_FLAG_NONBLOCK, NULL);", "g_io_add_watch(in_ch, G_IO_OUT, guest_exec_input_watch, &gei->in);", "}", "if (has_output) {", "#ifdef G_OS_WIN32\nout_ch = g_io_channel_win32_new_fd(out_fd);", "err_ch = g_io_channel_win32_new_fd(err_fd);", "#else\nout_ch = g_io_channel_unix_new(out_fd);", "err_ch = g_io_channel_unix_new(err_fd);", "#endif\ng_io_channel_set_encoding(out_ch, NULL, NULL);", "g_io_channel_set_encoding(err_ch, NULL, NULL);", "g_io_channel_set_buffered(out_ch, false);", "g_io_channel_set_buffered(err_ch, false);", "g_io_channel_set_close_on_unref(out_ch, true);", "g_io_channel_set_close_on_unref(err_ch, true);", "g_io_add_watch(out_ch, G_IO_IN | G_IO_HUP,\nguest_exec_output_watch, &gei->out);", "g_io_add_watch(err_ch, G_IO_IN | G_IO_HUP,\nguest_exec_output_watch, &gei->err);", "}", "done:\ng_free(VAR_0);", "g_free(VAR_1);", "return ge;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11, 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 69 ], [ 71, 73 ], [ 75, 77 ], [ 79 ], [ 81 ], [ 85, 87, 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 103 ], [ 105 ], [ 109 ], [ 111 ], [ 113 ], [ 117 ], [ 119 ], [ 121 ], [ 123, 125 ], [ 127, 129 ], [ 131, 133 ], [ 135 ], [ 137 ], [ 140 ], [ 142 ], [ 146 ], [ 148, 150 ], [ 152 ], [ 154, 156 ], [ 158 ], [ 160, 162 ], [ 164 ], [ 166 ], [ 168 ], [ 170 ], [ 172 ], [ 174, 176 ], [ 178, 180 ], [ 182 ], [ 186, 188 ], [ 190 ], [ 194 ], [ 196 ] ]
13,970
static inline void RENAME(bgr24ToUV_mmx)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src, long width, enum PixelFormat srcFormat) { __asm__ volatile( "movq 24(%4), %%mm6 \n\t" "mov %3, %%"REG_a" \n\t" "pxor %%mm7, %%mm7 \n\t" "1: \n\t" PREFETCH" 64(%0) \n\t" "movd (%0), %%mm0 \n\t" "movd 2(%0), %%mm1 \n\t" "punpcklbw %%mm7, %%mm0 \n\t" "punpcklbw %%mm7, %%mm1 \n\t" "movq %%mm0, %%mm2 \n\t" "movq %%mm1, %%mm3 \n\t" "pmaddwd (%4), %%mm0 \n\t" "pmaddwd 8(%4), %%mm1 \n\t" "pmaddwd 16(%4), %%mm2 \n\t" "pmaddwd %%mm6, %%mm3 \n\t" "paddd %%mm1, %%mm0 \n\t" "paddd %%mm3, %%mm2 \n\t" "movd 6(%0), %%mm1 \n\t" "movd 8(%0), %%mm3 \n\t" "add $12, %0 \n\t" "punpcklbw %%mm7, %%mm1 \n\t" "punpcklbw %%mm7, %%mm3 \n\t" "movq %%mm1, %%mm4 \n\t" "movq %%mm3, %%mm5 \n\t" "pmaddwd (%4), %%mm1 \n\t" "pmaddwd 8(%4), %%mm3 \n\t" "pmaddwd 16(%4), %%mm4 \n\t" "pmaddwd %%mm6, %%mm5 \n\t" "paddd %%mm3, %%mm1 \n\t" "paddd %%mm5, %%mm4 \n\t" "movq "MANGLE(ff_bgr24toUVOffset)", %%mm3 \n\t" "paddd %%mm3, %%mm0 \n\t" "paddd %%mm3, %%mm2 \n\t" "paddd %%mm3, %%mm1 \n\t" "paddd %%mm3, %%mm4 \n\t" "psrad $15, %%mm0 \n\t" "psrad $15, %%mm2 \n\t" "psrad $15, %%mm1 \n\t" "psrad $15, %%mm4 \n\t" "packssdw %%mm1, %%mm0 \n\t" "packssdw %%mm4, %%mm2 \n\t" "packuswb %%mm0, %%mm0 \n\t" "packuswb %%mm2, %%mm2 \n\t" "movd %%mm0, (%1, %%"REG_a") \n\t" "movd %%mm2, (%2, %%"REG_a") \n\t" "add $4, %%"REG_a" \n\t" " js 1b \n\t" : "+r" (src) : "r" (dstU+width), "r" (dstV+width), "g" ((x86_reg)-width), "r"(ff_bgr24toUV[srcFormat == PIX_FMT_RGB24]) : "%"REG_a ); }
false
FFmpeg
d1adad3cca407f493c3637e20ecd4f7124e69212
static inline void RENAME(bgr24ToUV_mmx)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src, long width, enum PixelFormat srcFormat) { __asm__ volatile( "movq 24(%4), %%mm6 \n\t" "mov %3, %%"REG_a" \n\t" "pxor %%mm7, %%mm7 \n\t" "1: \n\t" PREFETCH" 64(%0) \n\t" "movd (%0), %%mm0 \n\t" "movd 2(%0), %%mm1 \n\t" "punpcklbw %%mm7, %%mm0 \n\t" "punpcklbw %%mm7, %%mm1 \n\t" "movq %%mm0, %%mm2 \n\t" "movq %%mm1, %%mm3 \n\t" "pmaddwd (%4), %%mm0 \n\t" "pmaddwd 8(%4), %%mm1 \n\t" "pmaddwd 16(%4), %%mm2 \n\t" "pmaddwd %%mm6, %%mm3 \n\t" "paddd %%mm1, %%mm0 \n\t" "paddd %%mm3, %%mm2 \n\t" "movd 6(%0), %%mm1 \n\t" "movd 8(%0), %%mm3 \n\t" "add $12, %0 \n\t" "punpcklbw %%mm7, %%mm1 \n\t" "punpcklbw %%mm7, %%mm3 \n\t" "movq %%mm1, %%mm4 \n\t" "movq %%mm3, %%mm5 \n\t" "pmaddwd (%4), %%mm1 \n\t" "pmaddwd 8(%4), %%mm3 \n\t" "pmaddwd 16(%4), %%mm4 \n\t" "pmaddwd %%mm6, %%mm5 \n\t" "paddd %%mm3, %%mm1 \n\t" "paddd %%mm5, %%mm4 \n\t" "movq "MANGLE(ff_bgr24toUVOffset)", %%mm3 \n\t" "paddd %%mm3, %%mm0 \n\t" "paddd %%mm3, %%mm2 \n\t" "paddd %%mm3, %%mm1 \n\t" "paddd %%mm3, %%mm4 \n\t" "psrad $15, %%mm0 \n\t" "psrad $15, %%mm2 \n\t" "psrad $15, %%mm1 \n\t" "psrad $15, %%mm4 \n\t" "packssdw %%mm1, %%mm0 \n\t" "packssdw %%mm4, %%mm2 \n\t" "packuswb %%mm0, %%mm0 \n\t" "packuswb %%mm2, %%mm2 \n\t" "movd %%mm0, (%1, %%"REG_a") \n\t" "movd %%mm2, (%2, %%"REG_a") \n\t" "add $4, %%"REG_a" \n\t" " js 1b \n\t" : "+r" (src) : "r" (dstU+width), "r" (dstV+width), "g" ((x86_reg)-width), "r"(ff_bgr24toUV[srcFormat == PIX_FMT_RGB24]) : "%"REG_a ); }
{ "code": [], "line_no": [] }
static inline void FUNC_0(bgr24ToUV_mmx)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src, long width, enum PixelFormat srcFormat) { __asm__ volatile( "movq 24(%4), %%mm6 \n\t" "mov %3, %%"REG_a" \n\t" "pxor %%mm7, %%mm7 \n\t" "1: \n\t" PREFETCH" 64(%0) \n\t" "movd (%0), %%mm0 \n\t" "movd 2(%0), %%mm1 \n\t" "punpcklbw %%mm7, %%mm0 \n\t" "punpcklbw %%mm7, %%mm1 \n\t" "movq %%mm0, %%mm2 \n\t" "movq %%mm1, %%mm3 \n\t" "pmaddwd (%4), %%mm0 \n\t" "pmaddwd 8(%4), %%mm1 \n\t" "pmaddwd 16(%4), %%mm2 \n\t" "pmaddwd %%mm6, %%mm3 \n\t" "paddd %%mm1, %%mm0 \n\t" "paddd %%mm3, %%mm2 \n\t" "movd 6(%0), %%mm1 \n\t" "movd 8(%0), %%mm3 \n\t" "add $12, %0 \n\t" "punpcklbw %%mm7, %%mm1 \n\t" "punpcklbw %%mm7, %%mm3 \n\t" "movq %%mm1, %%mm4 \n\t" "movq %%mm3, %%mm5 \n\t" "pmaddwd (%4), %%mm1 \n\t" "pmaddwd 8(%4), %%mm3 \n\t" "pmaddwd 16(%4), %%mm4 \n\t" "pmaddwd %%mm6, %%mm5 \n\t" "paddd %%mm3, %%mm1 \n\t" "paddd %%mm5, %%mm4 \n\t" "movq "MANGLE(ff_bgr24toUVOffset)", %%mm3 \n\t" "paddd %%mm3, %%mm0 \n\t" "paddd %%mm3, %%mm2 \n\t" "paddd %%mm3, %%mm1 \n\t" "paddd %%mm3, %%mm4 \n\t" "psrad $15, %%mm0 \n\t" "psrad $15, %%mm2 \n\t" "psrad $15, %%mm1 \n\t" "psrad $15, %%mm4 \n\t" "packssdw %%mm1, %%mm0 \n\t" "packssdw %%mm4, %%mm2 \n\t" "packuswb %%mm0, %%mm0 \n\t" "packuswb %%mm2, %%mm2 \n\t" "movd %%mm0, (%1, %%"REG_a") \n\t" "movd %%mm2, (%2, %%"REG_a") \n\t" "add $4, %%"REG_a" \n\t" " js 1b \n\t" : "+r" (src) : "r" (dstU+width), "r" (dstV+width), "g" ((x86_reg)-width), "r"(ff_bgr24toUV[srcFormat == PIX_FMT_RGB24]) : "%"REG_a ); }
[ "static inline void FUNC_0(bgr24ToUV_mmx)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src, long width, enum PixelFormat srcFormat)\n{", "__asm__ volatile(\n\"movq 24(%4), %%mm6 \\n\\t\"\n\"mov %3, %%\"REG_a\" \\n\\t\"\n\"pxor %%mm7, %%mm7 \\n\\t\"\n\"1: \\n\\t\"\nPREFETCH\" 64(%0) \\n\\t\"\n\"movd (%0), %%mm0 \\n\\t\"\n\"movd 2(%0), %%mm1 \\n\\t\"\n\"punpcklbw %%mm7, %%mm0 \\n\\t\"\n\"punpcklbw %%mm7, %%mm1 \\n\\t\"\n\"movq %%mm0, %%mm2 \\n\\t\"\n\"movq %%mm1, %%mm3 \\n\\t\"\n\"pmaddwd (%4), %%mm0 \\n\\t\"\n\"pmaddwd 8(%4), %%mm1 \\n\\t\"\n\"pmaddwd 16(%4), %%mm2 \\n\\t\"\n\"pmaddwd %%mm6, %%mm3 \\n\\t\"\n\"paddd %%mm1, %%mm0 \\n\\t\"\n\"paddd %%mm3, %%mm2 \\n\\t\"\n\"movd 6(%0), %%mm1 \\n\\t\"\n\"movd 8(%0), %%mm3 \\n\\t\"\n\"add $12, %0 \\n\\t\"\n\"punpcklbw %%mm7, %%mm1 \\n\\t\"\n\"punpcklbw %%mm7, %%mm3 \\n\\t\"\n\"movq %%mm1, %%mm4 \\n\\t\"\n\"movq %%mm3, %%mm5 \\n\\t\"\n\"pmaddwd (%4), %%mm1 \\n\\t\"\n\"pmaddwd 8(%4), %%mm3 \\n\\t\"\n\"pmaddwd 16(%4), %%mm4 \\n\\t\"\n\"pmaddwd %%mm6, %%mm5 \\n\\t\"\n\"paddd %%mm3, %%mm1 \\n\\t\"\n\"paddd %%mm5, %%mm4 \\n\\t\"\n\"movq \"MANGLE(ff_bgr24toUVOffset)\", %%mm3 \\n\\t\"\n\"paddd %%mm3, %%mm0 \\n\\t\"\n\"paddd %%mm3, %%mm2 \\n\\t\"\n\"paddd %%mm3, %%mm1 \\n\\t\"\n\"paddd %%mm3, %%mm4 \\n\\t\"\n\"psrad $15, %%mm0 \\n\\t\"\n\"psrad $15, %%mm2 \\n\\t\"\n\"psrad $15, %%mm1 \\n\\t\"\n\"psrad $15, %%mm4 \\n\\t\"\n\"packssdw %%mm1, %%mm0 \\n\\t\"\n\"packssdw %%mm4, %%mm2 \\n\\t\"\n\"packuswb %%mm0, %%mm0 \\n\\t\"\n\"packuswb %%mm2, %%mm2 \\n\\t\"\n\"movd %%mm0, (%1, %%\"REG_a\") \\n\\t\"\n\"movd %%mm2, (%2, %%\"REG_a\") \\n\\t\"\n\"add $4, %%\"REG_a\" \\n\\t\"\n\" js 1b \\n\\t\"\n: \"+r\" (src)\n: \"r\" (dstU+width), \"r\" (dstV+width), \"g\" ((x86_reg)-width), \"r\"(ff_bgr24toUV[srcFormat == PIX_FMT_RGB24])\n: \"%\"REG_a\n);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, 99, 101, 103, 105, 107, 109, 111 ], [ 113 ] ]
13,971
void intra_predict(VP8Context *s, VP8ThreadData *td, uint8_t *dst[3], VP8Macroblock *mb, int mb_x, int mb_y) { int x, y, mode, nnz; uint32_t tr; /* for the first row, we need to run xchg_mb_border to init the top edge * to 127 otherwise, skip it if we aren't going to deblock */ if (mb_y && (s->deblock_filter || !mb_y) && td->thread_nr == 0) xchg_mb_border(s->top_border[mb_x + 1], dst[0], dst[1], dst[2], s->linesize, s->uvlinesize, mb_x, mb_y, s->mb_width, s->filter.simple, 1); if (mb->mode < MODE_I4x4) { mode = check_intra_pred8x8_mode_emuedge(mb->mode, mb_x, mb_y); s->hpc.pred16x16[mode](dst[0], s->linesize); } else { uint8_t *ptr = dst[0]; uint8_t *intra4x4 = mb->intra4x4_pred_mode_mb; uint8_t tr_top[4] = { 127, 127, 127, 127 }; // all blocks on the right edge of the macroblock use bottom edge // the top macroblock for their topright edge uint8_t *tr_right = ptr - s->linesize + 16; // if we're on the right edge of the frame, said edge is extended // from the top macroblock if (mb_y && mb_x == s->mb_width - 1) { tr = tr_right[-1] * 0x01010101u; tr_right = (uint8_t *) &tr; } if (mb->skip) AV_ZERO128(td->non_zero_count_cache); for (y = 0; y < 4; y++) { uint8_t *topright = ptr + 4 - s->linesize; for (x = 0; x < 4; x++) { int copy = 0, linesize = s->linesize; uint8_t *dst = ptr + 4 * x; DECLARE_ALIGNED(4, uint8_t, copy_dst)[5 * 8]; if ((y == 0 || x == 3) && mb_y == 0) { topright = tr_top; } else if (x == 3) topright = tr_right; mode = check_intra_pred4x4_mode_emuedge(intra4x4[x], mb_x + x, mb_y + y, &copy); if (copy) { dst = copy_dst + 12; linesize = 8; if (!(mb_y + y)) { copy_dst[3] = 127U; AV_WN32A(copy_dst + 4, 127U * 0x01010101U); } else { AV_COPY32(copy_dst + 4, ptr + 4 * x - s->linesize); if (!(mb_x + x)) { copy_dst[3] = 129U; } else { copy_dst[3] = ptr[4 * x - s->linesize - 1]; } } if (!(mb_x + x)) { copy_dst[11] = copy_dst[19] = copy_dst[27] = copy_dst[35] = 129U; } else { copy_dst[11] = ptr[4 * x - 1]; copy_dst[19] = ptr[4 * x + s->linesize - 1]; copy_dst[27] = ptr[4 * x + s->linesize * 2 - 1]; copy_dst[35] = ptr[4 * x + s->linesize * 3 - 1]; } } s->hpc.pred4x4[mode](dst, topright, linesize); if (copy) { AV_COPY32(ptr + 4 * x, copy_dst + 12); AV_COPY32(ptr + 4 * x + s->linesize, copy_dst + 20); AV_COPY32(ptr + 4 * x + s->linesize * 2, copy_dst + 28); AV_COPY32(ptr + 4 * x + s->linesize * 3, copy_dst + 36); } nnz = td->non_zero_count_cache[y][x]; if (nnz) { if (nnz == 1) s->vp8dsp.vp8_idct_dc_add(ptr + 4 * x, td->block[y][x], s->linesize); else s->vp8dsp.vp8_idct_add(ptr + 4 * x, td->block[y][x], s->linesize); } topright += 4; } ptr += 4 * s->linesize; intra4x4 += 4; } } mode = check_intra_pred8x8_mode_emuedge(mb->chroma_pred_mode, mb_x, mb_y); s->hpc.pred8x8[mode](dst[1], s->uvlinesize); s->hpc.pred8x8[mode](dst[2], s->uvlinesize); if (mb_y && (s->deblock_filter || !mb_y) && td->thread_nr == 0) xchg_mb_border(s->top_border[mb_x + 1], dst[0], dst[1], dst[2], s->linesize, s->uvlinesize, mb_x, mb_y, s->mb_width, s->filter.simple, 0); }
true
FFmpeg
ac4b32df71bd932838043a4838b86d11e169707f
void intra_predict(VP8Context *s, VP8ThreadData *td, uint8_t *dst[3], VP8Macroblock *mb, int mb_x, int mb_y) { int x, y, mode, nnz; uint32_t tr; if (mb_y && (s->deblock_filter || !mb_y) && td->thread_nr == 0) xchg_mb_border(s->top_border[mb_x + 1], dst[0], dst[1], dst[2], s->linesize, s->uvlinesize, mb_x, mb_y, s->mb_width, s->filter.simple, 1); if (mb->mode < MODE_I4x4) { mode = check_intra_pred8x8_mode_emuedge(mb->mode, mb_x, mb_y); s->hpc.pred16x16[mode](dst[0], s->linesize); } else { uint8_t *ptr = dst[0]; uint8_t *intra4x4 = mb->intra4x4_pred_mode_mb; uint8_t tr_top[4] = { 127, 127, 127, 127 }; uint8_t *tr_right = ptr - s->linesize + 16; if (mb_y && mb_x == s->mb_width - 1) { tr = tr_right[-1] * 0x01010101u; tr_right = (uint8_t *) &tr; } if (mb->skip) AV_ZERO128(td->non_zero_count_cache); for (y = 0; y < 4; y++) { uint8_t *topright = ptr + 4 - s->linesize; for (x = 0; x < 4; x++) { int copy = 0, linesize = s->linesize; uint8_t *dst = ptr + 4 * x; DECLARE_ALIGNED(4, uint8_t, copy_dst)[5 * 8]; if ((y == 0 || x == 3) && mb_y == 0) { topright = tr_top; } else if (x == 3) topright = tr_right; mode = check_intra_pred4x4_mode_emuedge(intra4x4[x], mb_x + x, mb_y + y, &copy); if (copy) { dst = copy_dst + 12; linesize = 8; if (!(mb_y + y)) { copy_dst[3] = 127U; AV_WN32A(copy_dst + 4, 127U * 0x01010101U); } else { AV_COPY32(copy_dst + 4, ptr + 4 * x - s->linesize); if (!(mb_x + x)) { copy_dst[3] = 129U; } else { copy_dst[3] = ptr[4 * x - s->linesize - 1]; } } if (!(mb_x + x)) { copy_dst[11] = copy_dst[19] = copy_dst[27] = copy_dst[35] = 129U; } else { copy_dst[11] = ptr[4 * x - 1]; copy_dst[19] = ptr[4 * x + s->linesize - 1]; copy_dst[27] = ptr[4 * x + s->linesize * 2 - 1]; copy_dst[35] = ptr[4 * x + s->linesize * 3 - 1]; } } s->hpc.pred4x4[mode](dst, topright, linesize); if (copy) { AV_COPY32(ptr + 4 * x, copy_dst + 12); AV_COPY32(ptr + 4 * x + s->linesize, copy_dst + 20); AV_COPY32(ptr + 4 * x + s->linesize * 2, copy_dst + 28); AV_COPY32(ptr + 4 * x + s->linesize * 3, copy_dst + 36); } nnz = td->non_zero_count_cache[y][x]; if (nnz) { if (nnz == 1) s->vp8dsp.vp8_idct_dc_add(ptr + 4 * x, td->block[y][x], s->linesize); else s->vp8dsp.vp8_idct_add(ptr + 4 * x, td->block[y][x], s->linesize); } topright += 4; } ptr += 4 * s->linesize; intra4x4 += 4; } } mode = check_intra_pred8x8_mode_emuedge(mb->chroma_pred_mode, mb_x, mb_y); s->hpc.pred8x8[mode](dst[1], s->uvlinesize); s->hpc.pred8x8[mode](dst[2], s->uvlinesize); if (mb_y && (s->deblock_filter || !mb_y) && td->thread_nr == 0) xchg_mb_border(s->top_border[mb_x + 1], dst[0], dst[1], dst[2], s->linesize, s->uvlinesize, mb_x, mb_y, s->mb_width, s->filter.simple, 0); }
{ "code": [ " VP8Macroblock *mb, int mb_x, int mb_y)", " mode = check_intra_pred8x8_mode_emuedge(mb->mode, mb_x, mb_y);", " uint8_t tr_top[4] = { 127, 127, 127, 127 };", " mode = check_intra_pred4x4_mode_emuedge(intra4x4[x],", " mb_x + x, mb_y + y,", " &copy);", " copy_dst[3] = 127U;", " AV_WN32A(copy_dst + 4, 127U * 0x01010101U);", " copy_dst[3] = 129U;", " copy_dst[35] = 129U;", " mode = check_intra_pred8x8_mode_emuedge(mb->chroma_pred_mode, mb_x, mb_y);" ], "line_no": [ 3, 29, 39, 95, 97, 99, 109, 111, 119, 137, 203 ] }
void FUNC_0(VP8Context *VAR_0, VP8ThreadData *VAR_1, uint8_t *VAR_2[3], VP8Macroblock *VAR_3, int VAR_4, int VAR_5) { int VAR_6, VAR_7, VAR_8, VAR_9; uint32_t tr; if (VAR_5 && (VAR_0->deblock_filter || !VAR_5) && VAR_1->thread_nr == 0) xchg_mb_border(VAR_0->top_border[VAR_4 + 1], VAR_2[0], VAR_2[1], VAR_2[2], VAR_0->VAR_11, VAR_0->uvlinesize, VAR_4, VAR_5, VAR_0->mb_width, VAR_0->filter.simple, 1); if (VAR_3->VAR_8 < MODE_I4x4) { VAR_8 = check_intra_pred8x8_mode_emuedge(VAR_3->VAR_8, VAR_4, VAR_5); VAR_0->hpc.pred16x16[VAR_8](VAR_2[0], VAR_0->VAR_11); } else { uint8_t *ptr = VAR_2[0]; uint8_t *intra4x4 = VAR_3->intra4x4_pred_mode_mb; uint8_t tr_top[4] = { 127, 127, 127, 127 }; uint8_t *tr_right = ptr - VAR_0->VAR_11 + 16; if (VAR_5 && VAR_4 == VAR_0->mb_width - 1) { tr = tr_right[-1] * 0x01010101u; tr_right = (uint8_t *) &tr; } if (VAR_3->skip) AV_ZERO128(VAR_1->non_zero_count_cache); for (VAR_7 = 0; VAR_7 < 4; VAR_7++) { uint8_t *topright = ptr + 4 - VAR_0->VAR_11; for (VAR_6 = 0; VAR_6 < 4; VAR_6++) { int VAR_10 = 0, VAR_11 = VAR_0->VAR_11; uint8_t *VAR_2 = ptr + 4 * VAR_6; DECLARE_ALIGNED(4, uint8_t, copy_dst)[5 * 8]; if ((VAR_7 == 0 || VAR_6 == 3) && VAR_5 == 0) { topright = tr_top; } else if (VAR_6 == 3) topright = tr_right; VAR_8 = check_intra_pred4x4_mode_emuedge(intra4x4[VAR_6], VAR_4 + VAR_6, VAR_5 + VAR_7, &VAR_10); if (VAR_10) { VAR_2 = copy_dst + 12; VAR_11 = 8; if (!(VAR_5 + VAR_7)) { copy_dst[3] = 127U; AV_WN32A(copy_dst + 4, 127U * 0x01010101U); } else { AV_COPY32(copy_dst + 4, ptr + 4 * VAR_6 - VAR_0->VAR_11); if (!(VAR_4 + VAR_6)) { copy_dst[3] = 129U; } else { copy_dst[3] = ptr[4 * VAR_6 - VAR_0->VAR_11 - 1]; } } if (!(VAR_4 + VAR_6)) { copy_dst[11] = copy_dst[19] = copy_dst[27] = copy_dst[35] = 129U; } else { copy_dst[11] = ptr[4 * VAR_6 - 1]; copy_dst[19] = ptr[4 * VAR_6 + VAR_0->VAR_11 - 1]; copy_dst[27] = ptr[4 * VAR_6 + VAR_0->VAR_11 * 2 - 1]; copy_dst[35] = ptr[4 * VAR_6 + VAR_0->VAR_11 * 3 - 1]; } } VAR_0->hpc.pred4x4[VAR_8](VAR_2, topright, VAR_11); if (VAR_10) { AV_COPY32(ptr + 4 * VAR_6, copy_dst + 12); AV_COPY32(ptr + 4 * VAR_6 + VAR_0->VAR_11, copy_dst + 20); AV_COPY32(ptr + 4 * VAR_6 + VAR_0->VAR_11 * 2, copy_dst + 28); AV_COPY32(ptr + 4 * VAR_6 + VAR_0->VAR_11 * 3, copy_dst + 36); } VAR_9 = VAR_1->non_zero_count_cache[VAR_7][VAR_6]; if (VAR_9) { if (VAR_9 == 1) VAR_0->vp8dsp.vp8_idct_dc_add(ptr + 4 * VAR_6, VAR_1->block[VAR_7][VAR_6], VAR_0->VAR_11); else VAR_0->vp8dsp.vp8_idct_add(ptr + 4 * VAR_6, VAR_1->block[VAR_7][VAR_6], VAR_0->VAR_11); } topright += 4; } ptr += 4 * VAR_0->VAR_11; intra4x4 += 4; } } VAR_8 = check_intra_pred8x8_mode_emuedge(VAR_3->chroma_pred_mode, VAR_4, VAR_5); VAR_0->hpc.pred8x8[VAR_8](VAR_2[1], VAR_0->uvlinesize); VAR_0->hpc.pred8x8[VAR_8](VAR_2[2], VAR_0->uvlinesize); if (VAR_5 && (VAR_0->deblock_filter || !VAR_5) && VAR_1->thread_nr == 0) xchg_mb_border(VAR_0->top_border[VAR_4 + 1], VAR_2[0], VAR_2[1], VAR_2[2], VAR_0->VAR_11, VAR_0->uvlinesize, VAR_4, VAR_5, VAR_0->mb_width, VAR_0->filter.simple, 0); }
[ "void FUNC_0(VP8Context *VAR_0, VP8ThreadData *VAR_1, uint8_t *VAR_2[3],\nVP8Macroblock *VAR_3, int VAR_4, int VAR_5)\n{", "int VAR_6, VAR_7, VAR_8, VAR_9;", "uint32_t tr;", "if (VAR_5 && (VAR_0->deblock_filter || !VAR_5) && VAR_1->thread_nr == 0)\nxchg_mb_border(VAR_0->top_border[VAR_4 + 1], VAR_2[0], VAR_2[1], VAR_2[2],\nVAR_0->VAR_11, VAR_0->uvlinesize, VAR_4, VAR_5, VAR_0->mb_width,\nVAR_0->filter.simple, 1);", "if (VAR_3->VAR_8 < MODE_I4x4) {", "VAR_8 = check_intra_pred8x8_mode_emuedge(VAR_3->VAR_8, VAR_4, VAR_5);", "VAR_0->hpc.pred16x16[VAR_8](VAR_2[0], VAR_0->VAR_11);", "} else {", "uint8_t *ptr = VAR_2[0];", "uint8_t *intra4x4 = VAR_3->intra4x4_pred_mode_mb;", "uint8_t tr_top[4] = { 127, 127, 127, 127 };", "uint8_t *tr_right = ptr - VAR_0->VAR_11 + 16;", "if (VAR_5 && VAR_4 == VAR_0->mb_width - 1) {", "tr = tr_right[-1] * 0x01010101u;", "tr_right = (uint8_t *) &tr;", "}", "if (VAR_3->skip)\nAV_ZERO128(VAR_1->non_zero_count_cache);", "for (VAR_7 = 0; VAR_7 < 4; VAR_7++) {", "uint8_t *topright = ptr + 4 - VAR_0->VAR_11;", "for (VAR_6 = 0; VAR_6 < 4; VAR_6++) {", "int VAR_10 = 0, VAR_11 = VAR_0->VAR_11;", "uint8_t *VAR_2 = ptr + 4 * VAR_6;", "DECLARE_ALIGNED(4, uint8_t, copy_dst)[5 * 8];", "if ((VAR_7 == 0 || VAR_6 == 3) && VAR_5 == 0) {", "topright = tr_top;", "} else if (VAR_6 == 3)", "topright = tr_right;", "VAR_8 = check_intra_pred4x4_mode_emuedge(intra4x4[VAR_6],\nVAR_4 + VAR_6, VAR_5 + VAR_7,\n&VAR_10);", "if (VAR_10) {", "VAR_2 = copy_dst + 12;", "VAR_11 = 8;", "if (!(VAR_5 + VAR_7)) {", "copy_dst[3] = 127U;", "AV_WN32A(copy_dst + 4, 127U * 0x01010101U);", "} else {", "AV_COPY32(copy_dst + 4, ptr + 4 * VAR_6 - VAR_0->VAR_11);", "if (!(VAR_4 + VAR_6)) {", "copy_dst[3] = 129U;", "} else {", "copy_dst[3] = ptr[4 * VAR_6 - VAR_0->VAR_11 - 1];", "}", "}", "if (!(VAR_4 + VAR_6)) {", "copy_dst[11] =\ncopy_dst[19] =\ncopy_dst[27] =\ncopy_dst[35] = 129U;", "} else {", "copy_dst[11] = ptr[4 * VAR_6 - 1];", "copy_dst[19] = ptr[4 * VAR_6 + VAR_0->VAR_11 - 1];", "copy_dst[27] = ptr[4 * VAR_6 + VAR_0->VAR_11 * 2 - 1];", "copy_dst[35] = ptr[4 * VAR_6 + VAR_0->VAR_11 * 3 - 1];", "}", "}", "VAR_0->hpc.pred4x4[VAR_8](VAR_2, topright, VAR_11);", "if (VAR_10) {", "AV_COPY32(ptr + 4 * VAR_6, copy_dst + 12);", "AV_COPY32(ptr + 4 * VAR_6 + VAR_0->VAR_11, copy_dst + 20);", "AV_COPY32(ptr + 4 * VAR_6 + VAR_0->VAR_11 * 2, copy_dst + 28);", "AV_COPY32(ptr + 4 * VAR_6 + VAR_0->VAR_11 * 3, copy_dst + 36);", "}", "VAR_9 = VAR_1->non_zero_count_cache[VAR_7][VAR_6];", "if (VAR_9) {", "if (VAR_9 == 1)\nVAR_0->vp8dsp.vp8_idct_dc_add(ptr + 4 * VAR_6,\nVAR_1->block[VAR_7][VAR_6], VAR_0->VAR_11);", "else\nVAR_0->vp8dsp.vp8_idct_add(ptr + 4 * VAR_6,\nVAR_1->block[VAR_7][VAR_6], VAR_0->VAR_11);", "}", "topright += 4;", "}", "ptr += 4 * VAR_0->VAR_11;", "intra4x4 += 4;", "}", "}", "VAR_8 = check_intra_pred8x8_mode_emuedge(VAR_3->chroma_pred_mode, VAR_4, VAR_5);", "VAR_0->hpc.pred8x8[VAR_8](VAR_2[1], VAR_0->uvlinesize);", "VAR_0->hpc.pred8x8[VAR_8](VAR_2[2], VAR_0->uvlinesize);", "if (VAR_5 && (VAR_0->deblock_filter || !VAR_5) && VAR_1->thread_nr == 0)\nxchg_mb_border(VAR_0->top_border[VAR_4 + 1], VAR_2[0], VAR_2[1], VAR_2[2],\nVAR_0->VAR_11, VAR_0->uvlinesize, VAR_4, VAR_5, VAR_0->mb_width,\nVAR_0->filter.simple, 0);", "}" ]
[ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 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, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 17, 19, 21, 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 47 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65, 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 95, 97, 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131, 133, 135, 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 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 203 ], [ 205 ], [ 207 ], [ 211, 213, 215, 217 ], [ 219 ] ]
13,972
static av_always_inline void decode_subband_internal(DiracContext *s, SubBand *b, int is_arith) { int cb_x, cb_y, left, right, top, bottom; DiracArith c; GetBitContext gb; int cb_width = s->codeblock[b->level + (b->orientation != subband_ll)].width; int cb_height = s->codeblock[b->level + (b->orientation != subband_ll)].height; int blockcnt_one = (cb_width + cb_height) == 2; if (!b->length) return; init_get_bits8(&gb, b->coeff_data, b->length); if (is_arith) ff_dirac_init_arith_decoder(&c, &gb, b->length); top = 0; for (cb_y = 0; cb_y < cb_height; cb_y++) { bottom = (b->height * (cb_y+1)) / cb_height; left = 0; for (cb_x = 0; cb_x < cb_width; cb_x++) { right = (b->width * (cb_x+1)) / cb_width; codeblock(s, b, &gb, &c, left, right, top, bottom, blockcnt_one, is_arith); left = right; } top = bottom; } if (b->orientation == subband_ll && s->num_refs == 0) intra_dc_prediction(b); }
true
FFmpeg
526886e6069636a918c8c04db17e864e3d8151c1
static av_always_inline void decode_subband_internal(DiracContext *s, SubBand *b, int is_arith) { int cb_x, cb_y, left, right, top, bottom; DiracArith c; GetBitContext gb; int cb_width = s->codeblock[b->level + (b->orientation != subband_ll)].width; int cb_height = s->codeblock[b->level + (b->orientation != subband_ll)].height; int blockcnt_one = (cb_width + cb_height) == 2; if (!b->length) return; init_get_bits8(&gb, b->coeff_data, b->length); if (is_arith) ff_dirac_init_arith_decoder(&c, &gb, b->length); top = 0; for (cb_y = 0; cb_y < cb_height; cb_y++) { bottom = (b->height * (cb_y+1)) / cb_height; left = 0; for (cb_x = 0; cb_x < cb_width; cb_x++) { right = (b->width * (cb_x+1)) / cb_width; codeblock(s, b, &gb, &c, left, right, top, bottom, blockcnt_one, is_arith); left = right; } top = bottom; } if (b->orientation == subband_ll && s->num_refs == 0) intra_dc_prediction(b); }
{ "code": [ " bottom = (b->height * (cb_y+1)) / cb_height;", " right = (b->width * (cb_x+1)) / cb_width;" ], "line_no": [ 39, 45 ] }
static av_always_inline void FUNC_0(DiracContext *s, SubBand *b, int is_arith) { int VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5; DiracArith c; GetBitContext gb; int VAR_6 = s->codeblock[b->level + (b->orientation != subband_ll)].width; int VAR_7 = s->codeblock[b->level + (b->orientation != subband_ll)].height; int VAR_8 = (VAR_6 + VAR_7) == 2; if (!b->length) return; init_get_bits8(&gb, b->coeff_data, b->length); if (is_arith) ff_dirac_init_arith_decoder(&c, &gb, b->length); VAR_4 = 0; for (VAR_1 = 0; VAR_1 < VAR_7; VAR_1++) { VAR_5 = (b->height * (VAR_1+1)) / VAR_7; VAR_2 = 0; for (VAR_0 = 0; VAR_0 < VAR_6; VAR_0++) { VAR_3 = (b->width * (VAR_0+1)) / VAR_6; codeblock(s, b, &gb, &c, VAR_2, VAR_3, VAR_4, VAR_5, VAR_8, is_arith); VAR_2 = VAR_3; } VAR_4 = VAR_5; } if (b->orientation == subband_ll && s->num_refs == 0) intra_dc_prediction(b); }
[ "static av_always_inline void FUNC_0(DiracContext *s, SubBand *b, int is_arith)\n{", "int VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5;", "DiracArith c;", "GetBitContext gb;", "int VAR_6 = s->codeblock[b->level + (b->orientation != subband_ll)].width;", "int VAR_7 = s->codeblock[b->level + (b->orientation != subband_ll)].height;", "int VAR_8 = (VAR_6 + VAR_7) == 2;", "if (!b->length)\nreturn;", "init_get_bits8(&gb, b->coeff_data, b->length);", "if (is_arith)\nff_dirac_init_arith_decoder(&c, &gb, b->length);", "VAR_4 = 0;", "for (VAR_1 = 0; VAR_1 < VAR_7; VAR_1++) {", "VAR_5 = (b->height * (VAR_1+1)) / VAR_7;", "VAR_2 = 0;", "for (VAR_0 = 0; VAR_0 < VAR_6; VAR_0++) {", "VAR_3 = (b->width * (VAR_0+1)) / VAR_6;", "codeblock(s, b, &gb, &c, VAR_2, VAR_3, VAR_4, VAR_5, VAR_8, is_arith);", "VAR_2 = VAR_3;", "}", "VAR_4 = VAR_5;", "}", "if (b->orientation == subband_ll && s->num_refs == 0)\nintra_dc_prediction(b);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19, 21 ], [ 25 ], [ 29, 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59, 61 ], [ 63 ] ]
13,973
static inline void RENAME(yuv2rgb2)(uint16_t *buf0, uint16_t *buf1, uint16_t *uvbuf0, uint16_t *uvbuf1, uint8_t *dest, int dstW, int yalpha, int uvalpha, int dstbpp) { int yalpha1=yalpha^4095; int uvalpha1=uvalpha^4095; if(fullUVIpol) { #ifdef HAVE_MMX if(dstbpp == 32) { asm volatile( FULL_YSCALEYUV2RGB "punpcklbw %%mm1, %%mm3 \n\t" // BGBGBGBG "punpcklbw %%mm7, %%mm0 \n\t" // R0R0R0R0 "movq %%mm3, %%mm1 \n\t" "punpcklwd %%mm0, %%mm3 \n\t" // BGR0BGR0 "punpckhwd %%mm0, %%mm1 \n\t" // BGR0BGR0 MOVNTQ(%%mm3, (%4, %%eax, 4)) MOVNTQ(%%mm1, 8(%4, %%eax, 4)) "addl $4, %%eax \n\t" "cmpl %5, %%eax \n\t" " jb 1b \n\t" :: "r" (buf0), "r" (buf1), "r" (uvbuf0), "r" (uvbuf1), "r" (dest), "m" (dstW), "m" (yalpha1), "m" (uvalpha1) : "%eax" ); } else if(dstbpp==24) { asm volatile( FULL_YSCALEYUV2RGB // lsb ... msb "punpcklbw %%mm1, %%mm3 \n\t" // BGBGBGBG "punpcklbw %%mm7, %%mm0 \n\t" // R0R0R0R0 "movq %%mm3, %%mm1 \n\t" "punpcklwd %%mm0, %%mm3 \n\t" // BGR0BGR0 "punpckhwd %%mm0, %%mm1 \n\t" // BGR0BGR0 "movq %%mm3, %%mm2 \n\t" // BGR0BGR0 "psrlq $8, %%mm3 \n\t" // GR0BGR00 "pand "MANGLE(bm00000111)", %%mm2\n\t" // BGR00000 "pand "MANGLE(bm11111000)", %%mm3\n\t" // 000BGR00 "por %%mm2, %%mm3 \n\t" // BGRBGR00 "movq %%mm1, %%mm2 \n\t" "psllq $48, %%mm1 \n\t" // 000000BG "por %%mm1, %%mm3 \n\t" // BGRBGRBG "movq %%mm2, %%mm1 \n\t" // BGR0BGR0 "psrld $16, %%mm2 \n\t" // R000R000 "psrlq $24, %%mm1 \n\t" // 0BGR0000 "por %%mm2, %%mm1 \n\t" // RBGRR000 "movl %4, %%ebx \n\t" "addl %%eax, %%ebx \n\t" #ifdef HAVE_MMX2 //FIXME Alignment "movntq %%mm3, (%%ebx, %%eax, 2)\n\t" "movntq %%mm1, 8(%%ebx, %%eax, 2)\n\t" #else "movd %%mm3, (%%ebx, %%eax, 2) \n\t" "psrlq $32, %%mm3 \n\t" "movd %%mm3, 4(%%ebx, %%eax, 2) \n\t" "movd %%mm1, 8(%%ebx, %%eax, 2) \n\t" #endif "addl $4, %%eax \n\t" "cmpl %5, %%eax \n\t" " jb 1b \n\t" :: "r" (buf0), "r" (buf1), "r" (uvbuf0), "r" (uvbuf1), "m" (dest), "m" (dstW), "m" (yalpha1), "m" (uvalpha1) : "%eax", "%ebx" ); } else if(dstbpp==15) { asm volatile( FULL_YSCALEYUV2RGB #ifdef DITHER1XBPP "paddusb "MANGLE(g5Dither)", %%mm1\n\t" "paddusb "MANGLE(r5Dither)", %%mm0\n\t" "paddusb "MANGLE(b5Dither)", %%mm3\n\t" #endif "punpcklbw %%mm7, %%mm1 \n\t" // 0G0G0G0G "punpcklbw %%mm7, %%mm3 \n\t" // 0B0B0B0B "punpcklbw %%mm7, %%mm0 \n\t" // 0R0R0R0R "psrlw $3, %%mm3 \n\t" "psllw $2, %%mm1 \n\t" "psllw $7, %%mm0 \n\t" "pand "MANGLE(g15Mask)", %%mm1 \n\t" "pand "MANGLE(r15Mask)", %%mm0 \n\t" "por %%mm3, %%mm1 \n\t" "por %%mm1, %%mm0 \n\t" MOVNTQ(%%mm0, (%4, %%eax, 2)) "addl $4, %%eax \n\t" "cmpl %5, %%eax \n\t" " jb 1b \n\t" :: "r" (buf0), "r" (buf1), "r" (uvbuf0), "r" (uvbuf1), "r" (dest), "m" (dstW), "m" (yalpha1), "m" (uvalpha1) : "%eax" ); } else if(dstbpp==16) { asm volatile( FULL_YSCALEYUV2RGB #ifdef DITHER1XBPP "paddusb "MANGLE(g6Dither)", %%mm1\n\t" "paddusb "MANGLE(r5Dither)", %%mm0\n\t" "paddusb "MANGLE(b5Dither)", %%mm3\n\t" #endif "punpcklbw %%mm7, %%mm1 \n\t" // 0G0G0G0G "punpcklbw %%mm7, %%mm3 \n\t" // 0B0B0B0B "punpcklbw %%mm7, %%mm0 \n\t" // 0R0R0R0R "psrlw $3, %%mm3 \n\t" "psllw $3, %%mm1 \n\t" "psllw $8, %%mm0 \n\t" "pand "MANGLE(g16Mask)", %%mm1 \n\t" "pand "MANGLE(r16Mask)", %%mm0 \n\t" "por %%mm3, %%mm1 \n\t" "por %%mm1, %%mm0 \n\t" MOVNTQ(%%mm0, (%4, %%eax, 2)) "addl $4, %%eax \n\t" "cmpl %5, %%eax \n\t" " jb 1b \n\t" :: "r" (buf0), "r" (buf1), "r" (uvbuf0), "r" (uvbuf1), "r" (dest), "m" (dstW), "m" (yalpha1), "m" (uvalpha1) : "%eax" ); } #else if(dstbpp==32 || dstbpp==24) { int i; for(i=0;i<dstW;i++){ // vertical linear interpolation && yuv2rgb in a single step: int Y=yuvtab_2568[((buf0[i]*yalpha1+buf1[i]*yalpha)>>19)]; int U=((uvbuf0[i]*uvalpha1+uvbuf1[i]*uvalpha)>>19); int V=((uvbuf0[i+2048]*uvalpha1+uvbuf1[i+2048]*uvalpha)>>19); dest[0]=clip_table[((Y + yuvtab_40cf[U]) >>13)]; dest[1]=clip_table[((Y + yuvtab_1a1e[V] + yuvtab_0c92[U]) >>13)]; dest[2]=clip_table[((Y + yuvtab_3343[V]) >>13)]; dest+=dstbpp>>3; } } else if(dstbpp==16) { int i; for(i=0;i<dstW;i++){ // vertical linear interpolation && yuv2rgb in a single step: int Y=yuvtab_2568[((buf0[i]*yalpha1+buf1[i]*yalpha)>>19)]; int U=((uvbuf0[i]*uvalpha1+uvbuf1[i]*uvalpha)>>19); int V=((uvbuf0[i+2048]*uvalpha1+uvbuf1[i+2048]*uvalpha)>>19); ((uint16_t*)dest)[i] = clip_table16b[(Y + yuvtab_40cf[U]) >>13] | clip_table16g[(Y + yuvtab_1a1e[V] + yuvtab_0c92[U]) >>13] | clip_table16r[(Y + yuvtab_3343[V]) >>13]; } } else if(dstbpp==15) { int i; for(i=0;i<dstW;i++){ // vertical linear interpolation && yuv2rgb in a single step: int Y=yuvtab_2568[((buf0[i]*yalpha1+buf1[i]*yalpha)>>19)]; int U=((uvbuf0[i]*uvalpha1+uvbuf1[i]*uvalpha)>>19); int V=((uvbuf0[i+2048]*uvalpha1+uvbuf1[i+2048]*uvalpha)>>19); ((uint16_t*)dest)[i] = clip_table15b[(Y + yuvtab_40cf[U]) >>13] | clip_table15g[(Y + yuvtab_1a1e[V] + yuvtab_0c92[U]) >>13] | clip_table15r[(Y + yuvtab_3343[V]) >>13]; } } #endif }//FULL_UV_IPOL else { #ifdef HAVE_MMX if(dstbpp == 32) { asm volatile( YSCALEYUV2RGB WRITEBGR32 :: "r" (buf0), "r" (buf1), "r" (uvbuf0), "r" (uvbuf1), "r" (dest), "m" (dstW), "m" (yalpha1), "m" (uvalpha1) : "%eax" ); } else if(dstbpp==24) { asm volatile( "movl %4, %%ebx \n\t" YSCALEYUV2RGB WRITEBGR24 :: "r" (buf0), "r" (buf1), "r" (uvbuf0), "r" (uvbuf1), "m" (dest), "m" (dstW), "m" (yalpha1), "m" (uvalpha1) : "%eax", "%ebx" ); } else if(dstbpp==15) { asm volatile( YSCALEYUV2RGB /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */ #ifdef DITHER1XBPP "paddusb "MANGLE(b5Dither)", %%mm2\n\t" "paddusb "MANGLE(g5Dither)", %%mm4\n\t" "paddusb "MANGLE(r5Dither)", %%mm5\n\t" #endif WRITEBGR15 :: "r" (buf0), "r" (buf1), "r" (uvbuf0), "r" (uvbuf1), "r" (dest), "m" (dstW), "m" (yalpha1), "m" (uvalpha1) : "%eax" ); } else if(dstbpp==16) { asm volatile( YSCALEYUV2RGB /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */ #ifdef DITHER1XBPP "paddusb "MANGLE(b5Dither)", %%mm2\n\t" "paddusb "MANGLE(g6Dither)", %%mm4\n\t" "paddusb "MANGLE(r5Dither)", %%mm5\n\t" #endif WRITEBGR16 :: "r" (buf0), "r" (buf1), "r" (uvbuf0), "r" (uvbuf1), "r" (dest), "m" (dstW), "m" (yalpha1), "m" (uvalpha1) : "%eax" ); } #else if(dstbpp==32) { int i; for(i=0; i<dstW-1; i+=2){ // vertical linear interpolation && yuv2rgb in a single step: int Y1=yuvtab_2568[((buf0[i]*yalpha1+buf1[i]*yalpha)>>19)]; int Y2=yuvtab_2568[((buf0[i+1]*yalpha1+buf1[i+1]*yalpha)>>19)]; int U=((uvbuf0[i>>1]*uvalpha1+uvbuf1[i>>1]*uvalpha)>>19); int V=((uvbuf0[(i>>1)+2048]*uvalpha1+uvbuf1[(i>>1)+2048]*uvalpha)>>19); int Cb= yuvtab_40cf[U]; int Cg= yuvtab_1a1e[V] + yuvtab_0c92[U]; int Cr= yuvtab_3343[V]; dest[4*i+0]=clip_table[((Y1 + Cb) >>13)]; dest[4*i+1]=clip_table[((Y1 + Cg) >>13)]; dest[4*i+2]=clip_table[((Y1 + Cr) >>13)]; dest[4*i+4]=clip_table[((Y2 + Cb) >>13)]; dest[4*i+5]=clip_table[((Y2 + Cg) >>13)]; dest[4*i+6]=clip_table[((Y2 + Cr) >>13)]; } } else if(dstbpp==24) { int i; for(i=0; i<dstW-1; i+=2){ // vertical linear interpolation && yuv2rgb in a single step: int Y1=yuvtab_2568[((buf0[i]*yalpha1+buf1[i]*yalpha)>>19)]; int Y2=yuvtab_2568[((buf0[i+1]*yalpha1+buf1[i+1]*yalpha)>>19)]; int U=((uvbuf0[i>>1]*uvalpha1+uvbuf1[i>>1]*uvalpha)>>19); int V=((uvbuf0[(i>>1)+2048]*uvalpha1+uvbuf1[(i>>1)+2048]*uvalpha)>>19); int Cb= yuvtab_40cf[U]; int Cg= yuvtab_1a1e[V] + yuvtab_0c92[U]; int Cr= yuvtab_3343[V]; dest[0]=clip_table[((Y1 + Cb) >>13)]; dest[1]=clip_table[((Y1 + Cg) >>13)]; dest[2]=clip_table[((Y1 + Cr) >>13)]; dest[3]=clip_table[((Y2 + Cb) >>13)]; dest[4]=clip_table[((Y2 + Cg) >>13)]; dest[5]=clip_table[((Y2 + Cr) >>13)]; dest+=6; } } else if(dstbpp==16) { int i; for(i=0; i<dstW-1; i+=2){ // vertical linear interpolation && yuv2rgb in a single step: int Y1=yuvtab_2568[((buf0[i]*yalpha1+buf1[i]*yalpha)>>19)]; int Y2=yuvtab_2568[((buf0[i+1]*yalpha1+buf1[i+1]*yalpha)>>19)]; int U=((uvbuf0[i>>1]*uvalpha1+uvbuf1[i>>1]*uvalpha)>>19); int V=((uvbuf0[(i>>1)+2048]*uvalpha1+uvbuf1[(i>>1)+2048]*uvalpha)>>19); int Cb= yuvtab_40cf[U]; int Cg= yuvtab_1a1e[V] + yuvtab_0c92[U]; int Cr= yuvtab_3343[V]; ((uint16_t*)dest)[i] = clip_table16b[(Y1 + Cb) >>13] | clip_table16g[(Y1 + Cg) >>13] | clip_table16r[(Y1 + Cr) >>13]; ((uint16_t*)dest)[i+1] = clip_table16b[(Y2 + Cb) >>13] | clip_table16g[(Y2 + Cg) >>13] | clip_table16r[(Y2 + Cr) >>13]; } } else if(dstbpp==15) { int i; for(i=0; i<dstW-1; i+=2){ // vertical linear interpolation && yuv2rgb in a single step: int Y1=yuvtab_2568[((buf0[i]*yalpha1+buf1[i]*yalpha)>>19)]; int Y2=yuvtab_2568[((buf0[i+1]*yalpha1+buf1[i+1]*yalpha)>>19)]; int U=((uvbuf0[i>>1]*uvalpha1+uvbuf1[i>>1]*uvalpha)>>19); int V=((uvbuf0[(i>>1)+2048]*uvalpha1+uvbuf1[(i>>1)+2048]*uvalpha)>>19); int Cb= yuvtab_40cf[U]; int Cg= yuvtab_1a1e[V] + yuvtab_0c92[U]; int Cr= yuvtab_3343[V]; ((uint16_t*)dest)[i] = clip_table15b[(Y1 + Cb) >>13] | clip_table15g[(Y1 + Cg) >>13] | clip_table15r[(Y1 + Cr) >>13]; ((uint16_t*)dest)[i+1] = clip_table15b[(Y2 + Cb) >>13] | clip_table15g[(Y2 + Cg) >>13] | clip_table15r[(Y2 + Cr) >>13]; } } #endif } //!FULL_UV_IPOL }
true
FFmpeg
28bf81c90d36a55cf76e2be913c5215ebebf61f2
static inline void RENAME(yuv2rgb2)(uint16_t *buf0, uint16_t *buf1, uint16_t *uvbuf0, uint16_t *uvbuf1, uint8_t *dest, int dstW, int yalpha, int uvalpha, int dstbpp) { int yalpha1=yalpha^4095; int uvalpha1=uvalpha^4095; if(fullUVIpol) { #ifdef HAVE_MMX if(dstbpp == 32) { asm volatile( FULL_YSCALEYUV2RGB "punpcklbw %%mm1, %%mm3 \n\t" "punpcklbw %%mm7, %%mm0 \n\t" "movq %%mm3, %%mm1 \n\t" "punpcklwd %%mm0, %%mm3 \n\t" "punpckhwd %%mm0, %%mm1 \n\t" MOVNTQ(%%mm3, (%4, %%eax, 4)) MOVNTQ(%%mm1, 8(%4, %%eax, 4)) "addl $4, %%eax \n\t" "cmpl %5, %%eax \n\t" " jb 1b \n\t" :: "r" (buf0), "r" (buf1), "r" (uvbuf0), "r" (uvbuf1), "r" (dest), "m" (dstW), "m" (yalpha1), "m" (uvalpha1) : "%eax" ); } else if(dstbpp==24) { asm volatile( FULL_YSCALEYUV2RGB "punpcklbw %%mm1, %%mm3 \n\t" "punpcklbw %%mm7, %%mm0 \n\t" "movq %%mm3, %%mm1 \n\t" "punpcklwd %%mm0, %%mm3 \n\t" "punpckhwd %%mm0, %%mm1 \n\t" "movq %%mm3, %%mm2 \n\t" "psrlq $8, %%mm3 \n\t" "pand "MANGLE(bm00000111)", %%mm2\n\t" "pand "MANGLE(bm11111000)", %%mm3\n\t" "por %%mm2, %%mm3 \n\t" "movq %%mm1, %%mm2 \n\t" "psllq $48, %%mm1 \n\t" "por %%mm1, %%mm3 \n\t" "movq %%mm2, %%mm1 \n\t" "psrld $16, %%mm2 \n\t" "psrlq $24, %%mm1 \n\t" "por %%mm2, %%mm1 \n\t" "movl %4, %%ebx \n\t" "addl %%eax, %%ebx \n\t" #ifdef HAVE_MMX2 "movntq %%mm3, (%%ebx, %%eax, 2)\n\t" "movntq %%mm1, 8(%%ebx, %%eax, 2)\n\t" #else "movd %%mm3, (%%ebx, %%eax, 2) \n\t" "psrlq $32, %%mm3 \n\t" "movd %%mm3, 4(%%ebx, %%eax, 2) \n\t" "movd %%mm1, 8(%%ebx, %%eax, 2) \n\t" #endif "addl $4, %%eax \n\t" "cmpl %5, %%eax \n\t" " jb 1b \n\t" :: "r" (buf0), "r" (buf1), "r" (uvbuf0), "r" (uvbuf1), "m" (dest), "m" (dstW), "m" (yalpha1), "m" (uvalpha1) : "%eax", "%ebx" ); } else if(dstbpp==15) { asm volatile( FULL_YSCALEYUV2RGB #ifdef DITHER1XBPP "paddusb "MANGLE(g5Dither)", %%mm1\n\t" "paddusb "MANGLE(r5Dither)", %%mm0\n\t" "paddusb "MANGLE(b5Dither)", %%mm3\n\t" #endif "punpcklbw %%mm7, %%mm1 \n\t" "punpcklbw %%mm7, %%mm3 \n\t" "punpcklbw %%mm7, %%mm0 \n\t" "psrlw $3, %%mm3 \n\t" "psllw $2, %%mm1 \n\t" "psllw $7, %%mm0 \n\t" "pand "MANGLE(g15Mask)", %%mm1 \n\t" "pand "MANGLE(r15Mask)", %%mm0 \n\t" "por %%mm3, %%mm1 \n\t" "por %%mm1, %%mm0 \n\t" MOVNTQ(%%mm0, (%4, %%eax, 2)) "addl $4, %%eax \n\t" "cmpl %5, %%eax \n\t" " jb 1b \n\t" :: "r" (buf0), "r" (buf1), "r" (uvbuf0), "r" (uvbuf1), "r" (dest), "m" (dstW), "m" (yalpha1), "m" (uvalpha1) : "%eax" ); } else if(dstbpp==16) { asm volatile( FULL_YSCALEYUV2RGB #ifdef DITHER1XBPP "paddusb "MANGLE(g6Dither)", %%mm1\n\t" "paddusb "MANGLE(r5Dither)", %%mm0\n\t" "paddusb "MANGLE(b5Dither)", %%mm3\n\t" #endif "punpcklbw %%mm7, %%mm1 \n\t" "punpcklbw %%mm7, %%mm3 \n\t" "punpcklbw %%mm7, %%mm0 \n\t" "psrlw $3, %%mm3 \n\t" "psllw $3, %%mm1 \n\t" "psllw $8, %%mm0 \n\t" "pand "MANGLE(g16Mask)", %%mm1 \n\t" "pand "MANGLE(r16Mask)", %%mm0 \n\t" "por %%mm3, %%mm1 \n\t" "por %%mm1, %%mm0 \n\t" MOVNTQ(%%mm0, (%4, %%eax, 2)) "addl $4, %%eax \n\t" "cmpl %5, %%eax \n\t" " jb 1b \n\t" :: "r" (buf0), "r" (buf1), "r" (uvbuf0), "r" (uvbuf1), "r" (dest), "m" (dstW), "m" (yalpha1), "m" (uvalpha1) : "%eax" ); } #else if(dstbpp==32 || dstbpp==24) { int i; for(i=0;i<dstW;i++){ int Y=yuvtab_2568[((buf0[i]*yalpha1+buf1[i]*yalpha)>>19)]; int U=((uvbuf0[i]*uvalpha1+uvbuf1[i]*uvalpha)>>19); int V=((uvbuf0[i+2048]*uvalpha1+uvbuf1[i+2048]*uvalpha)>>19); dest[0]=clip_table[((Y + yuvtab_40cf[U]) >>13)]; dest[1]=clip_table[((Y + yuvtab_1a1e[V] + yuvtab_0c92[U]) >>13)]; dest[2]=clip_table[((Y + yuvtab_3343[V]) >>13)]; dest+=dstbpp>>3; } } else if(dstbpp==16) { int i; for(i=0;i<dstW;i++){ int Y=yuvtab_2568[((buf0[i]*yalpha1+buf1[i]*yalpha)>>19)]; int U=((uvbuf0[i]*uvalpha1+uvbuf1[i]*uvalpha)>>19); int V=((uvbuf0[i+2048]*uvalpha1+uvbuf1[i+2048]*uvalpha)>>19); ((uint16_t*)dest)[i] = clip_table16b[(Y + yuvtab_40cf[U]) >>13] | clip_table16g[(Y + yuvtab_1a1e[V] + yuvtab_0c92[U]) >>13] | clip_table16r[(Y + yuvtab_3343[V]) >>13]; } } else if(dstbpp==15) { int i; for(i=0;i<dstW;i++){ int Y=yuvtab_2568[((buf0[i]*yalpha1+buf1[i]*yalpha)>>19)]; int U=((uvbuf0[i]*uvalpha1+uvbuf1[i]*uvalpha)>>19); int V=((uvbuf0[i+2048]*uvalpha1+uvbuf1[i+2048]*uvalpha)>>19); ((uint16_t*)dest)[i] = clip_table15b[(Y + yuvtab_40cf[U]) >>13] | clip_table15g[(Y + yuvtab_1a1e[V] + yuvtab_0c92[U]) >>13] | clip_table15r[(Y + yuvtab_3343[V]) >>13]; } } #endif } else { #ifdef HAVE_MMX if(dstbpp == 32) { asm volatile( YSCALEYUV2RGB WRITEBGR32 :: "r" (buf0), "r" (buf1), "r" (uvbuf0), "r" (uvbuf1), "r" (dest), "m" (dstW), "m" (yalpha1), "m" (uvalpha1) : "%eax" ); } else if(dstbpp==24) { asm volatile( "movl %4, %%ebx \n\t" YSCALEYUV2RGB WRITEBGR24 :: "r" (buf0), "r" (buf1), "r" (uvbuf0), "r" (uvbuf1), "m" (dest), "m" (dstW), "m" (yalpha1), "m" (uvalpha1) : "%eax", "%ebx" ); } else if(dstbpp==15) { asm volatile( YSCALEYUV2RGB #ifdef DITHER1XBPP "paddusb "MANGLE(b5Dither)", %%mm2\n\t" "paddusb "MANGLE(g5Dither)", %%mm4\n\t" "paddusb "MANGLE(r5Dither)", %%mm5\n\t" #endif WRITEBGR15 :: "r" (buf0), "r" (buf1), "r" (uvbuf0), "r" (uvbuf1), "r" (dest), "m" (dstW), "m" (yalpha1), "m" (uvalpha1) : "%eax" ); } else if(dstbpp==16) { asm volatile( YSCALEYUV2RGB #ifdef DITHER1XBPP "paddusb "MANGLE(b5Dither)", %%mm2\n\t" "paddusb "MANGLE(g6Dither)", %%mm4\n\t" "paddusb "MANGLE(r5Dither)", %%mm5\n\t" #endif WRITEBGR16 :: "r" (buf0), "r" (buf1), "r" (uvbuf0), "r" (uvbuf1), "r" (dest), "m" (dstW), "m" (yalpha1), "m" (uvalpha1) : "%eax" ); } #else if(dstbpp==32) { int i; for(i=0; i<dstW-1; i+=2){ int Y1=yuvtab_2568[((buf0[i]*yalpha1+buf1[i]*yalpha)>>19)]; int Y2=yuvtab_2568[((buf0[i+1]*yalpha1+buf1[i+1]*yalpha)>>19)]; int U=((uvbuf0[i>>1]*uvalpha1+uvbuf1[i>>1]*uvalpha)>>19); int V=((uvbuf0[(i>>1)+2048]*uvalpha1+uvbuf1[(i>>1)+2048]*uvalpha)>>19); int Cb= yuvtab_40cf[U]; int Cg= yuvtab_1a1e[V] + yuvtab_0c92[U]; int Cr= yuvtab_3343[V]; dest[4*i+0]=clip_table[((Y1 + Cb) >>13)]; dest[4*i+1]=clip_table[((Y1 + Cg) >>13)]; dest[4*i+2]=clip_table[((Y1 + Cr) >>13)]; dest[4*i+4]=clip_table[((Y2 + Cb) >>13)]; dest[4*i+5]=clip_table[((Y2 + Cg) >>13)]; dest[4*i+6]=clip_table[((Y2 + Cr) >>13)]; } } else if(dstbpp==24) { int i; for(i=0; i<dstW-1; i+=2){ int Y1=yuvtab_2568[((buf0[i]*yalpha1+buf1[i]*yalpha)>>19)]; int Y2=yuvtab_2568[((buf0[i+1]*yalpha1+buf1[i+1]*yalpha)>>19)]; int U=((uvbuf0[i>>1]*uvalpha1+uvbuf1[i>>1]*uvalpha)>>19); int V=((uvbuf0[(i>>1)+2048]*uvalpha1+uvbuf1[(i>>1)+2048]*uvalpha)>>19); int Cb= yuvtab_40cf[U]; int Cg= yuvtab_1a1e[V] + yuvtab_0c92[U]; int Cr= yuvtab_3343[V]; dest[0]=clip_table[((Y1 + Cb) >>13)]; dest[1]=clip_table[((Y1 + Cg) >>13)]; dest[2]=clip_table[((Y1 + Cr) >>13)]; dest[3]=clip_table[((Y2 + Cb) >>13)]; dest[4]=clip_table[((Y2 + Cg) >>13)]; dest[5]=clip_table[((Y2 + Cr) >>13)]; dest+=6; } } else if(dstbpp==16) { int i; for(i=0; i<dstW-1; i+=2){ int Y1=yuvtab_2568[((buf0[i]*yalpha1+buf1[i]*yalpha)>>19)]; int Y2=yuvtab_2568[((buf0[i+1]*yalpha1+buf1[i+1]*yalpha)>>19)]; int U=((uvbuf0[i>>1]*uvalpha1+uvbuf1[i>>1]*uvalpha)>>19); int V=((uvbuf0[(i>>1)+2048]*uvalpha1+uvbuf1[(i>>1)+2048]*uvalpha)>>19); int Cb= yuvtab_40cf[U]; int Cg= yuvtab_1a1e[V] + yuvtab_0c92[U]; int Cr= yuvtab_3343[V]; ((uint16_t*)dest)[i] = clip_table16b[(Y1 + Cb) >>13] | clip_table16g[(Y1 + Cg) >>13] | clip_table16r[(Y1 + Cr) >>13]; ((uint16_t*)dest)[i+1] = clip_table16b[(Y2 + Cb) >>13] | clip_table16g[(Y2 + Cg) >>13] | clip_table16r[(Y2 + Cr) >>13]; } } else if(dstbpp==15) { int i; for(i=0; i<dstW-1; i+=2){ int Y1=yuvtab_2568[((buf0[i]*yalpha1+buf1[i]*yalpha)>>19)]; int Y2=yuvtab_2568[((buf0[i+1]*yalpha1+buf1[i+1]*yalpha)>>19)]; int U=((uvbuf0[i>>1]*uvalpha1+uvbuf1[i>>1]*uvalpha)>>19); int V=((uvbuf0[(i>>1)+2048]*uvalpha1+uvbuf1[(i>>1)+2048]*uvalpha)>>19); int Cb= yuvtab_40cf[U]; int Cg= yuvtab_1a1e[V] + yuvtab_0c92[U]; int Cr= yuvtab_3343[V]; ((uint16_t*)dest)[i] = clip_table15b[(Y1 + Cb) >>13] | clip_table15g[(Y1 + Cg) >>13] | clip_table15r[(Y1 + Cr) >>13]; ((uint16_t*)dest)[i+1] = clip_table15b[(Y2 + Cb) >>13] | clip_table15g[(Y2 + Cg) >>13] | clip_table15r[(Y2 + Cr) >>13]; } } #endif } }
{ "code": [ "#else", "#endif", "#else", "#endif", "#ifdef HAVE_MMX2", "#else", "\tif(fullUVIpol)", "\t\telse if(dstbpp==15)", "\t\telse if(dstbpp==16)", "\t\t\t uint8_t *dest, int dstW, int yalpha, int uvalpha, int dstbpp)", "\tif(fullUVIpol)", "\t\tif(dstbpp == 32)", "\t\telse if(dstbpp==24)", "\t\telse if(dstbpp==15)", "\t\telse if(dstbpp==16)", "\t\tif(dstbpp==32 || dstbpp==24)", "\t\t\t\tdest+=dstbpp>>3;", "\t\telse if(dstbpp==16)", "\t\telse if(dstbpp==15)", "\t\tif(dstbpp == 32)", "\t\telse if(dstbpp==24)", "\t\telse if(dstbpp==15)", "\t\telse if(dstbpp==16)", "\t\tif(dstbpp==32)", "\t\telse if(dstbpp==24)", "\t\telse if(dstbpp==16)", "\t\telse if(dstbpp==15)", "\t\tif(dstbpp == 32)", "\t\telse if(dstbpp==24)", "\t\telse if(dstbpp==15)", "\t\telse if(dstbpp==16)", "\t\tif(dstbpp == 32)", "\t\telse if(dstbpp==24)", "\t\telse if(dstbpp==15)", "\t\telse if(dstbpp==16)", "#ifdef HAVE_MMX", "#endif", "#ifdef HAVE_MMX2", "#ifdef HAVE_MMX2", "#else", "#endif", "#else", "#endif", "#ifdef HAVE_MMX2", "#else", "#endif", "#endif", "#ifdef HAVE_MMX", "#else", "#endif", "#ifdef HAVE_MMX2", "#endif", "#ifdef HAVE_MMX", "#endif", "#ifdef HAVE_MMX2", "#else", "#endif", "#ifdef HAVE_MMX", "#else", "#endif", "#ifdef HAVE_MMX", "#else", "#endif" ], "line_no": [ 143, 153, 143, 153, 135, 143, 13, 173, 241, 3, 13, 21, 73, 173, 241, 311, 333, 241, 173, 21, 73, 173, 241, 529, 73, 241, 173, 21, 73, 173, 241, 21, 73, 173, 241, 19, 153, 135, 135, 143, 153, 143, 153, 135, 143, 153, 153, 19, 143, 153, 135, 153, 19, 153, 135, 143, 153, 19, 143, 153, 19, 143, 153 ] }
static inline void FUNC_0(yuv2rgb2)(uint16_t *buf0, uint16_t *buf1, uint16_t *uvbuf0, uint16_t *uvbuf1, uint8_t *dest, int dstW, int yalpha, int uvalpha, int dstbpp) { int VAR_0=yalpha^4095; int VAR_1=uvalpha^4095; if(fullUVIpol) { #ifdef HAVE_MMX if(dstbpp == 32) { asm volatile( FULL_YSCALEYUV2RGB "punpcklbw %%mm1, %%mm3 \n\t" "punpcklbw %%mm7, %%mm0 \n\t" "movq %%mm3, %%mm1 \n\t" "punpcklwd %%mm0, %%mm3 \n\t" "punpckhwd %%mm0, %%mm1 \n\t" MOVNTQ(%%mm3, (%4, %%eax, 4)) MOVNTQ(%%mm1, 8(%4, %%eax, 4)) "addl $4, %%eax \n\t" "cmpl %5, %%eax \n\t" " jb 1b \n\t" :: "r" (buf0), "r" (buf1), "r" (uvbuf0), "r" (uvbuf1), "r" (dest), "m" (dstW), "m" (VAR_0), "m" (VAR_1) : "%eax" ); } else if(dstbpp==24) { asm volatile( FULL_YSCALEYUV2RGB "punpcklbw %%mm1, %%mm3 \n\t" "punpcklbw %%mm7, %%mm0 \n\t" "movq %%mm3, %%mm1 \n\t" "punpcklwd %%mm0, %%mm3 \n\t" "punpckhwd %%mm0, %%mm1 \n\t" "movq %%mm3, %%mm2 \n\t" "psrlq $8, %%mm3 \n\t" "pand "MANGLE(bm00000111)", %%mm2\n\t" "pand "MANGLE(bm11111000)", %%mm3\n\t" "por %%mm2, %%mm3 \n\t" "movq %%mm1, %%mm2 \n\t" "psllq $48, %%mm1 \n\t" "por %%mm1, %%mm3 \n\t" "movq %%mm2, %%mm1 \n\t" "psrld $16, %%mm2 \n\t" "psrlq $24, %%mm1 \n\t" "por %%mm2, %%mm1 \n\t" "movl %4, %%ebx \n\t" "addl %%eax, %%ebx \n\t" #ifdef HAVE_MMX2 "movntq %%mm3, (%%ebx, %%eax, 2)\n\t" "movntq %%mm1, 8(%%ebx, %%eax, 2)\n\t" #else "movd %%mm3, (%%ebx, %%eax, 2) \n\t" "psrlq $32, %%mm3 \n\t" "movd %%mm3, 4(%%ebx, %%eax, 2) \n\t" "movd %%mm1, 8(%%ebx, %%eax, 2) \n\t" #endif "addl $4, %%eax \n\t" "cmpl %5, %%eax \n\t" " jb 1b \n\t" :: "r" (buf0), "r" (buf1), "r" (uvbuf0), "r" (uvbuf1), "m" (dest), "m" (dstW), "m" (VAR_0), "m" (VAR_1) : "%eax", "%ebx" ); } else if(dstbpp==15) { asm volatile( FULL_YSCALEYUV2RGB #ifdef DITHER1XBPP "paddusb "MANGLE(g5Dither)", %%mm1\n\t" "paddusb "MANGLE(r5Dither)", %%mm0\n\t" "paddusb "MANGLE(b5Dither)", %%mm3\n\t" #endif "punpcklbw %%mm7, %%mm1 \n\t" "punpcklbw %%mm7, %%mm3 \n\t" "punpcklbw %%mm7, %%mm0 \n\t" "psrlw $3, %%mm3 \n\t" "psllw $2, %%mm1 \n\t" "psllw $7, %%mm0 \n\t" "pand "MANGLE(g15Mask)", %%mm1 \n\t" "pand "MANGLE(r15Mask)", %%mm0 \n\t" "por %%mm3, %%mm1 \n\t" "por %%mm1, %%mm0 \n\t" MOVNTQ(%%mm0, (%4, %%eax, 2)) "addl $4, %%eax \n\t" "cmpl %5, %%eax \n\t" " jb 1b \n\t" :: "r" (buf0), "r" (buf1), "r" (uvbuf0), "r" (uvbuf1), "r" (dest), "m" (dstW), "m" (VAR_0), "m" (VAR_1) : "%eax" ); } else if(dstbpp==16) { asm volatile( FULL_YSCALEYUV2RGB #ifdef DITHER1XBPP "paddusb "MANGLE(g6Dither)", %%mm1\n\t" "paddusb "MANGLE(r5Dither)", %%mm0\n\t" "paddusb "MANGLE(b5Dither)", %%mm3\n\t" #endif "punpcklbw %%mm7, %%mm1 \n\t" "punpcklbw %%mm7, %%mm3 \n\t" "punpcklbw %%mm7, %%mm0 \n\t" "psrlw $3, %%mm3 \n\t" "psllw $3, %%mm1 \n\t" "psllw $8, %%mm0 \n\t" "pand "MANGLE(g16Mask)", %%mm1 \n\t" "pand "MANGLE(r16Mask)", %%mm0 \n\t" "por %%mm3, %%mm1 \n\t" "por %%mm1, %%mm0 \n\t" MOVNTQ(%%mm0, (%4, %%eax, 2)) "addl $4, %%eax \n\t" "cmpl %5, %%eax \n\t" " jb 1b \n\t" :: "r" (buf0), "r" (buf1), "r" (uvbuf0), "r" (uvbuf1), "r" (dest), "m" (dstW), "m" (VAR_0), "m" (VAR_1) : "%eax" ); } #else if(dstbpp==32 || dstbpp==24) { int VAR_3; for(VAR_3=0;VAR_3<dstW;VAR_3++){ int Y=yuvtab_2568[((buf0[VAR_3]*VAR_0+buf1[VAR_3]*yalpha)>>19)]; int U=((uvbuf0[VAR_3]*VAR_1+uvbuf1[VAR_3]*uvalpha)>>19); int V=((uvbuf0[VAR_3+2048]*VAR_1+uvbuf1[VAR_3+2048]*uvalpha)>>19); dest[0]=clip_table[((Y + yuvtab_40cf[U]) >>13)]; dest[1]=clip_table[((Y + yuvtab_1a1e[V] + yuvtab_0c92[U]) >>13)]; dest[2]=clip_table[((Y + yuvtab_3343[V]) >>13)]; dest+=dstbpp>>3; } } else if(dstbpp==16) { int VAR_3; for(VAR_3=0;VAR_3<dstW;VAR_3++){ int Y=yuvtab_2568[((buf0[VAR_3]*VAR_0+buf1[VAR_3]*yalpha)>>19)]; int U=((uvbuf0[VAR_3]*VAR_1+uvbuf1[VAR_3]*uvalpha)>>19); int V=((uvbuf0[VAR_3+2048]*VAR_1+uvbuf1[VAR_3+2048]*uvalpha)>>19); ((uint16_t*)dest)[VAR_3] = clip_table16b[(Y + yuvtab_40cf[U]) >>13] | clip_table16g[(Y + yuvtab_1a1e[V] + yuvtab_0c92[U]) >>13] | clip_table16r[(Y + yuvtab_3343[V]) >>13]; } } else if(dstbpp==15) { int VAR_3; for(VAR_3=0;VAR_3<dstW;VAR_3++){ int Y=yuvtab_2568[((buf0[VAR_3]*VAR_0+buf1[VAR_3]*yalpha)>>19)]; int U=((uvbuf0[VAR_3]*VAR_1+uvbuf1[VAR_3]*uvalpha)>>19); int V=((uvbuf0[VAR_3+2048]*VAR_1+uvbuf1[VAR_3+2048]*uvalpha)>>19); ((uint16_t*)dest)[VAR_3] = clip_table15b[(Y + yuvtab_40cf[U]) >>13] | clip_table15g[(Y + yuvtab_1a1e[V] + yuvtab_0c92[U]) >>13] | clip_table15r[(Y + yuvtab_3343[V]) >>13]; } } #endif } else { #ifdef HAVE_MMX if(dstbpp == 32) { asm volatile( YSCALEYUV2RGB WRITEBGR32 :: "r" (buf0), "r" (buf1), "r" (uvbuf0), "r" (uvbuf1), "r" (dest), "m" (dstW), "m" (VAR_0), "m" (VAR_1) : "%eax" ); } else if(dstbpp==24) { asm volatile( "movl %4, %%ebx \n\t" YSCALEYUV2RGB WRITEBGR24 :: "r" (buf0), "r" (buf1), "r" (uvbuf0), "r" (uvbuf1), "m" (dest), "m" (dstW), "m" (VAR_0), "m" (VAR_1) : "%eax", "%ebx" ); } else if(dstbpp==15) { asm volatile( YSCALEYUV2RGB #ifdef DITHER1XBPP "paddusb "MANGLE(b5Dither)", %%mm2\n\t" "paddusb "MANGLE(g5Dither)", %%mm4\n\t" "paddusb "MANGLE(r5Dither)", %%mm5\n\t" #endif WRITEBGR15 :: "r" (buf0), "r" (buf1), "r" (uvbuf0), "r" (uvbuf1), "r" (dest), "m" (dstW), "m" (VAR_0), "m" (VAR_1) : "%eax" ); } else if(dstbpp==16) { asm volatile( YSCALEYUV2RGB #ifdef DITHER1XBPP "paddusb "MANGLE(b5Dither)", %%mm2\n\t" "paddusb "MANGLE(g6Dither)", %%mm4\n\t" "paddusb "MANGLE(r5Dither)", %%mm5\n\t" #endif WRITEBGR16 :: "r" (buf0), "r" (buf1), "r" (uvbuf0), "r" (uvbuf1), "r" (dest), "m" (dstW), "m" (VAR_0), "m" (VAR_1) : "%eax" ); } #else if(dstbpp==32) { int VAR_3; for(VAR_3=0; VAR_3<dstW-1; VAR_3+=2){ int Y1=yuvtab_2568[((buf0[VAR_3]*VAR_0+buf1[VAR_3]*yalpha)>>19)]; int Y2=yuvtab_2568[((buf0[VAR_3+1]*VAR_0+buf1[VAR_3+1]*yalpha)>>19)]; int U=((uvbuf0[VAR_3>>1]*VAR_1+uvbuf1[VAR_3>>1]*uvalpha)>>19); int V=((uvbuf0[(VAR_3>>1)+2048]*VAR_1+uvbuf1[(VAR_3>>1)+2048]*uvalpha)>>19); int Cb= yuvtab_40cf[U]; int Cg= yuvtab_1a1e[V] + yuvtab_0c92[U]; int Cr= yuvtab_3343[V]; dest[4*VAR_3+0]=clip_table[((Y1 + Cb) >>13)]; dest[4*VAR_3+1]=clip_table[((Y1 + Cg) >>13)]; dest[4*VAR_3+2]=clip_table[((Y1 + Cr) >>13)]; dest[4*VAR_3+4]=clip_table[((Y2 + Cb) >>13)]; dest[4*VAR_3+5]=clip_table[((Y2 + Cg) >>13)]; dest[4*VAR_3+6]=clip_table[((Y2 + Cr) >>13)]; } } else if(dstbpp==24) { int VAR_3; for(VAR_3=0; VAR_3<dstW-1; VAR_3+=2){ int Y1=yuvtab_2568[((buf0[VAR_3]*VAR_0+buf1[VAR_3]*yalpha)>>19)]; int Y2=yuvtab_2568[((buf0[VAR_3+1]*VAR_0+buf1[VAR_3+1]*yalpha)>>19)]; int U=((uvbuf0[VAR_3>>1]*VAR_1+uvbuf1[VAR_3>>1]*uvalpha)>>19); int V=((uvbuf0[(VAR_3>>1)+2048]*VAR_1+uvbuf1[(VAR_3>>1)+2048]*uvalpha)>>19); int Cb= yuvtab_40cf[U]; int Cg= yuvtab_1a1e[V] + yuvtab_0c92[U]; int Cr= yuvtab_3343[V]; dest[0]=clip_table[((Y1 + Cb) >>13)]; dest[1]=clip_table[((Y1 + Cg) >>13)]; dest[2]=clip_table[((Y1 + Cr) >>13)]; dest[3]=clip_table[((Y2 + Cb) >>13)]; dest[4]=clip_table[((Y2 + Cg) >>13)]; dest[5]=clip_table[((Y2 + Cr) >>13)]; dest+=6; } } else if(dstbpp==16) { int VAR_3; for(VAR_3=0; VAR_3<dstW-1; VAR_3+=2){ int Y1=yuvtab_2568[((buf0[VAR_3]*VAR_0+buf1[VAR_3]*yalpha)>>19)]; int Y2=yuvtab_2568[((buf0[VAR_3+1]*VAR_0+buf1[VAR_3+1]*yalpha)>>19)]; int U=((uvbuf0[VAR_3>>1]*VAR_1+uvbuf1[VAR_3>>1]*uvalpha)>>19); int V=((uvbuf0[(VAR_3>>1)+2048]*VAR_1+uvbuf1[(VAR_3>>1)+2048]*uvalpha)>>19); int Cb= yuvtab_40cf[U]; int Cg= yuvtab_1a1e[V] + yuvtab_0c92[U]; int Cr= yuvtab_3343[V]; ((uint16_t*)dest)[VAR_3] = clip_table16b[(Y1 + Cb) >>13] | clip_table16g[(Y1 + Cg) >>13] | clip_table16r[(Y1 + Cr) >>13]; ((uint16_t*)dest)[VAR_3+1] = clip_table16b[(Y2 + Cb) >>13] | clip_table16g[(Y2 + Cg) >>13] | clip_table16r[(Y2 + Cr) >>13]; } } else if(dstbpp==15) { int VAR_3; for(VAR_3=0; VAR_3<dstW-1; VAR_3+=2){ int Y1=yuvtab_2568[((buf0[VAR_3]*VAR_0+buf1[VAR_3]*yalpha)>>19)]; int Y2=yuvtab_2568[((buf0[VAR_3+1]*VAR_0+buf1[VAR_3+1]*yalpha)>>19)]; int U=((uvbuf0[VAR_3>>1]*VAR_1+uvbuf1[VAR_3>>1]*uvalpha)>>19); int V=((uvbuf0[(VAR_3>>1)+2048]*VAR_1+uvbuf1[(VAR_3>>1)+2048]*uvalpha)>>19); int Cb= yuvtab_40cf[U]; int Cg= yuvtab_1a1e[V] + yuvtab_0c92[U]; int Cr= yuvtab_3343[V]; ((uint16_t*)dest)[VAR_3] = clip_table15b[(Y1 + Cb) >>13] | clip_table15g[(Y1 + Cg) >>13] | clip_table15r[(Y1 + Cr) >>13]; ((uint16_t*)dest)[VAR_3+1] = clip_table15b[(Y2 + Cb) >>13] | clip_table15g[(Y2 + Cg) >>13] | clip_table15r[(Y2 + Cr) >>13]; } } #endif } }
[ "static inline void FUNC_0(yuv2rgb2)(uint16_t *buf0, uint16_t *buf1, uint16_t *uvbuf0, uint16_t *uvbuf1,\nuint8_t *dest, int dstW, int yalpha, int uvalpha, int dstbpp)\n{", "int VAR_0=yalpha^4095;", "int VAR_1=uvalpha^4095;", "if(fullUVIpol)\n{", "#ifdef HAVE_MMX\nif(dstbpp == 32)\n{", "asm volatile(\nFULL_YSCALEYUV2RGB\n\"punpcklbw %%mm1, %%mm3\t\t\\n\\t\"\n\"punpcklbw %%mm7, %%mm0\t\t\\n\\t\"\n\"movq %%mm3, %%mm1\t\t\\n\\t\"\n\"punpcklwd %%mm0, %%mm3\t\t\\n\\t\"\n\"punpckhwd %%mm0, %%mm1\t\t\\n\\t\"\nMOVNTQ(%%mm3, (%4, %%eax, 4))\nMOVNTQ(%%mm1, 8(%4, %%eax, 4))\n\"addl $4, %%eax\t\t\t\\n\\t\"\n\"cmpl %5, %%eax\t\t\t\\n\\t\"\n\" jb 1b\t\t\t\t\\n\\t\"\n:: \"r\" (buf0), \"r\" (buf1), \"r\" (uvbuf0), \"r\" (uvbuf1), \"r\" (dest), \"m\" (dstW),\n\"m\" (VAR_0), \"m\" (VAR_1)\n: \"%eax\"\n);", "}", "else if(dstbpp==24)\n{", "asm volatile(\nFULL_YSCALEYUV2RGB\n\"punpcklbw %%mm1, %%mm3\t\t\\n\\t\"\n\"punpcklbw %%mm7, %%mm0\t\t\\n\\t\"\n\"movq %%mm3, %%mm1\t\t\\n\\t\"\n\"punpcklwd %%mm0, %%mm3\t\t\\n\\t\"\n\"punpckhwd %%mm0, %%mm1\t\t\\n\\t\"\n\"movq %%mm3, %%mm2\t\t\\n\\t\"\n\"psrlq $8, %%mm3\t\t\\n\\t\"\n\"pand \"MANGLE(bm00000111)\", %%mm2\\n\\t\"\n\"pand \"MANGLE(bm11111000)\", %%mm3\\n\\t\"\n\"por %%mm2, %%mm3\t\t\\n\\t\"\n\"movq %%mm1, %%mm2\t\t\\n\\t\"\n\"psllq $48, %%mm1\t\t\\n\\t\"\n\"por %%mm1, %%mm3\t\t\\n\\t\"\n\"movq %%mm2, %%mm1\t\t\\n\\t\"\n\"psrld $16, %%mm2\t\t\\n\\t\"\n\"psrlq $24, %%mm1\t\t\\n\\t\"\n\"por %%mm2, %%mm1\t\t\\n\\t\"\n\"movl %4, %%ebx\t\t\t\\n\\t\"\n\"addl %%eax, %%ebx\t\t\\n\\t\"\n#ifdef HAVE_MMX2\n\"movntq %%mm3, (%%ebx, %%eax, 2)\\n\\t\"\n\"movntq %%mm1, 8(%%ebx, %%eax, 2)\\n\\t\"\n#else\n\"movd %%mm3, (%%ebx, %%eax, 2)\t\\n\\t\"\n\"psrlq $32, %%mm3\t\t\\n\\t\"\n\"movd %%mm3, 4(%%ebx, %%eax, 2)\t\\n\\t\"\n\"movd %%mm1, 8(%%ebx, %%eax, 2)\t\\n\\t\"\n#endif\n\"addl $4, %%eax\t\t\t\\n\\t\"\n\"cmpl %5, %%eax\t\t\t\\n\\t\"\n\" jb 1b\t\t\t\t\\n\\t\"\n:: \"r\" (buf0), \"r\" (buf1), \"r\" (uvbuf0), \"r\" (uvbuf1), \"m\" (dest), \"m\" (dstW),\n\"m\" (VAR_0), \"m\" (VAR_1)\n: \"%eax\", \"%ebx\"\n);", "}", "else if(dstbpp==15)\n{", "asm volatile(\nFULL_YSCALEYUV2RGB\n#ifdef DITHER1XBPP\n\"paddusb \"MANGLE(g5Dither)\", %%mm1\\n\\t\"\n\"paddusb \"MANGLE(r5Dither)\", %%mm0\\n\\t\"\n\"paddusb \"MANGLE(b5Dither)\", %%mm3\\n\\t\"\n#endif\n\"punpcklbw %%mm7, %%mm1\t\t\\n\\t\"\n\"punpcklbw %%mm7, %%mm3\t\t\\n\\t\"\n\"punpcklbw %%mm7, %%mm0\t\t\\n\\t\"\n\"psrlw $3, %%mm3\t\t\\n\\t\"\n\"psllw $2, %%mm1\t\t\\n\\t\"\n\"psllw $7, %%mm0\t\t\\n\\t\"\n\"pand \"MANGLE(g15Mask)\", %%mm1\t\\n\\t\"\n\"pand \"MANGLE(r15Mask)\", %%mm0\t\\n\\t\"\n\"por %%mm3, %%mm1\t\t\\n\\t\"\n\"por %%mm1, %%mm0\t\t\\n\\t\"\nMOVNTQ(%%mm0, (%4, %%eax, 2))\n\"addl $4, %%eax\t\t\t\\n\\t\"\n\"cmpl %5, %%eax\t\t\t\\n\\t\"\n\" jb 1b\t\t\t\t\\n\\t\"\n:: \"r\" (buf0), \"r\" (buf1), \"r\" (uvbuf0), \"r\" (uvbuf1), \"r\" (dest), \"m\" (dstW),\n\"m\" (VAR_0), \"m\" (VAR_1)\n: \"%eax\"\n);", "}", "else if(dstbpp==16)\n{", "asm volatile(\nFULL_YSCALEYUV2RGB\n#ifdef DITHER1XBPP\n\"paddusb \"MANGLE(g6Dither)\", %%mm1\\n\\t\"\n\"paddusb \"MANGLE(r5Dither)\", %%mm0\\n\\t\"\n\"paddusb \"MANGLE(b5Dither)\", %%mm3\\n\\t\"\n#endif\n\"punpcklbw %%mm7, %%mm1\t\t\\n\\t\"\n\"punpcklbw %%mm7, %%mm3\t\t\\n\\t\"\n\"punpcklbw %%mm7, %%mm0\t\t\\n\\t\"\n\"psrlw $3, %%mm3\t\t\\n\\t\"\n\"psllw $3, %%mm1\t\t\\n\\t\"\n\"psllw $8, %%mm0\t\t\\n\\t\"\n\"pand \"MANGLE(g16Mask)\", %%mm1\t\\n\\t\"\n\"pand \"MANGLE(r16Mask)\", %%mm0\t\\n\\t\"\n\"por %%mm3, %%mm1\t\t\\n\\t\"\n\"por %%mm1, %%mm0\t\t\\n\\t\"\nMOVNTQ(%%mm0, (%4, %%eax, 2))\n\"addl $4, %%eax\t\t\t\\n\\t\"\n\"cmpl %5, %%eax\t\t\t\\n\\t\"\n\" jb 1b\t\t\t\t\\n\\t\"\n:: \"r\" (buf0), \"r\" (buf1), \"r\" (uvbuf0), \"r\" (uvbuf1), \"r\" (dest), \"m\" (dstW),\n\"m\" (VAR_0), \"m\" (VAR_1)\n: \"%eax\"\n);", "}", "#else\nif(dstbpp==32 || dstbpp==24)\n{", "int VAR_3;", "for(VAR_3=0;VAR_3<dstW;VAR_3++){", "int Y=yuvtab_2568[((buf0[VAR_3]*VAR_0+buf1[VAR_3]*yalpha)>>19)];", "int U=((uvbuf0[VAR_3]*VAR_1+uvbuf1[VAR_3]*uvalpha)>>19);", "int V=((uvbuf0[VAR_3+2048]*VAR_1+uvbuf1[VAR_3+2048]*uvalpha)>>19);", "dest[0]=clip_table[((Y + yuvtab_40cf[U]) >>13)];", "dest[1]=clip_table[((Y + yuvtab_1a1e[V] + yuvtab_0c92[U]) >>13)];", "dest[2]=clip_table[((Y + yuvtab_3343[V]) >>13)];", "dest+=dstbpp>>3;", "}", "}", "else if(dstbpp==16)\n{", "int VAR_3;", "for(VAR_3=0;VAR_3<dstW;VAR_3++){", "int Y=yuvtab_2568[((buf0[VAR_3]*VAR_0+buf1[VAR_3]*yalpha)>>19)];", "int U=((uvbuf0[VAR_3]*VAR_1+uvbuf1[VAR_3]*uvalpha)>>19);", "int V=((uvbuf0[VAR_3+2048]*VAR_1+uvbuf1[VAR_3+2048]*uvalpha)>>19);", "((uint16_t*)dest)[VAR_3] =\nclip_table16b[(Y + yuvtab_40cf[U]) >>13] |\nclip_table16g[(Y + yuvtab_1a1e[V] + yuvtab_0c92[U]) >>13] |\nclip_table16r[(Y + yuvtab_3343[V]) >>13];", "}", "}", "else if(dstbpp==15)\n{", "int VAR_3;", "for(VAR_3=0;VAR_3<dstW;VAR_3++){", "int Y=yuvtab_2568[((buf0[VAR_3]*VAR_0+buf1[VAR_3]*yalpha)>>19)];", "int U=((uvbuf0[VAR_3]*VAR_1+uvbuf1[VAR_3]*uvalpha)>>19);", "int V=((uvbuf0[VAR_3+2048]*VAR_1+uvbuf1[VAR_3+2048]*uvalpha)>>19);", "((uint16_t*)dest)[VAR_3] =\nclip_table15b[(Y + yuvtab_40cf[U]) >>13] |\nclip_table15g[(Y + yuvtab_1a1e[V] + yuvtab_0c92[U]) >>13] |\nclip_table15r[(Y + yuvtab_3343[V]) >>13];", "}", "}", "#endif\n}", "else\n{", "#ifdef HAVE_MMX\nif(dstbpp == 32)\n{", "asm volatile(\nYSCALEYUV2RGB\nWRITEBGR32\n:: \"r\" (buf0), \"r\" (buf1), \"r\" (uvbuf0), \"r\" (uvbuf1), \"r\" (dest), \"m\" (dstW),\n\"m\" (VAR_0), \"m\" (VAR_1)\n: \"%eax\"\n);", "}", "else if(dstbpp==24)\n{", "asm volatile(\n\"movl %4, %%ebx\t\t\t\\n\\t\"\nYSCALEYUV2RGB\nWRITEBGR24\n:: \"r\" (buf0), \"r\" (buf1), \"r\" (uvbuf0), \"r\" (uvbuf1), \"m\" (dest), \"m\" (dstW),\n\"m\" (VAR_0), \"m\" (VAR_1)\n: \"%eax\", \"%ebx\"\n);", "}", "else if(dstbpp==15)\n{", "asm volatile(\nYSCALEYUV2RGB\n#ifdef DITHER1XBPP\n\"paddusb \"MANGLE(b5Dither)\", %%mm2\\n\\t\"\n\"paddusb \"MANGLE(g5Dither)\", %%mm4\\n\\t\"\n\"paddusb \"MANGLE(r5Dither)\", %%mm5\\n\\t\"\n#endif\nWRITEBGR15\n:: \"r\" (buf0), \"r\" (buf1), \"r\" (uvbuf0), \"r\" (uvbuf1), \"r\" (dest), \"m\" (dstW),\n\"m\" (VAR_0), \"m\" (VAR_1)\n: \"%eax\"\n);", "}", "else if(dstbpp==16)\n{", "asm volatile(\nYSCALEYUV2RGB\n#ifdef DITHER1XBPP\n\"paddusb \"MANGLE(b5Dither)\", %%mm2\\n\\t\"\n\"paddusb \"MANGLE(g6Dither)\", %%mm4\\n\\t\"\n\"paddusb \"MANGLE(r5Dither)\", %%mm5\\n\\t\"\n#endif\nWRITEBGR16\n:: \"r\" (buf0), \"r\" (buf1), \"r\" (uvbuf0), \"r\" (uvbuf1), \"r\" (dest), \"m\" (dstW),\n\"m\" (VAR_0), \"m\" (VAR_1)\n: \"%eax\"\n);", "}", "#else\nif(dstbpp==32)\n{", "int VAR_3;", "for(VAR_3=0; VAR_3<dstW-1; VAR_3+=2){", "int Y1=yuvtab_2568[((buf0[VAR_3]*VAR_0+buf1[VAR_3]*yalpha)>>19)];", "int Y2=yuvtab_2568[((buf0[VAR_3+1]*VAR_0+buf1[VAR_3+1]*yalpha)>>19)];", "int U=((uvbuf0[VAR_3>>1]*VAR_1+uvbuf1[VAR_3>>1]*uvalpha)>>19);", "int V=((uvbuf0[(VAR_3>>1)+2048]*VAR_1+uvbuf1[(VAR_3>>1)+2048]*uvalpha)>>19);", "int Cb= yuvtab_40cf[U];", "int Cg= yuvtab_1a1e[V] + yuvtab_0c92[U];", "int Cr= yuvtab_3343[V];", "dest[4*VAR_3+0]=clip_table[((Y1 + Cb) >>13)];", "dest[4*VAR_3+1]=clip_table[((Y1 + Cg) >>13)];", "dest[4*VAR_3+2]=clip_table[((Y1 + Cr) >>13)];", "dest[4*VAR_3+4]=clip_table[((Y2 + Cb) >>13)];", "dest[4*VAR_3+5]=clip_table[((Y2 + Cg) >>13)];", "dest[4*VAR_3+6]=clip_table[((Y2 + Cr) >>13)];", "}", "}", "else if(dstbpp==24)\n{", "int VAR_3;", "for(VAR_3=0; VAR_3<dstW-1; VAR_3+=2){", "int Y1=yuvtab_2568[((buf0[VAR_3]*VAR_0+buf1[VAR_3]*yalpha)>>19)];", "int Y2=yuvtab_2568[((buf0[VAR_3+1]*VAR_0+buf1[VAR_3+1]*yalpha)>>19)];", "int U=((uvbuf0[VAR_3>>1]*VAR_1+uvbuf1[VAR_3>>1]*uvalpha)>>19);", "int V=((uvbuf0[(VAR_3>>1)+2048]*VAR_1+uvbuf1[(VAR_3>>1)+2048]*uvalpha)>>19);", "int Cb= yuvtab_40cf[U];", "int Cg= yuvtab_1a1e[V] + yuvtab_0c92[U];", "int Cr= yuvtab_3343[V];", "dest[0]=clip_table[((Y1 + Cb) >>13)];", "dest[1]=clip_table[((Y1 + Cg) >>13)];", "dest[2]=clip_table[((Y1 + Cr) >>13)];", "dest[3]=clip_table[((Y2 + Cb) >>13)];", "dest[4]=clip_table[((Y2 + Cg) >>13)];", "dest[5]=clip_table[((Y2 + Cr) >>13)];", "dest+=6;", "}", "}", "else if(dstbpp==16)\n{", "int VAR_3;", "for(VAR_3=0; VAR_3<dstW-1; VAR_3+=2){", "int Y1=yuvtab_2568[((buf0[VAR_3]*VAR_0+buf1[VAR_3]*yalpha)>>19)];", "int Y2=yuvtab_2568[((buf0[VAR_3+1]*VAR_0+buf1[VAR_3+1]*yalpha)>>19)];", "int U=((uvbuf0[VAR_3>>1]*VAR_1+uvbuf1[VAR_3>>1]*uvalpha)>>19);", "int V=((uvbuf0[(VAR_3>>1)+2048]*VAR_1+uvbuf1[(VAR_3>>1)+2048]*uvalpha)>>19);", "int Cb= yuvtab_40cf[U];", "int Cg= yuvtab_1a1e[V] + yuvtab_0c92[U];", "int Cr= yuvtab_3343[V];", "((uint16_t*)dest)[VAR_3] =\nclip_table16b[(Y1 + Cb) >>13] |\nclip_table16g[(Y1 + Cg) >>13] |\nclip_table16r[(Y1 + Cr) >>13];", "((uint16_t*)dest)[VAR_3+1] =\nclip_table16b[(Y2 + Cb) >>13] |\nclip_table16g[(Y2 + Cg) >>13] |\nclip_table16r[(Y2 + Cr) >>13];", "}", "}", "else if(dstbpp==15)\n{", "int VAR_3;", "for(VAR_3=0; VAR_3<dstW-1; VAR_3+=2){", "int Y1=yuvtab_2568[((buf0[VAR_3]*VAR_0+buf1[VAR_3]*yalpha)>>19)];", "int Y2=yuvtab_2568[((buf0[VAR_3+1]*VAR_0+buf1[VAR_3+1]*yalpha)>>19)];", "int U=((uvbuf0[VAR_3>>1]*VAR_1+uvbuf1[VAR_3>>1]*uvalpha)>>19);", "int V=((uvbuf0[(VAR_3>>1)+2048]*VAR_1+uvbuf1[(VAR_3>>1)+2048]*uvalpha)>>19);", "int Cb= yuvtab_40cf[U];", "int Cg= yuvtab_1a1e[V] + yuvtab_0c92[U];", "int Cr= yuvtab_3343[V];", "((uint16_t*)dest)[VAR_3] =\nclip_table15b[(Y1 + Cb) >>13] |\nclip_table15g[(Y1 + Cg) >>13] |\nclip_table15r[(Y1 + Cr) >>13];", "((uint16_t*)dest)[VAR_3+1] =\nclip_table15b[(Y2 + Cb) >>13] |\nclip_table15g[(Y2 + Cg) >>13] |\nclip_table15r[(Y2 + Cr) >>13];", "}", "}", "#endif\n}", "}" ]
[ 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13, 15 ], [ 19, 21, 23 ], [ 25, 31, 33, 35, 39, 41, 43, 47, 49, 53, 55, 57, 63, 65, 67, 69 ], [ 71 ], [ 73, 75 ], [ 77, 81, 87, 89, 93, 95, 97, 101, 103, 105, 107, 109, 111, 113, 115, 119, 121, 123, 125, 129, 131, 135, 139, 141, 143, 145, 147, 149, 151, 153, 155, 157, 159, 163, 165, 167, 169 ], [ 171 ], [ 173, 175 ], [ 177, 181, 183, 185, 187, 189, 191, 193, 195, 197, 201, 203, 205, 207, 209, 213, 215, 219, 223, 225, 227, 231, 233, 235, 237 ], [ 239 ], [ 241, 243 ], [ 245, 249, 251, 253, 255, 257, 259, 261, 263, 265, 269, 271, 273, 275, 277, 281, 283, 287, 291, 293, 295, 299, 301, 303, 305 ], [ 307 ], [ 309, 311, 313 ], [ 315 ], [ 317 ], [ 321 ], [ 323 ], [ 325 ], [ 327 ], [ 329 ], [ 331 ], [ 333 ], [ 335 ], [ 337 ], [ 339, 341 ], [ 343 ], [ 345 ], [ 349 ], [ 351 ], [ 353 ], [ 357, 359, 361, 363 ], [ 365 ], [ 367 ], [ 369, 371 ], [ 373 ], [ 375 ], [ 379 ], [ 381 ], [ 383 ], [ 387, 389, 391, 393 ], [ 395 ], [ 397 ], [ 399, 401 ], [ 403, 405 ], [ 407, 409, 411 ], [ 413, 415, 417, 421, 423, 425, 427 ], [ 429 ], [ 431, 433 ], [ 435, 437, 439, 441, 445, 447, 449, 451 ], [ 453 ], [ 455, 457 ], [ 459, 461, 465, 467, 469, 471, 473, 477, 481, 483, 485, 487 ], [ 489 ], [ 491, 493 ], [ 495, 497, 501, 503, 505, 507, 509, 513, 517, 519, 521, 523 ], [ 525 ], [ 527, 529, 531 ], [ 533 ], [ 535 ], [ 539 ], [ 541 ], [ 543 ], [ 545 ], [ 549 ], [ 551 ], [ 553 ], [ 557 ], [ 559 ], [ 561 ], [ 565 ], [ 567 ], [ 569 ], [ 571 ], [ 573 ], [ 575, 577 ], [ 579 ], [ 581 ], [ 585 ], [ 587 ], [ 589 ], [ 591 ], [ 595 ], [ 597 ], [ 599 ], [ 603 ], [ 605 ], [ 607 ], [ 611 ], [ 613 ], [ 615 ], [ 617 ], [ 619 ], [ 621 ], [ 623, 625 ], [ 627 ], [ 629 ], [ 633 ], [ 635 ], [ 637 ], [ 639 ], [ 643 ], [ 645 ], [ 647 ], [ 651, 653, 655, 657 ], [ 661, 663, 665, 667 ], [ 669 ], [ 671 ], [ 673, 675 ], [ 677 ], [ 679 ], [ 683 ], [ 685 ], [ 687 ], [ 689 ], [ 693 ], [ 695 ], [ 697 ], [ 701, 703, 705, 707 ], [ 711, 713, 715, 717 ], [ 719 ], [ 721 ], [ 723, 725 ], [ 727 ] ]
13,974
static int wavpack_encode_block(WavPackEncodeContext *s, int32_t *samples_l, int32_t *samples_r, uint8_t *out, int out_size) { int block_size, start, end, data_size, tcount, temp, m = 0; int i, j, ret, got_extra = 0, nb_samples = s->block_samples; uint32_t crc = 0xffffffffu; struct Decorr *dpp; PutByteContext pb; if (!(s->flags & WV_MONO) && s->optimize_mono) { int32_t lor = 0, diff = 0; for (i = 0; i < nb_samples; i++) { lor |= samples_l[i] | samples_r[i]; diff |= samples_l[i] - samples_r[i]; if (lor && diff) break; } if (i == nb_samples && lor && !diff) { s->flags &= ~(WV_JOINT_STEREO | WV_CROSS_DECORR); s->flags |= WV_FALSE_STEREO; if (!s->false_stereo) { s->false_stereo = 1; s->num_terms = 0; CLEAR(s->w); } } else if (s->false_stereo) { s->false_stereo = 0; s->num_terms = 0; CLEAR(s->w); } } if (s->flags & SHIFT_MASK) { int shift = (s->flags & SHIFT_MASK) >> SHIFT_LSB; int mag = (s->flags & MAG_MASK) >> MAG_LSB; if (s->flags & WV_MONO_DATA) shift_mono(samples_l, nb_samples, shift); else shift_stereo(samples_l, samples_r, nb_samples, shift); if ((mag -= shift) < 0) s->flags &= ~MAG_MASK; else s->flags -= (1 << MAG_LSB) * shift; } if ((s->flags & WV_FLOAT_DATA) || (s->flags & MAG_MASK) >> MAG_LSB >= 24) { av_fast_padded_malloc(&s->orig_l, &s->orig_l_size, sizeof(int32_t) * nb_samples); memcpy(s->orig_l, samples_l, sizeof(int32_t) * nb_samples); if (!(s->flags & WV_MONO_DATA)) { av_fast_padded_malloc(&s->orig_r, &s->orig_r_size, sizeof(int32_t) * nb_samples); memcpy(s->orig_r, samples_r, sizeof(int32_t) * nb_samples); } if (s->flags & WV_FLOAT_DATA) got_extra = scan_float(s, samples_l, samples_r, nb_samples); else got_extra = scan_int32(s, samples_l, samples_r, nb_samples); s->num_terms = 0; } else { scan_int23(s, samples_l, samples_r, nb_samples); if (s->shift != s->int32_zeros + s->int32_ones + s->int32_dups) { s->shift = s->int32_zeros + s->int32_ones + s->int32_dups; s->num_terms = 0; } } if (!s->num_passes && !s->num_terms) { s->num_passes = 1; if (s->flags & WV_MONO_DATA) ret = wv_mono(s, samples_l, 1, 0); else ret = wv_stereo(s, samples_l, samples_r, 1, 0); s->num_passes = 0; } if (s->flags & WV_MONO_DATA) { for (i = 0; i < nb_samples; i++) crc += (crc << 1) + samples_l[i]; if (s->num_passes) ret = wv_mono(s, samples_l, !s->num_terms, 1); } else { for (i = 0; i < nb_samples; i++) crc += (crc << 3) + (samples_l[i] << 1) + samples_l[i] + samples_r[i]; if (s->num_passes) ret = wv_stereo(s, samples_l, samples_r, !s->num_terms, 1); } if (ret < 0) return ret; if (!s->ch_offset) s->flags |= WV_INITIAL_BLOCK; s->ch_offset += 1 + !(s->flags & WV_MONO); if (s->ch_offset == s->avctx->channels) s->flags |= WV_FINAL_BLOCK; bytestream2_init_writer(&pb, out, out_size); bytestream2_put_le32(&pb, MKTAG('w', 'v', 'p', 'k')); bytestream2_put_le32(&pb, 0); bytestream2_put_le16(&pb, 0x410); bytestream2_put_le16(&pb, 0); bytestream2_put_le32(&pb, 0); bytestream2_put_le32(&pb, s->sample_index); bytestream2_put_le32(&pb, nb_samples); bytestream2_put_le32(&pb, s->flags); bytestream2_put_le32(&pb, crc); if (s->flags & WV_INITIAL_BLOCK && s->avctx->channel_layout != AV_CH_LAYOUT_MONO && s->avctx->channel_layout != AV_CH_LAYOUT_STEREO) { put_metadata_block(&pb, WP_ID_CHANINFO, 5); bytestream2_put_byte(&pb, s->avctx->channels); bytestream2_put_le32(&pb, s->avctx->channel_layout); bytestream2_put_byte(&pb, 0); } if ((s->flags & SRATE_MASK) == SRATE_MASK) { put_metadata_block(&pb, WP_ID_SAMPLE_RATE, 3); bytestream2_put_le24(&pb, s->avctx->sample_rate); bytestream2_put_byte(&pb, 0); } put_metadata_block(&pb, WP_ID_DECTERMS, s->num_terms); for (i = 0; i < s->num_terms; i++) { struct Decorr *dpp = &s->decorr_passes[i]; bytestream2_put_byte(&pb, ((dpp->value + 5) & 0x1f) | ((dpp->delta << 5) & 0xe0)); } if (s->num_terms & 1) bytestream2_put_byte(&pb, 0); #define WRITE_DECWEIGHT(type) do { \ temp = store_weight(type); \ bytestream2_put_byte(&pb, temp); \ type = restore_weight(temp); \ } while (0) bytestream2_put_byte(&pb, WP_ID_DECWEIGHTS); bytestream2_put_byte(&pb, 0); start = bytestream2_tell_p(&pb); for (i = s->num_terms - 1; i >= 0; --i) { struct Decorr *dpp = &s->decorr_passes[i]; if (store_weight(dpp->weightA) || (!(s->flags & WV_MONO_DATA) && store_weight(dpp->weightB))) break; } tcount = i + 1; for (i = 0; i < s->num_terms; i++) { struct Decorr *dpp = &s->decorr_passes[i]; if (i < tcount) { WRITE_DECWEIGHT(dpp->weightA); if (!(s->flags & WV_MONO_DATA)) WRITE_DECWEIGHT(dpp->weightB); } else { dpp->weightA = dpp->weightB = 0; } } end = bytestream2_tell_p(&pb); out[start - 2] = WP_ID_DECWEIGHTS | (((end - start) & 1) ? WP_IDF_ODD: 0); out[start - 1] = (end - start + 1) >> 1; if ((end - start) & 1) bytestream2_put_byte(&pb, 0); #define WRITE_DECSAMPLE(type) do { \ temp = log2s(type); \ type = wp_exp2(temp); \ bytestream2_put_le16(&pb, temp); \ } while (0) bytestream2_put_byte(&pb, WP_ID_DECSAMPLES); bytestream2_put_byte(&pb, 0); start = bytestream2_tell_p(&pb); for (i = 0; i < s->num_terms; i++) { struct Decorr *dpp = &s->decorr_passes[i]; if (i == 0) { if (dpp->value > MAX_TERM) { WRITE_DECSAMPLE(dpp->samplesA[0]); WRITE_DECSAMPLE(dpp->samplesA[1]); if (!(s->flags & WV_MONO_DATA)) { WRITE_DECSAMPLE(dpp->samplesB[0]); WRITE_DECSAMPLE(dpp->samplesB[1]); } } else if (dpp->value < 0) { WRITE_DECSAMPLE(dpp->samplesA[0]); WRITE_DECSAMPLE(dpp->samplesB[0]); } else { for (j = 0; j < dpp->value; j++) { WRITE_DECSAMPLE(dpp->samplesA[j]); if (!(s->flags & WV_MONO_DATA)) WRITE_DECSAMPLE(dpp->samplesB[j]); } } } else { CLEAR(dpp->samplesA); CLEAR(dpp->samplesB); } } end = bytestream2_tell_p(&pb); out[start - 1] = (end - start) >> 1; #define WRITE_CHAN_ENTROPY(chan) do { \ for (i = 0; i < 3; i++) { \ temp = wp_log2(s->w.c[chan].median[i]); \ bytestream2_put_le16(&pb, temp); \ s->w.c[chan].median[i] = wp_exp2(temp); \ } \ } while (0) put_metadata_block(&pb, WP_ID_ENTROPY, 6 * (1 + (!(s->flags & WV_MONO_DATA)))); WRITE_CHAN_ENTROPY(0); if (!(s->flags & WV_MONO_DATA)) WRITE_CHAN_ENTROPY(1); if (s->flags & WV_FLOAT_DATA) { put_metadata_block(&pb, WP_ID_FLOATINFO, 4); bytestream2_put_byte(&pb, s->float_flags); bytestream2_put_byte(&pb, s->float_shift); bytestream2_put_byte(&pb, s->float_max_exp); bytestream2_put_byte(&pb, 127); } if (s->flags & WV_INT32_DATA) { put_metadata_block(&pb, WP_ID_INT32INFO, 4); bytestream2_put_byte(&pb, s->int32_sent_bits); bytestream2_put_byte(&pb, s->int32_zeros); bytestream2_put_byte(&pb, s->int32_ones); bytestream2_put_byte(&pb, s->int32_dups); } if (s->flags & WV_MONO_DATA && !s->num_passes) { for (i = 0; i < nb_samples; i++) { int32_t code = samples_l[i]; for (tcount = s->num_terms, dpp = s->decorr_passes; tcount--; dpp++) { int32_t sam; if (dpp->value > MAX_TERM) { if (dpp->value & 1) sam = 2 * dpp->samplesA[0] - dpp->samplesA[1]; else sam = (3 * dpp->samplesA[0] - dpp->samplesA[1]) >> 1; dpp->samplesA[1] = dpp->samplesA[0]; dpp->samplesA[0] = code; } else { sam = dpp->samplesA[m]; dpp->samplesA[(m + dpp->value) & (MAX_TERM - 1)] = code; } code -= APPLY_WEIGHT(dpp->weightA, sam); UPDATE_WEIGHT(dpp->weightA, dpp->delta, sam, code); } m = (m + 1) & (MAX_TERM - 1); samples_l[i] = code; } if (m) { for (tcount = s->num_terms, dpp = s->decorr_passes; tcount--; dpp++) if (dpp->value > 0 && dpp->value <= MAX_TERM) { int32_t temp_A[MAX_TERM], temp_B[MAX_TERM]; int k; memcpy(temp_A, dpp->samplesA, sizeof(dpp->samplesA)); memcpy(temp_B, dpp->samplesB, sizeof(dpp->samplesB)); for (k = 0; k < MAX_TERM; k++) { dpp->samplesA[k] = temp_A[m]; dpp->samplesB[k] = temp_B[m]; m = (m + 1) & (MAX_TERM - 1); } } } } else if (!s->num_passes) { if (s->flags & WV_JOINT_STEREO) { for (i = 0; i < nb_samples; i++) samples_r[i] += ((samples_l[i] -= samples_r[i]) >> 1); } for (i = 0; i < s->num_terms; i++) { struct Decorr *dpp = &s->decorr_passes[i]; if (((s->flags & MAG_MASK) >> MAG_LSB) >= 16 || dpp->delta != 2) decorr_stereo_pass2(dpp, samples_l, samples_r, nb_samples); else decorr_stereo_pass_id2(dpp, samples_l, samples_r, nb_samples); } } bytestream2_put_byte(&pb, WP_ID_DATA | WP_IDF_LONG); init_put_bits(&s->pb, pb.buffer + 3, bytestream2_get_bytes_left_p(&pb)); if (s->flags & WV_MONO_DATA) { for (i = 0; i < nb_samples; i++) wavpack_encode_sample(s, &s->w.c[0], s->samples[0][i]); } else { for (i = 0; i < nb_samples; i++) { wavpack_encode_sample(s, &s->w.c[0], s->samples[0][i]); wavpack_encode_sample(s, &s->w.c[1], s->samples[1][i]); } } encode_flush(s); flush_put_bits(&s->pb); data_size = put_bits_count(&s->pb) >> 3; bytestream2_put_le24(&pb, (data_size + 1) >> 1); bytestream2_skip_p(&pb, data_size); if (data_size & 1) bytestream2_put_byte(&pb, 0); if (got_extra) { bytestream2_put_byte(&pb, WP_ID_EXTRABITS | WP_IDF_LONG); init_put_bits(&s->pb, pb.buffer + 7, bytestream2_get_bytes_left_p(&pb)); if (s->flags & WV_FLOAT_DATA) pack_float(s, s->orig_l, s->orig_r, nb_samples); else pack_int32(s, s->orig_l, s->orig_r, nb_samples); flush_put_bits(&s->pb); data_size = put_bits_count(&s->pb) >> 3; bytestream2_put_le24(&pb, (data_size + 5) >> 1); bytestream2_put_le32(&pb, s->crc_x); bytestream2_skip_p(&pb, data_size); if (data_size & 1) bytestream2_put_byte(&pb, 0); } block_size = bytestream2_tell_p(&pb); AV_WL32(out + 4, block_size - 8); return block_size; }
true
FFmpeg
2e9b79fc003f19c65f4fd6ef30748c1916ed4fa7
static int wavpack_encode_block(WavPackEncodeContext *s, int32_t *samples_l, int32_t *samples_r, uint8_t *out, int out_size) { int block_size, start, end, data_size, tcount, temp, m = 0; int i, j, ret, got_extra = 0, nb_samples = s->block_samples; uint32_t crc = 0xffffffffu; struct Decorr *dpp; PutByteContext pb; if (!(s->flags & WV_MONO) && s->optimize_mono) { int32_t lor = 0, diff = 0; for (i = 0; i < nb_samples; i++) { lor |= samples_l[i] | samples_r[i]; diff |= samples_l[i] - samples_r[i]; if (lor && diff) break; } if (i == nb_samples && lor && !diff) { s->flags &= ~(WV_JOINT_STEREO | WV_CROSS_DECORR); s->flags |= WV_FALSE_STEREO; if (!s->false_stereo) { s->false_stereo = 1; s->num_terms = 0; CLEAR(s->w); } } else if (s->false_stereo) { s->false_stereo = 0; s->num_terms = 0; CLEAR(s->w); } } if (s->flags & SHIFT_MASK) { int shift = (s->flags & SHIFT_MASK) >> SHIFT_LSB; int mag = (s->flags & MAG_MASK) >> MAG_LSB; if (s->flags & WV_MONO_DATA) shift_mono(samples_l, nb_samples, shift); else shift_stereo(samples_l, samples_r, nb_samples, shift); if ((mag -= shift) < 0) s->flags &= ~MAG_MASK; else s->flags -= (1 << MAG_LSB) * shift; } if ((s->flags & WV_FLOAT_DATA) || (s->flags & MAG_MASK) >> MAG_LSB >= 24) { av_fast_padded_malloc(&s->orig_l, &s->orig_l_size, sizeof(int32_t) * nb_samples); memcpy(s->orig_l, samples_l, sizeof(int32_t) * nb_samples); if (!(s->flags & WV_MONO_DATA)) { av_fast_padded_malloc(&s->orig_r, &s->orig_r_size, sizeof(int32_t) * nb_samples); memcpy(s->orig_r, samples_r, sizeof(int32_t) * nb_samples); } if (s->flags & WV_FLOAT_DATA) got_extra = scan_float(s, samples_l, samples_r, nb_samples); else got_extra = scan_int32(s, samples_l, samples_r, nb_samples); s->num_terms = 0; } else { scan_int23(s, samples_l, samples_r, nb_samples); if (s->shift != s->int32_zeros + s->int32_ones + s->int32_dups) { s->shift = s->int32_zeros + s->int32_ones + s->int32_dups; s->num_terms = 0; } } if (!s->num_passes && !s->num_terms) { s->num_passes = 1; if (s->flags & WV_MONO_DATA) ret = wv_mono(s, samples_l, 1, 0); else ret = wv_stereo(s, samples_l, samples_r, 1, 0); s->num_passes = 0; } if (s->flags & WV_MONO_DATA) { for (i = 0; i < nb_samples; i++) crc += (crc << 1) + samples_l[i]; if (s->num_passes) ret = wv_mono(s, samples_l, !s->num_terms, 1); } else { for (i = 0; i < nb_samples; i++) crc += (crc << 3) + (samples_l[i] << 1) + samples_l[i] + samples_r[i]; if (s->num_passes) ret = wv_stereo(s, samples_l, samples_r, !s->num_terms, 1); } if (ret < 0) return ret; if (!s->ch_offset) s->flags |= WV_INITIAL_BLOCK; s->ch_offset += 1 + !(s->flags & WV_MONO); if (s->ch_offset == s->avctx->channels) s->flags |= WV_FINAL_BLOCK; bytestream2_init_writer(&pb, out, out_size); bytestream2_put_le32(&pb, MKTAG('w', 'v', 'p', 'k')); bytestream2_put_le32(&pb, 0); bytestream2_put_le16(&pb, 0x410); bytestream2_put_le16(&pb, 0); bytestream2_put_le32(&pb, 0); bytestream2_put_le32(&pb, s->sample_index); bytestream2_put_le32(&pb, nb_samples); bytestream2_put_le32(&pb, s->flags); bytestream2_put_le32(&pb, crc); if (s->flags & WV_INITIAL_BLOCK && s->avctx->channel_layout != AV_CH_LAYOUT_MONO && s->avctx->channel_layout != AV_CH_LAYOUT_STEREO) { put_metadata_block(&pb, WP_ID_CHANINFO, 5); bytestream2_put_byte(&pb, s->avctx->channels); bytestream2_put_le32(&pb, s->avctx->channel_layout); bytestream2_put_byte(&pb, 0); } if ((s->flags & SRATE_MASK) == SRATE_MASK) { put_metadata_block(&pb, WP_ID_SAMPLE_RATE, 3); bytestream2_put_le24(&pb, s->avctx->sample_rate); bytestream2_put_byte(&pb, 0); } put_metadata_block(&pb, WP_ID_DECTERMS, s->num_terms); for (i = 0; i < s->num_terms; i++) { struct Decorr *dpp = &s->decorr_passes[i]; bytestream2_put_byte(&pb, ((dpp->value + 5) & 0x1f) | ((dpp->delta << 5) & 0xe0)); } if (s->num_terms & 1) bytestream2_put_byte(&pb, 0); #define WRITE_DECWEIGHT(type) do { \ temp = store_weight(type); \ bytestream2_put_byte(&pb, temp); \ type = restore_weight(temp); \ } while (0) bytestream2_put_byte(&pb, WP_ID_DECWEIGHTS); bytestream2_put_byte(&pb, 0); start = bytestream2_tell_p(&pb); for (i = s->num_terms - 1; i >= 0; --i) { struct Decorr *dpp = &s->decorr_passes[i]; if (store_weight(dpp->weightA) || (!(s->flags & WV_MONO_DATA) && store_weight(dpp->weightB))) break; } tcount = i + 1; for (i = 0; i < s->num_terms; i++) { struct Decorr *dpp = &s->decorr_passes[i]; if (i < tcount) { WRITE_DECWEIGHT(dpp->weightA); if (!(s->flags & WV_MONO_DATA)) WRITE_DECWEIGHT(dpp->weightB); } else { dpp->weightA = dpp->weightB = 0; } } end = bytestream2_tell_p(&pb); out[start - 2] = WP_ID_DECWEIGHTS | (((end - start) & 1) ? WP_IDF_ODD: 0); out[start - 1] = (end - start + 1) >> 1; if ((end - start) & 1) bytestream2_put_byte(&pb, 0); #define WRITE_DECSAMPLE(type) do { \ temp = log2s(type); \ type = wp_exp2(temp); \ bytestream2_put_le16(&pb, temp); \ } while (0) bytestream2_put_byte(&pb, WP_ID_DECSAMPLES); bytestream2_put_byte(&pb, 0); start = bytestream2_tell_p(&pb); for (i = 0; i < s->num_terms; i++) { struct Decorr *dpp = &s->decorr_passes[i]; if (i == 0) { if (dpp->value > MAX_TERM) { WRITE_DECSAMPLE(dpp->samplesA[0]); WRITE_DECSAMPLE(dpp->samplesA[1]); if (!(s->flags & WV_MONO_DATA)) { WRITE_DECSAMPLE(dpp->samplesB[0]); WRITE_DECSAMPLE(dpp->samplesB[1]); } } else if (dpp->value < 0) { WRITE_DECSAMPLE(dpp->samplesA[0]); WRITE_DECSAMPLE(dpp->samplesB[0]); } else { for (j = 0; j < dpp->value; j++) { WRITE_DECSAMPLE(dpp->samplesA[j]); if (!(s->flags & WV_MONO_DATA)) WRITE_DECSAMPLE(dpp->samplesB[j]); } } } else { CLEAR(dpp->samplesA); CLEAR(dpp->samplesB); } } end = bytestream2_tell_p(&pb); out[start - 1] = (end - start) >> 1; #define WRITE_CHAN_ENTROPY(chan) do { \ for (i = 0; i < 3; i++) { \ temp = wp_log2(s->w.c[chan].median[i]); \ bytestream2_put_le16(&pb, temp); \ s->w.c[chan].median[i] = wp_exp2(temp); \ } \ } while (0) put_metadata_block(&pb, WP_ID_ENTROPY, 6 * (1 + (!(s->flags & WV_MONO_DATA)))); WRITE_CHAN_ENTROPY(0); if (!(s->flags & WV_MONO_DATA)) WRITE_CHAN_ENTROPY(1); if (s->flags & WV_FLOAT_DATA) { put_metadata_block(&pb, WP_ID_FLOATINFO, 4); bytestream2_put_byte(&pb, s->float_flags); bytestream2_put_byte(&pb, s->float_shift); bytestream2_put_byte(&pb, s->float_max_exp); bytestream2_put_byte(&pb, 127); } if (s->flags & WV_INT32_DATA) { put_metadata_block(&pb, WP_ID_INT32INFO, 4); bytestream2_put_byte(&pb, s->int32_sent_bits); bytestream2_put_byte(&pb, s->int32_zeros); bytestream2_put_byte(&pb, s->int32_ones); bytestream2_put_byte(&pb, s->int32_dups); } if (s->flags & WV_MONO_DATA && !s->num_passes) { for (i = 0; i < nb_samples; i++) { int32_t code = samples_l[i]; for (tcount = s->num_terms, dpp = s->decorr_passes; tcount--; dpp++) { int32_t sam; if (dpp->value > MAX_TERM) { if (dpp->value & 1) sam = 2 * dpp->samplesA[0] - dpp->samplesA[1]; else sam = (3 * dpp->samplesA[0] - dpp->samplesA[1]) >> 1; dpp->samplesA[1] = dpp->samplesA[0]; dpp->samplesA[0] = code; } else { sam = dpp->samplesA[m]; dpp->samplesA[(m + dpp->value) & (MAX_TERM - 1)] = code; } code -= APPLY_WEIGHT(dpp->weightA, sam); UPDATE_WEIGHT(dpp->weightA, dpp->delta, sam, code); } m = (m + 1) & (MAX_TERM - 1); samples_l[i] = code; } if (m) { for (tcount = s->num_terms, dpp = s->decorr_passes; tcount--; dpp++) if (dpp->value > 0 && dpp->value <= MAX_TERM) { int32_t temp_A[MAX_TERM], temp_B[MAX_TERM]; int k; memcpy(temp_A, dpp->samplesA, sizeof(dpp->samplesA)); memcpy(temp_B, dpp->samplesB, sizeof(dpp->samplesB)); for (k = 0; k < MAX_TERM; k++) { dpp->samplesA[k] = temp_A[m]; dpp->samplesB[k] = temp_B[m]; m = (m + 1) & (MAX_TERM - 1); } } } } else if (!s->num_passes) { if (s->flags & WV_JOINT_STEREO) { for (i = 0; i < nb_samples; i++) samples_r[i] += ((samples_l[i] -= samples_r[i]) >> 1); } for (i = 0; i < s->num_terms; i++) { struct Decorr *dpp = &s->decorr_passes[i]; if (((s->flags & MAG_MASK) >> MAG_LSB) >= 16 || dpp->delta != 2) decorr_stereo_pass2(dpp, samples_l, samples_r, nb_samples); else decorr_stereo_pass_id2(dpp, samples_l, samples_r, nb_samples); } } bytestream2_put_byte(&pb, WP_ID_DATA | WP_IDF_LONG); init_put_bits(&s->pb, pb.buffer + 3, bytestream2_get_bytes_left_p(&pb)); if (s->flags & WV_MONO_DATA) { for (i = 0; i < nb_samples; i++) wavpack_encode_sample(s, &s->w.c[0], s->samples[0][i]); } else { for (i = 0; i < nb_samples; i++) { wavpack_encode_sample(s, &s->w.c[0], s->samples[0][i]); wavpack_encode_sample(s, &s->w.c[1], s->samples[1][i]); } } encode_flush(s); flush_put_bits(&s->pb); data_size = put_bits_count(&s->pb) >> 3; bytestream2_put_le24(&pb, (data_size + 1) >> 1); bytestream2_skip_p(&pb, data_size); if (data_size & 1) bytestream2_put_byte(&pb, 0); if (got_extra) { bytestream2_put_byte(&pb, WP_ID_EXTRABITS | WP_IDF_LONG); init_put_bits(&s->pb, pb.buffer + 7, bytestream2_get_bytes_left_p(&pb)); if (s->flags & WV_FLOAT_DATA) pack_float(s, s->orig_l, s->orig_r, nb_samples); else pack_int32(s, s->orig_l, s->orig_r, nb_samples); flush_put_bits(&s->pb); data_size = put_bits_count(&s->pb) >> 3; bytestream2_put_le24(&pb, (data_size + 5) >> 1); bytestream2_put_le32(&pb, s->crc_x); bytestream2_skip_p(&pb, data_size); if (data_size & 1) bytestream2_put_byte(&pb, 0); } block_size = bytestream2_tell_p(&pb); AV_WL32(out + 4, block_size - 8); return block_size; }
{ "code": [ " int i, j, ret, got_extra = 0, nb_samples = s->block_samples;" ], "line_no": [ 11 ] }
static int FUNC_0(WavPackEncodeContext *VAR_0, int32_t *VAR_1, int32_t *VAR_2, uint8_t *VAR_3, int VAR_4) { int VAR_5, VAR_20, VAR_7, VAR_8, VAR_20, VAR_10, VAR_11 = 0; int VAR_12, VAR_13, VAR_14, VAR_15 = 0, VAR_16 = VAR_0->block_samples; uint32_t crc = 0xffffffffu; struct Decorr *VAR_17; PutByteContext pb; if (!(VAR_0->flags & WV_MONO) && VAR_0->optimize_mono) { int32_t lor = 0, diff = 0; for (VAR_12 = 0; VAR_12 < VAR_16; VAR_12++) { lor |= VAR_1[VAR_12] | VAR_2[VAR_12]; diff |= VAR_1[VAR_12] - VAR_2[VAR_12]; if (lor && diff) break; } if (VAR_12 == VAR_16 && lor && !diff) { VAR_0->flags &= ~(WV_JOINT_STEREO | WV_CROSS_DECORR); VAR_0->flags |= WV_FALSE_STEREO; if (!VAR_0->false_stereo) { VAR_0->false_stereo = 1; VAR_0->num_terms = 0; CLEAR(VAR_0->w); } } else if (VAR_0->false_stereo) { VAR_0->false_stereo = 0; VAR_0->num_terms = 0; CLEAR(VAR_0->w); } } if (VAR_0->flags & SHIFT_MASK) { int VAR_18 = (VAR_0->flags & SHIFT_MASK) >> SHIFT_LSB; int VAR_19 = (VAR_0->flags & MAG_MASK) >> MAG_LSB; if (VAR_0->flags & WV_MONO_DATA) shift_mono(VAR_1, VAR_16, VAR_18); else shift_stereo(VAR_1, VAR_2, VAR_16, VAR_18); if ((VAR_19 -= VAR_18) < 0) VAR_0->flags &= ~MAG_MASK; else VAR_0->flags -= (1 << MAG_LSB) * VAR_18; } if ((VAR_0->flags & WV_FLOAT_DATA) || (VAR_0->flags & MAG_MASK) >> MAG_LSB >= 24) { av_fast_padded_malloc(&VAR_0->orig_l, &VAR_0->orig_l_size, sizeof(int32_t) * VAR_16); memcpy(VAR_0->orig_l, VAR_1, sizeof(int32_t) * VAR_16); if (!(VAR_0->flags & WV_MONO_DATA)) { av_fast_padded_malloc(&VAR_0->orig_r, &VAR_0->orig_r_size, sizeof(int32_t) * VAR_16); memcpy(VAR_0->orig_r, VAR_2, sizeof(int32_t) * VAR_16); } if (VAR_0->flags & WV_FLOAT_DATA) VAR_15 = scan_float(VAR_0, VAR_1, VAR_2, VAR_16); else VAR_15 = scan_int32(VAR_0, VAR_1, VAR_2, VAR_16); VAR_0->num_terms = 0; } else { scan_int23(VAR_0, VAR_1, VAR_2, VAR_16); if (VAR_0->VAR_18 != VAR_0->int32_zeros + VAR_0->int32_ones + VAR_0->int32_dups) { VAR_0->VAR_18 = VAR_0->int32_zeros + VAR_0->int32_ones + VAR_0->int32_dups; VAR_0->num_terms = 0; } } if (!VAR_0->num_passes && !VAR_0->num_terms) { VAR_0->num_passes = 1; if (VAR_0->flags & WV_MONO_DATA) VAR_14 = wv_mono(VAR_0, VAR_1, 1, 0); else VAR_14 = wv_stereo(VAR_0, VAR_1, VAR_2, 1, 0); VAR_0->num_passes = 0; } if (VAR_0->flags & WV_MONO_DATA) { for (VAR_12 = 0; VAR_12 < VAR_16; VAR_12++) crc += (crc << 1) + VAR_1[VAR_12]; if (VAR_0->num_passes) VAR_14 = wv_mono(VAR_0, VAR_1, !VAR_0->num_terms, 1); } else { for (VAR_12 = 0; VAR_12 < VAR_16; VAR_12++) crc += (crc << 3) + (VAR_1[VAR_12] << 1) + VAR_1[VAR_12] + VAR_2[VAR_12]; if (VAR_0->num_passes) VAR_14 = wv_stereo(VAR_0, VAR_1, VAR_2, !VAR_0->num_terms, 1); } if (VAR_14 < 0) return VAR_14; if (!VAR_0->ch_offset) VAR_0->flags |= WV_INITIAL_BLOCK; VAR_0->ch_offset += 1 + !(VAR_0->flags & WV_MONO); if (VAR_0->ch_offset == VAR_0->avctx->channels) VAR_0->flags |= WV_FINAL_BLOCK; bytestream2_init_writer(&pb, VAR_3, VAR_4); bytestream2_put_le32(&pb, MKTAG('w', 'v', 'p', 'k')); bytestream2_put_le32(&pb, 0); bytestream2_put_le16(&pb, 0x410); bytestream2_put_le16(&pb, 0); bytestream2_put_le32(&pb, 0); bytestream2_put_le32(&pb, VAR_0->sample_index); bytestream2_put_le32(&pb, VAR_16); bytestream2_put_le32(&pb, VAR_0->flags); bytestream2_put_le32(&pb, crc); if (VAR_0->flags & WV_INITIAL_BLOCK && VAR_0->avctx->channel_layout != AV_CH_LAYOUT_MONO && VAR_0->avctx->channel_layout != AV_CH_LAYOUT_STEREO) { put_metadata_block(&pb, WP_ID_CHANINFO, 5); FUNC_1(&pb, VAR_0->avctx->channels); bytestream2_put_le32(&pb, VAR_0->avctx->channel_layout); FUNC_1(&pb, 0); } if ((VAR_0->flags & SRATE_MASK) == SRATE_MASK) { put_metadata_block(&pb, WP_ID_SAMPLE_RATE, 3); bytestream2_put_le24(&pb, VAR_0->avctx->sample_rate); FUNC_1(&pb, 0); } put_metadata_block(&pb, WP_ID_DECTERMS, VAR_0->num_terms); for (VAR_12 = 0; VAR_12 < VAR_0->num_terms; VAR_12++) { struct Decorr *VAR_17 = &VAR_0->decorr_passes[VAR_12]; FUNC_1(&pb, ((VAR_17->value + 5) & 0x1f) | ((VAR_17->delta << 5) & 0xe0)); } if (VAR_0->num_terms & 1) FUNC_1(&pb, 0); #define WRITE_DECWEIGHT(type) do { \ VAR_10 = store_weight(type); \ FUNC_1(&pb, VAR_10); \ type = restore_weight(VAR_10); \ } while (0) FUNC_1(&pb, WP_ID_DECWEIGHTS); FUNC_1(&pb, 0); VAR_20 = bytestream2_tell_p(&pb); for (VAR_12 = VAR_0->num_terms - 1; VAR_12 >= 0; --VAR_12) { struct Decorr *VAR_17 = &VAR_0->decorr_passes[VAR_12]; if (store_weight(VAR_17->weightA) || (!(VAR_0->flags & WV_MONO_DATA) && store_weight(VAR_17->weightB))) break; } VAR_20 = VAR_12 + 1; for (VAR_12 = 0; VAR_12 < VAR_0->num_terms; VAR_12++) { struct Decorr *VAR_17 = &VAR_0->decorr_passes[VAR_12]; if (VAR_12 < VAR_20) { WRITE_DECWEIGHT(VAR_17->weightA); if (!(VAR_0->flags & WV_MONO_DATA)) WRITE_DECWEIGHT(VAR_17->weightB); } else { VAR_17->weightA = VAR_17->weightB = 0; } } VAR_7 = bytestream2_tell_p(&pb); VAR_3[VAR_20 - 2] = WP_ID_DECWEIGHTS | (((VAR_7 - VAR_20) & 1) ? WP_IDF_ODD: 0); VAR_3[VAR_20 - 1] = (VAR_7 - VAR_20 + 1) >> 1; if ((VAR_7 - VAR_20) & 1) FUNC_1(&pb, 0); #define WRITE_DECSAMPLE(type) do { \ VAR_10 = log2s(type); \ type = wp_exp2(VAR_10); \ bytestream2_put_le16(&pb, VAR_10); \ } while (0) FUNC_1(&pb, WP_ID_DECSAMPLES); FUNC_1(&pb, 0); VAR_20 = bytestream2_tell_p(&pb); for (VAR_12 = 0; VAR_12 < VAR_0->num_terms; VAR_12++) { struct Decorr *VAR_17 = &VAR_0->decorr_passes[VAR_12]; if (VAR_12 == 0) { if (VAR_17->value > MAX_TERM) { WRITE_DECSAMPLE(VAR_17->samplesA[0]); WRITE_DECSAMPLE(VAR_17->samplesA[1]); if (!(VAR_0->flags & WV_MONO_DATA)) { WRITE_DECSAMPLE(VAR_17->samplesB[0]); WRITE_DECSAMPLE(VAR_17->samplesB[1]); } } else if (VAR_17->value < 0) { WRITE_DECSAMPLE(VAR_17->samplesA[0]); WRITE_DECSAMPLE(VAR_17->samplesB[0]); } else { for (VAR_13 = 0; VAR_13 < VAR_17->value; VAR_13++) { WRITE_DECSAMPLE(VAR_17->samplesA[VAR_13]); if (!(VAR_0->flags & WV_MONO_DATA)) WRITE_DECSAMPLE(VAR_17->samplesB[VAR_13]); } } } else { CLEAR(VAR_17->samplesA); CLEAR(VAR_17->samplesB); } } VAR_7 = bytestream2_tell_p(&pb); VAR_3[VAR_20 - 1] = (VAR_7 - VAR_20) >> 1; #define WRITE_CHAN_ENTROPY(chan) do { \ for (VAR_12 = 0; VAR_12 < 3; VAR_12++) { \ VAR_10 = wp_log2(VAR_0->w.c[chan].median[VAR_12]); \ bytestream2_put_le16(&pb, VAR_10); \ VAR_0->w.c[chan].median[VAR_12] = wp_exp2(VAR_10); \ } \ } while (0) put_metadata_block(&pb, WP_ID_ENTROPY, 6 * (1 + (!(VAR_0->flags & WV_MONO_DATA)))); WRITE_CHAN_ENTROPY(0); if (!(VAR_0->flags & WV_MONO_DATA)) WRITE_CHAN_ENTROPY(1); if (VAR_0->flags & WV_FLOAT_DATA) { put_metadata_block(&pb, WP_ID_FLOATINFO, 4); FUNC_1(&pb, VAR_0->float_flags); FUNC_1(&pb, VAR_0->float_shift); FUNC_1(&pb, VAR_0->float_max_exp); FUNC_1(&pb, 127); } if (VAR_0->flags & WV_INT32_DATA) { put_metadata_block(&pb, WP_ID_INT32INFO, 4); FUNC_1(&pb, VAR_0->int32_sent_bits); FUNC_1(&pb, VAR_0->int32_zeros); FUNC_1(&pb, VAR_0->int32_ones); FUNC_1(&pb, VAR_0->int32_dups); } if (VAR_0->flags & WV_MONO_DATA && !VAR_0->num_passes) { for (VAR_12 = 0; VAR_12 < VAR_16; VAR_12++) { int32_t code = VAR_1[VAR_12]; for (VAR_20 = VAR_0->num_terms, VAR_17 = VAR_0->decorr_passes; VAR_20--; VAR_17++) { int32_t sam; if (VAR_17->value > MAX_TERM) { if (VAR_17->value & 1) sam = 2 * VAR_17->samplesA[0] - VAR_17->samplesA[1]; else sam = (3 * VAR_17->samplesA[0] - VAR_17->samplesA[1]) >> 1; VAR_17->samplesA[1] = VAR_17->samplesA[0]; VAR_17->samplesA[0] = code; } else { sam = VAR_17->samplesA[VAR_11]; VAR_17->samplesA[(VAR_11 + VAR_17->value) & (MAX_TERM - 1)] = code; } code -= APPLY_WEIGHT(VAR_17->weightA, sam); UPDATE_WEIGHT(VAR_17->weightA, VAR_17->delta, sam, code); } VAR_11 = (VAR_11 + 1) & (MAX_TERM - 1); VAR_1[VAR_12] = code; } if (VAR_11) { for (VAR_20 = VAR_0->num_terms, VAR_17 = VAR_0->decorr_passes; VAR_20--; VAR_17++) if (VAR_17->value > 0 && VAR_17->value <= MAX_TERM) { int32_t temp_A[MAX_TERM], temp_B[MAX_TERM]; int k; memcpy(temp_A, VAR_17->samplesA, sizeof(VAR_17->samplesA)); memcpy(temp_B, VAR_17->samplesB, sizeof(VAR_17->samplesB)); for (k = 0; k < MAX_TERM; k++) { VAR_17->samplesA[k] = temp_A[VAR_11]; VAR_17->samplesB[k] = temp_B[VAR_11]; VAR_11 = (VAR_11 + 1) & (MAX_TERM - 1); } } } } else if (!VAR_0->num_passes) { if (VAR_0->flags & WV_JOINT_STEREO) { for (VAR_12 = 0; VAR_12 < VAR_16; VAR_12++) VAR_2[VAR_12] += ((VAR_1[VAR_12] -= VAR_2[VAR_12]) >> 1); } for (VAR_12 = 0; VAR_12 < VAR_0->num_terms; VAR_12++) { struct Decorr *VAR_17 = &VAR_0->decorr_passes[VAR_12]; if (((VAR_0->flags & MAG_MASK) >> MAG_LSB) >= 16 || VAR_17->delta != 2) decorr_stereo_pass2(VAR_17, VAR_1, VAR_2, VAR_16); else decorr_stereo_pass_id2(VAR_17, VAR_1, VAR_2, VAR_16); } } FUNC_1(&pb, WP_ID_DATA | WP_IDF_LONG); init_put_bits(&VAR_0->pb, pb.buffer + 3, bytestream2_get_bytes_left_p(&pb)); if (VAR_0->flags & WV_MONO_DATA) { for (VAR_12 = 0; VAR_12 < VAR_16; VAR_12++) wavpack_encode_sample(VAR_0, &VAR_0->w.c[0], VAR_0->samples[0][VAR_12]); } else { for (VAR_12 = 0; VAR_12 < VAR_16; VAR_12++) { wavpack_encode_sample(VAR_0, &VAR_0->w.c[0], VAR_0->samples[0][VAR_12]); wavpack_encode_sample(VAR_0, &VAR_0->w.c[1], VAR_0->samples[1][VAR_12]); } } encode_flush(VAR_0); flush_put_bits(&VAR_0->pb); VAR_8 = put_bits_count(&VAR_0->pb) >> 3; bytestream2_put_le24(&pb, (VAR_8 + 1) >> 1); bytestream2_skip_p(&pb, VAR_8); if (VAR_8 & 1) FUNC_1(&pb, 0); if (VAR_15) { FUNC_1(&pb, WP_ID_EXTRABITS | WP_IDF_LONG); init_put_bits(&VAR_0->pb, pb.buffer + 7, bytestream2_get_bytes_left_p(&pb)); if (VAR_0->flags & WV_FLOAT_DATA) pack_float(VAR_0, VAR_0->orig_l, VAR_0->orig_r, VAR_16); else pack_int32(VAR_0, VAR_0->orig_l, VAR_0->orig_r, VAR_16); flush_put_bits(&VAR_0->pb); VAR_8 = put_bits_count(&VAR_0->pb) >> 3; bytestream2_put_le24(&pb, (VAR_8 + 5) >> 1); bytestream2_put_le32(&pb, VAR_0->crc_x); bytestream2_skip_p(&pb, VAR_8); if (VAR_8 & 1) FUNC_1(&pb, 0); } VAR_5 = bytestream2_tell_p(&pb); AV_WL32(VAR_3 + 4, VAR_5 - 8); return VAR_5; }
[ "static int FUNC_0(WavPackEncodeContext *VAR_0,\nint32_t *VAR_1, int32_t *VAR_2,\nuint8_t *VAR_3, int VAR_4)\n{", "int VAR_5, VAR_20, VAR_7, VAR_8, VAR_20, VAR_10, VAR_11 = 0;", "int VAR_12, VAR_13, VAR_14, VAR_15 = 0, VAR_16 = VAR_0->block_samples;", "uint32_t crc = 0xffffffffu;", "struct Decorr *VAR_17;", "PutByteContext pb;", "if (!(VAR_0->flags & WV_MONO) && VAR_0->optimize_mono) {", "int32_t lor = 0, diff = 0;", "for (VAR_12 = 0; VAR_12 < VAR_16; VAR_12++) {", "lor |= VAR_1[VAR_12] | VAR_2[VAR_12];", "diff |= VAR_1[VAR_12] - VAR_2[VAR_12];", "if (lor && diff)\nbreak;", "}", "if (VAR_12 == VAR_16 && lor && !diff) {", "VAR_0->flags &= ~(WV_JOINT_STEREO | WV_CROSS_DECORR);", "VAR_0->flags |= WV_FALSE_STEREO;", "if (!VAR_0->false_stereo) {", "VAR_0->false_stereo = 1;", "VAR_0->num_terms = 0;", "CLEAR(VAR_0->w);", "}", "} else if (VAR_0->false_stereo) {", "VAR_0->false_stereo = 0;", "VAR_0->num_terms = 0;", "CLEAR(VAR_0->w);", "}", "}", "if (VAR_0->flags & SHIFT_MASK) {", "int VAR_18 = (VAR_0->flags & SHIFT_MASK) >> SHIFT_LSB;", "int VAR_19 = (VAR_0->flags & MAG_MASK) >> MAG_LSB;", "if (VAR_0->flags & WV_MONO_DATA)\nshift_mono(VAR_1, VAR_16, VAR_18);", "else\nshift_stereo(VAR_1, VAR_2, VAR_16, VAR_18);", "if ((VAR_19 -= VAR_18) < 0)\nVAR_0->flags &= ~MAG_MASK;", "else\nVAR_0->flags -= (1 << MAG_LSB) * VAR_18;", "}", "if ((VAR_0->flags & WV_FLOAT_DATA) || (VAR_0->flags & MAG_MASK) >> MAG_LSB >= 24) {", "av_fast_padded_malloc(&VAR_0->orig_l, &VAR_0->orig_l_size, sizeof(int32_t) * VAR_16);", "memcpy(VAR_0->orig_l, VAR_1, sizeof(int32_t) * VAR_16);", "if (!(VAR_0->flags & WV_MONO_DATA)) {", "av_fast_padded_malloc(&VAR_0->orig_r, &VAR_0->orig_r_size, sizeof(int32_t) * VAR_16);", "memcpy(VAR_0->orig_r, VAR_2, sizeof(int32_t) * VAR_16);", "}", "if (VAR_0->flags & WV_FLOAT_DATA)\nVAR_15 = scan_float(VAR_0, VAR_1, VAR_2, VAR_16);", "else\nVAR_15 = scan_int32(VAR_0, VAR_1, VAR_2, VAR_16);", "VAR_0->num_terms = 0;", "} else {", "scan_int23(VAR_0, VAR_1, VAR_2, VAR_16);", "if (VAR_0->VAR_18 != VAR_0->int32_zeros + VAR_0->int32_ones + VAR_0->int32_dups) {", "VAR_0->VAR_18 = VAR_0->int32_zeros + VAR_0->int32_ones + VAR_0->int32_dups;", "VAR_0->num_terms = 0;", "}", "}", "if (!VAR_0->num_passes && !VAR_0->num_terms) {", "VAR_0->num_passes = 1;", "if (VAR_0->flags & WV_MONO_DATA)\nVAR_14 = wv_mono(VAR_0, VAR_1, 1, 0);", "else\nVAR_14 = wv_stereo(VAR_0, VAR_1, VAR_2, 1, 0);", "VAR_0->num_passes = 0;", "}", "if (VAR_0->flags & WV_MONO_DATA) {", "for (VAR_12 = 0; VAR_12 < VAR_16; VAR_12++)", "crc += (crc << 1) + VAR_1[VAR_12];", "if (VAR_0->num_passes)\nVAR_14 = wv_mono(VAR_0, VAR_1, !VAR_0->num_terms, 1);", "} else {", "for (VAR_12 = 0; VAR_12 < VAR_16; VAR_12++)", "crc += (crc << 3) + (VAR_1[VAR_12] << 1) + VAR_1[VAR_12] + VAR_2[VAR_12];", "if (VAR_0->num_passes)\nVAR_14 = wv_stereo(VAR_0, VAR_1, VAR_2, !VAR_0->num_terms, 1);", "}", "if (VAR_14 < 0)\nreturn VAR_14;", "if (!VAR_0->ch_offset)\nVAR_0->flags |= WV_INITIAL_BLOCK;", "VAR_0->ch_offset += 1 + !(VAR_0->flags & WV_MONO);", "if (VAR_0->ch_offset == VAR_0->avctx->channels)\nVAR_0->flags |= WV_FINAL_BLOCK;", "bytestream2_init_writer(&pb, VAR_3, VAR_4);", "bytestream2_put_le32(&pb, MKTAG('w', 'v', 'p', 'k'));", "bytestream2_put_le32(&pb, 0);", "bytestream2_put_le16(&pb, 0x410);", "bytestream2_put_le16(&pb, 0);", "bytestream2_put_le32(&pb, 0);", "bytestream2_put_le32(&pb, VAR_0->sample_index);", "bytestream2_put_le32(&pb, VAR_16);", "bytestream2_put_le32(&pb, VAR_0->flags);", "bytestream2_put_le32(&pb, crc);", "if (VAR_0->flags & WV_INITIAL_BLOCK &&\nVAR_0->avctx->channel_layout != AV_CH_LAYOUT_MONO &&\nVAR_0->avctx->channel_layout != AV_CH_LAYOUT_STEREO) {", "put_metadata_block(&pb, WP_ID_CHANINFO, 5);", "FUNC_1(&pb, VAR_0->avctx->channels);", "bytestream2_put_le32(&pb, VAR_0->avctx->channel_layout);", "FUNC_1(&pb, 0);", "}", "if ((VAR_0->flags & SRATE_MASK) == SRATE_MASK) {", "put_metadata_block(&pb, WP_ID_SAMPLE_RATE, 3);", "bytestream2_put_le24(&pb, VAR_0->avctx->sample_rate);", "FUNC_1(&pb, 0);", "}", "put_metadata_block(&pb, WP_ID_DECTERMS, VAR_0->num_terms);", "for (VAR_12 = 0; VAR_12 < VAR_0->num_terms; VAR_12++) {", "struct Decorr *VAR_17 = &VAR_0->decorr_passes[VAR_12];", "FUNC_1(&pb, ((VAR_17->value + 5) & 0x1f) | ((VAR_17->delta << 5) & 0xe0));", "}", "if (VAR_0->num_terms & 1)\nFUNC_1(&pb, 0);", "#define WRITE_DECWEIGHT(type) do { \\", "VAR_10 = store_weight(type); \\", "FUNC_1(&pb, VAR_10); \\", "type = restore_weight(VAR_10); \\", "} while (0)", "FUNC_1(&pb, WP_ID_DECWEIGHTS);", "FUNC_1(&pb, 0);", "VAR_20 = bytestream2_tell_p(&pb);", "for (VAR_12 = VAR_0->num_terms - 1; VAR_12 >= 0; --VAR_12) {", "struct Decorr *VAR_17 = &VAR_0->decorr_passes[VAR_12];", "if (store_weight(VAR_17->weightA) ||\n(!(VAR_0->flags & WV_MONO_DATA) && store_weight(VAR_17->weightB)))\nbreak;", "}", "VAR_20 = VAR_12 + 1;", "for (VAR_12 = 0; VAR_12 < VAR_0->num_terms; VAR_12++) {", "struct Decorr *VAR_17 = &VAR_0->decorr_passes[VAR_12];", "if (VAR_12 < VAR_20) {", "WRITE_DECWEIGHT(VAR_17->weightA);", "if (!(VAR_0->flags & WV_MONO_DATA))\nWRITE_DECWEIGHT(VAR_17->weightB);", "} else {", "VAR_17->weightA = VAR_17->weightB = 0;", "}", "}", "VAR_7 = bytestream2_tell_p(&pb);", "VAR_3[VAR_20 - 2] = WP_ID_DECWEIGHTS | (((VAR_7 - VAR_20) & 1) ? WP_IDF_ODD: 0);", "VAR_3[VAR_20 - 1] = (VAR_7 - VAR_20 + 1) >> 1;", "if ((VAR_7 - VAR_20) & 1)\nFUNC_1(&pb, 0);", "#define WRITE_DECSAMPLE(type) do { \\", "VAR_10 = log2s(type); \\", "type = wp_exp2(VAR_10); \\", "bytestream2_put_le16(&pb, VAR_10); \\", "} while (0)", "FUNC_1(&pb, WP_ID_DECSAMPLES);", "FUNC_1(&pb, 0);", "VAR_20 = bytestream2_tell_p(&pb);", "for (VAR_12 = 0; VAR_12 < VAR_0->num_terms; VAR_12++) {", "struct Decorr *VAR_17 = &VAR_0->decorr_passes[VAR_12];", "if (VAR_12 == 0) {", "if (VAR_17->value > MAX_TERM) {", "WRITE_DECSAMPLE(VAR_17->samplesA[0]);", "WRITE_DECSAMPLE(VAR_17->samplesA[1]);", "if (!(VAR_0->flags & WV_MONO_DATA)) {", "WRITE_DECSAMPLE(VAR_17->samplesB[0]);", "WRITE_DECSAMPLE(VAR_17->samplesB[1]);", "}", "} else if (VAR_17->value < 0) {", "WRITE_DECSAMPLE(VAR_17->samplesA[0]);", "WRITE_DECSAMPLE(VAR_17->samplesB[0]);", "} else {", "for (VAR_13 = 0; VAR_13 < VAR_17->value; VAR_13++) {", "WRITE_DECSAMPLE(VAR_17->samplesA[VAR_13]);", "if (!(VAR_0->flags & WV_MONO_DATA))\nWRITE_DECSAMPLE(VAR_17->samplesB[VAR_13]);", "}", "}", "} else {", "CLEAR(VAR_17->samplesA);", "CLEAR(VAR_17->samplesB);", "}", "}", "VAR_7 = bytestream2_tell_p(&pb);", "VAR_3[VAR_20 - 1] = (VAR_7 - VAR_20) >> 1;", "#define WRITE_CHAN_ENTROPY(chan) do { \\", "for (VAR_12 = 0; VAR_12 < 3; VAR_12++) { \\", "VAR_10 = wp_log2(VAR_0->w.c[chan].median[VAR_12]); \\", "bytestream2_put_le16(&pb, VAR_10); \\", "VAR_0->w.c[chan].median[VAR_12] = wp_exp2(VAR_10); \\", "} \\", "} while (0)", "put_metadata_block(&pb, WP_ID_ENTROPY, 6 * (1 + (!(VAR_0->flags & WV_MONO_DATA))));", "WRITE_CHAN_ENTROPY(0);", "if (!(VAR_0->flags & WV_MONO_DATA))\nWRITE_CHAN_ENTROPY(1);", "if (VAR_0->flags & WV_FLOAT_DATA) {", "put_metadata_block(&pb, WP_ID_FLOATINFO, 4);", "FUNC_1(&pb, VAR_0->float_flags);", "FUNC_1(&pb, VAR_0->float_shift);", "FUNC_1(&pb, VAR_0->float_max_exp);", "FUNC_1(&pb, 127);", "}", "if (VAR_0->flags & WV_INT32_DATA) {", "put_metadata_block(&pb, WP_ID_INT32INFO, 4);", "FUNC_1(&pb, VAR_0->int32_sent_bits);", "FUNC_1(&pb, VAR_0->int32_zeros);", "FUNC_1(&pb, VAR_0->int32_ones);", "FUNC_1(&pb, VAR_0->int32_dups);", "}", "if (VAR_0->flags & WV_MONO_DATA && !VAR_0->num_passes) {", "for (VAR_12 = 0; VAR_12 < VAR_16; VAR_12++) {", "int32_t code = VAR_1[VAR_12];", "for (VAR_20 = VAR_0->num_terms, VAR_17 = VAR_0->decorr_passes; VAR_20--; VAR_17++) {", "int32_t sam;", "if (VAR_17->value > MAX_TERM) {", "if (VAR_17->value & 1)\nsam = 2 * VAR_17->samplesA[0] - VAR_17->samplesA[1];", "else\nsam = (3 * VAR_17->samplesA[0] - VAR_17->samplesA[1]) >> 1;", "VAR_17->samplesA[1] = VAR_17->samplesA[0];", "VAR_17->samplesA[0] = code;", "} else {", "sam = VAR_17->samplesA[VAR_11];", "VAR_17->samplesA[(VAR_11 + VAR_17->value) & (MAX_TERM - 1)] = code;", "}", "code -= APPLY_WEIGHT(VAR_17->weightA, sam);", "UPDATE_WEIGHT(VAR_17->weightA, VAR_17->delta, sam, code);", "}", "VAR_11 = (VAR_11 + 1) & (MAX_TERM - 1);", "VAR_1[VAR_12] = code;", "}", "if (VAR_11) {", "for (VAR_20 = VAR_0->num_terms, VAR_17 = VAR_0->decorr_passes; VAR_20--; VAR_17++)", "if (VAR_17->value > 0 && VAR_17->value <= MAX_TERM) {", "int32_t temp_A[MAX_TERM], temp_B[MAX_TERM];", "int k;", "memcpy(temp_A, VAR_17->samplesA, sizeof(VAR_17->samplesA));", "memcpy(temp_B, VAR_17->samplesB, sizeof(VAR_17->samplesB));", "for (k = 0; k < MAX_TERM; k++) {", "VAR_17->samplesA[k] = temp_A[VAR_11];", "VAR_17->samplesB[k] = temp_B[VAR_11];", "VAR_11 = (VAR_11 + 1) & (MAX_TERM - 1);", "}", "}", "}", "} else if (!VAR_0->num_passes) {", "if (VAR_0->flags & WV_JOINT_STEREO) {", "for (VAR_12 = 0; VAR_12 < VAR_16; VAR_12++)", "VAR_2[VAR_12] += ((VAR_1[VAR_12] -= VAR_2[VAR_12]) >> 1);", "}", "for (VAR_12 = 0; VAR_12 < VAR_0->num_terms; VAR_12++) {", "struct Decorr *VAR_17 = &VAR_0->decorr_passes[VAR_12];", "if (((VAR_0->flags & MAG_MASK) >> MAG_LSB) >= 16 || VAR_17->delta != 2)\ndecorr_stereo_pass2(VAR_17, VAR_1, VAR_2, VAR_16);", "else\ndecorr_stereo_pass_id2(VAR_17, VAR_1, VAR_2, VAR_16);", "}", "}", "FUNC_1(&pb, WP_ID_DATA | WP_IDF_LONG);", "init_put_bits(&VAR_0->pb, pb.buffer + 3, bytestream2_get_bytes_left_p(&pb));", "if (VAR_0->flags & WV_MONO_DATA) {", "for (VAR_12 = 0; VAR_12 < VAR_16; VAR_12++)", "wavpack_encode_sample(VAR_0, &VAR_0->w.c[0], VAR_0->samples[0][VAR_12]);", "} else {", "for (VAR_12 = 0; VAR_12 < VAR_16; VAR_12++) {", "wavpack_encode_sample(VAR_0, &VAR_0->w.c[0], VAR_0->samples[0][VAR_12]);", "wavpack_encode_sample(VAR_0, &VAR_0->w.c[1], VAR_0->samples[1][VAR_12]);", "}", "}", "encode_flush(VAR_0);", "flush_put_bits(&VAR_0->pb);", "VAR_8 = put_bits_count(&VAR_0->pb) >> 3;", "bytestream2_put_le24(&pb, (VAR_8 + 1) >> 1);", "bytestream2_skip_p(&pb, VAR_8);", "if (VAR_8 & 1)\nFUNC_1(&pb, 0);", "if (VAR_15) {", "FUNC_1(&pb, WP_ID_EXTRABITS | WP_IDF_LONG);", "init_put_bits(&VAR_0->pb, pb.buffer + 7, bytestream2_get_bytes_left_p(&pb));", "if (VAR_0->flags & WV_FLOAT_DATA)\npack_float(VAR_0, VAR_0->orig_l, VAR_0->orig_r, VAR_16);", "else\npack_int32(VAR_0, VAR_0->orig_l, VAR_0->orig_r, VAR_16);", "flush_put_bits(&VAR_0->pb);", "VAR_8 = put_bits_count(&VAR_0->pb) >> 3;", "bytestream2_put_le24(&pb, (VAR_8 + 5) >> 1);", "bytestream2_put_le32(&pb, VAR_0->crc_x);", "bytestream2_skip_p(&pb, VAR_8);", "if (VAR_8 & 1)\nFUNC_1(&pb, 0);", "}", "VAR_5 = bytestream2_tell_p(&pb);", "AV_WL32(VAR_3 + 4, VAR_5 - 8);", "return VAR_5;", "}" ]
[ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 35, 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 75 ], [ 77 ], [ 79 ], [ 83, 85 ], [ 87, 89 ], [ 93, 95 ], [ 97, 99 ], [ 101 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 121, 123 ], [ 125, 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 147 ], [ 149 ], [ 153, 155 ], [ 157, 159 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 175, 177 ], [ 179 ], [ 181 ], [ 183 ], [ 187, 189 ], [ 191 ], [ 193, 195 ], [ 199, 201 ], [ 205 ], [ 209, 211 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 237, 239, 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277, 279 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ], [ 291 ], [ 295 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 307, 309, 311 ], [ 313 ], [ 315 ], [ 317 ], [ 319 ], [ 321 ], [ 323 ], [ 325, 327 ], [ 329 ], [ 331 ], [ 333 ], [ 335 ], [ 337 ], [ 339 ], [ 341 ], [ 343, 345 ], [ 349 ], [ 351 ], [ 353 ], [ 355 ], [ 357 ], [ 361 ], [ 363 ], [ 365 ], [ 367 ], [ 369 ], [ 371 ], [ 373 ], [ 375 ], [ 377 ], [ 379 ], [ 381 ], [ 383 ], [ 385 ], [ 387 ], [ 389 ], [ 391 ], [ 393 ], [ 395 ], [ 397 ], [ 399, 401 ], [ 403 ], [ 405 ], [ 407 ], [ 409 ], [ 411 ], [ 413 ], [ 415 ], [ 417 ], [ 419 ], [ 423 ], [ 425 ], [ 427 ], [ 429 ], [ 431 ], [ 433 ], [ 435 ], [ 439 ], [ 441 ], [ 443, 445 ], [ 449 ], [ 451 ], [ 453 ], [ 455 ], [ 457 ], [ 459 ], [ 461 ], [ 465 ], [ 467 ], [ 469 ], [ 471 ], [ 473 ], [ 475 ], [ 477 ], [ 481 ], [ 483 ], [ 485 ], [ 489 ], [ 491 ], [ 495 ], [ 497, 499 ], [ 501, 503 ], [ 507 ], [ 509 ], [ 511 ], [ 513 ], [ 515 ], [ 517 ], [ 521 ], [ 523 ], [ 525 ], [ 529 ], [ 531 ], [ 533 ], [ 535 ], [ 537 ], [ 539 ], [ 541 ], [ 543 ], [ 547 ], [ 549 ], [ 553 ], [ 555 ], [ 557 ], [ 559 ], [ 561 ], [ 563 ], [ 565 ], [ 567 ], [ 569 ], [ 571 ], [ 573 ], [ 575 ], [ 579 ], [ 581 ], [ 583, 585 ], [ 587, 589 ], [ 591 ], [ 593 ], [ 597 ], [ 599 ], [ 601 ], [ 603 ], [ 605 ], [ 607 ], [ 609 ], [ 611 ], [ 613 ], [ 615 ], [ 617 ], [ 619 ], [ 621 ], [ 623 ], [ 625 ], [ 627 ], [ 629, 631 ], [ 635 ], [ 637 ], [ 639 ], [ 641, 643 ], [ 645, 647 ], [ 649 ], [ 651 ], [ 653 ], [ 655 ], [ 657 ], [ 659, 661 ], [ 663 ], [ 667 ], [ 669 ], [ 673 ], [ 675 ] ]
13,975
static void qemu_laio_process_completion(struct qemu_laio_state *s, struct qemu_laiocb *laiocb) { int ret; s->count--; ret = laiocb->ret; if (ret != -ECANCELED) { if (ret == laiocb->nbytes) ret = 0; else if (ret >= 0) ret = -EINVAL; laiocb->common.cb(laiocb->common.opaque, ret); } qemu_aio_release(laiocb); }
true
qemu
b161e2e4b32ac8fb9e6a891eba3da0b825b5d046
static void qemu_laio_process_completion(struct qemu_laio_state *s, struct qemu_laiocb *laiocb) { int ret; s->count--; ret = laiocb->ret; if (ret != -ECANCELED) { if (ret == laiocb->nbytes) ret = 0; else if (ret >= 0) ret = -EINVAL; laiocb->common.cb(laiocb->common.opaque, ret); } qemu_aio_release(laiocb); }
{ "code": [ " if (ret == laiocb->nbytes)", " else if (ret >= 0)", " ret = -EINVAL;" ], "line_no": [ 19, 23, 25 ] }
static void FUNC_0(struct qemu_laio_state *VAR_0, struct qemu_laiocb *VAR_1) { int VAR_2; VAR_0->count--; VAR_2 = VAR_1->VAR_2; if (VAR_2 != -ECANCELED) { if (VAR_2 == VAR_1->nbytes) VAR_2 = 0; else if (VAR_2 >= 0) VAR_2 = -EINVAL; VAR_1->common.cb(VAR_1->common.opaque, VAR_2); } qemu_aio_release(VAR_1); }
[ "static void FUNC_0(struct qemu_laio_state *VAR_0,\nstruct qemu_laiocb *VAR_1)\n{", "int VAR_2;", "VAR_0->count--;", "VAR_2 = VAR_1->VAR_2;", "if (VAR_2 != -ECANCELED) {", "if (VAR_2 == VAR_1->nbytes)\nVAR_2 = 0;", "else if (VAR_2 >= 0)\nVAR_2 = -EINVAL;", "VAR_1->common.cb(VAR_1->common.opaque, VAR_2);", "}", "qemu_aio_release(VAR_1);", "}" ]
[ 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 15 ], [ 17 ], [ 19, 21 ], [ 23, 25 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ] ]
13,976
void throttle_get_config(ThrottleState *ts, ThrottleConfig *cfg) { *cfg = ts->cfg;
true
qemu
d72915c60bff51495529449750e051d01b03c62f
void throttle_get_config(ThrottleState *ts, ThrottleConfig *cfg) { *cfg = ts->cfg;
{ "code": [], "line_no": [] }
void FUNC_0(ThrottleState *VAR_0, ThrottleConfig *VAR_1) { *VAR_1 = VAR_0->VAR_1;
[ "void FUNC_0(ThrottleState *VAR_0, ThrottleConfig *VAR_1)\n{", "*VAR_1 = VAR_0->VAR_1;" ]
[ 0, 0 ]
[ [ 1, 2 ], [ 3 ] ]
13,977
vreader_xfr_bytes(VReader *reader, unsigned char *send_buf, int send_buf_len, unsigned char *receive_buf, int *receive_buf_len) { VCardAPDU *apdu; VCardResponse *response = NULL; VCardStatus card_status; unsigned short status; VCard *card = vreader_get_card(reader); if (card == NULL) { return VREADER_NO_CARD; } apdu = vcard_apdu_new(send_buf, send_buf_len, &status); if (apdu == NULL) { response = vcard_make_response(status); card_status = VCARD_DONE; } else { g_debug("%s: CLS=0x%x,INS=0x%x,P1=0x%x,P2=0x%x,Lc=%d,Le=%d %s", __func__, apdu->a_cla, apdu->a_ins, apdu->a_p1, apdu->a_p2, apdu->a_Lc, apdu->a_Le, apdu_ins_to_string(apdu->a_ins)); card_status = vcard_process_apdu(card, apdu, &response); if (response) { g_debug("%s: status=%d sw1=0x%x sw2=0x%x len=%d (total=%d)", __func__, response->b_status, response->b_sw1, response->b_sw2, response->b_len, response->b_total_len); } } assert(card_status == VCARD_DONE); if (card_status == VCARD_DONE) { int size = MIN(*receive_buf_len, response->b_total_len); memcpy(receive_buf, response->b_data, size); *receive_buf_len = size; } vcard_response_delete(response); vcard_apdu_delete(apdu); vcard_free(card); /* free our reference */ return VREADER_OK; }
true
qemu
fa5912a17b51b807c4ec78a4aa914891c7770781
vreader_xfr_bytes(VReader *reader, unsigned char *send_buf, int send_buf_len, unsigned char *receive_buf, int *receive_buf_len) { VCardAPDU *apdu; VCardResponse *response = NULL; VCardStatus card_status; unsigned short status; VCard *card = vreader_get_card(reader); if (card == NULL) { return VREADER_NO_CARD; } apdu = vcard_apdu_new(send_buf, send_buf_len, &status); if (apdu == NULL) { response = vcard_make_response(status); card_status = VCARD_DONE; } else { g_debug("%s: CLS=0x%x,INS=0x%x,P1=0x%x,P2=0x%x,Lc=%d,Le=%d %s", __func__, apdu->a_cla, apdu->a_ins, apdu->a_p1, apdu->a_p2, apdu->a_Lc, apdu->a_Le, apdu_ins_to_string(apdu->a_ins)); card_status = vcard_process_apdu(card, apdu, &response); if (response) { g_debug("%s: status=%d sw1=0x%x sw2=0x%x len=%d (total=%d)", __func__, response->b_status, response->b_sw1, response->b_sw2, response->b_len, response->b_total_len); } } assert(card_status == VCARD_DONE); if (card_status == VCARD_DONE) { int size = MIN(*receive_buf_len, response->b_total_len); memcpy(receive_buf, response->b_data, size); *receive_buf_len = size; } vcard_response_delete(response); vcard_apdu_delete(apdu); vcard_free(card); return VREADER_OK; }
{ "code": [ " if (card_status == VCARD_DONE) {", " int size = MIN(*receive_buf_len, response->b_total_len);", " memcpy(receive_buf, response->b_data, size);", " *receive_buf_len = size;" ], "line_no": [ 61, 63, 65, 67 ] }
FUNC_0(VReader *VAR_0, unsigned char *VAR_1, int VAR_2, unsigned char *VAR_3, int *VAR_4) { VCardAPDU *apdu; VCardResponse *response = NULL; VCardStatus card_status; unsigned short VAR_5; VCard *card = vreader_get_card(VAR_0); if (card == NULL) { return VREADER_NO_CARD; } apdu = vcard_apdu_new(VAR_1, VAR_2, &VAR_5); if (apdu == NULL) { response = vcard_make_response(VAR_5); card_status = VCARD_DONE; } else { g_debug("%s: CLS=0x%x,INS=0x%x,P1=0x%x,P2=0x%x,Lc=%d,Le=%d %s", __func__, apdu->a_cla, apdu->a_ins, apdu->a_p1, apdu->a_p2, apdu->a_Lc, apdu->a_Le, apdu_ins_to_string(apdu->a_ins)); card_status = vcard_process_apdu(card, apdu, &response); if (response) { g_debug("%s: VAR_5=%d sw1=0x%x sw2=0x%x len=%d (total=%d)", __func__, response->b_status, response->b_sw1, response->b_sw2, response->b_len, response->b_total_len); } } assert(card_status == VCARD_DONE); if (card_status == VCARD_DONE) { int VAR_6 = MIN(*VAR_4, response->b_total_len); memcpy(VAR_3, response->b_data, VAR_6); *VAR_4 = VAR_6; } vcard_response_delete(response); vcard_apdu_delete(apdu); vcard_free(card); return VREADER_OK; }
[ "FUNC_0(VReader *VAR_0,\nunsigned char *VAR_1, int VAR_2,\nunsigned char *VAR_3, int *VAR_4)\n{", "VCardAPDU *apdu;", "VCardResponse *response = NULL;", "VCardStatus card_status;", "unsigned short VAR_5;", "VCard *card = vreader_get_card(VAR_0);", "if (card == NULL) {", "return VREADER_NO_CARD;", "}", "apdu = vcard_apdu_new(VAR_1, VAR_2, &VAR_5);", "if (apdu == NULL) {", "response = vcard_make_response(VAR_5);", "card_status = VCARD_DONE;", "} else {", "g_debug(\"%s: CLS=0x%x,INS=0x%x,P1=0x%x,P2=0x%x,Lc=%d,Le=%d %s\",\n__func__, apdu->a_cla, apdu->a_ins, apdu->a_p1, apdu->a_p2,\napdu->a_Lc, apdu->a_Le, apdu_ins_to_string(apdu->a_ins));", "card_status = vcard_process_apdu(card, apdu, &response);", "if (response) {", "g_debug(\"%s: VAR_5=%d sw1=0x%x sw2=0x%x len=%d (total=%d)\",\n__func__, response->b_status, response->b_sw1,\nresponse->b_sw2, response->b_len, response->b_total_len);", "}", "}", "assert(card_status == VCARD_DONE);", "if (card_status == VCARD_DONE) {", "int VAR_6 = MIN(*VAR_4, response->b_total_len);", "memcpy(VAR_3, response->b_data, VAR_6);", "*VAR_4 = VAR_6;", "}", "vcard_response_delete(response);", "vcard_apdu_delete(apdu);", "vcard_free(card);", "return VREADER_OK;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39, 41, 43 ], [ 45 ], [ 47 ], [ 49, 51, 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ] ]
13,978
static int tsc210x_load(QEMUFile *f, void *opaque, int version_id) { TSC210xState *s = (TSC210xState *) opaque; int64_t now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); int i; s->x = qemu_get_be16(f); s->y = qemu_get_be16(f); s->pressure = qemu_get_byte(f); s->state = qemu_get_byte(f); s->page = qemu_get_byte(f); s->offset = qemu_get_byte(f); s->command = qemu_get_byte(f); s->irq = qemu_get_byte(f); qemu_get_be16s(f, &s->dav); timer_get(f, s->timer); s->enabled = qemu_get_byte(f); s->host_mode = qemu_get_byte(f); s->function = qemu_get_byte(f); s->nextfunction = qemu_get_byte(f); s->precision = qemu_get_byte(f); s->nextprecision = qemu_get_byte(f); s->filter = qemu_get_byte(f); s->pin_func = qemu_get_byte(f); s->ref = qemu_get_byte(f); s->timing = qemu_get_byte(f); s->noise = qemu_get_be32(f); qemu_get_be16s(f, &s->audio_ctrl1); qemu_get_be16s(f, &s->audio_ctrl2); qemu_get_be16s(f, &s->audio_ctrl3); qemu_get_be16s(f, &s->pll[0]); qemu_get_be16s(f, &s->pll[1]); qemu_get_be16s(f, &s->volume); s->volume_change = qemu_get_sbe64(f) + now; s->powerdown = qemu_get_sbe64(f) + now; s->softstep = qemu_get_byte(f); qemu_get_be16s(f, &s->dac_power); for (i = 0; i < 0x14; i ++) qemu_get_be16s(f, &s->filter_data[i]); s->busy = timer_pending(s->timer); qemu_set_irq(s->pint, !s->irq); qemu_set_irq(s->davint, !s->dav); return 0;
true
qemu
5193be3be35f29a35bc465036cd64ad60d43385f
static int tsc210x_load(QEMUFile *f, void *opaque, int version_id) { TSC210xState *s = (TSC210xState *) opaque; int64_t now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); int i; s->x = qemu_get_be16(f); s->y = qemu_get_be16(f); s->pressure = qemu_get_byte(f); s->state = qemu_get_byte(f); s->page = qemu_get_byte(f); s->offset = qemu_get_byte(f); s->command = qemu_get_byte(f); s->irq = qemu_get_byte(f); qemu_get_be16s(f, &s->dav); timer_get(f, s->timer); s->enabled = qemu_get_byte(f); s->host_mode = qemu_get_byte(f); s->function = qemu_get_byte(f); s->nextfunction = qemu_get_byte(f); s->precision = qemu_get_byte(f); s->nextprecision = qemu_get_byte(f); s->filter = qemu_get_byte(f); s->pin_func = qemu_get_byte(f); s->ref = qemu_get_byte(f); s->timing = qemu_get_byte(f); s->noise = qemu_get_be32(f); qemu_get_be16s(f, &s->audio_ctrl1); qemu_get_be16s(f, &s->audio_ctrl2); qemu_get_be16s(f, &s->audio_ctrl3); qemu_get_be16s(f, &s->pll[0]); qemu_get_be16s(f, &s->pll[1]); qemu_get_be16s(f, &s->volume); s->volume_change = qemu_get_sbe64(f) + now; s->powerdown = qemu_get_sbe64(f) + now; s->softstep = qemu_get_byte(f); qemu_get_be16s(f, &s->dac_power); for (i = 0; i < 0x14; i ++) qemu_get_be16s(f, &s->filter_data[i]); s->busy = timer_pending(s->timer); qemu_set_irq(s->pint, !s->irq); qemu_set_irq(s->davint, !s->dav); return 0;
{ "code": [], "line_no": [] }
static int FUNC_0(QEMUFile *VAR_0, void *VAR_1, int VAR_2) { TSC210xState *s = (TSC210xState *) VAR_1; int64_t now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); int VAR_3; s->x = qemu_get_be16(VAR_0); s->y = qemu_get_be16(VAR_0); s->pressure = qemu_get_byte(VAR_0); s->state = qemu_get_byte(VAR_0); s->page = qemu_get_byte(VAR_0); s->offset = qemu_get_byte(VAR_0); s->command = qemu_get_byte(VAR_0); s->irq = qemu_get_byte(VAR_0); qemu_get_be16s(VAR_0, &s->dav); timer_get(VAR_0, s->timer); s->enabled = qemu_get_byte(VAR_0); s->host_mode = qemu_get_byte(VAR_0); s->function = qemu_get_byte(VAR_0); s->nextfunction = qemu_get_byte(VAR_0); s->precision = qemu_get_byte(VAR_0); s->nextprecision = qemu_get_byte(VAR_0); s->filter = qemu_get_byte(VAR_0); s->pin_func = qemu_get_byte(VAR_0); s->ref = qemu_get_byte(VAR_0); s->timing = qemu_get_byte(VAR_0); s->noise = qemu_get_be32(VAR_0); qemu_get_be16s(VAR_0, &s->audio_ctrl1); qemu_get_be16s(VAR_0, &s->audio_ctrl2); qemu_get_be16s(VAR_0, &s->audio_ctrl3); qemu_get_be16s(VAR_0, &s->pll[0]); qemu_get_be16s(VAR_0, &s->pll[1]); qemu_get_be16s(VAR_0, &s->volume); s->volume_change = qemu_get_sbe64(VAR_0) + now; s->powerdown = qemu_get_sbe64(VAR_0) + now; s->softstep = qemu_get_byte(VAR_0); qemu_get_be16s(VAR_0, &s->dac_power); for (VAR_3 = 0; VAR_3 < 0x14; VAR_3 ++) qemu_get_be16s(VAR_0, &s->filter_data[VAR_3]); s->busy = timer_pending(s->timer); qemu_set_irq(s->pint, !s->irq); qemu_set_irq(s->davint, !s->dav); return 0;
[ "static int FUNC_0(QEMUFile *VAR_0, void *VAR_1, int VAR_2)\n{", "TSC210xState *s = (TSC210xState *) VAR_1;", "int64_t now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);", "int VAR_3;", "s->x = qemu_get_be16(VAR_0);", "s->y = qemu_get_be16(VAR_0);", "s->pressure = qemu_get_byte(VAR_0);", "s->state = qemu_get_byte(VAR_0);", "s->page = qemu_get_byte(VAR_0);", "s->offset = qemu_get_byte(VAR_0);", "s->command = qemu_get_byte(VAR_0);", "s->irq = qemu_get_byte(VAR_0);", "qemu_get_be16s(VAR_0, &s->dav);", "timer_get(VAR_0, s->timer);", "s->enabled = qemu_get_byte(VAR_0);", "s->host_mode = qemu_get_byte(VAR_0);", "s->function = qemu_get_byte(VAR_0);", "s->nextfunction = qemu_get_byte(VAR_0);", "s->precision = qemu_get_byte(VAR_0);", "s->nextprecision = qemu_get_byte(VAR_0);", "s->filter = qemu_get_byte(VAR_0);", "s->pin_func = qemu_get_byte(VAR_0);", "s->ref = qemu_get_byte(VAR_0);", "s->timing = qemu_get_byte(VAR_0);", "s->noise = qemu_get_be32(VAR_0);", "qemu_get_be16s(VAR_0, &s->audio_ctrl1);", "qemu_get_be16s(VAR_0, &s->audio_ctrl2);", "qemu_get_be16s(VAR_0, &s->audio_ctrl3);", "qemu_get_be16s(VAR_0, &s->pll[0]);", "qemu_get_be16s(VAR_0, &s->pll[1]);", "qemu_get_be16s(VAR_0, &s->volume);", "s->volume_change = qemu_get_sbe64(VAR_0) + now;", "s->powerdown = qemu_get_sbe64(VAR_0) + now;", "s->softstep = qemu_get_byte(VAR_0);", "qemu_get_be16s(VAR_0, &s->dac_power);", "for (VAR_3 = 0; VAR_3 < 0x14; VAR_3 ++)", "qemu_get_be16s(VAR_0, &s->filter_data[VAR_3]);", "s->busy = timer_pending(s->timer);", "qemu_set_irq(s->pint, !s->irq);", "qemu_set_irq(s->davint, !s->dav);", "return 0;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 48 ], [ 53 ], [ 58 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 97 ], [ 99 ], [ 103 ], [ 105 ], [ 107 ], [ 111 ] ]
13,979
static uint16_t eepro100_read2(EEPRO100State * s, uint32_t addr) { uint16_t val; if (addr <= sizeof(s->mem) - sizeof(val)) { memcpy(&val, &s->mem[addr], sizeof(val)); } switch (addr) { case SCBStatus: case SCBCmd: TRACE(OTHER, logout("addr=%s val=0x%04x\n", regname(addr), val)); break; case SCBeeprom: val = eepro100_read_eeprom(s); TRACE(OTHER, logout("addr=%s val=0x%04x\n", regname(addr), val)); break; default: logout("addr=%s val=0x%04x\n", regname(addr), val); missing("unknown word read"); } return val; }
true
qemu
ef4760626e88bc3e7a1b46c7370378cbd12d379f
static uint16_t eepro100_read2(EEPRO100State * s, uint32_t addr) { uint16_t val; if (addr <= sizeof(s->mem) - sizeof(val)) { memcpy(&val, &s->mem[addr], sizeof(val)); } switch (addr) { case SCBStatus: case SCBCmd: TRACE(OTHER, logout("addr=%s val=0x%04x\n", regname(addr), val)); break; case SCBeeprom: val = eepro100_read_eeprom(s); TRACE(OTHER, logout("addr=%s val=0x%04x\n", regname(addr), val)); break; default: logout("addr=%s val=0x%04x\n", regname(addr), val); missing("unknown word read"); } return val; }
{ "code": [ " uint16_t val;" ], "line_no": [ 5 ] }
static uint16_t FUNC_0(EEPRO100State * s, uint32_t addr) { uint16_t val; if (addr <= sizeof(s->mem) - sizeof(val)) { memcpy(&val, &s->mem[addr], sizeof(val)); } switch (addr) { case SCBStatus: case SCBCmd: TRACE(OTHER, logout("addr=%s val=0x%04x\n", regname(addr), val)); break; case SCBeeprom: val = eepro100_read_eeprom(s); TRACE(OTHER, logout("addr=%s val=0x%04x\n", regname(addr), val)); break; default: logout("addr=%s val=0x%04x\n", regname(addr), val); missing("unknown word read"); } return val; }
[ "static uint16_t FUNC_0(EEPRO100State * s, uint32_t addr)\n{", "uint16_t val;", "if (addr <= sizeof(s->mem) - sizeof(val)) {", "memcpy(&val, &s->mem[addr], sizeof(val));", "}", "switch (addr) {", "case SCBStatus:\ncase SCBCmd:\nTRACE(OTHER, logout(\"addr=%s val=0x%04x\\n\", regname(addr), val));", "break;", "case SCBeeprom:\nval = eepro100_read_eeprom(s);", "TRACE(OTHER, logout(\"addr=%s val=0x%04x\\n\", regname(addr), val));", "break;", "default:\nlogout(\"addr=%s val=0x%04x\\n\", regname(addr), val);", "missing(\"unknown word read\");", "}", "return val;", "}" ]
[ 0, 1, 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 ] ]
13,980
static int disas_cp15_insn(CPUState *env, DisasContext *s, uint32_t insn) { uint32_t rd; TCGv tmp, tmp2; /* M profile cores use memory mapped registers instead of cp15. */ if (arm_feature(env, ARM_FEATURE_M)) return 1; if ((insn & (1 << 25)) == 0) { if (insn & (1 << 20)) { /* mrrc */ return 1; } /* mcrr. Used for block cache operations, so implement as no-op. */ return 0; } if ((insn & (1 << 4)) == 0) { /* cdp */ return 1; } if (IS_USER(s) && !cp15_user_ok(insn)) { return 1; } /* Pre-v7 versions of the architecture implemented WFI via coprocessor * instructions rather than a separate instruction. */ if ((insn & 0x0fff0fff) == 0x0e070f90) { /* 0,c7,c0,4: Standard v6 WFI (also used in some pre-v6 cores). * In v7, this must NOP. */ if (!arm_feature(env, ARM_FEATURE_V7)) { /* Wait for interrupt. */ gen_set_pc_im(s->pc); s->is_jmp = DISAS_WFI; } return 0; } if ((insn & 0x0fff0fff) == 0x0e070f58) { /* 0,c7,c8,2: Not all pre-v6 cores implemented this WFI, * so this is slightly over-broad. */ if (!arm_feature(env, ARM_FEATURE_V6)) { /* Wait for interrupt. */ gen_set_pc_im(s->pc); s->is_jmp = DISAS_WFI; return 0; } /* Otherwise fall through to handle via helper function. * In particular, on v7 and some v6 cores this is one of * the VA-PA registers. */ } rd = (insn >> 12) & 0xf; if (cp15_tls_load_store(env, s, insn, rd)) return 0; tmp2 = tcg_const_i32(insn); if (insn & ARM_CP_RW_BIT) { tmp = new_tmp(); gen_helper_get_cp15(tmp, cpu_env, tmp2); /* If the destination register is r15 then sets condition codes. */ if (rd != 15) store_reg(s, rd, tmp); else dead_tmp(tmp); } else { tmp = load_reg(s, rd); gen_helper_set_cp15(cpu_env, tmp2, tmp); dead_tmp(tmp); /* Normally we would always end the TB here, but Linux * arch/arm/mach-pxa/sleep.S expects two instructions following * an MMU enable to execute from cache. Imitate this behaviour. */ if (!arm_feature(env, ARM_FEATURE_XSCALE) || (insn & 0x0fff0fff) != 0x0e010f10) gen_lookup_tb(s); } tcg_temp_free_i32(tmp2); return 0; }
true
qemu
7d1b0095bff7157e856d1d0e6c4295641ced2752
static int disas_cp15_insn(CPUState *env, DisasContext *s, uint32_t insn) { uint32_t rd; TCGv tmp, tmp2; if (arm_feature(env, ARM_FEATURE_M)) return 1; if ((insn & (1 << 25)) == 0) { if (insn & (1 << 20)) { return 1; } return 0; } if ((insn & (1 << 4)) == 0) { return 1; } if (IS_USER(s) && !cp15_user_ok(insn)) { return 1; } if ((insn & 0x0fff0fff) == 0x0e070f90) { if (!arm_feature(env, ARM_FEATURE_V7)) { gen_set_pc_im(s->pc); s->is_jmp = DISAS_WFI; } return 0; } if ((insn & 0x0fff0fff) == 0x0e070f58) { if (!arm_feature(env, ARM_FEATURE_V6)) { gen_set_pc_im(s->pc); s->is_jmp = DISAS_WFI; return 0; } } rd = (insn >> 12) & 0xf; if (cp15_tls_load_store(env, s, insn, rd)) return 0; tmp2 = tcg_const_i32(insn); if (insn & ARM_CP_RW_BIT) { tmp = new_tmp(); gen_helper_get_cp15(tmp, cpu_env, tmp2); if (rd != 15) store_reg(s, rd, tmp); else dead_tmp(tmp); } else { tmp = load_reg(s, rd); gen_helper_set_cp15(cpu_env, tmp2, tmp); dead_tmp(tmp); if (!arm_feature(env, ARM_FEATURE_XSCALE) || (insn & 0x0fff0fff) != 0x0e010f10) gen_lookup_tb(s); } tcg_temp_free_i32(tmp2); return 0; }
{ "code": [ " dead_tmp(tmp);", " dead_tmp(tmp);", " dead_tmp(tmp);", " dead_tmp(tmp);", " dead_tmp(tmp);", " tmp = new_tmp();", " dead_tmp(tmp);", " dead_tmp(tmp);", " tmp = new_tmp();", " dead_tmp(tmp);", " dead_tmp(tmp);", " tmp = new_tmp();", " dead_tmp(tmp);", " dead_tmp(tmp);", " dead_tmp(tmp);", " dead_tmp(tmp);", " tmp = new_tmp();", " tmp = new_tmp();", " dead_tmp(tmp);", " dead_tmp(tmp);", " tmp = new_tmp();", " dead_tmp(tmp);", " dead_tmp(tmp);", " tmp = new_tmp();", " dead_tmp(tmp);", " dead_tmp(tmp);", " tmp = new_tmp();", " dead_tmp(tmp);", " dead_tmp(tmp);", " dead_tmp(tmp);", " dead_tmp(tmp);", " tmp = new_tmp();", " dead_tmp(tmp);", " dead_tmp(tmp);", " tmp = new_tmp();", " dead_tmp(tmp);", " dead_tmp(tmp);", " dead_tmp(tmp);", " dead_tmp(tmp);", " dead_tmp(tmp);", " dead_tmp(tmp);", " dead_tmp(tmp);", " dead_tmp(tmp);", " dead_tmp(tmp);", " dead_tmp(tmp);", " dead_tmp(tmp);" ], "line_no": [ 139, 147, 147, 147, 147, 127, 147, 139, 127, 147, 147, 127, 147, 147, 147, 147, 127, 127, 139, 147, 127, 139, 147, 127, 139, 147, 127, 147, 139, 147, 147, 127, 147, 139, 127, 139, 147, 139, 147, 139, 139, 139, 139, 139, 147, 139 ] }
static int FUNC_0(CPUState *VAR_0, DisasContext *VAR_1, uint32_t VAR_2) { uint32_t rd; TCGv tmp, tmp2; if (arm_feature(VAR_0, ARM_FEATURE_M)) return 1; if ((VAR_2 & (1 << 25)) == 0) { if (VAR_2 & (1 << 20)) { return 1; } return 0; } if ((VAR_2 & (1 << 4)) == 0) { return 1; } if (IS_USER(VAR_1) && !cp15_user_ok(VAR_2)) { return 1; } if ((VAR_2 & 0x0fff0fff) == 0x0e070f90) { if (!arm_feature(VAR_0, ARM_FEATURE_V7)) { gen_set_pc_im(VAR_1->pc); VAR_1->is_jmp = DISAS_WFI; } return 0; } if ((VAR_2 & 0x0fff0fff) == 0x0e070f58) { if (!arm_feature(VAR_0, ARM_FEATURE_V6)) { gen_set_pc_im(VAR_1->pc); VAR_1->is_jmp = DISAS_WFI; return 0; } } rd = (VAR_2 >> 12) & 0xf; if (cp15_tls_load_store(VAR_0, VAR_1, VAR_2, rd)) return 0; tmp2 = tcg_const_i32(VAR_2); if (VAR_2 & ARM_CP_RW_BIT) { tmp = new_tmp(); gen_helper_get_cp15(tmp, cpu_env, tmp2); if (rd != 15) store_reg(VAR_1, rd, tmp); else dead_tmp(tmp); } else { tmp = load_reg(VAR_1, rd); gen_helper_set_cp15(cpu_env, tmp2, tmp); dead_tmp(tmp); if (!arm_feature(VAR_0, ARM_FEATURE_XSCALE) || (VAR_2 & 0x0fff0fff) != 0x0e010f10) gen_lookup_tb(VAR_1); } tcg_temp_free_i32(tmp2); return 0; }
[ "static int FUNC_0(CPUState *VAR_0, DisasContext *VAR_1, uint32_t VAR_2)\n{", "uint32_t rd;", "TCGv tmp, tmp2;", "if (arm_feature(VAR_0, ARM_FEATURE_M))\nreturn 1;", "if ((VAR_2 & (1 << 25)) == 0) {", "if (VAR_2 & (1 << 20)) {", "return 1;", "}", "return 0;", "}", "if ((VAR_2 & (1 << 4)) == 0) {", "return 1;", "}", "if (IS_USER(VAR_1) && !cp15_user_ok(VAR_2)) {", "return 1;", "}", "if ((VAR_2 & 0x0fff0fff) == 0x0e070f90) {", "if (!arm_feature(VAR_0, ARM_FEATURE_V7)) {", "gen_set_pc_im(VAR_1->pc);", "VAR_1->is_jmp = DISAS_WFI;", "}", "return 0;", "}", "if ((VAR_2 & 0x0fff0fff) == 0x0e070f58) {", "if (!arm_feature(VAR_0, ARM_FEATURE_V6)) {", "gen_set_pc_im(VAR_1->pc);", "VAR_1->is_jmp = DISAS_WFI;", "return 0;", "}", "}", "rd = (VAR_2 >> 12) & 0xf;", "if (cp15_tls_load_store(VAR_0, VAR_1, VAR_2, rd))\nreturn 0;", "tmp2 = tcg_const_i32(VAR_2);", "if (VAR_2 & ARM_CP_RW_BIT) {", "tmp = new_tmp();", "gen_helper_get_cp15(tmp, cpu_env, tmp2);", "if (rd != 15)\nstore_reg(VAR_1, rd, tmp);", "else\ndead_tmp(tmp);", "} else {", "tmp = load_reg(VAR_1, rd);", "gen_helper_set_cp15(cpu_env, tmp2, tmp);", "dead_tmp(tmp);", "if (!arm_feature(VAR_0, ARM_FEATURE_XSCALE) ||\n(VAR_2 & 0x0fff0fff) != 0x0e010f10)\ngen_lookup_tb(VAR_1);", "}", "tcg_temp_free_i32(tmp2);", "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, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 13, 15 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 57 ], [ 65 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 89 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 109 ], [ 113 ], [ 117, 119 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 133, 135 ], [ 137, 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 155, 157, 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ] ]
13,981
static int asf_write_packet(AVFormatContext *s, AVPacket *pkt) { ASFContext *asf = s->priv_data; AVIOContext *pb = s->pb; ASFStream *stream; AVCodecContext *codec; uint32_t packet_number; int64_t pts; int start_sec; int flags = pkt->flags; int ret; uint64_t offset = avio_tell(pb); codec = s->streams[pkt->stream_index]->codec; stream = &asf->streams[pkt->stream_index]; if (codec->codec_type == AVMEDIA_TYPE_AUDIO) flags &= ~AV_PKT_FLAG_KEY; pts = (pkt->pts != AV_NOPTS_VALUE) ? pkt->pts : pkt->dts; av_assert0(pts != AV_NOPTS_VALUE); pts *= 10000; asf->duration = FFMAX(asf->duration, pts + pkt->duration * 10000); packet_number = asf->nb_packets; put_frame(s, stream, s->streams[pkt->stream_index], pkt->dts, pkt->data, pkt->size, flags); start_sec = (int)((PREROLL_TIME * 10000 + pts + ASF_INDEXED_INTERVAL - 1) / ASF_INDEXED_INTERVAL); /* check index */ if ((!asf->is_streamed) && (flags & AV_PKT_FLAG_KEY)) { uint16_t packet_count = asf->nb_packets - packet_number; ret = update_index(s, start_sec, packet_number, packet_count, offset); if (ret < 0) return ret; asf->end_sec = start_sec; return 0;
true
FFmpeg
7c0b84d89911b2035161f5ef51aafbfcc84aa9e2
static int asf_write_packet(AVFormatContext *s, AVPacket *pkt) { ASFContext *asf = s->priv_data; AVIOContext *pb = s->pb; ASFStream *stream; AVCodecContext *codec; uint32_t packet_number; int64_t pts; int start_sec; int flags = pkt->flags; int ret; uint64_t offset = avio_tell(pb); codec = s->streams[pkt->stream_index]->codec; stream = &asf->streams[pkt->stream_index]; if (codec->codec_type == AVMEDIA_TYPE_AUDIO) flags &= ~AV_PKT_FLAG_KEY; pts = (pkt->pts != AV_NOPTS_VALUE) ? pkt->pts : pkt->dts; av_assert0(pts != AV_NOPTS_VALUE); pts *= 10000; asf->duration = FFMAX(asf->duration, pts + pkt->duration * 10000); packet_number = asf->nb_packets; put_frame(s, stream, s->streams[pkt->stream_index], pkt->dts, pkt->data, pkt->size, flags); start_sec = (int)((PREROLL_TIME * 10000 + pts + ASF_INDEXED_INTERVAL - 1) / ASF_INDEXED_INTERVAL); if ((!asf->is_streamed) && (flags & AV_PKT_FLAG_KEY)) { uint16_t packet_count = asf->nb_packets - packet_number; ret = update_index(s, start_sec, packet_number, packet_count, offset); if (ret < 0) return ret; asf->end_sec = start_sec; return 0;
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1) { ASFContext *asf = VAR_0->priv_data; AVIOContext *pb = VAR_0->pb; ASFStream *stream; AVCodecContext *codec; uint32_t packet_number; int64_t pts; int VAR_2; int VAR_3 = VAR_1->VAR_3; int VAR_4; uint64_t offset = avio_tell(pb); codec = VAR_0->streams[VAR_1->stream_index]->codec; stream = &asf->streams[VAR_1->stream_index]; if (codec->codec_type == AVMEDIA_TYPE_AUDIO) VAR_3 &= ~AV_PKT_FLAG_KEY; pts = (VAR_1->pts != AV_NOPTS_VALUE) ? VAR_1->pts : VAR_1->dts; av_assert0(pts != AV_NOPTS_VALUE); pts *= 10000; asf->duration = FFMAX(asf->duration, pts + VAR_1->duration * 10000); packet_number = asf->nb_packets; put_frame(VAR_0, stream, VAR_0->streams[VAR_1->stream_index], VAR_1->dts, VAR_1->data, VAR_1->size, VAR_3); VAR_2 = (int)((PREROLL_TIME * 10000 + pts + ASF_INDEXED_INTERVAL - 1) / ASF_INDEXED_INTERVAL); if ((!asf->is_streamed) && (VAR_3 & AV_PKT_FLAG_KEY)) { uint16_t packet_count = asf->nb_packets - packet_number; VAR_4 = update_index(VAR_0, VAR_2, packet_number, packet_count, offset); if (VAR_4 < 0) return VAR_4; asf->end_sec = VAR_2; return 0;
[ "static int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1)\n{", "ASFContext *asf = VAR_0->priv_data;", "AVIOContext *pb = VAR_0->pb;", "ASFStream *stream;", "AVCodecContext *codec;", "uint32_t packet_number;", "int64_t pts;", "int VAR_2;", "int VAR_3 = VAR_1->VAR_3;", "int VAR_4;", "uint64_t offset = avio_tell(pb);", "codec = VAR_0->streams[VAR_1->stream_index]->codec;", "stream = &asf->streams[VAR_1->stream_index];", "if (codec->codec_type == AVMEDIA_TYPE_AUDIO)\nVAR_3 &= ~AV_PKT_FLAG_KEY;", "pts = (VAR_1->pts != AV_NOPTS_VALUE) ? VAR_1->pts : VAR_1->dts;", "av_assert0(pts != AV_NOPTS_VALUE);", "pts *= 10000;", "asf->duration = FFMAX(asf->duration, pts + VAR_1->duration * 10000);", "packet_number = asf->nb_packets;", "put_frame(VAR_0, stream, VAR_0->streams[VAR_1->stream_index],\nVAR_1->dts, VAR_1->data, VAR_1->size, VAR_3);", "VAR_2 = (int)((PREROLL_TIME * 10000 + pts + ASF_INDEXED_INTERVAL - 1)\n/ ASF_INDEXED_INTERVAL);", "if ((!asf->is_streamed) && (VAR_3 & AV_PKT_FLAG_KEY)) {", "uint16_t packet_count = asf->nb_packets - packet_number;", "VAR_4 = update_index(VAR_0, VAR_2, packet_number, packet_count, offset);", "if (VAR_4 < 0)\nreturn VAR_4;", "asf->end_sec = VAR_2;", "return 0;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 33, 35 ], [ 39 ], [ 41 ], [ 48 ], [ 50 ], [ 54 ], [ 56, 58 ], [ 62, 64 ], [ 70 ], [ 72 ], [ 74 ], [ 76, 78 ], [ 81 ], [ 85 ] ]
13,982
static void pl181_class_init(ObjectClass *klass, void *data) { SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass); DeviceClass *k = DEVICE_CLASS(klass); sdc->init = pl181_init; k->vmsd = &vmstate_pl181; k->reset = pl181_reset; k->no_user = 1; }
true
qemu
efec3dd631d94160288392721a5f9c39e50fb2bc
static void pl181_class_init(ObjectClass *klass, void *data) { SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass); DeviceClass *k = DEVICE_CLASS(klass); sdc->init = pl181_init; k->vmsd = &vmstate_pl181; k->reset = pl181_reset; k->no_user = 1; }
{ "code": [ " k->no_user = 1;" ], "line_no": [ 17 ] }
static void FUNC_0(ObjectClass *VAR_0, void *VAR_1) { SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(VAR_0); DeviceClass *k = DEVICE_CLASS(VAR_0); sdc->init = pl181_init; k->vmsd = &vmstate_pl181; k->reset = pl181_reset; k->no_user = 1; }
[ "static void FUNC_0(ObjectClass *VAR_0, void *VAR_1)\n{", "SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(VAR_0);", "DeviceClass *k = DEVICE_CLASS(VAR_0);", "sdc->init = pl181_init;", "k->vmsd = &vmstate_pl181;", "k->reset = pl181_reset;", "k->no_user = 1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ] ]
13,983
static void ahci_start_transfer(IDEDMA *dma) { AHCIDevice *ad = DO_UPCAST(AHCIDevice, dma, dma); IDEState *s = &ad->port.ifs[0]; uint32_t size = (uint32_t)(s->data_end - s->data_ptr); /* write == ram -> device */ uint16_t opts = le16_to_cpu(ad->cur_cmd->opts); int is_write = opts & AHCI_CMD_WRITE; int is_atapi = opts & AHCI_CMD_ATAPI; int has_sglist = 0; if (is_atapi && !ad->done_atapi_packet) { /* already prepopulated iobuffer */ ad->done_atapi_packet = true; size = 0; goto out; } if (ahci_dma_prepare_buf(dma, is_write)) { has_sglist = 1; } DPRINTF(ad->port_no, "%sing %d bytes on %s w/%s sglist\n", is_write ? "writ" : "read", size, is_atapi ? "atapi" : "ata", has_sglist ? "" : "o"); if (has_sglist && size) { if (is_write) { dma_buf_write(s->data_ptr, size, &s->sg); } else { dma_buf_read(s->data_ptr, size, &s->sg); } } out: /* declare that we processed everything */ s->data_ptr = s->data_end; /* Update number of transferred bytes, destroy sglist */ ahci_commit_buf(dma, size); s->end_transfer_func(s); if (!(s->status & DRQ_STAT)) { /* done with PIO send/receive */ ahci_write_fis_pio(ad, le32_to_cpu(ad->cur_cmd->status)); } }
true
qemu
a718978ed58abc1ad92567a9c17525136be02a71
static void ahci_start_transfer(IDEDMA *dma) { AHCIDevice *ad = DO_UPCAST(AHCIDevice, dma, dma); IDEState *s = &ad->port.ifs[0]; uint32_t size = (uint32_t)(s->data_end - s->data_ptr); uint16_t opts = le16_to_cpu(ad->cur_cmd->opts); int is_write = opts & AHCI_CMD_WRITE; int is_atapi = opts & AHCI_CMD_ATAPI; int has_sglist = 0; if (is_atapi && !ad->done_atapi_packet) { ad->done_atapi_packet = true; size = 0; goto out; } if (ahci_dma_prepare_buf(dma, is_write)) { has_sglist = 1; } DPRINTF(ad->port_no, "%sing %d bytes on %s w/%s sglist\n", is_write ? "writ" : "read", size, is_atapi ? "atapi" : "ata", has_sglist ? "" : "o"); if (has_sglist && size) { if (is_write) { dma_buf_write(s->data_ptr, size, &s->sg); } else { dma_buf_read(s->data_ptr, size, &s->sg); } } out: s->data_ptr = s->data_end; ahci_commit_buf(dma, size); s->end_transfer_func(s); if (!(s->status & DRQ_STAT)) { ahci_write_fis_pio(ad, le32_to_cpu(ad->cur_cmd->status)); } }
{ "code": [ " if (ahci_dma_prepare_buf(dma, is_write)) {" ], "line_no": [ 37 ] }
static void FUNC_0(IDEDMA *VAR_0) { AHCIDevice *ad = DO_UPCAST(AHCIDevice, VAR_0, VAR_0); IDEState *s = &ad->port.ifs[0]; uint32_t size = (uint32_t)(s->data_end - s->data_ptr); uint16_t opts = le16_to_cpu(ad->cur_cmd->opts); int VAR_1 = opts & AHCI_CMD_WRITE; int VAR_2 = opts & AHCI_CMD_ATAPI; int VAR_3 = 0; if (VAR_2 && !ad->done_atapi_packet) { ad->done_atapi_packet = true; size = 0; goto out; } if (ahci_dma_prepare_buf(VAR_0, VAR_1)) { VAR_3 = 1; } DPRINTF(ad->port_no, "%sing %d bytes on %s w/%s sglist\n", VAR_1 ? "writ" : "read", size, VAR_2 ? "atapi" : "ata", VAR_3 ? "" : "o"); if (VAR_3 && size) { if (VAR_1) { dma_buf_write(s->data_ptr, size, &s->sg); } else { dma_buf_read(s->data_ptr, size, &s->sg); } } out: s->data_ptr = s->data_end; ahci_commit_buf(VAR_0, size); s->end_transfer_func(s); if (!(s->status & DRQ_STAT)) { ahci_write_fis_pio(ad, le32_to_cpu(ad->cur_cmd->status)); } }
[ "static void FUNC_0(IDEDMA *VAR_0)\n{", "AHCIDevice *ad = DO_UPCAST(AHCIDevice, VAR_0, VAR_0);", "IDEState *s = &ad->port.ifs[0];", "uint32_t size = (uint32_t)(s->data_end - s->data_ptr);", "uint16_t opts = le16_to_cpu(ad->cur_cmd->opts);", "int VAR_1 = opts & AHCI_CMD_WRITE;", "int VAR_2 = opts & AHCI_CMD_ATAPI;", "int VAR_3 = 0;", "if (VAR_2 && !ad->done_atapi_packet) {", "ad->done_atapi_packet = true;", "size = 0;", "goto out;", "}", "if (ahci_dma_prepare_buf(VAR_0, VAR_1)) {", "VAR_3 = 1;", "}", "DPRINTF(ad->port_no, \"%sing %d bytes on %s w/%s sglist\\n\",\nVAR_1 ? \"writ\" : \"read\", size, VAR_2 ? \"atapi\" : \"ata\",\nVAR_3 ? \"\" : \"o\");", "if (VAR_3 && size) {", "if (VAR_1) {", "dma_buf_write(s->data_ptr, size, &s->sg);", "} else {", "dma_buf_read(s->data_ptr, size, &s->sg);", "}", "}", "out:\ns->data_ptr = s->data_end;", "ahci_commit_buf(VAR_0, size);", "s->end_transfer_func(s);", "if (!(s->status & DRQ_STAT)) {", "ahci_write_fis_pio(ad, le32_to_cpu(ad->cur_cmd->status));", "}", "}" ]
[ 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 45, 47, 49 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69, 73 ], [ 79 ], [ 83 ], [ 87 ], [ 91 ], [ 93 ], [ 95 ] ]
13,984
void bmdma_init(IDEBus *bus, BMDMAState *bm, PCIIDEState *d) { qemu_irq *irq; if (bus->dma == &bm->dma) { return; } bm->dma.ops = &bmdma_ops; bus->dma = &bm->dma; bm->irq = bus->irq; irq = qemu_allocate_irqs(bmdma_irq, bm, 1); bus->irq = *irq; bm->pci_dev = d; }
true
qemu
6e38a4ba7889083b65729db2144cdbcefbaa303a
void bmdma_init(IDEBus *bus, BMDMAState *bm, PCIIDEState *d) { qemu_irq *irq; if (bus->dma == &bm->dma) { return; } bm->dma.ops = &bmdma_ops; bus->dma = &bm->dma; bm->irq = bus->irq; irq = qemu_allocate_irqs(bmdma_irq, bm, 1); bus->irq = *irq; bm->pci_dev = d; }
{ "code": [ " qemu_irq *irq;", " irq = qemu_allocate_irqs(bmdma_irq, bm, 1);", " bus->irq = *irq;" ], "line_no": [ 5, 23, 25 ] }
void FUNC_0(IDEBus *VAR_0, BMDMAState *VAR_1, PCIIDEState *VAR_2) { qemu_irq *irq; if (VAR_0->dma == &VAR_1->dma) { return; } VAR_1->dma.ops = &bmdma_ops; VAR_0->dma = &VAR_1->dma; VAR_1->irq = VAR_0->irq; irq = qemu_allocate_irqs(bmdma_irq, VAR_1, 1); VAR_0->irq = *irq; VAR_1->pci_dev = VAR_2; }
[ "void FUNC_0(IDEBus *VAR_0, BMDMAState *VAR_1, PCIIDEState *VAR_2)\n{", "qemu_irq *irq;", "if (VAR_0->dma == &VAR_1->dma) {", "return;", "}", "VAR_1->dma.ops = &bmdma_ops;", "VAR_0->dma = &VAR_1->dma;", "VAR_1->irq = VAR_0->irq;", "irq = qemu_allocate_irqs(bmdma_irq, VAR_1, 1);", "VAR_0->irq = *irq;", "VAR_1->pci_dev = VAR_2;", "}" ]
[ 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ] ]
13,985
static void qemu_tcg_wait_io_event(void) { CPUState *env; while (all_cpu_threads_idle()) { /* Start accounting real time to the virtual clock if the CPUs are idle. */ qemu_clock_warp(vm_clock); qemu_cond_wait(tcg_halt_cond, &qemu_global_mutex); } qemu_mutex_unlock(&qemu_global_mutex); /* * Users of qemu_global_mutex can be starved, having no chance * to acquire it since this path will get to it first. * So use another lock to provide fairness. */ qemu_mutex_lock(&qemu_fair_mutex); qemu_mutex_unlock(&qemu_fair_mutex); qemu_mutex_lock(&qemu_global_mutex); for (env = first_cpu; env != NULL; env = env->next_cpu) { qemu_wait_io_event_common(env); } }
true
qemu
46daff13c854769bfa8c51e77719325ea0f47b1b
static void qemu_tcg_wait_io_event(void) { CPUState *env; while (all_cpu_threads_idle()) { qemu_clock_warp(vm_clock); qemu_cond_wait(tcg_halt_cond, &qemu_global_mutex); } qemu_mutex_unlock(&qemu_global_mutex); qemu_mutex_lock(&qemu_fair_mutex); qemu_mutex_unlock(&qemu_fair_mutex); qemu_mutex_lock(&qemu_global_mutex); for (env = first_cpu; env != NULL; env = env->next_cpu) { qemu_wait_io_event_common(env); } }
{ "code": [ " qemu_mutex_unlock(&qemu_global_mutex);", " qemu_mutex_lock(&qemu_fair_mutex);", " qemu_mutex_unlock(&qemu_fair_mutex);", " qemu_mutex_lock(&qemu_global_mutex);" ], "line_no": [ 23, 37, 39, 43 ] }
static void FUNC_0(void) { CPUState *env; while (all_cpu_threads_idle()) { qemu_clock_warp(vm_clock); qemu_cond_wait(tcg_halt_cond, &qemu_global_mutex); } qemu_mutex_unlock(&qemu_global_mutex); qemu_mutex_lock(&qemu_fair_mutex); qemu_mutex_unlock(&qemu_fair_mutex); qemu_mutex_lock(&qemu_global_mutex); for (env = first_cpu; env != NULL; env = env->next_cpu) { qemu_wait_io_event_common(env); } }
[ "static void FUNC_0(void)\n{", "CPUState *env;", "while (all_cpu_threads_idle()) {", "qemu_clock_warp(vm_clock);", "qemu_cond_wait(tcg_halt_cond, &qemu_global_mutex);", "}", "qemu_mutex_unlock(&qemu_global_mutex);", "qemu_mutex_lock(&qemu_fair_mutex);", "qemu_mutex_unlock(&qemu_fair_mutex);", "qemu_mutex_lock(&qemu_global_mutex);", "for (env = first_cpu; env != NULL; env = env->next_cpu) {", "qemu_wait_io_event_common(env);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 37 ], [ 39 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ] ]
13,986
void ff_mdct_calc_c(FFTContext *s, FFTSample *out, const FFTSample *input) { int i, j, n, n8, n4, n2, n3; FFTDouble re, im; const uint16_t *revtab = s->revtab; const FFTSample *tcos = s->tcos; const FFTSample *tsin = s->tsin; FFTComplex *x = (FFTComplex *)out; n = 1 << s->mdct_bits; n2 = n >> 1; n4 = n >> 2; n8 = n >> 3; n3 = 3 * n4; /* pre rotation */ for(i=0;i<n8;i++) { re = RSCALE(-input[2*i+n3] - input[n3-1-2*i]); im = RSCALE(-input[n4+2*i] + input[n4-1-2*i]); j = revtab[i]; CMUL(x[j].re, x[j].im, re, im, -tcos[i], tsin[i]); re = RSCALE( input[2*i] - input[n2-1-2*i]); im = RSCALE(-input[n2+2*i] - input[ n-1-2*i]); j = revtab[n8 + i]; CMUL(x[j].re, x[j].im, re, im, -tcos[n8 + i], tsin[n8 + i]); } s->fft_calc(s, x); /* post rotation */ for(i=0;i<n8;i++) { FFTSample r0, i0, r1, i1; CMUL(i1, r0, x[n8-i-1].re, x[n8-i-1].im, -tsin[n8-i-1], -tcos[n8-i-1]); CMUL(i0, r1, x[n8+i ].re, x[n8+i ].im, -tsin[n8+i ], -tcos[n8+i ]); x[n8-i-1].re = r0; x[n8-i-1].im = i0; x[n8+i ].re = r1; x[n8+i ].im = i1; } }
true
FFmpeg
770c934fa1635f4fadf5db4fc5cc5ad15d82455a
void ff_mdct_calc_c(FFTContext *s, FFTSample *out, const FFTSample *input) { int i, j, n, n8, n4, n2, n3; FFTDouble re, im; const uint16_t *revtab = s->revtab; const FFTSample *tcos = s->tcos; const FFTSample *tsin = s->tsin; FFTComplex *x = (FFTComplex *)out; n = 1 << s->mdct_bits; n2 = n >> 1; n4 = n >> 2; n8 = n >> 3; n3 = 3 * n4; for(i=0;i<n8;i++) { re = RSCALE(-input[2*i+n3] - input[n3-1-2*i]); im = RSCALE(-input[n4+2*i] + input[n4-1-2*i]); j = revtab[i]; CMUL(x[j].re, x[j].im, re, im, -tcos[i], tsin[i]); re = RSCALE( input[2*i] - input[n2-1-2*i]); im = RSCALE(-input[n2+2*i] - input[ n-1-2*i]); j = revtab[n8 + i]; CMUL(x[j].re, x[j].im, re, im, -tcos[n8 + i], tsin[n8 + i]); } s->fft_calc(s, x); for(i=0;i<n8;i++) { FFTSample r0, i0, r1, i1; CMUL(i1, r0, x[n8-i-1].re, x[n8-i-1].im, -tsin[n8-i-1], -tcos[n8-i-1]); CMUL(i0, r1, x[n8+i ].re, x[n8+i ].im, -tsin[n8+i ], -tcos[n8+i ]); x[n8-i-1].re = r0; x[n8-i-1].im = i0; x[n8+i ].re = r1; x[n8+i ].im = i1; } }
{ "code": [ " re = RSCALE(-input[2*i+n3] - input[n3-1-2*i]);", " im = RSCALE(-input[n4+2*i] + input[n4-1-2*i]);", " re = RSCALE( input[2*i] - input[n2-1-2*i]);", " im = RSCALE(-input[n2+2*i] - input[ n-1-2*i]);", " re = RSCALE(-input[2*i+n3] - input[n3-1-2*i]);", " im = RSCALE(-input[n4+2*i] + input[n4-1-2*i]);", " re = RSCALE( input[2*i] - input[n2-1-2*i]);", " im = RSCALE(-input[n2+2*i] - input[ n-1-2*i]);" ], "line_no": [ 35, 37, 45, 47, 35, 37, 45, 47 ] }
void FUNC_0(FFTContext *VAR_0, FFTSample *VAR_1, const FFTSample *VAR_2) { int VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9; FFTDouble re, im; const uint16_t *VAR_10 = VAR_0->VAR_10; const FFTSample *VAR_11 = VAR_0->VAR_11; const FFTSample *VAR_12 = VAR_0->VAR_12; FFTComplex *x = (FFTComplex *)VAR_1; VAR_5 = 1 << VAR_0->mdct_bits; VAR_8 = VAR_5 >> 1; VAR_7 = VAR_5 >> 2; VAR_6 = VAR_5 >> 3; VAR_9 = 3 * VAR_7; for(VAR_3=0;VAR_3<VAR_6;VAR_3++) { re = RSCALE(-VAR_2[2*VAR_3+VAR_9] - VAR_2[VAR_9-1-2*VAR_3]); im = RSCALE(-VAR_2[VAR_7+2*VAR_3] + VAR_2[VAR_7-1-2*VAR_3]); VAR_4 = VAR_10[VAR_3]; CMUL(x[VAR_4].re, x[VAR_4].im, re, im, -VAR_11[VAR_3], VAR_12[VAR_3]); re = RSCALE( VAR_2[2*VAR_3] - VAR_2[VAR_8-1-2*VAR_3]); im = RSCALE(-VAR_2[VAR_8+2*VAR_3] - VAR_2[ VAR_5-1-2*VAR_3]); VAR_4 = VAR_10[VAR_6 + VAR_3]; CMUL(x[VAR_4].re, x[VAR_4].im, re, im, -VAR_11[VAR_6 + VAR_3], VAR_12[VAR_6 + VAR_3]); } VAR_0->fft_calc(VAR_0, x); for(VAR_3=0;VAR_3<VAR_6;VAR_3++) { FFTSample r0, i0, r1, i1; CMUL(i1, r0, x[VAR_6-VAR_3-1].re, x[VAR_6-VAR_3-1].im, -VAR_12[VAR_6-VAR_3-1], -VAR_11[VAR_6-VAR_3-1]); CMUL(i0, r1, x[VAR_6+VAR_3 ].re, x[VAR_6+VAR_3 ].im, -VAR_12[VAR_6+VAR_3 ], -VAR_11[VAR_6+VAR_3 ]); x[VAR_6-VAR_3-1].re = r0; x[VAR_6-VAR_3-1].im = i0; x[VAR_6+VAR_3 ].re = r1; x[VAR_6+VAR_3 ].im = i1; } }
[ "void FUNC_0(FFTContext *VAR_0, FFTSample *VAR_1, const FFTSample *VAR_2)\n{", "int VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9;", "FFTDouble re, im;", "const uint16_t *VAR_10 = VAR_0->VAR_10;", "const FFTSample *VAR_11 = VAR_0->VAR_11;", "const FFTSample *VAR_12 = VAR_0->VAR_12;", "FFTComplex *x = (FFTComplex *)VAR_1;", "VAR_5 = 1 << VAR_0->mdct_bits;", "VAR_8 = VAR_5 >> 1;", "VAR_7 = VAR_5 >> 2;", "VAR_6 = VAR_5 >> 3;", "VAR_9 = 3 * VAR_7;", "for(VAR_3=0;VAR_3<VAR_6;VAR_3++) {", "re = RSCALE(-VAR_2[2*VAR_3+VAR_9] - VAR_2[VAR_9-1-2*VAR_3]);", "im = RSCALE(-VAR_2[VAR_7+2*VAR_3] + VAR_2[VAR_7-1-2*VAR_3]);", "VAR_4 = VAR_10[VAR_3];", "CMUL(x[VAR_4].re, x[VAR_4].im, re, im, -VAR_11[VAR_3], VAR_12[VAR_3]);", "re = RSCALE( VAR_2[2*VAR_3] - VAR_2[VAR_8-1-2*VAR_3]);", "im = RSCALE(-VAR_2[VAR_8+2*VAR_3] - VAR_2[ VAR_5-1-2*VAR_3]);", "VAR_4 = VAR_10[VAR_6 + VAR_3];", "CMUL(x[VAR_4].re, x[VAR_4].im, re, im, -VAR_11[VAR_6 + VAR_3], VAR_12[VAR_6 + VAR_3]);", "}", "VAR_0->fft_calc(VAR_0, x);", "for(VAR_3=0;VAR_3<VAR_6;VAR_3++) {", "FFTSample r0, i0, r1, i1;", "CMUL(i1, r0, x[VAR_6-VAR_3-1].re, x[VAR_6-VAR_3-1].im, -VAR_12[VAR_6-VAR_3-1], -VAR_11[VAR_6-VAR_3-1]);", "CMUL(i0, r1, x[VAR_6+VAR_3 ].re, x[VAR_6+VAR_3 ].im, -VAR_12[VAR_6+VAR_3 ], -VAR_11[VAR_6+VAR_3 ]);", "x[VAR_6-VAR_3-1].re = r0;", "x[VAR_6-VAR_3-1].im = i0;", "x[VAR_6+VAR_3 ].re = r1;", "x[VAR_6+VAR_3 ].im = i1;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 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 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ] ]
13,987
int bdrv_file_open(BlockDriverState **pbs, const char *filename, int flags) { BlockDriverState *bs; int ret; bs = bdrv_new(""); if (!bs) return -ENOMEM; ret = bdrv_open2(bs, filename, flags | BDRV_O_FILE, NULL); if (ret < 0) { bdrv_delete(bs); return ret; } *pbs = bs; return 0; }
true
qemu
71d0770c4cec9f1dc04f4dadcbf7fd6c335030a9
int bdrv_file_open(BlockDriverState **pbs, const char *filename, int flags) { BlockDriverState *bs; int ret; bs = bdrv_new(""); if (!bs) return -ENOMEM; ret = bdrv_open2(bs, filename, flags | BDRV_O_FILE, NULL); if (ret < 0) { bdrv_delete(bs); return ret; } *pbs = bs; return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(BlockDriverState **VAR_0, const char *VAR_1, int VAR_2) { BlockDriverState *bs; int VAR_3; bs = bdrv_new(""); if (!bs) return -ENOMEM; VAR_3 = bdrv_open2(bs, VAR_1, VAR_2 | BDRV_O_FILE, NULL); if (VAR_3 < 0) { bdrv_delete(bs); return VAR_3; } *VAR_0 = bs; return 0; }
[ "int FUNC_0(BlockDriverState **VAR_0, const char *VAR_1, int VAR_2)\n{", "BlockDriverState *bs;", "int VAR_3;", "bs = bdrv_new(\"\");", "if (!bs)\nreturn -ENOMEM;", "VAR_3 = bdrv_open2(bs, VAR_1, VAR_2 | BDRV_O_FILE, NULL);", "if (VAR_3 < 0) {", "bdrv_delete(bs);", "return VAR_3;", "}", "*VAR_0 = bs;", "return 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 ], [ 28 ], [ 30 ], [ 32 ] ]
13,989
static int sdp_parse_fmtp_config_h264(AVStream * stream, PayloadContext * h264_data, char *attr, char *value) { AVCodecContext *codec = stream->codec; assert(codec->codec_id == CODEC_ID_H264); assert(h264_data != NULL); if (!strcmp(attr, "packetization-mode")) { av_log(codec, AV_LOG_DEBUG, "RTP Packetization Mode: %d\n", atoi(value)); h264_data->packetization_mode = atoi(value); /* Packetization Mode: 0 or not present: Single NAL mode (Only nals from 1-23 are allowed) 1: Non-interleaved Mode: 1-23, 24 (STAP-A), 28 (FU-A) are allowed. 2: Interleaved Mode: 25 (STAP-B), 26 (MTAP16), 27 (MTAP24), 28 (FU-A), and 29 (FU-B) are allowed. */ if (h264_data->packetization_mode > 1) av_log(codec, AV_LOG_ERROR, "Interleaved RTP mode is not supported yet."); } else if (!strcmp(attr, "profile-level-id")) { if (strlen(value) == 6) { char buffer[3]; // 6 characters=3 bytes, in hex. uint8_t profile_idc; uint8_t profile_iop; uint8_t level_idc; buffer[0] = value[0]; buffer[1] = value[1]; buffer[2] = '\0'; profile_idc = strtol(buffer, NULL, 16); buffer[0] = value[2]; buffer[1] = value[3]; profile_iop = strtol(buffer, NULL, 16); buffer[0] = value[4]; buffer[1] = value[5]; level_idc = strtol(buffer, NULL, 16); // set the parameters... av_log(codec, AV_LOG_DEBUG, "RTP Profile IDC: %x Profile IOP: %x Level: %x\n", profile_idc, profile_iop, level_idc); h264_data->profile_idc = profile_idc; h264_data->profile_iop = profile_iop; h264_data->level_idc = level_idc; } } else if (!strcmp(attr, "sprop-parameter-sets")) { uint8_t start_sequence[]= { 0, 0, 1 }; codec->extradata_size= 0; codec->extradata= NULL; while (*value) { char base64packet[1024]; uint8_t decoded_packet[1024]; uint32_t packet_size; char *dst = base64packet; while (*value && *value != ',' && (dst - base64packet) < sizeof(base64packet) - 1) { *dst++ = *value++; } *dst++ = '\0'; if (*value == ',') value++; packet_size= av_base64_decode(decoded_packet, base64packet, sizeof(decoded_packet)); if (packet_size) { uint8_t *dest = av_malloc(packet_size + sizeof(start_sequence) + codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); if(dest) { if(codec->extradata_size) { // av_realloc? memcpy(dest, codec->extradata, codec->extradata_size); av_free(codec->extradata); } memcpy(dest+codec->extradata_size, start_sequence, sizeof(start_sequence)); memcpy(dest+codec->extradata_size+sizeof(start_sequence), decoded_packet, packet_size); memset(dest+codec->extradata_size+sizeof(start_sequence)+ packet_size, 0, FF_INPUT_BUFFER_PADDING_SIZE); codec->extradata= dest; codec->extradata_size+= sizeof(start_sequence)+packet_size; } else { av_log(codec, AV_LOG_ERROR, "Unable to allocate memory for extradata!"); return AVERROR(ENOMEM); } } } av_log(codec, AV_LOG_DEBUG, "Extradata set to %p (size: %d)!", codec->extradata, codec->extradata_size); } return 0; }
true
FFmpeg
dc6cf61e331557eb275a44d7a31df8e781bbb22b
static int sdp_parse_fmtp_config_h264(AVStream * stream, PayloadContext * h264_data, char *attr, char *value) { AVCodecContext *codec = stream->codec; assert(codec->codec_id == CODEC_ID_H264); assert(h264_data != NULL); if (!strcmp(attr, "packetization-mode")) { av_log(codec, AV_LOG_DEBUG, "RTP Packetization Mode: %d\n", atoi(value)); h264_data->packetization_mode = atoi(value); if (h264_data->packetization_mode > 1) av_log(codec, AV_LOG_ERROR, "Interleaved RTP mode is not supported yet."); } else if (!strcmp(attr, "profile-level-id")) { if (strlen(value) == 6) { char buffer[3]; uint8_t profile_idc; uint8_t profile_iop; uint8_t level_idc; buffer[0] = value[0]; buffer[1] = value[1]; buffer[2] = '\0'; profile_idc = strtol(buffer, NULL, 16); buffer[0] = value[2]; buffer[1] = value[3]; profile_iop = strtol(buffer, NULL, 16); buffer[0] = value[4]; buffer[1] = value[5]; level_idc = strtol(buffer, NULL, 16); av_log(codec, AV_LOG_DEBUG, "RTP Profile IDC: %x Profile IOP: %x Level: %x\n", profile_idc, profile_iop, level_idc); h264_data->profile_idc = profile_idc; h264_data->profile_iop = profile_iop; h264_data->level_idc = level_idc; } } else if (!strcmp(attr, "sprop-parameter-sets")) { uint8_t start_sequence[]= { 0, 0, 1 }; codec->extradata_size= 0; codec->extradata= NULL; while (*value) { char base64packet[1024]; uint8_t decoded_packet[1024]; uint32_t packet_size; char *dst = base64packet; while (*value && *value != ',' && (dst - base64packet) < sizeof(base64packet) - 1) { *dst++ = *value++; } *dst++ = '\0'; if (*value == ',') value++; packet_size= av_base64_decode(decoded_packet, base64packet, sizeof(decoded_packet)); if (packet_size) { uint8_t *dest = av_malloc(packet_size + sizeof(start_sequence) + codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); if(dest) { if(codec->extradata_size) { memcpy(dest, codec->extradata, codec->extradata_size); av_free(codec->extradata); } memcpy(dest+codec->extradata_size, start_sequence, sizeof(start_sequence)); memcpy(dest+codec->extradata_size+sizeof(start_sequence), decoded_packet, packet_size); memset(dest+codec->extradata_size+sizeof(start_sequence)+ packet_size, 0, FF_INPUT_BUFFER_PADDING_SIZE); codec->extradata= dest; codec->extradata_size+= sizeof(start_sequence)+packet_size; } else { av_log(codec, AV_LOG_ERROR, "Unable to allocate memory for extradata!"); return AVERROR(ENOMEM); } } } av_log(codec, AV_LOG_DEBUG, "Extradata set to %p (size: %d)!", codec->extradata, codec->extradata_size); } return 0; }
{ "code": [ " uint32_t packet_size;", " if (packet_size) {" ], "line_no": [ 103, 129 ] }
static int FUNC_0(AVStream * VAR_0, PayloadContext * VAR_1, char *VAR_2, char *VAR_3) { AVCodecContext *codec = VAR_0->codec; assert(codec->codec_id == CODEC_ID_H264); assert(VAR_1 != NULL); if (!strcmp(VAR_2, "packetization-mode")) { av_log(codec, AV_LOG_DEBUG, "RTP Packetization Mode: %d\n", atoi(VAR_3)); VAR_1->packetization_mode = atoi(VAR_3); if (VAR_1->packetization_mode > 1) av_log(codec, AV_LOG_ERROR, "Interleaved RTP mode is not supported yet."); } else if (!strcmp(VAR_2, "profile-level-id")) { if (strlen(VAR_3) == 6) { char VAR_4[3]; uint8_t profile_idc; uint8_t profile_iop; uint8_t level_idc; VAR_4[0] = VAR_3[0]; VAR_4[1] = VAR_3[1]; VAR_4[2] = '\0'; profile_idc = strtol(VAR_4, NULL, 16); VAR_4[0] = VAR_3[2]; VAR_4[1] = VAR_3[3]; profile_iop = strtol(VAR_4, NULL, 16); VAR_4[0] = VAR_3[4]; VAR_4[1] = VAR_3[5]; level_idc = strtol(VAR_4, NULL, 16); av_log(codec, AV_LOG_DEBUG, "RTP Profile IDC: %x Profile IOP: %x Level: %x\n", profile_idc, profile_iop, level_idc); VAR_1->profile_idc = profile_idc; VAR_1->profile_iop = profile_iop; VAR_1->level_idc = level_idc; } } else if (!strcmp(VAR_2, "sprop-parameter-sets")) { uint8_t start_sequence[]= { 0, 0, 1 }; codec->extradata_size= 0; codec->extradata= NULL; while (*VAR_3) { char VAR_5[1024]; uint8_t decoded_packet[1024]; uint32_t packet_size; char *VAR_6 = VAR_5; while (*VAR_3 && *VAR_3 != ',' && (VAR_6 - VAR_5) < sizeof(VAR_5) - 1) { *VAR_6++ = *VAR_3++; } *VAR_6++ = '\0'; if (*VAR_3 == ',') VAR_3++; packet_size= av_base64_decode(decoded_packet, VAR_5, sizeof(decoded_packet)); if (packet_size) { uint8_t *dest = av_malloc(packet_size + sizeof(start_sequence) + codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); if(dest) { if(codec->extradata_size) { memcpy(dest, codec->extradata, codec->extradata_size); av_free(codec->extradata); } memcpy(dest+codec->extradata_size, start_sequence, sizeof(start_sequence)); memcpy(dest+codec->extradata_size+sizeof(start_sequence), decoded_packet, packet_size); memset(dest+codec->extradata_size+sizeof(start_sequence)+ packet_size, 0, FF_INPUT_BUFFER_PADDING_SIZE); codec->extradata= dest; codec->extradata_size+= sizeof(start_sequence)+packet_size; } else { av_log(codec, AV_LOG_ERROR, "Unable to allocate memory for extradata!"); return AVERROR(ENOMEM); } } } av_log(codec, AV_LOG_DEBUG, "Extradata set to %p (size: %d)!", codec->extradata, codec->extradata_size); } return 0; }
[ "static int FUNC_0(AVStream * VAR_0,\nPayloadContext * VAR_1,\nchar *VAR_2, char *VAR_3)\n{", "AVCodecContext *codec = VAR_0->codec;", "assert(codec->codec_id == CODEC_ID_H264);", "assert(VAR_1 != NULL);", "if (!strcmp(VAR_2, \"packetization-mode\")) {", "av_log(codec, AV_LOG_DEBUG, \"RTP Packetization Mode: %d\\n\", atoi(VAR_3));", "VAR_1->packetization_mode = atoi(VAR_3);", "if (VAR_1->packetization_mode > 1)\nav_log(codec, AV_LOG_ERROR,\n\"Interleaved RTP mode is not supported yet.\");", "} else if (!strcmp(VAR_2, \"profile-level-id\")) {", "if (strlen(VAR_3) == 6) {", "char VAR_4[3];", "uint8_t profile_idc;", "uint8_t profile_iop;", "uint8_t level_idc;", "VAR_4[0] = VAR_3[0]; VAR_4[1] = VAR_3[1]; VAR_4[2] = '\\0';", "profile_idc = strtol(VAR_4, NULL, 16);", "VAR_4[0] = VAR_3[2]; VAR_4[1] = VAR_3[3];", "profile_iop = strtol(VAR_4, NULL, 16);", "VAR_4[0] = VAR_3[4]; VAR_4[1] = VAR_3[5];", "level_idc = strtol(VAR_4, NULL, 16);", "av_log(codec, AV_LOG_DEBUG,\n\"RTP Profile IDC: %x Profile IOP: %x Level: %x\\n\",\nprofile_idc, profile_iop, level_idc);", "VAR_1->profile_idc = profile_idc;", "VAR_1->profile_iop = profile_iop;", "VAR_1->level_idc = level_idc;", "}", "} else if (!strcmp(VAR_2, \"sprop-parameter-sets\")) {", "uint8_t start_sequence[]= { 0, 0, 1 };", "codec->extradata_size= 0;", "codec->extradata= NULL;", "while (*VAR_3) {", "char VAR_5[1024];", "uint8_t decoded_packet[1024];", "uint32_t packet_size;", "char *VAR_6 = VAR_5;", "while (*VAR_3 && *VAR_3 != ','\n&& (VAR_6 - VAR_5) < sizeof(VAR_5) - 1) {", "*VAR_6++ = *VAR_3++;", "}", "*VAR_6++ = '\\0';", "if (*VAR_3 == ',')\nVAR_3++;", "packet_size= av_base64_decode(decoded_packet, VAR_5, sizeof(decoded_packet));", "if (packet_size) {", "uint8_t *dest = av_malloc(packet_size + sizeof(start_sequence) +\ncodec->extradata_size +\nFF_INPUT_BUFFER_PADDING_SIZE);", "if(dest)\n{", "if(codec->extradata_size)\n{", "memcpy(dest, codec->extradata, codec->extradata_size);", "av_free(codec->extradata);", "}", "memcpy(dest+codec->extradata_size, start_sequence, sizeof(start_sequence));", "memcpy(dest+codec->extradata_size+sizeof(start_sequence), decoded_packet, packet_size);", "memset(dest+codec->extradata_size+sizeof(start_sequence)+\npacket_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);", "codec->extradata= dest;", "codec->extradata_size+= sizeof(start_sequence)+packet_size;", "} else {", "av_log(codec, AV_LOG_ERROR, \"Unable to allocate memory for extradata!\");", "return AVERROR(ENOMEM);", "}", "}", "}", "av_log(codec, AV_LOG_DEBUG, \"Extradata set to %p (size: %d)!\", codec->extradata, codec->extradata_size);", "}", "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, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 35, 37, 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 73, 75, 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 109, 111 ], [ 113 ], [ 115 ], [ 117 ], [ 121, 123 ], [ 127 ], [ 129 ], [ 131, 133, 135 ], [ 137, 139 ], [ 141, 143 ], [ 147 ], [ 149 ], [ 151 ], [ 155 ], [ 157 ], [ 159, 161 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ] ]
13,990
void qpci_io_writeq(QPCIDevice *dev, void *data, uint64_t value) { uintptr_t addr = (uintptr_t)data; if (addr < QPCI_PIO_LIMIT) { dev->bus->pio_writeq(dev->bus, addr, value); } else { value = cpu_to_le64(value); dev->bus->memwrite(dev->bus, addr, &value, sizeof(value)); } }
true
qemu
b4ba67d9a702507793c2724e56f98e9b0f7be02b
void qpci_io_writeq(QPCIDevice *dev, void *data, uint64_t value) { uintptr_t addr = (uintptr_t)data; if (addr < QPCI_PIO_LIMIT) { dev->bus->pio_writeq(dev->bus, addr, value); } else { value = cpu_to_le64(value); dev->bus->memwrite(dev->bus, addr, &value, sizeof(value)); } }
{ "code": [ " uintptr_t addr = (uintptr_t)data;", " if (addr < QPCI_PIO_LIMIT) {", " uintptr_t addr = (uintptr_t)data;", " if (addr < QPCI_PIO_LIMIT) {", " uintptr_t addr = (uintptr_t)data;", " if (addr < QPCI_PIO_LIMIT) {", " uintptr_t addr = (uintptr_t)data;", " if (addr < QPCI_PIO_LIMIT) {", " uintptr_t addr = (uintptr_t)data;", " if (addr < QPCI_PIO_LIMIT) {", " dev->bus->memwrite(dev->bus, addr, &value, sizeof(value));", " uintptr_t addr = (uintptr_t)data;", " if (addr < QPCI_PIO_LIMIT) {", " dev->bus->memwrite(dev->bus, addr, &value, sizeof(value));", " uintptr_t addr = (uintptr_t)data;", " if (addr < QPCI_PIO_LIMIT) {", " dev->bus->memwrite(dev->bus, addr, &value, sizeof(value));", "void qpci_io_writeq(QPCIDevice *dev, void *data, uint64_t value)", " uintptr_t addr = (uintptr_t)data;", " if (addr < QPCI_PIO_LIMIT) {", " dev->bus->pio_writeq(dev->bus, addr, value);", " dev->bus->memwrite(dev->bus, addr, &value, sizeof(value));", " uintptr_t addr = (uintptr_t)data;", " uintptr_t addr = (uintptr_t)data;" ], "line_no": [ 5, 9, 5, 9, 5, 9, 5, 9, 5, 9, 17, 5, 9, 17, 5, 9, 17, 1, 5, 9, 11, 17, 5, 5 ] }
void FUNC_0(QPCIDevice *VAR_0, void *VAR_1, uint64_t VAR_2) { uintptr_t addr = (uintptr_t)VAR_1; if (addr < QPCI_PIO_LIMIT) { VAR_0->bus->pio_writeq(VAR_0->bus, addr, VAR_2); } else { VAR_2 = cpu_to_le64(VAR_2); VAR_0->bus->memwrite(VAR_0->bus, addr, &VAR_2, sizeof(VAR_2)); } }
[ "void FUNC_0(QPCIDevice *VAR_0, void *VAR_1, uint64_t VAR_2)\n{", "uintptr_t addr = (uintptr_t)VAR_1;", "if (addr < QPCI_PIO_LIMIT) {", "VAR_0->bus->pio_writeq(VAR_0->bus, addr, VAR_2);", "} else {", "VAR_2 = cpu_to_le64(VAR_2);", "VAR_0->bus->memwrite(VAR_0->bus, addr, &VAR_2, sizeof(VAR_2));", "}", "}" ]
[ 1, 1, 1, 1, 0, 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
13,991
static abi_long do_sendto(int fd, abi_ulong msg, size_t len, int flags, abi_ulong target_addr, socklen_t addrlen) { void *addr; void *host_msg; abi_long ret; if ((int)addrlen < 0) { return -TARGET_EINVAL; } host_msg = lock_user(VERIFY_READ, msg, len, 1); if (!host_msg) return -TARGET_EFAULT; if (fd_trans_target_to_host_data(fd)) { ret = fd_trans_target_to_host_data(fd)(host_msg, len); if (ret < 0) { unlock_user(host_msg, msg, 0); return ret; } } if (target_addr) { addr = alloca(addrlen+1); ret = target_to_host_sockaddr(fd, addr, target_addr, addrlen); if (ret) { unlock_user(host_msg, msg, 0); return ret; } ret = get_errno(safe_sendto(fd, host_msg, len, flags, addr, addrlen)); } else { ret = get_errno(safe_sendto(fd, host_msg, len, flags, NULL, 0)); } unlock_user(host_msg, msg, 0); return ret; }
true
qemu
7d61d892327d803ae43d14500601e48031b4632c
static abi_long do_sendto(int fd, abi_ulong msg, size_t len, int flags, abi_ulong target_addr, socklen_t addrlen) { void *addr; void *host_msg; abi_long ret; if ((int)addrlen < 0) { return -TARGET_EINVAL; } host_msg = lock_user(VERIFY_READ, msg, len, 1); if (!host_msg) return -TARGET_EFAULT; if (fd_trans_target_to_host_data(fd)) { ret = fd_trans_target_to_host_data(fd)(host_msg, len); if (ret < 0) { unlock_user(host_msg, msg, 0); return ret; } } if (target_addr) { addr = alloca(addrlen+1); ret = target_to_host_sockaddr(fd, addr, target_addr, addrlen); if (ret) { unlock_user(host_msg, msg, 0); return ret; } ret = get_errno(safe_sendto(fd, host_msg, len, flags, addr, addrlen)); } else { ret = get_errno(safe_sendto(fd, host_msg, len, flags, NULL, 0)); } unlock_user(host_msg, msg, 0); return ret; }
{ "code": [ " unlock_user(host_msg, msg, 0);", " return ret;", " unlock_user(host_msg, msg, 0);", " return ret;" ], "line_no": [ 35, 37, 35, 37 ] }
static abi_long FUNC_0(int fd, abi_ulong msg, size_t len, int flags, abi_ulong target_addr, socklen_t addrlen) { void *VAR_0; void *VAR_1; abi_long ret; if ((int)addrlen < 0) { return -TARGET_EINVAL; } VAR_1 = lock_user(VERIFY_READ, msg, len, 1); if (!VAR_1) return -TARGET_EFAULT; if (fd_trans_target_to_host_data(fd)) { ret = fd_trans_target_to_host_data(fd)(VAR_1, len); if (ret < 0) { unlock_user(VAR_1, msg, 0); return ret; } } if (target_addr) { VAR_0 = alloca(addrlen+1); ret = target_to_host_sockaddr(fd, VAR_0, target_addr, addrlen); if (ret) { unlock_user(VAR_1, msg, 0); return ret; } ret = get_errno(safe_sendto(fd, VAR_1, len, flags, VAR_0, addrlen)); } else { ret = get_errno(safe_sendto(fd, VAR_1, len, flags, NULL, 0)); } unlock_user(VAR_1, msg, 0); return ret; }
[ "static abi_long FUNC_0(int fd, abi_ulong msg, size_t len, int flags,\nabi_ulong target_addr, socklen_t addrlen)\n{", "void *VAR_0;", "void *VAR_1;", "abi_long ret;", "if ((int)addrlen < 0) {", "return -TARGET_EINVAL;", "}", "VAR_1 = lock_user(VERIFY_READ, msg, len, 1);", "if (!VAR_1)\nreturn -TARGET_EFAULT;", "if (fd_trans_target_to_host_data(fd)) {", "ret = fd_trans_target_to_host_data(fd)(VAR_1, len);", "if (ret < 0) {", "unlock_user(VAR_1, msg, 0);", "return ret;", "}", "}", "if (target_addr) {", "VAR_0 = alloca(addrlen+1);", "ret = target_to_host_sockaddr(fd, VAR_0, target_addr, addrlen);", "if (ret) {", "unlock_user(VAR_1, msg, 0);", "return ret;", "}", "ret = get_errno(safe_sendto(fd, VAR_1, len, flags, VAR_0, addrlen));", "} else {", "ret = get_errno(safe_sendto(fd, VAR_1, len, flags, NULL, 0));", "}", "unlock_user(VAR_1, msg, 0);", "return ret;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ] ]
13,992
static int vscsi_srp_direct_data(VSCSIState *s, vscsi_req *req, uint8_t *buf, uint32_t len) { struct srp_direct_buf *md = req->cur_desc; uint32_t llen; int rc; dprintf("VSCSI: direct segment 0x%x bytes, va=0x%llx desc len=0x%x\n", len, (unsigned long long)md->va, md->len); llen = MIN(len, md->len); if (llen) { if (req->writing) { /* writing = to device = reading from memory */ rc = spapr_tce_dma_read(&s->vdev, md->va, buf, llen); } else { rc = spapr_tce_dma_write(&s->vdev, md->va, buf, llen); } } md->len -= llen; md->va += llen; if (rc) { return -1; } return llen; }
true
qemu
8804f57b531e4887ad9521c9abb9e0bbbcb1dd4e
static int vscsi_srp_direct_data(VSCSIState *s, vscsi_req *req, uint8_t *buf, uint32_t len) { struct srp_direct_buf *md = req->cur_desc; uint32_t llen; int rc; dprintf("VSCSI: direct segment 0x%x bytes, va=0x%llx desc len=0x%x\n", len, (unsigned long long)md->va, md->len); llen = MIN(len, md->len); if (llen) { if (req->writing) { rc = spapr_tce_dma_read(&s->vdev, md->va, buf, llen); } else { rc = spapr_tce_dma_write(&s->vdev, md->va, buf, llen); } } md->len -= llen; md->va += llen; if (rc) { return -1; } return llen; }
{ "code": [ " int rc;" ], "line_no": [ 11 ] }
static int FUNC_0(VSCSIState *VAR_0, vscsi_req *VAR_1, uint8_t *VAR_2, uint32_t VAR_3) { struct srp_direct_buf *VAR_4 = VAR_1->cur_desc; uint32_t llen; int VAR_5; dprintf("VSCSI: direct segment 0x%x bytes, va=0x%llx desc VAR_3=0x%x\n", VAR_3, (unsigned long long)VAR_4->va, VAR_4->VAR_3); llen = MIN(VAR_3, VAR_4->VAR_3); if (llen) { if (VAR_1->writing) { VAR_5 = spapr_tce_dma_read(&VAR_0->vdev, VAR_4->va, VAR_2, llen); } else { VAR_5 = spapr_tce_dma_write(&VAR_0->vdev, VAR_4->va, VAR_2, llen); } } VAR_4->VAR_3 -= llen; VAR_4->va += llen; if (VAR_5) { return -1; } return llen; }
[ "static int FUNC_0(VSCSIState *VAR_0, vscsi_req *VAR_1,\nuint8_t *VAR_2, uint32_t VAR_3)\n{", "struct srp_direct_buf *VAR_4 = VAR_1->cur_desc;", "uint32_t llen;", "int VAR_5;", "dprintf(\"VSCSI: direct segment 0x%x bytes, va=0x%llx desc VAR_3=0x%x\\n\",\nVAR_3, (unsigned long long)VAR_4->va, VAR_4->VAR_3);", "llen = MIN(VAR_3, VAR_4->VAR_3);", "if (llen) {", "if (VAR_1->writing) {", "VAR_5 = spapr_tce_dma_read(&VAR_0->vdev, VAR_4->va, VAR_2, llen);", "} else {", "VAR_5 = spapr_tce_dma_write(&VAR_0->vdev, VAR_4->va, VAR_2, llen);", "}", "}", "VAR_4->VAR_3 -= llen;", "VAR_4->va += llen;", "if (VAR_5) {", "return -1;", "}", "return llen;", "}" ]
[ 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 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ] ]
13,993
static inline void flash_sync_area(Flash *s, int64_t off, int64_t len) { QEMUIOVector *iov = g_new(QEMUIOVector, 1); if (!s->blk || blk_is_read_only(s->blk)) { return; } assert(!(len % BDRV_SECTOR_SIZE)); qemu_iovec_init(iov, 1); qemu_iovec_add(iov, s->storage + off, len); blk_aio_pwritev(s->blk, off, iov, 0, blk_sync_complete, iov); }
true
qemu
eef9f19eea26cd8b4553459118f87d7150b53c5a
static inline void flash_sync_area(Flash *s, int64_t off, int64_t len) { QEMUIOVector *iov = g_new(QEMUIOVector, 1); if (!s->blk || blk_is_read_only(s->blk)) { return; } assert(!(len % BDRV_SECTOR_SIZE)); qemu_iovec_init(iov, 1); qemu_iovec_add(iov, s->storage + off, len); blk_aio_pwritev(s->blk, off, iov, 0, blk_sync_complete, iov); }
{ "code": [ " QEMUIOVector *iov = g_new(QEMUIOVector, 1);", " QEMUIOVector *iov = g_new(QEMUIOVector, 1);" ], "line_no": [ 5, 5 ] }
static inline void FUNC_0(Flash *VAR_0, int64_t VAR_1, int64_t VAR_2) { QEMUIOVector *iov = g_new(QEMUIOVector, 1); if (!VAR_0->blk || blk_is_read_only(VAR_0->blk)) { return; } assert(!(VAR_2 % BDRV_SECTOR_SIZE)); qemu_iovec_init(iov, 1); qemu_iovec_add(iov, VAR_0->storage + VAR_1, VAR_2); blk_aio_pwritev(VAR_0->blk, VAR_1, iov, 0, blk_sync_complete, iov); }
[ "static inline void FUNC_0(Flash *VAR_0, int64_t VAR_1, int64_t VAR_2)\n{", "QEMUIOVector *iov = g_new(QEMUIOVector, 1);", "if (!VAR_0->blk || blk_is_read_only(VAR_0->blk)) {", "return;", "}", "assert(!(VAR_2 % BDRV_SECTOR_SIZE));", "qemu_iovec_init(iov, 1);", "qemu_iovec_add(iov, VAR_0->storage + VAR_1, VAR_2);", "blk_aio_pwritev(VAR_0->blk, VAR_1, iov, 0, blk_sync_complete, iov);", "}" ]
[ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ] ]
13,994
static void gdb_vm_stopped(void *opaque, int reason) { GDBState *s = opaque; char buf[256]; int ret; if (s->state == RS_SYSCALL) /* disable single step if it was enable */ cpu_single_step(s->env, 0); if (reason == EXCP_DEBUG) { tb_flush(s->env); ret = SIGTRAP; } else if (reason == EXCP_INTERRUPT) { ret = SIGINT; } else { ret = 0; snprintf(buf, sizeof(buf), "S%02x", ret);
true
qemu
6658ffb81ee56a510d7d77025872a508a9adce3a
static void gdb_vm_stopped(void *opaque, int reason) { GDBState *s = opaque; char buf[256]; int ret; if (s->state == RS_SYSCALL) cpu_single_step(s->env, 0); if (reason == EXCP_DEBUG) { tb_flush(s->env); ret = SIGTRAP; } else if (reason == EXCP_INTERRUPT) { ret = SIGINT; } else { ret = 0; snprintf(buf, sizeof(buf), "S%02x", ret);
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, int VAR_1) { GDBState *s = VAR_0; char VAR_2[256]; int VAR_3; if (s->state == RS_SYSCALL) cpu_single_step(s->env, 0); if (VAR_1 == EXCP_DEBUG) { tb_flush(s->env); VAR_3 = SIGTRAP; } else if (VAR_1 == EXCP_INTERRUPT) { VAR_3 = SIGINT; } else { VAR_3 = 0; snprintf(VAR_2, sizeof(VAR_2), "S%02x", VAR_3);
[ "static void FUNC_0(void *VAR_0, int VAR_1)\n{", "GDBState *s = VAR_0;", "char VAR_2[256];", "int VAR_3;", "if (s->state == RS_SYSCALL)\ncpu_single_step(s->env, 0);", "if (VAR_1 == EXCP_DEBUG) {", "tb_flush(s->env);", "VAR_3 = SIGTRAP;", "} else if (VAR_1 == EXCP_INTERRUPT) {", "VAR_3 = SIGINT;", "} else {", "VAR_3 = 0;", "snprintf(VAR_2, sizeof(VAR_2), \"S%02x\", VAR_3);" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13, 20 ], [ 24 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 46 ] ]
13,995
void main_loop_wait(int timeout) { IOHandlerRecord *ioh; fd_set rfds, wfds, xfds; int ret, nfds; #ifdef _WIN32 int ret2, i; #endif struct timeval tv; PollingEntry *pe; /* XXX: need to suppress polling by better using win32 events */ ret = 0; for(pe = first_polling_entry; pe != NULL; pe = pe->next) { ret |= pe->func(pe->opaque); } #ifdef _WIN32 if (ret == 0) { int err; WaitObjects *w = &wait_objects; ret = WaitForMultipleObjects(w->num, w->events, FALSE, timeout); if (WAIT_OBJECT_0 + 0 <= ret && ret <= WAIT_OBJECT_0 + w->num - 1) { if (w->func[ret - WAIT_OBJECT_0]) w->func[ret - WAIT_OBJECT_0](w->opaque[ret - WAIT_OBJECT_0]); /* Check for additional signaled events */ for(i = (ret - WAIT_OBJECT_0 + 1); i < w->num; i++) { /* Check if event is signaled */ ret2 = WaitForSingleObject(w->events[i], 0); if(ret2 == WAIT_OBJECT_0) { if (w->func[i]) w->func[i](w->opaque[i]); } else if (ret2 == WAIT_TIMEOUT) { } else { err = GetLastError(); fprintf(stderr, "WaitForSingleObject error %d %d\n", i, err); } } } else if (ret == WAIT_TIMEOUT) { } else { err = GetLastError(); fprintf(stderr, "WaitForMultipleObjects error %d %d\n", ret, err); } } #endif /* poll any events */ /* XXX: separate device handlers from system ones */ nfds = -1; FD_ZERO(&rfds); FD_ZERO(&wfds); FD_ZERO(&xfds); for(ioh = first_io_handler; ioh != NULL; ioh = ioh->next) { if (ioh->deleted) continue; if (ioh->fd_read && (!ioh->fd_read_poll || ioh->fd_read_poll(ioh->opaque) != 0)) { FD_SET(ioh->fd, &rfds); if (ioh->fd > nfds) nfds = ioh->fd; } if (ioh->fd_write) { FD_SET(ioh->fd, &wfds); if (ioh->fd > nfds) nfds = ioh->fd; } } tv.tv_sec = 0; #ifdef _WIN32 tv.tv_usec = 0; #else tv.tv_usec = timeout * 1000; #endif #if defined(CONFIG_SLIRP) if (slirp_inited) { slirp_select_fill(&nfds, &rfds, &wfds, &xfds); } #endif ret = select(nfds + 1, &rfds, &wfds, &xfds, &tv); if (ret > 0) { IOHandlerRecord **pioh; for(ioh = first_io_handler; ioh != NULL; ioh = ioh->next) { if (!ioh->deleted && ioh->fd_read && FD_ISSET(ioh->fd, &rfds)) { ioh->fd_read(ioh->opaque); } if (!ioh->deleted && ioh->fd_write && FD_ISSET(ioh->fd, &wfds)) { ioh->fd_write(ioh->opaque); } } /* remove deleted IO handlers */ pioh = &first_io_handler; while (*pioh) { ioh = *pioh; if (ioh->deleted) { *pioh = ioh->next; qemu_free(ioh); } else pioh = &ioh->next; } } #if defined(CONFIG_SLIRP) if (slirp_inited) { if (ret < 0) { FD_ZERO(&rfds); FD_ZERO(&wfds); FD_ZERO(&xfds); } slirp_select_poll(&rfds, &wfds, &xfds); } #endif qemu_aio_poll(); if (vm_running) { if (likely(!(cur_cpu->singlestep_enabled & SSTEP_NOTIMER))) qemu_run_timers(&active_timers[QEMU_TIMER_VIRTUAL], qemu_get_clock(vm_clock)); /* run dma transfers, if any */ DMA_run(); } /* real time timers */ qemu_run_timers(&active_timers[QEMU_TIMER_REALTIME], qemu_get_clock(rt_clock)); if (alarm_timer->flags & ALARM_FLAG_EXPIRED) { alarm_timer->flags &= ~(ALARM_FLAG_EXPIRED); qemu_rearm_alarm_timer(alarm_timer); } /* Check bottom-halves last in case any of the earlier events triggered them. */ qemu_bh_poll(); }
true
qemu
baf35cb90204d75404892aa4e52628ae7a00669b
void main_loop_wait(int timeout) { IOHandlerRecord *ioh; fd_set rfds, wfds, xfds; int ret, nfds; #ifdef _WIN32 int ret2, i; #endif struct timeval tv; PollingEntry *pe; ret = 0; for(pe = first_polling_entry; pe != NULL; pe = pe->next) { ret |= pe->func(pe->opaque); } #ifdef _WIN32 if (ret == 0) { int err; WaitObjects *w = &wait_objects; ret = WaitForMultipleObjects(w->num, w->events, FALSE, timeout); if (WAIT_OBJECT_0 + 0 <= ret && ret <= WAIT_OBJECT_0 + w->num - 1) { if (w->func[ret - WAIT_OBJECT_0]) w->func[ret - WAIT_OBJECT_0](w->opaque[ret - WAIT_OBJECT_0]); for(i = (ret - WAIT_OBJECT_0 + 1); i < w->num; i++) { ret2 = WaitForSingleObject(w->events[i], 0); if(ret2 == WAIT_OBJECT_0) { if (w->func[i]) w->func[i](w->opaque[i]); } else if (ret2 == WAIT_TIMEOUT) { } else { err = GetLastError(); fprintf(stderr, "WaitForSingleObject error %d %d\n", i, err); } } } else if (ret == WAIT_TIMEOUT) { } else { err = GetLastError(); fprintf(stderr, "WaitForMultipleObjects error %d %d\n", ret, err); } } #endif nfds = -1; FD_ZERO(&rfds); FD_ZERO(&wfds); FD_ZERO(&xfds); for(ioh = first_io_handler; ioh != NULL; ioh = ioh->next) { if (ioh->deleted) continue; if (ioh->fd_read && (!ioh->fd_read_poll || ioh->fd_read_poll(ioh->opaque) != 0)) { FD_SET(ioh->fd, &rfds); if (ioh->fd > nfds) nfds = ioh->fd; } if (ioh->fd_write) { FD_SET(ioh->fd, &wfds); if (ioh->fd > nfds) nfds = ioh->fd; } } tv.tv_sec = 0; #ifdef _WIN32 tv.tv_usec = 0; #else tv.tv_usec = timeout * 1000; #endif #if defined(CONFIG_SLIRP) if (slirp_inited) { slirp_select_fill(&nfds, &rfds, &wfds, &xfds); } #endif ret = select(nfds + 1, &rfds, &wfds, &xfds, &tv); if (ret > 0) { IOHandlerRecord **pioh; for(ioh = first_io_handler; ioh != NULL; ioh = ioh->next) { if (!ioh->deleted && ioh->fd_read && FD_ISSET(ioh->fd, &rfds)) { ioh->fd_read(ioh->opaque); } if (!ioh->deleted && ioh->fd_write && FD_ISSET(ioh->fd, &wfds)) { ioh->fd_write(ioh->opaque); } } pioh = &first_io_handler; while (*pioh) { ioh = *pioh; if (ioh->deleted) { *pioh = ioh->next; qemu_free(ioh); } else pioh = &ioh->next; } } #if defined(CONFIG_SLIRP) if (slirp_inited) { if (ret < 0) { FD_ZERO(&rfds); FD_ZERO(&wfds); FD_ZERO(&xfds); } slirp_select_poll(&rfds, &wfds, &xfds); } #endif qemu_aio_poll(); if (vm_running) { if (likely(!(cur_cpu->singlestep_enabled & SSTEP_NOTIMER))) qemu_run_timers(&active_timers[QEMU_TIMER_VIRTUAL], qemu_get_clock(vm_clock)); DMA_run(); } qemu_run_timers(&active_timers[QEMU_TIMER_REALTIME], qemu_get_clock(rt_clock)); if (alarm_timer->flags & ALARM_FLAG_EXPIRED) { alarm_timer->flags &= ~(ALARM_FLAG_EXPIRED); qemu_rearm_alarm_timer(alarm_timer); } qemu_bh_poll(); }
{ "code": [ "#endif", "#endif", "#endif", " qemu_aio_poll();", " qemu_aio_poll();", " qemu_aio_poll();" ], "line_no": [ 15, 15, 15, 233, 233, 233 ] }
void FUNC_0(int VAR_0) { IOHandlerRecord *ioh; fd_set rfds, wfds, xfds; int VAR_1, VAR_2; #ifdef _WIN32 int ret2, i; #endif struct timeval VAR_3; PollingEntry *pe; VAR_1 = 0; for(pe = first_polling_entry; pe != NULL; pe = pe->next) { VAR_1 |= pe->func(pe->opaque); } #ifdef _WIN32 if (VAR_1 == 0) { int err; WaitObjects *w = &wait_objects; VAR_1 = WaitForMultipleObjects(w->num, w->events, FALSE, VAR_0); if (WAIT_OBJECT_0 + 0 <= VAR_1 && VAR_1 <= WAIT_OBJECT_0 + w->num - 1) { if (w->func[VAR_1 - WAIT_OBJECT_0]) w->func[VAR_1 - WAIT_OBJECT_0](w->opaque[VAR_1 - WAIT_OBJECT_0]); for(i = (VAR_1 - WAIT_OBJECT_0 + 1); i < w->num; i++) { ret2 = WaitForSingleObject(w->events[i], 0); if(ret2 == WAIT_OBJECT_0) { if (w->func[i]) w->func[i](w->opaque[i]); } else if (ret2 == WAIT_TIMEOUT) { } else { err = GetLastError(); fprintf(stderr, "WaitForSingleObject error %d %d\n", i, err); } } } else if (VAR_1 == WAIT_TIMEOUT) { } else { err = GetLastError(); fprintf(stderr, "WaitForMultipleObjects error %d %d\n", VAR_1, err); } } #endif VAR_2 = -1; FD_ZERO(&rfds); FD_ZERO(&wfds); FD_ZERO(&xfds); for(ioh = first_io_handler; ioh != NULL; ioh = ioh->next) { if (ioh->deleted) continue; if (ioh->fd_read && (!ioh->fd_read_poll || ioh->fd_read_poll(ioh->opaque) != 0)) { FD_SET(ioh->fd, &rfds); if (ioh->fd > VAR_2) VAR_2 = ioh->fd; } if (ioh->fd_write) { FD_SET(ioh->fd, &wfds); if (ioh->fd > VAR_2) VAR_2 = ioh->fd; } } VAR_3.tv_sec = 0; #ifdef _WIN32 VAR_3.tv_usec = 0; #else VAR_3.tv_usec = VAR_0 * 1000; #endif #if defined(CONFIG_SLIRP) if (slirp_inited) { slirp_select_fill(&VAR_2, &rfds, &wfds, &xfds); } #endif VAR_1 = select(VAR_2 + 1, &rfds, &wfds, &xfds, &VAR_3); if (VAR_1 > 0) { IOHandlerRecord **pioh; for(ioh = first_io_handler; ioh != NULL; ioh = ioh->next) { if (!ioh->deleted && ioh->fd_read && FD_ISSET(ioh->fd, &rfds)) { ioh->fd_read(ioh->opaque); } if (!ioh->deleted && ioh->fd_write && FD_ISSET(ioh->fd, &wfds)) { ioh->fd_write(ioh->opaque); } } pioh = &first_io_handler; while (*pioh) { ioh = *pioh; if (ioh->deleted) { *pioh = ioh->next; qemu_free(ioh); } else pioh = &ioh->next; } } #if defined(CONFIG_SLIRP) if (slirp_inited) { if (VAR_1 < 0) { FD_ZERO(&rfds); FD_ZERO(&wfds); FD_ZERO(&xfds); } slirp_select_poll(&rfds, &wfds, &xfds); } #endif qemu_aio_poll(); if (vm_running) { if (likely(!(cur_cpu->singlestep_enabled & SSTEP_NOTIMER))) qemu_run_timers(&active_timers[QEMU_TIMER_VIRTUAL], qemu_get_clock(vm_clock)); DMA_run(); } qemu_run_timers(&active_timers[QEMU_TIMER_REALTIME], qemu_get_clock(rt_clock)); if (alarm_timer->flags & ALARM_FLAG_EXPIRED) { alarm_timer->flags &= ~(ALARM_FLAG_EXPIRED); qemu_rearm_alarm_timer(alarm_timer); } qemu_bh_poll(); }
[ "void FUNC_0(int VAR_0)\n{", "IOHandlerRecord *ioh;", "fd_set rfds, wfds, xfds;", "int VAR_1, VAR_2;", "#ifdef _WIN32\nint ret2, i;", "#endif\nstruct timeval VAR_3;", "PollingEntry *pe;", "VAR_1 = 0;", "for(pe = first_polling_entry; pe != NULL; pe = pe->next) {", "VAR_1 |= pe->func(pe->opaque);", "}", "#ifdef _WIN32\nif (VAR_1 == 0) {", "int err;", "WaitObjects *w = &wait_objects;", "VAR_1 = WaitForMultipleObjects(w->num, w->events, FALSE, VAR_0);", "if (WAIT_OBJECT_0 + 0 <= VAR_1 && VAR_1 <= WAIT_OBJECT_0 + w->num - 1) {", "if (w->func[VAR_1 - WAIT_OBJECT_0])\nw->func[VAR_1 - WAIT_OBJECT_0](w->opaque[VAR_1 - WAIT_OBJECT_0]);", "for(i = (VAR_1 - WAIT_OBJECT_0 + 1); i < w->num; i++) {", "ret2 = WaitForSingleObject(w->events[i], 0);", "if(ret2 == WAIT_OBJECT_0) {", "if (w->func[i])\nw->func[i](w->opaque[i]);", "} else if (ret2 == WAIT_TIMEOUT) {", "} else {", "err = GetLastError();", "fprintf(stderr, \"WaitForSingleObject error %d %d\\n\", i, err);", "}", "}", "} else if (VAR_1 == WAIT_TIMEOUT) {", "} else {", "err = GetLastError();", "fprintf(stderr, \"WaitForMultipleObjects error %d %d\\n\", VAR_1, err);", "}", "}", "#endif\nVAR_2 = -1;", "FD_ZERO(&rfds);", "FD_ZERO(&wfds);", "FD_ZERO(&xfds);", "for(ioh = first_io_handler; ioh != NULL; ioh = ioh->next) {", "if (ioh->deleted)\ncontinue;", "if (ioh->fd_read &&\n(!ioh->fd_read_poll ||\nioh->fd_read_poll(ioh->opaque) != 0)) {", "FD_SET(ioh->fd, &rfds);", "if (ioh->fd > VAR_2)\nVAR_2 = ioh->fd;", "}", "if (ioh->fd_write) {", "FD_SET(ioh->fd, &wfds);", "if (ioh->fd > VAR_2)\nVAR_2 = ioh->fd;", "}", "}", "VAR_3.tv_sec = 0;", "#ifdef _WIN32\nVAR_3.tv_usec = 0;", "#else\nVAR_3.tv_usec = VAR_0 * 1000;", "#endif\n#if defined(CONFIG_SLIRP)\nif (slirp_inited) {", "slirp_select_fill(&VAR_2, &rfds, &wfds, &xfds);", "}", "#endif\nVAR_1 = select(VAR_2 + 1, &rfds, &wfds, &xfds, &VAR_3);", "if (VAR_1 > 0) {", "IOHandlerRecord **pioh;", "for(ioh = first_io_handler; ioh != NULL; ioh = ioh->next) {", "if (!ioh->deleted && ioh->fd_read && FD_ISSET(ioh->fd, &rfds)) {", "ioh->fd_read(ioh->opaque);", "}", "if (!ioh->deleted && ioh->fd_write && FD_ISSET(ioh->fd, &wfds)) {", "ioh->fd_write(ioh->opaque);", "}", "}", "pioh = &first_io_handler;", "while (*pioh) {", "ioh = *pioh;", "if (ioh->deleted) {", "*pioh = ioh->next;", "qemu_free(ioh);", "} else", "pioh = &ioh->next;", "}", "}", "#if defined(CONFIG_SLIRP)\nif (slirp_inited) {", "if (VAR_1 < 0) {", "FD_ZERO(&rfds);", "FD_ZERO(&wfds);", "FD_ZERO(&xfds);", "}", "slirp_select_poll(&rfds, &wfds, &xfds);", "}", "#endif\nqemu_aio_poll();", "if (vm_running) {", "if (likely(!(cur_cpu->singlestep_enabled & SSTEP_NOTIMER)))\nqemu_run_timers(&active_timers[QEMU_TIMER_VIRTUAL],\nqemu_get_clock(vm_clock));", "DMA_run();", "}", "qemu_run_timers(&active_timers[QEMU_TIMER_REALTIME],\nqemu_get_clock(rt_clock));", "if (alarm_timer->flags & ALARM_FLAG_EXPIRED) {", "alarm_timer->flags &= ~(ALARM_FLAG_EXPIRED);", "qemu_rearm_alarm_timer(alarm_timer);", "}", "qemu_bh_poll();", "}" ]
[ 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, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11, 13 ], [ 15, 17 ], [ 19 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35, 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49, 51 ], [ 57 ], [ 63 ], [ 65 ], [ 67, 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95, 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111, 113 ], [ 115, 117, 119 ], [ 121 ], [ 123, 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133, 135 ], [ 137 ], [ 139 ], [ 143 ], [ 145, 147 ], [ 149, 151 ], [ 153, 155, 157 ], [ 159 ], [ 161 ], [ 163, 165 ], [ 167 ], [ 169 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213, 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231, 233 ], [ 237 ], [ 239, 241, 243 ], [ 247 ], [ 249 ], [ 255, 257 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 275 ], [ 279 ] ]
13,996
static int buf_put_buffer(void *opaque, const uint8_t *buf, int64_t pos, int size) { QEMUBuffer *s = opaque; return qsb_write_at(s->qsb, buf, pos, size); }
true
qemu
60fe637bf0e4d7989e21e50f52526444765c63b4
static int buf_put_buffer(void *opaque, const uint8_t *buf, int64_t pos, int size) { QEMUBuffer *s = opaque; return qsb_write_at(s->qsb, buf, pos, size); }
{ "code": [], "line_no": [] }
static int FUNC_0(void *VAR_0, const uint8_t *VAR_1, int64_t VAR_2, int VAR_3) { QEMUBuffer *s = VAR_0; return qsb_write_at(s->qsb, VAR_1, VAR_2, VAR_3); }
[ "static int FUNC_0(void *VAR_0, const uint8_t *VAR_1,\nint64_t VAR_2, int VAR_3)\n{", "QEMUBuffer *s = VAR_0;", "return qsb_write_at(s->qsb, VAR_1, VAR_2, VAR_3);", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13 ] ]
13,997
static void mv88w8618_eth_write(void *opaque, hwaddr offset, uint64_t value, unsigned size) { mv88w8618_eth_state *s = opaque; switch (offset) { case MP_ETH_SMIR: s->smir = value; break; case MP_ETH_PCXR: s->vlan_header = ((value >> MP_ETH_PCXR_2BSM_BIT) & 1) * 2; break; case MP_ETH_SDCMR: if (value & MP_ETH_CMD_TXHI) { eth_send(s, 1); } if (value & MP_ETH_CMD_TXLO) { eth_send(s, 0); } if (value & (MP_ETH_CMD_TXHI | MP_ETH_CMD_TXLO) && s->icr & s->imr) { qemu_irq_raise(s->irq); } break; case MP_ETH_ICR: s->icr &= value; break; case MP_ETH_IMR: s->imr = value; if (s->icr & s->imr) { qemu_irq_raise(s->irq); } break; case MP_ETH_FRDP0 ... MP_ETH_FRDP3: s->frx_queue[(offset - MP_ETH_FRDP0)/4] = value; break; case MP_ETH_CRDP0 ... MP_ETH_CRDP3: s->rx_queue[(offset - MP_ETH_CRDP0)/4] = s->cur_rx[(offset - MP_ETH_CRDP0)/4] = value; break; case MP_ETH_CTDP0 ... MP_ETH_CTDP3: s->tx_queue[(offset - MP_ETH_CTDP0)/4] = value; break; } }
true
qemu
cf143ad35018c5fc1da6365b45acda2b34aba90a
static void mv88w8618_eth_write(void *opaque, hwaddr offset, uint64_t value, unsigned size) { mv88w8618_eth_state *s = opaque; switch (offset) { case MP_ETH_SMIR: s->smir = value; break; case MP_ETH_PCXR: s->vlan_header = ((value >> MP_ETH_PCXR_2BSM_BIT) & 1) * 2; break; case MP_ETH_SDCMR: if (value & MP_ETH_CMD_TXHI) { eth_send(s, 1); } if (value & MP_ETH_CMD_TXLO) { eth_send(s, 0); } if (value & (MP_ETH_CMD_TXHI | MP_ETH_CMD_TXLO) && s->icr & s->imr) { qemu_irq_raise(s->irq); } break; case MP_ETH_ICR: s->icr &= value; break; case MP_ETH_IMR: s->imr = value; if (s->icr & s->imr) { qemu_irq_raise(s->irq); } break; case MP_ETH_FRDP0 ... MP_ETH_FRDP3: s->frx_queue[(offset - MP_ETH_FRDP0)/4] = value; break; case MP_ETH_CRDP0 ... MP_ETH_CRDP3: s->rx_queue[(offset - MP_ETH_CRDP0)/4] = s->cur_rx[(offset - MP_ETH_CRDP0)/4] = value; break; case MP_ETH_CTDP0 ... MP_ETH_CTDP3: s->tx_queue[(offset - MP_ETH_CTDP0)/4] = value; break; } }
{ "code": [ " case MP_ETH_CTDP0 ... MP_ETH_CTDP3:", " case MP_ETH_CTDP0 ... MP_ETH_CTDP3:" ], "line_no": [ 93, 93 ] }
static void FUNC_0(void *VAR_0, hwaddr VAR_1, uint64_t VAR_2, unsigned VAR_3) { mv88w8618_eth_state *s = VAR_0; switch (VAR_1) { case MP_ETH_SMIR: s->smir = VAR_2; break; case MP_ETH_PCXR: s->vlan_header = ((VAR_2 >> MP_ETH_PCXR_2BSM_BIT) & 1) * 2; break; case MP_ETH_SDCMR: if (VAR_2 & MP_ETH_CMD_TXHI) { eth_send(s, 1); } if (VAR_2 & MP_ETH_CMD_TXLO) { eth_send(s, 0); } if (VAR_2 & (MP_ETH_CMD_TXHI | MP_ETH_CMD_TXLO) && s->icr & s->imr) { qemu_irq_raise(s->irq); } break; case MP_ETH_ICR: s->icr &= VAR_2; break; case MP_ETH_IMR: s->imr = VAR_2; if (s->icr & s->imr) { qemu_irq_raise(s->irq); } break; case MP_ETH_FRDP0 ... MP_ETH_FRDP3: s->frx_queue[(VAR_1 - MP_ETH_FRDP0)/4] = VAR_2; break; case MP_ETH_CRDP0 ... MP_ETH_CRDP3: s->rx_queue[(VAR_1 - MP_ETH_CRDP0)/4] = s->cur_rx[(VAR_1 - MP_ETH_CRDP0)/4] = VAR_2; break; case MP_ETH_CTDP0 ... MP_ETH_CTDP3: s->tx_queue[(VAR_1 - MP_ETH_CTDP0)/4] = VAR_2; break; } }
[ "static void FUNC_0(void *VAR_0, hwaddr VAR_1,\nuint64_t VAR_2, unsigned VAR_3)\n{", "mv88w8618_eth_state *s = VAR_0;", "switch (VAR_1) {", "case MP_ETH_SMIR:\ns->smir = VAR_2;", "break;", "case MP_ETH_PCXR:\ns->vlan_header = ((VAR_2 >> MP_ETH_PCXR_2BSM_BIT) & 1) * 2;", "break;", "case MP_ETH_SDCMR:\nif (VAR_2 & MP_ETH_CMD_TXHI) {", "eth_send(s, 1);", "}", "if (VAR_2 & MP_ETH_CMD_TXLO) {", "eth_send(s, 0);", "}", "if (VAR_2 & (MP_ETH_CMD_TXHI | MP_ETH_CMD_TXLO) && s->icr & s->imr) {", "qemu_irq_raise(s->irq);", "}", "break;", "case MP_ETH_ICR:\ns->icr &= VAR_2;", "break;", "case MP_ETH_IMR:\ns->imr = VAR_2;", "if (s->icr & s->imr) {", "qemu_irq_raise(s->irq);", "}", "break;", "case MP_ETH_FRDP0 ... MP_ETH_FRDP3:\ns->frx_queue[(VAR_1 - MP_ETH_FRDP0)/4] = VAR_2;", "break;", "case MP_ETH_CRDP0 ... MP_ETH_CRDP3:\ns->rx_queue[(VAR_1 - MP_ETH_CRDP0)/4] =\ns->cur_rx[(VAR_1 - MP_ETH_CRDP0)/4] = VAR_2;", "break;", "case MP_ETH_CTDP0 ... MP_ETH_CTDP3:\ns->tx_queue[(VAR_1 - MP_ETH_CTDP0)/4] = VAR_2;", "break;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13, 15 ], [ 17 ], [ 21, 23 ], [ 25 ], [ 29, 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53, 55 ], [ 57 ], [ 61, 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 75, 77 ], [ 79 ], [ 83, 85, 87 ], [ 89 ], [ 93, 95 ], [ 97 ], [ 99 ], [ 101 ] ]
13,998
static int config_props(AVFilterLink *inlink) { FadeContext *s = inlink->dst->priv; const AVPixFmtDescriptor *pixdesc = av_pix_fmt_desc_get(inlink->format); s->hsub = pixdesc->log2_chroma_w; s->vsub = pixdesc->log2_chroma_h; s->bpp = av_get_bits_per_pixel(pixdesc) >> 3; s->alpha &= !!(pixdesc->flags & AV_PIX_FMT_FLAG_ALPHA); s->is_packed_rgb = ff_fill_rgba_map(s->rgba_map, inlink->format) >= 0; /* use CCIR601/709 black level for studio-level pixel non-alpha components */ s->black_level = ff_fmt_is_in(inlink->format, studio_level_pix_fmts) && !s->alpha ? 16 : 0; /* 32768 = 1 << 15, it is an integer representation * of 0.5 and is for rounding. */ s->black_level_scaled = (s->black_level << 16) + 32768; return 0; }
true
FFmpeg
ab3ff19f08b7a83e320c39ab066f289c242b8030
static int config_props(AVFilterLink *inlink) { FadeContext *s = inlink->dst->priv; const AVPixFmtDescriptor *pixdesc = av_pix_fmt_desc_get(inlink->format); s->hsub = pixdesc->log2_chroma_w; s->vsub = pixdesc->log2_chroma_h; s->bpp = av_get_bits_per_pixel(pixdesc) >> 3; s->alpha &= !!(pixdesc->flags & AV_PIX_FMT_FLAG_ALPHA); s->is_packed_rgb = ff_fill_rgba_map(s->rgba_map, inlink->format) >= 0; s->black_level = ff_fmt_is_in(inlink->format, studio_level_pix_fmts) && !s->alpha ? 16 : 0; s->black_level_scaled = (s->black_level << 16) + 32768; return 0; }
{ "code": [ " s->bpp = av_get_bits_per_pixel(pixdesc) >> 3;" ], "line_no": [ 17 ] }
static int FUNC_0(AVFilterLink *VAR_0) { FadeContext *s = VAR_0->dst->priv; const AVPixFmtDescriptor *VAR_1 = av_pix_fmt_desc_get(VAR_0->format); s->hsub = VAR_1->log2_chroma_w; s->vsub = VAR_1->log2_chroma_h; s->bpp = av_get_bits_per_pixel(VAR_1) >> 3; s->alpha &= !!(VAR_1->flags & AV_PIX_FMT_FLAG_ALPHA); s->is_packed_rgb = ff_fill_rgba_map(s->rgba_map, VAR_0->format) >= 0; s->black_level = ff_fmt_is_in(VAR_0->format, studio_level_pix_fmts) && !s->alpha ? 16 : 0; s->black_level_scaled = (s->black_level << 16) + 32768; return 0; }
[ "static int FUNC_0(AVFilterLink *VAR_0)\n{", "FadeContext *s = VAR_0->dst->priv;", "const AVPixFmtDescriptor *VAR_1 = av_pix_fmt_desc_get(VAR_0->format);", "s->hsub = VAR_1->log2_chroma_w;", "s->vsub = VAR_1->log2_chroma_h;", "s->bpp = av_get_bits_per_pixel(VAR_1) >> 3;", "s->alpha &= !!(VAR_1->flags & AV_PIX_FMT_FLAG_ALPHA);", "s->is_packed_rgb = ff_fill_rgba_map(s->rgba_map, VAR_0->format) >= 0;", "s->black_level =\nff_fmt_is_in(VAR_0->format, studio_level_pix_fmts) && !s->alpha ? 16 : 0;", "s->black_level_scaled = (s->black_level << 16) + 32768;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 27, 29 ], [ 35 ], [ 37 ], [ 39 ] ]
13,999
static void gen_msa(CPUMIPSState *env, DisasContext *ctx) { uint32_t opcode = ctx->opcode; check_insn(ctx, ASE_MSA); check_msa_access(ctx); switch (MASK_MSA_MINOR(opcode)) { case OPC_MSA_I8_00: case OPC_MSA_I8_01: case OPC_MSA_I8_02: gen_msa_i8(env, ctx); break; case OPC_MSA_I5_06: case OPC_MSA_I5_07: gen_msa_i5(env, ctx); break; case OPC_MSA_BIT_09: case OPC_MSA_BIT_0A: gen_msa_bit(env, ctx); break; case OPC_MSA_3R_0D: case OPC_MSA_3R_0E: case OPC_MSA_3R_0F: case OPC_MSA_3R_10: case OPC_MSA_3R_11: case OPC_MSA_3R_12: case OPC_MSA_3R_13: case OPC_MSA_3R_14: case OPC_MSA_3R_15: gen_msa_3r(env, ctx); break; case OPC_MSA_ELM: gen_msa_elm(env, ctx); break; case OPC_MSA_3RF_1A: case OPC_MSA_3RF_1B: case OPC_MSA_3RF_1C: gen_msa_3rf(env, ctx); break; case OPC_MSA_VEC: gen_msa_vec(env, ctx); break; case OPC_LD_B: case OPC_LD_H: case OPC_LD_W: case OPC_LD_D: case OPC_ST_B: case OPC_ST_H: case OPC_ST_W: case OPC_ST_D: { int32_t s10 = sextract32(ctx->opcode, 16, 10); uint8_t rs = (ctx->opcode >> 11) & 0x1f; uint8_t wd = (ctx->opcode >> 6) & 0x1f; uint8_t df = (ctx->opcode >> 0) & 0x3; TCGv_i32 tdf = tcg_const_i32(df); TCGv_i32 twd = tcg_const_i32(wd); TCGv_i32 trs = tcg_const_i32(rs); TCGv_i32 ts10 = tcg_const_i32(s10); switch (MASK_MSA_MINOR(opcode)) { case OPC_LD_B: case OPC_LD_H: case OPC_LD_W: case OPC_LD_D: gen_helper_msa_ld_df(cpu_env, tdf, twd, trs, ts10); break; case OPC_ST_B: case OPC_ST_H: case OPC_ST_W: case OPC_ST_D: gen_helper_msa_st_df(cpu_env, tdf, twd, trs, ts10); break; } tcg_temp_free_i32(twd); tcg_temp_free_i32(tdf); tcg_temp_free_i32(trs); tcg_temp_free_i32(ts10); } break; default: MIPS_INVAL("MSA instruction"); generate_exception(ctx, EXCP_RI); break; } }
true
qemu
0af7a37054310384e00209e0a43efe95b7c19ef0
static void gen_msa(CPUMIPSState *env, DisasContext *ctx) { uint32_t opcode = ctx->opcode; check_insn(ctx, ASE_MSA); check_msa_access(ctx); switch (MASK_MSA_MINOR(opcode)) { case OPC_MSA_I8_00: case OPC_MSA_I8_01: case OPC_MSA_I8_02: gen_msa_i8(env, ctx); break; case OPC_MSA_I5_06: case OPC_MSA_I5_07: gen_msa_i5(env, ctx); break; case OPC_MSA_BIT_09: case OPC_MSA_BIT_0A: gen_msa_bit(env, ctx); break; case OPC_MSA_3R_0D: case OPC_MSA_3R_0E: case OPC_MSA_3R_0F: case OPC_MSA_3R_10: case OPC_MSA_3R_11: case OPC_MSA_3R_12: case OPC_MSA_3R_13: case OPC_MSA_3R_14: case OPC_MSA_3R_15: gen_msa_3r(env, ctx); break; case OPC_MSA_ELM: gen_msa_elm(env, ctx); break; case OPC_MSA_3RF_1A: case OPC_MSA_3RF_1B: case OPC_MSA_3RF_1C: gen_msa_3rf(env, ctx); break; case OPC_MSA_VEC: gen_msa_vec(env, ctx); break; case OPC_LD_B: case OPC_LD_H: case OPC_LD_W: case OPC_LD_D: case OPC_ST_B: case OPC_ST_H: case OPC_ST_W: case OPC_ST_D: { int32_t s10 = sextract32(ctx->opcode, 16, 10); uint8_t rs = (ctx->opcode >> 11) & 0x1f; uint8_t wd = (ctx->opcode >> 6) & 0x1f; uint8_t df = (ctx->opcode >> 0) & 0x3; TCGv_i32 tdf = tcg_const_i32(df); TCGv_i32 twd = tcg_const_i32(wd); TCGv_i32 trs = tcg_const_i32(rs); TCGv_i32 ts10 = tcg_const_i32(s10); switch (MASK_MSA_MINOR(opcode)) { case OPC_LD_B: case OPC_LD_H: case OPC_LD_W: case OPC_LD_D: gen_helper_msa_ld_df(cpu_env, tdf, twd, trs, ts10); break; case OPC_ST_B: case OPC_ST_H: case OPC_ST_W: case OPC_ST_D: gen_helper_msa_st_df(cpu_env, tdf, twd, trs, ts10); break; } tcg_temp_free_i32(twd); tcg_temp_free_i32(tdf); tcg_temp_free_i32(trs); tcg_temp_free_i32(ts10); } break; default: MIPS_INVAL("MSA instruction"); generate_exception(ctx, EXCP_RI); break; } }
{ "code": [], "line_no": [] }
static void FUNC_0(CPUMIPSState *VAR_0, DisasContext *VAR_1) { uint32_t opcode = VAR_1->opcode; check_insn(VAR_1, ASE_MSA); check_msa_access(VAR_1); switch (MASK_MSA_MINOR(opcode)) { case OPC_MSA_I8_00: case OPC_MSA_I8_01: case OPC_MSA_I8_02: gen_msa_i8(VAR_0, VAR_1); break; case OPC_MSA_I5_06: case OPC_MSA_I5_07: gen_msa_i5(VAR_0, VAR_1); break; case OPC_MSA_BIT_09: case OPC_MSA_BIT_0A: gen_msa_bit(VAR_0, VAR_1); break; case OPC_MSA_3R_0D: case OPC_MSA_3R_0E: case OPC_MSA_3R_0F: case OPC_MSA_3R_10: case OPC_MSA_3R_11: case OPC_MSA_3R_12: case OPC_MSA_3R_13: case OPC_MSA_3R_14: case OPC_MSA_3R_15: gen_msa_3r(VAR_0, VAR_1); break; case OPC_MSA_ELM: gen_msa_elm(VAR_0, VAR_1); break; case OPC_MSA_3RF_1A: case OPC_MSA_3RF_1B: case OPC_MSA_3RF_1C: gen_msa_3rf(VAR_0, VAR_1); break; case OPC_MSA_VEC: gen_msa_vec(VAR_0, VAR_1); break; case OPC_LD_B: case OPC_LD_H: case OPC_LD_W: case OPC_LD_D: case OPC_ST_B: case OPC_ST_H: case OPC_ST_W: case OPC_ST_D: { int32_t s10 = sextract32(VAR_1->opcode, 16, 10); uint8_t rs = (VAR_1->opcode >> 11) & 0x1f; uint8_t wd = (VAR_1->opcode >> 6) & 0x1f; uint8_t df = (VAR_1->opcode >> 0) & 0x3; TCGv_i32 tdf = tcg_const_i32(df); TCGv_i32 twd = tcg_const_i32(wd); TCGv_i32 trs = tcg_const_i32(rs); TCGv_i32 ts10 = tcg_const_i32(s10); switch (MASK_MSA_MINOR(opcode)) { case OPC_LD_B: case OPC_LD_H: case OPC_LD_W: case OPC_LD_D: gen_helper_msa_ld_df(cpu_env, tdf, twd, trs, ts10); break; case OPC_ST_B: case OPC_ST_H: case OPC_ST_W: case OPC_ST_D: gen_helper_msa_st_df(cpu_env, tdf, twd, trs, ts10); break; } tcg_temp_free_i32(twd); tcg_temp_free_i32(tdf); tcg_temp_free_i32(trs); tcg_temp_free_i32(ts10); } break; default: MIPS_INVAL("MSA instruction"); generate_exception(VAR_1, EXCP_RI); break; } }
[ "static void FUNC_0(CPUMIPSState *VAR_0, DisasContext *VAR_1)\n{", "uint32_t opcode = VAR_1->opcode;", "check_insn(VAR_1, ASE_MSA);", "check_msa_access(VAR_1);", "switch (MASK_MSA_MINOR(opcode)) {", "case OPC_MSA_I8_00:\ncase OPC_MSA_I8_01:\ncase OPC_MSA_I8_02:\ngen_msa_i8(VAR_0, VAR_1);", "break;", "case OPC_MSA_I5_06:\ncase OPC_MSA_I5_07:\ngen_msa_i5(VAR_0, VAR_1);", "break;", "case OPC_MSA_BIT_09:\ncase OPC_MSA_BIT_0A:\ngen_msa_bit(VAR_0, VAR_1);", "break;", "case OPC_MSA_3R_0D:\ncase OPC_MSA_3R_0E:\ncase OPC_MSA_3R_0F:\ncase OPC_MSA_3R_10:\ncase OPC_MSA_3R_11:\ncase OPC_MSA_3R_12:\ncase OPC_MSA_3R_13:\ncase OPC_MSA_3R_14:\ncase OPC_MSA_3R_15:\ngen_msa_3r(VAR_0, VAR_1);", "break;", "case OPC_MSA_ELM:\ngen_msa_elm(VAR_0, VAR_1);", "break;", "case OPC_MSA_3RF_1A:\ncase OPC_MSA_3RF_1B:\ncase OPC_MSA_3RF_1C:\ngen_msa_3rf(VAR_0, VAR_1);", "break;", "case OPC_MSA_VEC:\ngen_msa_vec(VAR_0, VAR_1);", "break;", "case OPC_LD_B:\ncase OPC_LD_H:\ncase OPC_LD_W:\ncase OPC_LD_D:\ncase OPC_ST_B:\ncase OPC_ST_H:\ncase OPC_ST_W:\ncase OPC_ST_D:\n{", "int32_t s10 = sextract32(VAR_1->opcode, 16, 10);", "uint8_t rs = (VAR_1->opcode >> 11) & 0x1f;", "uint8_t wd = (VAR_1->opcode >> 6) & 0x1f;", "uint8_t df = (VAR_1->opcode >> 0) & 0x3;", "TCGv_i32 tdf = tcg_const_i32(df);", "TCGv_i32 twd = tcg_const_i32(wd);", "TCGv_i32 trs = tcg_const_i32(rs);", "TCGv_i32 ts10 = tcg_const_i32(s10);", "switch (MASK_MSA_MINOR(opcode)) {", "case OPC_LD_B:\ncase OPC_LD_H:\ncase OPC_LD_W:\ncase OPC_LD_D:\ngen_helper_msa_ld_df(cpu_env, tdf, twd, trs, ts10);", "break;", "case OPC_ST_B:\ncase OPC_ST_H:\ncase OPC_ST_W:\ncase OPC_ST_D:\ngen_helper_msa_st_df(cpu_env, tdf, twd, trs, ts10);", "break;", "}", "tcg_temp_free_i32(twd);", "tcg_temp_free_i32(tdf);", "tcg_temp_free_i32(trs);", "tcg_temp_free_i32(ts10);", "}", "break;", "default:\nMIPS_INVAL(\"MSA instruction\");", "generate_exception(VAR_1, EXCP_RI);", "break;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15, 17, 19, 21 ], [ 23 ], [ 25, 27, 29 ], [ 31 ], [ 33, 35, 37 ], [ 39 ], [ 41, 43, 45, 47, 49, 51, 53, 55, 57, 59 ], [ 61 ], [ 63, 65 ], [ 67 ], [ 69, 71, 73, 75 ], [ 77 ], [ 79, 81 ], [ 83 ], [ 85, 87, 89, 91, 93, 95, 97, 99, 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 123 ], [ 125, 127, 129, 131, 134 ], [ 136 ], [ 138, 140, 142, 144, 147 ], [ 149 ], [ 151 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167, 169 ], [ 171 ], [ 173 ], [ 175 ], [ 179 ] ]
14,000
static BlockAIOCB *read_fifo_child(QuorumAIOCB *acb) { BDRVQuorumState *s = acb->common.bs->opaque; acb->qcrs[acb->child_iter].buf = qemu_blockalign(s->children[acb->child_iter]->bs, acb->qiov->size); qemu_iovec_init(&acb->qcrs[acb->child_iter].qiov, acb->qiov->niov); qemu_iovec_clone(&acb->qcrs[acb->child_iter].qiov, acb->qiov, acb->qcrs[acb->child_iter].buf); bdrv_aio_readv(s->children[acb->child_iter]->bs, acb->sector_num, &acb->qcrs[acb->child_iter].qiov, acb->nb_sectors, quorum_aio_cb, &acb->qcrs[acb->child_iter]); return &acb->common; }
true
qemu
b9c600d20716b3d942cb07188ff998fb236a8365
static BlockAIOCB *read_fifo_child(QuorumAIOCB *acb) { BDRVQuorumState *s = acb->common.bs->opaque; acb->qcrs[acb->child_iter].buf = qemu_blockalign(s->children[acb->child_iter]->bs, acb->qiov->size); qemu_iovec_init(&acb->qcrs[acb->child_iter].qiov, acb->qiov->niov); qemu_iovec_clone(&acb->qcrs[acb->child_iter].qiov, acb->qiov, acb->qcrs[acb->child_iter].buf); bdrv_aio_readv(s->children[acb->child_iter]->bs, acb->sector_num, &acb->qcrs[acb->child_iter].qiov, acb->nb_sectors, quorum_aio_cb, &acb->qcrs[acb->child_iter]); return &acb->common; }
{ "code": [ " bdrv_aio_readv(s->children[acb->child_iter]->bs, acb->sector_num,", " &acb->qcrs[acb->child_iter].qiov, acb->nb_sectors,", " quorum_aio_cb, &acb->qcrs[acb->child_iter]);" ], "line_no": [ 19, 21, 23 ] }
static BlockAIOCB *FUNC_0(QuorumAIOCB *acb) { BDRVQuorumState *s = acb->common.bs->opaque; acb->qcrs[acb->child_iter].buf = qemu_blockalign(s->children[acb->child_iter]->bs, acb->qiov->size); qemu_iovec_init(&acb->qcrs[acb->child_iter].qiov, acb->qiov->niov); qemu_iovec_clone(&acb->qcrs[acb->child_iter].qiov, acb->qiov, acb->qcrs[acb->child_iter].buf); bdrv_aio_readv(s->children[acb->child_iter]->bs, acb->sector_num, &acb->qcrs[acb->child_iter].qiov, acb->nb_sectors, quorum_aio_cb, &acb->qcrs[acb->child_iter]); return &acb->common; }
[ "static BlockAIOCB *FUNC_0(QuorumAIOCB *acb)\n{", "BDRVQuorumState *s = acb->common.bs->opaque;", "acb->qcrs[acb->child_iter].buf =\nqemu_blockalign(s->children[acb->child_iter]->bs, acb->qiov->size);", "qemu_iovec_init(&acb->qcrs[acb->child_iter].qiov, acb->qiov->niov);", "qemu_iovec_clone(&acb->qcrs[acb->child_iter].qiov, acb->qiov,\nacb->qcrs[acb->child_iter].buf);", "bdrv_aio_readv(s->children[acb->child_iter]->bs, acb->sector_num,\n&acb->qcrs[acb->child_iter].qiov, acb->nb_sectors,\nquorum_aio_cb, &acb->qcrs[acb->child_iter]);", "return &acb->common;", "}" ]
[ 0, 0, 0, 0, 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11 ], [ 13 ], [ 15, 17 ], [ 19, 21, 23 ], [ 27 ], [ 29 ] ]
14,002
static void qmp_monitor_complete(void *opaque, QObject *ret_data) { monitor_protocol_emitter(opaque, ret_data); }
true
qemu
65207c59d99f2260c5f1d3b9c491146616a522aa
static void qmp_monitor_complete(void *opaque, QObject *ret_data) { monitor_protocol_emitter(opaque, ret_data); }
{ "code": [ "static void qmp_monitor_complete(void *opaque, QObject *ret_data)", " monitor_protocol_emitter(opaque, ret_data);" ], "line_no": [ 1, 5 ] }
static void FUNC_0(void *VAR_0, QObject *VAR_1) { monitor_protocol_emitter(VAR_0, VAR_1); }
[ "static void FUNC_0(void *VAR_0, QObject *VAR_1)\n{", "monitor_protocol_emitter(VAR_0, VAR_1);", "}" ]
[ 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
14,003
static int old_codec37(SANMVideoContext *ctx, int top, int left, int width, int height) { int stride = ctx->pitch; int i, j, k, t; int skip_run = 0; int compr, mvoff, seq, flags; uint32_t decoded_size; uint8_t *dst, *prev; compr = bytestream2_get_byte(&ctx->gb); mvoff = bytestream2_get_byte(&ctx->gb); seq = bytestream2_get_le16(&ctx->gb); decoded_size = bytestream2_get_le32(&ctx->gb); bytestream2_skip(&ctx->gb, 4); flags = bytestream2_get_byte(&ctx->gb); bytestream2_skip(&ctx->gb, 3); if (decoded_size > height * stride - left - top * stride) { decoded_size = height * stride - left - top * stride; av_log(ctx->avctx, AV_LOG_WARNING, "decoded size is too large\n"); } ctx->rotate_code = 0; if (((seq & 1) || !(flags & 1)) && (compr && compr != 2)) rotate_bufs(ctx, 1); dst = ((uint8_t*)ctx->frm0) + left + top * stride; prev = ((uint8_t*)ctx->frm2) + left + top * stride; if (mvoff > 2) { av_log(ctx->avctx, AV_LOG_ERROR, "invalid motion base value %d\n", mvoff); return AVERROR_INVALIDDATA; } av_dlog(ctx->avctx, "compression %d\n", compr); switch (compr) { case 0: for (i = 0; i < height; i++) { bytestream2_get_buffer(&ctx->gb, dst, width); dst += stride; } memset(ctx->frm1, 0, ctx->height * stride); memset(ctx->frm2, 0, ctx->height * stride); break; case 2: if (rle_decode(ctx, dst, decoded_size)) return AVERROR_INVALIDDATA; memset(ctx->frm1, 0, ctx->frm1_size); memset(ctx->frm2, 0, ctx->frm2_size); break; case 3: case 4: if (flags & 4) { for (j = 0; j < height; j += 4) { for (i = 0; i < width; i += 4) { int code; if (skip_run) { skip_run--; copy_block4(dst + i, prev + i, stride, stride, 4); continue; } if (bytestream2_get_bytes_left(&ctx->gb) < 1) return AVERROR_INVALIDDATA; code = bytestream2_get_byteu(&ctx->gb); switch (code) { case 0xFF: if (bytestream2_get_bytes_left(&ctx->gb) < 16) return AVERROR_INVALIDDATA; for (k = 0; k < 4; k++) bytestream2_get_bufferu(&ctx->gb, dst + i + k * stride, 4); break; case 0xFE: if (bytestream2_get_bytes_left(&ctx->gb) < 4) return AVERROR_INVALIDDATA; for (k = 0; k < 4; k++) memset(dst + i + k * stride, bytestream2_get_byteu(&ctx->gb), 4); break; case 0xFD: if (bytestream2_get_bytes_left(&ctx->gb) < 1) return AVERROR_INVALIDDATA; t = bytestream2_get_byteu(&ctx->gb); for (k = 0; k < 4; k++) memset(dst + i + k * stride, t, 4); break; default: if (compr == 4 && !code) { if (bytestream2_get_bytes_left(&ctx->gb) < 1) return AVERROR_INVALIDDATA; skip_run = bytestream2_get_byteu(&ctx->gb) + 1; i -= 4; } else { int mx, my; mx = c37_mv[(mvoff * 255 + code) * 2 ]; my = c37_mv[(mvoff * 255 + code) * 2 + 1]; codec37_mv(dst + i, prev + i + mx + my * stride, ctx->height, stride, i + mx, j + my); } } } dst += stride * 4; prev += stride * 4; } } else { for (j = 0; j < height; j += 4) { for (i = 0; i < width; i += 4) { int code; if (skip_run) { skip_run--; copy_block4(dst + i, prev + i, stride, stride, 4); continue; } code = bytestream2_get_byte(&ctx->gb); if (code == 0xFF) { if (bytestream2_get_bytes_left(&ctx->gb) < 16) return AVERROR_INVALIDDATA; for (k = 0; k < 4; k++) bytestream2_get_bufferu(&ctx->gb, dst + i + k * stride, 4); } else if (compr == 4 && !code) { if (bytestream2_get_bytes_left(&ctx->gb) < 1) return AVERROR_INVALIDDATA; skip_run = bytestream2_get_byteu(&ctx->gb) + 1; i -= 4; } else { int mx, my; mx = c37_mv[(mvoff * 255 + code) * 2]; my = c37_mv[(mvoff * 255 + code) * 2 + 1]; codec37_mv(dst + i, prev + i + mx + my * stride, ctx->height, stride, i + mx, j + my); } } dst += stride * 4; prev += stride * 4; } } break; default: av_log(ctx->avctx, AV_LOG_ERROR, "subcodec 37 compression %d not implemented\n", compr); return AVERROR_PATCHWELCOME; } return 0; }
true
FFmpeg
5260edee7e5bd975837696c8c8c1a80eb2fbd7c1
static int old_codec37(SANMVideoContext *ctx, int top, int left, int width, int height) { int stride = ctx->pitch; int i, j, k, t; int skip_run = 0; int compr, mvoff, seq, flags; uint32_t decoded_size; uint8_t *dst, *prev; compr = bytestream2_get_byte(&ctx->gb); mvoff = bytestream2_get_byte(&ctx->gb); seq = bytestream2_get_le16(&ctx->gb); decoded_size = bytestream2_get_le32(&ctx->gb); bytestream2_skip(&ctx->gb, 4); flags = bytestream2_get_byte(&ctx->gb); bytestream2_skip(&ctx->gb, 3); if (decoded_size > height * stride - left - top * stride) { decoded_size = height * stride - left - top * stride; av_log(ctx->avctx, AV_LOG_WARNING, "decoded size is too large\n"); } ctx->rotate_code = 0; if (((seq & 1) || !(flags & 1)) && (compr && compr != 2)) rotate_bufs(ctx, 1); dst = ((uint8_t*)ctx->frm0) + left + top * stride; prev = ((uint8_t*)ctx->frm2) + left + top * stride; if (mvoff > 2) { av_log(ctx->avctx, AV_LOG_ERROR, "invalid motion base value %d\n", mvoff); return AVERROR_INVALIDDATA; } av_dlog(ctx->avctx, "compression %d\n", compr); switch (compr) { case 0: for (i = 0; i < height; i++) { bytestream2_get_buffer(&ctx->gb, dst, width); dst += stride; } memset(ctx->frm1, 0, ctx->height * stride); memset(ctx->frm2, 0, ctx->height * stride); break; case 2: if (rle_decode(ctx, dst, decoded_size)) return AVERROR_INVALIDDATA; memset(ctx->frm1, 0, ctx->frm1_size); memset(ctx->frm2, 0, ctx->frm2_size); break; case 3: case 4: if (flags & 4) { for (j = 0; j < height; j += 4) { for (i = 0; i < width; i += 4) { int code; if (skip_run) { skip_run--; copy_block4(dst + i, prev + i, stride, stride, 4); continue; } if (bytestream2_get_bytes_left(&ctx->gb) < 1) return AVERROR_INVALIDDATA; code = bytestream2_get_byteu(&ctx->gb); switch (code) { case 0xFF: if (bytestream2_get_bytes_left(&ctx->gb) < 16) return AVERROR_INVALIDDATA; for (k = 0; k < 4; k++) bytestream2_get_bufferu(&ctx->gb, dst + i + k * stride, 4); break; case 0xFE: if (bytestream2_get_bytes_left(&ctx->gb) < 4) return AVERROR_INVALIDDATA; for (k = 0; k < 4; k++) memset(dst + i + k * stride, bytestream2_get_byteu(&ctx->gb), 4); break; case 0xFD: if (bytestream2_get_bytes_left(&ctx->gb) < 1) return AVERROR_INVALIDDATA; t = bytestream2_get_byteu(&ctx->gb); for (k = 0; k < 4; k++) memset(dst + i + k * stride, t, 4); break; default: if (compr == 4 && !code) { if (bytestream2_get_bytes_left(&ctx->gb) < 1) return AVERROR_INVALIDDATA; skip_run = bytestream2_get_byteu(&ctx->gb) + 1; i -= 4; } else { int mx, my; mx = c37_mv[(mvoff * 255 + code) * 2 ]; my = c37_mv[(mvoff * 255 + code) * 2 + 1]; codec37_mv(dst + i, prev + i + mx + my * stride, ctx->height, stride, i + mx, j + my); } } } dst += stride * 4; prev += stride * 4; } } else { for (j = 0; j < height; j += 4) { for (i = 0; i < width; i += 4) { int code; if (skip_run) { skip_run--; copy_block4(dst + i, prev + i, stride, stride, 4); continue; } code = bytestream2_get_byte(&ctx->gb); if (code == 0xFF) { if (bytestream2_get_bytes_left(&ctx->gb) < 16) return AVERROR_INVALIDDATA; for (k = 0; k < 4; k++) bytestream2_get_bufferu(&ctx->gb, dst + i + k * stride, 4); } else if (compr == 4 && !code) { if (bytestream2_get_bytes_left(&ctx->gb) < 1) return AVERROR_INVALIDDATA; skip_run = bytestream2_get_byteu(&ctx->gb) + 1; i -= 4; } else { int mx, my; mx = c37_mv[(mvoff * 255 + code) * 2]; my = c37_mv[(mvoff * 255 + code) * 2 + 1]; codec37_mv(dst + i, prev + i + mx + my * stride, ctx->height, stride, i + mx, j + my); } } dst += stride * 4; prev += stride * 4; } } break; default: av_log(ctx->avctx, AV_LOG_ERROR, "subcodec 37 compression %d not implemented\n", compr); return AVERROR_PATCHWELCOME; } return 0; }
{ "code": [ " if (decoded_size > height * stride - left - top * stride) {", " decoded_size = height * stride - left - top * stride;", " if (decoded_size > height * stride - left - top * stride) {", " decoded_size = height * stride - left - top * stride;" ], "line_no": [ 37, 39, 37, 39 ] }
static int FUNC_0(SANMVideoContext *VAR_0, int VAR_1, int VAR_2, int VAR_3, int VAR_4) { int VAR_5 = VAR_0->pitch; int VAR_6, VAR_7, VAR_8, VAR_9; int VAR_10 = 0; int VAR_11, VAR_12, VAR_13, VAR_14; uint32_t decoded_size; uint8_t *dst, *prev; VAR_11 = bytestream2_get_byte(&VAR_0->gb); VAR_12 = bytestream2_get_byte(&VAR_0->gb); VAR_13 = bytestream2_get_le16(&VAR_0->gb); decoded_size = bytestream2_get_le32(&VAR_0->gb); bytestream2_skip(&VAR_0->gb, 4); VAR_14 = bytestream2_get_byte(&VAR_0->gb); bytestream2_skip(&VAR_0->gb, 3); if (decoded_size > VAR_4 * VAR_5 - VAR_2 - VAR_1 * VAR_5) { decoded_size = VAR_4 * VAR_5 - VAR_2 - VAR_1 * VAR_5; av_log(VAR_0->avctx, AV_LOG_WARNING, "decoded size is too large\n"); } VAR_0->rotate_code = 0; if (((VAR_13 & 1) || !(VAR_14 & 1)) && (VAR_11 && VAR_11 != 2)) rotate_bufs(VAR_0, 1); dst = ((uint8_t*)VAR_0->frm0) + VAR_2 + VAR_1 * VAR_5; prev = ((uint8_t*)VAR_0->frm2) + VAR_2 + VAR_1 * VAR_5; if (VAR_12 > 2) { av_log(VAR_0->avctx, AV_LOG_ERROR, "invalid motion base value %d\n", VAR_12); return AVERROR_INVALIDDATA; } av_dlog(VAR_0->avctx, "compression %d\n", VAR_11); switch (VAR_11) { case 0: for (VAR_6 = 0; VAR_6 < VAR_4; VAR_6++) { bytestream2_get_buffer(&VAR_0->gb, dst, VAR_3); dst += VAR_5; } memset(VAR_0->frm1, 0, VAR_0->VAR_4 * VAR_5); memset(VAR_0->frm2, 0, VAR_0->VAR_4 * VAR_5); break; case 2: if (rle_decode(VAR_0, dst, decoded_size)) return AVERROR_INVALIDDATA; memset(VAR_0->frm1, 0, VAR_0->frm1_size); memset(VAR_0->frm2, 0, VAR_0->frm2_size); break; case 3: case 4: if (VAR_14 & 4) { for (VAR_7 = 0; VAR_7 < VAR_4; VAR_7 += 4) { for (VAR_6 = 0; VAR_6 < VAR_3; VAR_6 += 4) { int VAR_18; if (VAR_10) { VAR_10--; copy_block4(dst + VAR_6, prev + VAR_6, VAR_5, VAR_5, 4); continue; } if (bytestream2_get_bytes_left(&VAR_0->gb) < 1) return AVERROR_INVALIDDATA; VAR_18 = bytestream2_get_byteu(&VAR_0->gb); switch (VAR_18) { case 0xFF: if (bytestream2_get_bytes_left(&VAR_0->gb) < 16) return AVERROR_INVALIDDATA; for (VAR_8 = 0; VAR_8 < 4; VAR_8++) bytestream2_get_bufferu(&VAR_0->gb, dst + VAR_6 + VAR_8 * VAR_5, 4); break; case 0xFE: if (bytestream2_get_bytes_left(&VAR_0->gb) < 4) return AVERROR_INVALIDDATA; for (VAR_8 = 0; VAR_8 < 4; VAR_8++) memset(dst + VAR_6 + VAR_8 * VAR_5, bytestream2_get_byteu(&VAR_0->gb), 4); break; case 0xFD: if (bytestream2_get_bytes_left(&VAR_0->gb) < 1) return AVERROR_INVALIDDATA; VAR_9 = bytestream2_get_byteu(&VAR_0->gb); for (VAR_8 = 0; VAR_8 < 4; VAR_8++) memset(dst + VAR_6 + VAR_8 * VAR_5, VAR_9, 4); break; default: if (VAR_11 == 4 && !VAR_18) { if (bytestream2_get_bytes_left(&VAR_0->gb) < 1) return AVERROR_INVALIDDATA; VAR_10 = bytestream2_get_byteu(&VAR_0->gb) + 1; VAR_6 -= 4; } else { int VAR_18, VAR_18; VAR_18 = c37_mv[(VAR_12 * 255 + VAR_18) * 2 ]; VAR_18 = c37_mv[(VAR_12 * 255 + VAR_18) * 2 + 1]; codec37_mv(dst + VAR_6, prev + VAR_6 + VAR_18 + VAR_18 * VAR_5, VAR_0->VAR_4, VAR_5, VAR_6 + VAR_18, VAR_7 + VAR_18); } } } dst += VAR_5 * 4; prev += VAR_5 * 4; } } else { for (VAR_7 = 0; VAR_7 < VAR_4; VAR_7 += 4) { for (VAR_6 = 0; VAR_6 < VAR_3; VAR_6 += 4) { int VAR_18; if (VAR_10) { VAR_10--; copy_block4(dst + VAR_6, prev + VAR_6, VAR_5, VAR_5, 4); continue; } VAR_18 = bytestream2_get_byte(&VAR_0->gb); if (VAR_18 == 0xFF) { if (bytestream2_get_bytes_left(&VAR_0->gb) < 16) return AVERROR_INVALIDDATA; for (VAR_8 = 0; VAR_8 < 4; VAR_8++) bytestream2_get_bufferu(&VAR_0->gb, dst + VAR_6 + VAR_8 * VAR_5, 4); } else if (VAR_11 == 4 && !VAR_18) { if (bytestream2_get_bytes_left(&VAR_0->gb) < 1) return AVERROR_INVALIDDATA; VAR_10 = bytestream2_get_byteu(&VAR_0->gb) + 1; VAR_6 -= 4; } else { int VAR_18, VAR_18; VAR_18 = c37_mv[(VAR_12 * 255 + VAR_18) * 2]; VAR_18 = c37_mv[(VAR_12 * 255 + VAR_18) * 2 + 1]; codec37_mv(dst + VAR_6, prev + VAR_6 + VAR_18 + VAR_18 * VAR_5, VAR_0->VAR_4, VAR_5, VAR_6 + VAR_18, VAR_7 + VAR_18); } } dst += VAR_5 * 4; prev += VAR_5 * 4; } } break; default: av_log(VAR_0->avctx, AV_LOG_ERROR, "subcodec 37 compression %d not implemented\n", VAR_11); return AVERROR_PATCHWELCOME; } return 0; }
[ "static int FUNC_0(SANMVideoContext *VAR_0, int VAR_1,\nint VAR_2, int VAR_3, int VAR_4)\n{", "int VAR_5 = VAR_0->pitch;", "int VAR_6, VAR_7, VAR_8, VAR_9;", "int VAR_10 = 0;", "int VAR_11, VAR_12, VAR_13, VAR_14;", "uint32_t decoded_size;", "uint8_t *dst, *prev;", "VAR_11 = bytestream2_get_byte(&VAR_0->gb);", "VAR_12 = bytestream2_get_byte(&VAR_0->gb);", "VAR_13 = bytestream2_get_le16(&VAR_0->gb);", "decoded_size = bytestream2_get_le32(&VAR_0->gb);", "bytestream2_skip(&VAR_0->gb, 4);", "VAR_14 = bytestream2_get_byte(&VAR_0->gb);", "bytestream2_skip(&VAR_0->gb, 3);", "if (decoded_size > VAR_4 * VAR_5 - VAR_2 - VAR_1 * VAR_5) {", "decoded_size = VAR_4 * VAR_5 - VAR_2 - VAR_1 * VAR_5;", "av_log(VAR_0->avctx, AV_LOG_WARNING, \"decoded size is too large\\n\");", "}", "VAR_0->rotate_code = 0;", "if (((VAR_13 & 1) || !(VAR_14 & 1)) && (VAR_11 && VAR_11 != 2))\nrotate_bufs(VAR_0, 1);", "dst = ((uint8_t*)VAR_0->frm0) + VAR_2 + VAR_1 * VAR_5;", "prev = ((uint8_t*)VAR_0->frm2) + VAR_2 + VAR_1 * VAR_5;", "if (VAR_12 > 2) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"invalid motion base value %d\\n\", VAR_12);", "return AVERROR_INVALIDDATA;", "}", "av_dlog(VAR_0->avctx, \"compression %d\\n\", VAR_11);", "switch (VAR_11) {", "case 0:\nfor (VAR_6 = 0; VAR_6 < VAR_4; VAR_6++) {", "bytestream2_get_buffer(&VAR_0->gb, dst, VAR_3);", "dst += VAR_5;", "}", "memset(VAR_0->frm1, 0, VAR_0->VAR_4 * VAR_5);", "memset(VAR_0->frm2, 0, VAR_0->VAR_4 * VAR_5);", "break;", "case 2:\nif (rle_decode(VAR_0, dst, decoded_size))\nreturn AVERROR_INVALIDDATA;", "memset(VAR_0->frm1, 0, VAR_0->frm1_size);", "memset(VAR_0->frm2, 0, VAR_0->frm2_size);", "break;", "case 3:\ncase 4:\nif (VAR_14 & 4) {", "for (VAR_7 = 0; VAR_7 < VAR_4; VAR_7 += 4) {", "for (VAR_6 = 0; VAR_6 < VAR_3; VAR_6 += 4) {", "int VAR_18;", "if (VAR_10) {", "VAR_10--;", "copy_block4(dst + VAR_6, prev + VAR_6, VAR_5, VAR_5, 4);", "continue;", "}", "if (bytestream2_get_bytes_left(&VAR_0->gb) < 1)\nreturn AVERROR_INVALIDDATA;", "VAR_18 = bytestream2_get_byteu(&VAR_0->gb);", "switch (VAR_18) {", "case 0xFF:\nif (bytestream2_get_bytes_left(&VAR_0->gb) < 16)\nreturn AVERROR_INVALIDDATA;", "for (VAR_8 = 0; VAR_8 < 4; VAR_8++)", "bytestream2_get_bufferu(&VAR_0->gb, dst + VAR_6 + VAR_8 * VAR_5, 4);", "break;", "case 0xFE:\nif (bytestream2_get_bytes_left(&VAR_0->gb) < 4)\nreturn AVERROR_INVALIDDATA;", "for (VAR_8 = 0; VAR_8 < 4; VAR_8++)", "memset(dst + VAR_6 + VAR_8 * VAR_5, bytestream2_get_byteu(&VAR_0->gb), 4);", "break;", "case 0xFD:\nif (bytestream2_get_bytes_left(&VAR_0->gb) < 1)\nreturn AVERROR_INVALIDDATA;", "VAR_9 = bytestream2_get_byteu(&VAR_0->gb);", "for (VAR_8 = 0; VAR_8 < 4; VAR_8++)", "memset(dst + VAR_6 + VAR_8 * VAR_5, VAR_9, 4);", "break;", "default:\nif (VAR_11 == 4 && !VAR_18) {", "if (bytestream2_get_bytes_left(&VAR_0->gb) < 1)\nreturn AVERROR_INVALIDDATA;", "VAR_10 = bytestream2_get_byteu(&VAR_0->gb) + 1;", "VAR_6 -= 4;", "} else {", "int VAR_18, VAR_18;", "VAR_18 = c37_mv[(VAR_12 * 255 + VAR_18) * 2 ];", "VAR_18 = c37_mv[(VAR_12 * 255 + VAR_18) * 2 + 1];", "codec37_mv(dst + VAR_6, prev + VAR_6 + VAR_18 + VAR_18 * VAR_5,\nVAR_0->VAR_4, VAR_5, VAR_6 + VAR_18, VAR_7 + VAR_18);", "}", "}", "}", "dst += VAR_5 * 4;", "prev += VAR_5 * 4;", "}", "} else {", "for (VAR_7 = 0; VAR_7 < VAR_4; VAR_7 += 4) {", "for (VAR_6 = 0; VAR_6 < VAR_3; VAR_6 += 4) {", "int VAR_18;", "if (VAR_10) {", "VAR_10--;", "copy_block4(dst + VAR_6, prev + VAR_6, VAR_5, VAR_5, 4);", "continue;", "}", "VAR_18 = bytestream2_get_byte(&VAR_0->gb);", "if (VAR_18 == 0xFF) {", "if (bytestream2_get_bytes_left(&VAR_0->gb) < 16)\nreturn AVERROR_INVALIDDATA;", "for (VAR_8 = 0; VAR_8 < 4; VAR_8++)", "bytestream2_get_bufferu(&VAR_0->gb, dst + VAR_6 + VAR_8 * VAR_5, 4);", "} else if (VAR_11 == 4 && !VAR_18) {", "if (bytestream2_get_bytes_left(&VAR_0->gb) < 1)\nreturn AVERROR_INVALIDDATA;", "VAR_10 = bytestream2_get_byteu(&VAR_0->gb) + 1;", "VAR_6 -= 4;", "} else {", "int VAR_18, VAR_18;", "VAR_18 = c37_mv[(VAR_12 * 255 + VAR_18) * 2];", "VAR_18 = c37_mv[(VAR_12 * 255 + VAR_18) * 2 + 1];", "codec37_mv(dst + VAR_6, prev + VAR_6 + VAR_18 + VAR_18 * VAR_5,\nVAR_0->VAR_4, VAR_5, VAR_6 + VAR_18, VAR_7 + VAR_18);", "}", "}", "dst += VAR_5 * 4;", "prev += VAR_5 * 4;", "}", "}", "break;", "default:\nav_log(VAR_0->avctx, AV_LOG_ERROR,\n\"subcodec 37 compression %d not implemented\\n\", VAR_11);", "return AVERROR_PATCHWELCOME;", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 51, 53 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75, 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91, 93, 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103, 105, 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 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 ], [ 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 ], [ 255 ], [ 257 ], [ 259, 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277, 279, 281 ], [ 283 ], [ 285 ], [ 289 ], [ 291 ] ]
14,004
static int calculate_refcounts(BlockDriverState *bs, BdrvCheckResult *res, BdrvCheckMode fix, bool *rebuild, void **refcount_table, int64_t *nb_clusters) { BDRVQcow2State *s = bs->opaque; int64_t i; QCowSnapshot *sn; int ret; if (!*refcount_table) { int64_t old_size = 0; ret = realloc_refcount_array(s, refcount_table, &old_size, *nb_clusters); res->check_errors++; /* header */ 0, s->cluster_size); /* current L1 table */ ret = check_refcounts_l1(bs, res, refcount_table, nb_clusters, s->l1_table_offset, s->l1_size, CHECK_FRAG_INFO); /* snapshots */ for (i = 0; i < s->nb_snapshots; i++) { sn = s->snapshots + i; ret = check_refcounts_l1(bs, res, refcount_table, nb_clusters, sn->l1_table_offset, sn->l1_size, 0); s->snapshots_offset, s->snapshots_size); /* refcount data */ s->refcount_table_offset, s->refcount_table_size * sizeof(uint64_t)); return check_refblocks(bs, res, fix, rebuild, refcount_table, nb_clusters);
true
qemu
4652b8f3e1ec91bb9d6f00e40df7f96d1f1aafee
static int calculate_refcounts(BlockDriverState *bs, BdrvCheckResult *res, BdrvCheckMode fix, bool *rebuild, void **refcount_table, int64_t *nb_clusters) { BDRVQcow2State *s = bs->opaque; int64_t i; QCowSnapshot *sn; int ret; if (!*refcount_table) { int64_t old_size = 0; ret = realloc_refcount_array(s, refcount_table, &old_size, *nb_clusters); res->check_errors++; 0, s->cluster_size); ret = check_refcounts_l1(bs, res, refcount_table, nb_clusters, s->l1_table_offset, s->l1_size, CHECK_FRAG_INFO); for (i = 0; i < s->nb_snapshots; i++) { sn = s->snapshots + i; ret = check_refcounts_l1(bs, res, refcount_table, nb_clusters, sn->l1_table_offset, sn->l1_size, 0); s->snapshots_offset, s->snapshots_size); s->refcount_table_offset, s->refcount_table_size * sizeof(uint64_t)); return check_refblocks(bs, res, fix, rebuild, refcount_table, nb_clusters);
{ "code": [], "line_no": [] }
static int FUNC_0(BlockDriverState *VAR_0, BdrvCheckResult *VAR_1, BdrvCheckMode VAR_2, bool *VAR_3, void **VAR_4, int64_t *VAR_5) { BDRVQcow2State *s = VAR_0->opaque; int64_t i; QCowSnapshot *sn; int VAR_6; if (!*VAR_4) { int64_t old_size = 0; VAR_6 = realloc_refcount_array(s, VAR_4, &old_size, *VAR_5); VAR_1->check_errors++; 0, s->cluster_size); VAR_6 = check_refcounts_l1(VAR_0, VAR_1, VAR_4, VAR_5, s->l1_table_offset, s->l1_size, CHECK_FRAG_INFO); for (i = 0; i < s->nb_snapshots; i++) { sn = s->snapshots + i; VAR_6 = check_refcounts_l1(VAR_0, VAR_1, VAR_4, VAR_5, sn->l1_table_offset, sn->l1_size, 0); s->snapshots_offset, s->snapshots_size); s->refcount_table_offset, s->refcount_table_size * sizeof(uint64_t)); return check_refblocks(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5);
[ "static int FUNC_0(BlockDriverState *VAR_0, BdrvCheckResult *VAR_1,\nBdrvCheckMode VAR_2, bool *VAR_3,\nvoid **VAR_4, int64_t *VAR_5)\n{", "BDRVQcow2State *s = VAR_0->opaque;", "int64_t i;", "QCowSnapshot *sn;", "int VAR_6;", "if (!*VAR_4) {", "int64_t old_size = 0;", "VAR_6 = realloc_refcount_array(s, VAR_4,\n&old_size, *VAR_5);", "VAR_1->check_errors++;", "0, s->cluster_size);", "VAR_6 = check_refcounts_l1(VAR_0, VAR_1, VAR_4, VAR_5,\ns->l1_table_offset, s->l1_size, CHECK_FRAG_INFO);", "for (i = 0; i < s->nb_snapshots; i++) {", "sn = s->snapshots + i;", "VAR_6 = check_refcounts_l1(VAR_0, VAR_1, VAR_4, VAR_5,\nsn->l1_table_offset, sn->l1_size, 0);", "s->snapshots_offset, s->snapshots_size);", "s->refcount_table_offset,\ns->refcount_table_size * sizeof(uint64_t));", "return check_refblocks(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5);" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2, 3, 4 ], [ 5 ], [ 6 ], [ 7 ], [ 8 ], [ 9 ], [ 10 ], [ 11, 12 ], [ 13 ], [ 15 ], [ 17, 18 ], [ 20 ], [ 21 ], [ 22, 23 ], [ 24 ], [ 26, 27 ], [ 28 ] ]
14,005
static uint64_t calc_rice_params(RiceContext *rc, uint32_t udata[FLAC_MAX_BLOCKSIZE], uint64_t sums[32][MAX_PARTITIONS], int pmin, int pmax, const int32_t *data, int n, int pred_order, int exact) { int i; uint64_t bits[MAX_PARTITION_ORDER+1]; int opt_porder; RiceContext tmp_rc; int kmax = (1 << rc->coding_mode) - 2; av_assert1(pmin >= 0 && pmin <= MAX_PARTITION_ORDER); av_assert1(pmax >= 0 && pmax <= MAX_PARTITION_ORDER); av_assert1(pmin <= pmax); tmp_rc.coding_mode = rc->coding_mode; for (i = 0; i < n; i++) udata[i] = (2 * data[i]) ^ (data[i] >> 31); calc_sum_top(pmax, exact ? kmax : 0, udata, n, pred_order, sums); opt_porder = pmin; bits[pmin] = UINT32_MAX; for (i = pmax; ; ) { bits[i] = calc_optimal_rice_params(&tmp_rc, i, sums, n, pred_order, kmax, exact); if (bits[i] < bits[opt_porder]) { opt_porder = i; *rc = tmp_rc; } if (i == pmin) break; calc_sum_next(--i, sums, exact ? kmax : 0); } return bits[opt_porder]; }
true
FFmpeg
2469ed32c81ebf2347e6883091c566724b286167
static uint64_t calc_rice_params(RiceContext *rc, uint32_t udata[FLAC_MAX_BLOCKSIZE], uint64_t sums[32][MAX_PARTITIONS], int pmin, int pmax, const int32_t *data, int n, int pred_order, int exact) { int i; uint64_t bits[MAX_PARTITION_ORDER+1]; int opt_porder; RiceContext tmp_rc; int kmax = (1 << rc->coding_mode) - 2; av_assert1(pmin >= 0 && pmin <= MAX_PARTITION_ORDER); av_assert1(pmax >= 0 && pmax <= MAX_PARTITION_ORDER); av_assert1(pmin <= pmax); tmp_rc.coding_mode = rc->coding_mode; for (i = 0; i < n; i++) udata[i] = (2 * data[i]) ^ (data[i] >> 31); calc_sum_top(pmax, exact ? kmax : 0, udata, n, pred_order, sums); opt_porder = pmin; bits[pmin] = UINT32_MAX; for (i = pmax; ; ) { bits[i] = calc_optimal_rice_params(&tmp_rc, i, sums, n, pred_order, kmax, exact); if (bits[i] < bits[opt_porder]) { opt_porder = i; *rc = tmp_rc; } if (i == pmin) break; calc_sum_next(--i, sums, exact ? kmax : 0); } return bits[opt_porder]; }
{ "code": [ " if (bits[i] < bits[opt_porder]) {" ], "line_no": [ 55 ] }
static uint64_t FUNC_0(RiceContext *rc, uint32_t udata[FLAC_MAX_BLOCKSIZE], uint64_t sums[32][MAX_PARTITIONS], int pmin, int pmax, const int32_t *data, int n, int pred_order, int exact) { int VAR_0; uint64_t bits[MAX_PARTITION_ORDER+1]; int VAR_1; RiceContext tmp_rc; int VAR_2 = (1 << rc->coding_mode) - 2; av_assert1(pmin >= 0 && pmin <= MAX_PARTITION_ORDER); av_assert1(pmax >= 0 && pmax <= MAX_PARTITION_ORDER); av_assert1(pmin <= pmax); tmp_rc.coding_mode = rc->coding_mode; for (VAR_0 = 0; VAR_0 < n; VAR_0++) udata[VAR_0] = (2 * data[VAR_0]) ^ (data[VAR_0] >> 31); calc_sum_top(pmax, exact ? VAR_2 : 0, udata, n, pred_order, sums); VAR_1 = pmin; bits[pmin] = UINT32_MAX; for (VAR_0 = pmax; ; ) { bits[VAR_0] = calc_optimal_rice_params(&tmp_rc, VAR_0, sums, n, pred_order, VAR_2, exact); if (bits[VAR_0] < bits[VAR_1]) { VAR_1 = VAR_0; *rc = tmp_rc; } if (VAR_0 == pmin) break; calc_sum_next(--VAR_0, sums, exact ? VAR_2 : 0); } return bits[VAR_1]; }
[ "static uint64_t FUNC_0(RiceContext *rc,\nuint32_t udata[FLAC_MAX_BLOCKSIZE],\nuint64_t sums[32][MAX_PARTITIONS],\nint pmin, int pmax,\nconst int32_t *data, int n, int pred_order, int exact)\n{", "int VAR_0;", "uint64_t bits[MAX_PARTITION_ORDER+1];", "int VAR_1;", "RiceContext tmp_rc;", "int VAR_2 = (1 << rc->coding_mode) - 2;", "av_assert1(pmin >= 0 && pmin <= MAX_PARTITION_ORDER);", "av_assert1(pmax >= 0 && pmax <= MAX_PARTITION_ORDER);", "av_assert1(pmin <= pmax);", "tmp_rc.coding_mode = rc->coding_mode;", "for (VAR_0 = 0; VAR_0 < n; VAR_0++)", "udata[VAR_0] = (2 * data[VAR_0]) ^ (data[VAR_0] >> 31);", "calc_sum_top(pmax, exact ? VAR_2 : 0, udata, n, pred_order, sums);", "VAR_1 = pmin;", "bits[pmin] = UINT32_MAX;", "for (VAR_0 = pmax; ; ) {", "bits[VAR_0] = calc_optimal_rice_params(&tmp_rc, VAR_0, sums, n, pred_order, VAR_2, exact);", "if (bits[VAR_0] < bits[VAR_1]) {", "VAR_1 = VAR_0;", "*rc = tmp_rc;", "}", "if (VAR_0 == pmin)\nbreak;", "calc_sum_next(--VAR_0, sums, exact ? VAR_2 : 0);", "}", "return bits[VAR_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 ]
[ [ 1, 3, 5, 7, 9, 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 37 ], [ 39 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63, 65 ], [ 67 ], [ 69 ], [ 73 ], [ 75 ] ]
14,006
static void nvdimm_realize(PCDIMMDevice *dimm, Error **errp) { MemoryRegion *mr = host_memory_backend_get_memory(dimm->hostmem, errp); NVDIMMDevice *nvdimm = NVDIMM(dimm); uint64_t align, pmem_size, size = memory_region_size(mr); align = memory_region_get_alignment(mr); pmem_size = size - nvdimm->label_size; nvdimm->label_data = memory_region_get_ram_ptr(mr) + pmem_size; pmem_size = QEMU_ALIGN_DOWN(pmem_size, align); if (size <= nvdimm->label_size || !pmem_size) { HostMemoryBackend *hostmem = dimm->hostmem; char *path = object_get_canonical_path_component(OBJECT(hostmem)); error_setg(errp, "the size of memdev %s (0x%" PRIx64 ") is too " "small to contain nvdimm label (0x%" PRIx64 ") and " "aligned PMEM (0x%" PRIx64 ")", path, memory_region_size(mr), nvdimm->label_size, align); return; } memory_region_init_alias(&nvdimm->nvdimm_mr, OBJECT(dimm), "nvdimm-memory", mr, 0, pmem_size); nvdimm->nvdimm_mr.align = align; }
true
qemu
cdcab9d94101a6dd9ac8136c6f2cd15b6a997896
static void nvdimm_realize(PCDIMMDevice *dimm, Error **errp) { MemoryRegion *mr = host_memory_backend_get_memory(dimm->hostmem, errp); NVDIMMDevice *nvdimm = NVDIMM(dimm); uint64_t align, pmem_size, size = memory_region_size(mr); align = memory_region_get_alignment(mr); pmem_size = size - nvdimm->label_size; nvdimm->label_data = memory_region_get_ram_ptr(mr) + pmem_size; pmem_size = QEMU_ALIGN_DOWN(pmem_size, align); if (size <= nvdimm->label_size || !pmem_size) { HostMemoryBackend *hostmem = dimm->hostmem; char *path = object_get_canonical_path_component(OBJECT(hostmem)); error_setg(errp, "the size of memdev %s (0x%" PRIx64 ") is too " "small to contain nvdimm label (0x%" PRIx64 ") and " "aligned PMEM (0x%" PRIx64 ")", path, memory_region_size(mr), nvdimm->label_size, align); return; } memory_region_init_alias(&nvdimm->nvdimm_mr, OBJECT(dimm), "nvdimm-memory", mr, 0, pmem_size); nvdimm->nvdimm_mr.align = align; }
{ "code": [], "line_no": [] }
static void FUNC_0(PCDIMMDevice *VAR_0, Error **VAR_1) { MemoryRegion *mr = host_memory_backend_get_memory(VAR_0->hostmem, VAR_1); NVDIMMDevice *nvdimm = NVDIMM(VAR_0); uint64_t align, pmem_size, size = memory_region_size(mr); align = memory_region_get_alignment(mr); pmem_size = size - nvdimm->label_size; nvdimm->label_data = memory_region_get_ram_ptr(mr) + pmem_size; pmem_size = QEMU_ALIGN_DOWN(pmem_size, align); if (size <= nvdimm->label_size || !pmem_size) { HostMemoryBackend *hostmem = VAR_0->hostmem; char *VAR_2 = object_get_canonical_path_component(OBJECT(hostmem)); error_setg(VAR_1, "the size of memdev %s (0x%" PRIx64 ") is too " "small to contain nvdimm label (0x%" PRIx64 ") and " "aligned PMEM (0x%" PRIx64 ")", VAR_2, memory_region_size(mr), nvdimm->label_size, align); return; } memory_region_init_alias(&nvdimm->nvdimm_mr, OBJECT(VAR_0), "nvdimm-memory", mr, 0, pmem_size); nvdimm->nvdimm_mr.align = align; }
[ "static void FUNC_0(PCDIMMDevice *VAR_0, Error **VAR_1)\n{", "MemoryRegion *mr = host_memory_backend_get_memory(VAR_0->hostmem, VAR_1);", "NVDIMMDevice *nvdimm = NVDIMM(VAR_0);", "uint64_t align, pmem_size, size = memory_region_size(mr);", "align = memory_region_get_alignment(mr);", "pmem_size = size - nvdimm->label_size;", "nvdimm->label_data = memory_region_get_ram_ptr(mr) + pmem_size;", "pmem_size = QEMU_ALIGN_DOWN(pmem_size, align);", "if (size <= nvdimm->label_size || !pmem_size) {", "HostMemoryBackend *hostmem = VAR_0->hostmem;", "char *VAR_2 = object_get_canonical_path_component(OBJECT(hostmem));", "error_setg(VAR_1, \"the size of memdev %s (0x%\" PRIx64 \") is too \"\n\"small to contain nvdimm label (0x%\" PRIx64 \") and \"\n\"aligned PMEM (0x%\" PRIx64 \")\",\nVAR_2, memory_region_size(mr), nvdimm->label_size, align);", "return;", "}", "memory_region_init_alias(&nvdimm->nvdimm_mr, OBJECT(VAR_0),\n\"nvdimm-memory\", mr, 0, pmem_size);", "nvdimm->nvdimm_mr.align = align;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 33, 35, 37, 39 ], [ 42 ], [ 44 ], [ 48, 50 ], [ 52 ], [ 54 ] ]
14,007
ReSampleContext *av_audio_resample_init(int output_channels, int input_channels, int output_rate, int input_rate, enum AVSampleFormat sample_fmt_out, enum AVSampleFormat sample_fmt_in, int filter_length, int log2_phase_count, int linear, double cutoff) { ReSampleContext *s; if (input_channels > MAX_CHANNELS) { av_log(NULL, AV_LOG_ERROR, "Resampling with input channels greater than %d is unsupported.\n", MAX_CHANNELS); return NULL; } if (output_channels > 2 && !(output_channels == 6 && input_channels == 2) && output_channels != input_channels) { av_log(NULL, AV_LOG_ERROR, "Resampling output channel count must be 1 or 2 for mono input; 1, 2 or 6 for stereo input; or N for N channel input.\n"); return NULL; } s = av_mallocz(sizeof(ReSampleContext)); if (!s) { av_log(NULL, AV_LOG_ERROR, "Can't allocate memory for resample context.\n"); return NULL; } s->ratio = (float)output_rate / (float)input_rate; s->input_channels = input_channels; s->output_channels = output_channels; s->filter_channels = s->input_channels; if (s->output_channels < s->filter_channels) s->filter_channels = s->output_channels; s->sample_fmt[0] = sample_fmt_in; s->sample_fmt[1] = sample_fmt_out; s->sample_size[0] = av_get_bits_per_sample_fmt(s->sample_fmt[0]) >> 3; s->sample_size[1] = av_get_bits_per_sample_fmt(s->sample_fmt[1]) >> 3; if (s->sample_fmt[0] != AV_SAMPLE_FMT_S16) { if (!(s->convert_ctx[0] = av_audio_convert_alloc(AV_SAMPLE_FMT_S16, 1, s->sample_fmt[0], 1, NULL, 0))) { av_log(s, AV_LOG_ERROR, "Cannot convert %s sample format to s16 sample format\n", av_get_sample_fmt_name(s->sample_fmt[0])); av_free(s); return NULL; } } if (s->sample_fmt[1] != AV_SAMPLE_FMT_S16) { if (!(s->convert_ctx[1] = av_audio_convert_alloc(s->sample_fmt[1], 1, AV_SAMPLE_FMT_S16, 1, NULL, 0))) { av_log(s, AV_LOG_ERROR, "Cannot convert s16 sample format to %s sample format\n", av_get_sample_fmt_name(s->sample_fmt[1])); av_audio_convert_free(s->convert_ctx[0]); av_free(s); return NULL; } } #define TAPS 16 s->resample_context = av_resample_init(output_rate, input_rate, filter_length, log2_phase_count, linear, cutoff); *(const AVClass**)s->resample_context = &audioresample_context_class; return s; }
true
FFmpeg
e8876902a9021ec185ca785653067dd34f24c5ce
ReSampleContext *av_audio_resample_init(int output_channels, int input_channels, int output_rate, int input_rate, enum AVSampleFormat sample_fmt_out, enum AVSampleFormat sample_fmt_in, int filter_length, int log2_phase_count, int linear, double cutoff) { ReSampleContext *s; if (input_channels > MAX_CHANNELS) { av_log(NULL, AV_LOG_ERROR, "Resampling with input channels greater than %d is unsupported.\n", MAX_CHANNELS); return NULL; } if (output_channels > 2 && !(output_channels == 6 && input_channels == 2) && output_channels != input_channels) { av_log(NULL, AV_LOG_ERROR, "Resampling output channel count must be 1 or 2 for mono input; 1, 2 or 6 for stereo input; or N for N channel input.\n"); return NULL; } s = av_mallocz(sizeof(ReSampleContext)); if (!s) { av_log(NULL, AV_LOG_ERROR, "Can't allocate memory for resample context.\n"); return NULL; } s->ratio = (float)output_rate / (float)input_rate; s->input_channels = input_channels; s->output_channels = output_channels; s->filter_channels = s->input_channels; if (s->output_channels < s->filter_channels) s->filter_channels = s->output_channels; s->sample_fmt[0] = sample_fmt_in; s->sample_fmt[1] = sample_fmt_out; s->sample_size[0] = av_get_bits_per_sample_fmt(s->sample_fmt[0]) >> 3; s->sample_size[1] = av_get_bits_per_sample_fmt(s->sample_fmt[1]) >> 3; if (s->sample_fmt[0] != AV_SAMPLE_FMT_S16) { if (!(s->convert_ctx[0] = av_audio_convert_alloc(AV_SAMPLE_FMT_S16, 1, s->sample_fmt[0], 1, NULL, 0))) { av_log(s, AV_LOG_ERROR, "Cannot convert %s sample format to s16 sample format\n", av_get_sample_fmt_name(s->sample_fmt[0])); av_free(s); return NULL; } } if (s->sample_fmt[1] != AV_SAMPLE_FMT_S16) { if (!(s->convert_ctx[1] = av_audio_convert_alloc(s->sample_fmt[1], 1, AV_SAMPLE_FMT_S16, 1, NULL, 0))) { av_log(s, AV_LOG_ERROR, "Cannot convert s16 sample format to %s sample format\n", av_get_sample_fmt_name(s->sample_fmt[1])); av_audio_convert_free(s->convert_ctx[0]); av_free(s); return NULL; } } #define TAPS 16 s->resample_context = av_resample_init(output_rate, input_rate, filter_length, log2_phase_count, linear, cutoff); *(const AVClass**)s->resample_context = &audioresample_context_class; return s; }
{ "code": [ " if (output_channels > 2 &&", " !(output_channels == 6 && input_channels == 2) &&", " output_channels != input_channels) {", " av_log(NULL, AV_LOG_ERROR,", " \"Resampling output channel count must be 1 or 2 for mono input; 1, 2 or 6 for stereo input; or N for N channel input.\\n\");" ], "line_no": [ 31, 33, 35, 21, 39 ] }
ReSampleContext *FUNC_0(int output_channels, int input_channels, int output_rate, int input_rate, enum AVSampleFormat sample_fmt_out, enum AVSampleFormat sample_fmt_in, int filter_length, int log2_phase_count, int linear, double cutoff) { ReSampleContext *s; if (input_channels > MAX_CHANNELS) { av_log(NULL, AV_LOG_ERROR, "Resampling with input channels greater than %d is unsupported.\n", MAX_CHANNELS); return NULL; } if (output_channels > 2 && !(output_channels == 6 && input_channels == 2) && output_channels != input_channels) { av_log(NULL, AV_LOG_ERROR, "Resampling output channel count must be 1 or 2 for mono input; 1, 2 or 6 for stereo input; or N for N channel input.\n"); return NULL; } s = av_mallocz(sizeof(ReSampleContext)); if (!s) { av_log(NULL, AV_LOG_ERROR, "Can't allocate memory for resample context.\n"); return NULL; } s->ratio = (float)output_rate / (float)input_rate; s->input_channels = input_channels; s->output_channels = output_channels; s->filter_channels = s->input_channels; if (s->output_channels < s->filter_channels) s->filter_channels = s->output_channels; s->sample_fmt[0] = sample_fmt_in; s->sample_fmt[1] = sample_fmt_out; s->sample_size[0] = av_get_bits_per_sample_fmt(s->sample_fmt[0]) >> 3; s->sample_size[1] = av_get_bits_per_sample_fmt(s->sample_fmt[1]) >> 3; if (s->sample_fmt[0] != AV_SAMPLE_FMT_S16) { if (!(s->convert_ctx[0] = av_audio_convert_alloc(AV_SAMPLE_FMT_S16, 1, s->sample_fmt[0], 1, NULL, 0))) { av_log(s, AV_LOG_ERROR, "Cannot convert %s sample format to s16 sample format\n", av_get_sample_fmt_name(s->sample_fmt[0])); av_free(s); return NULL; } } if (s->sample_fmt[1] != AV_SAMPLE_FMT_S16) { if (!(s->convert_ctx[1] = av_audio_convert_alloc(s->sample_fmt[1], 1, AV_SAMPLE_FMT_S16, 1, NULL, 0))) { av_log(s, AV_LOG_ERROR, "Cannot convert s16 sample format to %s sample format\n", av_get_sample_fmt_name(s->sample_fmt[1])); av_audio_convert_free(s->convert_ctx[0]); av_free(s); return NULL; } } #define TAPS 16 s->resample_context = av_resample_init(output_rate, input_rate, filter_length, log2_phase_count, linear, cutoff); *(const AVClass**)s->resample_context = &audioresample_context_class; return s; }
[ "ReSampleContext *FUNC_0(int output_channels, int input_channels,\nint output_rate, int input_rate,\nenum AVSampleFormat sample_fmt_out,\nenum AVSampleFormat sample_fmt_in,\nint filter_length, int log2_phase_count,\nint linear, double cutoff)\n{", "ReSampleContext *s;", "if (input_channels > MAX_CHANNELS) {", "av_log(NULL, AV_LOG_ERROR,\n\"Resampling with input channels greater than %d is unsupported.\\n\",\nMAX_CHANNELS);", "return NULL;", "}", "if (output_channels > 2 &&\n!(output_channels == 6 && input_channels == 2) &&\noutput_channels != input_channels) {", "av_log(NULL, AV_LOG_ERROR,\n\"Resampling output channel count must be 1 or 2 for mono input; 1, 2 or 6 for stereo input; or N for N channel input.\\n\");", "return NULL;", "}", "s = av_mallocz(sizeof(ReSampleContext));", "if (!s) {", "av_log(NULL, AV_LOG_ERROR, \"Can't allocate memory for resample context.\\n\");", "return NULL;", "}", "s->ratio = (float)output_rate / (float)input_rate;", "s->input_channels = input_channels;", "s->output_channels = output_channels;", "s->filter_channels = s->input_channels;", "if (s->output_channels < s->filter_channels)\ns->filter_channels = s->output_channels;", "s->sample_fmt[0] = sample_fmt_in;", "s->sample_fmt[1] = sample_fmt_out;", "s->sample_size[0] = av_get_bits_per_sample_fmt(s->sample_fmt[0]) >> 3;", "s->sample_size[1] = av_get_bits_per_sample_fmt(s->sample_fmt[1]) >> 3;", "if (s->sample_fmt[0] != AV_SAMPLE_FMT_S16) {", "if (!(s->convert_ctx[0] = av_audio_convert_alloc(AV_SAMPLE_FMT_S16, 1,\ns->sample_fmt[0], 1, NULL, 0))) {", "av_log(s, AV_LOG_ERROR,\n\"Cannot convert %s sample format to s16 sample format\\n\",\nav_get_sample_fmt_name(s->sample_fmt[0]));", "av_free(s);", "return NULL;", "}", "}", "if (s->sample_fmt[1] != AV_SAMPLE_FMT_S16) {", "if (!(s->convert_ctx[1] = av_audio_convert_alloc(s->sample_fmt[1], 1,\nAV_SAMPLE_FMT_S16, 1, NULL, 0))) {", "av_log(s, AV_LOG_ERROR,\n\"Cannot convert s16 sample format to %s sample format\\n\",\nav_get_sample_fmt_name(s->sample_fmt[1]));", "av_audio_convert_free(s->convert_ctx[0]);", "av_free(s);", "return NULL;", "}", "}", "#define TAPS 16\ns->resample_context = av_resample_init(output_rate, input_rate,\nfilter_length, log2_phase_count,\nlinear, cutoff);", "*(const AVClass**)s->resample_context = &audioresample_context_class;", "return s;", "}" ]
[ 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11, 13 ], [ 15 ], [ 19 ], [ 21, 23, 25 ], [ 27 ], [ 29 ], [ 31, 33, 35 ], [ 37, 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 63 ], [ 65 ], [ 69 ], [ 71, 73 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 87 ], [ 89, 91 ], [ 93, 95, 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 109 ], [ 111, 113 ], [ 115, 117, 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 133, 135, 137, 139 ], [ 143 ], [ 147 ], [ 149 ] ]
14,008
static void gen_sync(DisasContext *ctx) { uint32_t l = (ctx->opcode >> 21) & 3; /* * We may need to check for a pending TLB flush. * * We do this on ptesync (l == 2) on ppc64 and any sync pn ppc32. * * Additionally, this can only happen in kernel mode however so * check MSR_PR as well. */ if (((l == 2) || !(ctx->insns_flags & PPC_64B)) && !ctx->pr) { gen_check_tlb_flush(ctx); } }
true
qemu
e3cffe6fad29e07d401eabb913a6d88501d5c143
static void gen_sync(DisasContext *ctx) { uint32_t l = (ctx->opcode >> 21) & 3; if (((l == 2) || !(ctx->insns_flags & PPC_64B)) && !ctx->pr) { gen_check_tlb_flush(ctx); } }
{ "code": [ " gen_check_tlb_flush(ctx);", " gen_check_tlb_flush(ctx);" ], "line_no": [ 27, 27 ] }
static void FUNC_0(DisasContext *VAR_0) { uint32_t l = (VAR_0->opcode >> 21) & 3; if (((l == 2) || !(VAR_0->insns_flags & PPC_64B)) && !VAR_0->pr) { gen_check_tlb_flush(VAR_0); } }
[ "static void FUNC_0(DisasContext *VAR_0)\n{", "uint32_t l = (VAR_0->opcode >> 21) & 3;", "if (((l == 2) || !(VAR_0->insns_flags & PPC_64B)) && !VAR_0->pr) {", "gen_check_tlb_flush(VAR_0);", "}", "}" ]
[ 0, 0, 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ] ]
14,009
static int qcrypto_ivgen_essiv_calculate(QCryptoIVGen *ivgen, uint64_t sector, uint8_t *iv, size_t niv, Error **errp) { QCryptoIVGenESSIV *essiv = ivgen->private; size_t ndata = qcrypto_cipher_get_block_len(ivgen->cipher); uint8_t *data = g_new(uint8_t, ndata); sector = cpu_to_le64(sector); memcpy(data, (uint8_t *)&sector, ndata); if (sizeof(sector) < ndata) { memset(data + sizeof(sector), 0, ndata - sizeof(sector)); } if (qcrypto_cipher_encrypt(essiv->cipher, data, data, ndata, errp) < 0) { g_free(data); return -1; } if (ndata > niv) { ndata = niv; } memcpy(iv, data, ndata); if (ndata < niv) { memset(iv + ndata, 0, niv - ndata); } g_free(data); return 0; }
true
qemu
83e33300a2342c5d0bf48474fdf8da22c22b4973
static int qcrypto_ivgen_essiv_calculate(QCryptoIVGen *ivgen, uint64_t sector, uint8_t *iv, size_t niv, Error **errp) { QCryptoIVGenESSIV *essiv = ivgen->private; size_t ndata = qcrypto_cipher_get_block_len(ivgen->cipher); uint8_t *data = g_new(uint8_t, ndata); sector = cpu_to_le64(sector); memcpy(data, (uint8_t *)&sector, ndata); if (sizeof(sector) < ndata) { memset(data + sizeof(sector), 0, ndata - sizeof(sector)); } if (qcrypto_cipher_encrypt(essiv->cipher, data, data, ndata, errp) < 0) { g_free(data); return -1; } if (ndata > niv) { ndata = niv; } memcpy(iv, data, ndata); if (ndata < niv) { memset(iv + ndata, 0, niv - ndata); } g_free(data); return 0; }
{ "code": [ " memcpy(data, (uint8_t *)&sector, ndata);" ], "line_no": [ 21 ] }
static int FUNC_0(QCryptoIVGen *VAR_0, uint64_t VAR_1, uint8_t *VAR_2, size_t VAR_3, Error **VAR_4) { QCryptoIVGenESSIV *essiv = VAR_0->private; size_t ndata = qcrypto_cipher_get_block_len(VAR_0->cipher); uint8_t *data = g_new(uint8_t, ndata); VAR_1 = cpu_to_le64(VAR_1); memcpy(data, (uint8_t *)&VAR_1, ndata); if (sizeof(VAR_1) < ndata) { memset(data + sizeof(VAR_1), 0, ndata - sizeof(VAR_1)); } if (qcrypto_cipher_encrypt(essiv->cipher, data, data, ndata, VAR_4) < 0) { g_free(data); return -1; } if (ndata > VAR_3) { ndata = VAR_3; } memcpy(VAR_2, data, ndata); if (ndata < VAR_3) { memset(VAR_2 + ndata, 0, VAR_3 - ndata); } g_free(data); return 0; }
[ "static int FUNC_0(QCryptoIVGen *VAR_0,\nuint64_t VAR_1,\nuint8_t *VAR_2, size_t VAR_3,\nError **VAR_4)\n{", "QCryptoIVGenESSIV *essiv = VAR_0->private;", "size_t ndata = qcrypto_cipher_get_block_len(VAR_0->cipher);", "uint8_t *data = g_new(uint8_t, ndata);", "VAR_1 = cpu_to_le64(VAR_1);", "memcpy(data, (uint8_t *)&VAR_1, ndata);", "if (sizeof(VAR_1) < ndata) {", "memset(data + sizeof(VAR_1), 0, ndata - sizeof(VAR_1));", "}", "if (qcrypto_cipher_encrypt(essiv->cipher,\ndata,\ndata,\nndata,\nVAR_4) < 0) {", "g_free(data);", "return -1;", "}", "if (ndata > VAR_3) {", "ndata = VAR_3;", "}", "memcpy(VAR_2, data, ndata);", "if (ndata < VAR_3) {", "memset(VAR_2 + ndata, 0, VAR_3 - ndata);", "}", "g_free(data);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31, 33, 35, 37, 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ] ]
14,010
void ff_nut_free_sp(NUTContext *nut) { av_tree_enumerate(nut->syncpoints, NULL, NULL, enu_free); av_tree_destroy(nut->syncpoints); }
true
FFmpeg
56c182c4d716b8b72156ff57a0c8d72087db8549
void ff_nut_free_sp(NUTContext *nut) { av_tree_enumerate(nut->syncpoints, NULL, NULL, enu_free); av_tree_destroy(nut->syncpoints); }
{ "code": [ " av_tree_enumerate(nut->syncpoints, NULL, NULL, enu_free);", " av_tree_destroy(nut->syncpoints);" ], "line_no": [ 5, 7 ] }
void FUNC_0(NUTContext *VAR_0) { av_tree_enumerate(VAR_0->syncpoints, NULL, NULL, enu_free); av_tree_destroy(VAR_0->syncpoints); }
[ "void FUNC_0(NUTContext *VAR_0)\n{", "av_tree_enumerate(VAR_0->syncpoints, NULL, NULL, enu_free);", "av_tree_destroy(VAR_0->syncpoints);", "}" ]
[ 0, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
14,011
static void memory_region_oldmmio_write_accessor(MemoryRegion *mr, hwaddr addr, uint64_t *value, unsigned size, unsigned shift, uint64_t mask) { uint64_t tmp; tmp = (*value >> shift) & mask; trace_memory_region_ops_write(mr, addr, tmp, size); mr->ops->old_mmio.write[ctz32(size)](mr->opaque, addr, tmp); }
true
qemu
cc05c43ad942165ecc6ffd39e41991bee43af044
static void memory_region_oldmmio_write_accessor(MemoryRegion *mr, hwaddr addr, uint64_t *value, unsigned size, unsigned shift, uint64_t mask) { uint64_t tmp; tmp = (*value >> shift) & mask; trace_memory_region_ops_write(mr, addr, tmp, size); mr->ops->old_mmio.write[ctz32(size)](mr->opaque, addr, tmp); }
{ "code": [ " uint64_t tmp;", "static void memory_region_oldmmio_write_accessor(MemoryRegion *mr,", " hwaddr addr,", " uint64_t *value,", " unsigned size,", " unsigned shift,", " uint64_t mask)" ], "line_no": [ 15, 1, 3, 5, 7, 9, 11 ] }
static void FUNC_0(MemoryRegion *VAR_0, hwaddr VAR_1, uint64_t *VAR_2, unsigned VAR_3, unsigned VAR_4, uint64_t VAR_5) { uint64_t tmp; tmp = (*VAR_2 >> VAR_4) & VAR_5; trace_memory_region_ops_write(VAR_0, VAR_1, tmp, VAR_3); VAR_0->ops->old_mmio.write[ctz32(VAR_3)](VAR_0->opaque, VAR_1, tmp); }
[ "static void FUNC_0(MemoryRegion *VAR_0,\nhwaddr VAR_1,\nuint64_t *VAR_2,\nunsigned VAR_3,\nunsigned VAR_4,\nuint64_t VAR_5)\n{", "uint64_t tmp;", "tmp = (*VAR_2 >> VAR_4) & VAR_5;", "trace_memory_region_ops_write(VAR_0, VAR_1, tmp, VAR_3);", "VAR_0->ops->old_mmio.write[ctz32(VAR_3)](VAR_0->opaque, VAR_1, tmp);", "}" ]
[ 1, 1, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11, 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ] ]
14,012
static void scsi_cmd_xfer_mode(SCSICommand *cmd) { if (!cmd->xfer) { cmd->mode = SCSI_XFER_NONE; return; } switch (cmd->buf[0]) { case WRITE_6: case WRITE_10: case WRITE_VERIFY_10: case WRITE_12: case WRITE_VERIFY_12: case WRITE_16: case WRITE_VERIFY_16: case COPY: case COPY_VERIFY: case COMPARE: case CHANGE_DEFINITION: case LOG_SELECT: case MODE_SELECT: case MODE_SELECT_10: case SEND_DIAGNOSTIC: case WRITE_BUFFER: case FORMAT_UNIT: case REASSIGN_BLOCKS: case SEARCH_EQUAL: case SEARCH_HIGH: case SEARCH_LOW: case UPDATE_BLOCK: case WRITE_LONG_10: case WRITE_SAME_10: case WRITE_SAME_16: case UNMAP: case SEARCH_HIGH_12: case SEARCH_EQUAL_12: case SEARCH_LOW_12: case MEDIUM_SCAN: case SEND_VOLUME_TAG: case SEND_CUE_SHEET: case SEND_DVD_STRUCTURE: case PERSISTENT_RESERVE_OUT: case MAINTENANCE_OUT: cmd->mode = SCSI_XFER_TO_DEV; break; default: cmd->mode = SCSI_XFER_FROM_DEV; break; } }
true
qemu
381b634c275ca1a2806e97392527bbfc01bcb333
static void scsi_cmd_xfer_mode(SCSICommand *cmd) { if (!cmd->xfer) { cmd->mode = SCSI_XFER_NONE; return; } switch (cmd->buf[0]) { case WRITE_6: case WRITE_10: case WRITE_VERIFY_10: case WRITE_12: case WRITE_VERIFY_12: case WRITE_16: case WRITE_VERIFY_16: case COPY: case COPY_VERIFY: case COMPARE: case CHANGE_DEFINITION: case LOG_SELECT: case MODE_SELECT: case MODE_SELECT_10: case SEND_DIAGNOSTIC: case WRITE_BUFFER: case FORMAT_UNIT: case REASSIGN_BLOCKS: case SEARCH_EQUAL: case SEARCH_HIGH: case SEARCH_LOW: case UPDATE_BLOCK: case WRITE_LONG_10: case WRITE_SAME_10: case WRITE_SAME_16: case UNMAP: case SEARCH_HIGH_12: case SEARCH_EQUAL_12: case SEARCH_LOW_12: case MEDIUM_SCAN: case SEND_VOLUME_TAG: case SEND_CUE_SHEET: case SEND_DVD_STRUCTURE: case PERSISTENT_RESERVE_OUT: case MAINTENANCE_OUT: cmd->mode = SCSI_XFER_TO_DEV; break; default: cmd->mode = SCSI_XFER_FROM_DEV; break; } }
{ "code": [], "line_no": [] }
static void FUNC_0(SCSICommand *VAR_0) { if (!VAR_0->xfer) { VAR_0->mode = SCSI_XFER_NONE; return; } switch (VAR_0->buf[0]) { case WRITE_6: case WRITE_10: case WRITE_VERIFY_10: case WRITE_12: case WRITE_VERIFY_12: case WRITE_16: case WRITE_VERIFY_16: case COPY: case COPY_VERIFY: case COMPARE: case CHANGE_DEFINITION: case LOG_SELECT: case MODE_SELECT: case MODE_SELECT_10: case SEND_DIAGNOSTIC: case WRITE_BUFFER: case FORMAT_UNIT: case REASSIGN_BLOCKS: case SEARCH_EQUAL: case SEARCH_HIGH: case SEARCH_LOW: case UPDATE_BLOCK: case WRITE_LONG_10: case WRITE_SAME_10: case WRITE_SAME_16: case UNMAP: case SEARCH_HIGH_12: case SEARCH_EQUAL_12: case SEARCH_LOW_12: case MEDIUM_SCAN: case SEND_VOLUME_TAG: case SEND_CUE_SHEET: case SEND_DVD_STRUCTURE: case PERSISTENT_RESERVE_OUT: case MAINTENANCE_OUT: VAR_0->mode = SCSI_XFER_TO_DEV; break; default: VAR_0->mode = SCSI_XFER_FROM_DEV; break; } }
[ "static void FUNC_0(SCSICommand *VAR_0)\n{", "if (!VAR_0->xfer) {", "VAR_0->mode = SCSI_XFER_NONE;", "return;", "}", "switch (VAR_0->buf[0]) {", "case WRITE_6:\ncase WRITE_10:\ncase WRITE_VERIFY_10:\ncase WRITE_12:\ncase WRITE_VERIFY_12:\ncase WRITE_16:\ncase WRITE_VERIFY_16:\ncase COPY:\ncase COPY_VERIFY:\ncase COMPARE:\ncase CHANGE_DEFINITION:\ncase LOG_SELECT:\ncase MODE_SELECT:\ncase MODE_SELECT_10:\ncase SEND_DIAGNOSTIC:\ncase WRITE_BUFFER:\ncase FORMAT_UNIT:\ncase REASSIGN_BLOCKS:\ncase SEARCH_EQUAL:\ncase SEARCH_HIGH:\ncase SEARCH_LOW:\ncase UPDATE_BLOCK:\ncase WRITE_LONG_10:\ncase WRITE_SAME_10:\ncase WRITE_SAME_16:\ncase UNMAP:\ncase SEARCH_HIGH_12:\ncase SEARCH_EQUAL_12:\ncase SEARCH_LOW_12:\ncase MEDIUM_SCAN:\ncase SEND_VOLUME_TAG:\ncase SEND_CUE_SHEET:\ncase SEND_DVD_STRUCTURE:\ncase PERSISTENT_RESERVE_OUT:\ncase MAINTENANCE_OUT:\nVAR_0->mode = SCSI_XFER_TO_DEV;", "break;", "default:\nVAR_0->mode = SCSI_XFER_FROM_DEV;", "break;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 86 ], [ 88 ], [ 90, 92 ], [ 94 ], [ 96 ], [ 98 ] ]
14,013
static void test_visitor_in_union_flat(TestInputVisitorData *data, const void *unused) { Visitor *v; UserDefFlatUnion *tmp; UserDefUnionBase *base; v = visitor_input_test_init(data, "{ 'enum1': 'value1', " "'integer': 41, " "'string': 'str', " "'boolean': true }"); visit_type_UserDefFlatUnion(v, NULL, &tmp, &error_abort); g_assert_cmpint(tmp->enum1, ==, ENUM_ONE_VALUE1); g_assert_cmpstr(tmp->string, ==, "str"); g_assert_cmpint(tmp->integer, ==, 41); g_assert_cmpint(tmp->u.value1->boolean, ==, true); base = qapi_UserDefFlatUnion_base(tmp); g_assert(&base->enum1 == &tmp->enum1); qapi_free_UserDefFlatUnion(tmp); }
true
qemu
544a3731591f5d53e15f22de00ce5ac758d490b3
static void test_visitor_in_union_flat(TestInputVisitorData *data, const void *unused) { Visitor *v; UserDefFlatUnion *tmp; UserDefUnionBase *base; v = visitor_input_test_init(data, "{ 'enum1': 'value1', " "'integer': 41, " "'string': 'str', " "'boolean': true }"); visit_type_UserDefFlatUnion(v, NULL, &tmp, &error_abort); g_assert_cmpint(tmp->enum1, ==, ENUM_ONE_VALUE1); g_assert_cmpstr(tmp->string, ==, "str"); g_assert_cmpint(tmp->integer, ==, 41); g_assert_cmpint(tmp->u.value1->boolean, ==, true); base = qapi_UserDefFlatUnion_base(tmp); g_assert(&base->enum1 == &tmp->enum1); qapi_free_UserDefFlatUnion(tmp); }
{ "code": [ " g_assert_cmpint(tmp->u.value1->boolean, ==, true);" ], "line_no": [ 35 ] }
static void FUNC_0(TestInputVisitorData *VAR_0, const void *VAR_1) { Visitor *v; UserDefFlatUnion *tmp; UserDefUnionBase *base; v = visitor_input_test_init(VAR_0, "{ 'enum1': 'value1', " "'integer': 41, " "'string': 'str', " "'boolean': true }"); visit_type_UserDefFlatUnion(v, NULL, &tmp, &error_abort); g_assert_cmpint(tmp->enum1, ==, ENUM_ONE_VALUE1); g_assert_cmpstr(tmp->string, ==, "str"); g_assert_cmpint(tmp->integer, ==, 41); g_assert_cmpint(tmp->u.value1->boolean, ==, true); base = qapi_UserDefFlatUnion_base(tmp); g_assert(&base->enum1 == &tmp->enum1); qapi_free_UserDefFlatUnion(tmp); }
[ "static void FUNC_0(TestInputVisitorData *VAR_0,\nconst void *VAR_1)\n{", "Visitor *v;", "UserDefFlatUnion *tmp;", "UserDefUnionBase *base;", "v = visitor_input_test_init(VAR_0,\n\"{ 'enum1': 'value1', \"", "\"'integer': 41, \"\n\"'string': 'str', \"\n\"'boolean': true }\");", "visit_type_UserDefFlatUnion(v, NULL, &tmp, &error_abort);", "g_assert_cmpint(tmp->enum1, ==, ENUM_ONE_VALUE1);", "g_assert_cmpstr(tmp->string, ==, \"str\");", "g_assert_cmpint(tmp->integer, ==, 41);", "g_assert_cmpint(tmp->u.value1->boolean, ==, true);", "base = qapi_UserDefFlatUnion_base(tmp);", "g_assert(&base->enum1 == &tmp->enum1);", "qapi_free_UserDefFlatUnion(tmp);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15, 17 ], [ 19, 21, 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ] ]
14,015
static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap) { AVIOContext *pb = s->pb; APEContext *ape = s->priv_data; AVStream *st; uint32_t tag; int i; int total_blocks; int64_t pts; /* TODO: Skip any leading junk such as id3v2 tags */ ape->junklength = 0; tag = avio_rl32(pb); if (tag != MKTAG('M', 'A', 'C', ' ')) return -1; ape->fileversion = avio_rl16(pb); if (ape->fileversion < APE_MIN_VERSION || ape->fileversion > APE_MAX_VERSION) { av_log(s, AV_LOG_ERROR, "Unsupported file version - %d.%02d\n", ape->fileversion / 1000, (ape->fileversion % 1000) / 10); return -1; if (ape->fileversion >= 3980) { ape->padding1 = avio_rl16(pb); ape->descriptorlength = avio_rl32(pb); ape->headerlength = avio_rl32(pb); ape->seektablelength = avio_rl32(pb); ape->wavheaderlength = avio_rl32(pb); ape->audiodatalength = avio_rl32(pb); ape->audiodatalength_high = avio_rl32(pb); ape->wavtaillength = avio_rl32(pb); avio_read(pb, ape->md5, 16); /* Skip any unknown bytes at the end of the descriptor. This is for future compatibility */ if (ape->descriptorlength > 52) avio_seek(pb, ape->descriptorlength - 52, SEEK_CUR); /* Read header data */ ape->compressiontype = avio_rl16(pb); ape->formatflags = avio_rl16(pb); ape->blocksperframe = avio_rl32(pb); ape->finalframeblocks = avio_rl32(pb); ape->totalframes = avio_rl32(pb); ape->bps = avio_rl16(pb); ape->channels = avio_rl16(pb); ape->samplerate = avio_rl32(pb); } else { ape->descriptorlength = 0; ape->headerlength = 32; ape->compressiontype = avio_rl16(pb); ape->formatflags = avio_rl16(pb); ape->channels = avio_rl16(pb); ape->samplerate = avio_rl32(pb); ape->wavheaderlength = avio_rl32(pb); ape->wavtaillength = avio_rl32(pb); ape->totalframes = avio_rl32(pb); ape->finalframeblocks = avio_rl32(pb); if (ape->formatflags & MAC_FORMAT_FLAG_HAS_PEAK_LEVEL) { avio_seek(pb, 4, SEEK_CUR); /* Skip the peak level */ ape->headerlength += 4; if (ape->formatflags & MAC_FORMAT_FLAG_HAS_SEEK_ELEMENTS) { ape->seektablelength = avio_rl32(pb); ape->headerlength += 4; ape->seektablelength *= sizeof(int32_t); } else ape->seektablelength = ape->totalframes * sizeof(int32_t); if (ape->formatflags & MAC_FORMAT_FLAG_8_BIT) ape->bps = 8; else if (ape->formatflags & MAC_FORMAT_FLAG_24_BIT) ape->bps = 24; else ape->bps = 16; if (ape->fileversion >= 3950) ape->blocksperframe = 73728 * 4; else if (ape->fileversion >= 3900 || (ape->fileversion >= 3800 && ape->compressiontype >= 4000)) ape->blocksperframe = 73728; else ape->blocksperframe = 9216; /* Skip any stored wav header */ if (!(ape->formatflags & MAC_FORMAT_FLAG_CREATE_WAV_HEADER)) avio_seek(pb, ape->wavheaderlength, SEEK_CUR); if(ape->totalframes > UINT_MAX / sizeof(APEFrame)){ av_log(s, AV_LOG_ERROR, "Too many frames: %d\n", ape->totalframes); return -1; ape->frames = av_malloc(ape->totalframes * sizeof(APEFrame)); if(!ape->frames) return AVERROR(ENOMEM); ape->firstframe = ape->junklength + ape->descriptorlength + ape->headerlength + ape->seektablelength + ape->wavheaderlength; ape->currentframe = 0; ape->totalsamples = ape->finalframeblocks; if (ape->totalframes > 1) ape->totalsamples += ape->blocksperframe * (ape->totalframes - 1); if (ape->seektablelength > 0) { ape->seektable = av_malloc(ape->seektablelength); for (i = 0; i < ape->seektablelength / sizeof(uint32_t); i++) ape->seektable[i] = avio_rl32(pb); ape->frames[0].pos = ape->firstframe; ape->frames[0].nblocks = ape->blocksperframe; ape->frames[0].skip = 0; for (i = 1; i < ape->totalframes; i++) { ape->frames[i].pos = ape->seektable[i]; //ape->frames[i-1].pos + ape->blocksperframe; ape->frames[i].nblocks = ape->blocksperframe; ape->frames[i - 1].size = ape->frames[i].pos - ape->frames[i - 1].pos; ape->frames[i].skip = (ape->frames[i].pos - ape->frames[0].pos) & 3; ape->frames[ape->totalframes - 1].size = ape->finalframeblocks * 4; ape->frames[ape->totalframes - 1].nblocks = ape->finalframeblocks; for (i = 0; i < ape->totalframes; i++) { if(ape->frames[i].skip){ ape->frames[i].pos -= ape->frames[i].skip; ape->frames[i].size += ape->frames[i].skip; ape->frames[i].size = (ape->frames[i].size + 3) & ~3; ape_dumpinfo(s, ape); /* try to read APE tags */ if (!url_is_streamed(pb)) { ff_ape_parse_tag(s); avio_seek(pb, 0, SEEK_SET); av_log(s, AV_LOG_DEBUG, "Decoding file - v%d.%02d, compression level %d\n", ape->fileversion / 1000, (ape->fileversion % 1000) / 10, ape->compressiontype); /* now we are ready: build format streams */ st = av_new_stream(s, 0); if (!st) return -1; total_blocks = (ape->totalframes == 0) ? 0 : ((ape->totalframes - 1) * ape->blocksperframe) + ape->finalframeblocks; st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_id = CODEC_ID_APE; st->codec->codec_tag = MKTAG('A', 'P', 'E', ' '); st->codec->channels = ape->channels; st->codec->sample_rate = ape->samplerate; st->codec->bits_per_coded_sample = ape->bps; st->codec->frame_size = MAC_SUBFRAME_SIZE; st->nb_frames = ape->totalframes; st->start_time = 0; st->duration = total_blocks / MAC_SUBFRAME_SIZE; av_set_pts_info(st, 64, MAC_SUBFRAME_SIZE, ape->samplerate); st->codec->extradata = av_malloc(APE_EXTRADATA_SIZE); st->codec->extradata_size = APE_EXTRADATA_SIZE; AV_WL16(st->codec->extradata + 0, ape->fileversion); AV_WL16(st->codec->extradata + 2, ape->compressiontype); AV_WL16(st->codec->extradata + 4, ape->formatflags); pts = 0; for (i = 0; i < ape->totalframes; i++) { ape->frames[i].pts = pts; av_add_index_entry(st, ape->frames[i].pos, ape->frames[i].pts, 0, 0, AVINDEX_KEYFRAME); pts += ape->blocksperframe / MAC_SUBFRAME_SIZE; return 0;
true
FFmpeg
1c31b26bdf66879a46a7a3e340da815c1b2125a8
static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap) { AVIOContext *pb = s->pb; APEContext *ape = s->priv_data; AVStream *st; uint32_t tag; int i; int total_blocks; int64_t pts; ape->junklength = 0; tag = avio_rl32(pb); if (tag != MKTAG('M', 'A', 'C', ' ')) return -1; ape->fileversion = avio_rl16(pb); if (ape->fileversion < APE_MIN_VERSION || ape->fileversion > APE_MAX_VERSION) { av_log(s, AV_LOG_ERROR, "Unsupported file version - %d.%02d\n", ape->fileversion / 1000, (ape->fileversion % 1000) / 10); return -1; if (ape->fileversion >= 3980) { ape->padding1 = avio_rl16(pb); ape->descriptorlength = avio_rl32(pb); ape->headerlength = avio_rl32(pb); ape->seektablelength = avio_rl32(pb); ape->wavheaderlength = avio_rl32(pb); ape->audiodatalength = avio_rl32(pb); ape->audiodatalength_high = avio_rl32(pb); ape->wavtaillength = avio_rl32(pb); avio_read(pb, ape->md5, 16); if (ape->descriptorlength > 52) avio_seek(pb, ape->descriptorlength - 52, SEEK_CUR); ape->compressiontype = avio_rl16(pb); ape->formatflags = avio_rl16(pb); ape->blocksperframe = avio_rl32(pb); ape->finalframeblocks = avio_rl32(pb); ape->totalframes = avio_rl32(pb); ape->bps = avio_rl16(pb); ape->channels = avio_rl16(pb); ape->samplerate = avio_rl32(pb); } else { ape->descriptorlength = 0; ape->headerlength = 32; ape->compressiontype = avio_rl16(pb); ape->formatflags = avio_rl16(pb); ape->channels = avio_rl16(pb); ape->samplerate = avio_rl32(pb); ape->wavheaderlength = avio_rl32(pb); ape->wavtaillength = avio_rl32(pb); ape->totalframes = avio_rl32(pb); ape->finalframeblocks = avio_rl32(pb); if (ape->formatflags & MAC_FORMAT_FLAG_HAS_PEAK_LEVEL) { avio_seek(pb, 4, SEEK_CUR); ape->headerlength += 4; if (ape->formatflags & MAC_FORMAT_FLAG_HAS_SEEK_ELEMENTS) { ape->seektablelength = avio_rl32(pb); ape->headerlength += 4; ape->seektablelength *= sizeof(int32_t); } else ape->seektablelength = ape->totalframes * sizeof(int32_t); if (ape->formatflags & MAC_FORMAT_FLAG_8_BIT) ape->bps = 8; else if (ape->formatflags & MAC_FORMAT_FLAG_24_BIT) ape->bps = 24; else ape->bps = 16; if (ape->fileversion >= 3950) ape->blocksperframe = 73728 * 4; else if (ape->fileversion >= 3900 || (ape->fileversion >= 3800 && ape->compressiontype >= 4000)) ape->blocksperframe = 73728; else ape->blocksperframe = 9216; if (!(ape->formatflags & MAC_FORMAT_FLAG_CREATE_WAV_HEADER)) avio_seek(pb, ape->wavheaderlength, SEEK_CUR); if(ape->totalframes > UINT_MAX / sizeof(APEFrame)){ av_log(s, AV_LOG_ERROR, "Too many frames: %d\n", ape->totalframes); return -1; ape->frames = av_malloc(ape->totalframes * sizeof(APEFrame)); if(!ape->frames) return AVERROR(ENOMEM); ape->firstframe = ape->junklength + ape->descriptorlength + ape->headerlength + ape->seektablelength + ape->wavheaderlength; ape->currentframe = 0; ape->totalsamples = ape->finalframeblocks; if (ape->totalframes > 1) ape->totalsamples += ape->blocksperframe * (ape->totalframes - 1); if (ape->seektablelength > 0) { ape->seektable = av_malloc(ape->seektablelength); for (i = 0; i < ape->seektablelength / sizeof(uint32_t); i++) ape->seektable[i] = avio_rl32(pb); ape->frames[0].pos = ape->firstframe; ape->frames[0].nblocks = ape->blocksperframe; ape->frames[0].skip = 0; for (i = 1; i < ape->totalframes; i++) { ape->frames[i].pos = ape->seektable[i]; ape->frames[i].nblocks = ape->blocksperframe; ape->frames[i - 1].size = ape->frames[i].pos - ape->frames[i - 1].pos; ape->frames[i].skip = (ape->frames[i].pos - ape->frames[0].pos) & 3; ape->frames[ape->totalframes - 1].size = ape->finalframeblocks * 4; ape->frames[ape->totalframes - 1].nblocks = ape->finalframeblocks; for (i = 0; i < ape->totalframes; i++) { if(ape->frames[i].skip){ ape->frames[i].pos -= ape->frames[i].skip; ape->frames[i].size += ape->frames[i].skip; ape->frames[i].size = (ape->frames[i].size + 3) & ~3; ape_dumpinfo(s, ape); if (!url_is_streamed(pb)) { ff_ape_parse_tag(s); avio_seek(pb, 0, SEEK_SET); av_log(s, AV_LOG_DEBUG, "Decoding file - v%d.%02d, compression level %d\n", ape->fileversion / 1000, (ape->fileversion % 1000) / 10, ape->compressiontype); st = av_new_stream(s, 0); if (!st) return -1; total_blocks = (ape->totalframes == 0) ? 0 : ((ape->totalframes - 1) * ape->blocksperframe) + ape->finalframeblocks; st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_id = CODEC_ID_APE; st->codec->codec_tag = MKTAG('A', 'P', 'E', ' '); st->codec->channels = ape->channels; st->codec->sample_rate = ape->samplerate; st->codec->bits_per_coded_sample = ape->bps; st->codec->frame_size = MAC_SUBFRAME_SIZE; st->nb_frames = ape->totalframes; st->start_time = 0; st->duration = total_blocks / MAC_SUBFRAME_SIZE; av_set_pts_info(st, 64, MAC_SUBFRAME_SIZE, ape->samplerate); st->codec->extradata = av_malloc(APE_EXTRADATA_SIZE); st->codec->extradata_size = APE_EXTRADATA_SIZE; AV_WL16(st->codec->extradata + 0, ape->fileversion); AV_WL16(st->codec->extradata + 2, ape->compressiontype); AV_WL16(st->codec->extradata + 4, ape->formatflags); pts = 0; for (i = 0; i < ape->totalframes; i++) { ape->frames[i].pts = pts; av_add_index_entry(st, ape->frames[i].pos, ape->frames[i].pts, 0, 0, AVINDEX_KEYFRAME); pts += ape->blocksperframe / MAC_SUBFRAME_SIZE; return 0;
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext * VAR_0, AVFormatParameters * VAR_1) { AVIOContext *pb = VAR_0->pb; APEContext *ape = VAR_0->priv_data; AVStream *st; uint32_t tag; int VAR_2; int VAR_3; int64_t pts; ape->junklength = 0; tag = avio_rl32(pb); if (tag != MKTAG('M', 'A', 'C', ' ')) return -1; ape->fileversion = avio_rl16(pb); if (ape->fileversion < APE_MIN_VERSION || ape->fileversion > APE_MAX_VERSION) { av_log(VAR_0, AV_LOG_ERROR, "Unsupported file version - %d.%02d\n", ape->fileversion / 1000, (ape->fileversion % 1000) / 10); return -1; if (ape->fileversion >= 3980) { ape->padding1 = avio_rl16(pb); ape->descriptorlength = avio_rl32(pb); ape->headerlength = avio_rl32(pb); ape->seektablelength = avio_rl32(pb); ape->wavheaderlength = avio_rl32(pb); ape->audiodatalength = avio_rl32(pb); ape->audiodatalength_high = avio_rl32(pb); ape->wavtaillength = avio_rl32(pb); avio_read(pb, ape->md5, 16); if (ape->descriptorlength > 52) avio_seek(pb, ape->descriptorlength - 52, SEEK_CUR); ape->compressiontype = avio_rl16(pb); ape->formatflags = avio_rl16(pb); ape->blocksperframe = avio_rl32(pb); ape->finalframeblocks = avio_rl32(pb); ape->totalframes = avio_rl32(pb); ape->bps = avio_rl16(pb); ape->channels = avio_rl16(pb); ape->samplerate = avio_rl32(pb); } else { ape->descriptorlength = 0; ape->headerlength = 32; ape->compressiontype = avio_rl16(pb); ape->formatflags = avio_rl16(pb); ape->channels = avio_rl16(pb); ape->samplerate = avio_rl32(pb); ape->wavheaderlength = avio_rl32(pb); ape->wavtaillength = avio_rl32(pb); ape->totalframes = avio_rl32(pb); ape->finalframeblocks = avio_rl32(pb); if (ape->formatflags & MAC_FORMAT_FLAG_HAS_PEAK_LEVEL) { avio_seek(pb, 4, SEEK_CUR); ape->headerlength += 4; if (ape->formatflags & MAC_FORMAT_FLAG_HAS_SEEK_ELEMENTS) { ape->seektablelength = avio_rl32(pb); ape->headerlength += 4; ape->seektablelength *= sizeof(int32_t); } else ape->seektablelength = ape->totalframes * sizeof(int32_t); if (ape->formatflags & MAC_FORMAT_FLAG_8_BIT) ape->bps = 8; else if (ape->formatflags & MAC_FORMAT_FLAG_24_BIT) ape->bps = 24; else ape->bps = 16; if (ape->fileversion >= 3950) ape->blocksperframe = 73728 * 4; else if (ape->fileversion >= 3900 || (ape->fileversion >= 3800 && ape->compressiontype >= 4000)) ape->blocksperframe = 73728; else ape->blocksperframe = 9216; if (!(ape->formatflags & MAC_FORMAT_FLAG_CREATE_WAV_HEADER)) avio_seek(pb, ape->wavheaderlength, SEEK_CUR); if(ape->totalframes > UINT_MAX / sizeof(APEFrame)){ av_log(VAR_0, AV_LOG_ERROR, "Too many frames: %d\n", ape->totalframes); return -1; ape->frames = av_malloc(ape->totalframes * sizeof(APEFrame)); if(!ape->frames) return AVERROR(ENOMEM); ape->firstframe = ape->junklength + ape->descriptorlength + ape->headerlength + ape->seektablelength + ape->wavheaderlength; ape->currentframe = 0; ape->totalsamples = ape->finalframeblocks; if (ape->totalframes > 1) ape->totalsamples += ape->blocksperframe * (ape->totalframes - 1); if (ape->seektablelength > 0) { ape->seektable = av_malloc(ape->seektablelength); for (VAR_2 = 0; VAR_2 < ape->seektablelength / sizeof(uint32_t); VAR_2++) ape->seektable[VAR_2] = avio_rl32(pb); ape->frames[0].pos = ape->firstframe; ape->frames[0].nblocks = ape->blocksperframe; ape->frames[0].skip = 0; for (VAR_2 = 1; VAR_2 < ape->totalframes; VAR_2++) { ape->frames[VAR_2].pos = ape->seektable[VAR_2]; ape->frames[VAR_2].nblocks = ape->blocksperframe; ape->frames[VAR_2 - 1].size = ape->frames[VAR_2].pos - ape->frames[VAR_2 - 1].pos; ape->frames[VAR_2].skip = (ape->frames[VAR_2].pos - ape->frames[0].pos) & 3; ape->frames[ape->totalframes - 1].size = ape->finalframeblocks * 4; ape->frames[ape->totalframes - 1].nblocks = ape->finalframeblocks; for (VAR_2 = 0; VAR_2 < ape->totalframes; VAR_2++) { if(ape->frames[VAR_2].skip){ ape->frames[VAR_2].pos -= ape->frames[VAR_2].skip; ape->frames[VAR_2].size += ape->frames[VAR_2].skip; ape->frames[VAR_2].size = (ape->frames[VAR_2].size + 3) & ~3; ape_dumpinfo(VAR_0, ape); if (!url_is_streamed(pb)) { ff_ape_parse_tag(VAR_0); avio_seek(pb, 0, SEEK_SET); av_log(VAR_0, AV_LOG_DEBUG, "Decoding file - v%d.%02d, compression level %d\n", ape->fileversion / 1000, (ape->fileversion % 1000) / 10, ape->compressiontype); st = av_new_stream(VAR_0, 0); if (!st) return -1; VAR_3 = (ape->totalframes == 0) ? 0 : ((ape->totalframes - 1) * ape->blocksperframe) + ape->finalframeblocks; st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_id = CODEC_ID_APE; st->codec->codec_tag = MKTAG('A', 'P', 'E', ' '); st->codec->channels = ape->channels; st->codec->sample_rate = ape->samplerate; st->codec->bits_per_coded_sample = ape->bps; st->codec->frame_size = MAC_SUBFRAME_SIZE; st->nb_frames = ape->totalframes; st->start_time = 0; st->duration = VAR_3 / MAC_SUBFRAME_SIZE; av_set_pts_info(st, 64, MAC_SUBFRAME_SIZE, ape->samplerate); st->codec->extradata = av_malloc(APE_EXTRADATA_SIZE); st->codec->extradata_size = APE_EXTRADATA_SIZE; AV_WL16(st->codec->extradata + 0, ape->fileversion); AV_WL16(st->codec->extradata + 2, ape->compressiontype); AV_WL16(st->codec->extradata + 4, ape->formatflags); pts = 0; for (VAR_2 = 0; VAR_2 < ape->totalframes; VAR_2++) { ape->frames[VAR_2].pts = pts; av_add_index_entry(st, ape->frames[VAR_2].pos, ape->frames[VAR_2].pts, 0, 0, AVINDEX_KEYFRAME); pts += ape->blocksperframe / MAC_SUBFRAME_SIZE; return 0;
[ "static int FUNC_0(AVFormatContext * VAR_0, AVFormatParameters * VAR_1)\n{", "AVIOContext *pb = VAR_0->pb;", "APEContext *ape = VAR_0->priv_data;", "AVStream *st;", "uint32_t tag;", "int VAR_2;", "int VAR_3;", "int64_t pts;", "ape->junklength = 0;", "tag = avio_rl32(pb);", "if (tag != MKTAG('M', 'A', 'C', ' '))\nreturn -1;", "ape->fileversion = avio_rl16(pb);", "if (ape->fileversion < APE_MIN_VERSION || ape->fileversion > APE_MAX_VERSION) {", "av_log(VAR_0, AV_LOG_ERROR, \"Unsupported file version - %d.%02d\\n\", ape->fileversion / 1000, (ape->fileversion % 1000) / 10);", "return -1;", "if (ape->fileversion >= 3980) {", "ape->padding1 = avio_rl16(pb);", "ape->descriptorlength = avio_rl32(pb);", "ape->headerlength = avio_rl32(pb);", "ape->seektablelength = avio_rl32(pb);", "ape->wavheaderlength = avio_rl32(pb);", "ape->audiodatalength = avio_rl32(pb);", "ape->audiodatalength_high = avio_rl32(pb);", "ape->wavtaillength = avio_rl32(pb);", "avio_read(pb, ape->md5, 16);", "if (ape->descriptorlength > 52)\navio_seek(pb, ape->descriptorlength - 52, SEEK_CUR);", "ape->compressiontype = avio_rl16(pb);", "ape->formatflags = avio_rl16(pb);", "ape->blocksperframe = avio_rl32(pb);", "ape->finalframeblocks = avio_rl32(pb);", "ape->totalframes = avio_rl32(pb);", "ape->bps = avio_rl16(pb);", "ape->channels = avio_rl16(pb);", "ape->samplerate = avio_rl32(pb);", "} else {", "ape->descriptorlength = 0;", "ape->headerlength = 32;", "ape->compressiontype = avio_rl16(pb);", "ape->formatflags = avio_rl16(pb);", "ape->channels = avio_rl16(pb);", "ape->samplerate = avio_rl32(pb);", "ape->wavheaderlength = avio_rl32(pb);", "ape->wavtaillength = avio_rl32(pb);", "ape->totalframes = avio_rl32(pb);", "ape->finalframeblocks = avio_rl32(pb);", "if (ape->formatflags & MAC_FORMAT_FLAG_HAS_PEAK_LEVEL) {", "avio_seek(pb, 4, SEEK_CUR);", "ape->headerlength += 4;", "if (ape->formatflags & MAC_FORMAT_FLAG_HAS_SEEK_ELEMENTS) {", "ape->seektablelength = avio_rl32(pb);", "ape->headerlength += 4;", "ape->seektablelength *= sizeof(int32_t);", "} else", "ape->seektablelength = ape->totalframes * sizeof(int32_t);", "if (ape->formatflags & MAC_FORMAT_FLAG_8_BIT)\nape->bps = 8;", "else if (ape->formatflags & MAC_FORMAT_FLAG_24_BIT)\nape->bps = 24;", "else\nape->bps = 16;", "if (ape->fileversion >= 3950)\nape->blocksperframe = 73728 * 4;", "else if (ape->fileversion >= 3900 || (ape->fileversion >= 3800 && ape->compressiontype >= 4000))\nape->blocksperframe = 73728;", "else\nape->blocksperframe = 9216;", "if (!(ape->formatflags & MAC_FORMAT_FLAG_CREATE_WAV_HEADER))\navio_seek(pb, ape->wavheaderlength, SEEK_CUR);", "if(ape->totalframes > UINT_MAX / sizeof(APEFrame)){", "av_log(VAR_0, AV_LOG_ERROR, \"Too many frames: %d\\n\", ape->totalframes);", "return -1;", "ape->frames = av_malloc(ape->totalframes * sizeof(APEFrame));", "if(!ape->frames)\nreturn AVERROR(ENOMEM);", "ape->firstframe = ape->junklength + ape->descriptorlength + ape->headerlength + ape->seektablelength + ape->wavheaderlength;", "ape->currentframe = 0;", "ape->totalsamples = ape->finalframeblocks;", "if (ape->totalframes > 1)\nape->totalsamples += ape->blocksperframe * (ape->totalframes - 1);", "if (ape->seektablelength > 0) {", "ape->seektable = av_malloc(ape->seektablelength);", "for (VAR_2 = 0; VAR_2 < ape->seektablelength / sizeof(uint32_t); VAR_2++)", "ape->seektable[VAR_2] = avio_rl32(pb);", "ape->frames[0].pos = ape->firstframe;", "ape->frames[0].nblocks = ape->blocksperframe;", "ape->frames[0].skip = 0;", "for (VAR_2 = 1; VAR_2 < ape->totalframes; VAR_2++) {", "ape->frames[VAR_2].pos = ape->seektable[VAR_2];", "ape->frames[VAR_2].nblocks = ape->blocksperframe;", "ape->frames[VAR_2 - 1].size = ape->frames[VAR_2].pos - ape->frames[VAR_2 - 1].pos;", "ape->frames[VAR_2].skip = (ape->frames[VAR_2].pos - ape->frames[0].pos) & 3;", "ape->frames[ape->totalframes - 1].size = ape->finalframeblocks * 4;", "ape->frames[ape->totalframes - 1].nblocks = ape->finalframeblocks;", "for (VAR_2 = 0; VAR_2 < ape->totalframes; VAR_2++) {", "if(ape->frames[VAR_2].skip){", "ape->frames[VAR_2].pos -= ape->frames[VAR_2].skip;", "ape->frames[VAR_2].size += ape->frames[VAR_2].skip;", "ape->frames[VAR_2].size = (ape->frames[VAR_2].size + 3) & ~3;", "ape_dumpinfo(VAR_0, ape);", "if (!url_is_streamed(pb)) {", "ff_ape_parse_tag(VAR_0);", "avio_seek(pb, 0, SEEK_SET);", "av_log(VAR_0, AV_LOG_DEBUG, \"Decoding file - v%d.%02d, compression level %d\\n\", ape->fileversion / 1000, (ape->fileversion % 1000) / 10, ape->compressiontype);", "st = av_new_stream(VAR_0, 0);", "if (!st)\nreturn -1;", "VAR_3 = (ape->totalframes == 0) ? 0 : ((ape->totalframes - 1) * ape->blocksperframe) + ape->finalframeblocks;", "st->codec->codec_type = AVMEDIA_TYPE_AUDIO;", "st->codec->codec_id = CODEC_ID_APE;", "st->codec->codec_tag = MKTAG('A', 'P', 'E', ' ');", "st->codec->channels = ape->channels;", "st->codec->sample_rate = ape->samplerate;", "st->codec->bits_per_coded_sample = ape->bps;", "st->codec->frame_size = MAC_SUBFRAME_SIZE;", "st->nb_frames = ape->totalframes;", "st->start_time = 0;", "st->duration = VAR_3 / MAC_SUBFRAME_SIZE;", "av_set_pts_info(st, 64, MAC_SUBFRAME_SIZE, ape->samplerate);", "st->codec->extradata = av_malloc(APE_EXTRADATA_SIZE);", "st->codec->extradata_size = APE_EXTRADATA_SIZE;", "AV_WL16(st->codec->extradata + 0, ape->fileversion);", "AV_WL16(st->codec->extradata + 2, ape->compressiontype);", "AV_WL16(st->codec->extradata + 4, ape->formatflags);", "pts = 0;", "for (VAR_2 = 0; VAR_2 < ape->totalframes; VAR_2++) {", "ape->frames[VAR_2].pts = pts;", "av_add_index_entry(st, ape->frames[VAR_2].pos, ape->frames[VAR_2].pts, 0, 0, AVINDEX_KEYFRAME);", "pts += ape->blocksperframe / MAC_SUBFRAME_SIZE;", "return 0;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 23 ], [ 27 ], [ 29, 31 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 48 ], [ 50 ], [ 52 ], [ 54 ], [ 56 ], [ 58 ], [ 60 ], [ 62 ], [ 64 ], [ 66 ], [ 74, 76 ], [ 82 ], [ 84 ], [ 86 ], [ 88 ], [ 90 ], [ 92 ], [ 94 ], [ 96 ], [ 98 ], [ 100 ], [ 102 ], [ 106 ], [ 108 ], [ 110 ], [ 112 ], [ 114 ], [ 116 ], [ 118 ], [ 120 ], [ 124 ], [ 126 ], [ 128 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 147, 149 ], [ 151, 153 ], [ 155, 157 ], [ 161, 163 ], [ 165, 167 ], [ 169, 171 ], [ 177, 179 ], [ 188 ], [ 190 ], [ 192 ], [ 195 ], [ 197, 199 ], [ 201 ], [ 203 ], [ 209 ], [ 211, 213 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 228 ], [ 230 ], [ 232 ], [ 234 ], [ 236 ], [ 238 ], [ 240 ], [ 242 ], [ 245 ], [ 247 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 260 ], [ 267 ], [ 273 ], [ 275 ], [ 277 ], [ 282 ], [ 288 ], [ 290, 292 ], [ 296 ], [ 300 ], [ 302 ], [ 304 ], [ 306 ], [ 308 ], [ 310 ], [ 312 ], [ 316 ], [ 318 ], [ 320 ], [ 322 ], [ 326 ], [ 328 ], [ 330 ], [ 332 ], [ 334 ], [ 338 ], [ 340 ], [ 342 ], [ 344 ], [ 346 ], [ 351 ] ]
14,016
static int buf_close(void *opaque) { QEMUBuffer *s = opaque; qsb_free(s->qsb); g_free(s); return 0; }
true
qemu
60fe637bf0e4d7989e21e50f52526444765c63b4
static int buf_close(void *opaque) { QEMUBuffer *s = opaque; qsb_free(s->qsb); g_free(s); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(void *VAR_0) { QEMUBuffer *s = VAR_0; qsb_free(s->qsb); g_free(s); return 0; }
[ "static int FUNC_0(void *VAR_0)\n{", "QEMUBuffer *s = VAR_0;", "qsb_free(s->qsb);", "g_free(s);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 13 ], [ 17 ], [ 19 ] ]
14,017
static const struct URLProtocol *url_find_protocol(const char *filename) { const URLProtocol **protocols; char proto_str[128], proto_nested[128], *ptr; size_t proto_len = strspn(filename, URL_SCHEME_CHARS); int i; if (filename[proto_len] != ':' && (strncmp(filename, "subfile,", 8) || !strchr(filename + proto_len + 1, ':')) || is_dos_path(filename)) strcpy(proto_str, "file"); else av_strlcpy(proto_str, filename, FFMIN(proto_len + 1, sizeof(proto_str))); if ((ptr = strchr(proto_str, ','))) *ptr = '\0'; av_strlcpy(proto_nested, proto_str, sizeof(proto_nested)); if ((ptr = strchr(proto_nested, '+'))) *ptr = '\0'; protocols = ffurl_get_protocols(NULL, NULL); for (i = 0; protocols[i]; i++) { const URLProtocol *up = protocols[i]; if (!strcmp(proto_str, up->name)) { av_freep(&protocols); return up; } if (up->flags & URL_PROTOCOL_FLAG_NESTED_SCHEME && !strcmp(proto_nested, up->name)) { av_freep(&protocols); return up; } } av_freep(&protocols); }
true
FFmpeg
936751b6527cff789ef077a4e43a04ae9e658232
static const struct URLProtocol *url_find_protocol(const char *filename) { const URLProtocol **protocols; char proto_str[128], proto_nested[128], *ptr; size_t proto_len = strspn(filename, URL_SCHEME_CHARS); int i; if (filename[proto_len] != ':' && (strncmp(filename, "subfile,", 8) || !strchr(filename + proto_len + 1, ':')) || is_dos_path(filename)) strcpy(proto_str, "file"); else av_strlcpy(proto_str, filename, FFMIN(proto_len + 1, sizeof(proto_str))); if ((ptr = strchr(proto_str, ','))) *ptr = '\0'; av_strlcpy(proto_nested, proto_str, sizeof(proto_nested)); if ((ptr = strchr(proto_nested, '+'))) *ptr = '\0'; protocols = ffurl_get_protocols(NULL, NULL); for (i = 0; protocols[i]; i++) { const URLProtocol *up = protocols[i]; if (!strcmp(proto_str, up->name)) { av_freep(&protocols); return up; } if (up->flags & URL_PROTOCOL_FLAG_NESTED_SCHEME && !strcmp(proto_nested, up->name)) { av_freep(&protocols); return up; } } av_freep(&protocols); }
{ "code": [], "line_no": [] }
static const struct URLProtocol *FUNC_0(const char *VAR_0) { const URLProtocol **VAR_1; char VAR_2[128], VAR_3[128], *VAR_4; size_t proto_len = strspn(VAR_0, URL_SCHEME_CHARS); int VAR_5; if (VAR_0[proto_len] != ':' && (strncmp(VAR_0, "subfile,", 8) || !strchr(VAR_0 + proto_len + 1, ':')) || is_dos_path(VAR_0)) strcpy(VAR_2, "file"); else av_strlcpy(VAR_2, VAR_0, FFMIN(proto_len + 1, sizeof(VAR_2))); if ((VAR_4 = strchr(VAR_2, ','))) *VAR_4 = '\0'; av_strlcpy(VAR_3, VAR_2, sizeof(VAR_3)); if ((VAR_4 = strchr(VAR_3, '+'))) *VAR_4 = '\0'; VAR_1 = ffurl_get_protocols(NULL, NULL); for (VAR_5 = 0; VAR_1[VAR_5]; VAR_5++) { const URLProtocol *VAR_6 = VAR_1[VAR_5]; if (!strcmp(VAR_2, VAR_6->name)) { av_freep(&VAR_1); return VAR_6; } if (VAR_6->flags & URL_PROTOCOL_FLAG_NESTED_SCHEME && !strcmp(VAR_3, VAR_6->name)) { av_freep(&VAR_1); return VAR_6; } } av_freep(&VAR_1); }
[ "static const struct URLProtocol *FUNC_0(const char *VAR_0)\n{", "const URLProtocol **VAR_1;", "char VAR_2[128], VAR_3[128], *VAR_4;", "size_t proto_len = strspn(VAR_0, URL_SCHEME_CHARS);", "int VAR_5;", "if (VAR_0[proto_len] != ':' &&\n(strncmp(VAR_0, \"subfile,\", 8) || !strchr(VAR_0 + proto_len + 1, ':')) ||\nis_dos_path(VAR_0))\nstrcpy(VAR_2, \"file\");", "else\nav_strlcpy(VAR_2, VAR_0,\nFFMIN(proto_len + 1, sizeof(VAR_2)));", "if ((VAR_4 = strchr(VAR_2, ',')))\n*VAR_4 = '\\0';", "av_strlcpy(VAR_3, VAR_2, sizeof(VAR_3));", "if ((VAR_4 = strchr(VAR_3, '+')))\n*VAR_4 = '\\0';", "VAR_1 = ffurl_get_protocols(NULL, NULL);", "for (VAR_5 = 0; VAR_1[VAR_5]; VAR_5++) {", "const URLProtocol *VAR_6 = VAR_1[VAR_5];", "if (!strcmp(VAR_2, VAR_6->name)) {", "av_freep(&VAR_1);", "return VAR_6;", "}", "if (VAR_6->flags & URL_PROTOCOL_FLAG_NESTED_SCHEME &&\n!strcmp(VAR_3, VAR_6->name)) {", "av_freep(&VAR_1);", "return VAR_6;", "}", "}", "av_freep(&VAR_1);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15, 17, 19, 21 ], [ 23, 25, 27 ], [ 31, 33 ], [ 35 ], [ 37, 39 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59, 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 76 ] ]
14,018
void qmp_nbd_server_stop(Error **errp) { while (!QTAILQ_EMPTY(&close_notifiers)) { NBDCloseNotifier *cn = QTAILQ_FIRST(&close_notifiers); nbd_close_notifier(&cn->n, nbd_export_get_blockdev(cn->exp)); } qemu_set_fd_handler2(server_fd, NULL, NULL, NULL, NULL); close(server_fd); server_fd = -1; }
true
qemu
fc6467eaf22f974620b5dd046afca04e619f9be9
void qmp_nbd_server_stop(Error **errp) { while (!QTAILQ_EMPTY(&close_notifiers)) { NBDCloseNotifier *cn = QTAILQ_FIRST(&close_notifiers); nbd_close_notifier(&cn->n, nbd_export_get_blockdev(cn->exp)); } qemu_set_fd_handler2(server_fd, NULL, NULL, NULL, NULL); close(server_fd); server_fd = -1; }
{ "code": [ " qemu_set_fd_handler2(server_fd, NULL, NULL, NULL, NULL);", " close(server_fd);", " server_fd = -1;" ], "line_no": [ 15, 17, 19 ] }
void FUNC_0(Error **VAR_0) { while (!QTAILQ_EMPTY(&close_notifiers)) { NBDCloseNotifier *cn = QTAILQ_FIRST(&close_notifiers); nbd_close_notifier(&cn->n, nbd_export_get_blockdev(cn->exp)); } qemu_set_fd_handler2(server_fd, NULL, NULL, NULL, NULL); close(server_fd); server_fd = -1; }
[ "void FUNC_0(Error **VAR_0)\n{", "while (!QTAILQ_EMPTY(&close_notifiers)) {", "NBDCloseNotifier *cn = QTAILQ_FIRST(&close_notifiers);", "nbd_close_notifier(&cn->n, nbd_export_get_blockdev(cn->exp));", "}", "qemu_set_fd_handler2(server_fd, NULL, NULL, NULL, NULL);", "close(server_fd);", "server_fd = -1;", "}" ]
[ 0, 0, 0, 0, 0, 1, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
14,019
int arm_reset_cpu(uint64_t cpuid) { CPUState *target_cpu_state; ARMCPU *target_cpu; DPRINTF("cpu %" PRId64 "\n", cpuid); /* change to the cpu we are resetting */ target_cpu_state = arm_get_cpu_by_id(cpuid); if (!target_cpu_state) { return QEMU_ARM_POWERCTL_INVALID_PARAM; } target_cpu = ARM_CPU(target_cpu_state); if (target_cpu->powered_off) { qemu_log_mask(LOG_GUEST_ERROR, "[ARM]%s: CPU %" PRId64 " is off\n", __func__, cpuid); return QEMU_ARM_POWERCTL_IS_OFF; } /* Reset the cpu */ cpu_reset(target_cpu_state); return QEMU_ARM_POWERCTL_RET_SUCCESS; }
true
qemu
062ba099e01ff1474be98c0a4f3da351efab5d9d
int arm_reset_cpu(uint64_t cpuid) { CPUState *target_cpu_state; ARMCPU *target_cpu; DPRINTF("cpu %" PRId64 "\n", cpuid); target_cpu_state = arm_get_cpu_by_id(cpuid); if (!target_cpu_state) { return QEMU_ARM_POWERCTL_INVALID_PARAM; } target_cpu = ARM_CPU(target_cpu_state); if (target_cpu->powered_off) { qemu_log_mask(LOG_GUEST_ERROR, "[ARM]%s: CPU %" PRId64 " is off\n", __func__, cpuid); return QEMU_ARM_POWERCTL_IS_OFF; } cpu_reset(target_cpu_state); return QEMU_ARM_POWERCTL_RET_SUCCESS; }
{ "code": [ " cpu_reset(target_cpu_state);", " if (target_cpu->powered_off) {", " if (target_cpu->powered_off) {", " cpu_reset(target_cpu_state);" ], "line_no": [ 43, 27, 27, 43 ] }
int FUNC_0(uint64_t VAR_0) { CPUState *target_cpu_state; ARMCPU *target_cpu; DPRINTF("cpu %" PRId64 "\n", VAR_0); target_cpu_state = arm_get_cpu_by_id(VAR_0); if (!target_cpu_state) { return QEMU_ARM_POWERCTL_INVALID_PARAM; } target_cpu = ARM_CPU(target_cpu_state); if (target_cpu->powered_off) { qemu_log_mask(LOG_GUEST_ERROR, "[ARM]%s: CPU %" PRId64 " is off\n", __func__, VAR_0); return QEMU_ARM_POWERCTL_IS_OFF; } cpu_reset(target_cpu_state); return QEMU_ARM_POWERCTL_RET_SUCCESS; }
[ "int FUNC_0(uint64_t VAR_0)\n{", "CPUState *target_cpu_state;", "ARMCPU *target_cpu;", "DPRINTF(\"cpu %\" PRId64 \"\\n\", VAR_0);", "target_cpu_state = arm_get_cpu_by_id(VAR_0);", "if (!target_cpu_state) {", "return QEMU_ARM_POWERCTL_INVALID_PARAM;", "}", "target_cpu = ARM_CPU(target_cpu_state);", "if (target_cpu->powered_off) {", "qemu_log_mask(LOG_GUEST_ERROR,\n\"[ARM]%s: CPU %\" PRId64 \" is off\\n\",\n__func__, VAR_0);", "return QEMU_ARM_POWERCTL_IS_OFF;", "}", "cpu_reset(target_cpu_state);", "return QEMU_ARM_POWERCTL_RET_SUCCESS;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29, 31, 33 ], [ 35 ], [ 37 ], [ 43 ], [ 47 ], [ 49 ] ]
14,020
static void postprocess_chroma(AVFrame *frame, int w, int h, int depth) { uint16_t *dstu = (uint16_t *)frame->data[1]; uint16_t *dstv = (uint16_t *)frame->data[2]; int16_t *srcu = (int16_t *)frame->data[1]; int16_t *srcv = (int16_t *)frame->data[2]; ptrdiff_t strideu = frame->linesize[1] / 2; ptrdiff_t stridev = frame->linesize[2] / 2; const int add = 1 << (depth - 1); const int shift = 16 - depth; int i, j; for (j = 0; j < h; j++) { for (i = 0; i < w; i++) { dstu[i] = (add + srcu[i]) << shift; dstv[i] = (add + srcv[i]) << shift; } dstu += strideu; dstv += stridev; srcu += strideu; srcv += stridev; } }
true
FFmpeg
43cd33be16b21b9a217025e208f4ffbf0bf81da4
static void postprocess_chroma(AVFrame *frame, int w, int h, int depth) { uint16_t *dstu = (uint16_t *)frame->data[1]; uint16_t *dstv = (uint16_t *)frame->data[2]; int16_t *srcu = (int16_t *)frame->data[1]; int16_t *srcv = (int16_t *)frame->data[2]; ptrdiff_t strideu = frame->linesize[1] / 2; ptrdiff_t stridev = frame->linesize[2] / 2; const int add = 1 << (depth - 1); const int shift = 16 - depth; int i, j; for (j = 0; j < h; j++) { for (i = 0; i < w; i++) { dstu[i] = (add + srcu[i]) << shift; dstv[i] = (add + srcv[i]) << shift; } dstu += strideu; dstv += stridev; srcu += strideu; srcv += stridev; } }
{ "code": [ " const int add = 1 << (depth - 1);", " const int shift = 16 - depth;" ], "line_no": [ 17, 19 ] }
static void FUNC_0(AVFrame *VAR_0, int VAR_1, int VAR_2, int VAR_3) { uint16_t *dstu = (uint16_t *)VAR_0->data[1]; uint16_t *dstv = (uint16_t *)VAR_0->data[2]; int16_t *srcu = (int16_t *)VAR_0->data[1]; int16_t *srcv = (int16_t *)VAR_0->data[2]; ptrdiff_t strideu = VAR_0->linesize[1] / 2; ptrdiff_t stridev = VAR_0->linesize[2] / 2; const int VAR_4 = 1 << (VAR_3 - 1); const int VAR_5 = 16 - VAR_3; int VAR_6, VAR_7; for (VAR_7 = 0; VAR_7 < VAR_2; VAR_7++) { for (VAR_6 = 0; VAR_6 < VAR_1; VAR_6++) { dstu[VAR_6] = (VAR_4 + srcu[VAR_6]) << VAR_5; dstv[VAR_6] = (VAR_4 + srcv[VAR_6]) << VAR_5; } dstu += strideu; dstv += stridev; srcu += strideu; srcv += stridev; } }
[ "static void FUNC_0(AVFrame *VAR_0, int VAR_1, int VAR_2, int VAR_3)\n{", "uint16_t *dstu = (uint16_t *)VAR_0->data[1];", "uint16_t *dstv = (uint16_t *)VAR_0->data[2];", "int16_t *srcu = (int16_t *)VAR_0->data[1];", "int16_t *srcv = (int16_t *)VAR_0->data[2];", "ptrdiff_t strideu = VAR_0->linesize[1] / 2;", "ptrdiff_t stridev = VAR_0->linesize[2] / 2;", "const int VAR_4 = 1 << (VAR_3 - 1);", "const int VAR_5 = 16 - VAR_3;", "int VAR_6, VAR_7;", "for (VAR_7 = 0; VAR_7 < VAR_2; VAR_7++) {", "for (VAR_6 = 0; VAR_6 < VAR_1; VAR_6++) {", "dstu[VAR_6] = (VAR_4 + srcu[VAR_6]) << VAR_5;", "dstv[VAR_6] = (VAR_4 + srcv[VAR_6]) << VAR_5;", "}", "dstu += strideu;", "dstv += stridev;", "srcu += strideu;", "srcv += stridev;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ] ]
14,021
static void id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t flags, ID3v2ExtraMeta **extra_meta) { int isv34, tlen, unsync; char tag[5]; int64_t next, end = avio_tell(s->pb) + len; int taghdrlen; const char *reason = NULL; AVIOContext pb; AVIOContext *pbx; unsigned char *buffer = NULL; int buffer_size = 0; const ID3v2EMFunc *extra_func; switch (version) { case 2: if (flags & 0x40) { reason = "compression"; goto error; } isv34 = 0; taghdrlen = 6; break; case 3: case 4: isv34 = 1; taghdrlen = 10; break; default: reason = "version"; goto error; } unsync = flags & 0x80; if (isv34 && flags & 0x40) { /* Extended header present, just skip over it */ int extlen = get_size(s->pb, 4); if (version == 4) /* In v2.4 the length includes the length field we just read. */ extlen -= 4; if (extlen < 0) { reason = "invalid extended header length"; goto error; } avio_skip(s->pb, extlen); } while (len >= taghdrlen) { unsigned int tflags = 0; int tunsync = 0; if (isv34) { avio_read(s->pb, tag, 4); tag[4] = 0; if (version == 3) { tlen = avio_rb32(s->pb); } else tlen = get_size(s->pb, 4); tflags = avio_rb16(s->pb); tunsync = tflags & ID3v2_FLAG_UNSYNCH; } else { avio_read(s->pb, tag, 3); tag[3] = 0; tlen = avio_rb24(s->pb); } if (tlen < 0 || tlen > len - taghdrlen) { av_log(s, AV_LOG_WARNING, "Invalid size in frame %s, skipping the rest of tag.\n", tag); break; } len -= taghdrlen + tlen; next = avio_tell(s->pb) + tlen; if (!tlen) { if (tag[0]) av_log(s, AV_LOG_DEBUG, "Invalid empty frame %s, skipping.\n", tag); continue; } if (tflags & ID3v2_FLAG_DATALEN) { avio_rb32(s->pb); tlen -= 4; } if (tflags & (ID3v2_FLAG_ENCRYPTION | ID3v2_FLAG_COMPRESSION)) { av_log(s, AV_LOG_WARNING, "Skipping encrypted/compressed ID3v2 frame %s.\n", tag); avio_skip(s->pb, tlen); /* check for text tag or supported special meta tag */ } else if (tag[0] == 'T' || (extra_meta && (extra_func = get_extra_meta_func(tag, isv34)))) { if (unsync || tunsync) { int64_t end = avio_tell(s->pb) + tlen; uint8_t *b; av_fast_malloc(&buffer, &buffer_size, tlen); if (!buffer) { av_log(s, AV_LOG_ERROR, "Failed to alloc %d bytes\n", tlen); goto seek; } b = buffer; while (avio_tell(s->pb) < end) { *b++ = avio_r8(s->pb); if (*(b - 1) == 0xff && avio_tell(s->pb) < end - 1) { uint8_t val = avio_r8(s->pb); *b++ = val ? val : avio_r8(s->pb); } } ffio_init_context(&pb, buffer, b - buffer, 0, NULL, NULL, NULL, NULL); tlen = b - buffer; pbx = &pb; // read from sync buffer } else { pbx = s->pb; // read straight from input } if (tag[0] == 'T') /* parse text tag */ read_ttag(s, pbx, tlen, tag); else /* parse special meta tag */ extra_func->read(s, pbx, tlen, tag, extra_meta); } else if (!tag[0]) { if (tag[1]) av_log(s, AV_LOG_WARNING, "invalid frame id, assuming padding"); avio_skip(s->pb, tlen); break; } /* Skip to end of tag */ seek: avio_seek(s->pb, next, SEEK_SET); } /* Footer preset, always 10 bytes, skip over it */ if (version == 4 && flags & 0x10) end += 10; error: if (reason) av_log(s, AV_LOG_INFO, "ID3v2.%d tag skipped, cannot handle %s\n", version, reason); avio_seek(s->pb, end, SEEK_SET); av_free(buffer); return; }
false
FFmpeg
af4cc2605c7a56ecfd84c264aa2b325020418472
static void id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t flags, ID3v2ExtraMeta **extra_meta) { int isv34, tlen, unsync; char tag[5]; int64_t next, end = avio_tell(s->pb) + len; int taghdrlen; const char *reason = NULL; AVIOContext pb; AVIOContext *pbx; unsigned char *buffer = NULL; int buffer_size = 0; const ID3v2EMFunc *extra_func; switch (version) { case 2: if (flags & 0x40) { reason = "compression"; goto error; } isv34 = 0; taghdrlen = 6; break; case 3: case 4: isv34 = 1; taghdrlen = 10; break; default: reason = "version"; goto error; } unsync = flags & 0x80; if (isv34 && flags & 0x40) { int extlen = get_size(s->pb, 4); if (version == 4) extlen -= 4; if (extlen < 0) { reason = "invalid extended header length"; goto error; } avio_skip(s->pb, extlen); } while (len >= taghdrlen) { unsigned int tflags = 0; int tunsync = 0; if (isv34) { avio_read(s->pb, tag, 4); tag[4] = 0; if (version == 3) { tlen = avio_rb32(s->pb); } else tlen = get_size(s->pb, 4); tflags = avio_rb16(s->pb); tunsync = tflags & ID3v2_FLAG_UNSYNCH; } else { avio_read(s->pb, tag, 3); tag[3] = 0; tlen = avio_rb24(s->pb); } if (tlen < 0 || tlen > len - taghdrlen) { av_log(s, AV_LOG_WARNING, "Invalid size in frame %s, skipping the rest of tag.\n", tag); break; } len -= taghdrlen + tlen; next = avio_tell(s->pb) + tlen; if (!tlen) { if (tag[0]) av_log(s, AV_LOG_DEBUG, "Invalid empty frame %s, skipping.\n", tag); continue; } if (tflags & ID3v2_FLAG_DATALEN) { avio_rb32(s->pb); tlen -= 4; } if (tflags & (ID3v2_FLAG_ENCRYPTION | ID3v2_FLAG_COMPRESSION)) { av_log(s, AV_LOG_WARNING, "Skipping encrypted/compressed ID3v2 frame %s.\n", tag); avio_skip(s->pb, tlen); } else if (tag[0] == 'T' || (extra_meta && (extra_func = get_extra_meta_func(tag, isv34)))) { if (unsync || tunsync) { int64_t end = avio_tell(s->pb) + tlen; uint8_t *b; av_fast_malloc(&buffer, &buffer_size, tlen); if (!buffer) { av_log(s, AV_LOG_ERROR, "Failed to alloc %d bytes\n", tlen); goto seek; } b = buffer; while (avio_tell(s->pb) < end) { *b++ = avio_r8(s->pb); if (*(b - 1) == 0xff && avio_tell(s->pb) < end - 1) { uint8_t val = avio_r8(s->pb); *b++ = val ? val : avio_r8(s->pb); } } ffio_init_context(&pb, buffer, b - buffer, 0, NULL, NULL, NULL, NULL); tlen = b - buffer; pbx = &pb; } else { pbx = s->pb; } if (tag[0] == 'T') read_ttag(s, pbx, tlen, tag); else extra_func->read(s, pbx, tlen, tag, extra_meta); } else if (!tag[0]) { if (tag[1]) av_log(s, AV_LOG_WARNING, "invalid frame id, assuming padding"); avio_skip(s->pb, tlen); break; } seek: avio_seek(s->pb, next, SEEK_SET); } if (version == 4 && flags & 0x10) end += 10; error: if (reason) av_log(s, AV_LOG_INFO, "ID3v2.%d tag skipped, cannot handle %s\n", version, reason); avio_seek(s->pb, end, SEEK_SET); av_free(buffer); return; }
{ "code": [], "line_no": [] }
static void FUNC_0(AVFormatContext *VAR_0, int VAR_1, uint8_t VAR_2, uint8_t VAR_3, ID3v2ExtraMeta **VAR_4) { int VAR_5, VAR_6, VAR_7; char VAR_8[5]; int64_t next, end = avio_tell(VAR_0->pb) + VAR_1; int VAR_9; const char *VAR_10 = NULL; AVIOContext pb; AVIOContext *pbx; unsigned char *VAR_11 = NULL; int VAR_12 = 0; const ID3v2EMFunc *VAR_13; switch (VAR_2) { case 2: if (VAR_3 & 0x40) { VAR_10 = "compression"; goto error; } VAR_5 = 0; VAR_9 = 6; break; case 3: case 4: VAR_5 = 1; VAR_9 = 10; break; default: VAR_10 = "VAR_2"; goto error; } VAR_7 = VAR_3 & 0x80; if (VAR_5 && VAR_3 & 0x40) { int VAR_14 = get_size(VAR_0->pb, 4); if (VAR_2 == 4) VAR_14 -= 4; if (VAR_14 < 0) { VAR_10 = "invalid extended header length"; goto error; } avio_skip(VAR_0->pb, VAR_14); } while (VAR_1 >= VAR_9) { unsigned int VAR_15 = 0; int VAR_16 = 0; if (VAR_5) { avio_read(VAR_0->pb, VAR_8, 4); VAR_8[4] = 0; if (VAR_2 == 3) { VAR_6 = avio_rb32(VAR_0->pb); } else VAR_6 = get_size(VAR_0->pb, 4); VAR_15 = avio_rb16(VAR_0->pb); VAR_16 = VAR_15 & ID3v2_FLAG_UNSYNCH; } else { avio_read(VAR_0->pb, VAR_8, 3); VAR_8[3] = 0; VAR_6 = avio_rb24(VAR_0->pb); } if (VAR_6 < 0 || VAR_6 > VAR_1 - VAR_9) { av_log(VAR_0, AV_LOG_WARNING, "Invalid size in frame %VAR_0, skipping the rest of VAR_8.\n", VAR_8); break; } VAR_1 -= VAR_9 + VAR_6; next = avio_tell(VAR_0->pb) + VAR_6; if (!VAR_6) { if (VAR_8[0]) av_log(VAR_0, AV_LOG_DEBUG, "Invalid empty frame %VAR_0, skipping.\n", VAR_8); continue; } if (VAR_15 & ID3v2_FLAG_DATALEN) { avio_rb32(VAR_0->pb); VAR_6 -= 4; } if (VAR_15 & (ID3v2_FLAG_ENCRYPTION | ID3v2_FLAG_COMPRESSION)) { av_log(VAR_0, AV_LOG_WARNING, "Skipping encrypted/compressed ID3v2 frame %VAR_0.\n", VAR_8); avio_skip(VAR_0->pb, VAR_6); } else if (VAR_8[0] == 'T' || (VAR_4 && (VAR_13 = get_extra_meta_func(VAR_8, VAR_5)))) { if (VAR_7 || VAR_16) { int64_t end = avio_tell(VAR_0->pb) + VAR_6; uint8_t *b; av_fast_malloc(&VAR_11, &VAR_12, VAR_6); if (!VAR_11) { av_log(VAR_0, AV_LOG_ERROR, "Failed to alloc %d bytes\n", VAR_6); goto seek; } b = VAR_11; while (avio_tell(VAR_0->pb) < end) { *b++ = avio_r8(VAR_0->pb); if (*(b - 1) == 0xff && avio_tell(VAR_0->pb) < end - 1) { uint8_t val = avio_r8(VAR_0->pb); *b++ = val ? val : avio_r8(VAR_0->pb); } } ffio_init_context(&pb, VAR_11, b - VAR_11, 0, NULL, NULL, NULL, NULL); VAR_6 = b - VAR_11; pbx = &pb; } else { pbx = VAR_0->pb; } if (VAR_8[0] == 'T') read_ttag(VAR_0, pbx, VAR_6, VAR_8); else VAR_13->read(VAR_0, pbx, VAR_6, VAR_8, VAR_4); } else if (!VAR_8[0]) { if (VAR_8[1]) av_log(VAR_0, AV_LOG_WARNING, "invalid frame id, assuming padding"); avio_skip(VAR_0->pb, VAR_6); break; } seek: avio_seek(VAR_0->pb, next, SEEK_SET); } if (VAR_2 == 4 && VAR_3 & 0x10) end += 10; error: if (VAR_10) av_log(VAR_0, AV_LOG_INFO, "ID3v2.%d VAR_8 skipped, cannot handle %VAR_0\n", VAR_2, VAR_10); avio_seek(VAR_0->pb, end, SEEK_SET); av_free(VAR_11); return; }
[ "static void FUNC_0(AVFormatContext *VAR_0, int VAR_1, uint8_t VAR_2,\nuint8_t VAR_3, ID3v2ExtraMeta **VAR_4)\n{", "int VAR_5, VAR_6, VAR_7;", "char VAR_8[5];", "int64_t next, end = avio_tell(VAR_0->pb) + VAR_1;", "int VAR_9;", "const char *VAR_10 = NULL;", "AVIOContext pb;", "AVIOContext *pbx;", "unsigned char *VAR_11 = NULL;", "int VAR_12 = 0;", "const ID3v2EMFunc *VAR_13;", "switch (VAR_2) {", "case 2:\nif (VAR_3 & 0x40) {", "VAR_10 = \"compression\";", "goto error;", "}", "VAR_5 = 0;", "VAR_9 = 6;", "break;", "case 3:\ncase 4:\nVAR_5 = 1;", "VAR_9 = 10;", "break;", "default:\nVAR_10 = \"VAR_2\";", "goto error;", "}", "VAR_7 = VAR_3 & 0x80;", "if (VAR_5 && VAR_3 & 0x40) {", "int VAR_14 = get_size(VAR_0->pb, 4);", "if (VAR_2 == 4)\nVAR_14 -= 4;", "if (VAR_14 < 0) {", "VAR_10 = \"invalid extended header length\";", "goto error;", "}", "avio_skip(VAR_0->pb, VAR_14);", "}", "while (VAR_1 >= VAR_9) {", "unsigned int VAR_15 = 0;", "int VAR_16 = 0;", "if (VAR_5) {", "avio_read(VAR_0->pb, VAR_8, 4);", "VAR_8[4] = 0;", "if (VAR_2 == 3) {", "VAR_6 = avio_rb32(VAR_0->pb);", "} else", "VAR_6 = get_size(VAR_0->pb, 4);", "VAR_15 = avio_rb16(VAR_0->pb);", "VAR_16 = VAR_15 & ID3v2_FLAG_UNSYNCH;", "} else {", "avio_read(VAR_0->pb, VAR_8, 3);", "VAR_8[3] = 0;", "VAR_6 = avio_rb24(VAR_0->pb);", "}", "if (VAR_6 < 0 || VAR_6 > VAR_1 - VAR_9) {", "av_log(VAR_0, AV_LOG_WARNING,\n\"Invalid size in frame %VAR_0, skipping the rest of VAR_8.\\n\",\nVAR_8);", "break;", "}", "VAR_1 -= VAR_9 + VAR_6;", "next = avio_tell(VAR_0->pb) + VAR_6;", "if (!VAR_6) {", "if (VAR_8[0])\nav_log(VAR_0, AV_LOG_DEBUG, \"Invalid empty frame %VAR_0, skipping.\\n\",\nVAR_8);", "continue;", "}", "if (VAR_15 & ID3v2_FLAG_DATALEN) {", "avio_rb32(VAR_0->pb);", "VAR_6 -= 4;", "}", "if (VAR_15 & (ID3v2_FLAG_ENCRYPTION | ID3v2_FLAG_COMPRESSION)) {", "av_log(VAR_0, AV_LOG_WARNING,\n\"Skipping encrypted/compressed ID3v2 frame %VAR_0.\\n\", VAR_8);", "avio_skip(VAR_0->pb, VAR_6);", "} else if (VAR_8[0] == 'T' ||", "(VAR_4 &&\n(VAR_13 = get_extra_meta_func(VAR_8, VAR_5)))) {", "if (VAR_7 || VAR_16) {", "int64_t end = avio_tell(VAR_0->pb) + VAR_6;", "uint8_t *b;", "av_fast_malloc(&VAR_11, &VAR_12, VAR_6);", "if (!VAR_11) {", "av_log(VAR_0, AV_LOG_ERROR, \"Failed to alloc %d bytes\\n\", VAR_6);", "goto seek;", "}", "b = VAR_11;", "while (avio_tell(VAR_0->pb) < end) {", "*b++ = avio_r8(VAR_0->pb);", "if (*(b - 1) == 0xff && avio_tell(VAR_0->pb) < end - 1) {", "uint8_t val = avio_r8(VAR_0->pb);", "*b++ = val ? val : avio_r8(VAR_0->pb);", "}", "}", "ffio_init_context(&pb, VAR_11, b - VAR_11, 0, NULL, NULL, NULL,\nNULL);", "VAR_6 = b - VAR_11;", "pbx = &pb;", "} else {", "pbx = VAR_0->pb;", "}", "if (VAR_8[0] == 'T')\nread_ttag(VAR_0, pbx, VAR_6, VAR_8);", "else\nVAR_13->read(VAR_0, pbx, VAR_6, VAR_8, VAR_4);", "} else if (!VAR_8[0]) {", "if (VAR_8[1])\nav_log(VAR_0, AV_LOG_WARNING, \"invalid frame id, assuming padding\");", "avio_skip(VAR_0->pb, VAR_6);", "break;", "}", "seek:\navio_seek(VAR_0->pb, next, SEEK_SET);", "}", "if (VAR_2 == 4 && VAR_3 & 0x10)\nend += 10;", "error:\nif (VAR_10)\nav_log(VAR_0, AV_LOG_INFO, \"ID3v2.%d VAR_8 skipped, cannot handle %VAR_0\\n\",\nVAR_2, VAR_10);", "avio_seek(VAR_0->pb, end, SEEK_SET);", "av_free(VAR_11);", "return;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49, 51, 53 ], [ 55 ], [ 57 ], [ 61, 63 ], [ 65 ], [ 67 ], [ 71 ], [ 75 ], [ 77 ], [ 79, 83 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 101 ], [ 103 ], [ 105 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139, 141, 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 155 ], [ 157, 159, 161 ], [ 163 ], [ 165 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 179 ], [ 181, 183 ], [ 185 ], [ 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, 245 ], [ 247, 251 ], [ 253 ], [ 255, 257 ], [ 259 ], [ 261 ], [ 263 ], [ 267, 269 ], [ 271 ], [ 277, 279 ], [ 283, 285, 287, 289 ], [ 291 ], [ 293 ], [ 295 ], [ 297 ] ]
14,026
static int ehci_state_fetchqtd(EHCIQueue *q) { EHCIqtd qtd; EHCIPacket *p; int again = 0; get_dwords(q->ehci, NLPTR_GET(q->qtdaddr), (uint32_t *) &qtd, sizeof(EHCIqtd) >> 2); ehci_trace_qtd(q, NLPTR_GET(q->qtdaddr), &qtd); p = QTAILQ_FIRST(&q->packets); if (p != NULL) { if (p->qtdaddr != q->qtdaddr || (!NLPTR_TBIT(p->qtd.next) && (p->qtd.next != qtd.next)) || (!NLPTR_TBIT(p->qtd.altnext) && (p->qtd.altnext != qtd.altnext)) || p->qtd.bufptr[0] != qtd.bufptr[0]) { ehci_cancel_queue(q); ehci_trace_guest_bug(q->ehci, "guest updated active QH or qTD"); p = NULL; } else { p->qtd = qtd; ehci_qh_do_overlay(q); } } if (!(qtd.token & QTD_TOKEN_ACTIVE)) { if (p != NULL) { /* transfer canceled by guest (clear active) */ ehci_cancel_queue(q); p = NULL; } ehci_set_state(q->ehci, q->async, EST_HORIZONTALQH); again = 1; } else if (p != NULL) { switch (p->async) { case EHCI_ASYNC_NONE: /* Previously nacked packet (likely interrupt ep) */ ehci_set_state(q->ehci, q->async, EST_EXECUTE); break; case EHCI_ASYNC_INFLIGHT: /* Unfinyshed async handled packet, go horizontal */ ehci_set_state(q->ehci, q->async, EST_HORIZONTALQH); break; case EHCI_ASYNC_FINISHED: /* Should never happen, as this case is caught by fetchqh */ ehci_set_state(q->ehci, q->async, EST_EXECUTING); break; } again = 1; } else { p = ehci_alloc_packet(q); p->qtdaddr = q->qtdaddr; p->qtd = qtd; ehci_set_state(q->ehci, q->async, EST_EXECUTE); again = 1; } return again; }
true
qemu
ef5b234477df80700b128f561f5877a0688a70c8
static int ehci_state_fetchqtd(EHCIQueue *q) { EHCIqtd qtd; EHCIPacket *p; int again = 0; get_dwords(q->ehci, NLPTR_GET(q->qtdaddr), (uint32_t *) &qtd, sizeof(EHCIqtd) >> 2); ehci_trace_qtd(q, NLPTR_GET(q->qtdaddr), &qtd); p = QTAILQ_FIRST(&q->packets); if (p != NULL) { if (p->qtdaddr != q->qtdaddr || (!NLPTR_TBIT(p->qtd.next) && (p->qtd.next != qtd.next)) || (!NLPTR_TBIT(p->qtd.altnext) && (p->qtd.altnext != qtd.altnext)) || p->qtd.bufptr[0] != qtd.bufptr[0]) { ehci_cancel_queue(q); ehci_trace_guest_bug(q->ehci, "guest updated active QH or qTD"); p = NULL; } else { p->qtd = qtd; ehci_qh_do_overlay(q); } } if (!(qtd.token & QTD_TOKEN_ACTIVE)) { if (p != NULL) { ehci_cancel_queue(q); p = NULL; } ehci_set_state(q->ehci, q->async, EST_HORIZONTALQH); again = 1; } else if (p != NULL) { switch (p->async) { case EHCI_ASYNC_NONE: ehci_set_state(q->ehci, q->async, EST_EXECUTE); break; case EHCI_ASYNC_INFLIGHT: ehci_set_state(q->ehci, q->async, EST_HORIZONTALQH); break; case EHCI_ASYNC_FINISHED: ehci_set_state(q->ehci, q->async, EST_EXECUTING); break; } again = 1; } else { p = ehci_alloc_packet(q); p->qtdaddr = q->qtdaddr; p->qtd = qtd; ehci_set_state(q->ehci, q->async, EST_EXECUTE); again = 1; } return again; }
{ "code": [ " ehci_set_state(q->ehci, q->async, EST_EXECUTE);", " break;" ], "line_no": [ 75, 77 ] }
static int FUNC_0(EHCIQueue *VAR_0) { EHCIqtd qtd; EHCIPacket *p; int VAR_1 = 0; get_dwords(VAR_0->ehci, NLPTR_GET(VAR_0->qtdaddr), (uint32_t *) &qtd, sizeof(EHCIqtd) >> 2); ehci_trace_qtd(VAR_0, NLPTR_GET(VAR_0->qtdaddr), &qtd); p = QTAILQ_FIRST(&VAR_0->packets); if (p != NULL) { if (p->qtdaddr != VAR_0->qtdaddr || (!NLPTR_TBIT(p->qtd.next) && (p->qtd.next != qtd.next)) || (!NLPTR_TBIT(p->qtd.altnext) && (p->qtd.altnext != qtd.altnext)) || p->qtd.bufptr[0] != qtd.bufptr[0]) { ehci_cancel_queue(VAR_0); ehci_trace_guest_bug(VAR_0->ehci, "guest updated active QH or qTD"); p = NULL; } else { p->qtd = qtd; ehci_qh_do_overlay(VAR_0); } } if (!(qtd.token & QTD_TOKEN_ACTIVE)) { if (p != NULL) { ehci_cancel_queue(VAR_0); p = NULL; } ehci_set_state(VAR_0->ehci, VAR_0->async, EST_HORIZONTALQH); VAR_1 = 1; } else if (p != NULL) { switch (p->async) { case EHCI_ASYNC_NONE: ehci_set_state(VAR_0->ehci, VAR_0->async, EST_EXECUTE); break; case EHCI_ASYNC_INFLIGHT: ehci_set_state(VAR_0->ehci, VAR_0->async, EST_HORIZONTALQH); break; case EHCI_ASYNC_FINISHED: ehci_set_state(VAR_0->ehci, VAR_0->async, EST_EXECUTING); break; } VAR_1 = 1; } else { p = ehci_alloc_packet(VAR_0); p->qtdaddr = VAR_0->qtdaddr; p->qtd = qtd; ehci_set_state(VAR_0->ehci, VAR_0->async, EST_EXECUTE); VAR_1 = 1; } return VAR_1; }
[ "static int FUNC_0(EHCIQueue *VAR_0)\n{", "EHCIqtd qtd;", "EHCIPacket *p;", "int VAR_1 = 0;", "get_dwords(VAR_0->ehci, NLPTR_GET(VAR_0->qtdaddr), (uint32_t *) &qtd,\nsizeof(EHCIqtd) >> 2);", "ehci_trace_qtd(VAR_0, NLPTR_GET(VAR_0->qtdaddr), &qtd);", "p = QTAILQ_FIRST(&VAR_0->packets);", "if (p != NULL) {", "if (p->qtdaddr != VAR_0->qtdaddr ||\n(!NLPTR_TBIT(p->qtd.next) && (p->qtd.next != qtd.next)) ||\n(!NLPTR_TBIT(p->qtd.altnext) && (p->qtd.altnext != qtd.altnext)) ||\np->qtd.bufptr[0] != qtd.bufptr[0]) {", "ehci_cancel_queue(VAR_0);", "ehci_trace_guest_bug(VAR_0->ehci, \"guest updated active QH or qTD\");", "p = NULL;", "} else {", "p->qtd = qtd;", "ehci_qh_do_overlay(VAR_0);", "}", "}", "if (!(qtd.token & QTD_TOKEN_ACTIVE)) {", "if (p != NULL) {", "ehci_cancel_queue(VAR_0);", "p = NULL;", "}", "ehci_set_state(VAR_0->ehci, VAR_0->async, EST_HORIZONTALQH);", "VAR_1 = 1;", "} else if (p != NULL) {", "switch (p->async) {", "case EHCI_ASYNC_NONE:\nehci_set_state(VAR_0->ehci, VAR_0->async, EST_EXECUTE);", "break;", "case EHCI_ASYNC_INFLIGHT:\nehci_set_state(VAR_0->ehci, VAR_0->async, EST_HORIZONTALQH);", "break;", "case EHCI_ASYNC_FINISHED:\nehci_set_state(VAR_0->ehci, VAR_0->async, EST_EXECUTING);", "break;", "}", "VAR_1 = 1;", "} else {", "p = ehci_alloc_packet(VAR_0);", "p->qtdaddr = VAR_0->qtdaddr;", "p->qtd = qtd;", "ehci_set_state(VAR_0->ehci, VAR_0->async, EST_EXECUTE);", "VAR_1 = 1;", "}", "return VAR_1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13, 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25, 27, 29, 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71, 75 ], [ 77 ], [ 79, 83 ], [ 85 ], [ 87, 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 115 ], [ 117 ] ]
14,028
static av_always_inline int encode_line(FFV1Context *s, int w, int16_t *sample[3], int plane_index, int bits) { PlaneContext *const p = &s->plane[plane_index]; RangeCoder *const c = &s->c; int x; int run_index = s->run_index; int run_count = 0; int run_mode = 0; if (s->ac) { if (c->bytestream_end - c->bytestream < w * 20) { av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n"); return AVERROR_INVALIDDATA; } } else { if (s->pb.buf_end - s->pb.buf - (put_bits_count(&s->pb) >> 3) < w * 4) { av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n"); return AVERROR_INVALIDDATA; } } for (x = 0; x < w; x++) { int diff, context; context = get_context(p, sample[0] + x, sample[1] + x, sample[2] + x); diff = sample[0][x] - predict(sample[0] + x, sample[1] + x); if (context < 0) { context = -context; diff = -diff; } diff = fold(diff, bits); if (s->ac) { if (s->flags & CODEC_FLAG_PASS1) { put_symbol_inline(c, p->state[context], diff, 1, s->rc_stat, s->rc_stat2[p->quant_table_index][context]); } else { put_symbol_inline(c, p->state[context], diff, 1, NULL, NULL); } } else { if (context == 0) run_mode = 1; if (run_mode) { if (diff) { while (run_count >= 1 << ff_log2_run[run_index]) { run_count -= 1 << ff_log2_run[run_index]; run_index++; put_bits(&s->pb, 1, 1); } put_bits(&s->pb, 1 + ff_log2_run[run_index], run_count); if (run_index) run_index--; run_count = 0; run_mode = 0; if (diff > 0) diff--; } else { run_count++; } } av_dlog(s->avctx, "count:%d index:%d, mode:%d, x:%d pos:%d\n", run_count, run_index, run_mode, x, (int)put_bits_count(&s->pb)); if (run_mode == 0) put_vlc_symbol(&s->pb, &p->vlc_state[context], diff, bits); } } if (run_mode) { while (run_count >= 1 << ff_log2_run[run_index]) { run_count -= 1 << ff_log2_run[run_index]; run_index++; put_bits(&s->pb, 1, 1); } if (run_count) put_bits(&s->pb, 1, 1); } s->run_index = run_index; return 0; }
false
FFmpeg
3728603f1854b5c79d1a64dd3b41b80640ef1e7f
static av_always_inline int encode_line(FFV1Context *s, int w, int16_t *sample[3], int plane_index, int bits) { PlaneContext *const p = &s->plane[plane_index]; RangeCoder *const c = &s->c; int x; int run_index = s->run_index; int run_count = 0; int run_mode = 0; if (s->ac) { if (c->bytestream_end - c->bytestream < w * 20) { av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n"); return AVERROR_INVALIDDATA; } } else { if (s->pb.buf_end - s->pb.buf - (put_bits_count(&s->pb) >> 3) < w * 4) { av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n"); return AVERROR_INVALIDDATA; } } for (x = 0; x < w; x++) { int diff, context; context = get_context(p, sample[0] + x, sample[1] + x, sample[2] + x); diff = sample[0][x] - predict(sample[0] + x, sample[1] + x); if (context < 0) { context = -context; diff = -diff; } diff = fold(diff, bits); if (s->ac) { if (s->flags & CODEC_FLAG_PASS1) { put_symbol_inline(c, p->state[context], diff, 1, s->rc_stat, s->rc_stat2[p->quant_table_index][context]); } else { put_symbol_inline(c, p->state[context], diff, 1, NULL, NULL); } } else { if (context == 0) run_mode = 1; if (run_mode) { if (diff) { while (run_count >= 1 << ff_log2_run[run_index]) { run_count -= 1 << ff_log2_run[run_index]; run_index++; put_bits(&s->pb, 1, 1); } put_bits(&s->pb, 1 + ff_log2_run[run_index], run_count); if (run_index) run_index--; run_count = 0; run_mode = 0; if (diff > 0) diff--; } else { run_count++; } } av_dlog(s->avctx, "count:%d index:%d, mode:%d, x:%d pos:%d\n", run_count, run_index, run_mode, x, (int)put_bits_count(&s->pb)); if (run_mode == 0) put_vlc_symbol(&s->pb, &p->vlc_state[context], diff, bits); } } if (run_mode) { while (run_count >= 1 << ff_log2_run[run_index]) { run_count -= 1 << ff_log2_run[run_index]; run_index++; put_bits(&s->pb, 1, 1); } if (run_count) put_bits(&s->pb, 1, 1); } s->run_index = run_index; return 0; }
{ "code": [], "line_no": [] }
static av_always_inline int FUNC_0(FFV1Context *s, int w, int16_t *sample[3], int plane_index, int bits) { PlaneContext *const p = &s->plane[plane_index]; RangeCoder *const c = &s->c; int VAR_0; int VAR_1 = s->VAR_1; int VAR_2 = 0; int VAR_3 = 0; if (s->ac) { if (c->bytestream_end - c->bytestream < w * 20) { av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n"); return AVERROR_INVALIDDATA; } } else { if (s->pb.buf_end - s->pb.buf - (put_bits_count(&s->pb) >> 3) < w * 4) { av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n"); return AVERROR_INVALIDDATA; } } for (VAR_0 = 0; VAR_0 < w; VAR_0++) { int VAR_4, VAR_5; VAR_5 = get_context(p, sample[0] + VAR_0, sample[1] + VAR_0, sample[2] + VAR_0); VAR_4 = sample[0][VAR_0] - predict(sample[0] + VAR_0, sample[1] + VAR_0); if (VAR_5 < 0) { VAR_5 = -VAR_5; VAR_4 = -VAR_4; } VAR_4 = fold(VAR_4, bits); if (s->ac) { if (s->flags & CODEC_FLAG_PASS1) { put_symbol_inline(c, p->state[VAR_5], VAR_4, 1, s->rc_stat, s->rc_stat2[p->quant_table_index][VAR_5]); } else { put_symbol_inline(c, p->state[VAR_5], VAR_4, 1, NULL, NULL); } } else { if (VAR_5 == 0) VAR_3 = 1; if (VAR_3) { if (VAR_4) { while (VAR_2 >= 1 << ff_log2_run[VAR_1]) { VAR_2 -= 1 << ff_log2_run[VAR_1]; VAR_1++; put_bits(&s->pb, 1, 1); } put_bits(&s->pb, 1 + ff_log2_run[VAR_1], VAR_2); if (VAR_1) VAR_1--; VAR_2 = 0; VAR_3 = 0; if (VAR_4 > 0) VAR_4--; } else { VAR_2++; } } av_dlog(s->avctx, "count:%d index:%d, mode:%d, VAR_0:%d pos:%d\n", VAR_2, VAR_1, VAR_3, VAR_0, (int)put_bits_count(&s->pb)); if (VAR_3 == 0) put_vlc_symbol(&s->pb, &p->vlc_state[VAR_5], VAR_4, bits); } } if (VAR_3) { while (VAR_2 >= 1 << ff_log2_run[VAR_1]) { VAR_2 -= 1 << ff_log2_run[VAR_1]; VAR_1++; put_bits(&s->pb, 1, 1); } if (VAR_2) put_bits(&s->pb, 1, 1); } s->VAR_1 = VAR_1; return 0; }
[ "static av_always_inline int FUNC_0(FFV1Context *s, int w,\nint16_t *sample[3],\nint plane_index, int bits)\n{", "PlaneContext *const p = &s->plane[plane_index];", "RangeCoder *const c = &s->c;", "int VAR_0;", "int VAR_1 = s->VAR_1;", "int VAR_2 = 0;", "int VAR_3 = 0;", "if (s->ac) {", "if (c->bytestream_end - c->bytestream < w * 20) {", "av_log(s->avctx, AV_LOG_ERROR, \"encoded frame too large\\n\");", "return AVERROR_INVALIDDATA;", "}", "} else {", "if (s->pb.buf_end - s->pb.buf - (put_bits_count(&s->pb) >> 3) < w * 4) {", "av_log(s->avctx, AV_LOG_ERROR, \"encoded frame too large\\n\");", "return AVERROR_INVALIDDATA;", "}", "}", "for (VAR_0 = 0; VAR_0 < w; VAR_0++) {", "int VAR_4, VAR_5;", "VAR_5 = get_context(p, sample[0] + VAR_0, sample[1] + VAR_0, sample[2] + VAR_0);", "VAR_4 = sample[0][VAR_0] - predict(sample[0] + VAR_0, sample[1] + VAR_0);", "if (VAR_5 < 0) {", "VAR_5 = -VAR_5;", "VAR_4 = -VAR_4;", "}", "VAR_4 = fold(VAR_4, bits);", "if (s->ac) {", "if (s->flags & CODEC_FLAG_PASS1) {", "put_symbol_inline(c, p->state[VAR_5], VAR_4, 1, s->rc_stat,\ns->rc_stat2[p->quant_table_index][VAR_5]);", "} else {", "put_symbol_inline(c, p->state[VAR_5], VAR_4, 1, NULL, NULL);", "}", "} else {", "if (VAR_5 == 0)\nVAR_3 = 1;", "if (VAR_3) {", "if (VAR_4) {", "while (VAR_2 >= 1 << ff_log2_run[VAR_1]) {", "VAR_2 -= 1 << ff_log2_run[VAR_1];", "VAR_1++;", "put_bits(&s->pb, 1, 1);", "}", "put_bits(&s->pb, 1 + ff_log2_run[VAR_1], VAR_2);", "if (VAR_1)\nVAR_1--;", "VAR_2 = 0;", "VAR_3 = 0;", "if (VAR_4 > 0)\nVAR_4--;", "} else {", "VAR_2++;", "}", "}", "av_dlog(s->avctx, \"count:%d index:%d, mode:%d, VAR_0:%d pos:%d\\n\",\nVAR_2, VAR_1, VAR_3, VAR_0,\n(int)put_bits_count(&s->pb));", "if (VAR_3 == 0)\nput_vlc_symbol(&s->pb, &p->vlc_state[VAR_5], VAR_4, bits);", "}", "}", "if (VAR_3) {", "while (VAR_2 >= 1 << ff_log2_run[VAR_1]) {", "VAR_2 -= 1 << ff_log2_run[VAR_1];", "VAR_1++;", "put_bits(&s->pb, 1, 1);", "}", "if (VAR_2)\nput_bits(&s->pb, 1, 1);", "}", "s->VAR_1 = VAR_1;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 73 ], [ 75 ], [ 77, 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89, 91 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 111 ], [ 113, 115 ], [ 117 ], [ 119 ], [ 121, 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 135, 137, 139 ], [ 143, 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 165, 167 ], [ 169 ], [ 171 ], [ 175 ], [ 177 ] ]
14,029
static int mpeg4_decode_header(AVCodecParserContext *s1, AVCodecContext *avctx, const uint8_t *buf, int buf_size) { struct Mp4vParseContext *pc = s1->priv_data; Mpeg4DecContext *dec_ctx = &pc->dec_ctx; MpegEncContext *s = &dec_ctx->m; GetBitContext gb1, *gb = &gb1; int ret; s->avctx = avctx; s->current_picture_ptr = &s->current_picture; if (avctx->extradata_size && pc->first_picture) { init_get_bits(gb, avctx->extradata, avctx->extradata_size * 8); ret = ff_mpeg4_decode_picture_header(dec_ctx, gb); } init_get_bits(gb, buf, 8 * buf_size); ret = ff_mpeg4_decode_picture_header(dec_ctx, gb); if (s->width && (!avctx->width || !avctx->height || !avctx->coded_width || !avctx->coded_height)) { ret = ff_set_dimensions(avctx, s->width, s->height); return ret; } if((s1->flags & PARSER_FLAG_USE_CODEC_TS) && s->avctx->time_base.den>0 && ret>=0){ av_assert1(s1->pts == AV_NOPTS_VALUE); av_assert1(s1->dts == AV_NOPTS_VALUE); s1->pts = av_rescale_q(s->time, (AVRational){1, s->avctx->time_base.den}, (AVRational){1, 1200000}); } s1->pict_type = s->pict_type; pc->first_picture = 0; return ret; }
true
FFmpeg
37ec7d291eacedfacdce21332f4c719f2be79d12
static int mpeg4_decode_header(AVCodecParserContext *s1, AVCodecContext *avctx, const uint8_t *buf, int buf_size) { struct Mp4vParseContext *pc = s1->priv_data; Mpeg4DecContext *dec_ctx = &pc->dec_ctx; MpegEncContext *s = &dec_ctx->m; GetBitContext gb1, *gb = &gb1; int ret; s->avctx = avctx; s->current_picture_ptr = &s->current_picture; if (avctx->extradata_size && pc->first_picture) { init_get_bits(gb, avctx->extradata, avctx->extradata_size * 8); ret = ff_mpeg4_decode_picture_header(dec_ctx, gb); } init_get_bits(gb, buf, 8 * buf_size); ret = ff_mpeg4_decode_picture_header(dec_ctx, gb); if (s->width && (!avctx->width || !avctx->height || !avctx->coded_width || !avctx->coded_height)) { ret = ff_set_dimensions(avctx, s->width, s->height); return ret; } if((s1->flags & PARSER_FLAG_USE_CODEC_TS) && s->avctx->time_base.den>0 && ret>=0){ av_assert1(s1->pts == AV_NOPTS_VALUE); av_assert1(s1->dts == AV_NOPTS_VALUE); s1->pts = av_rescale_q(s->time, (AVRational){1, s->avctx->time_base.den}, (AVRational){1, 1200000}); } s1->pict_type = s->pict_type; pc->first_picture = 0; return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecParserContext *VAR_0, AVCodecContext *VAR_1, const uint8_t *VAR_2, int VAR_3) { struct Mp4vParseContext *VAR_4 = VAR_0->priv_data; Mpeg4DecContext *dec_ctx = &VAR_4->dec_ctx; MpegEncContext *s = &dec_ctx->m; GetBitContext gb1, *gb = &gb1; int VAR_5; s->VAR_1 = VAR_1; s->current_picture_ptr = &s->current_picture; if (VAR_1->extradata_size && VAR_4->first_picture) { init_get_bits(gb, VAR_1->extradata, VAR_1->extradata_size * 8); VAR_5 = ff_mpeg4_decode_picture_header(dec_ctx, gb); } init_get_bits(gb, VAR_2, 8 * VAR_3); VAR_5 = ff_mpeg4_decode_picture_header(dec_ctx, gb); if (s->width && (!VAR_1->width || !VAR_1->height || !VAR_1->coded_width || !VAR_1->coded_height)) { VAR_5 = ff_set_dimensions(VAR_1, s->width, s->height); return VAR_5; } if((VAR_0->flags & PARSER_FLAG_USE_CODEC_TS) && s->VAR_1->time_base.den>0 && VAR_5>=0){ av_assert1(VAR_0->pts == AV_NOPTS_VALUE); av_assert1(VAR_0->dts == AV_NOPTS_VALUE); VAR_0->pts = av_rescale_q(s->time, (AVRational){1, s->VAR_1->time_base.den}, (AVRational){1, 1200000}); } VAR_0->pict_type = s->pict_type; VAR_4->first_picture = 0; return VAR_5; }
[ "static int FUNC_0(AVCodecParserContext *VAR_0, AVCodecContext *VAR_1,\nconst uint8_t *VAR_2, int VAR_3)\n{", "struct Mp4vParseContext *VAR_4 = VAR_0->priv_data;", "Mpeg4DecContext *dec_ctx = &VAR_4->dec_ctx;", "MpegEncContext *s = &dec_ctx->m;", "GetBitContext gb1, *gb = &gb1;", "int VAR_5;", "s->VAR_1 = VAR_1;", "s->current_picture_ptr = &s->current_picture;", "if (VAR_1->extradata_size && VAR_4->first_picture) {", "init_get_bits(gb, VAR_1->extradata, VAR_1->extradata_size * 8);", "VAR_5 = ff_mpeg4_decode_picture_header(dec_ctx, gb);", "}", "init_get_bits(gb, VAR_2, 8 * VAR_3);", "VAR_5 = ff_mpeg4_decode_picture_header(dec_ctx, gb);", "if (s->width && (!VAR_1->width || !VAR_1->height ||\n!VAR_1->coded_width || !VAR_1->coded_height)) {", "VAR_5 = ff_set_dimensions(VAR_1, s->width, s->height);", "return VAR_5;", "}", "if((VAR_0->flags & PARSER_FLAG_USE_CODEC_TS) && s->VAR_1->time_base.den>0 && VAR_5>=0){", "av_assert1(VAR_0->pts == AV_NOPTS_VALUE);", "av_assert1(VAR_0->dts == AV_NOPTS_VALUE);", "VAR_0->pts = av_rescale_q(s->time, (AVRational){1, s->VAR_1->time_base.den}, (AVRational){1, 1200000});", "}", "VAR_0->pict_type = s->pict_type;", "VAR_4->first_picture = 0;", "return VAR_5;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 37 ], [ 39 ], [ 41, 43 ], [ 45 ], [ 48 ], [ 50 ], [ 52 ], [ 54 ], [ 56 ], [ 60 ], [ 62 ], [ 66 ], [ 68 ], [ 70 ], [ 72 ] ]
14,032
void vnc_tls_client_cleanup(VncState *vs) { if (vs->tls.session) { gnutls_deinit(vs->tls.session); vs->tls.session = NULL; } g_free(vs->tls.dname); }
true
qemu
3e305e4a4752f70c0b5c3cf5b43ec957881714f7
void vnc_tls_client_cleanup(VncState *vs) { if (vs->tls.session) { gnutls_deinit(vs->tls.session); vs->tls.session = NULL; } g_free(vs->tls.dname); }
{ "code": [ "void vnc_tls_client_cleanup(VncState *vs)", " if (vs->tls.session) {", " gnutls_deinit(vs->tls.session);", " vs->tls.session = NULL;", " g_free(vs->tls.dname);", " if (vs->tls.session) {", " if (vs->tls.session) {" ], "line_no": [ 1, 5, 7, 9, 13, 5, 5 ] }
void FUNC_0(VncState *VAR_0) { if (VAR_0->tls.session) { gnutls_deinit(VAR_0->tls.session); VAR_0->tls.session = NULL; } g_free(VAR_0->tls.dname); }
[ "void FUNC_0(VncState *VAR_0)\n{", "if (VAR_0->tls.session) {", "gnutls_deinit(VAR_0->tls.session);", "VAR_0->tls.session = NULL;", "}", "g_free(VAR_0->tls.dname);", "}" ]
[ 1, 1, 1, 1, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ] ]
14,033
void colo_do_failover(MigrationState *s) { /* Make sure VM stopped while failover happened. */ if (!colo_runstate_is_stopped()) { vm_stop_force_state(RUN_STATE_COLO); } if (get_colo_mode() == COLO_MODE_PRIMARY) { primary_vm_do_failover(); } }
true
qemu
9d2db3760be9e32414e22889e3e2bffdf4898f32
void colo_do_failover(MigrationState *s) { if (!colo_runstate_is_stopped()) { vm_stop_force_state(RUN_STATE_COLO); } if (get_colo_mode() == COLO_MODE_PRIMARY) { primary_vm_do_failover(); } }
{ "code": [], "line_no": [] }
void FUNC_0(MigrationState *VAR_0) { if (!colo_runstate_is_stopped()) { vm_stop_force_state(RUN_STATE_COLO); } if (get_colo_mode() == COLO_MODE_PRIMARY) { primary_vm_do_failover(); } }
[ "void FUNC_0(MigrationState *VAR_0)\n{", "if (!colo_runstate_is_stopped()) {", "vm_stop_force_state(RUN_STATE_COLO);", "}", "if (get_colo_mode() == COLO_MODE_PRIMARY) {", "primary_vm_do_failover();", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ] ]
14,035
static void test_validate_union_flat(TestInputVisitorData *data, const void *unused) { UserDefFlatUnion *tmp = NULL; Visitor *v; Error *err = NULL; v = validate_test_init(data, "{ 'enum1': 'value1', " "'string': 'str', " "'boolean': true }"); /* TODO when generator bug is fixed, add 'integer': 41 */ visit_type_UserDefFlatUnion(v, &tmp, NULL, &err); g_assert(!err); qapi_free_UserDefFlatUnion(tmp); }
true
qemu
441cbac0c7e641780decbc674a9a68c6a5200f71
static void test_validate_union_flat(TestInputVisitorData *data, const void *unused) { UserDefFlatUnion *tmp = NULL; Visitor *v; Error *err = NULL; v = validate_test_init(data, "{ 'enum1': 'value1', " "'string': 'str', " "'boolean': true }"); visit_type_UserDefFlatUnion(v, &tmp, NULL, &err); g_assert(!err); qapi_free_UserDefFlatUnion(tmp); }
{ "code": [], "line_no": [] }
static void FUNC_0(TestInputVisitorData *VAR_0, const void *VAR_1) { UserDefFlatUnion *tmp = NULL; Visitor *v; Error *err = NULL; v = validate_test_init(VAR_0, "{ 'enum1': 'value1', " "'string': 'str', " "'boolean': true }"); visit_type_UserDefFlatUnion(v, &tmp, NULL, &err); g_assert(!err); qapi_free_UserDefFlatUnion(tmp); }
[ "static void FUNC_0(TestInputVisitorData *VAR_0,\nconst void *VAR_1)\n{", "UserDefFlatUnion *tmp = NULL;", "Visitor *v;", "Error *err = NULL;", "v = validate_test_init(VAR_0,\n\"{ 'enum1': 'value1', \"", "\"'string': 'str', \"\n\"'boolean': true }\");", "visit_type_UserDefFlatUnion(v, &tmp, NULL, &err);", "g_assert(!err);", "qapi_free_UserDefFlatUnion(tmp);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15, 17 ], [ 19, 21 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ] ]
14,036
static inline void RENAME(yuvPlanartouyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst, long width, long height, long lumStride, long chromStride, long dstStride, long vertLumPerChroma) { long y; const long chromWidth= width>>1; for(y=0; y<height; y++) { #ifdef HAVE_MMX //FIXME handle 2 lines a once (fewer prefetch, reuse some chrom, but very likely limited by mem anyway) asm volatile( "xor %%"REG_a", %%"REG_a" \n\t" ASMALIGN(4) "1: \n\t" PREFETCH" 32(%1, %%"REG_a", 2) \n\t" PREFETCH" 32(%2, %%"REG_a") \n\t" PREFETCH" 32(%3, %%"REG_a") \n\t" "movq (%2, %%"REG_a"), %%mm0 \n\t" // U(0) "movq %%mm0, %%mm2 \n\t" // U(0) "movq (%3, %%"REG_a"), %%mm1 \n\t" // V(0) "punpcklbw %%mm1, %%mm0 \n\t" // UVUV UVUV(0) "punpckhbw %%mm1, %%mm2 \n\t" // UVUV UVUV(8) "movq (%1, %%"REG_a",2), %%mm3 \n\t" // Y(0) "movq 8(%1, %%"REG_a",2), %%mm5 \n\t" // Y(8) "movq %%mm0, %%mm4 \n\t" // Y(0) "movq %%mm2, %%mm6 \n\t" // Y(8) "punpcklbw %%mm3, %%mm0 \n\t" // YUYV YUYV(0) "punpckhbw %%mm3, %%mm4 \n\t" // YUYV YUYV(4) "punpcklbw %%mm5, %%mm2 \n\t" // YUYV YUYV(8) "punpckhbw %%mm5, %%mm6 \n\t" // YUYV YUYV(12) MOVNTQ" %%mm0, (%0, %%"REG_a", 4)\n\t" MOVNTQ" %%mm4, 8(%0, %%"REG_a", 4)\n\t" MOVNTQ" %%mm2, 16(%0, %%"REG_a", 4)\n\t" MOVNTQ" %%mm6, 24(%0, %%"REG_a", 4)\n\t" "add $8, %%"REG_a" \n\t" "cmp %4, %%"REG_a" \n\t" " jb 1b \n\t" ::"r"(dst), "r"(ysrc), "r"(usrc), "r"(vsrc), "g" (chromWidth) : "%"REG_a ); #else //FIXME adapt the alpha asm code from yv12->yuy2 #if __WORDSIZE >= 64 int i; uint64_t *ldst = (uint64_t *) dst; const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc; for(i = 0; i < chromWidth; i += 2){ uint64_t k, l; k = uc[0] + (yc[0] << 8) + (vc[0] << 16) + (yc[1] << 24); l = uc[1] + (yc[2] << 8) + (vc[1] << 16) + (yc[3] << 24); *ldst++ = k + (l << 32); yc += 4; uc += 2; vc += 2; } #else int i, *idst = (int32_t *) dst; const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc; for(i = 0; i < chromWidth; i++){ #ifdef WORDS_BIGENDIAN *idst++ = (uc[0] << 24)+ (yc[0] << 16) + (vc[0] << 8) + (yc[1] << 0); #else *idst++ = uc[0] + (yc[0] << 8) + (vc[0] << 16) + (yc[1] << 24); #endif yc += 2; uc++; vc++; } #endif #endif if((y&(vertLumPerChroma-1))==(vertLumPerChroma-1) ) { usrc += chromStride; vsrc += chromStride; } ysrc += lumStride; dst += dstStride; } #ifdef HAVE_MMX asm( EMMS" \n\t" SFENCE" \n\t" :::"memory"); #endif }
true
FFmpeg
6e42e6c4b410dbef8b593c2d796a5dad95f89ee4
static inline void RENAME(yuvPlanartouyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst, long width, long height, long lumStride, long chromStride, long dstStride, long vertLumPerChroma) { long y; const long chromWidth= width>>1; for(y=0; y<height; y++) { #ifdef HAVE_MMX asm volatile( "xor %%"REG_a", %%"REG_a" \n\t" ASMALIGN(4) "1: \n\t" PREFETCH" 32(%1, %%"REG_a", 2) \n\t" PREFETCH" 32(%2, %%"REG_a") \n\t" PREFETCH" 32(%3, %%"REG_a") \n\t" "movq (%2, %%"REG_a"), %%mm0 \n\t" "movq %%mm0, %%mm2 \n\t" "movq (%3, %%"REG_a"), %%mm1 \n\t" "punpcklbw %%mm1, %%mm0 \n\t" "punpckhbw %%mm1, %%mm2 \n\t" "movq (%1, %%"REG_a",2), %%mm3 \n\t" "movq 8(%1, %%"REG_a",2), %%mm5 \n\t" "movq %%mm0, %%mm4 \n\t" "movq %%mm2, %%mm6 \n\t" "punpcklbw %%mm3, %%mm0 \n\t" "punpckhbw %%mm3, %%mm4 \n\t" "punpcklbw %%mm5, %%mm2 \n\t" "punpckhbw %%mm5, %%mm6 \n\t" MOVNTQ" %%mm0, (%0, %%"REG_a", 4)\n\t" MOVNTQ" %%mm4, 8(%0, %%"REG_a", 4)\n\t" MOVNTQ" %%mm2, 16(%0, %%"REG_a", 4)\n\t" MOVNTQ" %%mm6, 24(%0, %%"REG_a", 4)\n\t" "add $8, %%"REG_a" \n\t" "cmp %4, %%"REG_a" \n\t" " jb 1b \n\t" ::"r"(dst), "r"(ysrc), "r"(usrc), "r"(vsrc), "g" (chromWidth) : "%"REG_a ); #else #if __WORDSIZE >= 64 int i; uint64_t *ldst = (uint64_t *) dst; const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc; for(i = 0; i < chromWidth; i += 2){ uint64_t k, l; k = uc[0] + (yc[0] << 8) + (vc[0] << 16) + (yc[1] << 24); l = uc[1] + (yc[2] << 8) + (vc[1] << 16) + (yc[3] << 24); *ldst++ = k + (l << 32); yc += 4; uc += 2; vc += 2; } #else int i, *idst = (int32_t *) dst; const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc; for(i = 0; i < chromWidth; i++){ #ifdef WORDS_BIGENDIAN *idst++ = (uc[0] << 24)+ (yc[0] << 16) + (vc[0] << 8) + (yc[1] << 0); #else *idst++ = uc[0] + (yc[0] << 8) + (vc[0] << 16) + (yc[1] << 24); #endif yc += 2; uc++; vc++; } #endif #endif if((y&(vertLumPerChroma-1))==(vertLumPerChroma-1) ) { usrc += chromStride; vsrc += chromStride; } ysrc += lumStride; dst += dstStride; } #ifdef HAVE_MMX asm( EMMS" \n\t" SFENCE" \n\t" :::"memory"); #endif }
{ "code": [ "\tlong width, long height,", "\tlong width, long height,", "\tlong width, long height,", "\tlong width, long height,", "\tlong width, long height,", "\tlong width, long height,", "\tlong width, long height,", "\tlong width, long height,", "\tlong width, long height,", "\tlong width, long height,", "#ifdef HAVE_MMX", "#endif", "#ifdef HAVE_MMX", "#endif", "#ifdef WORDS_BIGENDIAN", "#else", "#endif", "#endif", "\t\t);", "\t\t);", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "\tlong width, long height,", "\tlong lumStride, long chromStride, long dstStride, long vertLumPerChroma)", "\tlong y;", "\tconst long chromWidth= width>>1;", "\tfor(y=0; y<height; y++)", "\t\tasm volatile(", "\t\t\t\"xor %%\"REG_a\", %%\"REG_a\"\t\\n\\t\"", "\t\t\tASMALIGN(4)", "\t\t\t\"1:\t\t\t\t\\n\\t\"", "\t\t\tPREFETCH\" 32(%1, %%\"REG_a\", 2)\t\\n\\t\"", "\t\t\tPREFETCH\" 32(%2, %%\"REG_a\")\t\\n\\t\"", "\t\t\tPREFETCH\" 32(%3, %%\"REG_a\")\t\\n\\t\"", "\t\t\tMOVNTQ\" %%mm4, 8(%0, %%\"REG_a\", 4)\\n\\t\"", "\t\t\tMOVNTQ\" %%mm6, 24(%0, %%\"REG_a\", 4)\\n\\t\"", "\t\t\t\"add $8, %%\"REG_a\"\t\t\\n\\t\"", "\t\t\t\"cmp %4, %%\"REG_a\"\t\t\\n\\t\"", "\t\t\t\" jb 1b\t\t\t\t\\n\\t\"", "\t\t\t::\"r\"(dst), \"r\"(ysrc), \"r\"(usrc), \"r\"(vsrc), \"g\" (chromWidth)", "\t\t\t: \"%\"REG_a", "\t\t);", "\t\tint i;", "\t\t\tyc += 4;", "\t\tysrc += lumStride;", "\t\tdst += dstStride;", "\t\tint i;", "\t\tuint64_t *ldst = (uint64_t *) dst;", "\t\tconst uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc;", "\t\tfor(i = 0; i < chromWidth; i += 2){", "\t\t\tuint64_t k, l;", "\t\t\t*ldst++ = k + (l << 32);", "\t\t\tyc += 4;", "\t\t\tuc += 2;", "\t\t\tvc += 2;", "\t\tint i, *idst = (int32_t *) dst;", "\t\tconst uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc;", "\t\tfor(i = 0; i < chromWidth; i++){", "#endif", "\t\t\tyc += 2;", "\t\t\tuc++;", "\t\t\tvc++;", "#endif", "#endif", "\t\tif((y&(vertLumPerChroma-1))==(vertLumPerChroma-1) )", "\t\t\tusrc += chromStride;", "\t\t\tvsrc += chromStride;", "\t\tysrc += lumStride;", "\t\tdst += dstStride;", "asm( EMMS\" \\n\\t\"", " SFENCE\" \\n\\t\"", "\tlong width, long height,", "\tlong width, long height,", "\tlong lumStride, long chromStride, long dstStride, long vertLumPerChroma)", "\tlong y;", "\tconst long chromWidth= width>>1;", "\tfor(y=0; y<height; y++)", "\t\tasm volatile(", "\t\t\t\"xor %%\"REG_a\", %%\"REG_a\"\t\\n\\t\"", "\t\t\tASMALIGN(4)", "\t\t\t\"1:\t\t\t\t\\n\\t\"", "\t\t\tPREFETCH\" 32(%1, %%\"REG_a\", 2)\t\\n\\t\"", "\t\t\tPREFETCH\" 32(%2, %%\"REG_a\")\t\\n\\t\"", "\t\t\tPREFETCH\" 32(%3, %%\"REG_a\")\t\\n\\t\"", "\t\t\tMOVNTQ\" %%mm0, (%0, %%\"REG_a\", 4)\\n\\t\"", "\t\t\tMOVNTQ\" %%mm4, 8(%0, %%\"REG_a\", 4)\\n\\t\"", "\t\t\tMOVNTQ\" %%mm2, 16(%0, %%\"REG_a\", 4)\\n\\t\"", "\t\t\tMOVNTQ\" %%mm6, 24(%0, %%\"REG_a\", 4)\\n\\t\"", "\t\t\t\"add $8, %%\"REG_a\"\t\t\\n\\t\"", "\t\t\t\"cmp %4, %%\"REG_a\"\t\t\\n\\t\"", "\t\t\t\" jb 1b\t\t\t\t\\n\\t\"", "\t\t\t::\"r\"(dst), \"r\"(ysrc), \"r\"(usrc), \"r\"(vsrc), \"g\" (chromWidth)", "\t\t\t: \"%\"REG_a", "\t\t);", "\t\tint i;", "\t\tuint64_t *ldst = (uint64_t *) dst;", "\t\tconst uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc;", "\t\tfor(i = 0; i < chromWidth; i += 2){", "\t\t\tuint64_t k, l;", "\t\t\tk = uc[0] + (yc[0] << 8) +", "\t\t\t (vc[0] << 16) + (yc[1] << 24);", "\t\t\tl = uc[1] + (yc[2] << 8) +", "\t\t\t (vc[1] << 16) + (yc[3] << 24);", "\t\t\t*ldst++ = k + (l << 32);", "\t\t\tyc += 4;", "\t\t\tuc += 2;", "\t\t\tvc += 2;", "\t\tint i, *idst = (int32_t *) dst;", "\t\tconst uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc;", "\t\tfor(i = 0; i < chromWidth; i++){", "\t\t\t*idst++ = (uc[0] << 24)+ (yc[0] << 16) +", "\t\t\t (vc[0] << 8) + (yc[1] << 0);", "\t\t\t*idst++ = uc[0] + (yc[0] << 8) +", "\t\t\t (vc[0] << 16) + (yc[1] << 24);", "#endif", "\t\t\tyc += 2;", "\t\t\tuc++;", "\t\t\tvc++;", "#endif", "#endif", "\t\tif((y&(vertLumPerChroma-1))==(vertLumPerChroma-1) )", "\t\t\tusrc += chromStride;", "\t\t\tvsrc += chromStride;", "\t\tysrc += lumStride;", "\t\tdst += dstStride;", "asm( EMMS\" \\n\\t\"", " SFENCE\" \\n\\t\"", "\tlong width, long height,", "\tlong width, long height,", "\tlong width, long height,", "\tlong y;", "\tconst long chromWidth= width>>1;", "\t\tasm volatile(", "\t\t\t\"xor %%\"REG_a\", %%\"REG_a\"\t\\n\\t\"", "\t\t\tASMALIGN(4)", "\t\t\t\"1:\t\t\t\t\\n\\t\"", "\t\t\t\"add $8, %%\"REG_a\"\t\t\\n\\t\"", "\t\t\t\"cmp %4, %%\"REG_a\"\t\t\\n\\t\"", "\t\t\t\" jb 1b\t\t\t\t\\n\\t\"", "\t\t);", "\t\tasm volatile(", "\t\t\t\"xor %%\"REG_a\", %%\"REG_a\"\t\\n\\t\"", "\t\t\tASMALIGN(4)", "\t\t\t\"1:\t\t\t\t\\n\\t\"", "\t\t\t\"add $8, %%\"REG_a\"\t\t\\n\\t\"", "\t\t\t\"cmp %4, %%\"REG_a\"\t\t\\n\\t\"", "\t\t\t\" jb 1b\t\t\t\t\\n\\t\"", "\t\t);", "#endif", "\t\tasm volatile(", "\t\t\t\"1:\t\t\t\t\\n\\t\"", "#endif", "\t\t\t\"add $8, %%\"REG_a\"\t\t\\n\\t\"", "\t\t\t: \"%\"REG_a", "\t\t);", "#endif", "\tlong width, long height,", "\tlong y;", "\tconst long chromWidth= width>>1;", "\t\tasm volatile(", "\t\t\tASMALIGN(4)", "\t\t\t\"1:\t\t\t\t\\n\\t\"", "\t\t\t\" jb 1b\t\t\t\t\\n\\t\"", "\t\t);", "\t\tasm volatile(", "\t\t\tASMALIGN(4)", "\t\t\t\"1:\t\t\t\t\\n\\t\"", "\t\t\t\" jb 1b\t\t\t\t\\n\\t\"", "\t\t);", "#endif", "\tlong width, long height,", "\tlong y;", "\tconst long chromWidth= width>>1;", "#endif", "#endif", "\t\tasm volatile(", "\t\t\tASMALIGN(4)", "\t\t\t\"1:\t\t\t\t\\n\\t\"", "#endif", "#endif", "#endif", "#endif", "\t\t);", "#endif", "\t\t\t\"xor %%\"REG_a\", %%\"REG_a\"\t\\n\\t\"", "\t\t\t\"1:\t\t\t\t\\n\\t\"", "\t\t\t\" jb 1b\t\t\t\t\\n\\t\"", "\t\t);", "\t\t\t\"xor %%\"REG_a\", %%\"REG_a\"\t\\n\\t\"", "\t\t\t\"1:\t\t\t\t\\n\\t\"", "\t\t\t\" jb 1b\t\t\t\t\\n\\t\"", "\t\t);", "#endif", "\t\t);", "#endif", "#endif", "#endif", "\t\t);", "#endif", "\t\t);" ], "line_no": [ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 17, 145, 17, 145, 133, 87, 145, 145, 85, 85, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 3, 5, 9, 11, 13, 21, 23, 25, 27, 29, 31, 33, 67, 71, 75, 77, 79, 81, 83, 85, 95, 115, 169, 171, 95, 97, 99, 101, 103, 113, 115, 117, 119, 127, 99, 131, 145, 147, 149, 151, 145, 145, 159, 163, 165, 169, 171, 177, 179, 3, 3, 5, 9, 11, 13, 21, 23, 25, 27, 29, 31, 33, 65, 67, 69, 71, 75, 77, 79, 81, 83, 85, 95, 97, 99, 101, 103, 105, 107, 109, 111, 113, 115, 117, 119, 127, 99, 131, 135, 137, 141, 107, 145, 147, 149, 151, 145, 145, 159, 163, 165, 169, 171, 177, 179, 3, 3, 3, 9, 11, 21, 23, 25, 27, 75, 77, 79, 85, 21, 23, 25, 27, 75, 77, 79, 85, 145, 21, 27, 145, 75, 83, 85, 145, 3, 9, 11, 21, 25, 27, 79, 85, 21, 25, 27, 79, 85, 145, 3, 9, 11, 145, 145, 21, 25, 27, 145, 145, 145, 145, 85, 145, 23, 27, 79, 85, 23, 27, 79, 85, 145, 85, 145, 145, 145, 85, 145, 85 ] }
static inline void FUNC_0(yuvPlanartouyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst, long width, long height, long lumStride, long chromStride, long dstStride, long vertLumPerChroma) { long VAR_0; const long VAR_1= width>>1; for(VAR_0=0; VAR_0<height; VAR_0++) { #ifdef HAVE_MMX asm volatile( "xor %%"REG_a", %%"REG_a" \n\t" ASMALIGN(4) "1: \n\t" PREFETCH" 32(%1, %%"REG_a", 2) \n\t" PREFETCH" 32(%2, %%"REG_a") \n\t" PREFETCH" 32(%3, %%"REG_a") \n\t" "movq (%2, %%"REG_a"), %%mm0 \n\t" "movq %%mm0, %%mm2 \n\t" "movq (%3, %%"REG_a"), %%mm1 \n\t" "punpcklbw %%mm1, %%mm0 \n\t" "punpckhbw %%mm1, %%mm2 \n\t" "movq (%1, %%"REG_a",2), %%mm3 \n\t" "movq 8(%1, %%"REG_a",2), %%mm5 \n\t" "movq %%mm0, %%mm4 \n\t" "movq %%mm2, %%mm6 \n\t" "punpcklbw %%mm3, %%mm0 \n\t" "punpckhbw %%mm3, %%mm4 \n\t" "punpcklbw %%mm5, %%mm2 \n\t" "punpckhbw %%mm5, %%mm6 \n\t" MOVNTQ" %%mm0, (%0, %%"REG_a", 4)\n\t" MOVNTQ" %%mm4, 8(%0, %%"REG_a", 4)\n\t" MOVNTQ" %%mm2, 16(%0, %%"REG_a", 4)\n\t" MOVNTQ" %%mm6, 24(%0, %%"REG_a", 4)\n\t" "add $8, %%"REG_a" \n\t" "cmp %4, %%"REG_a" \n\t" " jb 1b \n\t" ::"r"(dst), "r"(ysrc), "r"(usrc), "r"(vsrc), "g" (VAR_1) : "%"REG_a ); #else #if __WORDSIZE >= 64 int i; uint64_t *ldst = (uint64_t *) dst; const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc; for(i = 0; i < VAR_1; i += 2){ uint64_t k, l; k = uc[0] + (yc[0] << 8) + (vc[0] << 16) + (yc[1] << 24); l = uc[1] + (yc[2] << 8) + (vc[1] << 16) + (yc[3] << 24); *ldst++ = k + (l << 32); yc += 4; uc += 2; vc += 2; } #else int i, *idst = (int32_t *) dst; const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc; for(i = 0; i < VAR_1; i++){ #ifdef WORDS_BIGENDIAN *idst++ = (uc[0] << 24)+ (yc[0] << 16) + (vc[0] << 8) + (yc[1] << 0); #else *idst++ = uc[0] + (yc[0] << 8) + (vc[0] << 16) + (yc[1] << 24); #endif yc += 2; uc++; vc++; } #endif #endif if((VAR_0&(vertLumPerChroma-1))==(vertLumPerChroma-1) ) { usrc += chromStride; vsrc += chromStride; } ysrc += lumStride; dst += dstStride; } #ifdef HAVE_MMX asm( EMMS" \n\t" SFENCE" \n\t" :::"memory"); #endif }
[ "static inline void FUNC_0(yuvPlanartouyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,\nlong width, long height,\nlong lumStride, long chromStride, long dstStride, long vertLumPerChroma)\n{", "long VAR_0;", "const long VAR_1= width>>1;", "for(VAR_0=0; VAR_0<height; VAR_0++)", "{", "#ifdef HAVE_MMX\nasm volatile(\n\"xor %%\"REG_a\", %%\"REG_a\"\t\\n\\t\"\nASMALIGN(4)\n\"1:\t\t\t\t\\n\\t\"\nPREFETCH\" 32(%1, %%\"REG_a\", 2)\t\\n\\t\"\nPREFETCH\" 32(%2, %%\"REG_a\")\t\\n\\t\"\nPREFETCH\" 32(%3, %%\"REG_a\")\t\\n\\t\"\n\"movq (%2, %%\"REG_a\"), %%mm0\t\\n\\t\"\n\"movq %%mm0, %%mm2\t\t\\n\\t\"\n\"movq (%3, %%\"REG_a\"), %%mm1\t\\n\\t\"\n\"punpcklbw %%mm1, %%mm0\t\t\\n\\t\"\n\"punpckhbw %%mm1, %%mm2\t\t\\n\\t\"\n\"movq (%1, %%\"REG_a\",2), %%mm3\t\\n\\t\"\n\"movq 8(%1, %%\"REG_a\",2), %%mm5\t\\n\\t\"\n\"movq %%mm0, %%mm4\t\t\\n\\t\"\n\"movq %%mm2, %%mm6\t\t\\n\\t\"\n\"punpcklbw %%mm3, %%mm0\t\t\\n\\t\"\n\"punpckhbw %%mm3, %%mm4\t\t\\n\\t\"\n\"punpcklbw %%mm5, %%mm2\t\t\\n\\t\"\n\"punpckhbw %%mm5, %%mm6\t\t\\n\\t\"\nMOVNTQ\" %%mm0, (%0, %%\"REG_a\", 4)\\n\\t\"\nMOVNTQ\" %%mm4, 8(%0, %%\"REG_a\", 4)\\n\\t\"\nMOVNTQ\" %%mm2, 16(%0, %%\"REG_a\", 4)\\n\\t\"\nMOVNTQ\" %%mm6, 24(%0, %%\"REG_a\", 4)\\n\\t\"\n\"add $8, %%\"REG_a\"\t\t\\n\\t\"\n\"cmp %4, %%\"REG_a\"\t\t\\n\\t\"\n\" jb 1b\t\t\t\t\\n\\t\"\n::\"r\"(dst), \"r\"(ysrc), \"r\"(usrc), \"r\"(vsrc), \"g\" (VAR_1)\n: \"%\"REG_a\n);", "#else\n#if __WORDSIZE >= 64\nint i;", "uint64_t *ldst = (uint64_t *) dst;", "const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc;", "for(i = 0; i < VAR_1; i += 2){", "uint64_t k, l;", "k = uc[0] + (yc[0] << 8) +\n(vc[0] << 16) + (yc[1] << 24);", "l = uc[1] + (yc[2] << 8) +\n(vc[1] << 16) + (yc[3] << 24);", "*ldst++ = k + (l << 32);", "yc += 4;", "uc += 2;", "vc += 2;", "}", "#else\nint i, *idst = (int32_t *) dst;", "const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc;", "for(i = 0; i < VAR_1; i++){", "#ifdef WORDS_BIGENDIAN\n*idst++ = (uc[0] << 24)+ (yc[0] << 16) +\n(vc[0] << 8) + (yc[1] << 0);", "#else\n*idst++ = uc[0] + (yc[0] << 8) +\n(vc[0] << 16) + (yc[1] << 24);", "#endif\nyc += 2;", "uc++;", "vc++;", "}", "#endif\n#endif\nif((VAR_0&(vertLumPerChroma-1))==(vertLumPerChroma-1) )\n{", "usrc += chromStride;", "vsrc += chromStride;", "}", "ysrc += lumStride;", "dst += dstStride;", "}", "#ifdef HAVE_MMX\nasm( EMMS\" \\n\\t\"\nSFENCE\" \\n\\t\"\n:::\"memory\");", "#endif\n}" ]
[ 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 47, 49, 51, 53, 55, 57, 59, 61, 65, 67, 69, 71, 75, 77, 79, 81, 83, 85 ], [ 87, 93, 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105, 107 ], [ 109, 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 125, 127 ], [ 129 ], [ 131 ], [ 133, 135, 137 ], [ 139, 141, 143 ], [ 145, 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155, 157, 159, 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175, 177, 179, 181 ], [ 183, 185 ] ]
14,037
int target_munmap(target_ulong start, target_ulong len) { target_ulong end, real_start, real_end, addr; int prot, ret; #ifdef DEBUG_MMAP printf("munmap: start=0x%lx len=0x%lx\n", start, len); #endif if (start & ~TARGET_PAGE_MASK) return -EINVAL; len = TARGET_PAGE_ALIGN(len); if (len == 0) return -EINVAL; end = start + len; real_start = start & qemu_host_page_mask; real_end = HOST_PAGE_ALIGN(end); if (start > real_start) { /* handle host page containing start */ prot = 0; for(addr = real_start; addr < start; addr += TARGET_PAGE_SIZE) { prot |= page_get_flags(addr); } if (real_end == real_start + qemu_host_page_size) { for(addr = end; addr < real_end; addr += TARGET_PAGE_SIZE) { prot |= page_get_flags(addr); } end = real_end; } if (prot != 0) real_start += qemu_host_page_size; } if (end < real_end) { prot = 0; for(addr = end; addr < real_end; addr += TARGET_PAGE_SIZE) { prot |= page_get_flags(addr); } if (prot != 0) real_end -= qemu_host_page_size; } /* unmap what we can */ if (real_start < real_end) { ret = munmap((void *)real_start, real_end - real_start); if (ret != 0) return ret; } page_set_flags(start, start + len, 0); return 0; }
true
qemu
4118a97030aa9bd1d520d1d06bbe0655d829df04
int target_munmap(target_ulong start, target_ulong len) { target_ulong end, real_start, real_end, addr; int prot, ret; #ifdef DEBUG_MMAP printf("munmap: start=0x%lx len=0x%lx\n", start, len); #endif if (start & ~TARGET_PAGE_MASK) return -EINVAL; len = TARGET_PAGE_ALIGN(len); if (len == 0) return -EINVAL; end = start + len; real_start = start & qemu_host_page_mask; real_end = HOST_PAGE_ALIGN(end); if (start > real_start) { prot = 0; for(addr = real_start; addr < start; addr += TARGET_PAGE_SIZE) { prot |= page_get_flags(addr); } if (real_end == real_start + qemu_host_page_size) { for(addr = end; addr < real_end; addr += TARGET_PAGE_SIZE) { prot |= page_get_flags(addr); } end = real_end; } if (prot != 0) real_start += qemu_host_page_size; } if (end < real_end) { prot = 0; for(addr = end; addr < real_end; addr += TARGET_PAGE_SIZE) { prot |= page_get_flags(addr); } if (prot != 0) real_end -= qemu_host_page_size; } if (real_start < real_end) { ret = munmap((void *)real_start, real_end - real_start); if (ret != 0) return ret; } page_set_flags(start, start + len, 0); return 0; }
{ "code": [ " ret = munmap((void *)real_start, real_end - real_start);" ], "line_no": [ 87 ] }
int FUNC_0(target_ulong VAR_0, target_ulong VAR_1) { target_ulong end, real_start, real_end, addr; int VAR_2, VAR_3; #ifdef DEBUG_MMAP printf("munmap: VAR_0=0x%lx VAR_1=0x%lx\n", VAR_0, VAR_1); #endif if (VAR_0 & ~TARGET_PAGE_MASK) return -EINVAL; VAR_1 = TARGET_PAGE_ALIGN(VAR_1); if (VAR_1 == 0) return -EINVAL; end = VAR_0 + VAR_1; real_start = VAR_0 & qemu_host_page_mask; real_end = HOST_PAGE_ALIGN(end); if (VAR_0 > real_start) { VAR_2 = 0; for(addr = real_start; addr < VAR_0; addr += TARGET_PAGE_SIZE) { VAR_2 |= page_get_flags(addr); } if (real_end == real_start + qemu_host_page_size) { for(addr = end; addr < real_end; addr += TARGET_PAGE_SIZE) { VAR_2 |= page_get_flags(addr); } end = real_end; } if (VAR_2 != 0) real_start += qemu_host_page_size; } if (end < real_end) { VAR_2 = 0; for(addr = end; addr < real_end; addr += TARGET_PAGE_SIZE) { VAR_2 |= page_get_flags(addr); } if (VAR_2 != 0) real_end -= qemu_host_page_size; } if (real_start < real_end) { VAR_3 = munmap((void *)real_start, real_end - real_start); if (VAR_3 != 0) return VAR_3; } page_set_flags(VAR_0, VAR_0 + VAR_1, 0); return 0; }
[ "int FUNC_0(target_ulong VAR_0, target_ulong VAR_1)\n{", "target_ulong end, real_start, real_end, addr;", "int VAR_2, VAR_3;", "#ifdef DEBUG_MMAP\nprintf(\"munmap: VAR_0=0x%lx VAR_1=0x%lx\\n\", VAR_0, VAR_1);", "#endif\nif (VAR_0 & ~TARGET_PAGE_MASK)\nreturn -EINVAL;", "VAR_1 = TARGET_PAGE_ALIGN(VAR_1);", "if (VAR_1 == 0)\nreturn -EINVAL;", "end = VAR_0 + VAR_1;", "real_start = VAR_0 & qemu_host_page_mask;", "real_end = HOST_PAGE_ALIGN(end);", "if (VAR_0 > real_start) {", "VAR_2 = 0;", "for(addr = real_start; addr < VAR_0; addr += TARGET_PAGE_SIZE) {", "VAR_2 |= page_get_flags(addr);", "}", "if (real_end == real_start + qemu_host_page_size) {", "for(addr = end; addr < real_end; addr += TARGET_PAGE_SIZE) {", "VAR_2 |= page_get_flags(addr);", "}", "end = real_end;", "}", "if (VAR_2 != 0)\nreal_start += qemu_host_page_size;", "}", "if (end < real_end) {", "VAR_2 = 0;", "for(addr = end; addr < real_end; addr += TARGET_PAGE_SIZE) {", "VAR_2 |= page_get_flags(addr);", "}", "if (VAR_2 != 0)\nreal_end -= qemu_host_page_size;", "}", "if (real_start < real_end) {", "VAR_3 = munmap((void *)real_start, real_end - real_start);", "if (VAR_3 != 0)\nreturn VAR_3;", "}", "page_set_flags(VAR_0, VAR_0 + VAR_1, 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, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11, 13 ], [ 15, 17, 19 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59, 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75, 77 ], [ 79 ], [ 85 ], [ 87 ], [ 89, 91 ], [ 93 ], [ 97 ], [ 99 ], [ 101 ] ]
14,038
int cpu_exec(CPUState *env) { int ret, interrupt_request; TranslationBlock *tb; uint8_t *tc_ptr; unsigned long next_tb; if (env->halted) { if (!cpu_has_work(env)) { return EXCP_HALTED; } env->halted = 0; } cpu_single_env = env; if (unlikely(exit_request)) { env->exit_request = 1; } #if defined(TARGET_I386) /* put eflags in CPU temporary format */ CC_SRC = env->eflags & (CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C); DF = 1 - (2 * ((env->eflags >> 10) & 1)); CC_OP = CC_OP_EFLAGS; env->eflags &= ~(DF_MASK | CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C); #elif defined(TARGET_SPARC) #elif defined(TARGET_M68K) env->cc_op = CC_OP_FLAGS; env->cc_dest = env->sr & 0xf; env->cc_x = (env->sr >> 4) & 1; #elif defined(TARGET_ALPHA) #elif defined(TARGET_ARM) #elif defined(TARGET_UNICORE32) #elif defined(TARGET_PPC) #elif defined(TARGET_LM32) #elif defined(TARGET_MICROBLAZE) #elif defined(TARGET_MIPS) #elif defined(TARGET_SH4) #elif defined(TARGET_CRIS) #elif defined(TARGET_S390X) /* XXXXX */ #else #error unsupported target CPU #endif env->exception_index = -1; /* prepare setjmp context for exception handling */ for(;;) { if (setjmp(env->jmp_env) == 0) { /* if an exception is pending, we execute it here */ if (env->exception_index >= 0) { if (env->exception_index >= EXCP_INTERRUPT) { /* exit request from the cpu execution loop */ ret = env->exception_index; if (ret == EXCP_DEBUG) { cpu_handle_debug_exception(env); } break; #if defined(CONFIG_USER_ONLY) /* if user mode only, we simulate a fake exception which will be handled outside the cpu execution loop */ #if defined(TARGET_I386) do_interrupt(env); #endif ret = env->exception_index; break; #else do_interrupt(env); env->exception_index = -1; #endif } } next_tb = 0; /* force lookup of first TB */ for(;;) { interrupt_request = env->interrupt_request; if (unlikely(interrupt_request)) { if (unlikely(env->singlestep_enabled & SSTEP_NOIRQ)) { /* Mask out external interrupts for this step. */ interrupt_request &= ~CPU_INTERRUPT_SSTEP_MASK; } if (interrupt_request & CPU_INTERRUPT_DEBUG) { env->interrupt_request &= ~CPU_INTERRUPT_DEBUG; env->exception_index = EXCP_DEBUG; cpu_loop_exit(env); } #if defined(TARGET_ARM) || defined(TARGET_SPARC) || defined(TARGET_MIPS) || \ defined(TARGET_PPC) || defined(TARGET_ALPHA) || defined(TARGET_CRIS) || \ defined(TARGET_MICROBLAZE) || defined(TARGET_LM32) || defined(TARGET_UNICORE32) if (interrupt_request & CPU_INTERRUPT_HALT) { env->interrupt_request &= ~CPU_INTERRUPT_HALT; env->halted = 1; env->exception_index = EXCP_HLT; cpu_loop_exit(env); } #endif #if defined(TARGET_I386) if (interrupt_request & CPU_INTERRUPT_INIT) { svm_check_intercept(env, SVM_EXIT_INIT); do_cpu_init(env); env->exception_index = EXCP_HALTED; cpu_loop_exit(env); } else if (interrupt_request & CPU_INTERRUPT_SIPI) { do_cpu_sipi(env); } else if (env->hflags2 & HF2_GIF_MASK) { if ((interrupt_request & CPU_INTERRUPT_SMI) && !(env->hflags & HF_SMM_MASK)) { svm_check_intercept(env, SVM_EXIT_SMI); env->interrupt_request &= ~CPU_INTERRUPT_SMI; do_smm_enter(env); next_tb = 0; } else if ((interrupt_request & CPU_INTERRUPT_NMI) && !(env->hflags2 & HF2_NMI_MASK)) { env->interrupt_request &= ~CPU_INTERRUPT_NMI; env->hflags2 |= HF2_NMI_MASK; do_interrupt_x86_hardirq(env, EXCP02_NMI, 1); next_tb = 0; } else if (interrupt_request & CPU_INTERRUPT_MCE) { env->interrupt_request &= ~CPU_INTERRUPT_MCE; do_interrupt_x86_hardirq(env, EXCP12_MCHK, 0); next_tb = 0; } else if ((interrupt_request & CPU_INTERRUPT_HARD) && (((env->hflags2 & HF2_VINTR_MASK) && (env->hflags2 & HF2_HIF_MASK)) || (!(env->hflags2 & HF2_VINTR_MASK) && (env->eflags & IF_MASK && !(env->hflags & HF_INHIBIT_IRQ_MASK))))) { int intno; svm_check_intercept(env, SVM_EXIT_INTR); env->interrupt_request &= ~(CPU_INTERRUPT_HARD | CPU_INTERRUPT_VIRQ); intno = cpu_get_pic_interrupt(env); qemu_log_mask(CPU_LOG_TB_IN_ASM, "Servicing hardware INT=0x%02x\n", intno); do_interrupt_x86_hardirq(env, intno, 1); /* ensure that no TB jump will be modified as the program flow was changed */ next_tb = 0; #if !defined(CONFIG_USER_ONLY) } else if ((interrupt_request & CPU_INTERRUPT_VIRQ) && (env->eflags & IF_MASK) && !(env->hflags & HF_INHIBIT_IRQ_MASK)) { int intno; /* FIXME: this should respect TPR */ svm_check_intercept(env, SVM_EXIT_VINTR); intno = ldl_phys(env->vm_vmcb + offsetof(struct vmcb, control.int_vector)); qemu_log_mask(CPU_LOG_TB_IN_ASM, "Servicing virtual hardware INT=0x%02x\n", intno); do_interrupt_x86_hardirq(env, intno, 1); env->interrupt_request &= ~CPU_INTERRUPT_VIRQ; next_tb = 0; #endif } } #elif defined(TARGET_PPC) #if 0 if ((interrupt_request & CPU_INTERRUPT_RESET)) { cpu_reset(env); } #endif if (interrupt_request & CPU_INTERRUPT_HARD) { ppc_hw_interrupt(env); if (env->pending_interrupts == 0) env->interrupt_request &= ~CPU_INTERRUPT_HARD; next_tb = 0; } #elif defined(TARGET_LM32) if ((interrupt_request & CPU_INTERRUPT_HARD) && (env->ie & IE_IE)) { env->exception_index = EXCP_IRQ; do_interrupt(env); next_tb = 0; } #elif defined(TARGET_MICROBLAZE) if ((interrupt_request & CPU_INTERRUPT_HARD) && (env->sregs[SR_MSR] & MSR_IE) && !(env->sregs[SR_MSR] & (MSR_EIP | MSR_BIP)) && !(env->iflags & (D_FLAG | IMM_FLAG))) { env->exception_index = EXCP_IRQ; do_interrupt(env); next_tb = 0; } #elif defined(TARGET_MIPS) if ((interrupt_request & CPU_INTERRUPT_HARD) && cpu_mips_hw_interrupts_pending(env)) { /* Raise it */ env->exception_index = EXCP_EXT_INTERRUPT; env->error_code = 0; do_interrupt(env); next_tb = 0; } #elif defined(TARGET_SPARC) if (interrupt_request & CPU_INTERRUPT_HARD) { if (cpu_interrupts_enabled(env) && env->interrupt_index > 0) { int pil = env->interrupt_index & 0xf; int type = env->interrupt_index & 0xf0; if (((type == TT_EXTINT) && cpu_pil_allowed(env, pil)) || type != TT_EXTINT) { env->exception_index = env->interrupt_index; do_interrupt(env); next_tb = 0; } } } #elif defined(TARGET_ARM) if (interrupt_request & CPU_INTERRUPT_FIQ && !(env->uncached_cpsr & CPSR_F)) { env->exception_index = EXCP_FIQ; do_interrupt(env); next_tb = 0; } /* ARMv7-M interrupt return works by loading a magic value into the PC. On real hardware the load causes the return to occur. The qemu implementation performs the jump normally, then does the exception return when the CPU tries to execute code at the magic address. This will cause the magic PC value to be pushed to the stack if an interrupt occurred at the wrong time. We avoid this by disabling interrupts when pc contains a magic address. */ if (interrupt_request & CPU_INTERRUPT_HARD && ((IS_M(env) && env->regs[15] < 0xfffffff0) || !(env->uncached_cpsr & CPSR_I))) { env->exception_index = EXCP_IRQ; do_interrupt(env); next_tb = 0; } #elif defined(TARGET_UNICORE32) if (interrupt_request & CPU_INTERRUPT_HARD && !(env->uncached_asr & ASR_I)) { do_interrupt(env); next_tb = 0; } #elif defined(TARGET_SH4) if (interrupt_request & CPU_INTERRUPT_HARD) { do_interrupt(env); next_tb = 0; } #elif defined(TARGET_ALPHA) { int idx = -1; /* ??? This hard-codes the OSF/1 interrupt levels. */ switch (env->pal_mode ? 7 : env->ps & PS_INT_MASK) { case 0 ... 3: if (interrupt_request & CPU_INTERRUPT_HARD) { idx = EXCP_DEV_INTERRUPT; } /* FALLTHRU */ case 4: if (interrupt_request & CPU_INTERRUPT_TIMER) { idx = EXCP_CLK_INTERRUPT; } /* FALLTHRU */ case 5: if (interrupt_request & CPU_INTERRUPT_SMP) { idx = EXCP_SMP_INTERRUPT; } /* FALLTHRU */ case 6: if (interrupt_request & CPU_INTERRUPT_MCHK) { idx = EXCP_MCHK; } } if (idx >= 0) { env->exception_index = idx; env->error_code = 0; do_interrupt(env); next_tb = 0; } } #elif defined(TARGET_CRIS) if (interrupt_request & CPU_INTERRUPT_HARD && (env->pregs[PR_CCS] & I_FLAG) && !env->locked_irq) { env->exception_index = EXCP_IRQ; do_interrupt(env); next_tb = 0; } if (interrupt_request & CPU_INTERRUPT_NMI && (env->pregs[PR_CCS] & M_FLAG)) { env->exception_index = EXCP_NMI; do_interrupt(env); next_tb = 0; } #elif defined(TARGET_M68K) if (interrupt_request & CPU_INTERRUPT_HARD && ((env->sr & SR_I) >> SR_I_SHIFT) < env->pending_level) { /* Real hardware gets the interrupt vector via an IACK cycle at this point. Current emulated hardware doesn't rely on this, so we provide/save the vector when the interrupt is first signalled. */ env->exception_index = env->pending_vector; do_interrupt_m68k_hardirq(env); next_tb = 0; } #elif defined(TARGET_S390X) && !defined(CONFIG_USER_ONLY) if ((interrupt_request & CPU_INTERRUPT_HARD) && (env->psw.mask & PSW_MASK_EXT)) { do_interrupt(env); next_tb = 0; } #endif /* Don't use the cached interrupt_request value, do_interrupt may have updated the EXITTB flag. */ if (env->interrupt_request & CPU_INTERRUPT_EXITTB) { env->interrupt_request &= ~CPU_INTERRUPT_EXITTB; /* ensure that no TB jump will be modified as the program flow was changed */ next_tb = 0; } } if (unlikely(env->exit_request)) { env->exit_request = 0; env->exception_index = EXCP_INTERRUPT; cpu_loop_exit(env); } #if defined(DEBUG_DISAS) || defined(CONFIG_DEBUG_EXEC) if (qemu_loglevel_mask(CPU_LOG_TB_CPU)) { /* restore flags in standard format */ #if defined(TARGET_I386) env->eflags = env->eflags | cpu_cc_compute_all(env, CC_OP) | (DF & DF_MASK); log_cpu_state(env, X86_DUMP_CCOP); env->eflags &= ~(DF_MASK | CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C); #elif defined(TARGET_M68K) cpu_m68k_flush_flags(env, env->cc_op); env->cc_op = CC_OP_FLAGS; env->sr = (env->sr & 0xffe0) | env->cc_dest | (env->cc_x << 4); log_cpu_state(env, 0); #else log_cpu_state(env, 0); #endif } #endif /* DEBUG_DISAS || CONFIG_DEBUG_EXEC */ spin_lock(&tb_lock); tb = tb_find_fast(env); /* Note: we do it here to avoid a gcc bug on Mac OS X when doing it in tb_find_slow */ if (tb_invalidated_flag) { /* as some TB could have been invalidated because of memory exceptions while generating the code, we must recompute the hash index here */ next_tb = 0; tb_invalidated_flag = 0; } #ifdef CONFIG_DEBUG_EXEC qemu_log_mask(CPU_LOG_EXEC, "Trace 0x%08lx [" TARGET_FMT_lx "] %s\n", (long)tb->tc_ptr, tb->pc, lookup_symbol(tb->pc)); #endif /* see if we can patch the calling TB. When the TB spans two pages, we cannot safely do a direct jump. */ if (next_tb != 0 && tb->page_addr[1] == -1) { tb_add_jump((TranslationBlock *)(next_tb & ~3), next_tb & 3, tb); } spin_unlock(&tb_lock); /* cpu_interrupt might be called while translating the TB, but before it is linked into a potentially infinite loop and becomes env->current_tb. Avoid starting execution if there is a pending interrupt. */ env->current_tb = tb; barrier(); if (likely(!env->exit_request)) { tc_ptr = tb->tc_ptr; /* execute the generated code */ next_tb = tcg_qemu_tb_exec(env, tc_ptr); if ((next_tb & 3) == 2) { /* Instruction counter expired. */ int insns_left; tb = (TranslationBlock *)(long)(next_tb & ~3); /* Restore PC. */ cpu_pc_from_tb(env, tb); insns_left = env->icount_decr.u32; if (env->icount_extra && insns_left >= 0) { /* Refill decrementer and continue execution. */ env->icount_extra += insns_left; if (env->icount_extra > 0xffff) { insns_left = 0xffff; insns_left = env->icount_extra; } env->icount_extra -= insns_left; env->icount_decr.u16.low = insns_left; if (insns_left > 0) { /* Execute remaining instructions. */ cpu_exec_nocache(env, insns_left, tb); } env->exception_index = EXCP_INTERRUPT; next_tb = 0; cpu_loop_exit(env); } } } env->current_tb = NULL; /* reset soft MMU for next block (it can currently only be set by a memory fault) */ } /* for(;;) */ } } /* for(;;) */ #if defined(TARGET_I386) /* restore flags in standard format */ env->eflags = env->eflags | cpu_cc_compute_all(env, CC_OP) | (DF & DF_MASK); #elif defined(TARGET_ARM) /* XXX: Save/restore host fpu exception state?. */ #elif defined(TARGET_UNICORE32) #elif defined(TARGET_SPARC) #elif defined(TARGET_PPC) #elif defined(TARGET_LM32) #elif defined(TARGET_M68K) cpu_m68k_flush_flags(env, env->cc_op); env->cc_op = CC_OP_FLAGS; env->sr = (env->sr & 0xffe0) | env->cc_dest | (env->cc_x << 4); #elif defined(TARGET_MICROBLAZE) #elif defined(TARGET_MIPS) #elif defined(TARGET_SH4) #elif defined(TARGET_ALPHA) #elif defined(TARGET_CRIS) #elif defined(TARGET_S390X) /* XXXXX */ #else #error unsupported target CPU #endif /* fail safe : never use cpu_single_env outside cpu_exec() */ cpu_single_env = NULL; return ret; }
true
qemu
0d10193870b5a81c3bce13a602a5403c3a55cf6c
int cpu_exec(CPUState *env) { int ret, interrupt_request; TranslationBlock *tb; uint8_t *tc_ptr; unsigned long next_tb; if (env->halted) { if (!cpu_has_work(env)) { return EXCP_HALTED; } env->halted = 0; } cpu_single_env = env; if (unlikely(exit_request)) { env->exit_request = 1; } #if defined(TARGET_I386) CC_SRC = env->eflags & (CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C); DF = 1 - (2 * ((env->eflags >> 10) & 1)); CC_OP = CC_OP_EFLAGS; env->eflags &= ~(DF_MASK | CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C); #elif defined(TARGET_SPARC) #elif defined(TARGET_M68K) env->cc_op = CC_OP_FLAGS; env->cc_dest = env->sr & 0xf; env->cc_x = (env->sr >> 4) & 1; #elif defined(TARGET_ALPHA) #elif defined(TARGET_ARM) #elif defined(TARGET_UNICORE32) #elif defined(TARGET_PPC) #elif defined(TARGET_LM32) #elif defined(TARGET_MICROBLAZE) #elif defined(TARGET_MIPS) #elif defined(TARGET_SH4) #elif defined(TARGET_CRIS) #elif defined(TARGET_S390X) #else #error unsupported target CPU #endif env->exception_index = -1; for(;;) { if (setjmp(env->jmp_env) == 0) { if (env->exception_index >= 0) { if (env->exception_index >= EXCP_INTERRUPT) { ret = env->exception_index; if (ret == EXCP_DEBUG) { cpu_handle_debug_exception(env); } break; #if defined(CONFIG_USER_ONLY) #if defined(TARGET_I386) do_interrupt(env); #endif ret = env->exception_index; break; #else do_interrupt(env); env->exception_index = -1; #endif } } next_tb = 0; for(;;) { interrupt_request = env->interrupt_request; if (unlikely(interrupt_request)) { if (unlikely(env->singlestep_enabled & SSTEP_NOIRQ)) { interrupt_request &= ~CPU_INTERRUPT_SSTEP_MASK; } if (interrupt_request & CPU_INTERRUPT_DEBUG) { env->interrupt_request &= ~CPU_INTERRUPT_DEBUG; env->exception_index = EXCP_DEBUG; cpu_loop_exit(env); } #if defined(TARGET_ARM) || defined(TARGET_SPARC) || defined(TARGET_MIPS) || \ defined(TARGET_PPC) || defined(TARGET_ALPHA) || defined(TARGET_CRIS) || \ defined(TARGET_MICROBLAZE) || defined(TARGET_LM32) || defined(TARGET_UNICORE32) if (interrupt_request & CPU_INTERRUPT_HALT) { env->interrupt_request &= ~CPU_INTERRUPT_HALT; env->halted = 1; env->exception_index = EXCP_HLT; cpu_loop_exit(env); } #endif #if defined(TARGET_I386) if (interrupt_request & CPU_INTERRUPT_INIT) { svm_check_intercept(env, SVM_EXIT_INIT); do_cpu_init(env); env->exception_index = EXCP_HALTED; cpu_loop_exit(env); } else if (interrupt_request & CPU_INTERRUPT_SIPI) { do_cpu_sipi(env); } else if (env->hflags2 & HF2_GIF_MASK) { if ((interrupt_request & CPU_INTERRUPT_SMI) && !(env->hflags & HF_SMM_MASK)) { svm_check_intercept(env, SVM_EXIT_SMI); env->interrupt_request &= ~CPU_INTERRUPT_SMI; do_smm_enter(env); next_tb = 0; } else if ((interrupt_request & CPU_INTERRUPT_NMI) && !(env->hflags2 & HF2_NMI_MASK)) { env->interrupt_request &= ~CPU_INTERRUPT_NMI; env->hflags2 |= HF2_NMI_MASK; do_interrupt_x86_hardirq(env, EXCP02_NMI, 1); next_tb = 0; } else if (interrupt_request & CPU_INTERRUPT_MCE) { env->interrupt_request &= ~CPU_INTERRUPT_MCE; do_interrupt_x86_hardirq(env, EXCP12_MCHK, 0); next_tb = 0; } else if ((interrupt_request & CPU_INTERRUPT_HARD) && (((env->hflags2 & HF2_VINTR_MASK) && (env->hflags2 & HF2_HIF_MASK)) || (!(env->hflags2 & HF2_VINTR_MASK) && (env->eflags & IF_MASK && !(env->hflags & HF_INHIBIT_IRQ_MASK))))) { int intno; svm_check_intercept(env, SVM_EXIT_INTR); env->interrupt_request &= ~(CPU_INTERRUPT_HARD | CPU_INTERRUPT_VIRQ); intno = cpu_get_pic_interrupt(env); qemu_log_mask(CPU_LOG_TB_IN_ASM, "Servicing hardware INT=0x%02x\n", intno); do_interrupt_x86_hardirq(env, intno, 1); next_tb = 0; #if !defined(CONFIG_USER_ONLY) } else if ((interrupt_request & CPU_INTERRUPT_VIRQ) && (env->eflags & IF_MASK) && !(env->hflags & HF_INHIBIT_IRQ_MASK)) { int intno; svm_check_intercept(env, SVM_EXIT_VINTR); intno = ldl_phys(env->vm_vmcb + offsetof(struct vmcb, control.int_vector)); qemu_log_mask(CPU_LOG_TB_IN_ASM, "Servicing virtual hardware INT=0x%02x\n", intno); do_interrupt_x86_hardirq(env, intno, 1); env->interrupt_request &= ~CPU_INTERRUPT_VIRQ; next_tb = 0; #endif } } #elif defined(TARGET_PPC) #if 0 if ((interrupt_request & CPU_INTERRUPT_RESET)) { cpu_reset(env); } #endif if (interrupt_request & CPU_INTERRUPT_HARD) { ppc_hw_interrupt(env); if (env->pending_interrupts == 0) env->interrupt_request &= ~CPU_INTERRUPT_HARD; next_tb = 0; } #elif defined(TARGET_LM32) if ((interrupt_request & CPU_INTERRUPT_HARD) && (env->ie & IE_IE)) { env->exception_index = EXCP_IRQ; do_interrupt(env); next_tb = 0; } #elif defined(TARGET_MICROBLAZE) if ((interrupt_request & CPU_INTERRUPT_HARD) && (env->sregs[SR_MSR] & MSR_IE) && !(env->sregs[SR_MSR] & (MSR_EIP | MSR_BIP)) && !(env->iflags & (D_FLAG | IMM_FLAG))) { env->exception_index = EXCP_IRQ; do_interrupt(env); next_tb = 0; } #elif defined(TARGET_MIPS) if ((interrupt_request & CPU_INTERRUPT_HARD) && cpu_mips_hw_interrupts_pending(env)) { env->exception_index = EXCP_EXT_INTERRUPT; env->error_code = 0; do_interrupt(env); next_tb = 0; } #elif defined(TARGET_SPARC) if (interrupt_request & CPU_INTERRUPT_HARD) { if (cpu_interrupts_enabled(env) && env->interrupt_index > 0) { int pil = env->interrupt_index & 0xf; int type = env->interrupt_index & 0xf0; if (((type == TT_EXTINT) && cpu_pil_allowed(env, pil)) || type != TT_EXTINT) { env->exception_index = env->interrupt_index; do_interrupt(env); next_tb = 0; } } } #elif defined(TARGET_ARM) if (interrupt_request & CPU_INTERRUPT_FIQ && !(env->uncached_cpsr & CPSR_F)) { env->exception_index = EXCP_FIQ; do_interrupt(env); next_tb = 0; } if (interrupt_request & CPU_INTERRUPT_HARD && ((IS_M(env) && env->regs[15] < 0xfffffff0) || !(env->uncached_cpsr & CPSR_I))) { env->exception_index = EXCP_IRQ; do_interrupt(env); next_tb = 0; } #elif defined(TARGET_UNICORE32) if (interrupt_request & CPU_INTERRUPT_HARD && !(env->uncached_asr & ASR_I)) { do_interrupt(env); next_tb = 0; } #elif defined(TARGET_SH4) if (interrupt_request & CPU_INTERRUPT_HARD) { do_interrupt(env); next_tb = 0; } #elif defined(TARGET_ALPHA) { int idx = -1; switch (env->pal_mode ? 7 : env->ps & PS_INT_MASK) { case 0 ... 3: if (interrupt_request & CPU_INTERRUPT_HARD) { idx = EXCP_DEV_INTERRUPT; } case 4: if (interrupt_request & CPU_INTERRUPT_TIMER) { idx = EXCP_CLK_INTERRUPT; } case 5: if (interrupt_request & CPU_INTERRUPT_SMP) { idx = EXCP_SMP_INTERRUPT; } case 6: if (interrupt_request & CPU_INTERRUPT_MCHK) { idx = EXCP_MCHK; } } if (idx >= 0) { env->exception_index = idx; env->error_code = 0; do_interrupt(env); next_tb = 0; } } #elif defined(TARGET_CRIS) if (interrupt_request & CPU_INTERRUPT_HARD && (env->pregs[PR_CCS] & I_FLAG) && !env->locked_irq) { env->exception_index = EXCP_IRQ; do_interrupt(env); next_tb = 0; } if (interrupt_request & CPU_INTERRUPT_NMI && (env->pregs[PR_CCS] & M_FLAG)) { env->exception_index = EXCP_NMI; do_interrupt(env); next_tb = 0; } #elif defined(TARGET_M68K) if (interrupt_request & CPU_INTERRUPT_HARD && ((env->sr & SR_I) >> SR_I_SHIFT) < env->pending_level) { env->exception_index = env->pending_vector; do_interrupt_m68k_hardirq(env); next_tb = 0; } #elif defined(TARGET_S390X) && !defined(CONFIG_USER_ONLY) if ((interrupt_request & CPU_INTERRUPT_HARD) && (env->psw.mask & PSW_MASK_EXT)) { do_interrupt(env); next_tb = 0; } #endif if (env->interrupt_request & CPU_INTERRUPT_EXITTB) { env->interrupt_request &= ~CPU_INTERRUPT_EXITTB; next_tb = 0; } } if (unlikely(env->exit_request)) { env->exit_request = 0; env->exception_index = EXCP_INTERRUPT; cpu_loop_exit(env); } #if defined(DEBUG_DISAS) || defined(CONFIG_DEBUG_EXEC) if (qemu_loglevel_mask(CPU_LOG_TB_CPU)) { #if defined(TARGET_I386) env->eflags = env->eflags | cpu_cc_compute_all(env, CC_OP) | (DF & DF_MASK); log_cpu_state(env, X86_DUMP_CCOP); env->eflags &= ~(DF_MASK | CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C); #elif defined(TARGET_M68K) cpu_m68k_flush_flags(env, env->cc_op); env->cc_op = CC_OP_FLAGS; env->sr = (env->sr & 0xffe0) | env->cc_dest | (env->cc_x << 4); log_cpu_state(env, 0); #else log_cpu_state(env, 0); #endif } #endif spin_lock(&tb_lock); tb = tb_find_fast(env); if (tb_invalidated_flag) { next_tb = 0; tb_invalidated_flag = 0; } #ifdef CONFIG_DEBUG_EXEC qemu_log_mask(CPU_LOG_EXEC, "Trace 0x%08lx [" TARGET_FMT_lx "] %s\n", (long)tb->tc_ptr, tb->pc, lookup_symbol(tb->pc)); #endif if (next_tb != 0 && tb->page_addr[1] == -1) { tb_add_jump((TranslationBlock *)(next_tb & ~3), next_tb & 3, tb); } spin_unlock(&tb_lock); env->current_tb = tb; barrier(); if (likely(!env->exit_request)) { tc_ptr = tb->tc_ptr; next_tb = tcg_qemu_tb_exec(env, tc_ptr); if ((next_tb & 3) == 2) { int insns_left; tb = (TranslationBlock *)(long)(next_tb & ~3); cpu_pc_from_tb(env, tb); insns_left = env->icount_decr.u32; if (env->icount_extra && insns_left >= 0) { env->icount_extra += insns_left; if (env->icount_extra > 0xffff) { insns_left = 0xffff; insns_left = env->icount_extra; } env->icount_extra -= insns_left; env->icount_decr.u16.low = insns_left; if (insns_left > 0) { cpu_exec_nocache(env, insns_left, tb); } env->exception_index = EXCP_INTERRUPT; next_tb = 0; cpu_loop_exit(env); } } } env->current_tb = NULL; } } } #if defined(TARGET_I386) env->eflags = env->eflags | cpu_cc_compute_all(env, CC_OP) | (DF & DF_MASK); #elif defined(TARGET_ARM) #elif defined(TARGET_UNICORE32) #elif defined(TARGET_SPARC) #elif defined(TARGET_PPC) #elif defined(TARGET_LM32) #elif defined(TARGET_M68K) cpu_m68k_flush_flags(env, env->cc_op); env->cc_op = CC_OP_FLAGS; env->sr = (env->sr & 0xffe0) | env->cc_dest | (env->cc_x << 4); #elif defined(TARGET_MICROBLAZE) #elif defined(TARGET_MIPS) #elif defined(TARGET_SH4) #elif defined(TARGET_ALPHA) #elif defined(TARGET_CRIS) #elif defined(TARGET_S390X) #else #error unsupported target CPU #endif cpu_single_env = NULL; return ret; }
{ "code": [], "line_no": [] }
int FUNC_0(CPUState *VAR_0) { int VAR_1, VAR_2; TranslationBlock *tb; uint8_t *tc_ptr; unsigned long VAR_3; if (VAR_0->halted) { if (!cpu_has_work(VAR_0)) { return EXCP_HALTED; } VAR_0->halted = 0; } cpu_single_env = VAR_0; if (unlikely(exit_request)) { VAR_0->exit_request = 1; } #if defined(TARGET_I386) CC_SRC = VAR_0->eflags & (CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C); DF = 1 - (2 * ((VAR_0->eflags >> 10) & 1)); CC_OP = CC_OP_EFLAGS; VAR_0->eflags &= ~(DF_MASK | CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C); #elif defined(TARGET_SPARC) #elif defined(TARGET_M68K) VAR_0->cc_op = CC_OP_FLAGS; VAR_0->cc_dest = VAR_0->sr & 0xf; VAR_0->cc_x = (VAR_0->sr >> 4) & 1; #elif defined(TARGET_ALPHA) #elif defined(TARGET_ARM) #elif defined(TARGET_UNICORE32) #elif defined(TARGET_PPC) #elif defined(TARGET_LM32) #elif defined(TARGET_MICROBLAZE) #elif defined(TARGET_MIPS) #elif defined(TARGET_SH4) #elif defined(TARGET_CRIS) #elif defined(TARGET_S390X) #else #error unsupported target CPU #endif VAR_0->exception_index = -1; for(;;) { if (setjmp(VAR_0->jmp_env) == 0) { if (VAR_0->exception_index >= 0) { if (VAR_0->exception_index >= EXCP_INTERRUPT) { VAR_1 = VAR_0->exception_index; if (VAR_1 == EXCP_DEBUG) { cpu_handle_debug_exception(VAR_0); } break; #if defined(CONFIG_USER_ONLY) #if defined(TARGET_I386) do_interrupt(VAR_0); #endif VAR_1 = VAR_0->exception_index; break; #else do_interrupt(VAR_0); VAR_0->exception_index = -1; #endif } } VAR_3 = 0; for(;;) { VAR_2 = VAR_0->VAR_2; if (unlikely(VAR_2)) { if (unlikely(VAR_0->singlestep_enabled & SSTEP_NOIRQ)) { VAR_2 &= ~CPU_INTERRUPT_SSTEP_MASK; } if (VAR_2 & CPU_INTERRUPT_DEBUG) { VAR_0->VAR_2 &= ~CPU_INTERRUPT_DEBUG; VAR_0->exception_index = EXCP_DEBUG; cpu_loop_exit(VAR_0); } #if defined(TARGET_ARM) || defined(TARGET_SPARC) || defined(TARGET_MIPS) || \ defined(TARGET_PPC) || defined(TARGET_ALPHA) || defined(TARGET_CRIS) || \ defined(TARGET_MICROBLAZE) || defined(TARGET_LM32) || defined(TARGET_UNICORE32) if (VAR_2 & CPU_INTERRUPT_HALT) { VAR_0->VAR_2 &= ~CPU_INTERRUPT_HALT; VAR_0->halted = 1; VAR_0->exception_index = EXCP_HLT; cpu_loop_exit(VAR_0); } #endif #if defined(TARGET_I386) if (VAR_2 & CPU_INTERRUPT_INIT) { svm_check_intercept(VAR_0, SVM_EXIT_INIT); do_cpu_init(VAR_0); VAR_0->exception_index = EXCP_HALTED; cpu_loop_exit(VAR_0); } else if (VAR_2 & CPU_INTERRUPT_SIPI) { do_cpu_sipi(VAR_0); } else if (VAR_0->hflags2 & HF2_GIF_MASK) { if ((VAR_2 & CPU_INTERRUPT_SMI) && !(VAR_0->hflags & HF_SMM_MASK)) { svm_check_intercept(VAR_0, SVM_EXIT_SMI); VAR_0->VAR_2 &= ~CPU_INTERRUPT_SMI; do_smm_enter(VAR_0); VAR_3 = 0; } else if ((VAR_2 & CPU_INTERRUPT_NMI) && !(VAR_0->hflags2 & HF2_NMI_MASK)) { VAR_0->VAR_2 &= ~CPU_INTERRUPT_NMI; VAR_0->hflags2 |= HF2_NMI_MASK; do_interrupt_x86_hardirq(VAR_0, EXCP02_NMI, 1); VAR_3 = 0; } else if (VAR_2 & CPU_INTERRUPT_MCE) { VAR_0->VAR_2 &= ~CPU_INTERRUPT_MCE; do_interrupt_x86_hardirq(VAR_0, EXCP12_MCHK, 0); VAR_3 = 0; } else if ((VAR_2 & CPU_INTERRUPT_HARD) && (((VAR_0->hflags2 & HF2_VINTR_MASK) && (VAR_0->hflags2 & HF2_HIF_MASK)) || (!(VAR_0->hflags2 & HF2_VINTR_MASK) && (VAR_0->eflags & IF_MASK && !(VAR_0->hflags & HF_INHIBIT_IRQ_MASK))))) { int intno; svm_check_intercept(VAR_0, SVM_EXIT_INTR); VAR_0->VAR_2 &= ~(CPU_INTERRUPT_HARD | CPU_INTERRUPT_VIRQ); intno = cpu_get_pic_interrupt(VAR_0); qemu_log_mask(CPU_LOG_TB_IN_ASM, "Servicing hardware INT=0x%02x\n", intno); do_interrupt_x86_hardirq(VAR_0, intno, 1); VAR_3 = 0; #if !defined(CONFIG_USER_ONLY) } else if ((VAR_2 & CPU_INTERRUPT_VIRQ) && (VAR_0->eflags & IF_MASK) && !(VAR_0->hflags & HF_INHIBIT_IRQ_MASK)) { int intno; svm_check_intercept(VAR_0, SVM_EXIT_VINTR); intno = ldl_phys(VAR_0->vm_vmcb + offsetof(struct vmcb, control.int_vector)); qemu_log_mask(CPU_LOG_TB_IN_ASM, "Servicing virtual hardware INT=0x%02x\n", intno); do_interrupt_x86_hardirq(VAR_0, intno, 1); VAR_0->VAR_2 &= ~CPU_INTERRUPT_VIRQ; VAR_3 = 0; #endif } } #elif defined(TARGET_PPC) #if 0 if ((VAR_2 & CPU_INTERRUPT_RESET)) { cpu_reset(VAR_0); } #endif if (VAR_2 & CPU_INTERRUPT_HARD) { ppc_hw_interrupt(VAR_0); if (VAR_0->pending_interrupts == 0) VAR_0->VAR_2 &= ~CPU_INTERRUPT_HARD; VAR_3 = 0; } #elif defined(TARGET_LM32) if ((VAR_2 & CPU_INTERRUPT_HARD) && (VAR_0->ie & IE_IE)) { VAR_0->exception_index = EXCP_IRQ; do_interrupt(VAR_0); VAR_3 = 0; } #elif defined(TARGET_MICROBLAZE) if ((VAR_2 & CPU_INTERRUPT_HARD) && (VAR_0->sregs[SR_MSR] & MSR_IE) && !(VAR_0->sregs[SR_MSR] & (MSR_EIP | MSR_BIP)) && !(VAR_0->iflags & (D_FLAG | IMM_FLAG))) { VAR_0->exception_index = EXCP_IRQ; do_interrupt(VAR_0); VAR_3 = 0; } #elif defined(TARGET_MIPS) if ((VAR_2 & CPU_INTERRUPT_HARD) && cpu_mips_hw_interrupts_pending(VAR_0)) { VAR_0->exception_index = EXCP_EXT_INTERRUPT; VAR_0->error_code = 0; do_interrupt(VAR_0); VAR_3 = 0; } #elif defined(TARGET_SPARC) if (VAR_2 & CPU_INTERRUPT_HARD) { if (cpu_interrupts_enabled(VAR_0) && VAR_0->interrupt_index > 0) { int pil = VAR_0->interrupt_index & 0xf; int type = VAR_0->interrupt_index & 0xf0; if (((type == TT_EXTINT) && cpu_pil_allowed(VAR_0, pil)) || type != TT_EXTINT) { VAR_0->exception_index = VAR_0->interrupt_index; do_interrupt(VAR_0); VAR_3 = 0; } } } #elif defined(TARGET_ARM) if (VAR_2 & CPU_INTERRUPT_FIQ && !(VAR_0->uncached_cpsr & CPSR_F)) { VAR_0->exception_index = EXCP_FIQ; do_interrupt(VAR_0); VAR_3 = 0; } if (VAR_2 & CPU_INTERRUPT_HARD && ((IS_M(VAR_0) && VAR_0->regs[15] < 0xfffffff0) || !(VAR_0->uncached_cpsr & CPSR_I))) { VAR_0->exception_index = EXCP_IRQ; do_interrupt(VAR_0); VAR_3 = 0; } #elif defined(TARGET_UNICORE32) if (VAR_2 & CPU_INTERRUPT_HARD && !(VAR_0->uncached_asr & ASR_I)) { do_interrupt(VAR_0); VAR_3 = 0; } #elif defined(TARGET_SH4) if (VAR_2 & CPU_INTERRUPT_HARD) { do_interrupt(VAR_0); VAR_3 = 0; } #elif defined(TARGET_ALPHA) { int idx = -1; switch (VAR_0->pal_mode ? 7 : VAR_0->ps & PS_INT_MASK) { case 0 ... 3: if (VAR_2 & CPU_INTERRUPT_HARD) { idx = EXCP_DEV_INTERRUPT; } case 4: if (VAR_2 & CPU_INTERRUPT_TIMER) { idx = EXCP_CLK_INTERRUPT; } case 5: if (VAR_2 & CPU_INTERRUPT_SMP) { idx = EXCP_SMP_INTERRUPT; } case 6: if (VAR_2 & CPU_INTERRUPT_MCHK) { idx = EXCP_MCHK; } } if (idx >= 0) { VAR_0->exception_index = idx; VAR_0->error_code = 0; do_interrupt(VAR_0); VAR_3 = 0; } } #elif defined(TARGET_CRIS) if (VAR_2 & CPU_INTERRUPT_HARD && (VAR_0->pregs[PR_CCS] & I_FLAG) && !VAR_0->locked_irq) { VAR_0->exception_index = EXCP_IRQ; do_interrupt(VAR_0); VAR_3 = 0; } if (VAR_2 & CPU_INTERRUPT_NMI && (VAR_0->pregs[PR_CCS] & M_FLAG)) { VAR_0->exception_index = EXCP_NMI; do_interrupt(VAR_0); VAR_3 = 0; } #elif defined(TARGET_M68K) if (VAR_2 & CPU_INTERRUPT_HARD && ((VAR_0->sr & SR_I) >> SR_I_SHIFT) < VAR_0->pending_level) { VAR_0->exception_index = VAR_0->pending_vector; do_interrupt_m68k_hardirq(VAR_0); VAR_3 = 0; } #elif defined(TARGET_S390X) && !defined(CONFIG_USER_ONLY) if ((VAR_2 & CPU_INTERRUPT_HARD) && (VAR_0->psw.mask & PSW_MASK_EXT)) { do_interrupt(VAR_0); VAR_3 = 0; } #endif if (VAR_0->VAR_2 & CPU_INTERRUPT_EXITTB) { VAR_0->VAR_2 &= ~CPU_INTERRUPT_EXITTB; VAR_3 = 0; } } if (unlikely(VAR_0->exit_request)) { VAR_0->exit_request = 0; VAR_0->exception_index = EXCP_INTERRUPT; cpu_loop_exit(VAR_0); } #if defined(DEBUG_DISAS) || defined(CONFIG_DEBUG_EXEC) if (qemu_loglevel_mask(CPU_LOG_TB_CPU)) { #if defined(TARGET_I386) VAR_0->eflags = VAR_0->eflags | cpu_cc_compute_all(VAR_0, CC_OP) | (DF & DF_MASK); log_cpu_state(VAR_0, X86_DUMP_CCOP); VAR_0->eflags &= ~(DF_MASK | CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C); #elif defined(TARGET_M68K) cpu_m68k_flush_flags(VAR_0, VAR_0->cc_op); VAR_0->cc_op = CC_OP_FLAGS; VAR_0->sr = (VAR_0->sr & 0xffe0) | VAR_0->cc_dest | (VAR_0->cc_x << 4); log_cpu_state(VAR_0, 0); #else log_cpu_state(VAR_0, 0); #endif } #endif spin_lock(&tb_lock); tb = tb_find_fast(VAR_0); if (tb_invalidated_flag) { VAR_3 = 0; tb_invalidated_flag = 0; } #ifdef CONFIG_DEBUG_EXEC qemu_log_mask(CPU_LOG_EXEC, "Trace 0x%08lx [" TARGET_FMT_lx "] %s\n", (long)tb->tc_ptr, tb->pc, lookup_symbol(tb->pc)); #endif if (VAR_3 != 0 && tb->page_addr[1] == -1) { tb_add_jump((TranslationBlock *)(VAR_3 & ~3), VAR_3 & 3, tb); } spin_unlock(&tb_lock); VAR_0->current_tb = tb; barrier(); if (likely(!VAR_0->exit_request)) { tc_ptr = tb->tc_ptr; VAR_3 = tcg_qemu_tb_exec(VAR_0, tc_ptr); if ((VAR_3 & 3) == 2) { int VAR_4; tb = (TranslationBlock *)(long)(VAR_3 & ~3); cpu_pc_from_tb(VAR_0, tb); VAR_4 = VAR_0->icount_decr.u32; if (VAR_0->icount_extra && VAR_4 >= 0) { VAR_0->icount_extra += VAR_4; if (VAR_0->icount_extra > 0xffff) { VAR_4 = 0xffff; VAR_4 = VAR_0->icount_extra; } VAR_0->icount_extra -= VAR_4; VAR_0->icount_decr.u16.low = VAR_4; if (VAR_4 > 0) { cpu_exec_nocache(VAR_0, VAR_4, tb); } VAR_0->exception_index = EXCP_INTERRUPT; VAR_3 = 0; cpu_loop_exit(VAR_0); } } } VAR_0->current_tb = NULL; } } } #if defined(TARGET_I386) VAR_0->eflags = VAR_0->eflags | cpu_cc_compute_all(VAR_0, CC_OP) | (DF & DF_MASK); #elif defined(TARGET_ARM) #elif defined(TARGET_UNICORE32) #elif defined(TARGET_SPARC) #elif defined(TARGET_PPC) #elif defined(TARGET_LM32) #elif defined(TARGET_M68K) cpu_m68k_flush_flags(VAR_0, VAR_0->cc_op); VAR_0->cc_op = CC_OP_FLAGS; VAR_0->sr = (VAR_0->sr & 0xffe0) | VAR_0->cc_dest | (VAR_0->cc_x << 4); #elif defined(TARGET_MICROBLAZE) #elif defined(TARGET_MIPS) #elif defined(TARGET_SH4) #elif defined(TARGET_ALPHA) #elif defined(TARGET_CRIS) #elif defined(TARGET_S390X) #else #error unsupported target CPU #endif cpu_single_env = NULL; return VAR_1; }
[ "int FUNC_0(CPUState *VAR_0)\n{", "int VAR_1, VAR_2;", "TranslationBlock *tb;", "uint8_t *tc_ptr;", "unsigned long VAR_3;", "if (VAR_0->halted) {", "if (!cpu_has_work(VAR_0)) {", "return EXCP_HALTED;", "}", "VAR_0->halted = 0;", "}", "cpu_single_env = VAR_0;", "if (unlikely(exit_request)) {", "VAR_0->exit_request = 1;", "}", "#if defined(TARGET_I386)\nCC_SRC = VAR_0->eflags & (CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C);", "DF = 1 - (2 * ((VAR_0->eflags >> 10) & 1));", "CC_OP = CC_OP_EFLAGS;", "VAR_0->eflags &= ~(DF_MASK | CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C);", "#elif defined(TARGET_SPARC)\n#elif defined(TARGET_M68K)\nVAR_0->cc_op = CC_OP_FLAGS;", "VAR_0->cc_dest = VAR_0->sr & 0xf;", "VAR_0->cc_x = (VAR_0->sr >> 4) & 1;", "#elif defined(TARGET_ALPHA)\n#elif defined(TARGET_ARM)\n#elif defined(TARGET_UNICORE32)\n#elif defined(TARGET_PPC)\n#elif defined(TARGET_LM32)\n#elif defined(TARGET_MICROBLAZE)\n#elif defined(TARGET_MIPS)\n#elif defined(TARGET_SH4)\n#elif defined(TARGET_CRIS)\n#elif defined(TARGET_S390X)\n#else\n#error unsupported target CPU\n#endif\nVAR_0->exception_index = -1;", "for(;;) {", "if (setjmp(VAR_0->jmp_env) == 0) {", "if (VAR_0->exception_index >= 0) {", "if (VAR_0->exception_index >= EXCP_INTERRUPT) {", "VAR_1 = VAR_0->exception_index;", "if (VAR_1 == EXCP_DEBUG) {", "cpu_handle_debug_exception(VAR_0);", "}", "break;", "#if defined(CONFIG_USER_ONLY)\n#if defined(TARGET_I386)\ndo_interrupt(VAR_0);", "#endif\nVAR_1 = VAR_0->exception_index;", "break;", "#else\ndo_interrupt(VAR_0);", "VAR_0->exception_index = -1;", "#endif\n}", "}", "VAR_3 = 0;", "for(;;) {", "VAR_2 = VAR_0->VAR_2;", "if (unlikely(VAR_2)) {", "if (unlikely(VAR_0->singlestep_enabled & SSTEP_NOIRQ)) {", "VAR_2 &= ~CPU_INTERRUPT_SSTEP_MASK;", "}", "if (VAR_2 & CPU_INTERRUPT_DEBUG) {", "VAR_0->VAR_2 &= ~CPU_INTERRUPT_DEBUG;", "VAR_0->exception_index = EXCP_DEBUG;", "cpu_loop_exit(VAR_0);", "}", "#if defined(TARGET_ARM) || defined(TARGET_SPARC) || defined(TARGET_MIPS) || \\\ndefined(TARGET_PPC) || defined(TARGET_ALPHA) || defined(TARGET_CRIS) || \\\ndefined(TARGET_MICROBLAZE) || defined(TARGET_LM32) || defined(TARGET_UNICORE32)\nif (VAR_2 & CPU_INTERRUPT_HALT) {", "VAR_0->VAR_2 &= ~CPU_INTERRUPT_HALT;", "VAR_0->halted = 1;", "VAR_0->exception_index = EXCP_HLT;", "cpu_loop_exit(VAR_0);", "}", "#endif\n#if defined(TARGET_I386)\nif (VAR_2 & CPU_INTERRUPT_INIT) {", "svm_check_intercept(VAR_0, SVM_EXIT_INIT);", "do_cpu_init(VAR_0);", "VAR_0->exception_index = EXCP_HALTED;", "cpu_loop_exit(VAR_0);", "} else if (VAR_2 & CPU_INTERRUPT_SIPI) {", "do_cpu_sipi(VAR_0);", "} else if (VAR_0->hflags2 & HF2_GIF_MASK) {", "if ((VAR_2 & CPU_INTERRUPT_SMI) &&\n!(VAR_0->hflags & HF_SMM_MASK)) {", "svm_check_intercept(VAR_0, SVM_EXIT_SMI);", "VAR_0->VAR_2 &= ~CPU_INTERRUPT_SMI;", "do_smm_enter(VAR_0);", "VAR_3 = 0;", "} else if ((VAR_2 & CPU_INTERRUPT_NMI) &&", "!(VAR_0->hflags2 & HF2_NMI_MASK)) {", "VAR_0->VAR_2 &= ~CPU_INTERRUPT_NMI;", "VAR_0->hflags2 |= HF2_NMI_MASK;", "do_interrupt_x86_hardirq(VAR_0, EXCP02_NMI, 1);", "VAR_3 = 0;", "} else if (VAR_2 & CPU_INTERRUPT_MCE) {", "VAR_0->VAR_2 &= ~CPU_INTERRUPT_MCE;", "do_interrupt_x86_hardirq(VAR_0, EXCP12_MCHK, 0);", "VAR_3 = 0;", "} else if ((VAR_2 & CPU_INTERRUPT_HARD) &&", "(((VAR_0->hflags2 & HF2_VINTR_MASK) &&\n(VAR_0->hflags2 & HF2_HIF_MASK)) ||\n(!(VAR_0->hflags2 & HF2_VINTR_MASK) &&\n(VAR_0->eflags & IF_MASK &&\n!(VAR_0->hflags & HF_INHIBIT_IRQ_MASK))))) {", "int intno;", "svm_check_intercept(VAR_0, SVM_EXIT_INTR);", "VAR_0->VAR_2 &= ~(CPU_INTERRUPT_HARD | CPU_INTERRUPT_VIRQ);", "intno = cpu_get_pic_interrupt(VAR_0);", "qemu_log_mask(CPU_LOG_TB_IN_ASM, \"Servicing hardware INT=0x%02x\\n\", intno);", "do_interrupt_x86_hardirq(VAR_0, intno, 1);", "VAR_3 = 0;", "#if !defined(CONFIG_USER_ONLY)\n} else if ((VAR_2 & CPU_INTERRUPT_VIRQ) &&", "(VAR_0->eflags & IF_MASK) &&\n!(VAR_0->hflags & HF_INHIBIT_IRQ_MASK)) {", "int intno;", "svm_check_intercept(VAR_0, SVM_EXIT_VINTR);", "intno = ldl_phys(VAR_0->vm_vmcb + offsetof(struct vmcb, control.int_vector));", "qemu_log_mask(CPU_LOG_TB_IN_ASM, \"Servicing virtual hardware INT=0x%02x\\n\", intno);", "do_interrupt_x86_hardirq(VAR_0, intno, 1);", "VAR_0->VAR_2 &= ~CPU_INTERRUPT_VIRQ;", "VAR_3 = 0;", "#endif\n}", "}", "#elif defined(TARGET_PPC)\n#if 0\nif ((VAR_2 & CPU_INTERRUPT_RESET)) {", "cpu_reset(VAR_0);", "}", "#endif\nif (VAR_2 & CPU_INTERRUPT_HARD) {", "ppc_hw_interrupt(VAR_0);", "if (VAR_0->pending_interrupts == 0)\nVAR_0->VAR_2 &= ~CPU_INTERRUPT_HARD;", "VAR_3 = 0;", "}", "#elif defined(TARGET_LM32)\nif ((VAR_2 & CPU_INTERRUPT_HARD)\n&& (VAR_0->ie & IE_IE)) {", "VAR_0->exception_index = EXCP_IRQ;", "do_interrupt(VAR_0);", "VAR_3 = 0;", "}", "#elif defined(TARGET_MICROBLAZE)\nif ((VAR_2 & CPU_INTERRUPT_HARD)\n&& (VAR_0->sregs[SR_MSR] & MSR_IE)\n&& !(VAR_0->sregs[SR_MSR] & (MSR_EIP | MSR_BIP))\n&& !(VAR_0->iflags & (D_FLAG | IMM_FLAG))) {", "VAR_0->exception_index = EXCP_IRQ;", "do_interrupt(VAR_0);", "VAR_3 = 0;", "}", "#elif defined(TARGET_MIPS)\nif ((VAR_2 & CPU_INTERRUPT_HARD) &&\ncpu_mips_hw_interrupts_pending(VAR_0)) {", "VAR_0->exception_index = EXCP_EXT_INTERRUPT;", "VAR_0->error_code = 0;", "do_interrupt(VAR_0);", "VAR_3 = 0;", "}", "#elif defined(TARGET_SPARC)\nif (VAR_2 & CPU_INTERRUPT_HARD) {", "if (cpu_interrupts_enabled(VAR_0) &&\nVAR_0->interrupt_index > 0) {", "int pil = VAR_0->interrupt_index & 0xf;", "int type = VAR_0->interrupt_index & 0xf0;", "if (((type == TT_EXTINT) &&\ncpu_pil_allowed(VAR_0, pil)) ||\ntype != TT_EXTINT) {", "VAR_0->exception_index = VAR_0->interrupt_index;", "do_interrupt(VAR_0);", "VAR_3 = 0;", "}", "}", "}", "#elif defined(TARGET_ARM)\nif (VAR_2 & CPU_INTERRUPT_FIQ\n&& !(VAR_0->uncached_cpsr & CPSR_F)) {", "VAR_0->exception_index = EXCP_FIQ;", "do_interrupt(VAR_0);", "VAR_3 = 0;", "}", "if (VAR_2 & CPU_INTERRUPT_HARD\n&& ((IS_M(VAR_0) && VAR_0->regs[15] < 0xfffffff0)\n|| !(VAR_0->uncached_cpsr & CPSR_I))) {", "VAR_0->exception_index = EXCP_IRQ;", "do_interrupt(VAR_0);", "VAR_3 = 0;", "}", "#elif defined(TARGET_UNICORE32)\nif (VAR_2 & CPU_INTERRUPT_HARD\n&& !(VAR_0->uncached_asr & ASR_I)) {", "do_interrupt(VAR_0);", "VAR_3 = 0;", "}", "#elif defined(TARGET_SH4)\nif (VAR_2 & CPU_INTERRUPT_HARD) {", "do_interrupt(VAR_0);", "VAR_3 = 0;", "}", "#elif defined(TARGET_ALPHA)\n{", "int idx = -1;", "switch (VAR_0->pal_mode ? 7 : VAR_0->ps & PS_INT_MASK) {", "case 0 ... 3:\nif (VAR_2 & CPU_INTERRUPT_HARD) {", "idx = EXCP_DEV_INTERRUPT;", "}", "case 4:\nif (VAR_2 & CPU_INTERRUPT_TIMER) {", "idx = EXCP_CLK_INTERRUPT;", "}", "case 5:\nif (VAR_2 & CPU_INTERRUPT_SMP) {", "idx = EXCP_SMP_INTERRUPT;", "}", "case 6:\nif (VAR_2 & CPU_INTERRUPT_MCHK) {", "idx = EXCP_MCHK;", "}", "}", "if (idx >= 0) {", "VAR_0->exception_index = idx;", "VAR_0->error_code = 0;", "do_interrupt(VAR_0);", "VAR_3 = 0;", "}", "}", "#elif defined(TARGET_CRIS)\nif (VAR_2 & CPU_INTERRUPT_HARD\n&& (VAR_0->pregs[PR_CCS] & I_FLAG)\n&& !VAR_0->locked_irq) {", "VAR_0->exception_index = EXCP_IRQ;", "do_interrupt(VAR_0);", "VAR_3 = 0;", "}", "if (VAR_2 & CPU_INTERRUPT_NMI\n&& (VAR_0->pregs[PR_CCS] & M_FLAG)) {", "VAR_0->exception_index = EXCP_NMI;", "do_interrupt(VAR_0);", "VAR_3 = 0;", "}", "#elif defined(TARGET_M68K)\nif (VAR_2 & CPU_INTERRUPT_HARD\n&& ((VAR_0->sr & SR_I) >> SR_I_SHIFT)\n< VAR_0->pending_level) {", "VAR_0->exception_index = VAR_0->pending_vector;", "do_interrupt_m68k_hardirq(VAR_0);", "VAR_3 = 0;", "}", "#elif defined(TARGET_S390X) && !defined(CONFIG_USER_ONLY)\nif ((VAR_2 & CPU_INTERRUPT_HARD) &&\n(VAR_0->psw.mask & PSW_MASK_EXT)) {", "do_interrupt(VAR_0);", "VAR_3 = 0;", "}", "#endif\nif (VAR_0->VAR_2 & CPU_INTERRUPT_EXITTB) {", "VAR_0->VAR_2 &= ~CPU_INTERRUPT_EXITTB;", "VAR_3 = 0;", "}", "}", "if (unlikely(VAR_0->exit_request)) {", "VAR_0->exit_request = 0;", "VAR_0->exception_index = EXCP_INTERRUPT;", "cpu_loop_exit(VAR_0);", "}", "#if defined(DEBUG_DISAS) || defined(CONFIG_DEBUG_EXEC)\nif (qemu_loglevel_mask(CPU_LOG_TB_CPU)) {", "#if defined(TARGET_I386)\nVAR_0->eflags = VAR_0->eflags | cpu_cc_compute_all(VAR_0, CC_OP)\n| (DF & DF_MASK);", "log_cpu_state(VAR_0, X86_DUMP_CCOP);", "VAR_0->eflags &= ~(DF_MASK | CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C);", "#elif defined(TARGET_M68K)\ncpu_m68k_flush_flags(VAR_0, VAR_0->cc_op);", "VAR_0->cc_op = CC_OP_FLAGS;", "VAR_0->sr = (VAR_0->sr & 0xffe0)\n| VAR_0->cc_dest | (VAR_0->cc_x << 4);", "log_cpu_state(VAR_0, 0);", "#else\nlog_cpu_state(VAR_0, 0);", "#endif\n}", "#endif\nspin_lock(&tb_lock);", "tb = tb_find_fast(VAR_0);", "if (tb_invalidated_flag) {", "VAR_3 = 0;", "tb_invalidated_flag = 0;", "}", "#ifdef CONFIG_DEBUG_EXEC\nqemu_log_mask(CPU_LOG_EXEC, \"Trace 0x%08lx [\" TARGET_FMT_lx \"] %s\\n\",\n(long)tb->tc_ptr, tb->pc,\nlookup_symbol(tb->pc));", "#endif\nif (VAR_3 != 0 && tb->page_addr[1] == -1) {", "tb_add_jump((TranslationBlock *)(VAR_3 & ~3), VAR_3 & 3, tb);", "}", "spin_unlock(&tb_lock);", "VAR_0->current_tb = tb;", "barrier();", "if (likely(!VAR_0->exit_request)) {", "tc_ptr = tb->tc_ptr;", "VAR_3 = tcg_qemu_tb_exec(VAR_0, tc_ptr);", "if ((VAR_3 & 3) == 2) {", "int VAR_4;", "tb = (TranslationBlock *)(long)(VAR_3 & ~3);", "cpu_pc_from_tb(VAR_0, tb);", "VAR_4 = VAR_0->icount_decr.u32;", "if (VAR_0->icount_extra && VAR_4 >= 0) {", "VAR_0->icount_extra += VAR_4;", "if (VAR_0->icount_extra > 0xffff) {", "VAR_4 = 0xffff;", "VAR_4 = VAR_0->icount_extra;", "}", "VAR_0->icount_extra -= VAR_4;", "VAR_0->icount_decr.u16.low = VAR_4;", "if (VAR_4 > 0) {", "cpu_exec_nocache(VAR_0, VAR_4, tb);", "}", "VAR_0->exception_index = EXCP_INTERRUPT;", "VAR_3 = 0;", "cpu_loop_exit(VAR_0);", "}", "}", "}", "VAR_0->current_tb = NULL;", "}", "}", "}", "#if defined(TARGET_I386)\nVAR_0->eflags = VAR_0->eflags | cpu_cc_compute_all(VAR_0, CC_OP)\n| (DF & DF_MASK);", "#elif defined(TARGET_ARM)\n#elif defined(TARGET_UNICORE32)\n#elif defined(TARGET_SPARC)\n#elif defined(TARGET_PPC)\n#elif defined(TARGET_LM32)\n#elif defined(TARGET_M68K)\ncpu_m68k_flush_flags(VAR_0, VAR_0->cc_op);", "VAR_0->cc_op = CC_OP_FLAGS;", "VAR_0->sr = (VAR_0->sr & 0xffe0)\n| VAR_0->cc_dest | (VAR_0->cc_x << 4);", "#elif defined(TARGET_MICROBLAZE)\n#elif defined(TARGET_MIPS)\n#elif defined(TARGET_SH4)\n#elif defined(TARGET_ALPHA)\n#elif defined(TARGET_CRIS)\n#elif defined(TARGET_S390X)\n#else\n#error unsupported target CPU\n#endif\ncpu_single_env = NULL;", "return VAR_1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 43, 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55, 57, 59 ], [ 61 ], [ 63 ], [ 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 87, 89, 91, 93 ], [ 99 ], [ 101 ], [ 105 ], [ 107 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 122, 130, 132 ], [ 134, 136 ], [ 138 ], [ 140, 142 ], [ 144 ], [ 146, 148 ], [ 150 ], [ 154 ], [ 156 ], [ 158 ], [ 160 ], [ 162 ], [ 166 ], [ 168 ], [ 170 ], [ 172 ], [ 174 ], [ 176 ], [ 178 ], [ 180, 182, 184, 186 ], [ 188 ], [ 190 ], [ 192 ], [ 194 ], [ 196 ], [ 198, 200, 202 ], [ 204 ], [ 206 ], [ 208 ], [ 210 ], [ 212 ], [ 214 ], [ 216 ], [ 218, 220 ], [ 222 ], [ 224 ], [ 226 ], [ 228 ], [ 230 ], [ 232 ], [ 234 ], [ 236 ], [ 238 ], [ 240 ], [ 242 ], [ 244 ], [ 246 ], [ 248 ], [ 250 ], [ 252, 254, 256, 258, 260 ], [ 262 ], [ 264 ], [ 266 ], [ 268 ], [ 270 ], [ 272 ], [ 278 ], [ 280, 282 ], [ 284, 286 ], [ 288 ], [ 292 ], [ 294 ], [ 296 ], [ 298 ], [ 300 ], [ 302 ], [ 304, 306 ], [ 308 ], [ 310, 312, 314 ], [ 316 ], [ 318 ], [ 320, 322 ], [ 324 ], [ 326, 328 ], [ 330 ], [ 332 ], [ 334, 336, 338 ], [ 340 ], [ 342 ], [ 344 ], [ 346 ], [ 348, 350, 352, 354, 356 ], [ 358 ], [ 360 ], [ 362 ], [ 364 ], [ 366, 368, 370 ], [ 374 ], [ 376 ], [ 378 ], [ 380 ], [ 382 ], [ 384, 386 ], [ 388, 390 ], [ 392 ], [ 394 ], [ 398, 400, 402 ], [ 404 ], [ 406 ], [ 408 ], [ 410 ], [ 412 ], [ 414 ], [ 416, 418, 420 ], [ 422 ], [ 424 ], [ 426 ], [ 428 ], [ 448, 450, 452 ], [ 454 ], [ 456 ], [ 458 ], [ 460 ], [ 462, 464, 466 ], [ 468 ], [ 470 ], [ 472 ], [ 474, 476 ], [ 478 ], [ 480 ], [ 482 ], [ 484, 486 ], [ 488 ], [ 492 ], [ 494, 496 ], [ 498 ], [ 500 ], [ 504, 506 ], [ 508 ], [ 510 ], [ 514, 516 ], [ 518 ], [ 520 ], [ 524, 526 ], [ 528 ], [ 530 ], [ 532 ], [ 534 ], [ 536 ], [ 538 ], [ 540 ], [ 542 ], [ 544 ], [ 546 ], [ 548, 550, 552, 554 ], [ 556 ], [ 558 ], [ 560 ], [ 562 ], [ 564, 566 ], [ 568 ], [ 570 ], [ 572 ], [ 574 ], [ 576, 578, 580, 582 ], [ 594 ], [ 596 ], [ 598 ], [ 600 ], [ 602, 604, 606 ], [ 608 ], [ 610 ], [ 612 ], [ 614, 620 ], [ 622 ], [ 628 ], [ 630 ], [ 632 ], [ 634 ], [ 636 ], [ 638 ], [ 640 ], [ 642 ], [ 644, 646 ], [ 650, 652, 654 ], [ 656 ], [ 658 ], [ 660, 662 ], [ 664 ], [ 666, 668 ], [ 670 ], [ 672, 674 ], [ 676, 678 ], [ 680, 682 ], [ 684 ], [ 690 ], [ 698 ], [ 700 ], [ 702 ], [ 704, 706, 708, 710 ], [ 712, 720 ], [ 722 ], [ 724 ], [ 726 ], [ 738 ], [ 740 ], [ 742 ], [ 744 ], [ 748 ], [ 750 ], [ 754 ], [ 756 ], [ 760 ], [ 762 ], [ 764 ], [ 768 ], [ 770 ], [ 772 ], [ 775 ], [ 777 ], [ 779 ], [ 781 ], [ 784 ], [ 788 ], [ 790 ], [ 792 ], [ 794 ], [ 796 ], [ 798 ], [ 800 ], [ 802 ], [ 804 ], [ 810 ], [ 816 ], [ 818 ], [ 824, 828, 830 ], [ 832, 836, 838, 840, 842, 844, 846 ], [ 848 ], [ 850, 852 ], [ 854, 856, 858, 860, 862, 864, 868, 870, 872, 878 ], [ 880 ], [ 882 ] ]
14,039
callback(void *priv_data, int index, uint8_t *buf, int buf_size, int64_t time) { AVFormatContext *s = priv_data; struct dshow_ctx *ctx = s->priv_data; AVPacketList **ppktl, *pktl_next; // dump_videohdr(s, vdhdr); WaitForSingleObject(ctx->mutex, INFINITE); if(shall_we_drop(s)) goto fail; pktl_next = av_mallocz(sizeof(AVPacketList)); if(!pktl_next) goto fail; if(av_new_packet(&pktl_next->pkt, buf_size) < 0) { av_free(pktl_next); goto fail; } pktl_next->pkt.stream_index = index; pktl_next->pkt.pts = time; memcpy(pktl_next->pkt.data, buf, buf_size); for(ppktl = &ctx->pktl ; *ppktl ; ppktl = &(*ppktl)->next); *ppktl = pktl_next; ctx->curbufsize += buf_size; SetEvent(ctx->event); ReleaseMutex(ctx->mutex); return; fail: ReleaseMutex(ctx->mutex); return; }
false
FFmpeg
190f6135b48a97dadd7586f154640bec6468df1b
callback(void *priv_data, int index, uint8_t *buf, int buf_size, int64_t time) { AVFormatContext *s = priv_data; struct dshow_ctx *ctx = s->priv_data; AVPacketList **ppktl, *pktl_next; WaitForSingleObject(ctx->mutex, INFINITE); if(shall_we_drop(s)) goto fail; pktl_next = av_mallocz(sizeof(AVPacketList)); if(!pktl_next) goto fail; if(av_new_packet(&pktl_next->pkt, buf_size) < 0) { av_free(pktl_next); goto fail; } pktl_next->pkt.stream_index = index; pktl_next->pkt.pts = time; memcpy(pktl_next->pkt.data, buf, buf_size); for(ppktl = &ctx->pktl ; *ppktl ; ppktl = &(*ppktl)->next); *ppktl = pktl_next; ctx->curbufsize += buf_size; SetEvent(ctx->event); ReleaseMutex(ctx->mutex); return; fail: ReleaseMutex(ctx->mutex); return; }
{ "code": [], "line_no": [] }
FUNC_0(void *VAR_0, int VAR_1, uint8_t *VAR_2, int VAR_3, int64_t VAR_4) { AVFormatContext *s = VAR_0; struct dshow_ctx *VAR_5 = s->VAR_0; AVPacketList **ppktl, *pktl_next; WaitForSingleObject(VAR_5->mutex, INFINITE); if(shall_we_drop(s)) goto fail; pktl_next = av_mallocz(sizeof(AVPacketList)); if(!pktl_next) goto fail; if(av_new_packet(&pktl_next->pkt, VAR_3) < 0) { av_free(pktl_next); goto fail; } pktl_next->pkt.stream_index = VAR_1; pktl_next->pkt.pts = VAR_4; memcpy(pktl_next->pkt.data, VAR_2, VAR_3); for(ppktl = &VAR_5->pktl ; *ppktl ; ppktl = &(*ppktl)->next); *ppktl = pktl_next; VAR_5->curbufsize += VAR_3; SetEvent(VAR_5->event); ReleaseMutex(VAR_5->mutex); return; fail: ReleaseMutex(VAR_5->mutex); return; }
[ "FUNC_0(void *VAR_0, int VAR_1, uint8_t *VAR_2, int VAR_3, int64_t VAR_4)\n{", "AVFormatContext *s = VAR_0;", "struct dshow_ctx *VAR_5 = s->VAR_0;", "AVPacketList **ppktl, *pktl_next;", "WaitForSingleObject(VAR_5->mutex, INFINITE);", "if(shall_we_drop(s))\ngoto fail;", "pktl_next = av_mallocz(sizeof(AVPacketList));", "if(!pktl_next)\ngoto fail;", "if(av_new_packet(&pktl_next->pkt, VAR_3) < 0) {", "av_free(pktl_next);", "goto fail;", "}", "pktl_next->pkt.stream_index = VAR_1;", "pktl_next->pkt.pts = VAR_4;", "memcpy(pktl_next->pkt.data, VAR_2, VAR_3);", "for(ppktl = &VAR_5->pktl ; *ppktl ; ppktl = &(*ppktl)->next);", "*ppktl = pktl_next;", "VAR_5->curbufsize += VAR_3;", "SetEvent(VAR_5->event);", "ReleaseMutex(VAR_5->mutex);", "return;", "fail:\nReleaseMutex(VAR_5->mutex);", "return;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 17 ], [ 21, 23 ], [ 27 ], [ 29, 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 59 ], [ 63 ], [ 65 ], [ 69 ], [ 71, 73 ], [ 75 ], [ 77 ] ]
14,040
static inline void RENAME(yvu9_to_yuy2)(const uint8_t *src1, const uint8_t *src2, const uint8_t *src3, uint8_t *dst, unsigned width, unsigned height, int srcStride1, int srcStride2, int srcStride3, int dstStride) { unsigned long y,x,w,h; w=width/2; h=height; for(y=0;y<h;y++){ const uint8_t* yp=src1+srcStride1*y; const uint8_t* up=src2+srcStride2*(y>>2); const uint8_t* vp=src3+srcStride3*(y>>2); uint8_t* d=dst+dstStride*y; x=0; #ifdef HAVE_MMX for(;x<w-7;x+=8) { asm volatile( PREFETCH" 32(%1, %0)\n\t" PREFETCH" 32(%2, %0)\n\t" PREFETCH" 32(%3, %0)\n\t" "movq (%1, %0, 4), %%mm0\n\t" /* Y0Y1Y2Y3Y4Y5Y6Y7 */ "movq (%2, %0), %%mm1\n\t" /* U0U1U2U3U4U5U6U7 */ "movq (%3, %0), %%mm2\n\t" /* V0V1V2V3V4V5V6V7 */ "movq %%mm0, %%mm3\n\t" /* Y0Y1Y2Y3Y4Y5Y6Y7 */ "movq %%mm1, %%mm4\n\t" /* U0U1U2U3U4U5U6U7 */ "movq %%mm2, %%mm5\n\t" /* V0V1V2V3V4V5V6V7 */ "punpcklbw %%mm1, %%mm1\n\t" /* U0U0 U1U1 U2U2 U3U3 */ "punpcklbw %%mm2, %%mm2\n\t" /* V0V0 V1V1 V2V2 V3V3 */ "punpckhbw %%mm4, %%mm4\n\t" /* U4U4 U5U5 U6U6 U7U7 */ "punpckhbw %%mm5, %%mm5\n\t" /* V4V4 V5V5 V6V6 V7V7 */ "movq %%mm1, %%mm6\n\t" "punpcklbw %%mm2, %%mm1\n\t" /* U0V0 U0V0 U1V1 U1V1*/ "punpcklbw %%mm1, %%mm0\n\t" /* Y0U0 Y1V0 Y2U0 Y3V0*/ "punpckhbw %%mm1, %%mm3\n\t" /* Y4U1 Y5V1 Y6U1 Y7V1*/ MOVNTQ" %%mm0, (%4, %0, 8)\n\t" MOVNTQ" %%mm3, 8(%4, %0, 8)\n\t" "punpckhbw %%mm2, %%mm6\n\t" /* U2V2 U2V2 U3V3 U3V3*/ "movq 8(%1, %0, 4), %%mm0\n\t" "movq %%mm0, %%mm3\n\t" "punpcklbw %%mm6, %%mm0\n\t" /* Y U2 Y V2 Y U2 Y V2*/ "punpckhbw %%mm6, %%mm3\n\t" /* Y U3 Y V3 Y U3 Y V3*/ MOVNTQ" %%mm0, 16(%4, %0, 8)\n\t" MOVNTQ" %%mm3, 24(%4, %0, 8)\n\t" "movq %%mm4, %%mm6\n\t" "movq 16(%1, %0, 4), %%mm0\n\t" "movq %%mm0, %%mm3\n\t" "punpcklbw %%mm5, %%mm4\n\t" "punpcklbw %%mm4, %%mm0\n\t" /* Y U4 Y V4 Y U4 Y V4*/ "punpckhbw %%mm4, %%mm3\n\t" /* Y U5 Y V5 Y U5 Y V5*/ MOVNTQ" %%mm0, 32(%4, %0, 8)\n\t" MOVNTQ" %%mm3, 40(%4, %0, 8)\n\t" "punpckhbw %%mm5, %%mm6\n\t" "movq 24(%1, %0, 4), %%mm0\n\t" "movq %%mm0, %%mm3\n\t" "punpcklbw %%mm6, %%mm0\n\t" /* Y U6 Y V6 Y U6 Y V6*/ "punpckhbw %%mm6, %%mm3\n\t" /* Y U7 Y V7 Y U7 Y V7*/ MOVNTQ" %%mm0, 48(%4, %0, 8)\n\t" MOVNTQ" %%mm3, 56(%4, %0, 8)\n\t" : "+r" (x) : "r"(yp), "r" (up), "r"(vp), "r"(d) :"memory"); } #endif for(; x<w; x++) { const int x2= x<<2; d[8*x+0]=yp[x2]; d[8*x+1]=up[x]; d[8*x+2]=yp[x2+1]; d[8*x+3]=vp[x]; d[8*x+4]=yp[x2+2]; d[8*x+5]=up[x]; d[8*x+6]=yp[x2+3]; d[8*x+7]=vp[x]; } } #ifdef HAVE_MMX asm( EMMS" \n\t" SFENCE" \n\t" ::: "memory" ); #endif }
true
FFmpeg
7f526efd17973ec6d2204f7a47b6923e2be31363
static inline void RENAME(yvu9_to_yuy2)(const uint8_t *src1, const uint8_t *src2, const uint8_t *src3, uint8_t *dst, unsigned width, unsigned height, int srcStride1, int srcStride2, int srcStride3, int dstStride) { unsigned long y,x,w,h; w=width/2; h=height; for(y=0;y<h;y++){ const uint8_t* yp=src1+srcStride1*y; const uint8_t* up=src2+srcStride2*(y>>2); const uint8_t* vp=src3+srcStride3*(y>>2); uint8_t* d=dst+dstStride*y; x=0; #ifdef HAVE_MMX for(;x<w-7;x+=8) { asm volatile( PREFETCH" 32(%1, %0)\n\t" PREFETCH" 32(%2, %0)\n\t" PREFETCH" 32(%3, %0)\n\t" "movq (%1, %0, 4), %%mm0\n\t" "movq (%2, %0), %%mm1\n\t" "movq (%3, %0), %%mm2\n\t" "movq %%mm0, %%mm3\n\t" "movq %%mm1, %%mm4\n\t" "movq %%mm2, %%mm5\n\t" "punpcklbw %%mm1, %%mm1\n\t" "punpcklbw %%mm2, %%mm2\n\t" "punpckhbw %%mm4, %%mm4\n\t" "punpckhbw %%mm5, %%mm5\n\t" "movq %%mm1, %%mm6\n\t" "punpcklbw %%mm2, %%mm1\n\t" "punpcklbw %%mm1, %%mm0\n\t" "punpckhbw %%mm1, %%mm3\n\t" MOVNTQ" %%mm0, (%4, %0, 8)\n\t" MOVNTQ" %%mm3, 8(%4, %0, 8)\n\t" "punpckhbw %%mm2, %%mm6\n\t" "movq 8(%1, %0, 4), %%mm0\n\t" "movq %%mm0, %%mm3\n\t" "punpcklbw %%mm6, %%mm0\n\t" "punpckhbw %%mm6, %%mm3\n\t" MOVNTQ" %%mm0, 16(%4, %0, 8)\n\t" MOVNTQ" %%mm3, 24(%4, %0, 8)\n\t" "movq %%mm4, %%mm6\n\t" "movq 16(%1, %0, 4), %%mm0\n\t" "movq %%mm0, %%mm3\n\t" "punpcklbw %%mm5, %%mm4\n\t" "punpcklbw %%mm4, %%mm0\n\t" "punpckhbw %%mm4, %%mm3\n\t" MOVNTQ" %%mm0, 32(%4, %0, 8)\n\t" MOVNTQ" %%mm3, 40(%4, %0, 8)\n\t" "punpckhbw %%mm5, %%mm6\n\t" "movq 24(%1, %0, 4), %%mm0\n\t" "movq %%mm0, %%mm3\n\t" "punpcklbw %%mm6, %%mm0\n\t" "punpckhbw %%mm6, %%mm3\n\t" MOVNTQ" %%mm0, 48(%4, %0, 8)\n\t" MOVNTQ" %%mm3, 56(%4, %0, 8)\n\t" : "+r" (x) : "r"(yp), "r" (up), "r"(vp), "r"(d) :"memory"); } #endif for(; x<w; x++) { const int x2= x<<2; d[8*x+0]=yp[x2]; d[8*x+1]=up[x]; d[8*x+2]=yp[x2+1]; d[8*x+3]=vp[x]; d[8*x+4]=yp[x2+2]; d[8*x+5]=up[x]; d[8*x+6]=yp[x2+3]; d[8*x+7]=vp[x]; } } #ifdef HAVE_MMX asm( EMMS" \n\t" SFENCE" \n\t" ::: "memory" ); #endif }
{ "code": [ "\t\t\tunsigned width, unsigned height,", "\t\t\tint srcStride1, int srcStride2,", "\t\t\tunsigned width, unsigned height,", "\t\t\tint srcStride1, int srcStride2,", "\t\t\tunsigned width, unsigned height,", "\t\t\tint srcStride1, int srcStride2,", "\t\t\tunsigned width, unsigned height,", "\t\t\tint srcStride1, int srcStride2,", "\t\t\tunsigned width, unsigned height,", "\t\t\tint srcStride1, int srcStride2,", "\t\t\tunsigned width, unsigned height,", "\t\t\tint srcStride1, int srcStride2,", "\t\t\tint srcStride3, int dstStride)", " unsigned long y,x,w,h;", "\t const int x2= x<<2;" ], "line_no": [ 5, 7, 5, 7, 5, 7, 5, 7, 5, 7, 5, 7, 9, 13, 143 ] }
static inline void FUNC_0(yvu9_to_yuy2)(const uint8_t *src1, const uint8_t *src2, const uint8_t *src3, uint8_t *dst, unsigned width, unsigned height, int srcStride1, int srcStride2, int srcStride3, int dstStride) { unsigned long VAR_0,VAR_1,VAR_2,VAR_3; VAR_2=width/2; VAR_3=height; for(VAR_0=0;VAR_0<VAR_3;VAR_0++){ const uint8_t* VAR_4=src1+srcStride1*VAR_0; const uint8_t* VAR_5=src2+srcStride2*(VAR_0>>2); const uint8_t* VAR_6=src3+srcStride3*(VAR_0>>2); uint8_t* d=dst+dstStride*VAR_0; VAR_1=0; #ifdef HAVE_MMX for(;VAR_1<VAR_2-7;VAR_1+=8) { asm volatile( PREFETCH" 32(%1, %0)\n\t" PREFETCH" 32(%2, %0)\n\t" PREFETCH" 32(%3, %0)\n\t" "movq (%1, %0, 4), %%mm0\n\t" "movq (%2, %0), %%mm1\n\t" "movq (%3, %0), %%mm2\n\t" "movq %%mm0, %%mm3\n\t" "movq %%mm1, %%mm4\n\t" "movq %%mm2, %%mm5\n\t" "punpcklbw %%mm1, %%mm1\n\t" "punpcklbw %%mm2, %%mm2\n\t" "punpckhbw %%mm4, %%mm4\n\t" "punpckhbw %%mm5, %%mm5\n\t" "movq %%mm1, %%mm6\n\t" "punpcklbw %%mm2, %%mm1\n\t" "punpcklbw %%mm1, %%mm0\n\t" "punpckhbw %%mm1, %%mm3\n\t" MOVNTQ" %%mm0, (%4, %0, 8)\n\t" MOVNTQ" %%mm3, 8(%4, %0, 8)\n\t" "punpckhbw %%mm2, %%mm6\n\t" "movq 8(%1, %0, 4), %%mm0\n\t" "movq %%mm0, %%mm3\n\t" "punpcklbw %%mm6, %%mm0\n\t" "punpckhbw %%mm6, %%mm3\n\t" MOVNTQ" %%mm0, 16(%4, %0, 8)\n\t" MOVNTQ" %%mm3, 24(%4, %0, 8)\n\t" "movq %%mm4, %%mm6\n\t" "movq 16(%1, %0, 4), %%mm0\n\t" "movq %%mm0, %%mm3\n\t" "punpcklbw %%mm5, %%mm4\n\t" "punpcklbw %%mm4, %%mm0\n\t" "punpckhbw %%mm4, %%mm3\n\t" MOVNTQ" %%mm0, 32(%4, %0, 8)\n\t" MOVNTQ" %%mm3, 40(%4, %0, 8)\n\t" "punpckhbw %%mm5, %%mm6\n\t" "movq 24(%1, %0, 4), %%mm0\n\t" "movq %%mm0, %%mm3\n\t" "punpcklbw %%mm6, %%mm0\n\t" "punpckhbw %%mm6, %%mm3\n\t" MOVNTQ" %%mm0, 48(%4, %0, 8)\n\t" MOVNTQ" %%mm3, 56(%4, %0, 8)\n\t" : "+r" (VAR_1) : "r"(VAR_4), "r" (VAR_5), "r"(VAR_6), "r"(d) :"memory"); } #endif for(; VAR_1<VAR_2; VAR_1++) { const int VAR_7= VAR_1<<2; d[8*VAR_1+0]=VAR_4[VAR_7]; d[8*VAR_1+1]=VAR_5[VAR_1]; d[8*VAR_1+2]=VAR_4[VAR_7+1]; d[8*VAR_1+3]=VAR_6[VAR_1]; d[8*VAR_1+4]=VAR_4[VAR_7+2]; d[8*VAR_1+5]=VAR_5[VAR_1]; d[8*VAR_1+6]=VAR_4[VAR_7+3]; d[8*VAR_1+7]=VAR_6[VAR_1]; } } #ifdef HAVE_MMX asm( EMMS" \n\t" SFENCE" \n\t" ::: "memory" ); #endif }
[ "static inline void FUNC_0(yvu9_to_yuy2)(const uint8_t *src1, const uint8_t *src2, const uint8_t *src3,\nuint8_t *dst,\nunsigned width, unsigned height,\nint srcStride1, int srcStride2,\nint srcStride3, int dstStride)\n{", "unsigned long VAR_0,VAR_1,VAR_2,VAR_3;", "VAR_2=width/2; VAR_3=height;", "for(VAR_0=0;VAR_0<VAR_3;VAR_0++){", "const uint8_t* VAR_4=src1+srcStride1*VAR_0;", "const uint8_t* VAR_5=src2+srcStride2*(VAR_0>>2);", "const uint8_t* VAR_6=src3+srcStride3*(VAR_0>>2);", "uint8_t* d=dst+dstStride*VAR_0;", "VAR_1=0;", "#ifdef HAVE_MMX\nfor(;VAR_1<VAR_2-7;VAR_1+=8)", "{", "asm volatile(\nPREFETCH\" 32(%1, %0)\\n\\t\"\nPREFETCH\" 32(%2, %0)\\n\\t\"\nPREFETCH\" 32(%3, %0)\\n\\t\"\n\"movq\t(%1, %0, 4), %%mm0\\n\\t\"\n\"movq\t(%2, %0), %%mm1\\n\\t\"\n\"movq\t(%3, %0), %%mm2\\n\\t\"\n\"movq\t%%mm0, %%mm3\\n\\t\"\n\"movq\t%%mm1, %%mm4\\n\\t\"\n\"movq\t%%mm2, %%mm5\\n\\t\"\n\"punpcklbw %%mm1, %%mm1\\n\\t\"\n\"punpcklbw %%mm2, %%mm2\\n\\t\"\n\"punpckhbw %%mm4, %%mm4\\n\\t\"\n\"punpckhbw %%mm5, %%mm5\\n\\t\"\n\"movq\t%%mm1, %%mm6\\n\\t\"\n\"punpcklbw %%mm2, %%mm1\\n\\t\"\n\"punpcklbw %%mm1, %%mm0\\n\\t\"\n\"punpckhbw %%mm1, %%mm3\\n\\t\"\nMOVNTQ\"\t%%mm0, (%4, %0, 8)\\n\\t\"\nMOVNTQ\"\t%%mm3, 8(%4, %0, 8)\\n\\t\"\n\"punpckhbw %%mm2, %%mm6\\n\\t\"\n\"movq\t8(%1, %0, 4), %%mm0\\n\\t\"\n\"movq\t%%mm0, %%mm3\\n\\t\"\n\"punpcklbw %%mm6, %%mm0\\n\\t\"\n\"punpckhbw %%mm6, %%mm3\\n\\t\"\nMOVNTQ\"\t%%mm0, 16(%4, %0, 8)\\n\\t\"\nMOVNTQ\"\t%%mm3, 24(%4, %0, 8)\\n\\t\"\n\"movq\t%%mm4, %%mm6\\n\\t\"\n\"movq\t16(%1, %0, 4), %%mm0\\n\\t\"\n\"movq\t%%mm0, %%mm3\\n\\t\"\n\"punpcklbw %%mm5, %%mm4\\n\\t\"\n\"punpcklbw %%mm4, %%mm0\\n\\t\"\n\"punpckhbw %%mm4, %%mm3\\n\\t\"\nMOVNTQ\"\t%%mm0, 32(%4, %0, 8)\\n\\t\"\nMOVNTQ\"\t%%mm3, 40(%4, %0, 8)\\n\\t\"\n\"punpckhbw %%mm5, %%mm6\\n\\t\"\n\"movq\t24(%1, %0, 4), %%mm0\\n\\t\"\n\"movq\t%%mm0, %%mm3\\n\\t\"\n\"punpcklbw %%mm6, %%mm0\\n\\t\"\n\"punpckhbw %%mm6, %%mm3\\n\\t\"\nMOVNTQ\"\t%%mm0, 48(%4, %0, 8)\\n\\t\"\nMOVNTQ\"\t%%mm3, 56(%4, %0, 8)\\n\\t\"\n: \"+r\" (VAR_1)\n: \"r\"(VAR_4), \"r\" (VAR_5), \"r\"(VAR_6), \"r\"(d)\n:\"memory\");", "}", "#endif\nfor(; VAR_1<VAR_2; VAR_1++)", "{", "const int VAR_7= VAR_1<<2;", "d[8*VAR_1+0]=VAR_4[VAR_7];", "d[8*VAR_1+1]=VAR_5[VAR_1];", "d[8*VAR_1+2]=VAR_4[VAR_7+1];", "d[8*VAR_1+3]=VAR_6[VAR_1];", "d[8*VAR_1+4]=VAR_4[VAR_7+2];", "d[8*VAR_1+5]=VAR_5[VAR_1];", "d[8*VAR_1+6]=VAR_4[VAR_7+3];", "d[8*VAR_1+7]=VAR_6[VAR_1];", "}", "}", "#ifdef HAVE_MMX\nasm(\nEMMS\" \\n\\t\"\nSFENCE\" \\n\\t\"\n::: \"memory\"\n);", "#endif\n}" ]
[ 1, 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, 7, 9, 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29, 31 ], [ 33 ], [ 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 65, 67, 69, 71, 73, 75, 79, 81, 83, 85, 87, 89, 91, 95, 97, 99, 101, 103, 105, 107, 109, 113, 115, 117, 119, 121, 123, 125, 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 ] ]
14,041
static int qio_channel_websock_handshake_process(QIOChannelWebsock *ioc, const char *line, size_t size, Error **errp) { int ret = -1; char *protocols = qio_channel_websock_handshake_entry( line, size, QIO_CHANNEL_WEBSOCK_HEADER_PROTOCOL); char *version = qio_channel_websock_handshake_entry( line, size, QIO_CHANNEL_WEBSOCK_HEADER_VERSION); char *key = qio_channel_websock_handshake_entry( line, size, QIO_CHANNEL_WEBSOCK_HEADER_KEY); if (!protocols) { error_setg(errp, "Missing websocket protocol header data"); goto cleanup; } if (!version) { error_setg(errp, "Missing websocket version header data"); goto cleanup; } if (!key) { error_setg(errp, "Missing websocket key header data"); goto cleanup; } if (!g_strrstr(protocols, QIO_CHANNEL_WEBSOCK_PROTOCOL_BINARY)) { error_setg(errp, "No '%s' protocol is supported by client '%s'", QIO_CHANNEL_WEBSOCK_PROTOCOL_BINARY, protocols); goto cleanup; } if (!g_str_equal(version, QIO_CHANNEL_WEBSOCK_SUPPORTED_VERSION)) { error_setg(errp, "Version '%s' is not supported by client '%s'", QIO_CHANNEL_WEBSOCK_SUPPORTED_VERSION, version); goto cleanup; } if (strlen(key) != QIO_CHANNEL_WEBSOCK_CLIENT_KEY_LEN) { error_setg(errp, "Key length '%zu' was not as expected '%d'", strlen(key), QIO_CHANNEL_WEBSOCK_CLIENT_KEY_LEN); goto cleanup; } ret = qio_channel_websock_handshake_send_response(ioc, key, errp); cleanup: g_free(protocols); g_free(version); g_free(key); return ret; }
true
qemu
07e95cd529af345fdeea230913f68eff5b925bb6
static int qio_channel_websock_handshake_process(QIOChannelWebsock *ioc, const char *line, size_t size, Error **errp) { int ret = -1; char *protocols = qio_channel_websock_handshake_entry( line, size, QIO_CHANNEL_WEBSOCK_HEADER_PROTOCOL); char *version = qio_channel_websock_handshake_entry( line, size, QIO_CHANNEL_WEBSOCK_HEADER_VERSION); char *key = qio_channel_websock_handshake_entry( line, size, QIO_CHANNEL_WEBSOCK_HEADER_KEY); if (!protocols) { error_setg(errp, "Missing websocket protocol header data"); goto cleanup; } if (!version) { error_setg(errp, "Missing websocket version header data"); goto cleanup; } if (!key) { error_setg(errp, "Missing websocket key header data"); goto cleanup; } if (!g_strrstr(protocols, QIO_CHANNEL_WEBSOCK_PROTOCOL_BINARY)) { error_setg(errp, "No '%s' protocol is supported by client '%s'", QIO_CHANNEL_WEBSOCK_PROTOCOL_BINARY, protocols); goto cleanup; } if (!g_str_equal(version, QIO_CHANNEL_WEBSOCK_SUPPORTED_VERSION)) { error_setg(errp, "Version '%s' is not supported by client '%s'", QIO_CHANNEL_WEBSOCK_SUPPORTED_VERSION, version); goto cleanup; } if (strlen(key) != QIO_CHANNEL_WEBSOCK_CLIENT_KEY_LEN) { error_setg(errp, "Key length '%zu' was not as expected '%d'", strlen(key), QIO_CHANNEL_WEBSOCK_CLIENT_KEY_LEN); goto cleanup; } ret = qio_channel_websock_handshake_send_response(ioc, key, errp); cleanup: g_free(protocols); g_free(version); g_free(key); return ret; }
{ "code": [ " return ret;", " const char *line,", " size_t size,", " int ret = -1;", " char *protocols = qio_channel_websock_handshake_entry(", " line, size, QIO_CHANNEL_WEBSOCK_HEADER_PROTOCOL);", " char *version = qio_channel_websock_handshake_entry(", " line, size, QIO_CHANNEL_WEBSOCK_HEADER_VERSION);", " char *key = qio_channel_websock_handshake_entry(", " line, size, QIO_CHANNEL_WEBSOCK_HEADER_KEY);", " goto cleanup;", " goto cleanup;", " goto cleanup;", " goto cleanup;", " goto cleanup;", " goto cleanup;", " ret = qio_channel_websock_handshake_send_response(ioc, key, errp);", " cleanup:", " g_free(protocols);", " g_free(version);", " g_free(key);", " return ret;" ], "line_no": [ 105, 3, 5, 11, 13, 15, 17, 19, 21, 23, 31, 31, 31, 31, 31, 31, 93, 97, 99, 101, 103, 105 ] }
static int FUNC_0(QIOChannelWebsock *VAR_0, const char *VAR_1, size_t VAR_2, Error **VAR_3) { int VAR_4 = -1; char *VAR_5 = qio_channel_websock_handshake_entry( VAR_1, VAR_2, QIO_CHANNEL_WEBSOCK_HEADER_PROTOCOL); char *VAR_6 = qio_channel_websock_handshake_entry( VAR_1, VAR_2, QIO_CHANNEL_WEBSOCK_HEADER_VERSION); char *VAR_7 = qio_channel_websock_handshake_entry( VAR_1, VAR_2, QIO_CHANNEL_WEBSOCK_HEADER_KEY); if (!VAR_5) { error_setg(VAR_3, "Missing websocket protocol header data"); goto cleanup; } if (!VAR_6) { error_setg(VAR_3, "Missing websocket VAR_6 header data"); goto cleanup; } if (!VAR_7) { error_setg(VAR_3, "Missing websocket VAR_7 header data"); goto cleanup; } if (!g_strrstr(VAR_5, QIO_CHANNEL_WEBSOCK_PROTOCOL_BINARY)) { error_setg(VAR_3, "No '%s' protocol is supported by client '%s'", QIO_CHANNEL_WEBSOCK_PROTOCOL_BINARY, VAR_5); goto cleanup; } if (!g_str_equal(VAR_6, QIO_CHANNEL_WEBSOCK_SUPPORTED_VERSION)) { error_setg(VAR_3, "Version '%s' is not supported by client '%s'", QIO_CHANNEL_WEBSOCK_SUPPORTED_VERSION, VAR_6); goto cleanup; } if (strlen(VAR_7) != QIO_CHANNEL_WEBSOCK_CLIENT_KEY_LEN) { error_setg(VAR_3, "Key length '%zu' was not as expected '%d'", strlen(VAR_7), QIO_CHANNEL_WEBSOCK_CLIENT_KEY_LEN); goto cleanup; } VAR_4 = qio_channel_websock_handshake_send_response(VAR_0, VAR_7, VAR_3); cleanup: g_free(VAR_5); g_free(VAR_6); g_free(VAR_7); return VAR_4; }
[ "static int FUNC_0(QIOChannelWebsock *VAR_0,\nconst char *VAR_1,\nsize_t VAR_2,\nError **VAR_3)\n{", "int VAR_4 = -1;", "char *VAR_5 = qio_channel_websock_handshake_entry(\nVAR_1, VAR_2, QIO_CHANNEL_WEBSOCK_HEADER_PROTOCOL);", "char *VAR_6 = qio_channel_websock_handshake_entry(\nVAR_1, VAR_2, QIO_CHANNEL_WEBSOCK_HEADER_VERSION);", "char *VAR_7 = qio_channel_websock_handshake_entry(\nVAR_1, VAR_2, QIO_CHANNEL_WEBSOCK_HEADER_KEY);", "if (!VAR_5) {", "error_setg(VAR_3, \"Missing websocket protocol header data\");", "goto cleanup;", "}", "if (!VAR_6) {", "error_setg(VAR_3, \"Missing websocket VAR_6 header data\");", "goto cleanup;", "}", "if (!VAR_7) {", "error_setg(VAR_3, \"Missing websocket VAR_7 header data\");", "goto cleanup;", "}", "if (!g_strrstr(VAR_5, QIO_CHANNEL_WEBSOCK_PROTOCOL_BINARY)) {", "error_setg(VAR_3, \"No '%s' protocol is supported by client '%s'\",\nQIO_CHANNEL_WEBSOCK_PROTOCOL_BINARY, VAR_5);", "goto cleanup;", "}", "if (!g_str_equal(VAR_6, QIO_CHANNEL_WEBSOCK_SUPPORTED_VERSION)) {", "error_setg(VAR_3, \"Version '%s' is not supported by client '%s'\",\nQIO_CHANNEL_WEBSOCK_SUPPORTED_VERSION, VAR_6);", "goto cleanup;", "}", "if (strlen(VAR_7) != QIO_CHANNEL_WEBSOCK_CLIENT_KEY_LEN) {", "error_setg(VAR_3, \"Key length '%zu' was not as expected '%d'\",\nstrlen(VAR_7), QIO_CHANNEL_WEBSOCK_CLIENT_KEY_LEN);", "goto cleanup;", "}", "VAR_4 = qio_channel_websock_handshake_send_response(VAR_0, VAR_7, VAR_3);", "cleanup:\ng_free(VAR_5);", "g_free(VAR_6);", "g_free(VAR_7);", "return VAR_4;", "}" ]
[ 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13, 15 ], [ 17, 19 ], [ 21, 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59, 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71, 73 ], [ 75 ], [ 77 ], [ 81 ], [ 83, 85 ], [ 87 ], [ 89 ], [ 93 ], [ 97, 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ] ]
14,042
static void *av_mallocz_static(unsigned int size) { void *ptr = av_mallocz(size); if(ptr){ array_static =av_fast_realloc(array_static, &allocated_static, sizeof(void*)*(last_static+1)); if(!array_static) return NULL; array_static[last_static++] = ptr; } return ptr; }
true
FFmpeg
b9c8388710a06544812739eedc0a40d3451491dc
static void *av_mallocz_static(unsigned int size) { void *ptr = av_mallocz(size); if(ptr){ array_static =av_fast_realloc(array_static, &allocated_static, sizeof(void*)*(last_static+1)); if(!array_static) return NULL; array_static[last_static++] = ptr; } return ptr; }
{ "code": [ " void *ptr = av_mallocz(size);", " if(ptr){", " array_static =av_fast_realloc(array_static, &allocated_static, sizeof(void*)*(last_static+1));", " if(!array_static)", " return NULL;", " array_static[last_static++] = ptr;", " return ptr;" ], "line_no": [ 5, 9, 11, 13, 15, 17, 23 ] }
static void *FUNC_0(unsigned int VAR_0) { void *VAR_1 = av_mallocz(VAR_0); if(VAR_1){ array_static =av_fast_realloc(array_static, &allocated_static, sizeof(void*)*(last_static+1)); if(!array_static) return NULL; array_static[last_static++] = VAR_1; } return VAR_1; }
[ "static void *FUNC_0(unsigned int VAR_0)\n{", "void *VAR_1 = av_mallocz(VAR_0);", "if(VAR_1){", "array_static =av_fast_realloc(array_static, &allocated_static, sizeof(void*)*(last_static+1));", "if(!array_static)\nreturn NULL;", "array_static[last_static++] = VAR_1;", "}", "return VAR_1;", "}" ]
[ 0, 1, 1, 1, 1, 1, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ] ]
14,043
int index_from_key(const char *key) { int i; for (i = 0; QKeyCode_lookup[i] != NULL; i++) { if (!strcmp(key, QKeyCode_lookup[i])) { break; } } /* Return Q_KEY_CODE__MAX if the key is invalid */ return i; }
true
qemu
64ffbe04eaafebf4045a3ace52a360c14959d196
int index_from_key(const char *key) { int i; for (i = 0; QKeyCode_lookup[i] != NULL; i++) { if (!strcmp(key, QKeyCode_lookup[i])) { break; } } return i; }
{ "code": [ "int index_from_key(const char *key)", " if (!strcmp(key, QKeyCode_lookup[i])) {" ], "line_no": [ 1, 11 ] }
int FUNC_0(const char *VAR_0) { int VAR_1; for (VAR_1 = 0; QKeyCode_lookup[VAR_1] != NULL; VAR_1++) { if (!strcmp(VAR_0, QKeyCode_lookup[VAR_1])) { break; } } return VAR_1; }
[ "int FUNC_0(const char *VAR_0)\n{", "int VAR_1;", "for (VAR_1 = 0; QKeyCode_lookup[VAR_1] != NULL; VAR_1++) {", "if (!strcmp(VAR_0, QKeyCode_lookup[VAR_1])) {", "break;", "}", "}", "return VAR_1;", "}" ]
[ 1, 0, 0, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 23 ], [ 25 ] ]
14,045
static int mxf_read_primer_pack(MXFContext *mxf) { ByteIOContext *pb = mxf->fc->pb; int item_num = get_be32(pb); int item_len = get_be32(pb); if (item_len != 18) { av_log(mxf->fc, AV_LOG_ERROR, "unsupported primer pack item length\n"); return -1; } if (item_num > UINT_MAX / item_len) return -1; mxf->local_tags_count = item_num; mxf->local_tags = av_malloc(item_num*item_len); if (!mxf->local_tags) return -1; get_buffer(pb, mxf->local_tags, item_num*item_len); return 0; }
true
FFmpeg
39bb30f6640fe1faf4bbc779a79786028febc95d
static int mxf_read_primer_pack(MXFContext *mxf) { ByteIOContext *pb = mxf->fc->pb; int item_num = get_be32(pb); int item_len = get_be32(pb); if (item_len != 18) { av_log(mxf->fc, AV_LOG_ERROR, "unsupported primer pack item length\n"); return -1; } if (item_num > UINT_MAX / item_len) return -1; mxf->local_tags_count = item_num; mxf->local_tags = av_malloc(item_num*item_len); if (!mxf->local_tags) return -1; get_buffer(pb, mxf->local_tags, item_num*item_len); return 0; }
{ "code": [ "static int mxf_read_primer_pack(MXFContext *mxf)", " ByteIOContext *pb = mxf->fc->pb;" ], "line_no": [ 1, 5 ] }
static int FUNC_0(MXFContext *VAR_0) { ByteIOContext *pb = VAR_0->fc->pb; int VAR_1 = get_be32(pb); int VAR_2 = get_be32(pb); if (VAR_2 != 18) { av_log(VAR_0->fc, AV_LOG_ERROR, "unsupported primer pack item length\n"); return -1; } if (VAR_1 > UINT_MAX / VAR_2) return -1; VAR_0->local_tags_count = VAR_1; VAR_0->local_tags = av_malloc(VAR_1*VAR_2); if (!VAR_0->local_tags) return -1; get_buffer(pb, VAR_0->local_tags, VAR_1*VAR_2); return 0; }
[ "static int FUNC_0(MXFContext *VAR_0)\n{", "ByteIOContext *pb = VAR_0->fc->pb;", "int VAR_1 = get_be32(pb);", "int VAR_2 = get_be32(pb);", "if (VAR_2 != 18) {", "av_log(VAR_0->fc, AV_LOG_ERROR, \"unsupported primer pack item length\\n\");", "return -1;", "}", "if (VAR_1 > UINT_MAX / VAR_2)\nreturn -1;", "VAR_0->local_tags_count = VAR_1;", "VAR_0->local_tags = av_malloc(VAR_1*VAR_2);", "if (!VAR_0->local_tags)\nreturn -1;", "get_buffer(pb, VAR_0->local_tags, VAR_1*VAR_2);", "return 0;", "}" ]
[ 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21, 23 ], [ 25 ], [ 27 ], [ 29, 31 ], [ 33 ], [ 35 ], [ 37 ] ]
14,047
static void rtas_ibm_query_interrupt_source_number(PowerPCCPU *cpu, sPAPREnvironment *spapr, uint32_t token, uint32_t nargs, target_ulong args, uint32_t nret, target_ulong rets) { uint32_t config_addr = rtas_ld(args, 0); uint64_t buid = ((uint64_t)rtas_ld(args, 1) << 32) | rtas_ld(args, 2); unsigned int intr_src_num = -1, ioa_intr_num = rtas_ld(args, 3); int ndev; sPAPRPHBState *phb = NULL; /* Fins sPAPRPHBState */ phb = find_phb(spapr, buid); if (!phb) { rtas_st(rets, 0, RTAS_OUT_PARAM_ERROR); return; } /* Find device descriptor and start IRQ */ ndev = spapr_msicfg_find(phb, config_addr, false); if (ndev < 0) { trace_spapr_pci_msi("MSI has not been enabled", -1, config_addr); rtas_st(rets, 0, RTAS_OUT_HW_ERROR); return; } intr_src_num = phb->msi_table[ndev].irq + ioa_intr_num; trace_spapr_pci_rtas_ibm_query_interrupt_source_number(ioa_intr_num, intr_src_num); rtas_st(rets, 0, RTAS_OUT_SUCCESS); rtas_st(rets, 1, intr_src_num); rtas_st(rets, 2, 1);/* 0 == level; 1 == edge */ }
true
qemu
9a321e92343891e30f6fe8bfaad40454ae358bfb
static void rtas_ibm_query_interrupt_source_number(PowerPCCPU *cpu, sPAPREnvironment *spapr, uint32_t token, uint32_t nargs, target_ulong args, uint32_t nret, target_ulong rets) { uint32_t config_addr = rtas_ld(args, 0); uint64_t buid = ((uint64_t)rtas_ld(args, 1) << 32) | rtas_ld(args, 2); unsigned int intr_src_num = -1, ioa_intr_num = rtas_ld(args, 3); int ndev; sPAPRPHBState *phb = NULL; phb = find_phb(spapr, buid); if (!phb) { rtas_st(rets, 0, RTAS_OUT_PARAM_ERROR); return; } ndev = spapr_msicfg_find(phb, config_addr, false); if (ndev < 0) { trace_spapr_pci_msi("MSI has not been enabled", -1, config_addr); rtas_st(rets, 0, RTAS_OUT_HW_ERROR); return; } intr_src_num = phb->msi_table[ndev].irq + ioa_intr_num; trace_spapr_pci_rtas_ibm_query_interrupt_source_number(ioa_intr_num, intr_src_num); rtas_st(rets, 0, RTAS_OUT_SUCCESS); rtas_st(rets, 1, intr_src_num); rtas_st(rets, 2, 1); }
{ "code": [ " rtas_st(rets, 0, RTAS_OUT_HW_ERROR);", " int ndev;", " if (!phb) {", " ndev = spapr_msicfg_find(phb, config_addr, false);", " if (ndev < 0) {", " trace_spapr_pci_msi(\"MSI has not been enabled\", -1, config_addr);", " intr_src_num = phb->msi_table[ndev].irq + ioa_intr_num;" ], "line_no": [ 51, 23, 33, 45, 47, 49, 59 ] }
static void FUNC_0(PowerPCCPU *VAR_0, sPAPREnvironment *VAR_1, uint32_t VAR_2, uint32_t VAR_3, target_ulong VAR_4, uint32_t VAR_5, target_ulong VAR_6) { uint32_t config_addr = rtas_ld(VAR_4, 0); uint64_t buid = ((uint64_t)rtas_ld(VAR_4, 1) << 32) | rtas_ld(VAR_4, 2); unsigned int VAR_7 = -1, VAR_8 = rtas_ld(VAR_4, 3); int VAR_9; sPAPRPHBState *phb = NULL; phb = find_phb(VAR_1, buid); if (!phb) { rtas_st(VAR_6, 0, RTAS_OUT_PARAM_ERROR); return; } VAR_9 = spapr_msicfg_find(phb, config_addr, false); if (VAR_9 < 0) { trace_spapr_pci_msi("MSI has not been enabled", -1, config_addr); rtas_st(VAR_6, 0, RTAS_OUT_HW_ERROR); return; } VAR_7 = phb->msi_table[VAR_9].irq + VAR_8; trace_spapr_pci_rtas_ibm_query_interrupt_source_number(VAR_8, VAR_7); rtas_st(VAR_6, 0, RTAS_OUT_SUCCESS); rtas_st(VAR_6, 1, VAR_7); rtas_st(VAR_6, 2, 1); }
[ "static void FUNC_0(PowerPCCPU *VAR_0,\nsPAPREnvironment *VAR_1,\nuint32_t VAR_2,\nuint32_t VAR_3,\ntarget_ulong VAR_4,\nuint32_t VAR_5,\ntarget_ulong VAR_6)\n{", "uint32_t config_addr = rtas_ld(VAR_4, 0);", "uint64_t buid = ((uint64_t)rtas_ld(VAR_4, 1) << 32) | rtas_ld(VAR_4, 2);", "unsigned int VAR_7 = -1, VAR_8 = rtas_ld(VAR_4, 3);", "int VAR_9;", "sPAPRPHBState *phb = NULL;", "phb = find_phb(VAR_1, buid);", "if (!phb) {", "rtas_st(VAR_6, 0, RTAS_OUT_PARAM_ERROR);", "return;", "}", "VAR_9 = spapr_msicfg_find(phb, config_addr, false);", "if (VAR_9 < 0) {", "trace_spapr_pci_msi(\"MSI has not been enabled\", -1, config_addr);", "rtas_st(VAR_6, 0, RTAS_OUT_HW_ERROR);", "return;", "}", "VAR_7 = phb->msi_table[VAR_9].irq + VAR_8;", "trace_spapr_pci_rtas_ibm_query_interrupt_source_number(VAR_8,\nVAR_7);", "rtas_st(VAR_6, 0, RTAS_OUT_SUCCESS);", "rtas_st(VAR_6, 1, VAR_7);", "rtas_st(VAR_6, 2, 1);", "}" ]
[ 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11, 13, 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61, 63 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ] ]
14,048
static int convert_bitstream(const uint8_t *src, int src_size, uint8_t *dst, int max_size) { switch (AV_RB32(src)) { case DCA_SYNCWORD_CORE_BE: case DCA_SYNCWORD_SUBSTREAM: memcpy(dst, src, src_size); return src_size; case DCA_SYNCWORD_CORE_LE: case DCA_SYNCWORD_CORE_14B_BE: case DCA_SYNCWORD_CORE_14B_LE: return avpriv_dca_convert_bitstream(src, src_size, dst, max_size); default: return AVERROR_INVALIDDATA; } }
false
FFmpeg
d1f558b3628d3ab99fd93a98b5758ef1be45a5da
static int convert_bitstream(const uint8_t *src, int src_size, uint8_t *dst, int max_size) { switch (AV_RB32(src)) { case DCA_SYNCWORD_CORE_BE: case DCA_SYNCWORD_SUBSTREAM: memcpy(dst, src, src_size); return src_size; case DCA_SYNCWORD_CORE_LE: case DCA_SYNCWORD_CORE_14B_BE: case DCA_SYNCWORD_CORE_14B_LE: return avpriv_dca_convert_bitstream(src, src_size, dst, max_size); default: return AVERROR_INVALIDDATA; } }
{ "code": [], "line_no": [] }
static int FUNC_0(const uint8_t *VAR_0, int VAR_1, uint8_t *VAR_2, int VAR_3) { switch (AV_RB32(VAR_0)) { case DCA_SYNCWORD_CORE_BE: case DCA_SYNCWORD_SUBSTREAM: memcpy(VAR_2, VAR_0, VAR_1); return VAR_1; case DCA_SYNCWORD_CORE_LE: case DCA_SYNCWORD_CORE_14B_BE: case DCA_SYNCWORD_CORE_14B_LE: return avpriv_dca_convert_bitstream(VAR_0, VAR_1, VAR_2, VAR_3); default: return AVERROR_INVALIDDATA; } }
[ "static int FUNC_0(const uint8_t *VAR_0, int VAR_1, uint8_t *VAR_2, int VAR_3)\n{", "switch (AV_RB32(VAR_0)) {", "case DCA_SYNCWORD_CORE_BE:\ncase DCA_SYNCWORD_SUBSTREAM:\nmemcpy(VAR_2, VAR_0, VAR_1);", "return VAR_1;", "case DCA_SYNCWORD_CORE_LE:\ncase DCA_SYNCWORD_CORE_14B_BE:\ncase DCA_SYNCWORD_CORE_14B_LE:\nreturn avpriv_dca_convert_bitstream(VAR_0, VAR_1, VAR_2, VAR_3);", "default:\nreturn AVERROR_INVALIDDATA;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9, 11 ], [ 13 ], [ 15, 17, 19, 21 ], [ 23, 25 ], [ 27 ], [ 29 ] ]
14,049
int ff_scale_image(uint8_t *dst_data[4], int dst_linesize[4], int dst_w, int dst_h, enum AVPixelFormat dst_pix_fmt, uint8_t * const src_data[4], int src_linesize[4], int src_w, int src_h, enum AVPixelFormat src_pix_fmt, void *log_ctx) { int ret; struct SwsContext *sws_ctx = sws_getContext(src_w, src_h, src_pix_fmt, dst_w, dst_h, dst_pix_fmt, SWS_BILINEAR, NULL, NULL, NULL); if (!sws_ctx) { av_log(log_ctx, AV_LOG_ERROR, "Impossible to create scale context for the conversion " "fmt:%s s:%dx%d -> fmt:%s s:%dx%d\n", av_get_pix_fmt_name(src_pix_fmt), src_w, src_h, av_get_pix_fmt_name(dst_pix_fmt), dst_w, dst_h); ret = AVERROR(EINVAL); goto end; } if ((ret = av_image_alloc(dst_data, dst_linesize, dst_w, dst_h, dst_pix_fmt, 16)) < 0) goto end; ret = 0; sws_scale(sws_ctx, (const uint8_t * const*)src_data, src_linesize, 0, src_h, dst_data, dst_linesize); end: sws_freeContext(sws_ctx); return ret; }
false
FFmpeg
b8866783c6a855643a3869020ac5241b12f7d97a
int ff_scale_image(uint8_t *dst_data[4], int dst_linesize[4], int dst_w, int dst_h, enum AVPixelFormat dst_pix_fmt, uint8_t * const src_data[4], int src_linesize[4], int src_w, int src_h, enum AVPixelFormat src_pix_fmt, void *log_ctx) { int ret; struct SwsContext *sws_ctx = sws_getContext(src_w, src_h, src_pix_fmt, dst_w, dst_h, dst_pix_fmt, SWS_BILINEAR, NULL, NULL, NULL); if (!sws_ctx) { av_log(log_ctx, AV_LOG_ERROR, "Impossible to create scale context for the conversion " "fmt:%s s:%dx%d -> fmt:%s s:%dx%d\n", av_get_pix_fmt_name(src_pix_fmt), src_w, src_h, av_get_pix_fmt_name(dst_pix_fmt), dst_w, dst_h); ret = AVERROR(EINVAL); goto end; } if ((ret = av_image_alloc(dst_data, dst_linesize, dst_w, dst_h, dst_pix_fmt, 16)) < 0) goto end; ret = 0; sws_scale(sws_ctx, (const uint8_t * const*)src_data, src_linesize, 0, src_h, dst_data, dst_linesize); end: sws_freeContext(sws_ctx); return ret; }
{ "code": [], "line_no": [] }
int FUNC_0(uint8_t *VAR_0[4], int VAR_1[4], int VAR_2, int VAR_3, enum AVPixelFormat VAR_4, uint8_t * const VAR_5[4], int VAR_6[4], int VAR_7, int VAR_8, enum AVPixelFormat VAR_9, void *VAR_10) { int VAR_11; struct SwsContext *VAR_12 = sws_getContext(VAR_7, VAR_8, VAR_9, VAR_2, VAR_3, VAR_4, SWS_BILINEAR, NULL, NULL, NULL); if (!VAR_12) { av_log(VAR_10, AV_LOG_ERROR, "Impossible to create scale context for the conversion " "fmt:%s s:%dx%d -> fmt:%s s:%dx%d\n", av_get_pix_fmt_name(VAR_9), VAR_7, VAR_8, av_get_pix_fmt_name(VAR_4), VAR_2, VAR_3); VAR_11 = AVERROR(EINVAL); goto end; } if ((VAR_11 = av_image_alloc(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, 16)) < 0) goto end; VAR_11 = 0; sws_scale(VAR_12, (const uint8_t * const*)VAR_5, VAR_6, 0, VAR_8, VAR_0, VAR_1); end: sws_freeContext(VAR_12); return VAR_11; }
[ "int FUNC_0(uint8_t *VAR_0[4], int VAR_1[4],\nint VAR_2, int VAR_3, enum AVPixelFormat VAR_4,\nuint8_t * const VAR_5[4], int VAR_6[4],\nint VAR_7, int VAR_8, enum AVPixelFormat VAR_9,\nvoid *VAR_10)\n{", "int VAR_11;", "struct SwsContext *VAR_12 = sws_getContext(VAR_7, VAR_8, VAR_9,\nVAR_2, VAR_3, VAR_4,\nSWS_BILINEAR, NULL, NULL, NULL);", "if (!VAR_12) {", "av_log(VAR_10, AV_LOG_ERROR,\n\"Impossible to create scale context for the conversion \"\n\"fmt:%s s:%dx%d -> fmt:%s s:%dx%d\\n\",\nav_get_pix_fmt_name(VAR_9), VAR_7, VAR_8,\nav_get_pix_fmt_name(VAR_4), VAR_2, VAR_3);", "VAR_11 = AVERROR(EINVAL);", "goto end;", "}", "if ((VAR_11 = av_image_alloc(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, 16)) < 0)\ngoto end;", "VAR_11 = 0;", "sws_scale(VAR_12, (const uint8_t * const*)VAR_5, VAR_6, 0, VAR_8, VAR_0, VAR_1);", "end:\nsws_freeContext(VAR_12);", "return VAR_11;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11 ], [ 13 ], [ 15, 17, 19 ], [ 21 ], [ 23, 25, 27, 29, 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41, 43 ], [ 45 ], [ 47 ], [ 51, 53 ], [ 55 ], [ 57 ] ]
14,050
static int ftp_read(URLContext *h, unsigned char *buf, int size) { FTPContext *s = h->priv_data; int read, err, retry_done = 0; av_dlog(h, "ftp protocol read %d bytes\n", size); retry: if (s->state == DISCONNECTED) { /* optimization */ if (s->position >= s->filesize) return 0; if ((err = ftp_connect_data_connection(h)) < 0) return err; } if (s->state == READY) { if (s->position >= s->filesize) return 0; if ((err = ftp_retrieve(s)) < 0) return err; } if (s->conn_data && s->state == DOWNLOADING) { read = ffurl_read(s->conn_data, buf, size); if (read >= 0) { s->position += read; if (s->position >= s->filesize) { /* server will terminate, but keep current position to avoid madness */ /* save position to restart from it */ int64_t pos = s->position; if (ftp_abort(h) < 0) { s->position = pos; return AVERROR(EIO); } s->position = pos; } } if (read <= 0 && s->position < s->filesize && !h->is_streamed) { /* Server closed connection. Probably due to inactivity */ int64_t pos = s->position; av_log(h, AV_LOG_INFO, "Reconnect to FTP server.\n"); if ((err = ftp_abort(h)) < 0) return err; if ((err = ftp_seek(h, pos, SEEK_SET)) < 0) { av_log(h, AV_LOG_ERROR, "Position cannot be restored.\n"); return err; } if (!retry_done) { retry_done = 1; goto retry; } } return read; } av_log(h, AV_LOG_DEBUG, "FTP read failed\n"); return AVERROR(EIO); }
false
FFmpeg
229843aa359ae0c9519977d7fa952688db63f559
static int ftp_read(URLContext *h, unsigned char *buf, int size) { FTPContext *s = h->priv_data; int read, err, retry_done = 0; av_dlog(h, "ftp protocol read %d bytes\n", size); retry: if (s->state == DISCONNECTED) { if (s->position >= s->filesize) return 0; if ((err = ftp_connect_data_connection(h)) < 0) return err; } if (s->state == READY) { if (s->position >= s->filesize) return 0; if ((err = ftp_retrieve(s)) < 0) return err; } if (s->conn_data && s->state == DOWNLOADING) { read = ffurl_read(s->conn_data, buf, size); if (read >= 0) { s->position += read; if (s->position >= s->filesize) { int64_t pos = s->position; if (ftp_abort(h) < 0) { s->position = pos; return AVERROR(EIO); } s->position = pos; } } if (read <= 0 && s->position < s->filesize && !h->is_streamed) { int64_t pos = s->position; av_log(h, AV_LOG_INFO, "Reconnect to FTP server.\n"); if ((err = ftp_abort(h)) < 0) return err; if ((err = ftp_seek(h, pos, SEEK_SET)) < 0) { av_log(h, AV_LOG_ERROR, "Position cannot be restored.\n"); return err; } if (!retry_done) { retry_done = 1; goto retry; } } return read; } av_log(h, AV_LOG_DEBUG, "FTP read failed\n"); return AVERROR(EIO); }
{ "code": [], "line_no": [] }
static int FUNC_0(URLContext *VAR_0, unsigned char *VAR_1, int VAR_2) { FTPContext *s = VAR_0->priv_data; int VAR_3, VAR_4, VAR_5 = 0; av_dlog(VAR_0, "ftp protocol VAR_3 %d bytes\n", VAR_2); retry: if (s->state == DISCONNECTED) { if (s->position >= s->filesize) return 0; if ((VAR_4 = ftp_connect_data_connection(VAR_0)) < 0) return VAR_4; } if (s->state == READY) { if (s->position >= s->filesize) return 0; if ((VAR_4 = ftp_retrieve(s)) < 0) return VAR_4; } if (s->conn_data && s->state == DOWNLOADING) { VAR_3 = ffurl_read(s->conn_data, VAR_1, VAR_2); if (VAR_3 >= 0) { s->position += VAR_3; if (s->position >= s->filesize) { int64_t pos = s->position; if (ftp_abort(VAR_0) < 0) { s->position = pos; return AVERROR(EIO); } s->position = pos; } } if (VAR_3 <= 0 && s->position < s->filesize && !VAR_0->is_streamed) { int64_t pos = s->position; av_log(VAR_0, AV_LOG_INFO, "Reconnect to FTP server.\n"); if ((VAR_4 = ftp_abort(VAR_0)) < 0) return VAR_4; if ((VAR_4 = ftp_seek(VAR_0, pos, SEEK_SET)) < 0) { av_log(VAR_0, AV_LOG_ERROR, "Position cannot be restored.\n"); return VAR_4; } if (!VAR_5) { VAR_5 = 1; goto retry; } } return VAR_3; } av_log(VAR_0, AV_LOG_DEBUG, "FTP VAR_3 failed\n"); return AVERROR(EIO); }
[ "static int FUNC_0(URLContext *VAR_0, unsigned char *VAR_1, int VAR_2)\n{", "FTPContext *s = VAR_0->priv_data;", "int VAR_3, VAR_4, VAR_5 = 0;", "av_dlog(VAR_0, \"ftp protocol VAR_3 %d bytes\\n\", VAR_2);", "retry:\nif (s->state == DISCONNECTED) {", "if (s->position >= s->filesize)\nreturn 0;", "if ((VAR_4 = ftp_connect_data_connection(VAR_0)) < 0)\nreturn VAR_4;", "}", "if (s->state == READY) {", "if (s->position >= s->filesize)\nreturn 0;", "if ((VAR_4 = ftp_retrieve(s)) < 0)\nreturn VAR_4;", "}", "if (s->conn_data && s->state == DOWNLOADING) {", "VAR_3 = ffurl_read(s->conn_data, VAR_1, VAR_2);", "if (VAR_3 >= 0) {", "s->position += VAR_3;", "if (s->position >= s->filesize) {", "int64_t pos = s->position;", "if (ftp_abort(VAR_0) < 0) {", "s->position = pos;", "return AVERROR(EIO);", "}", "s->position = pos;", "}", "}", "if (VAR_3 <= 0 && s->position < s->filesize && !VAR_0->is_streamed) {", "int64_t pos = s->position;", "av_log(VAR_0, AV_LOG_INFO, \"Reconnect to FTP server.\\n\");", "if ((VAR_4 = ftp_abort(VAR_0)) < 0)\nreturn VAR_4;", "if ((VAR_4 = ftp_seek(VAR_0, pos, SEEK_SET)) < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"Position cannot be restored.\\n\");", "return VAR_4;", "}", "if (!VAR_5) {", "VAR_5 = 1;", "goto retry;", "}", "}", "return VAR_3;", "}", "av_log(VAR_0, AV_LOG_DEBUG, \"FTP VAR_3 failed\\n\");", "return AVERROR(EIO);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13, 15 ], [ 19, 21 ], [ 23, 25 ], [ 27 ], [ 29 ], [ 31, 33 ], [ 35, 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 75 ], [ 77 ], [ 79, 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 107 ], [ 109 ], [ 111 ] ]
14,051
sPAPROptionVector *spapr_ovec_new(void) { sPAPROptionVector *ov; ov = g_new0(sPAPROptionVector, 1); ov->bitmap = bitmap_new(OV_MAXBITS); return ov; }
true
qemu
62ef3760d4e400849fc663474227bb4668244455
sPAPROptionVector *spapr_ovec_new(void) { sPAPROptionVector *ov; ov = g_new0(sPAPROptionVector, 1); ov->bitmap = bitmap_new(OV_MAXBITS); return ov; }
{ "code": [], "line_no": [] }
sPAPROptionVector *FUNC_0(void) { sPAPROptionVector *ov; ov = g_new0(sPAPROptionVector, 1); ov->bitmap = bitmap_new(OV_MAXBITS); return ov; }
[ "sPAPROptionVector *FUNC_0(void)\n{", "sPAPROptionVector *ov;", "ov = g_new0(sPAPROptionVector, 1);", "ov->bitmap = bitmap_new(OV_MAXBITS);", "return ov;", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 16 ], [ 18 ] ]
14,052
static uint32_t vmdk_read_cid(BlockDriverState *bs, int parent) { char desc[DESC_SIZE]; uint32_t cid; const char *p_name, *cid_str; size_t cid_str_size; BDRVVmdkState *s = bs->opaque; if (bdrv_pread(bs->file, s->desc_offset, desc, DESC_SIZE) != DESC_SIZE) { return 0; } if (parent) { cid_str = "parentCID"; cid_str_size = sizeof("parentCID"); } else { cid_str = "CID"; cid_str_size = sizeof("CID"); } p_name = strstr(desc, cid_str); if (p_name != NULL) { p_name += cid_str_size; sscanf(p_name, "%x", &cid); } return cid; }
true
qemu
bac8d7b45dd855759204117e5a05452ede01bbab
static uint32_t vmdk_read_cid(BlockDriverState *bs, int parent) { char desc[DESC_SIZE]; uint32_t cid; const char *p_name, *cid_str; size_t cid_str_size; BDRVVmdkState *s = bs->opaque; if (bdrv_pread(bs->file, s->desc_offset, desc, DESC_SIZE) != DESC_SIZE) { return 0; } if (parent) { cid_str = "parentCID"; cid_str_size = sizeof("parentCID"); } else { cid_str = "CID"; cid_str_size = sizeof("CID"); } p_name = strstr(desc, cid_str); if (p_name != NULL) { p_name += cid_str_size; sscanf(p_name, "%x", &cid); } return cid; }
{ "code": [ " uint32_t cid;" ], "line_no": [ 7 ] }
static uint32_t FUNC_0(BlockDriverState *bs, int parent) { char VAR_0[DESC_SIZE]; uint32_t cid; const char *VAR_1, *VAR_2; size_t cid_str_size; BDRVVmdkState *s = bs->opaque; if (bdrv_pread(bs->file, s->desc_offset, VAR_0, DESC_SIZE) != DESC_SIZE) { return 0; } if (parent) { VAR_2 = "parentCID"; cid_str_size = sizeof("parentCID"); } else { VAR_2 = "CID"; cid_str_size = sizeof("CID"); } VAR_1 = strstr(VAR_0, VAR_2); if (VAR_1 != NULL) { VAR_1 += cid_str_size; sscanf(VAR_1, "%x", &cid); } return cid; }
[ "static uint32_t FUNC_0(BlockDriverState *bs, int parent)\n{", "char VAR_0[DESC_SIZE];", "uint32_t cid;", "const char *VAR_1, *VAR_2;", "size_t cid_str_size;", "BDRVVmdkState *s = bs->opaque;", "if (bdrv_pread(bs->file, s->desc_offset, VAR_0, DESC_SIZE) != DESC_SIZE) {", "return 0;", "}", "if (parent) {", "VAR_2 = \"parentCID\";", "cid_str_size = sizeof(\"parentCID\");", "} else {", "VAR_2 = \"CID\";", "cid_str_size = sizeof(\"CID\");", "}", "VAR_1 = strstr(VAR_0, VAR_2);", "if (VAR_1 != NULL) {", "VAR_1 += cid_str_size;", "sscanf(VAR_1, \"%x\", &cid);", "}", "return cid;", "}" ]
[ 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 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ] ]
14,053
QemuOpts *qemu_opts_find(QemuOptsList *list, const char *id) { QemuOpts *opts; QTAILQ_FOREACH(opts, &list->head, next) { if (!opts->id) { if (!id) { return opts; } continue; } if (strcmp(opts->id, id) != 0) { continue; } return opts; } return NULL; }
true
qemu
96bc97ebf350ec480b69082819cedb8850f46a0f
QemuOpts *qemu_opts_find(QemuOptsList *list, const char *id) { QemuOpts *opts; QTAILQ_FOREACH(opts, &list->head, next) { if (!opts->id) { if (!id) { return opts; } continue; } if (strcmp(opts->id, id) != 0) { continue; } return opts; } return NULL; }
{ "code": [ " if (!opts->id) {", " if (!id) {", " return opts;", " continue;", " if (strcmp(opts->id, id) != 0) {", " continue;", " return opts;" ], "line_no": [ 11, 13, 15, 19, 23, 19, 29 ] }
QemuOpts *FUNC_0(QemuOptsList *list, const char *id) { QemuOpts *opts; QTAILQ_FOREACH(opts, &list->head, next) { if (!opts->id) { if (!id) { return opts; } continue; } if (strcmp(opts->id, id) != 0) { continue; } return opts; } return NULL; }
[ "QemuOpts *FUNC_0(QemuOptsList *list, const char *id)\n{", "QemuOpts *opts;", "QTAILQ_FOREACH(opts, &list->head, next) {", "if (!opts->id) {", "if (!id) {", "return opts;", "}", "continue;", "}", "if (strcmp(opts->id, id) != 0) {", "continue;", "}", "return opts;", "}", "return NULL;", "}" ]
[ 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ] ]
14,054
static void do_video_out(AVFormatContext *s, OutputStream *ost, AVFrame *in_picture, float quality) { int ret, format_video_sync; AVPacket pkt; AVCodecContext *enc = ost->st->codec; int nb_frames; double sync_ipts, delta; double duration = 0; int frame_size = 0; InputStream *ist = NULL; if (ost->source_index >= 0) ist = input_streams[ost->source_index]; if(ist && ist->st->start_time != AV_NOPTS_VALUE && ist->st->first_dts != AV_NOPTS_VALUE && ost->frame_rate.num) duration = 1/(av_q2d(ost->frame_rate) * av_q2d(enc->time_base)); sync_ipts = in_picture->pts; delta = sync_ipts - ost->sync_opts + duration; /* by default, we output a single frame */ nb_frames = 1; format_video_sync = video_sync_method; if (format_video_sync == VSYNC_AUTO) format_video_sync = (s->oformat->flags & AVFMT_VARIABLE_FPS) ? ((s->oformat->flags & AVFMT_NOTIMESTAMPS) ? VSYNC_PASSTHROUGH : VSYNC_VFR) : 1; switch (format_video_sync) { case VSYNC_CFR: // FIXME set to 0.5 after we fix some dts/pts bugs like in avidec.c if (delta < -1.1) nb_frames = 0; else if (delta > 1.1) nb_frames = lrintf(delta); break; case VSYNC_VFR: if (delta <= -0.6) nb_frames = 0; else if (delta > 0.6) ost->sync_opts = lrint(sync_ipts); break; case VSYNC_DROP: case VSYNC_PASSTHROUGH: ost->sync_opts = lrint(sync_ipts); break; default: av_assert0(0); nb_frames = FFMIN(nb_frames, ost->max_frames - ost->frame_number); if (nb_frames == 0) { av_log(NULL, AV_LOG_VERBOSE, "*** drop!\n"); } else if (nb_frames > 1) { nb_frames_dup += nb_frames - 1; av_log(NULL, AV_LOG_VERBOSE, "*** %d dup!\n", nb_frames - 1); duplicate_frame: av_init_packet(&pkt); pkt.data = NULL; pkt.size = 0; in_picture->pts = ost->sync_opts; if (s->oformat->flags & AVFMT_RAWPICTURE && enc->codec->id == CODEC_ID_RAWVIDEO) { /* raw pictures are written as AVPicture structure to avoid any copies. We support temporarily the older method. */ enc->coded_frame->interlaced_frame = in_picture->interlaced_frame; enc->coded_frame->top_field_first = in_picture->top_field_first; pkt.data = (uint8_t *)in_picture; pkt.size = sizeof(AVPicture); pkt.pts = av_rescale_q(in_picture->pts, enc->time_base, ost->st->time_base); pkt.flags |= AV_PKT_FLAG_KEY; write_frame(s, &pkt, ost); video_size += pkt.size; } else { int got_packet; AVFrame big_picture; big_picture = *in_picture; /* better than nothing: use input picture interlaced settings */ big_picture.interlaced_frame = in_picture->interlaced_frame; if (ost->st->codec->flags & (CODEC_FLAG_INTERLACED_DCT|CODEC_FLAG_INTERLACED_ME)) { if (ost->top_field_first == -1) big_picture.top_field_first = in_picture->top_field_first; else big_picture.top_field_first = !!ost->top_field_first; /* handles same_quant here. This is not correct because it may not be a global option */ big_picture.quality = quality; if (!enc->me_threshold) big_picture.pict_type = 0; if (ost->forced_kf_index < ost->forced_kf_count && big_picture.pts >= ost->forced_kf_pts[ost->forced_kf_index]) { big_picture.pict_type = AV_PICTURE_TYPE_I; ost->forced_kf_index++; update_benchmark(NULL); ret = avcodec_encode_video2(enc, &pkt, &big_picture, &got_packet); update_benchmark("encode_video %d.%d", ost->file_index, ost->index); if (ret < 0) { av_log(NULL, AV_LOG_FATAL, "Video encoding failed\n"); exit_program(1); if (got_packet) { if (pkt.pts == AV_NOPTS_VALUE && !(enc->codec->capabilities & CODEC_CAP_DELAY)) pkt.pts = ost->sync_opts; if (pkt.pts != AV_NOPTS_VALUE) pkt.pts = av_rescale_q(pkt.pts, enc->time_base, ost->st->time_base); if (pkt.dts != AV_NOPTS_VALUE) pkt.dts = av_rescale_q(pkt.dts, enc->time_base, ost->st->time_base); if (debug_ts) { av_log(NULL, AV_LOG_INFO, "encoder -> type:video " "pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s\n", av_ts2str(pkt.pts), av_ts2timestr(pkt.pts, &ost->st->time_base), av_ts2str(pkt.dts), av_ts2timestr(pkt.dts, &ost->st->time_base)); write_frame(s, &pkt, ost); frame_size = pkt.size; video_size += pkt.size; av_free_packet(&pkt); /* if two pass, output log */ if (ost->logfile && enc->stats_out) { fprintf(ost->logfile, "%s", enc->stats_out); ost->sync_opts++; /* * For video, number of frames in == number of packets out. * But there may be reordering, so we can't throw away frames on encoder * flush, we need to limit them here, before they go into encoder. */ ost->frame_number++; if(--nb_frames) goto duplicate_frame; if (vstats_filename && frame_size) do_video_stats(output_files[ost->file_index]->ctx, ost, frame_size);
true
FFmpeg
df3a96c497c0db51c917e51e5e4a60986979db91
static void do_video_out(AVFormatContext *s, OutputStream *ost, AVFrame *in_picture, float quality) { int ret, format_video_sync; AVPacket pkt; AVCodecContext *enc = ost->st->codec; int nb_frames; double sync_ipts, delta; double duration = 0; int frame_size = 0; InputStream *ist = NULL; if (ost->source_index >= 0) ist = input_streams[ost->source_index]; if(ist && ist->st->start_time != AV_NOPTS_VALUE && ist->st->first_dts != AV_NOPTS_VALUE && ost->frame_rate.num) duration = 1/(av_q2d(ost->frame_rate) * av_q2d(enc->time_base)); sync_ipts = in_picture->pts; delta = sync_ipts - ost->sync_opts + duration; nb_frames = 1; format_video_sync = video_sync_method; if (format_video_sync == VSYNC_AUTO) format_video_sync = (s->oformat->flags & AVFMT_VARIABLE_FPS) ? ((s->oformat->flags & AVFMT_NOTIMESTAMPS) ? VSYNC_PASSTHROUGH : VSYNC_VFR) : 1; switch (format_video_sync) { case VSYNC_CFR: if (delta < -1.1) nb_frames = 0; else if (delta > 1.1) nb_frames = lrintf(delta); break; case VSYNC_VFR: if (delta <= -0.6) nb_frames = 0; else if (delta > 0.6) ost->sync_opts = lrint(sync_ipts); break; case VSYNC_DROP: case VSYNC_PASSTHROUGH: ost->sync_opts = lrint(sync_ipts); break; default: av_assert0(0); nb_frames = FFMIN(nb_frames, ost->max_frames - ost->frame_number); if (nb_frames == 0) { av_log(NULL, AV_LOG_VERBOSE, "*** drop!\n"); } else if (nb_frames > 1) { nb_frames_dup += nb_frames - 1; av_log(NULL, AV_LOG_VERBOSE, "*** %d dup!\n", nb_frames - 1); duplicate_frame: av_init_packet(&pkt); pkt.data = NULL; pkt.size = 0; in_picture->pts = ost->sync_opts; if (s->oformat->flags & AVFMT_RAWPICTURE && enc->codec->id == CODEC_ID_RAWVIDEO) { enc->coded_frame->interlaced_frame = in_picture->interlaced_frame; enc->coded_frame->top_field_first = in_picture->top_field_first; pkt.data = (uint8_t *)in_picture; pkt.size = sizeof(AVPicture); pkt.pts = av_rescale_q(in_picture->pts, enc->time_base, ost->st->time_base); pkt.flags |= AV_PKT_FLAG_KEY; write_frame(s, &pkt, ost); video_size += pkt.size; } else { int got_packet; AVFrame big_picture; big_picture = *in_picture; big_picture.interlaced_frame = in_picture->interlaced_frame; if (ost->st->codec->flags & (CODEC_FLAG_INTERLACED_DCT|CODEC_FLAG_INTERLACED_ME)) { if (ost->top_field_first == -1) big_picture.top_field_first = in_picture->top_field_first; else big_picture.top_field_first = !!ost->top_field_first; big_picture.quality = quality; if (!enc->me_threshold) big_picture.pict_type = 0; if (ost->forced_kf_index < ost->forced_kf_count && big_picture.pts >= ost->forced_kf_pts[ost->forced_kf_index]) { big_picture.pict_type = AV_PICTURE_TYPE_I; ost->forced_kf_index++; update_benchmark(NULL); ret = avcodec_encode_video2(enc, &pkt, &big_picture, &got_packet); update_benchmark("encode_video %d.%d", ost->file_index, ost->index); if (ret < 0) { av_log(NULL, AV_LOG_FATAL, "Video encoding failed\n"); exit_program(1); if (got_packet) { if (pkt.pts == AV_NOPTS_VALUE && !(enc->codec->capabilities & CODEC_CAP_DELAY)) pkt.pts = ost->sync_opts; if (pkt.pts != AV_NOPTS_VALUE) pkt.pts = av_rescale_q(pkt.pts, enc->time_base, ost->st->time_base); if (pkt.dts != AV_NOPTS_VALUE) pkt.dts = av_rescale_q(pkt.dts, enc->time_base, ost->st->time_base); if (debug_ts) { av_log(NULL, AV_LOG_INFO, "encoder -> type:video " "pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s\n", av_ts2str(pkt.pts), av_ts2timestr(pkt.pts, &ost->st->time_base), av_ts2str(pkt.dts), av_ts2timestr(pkt.dts, &ost->st->time_base)); write_frame(s, &pkt, ost); frame_size = pkt.size; video_size += pkt.size; av_free_packet(&pkt); if (ost->logfile && enc->stats_out) { fprintf(ost->logfile, "%s", enc->stats_out); ost->sync_opts++; ost->frame_number++; if(--nb_frames) goto duplicate_frame; if (vstats_filename && frame_size) do_video_stats(output_files[ost->file_index]->ctx, ost, frame_size);
{ "code": [], "line_no": [] }
static void FUNC_0(AVFormatContext *VAR_0, OutputStream *VAR_1, AVFrame *VAR_2, float VAR_3) { int VAR_4, VAR_5; AVPacket pkt; AVCodecContext *enc = VAR_1->st->codec; int VAR_6; double VAR_7, VAR_8; double VAR_9 = 0; int VAR_10 = 0; InputStream *ist = NULL; if (VAR_1->source_index >= 0) ist = input_streams[VAR_1->source_index]; if(ist && ist->st->start_time != AV_NOPTS_VALUE && ist->st->first_dts != AV_NOPTS_VALUE && VAR_1->frame_rate.num) VAR_9 = 1/(av_q2d(VAR_1->frame_rate) * av_q2d(enc->time_base)); VAR_7 = VAR_2->pts; VAR_8 = VAR_7 - VAR_1->sync_opts + VAR_9; VAR_6 = 1; VAR_5 = video_sync_method; if (VAR_5 == VSYNC_AUTO) VAR_5 = (VAR_0->oformat->flags & AVFMT_VARIABLE_FPS) ? ((VAR_0->oformat->flags & AVFMT_NOTIMESTAMPS) ? VSYNC_PASSTHROUGH : VSYNC_VFR) : 1; switch (VAR_5) { case VSYNC_CFR: if (VAR_8 < -1.1) VAR_6 = 0; else if (VAR_8 > 1.1) VAR_6 = lrintf(VAR_8); break; case VSYNC_VFR: if (VAR_8 <= -0.6) VAR_6 = 0; else if (VAR_8 > 0.6) VAR_1->sync_opts = lrint(VAR_7); break; case VSYNC_DROP: case VSYNC_PASSTHROUGH: VAR_1->sync_opts = lrint(VAR_7); break; default: av_assert0(0); VAR_6 = FFMIN(VAR_6, VAR_1->max_frames - VAR_1->frame_number); if (VAR_6 == 0) { av_log(NULL, AV_LOG_VERBOSE, "*** drop!\n"); } else if (VAR_6 > 1) { nb_frames_dup += VAR_6 - 1; av_log(NULL, AV_LOG_VERBOSE, "*** %d dup!\n", VAR_6 - 1); duplicate_frame: av_init_packet(&pkt); pkt.data = NULL; pkt.size = 0; VAR_2->pts = VAR_1->sync_opts; if (VAR_0->oformat->flags & AVFMT_RAWPICTURE && enc->codec->id == CODEC_ID_RAWVIDEO) { enc->coded_frame->interlaced_frame = VAR_2->interlaced_frame; enc->coded_frame->top_field_first = VAR_2->top_field_first; pkt.data = (uint8_t *)VAR_2; pkt.size = sizeof(AVPicture); pkt.pts = av_rescale_q(VAR_2->pts, enc->time_base, VAR_1->st->time_base); pkt.flags |= AV_PKT_FLAG_KEY; write_frame(VAR_0, &pkt, VAR_1); video_size += pkt.size; } else { int VAR_11; AVFrame big_picture; big_picture = *VAR_2; big_picture.interlaced_frame = VAR_2->interlaced_frame; if (VAR_1->st->codec->flags & (CODEC_FLAG_INTERLACED_DCT|CODEC_FLAG_INTERLACED_ME)) { if (VAR_1->top_field_first == -1) big_picture.top_field_first = VAR_2->top_field_first; else big_picture.top_field_first = !!VAR_1->top_field_first; big_picture.VAR_3 = VAR_3; if (!enc->me_threshold) big_picture.pict_type = 0; if (VAR_1->forced_kf_index < VAR_1->forced_kf_count && big_picture.pts >= VAR_1->forced_kf_pts[VAR_1->forced_kf_index]) { big_picture.pict_type = AV_PICTURE_TYPE_I; VAR_1->forced_kf_index++; update_benchmark(NULL); VAR_4 = avcodec_encode_video2(enc, &pkt, &big_picture, &VAR_11); update_benchmark("encode_video %d.%d", VAR_1->file_index, VAR_1->index); if (VAR_4 < 0) { av_log(NULL, AV_LOG_FATAL, "Video encoding failed\n"); exit_program(1); if (VAR_11) { if (pkt.pts == AV_NOPTS_VALUE && !(enc->codec->capabilities & CODEC_CAP_DELAY)) pkt.pts = VAR_1->sync_opts; if (pkt.pts != AV_NOPTS_VALUE) pkt.pts = av_rescale_q(pkt.pts, enc->time_base, VAR_1->st->time_base); if (pkt.dts != AV_NOPTS_VALUE) pkt.dts = av_rescale_q(pkt.dts, enc->time_base, VAR_1->st->time_base); if (debug_ts) { av_log(NULL, AV_LOG_INFO, "encoder -> type:video " "pkt_pts:%VAR_0 pkt_pts_time:%VAR_0 pkt_dts:%VAR_0 pkt_dts_time:%VAR_0\n", av_ts2str(pkt.pts), av_ts2timestr(pkt.pts, &VAR_1->st->time_base), av_ts2str(pkt.dts), av_ts2timestr(pkt.dts, &VAR_1->st->time_base)); write_frame(VAR_0, &pkt, VAR_1); VAR_10 = pkt.size; video_size += pkt.size; av_free_packet(&pkt); if (VAR_1->logfile && enc->stats_out) { fprintf(VAR_1->logfile, "%VAR_0", enc->stats_out); VAR_1->sync_opts++; VAR_1->frame_number++; if(--VAR_6) goto duplicate_frame; if (vstats_filename && VAR_10) do_video_stats(output_files[VAR_1->file_index]->ctx, VAR_1, VAR_10);
[ "static void FUNC_0(AVFormatContext *VAR_0,\nOutputStream *VAR_1,\nAVFrame *VAR_2,\nfloat VAR_3)\n{", "int VAR_4, VAR_5;", "AVPacket pkt;", "AVCodecContext *enc = VAR_1->st->codec;", "int VAR_6;", "double VAR_7, VAR_8;", "double VAR_9 = 0;", "int VAR_10 = 0;", "InputStream *ist = NULL;", "if (VAR_1->source_index >= 0)\nist = input_streams[VAR_1->source_index];", "if(ist && ist->st->start_time != AV_NOPTS_VALUE && ist->st->first_dts != AV_NOPTS_VALUE && VAR_1->frame_rate.num)\nVAR_9 = 1/(av_q2d(VAR_1->frame_rate) * av_q2d(enc->time_base));", "VAR_7 = VAR_2->pts;", "VAR_8 = VAR_7 - VAR_1->sync_opts + VAR_9;", "VAR_6 = 1;", "VAR_5 = video_sync_method;", "if (VAR_5 == VSYNC_AUTO)\nVAR_5 = (VAR_0->oformat->flags & AVFMT_VARIABLE_FPS) ? ((VAR_0->oformat->flags & AVFMT_NOTIMESTAMPS) ? VSYNC_PASSTHROUGH : VSYNC_VFR) : 1;", "switch (VAR_5) {", "case VSYNC_CFR:\nif (VAR_8 < -1.1)\nVAR_6 = 0;", "else if (VAR_8 > 1.1)\nVAR_6 = lrintf(VAR_8);", "break;", "case VSYNC_VFR:\nif (VAR_8 <= -0.6)\nVAR_6 = 0;", "else if (VAR_8 > 0.6)\nVAR_1->sync_opts = lrint(VAR_7);", "break;", "case VSYNC_DROP:\ncase VSYNC_PASSTHROUGH:\nVAR_1->sync_opts = lrint(VAR_7);", "break;", "default:\nav_assert0(0);", "VAR_6 = FFMIN(VAR_6, VAR_1->max_frames - VAR_1->frame_number);", "if (VAR_6 == 0) {", "av_log(NULL, AV_LOG_VERBOSE, \"*** drop!\\n\");", "} else if (VAR_6 > 1) {", "nb_frames_dup += VAR_6 - 1;", "av_log(NULL, AV_LOG_VERBOSE, \"*** %d dup!\\n\", VAR_6 - 1);", "duplicate_frame:\nav_init_packet(&pkt);", "pkt.data = NULL;", "pkt.size = 0;", "VAR_2->pts = VAR_1->sync_opts;", "if (VAR_0->oformat->flags & AVFMT_RAWPICTURE &&\nenc->codec->id == CODEC_ID_RAWVIDEO) {", "enc->coded_frame->interlaced_frame = VAR_2->interlaced_frame;", "enc->coded_frame->top_field_first = VAR_2->top_field_first;", "pkt.data = (uint8_t *)VAR_2;", "pkt.size = sizeof(AVPicture);", "pkt.pts = av_rescale_q(VAR_2->pts, enc->time_base, VAR_1->st->time_base);", "pkt.flags |= AV_PKT_FLAG_KEY;", "write_frame(VAR_0, &pkt, VAR_1);", "video_size += pkt.size;", "} else {", "int VAR_11;", "AVFrame big_picture;", "big_picture = *VAR_2;", "big_picture.interlaced_frame = VAR_2->interlaced_frame;", "if (VAR_1->st->codec->flags & (CODEC_FLAG_INTERLACED_DCT|CODEC_FLAG_INTERLACED_ME)) {", "if (VAR_1->top_field_first == -1)\nbig_picture.top_field_first = VAR_2->top_field_first;", "else\nbig_picture.top_field_first = !!VAR_1->top_field_first;", "big_picture.VAR_3 = VAR_3;", "if (!enc->me_threshold)\nbig_picture.pict_type = 0;", "if (VAR_1->forced_kf_index < VAR_1->forced_kf_count &&\nbig_picture.pts >= VAR_1->forced_kf_pts[VAR_1->forced_kf_index]) {", "big_picture.pict_type = AV_PICTURE_TYPE_I;", "VAR_1->forced_kf_index++;", "update_benchmark(NULL);", "VAR_4 = avcodec_encode_video2(enc, &pkt, &big_picture, &VAR_11);", "update_benchmark(\"encode_video %d.%d\", VAR_1->file_index, VAR_1->index);", "if (VAR_4 < 0) {", "av_log(NULL, AV_LOG_FATAL, \"Video encoding failed\\n\");", "exit_program(1);", "if (VAR_11) {", "if (pkt.pts == AV_NOPTS_VALUE && !(enc->codec->capabilities & CODEC_CAP_DELAY))\npkt.pts = VAR_1->sync_opts;", "if (pkt.pts != AV_NOPTS_VALUE)\npkt.pts = av_rescale_q(pkt.pts, enc->time_base, VAR_1->st->time_base);", "if (pkt.dts != AV_NOPTS_VALUE)\npkt.dts = av_rescale_q(pkt.dts, enc->time_base, VAR_1->st->time_base);", "if (debug_ts) {", "av_log(NULL, AV_LOG_INFO, \"encoder -> type:video \"\n\"pkt_pts:%VAR_0 pkt_pts_time:%VAR_0 pkt_dts:%VAR_0 pkt_dts_time:%VAR_0\\n\",\nav_ts2str(pkt.pts), av_ts2timestr(pkt.pts, &VAR_1->st->time_base),\nav_ts2str(pkt.dts), av_ts2timestr(pkt.dts, &VAR_1->st->time_base));", "write_frame(VAR_0, &pkt, VAR_1);", "VAR_10 = pkt.size;", "video_size += pkt.size;", "av_free_packet(&pkt);", "if (VAR_1->logfile && enc->stats_out) {", "fprintf(VAR_1->logfile, \"%VAR_0\", enc->stats_out);", "VAR_1->sync_opts++;", "VAR_1->frame_number++;", "if(--VAR_6)\ngoto duplicate_frame;", "if (vstats_filename && VAR_10)\ndo_video_stats(output_files[VAR_1->file_index]->ctx, VAR_1, VAR_10);" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29, 31 ], [ 35, 37 ], [ 41 ], [ 43 ], [ 49 ], [ 53 ], [ 55, 57 ], [ 61 ], [ 63, 67, 69 ], [ 71, 73 ], [ 75 ], [ 77, 79, 81 ], [ 83, 85 ], [ 87 ], [ 89, 91, 93 ], [ 95 ], [ 97, 99 ], [ 104 ], [ 106 ], [ 109 ], [ 112 ], [ 119 ], [ 121 ], [ 128, 130 ], [ 132 ], [ 134 ], [ 138 ], [ 142, 144 ], [ 152 ], [ 154 ], [ 156 ], [ 158 ], [ 160 ], [ 162 ], [ 166 ], [ 168 ], [ 170 ], [ 172 ], [ 174 ], [ 178 ], [ 184 ], [ 186 ], [ 188, 190 ], [ 192, 194 ], [ 203 ], [ 205, 207 ], [ 209, 211 ], [ 213 ], [ 215 ], [ 218 ], [ 220 ], [ 222 ], [ 224 ], [ 226 ], [ 228 ], [ 233 ], [ 235, 237 ], [ 241, 243 ], [ 245, 247 ], [ 251 ], [ 253, 255, 257, 259 ], [ 264 ], [ 266 ], [ 268 ], [ 270 ], [ 276 ], [ 278 ], [ 283 ], [ 295 ], [ 299, 301 ], [ 305, 307 ] ]
14,055
static av_cold int read_specific_config(ALSDecContext *ctx) { GetBitContext gb; uint64_t ht_size; int i, config_offset; MPEG4AudioConfig m4ac; ALSSpecificConfig *sconf = &ctx->sconf; AVCodecContext *avctx = ctx->avctx; uint32_t als_id, header_size, trailer_size; init_get_bits(&gb, avctx->extradata, avctx->extradata_size * 8); config_offset = avpriv_mpeg4audio_get_config(&m4ac, avctx->extradata, avctx->extradata_size * 8, 1); if (config_offset < 0) return -1; skip_bits_long(&gb, config_offset); if (get_bits_left(&gb) < (30 << 3)) return -1; // read the fixed items als_id = get_bits_long(&gb, 32); avctx->sample_rate = m4ac.sample_rate; skip_bits_long(&gb, 32); // sample rate already known sconf->samples = get_bits_long(&gb, 32); avctx->channels = m4ac.channels; skip_bits(&gb, 16); // number of channels already known skip_bits(&gb, 3); // skip file_type sconf->resolution = get_bits(&gb, 3); sconf->floating = get_bits1(&gb); sconf->msb_first = get_bits1(&gb); sconf->frame_length = get_bits(&gb, 16) + 1; sconf->ra_distance = get_bits(&gb, 8); sconf->ra_flag = get_bits(&gb, 2); sconf->adapt_order = get_bits1(&gb); sconf->coef_table = get_bits(&gb, 2); sconf->long_term_prediction = get_bits1(&gb); sconf->max_order = get_bits(&gb, 10); sconf->block_switching = get_bits(&gb, 2); sconf->bgmc = get_bits1(&gb); sconf->sb_part = get_bits1(&gb); sconf->joint_stereo = get_bits1(&gb); sconf->mc_coding = get_bits1(&gb); sconf->chan_config = get_bits1(&gb); sconf->chan_sort = get_bits1(&gb); sconf->crc_enabled = get_bits1(&gb); sconf->rlslms = get_bits1(&gb); skip_bits(&gb, 5); // skip 5 reserved bits skip_bits1(&gb); // skip aux_data_enabled // check for ALSSpecificConfig struct if (als_id != MKBETAG('A','L','S','\0')) return -1; ctx->cur_frame_length = sconf->frame_length; // read channel config if (sconf->chan_config) sconf->chan_config_info = get_bits(&gb, 16); // TODO: use this to set avctx->channel_layout // read channel sorting if (sconf->chan_sort && avctx->channels > 1) { int chan_pos_bits = av_ceil_log2(avctx->channels); int bits_needed = avctx->channels * chan_pos_bits + 7; if (get_bits_left(&gb) < bits_needed) return -1; if (!(sconf->chan_pos = av_malloc(avctx->channels * sizeof(*sconf->chan_pos)))) return AVERROR(ENOMEM); ctx->cs_switch = 1; for (i = 0; i < avctx->channels; i++) { int idx; idx = get_bits(&gb, chan_pos_bits); if (idx >= avctx->channels) { av_log(avctx, AV_LOG_WARNING, "Invalid channel reordering.\n"); ctx->cs_switch = 0; break; } sconf->chan_pos[idx] = i; } align_get_bits(&gb); } // read fixed header and trailer sizes, // if size = 0xFFFFFFFF then there is no data field! if (get_bits_left(&gb) < 64) return -1; header_size = get_bits_long(&gb, 32); trailer_size = get_bits_long(&gb, 32); if (header_size == 0xFFFFFFFF) header_size = 0; if (trailer_size == 0xFFFFFFFF) trailer_size = 0; ht_size = ((int64_t)(header_size) + (int64_t)(trailer_size)) << 3; // skip the header and trailer data if (get_bits_left(&gb) < ht_size) return -1; if (ht_size > INT32_MAX) return -1; skip_bits_long(&gb, ht_size); // initialize CRC calculation if (sconf->crc_enabled) { if (get_bits_left(&gb) < 32) return -1; if (avctx->err_recognition & (AV_EF_CRCCHECK|AV_EF_CAREFUL)) { ctx->crc_table = av_crc_get_table(AV_CRC_32_IEEE_LE); ctx->crc = 0xFFFFFFFF; ctx->crc_org = ~get_bits_long(&gb, 32); } else skip_bits_long(&gb, 32); } // no need to read the rest of ALSSpecificConfig (ra_unit_size & aux data) dprint_specific_config(ctx); return 0; }
true
FFmpeg
4484c722f68e6a54b8bd701d391897bc092b4404
static av_cold int read_specific_config(ALSDecContext *ctx) { GetBitContext gb; uint64_t ht_size; int i, config_offset; MPEG4AudioConfig m4ac; ALSSpecificConfig *sconf = &ctx->sconf; AVCodecContext *avctx = ctx->avctx; uint32_t als_id, header_size, trailer_size; init_get_bits(&gb, avctx->extradata, avctx->extradata_size * 8); config_offset = avpriv_mpeg4audio_get_config(&m4ac, avctx->extradata, avctx->extradata_size * 8, 1); if (config_offset < 0) return -1; skip_bits_long(&gb, config_offset); if (get_bits_left(&gb) < (30 << 3)) return -1; als_id = get_bits_long(&gb, 32); avctx->sample_rate = m4ac.sample_rate; skip_bits_long(&gb, 32); sconf->samples = get_bits_long(&gb, 32); avctx->channels = m4ac.channels; skip_bits(&gb, 16); skip_bits(&gb, 3); sconf->resolution = get_bits(&gb, 3); sconf->floating = get_bits1(&gb); sconf->msb_first = get_bits1(&gb); sconf->frame_length = get_bits(&gb, 16) + 1; sconf->ra_distance = get_bits(&gb, 8); sconf->ra_flag = get_bits(&gb, 2); sconf->adapt_order = get_bits1(&gb); sconf->coef_table = get_bits(&gb, 2); sconf->long_term_prediction = get_bits1(&gb); sconf->max_order = get_bits(&gb, 10); sconf->block_switching = get_bits(&gb, 2); sconf->bgmc = get_bits1(&gb); sconf->sb_part = get_bits1(&gb); sconf->joint_stereo = get_bits1(&gb); sconf->mc_coding = get_bits1(&gb); sconf->chan_config = get_bits1(&gb); sconf->chan_sort = get_bits1(&gb); sconf->crc_enabled = get_bits1(&gb); sconf->rlslms = get_bits1(&gb); skip_bits(&gb, 5); skip_bits1(&gb); if (als_id != MKBETAG('A','L','S','\0')) return -1; ctx->cur_frame_length = sconf->frame_length; if (sconf->chan_config) sconf->chan_config_info = get_bits(&gb, 16); if (sconf->chan_sort && avctx->channels > 1) { int chan_pos_bits = av_ceil_log2(avctx->channels); int bits_needed = avctx->channels * chan_pos_bits + 7; if (get_bits_left(&gb) < bits_needed) return -1; if (!(sconf->chan_pos = av_malloc(avctx->channels * sizeof(*sconf->chan_pos)))) return AVERROR(ENOMEM); ctx->cs_switch = 1; for (i = 0; i < avctx->channels; i++) { int idx; idx = get_bits(&gb, chan_pos_bits); if (idx >= avctx->channels) { av_log(avctx, AV_LOG_WARNING, "Invalid channel reordering.\n"); ctx->cs_switch = 0; break; } sconf->chan_pos[idx] = i; } align_get_bits(&gb); } if (get_bits_left(&gb) < 64) return -1; header_size = get_bits_long(&gb, 32); trailer_size = get_bits_long(&gb, 32); if (header_size == 0xFFFFFFFF) header_size = 0; if (trailer_size == 0xFFFFFFFF) trailer_size = 0; ht_size = ((int64_t)(header_size) + (int64_t)(trailer_size)) << 3; if (get_bits_left(&gb) < ht_size) return -1; if (ht_size > INT32_MAX) return -1; skip_bits_long(&gb, ht_size); if (sconf->crc_enabled) { if (get_bits_left(&gb) < 32) return -1; if (avctx->err_recognition & (AV_EF_CRCCHECK|AV_EF_CAREFUL)) { ctx->crc_table = av_crc_get_table(AV_CRC_32_IEEE_LE); ctx->crc = 0xFFFFFFFF; ctx->crc_org = ~get_bits_long(&gb, 32); } else skip_bits_long(&gb, 32); } dprint_specific_config(ctx); return 0; }
{ "code": [ " init_get_bits(&gb, avctx->extradata, avctx->extradata_size * 8);" ], "line_no": [ 21 ] }
static av_cold int FUNC_0(ALSDecContext *ctx) { GetBitContext gb; uint64_t ht_size; int VAR_0, VAR_1; MPEG4AudioConfig m4ac; ALSSpecificConfig *sconf = &ctx->sconf; AVCodecContext *avctx = ctx->avctx; uint32_t als_id, header_size, trailer_size; init_get_bits(&gb, avctx->extradata, avctx->extradata_size * 8); VAR_1 = avpriv_mpeg4audio_get_config(&m4ac, avctx->extradata, avctx->extradata_size * 8, 1); if (VAR_1 < 0) return -1; skip_bits_long(&gb, VAR_1); if (get_bits_left(&gb) < (30 << 3)) return -1; als_id = get_bits_long(&gb, 32); avctx->sample_rate = m4ac.sample_rate; skip_bits_long(&gb, 32); sconf->samples = get_bits_long(&gb, 32); avctx->channels = m4ac.channels; skip_bits(&gb, 16); skip_bits(&gb, 3); sconf->resolution = get_bits(&gb, 3); sconf->floating = get_bits1(&gb); sconf->msb_first = get_bits1(&gb); sconf->frame_length = get_bits(&gb, 16) + 1; sconf->ra_distance = get_bits(&gb, 8); sconf->ra_flag = get_bits(&gb, 2); sconf->adapt_order = get_bits1(&gb); sconf->coef_table = get_bits(&gb, 2); sconf->long_term_prediction = get_bits1(&gb); sconf->max_order = get_bits(&gb, 10); sconf->block_switching = get_bits(&gb, 2); sconf->bgmc = get_bits1(&gb); sconf->sb_part = get_bits1(&gb); sconf->joint_stereo = get_bits1(&gb); sconf->mc_coding = get_bits1(&gb); sconf->chan_config = get_bits1(&gb); sconf->chan_sort = get_bits1(&gb); sconf->crc_enabled = get_bits1(&gb); sconf->rlslms = get_bits1(&gb); skip_bits(&gb, 5); skip_bits1(&gb); if (als_id != MKBETAG('A','L','S','\0')) return -1; ctx->cur_frame_length = sconf->frame_length; if (sconf->chan_config) sconf->chan_config_info = get_bits(&gb, 16); if (sconf->chan_sort && avctx->channels > 1) { int VAR_2 = av_ceil_log2(avctx->channels); int VAR_3 = avctx->channels * VAR_2 + 7; if (get_bits_left(&gb) < VAR_3) return -1; if (!(sconf->chan_pos = av_malloc(avctx->channels * sizeof(*sconf->chan_pos)))) return AVERROR(ENOMEM); ctx->cs_switch = 1; for (VAR_0 = 0; VAR_0 < avctx->channels; VAR_0++) { int idx; idx = get_bits(&gb, VAR_2); if (idx >= avctx->channels) { av_log(avctx, AV_LOG_WARNING, "Invalid channel reordering.\n"); ctx->cs_switch = 0; break; } sconf->chan_pos[idx] = VAR_0; } align_get_bits(&gb); } if (get_bits_left(&gb) < 64) return -1; header_size = get_bits_long(&gb, 32); trailer_size = get_bits_long(&gb, 32); if (header_size == 0xFFFFFFFF) header_size = 0; if (trailer_size == 0xFFFFFFFF) trailer_size = 0; ht_size = ((int64_t)(header_size) + (int64_t)(trailer_size)) << 3; if (get_bits_left(&gb) < ht_size) return -1; if (ht_size > INT32_MAX) return -1; skip_bits_long(&gb, ht_size); if (sconf->crc_enabled) { if (get_bits_left(&gb) < 32) return -1; if (avctx->err_recognition & (AV_EF_CRCCHECK|AV_EF_CAREFUL)) { ctx->crc_table = av_crc_get_table(AV_CRC_32_IEEE_LE); ctx->crc = 0xFFFFFFFF; ctx->crc_org = ~get_bits_long(&gb, 32); } else skip_bits_long(&gb, 32); } dprint_specific_config(ctx); return 0; }
[ "static av_cold int FUNC_0(ALSDecContext *ctx)\n{", "GetBitContext gb;", "uint64_t ht_size;", "int VAR_0, VAR_1;", "MPEG4AudioConfig m4ac;", "ALSSpecificConfig *sconf = &ctx->sconf;", "AVCodecContext *avctx = ctx->avctx;", "uint32_t als_id, header_size, trailer_size;", "init_get_bits(&gb, avctx->extradata, avctx->extradata_size * 8);", "VAR_1 = avpriv_mpeg4audio_get_config(&m4ac, avctx->extradata,\navctx->extradata_size * 8, 1);", "if (VAR_1 < 0)\nreturn -1;", "skip_bits_long(&gb, VAR_1);", "if (get_bits_left(&gb) < (30 << 3))\nreturn -1;", "als_id = get_bits_long(&gb, 32);", "avctx->sample_rate = m4ac.sample_rate;", "skip_bits_long(&gb, 32);", "sconf->samples = get_bits_long(&gb, 32);", "avctx->channels = m4ac.channels;", "skip_bits(&gb, 16);", "skip_bits(&gb, 3);", "sconf->resolution = get_bits(&gb, 3);", "sconf->floating = get_bits1(&gb);", "sconf->msb_first = get_bits1(&gb);", "sconf->frame_length = get_bits(&gb, 16) + 1;", "sconf->ra_distance = get_bits(&gb, 8);", "sconf->ra_flag = get_bits(&gb, 2);", "sconf->adapt_order = get_bits1(&gb);", "sconf->coef_table = get_bits(&gb, 2);", "sconf->long_term_prediction = get_bits1(&gb);", "sconf->max_order = get_bits(&gb, 10);", "sconf->block_switching = get_bits(&gb, 2);", "sconf->bgmc = get_bits1(&gb);", "sconf->sb_part = get_bits1(&gb);", "sconf->joint_stereo = get_bits1(&gb);", "sconf->mc_coding = get_bits1(&gb);", "sconf->chan_config = get_bits1(&gb);", "sconf->chan_sort = get_bits1(&gb);", "sconf->crc_enabled = get_bits1(&gb);", "sconf->rlslms = get_bits1(&gb);", "skip_bits(&gb, 5);", "skip_bits1(&gb);", "if (als_id != MKBETAG('A','L','S','\\0'))\nreturn -1;", "ctx->cur_frame_length = sconf->frame_length;", "if (sconf->chan_config)\nsconf->chan_config_info = get_bits(&gb, 16);", "if (sconf->chan_sort && avctx->channels > 1) {", "int VAR_2 = av_ceil_log2(avctx->channels);", "int VAR_3 = avctx->channels * VAR_2 + 7;", "if (get_bits_left(&gb) < VAR_3)\nreturn -1;", "if (!(sconf->chan_pos = av_malloc(avctx->channels * sizeof(*sconf->chan_pos))))\nreturn AVERROR(ENOMEM);", "ctx->cs_switch = 1;", "for (VAR_0 = 0; VAR_0 < avctx->channels; VAR_0++) {", "int idx;", "idx = get_bits(&gb, VAR_2);", "if (idx >= avctx->channels) {", "av_log(avctx, AV_LOG_WARNING, \"Invalid channel reordering.\\n\");", "ctx->cs_switch = 0;", "break;", "}", "sconf->chan_pos[idx] = VAR_0;", "}", "align_get_bits(&gb);", "}", "if (get_bits_left(&gb) < 64)\nreturn -1;", "header_size = get_bits_long(&gb, 32);", "trailer_size = get_bits_long(&gb, 32);", "if (header_size == 0xFFFFFFFF)\nheader_size = 0;", "if (trailer_size == 0xFFFFFFFF)\ntrailer_size = 0;", "ht_size = ((int64_t)(header_size) + (int64_t)(trailer_size)) << 3;", "if (get_bits_left(&gb) < ht_size)\nreturn -1;", "if (ht_size > INT32_MAX)\nreturn -1;", "skip_bits_long(&gb, ht_size);", "if (sconf->crc_enabled) {", "if (get_bits_left(&gb) < 32)\nreturn -1;", "if (avctx->err_recognition & (AV_EF_CRCCHECK|AV_EF_CAREFUL)) {", "ctx->crc_table = av_crc_get_table(AV_CRC_32_IEEE_LE);", "ctx->crc = 0xFFFFFFFF;", "ctx->crc_org = ~get_bits_long(&gb, 32);", "} else", "skip_bits_long(&gb, 32);", "}", "dprint_specific_config(ctx);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 25, 27 ], [ 31, 33 ], [ 37 ], [ 41, 43 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 111, 113 ], [ 117 ], [ 123, 125 ], [ 135 ], [ 137 ], [ 139 ], [ 141, 143 ], [ 147, 149 ], [ 153 ], [ 157 ], [ 159 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 181 ], [ 183 ], [ 193, 195 ], [ 199 ], [ 201 ], [ 203, 205 ], [ 207, 209 ], [ 213 ], [ 221, 223 ], [ 227, 229 ], [ 233 ], [ 241 ], [ 243, 245 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 271 ], [ 275 ], [ 277 ] ]
14,057
static int v4l2_receive_frame(AVCodecContext *avctx, AVFrame *frame) { V4L2m2mContext *s = avctx->priv_data; V4L2Context *const capture = &s->capture; V4L2Context *const output = &s->output; AVPacket avpkt = {0}; int ret; ret = ff_decode_get_packet(avctx, &avpkt); if (ret < 0 && ret != AVERROR_EOF) return ret; if (s->draining) goto dequeue; ret = ff_v4l2_context_enqueue_packet(output, &avpkt); if (ret < 0) { if (ret != AVERROR(ENOMEM)) return ret; /* no input buffers available, continue dequeing */ } if (avpkt.size) { ret = v4l2_try_start(avctx); if (ret) return 0; } dequeue: return ff_v4l2_context_dequeue_frame(capture, frame); }
true
FFmpeg
a0c624e299730c8c5800375c2f5f3c6c200053ff
static int v4l2_receive_frame(AVCodecContext *avctx, AVFrame *frame) { V4L2m2mContext *s = avctx->priv_data; V4L2Context *const capture = &s->capture; V4L2Context *const output = &s->output; AVPacket avpkt = {0}; int ret; ret = ff_decode_get_packet(avctx, &avpkt); if (ret < 0 && ret != AVERROR_EOF) return ret; if (s->draining) goto dequeue; ret = ff_v4l2_context_enqueue_packet(output, &avpkt); if (ret < 0) { if (ret != AVERROR(ENOMEM)) return ret; } if (avpkt.size) { ret = v4l2_try_start(avctx); if (ret) return 0; } dequeue: return ff_v4l2_context_dequeue_frame(capture, frame); }
{ "code": [ " V4L2m2mContext *s = avctx->priv_data;", " V4L2m2mContext *s = avctx->priv_data;", " V4L2m2mContext *s = avctx->priv_data;", " V4L2m2mContext *s = avctx->priv_data;", " V4L2m2mContext *s = avctx->priv_data;", " V4L2m2mContext *s = avctx->priv_data;", " V4L2m2mContext *s = avctx->priv_data;" ], "line_no": [ 5, 5, 5, 5, 5, 5, 5 ] }
static int FUNC_0(AVCodecContext *VAR_0, AVFrame *VAR_1) { V4L2m2mContext *s = VAR_0->priv_data; V4L2Context *const capture = &s->capture; V4L2Context *const output = &s->output; AVPacket avpkt = {0}; int VAR_2; VAR_2 = ff_decode_get_packet(VAR_0, &avpkt); if (VAR_2 < 0 && VAR_2 != AVERROR_EOF) return VAR_2; if (s->draining) goto dequeue; VAR_2 = ff_v4l2_context_enqueue_packet(output, &avpkt); if (VAR_2 < 0) { if (VAR_2 != AVERROR(ENOMEM)) return VAR_2; } if (avpkt.size) { VAR_2 = v4l2_try_start(VAR_0); if (VAR_2) return 0; } dequeue: return ff_v4l2_context_dequeue_frame(capture, VAR_1); }
[ "static int FUNC_0(AVCodecContext *VAR_0, AVFrame *VAR_1)\n{", "V4L2m2mContext *s = VAR_0->priv_data;", "V4L2Context *const capture = &s->capture;", "V4L2Context *const output = &s->output;", "AVPacket avpkt = {0};", "int VAR_2;", "VAR_2 = ff_decode_get_packet(VAR_0, &avpkt);", "if (VAR_2 < 0 && VAR_2 != AVERROR_EOF)\nreturn VAR_2;", "if (s->draining)\ngoto dequeue;", "VAR_2 = ff_v4l2_context_enqueue_packet(output, &avpkt);", "if (VAR_2 < 0) {", "if (VAR_2 != AVERROR(ENOMEM))\nreturn VAR_2;", "}", "if (avpkt.size) {", "VAR_2 = v4l2_try_start(VAR_0);", "if (VAR_2)\nreturn 0;", "}", "dequeue:\nreturn ff_v4l2_context_dequeue_frame(capture, VAR_1);", "}" ]
[ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19, 21 ], [ 25, 27 ], [ 31 ], [ 33 ], [ 35, 37 ], [ 41 ], [ 45 ], [ 47 ], [ 49, 51 ], [ 53 ], [ 57, 59 ], [ 61 ] ]
14,058
static int jpeg2000_decode_tile(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile, AVFrame *picture) { int compno, reslevelno, bandno; int x, y; uint8_t *line; Jpeg2000T1Context t1; /* Loop on tile components */ for (compno = 0; compno < s->ncomponents; compno++) { Jpeg2000Component *comp = tile->comp + compno; Jpeg2000CodingStyle *codsty = tile->codsty + compno; /* Loop on resolution levels */ for (reslevelno = 0; reslevelno < codsty->nreslevels2decode; reslevelno++) { Jpeg2000ResLevel *rlevel = comp->reslevel + reslevelno; /* Loop on bands */ for (bandno = 0; bandno < rlevel->nbands; bandno++) { uint16_t nb_precincts, precno; Jpeg2000Band *band = rlevel->band + bandno; int cblkno = 0, bandpos; bandpos = bandno + (reslevelno > 0); if (band->coord[0][0] == band->coord[0][1] || band->coord[1][0] == band->coord[1][1]) continue; nb_precincts = rlevel->num_precincts_x * rlevel->num_precincts_y; /* Loop on precincts */ for (precno = 0; precno < nb_precincts; precno++) { Jpeg2000Prec *prec = band->prec + precno; /* Loop on codeblocks */ for (cblkno = 0; cblkno < prec->nb_codeblocks_width * prec->nb_codeblocks_height; cblkno++) { int x, y; Jpeg2000Cblk *cblk = prec->cblk + cblkno; decode_cblk(s, codsty, &t1, cblk, cblk->coord[0][1] - cblk->coord[0][0], cblk->coord[1][1] - cblk->coord[1][0], bandpos); x = cblk->coord[0][0]; y = cblk->coord[1][0]; if (codsty->transform == FF_DWT97) dequantization_float(x, y, cblk, comp, &t1, band); else dequantization_int(x, y, cblk, comp, &t1, band); } /* end cblk */ } /*end prec */ } /* end band */ } /* end reslevel */ /* inverse DWT */ ff_dwt_decode(&comp->dwt, codsty->transform == FF_DWT97 ? (void*)comp->f_data : (void*)comp->i_data); } /*end comp */ /* inverse MCT transformation */ if (tile->codsty[0].mct) mct_decode(s, tile); if (s->precision <= 8) { for (compno = 0; compno < s->ncomponents; compno++) { Jpeg2000Component *comp = tile->comp + compno; float *datap = comp->f_data; int32_t *i_datap = comp->i_data; int cbps = s->cbps[compno]; int w = tile->comp[compno].coord[0][1] - s->image_offset_x; y = tile->comp[compno].coord[1][0] - s->image_offset_y; line = picture->data[0] + y * picture->linesize[0]; for (; y < tile->comp[compno].coord[1][1] - s->image_offset_y; y += s->cdy[compno]) { uint8_t *dst; x = tile->comp[compno].coord[0][0] - s->image_offset_x; dst = line + x * s->ncomponents + compno; if (tile->codsty->transform == FF_DWT97) { for (; x < w; x += s->cdx[compno]) { int val = lrintf(*datap) + (1 << (cbps - 1)); /* DC level shift and clip see ISO 15444-1:2002 G.1.2 */ val = av_clip(val, 0, (1 << cbps) - 1); *dst = val << (8 - cbps); datap++; dst += s->ncomponents; } } else { for (; x < w; x += s->cdx[compno]) { int val = *i_datap + (1 << (cbps - 1)); /* DC level shift and clip see ISO 15444-1:2002 G.1.2 */ val = av_clip(val, 0, (1 << cbps) - 1); *dst = val << (8 - cbps); i_datap++; dst += s->ncomponents; } } line += picture->linesize[0]; } } } else { for (compno = 0; compno < s->ncomponents; compno++) { Jpeg2000Component *comp = tile->comp + compno; float *datap = comp->f_data; int32_t *i_datap = comp->i_data; uint16_t *linel; int cbps = s->cbps[compno]; int w = tile->comp[compno].coord[0][1] - s->image_offset_x; y = tile->comp[compno].coord[1][0] - s->image_offset_y; linel = (uint16_t *)picture->data[0] + y * (picture->linesize[0] >> 1); for (; y < tile->comp[compno].coord[1][1] - s->image_offset_y; y += s->cdy[compno]) { uint16_t *dst; x = tile->comp[compno].coord[0][0] - s->image_offset_x; dst = linel + (x * s->ncomponents + compno); if (tile->codsty->transform == FF_DWT97) { for (; x < w; x += s-> cdx[compno]) { int val = lrintf(*datap) + (1 << (cbps - 1)); /* DC level shift and clip see ISO 15444-1:2002 G.1.2 */ val = av_clip(val, 0, (1 << cbps) - 1); /* align 12 bit values in little-endian mode */ *dst = val << (16 - cbps); datap++; dst += s->ncomponents; } } else { for (; x < w; x += s-> cdx[compno]) { int val = *i_datap + (1 << (cbps - 1)); /* DC level shift and clip see ISO 15444-1:2002 G.1.2 */ val = av_clip(val, 0, (1 << cbps) - 1); /* align 12 bit values in little-endian mode */ *dst = val << (16 - cbps); i_datap++; dst += s->ncomponents; } } linel += picture->linesize[0] >> 1; } } } return 0; }
true
FFmpeg
95a57d26d8653d21f0dab1aff3558ee944853dbf
static int jpeg2000_decode_tile(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile, AVFrame *picture) { int compno, reslevelno, bandno; int x, y; uint8_t *line; Jpeg2000T1Context t1; for (compno = 0; compno < s->ncomponents; compno++) { Jpeg2000Component *comp = tile->comp + compno; Jpeg2000CodingStyle *codsty = tile->codsty + compno; for (reslevelno = 0; reslevelno < codsty->nreslevels2decode; reslevelno++) { Jpeg2000ResLevel *rlevel = comp->reslevel + reslevelno; for (bandno = 0; bandno < rlevel->nbands; bandno++) { uint16_t nb_precincts, precno; Jpeg2000Band *band = rlevel->band + bandno; int cblkno = 0, bandpos; bandpos = bandno + (reslevelno > 0); if (band->coord[0][0] == band->coord[0][1] || band->coord[1][0] == band->coord[1][1]) continue; nb_precincts = rlevel->num_precincts_x * rlevel->num_precincts_y; for (precno = 0; precno < nb_precincts; precno++) { Jpeg2000Prec *prec = band->prec + precno; for (cblkno = 0; cblkno < prec->nb_codeblocks_width * prec->nb_codeblocks_height; cblkno++) { int x, y; Jpeg2000Cblk *cblk = prec->cblk + cblkno; decode_cblk(s, codsty, &t1, cblk, cblk->coord[0][1] - cblk->coord[0][0], cblk->coord[1][1] - cblk->coord[1][0], bandpos); x = cblk->coord[0][0]; y = cblk->coord[1][0]; if (codsty->transform == FF_DWT97) dequantization_float(x, y, cblk, comp, &t1, band); else dequantization_int(x, y, cblk, comp, &t1, band); } } } } ff_dwt_decode(&comp->dwt, codsty->transform == FF_DWT97 ? (void*)comp->f_data : (void*)comp->i_data); } if (tile->codsty[0].mct) mct_decode(s, tile); if (s->precision <= 8) { for (compno = 0; compno < s->ncomponents; compno++) { Jpeg2000Component *comp = tile->comp + compno; float *datap = comp->f_data; int32_t *i_datap = comp->i_data; int cbps = s->cbps[compno]; int w = tile->comp[compno].coord[0][1] - s->image_offset_x; y = tile->comp[compno].coord[1][0] - s->image_offset_y; line = picture->data[0] + y * picture->linesize[0]; for (; y < tile->comp[compno].coord[1][1] - s->image_offset_y; y += s->cdy[compno]) { uint8_t *dst; x = tile->comp[compno].coord[0][0] - s->image_offset_x; dst = line + x * s->ncomponents + compno; if (tile->codsty->transform == FF_DWT97) { for (; x < w; x += s->cdx[compno]) { int val = lrintf(*datap) + (1 << (cbps - 1)); val = av_clip(val, 0, (1 << cbps) - 1); *dst = val << (8 - cbps); datap++; dst += s->ncomponents; } } else { for (; x < w; x += s->cdx[compno]) { int val = *i_datap + (1 << (cbps - 1)); val = av_clip(val, 0, (1 << cbps) - 1); *dst = val << (8 - cbps); i_datap++; dst += s->ncomponents; } } line += picture->linesize[0]; } } } else { for (compno = 0; compno < s->ncomponents; compno++) { Jpeg2000Component *comp = tile->comp + compno; float *datap = comp->f_data; int32_t *i_datap = comp->i_data; uint16_t *linel; int cbps = s->cbps[compno]; int w = tile->comp[compno].coord[0][1] - s->image_offset_x; y = tile->comp[compno].coord[1][0] - s->image_offset_y; linel = (uint16_t *)picture->data[0] + y * (picture->linesize[0] >> 1); for (; y < tile->comp[compno].coord[1][1] - s->image_offset_y; y += s->cdy[compno]) { uint16_t *dst; x = tile->comp[compno].coord[0][0] - s->image_offset_x; dst = linel + (x * s->ncomponents + compno); if (tile->codsty->transform == FF_DWT97) { for (; x < w; x += s-> cdx[compno]) { int val = lrintf(*datap) + (1 << (cbps - 1)); val = av_clip(val, 0, (1 << cbps) - 1); *dst = val << (16 - cbps); datap++; dst += s->ncomponents; } } else { for (; x < w; x += s-> cdx[compno]) { int val = *i_datap + (1 << (cbps - 1)); val = av_clip(val, 0, (1 << cbps) - 1); *dst = val << (16 - cbps); i_datap++; dst += s->ncomponents; } } linel += picture->linesize[0] >> 1; } } } return 0; }
{ "code": [ " if (tile->codsty->transform == FF_DWT97) {", " if (tile->codsty->transform == FF_DWT97) {" ], "line_no": [ 155, 155 ] }
static int FUNC_0(Jpeg2000DecoderContext *VAR_0, Jpeg2000Tile *VAR_1, AVFrame *VAR_2) { int VAR_3, VAR_4, VAR_5; int VAR_6, VAR_7; uint8_t *line; Jpeg2000T1Context t1; for (VAR_3 = 0; VAR_3 < VAR_0->ncomponents; VAR_3++) { Jpeg2000Component *comp = VAR_1->comp + VAR_3; Jpeg2000CodingStyle *codsty = VAR_1->codsty + VAR_3; for (VAR_4 = 0; VAR_4 < codsty->nreslevels2decode; VAR_4++) { Jpeg2000ResLevel *rlevel = comp->reslevel + VAR_4; for (VAR_5 = 0; VAR_5 < rlevel->nbands; VAR_5++) { uint16_t nb_precincts, precno; Jpeg2000Band *band = rlevel->band + VAR_5; int cblkno = 0, bandpos; bandpos = VAR_5 + (VAR_4 > 0); if (band->coord[0][0] == band->coord[0][1] || band->coord[1][0] == band->coord[1][1]) continue; nb_precincts = rlevel->num_precincts_x * rlevel->num_precincts_y; for (precno = 0; precno < nb_precincts; precno++) { Jpeg2000Prec *prec = band->prec + precno; for (cblkno = 0; cblkno < prec->nb_codeblocks_width * prec->nb_codeblocks_height; cblkno++) { int VAR_6, VAR_7; Jpeg2000Cblk *cblk = prec->cblk + cblkno; decode_cblk(VAR_0, codsty, &t1, cblk, cblk->coord[0][1] - cblk->coord[0][0], cblk->coord[1][1] - cblk->coord[1][0], bandpos); VAR_6 = cblk->coord[0][0]; VAR_7 = cblk->coord[1][0]; if (codsty->transform == FF_DWT97) dequantization_float(VAR_6, VAR_7, cblk, comp, &t1, band); else dequantization_int(VAR_6, VAR_7, cblk, comp, &t1, band); } } } } ff_dwt_decode(&comp->dwt, codsty->transform == FF_DWT97 ? (void*)comp->f_data : (void*)comp->i_data); } if (VAR_1->codsty[0].mct) mct_decode(VAR_0, VAR_1); if (VAR_0->precision <= 8) { for (VAR_3 = 0; VAR_3 < VAR_0->ncomponents; VAR_3++) { Jpeg2000Component *comp = VAR_1->comp + VAR_3; float *datap = comp->f_data; int32_t *i_datap = comp->i_data; int cbps = VAR_0->cbps[VAR_3]; int w = VAR_1->comp[VAR_3].coord[0][1] - VAR_0->image_offset_x; VAR_7 = VAR_1->comp[VAR_3].coord[1][0] - VAR_0->image_offset_y; line = VAR_2->data[0] + VAR_7 * VAR_2->linesize[0]; for (; VAR_7 < VAR_1->comp[VAR_3].coord[1][1] - VAR_0->image_offset_y; VAR_7 += VAR_0->cdy[VAR_3]) { uint8_t *dst; VAR_6 = VAR_1->comp[VAR_3].coord[0][0] - VAR_0->image_offset_x; dst = line + VAR_6 * VAR_0->ncomponents + VAR_3; if (VAR_1->codsty->transform == FF_DWT97) { for (; VAR_6 < w; VAR_6 += VAR_0->cdx[VAR_3]) { int val = lrintf(*datap) + (1 << (cbps - 1)); val = av_clip(val, 0, (1 << cbps) - 1); *dst = val << (8 - cbps); datap++; dst += VAR_0->ncomponents; } } else { for (; VAR_6 < w; VAR_6 += VAR_0->cdx[VAR_3]) { int val = *i_datap + (1 << (cbps - 1)); val = av_clip(val, 0, (1 << cbps) - 1); *dst = val << (8 - cbps); i_datap++; dst += VAR_0->ncomponents; } } line += VAR_2->linesize[0]; } } } else { for (VAR_3 = 0; VAR_3 < VAR_0->ncomponents; VAR_3++) { Jpeg2000Component *comp = VAR_1->comp + VAR_3; float *datap = comp->f_data; int32_t *i_datap = comp->i_data; uint16_t *linel; int cbps = VAR_0->cbps[VAR_3]; int w = VAR_1->comp[VAR_3].coord[0][1] - VAR_0->image_offset_x; VAR_7 = VAR_1->comp[VAR_3].coord[1][0] - VAR_0->image_offset_y; linel = (uint16_t *)VAR_2->data[0] + VAR_7 * (VAR_2->linesize[0] >> 1); for (; VAR_7 < VAR_1->comp[VAR_3].coord[1][1] - VAR_0->image_offset_y; VAR_7 += VAR_0->cdy[VAR_3]) { uint16_t *dst; VAR_6 = VAR_1->comp[VAR_3].coord[0][0] - VAR_0->image_offset_x; dst = linel + (VAR_6 * VAR_0->ncomponents + VAR_3); if (VAR_1->codsty->transform == FF_DWT97) { for (; VAR_6 < w; VAR_6 += VAR_0-> cdx[VAR_3]) { int val = lrintf(*datap) + (1 << (cbps - 1)); val = av_clip(val, 0, (1 << cbps) - 1); *dst = val << (16 - cbps); datap++; dst += VAR_0->ncomponents; } } else { for (; VAR_6 < w; VAR_6 += VAR_0-> cdx[VAR_3]) { int val = *i_datap + (1 << (cbps - 1)); val = av_clip(val, 0, (1 << cbps) - 1); *dst = val << (16 - cbps); i_datap++; dst += VAR_0->ncomponents; } } linel += VAR_2->linesize[0] >> 1; } } } return 0; }
[ "static int FUNC_0(Jpeg2000DecoderContext *VAR_0, Jpeg2000Tile *VAR_1,\nAVFrame *VAR_2)\n{", "int VAR_3, VAR_4, VAR_5;", "int VAR_6, VAR_7;", "uint8_t *line;", "Jpeg2000T1Context t1;", "for (VAR_3 = 0; VAR_3 < VAR_0->ncomponents; VAR_3++) {", "Jpeg2000Component *comp = VAR_1->comp + VAR_3;", "Jpeg2000CodingStyle *codsty = VAR_1->codsty + VAR_3;", "for (VAR_4 = 0; VAR_4 < codsty->nreslevels2decode; VAR_4++) {", "Jpeg2000ResLevel *rlevel = comp->reslevel + VAR_4;", "for (VAR_5 = 0; VAR_5 < rlevel->nbands; VAR_5++) {", "uint16_t nb_precincts, precno;", "Jpeg2000Band *band = rlevel->band + VAR_5;", "int cblkno = 0, bandpos;", "bandpos = VAR_5 + (VAR_4 > 0);", "if (band->coord[0][0] == band->coord[0][1] ||\nband->coord[1][0] == band->coord[1][1])\ncontinue;", "nb_precincts = rlevel->num_precincts_x * rlevel->num_precincts_y;", "for (precno = 0; precno < nb_precincts; precno++) {", "Jpeg2000Prec *prec = band->prec + precno;", "for (cblkno = 0; cblkno < prec->nb_codeblocks_width * prec->nb_codeblocks_height; cblkno++) {", "int VAR_6, VAR_7;", "Jpeg2000Cblk *cblk = prec->cblk + cblkno;", "decode_cblk(VAR_0, codsty, &t1, cblk,\ncblk->coord[0][1] - cblk->coord[0][0],\ncblk->coord[1][1] - cblk->coord[1][0],\nbandpos);", "VAR_6 = cblk->coord[0][0];", "VAR_7 = cblk->coord[1][0];", "if (codsty->transform == FF_DWT97)\ndequantization_float(VAR_6, VAR_7, cblk, comp, &t1, band);", "else\ndequantization_int(VAR_6, VAR_7, cblk, comp, &t1, band);", "}", "}", "}", "}", "ff_dwt_decode(&comp->dwt, codsty->transform == FF_DWT97 ? (void*)comp->f_data : (void*)comp->i_data);", "}", "if (VAR_1->codsty[0].mct)\nmct_decode(VAR_0, VAR_1);", "if (VAR_0->precision <= 8) {", "for (VAR_3 = 0; VAR_3 < VAR_0->ncomponents; VAR_3++) {", "Jpeg2000Component *comp = VAR_1->comp + VAR_3;", "float *datap = comp->f_data;", "int32_t *i_datap = comp->i_data;", "int cbps = VAR_0->cbps[VAR_3];", "int w = VAR_1->comp[VAR_3].coord[0][1] - VAR_0->image_offset_x;", "VAR_7 = VAR_1->comp[VAR_3].coord[1][0] - VAR_0->image_offset_y;", "line = VAR_2->data[0] + VAR_7 * VAR_2->linesize[0];", "for (; VAR_7 < VAR_1->comp[VAR_3].coord[1][1] - VAR_0->image_offset_y; VAR_7 += VAR_0->cdy[VAR_3]) {", "uint8_t *dst;", "VAR_6 = VAR_1->comp[VAR_3].coord[0][0] - VAR_0->image_offset_x;", "dst = line + VAR_6 * VAR_0->ncomponents + VAR_3;", "if (VAR_1->codsty->transform == FF_DWT97) {", "for (; VAR_6 < w; VAR_6 += VAR_0->cdx[VAR_3]) {", "int val = lrintf(*datap) + (1 << (cbps - 1));", "val = av_clip(val, 0, (1 << cbps) - 1);", "*dst = val << (8 - cbps);", "datap++;", "dst += VAR_0->ncomponents;", "}", "} else {", "for (; VAR_6 < w; VAR_6 += VAR_0->cdx[VAR_3]) {", "int val = *i_datap + (1 << (cbps - 1));", "val = av_clip(val, 0, (1 << cbps) - 1);", "*dst = val << (8 - cbps);", "i_datap++;", "dst += VAR_0->ncomponents;", "}", "}", "line += VAR_2->linesize[0];", "}", "}", "} else {", "for (VAR_3 = 0; VAR_3 < VAR_0->ncomponents; VAR_3++) {", "Jpeg2000Component *comp = VAR_1->comp + VAR_3;", "float *datap = comp->f_data;", "int32_t *i_datap = comp->i_data;", "uint16_t *linel;", "int cbps = VAR_0->cbps[VAR_3];", "int w = VAR_1->comp[VAR_3].coord[0][1] - VAR_0->image_offset_x;", "VAR_7 = VAR_1->comp[VAR_3].coord[1][0] - VAR_0->image_offset_y;", "linel = (uint16_t *)VAR_2->data[0] + VAR_7 * (VAR_2->linesize[0] >> 1);", "for (; VAR_7 < VAR_1->comp[VAR_3].coord[1][1] - VAR_0->image_offset_y; VAR_7 += VAR_0->cdy[VAR_3]) {", "uint16_t *dst;", "VAR_6 = VAR_1->comp[VAR_3].coord[0][0] - VAR_0->image_offset_x;", "dst = linel + (VAR_6 * VAR_0->ncomponents + VAR_3);", "if (VAR_1->codsty->transform == FF_DWT97) {", "for (; VAR_6 < w; VAR_6 += VAR_0-> cdx[VAR_3]) {", "int val = lrintf(*datap) + (1 << (cbps - 1));", "val = av_clip(val, 0, (1 << cbps) - 1);", "*dst = val << (16 - cbps);", "datap++;", "dst += VAR_0->ncomponents;", "}", "} else {", "for (; VAR_6 < w; VAR_6 += VAR_0-> cdx[VAR_3]) {", "int val = *i_datap + (1 << (cbps - 1));", "val = av_clip(val, 0, (1 << cbps) - 1);", "*dst = val << (16 - cbps);", "i_datap++;", "dst += VAR_0->ncomponents;", "}", "}", "linel += VAR_2->linesize[0] >> 1;", "}", "}", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47, 49, 51 ], [ 55 ], [ 59 ], [ 61 ], [ 67 ], [ 69 ], [ 71 ], [ 73, 75, 77, 79 ], [ 83 ], [ 85 ], [ 89, 91 ], [ 93, 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 109 ], [ 111 ], [ 117, 119 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 149 ], [ 151 ], [ 155 ], [ 157 ], [ 159 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 237 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 257 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277 ], [ 281 ], [ 283 ] ]
14,059
static int rtmp_open(URLContext *s, const char *uri, int flags) { RTMPContext *rt = s->priv_data; char proto[8], hostname[256], path[1024], auth[100], *fname; char *old_app, *qmark, fname_buffer[1024]; uint8_t buf[2048]; int port; AVDictionary *opts = NULL; int ret; if (rt->listen_timeout > 0) rt->listen = 1; rt->is_input = !(flags & AVIO_FLAG_WRITE); av_url_split(proto, sizeof(proto), auth, sizeof(auth), hostname, sizeof(hostname), &port, path, sizeof(path), s->filename); if (strchr(path, ' ')) { av_log(s, AV_LOG_WARNING, "Detected librtmp style URL parameters, these aren't supported " "by the libavformat internal RTMP handler currently enabled. " "See the documentation for the correct way to pass parameters.\n"); } if (auth[0]) { char *ptr = strchr(auth, ':'); if (ptr) { *ptr = '\0'; av_strlcpy(rt->username, auth, sizeof(rt->username)); av_strlcpy(rt->password, ptr + 1, sizeof(rt->password)); } } if (rt->listen && strcmp(proto, "rtmp")) { av_log(s, AV_LOG_ERROR, "rtmp_listen not available for %s\n", proto); return AVERROR(EINVAL); } if (!strcmp(proto, "rtmpt") || !strcmp(proto, "rtmpts")) { if (!strcmp(proto, "rtmpts")) av_dict_set(&opts, "ffrtmphttp_tls", "1", 1); /* open the http tunneling connection */ ff_url_join(buf, sizeof(buf), "ffrtmphttp", NULL, hostname, port, NULL); } else if (!strcmp(proto, "rtmps")) { /* open the tls connection */ if (port < 0) port = RTMPS_DEFAULT_PORT; ff_url_join(buf, sizeof(buf), "tls", NULL, hostname, port, NULL); } else if (!strcmp(proto, "rtmpe") || (!strcmp(proto, "rtmpte"))) { if (!strcmp(proto, "rtmpte")) av_dict_set(&opts, "ffrtmpcrypt_tunneling", "1", 1); /* open the encrypted connection */ ff_url_join(buf, sizeof(buf), "ffrtmpcrypt", NULL, hostname, port, NULL); rt->encrypted = 1; } else { /* open the tcp connection */ if (port < 0) port = RTMP_DEFAULT_PORT; if (rt->listen) ff_url_join(buf, sizeof(buf), "tcp", NULL, hostname, port, "?listen&listen_timeout=%d", rt->listen_timeout * 1000); else ff_url_join(buf, sizeof(buf), "tcp", NULL, hostname, port, NULL); } reconnect: if ((ret = ffurl_open(&rt->stream, buf, AVIO_FLAG_READ_WRITE, &s->interrupt_callback, &opts)) < 0) { av_log(s , AV_LOG_ERROR, "Cannot open connection %s\n", buf); goto fail; } if (rt->swfverify) { if ((ret = rtmp_calc_swfhash(s)) < 0) goto fail; } rt->state = STATE_START; if (!rt->listen && (ret = rtmp_handshake(s, rt)) < 0) goto fail; if (rt->listen && (ret = rtmp_server_handshake(s, rt)) < 0) goto fail; rt->out_chunk_size = 128; rt->in_chunk_size = 128; // Probably overwritten later rt->state = STATE_HANDSHAKED; // Keep the application name when it has been defined by the user. old_app = rt->app; rt->app = av_malloc(APP_MAX_LENGTH); if (!rt->app) { ret = AVERROR(ENOMEM); goto fail; } //extract "app" part from path qmark = strchr(path, '?'); if (qmark && strstr(qmark, "slist=")) { char* amp; // After slist we have the playpath, before the params, the app av_strlcpy(rt->app, path + 1, FFMIN(qmark - path, APP_MAX_LENGTH)); fname = strstr(path, "slist=") + 6; // Strip any further query parameters from fname amp = strchr(fname, '&'); if (amp) { av_strlcpy(fname_buffer, fname, FFMIN(amp - fname + 1, sizeof(fname_buffer))); fname = fname_buffer; } } else if (!strncmp(path, "/ondemand/", 10)) { fname = path + 10; memcpy(rt->app, "ondemand", 9); } else { char *next = *path ? path + 1 : path; char *p = strchr(next, '/'); if (!p) { fname = next; rt->app[0] = '\0'; } else { // make sure we do not mismatch a playpath for an application instance char *c = strchr(p + 1, ':'); fname = strchr(p + 1, '/'); if (!fname || (c && c < fname)) { fname = p + 1; av_strlcpy(rt->app, path + 1, FFMIN(p - path, APP_MAX_LENGTH)); } else { fname++; av_strlcpy(rt->app, path + 1, FFMIN(fname - path - 1, APP_MAX_LENGTH)); } } } if (old_app) { // The name of application has been defined by the user, override it. if (strlen(old_app) >= APP_MAX_LENGTH) { ret = AVERROR(EINVAL); goto fail; } av_free(rt->app); rt->app = old_app; } if (!rt->playpath) { int len = strlen(fname); rt->playpath = av_malloc(PLAYPATH_MAX_LENGTH); if (!rt->playpath) { ret = AVERROR(ENOMEM); goto fail; } if (!strchr(fname, ':') && len >= 4 && (!strcmp(fname + len - 4, ".f4v") || !strcmp(fname + len - 4, ".mp4"))) { memcpy(rt->playpath, "mp4:", 5); } else { if (len >= 4 && !strcmp(fname + len - 4, ".flv")) fname[len - 4] = '\0'; rt->playpath[0] = 0; } av_strlcat(rt->playpath, fname, PLAYPATH_MAX_LENGTH); } if (!rt->tcurl) { rt->tcurl = av_malloc(TCURL_MAX_LENGTH); if (!rt->tcurl) { ret = AVERROR(ENOMEM); goto fail; } ff_url_join(rt->tcurl, TCURL_MAX_LENGTH, proto, NULL, hostname, port, "/%s", rt->app); } if (!rt->flashver) { rt->flashver = av_malloc(FLASHVER_MAX_LENGTH); if (!rt->flashver) { ret = AVERROR(ENOMEM); goto fail; } if (rt->is_input) { snprintf(rt->flashver, FLASHVER_MAX_LENGTH, "%s %d,%d,%d,%d", RTMP_CLIENT_PLATFORM, RTMP_CLIENT_VER1, RTMP_CLIENT_VER2, RTMP_CLIENT_VER3, RTMP_CLIENT_VER4); } else { snprintf(rt->flashver, FLASHVER_MAX_LENGTH, "FMLE/3.0 (compatible; %s)", LIBAVFORMAT_IDENT); } } rt->client_report_size = 1048576; rt->bytes_read = 0; rt->has_audio = 0; rt->has_video = 0; rt->received_metadata = 0; rt->last_bytes_read = 0; rt->server_bw = 2500000; av_log(s, AV_LOG_DEBUG, "Proto = %s, path = %s, app = %s, fname = %s\n", proto, path, rt->app, rt->playpath); if (!rt->listen) { if ((ret = gen_connect(s, rt)) < 0) goto fail; } else { if ((ret = read_connect(s, s->priv_data)) < 0) goto fail; } do { ret = get_packet(s, 1); } while (ret == AVERROR(EAGAIN)); if (ret < 0) goto fail; if (rt->do_reconnect) { int i; ffurl_close(rt->stream); rt->stream = NULL; rt->do_reconnect = 0; rt->nb_invokes = 0; for (i = 0; i < 2; i++) memset(rt->prev_pkt[i], 0, sizeof(**rt->prev_pkt) * rt->nb_prev_pkt[i]); free_tracked_methods(rt); goto reconnect; } if (rt->is_input) { int err; // generate FLV header for demuxer rt->flv_size = 13; if ((err = av_reallocp(&rt->flv_data, rt->flv_size)) < 0) return err; rt->flv_off = 0; memcpy(rt->flv_data, "FLV\1\0\0\0\0\011\0\0\0\0", rt->flv_size); // Read packets until we reach the first A/V packet or read metadata. // If there was a metadata package in front of the A/V packets, we can // build the FLV header from this. If we do not receive any metadata, // the FLV decoder will allocate the needed streams when their first // audio or video packet arrives. while (!rt->has_audio && !rt->has_video && !rt->received_metadata) { if ((ret = get_packet(s, 0)) < 0) return ret; } // Either after we have read the metadata or (if there is none) the // first packet of an A/V stream, we have a better knowledge about the // streams, so set the FLV header accordingly. if (rt->has_audio) { rt->flv_data[4] |= FLV_HEADER_FLAG_HASAUDIO; } if (rt->has_video) { rt->flv_data[4] |= FLV_HEADER_FLAG_HASVIDEO; } } else { rt->flv_size = 0; rt->flv_data = NULL; rt->flv_off = 0; rt->skip_bytes = 13; } s->max_packet_size = rt->stream->max_packet_size; s->is_streamed = 1; return 0; fail: av_dict_free(&opts); rtmp_close(s); return ret; }
true
FFmpeg
08ccc474b73a3acef5e56060c8174d4e82ace20d
static int rtmp_open(URLContext *s, const char *uri, int flags) { RTMPContext *rt = s->priv_data; char proto[8], hostname[256], path[1024], auth[100], *fname; char *old_app, *qmark, fname_buffer[1024]; uint8_t buf[2048]; int port; AVDictionary *opts = NULL; int ret; if (rt->listen_timeout > 0) rt->listen = 1; rt->is_input = !(flags & AVIO_FLAG_WRITE); av_url_split(proto, sizeof(proto), auth, sizeof(auth), hostname, sizeof(hostname), &port, path, sizeof(path), s->filename); if (strchr(path, ' ')) { av_log(s, AV_LOG_WARNING, "Detected librtmp style URL parameters, these aren't supported " "by the libavformat internal RTMP handler currently enabled. " "See the documentation for the correct way to pass parameters.\n"); } if (auth[0]) { char *ptr = strchr(auth, ':'); if (ptr) { *ptr = '\0'; av_strlcpy(rt->username, auth, sizeof(rt->username)); av_strlcpy(rt->password, ptr + 1, sizeof(rt->password)); } } if (rt->listen && strcmp(proto, "rtmp")) { av_log(s, AV_LOG_ERROR, "rtmp_listen not available for %s\n", proto); return AVERROR(EINVAL); } if (!strcmp(proto, "rtmpt") || !strcmp(proto, "rtmpts")) { if (!strcmp(proto, "rtmpts")) av_dict_set(&opts, "ffrtmphttp_tls", "1", 1); ff_url_join(buf, sizeof(buf), "ffrtmphttp", NULL, hostname, port, NULL); } else if (!strcmp(proto, "rtmps")) { if (port < 0) port = RTMPS_DEFAULT_PORT; ff_url_join(buf, sizeof(buf), "tls", NULL, hostname, port, NULL); } else if (!strcmp(proto, "rtmpe") || (!strcmp(proto, "rtmpte"))) { if (!strcmp(proto, "rtmpte")) av_dict_set(&opts, "ffrtmpcrypt_tunneling", "1", 1); ff_url_join(buf, sizeof(buf), "ffrtmpcrypt", NULL, hostname, port, NULL); rt->encrypted = 1; } else { if (port < 0) port = RTMP_DEFAULT_PORT; if (rt->listen) ff_url_join(buf, sizeof(buf), "tcp", NULL, hostname, port, "?listen&listen_timeout=%d", rt->listen_timeout * 1000); else ff_url_join(buf, sizeof(buf), "tcp", NULL, hostname, port, NULL); } reconnect: if ((ret = ffurl_open(&rt->stream, buf, AVIO_FLAG_READ_WRITE, &s->interrupt_callback, &opts)) < 0) { av_log(s , AV_LOG_ERROR, "Cannot open connection %s\n", buf); goto fail; } if (rt->swfverify) { if ((ret = rtmp_calc_swfhash(s)) < 0) goto fail; } rt->state = STATE_START; if (!rt->listen && (ret = rtmp_handshake(s, rt)) < 0) goto fail; if (rt->listen && (ret = rtmp_server_handshake(s, rt)) < 0) goto fail; rt->out_chunk_size = 128; rt->in_chunk_size = 128; rt->state = STATE_HANDSHAKED; old_app = rt->app; rt->app = av_malloc(APP_MAX_LENGTH); if (!rt->app) { ret = AVERROR(ENOMEM); goto fail; } qmark = strchr(path, '?'); if (qmark && strstr(qmark, "slist=")) { char* amp; av_strlcpy(rt->app, path + 1, FFMIN(qmark - path, APP_MAX_LENGTH)); fname = strstr(path, "slist=") + 6; amp = strchr(fname, '&'); if (amp) { av_strlcpy(fname_buffer, fname, FFMIN(amp - fname + 1, sizeof(fname_buffer))); fname = fname_buffer; } } else if (!strncmp(path, "/ondemand/", 10)) { fname = path + 10; memcpy(rt->app, "ondemand", 9); } else { char *next = *path ? path + 1 : path; char *p = strchr(next, '/'); if (!p) { fname = next; rt->app[0] = '\0'; } else { char *c = strchr(p + 1, ':'); fname = strchr(p + 1, '/'); if (!fname || (c && c < fname)) { fname = p + 1; av_strlcpy(rt->app, path + 1, FFMIN(p - path, APP_MAX_LENGTH)); } else { fname++; av_strlcpy(rt->app, path + 1, FFMIN(fname - path - 1, APP_MAX_LENGTH)); } } } if (old_app) { if (strlen(old_app) >= APP_MAX_LENGTH) { ret = AVERROR(EINVAL); goto fail; } av_free(rt->app); rt->app = old_app; } if (!rt->playpath) { int len = strlen(fname); rt->playpath = av_malloc(PLAYPATH_MAX_LENGTH); if (!rt->playpath) { ret = AVERROR(ENOMEM); goto fail; } if (!strchr(fname, ':') && len >= 4 && (!strcmp(fname + len - 4, ".f4v") || !strcmp(fname + len - 4, ".mp4"))) { memcpy(rt->playpath, "mp4:", 5); } else { if (len >= 4 && !strcmp(fname + len - 4, ".flv")) fname[len - 4] = '\0'; rt->playpath[0] = 0; } av_strlcat(rt->playpath, fname, PLAYPATH_MAX_LENGTH); } if (!rt->tcurl) { rt->tcurl = av_malloc(TCURL_MAX_LENGTH); if (!rt->tcurl) { ret = AVERROR(ENOMEM); goto fail; } ff_url_join(rt->tcurl, TCURL_MAX_LENGTH, proto, NULL, hostname, port, "/%s", rt->app); } if (!rt->flashver) { rt->flashver = av_malloc(FLASHVER_MAX_LENGTH); if (!rt->flashver) { ret = AVERROR(ENOMEM); goto fail; } if (rt->is_input) { snprintf(rt->flashver, FLASHVER_MAX_LENGTH, "%s %d,%d,%d,%d", RTMP_CLIENT_PLATFORM, RTMP_CLIENT_VER1, RTMP_CLIENT_VER2, RTMP_CLIENT_VER3, RTMP_CLIENT_VER4); } else { snprintf(rt->flashver, FLASHVER_MAX_LENGTH, "FMLE/3.0 (compatible; %s)", LIBAVFORMAT_IDENT); } } rt->client_report_size = 1048576; rt->bytes_read = 0; rt->has_audio = 0; rt->has_video = 0; rt->received_metadata = 0; rt->last_bytes_read = 0; rt->server_bw = 2500000; av_log(s, AV_LOG_DEBUG, "Proto = %s, path = %s, app = %s, fname = %s\n", proto, path, rt->app, rt->playpath); if (!rt->listen) { if ((ret = gen_connect(s, rt)) < 0) goto fail; } else { if ((ret = read_connect(s, s->priv_data)) < 0) goto fail; } do { ret = get_packet(s, 1); } while (ret == AVERROR(EAGAIN)); if (ret < 0) goto fail; if (rt->do_reconnect) { int i; ffurl_close(rt->stream); rt->stream = NULL; rt->do_reconnect = 0; rt->nb_invokes = 0; for (i = 0; i < 2; i++) memset(rt->prev_pkt[i], 0, sizeof(**rt->prev_pkt) * rt->nb_prev_pkt[i]); free_tracked_methods(rt); goto reconnect; } if (rt->is_input) { int err; rt->flv_size = 13; if ((err = av_reallocp(&rt->flv_data, rt->flv_size)) < 0) return err; rt->flv_off = 0; memcpy(rt->flv_data, "FLV\1\0\0\0\0\011\0\0\0\0", rt->flv_size); while (!rt->has_audio && !rt->has_video && !rt->received_metadata) { if ((ret = get_packet(s, 0)) < 0) return ret; } if (rt->has_audio) { rt->flv_data[4] |= FLV_HEADER_FLAG_HASAUDIO; } if (rt->has_video) { rt->flv_data[4] |= FLV_HEADER_FLAG_HASVIDEO; } } else { rt->flv_size = 0; rt->flv_data = NULL; rt->flv_off = 0; rt->skip_bytes = 13; } s->max_packet_size = rt->stream->max_packet_size; s->is_streamed = 1; return 0; fail: av_dict_free(&opts); rtmp_close(s); return ret; }
{ "code": [ " return ret;" ], "line_no": [ 497 ] }
static int FUNC_0(URLContext *VAR_0, const char *VAR_1, int VAR_2) { RTMPContext *rt = VAR_0->priv_data; char VAR_3[8], VAR_4[256], VAR_5[1024], VAR_6[100], *VAR_7; char *VAR_8, *VAR_9, VAR_10[1024]; uint8_t buf[2048]; int VAR_11; AVDictionary *opts = NULL; int VAR_12; if (rt->listen_timeout > 0) rt->listen = 1; rt->is_input = !(VAR_2 & AVIO_FLAG_WRITE); av_url_split(VAR_3, sizeof(VAR_3), VAR_6, sizeof(VAR_6), VAR_4, sizeof(VAR_4), &VAR_11, VAR_5, sizeof(VAR_5), VAR_0->filename); if (strchr(VAR_5, ' ')) { av_log(VAR_0, AV_LOG_WARNING, "Detected librtmp style URL parameters, these aren't supported " "by the libavformat internal RTMP handler currently enabled. " "See the documentation for the correct way to pass parameters.\n"); } if (VAR_6[0]) { char *VAR_13 = strchr(VAR_6, ':'); if (VAR_13) { *VAR_13 = '\0'; av_strlcpy(rt->username, VAR_6, sizeof(rt->username)); av_strlcpy(rt->password, VAR_13 + 1, sizeof(rt->password)); } } if (rt->listen && strcmp(VAR_3, "rtmp")) { av_log(VAR_0, AV_LOG_ERROR, "rtmp_listen not available for %VAR_0\n", VAR_3); return AVERROR(EINVAL); } if (!strcmp(VAR_3, "rtmpt") || !strcmp(VAR_3, "rtmpts")) { if (!strcmp(VAR_3, "rtmpts")) av_dict_set(&opts, "ffrtmphttp_tls", "1", 1); ff_url_join(buf, sizeof(buf), "ffrtmphttp", NULL, VAR_4, VAR_11, NULL); } else if (!strcmp(VAR_3, "rtmps")) { if (VAR_11 < 0) VAR_11 = RTMPS_DEFAULT_PORT; ff_url_join(buf, sizeof(buf), "tls", NULL, VAR_4, VAR_11, NULL); } else if (!strcmp(VAR_3, "rtmpe") || (!strcmp(VAR_3, "rtmpte"))) { if (!strcmp(VAR_3, "rtmpte")) av_dict_set(&opts, "ffrtmpcrypt_tunneling", "1", 1); ff_url_join(buf, sizeof(buf), "ffrtmpcrypt", NULL, VAR_4, VAR_11, NULL); rt->encrypted = 1; } else { if (VAR_11 < 0) VAR_11 = RTMP_DEFAULT_PORT; if (rt->listen) ff_url_join(buf, sizeof(buf), "tcp", NULL, VAR_4, VAR_11, "?listen&listen_timeout=%d", rt->listen_timeout * 1000); else ff_url_join(buf, sizeof(buf), "tcp", NULL, VAR_4, VAR_11, NULL); } reconnect: if ((VAR_12 = ffurl_open(&rt->stream, buf, AVIO_FLAG_READ_WRITE, &VAR_0->interrupt_callback, &opts)) < 0) { av_log(VAR_0 , AV_LOG_ERROR, "Cannot open connection %VAR_0\n", buf); goto fail; } if (rt->swfverify) { if ((VAR_12 = rtmp_calc_swfhash(VAR_0)) < 0) goto fail; } rt->state = STATE_START; if (!rt->listen && (VAR_12 = rtmp_handshake(VAR_0, rt)) < 0) goto fail; if (rt->listen && (VAR_12 = rtmp_server_handshake(VAR_0, rt)) < 0) goto fail; rt->out_chunk_size = 128; rt->in_chunk_size = 128; rt->state = STATE_HANDSHAKED; VAR_8 = rt->app; rt->app = av_malloc(APP_MAX_LENGTH); if (!rt->app) { VAR_12 = AVERROR(ENOMEM); goto fail; } VAR_9 = strchr(VAR_5, '?'); if (VAR_9 && strstr(VAR_9, "slist=")) { char* VAR_14; av_strlcpy(rt->app, VAR_5 + 1, FFMIN(VAR_9 - VAR_5, APP_MAX_LENGTH)); VAR_7 = strstr(VAR_5, "slist=") + 6; VAR_14 = strchr(VAR_7, '&'); if (VAR_14) { av_strlcpy(VAR_10, VAR_7, FFMIN(VAR_14 - VAR_7 + 1, sizeof(VAR_10))); VAR_7 = VAR_10; } } else if (!strncmp(VAR_5, "/ondemand/", 10)) { VAR_7 = VAR_5 + 10; memcpy(rt->app, "ondemand", 9); } else { char *VAR_15 = *VAR_5 ? VAR_5 + 1 : VAR_5; char *VAR_16 = strchr(VAR_15, '/'); if (!VAR_16) { VAR_7 = VAR_15; rt->app[0] = '\0'; } else { char *VAR_17 = strchr(VAR_16 + 1, ':'); VAR_7 = strchr(VAR_16 + 1, '/'); if (!VAR_7 || (VAR_17 && VAR_17 < VAR_7)) { VAR_7 = VAR_16 + 1; av_strlcpy(rt->app, VAR_5 + 1, FFMIN(VAR_16 - VAR_5, APP_MAX_LENGTH)); } else { VAR_7++; av_strlcpy(rt->app, VAR_5 + 1, FFMIN(VAR_7 - VAR_5 - 1, APP_MAX_LENGTH)); } } } if (VAR_8) { if (strlen(VAR_8) >= APP_MAX_LENGTH) { VAR_12 = AVERROR(EINVAL); goto fail; } av_free(rt->app); rt->app = VAR_8; } if (!rt->playpath) { int VAR_18 = strlen(VAR_7); rt->playpath = av_malloc(PLAYPATH_MAX_LENGTH); if (!rt->playpath) { VAR_12 = AVERROR(ENOMEM); goto fail; } if (!strchr(VAR_7, ':') && VAR_18 >= 4 && (!strcmp(VAR_7 + VAR_18 - 4, ".f4v") || !strcmp(VAR_7 + VAR_18 - 4, ".mp4"))) { memcpy(rt->playpath, "mp4:", 5); } else { if (VAR_18 >= 4 && !strcmp(VAR_7 + VAR_18 - 4, ".flv")) VAR_7[VAR_18 - 4] = '\0'; rt->playpath[0] = 0; } av_strlcat(rt->playpath, VAR_7, PLAYPATH_MAX_LENGTH); } if (!rt->tcurl) { rt->tcurl = av_malloc(TCURL_MAX_LENGTH); if (!rt->tcurl) { VAR_12 = AVERROR(ENOMEM); goto fail; } ff_url_join(rt->tcurl, TCURL_MAX_LENGTH, VAR_3, NULL, VAR_4, VAR_11, "/%VAR_0", rt->app); } if (!rt->flashver) { rt->flashver = av_malloc(FLASHVER_MAX_LENGTH); if (!rt->flashver) { VAR_12 = AVERROR(ENOMEM); goto fail; } if (rt->is_input) { snprintf(rt->flashver, FLASHVER_MAX_LENGTH, "%VAR_0 %d,%d,%d,%d", RTMP_CLIENT_PLATFORM, RTMP_CLIENT_VER1, RTMP_CLIENT_VER2, RTMP_CLIENT_VER3, RTMP_CLIENT_VER4); } else { snprintf(rt->flashver, FLASHVER_MAX_LENGTH, "FMLE/3.0 (compatible; %VAR_0)", LIBAVFORMAT_IDENT); } } rt->client_report_size = 1048576; rt->bytes_read = 0; rt->has_audio = 0; rt->has_video = 0; rt->received_metadata = 0; rt->last_bytes_read = 0; rt->server_bw = 2500000; av_log(VAR_0, AV_LOG_DEBUG, "Proto = %VAR_0, VAR_5 = %VAR_0, app = %VAR_0, VAR_7 = %VAR_0\n", VAR_3, VAR_5, rt->app, rt->playpath); if (!rt->listen) { if ((VAR_12 = gen_connect(VAR_0, rt)) < 0) goto fail; } else { if ((VAR_12 = read_connect(VAR_0, VAR_0->priv_data)) < 0) goto fail; } do { VAR_12 = get_packet(VAR_0, 1); } while (VAR_12 == AVERROR(EAGAIN)); if (VAR_12 < 0) goto fail; if (rt->do_reconnect) { int VAR_19; ffurl_close(rt->stream); rt->stream = NULL; rt->do_reconnect = 0; rt->nb_invokes = 0; for (VAR_19 = 0; VAR_19 < 2; VAR_19++) memset(rt->prev_pkt[VAR_19], 0, sizeof(**rt->prev_pkt) * rt->nb_prev_pkt[VAR_19]); free_tracked_methods(rt); goto reconnect; } if (rt->is_input) { int VAR_20; rt->flv_size = 13; if ((VAR_20 = av_reallocp(&rt->flv_data, rt->flv_size)) < 0) return VAR_20; rt->flv_off = 0; memcpy(rt->flv_data, "FLV\1\0\0\0\0\011\0\0\0\0", rt->flv_size); while (!rt->has_audio && !rt->has_video && !rt->received_metadata) { if ((VAR_12 = get_packet(VAR_0, 0)) < 0) return VAR_12; } if (rt->has_audio) { rt->flv_data[4] |= FLV_HEADER_FLAG_HASAUDIO; } if (rt->has_video) { rt->flv_data[4] |= FLV_HEADER_FLAG_HASVIDEO; } } else { rt->flv_size = 0; rt->flv_data = NULL; rt->flv_off = 0; rt->skip_bytes = 13; } VAR_0->max_packet_size = rt->stream->max_packet_size; VAR_0->is_streamed = 1; return 0; fail: av_dict_free(&opts); rtmp_close(VAR_0); return VAR_12; }
[ "static int FUNC_0(URLContext *VAR_0, const char *VAR_1, int VAR_2)\n{", "RTMPContext *rt = VAR_0->priv_data;", "char VAR_3[8], VAR_4[256], VAR_5[1024], VAR_6[100], *VAR_7;", "char *VAR_8, *VAR_9, VAR_10[1024];", "uint8_t buf[2048];", "int VAR_11;", "AVDictionary *opts = NULL;", "int VAR_12;", "if (rt->listen_timeout > 0)\nrt->listen = 1;", "rt->is_input = !(VAR_2 & AVIO_FLAG_WRITE);", "av_url_split(VAR_3, sizeof(VAR_3), VAR_6, sizeof(VAR_6),\nVAR_4, sizeof(VAR_4), &VAR_11,\nVAR_5, sizeof(VAR_5), VAR_0->filename);", "if (strchr(VAR_5, ' ')) {", "av_log(VAR_0, AV_LOG_WARNING,\n\"Detected librtmp style URL parameters, these aren't supported \"\n\"by the libavformat internal RTMP handler currently enabled. \"\n\"See the documentation for the correct way to pass parameters.\\n\");", "}", "if (VAR_6[0]) {", "char *VAR_13 = strchr(VAR_6, ':');", "if (VAR_13) {", "*VAR_13 = '\\0';", "av_strlcpy(rt->username, VAR_6, sizeof(rt->username));", "av_strlcpy(rt->password, VAR_13 + 1, sizeof(rt->password));", "}", "}", "if (rt->listen && strcmp(VAR_3, \"rtmp\")) {", "av_log(VAR_0, AV_LOG_ERROR, \"rtmp_listen not available for %VAR_0\\n\",\nVAR_3);", "return AVERROR(EINVAL);", "}", "if (!strcmp(VAR_3, \"rtmpt\") || !strcmp(VAR_3, \"rtmpts\")) {", "if (!strcmp(VAR_3, \"rtmpts\"))\nav_dict_set(&opts, \"ffrtmphttp_tls\", \"1\", 1);", "ff_url_join(buf, sizeof(buf), \"ffrtmphttp\", NULL, VAR_4, VAR_11, NULL);", "} else if (!strcmp(VAR_3, \"rtmps\")) {", "if (VAR_11 < 0)\nVAR_11 = RTMPS_DEFAULT_PORT;", "ff_url_join(buf, sizeof(buf), \"tls\", NULL, VAR_4, VAR_11, NULL);", "} else if (!strcmp(VAR_3, \"rtmpe\") || (!strcmp(VAR_3, \"rtmpte\"))) {", "if (!strcmp(VAR_3, \"rtmpte\"))\nav_dict_set(&opts, \"ffrtmpcrypt_tunneling\", \"1\", 1);", "ff_url_join(buf, sizeof(buf), \"ffrtmpcrypt\", NULL, VAR_4, VAR_11, NULL);", "rt->encrypted = 1;", "} else {", "if (VAR_11 < 0)\nVAR_11 = RTMP_DEFAULT_PORT;", "if (rt->listen)\nff_url_join(buf, sizeof(buf), \"tcp\", NULL, VAR_4, VAR_11,\n\"?listen&listen_timeout=%d\",\nrt->listen_timeout * 1000);", "else\nff_url_join(buf, sizeof(buf), \"tcp\", NULL, VAR_4, VAR_11, NULL);", "}", "reconnect:\nif ((VAR_12 = ffurl_open(&rt->stream, buf, AVIO_FLAG_READ_WRITE,\n&VAR_0->interrupt_callback, &opts)) < 0) {", "av_log(VAR_0 , AV_LOG_ERROR, \"Cannot open connection %VAR_0\\n\", buf);", "goto fail;", "}", "if (rt->swfverify) {", "if ((VAR_12 = rtmp_calc_swfhash(VAR_0)) < 0)\ngoto fail;", "}", "rt->state = STATE_START;", "if (!rt->listen && (VAR_12 = rtmp_handshake(VAR_0, rt)) < 0)\ngoto fail;", "if (rt->listen && (VAR_12 = rtmp_server_handshake(VAR_0, rt)) < 0)\ngoto fail;", "rt->out_chunk_size = 128;", "rt->in_chunk_size = 128;", "rt->state = STATE_HANDSHAKED;", "VAR_8 = rt->app;", "rt->app = av_malloc(APP_MAX_LENGTH);", "if (!rt->app) {", "VAR_12 = AVERROR(ENOMEM);", "goto fail;", "}", "VAR_9 = strchr(VAR_5, '?');", "if (VAR_9 && strstr(VAR_9, \"slist=\")) {", "char* VAR_14;", "av_strlcpy(rt->app, VAR_5 + 1, FFMIN(VAR_9 - VAR_5, APP_MAX_LENGTH));", "VAR_7 = strstr(VAR_5, \"slist=\") + 6;", "VAR_14 = strchr(VAR_7, '&');", "if (VAR_14) {", "av_strlcpy(VAR_10, VAR_7, FFMIN(VAR_14 - VAR_7 + 1,\nsizeof(VAR_10)));", "VAR_7 = VAR_10;", "}", "} else if (!strncmp(VAR_5, \"/ondemand/\", 10)) {", "VAR_7 = VAR_5 + 10;", "memcpy(rt->app, \"ondemand\", 9);", "} else {", "char *VAR_15 = *VAR_5 ? VAR_5 + 1 : VAR_5;", "char *VAR_16 = strchr(VAR_15, '/');", "if (!VAR_16) {", "VAR_7 = VAR_15;", "rt->app[0] = '\\0';", "} else {", "char *VAR_17 = strchr(VAR_16 + 1, ':');", "VAR_7 = strchr(VAR_16 + 1, '/');", "if (!VAR_7 || (VAR_17 && VAR_17 < VAR_7)) {", "VAR_7 = VAR_16 + 1;", "av_strlcpy(rt->app, VAR_5 + 1, FFMIN(VAR_16 - VAR_5, APP_MAX_LENGTH));", "} else {", "VAR_7++;", "av_strlcpy(rt->app, VAR_5 + 1, FFMIN(VAR_7 - VAR_5 - 1, APP_MAX_LENGTH));", "}", "}", "}", "if (VAR_8) {", "if (strlen(VAR_8) >= APP_MAX_LENGTH) {", "VAR_12 = AVERROR(EINVAL);", "goto fail;", "}", "av_free(rt->app);", "rt->app = VAR_8;", "}", "if (!rt->playpath) {", "int VAR_18 = strlen(VAR_7);", "rt->playpath = av_malloc(PLAYPATH_MAX_LENGTH);", "if (!rt->playpath) {", "VAR_12 = AVERROR(ENOMEM);", "goto fail;", "}", "if (!strchr(VAR_7, ':') && VAR_18 >= 4 &&\n(!strcmp(VAR_7 + VAR_18 - 4, \".f4v\") ||\n!strcmp(VAR_7 + VAR_18 - 4, \".mp4\"))) {", "memcpy(rt->playpath, \"mp4:\", 5);", "} else {", "if (VAR_18 >= 4 && !strcmp(VAR_7 + VAR_18 - 4, \".flv\"))\nVAR_7[VAR_18 - 4] = '\\0';", "rt->playpath[0] = 0;", "}", "av_strlcat(rt->playpath, VAR_7, PLAYPATH_MAX_LENGTH);", "}", "if (!rt->tcurl) {", "rt->tcurl = av_malloc(TCURL_MAX_LENGTH);", "if (!rt->tcurl) {", "VAR_12 = AVERROR(ENOMEM);", "goto fail;", "}", "ff_url_join(rt->tcurl, TCURL_MAX_LENGTH, VAR_3, NULL, VAR_4,\nVAR_11, \"/%VAR_0\", rt->app);", "}", "if (!rt->flashver) {", "rt->flashver = av_malloc(FLASHVER_MAX_LENGTH);", "if (!rt->flashver) {", "VAR_12 = AVERROR(ENOMEM);", "goto fail;", "}", "if (rt->is_input) {", "snprintf(rt->flashver, FLASHVER_MAX_LENGTH, \"%VAR_0 %d,%d,%d,%d\",\nRTMP_CLIENT_PLATFORM, RTMP_CLIENT_VER1, RTMP_CLIENT_VER2,\nRTMP_CLIENT_VER3, RTMP_CLIENT_VER4);", "} else {", "snprintf(rt->flashver, FLASHVER_MAX_LENGTH,\n\"FMLE/3.0 (compatible; %VAR_0)\", LIBAVFORMAT_IDENT);", "}", "}", "rt->client_report_size = 1048576;", "rt->bytes_read = 0;", "rt->has_audio = 0;", "rt->has_video = 0;", "rt->received_metadata = 0;", "rt->last_bytes_read = 0;", "rt->server_bw = 2500000;", "av_log(VAR_0, AV_LOG_DEBUG, \"Proto = %VAR_0, VAR_5 = %VAR_0, app = %VAR_0, VAR_7 = %VAR_0\\n\",\nVAR_3, VAR_5, rt->app, rt->playpath);", "if (!rt->listen) {", "if ((VAR_12 = gen_connect(VAR_0, rt)) < 0)\ngoto fail;", "} else {", "if ((VAR_12 = read_connect(VAR_0, VAR_0->priv_data)) < 0)\ngoto fail;", "}", "do {", "VAR_12 = get_packet(VAR_0, 1);", "} while (VAR_12 == AVERROR(EAGAIN));", "if (VAR_12 < 0)\ngoto fail;", "if (rt->do_reconnect) {", "int VAR_19;", "ffurl_close(rt->stream);", "rt->stream = NULL;", "rt->do_reconnect = 0;", "rt->nb_invokes = 0;", "for (VAR_19 = 0; VAR_19 < 2; VAR_19++)", "memset(rt->prev_pkt[VAR_19], 0,\nsizeof(**rt->prev_pkt) * rt->nb_prev_pkt[VAR_19]);", "free_tracked_methods(rt);", "goto reconnect;", "}", "if (rt->is_input) {", "int VAR_20;", "rt->flv_size = 13;", "if ((VAR_20 = av_reallocp(&rt->flv_data, rt->flv_size)) < 0)\nreturn VAR_20;", "rt->flv_off = 0;", "memcpy(rt->flv_data, \"FLV\\1\\0\\0\\0\\0\\011\\0\\0\\0\\0\", rt->flv_size);", "while (!rt->has_audio && !rt->has_video && !rt->received_metadata) {", "if ((VAR_12 = get_packet(VAR_0, 0)) < 0)\nreturn VAR_12;", "}", "if (rt->has_audio) {", "rt->flv_data[4] |= FLV_HEADER_FLAG_HASAUDIO;", "}", "if (rt->has_video) {", "rt->flv_data[4] |= FLV_HEADER_FLAG_HASVIDEO;", "}", "} else {", "rt->flv_size = 0;", "rt->flv_data = NULL;", "rt->flv_off = 0;", "rt->skip_bytes = 13;", "}", "VAR_0->max_packet_size = rt->stream->max_packet_size;", "VAR_0->is_streamed = 1;", "return 0;", "fail:\nav_dict_free(&opts);", "rtmp_close(VAR_0);", "return VAR_12;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21, 23 ], [ 27 ], [ 31, 33, 35 ], [ 39 ], [ 41, 43, 45, 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73, 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83, 85 ], [ 91 ], [ 93 ], [ 97, 99 ], [ 101 ], [ 103 ], [ 105, 107 ], [ 113 ], [ 115 ], [ 117 ], [ 121, 123 ], [ 125, 127, 129, 131 ], [ 133, 135 ], [ 137 ], [ 141, 143, 145 ], [ 147 ], [ 149 ], [ 151 ], [ 155 ], [ 157, 159 ], [ 161 ], [ 165 ], [ 167, 169 ], [ 171, 173 ], [ 177 ], [ 179 ], [ 181 ], [ 187 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 205 ], [ 207 ], [ 209 ], [ 213 ], [ 215 ], [ 219 ], [ 221 ], [ 223, 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 277 ], [ 281 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ], [ 291 ], [ 293 ], [ 297 ], [ 299 ], [ 303 ], [ 305 ], [ 307 ], [ 309 ], [ 311 ], [ 315, 317, 319 ], [ 321 ], [ 323 ], [ 325, 327 ], [ 329 ], [ 331 ], [ 333 ], [ 335 ], [ 339 ], [ 341 ], [ 343 ], [ 345 ], [ 347 ], [ 349 ], [ 351, 353 ], [ 355 ], [ 359 ], [ 361 ], [ 363 ], [ 365 ], [ 367 ], [ 369 ], [ 371 ], [ 373, 375, 377 ], [ 379 ], [ 381, 383 ], [ 385 ], [ 387 ], [ 391 ], [ 393 ], [ 395 ], [ 397 ], [ 399 ], [ 401 ], [ 403 ], [ 407, 409 ], [ 411 ], [ 413, 415 ], [ 417 ], [ 419, 421 ], [ 423 ], [ 427 ], [ 429 ], [ 431 ], [ 433, 435 ], [ 439 ], [ 441 ], [ 443 ], [ 445 ], [ 447 ], [ 449 ], [ 451 ], [ 453, 455 ], [ 457 ], [ 459 ], [ 461 ], [ 465 ], [ 467 ], [ 471 ], [ 473, 475 ], [ 477 ], [ 479 ], [ 493 ], [ 495, 497 ], [ 499 ], [ 509 ], [ 511 ], [ 513 ], [ 515 ], [ 517 ], [ 519 ], [ 521 ], [ 523 ], [ 525 ], [ 527 ], [ 529 ], [ 531 ], [ 535 ], [ 537 ], [ 539 ], [ 543, 545 ], [ 547 ], [ 549 ], [ 551 ] ]
14,060
static int read_random(uint32_t *dst, const char *file) { int fd = open(file, O_RDONLY); int err = -1; if (fd == -1) return -1; #if HAVE_FCNTL && defined(O_NONBLOCK) if (fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_NONBLOCK) != -1) #endif err = read(fd, dst, sizeof(*dst)); close(fd); return err; }
true
FFmpeg
b7fa5c5abb39f819fbb42253711bc13e5cac0e81
static int read_random(uint32_t *dst, const char *file) { int fd = open(file, O_RDONLY); int err = -1; if (fd == -1) return -1; #if HAVE_FCNTL && defined(O_NONBLOCK) if (fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_NONBLOCK) != -1) #endif err = read(fd, dst, sizeof(*dst)); close(fd); return err; }
{ "code": [ "#if HAVE_FCNTL && defined(O_NONBLOCK)", " if (fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_NONBLOCK) != -1)", "#endif" ], "line_no": [ 15, 17, 19 ] }
static int FUNC_0(uint32_t *VAR_0, const char *VAR_1) { int VAR_2 = open(VAR_1, O_RDONLY); int VAR_3 = -1; if (VAR_2 == -1) return -1; #if HAVE_FCNTL && defined(O_NONBLOCK) if (fcntl(VAR_2, F_SETFL, fcntl(VAR_2, F_GETFL) | O_NONBLOCK) != -1) #endif VAR_3 = read(VAR_2, VAR_0, sizeof(*VAR_0)); close(VAR_2); return VAR_3; }
[ "static int FUNC_0(uint32_t *VAR_0, const char *VAR_1)\n{", "int VAR_2 = open(VAR_1, O_RDONLY);", "int VAR_3 = -1;", "if (VAR_2 == -1)\nreturn -1;", "#if HAVE_FCNTL && defined(O_NONBLOCK)\nif (fcntl(VAR_2, F_SETFL, fcntl(VAR_2, F_GETFL) | O_NONBLOCK) != -1)\n#endif\nVAR_3 = read(VAR_2, VAR_0, sizeof(*VAR_0));", "close(VAR_2);", "return VAR_3;", "}" ]
[ 0, 0, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11, 13 ], [ 15, 17, 19, 21 ], [ 23 ], [ 27 ], [ 29 ] ]
14,061
static void enable_device(PIIX4PMState *s, int slot) { s->ar.gpe.sts[0] |= PIIX4_PCI_HOTPLUG_STATUS; s->pci0_status.up |= (1 << slot); }
true
qemu
7faa8075d898ae56d2c533c530569bb25ab86eaf
static void enable_device(PIIX4PMState *s, int slot) { s->ar.gpe.sts[0] |= PIIX4_PCI_HOTPLUG_STATUS; s->pci0_status.up |= (1 << slot); }
{ "code": [ " s->pci0_status.up |= (1 << slot);" ], "line_no": [ 7 ] }
static void FUNC_0(PIIX4PMState *VAR_0, int VAR_1) { VAR_0->ar.gpe.sts[0] |= PIIX4_PCI_HOTPLUG_STATUS; VAR_0->pci0_status.up |= (1 << VAR_1); }
[ "static void FUNC_0(PIIX4PMState *VAR_0, int VAR_1)\n{", "VAR_0->ar.gpe.sts[0] |= PIIX4_PCI_HOTPLUG_STATUS;", "VAR_0->pci0_status.up |= (1 << VAR_1);", "}" ]
[ 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
14,062
static QObject *parse_literal(JSONParserContext *ctxt) { QObject *token, *obj; JSONParserContext saved_ctxt = parser_context_save(ctxt); token = parser_context_pop_token(ctxt); if (token == NULL) { goto out; } switch (token_get_type(token)) { case JSON_STRING: obj = QOBJECT(qstring_from_escaped_str(ctxt, token)); break; case JSON_INTEGER: obj = QOBJECT(qint_from_int(strtoll(token_get_value(token), NULL, 10))); break; case JSON_FLOAT: /* FIXME dependent on locale */ obj = QOBJECT(qfloat_from_double(strtod(token_get_value(token), NULL))); break; default: goto out; } return obj; out: parser_context_restore(ctxt, saved_ctxt); return NULL; }
true
qemu
3d5b3ec6d460a92245215aaf7b349b0b9e5ffa25
static QObject *parse_literal(JSONParserContext *ctxt) { QObject *token, *obj; JSONParserContext saved_ctxt = parser_context_save(ctxt); token = parser_context_pop_token(ctxt); if (token == NULL) { goto out; } switch (token_get_type(token)) { case JSON_STRING: obj = QOBJECT(qstring_from_escaped_str(ctxt, token)); break; case JSON_INTEGER: obj = QOBJECT(qint_from_int(strtoll(token_get_value(token), NULL, 10))); break; case JSON_FLOAT: obj = QOBJECT(qfloat_from_double(strtod(token_get_value(token), NULL))); break; default: goto out; } return obj; out: parser_context_restore(ctxt, saved_ctxt); return NULL; }
{ "code": [ " case JSON_INTEGER:", " obj = QOBJECT(qint_from_int(strtoll(token_get_value(token), NULL, 10)));", " break;" ], "line_no": [ 29, 31, 27 ] }
static QObject *FUNC_0(JSONParserContext *ctxt) { QObject *token, *obj; JSONParserContext saved_ctxt = parser_context_save(ctxt); token = parser_context_pop_token(ctxt); if (token == NULL) { goto out; } switch (token_get_type(token)) { case JSON_STRING: obj = QOBJECT(qstring_from_escaped_str(ctxt, token)); break; case JSON_INTEGER: obj = QOBJECT(qint_from_int(strtoll(token_get_value(token), NULL, 10))); break; case JSON_FLOAT: obj = QOBJECT(qfloat_from_double(strtod(token_get_value(token), NULL))); break; default: goto out; } return obj; out: parser_context_restore(ctxt, saved_ctxt); return NULL; }
[ "static QObject *FUNC_0(JSONParserContext *ctxt)\n{", "QObject *token, *obj;", "JSONParserContext saved_ctxt = parser_context_save(ctxt);", "token = parser_context_pop_token(ctxt);", "if (token == NULL) {", "goto out;", "}", "switch (token_get_type(token)) {", "case JSON_STRING:\nobj = QOBJECT(qstring_from_escaped_str(ctxt, token));", "break;", "case JSON_INTEGER:\nobj = QOBJECT(qint_from_int(strtoll(token_get_value(token), NULL, 10)));", "break;", "case JSON_FLOAT:\nobj = QOBJECT(qfloat_from_double(strtod(token_get_value(token), NULL)));", "break;", "default:\ngoto out;", "}", "return obj;", "out:\nparser_context_restore(ctxt, saved_ctxt);", "return NULL;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 29, 31 ], [ 33 ], [ 35, 39 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 51 ], [ 55, 57 ], [ 61 ], [ 63 ] ]
14,064
void cpu_loop(CPUM68KState *env) { CPUState *cs = CPU(m68k_env_get_cpu(env)); int trapnr; unsigned int n; target_siginfo_t info; TaskState *ts = cs->opaque; for(;;) { cpu_exec_start(cs); trapnr = cpu_exec(cs); cpu_exec_end(cs); process_queued_cpu_work(cs); switch(trapnr) { case EXCP_ILLEGAL: { if (ts->sim_syscalls) { uint16_t nr; get_user_u16(nr, env->pc + 2); env->pc += 4; do_m68k_simcall(env, nr); } else { goto do_sigill; } } case EXCP_HALT_INSN: /* Semihosing syscall. */ env->pc += 4; do_m68k_semihosting(env, env->dregs[0]); case EXCP_LINEA: case EXCP_LINEF: case EXCP_UNSUPPORTED: do_sigill: info.si_signo = TARGET_SIGILL; info.si_code = TARGET_ILL_ILLOPN; case EXCP_TRAP0: { abi_long ret; ts->sim_syscalls = 0; n = env->dregs[0]; env->pc += 2; ret = do_syscall(env, n, env->dregs[1], env->dregs[2], env->dregs[3], env->dregs[4], env->dregs[5], env->aregs[0], 0, 0); if (ret == -TARGET_ERESTARTSYS) { env->pc -= 2; } else if (ret != -TARGET_QEMU_ESIGRETURN) { env->dregs[0] = ret; } } case EXCP_INTERRUPT: /* just indicate that signals should be handled asap */ case EXCP_ACCESS: { info.si_signo = TARGET_SIGSEGV; /* XXX: check env->error_code */ info.si_code = TARGET_SEGV_MAPERR; info._sifields._sigfault._addr = env->mmu.ar; } case EXCP_DEBUG: { int sig; sig = gdb_handlesig(cs, TARGET_SIGTRAP); if (sig) { info.si_signo = sig; info.si_code = TARGET_TRAP_BRKPT; } } case EXCP_ATOMIC: cpu_exec_step_atomic(cs); default: EXCP_DUMP(env, "qemu: unhandled CPU exception 0x%x - aborting\n", trapnr); abort(); } process_pending_signals(env); } }
true
qemu
0ccb9c1d8128a020720d5c6abf99a470742a1b94
void cpu_loop(CPUM68KState *env) { CPUState *cs = CPU(m68k_env_get_cpu(env)); int trapnr; unsigned int n; target_siginfo_t info; TaskState *ts = cs->opaque; for(;;) { cpu_exec_start(cs); trapnr = cpu_exec(cs); cpu_exec_end(cs); process_queued_cpu_work(cs); switch(trapnr) { case EXCP_ILLEGAL: { if (ts->sim_syscalls) { uint16_t nr; get_user_u16(nr, env->pc + 2); env->pc += 4; do_m68k_simcall(env, nr); } else { goto do_sigill; } } case EXCP_HALT_INSN: env->pc += 4; do_m68k_semihosting(env, env->dregs[0]); case EXCP_LINEA: case EXCP_LINEF: case EXCP_UNSUPPORTED: do_sigill: info.si_signo = TARGET_SIGILL; info.si_code = TARGET_ILL_ILLOPN; case EXCP_TRAP0: { abi_long ret; ts->sim_syscalls = 0; n = env->dregs[0]; env->pc += 2; ret = do_syscall(env, n, env->dregs[1], env->dregs[2], env->dregs[3], env->dregs[4], env->dregs[5], env->aregs[0], 0, 0); if (ret == -TARGET_ERESTARTSYS) { env->pc -= 2; } else if (ret != -TARGET_QEMU_ESIGRETURN) { env->dregs[0] = ret; } } case EXCP_INTERRUPT: case EXCP_ACCESS: { info.si_signo = TARGET_SIGSEGV; info.si_code = TARGET_SEGV_MAPERR; info._sifields._sigfault._addr = env->mmu.ar; } case EXCP_DEBUG: { int sig; sig = gdb_handlesig(cs, TARGET_SIGTRAP); if (sig) { info.si_signo = sig; info.si_code = TARGET_TRAP_BRKPT; } } case EXCP_ATOMIC: cpu_exec_step_atomic(cs); default: EXCP_DUMP(env, "qemu: unhandled CPU exception 0x%x - aborting\n", trapnr); abort(); } process_pending_signals(env); } }
{ "code": [], "line_no": [] }
void FUNC_0(CPUM68KState *VAR_0) { CPUState *cs = CPU(m68k_env_get_cpu(VAR_0)); int VAR_1; unsigned int VAR_2; target_siginfo_t info; TaskState *ts = cs->opaque; for(;;) { cpu_exec_start(cs); VAR_1 = cpu_exec(cs); cpu_exec_end(cs); process_queued_cpu_work(cs); switch(VAR_1) { case EXCP_ILLEGAL: { if (ts->sim_syscalls) { uint16_t nr; get_user_u16(nr, VAR_0->pc + 2); VAR_0->pc += 4; do_m68k_simcall(VAR_0, nr); } else { goto do_sigill; } } case EXCP_HALT_INSN: VAR_0->pc += 4; do_m68k_semihosting(VAR_0, VAR_0->dregs[0]); case EXCP_LINEA: case EXCP_LINEF: case EXCP_UNSUPPORTED: do_sigill: info.si_signo = TARGET_SIGILL; info.si_code = TARGET_ILL_ILLOPN; case EXCP_TRAP0: { abi_long ret; ts->sim_syscalls = 0; VAR_2 = VAR_0->dregs[0]; VAR_0->pc += 2; ret = do_syscall(VAR_0, VAR_2, VAR_0->dregs[1], VAR_0->dregs[2], VAR_0->dregs[3], VAR_0->dregs[4], VAR_0->dregs[5], VAR_0->aregs[0], 0, 0); if (ret == -TARGET_ERESTARTSYS) { VAR_0->pc -= 2; } else if (ret != -TARGET_QEMU_ESIGRETURN) { VAR_0->dregs[0] = ret; } } case EXCP_INTERRUPT: case EXCP_ACCESS: { info.si_signo = TARGET_SIGSEGV; info.si_code = TARGET_SEGV_MAPERR; info._sifields._sigfault._addr = VAR_0->mmu.ar; } case EXCP_DEBUG: { int VAR_3; VAR_3 = gdb_handlesig(cs, TARGET_SIGTRAP); if (VAR_3) { info.si_signo = VAR_3; info.si_code = TARGET_TRAP_BRKPT; } } case EXCP_ATOMIC: cpu_exec_step_atomic(cs); default: EXCP_DUMP(VAR_0, "qemu: unhandled CPU exception 0x%x - aborting\VAR_2", VAR_1); abort(); } process_pending_signals(VAR_0); } }
[ "void FUNC_0(CPUM68KState *VAR_0)\n{", "CPUState *cs = CPU(m68k_env_get_cpu(VAR_0));", "int VAR_1;", "unsigned int VAR_2;", "target_siginfo_t info;", "TaskState *ts = cs->opaque;", "for(;;) {", "cpu_exec_start(cs);", "VAR_1 = cpu_exec(cs);", "cpu_exec_end(cs);", "process_queued_cpu_work(cs);", "switch(VAR_1) {", "case EXCP_ILLEGAL:\n{", "if (ts->sim_syscalls) {", "uint16_t nr;", "get_user_u16(nr, VAR_0->pc + 2);", "VAR_0->pc += 4;", "do_m68k_simcall(VAR_0, nr);", "} else {", "goto do_sigill;", "}", "}", "case EXCP_HALT_INSN:\nVAR_0->pc += 4;", "do_m68k_semihosting(VAR_0, VAR_0->dregs[0]);", "case EXCP_LINEA:\ncase EXCP_LINEF:\ncase EXCP_UNSUPPORTED:\ndo_sigill:\ninfo.si_signo = TARGET_SIGILL;", "info.si_code = TARGET_ILL_ILLOPN;", "case EXCP_TRAP0:\n{", "abi_long ret;", "ts->sim_syscalls = 0;", "VAR_2 = VAR_0->dregs[0];", "VAR_0->pc += 2;", "ret = do_syscall(VAR_0,\nVAR_2,\nVAR_0->dregs[1],\nVAR_0->dregs[2],\nVAR_0->dregs[3],\nVAR_0->dregs[4],\nVAR_0->dregs[5],\nVAR_0->aregs[0],\n0, 0);", "if (ret == -TARGET_ERESTARTSYS) {", "VAR_0->pc -= 2;", "} else if (ret != -TARGET_QEMU_ESIGRETURN) {", "VAR_0->dregs[0] = ret;", "}", "}", "case EXCP_INTERRUPT:\ncase EXCP_ACCESS:\n{", "info.si_signo = TARGET_SIGSEGV;", "info.si_code = TARGET_SEGV_MAPERR;", "info._sifields._sigfault._addr = VAR_0->mmu.ar;", "}", "case EXCP_DEBUG:\n{", "int VAR_3;", "VAR_3 = gdb_handlesig(cs, TARGET_SIGTRAP);", "if (VAR_3)\n{", "info.si_signo = VAR_3;", "info.si_code = TARGET_TRAP_BRKPT;", "}", "}", "case EXCP_ATOMIC:\ncpu_exec_step_atomic(cs);", "default:\nEXCP_DUMP(VAR_0, \"qemu: unhandled CPU exception 0x%x - aborting\\VAR_2\", VAR_1);", "abort();", "}", "process_pending_signals(VAR_0);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 54, 58 ], [ 60 ], [ 63, 65, 67, 69, 71 ], [ 74 ], [ 86, 88 ], [ 90 ], [ 92 ], [ 94 ], [ 96 ], [ 98, 100, 102, 104, 106, 108, 110, 112, 114 ], [ 116 ], [ 118 ], [ 120 ], [ 122 ], [ 124 ], [ 126 ], [ 129, 134, 136 ], [ 138 ], [ 143 ], [ 145 ], [ 148 ], [ 151, 153 ], [ 155 ], [ 159 ], [ 161, 163 ], [ 165 ], [ 168 ], [ 171 ], [ 173 ], [ 176, 178 ], [ 181, 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ] ]
14,065
void do_savevm(Monitor *mon, const QDict *qdict) { DriveInfo *dinfo; BlockDriverState *bs, *bs1; QEMUSnapshotInfo sn1, *sn = &sn1, old_sn1, *old_sn = &old_sn1; int ret; QEMUFile *f; int saved_vm_running; uint32_t vm_state_size; #ifdef _WIN32 struct _timeb tb; #else struct timeval tv; #endif const char *name = qdict_get_try_str(qdict, "name"); bs = get_bs_snapshots(); if (!bs) { monitor_printf(mon, "No block device can accept snapshots\n"); return; } /* ??? Should this occur after vm_stop? */ qemu_aio_flush(); saved_vm_running = vm_running; vm_stop(0); memset(sn, 0, sizeof(*sn)); if (name) { ret = bdrv_snapshot_find(bs, old_sn, name); if (ret >= 0) { pstrcpy(sn->name, sizeof(sn->name), old_sn->name); pstrcpy(sn->id_str, sizeof(sn->id_str), old_sn->id_str); } else { pstrcpy(sn->name, sizeof(sn->name), name); } } /* fill auxiliary fields */ #ifdef _WIN32 _ftime(&tb); sn->date_sec = tb.time; sn->date_nsec = tb.millitm * 1000000; #else gettimeofday(&tv, NULL); sn->date_sec = tv.tv_sec; sn->date_nsec = tv.tv_usec * 1000; #endif sn->vm_clock_nsec = qemu_get_clock(vm_clock); /* Delete old snapshots of the same name */ if (name && del_existing_snapshots(mon, name) < 0) { goto the_end; } /* save the VM state */ f = qemu_fopen_bdrv(bs, 1); if (!f) { monitor_printf(mon, "Could not open VM state file\n"); goto the_end; } ret = qemu_savevm_state(mon, f); vm_state_size = qemu_ftell(f); qemu_fclose(f); if (ret < 0) { monitor_printf(mon, "Error %d while writing VM\n", ret); goto the_end; } /* create the snapshots */ QTAILQ_FOREACH(dinfo, &drives, next) { bs1 = dinfo->bdrv; if (bdrv_has_snapshot(bs1)) { /* Write VM state size only to the image that contains the state */ sn->vm_state_size = (bs == bs1 ? vm_state_size : 0); ret = bdrv_snapshot_create(bs1, sn); if (ret < 0) { monitor_printf(mon, "Error while creating snapshot on '%s'\n", bdrv_get_device_name(bs1)); } } } the_end: if (saved_vm_running) vm_start(); }
true
qemu
feeee5aca765606818e00f5a19d19f141f4ae365
void do_savevm(Monitor *mon, const QDict *qdict) { DriveInfo *dinfo; BlockDriverState *bs, *bs1; QEMUSnapshotInfo sn1, *sn = &sn1, old_sn1, *old_sn = &old_sn1; int ret; QEMUFile *f; int saved_vm_running; uint32_t vm_state_size; #ifdef _WIN32 struct _timeb tb; #else struct timeval tv; #endif const char *name = qdict_get_try_str(qdict, "name"); bs = get_bs_snapshots(); if (!bs) { monitor_printf(mon, "No block device can accept snapshots\n"); return; } qemu_aio_flush(); saved_vm_running = vm_running; vm_stop(0); memset(sn, 0, sizeof(*sn)); if (name) { ret = bdrv_snapshot_find(bs, old_sn, name); if (ret >= 0) { pstrcpy(sn->name, sizeof(sn->name), old_sn->name); pstrcpy(sn->id_str, sizeof(sn->id_str), old_sn->id_str); } else { pstrcpy(sn->name, sizeof(sn->name), name); } } #ifdef _WIN32 _ftime(&tb); sn->date_sec = tb.time; sn->date_nsec = tb.millitm * 1000000; #else gettimeofday(&tv, NULL); sn->date_sec = tv.tv_sec; sn->date_nsec = tv.tv_usec * 1000; #endif sn->vm_clock_nsec = qemu_get_clock(vm_clock); if (name && del_existing_snapshots(mon, name) < 0) { goto the_end; } f = qemu_fopen_bdrv(bs, 1); if (!f) { monitor_printf(mon, "Could not open VM state file\n"); goto the_end; } ret = qemu_savevm_state(mon, f); vm_state_size = qemu_ftell(f); qemu_fclose(f); if (ret < 0) { monitor_printf(mon, "Error %d while writing VM\n", ret); goto the_end; } QTAILQ_FOREACH(dinfo, &drives, next) { bs1 = dinfo->bdrv; if (bdrv_has_snapshot(bs1)) { sn->vm_state_size = (bs == bs1 ? vm_state_size : 0); ret = bdrv_snapshot_create(bs1, sn); if (ret < 0) { monitor_printf(mon, "Error while creating snapshot on '%s'\n", bdrv_get_device_name(bs1)); } } } the_end: if (saved_vm_running) vm_start(); }
{ "code": [ " if (bdrv_has_snapshot(bs1)) {", " if (bdrv_has_snapshot(bs1)) {", " if (bdrv_has_snapshot(bs1)) {", " if (bdrv_has_snapshot(bs1)) {" ], "line_no": [ 149, 149, 149, 149 ] }
void FUNC_0(Monitor *VAR_0, const QDict *VAR_1) { DriveInfo *dinfo; BlockDriverState *bs, *bs1; QEMUSnapshotInfo sn1, *sn = &sn1, old_sn1, *old_sn = &old_sn1; int VAR_2; QEMUFile *f; int VAR_3; uint32_t vm_state_size; #ifdef _WIN32 struct _timeb tb; #else struct timeval VAR_4; #endif const char *VAR_5 = qdict_get_try_str(VAR_1, "VAR_5"); bs = get_bs_snapshots(); if (!bs) { monitor_printf(VAR_0, "No block device can accept snapshots\n"); return; } qemu_aio_flush(); VAR_3 = vm_running; vm_stop(0); memset(sn, 0, sizeof(*sn)); if (VAR_5) { VAR_2 = bdrv_snapshot_find(bs, old_sn, VAR_5); if (VAR_2 >= 0) { pstrcpy(sn->VAR_5, sizeof(sn->VAR_5), old_sn->VAR_5); pstrcpy(sn->id_str, sizeof(sn->id_str), old_sn->id_str); } else { pstrcpy(sn->VAR_5, sizeof(sn->VAR_5), VAR_5); } } #ifdef _WIN32 _ftime(&tb); sn->date_sec = tb.time; sn->date_nsec = tb.millitm * 1000000; #else gettimeofday(&VAR_4, NULL); sn->date_sec = VAR_4.tv_sec; sn->date_nsec = VAR_4.tv_usec * 1000; #endif sn->vm_clock_nsec = qemu_get_clock(vm_clock); if (VAR_5 && del_existing_snapshots(VAR_0, VAR_5) < 0) { goto the_end; } f = qemu_fopen_bdrv(bs, 1); if (!f) { monitor_printf(VAR_0, "Could not open VM state file\n"); goto the_end; } VAR_2 = qemu_savevm_state(VAR_0, f); vm_state_size = qemu_ftell(f); qemu_fclose(f); if (VAR_2 < 0) { monitor_printf(VAR_0, "Error %d while writing VM\n", VAR_2); goto the_end; } QTAILQ_FOREACH(dinfo, &drives, next) { bs1 = dinfo->bdrv; if (bdrv_has_snapshot(bs1)) { sn->vm_state_size = (bs == bs1 ? vm_state_size : 0); VAR_2 = bdrv_snapshot_create(bs1, sn); if (VAR_2 < 0) { monitor_printf(VAR_0, "Error while creating snapshot on '%s'\n", bdrv_get_device_name(bs1)); } } } the_end: if (VAR_3) vm_start(); }
[ "void FUNC_0(Monitor *VAR_0, const QDict *VAR_1)\n{", "DriveInfo *dinfo;", "BlockDriverState *bs, *bs1;", "QEMUSnapshotInfo sn1, *sn = &sn1, old_sn1, *old_sn = &old_sn1;", "int VAR_2;", "QEMUFile *f;", "int VAR_3;", "uint32_t vm_state_size;", "#ifdef _WIN32\nstruct _timeb tb;", "#else\nstruct timeval VAR_4;", "#endif\nconst char *VAR_5 = qdict_get_try_str(VAR_1, \"VAR_5\");", "bs = get_bs_snapshots();", "if (!bs) {", "monitor_printf(VAR_0, \"No block device can accept snapshots\\n\");", "return;", "}", "qemu_aio_flush();", "VAR_3 = vm_running;", "vm_stop(0);", "memset(sn, 0, sizeof(*sn));", "if (VAR_5) {", "VAR_2 = bdrv_snapshot_find(bs, old_sn, VAR_5);", "if (VAR_2 >= 0) {", "pstrcpy(sn->VAR_5, sizeof(sn->VAR_5), old_sn->VAR_5);", "pstrcpy(sn->id_str, sizeof(sn->id_str), old_sn->id_str);", "} else {", "pstrcpy(sn->VAR_5, sizeof(sn->VAR_5), VAR_5);", "}", "}", "#ifdef _WIN32\n_ftime(&tb);", "sn->date_sec = tb.time;", "sn->date_nsec = tb.millitm * 1000000;", "#else\ngettimeofday(&VAR_4, NULL);", "sn->date_sec = VAR_4.tv_sec;", "sn->date_nsec = VAR_4.tv_usec * 1000;", "#endif\nsn->vm_clock_nsec = qemu_get_clock(vm_clock);", "if (VAR_5 && del_existing_snapshots(VAR_0, VAR_5) < 0) {", "goto the_end;", "}", "f = qemu_fopen_bdrv(bs, 1);", "if (!f) {", "monitor_printf(VAR_0, \"Could not open VM state file\\n\");", "goto the_end;", "}", "VAR_2 = qemu_savevm_state(VAR_0, f);", "vm_state_size = qemu_ftell(f);", "qemu_fclose(f);", "if (VAR_2 < 0) {", "monitor_printf(VAR_0, \"Error %d while writing VM\\n\", VAR_2);", "goto the_end;", "}", "QTAILQ_FOREACH(dinfo, &drives, next) {", "bs1 = dinfo->bdrv;", "if (bdrv_has_snapshot(bs1)) {", "sn->vm_state_size = (bs == bs1 ? vm_state_size : 0);", "VAR_2 = bdrv_snapshot_create(bs1, sn);", "if (VAR_2 < 0) {", "monitor_printf(VAR_0, \"Error while creating snapshot on '%s'\\n\",\nbdrv_get_device_name(bs1));", "}", "}", "}", "the_end:\nif (VAR_3)\nvm_start();", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19, 21 ], [ 23, 25 ], [ 27, 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 47 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 81, 83 ], [ 85 ], [ 87 ], [ 89, 91 ], [ 93 ], [ 95 ], [ 97, 99 ], [ 105 ], [ 107 ], [ 109 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 145 ], [ 147 ], [ 149 ], [ 153 ], [ 155 ], [ 157 ], [ 159, 161 ], [ 163 ], [ 165 ], [ 167 ], [ 171, 173, 175 ], [ 177 ] ]
14,066
int paio_init(void) { struct sigaction act; PosixAioState *s; int fds[2]; int ret; if (posix_aio_state) return 0; s = qemu_malloc(sizeof(PosixAioState)); sigfillset(&act.sa_mask); act.sa_flags = 0; /* do not restart syscalls to interrupt select() */ act.sa_handler = aio_signal_handler; sigaction(SIGUSR2, &act, NULL); s->first_aio = NULL; if (pipe(fds) == -1) { fprintf(stderr, "failed to create pipe\n"); return -1; } s->rfd = fds[0]; s->wfd = fds[1]; fcntl(s->rfd, F_SETFL, O_NONBLOCK); fcntl(s->wfd, F_SETFL, O_NONBLOCK); qemu_aio_set_fd_handler(s->rfd, posix_aio_read, NULL, posix_aio_flush, posix_aio_process_queue, s); ret = pthread_attr_init(&attr); if (ret) die2(ret, "pthread_attr_init"); ret = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); if (ret) die2(ret, "pthread_attr_setdetachstate"); QTAILQ_INIT(&request_list); posix_aio_state = s; return 0; }
true
qemu
40ff6d7e8dceca227e7f8a3e8e0d58b2c66d19b4
int paio_init(void) { struct sigaction act; PosixAioState *s; int fds[2]; int ret; if (posix_aio_state) return 0; s = qemu_malloc(sizeof(PosixAioState)); sigfillset(&act.sa_mask); act.sa_flags = 0; act.sa_handler = aio_signal_handler; sigaction(SIGUSR2, &act, NULL); s->first_aio = NULL; if (pipe(fds) == -1) { fprintf(stderr, "failed to create pipe\n"); return -1; } s->rfd = fds[0]; s->wfd = fds[1]; fcntl(s->rfd, F_SETFL, O_NONBLOCK); fcntl(s->wfd, F_SETFL, O_NONBLOCK); qemu_aio_set_fd_handler(s->rfd, posix_aio_read, NULL, posix_aio_flush, posix_aio_process_queue, s); ret = pthread_attr_init(&attr); if (ret) die2(ret, "pthread_attr_init"); ret = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); if (ret) die2(ret, "pthread_attr_setdetachstate"); QTAILQ_INIT(&request_list); posix_aio_state = s; return 0; }
{ "code": [ " if (pipe(fds) == -1) {" ], "line_no": [ 37 ] }
int FUNC_0(void) { struct sigaction VAR_0; PosixAioState *s; int VAR_1[2]; int VAR_2; if (posix_aio_state) return 0; s = qemu_malloc(sizeof(PosixAioState)); sigfillset(&VAR_0.sa_mask); VAR_0.sa_flags = 0; VAR_0.sa_handler = aio_signal_handler; sigaction(SIGUSR2, &VAR_0, NULL); s->first_aio = NULL; if (pipe(VAR_1) == -1) { fprintf(stderr, "failed to create pipe\n"); return -1; } s->rfd = VAR_1[0]; s->wfd = VAR_1[1]; fcntl(s->rfd, F_SETFL, O_NONBLOCK); fcntl(s->wfd, F_SETFL, O_NONBLOCK); qemu_aio_set_fd_handler(s->rfd, posix_aio_read, NULL, posix_aio_flush, posix_aio_process_queue, s); VAR_2 = pthread_attr_init(&attr); if (VAR_2) die2(VAR_2, "pthread_attr_init"); VAR_2 = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); if (VAR_2) die2(VAR_2, "pthread_attr_setdetachstate"); QTAILQ_INIT(&request_list); posix_aio_state = s; return 0; }
[ "int FUNC_0(void)\n{", "struct sigaction VAR_0;", "PosixAioState *s;", "int VAR_1[2];", "int VAR_2;", "if (posix_aio_state)\nreturn 0;", "s = qemu_malloc(sizeof(PosixAioState));", "sigfillset(&VAR_0.sa_mask);", "VAR_0.sa_flags = 0;", "VAR_0.sa_handler = aio_signal_handler;", "sigaction(SIGUSR2, &VAR_0, NULL);", "s->first_aio = NULL;", "if (pipe(VAR_1) == -1) {", "fprintf(stderr, \"failed to create pipe\\n\");", "return -1;", "}", "s->rfd = VAR_1[0];", "s->wfd = VAR_1[1];", "fcntl(s->rfd, F_SETFL, O_NONBLOCK);", "fcntl(s->wfd, F_SETFL, O_NONBLOCK);", "qemu_aio_set_fd_handler(s->rfd, posix_aio_read, NULL, posix_aio_flush,\nposix_aio_process_queue, s);", "VAR_2 = pthread_attr_init(&attr);", "if (VAR_2)\ndie2(VAR_2, \"pthread_attr_init\");", "VAR_2 = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);", "if (VAR_2)\ndie2(VAR_2, \"pthread_attr_setdetachstate\");", "QTAILQ_INIT(&request_list);", "posix_aio_state = s;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15, 17 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 59, 61 ], [ 65 ], [ 67, 69 ], [ 73 ], [ 75, 77 ], [ 81 ], [ 85 ], [ 87 ], [ 89 ] ]
14,067
static int set_dirty_tracking(void) { BlkMigDevState *bmds; int ret; QSIMPLEQ_FOREACH(bmds, &block_mig_state.bmds_list, entry) { bmds->dirty_bitmap = bdrv_create_dirty_bitmap(bmds->bs, BLOCK_SIZE, NULL); if (!bmds->dirty_bitmap) { ret = -errno; goto fail; } } return 0; fail: QSIMPLEQ_FOREACH(bmds, &block_mig_state.bmds_list, entry) { if (bmds->dirty_bitmap) { bdrv_release_dirty_bitmap(bmds->bs, bmds->dirty_bitmap); } } return ret; }
true
qemu
60fe637bf0e4d7989e21e50f52526444765c63b4
static int set_dirty_tracking(void) { BlkMigDevState *bmds; int ret; QSIMPLEQ_FOREACH(bmds, &block_mig_state.bmds_list, entry) { bmds->dirty_bitmap = bdrv_create_dirty_bitmap(bmds->bs, BLOCK_SIZE, NULL); if (!bmds->dirty_bitmap) { ret = -errno; goto fail; } } return 0; fail: QSIMPLEQ_FOREACH(bmds, &block_mig_state.bmds_list, entry) { if (bmds->dirty_bitmap) { bdrv_release_dirty_bitmap(bmds->bs, bmds->dirty_bitmap); } } return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(void) { BlkMigDevState *bmds; int VAR_0; QSIMPLEQ_FOREACH(bmds, &block_mig_state.bmds_list, entry) { bmds->dirty_bitmap = bdrv_create_dirty_bitmap(bmds->bs, BLOCK_SIZE, NULL); if (!bmds->dirty_bitmap) { VAR_0 = -errno; goto fail; } } return 0; fail: QSIMPLEQ_FOREACH(bmds, &block_mig_state.bmds_list, entry) { if (bmds->dirty_bitmap) { bdrv_release_dirty_bitmap(bmds->bs, bmds->dirty_bitmap); } } return VAR_0; }
[ "static int FUNC_0(void)\n{", "BlkMigDevState *bmds;", "int VAR_0;", "QSIMPLEQ_FOREACH(bmds, &block_mig_state.bmds_list, entry) {", "bmds->dirty_bitmap = bdrv_create_dirty_bitmap(bmds->bs, BLOCK_SIZE,\nNULL);", "if (!bmds->dirty_bitmap) {", "VAR_0 = -errno;", "goto fail;", "}", "}", "return 0;", "fail:\nQSIMPLEQ_FOREACH(bmds, &block_mig_state.bmds_list, entry) {", "if (bmds->dirty_bitmap) {", "bdrv_release_dirty_bitmap(bmds->bs, bmds->dirty_bitmap);", "}", "}", "return VAR_0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ] ]
14,068
static int draw_slice(AVFilterLink *link, int y, int h, int slice_dir) { SliceContext *slice = link->dst->priv; int y2, ret = 0; if (slice_dir == 1) { for (y2 = y; y2 + slice->h <= y + h; y2 += slice->h) { ret = ff_draw_slice(link->dst->outputs[0], y2, slice->h, slice_dir); if (ret < 0) return ret; } if (y2 < y + h) return ff_draw_slice(link->dst->outputs[0], y2, y + h - y2, slice_dir); } else if (slice_dir == -1) { for (y2 = y + h; y2 - slice->h >= y; y2 -= slice->h) { ret = ff_draw_slice(link->dst->outputs[0], y2 - slice->h, slice->h, slice_dir); if (ret < 0) return ret; } if (y2 > y) return ff_draw_slice(link->dst->outputs[0], y, y2 - y, slice_dir); } return 0; }
true
FFmpeg
bb6c67bb36b136de10256f0999128df4a42f9ffc
static int draw_slice(AVFilterLink *link, int y, int h, int slice_dir) { SliceContext *slice = link->dst->priv; int y2, ret = 0; if (slice_dir == 1) { for (y2 = y; y2 + slice->h <= y + h; y2 += slice->h) { ret = ff_draw_slice(link->dst->outputs[0], y2, slice->h, slice_dir); if (ret < 0) return ret; } if (y2 < y + h) return ff_draw_slice(link->dst->outputs[0], y2, y + h - y2, slice_dir); } else if (slice_dir == -1) { for (y2 = y + h; y2 - slice->h >= y; y2 -= slice->h) { ret = ff_draw_slice(link->dst->outputs[0], y2 - slice->h, slice->h, slice_dir); if (ret < 0) return ret; } if (y2 > y) return ff_draw_slice(link->dst->outputs[0], y, y2 - y, slice_dir); } return 0; }
{ "code": [ " return 0;", " SliceContext *slice = link->dst->priv;", " return 0;", " SliceContext *slice = link->dst->priv;", "static int draw_slice(AVFilterLink *link, int y, int h, int slice_dir)", " SliceContext *slice = link->dst->priv;", " int y2, ret = 0;", " if (slice_dir == 1) {", " for (y2 = y; y2 + slice->h <= y + h; y2 += slice->h) {", " ret = ff_draw_slice(link->dst->outputs[0], y2, slice->h, slice_dir);", " if (ret < 0)", " return ret;", " if (y2 < y + h)", " return ff_draw_slice(link->dst->outputs[0], y2, y + h - y2, slice_dir);", " } else if (slice_dir == -1) {", " for (y2 = y + h; y2 - slice->h >= y; y2 -= slice->h) {", " ret = ff_draw_slice(link->dst->outputs[0], y2 - slice->h, slice->h, slice_dir);", " if (ret < 0)", " return ret;", " if (y2 > y)", " return ff_draw_slice(link->dst->outputs[0], y, y2 - y, slice_dir);", " return 0;" ], "line_no": [ 49, 5, 49, 5, 1, 5, 7, 11, 13, 15, 17, 19, 25, 27, 29, 31, 33, 17, 19, 43, 45, 49 ] }
static int FUNC_0(AVFilterLink *VAR_0, int VAR_1, int VAR_2, int VAR_3) { SliceContext *slice = VAR_0->dst->priv; int VAR_4, VAR_5 = 0; if (VAR_3 == 1) { for (VAR_4 = VAR_1; VAR_4 + slice->VAR_2 <= VAR_1 + VAR_2; VAR_4 += slice->VAR_2) { VAR_5 = ff_draw_slice(VAR_0->dst->outputs[0], VAR_4, slice->VAR_2, VAR_3); if (VAR_5 < 0) return VAR_5; } if (VAR_4 < VAR_1 + VAR_2) return ff_draw_slice(VAR_0->dst->outputs[0], VAR_4, VAR_1 + VAR_2 - VAR_4, VAR_3); } else if (VAR_3 == -1) { for (VAR_4 = VAR_1 + VAR_2; VAR_4 - slice->VAR_2 >= VAR_1; VAR_4 -= slice->VAR_2) { VAR_5 = ff_draw_slice(VAR_0->dst->outputs[0], VAR_4 - slice->VAR_2, slice->VAR_2, VAR_3); if (VAR_5 < 0) return VAR_5; } if (VAR_4 > VAR_1) return ff_draw_slice(VAR_0->dst->outputs[0], VAR_1, VAR_4 - VAR_1, VAR_3); } return 0; }
[ "static int FUNC_0(AVFilterLink *VAR_0, int VAR_1, int VAR_2, int VAR_3)\n{", "SliceContext *slice = VAR_0->dst->priv;", "int VAR_4, VAR_5 = 0;", "if (VAR_3 == 1) {", "for (VAR_4 = VAR_1; VAR_4 + slice->VAR_2 <= VAR_1 + VAR_2; VAR_4 += slice->VAR_2) {", "VAR_5 = ff_draw_slice(VAR_0->dst->outputs[0], VAR_4, slice->VAR_2, VAR_3);", "if (VAR_5 < 0)\nreturn VAR_5;", "}", "if (VAR_4 < VAR_1 + VAR_2)\nreturn ff_draw_slice(VAR_0->dst->outputs[0], VAR_4, VAR_1 + VAR_2 - VAR_4, VAR_3);", "} else if (VAR_3 == -1) {", "for (VAR_4 = VAR_1 + VAR_2; VAR_4 - slice->VAR_2 >= VAR_1; VAR_4 -= slice->VAR_2) {", "VAR_5 = ff_draw_slice(VAR_0->dst->outputs[0], VAR_4 - slice->VAR_2, slice->VAR_2, VAR_3);", "if (VAR_5 < 0)\nreturn VAR_5;", "}", "if (VAR_4 > VAR_1)\nreturn ff_draw_slice(VAR_0->dst->outputs[0], VAR_1, VAR_4 - VAR_1, VAR_3);", "}", "return 0;", "}" ]
[ 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17, 19 ], [ 21 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35, 37 ], [ 39 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 51 ] ]
14,069
void cpu_check_irqs(CPUSPARCState *env) { CPUState *cs; if (env->pil_in && (env->interrupt_index == 0 || (env->interrupt_index & ~15) == TT_EXTINT)) { unsigned int i; for (i = 15; i > 0; i--) { if (env->pil_in & (1 << i)) { int old_interrupt = env->interrupt_index; env->interrupt_index = TT_EXTINT | i; if (old_interrupt != env->interrupt_index) { cs = CPU(sparc_env_get_cpu(env)); trace_sun4m_cpu_interrupt(i); cpu_interrupt(cs, CPU_INTERRUPT_HARD); } break; } } } else if (!env->pil_in && (env->interrupt_index & ~15) == TT_EXTINT) { cs = CPU(sparc_env_get_cpu(env)); trace_sun4m_cpu_reset_interrupt(env->interrupt_index & 15); env->interrupt_index = 0; cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD); } }
true
qemu
5ee5993001cf32addb86a92e2ae8cb090fbc1462
void cpu_check_irqs(CPUSPARCState *env) { CPUState *cs; if (env->pil_in && (env->interrupt_index == 0 || (env->interrupt_index & ~15) == TT_EXTINT)) { unsigned int i; for (i = 15; i > 0; i--) { if (env->pil_in & (1 << i)) { int old_interrupt = env->interrupt_index; env->interrupt_index = TT_EXTINT | i; if (old_interrupt != env->interrupt_index) { cs = CPU(sparc_env_get_cpu(env)); trace_sun4m_cpu_interrupt(i); cpu_interrupt(cs, CPU_INTERRUPT_HARD); } break; } } } else if (!env->pil_in && (env->interrupt_index & ~15) == TT_EXTINT) { cs = CPU(sparc_env_get_cpu(env)); trace_sun4m_cpu_reset_interrupt(env->interrupt_index & 15); env->interrupt_index = 0; cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD); } }
{ "code": [], "line_no": [] }
void FUNC_0(CPUSPARCState *VAR_0) { CPUState *cs; if (VAR_0->pil_in && (VAR_0->interrupt_index == 0 || (VAR_0->interrupt_index & ~15) == TT_EXTINT)) { unsigned int VAR_1; for (VAR_1 = 15; VAR_1 > 0; VAR_1--) { if (VAR_0->pil_in & (1 << VAR_1)) { int VAR_2 = VAR_0->interrupt_index; VAR_0->interrupt_index = TT_EXTINT | VAR_1; if (VAR_2 != VAR_0->interrupt_index) { cs = CPU(sparc_env_get_cpu(VAR_0)); trace_sun4m_cpu_interrupt(VAR_1); cpu_interrupt(cs, CPU_INTERRUPT_HARD); } break; } } } else if (!VAR_0->pil_in && (VAR_0->interrupt_index & ~15) == TT_EXTINT) { cs = CPU(sparc_env_get_cpu(VAR_0)); trace_sun4m_cpu_reset_interrupt(VAR_0->interrupt_index & 15); VAR_0->interrupt_index = 0; cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD); } }
[ "void FUNC_0(CPUSPARCState *VAR_0)\n{", "CPUState *cs;", "if (VAR_0->pil_in && (VAR_0->interrupt_index == 0 ||\n(VAR_0->interrupt_index & ~15) == TT_EXTINT)) {", "unsigned int VAR_1;", "for (VAR_1 = 15; VAR_1 > 0; VAR_1--) {", "if (VAR_0->pil_in & (1 << VAR_1)) {", "int VAR_2 = VAR_0->interrupt_index;", "VAR_0->interrupt_index = TT_EXTINT | VAR_1;", "if (VAR_2 != VAR_0->interrupt_index) {", "cs = CPU(sparc_env_get_cpu(VAR_0));", "trace_sun4m_cpu_interrupt(VAR_1);", "cpu_interrupt(cs, CPU_INTERRUPT_HARD);", "}", "break;", "}", "}", "} else if (!VAR_0->pil_in && (VAR_0->interrupt_index & ~15) == TT_EXTINT) {", "cs = CPU(sparc_env_get_cpu(VAR_0));", "trace_sun4m_cpu_reset_interrupt(VAR_0->interrupt_index & 15);", "VAR_0->interrupt_index = 0;", "cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2 ], [ 3 ], [ 4, 5 ], [ 6 ], [ 7 ], [ 8 ], [ 9 ], [ 10 ], [ 11 ], [ 12 ], [ 13 ], [ 14 ], [ 15 ], [ 16 ], [ 17 ], [ 18 ], [ 19 ], [ 20 ], [ 21 ], [ 22 ], [ 23 ], [ 24 ], [ 25 ] ]