id
int32
0
27.3k
func
stringlengths
26
142k
target
bool
2 classes
project
stringclasses
2 values
commit_id
stringlengths
40
40
func_clean
stringlengths
26
131k
vul_lines
dict
normalized_func
stringlengths
24
132k
lines
sequencelengths
1
2.8k
label
sequencelengths
1
2.8k
line_no
sequencelengths
1
2.8k
26,371
static int qemu_gluster_parse_json(BlockdevOptionsGluster *gconf, QDict *options, Error **errp) { QemuOpts *opts; SocketAddress *gsconf = NULL; SocketAddressList *curr = NULL; QDict *backing_options = NULL; Error *local_err = NULL; char *str = NULL; const char *ptr; size_t num_servers; int i, type; /* create opts info from runtime_json_opts list */ opts = qemu_opts_create(&runtime_json_opts, NULL, 0, &error_abort); qemu_opts_absorb_qdict(opts, options, &local_err); if (local_err) { goto out; } num_servers = qdict_array_entries(options, GLUSTER_OPT_SERVER_PATTERN); if (num_servers < 1) { error_setg(&local_err, QERR_MISSING_PARAMETER, "server"); goto out; } ptr = qemu_opt_get(opts, GLUSTER_OPT_VOLUME); if (!ptr) { error_setg(&local_err, QERR_MISSING_PARAMETER, GLUSTER_OPT_VOLUME); goto out; } gconf->volume = g_strdup(ptr); ptr = qemu_opt_get(opts, GLUSTER_OPT_PATH); if (!ptr) { error_setg(&local_err, QERR_MISSING_PARAMETER, GLUSTER_OPT_PATH); goto out; } gconf->path = g_strdup(ptr); qemu_opts_del(opts); for (i = 0; i < num_servers; i++) { str = g_strdup_printf(GLUSTER_OPT_SERVER_PATTERN"%d.", i); qdict_extract_subqdict(options, &backing_options, str); /* create opts info from runtime_type_opts list */ opts = qemu_opts_create(&runtime_type_opts, NULL, 0, &error_abort); qemu_opts_absorb_qdict(opts, backing_options, &local_err); if (local_err) { goto out; } ptr = qemu_opt_get(opts, GLUSTER_OPT_TYPE); if (!ptr) { error_setg(&local_err, QERR_MISSING_PARAMETER, GLUSTER_OPT_TYPE); error_append_hint(&local_err, GERR_INDEX_HINT, i); goto out; } gsconf = g_new0(SocketAddress, 1); if (!strcmp(ptr, "tcp")) { ptr = "inet"; /* accept legacy "tcp" */ } type = qapi_enum_parse(SocketAddressType_lookup, ptr, SOCKET_ADDRESS_TYPE__MAX, -1, NULL); if (type != SOCKET_ADDRESS_TYPE_INET && type != SOCKET_ADDRESS_TYPE_UNIX) { error_setg(&local_err, "Parameter '%s' may be 'inet' or 'unix'", GLUSTER_OPT_TYPE); error_append_hint(&local_err, GERR_INDEX_HINT, i); goto out; } gsconf->type = type; qemu_opts_del(opts); if (gsconf->type == SOCKET_ADDRESS_TYPE_INET) { /* create opts info from runtime_inet_opts list */ opts = qemu_opts_create(&runtime_inet_opts, NULL, 0, &error_abort); qemu_opts_absorb_qdict(opts, backing_options, &local_err); if (local_err) { goto out; } ptr = qemu_opt_get(opts, GLUSTER_OPT_HOST); if (!ptr) { error_setg(&local_err, QERR_MISSING_PARAMETER, GLUSTER_OPT_HOST); error_append_hint(&local_err, GERR_INDEX_HINT, i); goto out; } gsconf->u.inet.host = g_strdup(ptr); ptr = qemu_opt_get(opts, GLUSTER_OPT_PORT); if (!ptr) { error_setg(&local_err, QERR_MISSING_PARAMETER, GLUSTER_OPT_PORT); error_append_hint(&local_err, GERR_INDEX_HINT, i); goto out; } gsconf->u.inet.port = g_strdup(ptr); /* defend for unsupported fields in InetSocketAddress, * i.e. @ipv4, @ipv6 and @to */ ptr = qemu_opt_get(opts, GLUSTER_OPT_TO); if (ptr) { gsconf->u.inet.has_to = true; } ptr = qemu_opt_get(opts, GLUSTER_OPT_IPV4); if (ptr) { gsconf->u.inet.has_ipv4 = true; } ptr = qemu_opt_get(opts, GLUSTER_OPT_IPV6); if (ptr) { gsconf->u.inet.has_ipv6 = true; } if (gsconf->u.inet.has_to) { error_setg(&local_err, "Parameter 'to' not supported"); goto out; } if (gsconf->u.inet.has_ipv4 || gsconf->u.inet.has_ipv6) { error_setg(&local_err, "Parameters 'ipv4/ipv6' not supported"); goto out; } qemu_opts_del(opts); } else { /* create opts info from runtime_unix_opts list */ opts = qemu_opts_create(&runtime_unix_opts, NULL, 0, &error_abort); qemu_opts_absorb_qdict(opts, backing_options, &local_err); if (local_err) { goto out; } ptr = qemu_opt_get(opts, GLUSTER_OPT_SOCKET); if (!ptr) { error_setg(&local_err, QERR_MISSING_PARAMETER, GLUSTER_OPT_SOCKET); error_append_hint(&local_err, GERR_INDEX_HINT, i); goto out; } gsconf->u.q_unix.path = g_strdup(ptr); qemu_opts_del(opts); } if (gconf->server == NULL) { gconf->server = g_new0(SocketAddressList, 1); gconf->server->value = gsconf; curr = gconf->server; } else { curr->next = g_new0(SocketAddressList, 1); curr->next->value = gsconf; curr = curr->next; } gsconf = NULL; QDECREF(backing_options); backing_options = NULL; g_free(str); str = NULL; } return 0; out: error_propagate(errp, local_err); qapi_free_SocketAddress(gsconf); qemu_opts_del(opts); g_free(str); QDECREF(backing_options); errno = EINVAL; return -errno; }
true
qemu
56faeb9bb6872b3f926b3b3e0452a70beea10af2
static int qemu_gluster_parse_json(BlockdevOptionsGluster *gconf, QDict *options, Error **errp) { QemuOpts *opts; SocketAddress *gsconf = NULL; SocketAddressList *curr = NULL; QDict *backing_options = NULL; Error *local_err = NULL; char *str = NULL; const char *ptr; size_t num_servers; int i, type; opts = qemu_opts_create(&runtime_json_opts, NULL, 0, &error_abort); qemu_opts_absorb_qdict(opts, options, &local_err); if (local_err) { goto out; } num_servers = qdict_array_entries(options, GLUSTER_OPT_SERVER_PATTERN); if (num_servers < 1) { error_setg(&local_err, QERR_MISSING_PARAMETER, "server"); goto out; } ptr = qemu_opt_get(opts, GLUSTER_OPT_VOLUME); if (!ptr) { error_setg(&local_err, QERR_MISSING_PARAMETER, GLUSTER_OPT_VOLUME); goto out; } gconf->volume = g_strdup(ptr); ptr = qemu_opt_get(opts, GLUSTER_OPT_PATH); if (!ptr) { error_setg(&local_err, QERR_MISSING_PARAMETER, GLUSTER_OPT_PATH); goto out; } gconf->path = g_strdup(ptr); qemu_opts_del(opts); for (i = 0; i < num_servers; i++) { str = g_strdup_printf(GLUSTER_OPT_SERVER_PATTERN"%d.", i); qdict_extract_subqdict(options, &backing_options, str); opts = qemu_opts_create(&runtime_type_opts, NULL, 0, &error_abort); qemu_opts_absorb_qdict(opts, backing_options, &local_err); if (local_err) { goto out; } ptr = qemu_opt_get(opts, GLUSTER_OPT_TYPE); if (!ptr) { error_setg(&local_err, QERR_MISSING_PARAMETER, GLUSTER_OPT_TYPE); error_append_hint(&local_err, GERR_INDEX_HINT, i); goto out; } gsconf = g_new0(SocketAddress, 1); if (!strcmp(ptr, "tcp")) { ptr = "inet"; } type = qapi_enum_parse(SocketAddressType_lookup, ptr, SOCKET_ADDRESS_TYPE__MAX, -1, NULL); if (type != SOCKET_ADDRESS_TYPE_INET && type != SOCKET_ADDRESS_TYPE_UNIX) { error_setg(&local_err, "Parameter '%s' may be 'inet' or 'unix'", GLUSTER_OPT_TYPE); error_append_hint(&local_err, GERR_INDEX_HINT, i); goto out; } gsconf->type = type; qemu_opts_del(opts); if (gsconf->type == SOCKET_ADDRESS_TYPE_INET) { opts = qemu_opts_create(&runtime_inet_opts, NULL, 0, &error_abort); qemu_opts_absorb_qdict(opts, backing_options, &local_err); if (local_err) { goto out; } ptr = qemu_opt_get(opts, GLUSTER_OPT_HOST); if (!ptr) { error_setg(&local_err, QERR_MISSING_PARAMETER, GLUSTER_OPT_HOST); error_append_hint(&local_err, GERR_INDEX_HINT, i); goto out; } gsconf->u.inet.host = g_strdup(ptr); ptr = qemu_opt_get(opts, GLUSTER_OPT_PORT); if (!ptr) { error_setg(&local_err, QERR_MISSING_PARAMETER, GLUSTER_OPT_PORT); error_append_hint(&local_err, GERR_INDEX_HINT, i); goto out; } gsconf->u.inet.port = g_strdup(ptr); ptr = qemu_opt_get(opts, GLUSTER_OPT_TO); if (ptr) { gsconf->u.inet.has_to = true; } ptr = qemu_opt_get(opts, GLUSTER_OPT_IPV4); if (ptr) { gsconf->u.inet.has_ipv4 = true; } ptr = qemu_opt_get(opts, GLUSTER_OPT_IPV6); if (ptr) { gsconf->u.inet.has_ipv6 = true; } if (gsconf->u.inet.has_to) { error_setg(&local_err, "Parameter 'to' not supported"); goto out; } if (gsconf->u.inet.has_ipv4 || gsconf->u.inet.has_ipv6) { error_setg(&local_err, "Parameters 'ipv4/ipv6' not supported"); goto out; } qemu_opts_del(opts); } else { opts = qemu_opts_create(&runtime_unix_opts, NULL, 0, &error_abort); qemu_opts_absorb_qdict(opts, backing_options, &local_err); if (local_err) { goto out; } ptr = qemu_opt_get(opts, GLUSTER_OPT_SOCKET); if (!ptr) { error_setg(&local_err, QERR_MISSING_PARAMETER, GLUSTER_OPT_SOCKET); error_append_hint(&local_err, GERR_INDEX_HINT, i); goto out; } gsconf->u.q_unix.path = g_strdup(ptr); qemu_opts_del(opts); } if (gconf->server == NULL) { gconf->server = g_new0(SocketAddressList, 1); gconf->server->value = gsconf; curr = gconf->server; } else { curr->next = g_new0(SocketAddressList, 1); curr->next->value = gsconf; curr = curr->next; } gsconf = NULL; QDECREF(backing_options); backing_options = NULL; g_free(str); str = NULL; } return 0; out: error_propagate(errp, local_err); qapi_free_SocketAddress(gsconf); qemu_opts_del(opts); g_free(str); QDECREF(backing_options); errno = EINVAL; return -errno; }
{ "code": [ " size_t num_servers;", " int i, type;" ], "line_no": [ 21, 23 ] }
static int FUNC_0(BlockdevOptionsGluster *VAR_0, QDict *VAR_1, Error **VAR_2) { QemuOpts *opts; SocketAddress *gsconf = NULL; SocketAddressList *curr = NULL; QDict *backing_options = NULL; Error *local_err = NULL; char *VAR_3 = NULL; const char *VAR_4; size_t num_servers; int VAR_5, VAR_6; opts = qemu_opts_create(&runtime_json_opts, NULL, 0, &error_abort); qemu_opts_absorb_qdict(opts, VAR_1, &local_err); if (local_err) { goto out; } num_servers = qdict_array_entries(VAR_1, GLUSTER_OPT_SERVER_PATTERN); if (num_servers < 1) { error_setg(&local_err, QERR_MISSING_PARAMETER, "server"); goto out; } VAR_4 = qemu_opt_get(opts, GLUSTER_OPT_VOLUME); if (!VAR_4) { error_setg(&local_err, QERR_MISSING_PARAMETER, GLUSTER_OPT_VOLUME); goto out; } VAR_0->volume = g_strdup(VAR_4); VAR_4 = qemu_opt_get(opts, GLUSTER_OPT_PATH); if (!VAR_4) { error_setg(&local_err, QERR_MISSING_PARAMETER, GLUSTER_OPT_PATH); goto out; } VAR_0->path = g_strdup(VAR_4); qemu_opts_del(opts); for (VAR_5 = 0; VAR_5 < num_servers; VAR_5++) { VAR_3 = g_strdup_printf(GLUSTER_OPT_SERVER_PATTERN"%d.", VAR_5); qdict_extract_subqdict(VAR_1, &backing_options, VAR_3); opts = qemu_opts_create(&runtime_type_opts, NULL, 0, &error_abort); qemu_opts_absorb_qdict(opts, backing_options, &local_err); if (local_err) { goto out; } VAR_4 = qemu_opt_get(opts, GLUSTER_OPT_TYPE); if (!VAR_4) { error_setg(&local_err, QERR_MISSING_PARAMETER, GLUSTER_OPT_TYPE); error_append_hint(&local_err, GERR_INDEX_HINT, VAR_5); goto out; } gsconf = g_new0(SocketAddress, 1); if (!strcmp(VAR_4, "tcp")) { VAR_4 = "inet"; } VAR_6 = qapi_enum_parse(SocketAddressType_lookup, VAR_4, SOCKET_ADDRESS_TYPE__MAX, -1, NULL); if (VAR_6 != SOCKET_ADDRESS_TYPE_INET && VAR_6 != SOCKET_ADDRESS_TYPE_UNIX) { error_setg(&local_err, "Parameter '%s' may be 'inet' or 'unix'", GLUSTER_OPT_TYPE); error_append_hint(&local_err, GERR_INDEX_HINT, VAR_5); goto out; } gsconf->VAR_6 = VAR_6; qemu_opts_del(opts); if (gsconf->VAR_6 == SOCKET_ADDRESS_TYPE_INET) { opts = qemu_opts_create(&runtime_inet_opts, NULL, 0, &error_abort); qemu_opts_absorb_qdict(opts, backing_options, &local_err); if (local_err) { goto out; } VAR_4 = qemu_opt_get(opts, GLUSTER_OPT_HOST); if (!VAR_4) { error_setg(&local_err, QERR_MISSING_PARAMETER, GLUSTER_OPT_HOST); error_append_hint(&local_err, GERR_INDEX_HINT, VAR_5); goto out; } gsconf->u.inet.host = g_strdup(VAR_4); VAR_4 = qemu_opt_get(opts, GLUSTER_OPT_PORT); if (!VAR_4) { error_setg(&local_err, QERR_MISSING_PARAMETER, GLUSTER_OPT_PORT); error_append_hint(&local_err, GERR_INDEX_HINT, VAR_5); goto out; } gsconf->u.inet.port = g_strdup(VAR_4); VAR_4 = qemu_opt_get(opts, GLUSTER_OPT_TO); if (VAR_4) { gsconf->u.inet.has_to = true; } VAR_4 = qemu_opt_get(opts, GLUSTER_OPT_IPV4); if (VAR_4) { gsconf->u.inet.has_ipv4 = true; } VAR_4 = qemu_opt_get(opts, GLUSTER_OPT_IPV6); if (VAR_4) { gsconf->u.inet.has_ipv6 = true; } if (gsconf->u.inet.has_to) { error_setg(&local_err, "Parameter 'to' not supported"); goto out; } if (gsconf->u.inet.has_ipv4 || gsconf->u.inet.has_ipv6) { error_setg(&local_err, "Parameters 'ipv4/ipv6' not supported"); goto out; } qemu_opts_del(opts); } else { opts = qemu_opts_create(&runtime_unix_opts, NULL, 0, &error_abort); qemu_opts_absorb_qdict(opts, backing_options, &local_err); if (local_err) { goto out; } VAR_4 = qemu_opt_get(opts, GLUSTER_OPT_SOCKET); if (!VAR_4) { error_setg(&local_err, QERR_MISSING_PARAMETER, GLUSTER_OPT_SOCKET); error_append_hint(&local_err, GERR_INDEX_HINT, VAR_5); goto out; } gsconf->u.q_unix.path = g_strdup(VAR_4); qemu_opts_del(opts); } if (VAR_0->server == NULL) { VAR_0->server = g_new0(SocketAddressList, 1); VAR_0->server->value = gsconf; curr = VAR_0->server; } else { curr->next = g_new0(SocketAddressList, 1); curr->next->value = gsconf; curr = curr->next; } gsconf = NULL; QDECREF(backing_options); backing_options = NULL; g_free(VAR_3); VAR_3 = NULL; } return 0; out: error_propagate(VAR_2, local_err); qapi_free_SocketAddress(gsconf); qemu_opts_del(opts); g_free(VAR_3); QDECREF(backing_options); errno = EINVAL; return -errno; }
[ "static int FUNC_0(BlockdevOptionsGluster *VAR_0,\nQDict *VAR_1, Error **VAR_2)\n{", "QemuOpts *opts;", "SocketAddress *gsconf = NULL;", "SocketAddressList *curr = NULL;", "QDict *backing_options = NULL;", "Error *local_err = NULL;", "char *VAR_3 = NULL;", "const char *VAR_4;", "size_t num_servers;", "int VAR_5, VAR_6;", "opts = qemu_opts_create(&runtime_json_opts, NULL, 0, &error_abort);", "qemu_opts_absorb_qdict(opts, VAR_1, &local_err);", "if (local_err) {", "goto out;", "}", "num_servers = qdict_array_entries(VAR_1, GLUSTER_OPT_SERVER_PATTERN);", "if (num_servers < 1) {", "error_setg(&local_err, QERR_MISSING_PARAMETER, \"server\");", "goto out;", "}", "VAR_4 = qemu_opt_get(opts, GLUSTER_OPT_VOLUME);", "if (!VAR_4) {", "error_setg(&local_err, QERR_MISSING_PARAMETER, GLUSTER_OPT_VOLUME);", "goto out;", "}", "VAR_0->volume = g_strdup(VAR_4);", "VAR_4 = qemu_opt_get(opts, GLUSTER_OPT_PATH);", "if (!VAR_4) {", "error_setg(&local_err, QERR_MISSING_PARAMETER, GLUSTER_OPT_PATH);", "goto out;", "}", "VAR_0->path = g_strdup(VAR_4);", "qemu_opts_del(opts);", "for (VAR_5 = 0; VAR_5 < num_servers; VAR_5++) {", "VAR_3 = g_strdup_printf(GLUSTER_OPT_SERVER_PATTERN\"%d.\", VAR_5);", "qdict_extract_subqdict(VAR_1, &backing_options, VAR_3);", "opts = qemu_opts_create(&runtime_type_opts, NULL, 0, &error_abort);", "qemu_opts_absorb_qdict(opts, backing_options, &local_err);", "if (local_err) {", "goto out;", "}", "VAR_4 = qemu_opt_get(opts, GLUSTER_OPT_TYPE);", "if (!VAR_4) {", "error_setg(&local_err, QERR_MISSING_PARAMETER, GLUSTER_OPT_TYPE);", "error_append_hint(&local_err, GERR_INDEX_HINT, VAR_5);", "goto out;", "}", "gsconf = g_new0(SocketAddress, 1);", "if (!strcmp(VAR_4, \"tcp\")) {", "VAR_4 = \"inet\";", "}", "VAR_6 = qapi_enum_parse(SocketAddressType_lookup, VAR_4,\nSOCKET_ADDRESS_TYPE__MAX, -1, NULL);", "if (VAR_6 != SOCKET_ADDRESS_TYPE_INET\n&& VAR_6 != SOCKET_ADDRESS_TYPE_UNIX) {", "error_setg(&local_err,\n\"Parameter '%s' may be 'inet' or 'unix'\",\nGLUSTER_OPT_TYPE);", "error_append_hint(&local_err, GERR_INDEX_HINT, VAR_5);", "goto out;", "}", "gsconf->VAR_6 = VAR_6;", "qemu_opts_del(opts);", "if (gsconf->VAR_6 == SOCKET_ADDRESS_TYPE_INET) {", "opts = qemu_opts_create(&runtime_inet_opts, NULL, 0, &error_abort);", "qemu_opts_absorb_qdict(opts, backing_options, &local_err);", "if (local_err) {", "goto out;", "}", "VAR_4 = qemu_opt_get(opts, GLUSTER_OPT_HOST);", "if (!VAR_4) {", "error_setg(&local_err, QERR_MISSING_PARAMETER,\nGLUSTER_OPT_HOST);", "error_append_hint(&local_err, GERR_INDEX_HINT, VAR_5);", "goto out;", "}", "gsconf->u.inet.host = g_strdup(VAR_4);", "VAR_4 = qemu_opt_get(opts, GLUSTER_OPT_PORT);", "if (!VAR_4) {", "error_setg(&local_err, QERR_MISSING_PARAMETER,\nGLUSTER_OPT_PORT);", "error_append_hint(&local_err, GERR_INDEX_HINT, VAR_5);", "goto out;", "}", "gsconf->u.inet.port = g_strdup(VAR_4);", "VAR_4 = qemu_opt_get(opts, GLUSTER_OPT_TO);", "if (VAR_4) {", "gsconf->u.inet.has_to = true;", "}", "VAR_4 = qemu_opt_get(opts, GLUSTER_OPT_IPV4);", "if (VAR_4) {", "gsconf->u.inet.has_ipv4 = true;", "}", "VAR_4 = qemu_opt_get(opts, GLUSTER_OPT_IPV6);", "if (VAR_4) {", "gsconf->u.inet.has_ipv6 = true;", "}", "if (gsconf->u.inet.has_to) {", "error_setg(&local_err, \"Parameter 'to' not supported\");", "goto out;", "}", "if (gsconf->u.inet.has_ipv4 || gsconf->u.inet.has_ipv6) {", "error_setg(&local_err, \"Parameters 'ipv4/ipv6' not supported\");", "goto out;", "}", "qemu_opts_del(opts);", "} else {", "opts = qemu_opts_create(&runtime_unix_opts, NULL, 0, &error_abort);", "qemu_opts_absorb_qdict(opts, backing_options, &local_err);", "if (local_err) {", "goto out;", "}", "VAR_4 = qemu_opt_get(opts, GLUSTER_OPT_SOCKET);", "if (!VAR_4) {", "error_setg(&local_err, QERR_MISSING_PARAMETER,\nGLUSTER_OPT_SOCKET);", "error_append_hint(&local_err, GERR_INDEX_HINT, VAR_5);", "goto out;", "}", "gsconf->u.q_unix.path = g_strdup(VAR_4);", "qemu_opts_del(opts);", "}", "if (VAR_0->server == NULL) {", "VAR_0->server = g_new0(SocketAddressList, 1);", "VAR_0->server->value = gsconf;", "curr = VAR_0->server;", "} else {", "curr->next = g_new0(SocketAddressList, 1);", "curr->next->value = gsconf;", "curr = curr->next;", "}", "gsconf = NULL;", "QDECREF(backing_options);", "backing_options = NULL;", "g_free(VAR_3);", "VAR_3 = NULL;", "}", "return 0;", "out:\nerror_propagate(VAR_2, local_err);", "qapi_free_SocketAddress(gsconf);", "qemu_opts_del(opts);", "g_free(VAR_3);", "QDECREF(backing_options);", "errno = EINVAL;", "return -errno;", "}" ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 85 ], [ 87 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127, 129 ], [ 131, 133 ], [ 135, 137, 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 153 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 169 ], [ 171 ], [ 173, 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189, 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 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 ], [ 267 ], [ 269 ], [ 271, 273 ], [ 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 289 ], [ 291 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305 ], [ 307 ], [ 311 ], [ 313 ], [ 315 ], [ 317 ], [ 319 ], [ 323 ], [ 327, 329 ], [ 331 ], [ 333 ], [ 335 ], [ 337 ], [ 339 ], [ 341 ], [ 343 ] ]
26,373
static int try_seek_hole(BlockDriverState *bs, off_t start, off_t *data, off_t *hole) { #if defined SEEK_HOLE && defined SEEK_DATA BDRVRawState *s = bs->opaque; *hole = lseek(s->fd, start, SEEK_HOLE); if (*hole == -1) { return -errno; } if (*hole > start) { *data = start; } else { /* On a hole. We need another syscall to find its end. */ *data = lseek(s->fd, start, SEEK_DATA); if (*data == -1) { *data = lseek(s->fd, 0, SEEK_END); } } return 0; #else return -ENOTSUP; #endif }
true
qemu
d1f06fe665acdd7aa7a46a5ef88172c3d7d3028e
static int try_seek_hole(BlockDriverState *bs, off_t start, off_t *data, off_t *hole) { #if defined SEEK_HOLE && defined SEEK_DATA BDRVRawState *s = bs->opaque; *hole = lseek(s->fd, start, SEEK_HOLE); if (*hole == -1) { return -errno; } if (*hole > start) { *data = start; } else { *data = lseek(s->fd, start, SEEK_DATA); if (*data == -1) { *data = lseek(s->fd, 0, SEEK_END); } } return 0; #else return -ENOTSUP; #endif }
{ "code": [ "static int try_seek_hole(BlockDriverState *bs, off_t start, off_t *data,", " off_t *hole)", " *hole = lseek(s->fd, start, SEEK_HOLE);", " if (*hole == -1) {", " return -errno;", " if (*hole > start) {", " } else {", " *data = lseek(s->fd, start, SEEK_DATA);", " if (*data == -1) {", " *data = lseek(s->fd, 0, SEEK_END);", " return 0;" ], "line_no": [ 1, 3, 13, 15, 17, 23, 27, 31, 33, 35, 43 ] }
static int FUNC_0(BlockDriverState *VAR_0, off_t VAR_1, off_t *VAR_2, off_t *VAR_3) { #if defined SEEK_HOLE && defined SEEK_DATA BDRVRawState *s = VAR_0->opaque; *VAR_3 = lseek(s->fd, VAR_1, SEEK_HOLE); if (*VAR_3 == -1) { return -errno; } if (*VAR_3 > VAR_1) { *VAR_2 = VAR_1; } else { *VAR_2 = lseek(s->fd, VAR_1, SEEK_DATA); if (*VAR_2 == -1) { *VAR_2 = lseek(s->fd, 0, SEEK_END); } } return 0; #else return -ENOTSUP; #endif }
[ "static int FUNC_0(BlockDriverState *VAR_0, off_t VAR_1, off_t *VAR_2,\noff_t *VAR_3)\n{", "#if defined SEEK_HOLE && defined SEEK_DATA\nBDRVRawState *s = VAR_0->opaque;", "*VAR_3 = lseek(s->fd, VAR_1, SEEK_HOLE);", "if (*VAR_3 == -1) {", "return -errno;", "}", "if (*VAR_3 > VAR_1) {", "*VAR_2 = VAR_1;", "} else {", "*VAR_2 = lseek(s->fd, VAR_1, SEEK_DATA);", "if (*VAR_2 == -1) {", "*VAR_2 = lseek(s->fd, 0, SEEK_END);", "}", "}", "return 0;", "#else\nreturn -ENOTSUP;", "#endif\n}" ]
[ 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0 ]
[ [ 1, 3, 5 ], [ 7, 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45, 47 ], [ 49, 51 ] ]
26,374
static int net_client_init(const char *str) { const char *p; char *q; char device[64]; char buf[1024]; int vlan_id, ret; VLANState *vlan; p = str; q = device; while (*p != '\0' && *p != ',') { if ((q - device) < sizeof(device) - 1) *q++ = *p; p++; } *q = '\0'; if (*p == ',') p++; vlan_id = 0; if (get_param_value(buf, sizeof(buf), "vlan", p)) { vlan_id = strtol(buf, NULL, 0); } vlan = qemu_find_vlan(vlan_id); if (!vlan) { fprintf(stderr, "Could not create vlan %d\n", vlan_id); return -1; } if (!strcmp(device, "nic")) { NICInfo *nd; uint8_t *macaddr; if (nb_nics >= MAX_NICS) { fprintf(stderr, "Too Many NICs\n"); return -1; } nd = &nd_table[nb_nics]; macaddr = nd->macaddr; macaddr[0] = 0x52; macaddr[1] = 0x54; macaddr[2] = 0x00; macaddr[3] = 0x12; macaddr[4] = 0x34; macaddr[5] = 0x56 + nb_nics; if (get_param_value(buf, sizeof(buf), "macaddr", p)) { if (parse_macaddr(macaddr, buf) < 0) { fprintf(stderr, "invalid syntax for ethernet address\n"); return -1; } } if (get_param_value(buf, sizeof(buf), "model", p)) { nd->model = strdup(buf); } nd->vlan = vlan; nb_nics++; vlan->nb_guest_devs++; ret = 0; } else if (!strcmp(device, "none")) { /* does nothing. It is needed to signal that no network cards are wanted */ ret = 0; } else #ifdef CONFIG_SLIRP if (!strcmp(device, "user")) { if (get_param_value(buf, sizeof(buf), "hostname", p)) { pstrcpy(slirp_hostname, sizeof(slirp_hostname), buf); } ret = net_slirp_init(vlan); } else #endif #ifdef _WIN32 if (!strcmp(device, "tap")) { char ifname[64]; if (get_param_value(ifname, sizeof(ifname), "ifname", p) <= 0) { fprintf(stderr, "tap: no interface name\n"); return -1; } ret = tap_win32_init(vlan, ifname); } else #else if (!strcmp(device, "tap")) { char ifname[64]; char setup_script[1024]; int fd; if (get_param_value(buf, sizeof(buf), "fd", p) > 0) { fd = strtol(buf, NULL, 0); ret = -1; if (net_tap_fd_init(vlan, fd)) ret = 0; } else { if (get_param_value(ifname, sizeof(ifname), "ifname", p) <= 0) { ifname[0] = '\0'; } if (get_param_value(setup_script, sizeof(setup_script), "script", p) == 0) { pstrcpy(setup_script, sizeof(setup_script), DEFAULT_NETWORK_SCRIPT); } ret = net_tap_init(vlan, ifname, setup_script); } } else #endif if (!strcmp(device, "socket")) { if (get_param_value(buf, sizeof(buf), "fd", p) > 0) { int fd; fd = strtol(buf, NULL, 0); ret = -1; if (net_socket_fd_init(vlan, fd, 1)) ret = 0; } else if (get_param_value(buf, sizeof(buf), "listen", p) > 0) { ret = net_socket_listen_init(vlan, buf); } else if (get_param_value(buf, sizeof(buf), "connect", p) > 0) { ret = net_socket_connect_init(vlan, buf); } else if (get_param_value(buf, sizeof(buf), "mcast", p) > 0) { ret = net_socket_mcast_init(vlan, buf); } else { fprintf(stderr, "Unknown socket options: %s\n", p); return -1; } } else { fprintf(stderr, "Unknown network device: %s\n", device); return -1; } if (ret < 0) { fprintf(stderr, "Could not initialize device '%s'\n", device); } return ret; }
true
qemu
833c7174ce5145397d2b3405f6857ca607fed1f1
static int net_client_init(const char *str) { const char *p; char *q; char device[64]; char buf[1024]; int vlan_id, ret; VLANState *vlan; p = str; q = device; while (*p != '\0' && *p != ',') { if ((q - device) < sizeof(device) - 1) *q++ = *p; p++; } *q = '\0'; if (*p == ',') p++; vlan_id = 0; if (get_param_value(buf, sizeof(buf), "vlan", p)) { vlan_id = strtol(buf, NULL, 0); } vlan = qemu_find_vlan(vlan_id); if (!vlan) { fprintf(stderr, "Could not create vlan %d\n", vlan_id); return -1; } if (!strcmp(device, "nic")) { NICInfo *nd; uint8_t *macaddr; if (nb_nics >= MAX_NICS) { fprintf(stderr, "Too Many NICs\n"); return -1; } nd = &nd_table[nb_nics]; macaddr = nd->macaddr; macaddr[0] = 0x52; macaddr[1] = 0x54; macaddr[2] = 0x00; macaddr[3] = 0x12; macaddr[4] = 0x34; macaddr[5] = 0x56 + nb_nics; if (get_param_value(buf, sizeof(buf), "macaddr", p)) { if (parse_macaddr(macaddr, buf) < 0) { fprintf(stderr, "invalid syntax for ethernet address\n"); return -1; } } if (get_param_value(buf, sizeof(buf), "model", p)) { nd->model = strdup(buf); } nd->vlan = vlan; nb_nics++; vlan->nb_guest_devs++; ret = 0; } else if (!strcmp(device, "none")) { ret = 0; } else #ifdef CONFIG_SLIRP if (!strcmp(device, "user")) { if (get_param_value(buf, sizeof(buf), "hostname", p)) { pstrcpy(slirp_hostname, sizeof(slirp_hostname), buf); } ret = net_slirp_init(vlan); } else #endif #ifdef _WIN32 if (!strcmp(device, "tap")) { char ifname[64]; if (get_param_value(ifname, sizeof(ifname), "ifname", p) <= 0) { fprintf(stderr, "tap: no interface name\n"); return -1; } ret = tap_win32_init(vlan, ifname); } else #else if (!strcmp(device, "tap")) { char ifname[64]; char setup_script[1024]; int fd; if (get_param_value(buf, sizeof(buf), "fd", p) > 0) { fd = strtol(buf, NULL, 0); ret = -1; if (net_tap_fd_init(vlan, fd)) ret = 0; } else { if (get_param_value(ifname, sizeof(ifname), "ifname", p) <= 0) { ifname[0] = '\0'; } if (get_param_value(setup_script, sizeof(setup_script), "script", p) == 0) { pstrcpy(setup_script, sizeof(setup_script), DEFAULT_NETWORK_SCRIPT); } ret = net_tap_init(vlan, ifname, setup_script); } } else #endif if (!strcmp(device, "socket")) { if (get_param_value(buf, sizeof(buf), "fd", p) > 0) { int fd; fd = strtol(buf, NULL, 0); ret = -1; if (net_socket_fd_init(vlan, fd, 1)) ret = 0; } else if (get_param_value(buf, sizeof(buf), "listen", p) > 0) { ret = net_socket_listen_init(vlan, buf); } else if (get_param_value(buf, sizeof(buf), "connect", p) > 0) { ret = net_socket_connect_init(vlan, buf); } else if (get_param_value(buf, sizeof(buf), "mcast", p) > 0) { ret = net_socket_mcast_init(vlan, buf); } else { fprintf(stderr, "Unknown socket options: %s\n", p); return -1; } } else { fprintf(stderr, "Unknown network device: %s\n", device); return -1; } if (ret < 0) { fprintf(stderr, "Could not initialize device '%s'\n", device); } return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(const char *VAR_0) { const char *VAR_1; char *VAR_2; char VAR_3[64]; char VAR_4[1024]; int VAR_5, VAR_6; VLANState *vlan; VAR_1 = VAR_0; VAR_2 = VAR_3; while (*VAR_1 != '\0' && *VAR_1 != ',') { if ((VAR_2 - VAR_3) < sizeof(VAR_3) - 1) *VAR_2++ = *VAR_1; VAR_1++; } *VAR_2 = '\0'; if (*VAR_1 == ',') VAR_1++; VAR_5 = 0; if (get_param_value(VAR_4, sizeof(VAR_4), "vlan", VAR_1)) { VAR_5 = strtol(VAR_4, NULL, 0); } vlan = qemu_find_vlan(VAR_5); if (!vlan) { fprintf(stderr, "Could not create vlan %d\n", VAR_5); return -1; } if (!strcmp(VAR_3, "nic")) { NICInfo *nd; uint8_t *macaddr; if (nb_nics >= MAX_NICS) { fprintf(stderr, "Too Many NICs\n"); return -1; } nd = &nd_table[nb_nics]; macaddr = nd->macaddr; macaddr[0] = 0x52; macaddr[1] = 0x54; macaddr[2] = 0x00; macaddr[3] = 0x12; macaddr[4] = 0x34; macaddr[5] = 0x56 + nb_nics; if (get_param_value(VAR_4, sizeof(VAR_4), "macaddr", VAR_1)) { if (parse_macaddr(macaddr, VAR_4) < 0) { fprintf(stderr, "invalid syntax for ethernet address\n"); return -1; } } if (get_param_value(VAR_4, sizeof(VAR_4), "model", VAR_1)) { nd->model = strdup(VAR_4); } nd->vlan = vlan; nb_nics++; vlan->nb_guest_devs++; VAR_6 = 0; } else if (!strcmp(VAR_3, "none")) { VAR_6 = 0; } else #ifdef CONFIG_SLIRP if (!strcmp(VAR_3, "user")) { if (get_param_value(VAR_4, sizeof(VAR_4), "hostname", VAR_1)) { pstrcpy(slirp_hostname, sizeof(slirp_hostname), VAR_4); } VAR_6 = net_slirp_init(vlan); } else #endif #ifdef _WIN32 if (!strcmp(VAR_3, "tap")) { char VAR_7[64]; if (get_param_value(VAR_7, sizeof(VAR_7), "VAR_7", VAR_1) <= 0) { fprintf(stderr, "tap: no interface name\n"); return -1; } VAR_6 = tap_win32_init(vlan, VAR_7); } else #else if (!strcmp(VAR_3, "tap")) { char VAR_7[64]; char VAR_8[1024]; int VAR_10; if (get_param_value(VAR_4, sizeof(VAR_4), "VAR_10", VAR_1) > 0) { VAR_10 = strtol(VAR_4, NULL, 0); VAR_6 = -1; if (net_tap_fd_init(vlan, VAR_10)) VAR_6 = 0; } else { if (get_param_value(VAR_7, sizeof(VAR_7), "VAR_7", VAR_1) <= 0) { VAR_7[0] = '\0'; } if (get_param_value(VAR_8, sizeof(VAR_8), "script", VAR_1) == 0) { pstrcpy(VAR_8, sizeof(VAR_8), DEFAULT_NETWORK_SCRIPT); } VAR_6 = net_tap_init(vlan, VAR_7, VAR_8); } } else #endif if (!strcmp(VAR_3, "socket")) { if (get_param_value(VAR_4, sizeof(VAR_4), "VAR_10", VAR_1) > 0) { int VAR_10; VAR_10 = strtol(VAR_4, NULL, 0); VAR_6 = -1; if (net_socket_fd_init(vlan, VAR_10, 1)) VAR_6 = 0; } else if (get_param_value(VAR_4, sizeof(VAR_4), "listen", VAR_1) > 0) { VAR_6 = net_socket_listen_init(vlan, VAR_4); } else if (get_param_value(VAR_4, sizeof(VAR_4), "connect", VAR_1) > 0) { VAR_6 = net_socket_connect_init(vlan, VAR_4); } else if (get_param_value(VAR_4, sizeof(VAR_4), "mcast", VAR_1) > 0) { VAR_6 = net_socket_mcast_init(vlan, VAR_4); } else { fprintf(stderr, "Unknown socket options: %s\n", VAR_1); return -1; } } else { fprintf(stderr, "Unknown network VAR_3: %s\n", VAR_3); return -1; } if (VAR_6 < 0) { fprintf(stderr, "Could not initialize VAR_3 '%s'\n", VAR_3); } return VAR_6; }
[ "static int FUNC_0(const char *VAR_0)\n{", "const char *VAR_1;", "char *VAR_2;", "char VAR_3[64];", "char VAR_4[1024];", "int VAR_5, VAR_6;", "VLANState *vlan;", "VAR_1 = VAR_0;", "VAR_2 = VAR_3;", "while (*VAR_1 != '\\0' && *VAR_1 != ',') {", "if ((VAR_2 - VAR_3) < sizeof(VAR_3) - 1)\n*VAR_2++ = *VAR_1;", "VAR_1++;", "}", "*VAR_2 = '\\0';", "if (*VAR_1 == ',')\nVAR_1++;", "VAR_5 = 0;", "if (get_param_value(VAR_4, sizeof(VAR_4), \"vlan\", VAR_1)) {", "VAR_5 = strtol(VAR_4, NULL, 0);", "}", "vlan = qemu_find_vlan(VAR_5);", "if (!vlan) {", "fprintf(stderr, \"Could not create vlan %d\\n\", VAR_5);", "return -1;", "}", "if (!strcmp(VAR_3, \"nic\")) {", "NICInfo *nd;", "uint8_t *macaddr;", "if (nb_nics >= MAX_NICS) {", "fprintf(stderr, \"Too Many NICs\\n\");", "return -1;", "}", "nd = &nd_table[nb_nics];", "macaddr = nd->macaddr;", "macaddr[0] = 0x52;", "macaddr[1] = 0x54;", "macaddr[2] = 0x00;", "macaddr[3] = 0x12;", "macaddr[4] = 0x34;", "macaddr[5] = 0x56 + nb_nics;", "if (get_param_value(VAR_4, sizeof(VAR_4), \"macaddr\", VAR_1)) {", "if (parse_macaddr(macaddr, VAR_4) < 0) {", "fprintf(stderr, \"invalid syntax for ethernet address\\n\");", "return -1;", "}", "}", "if (get_param_value(VAR_4, sizeof(VAR_4), \"model\", VAR_1)) {", "nd->model = strdup(VAR_4);", "}", "nd->vlan = vlan;", "nb_nics++;", "vlan->nb_guest_devs++;", "VAR_6 = 0;", "} else", "if (!strcmp(VAR_3, \"none\")) {", "VAR_6 = 0;", "} else", "#ifdef CONFIG_SLIRP\nif (!strcmp(VAR_3, \"user\")) {", "if (get_param_value(VAR_4, sizeof(VAR_4), \"hostname\", VAR_1)) {", "pstrcpy(slirp_hostname, sizeof(slirp_hostname), VAR_4);", "}", "VAR_6 = net_slirp_init(vlan);", "} else", "#endif\n#ifdef _WIN32\nif (!strcmp(VAR_3, \"tap\")) {", "char VAR_7[64];", "if (get_param_value(VAR_7, sizeof(VAR_7), \"VAR_7\", VAR_1) <= 0) {", "fprintf(stderr, \"tap: no interface name\\n\");", "return -1;", "}", "VAR_6 = tap_win32_init(vlan, VAR_7);", "} else", "#else\nif (!strcmp(VAR_3, \"tap\")) {", "char VAR_7[64];", "char VAR_8[1024];", "int VAR_10;", "if (get_param_value(VAR_4, sizeof(VAR_4), \"VAR_10\", VAR_1) > 0) {", "VAR_10 = strtol(VAR_4, NULL, 0);", "VAR_6 = -1;", "if (net_tap_fd_init(vlan, VAR_10))\nVAR_6 = 0;", "} else {", "if (get_param_value(VAR_7, sizeof(VAR_7), \"VAR_7\", VAR_1) <= 0) {", "VAR_7[0] = '\\0';", "}", "if (get_param_value(VAR_8, sizeof(VAR_8), \"script\", VAR_1) == 0) {", "pstrcpy(VAR_8, sizeof(VAR_8), DEFAULT_NETWORK_SCRIPT);", "}", "VAR_6 = net_tap_init(vlan, VAR_7, VAR_8);", "}", "} else", "#endif\nif (!strcmp(VAR_3, \"socket\")) {", "if (get_param_value(VAR_4, sizeof(VAR_4), \"VAR_10\", VAR_1) > 0) {", "int VAR_10;", "VAR_10 = strtol(VAR_4, NULL, 0);", "VAR_6 = -1;", "if (net_socket_fd_init(vlan, VAR_10, 1))\nVAR_6 = 0;", "} else if (get_param_value(VAR_4, sizeof(VAR_4), \"listen\", VAR_1) > 0) {", "VAR_6 = net_socket_listen_init(vlan, VAR_4);", "} else if (get_param_value(VAR_4, sizeof(VAR_4), \"connect\", VAR_1) > 0) {", "VAR_6 = net_socket_connect_init(vlan, VAR_4);", "} else if (get_param_value(VAR_4, sizeof(VAR_4), \"mcast\", VAR_1) > 0) {", "VAR_6 = net_socket_mcast_init(vlan, VAR_4);", "} else {", "fprintf(stderr, \"Unknown socket options: %s\\n\", VAR_1);", "return -1;", "}", "} else", "{", "fprintf(stderr, \"Unknown network VAR_3: %s\\n\", VAR_3);", "return -1;", "}", "if (VAR_6 < 0) {", "fprintf(stderr, \"Could not initialize VAR_3 '%s'\\n\", VAR_3);", "}", "return VAR_6;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35, 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 125 ], [ 127 ], [ 129, 131 ], [ 133 ], [ 135 ], [ 137 ], [ 140 ], [ 142 ], [ 144, 146, 148 ], [ 150 ], [ 152 ], [ 154 ], [ 156 ], [ 158 ], [ 161 ], [ 163 ], [ 165, 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181, 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 200 ], [ 202 ], [ 204 ], [ 206, 208 ], [ 210 ], [ 212 ], [ 214 ], [ 216 ], [ 218, 220 ], [ 222 ], [ 224 ], [ 226 ], [ 228 ], [ 230 ], [ 232 ], [ 234 ], [ 236 ], [ 238 ], [ 240 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 261 ], [ 263 ] ]
26,375
static void kvm_io_ioeventfd_add(MemoryListener *listener, MemoryRegionSection *section, bool match_data, uint64_t data, EventNotifier *e) { int fd = event_notifier_get_fd(e); int r; r = kvm_set_ioeventfd_pio(fd, section->offset_within_address_space, data, true, int128_get64(section->size), match_data); if (r < 0) { abort(); } }
true
qemu
fa4ba923bd539647ace9d70d226a848bd6a89dac
static void kvm_io_ioeventfd_add(MemoryListener *listener, MemoryRegionSection *section, bool match_data, uint64_t data, EventNotifier *e) { int fd = event_notifier_get_fd(e); int r; r = kvm_set_ioeventfd_pio(fd, section->offset_within_address_space, data, true, int128_get64(section->size), match_data); if (r < 0) { abort(); } }
{ "code": [], "line_no": [] }
static void FUNC_0(MemoryListener *VAR_0, MemoryRegionSection *VAR_1, bool VAR_2, uint64_t VAR_3, EventNotifier *VAR_4) { int VAR_5 = event_notifier_get_fd(VAR_4); int VAR_6; VAR_6 = kvm_set_ioeventfd_pio(VAR_5, VAR_1->offset_within_address_space, VAR_3, true, int128_get64(VAR_1->size), VAR_2); if (VAR_6 < 0) { abort(); } }
[ "static void FUNC_0(MemoryListener *VAR_0,\nMemoryRegionSection *VAR_1,\nbool VAR_2, uint64_t VAR_3,\nEventNotifier *VAR_4)\n{", "int VAR_5 = event_notifier_get_fd(VAR_4);", "int VAR_6;", "VAR_6 = kvm_set_ioeventfd_pio(VAR_5, VAR_1->offset_within_address_space,\nVAR_3, true, int128_get64(VAR_1->size),\nVAR_2);", "if (VAR_6 < 0) {", "abort();", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 17, 19, 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ] ]
26,376
void opt_input_file(const char *filename) { AVFormatContext *ic; AVFormatParameters params, *ap = &params; int err, i, ret, rfps; /* get default parameters from command line */ memset(ap, 0, sizeof(*ap)); ap->sample_rate = audio_sample_rate; ap->channels = audio_channels; ap->frame_rate = frame_rate; ap->width = frame_width; ap->height = frame_height; /* open the input file with generic libav function */ err = av_open_input_file(&ic, filename, file_iformat, 0, ap); if (err < 0) { print_error(filename, err); exit(1); } /* If not enough info to get the stream parameters, we decode the first frames to get it. (used in mpeg case for example) */ ret = av_find_stream_info(ic); if (ret < 0) { fprintf(stderr, "%s: could not find codec parameters\n", filename); exit(1); } /* update the current parameters so that they match the one of the input stream */ for(i=0;i<ic->nb_streams;i++) { AVCodecContext *enc = &ic->streams[i]->codec; switch(enc->codec_type) { case CODEC_TYPE_AUDIO: //fprintf(stderr, "\nInput Audio channels: %d", enc->channels); audio_channels = enc->channels; audio_sample_rate = enc->sample_rate; break; case CODEC_TYPE_VIDEO: frame_height = enc->height; frame_width = enc->width; rfps = ic->streams[i]->r_frame_rate; if (enc->frame_rate != rfps) { fprintf(stderr,"\nSeems that stream %d comes from film source: %2.2f->%2.2f\n", i, (float)enc->frame_rate / FRAME_RATE_BASE, (float)rfps / FRAME_RATE_BASE); } /* update the current frame rate to match the stream frame rate */ frame_rate = rfps; break; default: abort(); } } input_files[nb_input_files] = ic; /* dump the file content */ dump_format(ic, nb_input_files, filename, 0); nb_input_files++; file_iformat = NULL; file_oformat = NULL; }
false
FFmpeg
c04643a2c24564aed96a5b0760de8bf02eb305c6
void opt_input_file(const char *filename) { AVFormatContext *ic; AVFormatParameters params, *ap = &params; int err, i, ret, rfps; memset(ap, 0, sizeof(*ap)); ap->sample_rate = audio_sample_rate; ap->channels = audio_channels; ap->frame_rate = frame_rate; ap->width = frame_width; ap->height = frame_height; err = av_open_input_file(&ic, filename, file_iformat, 0, ap); if (err < 0) { print_error(filename, err); exit(1); } ret = av_find_stream_info(ic); if (ret < 0) { fprintf(stderr, "%s: could not find codec parameters\n", filename); exit(1); } for(i=0;i<ic->nb_streams;i++) { AVCodecContext *enc = &ic->streams[i]->codec; switch(enc->codec_type) { case CODEC_TYPE_AUDIO: audio_channels = enc->channels; audio_sample_rate = enc->sample_rate; break; case CODEC_TYPE_VIDEO: frame_height = enc->height; frame_width = enc->width; rfps = ic->streams[i]->r_frame_rate; if (enc->frame_rate != rfps) { fprintf(stderr,"\nSeems that stream %d comes from film source: %2.2f->%2.2f\n", i, (float)enc->frame_rate / FRAME_RATE_BASE, (float)rfps / FRAME_RATE_BASE); } frame_rate = rfps; break; default: abort(); } } input_files[nb_input_files] = ic; dump_format(ic, nb_input_files, filename, 0); nb_input_files++; file_iformat = NULL; file_oformat = NULL; }
{ "code": [], "line_no": [] }
void FUNC_0(const char *VAR_0) { AVFormatContext *ic; AVFormatParameters params, *ap = &params; int VAR_1, VAR_2, VAR_3, VAR_4; memset(ap, 0, sizeof(*ap)); ap->sample_rate = audio_sample_rate; ap->channels = audio_channels; ap->frame_rate = frame_rate; ap->width = frame_width; ap->height = frame_height; VAR_1 = av_open_input_file(&ic, VAR_0, file_iformat, 0, ap); if (VAR_1 < 0) { print_error(VAR_0, VAR_1); exit(1); } VAR_3 = av_find_stream_info(ic); if (VAR_3 < 0) { fprintf(stderr, "%s: could not find codec parameters\n", VAR_0); exit(1); } for(VAR_2=0;VAR_2<ic->nb_streams;VAR_2++) { AVCodecContext *enc = &ic->streams[VAR_2]->codec; switch(enc->codec_type) { case CODEC_TYPE_AUDIO: audio_channels = enc->channels; audio_sample_rate = enc->sample_rate; break; case CODEC_TYPE_VIDEO: frame_height = enc->height; frame_width = enc->width; VAR_4 = ic->streams[VAR_2]->r_frame_rate; if (enc->frame_rate != VAR_4) { fprintf(stderr,"\nSeems that stream %d comes from film source: %2.2f->%2.2f\n", VAR_2, (float)enc->frame_rate / FRAME_RATE_BASE, (float)VAR_4 / FRAME_RATE_BASE); } frame_rate = VAR_4; break; default: abort(); } } input_files[nb_input_files] = ic; dump_format(ic, nb_input_files, VAR_0, 0); nb_input_files++; file_iformat = NULL; file_oformat = NULL; }
[ "void FUNC_0(const char *VAR_0)\n{", "AVFormatContext *ic;", "AVFormatParameters params, *ap = &params;", "int VAR_1, VAR_2, VAR_3, VAR_4;", "memset(ap, 0, sizeof(*ap));", "ap->sample_rate = audio_sample_rate;", "ap->channels = audio_channels;", "ap->frame_rate = frame_rate;", "ap->width = frame_width;", "ap->height = frame_height;", "VAR_1 = av_open_input_file(&ic, VAR_0, file_iformat, 0, ap);", "if (VAR_1 < 0) {", "print_error(VAR_0, VAR_1);", "exit(1);", "}", "VAR_3 = av_find_stream_info(ic);", "if (VAR_3 < 0) {", "fprintf(stderr, \"%s: could not find codec parameters\\n\", VAR_0);", "exit(1);", "}", "for(VAR_2=0;VAR_2<ic->nb_streams;VAR_2++) {", "AVCodecContext *enc = &ic->streams[VAR_2]->codec;", "switch(enc->codec_type) {", "case CODEC_TYPE_AUDIO:\naudio_channels = enc->channels;", "audio_sample_rate = enc->sample_rate;", "break;", "case CODEC_TYPE_VIDEO:\nframe_height = enc->height;", "frame_width = enc->width;", "VAR_4 = ic->streams[VAR_2]->r_frame_rate;", "if (enc->frame_rate != VAR_4) {", "fprintf(stderr,\"\\nSeems that stream %d comes from film source: %2.2f->%2.2f\\n\",\nVAR_2, (float)enc->frame_rate / FRAME_RATE_BASE,\n(float)VAR_4 / FRAME_RATE_BASE);", "}", "frame_rate = VAR_4;", "break;", "default:\nabort();", "}", "}", "input_files[nb_input_files] = ic;", "dump_format(ic, nb_input_files, VAR_0, 0);", "nb_input_files++;", "file_iformat = NULL;", "file_oformat = NULL;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 61 ], [ 63 ], [ 65 ], [ 67, 71 ], [ 73 ], [ 75 ], [ 77, 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87, 89, 91 ], [ 93 ], [ 97 ], [ 99 ], [ 101, 103 ], [ 105 ], [ 107 ], [ 111 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ] ]
26,377
static inline bool regime_is_secure(CPUARMState *env, ARMMMUIdx mmu_idx) { switch (mmu_idx) { case ARMMMUIdx_S12NSE0: case ARMMMUIdx_S12NSE1: case ARMMMUIdx_S1NSE0: case ARMMMUIdx_S1NSE1: case ARMMMUIdx_S1E2: case ARMMMUIdx_S2NS: return false; case ARMMMUIdx_S1E3: case ARMMMUIdx_S1SE0: case ARMMMUIdx_S1SE1: return true; default: g_assert_not_reached(); } }
true
qemu
e7b921c2d9efc249f99b9feb0e7dca82c96aa5c4
static inline bool regime_is_secure(CPUARMState *env, ARMMMUIdx mmu_idx) { switch (mmu_idx) { case ARMMMUIdx_S12NSE0: case ARMMMUIdx_S12NSE1: case ARMMMUIdx_S1NSE0: case ARMMMUIdx_S1NSE1: case ARMMMUIdx_S1E2: case ARMMMUIdx_S2NS: return false; case ARMMMUIdx_S1E3: case ARMMMUIdx_S1SE0: case ARMMMUIdx_S1SE1: return true; default: g_assert_not_reached(); } }
{ "code": [], "line_no": [] }
static inline bool FUNC_0(CPUARMState *env, ARMMMUIdx mmu_idx) { switch (mmu_idx) { case ARMMMUIdx_S12NSE0: case ARMMMUIdx_S12NSE1: case ARMMMUIdx_S1NSE0: case ARMMMUIdx_S1NSE1: case ARMMMUIdx_S1E2: case ARMMMUIdx_S2NS: return false; case ARMMMUIdx_S1E3: case ARMMMUIdx_S1SE0: case ARMMMUIdx_S1SE1: return true; default: g_assert_not_reached(); } }
[ "static inline bool FUNC_0(CPUARMState *env, ARMMMUIdx mmu_idx)\n{", "switch (mmu_idx) {", "case ARMMMUIdx_S12NSE0:\ncase ARMMMUIdx_S12NSE1:\ncase ARMMMUIdx_S1NSE0:\ncase ARMMMUIdx_S1NSE1:\ncase ARMMMUIdx_S1E2:\ncase ARMMMUIdx_S2NS:\nreturn false;", "case ARMMMUIdx_S1E3:\ncase ARMMMUIdx_S1SE0:\ncase ARMMMUIdx_S1SE1:\nreturn true;", "default:\ng_assert_not_reached();", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9, 11, 13, 15, 17, 21 ], [ 23, 25, 27, 29 ], [ 31, 33 ], [ 35 ], [ 37 ] ]
26,378
static int parse_iplconvkernel(IplConvKernel **kernel, char *buf, void *log_ctx) { char shape_filename[128] = "", shape_str[32] = "rect"; int cols = 0, rows = 0, anchor_x = 0, anchor_y = 0, shape = CV_SHAPE_RECT; int *values = NULL, ret; sscanf(buf, "%dx%d+%dx%d/%32[^=]=%127s", &cols, &rows, &anchor_x, &anchor_y, shape_str, shape_filename); if (!strcmp(shape_str, "rect" )) shape = CV_SHAPE_RECT; else if (!strcmp(shape_str, "cross" )) shape = CV_SHAPE_CROSS; else if (!strcmp(shape_str, "ellipse")) shape = CV_SHAPE_ELLIPSE; else if (!strcmp(shape_str, "custom" )) { shape = CV_SHAPE_CUSTOM; if ((ret = read_shape_from_file(&cols, &rows, &values, shape_filename, log_ctx)) < 0) return ret; } else { av_log(log_ctx, AV_LOG_ERROR, "Shape unspecified or type '%s' unknown.\n", shape_str); return AVERROR(EINVAL); } if (rows <= 0 || cols <= 0) { av_log(log_ctx, AV_LOG_ERROR, "Invalid non-positive values for shape size %dx%d\n", cols, rows); return AVERROR(EINVAL); } if (anchor_x < 0 || anchor_y < 0 || anchor_x >= cols || anchor_y >= rows) { av_log(log_ctx, AV_LOG_ERROR, "Shape anchor %dx%d is not inside the rectangle with size %dx%d.\n", anchor_x, anchor_y, cols, rows); return AVERROR(EINVAL); } *kernel = cvCreateStructuringElementEx(cols, rows, anchor_x, anchor_y, shape, values); av_freep(&values); if (!*kernel) return AVERROR(ENOMEM); av_log(log_ctx, AV_LOG_VERBOSE, "Structuring element: w:%d h:%d x:%d y:%d shape:%s\n", rows, cols, anchor_x, anchor_y, shape_str); return 0; }
true
FFmpeg
8805589b803fab5f362008306319336ac79a3fa7
static int parse_iplconvkernel(IplConvKernel **kernel, char *buf, void *log_ctx) { char shape_filename[128] = "", shape_str[32] = "rect"; int cols = 0, rows = 0, anchor_x = 0, anchor_y = 0, shape = CV_SHAPE_RECT; int *values = NULL, ret; sscanf(buf, "%dx%d+%dx%d/%32[^=]=%127s", &cols, &rows, &anchor_x, &anchor_y, shape_str, shape_filename); if (!strcmp(shape_str, "rect" )) shape = CV_SHAPE_RECT; else if (!strcmp(shape_str, "cross" )) shape = CV_SHAPE_CROSS; else if (!strcmp(shape_str, "ellipse")) shape = CV_SHAPE_ELLIPSE; else if (!strcmp(shape_str, "custom" )) { shape = CV_SHAPE_CUSTOM; if ((ret = read_shape_from_file(&cols, &rows, &values, shape_filename, log_ctx)) < 0) return ret; } else { av_log(log_ctx, AV_LOG_ERROR, "Shape unspecified or type '%s' unknown.\n", shape_str); return AVERROR(EINVAL); } if (rows <= 0 || cols <= 0) { av_log(log_ctx, AV_LOG_ERROR, "Invalid non-positive values for shape size %dx%d\n", cols, rows); return AVERROR(EINVAL); } if (anchor_x < 0 || anchor_y < 0 || anchor_x >= cols || anchor_y >= rows) { av_log(log_ctx, AV_LOG_ERROR, "Shape anchor %dx%d is not inside the rectangle with size %dx%d.\n", anchor_x, anchor_y, cols, rows); return AVERROR(EINVAL); } *kernel = cvCreateStructuringElementEx(cols, rows, anchor_x, anchor_y, shape, values); av_freep(&values); if (!*kernel) return AVERROR(ENOMEM); av_log(log_ctx, AV_LOG_VERBOSE, "Structuring element: w:%d h:%d x:%d y:%d shape:%s\n", rows, cols, anchor_x, anchor_y, shape_str); return 0; }
{ "code": [ " int *values = NULL, ret;", " return AVERROR(EINVAL);", " return AVERROR(EINVAL);", " return AVERROR(EINVAL);", " av_freep(&values);", " if (!*kernel)", " return AVERROR(ENOMEM);", " return 0;" ], "line_no": [ 9, 37, 37, 37, 71, 73, 75, 83 ] }
static int FUNC_0(IplConvKernel **VAR_0, char *VAR_1, void *VAR_2) { char VAR_3[128] = "", VAR_4[32] = "rect"; int VAR_5 = 0, VAR_6 = 0, VAR_7 = 0, VAR_8 = 0, VAR_9 = CV_SHAPE_RECT; int *VAR_10 = NULL, VAR_11; sscanf(VAR_1, "%dx%d+%dx%d/%32[^=]=%127s", &VAR_5, &VAR_6, &VAR_7, &VAR_8, VAR_4, VAR_3); if (!strcmp(VAR_4, "rect" )) VAR_9 = CV_SHAPE_RECT; else if (!strcmp(VAR_4, "cross" )) VAR_9 = CV_SHAPE_CROSS; else if (!strcmp(VAR_4, "ellipse")) VAR_9 = CV_SHAPE_ELLIPSE; else if (!strcmp(VAR_4, "custom" )) { VAR_9 = CV_SHAPE_CUSTOM; if ((VAR_11 = read_shape_from_file(&VAR_5, &VAR_6, &VAR_10, VAR_3, VAR_2)) < 0) return VAR_11; } else { av_log(VAR_2, AV_LOG_ERROR, "Shape unspecified or type '%s' unknown.\n", VAR_4); return AVERROR(EINVAL); } if (VAR_6 <= 0 || VAR_5 <= 0) { av_log(VAR_2, AV_LOG_ERROR, "Invalid non-positive VAR_10 for VAR_9 size %dx%d\n", VAR_5, VAR_6); return AVERROR(EINVAL); } if (VAR_7 < 0 || VAR_8 < 0 || VAR_7 >= VAR_5 || VAR_8 >= VAR_6) { av_log(VAR_2, AV_LOG_ERROR, "Shape anchor %dx%d is not inside the rectangle with size %dx%d.\n", VAR_7, VAR_8, VAR_5, VAR_6); return AVERROR(EINVAL); } *VAR_0 = cvCreateStructuringElementEx(VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10); av_freep(&VAR_10); if (!*VAR_0) return AVERROR(ENOMEM); av_log(VAR_2, AV_LOG_VERBOSE, "Structuring element: w:%d h:%d x:%d y:%d VAR_9:%s\n", VAR_6, VAR_5, VAR_7, VAR_8, VAR_4); return 0; }
[ "static int FUNC_0(IplConvKernel **VAR_0, char *VAR_1, void *VAR_2)\n{", "char VAR_3[128] = \"\", VAR_4[32] = \"rect\";", "int VAR_5 = 0, VAR_6 = 0, VAR_7 = 0, VAR_8 = 0, VAR_9 = CV_SHAPE_RECT;", "int *VAR_10 = NULL, VAR_11;", "sscanf(VAR_1, \"%dx%d+%dx%d/%32[^=]=%127s\", &VAR_5, &VAR_6, &VAR_7, &VAR_8, VAR_4, VAR_3);", "if (!strcmp(VAR_4, \"rect\" )) VAR_9 = CV_SHAPE_RECT;", "else if (!strcmp(VAR_4, \"cross\" )) VAR_9 = CV_SHAPE_CROSS;", "else if (!strcmp(VAR_4, \"ellipse\")) VAR_9 = CV_SHAPE_ELLIPSE;", "else if (!strcmp(VAR_4, \"custom\" )) {", "VAR_9 = CV_SHAPE_CUSTOM;", "if ((VAR_11 = read_shape_from_file(&VAR_5, &VAR_6, &VAR_10, VAR_3, VAR_2)) < 0)\nreturn VAR_11;", "} else {", "av_log(VAR_2, AV_LOG_ERROR,\n\"Shape unspecified or type '%s' unknown.\\n\", VAR_4);", "return AVERROR(EINVAL);", "}", "if (VAR_6 <= 0 || VAR_5 <= 0) {", "av_log(VAR_2, AV_LOG_ERROR,\n\"Invalid non-positive VAR_10 for VAR_9 size %dx%d\\n\", VAR_5, VAR_6);", "return AVERROR(EINVAL);", "}", "if (VAR_7 < 0 || VAR_8 < 0 || VAR_7 >= VAR_5 || VAR_8 >= VAR_6) {", "av_log(VAR_2, AV_LOG_ERROR,\n\"Shape anchor %dx%d is not inside the rectangle with size %dx%d.\\n\",\nVAR_7, VAR_8, VAR_5, VAR_6);", "return AVERROR(EINVAL);", "}", "*VAR_0 = cvCreateStructuringElementEx(VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10);", "av_freep(&VAR_10);", "if (!*VAR_0)\nreturn AVERROR(ENOMEM);", "av_log(VAR_2, AV_LOG_VERBOSE, \"Structuring element: w:%d h:%d x:%d y:%d VAR_9:%s\\n\",\nVAR_6, VAR_5, VAR_7, VAR_8, VAR_4);", "return 0;", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45, 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57, 59, 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ], [ 73, 75 ], [ 79, 81 ], [ 83 ], [ 85 ] ]
26,380
static uint32_t pci_up_read(void *opaque, uint32_t addr) { PIIX4PMState *s = opaque; uint32_t val = s->pci0_status.up; PIIX4_DPRINTF("pci_up_read %x\n", val); return val; }
true
qemu
7faa8075d898ae56d2c533c530569bb25ab86eaf
static uint32_t pci_up_read(void *opaque, uint32_t addr) { PIIX4PMState *s = opaque; uint32_t val = s->pci0_status.up; PIIX4_DPRINTF("pci_up_read %x\n", val); return val; }
{ "code": [ " uint32_t val = s->pci0_status.up;" ], "line_no": [ 7 ] }
static uint32_t FUNC_0(void *opaque, uint32_t addr) { PIIX4PMState *s = opaque; uint32_t val = s->pci0_status.up; PIIX4_DPRINTF("FUNC_0 %x\n", val); return val; }
[ "static uint32_t FUNC_0(void *opaque, uint32_t addr)\n{", "PIIX4PMState *s = opaque;", "uint32_t val = s->pci0_status.up;", "PIIX4_DPRINTF(\"FUNC_0 %x\\n\", val);", "return val;", "}" ]
[ 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ] ]
26,382
static int amovie_request_frame(AVFilterLink *outlink) { MovieContext *movie = outlink->src->priv; int ret; if (movie->is_done) return AVERROR_EOF; if ((ret = amovie_get_samples(outlink)) < 0) return ret; avfilter_filter_samples(outlink, avfilter_ref_buffer(movie->samplesref, ~0)); avfilter_unref_buffer(movie->samplesref); movie->samplesref = NULL; return 0; }
true
FFmpeg
2b1a4c5b3411c3030a5bdbd70d80bc606be570f7
static int amovie_request_frame(AVFilterLink *outlink) { MovieContext *movie = outlink->src->priv; int ret; if (movie->is_done) return AVERROR_EOF; if ((ret = amovie_get_samples(outlink)) < 0) return ret; avfilter_filter_samples(outlink, avfilter_ref_buffer(movie->samplesref, ~0)); avfilter_unref_buffer(movie->samplesref); movie->samplesref = NULL; return 0; }
{ "code": [ " if ((ret = amovie_get_samples(outlink)) < 0)", " return ret;" ], "line_no": [ 15, 17 ] }
static int FUNC_0(AVFilterLink *VAR_0) { MovieContext *movie = VAR_0->src->priv; int VAR_1; if (movie->is_done) return AVERROR_EOF; if ((VAR_1 = amovie_get_samples(VAR_0)) < 0) return VAR_1; avfilter_filter_samples(VAR_0, avfilter_ref_buffer(movie->samplesref, ~0)); avfilter_unref_buffer(movie->samplesref); movie->samplesref = NULL; return 0; }
[ "static int FUNC_0(AVFilterLink *VAR_0)\n{", "MovieContext *movie = VAR_0->src->priv;", "int VAR_1;", "if (movie->is_done)\nreturn AVERROR_EOF;", "if ((VAR_1 = amovie_get_samples(VAR_0)) < 0)\nreturn VAR_1;", "avfilter_filter_samples(VAR_0, avfilter_ref_buffer(movie->samplesref, ~0));", "avfilter_unref_buffer(movie->samplesref);", "movie->samplesref = NULL;", "return 0;", "}" ]
[ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11, 13 ], [ 15, 17 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ] ]
26,383
inline static void RENAME(hcscale)(uint16_t *dst, long dstWidth, uint8_t *src1, uint8_t *src2, int srcW, int xInc, int flags, int canMMX2BeUsed, int16_t *hChrFilter, int16_t *hChrFilterPos, int hChrFilterSize, void *funnyUVCode, int srcFormat, uint8_t *formatConvBuffer, int16_t *mmx2Filter, int32_t *mmx2FilterPos, uint8_t *pal) { if(srcFormat==PIX_FMT_YUYV422) { RENAME(yuy2ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+2048; } else if(srcFormat==PIX_FMT_UYVY422) { RENAME(uyvyToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+2048; } else if(srcFormat==PIX_FMT_RGB32) { RENAME(bgr32ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+2048; } else if(srcFormat==PIX_FMT_BGR24) { RENAME(bgr24ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+2048; } else if(srcFormat==PIX_FMT_BGR565) { RENAME(bgr16ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+2048; } else if(srcFormat==PIX_FMT_BGR555) { RENAME(bgr15ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+2048; } else if(srcFormat==PIX_FMT_BGR32) { RENAME(rgb32ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+2048; } else if(srcFormat==PIX_FMT_RGB24) { RENAME(rgb24ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+2048; } else if(srcFormat==PIX_FMT_RGB565) { RENAME(rgb16ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+2048; } else if(srcFormat==PIX_FMT_RGB555) { RENAME(rgb15ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+2048; } else if(isGray(srcFormat)) { return; } else if(srcFormat==PIX_FMT_RGB8 || srcFormat==PIX_FMT_BGR8 || srcFormat==PIX_FMT_PAL8 || srcFormat==PIX_FMT_BGR4_BYTE || srcFormat==PIX_FMT_RGB4_BYTE) { RENAME(palToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW, pal); src1= formatConvBuffer; src2= formatConvBuffer+2048; } #ifdef HAVE_MMX // use the new MMX scaler if the mmx2 can't be used (its faster than the x86asm one) if(!(flags&SWS_FAST_BILINEAR) || (!canMMX2BeUsed)) #else if(!(flags&SWS_FAST_BILINEAR)) #endif { RENAME(hScale)(dst , dstWidth, src1, srcW, xInc, hChrFilter, hChrFilterPos, hChrFilterSize); RENAME(hScale)(dst+2048, dstWidth, src2, srcW, xInc, hChrFilter, hChrFilterPos, hChrFilterSize); } else // Fast Bilinear upscale / crap downscale { #if defined(ARCH_X86) #ifdef HAVE_MMX2 int i; #if defined(PIC) uint64_t ebxsave __attribute__((aligned(8))); #endif if(canMMX2BeUsed) { asm volatile( #if defined(PIC) "mov %%"REG_b", %6 \n\t" #endif "pxor %%mm7, %%mm7 \n\t" "mov %0, %%"REG_c" \n\t" "mov %1, %%"REG_D" \n\t" "mov %2, %%"REG_d" \n\t" "mov %3, %%"REG_b" \n\t" "xor %%"REG_a", %%"REG_a" \n\t" // i PREFETCH" (%%"REG_c") \n\t" PREFETCH" 32(%%"REG_c") \n\t" PREFETCH" 64(%%"REG_c") \n\t" #ifdef ARCH_X86_64 #define FUNNY_UV_CODE \ "movl (%%"REG_b"), %%esi \n\t"\ "call *%4 \n\t"\ "movl (%%"REG_b", %%"REG_a"), %%esi\n\t"\ "add %%"REG_S", %%"REG_c" \n\t"\ "add %%"REG_a", %%"REG_D" \n\t"\ "xor %%"REG_a", %%"REG_a" \n\t"\ #else #define FUNNY_UV_CODE \ "movl (%%"REG_b"), %%esi \n\t"\ "call *%4 \n\t"\ "addl (%%"REG_b", %%"REG_a"), %%"REG_c"\n\t"\ "add %%"REG_a", %%"REG_D" \n\t"\ "xor %%"REG_a", %%"REG_a" \n\t"\ #endif FUNNY_UV_CODE FUNNY_UV_CODE FUNNY_UV_CODE FUNNY_UV_CODE "xor %%"REG_a", %%"REG_a" \n\t" // i "mov %5, %%"REG_c" \n\t" // src "mov %1, %%"REG_D" \n\t" // buf1 "add $4096, %%"REG_D" \n\t" PREFETCH" (%%"REG_c") \n\t" PREFETCH" 32(%%"REG_c") \n\t" PREFETCH" 64(%%"REG_c") \n\t" FUNNY_UV_CODE FUNNY_UV_CODE FUNNY_UV_CODE FUNNY_UV_CODE #if defined(PIC) "mov %6, %%"REG_b" \n\t" #endif :: "m" (src1), "m" (dst), "m" (mmx2Filter), "m" (mmx2FilterPos), "m" (funnyUVCode), "m" (src2) #if defined(PIC) ,"m" (ebxsave) #endif : "%"REG_a, "%"REG_c, "%"REG_d, "%"REG_S, "%"REG_D #if !defined(PIC) ,"%"REG_b #endif ); for(i=dstWidth-1; (i*xInc)>>16 >=srcW-1; i--) { // printf("%d %d %d\n", dstWidth, i, srcW); dst[i] = src1[srcW-1]*128; dst[i+2048] = src2[srcW-1]*128; } } else { #endif long xInc_shr16 = (long) (xInc >> 16); uint16_t xInc_mask = xInc & 0xffff; asm volatile( "xor %%"REG_a", %%"REG_a" \n\t" // i "xor %%"REG_d", %%"REG_d" \n\t" // xx "xorl %%ecx, %%ecx \n\t" // 2*xalpha ASMALIGN(4) "1: \n\t" "mov %0, %%"REG_S" \n\t" "movzbl (%%"REG_S", %%"REG_d"), %%edi \n\t" //src[xx] "movzbl 1(%%"REG_S", %%"REG_d"), %%esi \n\t" //src[xx+1] "subl %%edi, %%esi \n\t" //src[xx+1] - src[xx] "imull %%ecx, %%esi \n\t" //(src[xx+1] - src[xx])*2*xalpha "shll $16, %%edi \n\t" "addl %%edi, %%esi \n\t" //src[xx+1]*2*xalpha + src[xx]*(1-2*xalpha) "mov %1, %%"REG_D" \n\t" "shrl $9, %%esi \n\t" "movw %%si, (%%"REG_D", %%"REG_a", 2)\n\t" "movzbl (%5, %%"REG_d"), %%edi \n\t" //src[xx] "movzbl 1(%5, %%"REG_d"), %%esi \n\t" //src[xx+1] "subl %%edi, %%esi \n\t" //src[xx+1] - src[xx] "imull %%ecx, %%esi \n\t" //(src[xx+1] - src[xx])*2*xalpha "shll $16, %%edi \n\t" "addl %%edi, %%esi \n\t" //src[xx+1]*2*xalpha + src[xx]*(1-2*xalpha) "mov %1, %%"REG_D" \n\t" "shrl $9, %%esi \n\t" "movw %%si, 4096(%%"REG_D", %%"REG_a", 2)\n\t" "addw %4, %%cx \n\t" //2*xalpha += xInc&0xFF "adc %3, %%"REG_d" \n\t" //xx+= xInc>>8 + carry "add $1, %%"REG_a" \n\t" "cmp %2, %%"REG_a" \n\t" " jb 1b \n\t" /* GCC-3.3 makes MPlayer crash on IA-32 machines when using "g" operand here, which is needed to support GCC-4.0 */ #if defined(ARCH_X86_64) && ((__GNUC__ > 3) || ( __GNUC__ == 3 && __GNUC_MINOR__ >= 4)) :: "m" (src1), "m" (dst), "g" ((long)dstWidth), "m" (xInc_shr16), "m" (xInc_mask), #else :: "m" (src1), "m" (dst), "m" ((long)dstWidth), "m" (xInc_shr16), "m" (xInc_mask), #endif "r" (src2) : "%"REG_a, "%"REG_d, "%ecx", "%"REG_D, "%esi" ); #ifdef HAVE_MMX2 } //if MMX2 can't be used #endif #else int i; unsigned int xpos=0; for(i=0;i<dstWidth;i++) { register unsigned int xx=xpos>>16; register unsigned int xalpha=(xpos&0xFFFF)>>9; dst[i]=(src1[xx]*(xalpha^127)+src1[xx+1]*xalpha); dst[i+2048]=(src2[xx]*(xalpha^127)+src2[xx+1]*xalpha); /* slower dst[i]= (src1[xx]<<7) + (src1[xx+1] - src1[xx])*xalpha; dst[i+2048]=(src2[xx]<<7) + (src2[xx+1] - src2[xx])*xalpha; */ xpos+=xInc; } #endif } }
true
FFmpeg
2da0d70d5eebe42f9fcd27ee554419ebe2a5da06
inline static void RENAME(hcscale)(uint16_t *dst, long dstWidth, uint8_t *src1, uint8_t *src2, int srcW, int xInc, int flags, int canMMX2BeUsed, int16_t *hChrFilter, int16_t *hChrFilterPos, int hChrFilterSize, void *funnyUVCode, int srcFormat, uint8_t *formatConvBuffer, int16_t *mmx2Filter, int32_t *mmx2FilterPos, uint8_t *pal) { if(srcFormat==PIX_FMT_YUYV422) { RENAME(yuy2ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+2048; } else if(srcFormat==PIX_FMT_UYVY422) { RENAME(uyvyToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+2048; } else if(srcFormat==PIX_FMT_RGB32) { RENAME(bgr32ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+2048; } else if(srcFormat==PIX_FMT_BGR24) { RENAME(bgr24ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+2048; } else if(srcFormat==PIX_FMT_BGR565) { RENAME(bgr16ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+2048; } else if(srcFormat==PIX_FMT_BGR555) { RENAME(bgr15ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+2048; } else if(srcFormat==PIX_FMT_BGR32) { RENAME(rgb32ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+2048; } else if(srcFormat==PIX_FMT_RGB24) { RENAME(rgb24ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+2048; } else if(srcFormat==PIX_FMT_RGB565) { RENAME(rgb16ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+2048; } else if(srcFormat==PIX_FMT_RGB555) { RENAME(rgb15ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+2048; } else if(isGray(srcFormat)) { return; } else if(srcFormat==PIX_FMT_RGB8 || srcFormat==PIX_FMT_BGR8 || srcFormat==PIX_FMT_PAL8 || srcFormat==PIX_FMT_BGR4_BYTE || srcFormat==PIX_FMT_RGB4_BYTE) { RENAME(palToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW, pal); src1= formatConvBuffer; src2= formatConvBuffer+2048; } #ifdef HAVE_MMX if(!(flags&SWS_FAST_BILINEAR) || (!canMMX2BeUsed)) #else if(!(flags&SWS_FAST_BILINEAR)) #endif { RENAME(hScale)(dst , dstWidth, src1, srcW, xInc, hChrFilter, hChrFilterPos, hChrFilterSize); RENAME(hScale)(dst+2048, dstWidth, src2, srcW, xInc, hChrFilter, hChrFilterPos, hChrFilterSize); } else { #if defined(ARCH_X86) #ifdef HAVE_MMX2 int i; #if defined(PIC) uint64_t ebxsave __attribute__((aligned(8))); #endif if(canMMX2BeUsed) { asm volatile( #if defined(PIC) "mov %%"REG_b", %6 \n\t" #endif "pxor %%mm7, %%mm7 \n\t" "mov %0, %%"REG_c" \n\t" "mov %1, %%"REG_D" \n\t" "mov %2, %%"REG_d" \n\t" "mov %3, %%"REG_b" \n\t" "xor %%"REG_a", %%"REG_a" \n\t" PREFETCH" (%%"REG_c") \n\t" PREFETCH" 32(%%"REG_c") \n\t" PREFETCH" 64(%%"REG_c") \n\t" #ifdef ARCH_X86_64 #define FUNNY_UV_CODE \ "movl (%%"REG_b"), %%esi \n\t"\ "call *%4 \n\t"\ "movl (%%"REG_b", %%"REG_a"), %%esi\n\t"\ "add %%"REG_S", %%"REG_c" \n\t"\ "add %%"REG_a", %%"REG_D" \n\t"\ "xor %%"REG_a", %%"REG_a" \n\t"\ #else #define FUNNY_UV_CODE \ "movl (%%"REG_b"), %%esi \n\t"\ "call *%4 \n\t"\ "addl (%%"REG_b", %%"REG_a"), %%"REG_c"\n\t"\ "add %%"REG_a", %%"REG_D" \n\t"\ "xor %%"REG_a", %%"REG_a" \n\t"\ #endif FUNNY_UV_CODE FUNNY_UV_CODE FUNNY_UV_CODE FUNNY_UV_CODE "xor %%"REG_a", %%"REG_a" \n\t" "mov %5, %%"REG_c" \n\t" "mov %1, %%"REG_D" \n\t" "add $4096, %%"REG_D" \n\t" PREFETCH" (%%"REG_c") \n\t" PREFETCH" 32(%%"REG_c") \n\t" PREFETCH" 64(%%"REG_c") \n\t" FUNNY_UV_CODE FUNNY_UV_CODE FUNNY_UV_CODE FUNNY_UV_CODE #if defined(PIC) "mov %6, %%"REG_b" \n\t" #endif :: "m" (src1), "m" (dst), "m" (mmx2Filter), "m" (mmx2FilterPos), "m" (funnyUVCode), "m" (src2) #if defined(PIC) ,"m" (ebxsave) #endif : "%"REG_a, "%"REG_c, "%"REG_d, "%"REG_S, "%"REG_D #if !defined(PIC) ,"%"REG_b #endif ); for(i=dstWidth-1; (i*xInc)>>16 >=srcW-1; i--) { dst[i] = src1[srcW-1]*128; dst[i+2048] = src2[srcW-1]*128; } } else { #endif long xInc_shr16 = (long) (xInc >> 16); uint16_t xInc_mask = xInc & 0xffff; asm volatile( "xor %%"REG_a", %%"REG_a" \n\t" "xor %%"REG_d", %%"REG_d" \n\t" "xorl %%ecx, %%ecx \n\t" ASMALIGN(4) "1: \n\t" "mov %0, %%"REG_S" \n\t" "movzbl (%%"REG_S", %%"REG_d"), %%edi \n\t" "movzbl 1(%%"REG_S", %%"REG_d"), %%esi \n\t" "subl %%edi, %%esi \n\t" - src[xx] "imull %%ecx, %%esi \n\t" "shll $16, %%edi \n\t" "addl %%edi, %%esi \n\t" *2*xalpha + src[xx]*(1-2*xalpha) "mov %1, %%"REG_D" \n\t" "shrl $9, %%esi \n\t" "movw %%si, (%%"REG_D", %%"REG_a", 2)\n\t" "movzbl (%5, %%"REG_d"), %%edi \n\t" "movzbl 1(%5, %%"REG_d"), %%esi \n\t" "subl %%edi, %%esi \n\t" - src[xx] "imull %%ecx, %%esi \n\t" "shll $16, %%edi \n\t" "addl %%edi, %%esi \n\t" *2*xalpha + src[xx]*(1-2*xalpha) "mov %1, %%"REG_D" \n\t" "shrl $9, %%esi \n\t" "movw %%si, 4096(%%"REG_D", %%"REG_a", 2)\n\t" "addw %4, %%cx \n\t" "adc %3, %%"REG_d" \n\t" "add $1, %%"REG_a" \n\t" "cmp %2, %%"REG_a" \n\t" " jb 1b \n\t" #if defined(ARCH_X86_64) && ((__GNUC__ > 3) || ( __GNUC__ == 3 && __GNUC_MINOR__ >= 4)) :: "m" (src1), "m" (dst), "g" ((long)dstWidth), "m" (xInc_shr16), "m" (xInc_mask), #else :: "m" (src1), "m" (dst), "m" ((long)dstWidth), "m" (xInc_shr16), "m" (xInc_mask), #endif "r" (src2) : "%"REG_a, "%"REG_d, "%ecx", "%"REG_D, "%esi" ); #ifdef HAVE_MMX2 } #endif #else int i; unsigned int xpos=0; for(i=0;i<dstWidth;i++) { register unsigned int xx=xpos>>16; register unsigned int xalpha=(xpos&0xFFFF)>>9; dst[i]=(src1[xx]*(xalpha^127)+src1[xx+1]*xalpha); dst[i+2048]=(src2[xx]*(xalpha^127)+src2[xx+1]*xalpha); xpos+=xInc; } #endif } }
{ "code": [ "\t\t\t\"xor %%\"REG_a\", %%\"REG_a\"\t\\n\\t\"\\", "\t\t\t\"xor %%\"REG_a\", %%\"REG_a\"\t\\n\\t\"\\", "\t\tasm volatile(", "\t\tasm volatile(", "\tasm volatile(", "\tint i;", "#endif", "#endif", "#endif", "#endif", "#endif", "\tint i;", "#endif", "#endif", "#endif", "#endif", "\tint i;", "#endif", "#endif", "#endif", "#endif", "#endif", "\tasm volatile(", "\t\t\"1:\t\t\t\t\\n\\t\"", "\tint i;", "\tasm volatile(", "\t\t\"1:\t\t\t\t\\n\\t\"", "\tint i;", "#endif", "\tasm volatile(", "\t\t\"1:\t\t\t\t\\n\\t\"", "\tint i;", "\tasm volatile(", "\t\t\"1:\t\t\t\t\\n\\t\"", "\tint i;", "#endif", "\tint i;", "\tint i;", "\tasm volatile(", "\t\tASMALIGN(4)", "\t\t\"1:\t\t\t\t\\n\\t\"", "#endif", "#endif", "\tint i;", "\tasm volatile(", "\t\tASMALIGN(4)", "\t\t\"1:\t\t\t\t\\n\\t\"", "#endif", "#endif", "#endif", "#endif", "\tint i;", "#endif", "\tint i;", "\tint i;", "\tint i;", "\tint i;", "\tint i;", "\tint i;", "\tint i;", "\tint i;", "\tint i;", "\tint i;", "\tint i;", "\tint i;", "\tint i;", "\tint i;", "\t\tasm volatile(", "#endif", "\t\t\t\"pxor %%mm7, %%mm7\t\t\\n\\t\"", "#endif", "\t\t);", "\t\tasm volatile(", "#endif", "\t\t\t\"pxor %%mm7, %%mm7\t\t\\n\\t\"", "#endif", "\t\t);", "\t\tasm volatile(", "\t\t\t\"pxor %%mm7, %%mm7\t\t\\n\\t\"", "\t\t);", "\tint i;", "\t\t\t\t int srcFormat, uint8_t *formatConvBuffer, int16_t *mmx2Filter,", "\t\t\t\t int32_t *mmx2FilterPos, uint8_t *pal)", " else if(srcFormat==PIX_FMT_RGB32)", " else if(srcFormat==PIX_FMT_BGR24)", " else if(srcFormat==PIX_FMT_BGR565)", " else if(srcFormat==PIX_FMT_BGR555)", " else if(srcFormat==PIX_FMT_BGR32)", " else if(srcFormat==PIX_FMT_RGB24)", " else if(srcFormat==PIX_FMT_RGB565)", " else if(srcFormat==PIX_FMT_RGB555)", " else if(srcFormat==PIX_FMT_RGB8 || srcFormat==PIX_FMT_BGR8 || srcFormat==PIX_FMT_PAL8 || srcFormat==PIX_FMT_BGR4_BYTE || srcFormat==PIX_FMT_RGB4_BYTE)", " if(!(flags&SWS_FAST_BILINEAR) || (!canMMX2BeUsed))", " if(!(flags&SWS_FAST_BILINEAR))", "\tint i;", "\tuint64_t ebxsave __attribute__((aligned(8)));", "\tif(canMMX2BeUsed)", "\t\tasm volatile(", "#endif", "\t\t\t\"pxor %%mm7, %%mm7\t\t\\n\\t\"", "\t\t\t\"mov %0, %%\"REG_c\"\t\t\\n\\t\"", "\t\t\t\"mov %1, %%\"REG_D\"\t\t\\n\\t\"", "\t\t\t\"mov %2, %%\"REG_d\"\t\t\\n\\t\"", "\t\t\t\"mov %3, %%\"REG_b\"\t\t\\n\\t\"", "\t\t\tPREFETCH\" (%%\"REG_c\")\t\t\\n\\t\"", "\t\t\tPREFETCH\" 32(%%\"REG_c\")\t\t\\n\\t\"", "\t\t\tPREFETCH\" 64(%%\"REG_c\")\t\t\\n\\t\"", "\t\t\t\"movl (%%\"REG_b\"), %%esi\t\\n\\t\"\\", "\t\t\t\"call *%4\t\t\t\\n\\t\"\\", "\t\t\t\"movl (%%\"REG_b\", %%\"REG_a\"), %%esi\\n\\t\"\\", "\t\t\t\"add %%\"REG_S\", %%\"REG_c\"\t\\n\\t\"\\", "\t\t\t\"add %%\"REG_a\", %%\"REG_D\"\t\\n\\t\"\\", "\t\t\t\"xor %%\"REG_a\", %%\"REG_a\"\t\\n\\t\"\\", "\t\t\t\"movl (%%\"REG_b\"), %%esi\t\\n\\t\"\\", "\t\t\t\"call *%4\t\t\t\\n\\t\"\\", "\t\t\t\"addl (%%\"REG_b\", %%\"REG_a\"), %%\"REG_c\"\\n\\t\"\\", "\t\t\t\"add %%\"REG_a\", %%\"REG_D\"\t\\n\\t\"\\", "\t\t\t\"xor %%\"REG_a\", %%\"REG_a\"\t\\n\\t\"\\", "\t\t\t,\"m\" (ebxsave)", "\t\t\t: \"%\"REG_a, \"%\"REG_c, \"%\"REG_d, \"%\"REG_S, \"%\"REG_D", "#endif", "\t\t);", "#endif", "\tuint16_t xInc_mask = xInc & 0xffff;", "\tasm volatile(", "\t\tASMALIGN(4)", "\t\t\"1:\t\t\t\t\\n\\t\"", "\t\t\"shll $16, %%edi\t\t\\n\\t\"", "\t\t\"mov %1, %%\"REG_D\"\t\t\\n\\t\"", "\t\t\"shrl $9, %%esi\t\t\t\\n\\t\"", "\t\t\"movw %%si, (%%\"REG_D\", %%\"REG_a\", 2)\\n\\t\"", "\t\t\"shll $16, %%edi\t\t\\n\\t\"", "\t\t\"mov %1, %%\"REG_D\"\t\t\\n\\t\"", "\t\t\"shrl $9, %%esi\t\t\t\\n\\t\"", "\t\t\"cmp %2, %%\"REG_a\"\t\t\\n\\t\"", "\t\t\" jb 1b\t\t\t\t\\n\\t\"", "\t\t: \"%\"REG_a, \"%\"REG_d, \"%ecx\", \"%\"REG_D, \"%esi\"", "\t\t);", "\tint i;", "\tunsigned int xpos=0;", "\tfor(i=0;i<dstWidth;i++)", "\t\tregister unsigned int xx=xpos>>16;", "\t\tregister unsigned int xalpha=(xpos&0xFFFF)>>9;", "\t\txpos+=xInc;", "\t\t\t\t int srcW, int xInc, int flags, int canMMX2BeUsed, int16_t *hChrFilter,", "\t\t\t\t int16_t *hChrFilterPos, int hChrFilterSize, void *funnyUVCode,", "\t\t\t\t int srcFormat, uint8_t *formatConvBuffer, int16_t *mmx2Filter,", "\t\t\t\t int32_t *mmx2FilterPos, uint8_t *pal)", " if(srcFormat==PIX_FMT_YUYV422)", "\tRENAME(yuy2ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW);", "\tsrc1= formatConvBuffer;", "\tsrc2= formatConvBuffer+2048;", " else if(srcFormat==PIX_FMT_UYVY422)", "\tRENAME(uyvyToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW);", "\tsrc1= formatConvBuffer;", "\tsrc2= formatConvBuffer+2048;", " else if(srcFormat==PIX_FMT_RGB32)", "\tRENAME(bgr32ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW);", "\tsrc1= formatConvBuffer;", "\tsrc2= formatConvBuffer+2048;", " else if(srcFormat==PIX_FMT_BGR24)", "\tRENAME(bgr24ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW);", "\tsrc1= formatConvBuffer;", "\tsrc2= formatConvBuffer+2048;", " else if(srcFormat==PIX_FMT_BGR565)", "\tRENAME(bgr16ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW);", "\tsrc1= formatConvBuffer;", "\tsrc2= formatConvBuffer+2048;", " else if(srcFormat==PIX_FMT_BGR555)", "\tRENAME(bgr15ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW);", "\tsrc1= formatConvBuffer;", "\tsrc2= formatConvBuffer+2048;", " else if(srcFormat==PIX_FMT_BGR32)", "\tRENAME(rgb32ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW);", "\tsrc1= formatConvBuffer;", "\tsrc2= formatConvBuffer+2048;", " else if(srcFormat==PIX_FMT_RGB24)", "\tRENAME(rgb24ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW);", "\tsrc1= formatConvBuffer;", "\tsrc2= formatConvBuffer+2048;", " else if(srcFormat==PIX_FMT_RGB565)", "\tRENAME(rgb16ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW);", "\tsrc1= formatConvBuffer;", "\tsrc2= formatConvBuffer+2048;", " else if(srcFormat==PIX_FMT_RGB555)", "\tRENAME(rgb15ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW);", "\tsrc1= formatConvBuffer;", "\tsrc2= formatConvBuffer+2048;", " else if(isGray(srcFormat))", " else if(srcFormat==PIX_FMT_RGB8 || srcFormat==PIX_FMT_BGR8 || srcFormat==PIX_FMT_PAL8 || srcFormat==PIX_FMT_BGR4_BYTE || srcFormat==PIX_FMT_RGB4_BYTE)", "\tRENAME(palToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW, pal);", "\tsrc1= formatConvBuffer;", "\tsrc2= formatConvBuffer+2048;", " if(!(flags&SWS_FAST_BILINEAR) || (!canMMX2BeUsed))", " if(!(flags&SWS_FAST_BILINEAR))", " \tRENAME(hScale)(dst , dstWidth, src1, srcW, xInc, hChrFilter, hChrFilterPos, hChrFilterSize);", " \tRENAME(hScale)(dst+2048, dstWidth, src2, srcW, xInc, hChrFilter, hChrFilterPos, hChrFilterSize);", "\tint i;", "\tuint64_t ebxsave __attribute__((aligned(8)));", "\tif(canMMX2BeUsed)", "\t\tasm volatile(", "\t\t\t\"mov %%\"REG_b\", %6 \\n\\t\"", "#endif", "\t\t\t\"pxor %%mm7, %%mm7\t\t\\n\\t\"", "\t\t\t\"mov %0, %%\"REG_c\"\t\t\\n\\t\"", "\t\t\t\"mov %1, %%\"REG_D\"\t\t\\n\\t\"", "\t\t\t\"mov %2, %%\"REG_d\"\t\t\\n\\t\"", "\t\t\t\"mov %3, %%\"REG_b\"\t\t\\n\\t\"", "\t\t\tPREFETCH\" (%%\"REG_c\")\t\t\\n\\t\"", "\t\t\tPREFETCH\" 32(%%\"REG_c\")\t\t\\n\\t\"", "\t\t\tPREFETCH\" 64(%%\"REG_c\")\t\t\\n\\t\"", "\t\t\t\"movl (%%\"REG_b\"), %%esi\t\\n\\t\"\\", "\t\t\t\"call *%4\t\t\t\\n\\t\"\\", "\t\t\t\"movl (%%\"REG_b\", %%\"REG_a\"), %%esi\\n\\t\"\\", "\t\t\t\"add %%\"REG_S\", %%\"REG_c\"\t\\n\\t\"\\", "\t\t\t\"add %%\"REG_a\", %%\"REG_D\"\t\\n\\t\"\\", "\t\t\t\"xor %%\"REG_a\", %%\"REG_a\"\t\\n\\t\"\\", "\t\t\t\"movl (%%\"REG_b\"), %%esi\t\\n\\t\"\\", "\t\t\t\"call *%4\t\t\t\\n\\t\"\\", "\t\t\t\"addl (%%\"REG_b\", %%\"REG_a\"), %%\"REG_c\"\\n\\t\"\\", "\t\t\t\"add %%\"REG_a\", %%\"REG_D\"\t\\n\\t\"\\", "\t\t\t\"xor %%\"REG_a\", %%\"REG_a\"\t\\n\\t\"\\", "\t\t\t\"add $4096, %%\"REG_D\"\t\t\\n\\t\"", "\t\t\tPREFETCH\" (%%\"REG_c\")\t\t\\n\\t\"", "\t\t\tPREFETCH\" 32(%%\"REG_c\")\t\t\\n\\t\"", "\t\t\tPREFETCH\" 64(%%\"REG_c\")\t\t\\n\\t\"", "\t\t\t\"mov %6, %%\"REG_b\" \\n\\t\"", "\t\t\t:: \"m\" (src1), \"m\" (dst), \"m\" (mmx2Filter), \"m\" (mmx2FilterPos),", "\t\t\t\"m\" (funnyUVCode), \"m\" (src2)", "\t\t\t,\"m\" (ebxsave)", "\t\t\t: \"%\"REG_a, \"%\"REG_c, \"%\"REG_d, \"%\"REG_S, \"%\"REG_D", "\t\t\t ,\"%\"REG_b", "#endif", "\t\t);", "\t\tfor(i=dstWidth-1; (i*xInc)>>16 >=srcW-1; i--)", "\t\t\tdst[i] = src1[srcW-1]*128;", "\t\t\tdst[i+2048] = src2[srcW-1]*128;", "#endif", "\tlong xInc_shr16 = (long) (xInc >> 16);", "\tuint16_t xInc_mask = xInc & 0xffff;", "\tasm volatile(", "\t\tASMALIGN(4)", "\t\t\"1:\t\t\t\t\\n\\t\"", "\t\t\"mov %0, %%\"REG_S\"\t\t\\n\\t\"", "\t\t\"shll $16, %%edi\t\t\\n\\t\"", "\t\t\"mov %1, %%\"REG_D\"\t\t\\n\\t\"", "\t\t\"shrl $9, %%esi\t\t\t\\n\\t\"", "\t\t\"movw %%si, (%%\"REG_D\", %%\"REG_a\", 2)\\n\\t\"", "\t\t\"shll $16, %%edi\t\t\\n\\t\"", "\t\t\"mov %1, %%\"REG_D\"\t\t\\n\\t\"", "\t\t\"shrl $9, %%esi\t\t\t\\n\\t\"", "\t\t\"movw %%si, 4096(%%\"REG_D\", %%\"REG_a\", 2)\\n\\t\"", "\t\t\"add $1, %%\"REG_a\"\t\t\\n\\t\"", "\t\t\"cmp %2, %%\"REG_a\"\t\t\\n\\t\"", "\t\t\" jb 1b\t\t\t\t\\n\\t\"", "\t\t:: \"m\" (src1), \"m\" (dst), \"g\" ((long)dstWidth), \"m\" (xInc_shr16), \"m\" (xInc_mask),", "\t\t:: \"m\" (src1), \"m\" (dst), \"m\" ((long)dstWidth), \"m\" (xInc_shr16), \"m\" (xInc_mask),", "\t\t\"r\" (src2)", "\t\t: \"%\"REG_a, \"%\"REG_d, \"%ecx\", \"%\"REG_D, \"%esi\"", "\t\t);", "\tint i;", "\tunsigned int xpos=0;", "\tfor(i=0;i<dstWidth;i++)", "\t\tregister unsigned int xx=xpos>>16;", "\t\tregister unsigned int xalpha=(xpos&0xFFFF)>>9;", "\t\tdst[i]=(src1[xx]*(xalpha^127)+src1[xx+1]*xalpha);", "\t\tdst[i+2048]=(src2[xx]*(xalpha^127)+src2[xx+1]*xalpha);", "\t\txpos+=xInc;", "#endif" ], "line_no": [ 239, 239, 195, 195, 349, 183, 165, 165, 165, 165, 165, 183, 165, 165, 165, 165, 183, 165, 165, 165, 165, 165, 349, 359, 183, 349, 359, 183, 165, 349, 359, 183, 349, 359, 183, 165, 183, 183, 349, 357, 359, 165, 165, 183, 349, 357, 359, 165, 165, 165, 165, 183, 165, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 195, 165, 203, 165, 323, 195, 165, 203, 165, 323, 195, 203, 323, 183, 7, 9, 37, 49, 61, 73, 85, 97, 109, 121, 141, 159, 163, 183, 187, 191, 195, 165, 203, 205, 207, 209, 211, 215, 217, 219, 229, 231, 233, 235, 237, 239, 229, 231, 253, 237, 239, 311, 315, 165, 323, 165, 347, 349, 357, 359, 371, 375, 377, 379, 371, 375, 377, 409, 411, 431, 323, 183, 445, 447, 451, 453, 467, 3, 5, 7, 9, 13, 17, 19, 21, 25, 29, 19, 21, 37, 41, 19, 21, 49, 53, 19, 21, 61, 65, 19, 21, 73, 77, 19, 21, 85, 89, 19, 21, 97, 101, 19, 21, 109, 113, 19, 21, 121, 125, 19, 21, 133, 141, 145, 19, 21, 159, 163, 169, 171, 183, 187, 191, 195, 199, 165, 203, 205, 207, 209, 211, 215, 217, 219, 229, 231, 233, 235, 237, 239, 229, 231, 253, 237, 239, 279, 215, 217, 219, 301, 305, 307, 311, 315, 319, 165, 323, 325, 331, 333, 165, 345, 347, 349, 357, 359, 361, 371, 375, 377, 379, 371, 375, 377, 399, 407, 409, 411, 421, 425, 429, 431, 323, 183, 445, 447, 451, 453, 455, 457, 467, 165 ] }
inline static void FUNC_0(hcscale)(uint16_t *dst, long dstWidth, uint8_t *src1, uint8_t *src2, int srcW, int xInc, int flags, int canMMX2BeUsed, int16_t *hChrFilter, int16_t *hChrFilterPos, int hChrFilterSize, void *funnyUVCode, int srcFormat, uint8_t *formatConvBuffer, int16_t *mmx2Filter, int32_t *mmx2FilterPos, uint8_t *pal) { if(srcFormat==PIX_FMT_YUYV422) { FUNC_0(yuy2ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+2048; } else if(srcFormat==PIX_FMT_UYVY422) { FUNC_0(uyvyToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+2048; } else if(srcFormat==PIX_FMT_RGB32) { FUNC_0(bgr32ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+2048; } else if(srcFormat==PIX_FMT_BGR24) { FUNC_0(bgr24ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+2048; } else if(srcFormat==PIX_FMT_BGR565) { FUNC_0(bgr16ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+2048; } else if(srcFormat==PIX_FMT_BGR555) { FUNC_0(bgr15ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+2048; } else if(srcFormat==PIX_FMT_BGR32) { FUNC_0(rgb32ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+2048; } else if(srcFormat==PIX_FMT_RGB24) { FUNC_0(rgb24ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+2048; } else if(srcFormat==PIX_FMT_RGB565) { FUNC_0(rgb16ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+2048; } else if(srcFormat==PIX_FMT_RGB555) { FUNC_0(rgb15ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+2048; } else if(isGray(srcFormat)) { return; } else if(srcFormat==PIX_FMT_RGB8 || srcFormat==PIX_FMT_BGR8 || srcFormat==PIX_FMT_PAL8 || srcFormat==PIX_FMT_BGR4_BYTE || srcFormat==PIX_FMT_RGB4_BYTE) { FUNC_0(palToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW, pal); src1= formatConvBuffer; src2= formatConvBuffer+2048; } #ifdef HAVE_MMX if(!(flags&SWS_FAST_BILINEAR) || (!canMMX2BeUsed)) #else if(!(flags&SWS_FAST_BILINEAR)) #endif { FUNC_0(hScale)(dst , dstWidth, src1, srcW, xInc, hChrFilter, hChrFilterPos, hChrFilterSize); FUNC_0(hScale)(dst+2048, dstWidth, src2, srcW, xInc, hChrFilter, hChrFilterPos, hChrFilterSize); } else { #if defined(ARCH_X86) #ifdef HAVE_MMX2 int VAR_0; #if defined(PIC) uint64_t ebxsave __attribute__((aligned(8))); #endif if(canMMX2BeUsed) { asm volatile( #if defined(PIC) "mov %%"REG_b", %6 \n\t" #endif "pxor %%mm7, %%mm7 \n\t" "mov %0, %%"REG_c" \n\t" "mov %1, %%"REG_D" \n\t" "mov %2, %%"REG_d" \n\t" "mov %3, %%"REG_b" \n\t" "xor %%"REG_a", %%"REG_a" \n\t" PREFETCH" (%%"REG_c") \n\t" PREFETCH" 32(%%"REG_c") \n\t" PREFETCH" 64(%%"REG_c") \n\t" #ifdef ARCH_X86_64 #define FUNNY_UV_CODE \ "movl (%%"REG_b"), %%esi \n\t"\ "call *%4 \n\t"\ "movl (%%"REG_b", %%"REG_a"), %%esi\n\t"\ "add %%"REG_S", %%"REG_c" \n\t"\ "add %%"REG_a", %%"REG_D" \n\t"\ "xor %%"REG_a", %%"REG_a" \n\t"\ #else #define FUNNY_UV_CODE \ "movl (%%"REG_b"), %%esi \n\t"\ "call *%4 \n\t"\ "addl (%%"REG_b", %%"REG_a"), %%"REG_c"\n\t"\ "add %%"REG_a", %%"REG_D" \n\t"\ "xor %%"REG_a", %%"REG_a" \n\t"\ #endif FUNNY_UV_CODE FUNNY_UV_CODE FUNNY_UV_CODE FUNNY_UV_CODE "xor %%"REG_a", %%"REG_a" \n\t" "mov %5, %%"REG_c" \n\t" "mov %1, %%"REG_D" \n\t" "add $4096, %%"REG_D" \n\t" PREFETCH" (%%"REG_c") \n\t" PREFETCH" 32(%%"REG_c") \n\t" PREFETCH" 64(%%"REG_c") \n\t" FUNNY_UV_CODE FUNNY_UV_CODE FUNNY_UV_CODE FUNNY_UV_CODE #if defined(PIC) "mov %6, %%"REG_b" \n\t" #endif :: "m" (src1), "m" (dst), "m" (mmx2Filter), "m" (mmx2FilterPos), "m" (funnyUVCode), "m" (src2) #if defined(PIC) ,"m" (ebxsave) #endif : "%"REG_a, "%"REG_c, "%"REG_d, "%"REG_S, "%"REG_D #if !defined(PIC) ,"%"REG_b #endif ); for(VAR_0=dstWidth-1; (VAR_0*xInc)>>16 >=srcW-1; VAR_0--) { dst[VAR_0] = src1[srcW-1]*128; dst[VAR_0+2048] = src2[srcW-1]*128; } } else { #endif long xInc_shr16 = (long) (xInc >> 16); uint16_t xInc_mask = xInc & 0xffff; asm volatile( "xor %%"REG_a", %%"REG_a" \n\t" "xor %%"REG_d", %%"REG_d" \n\t" "xorl %%ecx, %%ecx \n\t" ASMALIGN(4) "1: \n\t" "mov %0, %%"REG_S" \n\t" "movzbl (%%"REG_S", %%"REG_d"), %%edi \n\t" "movzbl 1(%%"REG_S", %%"REG_d"), %%esi \n\t" "subl %%edi, %%esi \n\t" - src[xx] "imull %%ecx, %%esi \n\t" "shll $16, %%edi \n\t" "addl %%edi, %%esi \n\t" *2*xalpha + src[xx]*(1-2*xalpha) "mov %1, %%"REG_D" \n\t" "shrl $9, %%esi \n\t" "movw %%si, (%%"REG_D", %%"REG_a", 2)\n\t" "movzbl (%5, %%"REG_d"), %%edi \n\t" "movzbl 1(%5, %%"REG_d"), %%esi \n\t" "subl %%edi, %%esi \n\t" - src[xx] "imull %%ecx, %%esi \n\t" "shll $16, %%edi \n\t" "addl %%edi, %%esi \n\t" *2*xalpha + src[xx]*(1-2*xalpha) "mov %1, %%"REG_D" \n\t" "shrl $9, %%esi \n\t" "movw %%si, 4096(%%"REG_D", %%"REG_a", 2)\n\t" "addw %4, %%cx \n\t" "adc %3, %%"REG_d" \n\t" "add $1, %%"REG_a" \n\t" "cmp %2, %%"REG_a" \n\t" " jb 1b \n\t" #if defined(ARCH_X86_64) && ((__GNUC__ > 3) || ( __GNUC__ == 3 && __GNUC_MINOR__ >= 4)) :: "m" (src1), "m" (dst), "g" ((long)dstWidth), "m" (xInc_shr16), "m" (xInc_mask), #else :: "m" (src1), "m" (dst), "m" ((long)dstWidth), "m" (xInc_shr16), "m" (xInc_mask), #endif "r" (src2) : "%"REG_a, "%"REG_d, "%ecx", "%"REG_D, "%esi" ); #ifdef HAVE_MMX2 } #endif #else int VAR_0; unsigned int VAR_1=0; for(VAR_0=0;VAR_0<dstWidth;VAR_0++) { register unsigned int xx=VAR_1>>16; register unsigned int xalpha=(VAR_1&0xFFFF)>>9; dst[VAR_0]=(src1[xx]*(xalpha^127)+src1[xx+1]*xalpha); dst[VAR_0+2048]=(src2[xx]*(xalpha^127)+src2[xx+1]*xalpha); VAR_1+=xInc; } #endif } }
[ "inline static void FUNC_0(hcscale)(uint16_t *dst, long dstWidth, uint8_t *src1, uint8_t *src2,\nint srcW, int xInc, int flags, int canMMX2BeUsed, int16_t *hChrFilter,\nint16_t *hChrFilterPos, int hChrFilterSize, void *funnyUVCode,\nint srcFormat, uint8_t *formatConvBuffer, int16_t *mmx2Filter,\nint32_t *mmx2FilterPos, uint8_t *pal)\n{", "if(srcFormat==PIX_FMT_YUYV422)\n{", "FUNC_0(yuy2ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW);", "src1= formatConvBuffer;", "src2= formatConvBuffer+2048;", "}", "else if(srcFormat==PIX_FMT_UYVY422)\n{", "FUNC_0(uyvyToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW);", "src1= formatConvBuffer;", "src2= formatConvBuffer+2048;", "}", "else if(srcFormat==PIX_FMT_RGB32)\n{", "FUNC_0(bgr32ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW);", "src1= formatConvBuffer;", "src2= formatConvBuffer+2048;", "}", "else if(srcFormat==PIX_FMT_BGR24)\n{", "FUNC_0(bgr24ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW);", "src1= formatConvBuffer;", "src2= formatConvBuffer+2048;", "}", "else if(srcFormat==PIX_FMT_BGR565)\n{", "FUNC_0(bgr16ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW);", "src1= formatConvBuffer;", "src2= formatConvBuffer+2048;", "}", "else if(srcFormat==PIX_FMT_BGR555)\n{", "FUNC_0(bgr15ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW);", "src1= formatConvBuffer;", "src2= formatConvBuffer+2048;", "}", "else if(srcFormat==PIX_FMT_BGR32)\n{", "FUNC_0(rgb32ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW);", "src1= formatConvBuffer;", "src2= formatConvBuffer+2048;", "}", "else if(srcFormat==PIX_FMT_RGB24)\n{", "FUNC_0(rgb24ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW);", "src1= formatConvBuffer;", "src2= formatConvBuffer+2048;", "}", "else if(srcFormat==PIX_FMT_RGB565)\n{", "FUNC_0(rgb16ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW);", "src1= formatConvBuffer;", "src2= formatConvBuffer+2048;", "}", "else if(srcFormat==PIX_FMT_RGB555)\n{", "FUNC_0(rgb15ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW);", "src1= formatConvBuffer;", "src2= formatConvBuffer+2048;", "}", "else if(isGray(srcFormat))\n{", "return;", "}", "else if(srcFormat==PIX_FMT_RGB8 || srcFormat==PIX_FMT_BGR8 || srcFormat==PIX_FMT_PAL8 || srcFormat==PIX_FMT_BGR4_BYTE || srcFormat==PIX_FMT_RGB4_BYTE)\n{", "FUNC_0(palToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW, pal);", "src1= formatConvBuffer;", "src2= formatConvBuffer+2048;", "}", "#ifdef HAVE_MMX\nif(!(flags&SWS_FAST_BILINEAR) || (!canMMX2BeUsed))\n#else\nif(!(flags&SWS_FAST_BILINEAR))\n#endif\n{", "FUNC_0(hScale)(dst , dstWidth, src1, srcW, xInc, hChrFilter, hChrFilterPos, hChrFilterSize);", "FUNC_0(hScale)(dst+2048, dstWidth, src2, srcW, xInc, hChrFilter, hChrFilterPos, hChrFilterSize);", "}", "else\n{", "#if defined(ARCH_X86)\n#ifdef HAVE_MMX2\nint VAR_0;", "#if defined(PIC)\nuint64_t ebxsave __attribute__((aligned(8)));", "#endif\nif(canMMX2BeUsed)\n{", "asm volatile(\n#if defined(PIC)\n\"mov %%\"REG_b\", %6 \\n\\t\"\n#endif\n\"pxor %%mm7, %%mm7\t\t\\n\\t\"\n\"mov %0, %%\"REG_c\"\t\t\\n\\t\"\n\"mov %1, %%\"REG_D\"\t\t\\n\\t\"\n\"mov %2, %%\"REG_d\"\t\t\\n\\t\"\n\"mov %3, %%\"REG_b\"\t\t\\n\\t\"\n\"xor %%\"REG_a\", %%\"REG_a\"\t\\n\\t\"\nPREFETCH\" (%%\"REG_c\")\t\t\\n\\t\"\nPREFETCH\" 32(%%\"REG_c\")\t\t\\n\\t\"\nPREFETCH\" 64(%%\"REG_c\")\t\t\\n\\t\"\n#ifdef ARCH_X86_64\n#define FUNNY_UV_CODE \\\n\"movl (%%\"REG_b\"), %%esi\t\\n\\t\"\\\n\"call *%4\t\t\t\\n\\t\"\\\n\"movl (%%\"REG_b\", %%\"REG_a\"), %%esi\\n\\t\"\\\n\"add %%\"REG_S\", %%\"REG_c\"\t\\n\\t\"\\\n\"add %%\"REG_a\", %%\"REG_D\"\t\\n\\t\"\\\n\"xor %%\"REG_a\", %%\"REG_a\"\t\\n\\t\"\\\n#else\n#define FUNNY_UV_CODE \\\n\"movl (%%\"REG_b\"), %%esi\t\\n\\t\"\\\n\"call *%4\t\t\t\\n\\t\"\\\n\"addl (%%\"REG_b\", %%\"REG_a\"), %%\"REG_c\"\\n\\t\"\\\n\"add %%\"REG_a\", %%\"REG_D\"\t\\n\\t\"\\\n\"xor %%\"REG_a\", %%\"REG_a\"\t\\n\\t\"\\\n#endif\nFUNNY_UV_CODE\nFUNNY_UV_CODE\nFUNNY_UV_CODE\nFUNNY_UV_CODE\n\"xor %%\"REG_a\", %%\"REG_a\"\t\\n\\t\"\n\"mov %5, %%\"REG_c\"\t\t\\n\\t\"\n\"mov %1, %%\"REG_D\"\t\t\\n\\t\"\n\"add $4096, %%\"REG_D\"\t\t\\n\\t\"\nPREFETCH\" (%%\"REG_c\")\t\t\\n\\t\"\nPREFETCH\" 32(%%\"REG_c\")\t\t\\n\\t\"\nPREFETCH\" 64(%%\"REG_c\")\t\t\\n\\t\"\nFUNNY_UV_CODE\nFUNNY_UV_CODE\nFUNNY_UV_CODE\nFUNNY_UV_CODE\n#if defined(PIC)\n\"mov %6, %%\"REG_b\" \\n\\t\"\n#endif\n:: \"m\" (src1), \"m\" (dst), \"m\" (mmx2Filter), \"m\" (mmx2FilterPos),\n\"m\" (funnyUVCode), \"m\" (src2)\n#if defined(PIC)\n,\"m\" (ebxsave)\n#endif\n: \"%\"REG_a, \"%\"REG_c, \"%\"REG_d, \"%\"REG_S, \"%\"REG_D\n#if !defined(PIC)\n,\"%\"REG_b\n#endif\n);", "for(VAR_0=dstWidth-1; (VAR_0*xInc)>>16 >=srcW-1; VAR_0--)", "{", "dst[VAR_0] = src1[srcW-1]*128;", "dst[VAR_0+2048] = src2[srcW-1]*128;", "}", "}", "else\n{", "#endif\nlong xInc_shr16 = (long) (xInc >> 16);", "uint16_t xInc_mask = xInc & 0xffff;", "asm volatile(\n\"xor %%\"REG_a\", %%\"REG_a\"\t\\n\\t\"\n\"xor %%\"REG_d\", %%\"REG_d\"\t\t\\n\\t\"\n\"xorl %%ecx, %%ecx\t\t\\n\\t\"\nASMALIGN(4)\n\"1:\t\t\t\t\\n\\t\"\n\"mov %0, %%\"REG_S\"\t\t\\n\\t\"\n\"movzbl (%%\"REG_S\", %%\"REG_d\"), %%edi\t\\n\\t\"\n\"movzbl 1(%%\"REG_S\", %%\"REG_d\"), %%esi\t\\n\\t\"\n\"subl %%edi, %%esi\t\t\\n\\t\" - src[xx]\n\"imull %%ecx, %%esi\t\t\\n\\t\"\n\"shll $16, %%edi\t\t\\n\\t\"\n\"addl %%edi, %%esi\t\t\\n\\t\" *2*xalpha + src[xx]*(1-2*xalpha)\n\"mov %1, %%\"REG_D\"\t\t\\n\\t\"\n\"shrl $9, %%esi\t\t\t\\n\\t\"\n\"movw %%si, (%%\"REG_D\", %%\"REG_a\", 2)\\n\\t\"\n\"movzbl (%5, %%\"REG_d\"), %%edi\t\\n\\t\"\n\"movzbl 1(%5, %%\"REG_d\"), %%esi\t\\n\\t\"\n\"subl %%edi, %%esi\t\t\\n\\t\" - src[xx]\n\"imull %%ecx, %%esi\t\t\\n\\t\"\n\"shll $16, %%edi\t\t\\n\\t\"\n\"addl %%edi, %%esi\t\t\\n\\t\" *2*xalpha + src[xx]*(1-2*xalpha)\n\"mov %1, %%\"REG_D\"\t\t\\n\\t\"\n\"shrl $9, %%esi\t\t\t\\n\\t\"\n\"movw %%si, 4096(%%\"REG_D\", %%\"REG_a\", 2)\\n\\t\"\n\"addw %4, %%cx\t\t\t\\n\\t\"\n\"adc %3, %%\"REG_d\"\t\t\\n\\t\"\n\"add $1, %%\"REG_a\"\t\t\\n\\t\"\n\"cmp %2, %%\"REG_a\"\t\t\\n\\t\"\n\" jb 1b\t\t\t\t\\n\\t\"\n#if defined(ARCH_X86_64) && ((__GNUC__ > 3) || ( __GNUC__ == 3 && __GNUC_MINOR__ >= 4))\n:: \"m\" (src1), \"m\" (dst), \"g\" ((long)dstWidth), \"m\" (xInc_shr16), \"m\" (xInc_mask),\n#else\n:: \"m\" (src1), \"m\" (dst), \"m\" ((long)dstWidth), \"m\" (xInc_shr16), \"m\" (xInc_mask),\n#endif\n\"r\" (src2)\n: \"%\"REG_a, \"%\"REG_d, \"%ecx\", \"%\"REG_D, \"%esi\"\n);", "#ifdef HAVE_MMX2\n}", "#endif\n#else\nint VAR_0;", "unsigned int VAR_1=0;", "for(VAR_0=0;VAR_0<dstWidth;VAR_0++)", "{", "register unsigned int xx=VAR_1>>16;", "register unsigned int xalpha=(VAR_1&0xFFFF)>>9;", "dst[VAR_0]=(src1[xx]*(xalpha^127)+src1[xx+1]*xalpha);", "dst[VAR_0+2048]=(src2[xx]*(xalpha^127)+src2[xx+1]*xalpha);", "VAR_1+=xInc;", "}", "#endif\n}", "}" ]
[ 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37, 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49, 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61, 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73, 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85, 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97, 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109, 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121, 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133, 135 ], [ 137 ], [ 139 ], [ 141, 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 155, 159, 161, 163, 165, 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175, 177 ], [ 179, 181, 183 ], [ 185, 187 ], [ 189, 191, 193 ], [ 195, 197, 199, 201, 203, 205, 207, 209, 211, 213, 215, 217, 219, 223, 227, 229, 231, 233, 235, 237, 239, 243, 247, 249, 251, 253, 255, 257, 261, 265, 267, 269, 271, 273, 275, 277, 279, 281, 283, 285, 289, 291, 293, 295, 299, 301, 303, 305, 307, 309, 311, 313, 315, 317, 319, 321, 323 ], [ 325 ], [ 327 ], [ 331 ], [ 333 ], [ 335 ], [ 337 ], [ 339, 341 ], [ 343, 345 ], [ 347 ], [ 349, 351, 353, 355, 357, 359, 361, 363, 365, 367, 369, 371, 373, 375, 377, 379, 383, 385, 387, 389, 391, 393, 395, 397, 399, 403, 405, 407, 409, 411, 419, 421, 423, 425, 427, 429, 431, 433 ], [ 435, 437 ], [ 439, 441, 443 ], [ 445 ], [ 447 ], [ 449 ], [ 451 ], [ 453 ], [ 455 ], [ 457 ], [ 467 ], [ 469 ], [ 471, 473 ], [ 475 ] ]
26,384
static void virtio_blk_rw_complete(void *opaque, int ret) { VirtIOBlockReq *next = opaque; while (next) { VirtIOBlockReq *req = next; next = req->mr_next; trace_virtio_blk_rw_complete(req, ret); if (req->qiov.nalloc != -1) { /* If nalloc is != 1 req->qiov is a local copy of the original * external iovec. It was allocated in submit_merged_requests * to be able to merge requests. */ qemu_iovec_destroy(&req->qiov); } if (ret) { int p = virtio_ldl_p(VIRTIO_DEVICE(req->dev), &req->out.type); bool is_read = !(p & VIRTIO_BLK_T_OUT); /* Note that memory may be dirtied on read failure. If the * virtio request is not completed here, as is the case for * BLOCK_ERROR_ACTION_STOP, the memory may not be copied * correctly during live migration. While this is ugly, * it is acceptable because the device is free to write to * the memory until the request is completed (which will * happen on the other side of the migration). if (virtio_blk_handle_rw_error(req, -ret, is_read)) { continue; } } virtio_blk_req_complete(req, VIRTIO_BLK_S_OK); block_acct_done(blk_get_stats(req->dev->blk), &req->acct); virtio_blk_free_request(req); } }
true
qemu
10f5a72f70862d299ddbdf226d6dc71fa4ae34dd
static void virtio_blk_rw_complete(void *opaque, int ret) { VirtIOBlockReq *next = opaque; while (next) { VirtIOBlockReq *req = next; next = req->mr_next; trace_virtio_blk_rw_complete(req, ret); if (req->qiov.nalloc != -1) { qemu_iovec_destroy(&req->qiov); } if (ret) { int p = virtio_ldl_p(VIRTIO_DEVICE(req->dev), &req->out.type); bool is_read = !(p & VIRTIO_BLK_T_OUT); /* Note that memory may be dirtied on read failure. If the * virtio request is not completed here, as is the case for * BLOCK_ERROR_ACTION_STOP, the memory may not be copied * correctly during live migration. While this is ugly, * it is acceptable because the device is free to write to * the memory until the request is completed (which will * happen on the other side of the migration). if (virtio_blk_handle_rw_error(req, -ret, is_read)) { continue; } } virtio_blk_req_complete(req, VIRTIO_BLK_S_OK); block_acct_done(blk_get_stats(req->dev->blk), &req->acct); virtio_blk_free_request(req); } }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, int VAR_1) { VirtIOBlockReq *next = VAR_0; while (next) { VirtIOBlockReq *req = next; next = req->mr_next; trace_virtio_blk_rw_complete(req, VAR_1); if (req->qiov.nalloc != -1) { qemu_iovec_destroy(&req->qiov); } if (VAR_1) { int VAR_2 = virtio_ldl_p(VIRTIO_DEVICE(req->dev), &req->out.type); bool is_read = !(VAR_2 & VIRTIO_BLK_T_OUT); /* Note that memory may be dirtied on read failure. If the * virtio request is not completed here, as is the case for * BLOCK_ERROR_ACTION_STOP, the memory may not be copied * correctly during live migration. While this is ugly, * it is acceptable because the device is free to write to * the memory until the request is completed (which will * happen on the other side of the migration). if (virtio_blk_handle_rw_error(req, -VAR_1, is_read)) { continue; } } virtio_blk_req_complete(req, VIRTIO_BLK_S_OK); block_acct_done(blk_get_stats(req->dev->blk), &req->acct); virtio_blk_free_request(req); } }
[ "static void FUNC_0(void *VAR_0, int VAR_1)\n{", "VirtIOBlockReq *next = VAR_0;", "while (next) {", "VirtIOBlockReq *req = next;", "next = req->mr_next;", "trace_virtio_blk_rw_complete(req, VAR_1);", "if (req->qiov.nalloc != -1) {", "qemu_iovec_destroy(&req->qiov);", "}", "if (VAR_1) {", "int VAR_2 = virtio_ldl_p(VIRTIO_DEVICE(req->dev), &req->out.type);", "bool is_read = !(VAR_2 & VIRTIO_BLK_T_OUT);", "/* Note that memory may be dirtied on read failure. If the\n* virtio request is not completed here, as is the case for\n* BLOCK_ERROR_ACTION_STOP, the memory may not be copied\n* correctly during live migration. While this is ugly,\n* it is acceptable because the device is free to write to\n* the memory until the request is completed (which will\n* happen on the other side of the migration).\nif (virtio_blk_handle_rw_error(req, -VAR_1, is_read)) {", "continue;", "}", "}", "virtio_blk_req_complete(req, VIRTIO_BLK_S_OK);", "block_acct_done(blk_get_stats(req->dev->blk), &req->acct);", "virtio_blk_free_request(req);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39, 41, 43, 45, 47, 49, 51, 54 ], [ 60 ], [ 62 ], [ 64 ], [ 68 ], [ 70 ], [ 72 ], [ 74 ], [ 76 ] ]
26,385
static void qmp_input_type_str(Visitor *v, const char *name, char **obj, Error **errp) { QmpInputVisitor *qiv = to_qiv(v); QString *qstr = qobject_to_qstring(qmp_input_get_object(qiv, name, true)); if (!qstr) { error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null", "string"); return; } *obj = g_strdup(qstring_get_str(qstr)); }
true
qemu
e58d695e6c3a5cfa0aa2fc91b87ade017ef28b05
static void qmp_input_type_str(Visitor *v, const char *name, char **obj, Error **errp) { QmpInputVisitor *qiv = to_qiv(v); QString *qstr = qobject_to_qstring(qmp_input_get_object(qiv, name, true)); if (!qstr) { error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null", "string"); return; } *obj = g_strdup(qstring_get_str(qstr)); }
{ "code": [], "line_no": [] }
static void FUNC_0(Visitor *VAR_0, const char *VAR_1, char **VAR_2, Error **VAR_3) { QmpInputVisitor *qiv = to_qiv(VAR_0); QString *qstr = qobject_to_qstring(qmp_input_get_object(qiv, VAR_1, true)); if (!qstr) { error_setg(VAR_3, QERR_INVALID_PARAMETER_TYPE, VAR_1 ? VAR_1 : "null", "string"); return; } *VAR_2 = g_strdup(qstring_get_str(qstr)); }
[ "static void FUNC_0(Visitor *VAR_0, const char *VAR_1, char **VAR_2,\nError **VAR_3)\n{", "QmpInputVisitor *qiv = to_qiv(VAR_0);", "QString *qstr = qobject_to_qstring(qmp_input_get_object(qiv, VAR_1, true));", "if (!qstr) {", "error_setg(VAR_3, QERR_INVALID_PARAMETER_TYPE, VAR_1 ? VAR_1 : \"null\",\n\"string\");", "return;", "}", "*VAR_2 = g_strdup(qstring_get_str(qstr));", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 16, 18 ], [ 20 ], [ 22 ], [ 26 ], [ 28 ] ]
26,386
static int wavpack_decode_block(AVCodecContext *avctx, int block_no, void *data, int *got_frame_ptr, const uint8_t *buf, int buf_size) { WavpackContext *wc = avctx->priv_data; WavpackFrameContext *s; void *samples = data; int samplecount; int got_terms = 0, got_weights = 0, got_samples = 0, got_entropy = 0, got_bs = 0, got_float = 0; int got_hybrid = 0; const uint8_t* orig_buf = buf; const uint8_t* buf_end = buf + buf_size; int i, j, id, size, ssize, weights, t; int bpp, chan, chmask; if (buf_size == 0){ *got_frame_ptr = 0; return 0; } if(block_no >= wc->fdec_num && wv_alloc_frame_context(wc) < 0){ av_log(avctx, AV_LOG_ERROR, "Error creating frame decode context\n"); return -1; } s = wc->fdec[block_no]; if(!s){ av_log(avctx, AV_LOG_ERROR, "Context for block %d is not present\n", block_no); return -1; } memset(s->decorr, 0, MAX_TERMS * sizeof(Decorr)); memset(s->ch, 0, sizeof(s->ch)); s->extra_bits = 0; s->and = s->or = s->shift = 0; s->got_extra_bits = 0; if(!wc->mkv_mode){ s->samples = AV_RL32(buf); buf += 4; if(!s->samples){ *got_frame_ptr = 0; return 0; } }else{ s->samples = wc->samples; } s->frame_flags = AV_RL32(buf); buf += 4; if(s->frame_flags&0x80){ avctx->sample_fmt = AV_SAMPLE_FMT_FLT; } else if((s->frame_flags&0x03) <= 1){ avctx->sample_fmt = AV_SAMPLE_FMT_S16; } else { avctx->sample_fmt = AV_SAMPLE_FMT_S32; } bpp = av_get_bytes_per_sample(avctx->sample_fmt); samples = (uint8_t*)samples + bpp * wc->ch_offset; s->stereo = !(s->frame_flags & WV_MONO); s->stereo_in = (s->frame_flags & WV_FALSE_STEREO) ? 0 : s->stereo; s->joint = s->frame_flags & WV_JOINT_STEREO; s->hybrid = s->frame_flags & WV_HYBRID_MODE; s->hybrid_bitrate = s->frame_flags & WV_HYBRID_BITRATE; s->hybrid_maxclip = 1 << ((((s->frame_flags & 0x03) + 1) << 3) - 1); s->post_shift = 8 * (bpp-1-(s->frame_flags&0x03)) + ((s->frame_flags >> 13) & 0x1f); s->CRC = AV_RL32(buf); buf += 4; if(wc->mkv_mode) buf += 4; //skip block size; wc->ch_offset += 1 + s->stereo; // parse metadata blocks while(buf < buf_end){ id = *buf++; size = *buf++; if(id & WP_IDF_LONG) { size |= (*buf++) << 8; size |= (*buf++) << 16; } size <<= 1; // size is specified in words ssize = size; if(id & WP_IDF_ODD) size--; if(size < 0){ av_log(avctx, AV_LOG_ERROR, "Got incorrect block %02X with size %i\n", id, size); break; } if(buf + ssize > buf_end){ av_log(avctx, AV_LOG_ERROR, "Block size %i is out of bounds\n", size); break; } if(id & WP_IDF_IGNORE){ buf += ssize; continue; } switch(id & WP_IDF_MASK){ case WP_ID_DECTERMS: if(size > MAX_TERMS){ av_log(avctx, AV_LOG_ERROR, "Too many decorrelation terms\n"); s->terms = 0; buf += ssize; continue; } s->terms = size; for(i = 0; i < s->terms; i++) { s->decorr[s->terms - i - 1].value = (*buf & 0x1F) - 5; s->decorr[s->terms - i - 1].delta = *buf >> 5; buf++; } got_terms = 1; break; case WP_ID_DECWEIGHTS: if(!got_terms){ av_log(avctx, AV_LOG_ERROR, "No decorrelation terms met\n"); continue; } weights = size >> s->stereo_in; if(weights > MAX_TERMS || weights > s->terms){ av_log(avctx, AV_LOG_ERROR, "Too many decorrelation weights\n"); buf += ssize; continue; } for(i = 0; i < weights; i++) { t = (int8_t)(*buf++); s->decorr[s->terms - i - 1].weightA = t << 3; if(s->decorr[s->terms - i - 1].weightA > 0) s->decorr[s->terms - i - 1].weightA += (s->decorr[s->terms - i - 1].weightA + 64) >> 7; if(s->stereo_in){ t = (int8_t)(*buf++); s->decorr[s->terms - i - 1].weightB = t << 3; if(s->decorr[s->terms - i - 1].weightB > 0) s->decorr[s->terms - i - 1].weightB += (s->decorr[s->terms - i - 1].weightB + 64) >> 7; } } got_weights = 1; break; case WP_ID_DECSAMPLES: if(!got_terms){ av_log(avctx, AV_LOG_ERROR, "No decorrelation terms met\n"); continue; } t = 0; for(i = s->terms - 1; (i >= 0) && (t < size); i--) { if(s->decorr[i].value > 8){ s->decorr[i].samplesA[0] = wp_exp2(AV_RL16(buf)); buf += 2; s->decorr[i].samplesA[1] = wp_exp2(AV_RL16(buf)); buf += 2; if(s->stereo_in){ s->decorr[i].samplesB[0] = wp_exp2(AV_RL16(buf)); buf += 2; s->decorr[i].samplesB[1] = wp_exp2(AV_RL16(buf)); buf += 2; t += 4; } t += 4; }else if(s->decorr[i].value < 0){ s->decorr[i].samplesA[0] = wp_exp2(AV_RL16(buf)); buf += 2; s->decorr[i].samplesB[0] = wp_exp2(AV_RL16(buf)); buf += 2; t += 4; }else{ for(j = 0; j < s->decorr[i].value; j++){ s->decorr[i].samplesA[j] = wp_exp2(AV_RL16(buf)); buf += 2; if(s->stereo_in){ s->decorr[i].samplesB[j] = wp_exp2(AV_RL16(buf)); buf += 2; } } t += s->decorr[i].value * 2 * (s->stereo_in + 1); } } got_samples = 1; break; case WP_ID_ENTROPY: if(size != 6 * (s->stereo_in + 1)){ av_log(avctx, AV_LOG_ERROR, "Entropy vars size should be %i, got %i", 6 * (s->stereo_in + 1), size); buf += ssize; continue; } for(j = 0; j <= s->stereo_in; j++){ for(i = 0; i < 3; i++){ s->ch[j].median[i] = wp_exp2(AV_RL16(buf)); buf += 2; } } got_entropy = 1; break; case WP_ID_HYBRID: if(s->hybrid_bitrate){ for(i = 0; i <= s->stereo_in; i++){ s->ch[i].slow_level = wp_exp2(AV_RL16(buf)); buf += 2; size -= 2; } } for(i = 0; i < (s->stereo_in + 1); i++){ s->ch[i].bitrate_acc = AV_RL16(buf) << 16; buf += 2; size -= 2; } if(size > 0){ for(i = 0; i < (s->stereo_in + 1); i++){ s->ch[i].bitrate_delta = wp_exp2((int16_t)AV_RL16(buf)); buf += 2; } }else{ for(i = 0; i < (s->stereo_in + 1); i++) s->ch[i].bitrate_delta = 0; } got_hybrid = 1; break; case WP_ID_INT32INFO: if(size != 4){ av_log(avctx, AV_LOG_ERROR, "Invalid INT32INFO, size = %i, sent_bits = %i\n", size, *buf); buf += ssize; continue; } if(buf[0]) s->extra_bits = buf[0]; else if(buf[1]) s->shift = buf[1]; else if(buf[2]){ s->and = s->or = 1; s->shift = buf[2]; }else if(buf[3]){ s->and = 1; s->shift = buf[3]; } buf += 4; break; case WP_ID_FLOATINFO: if(size != 4){ av_log(avctx, AV_LOG_ERROR, "Invalid FLOATINFO, size = %i\n", size); buf += ssize; continue; } s->float_flag = buf[0]; s->float_shift = buf[1]; s->float_max_exp = buf[2]; buf += 4; got_float = 1; break; case WP_ID_DATA: s->sc.offset = buf - orig_buf; s->sc.size = size * 8; init_get_bits(&s->gb, buf, size * 8); s->data_size = size * 8; buf += size; got_bs = 1; break; case WP_ID_EXTRABITS: if(size <= 4){ av_log(avctx, AV_LOG_ERROR, "Invalid EXTRABITS, size = %i\n", size); buf += size; continue; } s->extra_sc.offset = buf - orig_buf; s->extra_sc.size = size * 8; init_get_bits(&s->gb_extra_bits, buf, size * 8); s->crc_extra_bits = get_bits_long(&s->gb_extra_bits, 32); buf += size; s->got_extra_bits = 1; break; case WP_ID_CHANINFO: if(size <= 1){ av_log(avctx, AV_LOG_ERROR, "Insufficient channel information\n"); return -1; } chan = *buf++; switch(size - 2){ case 0: chmask = *buf; break; case 1: chmask = AV_RL16(buf); break; case 2: chmask = AV_RL24(buf); break; case 3: chmask = AV_RL32(buf); break; case 5: chan |= (buf[1] & 0xF) << 8; chmask = AV_RL24(buf + 2); break; default: av_log(avctx, AV_LOG_ERROR, "Invalid channel info size %d\n", size); chan = avctx->channels; chmask = avctx->channel_layout; } if(chan != avctx->channels){ av_log(avctx, AV_LOG_ERROR, "Block reports total %d channels, decoder believes it's %d channels\n", chan, avctx->channels); return -1; } if(!avctx->channel_layout) avctx->channel_layout = chmask; buf += size - 1; break; default: buf += size; } if(id & WP_IDF_ODD) buf++; } if(!got_terms){ av_log(avctx, AV_LOG_ERROR, "No block with decorrelation terms\n"); return -1; } if(!got_weights){ av_log(avctx, AV_LOG_ERROR, "No block with decorrelation weights\n"); return -1; } if(!got_samples){ av_log(avctx, AV_LOG_ERROR, "No block with decorrelation samples\n"); return -1; } if(!got_entropy){ av_log(avctx, AV_LOG_ERROR, "No block with entropy info\n"); return -1; } if(s->hybrid && !got_hybrid){ av_log(avctx, AV_LOG_ERROR, "Hybrid config not found\n"); return -1; } if(!got_bs){ av_log(avctx, AV_LOG_ERROR, "Packed samples not found\n"); return -1; } if(!got_float && avctx->sample_fmt == AV_SAMPLE_FMT_FLT){ av_log(avctx, AV_LOG_ERROR, "Float information not found\n"); return -1; } if(s->got_extra_bits && avctx->sample_fmt != AV_SAMPLE_FMT_FLT){ const int size = get_bits_left(&s->gb_extra_bits); const int wanted = s->samples * s->extra_bits << s->stereo_in; if(size < wanted){ av_log(avctx, AV_LOG_ERROR, "Too small EXTRABITS\n"); s->got_extra_bits = 0; } } if(s->stereo_in){ if(avctx->sample_fmt == AV_SAMPLE_FMT_S16) samplecount = wv_unpack_stereo(s, &s->gb, samples, AV_SAMPLE_FMT_S16); else if(avctx->sample_fmt == AV_SAMPLE_FMT_S32) samplecount = wv_unpack_stereo(s, &s->gb, samples, AV_SAMPLE_FMT_S32); else samplecount = wv_unpack_stereo(s, &s->gb, samples, AV_SAMPLE_FMT_FLT); if (samplecount < 0) return -1; samplecount >>= 1; }else{ const int channel_stride = avctx->channels; if(avctx->sample_fmt == AV_SAMPLE_FMT_S16) samplecount = wv_unpack_mono(s, &s->gb, samples, AV_SAMPLE_FMT_S16); else if(avctx->sample_fmt == AV_SAMPLE_FMT_S32) samplecount = wv_unpack_mono(s, &s->gb, samples, AV_SAMPLE_FMT_S32); else samplecount = wv_unpack_mono(s, &s->gb, samples, AV_SAMPLE_FMT_FLT); if (samplecount < 0) return -1; if(s->stereo && avctx->sample_fmt == AV_SAMPLE_FMT_S16){ int16_t *dst = (int16_t*)samples + 1; int16_t *src = (int16_t*)samples; int cnt = samplecount; while(cnt--){ *dst = *src; src += channel_stride; dst += channel_stride; } }else if(s->stereo && avctx->sample_fmt == AV_SAMPLE_FMT_S32){ int32_t *dst = (int32_t*)samples + 1; int32_t *src = (int32_t*)samples; int cnt = samplecount; while(cnt--){ *dst = *src; src += channel_stride; dst += channel_stride; } }else if(s->stereo){ float *dst = (float*)samples + 1; float *src = (float*)samples; int cnt = samplecount; while(cnt--){ *dst = *src; src += channel_stride; dst += channel_stride; } } } *got_frame_ptr = 1; return samplecount * bpp; }
true
FFmpeg
bb9747c8eee134f2bf6058d368f8cbc799f4b7d3
static int wavpack_decode_block(AVCodecContext *avctx, int block_no, void *data, int *got_frame_ptr, const uint8_t *buf, int buf_size) { WavpackContext *wc = avctx->priv_data; WavpackFrameContext *s; void *samples = data; int samplecount; int got_terms = 0, got_weights = 0, got_samples = 0, got_entropy = 0, got_bs = 0, got_float = 0; int got_hybrid = 0; const uint8_t* orig_buf = buf; const uint8_t* buf_end = buf + buf_size; int i, j, id, size, ssize, weights, t; int bpp, chan, chmask; if (buf_size == 0){ *got_frame_ptr = 0; return 0; } if(block_no >= wc->fdec_num && wv_alloc_frame_context(wc) < 0){ av_log(avctx, AV_LOG_ERROR, "Error creating frame decode context\n"); return -1; } s = wc->fdec[block_no]; if(!s){ av_log(avctx, AV_LOG_ERROR, "Context for block %d is not present\n", block_no); return -1; } memset(s->decorr, 0, MAX_TERMS * sizeof(Decorr)); memset(s->ch, 0, sizeof(s->ch)); s->extra_bits = 0; s->and = s->or = s->shift = 0; s->got_extra_bits = 0; if(!wc->mkv_mode){ s->samples = AV_RL32(buf); buf += 4; if(!s->samples){ *got_frame_ptr = 0; return 0; } }else{ s->samples = wc->samples; } s->frame_flags = AV_RL32(buf); buf += 4; if(s->frame_flags&0x80){ avctx->sample_fmt = AV_SAMPLE_FMT_FLT; } else if((s->frame_flags&0x03) <= 1){ avctx->sample_fmt = AV_SAMPLE_FMT_S16; } else { avctx->sample_fmt = AV_SAMPLE_FMT_S32; } bpp = av_get_bytes_per_sample(avctx->sample_fmt); samples = (uint8_t*)samples + bpp * wc->ch_offset; s->stereo = !(s->frame_flags & WV_MONO); s->stereo_in = (s->frame_flags & WV_FALSE_STEREO) ? 0 : s->stereo; s->joint = s->frame_flags & WV_JOINT_STEREO; s->hybrid = s->frame_flags & WV_HYBRID_MODE; s->hybrid_bitrate = s->frame_flags & WV_HYBRID_BITRATE; s->hybrid_maxclip = 1 << ((((s->frame_flags & 0x03) + 1) << 3) - 1); s->post_shift = 8 * (bpp-1-(s->frame_flags&0x03)) + ((s->frame_flags >> 13) & 0x1f); s->CRC = AV_RL32(buf); buf += 4; if(wc->mkv_mode) buf += 4; wc->ch_offset += 1 + s->stereo; while(buf < buf_end){ id = *buf++; size = *buf++; if(id & WP_IDF_LONG) { size |= (*buf++) << 8; size |= (*buf++) << 16; } size <<= 1; ssize = size; if(id & WP_IDF_ODD) size--; if(size < 0){ av_log(avctx, AV_LOG_ERROR, "Got incorrect block %02X with size %i\n", id, size); break; } if(buf + ssize > buf_end){ av_log(avctx, AV_LOG_ERROR, "Block size %i is out of bounds\n", size); break; } if(id & WP_IDF_IGNORE){ buf += ssize; continue; } switch(id & WP_IDF_MASK){ case WP_ID_DECTERMS: if(size > MAX_TERMS){ av_log(avctx, AV_LOG_ERROR, "Too many decorrelation terms\n"); s->terms = 0; buf += ssize; continue; } s->terms = size; for(i = 0; i < s->terms; i++) { s->decorr[s->terms - i - 1].value = (*buf & 0x1F) - 5; s->decorr[s->terms - i - 1].delta = *buf >> 5; buf++; } got_terms = 1; break; case WP_ID_DECWEIGHTS: if(!got_terms){ av_log(avctx, AV_LOG_ERROR, "No decorrelation terms met\n"); continue; } weights = size >> s->stereo_in; if(weights > MAX_TERMS || weights > s->terms){ av_log(avctx, AV_LOG_ERROR, "Too many decorrelation weights\n"); buf += ssize; continue; } for(i = 0; i < weights; i++) { t = (int8_t)(*buf++); s->decorr[s->terms - i - 1].weightA = t << 3; if(s->decorr[s->terms - i - 1].weightA > 0) s->decorr[s->terms - i - 1].weightA += (s->decorr[s->terms - i - 1].weightA + 64) >> 7; if(s->stereo_in){ t = (int8_t)(*buf++); s->decorr[s->terms - i - 1].weightB = t << 3; if(s->decorr[s->terms - i - 1].weightB > 0) s->decorr[s->terms - i - 1].weightB += (s->decorr[s->terms - i - 1].weightB + 64) >> 7; } } got_weights = 1; break; case WP_ID_DECSAMPLES: if(!got_terms){ av_log(avctx, AV_LOG_ERROR, "No decorrelation terms met\n"); continue; } t = 0; for(i = s->terms - 1; (i >= 0) && (t < size); i--) { if(s->decorr[i].value > 8){ s->decorr[i].samplesA[0] = wp_exp2(AV_RL16(buf)); buf += 2; s->decorr[i].samplesA[1] = wp_exp2(AV_RL16(buf)); buf += 2; if(s->stereo_in){ s->decorr[i].samplesB[0] = wp_exp2(AV_RL16(buf)); buf += 2; s->decorr[i].samplesB[1] = wp_exp2(AV_RL16(buf)); buf += 2; t += 4; } t += 4; }else if(s->decorr[i].value < 0){ s->decorr[i].samplesA[0] = wp_exp2(AV_RL16(buf)); buf += 2; s->decorr[i].samplesB[0] = wp_exp2(AV_RL16(buf)); buf += 2; t += 4; }else{ for(j = 0; j < s->decorr[i].value; j++){ s->decorr[i].samplesA[j] = wp_exp2(AV_RL16(buf)); buf += 2; if(s->stereo_in){ s->decorr[i].samplesB[j] = wp_exp2(AV_RL16(buf)); buf += 2; } } t += s->decorr[i].value * 2 * (s->stereo_in + 1); } } got_samples = 1; break; case WP_ID_ENTROPY: if(size != 6 * (s->stereo_in + 1)){ av_log(avctx, AV_LOG_ERROR, "Entropy vars size should be %i, got %i", 6 * (s->stereo_in + 1), size); buf += ssize; continue; } for(j = 0; j <= s->stereo_in; j++){ for(i = 0; i < 3; i++){ s->ch[j].median[i] = wp_exp2(AV_RL16(buf)); buf += 2; } } got_entropy = 1; break; case WP_ID_HYBRID: if(s->hybrid_bitrate){ for(i = 0; i <= s->stereo_in; i++){ s->ch[i].slow_level = wp_exp2(AV_RL16(buf)); buf += 2; size -= 2; } } for(i = 0; i < (s->stereo_in + 1); i++){ s->ch[i].bitrate_acc = AV_RL16(buf) << 16; buf += 2; size -= 2; } if(size > 0){ for(i = 0; i < (s->stereo_in + 1); i++){ s->ch[i].bitrate_delta = wp_exp2((int16_t)AV_RL16(buf)); buf += 2; } }else{ for(i = 0; i < (s->stereo_in + 1); i++) s->ch[i].bitrate_delta = 0; } got_hybrid = 1; break; case WP_ID_INT32INFO: if(size != 4){ av_log(avctx, AV_LOG_ERROR, "Invalid INT32INFO, size = %i, sent_bits = %i\n", size, *buf); buf += ssize; continue; } if(buf[0]) s->extra_bits = buf[0]; else if(buf[1]) s->shift = buf[1]; else if(buf[2]){ s->and = s->or = 1; s->shift = buf[2]; }else if(buf[3]){ s->and = 1; s->shift = buf[3]; } buf += 4; break; case WP_ID_FLOATINFO: if(size != 4){ av_log(avctx, AV_LOG_ERROR, "Invalid FLOATINFO, size = %i\n", size); buf += ssize; continue; } s->float_flag = buf[0]; s->float_shift = buf[1]; s->float_max_exp = buf[2]; buf += 4; got_float = 1; break; case WP_ID_DATA: s->sc.offset = buf - orig_buf; s->sc.size = size * 8; init_get_bits(&s->gb, buf, size * 8); s->data_size = size * 8; buf += size; got_bs = 1; break; case WP_ID_EXTRABITS: if(size <= 4){ av_log(avctx, AV_LOG_ERROR, "Invalid EXTRABITS, size = %i\n", size); buf += size; continue; } s->extra_sc.offset = buf - orig_buf; s->extra_sc.size = size * 8; init_get_bits(&s->gb_extra_bits, buf, size * 8); s->crc_extra_bits = get_bits_long(&s->gb_extra_bits, 32); buf += size; s->got_extra_bits = 1; break; case WP_ID_CHANINFO: if(size <= 1){ av_log(avctx, AV_LOG_ERROR, "Insufficient channel information\n"); return -1; } chan = *buf++; switch(size - 2){ case 0: chmask = *buf; break; case 1: chmask = AV_RL16(buf); break; case 2: chmask = AV_RL24(buf); break; case 3: chmask = AV_RL32(buf); break; case 5: chan |= (buf[1] & 0xF) << 8; chmask = AV_RL24(buf + 2); break; default: av_log(avctx, AV_LOG_ERROR, "Invalid channel info size %d\n", size); chan = avctx->channels; chmask = avctx->channel_layout; } if(chan != avctx->channels){ av_log(avctx, AV_LOG_ERROR, "Block reports total %d channels, decoder believes it's %d channels\n", chan, avctx->channels); return -1; } if(!avctx->channel_layout) avctx->channel_layout = chmask; buf += size - 1; break; default: buf += size; } if(id & WP_IDF_ODD) buf++; } if(!got_terms){ av_log(avctx, AV_LOG_ERROR, "No block with decorrelation terms\n"); return -1; } if(!got_weights){ av_log(avctx, AV_LOG_ERROR, "No block with decorrelation weights\n"); return -1; } if(!got_samples){ av_log(avctx, AV_LOG_ERROR, "No block with decorrelation samples\n"); return -1; } if(!got_entropy){ av_log(avctx, AV_LOG_ERROR, "No block with entropy info\n"); return -1; } if(s->hybrid && !got_hybrid){ av_log(avctx, AV_LOG_ERROR, "Hybrid config not found\n"); return -1; } if(!got_bs){ av_log(avctx, AV_LOG_ERROR, "Packed samples not found\n"); return -1; } if(!got_float && avctx->sample_fmt == AV_SAMPLE_FMT_FLT){ av_log(avctx, AV_LOG_ERROR, "Float information not found\n"); return -1; } if(s->got_extra_bits && avctx->sample_fmt != AV_SAMPLE_FMT_FLT){ const int size = get_bits_left(&s->gb_extra_bits); const int wanted = s->samples * s->extra_bits << s->stereo_in; if(size < wanted){ av_log(avctx, AV_LOG_ERROR, "Too small EXTRABITS\n"); s->got_extra_bits = 0; } } if(s->stereo_in){ if(avctx->sample_fmt == AV_SAMPLE_FMT_S16) samplecount = wv_unpack_stereo(s, &s->gb, samples, AV_SAMPLE_FMT_S16); else if(avctx->sample_fmt == AV_SAMPLE_FMT_S32) samplecount = wv_unpack_stereo(s, &s->gb, samples, AV_SAMPLE_FMT_S32); else samplecount = wv_unpack_stereo(s, &s->gb, samples, AV_SAMPLE_FMT_FLT); if (samplecount < 0) return -1; samplecount >>= 1; }else{ const int channel_stride = avctx->channels; if(avctx->sample_fmt == AV_SAMPLE_FMT_S16) samplecount = wv_unpack_mono(s, &s->gb, samples, AV_SAMPLE_FMT_S16); else if(avctx->sample_fmt == AV_SAMPLE_FMT_S32) samplecount = wv_unpack_mono(s, &s->gb, samples, AV_SAMPLE_FMT_S32); else samplecount = wv_unpack_mono(s, &s->gb, samples, AV_SAMPLE_FMT_FLT); if (samplecount < 0) return -1; if(s->stereo && avctx->sample_fmt == AV_SAMPLE_FMT_S16){ int16_t *dst = (int16_t*)samples + 1; int16_t *src = (int16_t*)samples; int cnt = samplecount; while(cnt--){ *dst = *src; src += channel_stride; dst += channel_stride; } }else if(s->stereo && avctx->sample_fmt == AV_SAMPLE_FMT_S32){ int32_t *dst = (int32_t*)samples + 1; int32_t *src = (int32_t*)samples; int cnt = samplecount; while(cnt--){ *dst = *src; src += channel_stride; dst += channel_stride; } }else if(s->stereo){ float *dst = (float*)samples + 1; float *src = (float*)samples; int cnt = samplecount; while(cnt--){ *dst = *src; src += channel_stride; dst += channel_stride; } } } *got_frame_ptr = 1; return samplecount * bpp; }
{ "code": [ " s->hybrid_maxclip = 1 << ((((s->frame_flags & 0x03) + 1) << 3) - 1);" ], "line_no": [ 125 ] }
static int FUNC_0(AVCodecContext *VAR_0, int VAR_1, void *VAR_2, int *VAR_3, const uint8_t *VAR_4, int VAR_5) { WavpackContext *wc = VAR_0->priv_data; WavpackFrameContext *s; void *VAR_6 = VAR_2; int VAR_7; int VAR_8 = 0, VAR_9 = 0, VAR_10 = 0, VAR_11 = 0, VAR_12 = 0, VAR_13 = 0; int VAR_14 = 0; const uint8_t* VAR_15 = VAR_4; const uint8_t* VAR_16 = VAR_4 + VAR_5; int VAR_17, VAR_18, VAR_19, VAR_27, VAR_21, VAR_22, VAR_23; int VAR_24, VAR_25, VAR_26; if (VAR_5 == 0){ *VAR_3 = 0; return 0; } if(VAR_1 >= wc->fdec_num && wv_alloc_frame_context(wc) < 0){ av_log(VAR_0, AV_LOG_ERROR, "Error creating frame decode context\n"); return -1; } s = wc->fdec[VAR_1]; if(!s){ av_log(VAR_0, AV_LOG_ERROR, "Context for block %d is not present\n", VAR_1); return -1; } memset(s->decorr, 0, MAX_TERMS * sizeof(Decorr)); memset(s->ch, 0, sizeof(s->ch)); s->extra_bits = 0; s->and = s->or = s->shift = 0; s->got_extra_bits = 0; if(!wc->mkv_mode){ s->VAR_6 = AV_RL32(VAR_4); VAR_4 += 4; if(!s->VAR_6){ *VAR_3 = 0; return 0; } }else{ s->VAR_6 = wc->VAR_6; } s->frame_flags = AV_RL32(VAR_4); VAR_4 += 4; if(s->frame_flags&0x80){ VAR_0->sample_fmt = AV_SAMPLE_FMT_FLT; } else if((s->frame_flags&0x03) <= 1){ VAR_0->sample_fmt = AV_SAMPLE_FMT_S16; } else { VAR_0->sample_fmt = AV_SAMPLE_FMT_S32; } VAR_24 = av_get_bytes_per_sample(VAR_0->sample_fmt); VAR_6 = (uint8_t*)VAR_6 + VAR_24 * wc->ch_offset; s->stereo = !(s->frame_flags & WV_MONO); s->stereo_in = (s->frame_flags & WV_FALSE_STEREO) ? 0 : s->stereo; s->joint = s->frame_flags & WV_JOINT_STEREO; s->hybrid = s->frame_flags & WV_HYBRID_MODE; s->hybrid_bitrate = s->frame_flags & WV_HYBRID_BITRATE; s->hybrid_maxclip = 1 << ((((s->frame_flags & 0x03) + 1) << 3) - 1); s->post_shift = 8 * (VAR_24-1-(s->frame_flags&0x03)) + ((s->frame_flags >> 13) & 0x1f); s->CRC = AV_RL32(VAR_4); VAR_4 += 4; if(wc->mkv_mode) VAR_4 += 4; wc->ch_offset += 1 + s->stereo; while(VAR_4 < VAR_16){ VAR_19 = *VAR_4++; VAR_27 = *VAR_4++; if(VAR_19 & WP_IDF_LONG) { VAR_27 |= (*VAR_4++) << 8; VAR_27 |= (*VAR_4++) << 16; } VAR_27 <<= 1; VAR_21 = VAR_27; if(VAR_19 & WP_IDF_ODD) VAR_27--; if(VAR_27 < 0){ av_log(VAR_0, AV_LOG_ERROR, "Got incorrect block %02X with VAR_27 %VAR_17\n", VAR_19, VAR_27); break; } if(VAR_4 + VAR_21 > VAR_16){ av_log(VAR_0, AV_LOG_ERROR, "Block VAR_27 %VAR_17 is out of bounds\n", VAR_27); break; } if(VAR_19 & WP_IDF_IGNORE){ VAR_4 += VAR_21; continue; } switch(VAR_19 & WP_IDF_MASK){ case WP_ID_DECTERMS: if(VAR_27 > MAX_TERMS){ av_log(VAR_0, AV_LOG_ERROR, "Too many decorrelation terms\n"); s->terms = 0; VAR_4 += VAR_21; continue; } s->terms = VAR_27; for(VAR_17 = 0; VAR_17 < s->terms; VAR_17++) { s->decorr[s->terms - VAR_17 - 1].value = (*VAR_4 & 0x1F) - 5; s->decorr[s->terms - VAR_17 - 1].delta = *VAR_4 >> 5; VAR_4++; } VAR_8 = 1; break; case WP_ID_DECWEIGHTS: if(!VAR_8){ av_log(VAR_0, AV_LOG_ERROR, "No decorrelation terms met\n"); continue; } VAR_22 = VAR_27 >> s->stereo_in; if(VAR_22 > MAX_TERMS || VAR_22 > s->terms){ av_log(VAR_0, AV_LOG_ERROR, "Too many decorrelation VAR_22\n"); VAR_4 += VAR_21; continue; } for(VAR_17 = 0; VAR_17 < VAR_22; VAR_17++) { VAR_23 = (int8_t)(*VAR_4++); s->decorr[s->terms - VAR_17 - 1].weightA = VAR_23 << 3; if(s->decorr[s->terms - VAR_17 - 1].weightA > 0) s->decorr[s->terms - VAR_17 - 1].weightA += (s->decorr[s->terms - VAR_17 - 1].weightA + 64) >> 7; if(s->stereo_in){ VAR_23 = (int8_t)(*VAR_4++); s->decorr[s->terms - VAR_17 - 1].weightB = VAR_23 << 3; if(s->decorr[s->terms - VAR_17 - 1].weightB > 0) s->decorr[s->terms - VAR_17 - 1].weightB += (s->decorr[s->terms - VAR_17 - 1].weightB + 64) >> 7; } } VAR_9 = 1; break; case WP_ID_DECSAMPLES: if(!VAR_8){ av_log(VAR_0, AV_LOG_ERROR, "No decorrelation terms met\n"); continue; } VAR_23 = 0; for(VAR_17 = s->terms - 1; (VAR_17 >= 0) && (VAR_23 < VAR_27); VAR_17--) { if(s->decorr[VAR_17].value > 8){ s->decorr[VAR_17].samplesA[0] = wp_exp2(AV_RL16(VAR_4)); VAR_4 += 2; s->decorr[VAR_17].samplesA[1] = wp_exp2(AV_RL16(VAR_4)); VAR_4 += 2; if(s->stereo_in){ s->decorr[VAR_17].samplesB[0] = wp_exp2(AV_RL16(VAR_4)); VAR_4 += 2; s->decorr[VAR_17].samplesB[1] = wp_exp2(AV_RL16(VAR_4)); VAR_4 += 2; VAR_23 += 4; } VAR_23 += 4; }else if(s->decorr[VAR_17].value < 0){ s->decorr[VAR_17].samplesA[0] = wp_exp2(AV_RL16(VAR_4)); VAR_4 += 2; s->decorr[VAR_17].samplesB[0] = wp_exp2(AV_RL16(VAR_4)); VAR_4 += 2; VAR_23 += 4; }else{ for(VAR_18 = 0; VAR_18 < s->decorr[VAR_17].value; VAR_18++){ s->decorr[VAR_17].samplesA[VAR_18] = wp_exp2(AV_RL16(VAR_4)); VAR_4 += 2; if(s->stereo_in){ s->decorr[VAR_17].samplesB[VAR_18] = wp_exp2(AV_RL16(VAR_4)); VAR_4 += 2; } } VAR_23 += s->decorr[VAR_17].value * 2 * (s->stereo_in + 1); } } VAR_10 = 1; break; case WP_ID_ENTROPY: if(VAR_27 != 6 * (s->stereo_in + 1)){ av_log(VAR_0, AV_LOG_ERROR, "Entropy vars VAR_27 should be %VAR_17, got %VAR_17", 6 * (s->stereo_in + 1), VAR_27); VAR_4 += VAR_21; continue; } for(VAR_18 = 0; VAR_18 <= s->stereo_in; VAR_18++){ for(VAR_17 = 0; VAR_17 < 3; VAR_17++){ s->ch[VAR_18].median[VAR_17] = wp_exp2(AV_RL16(VAR_4)); VAR_4 += 2; } } VAR_11 = 1; break; case WP_ID_HYBRID: if(s->hybrid_bitrate){ for(VAR_17 = 0; VAR_17 <= s->stereo_in; VAR_17++){ s->ch[VAR_17].slow_level = wp_exp2(AV_RL16(VAR_4)); VAR_4 += 2; VAR_27 -= 2; } } for(VAR_17 = 0; VAR_17 < (s->stereo_in + 1); VAR_17++){ s->ch[VAR_17].bitrate_acc = AV_RL16(VAR_4) << 16; VAR_4 += 2; VAR_27 -= 2; } if(VAR_27 > 0){ for(VAR_17 = 0; VAR_17 < (s->stereo_in + 1); VAR_17++){ s->ch[VAR_17].bitrate_delta = wp_exp2((int16_t)AV_RL16(VAR_4)); VAR_4 += 2; } }else{ for(VAR_17 = 0; VAR_17 < (s->stereo_in + 1); VAR_17++) s->ch[VAR_17].bitrate_delta = 0; } VAR_14 = 1; break; case WP_ID_INT32INFO: if(VAR_27 != 4){ av_log(VAR_0, AV_LOG_ERROR, "Invalid INT32INFO, VAR_27 = %VAR_17, sent_bits = %VAR_17\n", VAR_27, *VAR_4); VAR_4 += VAR_21; continue; } if(VAR_4[0]) s->extra_bits = VAR_4[0]; else if(VAR_4[1]) s->shift = VAR_4[1]; else if(VAR_4[2]){ s->and = s->or = 1; s->shift = VAR_4[2]; }else if(VAR_4[3]){ s->and = 1; s->shift = VAR_4[3]; } VAR_4 += 4; break; case WP_ID_FLOATINFO: if(VAR_27 != 4){ av_log(VAR_0, AV_LOG_ERROR, "Invalid FLOATINFO, VAR_27 = %VAR_17\n", VAR_27); VAR_4 += VAR_21; continue; } s->float_flag = VAR_4[0]; s->float_shift = VAR_4[1]; s->float_max_exp = VAR_4[2]; VAR_4 += 4; VAR_13 = 1; break; case WP_ID_DATA: s->sc.offset = VAR_4 - VAR_15; s->sc.VAR_27 = VAR_27 * 8; init_get_bits(&s->gb, VAR_4, VAR_27 * 8); s->data_size = VAR_27 * 8; VAR_4 += VAR_27; VAR_12 = 1; break; case WP_ID_EXTRABITS: if(VAR_27 <= 4){ av_log(VAR_0, AV_LOG_ERROR, "Invalid EXTRABITS, VAR_27 = %VAR_17\n", VAR_27); VAR_4 += VAR_27; continue; } s->extra_sc.offset = VAR_4 - VAR_15; s->extra_sc.VAR_27 = VAR_27 * 8; init_get_bits(&s->gb_extra_bits, VAR_4, VAR_27 * 8); s->crc_extra_bits = get_bits_long(&s->gb_extra_bits, 32); VAR_4 += VAR_27; s->got_extra_bits = 1; break; case WP_ID_CHANINFO: if(VAR_27 <= 1){ av_log(VAR_0, AV_LOG_ERROR, "Insufficient channel information\n"); return -1; } VAR_25 = *VAR_4++; switch(VAR_27 - 2){ case 0: VAR_26 = *VAR_4; break; case 1: VAR_26 = AV_RL16(VAR_4); break; case 2: VAR_26 = AV_RL24(VAR_4); break; case 3: VAR_26 = AV_RL32(VAR_4); break; case 5: VAR_25 |= (VAR_4[1] & 0xF) << 8; VAR_26 = AV_RL24(VAR_4 + 2); break; default: av_log(VAR_0, AV_LOG_ERROR, "Invalid channel info VAR_27 %d\n", VAR_27); VAR_25 = VAR_0->channels; VAR_26 = VAR_0->channel_layout; } if(VAR_25 != VAR_0->channels){ av_log(VAR_0, AV_LOG_ERROR, "Block reports total %d channels, decoder believes it's %d channels\n", VAR_25, VAR_0->channels); return -1; } if(!VAR_0->channel_layout) VAR_0->channel_layout = VAR_26; VAR_4 += VAR_27 - 1; break; default: VAR_4 += VAR_27; } if(VAR_19 & WP_IDF_ODD) VAR_4++; } if(!VAR_8){ av_log(VAR_0, AV_LOG_ERROR, "No block with decorrelation terms\n"); return -1; } if(!VAR_9){ av_log(VAR_0, AV_LOG_ERROR, "No block with decorrelation VAR_22\n"); return -1; } if(!VAR_10){ av_log(VAR_0, AV_LOG_ERROR, "No block with decorrelation VAR_6\n"); return -1; } if(!VAR_11){ av_log(VAR_0, AV_LOG_ERROR, "No block with entropy info\n"); return -1; } if(s->hybrid && !VAR_14){ av_log(VAR_0, AV_LOG_ERROR, "Hybrid config not found\n"); return -1; } if(!VAR_12){ av_log(VAR_0, AV_LOG_ERROR, "Packed VAR_6 not found\n"); return -1; } if(!VAR_13 && VAR_0->sample_fmt == AV_SAMPLE_FMT_FLT){ av_log(VAR_0, AV_LOG_ERROR, "Float information not found\n"); return -1; } if(s->got_extra_bits && VAR_0->sample_fmt != AV_SAMPLE_FMT_FLT){ const int VAR_27 = get_bits_left(&s->gb_extra_bits); const int VAR_27 = s->VAR_6 * s->extra_bits << s->stereo_in; if(VAR_27 < VAR_27){ av_log(VAR_0, AV_LOG_ERROR, "Too small EXTRABITS\n"); s->got_extra_bits = 0; } } if(s->stereo_in){ if(VAR_0->sample_fmt == AV_SAMPLE_FMT_S16) VAR_7 = wv_unpack_stereo(s, &s->gb, VAR_6, AV_SAMPLE_FMT_S16); else if(VAR_0->sample_fmt == AV_SAMPLE_FMT_S32) VAR_7 = wv_unpack_stereo(s, &s->gb, VAR_6, AV_SAMPLE_FMT_S32); else VAR_7 = wv_unpack_stereo(s, &s->gb, VAR_6, AV_SAMPLE_FMT_FLT); if (VAR_7 < 0) return -1; VAR_7 >>= 1; }else{ const int VAR_28 = VAR_0->channels; if(VAR_0->sample_fmt == AV_SAMPLE_FMT_S16) VAR_7 = wv_unpack_mono(s, &s->gb, VAR_6, AV_SAMPLE_FMT_S16); else if(VAR_0->sample_fmt == AV_SAMPLE_FMT_S32) VAR_7 = wv_unpack_mono(s, &s->gb, VAR_6, AV_SAMPLE_FMT_S32); else VAR_7 = wv_unpack_mono(s, &s->gb, VAR_6, AV_SAMPLE_FMT_FLT); if (VAR_7 < 0) return -1; if(s->stereo && VAR_0->sample_fmt == AV_SAMPLE_FMT_S16){ int16_t *VAR_30 = (int16_t*)VAR_6 + 1; int16_t *VAR_31 = (int16_t*)VAR_6; int VAR_32 = VAR_7; while(VAR_32--){ *VAR_30 = *VAR_31; VAR_31 += VAR_28; VAR_30 += VAR_28; } }else if(s->stereo && VAR_0->sample_fmt == AV_SAMPLE_FMT_S32){ int32_t *VAR_30 = (int32_t*)VAR_6 + 1; int32_t *VAR_31 = (int32_t*)VAR_6; int VAR_32 = VAR_7; while(VAR_32--){ *VAR_30 = *VAR_31; VAR_31 += VAR_28; VAR_30 += VAR_28; } }else if(s->stereo){ float *VAR_30 = (float*)VAR_6 + 1; float *VAR_31 = (float*)VAR_6; int VAR_32 = VAR_7; while(VAR_32--){ *VAR_30 = *VAR_31; VAR_31 += VAR_28; VAR_30 += VAR_28; } } } *VAR_3 = 1; return VAR_7 * VAR_24; }
[ "static int FUNC_0(AVCodecContext *VAR_0, int VAR_1,\nvoid *VAR_2, int *VAR_3,\nconst uint8_t *VAR_4, int VAR_5)\n{", "WavpackContext *wc = VAR_0->priv_data;", "WavpackFrameContext *s;", "void *VAR_6 = VAR_2;", "int VAR_7;", "int VAR_8 = 0, VAR_9 = 0, VAR_10 = 0, VAR_11 = 0, VAR_12 = 0, VAR_13 = 0;", "int VAR_14 = 0;", "const uint8_t* VAR_15 = VAR_4;", "const uint8_t* VAR_16 = VAR_4 + VAR_5;", "int VAR_17, VAR_18, VAR_19, VAR_27, VAR_21, VAR_22, VAR_23;", "int VAR_24, VAR_25, VAR_26;", "if (VAR_5 == 0){", "*VAR_3 = 0;", "return 0;", "}", "if(VAR_1 >= wc->fdec_num && wv_alloc_frame_context(wc) < 0){", "av_log(VAR_0, AV_LOG_ERROR, \"Error creating frame decode context\\n\");", "return -1;", "}", "s = wc->fdec[VAR_1];", "if(!s){", "av_log(VAR_0, AV_LOG_ERROR, \"Context for block %d is not present\\n\", VAR_1);", "return -1;", "}", "memset(s->decorr, 0, MAX_TERMS * sizeof(Decorr));", "memset(s->ch, 0, sizeof(s->ch));", "s->extra_bits = 0;", "s->and = s->or = s->shift = 0;", "s->got_extra_bits = 0;", "if(!wc->mkv_mode){", "s->VAR_6 = AV_RL32(VAR_4); VAR_4 += 4;", "if(!s->VAR_6){", "*VAR_3 = 0;", "return 0;", "}", "}else{", "s->VAR_6 = wc->VAR_6;", "}", "s->frame_flags = AV_RL32(VAR_4); VAR_4 += 4;", "if(s->frame_flags&0x80){", "VAR_0->sample_fmt = AV_SAMPLE_FMT_FLT;", "} else if((s->frame_flags&0x03) <= 1){", "VAR_0->sample_fmt = AV_SAMPLE_FMT_S16;", "} else {", "VAR_0->sample_fmt = AV_SAMPLE_FMT_S32;", "}", "VAR_24 = av_get_bytes_per_sample(VAR_0->sample_fmt);", "VAR_6 = (uint8_t*)VAR_6 + VAR_24 * wc->ch_offset;", "s->stereo = !(s->frame_flags & WV_MONO);", "s->stereo_in = (s->frame_flags & WV_FALSE_STEREO) ? 0 : s->stereo;", "s->joint = s->frame_flags & WV_JOINT_STEREO;", "s->hybrid = s->frame_flags & WV_HYBRID_MODE;", "s->hybrid_bitrate = s->frame_flags & WV_HYBRID_BITRATE;", "s->hybrid_maxclip = 1 << ((((s->frame_flags & 0x03) + 1) << 3) - 1);", "s->post_shift = 8 * (VAR_24-1-(s->frame_flags&0x03)) + ((s->frame_flags >> 13) & 0x1f);", "s->CRC = AV_RL32(VAR_4); VAR_4 += 4;", "if(wc->mkv_mode)\nVAR_4 += 4;", "wc->ch_offset += 1 + s->stereo;", "while(VAR_4 < VAR_16){", "VAR_19 = *VAR_4++;", "VAR_27 = *VAR_4++;", "if(VAR_19 & WP_IDF_LONG) {", "VAR_27 |= (*VAR_4++) << 8;", "VAR_27 |= (*VAR_4++) << 16;", "}", "VAR_27 <<= 1;", "VAR_21 = VAR_27;", "if(VAR_19 & WP_IDF_ODD) VAR_27--;", "if(VAR_27 < 0){", "av_log(VAR_0, AV_LOG_ERROR, \"Got incorrect block %02X with VAR_27 %VAR_17\\n\", VAR_19, VAR_27);", "break;", "}", "if(VAR_4 + VAR_21 > VAR_16){", "av_log(VAR_0, AV_LOG_ERROR, \"Block VAR_27 %VAR_17 is out of bounds\\n\", VAR_27);", "break;", "}", "if(VAR_19 & WP_IDF_IGNORE){", "VAR_4 += VAR_21;", "continue;", "}", "switch(VAR_19 & WP_IDF_MASK){", "case WP_ID_DECTERMS:\nif(VAR_27 > MAX_TERMS){", "av_log(VAR_0, AV_LOG_ERROR, \"Too many decorrelation terms\\n\");", "s->terms = 0;", "VAR_4 += VAR_21;", "continue;", "}", "s->terms = VAR_27;", "for(VAR_17 = 0; VAR_17 < s->terms; VAR_17++) {", "s->decorr[s->terms - VAR_17 - 1].value = (*VAR_4 & 0x1F) - 5;", "s->decorr[s->terms - VAR_17 - 1].delta = *VAR_4 >> 5;", "VAR_4++;", "}", "VAR_8 = 1;", "break;", "case WP_ID_DECWEIGHTS:\nif(!VAR_8){", "av_log(VAR_0, AV_LOG_ERROR, \"No decorrelation terms met\\n\");", "continue;", "}", "VAR_22 = VAR_27 >> s->stereo_in;", "if(VAR_22 > MAX_TERMS || VAR_22 > s->terms){", "av_log(VAR_0, AV_LOG_ERROR, \"Too many decorrelation VAR_22\\n\");", "VAR_4 += VAR_21;", "continue;", "}", "for(VAR_17 = 0; VAR_17 < VAR_22; VAR_17++) {", "VAR_23 = (int8_t)(*VAR_4++);", "s->decorr[s->terms - VAR_17 - 1].weightA = VAR_23 << 3;", "if(s->decorr[s->terms - VAR_17 - 1].weightA > 0)\ns->decorr[s->terms - VAR_17 - 1].weightA += (s->decorr[s->terms - VAR_17 - 1].weightA + 64) >> 7;", "if(s->stereo_in){", "VAR_23 = (int8_t)(*VAR_4++);", "s->decorr[s->terms - VAR_17 - 1].weightB = VAR_23 << 3;", "if(s->decorr[s->terms - VAR_17 - 1].weightB > 0)\ns->decorr[s->terms - VAR_17 - 1].weightB += (s->decorr[s->terms - VAR_17 - 1].weightB + 64) >> 7;", "}", "}", "VAR_9 = 1;", "break;", "case WP_ID_DECSAMPLES:\nif(!VAR_8){", "av_log(VAR_0, AV_LOG_ERROR, \"No decorrelation terms met\\n\");", "continue;", "}", "VAR_23 = 0;", "for(VAR_17 = s->terms - 1; (VAR_17 >= 0) && (VAR_23 < VAR_27); VAR_17--) {", "if(s->decorr[VAR_17].value > 8){", "s->decorr[VAR_17].samplesA[0] = wp_exp2(AV_RL16(VAR_4)); VAR_4 += 2;", "s->decorr[VAR_17].samplesA[1] = wp_exp2(AV_RL16(VAR_4)); VAR_4 += 2;", "if(s->stereo_in){", "s->decorr[VAR_17].samplesB[0] = wp_exp2(AV_RL16(VAR_4)); VAR_4 += 2;", "s->decorr[VAR_17].samplesB[1] = wp_exp2(AV_RL16(VAR_4)); VAR_4 += 2;", "VAR_23 += 4;", "}", "VAR_23 += 4;", "}else if(s->decorr[VAR_17].value < 0){", "s->decorr[VAR_17].samplesA[0] = wp_exp2(AV_RL16(VAR_4)); VAR_4 += 2;", "s->decorr[VAR_17].samplesB[0] = wp_exp2(AV_RL16(VAR_4)); VAR_4 += 2;", "VAR_23 += 4;", "}else{", "for(VAR_18 = 0; VAR_18 < s->decorr[VAR_17].value; VAR_18++){", "s->decorr[VAR_17].samplesA[VAR_18] = wp_exp2(AV_RL16(VAR_4)); VAR_4 += 2;", "if(s->stereo_in){", "s->decorr[VAR_17].samplesB[VAR_18] = wp_exp2(AV_RL16(VAR_4)); VAR_4 += 2;", "}", "}", "VAR_23 += s->decorr[VAR_17].value * 2 * (s->stereo_in + 1);", "}", "}", "VAR_10 = 1;", "break;", "case WP_ID_ENTROPY:\nif(VAR_27 != 6 * (s->stereo_in + 1)){", "av_log(VAR_0, AV_LOG_ERROR, \"Entropy vars VAR_27 should be %VAR_17, got %VAR_17\", 6 * (s->stereo_in + 1), VAR_27);", "VAR_4 += VAR_21;", "continue;", "}", "for(VAR_18 = 0; VAR_18 <= s->stereo_in; VAR_18++){", "for(VAR_17 = 0; VAR_17 < 3; VAR_17++){", "s->ch[VAR_18].median[VAR_17] = wp_exp2(AV_RL16(VAR_4));", "VAR_4 += 2;", "}", "}", "VAR_11 = 1;", "break;", "case WP_ID_HYBRID:\nif(s->hybrid_bitrate){", "for(VAR_17 = 0; VAR_17 <= s->stereo_in; VAR_17++){", "s->ch[VAR_17].slow_level = wp_exp2(AV_RL16(VAR_4));", "VAR_4 += 2;", "VAR_27 -= 2;", "}", "}", "for(VAR_17 = 0; VAR_17 < (s->stereo_in + 1); VAR_17++){", "s->ch[VAR_17].bitrate_acc = AV_RL16(VAR_4) << 16;", "VAR_4 += 2;", "VAR_27 -= 2;", "}", "if(VAR_27 > 0){", "for(VAR_17 = 0; VAR_17 < (s->stereo_in + 1); VAR_17++){", "s->ch[VAR_17].bitrate_delta = wp_exp2((int16_t)AV_RL16(VAR_4));", "VAR_4 += 2;", "}", "}else{", "for(VAR_17 = 0; VAR_17 < (s->stereo_in + 1); VAR_17++)", "s->ch[VAR_17].bitrate_delta = 0;", "}", "VAR_14 = 1;", "break;", "case WP_ID_INT32INFO:\nif(VAR_27 != 4){", "av_log(VAR_0, AV_LOG_ERROR, \"Invalid INT32INFO, VAR_27 = %VAR_17, sent_bits = %VAR_17\\n\", VAR_27, *VAR_4);", "VAR_4 += VAR_21;", "continue;", "}", "if(VAR_4[0])\ns->extra_bits = VAR_4[0];", "else if(VAR_4[1])\ns->shift = VAR_4[1];", "else if(VAR_4[2]){", "s->and = s->or = 1;", "s->shift = VAR_4[2];", "}else if(VAR_4[3]){", "s->and = 1;", "s->shift = VAR_4[3];", "}", "VAR_4 += 4;", "break;", "case WP_ID_FLOATINFO:\nif(VAR_27 != 4){", "av_log(VAR_0, AV_LOG_ERROR, \"Invalid FLOATINFO, VAR_27 = %VAR_17\\n\", VAR_27);", "VAR_4 += VAR_21;", "continue;", "}", "s->float_flag = VAR_4[0];", "s->float_shift = VAR_4[1];", "s->float_max_exp = VAR_4[2];", "VAR_4 += 4;", "VAR_13 = 1;", "break;", "case WP_ID_DATA:\ns->sc.offset = VAR_4 - VAR_15;", "s->sc.VAR_27 = VAR_27 * 8;", "init_get_bits(&s->gb, VAR_4, VAR_27 * 8);", "s->data_size = VAR_27 * 8;", "VAR_4 += VAR_27;", "VAR_12 = 1;", "break;", "case WP_ID_EXTRABITS:\nif(VAR_27 <= 4){", "av_log(VAR_0, AV_LOG_ERROR, \"Invalid EXTRABITS, VAR_27 = %VAR_17\\n\", VAR_27);", "VAR_4 += VAR_27;", "continue;", "}", "s->extra_sc.offset = VAR_4 - VAR_15;", "s->extra_sc.VAR_27 = VAR_27 * 8;", "init_get_bits(&s->gb_extra_bits, VAR_4, VAR_27 * 8);", "s->crc_extra_bits = get_bits_long(&s->gb_extra_bits, 32);", "VAR_4 += VAR_27;", "s->got_extra_bits = 1;", "break;", "case WP_ID_CHANINFO:\nif(VAR_27 <= 1){", "av_log(VAR_0, AV_LOG_ERROR, \"Insufficient channel information\\n\");", "return -1;", "}", "VAR_25 = *VAR_4++;", "switch(VAR_27 - 2){", "case 0:\nVAR_26 = *VAR_4;", "break;", "case 1:\nVAR_26 = AV_RL16(VAR_4);", "break;", "case 2:\nVAR_26 = AV_RL24(VAR_4);", "break;", "case 3:\nVAR_26 = AV_RL32(VAR_4);", "break;", "case 5:\nVAR_25 |= (VAR_4[1] & 0xF) << 8;", "VAR_26 = AV_RL24(VAR_4 + 2);", "break;", "default:\nav_log(VAR_0, AV_LOG_ERROR, \"Invalid channel info VAR_27 %d\\n\", VAR_27);", "VAR_25 = VAR_0->channels;", "VAR_26 = VAR_0->channel_layout;", "}", "if(VAR_25 != VAR_0->channels){", "av_log(VAR_0, AV_LOG_ERROR, \"Block reports total %d channels, decoder believes it's %d channels\\n\",\nVAR_25, VAR_0->channels);", "return -1;", "}", "if(!VAR_0->channel_layout)\nVAR_0->channel_layout = VAR_26;", "VAR_4 += VAR_27 - 1;", "break;", "default:\nVAR_4 += VAR_27;", "}", "if(VAR_19 & WP_IDF_ODD) VAR_4++;", "}", "if(!VAR_8){", "av_log(VAR_0, AV_LOG_ERROR, \"No block with decorrelation terms\\n\");", "return -1;", "}", "if(!VAR_9){", "av_log(VAR_0, AV_LOG_ERROR, \"No block with decorrelation VAR_22\\n\");", "return -1;", "}", "if(!VAR_10){", "av_log(VAR_0, AV_LOG_ERROR, \"No block with decorrelation VAR_6\\n\");", "return -1;", "}", "if(!VAR_11){", "av_log(VAR_0, AV_LOG_ERROR, \"No block with entropy info\\n\");", "return -1;", "}", "if(s->hybrid && !VAR_14){", "av_log(VAR_0, AV_LOG_ERROR, \"Hybrid config not found\\n\");", "return -1;", "}", "if(!VAR_12){", "av_log(VAR_0, AV_LOG_ERROR, \"Packed VAR_6 not found\\n\");", "return -1;", "}", "if(!VAR_13 && VAR_0->sample_fmt == AV_SAMPLE_FMT_FLT){", "av_log(VAR_0, AV_LOG_ERROR, \"Float information not found\\n\");", "return -1;", "}", "if(s->got_extra_bits && VAR_0->sample_fmt != AV_SAMPLE_FMT_FLT){", "const int VAR_27 = get_bits_left(&s->gb_extra_bits);", "const int VAR_27 = s->VAR_6 * s->extra_bits << s->stereo_in;", "if(VAR_27 < VAR_27){", "av_log(VAR_0, AV_LOG_ERROR, \"Too small EXTRABITS\\n\");", "s->got_extra_bits = 0;", "}", "}", "if(s->stereo_in){", "if(VAR_0->sample_fmt == AV_SAMPLE_FMT_S16)\nVAR_7 = wv_unpack_stereo(s, &s->gb, VAR_6, AV_SAMPLE_FMT_S16);", "else if(VAR_0->sample_fmt == AV_SAMPLE_FMT_S32)\nVAR_7 = wv_unpack_stereo(s, &s->gb, VAR_6, AV_SAMPLE_FMT_S32);", "else\nVAR_7 = wv_unpack_stereo(s, &s->gb, VAR_6, AV_SAMPLE_FMT_FLT);", "if (VAR_7 < 0)\nreturn -1;", "VAR_7 >>= 1;", "}else{", "const int VAR_28 = VAR_0->channels;", "if(VAR_0->sample_fmt == AV_SAMPLE_FMT_S16)\nVAR_7 = wv_unpack_mono(s, &s->gb, VAR_6, AV_SAMPLE_FMT_S16);", "else if(VAR_0->sample_fmt == AV_SAMPLE_FMT_S32)\nVAR_7 = wv_unpack_mono(s, &s->gb, VAR_6, AV_SAMPLE_FMT_S32);", "else\nVAR_7 = wv_unpack_mono(s, &s->gb, VAR_6, AV_SAMPLE_FMT_FLT);", "if (VAR_7 < 0)\nreturn -1;", "if(s->stereo && VAR_0->sample_fmt == AV_SAMPLE_FMT_S16){", "int16_t *VAR_30 = (int16_t*)VAR_6 + 1;", "int16_t *VAR_31 = (int16_t*)VAR_6;", "int VAR_32 = VAR_7;", "while(VAR_32--){", "*VAR_30 = *VAR_31;", "VAR_31 += VAR_28;", "VAR_30 += VAR_28;", "}", "}else if(s->stereo && VAR_0->sample_fmt == AV_SAMPLE_FMT_S32){", "int32_t *VAR_30 = (int32_t*)VAR_6 + 1;", "int32_t *VAR_31 = (int32_t*)VAR_6;", "int VAR_32 = VAR_7;", "while(VAR_32--){", "*VAR_30 = *VAR_31;", "VAR_31 += VAR_28;", "VAR_30 += VAR_28;", "}", "}else if(s->stereo){", "float *VAR_30 = (float*)VAR_6 + 1;", "float *VAR_31 = (float*)VAR_6;", "int VAR_32 = VAR_7;", "while(VAR_32--){", "*VAR_30 = *VAR_31;", "VAR_31 += VAR_28;", "VAR_30 += VAR_28;", "}", "}", "}", "*VAR_3 = 1;", "return VAR_7 * VAR_24;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131, 133 ], [ 137 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189, 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219, 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247, 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257, 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269, 271 ], [ 273 ], [ 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ], [ 291 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305 ], [ 307 ], [ 309 ], [ 311 ], [ 313 ], [ 315 ], [ 317 ], [ 319 ], [ 321 ], [ 323 ], [ 325 ], [ 327 ], [ 329 ], [ 331 ], [ 333, 335 ], [ 337 ], [ 339 ], [ 341 ], [ 343 ], [ 345 ], [ 347 ], [ 349 ], [ 351 ], [ 353 ], [ 355 ], [ 357 ], [ 359 ], [ 361, 363 ], [ 365 ], [ 367 ], [ 369 ], [ 371 ], [ 373 ], [ 375 ], [ 377 ], [ 379 ], [ 381 ], [ 383 ], [ 385 ], [ 387 ], [ 389 ], [ 391 ], [ 393 ], [ 395 ], [ 397 ], [ 399 ], [ 401 ], [ 403 ], [ 405 ], [ 407 ], [ 409, 411 ], [ 413 ], [ 415 ], [ 417 ], [ 419 ], [ 421, 423 ], [ 425, 427 ], [ 429 ], [ 431 ], [ 433 ], [ 435 ], [ 437 ], [ 439 ], [ 441 ], [ 443 ], [ 445 ], [ 447, 449 ], [ 451 ], [ 453 ], [ 455 ], [ 457 ], [ 459 ], [ 461 ], [ 463 ], [ 465 ], [ 467 ], [ 469 ], [ 471, 473 ], [ 475 ], [ 477 ], [ 479 ], [ 481 ], [ 483 ], [ 485 ], [ 487, 489 ], [ 491 ], [ 493 ], [ 495 ], [ 497 ], [ 499 ], [ 501 ], [ 503 ], [ 505 ], [ 507 ], [ 509 ], [ 511 ], [ 513, 515 ], [ 517 ], [ 519 ], [ 521 ], [ 523 ], [ 525 ], [ 527, 529 ], [ 531 ], [ 533, 535 ], [ 537 ], [ 539, 541 ], [ 543 ], [ 545, 547 ], [ 549 ], [ 551, 553 ], [ 555 ], [ 557 ], [ 559, 561 ], [ 563 ], [ 565 ], [ 567 ], [ 569 ], [ 571, 573 ], [ 575 ], [ 577 ], [ 579, 581 ], [ 583 ], [ 585 ], [ 587, 589 ], [ 591 ], [ 593 ], [ 595 ], [ 599 ], [ 601 ], [ 603 ], [ 605 ], [ 607 ], [ 609 ], [ 611 ], [ 613 ], [ 615 ], [ 617 ], [ 619 ], [ 621 ], [ 623 ], [ 625 ], [ 627 ], [ 629 ], [ 631 ], [ 633 ], [ 635 ], [ 637 ], [ 639 ], [ 641 ], [ 643 ], [ 645 ], [ 647 ], [ 649 ], [ 651 ], [ 653 ], [ 655 ], [ 657 ], [ 659 ], [ 661 ], [ 663 ], [ 665 ], [ 667 ], [ 669 ], [ 673 ], [ 675, 677 ], [ 679, 681 ], [ 683, 685 ], [ 689, 691 ], [ 695 ], [ 697 ], [ 699 ], [ 703, 705 ], [ 707, 709 ], [ 711, 713 ], [ 717, 719 ], [ 723 ], [ 725 ], [ 727 ], [ 729 ], [ 731 ], [ 733 ], [ 735 ], [ 737 ], [ 739 ], [ 741 ], [ 743 ], [ 745 ], [ 747 ], [ 749 ], [ 751 ], [ 753 ], [ 755 ], [ 757 ], [ 759 ], [ 761 ], [ 763 ], [ 765 ], [ 767 ], [ 769 ], [ 771 ], [ 773 ], [ 775 ], [ 777 ], [ 779 ], [ 783 ], [ 787 ], [ 789 ] ]
26,387
int ff_put_wav_header(AVFormatContext *s, AVIOContext *pb, AVCodecParameters *par, int flags) { int bps, blkalign, bytespersec, frame_size; int hdrsize; int64_t hdrstart = avio_tell(pb); int waveformatextensible; uint8_t temp[256]; uint8_t *riff_extradata = temp; uint8_t *riff_extradata_start = temp; if (!par->codec_tag || par->codec_tag > 0xffff) return -1; /* We use the known constant frame size for the codec if known, otherwise * fall back on using AVCodecContext.frame_size, which is not as reliable * for indicating packet duration. */ frame_size = av_get_audio_frame_duration2(par, par->block_align); waveformatextensible = (par->channels > 2 && par->channel_layout) || par->sample_rate > 48000 || par->codec_id == AV_CODEC_ID_EAC3 || av_get_bits_per_sample(par->codec_id) > 16; if (waveformatextensible) avio_wl16(pb, 0xfffe); else avio_wl16(pb, par->codec_tag); avio_wl16(pb, par->channels); avio_wl32(pb, par->sample_rate); if (par->codec_id == AV_CODEC_ID_ATRAC3 || par->codec_id == AV_CODEC_ID_G723_1 || par->codec_id == AV_CODEC_ID_MP2 || par->codec_id == AV_CODEC_ID_MP3 || par->codec_id == AV_CODEC_ID_GSM_MS) { bps = 0; } else { if (!(bps = av_get_bits_per_sample(par->codec_id))) { if (par->bits_per_coded_sample) bps = par->bits_per_coded_sample; else bps = 16; // default to 16 } } if (bps != par->bits_per_coded_sample && par->bits_per_coded_sample) { av_log(s, AV_LOG_WARNING, "requested bits_per_coded_sample (%d) " "and actually stored (%d) differ\n", par->bits_per_coded_sample, bps); } if (par->codec_id == AV_CODEC_ID_MP2) { blkalign = (144 * par->bit_rate - 1)/par->sample_rate + 1; } else if (par->codec_id == AV_CODEC_ID_MP3) { blkalign = 576 * (par->sample_rate <= (24000 + 32000)/2 ? 1 : 2); } else if (par->codec_id == AV_CODEC_ID_AC3) { blkalign = 3840; /* maximum bytes per frame */ } else if (par->codec_id == AV_CODEC_ID_AAC) { blkalign = 768 * par->channels; /* maximum bytes per frame */ } else if (par->codec_id == AV_CODEC_ID_G723_1) { blkalign = 24; } else if (par->block_align != 0) { /* specified by the codec */ blkalign = par->block_align; } else blkalign = bps * par->channels / av_gcd(8, bps); if (par->codec_id == AV_CODEC_ID_PCM_U8 || par->codec_id == AV_CODEC_ID_PCM_S24LE || par->codec_id == AV_CODEC_ID_PCM_S32LE || par->codec_id == AV_CODEC_ID_PCM_F32LE || par->codec_id == AV_CODEC_ID_PCM_F64LE || par->codec_id == AV_CODEC_ID_PCM_S16LE) { bytespersec = par->sample_rate * blkalign; } else if (par->codec_id == AV_CODEC_ID_G723_1) { bytespersec = 800; } else { bytespersec = par->bit_rate / 8; } avio_wl32(pb, bytespersec); /* bytes per second */ avio_wl16(pb, blkalign); /* block align */ avio_wl16(pb, bps); /* bits per sample */ if (par->codec_id == AV_CODEC_ID_MP3) { bytestream_put_le16(&riff_extradata, 1); /* wID */ bytestream_put_le32(&riff_extradata, 2); /* fdwFlags */ bytestream_put_le16(&riff_extradata, 1152); /* nBlockSize */ bytestream_put_le16(&riff_extradata, 1); /* nFramesPerBlock */ bytestream_put_le16(&riff_extradata, 1393); /* nCodecDelay */ } else if (par->codec_id == AV_CODEC_ID_MP2) { /* fwHeadLayer */ bytestream_put_le16(&riff_extradata, 2); /* dwHeadBitrate */ bytestream_put_le32(&riff_extradata, par->bit_rate); /* fwHeadMode */ bytestream_put_le16(&riff_extradata, par->channels == 2 ? 1 : 8); /* fwHeadModeExt */ bytestream_put_le16(&riff_extradata, 0); /* wHeadEmphasis */ bytestream_put_le16(&riff_extradata, 1); /* fwHeadFlags */ bytestream_put_le16(&riff_extradata, 16); /* dwPTSLow */ bytestream_put_le32(&riff_extradata, 0); /* dwPTSHigh */ bytestream_put_le32(&riff_extradata, 0); } else if (par->codec_id == AV_CODEC_ID_G723_1) { bytestream_put_le32(&riff_extradata, 0x9ace0002); /* extradata needed for msacm g723.1 codec */ bytestream_put_le32(&riff_extradata, 0xaea2f732); bytestream_put_le16(&riff_extradata, 0xacde); } else if (par->codec_id == AV_CODEC_ID_GSM_MS || par->codec_id == AV_CODEC_ID_ADPCM_IMA_WAV) { /* wSamplesPerBlock */ bytestream_put_le16(&riff_extradata, frame_size); } else if (par->extradata_size) { riff_extradata_start = par->extradata; riff_extradata = par->extradata + par->extradata_size; } /* write WAVEFORMATEXTENSIBLE extensions */ if (waveformatextensible) { int write_channel_mask = !(flags & FF_PUT_WAV_HEADER_SKIP_CHANNELMASK) && (s->strict_std_compliance < FF_COMPLIANCE_NORMAL || par->channel_layout < 0x40000); /* 22 is WAVEFORMATEXTENSIBLE size */ avio_wl16(pb, riff_extradata - riff_extradata_start + 22); /* ValidBitsPerSample || SamplesPerBlock || Reserved */ avio_wl16(pb, bps); /* dwChannelMask */ avio_wl32(pb, write_channel_mask ? par->channel_layout : 0); /* GUID + next 3 */ if (par->codec_id == AV_CODEC_ID_EAC3) { ff_put_guid(pb, ff_get_codec_guid(par->codec_id, ff_codec_wav_guids)); } else { avio_wl32(pb, par->codec_tag); avio_wl32(pb, 0x00100000); avio_wl32(pb, 0xAA000080); avio_wl32(pb, 0x719B3800); } } else if ((flags & FF_PUT_WAV_HEADER_FORCE_WAVEFORMATEX) || par->codec_tag != 0x0001 /* PCM */ || riff_extradata - riff_extradata_start) { /* WAVEFORMATEX */ avio_wl16(pb, riff_extradata - riff_extradata_start); /* cbSize */ } /* else PCMWAVEFORMAT */ avio_write(pb, riff_extradata_start, riff_extradata - riff_extradata_start); hdrsize = avio_tell(pb) - hdrstart; if (hdrsize & 1) { hdrsize++; avio_w8(pb, 0); } return hdrsize; }
true
FFmpeg
fe8959bbece4d86a1872b813c25c2682dcd5ef42
int ff_put_wav_header(AVFormatContext *s, AVIOContext *pb, AVCodecParameters *par, int flags) { int bps, blkalign, bytespersec, frame_size; int hdrsize; int64_t hdrstart = avio_tell(pb); int waveformatextensible; uint8_t temp[256]; uint8_t *riff_extradata = temp; uint8_t *riff_extradata_start = temp; if (!par->codec_tag || par->codec_tag > 0xffff) return -1; frame_size = av_get_audio_frame_duration2(par, par->block_align); waveformatextensible = (par->channels > 2 && par->channel_layout) || par->sample_rate > 48000 || par->codec_id == AV_CODEC_ID_EAC3 || av_get_bits_per_sample(par->codec_id) > 16; if (waveformatextensible) avio_wl16(pb, 0xfffe); else avio_wl16(pb, par->codec_tag); avio_wl16(pb, par->channels); avio_wl32(pb, par->sample_rate); if (par->codec_id == AV_CODEC_ID_ATRAC3 || par->codec_id == AV_CODEC_ID_G723_1 || par->codec_id == AV_CODEC_ID_MP2 || par->codec_id == AV_CODEC_ID_MP3 || par->codec_id == AV_CODEC_ID_GSM_MS) { bps = 0; } else { if (!(bps = av_get_bits_per_sample(par->codec_id))) { if (par->bits_per_coded_sample) bps = par->bits_per_coded_sample; else bps = 16; } } if (bps != par->bits_per_coded_sample && par->bits_per_coded_sample) { av_log(s, AV_LOG_WARNING, "requested bits_per_coded_sample (%d) " "and actually stored (%d) differ\n", par->bits_per_coded_sample, bps); } if (par->codec_id == AV_CODEC_ID_MP2) { blkalign = (144 * par->bit_rate - 1)/par->sample_rate + 1; } else if (par->codec_id == AV_CODEC_ID_MP3) { blkalign = 576 * (par->sample_rate <= (24000 + 32000)/2 ? 1 : 2); } else if (par->codec_id == AV_CODEC_ID_AC3) { blkalign = 3840; } else if (par->codec_id == AV_CODEC_ID_AAC) { blkalign = 768 * par->channels; } else if (par->codec_id == AV_CODEC_ID_G723_1) { blkalign = 24; } else if (par->block_align != 0) { blkalign = par->block_align; } else blkalign = bps * par->channels / av_gcd(8, bps); if (par->codec_id == AV_CODEC_ID_PCM_U8 || par->codec_id == AV_CODEC_ID_PCM_S24LE || par->codec_id == AV_CODEC_ID_PCM_S32LE || par->codec_id == AV_CODEC_ID_PCM_F32LE || par->codec_id == AV_CODEC_ID_PCM_F64LE || par->codec_id == AV_CODEC_ID_PCM_S16LE) { bytespersec = par->sample_rate * blkalign; } else if (par->codec_id == AV_CODEC_ID_G723_1) { bytespersec = 800; } else { bytespersec = par->bit_rate / 8; } avio_wl32(pb, bytespersec); avio_wl16(pb, blkalign); avio_wl16(pb, bps); if (par->codec_id == AV_CODEC_ID_MP3) { bytestream_put_le16(&riff_extradata, 1); bytestream_put_le32(&riff_extradata, 2); bytestream_put_le16(&riff_extradata, 1152); bytestream_put_le16(&riff_extradata, 1); bytestream_put_le16(&riff_extradata, 1393); } else if (par->codec_id == AV_CODEC_ID_MP2) { bytestream_put_le16(&riff_extradata, 2); bytestream_put_le32(&riff_extradata, par->bit_rate); bytestream_put_le16(&riff_extradata, par->channels == 2 ? 1 : 8); bytestream_put_le16(&riff_extradata, 0); bytestream_put_le16(&riff_extradata, 1); bytestream_put_le16(&riff_extradata, 16); bytestream_put_le32(&riff_extradata, 0); bytestream_put_le32(&riff_extradata, 0); } else if (par->codec_id == AV_CODEC_ID_G723_1) { bytestream_put_le32(&riff_extradata, 0x9ace0002); bytestream_put_le32(&riff_extradata, 0xaea2f732); bytestream_put_le16(&riff_extradata, 0xacde); } else if (par->codec_id == AV_CODEC_ID_GSM_MS || par->codec_id == AV_CODEC_ID_ADPCM_IMA_WAV) { bytestream_put_le16(&riff_extradata, frame_size); } else if (par->extradata_size) { riff_extradata_start = par->extradata; riff_extradata = par->extradata + par->extradata_size; } if (waveformatextensible) { int write_channel_mask = !(flags & FF_PUT_WAV_HEADER_SKIP_CHANNELMASK) && (s->strict_std_compliance < FF_COMPLIANCE_NORMAL || par->channel_layout < 0x40000); avio_wl16(pb, riff_extradata - riff_extradata_start + 22); avio_wl16(pb, bps); avio_wl32(pb, write_channel_mask ? par->channel_layout : 0); if (par->codec_id == AV_CODEC_ID_EAC3) { ff_put_guid(pb, ff_get_codec_guid(par->codec_id, ff_codec_wav_guids)); } else { avio_wl32(pb, par->codec_tag); avio_wl32(pb, 0x00100000); avio_wl32(pb, 0xAA000080); avio_wl32(pb, 0x719B3800); } } else if ((flags & FF_PUT_WAV_HEADER_FORCE_WAVEFORMATEX) || par->codec_tag != 0x0001 || riff_extradata - riff_extradata_start) { avio_wl16(pb, riff_extradata - riff_extradata_start); } avio_write(pb, riff_extradata_start, riff_extradata - riff_extradata_start); hdrsize = avio_tell(pb) - hdrstart; if (hdrsize & 1) { hdrsize++; avio_w8(pb, 0); } return hdrsize; }
{ "code": [], "line_no": [] }
int FUNC_0(AVFormatContext *VAR_0, AVIOContext *VAR_1, AVCodecParameters *VAR_2, int VAR_3) { int VAR_4, VAR_5, VAR_6, VAR_7; int VAR_8; int64_t hdrstart = avio_tell(VAR_1); int VAR_9; uint8_t temp[256]; uint8_t *riff_extradata = temp; uint8_t *riff_extradata_start = temp; if (!VAR_2->codec_tag || VAR_2->codec_tag > 0xffff) return -1; VAR_7 = av_get_audio_frame_duration2(VAR_2, VAR_2->block_align); VAR_9 = (VAR_2->channels > 2 && VAR_2->channel_layout) || VAR_2->sample_rate > 48000 || VAR_2->codec_id == AV_CODEC_ID_EAC3 || av_get_bits_per_sample(VAR_2->codec_id) > 16; if (VAR_9) avio_wl16(VAR_1, 0xfffe); else avio_wl16(VAR_1, VAR_2->codec_tag); avio_wl16(VAR_1, VAR_2->channels); avio_wl32(VAR_1, VAR_2->sample_rate); if (VAR_2->codec_id == AV_CODEC_ID_ATRAC3 || VAR_2->codec_id == AV_CODEC_ID_G723_1 || VAR_2->codec_id == AV_CODEC_ID_MP2 || VAR_2->codec_id == AV_CODEC_ID_MP3 || VAR_2->codec_id == AV_CODEC_ID_GSM_MS) { VAR_4 = 0; } else { if (!(VAR_4 = av_get_bits_per_sample(VAR_2->codec_id))) { if (VAR_2->bits_per_coded_sample) VAR_4 = VAR_2->bits_per_coded_sample; else VAR_4 = 16; } } if (VAR_4 != VAR_2->bits_per_coded_sample && VAR_2->bits_per_coded_sample) { av_log(VAR_0, AV_LOG_WARNING, "requested bits_per_coded_sample (%d) " "and actually stored (%d) differ\n", VAR_2->bits_per_coded_sample, VAR_4); } if (VAR_2->codec_id == AV_CODEC_ID_MP2) { VAR_5 = (144 * VAR_2->bit_rate - 1)/VAR_2->sample_rate + 1; } else if (VAR_2->codec_id == AV_CODEC_ID_MP3) { VAR_5 = 576 * (VAR_2->sample_rate <= (24000 + 32000)/2 ? 1 : 2); } else if (VAR_2->codec_id == AV_CODEC_ID_AC3) { VAR_5 = 3840; } else if (VAR_2->codec_id == AV_CODEC_ID_AAC) { VAR_5 = 768 * VAR_2->channels; } else if (VAR_2->codec_id == AV_CODEC_ID_G723_1) { VAR_5 = 24; } else if (VAR_2->block_align != 0) { VAR_5 = VAR_2->block_align; } else VAR_5 = VAR_4 * VAR_2->channels / av_gcd(8, VAR_4); if (VAR_2->codec_id == AV_CODEC_ID_PCM_U8 || VAR_2->codec_id == AV_CODEC_ID_PCM_S24LE || VAR_2->codec_id == AV_CODEC_ID_PCM_S32LE || VAR_2->codec_id == AV_CODEC_ID_PCM_F32LE || VAR_2->codec_id == AV_CODEC_ID_PCM_F64LE || VAR_2->codec_id == AV_CODEC_ID_PCM_S16LE) { VAR_6 = VAR_2->sample_rate * VAR_5; } else if (VAR_2->codec_id == AV_CODEC_ID_G723_1) { VAR_6 = 800; } else { VAR_6 = VAR_2->bit_rate / 8; } avio_wl32(VAR_1, VAR_6); avio_wl16(VAR_1, VAR_5); avio_wl16(VAR_1, VAR_4); if (VAR_2->codec_id == AV_CODEC_ID_MP3) { bytestream_put_le16(&riff_extradata, 1); bytestream_put_le32(&riff_extradata, 2); bytestream_put_le16(&riff_extradata, 1152); bytestream_put_le16(&riff_extradata, 1); bytestream_put_le16(&riff_extradata, 1393); } else if (VAR_2->codec_id == AV_CODEC_ID_MP2) { bytestream_put_le16(&riff_extradata, 2); bytestream_put_le32(&riff_extradata, VAR_2->bit_rate); bytestream_put_le16(&riff_extradata, VAR_2->channels == 2 ? 1 : 8); bytestream_put_le16(&riff_extradata, 0); bytestream_put_le16(&riff_extradata, 1); bytestream_put_le16(&riff_extradata, 16); bytestream_put_le32(&riff_extradata, 0); bytestream_put_le32(&riff_extradata, 0); } else if (VAR_2->codec_id == AV_CODEC_ID_G723_1) { bytestream_put_le32(&riff_extradata, 0x9ace0002); bytestream_put_le32(&riff_extradata, 0xaea2f732); bytestream_put_le16(&riff_extradata, 0xacde); } else if (VAR_2->codec_id == AV_CODEC_ID_GSM_MS || VAR_2->codec_id == AV_CODEC_ID_ADPCM_IMA_WAV) { bytestream_put_le16(&riff_extradata, VAR_7); } else if (VAR_2->extradata_size) { riff_extradata_start = VAR_2->extradata; riff_extradata = VAR_2->extradata + VAR_2->extradata_size; } if (VAR_9) { int VAR_10 = !(VAR_3 & FF_PUT_WAV_HEADER_SKIP_CHANNELMASK) && (VAR_0->strict_std_compliance < FF_COMPLIANCE_NORMAL || VAR_2->channel_layout < 0x40000); avio_wl16(VAR_1, riff_extradata - riff_extradata_start + 22); avio_wl16(VAR_1, VAR_4); avio_wl32(VAR_1, VAR_10 ? VAR_2->channel_layout : 0); if (VAR_2->codec_id == AV_CODEC_ID_EAC3) { ff_put_guid(VAR_1, ff_get_codec_guid(VAR_2->codec_id, ff_codec_wav_guids)); } else { avio_wl32(VAR_1, VAR_2->codec_tag); avio_wl32(VAR_1, 0x00100000); avio_wl32(VAR_1, 0xAA000080); avio_wl32(VAR_1, 0x719B3800); } } else if ((VAR_3 & FF_PUT_WAV_HEADER_FORCE_WAVEFORMATEX) || VAR_2->codec_tag != 0x0001 || riff_extradata - riff_extradata_start) { avio_wl16(VAR_1, riff_extradata - riff_extradata_start); } avio_write(VAR_1, riff_extradata_start, riff_extradata - riff_extradata_start); VAR_8 = avio_tell(VAR_1) - hdrstart; if (VAR_8 & 1) { VAR_8++; avio_w8(VAR_1, 0); } return VAR_8; }
[ "int FUNC_0(AVFormatContext *VAR_0, AVIOContext *VAR_1,\nAVCodecParameters *VAR_2, int VAR_3)\n{", "int VAR_4, VAR_5, VAR_6, VAR_7;", "int VAR_8;", "int64_t hdrstart = avio_tell(VAR_1);", "int VAR_9;", "uint8_t temp[256];", "uint8_t *riff_extradata = temp;", "uint8_t *riff_extradata_start = temp;", "if (!VAR_2->codec_tag || VAR_2->codec_tag > 0xffff)\nreturn -1;", "VAR_7 = av_get_audio_frame_duration2(VAR_2, VAR_2->block_align);", "VAR_9 = (VAR_2->channels > 2 && VAR_2->channel_layout) ||\nVAR_2->sample_rate > 48000 ||\nVAR_2->codec_id == AV_CODEC_ID_EAC3 ||\nav_get_bits_per_sample(VAR_2->codec_id) > 16;", "if (VAR_9)\navio_wl16(VAR_1, 0xfffe);", "else\navio_wl16(VAR_1, VAR_2->codec_tag);", "avio_wl16(VAR_1, VAR_2->channels);", "avio_wl32(VAR_1, VAR_2->sample_rate);", "if (VAR_2->codec_id == AV_CODEC_ID_ATRAC3 ||\nVAR_2->codec_id == AV_CODEC_ID_G723_1 ||\nVAR_2->codec_id == AV_CODEC_ID_MP2 ||\nVAR_2->codec_id == AV_CODEC_ID_MP3 ||\nVAR_2->codec_id == AV_CODEC_ID_GSM_MS) {", "VAR_4 = 0;", "} else {", "if (!(VAR_4 = av_get_bits_per_sample(VAR_2->codec_id))) {", "if (VAR_2->bits_per_coded_sample)\nVAR_4 = VAR_2->bits_per_coded_sample;", "else\nVAR_4 = 16;", "}", "}", "if (VAR_4 != VAR_2->bits_per_coded_sample && VAR_2->bits_per_coded_sample) {", "av_log(VAR_0, AV_LOG_WARNING,\n\"requested bits_per_coded_sample (%d) \"\n\"and actually stored (%d) differ\\n\",\nVAR_2->bits_per_coded_sample, VAR_4);", "}", "if (VAR_2->codec_id == AV_CODEC_ID_MP2) {", "VAR_5 = (144 * VAR_2->bit_rate - 1)/VAR_2->sample_rate + 1;", "} else if (VAR_2->codec_id == AV_CODEC_ID_MP3) {", "VAR_5 = 576 * (VAR_2->sample_rate <= (24000 + 32000)/2 ? 1 : 2);", "} else if (VAR_2->codec_id == AV_CODEC_ID_AC3) {", "VAR_5 = 3840;", "} else if (VAR_2->codec_id == AV_CODEC_ID_AAC) {", "VAR_5 = 768 * VAR_2->channels;", "} else if (VAR_2->codec_id == AV_CODEC_ID_G723_1) {", "VAR_5 = 24;", "} else if (VAR_2->block_align != 0) {", "VAR_5 = VAR_2->block_align;", "} else", "VAR_5 = VAR_4 * VAR_2->channels / av_gcd(8, VAR_4);", "if (VAR_2->codec_id == AV_CODEC_ID_PCM_U8 ||\nVAR_2->codec_id == AV_CODEC_ID_PCM_S24LE ||\nVAR_2->codec_id == AV_CODEC_ID_PCM_S32LE ||\nVAR_2->codec_id == AV_CODEC_ID_PCM_F32LE ||\nVAR_2->codec_id == AV_CODEC_ID_PCM_F64LE ||\nVAR_2->codec_id == AV_CODEC_ID_PCM_S16LE) {", "VAR_6 = VAR_2->sample_rate * VAR_5;", "} else if (VAR_2->codec_id == AV_CODEC_ID_G723_1) {", "VAR_6 = 800;", "} else {", "VAR_6 = VAR_2->bit_rate / 8;", "}", "avio_wl32(VAR_1, VAR_6);", "avio_wl16(VAR_1, VAR_5);", "avio_wl16(VAR_1, VAR_4);", "if (VAR_2->codec_id == AV_CODEC_ID_MP3) {", "bytestream_put_le16(&riff_extradata, 1);", "bytestream_put_le32(&riff_extradata, 2);", "bytestream_put_le16(&riff_extradata, 1152);", "bytestream_put_le16(&riff_extradata, 1);", "bytestream_put_le16(&riff_extradata, 1393);", "} else if (VAR_2->codec_id == AV_CODEC_ID_MP2) {", "bytestream_put_le16(&riff_extradata, 2);", "bytestream_put_le32(&riff_extradata, VAR_2->bit_rate);", "bytestream_put_le16(&riff_extradata, VAR_2->channels == 2 ? 1 : 8);", "bytestream_put_le16(&riff_extradata, 0);", "bytestream_put_le16(&riff_extradata, 1);", "bytestream_put_le16(&riff_extradata, 16);", "bytestream_put_le32(&riff_extradata, 0);", "bytestream_put_le32(&riff_extradata, 0);", "} else if (VAR_2->codec_id == AV_CODEC_ID_G723_1) {", "bytestream_put_le32(&riff_extradata, 0x9ace0002);", "bytestream_put_le32(&riff_extradata, 0xaea2f732);", "bytestream_put_le16(&riff_extradata, 0xacde);", "} else if (VAR_2->codec_id == AV_CODEC_ID_GSM_MS ||", "VAR_2->codec_id == AV_CODEC_ID_ADPCM_IMA_WAV) {", "bytestream_put_le16(&riff_extradata, VAR_7);", "} else if (VAR_2->extradata_size) {", "riff_extradata_start = VAR_2->extradata;", "riff_extradata = VAR_2->extradata + VAR_2->extradata_size;", "}", "if (VAR_9) {", "int VAR_10 = !(VAR_3 & FF_PUT_WAV_HEADER_SKIP_CHANNELMASK) &&\n(VAR_0->strict_std_compliance < FF_COMPLIANCE_NORMAL ||\nVAR_2->channel_layout < 0x40000);", "avio_wl16(VAR_1, riff_extradata - riff_extradata_start + 22);", "avio_wl16(VAR_1, VAR_4);", "avio_wl32(VAR_1, VAR_10 ? VAR_2->channel_layout : 0);", "if (VAR_2->codec_id == AV_CODEC_ID_EAC3) {", "ff_put_guid(VAR_1, ff_get_codec_guid(VAR_2->codec_id, ff_codec_wav_guids));", "} else {", "avio_wl32(VAR_1, VAR_2->codec_tag);", "avio_wl32(VAR_1, 0x00100000);", "avio_wl32(VAR_1, 0xAA000080);", "avio_wl32(VAR_1, 0x719B3800);", "}", "} else if ((VAR_3 & FF_PUT_WAV_HEADER_FORCE_WAVEFORMATEX) ||", "VAR_2->codec_tag != 0x0001 ||\nriff_extradata - riff_extradata_start) {", "avio_wl16(VAR_1, riff_extradata - riff_extradata_start);", "}", "avio_write(VAR_1, riff_extradata_start, riff_extradata - riff_extradata_start);", "VAR_8 = avio_tell(VAR_1) - hdrstart;", "if (VAR_8 & 1) {", "VAR_8++;", "avio_w8(VAR_1, 0);", "}", "return VAR_8;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23, 25 ], [ 35 ], [ 39, 43, 45, 47 ], [ 51, 53 ], [ 55, 57 ], [ 61 ], [ 63 ], [ 65, 67, 69, 71, 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81, 83 ], [ 85, 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95, 97, 99, 101 ], [ 103 ], [ 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 ], [ 181 ], [ 185 ], [ 189 ], [ 193 ], [ 197 ], [ 201 ], [ 205 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 237 ], [ 239, 241, 243 ], [ 247 ], [ 251 ], [ 255 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277, 279 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ], [ 291 ], [ 293 ], [ 295 ], [ 297 ], [ 301 ], [ 303 ] ]
26,391
MigrationCapabilityStatusList *qmp_query_migrate_capabilities(Error **errp) { MigrationCapabilityStatusList *head = NULL; MigrationCapabilityStatusList *caps; MigrationState *s = migrate_get_current(); int i; caps = NULL; /* silence compiler warning */ for (i = 0; i < MIGRATION_CAPABILITY__MAX; i++) { #ifndef CONFIG_LIVE_BLOCK_MIGRATION if (i == MIGRATION_CAPABILITY_BLOCK) { continue; } #endif if (i == MIGRATION_CAPABILITY_X_COLO && !colo_supported()) { continue; } if (head == NULL) { head = g_malloc0(sizeof(*caps)); caps = head; } else { caps->next = g_malloc0(sizeof(*caps)); caps = caps->next; } caps->value = g_malloc(sizeof(*caps->value)); caps->value->capability = i; caps->value->state = s->enabled_capabilities[i]; } return head; }
false
qemu
fd198f9002a9e1f070c82b04d3229c18d9a49471
MigrationCapabilityStatusList *qmp_query_migrate_capabilities(Error **errp) { MigrationCapabilityStatusList *head = NULL; MigrationCapabilityStatusList *caps; MigrationState *s = migrate_get_current(); int i; caps = NULL; for (i = 0; i < MIGRATION_CAPABILITY__MAX; i++) { #ifndef CONFIG_LIVE_BLOCK_MIGRATION if (i == MIGRATION_CAPABILITY_BLOCK) { continue; } #endif if (i == MIGRATION_CAPABILITY_X_COLO && !colo_supported()) { continue; } if (head == NULL) { head = g_malloc0(sizeof(*caps)); caps = head; } else { caps->next = g_malloc0(sizeof(*caps)); caps = caps->next; } caps->value = g_malloc(sizeof(*caps->value)); caps->value->capability = i; caps->value->state = s->enabled_capabilities[i]; } return head; }
{ "code": [], "line_no": [] }
MigrationCapabilityStatusList *FUNC_0(Error **errp) { MigrationCapabilityStatusList *head = NULL; MigrationCapabilityStatusList *caps; MigrationState *s = migrate_get_current(); int VAR_0; caps = NULL; for (VAR_0 = 0; VAR_0 < MIGRATION_CAPABILITY__MAX; VAR_0++) { #ifndef CONFIG_LIVE_BLOCK_MIGRATION if (VAR_0 == MIGRATION_CAPABILITY_BLOCK) { continue; } #endif if (VAR_0 == MIGRATION_CAPABILITY_X_COLO && !colo_supported()) { continue; } if (head == NULL) { head = g_malloc0(sizeof(*caps)); caps = head; } else { caps->next = g_malloc0(sizeof(*caps)); caps = caps->next; } caps->value = g_malloc(sizeof(*caps->value)); caps->value->capability = VAR_0; caps->value->state = s->enabled_capabilities[VAR_0]; } return head; }
[ "MigrationCapabilityStatusList *FUNC_0(Error **errp)\n{", "MigrationCapabilityStatusList *head = NULL;", "MigrationCapabilityStatusList *caps;", "MigrationState *s = migrate_get_current();", "int VAR_0;", "caps = NULL;", "for (VAR_0 = 0; VAR_0 < MIGRATION_CAPABILITY__MAX; VAR_0++) {", "#ifndef CONFIG_LIVE_BLOCK_MIGRATION\nif (VAR_0 == MIGRATION_CAPABILITY_BLOCK) {", "continue;", "}", "#endif\nif (VAR_0 == MIGRATION_CAPABILITY_X_COLO && !colo_supported()) {", "continue;", "}", "if (head == NULL) {", "head = g_malloc0(sizeof(*caps));", "caps = head;", "} else {", "caps->next = g_malloc0(sizeof(*caps));", "caps = caps->next;", "}", "caps->value =\ng_malloc(sizeof(*caps->value));", "caps->value->capability = VAR_0;", "caps->value->state = s->enabled_capabilities[VAR_0];", "}", "return head;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19, 21 ], [ 23 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49, 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ] ]
26,392
static int read_f(BlockBackend *blk, int argc, char **argv) { struct timeval t1, t2; int Cflag = 0, pflag = 0, qflag = 0, vflag = 0; int Pflag = 0, sflag = 0, lflag = 0, bflag = 0; int c, cnt; char *buf; int64_t offset; int count; /* Some compilers get confused and warn if this is not initialized. */ int total = 0; int pattern = 0, pattern_offset = 0, pattern_count = 0; while ((c = getopt(argc, argv, "bCl:pP:qs:v")) != EOF) { switch (c) { case 'b': bflag = 1; break; case 'C': Cflag = 1; break; case 'l': lflag = 1; pattern_count = cvtnum(optarg); if (pattern_count < 0) { printf("non-numeric length argument -- %s\n", optarg); return 0; } break; case 'p': pflag = 1; break; case 'P': Pflag = 1; pattern = parse_pattern(optarg); if (pattern < 0) { return 0; } break; case 'q': qflag = 1; break; case 's': sflag = 1; pattern_offset = cvtnum(optarg); if (pattern_offset < 0) { printf("non-numeric length argument -- %s\n", optarg); return 0; } break; case 'v': vflag = 1; break; default: return qemuio_command_usage(&read_cmd); } } if (optind != argc - 2) { return qemuio_command_usage(&read_cmd); } if (bflag && pflag) { printf("-b and -p cannot be specified at the same time\n"); return 0; } offset = cvtnum(argv[optind]); if (offset < 0) { printf("non-numeric length argument -- %s\n", argv[optind]); return 0; } optind++; count = cvtnum(argv[optind]); if (count < 0) { printf("non-numeric length argument -- %s\n", argv[optind]); return 0; } if (!Pflag && (lflag || sflag)) { return qemuio_command_usage(&read_cmd); } if (!lflag) { pattern_count = count - pattern_offset; } if ((pattern_count < 0) || (pattern_count + pattern_offset > count)) { printf("pattern verification range exceeds end of read data\n"); return 0; } if (!pflag) { if (offset & 0x1ff) { printf("offset %" PRId64 " is not sector aligned\n", offset); return 0; } if (count & 0x1ff) { printf("count %d is not sector aligned\n", count); return 0; } } buf = qemu_io_alloc(blk, count, 0xab); gettimeofday(&t1, NULL); if (pflag) { cnt = do_pread(blk, buf, offset, count, &total); } else if (bflag) { cnt = do_load_vmstate(blk, buf, offset, count, &total); } else { cnt = do_read(blk, buf, offset, count, &total); } gettimeofday(&t2, NULL); if (cnt < 0) { printf("read failed: %s\n", strerror(-cnt)); goto out; } if (Pflag) { void *cmp_buf = g_malloc(pattern_count); memset(cmp_buf, pattern, pattern_count); if (memcmp(buf + pattern_offset, cmp_buf, pattern_count)) { printf("Pattern verification failed at offset %" PRId64 ", %d bytes\n", offset + pattern_offset, pattern_count); } g_free(cmp_buf); } if (qflag) { goto out; } if (vflag) { dump_buffer(buf, offset, count); } /* Finally, report back -- -C gives a parsable format */ t2 = tsub(t2, t1); print_report("read", &t2, offset, count, total, cnt, Cflag); out: qemu_io_free(buf); return 0; }
false
qemu
b062ad86dcd33ab39be5060b0655d8e13834b167
static int read_f(BlockBackend *blk, int argc, char **argv) { struct timeval t1, t2; int Cflag = 0, pflag = 0, qflag = 0, vflag = 0; int Pflag = 0, sflag = 0, lflag = 0, bflag = 0; int c, cnt; char *buf; int64_t offset; int count; int total = 0; int pattern = 0, pattern_offset = 0, pattern_count = 0; while ((c = getopt(argc, argv, "bCl:pP:qs:v")) != EOF) { switch (c) { case 'b': bflag = 1; break; case 'C': Cflag = 1; break; case 'l': lflag = 1; pattern_count = cvtnum(optarg); if (pattern_count < 0) { printf("non-numeric length argument -- %s\n", optarg); return 0; } break; case 'p': pflag = 1; break; case 'P': Pflag = 1; pattern = parse_pattern(optarg); if (pattern < 0) { return 0; } break; case 'q': qflag = 1; break; case 's': sflag = 1; pattern_offset = cvtnum(optarg); if (pattern_offset < 0) { printf("non-numeric length argument -- %s\n", optarg); return 0; } break; case 'v': vflag = 1; break; default: return qemuio_command_usage(&read_cmd); } } if (optind != argc - 2) { return qemuio_command_usage(&read_cmd); } if (bflag && pflag) { printf("-b and -p cannot be specified at the same time\n"); return 0; } offset = cvtnum(argv[optind]); if (offset < 0) { printf("non-numeric length argument -- %s\n", argv[optind]); return 0; } optind++; count = cvtnum(argv[optind]); if (count < 0) { printf("non-numeric length argument -- %s\n", argv[optind]); return 0; } if (!Pflag && (lflag || sflag)) { return qemuio_command_usage(&read_cmd); } if (!lflag) { pattern_count = count - pattern_offset; } if ((pattern_count < 0) || (pattern_count + pattern_offset > count)) { printf("pattern verification range exceeds end of read data\n"); return 0; } if (!pflag) { if (offset & 0x1ff) { printf("offset %" PRId64 " is not sector aligned\n", offset); return 0; } if (count & 0x1ff) { printf("count %d is not sector aligned\n", count); return 0; } } buf = qemu_io_alloc(blk, count, 0xab); gettimeofday(&t1, NULL); if (pflag) { cnt = do_pread(blk, buf, offset, count, &total); } else if (bflag) { cnt = do_load_vmstate(blk, buf, offset, count, &total); } else { cnt = do_read(blk, buf, offset, count, &total); } gettimeofday(&t2, NULL); if (cnt < 0) { printf("read failed: %s\n", strerror(-cnt)); goto out; } if (Pflag) { void *cmp_buf = g_malloc(pattern_count); memset(cmp_buf, pattern, pattern_count); if (memcmp(buf + pattern_offset, cmp_buf, pattern_count)) { printf("Pattern verification failed at offset %" PRId64 ", %d bytes\n", offset + pattern_offset, pattern_count); } g_free(cmp_buf); } if (qflag) { goto out; } if (vflag) { dump_buffer(buf, offset, count); } t2 = tsub(t2, t1); print_report("read", &t2, offset, count, total, cnt, Cflag); out: qemu_io_free(buf); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(BlockBackend *VAR_0, int VAR_1, char **VAR_2) { struct timeval VAR_3, VAR_4; int VAR_5 = 0, VAR_6 = 0, VAR_7 = 0, VAR_8 = 0; int VAR_9 = 0, VAR_10 = 0, VAR_11 = 0, VAR_12 = 0; int VAR_13, VAR_14; char *VAR_15; int64_t offset; int VAR_16; int VAR_17 = 0; int VAR_18 = 0, VAR_19 = 0, VAR_20 = 0; while ((VAR_13 = getopt(VAR_1, VAR_2, "bCl:pP:qs:v")) != EOF) { switch (VAR_13) { case 'b': VAR_12 = 1; break; case 'C': VAR_5 = 1; break; case 'l': VAR_11 = 1; VAR_20 = cvtnum(optarg); if (VAR_20 < 0) { printf("non-numeric length argument -- %s\n", optarg); return 0; } break; case 'p': VAR_6 = 1; break; case 'P': VAR_9 = 1; VAR_18 = parse_pattern(optarg); if (VAR_18 < 0) { return 0; } break; case 'q': VAR_7 = 1; break; case 's': VAR_10 = 1; VAR_19 = cvtnum(optarg); if (VAR_19 < 0) { printf("non-numeric length argument -- %s\n", optarg); return 0; } break; case 'v': VAR_8 = 1; break; default: return qemuio_command_usage(&read_cmd); } } if (optind != VAR_1 - 2) { return qemuio_command_usage(&read_cmd); } if (VAR_12 && VAR_6) { printf("-b and -p cannot be specified at the same time\n"); return 0; } offset = cvtnum(VAR_2[optind]); if (offset < 0) { printf("non-numeric length argument -- %s\n", VAR_2[optind]); return 0; } optind++; VAR_16 = cvtnum(VAR_2[optind]); if (VAR_16 < 0) { printf("non-numeric length argument -- %s\n", VAR_2[optind]); return 0; } if (!VAR_9 && (VAR_11 || VAR_10)) { return qemuio_command_usage(&read_cmd); } if (!VAR_11) { VAR_20 = VAR_16 - VAR_19; } if ((VAR_20 < 0) || (VAR_20 + VAR_19 > VAR_16)) { printf("VAR_18 verification range exceeds end of read data\n"); return 0; } if (!VAR_6) { if (offset & 0x1ff) { printf("offset %" PRId64 " is not sector aligned\n", offset); return 0; } if (VAR_16 & 0x1ff) { printf("VAR_16 %d is not sector aligned\n", VAR_16); return 0; } } VAR_15 = qemu_io_alloc(VAR_0, VAR_16, 0xab); gettimeofday(&VAR_3, NULL); if (VAR_6) { VAR_14 = do_pread(VAR_0, VAR_15, offset, VAR_16, &VAR_17); } else if (VAR_12) { VAR_14 = do_load_vmstate(VAR_0, VAR_15, offset, VAR_16, &VAR_17); } else { VAR_14 = do_read(VAR_0, VAR_15, offset, VAR_16, &VAR_17); } gettimeofday(&VAR_4, NULL); if (VAR_14 < 0) { printf("read failed: %s\n", strerror(-VAR_14)); goto out; } if (VAR_9) { void *VAR_21 = g_malloc(VAR_20); memset(VAR_21, VAR_18, VAR_20); if (memcmp(VAR_15 + VAR_19, VAR_21, VAR_20)) { printf("Pattern verification failed at offset %" PRId64 ", %d bytes\n", offset + VAR_19, VAR_20); } g_free(VAR_21); } if (VAR_7) { goto out; } if (VAR_8) { dump_buffer(VAR_15, offset, VAR_16); } VAR_4 = tsub(VAR_4, VAR_3); print_report("read", &VAR_4, offset, VAR_16, VAR_17, VAR_14, VAR_5); out: qemu_io_free(VAR_15); return 0; }
[ "static int FUNC_0(BlockBackend *VAR_0, int VAR_1, char **VAR_2)\n{", "struct timeval VAR_3, VAR_4;", "int VAR_5 = 0, VAR_6 = 0, VAR_7 = 0, VAR_8 = 0;", "int VAR_9 = 0, VAR_10 = 0, VAR_11 = 0, VAR_12 = 0;", "int VAR_13, VAR_14;", "char *VAR_15;", "int64_t offset;", "int VAR_16;", "int VAR_17 = 0;", "int VAR_18 = 0, VAR_19 = 0, VAR_20 = 0;", "while ((VAR_13 = getopt(VAR_1, VAR_2, \"bCl:pP:qs:v\")) != EOF) {", "switch (VAR_13) {", "case 'b':\nVAR_12 = 1;", "break;", "case 'C':\nVAR_5 = 1;", "break;", "case 'l':\nVAR_11 = 1;", "VAR_20 = cvtnum(optarg);", "if (VAR_20 < 0) {", "printf(\"non-numeric length argument -- %s\\n\", optarg);", "return 0;", "}", "break;", "case 'p':\nVAR_6 = 1;", "break;", "case 'P':\nVAR_9 = 1;", "VAR_18 = parse_pattern(optarg);", "if (VAR_18 < 0) {", "return 0;", "}", "break;", "case 'q':\nVAR_7 = 1;", "break;", "case 's':\nVAR_10 = 1;", "VAR_19 = cvtnum(optarg);", "if (VAR_19 < 0) {", "printf(\"non-numeric length argument -- %s\\n\", optarg);", "return 0;", "}", "break;", "case 'v':\nVAR_8 = 1;", "break;", "default:\nreturn qemuio_command_usage(&read_cmd);", "}", "}", "if (optind != VAR_1 - 2) {", "return qemuio_command_usage(&read_cmd);", "}", "if (VAR_12 && VAR_6) {", "printf(\"-b and -p cannot be specified at the same time\\n\");", "return 0;", "}", "offset = cvtnum(VAR_2[optind]);", "if (offset < 0) {", "printf(\"non-numeric length argument -- %s\\n\", VAR_2[optind]);", "return 0;", "}", "optind++;", "VAR_16 = cvtnum(VAR_2[optind]);", "if (VAR_16 < 0) {", "printf(\"non-numeric length argument -- %s\\n\", VAR_2[optind]);", "return 0;", "}", "if (!VAR_9 && (VAR_11 || VAR_10)) {", "return qemuio_command_usage(&read_cmd);", "}", "if (!VAR_11) {", "VAR_20 = VAR_16 - VAR_19;", "}", "if ((VAR_20 < 0) || (VAR_20 + VAR_19 > VAR_16)) {", "printf(\"VAR_18 verification range exceeds end of read data\\n\");", "return 0;", "}", "if (!VAR_6) {", "if (offset & 0x1ff) {", "printf(\"offset %\" PRId64 \" is not sector aligned\\n\",\noffset);", "return 0;", "}", "if (VAR_16 & 0x1ff) {", "printf(\"VAR_16 %d is not sector aligned\\n\",\nVAR_16);", "return 0;", "}", "}", "VAR_15 = qemu_io_alloc(VAR_0, VAR_16, 0xab);", "gettimeofday(&VAR_3, NULL);", "if (VAR_6) {", "VAR_14 = do_pread(VAR_0, VAR_15, offset, VAR_16, &VAR_17);", "} else if (VAR_12) {", "VAR_14 = do_load_vmstate(VAR_0, VAR_15, offset, VAR_16, &VAR_17);", "} else {", "VAR_14 = do_read(VAR_0, VAR_15, offset, VAR_16, &VAR_17);", "}", "gettimeofday(&VAR_4, NULL);", "if (VAR_14 < 0) {", "printf(\"read failed: %s\\n\", strerror(-VAR_14));", "goto out;", "}", "if (VAR_9) {", "void *VAR_21 = g_malloc(VAR_20);", "memset(VAR_21, VAR_18, VAR_20);", "if (memcmp(VAR_15 + VAR_19, VAR_21, VAR_20)) {", "printf(\"Pattern verification failed at offset %\"\nPRId64 \", %d bytes\\n\",\noffset + VAR_19, VAR_20);", "}", "g_free(VAR_21);", "}", "if (VAR_7) {", "goto out;", "}", "if (VAR_8) {", "dump_buffer(VAR_15, offset, VAR_16);", "}", "VAR_4 = tsub(VAR_4, VAR_3);", "print_report(\"read\", &VAR_4, offset, VAR_16, VAR_17, VAR_14, VAR_5);", "out:\nqemu_io_free(VAR_15);", "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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 37, 39 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59, 61 ], [ 63 ], [ 65, 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79, 81 ], [ 83 ], [ 85, 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101, 103 ], [ 105 ], [ 107, 109 ], [ 111 ], [ 113 ], [ 117 ], [ 119 ], [ 121 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 161 ], [ 163 ], [ 165 ], [ 169 ], [ 171 ], [ 173 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 187 ], [ 189 ], [ 191, 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201, 203 ], [ 205 ], [ 207 ], [ 209 ], [ 213 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255, 257, 259 ], [ 261 ], [ 263 ], [ 265 ], [ 269 ], [ 271 ], [ 273 ], [ 277 ], [ 279 ], [ 281 ], [ 287 ], [ 289 ], [ 293, 295 ], [ 299 ], [ 301 ] ]
26,393
static TRBCCode xhci_disable_ep(XHCIState *xhci, unsigned int slotid, unsigned int epid) { XHCISlot *slot; XHCIEPContext *epctx; int i; trace_usb_xhci_ep_disable(slotid, epid); assert(slotid >= 1 && slotid <= xhci->numslots); assert(epid >= 1 && epid <= 31); slot = &xhci->slots[slotid-1]; if (!slot->eps[epid-1]) { DPRINTF("xhci: slot %d ep %d already disabled\n", slotid, epid); return CC_SUCCESS; } xhci_ep_nuke_xfers(xhci, slotid, epid, 0); epctx = slot->eps[epid-1]; if (epctx->nr_pstreams) { xhci_free_streams(epctx); } for (i = 0; i < ARRAY_SIZE(epctx->transfers); i++) { usb_packet_cleanup(&epctx->transfers[i].packet); } /* only touch guest RAM if we're not resetting the HC */ if (xhci->dcbaap_low || xhci->dcbaap_high) { xhci_set_ep_state(xhci, epctx, NULL, EP_DISABLED); } timer_free(epctx->kick_timer); g_free(epctx); slot->eps[epid-1] = NULL; return CC_SUCCESS; }
false
qemu
94b037f2a451b3dc855f9f2c346e5049a361bd55
static TRBCCode xhci_disable_ep(XHCIState *xhci, unsigned int slotid, unsigned int epid) { XHCISlot *slot; XHCIEPContext *epctx; int i; trace_usb_xhci_ep_disable(slotid, epid); assert(slotid >= 1 && slotid <= xhci->numslots); assert(epid >= 1 && epid <= 31); slot = &xhci->slots[slotid-1]; if (!slot->eps[epid-1]) { DPRINTF("xhci: slot %d ep %d already disabled\n", slotid, epid); return CC_SUCCESS; } xhci_ep_nuke_xfers(xhci, slotid, epid, 0); epctx = slot->eps[epid-1]; if (epctx->nr_pstreams) { xhci_free_streams(epctx); } for (i = 0; i < ARRAY_SIZE(epctx->transfers); i++) { usb_packet_cleanup(&epctx->transfers[i].packet); } if (xhci->dcbaap_low || xhci->dcbaap_high) { xhci_set_ep_state(xhci, epctx, NULL, EP_DISABLED); } timer_free(epctx->kick_timer); g_free(epctx); slot->eps[epid-1] = NULL; return CC_SUCCESS; }
{ "code": [], "line_no": [] }
static TRBCCode FUNC_0(XHCIState *xhci, unsigned int slotid, unsigned int epid) { XHCISlot *slot; XHCIEPContext *epctx; int VAR_0; trace_usb_xhci_ep_disable(slotid, epid); assert(slotid >= 1 && slotid <= xhci->numslots); assert(epid >= 1 && epid <= 31); slot = &xhci->slots[slotid-1]; if (!slot->eps[epid-1]) { DPRINTF("xhci: slot %d ep %d already disabled\n", slotid, epid); return CC_SUCCESS; } xhci_ep_nuke_xfers(xhci, slotid, epid, 0); epctx = slot->eps[epid-1]; if (epctx->nr_pstreams) { xhci_free_streams(epctx); } for (VAR_0 = 0; VAR_0 < ARRAY_SIZE(epctx->transfers); VAR_0++) { usb_packet_cleanup(&epctx->transfers[VAR_0].packet); } if (xhci->dcbaap_low || xhci->dcbaap_high) { xhci_set_ep_state(xhci, epctx, NULL, EP_DISABLED); } timer_free(epctx->kick_timer); g_free(epctx); slot->eps[epid-1] = NULL; return CC_SUCCESS; }
[ "static TRBCCode FUNC_0(XHCIState *xhci, unsigned int slotid,\nunsigned int epid)\n{", "XHCISlot *slot;", "XHCIEPContext *epctx;", "int VAR_0;", "trace_usb_xhci_ep_disable(slotid, epid);", "assert(slotid >= 1 && slotid <= xhci->numslots);", "assert(epid >= 1 && epid <= 31);", "slot = &xhci->slots[slotid-1];", "if (!slot->eps[epid-1]) {", "DPRINTF(\"xhci: slot %d ep %d already disabled\\n\", slotid, epid);", "return CC_SUCCESS;", "}", "xhci_ep_nuke_xfers(xhci, slotid, epid, 0);", "epctx = slot->eps[epid-1];", "if (epctx->nr_pstreams) {", "xhci_free_streams(epctx);", "}", "for (VAR_0 = 0; VAR_0 < ARRAY_SIZE(epctx->transfers); VAR_0++) {", "usb_packet_cleanup(&epctx->transfers[VAR_0].packet);", "}", "if (xhci->dcbaap_low || xhci->dcbaap_high) {", "xhci_set_ep_state(xhci, epctx, NULL, EP_DISABLED);", "}", "timer_free(epctx->kick_timer);", "g_free(epctx);", "slot->eps[epid-1] = NULL;", "return CC_SUCCESS;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ] ]
26,395
static void monitor_find_completion(const char *cmdline) { const char *cmdname; char *args[MAX_ARGS]; int nb_args, i, len; const char *ptype, *str; const mon_cmd_t *cmd; const KeyDef *key; parse_cmdline(cmdline, &nb_args, args); #ifdef DEBUG_COMPLETION for(i = 0; i < nb_args; i++) { monitor_printf(cur_mon, "arg%d = '%s'\n", i, (char *)args[i]); } #endif /* if the line ends with a space, it means we want to complete the next arg */ len = strlen(cmdline); if (len > 0 && qemu_isspace(cmdline[len - 1])) { if (nb_args >= MAX_ARGS) { goto cleanup; } args[nb_args++] = g_strdup(""); } if (nb_args <= 1) { /* command completion */ if (nb_args == 0) cmdname = ""; else cmdname = args[0]; readline_set_completion_index(cur_mon->rs, strlen(cmdname)); for(cmd = mon_cmds; cmd->name != NULL; cmd++) { cmd_completion(cmdname, cmd->name); } } else { /* find the command */ for (cmd = mon_cmds; cmd->name != NULL; cmd++) { if (compare_cmd(args[0], cmd->name)) { break; } } if (!cmd->name) { goto cleanup; } ptype = next_arg_type(cmd->args_type); for(i = 0; i < nb_args - 2; i++) { if (*ptype != '\0') { ptype = next_arg_type(ptype); while (*ptype == '?') ptype = next_arg_type(ptype); } } str = args[nb_args - 1]; if (*ptype == '-' && ptype[1] != '\0') { ptype = next_arg_type(ptype); } switch(*ptype) { case 'F': /* file completion */ readline_set_completion_index(cur_mon->rs, strlen(str)); file_completion(str); break; case 'B': /* block device name completion */ readline_set_completion_index(cur_mon->rs, strlen(str)); bdrv_iterate(block_completion_it, (void *)str); break; case 's': /* XXX: more generic ? */ if (!strcmp(cmd->name, "info")) { readline_set_completion_index(cur_mon->rs, strlen(str)); for(cmd = info_cmds; cmd->name != NULL; cmd++) { cmd_completion(str, cmd->name); } } else if (!strcmp(cmd->name, "sendkey")) { char *sep = strrchr(str, '-'); if (sep) str = sep + 1; readline_set_completion_index(cur_mon->rs, strlen(str)); for(key = key_defs; key->name != NULL; key++) { cmd_completion(str, key->name); } } else if (!strcmp(cmd->name, "help|?")) { readline_set_completion_index(cur_mon->rs, strlen(str)); for (cmd = mon_cmds; cmd->name != NULL; cmd++) { cmd_completion(str, cmd->name); } } break; default: break; } } cleanup: for (i = 0; i < nb_args; i++) { g_free(args[i]); } }
false
qemu
1048c88f03545fa42bdebb077871a743a614d2ab
static void monitor_find_completion(const char *cmdline) { const char *cmdname; char *args[MAX_ARGS]; int nb_args, i, len; const char *ptype, *str; const mon_cmd_t *cmd; const KeyDef *key; parse_cmdline(cmdline, &nb_args, args); #ifdef DEBUG_COMPLETION for(i = 0; i < nb_args; i++) { monitor_printf(cur_mon, "arg%d = '%s'\n", i, (char *)args[i]); } #endif len = strlen(cmdline); if (len > 0 && qemu_isspace(cmdline[len - 1])) { if (nb_args >= MAX_ARGS) { goto cleanup; } args[nb_args++] = g_strdup(""); } if (nb_args <= 1) { if (nb_args == 0) cmdname = ""; else cmdname = args[0]; readline_set_completion_index(cur_mon->rs, strlen(cmdname)); for(cmd = mon_cmds; cmd->name != NULL; cmd++) { cmd_completion(cmdname, cmd->name); } } else { for (cmd = mon_cmds; cmd->name != NULL; cmd++) { if (compare_cmd(args[0], cmd->name)) { break; } } if (!cmd->name) { goto cleanup; } ptype = next_arg_type(cmd->args_type); for(i = 0; i < nb_args - 2; i++) { if (*ptype != '\0') { ptype = next_arg_type(ptype); while (*ptype == '?') ptype = next_arg_type(ptype); } } str = args[nb_args - 1]; if (*ptype == '-' && ptype[1] != '\0') { ptype = next_arg_type(ptype); } switch(*ptype) { case 'F': readline_set_completion_index(cur_mon->rs, strlen(str)); file_completion(str); break; case 'B': readline_set_completion_index(cur_mon->rs, strlen(str)); bdrv_iterate(block_completion_it, (void *)str); break; case 's': if (!strcmp(cmd->name, "info")) { readline_set_completion_index(cur_mon->rs, strlen(str)); for(cmd = info_cmds; cmd->name != NULL; cmd++) { cmd_completion(str, cmd->name); } } else if (!strcmp(cmd->name, "sendkey")) { char *sep = strrchr(str, '-'); if (sep) str = sep + 1; readline_set_completion_index(cur_mon->rs, strlen(str)); for(key = key_defs; key->name != NULL; key++) { cmd_completion(str, key->name); } } else if (!strcmp(cmd->name, "help|?")) { readline_set_completion_index(cur_mon->rs, strlen(str)); for (cmd = mon_cmds; cmd->name != NULL; cmd++) { cmd_completion(str, cmd->name); } } break; default: break; } } cleanup: for (i = 0; i < nb_args; i++) { g_free(args[i]); } }
{ "code": [], "line_no": [] }
static void FUNC_0(const char *VAR_0) { const char *VAR_1; char *VAR_2[MAX_ARGS]; int VAR_3, VAR_4, VAR_5; const char *VAR_6, *VAR_7; const mon_cmd_t *VAR_8; const KeyDef *VAR_9; parse_cmdline(VAR_0, &VAR_3, VAR_2); #ifdef DEBUG_COMPLETION for(VAR_4 = 0; VAR_4 < VAR_3; VAR_4++) { monitor_printf(cur_mon, "arg%d = '%s'\n", VAR_4, (char *)VAR_2[VAR_4]); } #endif VAR_5 = strlen(VAR_0); if (VAR_5 > 0 && qemu_isspace(VAR_0[VAR_5 - 1])) { if (VAR_3 >= MAX_ARGS) { goto cleanup; } VAR_2[VAR_3++] = g_strdup(""); } if (VAR_3 <= 1) { if (VAR_3 == 0) VAR_1 = ""; else VAR_1 = VAR_2[0]; readline_set_completion_index(cur_mon->rs, strlen(VAR_1)); for(VAR_8 = mon_cmds; VAR_8->name != NULL; VAR_8++) { cmd_completion(VAR_1, VAR_8->name); } } else { for (VAR_8 = mon_cmds; VAR_8->name != NULL; VAR_8++) { if (compare_cmd(VAR_2[0], VAR_8->name)) { break; } } if (!VAR_8->name) { goto cleanup; } VAR_6 = next_arg_type(VAR_8->args_type); for(VAR_4 = 0; VAR_4 < VAR_3 - 2; VAR_4++) { if (*VAR_6 != '\0') { VAR_6 = next_arg_type(VAR_6); while (*VAR_6 == '?') VAR_6 = next_arg_type(VAR_6); } } VAR_7 = VAR_2[VAR_3 - 1]; if (*VAR_6 == '-' && VAR_6[1] != '\0') { VAR_6 = next_arg_type(VAR_6); } switch(*VAR_6) { case 'F': readline_set_completion_index(cur_mon->rs, strlen(VAR_7)); file_completion(VAR_7); break; case 'B': readline_set_completion_index(cur_mon->rs, strlen(VAR_7)); bdrv_iterate(block_completion_it, (void *)VAR_7); break; case 's': if (!strcmp(VAR_8->name, "info")) { readline_set_completion_index(cur_mon->rs, strlen(VAR_7)); for(VAR_8 = info_cmds; VAR_8->name != NULL; VAR_8++) { cmd_completion(VAR_7, VAR_8->name); } } else if (!strcmp(VAR_8->name, "sendkey")) { char *VAR_10 = strrchr(VAR_7, '-'); if (VAR_10) VAR_7 = VAR_10 + 1; readline_set_completion_index(cur_mon->rs, strlen(VAR_7)); for(VAR_9 = key_defs; VAR_9->name != NULL; VAR_9++) { cmd_completion(VAR_7, VAR_9->name); } } else if (!strcmp(VAR_8->name, "help|?")) { readline_set_completion_index(cur_mon->rs, strlen(VAR_7)); for (VAR_8 = mon_cmds; VAR_8->name != NULL; VAR_8++) { cmd_completion(VAR_7, VAR_8->name); } } break; default: break; } } cleanup: for (VAR_4 = 0; VAR_4 < VAR_3; VAR_4++) { g_free(VAR_2[VAR_4]); } }
[ "static void FUNC_0(const char *VAR_0)\n{", "const char *VAR_1;", "char *VAR_2[MAX_ARGS];", "int VAR_3, VAR_4, VAR_5;", "const char *VAR_6, *VAR_7;", "const mon_cmd_t *VAR_8;", "const KeyDef *VAR_9;", "parse_cmdline(VAR_0, &VAR_3, VAR_2);", "#ifdef DEBUG_COMPLETION\nfor(VAR_4 = 0; VAR_4 < VAR_3; VAR_4++) {", "monitor_printf(cur_mon, \"arg%d = '%s'\\n\", VAR_4, (char *)VAR_2[VAR_4]);", "}", "#endif\nVAR_5 = strlen(VAR_0);", "if (VAR_5 > 0 && qemu_isspace(VAR_0[VAR_5 - 1])) {", "if (VAR_3 >= MAX_ARGS) {", "goto cleanup;", "}", "VAR_2[VAR_3++] = g_strdup(\"\");", "}", "if (VAR_3 <= 1) {", "if (VAR_3 == 0)\nVAR_1 = \"\";", "else\nVAR_1 = VAR_2[0];", "readline_set_completion_index(cur_mon->rs, strlen(VAR_1));", "for(VAR_8 = mon_cmds; VAR_8->name != NULL; VAR_8++) {", "cmd_completion(VAR_1, VAR_8->name);", "}", "} else {", "for (VAR_8 = mon_cmds; VAR_8->name != NULL; VAR_8++) {", "if (compare_cmd(VAR_2[0], VAR_8->name)) {", "break;", "}", "}", "if (!VAR_8->name) {", "goto cleanup;", "}", "VAR_6 = next_arg_type(VAR_8->args_type);", "for(VAR_4 = 0; VAR_4 < VAR_3 - 2; VAR_4++) {", "if (*VAR_6 != '\\0') {", "VAR_6 = next_arg_type(VAR_6);", "while (*VAR_6 == '?')\nVAR_6 = next_arg_type(VAR_6);", "}", "}", "VAR_7 = VAR_2[VAR_3 - 1];", "if (*VAR_6 == '-' && VAR_6[1] != '\\0') {", "VAR_6 = next_arg_type(VAR_6);", "}", "switch(*VAR_6) {", "case 'F':\nreadline_set_completion_index(cur_mon->rs, strlen(VAR_7));", "file_completion(VAR_7);", "break;", "case 'B':\nreadline_set_completion_index(cur_mon->rs, strlen(VAR_7));", "bdrv_iterate(block_completion_it, (void *)VAR_7);", "break;", "case 's':\nif (!strcmp(VAR_8->name, \"info\")) {", "readline_set_completion_index(cur_mon->rs, strlen(VAR_7));", "for(VAR_8 = info_cmds; VAR_8->name != NULL; VAR_8++) {", "cmd_completion(VAR_7, VAR_8->name);", "}", "} else if (!strcmp(VAR_8->name, \"sendkey\")) {", "char *VAR_10 = strrchr(VAR_7, '-');", "if (VAR_10)\nVAR_7 = VAR_10 + 1;", "readline_set_completion_index(cur_mon->rs, strlen(VAR_7));", "for(VAR_9 = key_defs; VAR_9->name != NULL; VAR_9++) {", "cmd_completion(VAR_7, VAR_9->name);", "}", "} else if (!strcmp(VAR_8->name, \"help|?\")) {", "readline_set_completion_index(cur_mon->rs, strlen(VAR_7));", "for (VAR_8 = mon_cmds; VAR_8->name != NULL; VAR_8++) {", "cmd_completion(VAR_7, VAR_8->name);", "}", "}", "break;", "default:\nbreak;", "}", "}", "cleanup:\nfor (VAR_4 = 0; VAR_4 < VAR_3; VAR_4++) {", "g_free(VAR_2[VAR_4]);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21, 23 ], [ 25 ], [ 27 ], [ 29, 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55, 57 ], [ 59, 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101, 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119, 123 ], [ 125 ], [ 127 ], [ 129, 133 ], [ 135 ], [ 137 ], [ 139, 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157, 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183, 185 ], [ 187 ], [ 189 ], [ 193, 195 ], [ 197 ], [ 199 ], [ 201 ] ]
26,397
CPUSPARCState *cpu_sparc_init(const char *cpu_model) { SPARCCPU *cpu; CPUSPARCState *env; cpu = SPARC_CPU(object_new(TYPE_SPARC_CPU)); env = &cpu->env; gen_intermediate_code_init(env); if (cpu_sparc_register(env, cpu_model) < 0) { object_delete(OBJECT(cpu)); return NULL; } qemu_init_vcpu(env); return env; }
false
qemu
90449c388711c3defdc76da490926d1eca177b06
CPUSPARCState *cpu_sparc_init(const char *cpu_model) { SPARCCPU *cpu; CPUSPARCState *env; cpu = SPARC_CPU(object_new(TYPE_SPARC_CPU)); env = &cpu->env; gen_intermediate_code_init(env); if (cpu_sparc_register(env, cpu_model) < 0) { object_delete(OBJECT(cpu)); return NULL; } qemu_init_vcpu(env); return env; }
{ "code": [], "line_no": [] }
CPUSPARCState *FUNC_0(const char *cpu_model) { SPARCCPU *cpu; CPUSPARCState *env; cpu = SPARC_CPU(object_new(TYPE_SPARC_CPU)); env = &cpu->env; gen_intermediate_code_init(env); if (cpu_sparc_register(env, cpu_model) < 0) { object_delete(OBJECT(cpu)); return NULL; } qemu_init_vcpu(env); return env; }
[ "CPUSPARCState *FUNC_0(const char *cpu_model)\n{", "SPARCCPU *cpu;", "CPUSPARCState *env;", "cpu = SPARC_CPU(object_new(TYPE_SPARC_CPU));", "env = &cpu->env;", "gen_intermediate_code_init(env);", "if (cpu_sparc_register(env, cpu_model) < 0) {", "object_delete(OBJECT(cpu));", "return NULL;", "}", "qemu_init_vcpu(env);", "return env;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ] ]
26,398
static abi_long unlock_iovec(struct iovec *vec, abi_ulong target_addr, int count, int copy) { struct target_iovec *target_vec; abi_ulong base; int i; target_vec = lock_user(VERIFY_READ, target_addr, count * sizeof(struct target_iovec), 1); if (!target_vec) return -TARGET_EFAULT; for(i = 0;i < count; i++) { base = tswapl(target_vec[i].iov_base); unlock_user(vec[i].iov_base, base, copy ? vec[i].iov_len : 0); } unlock_user (target_vec, target_addr, 0); return 0; }
false
qemu
d732dcb442ce810709f48d7a105b573efda118a2
static abi_long unlock_iovec(struct iovec *vec, abi_ulong target_addr, int count, int copy) { struct target_iovec *target_vec; abi_ulong base; int i; target_vec = lock_user(VERIFY_READ, target_addr, count * sizeof(struct target_iovec), 1); if (!target_vec) return -TARGET_EFAULT; for(i = 0;i < count; i++) { base = tswapl(target_vec[i].iov_base); unlock_user(vec[i].iov_base, base, copy ? vec[i].iov_len : 0); } unlock_user (target_vec, target_addr, 0); return 0; }
{ "code": [], "line_no": [] }
static abi_long FUNC_0(struct iovec *vec, abi_ulong target_addr, int count, int copy) { struct target_iovec *VAR_0; abi_ulong base; int VAR_1; VAR_0 = lock_user(VERIFY_READ, target_addr, count * sizeof(struct target_iovec), 1); if (!VAR_0) return -TARGET_EFAULT; for(VAR_1 = 0;VAR_1 < count; VAR_1++) { base = tswapl(VAR_0[VAR_1].iov_base); unlock_user(vec[VAR_1].iov_base, base, copy ? vec[VAR_1].iov_len : 0); } unlock_user (VAR_0, target_addr, 0); return 0; }
[ "static abi_long FUNC_0(struct iovec *vec, abi_ulong target_addr,\nint count, int copy)\n{", "struct target_iovec *VAR_0;", "abi_ulong base;", "int VAR_1;", "VAR_0 = lock_user(VERIFY_READ, target_addr, count * sizeof(struct target_iovec), 1);", "if (!VAR_0)\nreturn -TARGET_EFAULT;", "for(VAR_1 = 0;VAR_1 < count; VAR_1++) {", "base = tswapl(VAR_0[VAR_1].iov_base);", "unlock_user(vec[VAR_1].iov_base, base, copy ? vec[VAR_1].iov_len : 0);", "}", "unlock_user (VAR_0, target_addr, 0);", "return 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 ], [ 33 ], [ 35 ] ]
26,399
static int v9fs_synth_chmod(FsContext *fs_ctx, V9fsPath *path, FsCred *credp) { errno = EPERM; return -1; }
false
qemu
364031f17932814484657e5551ba12957d993d7e
static int v9fs_synth_chmod(FsContext *fs_ctx, V9fsPath *path, FsCred *credp) { errno = EPERM; return -1; }
{ "code": [], "line_no": [] }
static int FUNC_0(FsContext *VAR_0, V9fsPath *VAR_1, FsCred *VAR_2) { errno = EPERM; return -1; }
[ "static int FUNC_0(FsContext *VAR_0, V9fsPath *VAR_1, FsCred *VAR_2)\n{", "errno = EPERM;", "return -1;", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
26,400
static void mem_commit(MemoryListener *listener) { AddressSpace *as = container_of(listener, AddressSpace, dispatch_listener); AddressSpaceDispatch *cur = as->dispatch; AddressSpaceDispatch *next = as->next_dispatch; next->nodes = next_map.nodes; next->sections = next_map.sections; phys_page_compact_all(next, next_map.nodes_nb); as->dispatch = next; g_free(cur); }
false
qemu
53cb28cbfea038f8ad50132dc8a684e638c7d48b
static void mem_commit(MemoryListener *listener) { AddressSpace *as = container_of(listener, AddressSpace, dispatch_listener); AddressSpaceDispatch *cur = as->dispatch; AddressSpaceDispatch *next = as->next_dispatch; next->nodes = next_map.nodes; next->sections = next_map.sections; phys_page_compact_all(next, next_map.nodes_nb); as->dispatch = next; g_free(cur); }
{ "code": [], "line_no": [] }
static void FUNC_0(MemoryListener *VAR_0) { AddressSpace *as = container_of(VAR_0, AddressSpace, dispatch_listener); AddressSpaceDispatch *cur = as->dispatch; AddressSpaceDispatch *next = as->next_dispatch; next->nodes = next_map.nodes; next->sections = next_map.sections; phys_page_compact_all(next, next_map.nodes_nb); as->dispatch = next; g_free(cur); }
[ "static void FUNC_0(MemoryListener *VAR_0)\n{", "AddressSpace *as = container_of(VAR_0, AddressSpace, dispatch_listener);", "AddressSpaceDispatch *cur = as->dispatch;", "AddressSpaceDispatch *next = as->next_dispatch;", "next->nodes = next_map.nodes;", "next->sections = next_map.sections;", "phys_page_compact_all(next, next_map.nodes_nb);", "as->dispatch = next;", "g_free(cur);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ] ]
26,401
static void do_audio_out(AVFormatContext *s, OutputStream *ost, AVFrame *frame) { AVCodecContext *enc = ost->st->codec; AVPacket pkt; int got_packet = 0; av_init_packet(&pkt); pkt.data = NULL; pkt.size = 0; #if 0 if (!check_recording_time(ost)) return; #endif if (frame->pts == AV_NOPTS_VALUE || audio_sync_method < 0) frame->pts = ost->sync_opts; ost->sync_opts = frame->pts + frame->nb_samples; av_assert0(pkt.size || !pkt.data); update_benchmark(NULL); if (avcodec_encode_audio2(enc, &pkt, frame, &got_packet) < 0) { av_log(NULL, AV_LOG_FATAL, "Audio encoding failed (avcodec_encode_audio2)\n"); exit_program(1); } update_benchmark("encode_audio %d.%d", ost->file_index, ost->index); if (got_packet) { 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 (pkt.duration > 0) pkt.duration = av_rescale_q(pkt.duration, enc->time_base, ost->st->time_base); if (debug_ts) { av_log(NULL, AV_LOG_INFO, "encoder -> type:audio " "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); audio_size += pkt.size; av_free_packet(&pkt); } }
false
FFmpeg
2fc354f90d61f5f1bb75dbdd808a502dec69cf99
static void do_audio_out(AVFormatContext *s, OutputStream *ost, AVFrame *frame) { AVCodecContext *enc = ost->st->codec; AVPacket pkt; int got_packet = 0; av_init_packet(&pkt); pkt.data = NULL; pkt.size = 0; #if 0 if (!check_recording_time(ost)) return; #endif if (frame->pts == AV_NOPTS_VALUE || audio_sync_method < 0) frame->pts = ost->sync_opts; ost->sync_opts = frame->pts + frame->nb_samples; av_assert0(pkt.size || !pkt.data); update_benchmark(NULL); if (avcodec_encode_audio2(enc, &pkt, frame, &got_packet) < 0) { av_log(NULL, AV_LOG_FATAL, "Audio encoding failed (avcodec_encode_audio2)\n"); exit_program(1); } update_benchmark("encode_audio %d.%d", ost->file_index, ost->index); if (got_packet) { 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 (pkt.duration > 0) pkt.duration = av_rescale_q(pkt.duration, enc->time_base, ost->st->time_base); if (debug_ts) { av_log(NULL, AV_LOG_INFO, "encoder -> type:audio " "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); audio_size += pkt.size; av_free_packet(&pkt); } }
{ "code": [], "line_no": [] }
static void FUNC_0(AVFormatContext *VAR_0, OutputStream *VAR_1, AVFrame *VAR_2) { AVCodecContext *enc = VAR_1->st->codec; AVPacket pkt; int VAR_3 = 0; av_init_packet(&pkt); pkt.data = NULL; pkt.size = 0; #if 0 if (!check_recording_time(VAR_1)) return; #endif if (VAR_2->pts == AV_NOPTS_VALUE || audio_sync_method < 0) VAR_2->pts = VAR_1->sync_opts; VAR_1->sync_opts = VAR_2->pts + VAR_2->nb_samples; av_assert0(pkt.size || !pkt.data); update_benchmark(NULL); if (avcodec_encode_audio2(enc, &pkt, VAR_2, &VAR_3) < 0) { av_log(NULL, AV_LOG_FATAL, "Audio encoding failed (avcodec_encode_audio2)\n"); exit_program(1); } update_benchmark("encode_audio %d.%d", VAR_1->file_index, VAR_1->index); if (VAR_3) { 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 (pkt.duration > 0) pkt.duration = av_rescale_q(pkt.duration, enc->time_base, VAR_1->st->time_base); if (debug_ts) { av_log(NULL, AV_LOG_INFO, "encoder -> type:audio " "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); audio_size += pkt.size; av_free_packet(&pkt); } }
[ "static void FUNC_0(AVFormatContext *VAR_0, OutputStream *VAR_1,\nAVFrame *VAR_2)\n{", "AVCodecContext *enc = VAR_1->st->codec;", "AVPacket pkt;", "int VAR_3 = 0;", "av_init_packet(&pkt);", "pkt.data = NULL;", "pkt.size = 0;", "#if 0\nif (!check_recording_time(VAR_1))\nreturn;", "#endif\nif (VAR_2->pts == AV_NOPTS_VALUE || audio_sync_method < 0)\nVAR_2->pts = VAR_1->sync_opts;", "VAR_1->sync_opts = VAR_2->pts + VAR_2->nb_samples;", "av_assert0(pkt.size || !pkt.data);", "update_benchmark(NULL);", "if (avcodec_encode_audio2(enc, &pkt, VAR_2, &VAR_3) < 0) {", "av_log(NULL, AV_LOG_FATAL, \"Audio encoding failed (avcodec_encode_audio2)\\n\");", "exit_program(1);", "}", "update_benchmark(\"encode_audio %d.%d\", VAR_1->file_index, VAR_1->index);", "if (VAR_3) {", "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 (pkt.duration > 0)\npkt.duration = av_rescale_q(pkt.duration, enc->time_base, VAR_1->st->time_base);", "if (debug_ts) {", "av_log(NULL, AV_LOG_INFO, \"encoder -> type:audio \"\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);", "audio_size += pkt.size;", "av_free_packet(&pkt);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21, 23, 25 ], [ 27, 29, 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55, 57 ], [ 59, 61 ], [ 63, 65 ], [ 69 ], [ 71, 73, 75, 77 ], [ 79 ], [ 83 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ] ]
26,402
static void qemu_rdma_init_one_block(void *host_addr, ram_addr_t block_offset, ram_addr_t length, void *opaque) { rdma_add_block(opaque, host_addr, block_offset, length); }
false
qemu
e3807054e20fb3b94d18cb751c437ee2f43b6fac
static void qemu_rdma_init_one_block(void *host_addr, ram_addr_t block_offset, ram_addr_t length, void *opaque) { rdma_add_block(opaque, host_addr, block_offset, length); }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, ram_addr_t VAR_1, ram_addr_t VAR_2, void *VAR_3) { rdma_add_block(VAR_3, VAR_0, VAR_1, VAR_2); }
[ "static void FUNC_0(void *VAR_0,\nram_addr_t VAR_1, ram_addr_t VAR_2, void *VAR_3)\n{", "rdma_add_block(VAR_3, VAR_0, VAR_1, VAR_2);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ] ]
26,403
START_TEST(qdict_iterapi_test) { int count; const QDictEntry *ent; fail_unless(qdict_first(tests_dict) == NULL); qdict_put(tests_dict, "key1", qint_from_int(1)); qdict_put(tests_dict, "key2", qint_from_int(2)); qdict_put(tests_dict, "key3", qint_from_int(3)); count = 0; for (ent = qdict_first(tests_dict); ent; ent = qdict_next(tests_dict, ent)){ fail_unless(qdict_haskey(tests_dict, qdict_entry_key(ent)) == 1); count++; } fail_unless(count == qdict_size(tests_dict)); /* Do it again to test restarting */ count = 0; for (ent = qdict_first(tests_dict); ent; ent = qdict_next(tests_dict, ent)){ fail_unless(qdict_haskey(tests_dict, qdict_entry_key(ent)) == 1); count++; } fail_unless(count == qdict_size(tests_dict)); }
false
qemu
ac531cb6e542b1e61d668604adf9dc5306a948c0
START_TEST(qdict_iterapi_test) { int count; const QDictEntry *ent; fail_unless(qdict_first(tests_dict) == NULL); qdict_put(tests_dict, "key1", qint_from_int(1)); qdict_put(tests_dict, "key2", qint_from_int(2)); qdict_put(tests_dict, "key3", qint_from_int(3)); count = 0; for (ent = qdict_first(tests_dict); ent; ent = qdict_next(tests_dict, ent)){ fail_unless(qdict_haskey(tests_dict, qdict_entry_key(ent)) == 1); count++; } fail_unless(count == qdict_size(tests_dict)); count = 0; for (ent = qdict_first(tests_dict); ent; ent = qdict_next(tests_dict, ent)){ fail_unless(qdict_haskey(tests_dict, qdict_entry_key(ent)) == 1); count++; } fail_unless(count == qdict_size(tests_dict)); }
{ "code": [], "line_no": [] }
FUNC_0(VAR_0) { int VAR_1; const QDictEntry *VAR_2; fail_unless(qdict_first(tests_dict) == NULL); qdict_put(tests_dict, "key1", qint_from_int(1)); qdict_put(tests_dict, "key2", qint_from_int(2)); qdict_put(tests_dict, "key3", qint_from_int(3)); VAR_1 = 0; for (VAR_2 = qdict_first(tests_dict); VAR_2; VAR_2 = qdict_next(tests_dict, VAR_2)){ fail_unless(qdict_haskey(tests_dict, qdict_entry_key(VAR_2)) == 1); VAR_1++; } fail_unless(VAR_1 == qdict_size(tests_dict)); VAR_1 = 0; for (VAR_2 = qdict_first(tests_dict); VAR_2; VAR_2 = qdict_next(tests_dict, VAR_2)){ fail_unless(qdict_haskey(tests_dict, qdict_entry_key(VAR_2)) == 1); VAR_1++; } fail_unless(VAR_1 == qdict_size(tests_dict)); }
[ "FUNC_0(VAR_0)\n{", "int VAR_1;", "const QDictEntry *VAR_2;", "fail_unless(qdict_first(tests_dict) == NULL);", "qdict_put(tests_dict, \"key1\", qint_from_int(1));", "qdict_put(tests_dict, \"key2\", qint_from_int(2));", "qdict_put(tests_dict, \"key3\", qint_from_int(3));", "VAR_1 = 0;", "for (VAR_2 = qdict_first(tests_dict); VAR_2; VAR_2 = qdict_next(tests_dict, VAR_2)){", "fail_unless(qdict_haskey(tests_dict, qdict_entry_key(VAR_2)) == 1);", "VAR_1++;", "}", "fail_unless(VAR_1 == qdict_size(tests_dict));", "VAR_1 = 0;", "for (VAR_2 = qdict_first(tests_dict); VAR_2; VAR_2 = qdict_next(tests_dict, VAR_2)){", "fail_unless(qdict_haskey(tests_dict, qdict_entry_key(VAR_2)) == 1);", "VAR_1++;", "}", "fail_unless(VAR_1 == qdict_size(tests_dict));", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ] ]
26,404
static int coroutine_fn bdrv_co_do_zero_pwritev(BlockDriverState *bs, int64_t offset, unsigned int bytes, BdrvRequestFlags flags, BdrvTrackedRequest *req) { uint8_t *buf = NULL; QEMUIOVector local_qiov; struct iovec iov; uint64_t align = bs->bl.request_alignment; unsigned int head_padding_bytes, tail_padding_bytes; int ret = 0; head_padding_bytes = offset & (align - 1); tail_padding_bytes = align - ((offset + bytes) & (align - 1)); assert(flags & BDRV_REQ_ZERO_WRITE); if (head_padding_bytes || tail_padding_bytes) { buf = qemu_blockalign(bs, align); iov = (struct iovec) { .iov_base = buf, .iov_len = align, }; qemu_iovec_init_external(&local_qiov, &iov, 1); } if (head_padding_bytes) { uint64_t zero_bytes = MIN(bytes, align - head_padding_bytes); /* RMW the unaligned part before head. */ mark_request_serialising(req, align); wait_serialising_requests(req); bdrv_debug_event(bs, BLKDBG_PWRITEV_RMW_HEAD); ret = bdrv_aligned_preadv(bs, req, offset & ~(align - 1), align, align, &local_qiov, 0); if (ret < 0) { goto fail; } bdrv_debug_event(bs, BLKDBG_PWRITEV_RMW_AFTER_HEAD); memset(buf + head_padding_bytes, 0, zero_bytes); ret = bdrv_aligned_pwritev(bs, req, offset & ~(align - 1), align, align, &local_qiov, flags & ~BDRV_REQ_ZERO_WRITE); if (ret < 0) { goto fail; } offset += zero_bytes; bytes -= zero_bytes; } assert(!bytes || (offset & (align - 1)) == 0); if (bytes >= align) { /* Write the aligned part in the middle. */ uint64_t aligned_bytes = bytes & ~(align - 1); ret = bdrv_aligned_pwritev(bs, req, offset, aligned_bytes, align, NULL, flags); if (ret < 0) { goto fail; } bytes -= aligned_bytes; offset += aligned_bytes; } assert(!bytes || (offset & (align - 1)) == 0); if (bytes) { assert(align == tail_padding_bytes + bytes); /* RMW the unaligned part after tail. */ mark_request_serialising(req, align); wait_serialising_requests(req); bdrv_debug_event(bs, BLKDBG_PWRITEV_RMW_TAIL); ret = bdrv_aligned_preadv(bs, req, offset, align, align, &local_qiov, 0); if (ret < 0) { goto fail; } bdrv_debug_event(bs, BLKDBG_PWRITEV_RMW_AFTER_TAIL); memset(buf, 0, bytes); ret = bdrv_aligned_pwritev(bs, req, offset, align, align, &local_qiov, flags & ~BDRV_REQ_ZERO_WRITE); } fail: qemu_vfree(buf); return ret; }
false
qemu
85c97ca7a10b93216bc95052e9dabe3a4bb8736a
static int coroutine_fn bdrv_co_do_zero_pwritev(BlockDriverState *bs, int64_t offset, unsigned int bytes, BdrvRequestFlags flags, BdrvTrackedRequest *req) { uint8_t *buf = NULL; QEMUIOVector local_qiov; struct iovec iov; uint64_t align = bs->bl.request_alignment; unsigned int head_padding_bytes, tail_padding_bytes; int ret = 0; head_padding_bytes = offset & (align - 1); tail_padding_bytes = align - ((offset + bytes) & (align - 1)); assert(flags & BDRV_REQ_ZERO_WRITE); if (head_padding_bytes || tail_padding_bytes) { buf = qemu_blockalign(bs, align); iov = (struct iovec) { .iov_base = buf, .iov_len = align, }; qemu_iovec_init_external(&local_qiov, &iov, 1); } if (head_padding_bytes) { uint64_t zero_bytes = MIN(bytes, align - head_padding_bytes); mark_request_serialising(req, align); wait_serialising_requests(req); bdrv_debug_event(bs, BLKDBG_PWRITEV_RMW_HEAD); ret = bdrv_aligned_preadv(bs, req, offset & ~(align - 1), align, align, &local_qiov, 0); if (ret < 0) { goto fail; } bdrv_debug_event(bs, BLKDBG_PWRITEV_RMW_AFTER_HEAD); memset(buf + head_padding_bytes, 0, zero_bytes); ret = bdrv_aligned_pwritev(bs, req, offset & ~(align - 1), align, align, &local_qiov, flags & ~BDRV_REQ_ZERO_WRITE); if (ret < 0) { goto fail; } offset += zero_bytes; bytes -= zero_bytes; } assert(!bytes || (offset & (align - 1)) == 0); if (bytes >= align) { uint64_t aligned_bytes = bytes & ~(align - 1); ret = bdrv_aligned_pwritev(bs, req, offset, aligned_bytes, align, NULL, flags); if (ret < 0) { goto fail; } bytes -= aligned_bytes; offset += aligned_bytes; } assert(!bytes || (offset & (align - 1)) == 0); if (bytes) { assert(align == tail_padding_bytes + bytes); mark_request_serialising(req, align); wait_serialising_requests(req); bdrv_debug_event(bs, BLKDBG_PWRITEV_RMW_TAIL); ret = bdrv_aligned_preadv(bs, req, offset, align, align, &local_qiov, 0); if (ret < 0) { goto fail; } bdrv_debug_event(bs, BLKDBG_PWRITEV_RMW_AFTER_TAIL); memset(buf, 0, bytes); ret = bdrv_aligned_pwritev(bs, req, offset, align, align, &local_qiov, flags & ~BDRV_REQ_ZERO_WRITE); } fail: qemu_vfree(buf); return ret; }
{ "code": [], "line_no": [] }
static int VAR_0 bdrv_co_do_zero_pwritev(BlockDriverState *bs, int64_t offset, unsigned int bytes, BdrvRequestFlags flags, BdrvTrackedRequest *req) { uint8_t *buf = NULL; QEMUIOVector local_qiov; struct iovec iov; uint64_t align = bs->bl.request_alignment; unsigned int head_padding_bytes, tail_padding_bytes; int ret = 0; head_padding_bytes = offset & (align - 1); tail_padding_bytes = align - ((offset + bytes) & (align - 1)); assert(flags & BDRV_REQ_ZERO_WRITE); if (head_padding_bytes || tail_padding_bytes) { buf = qemu_blockalign(bs, align); iov = (struct iovec) { .iov_base = buf, .iov_len = align, }; qemu_iovec_init_external(&local_qiov, &iov, 1); } if (head_padding_bytes) { uint64_t zero_bytes = MIN(bytes, align - head_padding_bytes); mark_request_serialising(req, align); wait_serialising_requests(req); bdrv_debug_event(bs, BLKDBG_PWRITEV_RMW_HEAD); ret = bdrv_aligned_preadv(bs, req, offset & ~(align - 1), align, align, &local_qiov, 0); if (ret < 0) { goto fail; } bdrv_debug_event(bs, BLKDBG_PWRITEV_RMW_AFTER_HEAD); memset(buf + head_padding_bytes, 0, zero_bytes); ret = bdrv_aligned_pwritev(bs, req, offset & ~(align - 1), align, align, &local_qiov, flags & ~BDRV_REQ_ZERO_WRITE); if (ret < 0) { goto fail; } offset += zero_bytes; bytes -= zero_bytes; } assert(!bytes || (offset & (align - 1)) == 0); if (bytes >= align) { uint64_t aligned_bytes = bytes & ~(align - 1); ret = bdrv_aligned_pwritev(bs, req, offset, aligned_bytes, align, NULL, flags); if (ret < 0) { goto fail; } bytes -= aligned_bytes; offset += aligned_bytes; } assert(!bytes || (offset & (align - 1)) == 0); if (bytes) { assert(align == tail_padding_bytes + bytes); mark_request_serialising(req, align); wait_serialising_requests(req); bdrv_debug_event(bs, BLKDBG_PWRITEV_RMW_TAIL); ret = bdrv_aligned_preadv(bs, req, offset, align, align, &local_qiov, 0); if (ret < 0) { goto fail; } bdrv_debug_event(bs, BLKDBG_PWRITEV_RMW_AFTER_TAIL); memset(buf, 0, bytes); ret = bdrv_aligned_pwritev(bs, req, offset, align, align, &local_qiov, flags & ~BDRV_REQ_ZERO_WRITE); } fail: qemu_vfree(buf); return ret; }
[ "static int VAR_0 bdrv_co_do_zero_pwritev(BlockDriverState *bs,\nint64_t offset,\nunsigned int bytes,\nBdrvRequestFlags flags,\nBdrvTrackedRequest *req)\n{", "uint8_t *buf = NULL;", "QEMUIOVector local_qiov;", "struct iovec iov;", "uint64_t align = bs->bl.request_alignment;", "unsigned int head_padding_bytes, tail_padding_bytes;", "int ret = 0;", "head_padding_bytes = offset & (align - 1);", "tail_padding_bytes = align - ((offset + bytes) & (align - 1));", "assert(flags & BDRV_REQ_ZERO_WRITE);", "if (head_padding_bytes || tail_padding_bytes) {", "buf = qemu_blockalign(bs, align);", "iov = (struct iovec) {", ".iov_base = buf,\n.iov_len = align,\n};", "qemu_iovec_init_external(&local_qiov, &iov, 1);", "}", "if (head_padding_bytes) {", "uint64_t zero_bytes = MIN(bytes, align - head_padding_bytes);", "mark_request_serialising(req, align);", "wait_serialising_requests(req);", "bdrv_debug_event(bs, BLKDBG_PWRITEV_RMW_HEAD);", "ret = bdrv_aligned_preadv(bs, req, offset & ~(align - 1), align,\nalign, &local_qiov, 0);", "if (ret < 0) {", "goto fail;", "}", "bdrv_debug_event(bs, BLKDBG_PWRITEV_RMW_AFTER_HEAD);", "memset(buf + head_padding_bytes, 0, zero_bytes);", "ret = bdrv_aligned_pwritev(bs, req, offset & ~(align - 1), align,\nalign, &local_qiov,\nflags & ~BDRV_REQ_ZERO_WRITE);", "if (ret < 0) {", "goto fail;", "}", "offset += zero_bytes;", "bytes -= zero_bytes;", "}", "assert(!bytes || (offset & (align - 1)) == 0);", "if (bytes >= align) {", "uint64_t aligned_bytes = bytes & ~(align - 1);", "ret = bdrv_aligned_pwritev(bs, req, offset, aligned_bytes, align,\nNULL, flags);", "if (ret < 0) {", "goto fail;", "}", "bytes -= aligned_bytes;", "offset += aligned_bytes;", "}", "assert(!bytes || (offset & (align - 1)) == 0);", "if (bytes) {", "assert(align == tail_padding_bytes + bytes);", "mark_request_serialising(req, align);", "wait_serialising_requests(req);", "bdrv_debug_event(bs, BLKDBG_PWRITEV_RMW_TAIL);", "ret = bdrv_aligned_preadv(bs, req, offset, align,\nalign, &local_qiov, 0);", "if (ret < 0) {", "goto fail;", "}", "bdrv_debug_event(bs, BLKDBG_PWRITEV_RMW_AFTER_TAIL);", "memset(buf, 0, bytes);", "ret = bdrv_aligned_pwritev(bs, req, offset, align, align,\n&local_qiov, flags & ~BDRV_REQ_ZERO_WRITE);", "}", "fail:\nqemu_vfree(buf);", "return ret;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43, 45, 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 61 ], [ 63 ], [ 65 ], [ 67, 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 83, 85, 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 103 ], [ 105 ], [ 109 ], [ 111, 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 129 ], [ 131 ], [ 133 ], [ 137 ], [ 139 ], [ 141 ], [ 143, 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 157 ], [ 159, 161 ], [ 163 ], [ 165, 167 ], [ 169 ], [ 173 ] ]
26,405
static void qemu_wait_io_event(CPUState *env) { while (!tcg_has_work()) qemu_cond_timedwait(env->halt_cond, &qemu_global_mutex, 1000); 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); qemu_wait_io_event_common(env); }
false
qemu
6cabe1f303b9d76458c00f00df7f477449a13b2f
static void qemu_wait_io_event(CPUState *env) { while (!tcg_has_work()) qemu_cond_timedwait(env->halt_cond, &qemu_global_mutex, 1000); qemu_mutex_unlock(&qemu_global_mutex); qemu_mutex_lock(&qemu_fair_mutex); qemu_mutex_unlock(&qemu_fair_mutex); qemu_mutex_lock(&qemu_global_mutex); qemu_wait_io_event_common(env); }
{ "code": [], "line_no": [] }
static void FUNC_0(CPUState *VAR_0) { while (!tcg_has_work()) qemu_cond_timedwait(VAR_0->halt_cond, &qemu_global_mutex, 1000); qemu_mutex_unlock(&qemu_global_mutex); qemu_mutex_lock(&qemu_fair_mutex); qemu_mutex_unlock(&qemu_fair_mutex); qemu_mutex_lock(&qemu_global_mutex); qemu_wait_io_event_common(VAR_0); }
[ "static void FUNC_0(CPUState *VAR_0)\n{", "while (!tcg_has_work())\nqemu_cond_timedwait(VAR_0->halt_cond, &qemu_global_mutex, 1000);", "qemu_mutex_unlock(&qemu_global_mutex);", "qemu_mutex_lock(&qemu_fair_mutex);", "qemu_mutex_unlock(&qemu_fair_mutex);", "qemu_mutex_lock(&qemu_global_mutex);", "qemu_wait_io_event_common(VAR_0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 11 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ] ]
26,406
void qemu_co_queue_init(CoQueue *queue) { QTAILQ_INIT(&queue->entries); /* This will be exposed to callers once there are multiple AioContexts */ queue->ctx = qemu_get_aio_context(); }
false
qemu
02ffb504485f0920cfc75a0982a602f824a9a4f4
void qemu_co_queue_init(CoQueue *queue) { QTAILQ_INIT(&queue->entries); queue->ctx = qemu_get_aio_context(); }
{ "code": [], "line_no": [] }
void FUNC_0(CoQueue *VAR_0) { QTAILQ_INIT(&VAR_0->entries); VAR_0->ctx = qemu_get_aio_context(); }
[ "void FUNC_0(CoQueue *VAR_0)\n{", "QTAILQ_INIT(&VAR_0->entries);", "VAR_0->ctx = qemu_get_aio_context();", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 11 ], [ 13 ] ]
26,407
int64_t timerlistgroup_deadline_ns(QEMUTimerListGroup *tlg) { int64_t deadline = -1; QEMUClockType type; bool play = replay_mode == REPLAY_MODE_PLAY; for (type = 0; type < QEMU_CLOCK_MAX; type++) { if (qemu_clock_use_for_deadline(type)) { if (!play || type == QEMU_CLOCK_REALTIME) { deadline = qemu_soonest_timeout(deadline, timerlist_deadline_ns(tlg->tl[type])); } else { /* Read clock from the replay file and do not calculate the deadline, based on virtual clock. */ qemu_clock_get_ns(type); } } } return deadline; }
false
qemu
c2b38b277a7882a592f4f2ec955084b2b756daaa
int64_t timerlistgroup_deadline_ns(QEMUTimerListGroup *tlg) { int64_t deadline = -1; QEMUClockType type; bool play = replay_mode == REPLAY_MODE_PLAY; for (type = 0; type < QEMU_CLOCK_MAX; type++) { if (qemu_clock_use_for_deadline(type)) { if (!play || type == QEMU_CLOCK_REALTIME) { deadline = qemu_soonest_timeout(deadline, timerlist_deadline_ns(tlg->tl[type])); } else { qemu_clock_get_ns(type); } } } return deadline; }
{ "code": [], "line_no": [] }
int64_t FUNC_0(QEMUTimerListGroup *tlg) { int64_t deadline = -1; QEMUClockType type; bool play = replay_mode == REPLAY_MODE_PLAY; for (type = 0; type < QEMU_CLOCK_MAX; type++) { if (qemu_clock_use_for_deadline(type)) { if (!play || type == QEMU_CLOCK_REALTIME) { deadline = qemu_soonest_timeout(deadline, timerlist_deadline_ns(tlg->tl[type])); } else { qemu_clock_get_ns(type); } } } return deadline; }
[ "int64_t FUNC_0(QEMUTimerListGroup *tlg)\n{", "int64_t deadline = -1;", "QEMUClockType type;", "bool play = replay_mode == REPLAY_MODE_PLAY;", "for (type = 0; type < QEMU_CLOCK_MAX; type++) {", "if (qemu_clock_use_for_deadline(type)) {", "if (!play || type == QEMU_CLOCK_REALTIME) {", "deadline = qemu_soonest_timeout(deadline,\ntimerlist_deadline_ns(tlg->tl[type]));", "} else {", "qemu_clock_get_ns(type);", "}", "}", "}", "return deadline;", "}" ]
[ 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 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ] ]
26,408
static void socket_connect_data_free(socket_connect_data *c) { qapi_free_SocketAddressLegacy(c->saddr); g_free(c->model); g_free(c->name); g_free(c); }
false
qemu
bd269ebc82fbaa5fe7ce5bc7c1770ac8acecd884
static void socket_connect_data_free(socket_connect_data *c) { qapi_free_SocketAddressLegacy(c->saddr); g_free(c->model); g_free(c->name); g_free(c); }
{ "code": [], "line_no": [] }
static void FUNC_0(socket_connect_data *VAR_0) { qapi_free_SocketAddressLegacy(VAR_0->saddr); g_free(VAR_0->model); g_free(VAR_0->name); g_free(VAR_0); }
[ "static void FUNC_0(socket_connect_data *VAR_0)\n{", "qapi_free_SocketAddressLegacy(VAR_0->saddr);", "g_free(VAR_0->model);", "g_free(VAR_0->name);", "g_free(VAR_0);", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ] ]
26,409
static int blk_connect(struct XenDevice *xendev) { struct XenBlkDev *blkdev = container_of(xendev, struct XenBlkDev, xendev); int pers, index, qflags; bool readonly = true; /* read-only ? */ if (blkdev->directiosafe) { qflags = BDRV_O_NOCACHE | BDRV_O_NATIVE_AIO; } else { qflags = BDRV_O_CACHE_WB; } if (strcmp(blkdev->mode, "w") == 0) { qflags |= BDRV_O_RDWR; readonly = false; } /* init qemu block driver */ index = (blkdev->xendev.dev - 202 * 256) / 16; blkdev->dinfo = drive_get(IF_XEN, 0, index); if (!blkdev->dinfo) { /* setup via xenbus -> create new block driver instance */ xen_be_printf(&blkdev->xendev, 2, "create new bdrv (xenbus setup)\n"); blkdev->bs = bdrv_new(blkdev->dev); if (blkdev->bs) { Error *local_err = NULL; BlockDriver *drv = bdrv_find_whitelisted_format(blkdev->fileproto, readonly); if (bdrv_open(&blkdev->bs, blkdev->filename, NULL, NULL, qflags, drv, &local_err) != 0) { xen_be_printf(&blkdev->xendev, 0, "error: %s\n", error_get_pretty(local_err)); error_free(local_err); bdrv_unref(blkdev->bs); blkdev->bs = NULL; } } if (!blkdev->bs) { return -1; } } else { /* setup via qemu cmdline -> already setup for us */ xen_be_printf(&blkdev->xendev, 2, "get configured bdrv (cmdline setup)\n"); blkdev->bs = blkdev->dinfo->bdrv; if (bdrv_is_read_only(blkdev->bs) && !readonly) { xen_be_printf(&blkdev->xendev, 0, "Unexpected read-only drive"); blkdev->bs = NULL; return -1; } /* blkdev->bs is not create by us, we get a reference * so we can bdrv_unref() unconditionally */ bdrv_ref(blkdev->bs); } bdrv_attach_dev_nofail(blkdev->bs, blkdev); blkdev->file_size = bdrv_getlength(blkdev->bs); if (blkdev->file_size < 0) { xen_be_printf(&blkdev->xendev, 1, "bdrv_getlength: %d (%s) | drv %s\n", (int)blkdev->file_size, strerror(-blkdev->file_size), bdrv_get_format_name(blkdev->bs) ?: "-"); blkdev->file_size = 0; } xen_be_printf(xendev, 1, "type \"%s\", fileproto \"%s\", filename \"%s\"," " size %" PRId64 " (%" PRId64 " MB)\n", blkdev->type, blkdev->fileproto, blkdev->filename, blkdev->file_size, blkdev->file_size >> 20); /* Fill in number of sector size and number of sectors */ xenstore_write_be_int(&blkdev->xendev, "sector-size", blkdev->file_blk); xenstore_write_be_int64(&blkdev->xendev, "sectors", blkdev->file_size / blkdev->file_blk); if (xenstore_read_fe_int(&blkdev->xendev, "ring-ref", &blkdev->ring_ref) == -1) { return -1; } if (xenstore_read_fe_int(&blkdev->xendev, "event-channel", &blkdev->xendev.remote_port) == -1) { return -1; } if (xenstore_read_fe_int(&blkdev->xendev, "feature-persistent", &pers)) { blkdev->feature_persistent = FALSE; } else { blkdev->feature_persistent = !!pers; } blkdev->protocol = BLKIF_PROTOCOL_NATIVE; if (blkdev->xendev.protocol) { if (strcmp(blkdev->xendev.protocol, XEN_IO_PROTO_ABI_X86_32) == 0) { blkdev->protocol = BLKIF_PROTOCOL_X86_32; } if (strcmp(blkdev->xendev.protocol, XEN_IO_PROTO_ABI_X86_64) == 0) { blkdev->protocol = BLKIF_PROTOCOL_X86_64; } } blkdev->sring = xc_gnttab_map_grant_ref(blkdev->xendev.gnttabdev, blkdev->xendev.dom, blkdev->ring_ref, PROT_READ | PROT_WRITE); if (!blkdev->sring) { return -1; } blkdev->cnt_map++; switch (blkdev->protocol) { case BLKIF_PROTOCOL_NATIVE: { blkif_sring_t *sring_native = blkdev->sring; BACK_RING_INIT(&blkdev->rings.native, sring_native, XC_PAGE_SIZE); break; } case BLKIF_PROTOCOL_X86_32: { blkif_x86_32_sring_t *sring_x86_32 = blkdev->sring; BACK_RING_INIT(&blkdev->rings.x86_32_part, sring_x86_32, XC_PAGE_SIZE); break; } case BLKIF_PROTOCOL_X86_64: { blkif_x86_64_sring_t *sring_x86_64 = blkdev->sring; BACK_RING_INIT(&blkdev->rings.x86_64_part, sring_x86_64, XC_PAGE_SIZE); break; } } if (blkdev->feature_persistent) { /* Init persistent grants */ blkdev->max_grants = max_requests * BLKIF_MAX_SEGMENTS_PER_REQUEST; blkdev->persistent_gnts = g_tree_new_full((GCompareDataFunc)int_cmp, NULL, NULL, (GDestroyNotify)destroy_grant); blkdev->persistent_gnt_count = 0; } xen_be_bind_evtchn(&blkdev->xendev); xen_be_printf(&blkdev->xendev, 1, "ok: proto %s, ring-ref %d, " "remote port %d, local port %d\n", blkdev->xendev.protocol, blkdev->ring_ref, blkdev->xendev.remote_port, blkdev->xendev.local_port); return 0; }
false
qemu
98522f63f40adaebc412481e1d2e9170160d4539
static int blk_connect(struct XenDevice *xendev) { struct XenBlkDev *blkdev = container_of(xendev, struct XenBlkDev, xendev); int pers, index, qflags; bool readonly = true; if (blkdev->directiosafe) { qflags = BDRV_O_NOCACHE | BDRV_O_NATIVE_AIO; } else { qflags = BDRV_O_CACHE_WB; } if (strcmp(blkdev->mode, "w") == 0) { qflags |= BDRV_O_RDWR; readonly = false; } index = (blkdev->xendev.dev - 202 * 256) / 16; blkdev->dinfo = drive_get(IF_XEN, 0, index); if (!blkdev->dinfo) { xen_be_printf(&blkdev->xendev, 2, "create new bdrv (xenbus setup)\n"); blkdev->bs = bdrv_new(blkdev->dev); if (blkdev->bs) { Error *local_err = NULL; BlockDriver *drv = bdrv_find_whitelisted_format(blkdev->fileproto, readonly); if (bdrv_open(&blkdev->bs, blkdev->filename, NULL, NULL, qflags, drv, &local_err) != 0) { xen_be_printf(&blkdev->xendev, 0, "error: %s\n", error_get_pretty(local_err)); error_free(local_err); bdrv_unref(blkdev->bs); blkdev->bs = NULL; } } if (!blkdev->bs) { return -1; } } else { xen_be_printf(&blkdev->xendev, 2, "get configured bdrv (cmdline setup)\n"); blkdev->bs = blkdev->dinfo->bdrv; if (bdrv_is_read_only(blkdev->bs) && !readonly) { xen_be_printf(&blkdev->xendev, 0, "Unexpected read-only drive"); blkdev->bs = NULL; return -1; } bdrv_ref(blkdev->bs); } bdrv_attach_dev_nofail(blkdev->bs, blkdev); blkdev->file_size = bdrv_getlength(blkdev->bs); if (blkdev->file_size < 0) { xen_be_printf(&blkdev->xendev, 1, "bdrv_getlength: %d (%s) | drv %s\n", (int)blkdev->file_size, strerror(-blkdev->file_size), bdrv_get_format_name(blkdev->bs) ?: "-"); blkdev->file_size = 0; } xen_be_printf(xendev, 1, "type \"%s\", fileproto \"%s\", filename \"%s\"," " size %" PRId64 " (%" PRId64 " MB)\n", blkdev->type, blkdev->fileproto, blkdev->filename, blkdev->file_size, blkdev->file_size >> 20); xenstore_write_be_int(&blkdev->xendev, "sector-size", blkdev->file_blk); xenstore_write_be_int64(&blkdev->xendev, "sectors", blkdev->file_size / blkdev->file_blk); if (xenstore_read_fe_int(&blkdev->xendev, "ring-ref", &blkdev->ring_ref) == -1) { return -1; } if (xenstore_read_fe_int(&blkdev->xendev, "event-channel", &blkdev->xendev.remote_port) == -1) { return -1; } if (xenstore_read_fe_int(&blkdev->xendev, "feature-persistent", &pers)) { blkdev->feature_persistent = FALSE; } else { blkdev->feature_persistent = !!pers; } blkdev->protocol = BLKIF_PROTOCOL_NATIVE; if (blkdev->xendev.protocol) { if (strcmp(blkdev->xendev.protocol, XEN_IO_PROTO_ABI_X86_32) == 0) { blkdev->protocol = BLKIF_PROTOCOL_X86_32; } if (strcmp(blkdev->xendev.protocol, XEN_IO_PROTO_ABI_X86_64) == 0) { blkdev->protocol = BLKIF_PROTOCOL_X86_64; } } blkdev->sring = xc_gnttab_map_grant_ref(blkdev->xendev.gnttabdev, blkdev->xendev.dom, blkdev->ring_ref, PROT_READ | PROT_WRITE); if (!blkdev->sring) { return -1; } blkdev->cnt_map++; switch (blkdev->protocol) { case BLKIF_PROTOCOL_NATIVE: { blkif_sring_t *sring_native = blkdev->sring; BACK_RING_INIT(&blkdev->rings.native, sring_native, XC_PAGE_SIZE); break; } case BLKIF_PROTOCOL_X86_32: { blkif_x86_32_sring_t *sring_x86_32 = blkdev->sring; BACK_RING_INIT(&blkdev->rings.x86_32_part, sring_x86_32, XC_PAGE_SIZE); break; } case BLKIF_PROTOCOL_X86_64: { blkif_x86_64_sring_t *sring_x86_64 = blkdev->sring; BACK_RING_INIT(&blkdev->rings.x86_64_part, sring_x86_64, XC_PAGE_SIZE); break; } } if (blkdev->feature_persistent) { blkdev->max_grants = max_requests * BLKIF_MAX_SEGMENTS_PER_REQUEST; blkdev->persistent_gnts = g_tree_new_full((GCompareDataFunc)int_cmp, NULL, NULL, (GDestroyNotify)destroy_grant); blkdev->persistent_gnt_count = 0; } xen_be_bind_evtchn(&blkdev->xendev); xen_be_printf(&blkdev->xendev, 1, "ok: proto %s, ring-ref %d, " "remote port %d, local port %d\n", blkdev->xendev.protocol, blkdev->ring_ref, blkdev->xendev.remote_port, blkdev->xendev.local_port); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(struct XenDevice *VAR_0) { struct XenBlkDev *VAR_1 = container_of(VAR_0, struct XenBlkDev, VAR_0); int VAR_2, VAR_3, VAR_4; bool readonly = true; if (VAR_1->directiosafe) { VAR_4 = BDRV_O_NOCACHE | BDRV_O_NATIVE_AIO; } else { VAR_4 = BDRV_O_CACHE_WB; } if (strcmp(VAR_1->mode, "w") == 0) { VAR_4 |= BDRV_O_RDWR; readonly = false; } VAR_3 = (VAR_1->VAR_0.dev - 202 * 256) / 16; VAR_1->dinfo = drive_get(IF_XEN, 0, VAR_3); if (!VAR_1->dinfo) { xen_be_printf(&VAR_1->VAR_0, 2, "create new bdrv (xenbus setup)\n"); VAR_1->bs = bdrv_new(VAR_1->dev); if (VAR_1->bs) { Error *local_err = NULL; BlockDriver *drv = bdrv_find_whitelisted_format(VAR_1->fileproto, readonly); if (bdrv_open(&VAR_1->bs, VAR_1->filename, NULL, NULL, VAR_4, drv, &local_err) != 0) { xen_be_printf(&VAR_1->VAR_0, 0, "error: %s\n", error_get_pretty(local_err)); error_free(local_err); bdrv_unref(VAR_1->bs); VAR_1->bs = NULL; } } if (!VAR_1->bs) { return -1; } } else { xen_be_printf(&VAR_1->VAR_0, 2, "get configured bdrv (cmdline setup)\n"); VAR_1->bs = VAR_1->dinfo->bdrv; if (bdrv_is_read_only(VAR_1->bs) && !readonly) { xen_be_printf(&VAR_1->VAR_0, 0, "Unexpected read-only drive"); VAR_1->bs = NULL; return -1; } bdrv_ref(VAR_1->bs); } bdrv_attach_dev_nofail(VAR_1->bs, VAR_1); VAR_1->file_size = bdrv_getlength(VAR_1->bs); if (VAR_1->file_size < 0) { xen_be_printf(&VAR_1->VAR_0, 1, "bdrv_getlength: %d (%s) | drv %s\n", (int)VAR_1->file_size, strerror(-VAR_1->file_size), bdrv_get_format_name(VAR_1->bs) ?: "-"); VAR_1->file_size = 0; } xen_be_printf(VAR_0, 1, "type \"%s\", fileproto \"%s\", filename \"%s\"," " size %" PRId64 " (%" PRId64 " MB)\n", VAR_1->type, VAR_1->fileproto, VAR_1->filename, VAR_1->file_size, VAR_1->file_size >> 20); xenstore_write_be_int(&VAR_1->VAR_0, "sector-size", VAR_1->file_blk); xenstore_write_be_int64(&VAR_1->VAR_0, "sectors", VAR_1->file_size / VAR_1->file_blk); if (xenstore_read_fe_int(&VAR_1->VAR_0, "ring-ref", &VAR_1->ring_ref) == -1) { return -1; } if (xenstore_read_fe_int(&VAR_1->VAR_0, "event-channel", &VAR_1->VAR_0.remote_port) == -1) { return -1; } if (xenstore_read_fe_int(&VAR_1->VAR_0, "feature-persistent", &VAR_2)) { VAR_1->feature_persistent = FALSE; } else { VAR_1->feature_persistent = !!VAR_2; } VAR_1->protocol = BLKIF_PROTOCOL_NATIVE; if (VAR_1->VAR_0.protocol) { if (strcmp(VAR_1->VAR_0.protocol, XEN_IO_PROTO_ABI_X86_32) == 0) { VAR_1->protocol = BLKIF_PROTOCOL_X86_32; } if (strcmp(VAR_1->VAR_0.protocol, XEN_IO_PROTO_ABI_X86_64) == 0) { VAR_1->protocol = BLKIF_PROTOCOL_X86_64; } } VAR_1->sring = xc_gnttab_map_grant_ref(VAR_1->VAR_0.gnttabdev, VAR_1->VAR_0.dom, VAR_1->ring_ref, PROT_READ | PROT_WRITE); if (!VAR_1->sring) { return -1; } VAR_1->cnt_map++; switch (VAR_1->protocol) { case BLKIF_PROTOCOL_NATIVE: { blkif_sring_t *sring_native = VAR_1->sring; BACK_RING_INIT(&VAR_1->rings.native, sring_native, XC_PAGE_SIZE); break; } case BLKIF_PROTOCOL_X86_32: { blkif_x86_32_sring_t *sring_x86_32 = VAR_1->sring; BACK_RING_INIT(&VAR_1->rings.x86_32_part, sring_x86_32, XC_PAGE_SIZE); break; } case BLKIF_PROTOCOL_X86_64: { blkif_x86_64_sring_t *sring_x86_64 = VAR_1->sring; BACK_RING_INIT(&VAR_1->rings.x86_64_part, sring_x86_64, XC_PAGE_SIZE); break; } } if (VAR_1->feature_persistent) { VAR_1->max_grants = max_requests * BLKIF_MAX_SEGMENTS_PER_REQUEST; VAR_1->persistent_gnts = g_tree_new_full((GCompareDataFunc)int_cmp, NULL, NULL, (GDestroyNotify)destroy_grant); VAR_1->persistent_gnt_count = 0; } xen_be_bind_evtchn(&VAR_1->VAR_0); xen_be_printf(&VAR_1->VAR_0, 1, "ok: proto %s, ring-ref %d, " "remote port %d, local port %d\n", VAR_1->VAR_0.protocol, VAR_1->ring_ref, VAR_1->VAR_0.remote_port, VAR_1->VAR_0.local_port); return 0; }
[ "static int FUNC_0(struct XenDevice *VAR_0)\n{", "struct XenBlkDev *VAR_1 = container_of(VAR_0, struct XenBlkDev, VAR_0);", "int VAR_2, VAR_3, VAR_4;", "bool readonly = true;", "if (VAR_1->directiosafe) {", "VAR_4 = BDRV_O_NOCACHE | BDRV_O_NATIVE_AIO;", "} else {", "VAR_4 = BDRV_O_CACHE_WB;", "}", "if (strcmp(VAR_1->mode, \"w\") == 0) {", "VAR_4 |= BDRV_O_RDWR;", "readonly = false;", "}", "VAR_3 = (VAR_1->VAR_0.dev - 202 * 256) / 16;", "VAR_1->dinfo = drive_get(IF_XEN, 0, VAR_3);", "if (!VAR_1->dinfo) {", "xen_be_printf(&VAR_1->VAR_0, 2, \"create new bdrv (xenbus setup)\\n\");", "VAR_1->bs = bdrv_new(VAR_1->dev);", "if (VAR_1->bs) {", "Error *local_err = NULL;", "BlockDriver *drv = bdrv_find_whitelisted_format(VAR_1->fileproto,\nreadonly);", "if (bdrv_open(&VAR_1->bs, VAR_1->filename, NULL, NULL, VAR_4,\ndrv, &local_err) != 0)\n{", "xen_be_printf(&VAR_1->VAR_0, 0, \"error: %s\\n\",\nerror_get_pretty(local_err));", "error_free(local_err);", "bdrv_unref(VAR_1->bs);", "VAR_1->bs = NULL;", "}", "}", "if (!VAR_1->bs) {", "return -1;", "}", "} else {", "xen_be_printf(&VAR_1->VAR_0, 2, \"get configured bdrv (cmdline setup)\\n\");", "VAR_1->bs = VAR_1->dinfo->bdrv;", "if (bdrv_is_read_only(VAR_1->bs) && !readonly) {", "xen_be_printf(&VAR_1->VAR_0, 0, \"Unexpected read-only drive\");", "VAR_1->bs = NULL;", "return -1;", "}", "bdrv_ref(VAR_1->bs);", "}", "bdrv_attach_dev_nofail(VAR_1->bs, VAR_1);", "VAR_1->file_size = bdrv_getlength(VAR_1->bs);", "if (VAR_1->file_size < 0) {", "xen_be_printf(&VAR_1->VAR_0, 1, \"bdrv_getlength: %d (%s) | drv %s\\n\",\n(int)VAR_1->file_size, strerror(-VAR_1->file_size),\nbdrv_get_format_name(VAR_1->bs) ?: \"-\");", "VAR_1->file_size = 0;", "}", "xen_be_printf(VAR_0, 1, \"type \\\"%s\\\", fileproto \\\"%s\\\", filename \\\"%s\\\",\"\n\" size %\" PRId64 \" (%\" PRId64 \" MB)\\n\",\nVAR_1->type, VAR_1->fileproto, VAR_1->filename,\nVAR_1->file_size, VAR_1->file_size >> 20);", "xenstore_write_be_int(&VAR_1->VAR_0, \"sector-size\", VAR_1->file_blk);", "xenstore_write_be_int64(&VAR_1->VAR_0, \"sectors\",\nVAR_1->file_size / VAR_1->file_blk);", "if (xenstore_read_fe_int(&VAR_1->VAR_0, \"ring-ref\", &VAR_1->ring_ref) == -1) {", "return -1;", "}", "if (xenstore_read_fe_int(&VAR_1->VAR_0, \"event-channel\",\n&VAR_1->VAR_0.remote_port) == -1) {", "return -1;", "}", "if (xenstore_read_fe_int(&VAR_1->VAR_0, \"feature-persistent\", &VAR_2)) {", "VAR_1->feature_persistent = FALSE;", "} else {", "VAR_1->feature_persistent = !!VAR_2;", "}", "VAR_1->protocol = BLKIF_PROTOCOL_NATIVE;", "if (VAR_1->VAR_0.protocol) {", "if (strcmp(VAR_1->VAR_0.protocol, XEN_IO_PROTO_ABI_X86_32) == 0) {", "VAR_1->protocol = BLKIF_PROTOCOL_X86_32;", "}", "if (strcmp(VAR_1->VAR_0.protocol, XEN_IO_PROTO_ABI_X86_64) == 0) {", "VAR_1->protocol = BLKIF_PROTOCOL_X86_64;", "}", "}", "VAR_1->sring = xc_gnttab_map_grant_ref(VAR_1->VAR_0.gnttabdev,\nVAR_1->VAR_0.dom,\nVAR_1->ring_ref,\nPROT_READ | PROT_WRITE);", "if (!VAR_1->sring) {", "return -1;", "}", "VAR_1->cnt_map++;", "switch (VAR_1->protocol) {", "case BLKIF_PROTOCOL_NATIVE:\n{", "blkif_sring_t *sring_native = VAR_1->sring;", "BACK_RING_INIT(&VAR_1->rings.native, sring_native, XC_PAGE_SIZE);", "break;", "}", "case BLKIF_PROTOCOL_X86_32:\n{", "blkif_x86_32_sring_t *sring_x86_32 = VAR_1->sring;", "BACK_RING_INIT(&VAR_1->rings.x86_32_part, sring_x86_32, XC_PAGE_SIZE);", "break;", "}", "case BLKIF_PROTOCOL_X86_64:\n{", "blkif_x86_64_sring_t *sring_x86_64 = VAR_1->sring;", "BACK_RING_INIT(&VAR_1->rings.x86_64_part, sring_x86_64, XC_PAGE_SIZE);", "break;", "}", "}", "if (VAR_1->feature_persistent) {", "VAR_1->max_grants = max_requests * BLKIF_MAX_SEGMENTS_PER_REQUEST;", "VAR_1->persistent_gnts = g_tree_new_full((GCompareDataFunc)int_cmp,\nNULL, NULL,\n(GDestroyNotify)destroy_grant);", "VAR_1->persistent_gnt_count = 0;", "}", "xen_be_bind_evtchn(&VAR_1->VAR_0);", "xen_be_printf(&VAR_1->VAR_0, 1, \"ok: proto %s, ring-ref %d, \"\n\"remote port %d, local port %d\\n\",\nVAR_1->VAR_0.protocol, VAR_1->ring_ref,\nVAR_1->VAR_0.remote_port, VAR_1->VAR_0.local_port);", "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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53, 55 ], [ 57, 59, 61 ], [ 63, 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115, 117, 119 ], [ 121 ], [ 123 ], [ 127, 129, 131, 133 ], [ 139 ], [ 141, 143 ], [ 147 ], [ 149 ], [ 151 ], [ 153, 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 193, 195, 197, 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 211 ], [ 213, 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225, 227 ], [ 229 ], [ 233 ], [ 235 ], [ 237 ], [ 239, 241 ], [ 243 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 257 ], [ 261 ], [ 263, 265, 267 ], [ 269 ], [ 271 ], [ 275 ], [ 279, 281, 283, 285 ], [ 287 ], [ 289 ] ]
26,410
static uint64_t qemu_rdma_poll(RDMAContext *rdma, uint64_t *wr_id_out) { int ret; struct ibv_wc wc; uint64_t wr_id; ret = ibv_poll_cq(rdma->cq, 1, &wc); if (!ret) { *wr_id_out = RDMA_WRID_NONE; return 0; } if (ret < 0) { fprintf(stderr, "ibv_poll_cq return %d!\n", ret); return ret; } wr_id = wc.wr_id & RDMA_WRID_TYPE_MASK; if (wc.status != IBV_WC_SUCCESS) { fprintf(stderr, "ibv_poll_cq wc.status=%d %s!\n", wc.status, ibv_wc_status_str(wc.status)); fprintf(stderr, "ibv_poll_cq wrid=%s!\n", wrid_desc[wr_id]); return -1; } if (rdma->control_ready_expected && (wr_id >= RDMA_WRID_RECV_CONTROL)) { DDDPRINTF("completion %s #%" PRId64 " received (%" PRId64 ")" " left %d\n", wrid_desc[RDMA_WRID_RECV_CONTROL], wr_id - RDMA_WRID_RECV_CONTROL, wr_id, rdma->nb_sent); rdma->control_ready_expected = 0; } if (wr_id == RDMA_WRID_RDMA_WRITE) { uint64_t chunk = (wc.wr_id & RDMA_WRID_CHUNK_MASK) >> RDMA_WRID_CHUNK_SHIFT; uint64_t index = (wc.wr_id & RDMA_WRID_BLOCK_MASK) >> RDMA_WRID_BLOCK_SHIFT; RDMALocalBlock *block = &(rdma->local_ram_blocks.block[index]); DDDPRINTF("completions %s (%" PRId64 ") left %d, " "block %" PRIu64 ", chunk: %" PRIu64 " %p %p\n", print_wrid(wr_id), wr_id, rdma->nb_sent, index, chunk, block->local_host_addr, (void *)block->remote_host_addr); clear_bit(chunk, block->transit_bitmap); if (rdma->nb_sent > 0) { rdma->nb_sent--; } if (!rdma->pin_all) { /* * FYI: If one wanted to signal a specific chunk to be unregistered * using LRU or workload-specific information, this is the function * you would call to do so. That chunk would then get asynchronously * unregistered later. */ #ifdef RDMA_UNREGISTRATION_EXAMPLE qemu_rdma_signal_unregister(rdma, index, chunk, wc.wr_id); #endif } } else { DDDPRINTF("other completion %s (%" PRId64 ") received left %d\n", print_wrid(wr_id), wr_id, rdma->nb_sent); } *wr_id_out = wc.wr_id; return 0; }
false
qemu
88571882516a7cb4291a329c537eb79fd126e1f2
static uint64_t qemu_rdma_poll(RDMAContext *rdma, uint64_t *wr_id_out) { int ret; struct ibv_wc wc; uint64_t wr_id; ret = ibv_poll_cq(rdma->cq, 1, &wc); if (!ret) { *wr_id_out = RDMA_WRID_NONE; return 0; } if (ret < 0) { fprintf(stderr, "ibv_poll_cq return %d!\n", ret); return ret; } wr_id = wc.wr_id & RDMA_WRID_TYPE_MASK; if (wc.status != IBV_WC_SUCCESS) { fprintf(stderr, "ibv_poll_cq wc.status=%d %s!\n", wc.status, ibv_wc_status_str(wc.status)); fprintf(stderr, "ibv_poll_cq wrid=%s!\n", wrid_desc[wr_id]); return -1; } if (rdma->control_ready_expected && (wr_id >= RDMA_WRID_RECV_CONTROL)) { DDDPRINTF("completion %s #%" PRId64 " received (%" PRId64 ")" " left %d\n", wrid_desc[RDMA_WRID_RECV_CONTROL], wr_id - RDMA_WRID_RECV_CONTROL, wr_id, rdma->nb_sent); rdma->control_ready_expected = 0; } if (wr_id == RDMA_WRID_RDMA_WRITE) { uint64_t chunk = (wc.wr_id & RDMA_WRID_CHUNK_MASK) >> RDMA_WRID_CHUNK_SHIFT; uint64_t index = (wc.wr_id & RDMA_WRID_BLOCK_MASK) >> RDMA_WRID_BLOCK_SHIFT; RDMALocalBlock *block = &(rdma->local_ram_blocks.block[index]); DDDPRINTF("completions %s (%" PRId64 ") left %d, " "block %" PRIu64 ", chunk: %" PRIu64 " %p %p\n", print_wrid(wr_id), wr_id, rdma->nb_sent, index, chunk, block->local_host_addr, (void *)block->remote_host_addr); clear_bit(chunk, block->transit_bitmap); if (rdma->nb_sent > 0) { rdma->nb_sent--; } if (!rdma->pin_all) { #ifdef RDMA_UNREGISTRATION_EXAMPLE qemu_rdma_signal_unregister(rdma, index, chunk, wc.wr_id); #endif } } else { DDDPRINTF("other completion %s (%" PRId64 ") received left %d\n", print_wrid(wr_id), wr_id, rdma->nb_sent); } *wr_id_out = wc.wr_id; return 0; }
{ "code": [], "line_no": [] }
static uint64_t FUNC_0(RDMAContext *rdma, uint64_t *wr_id_out) { int VAR_0; struct ibv_wc VAR_1; uint64_t wr_id; VAR_0 = ibv_poll_cq(rdma->cq, 1, &VAR_1); if (!VAR_0) { *wr_id_out = RDMA_WRID_NONE; return 0; } if (VAR_0 < 0) { fprintf(stderr, "ibv_poll_cq return %d!\n", VAR_0); return VAR_0; } wr_id = VAR_1.wr_id & RDMA_WRID_TYPE_MASK; if (VAR_1.status != IBV_WC_SUCCESS) { fprintf(stderr, "ibv_poll_cq VAR_1.status=%d %s!\n", VAR_1.status, ibv_wc_status_str(VAR_1.status)); fprintf(stderr, "ibv_poll_cq wrid=%s!\n", wrid_desc[wr_id]); return -1; } if (rdma->control_ready_expected && (wr_id >= RDMA_WRID_RECV_CONTROL)) { DDDPRINTF("completion %s #%" PRId64 " received (%" PRId64 ")" " left %d\n", wrid_desc[RDMA_WRID_RECV_CONTROL], wr_id - RDMA_WRID_RECV_CONTROL, wr_id, rdma->nb_sent); rdma->control_ready_expected = 0; } if (wr_id == RDMA_WRID_RDMA_WRITE) { uint64_t chunk = (VAR_1.wr_id & RDMA_WRID_CHUNK_MASK) >> RDMA_WRID_CHUNK_SHIFT; uint64_t index = (VAR_1.wr_id & RDMA_WRID_BLOCK_MASK) >> RDMA_WRID_BLOCK_SHIFT; RDMALocalBlock *block = &(rdma->local_ram_blocks.block[index]); DDDPRINTF("completions %s (%" PRId64 ") left %d, " "block %" PRIu64 ", chunk: %" PRIu64 " %p %p\n", print_wrid(wr_id), wr_id, rdma->nb_sent, index, chunk, block->local_host_addr, (void *)block->remote_host_addr); clear_bit(chunk, block->transit_bitmap); if (rdma->nb_sent > 0) { rdma->nb_sent--; } if (!rdma->pin_all) { #ifdef RDMA_UNREGISTRATION_EXAMPLE qemu_rdma_signal_unregister(rdma, index, chunk, VAR_1.wr_id); #endif } } else { DDDPRINTF("other completion %s (%" PRId64 ") received left %d\n", print_wrid(wr_id), wr_id, rdma->nb_sent); } *wr_id_out = VAR_1.wr_id; return 0; }
[ "static uint64_t FUNC_0(RDMAContext *rdma, uint64_t *wr_id_out)\n{", "int VAR_0;", "struct ibv_wc VAR_1;", "uint64_t wr_id;", "VAR_0 = ibv_poll_cq(rdma->cq, 1, &VAR_1);", "if (!VAR_0) {", "*wr_id_out = RDMA_WRID_NONE;", "return 0;", "}", "if (VAR_0 < 0) {", "fprintf(stderr, \"ibv_poll_cq return %d!\\n\", VAR_0);", "return VAR_0;", "}", "wr_id = VAR_1.wr_id & RDMA_WRID_TYPE_MASK;", "if (VAR_1.status != IBV_WC_SUCCESS) {", "fprintf(stderr, \"ibv_poll_cq VAR_1.status=%d %s!\\n\",\nVAR_1.status, ibv_wc_status_str(VAR_1.status));", "fprintf(stderr, \"ibv_poll_cq wrid=%s!\\n\", wrid_desc[wr_id]);", "return -1;", "}", "if (rdma->control_ready_expected &&\n(wr_id >= RDMA_WRID_RECV_CONTROL)) {", "DDDPRINTF(\"completion %s #%\" PRId64 \" received (%\" PRId64 \")\"\n\" left %d\\n\", wrid_desc[RDMA_WRID_RECV_CONTROL],\nwr_id - RDMA_WRID_RECV_CONTROL, wr_id, rdma->nb_sent);", "rdma->control_ready_expected = 0;", "}", "if (wr_id == RDMA_WRID_RDMA_WRITE) {", "uint64_t chunk =\n(VAR_1.wr_id & RDMA_WRID_CHUNK_MASK) >> RDMA_WRID_CHUNK_SHIFT;", "uint64_t index =\n(VAR_1.wr_id & RDMA_WRID_BLOCK_MASK) >> RDMA_WRID_BLOCK_SHIFT;", "RDMALocalBlock *block = &(rdma->local_ram_blocks.block[index]);", "DDDPRINTF(\"completions %s (%\" PRId64 \") left %d, \"\n\"block %\" PRIu64 \", chunk: %\" PRIu64 \" %p %p\\n\",\nprint_wrid(wr_id), wr_id, rdma->nb_sent, index, chunk,\nblock->local_host_addr, (void *)block->remote_host_addr);", "clear_bit(chunk, block->transit_bitmap);", "if (rdma->nb_sent > 0) {", "rdma->nb_sent--;", "}", "if (!rdma->pin_all) {", "#ifdef RDMA_UNREGISTRATION_EXAMPLE\nqemu_rdma_signal_unregister(rdma, index, chunk, VAR_1.wr_id);", "#endif\n}", "} else {", "DDDPRINTF(\"other completion %s (%\" PRId64 \") received left %d\\n\",\nprint_wrid(wr_id), wr_id, rdma->nb_sent);", "}", "*wr_id_out = VAR_1.wr_id;", "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 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 51 ], [ 53 ], [ 57, 59 ], [ 61, 63, 65 ], [ 67 ], [ 69 ], [ 73 ], [ 75, 77 ], [ 79, 81 ], [ 83 ], [ 87, 89, 91, 93 ], [ 97 ], [ 101 ], [ 103 ], [ 105 ], [ 109 ], [ 123, 125 ], [ 127, 129 ], [ 131 ], [ 133, 135 ], [ 137 ], [ 141 ], [ 145 ], [ 147 ] ]
26,411
build_rsdt(GArray *table_data, BIOSLinker *linker, GArray *table_offsets, const char *oem_id, const char *oem_table_id) { AcpiRsdtDescriptorRev1 *rsdt; size_t rsdt_len; int i; const int table_data_len = (sizeof(uint32_t) * table_offsets->len); rsdt_len = sizeof(*rsdt) + table_data_len; rsdt = acpi_data_push(table_data, rsdt_len); memcpy(rsdt->table_offset_entry, table_offsets->data, table_data_len); for (i = 0; i < table_offsets->len; ++i) { /* rsdt->table_offset_entry to be filled by Guest linker */ bios_linker_loader_add_pointer(linker, ACPI_BUILD_TABLE_FILE, ACPI_BUILD_TABLE_FILE, &rsdt->table_offset_entry[i], sizeof(uint32_t)); } build_header(linker, table_data, (void *)rsdt, "RSDT", rsdt_len, 1, oem_id, oem_table_id); }
false
qemu
4678124bb9bfb49e93b83f95c4d2feeb443ea38b
build_rsdt(GArray *table_data, BIOSLinker *linker, GArray *table_offsets, const char *oem_id, const char *oem_table_id) { AcpiRsdtDescriptorRev1 *rsdt; size_t rsdt_len; int i; const int table_data_len = (sizeof(uint32_t) * table_offsets->len); rsdt_len = sizeof(*rsdt) + table_data_len; rsdt = acpi_data_push(table_data, rsdt_len); memcpy(rsdt->table_offset_entry, table_offsets->data, table_data_len); for (i = 0; i < table_offsets->len; ++i) { bios_linker_loader_add_pointer(linker, ACPI_BUILD_TABLE_FILE, ACPI_BUILD_TABLE_FILE, &rsdt->table_offset_entry[i], sizeof(uint32_t)); } build_header(linker, table_data, (void *)rsdt, "RSDT", rsdt_len, 1, oem_id, oem_table_id); }
{ "code": [], "line_no": [] }
FUNC_0(GArray *VAR_0, BIOSLinker *VAR_1, GArray *VAR_2, const char *VAR_3, const char *VAR_4) { AcpiRsdtDescriptorRev1 *rsdt; size_t rsdt_len; int VAR_5; const int VAR_6 = (sizeof(uint32_t) * VAR_2->len); rsdt_len = sizeof(*rsdt) + VAR_6; rsdt = acpi_data_push(VAR_0, rsdt_len); memcpy(rsdt->table_offset_entry, VAR_2->data, VAR_6); for (VAR_5 = 0; VAR_5 < VAR_2->len; ++VAR_5) { bios_linker_loader_add_pointer(VAR_1, ACPI_BUILD_TABLE_FILE, ACPI_BUILD_TABLE_FILE, &rsdt->table_offset_entry[VAR_5], sizeof(uint32_t)); } build_header(VAR_1, VAR_0, (void *)rsdt, "RSDT", rsdt_len, 1, VAR_3, VAR_4); }
[ "FUNC_0(GArray *VAR_0, BIOSLinker *VAR_1, GArray *VAR_2,\nconst char *VAR_3, const char *VAR_4)\n{", "AcpiRsdtDescriptorRev1 *rsdt;", "size_t rsdt_len;", "int VAR_5;", "const int VAR_6 = (sizeof(uint32_t) * VAR_2->len);", "rsdt_len = sizeof(*rsdt) + VAR_6;", "rsdt = acpi_data_push(VAR_0, rsdt_len);", "memcpy(rsdt->table_offset_entry, VAR_2->data, VAR_6);", "for (VAR_5 = 0; VAR_5 < VAR_2->len; ++VAR_5) {", "bios_linker_loader_add_pointer(VAR_1,\nACPI_BUILD_TABLE_FILE,\nACPI_BUILD_TABLE_FILE,\n&rsdt->table_offset_entry[VAR_5],\nsizeof(uint32_t));", "}", "build_header(VAR_1, VAR_0,\n(void *)rsdt, \"RSDT\", rsdt_len, 1, VAR_3, VAR_4);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27, 29, 31, 33, 35 ], [ 37 ], [ 39, 41 ], [ 43 ] ]
26,412
static av_cold int Faac_encode_close(AVCodecContext *avctx) { FaacAudioContext *s = avctx->priv_data; av_freep(&avctx->coded_frame); av_freep(&avctx->extradata); faacEncClose(s->faac_handle); return 0; }
false
FFmpeg
7a8cbb39f6154fb091597d28deba8d3bec38df64
static av_cold int Faac_encode_close(AVCodecContext *avctx) { FaacAudioContext *s = avctx->priv_data; av_freep(&avctx->coded_frame); av_freep(&avctx->extradata); faacEncClose(s->faac_handle); return 0; }
{ "code": [], "line_no": [] }
static av_cold int FUNC_0(AVCodecContext *avctx) { FaacAudioContext *s = avctx->priv_data; av_freep(&avctx->coded_frame); av_freep(&avctx->extradata); faacEncClose(s->faac_handle); return 0; }
[ "static av_cold int FUNC_0(AVCodecContext *avctx)\n{", "FaacAudioContext *s = avctx->priv_data;", "av_freep(&avctx->coded_frame);", "av_freep(&avctx->extradata);", "faacEncClose(s->faac_handle);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ] ]
26,413
static int object_create(QemuOpts *opts, void *opaque) { const char *type = qemu_opt_get(opts, "qom-type"); const char *id = qemu_opts_id(opts); Object *obj; g_assert(type != NULL); if (id == NULL) { qerror_report(QERR_MISSING_PARAMETER, "id"); return -1; } obj = object_new(type); if (qemu_opt_foreach(opts, object_set_property, obj, 1) < 0) { return -1; } object_property_add_child(container_get(object_get_root(), "/objects"), id, obj, NULL); return 0; }
true
qemu
28ec2598ff7d74bd9556a1786f45fc5df2aacfe1
static int object_create(QemuOpts *opts, void *opaque) { const char *type = qemu_opt_get(opts, "qom-type"); const char *id = qemu_opts_id(opts); Object *obj; g_assert(type != NULL); if (id == NULL) { qerror_report(QERR_MISSING_PARAMETER, "id"); return -1; } obj = object_new(type); if (qemu_opt_foreach(opts, object_set_property, obj, 1) < 0) { return -1; } object_property_add_child(container_get(object_get_root(), "/objects"), id, obj, NULL); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(QemuOpts *VAR_0, void *VAR_1) { const char *VAR_2 = qemu_opt_get(VAR_0, "qom-VAR_2"); const char *VAR_3 = qemu_opts_id(VAR_0); Object *obj; g_assert(VAR_2 != NULL); if (VAR_3 == NULL) { qerror_report(QERR_MISSING_PARAMETER, "VAR_3"); return -1; } obj = object_new(VAR_2); if (qemu_opt_foreach(VAR_0, object_set_property, obj, 1) < 0) { return -1; } object_property_add_child(container_get(object_get_root(), "/objects"), VAR_3, obj, NULL); return 0; }
[ "static int FUNC_0(QemuOpts *VAR_0, void *VAR_1)\n{", "const char *VAR_2 = qemu_opt_get(VAR_0, \"qom-VAR_2\");", "const char *VAR_3 = qemu_opts_id(VAR_0);", "Object *obj;", "g_assert(VAR_2 != NULL);", "if (VAR_3 == NULL) {", "qerror_report(QERR_MISSING_PARAMETER, \"VAR_3\");", "return -1;", "}", "obj = object_new(VAR_2);", "if (qemu_opt_foreach(VAR_0, object_set_property, obj, 1) < 0) {", "return -1;", "}", "object_property_add_child(container_get(object_get_root(), \"/objects\"),\nVAR_3, obj, NULL);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37, 39 ], [ 43 ], [ 45 ] ]
26,415
void tpm_backend_cancel_cmd(TPMBackend *s) { TPMBackendClass *k = TPM_BACKEND_GET_CLASS(s); assert(k->cancel_cmd); k->cancel_cmd(s); }
true
qemu
ebca2df783a5a742bb93784524336d8cbb9e662b
void tpm_backend_cancel_cmd(TPMBackend *s) { TPMBackendClass *k = TPM_BACKEND_GET_CLASS(s); assert(k->cancel_cmd); k->cancel_cmd(s); }
{ "code": [ " assert(k->cancel_cmd);" ], "line_no": [ 9 ] }
void FUNC_0(TPMBackend *VAR_0) { TPMBackendClass *k = TPM_BACKEND_GET_CLASS(VAR_0); assert(k->cancel_cmd); k->cancel_cmd(VAR_0); }
[ "void FUNC_0(TPMBackend *VAR_0)\n{", "TPMBackendClass *k = TPM_BACKEND_GET_CLASS(VAR_0);", "assert(k->cancel_cmd);", "k->cancel_cmd(VAR_0);", "}" ]
[ 0, 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 13 ], [ 15 ] ]
26,416
void scsi_bus_legacy_handle_cmdline(SCSIBus *bus) { DriveInfo *dinfo; int unit; for (unit = 0; unit < MAX_SCSI_DEVS; unit++) { dinfo = drive_get(IF_SCSI, bus->busnr, unit); if (dinfo == NULL) { continue; } scsi_bus_legacy_add_drive(bus, dinfo, unit); } }
true
qemu
fa66b909f382619da15f8c7e323145adfa94fdac
void scsi_bus_legacy_handle_cmdline(SCSIBus *bus) { DriveInfo *dinfo; int unit; for (unit = 0; unit < MAX_SCSI_DEVS; unit++) { dinfo = drive_get(IF_SCSI, bus->busnr, unit); if (dinfo == NULL) { continue; } scsi_bus_legacy_add_drive(bus, dinfo, unit); } }
{ "code": [ "void scsi_bus_legacy_handle_cmdline(SCSIBus *bus)", " int unit;", " scsi_bus_legacy_add_drive(bus, dinfo, unit);" ], "line_no": [ 1, 7, 21 ] }
void FUNC_0(SCSIBus *VAR_0) { DriveInfo *dinfo; int VAR_1; for (VAR_1 = 0; VAR_1 < MAX_SCSI_DEVS; VAR_1++) { dinfo = drive_get(IF_SCSI, VAR_0->busnr, VAR_1); if (dinfo == NULL) { continue; } scsi_bus_legacy_add_drive(VAR_0, dinfo, VAR_1); } }
[ "void FUNC_0(SCSIBus *VAR_0)\n{", "DriveInfo *dinfo;", "int VAR_1;", "for (VAR_1 = 0; VAR_1 < MAX_SCSI_DEVS; VAR_1++) {", "dinfo = drive_get(IF_SCSI, VAR_0->busnr, VAR_1);", "if (dinfo == NULL) {", "continue;", "}", "scsi_bus_legacy_add_drive(VAR_0, dinfo, VAR_1);", "}", "}" ]
[ 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ] ]
26,417
AVD3D11VAContext *av_d3d11va_alloc_context(void) { AVD3D11VAContext* res = av_mallocz(sizeof(AVD3D11VAContext)); res->context_mutex = INVALID_HANDLE_VALUE; return res; }
true
FFmpeg
f3202871598f59b570b31b01cfeb64b8fedbd700
AVD3D11VAContext *av_d3d11va_alloc_context(void) { AVD3D11VAContext* res = av_mallocz(sizeof(AVD3D11VAContext)); res->context_mutex = INVALID_HANDLE_VALUE; return res; }
{ "code": [], "line_no": [] }
AVD3D11VAContext *FUNC_0(void) { AVD3D11VAContext* res = av_mallocz(sizeof(AVD3D11VAContext)); res->context_mutex = INVALID_HANDLE_VALUE; return res; }
[ "AVD3D11VAContext *FUNC_0(void)\n{", "AVD3D11VAContext* res = av_mallocz(sizeof(AVD3D11VAContext));", "res->context_mutex = INVALID_HANDLE_VALUE;", "return res;", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ] ]
26,418
static TCGv_i32 new_tmp(void) { num_temps++; return tcg_temp_new_i32(); }
true
qemu
7d1b0095bff7157e856d1d0e6c4295641ced2752
static TCGv_i32 new_tmp(void) { num_temps++; return tcg_temp_new_i32(); }
{ "code": [ "static TCGv_i32 new_tmp(void)", " num_temps++;", " return tcg_temp_new_i32();" ], "line_no": [ 1, 5, 7 ] }
static TCGv_i32 FUNC_0(void) { num_temps++; return tcg_temp_new_i32(); }
[ "static TCGv_i32 FUNC_0(void)\n{", "num_temps++;", "return tcg_temp_new_i32();", "}" ]
[ 1, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
26,419
static int cudaupload_query_formats(AVFilterContext *ctx) { int ret; static const enum AVPixelFormat input_pix_fmts[] = { AV_PIX_FMT_NV12, AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV444P, AV_PIX_FMT_NONE, }; static const enum AVPixelFormat output_pix_fmts[] = { AV_PIX_FMT_CUDA, AV_PIX_FMT_NONE, }; AVFilterFormats *in_fmts = ff_make_format_list(input_pix_fmts); AVFilterFormats *out_fmts = ff_make_format_list(output_pix_fmts); ret = ff_formats_ref(in_fmts, &ctx->inputs[0]->out_formats); if (ret < 0) return ret; ret = ff_formats_ref(out_fmts, &ctx->outputs[0]->in_formats); if (ret < 0) return ret; return 0; }
true
FFmpeg
7dafb3a25a580a5f8f1a5083835c67be9ed17043
static int cudaupload_query_formats(AVFilterContext *ctx) { int ret; static const enum AVPixelFormat input_pix_fmts[] = { AV_PIX_FMT_NV12, AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV444P, AV_PIX_FMT_NONE, }; static const enum AVPixelFormat output_pix_fmts[] = { AV_PIX_FMT_CUDA, AV_PIX_FMT_NONE, }; AVFilterFormats *in_fmts = ff_make_format_list(input_pix_fmts); AVFilterFormats *out_fmts = ff_make_format_list(output_pix_fmts); ret = ff_formats_ref(in_fmts, &ctx->inputs[0]->out_formats); if (ret < 0) return ret; ret = ff_formats_ref(out_fmts, &ctx->outputs[0]->in_formats); if (ret < 0) return ret; return 0; }
{ "code": [ " AVFilterFormats *out_fmts = ff_make_format_list(output_pix_fmts);" ], "line_no": [ 25 ] }
static int FUNC_0(AVFilterContext *VAR_0) { int VAR_1; static const enum AVPixelFormat VAR_2[] = { AV_PIX_FMT_NV12, AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV444P, AV_PIX_FMT_NONE, }; static const enum AVPixelFormat VAR_3[] = { AV_PIX_FMT_CUDA, AV_PIX_FMT_NONE, }; AVFilterFormats *in_fmts = ff_make_format_list(VAR_2); AVFilterFormats *out_fmts = ff_make_format_list(VAR_3); VAR_1 = ff_formats_ref(in_fmts, &VAR_0->inputs[0]->out_formats); if (VAR_1 < 0) return VAR_1; VAR_1 = ff_formats_ref(out_fmts, &VAR_0->outputs[0]->in_formats); if (VAR_1 < 0) return VAR_1; return 0; }
[ "static int FUNC_0(AVFilterContext *VAR_0)\n{", "int VAR_1;", "static const enum AVPixelFormat VAR_2[] = {", "AV_PIX_FMT_NV12, AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV444P,\nAV_PIX_FMT_NONE,\n};", "static const enum AVPixelFormat VAR_3[] = {", "AV_PIX_FMT_CUDA, AV_PIX_FMT_NONE,\n};", "AVFilterFormats *in_fmts = ff_make_format_list(VAR_2);", "AVFilterFormats *out_fmts = ff_make_format_list(VAR_3);", "VAR_1 = ff_formats_ref(in_fmts, &VAR_0->inputs[0]->out_formats);", "if (VAR_1 < 0)\nreturn VAR_1;", "VAR_1 = ff_formats_ref(out_fmts, &VAR_0->outputs[0]->in_formats);", "if (VAR_1 < 0)\nreturn VAR_1;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11, 13, 15 ], [ 17 ], [ 19, 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31, 33 ], [ 37 ], [ 39, 41 ], [ 45 ], [ 47 ] ]
26,420
void ioinst_handle_ssch(S390CPU *cpu, uint64_t reg1, uint32_t ipb) { int cssid, ssid, schid, m; SubchDev *sch; ORB orig_orb, orb; uint64_t addr; int ret = -ENODEV; int cc; CPUS390XState *env = &cpu->env; uint8_t ar; addr = decode_basedisp_s(env, ipb, &ar); if (addr & 3) { program_interrupt(env, PGM_SPECIFICATION, 4); return; } if (s390_cpu_virt_mem_read(cpu, addr, ar, &orig_orb, sizeof(orb))) { return; } copy_orb_from_guest(&orb, &orig_orb); if (ioinst_disassemble_sch_ident(reg1, &m, &cssid, &ssid, &schid) || !ioinst_orb_valid(&orb)) { program_interrupt(env, PGM_OPERAND, 4); return; } trace_ioinst_sch_id("ssch", cssid, ssid, schid); sch = css_find_subch(m, cssid, ssid, schid); if (sch && css_subch_visible(sch)) { ret = css_do_ssch(sch, &orb); } switch (ret) { case -ENODEV: cc = 3; break; case -EBUSY: cc = 2; break; case -EFAULT: /* * TODO: * I'm wondering whether there is something better * to do for us here (like setting some device or * subchannel status). */ program_interrupt(env, PGM_ADDRESSING, 4); return; case 0: cc = 0; break; default: cc = 1; break; } setcc(cpu, cc); }
true
qemu
66dc50f7057b9a0191f54e55764412202306858d
void ioinst_handle_ssch(S390CPU *cpu, uint64_t reg1, uint32_t ipb) { int cssid, ssid, schid, m; SubchDev *sch; ORB orig_orb, orb; uint64_t addr; int ret = -ENODEV; int cc; CPUS390XState *env = &cpu->env; uint8_t ar; addr = decode_basedisp_s(env, ipb, &ar); if (addr & 3) { program_interrupt(env, PGM_SPECIFICATION, 4); return; } if (s390_cpu_virt_mem_read(cpu, addr, ar, &orig_orb, sizeof(orb))) { return; } copy_orb_from_guest(&orb, &orig_orb); if (ioinst_disassemble_sch_ident(reg1, &m, &cssid, &ssid, &schid) || !ioinst_orb_valid(&orb)) { program_interrupt(env, PGM_OPERAND, 4); return; } trace_ioinst_sch_id("ssch", cssid, ssid, schid); sch = css_find_subch(m, cssid, ssid, schid); if (sch && css_subch_visible(sch)) { ret = css_do_ssch(sch, &orb); } switch (ret) { case -ENODEV: cc = 3; break; case -EBUSY: cc = 2; break; case -EFAULT: program_interrupt(env, PGM_ADDRESSING, 4); return; case 0: cc = 0; break; default: cc = 1; break; } setcc(cpu, cc); }
{ "code": [ " switch (ret) {", " case 0:", " break;", " case -EBUSY:", " break;", " case -ENODEV:", " break;", " break;", " default:", " int ret = -ENODEV;", " int cc;", " if (sch && css_subch_visible(sch)) {", " ret = css_do_ssch(sch, &orb);", " switch (ret) {", " case -ENODEV:", " cc = 3;", " break;", " case -EBUSY:", " cc = 2;", " break;", " case -EFAULT:", " program_interrupt(env, PGM_ADDRESSING, 4);", " case 0:", " cc = 0;", " break;", " default:", " cc = 1;", " break;", " setcc(cpu, cc);", " int ret = -ENODEV;", " int cc;", " if (sch && css_subch_visible(sch)) {", " switch (ret) {", " case -ENODEV:", " cc = 3;", " break;", " cc = 2;", " break;", " case 0:", " cc = 0;", " break;", " default:", " cc = 1;", " break;", " setcc(cpu, cc);" ], "line_no": [ 61, 93, 67, 69, 67, 63, 67, 67, 99, 13, 15, 55, 57, 61, 63, 65, 67, 69, 71, 67, 75, 89, 93, 95, 67, 99, 101, 67, 107, 13, 15, 55, 61, 63, 65, 67, 71, 67, 93, 95, 67, 99, 101, 67, 107 ] }
void FUNC_0(S390CPU *VAR_0, uint64_t VAR_1, uint32_t VAR_2) { int VAR_3, VAR_4, VAR_5, VAR_6; SubchDev *sch; ORB orig_orb, orb; uint64_t addr; int VAR_7 = -ENODEV; int VAR_8; CPUS390XState *env = &VAR_0->env; uint8_t ar; addr = decode_basedisp_s(env, VAR_2, &ar); if (addr & 3) { program_interrupt(env, PGM_SPECIFICATION, 4); return; } if (s390_cpu_virt_mem_read(VAR_0, addr, ar, &orig_orb, sizeof(orb))) { return; } copy_orb_from_guest(&orb, &orig_orb); if (ioinst_disassemble_sch_ident(VAR_1, &VAR_6, &VAR_3, &VAR_4, &VAR_5) || !ioinst_orb_valid(&orb)) { program_interrupt(env, PGM_OPERAND, 4); return; } trace_ioinst_sch_id("ssch", VAR_3, VAR_4, VAR_5); sch = css_find_subch(VAR_6, VAR_3, VAR_4, VAR_5); if (sch && css_subch_visible(sch)) { VAR_7 = css_do_ssch(sch, &orb); } switch (VAR_7) { case -ENODEV: VAR_8 = 3; break; case -EBUSY: VAR_8 = 2; break; case -EFAULT: program_interrupt(env, PGM_ADDRESSING, 4); return; case 0: VAR_8 = 0; break; default: VAR_8 = 1; break; } setcc(VAR_0, VAR_8); }
[ "void FUNC_0(S390CPU *VAR_0, uint64_t VAR_1, uint32_t VAR_2)\n{", "int VAR_3, VAR_4, VAR_5, VAR_6;", "SubchDev *sch;", "ORB orig_orb, orb;", "uint64_t addr;", "int VAR_7 = -ENODEV;", "int VAR_8;", "CPUS390XState *env = &VAR_0->env;", "uint8_t ar;", "addr = decode_basedisp_s(env, VAR_2, &ar);", "if (addr & 3) {", "program_interrupt(env, PGM_SPECIFICATION, 4);", "return;", "}", "if (s390_cpu_virt_mem_read(VAR_0, addr, ar, &orig_orb, sizeof(orb))) {", "return;", "}", "copy_orb_from_guest(&orb, &orig_orb);", "if (ioinst_disassemble_sch_ident(VAR_1, &VAR_6, &VAR_3, &VAR_4, &VAR_5) ||\n!ioinst_orb_valid(&orb)) {", "program_interrupt(env, PGM_OPERAND, 4);", "return;", "}", "trace_ioinst_sch_id(\"ssch\", VAR_3, VAR_4, VAR_5);", "sch = css_find_subch(VAR_6, VAR_3, VAR_4, VAR_5);", "if (sch && css_subch_visible(sch)) {", "VAR_7 = css_do_ssch(sch, &orb);", "}", "switch (VAR_7) {", "case -ENODEV:\nVAR_8 = 3;", "break;", "case -EBUSY:\nVAR_8 = 2;", "break;", "case -EFAULT:\nprogram_interrupt(env, PGM_ADDRESSING, 4);", "return;", "case 0:\nVAR_8 = 0;", "break;", "default:\nVAR_8 = 1;", "break;", "}", "setcc(VAR_0, VAR_8);", "}" ]
[ 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41, 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63, 65 ], [ 67 ], [ 69, 71 ], [ 73 ], [ 75, 89 ], [ 91 ], [ 93, 95 ], [ 97 ], [ 99, 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ] ]
26,421
static int virtio_blk_device_init(VirtIODevice *vdev) { DeviceState *qdev = DEVICE(vdev); VirtIOBlock *s = VIRTIO_BLK(vdev); VirtIOBlkConf *blk = &(s->blk); static int virtio_blk_id; if (!blk->conf.bs) { error_report("drive property not set"); return -1; } if (!bdrv_is_inserted(blk->conf.bs)) { error_report("Device needs media, but drive is empty"); return -1; } blkconf_serial(&blk->conf, &blk->serial); if (blkconf_geometry(&blk->conf, NULL, 65535, 255, 255) < 0) { return -1; } virtio_init(vdev, "virtio-blk", VIRTIO_ID_BLOCK, sizeof(struct virtio_blk_config)); vdev->get_config = virtio_blk_update_config; vdev->set_config = virtio_blk_set_config; vdev->get_features = virtio_blk_get_features; vdev->set_status = virtio_blk_set_status; vdev->reset = virtio_blk_reset; s->bs = blk->conf.bs; s->conf = &blk->conf; memcpy(&(s->blk), blk, sizeof(struct VirtIOBlkConf)); s->rq = NULL; s->sector_mask = (s->conf->logical_block_size / BDRV_SECTOR_SIZE) - 1; s->vq = virtio_add_queue(vdev, 128, virtio_blk_handle_output); #ifdef CONFIG_VIRTIO_BLK_DATA_PLANE if (!virtio_blk_data_plane_create(vdev, blk, &s->dataplane)) { virtio_cleanup(vdev); return -1; } #endif s->change = qemu_add_vm_change_state_handler(virtio_blk_dma_restart_cb, s); register_savevm(qdev, "virtio-blk", virtio_blk_id++, 2, virtio_blk_save, virtio_blk_load, s); bdrv_set_dev_ops(s->bs, &virtio_block_ops, s); bdrv_set_buffer_alignment(s->bs, s->conf->logical_block_size); bdrv_iostatus_enable(s->bs); add_boot_device_path(s->conf->bootindex, qdev, "/disk@0,0"); return 0; }
true
qemu
a8e5cc0c076a6e3a62f0e9aad88b007dccf3dd17
static int virtio_blk_device_init(VirtIODevice *vdev) { DeviceState *qdev = DEVICE(vdev); VirtIOBlock *s = VIRTIO_BLK(vdev); VirtIOBlkConf *blk = &(s->blk); static int virtio_blk_id; if (!blk->conf.bs) { error_report("drive property not set"); return -1; } if (!bdrv_is_inserted(blk->conf.bs)) { error_report("Device needs media, but drive is empty"); return -1; } blkconf_serial(&blk->conf, &blk->serial); if (blkconf_geometry(&blk->conf, NULL, 65535, 255, 255) < 0) { return -1; } virtio_init(vdev, "virtio-blk", VIRTIO_ID_BLOCK, sizeof(struct virtio_blk_config)); vdev->get_config = virtio_blk_update_config; vdev->set_config = virtio_blk_set_config; vdev->get_features = virtio_blk_get_features; vdev->set_status = virtio_blk_set_status; vdev->reset = virtio_blk_reset; s->bs = blk->conf.bs; s->conf = &blk->conf; memcpy(&(s->blk), blk, sizeof(struct VirtIOBlkConf)); s->rq = NULL; s->sector_mask = (s->conf->logical_block_size / BDRV_SECTOR_SIZE) - 1; s->vq = virtio_add_queue(vdev, 128, virtio_blk_handle_output); #ifdef CONFIG_VIRTIO_BLK_DATA_PLANE if (!virtio_blk_data_plane_create(vdev, blk, &s->dataplane)) { virtio_cleanup(vdev); return -1; } #endif s->change = qemu_add_vm_change_state_handler(virtio_blk_dma_restart_cb, s); register_savevm(qdev, "virtio-blk", virtio_blk_id++, 2, virtio_blk_save, virtio_blk_load, s); bdrv_set_dev_ops(s->bs, &virtio_block_ops, s); bdrv_set_buffer_alignment(s->bs, s->conf->logical_block_size); bdrv_iostatus_enable(s->bs); add_boot_device_path(s->conf->bootindex, qdev, "/disk@0,0"); return 0; }
{ "code": [ " virtio_cleanup(vdev);" ], "line_no": [ 77 ] }
static int FUNC_0(VirtIODevice *VAR_0) { DeviceState *qdev = DEVICE(VAR_0); VirtIOBlock *s = VIRTIO_BLK(VAR_0); VirtIOBlkConf *blk = &(s->blk); static int VAR_1; if (!blk->conf.bs) { error_report("drive property not set"); return -1; } if (!bdrv_is_inserted(blk->conf.bs)) { error_report("Device needs media, but drive is empty"); return -1; } blkconf_serial(&blk->conf, &blk->serial); if (blkconf_geometry(&blk->conf, NULL, 65535, 255, 255) < 0) { return -1; } virtio_init(VAR_0, "virtio-blk", VIRTIO_ID_BLOCK, sizeof(struct virtio_blk_config)); VAR_0->get_config = virtio_blk_update_config; VAR_0->set_config = virtio_blk_set_config; VAR_0->get_features = virtio_blk_get_features; VAR_0->set_status = virtio_blk_set_status; VAR_0->reset = virtio_blk_reset; s->bs = blk->conf.bs; s->conf = &blk->conf; memcpy(&(s->blk), blk, sizeof(struct VirtIOBlkConf)); s->rq = NULL; s->sector_mask = (s->conf->logical_block_size / BDRV_SECTOR_SIZE) - 1; s->vq = virtio_add_queue(VAR_0, 128, virtio_blk_handle_output); #ifdef CONFIG_VIRTIO_BLK_DATA_PLANE if (!virtio_blk_data_plane_create(VAR_0, blk, &s->dataplane)) { virtio_cleanup(VAR_0); return -1; } #endif s->change = qemu_add_vm_change_state_handler(virtio_blk_dma_restart_cb, s); register_savevm(qdev, "virtio-blk", VAR_1++, 2, virtio_blk_save, virtio_blk_load, s); bdrv_set_dev_ops(s->bs, &virtio_block_ops, s); bdrv_set_buffer_alignment(s->bs, s->conf->logical_block_size); bdrv_iostatus_enable(s->bs); add_boot_device_path(s->conf->bootindex, qdev, "/disk@0,0"); return 0; }
[ "static int FUNC_0(VirtIODevice *VAR_0)\n{", "DeviceState *qdev = DEVICE(VAR_0);", "VirtIOBlock *s = VIRTIO_BLK(VAR_0);", "VirtIOBlkConf *blk = &(s->blk);", "static int VAR_1;", "if (!blk->conf.bs) {", "error_report(\"drive property not set\");", "return -1;", "}", "if (!bdrv_is_inserted(blk->conf.bs)) {", "error_report(\"Device needs media, but drive is empty\");", "return -1;", "}", "blkconf_serial(&blk->conf, &blk->serial);", "if (blkconf_geometry(&blk->conf, NULL, 65535, 255, 255) < 0) {", "return -1;", "}", "virtio_init(VAR_0, \"virtio-blk\", VIRTIO_ID_BLOCK,\nsizeof(struct virtio_blk_config));", "VAR_0->get_config = virtio_blk_update_config;", "VAR_0->set_config = virtio_blk_set_config;", "VAR_0->get_features = virtio_blk_get_features;", "VAR_0->set_status = virtio_blk_set_status;", "VAR_0->reset = virtio_blk_reset;", "s->bs = blk->conf.bs;", "s->conf = &blk->conf;", "memcpy(&(s->blk), blk, sizeof(struct VirtIOBlkConf));", "s->rq = NULL;", "s->sector_mask = (s->conf->logical_block_size / BDRV_SECTOR_SIZE) - 1;", "s->vq = virtio_add_queue(VAR_0, 128, virtio_blk_handle_output);", "#ifdef CONFIG_VIRTIO_BLK_DATA_PLANE\nif (!virtio_blk_data_plane_create(VAR_0, blk, &s->dataplane)) {", "virtio_cleanup(VAR_0);", "return -1;", "}", "#endif\ns->change = qemu_add_vm_change_state_handler(virtio_blk_dma_restart_cb, s);", "register_savevm(qdev, \"virtio-blk\", VAR_1++, 2,\nvirtio_blk_save, virtio_blk_load, s);", "bdrv_set_dev_ops(s->bs, &virtio_block_ops, s);", "bdrv_set_buffer_alignment(s->bs, s->conf->logical_block_size);", "bdrv_iostatus_enable(s->bs);", "add_boot_device_path(s->conf->bootindex, qdev, \"/disk@0,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, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43, 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73, 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83, 87 ], [ 89, 91 ], [ 93 ], [ 95 ], [ 99 ], [ 103 ], [ 105 ], [ 107 ] ]
26,422
static int encode_tile(Jpeg2000EncoderContext *s, Jpeg2000Tile *tile, int tileno) { int compno, reslevelno, bandno, ret; Jpeg2000T1Context t1; Jpeg2000CodingStyle *codsty = &s->codsty; for (compno = 0; compno < s->ncomponents; compno++){ Jpeg2000Component *comp = s->tile[tileno].comp + compno; av_log(s->avctx, AV_LOG_DEBUG,"dwt\n"); if ((ret = ff_dwt_encode(&comp->dwt, comp->i_data)) < 0) return ret; av_log(s->avctx, AV_LOG_DEBUG,"after dwt -> tier1\n"); for (reslevelno = 0; reslevelno < codsty->nreslevels; reslevelno++){ Jpeg2000ResLevel *reslevel = comp->reslevel + reslevelno; for (bandno = 0; bandno < reslevel->nbands ; bandno++){ Jpeg2000Band *band = reslevel->band + bandno; Jpeg2000Prec *prec = band->prec; // we support only 1 precinct per band ATM in the encoder int cblkx, cblky, cblkno=0, xx0, x0, xx1, y0, yy0, yy1, bandpos; yy0 = bandno == 0 ? 0 : comp->reslevel[reslevelno-1].coord[1][1] - comp->reslevel[reslevelno-1].coord[1][0]; y0 = yy0; yy1 = FFMIN(ff_jpeg2000_ceildivpow2(band->coord[1][0] + 1, band->log2_cblk_height) << band->log2_cblk_height, band->coord[1][1]) - band->coord[1][0] + yy0; if (band->coord[0][0] == band->coord[0][1] || band->coord[1][0] == band->coord[1][1]) continue; bandpos = bandno + (reslevelno > 0); for (cblky = 0; cblky < prec->nb_codeblocks_height; cblky++){ if (reslevelno == 0 || bandno == 1) xx0 = 0; else xx0 = comp->reslevel[reslevelno-1].coord[0][1] - comp->reslevel[reslevelno-1].coord[0][0]; x0 = xx0; xx1 = FFMIN(ff_jpeg2000_ceildivpow2(band->coord[0][0] + 1, band->log2_cblk_width) << band->log2_cblk_width, band->coord[0][1]) - band->coord[0][0] + xx0; for (cblkx = 0; cblkx < prec->nb_codeblocks_width; cblkx++, cblkno++){ int y, x; if (codsty->transform == FF_DWT53){ for (y = yy0; y < yy1; y++){ int *ptr = t1.data[y-yy0]; for (x = xx0; x < xx1; x++){ *ptr++ = comp->i_data[(comp->coord[0][1] - comp->coord[0][0]) * y + x] << NMSEDEC_FRACBITS; } } } else{ for (y = yy0; y < yy1; y++){ int *ptr = t1.data[y-yy0]; for (x = xx0; x < xx1; x++){ *ptr = (comp->i_data[(comp->coord[0][1] - comp->coord[0][0]) * y + x]); *ptr = (int64_t)*ptr * (int64_t)(16384 * 65536 / band->i_stepsize) >> 15 - NMSEDEC_FRACBITS; ptr++; } } } encode_cblk(s, &t1, prec->cblk + cblkno, tile, xx1 - xx0, yy1 - yy0, bandpos, codsty->nreslevels - reslevelno - 1); xx0 = xx1; xx1 = FFMIN(xx1 + (1 << band->log2_cblk_width), band->coord[0][1] - band->coord[0][0] + x0); } yy0 = yy1; yy1 = FFMIN(yy1 + (1 << band->log2_cblk_height), band->coord[1][1] - band->coord[1][0] + y0); } } } av_log(s->avctx, AV_LOG_DEBUG, "after tier1\n"); } av_log(s->avctx, AV_LOG_DEBUG, "rate control\n"); truncpasses(s, tile); if ((ret = encode_packets(s, tile, tileno)) < 0) return ret; av_log(s->avctx, AV_LOG_DEBUG, "after rate control\n"); return 0; }
false
FFmpeg
f1e173049ecc9de03817385ba8962d14cba779db
static int encode_tile(Jpeg2000EncoderContext *s, Jpeg2000Tile *tile, int tileno) { int compno, reslevelno, bandno, ret; Jpeg2000T1Context t1; Jpeg2000CodingStyle *codsty = &s->codsty; for (compno = 0; compno < s->ncomponents; compno++){ Jpeg2000Component *comp = s->tile[tileno].comp + compno; av_log(s->avctx, AV_LOG_DEBUG,"dwt\n"); if ((ret = ff_dwt_encode(&comp->dwt, comp->i_data)) < 0) return ret; av_log(s->avctx, AV_LOG_DEBUG,"after dwt -> tier1\n"); for (reslevelno = 0; reslevelno < codsty->nreslevels; reslevelno++){ Jpeg2000ResLevel *reslevel = comp->reslevel + reslevelno; for (bandno = 0; bandno < reslevel->nbands ; bandno++){ Jpeg2000Band *band = reslevel->band + bandno; Jpeg2000Prec *prec = band->prec; int cblkx, cblky, cblkno=0, xx0, x0, xx1, y0, yy0, yy1, bandpos; yy0 = bandno == 0 ? 0 : comp->reslevel[reslevelno-1].coord[1][1] - comp->reslevel[reslevelno-1].coord[1][0]; y0 = yy0; yy1 = FFMIN(ff_jpeg2000_ceildivpow2(band->coord[1][0] + 1, band->log2_cblk_height) << band->log2_cblk_height, band->coord[1][1]) - band->coord[1][0] + yy0; if (band->coord[0][0] == band->coord[0][1] || band->coord[1][0] == band->coord[1][1]) continue; bandpos = bandno + (reslevelno > 0); for (cblky = 0; cblky < prec->nb_codeblocks_height; cblky++){ if (reslevelno == 0 || bandno == 1) xx0 = 0; else xx0 = comp->reslevel[reslevelno-1].coord[0][1] - comp->reslevel[reslevelno-1].coord[0][0]; x0 = xx0; xx1 = FFMIN(ff_jpeg2000_ceildivpow2(band->coord[0][0] + 1, band->log2_cblk_width) << band->log2_cblk_width, band->coord[0][1]) - band->coord[0][0] + xx0; for (cblkx = 0; cblkx < prec->nb_codeblocks_width; cblkx++, cblkno++){ int y, x; if (codsty->transform == FF_DWT53){ for (y = yy0; y < yy1; y++){ int *ptr = t1.data[y-yy0]; for (x = xx0; x < xx1; x++){ *ptr++ = comp->i_data[(comp->coord[0][1] - comp->coord[0][0]) * y + x] << NMSEDEC_FRACBITS; } } } else{ for (y = yy0; y < yy1; y++){ int *ptr = t1.data[y-yy0]; for (x = xx0; x < xx1; x++){ *ptr = (comp->i_data[(comp->coord[0][1] - comp->coord[0][0]) * y + x]); *ptr = (int64_t)*ptr * (int64_t)(16384 * 65536 / band->i_stepsize) >> 15 - NMSEDEC_FRACBITS; ptr++; } } } encode_cblk(s, &t1, prec->cblk + cblkno, tile, xx1 - xx0, yy1 - yy0, bandpos, codsty->nreslevels - reslevelno - 1); xx0 = xx1; xx1 = FFMIN(xx1 + (1 << band->log2_cblk_width), band->coord[0][1] - band->coord[0][0] + x0); } yy0 = yy1; yy1 = FFMIN(yy1 + (1 << band->log2_cblk_height), band->coord[1][1] - band->coord[1][0] + y0); } } } av_log(s->avctx, AV_LOG_DEBUG, "after tier1\n"); } av_log(s->avctx, AV_LOG_DEBUG, "rate control\n"); truncpasses(s, tile); if ((ret = encode_packets(s, tile, tileno)) < 0) return ret; av_log(s->avctx, AV_LOG_DEBUG, "after rate control\n"); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(Jpeg2000EncoderContext *VAR_0, Jpeg2000Tile *VAR_1, int VAR_2) { int VAR_3, VAR_4, VAR_5, VAR_6; Jpeg2000T1Context t1; Jpeg2000CodingStyle *codsty = &VAR_0->codsty; for (VAR_3 = 0; VAR_3 < VAR_0->ncomponents; VAR_3++){ Jpeg2000Component *comp = VAR_0->VAR_1[VAR_2].comp + VAR_3; av_log(VAR_0->avctx, AV_LOG_DEBUG,"dwt\n"); if ((VAR_6 = ff_dwt_encode(&comp->dwt, comp->i_data)) < 0) return VAR_6; av_log(VAR_0->avctx, AV_LOG_DEBUG,"after dwt -> tier1\n"); for (VAR_4 = 0; VAR_4 < codsty->nreslevels; VAR_4++){ Jpeg2000ResLevel *reslevel = comp->reslevel + VAR_4; for (VAR_5 = 0; VAR_5 < reslevel->nbands ; VAR_5++){ Jpeg2000Band *band = reslevel->band + VAR_5; Jpeg2000Prec *prec = band->prec; int cblkx, cblky, cblkno=0, xx0, x0, xx1, y0, yy0, yy1, bandpos; yy0 = VAR_5 == 0 ? 0 : comp->reslevel[VAR_4-1].coord[1][1] - comp->reslevel[VAR_4-1].coord[1][0]; y0 = yy0; yy1 = FFMIN(ff_jpeg2000_ceildivpow2(band->coord[1][0] + 1, band->log2_cblk_height) << band->log2_cblk_height, band->coord[1][1]) - band->coord[1][0] + yy0; if (band->coord[0][0] == band->coord[0][1] || band->coord[1][0] == band->coord[1][1]) continue; bandpos = VAR_5 + (VAR_4 > 0); for (cblky = 0; cblky < prec->nb_codeblocks_height; cblky++){ if (VAR_4 == 0 || VAR_5 == 1) xx0 = 0; else xx0 = comp->reslevel[VAR_4-1].coord[0][1] - comp->reslevel[VAR_4-1].coord[0][0]; x0 = xx0; xx1 = FFMIN(ff_jpeg2000_ceildivpow2(band->coord[0][0] + 1, band->log2_cblk_width) << band->log2_cblk_width, band->coord[0][1]) - band->coord[0][0] + xx0; for (cblkx = 0; cblkx < prec->nb_codeblocks_width; cblkx++, cblkno++){ int y, x; if (codsty->transform == FF_DWT53){ for (y = yy0; y < yy1; y++){ int *ptr = t1.data[y-yy0]; for (x = xx0; x < xx1; x++){ *ptr++ = comp->i_data[(comp->coord[0][1] - comp->coord[0][0]) * y + x] << NMSEDEC_FRACBITS; } } } else{ for (y = yy0; y < yy1; y++){ int *ptr = t1.data[y-yy0]; for (x = xx0; x < xx1; x++){ *ptr = (comp->i_data[(comp->coord[0][1] - comp->coord[0][0]) * y + x]); *ptr = (int64_t)*ptr * (int64_t)(16384 * 65536 / band->i_stepsize) >> 15 - NMSEDEC_FRACBITS; ptr++; } } } encode_cblk(VAR_0, &t1, prec->cblk + cblkno, VAR_1, xx1 - xx0, yy1 - yy0, bandpos, codsty->nreslevels - VAR_4 - 1); xx0 = xx1; xx1 = FFMIN(xx1 + (1 << band->log2_cblk_width), band->coord[0][1] - band->coord[0][0] + x0); } yy0 = yy1; yy1 = FFMIN(yy1 + (1 << band->log2_cblk_height), band->coord[1][1] - band->coord[1][0] + y0); } } } av_log(VAR_0->avctx, AV_LOG_DEBUG, "after tier1\n"); } av_log(VAR_0->avctx, AV_LOG_DEBUG, "rate control\n"); truncpasses(VAR_0, VAR_1); if ((VAR_6 = encode_packets(VAR_0, VAR_1, VAR_2)) < 0) return VAR_6; av_log(VAR_0->avctx, AV_LOG_DEBUG, "after rate control\n"); return 0; }
[ "static int FUNC_0(Jpeg2000EncoderContext *VAR_0, Jpeg2000Tile *VAR_1, int VAR_2)\n{", "int VAR_3, VAR_4, VAR_5, VAR_6;", "Jpeg2000T1Context t1;", "Jpeg2000CodingStyle *codsty = &VAR_0->codsty;", "for (VAR_3 = 0; VAR_3 < VAR_0->ncomponents; VAR_3++){", "Jpeg2000Component *comp = VAR_0->VAR_1[VAR_2].comp + VAR_3;", "av_log(VAR_0->avctx, AV_LOG_DEBUG,\"dwt\\n\");", "if ((VAR_6 = ff_dwt_encode(&comp->dwt, comp->i_data)) < 0)\nreturn VAR_6;", "av_log(VAR_0->avctx, AV_LOG_DEBUG,\"after dwt -> tier1\\n\");", "for (VAR_4 = 0; VAR_4 < codsty->nreslevels; VAR_4++){", "Jpeg2000ResLevel *reslevel = comp->reslevel + VAR_4;", "for (VAR_5 = 0; VAR_5 < reslevel->nbands ; VAR_5++){", "Jpeg2000Band *band = reslevel->band + VAR_5;", "Jpeg2000Prec *prec = band->prec;", "int cblkx, cblky, cblkno=0, xx0, x0, xx1, y0, yy0, yy1, bandpos;", "yy0 = VAR_5 == 0 ? 0 : comp->reslevel[VAR_4-1].coord[1][1] - comp->reslevel[VAR_4-1].coord[1][0];", "y0 = yy0;", "yy1 = FFMIN(ff_jpeg2000_ceildivpow2(band->coord[1][0] + 1, band->log2_cblk_height) << band->log2_cblk_height,\nband->coord[1][1]) - band->coord[1][0] + yy0;", "if (band->coord[0][0] == band->coord[0][1] || band->coord[1][0] == band->coord[1][1])\ncontinue;", "bandpos = VAR_5 + (VAR_4 > 0);", "for (cblky = 0; cblky < prec->nb_codeblocks_height; cblky++){", "if (VAR_4 == 0 || VAR_5 == 1)\nxx0 = 0;", "else\nxx0 = comp->reslevel[VAR_4-1].coord[0][1] - comp->reslevel[VAR_4-1].coord[0][0];", "x0 = xx0;", "xx1 = FFMIN(ff_jpeg2000_ceildivpow2(band->coord[0][0] + 1, band->log2_cblk_width) << band->log2_cblk_width,\nband->coord[0][1]) - band->coord[0][0] + xx0;", "for (cblkx = 0; cblkx < prec->nb_codeblocks_width; cblkx++, cblkno++){", "int y, x;", "if (codsty->transform == FF_DWT53){", "for (y = yy0; y < yy1; y++){", "int *ptr = t1.data[y-yy0];", "for (x = xx0; x < xx1; x++){", "*ptr++ = comp->i_data[(comp->coord[0][1] - comp->coord[0][0]) * y + x] << NMSEDEC_FRACBITS;", "}", "}", "} else{", "for (y = yy0; y < yy1; y++){", "int *ptr = t1.data[y-yy0];", "for (x = xx0; x < xx1; x++){", "*ptr = (comp->i_data[(comp->coord[0][1] - comp->coord[0][0]) * y + x]);", "*ptr = (int64_t)*ptr * (int64_t)(16384 * 65536 / band->i_stepsize) >> 15 - NMSEDEC_FRACBITS;", "ptr++;", "}", "}", "}", "encode_cblk(VAR_0, &t1, prec->cblk + cblkno, VAR_1, xx1 - xx0, yy1 - yy0,\nbandpos, codsty->nreslevels - VAR_4 - 1);", "xx0 = xx1;", "xx1 = FFMIN(xx1 + (1 << band->log2_cblk_width), band->coord[0][1] - band->coord[0][0] + x0);", "}", "yy0 = yy1;", "yy1 = FFMIN(yy1 + (1 << band->log2_cblk_height), band->coord[1][1] - band->coord[1][0] + y0);", "}", "}", "}", "av_log(VAR_0->avctx, AV_LOG_DEBUG, \"after tier1\\n\");", "}", "av_log(VAR_0->avctx, AV_LOG_DEBUG, \"rate control\\n\");", "truncpasses(VAR_0, VAR_1);", "if ((VAR_6 = encode_packets(VAR_0, VAR_1, VAR_2)) < 0)\nreturn VAR_6;", "av_log(VAR_0->avctx, AV_LOG_DEBUG, \"after rate control\\n\");", "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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19, 21 ], [ 23 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45, 47 ], [ 51, 53 ], [ 57 ], [ 61 ], [ 63, 65 ], [ 67, 69 ], [ 71 ], [ 73, 75 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117, 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 143 ], [ 145 ], [ 147, 149 ], [ 151 ], [ 153 ], [ 155 ] ]
26,424
static void check_mct(uint8_t *ref0, uint8_t *ref1, uint8_t *ref2, uint8_t *new0, uint8_t *new1, uint8_t *new2) { declare_func(void, void *src0, void *src1, void *src2, int csize); randomize_buffers(); call_ref(ref0, ref1, ref2, BUF_SIZE / sizeof(int32_t)); call_new(new0, new1, new2, BUF_SIZE / sizeof(int32_t)); if (memcmp(ref0, new0, BUF_SIZE) || memcmp(ref1, new1, BUF_SIZE) || memcmp(ref2, new2, BUF_SIZE)) fail(); bench_new(new0, new1, new2, BUF_SIZE / sizeof(int32_t)); }
false
FFmpeg
20a93ea8d489304d5c522283d79ea5f9c8fdc804
static void check_mct(uint8_t *ref0, uint8_t *ref1, uint8_t *ref2, uint8_t *new0, uint8_t *new1, uint8_t *new2) { declare_func(void, void *src0, void *src1, void *src2, int csize); randomize_buffers(); call_ref(ref0, ref1, ref2, BUF_SIZE / sizeof(int32_t)); call_new(new0, new1, new2, BUF_SIZE / sizeof(int32_t)); if (memcmp(ref0, new0, BUF_SIZE) || memcmp(ref1, new1, BUF_SIZE) || memcmp(ref2, new2, BUF_SIZE)) fail(); bench_new(new0, new1, new2, BUF_SIZE / sizeof(int32_t)); }
{ "code": [], "line_no": [] }
static void FUNC_0(uint8_t *VAR_0, uint8_t *VAR_1, uint8_t *VAR_2, uint8_t *VAR_3, uint8_t *VAR_4, uint8_t *VAR_5) { declare_func(void, void *src0, void *src1, void *src2, int csize); randomize_buffers(); call_ref(VAR_0, VAR_1, VAR_2, BUF_SIZE / sizeof(int32_t)); call_new(VAR_3, VAR_4, VAR_5, BUF_SIZE / sizeof(int32_t)); if (memcmp(VAR_0, VAR_3, BUF_SIZE) || memcmp(VAR_1, VAR_4, BUF_SIZE) || memcmp(VAR_2, VAR_5, BUF_SIZE)) fail(); bench_new(VAR_3, VAR_4, VAR_5, BUF_SIZE / sizeof(int32_t)); }
[ "static void FUNC_0(uint8_t *VAR_0, uint8_t *VAR_1, uint8_t *VAR_2,\nuint8_t *VAR_3, uint8_t *VAR_4, uint8_t *VAR_5) {", "declare_func(void, void *src0, void *src1, void *src2, int csize);", "randomize_buffers();", "call_ref(VAR_0, VAR_1, VAR_2, BUF_SIZE / sizeof(int32_t));", "call_new(VAR_3, VAR_4, VAR_5, BUF_SIZE / sizeof(int32_t));", "if (memcmp(VAR_0, VAR_3, BUF_SIZE) || memcmp(VAR_1, VAR_4, BUF_SIZE) ||\nmemcmp(VAR_2, VAR_5, BUF_SIZE))\nfail();", "bench_new(VAR_3, VAR_4, VAR_5, BUF_SIZE / sizeof(int32_t));", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15, 17, 19 ], [ 21 ], [ 23 ] ]
26,425
int bdrv_flush_all(void) { BlockDriverState *bs; int result = 0; QTAILQ_FOREACH(bs, &bdrv_states, device_list) { int ret = bdrv_flush(bs); if (ret < 0 && !result) { result = ret; } } return result; }
true
qemu
ed78cda3de92056737364ab3cb748b16f5f17dea
int bdrv_flush_all(void) { BlockDriverState *bs; int result = 0; QTAILQ_FOREACH(bs, &bdrv_states, device_list) { int ret = bdrv_flush(bs); if (ret < 0 && !result) { result = ret; } } return result; }
{ "code": [ " int ret = bdrv_flush(bs);" ], "line_no": [ 13 ] }
int FUNC_0(void) { BlockDriverState *bs; int VAR_0 = 0; QTAILQ_FOREACH(bs, &bdrv_states, device_list) { int ret = bdrv_flush(bs); if (ret < 0 && !VAR_0) { VAR_0 = ret; } } return VAR_0; }
[ "int FUNC_0(void)\n{", "BlockDriverState *bs;", "int VAR_0 = 0;", "QTAILQ_FOREACH(bs, &bdrv_states, device_list) {", "int ret = bdrv_flush(bs);", "if (ret < 0 && !VAR_0) {", "VAR_0 = ret;", "}", "}", "return VAR_0;", "}" ]
[ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ] ]
26,427
static void FUNCC(ff_h264_add_pixels4)(uint8_t *_dst, int16_t *_src, int stride) { int i; pixel *dst = (pixel *) _dst; dctcoef *src = (dctcoef *) _src; stride /= sizeof(pixel); for (i = 0; i < 4; i++) { dst[0] += src[0]; dst[1] += src[1]; dst[2] += src[2]; dst[3] += src[3]; dst += stride; src += 4; } memset(_src, 0, sizeof(dctcoef) * 16); }
true
FFmpeg
d6945aeee419a8417b8019c7c92227e12e45b7ad
static void FUNCC(ff_h264_add_pixels4)(uint8_t *_dst, int16_t *_src, int stride) { int i; pixel *dst = (pixel *) _dst; dctcoef *src = (dctcoef *) _src; stride /= sizeof(pixel); for (i = 0; i < 4; i++) { dst[0] += src[0]; dst[1] += src[1]; dst[2] += src[2]; dst[3] += src[3]; dst += stride; src += 4; } memset(_src, 0, sizeof(dctcoef) * 16); }
{ "code": [ " dst[0] += src[0];", " dst[1] += src[1];", " dst[2] += src[2];", " dst[3] += src[3];", " dst[0] += src[0];", " dst[1] += src[1];", " dst[2] += src[2];", " dst[3] += src[3];" ], "line_no": [ 17, 19, 21, 23, 17, 19, 21, 23 ] }
static void FUNC_0(ff_h264_add_pixels4)(uint8_t *_dst, int16_t *_src, int stride) { int VAR_0; pixel *dst = (pixel *) _dst; dctcoef *src = (dctcoef *) _src; stride /= sizeof(pixel); for (VAR_0 = 0; VAR_0 < 4; VAR_0++) { dst[0] += src[0]; dst[1] += src[1]; dst[2] += src[2]; dst[3] += src[3]; dst += stride; src += 4; } memset(_src, 0, sizeof(dctcoef) * 16); }
[ "static void FUNC_0(ff_h264_add_pixels4)(uint8_t *_dst, int16_t *_src, int stride)\n{", "int VAR_0;", "pixel *dst = (pixel *) _dst;", "dctcoef *src = (dctcoef *) _src;", "stride /= sizeof(pixel);", "for (VAR_0 = 0; VAR_0 < 4; VAR_0++) {", "dst[0] += src[0];", "dst[1] += src[1];", "dst[2] += src[2];", "dst[3] += src[3];", "dst += stride;", "src += 4;", "}", "memset(_src, 0, sizeof(dctcoef) * 16);", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ] ]
26,429
static inline void downmix_2f_2r_to_mono(float *samples) { int i; for (i = 0; i < 256; i++) { samples[i] += (samples[i + 256] + samples[i + 512] + samples[i + 768]); samples[i + 256] = samples[i + 512] = samples[i + 768] = 0; } }
false
FFmpeg
0058584580b87feb47898e60e4b80c7f425882ad
static inline void downmix_2f_2r_to_mono(float *samples) { int i; for (i = 0; i < 256; i++) { samples[i] += (samples[i + 256] + samples[i + 512] + samples[i + 768]); samples[i + 256] = samples[i + 512] = samples[i + 768] = 0; } }
{ "code": [], "line_no": [] }
static inline void FUNC_0(float *VAR_0) { int VAR_1; for (VAR_1 = 0; VAR_1 < 256; VAR_1++) { VAR_0[VAR_1] += (VAR_0[VAR_1 + 256] + VAR_0[VAR_1 + 512] + VAR_0[VAR_1 + 768]); VAR_0[VAR_1 + 256] = VAR_0[VAR_1 + 512] = VAR_0[VAR_1 + 768] = 0; } }
[ "static inline void FUNC_0(float *VAR_0)\n{", "int VAR_1;", "for (VAR_1 = 0; VAR_1 < 256; VAR_1++) {", "VAR_0[VAR_1] += (VAR_0[VAR_1 + 256] + VAR_0[VAR_1 + 512] + VAR_0[VAR_1 + 768]);", "VAR_0[VAR_1 + 256] = VAR_0[VAR_1 + 512] = VAR_0[VAR_1 + 768] = 0;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ] ]
26,431
static inline void downmix_3f_1r_to_dolby(float *samples) { int i; for (i = 0; i < 256; i++) { samples[i] += (samples[i + 256] - samples[i + 768]); samples[i + 256] += (samples[i + 512] + samples[i + 768]); samples[i + 512] = samples[i + 768] = 0; } }
false
FFmpeg
0058584580b87feb47898e60e4b80c7f425882ad
static inline void downmix_3f_1r_to_dolby(float *samples) { int i; for (i = 0; i < 256; i++) { samples[i] += (samples[i + 256] - samples[i + 768]); samples[i + 256] += (samples[i + 512] + samples[i + 768]); samples[i + 512] = samples[i + 768] = 0; } }
{ "code": [], "line_no": [] }
static inline void FUNC_0(float *VAR_0) { int VAR_1; for (VAR_1 = 0; VAR_1 < 256; VAR_1++) { VAR_0[VAR_1] += (VAR_0[VAR_1 + 256] - VAR_0[VAR_1 + 768]); VAR_0[VAR_1 + 256] += (VAR_0[VAR_1 + 512] + VAR_0[VAR_1 + 768]); VAR_0[VAR_1 + 512] = VAR_0[VAR_1 + 768] = 0; } }
[ "static inline void FUNC_0(float *VAR_0)\n{", "int VAR_1;", "for (VAR_1 = 0; VAR_1 < 256; VAR_1++) {", "VAR_0[VAR_1] += (VAR_0[VAR_1 + 256] - VAR_0[VAR_1 + 768]);", "VAR_0[VAR_1 + 256] += (VAR_0[VAR_1 + 512] + VAR_0[VAR_1 + 768]);", "VAR_0[VAR_1 + 512] = VAR_0[VAR_1 + 768] = 0;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ] ]
26,432
static void neon_store_scratch(int scratch, TCGv var) { tcg_gen_st_i32(var, cpu_env, offsetof(CPUARMState, vfp.scratch[scratch])); dead_tmp(var); }
true
qemu
7d1b0095bff7157e856d1d0e6c4295641ced2752
static void neon_store_scratch(int scratch, TCGv var) { tcg_gen_st_i32(var, cpu_env, offsetof(CPUARMState, vfp.scratch[scratch])); dead_tmp(var); }
{ "code": [ " dead_tmp(var);", " dead_tmp(var);", " dead_tmp(var);", " dead_tmp(var);", " dead_tmp(var);" ], "line_no": [ 7, 7, 7, 7, 7 ] }
static void FUNC_0(int VAR_0, TCGv VAR_1) { tcg_gen_st_i32(VAR_1, cpu_env, offsetof(CPUARMState, vfp.VAR_0[VAR_0])); dead_tmp(VAR_1); }
[ "static void FUNC_0(int VAR_0, TCGv VAR_1)\n{", "tcg_gen_st_i32(VAR_1, cpu_env, offsetof(CPUARMState, vfp.VAR_0[VAR_0]));", "dead_tmp(VAR_1);", "}" ]
[ 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
26,433
void compute_images_mse(PSNRContext *s, const uint8_t *main_data[4], const int main_linesizes[4], const uint8_t *ref_data[4], const int ref_linesizes[4], int w, int h, double mse[4]) { int i, c, j; for (c = 0; c < s->nb_components; c++) { const int outw = s->planewidth[c]; const int outh = s->planeheight[c]; const uint8_t *main_line = main_data[c]; const uint8_t *ref_line = ref_data[c]; const int ref_linesize = ref_linesizes[c]; const int main_linesize = main_linesizes[c]; int m = 0; for (i = 0; i < outh; i++) { for (j = 0; j < outw; j++) m += pow2(main_line[j] - ref_line[j]); ref_line += ref_linesize; main_line += main_linesize; } mse[c] = m / (double)(outw * outh); } }
true
FFmpeg
a11c16a0b0cadf3a14fa5e7329c2a144a2165bc6
void compute_images_mse(PSNRContext *s, const uint8_t *main_data[4], const int main_linesizes[4], const uint8_t *ref_data[4], const int ref_linesizes[4], int w, int h, double mse[4]) { int i, c, j; for (c = 0; c < s->nb_components; c++) { const int outw = s->planewidth[c]; const int outh = s->planeheight[c]; const uint8_t *main_line = main_data[c]; const uint8_t *ref_line = ref_data[c]; const int ref_linesize = ref_linesizes[c]; const int main_linesize = main_linesizes[c]; int m = 0; for (i = 0; i < outh; i++) { for (j = 0; j < outw; j++) m += pow2(main_line[j] - ref_line[j]); ref_line += ref_linesize; main_line += main_linesize; } mse[c] = m / (double)(outw * outh); } }
{ "code": [ " int m = 0;" ], "line_no": [ 29 ] }
void FUNC_0(PSNRContext *VAR_0, const uint8_t *VAR_1[4], const int VAR_2[4], const uint8_t *VAR_3[4], const int VAR_4[4], int VAR_5, int VAR_6, double VAR_7[4]) { int VAR_8, VAR_9, VAR_10; for (VAR_9 = 0; VAR_9 < VAR_0->nb_components; VAR_9++) { const int outw = VAR_0->planewidth[VAR_9]; const int outh = VAR_0->planeheight[VAR_9]; const uint8_t *main_line = VAR_1[VAR_9]; const uint8_t *ref_line = VAR_3[VAR_9]; const int ref_linesize = VAR_4[VAR_9]; const int main_linesize = VAR_2[VAR_9]; int m = 0; for (VAR_8 = 0; VAR_8 < outh; VAR_8++) { for (VAR_10 = 0; VAR_10 < outw; VAR_10++) m += pow2(main_line[VAR_10] - ref_line[VAR_10]); ref_line += ref_linesize; main_line += main_linesize; } VAR_7[VAR_9] = m / (double)(outw * outh); } }
[ "void FUNC_0(PSNRContext *VAR_0,\nconst uint8_t *VAR_1[4], const int VAR_2[4],\nconst uint8_t *VAR_3[4], const int VAR_4[4],\nint VAR_5, int VAR_6, double VAR_7[4])\n{", "int VAR_8, VAR_9, VAR_10;", "for (VAR_9 = 0; VAR_9 < VAR_0->nb_components; VAR_9++) {", "const int outw = VAR_0->planewidth[VAR_9];", "const int outh = VAR_0->planeheight[VAR_9];", "const uint8_t *main_line = VAR_1[VAR_9];", "const uint8_t *ref_line = VAR_3[VAR_9];", "const int ref_linesize = VAR_4[VAR_9];", "const int main_linesize = VAR_2[VAR_9];", "int m = 0;", "for (VAR_8 = 0; VAR_8 < outh; VAR_8++) {", "for (VAR_10 = 0; VAR_10 < outw; VAR_10++)", "m += pow2(main_line[VAR_10] - ref_line[VAR_10]);", "ref_line += ref_linesize;", "main_line += main_linesize;", "}", "VAR_7[VAR_9] = m / (double)(outw * outh);", "}", "}" ]
[ 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 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ] ]
26,434
static void sparc_cpu_realizefn(DeviceState *dev, Error **errp) { SPARCCPUClass *scc = SPARC_CPU_GET_CLASS(dev); scc->parent_realize(dev, errp); }
true
qemu
14a10fc39923b3af07c8c46d22cb20843bee3a72
static void sparc_cpu_realizefn(DeviceState *dev, Error **errp) { SPARCCPUClass *scc = SPARC_CPU_GET_CLASS(dev); scc->parent_realize(dev, errp); }
{ "code": [], "line_no": [] }
static void FUNC_0(DeviceState *VAR_0, Error **VAR_1) { SPARCCPUClass *scc = SPARC_CPU_GET_CLASS(VAR_0); scc->parent_realize(VAR_0, VAR_1); }
[ "static void FUNC_0(DeviceState *VAR_0, Error **VAR_1)\n{", "SPARCCPUClass *scc = SPARC_CPU_GET_CLASS(VAR_0);", "scc->parent_realize(VAR_0, VAR_1);", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 2 ], [ 3 ], [ 4 ], [ 5 ] ]
26,436
static void block_migration_cancel(void *opaque) { blk_mig_cleanup(); }
true
qemu
60fe637bf0e4d7989e21e50f52526444765c63b4
static void block_migration_cancel(void *opaque) { blk_mig_cleanup(); }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0) { blk_mig_cleanup(); }
[ "static void FUNC_0(void *VAR_0)\n{", "blk_mig_cleanup();", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
26,438
static void tap_cleanup(VLANClientState *nc) { TAPState *s = DO_UPCAST(TAPState, nc, nc); if (s->vhost_net) { vhost_net_cleanup(s->vhost_net); } qemu_purge_queued_packets(nc); if (s->down_script[0]) launch_script(s->down_script, s->down_script_arg, s->fd); tap_read_poll(s, 0); tap_write_poll(s, 0); close(s->fd); }
true
qemu
43849424cff82803011fad21074531a1101e514e
static void tap_cleanup(VLANClientState *nc) { TAPState *s = DO_UPCAST(TAPState, nc, nc); if (s->vhost_net) { vhost_net_cleanup(s->vhost_net); } qemu_purge_queued_packets(nc); if (s->down_script[0]) launch_script(s->down_script, s->down_script_arg, s->fd); tap_read_poll(s, 0); tap_write_poll(s, 0); close(s->fd); }
{ "code": [], "line_no": [] }
static void FUNC_0(VLANClientState *VAR_0) { TAPState *s = DO_UPCAST(TAPState, VAR_0, VAR_0); if (s->vhost_net) { vhost_net_cleanup(s->vhost_net); } qemu_purge_queued_packets(VAR_0); if (s->down_script[0]) launch_script(s->down_script, s->down_script_arg, s->fd); tap_read_poll(s, 0); tap_write_poll(s, 0); close(s->fd); }
[ "static void FUNC_0(VLANClientState *VAR_0)\n{", "TAPState *s = DO_UPCAST(TAPState, VAR_0, VAR_0);", "if (s->vhost_net) {", "vhost_net_cleanup(s->vhost_net);", "}", "qemu_purge_queued_packets(VAR_0);", "if (s->down_script[0])\nlaunch_script(s->down_script, s->down_script_arg, s->fd);", "tap_read_poll(s, 0);", "tap_write_poll(s, 0);", "close(s->fd);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 14 ], [ 18 ], [ 22, 24 ], [ 28 ], [ 30 ], [ 32 ], [ 34 ] ]
26,439
static int ape_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt) { AVFrame *frame = data; const uint8_t *buf = avpkt->data; APEContext *s = avctx->priv_data; uint8_t *sample8; int16_t *sample16; int32_t *sample24; int i, ch, ret; int blockstodecode; /* this should never be negative, but bad things will happen if it is, so check it just to make sure. */ av_assert0(s->samples >= 0); if(!s->samples){ uint32_t nblocks, offset; int buf_size; if (!avpkt->size) { *got_frame_ptr = 0; return 0; } if (avpkt->size < 8) { av_log(avctx, AV_LOG_ERROR, "Packet is too small\n"); return AVERROR_INVALIDDATA; } buf_size = avpkt->size & ~3; if (buf_size != avpkt->size) { av_log(avctx, AV_LOG_WARNING, "packet size is not a multiple of 4. " "extra bytes at the end will be skipped.\n"); } if (s->fileversion < 3950) // previous versions overread two bytes buf_size += 2; av_fast_padded_malloc(&s->data, &s->data_size, buf_size); if (!s->data) return AVERROR(ENOMEM); s->bdsp.bswap_buf((uint32_t *) s->data, (const uint32_t *) buf, buf_size >> 2); memset(s->data + (buf_size & ~3), 0, buf_size & 3); s->ptr = s->data; s->data_end = s->data + buf_size; nblocks = bytestream_get_be32(&s->ptr); offset = bytestream_get_be32(&s->ptr); if (s->fileversion >= 3900) { if (offset > 3) { av_log(avctx, AV_LOG_ERROR, "Incorrect offset passed\n"); s->data = NULL; return AVERROR_INVALIDDATA; } if (s->data_end - s->ptr < offset) { av_log(avctx, AV_LOG_ERROR, "Packet is too small\n"); return AVERROR_INVALIDDATA; } s->ptr += offset; } else { if ((ret = init_get_bits8(&s->gb, s->ptr, s->data_end - s->ptr)) < 0) return ret; if (s->fileversion > 3800) skip_bits_long(&s->gb, offset * 8); else skip_bits_long(&s->gb, offset); } if (!nblocks || nblocks > INT_MAX) { av_log(avctx, AV_LOG_ERROR, "Invalid sample count: %"PRIu32".\n", nblocks); return AVERROR_INVALIDDATA; } s->samples = nblocks; /* Initialize the frame decoder */ if (init_frame_decoder(s) < 0) { av_log(avctx, AV_LOG_ERROR, "Error reading frame header\n"); return AVERROR_INVALIDDATA; } } if (!s->data) { *got_frame_ptr = 0; return avpkt->size; } blockstodecode = FFMIN(s->blocks_per_loop, s->samples); // for old files coefficients were not interleaved, // so we need to decode all of them at once if (s->fileversion < 3930) blockstodecode = s->samples; /* reallocate decoded sample buffer if needed */ av_fast_malloc(&s->decoded_buffer, &s->decoded_size, 2 * FFALIGN(blockstodecode, 8) * sizeof(*s->decoded_buffer)); if (!s->decoded_buffer) return AVERROR(ENOMEM); memset(s->decoded_buffer, 0, s->decoded_size); s->decoded[0] = s->decoded_buffer; s->decoded[1] = s->decoded_buffer + FFALIGN(blockstodecode, 8); /* get output buffer */ frame->nb_samples = blockstodecode; if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; s->error=0; if ((s->channels == 1) || (s->frameflags & APE_FRAMECODE_PSEUDO_STEREO)) ape_unpack_mono(s, blockstodecode); else ape_unpack_stereo(s, blockstodecode); emms_c(); if (s->error) { s->samples=0; av_log(avctx, AV_LOG_ERROR, "Error decoding frame\n"); return AVERROR_INVALIDDATA; } switch (s->bps) { case 8: for (ch = 0; ch < s->channels; ch++) { sample8 = (uint8_t *)frame->data[ch]; for (i = 0; i < blockstodecode; i++) *sample8++ = (s->decoded[ch][i] + 0x80) & 0xff; } break; case 16: for (ch = 0; ch < s->channels; ch++) { sample16 = (int16_t *)frame->data[ch]; for (i = 0; i < blockstodecode; i++) *sample16++ = s->decoded[ch][i]; } break; case 24: for (ch = 0; ch < s->channels; ch++) { sample24 = (int32_t *)frame->data[ch]; for (i = 0; i < blockstodecode; i++) *sample24++ = s->decoded[ch][i] << 8; } break; } s->samples -= blockstodecode; *got_frame_ptr = 1; return !s->samples ? avpkt->size : 0; }
false
FFmpeg
464c49155ce7ffc88ed39eb2511e7a75565c24be
static int ape_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt) { AVFrame *frame = data; const uint8_t *buf = avpkt->data; APEContext *s = avctx->priv_data; uint8_t *sample8; int16_t *sample16; int32_t *sample24; int i, ch, ret; int blockstodecode; av_assert0(s->samples >= 0); if(!s->samples){ uint32_t nblocks, offset; int buf_size; if (!avpkt->size) { *got_frame_ptr = 0; return 0; } if (avpkt->size < 8) { av_log(avctx, AV_LOG_ERROR, "Packet is too small\n"); return AVERROR_INVALIDDATA; } buf_size = avpkt->size & ~3; if (buf_size != avpkt->size) { av_log(avctx, AV_LOG_WARNING, "packet size is not a multiple of 4. " "extra bytes at the end will be skipped.\n"); } if (s->fileversion < 3950) buf_size += 2; av_fast_padded_malloc(&s->data, &s->data_size, buf_size); if (!s->data) return AVERROR(ENOMEM); s->bdsp.bswap_buf((uint32_t *) s->data, (const uint32_t *) buf, buf_size >> 2); memset(s->data + (buf_size & ~3), 0, buf_size & 3); s->ptr = s->data; s->data_end = s->data + buf_size; nblocks = bytestream_get_be32(&s->ptr); offset = bytestream_get_be32(&s->ptr); if (s->fileversion >= 3900) { if (offset > 3) { av_log(avctx, AV_LOG_ERROR, "Incorrect offset passed\n"); s->data = NULL; return AVERROR_INVALIDDATA; } if (s->data_end - s->ptr < offset) { av_log(avctx, AV_LOG_ERROR, "Packet is too small\n"); return AVERROR_INVALIDDATA; } s->ptr += offset; } else { if ((ret = init_get_bits8(&s->gb, s->ptr, s->data_end - s->ptr)) < 0) return ret; if (s->fileversion > 3800) skip_bits_long(&s->gb, offset * 8); else skip_bits_long(&s->gb, offset); } if (!nblocks || nblocks > INT_MAX) { av_log(avctx, AV_LOG_ERROR, "Invalid sample count: %"PRIu32".\n", nblocks); return AVERROR_INVALIDDATA; } s->samples = nblocks; if (init_frame_decoder(s) < 0) { av_log(avctx, AV_LOG_ERROR, "Error reading frame header\n"); return AVERROR_INVALIDDATA; } } if (!s->data) { *got_frame_ptr = 0; return avpkt->size; } blockstodecode = FFMIN(s->blocks_per_loop, s->samples); if (s->fileversion < 3930) blockstodecode = s->samples; av_fast_malloc(&s->decoded_buffer, &s->decoded_size, 2 * FFALIGN(blockstodecode, 8) * sizeof(*s->decoded_buffer)); if (!s->decoded_buffer) return AVERROR(ENOMEM); memset(s->decoded_buffer, 0, s->decoded_size); s->decoded[0] = s->decoded_buffer; s->decoded[1] = s->decoded_buffer + FFALIGN(blockstodecode, 8); frame->nb_samples = blockstodecode; if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; s->error=0; if ((s->channels == 1) || (s->frameflags & APE_FRAMECODE_PSEUDO_STEREO)) ape_unpack_mono(s, blockstodecode); else ape_unpack_stereo(s, blockstodecode); emms_c(); if (s->error) { s->samples=0; av_log(avctx, AV_LOG_ERROR, "Error decoding frame\n"); return AVERROR_INVALIDDATA; } switch (s->bps) { case 8: for (ch = 0; ch < s->channels; ch++) { sample8 = (uint8_t *)frame->data[ch]; for (i = 0; i < blockstodecode; i++) *sample8++ = (s->decoded[ch][i] + 0x80) & 0xff; } break; case 16: for (ch = 0; ch < s->channels; ch++) { sample16 = (int16_t *)frame->data[ch]; for (i = 0; i < blockstodecode; i++) *sample16++ = s->decoded[ch][i]; } break; case 24: for (ch = 0; ch < s->channels; ch++) { sample24 = (int32_t *)frame->data[ch]; for (i = 0; i < blockstodecode; i++) *sample24++ = s->decoded[ch][i] << 8; } break; } s->samples -= blockstodecode; *got_frame_ptr = 1; return !s->samples ? avpkt->size : 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3) { AVFrame *frame = VAR_1; const uint8_t *VAR_4 = VAR_3->VAR_1; APEContext *s = VAR_0->priv_data; uint8_t *sample8; int16_t *sample16; int32_t *sample24; int VAR_5, VAR_6, VAR_7; int VAR_8; av_assert0(s->samples >= 0); if(!s->samples){ uint32_t nblocks, offset; int VAR_9; if (!VAR_3->size) { *VAR_2 = 0; return 0; } if (VAR_3->size < 8) { av_log(VAR_0, AV_LOG_ERROR, "Packet is too small\n"); return AVERROR_INVALIDDATA; } VAR_9 = VAR_3->size & ~3; if (VAR_9 != VAR_3->size) { av_log(VAR_0, AV_LOG_WARNING, "packet size is not a multiple of 4. " "extra bytes at the end will be skipped.\n"); } if (s->fileversion < 3950) VAR_9 += 2; av_fast_padded_malloc(&s->VAR_1, &s->data_size, VAR_9); if (!s->VAR_1) return AVERROR(ENOMEM); s->bdsp.bswap_buf((uint32_t *) s->VAR_1, (const uint32_t *) VAR_4, VAR_9 >> 2); memset(s->VAR_1 + (VAR_9 & ~3), 0, VAR_9 & 3); s->ptr = s->VAR_1; s->data_end = s->VAR_1 + VAR_9; nblocks = bytestream_get_be32(&s->ptr); offset = bytestream_get_be32(&s->ptr); if (s->fileversion >= 3900) { if (offset > 3) { av_log(VAR_0, AV_LOG_ERROR, "Incorrect offset passed\n"); s->VAR_1 = NULL; return AVERROR_INVALIDDATA; } if (s->data_end - s->ptr < offset) { av_log(VAR_0, AV_LOG_ERROR, "Packet is too small\n"); return AVERROR_INVALIDDATA; } s->ptr += offset; } else { if ((VAR_7 = init_get_bits8(&s->gb, s->ptr, s->data_end - s->ptr)) < 0) return VAR_7; if (s->fileversion > 3800) skip_bits_long(&s->gb, offset * 8); else skip_bits_long(&s->gb, offset); } if (!nblocks || nblocks > INT_MAX) { av_log(VAR_0, AV_LOG_ERROR, "Invalid sample count: %"PRIu32".\n", nblocks); return AVERROR_INVALIDDATA; } s->samples = nblocks; if (init_frame_decoder(s) < 0) { av_log(VAR_0, AV_LOG_ERROR, "Error reading frame header\n"); return AVERROR_INVALIDDATA; } } if (!s->VAR_1) { *VAR_2 = 0; return VAR_3->size; } VAR_8 = FFMIN(s->blocks_per_loop, s->samples); if (s->fileversion < 3930) VAR_8 = s->samples; av_fast_malloc(&s->decoded_buffer, &s->decoded_size, 2 * FFALIGN(VAR_8, 8) * sizeof(*s->decoded_buffer)); if (!s->decoded_buffer) return AVERROR(ENOMEM); memset(s->decoded_buffer, 0, s->decoded_size); s->decoded[0] = s->decoded_buffer; s->decoded[1] = s->decoded_buffer + FFALIGN(VAR_8, 8); frame->nb_samples = VAR_8; if ((VAR_7 = ff_get_buffer(VAR_0, frame, 0)) < 0) return VAR_7; s->error=0; if ((s->channels == 1) || (s->frameflags & APE_FRAMECODE_PSEUDO_STEREO)) ape_unpack_mono(s, VAR_8); else ape_unpack_stereo(s, VAR_8); emms_c(); if (s->error) { s->samples=0; av_log(VAR_0, AV_LOG_ERROR, "Error decoding frame\n"); return AVERROR_INVALIDDATA; } switch (s->bps) { case 8: for (VAR_6 = 0; VAR_6 < s->channels; VAR_6++) { sample8 = (uint8_t *)frame->VAR_1[VAR_6]; for (VAR_5 = 0; VAR_5 < VAR_8; VAR_5++) *sample8++ = (s->decoded[VAR_6][VAR_5] + 0x80) & 0xff; } break; case 16: for (VAR_6 = 0; VAR_6 < s->channels; VAR_6++) { sample16 = (int16_t *)frame->VAR_1[VAR_6]; for (VAR_5 = 0; VAR_5 < VAR_8; VAR_5++) *sample16++ = s->decoded[VAR_6][VAR_5]; } break; case 24: for (VAR_6 = 0; VAR_6 < s->channels; VAR_6++) { sample24 = (int32_t *)frame->VAR_1[VAR_6]; for (VAR_5 = 0; VAR_5 < VAR_8; VAR_5++) *sample24++ = s->decoded[VAR_6][VAR_5] << 8; } break; } s->samples -= VAR_8; *VAR_2 = 1; return !s->samples ? VAR_3->size : 0; }
[ "static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1,\nint *VAR_2, AVPacket *VAR_3)\n{", "AVFrame *frame = VAR_1;", "const uint8_t *VAR_4 = VAR_3->VAR_1;", "APEContext *s = VAR_0->priv_data;", "uint8_t *sample8;", "int16_t *sample16;", "int32_t *sample24;", "int VAR_5, VAR_6, VAR_7;", "int VAR_8;", "av_assert0(s->samples >= 0);", "if(!s->samples){", "uint32_t nblocks, offset;", "int VAR_9;", "if (!VAR_3->size) {", "*VAR_2 = 0;", "return 0;", "}", "if (VAR_3->size < 8) {", "av_log(VAR_0, AV_LOG_ERROR, \"Packet is too small\\n\");", "return AVERROR_INVALIDDATA;", "}", "VAR_9 = VAR_3->size & ~3;", "if (VAR_9 != VAR_3->size) {", "av_log(VAR_0, AV_LOG_WARNING, \"packet size is not a multiple of 4. \"\n\"extra bytes at the end will be skipped.\\n\");", "}", "if (s->fileversion < 3950)\nVAR_9 += 2;", "av_fast_padded_malloc(&s->VAR_1, &s->data_size, VAR_9);", "if (!s->VAR_1)\nreturn AVERROR(ENOMEM);", "s->bdsp.bswap_buf((uint32_t *) s->VAR_1, (const uint32_t *) VAR_4,\nVAR_9 >> 2);", "memset(s->VAR_1 + (VAR_9 & ~3), 0, VAR_9 & 3);", "s->ptr = s->VAR_1;", "s->data_end = s->VAR_1 + VAR_9;", "nblocks = bytestream_get_be32(&s->ptr);", "offset = bytestream_get_be32(&s->ptr);", "if (s->fileversion >= 3900) {", "if (offset > 3) {", "av_log(VAR_0, AV_LOG_ERROR, \"Incorrect offset passed\\n\");", "s->VAR_1 = NULL;", "return AVERROR_INVALIDDATA;", "}", "if (s->data_end - s->ptr < offset) {", "av_log(VAR_0, AV_LOG_ERROR, \"Packet is too small\\n\");", "return AVERROR_INVALIDDATA;", "}", "s->ptr += offset;", "} else {", "if ((VAR_7 = init_get_bits8(&s->gb, s->ptr, s->data_end - s->ptr)) < 0)\nreturn VAR_7;", "if (s->fileversion > 3800)\nskip_bits_long(&s->gb, offset * 8);", "else\nskip_bits_long(&s->gb, offset);", "}", "if (!nblocks || nblocks > INT_MAX) {", "av_log(VAR_0, AV_LOG_ERROR, \"Invalid sample count: %\"PRIu32\".\\n\",\nnblocks);", "return AVERROR_INVALIDDATA;", "}", "s->samples = nblocks;", "if (init_frame_decoder(s) < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"Error reading frame header\\n\");", "return AVERROR_INVALIDDATA;", "}", "}", "if (!s->VAR_1) {", "*VAR_2 = 0;", "return VAR_3->size;", "}", "VAR_8 = FFMIN(s->blocks_per_loop, s->samples);", "if (s->fileversion < 3930)\nVAR_8 = s->samples;", "av_fast_malloc(&s->decoded_buffer, &s->decoded_size,\n2 * FFALIGN(VAR_8, 8) * sizeof(*s->decoded_buffer));", "if (!s->decoded_buffer)\nreturn AVERROR(ENOMEM);", "memset(s->decoded_buffer, 0, s->decoded_size);", "s->decoded[0] = s->decoded_buffer;", "s->decoded[1] = s->decoded_buffer + FFALIGN(VAR_8, 8);", "frame->nb_samples = VAR_8;", "if ((VAR_7 = ff_get_buffer(VAR_0, frame, 0)) < 0)\nreturn VAR_7;", "s->error=0;", "if ((s->channels == 1) || (s->frameflags & APE_FRAMECODE_PSEUDO_STEREO))\nape_unpack_mono(s, VAR_8);", "else\nape_unpack_stereo(s, VAR_8);", "emms_c();", "if (s->error) {", "s->samples=0;", "av_log(VAR_0, AV_LOG_ERROR, \"Error decoding frame\\n\");", "return AVERROR_INVALIDDATA;", "}", "switch (s->bps) {", "case 8:\nfor (VAR_6 = 0; VAR_6 < s->channels; VAR_6++) {", "sample8 = (uint8_t *)frame->VAR_1[VAR_6];", "for (VAR_5 = 0; VAR_5 < VAR_8; VAR_5++)", "*sample8++ = (s->decoded[VAR_6][VAR_5] + 0x80) & 0xff;", "}", "break;", "case 16:\nfor (VAR_6 = 0; VAR_6 < s->channels; VAR_6++) {", "sample16 = (int16_t *)frame->VAR_1[VAR_6];", "for (VAR_5 = 0; VAR_5 < VAR_8; VAR_5++)", "*sample16++ = s->decoded[VAR_6][VAR_5];", "}", "break;", "case 24:\nfor (VAR_6 = 0; VAR_6 < s->channels; VAR_6++) {", "sample24 = (int32_t *)frame->VAR_1[VAR_6];", "for (VAR_5 = 0; VAR_5 < VAR_8; VAR_5++)", "*sample24++ = s->decoded[VAR_6][VAR_5] << 8;", "}", "break;", "}", "s->samples -= VAR_8;", "*VAR_2 = 1;", "return !s->samples ? VAR_3->size : 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61, 63 ], [ 65 ], [ 67, 69 ], [ 71 ], [ 73, 75 ], [ 77, 79 ], [ 81 ], [ 83 ], [ 85 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117, 119 ], [ 121, 123 ], [ 125, 127 ], [ 129 ], [ 133 ], [ 135, 137 ], [ 139 ], [ 141 ], [ 143 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 171 ], [ 177, 179 ], [ 185, 187 ], [ 189, 191 ], [ 193 ], [ 195 ], [ 197 ], [ 203 ], [ 205, 207 ], [ 211 ], [ 215, 217 ], [ 219, 221 ], [ 223 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 239 ], [ 241, 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255, 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269, 271 ], [ 273 ], [ 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 287 ], [ 291 ], [ 295 ], [ 297 ] ]
26,440
static int decode_plane(UtvideoContext *c, int plane_no, uint8_t *dst, int step, int stride, int width, int height, const uint8_t *src, int src_size, int use_pred) { int i, j, slice, pix; int sstart, send; VLC vlc; GetBitContext gb; int prev; const int cmask = ~(!plane_no && c->avctx->pix_fmt == PIX_FMT_YUV420P); if (build_huff(src, &vlc)) { av_log(c->avctx, AV_LOG_ERROR, "Cannot build Huffman codes\n"); return AVERROR_INVALIDDATA; } src += 256; src_size -= 256; send = 0; for (slice = 0; slice < c->slices; slice++) { uint8_t *dest; int slice_data_start, slice_data_end, slice_size; sstart = send; send = (height * (slice + 1) / c->slices) & cmask; dest = dst + sstart * stride; // slice offset and size validation was done earlier slice_data_start = slice ? AV_RL32(src + slice * 4 - 4) : 0; slice_data_end = AV_RL32(src + slice * 4); slice_size = slice_data_end - slice_data_start; if (!slice_size) { for (j = sstart; j < send; j++) { for (i = 0; i < width * step; i += step) dest[i] = 0x80; dest += stride; } continue; } memcpy(c->slice_bits, src + slice_data_start + c->slices * 4, slice_size); memset(c->slice_bits + slice_size, 0, FF_INPUT_BUFFER_PADDING_SIZE); c->dsp.bswap_buf((uint32_t*)c->slice_bits, (uint32_t*)c->slice_bits, (slice_data_end - slice_data_start + 3) >> 2); init_get_bits(&gb, c->slice_bits, slice_size * 8); prev = 0x80; for (j = sstart; j < send; j++) { for (i = 0; i < width * step; i += step) { if (get_bits_left(&gb) <= 0) { av_log(c->avctx, AV_LOG_ERROR, "Slice decoding ran out of bits\n"); goto fail; } pix = get_vlc2(&gb, vlc.table, vlc.bits, 4); if (pix < 0) { av_log(c->avctx, AV_LOG_ERROR, "Decoding error\n"); goto fail; } if (use_pred) { prev += pix; pix = prev; } dest[i] = pix; } dest += stride; } if (get_bits_left(&gb) > 32) av_log(c->avctx, AV_LOG_WARNING, "%d bits left after decoding slice\n", get_bits_left(&gb)); } free_vlc(&vlc); return 0; fail: free_vlc(&vlc); return AVERROR_INVALIDDATA; }
false
FFmpeg
46e1af3b0f2c28936dfa88063cc5a35f466f5ac3
static int decode_plane(UtvideoContext *c, int plane_no, uint8_t *dst, int step, int stride, int width, int height, const uint8_t *src, int src_size, int use_pred) { int i, j, slice, pix; int sstart, send; VLC vlc; GetBitContext gb; int prev; const int cmask = ~(!plane_no && c->avctx->pix_fmt == PIX_FMT_YUV420P); if (build_huff(src, &vlc)) { av_log(c->avctx, AV_LOG_ERROR, "Cannot build Huffman codes\n"); return AVERROR_INVALIDDATA; } src += 256; src_size -= 256; send = 0; for (slice = 0; slice < c->slices; slice++) { uint8_t *dest; int slice_data_start, slice_data_end, slice_size; sstart = send; send = (height * (slice + 1) / c->slices) & cmask; dest = dst + sstart * stride; slice_data_start = slice ? AV_RL32(src + slice * 4 - 4) : 0; slice_data_end = AV_RL32(src + slice * 4); slice_size = slice_data_end - slice_data_start; if (!slice_size) { for (j = sstart; j < send; j++) { for (i = 0; i < width * step; i += step) dest[i] = 0x80; dest += stride; } continue; } memcpy(c->slice_bits, src + slice_data_start + c->slices * 4, slice_size); memset(c->slice_bits + slice_size, 0, FF_INPUT_BUFFER_PADDING_SIZE); c->dsp.bswap_buf((uint32_t*)c->slice_bits, (uint32_t*)c->slice_bits, (slice_data_end - slice_data_start + 3) >> 2); init_get_bits(&gb, c->slice_bits, slice_size * 8); prev = 0x80; for (j = sstart; j < send; j++) { for (i = 0; i < width * step; i += step) { if (get_bits_left(&gb) <= 0) { av_log(c->avctx, AV_LOG_ERROR, "Slice decoding ran out of bits\n"); goto fail; } pix = get_vlc2(&gb, vlc.table, vlc.bits, 4); if (pix < 0) { av_log(c->avctx, AV_LOG_ERROR, "Decoding error\n"); goto fail; } if (use_pred) { prev += pix; pix = prev; } dest[i] = pix; } dest += stride; } if (get_bits_left(&gb) > 32) av_log(c->avctx, AV_LOG_WARNING, "%d bits left after decoding slice\n", get_bits_left(&gb)); } free_vlc(&vlc); return 0; fail: free_vlc(&vlc); return AVERROR_INVALIDDATA; }
{ "code": [], "line_no": [] }
static int FUNC_0(UtvideoContext *VAR_0, int VAR_1, uint8_t *VAR_2, int VAR_3, int VAR_4, int VAR_5, int VAR_6, const uint8_t *VAR_7, int VAR_8, int VAR_9) { int VAR_10, VAR_11, VAR_12, VAR_13; int VAR_14, VAR_15; VLC vlc; GetBitContext gb; int VAR_16; const int VAR_17 = ~(!VAR_1 && VAR_0->avctx->pix_fmt == PIX_FMT_YUV420P); if (build_huff(VAR_7, &vlc)) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Cannot build Huffman codes\n"); return AVERROR_INVALIDDATA; } VAR_7 += 256; VAR_8 -= 256; VAR_15 = 0; for (VAR_12 = 0; VAR_12 < VAR_0->slices; VAR_12++) { uint8_t *dest; int slice_data_start, slice_data_end, slice_size; VAR_14 = VAR_15; VAR_15 = (VAR_6 * (VAR_12 + 1) / VAR_0->slices) & VAR_17; dest = VAR_2 + VAR_14 * VAR_4; slice_data_start = VAR_12 ? AV_RL32(VAR_7 + VAR_12 * 4 - 4) : 0; slice_data_end = AV_RL32(VAR_7 + VAR_12 * 4); slice_size = slice_data_end - slice_data_start; if (!slice_size) { for (VAR_11 = VAR_14; VAR_11 < VAR_15; VAR_11++) { for (VAR_10 = 0; VAR_10 < VAR_5 * VAR_3; VAR_10 += VAR_3) dest[VAR_10] = 0x80; dest += VAR_4; } continue; } memcpy(VAR_0->slice_bits, VAR_7 + slice_data_start + VAR_0->slices * 4, slice_size); memset(VAR_0->slice_bits + slice_size, 0, FF_INPUT_BUFFER_PADDING_SIZE); VAR_0->dsp.bswap_buf((uint32_t*)VAR_0->slice_bits, (uint32_t*)VAR_0->slice_bits, (slice_data_end - slice_data_start + 3) >> 2); init_get_bits(&gb, VAR_0->slice_bits, slice_size * 8); VAR_16 = 0x80; for (VAR_11 = VAR_14; VAR_11 < VAR_15; VAR_11++) { for (VAR_10 = 0; VAR_10 < VAR_5 * VAR_3; VAR_10 += VAR_3) { if (get_bits_left(&gb) <= 0) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Slice decoding ran out of bits\n"); goto fail; } VAR_13 = get_vlc2(&gb, vlc.table, vlc.bits, 4); if (VAR_13 < 0) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Decoding error\n"); goto fail; } if (VAR_9) { VAR_16 += VAR_13; VAR_13 = VAR_16; } dest[VAR_10] = VAR_13; } dest += VAR_4; } if (get_bits_left(&gb) > 32) av_log(VAR_0->avctx, AV_LOG_WARNING, "%d bits left after decoding VAR_12\n", get_bits_left(&gb)); } free_vlc(&vlc); return 0; fail: free_vlc(&vlc); return AVERROR_INVALIDDATA; }
[ "static int FUNC_0(UtvideoContext *VAR_0, int VAR_1,\nuint8_t *VAR_2, int VAR_3, int VAR_4,\nint VAR_5, int VAR_6,\nconst uint8_t *VAR_7, int VAR_8, int VAR_9)\n{", "int VAR_10, VAR_11, VAR_12, VAR_13;", "int VAR_14, VAR_15;", "VLC vlc;", "GetBitContext gb;", "int VAR_16;", "const int VAR_17 = ~(!VAR_1 && VAR_0->avctx->pix_fmt == PIX_FMT_YUV420P);", "if (build_huff(VAR_7, &vlc)) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Cannot build Huffman codes\\n\");", "return AVERROR_INVALIDDATA;", "}", "VAR_7 += 256;", "VAR_8 -= 256;", "VAR_15 = 0;", "for (VAR_12 = 0; VAR_12 < VAR_0->slices; VAR_12++) {", "uint8_t *dest;", "int slice_data_start, slice_data_end, slice_size;", "VAR_14 = VAR_15;", "VAR_15 = (VAR_6 * (VAR_12 + 1) / VAR_0->slices) & VAR_17;", "dest = VAR_2 + VAR_14 * VAR_4;", "slice_data_start = VAR_12 ? AV_RL32(VAR_7 + VAR_12 * 4 - 4) : 0;", "slice_data_end = AV_RL32(VAR_7 + VAR_12 * 4);", "slice_size = slice_data_end - slice_data_start;", "if (!slice_size) {", "for (VAR_11 = VAR_14; VAR_11 < VAR_15; VAR_11++) {", "for (VAR_10 = 0; VAR_10 < VAR_5 * VAR_3; VAR_10 += VAR_3)", "dest[VAR_10] = 0x80;", "dest += VAR_4;", "}", "continue;", "}", "memcpy(VAR_0->slice_bits, VAR_7 + slice_data_start + VAR_0->slices * 4, slice_size);", "memset(VAR_0->slice_bits + slice_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);", "VAR_0->dsp.bswap_buf((uint32_t*)VAR_0->slice_bits, (uint32_t*)VAR_0->slice_bits,\n(slice_data_end - slice_data_start + 3) >> 2);", "init_get_bits(&gb, VAR_0->slice_bits, slice_size * 8);", "VAR_16 = 0x80;", "for (VAR_11 = VAR_14; VAR_11 < VAR_15; VAR_11++) {", "for (VAR_10 = 0; VAR_10 < VAR_5 * VAR_3; VAR_10 += VAR_3) {", "if (get_bits_left(&gb) <= 0) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Slice decoding ran out of bits\\n\");", "goto fail;", "}", "VAR_13 = get_vlc2(&gb, vlc.table, vlc.bits, 4);", "if (VAR_13 < 0) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Decoding error\\n\");", "goto fail;", "}", "if (VAR_9) {", "VAR_16 += VAR_13;", "VAR_13 = VAR_16;", "}", "dest[VAR_10] = VAR_13;", "}", "dest += VAR_4;", "}", "if (get_bits_left(&gb) > 32)\nav_log(VAR_0->avctx, AV_LOG_WARNING, \"%d bits left after decoding VAR_12\\n\",\nget_bits_left(&gb));", "}", "free_vlc(&vlc);", "return 0;", "fail:\nfree_vlc(&vlc);", "return AVERROR_INVALIDDATA;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 87 ], [ 89 ], [ 91, 93 ], [ 95 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139, 141, 143 ], [ 145 ], [ 149 ], [ 153 ], [ 155, 157 ], [ 159 ], [ 161 ] ]
26,441
static int mov_read_dac3(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; enum AVAudioServiceType *ast; int ac3info, acmod, lfeon, bsmod; if (c->fc->nb_streams < 1) return 0; st = c->fc->streams[c->fc->nb_streams-1]; ast = (enum AVAudioServiceType*)ff_stream_new_side_data(st, AV_PKT_DATA_AUDIO_SERVICE_TYPE, sizeof(*ast)); if (!ast) return AVERROR(ENOMEM); ac3info = avio_rb24(pb); bsmod = (ac3info >> 14) & 0x7; acmod = (ac3info >> 11) & 0x7; lfeon = (ac3info >> 10) & 0x1; st->codec->channels = ((int[]){2,1,2,3,3,4,4,5})[acmod] + lfeon; st->codec->channel_layout = avpriv_ac3_channel_layout_tab[acmod]; if (lfeon) st->codec->channel_layout |= AV_CH_LOW_FREQUENCY; *ast = bsmod; if (st->codec->channels > 1 && bsmod == 0x7) *ast = AV_AUDIO_SERVICE_TYPE_KARAOKE; st->codec->audio_service_type = *ast; return 0; }
false
FFmpeg
7f4ec4364bc4a73036660c1c6a3c4801db524e9e
static int mov_read_dac3(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; enum AVAudioServiceType *ast; int ac3info, acmod, lfeon, bsmod; if (c->fc->nb_streams < 1) return 0; st = c->fc->streams[c->fc->nb_streams-1]; ast = (enum AVAudioServiceType*)ff_stream_new_side_data(st, AV_PKT_DATA_AUDIO_SERVICE_TYPE, sizeof(*ast)); if (!ast) return AVERROR(ENOMEM); ac3info = avio_rb24(pb); bsmod = (ac3info >> 14) & 0x7; acmod = (ac3info >> 11) & 0x7; lfeon = (ac3info >> 10) & 0x1; st->codec->channels = ((int[]){2,1,2,3,3,4,4,5})[acmod] + lfeon; st->codec->channel_layout = avpriv_ac3_channel_layout_tab[acmod]; if (lfeon) st->codec->channel_layout |= AV_CH_LOW_FREQUENCY; *ast = bsmod; if (st->codec->channels > 1 && bsmod == 0x7) *ast = AV_AUDIO_SERVICE_TYPE_KARAOKE; st->codec->audio_service_type = *ast; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(MOVContext *VAR_0, AVIOContext *VAR_1, MOVAtom VAR_2) { AVStream *st; enum AVAudioServiceType *VAR_3; int VAR_4, VAR_5, VAR_6, VAR_7; if (VAR_0->fc->nb_streams < 1) return 0; st = VAR_0->fc->streams[VAR_0->fc->nb_streams-1]; VAR_3 = (enum AVAudioServiceType*)ff_stream_new_side_data(st, AV_PKT_DATA_AUDIO_SERVICE_TYPE, sizeof(*VAR_3)); if (!VAR_3) return AVERROR(ENOMEM); VAR_4 = avio_rb24(VAR_1); VAR_7 = (VAR_4 >> 14) & 0x7; VAR_5 = (VAR_4 >> 11) & 0x7; VAR_6 = (VAR_4 >> 10) & 0x1; st->codec->channels = ((int[]){2,1,2,3,3,4,4,5})[VAR_5] + VAR_6; st->codec->channel_layout = avpriv_ac3_channel_layout_tab[VAR_5]; if (VAR_6) st->codec->channel_layout |= AV_CH_LOW_FREQUENCY; *VAR_3 = VAR_7; if (st->codec->channels > 1 && VAR_7 == 0x7) *VAR_3 = AV_AUDIO_SERVICE_TYPE_KARAOKE; st->codec->audio_service_type = *VAR_3; return 0; }
[ "static int FUNC_0(MOVContext *VAR_0, AVIOContext *VAR_1, MOVAtom VAR_2)\n{", "AVStream *st;", "enum AVAudioServiceType *VAR_3;", "int VAR_4, VAR_5, VAR_6, VAR_7;", "if (VAR_0->fc->nb_streams < 1)\nreturn 0;", "st = VAR_0->fc->streams[VAR_0->fc->nb_streams-1];", "VAR_3 = (enum AVAudioServiceType*)ff_stream_new_side_data(st, AV_PKT_DATA_AUDIO_SERVICE_TYPE,\nsizeof(*VAR_3));", "if (!VAR_3)\nreturn AVERROR(ENOMEM);", "VAR_4 = avio_rb24(VAR_1);", "VAR_7 = (VAR_4 >> 14) & 0x7;", "VAR_5 = (VAR_4 >> 11) & 0x7;", "VAR_6 = (VAR_4 >> 10) & 0x1;", "st->codec->channels = ((int[]){2,1,2,3,3,4,4,5})[VAR_5] + VAR_6;", "st->codec->channel_layout = avpriv_ac3_channel_layout_tab[VAR_5];", "if (VAR_6)\nst->codec->channel_layout |= AV_CH_LOW_FREQUENCY;", "*VAR_3 = VAR_7;", "if (st->codec->channels > 1 && VAR_7 == 0x7)\n*VAR_3 = AV_AUDIO_SERVICE_TYPE_KARAOKE;", "st->codec->audio_service_type = *VAR_3;", "return 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 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49, 51 ], [ 55 ], [ 59 ], [ 61 ] ]
26,442
static int set_pix_fmt(AVCodecContext *avctx, struct vpx_image *img, int has_alpha_channel) { #if VPX_IMAGE_ABI_VERSION >= 3 static const enum AVColorSpace colorspaces[8] = { AVCOL_SPC_UNSPECIFIED, AVCOL_SPC_BT470BG, AVCOL_SPC_BT709, AVCOL_SPC_SMPTE170M, AVCOL_SPC_SMPTE240M, AVCOL_SPC_BT2020_NCL, AVCOL_SPC_RESERVED, AVCOL_SPC_RGB, }; #if VPX_IMAGE_ABI_VERSION >= 4 static const enum AVColorRange color_ranges[] = { AVCOL_RANGE_MPEG, AVCOL_RANGE_JPEG }; avctx->color_range = color_ranges[img->range]; #endif avctx->colorspace = colorspaces[img->cs]; #endif if (avctx->codec_id == AV_CODEC_ID_VP8 && img->fmt != VPX_IMG_FMT_I420) return AVERROR_INVALIDDATA; switch (img->fmt) { case VPX_IMG_FMT_I420: if (avctx->codec_id == AV_CODEC_ID_VP9) avctx->profile = FF_PROFILE_VP9_0; avctx->pix_fmt = has_alpha_channel ? AV_PIX_FMT_YUVA420P : AV_PIX_FMT_YUV420P; return 0; #if CONFIG_LIBVPX_VP9_DECODER case VPX_IMG_FMT_I422: avctx->profile = FF_PROFILE_VP9_1; avctx->pix_fmt = AV_PIX_FMT_YUV422P; return 0; #if VPX_IMAGE_ABI_VERSION >= 3 case VPX_IMG_FMT_I440: avctx->profile = FF_PROFILE_VP9_1; avctx->pix_fmt = AV_PIX_FMT_YUV440P; return 0; #endif case VPX_IMG_FMT_I444: avctx->profile = FF_PROFILE_VP9_1; #if VPX_IMAGE_ABI_VERSION >= 3 avctx->pix_fmt = avctx->colorspace == AVCOL_SPC_RGB ? AV_PIX_FMT_GBRP : AV_PIX_FMT_YUV444P; #else avctx->pix_fmt = AV_PIX_FMT_YUV444P; #endif return 0; #ifdef VPX_IMG_FMT_HIGHBITDEPTH case VPX_IMG_FMT_I42016: avctx->profile = FF_PROFILE_VP9_2; if (img->bit_depth == 10) { avctx->pix_fmt = AV_PIX_FMT_YUV420P10; return 0; } else if (img->bit_depth == 12) { avctx->pix_fmt = AV_PIX_FMT_YUV420P12; return 0; } else { return AVERROR_INVALIDDATA; } case VPX_IMG_FMT_I42216: avctx->profile = FF_PROFILE_VP9_3; if (img->bit_depth == 10) { avctx->pix_fmt = AV_PIX_FMT_YUV422P10; return 0; } else if (img->bit_depth == 12) { avctx->pix_fmt = AV_PIX_FMT_YUV422P12; return 0; } else { return AVERROR_INVALIDDATA; } #if VPX_IMAGE_ABI_VERSION >= 3 case VPX_IMG_FMT_I44016: avctx->profile = FF_PROFILE_VP9_3; if (img->bit_depth == 10) { avctx->pix_fmt = AV_PIX_FMT_YUV440P10; return 0; } else if (img->bit_depth == 12) { avctx->pix_fmt = AV_PIX_FMT_YUV440P12; return 0; } else { return AVERROR_INVALIDDATA; } #endif case VPX_IMG_FMT_I44416: avctx->profile = FF_PROFILE_VP9_3; if (img->bit_depth == 10) { #if VPX_IMAGE_ABI_VERSION >= 3 avctx->pix_fmt = avctx->colorspace == AVCOL_SPC_RGB ? AV_PIX_FMT_GBRP10 : AV_PIX_FMT_YUV444P10; #else avctx->pix_fmt = AV_PIX_FMT_YUV444P10; #endif return 0; } else if (img->bit_depth == 12) { #if VPX_IMAGE_ABI_VERSION >= 3 avctx->pix_fmt = avctx->colorspace == AVCOL_SPC_RGB ? AV_PIX_FMT_GBRP12 : AV_PIX_FMT_YUV444P12; #else avctx->pix_fmt = AV_PIX_FMT_YUV444P12; #endif return 0; } else { return AVERROR_INVALIDDATA; } #endif #endif default: return AVERROR_INVALIDDATA; } }
false
FFmpeg
e60dbe421c7e9cd896d33e35a6a1b0cef953918e
static int set_pix_fmt(AVCodecContext *avctx, struct vpx_image *img, int has_alpha_channel) { #if VPX_IMAGE_ABI_VERSION >= 3 static const enum AVColorSpace colorspaces[8] = { AVCOL_SPC_UNSPECIFIED, AVCOL_SPC_BT470BG, AVCOL_SPC_BT709, AVCOL_SPC_SMPTE170M, AVCOL_SPC_SMPTE240M, AVCOL_SPC_BT2020_NCL, AVCOL_SPC_RESERVED, AVCOL_SPC_RGB, }; #if VPX_IMAGE_ABI_VERSION >= 4 static const enum AVColorRange color_ranges[] = { AVCOL_RANGE_MPEG, AVCOL_RANGE_JPEG }; avctx->color_range = color_ranges[img->range]; #endif avctx->colorspace = colorspaces[img->cs]; #endif if (avctx->codec_id == AV_CODEC_ID_VP8 && img->fmt != VPX_IMG_FMT_I420) return AVERROR_INVALIDDATA; switch (img->fmt) { case VPX_IMG_FMT_I420: if (avctx->codec_id == AV_CODEC_ID_VP9) avctx->profile = FF_PROFILE_VP9_0; avctx->pix_fmt = has_alpha_channel ? AV_PIX_FMT_YUVA420P : AV_PIX_FMT_YUV420P; return 0; #if CONFIG_LIBVPX_VP9_DECODER case VPX_IMG_FMT_I422: avctx->profile = FF_PROFILE_VP9_1; avctx->pix_fmt = AV_PIX_FMT_YUV422P; return 0; #if VPX_IMAGE_ABI_VERSION >= 3 case VPX_IMG_FMT_I440: avctx->profile = FF_PROFILE_VP9_1; avctx->pix_fmt = AV_PIX_FMT_YUV440P; return 0; #endif case VPX_IMG_FMT_I444: avctx->profile = FF_PROFILE_VP9_1; #if VPX_IMAGE_ABI_VERSION >= 3 avctx->pix_fmt = avctx->colorspace == AVCOL_SPC_RGB ? AV_PIX_FMT_GBRP : AV_PIX_FMT_YUV444P; #else avctx->pix_fmt = AV_PIX_FMT_YUV444P; #endif return 0; #ifdef VPX_IMG_FMT_HIGHBITDEPTH case VPX_IMG_FMT_I42016: avctx->profile = FF_PROFILE_VP9_2; if (img->bit_depth == 10) { avctx->pix_fmt = AV_PIX_FMT_YUV420P10; return 0; } else if (img->bit_depth == 12) { avctx->pix_fmt = AV_PIX_FMT_YUV420P12; return 0; } else { return AVERROR_INVALIDDATA; } case VPX_IMG_FMT_I42216: avctx->profile = FF_PROFILE_VP9_3; if (img->bit_depth == 10) { avctx->pix_fmt = AV_PIX_FMT_YUV422P10; return 0; } else if (img->bit_depth == 12) { avctx->pix_fmt = AV_PIX_FMT_YUV422P12; return 0; } else { return AVERROR_INVALIDDATA; } #if VPX_IMAGE_ABI_VERSION >= 3 case VPX_IMG_FMT_I44016: avctx->profile = FF_PROFILE_VP9_3; if (img->bit_depth == 10) { avctx->pix_fmt = AV_PIX_FMT_YUV440P10; return 0; } else if (img->bit_depth == 12) { avctx->pix_fmt = AV_PIX_FMT_YUV440P12; return 0; } else { return AVERROR_INVALIDDATA; } #endif case VPX_IMG_FMT_I44416: avctx->profile = FF_PROFILE_VP9_3; if (img->bit_depth == 10) { #if VPX_IMAGE_ABI_VERSION >= 3 avctx->pix_fmt = avctx->colorspace == AVCOL_SPC_RGB ? AV_PIX_FMT_GBRP10 : AV_PIX_FMT_YUV444P10; #else avctx->pix_fmt = AV_PIX_FMT_YUV444P10; #endif return 0; } else if (img->bit_depth == 12) { #if VPX_IMAGE_ABI_VERSION >= 3 avctx->pix_fmt = avctx->colorspace == AVCOL_SPC_RGB ? AV_PIX_FMT_GBRP12 : AV_PIX_FMT_YUV444P12; #else avctx->pix_fmt = AV_PIX_FMT_YUV444P12; #endif return 0; } else { return AVERROR_INVALIDDATA; } #endif #endif default: return AVERROR_INVALIDDATA; } }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, struct vpx_image *VAR_1, int VAR_2) { #if VPX_IMAGE_ABI_VERSION >= 3 static const enum AVColorSpace colorspaces[8] = { AVCOL_SPC_UNSPECIFIED, AVCOL_SPC_BT470BG, AVCOL_SPC_BT709, AVCOL_SPC_SMPTE170M, AVCOL_SPC_SMPTE240M, AVCOL_SPC_BT2020_NCL, AVCOL_SPC_RESERVED, AVCOL_SPC_RGB, }; #if VPX_IMAGE_ABI_VERSION >= 4 static const enum AVColorRange color_ranges[] = { AVCOL_RANGE_MPEG, AVCOL_RANGE_JPEG }; VAR_0->color_range = color_ranges[VAR_1->range]; #endif VAR_0->colorspace = colorspaces[VAR_1->cs]; #endif if (VAR_0->codec_id == AV_CODEC_ID_VP8 && VAR_1->fmt != VPX_IMG_FMT_I420) return AVERROR_INVALIDDATA; switch (VAR_1->fmt) { case VPX_IMG_FMT_I420: if (VAR_0->codec_id == AV_CODEC_ID_VP9) VAR_0->profile = FF_PROFILE_VP9_0; VAR_0->pix_fmt = VAR_2 ? AV_PIX_FMT_YUVA420P : AV_PIX_FMT_YUV420P; return 0; #if CONFIG_LIBVPX_VP9_DECODER case VPX_IMG_FMT_I422: VAR_0->profile = FF_PROFILE_VP9_1; VAR_0->pix_fmt = AV_PIX_FMT_YUV422P; return 0; #if VPX_IMAGE_ABI_VERSION >= 3 case VPX_IMG_FMT_I440: VAR_0->profile = FF_PROFILE_VP9_1; VAR_0->pix_fmt = AV_PIX_FMT_YUV440P; return 0; #endif case VPX_IMG_FMT_I444: VAR_0->profile = FF_PROFILE_VP9_1; #if VPX_IMAGE_ABI_VERSION >= 3 VAR_0->pix_fmt = VAR_0->colorspace == AVCOL_SPC_RGB ? AV_PIX_FMT_GBRP : AV_PIX_FMT_YUV444P; #else VAR_0->pix_fmt = AV_PIX_FMT_YUV444P; #endif return 0; #ifdef VPX_IMG_FMT_HIGHBITDEPTH case VPX_IMG_FMT_I42016: VAR_0->profile = FF_PROFILE_VP9_2; if (VAR_1->bit_depth == 10) { VAR_0->pix_fmt = AV_PIX_FMT_YUV420P10; return 0; } else if (VAR_1->bit_depth == 12) { VAR_0->pix_fmt = AV_PIX_FMT_YUV420P12; return 0; } else { return AVERROR_INVALIDDATA; } case VPX_IMG_FMT_I42216: VAR_0->profile = FF_PROFILE_VP9_3; if (VAR_1->bit_depth == 10) { VAR_0->pix_fmt = AV_PIX_FMT_YUV422P10; return 0; } else if (VAR_1->bit_depth == 12) { VAR_0->pix_fmt = AV_PIX_FMT_YUV422P12; return 0; } else { return AVERROR_INVALIDDATA; } #if VPX_IMAGE_ABI_VERSION >= 3 case VPX_IMG_FMT_I44016: VAR_0->profile = FF_PROFILE_VP9_3; if (VAR_1->bit_depth == 10) { VAR_0->pix_fmt = AV_PIX_FMT_YUV440P10; return 0; } else if (VAR_1->bit_depth == 12) { VAR_0->pix_fmt = AV_PIX_FMT_YUV440P12; return 0; } else { return AVERROR_INVALIDDATA; } #endif case VPX_IMG_FMT_I44416: VAR_0->profile = FF_PROFILE_VP9_3; if (VAR_1->bit_depth == 10) { #if VPX_IMAGE_ABI_VERSION >= 3 VAR_0->pix_fmt = VAR_0->colorspace == AVCOL_SPC_RGB ? AV_PIX_FMT_GBRP10 : AV_PIX_FMT_YUV444P10; #else VAR_0->pix_fmt = AV_PIX_FMT_YUV444P10; #endif return 0; } else if (VAR_1->bit_depth == 12) { #if VPX_IMAGE_ABI_VERSION >= 3 VAR_0->pix_fmt = VAR_0->colorspace == AVCOL_SPC_RGB ? AV_PIX_FMT_GBRP12 : AV_PIX_FMT_YUV444P12; #else VAR_0->pix_fmt = AV_PIX_FMT_YUV444P12; #endif return 0; } else { return AVERROR_INVALIDDATA; } #endif #endif default: return AVERROR_INVALIDDATA; } }
[ "static int FUNC_0(AVCodecContext *VAR_0, struct vpx_image *VAR_1,\nint VAR_2)\n{", "#if VPX_IMAGE_ABI_VERSION >= 3\nstatic const enum AVColorSpace colorspaces[8] = {", "AVCOL_SPC_UNSPECIFIED, AVCOL_SPC_BT470BG, AVCOL_SPC_BT709, AVCOL_SPC_SMPTE170M,\nAVCOL_SPC_SMPTE240M, AVCOL_SPC_BT2020_NCL, AVCOL_SPC_RESERVED, AVCOL_SPC_RGB,\n};", "#if VPX_IMAGE_ABI_VERSION >= 4\nstatic const enum AVColorRange color_ranges[] = {", "AVCOL_RANGE_MPEG, AVCOL_RANGE_JPEG\n};", "VAR_0->color_range = color_ranges[VAR_1->range];", "#endif\nVAR_0->colorspace = colorspaces[VAR_1->cs];", "#endif\nif (VAR_0->codec_id == AV_CODEC_ID_VP8 && VAR_1->fmt != VPX_IMG_FMT_I420)\nreturn AVERROR_INVALIDDATA;", "switch (VAR_1->fmt) {", "case VPX_IMG_FMT_I420:\nif (VAR_0->codec_id == AV_CODEC_ID_VP9)\nVAR_0->profile = FF_PROFILE_VP9_0;", "VAR_0->pix_fmt =\nVAR_2 ? AV_PIX_FMT_YUVA420P : AV_PIX_FMT_YUV420P;", "return 0;", "#if CONFIG_LIBVPX_VP9_DECODER\ncase VPX_IMG_FMT_I422:\nVAR_0->profile = FF_PROFILE_VP9_1;", "VAR_0->pix_fmt = AV_PIX_FMT_YUV422P;", "return 0;", "#if VPX_IMAGE_ABI_VERSION >= 3\ncase VPX_IMG_FMT_I440:\nVAR_0->profile = FF_PROFILE_VP9_1;", "VAR_0->pix_fmt = AV_PIX_FMT_YUV440P;", "return 0;", "#endif\ncase VPX_IMG_FMT_I444:\nVAR_0->profile = FF_PROFILE_VP9_1;", "#if VPX_IMAGE_ABI_VERSION >= 3\nVAR_0->pix_fmt = VAR_0->colorspace == AVCOL_SPC_RGB ?\nAV_PIX_FMT_GBRP : AV_PIX_FMT_YUV444P;", "#else\nVAR_0->pix_fmt = AV_PIX_FMT_YUV444P;", "#endif\nreturn 0;", "#ifdef VPX_IMG_FMT_HIGHBITDEPTH\ncase VPX_IMG_FMT_I42016:\nVAR_0->profile = FF_PROFILE_VP9_2;", "if (VAR_1->bit_depth == 10) {", "VAR_0->pix_fmt = AV_PIX_FMT_YUV420P10;", "return 0;", "} else if (VAR_1->bit_depth == 12) {", "VAR_0->pix_fmt = AV_PIX_FMT_YUV420P12;", "return 0;", "} else {", "return AVERROR_INVALIDDATA;", "}", "case VPX_IMG_FMT_I42216:\nVAR_0->profile = FF_PROFILE_VP9_3;", "if (VAR_1->bit_depth == 10) {", "VAR_0->pix_fmt = AV_PIX_FMT_YUV422P10;", "return 0;", "} else if (VAR_1->bit_depth == 12) {", "VAR_0->pix_fmt = AV_PIX_FMT_YUV422P12;", "return 0;", "} else {", "return AVERROR_INVALIDDATA;", "}", "#if VPX_IMAGE_ABI_VERSION >= 3\ncase VPX_IMG_FMT_I44016:\nVAR_0->profile = FF_PROFILE_VP9_3;", "if (VAR_1->bit_depth == 10) {", "VAR_0->pix_fmt = AV_PIX_FMT_YUV440P10;", "return 0;", "} else if (VAR_1->bit_depth == 12) {", "VAR_0->pix_fmt = AV_PIX_FMT_YUV440P12;", "return 0;", "} else {", "return AVERROR_INVALIDDATA;", "}", "#endif\ncase VPX_IMG_FMT_I44416:\nVAR_0->profile = FF_PROFILE_VP9_3;", "if (VAR_1->bit_depth == 10) {", "#if VPX_IMAGE_ABI_VERSION >= 3\nVAR_0->pix_fmt = VAR_0->colorspace == AVCOL_SPC_RGB ?\nAV_PIX_FMT_GBRP10 : AV_PIX_FMT_YUV444P10;", "#else\nVAR_0->pix_fmt = AV_PIX_FMT_YUV444P10;", "#endif\nreturn 0;", "} else if (VAR_1->bit_depth == 12) {", "#if VPX_IMAGE_ABI_VERSION >= 3\nVAR_0->pix_fmt = VAR_0->colorspace == AVCOL_SPC_RGB ?\nAV_PIX_FMT_GBRP12 : AV_PIX_FMT_YUV444P12;", "#else\nVAR_0->pix_fmt = AV_PIX_FMT_YUV444P12;", "#endif\nreturn 0;", "} else {", "return AVERROR_INVALIDDATA;", "}", "#endif\n#endif\ndefault:\nreturn AVERROR_INVALIDDATA;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7, 9 ], [ 11, 13, 15 ], [ 17, 19 ], [ 21, 23 ], [ 25 ], [ 27, 29 ], [ 31, 33, 35 ], [ 37 ], [ 39, 41, 43 ], [ 45, 47 ], [ 49 ], [ 51, 53, 55 ], [ 57 ], [ 59 ], [ 61, 63, 65 ], [ 67 ], [ 69 ], [ 71, 73, 75 ], [ 77, 79, 81 ], [ 83, 85 ], [ 87, 89 ], [ 91, 93, 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115, 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137, 139, 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161, 163, 165 ], [ 167 ], [ 169, 171, 173 ], [ 175, 177 ], [ 179, 181 ], [ 183 ], [ 185, 187, 189 ], [ 191, 193 ], [ 195, 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205, 207, 209, 211 ], [ 213 ], [ 215 ] ]
26,444
static int blk_mig_save_bulked_block(QEMUFile *f) { int64_t completed_sector_sum = 0; BlkMigDevState *bmds; int progress; int ret = 0; QSIMPLEQ_FOREACH(bmds, &block_mig_state.bmds_list, entry) { if (bmds->bulk_completed == 0) { if (mig_save_device_bulk(f, bmds) == 1) { /* completed bulk section for this device */ bmds->bulk_completed = 1; } completed_sector_sum += bmds->completed_sectors; ret = 1; break; } else { completed_sector_sum += bmds->completed_sectors; } } if (block_mig_state.total_sector_sum != 0) { progress = completed_sector_sum * 100 / block_mig_state.total_sector_sum; } else { progress = 100; } if (progress != block_mig_state.prev_progress) { block_mig_state.prev_progress = progress; qemu_put_be64(f, (progress << BDRV_SECTOR_BITS) | BLK_MIG_FLAG_PROGRESS); DPRINTF("Completed %d %%\r", progress); } return ret; }
true
qemu
60fe637bf0e4d7989e21e50f52526444765c63b4
static int blk_mig_save_bulked_block(QEMUFile *f) { int64_t completed_sector_sum = 0; BlkMigDevState *bmds; int progress; int ret = 0; QSIMPLEQ_FOREACH(bmds, &block_mig_state.bmds_list, entry) { if (bmds->bulk_completed == 0) { if (mig_save_device_bulk(f, bmds) == 1) { bmds->bulk_completed = 1; } completed_sector_sum += bmds->completed_sectors; ret = 1; break; } else { completed_sector_sum += bmds->completed_sectors; } } if (block_mig_state.total_sector_sum != 0) { progress = completed_sector_sum * 100 / block_mig_state.total_sector_sum; } else { progress = 100; } if (progress != block_mig_state.prev_progress) { block_mig_state.prev_progress = progress; qemu_put_be64(f, (progress << BDRV_SECTOR_BITS) | BLK_MIG_FLAG_PROGRESS); DPRINTF("Completed %d %%\r", progress); } return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(QEMUFile *VAR_0) { int64_t completed_sector_sum = 0; BlkMigDevState *bmds; int VAR_1; int VAR_2 = 0; QSIMPLEQ_FOREACH(bmds, &block_mig_state.bmds_list, entry) { if (bmds->bulk_completed == 0) { if (mig_save_device_bulk(VAR_0, bmds) == 1) { bmds->bulk_completed = 1; } completed_sector_sum += bmds->completed_sectors; VAR_2 = 1; break; } else { completed_sector_sum += bmds->completed_sectors; } } if (block_mig_state.total_sector_sum != 0) { VAR_1 = completed_sector_sum * 100 / block_mig_state.total_sector_sum; } else { VAR_1 = 100; } if (VAR_1 != block_mig_state.prev_progress) { block_mig_state.prev_progress = VAR_1; qemu_put_be64(VAR_0, (VAR_1 << BDRV_SECTOR_BITS) | BLK_MIG_FLAG_PROGRESS); DPRINTF("Completed %d %%\r", VAR_1); } return VAR_2; }
[ "static int FUNC_0(QEMUFile *VAR_0)\n{", "int64_t completed_sector_sum = 0;", "BlkMigDevState *bmds;", "int VAR_1;", "int VAR_2 = 0;", "QSIMPLEQ_FOREACH(bmds, &block_mig_state.bmds_list, entry) {", "if (bmds->bulk_completed == 0) {", "if (mig_save_device_bulk(VAR_0, bmds) == 1) {", "bmds->bulk_completed = 1;", "}", "completed_sector_sum += bmds->completed_sectors;", "VAR_2 = 1;", "break;", "} else {", "completed_sector_sum += bmds->completed_sectors;", "}", "}", "if (block_mig_state.total_sector_sum != 0) {", "VAR_1 = completed_sector_sum * 100 /\nblock_mig_state.total_sector_sum;", "} else {", "VAR_1 = 100;", "}", "if (VAR_1 != block_mig_state.prev_progress) {", "block_mig_state.prev_progress = VAR_1;", "qemu_put_be64(VAR_0, (VAR_1 << BDRV_SECTOR_BITS)\n| BLK_MIG_FLAG_PROGRESS);", "DPRINTF(\"Completed %d %%\\r\", VAR_1);", "}", "return VAR_2;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45, 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59, 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ] ]
26,446
static int mpsub_probe(AVProbeData *p) { const char *ptr = p->buf; const char *ptr_end = p->buf + p->buf_size; while (ptr < ptr_end) { if (!memcmp(ptr, "FORMAT=TIME", 11)) return AVPROBE_SCORE_EXTENSION; if (!memcmp(ptr, "FORMAT=", 7)) return AVPROBE_SCORE_EXTENSION / 3; ptr += strcspn(ptr, "\n") + 1; } return 0; }
true
FFmpeg
90fc00a623de44e137fe1601b91356e8cd8bdd54
static int mpsub_probe(AVProbeData *p) { const char *ptr = p->buf; const char *ptr_end = p->buf + p->buf_size; while (ptr < ptr_end) { if (!memcmp(ptr, "FORMAT=TIME", 11)) return AVPROBE_SCORE_EXTENSION; if (!memcmp(ptr, "FORMAT=", 7)) return AVPROBE_SCORE_EXTENSION / 3; ptr += strcspn(ptr, "\n") + 1; } return 0; }
{ "code": [ " ptr += strcspn(ptr, \"\\n\") + 1;", " ptr += strcspn(ptr, \"\\n\") + 1;", " ptr += strcspn(ptr, \"\\n\") + 1;", " ptr += strcspn(ptr, \"\\n\") + 1;", " ptr += strcspn(ptr, \"\\n\") + 1;" ], "line_no": [ 21, 21, 21, 21, 21 ] }
static int FUNC_0(AVProbeData *VAR_0) { const char *VAR_1 = VAR_0->buf; const char *VAR_2 = VAR_0->buf + VAR_0->buf_size; while (VAR_1 < VAR_2) { if (!memcmp(VAR_1, "FORMAT=TIME", 11)) return AVPROBE_SCORE_EXTENSION; if (!memcmp(VAR_1, "FORMAT=", 7)) return AVPROBE_SCORE_EXTENSION / 3; VAR_1 += strcspn(VAR_1, "\n") + 1; } return 0; }
[ "static int FUNC_0(AVProbeData *VAR_0)\n{", "const char *VAR_1 = VAR_0->buf;", "const char *VAR_2 = VAR_0->buf + VAR_0->buf_size;", "while (VAR_1 < VAR_2) {", "if (!memcmp(VAR_1, \"FORMAT=TIME\", 11))\nreturn AVPROBE_SCORE_EXTENSION;", "if (!memcmp(VAR_1, \"FORMAT=\", 7))\nreturn AVPROBE_SCORE_EXTENSION / 3;", "VAR_1 += strcspn(VAR_1, \"\\n\") + 1;", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13, 15 ], [ 17, 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ] ]
26,447
void MPV_common_init_altivec(MpegEncContext *s) { if (s->avctx->lowres==0) { if ((s->avctx->idct_algo == FF_IDCT_AUTO) || (s->avctx->idct_algo == FF_IDCT_ALTIVEC)) { s->dsp.idct_put = idct_put_altivec; s->dsp.idct_add = idct_add_altivec; s->dsp.idct_permutation_type = FF_TRANSPOSE_IDCT_PERM; } } // Test to make sure that the dct required alignments are met. if ((((long)(s->q_intra_matrix) & 0x0f) != 0) || (((long)(s->q_inter_matrix) & 0x0f) != 0)) { av_log(s->avctx, AV_LOG_INFO, "Internal Error: q-matrix blocks must be 16-byte aligned " "to use AltiVec DCT. Reverting to non-AltiVec version.\n"); return; } if (((long)(s->intra_scantable.inverse) & 0x0f) != 0) { av_log(s->avctx, AV_LOG_INFO, "Internal Error: scan table blocks must be 16-byte aligned " "to use AltiVec DCT. Reverting to non-AltiVec version.\n"); return; } if ((s->avctx->dct_algo == FF_DCT_AUTO) || (s->avctx->dct_algo == FF_DCT_ALTIVEC)) { #if 0 /* seems to cause trouble under some circumstances */ s->dct_quantize = dct_quantize_altivec; #endif s->dct_unquantize_h263_intra = dct_unquantize_h263_altivec; s->dct_unquantize_h263_inter = dct_unquantize_h263_altivec; } }
true
FFmpeg
3518c5a96b0417f6e66bd0c8c64bd2b32d936064
void MPV_common_init_altivec(MpegEncContext *s) { if (s->avctx->lowres==0) { if ((s->avctx->idct_algo == FF_IDCT_AUTO) || (s->avctx->idct_algo == FF_IDCT_ALTIVEC)) { s->dsp.idct_put = idct_put_altivec; s->dsp.idct_add = idct_add_altivec; s->dsp.idct_permutation_type = FF_TRANSPOSE_IDCT_PERM; } } if ((((long)(s->q_intra_matrix) & 0x0f) != 0) || (((long)(s->q_inter_matrix) & 0x0f) != 0)) { av_log(s->avctx, AV_LOG_INFO, "Internal Error: q-matrix blocks must be 16-byte aligned " "to use AltiVec DCT. Reverting to non-AltiVec version.\n"); return; } if (((long)(s->intra_scantable.inverse) & 0x0f) != 0) { av_log(s->avctx, AV_LOG_INFO, "Internal Error: scan table blocks must be 16-byte aligned " "to use AltiVec DCT. Reverting to non-AltiVec version.\n"); return; } if ((s->avctx->dct_algo == FF_DCT_AUTO) || (s->avctx->dct_algo == FF_DCT_ALTIVEC)) { #if 0 s->dct_quantize = dct_quantize_altivec; #endif s->dct_unquantize_h263_intra = dct_unquantize_h263_altivec; s->dct_unquantize_h263_inter = dct_unquantize_h263_altivec; } }
{ "code": [], "line_no": [] }
void FUNC_0(MpegEncContext *VAR_0) { if (VAR_0->avctx->lowres==0) { if ((VAR_0->avctx->idct_algo == FF_IDCT_AUTO) || (VAR_0->avctx->idct_algo == FF_IDCT_ALTIVEC)) { VAR_0->dsp.idct_put = idct_put_altivec; VAR_0->dsp.idct_add = idct_add_altivec; VAR_0->dsp.idct_permutation_type = FF_TRANSPOSE_IDCT_PERM; } } if ((((long)(VAR_0->q_intra_matrix) & 0x0f) != 0) || (((long)(VAR_0->q_inter_matrix) & 0x0f) != 0)) { av_log(VAR_0->avctx, AV_LOG_INFO, "Internal Error: q-matrix blocks must be 16-byte aligned " "to use AltiVec DCT. Reverting to non-AltiVec version.\n"); return; } if (((long)(VAR_0->intra_scantable.inverse) & 0x0f) != 0) { av_log(VAR_0->avctx, AV_LOG_INFO, "Internal Error: scan table blocks must be 16-byte aligned " "to use AltiVec DCT. Reverting to non-AltiVec version.\n"); return; } if ((VAR_0->avctx->dct_algo == FF_DCT_AUTO) || (VAR_0->avctx->dct_algo == FF_DCT_ALTIVEC)) { #if 0 VAR_0->dct_quantize = dct_quantize_altivec; #endif VAR_0->dct_unquantize_h263_intra = dct_unquantize_h263_altivec; VAR_0->dct_unquantize_h263_inter = dct_unquantize_h263_altivec; } }
[ "void FUNC_0(MpegEncContext *VAR_0)\n{", "if (VAR_0->avctx->lowres==0)\n{", "if ((VAR_0->avctx->idct_algo == FF_IDCT_AUTO) ||\n(VAR_0->avctx->idct_algo == FF_IDCT_ALTIVEC))\n{", "VAR_0->dsp.idct_put = idct_put_altivec;", "VAR_0->dsp.idct_add = idct_add_altivec;", "VAR_0->dsp.idct_permutation_type = FF_TRANSPOSE_IDCT_PERM;", "}", "}", "if ((((long)(VAR_0->q_intra_matrix) & 0x0f) != 0) ||\n(((long)(VAR_0->q_inter_matrix) & 0x0f) != 0))\n{", "av_log(VAR_0->avctx, AV_LOG_INFO, \"Internal Error: q-matrix blocks must be 16-byte aligned \"\n\"to use AltiVec DCT. Reverting to non-AltiVec version.\\n\");", "return;", "}", "if (((long)(VAR_0->intra_scantable.inverse) & 0x0f) != 0)\n{", "av_log(VAR_0->avctx, AV_LOG_INFO, \"Internal Error: scan table blocks must be 16-byte aligned \"\n\"to use AltiVec DCT. Reverting to non-AltiVec version.\\n\");", "return;", "}", "if ((VAR_0->avctx->dct_algo == FF_DCT_AUTO) ||\n(VAR_0->avctx->dct_algo == FF_DCT_ALTIVEC))\n{", "#if 0\nVAR_0->dct_quantize = dct_quantize_altivec;", "#endif\nVAR_0->dct_unquantize_h263_intra = dct_unquantize_h263_altivec;", "VAR_0->dct_unquantize_h263_inter = dct_unquantize_h263_altivec;", "}", "}" ]
[ 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 ], [ 14, 15, 16 ], [ 17, 18 ], [ 19 ], [ 20 ], [ 21, 22 ], [ 23, 24 ], [ 25 ], [ 26 ], [ 27, 28, 29 ], [ 30, 31 ], [ 32, 33 ], [ 34 ], [ 35 ], [ 36 ] ]
26,448
static int configure_output_filter(FilterGraph *fg, OutputFilter *ofilter, AVFilterInOut *out) { char *pix_fmts; AVCodecContext *codec = ofilter->ost->st->codec; AVFilterContext *last_filter = out->filter_ctx; int pad_idx = out->pad_idx; int ret; AVBufferSinkParams *buffersink_params = av_buffersink_params_alloc(); #if FF_API_OLD_VSINK_API ret = avfilter_graph_create_filter(&ofilter->filter, avfilter_get_by_name("buffersink"), "out", NULL, NULL, fg->graph); #else ret = avfilter_graph_create_filter(&ofilter->filter, avfilter_get_by_name("buffersink"), "out", NULL, buffersink_params, fg->graph); #endif av_freep(&buffersink_params); if (ret < 0) return ret; if (codec->width || codec->height) { char args[255]; AVFilterContext *filter; snprintf(args, sizeof(args), "%d:%d:flags=0x%X", codec->width, codec->height, (unsigned)ofilter->ost->sws_flags); if ((ret = avfilter_graph_create_filter(&filter, avfilter_get_by_name("scale"), NULL, args, NULL, fg->graph)) < 0) return ret; if ((ret = avfilter_link(last_filter, pad_idx, filter, 0)) < 0) return ret; last_filter = filter; pad_idx = 0; } if ((pix_fmts = choose_pixel_fmts(ofilter->ost))) { AVFilterContext *filter; if ((ret = avfilter_graph_create_filter(&filter, avfilter_get_by_name("format"), "format", pix_fmts, NULL, fg->graph)) < 0) return ret; if ((ret = avfilter_link(last_filter, pad_idx, filter, 0)) < 0) return ret; last_filter = filter; pad_idx = 0; av_freep(&pix_fmts); } if ((ret = avfilter_link(last_filter, pad_idx, ofilter->filter, 0)) < 0) return ret; return 0; }
true
FFmpeg
fc49f22c3b735db5aaac5f98e40b7124a2be13b8
static int configure_output_filter(FilterGraph *fg, OutputFilter *ofilter, AVFilterInOut *out) { char *pix_fmts; AVCodecContext *codec = ofilter->ost->st->codec; AVFilterContext *last_filter = out->filter_ctx; int pad_idx = out->pad_idx; int ret; AVBufferSinkParams *buffersink_params = av_buffersink_params_alloc(); #if FF_API_OLD_VSINK_API ret = avfilter_graph_create_filter(&ofilter->filter, avfilter_get_by_name("buffersink"), "out", NULL, NULL, fg->graph); #else ret = avfilter_graph_create_filter(&ofilter->filter, avfilter_get_by_name("buffersink"), "out", NULL, buffersink_params, fg->graph); #endif av_freep(&buffersink_params); if (ret < 0) return ret; if (codec->width || codec->height) { char args[255]; AVFilterContext *filter; snprintf(args, sizeof(args), "%d:%d:flags=0x%X", codec->width, codec->height, (unsigned)ofilter->ost->sws_flags); if ((ret = avfilter_graph_create_filter(&filter, avfilter_get_by_name("scale"), NULL, args, NULL, fg->graph)) < 0) return ret; if ((ret = avfilter_link(last_filter, pad_idx, filter, 0)) < 0) return ret; last_filter = filter; pad_idx = 0; } if ((pix_fmts = choose_pixel_fmts(ofilter->ost))) { AVFilterContext *filter; if ((ret = avfilter_graph_create_filter(&filter, avfilter_get_by_name("format"), "format", pix_fmts, NULL, fg->graph)) < 0) return ret; if ((ret = avfilter_link(last_filter, pad_idx, filter, 0)) < 0) return ret; last_filter = filter; pad_idx = 0; av_freep(&pix_fmts); } if ((ret = avfilter_link(last_filter, pad_idx, ofilter->filter, 0)) < 0) return ret; return 0; }
{ "code": [ " if ((pix_fmts = choose_pixel_fmts(ofilter->ost))) {", " return 0;" ], "line_no": [ 83, 119 ] }
static int FUNC_0(FilterGraph *VAR_0, OutputFilter *VAR_1, AVFilterInOut *VAR_2) { char *VAR_3; AVCodecContext *codec = VAR_1->ost->st->codec; AVFilterContext *last_filter = VAR_2->filter_ctx; int VAR_4 = VAR_2->VAR_4; int VAR_5; AVBufferSinkParams *buffersink_params = av_buffersink_params_alloc(); #if FF_API_OLD_VSINK_API VAR_5 = avfilter_graph_create_filter(&VAR_1->filter, avfilter_get_by_name("buffersink"), "VAR_2", NULL, NULL, VAR_0->graph); #else VAR_5 = avfilter_graph_create_filter(&VAR_1->filter, avfilter_get_by_name("buffersink"), "VAR_2", NULL, buffersink_params, VAR_0->graph); #endif av_freep(&buffersink_params); if (VAR_5 < 0) return VAR_5; if (codec->width || codec->height) { char VAR_6[255]; AVFilterContext *filter; snprintf(VAR_6, sizeof(VAR_6), "%d:%d:flags=0x%X", codec->width, codec->height, (unsigned)VAR_1->ost->sws_flags); if ((VAR_5 = avfilter_graph_create_filter(&filter, avfilter_get_by_name("scale"), NULL, VAR_6, NULL, VAR_0->graph)) < 0) return VAR_5; if ((VAR_5 = avfilter_link(last_filter, VAR_4, filter, 0)) < 0) return VAR_5; last_filter = filter; VAR_4 = 0; } if ((VAR_3 = choose_pixel_fmts(VAR_1->ost))) { AVFilterContext *filter; if ((VAR_5 = avfilter_graph_create_filter(&filter, avfilter_get_by_name("format"), "format", VAR_3, NULL, VAR_0->graph)) < 0) return VAR_5; if ((VAR_5 = avfilter_link(last_filter, VAR_4, filter, 0)) < 0) return VAR_5; last_filter = filter; VAR_4 = 0; av_freep(&VAR_3); } if ((VAR_5 = avfilter_link(last_filter, VAR_4, VAR_1->filter, 0)) < 0) return VAR_5; return 0; }
[ "static int FUNC_0(FilterGraph *VAR_0, OutputFilter *VAR_1, AVFilterInOut *VAR_2)\n{", "char *VAR_3;", "AVCodecContext *codec = VAR_1->ost->st->codec;", "AVFilterContext *last_filter = VAR_2->filter_ctx;", "int VAR_4 = VAR_2->VAR_4;", "int VAR_5;", "AVBufferSinkParams *buffersink_params = av_buffersink_params_alloc();", "#if FF_API_OLD_VSINK_API\nVAR_5 = avfilter_graph_create_filter(&VAR_1->filter,\navfilter_get_by_name(\"buffersink\"),\n\"VAR_2\", NULL, NULL, VAR_0->graph);", "#else\nVAR_5 = avfilter_graph_create_filter(&VAR_1->filter,\navfilter_get_by_name(\"buffersink\"),\n\"VAR_2\", NULL, buffersink_params, VAR_0->graph);", "#endif\nav_freep(&buffersink_params);", "if (VAR_5 < 0)\nreturn VAR_5;", "if (codec->width || codec->height) {", "char VAR_6[255];", "AVFilterContext *filter;", "snprintf(VAR_6, sizeof(VAR_6), \"%d:%d:flags=0x%X\",\ncodec->width,\ncodec->height,\n(unsigned)VAR_1->ost->sws_flags);", "if ((VAR_5 = avfilter_graph_create_filter(&filter, avfilter_get_by_name(\"scale\"),\nNULL, VAR_6, NULL, VAR_0->graph)) < 0)\nreturn VAR_5;", "if ((VAR_5 = avfilter_link(last_filter, VAR_4, filter, 0)) < 0)\nreturn VAR_5;", "last_filter = filter;", "VAR_4 = 0;", "}", "if ((VAR_3 = choose_pixel_fmts(VAR_1->ost))) {", "AVFilterContext *filter;", "if ((VAR_5 = avfilter_graph_create_filter(&filter,\navfilter_get_by_name(\"format\"),\n\"format\", VAR_3, NULL,\nVAR_0->graph)) < 0)\nreturn VAR_5;", "if ((VAR_5 = avfilter_link(last_filter, VAR_4, filter, 0)) < 0)\nreturn VAR_5;", "last_filter = filter;", "VAR_4 = 0;", "av_freep(&VAR_3);", "}", "if ((VAR_5 = avfilter_link(last_filter, VAR_4, VAR_1->filter, 0)) < 0)\nreturn VAR_5;", "return 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, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19, 21, 23, 25 ], [ 27, 29, 31, 33 ], [ 35, 37 ], [ 41, 43 ], [ 47 ], [ 49 ], [ 51 ], [ 55, 57, 59, 61 ], [ 63, 65, 67 ], [ 69, 71 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 85 ], [ 87, 89, 91, 93, 95 ], [ 97, 99 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 113, 115 ], [ 119 ], [ 121 ] ]
26,449
static int eightsvx_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt) { EightSvxContext *esc = avctx->priv_data; int n, out_data_size, ret; uint8_t *src, *dst; /* decode and interleave the first packet */ if (!esc->samples && avpkt) { uint8_t *deinterleaved_samples, *p = NULL; esc->samples_size = !esc->table ? avpkt->size : avctx->channels + (avpkt->size-avctx->channels) * 2; if (!(esc->samples = av_malloc(esc->samples_size))) return AVERROR(ENOMEM); /* decompress */ if (esc->table) { const uint8_t *buf = avpkt->data; uint8_t *dst; int buf_size = avpkt->size; int i, n = esc->samples_size; if (buf_size < 2) { av_log(avctx, AV_LOG_ERROR, "packet size is too small\n"); return AVERROR(EINVAL); } if (!(deinterleaved_samples = av_mallocz(n))) return AVERROR(ENOMEM); dst = p = deinterleaved_samples; /* the uncompressed starting value is contained in the first byte */ dst = deinterleaved_samples; for (i = 0; i < avctx->channels; i++) { delta_decode(dst, buf + 1, buf_size / avctx->channels - 1, buf[0], esc->table); buf += buf_size / avctx->channels; dst += n / avctx->channels - 1; } } else { deinterleaved_samples = avpkt->data; } if (avctx->channels == 2) interleave_stereo(esc->samples, deinterleaved_samples, esc->samples_size); else memcpy(esc->samples, deinterleaved_samples, esc->samples_size); av_freep(&p); } /* get output buffer */ av_assert1(!(esc->samples_size % avctx->channels || esc->samples_idx % avctx->channels)); esc->frame.nb_samples = FFMIN(MAX_FRAME_SIZE, esc->samples_size - esc->samples_idx) / avctx->channels; if ((ret = avctx->get_buffer(avctx, &esc->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } *got_frame_ptr = 1; *(AVFrame *)data = esc->frame; dst = esc->frame.data[0]; src = esc->samples + esc->samples_idx; out_data_size = esc->frame.nb_samples * avctx->channels; for (n = out_data_size; n > 0; n--) *dst++ = *src++ + 128; esc->samples_idx += out_data_size; return esc->table ? (avctx->frame_number == 0)*2 + out_data_size / 2 : out_data_size; }
true
FFmpeg
6eee9f5596074f9c0ff2cb25050b56c2914ff411
static int eightsvx_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt) { EightSvxContext *esc = avctx->priv_data; int n, out_data_size, ret; uint8_t *src, *dst; if (!esc->samples && avpkt) { uint8_t *deinterleaved_samples, *p = NULL; esc->samples_size = !esc->table ? avpkt->size : avctx->channels + (avpkt->size-avctx->channels) * 2; if (!(esc->samples = av_malloc(esc->samples_size))) return AVERROR(ENOMEM); if (esc->table) { const uint8_t *buf = avpkt->data; uint8_t *dst; int buf_size = avpkt->size; int i, n = esc->samples_size; if (buf_size < 2) { av_log(avctx, AV_LOG_ERROR, "packet size is too small\n"); return AVERROR(EINVAL); } if (!(deinterleaved_samples = av_mallocz(n))) return AVERROR(ENOMEM); dst = p = deinterleaved_samples; dst = deinterleaved_samples; for (i = 0; i < avctx->channels; i++) { delta_decode(dst, buf + 1, buf_size / avctx->channels - 1, buf[0], esc->table); buf += buf_size / avctx->channels; dst += n / avctx->channels - 1; } } else { deinterleaved_samples = avpkt->data; } if (avctx->channels == 2) interleave_stereo(esc->samples, deinterleaved_samples, esc->samples_size); else memcpy(esc->samples, deinterleaved_samples, esc->samples_size); av_freep(&p); } av_assert1(!(esc->samples_size % avctx->channels || esc->samples_idx % avctx->channels)); esc->frame.nb_samples = FFMIN(MAX_FRAME_SIZE, esc->samples_size - esc->samples_idx) / avctx->channels; if ((ret = avctx->get_buffer(avctx, &esc->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } *got_frame_ptr = 1; *(AVFrame *)data = esc->frame; dst = esc->frame.data[0]; src = esc->samples + esc->samples_idx; out_data_size = esc->frame.nb_samples * avctx->channels; for (n = out_data_size; n > 0; n--) *dst++ = *src++ + 128; esc->samples_idx += out_data_size; return esc->table ? (avctx->frame_number == 0)*2 + out_data_size / 2 : out_data_size; }
{ "code": [ " avpkt->size : avctx->channels + (avpkt->size-avctx->channels) * 2;" ], "line_no": [ 25 ] }
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3) { EightSvxContext *esc = VAR_0->priv_data; int VAR_10, VAR_5, VAR_6; uint8_t *src, *dst; if (!esc->samples && VAR_3) { uint8_t *deinterleaved_samples, *p = NULL; esc->samples_size = !esc->table ? VAR_3->size : VAR_0->channels + (VAR_3->size-VAR_0->channels) * 2; if (!(esc->samples = av_malloc(esc->samples_size))) return AVERROR(ENOMEM); if (esc->table) { const uint8_t *VAR_7 = VAR_3->VAR_1; uint8_t *dst; int VAR_8 = VAR_3->size; int VAR_9, VAR_10 = esc->samples_size; if (VAR_8 < 2) { av_log(VAR_0, AV_LOG_ERROR, "packet size is too small\VAR_10"); return AVERROR(EINVAL); } if (!(deinterleaved_samples = av_mallocz(VAR_10))) return AVERROR(ENOMEM); dst = p = deinterleaved_samples; dst = deinterleaved_samples; for (VAR_9 = 0; VAR_9 < VAR_0->channels; VAR_9++) { delta_decode(dst, VAR_7 + 1, VAR_8 / VAR_0->channels - 1, VAR_7[0], esc->table); VAR_7 += VAR_8 / VAR_0->channels; dst += VAR_10 / VAR_0->channels - 1; } } else { deinterleaved_samples = VAR_3->VAR_1; } if (VAR_0->channels == 2) interleave_stereo(esc->samples, deinterleaved_samples, esc->samples_size); else memcpy(esc->samples, deinterleaved_samples, esc->samples_size); av_freep(&p); } av_assert1(!(esc->samples_size % VAR_0->channels || esc->samples_idx % VAR_0->channels)); esc->frame.nb_samples = FFMIN(MAX_FRAME_SIZE, esc->samples_size - esc->samples_idx) / VAR_0->channels; if ((VAR_6 = VAR_0->get_buffer(VAR_0, &esc->frame)) < 0) { av_log(VAR_0, AV_LOG_ERROR, "get_buffer() failed\VAR_10"); return VAR_6; } *VAR_2 = 1; *(AVFrame *)VAR_1 = esc->frame; dst = esc->frame.VAR_1[0]; src = esc->samples + esc->samples_idx; VAR_5 = esc->frame.nb_samples * VAR_0->channels; for (VAR_10 = VAR_5; VAR_10 > 0; VAR_10--) *dst++ = *src++ + 128; esc->samples_idx += VAR_5; return esc->table ? (VAR_0->frame_number == 0)*2 + VAR_5 / 2 : VAR_5; }
[ "static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1,\nint *VAR_2, AVPacket *VAR_3)\n{", "EightSvxContext *esc = VAR_0->priv_data;", "int VAR_10, VAR_5, VAR_6;", "uint8_t *src, *dst;", "if (!esc->samples && VAR_3) {", "uint8_t *deinterleaved_samples, *p = NULL;", "esc->samples_size = !esc->table ?\nVAR_3->size : VAR_0->channels + (VAR_3->size-VAR_0->channels) * 2;", "if (!(esc->samples = av_malloc(esc->samples_size)))\nreturn AVERROR(ENOMEM);", "if (esc->table) {", "const uint8_t *VAR_7 = VAR_3->VAR_1;", "uint8_t *dst;", "int VAR_8 = VAR_3->size;", "int VAR_9, VAR_10 = esc->samples_size;", "if (VAR_8 < 2) {", "av_log(VAR_0, AV_LOG_ERROR, \"packet size is too small\\VAR_10\");", "return AVERROR(EINVAL);", "}", "if (!(deinterleaved_samples = av_mallocz(VAR_10)))\nreturn AVERROR(ENOMEM);", "dst = p = deinterleaved_samples;", "dst = deinterleaved_samples;", "for (VAR_9 = 0; VAR_9 < VAR_0->channels; VAR_9++) {", "delta_decode(dst, VAR_7 + 1, VAR_8 / VAR_0->channels - 1, VAR_7[0], esc->table);", "VAR_7 += VAR_8 / VAR_0->channels;", "dst += VAR_10 / VAR_0->channels - 1;", "}", "} else {", "deinterleaved_samples = VAR_3->VAR_1;", "}", "if (VAR_0->channels == 2)\ninterleave_stereo(esc->samples, deinterleaved_samples, esc->samples_size);", "else\nmemcpy(esc->samples, deinterleaved_samples, esc->samples_size);", "av_freep(&p);", "}", "av_assert1(!(esc->samples_size % VAR_0->channels || esc->samples_idx % VAR_0->channels));", "esc->frame.nb_samples = FFMIN(MAX_FRAME_SIZE, esc->samples_size - esc->samples_idx) / VAR_0->channels;", "if ((VAR_6 = VAR_0->get_buffer(VAR_0, &esc->frame)) < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"get_buffer() failed\\VAR_10\");", "return VAR_6;", "}", "*VAR_2 = 1;", "*(AVFrame *)VAR_1 = esc->frame;", "dst = esc->frame.VAR_1[0];", "src = esc->samples + esc->samples_idx;", "VAR_5 = esc->frame.nb_samples * VAR_0->channels;", "for (VAR_10 = VAR_5; VAR_10 > 0; VAR_10--)", "*dst++ = *src++ + 128;", "esc->samples_idx += VAR_5;", "return esc->table ?\n(VAR_0->frame_number == 0)*2 + VAR_5 / 2 :\nVAR_5;", "}" ]
[ 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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 17 ], [ 19 ], [ 23, 25 ], [ 27, 29 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55, 57 ], [ 59 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 85, 87 ], [ 89, 91 ], [ 93 ], [ 95 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 115 ], [ 117 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 135, 137, 139 ], [ 141 ] ]
26,450
static bool cmd_data_set_management(IDEState *s, uint8_t cmd) { switch (s->feature) { case DSM_TRIM: if (s->bs) { ide_sector_start_dma(s, IDE_DMA_TRIM); return false; } break; } ide_abort_command(s); return true; }
false
qemu
4be746345f13e99e468c60acbd3a355e8183e3ce
static bool cmd_data_set_management(IDEState *s, uint8_t cmd) { switch (s->feature) { case DSM_TRIM: if (s->bs) { ide_sector_start_dma(s, IDE_DMA_TRIM); return false; } break; } ide_abort_command(s); return true; }
{ "code": [], "line_no": [] }
static bool FUNC_0(IDEState *s, uint8_t cmd) { switch (s->feature) { case DSM_TRIM: if (s->bs) { ide_sector_start_dma(s, IDE_DMA_TRIM); return false; } break; } ide_abort_command(s); return true; }
[ "static bool FUNC_0(IDEState *s, uint8_t cmd)\n{", "switch (s->feature) {", "case DSM_TRIM:\nif (s->bs) {", "ide_sector_start_dma(s, IDE_DMA_TRIM);", "return false;", "}", "break;", "}", "ide_abort_command(s);", "return true;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ] ]
26,453
TranslationBlock *tb_gen_code(CPUState *cpu, target_ulong pc, target_ulong cs_base, uint32_t flags, int cflags) { CPUArchState *env = cpu->env_ptr; TranslationBlock *tb; tb_page_addr_t phys_pc, phys_page2; target_ulong virt_page2; tcg_insn_unit *gen_code_buf; int gen_code_size, search_size; #ifdef CONFIG_PROFILER int64_t ti; #endif phys_pc = get_page_addr_code(env, pc); if (use_icount && !(cflags & CF_IGNORE_ICOUNT)) { cflags |= CF_USE_ICOUNT; } tb = tb_alloc(pc); if (unlikely(!tb)) { buffer_overflow: /* flush must be done */ tb_flush(cpu); /* cannot fail at this point */ tb = tb_alloc(pc); assert(tb != NULL); /* Don't forget to invalidate previous TB info. */ tcg_ctx.tb_ctx.tb_invalidated_flag = 1; } gen_code_buf = tcg_ctx.code_gen_ptr; tb->tc_ptr = gen_code_buf; tb->cs_base = cs_base; tb->flags = flags; tb->cflags = cflags; #ifdef CONFIG_PROFILER tcg_ctx.tb_count1++; /* includes aborted translations because of exceptions */ ti = profile_getclock(); #endif tcg_func_start(&tcg_ctx); gen_intermediate_code(env, tb); trace_translate_block(tb, tb->pc, tb->tc_ptr); /* generate machine code */ tb->jmp_reset_offset[0] = TB_JMP_RESET_OFFSET_INVALID; tb->jmp_reset_offset[1] = TB_JMP_RESET_OFFSET_INVALID; tcg_ctx.tb_jmp_reset_offset = tb->jmp_reset_offset; #ifdef USE_DIRECT_JUMP tcg_ctx.tb_jmp_insn_offset = tb->jmp_insn_offset; tcg_ctx.tb_jmp_target_addr = NULL; #else tcg_ctx.tb_jmp_insn_offset = NULL; tcg_ctx.tb_jmp_target_addr = tb->jmp_target_addr; #endif #ifdef CONFIG_PROFILER tcg_ctx.tb_count++; tcg_ctx.interm_time += profile_getclock() - ti; tcg_ctx.code_time -= profile_getclock(); #endif /* ??? Overflow could be handled better here. In particular, we don't need to re-do gen_intermediate_code, nor should we re-do the tcg optimization currently hidden inside tcg_gen_code. All that should be required is to flush the TBs, allocate a new TB, re-initialize it per above, and re-do the actual code generation. */ gen_code_size = tcg_gen_code(&tcg_ctx, tb); if (unlikely(gen_code_size < 0)) { goto buffer_overflow; } search_size = encode_search(tb, (void *)gen_code_buf + gen_code_size); if (unlikely(search_size < 0)) { goto buffer_overflow; } #ifdef CONFIG_PROFILER tcg_ctx.code_time += profile_getclock(); tcg_ctx.code_in_len += tb->size; tcg_ctx.code_out_len += gen_code_size; tcg_ctx.search_out_len += search_size; #endif #ifdef DEBUG_DISAS if (qemu_loglevel_mask(CPU_LOG_TB_OUT_ASM) && qemu_log_in_addr_range(tb->pc)) { qemu_log("OUT: [size=%d]\n", gen_code_size); log_disas(tb->tc_ptr, gen_code_size); qemu_log("\n"); qemu_log_flush(); } #endif tcg_ctx.code_gen_ptr = (void *) ROUND_UP((uintptr_t)gen_code_buf + gen_code_size + search_size, CODE_GEN_ALIGN); /* init jump list */ assert(((uintptr_t)tb & 3) == 0); tb->jmp_list_first = (uintptr_t)tb | 2; tb->jmp_list_next[0] = (uintptr_t)NULL; tb->jmp_list_next[1] = (uintptr_t)NULL; /* init original jump addresses wich has been set during tcg_gen_code() */ if (tb->jmp_reset_offset[0] != TB_JMP_RESET_OFFSET_INVALID) { tb_reset_jump(tb, 0); } if (tb->jmp_reset_offset[1] != TB_JMP_RESET_OFFSET_INVALID) { tb_reset_jump(tb, 1); } /* check next page if needed */ virt_page2 = (pc + tb->size - 1) & TARGET_PAGE_MASK; phys_page2 = -1; if ((pc & TARGET_PAGE_MASK) != virt_page2) { phys_page2 = get_page_addr_code(env, virt_page2); } /* As long as consistency of the TB stuff is provided by tb_lock in user * mode and is implicit in single-threaded softmmu emulation, no explicit * memory barrier is required before tb_link_page() makes the TB visible * through the physical hash table and physical page list. */ tb_link_page(tb, phys_pc, phys_page2); return tb; }
false
qemu
6f789be56d3f38e9214dafcfab3bf9be7191f370
TranslationBlock *tb_gen_code(CPUState *cpu, target_ulong pc, target_ulong cs_base, uint32_t flags, int cflags) { CPUArchState *env = cpu->env_ptr; TranslationBlock *tb; tb_page_addr_t phys_pc, phys_page2; target_ulong virt_page2; tcg_insn_unit *gen_code_buf; int gen_code_size, search_size; #ifdef CONFIG_PROFILER int64_t ti; #endif phys_pc = get_page_addr_code(env, pc); if (use_icount && !(cflags & CF_IGNORE_ICOUNT)) { cflags |= CF_USE_ICOUNT; } tb = tb_alloc(pc); if (unlikely(!tb)) { buffer_overflow: tb_flush(cpu); tb = tb_alloc(pc); assert(tb != NULL); tcg_ctx.tb_ctx.tb_invalidated_flag = 1; } gen_code_buf = tcg_ctx.code_gen_ptr; tb->tc_ptr = gen_code_buf; tb->cs_base = cs_base; tb->flags = flags; tb->cflags = cflags; #ifdef CONFIG_PROFILER tcg_ctx.tb_count1++; ti = profile_getclock(); #endif tcg_func_start(&tcg_ctx); gen_intermediate_code(env, tb); trace_translate_block(tb, tb->pc, tb->tc_ptr); tb->jmp_reset_offset[0] = TB_JMP_RESET_OFFSET_INVALID; tb->jmp_reset_offset[1] = TB_JMP_RESET_OFFSET_INVALID; tcg_ctx.tb_jmp_reset_offset = tb->jmp_reset_offset; #ifdef USE_DIRECT_JUMP tcg_ctx.tb_jmp_insn_offset = tb->jmp_insn_offset; tcg_ctx.tb_jmp_target_addr = NULL; #else tcg_ctx.tb_jmp_insn_offset = NULL; tcg_ctx.tb_jmp_target_addr = tb->jmp_target_addr; #endif #ifdef CONFIG_PROFILER tcg_ctx.tb_count++; tcg_ctx.interm_time += profile_getclock() - ti; tcg_ctx.code_time -= profile_getclock(); #endif gen_code_size = tcg_gen_code(&tcg_ctx, tb); if (unlikely(gen_code_size < 0)) { goto buffer_overflow; } search_size = encode_search(tb, (void *)gen_code_buf + gen_code_size); if (unlikely(search_size < 0)) { goto buffer_overflow; } #ifdef CONFIG_PROFILER tcg_ctx.code_time += profile_getclock(); tcg_ctx.code_in_len += tb->size; tcg_ctx.code_out_len += gen_code_size; tcg_ctx.search_out_len += search_size; #endif #ifdef DEBUG_DISAS if (qemu_loglevel_mask(CPU_LOG_TB_OUT_ASM) && qemu_log_in_addr_range(tb->pc)) { qemu_log("OUT: [size=%d]\n", gen_code_size); log_disas(tb->tc_ptr, gen_code_size); qemu_log("\n"); qemu_log_flush(); } #endif tcg_ctx.code_gen_ptr = (void *) ROUND_UP((uintptr_t)gen_code_buf + gen_code_size + search_size, CODE_GEN_ALIGN); assert(((uintptr_t)tb & 3) == 0); tb->jmp_list_first = (uintptr_t)tb | 2; tb->jmp_list_next[0] = (uintptr_t)NULL; tb->jmp_list_next[1] = (uintptr_t)NULL; if (tb->jmp_reset_offset[0] != TB_JMP_RESET_OFFSET_INVALID) { tb_reset_jump(tb, 0); } if (tb->jmp_reset_offset[1] != TB_JMP_RESET_OFFSET_INVALID) { tb_reset_jump(tb, 1); } virt_page2 = (pc + tb->size - 1) & TARGET_PAGE_MASK; phys_page2 = -1; if ((pc & TARGET_PAGE_MASK) != virt_page2) { phys_page2 = get_page_addr_code(env, virt_page2); } tb_link_page(tb, phys_pc, phys_page2); return tb; }
{ "code": [], "line_no": [] }
TranslationBlock *FUNC_0(CPUState *cpu, target_ulong pc, target_ulong cs_base, uint32_t flags, int cflags) { CPUArchState *env = cpu->env_ptr; TranslationBlock *tb; tb_page_addr_t phys_pc, phys_page2; target_ulong virt_page2; tcg_insn_unit *gen_code_buf; int VAR_0, VAR_1; #ifdef CONFIG_PROFILER int64_t ti; #endif phys_pc = get_page_addr_code(env, pc); if (use_icount && !(cflags & CF_IGNORE_ICOUNT)) { cflags |= CF_USE_ICOUNT; } tb = tb_alloc(pc); if (unlikely(!tb)) { buffer_overflow: tb_flush(cpu); tb = tb_alloc(pc); assert(tb != NULL); tcg_ctx.tb_ctx.tb_invalidated_flag = 1; } gen_code_buf = tcg_ctx.code_gen_ptr; tb->tc_ptr = gen_code_buf; tb->cs_base = cs_base; tb->flags = flags; tb->cflags = cflags; #ifdef CONFIG_PROFILER tcg_ctx.tb_count1++; ti = profile_getclock(); #endif tcg_func_start(&tcg_ctx); gen_intermediate_code(env, tb); trace_translate_block(tb, tb->pc, tb->tc_ptr); tb->jmp_reset_offset[0] = TB_JMP_RESET_OFFSET_INVALID; tb->jmp_reset_offset[1] = TB_JMP_RESET_OFFSET_INVALID; tcg_ctx.tb_jmp_reset_offset = tb->jmp_reset_offset; #ifdef USE_DIRECT_JUMP tcg_ctx.tb_jmp_insn_offset = tb->jmp_insn_offset; tcg_ctx.tb_jmp_target_addr = NULL; #else tcg_ctx.tb_jmp_insn_offset = NULL; tcg_ctx.tb_jmp_target_addr = tb->jmp_target_addr; #endif #ifdef CONFIG_PROFILER tcg_ctx.tb_count++; tcg_ctx.interm_time += profile_getclock() - ti; tcg_ctx.code_time -= profile_getclock(); #endif VAR_0 = tcg_gen_code(&tcg_ctx, tb); if (unlikely(VAR_0 < 0)) { goto buffer_overflow; } VAR_1 = encode_search(tb, (void *)gen_code_buf + VAR_0); if (unlikely(VAR_1 < 0)) { goto buffer_overflow; } #ifdef CONFIG_PROFILER tcg_ctx.code_time += profile_getclock(); tcg_ctx.code_in_len += tb->size; tcg_ctx.code_out_len += VAR_0; tcg_ctx.search_out_len += VAR_1; #endif #ifdef DEBUG_DISAS if (qemu_loglevel_mask(CPU_LOG_TB_OUT_ASM) && qemu_log_in_addr_range(tb->pc)) { qemu_log("OUT: [size=%d]\n", VAR_0); log_disas(tb->tc_ptr, VAR_0); qemu_log("\n"); qemu_log_flush(); } #endif tcg_ctx.code_gen_ptr = (void *) ROUND_UP((uintptr_t)gen_code_buf + VAR_0 + VAR_1, CODE_GEN_ALIGN); assert(((uintptr_t)tb & 3) == 0); tb->jmp_list_first = (uintptr_t)tb | 2; tb->jmp_list_next[0] = (uintptr_t)NULL; tb->jmp_list_next[1] = (uintptr_t)NULL; if (tb->jmp_reset_offset[0] != TB_JMP_RESET_OFFSET_INVALID) { tb_reset_jump(tb, 0); } if (tb->jmp_reset_offset[1] != TB_JMP_RESET_OFFSET_INVALID) { tb_reset_jump(tb, 1); } virt_page2 = (pc + tb->size - 1) & TARGET_PAGE_MASK; phys_page2 = -1; if ((pc & TARGET_PAGE_MASK) != virt_page2) { phys_page2 = get_page_addr_code(env, virt_page2); } tb_link_page(tb, phys_pc, phys_page2); return tb; }
[ "TranslationBlock *FUNC_0(CPUState *cpu,\ntarget_ulong pc, target_ulong cs_base,\nuint32_t flags, int cflags)\n{", "CPUArchState *env = cpu->env_ptr;", "TranslationBlock *tb;", "tb_page_addr_t phys_pc, phys_page2;", "target_ulong virt_page2;", "tcg_insn_unit *gen_code_buf;", "int VAR_0, VAR_1;", "#ifdef CONFIG_PROFILER\nint64_t ti;", "#endif\nphys_pc = get_page_addr_code(env, pc);", "if (use_icount && !(cflags & CF_IGNORE_ICOUNT)) {", "cflags |= CF_USE_ICOUNT;", "}", "tb = tb_alloc(pc);", "if (unlikely(!tb)) {", "buffer_overflow:\ntb_flush(cpu);", "tb = tb_alloc(pc);", "assert(tb != NULL);", "tcg_ctx.tb_ctx.tb_invalidated_flag = 1;", "}", "gen_code_buf = tcg_ctx.code_gen_ptr;", "tb->tc_ptr = gen_code_buf;", "tb->cs_base = cs_base;", "tb->flags = flags;", "tb->cflags = cflags;", "#ifdef CONFIG_PROFILER\ntcg_ctx.tb_count1++;", "ti = profile_getclock();", "#endif\ntcg_func_start(&tcg_ctx);", "gen_intermediate_code(env, tb);", "trace_translate_block(tb, tb->pc, tb->tc_ptr);", "tb->jmp_reset_offset[0] = TB_JMP_RESET_OFFSET_INVALID;", "tb->jmp_reset_offset[1] = TB_JMP_RESET_OFFSET_INVALID;", "tcg_ctx.tb_jmp_reset_offset = tb->jmp_reset_offset;", "#ifdef USE_DIRECT_JUMP\ntcg_ctx.tb_jmp_insn_offset = tb->jmp_insn_offset;", "tcg_ctx.tb_jmp_target_addr = NULL;", "#else\ntcg_ctx.tb_jmp_insn_offset = NULL;", "tcg_ctx.tb_jmp_target_addr = tb->jmp_target_addr;", "#endif\n#ifdef CONFIG_PROFILER\ntcg_ctx.tb_count++;", "tcg_ctx.interm_time += profile_getclock() - ti;", "tcg_ctx.code_time -= profile_getclock();", "#endif\nVAR_0 = tcg_gen_code(&tcg_ctx, tb);", "if (unlikely(VAR_0 < 0)) {", "goto buffer_overflow;", "}", "VAR_1 = encode_search(tb, (void *)gen_code_buf + VAR_0);", "if (unlikely(VAR_1 < 0)) {", "goto buffer_overflow;", "}", "#ifdef CONFIG_PROFILER\ntcg_ctx.code_time += profile_getclock();", "tcg_ctx.code_in_len += tb->size;", "tcg_ctx.code_out_len += VAR_0;", "tcg_ctx.search_out_len += VAR_1;", "#endif\n#ifdef DEBUG_DISAS\nif (qemu_loglevel_mask(CPU_LOG_TB_OUT_ASM) &&\nqemu_log_in_addr_range(tb->pc)) {", "qemu_log(\"OUT: [size=%d]\\n\", VAR_0);", "log_disas(tb->tc_ptr, VAR_0);", "qemu_log(\"\\n\");", "qemu_log_flush();", "}", "#endif\ntcg_ctx.code_gen_ptr = (void *)\nROUND_UP((uintptr_t)gen_code_buf + VAR_0 + VAR_1,\nCODE_GEN_ALIGN);", "assert(((uintptr_t)tb & 3) == 0);", "tb->jmp_list_first = (uintptr_t)tb | 2;", "tb->jmp_list_next[0] = (uintptr_t)NULL;", "tb->jmp_list_next[1] = (uintptr_t)NULL;", "if (tb->jmp_reset_offset[0] != TB_JMP_RESET_OFFSET_INVALID) {", "tb_reset_jump(tb, 0);", "}", "if (tb->jmp_reset_offset[1] != TB_JMP_RESET_OFFSET_INVALID) {", "tb_reset_jump(tb, 1);", "}", "virt_page2 = (pc + tb->size - 1) & TARGET_PAGE_MASK;", "phys_page2 = -1;", "if ((pc & TARGET_PAGE_MASK) != virt_page2) {", "phys_page2 = get_page_addr_code(env, virt_page2);", "}", "tb_link_page(tb, phys_pc, phys_page2);", "return tb;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21, 23 ], [ 25, 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43, 47 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 75, 77 ], [ 81 ], [ 83, 87 ], [ 91 ], [ 95 ], [ 101 ], [ 103 ], [ 105 ], [ 107, 109 ], [ 111 ], [ 113, 115 ], [ 117 ], [ 119, 123, 125 ], [ 127 ], [ 129 ], [ 131, 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 163, 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173, 177, 179, 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193, 197, 199, 201 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 255 ], [ 257 ], [ 259 ] ]
26,454
void scsi_bus_legacy_handle_cmdline(SCSIBus *bus, bool deprecated) { Location loc; DriveInfo *dinfo; int unit; loc_push_none(&loc); for (unit = 0; unit <= bus->info->max_target; unit++) { dinfo = drive_get(IF_SCSI, bus->busnr, unit); if (dinfo == NULL) { continue; } qemu_opts_loc_restore(dinfo->opts); if (deprecated) { /* Handling -drive not claimed by machine initialization */ if (blk_get_attached_dev(blk_by_legacy_dinfo(dinfo))) { continue; /* claimed */ } if (!dinfo->is_default) { error_report("warning: bus=%d,unit=%d is deprecated with this" " machine type", bus->busnr, unit); } } scsi_bus_legacy_add_drive(bus, blk_by_legacy_dinfo(dinfo), unit, false, -1, NULL, &error_fatal); } loc_pop(&loc); }
false
qemu
3dc6f8693694a649a9c83f1e2746565b47683923
void scsi_bus_legacy_handle_cmdline(SCSIBus *bus, bool deprecated) { Location loc; DriveInfo *dinfo; int unit; loc_push_none(&loc); for (unit = 0; unit <= bus->info->max_target; unit++) { dinfo = drive_get(IF_SCSI, bus->busnr, unit); if (dinfo == NULL) { continue; } qemu_opts_loc_restore(dinfo->opts); if (deprecated) { if (blk_get_attached_dev(blk_by_legacy_dinfo(dinfo))) { continue; } if (!dinfo->is_default) { error_report("warning: bus=%d,unit=%d is deprecated with this" " machine type", bus->busnr, unit); } } scsi_bus_legacy_add_drive(bus, blk_by_legacy_dinfo(dinfo), unit, false, -1, NULL, &error_fatal); } loc_pop(&loc); }
{ "code": [], "line_no": [] }
void FUNC_0(SCSIBus *VAR_0, bool VAR_1) { Location loc; DriveInfo *dinfo; int VAR_2; loc_push_none(&loc); for (VAR_2 = 0; VAR_2 <= VAR_0->info->max_target; VAR_2++) { dinfo = drive_get(IF_SCSI, VAR_0->busnr, VAR_2); if (dinfo == NULL) { continue; } qemu_opts_loc_restore(dinfo->opts); if (VAR_1) { if (blk_get_attached_dev(blk_by_legacy_dinfo(dinfo))) { continue; } if (!dinfo->is_default) { error_report("warning: VAR_0=%d,VAR_2=%d is VAR_1 with this" " machine type", VAR_0->busnr, VAR_2); } } scsi_bus_legacy_add_drive(VAR_0, blk_by_legacy_dinfo(dinfo), VAR_2, false, -1, NULL, &error_fatal); } loc_pop(&loc); }
[ "void FUNC_0(SCSIBus *VAR_0, bool VAR_1)\n{", "Location loc;", "DriveInfo *dinfo;", "int VAR_2;", "loc_push_none(&loc);", "for (VAR_2 = 0; VAR_2 <= VAR_0->info->max_target; VAR_2++) {", "dinfo = drive_get(IF_SCSI, VAR_0->busnr, VAR_2);", "if (dinfo == NULL) {", "continue;", "}", "qemu_opts_loc_restore(dinfo->opts);", "if (VAR_1) {", "if (blk_get_attached_dev(blk_by_legacy_dinfo(dinfo))) {", "continue;", "}", "if (!dinfo->is_default) {", "error_report(\"warning: VAR_0=%d,VAR_2=%d is VAR_1 with this\"\n\" machine type\",\nVAR_0->busnr, VAR_2);", "}", "}", "scsi_bus_legacy_add_drive(VAR_0, blk_by_legacy_dinfo(dinfo),\nVAR_2, false, -1, NULL, &error_fatal);", "}", "loc_pop(&loc);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39, 41, 43 ], [ 45 ], [ 47 ], [ 49, 51 ], [ 53 ], [ 55 ], [ 57 ] ]
26,455
static void axienet_eth_rx_notify(void *opaque) { XilinxAXIEnet *s = XILINX_AXI_ENET(opaque); while (s->rxsize && stream_can_push(s->tx_dev, axienet_eth_rx_notify, s)) { size_t ret = stream_push(s->tx_dev, (void *)s->rxmem + s->rxpos, s->rxsize, s->rxapp); s->rxsize -= ret; s->rxpos += ret; if (!s->rxsize) { s->regs[R_IS] |= IS_RX_COMPLETE; g_free(s->rxapp); } } enet_update_irq(s); }
false
qemu
42bb9c9178ae7ac4c439172b1ae99cc29188a5c6
static void axienet_eth_rx_notify(void *opaque) { XilinxAXIEnet *s = XILINX_AXI_ENET(opaque); while (s->rxsize && stream_can_push(s->tx_dev, axienet_eth_rx_notify, s)) { size_t ret = stream_push(s->tx_dev, (void *)s->rxmem + s->rxpos, s->rxsize, s->rxapp); s->rxsize -= ret; s->rxpos += ret; if (!s->rxsize) { s->regs[R_IS] |= IS_RX_COMPLETE; g_free(s->rxapp); } } enet_update_irq(s); }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0) { XilinxAXIEnet *s = XILINX_AXI_ENET(VAR_0); while (s->rxsize && stream_can_push(s->tx_dev, FUNC_0, s)) { size_t ret = stream_push(s->tx_dev, (void *)s->rxmem + s->rxpos, s->rxsize, s->rxapp); s->rxsize -= ret; s->rxpos += ret; if (!s->rxsize) { s->regs[R_IS] |= IS_RX_COMPLETE; g_free(s->rxapp); } } enet_update_irq(s); }
[ "static void FUNC_0(void *VAR_0)\n{", "XilinxAXIEnet *s = XILINX_AXI_ENET(VAR_0);", "while (s->rxsize && stream_can_push(s->tx_dev, FUNC_0, s)) {", "size_t ret = stream_push(s->tx_dev, (void *)s->rxmem + s->rxpos,\ns->rxsize, s->rxapp);", "s->rxsize -= ret;", "s->rxpos += ret;", "if (!s->rxsize) {", "s->regs[R_IS] |= IS_RX_COMPLETE;", "g_free(s->rxapp);", "}", "}", "enet_update_irq(s);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11, 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ] ]
26,456
START_TEST(qint_from_int64_test) { QInt *qi; const int64_t value = 0x1234567890abcdefLL; qi = qint_from_int(value); fail_unless((int64_t) qi->value == value); QDECREF(qi); }
false
qemu
65cdadd2e2de76f7db3bf6b7d8dd8c67abff9659
START_TEST(qint_from_int64_test) { QInt *qi; const int64_t value = 0x1234567890abcdefLL; qi = qint_from_int(value); fail_unless((int64_t) qi->value == value); QDECREF(qi); }
{ "code": [], "line_no": [] }
FUNC_0(VAR_0) { QInt *qi; const int64_t VAR_1 = 0x1234567890abcdefLL; qi = qint_from_int(VAR_1); fail_unless((int64_t) qi->VAR_1 == VAR_1); QDECREF(qi); }
[ "FUNC_0(VAR_0)\n{", "QInt *qi;", "const int64_t VAR_1 = 0x1234567890abcdefLL;", "qi = qint_from_int(VAR_1);", "fail_unless((int64_t) qi->VAR_1 == VAR_1);", "QDECREF(qi);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ] ]
26,457
static int exynos4210_fimd_init(SysBusDevice *dev) { Exynos4210fimdState *s = FROM_SYSBUS(Exynos4210fimdState, dev); s->ifb = NULL; sysbus_init_irq(dev, &s->irq[0]); sysbus_init_irq(dev, &s->irq[1]); sysbus_init_irq(dev, &s->irq[2]); memory_region_init_io(&s->iomem, &exynos4210_fimd_mmio_ops, s, "exynos4210.fimd", FIMD_REGS_SIZE); sysbus_init_mmio(dev, &s->iomem); s->console = graphic_console_init(exynos4210_fimd_update, exynos4210_fimd_invalidate, NULL, NULL, s); return 0; }
false
qemu
2c62f08ddbf3fa80dc7202eb9a2ea60ae44e2cc5
static int exynos4210_fimd_init(SysBusDevice *dev) { Exynos4210fimdState *s = FROM_SYSBUS(Exynos4210fimdState, dev); s->ifb = NULL; sysbus_init_irq(dev, &s->irq[0]); sysbus_init_irq(dev, &s->irq[1]); sysbus_init_irq(dev, &s->irq[2]); memory_region_init_io(&s->iomem, &exynos4210_fimd_mmio_ops, s, "exynos4210.fimd", FIMD_REGS_SIZE); sysbus_init_mmio(dev, &s->iomem); s->console = graphic_console_init(exynos4210_fimd_update, exynos4210_fimd_invalidate, NULL, NULL, s); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(SysBusDevice *VAR_0) { Exynos4210fimdState *s = FROM_SYSBUS(Exynos4210fimdState, VAR_0); s->ifb = NULL; sysbus_init_irq(VAR_0, &s->irq[0]); sysbus_init_irq(VAR_0, &s->irq[1]); sysbus_init_irq(VAR_0, &s->irq[2]); memory_region_init_io(&s->iomem, &exynos4210_fimd_mmio_ops, s, "exynos4210.fimd", FIMD_REGS_SIZE); sysbus_init_mmio(VAR_0, &s->iomem); s->console = graphic_console_init(exynos4210_fimd_update, exynos4210_fimd_invalidate, NULL, NULL, s); return 0; }
[ "static int FUNC_0(SysBusDevice *VAR_0)\n{", "Exynos4210fimdState *s = FROM_SYSBUS(Exynos4210fimdState, VAR_0);", "s->ifb = NULL;", "sysbus_init_irq(VAR_0, &s->irq[0]);", "sysbus_init_irq(VAR_0, &s->irq[1]);", "sysbus_init_irq(VAR_0, &s->irq[2]);", "memory_region_init_io(&s->iomem, &exynos4210_fimd_mmio_ops, s,\n\"exynos4210.fimd\", FIMD_REGS_SIZE);", "sysbus_init_mmio(VAR_0, &s->iomem);", "s->console = graphic_console_init(exynos4210_fimd_update,\nexynos4210_fimd_invalidate, NULL, NULL, s);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 21, 23 ], [ 25 ], [ 27, 29 ], [ 33 ], [ 35 ] ]
26,460
void helper_fsqrtq(CPUSPARCState *env) { clear_float_exceptions(env); QT0 = float128_sqrt(QT1, &env->fp_status); check_ieee_exceptions(env); }
false
qemu
7385aed20db5d83979f683b9d0048674411e963c
void helper_fsqrtq(CPUSPARCState *env) { clear_float_exceptions(env); QT0 = float128_sqrt(QT1, &env->fp_status); check_ieee_exceptions(env); }
{ "code": [], "line_no": [] }
void FUNC_0(CPUSPARCState *VAR_0) { clear_float_exceptions(VAR_0); QT0 = float128_sqrt(QT1, &VAR_0->fp_status); check_ieee_exceptions(VAR_0); }
[ "void FUNC_0(CPUSPARCState *VAR_0)\n{", "clear_float_exceptions(VAR_0);", "QT0 = float128_sqrt(QT1, &VAR_0->fp_status);", "check_ieee_exceptions(VAR_0);", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ] ]
26,461
static void tpm_tis_abort(TPMState *s, uint8_t locty) { TPMTISEmuState *tis = &s->s.tis; tis->loc[locty].r_offset = 0; tis->loc[locty].w_offset = 0; DPRINTF("tpm_tis: tis_abort: new active locality is %d\n", tis->next_locty); /* * Need to react differently depending on who's aborting now and * which locality will become active afterwards. */ if (tis->aborting_locty == tis->next_locty) { tis->loc[tis->aborting_locty].state = TPM_TIS_STATE_READY; tis->loc[tis->aborting_locty].sts = TPM_TIS_STS_COMMAND_READY; tpm_tis_raise_irq(s, tis->aborting_locty, TPM_TIS_INT_COMMAND_READY); } /* locality after abort is another one than the current one */ tpm_tis_new_active_locality(s, tis->next_locty); tis->next_locty = TPM_TIS_NO_LOCALITY; /* nobody's aborting a command anymore */ tis->aborting_locty = TPM_TIS_NO_LOCALITY; }
false
qemu
fd859081453f94c3cbd6527289e41b7fddbf645f
static void tpm_tis_abort(TPMState *s, uint8_t locty) { TPMTISEmuState *tis = &s->s.tis; tis->loc[locty].r_offset = 0; tis->loc[locty].w_offset = 0; DPRINTF("tpm_tis: tis_abort: new active locality is %d\n", tis->next_locty); if (tis->aborting_locty == tis->next_locty) { tis->loc[tis->aborting_locty].state = TPM_TIS_STATE_READY; tis->loc[tis->aborting_locty].sts = TPM_TIS_STS_COMMAND_READY; tpm_tis_raise_irq(s, tis->aborting_locty, TPM_TIS_INT_COMMAND_READY); } tpm_tis_new_active_locality(s, tis->next_locty); tis->next_locty = TPM_TIS_NO_LOCALITY; tis->aborting_locty = TPM_TIS_NO_LOCALITY; }
{ "code": [], "line_no": [] }
static void FUNC_0(TPMState *VAR_0, uint8_t VAR_1) { TPMTISEmuState *tis = &VAR_0->VAR_0.tis; tis->loc[VAR_1].r_offset = 0; tis->loc[VAR_1].w_offset = 0; DPRINTF("tpm_tis: tis_abort: new active locality is %d\n", tis->next_locty); if (tis->aborting_locty == tis->next_locty) { tis->loc[tis->aborting_locty].state = TPM_TIS_STATE_READY; tis->loc[tis->aborting_locty].sts = TPM_TIS_STS_COMMAND_READY; tpm_tis_raise_irq(VAR_0, tis->aborting_locty, TPM_TIS_INT_COMMAND_READY); } tpm_tis_new_active_locality(VAR_0, tis->next_locty); tis->next_locty = TPM_TIS_NO_LOCALITY; tis->aborting_locty = TPM_TIS_NO_LOCALITY; }
[ "static void FUNC_0(TPMState *VAR_0, uint8_t VAR_1)\n{", "TPMTISEmuState *tis = &VAR_0->VAR_0.tis;", "tis->loc[VAR_1].r_offset = 0;", "tis->loc[VAR_1].w_offset = 0;", "DPRINTF(\"tpm_tis: tis_abort: new active locality is %d\\n\", tis->next_locty);", "if (tis->aborting_locty == tis->next_locty) {", "tis->loc[tis->aborting_locty].state = TPM_TIS_STATE_READY;", "tis->loc[tis->aborting_locty].sts = TPM_TIS_STS_COMMAND_READY;", "tpm_tis_raise_irq(VAR_0, tis->aborting_locty, TPM_TIS_INT_COMMAND_READY);", "}", "tpm_tis_new_active_locality(VAR_0, tis->next_locty);", "tis->next_locty = TPM_TIS_NO_LOCALITY;", "tis->aborting_locty = TPM_TIS_NO_LOCALITY;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 15 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 41 ], [ 45 ], [ 49 ], [ 51 ] ]
26,462
static TPMInfo *qmp_query_tpm_inst(TPMBackend *drv) { TPMInfo *res = g_new0(TPMInfo, 1); TPMPassthroughOptions *tpo; res->id = g_strdup(drv->id); res->model = drv->fe_model; res->options = g_new0(TpmTypeOptions, 1); switch (drv->ops->type) { case TPM_TYPE_PASSTHROUGH: res->options->type = TPM_TYPE_OPTIONS_KIND_PASSTHROUGH; tpo = g_new0(TPMPassthroughOptions, 1); res->options->u.passthrough = tpo; if (drv->path) { tpo->path = g_strdup(drv->path); tpo->has_path = true; } if (drv->cancel_path) { tpo->cancel_path = g_strdup(drv->cancel_path); tpo->has_cancel_path = true; } break; case TPM_TYPE__MAX: break; } return res; }
false
qemu
32bafa8fdd098d52fbf1102d5a5e48d29398c0aa
static TPMInfo *qmp_query_tpm_inst(TPMBackend *drv) { TPMInfo *res = g_new0(TPMInfo, 1); TPMPassthroughOptions *tpo; res->id = g_strdup(drv->id); res->model = drv->fe_model; res->options = g_new0(TpmTypeOptions, 1); switch (drv->ops->type) { case TPM_TYPE_PASSTHROUGH: res->options->type = TPM_TYPE_OPTIONS_KIND_PASSTHROUGH; tpo = g_new0(TPMPassthroughOptions, 1); res->options->u.passthrough = tpo; if (drv->path) { tpo->path = g_strdup(drv->path); tpo->has_path = true; } if (drv->cancel_path) { tpo->cancel_path = g_strdup(drv->cancel_path); tpo->has_cancel_path = true; } break; case TPM_TYPE__MAX: break; } return res; }
{ "code": [], "line_no": [] }
static TPMInfo *FUNC_0(TPMBackend *drv) { TPMInfo *res = g_new0(TPMInfo, 1); TPMPassthroughOptions *tpo; res->id = g_strdup(drv->id); res->model = drv->fe_model; res->options = g_new0(TpmTypeOptions, 1); switch (drv->ops->type) { case TPM_TYPE_PASSTHROUGH: res->options->type = TPM_TYPE_OPTIONS_KIND_PASSTHROUGH; tpo = g_new0(TPMPassthroughOptions, 1); res->options->u.passthrough = tpo; if (drv->path) { tpo->path = g_strdup(drv->path); tpo->has_path = true; } if (drv->cancel_path) { tpo->cancel_path = g_strdup(drv->cancel_path); tpo->has_cancel_path = true; } break; case TPM_TYPE__MAX: break; } return res; }
[ "static TPMInfo *FUNC_0(TPMBackend *drv)\n{", "TPMInfo *res = g_new0(TPMInfo, 1);", "TPMPassthroughOptions *tpo;", "res->id = g_strdup(drv->id);", "res->model = drv->fe_model;", "res->options = g_new0(TpmTypeOptions, 1);", "switch (drv->ops->type) {", "case TPM_TYPE_PASSTHROUGH:\nres->options->type = TPM_TYPE_OPTIONS_KIND_PASSTHROUGH;", "tpo = g_new0(TPMPassthroughOptions, 1);", "res->options->u.passthrough = tpo;", "if (drv->path) {", "tpo->path = g_strdup(drv->path);", "tpo->has_path = true;", "}", "if (drv->cancel_path) {", "tpo->cancel_path = g_strdup(drv->cancel_path);", "tpo->has_cancel_path = true;", "}", "break;", "case TPM_TYPE__MAX:\nbreak;", "}", "return res;", "}" ]
[ 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 ], [ 51 ], [ 55 ], [ 57 ] ]
26,466
static void qemu_file_set_if_error(QEMUFile *f, int ret) { if (ret < 0 && !f->last_error) { qemu_file_set_error(f, ret); } }
false
qemu
c10682cb031525a8bdf3999ef6a033777929d304
static void qemu_file_set_if_error(QEMUFile *f, int ret) { if (ret < 0 && !f->last_error) { qemu_file_set_error(f, ret); } }
{ "code": [], "line_no": [] }
static void FUNC_0(QEMUFile *VAR_0, int VAR_1) { if (VAR_1 < 0 && !VAR_0->last_error) { qemu_file_set_error(VAR_0, VAR_1); } }
[ "static void FUNC_0(QEMUFile *VAR_0, int VAR_1)\n{", "if (VAR_1 < 0 && !VAR_0->last_error) {", "qemu_file_set_error(VAR_0, VAR_1);", "}", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ] ]
26,467
static gboolean pty_chr_read(GIOChannel *chan, GIOCondition cond, void *opaque) { CharDriverState *chr = opaque; PtyCharDriver *s = chr->opaque; gsize size, len; uint8_t buf[READ_BUF_LEN]; GIOStatus status; len = sizeof(buf); if (len > s->read_bytes) len = s->read_bytes; if (len == 0) return FALSE; status = g_io_channel_read_chars(s->fd, (gchar *)buf, len, &size, NULL); if (status != G_IO_STATUS_NORMAL) { pty_chr_state(chr, 0); return FALSE; } else { pty_chr_state(chr, 1); qemu_chr_be_write(chr, buf, size); } return TRUE; }
false
qemu
cdbf6e165988ab9d7c01da03b9e27bb8ac0c76aa
static gboolean pty_chr_read(GIOChannel *chan, GIOCondition cond, void *opaque) { CharDriverState *chr = opaque; PtyCharDriver *s = chr->opaque; gsize size, len; uint8_t buf[READ_BUF_LEN]; GIOStatus status; len = sizeof(buf); if (len > s->read_bytes) len = s->read_bytes; if (len == 0) return FALSE; status = g_io_channel_read_chars(s->fd, (gchar *)buf, len, &size, NULL); if (status != G_IO_STATUS_NORMAL) { pty_chr_state(chr, 0); return FALSE; } else { pty_chr_state(chr, 1); qemu_chr_be_write(chr, buf, size); } return TRUE; }
{ "code": [], "line_no": [] }
static gboolean FUNC_0(GIOChannel *chan, GIOCondition cond, void *opaque) { CharDriverState *chr = opaque; PtyCharDriver *s = chr->opaque; gsize size, len; uint8_t buf[READ_BUF_LEN]; GIOStatus status; len = sizeof(buf); if (len > s->read_bytes) len = s->read_bytes; if (len == 0) return FALSE; status = g_io_channel_read_chars(s->fd, (gchar *)buf, len, &size, NULL); if (status != G_IO_STATUS_NORMAL) { pty_chr_state(chr, 0); return FALSE; } else { pty_chr_state(chr, 1); qemu_chr_be_write(chr, buf, size); } return TRUE; }
[ "static gboolean FUNC_0(GIOChannel *chan, GIOCondition cond, void *opaque)\n{", "CharDriverState *chr = opaque;", "PtyCharDriver *s = chr->opaque;", "gsize size, len;", "uint8_t buf[READ_BUF_LEN];", "GIOStatus status;", "len = sizeof(buf);", "if (len > s->read_bytes)\nlen = s->read_bytes;", "if (len == 0)\nreturn FALSE;", "status = g_io_channel_read_chars(s->fd, (gchar *)buf, len, &size, NULL);", "if (status != G_IO_STATUS_NORMAL) {", "pty_chr_state(chr, 0);", "return FALSE;", "} else {", "pty_chr_state(chr, 1);", "qemu_chr_be_write(chr, buf, size);", "}", "return TRUE;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19, 21 ], [ 23, 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ] ]
26,469
void gic_update(GICState *s) { int best_irq; int best_prio; int irq; int level; int cpu; int cm; for (cpu = 0; cpu < NUM_CPU(s); cpu++) { cm = 1 << cpu; s->current_pending[cpu] = 1023; if (!s->enabled || !s->cpu_enabled[cpu]) { qemu_irq_lower(s->parent_irq[cpu]); return; } best_prio = 0x100; best_irq = 1023; for (irq = 0; irq < s->num_irq; irq++) { if (GIC_TEST_ENABLED(irq, cm) && gic_test_pending(s, irq, cm) && (irq < GIC_INTERNAL || GIC_TARGET(irq) & cm)) { if (GIC_GET_PRIORITY(irq, cpu) < best_prio) { best_prio = GIC_GET_PRIORITY(irq, cpu); best_irq = irq; } } } level = 0; if (best_prio < s->priority_mask[cpu]) { s->current_pending[cpu] = best_irq; if (best_prio < s->running_priority[cpu]) { DPRINTF("Raised pending IRQ %d (cpu %d)\n", best_irq, cpu); level = 1; } } qemu_set_irq(s->parent_irq[cpu], level); } }
false
qemu
679aa175e84f5f80b32b307fce5a6b92729e0e61
void gic_update(GICState *s) { int best_irq; int best_prio; int irq; int level; int cpu; int cm; for (cpu = 0; cpu < NUM_CPU(s); cpu++) { cm = 1 << cpu; s->current_pending[cpu] = 1023; if (!s->enabled || !s->cpu_enabled[cpu]) { qemu_irq_lower(s->parent_irq[cpu]); return; } best_prio = 0x100; best_irq = 1023; for (irq = 0; irq < s->num_irq; irq++) { if (GIC_TEST_ENABLED(irq, cm) && gic_test_pending(s, irq, cm) && (irq < GIC_INTERNAL || GIC_TARGET(irq) & cm)) { if (GIC_GET_PRIORITY(irq, cpu) < best_prio) { best_prio = GIC_GET_PRIORITY(irq, cpu); best_irq = irq; } } } level = 0; if (best_prio < s->priority_mask[cpu]) { s->current_pending[cpu] = best_irq; if (best_prio < s->running_priority[cpu]) { DPRINTF("Raised pending IRQ %d (cpu %d)\n", best_irq, cpu); level = 1; } } qemu_set_irq(s->parent_irq[cpu], level); } }
{ "code": [], "line_no": [] }
void FUNC_0(GICState *VAR_0) { int VAR_1; int VAR_2; int VAR_3; int VAR_4; int VAR_5; int VAR_6; for (VAR_5 = 0; VAR_5 < NUM_CPU(VAR_0); VAR_5++) { VAR_6 = 1 << VAR_5; VAR_0->current_pending[VAR_5] = 1023; if (!VAR_0->enabled || !VAR_0->cpu_enabled[VAR_5]) { qemu_irq_lower(VAR_0->parent_irq[VAR_5]); return; } VAR_2 = 0x100; VAR_1 = 1023; for (VAR_3 = 0; VAR_3 < VAR_0->num_irq; VAR_3++) { if (GIC_TEST_ENABLED(VAR_3, VAR_6) && gic_test_pending(VAR_0, VAR_3, VAR_6) && (VAR_3 < GIC_INTERNAL || GIC_TARGET(VAR_3) & VAR_6)) { if (GIC_GET_PRIORITY(VAR_3, VAR_5) < VAR_2) { VAR_2 = GIC_GET_PRIORITY(VAR_3, VAR_5); VAR_1 = VAR_3; } } } VAR_4 = 0; if (VAR_2 < VAR_0->priority_mask[VAR_5]) { VAR_0->current_pending[VAR_5] = VAR_1; if (VAR_2 < VAR_0->running_priority[VAR_5]) { DPRINTF("Raised pending IRQ %d (VAR_5 %d)\n", VAR_1, VAR_5); VAR_4 = 1; } } qemu_set_irq(VAR_0->parent_irq[VAR_5], VAR_4); } }
[ "void FUNC_0(GICState *VAR_0)\n{", "int VAR_1;", "int VAR_2;", "int VAR_3;", "int VAR_4;", "int VAR_5;", "int VAR_6;", "for (VAR_5 = 0; VAR_5 < NUM_CPU(VAR_0); VAR_5++) {", "VAR_6 = 1 << VAR_5;", "VAR_0->current_pending[VAR_5] = 1023;", "if (!VAR_0->enabled || !VAR_0->cpu_enabled[VAR_5]) {", "qemu_irq_lower(VAR_0->parent_irq[VAR_5]);", "return;", "}", "VAR_2 = 0x100;", "VAR_1 = 1023;", "for (VAR_3 = 0; VAR_3 < VAR_0->num_irq; VAR_3++) {", "if (GIC_TEST_ENABLED(VAR_3, VAR_6) && gic_test_pending(VAR_0, VAR_3, VAR_6) &&\n(VAR_3 < GIC_INTERNAL || GIC_TARGET(VAR_3) & VAR_6)) {", "if (GIC_GET_PRIORITY(VAR_3, VAR_5) < VAR_2) {", "VAR_2 = GIC_GET_PRIORITY(VAR_3, VAR_5);", "VAR_1 = VAR_3;", "}", "}", "}", "VAR_4 = 0;", "if (VAR_2 < VAR_0->priority_mask[VAR_5]) {", "VAR_0->current_pending[VAR_5] = VAR_1;", "if (VAR_2 < VAR_0->running_priority[VAR_5]) {", "DPRINTF(\"Raised pending IRQ %d (VAR_5 %d)\\n\", VAR_1, VAR_5);", "VAR_4 = 1;", "}", "}", "qemu_set_irq(VAR_0->parent_irq[VAR_5], VAR_4);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ] ]
26,470
static int ftp_auth(FTPContext *s) { const char *user = NULL, *pass = NULL; char *end = NULL, buf[CONTROL_BUFFER_SIZE], credencials[CREDENTIALS_BUFFER_SIZE]; int err; const int user_codes[] = {331, 230, 0}; const int pass_codes[] = {230, 0}; /* Authentication may be repeated, original string has to be saved */ av_strlcpy(credencials, s->credencials, sizeof(credencials)); user = av_strtok(credencials, ":", &end); pass = av_strtok(end, ":", &end); if (!user) { user = "anonymous"; pass = s->anonymous_password ? s->anonymous_password : "nopassword"; } snprintf(buf, sizeof(buf), "USER %s\r\n", user); err = ftp_send_command(s, buf, user_codes, NULL); if (err == 331) { if (pass) { snprintf(buf, sizeof(buf), "PASS %s\r\n", pass); err = ftp_send_command(s, buf, pass_codes, NULL); } else return AVERROR(EACCES); } if (!err) return AVERROR(EACCES); return 0; }
false
FFmpeg
ddbcc48b646737c8bff7f8e28e0a69dca65509cf
static int ftp_auth(FTPContext *s) { const char *user = NULL, *pass = NULL; char *end = NULL, buf[CONTROL_BUFFER_SIZE], credencials[CREDENTIALS_BUFFER_SIZE]; int err; const int user_codes[] = {331, 230, 0}; const int pass_codes[] = {230, 0}; av_strlcpy(credencials, s->credencials, sizeof(credencials)); user = av_strtok(credencials, ":", &end); pass = av_strtok(end, ":", &end); if (!user) { user = "anonymous"; pass = s->anonymous_password ? s->anonymous_password : "nopassword"; } snprintf(buf, sizeof(buf), "USER %s\r\n", user); err = ftp_send_command(s, buf, user_codes, NULL); if (err == 331) { if (pass) { snprintf(buf, sizeof(buf), "PASS %s\r\n", pass); err = ftp_send_command(s, buf, pass_codes, NULL); } else return AVERROR(EACCES); } if (!err) return AVERROR(EACCES); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(FTPContext *VAR_0) { const char *VAR_1 = NULL, *VAR_2 = NULL; char *VAR_3 = NULL, buf[CONTROL_BUFFER_SIZE], credencials[CREDENTIALS_BUFFER_SIZE]; int VAR_4; const int VAR_5[] = {331, 230, 0}; const int VAR_6[] = {230, 0}; av_strlcpy(credencials, VAR_0->credencials, sizeof(credencials)); VAR_1 = av_strtok(credencials, ":", &VAR_3); VAR_2 = av_strtok(VAR_3, ":", &VAR_3); if (!VAR_1) { VAR_1 = "anonymous"; VAR_2 = VAR_0->anonymous_password ? VAR_0->anonymous_password : "nopassword"; } snprintf(buf, sizeof(buf), "USER %VAR_0\r\n", VAR_1); VAR_4 = ftp_send_command(VAR_0, buf, VAR_5, NULL); if (VAR_4 == 331) { if (VAR_2) { snprintf(buf, sizeof(buf), "PASS %VAR_0\r\n", VAR_2); VAR_4 = ftp_send_command(VAR_0, buf, VAR_6, NULL); } else return AVERROR(EACCES); } if (!VAR_4) return AVERROR(EACCES); return 0; }
[ "static int FUNC_0(FTPContext *VAR_0)\n{", "const char *VAR_1 = NULL, *VAR_2 = NULL;", "char *VAR_3 = NULL, buf[CONTROL_BUFFER_SIZE], credencials[CREDENTIALS_BUFFER_SIZE];", "int VAR_4;", "const int VAR_5[] = {331, 230, 0};", "const int VAR_6[] = {230, 0};", "av_strlcpy(credencials, VAR_0->credencials, sizeof(credencials));", "VAR_1 = av_strtok(credencials, \":\", &VAR_3);", "VAR_2 = av_strtok(VAR_3, \":\", &VAR_3);", "if (!VAR_1) {", "VAR_1 = \"anonymous\";", "VAR_2 = VAR_0->anonymous_password ? VAR_0->anonymous_password : \"nopassword\";", "}", "snprintf(buf, sizeof(buf), \"USER %VAR_0\\r\\n\", VAR_1);", "VAR_4 = ftp_send_command(VAR_0, buf, VAR_5, NULL);", "if (VAR_4 == 331) {", "if (VAR_2) {", "snprintf(buf, sizeof(buf), \"PASS %VAR_0\\r\\n\", VAR_2);", "VAR_4 = ftp_send_command(VAR_0, buf, VAR_6, NULL);", "} else", "return AVERROR(EACCES);", "}", "if (!VAR_4)\nreturn AVERROR(EACCES);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 19 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57, 59 ], [ 63 ], [ 65 ] ]
26,471
static void put_int64(QEMUFile *f, void *pv, size_t size) { int64_t *v = pv; qemu_put_sbe64s(f, v); }
true
qemu
60fe637bf0e4d7989e21e50f52526444765c63b4
static void put_int64(QEMUFile *f, void *pv, size_t size) { int64_t *v = pv; qemu_put_sbe64s(f, v); }
{ "code": [], "line_no": [] }
static void FUNC_0(QEMUFile *VAR_0, void *VAR_1, size_t VAR_2) { int64_t *v = VAR_1; qemu_put_sbe64s(VAR_0, v); }
[ "static void FUNC_0(QEMUFile *VAR_0, void *VAR_1, size_t VAR_2)\n{", "int64_t *v = VAR_1;", "qemu_put_sbe64s(VAR_0, v);", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
26,473
int ff_celp_lp_synthesis_filter(int16_t *out, const int16_t *filter_coeffs, const int16_t *in, int buffer_length, int filter_length, int stop_on_overflow, int shift, int rounder) { int i,n; for (n = 0; n < buffer_length; n++) { int sum = rounder; for (i = 1; i <= filter_length; i++) sum -= filter_coeffs[i-1] * out[n-i]; sum = ((sum >> 12) + in[n]) >> shift; if (sum + 0x8000 > 0xFFFFU) { if (stop_on_overflow) return 1; sum = (sum >> 31) ^ 32767; } out[n] = sum; } return 0; }
false
FFmpeg
fddc5b9bea39968ed1f45c667869428865de7626
int ff_celp_lp_synthesis_filter(int16_t *out, const int16_t *filter_coeffs, const int16_t *in, int buffer_length, int filter_length, int stop_on_overflow, int shift, int rounder) { int i,n; for (n = 0; n < buffer_length; n++) { int sum = rounder; for (i = 1; i <= filter_length; i++) sum -= filter_coeffs[i-1] * out[n-i]; sum = ((sum >> 12) + in[n]) >> shift; if (sum + 0x8000 > 0xFFFFU) { if (stop_on_overflow) return 1; sum = (sum >> 31) ^ 32767; } out[n] = sum; } return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(int16_t *VAR_0, const int16_t *VAR_1, const int16_t *VAR_2, int VAR_3, int VAR_4, int VAR_5, int VAR_6, int VAR_7) { int VAR_8,VAR_9; for (VAR_9 = 0; VAR_9 < VAR_3; VAR_9++) { int VAR_10 = VAR_7; for (VAR_8 = 1; VAR_8 <= VAR_4; VAR_8++) VAR_10 -= VAR_1[VAR_8-1] * VAR_0[VAR_9-VAR_8]; VAR_10 = ((VAR_10 >> 12) + VAR_2[VAR_9]) >> VAR_6; if (VAR_10 + 0x8000 > 0xFFFFU) { if (VAR_5) return 1; VAR_10 = (VAR_10 >> 31) ^ 32767; } VAR_0[VAR_9] = VAR_10; } return 0; }
[ "int FUNC_0(int16_t *VAR_0, const int16_t *VAR_1,\nconst int16_t *VAR_2, int VAR_3,\nint VAR_4, int VAR_5,\nint VAR_6, int VAR_7)\n{", "int VAR_8,VAR_9;", "for (VAR_9 = 0; VAR_9 < VAR_3; VAR_9++) {", "int VAR_10 = VAR_7;", "for (VAR_8 = 1; VAR_8 <= VAR_4; VAR_8++)", "VAR_10 -= VAR_1[VAR_8-1] * VAR_0[VAR_9-VAR_8];", "VAR_10 = ((VAR_10 >> 12) + VAR_2[VAR_9]) >> VAR_6;", "if (VAR_10 + 0x8000 > 0xFFFFU) {", "if (VAR_5)\nreturn 1;", "VAR_10 = (VAR_10 >> 31) ^ 32767;", "}", "VAR_0[VAR_9] = VAR_10;", "}", "return 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 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ] ]
26,474
static int push_samples(AVFilterLink *outlink) { ASNSContext *asns = outlink->src->priv; AVFrame *outsamples = NULL; int ret, nb_out_samples, nb_pad_samples; if (asns->pad) { nb_out_samples = av_audio_fifo_size(asns->fifo) ? asns->nb_out_samples : 0; nb_pad_samples = nb_out_samples - FFMIN(nb_out_samples, av_audio_fifo_size(asns->fifo)); } else { nb_out_samples = FFMIN(asns->nb_out_samples, av_audio_fifo_size(asns->fifo)); nb_pad_samples = 0; } if (!nb_out_samples) return 0; outsamples = ff_get_audio_buffer(outlink, nb_out_samples); av_assert0(outsamples); av_audio_fifo_read(asns->fifo, (void **)outsamples->extended_data, nb_out_samples); if (nb_pad_samples) av_samples_set_silence(outsamples->extended_data, nb_out_samples - nb_pad_samples, nb_pad_samples, av_get_channel_layout_nb_channels(outlink->channel_layout), outlink->format); outsamples->nb_samples = nb_out_samples; outsamples->channel_layout = outlink->channel_layout; outsamples->sample_rate = outlink->sample_rate; outsamples->pts = asns->next_out_pts; if (asns->next_out_pts != AV_NOPTS_VALUE) asns->next_out_pts += nb_out_samples; ret = ff_filter_frame(outlink, outsamples); if (ret < 0) return ret; asns->req_fullfilled = 1; return nb_out_samples; }
false
FFmpeg
b570f24d7600ef4c8f05018c46bea6356927ba4d
static int push_samples(AVFilterLink *outlink) { ASNSContext *asns = outlink->src->priv; AVFrame *outsamples = NULL; int ret, nb_out_samples, nb_pad_samples; if (asns->pad) { nb_out_samples = av_audio_fifo_size(asns->fifo) ? asns->nb_out_samples : 0; nb_pad_samples = nb_out_samples - FFMIN(nb_out_samples, av_audio_fifo_size(asns->fifo)); } else { nb_out_samples = FFMIN(asns->nb_out_samples, av_audio_fifo_size(asns->fifo)); nb_pad_samples = 0; } if (!nb_out_samples) return 0; outsamples = ff_get_audio_buffer(outlink, nb_out_samples); av_assert0(outsamples); av_audio_fifo_read(asns->fifo, (void **)outsamples->extended_data, nb_out_samples); if (nb_pad_samples) av_samples_set_silence(outsamples->extended_data, nb_out_samples - nb_pad_samples, nb_pad_samples, av_get_channel_layout_nb_channels(outlink->channel_layout), outlink->format); outsamples->nb_samples = nb_out_samples; outsamples->channel_layout = outlink->channel_layout; outsamples->sample_rate = outlink->sample_rate; outsamples->pts = asns->next_out_pts; if (asns->next_out_pts != AV_NOPTS_VALUE) asns->next_out_pts += nb_out_samples; ret = ff_filter_frame(outlink, outsamples); if (ret < 0) return ret; asns->req_fullfilled = 1; return nb_out_samples; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFilterLink *VAR_0) { ASNSContext *asns = VAR_0->src->priv; AVFrame *outsamples = NULL; int VAR_1, VAR_2, VAR_3; if (asns->pad) { VAR_2 = av_audio_fifo_size(asns->fifo) ? asns->VAR_2 : 0; VAR_3 = VAR_2 - FFMIN(VAR_2, av_audio_fifo_size(asns->fifo)); } else { VAR_2 = FFMIN(asns->VAR_2, av_audio_fifo_size(asns->fifo)); VAR_3 = 0; } if (!VAR_2) return 0; outsamples = ff_get_audio_buffer(VAR_0, VAR_2); av_assert0(outsamples); av_audio_fifo_read(asns->fifo, (void **)outsamples->extended_data, VAR_2); if (VAR_3) av_samples_set_silence(outsamples->extended_data, VAR_2 - VAR_3, VAR_3, av_get_channel_layout_nb_channels(VAR_0->channel_layout), VAR_0->format); outsamples->nb_samples = VAR_2; outsamples->channel_layout = VAR_0->channel_layout; outsamples->sample_rate = VAR_0->sample_rate; outsamples->pts = asns->next_out_pts; if (asns->next_out_pts != AV_NOPTS_VALUE) asns->next_out_pts += VAR_2; VAR_1 = ff_filter_frame(VAR_0, outsamples); if (VAR_1 < 0) return VAR_1; asns->req_fullfilled = 1; return VAR_2; }
[ "static int FUNC_0(AVFilterLink *VAR_0)\n{", "ASNSContext *asns = VAR_0->src->priv;", "AVFrame *outsamples = NULL;", "int VAR_1, VAR_2, VAR_3;", "if (asns->pad) {", "VAR_2 = av_audio_fifo_size(asns->fifo) ? asns->VAR_2 : 0;", "VAR_3 = VAR_2 - FFMIN(VAR_2, av_audio_fifo_size(asns->fifo));", "} else {", "VAR_2 = FFMIN(asns->VAR_2, av_audio_fifo_size(asns->fifo));", "VAR_3 = 0;", "}", "if (!VAR_2)\nreturn 0;", "outsamples = ff_get_audio_buffer(VAR_0, VAR_2);", "av_assert0(outsamples);", "av_audio_fifo_read(asns->fifo,\n(void **)outsamples->extended_data, VAR_2);", "if (VAR_3)\nav_samples_set_silence(outsamples->extended_data, VAR_2 - VAR_3,\nVAR_3, av_get_channel_layout_nb_channels(VAR_0->channel_layout),\nVAR_0->format);", "outsamples->nb_samples = VAR_2;", "outsamples->channel_layout = VAR_0->channel_layout;", "outsamples->sample_rate = VAR_0->sample_rate;", "outsamples->pts = asns->next_out_pts;", "if (asns->next_out_pts != AV_NOPTS_VALUE)\nasns->next_out_pts += VAR_2;", "VAR_1 = ff_filter_frame(VAR_0, outsamples);", "if (VAR_1 < 0)\nreturn VAR_1;", "asns->req_fullfilled = 1;", "return VAR_2;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29, 31 ], [ 35 ], [ 37 ], [ 41, 43 ], [ 47, 49, 51, 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65, 67 ], [ 71 ], [ 73, 75 ], [ 77 ], [ 79 ], [ 81 ] ]
26,475
static void truemotion1_decode_16bit(TrueMotion1Context *s) { int y; int pixels_left; /* remaining pixels on this line */ unsigned int predictor_pair; unsigned int horiz_pred; unsigned int *vert_pred; unsigned int *current_pixel_pair; unsigned char *current_line = s->frame->data[0]; int keyframe = s->flags & FLAG_KEYFRAME; /* these variables are for managing the stream of macroblock change bits */ const unsigned char *mb_change_bits = s->mb_change_bits; unsigned char mb_change_byte; unsigned char mb_change_byte_mask; int mb_change_index; /* these variables are for managing the main index stream */ int index_stream_index = 0; /* yes, the index into the index stream */ int index; /* clean out the line buffer */ memset(s->vert_pred, 0, s->avctx->width * sizeof(unsigned int)); GET_NEXT_INDEX(); for (y = 0; y < s->avctx->height; y++) { /* re-init variables for the next line iteration */ horiz_pred = 0; current_pixel_pair = (unsigned int *)current_line; vert_pred = s->vert_pred; mb_change_index = 0; mb_change_byte = mb_change_bits[mb_change_index++]; mb_change_byte_mask = 0x01; pixels_left = s->avctx->width; while (pixels_left > 0) { if (keyframe || ((mb_change_byte & mb_change_byte_mask) == 0)) { switch (y & 3) { case 0: /* if macroblock width is 2, apply C-Y-C-Y; else * apply C-Y-Y */ if (s->block_width == 2) { APPLY_C_PREDICTOR(); APPLY_Y_PREDICTOR(); OUTPUT_PIXEL_PAIR(); APPLY_C_PREDICTOR(); APPLY_Y_PREDICTOR(); OUTPUT_PIXEL_PAIR(); } else { APPLY_C_PREDICTOR(); APPLY_Y_PREDICTOR(); OUTPUT_PIXEL_PAIR(); APPLY_Y_PREDICTOR(); OUTPUT_PIXEL_PAIR(); } break; case 1: case 3: /* always apply 2 Y predictors on these iterations */ APPLY_Y_PREDICTOR(); OUTPUT_PIXEL_PAIR(); APPLY_Y_PREDICTOR(); OUTPUT_PIXEL_PAIR(); break; case 2: /* this iteration might be C-Y-C-Y, Y-Y, or C-Y-Y * depending on the macroblock type */ if (s->block_type == BLOCK_2x2) { APPLY_C_PREDICTOR(); APPLY_Y_PREDICTOR(); OUTPUT_PIXEL_PAIR(); APPLY_C_PREDICTOR(); APPLY_Y_PREDICTOR(); OUTPUT_PIXEL_PAIR(); } else if (s->block_type == BLOCK_4x2) { APPLY_C_PREDICTOR(); APPLY_Y_PREDICTOR(); OUTPUT_PIXEL_PAIR(); APPLY_Y_PREDICTOR(); OUTPUT_PIXEL_PAIR(); } else { APPLY_Y_PREDICTOR(); OUTPUT_PIXEL_PAIR(); APPLY_Y_PREDICTOR(); OUTPUT_PIXEL_PAIR(); } break; } } else { /* skip (copy) four pixels, but reassign the horizontal * predictor */ *vert_pred++ = *current_pixel_pair++; horiz_pred = *current_pixel_pair - *vert_pred; *vert_pred++ = *current_pixel_pair++; } if (!keyframe) { mb_change_byte_mask <<= 1; /* next byte */ if (!mb_change_byte_mask) { mb_change_byte = mb_change_bits[mb_change_index++]; mb_change_byte_mask = 0x01; } } pixels_left -= 4; } /* next change row */ if (((y + 1) & 3) == 0) mb_change_bits += s->mb_change_bits_row_size; current_line += s->frame->linesize[0]; } }
false
FFmpeg
a813cdda487e252681df36f675332b04c2e0e5a6
static void truemotion1_decode_16bit(TrueMotion1Context *s) { int y; int pixels_left; unsigned int predictor_pair; unsigned int horiz_pred; unsigned int *vert_pred; unsigned int *current_pixel_pair; unsigned char *current_line = s->frame->data[0]; int keyframe = s->flags & FLAG_KEYFRAME; const unsigned char *mb_change_bits = s->mb_change_bits; unsigned char mb_change_byte; unsigned char mb_change_byte_mask; int mb_change_index; int index_stream_index = 0; int index; memset(s->vert_pred, 0, s->avctx->width * sizeof(unsigned int)); GET_NEXT_INDEX(); for (y = 0; y < s->avctx->height; y++) { horiz_pred = 0; current_pixel_pair = (unsigned int *)current_line; vert_pred = s->vert_pred; mb_change_index = 0; mb_change_byte = mb_change_bits[mb_change_index++]; mb_change_byte_mask = 0x01; pixels_left = s->avctx->width; while (pixels_left > 0) { if (keyframe || ((mb_change_byte & mb_change_byte_mask) == 0)) { switch (y & 3) { case 0: if (s->block_width == 2) { APPLY_C_PREDICTOR(); APPLY_Y_PREDICTOR(); OUTPUT_PIXEL_PAIR(); APPLY_C_PREDICTOR(); APPLY_Y_PREDICTOR(); OUTPUT_PIXEL_PAIR(); } else { APPLY_C_PREDICTOR(); APPLY_Y_PREDICTOR(); OUTPUT_PIXEL_PAIR(); APPLY_Y_PREDICTOR(); OUTPUT_PIXEL_PAIR(); } break; case 1: case 3: APPLY_Y_PREDICTOR(); OUTPUT_PIXEL_PAIR(); APPLY_Y_PREDICTOR(); OUTPUT_PIXEL_PAIR(); break; case 2: if (s->block_type == BLOCK_2x2) { APPLY_C_PREDICTOR(); APPLY_Y_PREDICTOR(); OUTPUT_PIXEL_PAIR(); APPLY_C_PREDICTOR(); APPLY_Y_PREDICTOR(); OUTPUT_PIXEL_PAIR(); } else if (s->block_type == BLOCK_4x2) { APPLY_C_PREDICTOR(); APPLY_Y_PREDICTOR(); OUTPUT_PIXEL_PAIR(); APPLY_Y_PREDICTOR(); OUTPUT_PIXEL_PAIR(); } else { APPLY_Y_PREDICTOR(); OUTPUT_PIXEL_PAIR(); APPLY_Y_PREDICTOR(); OUTPUT_PIXEL_PAIR(); } break; } } else { *vert_pred++ = *current_pixel_pair++; horiz_pred = *current_pixel_pair - *vert_pred; *vert_pred++ = *current_pixel_pair++; } if (!keyframe) { mb_change_byte_mask <<= 1; if (!mb_change_byte_mask) { mb_change_byte = mb_change_bits[mb_change_index++]; mb_change_byte_mask = 0x01; } } pixels_left -= 4; } if (((y + 1) & 3) == 0) mb_change_bits += s->mb_change_bits_row_size; current_line += s->frame->linesize[0]; } }
{ "code": [], "line_no": [] }
static void FUNC_0(TrueMotion1Context *VAR_0) { int VAR_1; int VAR_2; unsigned int VAR_3; unsigned int VAR_4; unsigned int *VAR_5; unsigned int *VAR_6; unsigned char *VAR_7 = VAR_0->frame->data[0]; int VAR_8 = VAR_0->flags & FLAG_KEYFRAME; const unsigned char *VAR_9 = VAR_0->VAR_9; unsigned char VAR_10; unsigned char VAR_11; int VAR_12; int VAR_13 = 0; int VAR_14; memset(VAR_0->VAR_5, 0, VAR_0->avctx->width * sizeof(unsigned int)); GET_NEXT_INDEX(); for (VAR_1 = 0; VAR_1 < VAR_0->avctx->height; VAR_1++) { VAR_4 = 0; VAR_6 = (unsigned int *)VAR_7; VAR_5 = VAR_0->VAR_5; VAR_12 = 0; VAR_10 = VAR_9[VAR_12++]; VAR_11 = 0x01; VAR_2 = VAR_0->avctx->width; while (VAR_2 > 0) { if (VAR_8 || ((VAR_10 & VAR_11) == 0)) { switch (VAR_1 & 3) { case 0: if (VAR_0->block_width == 2) { APPLY_C_PREDICTOR(); APPLY_Y_PREDICTOR(); OUTPUT_PIXEL_PAIR(); APPLY_C_PREDICTOR(); APPLY_Y_PREDICTOR(); OUTPUT_PIXEL_PAIR(); } else { APPLY_C_PREDICTOR(); APPLY_Y_PREDICTOR(); OUTPUT_PIXEL_PAIR(); APPLY_Y_PREDICTOR(); OUTPUT_PIXEL_PAIR(); } break; case 1: case 3: APPLY_Y_PREDICTOR(); OUTPUT_PIXEL_PAIR(); APPLY_Y_PREDICTOR(); OUTPUT_PIXEL_PAIR(); break; case 2: if (VAR_0->block_type == BLOCK_2x2) { APPLY_C_PREDICTOR(); APPLY_Y_PREDICTOR(); OUTPUT_PIXEL_PAIR(); APPLY_C_PREDICTOR(); APPLY_Y_PREDICTOR(); OUTPUT_PIXEL_PAIR(); } else if (VAR_0->block_type == BLOCK_4x2) { APPLY_C_PREDICTOR(); APPLY_Y_PREDICTOR(); OUTPUT_PIXEL_PAIR(); APPLY_Y_PREDICTOR(); OUTPUT_PIXEL_PAIR(); } else { APPLY_Y_PREDICTOR(); OUTPUT_PIXEL_PAIR(); APPLY_Y_PREDICTOR(); OUTPUT_PIXEL_PAIR(); } break; } } else { *VAR_5++ = *VAR_6++; VAR_4 = *VAR_6 - *VAR_5; *VAR_5++ = *VAR_6++; } if (!VAR_8) { VAR_11 <<= 1; if (!VAR_11) { VAR_10 = VAR_9[VAR_12++]; VAR_11 = 0x01; } } VAR_2 -= 4; } if (((VAR_1 + 1) & 3) == 0) VAR_9 += VAR_0->mb_change_bits_row_size; VAR_7 += VAR_0->frame->linesize[0]; } }
[ "static void FUNC_0(TrueMotion1Context *VAR_0)\n{", "int VAR_1;", "int VAR_2;", "unsigned int VAR_3;", "unsigned int VAR_4;", "unsigned int *VAR_5;", "unsigned int *VAR_6;", "unsigned char *VAR_7 = VAR_0->frame->data[0];", "int VAR_8 = VAR_0->flags & FLAG_KEYFRAME;", "const unsigned char *VAR_9 = VAR_0->VAR_9;", "unsigned char VAR_10;", "unsigned char VAR_11;", "int VAR_12;", "int VAR_13 = 0;", "int VAR_14;", "memset(VAR_0->VAR_5, 0, VAR_0->avctx->width * sizeof(unsigned int));", "GET_NEXT_INDEX();", "for (VAR_1 = 0; VAR_1 < VAR_0->avctx->height; VAR_1++) {", "VAR_4 = 0;", "VAR_6 = (unsigned int *)VAR_7;", "VAR_5 = VAR_0->VAR_5;", "VAR_12 = 0;", "VAR_10 = VAR_9[VAR_12++];", "VAR_11 = 0x01;", "VAR_2 = VAR_0->avctx->width;", "while (VAR_2 > 0) {", "if (VAR_8 || ((VAR_10 & VAR_11) == 0)) {", "switch (VAR_1 & 3) {", "case 0:\nif (VAR_0->block_width == 2) {", "APPLY_C_PREDICTOR();", "APPLY_Y_PREDICTOR();", "OUTPUT_PIXEL_PAIR();", "APPLY_C_PREDICTOR();", "APPLY_Y_PREDICTOR();", "OUTPUT_PIXEL_PAIR();", "} else {", "APPLY_C_PREDICTOR();", "APPLY_Y_PREDICTOR();", "OUTPUT_PIXEL_PAIR();", "APPLY_Y_PREDICTOR();", "OUTPUT_PIXEL_PAIR();", "}", "break;", "case 1:\ncase 3:\nAPPLY_Y_PREDICTOR();", "OUTPUT_PIXEL_PAIR();", "APPLY_Y_PREDICTOR();", "OUTPUT_PIXEL_PAIR();", "break;", "case 2:\nif (VAR_0->block_type == BLOCK_2x2) {", "APPLY_C_PREDICTOR();", "APPLY_Y_PREDICTOR();", "OUTPUT_PIXEL_PAIR();", "APPLY_C_PREDICTOR();", "APPLY_Y_PREDICTOR();", "OUTPUT_PIXEL_PAIR();", "} else if (VAR_0->block_type == BLOCK_4x2) {", "APPLY_C_PREDICTOR();", "APPLY_Y_PREDICTOR();", "OUTPUT_PIXEL_PAIR();", "APPLY_Y_PREDICTOR();", "OUTPUT_PIXEL_PAIR();", "} else {", "APPLY_Y_PREDICTOR();", "OUTPUT_PIXEL_PAIR();", "APPLY_Y_PREDICTOR();", "OUTPUT_PIXEL_PAIR();", "}", "break;", "}", "} else {", "*VAR_5++ = *VAR_6++;", "VAR_4 = *VAR_6 - *VAR_5;", "*VAR_5++ = *VAR_6++;", "}", "if (!VAR_8) {", "VAR_11 <<= 1;", "if (!VAR_11) {", "VAR_10 = VAR_9[VAR_12++];", "VAR_11 = 0x01;", "}", "}", "VAR_2 -= 4;", "}", "if (((VAR_1 + 1) & 3) == 0)\nVAR_9 += VAR_0->mb_change_bits_row_size;", "VAR_7 += VAR_0->frame->linesize[0];", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 37 ], [ 39 ], [ 45 ], [ 49 ], [ 53 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 75 ], [ 79 ], [ 83 ], [ 85, 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 123, 125, 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 141, 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 191 ], [ 199 ], [ 201 ], [ 203 ], [ 207 ], [ 211 ], [ 213 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 231 ], [ 233 ], [ 239, 241 ], [ 245 ], [ 247 ], [ 249 ] ]
26,476
av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx) { int i; ff_check_alignment(); #if CONFIG_ENCODERS if (avctx->bits_per_raw_sample == 10) { c->fdct = ff_jpeg_fdct_islow_10; c->fdct248 = ff_fdct248_islow_10; } else { if(avctx->dct_algo==FF_DCT_FASTINT) { c->fdct = fdct_ifast; c->fdct248 = fdct_ifast248; } else if(avctx->dct_algo==FF_DCT_FAAN) { c->fdct = ff_faandct; c->fdct248 = ff_faandct248; } else { c->fdct = ff_jpeg_fdct_islow_8; //slow/accurate/default c->fdct248 = ff_fdct248_islow_8; } } #endif //CONFIG_ENCODERS if(avctx->lowres==1){ c->idct_put= ff_jref_idct4_put; c->idct_add= ff_jref_idct4_add; c->idct = j_rev_dct4; c->idct_permutation_type= FF_NO_IDCT_PERM; }else if(avctx->lowres==2){ c->idct_put= ff_jref_idct2_put; c->idct_add= ff_jref_idct2_add; c->idct = j_rev_dct2; c->idct_permutation_type= FF_NO_IDCT_PERM; }else if(avctx->lowres==3){ c->idct_put= ff_jref_idct1_put; c->idct_add= ff_jref_idct1_add; c->idct = j_rev_dct1; c->idct_permutation_type= FF_NO_IDCT_PERM; }else{ if (avctx->bits_per_raw_sample == 10) { c->idct_put = ff_simple_idct_put_10; c->idct_add = ff_simple_idct_add_10; c->idct = ff_simple_idct_10; c->idct_permutation_type = FF_NO_IDCT_PERM; } else { if(avctx->idct_algo==FF_IDCT_INT){ c->idct_put= ff_jref_idct_put; c->idct_add= ff_jref_idct_add; c->idct = j_rev_dct; c->idct_permutation_type= FF_LIBMPEG2_IDCT_PERM; }else if((CONFIG_VP3_DECODER || CONFIG_VP5_DECODER || CONFIG_VP6_DECODER ) && avctx->idct_algo==FF_IDCT_VP3){ c->idct_put= ff_vp3_idct_put_c; c->idct_add= ff_vp3_idct_add_c; c->idct = ff_vp3_idct_c; c->idct_permutation_type= FF_NO_IDCT_PERM; }else if(avctx->idct_algo==FF_IDCT_WMV2){ c->idct_put= ff_wmv2_idct_put_c; c->idct_add= ff_wmv2_idct_add_c; c->idct = ff_wmv2_idct_c; c->idct_permutation_type= FF_NO_IDCT_PERM; }else if(avctx->idct_algo==FF_IDCT_FAAN){ c->idct_put= ff_faanidct_put; c->idct_add= ff_faanidct_add; c->idct = ff_faanidct; c->idct_permutation_type= FF_NO_IDCT_PERM; }else if(CONFIG_EATGQ_DECODER && avctx->idct_algo==FF_IDCT_EA) { c->idct_put= ff_ea_idct_put_c; c->idct_permutation_type= FF_NO_IDCT_PERM; }else{ //accurate/default c->idct_put = ff_simple_idct_put_8; c->idct_add = ff_simple_idct_add_8; c->idct = ff_simple_idct_8; c->idct_permutation_type= FF_NO_IDCT_PERM; } } } c->diff_pixels = diff_pixels_c; c->put_pixels_clamped = ff_put_pixels_clamped_c; c->put_signed_pixels_clamped = ff_put_signed_pixels_clamped_c; c->add_pixels_clamped = ff_add_pixels_clamped_c; c->sum_abs_dctelem = sum_abs_dctelem_c; c->gmc1 = gmc1_c; c->gmc = ff_gmc_c; c->pix_sum = pix_sum_c; c->pix_norm1 = pix_norm1_c; c->fill_block_tab[0] = fill_block16_c; c->fill_block_tab[1] = fill_block8_c; /* TODO [0] 16 [1] 8 */ c->pix_abs[0][0] = pix_abs16_c; c->pix_abs[0][1] = pix_abs16_x2_c; c->pix_abs[0][2] = pix_abs16_y2_c; c->pix_abs[0][3] = pix_abs16_xy2_c; c->pix_abs[1][0] = pix_abs8_c; c->pix_abs[1][1] = pix_abs8_x2_c; c->pix_abs[1][2] = pix_abs8_y2_c; c->pix_abs[1][3] = pix_abs8_xy2_c; c->put_tpel_pixels_tab[ 0] = put_tpel_pixels_mc00_c; c->put_tpel_pixels_tab[ 1] = put_tpel_pixels_mc10_c; c->put_tpel_pixels_tab[ 2] = put_tpel_pixels_mc20_c; c->put_tpel_pixels_tab[ 4] = put_tpel_pixels_mc01_c; c->put_tpel_pixels_tab[ 5] = put_tpel_pixels_mc11_c; c->put_tpel_pixels_tab[ 6] = put_tpel_pixels_mc21_c; c->put_tpel_pixels_tab[ 8] = put_tpel_pixels_mc02_c; c->put_tpel_pixels_tab[ 9] = put_tpel_pixels_mc12_c; c->put_tpel_pixels_tab[10] = put_tpel_pixels_mc22_c; c->avg_tpel_pixels_tab[ 0] = avg_tpel_pixels_mc00_c; c->avg_tpel_pixels_tab[ 1] = avg_tpel_pixels_mc10_c; c->avg_tpel_pixels_tab[ 2] = avg_tpel_pixels_mc20_c; c->avg_tpel_pixels_tab[ 4] = avg_tpel_pixels_mc01_c; c->avg_tpel_pixels_tab[ 5] = avg_tpel_pixels_mc11_c; c->avg_tpel_pixels_tab[ 6] = avg_tpel_pixels_mc21_c; c->avg_tpel_pixels_tab[ 8] = avg_tpel_pixels_mc02_c; c->avg_tpel_pixels_tab[ 9] = avg_tpel_pixels_mc12_c; c->avg_tpel_pixels_tab[10] = avg_tpel_pixels_mc22_c; #define dspfunc(PFX, IDX, NUM) \ c->PFX ## _pixels_tab[IDX][ 0] = PFX ## NUM ## _mc00_c; \ c->PFX ## _pixels_tab[IDX][ 1] = PFX ## NUM ## _mc10_c; \ c->PFX ## _pixels_tab[IDX][ 2] = PFX ## NUM ## _mc20_c; \ c->PFX ## _pixels_tab[IDX][ 3] = PFX ## NUM ## _mc30_c; \ c->PFX ## _pixels_tab[IDX][ 4] = PFX ## NUM ## _mc01_c; \ c->PFX ## _pixels_tab[IDX][ 5] = PFX ## NUM ## _mc11_c; \ c->PFX ## _pixels_tab[IDX][ 6] = PFX ## NUM ## _mc21_c; \ c->PFX ## _pixels_tab[IDX][ 7] = PFX ## NUM ## _mc31_c; \ c->PFX ## _pixels_tab[IDX][ 8] = PFX ## NUM ## _mc02_c; \ c->PFX ## _pixels_tab[IDX][ 9] = PFX ## NUM ## _mc12_c; \ c->PFX ## _pixels_tab[IDX][10] = PFX ## NUM ## _mc22_c; \ c->PFX ## _pixels_tab[IDX][11] = PFX ## NUM ## _mc32_c; \ c->PFX ## _pixels_tab[IDX][12] = PFX ## NUM ## _mc03_c; \ c->PFX ## _pixels_tab[IDX][13] = PFX ## NUM ## _mc13_c; \ c->PFX ## _pixels_tab[IDX][14] = PFX ## NUM ## _mc23_c; \ c->PFX ## _pixels_tab[IDX][15] = PFX ## NUM ## _mc33_c dspfunc(put_qpel, 0, 16); dspfunc(put_no_rnd_qpel, 0, 16); dspfunc(avg_qpel, 0, 16); /* dspfunc(avg_no_rnd_qpel, 0, 16); */ dspfunc(put_qpel, 1, 8); dspfunc(put_no_rnd_qpel, 1, 8); dspfunc(avg_qpel, 1, 8); /* dspfunc(avg_no_rnd_qpel, 1, 8); */ #undef dspfunc #if CONFIG_MLP_DECODER || CONFIG_TRUEHD_DECODER ff_mlp_init(c, avctx); #endif #if CONFIG_WMV2_DECODER || CONFIG_VC1_DECODER ff_intrax8dsp_init(c,avctx); #endif c->put_mspel_pixels_tab[0]= ff_put_pixels8x8_c; c->put_mspel_pixels_tab[1]= put_mspel8_mc10_c; c->put_mspel_pixels_tab[2]= put_mspel8_mc20_c; c->put_mspel_pixels_tab[3]= put_mspel8_mc30_c; c->put_mspel_pixels_tab[4]= put_mspel8_mc02_c; c->put_mspel_pixels_tab[5]= put_mspel8_mc12_c; c->put_mspel_pixels_tab[6]= put_mspel8_mc22_c; c->put_mspel_pixels_tab[7]= put_mspel8_mc32_c; #define SET_CMP_FUNC(name) \ c->name[0]= name ## 16_c;\ c->name[1]= name ## 8x8_c; SET_CMP_FUNC(hadamard8_diff) c->hadamard8_diff[4]= hadamard8_intra16_c; c->hadamard8_diff[5]= hadamard8_intra8x8_c; SET_CMP_FUNC(dct_sad) SET_CMP_FUNC(dct_max) #if CONFIG_GPL SET_CMP_FUNC(dct264_sad) #endif c->sad[0]= pix_abs16_c; c->sad[1]= pix_abs8_c; c->sse[0]= sse16_c; c->sse[1]= sse8_c; c->sse[2]= sse4_c; SET_CMP_FUNC(quant_psnr) SET_CMP_FUNC(rd) SET_CMP_FUNC(bit) c->vsad[0]= vsad16_c; c->vsad[4]= vsad_intra16_c; c->vsad[5]= vsad_intra8_c; c->vsse[0]= vsse16_c; c->vsse[4]= vsse_intra16_c; c->vsse[5]= vsse_intra8_c; c->nsse[0]= nsse16_c; c->nsse[1]= nsse8_c; #if CONFIG_DWT ff_dsputil_init_dwt(c); #endif c->ssd_int8_vs_int16 = ssd_int8_vs_int16_c; c->add_bytes= add_bytes_c; c->diff_bytes= diff_bytes_c; c->add_hfyu_median_prediction= add_hfyu_median_prediction_c; c->sub_hfyu_median_prediction= sub_hfyu_median_prediction_c; c->add_hfyu_left_prediction = add_hfyu_left_prediction_c; c->add_hfyu_left_prediction_bgr32 = add_hfyu_left_prediction_bgr32_c; c->bswap_buf= bswap_buf; c->bswap16_buf = bswap16_buf; if (CONFIG_H263_DECODER || CONFIG_H263_ENCODER) { c->h263_h_loop_filter= h263_h_loop_filter_c; c->h263_v_loop_filter= h263_v_loop_filter_c; } if (CONFIG_VP3_DECODER) { c->vp3_h_loop_filter= ff_vp3_h_loop_filter_c; c->vp3_v_loop_filter= ff_vp3_v_loop_filter_c; c->vp3_idct_dc_add= ff_vp3_idct_dc_add_c; } c->h261_loop_filter= h261_loop_filter_c; c->try_8x8basis= try_8x8basis_c; c->add_8x8basis= add_8x8basis_c; #if CONFIG_VORBIS_DECODER c->vorbis_inverse_coupling = vorbis_inverse_coupling; #endif #if CONFIG_AC3_DECODER c->ac3_downmix = ff_ac3_downmix_c; #endif c->vector_fmul = vector_fmul_c; c->vector_fmul_reverse = vector_fmul_reverse_c; c->vector_fmul_add = vector_fmul_add_c; c->vector_fmul_window = vector_fmul_window_c; c->vector_clipf = vector_clipf_c; c->scalarproduct_int16 = scalarproduct_int16_c; c->scalarproduct_and_madd_int16 = scalarproduct_and_madd_int16_c; c->apply_window_int16 = apply_window_int16_c; c->vector_clip_int32 = vector_clip_int32_c; c->scalarproduct_float = scalarproduct_float_c; c->butterflies_float = butterflies_float_c; c->butterflies_float_interleave = butterflies_float_interleave_c; c->vector_fmul_scalar = vector_fmul_scalar_c; c->vector_fmac_scalar = vector_fmac_scalar_c; c->shrink[0]= av_image_copy_plane; c->shrink[1]= ff_shrink22; c->shrink[2]= ff_shrink44; c->shrink[3]= ff_shrink88; c->prefetch= just_return; memset(c->put_2tap_qpel_pixels_tab, 0, sizeof(c->put_2tap_qpel_pixels_tab)); memset(c->avg_2tap_qpel_pixels_tab, 0, sizeof(c->avg_2tap_qpel_pixels_tab)); #undef FUNC #undef FUNCC #define FUNC(f, depth) f ## _ ## depth #define FUNCC(f, depth) f ## _ ## depth ## _c #define dspfunc1(PFX, IDX, NUM, depth)\ c->PFX ## _pixels_tab[IDX][0] = FUNCC(PFX ## _pixels ## NUM , depth);\ c->PFX ## _pixels_tab[IDX][1] = FUNCC(PFX ## _pixels ## NUM ## _x2 , depth);\ c->PFX ## _pixels_tab[IDX][2] = FUNCC(PFX ## _pixels ## NUM ## _y2 , depth);\ c->PFX ## _pixels_tab[IDX][3] = FUNCC(PFX ## _pixels ## NUM ## _xy2, depth) #define dspfunc2(PFX, IDX, NUM, depth)\ c->PFX ## _pixels_tab[IDX][ 0] = FUNCC(PFX ## NUM ## _mc00, depth);\ c->PFX ## _pixels_tab[IDX][ 1] = FUNCC(PFX ## NUM ## _mc10, depth);\ c->PFX ## _pixels_tab[IDX][ 2] = FUNCC(PFX ## NUM ## _mc20, depth);\ c->PFX ## _pixels_tab[IDX][ 3] = FUNCC(PFX ## NUM ## _mc30, depth);\ c->PFX ## _pixels_tab[IDX][ 4] = FUNCC(PFX ## NUM ## _mc01, depth);\ c->PFX ## _pixels_tab[IDX][ 5] = FUNCC(PFX ## NUM ## _mc11, depth);\ c->PFX ## _pixels_tab[IDX][ 6] = FUNCC(PFX ## NUM ## _mc21, depth);\ c->PFX ## _pixels_tab[IDX][ 7] = FUNCC(PFX ## NUM ## _mc31, depth);\ c->PFX ## _pixels_tab[IDX][ 8] = FUNCC(PFX ## NUM ## _mc02, depth);\ c->PFX ## _pixels_tab[IDX][ 9] = FUNCC(PFX ## NUM ## _mc12, depth);\ c->PFX ## _pixels_tab[IDX][10] = FUNCC(PFX ## NUM ## _mc22, depth);\ c->PFX ## _pixels_tab[IDX][11] = FUNCC(PFX ## NUM ## _mc32, depth);\ c->PFX ## _pixels_tab[IDX][12] = FUNCC(PFX ## NUM ## _mc03, depth);\ c->PFX ## _pixels_tab[IDX][13] = FUNCC(PFX ## NUM ## _mc13, depth);\ c->PFX ## _pixels_tab[IDX][14] = FUNCC(PFX ## NUM ## _mc23, depth);\ c->PFX ## _pixels_tab[IDX][15] = FUNCC(PFX ## NUM ## _mc33, depth) #define BIT_DEPTH_FUNCS(depth, dct)\ c->get_pixels = FUNCC(get_pixels ## dct , depth);\ c->draw_edges = FUNCC(draw_edges , depth);\ c->emulated_edge_mc = FUNC (ff_emulated_edge_mc , depth);\ c->clear_block = FUNCC(clear_block ## dct , depth);\ c->clear_blocks = FUNCC(clear_blocks ## dct , depth);\ c->add_pixels8 = FUNCC(add_pixels8 ## dct , depth);\ c->add_pixels4 = FUNCC(add_pixels4 ## dct , depth);\ c->put_no_rnd_pixels_l2[0] = FUNCC(put_no_rnd_pixels16_l2, depth);\ c->put_no_rnd_pixels_l2[1] = FUNCC(put_no_rnd_pixels8_l2 , depth);\ \ c->put_h264_chroma_pixels_tab[0] = FUNCC(put_h264_chroma_mc8 , depth);\ c->put_h264_chroma_pixels_tab[1] = FUNCC(put_h264_chroma_mc4 , depth);\ c->put_h264_chroma_pixels_tab[2] = FUNCC(put_h264_chroma_mc2 , depth);\ c->avg_h264_chroma_pixels_tab[0] = FUNCC(avg_h264_chroma_mc8 , depth);\ c->avg_h264_chroma_pixels_tab[1] = FUNCC(avg_h264_chroma_mc4 , depth);\ c->avg_h264_chroma_pixels_tab[2] = FUNCC(avg_h264_chroma_mc2 , depth);\ \ dspfunc1(put , 0, 16, depth);\ dspfunc1(put , 1, 8, depth);\ dspfunc1(put , 2, 4, depth);\ dspfunc1(put , 3, 2, depth);\ dspfunc1(put_no_rnd, 0, 16, depth);\ dspfunc1(put_no_rnd, 1, 8, depth);\ dspfunc1(avg , 0, 16, depth);\ dspfunc1(avg , 1, 8, depth);\ dspfunc1(avg , 2, 4, depth);\ dspfunc1(avg , 3, 2, depth);\ dspfunc1(avg_no_rnd, 0, 16, depth);\ dspfunc1(avg_no_rnd, 1, 8, depth);\ \ dspfunc2(put_h264_qpel, 0, 16, depth);\ dspfunc2(put_h264_qpel, 1, 8, depth);\ dspfunc2(put_h264_qpel, 2, 4, depth);\ dspfunc2(put_h264_qpel, 3, 2, depth);\ dspfunc2(avg_h264_qpel, 0, 16, depth);\ dspfunc2(avg_h264_qpel, 1, 8, depth);\ dspfunc2(avg_h264_qpel, 2, 4, depth); switch (avctx->bits_per_raw_sample) { case 9: if (c->dct_bits == 32) { BIT_DEPTH_FUNCS(9, _32); } else { BIT_DEPTH_FUNCS(9, _16); } break; case 10: if (c->dct_bits == 32) { BIT_DEPTH_FUNCS(10, _32); } else { BIT_DEPTH_FUNCS(10, _16); } break; default: av_log(avctx, AV_LOG_DEBUG, "Unsupported bit depth: %d\n", avctx->bits_per_raw_sample); case 8: BIT_DEPTH_FUNCS(8, _16); break; } if (HAVE_MMX) dsputil_init_mmx (c, avctx); if (ARCH_ARM) dsputil_init_arm (c, avctx); if (CONFIG_MLIB) dsputil_init_mlib (c, avctx); if (HAVE_VIS) dsputil_init_vis (c, avctx); if (ARCH_ALPHA) dsputil_init_alpha (c, avctx); if (ARCH_PPC) dsputil_init_ppc (c, avctx); if (HAVE_MMI) dsputil_init_mmi (c, avctx); if (ARCH_SH4) dsputil_init_sh4 (c, avctx); if (ARCH_BFIN) dsputil_init_bfin (c, avctx); for(i=0; i<64; i++){ if(!c->put_2tap_qpel_pixels_tab[0][i]) c->put_2tap_qpel_pixels_tab[0][i]= c->put_h264_qpel_pixels_tab[0][i]; if(!c->avg_2tap_qpel_pixels_tab[0][i]) c->avg_2tap_qpel_pixels_tab[0][i]= c->avg_h264_qpel_pixels_tab[0][i]; } ff_init_scantable_permutation(c->idct_permutation, c->idct_permutation_type); }
false
FFmpeg
6f1a5e8d6b7e085171a49b8ce6a371a7c9643764
av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx) { int i; ff_check_alignment(); #if CONFIG_ENCODERS if (avctx->bits_per_raw_sample == 10) { c->fdct = ff_jpeg_fdct_islow_10; c->fdct248 = ff_fdct248_islow_10; } else { if(avctx->dct_algo==FF_DCT_FASTINT) { c->fdct = fdct_ifast; c->fdct248 = fdct_ifast248; } else if(avctx->dct_algo==FF_DCT_FAAN) { c->fdct = ff_faandct; c->fdct248 = ff_faandct248; } else { c->fdct = ff_jpeg_fdct_islow_8; c->fdct248 = ff_fdct248_islow_8; } } #endif if(avctx->lowres==1){ c->idct_put= ff_jref_idct4_put; c->idct_add= ff_jref_idct4_add; c->idct = j_rev_dct4; c->idct_permutation_type= FF_NO_IDCT_PERM; }else if(avctx->lowres==2){ c->idct_put= ff_jref_idct2_put; c->idct_add= ff_jref_idct2_add; c->idct = j_rev_dct2; c->idct_permutation_type= FF_NO_IDCT_PERM; }else if(avctx->lowres==3){ c->idct_put= ff_jref_idct1_put; c->idct_add= ff_jref_idct1_add; c->idct = j_rev_dct1; c->idct_permutation_type= FF_NO_IDCT_PERM; }else{ if (avctx->bits_per_raw_sample == 10) { c->idct_put = ff_simple_idct_put_10; c->idct_add = ff_simple_idct_add_10; c->idct = ff_simple_idct_10; c->idct_permutation_type = FF_NO_IDCT_PERM; } else { if(avctx->idct_algo==FF_IDCT_INT){ c->idct_put= ff_jref_idct_put; c->idct_add= ff_jref_idct_add; c->idct = j_rev_dct; c->idct_permutation_type= FF_LIBMPEG2_IDCT_PERM; }else if((CONFIG_VP3_DECODER || CONFIG_VP5_DECODER || CONFIG_VP6_DECODER ) && avctx->idct_algo==FF_IDCT_VP3){ c->idct_put= ff_vp3_idct_put_c; c->idct_add= ff_vp3_idct_add_c; c->idct = ff_vp3_idct_c; c->idct_permutation_type= FF_NO_IDCT_PERM; }else if(avctx->idct_algo==FF_IDCT_WMV2){ c->idct_put= ff_wmv2_idct_put_c; c->idct_add= ff_wmv2_idct_add_c; c->idct = ff_wmv2_idct_c; c->idct_permutation_type= FF_NO_IDCT_PERM; }else if(avctx->idct_algo==FF_IDCT_FAAN){ c->idct_put= ff_faanidct_put; c->idct_add= ff_faanidct_add; c->idct = ff_faanidct; c->idct_permutation_type= FF_NO_IDCT_PERM; }else if(CONFIG_EATGQ_DECODER && avctx->idct_algo==FF_IDCT_EA) { c->idct_put= ff_ea_idct_put_c; c->idct_permutation_type= FF_NO_IDCT_PERM; }else{ c->idct_put = ff_simple_idct_put_8; c->idct_add = ff_simple_idct_add_8; c->idct = ff_simple_idct_8; c->idct_permutation_type= FF_NO_IDCT_PERM; } } } c->diff_pixels = diff_pixels_c; c->put_pixels_clamped = ff_put_pixels_clamped_c; c->put_signed_pixels_clamped = ff_put_signed_pixels_clamped_c; c->add_pixels_clamped = ff_add_pixels_clamped_c; c->sum_abs_dctelem = sum_abs_dctelem_c; c->gmc1 = gmc1_c; c->gmc = ff_gmc_c; c->pix_sum = pix_sum_c; c->pix_norm1 = pix_norm1_c; c->fill_block_tab[0] = fill_block16_c; c->fill_block_tab[1] = fill_block8_c; c->pix_abs[0][0] = pix_abs16_c; c->pix_abs[0][1] = pix_abs16_x2_c; c->pix_abs[0][2] = pix_abs16_y2_c; c->pix_abs[0][3] = pix_abs16_xy2_c; c->pix_abs[1][0] = pix_abs8_c; c->pix_abs[1][1] = pix_abs8_x2_c; c->pix_abs[1][2] = pix_abs8_y2_c; c->pix_abs[1][3] = pix_abs8_xy2_c; c->put_tpel_pixels_tab[ 0] = put_tpel_pixels_mc00_c; c->put_tpel_pixels_tab[ 1] = put_tpel_pixels_mc10_c; c->put_tpel_pixels_tab[ 2] = put_tpel_pixels_mc20_c; c->put_tpel_pixels_tab[ 4] = put_tpel_pixels_mc01_c; c->put_tpel_pixels_tab[ 5] = put_tpel_pixels_mc11_c; c->put_tpel_pixels_tab[ 6] = put_tpel_pixels_mc21_c; c->put_tpel_pixels_tab[ 8] = put_tpel_pixels_mc02_c; c->put_tpel_pixels_tab[ 9] = put_tpel_pixels_mc12_c; c->put_tpel_pixels_tab[10] = put_tpel_pixels_mc22_c; c->avg_tpel_pixels_tab[ 0] = avg_tpel_pixels_mc00_c; c->avg_tpel_pixels_tab[ 1] = avg_tpel_pixels_mc10_c; c->avg_tpel_pixels_tab[ 2] = avg_tpel_pixels_mc20_c; c->avg_tpel_pixels_tab[ 4] = avg_tpel_pixels_mc01_c; c->avg_tpel_pixels_tab[ 5] = avg_tpel_pixels_mc11_c; c->avg_tpel_pixels_tab[ 6] = avg_tpel_pixels_mc21_c; c->avg_tpel_pixels_tab[ 8] = avg_tpel_pixels_mc02_c; c->avg_tpel_pixels_tab[ 9] = avg_tpel_pixels_mc12_c; c->avg_tpel_pixels_tab[10] = avg_tpel_pixels_mc22_c; #define dspfunc(PFX, IDX, NUM) \ c->PFX ## _pixels_tab[IDX][ 0] = PFX ## NUM ## _mc00_c; \ c->PFX ## _pixels_tab[IDX][ 1] = PFX ## NUM ## _mc10_c; \ c->PFX ## _pixels_tab[IDX][ 2] = PFX ## NUM ## _mc20_c; \ c->PFX ## _pixels_tab[IDX][ 3] = PFX ## NUM ## _mc30_c; \ c->PFX ## _pixels_tab[IDX][ 4] = PFX ## NUM ## _mc01_c; \ c->PFX ## _pixels_tab[IDX][ 5] = PFX ## NUM ## _mc11_c; \ c->PFX ## _pixels_tab[IDX][ 6] = PFX ## NUM ## _mc21_c; \ c->PFX ## _pixels_tab[IDX][ 7] = PFX ## NUM ## _mc31_c; \ c->PFX ## _pixels_tab[IDX][ 8] = PFX ## NUM ## _mc02_c; \ c->PFX ## _pixels_tab[IDX][ 9] = PFX ## NUM ## _mc12_c; \ c->PFX ## _pixels_tab[IDX][10] = PFX ## NUM ## _mc22_c; \ c->PFX ## _pixels_tab[IDX][11] = PFX ## NUM ## _mc32_c; \ c->PFX ## _pixels_tab[IDX][12] = PFX ## NUM ## _mc03_c; \ c->PFX ## _pixels_tab[IDX][13] = PFX ## NUM ## _mc13_c; \ c->PFX ## _pixels_tab[IDX][14] = PFX ## NUM ## _mc23_c; \ c->PFX ## _pixels_tab[IDX][15] = PFX ## NUM ## _mc33_c dspfunc(put_qpel, 0, 16); dspfunc(put_no_rnd_qpel, 0, 16); dspfunc(avg_qpel, 0, 16); dspfunc(put_qpel, 1, 8); dspfunc(put_no_rnd_qpel, 1, 8); dspfunc(avg_qpel, 1, 8); #undef dspfunc #if CONFIG_MLP_DECODER || CONFIG_TRUEHD_DECODER ff_mlp_init(c, avctx); #endif #if CONFIG_WMV2_DECODER || CONFIG_VC1_DECODER ff_intrax8dsp_init(c,avctx); #endif c->put_mspel_pixels_tab[0]= ff_put_pixels8x8_c; c->put_mspel_pixels_tab[1]= put_mspel8_mc10_c; c->put_mspel_pixels_tab[2]= put_mspel8_mc20_c; c->put_mspel_pixels_tab[3]= put_mspel8_mc30_c; c->put_mspel_pixels_tab[4]= put_mspel8_mc02_c; c->put_mspel_pixels_tab[5]= put_mspel8_mc12_c; c->put_mspel_pixels_tab[6]= put_mspel8_mc22_c; c->put_mspel_pixels_tab[7]= put_mspel8_mc32_c; #define SET_CMP_FUNC(name) \ c->name[0]= name ## 16_c;\ c->name[1]= name ## 8x8_c; SET_CMP_FUNC(hadamard8_diff) c->hadamard8_diff[4]= hadamard8_intra16_c; c->hadamard8_diff[5]= hadamard8_intra8x8_c; SET_CMP_FUNC(dct_sad) SET_CMP_FUNC(dct_max) #if CONFIG_GPL SET_CMP_FUNC(dct264_sad) #endif c->sad[0]= pix_abs16_c; c->sad[1]= pix_abs8_c; c->sse[0]= sse16_c; c->sse[1]= sse8_c; c->sse[2]= sse4_c; SET_CMP_FUNC(quant_psnr) SET_CMP_FUNC(rd) SET_CMP_FUNC(bit) c->vsad[0]= vsad16_c; c->vsad[4]= vsad_intra16_c; c->vsad[5]= vsad_intra8_c; c->vsse[0]= vsse16_c; c->vsse[4]= vsse_intra16_c; c->vsse[5]= vsse_intra8_c; c->nsse[0]= nsse16_c; c->nsse[1]= nsse8_c; #if CONFIG_DWT ff_dsputil_init_dwt(c); #endif c->ssd_int8_vs_int16 = ssd_int8_vs_int16_c; c->add_bytes= add_bytes_c; c->diff_bytes= diff_bytes_c; c->add_hfyu_median_prediction= add_hfyu_median_prediction_c; c->sub_hfyu_median_prediction= sub_hfyu_median_prediction_c; c->add_hfyu_left_prediction = add_hfyu_left_prediction_c; c->add_hfyu_left_prediction_bgr32 = add_hfyu_left_prediction_bgr32_c; c->bswap_buf= bswap_buf; c->bswap16_buf = bswap16_buf; if (CONFIG_H263_DECODER || CONFIG_H263_ENCODER) { c->h263_h_loop_filter= h263_h_loop_filter_c; c->h263_v_loop_filter= h263_v_loop_filter_c; } if (CONFIG_VP3_DECODER) { c->vp3_h_loop_filter= ff_vp3_h_loop_filter_c; c->vp3_v_loop_filter= ff_vp3_v_loop_filter_c; c->vp3_idct_dc_add= ff_vp3_idct_dc_add_c; } c->h261_loop_filter= h261_loop_filter_c; c->try_8x8basis= try_8x8basis_c; c->add_8x8basis= add_8x8basis_c; #if CONFIG_VORBIS_DECODER c->vorbis_inverse_coupling = vorbis_inverse_coupling; #endif #if CONFIG_AC3_DECODER c->ac3_downmix = ff_ac3_downmix_c; #endif c->vector_fmul = vector_fmul_c; c->vector_fmul_reverse = vector_fmul_reverse_c; c->vector_fmul_add = vector_fmul_add_c; c->vector_fmul_window = vector_fmul_window_c; c->vector_clipf = vector_clipf_c; c->scalarproduct_int16 = scalarproduct_int16_c; c->scalarproduct_and_madd_int16 = scalarproduct_and_madd_int16_c; c->apply_window_int16 = apply_window_int16_c; c->vector_clip_int32 = vector_clip_int32_c; c->scalarproduct_float = scalarproduct_float_c; c->butterflies_float = butterflies_float_c; c->butterflies_float_interleave = butterflies_float_interleave_c; c->vector_fmul_scalar = vector_fmul_scalar_c; c->vector_fmac_scalar = vector_fmac_scalar_c; c->shrink[0]= av_image_copy_plane; c->shrink[1]= ff_shrink22; c->shrink[2]= ff_shrink44; c->shrink[3]= ff_shrink88; c->prefetch= just_return; memset(c->put_2tap_qpel_pixels_tab, 0, sizeof(c->put_2tap_qpel_pixels_tab)); memset(c->avg_2tap_qpel_pixels_tab, 0, sizeof(c->avg_2tap_qpel_pixels_tab)); #undef FUNC #undef FUNCC #define FUNC(f, depth) f ## _ ## depth #define FUNCC(f, depth) f ## _ ## depth ## _c #define dspfunc1(PFX, IDX, NUM, depth)\ c->PFX ## _pixels_tab[IDX][0] = FUNCC(PFX ## _pixels ## NUM , depth);\ c->PFX ## _pixels_tab[IDX][1] = FUNCC(PFX ## _pixels ## NUM ## _x2 , depth);\ c->PFX ## _pixels_tab[IDX][2] = FUNCC(PFX ## _pixels ## NUM ## _y2 , depth);\ c->PFX ## _pixels_tab[IDX][3] = FUNCC(PFX ## _pixels ## NUM ## _xy2, depth) #define dspfunc2(PFX, IDX, NUM, depth)\ c->PFX ## _pixels_tab[IDX][ 0] = FUNCC(PFX ## NUM ## _mc00, depth);\ c->PFX ## _pixels_tab[IDX][ 1] = FUNCC(PFX ## NUM ## _mc10, depth);\ c->PFX ## _pixels_tab[IDX][ 2] = FUNCC(PFX ## NUM ## _mc20, depth);\ c->PFX ## _pixels_tab[IDX][ 3] = FUNCC(PFX ## NUM ## _mc30, depth);\ c->PFX ## _pixels_tab[IDX][ 4] = FUNCC(PFX ## NUM ## _mc01, depth);\ c->PFX ## _pixels_tab[IDX][ 5] = FUNCC(PFX ## NUM ## _mc11, depth);\ c->PFX ## _pixels_tab[IDX][ 6] = FUNCC(PFX ## NUM ## _mc21, depth);\ c->PFX ## _pixels_tab[IDX][ 7] = FUNCC(PFX ## NUM ## _mc31, depth);\ c->PFX ## _pixels_tab[IDX][ 8] = FUNCC(PFX ## NUM ## _mc02, depth);\ c->PFX ## _pixels_tab[IDX][ 9] = FUNCC(PFX ## NUM ## _mc12, depth);\ c->PFX ## _pixels_tab[IDX][10] = FUNCC(PFX ## NUM ## _mc22, depth);\ c->PFX ## _pixels_tab[IDX][11] = FUNCC(PFX ## NUM ## _mc32, depth);\ c->PFX ## _pixels_tab[IDX][12] = FUNCC(PFX ## NUM ## _mc03, depth);\ c->PFX ## _pixels_tab[IDX][13] = FUNCC(PFX ## NUM ## _mc13, depth);\ c->PFX ## _pixels_tab[IDX][14] = FUNCC(PFX ## NUM ## _mc23, depth);\ c->PFX ## _pixels_tab[IDX][15] = FUNCC(PFX ## NUM ## _mc33, depth) #define BIT_DEPTH_FUNCS(depth, dct)\ c->get_pixels = FUNCC(get_pixels ## dct , depth);\ c->draw_edges = FUNCC(draw_edges , depth);\ c->emulated_edge_mc = FUNC (ff_emulated_edge_mc , depth);\ c->clear_block = FUNCC(clear_block ## dct , depth);\ c->clear_blocks = FUNCC(clear_blocks ## dct , depth);\ c->add_pixels8 = FUNCC(add_pixels8 ## dct , depth);\ c->add_pixels4 = FUNCC(add_pixels4 ## dct , depth);\ c->put_no_rnd_pixels_l2[0] = FUNCC(put_no_rnd_pixels16_l2, depth);\ c->put_no_rnd_pixels_l2[1] = FUNCC(put_no_rnd_pixels8_l2 , depth);\ \ c->put_h264_chroma_pixels_tab[0] = FUNCC(put_h264_chroma_mc8 , depth);\ c->put_h264_chroma_pixels_tab[1] = FUNCC(put_h264_chroma_mc4 , depth);\ c->put_h264_chroma_pixels_tab[2] = FUNCC(put_h264_chroma_mc2 , depth);\ c->avg_h264_chroma_pixels_tab[0] = FUNCC(avg_h264_chroma_mc8 , depth);\ c->avg_h264_chroma_pixels_tab[1] = FUNCC(avg_h264_chroma_mc4 , depth);\ c->avg_h264_chroma_pixels_tab[2] = FUNCC(avg_h264_chroma_mc2 , depth);\ \ dspfunc1(put , 0, 16, depth);\ dspfunc1(put , 1, 8, depth);\ dspfunc1(put , 2, 4, depth);\ dspfunc1(put , 3, 2, depth);\ dspfunc1(put_no_rnd, 0, 16, depth);\ dspfunc1(put_no_rnd, 1, 8, depth);\ dspfunc1(avg , 0, 16, depth);\ dspfunc1(avg , 1, 8, depth);\ dspfunc1(avg , 2, 4, depth);\ dspfunc1(avg , 3, 2, depth);\ dspfunc1(avg_no_rnd, 0, 16, depth);\ dspfunc1(avg_no_rnd, 1, 8, depth);\ \ dspfunc2(put_h264_qpel, 0, 16, depth);\ dspfunc2(put_h264_qpel, 1, 8, depth);\ dspfunc2(put_h264_qpel, 2, 4, depth);\ dspfunc2(put_h264_qpel, 3, 2, depth);\ dspfunc2(avg_h264_qpel, 0, 16, depth);\ dspfunc2(avg_h264_qpel, 1, 8, depth);\ dspfunc2(avg_h264_qpel, 2, 4, depth); switch (avctx->bits_per_raw_sample) { case 9: if (c->dct_bits == 32) { BIT_DEPTH_FUNCS(9, _32); } else { BIT_DEPTH_FUNCS(9, _16); } break; case 10: if (c->dct_bits == 32) { BIT_DEPTH_FUNCS(10, _32); } else { BIT_DEPTH_FUNCS(10, _16); } break; default: av_log(avctx, AV_LOG_DEBUG, "Unsupported bit depth: %d\n", avctx->bits_per_raw_sample); case 8: BIT_DEPTH_FUNCS(8, _16); break; } if (HAVE_MMX) dsputil_init_mmx (c, avctx); if (ARCH_ARM) dsputil_init_arm (c, avctx); if (CONFIG_MLIB) dsputil_init_mlib (c, avctx); if (HAVE_VIS) dsputil_init_vis (c, avctx); if (ARCH_ALPHA) dsputil_init_alpha (c, avctx); if (ARCH_PPC) dsputil_init_ppc (c, avctx); if (HAVE_MMI) dsputil_init_mmi (c, avctx); if (ARCH_SH4) dsputil_init_sh4 (c, avctx); if (ARCH_BFIN) dsputil_init_bfin (c, avctx); for(i=0; i<64; i++){ if(!c->put_2tap_qpel_pixels_tab[0][i]) c->put_2tap_qpel_pixels_tab[0][i]= c->put_h264_qpel_pixels_tab[0][i]; if(!c->avg_2tap_qpel_pixels_tab[0][i]) c->avg_2tap_qpel_pixels_tab[0][i]= c->avg_h264_qpel_pixels_tab[0][i]; } ff_init_scantable_permutation(c->idct_permutation, c->idct_permutation_type); }
{ "code": [], "line_no": [] }
av_cold void FUNC_0(DSPContext* c, AVCodecContext *avctx) { int VAR_0; ff_check_alignment(); #if CONFIG_ENCODERS if (avctx->bits_per_raw_sample == 10) { c->fdct = ff_jpeg_fdct_islow_10; c->fdct248 = ff_fdct248_islow_10; } else { if(avctx->dct_algo==FF_DCT_FASTINT) { c->fdct = fdct_ifast; c->fdct248 = fdct_ifast248; } else if(avctx->dct_algo==FF_DCT_FAAN) { c->fdct = ff_faandct; c->fdct248 = ff_faandct248; } else { c->fdct = ff_jpeg_fdct_islow_8; c->fdct248 = ff_fdct248_islow_8; } } #endif if(avctx->lowres==1){ c->idct_put= ff_jref_idct4_put; c->idct_add= ff_jref_idct4_add; c->idct = j_rev_dct4; c->idct_permutation_type= FF_NO_IDCT_PERM; }else if(avctx->lowres==2){ c->idct_put= ff_jref_idct2_put; c->idct_add= ff_jref_idct2_add; c->idct = j_rev_dct2; c->idct_permutation_type= FF_NO_IDCT_PERM; }else if(avctx->lowres==3){ c->idct_put= ff_jref_idct1_put; c->idct_add= ff_jref_idct1_add; c->idct = j_rev_dct1; c->idct_permutation_type= FF_NO_IDCT_PERM; }else{ if (avctx->bits_per_raw_sample == 10) { c->idct_put = ff_simple_idct_put_10; c->idct_add = ff_simple_idct_add_10; c->idct = ff_simple_idct_10; c->idct_permutation_type = FF_NO_IDCT_PERM; } else { if(avctx->idct_algo==FF_IDCT_INT){ c->idct_put= ff_jref_idct_put; c->idct_add= ff_jref_idct_add; c->idct = j_rev_dct; c->idct_permutation_type= FF_LIBMPEG2_IDCT_PERM; }else if((CONFIG_VP3_DECODER || CONFIG_VP5_DECODER || CONFIG_VP6_DECODER ) && avctx->idct_algo==FF_IDCT_VP3){ c->idct_put= ff_vp3_idct_put_c; c->idct_add= ff_vp3_idct_add_c; c->idct = ff_vp3_idct_c; c->idct_permutation_type= FF_NO_IDCT_PERM; }else if(avctx->idct_algo==FF_IDCT_WMV2){ c->idct_put= ff_wmv2_idct_put_c; c->idct_add= ff_wmv2_idct_add_c; c->idct = ff_wmv2_idct_c; c->idct_permutation_type= FF_NO_IDCT_PERM; }else if(avctx->idct_algo==FF_IDCT_FAAN){ c->idct_put= ff_faanidct_put; c->idct_add= ff_faanidct_add; c->idct = ff_faanidct; c->idct_permutation_type= FF_NO_IDCT_PERM; }else if(CONFIG_EATGQ_DECODER && avctx->idct_algo==FF_IDCT_EA) { c->idct_put= ff_ea_idct_put_c; c->idct_permutation_type= FF_NO_IDCT_PERM; }else{ c->idct_put = ff_simple_idct_put_8; c->idct_add = ff_simple_idct_add_8; c->idct = ff_simple_idct_8; c->idct_permutation_type= FF_NO_IDCT_PERM; } } } c->diff_pixels = diff_pixels_c; c->put_pixels_clamped = ff_put_pixels_clamped_c; c->put_signed_pixels_clamped = ff_put_signed_pixels_clamped_c; c->add_pixels_clamped = ff_add_pixels_clamped_c; c->sum_abs_dctelem = sum_abs_dctelem_c; c->gmc1 = gmc1_c; c->gmc = ff_gmc_c; c->pix_sum = pix_sum_c; c->pix_norm1 = pix_norm1_c; c->fill_block_tab[0] = fill_block16_c; c->fill_block_tab[1] = fill_block8_c; c->pix_abs[0][0] = pix_abs16_c; c->pix_abs[0][1] = pix_abs16_x2_c; c->pix_abs[0][2] = pix_abs16_y2_c; c->pix_abs[0][3] = pix_abs16_xy2_c; c->pix_abs[1][0] = pix_abs8_c; c->pix_abs[1][1] = pix_abs8_x2_c; c->pix_abs[1][2] = pix_abs8_y2_c; c->pix_abs[1][3] = pix_abs8_xy2_c; c->put_tpel_pixels_tab[ 0] = put_tpel_pixels_mc00_c; c->put_tpel_pixels_tab[ 1] = put_tpel_pixels_mc10_c; c->put_tpel_pixels_tab[ 2] = put_tpel_pixels_mc20_c; c->put_tpel_pixels_tab[ 4] = put_tpel_pixels_mc01_c; c->put_tpel_pixels_tab[ 5] = put_tpel_pixels_mc11_c; c->put_tpel_pixels_tab[ 6] = put_tpel_pixels_mc21_c; c->put_tpel_pixels_tab[ 8] = put_tpel_pixels_mc02_c; c->put_tpel_pixels_tab[ 9] = put_tpel_pixels_mc12_c; c->put_tpel_pixels_tab[10] = put_tpel_pixels_mc22_c; c->avg_tpel_pixels_tab[ 0] = avg_tpel_pixels_mc00_c; c->avg_tpel_pixels_tab[ 1] = avg_tpel_pixels_mc10_c; c->avg_tpel_pixels_tab[ 2] = avg_tpel_pixels_mc20_c; c->avg_tpel_pixels_tab[ 4] = avg_tpel_pixels_mc01_c; c->avg_tpel_pixels_tab[ 5] = avg_tpel_pixels_mc11_c; c->avg_tpel_pixels_tab[ 6] = avg_tpel_pixels_mc21_c; c->avg_tpel_pixels_tab[ 8] = avg_tpel_pixels_mc02_c; c->avg_tpel_pixels_tab[ 9] = avg_tpel_pixels_mc12_c; c->avg_tpel_pixels_tab[10] = avg_tpel_pixels_mc22_c; #define dspfunc(PFX, IDX, NUM) \ c->PFX ## _pixels_tab[IDX][ 0] = PFX ## NUM ## _mc00_c; \ c->PFX ## _pixels_tab[IDX][ 1] = PFX ## NUM ## _mc10_c; \ c->PFX ## _pixels_tab[IDX][ 2] = PFX ## NUM ## _mc20_c; \ c->PFX ## _pixels_tab[IDX][ 3] = PFX ## NUM ## _mc30_c; \ c->PFX ## _pixels_tab[IDX][ 4] = PFX ## NUM ## _mc01_c; \ c->PFX ## _pixels_tab[IDX][ 5] = PFX ## NUM ## _mc11_c; \ c->PFX ## _pixels_tab[IDX][ 6] = PFX ## NUM ## _mc21_c; \ c->PFX ## _pixels_tab[IDX][ 7] = PFX ## NUM ## _mc31_c; \ c->PFX ## _pixels_tab[IDX][ 8] = PFX ## NUM ## _mc02_c; \ c->PFX ## _pixels_tab[IDX][ 9] = PFX ## NUM ## _mc12_c; \ c->PFX ## _pixels_tab[IDX][10] = PFX ## NUM ## _mc22_c; \ c->PFX ## _pixels_tab[IDX][11] = PFX ## NUM ## _mc32_c; \ c->PFX ## _pixels_tab[IDX][12] = PFX ## NUM ## _mc03_c; \ c->PFX ## _pixels_tab[IDX][13] = PFX ## NUM ## _mc13_c; \ c->PFX ## _pixels_tab[IDX][14] = PFX ## NUM ## _mc23_c; \ c->PFX ## _pixels_tab[IDX][15] = PFX ## NUM ## _mc33_c dspfunc(put_qpel, 0, 16); dspfunc(put_no_rnd_qpel, 0, 16); dspfunc(avg_qpel, 0, 16); dspfunc(put_qpel, 1, 8); dspfunc(put_no_rnd_qpel, 1, 8); dspfunc(avg_qpel, 1, 8); #undef dspfunc #if CONFIG_MLP_DECODER || CONFIG_TRUEHD_DECODER ff_mlp_init(c, avctx); #endif #if CONFIG_WMV2_DECODER || CONFIG_VC1_DECODER ff_intrax8dsp_init(c,avctx); #endif c->put_mspel_pixels_tab[0]= ff_put_pixels8x8_c; c->put_mspel_pixels_tab[1]= put_mspel8_mc10_c; c->put_mspel_pixels_tab[2]= put_mspel8_mc20_c; c->put_mspel_pixels_tab[3]= put_mspel8_mc30_c; c->put_mspel_pixels_tab[4]= put_mspel8_mc02_c; c->put_mspel_pixels_tab[5]= put_mspel8_mc12_c; c->put_mspel_pixels_tab[6]= put_mspel8_mc22_c; c->put_mspel_pixels_tab[7]= put_mspel8_mc32_c; #define SET_CMP_FUNC(name) \ c->name[0]= name ## 16_c;\ c->name[1]= name ## 8x8_c; SET_CMP_FUNC(hadamard8_diff) c->hadamard8_diff[4]= hadamard8_intra16_c; c->hadamard8_diff[5]= hadamard8_intra8x8_c; SET_CMP_FUNC(dct_sad) SET_CMP_FUNC(dct_max) #if CONFIG_GPL SET_CMP_FUNC(dct264_sad) #endif c->sad[0]= pix_abs16_c; c->sad[1]= pix_abs8_c; c->sse[0]= sse16_c; c->sse[1]= sse8_c; c->sse[2]= sse4_c; SET_CMP_FUNC(quant_psnr) SET_CMP_FUNC(rd) SET_CMP_FUNC(bit) c->vsad[0]= vsad16_c; c->vsad[4]= vsad_intra16_c; c->vsad[5]= vsad_intra8_c; c->vsse[0]= vsse16_c; c->vsse[4]= vsse_intra16_c; c->vsse[5]= vsse_intra8_c; c->nsse[0]= nsse16_c; c->nsse[1]= nsse8_c; #if CONFIG_DWT ff_dsputil_init_dwt(c); #endif c->ssd_int8_vs_int16 = ssd_int8_vs_int16_c; c->add_bytes= add_bytes_c; c->diff_bytes= diff_bytes_c; c->add_hfyu_median_prediction= add_hfyu_median_prediction_c; c->sub_hfyu_median_prediction= sub_hfyu_median_prediction_c; c->add_hfyu_left_prediction = add_hfyu_left_prediction_c; c->add_hfyu_left_prediction_bgr32 = add_hfyu_left_prediction_bgr32_c; c->bswap_buf= bswap_buf; c->bswap16_buf = bswap16_buf; if (CONFIG_H263_DECODER || CONFIG_H263_ENCODER) { c->h263_h_loop_filter= h263_h_loop_filter_c; c->h263_v_loop_filter= h263_v_loop_filter_c; } if (CONFIG_VP3_DECODER) { c->vp3_h_loop_filter= ff_vp3_h_loop_filter_c; c->vp3_v_loop_filter= ff_vp3_v_loop_filter_c; c->vp3_idct_dc_add= ff_vp3_idct_dc_add_c; } c->h261_loop_filter= h261_loop_filter_c; c->try_8x8basis= try_8x8basis_c; c->add_8x8basis= add_8x8basis_c; #if CONFIG_VORBIS_DECODER c->vorbis_inverse_coupling = vorbis_inverse_coupling; #endif #if CONFIG_AC3_DECODER c->ac3_downmix = ff_ac3_downmix_c; #endif c->vector_fmul = vector_fmul_c; c->vector_fmul_reverse = vector_fmul_reverse_c; c->vector_fmul_add = vector_fmul_add_c; c->vector_fmul_window = vector_fmul_window_c; c->vector_clipf = vector_clipf_c; c->scalarproduct_int16 = scalarproduct_int16_c; c->scalarproduct_and_madd_int16 = scalarproduct_and_madd_int16_c; c->apply_window_int16 = apply_window_int16_c; c->vector_clip_int32 = vector_clip_int32_c; c->scalarproduct_float = scalarproduct_float_c; c->butterflies_float = butterflies_float_c; c->butterflies_float_interleave = butterflies_float_interleave_c; c->vector_fmul_scalar = vector_fmul_scalar_c; c->vector_fmac_scalar = vector_fmac_scalar_c; c->shrink[0]= av_image_copy_plane; c->shrink[1]= ff_shrink22; c->shrink[2]= ff_shrink44; c->shrink[3]= ff_shrink88; c->prefetch= just_return; memset(c->put_2tap_qpel_pixels_tab, 0, sizeof(c->put_2tap_qpel_pixels_tab)); memset(c->avg_2tap_qpel_pixels_tab, 0, sizeof(c->avg_2tap_qpel_pixels_tab)); #undef FUNC #undef FUNCC #define FUNC(f, depth) f ## _ ## depth #define FUNCC(f, depth) f ## _ ## depth ## _c #define dspfunc1(PFX, IDX, NUM, depth)\ c->PFX ## _pixels_tab[IDX][0] = FUNCC(PFX ## _pixels ## NUM , depth);\ c->PFX ## _pixels_tab[IDX][1] = FUNCC(PFX ## _pixels ## NUM ## _x2 , depth);\ c->PFX ## _pixels_tab[IDX][2] = FUNCC(PFX ## _pixels ## NUM ## _y2 , depth);\ c->PFX ## _pixels_tab[IDX][3] = FUNCC(PFX ## _pixels ## NUM ## _xy2, depth) #define dspfunc2(PFX, IDX, NUM, depth)\ c->PFX ## _pixels_tab[IDX][ 0] = FUNCC(PFX ## NUM ## _mc00, depth);\ c->PFX ## _pixels_tab[IDX][ 1] = FUNCC(PFX ## NUM ## _mc10, depth);\ c->PFX ## _pixels_tab[IDX][ 2] = FUNCC(PFX ## NUM ## _mc20, depth);\ c->PFX ## _pixels_tab[IDX][ 3] = FUNCC(PFX ## NUM ## _mc30, depth);\ c->PFX ## _pixels_tab[IDX][ 4] = FUNCC(PFX ## NUM ## _mc01, depth);\ c->PFX ## _pixels_tab[IDX][ 5] = FUNCC(PFX ## NUM ## _mc11, depth);\ c->PFX ## _pixels_tab[IDX][ 6] = FUNCC(PFX ## NUM ## _mc21, depth);\ c->PFX ## _pixels_tab[IDX][ 7] = FUNCC(PFX ## NUM ## _mc31, depth);\ c->PFX ## _pixels_tab[IDX][ 8] = FUNCC(PFX ## NUM ## _mc02, depth);\ c->PFX ## _pixels_tab[IDX][ 9] = FUNCC(PFX ## NUM ## _mc12, depth);\ c->PFX ## _pixels_tab[IDX][10] = FUNCC(PFX ## NUM ## _mc22, depth);\ c->PFX ## _pixels_tab[IDX][11] = FUNCC(PFX ## NUM ## _mc32, depth);\ c->PFX ## _pixels_tab[IDX][12] = FUNCC(PFX ## NUM ## _mc03, depth);\ c->PFX ## _pixels_tab[IDX][13] = FUNCC(PFX ## NUM ## _mc13, depth);\ c->PFX ## _pixels_tab[IDX][14] = FUNCC(PFX ## NUM ## _mc23, depth);\ c->PFX ## _pixels_tab[IDX][15] = FUNCC(PFX ## NUM ## _mc33, depth) #define BIT_DEPTH_FUNCS(depth, dct)\ c->get_pixels = FUNCC(get_pixels ## dct , depth);\ c->draw_edges = FUNCC(draw_edges , depth);\ c->emulated_edge_mc = FUNC (ff_emulated_edge_mc , depth);\ c->clear_block = FUNCC(clear_block ## dct , depth);\ c->clear_blocks = FUNCC(clear_blocks ## dct , depth);\ c->add_pixels8 = FUNCC(add_pixels8 ## dct , depth);\ c->add_pixels4 = FUNCC(add_pixels4 ## dct , depth);\ c->put_no_rnd_pixels_l2[0] = FUNCC(put_no_rnd_pixels16_l2, depth);\ c->put_no_rnd_pixels_l2[1] = FUNCC(put_no_rnd_pixels8_l2 , depth);\ \ c->put_h264_chroma_pixels_tab[0] = FUNCC(put_h264_chroma_mc8 , depth);\ c->put_h264_chroma_pixels_tab[1] = FUNCC(put_h264_chroma_mc4 , depth);\ c->put_h264_chroma_pixels_tab[2] = FUNCC(put_h264_chroma_mc2 , depth);\ c->avg_h264_chroma_pixels_tab[0] = FUNCC(avg_h264_chroma_mc8 , depth);\ c->avg_h264_chroma_pixels_tab[1] = FUNCC(avg_h264_chroma_mc4 , depth);\ c->avg_h264_chroma_pixels_tab[2] = FUNCC(avg_h264_chroma_mc2 , depth);\ \ dspfunc1(put , 0, 16, depth);\ dspfunc1(put , 1, 8, depth);\ dspfunc1(put , 2, 4, depth);\ dspfunc1(put , 3, 2, depth);\ dspfunc1(put_no_rnd, 0, 16, depth);\ dspfunc1(put_no_rnd, 1, 8, depth);\ dspfunc1(avg , 0, 16, depth);\ dspfunc1(avg , 1, 8, depth);\ dspfunc1(avg , 2, 4, depth);\ dspfunc1(avg , 3, 2, depth);\ dspfunc1(avg_no_rnd, 0, 16, depth);\ dspfunc1(avg_no_rnd, 1, 8, depth);\ \ dspfunc2(put_h264_qpel, 0, 16, depth);\ dspfunc2(put_h264_qpel, 1, 8, depth);\ dspfunc2(put_h264_qpel, 2, 4, depth);\ dspfunc2(put_h264_qpel, 3, 2, depth);\ dspfunc2(avg_h264_qpel, 0, 16, depth);\ dspfunc2(avg_h264_qpel, 1, 8, depth);\ dspfunc2(avg_h264_qpel, 2, 4, depth); switch (avctx->bits_per_raw_sample) { case 9: if (c->dct_bits == 32) { BIT_DEPTH_FUNCS(9, _32); } else { BIT_DEPTH_FUNCS(9, _16); } break; case 10: if (c->dct_bits == 32) { BIT_DEPTH_FUNCS(10, _32); } else { BIT_DEPTH_FUNCS(10, _16); } break; default: av_log(avctx, AV_LOG_DEBUG, "Unsupported bit depth: %d\n", avctx->bits_per_raw_sample); case 8: BIT_DEPTH_FUNCS(8, _16); break; } if (HAVE_MMX) dsputil_init_mmx (c, avctx); if (ARCH_ARM) dsputil_init_arm (c, avctx); if (CONFIG_MLIB) dsputil_init_mlib (c, avctx); if (HAVE_VIS) dsputil_init_vis (c, avctx); if (ARCH_ALPHA) dsputil_init_alpha (c, avctx); if (ARCH_PPC) dsputil_init_ppc (c, avctx); if (HAVE_MMI) dsputil_init_mmi (c, avctx); if (ARCH_SH4) dsputil_init_sh4 (c, avctx); if (ARCH_BFIN) dsputil_init_bfin (c, avctx); for(VAR_0=0; VAR_0<64; VAR_0++){ if(!c->put_2tap_qpel_pixels_tab[0][VAR_0]) c->put_2tap_qpel_pixels_tab[0][VAR_0]= c->put_h264_qpel_pixels_tab[0][VAR_0]; if(!c->avg_2tap_qpel_pixels_tab[0][VAR_0]) c->avg_2tap_qpel_pixels_tab[0][VAR_0]= c->avg_h264_qpel_pixels_tab[0][VAR_0]; } ff_init_scantable_permutation(c->idct_permutation, c->idct_permutation_type); }
[ "av_cold void FUNC_0(DSPContext* c, AVCodecContext *avctx)\n{", "int VAR_0;", "ff_check_alignment();", "#if CONFIG_ENCODERS\nif (avctx->bits_per_raw_sample == 10) {", "c->fdct = ff_jpeg_fdct_islow_10;", "c->fdct248 = ff_fdct248_islow_10;", "} else {", "if(avctx->dct_algo==FF_DCT_FASTINT) {", "c->fdct = fdct_ifast;", "c->fdct248 = fdct_ifast248;", "}", "else if(avctx->dct_algo==FF_DCT_FAAN) {", "c->fdct = ff_faandct;", "c->fdct248 = ff_faandct248;", "}", "else {", "c->fdct = ff_jpeg_fdct_islow_8;", "c->fdct248 = ff_fdct248_islow_8;", "}", "}", "#endif\nif(avctx->lowres==1){", "c->idct_put= ff_jref_idct4_put;", "c->idct_add= ff_jref_idct4_add;", "c->idct = j_rev_dct4;", "c->idct_permutation_type= FF_NO_IDCT_PERM;", "}else if(avctx->lowres==2){", "c->idct_put= ff_jref_idct2_put;", "c->idct_add= ff_jref_idct2_add;", "c->idct = j_rev_dct2;", "c->idct_permutation_type= FF_NO_IDCT_PERM;", "}else if(avctx->lowres==3){", "c->idct_put= ff_jref_idct1_put;", "c->idct_add= ff_jref_idct1_add;", "c->idct = j_rev_dct1;", "c->idct_permutation_type= FF_NO_IDCT_PERM;", "}else{", "if (avctx->bits_per_raw_sample == 10) {", "c->idct_put = ff_simple_idct_put_10;", "c->idct_add = ff_simple_idct_add_10;", "c->idct = ff_simple_idct_10;", "c->idct_permutation_type = FF_NO_IDCT_PERM;", "} else {", "if(avctx->idct_algo==FF_IDCT_INT){", "c->idct_put= ff_jref_idct_put;", "c->idct_add= ff_jref_idct_add;", "c->idct = j_rev_dct;", "c->idct_permutation_type= FF_LIBMPEG2_IDCT_PERM;", "}else if((CONFIG_VP3_DECODER || CONFIG_VP5_DECODER || CONFIG_VP6_DECODER ) &&", "avctx->idct_algo==FF_IDCT_VP3){", "c->idct_put= ff_vp3_idct_put_c;", "c->idct_add= ff_vp3_idct_add_c;", "c->idct = ff_vp3_idct_c;", "c->idct_permutation_type= FF_NO_IDCT_PERM;", "}else if(avctx->idct_algo==FF_IDCT_WMV2){", "c->idct_put= ff_wmv2_idct_put_c;", "c->idct_add= ff_wmv2_idct_add_c;", "c->idct = ff_wmv2_idct_c;", "c->idct_permutation_type= FF_NO_IDCT_PERM;", "}else if(avctx->idct_algo==FF_IDCT_FAAN){", "c->idct_put= ff_faanidct_put;", "c->idct_add= ff_faanidct_add;", "c->idct = ff_faanidct;", "c->idct_permutation_type= FF_NO_IDCT_PERM;", "}else if(CONFIG_EATGQ_DECODER && avctx->idct_algo==FF_IDCT_EA) {", "c->idct_put= ff_ea_idct_put_c;", "c->idct_permutation_type= FF_NO_IDCT_PERM;", "}else{", "c->idct_put = ff_simple_idct_put_8;", "c->idct_add = ff_simple_idct_add_8;", "c->idct = ff_simple_idct_8;", "c->idct_permutation_type= FF_NO_IDCT_PERM;", "}", "}", "}", "c->diff_pixels = diff_pixels_c;", "c->put_pixels_clamped = ff_put_pixels_clamped_c;", "c->put_signed_pixels_clamped = ff_put_signed_pixels_clamped_c;", "c->add_pixels_clamped = ff_add_pixels_clamped_c;", "c->sum_abs_dctelem = sum_abs_dctelem_c;", "c->gmc1 = gmc1_c;", "c->gmc = ff_gmc_c;", "c->pix_sum = pix_sum_c;", "c->pix_norm1 = pix_norm1_c;", "c->fill_block_tab[0] = fill_block16_c;", "c->fill_block_tab[1] = fill_block8_c;", "c->pix_abs[0][0] = pix_abs16_c;", "c->pix_abs[0][1] = pix_abs16_x2_c;", "c->pix_abs[0][2] = pix_abs16_y2_c;", "c->pix_abs[0][3] = pix_abs16_xy2_c;", "c->pix_abs[1][0] = pix_abs8_c;", "c->pix_abs[1][1] = pix_abs8_x2_c;", "c->pix_abs[1][2] = pix_abs8_y2_c;", "c->pix_abs[1][3] = pix_abs8_xy2_c;", "c->put_tpel_pixels_tab[ 0] = put_tpel_pixels_mc00_c;", "c->put_tpel_pixels_tab[ 1] = put_tpel_pixels_mc10_c;", "c->put_tpel_pixels_tab[ 2] = put_tpel_pixels_mc20_c;", "c->put_tpel_pixels_tab[ 4] = put_tpel_pixels_mc01_c;", "c->put_tpel_pixels_tab[ 5] = put_tpel_pixels_mc11_c;", "c->put_tpel_pixels_tab[ 6] = put_tpel_pixels_mc21_c;", "c->put_tpel_pixels_tab[ 8] = put_tpel_pixels_mc02_c;", "c->put_tpel_pixels_tab[ 9] = put_tpel_pixels_mc12_c;", "c->put_tpel_pixels_tab[10] = put_tpel_pixels_mc22_c;", "c->avg_tpel_pixels_tab[ 0] = avg_tpel_pixels_mc00_c;", "c->avg_tpel_pixels_tab[ 1] = avg_tpel_pixels_mc10_c;", "c->avg_tpel_pixels_tab[ 2] = avg_tpel_pixels_mc20_c;", "c->avg_tpel_pixels_tab[ 4] = avg_tpel_pixels_mc01_c;", "c->avg_tpel_pixels_tab[ 5] = avg_tpel_pixels_mc11_c;", "c->avg_tpel_pixels_tab[ 6] = avg_tpel_pixels_mc21_c;", "c->avg_tpel_pixels_tab[ 8] = avg_tpel_pixels_mc02_c;", "c->avg_tpel_pixels_tab[ 9] = avg_tpel_pixels_mc12_c;", "c->avg_tpel_pixels_tab[10] = avg_tpel_pixels_mc22_c;", "#define dspfunc(PFX, IDX, NUM) \\\nc->PFX ## _pixels_tab[IDX][ 0] = PFX ## NUM ## _mc00_c; \\", "c->PFX ## _pixels_tab[IDX][ 1] = PFX ## NUM ## _mc10_c; \\", "c->PFX ## _pixels_tab[IDX][ 2] = PFX ## NUM ## _mc20_c; \\", "c->PFX ## _pixels_tab[IDX][ 3] = PFX ## NUM ## _mc30_c; \\", "c->PFX ## _pixels_tab[IDX][ 4] = PFX ## NUM ## _mc01_c; \\", "c->PFX ## _pixels_tab[IDX][ 5] = PFX ## NUM ## _mc11_c; \\", "c->PFX ## _pixels_tab[IDX][ 6] = PFX ## NUM ## _mc21_c; \\", "c->PFX ## _pixels_tab[IDX][ 7] = PFX ## NUM ## _mc31_c; \\", "c->PFX ## _pixels_tab[IDX][ 8] = PFX ## NUM ## _mc02_c; \\", "c->PFX ## _pixels_tab[IDX][ 9] = PFX ## NUM ## _mc12_c; \\", "c->PFX ## _pixels_tab[IDX][10] = PFX ## NUM ## _mc22_c; \\", "c->PFX ## _pixels_tab[IDX][11] = PFX ## NUM ## _mc32_c; \\", "c->PFX ## _pixels_tab[IDX][12] = PFX ## NUM ## _mc03_c; \\", "c->PFX ## _pixels_tab[IDX][13] = PFX ## NUM ## _mc13_c; \\", "c->PFX ## _pixels_tab[IDX][14] = PFX ## NUM ## _mc23_c; \\", "c->PFX ## _pixels_tab[IDX][15] = PFX ## NUM ## _mc33_c\ndspfunc(put_qpel, 0, 16);", "dspfunc(put_no_rnd_qpel, 0, 16);", "dspfunc(avg_qpel, 0, 16);", "dspfunc(put_qpel, 1, 8);", "dspfunc(put_no_rnd_qpel, 1, 8);", "dspfunc(avg_qpel, 1, 8);", "#undef dspfunc\n#if CONFIG_MLP_DECODER || CONFIG_TRUEHD_DECODER\nff_mlp_init(c, avctx);", "#endif\n#if CONFIG_WMV2_DECODER || CONFIG_VC1_DECODER\nff_intrax8dsp_init(c,avctx);", "#endif\nc->put_mspel_pixels_tab[0]= ff_put_pixels8x8_c;", "c->put_mspel_pixels_tab[1]= put_mspel8_mc10_c;", "c->put_mspel_pixels_tab[2]= put_mspel8_mc20_c;", "c->put_mspel_pixels_tab[3]= put_mspel8_mc30_c;", "c->put_mspel_pixels_tab[4]= put_mspel8_mc02_c;", "c->put_mspel_pixels_tab[5]= put_mspel8_mc12_c;", "c->put_mspel_pixels_tab[6]= put_mspel8_mc22_c;", "c->put_mspel_pixels_tab[7]= put_mspel8_mc32_c;", "#define SET_CMP_FUNC(name) \\\nc->name[0]= name ## 16_c;\\", "c->name[1]= name ## 8x8_c;", "SET_CMP_FUNC(hadamard8_diff)\nc->hadamard8_diff[4]= hadamard8_intra16_c;", "c->hadamard8_diff[5]= hadamard8_intra8x8_c;", "SET_CMP_FUNC(dct_sad)\nSET_CMP_FUNC(dct_max)\n#if CONFIG_GPL\nSET_CMP_FUNC(dct264_sad)\n#endif\nc->sad[0]= pix_abs16_c;", "c->sad[1]= pix_abs8_c;", "c->sse[0]= sse16_c;", "c->sse[1]= sse8_c;", "c->sse[2]= sse4_c;", "SET_CMP_FUNC(quant_psnr)\nSET_CMP_FUNC(rd)\nSET_CMP_FUNC(bit)\nc->vsad[0]= vsad16_c;", "c->vsad[4]= vsad_intra16_c;", "c->vsad[5]= vsad_intra8_c;", "c->vsse[0]= vsse16_c;", "c->vsse[4]= vsse_intra16_c;", "c->vsse[5]= vsse_intra8_c;", "c->nsse[0]= nsse16_c;", "c->nsse[1]= nsse8_c;", "#if CONFIG_DWT\nff_dsputil_init_dwt(c);", "#endif\nc->ssd_int8_vs_int16 = ssd_int8_vs_int16_c;", "c->add_bytes= add_bytes_c;", "c->diff_bytes= diff_bytes_c;", "c->add_hfyu_median_prediction= add_hfyu_median_prediction_c;", "c->sub_hfyu_median_prediction= sub_hfyu_median_prediction_c;", "c->add_hfyu_left_prediction = add_hfyu_left_prediction_c;", "c->add_hfyu_left_prediction_bgr32 = add_hfyu_left_prediction_bgr32_c;", "c->bswap_buf= bswap_buf;", "c->bswap16_buf = bswap16_buf;", "if (CONFIG_H263_DECODER || CONFIG_H263_ENCODER) {", "c->h263_h_loop_filter= h263_h_loop_filter_c;", "c->h263_v_loop_filter= h263_v_loop_filter_c;", "}", "if (CONFIG_VP3_DECODER) {", "c->vp3_h_loop_filter= ff_vp3_h_loop_filter_c;", "c->vp3_v_loop_filter= ff_vp3_v_loop_filter_c;", "c->vp3_idct_dc_add= ff_vp3_idct_dc_add_c;", "}", "c->h261_loop_filter= h261_loop_filter_c;", "c->try_8x8basis= try_8x8basis_c;", "c->add_8x8basis= add_8x8basis_c;", "#if CONFIG_VORBIS_DECODER\nc->vorbis_inverse_coupling = vorbis_inverse_coupling;", "#endif\n#if CONFIG_AC3_DECODER\nc->ac3_downmix = ff_ac3_downmix_c;", "#endif\nc->vector_fmul = vector_fmul_c;", "c->vector_fmul_reverse = vector_fmul_reverse_c;", "c->vector_fmul_add = vector_fmul_add_c;", "c->vector_fmul_window = vector_fmul_window_c;", "c->vector_clipf = vector_clipf_c;", "c->scalarproduct_int16 = scalarproduct_int16_c;", "c->scalarproduct_and_madd_int16 = scalarproduct_and_madd_int16_c;", "c->apply_window_int16 = apply_window_int16_c;", "c->vector_clip_int32 = vector_clip_int32_c;", "c->scalarproduct_float = scalarproduct_float_c;", "c->butterflies_float = butterflies_float_c;", "c->butterflies_float_interleave = butterflies_float_interleave_c;", "c->vector_fmul_scalar = vector_fmul_scalar_c;", "c->vector_fmac_scalar = vector_fmac_scalar_c;", "c->shrink[0]= av_image_copy_plane;", "c->shrink[1]= ff_shrink22;", "c->shrink[2]= ff_shrink44;", "c->shrink[3]= ff_shrink88;", "c->prefetch= just_return;", "memset(c->put_2tap_qpel_pixels_tab, 0, sizeof(c->put_2tap_qpel_pixels_tab));", "memset(c->avg_2tap_qpel_pixels_tab, 0, sizeof(c->avg_2tap_qpel_pixels_tab));", "#undef FUNC\n#undef FUNCC\n#define FUNC(f, depth) f ## _ ## depth\n#define FUNCC(f, depth) f ## _ ## depth ## _c\n#define dspfunc1(PFX, IDX, NUM, depth)\\\nc->PFX ## _pixels_tab[IDX][0] = FUNCC(PFX ## _pixels ## NUM , depth);\\", "c->PFX ## _pixels_tab[IDX][1] = FUNCC(PFX ## _pixels ## NUM ## _x2 , depth);\\", "c->PFX ## _pixels_tab[IDX][2] = FUNCC(PFX ## _pixels ## NUM ## _y2 , depth);\\", "c->PFX ## _pixels_tab[IDX][3] = FUNCC(PFX ## _pixels ## NUM ## _xy2, depth)\n#define dspfunc2(PFX, IDX, NUM, depth)\\\nc->PFX ## _pixels_tab[IDX][ 0] = FUNCC(PFX ## NUM ## _mc00, depth);\\", "c->PFX ## _pixels_tab[IDX][ 1] = FUNCC(PFX ## NUM ## _mc10, depth);\\", "c->PFX ## _pixels_tab[IDX][ 2] = FUNCC(PFX ## NUM ## _mc20, depth);\\", "c->PFX ## _pixels_tab[IDX][ 3] = FUNCC(PFX ## NUM ## _mc30, depth);\\", "c->PFX ## _pixels_tab[IDX][ 4] = FUNCC(PFX ## NUM ## _mc01, depth);\\", "c->PFX ## _pixels_tab[IDX][ 5] = FUNCC(PFX ## NUM ## _mc11, depth);\\", "c->PFX ## _pixels_tab[IDX][ 6] = FUNCC(PFX ## NUM ## _mc21, depth);\\", "c->PFX ## _pixels_tab[IDX][ 7] = FUNCC(PFX ## NUM ## _mc31, depth);\\", "c->PFX ## _pixels_tab[IDX][ 8] = FUNCC(PFX ## NUM ## _mc02, depth);\\", "c->PFX ## _pixels_tab[IDX][ 9] = FUNCC(PFX ## NUM ## _mc12, depth);\\", "c->PFX ## _pixels_tab[IDX][10] = FUNCC(PFX ## NUM ## _mc22, depth);\\", "c->PFX ## _pixels_tab[IDX][11] = FUNCC(PFX ## NUM ## _mc32, depth);\\", "c->PFX ## _pixels_tab[IDX][12] = FUNCC(PFX ## NUM ## _mc03, depth);\\", "c->PFX ## _pixels_tab[IDX][13] = FUNCC(PFX ## NUM ## _mc13, depth);\\", "c->PFX ## _pixels_tab[IDX][14] = FUNCC(PFX ## NUM ## _mc23, depth);\\", "c->PFX ## _pixels_tab[IDX][15] = FUNCC(PFX ## NUM ## _mc33, depth)\n#define BIT_DEPTH_FUNCS(depth, dct)\\\nc->get_pixels = FUNCC(get_pixels ## dct , depth);\\", "c->draw_edges = FUNCC(draw_edges , depth);\\", "c->emulated_edge_mc = FUNC (ff_emulated_edge_mc , depth);\\", "c->clear_block = FUNCC(clear_block ## dct , depth);\\", "c->clear_blocks = FUNCC(clear_blocks ## dct , depth);\\", "c->add_pixels8 = FUNCC(add_pixels8 ## dct , depth);\\", "c->add_pixels4 = FUNCC(add_pixels4 ## dct , depth);\\", "c->put_no_rnd_pixels_l2[0] = FUNCC(put_no_rnd_pixels16_l2, depth);\\", "c->put_no_rnd_pixels_l2[1] = FUNCC(put_no_rnd_pixels8_l2 , depth);\\", "\\\nc->put_h264_chroma_pixels_tab[0] = FUNCC(put_h264_chroma_mc8 , depth);\\", "c->put_h264_chroma_pixels_tab[1] = FUNCC(put_h264_chroma_mc4 , depth);\\", "c->put_h264_chroma_pixels_tab[2] = FUNCC(put_h264_chroma_mc2 , depth);\\", "c->avg_h264_chroma_pixels_tab[0] = FUNCC(avg_h264_chroma_mc8 , depth);\\", "c->avg_h264_chroma_pixels_tab[1] = FUNCC(avg_h264_chroma_mc4 , depth);\\", "c->avg_h264_chroma_pixels_tab[2] = FUNCC(avg_h264_chroma_mc2 , depth);\\", "\\\ndspfunc1(put , 0, 16, depth);\\", "dspfunc1(put , 1, 8, depth);\\", "dspfunc1(put , 2, 4, depth);\\", "dspfunc1(put , 3, 2, depth);\\", "dspfunc1(put_no_rnd, 0, 16, depth);\\", "dspfunc1(put_no_rnd, 1, 8, depth);\\", "dspfunc1(avg , 0, 16, depth);\\", "dspfunc1(avg , 1, 8, depth);\\", "dspfunc1(avg , 2, 4, depth);\\", "dspfunc1(avg , 3, 2, depth);\\", "dspfunc1(avg_no_rnd, 0, 16, depth);\\", "dspfunc1(avg_no_rnd, 1, 8, depth);\\", "\\\ndspfunc2(put_h264_qpel, 0, 16, depth);\\", "dspfunc2(put_h264_qpel, 1, 8, depth);\\", "dspfunc2(put_h264_qpel, 2, 4, depth);\\", "dspfunc2(put_h264_qpel, 3, 2, depth);\\", "dspfunc2(avg_h264_qpel, 0, 16, depth);\\", "dspfunc2(avg_h264_qpel, 1, 8, depth);\\", "dspfunc2(avg_h264_qpel, 2, 4, depth);", "switch (avctx->bits_per_raw_sample) {", "case 9:\nif (c->dct_bits == 32) {", "BIT_DEPTH_FUNCS(9, _32);", "} else {", "BIT_DEPTH_FUNCS(9, _16);", "}", "break;", "case 10:\nif (c->dct_bits == 32) {", "BIT_DEPTH_FUNCS(10, _32);", "} else {", "BIT_DEPTH_FUNCS(10, _16);", "}", "break;", "default:\nav_log(avctx, AV_LOG_DEBUG, \"Unsupported bit depth: %d\\n\", avctx->bits_per_raw_sample);", "case 8:\nBIT_DEPTH_FUNCS(8, _16);", "break;", "}", "if (HAVE_MMX) dsputil_init_mmx (c, avctx);", "if (ARCH_ARM) dsputil_init_arm (c, avctx);", "if (CONFIG_MLIB) dsputil_init_mlib (c, avctx);", "if (HAVE_VIS) dsputil_init_vis (c, avctx);", "if (ARCH_ALPHA) dsputil_init_alpha (c, avctx);", "if (ARCH_PPC) dsputil_init_ppc (c, avctx);", "if (HAVE_MMI) dsputil_init_mmi (c, avctx);", "if (ARCH_SH4) dsputil_init_sh4 (c, avctx);", "if (ARCH_BFIN) dsputil_init_bfin (c, avctx);", "for(VAR_0=0; VAR_0<64; VAR_0++){", "if(!c->put_2tap_qpel_pixels_tab[0][VAR_0])\nc->put_2tap_qpel_pixels_tab[0][VAR_0]= c->put_h264_qpel_pixels_tab[0][VAR_0];", "if(!c->avg_2tap_qpel_pixels_tab[0][VAR_0])\nc->avg_2tap_qpel_pixels_tab[0][VAR_0]= c->avg_h264_qpel_pixels_tab[0][VAR_0];", "}", "ff_init_scantable_permutation(c->idct_permutation,\nc->idct_permutation_type);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49, 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 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 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 183 ], [ 185 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 249, 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277 ], [ 279 ], [ 281, 285 ], [ 287 ], [ 291 ], [ 297 ], [ 299 ], [ 303 ], [ 309, 313, 315 ], [ 317, 319, 321 ], [ 323, 327 ], [ 329 ], [ 331 ], [ 333 ], [ 335 ], [ 337 ], [ 339 ], [ 341 ], [ 345, 347 ], [ 349 ], [ 353, 355 ], [ 357 ], [ 359, 361, 363, 365, 367, 369 ], [ 371 ], [ 373 ], [ 375 ], [ 377 ], [ 379, 381, 383, 385 ], [ 387 ], [ 389 ], [ 391 ], [ 393 ], [ 395 ], [ 397 ], [ 399 ], [ 401, 403 ], [ 405, 409 ], [ 413 ], [ 415 ], [ 417 ], [ 419 ], [ 421 ], [ 423 ], [ 425 ], [ 427 ], [ 431 ], [ 433 ], [ 435 ], [ 437 ], [ 441 ], [ 443 ], [ 445 ], [ 447 ], [ 449 ], [ 453 ], [ 457 ], [ 459 ], [ 463, 465 ], [ 467, 469, 471 ], [ 473, 475 ], [ 477 ], [ 479 ], [ 481 ], [ 483 ], [ 485 ], [ 487 ], [ 489 ], [ 491 ], [ 493 ], [ 495 ], [ 497 ], [ 499 ], [ 501 ], [ 505 ], [ 507 ], [ 509 ], [ 511 ], [ 515 ], [ 519 ], [ 521 ], [ 525, 527, 529, 531, 535, 537 ], [ 539 ], [ 541 ], [ 543, 547, 549 ], [ 551 ], [ 553 ], [ 555 ], [ 557 ], [ 559 ], [ 561 ], [ 563 ], [ 565 ], [ 567 ], [ 569 ], [ 571 ], [ 573 ], [ 575 ], [ 577 ], [ 579, 585, 587 ], [ 589 ], [ 591 ], [ 593 ], [ 595 ], [ 597 ], [ 599 ], [ 601 ], [ 603 ], [ 605, 607 ], [ 609 ], [ 611 ], [ 613 ], [ 615 ], [ 617 ], [ 619, 621 ], [ 623 ], [ 625 ], [ 627 ], [ 629 ], [ 631 ], [ 633 ], [ 635 ], [ 637 ], [ 639 ], [ 641 ], [ 643 ], [ 645, 647 ], [ 649 ], [ 651 ], [ 653 ], [ 655 ], [ 657 ], [ 659 ], [ 663 ], [ 665, 667 ], [ 669 ], [ 671 ], [ 673 ], [ 675 ], [ 677 ], [ 679, 681 ], [ 683 ], [ 685 ], [ 687 ], [ 689 ], [ 691 ], [ 693, 695 ], [ 697, 699 ], [ 701 ], [ 703 ], [ 709 ], [ 711 ], [ 713 ], [ 715 ], [ 717 ], [ 719 ], [ 721 ], [ 723 ], [ 725 ], [ 729 ], [ 731, 733 ], [ 735, 737 ], [ 739 ], [ 743, 745 ], [ 747 ] ]
26,477
static void decode(GetByteContext *gb, RangeCoder *rc, unsigned cumFreq, unsigned freq, unsigned total_freq) { rc->code -= cumFreq * rc->range; rc->range *= freq; while (rc->range < TOP && bytestream2_get_bytes_left(gb) > 0) { unsigned byte = bytestream2_get_byte(gb); rc->code = (rc->code << 8) | byte; rc->range <<= 8; } }
false
FFmpeg
86ab6b6e08e2982fb5785e0691c0a7e289339ffb
static void decode(GetByteContext *gb, RangeCoder *rc, unsigned cumFreq, unsigned freq, unsigned total_freq) { rc->code -= cumFreq * rc->range; rc->range *= freq; while (rc->range < TOP && bytestream2_get_bytes_left(gb) > 0) { unsigned byte = bytestream2_get_byte(gb); rc->code = (rc->code << 8) | byte; rc->range <<= 8; } }
{ "code": [], "line_no": [] }
static void FUNC_0(GetByteContext *VAR_0, RangeCoder *VAR_1, unsigned VAR_2, unsigned VAR_3, unsigned VAR_4) { VAR_1->code -= VAR_2 * VAR_1->range; VAR_1->range *= VAR_3; while (VAR_1->range < TOP && bytestream2_get_bytes_left(VAR_0) > 0) { unsigned VAR_5 = bytestream2_get_byte(VAR_0); VAR_1->code = (VAR_1->code << 8) | VAR_5; VAR_1->range <<= 8; } }
[ "static void FUNC_0(GetByteContext *VAR_0, RangeCoder *VAR_1, unsigned VAR_2, unsigned VAR_3, unsigned VAR_4)\n{", "VAR_1->code -= VAR_2 * VAR_1->range;", "VAR_1->range *= VAR_3;", "while (VAR_1->range < TOP && bytestream2_get_bytes_left(VAR_0) > 0) {", "unsigned VAR_5 = bytestream2_get_byte(VAR_0);", "VAR_1->code = (VAR_1->code << 8) | VAR_5;", "VAR_1->range <<= 8;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
26,478
int ff_thread_get_buffer(AVCodecContext *avctx, ThreadFrame *f, int flags) { PerThreadContext *p = avctx->internal->thread_ctx; int err; f->owner = avctx; if (!(avctx->active_thread_type & FF_THREAD_FRAME)) return ff_get_buffer(avctx, f->f, flags); if (atomic_load(&p->state) != STATE_SETTING_UP && (avctx->codec->update_thread_context || !avctx->thread_safe_callbacks)) { av_log(avctx, AV_LOG_ERROR, "get_buffer() cannot be called after ff_thread_finish_setup()\n"); return -1; } if (avctx->internal->allocate_progress) { atomic_int *progress; f->progress = av_buffer_alloc(2 * sizeof(*progress)); if (!f->progress) { return AVERROR(ENOMEM); } progress = (atomic_int*)f->progress->data; atomic_store(&progress[0], -1); atomic_store(&progress[1], -1); } pthread_mutex_lock(&p->parent->buffer_mutex); if (avctx->thread_safe_callbacks || avctx->get_buffer2 == avcodec_default_get_buffer2) { err = ff_get_buffer(avctx, f->f, flags); } else { p->requested_frame = f->f; p->requested_flags = flags; atomic_store_explicit(&p->state, STATE_GET_BUFFER, memory_order_release); pthread_mutex_lock(&p->progress_mutex); pthread_cond_signal(&p->progress_cond); while (atomic_load(&p->state) != STATE_SETTING_UP) pthread_cond_wait(&p->progress_cond, &p->progress_mutex); err = p->result; pthread_mutex_unlock(&p->progress_mutex); } if (!avctx->thread_safe_callbacks && !avctx->codec->update_thread_context) ff_thread_finish_setup(avctx); if (err) av_buffer_unref(&f->progress); pthread_mutex_unlock(&p->parent->buffer_mutex); return err; }
false
FFmpeg
343e2833994655c252d5236a3394bf6db7a4d8b1
int ff_thread_get_buffer(AVCodecContext *avctx, ThreadFrame *f, int flags) { PerThreadContext *p = avctx->internal->thread_ctx; int err; f->owner = avctx; if (!(avctx->active_thread_type & FF_THREAD_FRAME)) return ff_get_buffer(avctx, f->f, flags); if (atomic_load(&p->state) != STATE_SETTING_UP && (avctx->codec->update_thread_context || !avctx->thread_safe_callbacks)) { av_log(avctx, AV_LOG_ERROR, "get_buffer() cannot be called after ff_thread_finish_setup()\n"); return -1; } if (avctx->internal->allocate_progress) { atomic_int *progress; f->progress = av_buffer_alloc(2 * sizeof(*progress)); if (!f->progress) { return AVERROR(ENOMEM); } progress = (atomic_int*)f->progress->data; atomic_store(&progress[0], -1); atomic_store(&progress[1], -1); } pthread_mutex_lock(&p->parent->buffer_mutex); if (avctx->thread_safe_callbacks || avctx->get_buffer2 == avcodec_default_get_buffer2) { err = ff_get_buffer(avctx, f->f, flags); } else { p->requested_frame = f->f; p->requested_flags = flags; atomic_store_explicit(&p->state, STATE_GET_BUFFER, memory_order_release); pthread_mutex_lock(&p->progress_mutex); pthread_cond_signal(&p->progress_cond); while (atomic_load(&p->state) != STATE_SETTING_UP) pthread_cond_wait(&p->progress_cond, &p->progress_mutex); err = p->result; pthread_mutex_unlock(&p->progress_mutex); } if (!avctx->thread_safe_callbacks && !avctx->codec->update_thread_context) ff_thread_finish_setup(avctx); if (err) av_buffer_unref(&f->progress); pthread_mutex_unlock(&p->parent->buffer_mutex); return err; }
{ "code": [], "line_no": [] }
int FUNC_0(AVCodecContext *VAR_0, ThreadFrame *VAR_1, int VAR_2) { PerThreadContext *p = VAR_0->internal->thread_ctx; int VAR_3; VAR_1->owner = VAR_0; if (!(VAR_0->active_thread_type & FF_THREAD_FRAME)) return ff_get_buffer(VAR_0, VAR_1->VAR_1, VAR_2); if (atomic_load(&p->state) != STATE_SETTING_UP && (VAR_0->codec->update_thread_context || !VAR_0->thread_safe_callbacks)) { av_log(VAR_0, AV_LOG_ERROR, "get_buffer() cannot be called after ff_thread_finish_setup()\n"); return -1; } if (VAR_0->internal->allocate_progress) { atomic_int *progress; VAR_1->progress = av_buffer_alloc(2 * sizeof(*progress)); if (!VAR_1->progress) { return AVERROR(ENOMEM); } progress = (atomic_int*)VAR_1->progress->data; atomic_store(&progress[0], -1); atomic_store(&progress[1], -1); } pthread_mutex_lock(&p->parent->buffer_mutex); if (VAR_0->thread_safe_callbacks || VAR_0->get_buffer2 == avcodec_default_get_buffer2) { VAR_3 = ff_get_buffer(VAR_0, VAR_1->VAR_1, VAR_2); } else { p->requested_frame = VAR_1->VAR_1; p->requested_flags = VAR_2; atomic_store_explicit(&p->state, STATE_GET_BUFFER, memory_order_release); pthread_mutex_lock(&p->progress_mutex); pthread_cond_signal(&p->progress_cond); while (atomic_load(&p->state) != STATE_SETTING_UP) pthread_cond_wait(&p->progress_cond, &p->progress_mutex); VAR_3 = p->result; pthread_mutex_unlock(&p->progress_mutex); } if (!VAR_0->thread_safe_callbacks && !VAR_0->codec->update_thread_context) ff_thread_finish_setup(VAR_0); if (VAR_3) av_buffer_unref(&VAR_1->progress); pthread_mutex_unlock(&p->parent->buffer_mutex); return VAR_3; }
[ "int FUNC_0(AVCodecContext *VAR_0, ThreadFrame *VAR_1, int VAR_2)\n{", "PerThreadContext *p = VAR_0->internal->thread_ctx;", "int VAR_3;", "VAR_1->owner = VAR_0;", "if (!(VAR_0->active_thread_type & FF_THREAD_FRAME))\nreturn ff_get_buffer(VAR_0, VAR_1->VAR_1, VAR_2);", "if (atomic_load(&p->state) != STATE_SETTING_UP &&\n(VAR_0->codec->update_thread_context || !VAR_0->thread_safe_callbacks)) {", "av_log(VAR_0, AV_LOG_ERROR, \"get_buffer() cannot be called after ff_thread_finish_setup()\\n\");", "return -1;", "}", "if (VAR_0->internal->allocate_progress) {", "atomic_int *progress;", "VAR_1->progress = av_buffer_alloc(2 * sizeof(*progress));", "if (!VAR_1->progress) {", "return AVERROR(ENOMEM);", "}", "progress = (atomic_int*)VAR_1->progress->data;", "atomic_store(&progress[0], -1);", "atomic_store(&progress[1], -1);", "}", "pthread_mutex_lock(&p->parent->buffer_mutex);", "if (VAR_0->thread_safe_callbacks ||\nVAR_0->get_buffer2 == avcodec_default_get_buffer2) {", "VAR_3 = ff_get_buffer(VAR_0, VAR_1->VAR_1, VAR_2);", "} else {", "p->requested_frame = VAR_1->VAR_1;", "p->requested_flags = VAR_2;", "atomic_store_explicit(&p->state, STATE_GET_BUFFER, memory_order_release);", "pthread_mutex_lock(&p->progress_mutex);", "pthread_cond_signal(&p->progress_cond);", "while (atomic_load(&p->state) != STATE_SETTING_UP)\npthread_cond_wait(&p->progress_cond, &p->progress_mutex);", "VAR_3 = p->result;", "pthread_mutex_unlock(&p->progress_mutex);", "}", "if (!VAR_0->thread_safe_callbacks && !VAR_0->codec->update_thread_context)\nff_thread_finish_setup(VAR_0);", "if (VAR_3)\nav_buffer_unref(&VAR_1->progress);", "pthread_mutex_unlock(&p->parent->buffer_mutex);", "return VAR_3;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 15, 17 ], [ 21, 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59, 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79, 81 ], [ 85 ], [ 89 ], [ 93 ], [ 95, 97 ], [ 101, 103 ], [ 107 ], [ 111 ], [ 113 ] ]
26,482
static void nfs_refresh_filename(BlockDriverState *bs, QDict *options) { NFSClient *client = bs->opaque; QDict *opts = qdict_new(); QObject *server_qdict; Visitor *ov; qdict_put(opts, "driver", qstring_from_str("nfs")); if (client->uid && !client->gid) { snprintf(bs->exact_filename, sizeof(bs->exact_filename), "nfs://%s%s?uid=%" PRId64, client->server->host, client->path, client->uid); } else if (!client->uid && client->gid) { snprintf(bs->exact_filename, sizeof(bs->exact_filename), "nfs://%s%s?gid=%" PRId64, client->server->host, client->path, client->gid); } else if (client->uid && client->gid) { snprintf(bs->exact_filename, sizeof(bs->exact_filename), "nfs://%s%s?uid=%" PRId64 "&gid=%" PRId64, client->server->host, client->path, client->uid, client->gid); } else { snprintf(bs->exact_filename, sizeof(bs->exact_filename), "nfs://%s%s", client->server->host, client->path); } ov = qobject_output_visitor_new(&server_qdict); visit_type_NFSServer(ov, NULL, &client->server, &error_abort); visit_complete(ov, &server_qdict); assert(qobject_type(server_qdict) == QTYPE_QDICT); qdict_put_obj(opts, "server", server_qdict); qdict_put(opts, "path", qstring_from_str(client->path)); if (client->uid) { qdict_put(opts, "user", qint_from_int(client->uid)); } if (client->gid) { qdict_put(opts, "group", qint_from_int(client->gid)); } if (client->tcp_syncnt) { qdict_put(opts, "tcp-syn-cnt", qint_from_int(client->tcp_syncnt)); } if (client->readahead) { qdict_put(opts, "readahead-size", qint_from_int(client->readahead)); } if (client->pagecache) { qdict_put(opts, "page-cache-size", qint_from_int(client->pagecache)); } if (client->debug) { qdict_put(opts, "debug", qint_from_int(client->debug)); } visit_free(ov); qdict_flatten(opts); bs->full_open_options = opts; }
false
qemu
7c81e4e9db5f63635fbf11d66bf08e73d325ae97
static void nfs_refresh_filename(BlockDriverState *bs, QDict *options) { NFSClient *client = bs->opaque; QDict *opts = qdict_new(); QObject *server_qdict; Visitor *ov; qdict_put(opts, "driver", qstring_from_str("nfs")); if (client->uid && !client->gid) { snprintf(bs->exact_filename, sizeof(bs->exact_filename), "nfs: client->uid); } else if (!client->uid && client->gid) { snprintf(bs->exact_filename, sizeof(bs->exact_filename), "nfs: client->gid); } else if (client->uid && client->gid) { snprintf(bs->exact_filename, sizeof(bs->exact_filename), "nfs: client->server->host, client->path, client->uid, client->gid); } else { snprintf(bs->exact_filename, sizeof(bs->exact_filename), "nfs: } ov = qobject_output_visitor_new(&server_qdict); visit_type_NFSServer(ov, NULL, &client->server, &error_abort); visit_complete(ov, &server_qdict); assert(qobject_type(server_qdict) == QTYPE_QDICT); qdict_put_obj(opts, "server", server_qdict); qdict_put(opts, "path", qstring_from_str(client->path)); if (client->uid) { qdict_put(opts, "user", qint_from_int(client->uid)); } if (client->gid) { qdict_put(opts, "group", qint_from_int(client->gid)); } if (client->tcp_syncnt) { qdict_put(opts, "tcp-syn-cnt", qint_from_int(client->tcp_syncnt)); } if (client->readahead) { qdict_put(opts, "readahead-size", qint_from_int(client->readahead)); } if (client->pagecache) { qdict_put(opts, "page-cache-size", qint_from_int(client->pagecache)); } if (client->debug) { qdict_put(opts, "debug", qint_from_int(client->debug)); } visit_free(ov); qdict_flatten(opts); bs->full_open_options = opts; }
{ "code": [], "line_no": [] }
static void FUNC_0(BlockDriverState *VAR_0, QDict *VAR_1) { NFSClient *client = VAR_0->opaque; QDict *opts = qdict_new(); QObject *server_qdict; Visitor *ov; qdict_put(opts, "driver", qstring_from_str("nfs")); if (client->uid && !client->gid) { snprintf(VAR_0->exact_filename, sizeof(VAR_0->exact_filename), "nfs: client->uid); } else if (!client->uid && client->gid) { snprintf(VAR_0->exact_filename, sizeof(VAR_0->exact_filename), "nfs: client->gid); } else if (client->uid && client->gid) { snprintf(VAR_0->exact_filename, sizeof(VAR_0->exact_filename), "nfs: client->server->host, client->path, client->uid, client->gid); } else { snprintf(VAR_0->exact_filename, sizeof(VAR_0->exact_filename), "nfs: } ov = qobject_output_visitor_new(&server_qdict); visit_type_NFSServer(ov, NULL, &client->server, &error_abort); visit_complete(ov, &server_qdict); assert(qobject_type(server_qdict) == QTYPE_QDICT); qdict_put_obj(opts, "server", server_qdict); qdict_put(opts, "path", qstring_from_str(client->path)); if (client->uid) { qdict_put(opts, "user", qint_from_int(client->uid)); } if (client->gid) { qdict_put(opts, "group", qint_from_int(client->gid)); } if (client->tcp_syncnt) { qdict_put(opts, "tcp-syn-cnt", qint_from_int(client->tcp_syncnt)); } if (client->readahead) { qdict_put(opts, "readahead-size", qint_from_int(client->readahead)); } if (client->pagecache) { qdict_put(opts, "page-cache-size", qint_from_int(client->pagecache)); } if (client->debug) { qdict_put(opts, "debug", qint_from_int(client->debug)); } visit_free(ov); qdict_flatten(opts); VAR_0->full_open_options = opts; }
[ "static void FUNC_0(BlockDriverState *VAR_0, QDict *VAR_1)\n{", "NFSClient *client = VAR_0->opaque;", "QDict *opts = qdict_new();", "QObject *server_qdict;", "Visitor *ov;", "qdict_put(opts, \"driver\", qstring_from_str(\"nfs\"));", "if (client->uid && !client->gid) {", "snprintf(VAR_0->exact_filename, sizeof(VAR_0->exact_filename),\n\"nfs:\nclient->uid);", "} else if (!client->uid && client->gid) {", "snprintf(VAR_0->exact_filename, sizeof(VAR_0->exact_filename),\n\"nfs:\nclient->gid);", "} else if (client->uid && client->gid) {", "snprintf(VAR_0->exact_filename, sizeof(VAR_0->exact_filename),\n\"nfs:\nclient->server->host, client->path, client->uid, client->gid);", "} else {", "snprintf(VAR_0->exact_filename, sizeof(VAR_0->exact_filename),\n\"nfs:\n}", "ov = qobject_output_visitor_new(&server_qdict);", "visit_type_NFSServer(ov, NULL, &client->server, &error_abort);", "visit_complete(ov, &server_qdict);", "assert(qobject_type(server_qdict) == QTYPE_QDICT);", "qdict_put_obj(opts, \"server\", server_qdict);", "qdict_put(opts, \"path\", qstring_from_str(client->path));", "if (client->uid) {", "qdict_put(opts, \"user\", qint_from_int(client->uid));", "}", "if (client->gid) {", "qdict_put(opts, \"group\", qint_from_int(client->gid));", "}", "if (client->tcp_syncnt) {", "qdict_put(opts, \"tcp-syn-cnt\",\nqint_from_int(client->tcp_syncnt));", "}", "if (client->readahead) {", "qdict_put(opts, \"readahead-size\",\nqint_from_int(client->readahead));", "}", "if (client->pagecache) {", "qdict_put(opts, \"page-cache-size\",\nqint_from_int(client->pagecache));", "}", "if (client->debug) {", "qdict_put(opts, \"debug\", qint_from_int(client->debug));", "}", "visit_free(ov);", "qdict_flatten(opts);", "VAR_0->full_open_options = opts;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 19 ], [ 21, 23, 25 ], [ 27 ], [ 29, 31, 33 ], [ 35 ], [ 37, 39, 41 ], [ 43 ], [ 45, 47, 49 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 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 ] ]
26,483
static void pci_basic(gconstpointer data) { QVirtioPCIDevice *dev; QPCIBus *bus; QVirtQueuePCI *tx, *rx; QGuestAllocator *alloc; void (*func) (QVirtioDevice *dev, QGuestAllocator *alloc, QVirtQueue *rvq, QVirtQueue *tvq, int socket) = data; int sv[2], ret; ret = socketpair(PF_UNIX, SOCK_STREAM, 0, sv); g_assert_cmpint(ret, !=, -1); bus = pci_test_start(sv[1]); dev = virtio_net_pci_init(bus, PCI_SLOT); alloc = pc_alloc_init(); rx = (QVirtQueuePCI *)qvirtqueue_setup(&dev->vdev, alloc, 0); tx = (QVirtQueuePCI *)qvirtqueue_setup(&dev->vdev, alloc, 1); driver_init(&dev->vdev); func(&dev->vdev, alloc, &rx->vq, &tx->vq, sv[0]); /* End test */ close(sv[0]); qvirtqueue_cleanup(dev->vdev.bus, &tx->vq, alloc); qvirtqueue_cleanup(dev->vdev.bus, &rx->vq, alloc); pc_alloc_uninit(alloc); qvirtio_pci_device_disable(dev); g_free(dev->pdev); g_free(dev); qpci_free_pc(bus); test_end(); }
false
qemu
a980f7f2c2f4d7e9a1eba4f804cd66dbd458b6d4
static void pci_basic(gconstpointer data) { QVirtioPCIDevice *dev; QPCIBus *bus; QVirtQueuePCI *tx, *rx; QGuestAllocator *alloc; void (*func) (QVirtioDevice *dev, QGuestAllocator *alloc, QVirtQueue *rvq, QVirtQueue *tvq, int socket) = data; int sv[2], ret; ret = socketpair(PF_UNIX, SOCK_STREAM, 0, sv); g_assert_cmpint(ret, !=, -1); bus = pci_test_start(sv[1]); dev = virtio_net_pci_init(bus, PCI_SLOT); alloc = pc_alloc_init(); rx = (QVirtQueuePCI *)qvirtqueue_setup(&dev->vdev, alloc, 0); tx = (QVirtQueuePCI *)qvirtqueue_setup(&dev->vdev, alloc, 1); driver_init(&dev->vdev); func(&dev->vdev, alloc, &rx->vq, &tx->vq, sv[0]); close(sv[0]); qvirtqueue_cleanup(dev->vdev.bus, &tx->vq, alloc); qvirtqueue_cleanup(dev->vdev.bus, &rx->vq, alloc); pc_alloc_uninit(alloc); qvirtio_pci_device_disable(dev); g_free(dev->pdev); g_free(dev); qpci_free_pc(bus); test_end(); }
{ "code": [], "line_no": [] }
static void FUNC_0(gconstpointer VAR_0) { QVirtioPCIDevice *VAR_2; QPCIBus *bus; QVirtQueuePCI *tx, *rx; QGuestAllocator *VAR_3; void (*VAR_1) (QVirtioDevice *VAR_2, QGuestAllocator *VAR_3, QVirtQueue *VAR_4, QVirtQueue *VAR_5, int VAR_6) = VAR_0; int VAR_7[2], VAR_8; VAR_8 = socketpair(PF_UNIX, SOCK_STREAM, 0, VAR_7); g_assert_cmpint(VAR_8, !=, -1); bus = pci_test_start(VAR_7[1]); VAR_2 = virtio_net_pci_init(bus, PCI_SLOT); VAR_3 = pc_alloc_init(); rx = (QVirtQueuePCI *)qvirtqueue_setup(&VAR_2->vdev, VAR_3, 0); tx = (QVirtQueuePCI *)qvirtqueue_setup(&VAR_2->vdev, VAR_3, 1); driver_init(&VAR_2->vdev); VAR_1(&VAR_2->vdev, VAR_3, &rx->vq, &tx->vq, VAR_7[0]); close(VAR_7[0]); qvirtqueue_cleanup(VAR_2->vdev.bus, &tx->vq, VAR_3); qvirtqueue_cleanup(VAR_2->vdev.bus, &rx->vq, VAR_3); pc_alloc_uninit(VAR_3); qvirtio_pci_device_disable(VAR_2); g_free(VAR_2->pdev); g_free(VAR_2); qpci_free_pc(bus); test_end(); }
[ "static void FUNC_0(gconstpointer VAR_0)\n{", "QVirtioPCIDevice *VAR_2;", "QPCIBus *bus;", "QVirtQueuePCI *tx, *rx;", "QGuestAllocator *VAR_3;", "void (*VAR_1) (QVirtioDevice *VAR_2,\nQGuestAllocator *VAR_3,\nQVirtQueue *VAR_4,\nQVirtQueue *VAR_5,\nint VAR_6) = VAR_0;", "int VAR_7[2], VAR_8;", "VAR_8 = socketpair(PF_UNIX, SOCK_STREAM, 0, VAR_7);", "g_assert_cmpint(VAR_8, !=, -1);", "bus = pci_test_start(VAR_7[1]);", "VAR_2 = virtio_net_pci_init(bus, PCI_SLOT);", "VAR_3 = pc_alloc_init();", "rx = (QVirtQueuePCI *)qvirtqueue_setup(&VAR_2->vdev, VAR_3, 0);", "tx = (QVirtQueuePCI *)qvirtqueue_setup(&VAR_2->vdev, VAR_3, 1);", "driver_init(&VAR_2->vdev);", "VAR_1(&VAR_2->vdev, VAR_3, &rx->vq, &tx->vq, VAR_7[0]);", "close(VAR_7[0]);", "qvirtqueue_cleanup(VAR_2->vdev.bus, &tx->vq, VAR_3);", "qvirtqueue_cleanup(VAR_2->vdev.bus, &rx->vq, VAR_3);", "pc_alloc_uninit(VAR_3);", "qvirtio_pci_device_disable(VAR_2);", "g_free(VAR_2->pdev);", "g_free(VAR_2);", "qpci_free_pc(bus);", "test_end();", "}" ]
[ 0, 0, 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 ], [ 43 ], [ 47 ], [ 49 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ] ]
26,484
static void qmp_input_type_bool(Visitor *v, const char *name, bool *obj, Error **errp) { QmpInputVisitor *qiv = to_qiv(v); QObject *qobj = qmp_input_get_object(qiv, name, true, errp); QBool *qbool; if (!qobj) { return; } qbool = qobject_to_qbool(qobj); if (!qbool) { error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null", "boolean"); return; } *obj = qbool_get_bool(qbool); }
false
qemu
09e68369a88d7de0f988972bf28eec1b80cc47f9
static void qmp_input_type_bool(Visitor *v, const char *name, bool *obj, Error **errp) { QmpInputVisitor *qiv = to_qiv(v); QObject *qobj = qmp_input_get_object(qiv, name, true, errp); QBool *qbool; if (!qobj) { return; } qbool = qobject_to_qbool(qobj); if (!qbool) { error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null", "boolean"); return; } *obj = qbool_get_bool(qbool); }
{ "code": [], "line_no": [] }
static void FUNC_0(Visitor *VAR_0, const char *VAR_1, bool *VAR_2, Error **VAR_3) { QmpInputVisitor *qiv = to_qiv(VAR_0); QObject *qobj = qmp_input_get_object(qiv, VAR_1, true, VAR_3); QBool *qbool; if (!qobj) { return; } qbool = qobject_to_qbool(qobj); if (!qbool) { error_setg(VAR_3, QERR_INVALID_PARAMETER_TYPE, VAR_1 ? VAR_1 : "null", "boolean"); return; } *VAR_2 = qbool_get_bool(qbool); }
[ "static void FUNC_0(Visitor *VAR_0, const char *VAR_1, bool *VAR_2,\nError **VAR_3)\n{", "QmpInputVisitor *qiv = to_qiv(VAR_0);", "QObject *qobj = qmp_input_get_object(qiv, VAR_1, true, VAR_3);", "QBool *qbool;", "if (!qobj) {", "return;", "}", "qbool = qobject_to_qbool(qobj);", "if (!qbool) {", "error_setg(VAR_3, QERR_INVALID_PARAMETER_TYPE, VAR_1 ? VAR_1 : \"null\",\n\"boolean\");", "return;", "}", "*VAR_2 = qbool_get_bool(qbool);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ] ]
26,486
static int spapr_vio_busdev_init(DeviceState *qdev, DeviceInfo *qinfo) { VIOsPAPRDeviceInfo *info = (VIOsPAPRDeviceInfo *)qinfo; VIOsPAPRDevice *dev = (VIOsPAPRDevice *)qdev; char *id; int ret; ret = spapr_vio_check_reg(dev, info); if (ret) { return ret; } /* Don't overwrite ids assigned on the command line */ if (!dev->qdev.id) { id = vio_format_dev_name(dev); if (!id) { return -1; } dev->qdev.id = id; } dev->qirq = spapr_allocate_irq(dev->vio_irq_num, &dev->vio_irq_num); if (!dev->qirq) { return -1; } rtce_init(dev); return info->init(dev); }
false
qemu
3954d33ab7f82f5a5fa0ced231849920265a5fec
static int spapr_vio_busdev_init(DeviceState *qdev, DeviceInfo *qinfo) { VIOsPAPRDeviceInfo *info = (VIOsPAPRDeviceInfo *)qinfo; VIOsPAPRDevice *dev = (VIOsPAPRDevice *)qdev; char *id; int ret; ret = spapr_vio_check_reg(dev, info); if (ret) { return ret; } if (!dev->qdev.id) { id = vio_format_dev_name(dev); if (!id) { return -1; } dev->qdev.id = id; } dev->qirq = spapr_allocate_irq(dev->vio_irq_num, &dev->vio_irq_num); if (!dev->qirq) { return -1; } rtce_init(dev); return info->init(dev); }
{ "code": [], "line_no": [] }
static int FUNC_0(DeviceState *VAR_0, DeviceInfo *VAR_1) { VIOsPAPRDeviceInfo *info = (VIOsPAPRDeviceInfo *)VAR_1; VIOsPAPRDevice *dev = (VIOsPAPRDevice *)VAR_0; char *VAR_2; int VAR_3; VAR_3 = spapr_vio_check_reg(dev, info); if (VAR_3) { return VAR_3; } if (!dev->VAR_0.VAR_2) { VAR_2 = vio_format_dev_name(dev); if (!VAR_2) { return -1; } dev->VAR_0.VAR_2 = VAR_2; } dev->qirq = spapr_allocate_irq(dev->vio_irq_num, &dev->vio_irq_num); if (!dev->qirq) { return -1; } rtce_init(dev); return info->init(dev); }
[ "static int FUNC_0(DeviceState *VAR_0, DeviceInfo *VAR_1)\n{", "VIOsPAPRDeviceInfo *info = (VIOsPAPRDeviceInfo *)VAR_1;", "VIOsPAPRDevice *dev = (VIOsPAPRDevice *)VAR_0;", "char *VAR_2;", "int VAR_3;", "VAR_3 = spapr_vio_check_reg(dev, info);", "if (VAR_3) {", "return VAR_3;", "}", "if (!dev->VAR_0.VAR_2) {", "VAR_2 = vio_format_dev_name(dev);", "if (!VAR_2) {", "return -1;", "}", "dev->VAR_0.VAR_2 = VAR_2;", "}", "dev->qirq = spapr_allocate_irq(dev->vio_irq_num, &dev->vio_irq_num);", "if (!dev->qirq) {", "return -1;", "}", "rtce_init(dev);", "return info->init(dev);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 57 ], [ 59 ] ]
26,487
static DriveInfo *blockdev_init(QDict *bs_opts, BlockInterfaceType type, DriveMediaType media) { const char *buf; const char *file = NULL; const char *serial; int ro = 0; int bdrv_flags = 0; int on_read_error, on_write_error; DriveInfo *dinfo; ThrottleConfig cfg; int snapshot = 0; bool copy_on_read; int ret; Error *error = NULL; QemuOpts *opts; const char *id; bool has_driver_specific_opts; BlockDriver *drv = NULL; /* Check common options by copying from bs_opts to opts, all other options * stay in bs_opts for processing by bdrv_open(). */ id = qdict_get_try_str(bs_opts, "id"); opts = qemu_opts_create(&qemu_common_drive_opts, id, 1, &error); if (error_is_set(&error)) { qerror_report_err(error); error_free(error); return NULL; } qemu_opts_absorb_qdict(opts, bs_opts, &error); if (error_is_set(&error)) { qerror_report_err(error); error_free(error); return NULL; } if (id) { qdict_del(bs_opts, "id"); } has_driver_specific_opts = !!qdict_size(bs_opts); /* extract parameters */ snapshot = qemu_opt_get_bool(opts, "snapshot", 0); ro = qemu_opt_get_bool(opts, "read-only", 0); copy_on_read = qemu_opt_get_bool(opts, "copy-on-read", false); file = qemu_opt_get(opts, "file"); serial = qemu_opt_get(opts, "serial"); if ((buf = qemu_opt_get(opts, "discard")) != NULL) { if (bdrv_parse_discard_flags(buf, &bdrv_flags) != 0) { error_report("invalid discard option"); return NULL; } } if (qemu_opt_get_bool(opts, "cache.writeback", true)) { bdrv_flags |= BDRV_O_CACHE_WB; } if (qemu_opt_get_bool(opts, "cache.direct", false)) { bdrv_flags |= BDRV_O_NOCACHE; } if (qemu_opt_get_bool(opts, "cache.no-flush", false)) { bdrv_flags |= BDRV_O_NO_FLUSH; } #ifdef CONFIG_LINUX_AIO if ((buf = qemu_opt_get(opts, "aio")) != NULL) { if (!strcmp(buf, "native")) { bdrv_flags |= BDRV_O_NATIVE_AIO; } else if (!strcmp(buf, "threads")) { /* this is the default */ } else { error_report("invalid aio option"); return NULL; } } #endif if ((buf = qemu_opt_get(opts, "format")) != NULL) { if (is_help_option(buf)) { error_printf("Supported formats:"); bdrv_iterate_format(bdrv_format_print, NULL); error_printf("\n"); return NULL; } drv = bdrv_find_format(buf); if (!drv) { error_report("'%s' invalid format", buf); return NULL; } } /* disk I/O throttling */ memset(&cfg, 0, sizeof(cfg)); cfg.buckets[THROTTLE_BPS_TOTAL].avg = qemu_opt_get_number(opts, "throttling.bps-total", 0); cfg.buckets[THROTTLE_BPS_READ].avg = qemu_opt_get_number(opts, "throttling.bps-read", 0); cfg.buckets[THROTTLE_BPS_WRITE].avg = qemu_opt_get_number(opts, "throttling.bps-write", 0); cfg.buckets[THROTTLE_OPS_TOTAL].avg = qemu_opt_get_number(opts, "throttling.iops-total", 0); cfg.buckets[THROTTLE_OPS_READ].avg = qemu_opt_get_number(opts, "throttling.iops-read", 0); cfg.buckets[THROTTLE_OPS_WRITE].avg = qemu_opt_get_number(opts, "throttling.iops-write", 0); cfg.buckets[THROTTLE_BPS_TOTAL].max = qemu_opt_get_number(opts, "throttling.bps-total-max", 0); cfg.buckets[THROTTLE_BPS_READ].max = qemu_opt_get_number(opts, "throttling.bps-read-max", 0); cfg.buckets[THROTTLE_BPS_WRITE].max = qemu_opt_get_number(opts, "throttling.bps-write-max", 0); cfg.buckets[THROTTLE_OPS_TOTAL].max = qemu_opt_get_number(opts, "throttling.iops-total-max", 0); cfg.buckets[THROTTLE_OPS_READ].max = qemu_opt_get_number(opts, "throttling.iops-read-max", 0); cfg.buckets[THROTTLE_OPS_WRITE].max = qemu_opt_get_number(opts, "throttling.iops-write-max", 0); cfg.op_size = qemu_opt_get_number(opts, "throttling.iops-size", 0); if (!check_throttle_config(&cfg, &error)) { error_report("%s", error_get_pretty(error)); error_free(error); return NULL; } on_write_error = BLOCKDEV_ON_ERROR_ENOSPC; if ((buf = qemu_opt_get(opts, "werror")) != NULL) { if (type != IF_IDE && type != IF_SCSI && type != IF_VIRTIO && type != IF_NONE) { error_report("werror is not supported by this bus type"); return NULL; } on_write_error = parse_block_error_action(buf, 0); if (on_write_error < 0) { return NULL; } } on_read_error = BLOCKDEV_ON_ERROR_REPORT; if ((buf = qemu_opt_get(opts, "rerror")) != NULL) { if (type != IF_IDE && type != IF_VIRTIO && type != IF_SCSI && type != IF_NONE) { error_report("rerror is not supported by this bus type"); return NULL; } on_read_error = parse_block_error_action(buf, 1); if (on_read_error < 0) { return NULL; } } /* init */ dinfo = g_malloc0(sizeof(*dinfo)); dinfo->id = g_strdup(qemu_opts_id(opts)); dinfo->bdrv = bdrv_new(dinfo->id); dinfo->bdrv->open_flags = snapshot ? BDRV_O_SNAPSHOT : 0; dinfo->bdrv->read_only = ro; dinfo->type = type; dinfo->refcount = 1; if (serial != NULL) { dinfo->serial = g_strdup(serial); } QTAILQ_INSERT_TAIL(&drives, dinfo, next); bdrv_set_on_error(dinfo->bdrv, on_read_error, on_write_error); /* disk I/O throttling */ if (throttle_enabled(&cfg)) { bdrv_io_limits_enable(dinfo->bdrv); bdrv_set_io_limits(dinfo->bdrv, &cfg); } switch(type) { case IF_IDE: case IF_SCSI: case IF_XEN: case IF_NONE: dinfo->media_cd = media == MEDIA_CDROM; break; case IF_SD: case IF_FLOPPY: case IF_PFLASH: case IF_MTD: case IF_VIRTIO: break; default: abort(); } if (!file || !*file) { if (has_driver_specific_opts) { file = NULL; } else { return dinfo; } } if (snapshot) { /* always use cache=unsafe with snapshot */ bdrv_flags &= ~BDRV_O_CACHE_MASK; bdrv_flags |= (BDRV_O_SNAPSHOT|BDRV_O_CACHE_WB|BDRV_O_NO_FLUSH); } if (copy_on_read) { bdrv_flags |= BDRV_O_COPY_ON_READ; } if (runstate_check(RUN_STATE_INMIGRATE)) { bdrv_flags |= BDRV_O_INCOMING; } if (media == MEDIA_CDROM) { /* CDROM is fine for any interface, don't check. */ ro = 1; } else if (ro == 1) { if (type != IF_SCSI && type != IF_VIRTIO && type != IF_FLOPPY && type != IF_NONE && type != IF_PFLASH) { error_report("read-only not supported by this bus type"); goto err; } } bdrv_flags |= ro ? 0 : BDRV_O_RDWR; if (ro && copy_on_read) { error_report("warning: disabling copy_on_read on read-only drive"); } QINCREF(bs_opts); ret = bdrv_open(dinfo->bdrv, file, bs_opts, bdrv_flags, drv, &error); if (ret < 0) { error_report("could not open disk image %s: %s", file ?: dinfo->id, error_get_pretty(error)); goto err; } if (bdrv_key_required(dinfo->bdrv)) autostart = 0; QDECREF(bs_opts); qemu_opts_del(opts); return dinfo; err: qemu_opts_del(opts); QDECREF(bs_opts); bdrv_unref(dinfo->bdrv); g_free(dinfo->id); QTAILQ_REMOVE(&drives, dinfo, next); g_free(dinfo); return NULL; }
false
qemu
4f8a066b5fc254eeaabbbde56ba4f5b29cc68fdf
static DriveInfo *blockdev_init(QDict *bs_opts, BlockInterfaceType type, DriveMediaType media) { const char *buf; const char *file = NULL; const char *serial; int ro = 0; int bdrv_flags = 0; int on_read_error, on_write_error; DriveInfo *dinfo; ThrottleConfig cfg; int snapshot = 0; bool copy_on_read; int ret; Error *error = NULL; QemuOpts *opts; const char *id; bool has_driver_specific_opts; BlockDriver *drv = NULL; id = qdict_get_try_str(bs_opts, "id"); opts = qemu_opts_create(&qemu_common_drive_opts, id, 1, &error); if (error_is_set(&error)) { qerror_report_err(error); error_free(error); return NULL; } qemu_opts_absorb_qdict(opts, bs_opts, &error); if (error_is_set(&error)) { qerror_report_err(error); error_free(error); return NULL; } if (id) { qdict_del(bs_opts, "id"); } has_driver_specific_opts = !!qdict_size(bs_opts); snapshot = qemu_opt_get_bool(opts, "snapshot", 0); ro = qemu_opt_get_bool(opts, "read-only", 0); copy_on_read = qemu_opt_get_bool(opts, "copy-on-read", false); file = qemu_opt_get(opts, "file"); serial = qemu_opt_get(opts, "serial"); if ((buf = qemu_opt_get(opts, "discard")) != NULL) { if (bdrv_parse_discard_flags(buf, &bdrv_flags) != 0) { error_report("invalid discard option"); return NULL; } } if (qemu_opt_get_bool(opts, "cache.writeback", true)) { bdrv_flags |= BDRV_O_CACHE_WB; } if (qemu_opt_get_bool(opts, "cache.direct", false)) { bdrv_flags |= BDRV_O_NOCACHE; } if (qemu_opt_get_bool(opts, "cache.no-flush", false)) { bdrv_flags |= BDRV_O_NO_FLUSH; } #ifdef CONFIG_LINUX_AIO if ((buf = qemu_opt_get(opts, "aio")) != NULL) { if (!strcmp(buf, "native")) { bdrv_flags |= BDRV_O_NATIVE_AIO; } else if (!strcmp(buf, "threads")) { } else { error_report("invalid aio option"); return NULL; } } #endif if ((buf = qemu_opt_get(opts, "format")) != NULL) { if (is_help_option(buf)) { error_printf("Supported formats:"); bdrv_iterate_format(bdrv_format_print, NULL); error_printf("\n"); return NULL; } drv = bdrv_find_format(buf); if (!drv) { error_report("'%s' invalid format", buf); return NULL; } } memset(&cfg, 0, sizeof(cfg)); cfg.buckets[THROTTLE_BPS_TOTAL].avg = qemu_opt_get_number(opts, "throttling.bps-total", 0); cfg.buckets[THROTTLE_BPS_READ].avg = qemu_opt_get_number(opts, "throttling.bps-read", 0); cfg.buckets[THROTTLE_BPS_WRITE].avg = qemu_opt_get_number(opts, "throttling.bps-write", 0); cfg.buckets[THROTTLE_OPS_TOTAL].avg = qemu_opt_get_number(opts, "throttling.iops-total", 0); cfg.buckets[THROTTLE_OPS_READ].avg = qemu_opt_get_number(opts, "throttling.iops-read", 0); cfg.buckets[THROTTLE_OPS_WRITE].avg = qemu_opt_get_number(opts, "throttling.iops-write", 0); cfg.buckets[THROTTLE_BPS_TOTAL].max = qemu_opt_get_number(opts, "throttling.bps-total-max", 0); cfg.buckets[THROTTLE_BPS_READ].max = qemu_opt_get_number(opts, "throttling.bps-read-max", 0); cfg.buckets[THROTTLE_BPS_WRITE].max = qemu_opt_get_number(opts, "throttling.bps-write-max", 0); cfg.buckets[THROTTLE_OPS_TOTAL].max = qemu_opt_get_number(opts, "throttling.iops-total-max", 0); cfg.buckets[THROTTLE_OPS_READ].max = qemu_opt_get_number(opts, "throttling.iops-read-max", 0); cfg.buckets[THROTTLE_OPS_WRITE].max = qemu_opt_get_number(opts, "throttling.iops-write-max", 0); cfg.op_size = qemu_opt_get_number(opts, "throttling.iops-size", 0); if (!check_throttle_config(&cfg, &error)) { error_report("%s", error_get_pretty(error)); error_free(error); return NULL; } on_write_error = BLOCKDEV_ON_ERROR_ENOSPC; if ((buf = qemu_opt_get(opts, "werror")) != NULL) { if (type != IF_IDE && type != IF_SCSI && type != IF_VIRTIO && type != IF_NONE) { error_report("werror is not supported by this bus type"); return NULL; } on_write_error = parse_block_error_action(buf, 0); if (on_write_error < 0) { return NULL; } } on_read_error = BLOCKDEV_ON_ERROR_REPORT; if ((buf = qemu_opt_get(opts, "rerror")) != NULL) { if (type != IF_IDE && type != IF_VIRTIO && type != IF_SCSI && type != IF_NONE) { error_report("rerror is not supported by this bus type"); return NULL; } on_read_error = parse_block_error_action(buf, 1); if (on_read_error < 0) { return NULL; } } dinfo = g_malloc0(sizeof(*dinfo)); dinfo->id = g_strdup(qemu_opts_id(opts)); dinfo->bdrv = bdrv_new(dinfo->id); dinfo->bdrv->open_flags = snapshot ? BDRV_O_SNAPSHOT : 0; dinfo->bdrv->read_only = ro; dinfo->type = type; dinfo->refcount = 1; if (serial != NULL) { dinfo->serial = g_strdup(serial); } QTAILQ_INSERT_TAIL(&drives, dinfo, next); bdrv_set_on_error(dinfo->bdrv, on_read_error, on_write_error); if (throttle_enabled(&cfg)) { bdrv_io_limits_enable(dinfo->bdrv); bdrv_set_io_limits(dinfo->bdrv, &cfg); } switch(type) { case IF_IDE: case IF_SCSI: case IF_XEN: case IF_NONE: dinfo->media_cd = media == MEDIA_CDROM; break; case IF_SD: case IF_FLOPPY: case IF_PFLASH: case IF_MTD: case IF_VIRTIO: break; default: abort(); } if (!file || !*file) { if (has_driver_specific_opts) { file = NULL; } else { return dinfo; } } if (snapshot) { bdrv_flags &= ~BDRV_O_CACHE_MASK; bdrv_flags |= (BDRV_O_SNAPSHOT|BDRV_O_CACHE_WB|BDRV_O_NO_FLUSH); } if (copy_on_read) { bdrv_flags |= BDRV_O_COPY_ON_READ; } if (runstate_check(RUN_STATE_INMIGRATE)) { bdrv_flags |= BDRV_O_INCOMING; } if (media == MEDIA_CDROM) { ro = 1; } else if (ro == 1) { if (type != IF_SCSI && type != IF_VIRTIO && type != IF_FLOPPY && type != IF_NONE && type != IF_PFLASH) { error_report("read-only not supported by this bus type"); goto err; } } bdrv_flags |= ro ? 0 : BDRV_O_RDWR; if (ro && copy_on_read) { error_report("warning: disabling copy_on_read on read-only drive"); } QINCREF(bs_opts); ret = bdrv_open(dinfo->bdrv, file, bs_opts, bdrv_flags, drv, &error); if (ret < 0) { error_report("could not open disk image %s: %s", file ?: dinfo->id, error_get_pretty(error)); goto err; } if (bdrv_key_required(dinfo->bdrv)) autostart = 0; QDECREF(bs_opts); qemu_opts_del(opts); return dinfo; err: qemu_opts_del(opts); QDECREF(bs_opts); bdrv_unref(dinfo->bdrv); g_free(dinfo->id); QTAILQ_REMOVE(&drives, dinfo, next); g_free(dinfo); return NULL; }
{ "code": [], "line_no": [] }
static DriveInfo *FUNC_0(QDict *bs_opts, BlockInterfaceType type, DriveMediaType media) { const char *VAR_0; const char *VAR_1 = NULL; const char *VAR_2; int VAR_3 = 0; int VAR_4 = 0; int VAR_5, VAR_6; DriveInfo *dinfo; ThrottleConfig cfg; int VAR_7 = 0; bool copy_on_read; int VAR_8; Error *error = NULL; QemuOpts *opts; const char *VAR_9; bool has_driver_specific_opts; BlockDriver *drv = NULL; VAR_9 = qdict_get_try_str(bs_opts, "VAR_9"); opts = qemu_opts_create(&qemu_common_drive_opts, VAR_9, 1, &error); if (error_is_set(&error)) { qerror_report_err(error); error_free(error); return NULL; } qemu_opts_absorb_qdict(opts, bs_opts, &error); if (error_is_set(&error)) { qerror_report_err(error); error_free(error); return NULL; } if (VAR_9) { qdict_del(bs_opts, "VAR_9"); } has_driver_specific_opts = !!qdict_size(bs_opts); VAR_7 = qemu_opt_get_bool(opts, "VAR_7", 0); VAR_3 = qemu_opt_get_bool(opts, "read-only", 0); copy_on_read = qemu_opt_get_bool(opts, "copy-on-read", false); VAR_1 = qemu_opt_get(opts, "VAR_1"); VAR_2 = qemu_opt_get(opts, "VAR_2"); if ((VAR_0 = qemu_opt_get(opts, "discard")) != NULL) { if (bdrv_parse_discard_flags(VAR_0, &VAR_4) != 0) { error_report("invalid discard option"); return NULL; } } if (qemu_opt_get_bool(opts, "cache.writeback", true)) { VAR_4 |= BDRV_O_CACHE_WB; } if (qemu_opt_get_bool(opts, "cache.direct", false)) { VAR_4 |= BDRV_O_NOCACHE; } if (qemu_opt_get_bool(opts, "cache.no-flush", false)) { VAR_4 |= BDRV_O_NO_FLUSH; } #ifdef CONFIG_LINUX_AIO if ((VAR_0 = qemu_opt_get(opts, "aio")) != NULL) { if (!strcmp(VAR_0, "native")) { VAR_4 |= BDRV_O_NATIVE_AIO; } else if (!strcmp(VAR_0, "threads")) { } else { error_report("invalid aio option"); return NULL; } } #endif if ((VAR_0 = qemu_opt_get(opts, "format")) != NULL) { if (is_help_option(VAR_0)) { error_printf("Supported formats:"); bdrv_iterate_format(bdrv_format_print, NULL); error_printf("\n"); return NULL; } drv = bdrv_find_format(VAR_0); if (!drv) { error_report("'%s' invalid format", VAR_0); return NULL; } } memset(&cfg, 0, sizeof(cfg)); cfg.buckets[THROTTLE_BPS_TOTAL].avg = qemu_opt_get_number(opts, "throttling.bps-total", 0); cfg.buckets[THROTTLE_BPS_READ].avg = qemu_opt_get_number(opts, "throttling.bps-read", 0); cfg.buckets[THROTTLE_BPS_WRITE].avg = qemu_opt_get_number(opts, "throttling.bps-write", 0); cfg.buckets[THROTTLE_OPS_TOTAL].avg = qemu_opt_get_number(opts, "throttling.iops-total", 0); cfg.buckets[THROTTLE_OPS_READ].avg = qemu_opt_get_number(opts, "throttling.iops-read", 0); cfg.buckets[THROTTLE_OPS_WRITE].avg = qemu_opt_get_number(opts, "throttling.iops-write", 0); cfg.buckets[THROTTLE_BPS_TOTAL].max = qemu_opt_get_number(opts, "throttling.bps-total-max", 0); cfg.buckets[THROTTLE_BPS_READ].max = qemu_opt_get_number(opts, "throttling.bps-read-max", 0); cfg.buckets[THROTTLE_BPS_WRITE].max = qemu_opt_get_number(opts, "throttling.bps-write-max", 0); cfg.buckets[THROTTLE_OPS_TOTAL].max = qemu_opt_get_number(opts, "throttling.iops-total-max", 0); cfg.buckets[THROTTLE_OPS_READ].max = qemu_opt_get_number(opts, "throttling.iops-read-max", 0); cfg.buckets[THROTTLE_OPS_WRITE].max = qemu_opt_get_number(opts, "throttling.iops-write-max", 0); cfg.op_size = qemu_opt_get_number(opts, "throttling.iops-size", 0); if (!check_throttle_config(&cfg, &error)) { error_report("%s", error_get_pretty(error)); error_free(error); return NULL; } VAR_6 = BLOCKDEV_ON_ERROR_ENOSPC; if ((VAR_0 = qemu_opt_get(opts, "werror")) != NULL) { if (type != IF_IDE && type != IF_SCSI && type != IF_VIRTIO && type != IF_NONE) { error_report("werror is not supported by this bus type"); return NULL; } VAR_6 = parse_block_error_action(VAR_0, 0); if (VAR_6 < 0) { return NULL; } } VAR_5 = BLOCKDEV_ON_ERROR_REPORT; if ((VAR_0 = qemu_opt_get(opts, "rerror")) != NULL) { if (type != IF_IDE && type != IF_VIRTIO && type != IF_SCSI && type != IF_NONE) { error_report("rerror is not supported by this bus type"); return NULL; } VAR_5 = parse_block_error_action(VAR_0, 1); if (VAR_5 < 0) { return NULL; } } dinfo = g_malloc0(sizeof(*dinfo)); dinfo->VAR_9 = g_strdup(qemu_opts_id(opts)); dinfo->bdrv = bdrv_new(dinfo->VAR_9); dinfo->bdrv->open_flags = VAR_7 ? BDRV_O_SNAPSHOT : 0; dinfo->bdrv->read_only = VAR_3; dinfo->type = type; dinfo->refcount = 1; if (VAR_2 != NULL) { dinfo->VAR_2 = g_strdup(VAR_2); } QTAILQ_INSERT_TAIL(&drives, dinfo, next); bdrv_set_on_error(dinfo->bdrv, VAR_5, VAR_6); if (throttle_enabled(&cfg)) { bdrv_io_limits_enable(dinfo->bdrv); bdrv_set_io_limits(dinfo->bdrv, &cfg); } switch(type) { case IF_IDE: case IF_SCSI: case IF_XEN: case IF_NONE: dinfo->media_cd = media == MEDIA_CDROM; break; case IF_SD: case IF_FLOPPY: case IF_PFLASH: case IF_MTD: case IF_VIRTIO: break; default: abort(); } if (!VAR_1 || !*VAR_1) { if (has_driver_specific_opts) { VAR_1 = NULL; } else { return dinfo; } } if (VAR_7) { VAR_4 &= ~BDRV_O_CACHE_MASK; VAR_4 |= (BDRV_O_SNAPSHOT|BDRV_O_CACHE_WB|BDRV_O_NO_FLUSH); } if (copy_on_read) { VAR_4 |= BDRV_O_COPY_ON_READ; } if (runstate_check(RUN_STATE_INMIGRATE)) { VAR_4 |= BDRV_O_INCOMING; } if (media == MEDIA_CDROM) { VAR_3 = 1; } else if (VAR_3 == 1) { if (type != IF_SCSI && type != IF_VIRTIO && type != IF_FLOPPY && type != IF_NONE && type != IF_PFLASH) { error_report("read-only not supported by this bus type"); goto err; } } VAR_4 |= VAR_3 ? 0 : BDRV_O_RDWR; if (VAR_3 && copy_on_read) { error_report("warning: disabling copy_on_read on read-only drive"); } QINCREF(bs_opts); VAR_8 = bdrv_open(dinfo->bdrv, VAR_1, bs_opts, VAR_4, drv, &error); if (VAR_8 < 0) { error_report("could not open disk image %s: %s", VAR_1 ?: dinfo->VAR_9, error_get_pretty(error)); goto err; } if (bdrv_key_required(dinfo->bdrv)) autostart = 0; QDECREF(bs_opts); qemu_opts_del(opts); return dinfo; err: qemu_opts_del(opts); QDECREF(bs_opts); bdrv_unref(dinfo->bdrv); g_free(dinfo->VAR_9); QTAILQ_REMOVE(&drives, dinfo, next); g_free(dinfo); return NULL; }
[ "static DriveInfo *FUNC_0(QDict *bs_opts,\nBlockInterfaceType type,\nDriveMediaType media)\n{", "const char *VAR_0;", "const char *VAR_1 = NULL;", "const char *VAR_2;", "int VAR_3 = 0;", "int VAR_4 = 0;", "int VAR_5, VAR_6;", "DriveInfo *dinfo;", "ThrottleConfig cfg;", "int VAR_7 = 0;", "bool copy_on_read;", "int VAR_8;", "Error *error = NULL;", "QemuOpts *opts;", "const char *VAR_9;", "bool has_driver_specific_opts;", "BlockDriver *drv = NULL;", "VAR_9 = qdict_get_try_str(bs_opts, \"VAR_9\");", "opts = qemu_opts_create(&qemu_common_drive_opts, VAR_9, 1, &error);", "if (error_is_set(&error)) {", "qerror_report_err(error);", "error_free(error);", "return NULL;", "}", "qemu_opts_absorb_qdict(opts, bs_opts, &error);", "if (error_is_set(&error)) {", "qerror_report_err(error);", "error_free(error);", "return NULL;", "}", "if (VAR_9) {", "qdict_del(bs_opts, \"VAR_9\");", "}", "has_driver_specific_opts = !!qdict_size(bs_opts);", "VAR_7 = qemu_opt_get_bool(opts, \"VAR_7\", 0);", "VAR_3 = qemu_opt_get_bool(opts, \"read-only\", 0);", "copy_on_read = qemu_opt_get_bool(opts, \"copy-on-read\", false);", "VAR_1 = qemu_opt_get(opts, \"VAR_1\");", "VAR_2 = qemu_opt_get(opts, \"VAR_2\");", "if ((VAR_0 = qemu_opt_get(opts, \"discard\")) != NULL) {", "if (bdrv_parse_discard_flags(VAR_0, &VAR_4) != 0) {", "error_report(\"invalid discard option\");", "return NULL;", "}", "}", "if (qemu_opt_get_bool(opts, \"cache.writeback\", true)) {", "VAR_4 |= BDRV_O_CACHE_WB;", "}", "if (qemu_opt_get_bool(opts, \"cache.direct\", false)) {", "VAR_4 |= BDRV_O_NOCACHE;", "}", "if (qemu_opt_get_bool(opts, \"cache.no-flush\", false)) {", "VAR_4 |= BDRV_O_NO_FLUSH;", "}", "#ifdef CONFIG_LINUX_AIO\nif ((VAR_0 = qemu_opt_get(opts, \"aio\")) != NULL) {", "if (!strcmp(VAR_0, \"native\")) {", "VAR_4 |= BDRV_O_NATIVE_AIO;", "} else if (!strcmp(VAR_0, \"threads\")) {", "} else {", "error_report(\"invalid aio option\");", "return NULL;", "}", "}", "#endif\nif ((VAR_0 = qemu_opt_get(opts, \"format\")) != NULL) {", "if (is_help_option(VAR_0)) {", "error_printf(\"Supported formats:\");", "bdrv_iterate_format(bdrv_format_print, NULL);", "error_printf(\"\\n\");", "return NULL;", "}", "drv = bdrv_find_format(VAR_0);", "if (!drv) {", "error_report(\"'%s' invalid format\", VAR_0);", "return NULL;", "}", "}", "memset(&cfg, 0, sizeof(cfg));", "cfg.buckets[THROTTLE_BPS_TOTAL].avg =\nqemu_opt_get_number(opts, \"throttling.bps-total\", 0);", "cfg.buckets[THROTTLE_BPS_READ].avg =\nqemu_opt_get_number(opts, \"throttling.bps-read\", 0);", "cfg.buckets[THROTTLE_BPS_WRITE].avg =\nqemu_opt_get_number(opts, \"throttling.bps-write\", 0);", "cfg.buckets[THROTTLE_OPS_TOTAL].avg =\nqemu_opt_get_number(opts, \"throttling.iops-total\", 0);", "cfg.buckets[THROTTLE_OPS_READ].avg =\nqemu_opt_get_number(opts, \"throttling.iops-read\", 0);", "cfg.buckets[THROTTLE_OPS_WRITE].avg =\nqemu_opt_get_number(opts, \"throttling.iops-write\", 0);", "cfg.buckets[THROTTLE_BPS_TOTAL].max =\nqemu_opt_get_number(opts, \"throttling.bps-total-max\", 0);", "cfg.buckets[THROTTLE_BPS_READ].max =\nqemu_opt_get_number(opts, \"throttling.bps-read-max\", 0);", "cfg.buckets[THROTTLE_BPS_WRITE].max =\nqemu_opt_get_number(opts, \"throttling.bps-write-max\", 0);", "cfg.buckets[THROTTLE_OPS_TOTAL].max =\nqemu_opt_get_number(opts, \"throttling.iops-total-max\", 0);", "cfg.buckets[THROTTLE_OPS_READ].max =\nqemu_opt_get_number(opts, \"throttling.iops-read-max\", 0);", "cfg.buckets[THROTTLE_OPS_WRITE].max =\nqemu_opt_get_number(opts, \"throttling.iops-write-max\", 0);", "cfg.op_size = qemu_opt_get_number(opts, \"throttling.iops-size\", 0);", "if (!check_throttle_config(&cfg, &error)) {", "error_report(\"%s\", error_get_pretty(error));", "error_free(error);", "return NULL;", "}", "VAR_6 = BLOCKDEV_ON_ERROR_ENOSPC;", "if ((VAR_0 = qemu_opt_get(opts, \"werror\")) != NULL) {", "if (type != IF_IDE && type != IF_SCSI && type != IF_VIRTIO && type != IF_NONE) {", "error_report(\"werror is not supported by this bus type\");", "return NULL;", "}", "VAR_6 = parse_block_error_action(VAR_0, 0);", "if (VAR_6 < 0) {", "return NULL;", "}", "}", "VAR_5 = BLOCKDEV_ON_ERROR_REPORT;", "if ((VAR_0 = qemu_opt_get(opts, \"rerror\")) != NULL) {", "if (type != IF_IDE && type != IF_VIRTIO && type != IF_SCSI && type != IF_NONE) {", "error_report(\"rerror is not supported by this bus type\");", "return NULL;", "}", "VAR_5 = parse_block_error_action(VAR_0, 1);", "if (VAR_5 < 0) {", "return NULL;", "}", "}", "dinfo = g_malloc0(sizeof(*dinfo));", "dinfo->VAR_9 = g_strdup(qemu_opts_id(opts));", "dinfo->bdrv = bdrv_new(dinfo->VAR_9);", "dinfo->bdrv->open_flags = VAR_7 ? BDRV_O_SNAPSHOT : 0;", "dinfo->bdrv->read_only = VAR_3;", "dinfo->type = type;", "dinfo->refcount = 1;", "if (VAR_2 != NULL) {", "dinfo->VAR_2 = g_strdup(VAR_2);", "}", "QTAILQ_INSERT_TAIL(&drives, dinfo, next);", "bdrv_set_on_error(dinfo->bdrv, VAR_5, VAR_6);", "if (throttle_enabled(&cfg)) {", "bdrv_io_limits_enable(dinfo->bdrv);", "bdrv_set_io_limits(dinfo->bdrv, &cfg);", "}", "switch(type) {", "case IF_IDE:\ncase IF_SCSI:\ncase IF_XEN:\ncase IF_NONE:\ndinfo->media_cd = media == MEDIA_CDROM;", "break;", "case IF_SD:\ncase IF_FLOPPY:\ncase IF_PFLASH:\ncase IF_MTD:\ncase IF_VIRTIO:\nbreak;", "default:\nabort();", "}", "if (!VAR_1 || !*VAR_1) {", "if (has_driver_specific_opts) {", "VAR_1 = NULL;", "} else {", "return dinfo;", "}", "}", "if (VAR_7) {", "VAR_4 &= ~BDRV_O_CACHE_MASK;", "VAR_4 |= (BDRV_O_SNAPSHOT|BDRV_O_CACHE_WB|BDRV_O_NO_FLUSH);", "}", "if (copy_on_read) {", "VAR_4 |= BDRV_O_COPY_ON_READ;", "}", "if (runstate_check(RUN_STATE_INMIGRATE)) {", "VAR_4 |= BDRV_O_INCOMING;", "}", "if (media == MEDIA_CDROM) {", "VAR_3 = 1;", "} else if (VAR_3 == 1) {", "if (type != IF_SCSI && type != IF_VIRTIO && type != IF_FLOPPY &&\ntype != IF_NONE && type != IF_PFLASH) {", "error_report(\"read-only not supported by this bus type\");", "goto err;", "}", "}", "VAR_4 |= VAR_3 ? 0 : BDRV_O_RDWR;", "if (VAR_3 && copy_on_read) {", "error_report(\"warning: disabling copy_on_read on read-only drive\");", "}", "QINCREF(bs_opts);", "VAR_8 = bdrv_open(dinfo->bdrv, VAR_1, bs_opts, VAR_4, drv, &error);", "if (VAR_8 < 0) {", "error_report(\"could not open disk image %s: %s\",\nVAR_1 ?: dinfo->VAR_9, error_get_pretty(error));", "goto err;", "}", "if (bdrv_key_required(dinfo->bdrv))\nautostart = 0;", "QDECREF(bs_opts);", "qemu_opts_del(opts);", "return dinfo;", "err:\nqemu_opts_del(opts);", "QDECREF(bs_opts);", "bdrv_unref(dinfo->bdrv);", "g_free(dinfo->VAR_9);", "QTAILQ_REMOVE(&drives, dinfo, next);", "g_free(dinfo);", "return NULL;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 79 ], [ 81 ], [ 85 ], [ 91 ], [ 93 ], [ 95 ], [ 99 ], [ 101 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 139, 141 ], [ 143 ], [ 145 ], [ 147 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161, 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 197 ], [ 199, 201 ], [ 203, 205 ], [ 207, 209 ], [ 211, 213 ], [ 215, 217 ], [ 219, 221 ], [ 225, 227 ], [ 229, 231 ], [ 233, 235 ], [ 237, 239 ], [ 241, 243 ], [ 245, 247 ], [ 251 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277 ], [ 281 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 307 ], [ 309 ], [ 311 ], [ 313 ], [ 315 ], [ 321 ], [ 323 ], [ 325 ], [ 327 ], [ 329 ], [ 331 ], [ 333 ], [ 335 ], [ 337 ], [ 339 ], [ 341 ], [ 345 ], [ 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 ], [ 411 ], [ 413 ], [ 415 ], [ 419 ], [ 421 ], [ 423 ], [ 427 ], [ 429 ], [ 431 ], [ 435 ], [ 439 ], [ 441 ], [ 443, 445 ], [ 447 ], [ 449 ], [ 451 ], [ 453 ], [ 457 ], [ 461 ], [ 463 ], [ 465 ], [ 469 ], [ 471 ], [ 475 ], [ 477, 479 ], [ 481 ], [ 483 ], [ 487, 489 ], [ 493 ], [ 495 ], [ 499 ], [ 503, 505 ], [ 507 ], [ 509 ], [ 511 ], [ 513 ], [ 515 ], [ 517 ], [ 519 ] ]
26,488
static void ioq_init(LaioQueue *io_q) { QSIMPLEQ_INIT(&io_q->pending); io_q->plugged = 0; io_q->n = 0; io_q->blocked = false; }
false
qemu
5e1b34a3fa0a0fbf46628aab10cc49f6f855520e
static void ioq_init(LaioQueue *io_q) { QSIMPLEQ_INIT(&io_q->pending); io_q->plugged = 0; io_q->n = 0; io_q->blocked = false; }
{ "code": [], "line_no": [] }
static void FUNC_0(LaioQueue *VAR_0) { QSIMPLEQ_INIT(&VAR_0->pending); VAR_0->plugged = 0; VAR_0->n = 0; VAR_0->blocked = false; }
[ "static void FUNC_0(LaioQueue *VAR_0)\n{", "QSIMPLEQ_INIT(&VAR_0->pending);", "VAR_0->plugged = 0;", "VAR_0->n = 0;", "VAR_0->blocked = false;", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ] ]
26,490
static int sys_utimensat(int dirfd, const char *pathname, const struct timespec times[2], int flags) { return (utimensat(dirfd, pathname, times, flags)); }
false
qemu
ebc996f3b13004e7272c462254522ba0102f09fe
static int sys_utimensat(int dirfd, const char *pathname, const struct timespec times[2], int flags) { return (utimensat(dirfd, pathname, times, flags)); }
{ "code": [], "line_no": [] }
static int FUNC_0(int VAR_0, const char *VAR_1, const struct timespec VAR_2[2], int VAR_3) { return (utimensat(VAR_0, VAR_1, VAR_2, VAR_3)); }
[ "static int FUNC_0(int VAR_0, const char *VAR_1,\nconst struct timespec VAR_2[2], int VAR_3)\n{", "return (utimensat(VAR_0, VAR_1, VAR_2, VAR_3));", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ] ]
26,491
void hmp_delvm(Monitor *mon, const QDict *qdict) { BlockDriverState *bs; Error *err; const char *name = qdict_get_str(qdict, "name"); if (!find_vmstate_bs()) { monitor_printf(mon, "No block device supports snapshots\n"); return; } if (bdrv_all_delete_snapshot(name, &bs, &err) < 0) { monitor_printf(mon, "Error while deleting snapshot on device '%s': %s\n", bdrv_get_device_name(bs), error_get_pretty(err)); error_free(err); } }
false
qemu
c6258b04f19bc690b576b089f621cb5333c533d7
void hmp_delvm(Monitor *mon, const QDict *qdict) { BlockDriverState *bs; Error *err; const char *name = qdict_get_str(qdict, "name"); if (!find_vmstate_bs()) { monitor_printf(mon, "No block device supports snapshots\n"); return; } if (bdrv_all_delete_snapshot(name, &bs, &err) < 0) { monitor_printf(mon, "Error while deleting snapshot on device '%s': %s\n", bdrv_get_device_name(bs), error_get_pretty(err)); error_free(err); } }
{ "code": [], "line_no": [] }
void FUNC_0(Monitor *VAR_0, const QDict *VAR_1) { BlockDriverState *bs; Error *err; const char *VAR_2 = qdict_get_str(VAR_1, "VAR_2"); if (!find_vmstate_bs()) { monitor_printf(VAR_0, "No block device supports snapshots\n"); return; } if (bdrv_all_delete_snapshot(VAR_2, &bs, &err) < 0) { monitor_printf(VAR_0, "Error while deleting snapshot on device '%s': %s\n", bdrv_get_device_name(bs), error_get_pretty(err)); error_free(err); } }
[ "void FUNC_0(Monitor *VAR_0, const QDict *VAR_1)\n{", "BlockDriverState *bs;", "Error *err;", "const char *VAR_2 = qdict_get_str(VAR_1, \"VAR_2\");", "if (!find_vmstate_bs()) {", "monitor_printf(VAR_0, \"No block device supports snapshots\\n\");", "return;", "}", "if (bdrv_all_delete_snapshot(VAR_2, &bs, &err) < 0) {", "monitor_printf(VAR_0,\n\"Error while deleting snapshot on device '%s': %s\\n\",\nbdrv_get_device_name(bs), error_get_pretty(err));", "error_free(err);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25, 27, 29 ], [ 31 ], [ 33 ], [ 35 ] ]
26,492
static inline void RENAME(rgb15tobgr24)(const uint8_t *src, uint8_t *dst, long src_size) { const uint16_t *end; #if COMPILE_TEMPLATE_MMX const uint16_t *mm_end; #endif uint8_t *d = dst; const uint16_t *s = (const uint16_t*)src; end = s + src_size/2; #if COMPILE_TEMPLATE_MMX __asm__ volatile(PREFETCH" %0"::"m"(*s):"memory"); mm_end = end - 7; while (s < mm_end) { __asm__ volatile( PREFETCH" 32%1 \n\t" "movq %1, %%mm0 \n\t" "movq %1, %%mm1 \n\t" "movq %1, %%mm2 \n\t" "pand %2, %%mm0 \n\t" "pand %3, %%mm1 \n\t" "pand %4, %%mm2 \n\t" "psllq $3, %%mm0 \n\t" "psrlq $2, %%mm1 \n\t" "psrlq $7, %%mm2 \n\t" "movq %%mm0, %%mm3 \n\t" "movq %%mm1, %%mm4 \n\t" "movq %%mm2, %%mm5 \n\t" "punpcklwd %5, %%mm0 \n\t" "punpcklwd %5, %%mm1 \n\t" "punpcklwd %5, %%mm2 \n\t" "punpckhwd %5, %%mm3 \n\t" "punpckhwd %5, %%mm4 \n\t" "punpckhwd %5, %%mm5 \n\t" "psllq $8, %%mm1 \n\t" "psllq $16, %%mm2 \n\t" "por %%mm1, %%mm0 \n\t" "por %%mm2, %%mm0 \n\t" "psllq $8, %%mm4 \n\t" "psllq $16, %%mm5 \n\t" "por %%mm4, %%mm3 \n\t" "por %%mm5, %%mm3 \n\t" "movq %%mm0, %%mm6 \n\t" "movq %%mm3, %%mm7 \n\t" "movq 8%1, %%mm0 \n\t" "movq 8%1, %%mm1 \n\t" "movq 8%1, %%mm2 \n\t" "pand %2, %%mm0 \n\t" "pand %3, %%mm1 \n\t" "pand %4, %%mm2 \n\t" "psllq $3, %%mm0 \n\t" "psrlq $2, %%mm1 \n\t" "psrlq $7, %%mm2 \n\t" "movq %%mm0, %%mm3 \n\t" "movq %%mm1, %%mm4 \n\t" "movq %%mm2, %%mm5 \n\t" "punpcklwd %5, %%mm0 \n\t" "punpcklwd %5, %%mm1 \n\t" "punpcklwd %5, %%mm2 \n\t" "punpckhwd %5, %%mm3 \n\t" "punpckhwd %5, %%mm4 \n\t" "punpckhwd %5, %%mm5 \n\t" "psllq $8, %%mm1 \n\t" "psllq $16, %%mm2 \n\t" "por %%mm1, %%mm0 \n\t" "por %%mm2, %%mm0 \n\t" "psllq $8, %%mm4 \n\t" "psllq $16, %%mm5 \n\t" "por %%mm4, %%mm3 \n\t" "por %%mm5, %%mm3 \n\t" :"=m"(*d) :"m"(*s),"m"(mask15b),"m"(mask15g),"m"(mask15r), "m"(mmx_null) :"memory"); /* borrowed 32 to 24 */ __asm__ volatile( "movq %%mm0, %%mm4 \n\t" "movq %%mm3, %%mm5 \n\t" "movq %%mm6, %%mm0 \n\t" "movq %%mm7, %%mm1 \n\t" "movq %%mm4, %%mm6 \n\t" "movq %%mm5, %%mm7 \n\t" "movq %%mm0, %%mm2 \n\t" "movq %%mm1, %%mm3 \n\t" STORE_BGR24_MMX :"=m"(*d) :"m"(*s) :"memory"); d += 24; s += 8; } __asm__ volatile(SFENCE:::"memory"); __asm__ volatile(EMMS:::"memory"); #endif while (s < end) { register uint16_t bgr; bgr = *s++; *d++ = (bgr&0x1F)<<3; *d++ = (bgr&0x3E0)>>2; *d++ = (bgr&0x7C00)>>7; } }
false
FFmpeg
d1adad3cca407f493c3637e20ecd4f7124e69212
static inline void RENAME(rgb15tobgr24)(const uint8_t *src, uint8_t *dst, long src_size) { const uint16_t *end; #if COMPILE_TEMPLATE_MMX const uint16_t *mm_end; #endif uint8_t *d = dst; const uint16_t *s = (const uint16_t*)src; end = s + src_size/2; #if COMPILE_TEMPLATE_MMX __asm__ volatile(PREFETCH" %0"::"m"(*s):"memory"); mm_end = end - 7; while (s < mm_end) { __asm__ volatile( PREFETCH" 32%1 \n\t" "movq %1, %%mm0 \n\t" "movq %1, %%mm1 \n\t" "movq %1, %%mm2 \n\t" "pand %2, %%mm0 \n\t" "pand %3, %%mm1 \n\t" "pand %4, %%mm2 \n\t" "psllq $3, %%mm0 \n\t" "psrlq $2, %%mm1 \n\t" "psrlq $7, %%mm2 \n\t" "movq %%mm0, %%mm3 \n\t" "movq %%mm1, %%mm4 \n\t" "movq %%mm2, %%mm5 \n\t" "punpcklwd %5, %%mm0 \n\t" "punpcklwd %5, %%mm1 \n\t" "punpcklwd %5, %%mm2 \n\t" "punpckhwd %5, %%mm3 \n\t" "punpckhwd %5, %%mm4 \n\t" "punpckhwd %5, %%mm5 \n\t" "psllq $8, %%mm1 \n\t" "psllq $16, %%mm2 \n\t" "por %%mm1, %%mm0 \n\t" "por %%mm2, %%mm0 \n\t" "psllq $8, %%mm4 \n\t" "psllq $16, %%mm5 \n\t" "por %%mm4, %%mm3 \n\t" "por %%mm5, %%mm3 \n\t" "movq %%mm0, %%mm6 \n\t" "movq %%mm3, %%mm7 \n\t" "movq 8%1, %%mm0 \n\t" "movq 8%1, %%mm1 \n\t" "movq 8%1, %%mm2 \n\t" "pand %2, %%mm0 \n\t" "pand %3, %%mm1 \n\t" "pand %4, %%mm2 \n\t" "psllq $3, %%mm0 \n\t" "psrlq $2, %%mm1 \n\t" "psrlq $7, %%mm2 \n\t" "movq %%mm0, %%mm3 \n\t" "movq %%mm1, %%mm4 \n\t" "movq %%mm2, %%mm5 \n\t" "punpcklwd %5, %%mm0 \n\t" "punpcklwd %5, %%mm1 \n\t" "punpcklwd %5, %%mm2 \n\t" "punpckhwd %5, %%mm3 \n\t" "punpckhwd %5, %%mm4 \n\t" "punpckhwd %5, %%mm5 \n\t" "psllq $8, %%mm1 \n\t" "psllq $16, %%mm2 \n\t" "por %%mm1, %%mm0 \n\t" "por %%mm2, %%mm0 \n\t" "psllq $8, %%mm4 \n\t" "psllq $16, %%mm5 \n\t" "por %%mm4, %%mm3 \n\t" "por %%mm5, %%mm3 \n\t" :"=m"(*d) :"m"(*s),"m"(mask15b),"m"(mask15g),"m"(mask15r), "m"(mmx_null) :"memory"); __asm__ volatile( "movq %%mm0, %%mm4 \n\t" "movq %%mm3, %%mm5 \n\t" "movq %%mm6, %%mm0 \n\t" "movq %%mm7, %%mm1 \n\t" "movq %%mm4, %%mm6 \n\t" "movq %%mm5, %%mm7 \n\t" "movq %%mm0, %%mm2 \n\t" "movq %%mm1, %%mm3 \n\t" STORE_BGR24_MMX :"=m"(*d) :"m"(*s) :"memory"); d += 24; s += 8; } __asm__ volatile(SFENCE:::"memory"); __asm__ volatile(EMMS:::"memory"); #endif while (s < end) { register uint16_t bgr; bgr = *s++; *d++ = (bgr&0x1F)<<3; *d++ = (bgr&0x3E0)>>2; *d++ = (bgr&0x7C00)>>7; } }
{ "code": [], "line_no": [] }
static inline void FUNC_0(rgb15tobgr24)(const uint8_t *src, uint8_t *dst, long src_size) { const uint16_t *VAR_0; #if COMPILE_TEMPLATE_MMX const uint16_t *mm_end; #endif uint8_t *d = dst; const uint16_t *VAR_1 = (const uint16_t*)src; VAR_0 = VAR_1 + src_size/2; #if COMPILE_TEMPLATE_MMX __asm__ volatile(PREFETCH" %0"::"m"(*VAR_1):"memory"); mm_end = VAR_0 - 7; while (VAR_1 < mm_end) { __asm__ volatile( PREFETCH" 32%1 \n\t" "movq %1, %%mm0 \n\t" "movq %1, %%mm1 \n\t" "movq %1, %%mm2 \n\t" "pand %2, %%mm0 \n\t" "pand %3, %%mm1 \n\t" "pand %4, %%mm2 \n\t" "psllq $3, %%mm0 \n\t" "psrlq $2, %%mm1 \n\t" "psrlq $7, %%mm2 \n\t" "movq %%mm0, %%mm3 \n\t" "movq %%mm1, %%mm4 \n\t" "movq %%mm2, %%mm5 \n\t" "punpcklwd %5, %%mm0 \n\t" "punpcklwd %5, %%mm1 \n\t" "punpcklwd %5, %%mm2 \n\t" "punpckhwd %5, %%mm3 \n\t" "punpckhwd %5, %%mm4 \n\t" "punpckhwd %5, %%mm5 \n\t" "psllq $8, %%mm1 \n\t" "psllq $16, %%mm2 \n\t" "por %%mm1, %%mm0 \n\t" "por %%mm2, %%mm0 \n\t" "psllq $8, %%mm4 \n\t" "psllq $16, %%mm5 \n\t" "por %%mm4, %%mm3 \n\t" "por %%mm5, %%mm3 \n\t" "movq %%mm0, %%mm6 \n\t" "movq %%mm3, %%mm7 \n\t" "movq 8%1, %%mm0 \n\t" "movq 8%1, %%mm1 \n\t" "movq 8%1, %%mm2 \n\t" "pand %2, %%mm0 \n\t" "pand %3, %%mm1 \n\t" "pand %4, %%mm2 \n\t" "psllq $3, %%mm0 \n\t" "psrlq $2, %%mm1 \n\t" "psrlq $7, %%mm2 \n\t" "movq %%mm0, %%mm3 \n\t" "movq %%mm1, %%mm4 \n\t" "movq %%mm2, %%mm5 \n\t" "punpcklwd %5, %%mm0 \n\t" "punpcklwd %5, %%mm1 \n\t" "punpcklwd %5, %%mm2 \n\t" "punpckhwd %5, %%mm3 \n\t" "punpckhwd %5, %%mm4 \n\t" "punpckhwd %5, %%mm5 \n\t" "psllq $8, %%mm1 \n\t" "psllq $16, %%mm2 \n\t" "por %%mm1, %%mm0 \n\t" "por %%mm2, %%mm0 \n\t" "psllq $8, %%mm4 \n\t" "psllq $16, %%mm5 \n\t" "por %%mm4, %%mm3 \n\t" "por %%mm5, %%mm3 \n\t" :"=m"(*d) :"m"(*VAR_1),"m"(mask15b),"m"(mask15g),"m"(mask15r), "m"(mmx_null) :"memory"); __asm__ volatile( "movq %%mm0, %%mm4 \n\t" "movq %%mm3, %%mm5 \n\t" "movq %%mm6, %%mm0 \n\t" "movq %%mm7, %%mm1 \n\t" "movq %%mm4, %%mm6 \n\t" "movq %%mm5, %%mm7 \n\t" "movq %%mm0, %%mm2 \n\t" "movq %%mm1, %%mm3 \n\t" STORE_BGR24_MMX :"=m"(*d) :"m"(*VAR_1) :"memory"); d += 24; VAR_1 += 8; } __asm__ volatile(SFENCE:::"memory"); __asm__ volatile(EMMS:::"memory"); #endif while (VAR_1 < VAR_0) { register uint16_t VAR_2; VAR_2 = *VAR_1++; *d++ = (VAR_2&0x1F)<<3; *d++ = (VAR_2&0x3E0)>>2; *d++ = (VAR_2&0x7C00)>>7; } }
[ "static inline void FUNC_0(rgb15tobgr24)(const uint8_t *src, uint8_t *dst, long src_size)\n{", "const uint16_t *VAR_0;", "#if COMPILE_TEMPLATE_MMX\nconst uint16_t *mm_end;", "#endif\nuint8_t *d = dst;", "const uint16_t *VAR_1 = (const uint16_t*)src;", "VAR_0 = VAR_1 + src_size/2;", "#if COMPILE_TEMPLATE_MMX\n__asm__ volatile(PREFETCH\" %0\"::\"m\"(*VAR_1):\"memory\");", "mm_end = VAR_0 - 7;", "while (VAR_1 < mm_end) {", "__asm__ volatile(\nPREFETCH\" 32%1 \\n\\t\"\n\"movq %1, %%mm0 \\n\\t\"\n\"movq %1, %%mm1 \\n\\t\"\n\"movq %1, %%mm2 \\n\\t\"\n\"pand %2, %%mm0 \\n\\t\"\n\"pand %3, %%mm1 \\n\\t\"\n\"pand %4, %%mm2 \\n\\t\"\n\"psllq $3, %%mm0 \\n\\t\"\n\"psrlq $2, %%mm1 \\n\\t\"\n\"psrlq $7, %%mm2 \\n\\t\"\n\"movq %%mm0, %%mm3 \\n\\t\"\n\"movq %%mm1, %%mm4 \\n\\t\"\n\"movq %%mm2, %%mm5 \\n\\t\"\n\"punpcklwd %5, %%mm0 \\n\\t\"\n\"punpcklwd %5, %%mm1 \\n\\t\"\n\"punpcklwd %5, %%mm2 \\n\\t\"\n\"punpckhwd %5, %%mm3 \\n\\t\"\n\"punpckhwd %5, %%mm4 \\n\\t\"\n\"punpckhwd %5, %%mm5 \\n\\t\"\n\"psllq $8, %%mm1 \\n\\t\"\n\"psllq $16, %%mm2 \\n\\t\"\n\"por %%mm1, %%mm0 \\n\\t\"\n\"por %%mm2, %%mm0 \\n\\t\"\n\"psllq $8, %%mm4 \\n\\t\"\n\"psllq $16, %%mm5 \\n\\t\"\n\"por %%mm4, %%mm3 \\n\\t\"\n\"por %%mm5, %%mm3 \\n\\t\"\n\"movq %%mm0, %%mm6 \\n\\t\"\n\"movq %%mm3, %%mm7 \\n\\t\"\n\"movq 8%1, %%mm0 \\n\\t\"\n\"movq 8%1, %%mm1 \\n\\t\"\n\"movq 8%1, %%mm2 \\n\\t\"\n\"pand %2, %%mm0 \\n\\t\"\n\"pand %3, %%mm1 \\n\\t\"\n\"pand %4, %%mm2 \\n\\t\"\n\"psllq $3, %%mm0 \\n\\t\"\n\"psrlq $2, %%mm1 \\n\\t\"\n\"psrlq $7, %%mm2 \\n\\t\"\n\"movq %%mm0, %%mm3 \\n\\t\"\n\"movq %%mm1, %%mm4 \\n\\t\"\n\"movq %%mm2, %%mm5 \\n\\t\"\n\"punpcklwd %5, %%mm0 \\n\\t\"\n\"punpcklwd %5, %%mm1 \\n\\t\"\n\"punpcklwd %5, %%mm2 \\n\\t\"\n\"punpckhwd %5, %%mm3 \\n\\t\"\n\"punpckhwd %5, %%mm4 \\n\\t\"\n\"punpckhwd %5, %%mm5 \\n\\t\"\n\"psllq $8, %%mm1 \\n\\t\"\n\"psllq $16, %%mm2 \\n\\t\"\n\"por %%mm1, %%mm0 \\n\\t\"\n\"por %%mm2, %%mm0 \\n\\t\"\n\"psllq $8, %%mm4 \\n\\t\"\n\"psllq $16, %%mm5 \\n\\t\"\n\"por %%mm4, %%mm3 \\n\\t\"\n\"por %%mm5, %%mm3 \\n\\t\"\n:\"=m\"(*d)\n:\"m\"(*VAR_1),\"m\"(mask15b),\"m\"(mask15g),\"m\"(mask15r), \"m\"(mmx_null)\n:\"memory\");", "__asm__ volatile(\n\"movq %%mm0, %%mm4 \\n\\t\"\n\"movq %%mm3, %%mm5 \\n\\t\"\n\"movq %%mm6, %%mm0 \\n\\t\"\n\"movq %%mm7, %%mm1 \\n\\t\"\n\"movq %%mm4, %%mm6 \\n\\t\"\n\"movq %%mm5, %%mm7 \\n\\t\"\n\"movq %%mm0, %%mm2 \\n\\t\"\n\"movq %%mm1, %%mm3 \\n\\t\"\nSTORE_BGR24_MMX\n:\"=m\"(*d)\n:\"m\"(*VAR_1)\n:\"memory\");", "d += 24;", "VAR_1 += 8;", "}", "__asm__ volatile(SFENCE:::\"memory\");", "__asm__ volatile(EMMS:::\"memory\");", "#endif\nwhile (VAR_1 < VAR_0) {", "register uint16_t VAR_2;", "VAR_2 = *VAR_1++;", "*d++ = (VAR_2&0x1F)<<3;", "*d++ = (VAR_2&0x3E0)>>2;", "*d++ = (VAR_2&0x7C00)>>7;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 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, 85, 87, 91, 93, 95, 97, 99, 101, 103, 105, 107, 109, 111, 113, 115, 117, 119, 121, 123, 125, 127, 129, 131, 133, 135, 137, 139, 141, 145, 147, 149 ], [ 153, 155, 157, 159, 161, 165, 167, 169, 171, 175, 179, 181, 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195, 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ] ]
26,493
static void tcg_out_movi(TCGContext *s, TCGType type, TCGReg ret, tcg_target_long sval) { static const S390Opcode lli_insns[4] = { RI_LLILL, RI_LLILH, RI_LLIHL, RI_LLIHH }; tcg_target_ulong uval = sval; int i; if (type == TCG_TYPE_I32) { uval = (uint32_t)sval; sval = (int32_t)sval; } /* Try all 32-bit insns that can load it in one go. */ if (sval >= -0x8000 && sval < 0x8000) { tcg_out_insn(s, RI, LGHI, ret, sval); return; } for (i = 0; i < 4; i++) { tcg_target_long mask = 0xffffull << i*16; if ((uval & mask) == uval) { tcg_out_insn_RI(s, lli_insns[i], ret, uval >> i*16); return; } } /* Try all 48-bit insns that can load it in one go. */ if (facilities & FACILITY_EXT_IMM) { if (sval == (int32_t)sval) { tcg_out_insn(s, RIL, LGFI, ret, sval); return; } if (uval <= 0xffffffff) { tcg_out_insn(s, RIL, LLILF, ret, uval); return; } if ((uval & 0xffffffff) == 0) { tcg_out_insn(s, RIL, LLIHF, ret, uval >> 31 >> 1); return; } } /* Try for PC-relative address load. */ if ((sval & 1) == 0) { ptrdiff_t off = tcg_pcrel_diff(s, (void *)sval) >> 1; if (off == (int32_t)off) { tcg_out_insn(s, RIL, LARL, ret, off); return; } } /* If extended immediates are not present, then we may have to issue several instructions to load the low 32 bits. */ if (!(facilities & FACILITY_EXT_IMM)) { /* A 32-bit unsigned value can be loaded in 2 insns. And given that the lli_insns loop above did not succeed, we know that both insns are required. */ if (uval <= 0xffffffff) { tcg_out_insn(s, RI, LLILL, ret, uval); tcg_out_insn(s, RI, IILH, ret, uval >> 16); return; } /* If all high bits are set, the value can be loaded in 2 or 3 insns. We first want to make sure that all the high bits get set. With luck the low 16-bits can be considered negative to perform that for free, otherwise we load an explicit -1. */ if (sval >> 31 >> 1 == -1) { if (uval & 0x8000) { tcg_out_insn(s, RI, LGHI, ret, uval); } else { tcg_out_insn(s, RI, LGHI, ret, -1); tcg_out_insn(s, RI, IILL, ret, uval); } tcg_out_insn(s, RI, IILH, ret, uval >> 16); return; } } /* If we get here, both the high and low parts have non-zero bits. */ /* Recurse to load the lower 32-bits. */ tcg_out_movi(s, TCG_TYPE_I64, ret, uval & 0xffffffff); /* Insert data into the high 32-bits. */ uval = uval >> 31 >> 1; if (facilities & FACILITY_EXT_IMM) { if (uval < 0x10000) { tcg_out_insn(s, RI, IIHL, ret, uval); } else if ((uval & 0xffff) == 0) { tcg_out_insn(s, RI, IIHH, ret, uval >> 16); } else { tcg_out_insn(s, RIL, IIHF, ret, uval); } } else { if (uval & 0xffff) { tcg_out_insn(s, RI, IIHL, ret, uval); } if (uval & 0xffff0000) { tcg_out_insn(s, RI, IIHH, ret, uval >> 16); } } }
false
qemu
b2c98d9d392c87c9b9e975d30f79924719d9cbbe
static void tcg_out_movi(TCGContext *s, TCGType type, TCGReg ret, tcg_target_long sval) { static const S390Opcode lli_insns[4] = { RI_LLILL, RI_LLILH, RI_LLIHL, RI_LLIHH }; tcg_target_ulong uval = sval; int i; if (type == TCG_TYPE_I32) { uval = (uint32_t)sval; sval = (int32_t)sval; } if (sval >= -0x8000 && sval < 0x8000) { tcg_out_insn(s, RI, LGHI, ret, sval); return; } for (i = 0; i < 4; i++) { tcg_target_long mask = 0xffffull << i*16; if ((uval & mask) == uval) { tcg_out_insn_RI(s, lli_insns[i], ret, uval >> i*16); return; } } if (facilities & FACILITY_EXT_IMM) { if (sval == (int32_t)sval) { tcg_out_insn(s, RIL, LGFI, ret, sval); return; } if (uval <= 0xffffffff) { tcg_out_insn(s, RIL, LLILF, ret, uval); return; } if ((uval & 0xffffffff) == 0) { tcg_out_insn(s, RIL, LLIHF, ret, uval >> 31 >> 1); return; } } if ((sval & 1) == 0) { ptrdiff_t off = tcg_pcrel_diff(s, (void *)sval) >> 1; if (off == (int32_t)off) { tcg_out_insn(s, RIL, LARL, ret, off); return; } } if (!(facilities & FACILITY_EXT_IMM)) { if (uval <= 0xffffffff) { tcg_out_insn(s, RI, LLILL, ret, uval); tcg_out_insn(s, RI, IILH, ret, uval >> 16); return; } if (sval >> 31 >> 1 == -1) { if (uval & 0x8000) { tcg_out_insn(s, RI, LGHI, ret, uval); } else { tcg_out_insn(s, RI, LGHI, ret, -1); tcg_out_insn(s, RI, IILL, ret, uval); } tcg_out_insn(s, RI, IILH, ret, uval >> 16); return; } } tcg_out_movi(s, TCG_TYPE_I64, ret, uval & 0xffffffff); uval = uval >> 31 >> 1; if (facilities & FACILITY_EXT_IMM) { if (uval < 0x10000) { tcg_out_insn(s, RI, IIHL, ret, uval); } else if ((uval & 0xffff) == 0) { tcg_out_insn(s, RI, IIHH, ret, uval >> 16); } else { tcg_out_insn(s, RIL, IIHF, ret, uval); } } else { if (uval & 0xffff) { tcg_out_insn(s, RI, IIHL, ret, uval); } if (uval & 0xffff0000) { tcg_out_insn(s, RI, IIHH, ret, uval >> 16); } } }
{ "code": [], "line_no": [] }
static void FUNC_0(TCGContext *VAR_0, TCGType VAR_1, TCGReg VAR_2, tcg_target_long VAR_3) { static const S390Opcode VAR_4[4] = { RI_LLILL, RI_LLILH, RI_LLIHL, RI_LLIHH }; tcg_target_ulong uval = VAR_3; int VAR_5; if (VAR_1 == TCG_TYPE_I32) { uval = (uint32_t)VAR_3; VAR_3 = (int32_t)VAR_3; } if (VAR_3 >= -0x8000 && VAR_3 < 0x8000) { tcg_out_insn(VAR_0, RI, LGHI, VAR_2, VAR_3); return; } for (VAR_5 = 0; VAR_5 < 4; VAR_5++) { tcg_target_long mask = 0xffffull << VAR_5*16; if ((uval & mask) == uval) { tcg_out_insn_RI(VAR_0, VAR_4[VAR_5], VAR_2, uval >> VAR_5*16); return; } } if (facilities & FACILITY_EXT_IMM) { if (VAR_3 == (int32_t)VAR_3) { tcg_out_insn(VAR_0, RIL, LGFI, VAR_2, VAR_3); return; } if (uval <= 0xffffffff) { tcg_out_insn(VAR_0, RIL, LLILF, VAR_2, uval); return; } if ((uval & 0xffffffff) == 0) { tcg_out_insn(VAR_0, RIL, LLIHF, VAR_2, uval >> 31 >> 1); return; } } if ((VAR_3 & 1) == 0) { ptrdiff_t off = tcg_pcrel_diff(VAR_0, (void *)VAR_3) >> 1; if (off == (int32_t)off) { tcg_out_insn(VAR_0, RIL, LARL, VAR_2, off); return; } } if (!(facilities & FACILITY_EXT_IMM)) { if (uval <= 0xffffffff) { tcg_out_insn(VAR_0, RI, LLILL, VAR_2, uval); tcg_out_insn(VAR_0, RI, IILH, VAR_2, uval >> 16); return; } if (VAR_3 >> 31 >> 1 == -1) { if (uval & 0x8000) { tcg_out_insn(VAR_0, RI, LGHI, VAR_2, uval); } else { tcg_out_insn(VAR_0, RI, LGHI, VAR_2, -1); tcg_out_insn(VAR_0, RI, IILL, VAR_2, uval); } tcg_out_insn(VAR_0, RI, IILH, VAR_2, uval >> 16); return; } } FUNC_0(VAR_0, TCG_TYPE_I64, VAR_2, uval & 0xffffffff); uval = uval >> 31 >> 1; if (facilities & FACILITY_EXT_IMM) { if (uval < 0x10000) { tcg_out_insn(VAR_0, RI, IIHL, VAR_2, uval); } else if ((uval & 0xffff) == 0) { tcg_out_insn(VAR_0, RI, IIHH, VAR_2, uval >> 16); } else { tcg_out_insn(VAR_0, RIL, IIHF, VAR_2, uval); } } else { if (uval & 0xffff) { tcg_out_insn(VAR_0, RI, IIHL, VAR_2, uval); } if (uval & 0xffff0000) { tcg_out_insn(VAR_0, RI, IIHH, VAR_2, uval >> 16); } } }
[ "static void FUNC_0(TCGContext *VAR_0, TCGType VAR_1,\nTCGReg VAR_2, tcg_target_long VAR_3)\n{", "static const S390Opcode VAR_4[4] = {", "RI_LLILL, RI_LLILH, RI_LLIHL, RI_LLIHH\n};", "tcg_target_ulong uval = VAR_3;", "int VAR_5;", "if (VAR_1 == TCG_TYPE_I32) {", "uval = (uint32_t)VAR_3;", "VAR_3 = (int32_t)VAR_3;", "}", "if (VAR_3 >= -0x8000 && VAR_3 < 0x8000) {", "tcg_out_insn(VAR_0, RI, LGHI, VAR_2, VAR_3);", "return;", "}", "for (VAR_5 = 0; VAR_5 < 4; VAR_5++) {", "tcg_target_long mask = 0xffffull << VAR_5*16;", "if ((uval & mask) == uval) {", "tcg_out_insn_RI(VAR_0, VAR_4[VAR_5], VAR_2, uval >> VAR_5*16);", "return;", "}", "}", "if (facilities & FACILITY_EXT_IMM) {", "if (VAR_3 == (int32_t)VAR_3) {", "tcg_out_insn(VAR_0, RIL, LGFI, VAR_2, VAR_3);", "return;", "}", "if (uval <= 0xffffffff) {", "tcg_out_insn(VAR_0, RIL, LLILF, VAR_2, uval);", "return;", "}", "if ((uval & 0xffffffff) == 0) {", "tcg_out_insn(VAR_0, RIL, LLIHF, VAR_2, uval >> 31 >> 1);", "return;", "}", "}", "if ((VAR_3 & 1) == 0) {", "ptrdiff_t off = tcg_pcrel_diff(VAR_0, (void *)VAR_3) >> 1;", "if (off == (int32_t)off) {", "tcg_out_insn(VAR_0, RIL, LARL, VAR_2, off);", "return;", "}", "}", "if (!(facilities & FACILITY_EXT_IMM)) {", "if (uval <= 0xffffffff) {", "tcg_out_insn(VAR_0, RI, LLILL, VAR_2, uval);", "tcg_out_insn(VAR_0, RI, IILH, VAR_2, uval >> 16);", "return;", "}", "if (VAR_3 >> 31 >> 1 == -1) {", "if (uval & 0x8000) {", "tcg_out_insn(VAR_0, RI, LGHI, VAR_2, uval);", "} else {", "tcg_out_insn(VAR_0, RI, LGHI, VAR_2, -1);", "tcg_out_insn(VAR_0, RI, IILL, VAR_2, uval);", "}", "tcg_out_insn(VAR_0, RI, IILH, VAR_2, uval >> 16);", "return;", "}", "}", "FUNC_0(VAR_0, TCG_TYPE_I64, VAR_2, uval & 0xffffffff);", "uval = uval >> 31 >> 1;", "if (facilities & FACILITY_EXT_IMM) {", "if (uval < 0x10000) {", "tcg_out_insn(VAR_0, RI, IIHL, VAR_2, uval);", "} else if ((uval & 0xffff) == 0) {", "tcg_out_insn(VAR_0, RI, IIHH, VAR_2, uval >> 16);", "} else {", "tcg_out_insn(VAR_0, RIL, IIHF, VAR_2, uval);", "}", "} else {", "if (uval & 0xffff) {", "tcg_out_insn(VAR_0, RI, IIHL, VAR_2, uval);", "}", "if (uval & 0xffff0000) {", "tcg_out_insn(VAR_0, RI, IIHH, VAR_2, uval >> 16);", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9, 11 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 113 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 171 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ] ]
26,494
milkymist_init(MachineState *machine) { const char *cpu_model = machine->cpu_model; const char *kernel_filename = machine->kernel_filename; const char *kernel_cmdline = machine->kernel_cmdline; const char *initrd_filename = machine->initrd_filename; LM32CPU *cpu; CPULM32State *env; int kernel_size; DriveInfo *dinfo; MemoryRegion *address_space_mem = get_system_memory(); MemoryRegion *phys_sdram = g_new(MemoryRegion, 1); qemu_irq irq[32]; int i; char *bios_filename; ResetInfo *reset_info; /* memory map */ hwaddr flash_base = 0x00000000; size_t flash_sector_size = 128 * 1024; size_t flash_size = 32 * 1024 * 1024; hwaddr sdram_base = 0x40000000; size_t sdram_size = 128 * 1024 * 1024; hwaddr initrd_base = sdram_base + 0x1002000; hwaddr cmdline_base = sdram_base + 0x1000000; size_t initrd_max = sdram_size - 0x1002000; reset_info = g_malloc0(sizeof(ResetInfo)); if (cpu_model == NULL) { cpu_model = "lm32-full"; } cpu = cpu_lm32_init(cpu_model); if (cpu == NULL) { fprintf(stderr, "qemu: unable to find CPU '%s'\n", cpu_model); exit(1); } env = &cpu->env; reset_info->cpu = cpu; cpu_lm32_set_phys_msb_ignore(env, 1); memory_region_allocate_system_memory(phys_sdram, NULL, "milkymist.sdram", sdram_size); memory_region_add_subregion(address_space_mem, sdram_base, phys_sdram); dinfo = drive_get(IF_PFLASH, 0, 0); /* Numonyx JS28F256J3F105 */ pflash_cfi01_register(flash_base, NULL, "milkymist.flash", flash_size, dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, flash_sector_size, flash_size / flash_sector_size, 2, 0x00, 0x89, 0x00, 0x1d, 1); /* create irq lines */ env->pic_state = lm32_pic_init(qemu_allocate_irq(cpu_irq_handler, cpu, 0)); for (i = 0; i < 32; i++) { irq[i] = qdev_get_gpio_in(env->pic_state, i); } /* load bios rom */ if (bios_name == NULL) { bios_name = BIOS_FILENAME; } bios_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); if (bios_filename) { load_image_targphys(bios_filename, BIOS_OFFSET, BIOS_SIZE); } reset_info->bootstrap_pc = BIOS_OFFSET; /* if no kernel is given no valid bios rom is a fatal error */ if (!kernel_filename && !dinfo && !bios_filename && !qtest_enabled()) { fprintf(stderr, "qemu: could not load Milkymist One bios '%s'\n", bios_name); exit(1); } g_free(bios_filename); milkymist_uart_create(0x60000000, irq[0]); milkymist_sysctl_create(0x60001000, irq[1], irq[2], irq[3], 80000000, 0x10014d31, 0x0000041f, 0x00000001); milkymist_hpdmc_create(0x60002000); milkymist_vgafb_create(0x60003000, 0x40000000, 0x0fffffff); milkymist_memcard_create(0x60004000); milkymist_ac97_create(0x60005000, irq[4], irq[5], irq[6], irq[7]); milkymist_pfpu_create(0x60006000, irq[8]); milkymist_tmu2_create(0x60007000, irq[9]); milkymist_minimac2_create(0x60008000, 0x30000000, irq[10], irq[11]); milkymist_softusb_create(0x6000f000, irq[15], 0x20000000, 0x1000, 0x20020000, 0x2000); /* make sure juart isn't the first chardev */ env->juart_state = lm32_juart_init(); if (kernel_filename) { uint64_t entry; /* Boots a kernel elf binary. */ kernel_size = load_elf(kernel_filename, NULL, NULL, &entry, NULL, NULL, 1, EM_LATTICEMICO32, 0, 0); reset_info->bootstrap_pc = entry; if (kernel_size < 0) { kernel_size = load_image_targphys(kernel_filename, sdram_base, sdram_size); reset_info->bootstrap_pc = sdram_base; } if (kernel_size < 0) { fprintf(stderr, "qemu: could not load kernel '%s'\n", kernel_filename); exit(1); } } if (kernel_cmdline && strlen(kernel_cmdline)) { pstrcpy_targphys("cmdline", cmdline_base, TARGET_PAGE_SIZE, kernel_cmdline); reset_info->cmdline_base = (uint32_t)cmdline_base; } if (initrd_filename) { size_t initrd_size; initrd_size = load_image_targphys(initrd_filename, initrd_base, initrd_max); reset_info->initrd_base = (uint32_t)initrd_base; reset_info->initrd_size = (uint32_t)initrd_size; } qemu_register_reset(main_cpu_reset, reset_info); }
false
qemu
cf3dc71eb5141761c3aed0d936e390aeaa73a88b
milkymist_init(MachineState *machine) { const char *cpu_model = machine->cpu_model; const char *kernel_filename = machine->kernel_filename; const char *kernel_cmdline = machine->kernel_cmdline; const char *initrd_filename = machine->initrd_filename; LM32CPU *cpu; CPULM32State *env; int kernel_size; DriveInfo *dinfo; MemoryRegion *address_space_mem = get_system_memory(); MemoryRegion *phys_sdram = g_new(MemoryRegion, 1); qemu_irq irq[32]; int i; char *bios_filename; ResetInfo *reset_info; hwaddr flash_base = 0x00000000; size_t flash_sector_size = 128 * 1024; size_t flash_size = 32 * 1024 * 1024; hwaddr sdram_base = 0x40000000; size_t sdram_size = 128 * 1024 * 1024; hwaddr initrd_base = sdram_base + 0x1002000; hwaddr cmdline_base = sdram_base + 0x1000000; size_t initrd_max = sdram_size - 0x1002000; reset_info = g_malloc0(sizeof(ResetInfo)); if (cpu_model == NULL) { cpu_model = "lm32-full"; } cpu = cpu_lm32_init(cpu_model); if (cpu == NULL) { fprintf(stderr, "qemu: unable to find CPU '%s'\n", cpu_model); exit(1); } env = &cpu->env; reset_info->cpu = cpu; cpu_lm32_set_phys_msb_ignore(env, 1); memory_region_allocate_system_memory(phys_sdram, NULL, "milkymist.sdram", sdram_size); memory_region_add_subregion(address_space_mem, sdram_base, phys_sdram); dinfo = drive_get(IF_PFLASH, 0, 0); pflash_cfi01_register(flash_base, NULL, "milkymist.flash", flash_size, dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, flash_sector_size, flash_size / flash_sector_size, 2, 0x00, 0x89, 0x00, 0x1d, 1); env->pic_state = lm32_pic_init(qemu_allocate_irq(cpu_irq_handler, cpu, 0)); for (i = 0; i < 32; i++) { irq[i] = qdev_get_gpio_in(env->pic_state, i); } if (bios_name == NULL) { bios_name = BIOS_FILENAME; } bios_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); if (bios_filename) { load_image_targphys(bios_filename, BIOS_OFFSET, BIOS_SIZE); } reset_info->bootstrap_pc = BIOS_OFFSET; if (!kernel_filename && !dinfo && !bios_filename && !qtest_enabled()) { fprintf(stderr, "qemu: could not load Milkymist One bios '%s'\n", bios_name); exit(1); } g_free(bios_filename); milkymist_uart_create(0x60000000, irq[0]); milkymist_sysctl_create(0x60001000, irq[1], irq[2], irq[3], 80000000, 0x10014d31, 0x0000041f, 0x00000001); milkymist_hpdmc_create(0x60002000); milkymist_vgafb_create(0x60003000, 0x40000000, 0x0fffffff); milkymist_memcard_create(0x60004000); milkymist_ac97_create(0x60005000, irq[4], irq[5], irq[6], irq[7]); milkymist_pfpu_create(0x60006000, irq[8]); milkymist_tmu2_create(0x60007000, irq[9]); milkymist_minimac2_create(0x60008000, 0x30000000, irq[10], irq[11]); milkymist_softusb_create(0x6000f000, irq[15], 0x20000000, 0x1000, 0x20020000, 0x2000); env->juart_state = lm32_juart_init(); if (kernel_filename) { uint64_t entry; kernel_size = load_elf(kernel_filename, NULL, NULL, &entry, NULL, NULL, 1, EM_LATTICEMICO32, 0, 0); reset_info->bootstrap_pc = entry; if (kernel_size < 0) { kernel_size = load_image_targphys(kernel_filename, sdram_base, sdram_size); reset_info->bootstrap_pc = sdram_base; } if (kernel_size < 0) { fprintf(stderr, "qemu: could not load kernel '%s'\n", kernel_filename); exit(1); } } if (kernel_cmdline && strlen(kernel_cmdline)) { pstrcpy_targphys("cmdline", cmdline_base, TARGET_PAGE_SIZE, kernel_cmdline); reset_info->cmdline_base = (uint32_t)cmdline_base; } if (initrd_filename) { size_t initrd_size; initrd_size = load_image_targphys(initrd_filename, initrd_base, initrd_max); reset_info->initrd_base = (uint32_t)initrd_base; reset_info->initrd_size = (uint32_t)initrd_size; } qemu_register_reset(main_cpu_reset, reset_info); }
{ "code": [], "line_no": [] }
FUNC_0(MachineState *VAR_0) { const char *VAR_1 = VAR_0->VAR_1; const char *VAR_2 = VAR_0->VAR_2; const char *VAR_3 = VAR_0->VAR_3; const char *VAR_4 = VAR_0->VAR_4; LM32CPU *cpu; CPULM32State *env; int VAR_5; DriveInfo *dinfo; MemoryRegion *address_space_mem = get_system_memory(); MemoryRegion *phys_sdram = g_new(MemoryRegion, 1); qemu_irq irq[32]; int VAR_6; char *VAR_7; ResetInfo *reset_info; hwaddr flash_base = 0x00000000; size_t flash_sector_size = 128 * 1024; size_t flash_size = 32 * 1024 * 1024; hwaddr sdram_base = 0x40000000; size_t sdram_size = 128 * 1024 * 1024; hwaddr initrd_base = sdram_base + 0x1002000; hwaddr cmdline_base = sdram_base + 0x1000000; size_t initrd_max = sdram_size - 0x1002000; reset_info = g_malloc0(sizeof(ResetInfo)); if (VAR_1 == NULL) { VAR_1 = "lm32-full"; } cpu = cpu_lm32_init(VAR_1); if (cpu == NULL) { fprintf(stderr, "qemu: unable to find CPU '%s'\n", VAR_1); exit(1); } env = &cpu->env; reset_info->cpu = cpu; cpu_lm32_set_phys_msb_ignore(env, 1); memory_region_allocate_system_memory(phys_sdram, NULL, "milkymist.sdram", sdram_size); memory_region_add_subregion(address_space_mem, sdram_base, phys_sdram); dinfo = drive_get(IF_PFLASH, 0, 0); pflash_cfi01_register(flash_base, NULL, "milkymist.flash", flash_size, dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, flash_sector_size, flash_size / flash_sector_size, 2, 0x00, 0x89, 0x00, 0x1d, 1); env->pic_state = lm32_pic_init(qemu_allocate_irq(cpu_irq_handler, cpu, 0)); for (VAR_6 = 0; VAR_6 < 32; VAR_6++) { irq[VAR_6] = qdev_get_gpio_in(env->pic_state, VAR_6); } if (bios_name == NULL) { bios_name = BIOS_FILENAME; } VAR_7 = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); if (VAR_7) { load_image_targphys(VAR_7, BIOS_OFFSET, BIOS_SIZE); } reset_info->bootstrap_pc = BIOS_OFFSET; if (!VAR_2 && !dinfo && !VAR_7 && !qtest_enabled()) { fprintf(stderr, "qemu: could not load Milkymist One bios '%s'\n", bios_name); exit(1); } g_free(VAR_7); milkymist_uart_create(0x60000000, irq[0]); milkymist_sysctl_create(0x60001000, irq[1], irq[2], irq[3], 80000000, 0x10014d31, 0x0000041f, 0x00000001); milkymist_hpdmc_create(0x60002000); milkymist_vgafb_create(0x60003000, 0x40000000, 0x0fffffff); milkymist_memcard_create(0x60004000); milkymist_ac97_create(0x60005000, irq[4], irq[5], irq[6], irq[7]); milkymist_pfpu_create(0x60006000, irq[8]); milkymist_tmu2_create(0x60007000, irq[9]); milkymist_minimac2_create(0x60008000, 0x30000000, irq[10], irq[11]); milkymist_softusb_create(0x6000f000, irq[15], 0x20000000, 0x1000, 0x20020000, 0x2000); env->juart_state = lm32_juart_init(); if (VAR_2) { uint64_t entry; VAR_5 = load_elf(VAR_2, NULL, NULL, &entry, NULL, NULL, 1, EM_LATTICEMICO32, 0, 0); reset_info->bootstrap_pc = entry; if (VAR_5 < 0) { VAR_5 = load_image_targphys(VAR_2, sdram_base, sdram_size); reset_info->bootstrap_pc = sdram_base; } if (VAR_5 < 0) { fprintf(stderr, "qemu: could not load kernel '%s'\n", VAR_2); exit(1); } } if (VAR_3 && strlen(VAR_3)) { pstrcpy_targphys("cmdline", cmdline_base, TARGET_PAGE_SIZE, VAR_3); reset_info->cmdline_base = (uint32_t)cmdline_base; } if (VAR_4) { size_t initrd_size; initrd_size = load_image_targphys(VAR_4, initrd_base, initrd_max); reset_info->initrd_base = (uint32_t)initrd_base; reset_info->initrd_size = (uint32_t)initrd_size; } qemu_register_reset(main_cpu_reset, reset_info); }
[ "FUNC_0(MachineState *VAR_0)\n{", "const char *VAR_1 = VAR_0->VAR_1;", "const char *VAR_2 = VAR_0->VAR_2;", "const char *VAR_3 = VAR_0->VAR_3;", "const char *VAR_4 = VAR_0->VAR_4;", "LM32CPU *cpu;", "CPULM32State *env;", "int VAR_5;", "DriveInfo *dinfo;", "MemoryRegion *address_space_mem = get_system_memory();", "MemoryRegion *phys_sdram = g_new(MemoryRegion, 1);", "qemu_irq irq[32];", "int VAR_6;", "char *VAR_7;", "ResetInfo *reset_info;", "hwaddr flash_base = 0x00000000;", "size_t flash_sector_size = 128 * 1024;", "size_t flash_size = 32 * 1024 * 1024;", "hwaddr sdram_base = 0x40000000;", "size_t sdram_size = 128 * 1024 * 1024;", "hwaddr initrd_base = sdram_base + 0x1002000;", "hwaddr cmdline_base = sdram_base + 0x1000000;", "size_t initrd_max = sdram_size - 0x1002000;", "reset_info = g_malloc0(sizeof(ResetInfo));", "if (VAR_1 == NULL) {", "VAR_1 = \"lm32-full\";", "}", "cpu = cpu_lm32_init(VAR_1);", "if (cpu == NULL) {", "fprintf(stderr, \"qemu: unable to find CPU '%s'\\n\", VAR_1);", "exit(1);", "}", "env = &cpu->env;", "reset_info->cpu = cpu;", "cpu_lm32_set_phys_msb_ignore(env, 1);", "memory_region_allocate_system_memory(phys_sdram, NULL, \"milkymist.sdram\",\nsdram_size);", "memory_region_add_subregion(address_space_mem, sdram_base, phys_sdram);", "dinfo = drive_get(IF_PFLASH, 0, 0);", "pflash_cfi01_register(flash_base, NULL, \"milkymist.flash\", flash_size,\ndinfo ? blk_by_legacy_dinfo(dinfo) : NULL,\nflash_sector_size, flash_size / flash_sector_size,\n2, 0x00, 0x89, 0x00, 0x1d, 1);", "env->pic_state = lm32_pic_init(qemu_allocate_irq(cpu_irq_handler, cpu, 0));", "for (VAR_6 = 0; VAR_6 < 32; VAR_6++) {", "irq[VAR_6] = qdev_get_gpio_in(env->pic_state, VAR_6);", "}", "if (bios_name == NULL) {", "bios_name = BIOS_FILENAME;", "}", "VAR_7 = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);", "if (VAR_7) {", "load_image_targphys(VAR_7, BIOS_OFFSET, BIOS_SIZE);", "}", "reset_info->bootstrap_pc = BIOS_OFFSET;", "if (!VAR_2 && !dinfo && !VAR_7 && !qtest_enabled()) {", "fprintf(stderr, \"qemu: could not load Milkymist One bios '%s'\\n\",\nbios_name);", "exit(1);", "}", "g_free(VAR_7);", "milkymist_uart_create(0x60000000, irq[0]);", "milkymist_sysctl_create(0x60001000, irq[1], irq[2], irq[3],\n80000000, 0x10014d31, 0x0000041f, 0x00000001);", "milkymist_hpdmc_create(0x60002000);", "milkymist_vgafb_create(0x60003000, 0x40000000, 0x0fffffff);", "milkymist_memcard_create(0x60004000);", "milkymist_ac97_create(0x60005000, irq[4], irq[5], irq[6], irq[7]);", "milkymist_pfpu_create(0x60006000, irq[8]);", "milkymist_tmu2_create(0x60007000, irq[9]);", "milkymist_minimac2_create(0x60008000, 0x30000000, irq[10], irq[11]);", "milkymist_softusb_create(0x6000f000, irq[15],\n0x20000000, 0x1000, 0x20020000, 0x2000);", "env->juart_state = lm32_juart_init();", "if (VAR_2) {", "uint64_t entry;", "VAR_5 = load_elf(VAR_2, NULL, NULL, &entry, NULL, NULL,\n1, EM_LATTICEMICO32, 0, 0);", "reset_info->bootstrap_pc = entry;", "if (VAR_5 < 0) {", "VAR_5 = load_image_targphys(VAR_2, sdram_base,\nsdram_size);", "reset_info->bootstrap_pc = sdram_base;", "}", "if (VAR_5 < 0) {", "fprintf(stderr, \"qemu: could not load kernel '%s'\\n\",\nVAR_2);", "exit(1);", "}", "}", "if (VAR_3 && strlen(VAR_3)) {", "pstrcpy_targphys(\"cmdline\", cmdline_base, TARGET_PAGE_SIZE,\nVAR_3);", "reset_info->cmdline_base = (uint32_t)cmdline_base;", "}", "if (VAR_4) {", "size_t initrd_size;", "initrd_size = load_image_targphys(VAR_4, initrd_base,\ninitrd_max);", "reset_info->initrd_base = (uint32_t)initrd_base;", "reset_info->initrd_size = (uint32_t)initrd_size;", "}", "qemu_register_reset(main_cpu_reset, reset_info);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ], [ 85 ], [ 89, 91 ], [ 93 ], [ 97 ], [ 101, 103, 105, 107 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 135 ], [ 137 ], [ 139 ], [ 143 ], [ 149 ], [ 151, 153 ], [ 155 ], [ 157 ], [ 159 ], [ 163 ], [ 165, 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183, 185 ], [ 191 ], [ 195 ], [ 197 ], [ 203, 205 ], [ 207 ], [ 211 ], [ 213, 215 ], [ 217 ], [ 219 ], [ 223 ], [ 225, 227 ], [ 229 ], [ 231 ], [ 233 ], [ 237 ], [ 239, 241 ], [ 243 ], [ 245 ], [ 249 ], [ 251 ], [ 253, 255 ], [ 257 ], [ 259 ], [ 261 ], [ 265 ], [ 267 ] ]
26,495
static int vmdk_write_extent(VmdkExtent *extent, int64_t cluster_offset, int64_t offset_in_cluster, QEMUIOVector *qiov, uint64_t qiov_offset, uint64_t n_bytes, uint64_t offset) { int ret; VmdkGrainMarker *data = NULL; uLongf buf_len; QEMUIOVector local_qiov; struct iovec iov; int64_t write_offset; int64_t write_end_sector; if (extent->compressed) { void *compressed_data; if (!extent->has_marker) { ret = -EINVAL; goto out; } buf_len = (extent->cluster_sectors << 9) * 2; data = g_malloc(buf_len + sizeof(VmdkGrainMarker)); compressed_data = g_malloc(n_bytes); qemu_iovec_to_buf(qiov, qiov_offset, compressed_data, n_bytes); ret = compress(data->data, &buf_len, compressed_data, n_bytes); g_free(compressed_data); if (ret != Z_OK || buf_len == 0) { ret = -EINVAL; goto out; } data->lba = offset >> BDRV_SECTOR_BITS; data->size = buf_len; n_bytes = buf_len + sizeof(VmdkGrainMarker); iov = (struct iovec) { .iov_base = data, .iov_len = n_bytes, }; qemu_iovec_init_external(&local_qiov, &iov, 1); } else { qemu_iovec_init(&local_qiov, qiov->niov); qemu_iovec_concat(&local_qiov, qiov, qiov_offset, n_bytes); } write_offset = cluster_offset + offset_in_cluster, ret = bdrv_co_pwritev(extent->file->bs, write_offset, n_bytes, &local_qiov, 0); write_end_sector = DIV_ROUND_UP(write_offset + n_bytes, BDRV_SECTOR_SIZE); if (extent->compressed) { extent->next_cluster_sector = write_end_sector; } else { extent->next_cluster_sector = MAX(extent->next_cluster_sector, write_end_sector); } if (ret < 0) { goto out; } ret = 0; out: g_free(data); if (!extent->compressed) { qemu_iovec_destroy(&local_qiov); } return ret; }
false
qemu
a03ef88f77af045a2eb9629b5ce774a3fb973c5e
static int vmdk_write_extent(VmdkExtent *extent, int64_t cluster_offset, int64_t offset_in_cluster, QEMUIOVector *qiov, uint64_t qiov_offset, uint64_t n_bytes, uint64_t offset) { int ret; VmdkGrainMarker *data = NULL; uLongf buf_len; QEMUIOVector local_qiov; struct iovec iov; int64_t write_offset; int64_t write_end_sector; if (extent->compressed) { void *compressed_data; if (!extent->has_marker) { ret = -EINVAL; goto out; } buf_len = (extent->cluster_sectors << 9) * 2; data = g_malloc(buf_len + sizeof(VmdkGrainMarker)); compressed_data = g_malloc(n_bytes); qemu_iovec_to_buf(qiov, qiov_offset, compressed_data, n_bytes); ret = compress(data->data, &buf_len, compressed_data, n_bytes); g_free(compressed_data); if (ret != Z_OK || buf_len == 0) { ret = -EINVAL; goto out; } data->lba = offset >> BDRV_SECTOR_BITS; data->size = buf_len; n_bytes = buf_len + sizeof(VmdkGrainMarker); iov = (struct iovec) { .iov_base = data, .iov_len = n_bytes, }; qemu_iovec_init_external(&local_qiov, &iov, 1); } else { qemu_iovec_init(&local_qiov, qiov->niov); qemu_iovec_concat(&local_qiov, qiov, qiov_offset, n_bytes); } write_offset = cluster_offset + offset_in_cluster, ret = bdrv_co_pwritev(extent->file->bs, write_offset, n_bytes, &local_qiov, 0); write_end_sector = DIV_ROUND_UP(write_offset + n_bytes, BDRV_SECTOR_SIZE); if (extent->compressed) { extent->next_cluster_sector = write_end_sector; } else { extent->next_cluster_sector = MAX(extent->next_cluster_sector, write_end_sector); } if (ret < 0) { goto out; } ret = 0; out: g_free(data); if (!extent->compressed) { qemu_iovec_destroy(&local_qiov); } return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(VmdkExtent *VAR_0, int64_t VAR_1, int64_t VAR_2, QEMUIOVector *VAR_3, uint64_t VAR_4, uint64_t VAR_5, uint64_t VAR_6) { int VAR_7; VmdkGrainMarker *data = NULL; uLongf buf_len; QEMUIOVector local_qiov; struct iovec VAR_8; int64_t write_offset; int64_t write_end_sector; if (VAR_0->compressed) { void *VAR_9; if (!VAR_0->has_marker) { VAR_7 = -EINVAL; goto out; } buf_len = (VAR_0->cluster_sectors << 9) * 2; data = g_malloc(buf_len + sizeof(VmdkGrainMarker)); VAR_9 = g_malloc(VAR_5); qemu_iovec_to_buf(VAR_3, VAR_4, VAR_9, VAR_5); VAR_7 = compress(data->data, &buf_len, VAR_9, VAR_5); g_free(VAR_9); if (VAR_7 != Z_OK || buf_len == 0) { VAR_7 = -EINVAL; goto out; } data->lba = VAR_6 >> BDRV_SECTOR_BITS; data->size = buf_len; VAR_5 = buf_len + sizeof(VmdkGrainMarker); VAR_8 = (struct iovec) { .iov_base = data, .iov_len = VAR_5, }; qemu_iovec_init_external(&local_qiov, &VAR_8, 1); } else { qemu_iovec_init(&local_qiov, VAR_3->niov); qemu_iovec_concat(&local_qiov, VAR_3, VAR_4, VAR_5); } write_offset = VAR_1 + VAR_2, VAR_7 = bdrv_co_pwritev(VAR_0->file->bs, write_offset, VAR_5, &local_qiov, 0); write_end_sector = DIV_ROUND_UP(write_offset + VAR_5, BDRV_SECTOR_SIZE); if (VAR_0->compressed) { VAR_0->next_cluster_sector = write_end_sector; } else { VAR_0->next_cluster_sector = MAX(VAR_0->next_cluster_sector, write_end_sector); } if (VAR_7 < 0) { goto out; } VAR_7 = 0; out: g_free(data); if (!VAR_0->compressed) { qemu_iovec_destroy(&local_qiov); } return VAR_7; }
[ "static int FUNC_0(VmdkExtent *VAR_0, int64_t VAR_1,\nint64_t VAR_2, QEMUIOVector *VAR_3,\nuint64_t VAR_4, uint64_t VAR_5,\nuint64_t VAR_6)\n{", "int VAR_7;", "VmdkGrainMarker *data = NULL;", "uLongf buf_len;", "QEMUIOVector local_qiov;", "struct iovec VAR_8;", "int64_t write_offset;", "int64_t write_end_sector;", "if (VAR_0->compressed) {", "void *VAR_9;", "if (!VAR_0->has_marker) {", "VAR_7 = -EINVAL;", "goto out;", "}", "buf_len = (VAR_0->cluster_sectors << 9) * 2;", "data = g_malloc(buf_len + sizeof(VmdkGrainMarker));", "VAR_9 = g_malloc(VAR_5);", "qemu_iovec_to_buf(VAR_3, VAR_4, VAR_9, VAR_5);", "VAR_7 = compress(data->data, &buf_len, VAR_9, VAR_5);", "g_free(VAR_9);", "if (VAR_7 != Z_OK || buf_len == 0) {", "VAR_7 = -EINVAL;", "goto out;", "}", "data->lba = VAR_6 >> BDRV_SECTOR_BITS;", "data->size = buf_len;", "VAR_5 = buf_len + sizeof(VmdkGrainMarker);", "VAR_8 = (struct iovec) {", ".iov_base = data,\n.iov_len = VAR_5,\n};", "qemu_iovec_init_external(&local_qiov, &VAR_8, 1);", "} else {", "qemu_iovec_init(&local_qiov, VAR_3->niov);", "qemu_iovec_concat(&local_qiov, VAR_3, VAR_4, VAR_5);", "}", "write_offset = VAR_1 + VAR_2,\nVAR_7 = bdrv_co_pwritev(VAR_0->file->bs, write_offset, VAR_5,\n&local_qiov, 0);", "write_end_sector = DIV_ROUND_UP(write_offset + VAR_5, BDRV_SECTOR_SIZE);", "if (VAR_0->compressed) {", "VAR_0->next_cluster_sector = write_end_sector;", "} else {", "VAR_0->next_cluster_sector = MAX(VAR_0->next_cluster_sector,\nwrite_end_sector);", "}", "if (VAR_7 < 0) {", "goto out;", "}", "VAR_7 = 0;", "out:\ng_free(data);", "if (!VAR_0->compressed) {", "qemu_iovec_destroy(&local_qiov);", "}", "return VAR_7;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ], [ 73 ], [ 75 ], [ 77, 79, 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 95, 97, 99 ], [ 103 ], [ 107 ], [ 109 ], [ 111 ], [ 113, 115 ], [ 117 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129, 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ] ]
26,497
static int vnc_continue_handshake(struct VncState *vs) { int ret; if ((ret = gnutls_handshake(vs->tls_session)) < 0) { if (!gnutls_error_is_fatal(ret)) { VNC_DEBUG("Handshake interrupted (blocking)\n"); if (!gnutls_record_get_direction(vs->tls_session)) qemu_set_fd_handler(vs->csock, vnc_handshake_io, NULL, vs); else qemu_set_fd_handler(vs->csock, NULL, vnc_handshake_io, vs); return 0; } VNC_DEBUG("Handshake failed %s\n", gnutls_strerror(ret)); vnc_client_error(vs); return -1; } if (vs->vd->x509verify) { if (vnc_validate_certificate(vs) < 0) { VNC_DEBUG("Client verification failed\n"); vnc_client_error(vs); return -1; } else { VNC_DEBUG("Client verification passed\n"); } } VNC_DEBUG("Handshake done, switching to TLS data mode\n"); vs->wiremode = VNC_WIREMODE_TLS; qemu_set_fd_handler2(vs->csock, NULL, vnc_client_read, vnc_client_write, vs); return start_auth_vencrypt_subauth(vs); }
false
qemu
5fb6c7a8b26eab1a22207d24b4784bd2b39ab54b
static int vnc_continue_handshake(struct VncState *vs) { int ret; if ((ret = gnutls_handshake(vs->tls_session)) < 0) { if (!gnutls_error_is_fatal(ret)) { VNC_DEBUG("Handshake interrupted (blocking)\n"); if (!gnutls_record_get_direction(vs->tls_session)) qemu_set_fd_handler(vs->csock, vnc_handshake_io, NULL, vs); else qemu_set_fd_handler(vs->csock, NULL, vnc_handshake_io, vs); return 0; } VNC_DEBUG("Handshake failed %s\n", gnutls_strerror(ret)); vnc_client_error(vs); return -1; } if (vs->vd->x509verify) { if (vnc_validate_certificate(vs) < 0) { VNC_DEBUG("Client verification failed\n"); vnc_client_error(vs); return -1; } else { VNC_DEBUG("Client verification passed\n"); } } VNC_DEBUG("Handshake done, switching to TLS data mode\n"); vs->wiremode = VNC_WIREMODE_TLS; qemu_set_fd_handler2(vs->csock, NULL, vnc_client_read, vnc_client_write, vs); return start_auth_vencrypt_subauth(vs); }
{ "code": [], "line_no": [] }
static int FUNC_0(struct VncState *VAR_0) { int VAR_1; if ((VAR_1 = gnutls_handshake(VAR_0->tls_session)) < 0) { if (!gnutls_error_is_fatal(VAR_1)) { VNC_DEBUG("Handshake interrupted (blocking)\n"); if (!gnutls_record_get_direction(VAR_0->tls_session)) qemu_set_fd_handler(VAR_0->csock, vnc_handshake_io, NULL, VAR_0); else qemu_set_fd_handler(VAR_0->csock, NULL, vnc_handshake_io, VAR_0); return 0; } VNC_DEBUG("Handshake failed %s\n", gnutls_strerror(VAR_1)); vnc_client_error(VAR_0); return -1; } if (VAR_0->vd->x509verify) { if (vnc_validate_certificate(VAR_0) < 0) { VNC_DEBUG("Client verification failed\n"); vnc_client_error(VAR_0); return -1; } else { VNC_DEBUG("Client verification passed\n"); } } VNC_DEBUG("Handshake done, switching to TLS data mode\n"); VAR_0->wiremode = VNC_WIREMODE_TLS; qemu_set_fd_handler2(VAR_0->csock, NULL, vnc_client_read, vnc_client_write, VAR_0); return start_auth_vencrypt_subauth(VAR_0); }
[ "static int FUNC_0(struct VncState *VAR_0) {", "int VAR_1;", "if ((VAR_1 = gnutls_handshake(VAR_0->tls_session)) < 0) {", "if (!gnutls_error_is_fatal(VAR_1)) {", "VNC_DEBUG(\"Handshake interrupted (blocking)\\n\");", "if (!gnutls_record_get_direction(VAR_0->tls_session))\nqemu_set_fd_handler(VAR_0->csock, vnc_handshake_io, NULL, VAR_0);", "else\nqemu_set_fd_handler(VAR_0->csock, NULL, vnc_handshake_io, VAR_0);", "return 0;", "}", "VNC_DEBUG(\"Handshake failed %s\\n\", gnutls_strerror(VAR_1));", "vnc_client_error(VAR_0);", "return -1;", "}", "if (VAR_0->vd->x509verify) {", "if (vnc_validate_certificate(VAR_0) < 0) {", "VNC_DEBUG(\"Client verification failed\\n\");", "vnc_client_error(VAR_0);", "return -1;", "} else {", "VNC_DEBUG(\"Client verification passed\\n\");", "}", "}", "VNC_DEBUG(\"Handshake done, switching to TLS data mode\\n\");", "VAR_0->wiremode = VNC_WIREMODE_TLS;", "qemu_set_fd_handler2(VAR_0->csock, NULL, vnc_client_read, vnc_client_write, VAR_0);", "return start_auth_vencrypt_subauth(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 ]
[ [ 1 ], [ 3 ], [ 7 ], [ 9 ], [ 11 ], [ 13, 15 ], [ 17, 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ] ]
26,498
void cpu_reset (CPUMIPSState *env) { memset(env, 0, offsetof(CPUMIPSState, breakpoints)); tlb_flush(env, 1); /* Minimal init */ #if defined(CONFIG_USER_ONLY) env->hflags = MIPS_HFLAG_UM; #else if (env->hflags & MIPS_HFLAG_BMASK) { /* If the exception was raised from a delay slot, come back to the jump. */ env->CP0_ErrorEPC = env->active_tc.PC - 4; } else { env->CP0_ErrorEPC = env->active_tc.PC; env->active_tc.PC = (int32_t)0xBFC00000; env->CP0_Wired = 0; /* SMP not implemented */ env->CP0_EBase = 0x80000000; env->CP0_Status = (1 << CP0St_BEV) | (1 << CP0St_ERL); /* vectored interrupts not implemented, timer on int 7, no performance counters. */ env->CP0_IntCtl = 0xe0000000; { int i; for (i = 0; i < 7; i++) { env->CP0_WatchLo[i] = 0; env->CP0_WatchHi[i] = 0x80000000; env->CP0_WatchLo[7] = 0; env->CP0_WatchHi[7] = 0; /* Count register increments in debug mode, EJTAG version 1 */ env->CP0_Debug = (1 << CP0DB_CNT) | (0x1 << CP0DB_VER); env->hflags = MIPS_HFLAG_CP0; #endif env->exception_index = EXCP_NONE; cpu_mips_register(env, env->cpu_model);
true
qemu
eca1bdf415c454093dfc7eb983cd49287c043967
void cpu_reset (CPUMIPSState *env) { memset(env, 0, offsetof(CPUMIPSState, breakpoints)); tlb_flush(env, 1); #if defined(CONFIG_USER_ONLY) env->hflags = MIPS_HFLAG_UM; #else if (env->hflags & MIPS_HFLAG_BMASK) { env->CP0_ErrorEPC = env->active_tc.PC - 4; } else { env->CP0_ErrorEPC = env->active_tc.PC; env->active_tc.PC = (int32_t)0xBFC00000; env->CP0_Wired = 0; env->CP0_EBase = 0x80000000; env->CP0_Status = (1 << CP0St_BEV) | (1 << CP0St_ERL); env->CP0_IntCtl = 0xe0000000; { int i; for (i = 0; i < 7; i++) { env->CP0_WatchLo[i] = 0; env->CP0_WatchHi[i] = 0x80000000; env->CP0_WatchLo[7] = 0; env->CP0_WatchHi[7] = 0; env->CP0_Debug = (1 << CP0DB_CNT) | (0x1 << CP0DB_VER); env->hflags = MIPS_HFLAG_CP0; #endif env->exception_index = EXCP_NONE; cpu_mips_register(env, env->cpu_model);
{ "code": [], "line_no": [] }
void FUNC_0 (CPUMIPSState *VAR_0) { memset(VAR_0, 0, offsetof(CPUMIPSState, breakpoints)); tlb_flush(VAR_0, 1); #if defined(CONFIG_USER_ONLY) VAR_0->hflags = MIPS_HFLAG_UM; #else if (VAR_0->hflags & MIPS_HFLAG_BMASK) { VAR_0->CP0_ErrorEPC = VAR_0->active_tc.PC - 4; } else { VAR_0->CP0_ErrorEPC = VAR_0->active_tc.PC; VAR_0->active_tc.PC = (int32_t)0xBFC00000; VAR_0->CP0_Wired = 0; VAR_0->CP0_EBase = 0x80000000; VAR_0->CP0_Status = (1 << CP0St_BEV) | (1 << CP0St_ERL); VAR_0->CP0_IntCtl = 0xe0000000; { int VAR_1; for (VAR_1 = 0; VAR_1 < 7; VAR_1++) { VAR_0->CP0_WatchLo[VAR_1] = 0; VAR_0->CP0_WatchHi[VAR_1] = 0x80000000; VAR_0->CP0_WatchLo[7] = 0; VAR_0->CP0_WatchHi[7] = 0; VAR_0->CP0_Debug = (1 << CP0DB_CNT) | (0x1 << CP0DB_VER); VAR_0->hflags = MIPS_HFLAG_CP0; #endif VAR_0->exception_index = EXCP_NONE; cpu_mips_register(VAR_0, VAR_0->cpu_model);
[ "void FUNC_0 (CPUMIPSState *VAR_0)\n{", "memset(VAR_0, 0, offsetof(CPUMIPSState, breakpoints));", "tlb_flush(VAR_0, 1);", "#if defined(CONFIG_USER_ONLY)\nVAR_0->hflags = MIPS_HFLAG_UM;", "#else\nif (VAR_0->hflags & MIPS_HFLAG_BMASK) {", "VAR_0->CP0_ErrorEPC = VAR_0->active_tc.PC - 4;", "} else {", "VAR_0->CP0_ErrorEPC = VAR_0->active_tc.PC;", "VAR_0->active_tc.PC = (int32_t)0xBFC00000;", "VAR_0->CP0_Wired = 0;", "VAR_0->CP0_EBase = 0x80000000;", "VAR_0->CP0_Status = (1 << CP0St_BEV) | (1 << CP0St_ERL);", "VAR_0->CP0_IntCtl = 0xe0000000;", "{", "int VAR_1;", "for (VAR_1 = 0; VAR_1 < 7; VAR_1++) {", "VAR_0->CP0_WatchLo[VAR_1] = 0;", "VAR_0->CP0_WatchHi[VAR_1] = 0x80000000;", "VAR_0->CP0_WatchLo[7] = 0;", "VAR_0->CP0_WatchHi[7] = 0;", "VAR_0->CP0_Debug = (1 << CP0DB_CNT) | (0x1 << CP0DB_VER);", "VAR_0->hflags = MIPS_HFLAG_CP0;", "#endif\nVAR_0->exception_index = EXCP_NONE;", "cpu_mips_register(VAR_0, VAR_0->cpu_model);" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2 ], [ 3 ], [ 4 ], [ 6, 7 ], [ 8, 9 ], [ 12 ], [ 13 ], [ 14 ], [ 15 ], [ 16 ], [ 18 ], [ 19 ], [ 22 ], [ 23 ], [ 24 ], [ 25 ], [ 26 ], [ 27 ], [ 28 ], [ 29 ], [ 31 ], [ 32 ], [ 33, 34 ], [ 35 ] ]
26,499
static int vmdk_open(BlockDriverState *bs, QDict *options, int flags, Error **errp) { char *buf; int ret; BDRVVmdkState *s = bs->opaque; uint32_t magic; Error *local_err = NULL; bs->file = bdrv_open_child(NULL, options, "file", bs, &child_file, false, errp); if (!bs->file) { return -EINVAL; } buf = vmdk_read_desc(bs->file, 0, errp); if (!buf) { return -EINVAL; } magic = ldl_be_p(buf); switch (magic) { case VMDK3_MAGIC: case VMDK4_MAGIC: ret = vmdk_open_sparse(bs, bs->file, flags, buf, options, errp); s->desc_offset = 0x200; break; default: ret = vmdk_open_desc_file(bs, flags, buf, options, errp); break; } if (ret) { goto fail; } /* try to open parent images, if exist */ ret = vmdk_parent_open(bs); if (ret) { goto fail; } s->cid = vmdk_read_cid(bs, 0); s->parent_cid = vmdk_read_cid(bs, 1); qemu_co_mutex_init(&s->lock); /* Disable migration when VMDK images are used */ error_setg(&s->migration_blocker, "The vmdk format used by node '%s' " "does not support live migration", bdrv_get_device_or_node_name(bs)); ret = migrate_add_blocker(s->migration_blocker, &local_err); if (local_err) { error_propagate(errp, local_err); error_free(s->migration_blocker); goto fail; } g_free(buf); return 0; fail: g_free(buf); g_free(s->create_type); s->create_type = NULL; vmdk_free_extents(bs); return ret; }
true
qemu
9877860e7bd1e26ee70ab9bb5ebc34c92bf23bf5
static int vmdk_open(BlockDriverState *bs, QDict *options, int flags, Error **errp) { char *buf; int ret; BDRVVmdkState *s = bs->opaque; uint32_t magic; Error *local_err = NULL; bs->file = bdrv_open_child(NULL, options, "file", bs, &child_file, false, errp); if (!bs->file) { return -EINVAL; } buf = vmdk_read_desc(bs->file, 0, errp); if (!buf) { return -EINVAL; } magic = ldl_be_p(buf); switch (magic) { case VMDK3_MAGIC: case VMDK4_MAGIC: ret = vmdk_open_sparse(bs, bs->file, flags, buf, options, errp); s->desc_offset = 0x200; break; default: ret = vmdk_open_desc_file(bs, flags, buf, options, errp); break; } if (ret) { goto fail; } ret = vmdk_parent_open(bs); if (ret) { goto fail; } s->cid = vmdk_read_cid(bs, 0); s->parent_cid = vmdk_read_cid(bs, 1); qemu_co_mutex_init(&s->lock); error_setg(&s->migration_blocker, "The vmdk format used by node '%s' " "does not support live migration", bdrv_get_device_or_node_name(bs)); ret = migrate_add_blocker(s->migration_blocker, &local_err); if (local_err) { error_propagate(errp, local_err); error_free(s->migration_blocker); goto fail; } g_free(buf); return 0; fail: g_free(buf); g_free(s->create_type); s->create_type = NULL; vmdk_free_extents(bs); return ret; }
{ "code": [ " s->cid = vmdk_read_cid(bs, 0);", " s->parent_cid = vmdk_read_cid(bs, 1);" ], "line_no": [ 83, 85 ] }
static int FUNC_0(BlockDriverState *VAR_0, QDict *VAR_1, int VAR_2, Error **VAR_3) { char *VAR_4; int VAR_5; BDRVVmdkState *s = VAR_0->opaque; uint32_t magic; Error *local_err = NULL; VAR_0->file = bdrv_open_child(NULL, VAR_1, "file", VAR_0, &child_file, false, VAR_3); if (!VAR_0->file) { return -EINVAL; } VAR_4 = vmdk_read_desc(VAR_0->file, 0, VAR_3); if (!VAR_4) { return -EINVAL; } magic = ldl_be_p(VAR_4); switch (magic) { case VMDK3_MAGIC: case VMDK4_MAGIC: VAR_5 = vmdk_open_sparse(VAR_0, VAR_0->file, VAR_2, VAR_4, VAR_1, VAR_3); s->desc_offset = 0x200; break; default: VAR_5 = vmdk_open_desc_file(VAR_0, VAR_2, VAR_4, VAR_1, VAR_3); break; } if (VAR_5) { goto fail; } VAR_5 = vmdk_parent_open(VAR_0); if (VAR_5) { goto fail; } s->cid = vmdk_read_cid(VAR_0, 0); s->parent_cid = vmdk_read_cid(VAR_0, 1); qemu_co_mutex_init(&s->lock); error_setg(&s->migration_blocker, "The vmdk format used by node '%s' " "does not support live migration", bdrv_get_device_or_node_name(VAR_0)); VAR_5 = migrate_add_blocker(s->migration_blocker, &local_err); if (local_err) { error_propagate(VAR_3, local_err); error_free(s->migration_blocker); goto fail; } g_free(VAR_4); return 0; fail: g_free(VAR_4); g_free(s->create_type); s->create_type = NULL; vmdk_free_extents(VAR_0); return VAR_5; }
[ "static int FUNC_0(BlockDriverState *VAR_0, QDict *VAR_1, int VAR_2,\nError **VAR_3)\n{", "char *VAR_4;", "int VAR_5;", "BDRVVmdkState *s = VAR_0->opaque;", "uint32_t magic;", "Error *local_err = NULL;", "VAR_0->file = bdrv_open_child(NULL, VAR_1, \"file\", VAR_0, &child_file,\nfalse, VAR_3);", "if (!VAR_0->file) {", "return -EINVAL;", "}", "VAR_4 = vmdk_read_desc(VAR_0->file, 0, VAR_3);", "if (!VAR_4) {", "return -EINVAL;", "}", "magic = ldl_be_p(VAR_4);", "switch (magic) {", "case VMDK3_MAGIC:\ncase VMDK4_MAGIC:\nVAR_5 = vmdk_open_sparse(VAR_0, VAR_0->file, VAR_2, VAR_4, VAR_1,\nVAR_3);", "s->desc_offset = 0x200;", "break;", "default:\nVAR_5 = vmdk_open_desc_file(VAR_0, VAR_2, VAR_4, VAR_1, VAR_3);", "break;", "}", "if (VAR_5) {", "goto fail;", "}", "VAR_5 = vmdk_parent_open(VAR_0);", "if (VAR_5) {", "goto fail;", "}", "s->cid = vmdk_read_cid(VAR_0, 0);", "s->parent_cid = vmdk_read_cid(VAR_0, 1);", "qemu_co_mutex_init(&s->lock);", "error_setg(&s->migration_blocker, \"The vmdk format used by node '%s' \"\n\"does not support live migration\",\nbdrv_get_device_or_node_name(VAR_0));", "VAR_5 = migrate_add_blocker(s->migration_blocker, &local_err);", "if (local_err) {", "error_propagate(VAR_3, local_err);", "error_free(s->migration_blocker);", "goto fail;", "}", "g_free(VAR_4);", "return 0;", "fail:\ng_free(VAR_4);", "g_free(s->create_type);", "s->create_type = NULL;", "vmdk_free_extents(VAR_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, 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 ], [ 13 ], [ 15 ], [ 19, 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45, 47, 49, 51 ], [ 53 ], [ 55 ], [ 57, 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 93, 95, 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 113 ], [ 115 ], [ 119, 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ] ]
26,500
static inline void gen_neon_widen(TCGv_i64 dest, TCGv src, int size, int u) { if (u) { switch (size) { case 0: gen_helper_neon_widen_u8(dest, src); break; case 1: gen_helper_neon_widen_u16(dest, src); break; case 2: tcg_gen_extu_i32_i64(dest, src); break; default: abort(); } } else { switch (size) { case 0: gen_helper_neon_widen_s8(dest, src); break; case 1: gen_helper_neon_widen_s16(dest, src); break; case 2: tcg_gen_ext_i32_i64(dest, src); break; default: abort(); } } dead_tmp(src); }
true
qemu
7d1b0095bff7157e856d1d0e6c4295641ced2752
static inline void gen_neon_widen(TCGv_i64 dest, TCGv src, int size, int u) { if (u) { switch (size) { case 0: gen_helper_neon_widen_u8(dest, src); break; case 1: gen_helper_neon_widen_u16(dest, src); break; case 2: tcg_gen_extu_i32_i64(dest, src); break; default: abort(); } } else { switch (size) { case 0: gen_helper_neon_widen_s8(dest, src); break; case 1: gen_helper_neon_widen_s16(dest, src); break; case 2: tcg_gen_ext_i32_i64(dest, src); break; default: abort(); } } dead_tmp(src); }
{ "code": [ " dead_tmp(src);" ], "line_no": [ 35 ] }
static inline void FUNC_0(TCGv_i64 VAR_0, TCGv VAR_1, int VAR_2, int VAR_3) { if (VAR_3) { switch (VAR_2) { case 0: gen_helper_neon_widen_u8(VAR_0, VAR_1); break; case 1: gen_helper_neon_widen_u16(VAR_0, VAR_1); break; case 2: tcg_gen_extu_i32_i64(VAR_0, VAR_1); break; default: abort(); } } else { switch (VAR_2) { case 0: gen_helper_neon_widen_s8(VAR_0, VAR_1); break; case 1: gen_helper_neon_widen_s16(VAR_0, VAR_1); break; case 2: tcg_gen_ext_i32_i64(VAR_0, VAR_1); break; default: abort(); } } dead_tmp(VAR_1); }
[ "static inline void FUNC_0(TCGv_i64 VAR_0, TCGv VAR_1, int VAR_2, int VAR_3)\n{", "if (VAR_3) {", "switch (VAR_2) {", "case 0: gen_helper_neon_widen_u8(VAR_0, VAR_1); break;", "case 1: gen_helper_neon_widen_u16(VAR_0, VAR_1); break;", "case 2: tcg_gen_extu_i32_i64(VAR_0, VAR_1); break;", "default: abort();", "}", "} else {", "switch (VAR_2) {", "case 0: gen_helper_neon_widen_s8(VAR_0, VAR_1); break;", "case 1: gen_helper_neon_widen_s16(VAR_0, VAR_1); break;", "case 2: tcg_gen_ext_i32_i64(VAR_0, VAR_1); break;", "default: abort();", "}", "}", "dead_tmp(VAR_1);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ] ]
26,501
static int rv10_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; MpegEncContext *s = avctx->priv_data; int i; AVFrame *pict = data; int slice_count; const uint8_t *slices_hdr = NULL; av_dlog(avctx, "*****frame %d size=%d\n", avctx->frame_number, buf_size); /* no supplementary picture */ if (buf_size == 0) { return 0; } if(!avctx->slice_count){ slice_count = (*buf++) + 1; slices_hdr = buf + 4; buf += 8 * slice_count; }else slice_count = avctx->slice_count; for(i=0; i<slice_count; i++){ int offset= get_slice_offset(avctx, slices_hdr, i); int size, size2; if(i+1 == slice_count) size= buf_size - offset; else size= get_slice_offset(avctx, slices_hdr, i+1) - offset; if(i+2 >= slice_count) size2= buf_size - offset; else size2= get_slice_offset(avctx, slices_hdr, i+2) - offset; if(rv10_decode_packet(avctx, buf+offset, size, size2) > 8*size) i++; } if(s->current_picture_ptr != NULL && s->mb_y>=s->mb_height){ ff_er_frame_end(s); MPV_frame_end(s); if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) { *pict= *(AVFrame*)s->current_picture_ptr; } else if (s->last_picture_ptr != NULL) { *pict= *(AVFrame*)s->last_picture_ptr; } if(s->last_picture_ptr || s->low_delay){ *data_size = sizeof(AVFrame); ff_print_debug_info(s, pict); } s->current_picture_ptr= NULL; //so we can detect if frame_end wasnt called (find some nicer solution...) } return buf_size; }
true
FFmpeg
1d3a9e63e0dcbcba633d939cdfb79e977259be13
static int rv10_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; MpegEncContext *s = avctx->priv_data; int i; AVFrame *pict = data; int slice_count; const uint8_t *slices_hdr = NULL; av_dlog(avctx, "*****frame %d size=%d\n", avctx->frame_number, buf_size); if (buf_size == 0) { return 0; } if(!avctx->slice_count){ slice_count = (*buf++) + 1; slices_hdr = buf + 4; buf += 8 * slice_count; }else slice_count = avctx->slice_count; for(i=0; i<slice_count; i++){ int offset= get_slice_offset(avctx, slices_hdr, i); int size, size2; if(i+1 == slice_count) size= buf_size - offset; else size= get_slice_offset(avctx, slices_hdr, i+1) - offset; if(i+2 >= slice_count) size2= buf_size - offset; else size2= get_slice_offset(avctx, slices_hdr, i+2) - offset; if(rv10_decode_packet(avctx, buf+offset, size, size2) > 8*size) i++; } if(s->current_picture_ptr != NULL && s->mb_y>=s->mb_height){ ff_er_frame_end(s); MPV_frame_end(s); if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) { *pict= *(AVFrame*)s->current_picture_ptr; } else if (s->last_picture_ptr != NULL) { *pict= *(AVFrame*)s->last_picture_ptr; } if(s->last_picture_ptr || s->low_delay){ *data_size = sizeof(AVFrame); ff_print_debug_info(s, pict); } s->current_picture_ptr= NULL; } return buf_size; }
{ "code": [ " int offset= get_slice_offset(avctx, slices_hdr, i);" ], "line_no": [ 55 ] }
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3) { const uint8_t *VAR_4 = VAR_3->VAR_1; int VAR_5 = VAR_3->VAR_10; MpegEncContext *s = VAR_0->priv_data; int VAR_6; AVFrame *pict = VAR_1; int VAR_7; const uint8_t *VAR_8 = NULL; av_dlog(VAR_0, "*****frame %d VAR_10=%d\n", VAR_0->frame_number, VAR_5); if (VAR_5 == 0) { return 0; } if(!VAR_0->VAR_7){ VAR_7 = (*VAR_4++) + 1; VAR_8 = VAR_4 + 4; VAR_4 += 8 * VAR_7; }else VAR_7 = VAR_0->VAR_7; for(VAR_6=0; VAR_6<VAR_7; VAR_6++){ int VAR_9= get_slice_offset(VAR_0, VAR_8, VAR_6); int VAR_10, VAR_11; if(VAR_6+1 == VAR_7) VAR_10= VAR_5 - VAR_9; else VAR_10= get_slice_offset(VAR_0, VAR_8, VAR_6+1) - VAR_9; if(VAR_6+2 >= VAR_7) VAR_11= VAR_5 - VAR_9; else VAR_11= get_slice_offset(VAR_0, VAR_8, VAR_6+2) - VAR_9; if(rv10_decode_packet(VAR_0, VAR_4+VAR_9, VAR_10, VAR_11) > 8*VAR_10) VAR_6++; } if(s->current_picture_ptr != NULL && s->mb_y>=s->mb_height){ ff_er_frame_end(s); MPV_frame_end(s); if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) { *pict= *(AVFrame*)s->current_picture_ptr; } else if (s->last_picture_ptr != NULL) { *pict= *(AVFrame*)s->last_picture_ptr; } if(s->last_picture_ptr || s->low_delay){ *VAR_2 = sizeof(AVFrame); ff_print_debug_info(s, pict); } s->current_picture_ptr= NULL; } return VAR_5; }
[ "static int FUNC_0(AVCodecContext *VAR_0,\nvoid *VAR_1, int *VAR_2,\nAVPacket *VAR_3)\n{", "const uint8_t *VAR_4 = VAR_3->VAR_1;", "int VAR_5 = VAR_3->VAR_10;", "MpegEncContext *s = VAR_0->priv_data;", "int VAR_6;", "AVFrame *pict = VAR_1;", "int VAR_7;", "const uint8_t *VAR_8 = NULL;", "av_dlog(VAR_0, \"*****frame %d VAR_10=%d\\n\", VAR_0->frame_number, VAR_5);", "if (VAR_5 == 0) {", "return 0;", "}", "if(!VAR_0->VAR_7){", "VAR_7 = (*VAR_4++) + 1;", "VAR_8 = VAR_4 + 4;", "VAR_4 += 8 * VAR_7;", "}else", "VAR_7 = VAR_0->VAR_7;", "for(VAR_6=0; VAR_6<VAR_7; VAR_6++){", "int VAR_9= get_slice_offset(VAR_0, VAR_8, VAR_6);", "int VAR_10, VAR_11;", "if(VAR_6+1 == VAR_7)\nVAR_10= VAR_5 - VAR_9;", "else\nVAR_10= get_slice_offset(VAR_0, VAR_8, VAR_6+1) - VAR_9;", "if(VAR_6+2 >= VAR_7)\nVAR_11= VAR_5 - VAR_9;", "else\nVAR_11= get_slice_offset(VAR_0, VAR_8, VAR_6+2) - VAR_9;", "if(rv10_decode_packet(VAR_0, VAR_4+VAR_9, VAR_10, VAR_11) > 8*VAR_10)\nVAR_6++;", "}", "if(s->current_picture_ptr != NULL && s->mb_y>=s->mb_height){", "ff_er_frame_end(s);", "MPV_frame_end(s);", "if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) {", "*pict= *(AVFrame*)s->current_picture_ptr;", "} else if (s->last_picture_ptr != NULL) {", "*pict= *(AVFrame*)s->last_picture_ptr;", "}", "if(s->last_picture_ptr || s->low_delay){", "*VAR_2 = sizeof(AVFrame);", "ff_print_debug_info(s, pict);", "}", "s->current_picture_ptr= NULL;", "}", "return VAR_5;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 61, 63 ], [ 65, 67 ], [ 71, 73 ], [ 75, 77 ], [ 81, 83 ], [ 85 ], [ 89 ], [ 91 ], [ 93 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 123 ], [ 125 ] ]
26,502
static void output_client_manifest(struct VideoFiles *files, const char *basename, int split) { char filename[1000]; FILE *out; int i, j; if (split) snprintf(filename, sizeof(filename), "Manifest"); else snprintf(filename, sizeof(filename), "%s.ismc", basename); out = fopen(filename, "w"); if (!out) { perror(filename); return; } fprintf(out, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"); fprintf(out, "<SmoothStreamingMedia MajorVersion=\"2\" MinorVersion=\"0\" " "Duration=\"%"PRId64 "\">\n", files->duration * 10); if (files->video_file >= 0) { struct VideoFile *vf = files->files[files->video_file]; int index = 0; fprintf(out, "\t<StreamIndex Type=\"video\" QualityLevels=\"%d\" " "Chunks=\"%d\" " "Url=\"QualityLevels({bitrate})/Fragments(video={start time})\">\n", files->nb_video_files, vf->chunks); for (i = 0; i < files->nb_files; i++) { vf = files->files[i]; if (!vf->is_video) continue; fprintf(out, "\t\t<QualityLevel Index=\"%d\" Bitrate=\"%d\" " "FourCC=\"%s\" MaxWidth=\"%d\" MaxHeight=\"%d\" " "CodecPrivateData=\"", index, vf->bitrate, vf->fourcc, vf->width, vf->height); for (j = 0; j < vf->codec_private_size; j++) fprintf(out, "%02X", vf->codec_private[j]); fprintf(out, "\" />\n"); index++; } vf = files->files[files->video_file]; for (i = 0; i < vf->chunks; i++) fprintf(out, "\t\t<c n=\"%d\" d=\"%d\" />\n", i, vf->offsets[i].duration); fprintf(out, "\t</StreamIndex>\n"); } if (files->audio_file >= 0) { struct VideoFile *vf = files->files[files->audio_file]; int index = 0; fprintf(out, "\t<StreamIndex Type=\"audio\" QualityLevels=\"%d\" " "Chunks=\"%d\" " "Url=\"QualityLevels({bitrate})/Fragments(audio={start time})\">\n", files->nb_audio_files, vf->chunks); for (i = 0; i < files->nb_files; i++) { vf = files->files[i]; if (!vf->is_audio) continue; fprintf(out, "\t\t<QualityLevel Index=\"%d\" Bitrate=\"%d\" " "FourCC=\"%s\" SamplingRate=\"%d\" Channels=\"%d\" " "BitsPerSample=\"16\" PacketSize=\"%d\" " "AudioTag=\"%d\" CodecPrivateData=\"", index, vf->bitrate, vf->fourcc, vf->sample_rate, vf->channels, vf->blocksize, vf->tag); for (j = 0; j < vf->codec_private_size; j++) fprintf(out, "%02X", vf->codec_private[j]); fprintf(out, "\" />\n"); index++; } vf = files->files[files->audio_file]; for (i = 0; i < vf->chunks; i++) fprintf(out, "\t\t<c n=\"%d\" d=\"%d\" />\n", i, vf->offsets[i].duration); fprintf(out, "\t</StreamIndex>\n"); } fprintf(out, "</SmoothStreamingMedia>\n"); fclose(out); }
true
FFmpeg
30327865f388260e49d40affd1b9c9fc2e20ebfe
static void output_client_manifest(struct VideoFiles *files, const char *basename, int split) { char filename[1000]; FILE *out; int i, j; if (split) snprintf(filename, sizeof(filename), "Manifest"); else snprintf(filename, sizeof(filename), "%s.ismc", basename); out = fopen(filename, "w"); if (!out) { perror(filename); return; } fprintf(out, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"); fprintf(out, "<SmoothStreamingMedia MajorVersion=\"2\" MinorVersion=\"0\" " "Duration=\"%"PRId64 "\">\n", files->duration * 10); if (files->video_file >= 0) { struct VideoFile *vf = files->files[files->video_file]; int index = 0; fprintf(out, "\t<StreamIndex Type=\"video\" QualityLevels=\"%d\" " "Chunks=\"%d\" " "Url=\"QualityLevels({bitrate})/Fragments(video={start time})\">\n", files->nb_video_files, vf->chunks); for (i = 0; i < files->nb_files; i++) { vf = files->files[i]; if (!vf->is_video) continue; fprintf(out, "\t\t<QualityLevel Index=\"%d\" Bitrate=\"%d\" " "FourCC=\"%s\" MaxWidth=\"%d\" MaxHeight=\"%d\" " "CodecPrivateData=\"", index, vf->bitrate, vf->fourcc, vf->width, vf->height); for (j = 0; j < vf->codec_private_size; j++) fprintf(out, "%02X", vf->codec_private[j]); fprintf(out, "\" />\n"); index++; } vf = files->files[files->video_file]; for (i = 0; i < vf->chunks; i++) fprintf(out, "\t\t<c n=\"%d\" d=\"%d\" />\n", i, vf->offsets[i].duration); fprintf(out, "\t</StreamIndex>\n"); } if (files->audio_file >= 0) { struct VideoFile *vf = files->files[files->audio_file]; int index = 0; fprintf(out, "\t<StreamIndex Type=\"audio\" QualityLevels=\"%d\" " "Chunks=\"%d\" " "Url=\"QualityLevels({bitrate})/Fragments(audio={start time})\">\n", files->nb_audio_files, vf->chunks); for (i = 0; i < files->nb_files; i++) { vf = files->files[i]; if (!vf->is_audio) continue; fprintf(out, "\t\t<QualityLevel Index=\"%d\" Bitrate=\"%d\" " "FourCC=\"%s\" SamplingRate=\"%d\" Channels=\"%d\" " "BitsPerSample=\"16\" PacketSize=\"%d\" " "AudioTag=\"%d\" CodecPrivateData=\"", index, vf->bitrate, vf->fourcc, vf->sample_rate, vf->channels, vf->blocksize, vf->tag); for (j = 0; j < vf->codec_private_size; j++) fprintf(out, "%02X", vf->codec_private[j]); fprintf(out, "\" />\n"); index++; } vf = files->files[files->audio_file]; for (i = 0; i < vf->chunks; i++) fprintf(out, "\t\t<c n=\"%d\" d=\"%d\" />\n", i, vf->offsets[i].duration); fprintf(out, "\t</StreamIndex>\n"); } fprintf(out, "</SmoothStreamingMedia>\n"); fclose(out); }
{ "code": [ " vf = files->files[files->video_file];", " for (i = 0; i < vf->chunks; i++)", " vf = files->files[files->audio_file];", " for (i = 0; i < vf->chunks; i++)" ], "line_no": [ 83, 85, 143, 85 ] }
static void FUNC_0(struct VideoFiles *VAR_0, const char *VAR_1, int VAR_2) { char VAR_3[1000]; FILE *out; int VAR_4, VAR_5; if (VAR_2) snprintf(VAR_3, sizeof(VAR_3), "Manifest"); else snprintf(VAR_3, sizeof(VAR_3), "%s.ismc", VAR_1); out = fopen(VAR_3, "w"); if (!out) { perror(VAR_3); return; } fprintf(out, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"); fprintf(out, "<SmoothStreamingMedia MajorVersion=\"2\" MinorVersion=\"0\" " "Duration=\"%"PRId64 "\">\n", VAR_0->duration * 10); if (VAR_0->video_file >= 0) { struct VideoFile *VAR_8 = VAR_0->VAR_0[VAR_0->video_file]; int VAR_8 = 0; fprintf(out, "\t<StreamIndex Type=\"video\" QualityLevels=\"%d\" " "Chunks=\"%d\" " "Url=\"QualityLevels({bitrate})/Fragments(video={start time})\">\n", VAR_0->nb_video_files, VAR_8->chunks); for (VAR_4 = 0; VAR_4 < VAR_0->nb_files; VAR_4++) { VAR_8 = VAR_0->VAR_0[VAR_4]; if (!VAR_8->is_video) continue; fprintf(out, "\t\t<QualityLevel Index=\"%d\" Bitrate=\"%d\" " "FourCC=\"%s\" MaxWidth=\"%d\" MaxHeight=\"%d\" " "CodecPrivateData=\"", VAR_8, VAR_8->bitrate, VAR_8->fourcc, VAR_8->width, VAR_8->height); for (VAR_5 = 0; VAR_5 < VAR_8->codec_private_size; VAR_5++) fprintf(out, "%02X", VAR_8->codec_private[VAR_5]); fprintf(out, "\" />\n"); VAR_8++; } VAR_8 = VAR_0->VAR_0[VAR_0->video_file]; for (VAR_4 = 0; VAR_4 < VAR_8->chunks; VAR_4++) fprintf(out, "\t\t<c n=\"%d\" d=\"%d\" />\n", VAR_4, VAR_8->offsets[VAR_4].duration); fprintf(out, "\t</StreamIndex>\n"); } if (VAR_0->audio_file >= 0) { struct VideoFile *VAR_8 = VAR_0->VAR_0[VAR_0->audio_file]; int VAR_8 = 0; fprintf(out, "\t<StreamIndex Type=\"audio\" QualityLevels=\"%d\" " "Chunks=\"%d\" " "Url=\"QualityLevels({bitrate})/Fragments(audio={start time})\">\n", VAR_0->nb_audio_files, VAR_8->chunks); for (VAR_4 = 0; VAR_4 < VAR_0->nb_files; VAR_4++) { VAR_8 = VAR_0->VAR_0[VAR_4]; if (!VAR_8->is_audio) continue; fprintf(out, "\t\t<QualityLevel Index=\"%d\" Bitrate=\"%d\" " "FourCC=\"%s\" SamplingRate=\"%d\" Channels=\"%d\" " "BitsPerSample=\"16\" PacketSize=\"%d\" " "AudioTag=\"%d\" CodecPrivateData=\"", VAR_8, VAR_8->bitrate, VAR_8->fourcc, VAR_8->sample_rate, VAR_8->channels, VAR_8->blocksize, VAR_8->tag); for (VAR_5 = 0; VAR_5 < VAR_8->codec_private_size; VAR_5++) fprintf(out, "%02X", VAR_8->codec_private[VAR_5]); fprintf(out, "\" />\n"); VAR_8++; } VAR_8 = VAR_0->VAR_0[VAR_0->audio_file]; for (VAR_4 = 0; VAR_4 < VAR_8->chunks; VAR_4++) fprintf(out, "\t\t<c n=\"%d\" d=\"%d\" />\n", VAR_4, VAR_8->offsets[VAR_4].duration); fprintf(out, "\t</StreamIndex>\n"); } fprintf(out, "</SmoothStreamingMedia>\n"); fclose(out); }
[ "static void FUNC_0(struct VideoFiles *VAR_0,\nconst char *VAR_1, int VAR_2)\n{", "char VAR_3[1000];", "FILE *out;", "int VAR_4, VAR_5;", "if (VAR_2)\nsnprintf(VAR_3, sizeof(VAR_3), \"Manifest\");", "else\nsnprintf(VAR_3, sizeof(VAR_3), \"%s.ismc\", VAR_1);", "out = fopen(VAR_3, \"w\");", "if (!out) {", "perror(VAR_3);", "return;", "}", "fprintf(out, \"<?xml version=\\\"1.0\\\" encoding=\\\"utf-8\\\"?>\\n\");", "fprintf(out, \"<SmoothStreamingMedia MajorVersion=\\\"2\\\" MinorVersion=\\\"0\\\" \"\n\"Duration=\\\"%\"PRId64 \"\\\">\\n\", VAR_0->duration * 10);", "if (VAR_0->video_file >= 0) {", "struct VideoFile *VAR_8 = VAR_0->VAR_0[VAR_0->video_file];", "int VAR_8 = 0;", "fprintf(out,\n\"\\t<StreamIndex Type=\\\"video\\\" QualityLevels=\\\"%d\\\" \"\n\"Chunks=\\\"%d\\\" \"\n\"Url=\\\"QualityLevels({bitrate})/Fragments(video={start time})\\\">\\n\",", "VAR_0->nb_video_files, VAR_8->chunks);", "for (VAR_4 = 0; VAR_4 < VAR_0->nb_files; VAR_4++) {", "VAR_8 = VAR_0->VAR_0[VAR_4];", "if (!VAR_8->is_video)\ncontinue;", "fprintf(out,\n\"\\t\\t<QualityLevel Index=\\\"%d\\\" Bitrate=\\\"%d\\\" \"\n\"FourCC=\\\"%s\\\" MaxWidth=\\\"%d\\\" MaxHeight=\\\"%d\\\" \"\n\"CodecPrivateData=\\\"\",\nVAR_8, VAR_8->bitrate, VAR_8->fourcc, VAR_8->width, VAR_8->height);", "for (VAR_5 = 0; VAR_5 < VAR_8->codec_private_size; VAR_5++)", "fprintf(out, \"%02X\", VAR_8->codec_private[VAR_5]);", "fprintf(out, \"\\\" />\\n\");", "VAR_8++;", "}", "VAR_8 = VAR_0->VAR_0[VAR_0->video_file];", "for (VAR_4 = 0; VAR_4 < VAR_8->chunks; VAR_4++)", "fprintf(out, \"\\t\\t<c n=\\\"%d\\\" d=\\\"%d\\\" />\\n\", VAR_4,\nVAR_8->offsets[VAR_4].duration);", "fprintf(out, \"\\t</StreamIndex>\\n\");", "}", "if (VAR_0->audio_file >= 0) {", "struct VideoFile *VAR_8 = VAR_0->VAR_0[VAR_0->audio_file];", "int VAR_8 = 0;", "fprintf(out,\n\"\\t<StreamIndex Type=\\\"audio\\\" QualityLevels=\\\"%d\\\" \"\n\"Chunks=\\\"%d\\\" \"\n\"Url=\\\"QualityLevels({bitrate})/Fragments(audio={start time})\\\">\\n\",", "VAR_0->nb_audio_files, VAR_8->chunks);", "for (VAR_4 = 0; VAR_4 < VAR_0->nb_files; VAR_4++) {", "VAR_8 = VAR_0->VAR_0[VAR_4];", "if (!VAR_8->is_audio)\ncontinue;", "fprintf(out,\n\"\\t\\t<QualityLevel Index=\\\"%d\\\" Bitrate=\\\"%d\\\" \"\n\"FourCC=\\\"%s\\\" SamplingRate=\\\"%d\\\" Channels=\\\"%d\\\" \"\n\"BitsPerSample=\\\"16\\\" PacketSize=\\\"%d\\\" \"\n\"AudioTag=\\\"%d\\\" CodecPrivateData=\\\"\",\nVAR_8, VAR_8->bitrate, VAR_8->fourcc, VAR_8->sample_rate,\nVAR_8->channels, VAR_8->blocksize, VAR_8->tag);", "for (VAR_5 = 0; VAR_5 < VAR_8->codec_private_size; VAR_5++)", "fprintf(out, \"%02X\", VAR_8->codec_private[VAR_5]);", "fprintf(out, \"\\\" />\\n\");", "VAR_8++;", "}", "VAR_8 = VAR_0->VAR_0[VAR_0->audio_file];", "for (VAR_4 = 0; VAR_4 < VAR_8->chunks; VAR_4++)", "fprintf(out, \"\\t\\t<c n=\\\"%d\\\" d=\\\"%d\\\" />\\n\",\nVAR_4, VAR_8->offsets[VAR_4].duration);", "fprintf(out, \"\\t</StreamIndex>\\n\");", "}", "fprintf(out, \"</SmoothStreamingMedia>\\n\");", "fclose(out);", "}" ]
[ 0, 0, 0, 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, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15, 17 ], [ 19, 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35, 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45, 47, 49, 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59, 61 ], [ 63, 65, 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 ] ]