id
int32
0
27.3k
func
stringlengths
26
142k
target
bool
2 classes
project
stringclasses
2 values
commit_id
stringlengths
40
40
func_clean
stringlengths
26
131k
vul_lines
dict
normalized_func
stringlengths
24
132k
lines
listlengths
1
2.8k
label
listlengths
1
2.8k
line_no
listlengths
1
2.8k
7,335
CPUPPCState *cpu_ppc_init(void) { CPUPPCState *env; cpu_exec_init(); env = qemu_mallocz(sizeof(CPUPPCState)); if (!env) return NULL; #if !defined(CONFIG_USER_ONLY) && defined (USE_OPEN_FIRMWARE) setup_machine(env, 0); #else // env->spr[PVR] = 0; /* Basic PPC */ env->spr[PVR] = 0x00080100; /* G3 CPU */ // env->spr[PVR] = 0x00083100; /* MPC755 (G3 embedded) */ // env->spr[PVR] = 0x00070100; /* IBM 750FX */ #endif tlb_flush(env, 1); #if defined (DO_SINGLE_STEP) /* Single step trace mode */ msr_se = 1; #endif msr_fp = 1; /* Allow floating point exceptions */ msr_me = 1; /* Allow machine check exceptions */ #if defined(CONFIG_USER_ONLY) msr_pr = 1; cpu_ppc_register(env, 0x00080000); #else env->nip = 0xFFFFFFFC; #endif env->access_type = ACCESS_INT; cpu_single_env = env; return env; }
false
qemu
b769d8fef6c06ddb39ef0337882a4f8872b9c2bc
CPUPPCState *cpu_ppc_init(void) { CPUPPCState *env; cpu_exec_init(); env = qemu_mallocz(sizeof(CPUPPCState)); if (!env) return NULL; #if !defined(CONFIG_USER_ONLY) && defined (USE_OPEN_FIRMWARE) setup_machine(env, 0); #else env->spr[PVR] = 0x00080100; #endif tlb_flush(env, 1); #if defined (DO_SINGLE_STEP) msr_se = 1; #endif msr_fp = 1; msr_me = 1; #if defined(CONFIG_USER_ONLY) msr_pr = 1; cpu_ppc_register(env, 0x00080000); #else env->nip = 0xFFFFFFFC; #endif env->access_type = ACCESS_INT; cpu_single_env = env; return env; }
{ "code": [], "line_no": [] }
CPUPPCState *FUNC_0(void) { CPUPPCState *env; cpu_exec_init(); env = qemu_mallocz(sizeof(CPUPPCState)); if (!env) return NULL; #if !defined(CONFIG_USER_ONLY) && defined (USE_OPEN_FIRMWARE) setup_machine(env, 0); #else env->spr[PVR] = 0x00080100; #endif tlb_flush(env, 1); #if defined (DO_SINGLE_STEP) msr_se = 1; #endif msr_fp = 1; msr_me = 1; #if defined(CONFIG_USER_ONLY) msr_pr = 1; cpu_ppc_register(env, 0x00080000); #else env->nip = 0xFFFFFFFC; #endif env->access_type = ACCESS_INT; cpu_single_env = env; return env; }
[ "CPUPPCState *FUNC_0(void)\n{", "CPUPPCState *env;", "cpu_exec_init();", "env = qemu_mallocz(sizeof(CPUPPCState));", "if (!env)\nreturn NULL;", "#if !defined(CONFIG_USER_ONLY) && defined (USE_OPEN_FIRMWARE)\nsetup_machine(env, 0);", "#else\nenv->spr[PVR] = 0x00080100;", "#endif\ntlb_flush(env, 1);", "#if defined (DO_SINGLE_STEP)\nmsr_se = 1;", "#endif\nmsr_fp = 1;", "msr_me = 1;", "#if defined(CONFIG_USER_ONLY)\nmsr_pr = 1;", "cpu_ppc_register(env, 0x00080000);", "#else\nenv->nip = 0xFFFFFFFC;", "#endif\nenv->access_type = ACCESS_INT;", "cpu_single_env = env;", "return env;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 13 ], [ 15, 17 ], [ 19, 21 ], [ 23, 27 ], [ 33, 35 ], [ 37, 41 ], [ 43, 45 ], [ 47 ], [ 49, 51 ], [ 53 ], [ 55, 57 ], [ 59, 61 ], [ 63 ], [ 65 ], [ 67 ] ]
7,336
static void vmxnet3_net_init(VMXNET3State *s) { DeviceState *d = DEVICE(s); VMW_CBPRN("vmxnet3_net_init called..."); qemu_macaddr_default_if_unset(&s->conf.macaddr); /* Windows guest will query the address that was set on init */ memcpy(&s->perm_mac.a, &s->conf.macaddr.a, sizeof(s->perm_mac.a)); s->mcast_list = NULL; s->mcast_list_len = 0; s->link_status_and_speed = VMXNET3_LINK_SPEED | VMXNET3_LINK_STATUS_UP; VMW_CFPRN("Permanent MAC: " MAC_FMT, MAC_ARG(s->perm_mac.a)); s->nic = qemu_new_nic(&net_vmxnet3_info, &s->conf, object_get_typename(OBJECT(s)), d->id, s); s->peer_has_vhdr = vmxnet3_peer_has_vnet_hdr(s); s->tx_sop = true; s->skip_current_tx_pkt = false; s->tx_pkt = NULL; s->rx_pkt = NULL; s->rx_vlan_stripping = false; s->lro_supported = false; if (s->peer_has_vhdr) { qemu_peer_set_vnet_hdr_len(qemu_get_queue(s->nic), sizeof(struct virtio_net_hdr)); qemu_peer_using_vnet_hdr(qemu_get_queue(s->nic), 1); } qemu_format_nic_info_str(qemu_get_queue(s->nic), s->conf.macaddr.a); }
false
qemu
d6085e3ace20bc9b0fa625d8d79b22668710e217
static void vmxnet3_net_init(VMXNET3State *s) { DeviceState *d = DEVICE(s); VMW_CBPRN("vmxnet3_net_init called..."); qemu_macaddr_default_if_unset(&s->conf.macaddr); memcpy(&s->perm_mac.a, &s->conf.macaddr.a, sizeof(s->perm_mac.a)); s->mcast_list = NULL; s->mcast_list_len = 0; s->link_status_and_speed = VMXNET3_LINK_SPEED | VMXNET3_LINK_STATUS_UP; VMW_CFPRN("Permanent MAC: " MAC_FMT, MAC_ARG(s->perm_mac.a)); s->nic = qemu_new_nic(&net_vmxnet3_info, &s->conf, object_get_typename(OBJECT(s)), d->id, s); s->peer_has_vhdr = vmxnet3_peer_has_vnet_hdr(s); s->tx_sop = true; s->skip_current_tx_pkt = false; s->tx_pkt = NULL; s->rx_pkt = NULL; s->rx_vlan_stripping = false; s->lro_supported = false; if (s->peer_has_vhdr) { qemu_peer_set_vnet_hdr_len(qemu_get_queue(s->nic), sizeof(struct virtio_net_hdr)); qemu_peer_using_vnet_hdr(qemu_get_queue(s->nic), 1); } qemu_format_nic_info_str(qemu_get_queue(s->nic), s->conf.macaddr.a); }
{ "code": [], "line_no": [] }
static void FUNC_0(VMXNET3State *VAR_0) { DeviceState *d = DEVICE(VAR_0); VMW_CBPRN("FUNC_0 called..."); qemu_macaddr_default_if_unset(&VAR_0->conf.macaddr); memcpy(&VAR_0->perm_mac.a, &VAR_0->conf.macaddr.a, sizeof(VAR_0->perm_mac.a)); VAR_0->mcast_list = NULL; VAR_0->mcast_list_len = 0; VAR_0->link_status_and_speed = VMXNET3_LINK_SPEED | VMXNET3_LINK_STATUS_UP; VMW_CFPRN("Permanent MAC: " MAC_FMT, MAC_ARG(VAR_0->perm_mac.a)); VAR_0->nic = qemu_new_nic(&net_vmxnet3_info, &VAR_0->conf, object_get_typename(OBJECT(VAR_0)), d->id, VAR_0); VAR_0->peer_has_vhdr = vmxnet3_peer_has_vnet_hdr(VAR_0); VAR_0->tx_sop = true; VAR_0->skip_current_tx_pkt = false; VAR_0->tx_pkt = NULL; VAR_0->rx_pkt = NULL; VAR_0->rx_vlan_stripping = false; VAR_0->lro_supported = false; if (VAR_0->peer_has_vhdr) { qemu_peer_set_vnet_hdr_len(qemu_get_queue(VAR_0->nic), sizeof(struct virtio_net_hdr)); qemu_peer_using_vnet_hdr(qemu_get_queue(VAR_0->nic), 1); } qemu_format_nic_info_str(qemu_get_queue(VAR_0->nic), VAR_0->conf.macaddr.a); }
[ "static void FUNC_0(VMXNET3State *VAR_0)\n{", "DeviceState *d = DEVICE(VAR_0);", "VMW_CBPRN(\"FUNC_0 called...\");", "qemu_macaddr_default_if_unset(&VAR_0->conf.macaddr);", "memcpy(&VAR_0->perm_mac.a, &VAR_0->conf.macaddr.a, sizeof(VAR_0->perm_mac.a));", "VAR_0->mcast_list = NULL;", "VAR_0->mcast_list_len = 0;", "VAR_0->link_status_and_speed = VMXNET3_LINK_SPEED | VMXNET3_LINK_STATUS_UP;", "VMW_CFPRN(\"Permanent MAC: \" MAC_FMT, MAC_ARG(VAR_0->perm_mac.a));", "VAR_0->nic = qemu_new_nic(&net_vmxnet3_info, &VAR_0->conf,\nobject_get_typename(OBJECT(VAR_0)),\nd->id, VAR_0);", "VAR_0->peer_has_vhdr = vmxnet3_peer_has_vnet_hdr(VAR_0);", "VAR_0->tx_sop = true;", "VAR_0->skip_current_tx_pkt = false;", "VAR_0->tx_pkt = NULL;", "VAR_0->rx_pkt = NULL;", "VAR_0->rx_vlan_stripping = false;", "VAR_0->lro_supported = false;", "if (VAR_0->peer_has_vhdr) {", "qemu_peer_set_vnet_hdr_len(qemu_get_queue(VAR_0->nic),\nsizeof(struct virtio_net_hdr));", "qemu_peer_using_vnet_hdr(qemu_get_queue(VAR_0->nic), 1);", "}", "qemu_format_nic_info_str(qemu_get_queue(VAR_0->nic), VAR_0->conf.macaddr.a);", "}" ]
[ 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 ], [ 19 ], [ 23 ], [ 25 ], [ 29 ], [ 33 ], [ 37, 39, 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63, 65 ], [ 69 ], [ 71 ], [ 75 ], [ 77 ] ]
7,337
static hwaddr ppc_hash32_htab_lookup(PowerPCCPU *cpu, target_ulong sr, target_ulong eaddr, ppc_hash_pte32_t *pte) { CPUPPCState *env = &cpu->env; hwaddr pteg_off, pte_offset; hwaddr hash; uint32_t vsid, pgidx, ptem; vsid = sr & SR32_VSID; pgidx = (eaddr & ~SEGMENT_MASK_256M) >> TARGET_PAGE_BITS; hash = vsid ^ pgidx; ptem = (vsid << 7) | (pgidx >> 10); /* Page address translation */ qemu_log_mask(CPU_LOG_MMU, "htab_base " TARGET_FMT_plx " htab_mask " TARGET_FMT_plx " hash " TARGET_FMT_plx "\n", env->htab_base, env->htab_mask, hash); /* Primary PTEG lookup */ qemu_log_mask(CPU_LOG_MMU, "0 htab=" TARGET_FMT_plx "/" TARGET_FMT_plx " vsid=%" PRIx32 " ptem=%" PRIx32 " hash=" TARGET_FMT_plx "\n", env->htab_base, env->htab_mask, vsid, ptem, hash); pteg_off = get_pteg_offset32(cpu, hash); pte_offset = ppc_hash32_pteg_search(cpu, pteg_off, 0, ptem, pte); if (pte_offset == -1) { /* Secondary PTEG lookup */ qemu_log_mask(CPU_LOG_MMU, "1 htab=" TARGET_FMT_plx "/" TARGET_FMT_plx " vsid=%" PRIx32 " api=%" PRIx32 " hash=" TARGET_FMT_plx "\n", env->htab_base, env->htab_mask, vsid, ptem, ~hash); pteg_off = get_pteg_offset32(cpu, ~hash); pte_offset = ppc_hash32_pteg_search(cpu, pteg_off, 1, ptem, pte); } return pte_offset; }
false
qemu
36778660d7fd0748a6129916e47ecedd67bdb758
static hwaddr ppc_hash32_htab_lookup(PowerPCCPU *cpu, target_ulong sr, target_ulong eaddr, ppc_hash_pte32_t *pte) { CPUPPCState *env = &cpu->env; hwaddr pteg_off, pte_offset; hwaddr hash; uint32_t vsid, pgidx, ptem; vsid = sr & SR32_VSID; pgidx = (eaddr & ~SEGMENT_MASK_256M) >> TARGET_PAGE_BITS; hash = vsid ^ pgidx; ptem = (vsid << 7) | (pgidx >> 10); qemu_log_mask(CPU_LOG_MMU, "htab_base " TARGET_FMT_plx " htab_mask " TARGET_FMT_plx " hash " TARGET_FMT_plx "\n", env->htab_base, env->htab_mask, hash); qemu_log_mask(CPU_LOG_MMU, "0 htab=" TARGET_FMT_plx "/" TARGET_FMT_plx " vsid=%" PRIx32 " ptem=%" PRIx32 " hash=" TARGET_FMT_plx "\n", env->htab_base, env->htab_mask, vsid, ptem, hash); pteg_off = get_pteg_offset32(cpu, hash); pte_offset = ppc_hash32_pteg_search(cpu, pteg_off, 0, ptem, pte); if (pte_offset == -1) { qemu_log_mask(CPU_LOG_MMU, "1 htab=" TARGET_FMT_plx "/" TARGET_FMT_plx " vsid=%" PRIx32 " api=%" PRIx32 " hash=" TARGET_FMT_plx "\n", env->htab_base, env->htab_mask, vsid, ptem, ~hash); pteg_off = get_pteg_offset32(cpu, ~hash); pte_offset = ppc_hash32_pteg_search(cpu, pteg_off, 1, ptem, pte); } return pte_offset; }
{ "code": [], "line_no": [] }
static hwaddr FUNC_0(PowerPCCPU *cpu, target_ulong sr, target_ulong eaddr, ppc_hash_pte32_t *pte) { CPUPPCState *env = &cpu->env; hwaddr pteg_off, pte_offset; hwaddr hash; uint32_t vsid, pgidx, ptem; vsid = sr & SR32_VSID; pgidx = (eaddr & ~SEGMENT_MASK_256M) >> TARGET_PAGE_BITS; hash = vsid ^ pgidx; ptem = (vsid << 7) | (pgidx >> 10); qemu_log_mask(CPU_LOG_MMU, "htab_base " TARGET_FMT_plx " htab_mask " TARGET_FMT_plx " hash " TARGET_FMT_plx "\n", env->htab_base, env->htab_mask, hash); qemu_log_mask(CPU_LOG_MMU, "0 htab=" TARGET_FMT_plx "/" TARGET_FMT_plx " vsid=%" PRIx32 " ptem=%" PRIx32 " hash=" TARGET_FMT_plx "\n", env->htab_base, env->htab_mask, vsid, ptem, hash); pteg_off = get_pteg_offset32(cpu, hash); pte_offset = ppc_hash32_pteg_search(cpu, pteg_off, 0, ptem, pte); if (pte_offset == -1) { qemu_log_mask(CPU_LOG_MMU, "1 htab=" TARGET_FMT_plx "/" TARGET_FMT_plx " vsid=%" PRIx32 " api=%" PRIx32 " hash=" TARGET_FMT_plx "\n", env->htab_base, env->htab_mask, vsid, ptem, ~hash); pteg_off = get_pteg_offset32(cpu, ~hash); pte_offset = ppc_hash32_pteg_search(cpu, pteg_off, 1, ptem, pte); } return pte_offset; }
[ "static hwaddr FUNC_0(PowerPCCPU *cpu,\ntarget_ulong sr, target_ulong eaddr,\nppc_hash_pte32_t *pte)\n{", "CPUPPCState *env = &cpu->env;", "hwaddr pteg_off, pte_offset;", "hwaddr hash;", "uint32_t vsid, pgidx, ptem;", "vsid = sr & SR32_VSID;", "pgidx = (eaddr & ~SEGMENT_MASK_256M) >> TARGET_PAGE_BITS;", "hash = vsid ^ pgidx;", "ptem = (vsid << 7) | (pgidx >> 10);", "qemu_log_mask(CPU_LOG_MMU, \"htab_base \" TARGET_FMT_plx\n\" htab_mask \" TARGET_FMT_plx\n\" hash \" TARGET_FMT_plx \"\\n\",\nenv->htab_base, env->htab_mask, hash);", "qemu_log_mask(CPU_LOG_MMU, \"0 htab=\" TARGET_FMT_plx \"/\" TARGET_FMT_plx\n\" vsid=%\" PRIx32 \" ptem=%\" PRIx32\n\" hash=\" TARGET_FMT_plx \"\\n\",\nenv->htab_base, env->htab_mask, vsid, ptem, hash);", "pteg_off = get_pteg_offset32(cpu, hash);", "pte_offset = ppc_hash32_pteg_search(cpu, pteg_off, 0, ptem, pte);", "if (pte_offset == -1) {", "qemu_log_mask(CPU_LOG_MMU, \"1 htab=\" TARGET_FMT_plx \"/\" TARGET_FMT_plx\n\" vsid=%\" PRIx32 \" api=%\" PRIx32\n\" hash=\" TARGET_FMT_plx \"\\n\", env->htab_base,\nenv->htab_mask, vsid, ptem, ~hash);", "pteg_off = get_pteg_offset32(cpu, ~hash);", "pte_offset = ppc_hash32_pteg_search(cpu, pteg_off, 1, ptem, pte);", "}", "return pte_offset;", "}" ]
[ 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 ], [ 31, 33, 35, 37 ], [ 43, 45, 47, 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59, 61, 63, 65 ], [ 67 ], [ 69 ], [ 71 ], [ 75 ], [ 77 ] ]
7,338
int av_expr_parse(AVExpr **expr, const char *s, const char * const *const_names, const char * const *func1_names, double (* const *funcs1)(void *, double), const char * const *func2_names, double (* const *funcs2)(void *, double, double), int log_offset, void *log_ctx) { Parser p = { 0 }; AVExpr *e = NULL; char *w = av_malloc(strlen(s) + 1); char *wp = w; const char *s0 = s; int ret = 0; if (!w) return AVERROR(ENOMEM); while (*s) if (!av_isspace(*s++)) *wp++ = s[-1]; *wp++ = 0; p.class = &eval_class; p.stack_index=100; p.s= w; p.const_names = const_names; p.funcs1 = funcs1; p.func1_names = func1_names; p.funcs2 = funcs2; p.func2_names = func2_names; p.log_offset = log_offset; p.log_ctx = log_ctx; if ((ret = parse_expr(&e, &p)) < 0) if (*p.s) { av_log(&p, AV_LOG_ERROR, "Invalid chars '%s' at the end of expression '%s'\n", p.s, s0); ret = AVERROR(EINVAL); if (!verify_expr(e)) { ret = AVERROR(EINVAL); e->var= av_mallocz(sizeof(double) *VARS); *expr = e; e = NULL; end: av_expr_free(e); av_free(w); return ret;
true
FFmpeg
c49e7924a8b537f2cda0da8627641fb97528fc11
int av_expr_parse(AVExpr **expr, const char *s, const char * const *const_names, const char * const *func1_names, double (* const *funcs1)(void *, double), const char * const *func2_names, double (* const *funcs2)(void *, double, double), int log_offset, void *log_ctx) { Parser p = { 0 }; AVExpr *e = NULL; char *w = av_malloc(strlen(s) + 1); char *wp = w; const char *s0 = s; int ret = 0; if (!w) return AVERROR(ENOMEM); while (*s) if (!av_isspace(*s++)) *wp++ = s[-1]; *wp++ = 0; p.class = &eval_class; p.stack_index=100; p.s= w; p.const_names = const_names; p.funcs1 = funcs1; p.func1_names = func1_names; p.funcs2 = funcs2; p.func2_names = func2_names; p.log_offset = log_offset; p.log_ctx = log_ctx; if ((ret = parse_expr(&e, &p)) < 0) if (*p.s) { av_log(&p, AV_LOG_ERROR, "Invalid chars '%s' at the end of expression '%s'\n", p.s, s0); ret = AVERROR(EINVAL); if (!verify_expr(e)) { ret = AVERROR(EINVAL); e->var= av_mallocz(sizeof(double) *VARS); *expr = e; e = NULL; end: av_expr_free(e); av_free(w); return ret;
{ "code": [], "line_no": [] }
VAR_8intVAR_8 VAR_8av_expr_parseVAR_8(VAR_8AVExprVAR_8 **VAR_8VAR_0VAR_8, VAR_8constVAR_8 VAR_8charVAR_8 *VAR_8VAR_1VAR_8, VAR_8constVAR_8 VAR_8charVAR_8 * VAR_8constVAR_8 *VAR_8VAR_2VAR_8, VAR_8constVAR_8 VAR_8charVAR_8 * VAR_8constVAR_8 *VAR_8VAR_3VAR_8, VAR_8doubleVAR_8 (* VAR_8constVAR_8 *VAR_8VAR_4VAR_8)(VAR_8voidVAR_8 *, VAR_8doubleVAR_8), VAR_8constVAR_8 VAR_8charVAR_8 * VAR_8constVAR_8 *VAR_8func2_namesVAR_8, VAR_8doubleVAR_8 (* VAR_8constVAR_8 *VAR_8funcs2VAR_8)(VAR_8voidVAR_8 *, VAR_8doubleVAR_8, VAR_8doubleVAR_8), VAR_8intVAR_8 VAR_8log_offsetVAR_8, VAR_8voidVAR_8 *VAR_8log_ctxVAR_8) { VAR_8ParserVAR_8 VAR_8pVAR_8 = { VAR_80VAR_8 }; VAR_8AVExprVAR_8 *VAR_8eVAR_8 = VAR_8NULLVAR_8; VAR_8charVAR_8 *VAR_8wVAR_8 = VAR_8av_mallocVAR_8(VAR_8strlenVAR_8(VAR_8VAR_1VAR_8) + VAR_81VAR_8); VAR_8charVAR_8 *VAR_8wpVAR_8 = VAR_8wVAR_8; VAR_8constVAR_8 VAR_8charVAR_8 *VAR_8s0VAR_8 = VAR_8VAR_1VAR_8; VAR_8intVAR_8 VAR_8retVAR_8 = VAR_80VAR_8; VAR_8ifVAR_8 (!VAR_8wVAR_8) VAR_8returnVAR_8 VAR_8AVERRORVAR_8(VAR_8ENOMEMVAR_8); VAR_8whileVAR_8 (*VAR_8VAR_1VAR_8) VAR_8ifVAR_8 (!VAR_8av_isspaceVAR_8(*VAR_8VAR_1VAR_8++)) *VAR_8wpVAR_8++ = VAR_8VAR_1VAR_8[-VAR_81VAR_8]; *VAR_8wpVAR_8++ = VAR_80VAR_8; VAR_8pVAR_8.VAR_8classVAR_8 = &VAR_8eval_classVAR_8; VAR_8pVAR_8.VAR_8stack_indexVAR_8=VAR_8100VAR_8; VAR_8pVAR_8.VAR_8VAR_1VAR_8= VAR_8wVAR_8; VAR_8pVAR_8.VAR_8VAR_2VAR_8 = VAR_8VAR_2VAR_8; VAR_8pVAR_8.VAR_8VAR_4VAR_8 = VAR_8VAR_4VAR_8; VAR_8pVAR_8.VAR_8VAR_3VAR_8 = VAR_8VAR_3VAR_8; VAR_8pVAR_8.VAR_8funcs2VAR_8 = VAR_8funcs2VAR_8; VAR_8pVAR_8.VAR_8func2_namesVAR_8 = VAR_8func2_namesVAR_8; VAR_8pVAR_8.VAR_8log_offsetVAR_8 = VAR_8log_offsetVAR_8; VAR_8pVAR_8.VAR_8log_ctxVAR_8 = VAR_8log_ctxVAR_8; VAR_8ifVAR_8 ((VAR_8retVAR_8 = VAR_8parse_exprVAR_8(&VAR_8eVAR_8, &VAR_8pVAR_8)) < VAR_80VAR_8) VAR_8ifVAR_8 (*VAR_8pVAR_8.VAR_8VAR_1VAR_8) { VAR_8av_logVAR_8(&VAR_8pVAR_8, VAR_8AV_LOG_ERRORVAR_8, "VAR_8InvalidVAR_8 VAR_8charsVAR_8 '%VAR_8VAR_1VAR_8' VAR_8atVAR_8 VAR_8theVAR_8 VAR_8endVAR_8 VAR_8ofVAR_8 VAR_8expressionVAR_8 '%VAR_8VAR_1VAR_8'\VAR_8nVAR_8", VAR_8pVAR_8.VAR_8VAR_1VAR_8, VAR_8s0VAR_8); VAR_8retVAR_8 = VAR_8AVERRORVAR_8(VAR_8EINVALVAR_8); VAR_8ifVAR_8 (!VAR_8verify_exprVAR_8(VAR_8eVAR_8)) { VAR_8retVAR_8 = VAR_8AVERRORVAR_8(VAR_8EINVALVAR_8); VAR_8eVAR_8->VAR_8varVAR_8= VAR_8av_malloczVAR_8(VAR_8sizeofVAR_8(VAR_8doubleVAR_8) *VAR_8VARSVAR_8); *VAR_8VAR_0VAR_8 = VAR_8eVAR_8; VAR_8eVAR_8 = VAR_8NULLVAR_8; VAR_8endVAR_8: VAR_8av_expr_freeVAR_8(VAR_8eVAR_8); VAR_8av_freeVAR_8(VAR_8wVAR_8); VAR_8returnVAR_8 VAR_8retVAR_8;
[ "VAR_8intVAR_8 VAR_8av_expr_parseVAR_8(VAR_8AVExprVAR_8 **VAR_8VAR_0VAR_8, VAR_8constVAR_8 VAR_8charVAR_8 *VAR_8VAR_1VAR_8,\nVAR_8constVAR_8 VAR_8charVAR_8 * VAR_8constVAR_8 *VAR_8VAR_2VAR_8,\nVAR_8constVAR_8 VAR_8charVAR_8 * VAR_8constVAR_8 *VAR_8VAR_3VAR_8, VAR_8doubleVAR_8 (* VAR_8constVAR_8 *VAR_8VAR_4VAR_8)(VAR_8voidVAR_8 *, VAR_8doubleVAR_8),\nVAR_8constVAR_8 VAR_8charVAR_8 * VAR_8constVAR_8 *VAR_8func2_namesVAR_8, VAR_8doubleVAR_8 (* VAR_8constVAR_8 *VAR_8funcs2VAR_8)(VAR_8voidVAR_8 *, VAR_8doubleVAR_8, VAR_8doubleVAR_8),\nVAR_8intVAR_8 VAR_8log_offsetVAR_8, VAR_8voidVAR_8 *VAR_8log_ctxVAR_8)\n{", "VAR_8ParserVAR_8 VAR_8pVAR_8 = { VAR_80VAR_8 };", "VAR_8AVExprVAR_8 *VAR_8eVAR_8 = VAR_8NULLVAR_8;", "VAR_8charVAR_8 *VAR_8wVAR_8 = VAR_8av_mallocVAR_8(VAR_8strlenVAR_8(VAR_8VAR_1VAR_8) + VAR_81VAR_8);", "VAR_8charVAR_8 *VAR_8wpVAR_8 = VAR_8wVAR_8;", "VAR_8constVAR_8 VAR_8charVAR_8 *VAR_8s0VAR_8 = VAR_8VAR_1VAR_8;", "VAR_8intVAR_8 VAR_8retVAR_8 = VAR_80VAR_8;", "VAR_8ifVAR_8 (!VAR_8wVAR_8)\nVAR_8returnVAR_8 VAR_8AVERRORVAR_8(VAR_8ENOMEMVAR_8);", "VAR_8whileVAR_8 (*VAR_8VAR_1VAR_8)\nVAR_8ifVAR_8 (!VAR_8av_isspaceVAR_8(*VAR_8VAR_1VAR_8++)) *VAR_8wpVAR_8++ = VAR_8VAR_1VAR_8[-VAR_81VAR_8];", "*VAR_8wpVAR_8++ = VAR_80VAR_8;", "VAR_8pVAR_8.VAR_8classVAR_8 = &VAR_8eval_classVAR_8;", "VAR_8pVAR_8.VAR_8stack_indexVAR_8=VAR_8100VAR_8;", "VAR_8pVAR_8.VAR_8VAR_1VAR_8= VAR_8wVAR_8;", "VAR_8pVAR_8.VAR_8VAR_2VAR_8 = VAR_8VAR_2VAR_8;", "VAR_8pVAR_8.VAR_8VAR_4VAR_8 = VAR_8VAR_4VAR_8;", "VAR_8pVAR_8.VAR_8VAR_3VAR_8 = VAR_8VAR_3VAR_8;", "VAR_8pVAR_8.VAR_8funcs2VAR_8 = VAR_8funcs2VAR_8;", "VAR_8pVAR_8.VAR_8func2_namesVAR_8 = VAR_8func2_namesVAR_8;", "VAR_8pVAR_8.VAR_8log_offsetVAR_8 = VAR_8log_offsetVAR_8;", "VAR_8pVAR_8.VAR_8log_ctxVAR_8 = VAR_8log_ctxVAR_8;", "VAR_8ifVAR_8 ((VAR_8retVAR_8 = VAR_8parse_exprVAR_8(&VAR_8eVAR_8, &VAR_8pVAR_8)) < VAR_80VAR_8)\nVAR_8ifVAR_8 (*VAR_8pVAR_8.VAR_8VAR_1VAR_8) {", "VAR_8av_logVAR_8(&VAR_8pVAR_8, VAR_8AV_LOG_ERRORVAR_8, \"VAR_8InvalidVAR_8 VAR_8charsVAR_8 '%VAR_8VAR_1VAR_8' VAR_8atVAR_8 VAR_8theVAR_8 VAR_8endVAR_8 VAR_8ofVAR_8 VAR_8expressionVAR_8 '%VAR_8VAR_1VAR_8'\\VAR_8nVAR_8\", VAR_8pVAR_8.VAR_8VAR_1VAR_8, VAR_8s0VAR_8);", "VAR_8retVAR_8 = VAR_8AVERRORVAR_8(VAR_8EINVALVAR_8);", "VAR_8ifVAR_8 (!VAR_8verify_exprVAR_8(VAR_8eVAR_8)) {", "VAR_8retVAR_8 = VAR_8AVERRORVAR_8(VAR_8EINVALVAR_8);", "VAR_8eVAR_8->VAR_8varVAR_8= VAR_8av_malloczVAR_8(VAR_8sizeofVAR_8(VAR_8doubleVAR_8) *VAR_8VARSVAR_8);", "*VAR_8VAR_0VAR_8 = VAR_8eVAR_8;", "VAR_8eVAR_8 = VAR_8NULLVAR_8;", "VAR_8endVAR_8:\nVAR_8av_expr_freeVAR_8(VAR_8eVAR_8);", "VAR_8av_freeVAR_8(VAR_8wVAR_8);", "VAR_8returnVAR_8 VAR_8retVAR_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 ]
[ [ 1, 3, 5, 7, 9, 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27, 29 ], [ 33, 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63, 66 ], [ 68 ], [ 70 ], [ 74 ], [ 76 ], [ 80 ], [ 86 ], [ 88 ], [ 90, 92 ], [ 94 ], [ 96 ] ]
7,339
void spapr_create_phb(sPAPREnvironment *spapr, const char *busname, uint64_t buid, uint64_t mem_win_addr, uint64_t mem_win_size, uint64_t io_win_addr, uint64_t msi_win_addr) { DeviceState *dev; dev = qdev_create(NULL, TYPE_SPAPR_PCI_HOST_BRIDGE); if (busname) { qdev_prop_set_string(dev, "busname", g_strdup(busname)); } qdev_prop_set_uint64(dev, "buid", buid); qdev_prop_set_uint64(dev, "mem_win_addr", mem_win_addr); qdev_prop_set_uint64(dev, "mem_win_size", mem_win_size); qdev_prop_set_uint64(dev, "io_win_addr", io_win_addr); qdev_prop_set_uint64(dev, "msi_win_addr", msi_win_addr); qdev_init_nofail(dev); }
true
qemu
caae58cba07efec5f0616f568531c9dfaf1e9179
void spapr_create_phb(sPAPREnvironment *spapr, const char *busname, uint64_t buid, uint64_t mem_win_addr, uint64_t mem_win_size, uint64_t io_win_addr, uint64_t msi_win_addr) { DeviceState *dev; dev = qdev_create(NULL, TYPE_SPAPR_PCI_HOST_BRIDGE); if (busname) { qdev_prop_set_string(dev, "busname", g_strdup(busname)); } qdev_prop_set_uint64(dev, "buid", buid); qdev_prop_set_uint64(dev, "mem_win_addr", mem_win_addr); qdev_prop_set_uint64(dev, "mem_win_size", mem_win_size); qdev_prop_set_uint64(dev, "io_win_addr", io_win_addr); qdev_prop_set_uint64(dev, "msi_win_addr", msi_win_addr); qdev_init_nofail(dev); }
{ "code": [ "void spapr_create_phb(sPAPREnvironment *spapr,", " const char *busname, uint64_t buid,", " uint64_t mem_win_addr, uint64_t mem_win_size,", " uint64_t io_win_addr, uint64_t msi_win_addr)", " if (busname) {", " qdev_prop_set_string(dev, \"busname\", g_strdup(busname));", " qdev_prop_set_uint64(dev, \"buid\", buid);", " qdev_prop_set_uint64(dev, \"mem_win_addr\", mem_win_addr);", " qdev_prop_set_uint64(dev, \"mem_win_size\", mem_win_size);", " qdev_prop_set_uint64(dev, \"io_win_addr\", io_win_addr);", " qdev_prop_set_uint64(dev, \"msi_win_addr\", msi_win_addr);", "void spapr_create_phb(sPAPREnvironment *spapr,", " const char *busname, uint64_t buid,", " uint64_t mem_win_addr, uint64_t mem_win_size," ], "line_no": [ 1, 3, 5, 7, 19, 21, 25, 27, 29, 31, 33, 1, 3, 5 ] }
void FUNC_0(sPAPREnvironment *VAR_0, const char *VAR_1, uint64_t VAR_2, uint64_t VAR_3, uint64_t VAR_4, uint64_t VAR_5, uint64_t VAR_6) { DeviceState *dev; dev = qdev_create(NULL, TYPE_SPAPR_PCI_HOST_BRIDGE); if (VAR_1) { qdev_prop_set_string(dev, "VAR_1", g_strdup(VAR_1)); } qdev_prop_set_uint64(dev, "VAR_2", VAR_2); qdev_prop_set_uint64(dev, "VAR_3", VAR_3); qdev_prop_set_uint64(dev, "VAR_4", VAR_4); qdev_prop_set_uint64(dev, "VAR_5", VAR_5); qdev_prop_set_uint64(dev, "VAR_6", VAR_6); qdev_init_nofail(dev); }
[ "void FUNC_0(sPAPREnvironment *VAR_0,\nconst char *VAR_1, uint64_t VAR_2,\nuint64_t VAR_3, uint64_t VAR_4,\nuint64_t VAR_5, uint64_t VAR_6)\n{", "DeviceState *dev;", "dev = qdev_create(NULL, TYPE_SPAPR_PCI_HOST_BRIDGE);", "if (VAR_1) {", "qdev_prop_set_string(dev, \"VAR_1\", g_strdup(VAR_1));", "}", "qdev_prop_set_uint64(dev, \"VAR_2\", VAR_2);", "qdev_prop_set_uint64(dev, \"VAR_3\", VAR_3);", "qdev_prop_set_uint64(dev, \"VAR_4\", VAR_4);", "qdev_prop_set_uint64(dev, \"VAR_5\", VAR_5);", "qdev_prop_set_uint64(dev, \"VAR_6\", VAR_6);", "qdev_init_nofail(dev);", "}" ]
[ 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ] ]
7,340
static int expand_zero_clusters_in_l1(BlockDriverState *bs, uint64_t *l1_table, int l1_size, uint8_t **expanded_clusters, uint64_t *nb_clusters) { BDRVQcowState *s = bs->opaque; bool is_active_l1 = (l1_table == s->l1_table); uint64_t *l2_table = NULL; int ret; int i, j; if (!is_active_l1) { /* inactive L2 tables require a buffer to be stored in when loading * them from disk */ l2_table = qemu_blockalign(bs, s->cluster_size); } for (i = 0; i < l1_size; i++) { uint64_t l2_offset = l1_table[i] & L1E_OFFSET_MASK; bool l2_dirty = false; if (!l2_offset) { /* unallocated */ continue; } if (is_active_l1) { /* get active L2 tables from cache */ ret = qcow2_cache_get(bs, s->l2_table_cache, l2_offset, (void **)&l2_table); } else { /* load inactive L2 tables from disk */ ret = bdrv_read(bs->file, l2_offset / BDRV_SECTOR_SIZE, (void *)l2_table, s->cluster_sectors); } if (ret < 0) { goto fail; } for (j = 0; j < s->l2_size; j++) { uint64_t l2_entry = be64_to_cpu(l2_table[j]); int64_t offset = l2_entry & L2E_OFFSET_MASK, cluster_index; int cluster_type = qcow2_get_cluster_type(l2_entry); bool preallocated = offset != 0; if (cluster_type == QCOW2_CLUSTER_NORMAL) { cluster_index = offset >> s->cluster_bits; assert((cluster_index >= 0) && (cluster_index < *nb_clusters)); if ((*expanded_clusters)[cluster_index / 8] & (1 << (cluster_index % 8))) { /* Probably a shared L2 table; this cluster was a zero * cluster which has been expanded, its refcount * therefore most likely requires an update. */ ret = qcow2_update_cluster_refcount(bs, cluster_index, 1, QCOW2_DISCARD_NEVER); if (ret < 0) { goto fail; } /* Since we just increased the refcount, the COPIED flag may * no longer be set. */ l2_table[j] = cpu_to_be64(l2_entry & ~QCOW_OFLAG_COPIED); l2_dirty = true; } continue; } else if (qcow2_get_cluster_type(l2_entry) != QCOW2_CLUSTER_ZERO) { continue; } if (!preallocated) { if (!bs->backing_hd) { /* not backed; therefore we can simply deallocate the * cluster */ l2_table[j] = 0; l2_dirty = true; continue; } offset = qcow2_alloc_clusters(bs, s->cluster_size); if (offset < 0) { ret = offset; goto fail; } } ret = qcow2_pre_write_overlap_check(bs, QCOW2_OL_DEFAULT, offset, s->cluster_size); if (ret < 0) { if (!preallocated) { qcow2_free_clusters(bs, offset, s->cluster_size, QCOW2_DISCARD_ALWAYS); } goto fail; } ret = bdrv_write_zeroes(bs->file, offset / BDRV_SECTOR_SIZE, s->cluster_sectors); if (ret < 0) { if (!preallocated) { qcow2_free_clusters(bs, offset, s->cluster_size, QCOW2_DISCARD_ALWAYS); } goto fail; } l2_table[j] = cpu_to_be64(offset | QCOW_OFLAG_COPIED); l2_dirty = true; cluster_index = offset >> s->cluster_bits; if (cluster_index >= *nb_clusters) { uint64_t old_bitmap_size = (*nb_clusters + 7) / 8; uint64_t new_bitmap_size; /* The offset may lie beyond the old end of the underlying image * file for growable files only */ assert(bs->file->growable); *nb_clusters = size_to_clusters(s, bs->file->total_sectors * BDRV_SECTOR_SIZE); new_bitmap_size = (*nb_clusters + 7) / 8; *expanded_clusters = g_realloc(*expanded_clusters, new_bitmap_size); /* clear the newly allocated space */ memset(&(*expanded_clusters)[old_bitmap_size], 0, new_bitmap_size - old_bitmap_size); } assert((cluster_index >= 0) && (cluster_index < *nb_clusters)); (*expanded_clusters)[cluster_index / 8] |= 1 << (cluster_index % 8); } if (is_active_l1) { if (l2_dirty) { qcow2_cache_entry_mark_dirty(s->l2_table_cache, l2_table); qcow2_cache_depends_on_flush(s->l2_table_cache); } ret = qcow2_cache_put(bs, s->l2_table_cache, (void **)&l2_table); if (ret < 0) { l2_table = NULL; goto fail; } } else { if (l2_dirty) { ret = qcow2_pre_write_overlap_check(bs, QCOW2_OL_DEFAULT & ~(QCOW2_OL_INACTIVE_L2 | QCOW2_OL_ACTIVE_L2), l2_offset, s->cluster_size); if (ret < 0) { goto fail; } ret = bdrv_write(bs->file, l2_offset / BDRV_SECTOR_SIZE, (void *)l2_table, s->cluster_sectors); if (ret < 0) { goto fail; } } } } ret = 0; fail: if (l2_table) { if (!is_active_l1) { qemu_vfree(l2_table); } else { if (ret < 0) { qcow2_cache_put(bs, s->l2_table_cache, (void **)&l2_table); } else { ret = qcow2_cache_put(bs, s->l2_table_cache, (void **)&l2_table); } } } return ret; }
true
qemu
231bb267644ee3a9ebfd9c7f42d5d41610194b45
static int expand_zero_clusters_in_l1(BlockDriverState *bs, uint64_t *l1_table, int l1_size, uint8_t **expanded_clusters, uint64_t *nb_clusters) { BDRVQcowState *s = bs->opaque; bool is_active_l1 = (l1_table == s->l1_table); uint64_t *l2_table = NULL; int ret; int i, j; if (!is_active_l1) { l2_table = qemu_blockalign(bs, s->cluster_size); } for (i = 0; i < l1_size; i++) { uint64_t l2_offset = l1_table[i] & L1E_OFFSET_MASK; bool l2_dirty = false; if (!l2_offset) { continue; } if (is_active_l1) { ret = qcow2_cache_get(bs, s->l2_table_cache, l2_offset, (void **)&l2_table); } else { ret = bdrv_read(bs->file, l2_offset / BDRV_SECTOR_SIZE, (void *)l2_table, s->cluster_sectors); } if (ret < 0) { goto fail; } for (j = 0; j < s->l2_size; j++) { uint64_t l2_entry = be64_to_cpu(l2_table[j]); int64_t offset = l2_entry & L2E_OFFSET_MASK, cluster_index; int cluster_type = qcow2_get_cluster_type(l2_entry); bool preallocated = offset != 0; if (cluster_type == QCOW2_CLUSTER_NORMAL) { cluster_index = offset >> s->cluster_bits; assert((cluster_index >= 0) && (cluster_index < *nb_clusters)); if ((*expanded_clusters)[cluster_index / 8] & (1 << (cluster_index % 8))) { ret = qcow2_update_cluster_refcount(bs, cluster_index, 1, QCOW2_DISCARD_NEVER); if (ret < 0) { goto fail; } l2_table[j] = cpu_to_be64(l2_entry & ~QCOW_OFLAG_COPIED); l2_dirty = true; } continue; } else if (qcow2_get_cluster_type(l2_entry) != QCOW2_CLUSTER_ZERO) { continue; } if (!preallocated) { if (!bs->backing_hd) { l2_table[j] = 0; l2_dirty = true; continue; } offset = qcow2_alloc_clusters(bs, s->cluster_size); if (offset < 0) { ret = offset; goto fail; } } ret = qcow2_pre_write_overlap_check(bs, QCOW2_OL_DEFAULT, offset, s->cluster_size); if (ret < 0) { if (!preallocated) { qcow2_free_clusters(bs, offset, s->cluster_size, QCOW2_DISCARD_ALWAYS); } goto fail; } ret = bdrv_write_zeroes(bs->file, offset / BDRV_SECTOR_SIZE, s->cluster_sectors); if (ret < 0) { if (!preallocated) { qcow2_free_clusters(bs, offset, s->cluster_size, QCOW2_DISCARD_ALWAYS); } goto fail; } l2_table[j] = cpu_to_be64(offset | QCOW_OFLAG_COPIED); l2_dirty = true; cluster_index = offset >> s->cluster_bits; if (cluster_index >= *nb_clusters) { uint64_t old_bitmap_size = (*nb_clusters + 7) / 8; uint64_t new_bitmap_size; assert(bs->file->growable); *nb_clusters = size_to_clusters(s, bs->file->total_sectors * BDRV_SECTOR_SIZE); new_bitmap_size = (*nb_clusters + 7) / 8; *expanded_clusters = g_realloc(*expanded_clusters, new_bitmap_size); memset(&(*expanded_clusters)[old_bitmap_size], 0, new_bitmap_size - old_bitmap_size); } assert((cluster_index >= 0) && (cluster_index < *nb_clusters)); (*expanded_clusters)[cluster_index / 8] |= 1 << (cluster_index % 8); } if (is_active_l1) { if (l2_dirty) { qcow2_cache_entry_mark_dirty(s->l2_table_cache, l2_table); qcow2_cache_depends_on_flush(s->l2_table_cache); } ret = qcow2_cache_put(bs, s->l2_table_cache, (void **)&l2_table); if (ret < 0) { l2_table = NULL; goto fail; } } else { if (l2_dirty) { ret = qcow2_pre_write_overlap_check(bs, QCOW2_OL_DEFAULT & ~(QCOW2_OL_INACTIVE_L2 | QCOW2_OL_ACTIVE_L2), l2_offset, s->cluster_size); if (ret < 0) { goto fail; } ret = bdrv_write(bs->file, l2_offset / BDRV_SECTOR_SIZE, (void *)l2_table, s->cluster_sectors); if (ret < 0) { goto fail; } } } } ret = 0; fail: if (l2_table) { if (!is_active_l1) { qemu_vfree(l2_table); } else { if (ret < 0) { qcow2_cache_put(bs, s->l2_table_cache, (void **)&l2_table); } else { ret = qcow2_cache_put(bs, s->l2_table_cache, (void **)&l2_table); } } } return ret; }
{ "code": [ " ret = qcow2_pre_write_overlap_check(bs, QCOW2_OL_DEFAULT,", " offset, s->cluster_size);", " ret = qcow2_pre_write_overlap_check(bs, QCOW2_OL_DEFAULT &", " ~(QCOW2_OL_INACTIVE_L2 | QCOW2_OL_ACTIVE_L2), l2_offset," ], "line_no": [ 169, 171, 283, 285 ] }
static int FUNC_0(BlockDriverState *VAR_0, uint64_t *VAR_1, int VAR_2, uint8_t **VAR_3, uint64_t *VAR_4) { BDRVQcowState *s = VAR_0->opaque; bool is_active_l1 = (VAR_1 == s->VAR_1); uint64_t *l2_table = NULL; int VAR_5; int VAR_6, VAR_7; if (!is_active_l1) { l2_table = qemu_blockalign(VAR_0, s->cluster_size); } for (VAR_6 = 0; VAR_6 < VAR_2; VAR_6++) { uint64_t l2_offset = VAR_1[VAR_6] & L1E_OFFSET_MASK; bool l2_dirty = false; if (!l2_offset) { continue; } if (is_active_l1) { VAR_5 = qcow2_cache_get(VAR_0, s->l2_table_cache, l2_offset, (void **)&l2_table); } else { VAR_5 = bdrv_read(VAR_0->file, l2_offset / BDRV_SECTOR_SIZE, (void *)l2_table, s->cluster_sectors); } if (VAR_5 < 0) { goto fail; } for (VAR_7 = 0; VAR_7 < s->l2_size; VAR_7++) { uint64_t l2_entry = be64_to_cpu(l2_table[VAR_7]); int64_t offset = l2_entry & L2E_OFFSET_MASK, cluster_index; int cluster_type = qcow2_get_cluster_type(l2_entry); bool preallocated = offset != 0; if (cluster_type == QCOW2_CLUSTER_NORMAL) { cluster_index = offset >> s->cluster_bits; assert((cluster_index >= 0) && (cluster_index < *VAR_4)); if ((*VAR_3)[cluster_index / 8] & (1 << (cluster_index % 8))) { VAR_5 = qcow2_update_cluster_refcount(VAR_0, cluster_index, 1, QCOW2_DISCARD_NEVER); if (VAR_5 < 0) { goto fail; } l2_table[VAR_7] = cpu_to_be64(l2_entry & ~QCOW_OFLAG_COPIED); l2_dirty = true; } continue; } else if (qcow2_get_cluster_type(l2_entry) != QCOW2_CLUSTER_ZERO) { continue; } if (!preallocated) { if (!VAR_0->backing_hd) { l2_table[VAR_7] = 0; l2_dirty = true; continue; } offset = qcow2_alloc_clusters(VAR_0, s->cluster_size); if (offset < 0) { VAR_5 = offset; goto fail; } } VAR_5 = qcow2_pre_write_overlap_check(VAR_0, QCOW2_OL_DEFAULT, offset, s->cluster_size); if (VAR_5 < 0) { if (!preallocated) { qcow2_free_clusters(VAR_0, offset, s->cluster_size, QCOW2_DISCARD_ALWAYS); } goto fail; } VAR_5 = bdrv_write_zeroes(VAR_0->file, offset / BDRV_SECTOR_SIZE, s->cluster_sectors); if (VAR_5 < 0) { if (!preallocated) { qcow2_free_clusters(VAR_0, offset, s->cluster_size, QCOW2_DISCARD_ALWAYS); } goto fail; } l2_table[VAR_7] = cpu_to_be64(offset | QCOW_OFLAG_COPIED); l2_dirty = true; cluster_index = offset >> s->cluster_bits; if (cluster_index >= *VAR_4) { uint64_t old_bitmap_size = (*VAR_4 + 7) / 8; uint64_t new_bitmap_size; assert(VAR_0->file->growable); *VAR_4 = size_to_clusters(s, VAR_0->file->total_sectors * BDRV_SECTOR_SIZE); new_bitmap_size = (*VAR_4 + 7) / 8; *VAR_3 = g_realloc(*VAR_3, new_bitmap_size); memset(&(*VAR_3)[old_bitmap_size], 0, new_bitmap_size - old_bitmap_size); } assert((cluster_index >= 0) && (cluster_index < *VAR_4)); (*VAR_3)[cluster_index / 8] |= 1 << (cluster_index % 8); } if (is_active_l1) { if (l2_dirty) { qcow2_cache_entry_mark_dirty(s->l2_table_cache, l2_table); qcow2_cache_depends_on_flush(s->l2_table_cache); } VAR_5 = qcow2_cache_put(VAR_0, s->l2_table_cache, (void **)&l2_table); if (VAR_5 < 0) { l2_table = NULL; goto fail; } } else { if (l2_dirty) { VAR_5 = qcow2_pre_write_overlap_check(VAR_0, QCOW2_OL_DEFAULT & ~(QCOW2_OL_INACTIVE_L2 | QCOW2_OL_ACTIVE_L2), l2_offset, s->cluster_size); if (VAR_5 < 0) { goto fail; } VAR_5 = bdrv_write(VAR_0->file, l2_offset / BDRV_SECTOR_SIZE, (void *)l2_table, s->cluster_sectors); if (VAR_5 < 0) { goto fail; } } } } VAR_5 = 0; fail: if (l2_table) { if (!is_active_l1) { qemu_vfree(l2_table); } else { if (VAR_5 < 0) { qcow2_cache_put(VAR_0, s->l2_table_cache, (void **)&l2_table); } else { VAR_5 = qcow2_cache_put(VAR_0, s->l2_table_cache, (void **)&l2_table); } } } return VAR_5; }
[ "static int FUNC_0(BlockDriverState *VAR_0, uint64_t *VAR_1,\nint VAR_2, uint8_t **VAR_3,\nuint64_t *VAR_4)\n{", "BDRVQcowState *s = VAR_0->opaque;", "bool is_active_l1 = (VAR_1 == s->VAR_1);", "uint64_t *l2_table = NULL;", "int VAR_5;", "int VAR_6, VAR_7;", "if (!is_active_l1) {", "l2_table = qemu_blockalign(VAR_0, s->cluster_size);", "}", "for (VAR_6 = 0; VAR_6 < VAR_2; VAR_6++) {", "uint64_t l2_offset = VAR_1[VAR_6] & L1E_OFFSET_MASK;", "bool l2_dirty = false;", "if (!l2_offset) {", "continue;", "}", "if (is_active_l1) {", "VAR_5 = qcow2_cache_get(VAR_0, s->l2_table_cache, l2_offset,\n(void **)&l2_table);", "} else {", "VAR_5 = bdrv_read(VAR_0->file, l2_offset / BDRV_SECTOR_SIZE,\n(void *)l2_table, s->cluster_sectors);", "}", "if (VAR_5 < 0) {", "goto fail;", "}", "for (VAR_7 = 0; VAR_7 < s->l2_size; VAR_7++) {", "uint64_t l2_entry = be64_to_cpu(l2_table[VAR_7]);", "int64_t offset = l2_entry & L2E_OFFSET_MASK, cluster_index;", "int cluster_type = qcow2_get_cluster_type(l2_entry);", "bool preallocated = offset != 0;", "if (cluster_type == QCOW2_CLUSTER_NORMAL) {", "cluster_index = offset >> s->cluster_bits;", "assert((cluster_index >= 0) && (cluster_index < *VAR_4));", "if ((*VAR_3)[cluster_index / 8] &\n(1 << (cluster_index % 8))) {", "VAR_5 = qcow2_update_cluster_refcount(VAR_0, cluster_index, 1,\nQCOW2_DISCARD_NEVER);", "if (VAR_5 < 0) {", "goto fail;", "}", "l2_table[VAR_7] = cpu_to_be64(l2_entry & ~QCOW_OFLAG_COPIED);", "l2_dirty = true;", "}", "continue;", "}", "else if (qcow2_get_cluster_type(l2_entry) != QCOW2_CLUSTER_ZERO) {", "continue;", "}", "if (!preallocated) {", "if (!VAR_0->backing_hd) {", "l2_table[VAR_7] = 0;", "l2_dirty = true;", "continue;", "}", "offset = qcow2_alloc_clusters(VAR_0, s->cluster_size);", "if (offset < 0) {", "VAR_5 = offset;", "goto fail;", "}", "}", "VAR_5 = qcow2_pre_write_overlap_check(VAR_0, QCOW2_OL_DEFAULT,\noffset, s->cluster_size);", "if (VAR_5 < 0) {", "if (!preallocated) {", "qcow2_free_clusters(VAR_0, offset, s->cluster_size,\nQCOW2_DISCARD_ALWAYS);", "}", "goto fail;", "}", "VAR_5 = bdrv_write_zeroes(VAR_0->file, offset / BDRV_SECTOR_SIZE,\ns->cluster_sectors);", "if (VAR_5 < 0) {", "if (!preallocated) {", "qcow2_free_clusters(VAR_0, offset, s->cluster_size,\nQCOW2_DISCARD_ALWAYS);", "}", "goto fail;", "}", "l2_table[VAR_7] = cpu_to_be64(offset | QCOW_OFLAG_COPIED);", "l2_dirty = true;", "cluster_index = offset >> s->cluster_bits;", "if (cluster_index >= *VAR_4) {", "uint64_t old_bitmap_size = (*VAR_4 + 7) / 8;", "uint64_t new_bitmap_size;", "assert(VAR_0->file->growable);", "*VAR_4 = size_to_clusters(s, VAR_0->file->total_sectors *\nBDRV_SECTOR_SIZE);", "new_bitmap_size = (*VAR_4 + 7) / 8;", "*VAR_3 = g_realloc(*VAR_3,\nnew_bitmap_size);", "memset(&(*VAR_3)[old_bitmap_size], 0,\nnew_bitmap_size - old_bitmap_size);", "}", "assert((cluster_index >= 0) && (cluster_index < *VAR_4));", "(*VAR_3)[cluster_index / 8] |= 1 << (cluster_index % 8);", "}", "if (is_active_l1) {", "if (l2_dirty) {", "qcow2_cache_entry_mark_dirty(s->l2_table_cache, l2_table);", "qcow2_cache_depends_on_flush(s->l2_table_cache);", "}", "VAR_5 = qcow2_cache_put(VAR_0, s->l2_table_cache, (void **)&l2_table);", "if (VAR_5 < 0) {", "l2_table = NULL;", "goto fail;", "}", "} else {", "if (l2_dirty) {", "VAR_5 = qcow2_pre_write_overlap_check(VAR_0, QCOW2_OL_DEFAULT &\n~(QCOW2_OL_INACTIVE_L2 | QCOW2_OL_ACTIVE_L2), l2_offset,\ns->cluster_size);", "if (VAR_5 < 0) {", "goto fail;", "}", "VAR_5 = bdrv_write(VAR_0->file, l2_offset / BDRV_SECTOR_SIZE,\n(void *)l2_table, s->cluster_sectors);", "if (VAR_5 < 0) {", "goto fail;", "}", "}", "}", "}", "VAR_5 = 0;", "fail:\nif (l2_table) {", "if (!is_active_l1) {", "qemu_vfree(l2_table);", "} else {", "if (VAR_5 < 0) {", "qcow2_cache_put(VAR_0, s->l2_table_cache, (void **)&l2_table);", "} else {", "VAR_5 = qcow2_cache_put(VAR_0, s->l2_table_cache,\n(void **)&l2_table);", "}", "}", "}", "return VAR_5;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 45 ], [ 47 ], [ 51 ], [ 55, 57 ], [ 59 ], [ 63, 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 89 ], [ 91 ], [ 93 ], [ 95, 97 ], [ 105, 107 ], [ 109 ], [ 111 ], [ 113 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 137 ], [ 139 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 169, 171 ], [ 173 ], [ 175 ], [ 177, 179 ], [ 181 ], [ 183 ], [ 185 ], [ 189, 191 ], [ 193 ], [ 195 ], [ 197, 199 ], [ 201 ], [ 203 ], [ 205 ], [ 209 ], [ 211 ], [ 215 ], [ 219 ], [ 221 ], [ 223 ], [ 229 ], [ 231, 233 ], [ 235 ], [ 237, 239 ], [ 243, 245 ], [ 247 ], [ 251 ], [ 253 ], [ 255 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283, 285, 287 ], [ 289 ], [ 291 ], [ 293 ], [ 297, 299 ], [ 301 ], [ 303 ], [ 305 ], [ 307 ], [ 309 ], [ 311 ], [ 315 ], [ 319, 321 ], [ 323 ], [ 325 ], [ 327 ], [ 329 ], [ 331 ], [ 333 ], [ 335, 337 ], [ 339 ], [ 341 ], [ 343 ], [ 345 ], [ 347 ] ]
7,341
static void virtio_scsi_bad_req(void) { error_report("wrong size for virtio-scsi headers"); exit(1); }
true
qemu
661e32fb3cb71c7e019daee375be4bb487b9917c
static void virtio_scsi_bad_req(void) { error_report("wrong size for virtio-scsi headers"); exit(1); }
{ "code": [ "static void virtio_scsi_bad_req(void)", " error_report(\"wrong size for virtio-scsi headers\");", " exit(1);" ], "line_no": [ 1, 5, 7 ] }
static void FUNC_0(void) { error_report("wrong size for virtio-scsi headers"); exit(1); }
[ "static void FUNC_0(void)\n{", "error_report(\"wrong size for virtio-scsi headers\");", "exit(1);", "}" ]
[ 1, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
7,342
static int h261_decode_mb(H261Context *h, DCTELEM block[6][64]) { MpegEncContext * const s = &h->s; int i, cbp, xy, old_mtype; cbp = 63; // Read mba do{ h->mba_diff = get_vlc2(&s->gb, h261_mba_vlc.table, H261_MBA_VLC_BITS, 2)+1; } while( h->mba_diff == MAX_MBA + 1 ); // stuffing if ( h->mba_diff < 0 ) return -1; h->current_mba += h->mba_diff; if ( h->current_mba > MAX_MBA ) return -1; s->mb_x= ((h->gob_number-1) % 2) * 11 + ((h->current_mba-1) % 11); s->mb_y= ((h->gob_number-1) / 2) * 3 + ((h->current_mba-1) / 11); xy = s->mb_x + s->mb_y * s->mb_stride; ff_init_block_index(s); ff_update_block_index(s); s->dsp.clear_blocks(s->block[0]); // Read mtype old_mtype = h->mtype; h->mtype = get_vlc2(&s->gb, h261_mtype_vlc.table, H261_MTYPE_VLC_BITS, 2); h->mtype = h261_mtype_map[h->mtype]; if (IS_FIL (h->mtype)) h->loop_filter = 1; // Read mquant if ( IS_QUANT ( h->mtype ) ){ ff_set_qscale(s, get_bits(&s->gb, 5)); } s->mb_intra = IS_INTRA4x4(h->mtype); // Read mv if ( IS_16X16 ( h->mtype ) ){ // Motion vector data is included for all MC macroblocks. MVD is obtained from the macroblock vector by subtracting the // vector of the preceding macroblock. For this calculation the vector of the preceding macroblock is regarded as zero in the // following three situations: // 1) evaluating MVD for macroblocks 1, 12 and 23; // 2) evaluating MVD for macroblocks in which MBA does not represent a difference of 1; // 3) MTYPE of the previous macroblock was not MC. if ( ( h->current_mba == 1 ) || ( h->current_mba == 12 ) || ( h->current_mba == 23 ) || ( h->mba_diff != 1) || ( !IS_16X16 ( old_mtype ) )) { h->current_mv_x = 0; h->current_mv_y = 0; } h->current_mv_x= decode_mv_component(&s->gb, h->current_mv_x); h->current_mv_y= decode_mv_component(&s->gb, h->current_mv_y); } // Read cbp if ( HAS_CBP( h->mtype ) ){ cbp = get_vlc2(&s->gb, h261_cbp_vlc.table, H261_CBP_VLC_BITS, 2) + 1; } if(s->mb_intra){ s->current_picture.mb_type[xy]= MB_TYPE_INTRA; goto intra; } //set motion vectors s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_16X16; s->current_picture.mb_type[xy]= MB_TYPE_16x16 | MB_TYPE_L0; if(IS_16X16 ( h->mtype )){ s->mv[0][0][0] = h->current_mv_x * 2;//gets divided by 2 in motion compensation s->mv[0][0][1] = h->current_mv_y * 2; } else{ h->current_mv_x = s->mv[0][0][0] = 0; h->current_mv_x = s->mv[0][0][1] = 0; } intra: /* decode each block */ if(s->mb_intra || HAS_CBP(h->mtype)){ for (i = 0; i < 6; i++) { if (h261_decode_block(h, block[i], i, cbp&32) < 0){ return -1; } cbp+=cbp; } } /* per-MB end of slice check */ { int v= show_bits(&s->gb, 15); if(get_bits_count(&s->gb) + 15 > s->gb.size_in_bits){ v>>= get_bits_count(&s->gb) + 15 - s->gb.size_in_bits; } if(v==0){ return SLICE_END; } } return SLICE_OK; }
true
FFmpeg
49e5dcbce5f9e08ec375fd54c413148beb81f1d7
static int h261_decode_mb(H261Context *h, DCTELEM block[6][64]) { MpegEncContext * const s = &h->s; int i, cbp, xy, old_mtype; cbp = 63; do{ h->mba_diff = get_vlc2(&s->gb, h261_mba_vlc.table, H261_MBA_VLC_BITS, 2)+1; } while( h->mba_diff == MAX_MBA + 1 ); if ( h->mba_diff < 0 ) return -1; h->current_mba += h->mba_diff; if ( h->current_mba > MAX_MBA ) return -1; s->mb_x= ((h->gob_number-1) % 2) * 11 + ((h->current_mba-1) % 11); s->mb_y= ((h->gob_number-1) / 2) * 3 + ((h->current_mba-1) / 11); xy = s->mb_x + s->mb_y * s->mb_stride; ff_init_block_index(s); ff_update_block_index(s); s->dsp.clear_blocks(s->block[0]); old_mtype = h->mtype; h->mtype = get_vlc2(&s->gb, h261_mtype_vlc.table, H261_MTYPE_VLC_BITS, 2); h->mtype = h261_mtype_map[h->mtype]; if (IS_FIL (h->mtype)) h->loop_filter = 1; if ( IS_QUANT ( h->mtype ) ){ ff_set_qscale(s, get_bits(&s->gb, 5)); } s->mb_intra = IS_INTRA4x4(h->mtype); if ( IS_16X16 ( h->mtype ) ){ if ( ( h->current_mba == 1 ) || ( h->current_mba == 12 ) || ( h->current_mba == 23 ) || ( h->mba_diff != 1) || ( !IS_16X16 ( old_mtype ) )) { h->current_mv_x = 0; h->current_mv_y = 0; } h->current_mv_x= decode_mv_component(&s->gb, h->current_mv_x); h->current_mv_y= decode_mv_component(&s->gb, h->current_mv_y); } if ( HAS_CBP( h->mtype ) ){ cbp = get_vlc2(&s->gb, h261_cbp_vlc.table, H261_CBP_VLC_BITS, 2) + 1; } if(s->mb_intra){ s->current_picture.mb_type[xy]= MB_TYPE_INTRA; goto intra; } s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_16X16; s->current_picture.mb_type[xy]= MB_TYPE_16x16 | MB_TYPE_L0; if(IS_16X16 ( h->mtype )){ s->mv[0][0][0] = h->current_mv_x * 2; s->mv[0][0][1] = h->current_mv_y * 2; } else{ h->current_mv_x = s->mv[0][0][0] = 0; h->current_mv_x = s->mv[0][0][1] = 0; } intra: if(s->mb_intra || HAS_CBP(h->mtype)){ for (i = 0; i < 6; i++) { if (h261_decode_block(h, block[i], i, cbp&32) < 0){ return -1; } cbp+=cbp; } } { int v= show_bits(&s->gb, 15); if(get_bits_count(&s->gb) + 15 > s->gb.size_in_bits){ v>>= get_bits_count(&s->gb) + 15 - s->gb.size_in_bits; } if(v==0){ return SLICE_END; } } return SLICE_OK; }
{ "code": [ "static int h261_decode_mb(H261Context *h,", " return -1;", "static int h261_decode_mb(H261Context *h,", " DCTELEM block[6][64])", " h->mba_diff = get_vlc2(&s->gb, h261_mba_vlc.table, H261_MBA_VLC_BITS, 2)+1;", " if ( h->mba_diff < 0 )", " return -1;", " if ( h->current_mba > MAX_MBA )", " return -1;", " if (IS_FIL (h->mtype))", " h->loop_filter = 1;", " if (h261_decode_block(h, block[i], i, cbp&32) < 0){", " return -1;", " int v= show_bits(&s->gb, 15);", " if(get_bits_count(&s->gb) + 15 > s->gb.size_in_bits){", " v>>= get_bits_count(&s->gb) + 15 - s->gb.size_in_bits;", " if(v==0){", " return SLICE_END;", " return -1;" ], "line_no": [ 1, 29, 1, 3, 19, 27, 29, 37, 29, 71, 73, 183, 185, 201, 205, 207, 213, 215, 185 ] }
static int FUNC_0(H261Context *VAR_0, DCTELEM VAR_1[6][64]) { MpegEncContext * const s = &VAR_0->s; int VAR_2, VAR_3, VAR_4, VAR_5; VAR_3 = 63; do{ VAR_0->mba_diff = get_vlc2(&s->gb, h261_mba_vlc.table, H261_MBA_VLC_BITS, 2)+1; } while( VAR_0->mba_diff == MAX_MBA + 1 ); if ( VAR_0->mba_diff < 0 ) return -1; VAR_0->current_mba += VAR_0->mba_diff; if ( VAR_0->current_mba > MAX_MBA ) return -1; s->mb_x= ((VAR_0->gob_number-1) % 2) * 11 + ((VAR_0->current_mba-1) % 11); s->mb_y= ((VAR_0->gob_number-1) / 2) * 3 + ((VAR_0->current_mba-1) / 11); VAR_4 = s->mb_x + s->mb_y * s->mb_stride; ff_init_block_index(s); ff_update_block_index(s); s->dsp.clear_blocks(s->VAR_1[0]); VAR_5 = VAR_0->mtype; VAR_0->mtype = get_vlc2(&s->gb, h261_mtype_vlc.table, H261_MTYPE_VLC_BITS, 2); VAR_0->mtype = h261_mtype_map[VAR_0->mtype]; if (IS_FIL (VAR_0->mtype)) VAR_0->loop_filter = 1; if ( IS_QUANT ( VAR_0->mtype ) ){ ff_set_qscale(s, get_bits(&s->gb, 5)); } s->mb_intra = IS_INTRA4x4(VAR_0->mtype); if ( IS_16X16 ( VAR_0->mtype ) ){ if ( ( VAR_0->current_mba == 1 ) || ( VAR_0->current_mba == 12 ) || ( VAR_0->current_mba == 23 ) || ( VAR_0->mba_diff != 1) || ( !IS_16X16 ( VAR_5 ) )) { VAR_0->current_mv_x = 0; VAR_0->current_mv_y = 0; } VAR_0->current_mv_x= decode_mv_component(&s->gb, VAR_0->current_mv_x); VAR_0->current_mv_y= decode_mv_component(&s->gb, VAR_0->current_mv_y); } if ( HAS_CBP( VAR_0->mtype ) ){ VAR_3 = get_vlc2(&s->gb, h261_cbp_vlc.table, H261_CBP_VLC_BITS, 2) + 1; } if(s->mb_intra){ s->current_picture.mb_type[VAR_4]= MB_TYPE_INTRA; goto intra; } s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_16X16; s->current_picture.mb_type[VAR_4]= MB_TYPE_16x16 | MB_TYPE_L0; if(IS_16X16 ( VAR_0->mtype )){ s->mv[0][0][0] = VAR_0->current_mv_x * 2; s->mv[0][0][1] = VAR_0->current_mv_y * 2; } else{ VAR_0->current_mv_x = s->mv[0][0][0] = 0; VAR_0->current_mv_x = s->mv[0][0][1] = 0; } intra: if(s->mb_intra || HAS_CBP(VAR_0->mtype)){ for (VAR_2 = 0; VAR_2 < 6; VAR_2++) { if (h261_decode_block(VAR_0, VAR_1[VAR_2], VAR_2, VAR_3&32) < 0){ return -1; } VAR_3+=VAR_3; } } { int VAR_6= show_bits(&s->gb, 15); if(get_bits_count(&s->gb) + 15 > s->gb.size_in_bits){ VAR_6>>= get_bits_count(&s->gb) + 15 - s->gb.size_in_bits; } if(VAR_6==0){ return SLICE_END; } } return SLICE_OK; }
[ "static int FUNC_0(H261Context *VAR_0,\nDCTELEM VAR_1[6][64])\n{", "MpegEncContext * const s = &VAR_0->s;", "int VAR_2, VAR_3, VAR_4, VAR_5;", "VAR_3 = 63;", "do{", "VAR_0->mba_diff = get_vlc2(&s->gb, h261_mba_vlc.table, H261_MBA_VLC_BITS, 2)+1;", "}", "while( VAR_0->mba_diff == MAX_MBA + 1 );", "if ( VAR_0->mba_diff < 0 )\nreturn -1;", "VAR_0->current_mba += VAR_0->mba_diff;", "if ( VAR_0->current_mba > MAX_MBA )\nreturn -1;", "s->mb_x= ((VAR_0->gob_number-1) % 2) * 11 + ((VAR_0->current_mba-1) % 11);", "s->mb_y= ((VAR_0->gob_number-1) / 2) * 3 + ((VAR_0->current_mba-1) / 11);", "VAR_4 = s->mb_x + s->mb_y * s->mb_stride;", "ff_init_block_index(s);", "ff_update_block_index(s);", "s->dsp.clear_blocks(s->VAR_1[0]);", "VAR_5 = VAR_0->mtype;", "VAR_0->mtype = get_vlc2(&s->gb, h261_mtype_vlc.table, H261_MTYPE_VLC_BITS, 2);", "VAR_0->mtype = h261_mtype_map[VAR_0->mtype];", "if (IS_FIL (VAR_0->mtype))\nVAR_0->loop_filter = 1;", "if ( IS_QUANT ( VAR_0->mtype ) ){", "ff_set_qscale(s, get_bits(&s->gb, 5));", "}", "s->mb_intra = IS_INTRA4x4(VAR_0->mtype);", "if ( IS_16X16 ( VAR_0->mtype ) ){", "if ( ( VAR_0->current_mba == 1 ) || ( VAR_0->current_mba == 12 ) || ( VAR_0->current_mba == 23 ) ||\n( VAR_0->mba_diff != 1) || ( !IS_16X16 ( VAR_5 ) ))\n{", "VAR_0->current_mv_x = 0;", "VAR_0->current_mv_y = 0;", "}", "VAR_0->current_mv_x= decode_mv_component(&s->gb, VAR_0->current_mv_x);", "VAR_0->current_mv_y= decode_mv_component(&s->gb, VAR_0->current_mv_y);", "}", "if ( HAS_CBP( VAR_0->mtype ) ){", "VAR_3 = get_vlc2(&s->gb, h261_cbp_vlc.table, H261_CBP_VLC_BITS, 2) + 1;", "}", "if(s->mb_intra){", "s->current_picture.mb_type[VAR_4]= MB_TYPE_INTRA;", "goto intra;", "}", "s->mv_dir = MV_DIR_FORWARD;", "s->mv_type = MV_TYPE_16X16;", "s->current_picture.mb_type[VAR_4]= MB_TYPE_16x16 | MB_TYPE_L0;", "if(IS_16X16 ( VAR_0->mtype )){", "s->mv[0][0][0] = VAR_0->current_mv_x * 2;", "s->mv[0][0][1] = VAR_0->current_mv_y * 2;", "}", "else{", "VAR_0->current_mv_x = s->mv[0][0][0] = 0;", "VAR_0->current_mv_x = s->mv[0][0][1] = 0;", "}", "intra:\nif(s->mb_intra || HAS_CBP(VAR_0->mtype)){", "for (VAR_2 = 0; VAR_2 < 6; VAR_2++) {", "if (h261_decode_block(VAR_0, VAR_1[VAR_2], VAR_2, VAR_3&32) < 0){", "return -1;", "}", "VAR_3+=VAR_3;", "}", "}", "{", "int VAR_6= show_bits(&s->gb, 15);", "if(get_bits_count(&s->gb) + 15 > s->gb.size_in_bits){", "VAR_6>>= get_bits_count(&s->gb) + 15 - s->gb.size_in_bits;", "}", "if(VAR_6==0){", "return SLICE_END;", "}", "}", "return SLICE_OK;", "}" ]
[ 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27, 29 ], [ 33 ], [ 37, 39 ], [ 43 ], [ 45 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 63 ], [ 65 ], [ 67 ], [ 71, 73 ], [ 79 ], [ 81 ], [ 83 ], [ 87 ], [ 93 ], [ 107, 109, 111 ], [ 113 ], [ 115 ], [ 117 ], [ 121 ], [ 123 ], [ 125 ], [ 131 ], [ 133 ], [ 135 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 175, 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 199 ], [ 201 ], [ 205 ], [ 207 ], [ 209 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ] ]
7,343
static void IRQ_check(OpenPICState *opp, IRQ_queue_t *q) { int next, i; int priority; next = -1; priority = -1; if (!q->pending) { /* IRQ bitmap is empty */ goto out; } for (i = 0; i < opp->max_irq; i++) { if (IRQ_testbit(q, i)) { DPRINTF("IRQ_check: irq %d set ipvp_pr=%d pr=%d\n", i, IPVP_PRIORITY(opp->src[i].ipvp), priority); if (IPVP_PRIORITY(opp->src[i].ipvp) > priority) { next = i; priority = IPVP_PRIORITY(opp->src[i].ipvp); } } } out: q->next = next; q->priority = priority; }
true
qemu
af7e9e74c6a62a5bcd911726a9e88d28b61490e0
static void IRQ_check(OpenPICState *opp, IRQ_queue_t *q) { int next, i; int priority; next = -1; priority = -1; if (!q->pending) { goto out; } for (i = 0; i < opp->max_irq; i++) { if (IRQ_testbit(q, i)) { DPRINTF("IRQ_check: irq %d set ipvp_pr=%d pr=%d\n", i, IPVP_PRIORITY(opp->src[i].ipvp), priority); if (IPVP_PRIORITY(opp->src[i].ipvp) > priority) { next = i; priority = IPVP_PRIORITY(opp->src[i].ipvp); } } } out: q->next = next; q->priority = priority; }
{ "code": [ "static void IRQ_check(OpenPICState *opp, IRQ_queue_t *q)" ], "line_no": [ 1 ] }
static void FUNC_0(OpenPICState *VAR_0, IRQ_queue_t *VAR_1) { int VAR_2, VAR_3; int VAR_4; VAR_2 = -1; VAR_4 = -1; if (!VAR_1->pending) { goto out; } for (VAR_3 = 0; VAR_3 < VAR_0->max_irq; VAR_3++) { if (IRQ_testbit(VAR_1, VAR_3)) { DPRINTF("FUNC_0: irq %d set ipvp_pr=%d pr=%d\n", VAR_3, IPVP_PRIORITY(VAR_0->src[VAR_3].ipvp), VAR_4); if (IPVP_PRIORITY(VAR_0->src[VAR_3].ipvp) > VAR_4) { VAR_2 = VAR_3; VAR_4 = IPVP_PRIORITY(VAR_0->src[VAR_3].ipvp); } } } out: VAR_1->VAR_2 = VAR_2; VAR_1->VAR_4 = VAR_4; }
[ "static void FUNC_0(OpenPICState *VAR_0, IRQ_queue_t *VAR_1)\n{", "int VAR_2, VAR_3;", "int VAR_4;", "VAR_2 = -1;", "VAR_4 = -1;", "if (!VAR_1->pending) {", "goto out;", "}", "for (VAR_3 = 0; VAR_3 < VAR_0->max_irq; VAR_3++) {", "if (IRQ_testbit(VAR_1, VAR_3)) {", "DPRINTF(\"FUNC_0: irq %d set ipvp_pr=%d pr=%d\\n\",\nVAR_3, IPVP_PRIORITY(VAR_0->src[VAR_3].ipvp), VAR_4);", "if (IPVP_PRIORITY(VAR_0->src[VAR_3].ipvp) > VAR_4) {", "VAR_2 = VAR_3;", "VAR_4 = IPVP_PRIORITY(VAR_0->src[VAR_3].ipvp);", "}", "}", "}", "out:\nVAR_1->VAR_2 = VAR_2;", "VAR_1->VAR_4 = VAR_4;", "}" ]
[ 1, 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 ], [ 17 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49, 51 ], [ 53 ], [ 55 ] ]
7,344
static void test_visitor_out_alternate(TestOutputVisitorData *data, const void *unused) { QObject *arg; UserDefAlternate *tmp; QDict *qdict; tmp = g_new0(UserDefAlternate, 1); tmp->type = QTYPE_QINT; tmp->u.i = 42; visit_type_UserDefAlternate(data->ov, NULL, &tmp, &error_abort); arg = qmp_output_get_qobject(data->qov); g_assert(qobject_type(arg) == QTYPE_QINT); g_assert_cmpint(qint_get_int(qobject_to_qint(arg)), ==, 42); qapi_free_UserDefAlternate(tmp); qobject_decref(arg); tmp = g_new0(UserDefAlternate, 1); tmp->type = QTYPE_QSTRING; tmp->u.s = g_strdup("hello"); visit_type_UserDefAlternate(data->ov, NULL, &tmp, &error_abort); arg = qmp_output_get_qobject(data->qov); g_assert(qobject_type(arg) == QTYPE_QSTRING); g_assert_cmpstr(qstring_get_str(qobject_to_qstring(arg)), ==, "hello"); qapi_free_UserDefAlternate(tmp); qobject_decref(arg); tmp = g_new0(UserDefAlternate, 1); tmp->type = QTYPE_QDICT; tmp->u.udfu.integer = 1; tmp->u.udfu.string = g_strdup("str"); tmp->u.udfu.enum1 = ENUM_ONE_VALUE1; tmp->u.udfu.u.value1 = g_new0(UserDefA, 1); tmp->u.udfu.u.value1->boolean = true; visit_type_UserDefAlternate(data->ov, NULL, &tmp, &error_abort); arg = qmp_output_get_qobject(data->qov); g_assert_cmpint(qobject_type(arg), ==, QTYPE_QDICT); qdict = qobject_to_qdict(arg); g_assert_cmpint(qdict_size(qdict), ==, 4); g_assert_cmpint(qdict_get_int(qdict, "integer"), ==, 1); g_assert_cmpstr(qdict_get_str(qdict, "string"), ==, "str"); g_assert_cmpstr(qdict_get_str(qdict, "enum1"), ==, "value1"); g_assert_cmpint(qdict_get_bool(qdict, "boolean"), ==, true); qapi_free_UserDefAlternate(tmp); qobject_decref(arg); }
true
qemu
544a3731591f5d53e15f22de00ce5ac758d490b3
static void test_visitor_out_alternate(TestOutputVisitorData *data, const void *unused) { QObject *arg; UserDefAlternate *tmp; QDict *qdict; tmp = g_new0(UserDefAlternate, 1); tmp->type = QTYPE_QINT; tmp->u.i = 42; visit_type_UserDefAlternate(data->ov, NULL, &tmp, &error_abort); arg = qmp_output_get_qobject(data->qov); g_assert(qobject_type(arg) == QTYPE_QINT); g_assert_cmpint(qint_get_int(qobject_to_qint(arg)), ==, 42); qapi_free_UserDefAlternate(tmp); qobject_decref(arg); tmp = g_new0(UserDefAlternate, 1); tmp->type = QTYPE_QSTRING; tmp->u.s = g_strdup("hello"); visit_type_UserDefAlternate(data->ov, NULL, &tmp, &error_abort); arg = qmp_output_get_qobject(data->qov); g_assert(qobject_type(arg) == QTYPE_QSTRING); g_assert_cmpstr(qstring_get_str(qobject_to_qstring(arg)), ==, "hello"); qapi_free_UserDefAlternate(tmp); qobject_decref(arg); tmp = g_new0(UserDefAlternate, 1); tmp->type = QTYPE_QDICT; tmp->u.udfu.integer = 1; tmp->u.udfu.string = g_strdup("str"); tmp->u.udfu.enum1 = ENUM_ONE_VALUE1; tmp->u.udfu.u.value1 = g_new0(UserDefA, 1); tmp->u.udfu.u.value1->boolean = true; visit_type_UserDefAlternate(data->ov, NULL, &tmp, &error_abort); arg = qmp_output_get_qobject(data->qov); g_assert_cmpint(qobject_type(arg), ==, QTYPE_QDICT); qdict = qobject_to_qdict(arg); g_assert_cmpint(qdict_size(qdict), ==, 4); g_assert_cmpint(qdict_get_int(qdict, "integer"), ==, 1); g_assert_cmpstr(qdict_get_str(qdict, "string"), ==, "str"); g_assert_cmpstr(qdict_get_str(qdict, "enum1"), ==, "value1"); g_assert_cmpint(qdict_get_bool(qdict, "boolean"), ==, true); qapi_free_UserDefAlternate(tmp); qobject_decref(arg); }
{ "code": [ " tmp->u.udfu.u.value1 = g_new0(UserDefA, 1);", " tmp->u.udfu.u.value1->boolean = true;" ], "line_no": [ 77, 79 ] }
static void FUNC_0(TestOutputVisitorData *VAR_0, const void *VAR_1) { QObject *arg; UserDefAlternate *tmp; QDict *qdict; tmp = g_new0(UserDefAlternate, 1); tmp->type = QTYPE_QINT; tmp->u.i = 42; visit_type_UserDefAlternate(VAR_0->ov, NULL, &tmp, &error_abort); arg = qmp_output_get_qobject(VAR_0->qov); g_assert(qobject_type(arg) == QTYPE_QINT); g_assert_cmpint(qint_get_int(qobject_to_qint(arg)), ==, 42); qapi_free_UserDefAlternate(tmp); qobject_decref(arg); tmp = g_new0(UserDefAlternate, 1); tmp->type = QTYPE_QSTRING; tmp->u.s = g_strdup("hello"); visit_type_UserDefAlternate(VAR_0->ov, NULL, &tmp, &error_abort); arg = qmp_output_get_qobject(VAR_0->qov); g_assert(qobject_type(arg) == QTYPE_QSTRING); g_assert_cmpstr(qstring_get_str(qobject_to_qstring(arg)), ==, "hello"); qapi_free_UserDefAlternate(tmp); qobject_decref(arg); tmp = g_new0(UserDefAlternate, 1); tmp->type = QTYPE_QDICT; tmp->u.udfu.integer = 1; tmp->u.udfu.string = g_strdup("str"); tmp->u.udfu.enum1 = ENUM_ONE_VALUE1; tmp->u.udfu.u.value1 = g_new0(UserDefA, 1); tmp->u.udfu.u.value1->boolean = true; visit_type_UserDefAlternate(VAR_0->ov, NULL, &tmp, &error_abort); arg = qmp_output_get_qobject(VAR_0->qov); g_assert_cmpint(qobject_type(arg), ==, QTYPE_QDICT); qdict = qobject_to_qdict(arg); g_assert_cmpint(qdict_size(qdict), ==, 4); g_assert_cmpint(qdict_get_int(qdict, "integer"), ==, 1); g_assert_cmpstr(qdict_get_str(qdict, "string"), ==, "str"); g_assert_cmpstr(qdict_get_str(qdict, "enum1"), ==, "value1"); g_assert_cmpint(qdict_get_bool(qdict, "boolean"), ==, true); qapi_free_UserDefAlternate(tmp); qobject_decref(arg); }
[ "static void FUNC_0(TestOutputVisitorData *VAR_0,\nconst void *VAR_1)\n{", "QObject *arg;", "UserDefAlternate *tmp;", "QDict *qdict;", "tmp = g_new0(UserDefAlternate, 1);", "tmp->type = QTYPE_QINT;", "tmp->u.i = 42;", "visit_type_UserDefAlternate(VAR_0->ov, NULL, &tmp, &error_abort);", "arg = qmp_output_get_qobject(VAR_0->qov);", "g_assert(qobject_type(arg) == QTYPE_QINT);", "g_assert_cmpint(qint_get_int(qobject_to_qint(arg)), ==, 42);", "qapi_free_UserDefAlternate(tmp);", "qobject_decref(arg);", "tmp = g_new0(UserDefAlternate, 1);", "tmp->type = QTYPE_QSTRING;", "tmp->u.s = g_strdup(\"hello\");", "visit_type_UserDefAlternate(VAR_0->ov, NULL, &tmp, &error_abort);", "arg = qmp_output_get_qobject(VAR_0->qov);", "g_assert(qobject_type(arg) == QTYPE_QSTRING);", "g_assert_cmpstr(qstring_get_str(qobject_to_qstring(arg)), ==, \"hello\");", "qapi_free_UserDefAlternate(tmp);", "qobject_decref(arg);", "tmp = g_new0(UserDefAlternate, 1);", "tmp->type = QTYPE_QDICT;", "tmp->u.udfu.integer = 1;", "tmp->u.udfu.string = g_strdup(\"str\");", "tmp->u.udfu.enum1 = ENUM_ONE_VALUE1;", "tmp->u.udfu.u.value1 = g_new0(UserDefA, 1);", "tmp->u.udfu.u.value1->boolean = true;", "visit_type_UserDefAlternate(VAR_0->ov, NULL, &tmp, &error_abort);", "arg = qmp_output_get_qobject(VAR_0->qov);", "g_assert_cmpint(qobject_type(arg), ==, QTYPE_QDICT);", "qdict = qobject_to_qdict(arg);", "g_assert_cmpint(qdict_size(qdict), ==, 4);", "g_assert_cmpint(qdict_get_int(qdict, \"integer\"), ==, 1);", "g_assert_cmpstr(qdict_get_str(qdict, \"string\"), ==, \"str\");", "g_assert_cmpstr(qdict_get_str(qdict, \"enum1\"), ==, \"value1\");", "g_assert_cmpint(qdict_get_bool(qdict, \"boolean\"), ==, true);", "qapi_free_UserDefAlternate(tmp);", "qobject_decref(arg);", "}" ]
[ 0, 0, 0, 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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 85 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 105 ], [ 107 ], [ 109 ] ]
7,345
static double get_volume(CompandContext *s, double in_lin) { CompandSegment *cs; double in_log, out_log; int i; if (in_lin < s->in_min_lin) return s->out_min_lin; in_log = log(in_lin); for (i = 1;; i++) if (in_log <= s->segments[i + 1].x) break; cs = &s->segments[i]; in_log -= cs->x; out_log = cs->y + in_log * (cs->a * in_log + cs->b); return exp(out_log); }
true
FFmpeg
9e329185d701f60412eb70c4ffbeb345bd459e82
static double get_volume(CompandContext *s, double in_lin) { CompandSegment *cs; double in_log, out_log; int i; if (in_lin < s->in_min_lin) return s->out_min_lin; in_log = log(in_lin); for (i = 1;; i++) if (in_log <= s->segments[i + 1].x) break; cs = &s->segments[i]; in_log -= cs->x; out_log = cs->y + in_log * (cs->a * in_log + cs->b); return exp(out_log); }
{ "code": [ " for (i = 1;; i++)", " if (in_log <= s->segments[i + 1].x)", " cs = &s->segments[i];" ], "line_no": [ 23, 25, 31 ] }
static double FUNC_0(CompandContext *VAR_0, double VAR_1) { CompandSegment *cs; double VAR_2, VAR_3; int VAR_4; if (VAR_1 < VAR_0->in_min_lin) return VAR_0->out_min_lin; VAR_2 = log(VAR_1); for (VAR_4 = 1;; VAR_4++) if (VAR_2 <= VAR_0->segments[VAR_4 + 1].x) break; cs = &VAR_0->segments[VAR_4]; VAR_2 -= cs->x; VAR_3 = cs->y + VAR_2 * (cs->a * VAR_2 + cs->b); return exp(VAR_3); }
[ "static double FUNC_0(CompandContext *VAR_0, double VAR_1)\n{", "CompandSegment *cs;", "double VAR_2, VAR_3;", "int VAR_4;", "if (VAR_1 < VAR_0->in_min_lin)\nreturn VAR_0->out_min_lin;", "VAR_2 = log(VAR_1);", "for (VAR_4 = 1;; VAR_4++)", "if (VAR_2 <= VAR_0->segments[VAR_4 + 1].x)\nbreak;", "cs = &VAR_0->segments[VAR_4];", "VAR_2 -= cs->x;", "VAR_3 = cs->y + VAR_2 * (cs->a * VAR_2 + cs->b);", "return exp(VAR_3);", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13, 15 ], [ 19 ], [ 23 ], [ 25, 27 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ] ]
7,346
static void qemu_co_queue_next_bh(void *opaque) { struct unlock_bh *unlock_bh = opaque; Coroutine *next; trace_qemu_co_queue_next_bh(); while ((next = QTAILQ_FIRST(&unlock_bh_queue))) { QTAILQ_REMOVE(&unlock_bh_queue, next, co_queue_next); qemu_coroutine_enter(next, NULL); } qemu_bh_delete(unlock_bh->bh); qemu_free(unlock_bh); }
true
qemu
e680cfa7e20f5049c475ac94f998a79c9997b48d
static void qemu_co_queue_next_bh(void *opaque) { struct unlock_bh *unlock_bh = opaque; Coroutine *next; trace_qemu_co_queue_next_bh(); while ((next = QTAILQ_FIRST(&unlock_bh_queue))) { QTAILQ_REMOVE(&unlock_bh_queue, next, co_queue_next); qemu_coroutine_enter(next, NULL); } qemu_bh_delete(unlock_bh->bh); qemu_free(unlock_bh); }
{ "code": [ " struct unlock_bh *unlock_bh = opaque;", " qemu_bh_delete(unlock_bh->bh);", " qemu_free(unlock_bh);" ], "line_no": [ 5, 23, 25 ] }
static void FUNC_0(void *VAR_0) { struct VAR_1 *VAR_1 = VAR_0; Coroutine *next; trace_qemu_co_queue_next_bh(); while ((next = QTAILQ_FIRST(&unlock_bh_queue))) { QTAILQ_REMOVE(&unlock_bh_queue, next, co_queue_next); qemu_coroutine_enter(next, NULL); } qemu_bh_delete(VAR_1->bh); qemu_free(VAR_1); }
[ "static void FUNC_0(void *VAR_0)\n{", "struct VAR_1 *VAR_1 = VAR_0;", "Coroutine *next;", "trace_qemu_co_queue_next_bh();", "while ((next = QTAILQ_FIRST(&unlock_bh_queue))) {", "QTAILQ_REMOVE(&unlock_bh_queue, next, co_queue_next);", "qemu_coroutine_enter(next, NULL);", "}", "qemu_bh_delete(VAR_1->bh);", "qemu_free(VAR_1);", "}" ]
[ 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ] ]
7,348
PPC_OP(addeo) { do_addeo(); RETURN(); }
true
qemu
d9bce9d99f4656ae0b0127f7472db9067b8f84ab
PPC_OP(addeo) { do_addeo(); RETURN(); }
{ "code": [ " RETURN();", "PPC_OP(addeo)", " do_addeo();", " RETURN();" ], "line_no": [ 7, 1, 5, 7 ] }
FUNC_0(VAR_0) { do_addeo(); RETURN(); }
[ "FUNC_0(VAR_0)\n{", "do_addeo();", "RETURN();", "}" ]
[ 1, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
7,350
static void store_reg(DisasContext *s, int reg, TCGv var) { if (reg == 15) { tcg_gen_andi_i32(var, var, ~1); s->is_jmp = DISAS_JUMP; } tcg_gen_mov_i32(cpu_R[reg], var); dead_tmp(var); }
true
qemu
7d1b0095bff7157e856d1d0e6c4295641ced2752
static void store_reg(DisasContext *s, int reg, TCGv var) { if (reg == 15) { tcg_gen_andi_i32(var, var, ~1); s->is_jmp = DISAS_JUMP; } tcg_gen_mov_i32(cpu_R[reg], var); dead_tmp(var); }
{ "code": [ " dead_tmp(var);", " dead_tmp(var);", " dead_tmp(var);", " dead_tmp(var);", " dead_tmp(var);" ], "line_no": [ 15, 15, 15, 15, 15 ] }
static void FUNC_0(DisasContext *VAR_0, int VAR_1, TCGv VAR_2) { if (VAR_1 == 15) { tcg_gen_andi_i32(VAR_2, VAR_2, ~1); VAR_0->is_jmp = DISAS_JUMP; } tcg_gen_mov_i32(cpu_R[VAR_1], VAR_2); dead_tmp(VAR_2); }
[ "static void FUNC_0(DisasContext *VAR_0, int VAR_1, TCGv VAR_2)\n{", "if (VAR_1 == 15) {", "tcg_gen_andi_i32(VAR_2, VAR_2, ~1);", "VAR_0->is_jmp = DISAS_JUMP;", "}", "tcg_gen_mov_i32(cpu_R[VAR_1], VAR_2);", "dead_tmp(VAR_2);", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ] ]
7,354
static int vnc_display_get_addresses(QemuOpts *opts, bool reverse, SocketAddress ***retsaddr, size_t *retnsaddr, SocketAddress ***retwsaddr, size_t *retnwsaddr, Error **errp) { SocketAddress *saddr = NULL; SocketAddress *wsaddr = NULL; QemuOptsIter addriter; const char *addr; int to = qemu_opt_get_number(opts, "to", 0); bool has_ipv4 = qemu_opt_get(opts, "ipv4"); bool has_ipv6 = qemu_opt_get(opts, "ipv6"); bool ipv4 = qemu_opt_get_bool(opts, "ipv4", false); bool ipv6 = qemu_opt_get_bool(opts, "ipv6", false); size_t i; int displaynum = -1; int ret = -1; *retsaddr = NULL; *retnsaddr = 0; *retwsaddr = NULL; *retnwsaddr = 0; addr = qemu_opt_get(opts, "vnc"); if (addr == NULL || g_str_equal(addr, "none")) { ret = 0; goto cleanup; } if (qemu_opt_get(opts, "websocket") && !qcrypto_hash_supports(QCRYPTO_HASH_ALG_SHA1)) { error_setg(errp, "SHA1 hash support is required for websockets"); goto cleanup; } qemu_opt_iter_init(&addriter, opts, "vnc"); while ((addr = qemu_opt_iter_next(&addriter)) != NULL) { int rv; rv = vnc_display_get_address(addr, false, reverse, 0, to, has_ipv4, has_ipv6, ipv4, ipv6, &saddr, errp); if (rv < 0) { goto cleanup; } /* Historical compat - first listen address can be used * to set the default websocket port */ if (displaynum == -1) { displaynum = rv; } *retsaddr = g_renew(SocketAddress *, *retsaddr, *retnsaddr + 1); (*retsaddr)[(*retnsaddr)++] = saddr; } /* If we had multiple primary displays, we don't do defaults * for websocket, and require explicit config instead. */ if (*retnsaddr > 1) { displaynum = -1; } qemu_opt_iter_init(&addriter, opts, "websocket"); while ((addr = qemu_opt_iter_next(&addriter)) != NULL) { if (vnc_display_get_address(addr, true, reverse, displaynum, to, has_ipv4, has_ipv6, ipv4, ipv6, &wsaddr, errp) < 0) { goto cleanup; } /* Historical compat - if only a single listen address was * provided, then this is used to set the default listen * address for websocket too */ if (*retnsaddr == 1 && (*retsaddr)[0]->type == SOCKET_ADDRESS_TYPE_INET && wsaddr->type == SOCKET_ADDRESS_TYPE_INET && g_str_equal(wsaddr->u.inet.host, "") && !g_str_equal((*retsaddr)[0]->u.inet.host, "")) { g_free(wsaddr->u.inet.host); wsaddr->u.inet.host = g_strdup((*retsaddr)[0]->u.inet.host); } *retwsaddr = g_renew(SocketAddress *, *retwsaddr, *retnwsaddr + 1); (*retwsaddr)[(*retnwsaddr)++] = wsaddr; } ret = 0; cleanup: if (ret < 0) { for (i = 0; i < *retnsaddr; i++) { qapi_free_SocketAddress((*retsaddr)[i]); } g_free(*retsaddr); for (i = 0; i < *retnwsaddr; i++) { qapi_free_SocketAddress((*retwsaddr)[i]); } g_free(*retwsaddr); *retsaddr = *retwsaddr = NULL; *retnsaddr = *retnwsaddr = 0; } return ret; }
true
qemu
9f26f3252534e7680cfc7c0dbd1d79fdb56519ad
static int vnc_display_get_addresses(QemuOpts *opts, bool reverse, SocketAddress ***retsaddr, size_t *retnsaddr, SocketAddress ***retwsaddr, size_t *retnwsaddr, Error **errp) { SocketAddress *saddr = NULL; SocketAddress *wsaddr = NULL; QemuOptsIter addriter; const char *addr; int to = qemu_opt_get_number(opts, "to", 0); bool has_ipv4 = qemu_opt_get(opts, "ipv4"); bool has_ipv6 = qemu_opt_get(opts, "ipv6"); bool ipv4 = qemu_opt_get_bool(opts, "ipv4", false); bool ipv6 = qemu_opt_get_bool(opts, "ipv6", false); size_t i; int displaynum = -1; int ret = -1; *retsaddr = NULL; *retnsaddr = 0; *retwsaddr = NULL; *retnwsaddr = 0; addr = qemu_opt_get(opts, "vnc"); if (addr == NULL || g_str_equal(addr, "none")) { ret = 0; goto cleanup; } if (qemu_opt_get(opts, "websocket") && !qcrypto_hash_supports(QCRYPTO_HASH_ALG_SHA1)) { error_setg(errp, "SHA1 hash support is required for websockets"); goto cleanup; } qemu_opt_iter_init(&addriter, opts, "vnc"); while ((addr = qemu_opt_iter_next(&addriter)) != NULL) { int rv; rv = vnc_display_get_address(addr, false, reverse, 0, to, has_ipv4, has_ipv6, ipv4, ipv6, &saddr, errp); if (rv < 0) { goto cleanup; } if (displaynum == -1) { displaynum = rv; } *retsaddr = g_renew(SocketAddress *, *retsaddr, *retnsaddr + 1); (*retsaddr)[(*retnsaddr)++] = saddr; } if (*retnsaddr > 1) { displaynum = -1; } qemu_opt_iter_init(&addriter, opts, "websocket"); while ((addr = qemu_opt_iter_next(&addriter)) != NULL) { if (vnc_display_get_address(addr, true, reverse, displaynum, to, has_ipv4, has_ipv6, ipv4, ipv6, &wsaddr, errp) < 0) { goto cleanup; } if (*retnsaddr == 1 && (*retsaddr)[0]->type == SOCKET_ADDRESS_TYPE_INET && wsaddr->type == SOCKET_ADDRESS_TYPE_INET && g_str_equal(wsaddr->u.inet.host, "") && !g_str_equal((*retsaddr)[0]->u.inet.host, "")) { g_free(wsaddr->u.inet.host); wsaddr->u.inet.host = g_strdup((*retsaddr)[0]->u.inet.host); } *retwsaddr = g_renew(SocketAddress *, *retwsaddr, *retnwsaddr + 1); (*retwsaddr)[(*retnwsaddr)++] = wsaddr; } ret = 0; cleanup: if (ret < 0) { for (i = 0; i < *retnsaddr; i++) { qapi_free_SocketAddress((*retsaddr)[i]); } g_free(*retsaddr); for (i = 0; i < *retnwsaddr; i++) { qapi_free_SocketAddress((*retwsaddr)[i]); } g_free(*retwsaddr); *retsaddr = *retwsaddr = NULL; *retnsaddr = *retnwsaddr = 0; } return ret; }
{ "code": [ " size_t i;", " for (i = 0; i < *retnsaddr; i++) {", " qapi_free_SocketAddress((*retsaddr)[i]);", " g_free(*retsaddr);", " for (i = 0; i < *retnwsaddr; i++) {", " qapi_free_SocketAddress((*retwsaddr)[i]);", " g_free(*retwsaddr);", " *retsaddr = *retwsaddr = NULL;", " *retnsaddr = *retnwsaddr = 0;", " size_t i;" ], "line_no": [ 35, 187, 189, 193, 195, 197, 201, 203, 205, 35 ] }
static int FUNC_0(QemuOpts *VAR_0, bool VAR_1, SocketAddress ***VAR_2, size_t *VAR_3, SocketAddress ***VAR_4, size_t *VAR_5, Error **VAR_6) { SocketAddress *saddr = NULL; SocketAddress *wsaddr = NULL; QemuOptsIter addriter; const char *VAR_7; int VAR_8 = qemu_opt_get_number(VAR_0, "VAR_8", 0); bool has_ipv4 = qemu_opt_get(VAR_0, "ipv4"); bool has_ipv6 = qemu_opt_get(VAR_0, "ipv6"); bool ipv4 = qemu_opt_get_bool(VAR_0, "ipv4", false); bool ipv6 = qemu_opt_get_bool(VAR_0, "ipv6", false); size_t i; int VAR_9 = -1; int VAR_10 = -1; *VAR_2 = NULL; *VAR_3 = 0; *VAR_4 = NULL; *VAR_5 = 0; VAR_7 = qemu_opt_get(VAR_0, "vnc"); if (VAR_7 == NULL || g_str_equal(VAR_7, "none")) { VAR_10 = 0; goto cleanup; } if (qemu_opt_get(VAR_0, "websocket") && !qcrypto_hash_supports(QCRYPTO_HASH_ALG_SHA1)) { error_setg(VAR_6, "SHA1 hash support is required for websockets"); goto cleanup; } qemu_opt_iter_init(&addriter, VAR_0, "vnc"); while ((VAR_7 = qemu_opt_iter_next(&addriter)) != NULL) { int VAR_11; VAR_11 = vnc_display_get_address(VAR_7, false, VAR_1, 0, VAR_8, has_ipv4, has_ipv6, ipv4, ipv6, &saddr, VAR_6); if (VAR_11 < 0) { goto cleanup; } if (VAR_9 == -1) { VAR_9 = VAR_11; } *VAR_2 = g_renew(SocketAddress *, *VAR_2, *VAR_3 + 1); (*VAR_2)[(*VAR_3)++] = saddr; } if (*VAR_3 > 1) { VAR_9 = -1; } qemu_opt_iter_init(&addriter, VAR_0, "websocket"); while ((VAR_7 = qemu_opt_iter_next(&addriter)) != NULL) { if (vnc_display_get_address(VAR_7, true, VAR_1, VAR_9, VAR_8, has_ipv4, has_ipv6, ipv4, ipv6, &wsaddr, VAR_6) < 0) { goto cleanup; } if (*VAR_3 == 1 && (*VAR_2)[0]->type == SOCKET_ADDRESS_TYPE_INET && wsaddr->type == SOCKET_ADDRESS_TYPE_INET && g_str_equal(wsaddr->u.inet.host, "") && !g_str_equal((*VAR_2)[0]->u.inet.host, "")) { g_free(wsaddr->u.inet.host); wsaddr->u.inet.host = g_strdup((*VAR_2)[0]->u.inet.host); } *VAR_4 = g_renew(SocketAddress *, *VAR_4, *VAR_5 + 1); (*VAR_4)[(*VAR_5)++] = wsaddr; } VAR_10 = 0; cleanup: if (VAR_10 < 0) { for (i = 0; i < *VAR_3; i++) { qapi_free_SocketAddress((*VAR_2)[i]); } g_free(*VAR_2); for (i = 0; i < *VAR_5; i++) { qapi_free_SocketAddress((*VAR_4)[i]); } g_free(*VAR_4); *VAR_2 = *VAR_4 = NULL; *VAR_3 = *VAR_5 = 0; } return VAR_10; }
[ "static int FUNC_0(QemuOpts *VAR_0,\nbool VAR_1,\nSocketAddress ***VAR_2,\nsize_t *VAR_3,\nSocketAddress ***VAR_4,\nsize_t *VAR_5,\nError **VAR_6)\n{", "SocketAddress *saddr = NULL;", "SocketAddress *wsaddr = NULL;", "QemuOptsIter addriter;", "const char *VAR_7;", "int VAR_8 = qemu_opt_get_number(VAR_0, \"VAR_8\", 0);", "bool has_ipv4 = qemu_opt_get(VAR_0, \"ipv4\");", "bool has_ipv6 = qemu_opt_get(VAR_0, \"ipv6\");", "bool ipv4 = qemu_opt_get_bool(VAR_0, \"ipv4\", false);", "bool ipv6 = qemu_opt_get_bool(VAR_0, \"ipv6\", false);", "size_t i;", "int VAR_9 = -1;", "int VAR_10 = -1;", "*VAR_2 = NULL;", "*VAR_3 = 0;", "*VAR_4 = NULL;", "*VAR_5 = 0;", "VAR_7 = qemu_opt_get(VAR_0, \"vnc\");", "if (VAR_7 == NULL || g_str_equal(VAR_7, \"none\")) {", "VAR_10 = 0;", "goto cleanup;", "}", "if (qemu_opt_get(VAR_0, \"websocket\") &&\n!qcrypto_hash_supports(QCRYPTO_HASH_ALG_SHA1)) {", "error_setg(VAR_6,\n\"SHA1 hash support is required for websockets\");", "goto cleanup;", "}", "qemu_opt_iter_init(&addriter, VAR_0, \"vnc\");", "while ((VAR_7 = qemu_opt_iter_next(&addriter)) != NULL) {", "int VAR_11;", "VAR_11 = vnc_display_get_address(VAR_7, false, VAR_1, 0, VAR_8,\nhas_ipv4, has_ipv6,\nipv4, ipv6,\n&saddr, VAR_6);", "if (VAR_11 < 0) {", "goto cleanup;", "}", "if (VAR_9 == -1) {", "VAR_9 = VAR_11;", "}", "*VAR_2 = g_renew(SocketAddress *, *VAR_2, *VAR_3 + 1);", "(*VAR_2)[(*VAR_3)++] = saddr;", "}", "if (*VAR_3 > 1) {", "VAR_9 = -1;", "}", "qemu_opt_iter_init(&addriter, VAR_0, \"websocket\");", "while ((VAR_7 = qemu_opt_iter_next(&addriter)) != NULL) {", "if (vnc_display_get_address(VAR_7, true, VAR_1, VAR_9, VAR_8,\nhas_ipv4, has_ipv6,\nipv4, ipv6,\n&wsaddr, VAR_6) < 0) {", "goto cleanup;", "}", "if (*VAR_3 == 1 &&\n(*VAR_2)[0]->type == SOCKET_ADDRESS_TYPE_INET &&\nwsaddr->type == SOCKET_ADDRESS_TYPE_INET &&\ng_str_equal(wsaddr->u.inet.host, \"\") &&\n!g_str_equal((*VAR_2)[0]->u.inet.host, \"\")) {", "g_free(wsaddr->u.inet.host);", "wsaddr->u.inet.host = g_strdup((*VAR_2)[0]->u.inet.host);", "}", "*VAR_4 = g_renew(SocketAddress *, *VAR_4, *VAR_5 + 1);", "(*VAR_4)[(*VAR_5)++] = wsaddr;", "}", "VAR_10 = 0;", "cleanup:\nif (VAR_10 < 0) {", "for (i = 0; i < *VAR_3; i++) {", "qapi_free_SocketAddress((*VAR_2)[i]);", "}", "g_free(*VAR_2);", "for (i = 0; i < *VAR_5; i++) {", "qapi_free_SocketAddress((*VAR_4)[i]);", "}", "g_free(*VAR_4);", "*VAR_2 = *VAR_4 = NULL;", "*VAR_3 = *VAR_5 = 0;", "}", "return VAR_10;", "}" ]
[ 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, 1, 1, 0, 1, 1, 1, 0, 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 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63, 65 ], [ 67, 69 ], [ 71 ], [ 73 ], [ 77 ], [ 79 ], [ 81 ], [ 83, 85, 87, 89 ], [ 91 ], [ 93 ], [ 95 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 121 ], [ 123 ], [ 125 ], [ 129 ], [ 131 ], [ 133, 135, 137, 139 ], [ 141 ], [ 143 ], [ 155, 157, 159, 161, 163 ], [ 165 ], [ 167 ], [ 169 ], [ 173 ], [ 175 ], [ 177 ], [ 181 ], [ 183, 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ] ]
7,356
uint64_t HELPER(neon_abdl_u64)(uint32_t a, uint32_t b) { uint64_t result; DO_ABD(result, a, b, uint32_t); return result; }
true
qemu
4d9ad7f793605abd9806fc932b3e04e028894565
uint64_t HELPER(neon_abdl_u64)(uint32_t a, uint32_t b) { uint64_t result; DO_ABD(result, a, b, uint32_t); return result; }
{ "code": [ " DO_ABD(result, a, b, uint32_t);" ], "line_no": [ 7 ] }
uint64_t FUNC_0(neon_abdl_u64)(uint32_t a, uint32_t b) { uint64_t result; DO_ABD(result, a, b, uint32_t); return result; }
[ "uint64_t FUNC_0(neon_abdl_u64)(uint32_t a, uint32_t b)\n{", "uint64_t result;", "DO_ABD(result, a, b, uint32_t);", "return result;", "}" ]
[ 0, 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ] ]
7,357
static void virtio_net_handle_tx(VirtIODevice *vdev, VirtQueue *vq) { VirtIONet *n = to_virtio_net(vdev); if (n->tx_waiting) { virtio_queue_set_notification(vq, 1); qemu_del_timer(n->tx_timer); n->tx_waiting = 0; virtio_net_flush_tx(n, vq); } else { qemu_mod_timer(n->tx_timer, qemu_get_clock(vm_clock) + n->tx_timeout); n->tx_waiting = 1; virtio_queue_set_notification(vq, 0); } }
true
qemu
a697a334b3c4d3250e6420f5d38550ea10eb5319
static void virtio_net_handle_tx(VirtIODevice *vdev, VirtQueue *vq) { VirtIONet *n = to_virtio_net(vdev); if (n->tx_waiting) { virtio_queue_set_notification(vq, 1); qemu_del_timer(n->tx_timer); n->tx_waiting = 0; virtio_net_flush_tx(n, vq); } else { qemu_mod_timer(n->tx_timer, qemu_get_clock(vm_clock) + n->tx_timeout); n->tx_waiting = 1; virtio_queue_set_notification(vq, 0); } }
{ "code": [ "static void virtio_net_handle_tx(VirtIODevice *vdev, VirtQueue *vq)", " qemu_mod_timer(n->tx_timer,", " qemu_get_clock(vm_clock) + n->tx_timeout);" ], "line_no": [ 1, 21, 23 ] }
static void FUNC_0(VirtIODevice *VAR_0, VirtQueue *VAR_1) { VirtIONet *n = to_virtio_net(VAR_0); if (n->tx_waiting) { virtio_queue_set_notification(VAR_1, 1); qemu_del_timer(n->tx_timer); n->tx_waiting = 0; virtio_net_flush_tx(n, VAR_1); } else { qemu_mod_timer(n->tx_timer, qemu_get_clock(vm_clock) + n->tx_timeout); n->tx_waiting = 1; virtio_queue_set_notification(VAR_1, 0); } }
[ "static void FUNC_0(VirtIODevice *VAR_0, VirtQueue *VAR_1)\n{", "VirtIONet *n = to_virtio_net(VAR_0);", "if (n->tx_waiting) {", "virtio_queue_set_notification(VAR_1, 1);", "qemu_del_timer(n->tx_timer);", "n->tx_waiting = 0;", "virtio_net_flush_tx(n, VAR_1);", "} else {", "qemu_mod_timer(n->tx_timer,\nqemu_get_clock(vm_clock) + n->tx_timeout);", "n->tx_waiting = 1;", "virtio_queue_set_notification(VAR_1, 0);", "}", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21, 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ] ]
7,358
static void encode_picture(MpegEncContext *s, int picture_number) { int mb_x, mb_y, last_gob, pdif = 0; int i; int bits; MpegEncContext best_s, backup_s; UINT8 bit_buf[7][3000]; //FIXME check that this is ALLWAYS large enogh for a MB s->picture_number = picture_number; s->block_wrap[0]= s->block_wrap[1]= s->block_wrap[2]= s->block_wrap[3]= s->mb_width*2 + 2; s->block_wrap[4]= s->block_wrap[5]= s->mb_width + 2; /* Reset the average MB variance */ s->avg_mb_var = 0; s->mc_mb_var = 0; /* we need to initialize some time vars before we can encode b-frames */ if (s->h263_pred && !s->h263_msmpeg4) ff_set_mpeg4_time(s, s->picture_number); /* Estimate motion for every MB */ if(s->pict_type != I_TYPE){ // int16_t (*tmp)[2]= s->p_mv_table; // s->p_mv_table= s->last_mv_table; // s->last_mv_table= s->mv_table; for(mb_y=0; mb_y < s->mb_height; mb_y++) { s->block_index[0]= s->block_wrap[0]*(mb_y*2 + 1) - 1; s->block_index[1]= s->block_wrap[0]*(mb_y*2 + 1); s->block_index[2]= s->block_wrap[0]*(mb_y*2 + 2) - 1; s->block_index[3]= s->block_wrap[0]*(mb_y*2 + 2); for(mb_x=0; mb_x < s->mb_width; mb_x++) { s->mb_x = mb_x; s->mb_y = mb_y; s->block_index[0]+=2; s->block_index[1]+=2; s->block_index[2]+=2; s->block_index[3]+=2; /* compute motion vector & mb_type and store in context */ if(s->pict_type==B_TYPE) ff_estimate_b_frame_motion(s, mb_x, mb_y); else ff_estimate_p_frame_motion(s, mb_x, mb_y); // s->mb_type[mb_y*s->mb_width + mb_x]=MB_TYPE_INTER; } } emms_c(); }else if(s->pict_type == I_TYPE){ /* I-Frame */ //FIXME do we need to zero them? memset(s->motion_val[0], 0, sizeof(INT16)*(s->mb_width*2 + 2)*(s->mb_height*2 + 2)*2); memset(s->p_mv_table , 0, sizeof(INT16)*(s->mb_width+2)*(s->mb_height+2)*2); memset(s->mb_type , MB_TYPE_INTRA, sizeof(UINT8)*s->mb_width*s->mb_height); } if(s->avg_mb_var < s->mc_mb_var && s->pict_type == P_TYPE){ //FIXME subtract MV bits s->pict_type= I_TYPE; memset(s->mb_type , MB_TYPE_INTRA, sizeof(UINT8)*s->mb_width*s->mb_height); if(s->max_b_frames==0){ s->input_pict_type= I_TYPE; s->input_picture_in_gop_number=0; } //printf("Scene change detected, encoding as I Frame\n"); } if(s->pict_type==P_TYPE || s->pict_type==S_TYPE) s->f_code= ff_get_best_fcode(s, s->p_mv_table, MB_TYPE_INTER); ff_fix_long_p_mvs(s); if(s->pict_type==B_TYPE){ s->f_code= ff_get_best_fcode(s, s->b_forw_mv_table, MB_TYPE_FORWARD); s->b_code= ff_get_best_fcode(s, s->b_back_mv_table, MB_TYPE_BACKWARD); ff_fix_long_b_mvs(s, s->b_forw_mv_table, s->f_code, MB_TYPE_FORWARD); ff_fix_long_b_mvs(s, s->b_back_mv_table, s->b_code, MB_TYPE_BACKWARD); ff_fix_long_b_mvs(s, s->b_bidir_forw_mv_table, s->f_code, MB_TYPE_BIDIR); ff_fix_long_b_mvs(s, s->b_bidir_back_mv_table, s->b_code, MB_TYPE_BIDIR); } //printf("f_code %d ///\n", s->f_code); // printf("%d %d\n", s->avg_mb_var, s->mc_mb_var); if(s->flags&CODEC_FLAG_PASS2) s->qscale = ff_rate_estimate_qscale_pass2(s); else if (!s->fixed_qscale) s->qscale = ff_rate_estimate_qscale(s); /* precompute matrix */ if (s->out_format == FMT_MJPEG) { /* for mjpeg, we do include qscale in the matrix */ s->intra_matrix[0] = default_intra_matrix[0]; for(i=1;i<64;i++) s->intra_matrix[i] = (default_intra_matrix[i] * s->qscale) >> 3; convert_matrix(s->q_intra_matrix, s->q_intra_matrix16, s->intra_matrix, 8); } else { convert_matrix(s->q_intra_matrix, s->q_intra_matrix16, s->intra_matrix, s->qscale); convert_matrix(s->q_non_intra_matrix, s->q_non_intra_matrix16, s->non_intra_matrix, s->qscale); } s->last_bits= get_bit_count(&s->pb); switch(s->out_format) { case FMT_MJPEG: mjpeg_picture_header(s); break; case FMT_H263: if (s->h263_msmpeg4) msmpeg4_encode_picture_header(s, picture_number); else if (s->h263_pred) mpeg4_encode_picture_header(s, picture_number); else if (s->h263_rv10) rv10_encode_picture_header(s, picture_number); else h263_encode_picture_header(s, picture_number); break; case FMT_MPEG1: mpeg1_encode_picture_header(s, picture_number); break; } bits= get_bit_count(&s->pb); s->header_bits= bits - s->last_bits; s->last_bits= bits; s->mv_bits=0; s->misc_bits=0; s->i_tex_bits=0; s->p_tex_bits=0; s->i_count=0; s->p_count=0; s->skip_count=0; /* init last dc values */ /* note: quant matrix value (8) is implied here */ s->last_dc[0] = 128; s->last_dc[1] = 128; s->last_dc[2] = 128; s->mb_incr = 1; s->last_mv[0][0][0] = 0; s->last_mv[0][0][1] = 0; /* Get the GOB height based on picture height */ if (s->out_format == FMT_H263 && !s->h263_pred && !s->h263_msmpeg4) { if (s->height <= 400) s->gob_index = 1; else if (s->height <= 800) s->gob_index = 2; else s->gob_index = 4; } s->avg_mb_var = s->avg_mb_var / s->mb_num; for(mb_y=0; mb_y < s->mb_height; mb_y++) { /* Put GOB header based on RTP MTU */ /* TODO: Put all this stuff in a separate generic function */ if (s->rtp_mode) { if (!mb_y) { s->ptr_lastgob = s->pb.buf; s->ptr_last_mb_line = s->pb.buf; } else if (s->out_format == FMT_H263 && !s->h263_pred && !s->h263_msmpeg4 && !(mb_y % s->gob_index)) { last_gob = h263_encode_gob_header(s, mb_y); if (last_gob) { s->first_gob_line = 1; } } } s->block_index[0]= s->block_wrap[0]*(mb_y*2 + 1) - 1; s->block_index[1]= s->block_wrap[0]*(mb_y*2 + 1); s->block_index[2]= s->block_wrap[0]*(mb_y*2 + 2) - 1; s->block_index[3]= s->block_wrap[0]*(mb_y*2 + 2); s->block_index[4]= s->block_wrap[4]*(mb_y + 1) + s->block_wrap[0]*(s->mb_height*2 + 2); s->block_index[5]= s->block_wrap[4]*(mb_y + 1 + s->mb_height + 2) + s->block_wrap[0]*(s->mb_height*2 + 2); for(mb_x=0; mb_x < s->mb_width; mb_x++) { const int mb_type= s->mb_type[mb_y * s->mb_width + mb_x]; const int xy= (mb_y+1) * (s->mb_width+2) + mb_x + 1; PutBitContext pb; int d; int dmin=10000000; int best=0; s->mb_x = mb_x; s->mb_y = mb_y; s->block_index[0]+=2; s->block_index[1]+=2; s->block_index[2]+=2; s->block_index[3]+=2; s->block_index[4]++; s->block_index[5]++; if(mb_type & (mb_type-1)){ // more than 1 MB type possible int next_block=0; pb= s->pb; copy_context_before_encode(&backup_s, s, -1); if(mb_type&MB_TYPE_INTER){ s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_16X16; s->mb_intra= 0; s->mv[0][0][0] = s->p_mv_table[xy][0]; s->mv[0][0][1] = s->p_mv_table[xy][1]; init_put_bits(&s->pb, bit_buf[1], 3000, NULL, NULL); s->block= s->blocks[next_block]; s->last_bits= 0; //done in copy_context_before_encode but we skip that here encode_mb(s, s->mv[0][0][0], s->mv[0][0][1]); d= get_bit_count(&s->pb); if(d<dmin){ flush_put_bits(&s->pb); dmin=d; copy_context_after_encode(&best_s, s, MB_TYPE_INTER); best=1; next_block^=1; } } if(mb_type&MB_TYPE_INTER4V){ copy_context_before_encode(s, &backup_s, MB_TYPE_INTER4V); s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_8X8; s->mb_intra= 0; for(i=0; i<4; i++){ s->mv[0][i][0] = s->motion_val[s->block_index[i]][0]; s->mv[0][i][1] = s->motion_val[s->block_index[i]][1]; } init_put_bits(&s->pb, bit_buf[2], 3000, NULL, NULL); s->block= s->blocks[next_block]; encode_mb(s, 0, 0); d= get_bit_count(&s->pb); if(d<dmin){ flush_put_bits(&s->pb); dmin=d; copy_context_after_encode(&best_s, s, MB_TYPE_INTER4V); best=2; next_block^=1; } } if(mb_type&MB_TYPE_FORWARD){ copy_context_before_encode(s, &backup_s, MB_TYPE_FORWARD); s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_16X16; s->mb_intra= 0; s->mv[0][0][0] = s->b_forw_mv_table[xy][0]; s->mv[0][0][1] = s->b_forw_mv_table[xy][1]; init_put_bits(&s->pb, bit_buf[3], 3000, NULL, NULL); s->block= s->blocks[next_block]; encode_mb(s, s->mv[0][0][0], s->mv[0][0][1]); d= get_bit_count(&s->pb); if(d<dmin){ flush_put_bits(&s->pb); dmin=d; copy_context_after_encode(&best_s, s, MB_TYPE_FORWARD); best=3; next_block^=1; } } if(mb_type&MB_TYPE_BACKWARD){ copy_context_before_encode(s, &backup_s, MB_TYPE_BACKWARD); s->mv_dir = MV_DIR_BACKWARD; s->mv_type = MV_TYPE_16X16; s->mb_intra= 0; s->mv[1][0][0] = s->b_back_mv_table[xy][0]; s->mv[1][0][1] = s->b_back_mv_table[xy][1]; init_put_bits(&s->pb, bit_buf[4], 3000, NULL, NULL); s->block= s->blocks[next_block]; encode_mb(s, s->mv[1][0][0], s->mv[1][0][1]); d= get_bit_count(&s->pb); if(d<dmin){ flush_put_bits(&s->pb); dmin=d; copy_context_after_encode(&best_s, s, MB_TYPE_BACKWARD); best=4; next_block^=1; } } if(mb_type&MB_TYPE_BIDIR){ copy_context_before_encode(s, &backup_s, MB_TYPE_BIDIR); s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD; s->mv_type = MV_TYPE_16X16; s->mb_intra= 0; s->mv[0][0][0] = s->b_bidir_forw_mv_table[xy][0]; s->mv[0][0][1] = s->b_bidir_forw_mv_table[xy][1]; s->mv[1][0][0] = s->b_bidir_back_mv_table[xy][0]; s->mv[1][0][1] = s->b_bidir_back_mv_table[xy][1]; init_put_bits(&s->pb, bit_buf[5], 3000, NULL, NULL); s->block= s->blocks[next_block]; encode_mb(s, 0, 0); d= get_bit_count(&s->pb); if(d<dmin){ flush_put_bits(&s->pb); dmin=d; copy_context_after_encode(&best_s, s, MB_TYPE_BIDIR); best=5; next_block^=1; } } if(mb_type&MB_TYPE_DIRECT){ copy_context_before_encode(s, &backup_s, MB_TYPE_DIRECT); s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD | MV_DIRECT; s->mv_type = MV_TYPE_16X16; //FIXME s->mb_intra= 0; s->mv[0][0][0] = s->b_direct_forw_mv_table[xy][0]; s->mv[0][0][1] = s->b_direct_forw_mv_table[xy][1]; s->mv[1][0][0] = s->b_direct_back_mv_table[xy][0]; s->mv[1][0][1] = s->b_direct_back_mv_table[xy][1]; init_put_bits(&s->pb, bit_buf[6], 3000, NULL, NULL); s->block= s->blocks[next_block]; encode_mb(s, s->b_direct_mv_table[xy][0], s->b_direct_mv_table[xy][1]); d= get_bit_count(&s->pb); if(d<dmin){ flush_put_bits(&s->pb); dmin=d; copy_context_after_encode(&best_s, s, MB_TYPE_DIRECT); best=6; next_block^=1; } } if(mb_type&MB_TYPE_INTRA){ copy_context_before_encode(s, &backup_s, MB_TYPE_INTRA); s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_16X16; s->mb_intra= 1; s->mv[0][0][0] = 0; s->mv[0][0][1] = 0; init_put_bits(&s->pb, bit_buf[0], 3000, NULL, NULL); s->block= s->blocks[next_block]; encode_mb(s, 0, 0); d= get_bit_count(&s->pb); if(d<dmin){ flush_put_bits(&s->pb); dmin=d; copy_context_after_encode(&best_s, s, MB_TYPE_INTRA); best=0; next_block^=1; } /* force cleaning of ac/dc pred stuff if needed ... */ if(s->h263_pred || s->h263_aic) s->mbintra_table[mb_x + mb_y*s->mb_width]=1; } copy_context_after_encode(s, &best_s, -1); copy_bits(&pb, bit_buf[best], dmin); s->pb= pb; s->last_bits= get_bit_count(&s->pb); } else { int motion_x, motion_y; s->mv_type=MV_TYPE_16X16; // only one MB-Type possible switch(mb_type){ case MB_TYPE_INTRA: s->mv_dir = MV_DIR_FORWARD; s->mb_intra= 1; motion_x= s->mv[0][0][0] = 0; motion_y= s->mv[0][0][1] = 0; break; case MB_TYPE_INTER: s->mv_dir = MV_DIR_FORWARD; s->mb_intra= 0; motion_x= s->mv[0][0][0] = s->p_mv_table[xy][0]; motion_y= s->mv[0][0][1] = s->p_mv_table[xy][1]; break; case MB_TYPE_DIRECT: s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD | MV_DIRECT; s->mb_intra= 0; motion_x=s->b_direct_mv_table[xy][0]; motion_y=s->b_direct_mv_table[xy][1]; s->mv[0][0][0] = s->b_direct_forw_mv_table[xy][0]; s->mv[0][0][1] = s->b_direct_forw_mv_table[xy][1]; s->mv[1][0][0] = s->b_direct_back_mv_table[xy][0]; s->mv[1][0][1] = s->b_direct_back_mv_table[xy][1]; break; case MB_TYPE_BIDIR: s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD; s->mb_intra= 0; motion_x=0; motion_y=0; s->mv[0][0][0] = s->b_bidir_forw_mv_table[xy][0]; s->mv[0][0][1] = s->b_bidir_forw_mv_table[xy][1]; s->mv[1][0][0] = s->b_bidir_back_mv_table[xy][0]; s->mv[1][0][1] = s->b_bidir_back_mv_table[xy][1]; break; case MB_TYPE_BACKWARD: s->mv_dir = MV_DIR_BACKWARD; s->mb_intra= 0; motion_x= s->mv[1][0][0] = s->b_back_mv_table[xy][0]; motion_y= s->mv[1][0][1] = s->b_back_mv_table[xy][1]; break; case MB_TYPE_FORWARD: s->mv_dir = MV_DIR_FORWARD; s->mb_intra= 0; motion_x= s->mv[0][0][0] = s->b_forw_mv_table[xy][0]; motion_y= s->mv[0][0][1] = s->b_forw_mv_table[xy][1]; // printf(" %d %d ", motion_x, motion_y); break; default: motion_x=motion_y=0; //gcc warning fix printf("illegal MB type\n"); } encode_mb(s, motion_x, motion_y); } /* clean the MV table in IPS frames for direct mode in B frames */ if(s->mb_intra /* && I,P,S_TYPE */){ s->p_mv_table[xy][0]=0; s->p_mv_table[xy][1]=0; } MPV_decode_mb(s, s->block); } /* Obtain average GOB size for RTP */ if (s->rtp_mode) { if (!mb_y) s->mb_line_avgsize = pbBufPtr(&s->pb) - s->ptr_last_mb_line; else if (!(mb_y % s->gob_index)) { s->mb_line_avgsize = (s->mb_line_avgsize + pbBufPtr(&s->pb) - s->ptr_last_mb_line) >> 1; s->ptr_last_mb_line = pbBufPtr(&s->pb); } //fprintf(stderr, "\nMB line: %d\tSize: %u\tAvg. Size: %u", s->mb_y, // (s->pb.buf_ptr - s->ptr_last_mb_line), s->mb_line_avgsize); s->first_gob_line = 0; } } emms_c(); if (s->h263_msmpeg4 && s->msmpeg4_version<4 && s->pict_type == I_TYPE) msmpeg4_encode_ext_header(s); //if (s->gob_number) // fprintf(stderr,"\nNumber of GOB: %d", s->gob_number); /* Send the last GOB if RTP */ if (s->rtp_mode) { flush_put_bits(&s->pb); pdif = pbBufPtr(&s->pb) - s->ptr_lastgob; /* Call the RTP callback to send the last GOB */ if (s->rtp_callback) s->rtp_callback(s->ptr_lastgob, pdif, s->gob_number); s->ptr_lastgob = pbBufPtr(&s->pb); //fprintf(stderr,"\nGOB: %2d size: %d (last)", s->gob_number, pdif); } }
true
FFmpeg
d7e9533aa06f4073a27812349b35ba5fede11ca1
static void encode_picture(MpegEncContext *s, int picture_number) { int mb_x, mb_y, last_gob, pdif = 0; int i; int bits; MpegEncContext best_s, backup_s; UINT8 bit_buf[7][3000]; s->picture_number = picture_number; s->block_wrap[0]= s->block_wrap[1]= s->block_wrap[2]= s->block_wrap[3]= s->mb_width*2 + 2; s->block_wrap[4]= s->block_wrap[5]= s->mb_width + 2; s->avg_mb_var = 0; s->mc_mb_var = 0; if (s->h263_pred && !s->h263_msmpeg4) ff_set_mpeg4_time(s, s->picture_number); if(s->pict_type != I_TYPE){ for(mb_y=0; mb_y < s->mb_height; mb_y++) { s->block_index[0]= s->block_wrap[0]*(mb_y*2 + 1) - 1; s->block_index[1]= s->block_wrap[0]*(mb_y*2 + 1); s->block_index[2]= s->block_wrap[0]*(mb_y*2 + 2) - 1; s->block_index[3]= s->block_wrap[0]*(mb_y*2 + 2); for(mb_x=0; mb_x < s->mb_width; mb_x++) { s->mb_x = mb_x; s->mb_y = mb_y; s->block_index[0]+=2; s->block_index[1]+=2; s->block_index[2]+=2; s->block_index[3]+=2; if(s->pict_type==B_TYPE) ff_estimate_b_frame_motion(s, mb_x, mb_y); else ff_estimate_p_frame_motion(s, mb_x, mb_y); } } emms_c(); }else if(s->pict_type == I_TYPE){ memset(s->motion_val[0], 0, sizeof(INT16)*(s->mb_width*2 + 2)*(s->mb_height*2 + 2)*2); memset(s->p_mv_table , 0, sizeof(INT16)*(s->mb_width+2)*(s->mb_height+2)*2); memset(s->mb_type , MB_TYPE_INTRA, sizeof(UINT8)*s->mb_width*s->mb_height); } if(s->avg_mb_var < s->mc_mb_var && s->pict_type == P_TYPE){ s->pict_type= I_TYPE; memset(s->mb_type , MB_TYPE_INTRA, sizeof(UINT8)*s->mb_width*s->mb_height); if(s->max_b_frames==0){ s->input_pict_type= I_TYPE; s->input_picture_in_gop_number=0; } } if(s->pict_type==P_TYPE || s->pict_type==S_TYPE) s->f_code= ff_get_best_fcode(s, s->p_mv_table, MB_TYPE_INTER); ff_fix_long_p_mvs(s); if(s->pict_type==B_TYPE){ s->f_code= ff_get_best_fcode(s, s->b_forw_mv_table, MB_TYPE_FORWARD); s->b_code= ff_get_best_fcode(s, s->b_back_mv_table, MB_TYPE_BACKWARD); ff_fix_long_b_mvs(s, s->b_forw_mv_table, s->f_code, MB_TYPE_FORWARD); ff_fix_long_b_mvs(s, s->b_back_mv_table, s->b_code, MB_TYPE_BACKWARD); ff_fix_long_b_mvs(s, s->b_bidir_forw_mv_table, s->f_code, MB_TYPE_BIDIR); ff_fix_long_b_mvs(s, s->b_bidir_back_mv_table, s->b_code, MB_TYPE_BIDIR); } if(s->flags&CODEC_FLAG_PASS2) s->qscale = ff_rate_estimate_qscale_pass2(s); else if (!s->fixed_qscale) s->qscale = ff_rate_estimate_qscale(s); if (s->out_format == FMT_MJPEG) { s->intra_matrix[0] = default_intra_matrix[0]; for(i=1;i<64;i++) s->intra_matrix[i] = (default_intra_matrix[i] * s->qscale) >> 3; convert_matrix(s->q_intra_matrix, s->q_intra_matrix16, s->intra_matrix, 8); } else { convert_matrix(s->q_intra_matrix, s->q_intra_matrix16, s->intra_matrix, s->qscale); convert_matrix(s->q_non_intra_matrix, s->q_non_intra_matrix16, s->non_intra_matrix, s->qscale); } s->last_bits= get_bit_count(&s->pb); switch(s->out_format) { case FMT_MJPEG: mjpeg_picture_header(s); break; case FMT_H263: if (s->h263_msmpeg4) msmpeg4_encode_picture_header(s, picture_number); else if (s->h263_pred) mpeg4_encode_picture_header(s, picture_number); else if (s->h263_rv10) rv10_encode_picture_header(s, picture_number); else h263_encode_picture_header(s, picture_number); break; case FMT_MPEG1: mpeg1_encode_picture_header(s, picture_number); break; } bits= get_bit_count(&s->pb); s->header_bits= bits - s->last_bits; s->last_bits= bits; s->mv_bits=0; s->misc_bits=0; s->i_tex_bits=0; s->p_tex_bits=0; s->i_count=0; s->p_count=0; s->skip_count=0; s->last_dc[0] = 128; s->last_dc[1] = 128; s->last_dc[2] = 128; s->mb_incr = 1; s->last_mv[0][0][0] = 0; s->last_mv[0][0][1] = 0; if (s->out_format == FMT_H263 && !s->h263_pred && !s->h263_msmpeg4) { if (s->height <= 400) s->gob_index = 1; else if (s->height <= 800) s->gob_index = 2; else s->gob_index = 4; } s->avg_mb_var = s->avg_mb_var / s->mb_num; for(mb_y=0; mb_y < s->mb_height; mb_y++) { if (s->rtp_mode) { if (!mb_y) { s->ptr_lastgob = s->pb.buf; s->ptr_last_mb_line = s->pb.buf; } else if (s->out_format == FMT_H263 && !s->h263_pred && !s->h263_msmpeg4 && !(mb_y % s->gob_index)) { last_gob = h263_encode_gob_header(s, mb_y); if (last_gob) { s->first_gob_line = 1; } } } s->block_index[0]= s->block_wrap[0]*(mb_y*2 + 1) - 1; s->block_index[1]= s->block_wrap[0]*(mb_y*2 + 1); s->block_index[2]= s->block_wrap[0]*(mb_y*2 + 2) - 1; s->block_index[3]= s->block_wrap[0]*(mb_y*2 + 2); s->block_index[4]= s->block_wrap[4]*(mb_y + 1) + s->block_wrap[0]*(s->mb_height*2 + 2); s->block_index[5]= s->block_wrap[4]*(mb_y + 1 + s->mb_height + 2) + s->block_wrap[0]*(s->mb_height*2 + 2); for(mb_x=0; mb_x < s->mb_width; mb_x++) { const int mb_type= s->mb_type[mb_y * s->mb_width + mb_x]; const int xy= (mb_y+1) * (s->mb_width+2) + mb_x + 1; PutBitContext pb; int d; int dmin=10000000; int best=0; s->mb_x = mb_x; s->mb_y = mb_y; s->block_index[0]+=2; s->block_index[1]+=2; s->block_index[2]+=2; s->block_index[3]+=2; s->block_index[4]++; s->block_index[5]++; if(mb_type & (mb_type-1)){ int next_block=0; pb= s->pb; copy_context_before_encode(&backup_s, s, -1); if(mb_type&MB_TYPE_INTER){ s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_16X16; s->mb_intra= 0; s->mv[0][0][0] = s->p_mv_table[xy][0]; s->mv[0][0][1] = s->p_mv_table[xy][1]; init_put_bits(&s->pb, bit_buf[1], 3000, NULL, NULL); s->block= s->blocks[next_block]; s->last_bits= 0; encode_mb(s, s->mv[0][0][0], s->mv[0][0][1]); d= get_bit_count(&s->pb); if(d<dmin){ flush_put_bits(&s->pb); dmin=d; copy_context_after_encode(&best_s, s, MB_TYPE_INTER); best=1; next_block^=1; } } if(mb_type&MB_TYPE_INTER4V){ copy_context_before_encode(s, &backup_s, MB_TYPE_INTER4V); s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_8X8; s->mb_intra= 0; for(i=0; i<4; i++){ s->mv[0][i][0] = s->motion_val[s->block_index[i]][0]; s->mv[0][i][1] = s->motion_val[s->block_index[i]][1]; } init_put_bits(&s->pb, bit_buf[2], 3000, NULL, NULL); s->block= s->blocks[next_block]; encode_mb(s, 0, 0); d= get_bit_count(&s->pb); if(d<dmin){ flush_put_bits(&s->pb); dmin=d; copy_context_after_encode(&best_s, s, MB_TYPE_INTER4V); best=2; next_block^=1; } } if(mb_type&MB_TYPE_FORWARD){ copy_context_before_encode(s, &backup_s, MB_TYPE_FORWARD); s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_16X16; s->mb_intra= 0; s->mv[0][0][0] = s->b_forw_mv_table[xy][0]; s->mv[0][0][1] = s->b_forw_mv_table[xy][1]; init_put_bits(&s->pb, bit_buf[3], 3000, NULL, NULL); s->block= s->blocks[next_block]; encode_mb(s, s->mv[0][0][0], s->mv[0][0][1]); d= get_bit_count(&s->pb); if(d<dmin){ flush_put_bits(&s->pb); dmin=d; copy_context_after_encode(&best_s, s, MB_TYPE_FORWARD); best=3; next_block^=1; } } if(mb_type&MB_TYPE_BACKWARD){ copy_context_before_encode(s, &backup_s, MB_TYPE_BACKWARD); s->mv_dir = MV_DIR_BACKWARD; s->mv_type = MV_TYPE_16X16; s->mb_intra= 0; s->mv[1][0][0] = s->b_back_mv_table[xy][0]; s->mv[1][0][1] = s->b_back_mv_table[xy][1]; init_put_bits(&s->pb, bit_buf[4], 3000, NULL, NULL); s->block= s->blocks[next_block]; encode_mb(s, s->mv[1][0][0], s->mv[1][0][1]); d= get_bit_count(&s->pb); if(d<dmin){ flush_put_bits(&s->pb); dmin=d; copy_context_after_encode(&best_s, s, MB_TYPE_BACKWARD); best=4; next_block^=1; } } if(mb_type&MB_TYPE_BIDIR){ copy_context_before_encode(s, &backup_s, MB_TYPE_BIDIR); s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD; s->mv_type = MV_TYPE_16X16; s->mb_intra= 0; s->mv[0][0][0] = s->b_bidir_forw_mv_table[xy][0]; s->mv[0][0][1] = s->b_bidir_forw_mv_table[xy][1]; s->mv[1][0][0] = s->b_bidir_back_mv_table[xy][0]; s->mv[1][0][1] = s->b_bidir_back_mv_table[xy][1]; init_put_bits(&s->pb, bit_buf[5], 3000, NULL, NULL); s->block= s->blocks[next_block]; encode_mb(s, 0, 0); d= get_bit_count(&s->pb); if(d<dmin){ flush_put_bits(&s->pb); dmin=d; copy_context_after_encode(&best_s, s, MB_TYPE_BIDIR); best=5; next_block^=1; } } if(mb_type&MB_TYPE_DIRECT){ copy_context_before_encode(s, &backup_s, MB_TYPE_DIRECT); s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD | MV_DIRECT; s->mv_type = MV_TYPE_16X16; s->mb_intra= 0; s->mv[0][0][0] = s->b_direct_forw_mv_table[xy][0]; s->mv[0][0][1] = s->b_direct_forw_mv_table[xy][1]; s->mv[1][0][0] = s->b_direct_back_mv_table[xy][0]; s->mv[1][0][1] = s->b_direct_back_mv_table[xy][1]; init_put_bits(&s->pb, bit_buf[6], 3000, NULL, NULL); s->block= s->blocks[next_block]; encode_mb(s, s->b_direct_mv_table[xy][0], s->b_direct_mv_table[xy][1]); d= get_bit_count(&s->pb); if(d<dmin){ flush_put_bits(&s->pb); dmin=d; copy_context_after_encode(&best_s, s, MB_TYPE_DIRECT); best=6; next_block^=1; } } if(mb_type&MB_TYPE_INTRA){ copy_context_before_encode(s, &backup_s, MB_TYPE_INTRA); s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_16X16; s->mb_intra= 1; s->mv[0][0][0] = 0; s->mv[0][0][1] = 0; init_put_bits(&s->pb, bit_buf[0], 3000, NULL, NULL); s->block= s->blocks[next_block]; encode_mb(s, 0, 0); d= get_bit_count(&s->pb); if(d<dmin){ flush_put_bits(&s->pb); dmin=d; copy_context_after_encode(&best_s, s, MB_TYPE_INTRA); best=0; next_block^=1; } if(s->h263_pred || s->h263_aic) s->mbintra_table[mb_x + mb_y*s->mb_width]=1; } copy_context_after_encode(s, &best_s, -1); copy_bits(&pb, bit_buf[best], dmin); s->pb= pb; s->last_bits= get_bit_count(&s->pb); } else { int motion_x, motion_y; s->mv_type=MV_TYPE_16X16; switch(mb_type){ case MB_TYPE_INTRA: s->mv_dir = MV_DIR_FORWARD; s->mb_intra= 1; motion_x= s->mv[0][0][0] = 0; motion_y= s->mv[0][0][1] = 0; break; case MB_TYPE_INTER: s->mv_dir = MV_DIR_FORWARD; s->mb_intra= 0; motion_x= s->mv[0][0][0] = s->p_mv_table[xy][0]; motion_y= s->mv[0][0][1] = s->p_mv_table[xy][1]; break; case MB_TYPE_DIRECT: s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD | MV_DIRECT; s->mb_intra= 0; motion_x=s->b_direct_mv_table[xy][0]; motion_y=s->b_direct_mv_table[xy][1]; s->mv[0][0][0] = s->b_direct_forw_mv_table[xy][0]; s->mv[0][0][1] = s->b_direct_forw_mv_table[xy][1]; s->mv[1][0][0] = s->b_direct_back_mv_table[xy][0]; s->mv[1][0][1] = s->b_direct_back_mv_table[xy][1]; break; case MB_TYPE_BIDIR: s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD; s->mb_intra= 0; motion_x=0; motion_y=0; s->mv[0][0][0] = s->b_bidir_forw_mv_table[xy][0]; s->mv[0][0][1] = s->b_bidir_forw_mv_table[xy][1]; s->mv[1][0][0] = s->b_bidir_back_mv_table[xy][0]; s->mv[1][0][1] = s->b_bidir_back_mv_table[xy][1]; break; case MB_TYPE_BACKWARD: s->mv_dir = MV_DIR_BACKWARD; s->mb_intra= 0; motion_x= s->mv[1][0][0] = s->b_back_mv_table[xy][0]; motion_y= s->mv[1][0][1] = s->b_back_mv_table[xy][1]; break; case MB_TYPE_FORWARD: s->mv_dir = MV_DIR_FORWARD; s->mb_intra= 0; motion_x= s->mv[0][0][0] = s->b_forw_mv_table[xy][0]; motion_y= s->mv[0][0][1] = s->b_forw_mv_table[xy][1]; break; default: motion_x=motion_y=0; printf("illegal MB type\n"); } encode_mb(s, motion_x, motion_y); } if(s->mb_intra ){ s->p_mv_table[xy][0]=0; s->p_mv_table[xy][1]=0; } MPV_decode_mb(s, s->block); } if (s->rtp_mode) { if (!mb_y) s->mb_line_avgsize = pbBufPtr(&s->pb) - s->ptr_last_mb_line; else if (!(mb_y % s->gob_index)) { s->mb_line_avgsize = (s->mb_line_avgsize + pbBufPtr(&s->pb) - s->ptr_last_mb_line) >> 1; s->ptr_last_mb_line = pbBufPtr(&s->pb); } s->first_gob_line = 0; } } emms_c(); if (s->h263_msmpeg4 && s->msmpeg4_version<4 && s->pict_type == I_TYPE) msmpeg4_encode_ext_header(s); if (s->rtp_mode) { flush_put_bits(&s->pb); pdif = pbBufPtr(&s->pb) - s->ptr_lastgob; if (s->rtp_callback) s->rtp_callback(s->ptr_lastgob, pdif, s->gob_number); s->ptr_lastgob = pbBufPtr(&s->pb); } }
{ "code": [ " int i;", " } else {", " convert_matrix(s->q_intra_matrix, s->q_intra_matrix16, s->intra_matrix, 8);", " } else {", " convert_matrix(s->q_intra_matrix, s->q_intra_matrix16, s->intra_matrix, s->qscale);", " convert_matrix(s->q_non_intra_matrix, s->q_non_intra_matrix16, s->non_intra_matrix, s->qscale);", " } else {" ], "line_no": [ 7, 203, 201, 203, 205, 207, 707 ] }
static void FUNC_0(MpegEncContext *VAR_0, int VAR_1) { int VAR_2, VAR_3, VAR_4, VAR_5 = 0; int VAR_6; int VAR_7; MpegEncContext best_s, backup_s; UINT8 bit_buf[7][3000]; VAR_0->VAR_1 = VAR_1; VAR_0->block_wrap[0]= VAR_0->block_wrap[1]= VAR_0->block_wrap[2]= VAR_0->block_wrap[3]= VAR_0->mb_width*2 + 2; VAR_0->block_wrap[4]= VAR_0->block_wrap[5]= VAR_0->mb_width + 2; VAR_0->avg_mb_var = 0; VAR_0->mc_mb_var = 0; if (VAR_0->h263_pred && !VAR_0->h263_msmpeg4) ff_set_mpeg4_time(VAR_0, VAR_0->VAR_1); if(VAR_0->pict_type != I_TYPE){ for(VAR_3=0; VAR_3 < VAR_0->mb_height; VAR_3++) { VAR_0->block_index[0]= VAR_0->block_wrap[0]*(VAR_3*2 + 1) - 1; VAR_0->block_index[1]= VAR_0->block_wrap[0]*(VAR_3*2 + 1); VAR_0->block_index[2]= VAR_0->block_wrap[0]*(VAR_3*2 + 2) - 1; VAR_0->block_index[3]= VAR_0->block_wrap[0]*(VAR_3*2 + 2); for(VAR_2=0; VAR_2 < VAR_0->mb_width; VAR_2++) { VAR_0->VAR_2 = VAR_2; VAR_0->VAR_3 = VAR_3; VAR_0->block_index[0]+=2; VAR_0->block_index[1]+=2; VAR_0->block_index[2]+=2; VAR_0->block_index[3]+=2; if(VAR_0->pict_type==B_TYPE) ff_estimate_b_frame_motion(VAR_0, VAR_2, VAR_3); else ff_estimate_p_frame_motion(VAR_0, VAR_2, VAR_3); } } emms_c(); }else if(VAR_0->pict_type == I_TYPE){ memset(VAR_0->motion_val[0], 0, sizeof(INT16)*(VAR_0->mb_width*2 + 2)*(VAR_0->mb_height*2 + 2)*2); memset(VAR_0->p_mv_table , 0, sizeof(INT16)*(VAR_0->mb_width+2)*(VAR_0->mb_height+2)*2); memset(VAR_0->mb_type , MB_TYPE_INTRA, sizeof(UINT8)*VAR_0->mb_width*VAR_0->mb_height); } if(VAR_0->avg_mb_var < VAR_0->mc_mb_var && VAR_0->pict_type == P_TYPE){ VAR_0->pict_type= I_TYPE; memset(VAR_0->mb_type , MB_TYPE_INTRA, sizeof(UINT8)*VAR_0->mb_width*VAR_0->mb_height); if(VAR_0->max_b_frames==0){ VAR_0->input_pict_type= I_TYPE; VAR_0->input_picture_in_gop_number=0; } } if(VAR_0->pict_type==P_TYPE || VAR_0->pict_type==S_TYPE) VAR_0->f_code= ff_get_best_fcode(VAR_0, VAR_0->p_mv_table, MB_TYPE_INTER); ff_fix_long_p_mvs(VAR_0); if(VAR_0->pict_type==B_TYPE){ VAR_0->f_code= ff_get_best_fcode(VAR_0, VAR_0->b_forw_mv_table, MB_TYPE_FORWARD); VAR_0->b_code= ff_get_best_fcode(VAR_0, VAR_0->b_back_mv_table, MB_TYPE_BACKWARD); ff_fix_long_b_mvs(VAR_0, VAR_0->b_forw_mv_table, VAR_0->f_code, MB_TYPE_FORWARD); ff_fix_long_b_mvs(VAR_0, VAR_0->b_back_mv_table, VAR_0->b_code, MB_TYPE_BACKWARD); ff_fix_long_b_mvs(VAR_0, VAR_0->b_bidir_forw_mv_table, VAR_0->f_code, MB_TYPE_BIDIR); ff_fix_long_b_mvs(VAR_0, VAR_0->b_bidir_back_mv_table, VAR_0->b_code, MB_TYPE_BIDIR); } if(VAR_0->flags&CODEC_FLAG_PASS2) VAR_0->qscale = ff_rate_estimate_qscale_pass2(VAR_0); else if (!VAR_0->fixed_qscale) VAR_0->qscale = ff_rate_estimate_qscale(VAR_0); if (VAR_0->out_format == FMT_MJPEG) { VAR_0->intra_matrix[0] = default_intra_matrix[0]; for(VAR_6=1;VAR_6<64;VAR_6++) VAR_0->intra_matrix[VAR_6] = (default_intra_matrix[VAR_6] * VAR_0->qscale) >> 3; convert_matrix(VAR_0->q_intra_matrix, VAR_0->q_intra_matrix16, VAR_0->intra_matrix, 8); } else { convert_matrix(VAR_0->q_intra_matrix, VAR_0->q_intra_matrix16, VAR_0->intra_matrix, VAR_0->qscale); convert_matrix(VAR_0->q_non_intra_matrix, VAR_0->q_non_intra_matrix16, VAR_0->non_intra_matrix, VAR_0->qscale); } VAR_0->last_bits= get_bit_count(&VAR_0->pb); switch(VAR_0->out_format) { case FMT_MJPEG: mjpeg_picture_header(VAR_0); break; case FMT_H263: if (VAR_0->h263_msmpeg4) msmpeg4_encode_picture_header(VAR_0, VAR_1); else if (VAR_0->h263_pred) mpeg4_encode_picture_header(VAR_0, VAR_1); else if (VAR_0->h263_rv10) rv10_encode_picture_header(VAR_0, VAR_1); else h263_encode_picture_header(VAR_0, VAR_1); break; case FMT_MPEG1: mpeg1_encode_picture_header(VAR_0, VAR_1); break; } VAR_7= get_bit_count(&VAR_0->pb); VAR_0->header_bits= VAR_7 - VAR_0->last_bits; VAR_0->last_bits= VAR_7; VAR_0->mv_bits=0; VAR_0->misc_bits=0; VAR_0->i_tex_bits=0; VAR_0->p_tex_bits=0; VAR_0->i_count=0; VAR_0->p_count=0; VAR_0->skip_count=0; VAR_0->last_dc[0] = 128; VAR_0->last_dc[1] = 128; VAR_0->last_dc[2] = 128; VAR_0->mb_incr = 1; VAR_0->last_mv[0][0][0] = 0; VAR_0->last_mv[0][0][1] = 0; if (VAR_0->out_format == FMT_H263 && !VAR_0->h263_pred && !VAR_0->h263_msmpeg4) { if (VAR_0->height <= 400) VAR_0->gob_index = 1; else if (VAR_0->height <= 800) VAR_0->gob_index = 2; else VAR_0->gob_index = 4; } VAR_0->avg_mb_var = VAR_0->avg_mb_var / VAR_0->mb_num; for(VAR_3=0; VAR_3 < VAR_0->mb_height; VAR_3++) { if (VAR_0->rtp_mode) { if (!VAR_3) { VAR_0->ptr_lastgob = VAR_0->pb.buf; VAR_0->ptr_last_mb_line = VAR_0->pb.buf; } else if (VAR_0->out_format == FMT_H263 && !VAR_0->h263_pred && !VAR_0->h263_msmpeg4 && !(VAR_3 % VAR_0->gob_index)) { VAR_4 = h263_encode_gob_header(VAR_0, VAR_3); if (VAR_4) { VAR_0->first_gob_line = 1; } } } VAR_0->block_index[0]= VAR_0->block_wrap[0]*(VAR_3*2 + 1) - 1; VAR_0->block_index[1]= VAR_0->block_wrap[0]*(VAR_3*2 + 1); VAR_0->block_index[2]= VAR_0->block_wrap[0]*(VAR_3*2 + 2) - 1; VAR_0->block_index[3]= VAR_0->block_wrap[0]*(VAR_3*2 + 2); VAR_0->block_index[4]= VAR_0->block_wrap[4]*(VAR_3 + 1) + VAR_0->block_wrap[0]*(VAR_0->mb_height*2 + 2); VAR_0->block_index[5]= VAR_0->block_wrap[4]*(VAR_3 + 1 + VAR_0->mb_height + 2) + VAR_0->block_wrap[0]*(VAR_0->mb_height*2 + 2); for(VAR_2=0; VAR_2 < VAR_0->mb_width; VAR_2++) { const int mb_type= VAR_0->mb_type[VAR_3 * VAR_0->mb_width + VAR_2]; const int xy= (VAR_3+1) * (VAR_0->mb_width+2) + VAR_2 + 1; PutBitContext pb; int d; int dmin=10000000; int best=0; VAR_0->VAR_2 = VAR_2; VAR_0->VAR_3 = VAR_3; VAR_0->block_index[0]+=2; VAR_0->block_index[1]+=2; VAR_0->block_index[2]+=2; VAR_0->block_index[3]+=2; VAR_0->block_index[4]++; VAR_0->block_index[5]++; if(mb_type & (mb_type-1)){ int next_block=0; pb= VAR_0->pb; copy_context_before_encode(&backup_s, VAR_0, -1); if(mb_type&MB_TYPE_INTER){ VAR_0->mv_dir = MV_DIR_FORWARD; VAR_0->mv_type = MV_TYPE_16X16; VAR_0->mb_intra= 0; VAR_0->mv[0][0][0] = VAR_0->p_mv_table[xy][0]; VAR_0->mv[0][0][1] = VAR_0->p_mv_table[xy][1]; init_put_bits(&VAR_0->pb, bit_buf[1], 3000, NULL, NULL); VAR_0->block= VAR_0->blocks[next_block]; VAR_0->last_bits= 0; encode_mb(VAR_0, VAR_0->mv[0][0][0], VAR_0->mv[0][0][1]); d= get_bit_count(&VAR_0->pb); if(d<dmin){ flush_put_bits(&VAR_0->pb); dmin=d; copy_context_after_encode(&best_s, VAR_0, MB_TYPE_INTER); best=1; next_block^=1; } } if(mb_type&MB_TYPE_INTER4V){ copy_context_before_encode(VAR_0, &backup_s, MB_TYPE_INTER4V); VAR_0->mv_dir = MV_DIR_FORWARD; VAR_0->mv_type = MV_TYPE_8X8; VAR_0->mb_intra= 0; for(VAR_6=0; VAR_6<4; VAR_6++){ VAR_0->mv[0][VAR_6][0] = VAR_0->motion_val[VAR_0->block_index[VAR_6]][0]; VAR_0->mv[0][VAR_6][1] = VAR_0->motion_val[VAR_0->block_index[VAR_6]][1]; } init_put_bits(&VAR_0->pb, bit_buf[2], 3000, NULL, NULL); VAR_0->block= VAR_0->blocks[next_block]; encode_mb(VAR_0, 0, 0); d= get_bit_count(&VAR_0->pb); if(d<dmin){ flush_put_bits(&VAR_0->pb); dmin=d; copy_context_after_encode(&best_s, VAR_0, MB_TYPE_INTER4V); best=2; next_block^=1; } } if(mb_type&MB_TYPE_FORWARD){ copy_context_before_encode(VAR_0, &backup_s, MB_TYPE_FORWARD); VAR_0->mv_dir = MV_DIR_FORWARD; VAR_0->mv_type = MV_TYPE_16X16; VAR_0->mb_intra= 0; VAR_0->mv[0][0][0] = VAR_0->b_forw_mv_table[xy][0]; VAR_0->mv[0][0][1] = VAR_0->b_forw_mv_table[xy][1]; init_put_bits(&VAR_0->pb, bit_buf[3], 3000, NULL, NULL); VAR_0->block= VAR_0->blocks[next_block]; encode_mb(VAR_0, VAR_0->mv[0][0][0], VAR_0->mv[0][0][1]); d= get_bit_count(&VAR_0->pb); if(d<dmin){ flush_put_bits(&VAR_0->pb); dmin=d; copy_context_after_encode(&best_s, VAR_0, MB_TYPE_FORWARD); best=3; next_block^=1; } } if(mb_type&MB_TYPE_BACKWARD){ copy_context_before_encode(VAR_0, &backup_s, MB_TYPE_BACKWARD); VAR_0->mv_dir = MV_DIR_BACKWARD; VAR_0->mv_type = MV_TYPE_16X16; VAR_0->mb_intra= 0; VAR_0->mv[1][0][0] = VAR_0->b_back_mv_table[xy][0]; VAR_0->mv[1][0][1] = VAR_0->b_back_mv_table[xy][1]; init_put_bits(&VAR_0->pb, bit_buf[4], 3000, NULL, NULL); VAR_0->block= VAR_0->blocks[next_block]; encode_mb(VAR_0, VAR_0->mv[1][0][0], VAR_0->mv[1][0][1]); d= get_bit_count(&VAR_0->pb); if(d<dmin){ flush_put_bits(&VAR_0->pb); dmin=d; copy_context_after_encode(&best_s, VAR_0, MB_TYPE_BACKWARD); best=4; next_block^=1; } } if(mb_type&MB_TYPE_BIDIR){ copy_context_before_encode(VAR_0, &backup_s, MB_TYPE_BIDIR); VAR_0->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD; VAR_0->mv_type = MV_TYPE_16X16; VAR_0->mb_intra= 0; VAR_0->mv[0][0][0] = VAR_0->b_bidir_forw_mv_table[xy][0]; VAR_0->mv[0][0][1] = VAR_0->b_bidir_forw_mv_table[xy][1]; VAR_0->mv[1][0][0] = VAR_0->b_bidir_back_mv_table[xy][0]; VAR_0->mv[1][0][1] = VAR_0->b_bidir_back_mv_table[xy][1]; init_put_bits(&VAR_0->pb, bit_buf[5], 3000, NULL, NULL); VAR_0->block= VAR_0->blocks[next_block]; encode_mb(VAR_0, 0, 0); d= get_bit_count(&VAR_0->pb); if(d<dmin){ flush_put_bits(&VAR_0->pb); dmin=d; copy_context_after_encode(&best_s, VAR_0, MB_TYPE_BIDIR); best=5; next_block^=1; } } if(mb_type&MB_TYPE_DIRECT){ copy_context_before_encode(VAR_0, &backup_s, MB_TYPE_DIRECT); VAR_0->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD | MV_DIRECT; VAR_0->mv_type = MV_TYPE_16X16; VAR_0->mb_intra= 0; VAR_0->mv[0][0][0] = VAR_0->b_direct_forw_mv_table[xy][0]; VAR_0->mv[0][0][1] = VAR_0->b_direct_forw_mv_table[xy][1]; VAR_0->mv[1][0][0] = VAR_0->b_direct_back_mv_table[xy][0]; VAR_0->mv[1][0][1] = VAR_0->b_direct_back_mv_table[xy][1]; init_put_bits(&VAR_0->pb, bit_buf[6], 3000, NULL, NULL); VAR_0->block= VAR_0->blocks[next_block]; encode_mb(VAR_0, VAR_0->b_direct_mv_table[xy][0], VAR_0->b_direct_mv_table[xy][1]); d= get_bit_count(&VAR_0->pb); if(d<dmin){ flush_put_bits(&VAR_0->pb); dmin=d; copy_context_after_encode(&best_s, VAR_0, MB_TYPE_DIRECT); best=6; next_block^=1; } } if(mb_type&MB_TYPE_INTRA){ copy_context_before_encode(VAR_0, &backup_s, MB_TYPE_INTRA); VAR_0->mv_dir = MV_DIR_FORWARD; VAR_0->mv_type = MV_TYPE_16X16; VAR_0->mb_intra= 1; VAR_0->mv[0][0][0] = 0; VAR_0->mv[0][0][1] = 0; init_put_bits(&VAR_0->pb, bit_buf[0], 3000, NULL, NULL); VAR_0->block= VAR_0->blocks[next_block]; encode_mb(VAR_0, 0, 0); d= get_bit_count(&VAR_0->pb); if(d<dmin){ flush_put_bits(&VAR_0->pb); dmin=d; copy_context_after_encode(&best_s, VAR_0, MB_TYPE_INTRA); best=0; next_block^=1; } if(VAR_0->h263_pred || VAR_0->h263_aic) VAR_0->mbintra_table[VAR_2 + VAR_3*VAR_0->mb_width]=1; } copy_context_after_encode(VAR_0, &best_s, -1); copy_bits(&pb, bit_buf[best], dmin); VAR_0->pb= pb; VAR_0->last_bits= get_bit_count(&VAR_0->pb); } else { int motion_x, motion_y; VAR_0->mv_type=MV_TYPE_16X16; switch(mb_type){ case MB_TYPE_INTRA: VAR_0->mv_dir = MV_DIR_FORWARD; VAR_0->mb_intra= 1; motion_x= VAR_0->mv[0][0][0] = 0; motion_y= VAR_0->mv[0][0][1] = 0; break; case MB_TYPE_INTER: VAR_0->mv_dir = MV_DIR_FORWARD; VAR_0->mb_intra= 0; motion_x= VAR_0->mv[0][0][0] = VAR_0->p_mv_table[xy][0]; motion_y= VAR_0->mv[0][0][1] = VAR_0->p_mv_table[xy][1]; break; case MB_TYPE_DIRECT: VAR_0->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD | MV_DIRECT; VAR_0->mb_intra= 0; motion_x=VAR_0->b_direct_mv_table[xy][0]; motion_y=VAR_0->b_direct_mv_table[xy][1]; VAR_0->mv[0][0][0] = VAR_0->b_direct_forw_mv_table[xy][0]; VAR_0->mv[0][0][1] = VAR_0->b_direct_forw_mv_table[xy][1]; VAR_0->mv[1][0][0] = VAR_0->b_direct_back_mv_table[xy][0]; VAR_0->mv[1][0][1] = VAR_0->b_direct_back_mv_table[xy][1]; break; case MB_TYPE_BIDIR: VAR_0->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD; VAR_0->mb_intra= 0; motion_x=0; motion_y=0; VAR_0->mv[0][0][0] = VAR_0->b_bidir_forw_mv_table[xy][0]; VAR_0->mv[0][0][1] = VAR_0->b_bidir_forw_mv_table[xy][1]; VAR_0->mv[1][0][0] = VAR_0->b_bidir_back_mv_table[xy][0]; VAR_0->mv[1][0][1] = VAR_0->b_bidir_back_mv_table[xy][1]; break; case MB_TYPE_BACKWARD: VAR_0->mv_dir = MV_DIR_BACKWARD; VAR_0->mb_intra= 0; motion_x= VAR_0->mv[1][0][0] = VAR_0->b_back_mv_table[xy][0]; motion_y= VAR_0->mv[1][0][1] = VAR_0->b_back_mv_table[xy][1]; break; case MB_TYPE_FORWARD: VAR_0->mv_dir = MV_DIR_FORWARD; VAR_0->mb_intra= 0; motion_x= VAR_0->mv[0][0][0] = VAR_0->b_forw_mv_table[xy][0]; motion_y= VAR_0->mv[0][0][1] = VAR_0->b_forw_mv_table[xy][1]; break; default: motion_x=motion_y=0; printf("illegal MB type\n"); } encode_mb(VAR_0, motion_x, motion_y); } if(VAR_0->mb_intra ){ VAR_0->p_mv_table[xy][0]=0; VAR_0->p_mv_table[xy][1]=0; } MPV_decode_mb(VAR_0, VAR_0->block); } if (VAR_0->rtp_mode) { if (!VAR_3) VAR_0->mb_line_avgsize = pbBufPtr(&VAR_0->pb) - VAR_0->ptr_last_mb_line; else if (!(VAR_3 % VAR_0->gob_index)) { VAR_0->mb_line_avgsize = (VAR_0->mb_line_avgsize + pbBufPtr(&VAR_0->pb) - VAR_0->ptr_last_mb_line) >> 1; VAR_0->ptr_last_mb_line = pbBufPtr(&VAR_0->pb); } VAR_0->first_gob_line = 0; } } emms_c(); if (VAR_0->h263_msmpeg4 && VAR_0->msmpeg4_version<4 && VAR_0->pict_type == I_TYPE) msmpeg4_encode_ext_header(VAR_0); if (VAR_0->rtp_mode) { flush_put_bits(&VAR_0->pb); VAR_5 = pbBufPtr(&VAR_0->pb) - VAR_0->ptr_lastgob; if (VAR_0->rtp_callback) VAR_0->rtp_callback(VAR_0->ptr_lastgob, VAR_5, VAR_0->gob_number); VAR_0->ptr_lastgob = pbBufPtr(&VAR_0->pb); } }
[ "static void FUNC_0(MpegEncContext *VAR_0, int VAR_1)\n{", "int VAR_2, VAR_3, VAR_4, VAR_5 = 0;", "int VAR_6;", "int VAR_7;", "MpegEncContext best_s, backup_s;", "UINT8 bit_buf[7][3000];", "VAR_0->VAR_1 = VAR_1;", "VAR_0->block_wrap[0]=\nVAR_0->block_wrap[1]=\nVAR_0->block_wrap[2]=\nVAR_0->block_wrap[3]= VAR_0->mb_width*2 + 2;", "VAR_0->block_wrap[4]=\nVAR_0->block_wrap[5]= VAR_0->mb_width + 2;", "VAR_0->avg_mb_var = 0;", "VAR_0->mc_mb_var = 0;", "if (VAR_0->h263_pred && !VAR_0->h263_msmpeg4)\nff_set_mpeg4_time(VAR_0, VAR_0->VAR_1);", "if(VAR_0->pict_type != I_TYPE){", "for(VAR_3=0; VAR_3 < VAR_0->mb_height; VAR_3++) {", "VAR_0->block_index[0]= VAR_0->block_wrap[0]*(VAR_3*2 + 1) - 1;", "VAR_0->block_index[1]= VAR_0->block_wrap[0]*(VAR_3*2 + 1);", "VAR_0->block_index[2]= VAR_0->block_wrap[0]*(VAR_3*2 + 2) - 1;", "VAR_0->block_index[3]= VAR_0->block_wrap[0]*(VAR_3*2 + 2);", "for(VAR_2=0; VAR_2 < VAR_0->mb_width; VAR_2++) {", "VAR_0->VAR_2 = VAR_2;", "VAR_0->VAR_3 = VAR_3;", "VAR_0->block_index[0]+=2;", "VAR_0->block_index[1]+=2;", "VAR_0->block_index[2]+=2;", "VAR_0->block_index[3]+=2;", "if(VAR_0->pict_type==B_TYPE)\nff_estimate_b_frame_motion(VAR_0, VAR_2, VAR_3);", "else\nff_estimate_p_frame_motion(VAR_0, VAR_2, VAR_3);", "}", "}", "emms_c();", "}else if(VAR_0->pict_type == I_TYPE){", "memset(VAR_0->motion_val[0], 0, sizeof(INT16)*(VAR_0->mb_width*2 + 2)*(VAR_0->mb_height*2 + 2)*2);", "memset(VAR_0->p_mv_table , 0, sizeof(INT16)*(VAR_0->mb_width+2)*(VAR_0->mb_height+2)*2);", "memset(VAR_0->mb_type , MB_TYPE_INTRA, sizeof(UINT8)*VAR_0->mb_width*VAR_0->mb_height);", "}", "if(VAR_0->avg_mb_var < VAR_0->mc_mb_var && VAR_0->pict_type == P_TYPE){", "VAR_0->pict_type= I_TYPE;", "memset(VAR_0->mb_type , MB_TYPE_INTRA, sizeof(UINT8)*VAR_0->mb_width*VAR_0->mb_height);", "if(VAR_0->max_b_frames==0){", "VAR_0->input_pict_type= I_TYPE;", "VAR_0->input_picture_in_gop_number=0;", "}", "}", "if(VAR_0->pict_type==P_TYPE || VAR_0->pict_type==S_TYPE)\nVAR_0->f_code= ff_get_best_fcode(VAR_0, VAR_0->p_mv_table, MB_TYPE_INTER);", "ff_fix_long_p_mvs(VAR_0);", "if(VAR_0->pict_type==B_TYPE){", "VAR_0->f_code= ff_get_best_fcode(VAR_0, VAR_0->b_forw_mv_table, MB_TYPE_FORWARD);", "VAR_0->b_code= ff_get_best_fcode(VAR_0, VAR_0->b_back_mv_table, MB_TYPE_BACKWARD);", "ff_fix_long_b_mvs(VAR_0, VAR_0->b_forw_mv_table, VAR_0->f_code, MB_TYPE_FORWARD);", "ff_fix_long_b_mvs(VAR_0, VAR_0->b_back_mv_table, VAR_0->b_code, MB_TYPE_BACKWARD);", "ff_fix_long_b_mvs(VAR_0, VAR_0->b_bidir_forw_mv_table, VAR_0->f_code, MB_TYPE_BIDIR);", "ff_fix_long_b_mvs(VAR_0, VAR_0->b_bidir_back_mv_table, VAR_0->b_code, MB_TYPE_BIDIR);", "}", "if(VAR_0->flags&CODEC_FLAG_PASS2)\nVAR_0->qscale = ff_rate_estimate_qscale_pass2(VAR_0);", "else if (!VAR_0->fixed_qscale)\nVAR_0->qscale = ff_rate_estimate_qscale(VAR_0);", "if (VAR_0->out_format == FMT_MJPEG) {", "VAR_0->intra_matrix[0] = default_intra_matrix[0];", "for(VAR_6=1;VAR_6<64;VAR_6++)", "VAR_0->intra_matrix[VAR_6] = (default_intra_matrix[VAR_6] * VAR_0->qscale) >> 3;", "convert_matrix(VAR_0->q_intra_matrix, VAR_0->q_intra_matrix16, VAR_0->intra_matrix, 8);", "} else {", "convert_matrix(VAR_0->q_intra_matrix, VAR_0->q_intra_matrix16, VAR_0->intra_matrix, VAR_0->qscale);", "convert_matrix(VAR_0->q_non_intra_matrix, VAR_0->q_non_intra_matrix16, VAR_0->non_intra_matrix, VAR_0->qscale);", "}", "VAR_0->last_bits= get_bit_count(&VAR_0->pb);", "switch(VAR_0->out_format) {", "case FMT_MJPEG:\nmjpeg_picture_header(VAR_0);", "break;", "case FMT_H263:\nif (VAR_0->h263_msmpeg4)\nmsmpeg4_encode_picture_header(VAR_0, VAR_1);", "else if (VAR_0->h263_pred)\nmpeg4_encode_picture_header(VAR_0, VAR_1);", "else if (VAR_0->h263_rv10)\nrv10_encode_picture_header(VAR_0, VAR_1);", "else\nh263_encode_picture_header(VAR_0, VAR_1);", "break;", "case FMT_MPEG1:\nmpeg1_encode_picture_header(VAR_0, VAR_1);", "break;", "}", "VAR_7= get_bit_count(&VAR_0->pb);", "VAR_0->header_bits= VAR_7 - VAR_0->last_bits;", "VAR_0->last_bits= VAR_7;", "VAR_0->mv_bits=0;", "VAR_0->misc_bits=0;", "VAR_0->i_tex_bits=0;", "VAR_0->p_tex_bits=0;", "VAR_0->i_count=0;", "VAR_0->p_count=0;", "VAR_0->skip_count=0;", "VAR_0->last_dc[0] = 128;", "VAR_0->last_dc[1] = 128;", "VAR_0->last_dc[2] = 128;", "VAR_0->mb_incr = 1;", "VAR_0->last_mv[0][0][0] = 0;", "VAR_0->last_mv[0][0][1] = 0;", "if (VAR_0->out_format == FMT_H263 && !VAR_0->h263_pred && !VAR_0->h263_msmpeg4) {", "if (VAR_0->height <= 400)\nVAR_0->gob_index = 1;", "else if (VAR_0->height <= 800)\nVAR_0->gob_index = 2;", "else\nVAR_0->gob_index = 4;", "}", "VAR_0->avg_mb_var = VAR_0->avg_mb_var / VAR_0->mb_num;", "for(VAR_3=0; VAR_3 < VAR_0->mb_height; VAR_3++) {", "if (VAR_0->rtp_mode) {", "if (!VAR_3) {", "VAR_0->ptr_lastgob = VAR_0->pb.buf;", "VAR_0->ptr_last_mb_line = VAR_0->pb.buf;", "} else if (VAR_0->out_format == FMT_H263 && !VAR_0->h263_pred && !VAR_0->h263_msmpeg4 && !(VAR_3 % VAR_0->gob_index)) {", "VAR_4 = h263_encode_gob_header(VAR_0, VAR_3);", "if (VAR_4) {", "VAR_0->first_gob_line = 1;", "}", "}", "}", "VAR_0->block_index[0]= VAR_0->block_wrap[0]*(VAR_3*2 + 1) - 1;", "VAR_0->block_index[1]= VAR_0->block_wrap[0]*(VAR_3*2 + 1);", "VAR_0->block_index[2]= VAR_0->block_wrap[0]*(VAR_3*2 + 2) - 1;", "VAR_0->block_index[3]= VAR_0->block_wrap[0]*(VAR_3*2 + 2);", "VAR_0->block_index[4]= VAR_0->block_wrap[4]*(VAR_3 + 1) + VAR_0->block_wrap[0]*(VAR_0->mb_height*2 + 2);", "VAR_0->block_index[5]= VAR_0->block_wrap[4]*(VAR_3 + 1 + VAR_0->mb_height + 2) + VAR_0->block_wrap[0]*(VAR_0->mb_height*2 + 2);", "for(VAR_2=0; VAR_2 < VAR_0->mb_width; VAR_2++) {", "const int mb_type= VAR_0->mb_type[VAR_3 * VAR_0->mb_width + VAR_2];", "const int xy= (VAR_3+1) * (VAR_0->mb_width+2) + VAR_2 + 1;", "PutBitContext pb;", "int d;", "int dmin=10000000;", "int best=0;", "VAR_0->VAR_2 = VAR_2;", "VAR_0->VAR_3 = VAR_3;", "VAR_0->block_index[0]+=2;", "VAR_0->block_index[1]+=2;", "VAR_0->block_index[2]+=2;", "VAR_0->block_index[3]+=2;", "VAR_0->block_index[4]++;", "VAR_0->block_index[5]++;", "if(mb_type & (mb_type-1)){", "int next_block=0;", "pb= VAR_0->pb;", "copy_context_before_encode(&backup_s, VAR_0, -1);", "if(mb_type&MB_TYPE_INTER){", "VAR_0->mv_dir = MV_DIR_FORWARD;", "VAR_0->mv_type = MV_TYPE_16X16;", "VAR_0->mb_intra= 0;", "VAR_0->mv[0][0][0] = VAR_0->p_mv_table[xy][0];", "VAR_0->mv[0][0][1] = VAR_0->p_mv_table[xy][1];", "init_put_bits(&VAR_0->pb, bit_buf[1], 3000, NULL, NULL);", "VAR_0->block= VAR_0->blocks[next_block];", "VAR_0->last_bits= 0;", "encode_mb(VAR_0, VAR_0->mv[0][0][0], VAR_0->mv[0][0][1]);", "d= get_bit_count(&VAR_0->pb);", "if(d<dmin){", "flush_put_bits(&VAR_0->pb);", "dmin=d;", "copy_context_after_encode(&best_s, VAR_0, MB_TYPE_INTER);", "best=1;", "next_block^=1;", "}", "}", "if(mb_type&MB_TYPE_INTER4V){", "copy_context_before_encode(VAR_0, &backup_s, MB_TYPE_INTER4V);", "VAR_0->mv_dir = MV_DIR_FORWARD;", "VAR_0->mv_type = MV_TYPE_8X8;", "VAR_0->mb_intra= 0;", "for(VAR_6=0; VAR_6<4; VAR_6++){", "VAR_0->mv[0][VAR_6][0] = VAR_0->motion_val[VAR_0->block_index[VAR_6]][0];", "VAR_0->mv[0][VAR_6][1] = VAR_0->motion_val[VAR_0->block_index[VAR_6]][1];", "}", "init_put_bits(&VAR_0->pb, bit_buf[2], 3000, NULL, NULL);", "VAR_0->block= VAR_0->blocks[next_block];", "encode_mb(VAR_0, 0, 0);", "d= get_bit_count(&VAR_0->pb);", "if(d<dmin){", "flush_put_bits(&VAR_0->pb);", "dmin=d;", "copy_context_after_encode(&best_s, VAR_0, MB_TYPE_INTER4V);", "best=2;", "next_block^=1;", "}", "}", "if(mb_type&MB_TYPE_FORWARD){", "copy_context_before_encode(VAR_0, &backup_s, MB_TYPE_FORWARD);", "VAR_0->mv_dir = MV_DIR_FORWARD;", "VAR_0->mv_type = MV_TYPE_16X16;", "VAR_0->mb_intra= 0;", "VAR_0->mv[0][0][0] = VAR_0->b_forw_mv_table[xy][0];", "VAR_0->mv[0][0][1] = VAR_0->b_forw_mv_table[xy][1];", "init_put_bits(&VAR_0->pb, bit_buf[3], 3000, NULL, NULL);", "VAR_0->block= VAR_0->blocks[next_block];", "encode_mb(VAR_0, VAR_0->mv[0][0][0], VAR_0->mv[0][0][1]);", "d= get_bit_count(&VAR_0->pb);", "if(d<dmin){", "flush_put_bits(&VAR_0->pb);", "dmin=d;", "copy_context_after_encode(&best_s, VAR_0, MB_TYPE_FORWARD);", "best=3;", "next_block^=1;", "}", "}", "if(mb_type&MB_TYPE_BACKWARD){", "copy_context_before_encode(VAR_0, &backup_s, MB_TYPE_BACKWARD);", "VAR_0->mv_dir = MV_DIR_BACKWARD;", "VAR_0->mv_type = MV_TYPE_16X16;", "VAR_0->mb_intra= 0;", "VAR_0->mv[1][0][0] = VAR_0->b_back_mv_table[xy][0];", "VAR_0->mv[1][0][1] = VAR_0->b_back_mv_table[xy][1];", "init_put_bits(&VAR_0->pb, bit_buf[4], 3000, NULL, NULL);", "VAR_0->block= VAR_0->blocks[next_block];", "encode_mb(VAR_0, VAR_0->mv[1][0][0], VAR_0->mv[1][0][1]);", "d= get_bit_count(&VAR_0->pb);", "if(d<dmin){", "flush_put_bits(&VAR_0->pb);", "dmin=d;", "copy_context_after_encode(&best_s, VAR_0, MB_TYPE_BACKWARD);", "best=4;", "next_block^=1;", "}", "}", "if(mb_type&MB_TYPE_BIDIR){", "copy_context_before_encode(VAR_0, &backup_s, MB_TYPE_BIDIR);", "VAR_0->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD;", "VAR_0->mv_type = MV_TYPE_16X16;", "VAR_0->mb_intra= 0;", "VAR_0->mv[0][0][0] = VAR_0->b_bidir_forw_mv_table[xy][0];", "VAR_0->mv[0][0][1] = VAR_0->b_bidir_forw_mv_table[xy][1];", "VAR_0->mv[1][0][0] = VAR_0->b_bidir_back_mv_table[xy][0];", "VAR_0->mv[1][0][1] = VAR_0->b_bidir_back_mv_table[xy][1];", "init_put_bits(&VAR_0->pb, bit_buf[5], 3000, NULL, NULL);", "VAR_0->block= VAR_0->blocks[next_block];", "encode_mb(VAR_0, 0, 0);", "d= get_bit_count(&VAR_0->pb);", "if(d<dmin){", "flush_put_bits(&VAR_0->pb);", "dmin=d;", "copy_context_after_encode(&best_s, VAR_0, MB_TYPE_BIDIR);", "best=5;", "next_block^=1;", "}", "}", "if(mb_type&MB_TYPE_DIRECT){", "copy_context_before_encode(VAR_0, &backup_s, MB_TYPE_DIRECT);", "VAR_0->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD | MV_DIRECT;", "VAR_0->mv_type = MV_TYPE_16X16;", "VAR_0->mb_intra= 0;", "VAR_0->mv[0][0][0] = VAR_0->b_direct_forw_mv_table[xy][0];", "VAR_0->mv[0][0][1] = VAR_0->b_direct_forw_mv_table[xy][1];", "VAR_0->mv[1][0][0] = VAR_0->b_direct_back_mv_table[xy][0];", "VAR_0->mv[1][0][1] = VAR_0->b_direct_back_mv_table[xy][1];", "init_put_bits(&VAR_0->pb, bit_buf[6], 3000, NULL, NULL);", "VAR_0->block= VAR_0->blocks[next_block];", "encode_mb(VAR_0, VAR_0->b_direct_mv_table[xy][0], VAR_0->b_direct_mv_table[xy][1]);", "d= get_bit_count(&VAR_0->pb);", "if(d<dmin){", "flush_put_bits(&VAR_0->pb);", "dmin=d;", "copy_context_after_encode(&best_s, VAR_0, MB_TYPE_DIRECT);", "best=6;", "next_block^=1;", "}", "}", "if(mb_type&MB_TYPE_INTRA){", "copy_context_before_encode(VAR_0, &backup_s, MB_TYPE_INTRA);", "VAR_0->mv_dir = MV_DIR_FORWARD;", "VAR_0->mv_type = MV_TYPE_16X16;", "VAR_0->mb_intra= 1;", "VAR_0->mv[0][0][0] = 0;", "VAR_0->mv[0][0][1] = 0;", "init_put_bits(&VAR_0->pb, bit_buf[0], 3000, NULL, NULL);", "VAR_0->block= VAR_0->blocks[next_block];", "encode_mb(VAR_0, 0, 0);", "d= get_bit_count(&VAR_0->pb);", "if(d<dmin){", "flush_put_bits(&VAR_0->pb);", "dmin=d;", "copy_context_after_encode(&best_s, VAR_0, MB_TYPE_INTRA);", "best=0;", "next_block^=1;", "}", "if(VAR_0->h263_pred || VAR_0->h263_aic)\nVAR_0->mbintra_table[VAR_2 + VAR_3*VAR_0->mb_width]=1;", "}", "copy_context_after_encode(VAR_0, &best_s, -1);", "copy_bits(&pb, bit_buf[best], dmin);", "VAR_0->pb= pb;", "VAR_0->last_bits= get_bit_count(&VAR_0->pb);", "} else {", "int motion_x, motion_y;", "VAR_0->mv_type=MV_TYPE_16X16;", "switch(mb_type){", "case MB_TYPE_INTRA:\nVAR_0->mv_dir = MV_DIR_FORWARD;", "VAR_0->mb_intra= 1;", "motion_x= VAR_0->mv[0][0][0] = 0;", "motion_y= VAR_0->mv[0][0][1] = 0;", "break;", "case MB_TYPE_INTER:\nVAR_0->mv_dir = MV_DIR_FORWARD;", "VAR_0->mb_intra= 0;", "motion_x= VAR_0->mv[0][0][0] = VAR_0->p_mv_table[xy][0];", "motion_y= VAR_0->mv[0][0][1] = VAR_0->p_mv_table[xy][1];", "break;", "case MB_TYPE_DIRECT:\nVAR_0->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD | MV_DIRECT;", "VAR_0->mb_intra= 0;", "motion_x=VAR_0->b_direct_mv_table[xy][0];", "motion_y=VAR_0->b_direct_mv_table[xy][1];", "VAR_0->mv[0][0][0] = VAR_0->b_direct_forw_mv_table[xy][0];", "VAR_0->mv[0][0][1] = VAR_0->b_direct_forw_mv_table[xy][1];", "VAR_0->mv[1][0][0] = VAR_0->b_direct_back_mv_table[xy][0];", "VAR_0->mv[1][0][1] = VAR_0->b_direct_back_mv_table[xy][1];", "break;", "case MB_TYPE_BIDIR:\nVAR_0->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD;", "VAR_0->mb_intra= 0;", "motion_x=0;", "motion_y=0;", "VAR_0->mv[0][0][0] = VAR_0->b_bidir_forw_mv_table[xy][0];", "VAR_0->mv[0][0][1] = VAR_0->b_bidir_forw_mv_table[xy][1];", "VAR_0->mv[1][0][0] = VAR_0->b_bidir_back_mv_table[xy][0];", "VAR_0->mv[1][0][1] = VAR_0->b_bidir_back_mv_table[xy][1];", "break;", "case MB_TYPE_BACKWARD:\nVAR_0->mv_dir = MV_DIR_BACKWARD;", "VAR_0->mb_intra= 0;", "motion_x= VAR_0->mv[1][0][0] = VAR_0->b_back_mv_table[xy][0];", "motion_y= VAR_0->mv[1][0][1] = VAR_0->b_back_mv_table[xy][1];", "break;", "case MB_TYPE_FORWARD:\nVAR_0->mv_dir = MV_DIR_FORWARD;", "VAR_0->mb_intra= 0;", "motion_x= VAR_0->mv[0][0][0] = VAR_0->b_forw_mv_table[xy][0];", "motion_y= VAR_0->mv[0][0][1] = VAR_0->b_forw_mv_table[xy][1];", "break;", "default:\nmotion_x=motion_y=0;", "printf(\"illegal MB type\\n\");", "}", "encode_mb(VAR_0, motion_x, motion_y);", "}", "if(VAR_0->mb_intra ){", "VAR_0->p_mv_table[xy][0]=0;", "VAR_0->p_mv_table[xy][1]=0;", "}", "MPV_decode_mb(VAR_0, VAR_0->block);", "}", "if (VAR_0->rtp_mode) {", "if (!VAR_3)\nVAR_0->mb_line_avgsize = pbBufPtr(&VAR_0->pb) - VAR_0->ptr_last_mb_line;", "else if (!(VAR_3 % VAR_0->gob_index)) {", "VAR_0->mb_line_avgsize = (VAR_0->mb_line_avgsize + pbBufPtr(&VAR_0->pb) - VAR_0->ptr_last_mb_line) >> 1;", "VAR_0->ptr_last_mb_line = pbBufPtr(&VAR_0->pb);", "}", "VAR_0->first_gob_line = 0;", "}", "}", "emms_c();", "if (VAR_0->h263_msmpeg4 && VAR_0->msmpeg4_version<4 && VAR_0->pict_type == I_TYPE)\nmsmpeg4_encode_ext_header(VAR_0);", "if (VAR_0->rtp_mode) {", "flush_put_bits(&VAR_0->pb);", "VAR_5 = pbBufPtr(&VAR_0->pb) - VAR_0->ptr_lastgob;", "if (VAR_0->rtp_callback)\nVAR_0->rtp_callback(VAR_0->ptr_lastgob, VAR_5, VAR_0->gob_number);", "VAR_0->ptr_lastgob = pbBufPtr(&VAR_0->pb);", "}", "}" ]
[ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 21, 23, 25, 27 ], [ 29, 31 ], [ 37 ], [ 39 ], [ 45, 47 ], [ 53 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 91, 93 ], [ 95, 97 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 139 ], [ 143, 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 177, 179 ], [ 181, 183 ], [ 191 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 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 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 287 ], [ 293 ], [ 295, 297 ], [ 299, 301 ], [ 303, 305 ], [ 307 ], [ 311 ], [ 315 ], [ 321 ], [ 323 ], [ 325 ], [ 327 ], [ 329 ], [ 331 ], [ 333 ], [ 335 ], [ 337 ], [ 339 ], [ 341 ], [ 345 ], [ 347 ], [ 349 ], [ 351 ], [ 353 ], [ 355 ], [ 357 ], [ 359 ], [ 361 ], [ 363 ], [ 365 ], [ 367 ], [ 369 ], [ 373 ], [ 375 ], [ 377 ], [ 379 ], [ 381 ], [ 383 ], [ 385 ], [ 387 ], [ 389 ], [ 391 ], [ 393 ], [ 397 ], [ 401 ], [ 403 ], [ 405 ], [ 407 ], [ 409 ], [ 411 ], [ 413 ], [ 415 ], [ 417 ], [ 421 ], [ 423 ], [ 425 ], [ 427 ], [ 429 ], [ 431 ], [ 433 ], [ 435 ], [ 437 ], [ 439 ], [ 441 ], [ 443 ], [ 445 ], [ 447 ], [ 449 ], [ 451 ], [ 453 ], [ 455 ], [ 457 ], [ 459 ], [ 461 ], [ 465 ], [ 467 ], [ 469 ], [ 471 ], [ 473 ], [ 475 ], [ 477 ], [ 479 ], [ 481 ], [ 483 ], [ 485 ], [ 487 ], [ 489 ], [ 491 ], [ 493 ], [ 495 ], [ 497 ], [ 499 ], [ 501 ], [ 505 ], [ 507 ], [ 509 ], [ 511 ], [ 513 ], [ 515 ], [ 517 ], [ 519 ], [ 521 ], [ 523 ], [ 525 ], [ 527 ], [ 529 ], [ 531 ], [ 533 ], [ 535 ], [ 537 ], [ 539 ], [ 541 ], [ 545 ], [ 547 ], [ 549 ], [ 551 ], [ 553 ], [ 555 ], [ 557 ], [ 559 ], [ 561 ], [ 563 ], [ 565 ], [ 567 ], [ 569 ], [ 571 ], [ 573 ], [ 575 ], [ 577 ], [ 579 ], [ 581 ], [ 583 ], [ 585 ], [ 589 ], [ 591 ], [ 593 ], [ 595 ], [ 597 ], [ 599 ], [ 601 ], [ 603 ], [ 605 ], [ 607 ], [ 609 ], [ 611 ], [ 613 ], [ 615 ], [ 617 ], [ 619 ], [ 621 ], [ 623 ], [ 625 ], [ 627 ], [ 629 ], [ 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 ], [ 687 ], [ 689 ], [ 693, 695 ], [ 697 ], [ 699 ], [ 701 ], [ 703 ], [ 705 ], [ 707 ], [ 709 ], [ 711 ], [ 715 ], [ 717, 719 ], [ 721 ], [ 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 ], [ 781, 783 ], [ 785 ], [ 787 ], [ 789 ], [ 791 ], [ 793, 795 ], [ 797 ], [ 799 ], [ 801 ], [ 805 ], [ 807, 809 ], [ 811 ], [ 813 ], [ 815 ], [ 817 ], [ 821 ], [ 823 ], [ 825 ], [ 827 ], [ 831 ], [ 833 ], [ 841 ], [ 843, 845 ], [ 847 ], [ 849 ], [ 851 ], [ 853 ], [ 859 ], [ 861 ], [ 863 ], [ 865 ], [ 869, 871 ], [ 883 ], [ 885 ], [ 887 ], [ 891, 893 ], [ 895 ], [ 899 ], [ 901 ] ]
7,361
static void store_word(DBDMA_channel *ch, int key, uint32_t addr, uint16_t len) { dbdma_cmd *current = &ch->current; uint32_t val; DBDMA_DPRINTF("store_word\n"); /* only implements KEY_SYSTEM */ if (key != KEY_SYSTEM) { printf("DBDMA: STORE_WORD, unimplemented key %x\n", key); kill_channel(ch); return; } val = current->cmd_dep; if (len == 2) val >>= 16; else if (len == 1) val >>= 24; cpu_physical_memory_write(addr, (uint8_t*)&val, len); if (conditional_wait(ch)) goto wait; current->xfer_status = cpu_to_le16(be32_to_cpu(ch->regs[DBDMA_STATUS])); dbdma_cmdptr_save(ch); ch->regs[DBDMA_STATUS] &= cpu_to_be32(~FLUSH); conditional_interrupt(ch); next(ch); wait: qemu_bh_schedule(dbdma_bh); }
false
qemu
ad674e53b5cce265fadafbde2c6a4f190345cd00
static void store_word(DBDMA_channel *ch, int key, uint32_t addr, uint16_t len) { dbdma_cmd *current = &ch->current; uint32_t val; DBDMA_DPRINTF("store_word\n"); if (key != KEY_SYSTEM) { printf("DBDMA: STORE_WORD, unimplemented key %x\n", key); kill_channel(ch); return; } val = current->cmd_dep; if (len == 2) val >>= 16; else if (len == 1) val >>= 24; cpu_physical_memory_write(addr, (uint8_t*)&val, len); if (conditional_wait(ch)) goto wait; current->xfer_status = cpu_to_le16(be32_to_cpu(ch->regs[DBDMA_STATUS])); dbdma_cmdptr_save(ch); ch->regs[DBDMA_STATUS] &= cpu_to_be32(~FLUSH); conditional_interrupt(ch); next(ch); wait: qemu_bh_schedule(dbdma_bh); }
{ "code": [], "line_no": [] }
static void FUNC_0(DBDMA_channel *VAR_0, int VAR_1, uint32_t VAR_2, uint16_t VAR_3) { dbdma_cmd *current = &VAR_0->current; uint32_t val; DBDMA_DPRINTF("FUNC_0\n"); if (VAR_1 != KEY_SYSTEM) { printf("DBDMA: STORE_WORD, unimplemented VAR_1 %x\n", VAR_1); kill_channel(VAR_0); return; } val = current->cmd_dep; if (VAR_3 == 2) val >>= 16; else if (VAR_3 == 1) val >>= 24; cpu_physical_memory_write(VAR_2, (uint8_t*)&val, VAR_3); if (conditional_wait(VAR_0)) goto wait; current->xfer_status = cpu_to_le16(be32_to_cpu(VAR_0->regs[DBDMA_STATUS])); dbdma_cmdptr_save(VAR_0); VAR_0->regs[DBDMA_STATUS] &= cpu_to_be32(~FLUSH); conditional_interrupt(VAR_0); next(VAR_0); wait: qemu_bh_schedule(dbdma_bh); }
[ "static void FUNC_0(DBDMA_channel *VAR_0, int VAR_1, uint32_t VAR_2,\nuint16_t VAR_3)\n{", "dbdma_cmd *current = &VAR_0->current;", "uint32_t val;", "DBDMA_DPRINTF(\"FUNC_0\\n\");", "if (VAR_1 != KEY_SYSTEM) {", "printf(\"DBDMA: STORE_WORD, unimplemented VAR_1 %x\\n\", VAR_1);", "kill_channel(VAR_0);", "return;", "}", "val = current->cmd_dep;", "if (VAR_3 == 2)\nval >>= 16;", "else if (VAR_3 == 1)\nval >>= 24;", "cpu_physical_memory_write(VAR_2, (uint8_t*)&val, VAR_3);", "if (conditional_wait(VAR_0))\ngoto wait;", "current->xfer_status = cpu_to_le16(be32_to_cpu(VAR_0->regs[DBDMA_STATUS]));", "dbdma_cmdptr_save(VAR_0);", "VAR_0->regs[DBDMA_STATUS] &= cpu_to_be32(~FLUSH);", "conditional_interrupt(VAR_0);", "next(VAR_0);", "wait:\nqemu_bh_schedule(dbdma_bh);", "}" ]
[ 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 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35, 37 ], [ 39, 41 ], [ 45 ], [ 49, 51 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 69, 71 ], [ 73 ] ]
7,362
static int decode_cabac_mb_ref( H264Context *h, int list, int n ) { int refa = h->ref_cache[list][scan8[n] - 1]; int refb = h->ref_cache[list][scan8[n] - 8]; int ref = 0; int ctx = 0; if( h->slice_type_nos == FF_B_TYPE) { if( refa > 0 && !h->direct_cache[scan8[n] - 1] ) ctx++; if( refb > 0 && !h->direct_cache[scan8[n] - 8] ) ctx += 2; } else { if( refa > 0 ) ctx++; if( refb > 0 ) ctx += 2; } while( get_cabac( &h->cabac, &h->cabac_state[54+ctx] ) ) { ref++; if( ctx < 4 ) ctx = 4; else ctx = 5; if(ref >= 32 /*h->ref_list[list]*/){ av_log(h->s.avctx, AV_LOG_ERROR, "overflow in decode_cabac_mb_ref\n"); return 0; //FIXME we should return -1 and check the return everywhere } } return ref; }
false
FFmpeg
04618b98e361951f550b3970865803a875f4a8f0
static int decode_cabac_mb_ref( H264Context *h, int list, int n ) { int refa = h->ref_cache[list][scan8[n] - 1]; int refb = h->ref_cache[list][scan8[n] - 8]; int ref = 0; int ctx = 0; if( h->slice_type_nos == FF_B_TYPE) { if( refa > 0 && !h->direct_cache[scan8[n] - 1] ) ctx++; if( refb > 0 && !h->direct_cache[scan8[n] - 8] ) ctx += 2; } else { if( refa > 0 ) ctx++; if( refb > 0 ) ctx += 2; } while( get_cabac( &h->cabac, &h->cabac_state[54+ctx] ) ) { ref++; if( ctx < 4 ) ctx = 4; else ctx = 5; if(ref >= 32 ){ av_log(h->s.avctx, AV_LOG_ERROR, "overflow in decode_cabac_mb_ref\n"); return 0; } } return ref; }
{ "code": [], "line_no": [] }
static int FUNC_0( H264Context *VAR_0, int VAR_1, int VAR_2 ) { int VAR_3 = VAR_0->ref_cache[VAR_1][scan8[VAR_2] - 1]; int VAR_4 = VAR_0->ref_cache[VAR_1][scan8[VAR_2] - 8]; int VAR_5 = 0; int VAR_6 = 0; if( VAR_0->slice_type_nos == FF_B_TYPE) { if( VAR_3 > 0 && !VAR_0->direct_cache[scan8[VAR_2] - 1] ) VAR_6++; if( VAR_4 > 0 && !VAR_0->direct_cache[scan8[VAR_2] - 8] ) VAR_6 += 2; } else { if( VAR_3 > 0 ) VAR_6++; if( VAR_4 > 0 ) VAR_6 += 2; } while( get_cabac( &VAR_0->cabac, &VAR_0->cabac_state[54+VAR_6] ) ) { VAR_5++; if( VAR_6 < 4 ) VAR_6 = 4; else VAR_6 = 5; if(VAR_5 >= 32 ){ av_log(VAR_0->s.avctx, AV_LOG_ERROR, "overflow in FUNC_0\VAR_2"); return 0; } } return VAR_5; }
[ "static int FUNC_0( H264Context *VAR_0, int VAR_1, int VAR_2 ) {", "int VAR_3 = VAR_0->ref_cache[VAR_1][scan8[VAR_2] - 1];", "int VAR_4 = VAR_0->ref_cache[VAR_1][scan8[VAR_2] - 8];", "int VAR_5 = 0;", "int VAR_6 = 0;", "if( VAR_0->slice_type_nos == FF_B_TYPE) {", "if( VAR_3 > 0 && !VAR_0->direct_cache[scan8[VAR_2] - 1] )\nVAR_6++;", "if( VAR_4 > 0 && !VAR_0->direct_cache[scan8[VAR_2] - 8] )\nVAR_6 += 2;", "} else {", "if( VAR_3 > 0 )\nVAR_6++;", "if( VAR_4 > 0 )\nVAR_6 += 2;", "}", "while( get_cabac( &VAR_0->cabac, &VAR_0->cabac_state[54+VAR_6] ) ) {", "VAR_5++;", "if( VAR_6 < 4 )\nVAR_6 = 4;", "else\nVAR_6 = 5;", "if(VAR_5 >= 32 ){", "av_log(VAR_0->s.avctx, AV_LOG_ERROR, \"overflow in FUNC_0\\VAR_2\");", "return 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 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15, 17 ], [ 19, 21 ], [ 23 ], [ 25, 27 ], [ 29, 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41, 43 ], [ 45, 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ] ]
7,363
static void gen_mtc0(DisasContext *ctx, TCGv arg, int reg, int sel) { const char *rn = "invalid"; if (sel != 0) check_insn(ctx, ISA_MIPS32); if (use_icount) gen_io_start(); switch (reg) { case 0: switch (sel) { case 0: gen_helper_mtc0_index(cpu_env, arg); rn = "Index"; break; case 1: CP0_CHECK(ctx->insn_flags & ASE_MT); gen_helper_mtc0_mvpcontrol(cpu_env, arg); rn = "MVPControl"; break; case 2: CP0_CHECK(ctx->insn_flags & ASE_MT); /* ignored */ rn = "MVPConf0"; break; case 3: CP0_CHECK(ctx->insn_flags & ASE_MT); /* ignored */ rn = "MVPConf1"; break; default: goto cp0_unimplemented; } break; case 1: switch (sel) { case 0: /* ignored */ rn = "Random"; break; case 1: CP0_CHECK(ctx->insn_flags & ASE_MT); gen_helper_mtc0_vpecontrol(cpu_env, arg); rn = "VPEControl"; break; case 2: CP0_CHECK(ctx->insn_flags & ASE_MT); gen_helper_mtc0_vpeconf0(cpu_env, arg); rn = "VPEConf0"; break; case 3: CP0_CHECK(ctx->insn_flags & ASE_MT); gen_helper_mtc0_vpeconf1(cpu_env, arg); rn = "VPEConf1"; break; case 4: CP0_CHECK(ctx->insn_flags & ASE_MT); gen_helper_mtc0_yqmask(cpu_env, arg); rn = "YQMask"; break; case 5: CP0_CHECK(ctx->insn_flags & ASE_MT); gen_mtc0_store64(arg, offsetof(CPUMIPSState, CP0_VPESchedule)); rn = "VPESchedule"; break; case 6: CP0_CHECK(ctx->insn_flags & ASE_MT); gen_mtc0_store64(arg, offsetof(CPUMIPSState, CP0_VPEScheFBack)); rn = "VPEScheFBack"; break; case 7: CP0_CHECK(ctx->insn_flags & ASE_MT); gen_helper_mtc0_vpeopt(cpu_env, arg); rn = "VPEOpt"; break; default: goto cp0_unimplemented; } break; case 2: switch (sel) { case 0: gen_helper_mtc0_entrylo0(cpu_env, arg); rn = "EntryLo0"; break; case 1: CP0_CHECK(ctx->insn_flags & ASE_MT); gen_helper_mtc0_tcstatus(cpu_env, arg); rn = "TCStatus"; break; case 2: CP0_CHECK(ctx->insn_flags & ASE_MT); gen_helper_mtc0_tcbind(cpu_env, arg); rn = "TCBind"; break; case 3: CP0_CHECK(ctx->insn_flags & ASE_MT); gen_helper_mtc0_tcrestart(cpu_env, arg); rn = "TCRestart"; break; case 4: CP0_CHECK(ctx->insn_flags & ASE_MT); gen_helper_mtc0_tchalt(cpu_env, arg); rn = "TCHalt"; break; case 5: CP0_CHECK(ctx->insn_flags & ASE_MT); gen_helper_mtc0_tccontext(cpu_env, arg); rn = "TCContext"; break; case 6: CP0_CHECK(ctx->insn_flags & ASE_MT); gen_helper_mtc0_tcschedule(cpu_env, arg); rn = "TCSchedule"; break; case 7: CP0_CHECK(ctx->insn_flags & ASE_MT); gen_helper_mtc0_tcschefback(cpu_env, arg); rn = "TCScheFBack"; break; default: goto cp0_unimplemented; } break; case 3: switch (sel) { case 0: gen_helper_mtc0_entrylo1(cpu_env, arg); rn = "EntryLo1"; break; default: goto cp0_unimplemented; } break; case 4: switch (sel) { case 0: gen_helper_mtc0_context(cpu_env, arg); rn = "Context"; break; case 1: // gen_helper_mtc0_contextconfig(cpu_env, arg); /* SmartMIPS ASE */ rn = "ContextConfig"; goto cp0_unimplemented; // break; case 2: CP0_CHECK(ctx->ulri); tcg_gen_st_tl(arg, cpu_env, offsetof(CPUMIPSState, active_tc.CP0_UserLocal)); rn = "UserLocal"; break; default: goto cp0_unimplemented; } break; case 5: switch (sel) { case 0: gen_helper_mtc0_pagemask(cpu_env, arg); rn = "PageMask"; break; case 1: check_insn(ctx, ISA_MIPS32R2); gen_helper_mtc0_pagegrain(cpu_env, arg); rn = "PageGrain"; break; default: goto cp0_unimplemented; } break; case 6: switch (sel) { case 0: gen_helper_mtc0_wired(cpu_env, arg); rn = "Wired"; break; case 1: check_insn(ctx, ISA_MIPS32R2); gen_helper_mtc0_srsconf0(cpu_env, arg); rn = "SRSConf0"; break; case 2: check_insn(ctx, ISA_MIPS32R2); gen_helper_mtc0_srsconf1(cpu_env, arg); rn = "SRSConf1"; break; case 3: check_insn(ctx, ISA_MIPS32R2); gen_helper_mtc0_srsconf2(cpu_env, arg); rn = "SRSConf2"; break; case 4: check_insn(ctx, ISA_MIPS32R2); gen_helper_mtc0_srsconf3(cpu_env, arg); rn = "SRSConf3"; break; case 5: check_insn(ctx, ISA_MIPS32R2); gen_helper_mtc0_srsconf4(cpu_env, arg); rn = "SRSConf4"; break; default: goto cp0_unimplemented; } break; case 7: switch (sel) { case 0: check_insn(ctx, ISA_MIPS32R2); gen_helper_mtc0_hwrena(cpu_env, arg); ctx->bstate = BS_STOP; rn = "HWREna"; break; default: goto cp0_unimplemented; } break; case 8: switch (sel) { case 0: /* ignored */ rn = "BadVAddr"; break; case 1: /* ignored */ rn = "BadInstr"; break; case 2: /* ignored */ rn = "BadInstrP"; break; default: goto cp0_unimplemented; } break; case 9: switch (sel) { case 0: gen_helper_mtc0_count(cpu_env, arg); rn = "Count"; break; /* 6,7 are implementation dependent */ default: goto cp0_unimplemented; } break; case 10: switch (sel) { case 0: gen_helper_mtc0_entryhi(cpu_env, arg); rn = "EntryHi"; break; default: goto cp0_unimplemented; } break; case 11: switch (sel) { case 0: gen_helper_mtc0_compare(cpu_env, arg); rn = "Compare"; break; /* 6,7 are implementation dependent */ default: goto cp0_unimplemented; } break; case 12: switch (sel) { case 0: save_cpu_state(ctx, 1); gen_helper_mtc0_status(cpu_env, arg); /* BS_STOP isn't good enough here, hflags may have changed. */ gen_save_pc(ctx->pc + 4); ctx->bstate = BS_EXCP; rn = "Status"; break; case 1: check_insn(ctx, ISA_MIPS32R2); gen_helper_mtc0_intctl(cpu_env, arg); /* Stop translation as we may have switched the execution mode */ ctx->bstate = BS_STOP; rn = "IntCtl"; break; case 2: check_insn(ctx, ISA_MIPS32R2); gen_helper_mtc0_srsctl(cpu_env, arg); /* Stop translation as we may have switched the execution mode */ ctx->bstate = BS_STOP; rn = "SRSCtl"; break; case 3: check_insn(ctx, ISA_MIPS32R2); gen_mtc0_store32(arg, offsetof(CPUMIPSState, CP0_SRSMap)); /* Stop translation as we may have switched the execution mode */ ctx->bstate = BS_STOP; rn = "SRSMap"; break; default: goto cp0_unimplemented; } break; case 13: switch (sel) { case 0: save_cpu_state(ctx, 1); gen_helper_mtc0_cause(cpu_env, arg); rn = "Cause"; break; default: goto cp0_unimplemented; } break; case 14: switch (sel) { case 0: gen_mtc0_store64(arg, offsetof(CPUMIPSState, CP0_EPC)); rn = "EPC"; break; default: goto cp0_unimplemented; } break; case 15: switch (sel) { case 0: /* ignored */ rn = "PRid"; break; case 1: check_insn(ctx, ISA_MIPS32R2); gen_helper_mtc0_ebase(cpu_env, arg); rn = "EBase"; break; default: goto cp0_unimplemented; } break; case 16: switch (sel) { case 0: gen_helper_mtc0_config0(cpu_env, arg); rn = "Config"; /* Stop translation as we may have switched the execution mode */ ctx->bstate = BS_STOP; break; case 1: /* ignored, read only */ rn = "Config1"; break; case 2: gen_helper_mtc0_config2(cpu_env, arg); rn = "Config2"; /* Stop translation as we may have switched the execution mode */ ctx->bstate = BS_STOP; break; case 3: gen_helper_mtc0_config3(cpu_env, arg); rn = "Config3"; /* Stop translation as we may have switched the execution mode */ ctx->bstate = BS_STOP; break; case 4: gen_helper_mtc0_config4(cpu_env, arg); rn = "Config4"; ctx->bstate = BS_STOP; break; case 5: gen_helper_mtc0_config5(cpu_env, arg); rn = "Config5"; /* Stop translation as we may have switched the execution mode */ ctx->bstate = BS_STOP; break; /* 6,7 are implementation dependent */ case 6: /* ignored */ rn = "Config6"; break; case 7: /* ignored */ rn = "Config7"; break; default: rn = "Invalid config selector"; goto cp0_unimplemented; } break; case 17: switch (sel) { case 0: gen_helper_mtc0_lladdr(cpu_env, arg); rn = "LLAddr"; break; default: goto cp0_unimplemented; } break; case 18: switch (sel) { case 0 ... 7: gen_helper_0e1i(mtc0_watchlo, arg, sel); rn = "WatchLo"; break; default: goto cp0_unimplemented; } break; case 19: switch (sel) { case 0 ... 7: gen_helper_0e1i(mtc0_watchhi, arg, sel); rn = "WatchHi"; break; default: goto cp0_unimplemented; } break; case 20: switch (sel) { case 0: #if defined(TARGET_MIPS64) check_insn(ctx, ISA_MIPS3); gen_helper_mtc0_xcontext(cpu_env, arg); rn = "XContext"; break; #endif default: goto cp0_unimplemented; } break; case 21: /* Officially reserved, but sel 0 is used for R1x000 framemask */ CP0_CHECK(!(ctx->insn_flags & ISA_MIPS32R6)); switch (sel) { case 0: gen_helper_mtc0_framemask(cpu_env, arg); rn = "Framemask"; break; default: goto cp0_unimplemented; } break; case 22: /* ignored */ rn = "Diagnostic"; /* implementation dependent */ break; case 23: switch (sel) { case 0: gen_helper_mtc0_debug(cpu_env, arg); /* EJTAG support */ /* BS_STOP isn't good enough here, hflags may have changed. */ gen_save_pc(ctx->pc + 4); ctx->bstate = BS_EXCP; rn = "Debug"; break; case 1: // gen_helper_mtc0_tracecontrol(cpu_env, arg); /* PDtrace support */ rn = "TraceControl"; /* Stop translation as we may have switched the execution mode */ ctx->bstate = BS_STOP; // break; case 2: // gen_helper_mtc0_tracecontrol2(cpu_env, arg); /* PDtrace support */ rn = "TraceControl2"; /* Stop translation as we may have switched the execution mode */ ctx->bstate = BS_STOP; // break; case 3: /* Stop translation as we may have switched the execution mode */ ctx->bstate = BS_STOP; // gen_helper_mtc0_usertracedata(cpu_env, arg); /* PDtrace support */ rn = "UserTraceData"; /* Stop translation as we may have switched the execution mode */ ctx->bstate = BS_STOP; // break; case 4: // gen_helper_mtc0_tracebpc(cpu_env, arg); /* PDtrace support */ /* Stop translation as we may have switched the execution mode */ ctx->bstate = BS_STOP; rn = "TraceBPC"; // break; default: goto cp0_unimplemented; } break; case 24: switch (sel) { case 0: /* EJTAG support */ gen_mtc0_store64(arg, offsetof(CPUMIPSState, CP0_DEPC)); rn = "DEPC"; break; default: goto cp0_unimplemented; } break; case 25: switch (sel) { case 0: gen_helper_mtc0_performance0(cpu_env, arg); rn = "Performance0"; break; case 1: // gen_helper_mtc0_performance1(arg); rn = "Performance1"; // break; case 2: // gen_helper_mtc0_performance2(arg); rn = "Performance2"; // break; case 3: // gen_helper_mtc0_performance3(arg); rn = "Performance3"; // break; case 4: // gen_helper_mtc0_performance4(arg); rn = "Performance4"; // break; case 5: // gen_helper_mtc0_performance5(arg); rn = "Performance5"; // break; case 6: // gen_helper_mtc0_performance6(arg); rn = "Performance6"; // break; case 7: // gen_helper_mtc0_performance7(arg); rn = "Performance7"; // break; default: goto cp0_unimplemented; } break; case 26: /* ignored */ rn = "ECC"; break; case 27: switch (sel) { case 0 ... 3: /* ignored */ rn = "CacheErr"; break; default: goto cp0_unimplemented; } break; case 28: switch (sel) { case 0: case 2: case 4: case 6: gen_helper_mtc0_taglo(cpu_env, arg); rn = "TagLo"; break; case 1: case 3: case 5: case 7: gen_helper_mtc0_datalo(cpu_env, arg); rn = "DataLo"; break; default: goto cp0_unimplemented; } break; case 29: switch (sel) { case 0: case 2: case 4: case 6: gen_helper_mtc0_taghi(cpu_env, arg); rn = "TagHi"; break; case 1: case 3: case 5: case 7: gen_helper_mtc0_datahi(cpu_env, arg); rn = "DataHi"; break; default: rn = "invalid sel"; goto cp0_unimplemented; } break; case 30: switch (sel) { case 0: gen_mtc0_store64(arg, offsetof(CPUMIPSState, CP0_ErrorEPC)); rn = "ErrorEPC"; break; default: goto cp0_unimplemented; } break; case 31: switch (sel) { case 0: /* EJTAG support */ gen_mtc0_store32(arg, offsetof(CPUMIPSState, CP0_DESAVE)); rn = "DESAVE"; break; case 2 ... 7: CP0_CHECK(ctx->kscrexist & (1 << sel)); tcg_gen_st_tl(arg, cpu_env, offsetof(CPUMIPSState, CP0_KScratch[sel-2])); rn = "KScratch"; break; default: goto cp0_unimplemented; } /* Stop translation as we may have switched the execution mode */ ctx->bstate = BS_STOP; break; default: goto cp0_unimplemented; } (void)rn; /* avoid a compiler warning */ LOG_DISAS("mtc0 %s (reg %d sel %d)\n", rn, reg, sel); /* For simplicity assume that all writes can cause interrupts. */ if (use_icount) { gen_io_end(); ctx->bstate = BS_STOP; } return; cp0_unimplemented: LOG_DISAS("mtc0 %s (reg %d sel %d)\n", rn, reg, sel); }
false
qemu
bd79255d2571a3c68820117caf94ea9afe1d527e
static void gen_mtc0(DisasContext *ctx, TCGv arg, int reg, int sel) { const char *rn = "invalid"; if (sel != 0) check_insn(ctx, ISA_MIPS32); if (use_icount) gen_io_start(); switch (reg) { case 0: switch (sel) { case 0: gen_helper_mtc0_index(cpu_env, arg); rn = "Index"; break; case 1: CP0_CHECK(ctx->insn_flags & ASE_MT); gen_helper_mtc0_mvpcontrol(cpu_env, arg); rn = "MVPControl"; break; case 2: CP0_CHECK(ctx->insn_flags & ASE_MT); rn = "MVPConf0"; break; case 3: CP0_CHECK(ctx->insn_flags & ASE_MT); rn = "MVPConf1"; break; default: goto cp0_unimplemented; } break; case 1: switch (sel) { case 0: rn = "Random"; break; case 1: CP0_CHECK(ctx->insn_flags & ASE_MT); gen_helper_mtc0_vpecontrol(cpu_env, arg); rn = "VPEControl"; break; case 2: CP0_CHECK(ctx->insn_flags & ASE_MT); gen_helper_mtc0_vpeconf0(cpu_env, arg); rn = "VPEConf0"; break; case 3: CP0_CHECK(ctx->insn_flags & ASE_MT); gen_helper_mtc0_vpeconf1(cpu_env, arg); rn = "VPEConf1"; break; case 4: CP0_CHECK(ctx->insn_flags & ASE_MT); gen_helper_mtc0_yqmask(cpu_env, arg); rn = "YQMask"; break; case 5: CP0_CHECK(ctx->insn_flags & ASE_MT); gen_mtc0_store64(arg, offsetof(CPUMIPSState, CP0_VPESchedule)); rn = "VPESchedule"; break; case 6: CP0_CHECK(ctx->insn_flags & ASE_MT); gen_mtc0_store64(arg, offsetof(CPUMIPSState, CP0_VPEScheFBack)); rn = "VPEScheFBack"; break; case 7: CP0_CHECK(ctx->insn_flags & ASE_MT); gen_helper_mtc0_vpeopt(cpu_env, arg); rn = "VPEOpt"; break; default: goto cp0_unimplemented; } break; case 2: switch (sel) { case 0: gen_helper_mtc0_entrylo0(cpu_env, arg); rn = "EntryLo0"; break; case 1: CP0_CHECK(ctx->insn_flags & ASE_MT); gen_helper_mtc0_tcstatus(cpu_env, arg); rn = "TCStatus"; break; case 2: CP0_CHECK(ctx->insn_flags & ASE_MT); gen_helper_mtc0_tcbind(cpu_env, arg); rn = "TCBind"; break; case 3: CP0_CHECK(ctx->insn_flags & ASE_MT); gen_helper_mtc0_tcrestart(cpu_env, arg); rn = "TCRestart"; break; case 4: CP0_CHECK(ctx->insn_flags & ASE_MT); gen_helper_mtc0_tchalt(cpu_env, arg); rn = "TCHalt"; break; case 5: CP0_CHECK(ctx->insn_flags & ASE_MT); gen_helper_mtc0_tccontext(cpu_env, arg); rn = "TCContext"; break; case 6: CP0_CHECK(ctx->insn_flags & ASE_MT); gen_helper_mtc0_tcschedule(cpu_env, arg); rn = "TCSchedule"; break; case 7: CP0_CHECK(ctx->insn_flags & ASE_MT); gen_helper_mtc0_tcschefback(cpu_env, arg); rn = "TCScheFBack"; break; default: goto cp0_unimplemented; } break; case 3: switch (sel) { case 0: gen_helper_mtc0_entrylo1(cpu_env, arg); rn = "EntryLo1"; break; default: goto cp0_unimplemented; } break; case 4: switch (sel) { case 0: gen_helper_mtc0_context(cpu_env, arg); rn = "Context"; break; case 1: rn = "ContextConfig"; goto cp0_unimplemented; case 2: CP0_CHECK(ctx->ulri); tcg_gen_st_tl(arg, cpu_env, offsetof(CPUMIPSState, active_tc.CP0_UserLocal)); rn = "UserLocal"; break; default: goto cp0_unimplemented; } break; case 5: switch (sel) { case 0: gen_helper_mtc0_pagemask(cpu_env, arg); rn = "PageMask"; break; case 1: check_insn(ctx, ISA_MIPS32R2); gen_helper_mtc0_pagegrain(cpu_env, arg); rn = "PageGrain"; break; default: goto cp0_unimplemented; } break; case 6: switch (sel) { case 0: gen_helper_mtc0_wired(cpu_env, arg); rn = "Wired"; break; case 1: check_insn(ctx, ISA_MIPS32R2); gen_helper_mtc0_srsconf0(cpu_env, arg); rn = "SRSConf0"; break; case 2: check_insn(ctx, ISA_MIPS32R2); gen_helper_mtc0_srsconf1(cpu_env, arg); rn = "SRSConf1"; break; case 3: check_insn(ctx, ISA_MIPS32R2); gen_helper_mtc0_srsconf2(cpu_env, arg); rn = "SRSConf2"; break; case 4: check_insn(ctx, ISA_MIPS32R2); gen_helper_mtc0_srsconf3(cpu_env, arg); rn = "SRSConf3"; break; case 5: check_insn(ctx, ISA_MIPS32R2); gen_helper_mtc0_srsconf4(cpu_env, arg); rn = "SRSConf4"; break; default: goto cp0_unimplemented; } break; case 7: switch (sel) { case 0: check_insn(ctx, ISA_MIPS32R2); gen_helper_mtc0_hwrena(cpu_env, arg); ctx->bstate = BS_STOP; rn = "HWREna"; break; default: goto cp0_unimplemented; } break; case 8: switch (sel) { case 0: rn = "BadVAddr"; break; case 1: rn = "BadInstr"; break; case 2: rn = "BadInstrP"; break; default: goto cp0_unimplemented; } break; case 9: switch (sel) { case 0: gen_helper_mtc0_count(cpu_env, arg); rn = "Count"; break; default: goto cp0_unimplemented; } break; case 10: switch (sel) { case 0: gen_helper_mtc0_entryhi(cpu_env, arg); rn = "EntryHi"; break; default: goto cp0_unimplemented; } break; case 11: switch (sel) { case 0: gen_helper_mtc0_compare(cpu_env, arg); rn = "Compare"; break; default: goto cp0_unimplemented; } break; case 12: switch (sel) { case 0: save_cpu_state(ctx, 1); gen_helper_mtc0_status(cpu_env, arg); gen_save_pc(ctx->pc + 4); ctx->bstate = BS_EXCP; rn = "Status"; break; case 1: check_insn(ctx, ISA_MIPS32R2); gen_helper_mtc0_intctl(cpu_env, arg); ctx->bstate = BS_STOP; rn = "IntCtl"; break; case 2: check_insn(ctx, ISA_MIPS32R2); gen_helper_mtc0_srsctl(cpu_env, arg); ctx->bstate = BS_STOP; rn = "SRSCtl"; break; case 3: check_insn(ctx, ISA_MIPS32R2); gen_mtc0_store32(arg, offsetof(CPUMIPSState, CP0_SRSMap)); ctx->bstate = BS_STOP; rn = "SRSMap"; break; default: goto cp0_unimplemented; } break; case 13: switch (sel) { case 0: save_cpu_state(ctx, 1); gen_helper_mtc0_cause(cpu_env, arg); rn = "Cause"; break; default: goto cp0_unimplemented; } break; case 14: switch (sel) { case 0: gen_mtc0_store64(arg, offsetof(CPUMIPSState, CP0_EPC)); rn = "EPC"; break; default: goto cp0_unimplemented; } break; case 15: switch (sel) { case 0: rn = "PRid"; break; case 1: check_insn(ctx, ISA_MIPS32R2); gen_helper_mtc0_ebase(cpu_env, arg); rn = "EBase"; break; default: goto cp0_unimplemented; } break; case 16: switch (sel) { case 0: gen_helper_mtc0_config0(cpu_env, arg); rn = "Config"; ctx->bstate = BS_STOP; break; case 1: rn = "Config1"; break; case 2: gen_helper_mtc0_config2(cpu_env, arg); rn = "Config2"; ctx->bstate = BS_STOP; break; case 3: gen_helper_mtc0_config3(cpu_env, arg); rn = "Config3"; ctx->bstate = BS_STOP; break; case 4: gen_helper_mtc0_config4(cpu_env, arg); rn = "Config4"; ctx->bstate = BS_STOP; break; case 5: gen_helper_mtc0_config5(cpu_env, arg); rn = "Config5"; ctx->bstate = BS_STOP; break; case 6: rn = "Config6"; break; case 7: rn = "Config7"; break; default: rn = "Invalid config selector"; goto cp0_unimplemented; } break; case 17: switch (sel) { case 0: gen_helper_mtc0_lladdr(cpu_env, arg); rn = "LLAddr"; break; default: goto cp0_unimplemented; } break; case 18: switch (sel) { case 0 ... 7: gen_helper_0e1i(mtc0_watchlo, arg, sel); rn = "WatchLo"; break; default: goto cp0_unimplemented; } break; case 19: switch (sel) { case 0 ... 7: gen_helper_0e1i(mtc0_watchhi, arg, sel); rn = "WatchHi"; break; default: goto cp0_unimplemented; } break; case 20: switch (sel) { case 0: #if defined(TARGET_MIPS64) check_insn(ctx, ISA_MIPS3); gen_helper_mtc0_xcontext(cpu_env, arg); rn = "XContext"; break; #endif default: goto cp0_unimplemented; } break; case 21: CP0_CHECK(!(ctx->insn_flags & ISA_MIPS32R6)); switch (sel) { case 0: gen_helper_mtc0_framemask(cpu_env, arg); rn = "Framemask"; break; default: goto cp0_unimplemented; } break; case 22: rn = "Diagnostic"; break; case 23: switch (sel) { case 0: gen_helper_mtc0_debug(cpu_env, arg); gen_save_pc(ctx->pc + 4); ctx->bstate = BS_EXCP; rn = "Debug"; break; case 1: rn = "TraceControl"; ctx->bstate = BS_STOP; case 2: rn = "TraceControl2"; ctx->bstate = BS_STOP; case 3: ctx->bstate = BS_STOP; rn = "UserTraceData"; ctx->bstate = BS_STOP; case 4: ctx->bstate = BS_STOP; rn = "TraceBPC"; default: goto cp0_unimplemented; } break; case 24: switch (sel) { case 0: gen_mtc0_store64(arg, offsetof(CPUMIPSState, CP0_DEPC)); rn = "DEPC"; break; default: goto cp0_unimplemented; } break; case 25: switch (sel) { case 0: gen_helper_mtc0_performance0(cpu_env, arg); rn = "Performance0"; break; case 1: rn = "Performance1"; case 2: rn = "Performance2"; case 3: rn = "Performance3"; case 4: rn = "Performance4"; case 5: rn = "Performance5"; case 6: rn = "Performance6"; case 7: rn = "Performance7"; default: goto cp0_unimplemented; } break; case 26: rn = "ECC"; break; case 27: switch (sel) { case 0 ... 3: rn = "CacheErr"; break; default: goto cp0_unimplemented; } break; case 28: switch (sel) { case 0: case 2: case 4: case 6: gen_helper_mtc0_taglo(cpu_env, arg); rn = "TagLo"; break; case 1: case 3: case 5: case 7: gen_helper_mtc0_datalo(cpu_env, arg); rn = "DataLo"; break; default: goto cp0_unimplemented; } break; case 29: switch (sel) { case 0: case 2: case 4: case 6: gen_helper_mtc0_taghi(cpu_env, arg); rn = "TagHi"; break; case 1: case 3: case 5: case 7: gen_helper_mtc0_datahi(cpu_env, arg); rn = "DataHi"; break; default: rn = "invalid sel"; goto cp0_unimplemented; } break; case 30: switch (sel) { case 0: gen_mtc0_store64(arg, offsetof(CPUMIPSState, CP0_ErrorEPC)); rn = "ErrorEPC"; break; default: goto cp0_unimplemented; } break; case 31: switch (sel) { case 0: gen_mtc0_store32(arg, offsetof(CPUMIPSState, CP0_DESAVE)); rn = "DESAVE"; break; case 2 ... 7: CP0_CHECK(ctx->kscrexist & (1 << sel)); tcg_gen_st_tl(arg, cpu_env, offsetof(CPUMIPSState, CP0_KScratch[sel-2])); rn = "KScratch"; break; default: goto cp0_unimplemented; } ctx->bstate = BS_STOP; break; default: goto cp0_unimplemented; } (void)rn; LOG_DISAS("mtc0 %s (reg %d sel %d)\n", rn, reg, sel); if (use_icount) { gen_io_end(); ctx->bstate = BS_STOP; } return; cp0_unimplemented: LOG_DISAS("mtc0 %s (reg %d sel %d)\n", rn, reg, sel); }
{ "code": [], "line_no": [] }
static void FUNC_0(DisasContext *VAR_0, TCGv VAR_1, int VAR_2, int VAR_3) { const char *VAR_4 = "invalid"; if (VAR_3 != 0) check_insn(VAR_0, ISA_MIPS32); if (use_icount) gen_io_start(); switch (VAR_2) { case 0: switch (VAR_3) { case 0: gen_helper_mtc0_index(cpu_env, VAR_1); VAR_4 = "Index"; break; case 1: CP0_CHECK(VAR_0->insn_flags & ASE_MT); gen_helper_mtc0_mvpcontrol(cpu_env, VAR_1); VAR_4 = "MVPControl"; break; case 2: CP0_CHECK(VAR_0->insn_flags & ASE_MT); VAR_4 = "MVPConf0"; break; case 3: CP0_CHECK(VAR_0->insn_flags & ASE_MT); VAR_4 = "MVPConf1"; break; default: goto cp0_unimplemented; } break; case 1: switch (VAR_3) { case 0: VAR_4 = "Random"; break; case 1: CP0_CHECK(VAR_0->insn_flags & ASE_MT); gen_helper_mtc0_vpecontrol(cpu_env, VAR_1); VAR_4 = "VPEControl"; break; case 2: CP0_CHECK(VAR_0->insn_flags & ASE_MT); gen_helper_mtc0_vpeconf0(cpu_env, VAR_1); VAR_4 = "VPEConf0"; break; case 3: CP0_CHECK(VAR_0->insn_flags & ASE_MT); gen_helper_mtc0_vpeconf1(cpu_env, VAR_1); VAR_4 = "VPEConf1"; break; case 4: CP0_CHECK(VAR_0->insn_flags & ASE_MT); gen_helper_mtc0_yqmask(cpu_env, VAR_1); VAR_4 = "YQMask"; break; case 5: CP0_CHECK(VAR_0->insn_flags & ASE_MT); gen_mtc0_store64(VAR_1, offsetof(CPUMIPSState, CP0_VPESchedule)); VAR_4 = "VPESchedule"; break; case 6: CP0_CHECK(VAR_0->insn_flags & ASE_MT); gen_mtc0_store64(VAR_1, offsetof(CPUMIPSState, CP0_VPEScheFBack)); VAR_4 = "VPEScheFBack"; break; case 7: CP0_CHECK(VAR_0->insn_flags & ASE_MT); gen_helper_mtc0_vpeopt(cpu_env, VAR_1); VAR_4 = "VPEOpt"; break; default: goto cp0_unimplemented; } break; case 2: switch (VAR_3) { case 0: gen_helper_mtc0_entrylo0(cpu_env, VAR_1); VAR_4 = "EntryLo0"; break; case 1: CP0_CHECK(VAR_0->insn_flags & ASE_MT); gen_helper_mtc0_tcstatus(cpu_env, VAR_1); VAR_4 = "TCStatus"; break; case 2: CP0_CHECK(VAR_0->insn_flags & ASE_MT); gen_helper_mtc0_tcbind(cpu_env, VAR_1); VAR_4 = "TCBind"; break; case 3: CP0_CHECK(VAR_0->insn_flags & ASE_MT); gen_helper_mtc0_tcrestart(cpu_env, VAR_1); VAR_4 = "TCRestart"; break; case 4: CP0_CHECK(VAR_0->insn_flags & ASE_MT); gen_helper_mtc0_tchalt(cpu_env, VAR_1); VAR_4 = "TCHalt"; break; case 5: CP0_CHECK(VAR_0->insn_flags & ASE_MT); gen_helper_mtc0_tccontext(cpu_env, VAR_1); VAR_4 = "TCContext"; break; case 6: CP0_CHECK(VAR_0->insn_flags & ASE_MT); gen_helper_mtc0_tcschedule(cpu_env, VAR_1); VAR_4 = "TCSchedule"; break; case 7: CP0_CHECK(VAR_0->insn_flags & ASE_MT); gen_helper_mtc0_tcschefback(cpu_env, VAR_1); VAR_4 = "TCScheFBack"; break; default: goto cp0_unimplemented; } break; case 3: switch (VAR_3) { case 0: gen_helper_mtc0_entrylo1(cpu_env, VAR_1); VAR_4 = "EntryLo1"; break; default: goto cp0_unimplemented; } break; case 4: switch (VAR_3) { case 0: gen_helper_mtc0_context(cpu_env, VAR_1); VAR_4 = "Context"; break; case 1: VAR_4 = "ContextConfig"; goto cp0_unimplemented; case 2: CP0_CHECK(VAR_0->ulri); tcg_gen_st_tl(VAR_1, cpu_env, offsetof(CPUMIPSState, active_tc.CP0_UserLocal)); VAR_4 = "UserLocal"; break; default: goto cp0_unimplemented; } break; case 5: switch (VAR_3) { case 0: gen_helper_mtc0_pagemask(cpu_env, VAR_1); VAR_4 = "PageMask"; break; case 1: check_insn(VAR_0, ISA_MIPS32R2); gen_helper_mtc0_pagegrain(cpu_env, VAR_1); VAR_4 = "PageGrain"; break; default: goto cp0_unimplemented; } break; case 6: switch (VAR_3) { case 0: gen_helper_mtc0_wired(cpu_env, VAR_1); VAR_4 = "Wired"; break; case 1: check_insn(VAR_0, ISA_MIPS32R2); gen_helper_mtc0_srsconf0(cpu_env, VAR_1); VAR_4 = "SRSConf0"; break; case 2: check_insn(VAR_0, ISA_MIPS32R2); gen_helper_mtc0_srsconf1(cpu_env, VAR_1); VAR_4 = "SRSConf1"; break; case 3: check_insn(VAR_0, ISA_MIPS32R2); gen_helper_mtc0_srsconf2(cpu_env, VAR_1); VAR_4 = "SRSConf2"; break; case 4: check_insn(VAR_0, ISA_MIPS32R2); gen_helper_mtc0_srsconf3(cpu_env, VAR_1); VAR_4 = "SRSConf3"; break; case 5: check_insn(VAR_0, ISA_MIPS32R2); gen_helper_mtc0_srsconf4(cpu_env, VAR_1); VAR_4 = "SRSConf4"; break; default: goto cp0_unimplemented; } break; case 7: switch (VAR_3) { case 0: check_insn(VAR_0, ISA_MIPS32R2); gen_helper_mtc0_hwrena(cpu_env, VAR_1); VAR_0->bstate = BS_STOP; VAR_4 = "HWREna"; break; default: goto cp0_unimplemented; } break; case 8: switch (VAR_3) { case 0: VAR_4 = "BadVAddr"; break; case 1: VAR_4 = "BadInstr"; break; case 2: VAR_4 = "BadInstrP"; break; default: goto cp0_unimplemented; } break; case 9: switch (VAR_3) { case 0: gen_helper_mtc0_count(cpu_env, VAR_1); VAR_4 = "Count"; break; default: goto cp0_unimplemented; } break; case 10: switch (VAR_3) { case 0: gen_helper_mtc0_entryhi(cpu_env, VAR_1); VAR_4 = "EntryHi"; break; default: goto cp0_unimplemented; } break; case 11: switch (VAR_3) { case 0: gen_helper_mtc0_compare(cpu_env, VAR_1); VAR_4 = "Compare"; break; default: goto cp0_unimplemented; } break; case 12: switch (VAR_3) { case 0: save_cpu_state(VAR_0, 1); gen_helper_mtc0_status(cpu_env, VAR_1); gen_save_pc(VAR_0->pc + 4); VAR_0->bstate = BS_EXCP; VAR_4 = "Status"; break; case 1: check_insn(VAR_0, ISA_MIPS32R2); gen_helper_mtc0_intctl(cpu_env, VAR_1); VAR_0->bstate = BS_STOP; VAR_4 = "IntCtl"; break; case 2: check_insn(VAR_0, ISA_MIPS32R2); gen_helper_mtc0_srsctl(cpu_env, VAR_1); VAR_0->bstate = BS_STOP; VAR_4 = "SRSCtl"; break; case 3: check_insn(VAR_0, ISA_MIPS32R2); gen_mtc0_store32(VAR_1, offsetof(CPUMIPSState, CP0_SRSMap)); VAR_0->bstate = BS_STOP; VAR_4 = "SRSMap"; break; default: goto cp0_unimplemented; } break; case 13: switch (VAR_3) { case 0: save_cpu_state(VAR_0, 1); gen_helper_mtc0_cause(cpu_env, VAR_1); VAR_4 = "Cause"; break; default: goto cp0_unimplemented; } break; case 14: switch (VAR_3) { case 0: gen_mtc0_store64(VAR_1, offsetof(CPUMIPSState, CP0_EPC)); VAR_4 = "EPC"; break; default: goto cp0_unimplemented; } break; case 15: switch (VAR_3) { case 0: VAR_4 = "PRid"; break; case 1: check_insn(VAR_0, ISA_MIPS32R2); gen_helper_mtc0_ebase(cpu_env, VAR_1); VAR_4 = "EBase"; break; default: goto cp0_unimplemented; } break; case 16: switch (VAR_3) { case 0: gen_helper_mtc0_config0(cpu_env, VAR_1); VAR_4 = "Config"; VAR_0->bstate = BS_STOP; break; case 1: VAR_4 = "Config1"; break; case 2: gen_helper_mtc0_config2(cpu_env, VAR_1); VAR_4 = "Config2"; VAR_0->bstate = BS_STOP; break; case 3: gen_helper_mtc0_config3(cpu_env, VAR_1); VAR_4 = "Config3"; VAR_0->bstate = BS_STOP; break; case 4: gen_helper_mtc0_config4(cpu_env, VAR_1); VAR_4 = "Config4"; VAR_0->bstate = BS_STOP; break; case 5: gen_helper_mtc0_config5(cpu_env, VAR_1); VAR_4 = "Config5"; VAR_0->bstate = BS_STOP; break; case 6: VAR_4 = "Config6"; break; case 7: VAR_4 = "Config7"; break; default: VAR_4 = "Invalid config selector"; goto cp0_unimplemented; } break; case 17: switch (VAR_3) { case 0: gen_helper_mtc0_lladdr(cpu_env, VAR_1); VAR_4 = "LLAddr"; break; default: goto cp0_unimplemented; } break; case 18: switch (VAR_3) { case 0 ... 7: gen_helper_0e1i(mtc0_watchlo, VAR_1, VAR_3); VAR_4 = "WatchLo"; break; default: goto cp0_unimplemented; } break; case 19: switch (VAR_3) { case 0 ... 7: gen_helper_0e1i(mtc0_watchhi, VAR_1, VAR_3); VAR_4 = "WatchHi"; break; default: goto cp0_unimplemented; } break; case 20: switch (VAR_3) { case 0: #if defined(TARGET_MIPS64) check_insn(VAR_0, ISA_MIPS3); gen_helper_mtc0_xcontext(cpu_env, VAR_1); VAR_4 = "XContext"; break; #endif default: goto cp0_unimplemented; } break; case 21: CP0_CHECK(!(VAR_0->insn_flags & ISA_MIPS32R6)); switch (VAR_3) { case 0: gen_helper_mtc0_framemask(cpu_env, VAR_1); VAR_4 = "Framemask"; break; default: goto cp0_unimplemented; } break; case 22: VAR_4 = "Diagnostic"; break; case 23: switch (VAR_3) { case 0: gen_helper_mtc0_debug(cpu_env, VAR_1); gen_save_pc(VAR_0->pc + 4); VAR_0->bstate = BS_EXCP; VAR_4 = "Debug"; break; case 1: VAR_4 = "TraceControl"; VAR_0->bstate = BS_STOP; case 2: VAR_4 = "TraceControl2"; VAR_0->bstate = BS_STOP; case 3: VAR_0->bstate = BS_STOP; VAR_4 = "UserTraceData"; VAR_0->bstate = BS_STOP; case 4: VAR_0->bstate = BS_STOP; VAR_4 = "TraceBPC"; default: goto cp0_unimplemented; } break; case 24: switch (VAR_3) { case 0: gen_mtc0_store64(VAR_1, offsetof(CPUMIPSState, CP0_DEPC)); VAR_4 = "DEPC"; break; default: goto cp0_unimplemented; } break; case 25: switch (VAR_3) { case 0: gen_helper_mtc0_performance0(cpu_env, VAR_1); VAR_4 = "Performance0"; break; case 1: VAR_4 = "Performance1"; case 2: VAR_4 = "Performance2"; case 3: VAR_4 = "Performance3"; case 4: VAR_4 = "Performance4"; case 5: VAR_4 = "Performance5"; case 6: VAR_4 = "Performance6"; case 7: VAR_4 = "Performance7"; default: goto cp0_unimplemented; } break; case 26: VAR_4 = "ECC"; break; case 27: switch (VAR_3) { case 0 ... 3: VAR_4 = "CacheErr"; break; default: goto cp0_unimplemented; } break; case 28: switch (VAR_3) { case 0: case 2: case 4: case 6: gen_helper_mtc0_taglo(cpu_env, VAR_1); VAR_4 = "TagLo"; break; case 1: case 3: case 5: case 7: gen_helper_mtc0_datalo(cpu_env, VAR_1); VAR_4 = "DataLo"; break; default: goto cp0_unimplemented; } break; case 29: switch (VAR_3) { case 0: case 2: case 4: case 6: gen_helper_mtc0_taghi(cpu_env, VAR_1); VAR_4 = "TagHi"; break; case 1: case 3: case 5: case 7: gen_helper_mtc0_datahi(cpu_env, VAR_1); VAR_4 = "DataHi"; break; default: VAR_4 = "invalid VAR_3"; goto cp0_unimplemented; } break; case 30: switch (VAR_3) { case 0: gen_mtc0_store64(VAR_1, offsetof(CPUMIPSState, CP0_ErrorEPC)); VAR_4 = "ErrorEPC"; break; default: goto cp0_unimplemented; } break; case 31: switch (VAR_3) { case 0: gen_mtc0_store32(VAR_1, offsetof(CPUMIPSState, CP0_DESAVE)); VAR_4 = "DESAVE"; break; case 2 ... 7: CP0_CHECK(VAR_0->kscrexist & (1 << VAR_3)); tcg_gen_st_tl(VAR_1, cpu_env, offsetof(CPUMIPSState, CP0_KScratch[VAR_3-2])); VAR_4 = "KScratch"; break; default: goto cp0_unimplemented; } VAR_0->bstate = BS_STOP; break; default: goto cp0_unimplemented; } (void)VAR_4; LOG_DISAS("mtc0 %s (VAR_2 %d VAR_3 %d)\n", VAR_4, VAR_2, VAR_3); if (use_icount) { gen_io_end(); VAR_0->bstate = BS_STOP; } return; cp0_unimplemented: LOG_DISAS("mtc0 %s (VAR_2 %d VAR_3 %d)\n", VAR_4, VAR_2, VAR_3); }
[ "static void FUNC_0(DisasContext *VAR_0, TCGv VAR_1, int VAR_2, int VAR_3)\n{", "const char *VAR_4 = \"invalid\";", "if (VAR_3 != 0)\ncheck_insn(VAR_0, ISA_MIPS32);", "if (use_icount)\ngen_io_start();", "switch (VAR_2) {", "case 0:\nswitch (VAR_3) {", "case 0:\ngen_helper_mtc0_index(cpu_env, VAR_1);", "VAR_4 = \"Index\";", "break;", "case 1:\nCP0_CHECK(VAR_0->insn_flags & ASE_MT);", "gen_helper_mtc0_mvpcontrol(cpu_env, VAR_1);", "VAR_4 = \"MVPControl\";", "break;", "case 2:\nCP0_CHECK(VAR_0->insn_flags & ASE_MT);", "VAR_4 = \"MVPConf0\";", "break;", "case 3:\nCP0_CHECK(VAR_0->insn_flags & ASE_MT);", "VAR_4 = \"MVPConf1\";", "break;", "default:\ngoto cp0_unimplemented;", "}", "break;", "case 1:\nswitch (VAR_3) {", "case 0:\nVAR_4 = \"Random\";", "break;", "case 1:\nCP0_CHECK(VAR_0->insn_flags & ASE_MT);", "gen_helper_mtc0_vpecontrol(cpu_env, VAR_1);", "VAR_4 = \"VPEControl\";", "break;", "case 2:\nCP0_CHECK(VAR_0->insn_flags & ASE_MT);", "gen_helper_mtc0_vpeconf0(cpu_env, VAR_1);", "VAR_4 = \"VPEConf0\";", "break;", "case 3:\nCP0_CHECK(VAR_0->insn_flags & ASE_MT);", "gen_helper_mtc0_vpeconf1(cpu_env, VAR_1);", "VAR_4 = \"VPEConf1\";", "break;", "case 4:\nCP0_CHECK(VAR_0->insn_flags & ASE_MT);", "gen_helper_mtc0_yqmask(cpu_env, VAR_1);", "VAR_4 = \"YQMask\";", "break;", "case 5:\nCP0_CHECK(VAR_0->insn_flags & ASE_MT);", "gen_mtc0_store64(VAR_1, offsetof(CPUMIPSState, CP0_VPESchedule));", "VAR_4 = \"VPESchedule\";", "break;", "case 6:\nCP0_CHECK(VAR_0->insn_flags & ASE_MT);", "gen_mtc0_store64(VAR_1, offsetof(CPUMIPSState, CP0_VPEScheFBack));", "VAR_4 = \"VPEScheFBack\";", "break;", "case 7:\nCP0_CHECK(VAR_0->insn_flags & ASE_MT);", "gen_helper_mtc0_vpeopt(cpu_env, VAR_1);", "VAR_4 = \"VPEOpt\";", "break;", "default:\ngoto cp0_unimplemented;", "}", "break;", "case 2:\nswitch (VAR_3) {", "case 0:\ngen_helper_mtc0_entrylo0(cpu_env, VAR_1);", "VAR_4 = \"EntryLo0\";", "break;", "case 1:\nCP0_CHECK(VAR_0->insn_flags & ASE_MT);", "gen_helper_mtc0_tcstatus(cpu_env, VAR_1);", "VAR_4 = \"TCStatus\";", "break;", "case 2:\nCP0_CHECK(VAR_0->insn_flags & ASE_MT);", "gen_helper_mtc0_tcbind(cpu_env, VAR_1);", "VAR_4 = \"TCBind\";", "break;", "case 3:\nCP0_CHECK(VAR_0->insn_flags & ASE_MT);", "gen_helper_mtc0_tcrestart(cpu_env, VAR_1);", "VAR_4 = \"TCRestart\";", "break;", "case 4:\nCP0_CHECK(VAR_0->insn_flags & ASE_MT);", "gen_helper_mtc0_tchalt(cpu_env, VAR_1);", "VAR_4 = \"TCHalt\";", "break;", "case 5:\nCP0_CHECK(VAR_0->insn_flags & ASE_MT);", "gen_helper_mtc0_tccontext(cpu_env, VAR_1);", "VAR_4 = \"TCContext\";", "break;", "case 6:\nCP0_CHECK(VAR_0->insn_flags & ASE_MT);", "gen_helper_mtc0_tcschedule(cpu_env, VAR_1);", "VAR_4 = \"TCSchedule\";", "break;", "case 7:\nCP0_CHECK(VAR_0->insn_flags & ASE_MT);", "gen_helper_mtc0_tcschefback(cpu_env, VAR_1);", "VAR_4 = \"TCScheFBack\";", "break;", "default:\ngoto cp0_unimplemented;", "}", "break;", "case 3:\nswitch (VAR_3) {", "case 0:\ngen_helper_mtc0_entrylo1(cpu_env, VAR_1);", "VAR_4 = \"EntryLo1\";", "break;", "default:\ngoto cp0_unimplemented;", "}", "break;", "case 4:\nswitch (VAR_3) {", "case 0:\ngen_helper_mtc0_context(cpu_env, VAR_1);", "VAR_4 = \"Context\";", "break;", "case 1:\nVAR_4 = \"ContextConfig\";", "goto cp0_unimplemented;", "case 2:\nCP0_CHECK(VAR_0->ulri);", "tcg_gen_st_tl(VAR_1, cpu_env,\noffsetof(CPUMIPSState, active_tc.CP0_UserLocal));", "VAR_4 = \"UserLocal\";", "break;", "default:\ngoto cp0_unimplemented;", "}", "break;", "case 5:\nswitch (VAR_3) {", "case 0:\ngen_helper_mtc0_pagemask(cpu_env, VAR_1);", "VAR_4 = \"PageMask\";", "break;", "case 1:\ncheck_insn(VAR_0, ISA_MIPS32R2);", "gen_helper_mtc0_pagegrain(cpu_env, VAR_1);", "VAR_4 = \"PageGrain\";", "break;", "default:\ngoto cp0_unimplemented;", "}", "break;", "case 6:\nswitch (VAR_3) {", "case 0:\ngen_helper_mtc0_wired(cpu_env, VAR_1);", "VAR_4 = \"Wired\";", "break;", "case 1:\ncheck_insn(VAR_0, ISA_MIPS32R2);", "gen_helper_mtc0_srsconf0(cpu_env, VAR_1);", "VAR_4 = \"SRSConf0\";", "break;", "case 2:\ncheck_insn(VAR_0, ISA_MIPS32R2);", "gen_helper_mtc0_srsconf1(cpu_env, VAR_1);", "VAR_4 = \"SRSConf1\";", "break;", "case 3:\ncheck_insn(VAR_0, ISA_MIPS32R2);", "gen_helper_mtc0_srsconf2(cpu_env, VAR_1);", "VAR_4 = \"SRSConf2\";", "break;", "case 4:\ncheck_insn(VAR_0, ISA_MIPS32R2);", "gen_helper_mtc0_srsconf3(cpu_env, VAR_1);", "VAR_4 = \"SRSConf3\";", "break;", "case 5:\ncheck_insn(VAR_0, ISA_MIPS32R2);", "gen_helper_mtc0_srsconf4(cpu_env, VAR_1);", "VAR_4 = \"SRSConf4\";", "break;", "default:\ngoto cp0_unimplemented;", "}", "break;", "case 7:\nswitch (VAR_3) {", "case 0:\ncheck_insn(VAR_0, ISA_MIPS32R2);", "gen_helper_mtc0_hwrena(cpu_env, VAR_1);", "VAR_0->bstate = BS_STOP;", "VAR_4 = \"HWREna\";", "break;", "default:\ngoto cp0_unimplemented;", "}", "break;", "case 8:\nswitch (VAR_3) {", "case 0:\nVAR_4 = \"BadVAddr\";", "break;", "case 1:\nVAR_4 = \"BadInstr\";", "break;", "case 2:\nVAR_4 = \"BadInstrP\";", "break;", "default:\ngoto cp0_unimplemented;", "}", "break;", "case 9:\nswitch (VAR_3) {", "case 0:\ngen_helper_mtc0_count(cpu_env, VAR_1);", "VAR_4 = \"Count\";", "break;", "default:\ngoto cp0_unimplemented;", "}", "break;", "case 10:\nswitch (VAR_3) {", "case 0:\ngen_helper_mtc0_entryhi(cpu_env, VAR_1);", "VAR_4 = \"EntryHi\";", "break;", "default:\ngoto cp0_unimplemented;", "}", "break;", "case 11:\nswitch (VAR_3) {", "case 0:\ngen_helper_mtc0_compare(cpu_env, VAR_1);", "VAR_4 = \"Compare\";", "break;", "default:\ngoto cp0_unimplemented;", "}", "break;", "case 12:\nswitch (VAR_3) {", "case 0:\nsave_cpu_state(VAR_0, 1);", "gen_helper_mtc0_status(cpu_env, VAR_1);", "gen_save_pc(VAR_0->pc + 4);", "VAR_0->bstate = BS_EXCP;", "VAR_4 = \"Status\";", "break;", "case 1:\ncheck_insn(VAR_0, ISA_MIPS32R2);", "gen_helper_mtc0_intctl(cpu_env, VAR_1);", "VAR_0->bstate = BS_STOP;", "VAR_4 = \"IntCtl\";", "break;", "case 2:\ncheck_insn(VAR_0, ISA_MIPS32R2);", "gen_helper_mtc0_srsctl(cpu_env, VAR_1);", "VAR_0->bstate = BS_STOP;", "VAR_4 = \"SRSCtl\";", "break;", "case 3:\ncheck_insn(VAR_0, ISA_MIPS32R2);", "gen_mtc0_store32(VAR_1, offsetof(CPUMIPSState, CP0_SRSMap));", "VAR_0->bstate = BS_STOP;", "VAR_4 = \"SRSMap\";", "break;", "default:\ngoto cp0_unimplemented;", "}", "break;", "case 13:\nswitch (VAR_3) {", "case 0:\nsave_cpu_state(VAR_0, 1);", "gen_helper_mtc0_cause(cpu_env, VAR_1);", "VAR_4 = \"Cause\";", "break;", "default:\ngoto cp0_unimplemented;", "}", "break;", "case 14:\nswitch (VAR_3) {", "case 0:\ngen_mtc0_store64(VAR_1, offsetof(CPUMIPSState, CP0_EPC));", "VAR_4 = \"EPC\";", "break;", "default:\ngoto cp0_unimplemented;", "}", "break;", "case 15:\nswitch (VAR_3) {", "case 0:\nVAR_4 = \"PRid\";", "break;", "case 1:\ncheck_insn(VAR_0, ISA_MIPS32R2);", "gen_helper_mtc0_ebase(cpu_env, VAR_1);", "VAR_4 = \"EBase\";", "break;", "default:\ngoto cp0_unimplemented;", "}", "break;", "case 16:\nswitch (VAR_3) {", "case 0:\ngen_helper_mtc0_config0(cpu_env, VAR_1);", "VAR_4 = \"Config\";", "VAR_0->bstate = BS_STOP;", "break;", "case 1:\nVAR_4 = \"Config1\";", "break;", "case 2:\ngen_helper_mtc0_config2(cpu_env, VAR_1);", "VAR_4 = \"Config2\";", "VAR_0->bstate = BS_STOP;", "break;", "case 3:\ngen_helper_mtc0_config3(cpu_env, VAR_1);", "VAR_4 = \"Config3\";", "VAR_0->bstate = BS_STOP;", "break;", "case 4:\ngen_helper_mtc0_config4(cpu_env, VAR_1);", "VAR_4 = \"Config4\";", "VAR_0->bstate = BS_STOP;", "break;", "case 5:\ngen_helper_mtc0_config5(cpu_env, VAR_1);", "VAR_4 = \"Config5\";", "VAR_0->bstate = BS_STOP;", "break;", "case 6:\nVAR_4 = \"Config6\";", "break;", "case 7:\nVAR_4 = \"Config7\";", "break;", "default:\nVAR_4 = \"Invalid config selector\";", "goto cp0_unimplemented;", "}", "break;", "case 17:\nswitch (VAR_3) {", "case 0:\ngen_helper_mtc0_lladdr(cpu_env, VAR_1);", "VAR_4 = \"LLAddr\";", "break;", "default:\ngoto cp0_unimplemented;", "}", "break;", "case 18:\nswitch (VAR_3) {", "case 0 ... 7:\ngen_helper_0e1i(mtc0_watchlo, VAR_1, VAR_3);", "VAR_4 = \"WatchLo\";", "break;", "default:\ngoto cp0_unimplemented;", "}", "break;", "case 19:\nswitch (VAR_3) {", "case 0 ... 7:\ngen_helper_0e1i(mtc0_watchhi, VAR_1, VAR_3);", "VAR_4 = \"WatchHi\";", "break;", "default:\ngoto cp0_unimplemented;", "}", "break;", "case 20:\nswitch (VAR_3) {", "case 0:\n#if defined(TARGET_MIPS64)\ncheck_insn(VAR_0, ISA_MIPS3);", "gen_helper_mtc0_xcontext(cpu_env, VAR_1);", "VAR_4 = \"XContext\";", "break;", "#endif\ndefault:\ngoto cp0_unimplemented;", "}", "break;", "case 21:\nCP0_CHECK(!(VAR_0->insn_flags & ISA_MIPS32R6));", "switch (VAR_3) {", "case 0:\ngen_helper_mtc0_framemask(cpu_env, VAR_1);", "VAR_4 = \"Framemask\";", "break;", "default:\ngoto cp0_unimplemented;", "}", "break;", "case 22:\nVAR_4 = \"Diagnostic\";", "break;", "case 23:\nswitch (VAR_3) {", "case 0:\ngen_helper_mtc0_debug(cpu_env, VAR_1);", "gen_save_pc(VAR_0->pc + 4);", "VAR_0->bstate = BS_EXCP;", "VAR_4 = \"Debug\";", "break;", "case 1:\nVAR_4 = \"TraceControl\";", "VAR_0->bstate = BS_STOP;", "case 2:\nVAR_4 = \"TraceControl2\";", "VAR_0->bstate = BS_STOP;", "case 3:\nVAR_0->bstate = BS_STOP;", "VAR_4 = \"UserTraceData\";", "VAR_0->bstate = BS_STOP;", "case 4:\nVAR_0->bstate = BS_STOP;", "VAR_4 = \"TraceBPC\";", "default:\ngoto cp0_unimplemented;", "}", "break;", "case 24:\nswitch (VAR_3) {", "case 0:\ngen_mtc0_store64(VAR_1, offsetof(CPUMIPSState, CP0_DEPC));", "VAR_4 = \"DEPC\";", "break;", "default:\ngoto cp0_unimplemented;", "}", "break;", "case 25:\nswitch (VAR_3) {", "case 0:\ngen_helper_mtc0_performance0(cpu_env, VAR_1);", "VAR_4 = \"Performance0\";", "break;", "case 1:\nVAR_4 = \"Performance1\";", "case 2:\nVAR_4 = \"Performance2\";", "case 3:\nVAR_4 = \"Performance3\";", "case 4:\nVAR_4 = \"Performance4\";", "case 5:\nVAR_4 = \"Performance5\";", "case 6:\nVAR_4 = \"Performance6\";", "case 7:\nVAR_4 = \"Performance7\";", "default:\ngoto cp0_unimplemented;", "}", "break;", "case 26:\nVAR_4 = \"ECC\";", "break;", "case 27:\nswitch (VAR_3) {", "case 0 ... 3:\nVAR_4 = \"CacheErr\";", "break;", "default:\ngoto cp0_unimplemented;", "}", "break;", "case 28:\nswitch (VAR_3) {", "case 0:\ncase 2:\ncase 4:\ncase 6:\ngen_helper_mtc0_taglo(cpu_env, VAR_1);", "VAR_4 = \"TagLo\";", "break;", "case 1:\ncase 3:\ncase 5:\ncase 7:\ngen_helper_mtc0_datalo(cpu_env, VAR_1);", "VAR_4 = \"DataLo\";", "break;", "default:\ngoto cp0_unimplemented;", "}", "break;", "case 29:\nswitch (VAR_3) {", "case 0:\ncase 2:\ncase 4:\ncase 6:\ngen_helper_mtc0_taghi(cpu_env, VAR_1);", "VAR_4 = \"TagHi\";", "break;", "case 1:\ncase 3:\ncase 5:\ncase 7:\ngen_helper_mtc0_datahi(cpu_env, VAR_1);", "VAR_4 = \"DataHi\";", "break;", "default:\nVAR_4 = \"invalid VAR_3\";", "goto cp0_unimplemented;", "}", "break;", "case 30:\nswitch (VAR_3) {", "case 0:\ngen_mtc0_store64(VAR_1, offsetof(CPUMIPSState, CP0_ErrorEPC));", "VAR_4 = \"ErrorEPC\";", "break;", "default:\ngoto cp0_unimplemented;", "}", "break;", "case 31:\nswitch (VAR_3) {", "case 0:\ngen_mtc0_store32(VAR_1, offsetof(CPUMIPSState, CP0_DESAVE));", "VAR_4 = \"DESAVE\";", "break;", "case 2 ... 7:\nCP0_CHECK(VAR_0->kscrexist & (1 << VAR_3));", "tcg_gen_st_tl(VAR_1, cpu_env,\noffsetof(CPUMIPSState, CP0_KScratch[VAR_3-2]));", "VAR_4 = \"KScratch\";", "break;", "default:\ngoto cp0_unimplemented;", "}", "VAR_0->bstate = BS_STOP;", "break;", "default:\ngoto cp0_unimplemented;", "}", "(void)VAR_4;", "LOG_DISAS(\"mtc0 %s (VAR_2 %d VAR_3 %d)\\n\", VAR_4, VAR_2, VAR_3);", "if (use_icount) {", "gen_io_end();", "VAR_0->bstate = BS_STOP;", "}", "return;", "cp0_unimplemented:\nLOG_DISAS(\"mtc0 %s (VAR_2 %d VAR_3 %d)\\n\", VAR_4, VAR_2, VAR_3);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11 ], [ 15, 17 ], [ 21 ], [ 23, 25 ], [ 27, 29 ], [ 31 ], [ 33 ], [ 35, 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45, 47 ], [ 51 ], [ 53 ], [ 55, 57 ], [ 61 ], [ 63 ], [ 65, 67 ], [ 69 ], [ 71 ], [ 73, 75 ], [ 77, 81 ], [ 83 ], [ 85, 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95, 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105, 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115, 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125, 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135, 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145, 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155, 157 ], [ 159 ], [ 161 ], [ 163, 165 ], [ 167, 169 ], [ 171 ], [ 173 ], [ 175, 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185, 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195, 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205, 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215, 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225, 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235, 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245, 247 ], [ 249 ], [ 251 ], [ 253, 255 ], [ 257, 259 ], [ 261 ], [ 263 ], [ 265, 267 ], [ 269 ], [ 271 ], [ 273, 275 ], [ 277, 279 ], [ 281 ], [ 283 ], [ 285, 289 ], [ 291 ], [ 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, 447 ], [ 449 ], [ 451, 455 ], [ 457 ], [ 459, 463 ], [ 465 ], [ 467, 469 ], [ 471 ], [ 473 ], [ 475, 477 ], [ 479, 481 ], [ 483 ], [ 485 ], [ 489, 491 ], [ 493 ], [ 495 ], [ 497, 499 ], [ 501, 503 ], [ 505 ], [ 507 ], [ 509, 511 ], [ 513 ], [ 515 ], [ 517, 519 ], [ 521, 523 ], [ 525 ], [ 527 ], [ 531, 533 ], [ 535 ], [ 537 ], [ 539, 541 ], [ 543, 545 ], [ 547 ], [ 551 ], [ 553 ], [ 555 ], [ 557 ], [ 559, 561 ], [ 563 ], [ 567 ], [ 569 ], [ 571 ], [ 573, 575 ], [ 577 ], [ 581 ], [ 583 ], [ 585 ], [ 587, 589 ], [ 591 ], [ 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, 659 ], [ 661 ], [ 663, 665 ], [ 667 ], [ 669 ], [ 671 ], [ 673, 675 ], [ 677 ], [ 679 ], [ 681, 683 ], [ 685, 687 ], [ 689 ], [ 693 ], [ 695 ], [ 697, 701 ], [ 703 ], [ 705, 707 ], [ 709 ], [ 713 ], [ 715 ], [ 717, 719 ], [ 721 ], [ 725 ], [ 727 ], [ 729, 731 ], [ 733 ], [ 735 ], [ 737 ], [ 739, 741 ], [ 743 ], [ 747 ], [ 749 ], [ 753, 757 ], [ 759 ], [ 761, 765 ], [ 767 ], [ 769, 771 ], [ 773 ], [ 775 ], [ 777 ], [ 779, 781 ], [ 783, 785 ], [ 787 ], [ 789 ], [ 791, 793 ], [ 795 ], [ 797 ], [ 799, 801 ], [ 803, 805 ], [ 807 ], [ 809 ], [ 811, 813 ], [ 815 ], [ 817 ], [ 819, 821 ], [ 823, 825 ], [ 827 ], [ 829 ], [ 831, 833 ], [ 835 ], [ 837 ], [ 839, 841 ], [ 843, 845, 847 ], [ 849 ], [ 851 ], [ 853 ], [ 855, 857, 859 ], [ 861 ], [ 863 ], [ 865, 869 ], [ 871 ], [ 873, 875 ], [ 877 ], [ 879 ], [ 881, 883 ], [ 885 ], [ 887 ], [ 889, 893 ], [ 895 ], [ 897, 899 ], [ 901, 903 ], [ 907 ], [ 909 ], [ 911 ], [ 913 ], [ 915, 919 ], [ 923 ], [ 927, 931 ], [ 935 ], [ 939, 943 ], [ 947 ], [ 951 ], [ 955, 961 ], [ 963 ], [ 967, 969 ], [ 971 ], [ 973 ], [ 975, 977 ], [ 979, 983 ], [ 985 ], [ 987 ], [ 989, 991 ], [ 993 ], [ 995 ], [ 997, 999 ], [ 1001, 1003 ], [ 1005 ], [ 1007 ], [ 1009, 1013 ], [ 1017, 1021 ], [ 1025, 1029 ], [ 1033, 1037 ], [ 1041, 1045 ], [ 1049, 1053 ], [ 1057, 1061 ], [ 1065, 1067 ], [ 1069 ], [ 1071 ], [ 1073, 1077 ], [ 1079 ], [ 1081, 1083 ], [ 1085, 1089 ], [ 1091 ], [ 1093, 1095 ], [ 1097 ], [ 1099 ], [ 1101, 1103 ], [ 1105, 1107, 1109, 1111, 1113 ], [ 1115 ], [ 1117 ], [ 1119, 1121, 1123, 1125, 1127 ], [ 1129 ], [ 1131 ], [ 1133, 1135 ], [ 1137 ], [ 1139 ], [ 1141, 1143 ], [ 1145, 1147, 1149, 1151, 1153 ], [ 1155 ], [ 1157 ], [ 1159, 1161, 1163, 1165, 1167 ], [ 1169 ], [ 1171 ], [ 1173, 1175 ], [ 1177 ], [ 1179 ], [ 1181 ], [ 1183, 1185 ], [ 1187, 1189 ], [ 1191 ], [ 1193 ], [ 1195, 1197 ], [ 1199 ], [ 1201 ], [ 1203, 1205 ], [ 1207, 1211 ], [ 1213 ], [ 1215 ], [ 1217, 1219 ], [ 1221, 1223 ], [ 1225 ], [ 1227 ], [ 1229, 1231 ], [ 1233 ], [ 1237 ], [ 1239 ], [ 1241, 1243 ], [ 1245 ], [ 1247 ], [ 1249 ], [ 1253 ], [ 1255 ], [ 1257 ], [ 1259 ], [ 1261 ], [ 1265, 1267 ], [ 1269 ] ]
7,364
void module_call_init(module_init_type type) { ModuleTypeList *l; ModuleEntry *e; l = find_type(type); TAILQ_FOREACH(e, l, node) { e->init(); } }
false
qemu
72cf2d4f0e181d0d3a3122e04129c58a95da713e
void module_call_init(module_init_type type) { ModuleTypeList *l; ModuleEntry *e; l = find_type(type); TAILQ_FOREACH(e, l, node) { e->init(); } }
{ "code": [], "line_no": [] }
void FUNC_0(module_init_type VAR_0) { ModuleTypeList *l; ModuleEntry *e; l = find_type(VAR_0); TAILQ_FOREACH(e, l, node) { e->init(); } }
[ "void FUNC_0(module_init_type VAR_0)\n{", "ModuleTypeList *l;", "ModuleEntry *e;", "l = find_type(VAR_0);", "TAILQ_FOREACH(e, l, node) {", "e->init();", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
7,365
static void qmp_output_free(Visitor *v) { QmpOutputVisitor *qov = to_qov(v); QStackEntry *e; while (!QSLIST_EMPTY(&qov->stack)) { e = QSLIST_FIRST(&qov->stack); QSLIST_REMOVE_HEAD(&qov->stack, node); g_free(e); } qobject_decref(qov->root); g_free(qov); }
false
qemu
b3db211f3c80bb996a704d665fe275619f728bd4
static void qmp_output_free(Visitor *v) { QmpOutputVisitor *qov = to_qov(v); QStackEntry *e; while (!QSLIST_EMPTY(&qov->stack)) { e = QSLIST_FIRST(&qov->stack); QSLIST_REMOVE_HEAD(&qov->stack, node); g_free(e); } qobject_decref(qov->root); g_free(qov); }
{ "code": [], "line_no": [] }
static void FUNC_0(Visitor *VAR_0) { QmpOutputVisitor *qov = to_qov(VAR_0); QStackEntry *e; while (!QSLIST_EMPTY(&qov->stack)) { e = QSLIST_FIRST(&qov->stack); QSLIST_REMOVE_HEAD(&qov->stack, node); g_free(e); } qobject_decref(qov->root); g_free(qov); }
[ "static void FUNC_0(Visitor *VAR_0)\n{", "QmpOutputVisitor *qov = to_qov(VAR_0);", "QStackEntry *e;", "while (!QSLIST_EMPTY(&qov->stack)) {", "e = QSLIST_FIRST(&qov->stack);", "QSLIST_REMOVE_HEAD(&qov->stack, node);", "g_free(e);", "}", "qobject_decref(qov->root);", "g_free(qov);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ] ]
7,366
static void cpu_x86_register(X86CPU *cpu, const char *name, Error **errp) { CPUX86State *env = &cpu->env; x86_def_t def1, *def = &def1; memset(def, 0, sizeof(*def)); if (cpu_x86_find_by_name(cpu, def, name) < 0) { error_setg(errp, "Unable to find CPU definition: %s", name); return; } object_property_set_str(OBJECT(cpu), def->vendor, "vendor", errp); object_property_set_int(OBJECT(cpu), def->level, "level", errp); object_property_set_int(OBJECT(cpu), def->family, "family", errp); object_property_set_int(OBJECT(cpu), def->model, "model", errp); object_property_set_int(OBJECT(cpu), def->stepping, "stepping", errp); env->features[FEAT_1_EDX] = def->features[FEAT_1_EDX]; env->features[FEAT_1_ECX] = def->features[FEAT_1_ECX]; env->features[FEAT_8000_0001_EDX] = def->features[FEAT_8000_0001_EDX]; env->features[FEAT_8000_0001_ECX] = def->features[FEAT_8000_0001_ECX]; object_property_set_int(OBJECT(cpu), def->xlevel, "xlevel", errp); env->features[FEAT_KVM] = def->features[FEAT_KVM]; env->features[FEAT_SVM] = def->features[FEAT_SVM]; env->features[FEAT_C000_0001_EDX] = def->features[FEAT_C000_0001_EDX]; env->features[FEAT_7_0_EBX] = def->features[FEAT_7_0_EBX]; env->cpuid_xlevel2 = def->xlevel2; cpu->cache_info_passthrough = def->cache_info_passthrough; object_property_set_str(OBJECT(cpu), def->model_id, "model-id", errp); /* Special cases not set in the x86_def_t structs: */ if (kvm_enabled()) { env->features[FEAT_KVM] |= kvm_default_features; } env->features[FEAT_1_ECX] |= CPUID_EXT_HYPERVISOR; }
false
qemu
7c08db30e6a43f7083a881eb07bfbc878e001e08
static void cpu_x86_register(X86CPU *cpu, const char *name, Error **errp) { CPUX86State *env = &cpu->env; x86_def_t def1, *def = &def1; memset(def, 0, sizeof(*def)); if (cpu_x86_find_by_name(cpu, def, name) < 0) { error_setg(errp, "Unable to find CPU definition: %s", name); return; } object_property_set_str(OBJECT(cpu), def->vendor, "vendor", errp); object_property_set_int(OBJECT(cpu), def->level, "level", errp); object_property_set_int(OBJECT(cpu), def->family, "family", errp); object_property_set_int(OBJECT(cpu), def->model, "model", errp); object_property_set_int(OBJECT(cpu), def->stepping, "stepping", errp); env->features[FEAT_1_EDX] = def->features[FEAT_1_EDX]; env->features[FEAT_1_ECX] = def->features[FEAT_1_ECX]; env->features[FEAT_8000_0001_EDX] = def->features[FEAT_8000_0001_EDX]; env->features[FEAT_8000_0001_ECX] = def->features[FEAT_8000_0001_ECX]; object_property_set_int(OBJECT(cpu), def->xlevel, "xlevel", errp); env->features[FEAT_KVM] = def->features[FEAT_KVM]; env->features[FEAT_SVM] = def->features[FEAT_SVM]; env->features[FEAT_C000_0001_EDX] = def->features[FEAT_C000_0001_EDX]; env->features[FEAT_7_0_EBX] = def->features[FEAT_7_0_EBX]; env->cpuid_xlevel2 = def->xlevel2; cpu->cache_info_passthrough = def->cache_info_passthrough; object_property_set_str(OBJECT(cpu), def->model_id, "model-id", errp); if (kvm_enabled()) { env->features[FEAT_KVM] |= kvm_default_features; } env->features[FEAT_1_ECX] |= CPUID_EXT_HYPERVISOR; }
{ "code": [], "line_no": [] }
static void FUNC_0(X86CPU *VAR_0, const char *VAR_1, Error **VAR_2) { CPUX86State *env = &VAR_0->env; x86_def_t def1, *def = &def1; memset(def, 0, sizeof(*def)); if (cpu_x86_find_by_name(VAR_0, def, VAR_1) < 0) { error_setg(VAR_2, "Unable to find CPU definition: %s", VAR_1); return; } object_property_set_str(OBJECT(VAR_0), def->vendor, "vendor", VAR_2); object_property_set_int(OBJECT(VAR_0), def->level, "level", VAR_2); object_property_set_int(OBJECT(VAR_0), def->family, "family", VAR_2); object_property_set_int(OBJECT(VAR_0), def->model, "model", VAR_2); object_property_set_int(OBJECT(VAR_0), def->stepping, "stepping", VAR_2); env->features[FEAT_1_EDX] = def->features[FEAT_1_EDX]; env->features[FEAT_1_ECX] = def->features[FEAT_1_ECX]; env->features[FEAT_8000_0001_EDX] = def->features[FEAT_8000_0001_EDX]; env->features[FEAT_8000_0001_ECX] = def->features[FEAT_8000_0001_ECX]; object_property_set_int(OBJECT(VAR_0), def->xlevel, "xlevel", VAR_2); env->features[FEAT_KVM] = def->features[FEAT_KVM]; env->features[FEAT_SVM] = def->features[FEAT_SVM]; env->features[FEAT_C000_0001_EDX] = def->features[FEAT_C000_0001_EDX]; env->features[FEAT_7_0_EBX] = def->features[FEAT_7_0_EBX]; env->cpuid_xlevel2 = def->xlevel2; VAR_0->cache_info_passthrough = def->cache_info_passthrough; object_property_set_str(OBJECT(VAR_0), def->model_id, "model-id", VAR_2); if (kvm_enabled()) { env->features[FEAT_KVM] |= kvm_default_features; } env->features[FEAT_1_ECX] |= CPUID_EXT_HYPERVISOR; }
[ "static void FUNC_0(X86CPU *VAR_0, const char *VAR_1, Error **VAR_2)\n{", "CPUX86State *env = &VAR_0->env;", "x86_def_t def1, *def = &def1;", "memset(def, 0, sizeof(*def));", "if (cpu_x86_find_by_name(VAR_0, def, VAR_1) < 0) {", "error_setg(VAR_2, \"Unable to find CPU definition: %s\", VAR_1);", "return;", "}", "object_property_set_str(OBJECT(VAR_0), def->vendor, \"vendor\", VAR_2);", "object_property_set_int(OBJECT(VAR_0), def->level, \"level\", VAR_2);", "object_property_set_int(OBJECT(VAR_0), def->family, \"family\", VAR_2);", "object_property_set_int(OBJECT(VAR_0), def->model, \"model\", VAR_2);", "object_property_set_int(OBJECT(VAR_0), def->stepping, \"stepping\", VAR_2);", "env->features[FEAT_1_EDX] = def->features[FEAT_1_EDX];", "env->features[FEAT_1_ECX] = def->features[FEAT_1_ECX];", "env->features[FEAT_8000_0001_EDX] = def->features[FEAT_8000_0001_EDX];", "env->features[FEAT_8000_0001_ECX] = def->features[FEAT_8000_0001_ECX];", "object_property_set_int(OBJECT(VAR_0), def->xlevel, \"xlevel\", VAR_2);", "env->features[FEAT_KVM] = def->features[FEAT_KVM];", "env->features[FEAT_SVM] = def->features[FEAT_SVM];", "env->features[FEAT_C000_0001_EDX] = def->features[FEAT_C000_0001_EDX];", "env->features[FEAT_7_0_EBX] = def->features[FEAT_7_0_EBX];", "env->cpuid_xlevel2 = def->xlevel2;", "VAR_0->cache_info_passthrough = def->cache_info_passthrough;", "object_property_set_str(OBJECT(VAR_0), def->model_id, \"model-id\", VAR_2);", "if (kvm_enabled()) {", "env->features[FEAT_KVM] |= kvm_default_features;", "}", "env->features[FEAT_1_ECX] |= CPUID_EXT_HYPERVISOR;", "}" ]
[ 0, 0, 0, 0, 0, 0, 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 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ] ]
7,367
static void gem_init(NICInfo *nd, uint32_t base, qemu_irq irq) { DeviceState *dev; SysBusDevice *s; qemu_check_nic_model(nd, "cadence_gem"); dev = qdev_create(NULL, "cadence_gem"); qdev_set_nic_properties(dev, nd); qdev_init_nofail(dev); s = SYS_BUS_DEVICE(dev); sysbus_mmio_map(s, 0, base); sysbus_connect_irq(s, 0, irq); }
false
qemu
ec0e68ef1da316b3ead1943d8f607cc68b13e0d1
static void gem_init(NICInfo *nd, uint32_t base, qemu_irq irq) { DeviceState *dev; SysBusDevice *s; qemu_check_nic_model(nd, "cadence_gem"); dev = qdev_create(NULL, "cadence_gem"); qdev_set_nic_properties(dev, nd); qdev_init_nofail(dev); s = SYS_BUS_DEVICE(dev); sysbus_mmio_map(s, 0, base); sysbus_connect_irq(s, 0, irq); }
{ "code": [], "line_no": [] }
static void FUNC_0(NICInfo *VAR_0, uint32_t VAR_1, qemu_irq VAR_2) { DeviceState *dev; SysBusDevice *s; qemu_check_nic_model(VAR_0, "cadence_gem"); dev = qdev_create(NULL, "cadence_gem"); qdev_set_nic_properties(dev, VAR_0); qdev_init_nofail(dev); s = SYS_BUS_DEVICE(dev); sysbus_mmio_map(s, 0, VAR_1); sysbus_connect_irq(s, 0, VAR_2); }
[ "static void FUNC_0(NICInfo *VAR_0, uint32_t VAR_1, qemu_irq VAR_2)\n{", "DeviceState *dev;", "SysBusDevice *s;", "qemu_check_nic_model(VAR_0, \"cadence_gem\");", "dev = qdev_create(NULL, \"cadence_gem\");", "qdev_set_nic_properties(dev, VAR_0);", "qdev_init_nofail(dev);", "s = SYS_BUS_DEVICE(dev);", "sysbus_mmio_map(s, 0, VAR_1);", "sysbus_connect_irq(s, 0, VAR_2);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ] ]
7,368
static void monitor_json_emitter(Monitor *mon, const QObject *data) { QString *json; json = qobject_to_json(data); assert(json != NULL); mon->mc->print_enabled = 1; monitor_printf(mon, "%s\n", qstring_get_str(json)); mon->mc->print_enabled = 0; QDECREF(json); }
false
qemu
b8b08266bd58d26e9c6b529ab4130c13eaed3406
static void monitor_json_emitter(Monitor *mon, const QObject *data) { QString *json; json = qobject_to_json(data); assert(json != NULL); mon->mc->print_enabled = 1; monitor_printf(mon, "%s\n", qstring_get_str(json)); mon->mc->print_enabled = 0; QDECREF(json); }
{ "code": [], "line_no": [] }
static void FUNC_0(Monitor *VAR_0, const QObject *VAR_1) { QString *json; json = qobject_to_json(VAR_1); assert(json != NULL); VAR_0->mc->print_enabled = 1; monitor_printf(VAR_0, "%s\n", qstring_get_str(json)); VAR_0->mc->print_enabled = 0; QDECREF(json); }
[ "static void FUNC_0(Monitor *VAR_0, const QObject *VAR_1)\n{", "QString *json;", "json = qobject_to_json(VAR_1);", "assert(json != NULL);", "VAR_0->mc->print_enabled = 1;", "monitor_printf(VAR_0, \"%s\\n\", qstring_get_str(json));", "VAR_0->mc->print_enabled = 0;", "QDECREF(json);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ] ]
7,369
void pc_cpus_init(const char *cpu_model, DeviceState *icc_bridge) { int i; X86CPU *cpu = NULL; Error *error = NULL; unsigned long apic_id_limit; /* init CPUs */ if (cpu_model == NULL) { #ifdef TARGET_X86_64 cpu_model = "qemu64"; #else cpu_model = "qemu32"; #endif } current_cpu_model = cpu_model; apic_id_limit = pc_apic_id_limit(max_cpus); if (apic_id_limit > ACPI_CPU_HOTPLUG_ID_LIMIT) { error_report("max_cpus is too large. APIC ID of last CPU is %lu", apic_id_limit - 1); exit(1); } for (i = 0; i < smp_cpus; i++) { cpu = pc_new_cpu(cpu_model, x86_cpu_apic_id_from_index(i), icc_bridge, &error); if (error) { error_report_err(error); exit(1); } object_unref(OBJECT(cpu)); } /* tell smbios about cpuid version and features */ smbios_set_cpuid(cpu->env.cpuid_version, cpu->env.features[FEAT_1_EDX]); }
false
qemu
46232aaacb66733d3e16dcbd0d26c32ec388801d
void pc_cpus_init(const char *cpu_model, DeviceState *icc_bridge) { int i; X86CPU *cpu = NULL; Error *error = NULL; unsigned long apic_id_limit; if (cpu_model == NULL) { #ifdef TARGET_X86_64 cpu_model = "qemu64"; #else cpu_model = "qemu32"; #endif } current_cpu_model = cpu_model; apic_id_limit = pc_apic_id_limit(max_cpus); if (apic_id_limit > ACPI_CPU_HOTPLUG_ID_LIMIT) { error_report("max_cpus is too large. APIC ID of last CPU is %lu", apic_id_limit - 1); exit(1); } for (i = 0; i < smp_cpus; i++) { cpu = pc_new_cpu(cpu_model, x86_cpu_apic_id_from_index(i), icc_bridge, &error); if (error) { error_report_err(error); exit(1); } object_unref(OBJECT(cpu)); } smbios_set_cpuid(cpu->env.cpuid_version, cpu->env.features[FEAT_1_EDX]); }
{ "code": [], "line_no": [] }
void FUNC_0(const char *VAR_0, DeviceState *VAR_1) { int VAR_2; X86CPU *cpu = NULL; Error *error = NULL; unsigned long VAR_3; if (VAR_0 == NULL) { #ifdef TARGET_X86_64 VAR_0 = "qemu64"; #else VAR_0 = "qemu32"; #endif } current_cpu_model = VAR_0; VAR_3 = pc_apic_id_limit(max_cpus); if (VAR_3 > ACPI_CPU_HOTPLUG_ID_LIMIT) { error_report("max_cpus is too large. APIC ID of last CPU is %lu", VAR_3 - 1); exit(1); } for (VAR_2 = 0; VAR_2 < smp_cpus; VAR_2++) { cpu = pc_new_cpu(VAR_0, x86_cpu_apic_id_from_index(VAR_2), VAR_1, &error); if (error) { error_report_err(error); exit(1); } object_unref(OBJECT(cpu)); } smbios_set_cpuid(cpu->env.cpuid_version, cpu->env.features[FEAT_1_EDX]); }
[ "void FUNC_0(const char *VAR_0, DeviceState *VAR_1)\n{", "int VAR_2;", "X86CPU *cpu = NULL;", "Error *error = NULL;", "unsigned long VAR_3;", "if (VAR_0 == NULL) {", "#ifdef TARGET_X86_64\nVAR_0 = \"qemu64\";", "#else\nVAR_0 = \"qemu32\";", "#endif\n}", "current_cpu_model = VAR_0;", "VAR_3 = pc_apic_id_limit(max_cpus);", "if (VAR_3 > ACPI_CPU_HOTPLUG_ID_LIMIT) {", "error_report(\"max_cpus is too large. APIC ID of last CPU is %lu\",\nVAR_3 - 1);", "exit(1);", "}", "for (VAR_2 = 0; VAR_2 < smp_cpus; VAR_2++) {", "cpu = pc_new_cpu(VAR_0, x86_cpu_apic_id_from_index(VAR_2),\nVAR_1, &error);", "if (error) {", "error_report_err(error);", "exit(1);", "}", "object_unref(OBJECT(cpu));", "}", "smbios_set_cpuid(cpu->env.cpuid_version, cpu->env.features[FEAT_1_EDX]);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 17 ], [ 19, 21 ], [ 23, 25 ], [ 27, 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51, 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 71 ], [ 73 ] ]
7,370
static void cpu_exit_tb_from_sighandler(CPUState *cpu, void *puc) { #ifdef __linux__ struct ucontext *uc = puc; #elif defined(__OpenBSD__) struct sigcontext *uc = puc; #endif /* XXX: use siglongjmp ? */ #ifdef __linux__ #ifdef __ia64 sigprocmask(SIG_SETMASK, (sigset_t *)&uc->uc_sigmask, NULL); #else sigprocmask(SIG_SETMASK, &uc->uc_sigmask, NULL); #endif #elif defined(__OpenBSD__) sigprocmask(SIG_SETMASK, &uc->sc_mask, NULL); #endif cpu_resume_from_signal(cpu, NULL); }
false
qemu
6886b98036a8f8f5bce8b10756ce080084cef11b
static void cpu_exit_tb_from_sighandler(CPUState *cpu, void *puc) { #ifdef __linux__ struct ucontext *uc = puc; #elif defined(__OpenBSD__) struct sigcontext *uc = puc; #endif #ifdef __linux__ #ifdef __ia64 sigprocmask(SIG_SETMASK, (sigset_t *)&uc->uc_sigmask, NULL); #else sigprocmask(SIG_SETMASK, &uc->uc_sigmask, NULL); #endif #elif defined(__OpenBSD__) sigprocmask(SIG_SETMASK, &uc->sc_mask, NULL); #endif cpu_resume_from_signal(cpu, NULL); }
{ "code": [], "line_no": [] }
static void FUNC_0(CPUState *VAR_0, void *VAR_1) { #ifdef __linux__ struct ucontext *uc = VAR_1; #elif defined(__OpenBSD__) struct sigcontext *uc = VAR_1; #endif #ifdef __linux__ #ifdef __ia64 sigprocmask(SIG_SETMASK, (sigset_t *)&uc->uc_sigmask, NULL); #else sigprocmask(SIG_SETMASK, &uc->uc_sigmask, NULL); #endif #elif defined(__OpenBSD__) sigprocmask(SIG_SETMASK, &uc->sc_mask, NULL); #endif cpu_resume_from_signal(VAR_0, NULL); }
[ "static void FUNC_0(CPUState *VAR_0, void *VAR_1)\n{", "#ifdef __linux__\nstruct ucontext *uc = VAR_1;", "#elif defined(__OpenBSD__)\nstruct sigcontext *uc = VAR_1;", "#endif\n#ifdef __linux__\n#ifdef __ia64\nsigprocmask(SIG_SETMASK, (sigset_t *)&uc->uc_sigmask, NULL);", "#else\nsigprocmask(SIG_SETMASK, &uc->uc_sigmask, NULL);", "#endif\n#elif defined(__OpenBSD__)\nsigprocmask(SIG_SETMASK, &uc->sc_mask, NULL);", "#endif\ncpu_resume_from_signal(VAR_0, NULL);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9, 11 ], [ 13, 19, 21, 23 ], [ 25, 27 ], [ 29, 31, 33 ], [ 35, 39 ], [ 41 ] ]
7,372
static int ioreq_runio_qemu_aio(struct ioreq *ioreq) { struct XenBlkDev *blkdev = ioreq->blkdev; if (ioreq->req.nr_segments && ioreq_map(ioreq) == -1) { goto err_no_map; } ioreq->aio_inflight++; if (ioreq->presync) { bdrv_aio_flush(ioreq->blkdev->bs, qemu_aio_complete, ioreq); return 0; } switch (ioreq->req.operation) { case BLKIF_OP_READ: block_acct_start(bdrv_get_stats(blkdev->bs), &ioreq->acct, ioreq->v.size, BLOCK_ACCT_READ); ioreq->aio_inflight++; bdrv_aio_readv(blkdev->bs, ioreq->start / BLOCK_SIZE, &ioreq->v, ioreq->v.size / BLOCK_SIZE, qemu_aio_complete, ioreq); break; case BLKIF_OP_WRITE: case BLKIF_OP_FLUSH_DISKCACHE: if (!ioreq->req.nr_segments) { break; } block_acct_start(bdrv_get_stats(blkdev->bs), &ioreq->acct, ioreq->v.size, BLOCK_ACCT_WRITE); ioreq->aio_inflight++; bdrv_aio_writev(blkdev->bs, ioreq->start / BLOCK_SIZE, &ioreq->v, ioreq->v.size / BLOCK_SIZE, qemu_aio_complete, ioreq); break; case BLKIF_OP_DISCARD: { struct blkif_request_discard *discard_req = (void *)&ioreq->req; ioreq->aio_inflight++; bdrv_aio_discard(blkdev->bs, discard_req->sector_number, discard_req->nr_sectors, qemu_aio_complete, ioreq); break; } default: /* unknown operation (shouldn't happen -- parse catches this) */ goto err; } qemu_aio_complete(ioreq, 0); return 0; err: ioreq_unmap(ioreq); err_no_map: ioreq_finish(ioreq); ioreq->status = BLKIF_RSP_ERROR; return -1; }
false
qemu
4be746345f13e99e468c60acbd3a355e8183e3ce
static int ioreq_runio_qemu_aio(struct ioreq *ioreq) { struct XenBlkDev *blkdev = ioreq->blkdev; if (ioreq->req.nr_segments && ioreq_map(ioreq) == -1) { goto err_no_map; } ioreq->aio_inflight++; if (ioreq->presync) { bdrv_aio_flush(ioreq->blkdev->bs, qemu_aio_complete, ioreq); return 0; } switch (ioreq->req.operation) { case BLKIF_OP_READ: block_acct_start(bdrv_get_stats(blkdev->bs), &ioreq->acct, ioreq->v.size, BLOCK_ACCT_READ); ioreq->aio_inflight++; bdrv_aio_readv(blkdev->bs, ioreq->start / BLOCK_SIZE, &ioreq->v, ioreq->v.size / BLOCK_SIZE, qemu_aio_complete, ioreq); break; case BLKIF_OP_WRITE: case BLKIF_OP_FLUSH_DISKCACHE: if (!ioreq->req.nr_segments) { break; } block_acct_start(bdrv_get_stats(blkdev->bs), &ioreq->acct, ioreq->v.size, BLOCK_ACCT_WRITE); ioreq->aio_inflight++; bdrv_aio_writev(blkdev->bs, ioreq->start / BLOCK_SIZE, &ioreq->v, ioreq->v.size / BLOCK_SIZE, qemu_aio_complete, ioreq); break; case BLKIF_OP_DISCARD: { struct blkif_request_discard *discard_req = (void *)&ioreq->req; ioreq->aio_inflight++; bdrv_aio_discard(blkdev->bs, discard_req->sector_number, discard_req->nr_sectors, qemu_aio_complete, ioreq); break; } default: goto err; } qemu_aio_complete(ioreq, 0); return 0; err: ioreq_unmap(ioreq); err_no_map: ioreq_finish(ioreq); ioreq->status = BLKIF_RSP_ERROR; return -1; }
{ "code": [], "line_no": [] }
static int FUNC_0(struct VAR_0 *VAR_0) { struct XenBlkDev *VAR_1 = VAR_0->VAR_1; if (VAR_0->req.nr_segments && ioreq_map(VAR_0) == -1) { goto err_no_map; } VAR_0->aio_inflight++; if (VAR_0->presync) { bdrv_aio_flush(VAR_0->VAR_1->bs, qemu_aio_complete, VAR_0); return 0; } switch (VAR_0->req.operation) { case BLKIF_OP_READ: block_acct_start(bdrv_get_stats(VAR_1->bs), &VAR_0->acct, VAR_0->v.size, BLOCK_ACCT_READ); VAR_0->aio_inflight++; bdrv_aio_readv(VAR_1->bs, VAR_0->start / BLOCK_SIZE, &VAR_0->v, VAR_0->v.size / BLOCK_SIZE, qemu_aio_complete, VAR_0); break; case BLKIF_OP_WRITE: case BLKIF_OP_FLUSH_DISKCACHE: if (!VAR_0->req.nr_segments) { break; } block_acct_start(bdrv_get_stats(VAR_1->bs), &VAR_0->acct, VAR_0->v.size, BLOCK_ACCT_WRITE); VAR_0->aio_inflight++; bdrv_aio_writev(VAR_1->bs, VAR_0->start / BLOCK_SIZE, &VAR_0->v, VAR_0->v.size / BLOCK_SIZE, qemu_aio_complete, VAR_0); break; case BLKIF_OP_DISCARD: { struct blkif_request_discard *VAR_2 = (void *)&VAR_0->req; VAR_0->aio_inflight++; bdrv_aio_discard(VAR_1->bs, VAR_2->sector_number, VAR_2->nr_sectors, qemu_aio_complete, VAR_0); break; } default: goto err; } qemu_aio_complete(VAR_0, 0); return 0; err: ioreq_unmap(VAR_0); err_no_map: ioreq_finish(VAR_0); VAR_0->status = BLKIF_RSP_ERROR; return -1; }
[ "static int FUNC_0(struct VAR_0 *VAR_0)\n{", "struct XenBlkDev *VAR_1 = VAR_0->VAR_1;", "if (VAR_0->req.nr_segments && ioreq_map(VAR_0) == -1) {", "goto err_no_map;", "}", "VAR_0->aio_inflight++;", "if (VAR_0->presync) {", "bdrv_aio_flush(VAR_0->VAR_1->bs, qemu_aio_complete, VAR_0);", "return 0;", "}", "switch (VAR_0->req.operation) {", "case BLKIF_OP_READ:\nblock_acct_start(bdrv_get_stats(VAR_1->bs), &VAR_0->acct,\nVAR_0->v.size, BLOCK_ACCT_READ);", "VAR_0->aio_inflight++;", "bdrv_aio_readv(VAR_1->bs, VAR_0->start / BLOCK_SIZE,\n&VAR_0->v, VAR_0->v.size / BLOCK_SIZE,\nqemu_aio_complete, VAR_0);", "break;", "case BLKIF_OP_WRITE:\ncase BLKIF_OP_FLUSH_DISKCACHE:\nif (!VAR_0->req.nr_segments) {", "break;", "}", "block_acct_start(bdrv_get_stats(VAR_1->bs), &VAR_0->acct,\nVAR_0->v.size, BLOCK_ACCT_WRITE);", "VAR_0->aio_inflight++;", "bdrv_aio_writev(VAR_1->bs, VAR_0->start / BLOCK_SIZE,\n&VAR_0->v, VAR_0->v.size / BLOCK_SIZE,\nqemu_aio_complete, VAR_0);", "break;", "case BLKIF_OP_DISCARD:\n{", "struct blkif_request_discard *VAR_2 = (void *)&VAR_0->req;", "VAR_0->aio_inflight++;", "bdrv_aio_discard(VAR_1->bs,\nVAR_2->sector_number, VAR_2->nr_sectors,\nqemu_aio_complete, VAR_0);", "break;", "}", "default:\ngoto err;", "}", "qemu_aio_complete(VAR_0, 0);", "return 0;", "err:\nioreq_unmap(VAR_0);", "err_no_map:\nioreq_finish(VAR_0);", "VAR_0->status = BLKIF_RSP_ERROR;", "return -1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31, 33, 35 ], [ 37 ], [ 39, 41, 43 ], [ 45 ], [ 47, 49, 51 ], [ 53 ], [ 55 ], [ 59, 61 ], [ 63 ], [ 65, 67, 69 ], [ 71 ], [ 73, 75 ], [ 77 ], [ 79 ], [ 81, 83, 85 ], [ 87 ], [ 89 ], [ 91, 95 ], [ 97 ], [ 101 ], [ 105 ], [ 109, 111 ], [ 113, 115 ], [ 117 ], [ 119 ], [ 121 ] ]
7,373
static int decode_subframe_lpc(ShortenContext *s, int command, int channel, int residual_size, int32_t coffset) { int pred_order, sum, qshift, init_sum, i, j; const int *coeffs; if (command == FN_QLPC) { /* read/validate prediction order */ pred_order = get_ur_golomb_shorten(&s->gb, LPCQSIZE); if (pred_order > s->nwrap) { av_log(s->avctx, AV_LOG_ERROR, "invalid pred_order %d\n", pred_order); return AVERROR(EINVAL); } /* read LPC coefficients */ for (i = 0; i < pred_order; i++) s->coeffs[i] = get_sr_golomb_shorten(&s->gb, LPCQUANT); coeffs = s->coeffs; qshift = LPCQUANT; } else { /* fixed LPC coeffs */ pred_order = command; if (pred_order >= FF_ARRAY_ELEMS(fixed_coeffs)) { av_log(s->avctx, AV_LOG_ERROR, "invalid pred_order %d\n", pred_order); return AVERROR_INVALIDDATA; } coeffs = fixed_coeffs[pred_order]; qshift = 0; } /* subtract offset from previous samples to use in prediction */ if (command == FN_QLPC && coffset) for (i = -pred_order; i < 0; i++) s->decoded[channel][i] -= coffset; /* decode residual and do LPC prediction */ init_sum = pred_order ? (command == FN_QLPC ? s->lpcqoffset : 0) : coffset; for (i = 0; i < s->blocksize; i++) { sum = init_sum; for (j = 0; j < pred_order; j++) sum += coeffs[j] * s->decoded[channel][i - j - 1]; s->decoded[channel][i] = get_sr_golomb_shorten(&s->gb, residual_size) + (sum >> qshift); } /* add offset to current samples */ if (command == FN_QLPC && coffset) for (i = 0; i < s->blocksize; i++) s->decoded[channel][i] += coffset; return 0; }
false
FFmpeg
294469416d8193a28710d802bb0c46e5fa09fad7
static int decode_subframe_lpc(ShortenContext *s, int command, int channel, int residual_size, int32_t coffset) { int pred_order, sum, qshift, init_sum, i, j; const int *coeffs; if (command == FN_QLPC) { pred_order = get_ur_golomb_shorten(&s->gb, LPCQSIZE); if (pred_order > s->nwrap) { av_log(s->avctx, AV_LOG_ERROR, "invalid pred_order %d\n", pred_order); return AVERROR(EINVAL); } for (i = 0; i < pred_order; i++) s->coeffs[i] = get_sr_golomb_shorten(&s->gb, LPCQUANT); coeffs = s->coeffs; qshift = LPCQUANT; } else { pred_order = command; if (pred_order >= FF_ARRAY_ELEMS(fixed_coeffs)) { av_log(s->avctx, AV_LOG_ERROR, "invalid pred_order %d\n", pred_order); return AVERROR_INVALIDDATA; } coeffs = fixed_coeffs[pred_order]; qshift = 0; } if (command == FN_QLPC && coffset) for (i = -pred_order; i < 0; i++) s->decoded[channel][i] -= coffset; init_sum = pred_order ? (command == FN_QLPC ? s->lpcqoffset : 0) : coffset; for (i = 0; i < s->blocksize; i++) { sum = init_sum; for (j = 0; j < pred_order; j++) sum += coeffs[j] * s->decoded[channel][i - j - 1]; s->decoded[channel][i] = get_sr_golomb_shorten(&s->gb, residual_size) + (sum >> qshift); } if (command == FN_QLPC && coffset) for (i = 0; i < s->blocksize; i++) s->decoded[channel][i] += coffset; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(ShortenContext *VAR_0, int VAR_1, int VAR_2, int VAR_3, int32_t VAR_4) { int VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10; const int *VAR_11; if (VAR_1 == FN_QLPC) { VAR_5 = get_ur_golomb_shorten(&VAR_0->gb, LPCQSIZE); if (VAR_5 > VAR_0->nwrap) { av_log(VAR_0->avctx, AV_LOG_ERROR, "invalid VAR_5 %d\n", VAR_5); return AVERROR(EINVAL); } for (VAR_9 = 0; VAR_9 < VAR_5; VAR_9++) VAR_0->VAR_11[VAR_9] = get_sr_golomb_shorten(&VAR_0->gb, LPCQUANT); VAR_11 = VAR_0->VAR_11; VAR_7 = LPCQUANT; } else { VAR_5 = VAR_1; if (VAR_5 >= FF_ARRAY_ELEMS(fixed_coeffs)) { av_log(VAR_0->avctx, AV_LOG_ERROR, "invalid VAR_5 %d\n", VAR_5); return AVERROR_INVALIDDATA; } VAR_11 = fixed_coeffs[VAR_5]; VAR_7 = 0; } if (VAR_1 == FN_QLPC && VAR_4) for (VAR_9 = -VAR_5; VAR_9 < 0; VAR_9++) VAR_0->decoded[VAR_2][VAR_9] -= VAR_4; VAR_8 = VAR_5 ? (VAR_1 == FN_QLPC ? VAR_0->lpcqoffset : 0) : VAR_4; for (VAR_9 = 0; VAR_9 < VAR_0->blocksize; VAR_9++) { VAR_6 = VAR_8; for (VAR_10 = 0; VAR_10 < VAR_5; VAR_10++) VAR_6 += VAR_11[VAR_10] * VAR_0->decoded[VAR_2][VAR_9 - VAR_10 - 1]; VAR_0->decoded[VAR_2][VAR_9] = get_sr_golomb_shorten(&VAR_0->gb, VAR_3) + (VAR_6 >> VAR_7); } if (VAR_1 == FN_QLPC && VAR_4) for (VAR_9 = 0; VAR_9 < VAR_0->blocksize; VAR_9++) VAR_0->decoded[VAR_2][VAR_9] += VAR_4; return 0; }
[ "static int FUNC_0(ShortenContext *VAR_0, int VAR_1, int VAR_2,\nint VAR_3, int32_t VAR_4)\n{", "int VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10;", "const int *VAR_11;", "if (VAR_1 == FN_QLPC) {", "VAR_5 = get_ur_golomb_shorten(&VAR_0->gb, LPCQSIZE);", "if (VAR_5 > VAR_0->nwrap) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"invalid VAR_5 %d\\n\",\nVAR_5);", "return AVERROR(EINVAL);", "}", "for (VAR_9 = 0; VAR_9 < VAR_5; VAR_9++)", "VAR_0->VAR_11[VAR_9] = get_sr_golomb_shorten(&VAR_0->gb, LPCQUANT);", "VAR_11 = VAR_0->VAR_11;", "VAR_7 = LPCQUANT;", "} else {", "VAR_5 = VAR_1;", "if (VAR_5 >= FF_ARRAY_ELEMS(fixed_coeffs)) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"invalid VAR_5 %d\\n\",\nVAR_5);", "return AVERROR_INVALIDDATA;", "}", "VAR_11 = fixed_coeffs[VAR_5];", "VAR_7 = 0;", "}", "if (VAR_1 == FN_QLPC && VAR_4)\nfor (VAR_9 = -VAR_5; VAR_9 < 0; VAR_9++)", "VAR_0->decoded[VAR_2][VAR_9] -= VAR_4;", "VAR_8 = VAR_5 ? (VAR_1 == FN_QLPC ? VAR_0->lpcqoffset : 0) : VAR_4;", "for (VAR_9 = 0; VAR_9 < VAR_0->blocksize; VAR_9++) {", "VAR_6 = VAR_8;", "for (VAR_10 = 0; VAR_10 < VAR_5; VAR_10++)", "VAR_6 += VAR_11[VAR_10] * VAR_0->decoded[VAR_2][VAR_9 - VAR_10 - 1];", "VAR_0->decoded[VAR_2][VAR_9] = get_sr_golomb_shorten(&VAR_0->gb, VAR_3) +\n(VAR_6 >> VAR_7);", "}", "if (VAR_1 == FN_QLPC && VAR_4)\nfor (VAR_9 = 0; VAR_9 < VAR_0->blocksize; VAR_9++)", "VAR_0->decoded[VAR_2][VAR_9] += VAR_4;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17 ], [ 19 ], [ 21, 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49, 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 67, 69 ], [ 71 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87, 89 ], [ 91 ], [ 97, 99 ], [ 101 ], [ 105 ], [ 107 ] ]
7,374
static int coroutine_fn blkreplay_co_pwritev(BlockDriverState *bs, uint64_t offset, uint64_t bytes, QEMUIOVector *qiov, int flags) { uint64_t reqid = request_id++; int ret = bdrv_co_pwritev(bs->file->bs, offset, bytes, qiov, flags); block_request_create(reqid, bs, qemu_coroutine_self()); qemu_coroutine_yield(); return ret; }
false
qemu
a03ef88f77af045a2eb9629b5ce774a3fb973c5e
static int coroutine_fn blkreplay_co_pwritev(BlockDriverState *bs, uint64_t offset, uint64_t bytes, QEMUIOVector *qiov, int flags) { uint64_t reqid = request_id++; int ret = bdrv_co_pwritev(bs->file->bs, offset, bytes, qiov, flags); block_request_create(reqid, bs, qemu_coroutine_self()); qemu_coroutine_yield(); return ret; }
{ "code": [], "line_no": [] }
static int VAR_0 blkreplay_co_pwritev(BlockDriverState *bs, uint64_t offset, uint64_t bytes, QEMUIOVector *qiov, int flags) { uint64_t reqid = request_id++; int ret = bdrv_co_pwritev(bs->file->bs, offset, bytes, qiov, flags); block_request_create(reqid, bs, qemu_coroutine_self()); qemu_coroutine_yield(); return ret; }
[ "static int VAR_0 blkreplay_co_pwritev(BlockDriverState *bs,\nuint64_t offset, uint64_t bytes, QEMUIOVector *qiov, int flags)\n{", "uint64_t reqid = request_id++;", "int ret = bdrv_co_pwritev(bs->file->bs, offset, bytes, qiov, flags);", "block_request_create(reqid, bs, qemu_coroutine_self());", "qemu_coroutine_yield();", "return ret;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ] ]
7,375
static void hmp_handle_error(Monitor *mon, Error **errp) { if (error_is_set(errp)) { monitor_printf(mon, "%s\n", error_get_pretty(*errp)); error_free(*errp); } }
false
qemu
415168e0c7bda5371a876914d4fdb68c4556f28d
static void hmp_handle_error(Monitor *mon, Error **errp) { if (error_is_set(errp)) { monitor_printf(mon, "%s\n", error_get_pretty(*errp)); error_free(*errp); } }
{ "code": [], "line_no": [] }
static void FUNC_0(Monitor *VAR_0, Error **VAR_1) { if (error_is_set(VAR_1)) { monitor_printf(VAR_0, "%s\n", error_get_pretty(*VAR_1)); error_free(*VAR_1); } }
[ "static void FUNC_0(Monitor *VAR_0, Error **VAR_1)\n{", "if (error_is_set(VAR_1)) {", "monitor_printf(VAR_0, \"%s\\n\", error_get_pretty(*VAR_1));", "error_free(*VAR_1);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ] ]
7,376
void mips_r4k_init (ram_addr_t ram_size, const char *boot_device, const char *kernel_filename, const char *kernel_cmdline, const char *initrd_filename, const char *cpu_model) { char *filename; MemoryRegion *address_space_mem = get_system_memory(); MemoryRegion *ram = g_new(MemoryRegion, 1); MemoryRegion *bios; MemoryRegion *iomem = g_new(MemoryRegion, 1); int bios_size; CPUState *env; ResetData *reset_info; int i; qemu_irq *i8259; DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; DriveInfo *dinfo; int be; /* init CPUs */ if (cpu_model == NULL) { #ifdef TARGET_MIPS64 cpu_model = "R4000"; #else cpu_model = "24Kf"; #endif } env = cpu_init(cpu_model); if (!env) { fprintf(stderr, "Unable to find CPU definition\n"); exit(1); } reset_info = g_malloc0(sizeof(ResetData)); reset_info->env = env; reset_info->vector = env->active_tc.PC; qemu_register_reset(main_cpu_reset, reset_info); /* allocate RAM */ if (ram_size > (256 << 20)) { fprintf(stderr, "qemu: Too much memory for this machine: %d MB, maximum 256 MB\n", ((unsigned int)ram_size / (1 << 20))); exit(1); } memory_region_init_ram(ram, NULL, "mips_r4k.ram", ram_size); memory_region_add_subregion(address_space_mem, 0, ram); memory_region_init_io(iomem, &mips_qemu_ops, NULL, "mips-qemu", 0x10000); memory_region_add_subregion(address_space_mem, 0x1fbf0000, iomem); /* Try to load a BIOS image. If this fails, we continue regardless, but initialize the hardware ourselves. When a kernel gets preloaded we also initialize the hardware, since the BIOS wasn't run. */ if (bios_name == NULL) bios_name = BIOS_FILENAME; filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); if (filename) { bios_size = get_image_size(filename); } else { bios_size = -1; } #ifdef TARGET_WORDS_BIGENDIAN be = 1; #else be = 0; #endif if ((bios_size > 0) && (bios_size <= BIOS_SIZE)) { bios = g_new(MemoryRegion, 1); memory_region_init_ram(bios, NULL, "mips_r4k.bios", BIOS_SIZE); memory_region_set_readonly(bios, true); memory_region_add_subregion(get_system_memory(), 0x1fc00000, bios); load_image_targphys(filename, 0x1fc00000, BIOS_SIZE); } else if ((dinfo = drive_get(IF_PFLASH, 0, 0)) != NULL) { uint32_t mips_rom = 0x00400000; if (!pflash_cfi01_register(0x1fc00000, NULL, "mips_r4k.bios", mips_rom, dinfo->bdrv, sector_len, mips_rom / sector_len, 4, 0, 0, 0, 0, be)) { fprintf(stderr, "qemu: Error registering flash memory.\n"); } } else { /* not fatal */ fprintf(stderr, "qemu: Warning, could not load MIPS bios '%s'\n", bios_name); } if (filename) { g_free(filename); } if (kernel_filename) { loaderparams.ram_size = ram_size; loaderparams.kernel_filename = kernel_filename; loaderparams.kernel_cmdline = kernel_cmdline; loaderparams.initrd_filename = initrd_filename; reset_info->vector = load_kernel(); } /* Init CPU internal devices */ cpu_mips_irq_init_cpu(env); cpu_mips_clock_init(env); /* The PIC is attached to the MIPS CPU INT0 pin */ i8259 = i8259_init(env->irq[2]); isa_bus_new(NULL, get_system_io()); isa_bus_irqs(i8259); rtc_init(2000, NULL); /* Register 64 KB of ISA IO space at 0x14000000 */ isa_mmio_init(0x14000000, 0x00010000); isa_mem_base = 0x10000000; pit = pit_init(0x40, 0); for(i = 0; i < MAX_SERIAL_PORTS; i++) { if (serial_hds[i]) { serial_isa_init(i, serial_hds[i]); } } isa_vga_init(); if (nd_table[0].vlan) isa_ne2000_init(0x300, 9, &nd_table[0]); ide_drive_get(hd, MAX_IDE_BUS); for(i = 0; i < MAX_IDE_BUS; i++) isa_ide_init(ide_iobase[i], ide_iobase2[i], ide_irq[i], hd[MAX_IDE_DEVS * i], hd[MAX_IDE_DEVS * i + 1]); isa_create_simple("i8042"); }
false
qemu
a4ac5e64de1b676e0b377792528580065a574815
void mips_r4k_init (ram_addr_t ram_size, const char *boot_device, const char *kernel_filename, const char *kernel_cmdline, const char *initrd_filename, const char *cpu_model) { char *filename; MemoryRegion *address_space_mem = get_system_memory(); MemoryRegion *ram = g_new(MemoryRegion, 1); MemoryRegion *bios; MemoryRegion *iomem = g_new(MemoryRegion, 1); int bios_size; CPUState *env; ResetData *reset_info; int i; qemu_irq *i8259; DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; DriveInfo *dinfo; int be; if (cpu_model == NULL) { #ifdef TARGET_MIPS64 cpu_model = "R4000"; #else cpu_model = "24Kf"; #endif } env = cpu_init(cpu_model); if (!env) { fprintf(stderr, "Unable to find CPU definition\n"); exit(1); } reset_info = g_malloc0(sizeof(ResetData)); reset_info->env = env; reset_info->vector = env->active_tc.PC; qemu_register_reset(main_cpu_reset, reset_info); if (ram_size > (256 << 20)) { fprintf(stderr, "qemu: Too much memory for this machine: %d MB, maximum 256 MB\n", ((unsigned int)ram_size / (1 << 20))); exit(1); } memory_region_init_ram(ram, NULL, "mips_r4k.ram", ram_size); memory_region_add_subregion(address_space_mem, 0, ram); memory_region_init_io(iomem, &mips_qemu_ops, NULL, "mips-qemu", 0x10000); memory_region_add_subregion(address_space_mem, 0x1fbf0000, iomem); if (bios_name == NULL) bios_name = BIOS_FILENAME; filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); if (filename) { bios_size = get_image_size(filename); } else { bios_size = -1; } #ifdef TARGET_WORDS_BIGENDIAN be = 1; #else be = 0; #endif if ((bios_size > 0) && (bios_size <= BIOS_SIZE)) { bios = g_new(MemoryRegion, 1); memory_region_init_ram(bios, NULL, "mips_r4k.bios", BIOS_SIZE); memory_region_set_readonly(bios, true); memory_region_add_subregion(get_system_memory(), 0x1fc00000, bios); load_image_targphys(filename, 0x1fc00000, BIOS_SIZE); } else if ((dinfo = drive_get(IF_PFLASH, 0, 0)) != NULL) { uint32_t mips_rom = 0x00400000; if (!pflash_cfi01_register(0x1fc00000, NULL, "mips_r4k.bios", mips_rom, dinfo->bdrv, sector_len, mips_rom / sector_len, 4, 0, 0, 0, 0, be)) { fprintf(stderr, "qemu: Error registering flash memory.\n"); } } else { fprintf(stderr, "qemu: Warning, could not load MIPS bios '%s'\n", bios_name); } if (filename) { g_free(filename); } if (kernel_filename) { loaderparams.ram_size = ram_size; loaderparams.kernel_filename = kernel_filename; loaderparams.kernel_cmdline = kernel_cmdline; loaderparams.initrd_filename = initrd_filename; reset_info->vector = load_kernel(); } cpu_mips_irq_init_cpu(env); cpu_mips_clock_init(env); i8259 = i8259_init(env->irq[2]); isa_bus_new(NULL, get_system_io()); isa_bus_irqs(i8259); rtc_init(2000, NULL); isa_mmio_init(0x14000000, 0x00010000); isa_mem_base = 0x10000000; pit = pit_init(0x40, 0); for(i = 0; i < MAX_SERIAL_PORTS; i++) { if (serial_hds[i]) { serial_isa_init(i, serial_hds[i]); } } isa_vga_init(); if (nd_table[0].vlan) isa_ne2000_init(0x300, 9, &nd_table[0]); ide_drive_get(hd, MAX_IDE_BUS); for(i = 0; i < MAX_IDE_BUS; i++) isa_ide_init(ide_iobase[i], ide_iobase2[i], ide_irq[i], hd[MAX_IDE_DEVS * i], hd[MAX_IDE_DEVS * i + 1]); isa_create_simple("i8042"); }
{ "code": [], "line_no": [] }
void FUNC_0 (ram_addr_t VAR_0, const char *VAR_1, const char *VAR_2, const char *VAR_3, const char *VAR_4, const char *VAR_5) { char *VAR_6; MemoryRegion *address_space_mem = get_system_memory(); MemoryRegion *ram = g_new(MemoryRegion, 1); MemoryRegion *bios; MemoryRegion *iomem = g_new(MemoryRegion, 1); int VAR_7; CPUState *env; ResetData *reset_info; int VAR_8; qemu_irq *i8259; DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; DriveInfo *dinfo; int VAR_9; if (VAR_5 == NULL) { #ifdef TARGET_MIPS64 VAR_5 = "R4000"; #else VAR_5 = "24Kf"; #endif } env = cpu_init(VAR_5); if (!env) { fprintf(stderr, "Unable to find CPU definition\n"); exit(1); } reset_info = g_malloc0(sizeof(ResetData)); reset_info->env = env; reset_info->vector = env->active_tc.PC; qemu_register_reset(main_cpu_reset, reset_info); if (VAR_0 > (256 << 20)) { fprintf(stderr, "qemu: Too much memory for this machine: %d MB, maximum 256 MB\n", ((unsigned int)VAR_0 / (1 << 20))); exit(1); } memory_region_init_ram(ram, NULL, "mips_r4k.ram", VAR_0); memory_region_add_subregion(address_space_mem, 0, ram); memory_region_init_io(iomem, &mips_qemu_ops, NULL, "mips-qemu", 0x10000); memory_region_add_subregion(address_space_mem, 0x1fbf0000, iomem); if (bios_name == NULL) bios_name = BIOS_FILENAME; VAR_6 = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); if (VAR_6) { VAR_7 = get_image_size(VAR_6); } else { VAR_7 = -1; } #ifdef TARGET_WORDS_BIGENDIAN VAR_9 = 1; #else VAR_9 = 0; #endif if ((VAR_7 > 0) && (VAR_7 <= BIOS_SIZE)) { bios = g_new(MemoryRegion, 1); memory_region_init_ram(bios, NULL, "mips_r4k.bios", BIOS_SIZE); memory_region_set_readonly(bios, true); memory_region_add_subregion(get_system_memory(), 0x1fc00000, bios); load_image_targphys(VAR_6, 0x1fc00000, BIOS_SIZE); } else if ((dinfo = drive_get(IF_PFLASH, 0, 0)) != NULL) { uint32_t mips_rom = 0x00400000; if (!pflash_cfi01_register(0x1fc00000, NULL, "mips_r4k.bios", mips_rom, dinfo->bdrv, sector_len, mips_rom / sector_len, 4, 0, 0, 0, 0, VAR_9)) { fprintf(stderr, "qemu: Error registering flash memory.\n"); } } else { fprintf(stderr, "qemu: Warning, could not load MIPS bios '%s'\n", bios_name); } if (VAR_6) { g_free(VAR_6); } if (VAR_2) { loaderparams.VAR_0 = VAR_0; loaderparams.VAR_2 = VAR_2; loaderparams.VAR_3 = VAR_3; loaderparams.VAR_4 = VAR_4; reset_info->vector = load_kernel(); } cpu_mips_irq_init_cpu(env); cpu_mips_clock_init(env); i8259 = i8259_init(env->irq[2]); isa_bus_new(NULL, get_system_io()); isa_bus_irqs(i8259); rtc_init(2000, NULL); isa_mmio_init(0x14000000, 0x00010000); isa_mem_base = 0x10000000; pit = pit_init(0x40, 0); for(VAR_8 = 0; VAR_8 < MAX_SERIAL_PORTS; VAR_8++) { if (serial_hds[VAR_8]) { serial_isa_init(VAR_8, serial_hds[VAR_8]); } } isa_vga_init(); if (nd_table[0].vlan) isa_ne2000_init(0x300, 9, &nd_table[0]); ide_drive_get(hd, MAX_IDE_BUS); for(VAR_8 = 0; VAR_8 < MAX_IDE_BUS; VAR_8++) isa_ide_init(ide_iobase[VAR_8], ide_iobase2[VAR_8], ide_irq[VAR_8], hd[MAX_IDE_DEVS * VAR_8], hd[MAX_IDE_DEVS * VAR_8 + 1]); isa_create_simple("i8042"); }
[ "void FUNC_0 (ram_addr_t VAR_0,\nconst char *VAR_1,\nconst char *VAR_2, const char *VAR_3,\nconst char *VAR_4, const char *VAR_5)\n{", "char *VAR_6;", "MemoryRegion *address_space_mem = get_system_memory();", "MemoryRegion *ram = g_new(MemoryRegion, 1);", "MemoryRegion *bios;", "MemoryRegion *iomem = g_new(MemoryRegion, 1);", "int VAR_7;", "CPUState *env;", "ResetData *reset_info;", "int VAR_8;", "qemu_irq *i8259;", "DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];", "DriveInfo *dinfo;", "int VAR_9;", "if (VAR_5 == NULL) {", "#ifdef TARGET_MIPS64\nVAR_5 = \"R4000\";", "#else\nVAR_5 = \"24Kf\";", "#endif\n}", "env = cpu_init(VAR_5);", "if (!env) {", "fprintf(stderr, \"Unable to find CPU definition\\n\");", "exit(1);", "}", "reset_info = g_malloc0(sizeof(ResetData));", "reset_info->env = env;", "reset_info->vector = env->active_tc.PC;", "qemu_register_reset(main_cpu_reset, reset_info);", "if (VAR_0 > (256 << 20)) {", "fprintf(stderr,\n\"qemu: Too much memory for this machine: %d MB, maximum 256 MB\\n\",\n((unsigned int)VAR_0 / (1 << 20)));", "exit(1);", "}", "memory_region_init_ram(ram, NULL, \"mips_r4k.ram\", VAR_0);", "memory_region_add_subregion(address_space_mem, 0, ram);", "memory_region_init_io(iomem, &mips_qemu_ops, NULL, \"mips-qemu\", 0x10000);", "memory_region_add_subregion(address_space_mem, 0x1fbf0000, iomem);", "if (bios_name == NULL)\nbios_name = BIOS_FILENAME;", "VAR_6 = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);", "if (VAR_6) {", "VAR_7 = get_image_size(VAR_6);", "} else {", "VAR_7 = -1;", "}", "#ifdef TARGET_WORDS_BIGENDIAN\nVAR_9 = 1;", "#else\nVAR_9 = 0;", "#endif\nif ((VAR_7 > 0) && (VAR_7 <= BIOS_SIZE)) {", "bios = g_new(MemoryRegion, 1);", "memory_region_init_ram(bios, NULL, \"mips_r4k.bios\", BIOS_SIZE);", "memory_region_set_readonly(bios, true);", "memory_region_add_subregion(get_system_memory(), 0x1fc00000, bios);", "load_image_targphys(VAR_6, 0x1fc00000, BIOS_SIZE);", "} else if ((dinfo = drive_get(IF_PFLASH, 0, 0)) != NULL) {", "uint32_t mips_rom = 0x00400000;", "if (!pflash_cfi01_register(0x1fc00000, NULL, \"mips_r4k.bios\", mips_rom,\ndinfo->bdrv, sector_len,\nmips_rom / sector_len,\n4, 0, 0, 0, 0, VAR_9)) {", "fprintf(stderr, \"qemu: Error registering flash memory.\\n\");", "}", "}", "else {", "fprintf(stderr, \"qemu: Warning, could not load MIPS bios '%s'\\n\",\nbios_name);", "}", "if (VAR_6) {", "g_free(VAR_6);", "}", "if (VAR_2) {", "loaderparams.VAR_0 = VAR_0;", "loaderparams.VAR_2 = VAR_2;", "loaderparams.VAR_3 = VAR_3;", "loaderparams.VAR_4 = VAR_4;", "reset_info->vector = load_kernel();", "}", "cpu_mips_irq_init_cpu(env);", "cpu_mips_clock_init(env);", "i8259 = i8259_init(env->irq[2]);", "isa_bus_new(NULL, get_system_io());", "isa_bus_irqs(i8259);", "rtc_init(2000, NULL);", "isa_mmio_init(0x14000000, 0x00010000);", "isa_mem_base = 0x10000000;", "pit = pit_init(0x40, 0);", "for(VAR_8 = 0; VAR_8 < MAX_SERIAL_PORTS; VAR_8++) {", "if (serial_hds[VAR_8]) {", "serial_isa_init(VAR_8, serial_hds[VAR_8]);", "}", "}", "isa_vga_init();", "if (nd_table[0].vlan)\nisa_ne2000_init(0x300, 9, &nd_table[0]);", "ide_drive_get(hd, MAX_IDE_BUS);", "for(VAR_8 = 0; VAR_8 < MAX_IDE_BUS; VAR_8++)", "isa_ide_init(ide_iobase[VAR_8], ide_iobase2[VAR_8], ide_irq[VAR_8],\nhd[MAX_IDE_DEVS * VAR_8],\nhd[MAX_IDE_DEVS * VAR_8 + 1]);", "isa_create_simple(\"i8042\");", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 41 ], [ 43, 45 ], [ 47, 49 ], [ 51, 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 77 ], [ 79, 81, 83 ], [ 85 ], [ 87 ], [ 89 ], [ 93 ], [ 97 ], [ 99 ], [ 111, 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127, 129 ], [ 131, 133 ], [ 135, 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 149 ], [ 151 ], [ 153 ], [ 155, 157, 159, 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 173, 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 205 ], [ 207 ], [ 213 ], [ 215 ], [ 217 ], [ 221 ], [ 227 ], [ 229 ], [ 233 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 249 ], [ 253, 255 ], [ 259 ], [ 261 ], [ 263, 265, 267 ], [ 271 ], [ 273 ] ]
7,379
static int dmg_open(BlockDriverState *bs, QDict *options, int flags, Error **errp) { BDRVDMGState *s = bs->opaque; DmgHeaderState ds; uint64_t rsrc_fork_offset, rsrc_fork_length; uint64_t plist_xml_offset, plist_xml_length; int64_t offset; int ret; bs->file = bdrv_open_child(NULL, options, "file", bs, &child_file, false, errp); if (!bs->file) { return -EINVAL; } block_module_load_one("dmg-bz2"); bs->read_only = true; s->n_chunks = 0; s->offsets = s->lengths = s->sectors = s->sectorcounts = NULL; /* used by dmg_read_mish_block to keep track of the current I/O position */ ds.data_fork_offset = 0; ds.max_compressed_size = 1; ds.max_sectors_per_chunk = 1; /* locate the UDIF trailer */ offset = dmg_find_koly_offset(bs->file, errp); if (offset < 0) { ret = offset; goto fail; } /* offset of data fork (DataForkOffset) */ ret = read_uint64(bs, offset + 0x18, &ds.data_fork_offset); if (ret < 0) { goto fail; } else if (ds.data_fork_offset > offset) { ret = -EINVAL; goto fail; } /* offset of resource fork (RsrcForkOffset) */ ret = read_uint64(bs, offset + 0x28, &rsrc_fork_offset); if (ret < 0) { goto fail; } ret = read_uint64(bs, offset + 0x30, &rsrc_fork_length); if (ret < 0) { goto fail; } if (rsrc_fork_offset >= offset || rsrc_fork_length > offset - rsrc_fork_offset) { ret = -EINVAL; goto fail; } /* offset of property list (XMLOffset) */ ret = read_uint64(bs, offset + 0xd8, &plist_xml_offset); if (ret < 0) { goto fail; } ret = read_uint64(bs, offset + 0xe0, &plist_xml_length); if (ret < 0) { goto fail; } if (plist_xml_offset >= offset || plist_xml_length > offset - plist_xml_offset) { ret = -EINVAL; goto fail; } ret = read_uint64(bs, offset + 0x1ec, (uint64_t *)&bs->total_sectors); if (ret < 0) { goto fail; } if (bs->total_sectors < 0) { ret = -EINVAL; goto fail; } if (rsrc_fork_length != 0) { ret = dmg_read_resource_fork(bs, &ds, rsrc_fork_offset, rsrc_fork_length); if (ret < 0) { goto fail; } } else if (plist_xml_length != 0) { ret = dmg_read_plist_xml(bs, &ds, plist_xml_offset, plist_xml_length); if (ret < 0) { goto fail; } } else { ret = -EINVAL; goto fail; } /* initialize zlib engine */ s->compressed_chunk = qemu_try_blockalign(bs->file->bs, ds.max_compressed_size + 1); s->uncompressed_chunk = qemu_try_blockalign(bs->file->bs, 512 * ds.max_sectors_per_chunk); if (s->compressed_chunk == NULL || s->uncompressed_chunk == NULL) { ret = -ENOMEM; goto fail; } if (inflateInit(&s->zstream) != Z_OK) { ret = -EINVAL; goto fail; } s->current_chunk = s->n_chunks; qemu_co_mutex_init(&s->lock); return 0; fail: g_free(s->types); g_free(s->offsets); g_free(s->lengths); g_free(s->sectors); g_free(s->sectorcounts); qemu_vfree(s->compressed_chunk); qemu_vfree(s->uncompressed_chunk); return ret; }
false
qemu
fe5241bfe3fb61ec3f589ceacd91c1469bfd400f
static int dmg_open(BlockDriverState *bs, QDict *options, int flags, Error **errp) { BDRVDMGState *s = bs->opaque; DmgHeaderState ds; uint64_t rsrc_fork_offset, rsrc_fork_length; uint64_t plist_xml_offset, plist_xml_length; int64_t offset; int ret; bs->file = bdrv_open_child(NULL, options, "file", bs, &child_file, false, errp); if (!bs->file) { return -EINVAL; } block_module_load_one("dmg-bz2"); bs->read_only = true; s->n_chunks = 0; s->offsets = s->lengths = s->sectors = s->sectorcounts = NULL; ds.data_fork_offset = 0; ds.max_compressed_size = 1; ds.max_sectors_per_chunk = 1; offset = dmg_find_koly_offset(bs->file, errp); if (offset < 0) { ret = offset; goto fail; } ret = read_uint64(bs, offset + 0x18, &ds.data_fork_offset); if (ret < 0) { goto fail; } else if (ds.data_fork_offset > offset) { ret = -EINVAL; goto fail; } ret = read_uint64(bs, offset + 0x28, &rsrc_fork_offset); if (ret < 0) { goto fail; } ret = read_uint64(bs, offset + 0x30, &rsrc_fork_length); if (ret < 0) { goto fail; } if (rsrc_fork_offset >= offset || rsrc_fork_length > offset - rsrc_fork_offset) { ret = -EINVAL; goto fail; } ret = read_uint64(bs, offset + 0xd8, &plist_xml_offset); if (ret < 0) { goto fail; } ret = read_uint64(bs, offset + 0xe0, &plist_xml_length); if (ret < 0) { goto fail; } if (plist_xml_offset >= offset || plist_xml_length > offset - plist_xml_offset) { ret = -EINVAL; goto fail; } ret = read_uint64(bs, offset + 0x1ec, (uint64_t *)&bs->total_sectors); if (ret < 0) { goto fail; } if (bs->total_sectors < 0) { ret = -EINVAL; goto fail; } if (rsrc_fork_length != 0) { ret = dmg_read_resource_fork(bs, &ds, rsrc_fork_offset, rsrc_fork_length); if (ret < 0) { goto fail; } } else if (plist_xml_length != 0) { ret = dmg_read_plist_xml(bs, &ds, plist_xml_offset, plist_xml_length); if (ret < 0) { goto fail; } } else { ret = -EINVAL; goto fail; } s->compressed_chunk = qemu_try_blockalign(bs->file->bs, ds.max_compressed_size + 1); s->uncompressed_chunk = qemu_try_blockalign(bs->file->bs, 512 * ds.max_sectors_per_chunk); if (s->compressed_chunk == NULL || s->uncompressed_chunk == NULL) { ret = -ENOMEM; goto fail; } if (inflateInit(&s->zstream) != Z_OK) { ret = -EINVAL; goto fail; } s->current_chunk = s->n_chunks; qemu_co_mutex_init(&s->lock); return 0; fail: g_free(s->types); g_free(s->offsets); g_free(s->lengths); g_free(s->sectors); g_free(s->sectorcounts); qemu_vfree(s->compressed_chunk); qemu_vfree(s->uncompressed_chunk); return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(BlockDriverState *VAR_0, QDict *VAR_1, int VAR_2, Error **VAR_3) { BDRVDMGState *s = VAR_0->opaque; DmgHeaderState ds; uint64_t rsrc_fork_offset, rsrc_fork_length; uint64_t plist_xml_offset, plist_xml_length; int64_t offset; int VAR_4; VAR_0->file = bdrv_open_child(NULL, VAR_1, "file", VAR_0, &child_file, false, VAR_3); if (!VAR_0->file) { return -EINVAL; } block_module_load_one("dmg-bz2"); VAR_0->read_only = true; s->n_chunks = 0; s->offsets = s->lengths = s->sectors = s->sectorcounts = NULL; ds.data_fork_offset = 0; ds.max_compressed_size = 1; ds.max_sectors_per_chunk = 1; offset = dmg_find_koly_offset(VAR_0->file, VAR_3); if (offset < 0) { VAR_4 = offset; goto fail; } VAR_4 = read_uint64(VAR_0, offset + 0x18, &ds.data_fork_offset); if (VAR_4 < 0) { goto fail; } else if (ds.data_fork_offset > offset) { VAR_4 = -EINVAL; goto fail; } VAR_4 = read_uint64(VAR_0, offset + 0x28, &rsrc_fork_offset); if (VAR_4 < 0) { goto fail; } VAR_4 = read_uint64(VAR_0, offset + 0x30, &rsrc_fork_length); if (VAR_4 < 0) { goto fail; } if (rsrc_fork_offset >= offset || rsrc_fork_length > offset - rsrc_fork_offset) { VAR_4 = -EINVAL; goto fail; } VAR_4 = read_uint64(VAR_0, offset + 0xd8, &plist_xml_offset); if (VAR_4 < 0) { goto fail; } VAR_4 = read_uint64(VAR_0, offset + 0xe0, &plist_xml_length); if (VAR_4 < 0) { goto fail; } if (plist_xml_offset >= offset || plist_xml_length > offset - plist_xml_offset) { VAR_4 = -EINVAL; goto fail; } VAR_4 = read_uint64(VAR_0, offset + 0x1ec, (uint64_t *)&VAR_0->total_sectors); if (VAR_4 < 0) { goto fail; } if (VAR_0->total_sectors < 0) { VAR_4 = -EINVAL; goto fail; } if (rsrc_fork_length != 0) { VAR_4 = dmg_read_resource_fork(VAR_0, &ds, rsrc_fork_offset, rsrc_fork_length); if (VAR_4 < 0) { goto fail; } } else if (plist_xml_length != 0) { VAR_4 = dmg_read_plist_xml(VAR_0, &ds, plist_xml_offset, plist_xml_length); if (VAR_4 < 0) { goto fail; } } else { VAR_4 = -EINVAL; goto fail; } s->compressed_chunk = qemu_try_blockalign(VAR_0->file->VAR_0, ds.max_compressed_size + 1); s->uncompressed_chunk = qemu_try_blockalign(VAR_0->file->VAR_0, 512 * ds.max_sectors_per_chunk); if (s->compressed_chunk == NULL || s->uncompressed_chunk == NULL) { VAR_4 = -ENOMEM; goto fail; } if (inflateInit(&s->zstream) != Z_OK) { VAR_4 = -EINVAL; goto fail; } s->current_chunk = s->n_chunks; qemu_co_mutex_init(&s->lock); return 0; fail: g_free(s->types); g_free(s->offsets); g_free(s->lengths); g_free(s->sectors); g_free(s->sectorcounts); qemu_vfree(s->compressed_chunk); qemu_vfree(s->uncompressed_chunk); return VAR_4; }
[ "static int FUNC_0(BlockDriverState *VAR_0, QDict *VAR_1, int VAR_2,\nError **VAR_3)\n{", "BDRVDMGState *s = VAR_0->opaque;", "DmgHeaderState ds;", "uint64_t rsrc_fork_offset, rsrc_fork_length;", "uint64_t plist_xml_offset, plist_xml_length;", "int64_t offset;", "int VAR_4;", "VAR_0->file = bdrv_open_child(NULL, VAR_1, \"file\", VAR_0, &child_file,\nfalse, VAR_3);", "if (!VAR_0->file) {", "return -EINVAL;", "}", "block_module_load_one(\"dmg-bz2\");", "VAR_0->read_only = true;", "s->n_chunks = 0;", "s->offsets = s->lengths = s->sectors = s->sectorcounts = NULL;", "ds.data_fork_offset = 0;", "ds.max_compressed_size = 1;", "ds.max_sectors_per_chunk = 1;", "offset = dmg_find_koly_offset(VAR_0->file, VAR_3);", "if (offset < 0) {", "VAR_4 = offset;", "goto fail;", "}", "VAR_4 = read_uint64(VAR_0, offset + 0x18, &ds.data_fork_offset);", "if (VAR_4 < 0) {", "goto fail;", "} else if (ds.data_fork_offset > offset) {", "VAR_4 = -EINVAL;", "goto fail;", "}", "VAR_4 = read_uint64(VAR_0, offset + 0x28, &rsrc_fork_offset);", "if (VAR_4 < 0) {", "goto fail;", "}", "VAR_4 = read_uint64(VAR_0, offset + 0x30, &rsrc_fork_length);", "if (VAR_4 < 0) {", "goto fail;", "}", "if (rsrc_fork_offset >= offset ||\nrsrc_fork_length > offset - rsrc_fork_offset) {", "VAR_4 = -EINVAL;", "goto fail;", "}", "VAR_4 = read_uint64(VAR_0, offset + 0xd8, &plist_xml_offset);", "if (VAR_4 < 0) {", "goto fail;", "}", "VAR_4 = read_uint64(VAR_0, offset + 0xe0, &plist_xml_length);", "if (VAR_4 < 0) {", "goto fail;", "}", "if (plist_xml_offset >= offset ||\nplist_xml_length > offset - plist_xml_offset) {", "VAR_4 = -EINVAL;", "goto fail;", "}", "VAR_4 = read_uint64(VAR_0, offset + 0x1ec, (uint64_t *)&VAR_0->total_sectors);", "if (VAR_4 < 0) {", "goto fail;", "}", "if (VAR_0->total_sectors < 0) {", "VAR_4 = -EINVAL;", "goto fail;", "}", "if (rsrc_fork_length != 0) {", "VAR_4 = dmg_read_resource_fork(VAR_0, &ds,\nrsrc_fork_offset, rsrc_fork_length);", "if (VAR_4 < 0) {", "goto fail;", "}", "} else if (plist_xml_length != 0) {", "VAR_4 = dmg_read_plist_xml(VAR_0, &ds, plist_xml_offset, plist_xml_length);", "if (VAR_4 < 0) {", "goto fail;", "}", "} else {", "VAR_4 = -EINVAL;", "goto fail;", "}", "s->compressed_chunk = qemu_try_blockalign(VAR_0->file->VAR_0,\nds.max_compressed_size + 1);", "s->uncompressed_chunk = qemu_try_blockalign(VAR_0->file->VAR_0,\n512 * ds.max_sectors_per_chunk);", "if (s->compressed_chunk == NULL || s->uncompressed_chunk == NULL) {", "VAR_4 = -ENOMEM;", "goto fail;", "}", "if (inflateInit(&s->zstream) != Z_OK) {", "VAR_4 = -EINVAL;", "goto fail;", "}", "s->current_chunk = s->n_chunks;", "qemu_co_mutex_init(&s->lock);", "return 0;", "fail:\ng_free(s->types);", "g_free(s->offsets);", "g_free(s->lengths);", "g_free(s->sectors);", "g_free(s->sectorcounts);", "qemu_vfree(s->compressed_chunk);", "qemu_vfree(s->uncompressed_chunk);", "return VAR_4;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21, 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103, 105 ], [ 107 ], [ 109 ], [ 111 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131, 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159, 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 191, 193 ], [ 195, 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 219 ], [ 223 ], [ 225 ], [ 229, 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ] ]
7,381
void bdrv_detach_aio_context(BlockDriverState *bs) { BdrvAioNotifier *baf; if (!bs->drv) { return; } QLIST_FOREACH(baf, &bs->aio_notifiers, list) { baf->detach_aio_context(baf->opaque); } if (bs->io_limits_enabled) { throttle_timers_detach_aio_context(&bs->throttle_timers); } if (bs->drv->bdrv_detach_aio_context) { bs->drv->bdrv_detach_aio_context(bs); } if (bs->file) { bdrv_detach_aio_context(bs->file->bs); } if (bs->backing) { bdrv_detach_aio_context(bs->backing->bs); } bs->aio_context = NULL; }
false
qemu
a0d64a61db602696f4f1895a890c65eda5b3b618
void bdrv_detach_aio_context(BlockDriverState *bs) { BdrvAioNotifier *baf; if (!bs->drv) { return; } QLIST_FOREACH(baf, &bs->aio_notifiers, list) { baf->detach_aio_context(baf->opaque); } if (bs->io_limits_enabled) { throttle_timers_detach_aio_context(&bs->throttle_timers); } if (bs->drv->bdrv_detach_aio_context) { bs->drv->bdrv_detach_aio_context(bs); } if (bs->file) { bdrv_detach_aio_context(bs->file->bs); } if (bs->backing) { bdrv_detach_aio_context(bs->backing->bs); } bs->aio_context = NULL; }
{ "code": [], "line_no": [] }
void FUNC_0(BlockDriverState *VAR_0) { BdrvAioNotifier *baf; if (!VAR_0->drv) { return; } QLIST_FOREACH(baf, &VAR_0->aio_notifiers, list) { baf->detach_aio_context(baf->opaque); } if (VAR_0->io_limits_enabled) { throttle_timers_detach_aio_context(&VAR_0->throttle_timers); } if (VAR_0->drv->FUNC_0) { VAR_0->drv->FUNC_0(VAR_0); } if (VAR_0->file) { FUNC_0(VAR_0->file->VAR_0); } if (VAR_0->backing) { FUNC_0(VAR_0->backing->VAR_0); } VAR_0->aio_context = NULL; }
[ "void FUNC_0(BlockDriverState *VAR_0)\n{", "BdrvAioNotifier *baf;", "if (!VAR_0->drv) {", "return;", "}", "QLIST_FOREACH(baf, &VAR_0->aio_notifiers, list) {", "baf->detach_aio_context(baf->opaque);", "}", "if (VAR_0->io_limits_enabled) {", "throttle_timers_detach_aio_context(&VAR_0->throttle_timers);", "}", "if (VAR_0->drv->FUNC_0) {", "VAR_0->drv->FUNC_0(VAR_0);", "}", "if (VAR_0->file) {", "FUNC_0(VAR_0->file->VAR_0);", "}", "if (VAR_0->backing) {", "FUNC_0(VAR_0->backing->VAR_0);", "}", "VAR_0->aio_context = NULL;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ] ]
7,382
static int virtio_rng_load(QEMUFile *f, void *opaque, int version_id) { VirtIORNG *vrng = opaque; VirtIODevice *vdev = VIRTIO_DEVICE(vrng); if (version_id != 1) { return -EINVAL; } virtio_load(vdev, f, version_id); /* We may have an element ready but couldn't process it due to a quota * limit. Make sure to try again after live migration when the quota may * have been reset. */ virtio_rng_process(vrng); return 0; }
false
qemu
3902d49e13c2428bd6381cfdf183103ca4477c1f
static int virtio_rng_load(QEMUFile *f, void *opaque, int version_id) { VirtIORNG *vrng = opaque; VirtIODevice *vdev = VIRTIO_DEVICE(vrng); if (version_id != 1) { return -EINVAL; } virtio_load(vdev, f, version_id); virtio_rng_process(vrng); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(QEMUFile *VAR_0, void *VAR_1, int VAR_2) { VirtIORNG *vrng = VAR_1; VirtIODevice *vdev = VIRTIO_DEVICE(vrng); if (VAR_2 != 1) { return -EINVAL; } virtio_load(vdev, VAR_0, VAR_2); virtio_rng_process(vrng); return 0; }
[ "static int FUNC_0(QEMUFile *VAR_0, void *VAR_1, int VAR_2)\n{", "VirtIORNG *vrng = VAR_1;", "VirtIODevice *vdev = VIRTIO_DEVICE(vrng);", "if (VAR_2 != 1) {", "return -EINVAL;", "}", "virtio_load(vdev, VAR_0, VAR_2);", "virtio_rng_process(vrng);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 29 ], [ 33 ], [ 35 ] ]
7,384
static av_cold int roq_dpcm_encode_init(AVCodecContext *avctx) { ROQDPCMContext *context = avctx->priv_data; if (avctx->channels > 2) { av_log(avctx, AV_LOG_ERROR, "Audio must be mono or stereo\n"); return -1; } if (avctx->sample_rate != 22050) { av_log(avctx, AV_LOG_ERROR, "Audio must be 22050 Hz\n"); return -1; } if (avctx->sample_fmt != AV_SAMPLE_FMT_S16) { av_log(avctx, AV_LOG_ERROR, "Audio must be signed 16-bit\n"); return -1; } avctx->frame_size = ROQ_FIRST_FRAME_SIZE; context->lastSample[0] = context->lastSample[1] = 0; avctx->coded_frame= avcodec_alloc_frame(); if (!avctx->coded_frame) return AVERROR(ENOMEM); return 0; }
false
FFmpeg
56279f1d6155a7af52526b9852ee28831d0232a6
static av_cold int roq_dpcm_encode_init(AVCodecContext *avctx) { ROQDPCMContext *context = avctx->priv_data; if (avctx->channels > 2) { av_log(avctx, AV_LOG_ERROR, "Audio must be mono or stereo\n"); return -1; } if (avctx->sample_rate != 22050) { av_log(avctx, AV_LOG_ERROR, "Audio must be 22050 Hz\n"); return -1; } if (avctx->sample_fmt != AV_SAMPLE_FMT_S16) { av_log(avctx, AV_LOG_ERROR, "Audio must be signed 16-bit\n"); return -1; } avctx->frame_size = ROQ_FIRST_FRAME_SIZE; context->lastSample[0] = context->lastSample[1] = 0; avctx->coded_frame= avcodec_alloc_frame(); if (!avctx->coded_frame) return AVERROR(ENOMEM); return 0; }
{ "code": [], "line_no": [] }
static av_cold int FUNC_0(AVCodecContext *avctx) { ROQDPCMContext *context = avctx->priv_data; if (avctx->channels > 2) { av_log(avctx, AV_LOG_ERROR, "Audio must be mono or stereo\n"); return -1; } if (avctx->sample_rate != 22050) { av_log(avctx, AV_LOG_ERROR, "Audio must be 22050 Hz\n"); return -1; } if (avctx->sample_fmt != AV_SAMPLE_FMT_S16) { av_log(avctx, AV_LOG_ERROR, "Audio must be signed 16-bit\n"); return -1; } avctx->frame_size = ROQ_FIRST_FRAME_SIZE; context->lastSample[0] = context->lastSample[1] = 0; avctx->coded_frame= avcodec_alloc_frame(); if (!avctx->coded_frame) return AVERROR(ENOMEM); return 0; }
[ "static av_cold int FUNC_0(AVCodecContext *avctx)\n{", "ROQDPCMContext *context = avctx->priv_data;", "if (avctx->channels > 2) {", "av_log(avctx, AV_LOG_ERROR, \"Audio must be mono or stereo\\n\");", "return -1;", "}", "if (avctx->sample_rate != 22050) {", "av_log(avctx, AV_LOG_ERROR, \"Audio must be 22050 Hz\\n\");", "return -1;", "}", "if (avctx->sample_fmt != AV_SAMPLE_FMT_S16) {", "av_log(avctx, AV_LOG_ERROR, \"Audio must be signed 16-bit\\n\");", "return -1;", "}", "avctx->frame_size = ROQ_FIRST_FRAME_SIZE;", "context->lastSample[0] = context->lastSample[1] = 0;", "avctx->coded_frame= avcodec_alloc_frame();", "if (!avctx->coded_frame)\nreturn AVERROR(ENOMEM);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 39 ], [ 43 ], [ 45, 47 ], [ 51 ], [ 53 ] ]
7,385
static void kvm_mce_inj_srar_dataload(CPUState *env, target_phys_addr_t paddr) { struct kvm_x86_mce mce = { .bank = 9, .status = MCI_STATUS_VAL | MCI_STATUS_UC | MCI_STATUS_EN | MCI_STATUS_MISCV | MCI_STATUS_ADDRV | MCI_STATUS_S | MCI_STATUS_AR | 0x134, .mcg_status = MCG_STATUS_MCIP | MCG_STATUS_EIPV, .addr = paddr, .misc = (MCM_ADDR_PHYS << 6) | 0xc, }; int r; r = kvm_set_mce(env, &mce); if (r < 0) { fprintf(stderr, "kvm_set_mce: %s\n", strerror(errno)); abort(); } kvm_mce_broadcast_rest(env); }
false
qemu
c34d440a728fd3b5099d11dec122d440ef092c23
static void kvm_mce_inj_srar_dataload(CPUState *env, target_phys_addr_t paddr) { struct kvm_x86_mce mce = { .bank = 9, .status = MCI_STATUS_VAL | MCI_STATUS_UC | MCI_STATUS_EN | MCI_STATUS_MISCV | MCI_STATUS_ADDRV | MCI_STATUS_S | MCI_STATUS_AR | 0x134, .mcg_status = MCG_STATUS_MCIP | MCG_STATUS_EIPV, .addr = paddr, .misc = (MCM_ADDR_PHYS << 6) | 0xc, }; int r; r = kvm_set_mce(env, &mce); if (r < 0) { fprintf(stderr, "kvm_set_mce: %s\n", strerror(errno)); abort(); } kvm_mce_broadcast_rest(env); }
{ "code": [], "line_no": [] }
static void FUNC_0(CPUState *VAR_0, target_phys_addr_t VAR_1) { struct kvm_x86_mce VAR_2 = { .bank = 9, .status = MCI_STATUS_VAL | MCI_STATUS_UC | MCI_STATUS_EN | MCI_STATUS_MISCV | MCI_STATUS_ADDRV | MCI_STATUS_S | MCI_STATUS_AR | 0x134, .mcg_status = MCG_STATUS_MCIP | MCG_STATUS_EIPV, .addr = VAR_1, .misc = (MCM_ADDR_PHYS << 6) | 0xc, }; int VAR_3; VAR_3 = kvm_set_mce(VAR_0, &VAR_2); if (VAR_3 < 0) { fprintf(stderr, "kvm_set_mce: %s\n", strerror(errno)); abort(); } kvm_mce_broadcast_rest(VAR_0); }
[ "static void FUNC_0(CPUState *VAR_0, target_phys_addr_t VAR_1)\n{", "struct kvm_x86_mce VAR_2 = {", ".bank = 9,\n.status = MCI_STATUS_VAL | MCI_STATUS_UC | MCI_STATUS_EN\n| MCI_STATUS_MISCV | MCI_STATUS_ADDRV | MCI_STATUS_S\n| MCI_STATUS_AR | 0x134,\n.mcg_status = MCG_STATUS_MCIP | MCG_STATUS_EIPV,\n.addr = VAR_1,\n.misc = (MCM_ADDR_PHYS << 6) | 0xc,\n};", "int VAR_3;", "VAR_3 = kvm_set_mce(VAR_0, &VAR_2);", "if (VAR_3 < 0) {", "fprintf(stderr, \"kvm_set_mce: %s\\n\", strerror(errno));", "abort();", "}", "kvm_mce_broadcast_rest(VAR_0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9, 11, 13, 15, 17, 19, 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ] ]
7,386
int qemu_global_option(const char *str) { char driver[64], property[64]; QemuOpts *opts; int rc, offset; rc = sscanf(str, "%63[^.].%63[^=]%n", driver, property, &offset); if (rc < 2 || str[offset] != '=') { error_report("can't parse: \"%s\"", str); return -1; } opts = qemu_opts_create(&qemu_global_opts, NULL, 0, &error_abort); qemu_opt_set(opts, "driver", driver, &error_abort); qemu_opt_set(opts, "property", property, &error_abort); qemu_opt_set(opts, "value", str + offset + 1, &error_abort); return 0; }
false
qemu
3751d7c43f795b45ffdb9429cfb09c6beea55c68
int qemu_global_option(const char *str) { char driver[64], property[64]; QemuOpts *opts; int rc, offset; rc = sscanf(str, "%63[^.].%63[^=]%n", driver, property, &offset); if (rc < 2 || str[offset] != '=') { error_report("can't parse: \"%s\"", str); return -1; } opts = qemu_opts_create(&qemu_global_opts, NULL, 0, &error_abort); qemu_opt_set(opts, "driver", driver, &error_abort); qemu_opt_set(opts, "property", property, &error_abort); qemu_opt_set(opts, "value", str + offset + 1, &error_abort); return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(const char *VAR_0) { char VAR_1[64], VAR_2[64]; QemuOpts *opts; int VAR_3, VAR_4; VAR_3 = sscanf(VAR_0, "%63[^.].%63[^=]%n", VAR_1, VAR_2, &VAR_4); if (VAR_3 < 2 || VAR_0[VAR_4] != '=') { error_report("can't parse: \"%s\"", VAR_0); return -1; } opts = qemu_opts_create(&qemu_global_opts, NULL, 0, &error_abort); qemu_opt_set(opts, "VAR_1", VAR_1, &error_abort); qemu_opt_set(opts, "VAR_2", VAR_2, &error_abort); qemu_opt_set(opts, "value", VAR_0 + VAR_4 + 1, &error_abort); return 0; }
[ "int FUNC_0(const char *VAR_0)\n{", "char VAR_1[64], VAR_2[64];", "QemuOpts *opts;", "int VAR_3, VAR_4;", "VAR_3 = sscanf(VAR_0, \"%63[^.].%63[^=]%n\", VAR_1, VAR_2, &VAR_4);", "if (VAR_3 < 2 || VAR_0[VAR_4] != '=') {", "error_report(\"can't parse: \\\"%s\\\"\", VAR_0);", "return -1;", "}", "opts = qemu_opts_create(&qemu_global_opts, NULL, 0, &error_abort);", "qemu_opt_set(opts, \"VAR_1\", VAR_1, &error_abort);", "qemu_opt_set(opts, \"VAR_2\", VAR_2, &error_abort);", "qemu_opt_set(opts, \"value\", VAR_0 + VAR_4 + 1, &error_abort);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ] ]
7,387
static void uhci_ioport_writew(void *opaque, uint32_t addr, uint32_t val) { UHCIState *s = opaque; addr &= 0x1f; DPRINTF("uhci: writew port=0x%04x val=0x%04x\n", addr, val); switch(addr) { case 0x00: if ((val & UHCI_CMD_RS) && !(s->cmd & UHCI_CMD_RS)) { /* start frame processing */ s->expire_time = qemu_get_clock_ns(vm_clock) + (get_ticks_per_sec() / FRAME_TIMER_FREQ); qemu_mod_timer(s->frame_timer, qemu_get_clock_ns(vm_clock)); s->status &= ~UHCI_STS_HCHALTED; } else if (!(val & UHCI_CMD_RS)) { s->status |= UHCI_STS_HCHALTED; } if (val & UHCI_CMD_GRESET) { UHCIPort *port; USBDevice *dev; int i; /* send reset on the USB bus */ for(i = 0; i < NB_PORTS; i++) { port = &s->ports[i]; dev = port->port.dev; if (dev) { usb_send_msg(dev, USB_MSG_RESET); } } uhci_reset(s); return; } if (val & UHCI_CMD_HCRESET) { uhci_reset(s); return; } s->cmd = val; break; case 0x02: s->status &= ~val; /* XXX: the chip spec is not coherent, so we add a hidden register to distinguish between IOC and SPD */ if (val & UHCI_STS_USBINT) s->status2 = 0; uhci_update_irq(s); break; case 0x04: s->intr = val; uhci_update_irq(s); break; case 0x06: if (s->status & UHCI_STS_HCHALTED) s->frnum = val & 0x7ff; break; case 0x10 ... 0x1f: { UHCIPort *port; USBDevice *dev; int n; n = (addr >> 1) & 7; if (n >= NB_PORTS) return; port = &s->ports[n]; dev = port->port.dev; if (dev) { /* port reset */ if ( (val & UHCI_PORT_RESET) && !(port->ctrl & UHCI_PORT_RESET) ) { usb_send_msg(dev, USB_MSG_RESET); } } port->ctrl &= UHCI_PORT_READ_ONLY; port->ctrl |= (val & ~UHCI_PORT_READ_ONLY); /* some bits are reset when a '1' is written to them */ port->ctrl &= ~(val & UHCI_PORT_WRITE_CLEAR); } break; } }
false
qemu
891fb2cd4592b6fe76106a69e0ca40efbf82726a
static void uhci_ioport_writew(void *opaque, uint32_t addr, uint32_t val) { UHCIState *s = opaque; addr &= 0x1f; DPRINTF("uhci: writew port=0x%04x val=0x%04x\n", addr, val); switch(addr) { case 0x00: if ((val & UHCI_CMD_RS) && !(s->cmd & UHCI_CMD_RS)) { s->expire_time = qemu_get_clock_ns(vm_clock) + (get_ticks_per_sec() / FRAME_TIMER_FREQ); qemu_mod_timer(s->frame_timer, qemu_get_clock_ns(vm_clock)); s->status &= ~UHCI_STS_HCHALTED; } else if (!(val & UHCI_CMD_RS)) { s->status |= UHCI_STS_HCHALTED; } if (val & UHCI_CMD_GRESET) { UHCIPort *port; USBDevice *dev; int i; for(i = 0; i < NB_PORTS; i++) { port = &s->ports[i]; dev = port->port.dev; if (dev) { usb_send_msg(dev, USB_MSG_RESET); } } uhci_reset(s); return; } if (val & UHCI_CMD_HCRESET) { uhci_reset(s); return; } s->cmd = val; break; case 0x02: s->status &= ~val; if (val & UHCI_STS_USBINT) s->status2 = 0; uhci_update_irq(s); break; case 0x04: s->intr = val; uhci_update_irq(s); break; case 0x06: if (s->status & UHCI_STS_HCHALTED) s->frnum = val & 0x7ff; break; case 0x10 ... 0x1f: { UHCIPort *port; USBDevice *dev; int n; n = (addr >> 1) & 7; if (n >= NB_PORTS) return; port = &s->ports[n]; dev = port->port.dev; if (dev) { if ( (val & UHCI_PORT_RESET) && !(port->ctrl & UHCI_PORT_RESET) ) { usb_send_msg(dev, USB_MSG_RESET); } } port->ctrl &= UHCI_PORT_READ_ONLY; port->ctrl |= (val & ~UHCI_PORT_READ_ONLY); port->ctrl &= ~(val & UHCI_PORT_WRITE_CLEAR); } break; } }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, uint32_t VAR_1, uint32_t VAR_2) { UHCIState *s = VAR_0; VAR_1 &= 0x1f; DPRINTF("uhci: writew port=0x%04x VAR_2=0x%04x\VAR_4", VAR_1, VAR_2); switch(VAR_1) { case 0x00: if ((VAR_2 & UHCI_CMD_RS) && !(s->cmd & UHCI_CMD_RS)) { s->expire_time = qemu_get_clock_ns(vm_clock) + (get_ticks_per_sec() / FRAME_TIMER_FREQ); qemu_mod_timer(s->frame_timer, qemu_get_clock_ns(vm_clock)); s->status &= ~UHCI_STS_HCHALTED; } else if (!(VAR_2 & UHCI_CMD_RS)) { s->status |= UHCI_STS_HCHALTED; } if (VAR_2 & UHCI_CMD_GRESET) { UHCIPort *port; USBDevice *dev; int VAR_3; for(VAR_3 = 0; VAR_3 < NB_PORTS; VAR_3++) { port = &s->ports[VAR_3]; dev = port->port.dev; if (dev) { usb_send_msg(dev, USB_MSG_RESET); } } uhci_reset(s); return; } if (VAR_2 & UHCI_CMD_HCRESET) { uhci_reset(s); return; } s->cmd = VAR_2; break; case 0x02: s->status &= ~VAR_2; if (VAR_2 & UHCI_STS_USBINT) s->status2 = 0; uhci_update_irq(s); break; case 0x04: s->intr = VAR_2; uhci_update_irq(s); break; case 0x06: if (s->status & UHCI_STS_HCHALTED) s->frnum = VAR_2 & 0x7ff; break; case 0x10 ... 0x1f: { UHCIPort *port; USBDevice *dev; int VAR_4; VAR_4 = (VAR_1 >> 1) & 7; if (VAR_4 >= NB_PORTS) return; port = &s->ports[VAR_4]; dev = port->port.dev; if (dev) { if ( (VAR_2 & UHCI_PORT_RESET) && !(port->ctrl & UHCI_PORT_RESET) ) { usb_send_msg(dev, USB_MSG_RESET); } } port->ctrl &= UHCI_PORT_READ_ONLY; port->ctrl |= (VAR_2 & ~UHCI_PORT_READ_ONLY); port->ctrl &= ~(VAR_2 & UHCI_PORT_WRITE_CLEAR); } break; } }
[ "static void FUNC_0(void *VAR_0, uint32_t VAR_1, uint32_t VAR_2)\n{", "UHCIState *s = VAR_0;", "VAR_1 &= 0x1f;", "DPRINTF(\"uhci: writew port=0x%04x VAR_2=0x%04x\\VAR_4\", VAR_1, VAR_2);", "switch(VAR_1) {", "case 0x00:\nif ((VAR_2 & UHCI_CMD_RS) && !(s->cmd & UHCI_CMD_RS)) {", "s->expire_time = qemu_get_clock_ns(vm_clock) +\n(get_ticks_per_sec() / FRAME_TIMER_FREQ);", "qemu_mod_timer(s->frame_timer, qemu_get_clock_ns(vm_clock));", "s->status &= ~UHCI_STS_HCHALTED;", "} else if (!(VAR_2 & UHCI_CMD_RS)) {", "s->status |= UHCI_STS_HCHALTED;", "}", "if (VAR_2 & UHCI_CMD_GRESET) {", "UHCIPort *port;", "USBDevice *dev;", "int VAR_3;", "for(VAR_3 = 0; VAR_3 < NB_PORTS; VAR_3++) {", "port = &s->ports[VAR_3];", "dev = port->port.dev;", "if (dev) {", "usb_send_msg(dev, USB_MSG_RESET);", "}", "}", "uhci_reset(s);", "return;", "}", "if (VAR_2 & UHCI_CMD_HCRESET) {", "uhci_reset(s);", "return;", "}", "s->cmd = VAR_2;", "break;", "case 0x02:\ns->status &= ~VAR_2;", "if (VAR_2 & UHCI_STS_USBINT)\ns->status2 = 0;", "uhci_update_irq(s);", "break;", "case 0x04:\ns->intr = VAR_2;", "uhci_update_irq(s);", "break;", "case 0x06:\nif (s->status & UHCI_STS_HCHALTED)\ns->frnum = VAR_2 & 0x7ff;", "break;", "case 0x10 ... 0x1f:\n{", "UHCIPort *port;", "USBDevice *dev;", "int VAR_4;", "VAR_4 = (VAR_1 >> 1) & 7;", "if (VAR_4 >= NB_PORTS)\nreturn;", "port = &s->ports[VAR_4];", "dev = port->port.dev;", "if (dev) {", "if ( (VAR_2 & UHCI_PORT_RESET) &&\n!(port->ctrl & UHCI_PORT_RESET) ) {", "usb_send_msg(dev, USB_MSG_RESET);", "}", "}", "port->ctrl &= UHCI_PORT_READ_ONLY;", "port->ctrl |= (VAR_2 & ~UHCI_PORT_READ_ONLY);", "port->ctrl &= ~(VAR_2 & UHCI_PORT_WRITE_CLEAR);", "}", "break;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 15 ], [ 17, 19 ], [ 23, 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81, 83 ], [ 89, 91 ], [ 93 ], [ 95 ], [ 97, 99 ], [ 101 ], [ 103 ], [ 105, 107, 109 ], [ 111 ], [ 113, 115 ], [ 117 ], [ 119 ], [ 121 ], [ 125 ], [ 127, 129 ], [ 131 ], [ 133 ], [ 135 ], [ 139, 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ] ]
7,388
static void tlb_info_pae32(Monitor *mon, CPUState *env) { int l1, l2, l3; uint64_t pdpe, pde, pte; uint64_t pdp_addr, pd_addr, pt_addr; pdp_addr = env->cr[3] & ~0x1f; for (l1 = 0; l1 < 4; l1++) { cpu_physical_memory_read(pdp_addr + l1 * 8, &pdpe, 8); pdpe = le64_to_cpu(pdpe); if (pdpe & PG_PRESENT_MASK) { pd_addr = pdpe & 0x3fffffffff000ULL; for (l2 = 0; l2 < 512; l2++) { cpu_physical_memory_read(pd_addr + l2 * 8, &pde, 8); pde = le64_to_cpu(pde); if (pde & PG_PRESENT_MASK) { if (pde & PG_PSE_MASK) { /* 2M pages with PAE, CR4.PSE is ignored */ print_pte(mon, (l1 << 30 ) + (l2 << 21), pde, ~((target_phys_addr_t)(1 << 20) - 1)); } else { pt_addr = pde & 0x3fffffffff000ULL; for (l3 = 0; l3 < 512; l3++) { cpu_physical_memory_read(pt_addr + l3 * 8, &pte, 8); pte = le64_to_cpu(pte); if (pte & PG_PRESENT_MASK) { print_pte(mon, (l1 << 30 ) + (l2 << 21) + (l3 << 12), pte & ~PG_PSE_MASK, ~(target_phys_addr_t)0xfff); } } } } } } } }
false
qemu
94ac5cd20c6e441e0ed3aec5c98d6cbefb7f503f
static void tlb_info_pae32(Monitor *mon, CPUState *env) { int l1, l2, l3; uint64_t pdpe, pde, pte; uint64_t pdp_addr, pd_addr, pt_addr; pdp_addr = env->cr[3] & ~0x1f; for (l1 = 0; l1 < 4; l1++) { cpu_physical_memory_read(pdp_addr + l1 * 8, &pdpe, 8); pdpe = le64_to_cpu(pdpe); if (pdpe & PG_PRESENT_MASK) { pd_addr = pdpe & 0x3fffffffff000ULL; for (l2 = 0; l2 < 512; l2++) { cpu_physical_memory_read(pd_addr + l2 * 8, &pde, 8); pde = le64_to_cpu(pde); if (pde & PG_PRESENT_MASK) { if (pde & PG_PSE_MASK) { print_pte(mon, (l1 << 30 ) + (l2 << 21), pde, ~((target_phys_addr_t)(1 << 20) - 1)); } else { pt_addr = pde & 0x3fffffffff000ULL; for (l3 = 0; l3 < 512; l3++) { cpu_physical_memory_read(pt_addr + l3 * 8, &pte, 8); pte = le64_to_cpu(pte); if (pte & PG_PRESENT_MASK) { print_pte(mon, (l1 << 30 ) + (l2 << 21) + (l3 << 12), pte & ~PG_PSE_MASK, ~(target_phys_addr_t)0xfff); } } } } } } } }
{ "code": [], "line_no": [] }
static void FUNC_0(Monitor *VAR_0, CPUState *VAR_1) { int VAR_2, VAR_3, VAR_4; uint64_t pdpe, pde, pte; uint64_t pdp_addr, pd_addr, pt_addr; pdp_addr = VAR_1->cr[3] & ~0x1f; for (VAR_2 = 0; VAR_2 < 4; VAR_2++) { cpu_physical_memory_read(pdp_addr + VAR_2 * 8, &pdpe, 8); pdpe = le64_to_cpu(pdpe); if (pdpe & PG_PRESENT_MASK) { pd_addr = pdpe & 0x3fffffffff000ULL; for (VAR_3 = 0; VAR_3 < 512; VAR_3++) { cpu_physical_memory_read(pd_addr + VAR_3 * 8, &pde, 8); pde = le64_to_cpu(pde); if (pde & PG_PRESENT_MASK) { if (pde & PG_PSE_MASK) { print_pte(VAR_0, (VAR_2 << 30 ) + (VAR_3 << 21), pde, ~((target_phys_addr_t)(1 << 20) - 1)); } else { pt_addr = pde & 0x3fffffffff000ULL; for (VAR_4 = 0; VAR_4 < 512; VAR_4++) { cpu_physical_memory_read(pt_addr + VAR_4 * 8, &pte, 8); pte = le64_to_cpu(pte); if (pte & PG_PRESENT_MASK) { print_pte(VAR_0, (VAR_2 << 30 ) + (VAR_3 << 21) + (VAR_4 << 12), pte & ~PG_PSE_MASK, ~(target_phys_addr_t)0xfff); } } } } } } } }
[ "static void FUNC_0(Monitor *VAR_0, CPUState *VAR_1)\n{", "int VAR_2, VAR_3, VAR_4;", "uint64_t pdpe, pde, pte;", "uint64_t pdp_addr, pd_addr, pt_addr;", "pdp_addr = VAR_1->cr[3] & ~0x1f;", "for (VAR_2 = 0; VAR_2 < 4; VAR_2++) {", "cpu_physical_memory_read(pdp_addr + VAR_2 * 8, &pdpe, 8);", "pdpe = le64_to_cpu(pdpe);", "if (pdpe & PG_PRESENT_MASK) {", "pd_addr = pdpe & 0x3fffffffff000ULL;", "for (VAR_3 = 0; VAR_3 < 512; VAR_3++) {", "cpu_physical_memory_read(pd_addr + VAR_3 * 8, &pde, 8);", "pde = le64_to_cpu(pde);", "if (pde & PG_PRESENT_MASK) {", "if (pde & PG_PSE_MASK) {", "print_pte(VAR_0, (VAR_2 << 30 ) + (VAR_3 << 21), pde,\n~((target_phys_addr_t)(1 << 20) - 1));", "} else {", "pt_addr = pde & 0x3fffffffff000ULL;", "for (VAR_4 = 0; VAR_4 < 512; VAR_4++) {", "cpu_physical_memory_read(pt_addr + VAR_4 * 8, &pte, 8);", "pte = le64_to_cpu(pte);", "if (pte & PG_PRESENT_MASK) {", "print_pte(VAR_0, (VAR_2 << 30 ) + (VAR_3 << 21)\n+ (VAR_4 << 12),\npte & ~PG_PSE_MASK,\n~(target_phys_addr_t)0xfff);", "}", "}", "}", "}", "}", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37, 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53, 55, 57, 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ] ]
7,389
void *paio_init(void) { struct sigaction act; PosixAioState *s; int fds[2]; int ret; if (posix_aio_state) return posix_aio_state; s = qemu_malloc(sizeof(PosixAioState)); sigfillset(&act.sa_mask); act.sa_flags = 0; /* do not restart syscalls to interrupt select() */ act.sa_handler = aio_signal_handler; sigaction(SIGUSR2, &act, NULL); s->first_aio = NULL; if (pipe(fds) == -1) { fprintf(stderr, "failed to create pipe\n"); return NULL; } s->rfd = fds[0]; s->wfd = fds[1]; fcntl(s->rfd, F_SETFL, O_NONBLOCK); fcntl(s->wfd, F_SETFL, O_NONBLOCK); qemu_aio_set_fd_handler(s->rfd, posix_aio_read, NULL, posix_aio_flush, s); ret = pthread_attr_init(&attr); if (ret) die2(ret, "pthread_attr_init"); ret = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); if (ret) die2(ret, "pthread_attr_setdetachstate"); TAILQ_INIT(&request_list); posix_aio_state = s; return posix_aio_state; }
false
qemu
72cf2d4f0e181d0d3a3122e04129c58a95da713e
void *paio_init(void) { struct sigaction act; PosixAioState *s; int fds[2]; int ret; if (posix_aio_state) return posix_aio_state; s = qemu_malloc(sizeof(PosixAioState)); sigfillset(&act.sa_mask); act.sa_flags = 0; act.sa_handler = aio_signal_handler; sigaction(SIGUSR2, &act, NULL); s->first_aio = NULL; if (pipe(fds) == -1) { fprintf(stderr, "failed to create pipe\n"); return NULL; } s->rfd = fds[0]; s->wfd = fds[1]; fcntl(s->rfd, F_SETFL, O_NONBLOCK); fcntl(s->wfd, F_SETFL, O_NONBLOCK); qemu_aio_set_fd_handler(s->rfd, posix_aio_read, NULL, posix_aio_flush, s); ret = pthread_attr_init(&attr); if (ret) die2(ret, "pthread_attr_init"); ret = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); if (ret) die2(ret, "pthread_attr_setdetachstate"); TAILQ_INIT(&request_list); posix_aio_state = s; return posix_aio_state; }
{ "code": [], "line_no": [] }
void *FUNC_0(void) { struct sigaction VAR_0; PosixAioState *s; int VAR_1[2]; int VAR_2; if (posix_aio_state) return posix_aio_state; s = qemu_malloc(sizeof(PosixAioState)); sigfillset(&VAR_0.sa_mask); VAR_0.sa_flags = 0; VAR_0.sa_handler = aio_signal_handler; sigaction(SIGUSR2, &VAR_0, NULL); s->first_aio = NULL; if (pipe(VAR_1) == -1) { fprintf(stderr, "failed to create pipe\n"); return NULL; } s->rfd = VAR_1[0]; s->wfd = VAR_1[1]; fcntl(s->rfd, F_SETFL, O_NONBLOCK); fcntl(s->wfd, F_SETFL, O_NONBLOCK); qemu_aio_set_fd_handler(s->rfd, posix_aio_read, NULL, posix_aio_flush, s); VAR_2 = pthread_attr_init(&attr); if (VAR_2) die2(VAR_2, "pthread_attr_init"); VAR_2 = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); if (VAR_2) die2(VAR_2, "pthread_attr_setdetachstate"); TAILQ_INIT(&request_list); posix_aio_state = s; return posix_aio_state; }
[ "void *FUNC_0(void)\n{", "struct sigaction VAR_0;", "PosixAioState *s;", "int VAR_1[2];", "int VAR_2;", "if (posix_aio_state)\nreturn posix_aio_state;", "s = qemu_malloc(sizeof(PosixAioState));", "sigfillset(&VAR_0.sa_mask);", "VAR_0.sa_flags = 0;", "VAR_0.sa_handler = aio_signal_handler;", "sigaction(SIGUSR2, &VAR_0, NULL);", "s->first_aio = NULL;", "if (pipe(VAR_1) == -1) {", "fprintf(stderr, \"failed to create pipe\\n\");", "return NULL;", "}", "s->rfd = VAR_1[0];", "s->wfd = VAR_1[1];", "fcntl(s->rfd, F_SETFL, O_NONBLOCK);", "fcntl(s->wfd, F_SETFL, O_NONBLOCK);", "qemu_aio_set_fd_handler(s->rfd, posix_aio_read, NULL, posix_aio_flush, s);", "VAR_2 = pthread_attr_init(&attr);", "if (VAR_2)\ndie2(VAR_2, \"pthread_attr_init\");", "VAR_2 = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);", "if (VAR_2)\ndie2(VAR_2, \"pthread_attr_setdetachstate\");", "TAILQ_INIT(&request_list);", "posix_aio_state = s;", "return posix_aio_state;", "}" ]
[ 0, 0, 0, 0, 0, 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 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 59 ], [ 63 ], [ 65, 67 ], [ 71 ], [ 73, 75 ], [ 79 ], [ 83 ], [ 87 ], [ 89 ] ]
7,390
static void close_slaves(AVFormatContext *avf) { TeeContext *tee = avf->priv_data; AVFormatContext *avf2; unsigned i, j; for (i = 0; i < tee->nb_slaves; i++) { avf2 = tee->slaves[i].avf; for (j = 0; j < avf2->nb_streams; j++) { AVBitStreamFilterContext *bsf_next, *bsf = tee->slaves[i].bsfs[j]; while (bsf) { bsf_next = bsf->next; av_bitstream_filter_close(bsf); bsf = bsf_next; } } av_freep(&tee->slaves[i].stream_map); avio_close(avf2->pb); avf2->pb = NULL; avformat_free_context(avf2); tee->slaves[i].avf = NULL; } }
true
FFmpeg
c4e6024adc18df8ff82157227e2b4159f77951f9
static void close_slaves(AVFormatContext *avf) { TeeContext *tee = avf->priv_data; AVFormatContext *avf2; unsigned i, j; for (i = 0; i < tee->nb_slaves; i++) { avf2 = tee->slaves[i].avf; for (j = 0; j < avf2->nb_streams; j++) { AVBitStreamFilterContext *bsf_next, *bsf = tee->slaves[i].bsfs[j]; while (bsf) { bsf_next = bsf->next; av_bitstream_filter_close(bsf); bsf = bsf_next; } } av_freep(&tee->slaves[i].stream_map); avio_close(avf2->pb); avf2->pb = NULL; avformat_free_context(avf2); tee->slaves[i].avf = NULL; } }
{ "code": [], "line_no": [] }
static void FUNC_0(AVFormatContext *VAR_0) { TeeContext *tee = VAR_0->priv_data; AVFormatContext *avf2; unsigned VAR_1, VAR_2; for (VAR_1 = 0; VAR_1 < tee->nb_slaves; VAR_1++) { avf2 = tee->slaves[VAR_1].VAR_0; for (VAR_2 = 0; VAR_2 < avf2->nb_streams; VAR_2++) { AVBitStreamFilterContext *bsf_next, *bsf = tee->slaves[VAR_1].bsfs[VAR_2]; while (bsf) { bsf_next = bsf->next; av_bitstream_filter_close(bsf); bsf = bsf_next; } } av_freep(&tee->slaves[VAR_1].stream_map); avio_close(avf2->pb); avf2->pb = NULL; avformat_free_context(avf2); tee->slaves[VAR_1].VAR_0 = NULL; } }
[ "static void FUNC_0(AVFormatContext *VAR_0)\n{", "TeeContext *tee = VAR_0->priv_data;", "AVFormatContext *avf2;", "unsigned VAR_1, VAR_2;", "for (VAR_1 = 0; VAR_1 < tee->nb_slaves; VAR_1++) {", "avf2 = tee->slaves[VAR_1].VAR_0;", "for (VAR_2 = 0; VAR_2 < avf2->nb_streams; VAR_2++) {", "AVBitStreamFilterContext *bsf_next, *bsf = tee->slaves[VAR_1].bsfs[VAR_2];", "while (bsf) {", "bsf_next = bsf->next;", "av_bitstream_filter_close(bsf);", "bsf = bsf_next;", "}", "}", "av_freep(&tee->slaves[VAR_1].stream_map);", "avio_close(avf2->pb);", "avf2->pb = NULL;", "avformat_free_context(avf2);", "tee->slaves[VAR_1].VAR_0 = NULL;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 40 ], [ 42 ], [ 44 ], [ 46 ], [ 48 ], [ 50 ] ]
7,391
static int update_context_from_thread(AVCodecContext *dst, AVCodecContext *src, int for_user) { int err = 0; if (dst != src) { dst->sub_id = src->sub_id; dst->time_base = src->time_base; dst->width = src->width; dst->height = src->height; dst->pix_fmt = src->pix_fmt; dst->coded_width = src->coded_width; dst->coded_height = src->coded_height; dst->has_b_frames = src->has_b_frames; dst->idct_algo = src->idct_algo; dst->slice_count = src->slice_count; dst->bits_per_coded_sample = src->bits_per_coded_sample; dst->sample_aspect_ratio = src->sample_aspect_ratio; dst->dtg_active_format = src->dtg_active_format; dst->profile = src->profile; dst->level = src->level; dst->bits_per_raw_sample = src->bits_per_raw_sample; dst->ticks_per_frame = src->ticks_per_frame; dst->color_primaries = src->color_primaries; dst->color_trc = src->color_trc; dst->colorspace = src->colorspace; dst->color_range = src->color_range; dst->chroma_sample_location = src->chroma_sample_location; } if (for_user) { dst->coded_frame = src->coded_frame; dst->has_b_frames += src->thread_count - 1; } else { if (dst->codec->update_thread_context) err = dst->codec->update_thread_context(dst, src); } return err; }
true
FFmpeg
26ae9a5d7c448a3eb42641b546ee8d585ab716e6
static int update_context_from_thread(AVCodecContext *dst, AVCodecContext *src, int for_user) { int err = 0; if (dst != src) { dst->sub_id = src->sub_id; dst->time_base = src->time_base; dst->width = src->width; dst->height = src->height; dst->pix_fmt = src->pix_fmt; dst->coded_width = src->coded_width; dst->coded_height = src->coded_height; dst->has_b_frames = src->has_b_frames; dst->idct_algo = src->idct_algo; dst->slice_count = src->slice_count; dst->bits_per_coded_sample = src->bits_per_coded_sample; dst->sample_aspect_ratio = src->sample_aspect_ratio; dst->dtg_active_format = src->dtg_active_format; dst->profile = src->profile; dst->level = src->level; dst->bits_per_raw_sample = src->bits_per_raw_sample; dst->ticks_per_frame = src->ticks_per_frame; dst->color_primaries = src->color_primaries; dst->color_trc = src->color_trc; dst->colorspace = src->colorspace; dst->color_range = src->color_range; dst->chroma_sample_location = src->chroma_sample_location; } if (for_user) { dst->coded_frame = src->coded_frame; dst->has_b_frames += src->thread_count - 1; } else { if (dst->codec->update_thread_context) err = dst->codec->update_thread_context(dst, src); } return err; }
{ "code": [ " dst->has_b_frames += src->thread_count - 1;" ], "line_no": [ 75 ] }
static int FUNC_0(AVCodecContext *VAR_0, AVCodecContext *VAR_1, int VAR_2) { int VAR_3 = 0; if (VAR_0 != VAR_1) { VAR_0->sub_id = VAR_1->sub_id; VAR_0->time_base = VAR_1->time_base; VAR_0->width = VAR_1->width; VAR_0->height = VAR_1->height; VAR_0->pix_fmt = VAR_1->pix_fmt; VAR_0->coded_width = VAR_1->coded_width; VAR_0->coded_height = VAR_1->coded_height; VAR_0->has_b_frames = VAR_1->has_b_frames; VAR_0->idct_algo = VAR_1->idct_algo; VAR_0->slice_count = VAR_1->slice_count; VAR_0->bits_per_coded_sample = VAR_1->bits_per_coded_sample; VAR_0->sample_aspect_ratio = VAR_1->sample_aspect_ratio; VAR_0->dtg_active_format = VAR_1->dtg_active_format; VAR_0->profile = VAR_1->profile; VAR_0->level = VAR_1->level; VAR_0->bits_per_raw_sample = VAR_1->bits_per_raw_sample; VAR_0->ticks_per_frame = VAR_1->ticks_per_frame; VAR_0->color_primaries = VAR_1->color_primaries; VAR_0->color_trc = VAR_1->color_trc; VAR_0->colorspace = VAR_1->colorspace; VAR_0->color_range = VAR_1->color_range; VAR_0->chroma_sample_location = VAR_1->chroma_sample_location; } if (VAR_2) { VAR_0->coded_frame = VAR_1->coded_frame; VAR_0->has_b_frames += VAR_1->thread_count - 1; } else { if (VAR_0->codec->update_thread_context) VAR_3 = VAR_0->codec->update_thread_context(VAR_0, VAR_1); } return VAR_3; }
[ "static int FUNC_0(AVCodecContext *VAR_0, AVCodecContext *VAR_1, int VAR_2)\n{", "int VAR_3 = 0;", "if (VAR_0 != VAR_1) {", "VAR_0->sub_id = VAR_1->sub_id;", "VAR_0->time_base = VAR_1->time_base;", "VAR_0->width = VAR_1->width;", "VAR_0->height = VAR_1->height;", "VAR_0->pix_fmt = VAR_1->pix_fmt;", "VAR_0->coded_width = VAR_1->coded_width;", "VAR_0->coded_height = VAR_1->coded_height;", "VAR_0->has_b_frames = VAR_1->has_b_frames;", "VAR_0->idct_algo = VAR_1->idct_algo;", "VAR_0->slice_count = VAR_1->slice_count;", "VAR_0->bits_per_coded_sample = VAR_1->bits_per_coded_sample;", "VAR_0->sample_aspect_ratio = VAR_1->sample_aspect_ratio;", "VAR_0->dtg_active_format = VAR_1->dtg_active_format;", "VAR_0->profile = VAR_1->profile;", "VAR_0->level = VAR_1->level;", "VAR_0->bits_per_raw_sample = VAR_1->bits_per_raw_sample;", "VAR_0->ticks_per_frame = VAR_1->ticks_per_frame;", "VAR_0->color_primaries = VAR_1->color_primaries;", "VAR_0->color_trc = VAR_1->color_trc;", "VAR_0->colorspace = VAR_1->colorspace;", "VAR_0->color_range = VAR_1->color_range;", "VAR_0->chroma_sample_location = VAR_1->chroma_sample_location;", "}", "if (VAR_2) {", "VAR_0->coded_frame = VAR_1->coded_frame;", "VAR_0->has_b_frames += VAR_1->thread_count - 1;", "} else {", "if (VAR_0->codec->update_thread_context)\nVAR_3 = VAR_0->codec->update_thread_context(VAR_0, VAR_1);", "}", "return VAR_3;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79, 81 ], [ 83 ], [ 87 ], [ 89 ] ]
7,392
static int v4l2_set_parameters(AVFormatContext *s1) { struct video_data *s = s1->priv_data; struct v4l2_standard standard = { 0 }; struct v4l2_streamparm streamparm = { 0 }; struct v4l2_fract *tpf; AVRational framerate_q = { 0 }; int i, ret; if (s->framerate && (ret = av_parse_video_rate(&framerate_q, s->framerate)) < 0) { av_log(s1, AV_LOG_ERROR, "Could not parse framerate '%s'.\n", s->framerate); return ret; } if (s->standard) { if (s->std_id) { ret = 0; av_log(s1, AV_LOG_DEBUG, "Setting standard: %s\n", s->standard); /* set tv standard */ for (i = 0; ; i++) { standard.index = i; if (v4l2_ioctl(s->fd, VIDIOC_ENUMSTD, &standard) < 0) { ret = AVERROR(errno); break; } if (!av_strcasecmp(standard.name, s->standard)) break; } if (ret < 0) { av_log(s1, AV_LOG_ERROR, "Unknown or unsupported standard '%s'\n", s->standard); return ret; } if (v4l2_ioctl(s->fd, VIDIOC_S_STD, &standard.id) < 0) { ret = AVERROR(errno); av_log(s1, AV_LOG_ERROR, "ioctl(VIDIOC_S_STD): %s\n", av_err2str(ret)); return ret; } } else { av_log(s1, AV_LOG_WARNING, "This device does not support any standard\n"); } } /* get standard */ if (v4l2_ioctl(s->fd, VIDIOC_G_STD, &s->std_id) == 0) { tpf = &standard.frameperiod; for (i = 0; ; i++) { standard.index = i; if (v4l2_ioctl(s->fd, VIDIOC_ENUMSTD, &standard) < 0) { ret = AVERROR(errno); if (ret == AVERROR(EINVAL)) { tpf = &streamparm.parm.capture.timeperframe; break; } av_log(s1, AV_LOG_ERROR, "ioctl(VIDIOC_ENUMSTD): %s\n", av_err2str(ret)); return ret; } if (standard.id == s->std_id) { av_log(s1, AV_LOG_DEBUG, "Current standard: %s, id: %"PRIx64", frameperiod: %d/%d\n", standard.name, (uint64_t)standard.id, tpf->numerator, tpf->denominator); break; } } } else { tpf = &streamparm.parm.capture.timeperframe; } streamparm.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; if (v4l2_ioctl(s->fd, VIDIOC_G_PARM, &streamparm) < 0) { ret = AVERROR(errno); av_log(s1, AV_LOG_ERROR, "ioctl(VIDIOC_G_PARM): %s\n", av_err2str(ret)); return ret; } if (framerate_q.num && framerate_q.den) { if (streamparm.parm.capture.capability & V4L2_CAP_TIMEPERFRAME) { tpf = &streamparm.parm.capture.timeperframe; av_log(s1, AV_LOG_DEBUG, "Setting time per frame to %d/%d\n", framerate_q.den, framerate_q.num); tpf->numerator = framerate_q.den; tpf->denominator = framerate_q.num; if (v4l2_ioctl(s->fd, VIDIOC_S_PARM, &streamparm) < 0) { ret = AVERROR(errno); av_log(s1, AV_LOG_ERROR, "ioctl(VIDIOC_S_PARM): %s\n", av_err2str(ret)); return ret; } if (framerate_q.num != tpf->denominator || framerate_q.den != tpf->numerator) { av_log(s1, AV_LOG_INFO, "The driver changed the time per frame from " "%d/%d to %d/%d\n", framerate_q.den, framerate_q.num, tpf->numerator, tpf->denominator); } } else { av_log(s1, AV_LOG_WARNING, "The driver does not allow to change time per frame\n"); } } if (tpf->denominator > 0 && tpf->numerator > 0) { s1->streams[0]->avg_frame_rate.num = tpf->denominator; s1->streams[0]->avg_frame_rate.den = tpf->numerator; s1->streams[0]->r_frame_rate = s1->streams[0]->avg_frame_rate; } else av_log(s1, AV_LOG_WARNING, "Time per frame unknown\n"); return 0; }
true
FFmpeg
44e95a017c8fa0c3d019cc91c716ba876f931fe7
static int v4l2_set_parameters(AVFormatContext *s1) { struct video_data *s = s1->priv_data; struct v4l2_standard standard = { 0 }; struct v4l2_streamparm streamparm = { 0 }; struct v4l2_fract *tpf; AVRational framerate_q = { 0 }; int i, ret; if (s->framerate && (ret = av_parse_video_rate(&framerate_q, s->framerate)) < 0) { av_log(s1, AV_LOG_ERROR, "Could not parse framerate '%s'.\n", s->framerate); return ret; } if (s->standard) { if (s->std_id) { ret = 0; av_log(s1, AV_LOG_DEBUG, "Setting standard: %s\n", s->standard); for (i = 0; ; i++) { standard.index = i; if (v4l2_ioctl(s->fd, VIDIOC_ENUMSTD, &standard) < 0) { ret = AVERROR(errno); break; } if (!av_strcasecmp(standard.name, s->standard)) break; } if (ret < 0) { av_log(s1, AV_LOG_ERROR, "Unknown or unsupported standard '%s'\n", s->standard); return ret; } if (v4l2_ioctl(s->fd, VIDIOC_S_STD, &standard.id) < 0) { ret = AVERROR(errno); av_log(s1, AV_LOG_ERROR, "ioctl(VIDIOC_S_STD): %s\n", av_err2str(ret)); return ret; } } else { av_log(s1, AV_LOG_WARNING, "This device does not support any standard\n"); } } if (v4l2_ioctl(s->fd, VIDIOC_G_STD, &s->std_id) == 0) { tpf = &standard.frameperiod; for (i = 0; ; i++) { standard.index = i; if (v4l2_ioctl(s->fd, VIDIOC_ENUMSTD, &standard) < 0) { ret = AVERROR(errno); if (ret == AVERROR(EINVAL)) { tpf = &streamparm.parm.capture.timeperframe; break; } av_log(s1, AV_LOG_ERROR, "ioctl(VIDIOC_ENUMSTD): %s\n", av_err2str(ret)); return ret; } if (standard.id == s->std_id) { av_log(s1, AV_LOG_DEBUG, "Current standard: %s, id: %"PRIx64", frameperiod: %d/%d\n", standard.name, (uint64_t)standard.id, tpf->numerator, tpf->denominator); break; } } } else { tpf = &streamparm.parm.capture.timeperframe; } streamparm.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; if (v4l2_ioctl(s->fd, VIDIOC_G_PARM, &streamparm) < 0) { ret = AVERROR(errno); av_log(s1, AV_LOG_ERROR, "ioctl(VIDIOC_G_PARM): %s\n", av_err2str(ret)); return ret; } if (framerate_q.num && framerate_q.den) { if (streamparm.parm.capture.capability & V4L2_CAP_TIMEPERFRAME) { tpf = &streamparm.parm.capture.timeperframe; av_log(s1, AV_LOG_DEBUG, "Setting time per frame to %d/%d\n", framerate_q.den, framerate_q.num); tpf->numerator = framerate_q.den; tpf->denominator = framerate_q.num; if (v4l2_ioctl(s->fd, VIDIOC_S_PARM, &streamparm) < 0) { ret = AVERROR(errno); av_log(s1, AV_LOG_ERROR, "ioctl(VIDIOC_S_PARM): %s\n", av_err2str(ret)); return ret; } if (framerate_q.num != tpf->denominator || framerate_q.den != tpf->numerator) { av_log(s1, AV_LOG_INFO, "The driver changed the time per frame from " "%d/%d to %d/%d\n", framerate_q.den, framerate_q.num, tpf->numerator, tpf->denominator); } } else { av_log(s1, AV_LOG_WARNING, "The driver does not allow to change time per frame\n"); } } if (tpf->denominator > 0 && tpf->numerator > 0) { s1->streams[0]->avg_frame_rate.num = tpf->denominator; s1->streams[0]->avg_frame_rate.den = tpf->numerator; s1->streams[0]->r_frame_rate = s1->streams[0]->avg_frame_rate; } else av_log(s1, AV_LOG_WARNING, "Time per frame unknown\n"); return 0; }
{ "code": [ " if (ret == AVERROR(EINVAL)) {" ], "line_no": [ 107 ] }
static int FUNC_0(AVFormatContext *VAR_0) { struct video_data *VAR_1 = VAR_0->priv_data; struct v4l2_standard VAR_2 = { 0 }; struct v4l2_streamparm VAR_3 = { 0 }; struct v4l2_fract *VAR_4; AVRational framerate_q = { 0 }; int VAR_5, VAR_6; if (VAR_1->framerate && (VAR_6 = av_parse_video_rate(&framerate_q, VAR_1->framerate)) < 0) { av_log(VAR_0, AV_LOG_ERROR, "Could not parse framerate '%VAR_1'.\n", VAR_1->framerate); return VAR_6; } if (VAR_1->VAR_2) { if (VAR_1->std_id) { VAR_6 = 0; av_log(VAR_0, AV_LOG_DEBUG, "Setting VAR_2: %VAR_1\n", VAR_1->VAR_2); for (VAR_5 = 0; ; VAR_5++) { VAR_2.index = VAR_5; if (v4l2_ioctl(VAR_1->fd, VIDIOC_ENUMSTD, &VAR_2) < 0) { VAR_6 = AVERROR(errno); break; } if (!av_strcasecmp(VAR_2.name, VAR_1->VAR_2)) break; } if (VAR_6 < 0) { av_log(VAR_0, AV_LOG_ERROR, "Unknown or unsupported VAR_2 '%VAR_1'\n", VAR_1->VAR_2); return VAR_6; } if (v4l2_ioctl(VAR_1->fd, VIDIOC_S_STD, &VAR_2.id) < 0) { VAR_6 = AVERROR(errno); av_log(VAR_0, AV_LOG_ERROR, "ioctl(VIDIOC_S_STD): %VAR_1\n", av_err2str(VAR_6)); return VAR_6; } } else { av_log(VAR_0, AV_LOG_WARNING, "This device does not support any VAR_2\n"); } } if (v4l2_ioctl(VAR_1->fd, VIDIOC_G_STD, &VAR_1->std_id) == 0) { VAR_4 = &VAR_2.frameperiod; for (VAR_5 = 0; ; VAR_5++) { VAR_2.index = VAR_5; if (v4l2_ioctl(VAR_1->fd, VIDIOC_ENUMSTD, &VAR_2) < 0) { VAR_6 = AVERROR(errno); if (VAR_6 == AVERROR(EINVAL)) { VAR_4 = &VAR_3.parm.capture.timeperframe; break; } av_log(VAR_0, AV_LOG_ERROR, "ioctl(VIDIOC_ENUMSTD): %VAR_1\n", av_err2str(VAR_6)); return VAR_6; } if (VAR_2.id == VAR_1->std_id) { av_log(VAR_0, AV_LOG_DEBUG, "Current VAR_2: %VAR_1, id: %"PRIx64", frameperiod: %d/%d\n", VAR_2.name, (uint64_t)VAR_2.id, VAR_4->numerator, VAR_4->denominator); break; } } } else { VAR_4 = &VAR_3.parm.capture.timeperframe; } VAR_3.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; if (v4l2_ioctl(VAR_1->fd, VIDIOC_G_PARM, &VAR_3) < 0) { VAR_6 = AVERROR(errno); av_log(VAR_0, AV_LOG_ERROR, "ioctl(VIDIOC_G_PARM): %VAR_1\n", av_err2str(VAR_6)); return VAR_6; } if (framerate_q.num && framerate_q.den) { if (VAR_3.parm.capture.capability & V4L2_CAP_TIMEPERFRAME) { VAR_4 = &VAR_3.parm.capture.timeperframe; av_log(VAR_0, AV_LOG_DEBUG, "Setting time per frame to %d/%d\n", framerate_q.den, framerate_q.num); VAR_4->numerator = framerate_q.den; VAR_4->denominator = framerate_q.num; if (v4l2_ioctl(VAR_1->fd, VIDIOC_S_PARM, &VAR_3) < 0) { VAR_6 = AVERROR(errno); av_log(VAR_0, AV_LOG_ERROR, "ioctl(VIDIOC_S_PARM): %VAR_1\n", av_err2str(VAR_6)); return VAR_6; } if (framerate_q.num != VAR_4->denominator || framerate_q.den != VAR_4->numerator) { av_log(VAR_0, AV_LOG_INFO, "The driver changed the time per frame from " "%d/%d to %d/%d\n", framerate_q.den, framerate_q.num, VAR_4->numerator, VAR_4->denominator); } } else { av_log(VAR_0, AV_LOG_WARNING, "The driver does not allow to change time per frame\n"); } } if (VAR_4->denominator > 0 && VAR_4->numerator > 0) { VAR_0->streams[0]->avg_frame_rate.num = VAR_4->denominator; VAR_0->streams[0]->avg_frame_rate.den = VAR_4->numerator; VAR_0->streams[0]->r_frame_rate = VAR_0->streams[0]->avg_frame_rate; } else av_log(VAR_0, AV_LOG_WARNING, "Time per frame unknown\n"); return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0)\n{", "struct video_data *VAR_1 = VAR_0->priv_data;", "struct v4l2_standard VAR_2 = { 0 };", "struct v4l2_streamparm VAR_3 = { 0 };", "struct v4l2_fract *VAR_4;", "AVRational framerate_q = { 0 };", "int VAR_5, VAR_6;", "if (VAR_1->framerate &&\n(VAR_6 = av_parse_video_rate(&framerate_q, VAR_1->framerate)) < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"Could not parse framerate '%VAR_1'.\\n\",\nVAR_1->framerate);", "return VAR_6;", "}", "if (VAR_1->VAR_2) {", "if (VAR_1->std_id) {", "VAR_6 = 0;", "av_log(VAR_0, AV_LOG_DEBUG, \"Setting VAR_2: %VAR_1\\n\", VAR_1->VAR_2);", "for (VAR_5 = 0; ; VAR_5++) {", "VAR_2.index = VAR_5;", "if (v4l2_ioctl(VAR_1->fd, VIDIOC_ENUMSTD, &VAR_2) < 0) {", "VAR_6 = AVERROR(errno);", "break;", "}", "if (!av_strcasecmp(VAR_2.name, VAR_1->VAR_2))\nbreak;", "}", "if (VAR_6 < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"Unknown or unsupported VAR_2 '%VAR_1'\\n\", VAR_1->VAR_2);", "return VAR_6;", "}", "if (v4l2_ioctl(VAR_1->fd, VIDIOC_S_STD, &VAR_2.id) < 0) {", "VAR_6 = AVERROR(errno);", "av_log(VAR_0, AV_LOG_ERROR, \"ioctl(VIDIOC_S_STD): %VAR_1\\n\", av_err2str(VAR_6));", "return VAR_6;", "}", "} else {", "av_log(VAR_0, AV_LOG_WARNING,\n\"This device does not support any VAR_2\\n\");", "}", "}", "if (v4l2_ioctl(VAR_1->fd, VIDIOC_G_STD, &VAR_1->std_id) == 0) {", "VAR_4 = &VAR_2.frameperiod;", "for (VAR_5 = 0; ; VAR_5++) {", "VAR_2.index = VAR_5;", "if (v4l2_ioctl(VAR_1->fd, VIDIOC_ENUMSTD, &VAR_2) < 0) {", "VAR_6 = AVERROR(errno);", "if (VAR_6 == AVERROR(EINVAL)) {", "VAR_4 = &VAR_3.parm.capture.timeperframe;", "break;", "}", "av_log(VAR_0, AV_LOG_ERROR, \"ioctl(VIDIOC_ENUMSTD): %VAR_1\\n\", av_err2str(VAR_6));", "return VAR_6;", "}", "if (VAR_2.id == VAR_1->std_id) {", "av_log(VAR_0, AV_LOG_DEBUG,\n\"Current VAR_2: %VAR_1, id: %\"PRIx64\", frameperiod: %d/%d\\n\",\nVAR_2.name, (uint64_t)VAR_2.id, VAR_4->numerator, VAR_4->denominator);", "break;", "}", "}", "} else {", "VAR_4 = &VAR_3.parm.capture.timeperframe;", "}", "VAR_3.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;", "if (v4l2_ioctl(VAR_1->fd, VIDIOC_G_PARM, &VAR_3) < 0) {", "VAR_6 = AVERROR(errno);", "av_log(VAR_0, AV_LOG_ERROR, \"ioctl(VIDIOC_G_PARM): %VAR_1\\n\", av_err2str(VAR_6));", "return VAR_6;", "}", "if (framerate_q.num && framerate_q.den) {", "if (VAR_3.parm.capture.capability & V4L2_CAP_TIMEPERFRAME) {", "VAR_4 = &VAR_3.parm.capture.timeperframe;", "av_log(VAR_0, AV_LOG_DEBUG, \"Setting time per frame to %d/%d\\n\",\nframerate_q.den, framerate_q.num);", "VAR_4->numerator = framerate_q.den;", "VAR_4->denominator = framerate_q.num;", "if (v4l2_ioctl(VAR_1->fd, VIDIOC_S_PARM, &VAR_3) < 0) {", "VAR_6 = AVERROR(errno);", "av_log(VAR_0, AV_LOG_ERROR, \"ioctl(VIDIOC_S_PARM): %VAR_1\\n\", av_err2str(VAR_6));", "return VAR_6;", "}", "if (framerate_q.num != VAR_4->denominator ||\nframerate_q.den != VAR_4->numerator) {", "av_log(VAR_0, AV_LOG_INFO,\n\"The driver changed the time per frame from \"\n\"%d/%d to %d/%d\\n\",\nframerate_q.den, framerate_q.num,\nVAR_4->numerator, VAR_4->denominator);", "}", "} else {", "av_log(VAR_0, AV_LOG_WARNING,\n\"The driver does not allow to change time per frame\\n\");", "}", "}", "if (VAR_4->denominator > 0 && VAR_4->numerator > 0) {", "VAR_0->streams[0]->avg_frame_rate.num = VAR_4->denominator;", "VAR_0->streams[0]->avg_frame_rate.den = VAR_4->numerator;", "VAR_0->streams[0]->r_frame_rate = VAR_0->streams[0]->avg_frame_rate;", "} else", "av_log(VAR_0, AV_LOG_WARNING, \"Time per frame unknown\\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, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19, 21 ], [ 23, 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55, 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83, 85 ], [ 87 ], [ 89 ], [ 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 ], [ 157 ], [ 159 ], [ 161 ], [ 165, 167 ], [ 169 ], [ 171 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 187, 189 ], [ 191, 193, 195, 197, 199 ], [ 201 ], [ 203 ], [ 205, 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 227 ], [ 229 ] ]
7,395
static target_long monitor_get_tbu (const struct MonitorDef *md, int val) { CPUState *env = mon_get_cpu(); if (!env) return 0; return cpu_ppc_load_tbu(env); }
true
qemu
09b9418c6d085a0728372aa760ebd10128a020b1
static target_long monitor_get_tbu (const struct MonitorDef *md, int val) { CPUState *env = mon_get_cpu(); if (!env) return 0; return cpu_ppc_load_tbu(env); }
{ "code": [ " if (!env)", " if (!env)", " if (!env)", " if (!env)", " if (!env)", " return 0;", " if (!env)", " return 0;", " if (!env)", " return 0;", " if (!env)", " return 0;", " if (!env)", " return 0;", " if (!env)", " return 0;", " if (!env)", " return 0;", " if (!env)", " return 0;", " if (!env)", " return 0;" ], "line_no": [ 7, 7, 7, 7, 7, 9, 7, 9, 7, 9, 7, 9, 7, 9, 7, 9, 7, 9, 7, 9, 7, 9 ] }
static target_long FUNC_0 (const struct MonitorDef *md, int val) { CPUState *env = mon_get_cpu(); if (!env) return 0; return cpu_ppc_load_tbu(env); }
[ "static target_long FUNC_0 (const struct MonitorDef *md, int val)\n{", "CPUState *env = mon_get_cpu();", "if (!env)\nreturn 0;", "return cpu_ppc_load_tbu(env);", "}" ]
[ 0, 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 11 ], [ 13 ] ]
7,396
static void decorrelation(PSContext *ps, INTFLOAT (*out)[32][2], const INTFLOAT (*s)[32][2], int is34) { LOCAL_ALIGNED_16(INTFLOAT, power, [34], [PS_QMF_TIME_SLOTS]); LOCAL_ALIGNED_16(INTFLOAT, transient_gain, [34], [PS_QMF_TIME_SLOTS]); INTFLOAT *peak_decay_nrg = ps->peak_decay_nrg; INTFLOAT *power_smooth = ps->power_smooth; INTFLOAT *peak_decay_diff_smooth = ps->peak_decay_diff_smooth; INTFLOAT (*delay)[PS_QMF_TIME_SLOTS + PS_MAX_DELAY][2] = ps->delay; INTFLOAT (*ap_delay)[PS_AP_LINKS][PS_QMF_TIME_SLOTS + PS_MAX_AP_DELAY][2] = ps->ap_delay; #if !USE_FIXED const float transient_impact = 1.5f; const float a_smooth = 0.25f; ///< Smoothing coefficient #endif /* USE_FIXED */ const int8_t *k_to_i = is34 ? k_to_i_34 : k_to_i_20; int i, k, m, n; int n0 = 0, nL = 32; const INTFLOAT peak_decay_factor = Q31(0.76592833836465f); memset(power, 0, 34 * sizeof(*power)); if (is34 != ps->is34bands_old) { memset(ps->peak_decay_nrg, 0, sizeof(ps->peak_decay_nrg)); memset(ps->power_smooth, 0, sizeof(ps->power_smooth)); memset(ps->peak_decay_diff_smooth, 0, sizeof(ps->peak_decay_diff_smooth)); memset(ps->delay, 0, sizeof(ps->delay)); memset(ps->ap_delay, 0, sizeof(ps->ap_delay)); } for (k = 0; k < NR_BANDS[is34]; k++) { int i = k_to_i[k]; ps->dsp.add_squares(power[i], s[k], nL - n0); } //Transient detection #if USE_FIXED for (i = 0; i < NR_PAR_BANDS[is34]; i++) { for (n = n0; n < nL; n++) { int decayed_peak; int denom; decayed_peak = (int)(((int64_t)peak_decay_factor * \ peak_decay_nrg[i] + 0x40000000) >> 31); peak_decay_nrg[i] = FFMAX(decayed_peak, power[i][n]); power_smooth[i] += (power[i][n] - power_smooth[i] + 2) >> 2; peak_decay_diff_smooth[i] += (peak_decay_nrg[i] - power[i][n] - \ peak_decay_diff_smooth[i] + 2) >> 2; denom = peak_decay_diff_smooth[i] + (peak_decay_diff_smooth[i] >> 1); if (denom > power_smooth[i]) { int p = power_smooth[i]; while (denom < 0x40000000) { denom <<= 1; p <<= 1; } transient_gain[i][n] = p / (denom >> 16); } else { transient_gain[i][n] = 1 << 16; } } } #else for (i = 0; i < NR_PAR_BANDS[is34]; i++) { for (n = n0; n < nL; n++) { float decayed_peak = peak_decay_factor * peak_decay_nrg[i]; float denom; peak_decay_nrg[i] = FFMAX(decayed_peak, power[i][n]); power_smooth[i] += a_smooth * (power[i][n] - power_smooth[i]); peak_decay_diff_smooth[i] += a_smooth * (peak_decay_nrg[i] - power[i][n] - peak_decay_diff_smooth[i]); denom = transient_impact * peak_decay_diff_smooth[i]; transient_gain[i][n] = (denom > power_smooth[i]) ? power_smooth[i] / denom : 1.0f; } } #endif /* USE_FIXED */ //Decorrelation and transient reduction // PS_AP_LINKS - 1 // ----- // | | Q_fract_allpass[k][m]*z^-link_delay[m] - a[m]*g_decay_slope[k] //H[k][z] = z^-2 * phi_fract[k] * | | ---------------------------------------------------------------- // | | 1 - a[m]*g_decay_slope[k]*Q_fract_allpass[k][m]*z^-link_delay[m] // m = 0 //d[k][z] (out) = transient_gain_mapped[k][z] * H[k][z] * s[k][z] for (k = 0; k < NR_ALLPASS_BANDS[is34]; k++) { int b = k_to_i[k]; #if USE_FIXED int g_decay_slope; if (k - DECAY_CUTOFF[is34] <= 0) { g_decay_slope = 1 << 30; } else if (k - DECAY_CUTOFF[is34] >= 20) { g_decay_slope = 0; } else { g_decay_slope = (1 << 30) - DECAY_SLOPE * (k - DECAY_CUTOFF[is34]); } #else float g_decay_slope = 1.f - DECAY_SLOPE * (k - DECAY_CUTOFF[is34]); g_decay_slope = av_clipf(g_decay_slope, 0.f, 1.f); #endif /* USE_FIXED */ memcpy(delay[k], delay[k]+nL, PS_MAX_DELAY*sizeof(delay[k][0])); memcpy(delay[k]+PS_MAX_DELAY, s[k], numQMFSlots*sizeof(delay[k][0])); for (m = 0; m < PS_AP_LINKS; m++) { memcpy(ap_delay[k][m], ap_delay[k][m]+numQMFSlots, 5*sizeof(ap_delay[k][m][0])); } ps->dsp.decorrelate(out[k], delay[k] + PS_MAX_DELAY - 2, ap_delay[k], phi_fract[is34][k], (const INTFLOAT (*)[2]) Q_fract_allpass[is34][k], transient_gain[b], g_decay_slope, nL - n0); } for (; k < SHORT_DELAY_BAND[is34]; k++) { int i = k_to_i[k]; memcpy(delay[k], delay[k]+nL, PS_MAX_DELAY*sizeof(delay[k][0])); memcpy(delay[k]+PS_MAX_DELAY, s[k], numQMFSlots*sizeof(delay[k][0])); //H = delay 14 ps->dsp.mul_pair_single(out[k], delay[k] + PS_MAX_DELAY - 14, transient_gain[i], nL - n0); } for (; k < NR_BANDS[is34]; k++) { int i = k_to_i[k]; memcpy(delay[k], delay[k]+nL, PS_MAX_DELAY*sizeof(delay[k][0])); memcpy(delay[k]+PS_MAX_DELAY, s[k], numQMFSlots*sizeof(delay[k][0])); //H = delay 1 ps->dsp.mul_pair_single(out[k], delay[k] + PS_MAX_DELAY - 1, transient_gain[i], nL - n0); } }
true
FFmpeg
80b9e40b6f1e15db9f36c195e7375e65f6b4924f
static void decorrelation(PSContext *ps, INTFLOAT (*out)[32][2], const INTFLOAT (*s)[32][2], int is34) { LOCAL_ALIGNED_16(INTFLOAT, power, [34], [PS_QMF_TIME_SLOTS]); LOCAL_ALIGNED_16(INTFLOAT, transient_gain, [34], [PS_QMF_TIME_SLOTS]); INTFLOAT *peak_decay_nrg = ps->peak_decay_nrg; INTFLOAT *power_smooth = ps->power_smooth; INTFLOAT *peak_decay_diff_smooth = ps->peak_decay_diff_smooth; INTFLOAT (*delay)[PS_QMF_TIME_SLOTS + PS_MAX_DELAY][2] = ps->delay; INTFLOAT (*ap_delay)[PS_AP_LINKS][PS_QMF_TIME_SLOTS + PS_MAX_AP_DELAY][2] = ps->ap_delay; #if !USE_FIXED const float transient_impact = 1.5f; const float a_smooth = 0.25f; #endif const int8_t *k_to_i = is34 ? k_to_i_34 : k_to_i_20; int i, k, m, n; int n0 = 0, nL = 32; const INTFLOAT peak_decay_factor = Q31(0.76592833836465f); memset(power, 0, 34 * sizeof(*power)); if (is34 != ps->is34bands_old) { memset(ps->peak_decay_nrg, 0, sizeof(ps->peak_decay_nrg)); memset(ps->power_smooth, 0, sizeof(ps->power_smooth)); memset(ps->peak_decay_diff_smooth, 0, sizeof(ps->peak_decay_diff_smooth)); memset(ps->delay, 0, sizeof(ps->delay)); memset(ps->ap_delay, 0, sizeof(ps->ap_delay)); } for (k = 0; k < NR_BANDS[is34]; k++) { int i = k_to_i[k]; ps->dsp.add_squares(power[i], s[k], nL - n0); } #if USE_FIXED for (i = 0; i < NR_PAR_BANDS[is34]; i++) { for (n = n0; n < nL; n++) { int decayed_peak; int denom; decayed_peak = (int)(((int64_t)peak_decay_factor * \ peak_decay_nrg[i] + 0x40000000) >> 31); peak_decay_nrg[i] = FFMAX(decayed_peak, power[i][n]); power_smooth[i] += (power[i][n] - power_smooth[i] + 2) >> 2; peak_decay_diff_smooth[i] += (peak_decay_nrg[i] - power[i][n] - \ peak_decay_diff_smooth[i] + 2) >> 2; denom = peak_decay_diff_smooth[i] + (peak_decay_diff_smooth[i] >> 1); if (denom > power_smooth[i]) { int p = power_smooth[i]; while (denom < 0x40000000) { denom <<= 1; p <<= 1; } transient_gain[i][n] = p / (denom >> 16); } else { transient_gain[i][n] = 1 << 16; } } } #else for (i = 0; i < NR_PAR_BANDS[is34]; i++) { for (n = n0; n < nL; n++) { float decayed_peak = peak_decay_factor * peak_decay_nrg[i]; float denom; peak_decay_nrg[i] = FFMAX(decayed_peak, power[i][n]); power_smooth[i] += a_smooth * (power[i][n] - power_smooth[i]); peak_decay_diff_smooth[i] += a_smooth * (peak_decay_nrg[i] - power[i][n] - peak_decay_diff_smooth[i]); denom = transient_impact * peak_decay_diff_smooth[i]; transient_gain[i][n] = (denom > power_smooth[i]) ? power_smooth[i] / denom : 1.0f; } } #endif for (k = 0; k < NR_ALLPASS_BANDS[is34]; k++) { int b = k_to_i[k]; #if USE_FIXED int g_decay_slope; if (k - DECAY_CUTOFF[is34] <= 0) { g_decay_slope = 1 << 30; } else if (k - DECAY_CUTOFF[is34] >= 20) { g_decay_slope = 0; } else { g_decay_slope = (1 << 30) - DECAY_SLOPE * (k - DECAY_CUTOFF[is34]); } #else float g_decay_slope = 1.f - DECAY_SLOPE * (k - DECAY_CUTOFF[is34]); g_decay_slope = av_clipf(g_decay_slope, 0.f, 1.f); #endif memcpy(delay[k], delay[k]+nL, PS_MAX_DELAY*sizeof(delay[k][0])); memcpy(delay[k]+PS_MAX_DELAY, s[k], numQMFSlots*sizeof(delay[k][0])); for (m = 0; m < PS_AP_LINKS; m++) { memcpy(ap_delay[k][m], ap_delay[k][m]+numQMFSlots, 5*sizeof(ap_delay[k][m][0])); } ps->dsp.decorrelate(out[k], delay[k] + PS_MAX_DELAY - 2, ap_delay[k], phi_fract[is34][k], (const INTFLOAT (*)[2]) Q_fract_allpass[is34][k], transient_gain[b], g_decay_slope, nL - n0); } for (; k < SHORT_DELAY_BAND[is34]; k++) { int i = k_to_i[k]; memcpy(delay[k], delay[k]+nL, PS_MAX_DELAY*sizeof(delay[k][0])); memcpy(delay[k]+PS_MAX_DELAY, s[k], numQMFSlots*sizeof(delay[k][0])); ps->dsp.mul_pair_single(out[k], delay[k] + PS_MAX_DELAY - 14, transient_gain[i], nL - n0); } for (; k < NR_BANDS[is34]; k++) { int i = k_to_i[k]; memcpy(delay[k], delay[k]+nL, PS_MAX_DELAY*sizeof(delay[k][0])); memcpy(delay[k]+PS_MAX_DELAY, s[k], numQMFSlots*sizeof(delay[k][0])); ps->dsp.mul_pair_single(out[k], delay[k] + PS_MAX_DELAY - 1, transient_gain[i], nL - n0); } }
{ "code": [ " int denom;", " power_smooth[i] += (power[i][n] - power_smooth[i] + 2) >> 2;", " peak_decay_diff_smooth[i] += (peak_decay_nrg[i] - power[i][n] - \\", " peak_decay_diff_smooth[i] + 2) >> 2;", " denom = peak_decay_diff_smooth[i] + (peak_decay_diff_smooth[i] >> 1);", " if (denom > power_smooth[i]) {", " int p = power_smooth[i];", " while (denom < 0x40000000) {", " denom <<= 1;", " p <<= 1;", " transient_gain[i][n] = p / (denom >> 16);", " else {", " transient_gain[i][n] = 1 << 16;" ], "line_no": [ 77, 87, 89, 91, 93, 95, 97, 99, 101, 103, 107, 111, 113 ] }
VAR_2staticVAR_2 VAR_2voidVAR_2 VAR_2decorrelationVAR_2(VAR_2PSContextVAR_2 *VAR_2VAR_0VAR_2, VAR_2VAR_1VAR_2 (*VAR_2outVAR_2)[VAR_232VAR_2][VAR_22VAR_2], VAR_2constVAR_2 VAR_2VAR_1VAR_2 (*VAR_2sVAR_2)[VAR_232VAR_2][VAR_22VAR_2], VAR_2intVAR_2 VAR_2is34VAR_2) { VAR_2LOCAL_ALIGNED_16VAR_2(VAR_2VAR_1VAR_2, VAR_2powerVAR_2, [VAR_234VAR_2], [VAR_2PS_QMF_TIME_SLOTSVAR_2]); VAR_2LOCAL_ALIGNED_16VAR_2(VAR_2VAR_1VAR_2, VAR_2transient_gainVAR_2, [VAR_234VAR_2], [VAR_2PS_QMF_TIME_SLOTSVAR_2]); VAR_2VAR_1VAR_2 *VAR_2peak_decay_nrgVAR_2 = VAR_2VAR_0VAR_2->VAR_2peak_decay_nrgVAR_2; VAR_2VAR_1VAR_2 *VAR_2power_smoothVAR_2 = VAR_2VAR_0VAR_2->VAR_2power_smoothVAR_2; VAR_2VAR_1VAR_2 *VAR_2peak_decay_diff_smoothVAR_2 = VAR_2VAR_0VAR_2->VAR_2peak_decay_diff_smoothVAR_2; VAR_2VAR_1VAR_2 (*VAR_2delayVAR_2)[VAR_2PS_QMF_TIME_SLOTSVAR_2 + VAR_2PS_MAX_DELAYVAR_2][VAR_22VAR_2] = VAR_2VAR_0VAR_2->VAR_2delayVAR_2; VAR_2VAR_1VAR_2 (*VAR_2ap_delayVAR_2)[VAR_2PS_AP_LINKSVAR_2][VAR_2PS_QMF_TIME_SLOTSVAR_2 + VAR_2PS_MAX_AP_DELAYVAR_2][VAR_22VAR_2] = VAR_2VAR_0VAR_2->VAR_2ap_delayVAR_2; #VAR_2ifVAR_2 !VAR_2USE_FIXEDVAR_2 VAR_2constVAR_2 VAR_2floatVAR_2 VAR_2transient_impactVAR_2 = VAR_21VAR_2.VAR_25fVAR_2; VAR_2constVAR_2 VAR_2floatVAR_2 VAR_2a_smoothVAR_2 = VAR_20VAR_2.VAR_225fVAR_2; #VAR_2endifVAR_2 VAR_2constVAR_2 VAR_2int8_tVAR_2 *VAR_2k_to_iVAR_2 = VAR_2is34VAR_2 ? VAR_2k_to_i_34VAR_2 : VAR_2k_to_i_20VAR_2; VAR_2intVAR_2 VAR_2iVAR_2, VAR_2kVAR_2, VAR_2mVAR_2, VAR_2nVAR_2; VAR_2intVAR_2 VAR_2n0VAR_2 = VAR_20VAR_2, VAR_2nLVAR_2 = VAR_232VAR_2; VAR_2constVAR_2 VAR_2VAR_1VAR_2 VAR_2peak_decay_factorVAR_2 = VAR_2Q31VAR_2(VAR_20VAR_2.VAR_276592833836465fVAR_2); VAR_2memsetVAR_2(VAR_2powerVAR_2, VAR_20VAR_2, VAR_234VAR_2 * VAR_2sizeofVAR_2(*VAR_2powerVAR_2)); VAR_2ifVAR_2 (VAR_2is34VAR_2 != VAR_2VAR_0VAR_2->VAR_2is34bands_oldVAR_2) { VAR_2memsetVAR_2(VAR_2VAR_0VAR_2->VAR_2peak_decay_nrgVAR_2, VAR_20VAR_2, VAR_2sizeofVAR_2(VAR_2VAR_0VAR_2->VAR_2peak_decay_nrgVAR_2)); VAR_2memsetVAR_2(VAR_2VAR_0VAR_2->VAR_2power_smoothVAR_2, VAR_20VAR_2, VAR_2sizeofVAR_2(VAR_2VAR_0VAR_2->VAR_2power_smoothVAR_2)); VAR_2memsetVAR_2(VAR_2VAR_0VAR_2->VAR_2peak_decay_diff_smoothVAR_2, VAR_20VAR_2, VAR_2sizeofVAR_2(VAR_2VAR_0VAR_2->VAR_2peak_decay_diff_smoothVAR_2)); VAR_2memsetVAR_2(VAR_2VAR_0VAR_2->VAR_2delayVAR_2, VAR_20VAR_2, VAR_2sizeofVAR_2(VAR_2VAR_0VAR_2->VAR_2delayVAR_2)); VAR_2memsetVAR_2(VAR_2VAR_0VAR_2->VAR_2ap_delayVAR_2, VAR_20VAR_2, VAR_2sizeofVAR_2(VAR_2VAR_0VAR_2->VAR_2ap_delayVAR_2)); } VAR_2forVAR_2 (VAR_2kVAR_2 = VAR_20VAR_2; VAR_2kVAR_2 < VAR_2NR_BANDSVAR_2[VAR_2is34VAR_2]; VAR_2kVAR_2++) { VAR_2intVAR_2 VAR_2iVAR_2 = VAR_2k_to_iVAR_2[VAR_2kVAR_2]; VAR_2VAR_0VAR_2->VAR_2dspVAR_2.VAR_2add_squaresVAR_2(VAR_2powerVAR_2[VAR_2iVAR_2], VAR_2sVAR_2[VAR_2kVAR_2], VAR_2nLVAR_2 - VAR_2n0VAR_2); } #VAR_2ifVAR_2 VAR_2USE_FIXEDVAR_2 VAR_2forVAR_2 (VAR_2iVAR_2 = VAR_20VAR_2; VAR_2iVAR_2 < VAR_2NR_PAR_BANDSVAR_2[VAR_2is34VAR_2]; VAR_2iVAR_2++) { VAR_2forVAR_2 (VAR_2nVAR_2 = VAR_2n0VAR_2; VAR_2nVAR_2 < VAR_2nLVAR_2; VAR_2nVAR_2++) { VAR_2intVAR_2 VAR_2decayed_peakVAR_2; VAR_2intVAR_2 VAR_2denomVAR_2; VAR_2decayed_peakVAR_2 = (VAR_2intVAR_2)(((VAR_2int64_tVAR_2)VAR_2peak_decay_factorVAR_2 * \ VAR_2peak_decay_nrgVAR_2[VAR_2iVAR_2] + VAR_20x40000000VAR_2) >> VAR_231VAR_2); VAR_2peak_decay_nrgVAR_2[VAR_2iVAR_2] = VAR_2FFMAXVAR_2(VAR_2decayed_peakVAR_2, VAR_2powerVAR_2[VAR_2iVAR_2][VAR_2nVAR_2]); VAR_2power_smoothVAR_2[VAR_2iVAR_2] += (VAR_2powerVAR_2[VAR_2iVAR_2][VAR_2nVAR_2] - VAR_2power_smoothVAR_2[VAR_2iVAR_2] + VAR_22VAR_2) >> VAR_22VAR_2; VAR_2peak_decay_diff_smoothVAR_2[VAR_2iVAR_2] += (VAR_2peak_decay_nrgVAR_2[VAR_2iVAR_2] - VAR_2powerVAR_2[VAR_2iVAR_2][VAR_2nVAR_2] - \ VAR_2peak_decay_diff_smoothVAR_2[VAR_2iVAR_2] + VAR_22VAR_2) >> VAR_22VAR_2; VAR_2denomVAR_2 = VAR_2peak_decay_diff_smoothVAR_2[VAR_2iVAR_2] + (VAR_2peak_decay_diff_smoothVAR_2[VAR_2iVAR_2] >> VAR_21VAR_2); VAR_2ifVAR_2 (VAR_2denomVAR_2 > VAR_2power_smoothVAR_2[VAR_2iVAR_2]) { VAR_2intVAR_2 VAR_2pVAR_2 = VAR_2power_smoothVAR_2[VAR_2iVAR_2]; VAR_2whileVAR_2 (VAR_2denomVAR_2 < VAR_20x40000000VAR_2) { VAR_2denomVAR_2 <<= VAR_21VAR_2; VAR_2pVAR_2 <<= VAR_21VAR_2; } VAR_2transient_gainVAR_2[VAR_2iVAR_2][VAR_2nVAR_2] = VAR_2pVAR_2 / (VAR_2denomVAR_2 >> VAR_216VAR_2); } VAR_2elseVAR_2 { VAR_2transient_gainVAR_2[VAR_2iVAR_2][VAR_2nVAR_2] = VAR_21VAR_2 << VAR_216VAR_2; } } } #VAR_2elseVAR_2 VAR_2forVAR_2 (VAR_2iVAR_2 = VAR_20VAR_2; VAR_2iVAR_2 < VAR_2NR_PAR_BANDSVAR_2[VAR_2is34VAR_2]; VAR_2iVAR_2++) { VAR_2forVAR_2 (VAR_2nVAR_2 = VAR_2n0VAR_2; VAR_2nVAR_2 < VAR_2nLVAR_2; VAR_2nVAR_2++) { VAR_2floatVAR_2 VAR_2decayed_peakVAR_2 = VAR_2peak_decay_factorVAR_2 * VAR_2peak_decay_nrgVAR_2[VAR_2iVAR_2]; VAR_2floatVAR_2 VAR_2denomVAR_2; VAR_2peak_decay_nrgVAR_2[VAR_2iVAR_2] = VAR_2FFMAXVAR_2(VAR_2decayed_peakVAR_2, VAR_2powerVAR_2[VAR_2iVAR_2][VAR_2nVAR_2]); VAR_2power_smoothVAR_2[VAR_2iVAR_2] += VAR_2a_smoothVAR_2 * (VAR_2powerVAR_2[VAR_2iVAR_2][VAR_2nVAR_2] - VAR_2power_smoothVAR_2[VAR_2iVAR_2]); VAR_2peak_decay_diff_smoothVAR_2[VAR_2iVAR_2] += VAR_2a_smoothVAR_2 * (VAR_2peak_decay_nrgVAR_2[VAR_2iVAR_2] - VAR_2powerVAR_2[VAR_2iVAR_2][VAR_2nVAR_2] - VAR_2peak_decay_diff_smoothVAR_2[VAR_2iVAR_2]); VAR_2denomVAR_2 = VAR_2transient_impactVAR_2 * VAR_2peak_decay_diff_smoothVAR_2[VAR_2iVAR_2]; VAR_2transient_gainVAR_2[VAR_2iVAR_2][VAR_2nVAR_2] = (VAR_2denomVAR_2 > VAR_2power_smoothVAR_2[VAR_2iVAR_2]) ? VAR_2power_smoothVAR_2[VAR_2iVAR_2] / VAR_2denomVAR_2 : VAR_21VAR_2.VAR_20fVAR_2; } } #VAR_2endifVAR_2 VAR_2forVAR_2 (VAR_2kVAR_2 = VAR_20VAR_2; VAR_2kVAR_2 < VAR_2NR_ALLPASS_BANDSVAR_2[VAR_2is34VAR_2]; VAR_2kVAR_2++) { VAR_2intVAR_2 VAR_2bVAR_2 = VAR_2k_to_iVAR_2[VAR_2kVAR_2]; #VAR_2ifVAR_2 VAR_2USE_FIXEDVAR_2 VAR_2intVAR_2 VAR_2g_decay_slopeVAR_2; VAR_2ifVAR_2 (VAR_2kVAR_2 - VAR_2DECAY_CUTOFFVAR_2[VAR_2is34VAR_2] <= VAR_20VAR_2) { VAR_2g_decay_slopeVAR_2 = VAR_21VAR_2 << VAR_230VAR_2; } VAR_2elseVAR_2 VAR_2ifVAR_2 (VAR_2kVAR_2 - VAR_2DECAY_CUTOFFVAR_2[VAR_2is34VAR_2] >= VAR_220VAR_2) { VAR_2g_decay_slopeVAR_2 = VAR_20VAR_2; } VAR_2elseVAR_2 { VAR_2g_decay_slopeVAR_2 = (VAR_21VAR_2 << VAR_230VAR_2) - VAR_2DECAY_SLOPEVAR_2 * (VAR_2kVAR_2 - VAR_2DECAY_CUTOFFVAR_2[VAR_2is34VAR_2]); } #VAR_2elseVAR_2 VAR_2floatVAR_2 VAR_2g_decay_slopeVAR_2 = VAR_21VAR_2.VAR_2fVAR_2 - VAR_2DECAY_SLOPEVAR_2 * (VAR_2kVAR_2 - VAR_2DECAY_CUTOFFVAR_2[VAR_2is34VAR_2]); VAR_2g_decay_slopeVAR_2 = VAR_2av_clipfVAR_2(VAR_2g_decay_slopeVAR_2, VAR_20VAR_2.VAR_2fVAR_2, VAR_21VAR_2.VAR_2fVAR_2); #VAR_2endifVAR_2 VAR_2memcpyVAR_2(VAR_2delayVAR_2[VAR_2kVAR_2], VAR_2delayVAR_2[VAR_2kVAR_2]+VAR_2nLVAR_2, VAR_2PS_MAX_DELAYVAR_2*VAR_2sizeofVAR_2(VAR_2delayVAR_2[VAR_2kVAR_2][VAR_20VAR_2])); VAR_2memcpyVAR_2(VAR_2delayVAR_2[VAR_2kVAR_2]+VAR_2PS_MAX_DELAYVAR_2, VAR_2sVAR_2[VAR_2kVAR_2], VAR_2numQMFSlotsVAR_2*VAR_2sizeofVAR_2(VAR_2delayVAR_2[VAR_2kVAR_2][VAR_20VAR_2])); VAR_2forVAR_2 (VAR_2mVAR_2 = VAR_20VAR_2; VAR_2mVAR_2 < VAR_2PS_AP_LINKSVAR_2; VAR_2mVAR_2++) { VAR_2memcpyVAR_2(VAR_2ap_delayVAR_2[VAR_2kVAR_2][VAR_2mVAR_2], VAR_2ap_delayVAR_2[VAR_2kVAR_2][VAR_2mVAR_2]+VAR_2numQMFSlotsVAR_2, VAR_25VAR_2*VAR_2sizeofVAR_2(VAR_2ap_delayVAR_2[VAR_2kVAR_2][VAR_2mVAR_2][VAR_20VAR_2])); } VAR_2VAR_0VAR_2->VAR_2dspVAR_2.VAR_2decorrelateVAR_2(VAR_2outVAR_2[VAR_2kVAR_2], VAR_2delayVAR_2[VAR_2kVAR_2] + VAR_2PS_MAX_DELAYVAR_2 - VAR_22VAR_2, VAR_2ap_delayVAR_2[VAR_2kVAR_2], VAR_2phi_fractVAR_2[VAR_2is34VAR_2][VAR_2kVAR_2], (VAR_2constVAR_2 VAR_2VAR_1VAR_2 (*)[VAR_22VAR_2]) VAR_2Q_fract_allpassVAR_2[VAR_2is34VAR_2][VAR_2kVAR_2], VAR_2transient_gainVAR_2[VAR_2bVAR_2], VAR_2g_decay_slopeVAR_2, VAR_2nLVAR_2 - VAR_2n0VAR_2); } VAR_2forVAR_2 (; VAR_2kVAR_2 < VAR_2SHORT_DELAY_BANDVAR_2[VAR_2is34VAR_2]; VAR_2kVAR_2++) { VAR_2intVAR_2 VAR_2iVAR_2 = VAR_2k_to_iVAR_2[VAR_2kVAR_2]; VAR_2memcpyVAR_2(VAR_2delayVAR_2[VAR_2kVAR_2], VAR_2delayVAR_2[VAR_2kVAR_2]+VAR_2nLVAR_2, VAR_2PS_MAX_DELAYVAR_2*VAR_2sizeofVAR_2(VAR_2delayVAR_2[VAR_2kVAR_2][VAR_20VAR_2])); VAR_2memcpyVAR_2(VAR_2delayVAR_2[VAR_2kVAR_2]+VAR_2PS_MAX_DELAYVAR_2, VAR_2sVAR_2[VAR_2kVAR_2], VAR_2numQMFSlotsVAR_2*VAR_2sizeofVAR_2(VAR_2delayVAR_2[VAR_2kVAR_2][VAR_20VAR_2])); VAR_2VAR_0VAR_2->VAR_2dspVAR_2.VAR_2mul_pair_singleVAR_2(VAR_2outVAR_2[VAR_2kVAR_2], VAR_2delayVAR_2[VAR_2kVAR_2] + VAR_2PS_MAX_DELAYVAR_2 - VAR_214VAR_2, VAR_2transient_gainVAR_2[VAR_2iVAR_2], VAR_2nLVAR_2 - VAR_2n0VAR_2); } VAR_2forVAR_2 (; VAR_2kVAR_2 < VAR_2NR_BANDSVAR_2[VAR_2is34VAR_2]; VAR_2kVAR_2++) { VAR_2intVAR_2 VAR_2iVAR_2 = VAR_2k_to_iVAR_2[VAR_2kVAR_2]; VAR_2memcpyVAR_2(VAR_2delayVAR_2[VAR_2kVAR_2], VAR_2delayVAR_2[VAR_2kVAR_2]+VAR_2nLVAR_2, VAR_2PS_MAX_DELAYVAR_2*VAR_2sizeofVAR_2(VAR_2delayVAR_2[VAR_2kVAR_2][VAR_20VAR_2])); VAR_2memcpyVAR_2(VAR_2delayVAR_2[VAR_2kVAR_2]+VAR_2PS_MAX_DELAYVAR_2, VAR_2sVAR_2[VAR_2kVAR_2], VAR_2numQMFSlotsVAR_2*VAR_2sizeofVAR_2(VAR_2delayVAR_2[VAR_2kVAR_2][VAR_20VAR_2])); VAR_2VAR_0VAR_2->VAR_2dspVAR_2.VAR_2mul_pair_singleVAR_2(VAR_2outVAR_2[VAR_2kVAR_2], VAR_2delayVAR_2[VAR_2kVAR_2] + VAR_2PS_MAX_DELAYVAR_2 - VAR_21VAR_2, VAR_2transient_gainVAR_2[VAR_2iVAR_2], VAR_2nLVAR_2 - VAR_2n0VAR_2); } }
[ "VAR_2staticVAR_2 VAR_2voidVAR_2 VAR_2decorrelationVAR_2(VAR_2PSContextVAR_2 *VAR_2VAR_0VAR_2, VAR_2VAR_1VAR_2 (*VAR_2outVAR_2)[VAR_232VAR_2][VAR_22VAR_2], VAR_2constVAR_2 VAR_2VAR_1VAR_2 (*VAR_2sVAR_2)[VAR_232VAR_2][VAR_22VAR_2], VAR_2intVAR_2 VAR_2is34VAR_2)\n{", "VAR_2LOCAL_ALIGNED_16VAR_2(VAR_2VAR_1VAR_2, VAR_2powerVAR_2, [VAR_234VAR_2], [VAR_2PS_QMF_TIME_SLOTSVAR_2]);", "VAR_2LOCAL_ALIGNED_16VAR_2(VAR_2VAR_1VAR_2, VAR_2transient_gainVAR_2, [VAR_234VAR_2], [VAR_2PS_QMF_TIME_SLOTSVAR_2]);", "VAR_2VAR_1VAR_2 *VAR_2peak_decay_nrgVAR_2 = VAR_2VAR_0VAR_2->VAR_2peak_decay_nrgVAR_2;", "VAR_2VAR_1VAR_2 *VAR_2power_smoothVAR_2 = VAR_2VAR_0VAR_2->VAR_2power_smoothVAR_2;", "VAR_2VAR_1VAR_2 *VAR_2peak_decay_diff_smoothVAR_2 = VAR_2VAR_0VAR_2->VAR_2peak_decay_diff_smoothVAR_2;", "VAR_2VAR_1VAR_2 (*VAR_2delayVAR_2)[VAR_2PS_QMF_TIME_SLOTSVAR_2 + VAR_2PS_MAX_DELAYVAR_2][VAR_22VAR_2] = VAR_2VAR_0VAR_2->VAR_2delayVAR_2;", "VAR_2VAR_1VAR_2 (*VAR_2ap_delayVAR_2)[VAR_2PS_AP_LINKSVAR_2][VAR_2PS_QMF_TIME_SLOTSVAR_2 + VAR_2PS_MAX_AP_DELAYVAR_2][VAR_22VAR_2] = VAR_2VAR_0VAR_2->VAR_2ap_delayVAR_2;", "#VAR_2ifVAR_2 !VAR_2USE_FIXEDVAR_2\nVAR_2constVAR_2 VAR_2floatVAR_2 VAR_2transient_impactVAR_2 = VAR_21VAR_2.VAR_25fVAR_2;", "VAR_2constVAR_2 VAR_2floatVAR_2 VAR_2a_smoothVAR_2 = VAR_20VAR_2.VAR_225fVAR_2;", "#VAR_2endifVAR_2\nVAR_2constVAR_2 VAR_2int8_tVAR_2 *VAR_2k_to_iVAR_2 = VAR_2is34VAR_2 ? VAR_2k_to_i_34VAR_2 : VAR_2k_to_i_20VAR_2;", "VAR_2intVAR_2 VAR_2iVAR_2, VAR_2kVAR_2, VAR_2mVAR_2, VAR_2nVAR_2;", "VAR_2intVAR_2 VAR_2n0VAR_2 = VAR_20VAR_2, VAR_2nLVAR_2 = VAR_232VAR_2;", "VAR_2constVAR_2 VAR_2VAR_1VAR_2 VAR_2peak_decay_factorVAR_2 = VAR_2Q31VAR_2(VAR_20VAR_2.VAR_276592833836465fVAR_2);", "VAR_2memsetVAR_2(VAR_2powerVAR_2, VAR_20VAR_2, VAR_234VAR_2 * VAR_2sizeofVAR_2(*VAR_2powerVAR_2));", "VAR_2ifVAR_2 (VAR_2is34VAR_2 != VAR_2VAR_0VAR_2->VAR_2is34bands_oldVAR_2) {", "VAR_2memsetVAR_2(VAR_2VAR_0VAR_2->VAR_2peak_decay_nrgVAR_2, VAR_20VAR_2, VAR_2sizeofVAR_2(VAR_2VAR_0VAR_2->VAR_2peak_decay_nrgVAR_2));", "VAR_2memsetVAR_2(VAR_2VAR_0VAR_2->VAR_2power_smoothVAR_2, VAR_20VAR_2, VAR_2sizeofVAR_2(VAR_2VAR_0VAR_2->VAR_2power_smoothVAR_2));", "VAR_2memsetVAR_2(VAR_2VAR_0VAR_2->VAR_2peak_decay_diff_smoothVAR_2, VAR_20VAR_2, VAR_2sizeofVAR_2(VAR_2VAR_0VAR_2->VAR_2peak_decay_diff_smoothVAR_2));", "VAR_2memsetVAR_2(VAR_2VAR_0VAR_2->VAR_2delayVAR_2, VAR_20VAR_2, VAR_2sizeofVAR_2(VAR_2VAR_0VAR_2->VAR_2delayVAR_2));", "VAR_2memsetVAR_2(VAR_2VAR_0VAR_2->VAR_2ap_delayVAR_2, VAR_20VAR_2, VAR_2sizeofVAR_2(VAR_2VAR_0VAR_2->VAR_2ap_delayVAR_2));", "}", "VAR_2forVAR_2 (VAR_2kVAR_2 = VAR_20VAR_2; VAR_2kVAR_2 < VAR_2NR_BANDSVAR_2[VAR_2is34VAR_2]; VAR_2kVAR_2++) {", "VAR_2intVAR_2 VAR_2iVAR_2 = VAR_2k_to_iVAR_2[VAR_2kVAR_2];", "VAR_2VAR_0VAR_2->VAR_2dspVAR_2.VAR_2add_squaresVAR_2(VAR_2powerVAR_2[VAR_2iVAR_2], VAR_2sVAR_2[VAR_2kVAR_2], VAR_2nLVAR_2 - VAR_2n0VAR_2);", "}", "#VAR_2ifVAR_2 VAR_2USE_FIXEDVAR_2\nVAR_2forVAR_2 (VAR_2iVAR_2 = VAR_20VAR_2; VAR_2iVAR_2 < VAR_2NR_PAR_BANDSVAR_2[VAR_2is34VAR_2]; VAR_2iVAR_2++) {", "VAR_2forVAR_2 (VAR_2nVAR_2 = VAR_2n0VAR_2; VAR_2nVAR_2 < VAR_2nLVAR_2; VAR_2nVAR_2++) {", "VAR_2intVAR_2 VAR_2decayed_peakVAR_2;", "VAR_2intVAR_2 VAR_2denomVAR_2;", "VAR_2decayed_peakVAR_2 = (VAR_2intVAR_2)(((VAR_2int64_tVAR_2)VAR_2peak_decay_factorVAR_2 * \\\nVAR_2peak_decay_nrgVAR_2[VAR_2iVAR_2] + VAR_20x40000000VAR_2) >> VAR_231VAR_2);", "VAR_2peak_decay_nrgVAR_2[VAR_2iVAR_2] = VAR_2FFMAXVAR_2(VAR_2decayed_peakVAR_2, VAR_2powerVAR_2[VAR_2iVAR_2][VAR_2nVAR_2]);", "VAR_2power_smoothVAR_2[VAR_2iVAR_2] += (VAR_2powerVAR_2[VAR_2iVAR_2][VAR_2nVAR_2] - VAR_2power_smoothVAR_2[VAR_2iVAR_2] + VAR_22VAR_2) >> VAR_22VAR_2;", "VAR_2peak_decay_diff_smoothVAR_2[VAR_2iVAR_2] += (VAR_2peak_decay_nrgVAR_2[VAR_2iVAR_2] - VAR_2powerVAR_2[VAR_2iVAR_2][VAR_2nVAR_2] - \\\nVAR_2peak_decay_diff_smoothVAR_2[VAR_2iVAR_2] + VAR_22VAR_2) >> VAR_22VAR_2;", "VAR_2denomVAR_2 = VAR_2peak_decay_diff_smoothVAR_2[VAR_2iVAR_2] + (VAR_2peak_decay_diff_smoothVAR_2[VAR_2iVAR_2] >> VAR_21VAR_2);", "VAR_2ifVAR_2 (VAR_2denomVAR_2 > VAR_2power_smoothVAR_2[VAR_2iVAR_2]) {", "VAR_2intVAR_2 VAR_2pVAR_2 = VAR_2power_smoothVAR_2[VAR_2iVAR_2];", "VAR_2whileVAR_2 (VAR_2denomVAR_2 < VAR_20x40000000VAR_2) {", "VAR_2denomVAR_2 <<= VAR_21VAR_2;", "VAR_2pVAR_2 <<= VAR_21VAR_2;", "}", "VAR_2transient_gainVAR_2[VAR_2iVAR_2][VAR_2nVAR_2] = VAR_2pVAR_2 / (VAR_2denomVAR_2 >> VAR_216VAR_2);", "}", "VAR_2elseVAR_2 {", "VAR_2transient_gainVAR_2[VAR_2iVAR_2][VAR_2nVAR_2] = VAR_21VAR_2 << VAR_216VAR_2;", "}", "}", "}", "#VAR_2elseVAR_2\nVAR_2forVAR_2 (VAR_2iVAR_2 = VAR_20VAR_2; VAR_2iVAR_2 < VAR_2NR_PAR_BANDSVAR_2[VAR_2is34VAR_2]; VAR_2iVAR_2++) {", "VAR_2forVAR_2 (VAR_2nVAR_2 = VAR_2n0VAR_2; VAR_2nVAR_2 < VAR_2nLVAR_2; VAR_2nVAR_2++) {", "VAR_2floatVAR_2 VAR_2decayed_peakVAR_2 = VAR_2peak_decay_factorVAR_2 * VAR_2peak_decay_nrgVAR_2[VAR_2iVAR_2];", "VAR_2floatVAR_2 VAR_2denomVAR_2;", "VAR_2peak_decay_nrgVAR_2[VAR_2iVAR_2] = VAR_2FFMAXVAR_2(VAR_2decayed_peakVAR_2, VAR_2powerVAR_2[VAR_2iVAR_2][VAR_2nVAR_2]);", "VAR_2power_smoothVAR_2[VAR_2iVAR_2] += VAR_2a_smoothVAR_2 * (VAR_2powerVAR_2[VAR_2iVAR_2][VAR_2nVAR_2] - VAR_2power_smoothVAR_2[VAR_2iVAR_2]);", "VAR_2peak_decay_diff_smoothVAR_2[VAR_2iVAR_2] += VAR_2a_smoothVAR_2 * (VAR_2peak_decay_nrgVAR_2[VAR_2iVAR_2] - VAR_2powerVAR_2[VAR_2iVAR_2][VAR_2nVAR_2] - VAR_2peak_decay_diff_smoothVAR_2[VAR_2iVAR_2]);", "VAR_2denomVAR_2 = VAR_2transient_impactVAR_2 * VAR_2peak_decay_diff_smoothVAR_2[VAR_2iVAR_2];", "VAR_2transient_gainVAR_2[VAR_2iVAR_2][VAR_2nVAR_2] = (VAR_2denomVAR_2 > VAR_2power_smoothVAR_2[VAR_2iVAR_2]) ?\nVAR_2power_smoothVAR_2[VAR_2iVAR_2] / VAR_2denomVAR_2 : VAR_21VAR_2.VAR_20fVAR_2;", "}", "}", "#VAR_2endifVAR_2\nVAR_2forVAR_2 (VAR_2kVAR_2 = VAR_20VAR_2; VAR_2kVAR_2 < VAR_2NR_ALLPASS_BANDSVAR_2[VAR_2is34VAR_2]; VAR_2kVAR_2++) {", "VAR_2intVAR_2 VAR_2bVAR_2 = VAR_2k_to_iVAR_2[VAR_2kVAR_2];", "#VAR_2ifVAR_2 VAR_2USE_FIXEDVAR_2\nVAR_2intVAR_2 VAR_2g_decay_slopeVAR_2;", "VAR_2ifVAR_2 (VAR_2kVAR_2 - VAR_2DECAY_CUTOFFVAR_2[VAR_2is34VAR_2] <= VAR_20VAR_2) {", "VAR_2g_decay_slopeVAR_2 = VAR_21VAR_2 << VAR_230VAR_2;", "}", "VAR_2elseVAR_2 VAR_2ifVAR_2 (VAR_2kVAR_2 - VAR_2DECAY_CUTOFFVAR_2[VAR_2is34VAR_2] >= VAR_220VAR_2) {", "VAR_2g_decay_slopeVAR_2 = VAR_20VAR_2;", "}", "VAR_2elseVAR_2 {", "VAR_2g_decay_slopeVAR_2 = (VAR_21VAR_2 << VAR_230VAR_2) - VAR_2DECAY_SLOPEVAR_2 * (VAR_2kVAR_2 - VAR_2DECAY_CUTOFFVAR_2[VAR_2is34VAR_2]);", "}", "#VAR_2elseVAR_2\nVAR_2floatVAR_2 VAR_2g_decay_slopeVAR_2 = VAR_21VAR_2.VAR_2fVAR_2 - VAR_2DECAY_SLOPEVAR_2 * (VAR_2kVAR_2 - VAR_2DECAY_CUTOFFVAR_2[VAR_2is34VAR_2]);", "VAR_2g_decay_slopeVAR_2 = VAR_2av_clipfVAR_2(VAR_2g_decay_slopeVAR_2, VAR_20VAR_2.VAR_2fVAR_2, VAR_21VAR_2.VAR_2fVAR_2);", "#VAR_2endifVAR_2\nVAR_2memcpyVAR_2(VAR_2delayVAR_2[VAR_2kVAR_2], VAR_2delayVAR_2[VAR_2kVAR_2]+VAR_2nLVAR_2, VAR_2PS_MAX_DELAYVAR_2*VAR_2sizeofVAR_2(VAR_2delayVAR_2[VAR_2kVAR_2][VAR_20VAR_2]));", "VAR_2memcpyVAR_2(VAR_2delayVAR_2[VAR_2kVAR_2]+VAR_2PS_MAX_DELAYVAR_2, VAR_2sVAR_2[VAR_2kVAR_2], VAR_2numQMFSlotsVAR_2*VAR_2sizeofVAR_2(VAR_2delayVAR_2[VAR_2kVAR_2][VAR_20VAR_2]));", "VAR_2forVAR_2 (VAR_2mVAR_2 = VAR_20VAR_2; VAR_2mVAR_2 < VAR_2PS_AP_LINKSVAR_2; VAR_2mVAR_2++) {", "VAR_2memcpyVAR_2(VAR_2ap_delayVAR_2[VAR_2kVAR_2][VAR_2mVAR_2], VAR_2ap_delayVAR_2[VAR_2kVAR_2][VAR_2mVAR_2]+VAR_2numQMFSlotsVAR_2, VAR_25VAR_2*VAR_2sizeofVAR_2(VAR_2ap_delayVAR_2[VAR_2kVAR_2][VAR_2mVAR_2][VAR_20VAR_2]));", "}", "VAR_2VAR_0VAR_2->VAR_2dspVAR_2.VAR_2decorrelateVAR_2(VAR_2outVAR_2[VAR_2kVAR_2], VAR_2delayVAR_2[VAR_2kVAR_2] + VAR_2PS_MAX_DELAYVAR_2 - VAR_22VAR_2, VAR_2ap_delayVAR_2[VAR_2kVAR_2],\nVAR_2phi_fractVAR_2[VAR_2is34VAR_2][VAR_2kVAR_2],\n(VAR_2constVAR_2 VAR_2VAR_1VAR_2 (*)[VAR_22VAR_2]) VAR_2Q_fract_allpassVAR_2[VAR_2is34VAR_2][VAR_2kVAR_2],\nVAR_2transient_gainVAR_2[VAR_2bVAR_2], VAR_2g_decay_slopeVAR_2, VAR_2nLVAR_2 - VAR_2n0VAR_2);", "}", "VAR_2forVAR_2 (; VAR_2kVAR_2 < VAR_2SHORT_DELAY_BANDVAR_2[VAR_2is34VAR_2]; VAR_2kVAR_2++) {", "VAR_2intVAR_2 VAR_2iVAR_2 = VAR_2k_to_iVAR_2[VAR_2kVAR_2];", "VAR_2memcpyVAR_2(VAR_2delayVAR_2[VAR_2kVAR_2], VAR_2delayVAR_2[VAR_2kVAR_2]+VAR_2nLVAR_2, VAR_2PS_MAX_DELAYVAR_2*VAR_2sizeofVAR_2(VAR_2delayVAR_2[VAR_2kVAR_2][VAR_20VAR_2]));", "VAR_2memcpyVAR_2(VAR_2delayVAR_2[VAR_2kVAR_2]+VAR_2PS_MAX_DELAYVAR_2, VAR_2sVAR_2[VAR_2kVAR_2], VAR_2numQMFSlotsVAR_2*VAR_2sizeofVAR_2(VAR_2delayVAR_2[VAR_2kVAR_2][VAR_20VAR_2]));", "VAR_2VAR_0VAR_2->VAR_2dspVAR_2.VAR_2mul_pair_singleVAR_2(VAR_2outVAR_2[VAR_2kVAR_2], VAR_2delayVAR_2[VAR_2kVAR_2] + VAR_2PS_MAX_DELAYVAR_2 - VAR_214VAR_2,\nVAR_2transient_gainVAR_2[VAR_2iVAR_2], VAR_2nLVAR_2 - VAR_2n0VAR_2);", "}", "VAR_2forVAR_2 (; VAR_2kVAR_2 < VAR_2NR_BANDSVAR_2[VAR_2is34VAR_2]; VAR_2kVAR_2++) {", "VAR_2intVAR_2 VAR_2iVAR_2 = VAR_2k_to_iVAR_2[VAR_2kVAR_2];", "VAR_2memcpyVAR_2(VAR_2delayVAR_2[VAR_2kVAR_2], VAR_2delayVAR_2[VAR_2kVAR_2]+VAR_2nLVAR_2, VAR_2PS_MAX_DELAYVAR_2*VAR_2sizeofVAR_2(VAR_2delayVAR_2[VAR_2kVAR_2][VAR_20VAR_2]));", "VAR_2memcpyVAR_2(VAR_2delayVAR_2[VAR_2kVAR_2]+VAR_2PS_MAX_DELAYVAR_2, VAR_2sVAR_2[VAR_2kVAR_2], VAR_2numQMFSlotsVAR_2*VAR_2sizeofVAR_2(VAR_2delayVAR_2[VAR_2kVAR_2][VAR_20VAR_2]));", "VAR_2VAR_0VAR_2->VAR_2dspVAR_2.VAR_2mul_pair_singleVAR_2(VAR_2outVAR_2[VAR_2kVAR_2], VAR_2delayVAR_2[VAR_2kVAR_2] + VAR_2PS_MAX_DELAYVAR_2 - VAR_21VAR_2,\nVAR_2transient_gainVAR_2[VAR_2iVAR_2], VAR_2nLVAR_2 - VAR_2n0VAR_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, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19, 21 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 69, 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81, 83 ], [ 85 ], [ 87 ], [ 89, 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121, 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139, 141 ], [ 143 ], [ 145 ], [ 149, 167 ], [ 169 ], [ 171, 173 ], [ 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 ], [ 233, 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 249, 251 ], [ 253 ], [ 255 ] ]
7,397
void tcg_gen_ld8s_i64(TCGv_i64 ret, TCGv_ptr arg2, tcg_target_long offset) { tcg_gen_ld8s_i32(TCGV_LOW(ret), arg2, offset); tcg_gen_sari_i32(TCGV_HIGH(ret), TCGV_HIGH(ret), 31); }
true
qemu
3ff91d7e85176f8b4b131163d7fd801757a2c949
void tcg_gen_ld8s_i64(TCGv_i64 ret, TCGv_ptr arg2, tcg_target_long offset) { tcg_gen_ld8s_i32(TCGV_LOW(ret), arg2, offset); tcg_gen_sari_i32(TCGV_HIGH(ret), TCGV_HIGH(ret), 31); }
{ "code": [ " tcg_gen_sari_i32(TCGV_HIGH(ret), TCGV_HIGH(ret), 31);" ], "line_no": [ 7 ] }
void FUNC_0(TCGv_i64 VAR_0, TCGv_ptr VAR_1, tcg_target_long VAR_2) { tcg_gen_ld8s_i32(TCGV_LOW(VAR_0), VAR_1, VAR_2); tcg_gen_sari_i32(TCGV_HIGH(VAR_0), TCGV_HIGH(VAR_0), 31); }
[ "void FUNC_0(TCGv_i64 VAR_0, TCGv_ptr VAR_1, tcg_target_long VAR_2)\n{", "tcg_gen_ld8s_i32(TCGV_LOW(VAR_0), VAR_1, VAR_2);", "tcg_gen_sari_i32(TCGV_HIGH(VAR_0), TCGV_HIGH(VAR_0), 31);", "}" ]
[ 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
7,399
static int load_glyph(AVFilterContext *ctx, Glyph **glyph_ptr, uint32_t code) { DrawTextContext *s = ctx->priv; FT_BitmapGlyph bitmapglyph; Glyph *glyph; struct AVTreeNode *node = NULL; int ret; /* load glyph into s->face->glyph */ if (FT_Load_Char(s->face, code, s->ft_load_flags)) return AVERROR(EINVAL); /* save glyph */ if (!(glyph = av_mallocz(sizeof(*glyph))) || !(glyph->glyph = av_mallocz(sizeof(*glyph->glyph)))) { ret = AVERROR(ENOMEM); goto error; } glyph->code = code; if (FT_Get_Glyph(s->face->glyph, glyph->glyph)) { ret = AVERROR(EINVAL); goto error; } if (s->borderw) { FT_Glyph border_glyph = *glyph->glyph; if (FT_Glyph_StrokeBorder(&border_glyph, s->stroker, 0, 0) || FT_Glyph_To_Bitmap(&border_glyph, FT_RENDER_MODE_NORMAL, 0, 1)) { ret = AVERROR_EXTERNAL; goto error; } bitmapglyph = (FT_BitmapGlyph) border_glyph; glyph->border_bitmap = bitmapglyph->bitmap; } if (FT_Glyph_To_Bitmap(glyph->glyph, FT_RENDER_MODE_NORMAL, 0, 1)) { ret = AVERROR_EXTERNAL; goto error; } bitmapglyph = (FT_BitmapGlyph) *glyph->glyph; glyph->bitmap = bitmapglyph->bitmap; glyph->bitmap_left = bitmapglyph->left; glyph->bitmap_top = bitmapglyph->top; glyph->advance = s->face->glyph->advance.x >> 6; /* measure text height to calculate text_height (or the maximum text height) */ FT_Glyph_Get_CBox(*glyph->glyph, ft_glyph_bbox_pixels, &glyph->bbox); /* cache the newly created glyph */ if (!(node = av_tree_node_alloc())) { ret = AVERROR(ENOMEM); goto error; } av_tree_insert(&s->glyphs, glyph, glyph_cmp, &node); if (glyph_ptr) *glyph_ptr = glyph; return 0; error: if (glyph) av_freep(&glyph->glyph); av_freep(&glyph); av_freep(&node); return ret; }
true
FFmpeg
4582e1162a0b57bd0787da390555b8f96f8b393b
static int load_glyph(AVFilterContext *ctx, Glyph **glyph_ptr, uint32_t code) { DrawTextContext *s = ctx->priv; FT_BitmapGlyph bitmapglyph; Glyph *glyph; struct AVTreeNode *node = NULL; int ret; if (FT_Load_Char(s->face, code, s->ft_load_flags)) return AVERROR(EINVAL); if (!(glyph = av_mallocz(sizeof(*glyph))) || !(glyph->glyph = av_mallocz(sizeof(*glyph->glyph)))) { ret = AVERROR(ENOMEM); goto error; } glyph->code = code; if (FT_Get_Glyph(s->face->glyph, glyph->glyph)) { ret = AVERROR(EINVAL); goto error; } if (s->borderw) { FT_Glyph border_glyph = *glyph->glyph; if (FT_Glyph_StrokeBorder(&border_glyph, s->stroker, 0, 0) || FT_Glyph_To_Bitmap(&border_glyph, FT_RENDER_MODE_NORMAL, 0, 1)) { ret = AVERROR_EXTERNAL; goto error; } bitmapglyph = (FT_BitmapGlyph) border_glyph; glyph->border_bitmap = bitmapglyph->bitmap; } if (FT_Glyph_To_Bitmap(glyph->glyph, FT_RENDER_MODE_NORMAL, 0, 1)) { ret = AVERROR_EXTERNAL; goto error; } bitmapglyph = (FT_BitmapGlyph) *glyph->glyph; glyph->bitmap = bitmapglyph->bitmap; glyph->bitmap_left = bitmapglyph->left; glyph->bitmap_top = bitmapglyph->top; glyph->advance = s->face->glyph->advance.x >> 6; FT_Glyph_Get_CBox(*glyph->glyph, ft_glyph_bbox_pixels, &glyph->bbox); if (!(node = av_tree_node_alloc())) { ret = AVERROR(ENOMEM); goto error; } av_tree_insert(&s->glyphs, glyph, glyph_cmp, &node); if (glyph_ptr) *glyph_ptr = glyph; return 0; error: if (glyph) av_freep(&glyph->glyph); av_freep(&glyph); av_freep(&node); return ret; }
{ "code": [ " FT_Glyph border_glyph = *glyph->glyph;", " if (FT_Glyph_StrokeBorder(&border_glyph, s->stroker, 0, 0) ||", " FT_Glyph_To_Bitmap(&border_glyph, FT_RENDER_MODE_NORMAL, 0, 1)) {", " bitmapglyph = (FT_BitmapGlyph) border_glyph;" ], "line_no": [ 51, 53, 55, 63 ] }
static int FUNC_0(AVFilterContext *VAR_0, Glyph **VAR_1, uint32_t VAR_2) { DrawTextContext *s = VAR_0->priv; FT_BitmapGlyph bitmapglyph; Glyph *glyph; struct AVTreeNode *VAR_3 = NULL; int VAR_4; if (FT_Load_Char(s->face, VAR_2, s->ft_load_flags)) return AVERROR(EINVAL); if (!(glyph = av_mallocz(sizeof(*glyph))) || !(glyph->glyph = av_mallocz(sizeof(*glyph->glyph)))) { VAR_4 = AVERROR(ENOMEM); goto error; } glyph->VAR_2 = VAR_2; if (FT_Get_Glyph(s->face->glyph, glyph->glyph)) { VAR_4 = AVERROR(EINVAL); goto error; } if (s->borderw) { FT_Glyph border_glyph = *glyph->glyph; if (FT_Glyph_StrokeBorder(&border_glyph, s->stroker, 0, 0) || FT_Glyph_To_Bitmap(&border_glyph, FT_RENDER_MODE_NORMAL, 0, 1)) { VAR_4 = AVERROR_EXTERNAL; goto error; } bitmapglyph = (FT_BitmapGlyph) border_glyph; glyph->border_bitmap = bitmapglyph->bitmap; } if (FT_Glyph_To_Bitmap(glyph->glyph, FT_RENDER_MODE_NORMAL, 0, 1)) { VAR_4 = AVERROR_EXTERNAL; goto error; } bitmapglyph = (FT_BitmapGlyph) *glyph->glyph; glyph->bitmap = bitmapglyph->bitmap; glyph->bitmap_left = bitmapglyph->left; glyph->bitmap_top = bitmapglyph->top; glyph->advance = s->face->glyph->advance.x >> 6; FT_Glyph_Get_CBox(*glyph->glyph, ft_glyph_bbox_pixels, &glyph->bbox); if (!(VAR_3 = av_tree_node_alloc())) { VAR_4 = AVERROR(ENOMEM); goto error; } av_tree_insert(&s->glyphs, glyph, glyph_cmp, &VAR_3); if (VAR_1) *VAR_1 = glyph; return 0; error: if (glyph) av_freep(&glyph->glyph); av_freep(&glyph); av_freep(&VAR_3); return VAR_4; }
[ "static int FUNC_0(AVFilterContext *VAR_0, Glyph **VAR_1, uint32_t VAR_2)\n{", "DrawTextContext *s = VAR_0->priv;", "FT_BitmapGlyph bitmapglyph;", "Glyph *glyph;", "struct AVTreeNode *VAR_3 = NULL;", "int VAR_4;", "if (FT_Load_Char(s->face, VAR_2, s->ft_load_flags))\nreturn AVERROR(EINVAL);", "if (!(glyph = av_mallocz(sizeof(*glyph))) ||\n!(glyph->glyph = av_mallocz(sizeof(*glyph->glyph)))) {", "VAR_4 = AVERROR(ENOMEM);", "goto error;", "}", "glyph->VAR_2 = VAR_2;", "if (FT_Get_Glyph(s->face->glyph, glyph->glyph)) {", "VAR_4 = AVERROR(EINVAL);", "goto error;", "}", "if (s->borderw) {", "FT_Glyph border_glyph = *glyph->glyph;", "if (FT_Glyph_StrokeBorder(&border_glyph, s->stroker, 0, 0) ||\nFT_Glyph_To_Bitmap(&border_glyph, FT_RENDER_MODE_NORMAL, 0, 1)) {", "VAR_4 = AVERROR_EXTERNAL;", "goto error;", "}", "bitmapglyph = (FT_BitmapGlyph) border_glyph;", "glyph->border_bitmap = bitmapglyph->bitmap;", "}", "if (FT_Glyph_To_Bitmap(glyph->glyph, FT_RENDER_MODE_NORMAL, 0, 1)) {", "VAR_4 = AVERROR_EXTERNAL;", "goto error;", "}", "bitmapglyph = (FT_BitmapGlyph) *glyph->glyph;", "glyph->bitmap = bitmapglyph->bitmap;", "glyph->bitmap_left = bitmapglyph->left;", "glyph->bitmap_top = bitmapglyph->top;", "glyph->advance = s->face->glyph->advance.x >> 6;", "FT_Glyph_Get_CBox(*glyph->glyph, ft_glyph_bbox_pixels, &glyph->bbox);", "if (!(VAR_3 = av_tree_node_alloc())) {", "VAR_4 = AVERROR(ENOMEM);", "goto error;", "}", "av_tree_insert(&s->glyphs, glyph, glyph_cmp, &VAR_3);", "if (VAR_1)\n*VAR_1 = glyph;", "return 0;", "error:\nif (glyph)\nav_freep(&glyph->glyph);", "av_freep(&glyph);", "av_freep(&VAR_3);", "return VAR_4;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 19, 21 ], [ 27, 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53, 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 93 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 111, 113 ], [ 115 ], [ 119, 121, 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ] ]
7,401
QError *qobject_to_qerror(const QObject *obj) { if (qobject_type(obj) != QTYPE_QERROR) { return NULL; } return container_of(obj, QError, base); }
false
qemu
2a74440547ea0a15195224fa2b7784b267cbfe15
QError *qobject_to_qerror(const QObject *obj) { if (qobject_type(obj) != QTYPE_QERROR) { return NULL; } return container_of(obj, QError, base); }
{ "code": [], "line_no": [] }
QError *FUNC_0(const QObject *obj) { if (qobject_type(obj) != QTYPE_QERROR) { return NULL; } return container_of(obj, QError, base); }
[ "QError *FUNC_0(const QObject *obj)\n{", "if (qobject_type(obj) != QTYPE_QERROR) {", "return NULL;", "}", "return container_of(obj, QError, base);", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ] ]
7,402
uint64_t helper_fmul(CPUPPCState *env, uint64_t arg1, uint64_t arg2) { CPU_DoubleU farg1, farg2; farg1.ll = arg1; farg2.ll = arg2; if (unlikely((float64_is_infinity(farg1.d) && float64_is_zero(farg2.d)) || (float64_is_zero(farg1.d) && float64_is_infinity(farg2.d)))) { /* Multiplication of zero by infinity */ farg1.ll = fload_invalid_op_excp(env, POWERPC_EXCP_FP_VXIMZ); } else { if (unlikely(float64_is_signaling_nan(farg1.d) || float64_is_signaling_nan(farg2.d))) { /* sNaN multiplication */ fload_invalid_op_excp(env, POWERPC_EXCP_FP_VXSNAN); } farg1.d = float64_mul(farg1.d, farg2.d, &env->fp_status); } return farg1.ll; }
false
qemu
59800ec8e52bcfa271fa61fb0aae19205ef1b7f1
uint64_t helper_fmul(CPUPPCState *env, uint64_t arg1, uint64_t arg2) { CPU_DoubleU farg1, farg2; farg1.ll = arg1; farg2.ll = arg2; if (unlikely((float64_is_infinity(farg1.d) && float64_is_zero(farg2.d)) || (float64_is_zero(farg1.d) && float64_is_infinity(farg2.d)))) { farg1.ll = fload_invalid_op_excp(env, POWERPC_EXCP_FP_VXIMZ); } else { if (unlikely(float64_is_signaling_nan(farg1.d) || float64_is_signaling_nan(farg2.d))) { fload_invalid_op_excp(env, POWERPC_EXCP_FP_VXSNAN); } farg1.d = float64_mul(farg1.d, farg2.d, &env->fp_status); } return farg1.ll; }
{ "code": [], "line_no": [] }
uint64_t FUNC_0(CPUPPCState *env, uint64_t arg1, uint64_t arg2) { CPU_DoubleU farg1, farg2; farg1.ll = arg1; farg2.ll = arg2; if (unlikely((float64_is_infinity(farg1.d) && float64_is_zero(farg2.d)) || (float64_is_zero(farg1.d) && float64_is_infinity(farg2.d)))) { farg1.ll = fload_invalid_op_excp(env, POWERPC_EXCP_FP_VXIMZ); } else { if (unlikely(float64_is_signaling_nan(farg1.d) || float64_is_signaling_nan(farg2.d))) { fload_invalid_op_excp(env, POWERPC_EXCP_FP_VXSNAN); } farg1.d = float64_mul(farg1.d, farg2.d, &env->fp_status); } return farg1.ll; }
[ "uint64_t FUNC_0(CPUPPCState *env, uint64_t arg1, uint64_t arg2)\n{", "CPU_DoubleU farg1, farg2;", "farg1.ll = arg1;", "farg2.ll = arg2;", "if (unlikely((float64_is_infinity(farg1.d) && float64_is_zero(farg2.d)) ||\n(float64_is_zero(farg1.d) && float64_is_infinity(farg2.d)))) {", "farg1.ll = fload_invalid_op_excp(env, POWERPC_EXCP_FP_VXIMZ);", "} else {", "if (unlikely(float64_is_signaling_nan(farg1.d) ||\nfloat64_is_signaling_nan(farg2.d))) {", "fload_invalid_op_excp(env, POWERPC_EXCP_FP_VXSNAN);", "}", "farg1.d = float64_mul(farg1.d, farg2.d, &env->fp_status);", "}", "return farg1.ll;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 15, 17 ], [ 21 ], [ 23 ], [ 25, 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ] ]
7,403
static QObject *parse_value(JSONParserContext *ctxt, va_list *ap) { QObject *token; token = parser_context_peek_token(ctxt); if (token == NULL) { parse_error(ctxt, NULL, "premature EOI"); return NULL; } switch (token_get_type(token)) { case JSON_LCURLY: return parse_object(ctxt, ap); case JSON_LSQUARE: return parse_array(ctxt, ap); case JSON_ESCAPE: return parse_escape(ctxt, ap); case JSON_INTEGER: case JSON_FLOAT: case JSON_STRING: return parse_literal(ctxt); case JSON_KEYWORD: return parse_keyword(ctxt); default: parse_error(ctxt, token, "expecting value"); return NULL; } }
false
qemu
9bada8971173345ceb37ed1a47b00a01a4dd48cf
static QObject *parse_value(JSONParserContext *ctxt, va_list *ap) { QObject *token; token = parser_context_peek_token(ctxt); if (token == NULL) { parse_error(ctxt, NULL, "premature EOI"); return NULL; } switch (token_get_type(token)) { case JSON_LCURLY: return parse_object(ctxt, ap); case JSON_LSQUARE: return parse_array(ctxt, ap); case JSON_ESCAPE: return parse_escape(ctxt, ap); case JSON_INTEGER: case JSON_FLOAT: case JSON_STRING: return parse_literal(ctxt); case JSON_KEYWORD: return parse_keyword(ctxt); default: parse_error(ctxt, token, "expecting value"); return NULL; } }
{ "code": [], "line_no": [] }
static QObject *FUNC_0(JSONParserContext *ctxt, va_list *ap) { QObject *token; token = parser_context_peek_token(ctxt); if (token == NULL) { parse_error(ctxt, NULL, "premature EOI"); return NULL; } switch (token_get_type(token)) { case JSON_LCURLY: return parse_object(ctxt, ap); case JSON_LSQUARE: return parse_array(ctxt, ap); case JSON_ESCAPE: return parse_escape(ctxt, ap); case JSON_INTEGER: case JSON_FLOAT: case JSON_STRING: return parse_literal(ctxt); case JSON_KEYWORD: return parse_keyword(ctxt); default: parse_error(ctxt, token, "expecting value"); return NULL; } }
[ "static QObject *FUNC_0(JSONParserContext *ctxt, va_list *ap)\n{", "QObject *token;", "token = parser_context_peek_token(ctxt);", "if (token == NULL) {", "parse_error(ctxt, NULL, \"premature EOI\");", "return NULL;", "}", "switch (token_get_type(token)) {", "case JSON_LCURLY:\nreturn parse_object(ctxt, ap);", "case JSON_LSQUARE:\nreturn parse_array(ctxt, ap);", "case JSON_ESCAPE:\nreturn parse_escape(ctxt, ap);", "case JSON_INTEGER:\ncase JSON_FLOAT:\ncase JSON_STRING:\nreturn parse_literal(ctxt);", "case JSON_KEYWORD:\nreturn parse_keyword(ctxt);", "default:\nparse_error(ctxt, token, \"expecting value\");", "return NULL;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23, 25 ], [ 27, 29 ], [ 31, 33 ], [ 35, 37, 39, 41 ], [ 43, 45 ], [ 47, 49 ], [ 51 ], [ 53 ], [ 55 ] ]
7,404
ssize_t virtio_pdu_vmarshal(V9fsPDU *pdu, size_t offset, const char *fmt, va_list ap) { V9fsState *s = pdu->s; V9fsVirtioState *v = container_of(s, V9fsVirtioState, state); VirtQueueElement *elem = &v->elems[pdu->idx]; return v9fs_iov_vmarshal(elem->in_sg, elem->in_num, offset, 1, fmt, ap); }
false
qemu
51b19ebe4320f3dcd93cea71235c1219318ddfd2
ssize_t virtio_pdu_vmarshal(V9fsPDU *pdu, size_t offset, const char *fmt, va_list ap) { V9fsState *s = pdu->s; V9fsVirtioState *v = container_of(s, V9fsVirtioState, state); VirtQueueElement *elem = &v->elems[pdu->idx]; return v9fs_iov_vmarshal(elem->in_sg, elem->in_num, offset, 1, fmt, ap); }
{ "code": [], "line_no": [] }
ssize_t FUNC_0(V9fsPDU *pdu, size_t offset, const char *fmt, va_list ap) { V9fsState *s = pdu->s; V9fsVirtioState *v = container_of(s, V9fsVirtioState, state); VirtQueueElement *elem = &v->elems[pdu->idx]; return v9fs_iov_vmarshal(elem->in_sg, elem->in_num, offset, 1, fmt, ap); }
[ "ssize_t FUNC_0(V9fsPDU *pdu, size_t offset,\nconst char *fmt, va_list ap)\n{", "V9fsState *s = pdu->s;", "V9fsVirtioState *v = container_of(s, V9fsVirtioState, state);", "VirtQueueElement *elem = &v->elems[pdu->idx];", "return v9fs_iov_vmarshal(elem->in_sg, elem->in_num, offset, 1, fmt, ap);", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ] ]
7,405
static void curl_multi_check_completion(BDRVCURLState *s) { int msgs_in_queue; /* Try to find done transfers, so we can free the easy * handle again. */ do { CURLMsg *msg; msg = curl_multi_info_read(s->multi, &msgs_in_queue); if (!msg) break; if (msg->msg == CURLMSG_NONE) break; switch (msg->msg) { case CURLMSG_DONE: { CURLState *state = NULL; curl_easy_getinfo(msg->easy_handle, CURLINFO_PRIVATE, (char **)&state); /* ACBs for successful messages get completed in curl_read_cb */ if (msg->data.result != CURLE_OK) { int i; for (i = 0; i < CURL_NUM_ACB; i++) { CURLAIOCB *acb = state->acb[i]; if (acb == NULL) { continue; } acb->common.cb(acb->common.opaque, -EIO); qemu_aio_release(acb); state->acb[i] = NULL; } } curl_clean_state(state); break; } default: msgs_in_queue = 0; break; } } while(msgs_in_queue); }
false
qemu
1f2cead324436da25c3607f4b957f0198a01fc01
static void curl_multi_check_completion(BDRVCURLState *s) { int msgs_in_queue; do { CURLMsg *msg; msg = curl_multi_info_read(s->multi, &msgs_in_queue); if (!msg) break; if (msg->msg == CURLMSG_NONE) break; switch (msg->msg) { case CURLMSG_DONE: { CURLState *state = NULL; curl_easy_getinfo(msg->easy_handle, CURLINFO_PRIVATE, (char **)&state); if (msg->data.result != CURLE_OK) { int i; for (i = 0; i < CURL_NUM_ACB; i++) { CURLAIOCB *acb = state->acb[i]; if (acb == NULL) { continue; } acb->common.cb(acb->common.opaque, -EIO); qemu_aio_release(acb); state->acb[i] = NULL; } } curl_clean_state(state); break; } default: msgs_in_queue = 0; break; } } while(msgs_in_queue); }
{ "code": [], "line_no": [] }
static void FUNC_0(BDRVCURLState *VAR_0) { int VAR_1; do { CURLMsg *msg; msg = curl_multi_info_read(VAR_0->multi, &VAR_1); if (!msg) break; if (msg->msg == CURLMSG_NONE) break; switch (msg->msg) { case CURLMSG_DONE: { CURLState *state = NULL; curl_easy_getinfo(msg->easy_handle, CURLINFO_PRIVATE, (char **)&state); if (msg->data.result != CURLE_OK) { int VAR_2; for (VAR_2 = 0; VAR_2 < CURL_NUM_ACB; VAR_2++) { CURLAIOCB *acb = state->acb[VAR_2]; if (acb == NULL) { continue; } acb->common.cb(acb->common.opaque, -EIO); qemu_aio_release(acb); state->acb[VAR_2] = NULL; } } curl_clean_state(state); break; } default: VAR_1 = 0; break; } } while(VAR_1); }
[ "static void FUNC_0(BDRVCURLState *VAR_0)\n{", "int VAR_1;", "do {", "CURLMsg *msg;", "msg = curl_multi_info_read(VAR_0->multi, &VAR_1);", "if (!msg)\nbreak;", "if (msg->msg == CURLMSG_NONE)\nbreak;", "switch (msg->msg) {", "case CURLMSG_DONE:\n{", "CURLState *state = NULL;", "curl_easy_getinfo(msg->easy_handle, CURLINFO_PRIVATE,\n(char **)&state);", "if (msg->data.result != CURLE_OK) {", "int VAR_2;", "for (VAR_2 = 0; VAR_2 < CURL_NUM_ACB; VAR_2++) {", "CURLAIOCB *acb = state->acb[VAR_2];", "if (acb == NULL) {", "continue;", "}", "acb->common.cb(acb->common.opaque, -EIO);", "qemu_aio_release(acb);", "state->acb[VAR_2] = NULL;", "}", "}", "curl_clean_state(state);", "break;", "}", "default:\nVAR_1 = 0;", "break;", "}", "} while(VAR_1);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 13 ], [ 15 ], [ 17 ], [ 21, 23 ], [ 25, 27 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 39, 41 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 79 ], [ 81 ], [ 83, 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ] ]
7,407
BlockDriverState *bdrv_find_backing_image(BlockDriverState *bs, const char *backing_file) { char *filename_full = NULL; char *backing_file_full = NULL; char *filename_tmp = NULL; int is_protocol = 0; BlockDriverState *curr_bs = NULL; BlockDriverState *retval = NULL; if (!bs || !bs->drv || !backing_file) { return NULL; } filename_full = g_malloc(PATH_MAX); backing_file_full = g_malloc(PATH_MAX); filename_tmp = g_malloc(PATH_MAX); is_protocol = path_has_protocol(backing_file); for (curr_bs = bs; curr_bs->backing_hd; curr_bs = curr_bs->backing_hd) { /* If either of the filename paths is actually a protocol, then * compare unmodified paths; otherwise make paths relative */ if (is_protocol || path_has_protocol(curr_bs->backing_file)) { if (strcmp(backing_file, curr_bs->backing_file) == 0) { retval = curr_bs->backing_hd; break; } } else { /* If not an absolute filename path, make it relative to the current * image's filename path */ path_combine(filename_tmp, PATH_MAX, curr_bs->filename, backing_file); /* We are going to compare absolute pathnames */ if (!realpath(filename_tmp, filename_full)) { continue; } /* We need to make sure the backing filename we are comparing against * is relative to the current image filename (or absolute) */ path_combine(filename_tmp, PATH_MAX, curr_bs->filename, curr_bs->backing_file); if (!realpath(filename_tmp, backing_file_full)) { continue; } if (strcmp(backing_file_full, filename_full) == 0) { retval = curr_bs->backing_hd; break; } } } g_free(filename_full); g_free(backing_file_full); g_free(filename_tmp); return retval; }
false
qemu
61007b316cd71ee7333ff7a0a749a8949527575f
BlockDriverState *bdrv_find_backing_image(BlockDriverState *bs, const char *backing_file) { char *filename_full = NULL; char *backing_file_full = NULL; char *filename_tmp = NULL; int is_protocol = 0; BlockDriverState *curr_bs = NULL; BlockDriverState *retval = NULL; if (!bs || !bs->drv || !backing_file) { return NULL; } filename_full = g_malloc(PATH_MAX); backing_file_full = g_malloc(PATH_MAX); filename_tmp = g_malloc(PATH_MAX); is_protocol = path_has_protocol(backing_file); for (curr_bs = bs; curr_bs->backing_hd; curr_bs = curr_bs->backing_hd) { if (is_protocol || path_has_protocol(curr_bs->backing_file)) { if (strcmp(backing_file, curr_bs->backing_file) == 0) { retval = curr_bs->backing_hd; break; } } else { path_combine(filename_tmp, PATH_MAX, curr_bs->filename, backing_file); if (!realpath(filename_tmp, filename_full)) { continue; } path_combine(filename_tmp, PATH_MAX, curr_bs->filename, curr_bs->backing_file); if (!realpath(filename_tmp, backing_file_full)) { continue; } if (strcmp(backing_file_full, filename_full) == 0) { retval = curr_bs->backing_hd; break; } } } g_free(filename_full); g_free(backing_file_full); g_free(filename_tmp); return retval; }
{ "code": [], "line_no": [] }
BlockDriverState *FUNC_0(BlockDriverState *bs, const char *backing_file) { char *VAR_0 = NULL; char *VAR_1 = NULL; char *VAR_2 = NULL; int VAR_3 = 0; BlockDriverState *curr_bs = NULL; BlockDriverState *retval = NULL; if (!bs || !bs->drv || !backing_file) { return NULL; } VAR_0 = g_malloc(PATH_MAX); VAR_1 = g_malloc(PATH_MAX); VAR_2 = g_malloc(PATH_MAX); VAR_3 = path_has_protocol(backing_file); for (curr_bs = bs; curr_bs->backing_hd; curr_bs = curr_bs->backing_hd) { if (VAR_3 || path_has_protocol(curr_bs->backing_file)) { if (strcmp(backing_file, curr_bs->backing_file) == 0) { retval = curr_bs->backing_hd; break; } } else { path_combine(VAR_2, PATH_MAX, curr_bs->filename, backing_file); if (!realpath(VAR_2, VAR_0)) { continue; } path_combine(VAR_2, PATH_MAX, curr_bs->filename, curr_bs->backing_file); if (!realpath(VAR_2, VAR_1)) { continue; } if (strcmp(VAR_1, VAR_0) == 0) { retval = curr_bs->backing_hd; break; } } } g_free(VAR_0); g_free(VAR_1); g_free(VAR_2); return retval; }
[ "BlockDriverState *FUNC_0(BlockDriverState *bs,\nconst char *backing_file)\n{", "char *VAR_0 = NULL;", "char *VAR_1 = NULL;", "char *VAR_2 = NULL;", "int VAR_3 = 0;", "BlockDriverState *curr_bs = NULL;", "BlockDriverState *retval = NULL;", "if (!bs || !bs->drv || !backing_file) {", "return NULL;", "}", "VAR_0 = g_malloc(PATH_MAX);", "VAR_1 = g_malloc(PATH_MAX);", "VAR_2 = g_malloc(PATH_MAX);", "VAR_3 = path_has_protocol(backing_file);", "for (curr_bs = bs; curr_bs->backing_hd; curr_bs = curr_bs->backing_hd) {", "if (VAR_3 || path_has_protocol(curr_bs->backing_file)) {", "if (strcmp(backing_file, curr_bs->backing_file) == 0) {", "retval = curr_bs->backing_hd;", "break;", "}", "} else {", "path_combine(VAR_2, PATH_MAX, curr_bs->filename,\nbacking_file);", "if (!realpath(VAR_2, VAR_0)) {", "continue;", "}", "path_combine(VAR_2, PATH_MAX, curr_bs->filename,\ncurr_bs->backing_file);", "if (!realpath(VAR_2, VAR_1)) {", "continue;", "}", "if (strcmp(VAR_1, VAR_0) == 0) {", "retval = curr_bs->backing_hd;", "break;", "}", "}", "}", "g_free(VAR_0);", "g_free(VAR_1);", "g_free(VAR_2);", "return retval;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 41 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 65, 67 ], [ 73 ], [ 75 ], [ 77 ], [ 85, 87 ], [ 91 ], [ 93 ], [ 95 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ] ]
7,408
iscsi_set_events(IscsiLun *iscsilun) { struct iscsi_context *iscsi = iscsilun->iscsi; int ev; /* We always register a read handler. */ ev = POLLIN; ev |= iscsi_which_events(iscsi); if (ev != iscsilun->events) { aio_set_fd_handler(iscsilun->aio_context, iscsi_get_fd(iscsi), iscsi_process_read, (ev & POLLOUT) ? iscsi_process_write : NULL, iscsilun); } iscsilun->events = ev; }
false
qemu
05b685fbabb7fdcab72cb42b27db916fd74b2265
iscsi_set_events(IscsiLun *iscsilun) { struct iscsi_context *iscsi = iscsilun->iscsi; int ev; ev = POLLIN; ev |= iscsi_which_events(iscsi); if (ev != iscsilun->events) { aio_set_fd_handler(iscsilun->aio_context, iscsi_get_fd(iscsi), iscsi_process_read, (ev & POLLOUT) ? iscsi_process_write : NULL, iscsilun); } iscsilun->events = ev; }
{ "code": [], "line_no": [] }
FUNC_0(IscsiLun *VAR_0) { struct iscsi_context *VAR_1 = VAR_0->VAR_1; int VAR_2; VAR_2 = POLLIN; VAR_2 |= iscsi_which_events(VAR_1); if (VAR_2 != VAR_0->events) { aio_set_fd_handler(VAR_0->aio_context, iscsi_get_fd(VAR_1), iscsi_process_read, (VAR_2 & POLLOUT) ? iscsi_process_write : NULL, VAR_0); } VAR_0->events = VAR_2; }
[ "FUNC_0(IscsiLun *VAR_0)\n{", "struct iscsi_context *VAR_1 = VAR_0->VAR_1;", "int VAR_2;", "VAR_2 = POLLIN;", "VAR_2 |= iscsi_which_events(VAR_1);", "if (VAR_2 != VAR_0->events) {", "aio_set_fd_handler(VAR_0->aio_context,\niscsi_get_fd(VAR_1),\niscsi_process_read,\n(VAR_2 & POLLOUT) ? iscsi_process_write : NULL,\nVAR_0);", "}", "VAR_0->events = VAR_2;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 13 ], [ 15 ], [ 17 ], [ 19, 21, 23, 25, 27 ], [ 31 ], [ 35 ], [ 37 ] ]
7,409
void s390_program_interrupt(CPUS390XState *env, uint32_t code, int ilen, uintptr_t ra) { #ifdef CONFIG_TCG S390CPU *cpu = s390_env_get_cpu(env); if (tcg_enabled()) { cpu_restore_state(CPU(cpu), ra); } #endif program_interrupt(env, code, ilen); }
false
qemu
51dcdbd319f8d46834d8155defc8d384a9958a73
void s390_program_interrupt(CPUS390XState *env, uint32_t code, int ilen, uintptr_t ra) { #ifdef CONFIG_TCG S390CPU *cpu = s390_env_get_cpu(env); if (tcg_enabled()) { cpu_restore_state(CPU(cpu), ra); } #endif program_interrupt(env, code, ilen); }
{ "code": [], "line_no": [] }
void FUNC_0(CPUS390XState *VAR_0, uint32_t VAR_1, int VAR_2, uintptr_t VAR_3) { #ifdef CONFIG_TCG S390CPU *cpu = s390_env_get_cpu(VAR_0); if (tcg_enabled()) { cpu_restore_state(CPU(cpu), VAR_3); } #endif program_interrupt(VAR_0, VAR_1, VAR_2); }
[ "void FUNC_0(CPUS390XState *VAR_0, uint32_t VAR_1, int VAR_2,\nuintptr_t VAR_3)\n{", "#ifdef CONFIG_TCG\nS390CPU *cpu = s390_env_get_cpu(VAR_0);", "if (tcg_enabled()) {", "cpu_restore_state(CPU(cpu), VAR_3);", "}", "#endif\nprogram_interrupt(VAR_0, VAR_1, VAR_2);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7, 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19, 21 ], [ 23 ] ]
7,410
static void ipmi_sim_realize(DeviceState *dev, Error **errp) { IPMIBmc *b = IPMI_BMC(dev); unsigned int i; IPMIBmcSim *ibs = IPMI_BMC_SIMULATOR(b); qemu_mutex_init(&ibs->lock); QTAILQ_INIT(&ibs->rcvbufs); ibs->bmc_global_enables = (1 << IPMI_BMC_EVENT_LOG_BIT); ibs->device_id = 0x20; ibs->ipmi_version = 0x02; /* IPMI 2.0 */ ibs->restart_cause = 0; for (i = 0; i < 4; i++) { ibs->sel.last_addition[i] = 0xff; ibs->sel.last_clear[i] = 0xff; ibs->sdr.last_addition[i] = 0xff; ibs->sdr.last_clear[i] = 0xff; } ipmi_sdr_init(ibs); ibs->acpi_power_state[0] = 0; ibs->acpi_power_state[1] = 0; if (qemu_uuid_set) { memcpy(&ibs->uuid, qemu_uuid, 16); } else { memset(&ibs->uuid, 0, 16); } ipmi_init_sensors_from_sdrs(ibs); register_cmds(ibs); ibs->timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, ipmi_timeout, ibs); vmstate_register(NULL, 0, &vmstate_ipmi_sim, ibs); }
false
qemu
9c5ce8db2e5c2769ed2fd3d91928dd1853b5ce7c
static void ipmi_sim_realize(DeviceState *dev, Error **errp) { IPMIBmc *b = IPMI_BMC(dev); unsigned int i; IPMIBmcSim *ibs = IPMI_BMC_SIMULATOR(b); qemu_mutex_init(&ibs->lock); QTAILQ_INIT(&ibs->rcvbufs); ibs->bmc_global_enables = (1 << IPMI_BMC_EVENT_LOG_BIT); ibs->device_id = 0x20; ibs->ipmi_version = 0x02; ibs->restart_cause = 0; for (i = 0; i < 4; i++) { ibs->sel.last_addition[i] = 0xff; ibs->sel.last_clear[i] = 0xff; ibs->sdr.last_addition[i] = 0xff; ibs->sdr.last_clear[i] = 0xff; } ipmi_sdr_init(ibs); ibs->acpi_power_state[0] = 0; ibs->acpi_power_state[1] = 0; if (qemu_uuid_set) { memcpy(&ibs->uuid, qemu_uuid, 16); } else { memset(&ibs->uuid, 0, 16); } ipmi_init_sensors_from_sdrs(ibs); register_cmds(ibs); ibs->timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, ipmi_timeout, ibs); vmstate_register(NULL, 0, &vmstate_ipmi_sim, ibs); }
{ "code": [], "line_no": [] }
static void FUNC_0(DeviceState *VAR_0, Error **VAR_1) { IPMIBmc *b = IPMI_BMC(VAR_0); unsigned int VAR_2; IPMIBmcSim *ibs = IPMI_BMC_SIMULATOR(b); qemu_mutex_init(&ibs->lock); QTAILQ_INIT(&ibs->rcvbufs); ibs->bmc_global_enables = (1 << IPMI_BMC_EVENT_LOG_BIT); ibs->device_id = 0x20; ibs->ipmi_version = 0x02; ibs->restart_cause = 0; for (VAR_2 = 0; VAR_2 < 4; VAR_2++) { ibs->sel.last_addition[VAR_2] = 0xff; ibs->sel.last_clear[VAR_2] = 0xff; ibs->sdr.last_addition[VAR_2] = 0xff; ibs->sdr.last_clear[VAR_2] = 0xff; } ipmi_sdr_init(ibs); ibs->acpi_power_state[0] = 0; ibs->acpi_power_state[1] = 0; if (qemu_uuid_set) { memcpy(&ibs->uuid, qemu_uuid, 16); } else { memset(&ibs->uuid, 0, 16); } ipmi_init_sensors_from_sdrs(ibs); register_cmds(ibs); ibs->timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, ipmi_timeout, ibs); vmstate_register(NULL, 0, &vmstate_ipmi_sim, ibs); }
[ "static void FUNC_0(DeviceState *VAR_0, Error **VAR_1)\n{", "IPMIBmc *b = IPMI_BMC(VAR_0);", "unsigned int VAR_2;", "IPMIBmcSim *ibs = IPMI_BMC_SIMULATOR(b);", "qemu_mutex_init(&ibs->lock);", "QTAILQ_INIT(&ibs->rcvbufs);", "ibs->bmc_global_enables = (1 << IPMI_BMC_EVENT_LOG_BIT);", "ibs->device_id = 0x20;", "ibs->ipmi_version = 0x02;", "ibs->restart_cause = 0;", "for (VAR_2 = 0; VAR_2 < 4; VAR_2++) {", "ibs->sel.last_addition[VAR_2] = 0xff;", "ibs->sel.last_clear[VAR_2] = 0xff;", "ibs->sdr.last_addition[VAR_2] = 0xff;", "ibs->sdr.last_clear[VAR_2] = 0xff;", "}", "ipmi_sdr_init(ibs);", "ibs->acpi_power_state[0] = 0;", "ibs->acpi_power_state[1] = 0;", "if (qemu_uuid_set) {", "memcpy(&ibs->uuid, qemu_uuid, 16);", "} else {", "memset(&ibs->uuid, 0, 16);", "}", "ipmi_init_sensors_from_sdrs(ibs);", "register_cmds(ibs);", "ibs->timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, ipmi_timeout, ibs);", "vmstate_register(NULL, 0, &vmstate_ipmi_sim, ibs);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 69 ], [ 73 ], [ 75 ] ]
7,411
static void spapr_machine_2_3_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); mc->name = "pseries-2.3"; mc->desc = "pSeries Logical Partition (PAPR compliant) v2.3"; mc->alias = "pseries"; mc->is_default = 1; }
false
qemu
d25228e7befac33b665cd9250292de47ae6b78b5
static void spapr_machine_2_3_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); mc->name = "pseries-2.3"; mc->desc = "pSeries Logical Partition (PAPR compliant) v2.3"; mc->alias = "pseries"; mc->is_default = 1; }
{ "code": [], "line_no": [] }
static void FUNC_0(ObjectClass *VAR_0, void *VAR_1) { MachineClass *mc = MACHINE_CLASS(VAR_0); mc->name = "pseries-2.3"; mc->desc = "pSeries Logical Partition (PAPR compliant) v2.3"; mc->alias = "pseries"; mc->is_default = 1; }
[ "static void FUNC_0(ObjectClass *VAR_0, void *VAR_1)\n{", "MachineClass *mc = MACHINE_CLASS(VAR_0);", "mc->name = \"pseries-2.3\";", "mc->desc = \"pSeries Logical Partition (PAPR compliant) v2.3\";", "mc->alias = \"pseries\";", "mc->is_default = 1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ] ]
7,412
static int l2_allocate(BlockDriverState *bs, int l1_index, uint64_t **table) { BDRVQcowState *s = bs->opaque; uint64_t old_l2_offset; uint64_t *l2_table; int64_t l2_offset; int ret; old_l2_offset = s->l1_table[l1_index]; trace_qcow2_l2_allocate(bs, l1_index); /* allocate a new l2 entry */ l2_offset = qcow2_alloc_clusters(bs, s->l2_size * sizeof(uint64_t)); if (l2_offset < 0) { return l2_offset; } ret = qcow2_cache_flush(bs, s->refcount_block_cache); if (ret < 0) { goto fail; } /* allocate a new entry in the l2 cache */ trace_qcow2_l2_allocate_get_empty(bs, l1_index); ret = qcow2_cache_get_empty(bs, s->l2_table_cache, l2_offset, (void**) table); if (ret < 0) { return ret; } l2_table = *table; if ((old_l2_offset & L1E_OFFSET_MASK) == 0) { /* if there was no old l2 table, clear the new table */ memset(l2_table, 0, s->l2_size * sizeof(uint64_t)); } else { uint64_t* old_table; /* if there was an old l2 table, read it from the disk */ BLKDBG_EVENT(bs->file, BLKDBG_L2_ALLOC_COW_READ); ret = qcow2_cache_get(bs, s->l2_table_cache, old_l2_offset & L1E_OFFSET_MASK, (void**) &old_table); if (ret < 0) { goto fail; } memcpy(l2_table, old_table, s->cluster_size); ret = qcow2_cache_put(bs, s->l2_table_cache, (void**) &old_table); if (ret < 0) { goto fail; } } /* write the l2 table to the file */ BLKDBG_EVENT(bs->file, BLKDBG_L2_ALLOC_WRITE); trace_qcow2_l2_allocate_write_l2(bs, l1_index); qcow2_cache_entry_mark_dirty(s->l2_table_cache, l2_table); ret = qcow2_cache_flush(bs, s->l2_table_cache); if (ret < 0) { goto fail; } /* update the L1 entry */ trace_qcow2_l2_allocate_write_l1(bs, l1_index); s->l1_table[l1_index] = l2_offset | QCOW_OFLAG_COPIED; ret = write_l1_entry(bs, l1_index); if (ret < 0) { goto fail; } *table = l2_table; trace_qcow2_l2_allocate_done(bs, l1_index, 0); return 0; fail: trace_qcow2_l2_allocate_done(bs, l1_index, ret); qcow2_cache_put(bs, s->l2_table_cache, (void**) table); s->l1_table[l1_index] = old_l2_offset; return ret; }
false
qemu
e23e400ec62a03dea58ddb38479b4f1ef86f556d
static int l2_allocate(BlockDriverState *bs, int l1_index, uint64_t **table) { BDRVQcowState *s = bs->opaque; uint64_t old_l2_offset; uint64_t *l2_table; int64_t l2_offset; int ret; old_l2_offset = s->l1_table[l1_index]; trace_qcow2_l2_allocate(bs, l1_index); l2_offset = qcow2_alloc_clusters(bs, s->l2_size * sizeof(uint64_t)); if (l2_offset < 0) { return l2_offset; } ret = qcow2_cache_flush(bs, s->refcount_block_cache); if (ret < 0) { goto fail; } trace_qcow2_l2_allocate_get_empty(bs, l1_index); ret = qcow2_cache_get_empty(bs, s->l2_table_cache, l2_offset, (void**) table); if (ret < 0) { return ret; } l2_table = *table; if ((old_l2_offset & L1E_OFFSET_MASK) == 0) { memset(l2_table, 0, s->l2_size * sizeof(uint64_t)); } else { uint64_t* old_table; BLKDBG_EVENT(bs->file, BLKDBG_L2_ALLOC_COW_READ); ret = qcow2_cache_get(bs, s->l2_table_cache, old_l2_offset & L1E_OFFSET_MASK, (void**) &old_table); if (ret < 0) { goto fail; } memcpy(l2_table, old_table, s->cluster_size); ret = qcow2_cache_put(bs, s->l2_table_cache, (void**) &old_table); if (ret < 0) { goto fail; } } BLKDBG_EVENT(bs->file, BLKDBG_L2_ALLOC_WRITE); trace_qcow2_l2_allocate_write_l2(bs, l1_index); qcow2_cache_entry_mark_dirty(s->l2_table_cache, l2_table); ret = qcow2_cache_flush(bs, s->l2_table_cache); if (ret < 0) { goto fail; } trace_qcow2_l2_allocate_write_l1(bs, l1_index); s->l1_table[l1_index] = l2_offset | QCOW_OFLAG_COPIED; ret = write_l1_entry(bs, l1_index); if (ret < 0) { goto fail; } *table = l2_table; trace_qcow2_l2_allocate_done(bs, l1_index, 0); return 0; fail: trace_qcow2_l2_allocate_done(bs, l1_index, ret); qcow2_cache_put(bs, s->l2_table_cache, (void**) table); s->l1_table[l1_index] = old_l2_offset; return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(BlockDriverState *VAR_0, int VAR_1, uint64_t **VAR_2) { BDRVQcowState *s = VAR_0->opaque; uint64_t old_l2_offset; uint64_t *l2_table; int64_t l2_offset; int VAR_3; old_l2_offset = s->l1_table[VAR_1]; trace_qcow2_l2_allocate(VAR_0, VAR_1); l2_offset = qcow2_alloc_clusters(VAR_0, s->l2_size * sizeof(uint64_t)); if (l2_offset < 0) { return l2_offset; } VAR_3 = qcow2_cache_flush(VAR_0, s->refcount_block_cache); if (VAR_3 < 0) { goto fail; } trace_qcow2_l2_allocate_get_empty(VAR_0, VAR_1); VAR_3 = qcow2_cache_get_empty(VAR_0, s->l2_table_cache, l2_offset, (void**) VAR_2); if (VAR_3 < 0) { return VAR_3; } l2_table = *VAR_2; if ((old_l2_offset & L1E_OFFSET_MASK) == 0) { memset(l2_table, 0, s->l2_size * sizeof(uint64_t)); } else { uint64_t* old_table; BLKDBG_EVENT(VAR_0->file, BLKDBG_L2_ALLOC_COW_READ); VAR_3 = qcow2_cache_get(VAR_0, s->l2_table_cache, old_l2_offset & L1E_OFFSET_MASK, (void**) &old_table); if (VAR_3 < 0) { goto fail; } memcpy(l2_table, old_table, s->cluster_size); VAR_3 = qcow2_cache_put(VAR_0, s->l2_table_cache, (void**) &old_table); if (VAR_3 < 0) { goto fail; } } BLKDBG_EVENT(VAR_0->file, BLKDBG_L2_ALLOC_WRITE); trace_qcow2_l2_allocate_write_l2(VAR_0, VAR_1); qcow2_cache_entry_mark_dirty(s->l2_table_cache, l2_table); VAR_3 = qcow2_cache_flush(VAR_0, s->l2_table_cache); if (VAR_3 < 0) { goto fail; } trace_qcow2_l2_allocate_write_l1(VAR_0, VAR_1); s->l1_table[VAR_1] = l2_offset | QCOW_OFLAG_COPIED; VAR_3 = write_l1_entry(VAR_0, VAR_1); if (VAR_3 < 0) { goto fail; } *VAR_2 = l2_table; trace_qcow2_l2_allocate_done(VAR_0, VAR_1, 0); return 0; fail: trace_qcow2_l2_allocate_done(VAR_0, VAR_1, VAR_3); qcow2_cache_put(VAR_0, s->l2_table_cache, (void**) VAR_2); s->l1_table[VAR_1] = old_l2_offset; return VAR_3; }
[ "static int FUNC_0(BlockDriverState *VAR_0, int VAR_1, uint64_t **VAR_2)\n{", "BDRVQcowState *s = VAR_0->opaque;", "uint64_t old_l2_offset;", "uint64_t *l2_table;", "int64_t l2_offset;", "int VAR_3;", "old_l2_offset = s->l1_table[VAR_1];", "trace_qcow2_l2_allocate(VAR_0, VAR_1);", "l2_offset = qcow2_alloc_clusters(VAR_0, s->l2_size * sizeof(uint64_t));", "if (l2_offset < 0) {", "return l2_offset;", "}", "VAR_3 = qcow2_cache_flush(VAR_0, s->refcount_block_cache);", "if (VAR_3 < 0) {", "goto fail;", "}", "trace_qcow2_l2_allocate_get_empty(VAR_0, VAR_1);", "VAR_3 = qcow2_cache_get_empty(VAR_0, s->l2_table_cache, l2_offset, (void**) VAR_2);", "if (VAR_3 < 0) {", "return VAR_3;", "}", "l2_table = *VAR_2;", "if ((old_l2_offset & L1E_OFFSET_MASK) == 0) {", "memset(l2_table, 0, s->l2_size * sizeof(uint64_t));", "} else {", "uint64_t* old_table;", "BLKDBG_EVENT(VAR_0->file, BLKDBG_L2_ALLOC_COW_READ);", "VAR_3 = qcow2_cache_get(VAR_0, s->l2_table_cache,\nold_l2_offset & L1E_OFFSET_MASK,\n(void**) &old_table);", "if (VAR_3 < 0) {", "goto fail;", "}", "memcpy(l2_table, old_table, s->cluster_size);", "VAR_3 = qcow2_cache_put(VAR_0, s->l2_table_cache, (void**) &old_table);", "if (VAR_3 < 0) {", "goto fail;", "}", "}", "BLKDBG_EVENT(VAR_0->file, BLKDBG_L2_ALLOC_WRITE);", "trace_qcow2_l2_allocate_write_l2(VAR_0, VAR_1);", "qcow2_cache_entry_mark_dirty(s->l2_table_cache, l2_table);", "VAR_3 = qcow2_cache_flush(VAR_0, s->l2_table_cache);", "if (VAR_3 < 0) {", "goto fail;", "}", "trace_qcow2_l2_allocate_write_l1(VAR_0, VAR_1);", "s->l1_table[VAR_1] = l2_offset | QCOW_OFLAG_COPIED;", "VAR_3 = write_l1_entry(VAR_0, VAR_1);", "if (VAR_3 < 0) {", "goto fail;", "}", "*VAR_2 = l2_table;", "trace_qcow2_l2_allocate_done(VAR_0, VAR_1, 0);", "return 0;", "fail:\ntrace_qcow2_l2_allocate_done(VAR_0, VAR_1, VAR_3);", "qcow2_cache_put(VAR_0, s->l2_table_cache, (void**) VAR_2);", "s->l1_table[VAR_1] = old_l2_offset;", "return VAR_3;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 21 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 69 ], [ 73 ], [ 75 ], [ 77 ], [ 83 ], [ 85, 87, 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 117 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 151 ], [ 153 ], [ 155 ], [ 159, 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ] ]
7,413
static inline direntry_t* create_short_and_long_name(BDRVVVFATState* s, unsigned int directory_start, const char* filename, int is_dot) { int i,j,long_index=s->directory.next; direntry_t* entry = NULL; direntry_t* entry_long = NULL; if(is_dot) { entry=array_get_next(&(s->directory)); memset(entry->name,0x20,11); memcpy(entry->name,filename,strlen(filename)); return entry; } entry_long=create_long_filename(s,filename); i = strlen(filename); for(j = i - 1; j>0 && filename[j]!='.';j--); if (j > 0) i = (j > 8 ? 8 : j); else if (i > 8) i = 8; entry=array_get_next(&(s->directory)); memset(entry->name,0x20,11); memcpy(entry->name, filename, i); if(j > 0) for (i = 0; i < 3 && filename[j+1+i]; i++) entry->extension[i] = filename[j+1+i]; /* upcase & remove unwanted characters */ for(i=10;i>=0;i--) { if(i==10 || i==7) for(;i>0 && entry->name[i]==' ';i--); if(entry->name[i]<=' ' || entry->name[i]>0x7f || strchr(".*?<>|\":/\\[];,+='",entry->name[i])) entry->name[i]='_'; else if(entry->name[i]>='a' && entry->name[i]<='z') entry->name[i]+='A'-'a'; } /* mangle duplicates */ while(1) { direntry_t* entry1=array_get(&(s->directory),directory_start); int j; for(;entry1<entry;entry1++) if(!is_long_name(entry1) && !memcmp(entry1->name,entry->name,11)) break; /* found dupe */ if(entry1==entry) /* no dupe found */ break; /* use all 8 characters of name */ if(entry->name[7]==' ') { int j; for(j=6;j>0 && entry->name[j]==' ';j--) entry->name[j]='~'; } /* increment number */ for(j=7;j>0 && entry->name[j]=='9';j--) entry->name[j]='0'; if(j>0) { if(entry->name[j]<'0' || entry->name[j]>'9') entry->name[j]='0'; else entry->name[j]++; } } /* calculate checksum; propagate to long name */ if(entry_long) { uint8_t chksum=fat_chksum(entry); /* calculate anew, because realloc could have taken place */ entry_long=array_get(&(s->directory),long_index); while(entry_long<entry && is_long_name(entry_long)) { entry_long->reserved[1]=chksum; entry_long++; } } return entry; }
false
qemu
f671d173c7e1da555b693e8b14f3ed0852601809
static inline direntry_t* create_short_and_long_name(BDRVVVFATState* s, unsigned int directory_start, const char* filename, int is_dot) { int i,j,long_index=s->directory.next; direntry_t* entry = NULL; direntry_t* entry_long = NULL; if(is_dot) { entry=array_get_next(&(s->directory)); memset(entry->name,0x20,11); memcpy(entry->name,filename,strlen(filename)); return entry; } entry_long=create_long_filename(s,filename); i = strlen(filename); for(j = i - 1; j>0 && filename[j]!='.';j--); if (j > 0) i = (j > 8 ? 8 : j); else if (i > 8) i = 8; entry=array_get_next(&(s->directory)); memset(entry->name,0x20,11); memcpy(entry->name, filename, i); if(j > 0) for (i = 0; i < 3 && filename[j+1+i]; i++) entry->extension[i] = filename[j+1+i]; for(i=10;i>=0;i--) { if(i==10 || i==7) for(;i>0 && entry->name[i]==' ';i--); if(entry->name[i]<=' ' || entry->name[i]>0x7f || strchr(".*?<>|\":/\\[];,+='",entry->name[i])) entry->name[i]='_'; else if(entry->name[i]>='a' && entry->name[i]<='z') entry->name[i]+='A'-'a'; } while(1) { direntry_t* entry1=array_get(&(s->directory),directory_start); int j; for(;entry1<entry;entry1++) if(!is_long_name(entry1) && !memcmp(entry1->name,entry->name,11)) break; if(entry1==entry) break; if(entry->name[7]==' ') { int j; for(j=6;j>0 && entry->name[j]==' ';j--) entry->name[j]='~'; } for(j=7;j>0 && entry->name[j]=='9';j--) entry->name[j]='0'; if(j>0) { if(entry->name[j]<'0' || entry->name[j]>'9') entry->name[j]='0'; else entry->name[j]++; } } if(entry_long) { uint8_t chksum=fat_chksum(entry); entry_long=array_get(&(s->directory),long_index); while(entry_long<entry && is_long_name(entry_long)) { entry_long->reserved[1]=chksum; entry_long++; } } return entry; }
{ "code": [], "line_no": [] }
static inline direntry_t* FUNC_0(BDRVVVFATState* s, unsigned int directory_start, const char* filename, int is_dot) { int VAR_0,VAR_3,VAR_2=s->directory.next; direntry_t* entry = NULL; direntry_t* entry_long = NULL; if(is_dot) { entry=array_get_next(&(s->directory)); memset(entry->name,0x20,11); memcpy(entry->name,filename,strlen(filename)); return entry; } entry_long=create_long_filename(s,filename); VAR_0 = strlen(filename); for(VAR_3 = VAR_0 - 1; VAR_3>0 && filename[VAR_3]!='.';VAR_3--); if (VAR_3 > 0) VAR_0 = (VAR_3 > 8 ? 8 : VAR_3); else if (VAR_0 > 8) VAR_0 = 8; entry=array_get_next(&(s->directory)); memset(entry->name,0x20,11); memcpy(entry->name, filename, VAR_0); if(VAR_3 > 0) for (VAR_0 = 0; VAR_0 < 3 && filename[VAR_3+1+VAR_0]; VAR_0++) entry->extension[VAR_0] = filename[VAR_3+1+VAR_0]; for(VAR_0=10;VAR_0>=0;VAR_0--) { if(VAR_0==10 || VAR_0==7) for(;VAR_0>0 && entry->name[VAR_0]==' ';VAR_0--); if(entry->name[VAR_0]<=' ' || entry->name[VAR_0]>0x7f || strchr(".*?<>|\":/\\[];,+='",entry->name[VAR_0])) entry->name[VAR_0]='_'; else if(entry->name[VAR_0]>='a' && entry->name[VAR_0]<='z') entry->name[VAR_0]+='A'-'a'; } while(1) { direntry_t* entry1=array_get(&(s->directory),directory_start); int VAR_3; for(;entry1<entry;entry1++) if(!is_long_name(entry1) && !memcmp(entry1->name,entry->name,11)) break; if(entry1==entry) break; if(entry->name[7]==' ') { int VAR_3; for(VAR_3=6;VAR_3>0 && entry->name[VAR_3]==' ';VAR_3--) entry->name[VAR_3]='~'; } for(VAR_3=7;VAR_3>0 && entry->name[VAR_3]=='9';VAR_3--) entry->name[VAR_3]='0'; if(VAR_3>0) { if(entry->name[VAR_3]<'0' || entry->name[VAR_3]>'9') entry->name[VAR_3]='0'; else entry->name[VAR_3]++; } } if(entry_long) { uint8_t chksum=fat_chksum(entry); entry_long=array_get(&(s->directory),VAR_2); while(entry_long<entry && is_long_name(entry_long)) { entry_long->reserved[1]=chksum; entry_long++; } } return entry; }
[ "static inline direntry_t* FUNC_0(BDRVVVFATState* s,\nunsigned int directory_start, const char* filename, int is_dot)\n{", "int VAR_0,VAR_3,VAR_2=s->directory.next;", "direntry_t* entry = NULL;", "direntry_t* entry_long = NULL;", "if(is_dot) {", "entry=array_get_next(&(s->directory));", "memset(entry->name,0x20,11);", "memcpy(entry->name,filename,strlen(filename));", "return entry;", "}", "entry_long=create_long_filename(s,filename);", "VAR_0 = strlen(filename);", "for(VAR_3 = VAR_0 - 1; VAR_3>0 && filename[VAR_3]!='.';VAR_3--);", "if (VAR_3 > 0)\nVAR_0 = (VAR_3 > 8 ? 8 : VAR_3);", "else if (VAR_0 > 8)\nVAR_0 = 8;", "entry=array_get_next(&(s->directory));", "memset(entry->name,0x20,11);", "memcpy(entry->name, filename, VAR_0);", "if(VAR_3 > 0)\nfor (VAR_0 = 0; VAR_0 < 3 && filename[VAR_3+1+VAR_0]; VAR_0++)", "entry->extension[VAR_0] = filename[VAR_3+1+VAR_0];", "for(VAR_0=10;VAR_0>=0;VAR_0--) {", "if(VAR_0==10 || VAR_0==7) for(;VAR_0>0 && entry->name[VAR_0]==' ';VAR_0--);", "if(entry->name[VAR_0]<=' ' || entry->name[VAR_0]>0x7f\n|| strchr(\".*?<>|\\\":/\\\\[];,+='\",entry->name[VAR_0]))", "entry->name[VAR_0]='_';", "else if(entry->name[VAR_0]>='a' && entry->name[VAR_0]<='z')\nentry->name[VAR_0]+='A'-'a';", "}", "while(1) {", "direntry_t* entry1=array_get(&(s->directory),directory_start);", "int VAR_3;", "for(;entry1<entry;entry1++)", "if(!is_long_name(entry1) && !memcmp(entry1->name,entry->name,11))\nbreak;", "if(entry1==entry)\nbreak;", "if(entry->name[7]==' ') {", "int VAR_3;", "for(VAR_3=6;VAR_3>0 && entry->name[VAR_3]==' ';VAR_3--)", "entry->name[VAR_3]='~';", "}", "for(VAR_3=7;VAR_3>0 && entry->name[VAR_3]=='9';VAR_3--)", "entry->name[VAR_3]='0';", "if(VAR_3>0) {", "if(entry->name[VAR_3]<'0' || entry->name[VAR_3]>'9')\nentry->name[VAR_3]='0';", "else\nentry->name[VAR_3]++;", "}", "}", "if(entry_long) {", "uint8_t chksum=fat_chksum(entry);", "entry_long=array_get(&(s->directory),VAR_2);", "while(entry_long<entry && is_long_name(entry_long)) {", "entry_long->reserved[1]=chksum;", "entry_long++;", "}", "}", "return entry;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 29 ], [ 33 ], [ 35 ], [ 37, 39 ], [ 41, 43 ], [ 47 ], [ 49 ], [ 51 ], [ 55, 57 ], [ 59 ], [ 65 ], [ 67 ], [ 69, 71 ], [ 73 ], [ 75, 77 ], [ 79 ], [ 85 ], [ 87 ], [ 89 ], [ 93 ], [ 95, 97 ], [ 99, 101 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 121 ], [ 123 ], [ 125 ], [ 127, 129 ], [ 131, 133 ], [ 135 ], [ 137 ], [ 143 ], [ 145 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 165 ], [ 167 ] ]
7,414
int coroutine_fn bdrv_co_flush(BlockDriverState *bs) { int ret; if (!bs || !bdrv_is_inserted(bs) || bdrv_is_read_only(bs)) { return 0; } /* Write back cached data to the OS even with cache=unsafe */ BLKDBG_EVENT(bs->file, BLKDBG_FLUSH_TO_OS); if (bs->drv->bdrv_co_flush_to_os) { ret = bs->drv->bdrv_co_flush_to_os(bs); if (ret < 0) { return ret; } } /* But don't actually force it to the disk with cache=unsafe */ if (bs->open_flags & BDRV_O_NO_FLUSH) { goto flush_parent; } BLKDBG_EVENT(bs->file, BLKDBG_FLUSH_TO_DISK); if (bs->drv->bdrv_co_flush_to_disk) { ret = bs->drv->bdrv_co_flush_to_disk(bs); } else if (bs->drv->bdrv_aio_flush) { BlockAIOCB *acb; CoroutineIOCompletion co = { .coroutine = qemu_coroutine_self(), }; acb = bs->drv->bdrv_aio_flush(bs, bdrv_co_io_em_complete, &co); if (acb == NULL) { ret = -EIO; } else { qemu_coroutine_yield(); ret = co.ret; } } else { /* * Some block drivers always operate in either writethrough or unsafe * mode and don't support bdrv_flush therefore. Usually qemu doesn't * know how the server works (because the behaviour is hardcoded or * depends on server-side configuration), so we can't ensure that * everything is safe on disk. Returning an error doesn't work because * that would break guests even if the server operates in writethrough * mode. * * Let's hope the user knows what he's doing. */ ret = 0; } if (ret < 0) { return ret; } /* Now flush the underlying protocol. It will also have BDRV_O_NO_FLUSH * in the case of cache=unsafe, so there are no useless flushes. */ flush_parent: return bdrv_co_flush(bs->file); }
false
qemu
61007b316cd71ee7333ff7a0a749a8949527575f
int coroutine_fn bdrv_co_flush(BlockDriverState *bs) { int ret; if (!bs || !bdrv_is_inserted(bs) || bdrv_is_read_only(bs)) { return 0; } BLKDBG_EVENT(bs->file, BLKDBG_FLUSH_TO_OS); if (bs->drv->bdrv_co_flush_to_os) { ret = bs->drv->bdrv_co_flush_to_os(bs); if (ret < 0) { return ret; } } if (bs->open_flags & BDRV_O_NO_FLUSH) { goto flush_parent; } BLKDBG_EVENT(bs->file, BLKDBG_FLUSH_TO_DISK); if (bs->drv->bdrv_co_flush_to_disk) { ret = bs->drv->bdrv_co_flush_to_disk(bs); } else if (bs->drv->bdrv_aio_flush) { BlockAIOCB *acb; CoroutineIOCompletion co = { .coroutine = qemu_coroutine_self(), }; acb = bs->drv->bdrv_aio_flush(bs, bdrv_co_io_em_complete, &co); if (acb == NULL) { ret = -EIO; } else { qemu_coroutine_yield(); ret = co.ret; } } else { ret = 0; } if (ret < 0) { return ret; } flush_parent: return bdrv_co_flush(bs->file); }
{ "code": [], "line_no": [] }
int VAR_0 bdrv_co_flush(BlockDriverState *bs) { int ret; if (!bs || !bdrv_is_inserted(bs) || bdrv_is_read_only(bs)) { return 0; } BLKDBG_EVENT(bs->file, BLKDBG_FLUSH_TO_OS); if (bs->drv->bdrv_co_flush_to_os) { ret = bs->drv->bdrv_co_flush_to_os(bs); if (ret < 0) { return ret; } } if (bs->open_flags & BDRV_O_NO_FLUSH) { goto flush_parent; } BLKDBG_EVENT(bs->file, BLKDBG_FLUSH_TO_DISK); if (bs->drv->bdrv_co_flush_to_disk) { ret = bs->drv->bdrv_co_flush_to_disk(bs); } else if (bs->drv->bdrv_aio_flush) { BlockAIOCB *acb; CoroutineIOCompletion co = { .coroutine = qemu_coroutine_self(), }; acb = bs->drv->bdrv_aio_flush(bs, bdrv_co_io_em_complete, &co); if (acb == NULL) { ret = -EIO; } else { qemu_coroutine_yield(); ret = co.ret; } } else { ret = 0; } if (ret < 0) { return ret; } flush_parent: return bdrv_co_flush(bs->file); }
[ "int VAR_0 bdrv_co_flush(BlockDriverState *bs)\n{", "int ret;", "if (!bs || !bdrv_is_inserted(bs) || bdrv_is_read_only(bs)) {", "return 0;", "}", "BLKDBG_EVENT(bs->file, BLKDBG_FLUSH_TO_OS);", "if (bs->drv->bdrv_co_flush_to_os) {", "ret = bs->drv->bdrv_co_flush_to_os(bs);", "if (ret < 0) {", "return ret;", "}", "}", "if (bs->open_flags & BDRV_O_NO_FLUSH) {", "goto flush_parent;", "}", "BLKDBG_EVENT(bs->file, BLKDBG_FLUSH_TO_DISK);", "if (bs->drv->bdrv_co_flush_to_disk) {", "ret = bs->drv->bdrv_co_flush_to_disk(bs);", "} else if (bs->drv->bdrv_aio_flush) {", "BlockAIOCB *acb;", "CoroutineIOCompletion co = {", ".coroutine = qemu_coroutine_self(),\n};", "acb = bs->drv->bdrv_aio_flush(bs, bdrv_co_io_em_complete, &co);", "if (acb == NULL) {", "ret = -EIO;", "} else {", "qemu_coroutine_yield();", "ret = co.ret;", "}", "} else {", "ret = 0;", "}", "if (ret < 0) {", "return ret;", "}", "flush_parent:\nreturn bdrv_co_flush(bs->file);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57, 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 119, 121 ], [ 123 ] ]
7,415
static void virtio_scsi_push_event(VirtIOSCSI *s, SCSIDevice *dev, uint32_t event, uint32_t reason) { VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(s); VirtIOSCSIReq *req; VirtIOSCSIEvent *evt; VirtIODevice *vdev = VIRTIO_DEVICE(s); int in_size; if (!(vdev->status & VIRTIO_CONFIG_S_DRIVER_OK)) { return; } req = virtio_scsi_pop_req(s, vs->event_vq); if (!req) { s->events_dropped = true; return; } if (req->elem.out_num || req->elem.in_num != 1) { virtio_scsi_bad_req(); } if (s->events_dropped) { event |= VIRTIO_SCSI_T_EVENTS_MISSED; s->events_dropped = false; } in_size = req->elem.in_sg[0].iov_len; if (in_size < sizeof(VirtIOSCSIEvent)) { virtio_scsi_bad_req(); } evt = req->resp.event; memset(evt, 0, sizeof(VirtIOSCSIEvent)); evt->event = event; evt->reason = reason; if (!dev) { assert(event == VIRTIO_SCSI_T_EVENTS_MISSED); } else { evt->lun[0] = 1; evt->lun[1] = dev->id; /* Linux wants us to keep the same encoding we use for REPORT LUNS. */ if (dev->lun >= 256) { evt->lun[2] = (dev->lun >> 8) | 0x40; } evt->lun[3] = dev->lun & 0xFF; } virtio_scsi_complete_req(req); }
false
qemu
3eff1f46f08a360a4ae9f834ce9fef4c45bf6f0f
static void virtio_scsi_push_event(VirtIOSCSI *s, SCSIDevice *dev, uint32_t event, uint32_t reason) { VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(s); VirtIOSCSIReq *req; VirtIOSCSIEvent *evt; VirtIODevice *vdev = VIRTIO_DEVICE(s); int in_size; if (!(vdev->status & VIRTIO_CONFIG_S_DRIVER_OK)) { return; } req = virtio_scsi_pop_req(s, vs->event_vq); if (!req) { s->events_dropped = true; return; } if (req->elem.out_num || req->elem.in_num != 1) { virtio_scsi_bad_req(); } if (s->events_dropped) { event |= VIRTIO_SCSI_T_EVENTS_MISSED; s->events_dropped = false; } in_size = req->elem.in_sg[0].iov_len; if (in_size < sizeof(VirtIOSCSIEvent)) { virtio_scsi_bad_req(); } evt = req->resp.event; memset(evt, 0, sizeof(VirtIOSCSIEvent)); evt->event = event; evt->reason = reason; if (!dev) { assert(event == VIRTIO_SCSI_T_EVENTS_MISSED); } else { evt->lun[0] = 1; evt->lun[1] = dev->id; if (dev->lun >= 256) { evt->lun[2] = (dev->lun >> 8) | 0x40; } evt->lun[3] = dev->lun & 0xFF; } virtio_scsi_complete_req(req); }
{ "code": [], "line_no": [] }
static void FUNC_0(VirtIOSCSI *VAR_0, SCSIDevice *VAR_1, uint32_t VAR_2, uint32_t VAR_3) { VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(VAR_0); VirtIOSCSIReq *req; VirtIOSCSIEvent *evt; VirtIODevice *vdev = VIRTIO_DEVICE(VAR_0); int VAR_4; if (!(vdev->status & VIRTIO_CONFIG_S_DRIVER_OK)) { return; } req = virtio_scsi_pop_req(VAR_0, vs->event_vq); if (!req) { VAR_0->events_dropped = true; return; } if (req->elem.out_num || req->elem.in_num != 1) { virtio_scsi_bad_req(); } if (VAR_0->events_dropped) { VAR_2 |= VIRTIO_SCSI_T_EVENTS_MISSED; VAR_0->events_dropped = false; } VAR_4 = req->elem.in_sg[0].iov_len; if (VAR_4 < sizeof(VirtIOSCSIEvent)) { virtio_scsi_bad_req(); } evt = req->resp.VAR_2; memset(evt, 0, sizeof(VirtIOSCSIEvent)); evt->VAR_2 = VAR_2; evt->VAR_3 = VAR_3; if (!VAR_1) { assert(VAR_2 == VIRTIO_SCSI_T_EVENTS_MISSED); } else { evt->lun[0] = 1; evt->lun[1] = VAR_1->id; if (VAR_1->lun >= 256) { evt->lun[2] = (VAR_1->lun >> 8) | 0x40; } evt->lun[3] = VAR_1->lun & 0xFF; } virtio_scsi_complete_req(req); }
[ "static void FUNC_0(VirtIOSCSI *VAR_0, SCSIDevice *VAR_1,\nuint32_t VAR_2, uint32_t VAR_3)\n{", "VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(VAR_0);", "VirtIOSCSIReq *req;", "VirtIOSCSIEvent *evt;", "VirtIODevice *vdev = VIRTIO_DEVICE(VAR_0);", "int VAR_4;", "if (!(vdev->status & VIRTIO_CONFIG_S_DRIVER_OK)) {", "return;", "}", "req = virtio_scsi_pop_req(VAR_0, vs->event_vq);", "if (!req) {", "VAR_0->events_dropped = true;", "return;", "}", "if (req->elem.out_num || req->elem.in_num != 1) {", "virtio_scsi_bad_req();", "}", "if (VAR_0->events_dropped) {", "VAR_2 |= VIRTIO_SCSI_T_EVENTS_MISSED;", "VAR_0->events_dropped = false;", "}", "VAR_4 = req->elem.in_sg[0].iov_len;", "if (VAR_4 < sizeof(VirtIOSCSIEvent)) {", "virtio_scsi_bad_req();", "}", "evt = req->resp.VAR_2;", "memset(evt, 0, sizeof(VirtIOSCSIEvent));", "evt->VAR_2 = VAR_2;", "evt->VAR_3 = VAR_3;", "if (!VAR_1) {", "assert(VAR_2 == VIRTIO_SCSI_T_EVENTS_MISSED);", "} else {", "evt->lun[0] = 1;", "evt->lun[1] = VAR_1->id;", "if (VAR_1->lun >= 256) {", "evt->lun[2] = (VAR_1->lun >> 8) | 0x40;", "}", "evt->lun[3] = VAR_1->lun & 0xFF;", "}", "virtio_scsi_complete_req(req);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ] ]
7,416
static void gic_thiscpu_write(void *opaque, target_phys_addr_t addr, uint64_t value, unsigned size) { GICState *s = (GICState *)opaque; gic_cpu_write(s, gic_get_current_cpu(s), addr, value); }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static void gic_thiscpu_write(void *opaque, target_phys_addr_t addr, uint64_t value, unsigned size) { GICState *s = (GICState *)opaque; gic_cpu_write(s, gic_get_current_cpu(s), addr, value); }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1, uint64_t VAR_2, unsigned VAR_3) { GICState *s = (GICState *)VAR_0; gic_cpu_write(s, gic_get_current_cpu(s), VAR_1, VAR_2); }
[ "static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1,\nuint64_t VAR_2, unsigned VAR_3)\n{", "GICState *s = (GICState *)VAR_0;", "gic_cpu_write(s, gic_get_current_cpu(s), VAR_1, VAR_2);", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ] ]
7,417
static void cmv_process_header(CmvContext *s, const uint8_t *buf, const uint8_t *buf_end) { int pal_start, pal_count, i; if(buf_end - buf < 16) { av_log(s->avctx, AV_LOG_WARNING, "truncated header\n"); return; } s->width = AV_RL16(&buf[4]); s->height = AV_RL16(&buf[6]); if (s->avctx->width!=s->width || s->avctx->height!=s->height) avcodec_set_dimensions(s->avctx, s->width, s->height); s->avctx->time_base.num = 1; s->avctx->time_base.den = AV_RL16(&buf[10]); pal_start = AV_RL16(&buf[12]); pal_count = AV_RL16(&buf[14]); buf += 16; for (i=pal_start; i<pal_start+pal_count && i<AVPALETTE_COUNT && buf_end - buf >= 3; i++) { s->palette[i] = 0xFFU << 24 | AV_RB24(buf); buf += 3; } }
false
FFmpeg
e9d443cf08503f7bd0149576ba9e891322de340d
static void cmv_process_header(CmvContext *s, const uint8_t *buf, const uint8_t *buf_end) { int pal_start, pal_count, i; if(buf_end - buf < 16) { av_log(s->avctx, AV_LOG_WARNING, "truncated header\n"); return; } s->width = AV_RL16(&buf[4]); s->height = AV_RL16(&buf[6]); if (s->avctx->width!=s->width || s->avctx->height!=s->height) avcodec_set_dimensions(s->avctx, s->width, s->height); s->avctx->time_base.num = 1; s->avctx->time_base.den = AV_RL16(&buf[10]); pal_start = AV_RL16(&buf[12]); pal_count = AV_RL16(&buf[14]); buf += 16; for (i=pal_start; i<pal_start+pal_count && i<AVPALETTE_COUNT && buf_end - buf >= 3; i++) { s->palette[i] = 0xFFU << 24 | AV_RB24(buf); buf += 3; } }
{ "code": [], "line_no": [] }
static void FUNC_0(CmvContext *VAR_0, const uint8_t *VAR_1, const uint8_t *VAR_2) { int VAR_3, VAR_4, VAR_5; if(VAR_2 - VAR_1 < 16) { av_log(VAR_0->avctx, AV_LOG_WARNING, "truncated header\n"); return; } VAR_0->width = AV_RL16(&VAR_1[4]); VAR_0->height = AV_RL16(&VAR_1[6]); if (VAR_0->avctx->width!=VAR_0->width || VAR_0->avctx->height!=VAR_0->height) avcodec_set_dimensions(VAR_0->avctx, VAR_0->width, VAR_0->height); VAR_0->avctx->time_base.num = 1; VAR_0->avctx->time_base.den = AV_RL16(&VAR_1[10]); VAR_3 = AV_RL16(&VAR_1[12]); VAR_4 = AV_RL16(&VAR_1[14]); VAR_1 += 16; for (VAR_5=VAR_3; VAR_5<VAR_3+VAR_4 && VAR_5<AVPALETTE_COUNT && VAR_2 - VAR_1 >= 3; VAR_5++) { VAR_0->palette[VAR_5] = 0xFFU << 24 | AV_RB24(VAR_1); VAR_1 += 3; } }
[ "static void FUNC_0(CmvContext *VAR_0, const uint8_t *VAR_1, const uint8_t *VAR_2)\n{", "int VAR_3, VAR_4, VAR_5;", "if(VAR_2 - VAR_1 < 16) {", "av_log(VAR_0->avctx, AV_LOG_WARNING, \"truncated header\\n\");", "return;", "}", "VAR_0->width = AV_RL16(&VAR_1[4]);", "VAR_0->height = AV_RL16(&VAR_1[6]);", "if (VAR_0->avctx->width!=VAR_0->width || VAR_0->avctx->height!=VAR_0->height)\navcodec_set_dimensions(VAR_0->avctx, VAR_0->width, VAR_0->height);", "VAR_0->avctx->time_base.num = 1;", "VAR_0->avctx->time_base.den = AV_RL16(&VAR_1[10]);", "VAR_3 = AV_RL16(&VAR_1[12]);", "VAR_4 = AV_RL16(&VAR_1[14]);", "VAR_1 += 16;", "for (VAR_5=VAR_3; VAR_5<VAR_3+VAR_4 && VAR_5<AVPALETTE_COUNT && VAR_2 - VAR_1 >= 3; VAR_5++) {", "VAR_0->palette[VAR_5] = 0xFFU << 24 | AV_RB24(VAR_1);", "VAR_1 += 3;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23, 25 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ] ]
7,418
FWCfgState *fw_cfg_init_mem(hwaddr ctl_addr, hwaddr data_addr) { DeviceState *dev; SysBusDevice *sbd; dev = qdev_create(NULL, TYPE_FW_CFG_MEM); qdev_prop_set_uint32(dev, "data_width", fw_cfg_data_mem_ops.valid.max_access_size); fw_cfg_init1(dev); sbd = SYS_BUS_DEVICE(dev); sysbus_mmio_map(sbd, 0, ctl_addr); sysbus_mmio_map(sbd, 1, data_addr); return FW_CFG(dev); }
false
qemu
6c87e3d5967a1d731b5f591a8f0ee6c319c14ca8
FWCfgState *fw_cfg_init_mem(hwaddr ctl_addr, hwaddr data_addr) { DeviceState *dev; SysBusDevice *sbd; dev = qdev_create(NULL, TYPE_FW_CFG_MEM); qdev_prop_set_uint32(dev, "data_width", fw_cfg_data_mem_ops.valid.max_access_size); fw_cfg_init1(dev); sbd = SYS_BUS_DEVICE(dev); sysbus_mmio_map(sbd, 0, ctl_addr); sysbus_mmio_map(sbd, 1, data_addr); return FW_CFG(dev); }
{ "code": [], "line_no": [] }
FWCfgState *FUNC_0(hwaddr ctl_addr, hwaddr data_addr) { DeviceState *dev; SysBusDevice *sbd; dev = qdev_create(NULL, TYPE_FW_CFG_MEM); qdev_prop_set_uint32(dev, "data_width", fw_cfg_data_mem_ops.valid.max_access_size); fw_cfg_init1(dev); sbd = SYS_BUS_DEVICE(dev); sysbus_mmio_map(sbd, 0, ctl_addr); sysbus_mmio_map(sbd, 1, data_addr); return FW_CFG(dev); }
[ "FWCfgState *FUNC_0(hwaddr ctl_addr, hwaddr data_addr)\n{", "DeviceState *dev;", "SysBusDevice *sbd;", "dev = qdev_create(NULL, TYPE_FW_CFG_MEM);", "qdev_prop_set_uint32(dev, \"data_width\",\nfw_cfg_data_mem_ops.valid.max_access_size);", "fw_cfg_init1(dev);", "sbd = SYS_BUS_DEVICE(dev);", "sysbus_mmio_map(sbd, 0, ctl_addr);", "sysbus_mmio_map(sbd, 1, data_addr);", "return FW_CFG(dev);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13, 15 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ] ]
7,419
static uint32_t mvc_asc(CPUS390XState *env, int64_t l, uint64_t a1, uint64_t mode1, uint64_t a2, uint64_t mode2) { CPUState *cs = CPU(s390_env_get_cpu(env)); target_ulong src, dest; int flags, cc = 0, i; if (!l) { return 0; } else if (l > 256) { /* max 256 */ l = 256; cc = 3; } if (mmu_translate(env, a1, 1, mode1, &dest, &flags, true)) { cpu_loop_exit(CPU(s390_env_get_cpu(env))); } dest |= a1 & ~TARGET_PAGE_MASK; if (mmu_translate(env, a2, 0, mode2, &src, &flags, true)) { cpu_loop_exit(CPU(s390_env_get_cpu(env))); } src |= a2 & ~TARGET_PAGE_MASK; /* XXX replace w/ memcpy */ for (i = 0; i < l; i++) { /* XXX be more clever */ if ((((dest + i) & TARGET_PAGE_MASK) != (dest & TARGET_PAGE_MASK)) || (((src + i) & TARGET_PAGE_MASK) != (src & TARGET_PAGE_MASK))) { mvc_asc(env, l - i, a1 + i, mode1, a2 + i, mode2); break; } stb_phys(cs->as, dest + i, ldub_phys(cs->as, src + i)); } return cc; }
false
qemu
a3084e8055067b3fe8ed653a609021d2ab368564
static uint32_t mvc_asc(CPUS390XState *env, int64_t l, uint64_t a1, uint64_t mode1, uint64_t a2, uint64_t mode2) { CPUState *cs = CPU(s390_env_get_cpu(env)); target_ulong src, dest; int flags, cc = 0, i; if (!l) { return 0; } else if (l > 256) { l = 256; cc = 3; } if (mmu_translate(env, a1, 1, mode1, &dest, &flags, true)) { cpu_loop_exit(CPU(s390_env_get_cpu(env))); } dest |= a1 & ~TARGET_PAGE_MASK; if (mmu_translate(env, a2, 0, mode2, &src, &flags, true)) { cpu_loop_exit(CPU(s390_env_get_cpu(env))); } src |= a2 & ~TARGET_PAGE_MASK; for (i = 0; i < l; i++) { if ((((dest + i) & TARGET_PAGE_MASK) != (dest & TARGET_PAGE_MASK)) || (((src + i) & TARGET_PAGE_MASK) != (src & TARGET_PAGE_MASK))) { mvc_asc(env, l - i, a1 + i, mode1, a2 + i, mode2); break; } stb_phys(cs->as, dest + i, ldub_phys(cs->as, src + i)); } return cc; }
{ "code": [], "line_no": [] }
static uint32_t FUNC_0(CPUS390XState *env, int64_t l, uint64_t a1, uint64_t mode1, uint64_t a2, uint64_t mode2) { CPUState *cs = CPU(s390_env_get_cpu(env)); target_ulong src, dest; int VAR_0, VAR_1 = 0, VAR_2; if (!l) { return 0; } else if (l > 256) { l = 256; VAR_1 = 3; } if (mmu_translate(env, a1, 1, mode1, &dest, &VAR_0, true)) { cpu_loop_exit(CPU(s390_env_get_cpu(env))); } dest |= a1 & ~TARGET_PAGE_MASK; if (mmu_translate(env, a2, 0, mode2, &src, &VAR_0, true)) { cpu_loop_exit(CPU(s390_env_get_cpu(env))); } src |= a2 & ~TARGET_PAGE_MASK; for (VAR_2 = 0; VAR_2 < l; VAR_2++) { if ((((dest + VAR_2) & TARGET_PAGE_MASK) != (dest & TARGET_PAGE_MASK)) || (((src + VAR_2) & TARGET_PAGE_MASK) != (src & TARGET_PAGE_MASK))) { FUNC_0(env, l - VAR_2, a1 + VAR_2, mode1, a2 + VAR_2, mode2); break; } stb_phys(cs->as, dest + VAR_2, ldub_phys(cs->as, src + VAR_2)); } return VAR_1; }
[ "static uint32_t FUNC_0(CPUS390XState *env, int64_t l, uint64_t a1,\nuint64_t mode1, uint64_t a2, uint64_t mode2)\n{", "CPUState *cs = CPU(s390_env_get_cpu(env));", "target_ulong src, dest;", "int VAR_0, VAR_1 = 0, VAR_2;", "if (!l) {", "return 0;", "} else if (l > 256) {", "l = 256;", "VAR_1 = 3;", "}", "if (mmu_translate(env, a1, 1, mode1, &dest, &VAR_0, true)) {", "cpu_loop_exit(CPU(s390_env_get_cpu(env)));", "}", "dest |= a1 & ~TARGET_PAGE_MASK;", "if (mmu_translate(env, a2, 0, mode2, &src, &VAR_0, true)) {", "cpu_loop_exit(CPU(s390_env_get_cpu(env)));", "}", "src |= a2 & ~TARGET_PAGE_MASK;", "for (VAR_2 = 0; VAR_2 < l; VAR_2++) {", "if ((((dest + VAR_2) & TARGET_PAGE_MASK) != (dest & TARGET_PAGE_MASK)) ||\n(((src + VAR_2) & TARGET_PAGE_MASK) != (src & TARGET_PAGE_MASK))) {", "FUNC_0(env, l - VAR_2, a1 + VAR_2, mode1, a2 + VAR_2, mode2);", "break;", "}", "stb_phys(cs->as, dest + VAR_2, ldub_phys(cs->as, src + VAR_2));", "}", "return VAR_1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 53 ], [ 57, 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 73 ], [ 75 ] ]
7,421
static ssize_t qio_channel_file_writev(QIOChannel *ioc, const struct iovec *iov, size_t niov, int *fds, size_t nfds, Error **errp) { QIOChannelFile *fioc = QIO_CHANNEL_FILE(ioc); ssize_t ret; retry: ret = writev(fioc->fd, iov, niov); if (ret <= 0) { if (errno == EAGAIN || errno == EWOULDBLOCK) { return QIO_CHANNEL_ERR_BLOCK; } if (errno == EINTR) { goto retry; } error_setg_errno(errp, errno, "Unable to write to file"); return -1; } return ret; }
false
qemu
30fd3e27907dfd1c0c66cc1339657af1a2ce1d4b
static ssize_t qio_channel_file_writev(QIOChannel *ioc, const struct iovec *iov, size_t niov, int *fds, size_t nfds, Error **errp) { QIOChannelFile *fioc = QIO_CHANNEL_FILE(ioc); ssize_t ret; retry: ret = writev(fioc->fd, iov, niov); if (ret <= 0) { if (errno == EAGAIN || errno == EWOULDBLOCK) { return QIO_CHANNEL_ERR_BLOCK; } if (errno == EINTR) { goto retry; } error_setg_errno(errp, errno, "Unable to write to file"); return -1; } return ret; }
{ "code": [], "line_no": [] }
static ssize_t FUNC_0(QIOChannel *ioc, const struct iovec *iov, size_t niov, int *fds, size_t nfds, Error **errp) { QIOChannelFile *fioc = QIO_CHANNEL_FILE(ioc); ssize_t ret; retry: ret = writev(fioc->fd, iov, niov); if (ret <= 0) { if (errno == EAGAIN || errno == EWOULDBLOCK) { return QIO_CHANNEL_ERR_BLOCK; } if (errno == EINTR) { goto retry; } error_setg_errno(errp, errno, "Unable to write to file"); return -1; } return ret; }
[ "static ssize_t FUNC_0(QIOChannel *ioc,\nconst struct iovec *iov,\nsize_t niov,\nint *fds,\nsize_t nfds,\nError **errp)\n{", "QIOChannelFile *fioc = QIO_CHANNEL_FILE(ioc);", "ssize_t ret;", "retry:\nret = writev(fioc->fd, iov, niov);", "if (ret <= 0) {", "if (errno == EAGAIN ||\nerrno == EWOULDBLOCK) {", "return QIO_CHANNEL_ERR_BLOCK;", "}", "if (errno == EINTR) {", "goto retry;", "}", "error_setg_errno(errp, errno,\n\"Unable to write to file\");", "return -1;", "}", "return ret;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11, 13 ], [ 15 ], [ 17 ], [ 21, 23 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41, 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ] ]
7,422
static int ac97_initfn (PCIDevice *dev) { AC97LinkState *s = DO_UPCAST (AC97LinkState, dev, dev); uint8_t *c = s->dev.config; /* TODO: no need to override */ c[PCI_COMMAND] = 0x00; /* pcicmd pci command rw, ro */ c[PCI_COMMAND + 1] = 0x00; /* TODO: */ c[PCI_STATUS] = PCI_STATUS_FAST_BACK; /* pcists pci status rwc, ro */ c[PCI_STATUS + 1] = PCI_STATUS_DEVSEL_MEDIUM >> 8; c[PCI_CLASS_PROG] = 0x00; /* pi programming interface ro */ /* TODO set when bar is registered. no need to override. */ /* nabmar native audio mixer base address rw */ c[PCI_BASE_ADDRESS_0] = PCI_BASE_ADDRESS_SPACE_IO; c[PCI_BASE_ADDRESS_0 + 1] = 0x00; c[PCI_BASE_ADDRESS_0 + 2] = 0x00; c[PCI_BASE_ADDRESS_0 + 3] = 0x00; /* TODO set when bar is registered. no need to override. */ /* nabmbar native audio bus mastering base address rw */ c[PCI_BASE_ADDRESS_0 + 4] = PCI_BASE_ADDRESS_SPACE_IO; c[PCI_BASE_ADDRESS_0 + 5] = 0x00; c[PCI_BASE_ADDRESS_0 + 6] = 0x00; c[PCI_BASE_ADDRESS_0 + 7] = 0x00; c[PCI_SUBSYSTEM_VENDOR_ID] = 0x86; /* svid subsystem vendor id rwo */ c[PCI_SUBSYSTEM_VENDOR_ID + 1] = 0x80; c[PCI_SUBSYSTEM_ID] = 0x00; /* sid subsystem id rwo */ c[PCI_SUBSYSTEM_ID + 1] = 0x00; c[PCI_INTERRUPT_LINE] = 0x00; /* intr_ln interrupt line rw */ c[PCI_INTERRUPT_PIN] = 0x01; /* intr_pn interrupt pin ro */ memory_region_init_io (&s->io_nam, &ac97_io_nam_ops, s, "ac97-nam", 1024); memory_region_init_io (&s->io_nabm, &ac97_io_nabm_ops, s, "ac97-nabm", 256); pci_register_bar (&s->dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &s->io_nam); pci_register_bar (&s->dev, 1, PCI_BASE_ADDRESS_SPACE_IO, &s->io_nabm); qemu_register_reset (ac97_on_reset, s); AUD_register_card ("ac97", &s->card); ac97_on_reset (s); return 0; }
false
qemu
25a21c94c0055e078acb7f7455e66c8a15f32385
static int ac97_initfn (PCIDevice *dev) { AC97LinkState *s = DO_UPCAST (AC97LinkState, dev, dev); uint8_t *c = s->dev.config; c[PCI_COMMAND] = 0x00; c[PCI_COMMAND + 1] = 0x00; c[PCI_STATUS] = PCI_STATUS_FAST_BACK; c[PCI_STATUS + 1] = PCI_STATUS_DEVSEL_MEDIUM >> 8; c[PCI_CLASS_PROG] = 0x00; c[PCI_BASE_ADDRESS_0] = PCI_BASE_ADDRESS_SPACE_IO; c[PCI_BASE_ADDRESS_0 + 1] = 0x00; c[PCI_BASE_ADDRESS_0 + 2] = 0x00; c[PCI_BASE_ADDRESS_0 + 3] = 0x00; c[PCI_BASE_ADDRESS_0 + 4] = PCI_BASE_ADDRESS_SPACE_IO; c[PCI_BASE_ADDRESS_0 + 5] = 0x00; c[PCI_BASE_ADDRESS_0 + 6] = 0x00; c[PCI_BASE_ADDRESS_0 + 7] = 0x00; c[PCI_SUBSYSTEM_VENDOR_ID] = 0x86; c[PCI_SUBSYSTEM_VENDOR_ID + 1] = 0x80; c[PCI_SUBSYSTEM_ID] = 0x00; c[PCI_SUBSYSTEM_ID + 1] = 0x00; c[PCI_INTERRUPT_LINE] = 0x00; c[PCI_INTERRUPT_PIN] = 0x01; memory_region_init_io (&s->io_nam, &ac97_io_nam_ops, s, "ac97-nam", 1024); memory_region_init_io (&s->io_nabm, &ac97_io_nabm_ops, s, "ac97-nabm", 256); pci_register_bar (&s->dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &s->io_nam); pci_register_bar (&s->dev, 1, PCI_BASE_ADDRESS_SPACE_IO, &s->io_nabm); qemu_register_reset (ac97_on_reset, s); AUD_register_card ("ac97", &s->card); ac97_on_reset (s); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0 (PCIDevice *VAR_0) { AC97LinkState *s = DO_UPCAST (AC97LinkState, VAR_0, VAR_0); uint8_t *c = s->VAR_0.config; c[PCI_COMMAND] = 0x00; c[PCI_COMMAND + 1] = 0x00; c[PCI_STATUS] = PCI_STATUS_FAST_BACK; c[PCI_STATUS + 1] = PCI_STATUS_DEVSEL_MEDIUM >> 8; c[PCI_CLASS_PROG] = 0x00; c[PCI_BASE_ADDRESS_0] = PCI_BASE_ADDRESS_SPACE_IO; c[PCI_BASE_ADDRESS_0 + 1] = 0x00; c[PCI_BASE_ADDRESS_0 + 2] = 0x00; c[PCI_BASE_ADDRESS_0 + 3] = 0x00; c[PCI_BASE_ADDRESS_0 + 4] = PCI_BASE_ADDRESS_SPACE_IO; c[PCI_BASE_ADDRESS_0 + 5] = 0x00; c[PCI_BASE_ADDRESS_0 + 6] = 0x00; c[PCI_BASE_ADDRESS_0 + 7] = 0x00; c[PCI_SUBSYSTEM_VENDOR_ID] = 0x86; c[PCI_SUBSYSTEM_VENDOR_ID + 1] = 0x80; c[PCI_SUBSYSTEM_ID] = 0x00; c[PCI_SUBSYSTEM_ID + 1] = 0x00; c[PCI_INTERRUPT_LINE] = 0x00; c[PCI_INTERRUPT_PIN] = 0x01; memory_region_init_io (&s->io_nam, &ac97_io_nam_ops, s, "ac97-nam", 1024); memory_region_init_io (&s->io_nabm, &ac97_io_nabm_ops, s, "ac97-nabm", 256); pci_register_bar (&s->VAR_0, 0, PCI_BASE_ADDRESS_SPACE_IO, &s->io_nam); pci_register_bar (&s->VAR_0, 1, PCI_BASE_ADDRESS_SPACE_IO, &s->io_nabm); qemu_register_reset (ac97_on_reset, s); AUD_register_card ("ac97", &s->card); ac97_on_reset (s); return 0; }
[ "static int FUNC_0 (PCIDevice *VAR_0)\n{", "AC97LinkState *s = DO_UPCAST (AC97LinkState, VAR_0, VAR_0);", "uint8_t *c = s->VAR_0.config;", "c[PCI_COMMAND] = 0x00;", "c[PCI_COMMAND + 1] = 0x00;", "c[PCI_STATUS] = PCI_STATUS_FAST_BACK;", "c[PCI_STATUS + 1] = PCI_STATUS_DEVSEL_MEDIUM >> 8;", "c[PCI_CLASS_PROG] = 0x00;", "c[PCI_BASE_ADDRESS_0] = PCI_BASE_ADDRESS_SPACE_IO;", "c[PCI_BASE_ADDRESS_0 + 1] = 0x00;", "c[PCI_BASE_ADDRESS_0 + 2] = 0x00;", "c[PCI_BASE_ADDRESS_0 + 3] = 0x00;", "c[PCI_BASE_ADDRESS_0 + 4] = PCI_BASE_ADDRESS_SPACE_IO;", "c[PCI_BASE_ADDRESS_0 + 5] = 0x00;", "c[PCI_BASE_ADDRESS_0 + 6] = 0x00;", "c[PCI_BASE_ADDRESS_0 + 7] = 0x00;", "c[PCI_SUBSYSTEM_VENDOR_ID] = 0x86;", "c[PCI_SUBSYSTEM_VENDOR_ID + 1] = 0x80;", "c[PCI_SUBSYSTEM_ID] = 0x00;", "c[PCI_SUBSYSTEM_ID + 1] = 0x00;", "c[PCI_INTERRUPT_LINE] = 0x00;", "c[PCI_INTERRUPT_PIN] = 0x01;", "memory_region_init_io (&s->io_nam, &ac97_io_nam_ops, s, \"ac97-nam\", 1024);", "memory_region_init_io (&s->io_nabm, &ac97_io_nabm_ops, s, \"ac97-nabm\", 256);", "pci_register_bar (&s->VAR_0, 0, PCI_BASE_ADDRESS_SPACE_IO, &s->io_nam);", "pci_register_bar (&s->VAR_0, 1, PCI_BASE_ADDRESS_SPACE_IO, &s->io_nabm);", "qemu_register_reset (ac97_on_reset, s);", "AUD_register_card (\"ac97\", &s->card);", "ac97_on_reset (s);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 13 ], [ 15 ], [ 21 ], [ 23 ], [ 27 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ] ]
7,423
static Suite *qjson_suite(void) { Suite *suite; TCase *string_literals, *number_literals, *keyword_literals; TCase *dicts, *lists, *whitespace, *varargs; string_literals = tcase_create("String Literals"); tcase_add_test(string_literals, simple_string); tcase_add_test(string_literals, escaped_string); tcase_add_test(string_literals, single_quote_string); tcase_add_test(string_literals, vararg_string); number_literals = tcase_create("Number Literals"); tcase_add_test(number_literals, simple_number); tcase_add_test(number_literals, float_number); tcase_add_test(number_literals, vararg_number); keyword_literals = tcase_create("Keywords"); tcase_add_test(keyword_literals, keyword_literal); dicts = tcase_create("Objects"); tcase_add_test(dicts, simple_dict); lists = tcase_create("Lists"); tcase_add_test(lists, simple_list); whitespace = tcase_create("Whitespace"); tcase_add_test(whitespace, simple_whitespace); varargs = tcase_create("Varargs"); tcase_add_test(varargs, simple_varargs); suite = suite_create("QJSON test-suite"); suite_add_tcase(suite, string_literals); suite_add_tcase(suite, number_literals); suite_add_tcase(suite, keyword_literals); suite_add_tcase(suite, dicts); suite_add_tcase(suite, lists); suite_add_tcase(suite, whitespace); suite_add_tcase(suite, varargs); return suite; }
false
qemu
7f8fca7c8add770d6533c44d2d001c0442ed0371
static Suite *qjson_suite(void) { Suite *suite; TCase *string_literals, *number_literals, *keyword_literals; TCase *dicts, *lists, *whitespace, *varargs; string_literals = tcase_create("String Literals"); tcase_add_test(string_literals, simple_string); tcase_add_test(string_literals, escaped_string); tcase_add_test(string_literals, single_quote_string); tcase_add_test(string_literals, vararg_string); number_literals = tcase_create("Number Literals"); tcase_add_test(number_literals, simple_number); tcase_add_test(number_literals, float_number); tcase_add_test(number_literals, vararg_number); keyword_literals = tcase_create("Keywords"); tcase_add_test(keyword_literals, keyword_literal); dicts = tcase_create("Objects"); tcase_add_test(dicts, simple_dict); lists = tcase_create("Lists"); tcase_add_test(lists, simple_list); whitespace = tcase_create("Whitespace"); tcase_add_test(whitespace, simple_whitespace); varargs = tcase_create("Varargs"); tcase_add_test(varargs, simple_varargs); suite = suite_create("QJSON test-suite"); suite_add_tcase(suite, string_literals); suite_add_tcase(suite, number_literals); suite_add_tcase(suite, keyword_literals); suite_add_tcase(suite, dicts); suite_add_tcase(suite, lists); suite_add_tcase(suite, whitespace); suite_add_tcase(suite, varargs); return suite; }
{ "code": [], "line_no": [] }
static Suite *FUNC_0(void) { Suite *suite; TCase *string_literals, *number_literals, *keyword_literals; TCase *dicts, *lists, *whitespace, *varargs; string_literals = tcase_create("String Literals"); tcase_add_test(string_literals, simple_string); tcase_add_test(string_literals, escaped_string); tcase_add_test(string_literals, single_quote_string); tcase_add_test(string_literals, vararg_string); number_literals = tcase_create("Number Literals"); tcase_add_test(number_literals, simple_number); tcase_add_test(number_literals, float_number); tcase_add_test(number_literals, vararg_number); keyword_literals = tcase_create("Keywords"); tcase_add_test(keyword_literals, keyword_literal); dicts = tcase_create("Objects"); tcase_add_test(dicts, simple_dict); lists = tcase_create("Lists"); tcase_add_test(lists, simple_list); whitespace = tcase_create("Whitespace"); tcase_add_test(whitespace, simple_whitespace); varargs = tcase_create("Varargs"); tcase_add_test(varargs, simple_varargs); suite = suite_create("QJSON test-suite"); suite_add_tcase(suite, string_literals); suite_add_tcase(suite, number_literals); suite_add_tcase(suite, keyword_literals); suite_add_tcase(suite, dicts); suite_add_tcase(suite, lists); suite_add_tcase(suite, whitespace); suite_add_tcase(suite, varargs); return suite; }
[ "static Suite *FUNC_0(void)\n{", "Suite *suite;", "TCase *string_literals, *number_literals, *keyword_literals;", "TCase *dicts, *lists, *whitespace, *varargs;", "string_literals = tcase_create(\"String Literals\");", "tcase_add_test(string_literals, simple_string);", "tcase_add_test(string_literals, escaped_string);", "tcase_add_test(string_literals, single_quote_string);", "tcase_add_test(string_literals, vararg_string);", "number_literals = tcase_create(\"Number Literals\");", "tcase_add_test(number_literals, simple_number);", "tcase_add_test(number_literals, float_number);", "tcase_add_test(number_literals, vararg_number);", "keyword_literals = tcase_create(\"Keywords\");", "tcase_add_test(keyword_literals, keyword_literal);", "dicts = tcase_create(\"Objects\");", "tcase_add_test(dicts, simple_dict);", "lists = tcase_create(\"Lists\");", "tcase_add_test(lists, simple_list);", "whitespace = tcase_create(\"Whitespace\");", "tcase_add_test(whitespace, simple_whitespace);", "varargs = tcase_create(\"Varargs\");", "tcase_add_test(varargs, simple_varargs);", "suite = suite_create(\"QJSON test-suite\");", "suite_add_tcase(suite, string_literals);", "suite_add_tcase(suite, number_literals);", "suite_add_tcase(suite, keyword_literals);", "suite_add_tcase(suite, dicts);", "suite_add_tcase(suite, lists);", "suite_add_tcase(suite, whitespace);", "suite_add_tcase(suite, varargs);", "return suite;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ] ]
7,424
char_socket_get_addr(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { SocketChardev *s = SOCKET_CHARDEV(obj); visit_type_SocketAddress(v, name, &s->addr, errp); }
false
qemu
dfd100f242370886bb6732f70f1f7cbd8eb9fedc
char_socket_get_addr(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { SocketChardev *s = SOCKET_CHARDEV(obj); visit_type_SocketAddress(v, name, &s->addr, errp); }
{ "code": [], "line_no": [] }
FUNC_0(Object *VAR_0, Visitor *VAR_1, const char *VAR_2, void *VAR_3, Error **VAR_4) { SocketChardev *s = SOCKET_CHARDEV(VAR_0); visit_type_SocketAddress(VAR_1, VAR_2, &s->addr, VAR_4); }
[ "FUNC_0(Object *VAR_0, Visitor *VAR_1, const char *VAR_2,\nvoid *VAR_3, Error **VAR_4)\n{", "SocketChardev *s = SOCKET_CHARDEV(VAR_0);", "visit_type_SocketAddress(VAR_1, VAR_2, &s->addr, VAR_4);", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13 ] ]
7,425
static void invalidate_and_set_dirty(target_phys_addr_t addr, target_phys_addr_t length) { if (!cpu_physical_memory_is_dirty(addr)) { /* invalidate code */ tb_invalidate_phys_page_range(addr, addr + length, 0); /* set dirty bit */ cpu_physical_memory_set_dirty_flags(addr, (0xff & ~CODE_DIRTY_FLAG)); } xen_modified_memory(addr, length); }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static void invalidate_and_set_dirty(target_phys_addr_t addr, target_phys_addr_t length) { if (!cpu_physical_memory_is_dirty(addr)) { tb_invalidate_phys_page_range(addr, addr + length, 0); cpu_physical_memory_set_dirty_flags(addr, (0xff & ~CODE_DIRTY_FLAG)); } xen_modified_memory(addr, length); }
{ "code": [], "line_no": [] }
static void FUNC_0(target_phys_addr_t VAR_0, target_phys_addr_t VAR_1) { if (!cpu_physical_memory_is_dirty(VAR_0)) { tb_invalidate_phys_page_range(VAR_0, VAR_0 + VAR_1, 0); cpu_physical_memory_set_dirty_flags(VAR_0, (0xff & ~CODE_DIRTY_FLAG)); } xen_modified_memory(VAR_0, VAR_1); }
[ "static void FUNC_0(target_phys_addr_t VAR_0,\ntarget_phys_addr_t VAR_1)\n{", "if (!cpu_physical_memory_is_dirty(VAR_0)) {", "tb_invalidate_phys_page_range(VAR_0, VAR_0 + VAR_1, 0);", "cpu_physical_memory_set_dirty_flags(VAR_0, (0xff & ~CODE_DIRTY_FLAG));", "}", "xen_modified_memory(VAR_0, VAR_1);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
7,426
static void raw_refresh_limits(BlockDriverState *bs, Error **errp) { BDRVRawState *s = bs->opaque; struct stat st; if (!fstat(s->fd, &st)) { if (S_ISBLK(st.st_mode)) { int ret = hdev_get_max_transfer_length(s->fd); if (ret >= 0) { bs->bl.max_transfer_length = ret; } } } raw_probe_alignment(bs, s->fd, errp); bs->bl.min_mem_alignment = s->buf_align; bs->bl.opt_mem_alignment = MAX(s->buf_align, getpagesize()); }
false
qemu
5def6b80e1eca696c1fc6099e7f4d36729686402
static void raw_refresh_limits(BlockDriverState *bs, Error **errp) { BDRVRawState *s = bs->opaque; struct stat st; if (!fstat(s->fd, &st)) { if (S_ISBLK(st.st_mode)) { int ret = hdev_get_max_transfer_length(s->fd); if (ret >= 0) { bs->bl.max_transfer_length = ret; } } } raw_probe_alignment(bs, s->fd, errp); bs->bl.min_mem_alignment = s->buf_align; bs->bl.opt_mem_alignment = MAX(s->buf_align, getpagesize()); }
{ "code": [], "line_no": [] }
static void FUNC_0(BlockDriverState *VAR_0, Error **VAR_1) { BDRVRawState *s = VAR_0->opaque; struct stat VAR_2; if (!fstat(s->fd, &VAR_2)) { if (S_ISBLK(VAR_2.st_mode)) { int VAR_3 = hdev_get_max_transfer_length(s->fd); if (VAR_3 >= 0) { VAR_0->bl.max_transfer_length = VAR_3; } } } raw_probe_alignment(VAR_0, s->fd, VAR_1); VAR_0->bl.min_mem_alignment = s->buf_align; VAR_0->bl.opt_mem_alignment = MAX(s->buf_align, getpagesize()); }
[ "static void FUNC_0(BlockDriverState *VAR_0, Error **VAR_1)\n{", "BDRVRawState *s = VAR_0->opaque;", "struct stat VAR_2;", "if (!fstat(s->fd, &VAR_2)) {", "if (S_ISBLK(VAR_2.st_mode)) {", "int VAR_3 = hdev_get_max_transfer_length(s->fd);", "if (VAR_3 >= 0) {", "VAR_0->bl.max_transfer_length = VAR_3;", "}", "}", "}", "raw_probe_alignment(VAR_0, s->fd, VAR_1);", "VAR_0->bl.min_mem_alignment = s->buf_align;", "VAR_0->bl.opt_mem_alignment = MAX(s->buf_align, getpagesize());", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ] ]
7,427
static int cpudef_setfield(const char *name, const char *str, void *opaque) { x86_def_t *def = opaque; int err = 0; if (!strcmp(name, "name")) { def->name = strdup(str); } else if (!strcmp(name, "model_id")) { strncpy(def->model_id, str, sizeof (def->model_id)); } else if (!strcmp(name, "level")) { setscalar(&def->level, str, &err) } else if (!strcmp(name, "vendor")) { cpyid(&str[0], &def->vendor1); cpyid(&str[4], &def->vendor2); cpyid(&str[8], &def->vendor3); } else if (!strcmp(name, "family")) { setscalar(&def->family, str, &err) } else if (!strcmp(name, "model")) { setscalar(&def->model, str, &err) } else if (!strcmp(name, "stepping")) { setscalar(&def->stepping, str, &err) } else if (!strcmp(name, "feature_edx")) { setfeatures(&def->features, str, feature_name, &err); } else if (!strcmp(name, "feature_ecx")) { setfeatures(&def->ext_features, str, ext_feature_name, &err); } else if (!strcmp(name, "extfeature_edx")) { setfeatures(&def->ext2_features, str, ext2_feature_name, &err); } else if (!strcmp(name, "extfeature_ecx")) { setfeatures(&def->ext3_features, str, ext3_feature_name, &err); } else if (!strcmp(name, "xlevel")) { setscalar(&def->xlevel, str, &err) } else { fprintf(stderr, "error: unknown option [%s = %s]\n", name, str); return (1); } if (err) { fprintf(stderr, "error: bad option value [%s = %s]\n", name, str); return (1); } return (0); }
false
qemu
d3c481b357ee6f78d3df10ee30407fa05d85b76c
static int cpudef_setfield(const char *name, const char *str, void *opaque) { x86_def_t *def = opaque; int err = 0; if (!strcmp(name, "name")) { def->name = strdup(str); } else if (!strcmp(name, "model_id")) { strncpy(def->model_id, str, sizeof (def->model_id)); } else if (!strcmp(name, "level")) { setscalar(&def->level, str, &err) } else if (!strcmp(name, "vendor")) { cpyid(&str[0], &def->vendor1); cpyid(&str[4], &def->vendor2); cpyid(&str[8], &def->vendor3); } else if (!strcmp(name, "family")) { setscalar(&def->family, str, &err) } else if (!strcmp(name, "model")) { setscalar(&def->model, str, &err) } else if (!strcmp(name, "stepping")) { setscalar(&def->stepping, str, &err) } else if (!strcmp(name, "feature_edx")) { setfeatures(&def->features, str, feature_name, &err); } else if (!strcmp(name, "feature_ecx")) { setfeatures(&def->ext_features, str, ext_feature_name, &err); } else if (!strcmp(name, "extfeature_edx")) { setfeatures(&def->ext2_features, str, ext2_feature_name, &err); } else if (!strcmp(name, "extfeature_ecx")) { setfeatures(&def->ext3_features, str, ext3_feature_name, &err); } else if (!strcmp(name, "xlevel")) { setscalar(&def->xlevel, str, &err) } else { fprintf(stderr, "error: unknown option [%s = %s]\n", name, str); return (1); } if (err) { fprintf(stderr, "error: bad option value [%s = %s]\n", name, str); return (1); } return (0); }
{ "code": [], "line_no": [] }
static int FUNC_0(const char *VAR_0, const char *VAR_1, void *VAR_2) { x86_def_t *def = VAR_2; int VAR_3 = 0; if (!strcmp(VAR_0, "VAR_0")) { def->VAR_0 = strdup(VAR_1); } else if (!strcmp(VAR_0, "model_id")) { strncpy(def->model_id, VAR_1, sizeof (def->model_id)); } else if (!strcmp(VAR_0, "level")) { setscalar(&def->level, VAR_1, &VAR_3) } else if (!strcmp(VAR_0, "vendor")) { cpyid(&VAR_1[0], &def->vendor1); cpyid(&VAR_1[4], &def->vendor2); cpyid(&VAR_1[8], &def->vendor3); } else if (!strcmp(VAR_0, "family")) { setscalar(&def->family, VAR_1, &VAR_3) } else if (!strcmp(VAR_0, "model")) { setscalar(&def->model, VAR_1, &VAR_3) } else if (!strcmp(VAR_0, "stepping")) { setscalar(&def->stepping, VAR_1, &VAR_3) } else if (!strcmp(VAR_0, "feature_edx")) { setfeatures(&def->features, VAR_1, feature_name, &VAR_3); } else if (!strcmp(VAR_0, "feature_ecx")) { setfeatures(&def->ext_features, VAR_1, ext_feature_name, &VAR_3); } else if (!strcmp(VAR_0, "extfeature_edx")) { setfeatures(&def->ext2_features, VAR_1, ext2_feature_name, &VAR_3); } else if (!strcmp(VAR_0, "extfeature_ecx")) { setfeatures(&def->ext3_features, VAR_1, ext3_feature_name, &VAR_3); } else if (!strcmp(VAR_0, "xlevel")) { setscalar(&def->xlevel, VAR_1, &VAR_3) } else { fprintf(stderr, "error: unknown option [%s = %s]\n", VAR_0, VAR_1); return (1); } if (VAR_3) { fprintf(stderr, "error: bad option value [%s = %s]\n", VAR_0, VAR_1); return (1); } return (0); }
[ "static int FUNC_0(const char *VAR_0, const char *VAR_1, void *VAR_2)\n{", "x86_def_t *def = VAR_2;", "int VAR_3 = 0;", "if (!strcmp(VAR_0, \"VAR_0\")) {", "def->VAR_0 = strdup(VAR_1);", "} else if (!strcmp(VAR_0, \"model_id\")) {", "strncpy(def->model_id, VAR_1, sizeof (def->model_id));", "} else if (!strcmp(VAR_0, \"level\")) {", "setscalar(&def->level, VAR_1, &VAR_3)\n} else if (!strcmp(VAR_0, \"vendor\")) {", "cpyid(&VAR_1[0], &def->vendor1);", "cpyid(&VAR_1[4], &def->vendor2);", "cpyid(&VAR_1[8], &def->vendor3);", "} else if (!strcmp(VAR_0, \"family\")) {", "setscalar(&def->family, VAR_1, &VAR_3)\n} else if (!strcmp(VAR_0, \"model\")) {", "setscalar(&def->model, VAR_1, &VAR_3)\n} else if (!strcmp(VAR_0, \"stepping\")) {", "setscalar(&def->stepping, VAR_1, &VAR_3)\n} else if (!strcmp(VAR_0, \"feature_edx\")) {", "setfeatures(&def->features, VAR_1, feature_name, &VAR_3);", "} else if (!strcmp(VAR_0, \"feature_ecx\")) {", "setfeatures(&def->ext_features, VAR_1, ext_feature_name, &VAR_3);", "} else if (!strcmp(VAR_0, \"extfeature_edx\")) {", "setfeatures(&def->ext2_features, VAR_1, ext2_feature_name, &VAR_3);", "} else if (!strcmp(VAR_0, \"extfeature_ecx\")) {", "setfeatures(&def->ext3_features, VAR_1, ext3_feature_name, &VAR_3);", "} else if (!strcmp(VAR_0, \"xlevel\")) {", "setscalar(&def->xlevel, VAR_1, &VAR_3)\n} else {", "fprintf(stderr, \"error: unknown option [%s = %s]\\n\", VAR_0, VAR_1);", "return (1);", "}", "if (VAR_3) {", "fprintf(stderr, \"error: bad option value [%s = %s]\\n\", VAR_0, VAR_1);", "return (1);", "}", "return (0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21, 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33, 35 ], [ 37, 39 ], [ 41, 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61, 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ] ]
7,429
aio_read_f(int argc, char **argv) { int nr_iov, c; struct aio_ctx *ctx = calloc(1, sizeof(struct aio_ctx)); BlockDriverAIOCB *acb; while ((c = getopt(argc, argv, "CP:qv")) != EOF) { switch (c) { case 'C': ctx->Cflag = 1; break; case 'P': ctx->Pflag = 1; ctx->pattern = atoi(optarg); break; case 'q': ctx->qflag = 1; break; case 'v': ctx->vflag = 1; break; default: free(ctx); return command_usage(&aio_read_cmd); } } if (optind > argc - 2) { free(ctx); return command_usage(&aio_read_cmd); } ctx->offset = cvtnum(argv[optind]); if (ctx->offset < 0) { printf("non-numeric length argument -- %s\n", argv[optind]); free(ctx); return 0; } optind++; if (ctx->offset & 0x1ff) { printf("offset %lld is not sector aligned\n", (long long)ctx->offset); free(ctx); return 0; } nr_iov = argc - optind; ctx->buf = create_iovec(&ctx->qiov, &argv[optind], nr_iov, 0xab); gettimeofday(&ctx->t1, NULL); acb = bdrv_aio_readv(bs, ctx->offset >> 9, &ctx->qiov, ctx->qiov.size >> 9, aio_read_done, ctx); if (!acb) { free(ctx->buf); free(ctx); return -EIO; } return 0; }
false
qemu
cf070d7ec0b8fb21faa9a630ed5cc66f90844a08
aio_read_f(int argc, char **argv) { int nr_iov, c; struct aio_ctx *ctx = calloc(1, sizeof(struct aio_ctx)); BlockDriverAIOCB *acb; while ((c = getopt(argc, argv, "CP:qv")) != EOF) { switch (c) { case 'C': ctx->Cflag = 1; break; case 'P': ctx->Pflag = 1; ctx->pattern = atoi(optarg); break; case 'q': ctx->qflag = 1; break; case 'v': ctx->vflag = 1; break; default: free(ctx); return command_usage(&aio_read_cmd); } } if (optind > argc - 2) { free(ctx); return command_usage(&aio_read_cmd); } ctx->offset = cvtnum(argv[optind]); if (ctx->offset < 0) { printf("non-numeric length argument -- %s\n", argv[optind]); free(ctx); return 0; } optind++; if (ctx->offset & 0x1ff) { printf("offset %lld is not sector aligned\n", (long long)ctx->offset); free(ctx); return 0; } nr_iov = argc - optind; ctx->buf = create_iovec(&ctx->qiov, &argv[optind], nr_iov, 0xab); gettimeofday(&ctx->t1, NULL); acb = bdrv_aio_readv(bs, ctx->offset >> 9, &ctx->qiov, ctx->qiov.size >> 9, aio_read_done, ctx); if (!acb) { free(ctx->buf); free(ctx); return -EIO; } return 0; }
{ "code": [], "line_no": [] }
FUNC_0(int VAR_0, char **VAR_1) { int VAR_2, VAR_3; struct aio_ctx *VAR_4 = calloc(1, sizeof(struct aio_ctx)); BlockDriverAIOCB *acb; while ((VAR_3 = getopt(VAR_0, VAR_1, "CP:qv")) != EOF) { switch (VAR_3) { case 'C': VAR_4->Cflag = 1; break; case 'P': VAR_4->Pflag = 1; VAR_4->pattern = atoi(optarg); break; case 'q': VAR_4->qflag = 1; break; case 'v': VAR_4->vflag = 1; break; default: free(VAR_4); return command_usage(&aio_read_cmd); } } if (optind > VAR_0 - 2) { free(VAR_4); return command_usage(&aio_read_cmd); } VAR_4->offset = cvtnum(VAR_1[optind]); if (VAR_4->offset < 0) { printf("non-numeric length argument -- %s\n", VAR_1[optind]); free(VAR_4); return 0; } optind++; if (VAR_4->offset & 0x1ff) { printf("offset %lld is not sector aligned\n", (long long)VAR_4->offset); free(VAR_4); return 0; } VAR_2 = VAR_0 - optind; VAR_4->buf = create_iovec(&VAR_4->qiov, &VAR_1[optind], VAR_2, 0xab); gettimeofday(&VAR_4->t1, NULL); acb = bdrv_aio_readv(bs, VAR_4->offset >> 9, &VAR_4->qiov, VAR_4->qiov.size >> 9, aio_read_done, VAR_4); if (!acb) { free(VAR_4->buf); free(VAR_4); return -EIO; } return 0; }
[ "FUNC_0(int VAR_0, char **VAR_1)\n{", "int VAR_2, VAR_3;", "struct aio_ctx *VAR_4 = calloc(1, sizeof(struct aio_ctx));", "BlockDriverAIOCB *acb;", "while ((VAR_3 = getopt(VAR_0, VAR_1, \"CP:qv\")) != EOF) {", "switch (VAR_3) {", "case 'C':\nVAR_4->Cflag = 1;", "break;", "case 'P':\nVAR_4->Pflag = 1;", "VAR_4->pattern = atoi(optarg);", "break;", "case 'q':\nVAR_4->qflag = 1;", "break;", "case 'v':\nVAR_4->vflag = 1;", "break;", "default:\nfree(VAR_4);", "return command_usage(&aio_read_cmd);", "}", "}", "if (optind > VAR_0 - 2) {", "free(VAR_4);", "return command_usage(&aio_read_cmd);", "}", "VAR_4->offset = cvtnum(VAR_1[optind]);", "if (VAR_4->offset < 0) {", "printf(\"non-numeric length argument -- %s\\n\", VAR_1[optind]);", "free(VAR_4);", "return 0;", "}", "optind++;", "if (VAR_4->offset & 0x1ff) {", "printf(\"offset %lld is not sector aligned\\n\",\n(long long)VAR_4->offset);", "free(VAR_4);", "return 0;", "}", "VAR_2 = VAR_0 - optind;", "VAR_4->buf = create_iovec(&VAR_4->qiov, &VAR_1[optind], VAR_2, 0xab);", "gettimeofday(&VAR_4->t1, NULL);", "acb = bdrv_aio_readv(bs, VAR_4->offset >> 9, &VAR_4->qiov,\nVAR_4->qiov.size >> 9, aio_read_done, VAR_4);", "if (!acb) {", "free(VAR_4->buf);", "free(VAR_4);", "return -EIO;", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17, 19 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 37, 39 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 83, 85 ], [ 87 ], [ 89 ], [ 91 ], [ 95 ], [ 97 ], [ 101 ], [ 103, 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 119 ], [ 121 ] ]
7,431
static void nvdimm_build_device_dsm(Aml *dev) { Aml *method; method = aml_method("_DSM", 4, AML_NOTSERIALIZED); aml_append(method, aml_return(aml_call4(NVDIMM_COMMON_DSM, aml_arg(0), aml_arg(1), aml_arg(2), aml_arg(3)))); aml_append(dev, method); }
false
qemu
732b530c1bd064bdcc29975c0b78fc6de8c47e7f
static void nvdimm_build_device_dsm(Aml *dev) { Aml *method; method = aml_method("_DSM", 4, AML_NOTSERIALIZED); aml_append(method, aml_return(aml_call4(NVDIMM_COMMON_DSM, aml_arg(0), aml_arg(1), aml_arg(2), aml_arg(3)))); aml_append(dev, method); }
{ "code": [], "line_no": [] }
static void FUNC_0(Aml *VAR_0) { Aml *method; method = aml_method("_DSM", 4, AML_NOTSERIALIZED); aml_append(method, aml_return(aml_call4(NVDIMM_COMMON_DSM, aml_arg(0), aml_arg(1), aml_arg(2), aml_arg(3)))); aml_append(VAR_0, method); }
[ "static void FUNC_0(Aml *VAR_0)\n{", "Aml *method;", "method = aml_method(\"_DSM\", 4, AML_NOTSERIALIZED);", "aml_append(method, aml_return(aml_call4(NVDIMM_COMMON_DSM, aml_arg(0),\naml_arg(1), aml_arg(2), aml_arg(3))));", "aml_append(VAR_0, method);", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11, 13 ], [ 15 ], [ 17 ] ]
7,432
void kvm_s390_apply_cpu_model(const S390CPUModel *model, Error **errp) { struct kvm_s390_vm_cpu_processor prop = { .fac_list = { 0 }, }; struct kvm_device_attr attr = { .group = KVM_S390_VM_CPU_MODEL, .attr = KVM_S390_VM_CPU_PROCESSOR, .addr = (uint64_t) &prop, }; int rc; if (!model) { /* compatibility handling if cpu models are disabled */ if (kvm_s390_cmma_available() && !mem_path) { kvm_s390_enable_cmma(); } return; } if (!kvm_s390_cpu_models_supported()) { error_setg(errp, "KVM doesn't support CPU models"); return; } prop.cpuid = s390_cpuid_from_cpu_model(model); prop.ibc = s390_ibc_from_cpu_model(model); /* configure cpu features indicated via STFL(e) */ s390_fill_feat_block(model->features, S390_FEAT_TYPE_STFL, (uint8_t *) prop.fac_list); rc = kvm_vm_ioctl(kvm_state, KVM_SET_DEVICE_ATTR, &attr); if (rc) { error_setg(errp, "KVM: Error configuring the CPU model: %d", rc); return; } /* configure cpu features indicated e.g. via SCLP */ rc = configure_cpu_feat(model->features); if (rc) { error_setg(errp, "KVM: Error configuring CPU features: %d", rc); return; } /* configure cpu subfunctions indicated via query / test bit */ rc = configure_cpu_subfunc(model->features); if (rc) { error_setg(errp, "KVM: Error configuring CPU subfunctions: %d", rc); return; } /* enable CMM via CMMA - disable on hugetlbfs */ if (test_bit(S390_FEAT_CMM, model->features)) { if (mem_path) { error_report("Warning: CMM will not be enabled because it is not " "compatible to hugetlbfs."); } else { kvm_s390_enable_cmma(); } } }
false
qemu
03f47ee49e1478b5ffffb3a9b6203c672903196c
void kvm_s390_apply_cpu_model(const S390CPUModel *model, Error **errp) { struct kvm_s390_vm_cpu_processor prop = { .fac_list = { 0 }, }; struct kvm_device_attr attr = { .group = KVM_S390_VM_CPU_MODEL, .attr = KVM_S390_VM_CPU_PROCESSOR, .addr = (uint64_t) &prop, }; int rc; if (!model) { if (kvm_s390_cmma_available() && !mem_path) { kvm_s390_enable_cmma(); } return; } if (!kvm_s390_cpu_models_supported()) { error_setg(errp, "KVM doesn't support CPU models"); return; } prop.cpuid = s390_cpuid_from_cpu_model(model); prop.ibc = s390_ibc_from_cpu_model(model); s390_fill_feat_block(model->features, S390_FEAT_TYPE_STFL, (uint8_t *) prop.fac_list); rc = kvm_vm_ioctl(kvm_state, KVM_SET_DEVICE_ATTR, &attr); if (rc) { error_setg(errp, "KVM: Error configuring the CPU model: %d", rc); return; } rc = configure_cpu_feat(model->features); if (rc) { error_setg(errp, "KVM: Error configuring CPU features: %d", rc); return; } rc = configure_cpu_subfunc(model->features); if (rc) { error_setg(errp, "KVM: Error configuring CPU subfunctions: %d", rc); return; } if (test_bit(S390_FEAT_CMM, model->features)) { if (mem_path) { error_report("Warning: CMM will not be enabled because it is not " "compatible to hugetlbfs."); } else { kvm_s390_enable_cmma(); } } }
{ "code": [], "line_no": [] }
void FUNC_0(const S390CPUModel *VAR_0, Error **VAR_1) { struct kvm_s390_vm_cpu_processor VAR_2 = { .fac_list = { 0 }, }; struct kvm_device_attr VAR_3 = { .group = KVM_S390_VM_CPU_MODEL, .VAR_3 = KVM_S390_VM_CPU_PROCESSOR, .addr = (uint64_t) &VAR_2, }; int VAR_4; if (!VAR_0) { if (kvm_s390_cmma_available() && !mem_path) { kvm_s390_enable_cmma(); } return; } if (!kvm_s390_cpu_models_supported()) { error_setg(VAR_1, "KVM doesn't support CPU models"); return; } VAR_2.cpuid = s390_cpuid_from_cpu_model(VAR_0); VAR_2.ibc = s390_ibc_from_cpu_model(VAR_0); s390_fill_feat_block(VAR_0->features, S390_FEAT_TYPE_STFL, (uint8_t *) VAR_2.fac_list); VAR_4 = kvm_vm_ioctl(kvm_state, KVM_SET_DEVICE_ATTR, &VAR_3); if (VAR_4) { error_setg(VAR_1, "KVM: Error configuring the CPU VAR_0: %d", VAR_4); return; } VAR_4 = configure_cpu_feat(VAR_0->features); if (VAR_4) { error_setg(VAR_1, "KVM: Error configuring CPU features: %d", VAR_4); return; } VAR_4 = configure_cpu_subfunc(VAR_0->features); if (VAR_4) { error_setg(VAR_1, "KVM: Error configuring CPU subfunctions: %d", VAR_4); return; } if (test_bit(S390_FEAT_CMM, VAR_0->features)) { if (mem_path) { error_report("Warning: CMM will not be enabled because it is not " "compatible to hugetlbfs."); } else { kvm_s390_enable_cmma(); } } }
[ "void FUNC_0(const S390CPUModel *VAR_0, Error **VAR_1)\n{", "struct kvm_s390_vm_cpu_processor VAR_2 = {", ".fac_list = { 0 },", "};", "struct kvm_device_attr VAR_3 = {", ".group = KVM_S390_VM_CPU_MODEL,\n.VAR_3 = KVM_S390_VM_CPU_PROCESSOR,\n.addr = (uint64_t) &VAR_2,\n};", "int VAR_4;", "if (!VAR_0) {", "if (kvm_s390_cmma_available() && !mem_path) {", "kvm_s390_enable_cmma();", "}", "return;", "}", "if (!kvm_s390_cpu_models_supported()) {", "error_setg(VAR_1, \"KVM doesn't support CPU models\");", "return;", "}", "VAR_2.cpuid = s390_cpuid_from_cpu_model(VAR_0);", "VAR_2.ibc = s390_ibc_from_cpu_model(VAR_0);", "s390_fill_feat_block(VAR_0->features, S390_FEAT_TYPE_STFL,\n(uint8_t *) VAR_2.fac_list);", "VAR_4 = kvm_vm_ioctl(kvm_state, KVM_SET_DEVICE_ATTR, &VAR_3);", "if (VAR_4) {", "error_setg(VAR_1, \"KVM: Error configuring the CPU VAR_0: %d\", VAR_4);", "return;", "}", "VAR_4 = configure_cpu_feat(VAR_0->features);", "if (VAR_4) {", "error_setg(VAR_1, \"KVM: Error configuring CPU features: %d\", VAR_4);", "return;", "}", "VAR_4 = configure_cpu_subfunc(VAR_0->features);", "if (VAR_4) {", "error_setg(VAR_1, \"KVM: Error configuring CPU subfunctions: %d\", VAR_4);", "return;", "}", "if (test_bit(S390_FEAT_CMM, VAR_0->features)) {", "if (mem_path) {", "error_report(\"Warning: CMM will not be enabled because it is not \"\n\"compatible to hugetlbfs.\");", "} else {", "kvm_s390_enable_cmma();", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13, 15, 17, 19 ], [ 21 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53, 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 93 ], [ 95 ], [ 97, 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ] ]
7,433
static void qdm2_calculate_fft (QDM2Context *q, int channel, int sub_packet) { const float gain = (q->channels == 1 && q->nb_channels == 2) ? 0.5f : 1.0f; int i; q->fft.complex[channel][0].re *= 2.0f; q->fft.complex[channel][0].im = 0.0f; q->rdft_ctx.rdft_calc(&q->rdft_ctx, (FFTSample *)q->fft.complex[channel]); /* add samples to output buffer */ for (i = 0; i < ((q->fft_frame_size + 15) & ~15); i++) q->output_buffer[q->channels * i + channel] += ((float *) q->fft.complex[channel])[i] * gain; }
false
FFmpeg
f5be7958e313f3f62505ea7f90007800e8e1dcb5
static void qdm2_calculate_fft (QDM2Context *q, int channel, int sub_packet) { const float gain = (q->channels == 1 && q->nb_channels == 2) ? 0.5f : 1.0f; int i; q->fft.complex[channel][0].re *= 2.0f; q->fft.complex[channel][0].im = 0.0f; q->rdft_ctx.rdft_calc(&q->rdft_ctx, (FFTSample *)q->fft.complex[channel]); for (i = 0; i < ((q->fft_frame_size + 15) & ~15); i++) q->output_buffer[q->channels * i + channel] += ((float *) q->fft.complex[channel])[i] * gain; }
{ "code": [], "line_no": [] }
static void FUNC_0 (QDM2Context *VAR_0, int VAR_1, int VAR_2) { const float VAR_3 = (VAR_0->channels == 1 && VAR_0->nb_channels == 2) ? 0.5f : 1.0f; int VAR_4; VAR_0->fft.complex[VAR_1][0].re *= 2.0f; VAR_0->fft.complex[VAR_1][0].im = 0.0f; VAR_0->rdft_ctx.rdft_calc(&VAR_0->rdft_ctx, (FFTSample *)VAR_0->fft.complex[VAR_1]); for (VAR_4 = 0; VAR_4 < ((VAR_0->fft_frame_size + 15) & ~15); VAR_4++) VAR_0->output_buffer[VAR_0->channels * VAR_4 + VAR_1] += ((float *) VAR_0->fft.complex[VAR_1])[VAR_4] * VAR_3; }
[ "static void FUNC_0 (QDM2Context *VAR_0, int VAR_1, int VAR_2)\n{", "const float VAR_3 = (VAR_0->channels == 1 && VAR_0->nb_channels == 2) ? 0.5f : 1.0f;", "int VAR_4;", "VAR_0->fft.complex[VAR_1][0].re *= 2.0f;", "VAR_0->fft.complex[VAR_1][0].im = 0.0f;", "VAR_0->rdft_ctx.rdft_calc(&VAR_0->rdft_ctx, (FFTSample *)VAR_0->fft.complex[VAR_1]);", "for (VAR_4 = 0; VAR_4 < ((VAR_0->fft_frame_size + 15) & ~15); VAR_4++)", "VAR_0->output_buffer[VAR_0->channels * VAR_4 + VAR_1] += ((float *) VAR_0->fft.complex[VAR_1])[VAR_4] * VAR_3;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ] ]
7,435
int sws_init_context(SwsContext *c, SwsFilter *srcFilter, SwsFilter *dstFilter) { int i, j; int usesVFilter, usesHFilter; int unscaled; SwsFilter dummyFilter= {NULL, NULL, NULL, NULL}; int srcW= c->srcW; int srcH= c->srcH; int dstW= c->dstW; int dstH= c->dstH; int dst_stride = FFALIGN(dstW * sizeof(int16_t)+66, 16); int flags, cpu_flags; enum PixelFormat srcFormat= c->srcFormat; enum PixelFormat dstFormat= c->dstFormat; cpu_flags = av_get_cpu_flags(); flags = c->flags; emms_c(); if (!rgb15to16) sws_rgb2rgb_init(); unscaled = (srcW == dstW && srcH == dstH); handle_jpeg(&srcFormat); handle_jpeg(&dstFormat); if(srcFormat!=c->srcFormat || dstFormat!=c->dstFormat){ av_log(c, AV_LOG_WARNING, "deprecated pixel format used, make sure you did set range correctly\n"); c->srcFormat= srcFormat; c->dstFormat= dstFormat; } if (!sws_isSupportedInput(srcFormat)) { av_log(c, AV_LOG_ERROR, "%s is not supported as input pixel format\n", av_get_pix_fmt_name(srcFormat)); return AVERROR(EINVAL); } if (!sws_isSupportedOutput(dstFormat)) { av_log(c, AV_LOG_ERROR, "%s is not supported as output pixel format\n", av_get_pix_fmt_name(dstFormat)); return AVERROR(EINVAL); } i= flags & ( SWS_POINT |SWS_AREA |SWS_BILINEAR |SWS_FAST_BILINEAR |SWS_BICUBIC |SWS_X |SWS_GAUSS |SWS_LANCZOS |SWS_SINC |SWS_SPLINE |SWS_BICUBLIN); if(!i || (i & (i-1))) { av_log(c, AV_LOG_ERROR, "Exactly one scaler algorithm must be chosen\n"); return AVERROR(EINVAL); } /* sanity check */ if (srcW<4 || srcH<1 || dstW<8 || dstH<1) { //FIXME check if these are enough and try to lowwer them after fixing the relevant parts of the code av_log(c, AV_LOG_ERROR, "%dx%d -> %dx%d is invalid scaling dimension\n", srcW, srcH, dstW, dstH); return AVERROR(EINVAL); } if (!dstFilter) dstFilter= &dummyFilter; if (!srcFilter) srcFilter= &dummyFilter; c->lumXInc= ((srcW<<16) + (dstW>>1))/dstW; c->lumYInc= ((srcH<<16) + (dstH>>1))/dstH; c->dstFormatBpp = av_get_bits_per_pixel(&av_pix_fmt_descriptors[dstFormat]); c->srcFormatBpp = av_get_bits_per_pixel(&av_pix_fmt_descriptors[srcFormat]); c->vRounder= 4* 0x0001000100010001ULL; usesVFilter = (srcFilter->lumV && srcFilter->lumV->length>1) || (srcFilter->chrV && srcFilter->chrV->length>1) || (dstFilter->lumV && dstFilter->lumV->length>1) || (dstFilter->chrV && dstFilter->chrV->length>1); usesHFilter = (srcFilter->lumH && srcFilter->lumH->length>1) || (srcFilter->chrH && srcFilter->chrH->length>1) || (dstFilter->lumH && dstFilter->lumH->length>1) || (dstFilter->chrH && dstFilter->chrH->length>1); getSubSampleFactors(&c->chrSrcHSubSample, &c->chrSrcVSubSample, srcFormat); getSubSampleFactors(&c->chrDstHSubSample, &c->chrDstVSubSample, dstFormat); // reuse chroma for 2 pixels RGB/BGR unless user wants full chroma interpolation if (isAnyRGB(dstFormat) && !(flags&SWS_FULL_CHR_H_INT)) { if (dstW&1) { av_log(c, AV_LOG_DEBUG, "Forcing full internal H chroma due to odd output size\n"); flags |= SWS_FULL_CHR_H_INT; c->flags = flags; } else c->chrDstHSubSample = 1; } // drop some chroma lines if the user wants it c->vChrDrop= (flags&SWS_SRC_V_CHR_DROP_MASK)>>SWS_SRC_V_CHR_DROP_SHIFT; c->chrSrcVSubSample+= c->vChrDrop; // drop every other pixel for chroma calculation unless user wants full chroma if (isAnyRGB(srcFormat) && !(flags&SWS_FULL_CHR_H_INP) && srcFormat!=PIX_FMT_RGB8 && srcFormat!=PIX_FMT_BGR8 && srcFormat!=PIX_FMT_RGB4 && srcFormat!=PIX_FMT_BGR4 && srcFormat!=PIX_FMT_RGB4_BYTE && srcFormat!=PIX_FMT_BGR4_BYTE && ((dstW>>c->chrDstHSubSample) <= (srcW>>1) || (flags&SWS_FAST_BILINEAR))) c->chrSrcHSubSample=1; // Note the -((-x)>>y) is so that we always round toward +inf. c->chrSrcW= -((-srcW) >> c->chrSrcHSubSample); c->chrSrcH= -((-srcH) >> c->chrSrcVSubSample); c->chrDstW= -((-dstW) >> c->chrDstHSubSample); c->chrDstH= -((-dstH) >> c->chrDstVSubSample); /* unscaled special cases */ if (unscaled && !usesHFilter && !usesVFilter && (c->srcRange == c->dstRange || isAnyRGB(dstFormat))) { ff_get_unscaled_swscale(c); if (c->swScale) { if (flags&SWS_PRINT_INFO) av_log(c, AV_LOG_INFO, "using unscaled %s -> %s special converter\n", av_get_pix_fmt_name(srcFormat), av_get_pix_fmt_name(dstFormat)); return 0; } } c->srcBpc = 1 + av_pix_fmt_descriptors[srcFormat].comp[0].depth_minus1; if (c->srcBpc < 8) c->srcBpc = 8; c->dstBpc = 1 + av_pix_fmt_descriptors[dstFormat].comp[0].depth_minus1; if (c->dstBpc < 8) c->dstBpc = 8; if (isAnyRGB(srcFormat) || srcFormat == PIX_FMT_PAL8) c->srcBpc = 16; if (c->dstBpc == 16) dst_stride <<= 1; FF_ALLOC_OR_GOTO(c, c->formatConvBuffer, FFALIGN(srcW*2+78, 16) * 2, fail); if (HAVE_MMX2 && cpu_flags & AV_CPU_FLAG_MMX2 && c->srcBpc == 8 && c->dstBpc <= 10) { c->canMMX2BeUsed= (dstW >=srcW && (dstW&31)==0 && (srcW&15)==0) ? 1 : 0; if (!c->canMMX2BeUsed && dstW >=srcW && (srcW&15)==0 && (flags&SWS_FAST_BILINEAR)) { if (flags&SWS_PRINT_INFO) av_log(c, AV_LOG_INFO, "output width is not a multiple of 32 -> no MMX2 scaler\n"); } if (usesHFilter || isNBPS(c->srcFormat) || is16BPS(c->srcFormat) || isAnyRGB(c->srcFormat)) c->canMMX2BeUsed=0; } else c->canMMX2BeUsed=0; c->chrXInc= ((c->chrSrcW<<16) + (c->chrDstW>>1))/c->chrDstW; c->chrYInc= ((c->chrSrcH<<16) + (c->chrDstH>>1))/c->chrDstH; // match pixel 0 of the src to pixel 0 of dst and match pixel n-2 of src to pixel n-2 of dst // but only for the FAST_BILINEAR mode otherwise do correct scaling // n-2 is the last chrominance sample available // this is not perfect, but no one should notice the difference, the more correct variant // would be like the vertical one, but that would require some special code for the // first and last pixel if (flags&SWS_FAST_BILINEAR) { if (c->canMMX2BeUsed) { c->lumXInc+= 20; c->chrXInc+= 20; } //we don't use the x86 asm scaler if MMX is available else if (HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX && c->dstBpc <= 10) { c->lumXInc = ((srcW-2)<<16)/(dstW-2) - 20; c->chrXInc = ((c->chrSrcW-2)<<16)/(c->chrDstW-2) - 20; } } /* precalculate horizontal scaler filter coefficients */ { #if HAVE_MMX2 // can't downscale !!! if (c->canMMX2BeUsed && (flags & SWS_FAST_BILINEAR)) { c->lumMmx2FilterCodeSize = initMMX2HScaler( dstW, c->lumXInc, NULL, NULL, NULL, 8); c->chrMmx2FilterCodeSize = initMMX2HScaler(c->chrDstW, c->chrXInc, NULL, NULL, NULL, 4); #ifdef MAP_ANONYMOUS c->lumMmx2FilterCode = mmap(NULL, c->lumMmx2FilterCodeSize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); c->chrMmx2FilterCode = mmap(NULL, c->chrMmx2FilterCodeSize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); #elif HAVE_VIRTUALALLOC c->lumMmx2FilterCode = VirtualAlloc(NULL, c->lumMmx2FilterCodeSize, MEM_COMMIT, PAGE_EXECUTE_READWRITE); c->chrMmx2FilterCode = VirtualAlloc(NULL, c->chrMmx2FilterCodeSize, MEM_COMMIT, PAGE_EXECUTE_READWRITE); #else c->lumMmx2FilterCode = av_malloc(c->lumMmx2FilterCodeSize); c->chrMmx2FilterCode = av_malloc(c->chrMmx2FilterCodeSize); #endif #ifdef MAP_ANONYMOUS if (c->lumMmx2FilterCode == MAP_FAILED || c->chrMmx2FilterCode == MAP_FAILED) #else if (!c->lumMmx2FilterCode || !c->chrMmx2FilterCode) #endif { av_log(c, AV_LOG_ERROR, "Failed to allocate MMX2FilterCode\n"); return AVERROR(ENOMEM); } FF_ALLOCZ_OR_GOTO(c, c->hLumFilter , (dstW /8+8)*sizeof(int16_t), fail); FF_ALLOCZ_OR_GOTO(c, c->hChrFilter , (c->chrDstW /4+8)*sizeof(int16_t), fail); FF_ALLOCZ_OR_GOTO(c, c->hLumFilterPos, (dstW /2/8+8)*sizeof(int32_t), fail); FF_ALLOCZ_OR_GOTO(c, c->hChrFilterPos, (c->chrDstW/2/4+8)*sizeof(int32_t), fail); initMMX2HScaler( dstW, c->lumXInc, c->lumMmx2FilterCode, c->hLumFilter, (uint32_t*)c->hLumFilterPos, 8); initMMX2HScaler(c->chrDstW, c->chrXInc, c->chrMmx2FilterCode, c->hChrFilter, (uint32_t*)c->hChrFilterPos, 4); #ifdef MAP_ANONYMOUS mprotect(c->lumMmx2FilterCode, c->lumMmx2FilterCodeSize, PROT_EXEC | PROT_READ); mprotect(c->chrMmx2FilterCode, c->chrMmx2FilterCodeSize, PROT_EXEC | PROT_READ); #endif } else #endif /* HAVE_MMX2 */ { const int filterAlign= (HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) ? 4 : (HAVE_ALTIVEC && cpu_flags & AV_CPU_FLAG_ALTIVEC) ? 8 : 1; if (initFilter(&c->hLumFilter, &c->hLumFilterPos, &c->hLumFilterSize, c->lumXInc, srcW , dstW, filterAlign, 1<<14, (flags&SWS_BICUBLIN) ? (flags|SWS_BICUBIC) : flags, cpu_flags, srcFilter->lumH, dstFilter->lumH, c->param) < 0) goto fail; if (initFilter(&c->hChrFilter, &c->hChrFilterPos, &c->hChrFilterSize, c->chrXInc, c->chrSrcW, c->chrDstW, filterAlign, 1<<14, (flags&SWS_BICUBLIN) ? (flags|SWS_BILINEAR) : flags, cpu_flags, srcFilter->chrH, dstFilter->chrH, c->param) < 0) goto fail; } } // initialize horizontal stuff /* precalculate vertical scaler filter coefficients */ { const int filterAlign= (HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) ? 2 : (HAVE_ALTIVEC && cpu_flags & AV_CPU_FLAG_ALTIVEC) ? 8 : 1; if (initFilter(&c->vLumFilter, &c->vLumFilterPos, &c->vLumFilterSize, c->lumYInc, srcH , dstH, filterAlign, (1<<12), (flags&SWS_BICUBLIN) ? (flags|SWS_BICUBIC) : flags, cpu_flags, srcFilter->lumV, dstFilter->lumV, c->param) < 0) goto fail; if (initFilter(&c->vChrFilter, &c->vChrFilterPos, &c->vChrFilterSize, c->chrYInc, c->chrSrcH, c->chrDstH, filterAlign, (1<<12), (flags&SWS_BICUBLIN) ? (flags|SWS_BILINEAR) : flags, cpu_flags, srcFilter->chrV, dstFilter->chrV, c->param) < 0) goto fail; #if HAVE_ALTIVEC FF_ALLOC_OR_GOTO(c, c->vYCoeffsBank, sizeof (vector signed short)*c->vLumFilterSize*c->dstH, fail); FF_ALLOC_OR_GOTO(c, c->vCCoeffsBank, sizeof (vector signed short)*c->vChrFilterSize*c->chrDstH, fail); for (i=0;i<c->vLumFilterSize*c->dstH;i++) { int j; short *p = (short *)&c->vYCoeffsBank[i]; for (j=0;j<8;j++) p[j] = c->vLumFilter[i]; } for (i=0;i<c->vChrFilterSize*c->chrDstH;i++) { int j; short *p = (short *)&c->vCCoeffsBank[i]; for (j=0;j<8;j++) p[j] = c->vChrFilter[i]; } #endif } // calculate buffer sizes so that they won't run out while handling these damn slices c->vLumBufSize= c->vLumFilterSize; c->vChrBufSize= c->vChrFilterSize; for (i=0; i<dstH; i++) { int chrI= (int64_t)i*c->chrDstH / dstH; int nextSlice= FFMAX(c->vLumFilterPos[i ] + c->vLumFilterSize - 1, ((c->vChrFilterPos[chrI] + c->vChrFilterSize - 1)<<c->chrSrcVSubSample)); nextSlice>>= c->chrSrcVSubSample; nextSlice<<= c->chrSrcVSubSample; if (c->vLumFilterPos[i ] + c->vLumBufSize < nextSlice) c->vLumBufSize= nextSlice - c->vLumFilterPos[i]; if (c->vChrFilterPos[chrI] + c->vChrBufSize < (nextSlice>>c->chrSrcVSubSample)) c->vChrBufSize= (nextSlice>>c->chrSrcVSubSample) - c->vChrFilterPos[chrI]; } // allocate pixbufs (we use dynamic allocation because otherwise we would need to // allocate several megabytes to handle all possible cases) FF_ALLOC_OR_GOTO(c, c->lumPixBuf, c->vLumBufSize*2*sizeof(int16_t*), fail); FF_ALLOC_OR_GOTO(c, c->chrUPixBuf, c->vChrBufSize*2*sizeof(int16_t*), fail); FF_ALLOC_OR_GOTO(c, c->chrVPixBuf, c->vChrBufSize*2*sizeof(int16_t*), fail); if (CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat) && isALPHA(c->dstFormat)) FF_ALLOCZ_OR_GOTO(c, c->alpPixBuf, c->vLumBufSize*2*sizeof(int16_t*), fail); //Note we need at least one pixel more at the end because of the MMX code (just in case someone wanna replace the 4000/8000) /* align at 16 bytes for AltiVec */ for (i=0; i<c->vLumBufSize; i++) { FF_ALLOCZ_OR_GOTO(c, c->lumPixBuf[i+c->vLumBufSize], dst_stride+16, fail); c->lumPixBuf[i] = c->lumPixBuf[i+c->vLumBufSize]; } // 64 / c->scalingBpp is the same as 16 / sizeof(scaling_intermediate) c->uv_off = (dst_stride>>1) + 64 / (c->dstBpc &~ 7); c->uv_offx2 = dst_stride + 16; for (i=0; i<c->vChrBufSize; i++) { FF_ALLOC_OR_GOTO(c, c->chrUPixBuf[i+c->vChrBufSize], dst_stride*2+32, fail); c->chrUPixBuf[i] = c->chrUPixBuf[i+c->vChrBufSize]; c->chrVPixBuf[i] = c->chrVPixBuf[i+c->vChrBufSize] = c->chrUPixBuf[i] + (dst_stride >> 1) + 8; } if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) for (i=0; i<c->vLumBufSize; i++) { FF_ALLOCZ_OR_GOTO(c, c->alpPixBuf[i+c->vLumBufSize], dst_stride+16, fail); c->alpPixBuf[i] = c->alpPixBuf[i+c->vLumBufSize]; } //try to avoid drawing green stuff between the right end and the stride end for (i=0; i<c->vChrBufSize; i++) if(av_pix_fmt_descriptors[c->dstFormat].comp[0].depth_minus1 == 15){ av_assert0(c->dstBpc > 10); for(j=0; j<dst_stride/2+1; j++) ((int32_t*)(c->chrUPixBuf[i]))[j] = 1<<18; } else for(j=0; j<dst_stride+1; j++) ((int16_t*)(c->chrUPixBuf[i]))[j] = 1<<14; assert(c->chrDstH <= dstH); if (flags&SWS_PRINT_INFO) { if (flags&SWS_FAST_BILINEAR) av_log(c, AV_LOG_INFO, "FAST_BILINEAR scaler, "); else if (flags&SWS_BILINEAR) av_log(c, AV_LOG_INFO, "BILINEAR scaler, "); else if (flags&SWS_BICUBIC) av_log(c, AV_LOG_INFO, "BICUBIC scaler, "); else if (flags&SWS_X) av_log(c, AV_LOG_INFO, "Experimental scaler, "); else if (flags&SWS_POINT) av_log(c, AV_LOG_INFO, "Nearest Neighbor / POINT scaler, "); else if (flags&SWS_AREA) av_log(c, AV_LOG_INFO, "Area Averaging scaler, "); else if (flags&SWS_BICUBLIN) av_log(c, AV_LOG_INFO, "luma BICUBIC / chroma BILINEAR scaler, "); else if (flags&SWS_GAUSS) av_log(c, AV_LOG_INFO, "Gaussian scaler, "); else if (flags&SWS_SINC) av_log(c, AV_LOG_INFO, "Sinc scaler, "); else if (flags&SWS_LANCZOS) av_log(c, AV_LOG_INFO, "Lanczos scaler, "); else if (flags&SWS_SPLINE) av_log(c, AV_LOG_INFO, "Bicubic spline scaler, "); else av_log(c, AV_LOG_INFO, "ehh flags invalid?! "); av_log(c, AV_LOG_INFO, "from %s to %s%s ", av_get_pix_fmt_name(srcFormat), #ifdef DITHER1XBPP dstFormat == PIX_FMT_BGR555 || dstFormat == PIX_FMT_BGR565 || dstFormat == PIX_FMT_RGB444BE || dstFormat == PIX_FMT_RGB444LE || dstFormat == PIX_FMT_BGR444BE || dstFormat == PIX_FMT_BGR444LE ? "dithered " : "", #else "", #endif av_get_pix_fmt_name(dstFormat)); if (HAVE_MMX2 && cpu_flags & AV_CPU_FLAG_MMX2) av_log(c, AV_LOG_INFO, "using MMX2\n"); else if (HAVE_AMD3DNOW && cpu_flags & AV_CPU_FLAG_3DNOW) av_log(c, AV_LOG_INFO, "using 3DNOW\n"); else if (HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) av_log(c, AV_LOG_INFO, "using MMX\n"); else if (HAVE_ALTIVEC && cpu_flags & AV_CPU_FLAG_ALTIVEC) av_log(c, AV_LOG_INFO, "using AltiVec\n"); else av_log(c, AV_LOG_INFO, "using C\n"); av_log(c, AV_LOG_VERBOSE, "%dx%d -> %dx%d\n", srcW, srcH, dstW, dstH); av_log(c, AV_LOG_DEBUG, "lum srcW=%d srcH=%d dstW=%d dstH=%d xInc=%d yInc=%d\n", c->srcW, c->srcH, c->dstW, c->dstH, c->lumXInc, c->lumYInc); av_log(c, AV_LOG_DEBUG, "chr srcW=%d srcH=%d dstW=%d dstH=%d xInc=%d yInc=%d\n", c->chrSrcW, c->chrSrcH, c->chrDstW, c->chrDstH, c->chrXInc, c->chrYInc); } c->swScale= ff_getSwsFunc(c); return 0; fail: //FIXME replace things by appropriate error codes return -1; }
false
FFmpeg
0421b6dc7a1463b9263b9d63533dd7c5be8ffa97
int sws_init_context(SwsContext *c, SwsFilter *srcFilter, SwsFilter *dstFilter) { int i, j; int usesVFilter, usesHFilter; int unscaled; SwsFilter dummyFilter= {NULL, NULL, NULL, NULL}; int srcW= c->srcW; int srcH= c->srcH; int dstW= c->dstW; int dstH= c->dstH; int dst_stride = FFALIGN(dstW * sizeof(int16_t)+66, 16); int flags, cpu_flags; enum PixelFormat srcFormat= c->srcFormat; enum PixelFormat dstFormat= c->dstFormat; cpu_flags = av_get_cpu_flags(); flags = c->flags; emms_c(); if (!rgb15to16) sws_rgb2rgb_init(); unscaled = (srcW == dstW && srcH == dstH); handle_jpeg(&srcFormat); handle_jpeg(&dstFormat); if(srcFormat!=c->srcFormat || dstFormat!=c->dstFormat){ av_log(c, AV_LOG_WARNING, "deprecated pixel format used, make sure you did set range correctly\n"); c->srcFormat= srcFormat; c->dstFormat= dstFormat; } if (!sws_isSupportedInput(srcFormat)) { av_log(c, AV_LOG_ERROR, "%s is not supported as input pixel format\n", av_get_pix_fmt_name(srcFormat)); return AVERROR(EINVAL); } if (!sws_isSupportedOutput(dstFormat)) { av_log(c, AV_LOG_ERROR, "%s is not supported as output pixel format\n", av_get_pix_fmt_name(dstFormat)); return AVERROR(EINVAL); } i= flags & ( SWS_POINT |SWS_AREA |SWS_BILINEAR |SWS_FAST_BILINEAR |SWS_BICUBIC |SWS_X |SWS_GAUSS |SWS_LANCZOS |SWS_SINC |SWS_SPLINE |SWS_BICUBLIN); if(!i || (i & (i-1))) { av_log(c, AV_LOG_ERROR, "Exactly one scaler algorithm must be chosen\n"); return AVERROR(EINVAL); } if (srcW<4 || srcH<1 || dstW<8 || dstH<1) { av_log(c, AV_LOG_ERROR, "%dx%d -> %dx%d is invalid scaling dimension\n", srcW, srcH, dstW, dstH); return AVERROR(EINVAL); } if (!dstFilter) dstFilter= &dummyFilter; if (!srcFilter) srcFilter= &dummyFilter; c->lumXInc= ((srcW<<16) + (dstW>>1))/dstW; c->lumYInc= ((srcH<<16) + (dstH>>1))/dstH; c->dstFormatBpp = av_get_bits_per_pixel(&av_pix_fmt_descriptors[dstFormat]); c->srcFormatBpp = av_get_bits_per_pixel(&av_pix_fmt_descriptors[srcFormat]); c->vRounder= 4* 0x0001000100010001ULL; usesVFilter = (srcFilter->lumV && srcFilter->lumV->length>1) || (srcFilter->chrV && srcFilter->chrV->length>1) || (dstFilter->lumV && dstFilter->lumV->length>1) || (dstFilter->chrV && dstFilter->chrV->length>1); usesHFilter = (srcFilter->lumH && srcFilter->lumH->length>1) || (srcFilter->chrH && srcFilter->chrH->length>1) || (dstFilter->lumH && dstFilter->lumH->length>1) || (dstFilter->chrH && dstFilter->chrH->length>1); getSubSampleFactors(&c->chrSrcHSubSample, &c->chrSrcVSubSample, srcFormat); getSubSampleFactors(&c->chrDstHSubSample, &c->chrDstVSubSample, dstFormat); if (isAnyRGB(dstFormat) && !(flags&SWS_FULL_CHR_H_INT)) { if (dstW&1) { av_log(c, AV_LOG_DEBUG, "Forcing full internal H chroma due to odd output size\n"); flags |= SWS_FULL_CHR_H_INT; c->flags = flags; } else c->chrDstHSubSample = 1; } c->vChrDrop= (flags&SWS_SRC_V_CHR_DROP_MASK)>>SWS_SRC_V_CHR_DROP_SHIFT; c->chrSrcVSubSample+= c->vChrDrop; if (isAnyRGB(srcFormat) && !(flags&SWS_FULL_CHR_H_INP) && srcFormat!=PIX_FMT_RGB8 && srcFormat!=PIX_FMT_BGR8 && srcFormat!=PIX_FMT_RGB4 && srcFormat!=PIX_FMT_BGR4 && srcFormat!=PIX_FMT_RGB4_BYTE && srcFormat!=PIX_FMT_BGR4_BYTE && ((dstW>>c->chrDstHSubSample) <= (srcW>>1) || (flags&SWS_FAST_BILINEAR))) c->chrSrcHSubSample=1; c->chrSrcW= -((-srcW) >> c->chrSrcHSubSample); c->chrSrcH= -((-srcH) >> c->chrSrcVSubSample); c->chrDstW= -((-dstW) >> c->chrDstHSubSample); c->chrDstH= -((-dstH) >> c->chrDstVSubSample); if (unscaled && !usesHFilter && !usesVFilter && (c->srcRange == c->dstRange || isAnyRGB(dstFormat))) { ff_get_unscaled_swscale(c); if (c->swScale) { if (flags&SWS_PRINT_INFO) av_log(c, AV_LOG_INFO, "using unscaled %s -> %s special converter\n", av_get_pix_fmt_name(srcFormat), av_get_pix_fmt_name(dstFormat)); return 0; } } c->srcBpc = 1 + av_pix_fmt_descriptors[srcFormat].comp[0].depth_minus1; if (c->srcBpc < 8) c->srcBpc = 8; c->dstBpc = 1 + av_pix_fmt_descriptors[dstFormat].comp[0].depth_minus1; if (c->dstBpc < 8) c->dstBpc = 8; if (isAnyRGB(srcFormat) || srcFormat == PIX_FMT_PAL8) c->srcBpc = 16; if (c->dstBpc == 16) dst_stride <<= 1; FF_ALLOC_OR_GOTO(c, c->formatConvBuffer, FFALIGN(srcW*2+78, 16) * 2, fail); if (HAVE_MMX2 && cpu_flags & AV_CPU_FLAG_MMX2 && c->srcBpc == 8 && c->dstBpc <= 10) { c->canMMX2BeUsed= (dstW >=srcW && (dstW&31)==0 && (srcW&15)==0) ? 1 : 0; if (!c->canMMX2BeUsed && dstW >=srcW && (srcW&15)==0 && (flags&SWS_FAST_BILINEAR)) { if (flags&SWS_PRINT_INFO) av_log(c, AV_LOG_INFO, "output width is not a multiple of 32 -> no MMX2 scaler\n"); } if (usesHFilter || isNBPS(c->srcFormat) || is16BPS(c->srcFormat) || isAnyRGB(c->srcFormat)) c->canMMX2BeUsed=0; } else c->canMMX2BeUsed=0; c->chrXInc= ((c->chrSrcW<<16) + (c->chrDstW>>1))/c->chrDstW; c->chrYInc= ((c->chrSrcH<<16) + (c->chrDstH>>1))/c->chrDstH; if (flags&SWS_FAST_BILINEAR) { if (c->canMMX2BeUsed) { c->lumXInc+= 20; c->chrXInc+= 20; } else if (HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX && c->dstBpc <= 10) { c->lumXInc = ((srcW-2)<<16)/(dstW-2) - 20; c->chrXInc = ((c->chrSrcW-2)<<16)/(c->chrDstW-2) - 20; } } { #if HAVE_MMX2 if (c->canMMX2BeUsed && (flags & SWS_FAST_BILINEAR)) { c->lumMmx2FilterCodeSize = initMMX2HScaler( dstW, c->lumXInc, NULL, NULL, NULL, 8); c->chrMmx2FilterCodeSize = initMMX2HScaler(c->chrDstW, c->chrXInc, NULL, NULL, NULL, 4); #ifdef MAP_ANONYMOUS c->lumMmx2FilterCode = mmap(NULL, c->lumMmx2FilterCodeSize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); c->chrMmx2FilterCode = mmap(NULL, c->chrMmx2FilterCodeSize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); #elif HAVE_VIRTUALALLOC c->lumMmx2FilterCode = VirtualAlloc(NULL, c->lumMmx2FilterCodeSize, MEM_COMMIT, PAGE_EXECUTE_READWRITE); c->chrMmx2FilterCode = VirtualAlloc(NULL, c->chrMmx2FilterCodeSize, MEM_COMMIT, PAGE_EXECUTE_READWRITE); #else c->lumMmx2FilterCode = av_malloc(c->lumMmx2FilterCodeSize); c->chrMmx2FilterCode = av_malloc(c->chrMmx2FilterCodeSize); #endif #ifdef MAP_ANONYMOUS if (c->lumMmx2FilterCode == MAP_FAILED || c->chrMmx2FilterCode == MAP_FAILED) #else if (!c->lumMmx2FilterCode || !c->chrMmx2FilterCode) #endif { av_log(c, AV_LOG_ERROR, "Failed to allocate MMX2FilterCode\n"); return AVERROR(ENOMEM); } FF_ALLOCZ_OR_GOTO(c, c->hLumFilter , (dstW /8+8)*sizeof(int16_t), fail); FF_ALLOCZ_OR_GOTO(c, c->hChrFilter , (c->chrDstW /4+8)*sizeof(int16_t), fail); FF_ALLOCZ_OR_GOTO(c, c->hLumFilterPos, (dstW /2/8+8)*sizeof(int32_t), fail); FF_ALLOCZ_OR_GOTO(c, c->hChrFilterPos, (c->chrDstW/2/4+8)*sizeof(int32_t), fail); initMMX2HScaler( dstW, c->lumXInc, c->lumMmx2FilterCode, c->hLumFilter, (uint32_t*)c->hLumFilterPos, 8); initMMX2HScaler(c->chrDstW, c->chrXInc, c->chrMmx2FilterCode, c->hChrFilter, (uint32_t*)c->hChrFilterPos, 4); #ifdef MAP_ANONYMOUS mprotect(c->lumMmx2FilterCode, c->lumMmx2FilterCodeSize, PROT_EXEC | PROT_READ); mprotect(c->chrMmx2FilterCode, c->chrMmx2FilterCodeSize, PROT_EXEC | PROT_READ); #endif } else #endif { const int filterAlign= (HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) ? 4 : (HAVE_ALTIVEC && cpu_flags & AV_CPU_FLAG_ALTIVEC) ? 8 : 1; if (initFilter(&c->hLumFilter, &c->hLumFilterPos, &c->hLumFilterSize, c->lumXInc, srcW , dstW, filterAlign, 1<<14, (flags&SWS_BICUBLIN) ? (flags|SWS_BICUBIC) : flags, cpu_flags, srcFilter->lumH, dstFilter->lumH, c->param) < 0) goto fail; if (initFilter(&c->hChrFilter, &c->hChrFilterPos, &c->hChrFilterSize, c->chrXInc, c->chrSrcW, c->chrDstW, filterAlign, 1<<14, (flags&SWS_BICUBLIN) ? (flags|SWS_BILINEAR) : flags, cpu_flags, srcFilter->chrH, dstFilter->chrH, c->param) < 0) goto fail; } } { const int filterAlign= (HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) ? 2 : (HAVE_ALTIVEC && cpu_flags & AV_CPU_FLAG_ALTIVEC) ? 8 : 1; if (initFilter(&c->vLumFilter, &c->vLumFilterPos, &c->vLumFilterSize, c->lumYInc, srcH , dstH, filterAlign, (1<<12), (flags&SWS_BICUBLIN) ? (flags|SWS_BICUBIC) : flags, cpu_flags, srcFilter->lumV, dstFilter->lumV, c->param) < 0) goto fail; if (initFilter(&c->vChrFilter, &c->vChrFilterPos, &c->vChrFilterSize, c->chrYInc, c->chrSrcH, c->chrDstH, filterAlign, (1<<12), (flags&SWS_BICUBLIN) ? (flags|SWS_BILINEAR) : flags, cpu_flags, srcFilter->chrV, dstFilter->chrV, c->param) < 0) goto fail; #if HAVE_ALTIVEC FF_ALLOC_OR_GOTO(c, c->vYCoeffsBank, sizeof (vector signed short)*c->vLumFilterSize*c->dstH, fail); FF_ALLOC_OR_GOTO(c, c->vCCoeffsBank, sizeof (vector signed short)*c->vChrFilterSize*c->chrDstH, fail); for (i=0;i<c->vLumFilterSize*c->dstH;i++) { int j; short *p = (short *)&c->vYCoeffsBank[i]; for (j=0;j<8;j++) p[j] = c->vLumFilter[i]; } for (i=0;i<c->vChrFilterSize*c->chrDstH;i++) { int j; short *p = (short *)&c->vCCoeffsBank[i]; for (j=0;j<8;j++) p[j] = c->vChrFilter[i]; } #endif } c->vLumBufSize= c->vLumFilterSize; c->vChrBufSize= c->vChrFilterSize; for (i=0; i<dstH; i++) { int chrI= (int64_t)i*c->chrDstH / dstH; int nextSlice= FFMAX(c->vLumFilterPos[i ] + c->vLumFilterSize - 1, ((c->vChrFilterPos[chrI] + c->vChrFilterSize - 1)<<c->chrSrcVSubSample)); nextSlice>>= c->chrSrcVSubSample; nextSlice<<= c->chrSrcVSubSample; if (c->vLumFilterPos[i ] + c->vLumBufSize < nextSlice) c->vLumBufSize= nextSlice - c->vLumFilterPos[i]; if (c->vChrFilterPos[chrI] + c->vChrBufSize < (nextSlice>>c->chrSrcVSubSample)) c->vChrBufSize= (nextSlice>>c->chrSrcVSubSample) - c->vChrFilterPos[chrI]; } FF_ALLOC_OR_GOTO(c, c->lumPixBuf, c->vLumBufSize*2*sizeof(int16_t*), fail); FF_ALLOC_OR_GOTO(c, c->chrUPixBuf, c->vChrBufSize*2*sizeof(int16_t*), fail); FF_ALLOC_OR_GOTO(c, c->chrVPixBuf, c->vChrBufSize*2*sizeof(int16_t*), fail); if (CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat) && isALPHA(c->dstFormat)) FF_ALLOCZ_OR_GOTO(c, c->alpPixBuf, c->vLumBufSize*2*sizeof(int16_t*), fail); for (i=0; i<c->vLumBufSize; i++) { FF_ALLOCZ_OR_GOTO(c, c->lumPixBuf[i+c->vLumBufSize], dst_stride+16, fail); c->lumPixBuf[i] = c->lumPixBuf[i+c->vLumBufSize]; } c->uv_off = (dst_stride>>1) + 64 / (c->dstBpc &~ 7); c->uv_offx2 = dst_stride + 16; for (i=0; i<c->vChrBufSize; i++) { FF_ALLOC_OR_GOTO(c, c->chrUPixBuf[i+c->vChrBufSize], dst_stride*2+32, fail); c->chrUPixBuf[i] = c->chrUPixBuf[i+c->vChrBufSize]; c->chrVPixBuf[i] = c->chrVPixBuf[i+c->vChrBufSize] = c->chrUPixBuf[i] + (dst_stride >> 1) + 8; } if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) for (i=0; i<c->vLumBufSize; i++) { FF_ALLOCZ_OR_GOTO(c, c->alpPixBuf[i+c->vLumBufSize], dst_stride+16, fail); c->alpPixBuf[i] = c->alpPixBuf[i+c->vLumBufSize]; } for (i=0; i<c->vChrBufSize; i++) if(av_pix_fmt_descriptors[c->dstFormat].comp[0].depth_minus1 == 15){ av_assert0(c->dstBpc > 10); for(j=0; j<dst_stride/2+1; j++) ((int32_t*)(c->chrUPixBuf[i]))[j] = 1<<18; } else for(j=0; j<dst_stride+1; j++) ((int16_t*)(c->chrUPixBuf[i]))[j] = 1<<14; assert(c->chrDstH <= dstH); if (flags&SWS_PRINT_INFO) { if (flags&SWS_FAST_BILINEAR) av_log(c, AV_LOG_INFO, "FAST_BILINEAR scaler, "); else if (flags&SWS_BILINEAR) av_log(c, AV_LOG_INFO, "BILINEAR scaler, "); else if (flags&SWS_BICUBIC) av_log(c, AV_LOG_INFO, "BICUBIC scaler, "); else if (flags&SWS_X) av_log(c, AV_LOG_INFO, "Experimental scaler, "); else if (flags&SWS_POINT) av_log(c, AV_LOG_INFO, "Nearest Neighbor / POINT scaler, "); else if (flags&SWS_AREA) av_log(c, AV_LOG_INFO, "Area Averaging scaler, "); else if (flags&SWS_BICUBLIN) av_log(c, AV_LOG_INFO, "luma BICUBIC / chroma BILINEAR scaler, "); else if (flags&SWS_GAUSS) av_log(c, AV_LOG_INFO, "Gaussian scaler, "); else if (flags&SWS_SINC) av_log(c, AV_LOG_INFO, "Sinc scaler, "); else if (flags&SWS_LANCZOS) av_log(c, AV_LOG_INFO, "Lanczos scaler, "); else if (flags&SWS_SPLINE) av_log(c, AV_LOG_INFO, "Bicubic spline scaler, "); else av_log(c, AV_LOG_INFO, "ehh flags invalid?! "); av_log(c, AV_LOG_INFO, "from %s to %s%s ", av_get_pix_fmt_name(srcFormat), #ifdef DITHER1XBPP dstFormat == PIX_FMT_BGR555 || dstFormat == PIX_FMT_BGR565 || dstFormat == PIX_FMT_RGB444BE || dstFormat == PIX_FMT_RGB444LE || dstFormat == PIX_FMT_BGR444BE || dstFormat == PIX_FMT_BGR444LE ? "dithered " : "", #else "", #endif av_get_pix_fmt_name(dstFormat)); if (HAVE_MMX2 && cpu_flags & AV_CPU_FLAG_MMX2) av_log(c, AV_LOG_INFO, "using MMX2\n"); else if (HAVE_AMD3DNOW && cpu_flags & AV_CPU_FLAG_3DNOW) av_log(c, AV_LOG_INFO, "using 3DNOW\n"); else if (HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) av_log(c, AV_LOG_INFO, "using MMX\n"); else if (HAVE_ALTIVEC && cpu_flags & AV_CPU_FLAG_ALTIVEC) av_log(c, AV_LOG_INFO, "using AltiVec\n"); else av_log(c, AV_LOG_INFO, "using C\n"); av_log(c, AV_LOG_VERBOSE, "%dx%d -> %dx%d\n", srcW, srcH, dstW, dstH); av_log(c, AV_LOG_DEBUG, "lum srcW=%d srcH=%d dstW=%d dstH=%d xInc=%d yInc=%d\n", c->srcW, c->srcH, c->dstW, c->dstH, c->lumXInc, c->lumYInc); av_log(c, AV_LOG_DEBUG, "chr srcW=%d srcH=%d dstW=%d dstH=%d xInc=%d yInc=%d\n", c->chrSrcW, c->chrSrcH, c->chrDstW, c->chrDstH, c->chrXInc, c->chrYInc); } c->swScale= ff_getSwsFunc(c); return 0; fail: return -1; }
{ "code": [], "line_no": [] }
int FUNC_0(SwsContext *VAR_0, SwsFilter *VAR_1, SwsFilter *VAR_2) { int VAR_3, VAR_4; int VAR_5, VAR_6; int VAR_7; SwsFilter dummyFilter= {NULL, NULL, NULL, NULL}; int VAR_8= VAR_0->VAR_8; int VAR_9= VAR_0->VAR_9; int VAR_10= VAR_0->VAR_10; int VAR_11= VAR_0->VAR_11; int VAR_12 = FFALIGN(VAR_10 * sizeof(int16_t)+66, 16); int VAR_13, VAR_14; enum PixelFormat VAR_15= VAR_0->VAR_15; enum PixelFormat VAR_16= VAR_0->VAR_16; VAR_14 = av_get_cpu_flags(); VAR_13 = VAR_0->VAR_13; emms_c(); if (!rgb15to16) sws_rgb2rgb_init(); VAR_7 = (VAR_8 == VAR_10 && VAR_9 == VAR_11); handle_jpeg(&VAR_15); handle_jpeg(&VAR_16); if(VAR_15!=VAR_0->VAR_15 || VAR_16!=VAR_0->VAR_16){ av_log(VAR_0, AV_LOG_WARNING, "deprecated pixel format used, make sure you did set range correctly\n"); VAR_0->VAR_15= VAR_15; VAR_0->VAR_16= VAR_16; } if (!sws_isSupportedInput(VAR_15)) { av_log(VAR_0, AV_LOG_ERROR, "%s is not supported as input pixel format\n", av_get_pix_fmt_name(VAR_15)); return AVERROR(EINVAL); } if (!sws_isSupportedOutput(VAR_16)) { av_log(VAR_0, AV_LOG_ERROR, "%s is not supported as output pixel format\n", av_get_pix_fmt_name(VAR_16)); return AVERROR(EINVAL); } VAR_3= VAR_13 & ( SWS_POINT |SWS_AREA |SWS_BILINEAR |SWS_FAST_BILINEAR |SWS_BICUBIC |SWS_X |SWS_GAUSS |SWS_LANCZOS |SWS_SINC |SWS_SPLINE |SWS_BICUBLIN); if(!VAR_3 || (VAR_3 & (VAR_3-1))) { av_log(VAR_0, AV_LOG_ERROR, "Exactly one scaler algorithm must be chosen\n"); return AVERROR(EINVAL); } if (VAR_8<4 || VAR_9<1 || VAR_10<8 || VAR_11<1) { av_log(VAR_0, AV_LOG_ERROR, "%dx%d -> %dx%d is invalid scaling dimension\n", VAR_8, VAR_9, VAR_10, VAR_11); return AVERROR(EINVAL); } if (!VAR_2) VAR_2= &dummyFilter; if (!VAR_1) VAR_1= &dummyFilter; VAR_0->lumXInc= ((VAR_8<<16) + (VAR_10>>1))/VAR_10; VAR_0->lumYInc= ((VAR_9<<16) + (VAR_11>>1))/VAR_11; VAR_0->dstFormatBpp = av_get_bits_per_pixel(&av_pix_fmt_descriptors[VAR_16]); VAR_0->srcFormatBpp = av_get_bits_per_pixel(&av_pix_fmt_descriptors[VAR_15]); VAR_0->vRounder= 4* 0x0001000100010001ULL; VAR_5 = (VAR_1->lumV && VAR_1->lumV->length>1) || (VAR_1->chrV && VAR_1->chrV->length>1) || (VAR_2->lumV && VAR_2->lumV->length>1) || (VAR_2->chrV && VAR_2->chrV->length>1); VAR_6 = (VAR_1->lumH && VAR_1->lumH->length>1) || (VAR_1->chrH && VAR_1->chrH->length>1) || (VAR_2->lumH && VAR_2->lumH->length>1) || (VAR_2->chrH && VAR_2->chrH->length>1); getSubSampleFactors(&VAR_0->chrSrcHSubSample, &VAR_0->chrSrcVSubSample, VAR_15); getSubSampleFactors(&VAR_0->chrDstHSubSample, &VAR_0->chrDstVSubSample, VAR_16); if (isAnyRGB(VAR_16) && !(VAR_13&SWS_FULL_CHR_H_INT)) { if (VAR_10&1) { av_log(VAR_0, AV_LOG_DEBUG, "Forcing full internal H chroma due to odd output size\n"); VAR_13 |= SWS_FULL_CHR_H_INT; VAR_0->VAR_13 = VAR_13; } else VAR_0->chrDstHSubSample = 1; } VAR_0->vChrDrop= (VAR_13&SWS_SRC_V_CHR_DROP_MASK)>>SWS_SRC_V_CHR_DROP_SHIFT; VAR_0->chrSrcVSubSample+= VAR_0->vChrDrop; if (isAnyRGB(VAR_15) && !(VAR_13&SWS_FULL_CHR_H_INP) && VAR_15!=PIX_FMT_RGB8 && VAR_15!=PIX_FMT_BGR8 && VAR_15!=PIX_FMT_RGB4 && VAR_15!=PIX_FMT_BGR4 && VAR_15!=PIX_FMT_RGB4_BYTE && VAR_15!=PIX_FMT_BGR4_BYTE && ((VAR_10>>VAR_0->chrDstHSubSample) <= (VAR_8>>1) || (VAR_13&SWS_FAST_BILINEAR))) VAR_0->chrSrcHSubSample=1; VAR_0->chrSrcW= -((-VAR_8) >> VAR_0->chrSrcHSubSample); VAR_0->chrSrcH= -((-VAR_9) >> VAR_0->chrSrcVSubSample); VAR_0->chrDstW= -((-VAR_10) >> VAR_0->chrDstHSubSample); VAR_0->chrDstH= -((-VAR_11) >> VAR_0->chrDstVSubSample); if (VAR_7 && !VAR_6 && !VAR_5 && (VAR_0->srcRange == VAR_0->dstRange || isAnyRGB(VAR_16))) { ff_get_unscaled_swscale(VAR_0); if (VAR_0->swScale) { if (VAR_13&SWS_PRINT_INFO) av_log(VAR_0, AV_LOG_INFO, "using VAR_7 %s -> %s special converter\n", av_get_pix_fmt_name(VAR_15), av_get_pix_fmt_name(VAR_16)); return 0; } } VAR_0->srcBpc = 1 + av_pix_fmt_descriptors[VAR_15].comp[0].depth_minus1; if (VAR_0->srcBpc < 8) VAR_0->srcBpc = 8; VAR_0->dstBpc = 1 + av_pix_fmt_descriptors[VAR_16].comp[0].depth_minus1; if (VAR_0->dstBpc < 8) VAR_0->dstBpc = 8; if (isAnyRGB(VAR_15) || VAR_15 == PIX_FMT_PAL8) VAR_0->srcBpc = 16; if (VAR_0->dstBpc == 16) VAR_12 <<= 1; FF_ALLOC_OR_GOTO(VAR_0, VAR_0->formatConvBuffer, FFALIGN(VAR_8*2+78, 16) * 2, fail); if (HAVE_MMX2 && VAR_14 & AV_CPU_FLAG_MMX2 && VAR_0->srcBpc == 8 && VAR_0->dstBpc <= 10) { VAR_0->canMMX2BeUsed= (VAR_10 >=VAR_8 && (VAR_10&31)==0 && (VAR_8&15)==0) ? 1 : 0; if (!VAR_0->canMMX2BeUsed && VAR_10 >=VAR_8 && (VAR_8&15)==0 && (VAR_13&SWS_FAST_BILINEAR)) { if (VAR_13&SWS_PRINT_INFO) av_log(VAR_0, AV_LOG_INFO, "output width is not a multiple of 32 -> no MMX2 scaler\n"); } if (VAR_6 || isNBPS(VAR_0->VAR_15) || is16BPS(VAR_0->VAR_15) || isAnyRGB(VAR_0->VAR_15)) VAR_0->canMMX2BeUsed=0; } else VAR_0->canMMX2BeUsed=0; VAR_0->chrXInc= ((VAR_0->chrSrcW<<16) + (VAR_0->chrDstW>>1))/VAR_0->chrDstW; VAR_0->chrYInc= ((VAR_0->chrSrcH<<16) + (VAR_0->chrDstH>>1))/VAR_0->chrDstH; if (VAR_13&SWS_FAST_BILINEAR) { if (VAR_0->canMMX2BeUsed) { VAR_0->lumXInc+= 20; VAR_0->chrXInc+= 20; } else if (HAVE_MMX && VAR_14 & AV_CPU_FLAG_MMX && VAR_0->dstBpc <= 10) { VAR_0->lumXInc = ((VAR_8-2)<<16)/(VAR_10-2) - 20; VAR_0->chrXInc = ((VAR_0->chrSrcW-2)<<16)/(VAR_0->chrDstW-2) - 20; } } { #if HAVE_MMX2 if (VAR_0->canMMX2BeUsed && (VAR_13 & SWS_FAST_BILINEAR)) { VAR_0->lumMmx2FilterCodeSize = initMMX2HScaler( VAR_10, VAR_0->lumXInc, NULL, NULL, NULL, 8); VAR_0->chrMmx2FilterCodeSize = initMMX2HScaler(VAR_0->chrDstW, VAR_0->chrXInc, NULL, NULL, NULL, 4); #ifdef MAP_ANONYMOUS VAR_0->lumMmx2FilterCode = mmap(NULL, VAR_0->lumMmx2FilterCodeSize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); VAR_0->chrMmx2FilterCode = mmap(NULL, VAR_0->chrMmx2FilterCodeSize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); #elif HAVE_VIRTUALALLOC VAR_0->lumMmx2FilterCode = VirtualAlloc(NULL, VAR_0->lumMmx2FilterCodeSize, MEM_COMMIT, PAGE_EXECUTE_READWRITE); VAR_0->chrMmx2FilterCode = VirtualAlloc(NULL, VAR_0->chrMmx2FilterCodeSize, MEM_COMMIT, PAGE_EXECUTE_READWRITE); #else VAR_0->lumMmx2FilterCode = av_malloc(VAR_0->lumMmx2FilterCodeSize); VAR_0->chrMmx2FilterCode = av_malloc(VAR_0->chrMmx2FilterCodeSize); #endif #ifdef MAP_ANONYMOUS if (VAR_0->lumMmx2FilterCode == MAP_FAILED || VAR_0->chrMmx2FilterCode == MAP_FAILED) #else if (!VAR_0->lumMmx2FilterCode || !VAR_0->chrMmx2FilterCode) #endif { av_log(VAR_0, AV_LOG_ERROR, "Failed to allocate MMX2FilterCode\n"); return AVERROR(ENOMEM); } FF_ALLOCZ_OR_GOTO(VAR_0, VAR_0->hLumFilter , (VAR_10 /8+8)*sizeof(int16_t), fail); FF_ALLOCZ_OR_GOTO(VAR_0, VAR_0->hChrFilter , (VAR_0->chrDstW /4+8)*sizeof(int16_t), fail); FF_ALLOCZ_OR_GOTO(VAR_0, VAR_0->hLumFilterPos, (VAR_10 /2/8+8)*sizeof(int32_t), fail); FF_ALLOCZ_OR_GOTO(VAR_0, VAR_0->hChrFilterPos, (VAR_0->chrDstW/2/4+8)*sizeof(int32_t), fail); initMMX2HScaler( VAR_10, VAR_0->lumXInc, VAR_0->lumMmx2FilterCode, VAR_0->hLumFilter, (uint32_t*)VAR_0->hLumFilterPos, 8); initMMX2HScaler(VAR_0->chrDstW, VAR_0->chrXInc, VAR_0->chrMmx2FilterCode, VAR_0->hChrFilter, (uint32_t*)VAR_0->hChrFilterPos, 4); #ifdef MAP_ANONYMOUS mprotect(VAR_0->lumMmx2FilterCode, VAR_0->lumMmx2FilterCodeSize, PROT_EXEC | PROT_READ); mprotect(VAR_0->chrMmx2FilterCode, VAR_0->chrMmx2FilterCodeSize, PROT_EXEC | PROT_READ); #endif } else #endif { const int VAR_18= (HAVE_MMX && VAR_14 & AV_CPU_FLAG_MMX) ? 4 : (HAVE_ALTIVEC && VAR_14 & AV_CPU_FLAG_ALTIVEC) ? 8 : 1; if (initFilter(&VAR_0->hLumFilter, &VAR_0->hLumFilterPos, &VAR_0->hLumFilterSize, VAR_0->lumXInc, VAR_8 , VAR_10, VAR_18, 1<<14, (VAR_13&SWS_BICUBLIN) ? (VAR_13|SWS_BICUBIC) : VAR_13, VAR_14, VAR_1->lumH, VAR_2->lumH, VAR_0->param) < 0) goto fail; if (initFilter(&VAR_0->hChrFilter, &VAR_0->hChrFilterPos, &VAR_0->hChrFilterSize, VAR_0->chrXInc, VAR_0->chrSrcW, VAR_0->chrDstW, VAR_18, 1<<14, (VAR_13&SWS_BICUBLIN) ? (VAR_13|SWS_BILINEAR) : VAR_13, VAR_14, VAR_1->chrH, VAR_2->chrH, VAR_0->param) < 0) goto fail; } } { const int VAR_18= (HAVE_MMX && VAR_14 & AV_CPU_FLAG_MMX) ? 2 : (HAVE_ALTIVEC && VAR_14 & AV_CPU_FLAG_ALTIVEC) ? 8 : 1; if (initFilter(&VAR_0->vLumFilter, &VAR_0->vLumFilterPos, &VAR_0->vLumFilterSize, VAR_0->lumYInc, VAR_9 , VAR_11, VAR_18, (1<<12), (VAR_13&SWS_BICUBLIN) ? (VAR_13|SWS_BICUBIC) : VAR_13, VAR_14, VAR_1->lumV, VAR_2->lumV, VAR_0->param) < 0) goto fail; if (initFilter(&VAR_0->vChrFilter, &VAR_0->vChrFilterPos, &VAR_0->vChrFilterSize, VAR_0->chrYInc, VAR_0->chrSrcH, VAR_0->chrDstH, VAR_18, (1<<12), (VAR_13&SWS_BICUBLIN) ? (VAR_13|SWS_BILINEAR) : VAR_13, VAR_14, VAR_1->chrV, VAR_2->chrV, VAR_0->param) < 0) goto fail; #if HAVE_ALTIVEC FF_ALLOC_OR_GOTO(VAR_0, VAR_0->vYCoeffsBank, sizeof (vector signed short)*VAR_0->vLumFilterSize*VAR_0->VAR_11, fail); FF_ALLOC_OR_GOTO(VAR_0, VAR_0->vCCoeffsBank, sizeof (vector signed short)*VAR_0->vChrFilterSize*VAR_0->chrDstH, fail); for (VAR_3=0;VAR_3<VAR_0->vLumFilterSize*VAR_0->VAR_11;VAR_3++) { int VAR_4; short *p = (short *)&VAR_0->vYCoeffsBank[VAR_3]; for (VAR_4=0;VAR_4<8;VAR_4++) p[VAR_4] = VAR_0->vLumFilter[VAR_3]; } for (VAR_3=0;VAR_3<VAR_0->vChrFilterSize*VAR_0->chrDstH;VAR_3++) { int VAR_4; short *p = (short *)&VAR_0->vCCoeffsBank[VAR_3]; for (VAR_4=0;VAR_4<8;VAR_4++) p[VAR_4] = VAR_0->vChrFilter[VAR_3]; } #endif } VAR_0->vLumBufSize= VAR_0->vLumFilterSize; VAR_0->vChrBufSize= VAR_0->vChrFilterSize; for (VAR_3=0; VAR_3<VAR_11; VAR_3++) { int VAR_18= (int64_t)VAR_3*VAR_0->chrDstH / VAR_11; int VAR_19= FFMAX(VAR_0->vLumFilterPos[VAR_3 ] + VAR_0->vLumFilterSize - 1, ((VAR_0->vChrFilterPos[VAR_18] + VAR_0->vChrFilterSize - 1)<<VAR_0->chrSrcVSubSample)); VAR_19>>= VAR_0->chrSrcVSubSample; VAR_19<<= VAR_0->chrSrcVSubSample; if (VAR_0->vLumFilterPos[VAR_3 ] + VAR_0->vLumBufSize < VAR_19) VAR_0->vLumBufSize= VAR_19 - VAR_0->vLumFilterPos[VAR_3]; if (VAR_0->vChrFilterPos[VAR_18] + VAR_0->vChrBufSize < (VAR_19>>VAR_0->chrSrcVSubSample)) VAR_0->vChrBufSize= (VAR_19>>VAR_0->chrSrcVSubSample) - VAR_0->vChrFilterPos[VAR_18]; } FF_ALLOC_OR_GOTO(VAR_0, VAR_0->lumPixBuf, VAR_0->vLumBufSize*2*sizeof(int16_t*), fail); FF_ALLOC_OR_GOTO(VAR_0, VAR_0->chrUPixBuf, VAR_0->vChrBufSize*2*sizeof(int16_t*), fail); FF_ALLOC_OR_GOTO(VAR_0, VAR_0->chrVPixBuf, VAR_0->vChrBufSize*2*sizeof(int16_t*), fail); if (CONFIG_SWSCALE_ALPHA && isALPHA(VAR_0->VAR_15) && isALPHA(VAR_0->VAR_16)) FF_ALLOCZ_OR_GOTO(VAR_0, VAR_0->alpPixBuf, VAR_0->vLumBufSize*2*sizeof(int16_t*), fail); for (VAR_3=0; VAR_3<VAR_0->vLumBufSize; VAR_3++) { FF_ALLOCZ_OR_GOTO(VAR_0, VAR_0->lumPixBuf[VAR_3+VAR_0->vLumBufSize], VAR_12+16, fail); VAR_0->lumPixBuf[VAR_3] = VAR_0->lumPixBuf[VAR_3+VAR_0->vLumBufSize]; } VAR_0->uv_off = (VAR_12>>1) + 64 / (VAR_0->dstBpc &~ 7); VAR_0->uv_offx2 = VAR_12 + 16; for (VAR_3=0; VAR_3<VAR_0->vChrBufSize; VAR_3++) { FF_ALLOC_OR_GOTO(VAR_0, VAR_0->chrUPixBuf[VAR_3+VAR_0->vChrBufSize], VAR_12*2+32, fail); VAR_0->chrUPixBuf[VAR_3] = VAR_0->chrUPixBuf[VAR_3+VAR_0->vChrBufSize]; VAR_0->chrVPixBuf[VAR_3] = VAR_0->chrVPixBuf[VAR_3+VAR_0->vChrBufSize] = VAR_0->chrUPixBuf[VAR_3] + (VAR_12 >> 1) + 8; } if (CONFIG_SWSCALE_ALPHA && VAR_0->alpPixBuf) for (VAR_3=0; VAR_3<VAR_0->vLumBufSize; VAR_3++) { FF_ALLOCZ_OR_GOTO(VAR_0, VAR_0->alpPixBuf[VAR_3+VAR_0->vLumBufSize], VAR_12+16, fail); VAR_0->alpPixBuf[VAR_3] = VAR_0->alpPixBuf[VAR_3+VAR_0->vLumBufSize]; } for (VAR_3=0; VAR_3<VAR_0->vChrBufSize; VAR_3++) if(av_pix_fmt_descriptors[VAR_0->VAR_16].comp[0].depth_minus1 == 15){ av_assert0(VAR_0->dstBpc > 10); for(VAR_4=0; VAR_4<VAR_12/2+1; VAR_4++) ((int32_t*)(VAR_0->chrUPixBuf[VAR_3]))[VAR_4] = 1<<18; } else for(VAR_4=0; VAR_4<VAR_12+1; VAR_4++) ((int16_t*)(VAR_0->chrUPixBuf[VAR_3]))[VAR_4] = 1<<14; assert(VAR_0->chrDstH <= VAR_11); if (VAR_13&SWS_PRINT_INFO) { if (VAR_13&SWS_FAST_BILINEAR) av_log(VAR_0, AV_LOG_INFO, "FAST_BILINEAR scaler, "); else if (VAR_13&SWS_BILINEAR) av_log(VAR_0, AV_LOG_INFO, "BILINEAR scaler, "); else if (VAR_13&SWS_BICUBIC) av_log(VAR_0, AV_LOG_INFO, "BICUBIC scaler, "); else if (VAR_13&SWS_X) av_log(VAR_0, AV_LOG_INFO, "Experimental scaler, "); else if (VAR_13&SWS_POINT) av_log(VAR_0, AV_LOG_INFO, "Nearest Neighbor / POINT scaler, "); else if (VAR_13&SWS_AREA) av_log(VAR_0, AV_LOG_INFO, "Area Averaging scaler, "); else if (VAR_13&SWS_BICUBLIN) av_log(VAR_0, AV_LOG_INFO, "luma BICUBIC / chroma BILINEAR scaler, "); else if (VAR_13&SWS_GAUSS) av_log(VAR_0, AV_LOG_INFO, "Gaussian scaler, "); else if (VAR_13&SWS_SINC) av_log(VAR_0, AV_LOG_INFO, "Sinc scaler, "); else if (VAR_13&SWS_LANCZOS) av_log(VAR_0, AV_LOG_INFO, "Lanczos scaler, "); else if (VAR_13&SWS_SPLINE) av_log(VAR_0, AV_LOG_INFO, "Bicubic spline scaler, "); else av_log(VAR_0, AV_LOG_INFO, "ehh VAR_13 invalid?! "); av_log(VAR_0, AV_LOG_INFO, "from %s to %s%s ", av_get_pix_fmt_name(VAR_15), #ifdef DITHER1XBPP VAR_16 == PIX_FMT_BGR555 || VAR_16 == PIX_FMT_BGR565 || VAR_16 == PIX_FMT_RGB444BE || VAR_16 == PIX_FMT_RGB444LE || VAR_16 == PIX_FMT_BGR444BE || VAR_16 == PIX_FMT_BGR444LE ? "dithered " : "", #else "", #endif av_get_pix_fmt_name(VAR_16)); if (HAVE_MMX2 && VAR_14 & AV_CPU_FLAG_MMX2) av_log(VAR_0, AV_LOG_INFO, "using MMX2\n"); else if (HAVE_AMD3DNOW && VAR_14 & AV_CPU_FLAG_3DNOW) av_log(VAR_0, AV_LOG_INFO, "using 3DNOW\n"); else if (HAVE_MMX && VAR_14 & AV_CPU_FLAG_MMX) av_log(VAR_0, AV_LOG_INFO, "using MMX\n"); else if (HAVE_ALTIVEC && VAR_14 & AV_CPU_FLAG_ALTIVEC) av_log(VAR_0, AV_LOG_INFO, "using AltiVec\n"); else av_log(VAR_0, AV_LOG_INFO, "using C\n"); av_log(VAR_0, AV_LOG_VERBOSE, "%dx%d -> %dx%d\n", VAR_8, VAR_9, VAR_10, VAR_11); av_log(VAR_0, AV_LOG_DEBUG, "lum VAR_8=%d VAR_9=%d VAR_10=%d VAR_11=%d xInc=%d yInc=%d\n", VAR_0->VAR_8, VAR_0->VAR_9, VAR_0->VAR_10, VAR_0->VAR_11, VAR_0->lumXInc, VAR_0->lumYInc); av_log(VAR_0, AV_LOG_DEBUG, "chr VAR_8=%d VAR_9=%d VAR_10=%d VAR_11=%d xInc=%d yInc=%d\n", VAR_0->chrSrcW, VAR_0->chrSrcH, VAR_0->chrDstW, VAR_0->chrDstH, VAR_0->chrXInc, VAR_0->chrYInc); } VAR_0->swScale= ff_getSwsFunc(VAR_0); return 0; fail: return -1; }
[ "int FUNC_0(SwsContext *VAR_0, SwsFilter *VAR_1, SwsFilter *VAR_2)\n{", "int VAR_3, VAR_4;", "int VAR_5, VAR_6;", "int VAR_7;", "SwsFilter dummyFilter= {NULL, NULL, NULL, NULL};", "int VAR_8= VAR_0->VAR_8;", "int VAR_9= VAR_0->VAR_9;", "int VAR_10= VAR_0->VAR_10;", "int VAR_11= VAR_0->VAR_11;", "int VAR_12 = FFALIGN(VAR_10 * sizeof(int16_t)+66, 16);", "int VAR_13, VAR_14;", "enum PixelFormat VAR_15= VAR_0->VAR_15;", "enum PixelFormat VAR_16= VAR_0->VAR_16;", "VAR_14 = av_get_cpu_flags();", "VAR_13 = VAR_0->VAR_13;", "emms_c();", "if (!rgb15to16) sws_rgb2rgb_init();", "VAR_7 = (VAR_8 == VAR_10 && VAR_9 == VAR_11);", "handle_jpeg(&VAR_15);", "handle_jpeg(&VAR_16);", "if(VAR_15!=VAR_0->VAR_15 || VAR_16!=VAR_0->VAR_16){", "av_log(VAR_0, AV_LOG_WARNING, \"deprecated pixel format used, make sure you did set range correctly\\n\");", "VAR_0->VAR_15= VAR_15;", "VAR_0->VAR_16= VAR_16;", "}", "if (!sws_isSupportedInput(VAR_15)) {", "av_log(VAR_0, AV_LOG_ERROR, \"%s is not supported as input pixel format\\n\", av_get_pix_fmt_name(VAR_15));", "return AVERROR(EINVAL);", "}", "if (!sws_isSupportedOutput(VAR_16)) {", "av_log(VAR_0, AV_LOG_ERROR, \"%s is not supported as output pixel format\\n\", av_get_pix_fmt_name(VAR_16));", "return AVERROR(EINVAL);", "}", "VAR_3= VAR_13 & ( SWS_POINT\n|SWS_AREA\n|SWS_BILINEAR\n|SWS_FAST_BILINEAR\n|SWS_BICUBIC\n|SWS_X\n|SWS_GAUSS\n|SWS_LANCZOS\n|SWS_SINC\n|SWS_SPLINE\n|SWS_BICUBLIN);", "if(!VAR_3 || (VAR_3 & (VAR_3-1))) {", "av_log(VAR_0, AV_LOG_ERROR, \"Exactly one scaler algorithm must be chosen\\n\");", "return AVERROR(EINVAL);", "}", "if (VAR_8<4 || VAR_9<1 || VAR_10<8 || VAR_11<1) {", "av_log(VAR_0, AV_LOG_ERROR, \"%dx%d -> %dx%d is invalid scaling dimension\\n\",\nVAR_8, VAR_9, VAR_10, VAR_11);", "return AVERROR(EINVAL);", "}", "if (!VAR_2) VAR_2= &dummyFilter;", "if (!VAR_1) VAR_1= &dummyFilter;", "VAR_0->lumXInc= ((VAR_8<<16) + (VAR_10>>1))/VAR_10;", "VAR_0->lumYInc= ((VAR_9<<16) + (VAR_11>>1))/VAR_11;", "VAR_0->dstFormatBpp = av_get_bits_per_pixel(&av_pix_fmt_descriptors[VAR_16]);", "VAR_0->srcFormatBpp = av_get_bits_per_pixel(&av_pix_fmt_descriptors[VAR_15]);", "VAR_0->vRounder= 4* 0x0001000100010001ULL;", "VAR_5 = (VAR_1->lumV && VAR_1->lumV->length>1) ||\n(VAR_1->chrV && VAR_1->chrV->length>1) ||\n(VAR_2->lumV && VAR_2->lumV->length>1) ||\n(VAR_2->chrV && VAR_2->chrV->length>1);", "VAR_6 = (VAR_1->lumH && VAR_1->lumH->length>1) ||\n(VAR_1->chrH && VAR_1->chrH->length>1) ||\n(VAR_2->lumH && VAR_2->lumH->length>1) ||\n(VAR_2->chrH && VAR_2->chrH->length>1);", "getSubSampleFactors(&VAR_0->chrSrcHSubSample, &VAR_0->chrSrcVSubSample, VAR_15);", "getSubSampleFactors(&VAR_0->chrDstHSubSample, &VAR_0->chrDstVSubSample, VAR_16);", "if (isAnyRGB(VAR_16) && !(VAR_13&SWS_FULL_CHR_H_INT)) {", "if (VAR_10&1) {", "av_log(VAR_0, AV_LOG_DEBUG, \"Forcing full internal H chroma due to odd output size\\n\");", "VAR_13 |= SWS_FULL_CHR_H_INT;", "VAR_0->VAR_13 = VAR_13;", "} else", "VAR_0->chrDstHSubSample = 1;", "}", "VAR_0->vChrDrop= (VAR_13&SWS_SRC_V_CHR_DROP_MASK)>>SWS_SRC_V_CHR_DROP_SHIFT;", "VAR_0->chrSrcVSubSample+= VAR_0->vChrDrop;", "if (isAnyRGB(VAR_15) && !(VAR_13&SWS_FULL_CHR_H_INP)\n&& VAR_15!=PIX_FMT_RGB8 && VAR_15!=PIX_FMT_BGR8\n&& VAR_15!=PIX_FMT_RGB4 && VAR_15!=PIX_FMT_BGR4\n&& VAR_15!=PIX_FMT_RGB4_BYTE && VAR_15!=PIX_FMT_BGR4_BYTE\n&& ((VAR_10>>VAR_0->chrDstHSubSample) <= (VAR_8>>1) || (VAR_13&SWS_FAST_BILINEAR)))\nVAR_0->chrSrcHSubSample=1;", "VAR_0->chrSrcW= -((-VAR_8) >> VAR_0->chrSrcHSubSample);", "VAR_0->chrSrcH= -((-VAR_9) >> VAR_0->chrSrcVSubSample);", "VAR_0->chrDstW= -((-VAR_10) >> VAR_0->chrDstHSubSample);", "VAR_0->chrDstH= -((-VAR_11) >> VAR_0->chrDstVSubSample);", "if (VAR_7 && !VAR_6 && !VAR_5 && (VAR_0->srcRange == VAR_0->dstRange || isAnyRGB(VAR_16))) {", "ff_get_unscaled_swscale(VAR_0);", "if (VAR_0->swScale) {", "if (VAR_13&SWS_PRINT_INFO)\nav_log(VAR_0, AV_LOG_INFO, \"using VAR_7 %s -> %s special converter\\n\",\nav_get_pix_fmt_name(VAR_15), av_get_pix_fmt_name(VAR_16));", "return 0;", "}", "}", "VAR_0->srcBpc = 1 + av_pix_fmt_descriptors[VAR_15].comp[0].depth_minus1;", "if (VAR_0->srcBpc < 8)\nVAR_0->srcBpc = 8;", "VAR_0->dstBpc = 1 + av_pix_fmt_descriptors[VAR_16].comp[0].depth_minus1;", "if (VAR_0->dstBpc < 8)\nVAR_0->dstBpc = 8;", "if (isAnyRGB(VAR_15) || VAR_15 == PIX_FMT_PAL8)\nVAR_0->srcBpc = 16;", "if (VAR_0->dstBpc == 16)\nVAR_12 <<= 1;", "FF_ALLOC_OR_GOTO(VAR_0, VAR_0->formatConvBuffer, FFALIGN(VAR_8*2+78, 16) * 2, fail);", "if (HAVE_MMX2 && VAR_14 & AV_CPU_FLAG_MMX2 && VAR_0->srcBpc == 8 && VAR_0->dstBpc <= 10) {", "VAR_0->canMMX2BeUsed= (VAR_10 >=VAR_8 && (VAR_10&31)==0 && (VAR_8&15)==0) ? 1 : 0;", "if (!VAR_0->canMMX2BeUsed && VAR_10 >=VAR_8 && (VAR_8&15)==0 && (VAR_13&SWS_FAST_BILINEAR)) {", "if (VAR_13&SWS_PRINT_INFO)\nav_log(VAR_0, AV_LOG_INFO, \"output width is not a multiple of 32 -> no MMX2 scaler\\n\");", "}", "if (VAR_6 || isNBPS(VAR_0->VAR_15) || is16BPS(VAR_0->VAR_15) || isAnyRGB(VAR_0->VAR_15)) VAR_0->canMMX2BeUsed=0;", "}", "else\nVAR_0->canMMX2BeUsed=0;", "VAR_0->chrXInc= ((VAR_0->chrSrcW<<16) + (VAR_0->chrDstW>>1))/VAR_0->chrDstW;", "VAR_0->chrYInc= ((VAR_0->chrSrcH<<16) + (VAR_0->chrDstH>>1))/VAR_0->chrDstH;", "if (VAR_13&SWS_FAST_BILINEAR) {", "if (VAR_0->canMMX2BeUsed) {", "VAR_0->lumXInc+= 20;", "VAR_0->chrXInc+= 20;", "}", "else if (HAVE_MMX && VAR_14 & AV_CPU_FLAG_MMX && VAR_0->dstBpc <= 10) {", "VAR_0->lumXInc = ((VAR_8-2)<<16)/(VAR_10-2) - 20;", "VAR_0->chrXInc = ((VAR_0->chrSrcW-2)<<16)/(VAR_0->chrDstW-2) - 20;", "}", "}", "{", "#if HAVE_MMX2\nif (VAR_0->canMMX2BeUsed && (VAR_13 & SWS_FAST_BILINEAR)) {", "VAR_0->lumMmx2FilterCodeSize = initMMX2HScaler( VAR_10, VAR_0->lumXInc, NULL, NULL, NULL, 8);", "VAR_0->chrMmx2FilterCodeSize = initMMX2HScaler(VAR_0->chrDstW, VAR_0->chrXInc, NULL, NULL, NULL, 4);", "#ifdef MAP_ANONYMOUS\nVAR_0->lumMmx2FilterCode = mmap(NULL, VAR_0->lumMmx2FilterCodeSize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);", "VAR_0->chrMmx2FilterCode = mmap(NULL, VAR_0->chrMmx2FilterCodeSize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);", "#elif HAVE_VIRTUALALLOC\nVAR_0->lumMmx2FilterCode = VirtualAlloc(NULL, VAR_0->lumMmx2FilterCodeSize, MEM_COMMIT, PAGE_EXECUTE_READWRITE);", "VAR_0->chrMmx2FilterCode = VirtualAlloc(NULL, VAR_0->chrMmx2FilterCodeSize, MEM_COMMIT, PAGE_EXECUTE_READWRITE);", "#else\nVAR_0->lumMmx2FilterCode = av_malloc(VAR_0->lumMmx2FilterCodeSize);", "VAR_0->chrMmx2FilterCode = av_malloc(VAR_0->chrMmx2FilterCodeSize);", "#endif\n#ifdef MAP_ANONYMOUS\nif (VAR_0->lumMmx2FilterCode == MAP_FAILED || VAR_0->chrMmx2FilterCode == MAP_FAILED)\n#else\nif (!VAR_0->lumMmx2FilterCode || !VAR_0->chrMmx2FilterCode)\n#endif\n{", "av_log(VAR_0, AV_LOG_ERROR, \"Failed to allocate MMX2FilterCode\\n\");", "return AVERROR(ENOMEM);", "}", "FF_ALLOCZ_OR_GOTO(VAR_0, VAR_0->hLumFilter , (VAR_10 /8+8)*sizeof(int16_t), fail);", "FF_ALLOCZ_OR_GOTO(VAR_0, VAR_0->hChrFilter , (VAR_0->chrDstW /4+8)*sizeof(int16_t), fail);", "FF_ALLOCZ_OR_GOTO(VAR_0, VAR_0->hLumFilterPos, (VAR_10 /2/8+8)*sizeof(int32_t), fail);", "FF_ALLOCZ_OR_GOTO(VAR_0, VAR_0->hChrFilterPos, (VAR_0->chrDstW/2/4+8)*sizeof(int32_t), fail);", "initMMX2HScaler( VAR_10, VAR_0->lumXInc, VAR_0->lumMmx2FilterCode, VAR_0->hLumFilter, (uint32_t*)VAR_0->hLumFilterPos, 8);", "initMMX2HScaler(VAR_0->chrDstW, VAR_0->chrXInc, VAR_0->chrMmx2FilterCode, VAR_0->hChrFilter, (uint32_t*)VAR_0->hChrFilterPos, 4);", "#ifdef MAP_ANONYMOUS\nmprotect(VAR_0->lumMmx2FilterCode, VAR_0->lumMmx2FilterCodeSize, PROT_EXEC | PROT_READ);", "mprotect(VAR_0->chrMmx2FilterCode, VAR_0->chrMmx2FilterCodeSize, PROT_EXEC | PROT_READ);", "#endif\n} else", "#endif\n{", "const int VAR_18=\n(HAVE_MMX && VAR_14 & AV_CPU_FLAG_MMX) ? 4 :\n(HAVE_ALTIVEC && VAR_14 & AV_CPU_FLAG_ALTIVEC) ? 8 :\n1;", "if (initFilter(&VAR_0->hLumFilter, &VAR_0->hLumFilterPos, &VAR_0->hLumFilterSize, VAR_0->lumXInc,\nVAR_8 , VAR_10, VAR_18, 1<<14,\n(VAR_13&SWS_BICUBLIN) ? (VAR_13|SWS_BICUBIC) : VAR_13, VAR_14,\nVAR_1->lumH, VAR_2->lumH, VAR_0->param) < 0)\ngoto fail;", "if (initFilter(&VAR_0->hChrFilter, &VAR_0->hChrFilterPos, &VAR_0->hChrFilterSize, VAR_0->chrXInc,\nVAR_0->chrSrcW, VAR_0->chrDstW, VAR_18, 1<<14,\n(VAR_13&SWS_BICUBLIN) ? (VAR_13|SWS_BILINEAR) : VAR_13, VAR_14,\nVAR_1->chrH, VAR_2->chrH, VAR_0->param) < 0)\ngoto fail;", "}", "}", "{", "const int VAR_18=\n(HAVE_MMX && VAR_14 & AV_CPU_FLAG_MMX) ? 2 :\n(HAVE_ALTIVEC && VAR_14 & AV_CPU_FLAG_ALTIVEC) ? 8 :\n1;", "if (initFilter(&VAR_0->vLumFilter, &VAR_0->vLumFilterPos, &VAR_0->vLumFilterSize, VAR_0->lumYInc,\nVAR_9 , VAR_11, VAR_18, (1<<12),\n(VAR_13&SWS_BICUBLIN) ? (VAR_13|SWS_BICUBIC) : VAR_13, VAR_14,\nVAR_1->lumV, VAR_2->lumV, VAR_0->param) < 0)\ngoto fail;", "if (initFilter(&VAR_0->vChrFilter, &VAR_0->vChrFilterPos, &VAR_0->vChrFilterSize, VAR_0->chrYInc,\nVAR_0->chrSrcH, VAR_0->chrDstH, VAR_18, (1<<12),\n(VAR_13&SWS_BICUBLIN) ? (VAR_13|SWS_BILINEAR) : VAR_13, VAR_14,\nVAR_1->chrV, VAR_2->chrV, VAR_0->param) < 0)\ngoto fail;", "#if HAVE_ALTIVEC\nFF_ALLOC_OR_GOTO(VAR_0, VAR_0->vYCoeffsBank, sizeof (vector signed short)*VAR_0->vLumFilterSize*VAR_0->VAR_11, fail);", "FF_ALLOC_OR_GOTO(VAR_0, VAR_0->vCCoeffsBank, sizeof (vector signed short)*VAR_0->vChrFilterSize*VAR_0->chrDstH, fail);", "for (VAR_3=0;VAR_3<VAR_0->vLumFilterSize*VAR_0->VAR_11;VAR_3++) {", "int VAR_4;", "short *p = (short *)&VAR_0->vYCoeffsBank[VAR_3];", "for (VAR_4=0;VAR_4<8;VAR_4++)", "p[VAR_4] = VAR_0->vLumFilter[VAR_3];", "}", "for (VAR_3=0;VAR_3<VAR_0->vChrFilterSize*VAR_0->chrDstH;VAR_3++) {", "int VAR_4;", "short *p = (short *)&VAR_0->vCCoeffsBank[VAR_3];", "for (VAR_4=0;VAR_4<8;VAR_4++)", "p[VAR_4] = VAR_0->vChrFilter[VAR_3];", "}", "#endif\n}", "VAR_0->vLumBufSize= VAR_0->vLumFilterSize;", "VAR_0->vChrBufSize= VAR_0->vChrFilterSize;", "for (VAR_3=0; VAR_3<VAR_11; VAR_3++) {", "int VAR_18= (int64_t)VAR_3*VAR_0->chrDstH / VAR_11;", "int VAR_19= FFMAX(VAR_0->vLumFilterPos[VAR_3 ] + VAR_0->vLumFilterSize - 1,\n((VAR_0->vChrFilterPos[VAR_18] + VAR_0->vChrFilterSize - 1)<<VAR_0->chrSrcVSubSample));", "VAR_19>>= VAR_0->chrSrcVSubSample;", "VAR_19<<= VAR_0->chrSrcVSubSample;", "if (VAR_0->vLumFilterPos[VAR_3 ] + VAR_0->vLumBufSize < VAR_19)\nVAR_0->vLumBufSize= VAR_19 - VAR_0->vLumFilterPos[VAR_3];", "if (VAR_0->vChrFilterPos[VAR_18] + VAR_0->vChrBufSize < (VAR_19>>VAR_0->chrSrcVSubSample))\nVAR_0->vChrBufSize= (VAR_19>>VAR_0->chrSrcVSubSample) - VAR_0->vChrFilterPos[VAR_18];", "}", "FF_ALLOC_OR_GOTO(VAR_0, VAR_0->lumPixBuf, VAR_0->vLumBufSize*2*sizeof(int16_t*), fail);", "FF_ALLOC_OR_GOTO(VAR_0, VAR_0->chrUPixBuf, VAR_0->vChrBufSize*2*sizeof(int16_t*), fail);", "FF_ALLOC_OR_GOTO(VAR_0, VAR_0->chrVPixBuf, VAR_0->vChrBufSize*2*sizeof(int16_t*), fail);", "if (CONFIG_SWSCALE_ALPHA && isALPHA(VAR_0->VAR_15) && isALPHA(VAR_0->VAR_16))\nFF_ALLOCZ_OR_GOTO(VAR_0, VAR_0->alpPixBuf, VAR_0->vLumBufSize*2*sizeof(int16_t*), fail);", "for (VAR_3=0; VAR_3<VAR_0->vLumBufSize; VAR_3++) {", "FF_ALLOCZ_OR_GOTO(VAR_0, VAR_0->lumPixBuf[VAR_3+VAR_0->vLumBufSize], VAR_12+16, fail);", "VAR_0->lumPixBuf[VAR_3] = VAR_0->lumPixBuf[VAR_3+VAR_0->vLumBufSize];", "}", "VAR_0->uv_off = (VAR_12>>1) + 64 / (VAR_0->dstBpc &~ 7);", "VAR_0->uv_offx2 = VAR_12 + 16;", "for (VAR_3=0; VAR_3<VAR_0->vChrBufSize; VAR_3++) {", "FF_ALLOC_OR_GOTO(VAR_0, VAR_0->chrUPixBuf[VAR_3+VAR_0->vChrBufSize], VAR_12*2+32, fail);", "VAR_0->chrUPixBuf[VAR_3] = VAR_0->chrUPixBuf[VAR_3+VAR_0->vChrBufSize];", "VAR_0->chrVPixBuf[VAR_3] = VAR_0->chrVPixBuf[VAR_3+VAR_0->vChrBufSize] = VAR_0->chrUPixBuf[VAR_3] + (VAR_12 >> 1) + 8;", "}", "if (CONFIG_SWSCALE_ALPHA && VAR_0->alpPixBuf)\nfor (VAR_3=0; VAR_3<VAR_0->vLumBufSize; VAR_3++) {", "FF_ALLOCZ_OR_GOTO(VAR_0, VAR_0->alpPixBuf[VAR_3+VAR_0->vLumBufSize], VAR_12+16, fail);", "VAR_0->alpPixBuf[VAR_3] = VAR_0->alpPixBuf[VAR_3+VAR_0->vLumBufSize];", "}", "for (VAR_3=0; VAR_3<VAR_0->vChrBufSize; VAR_3++)", "if(av_pix_fmt_descriptors[VAR_0->VAR_16].comp[0].depth_minus1 == 15){", "av_assert0(VAR_0->dstBpc > 10);", "for(VAR_4=0; VAR_4<VAR_12/2+1; VAR_4++)", "((int32_t*)(VAR_0->chrUPixBuf[VAR_3]))[VAR_4] = 1<<18;", "} else", "for(VAR_4=0; VAR_4<VAR_12+1; VAR_4++)", "((int16_t*)(VAR_0->chrUPixBuf[VAR_3]))[VAR_4] = 1<<14;", "assert(VAR_0->chrDstH <= VAR_11);", "if (VAR_13&SWS_PRINT_INFO) {", "if (VAR_13&SWS_FAST_BILINEAR) av_log(VAR_0, AV_LOG_INFO, \"FAST_BILINEAR scaler, \");", "else if (VAR_13&SWS_BILINEAR) av_log(VAR_0, AV_LOG_INFO, \"BILINEAR scaler, \");", "else if (VAR_13&SWS_BICUBIC) av_log(VAR_0, AV_LOG_INFO, \"BICUBIC scaler, \");", "else if (VAR_13&SWS_X) av_log(VAR_0, AV_LOG_INFO, \"Experimental scaler, \");", "else if (VAR_13&SWS_POINT) av_log(VAR_0, AV_LOG_INFO, \"Nearest Neighbor / POINT scaler, \");", "else if (VAR_13&SWS_AREA) av_log(VAR_0, AV_LOG_INFO, \"Area Averaging scaler, \");", "else if (VAR_13&SWS_BICUBLIN) av_log(VAR_0, AV_LOG_INFO, \"luma BICUBIC / chroma BILINEAR scaler, \");", "else if (VAR_13&SWS_GAUSS) av_log(VAR_0, AV_LOG_INFO, \"Gaussian scaler, \");", "else if (VAR_13&SWS_SINC) av_log(VAR_0, AV_LOG_INFO, \"Sinc scaler, \");", "else if (VAR_13&SWS_LANCZOS) av_log(VAR_0, AV_LOG_INFO, \"Lanczos scaler, \");", "else if (VAR_13&SWS_SPLINE) av_log(VAR_0, AV_LOG_INFO, \"Bicubic spline scaler, \");", "else av_log(VAR_0, AV_LOG_INFO, \"ehh VAR_13 invalid?! \");", "av_log(VAR_0, AV_LOG_INFO, \"from %s to %s%s \",\nav_get_pix_fmt_name(VAR_15),\n#ifdef DITHER1XBPP\nVAR_16 == PIX_FMT_BGR555 || VAR_16 == PIX_FMT_BGR565 ||\nVAR_16 == PIX_FMT_RGB444BE || VAR_16 == PIX_FMT_RGB444LE ||\nVAR_16 == PIX_FMT_BGR444BE || VAR_16 == PIX_FMT_BGR444LE ? \"dithered \" : \"\",\n#else\n\"\",\n#endif\nav_get_pix_fmt_name(VAR_16));", "if (HAVE_MMX2 && VAR_14 & AV_CPU_FLAG_MMX2) av_log(VAR_0, AV_LOG_INFO, \"using MMX2\\n\");", "else if (HAVE_AMD3DNOW && VAR_14 & AV_CPU_FLAG_3DNOW) av_log(VAR_0, AV_LOG_INFO, \"using 3DNOW\\n\");", "else if (HAVE_MMX && VAR_14 & AV_CPU_FLAG_MMX) av_log(VAR_0, AV_LOG_INFO, \"using MMX\\n\");", "else if (HAVE_ALTIVEC && VAR_14 & AV_CPU_FLAG_ALTIVEC) av_log(VAR_0, AV_LOG_INFO, \"using AltiVec\\n\");", "else av_log(VAR_0, AV_LOG_INFO, \"using C\\n\");", "av_log(VAR_0, AV_LOG_VERBOSE, \"%dx%d -> %dx%d\\n\", VAR_8, VAR_9, VAR_10, VAR_11);", "av_log(VAR_0, AV_LOG_DEBUG, \"lum VAR_8=%d VAR_9=%d VAR_10=%d VAR_11=%d xInc=%d yInc=%d\\n\",\nVAR_0->VAR_8, VAR_0->VAR_9, VAR_0->VAR_10, VAR_0->VAR_11, VAR_0->lumXInc, VAR_0->lumYInc);", "av_log(VAR_0, AV_LOG_DEBUG, \"chr VAR_8=%d VAR_9=%d VAR_10=%d VAR_11=%d xInc=%d yInc=%d\\n\",\nVAR_0->chrSrcW, VAR_0->chrSrcH, VAR_0->chrDstW, VAR_0->chrDstH, VAR_0->chrXInc, VAR_0->chrYInc);", "}", "VAR_0->swScale= ff_getSwsFunc(VAR_0);", "return 0;", "fail:\nreturn -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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81, 83, 85, 87, 89, 91, 93, 95, 97, 99, 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 113 ], [ 115, 117 ], [ 119 ], [ 121 ], [ 125 ], [ 127 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 143, 145, 147, 149 ], [ 151, 153, 155, 157 ], [ 161 ], [ 163 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 189 ], [ 191 ], [ 197, 199, 201, 203, 205, 207 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 225 ], [ 227 ], [ 231 ], [ 233, 235, 237 ], [ 239 ], [ 241 ], [ 243 ], [ 247 ], [ 249, 251 ], [ 253 ], [ 255, 257 ], [ 259, 261 ], [ 263, 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275, 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285, 287 ], [ 291 ], [ 293 ], [ 309 ], [ 311 ], [ 313 ], [ 315 ], [ 317 ], [ 321 ], [ 323 ], [ 325 ], [ 327 ], [ 329 ], [ 335 ], [ 337, 341 ], [ 343 ], [ 345 ], [ 349, 351 ], [ 353 ], [ 355, 357 ], [ 359 ], [ 361, 363 ], [ 365 ], [ 367, 371, 373, 375, 377, 379, 381 ], [ 383 ], [ 385 ], [ 387 ], [ 389 ], [ 391 ], [ 393 ], [ 395 ], [ 399 ], [ 401 ], [ 405, 407 ], [ 409 ], [ 411, 413 ], [ 415, 417 ], [ 419, 421, 423, 425 ], [ 429, 431, 433, 435, 437 ], [ 439, 441, 443, 445, 447 ], [ 449 ], [ 451 ], [ 457 ], [ 459, 461, 463, 465 ], [ 469, 471, 473, 475, 477 ], [ 479, 481, 483, 485, 487 ], [ 491, 493 ], [ 495 ], [ 499 ], [ 501 ], [ 503 ], [ 505 ], [ 507 ], [ 509 ], [ 513 ], [ 515 ], [ 517 ], [ 519 ], [ 521 ], [ 523 ], [ 525, 527 ], [ 533 ], [ 535 ], [ 537 ], [ 539 ], [ 541, 543 ], [ 547 ], [ 549 ], [ 551, 553 ], [ 555, 557 ], [ 559 ], [ 567 ], [ 569 ], [ 571 ], [ 573, 575 ], [ 581 ], [ 583 ], [ 585 ], [ 587 ], [ 591 ], [ 593 ], [ 595 ], [ 597 ], [ 599 ], [ 601 ], [ 603 ], [ 605, 607 ], [ 609 ], [ 611 ], [ 613 ], [ 619 ], [ 621 ], [ 623 ], [ 625 ], [ 627 ], [ 629 ], [ 631 ], [ 633 ], [ 637 ], [ 641 ], [ 643 ], [ 645 ], [ 647 ], [ 649 ], [ 651 ], [ 653 ], [ 655 ], [ 657 ], [ 659 ], [ 661 ], [ 663 ], [ 665 ], [ 669, 671, 673, 675, 677, 679, 681, 683, 685, 687 ], [ 691 ], [ 693 ], [ 695 ], [ 697 ], [ 699 ], [ 703 ], [ 705, 707 ], [ 709, 711 ], [ 713 ], [ 717 ], [ 719 ], [ 721, 723 ], [ 725 ] ]
7,436
static int ra144_decode_frame(AVCodecContext * avctx, void *data, int *got_frame_ptr, AVPacket *avpkt) { AVFrame *frame = data; const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; static const uint8_t sizes[LPC_ORDER] = {6, 5, 5, 4, 4, 3, 3, 3, 3, 2}; unsigned int refl_rms[NBLOCKS]; // RMS of the reflection coefficients uint16_t block_coefs[NBLOCKS][LPC_ORDER]; // LPC coefficients of each sub-block unsigned int lpc_refl[LPC_ORDER]; // LPC reflection coefficients of the frame int i, j; int ret; int16_t *samples; unsigned int energy; RA144Context *ractx = avctx->priv_data; GetBitContext gb; /* get output buffer */ frame->nb_samples = NBLOCKS * BLOCKSIZE; if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } samples = (int16_t *)frame->data[0]; if(buf_size < FRAMESIZE) { av_log(avctx, AV_LOG_ERROR, "Frame too small (%d bytes). Truncated file?\n", buf_size); *got_frame_ptr = 0; return buf_size; } init_get_bits(&gb, buf, FRAMESIZE * 8); for (i = 0; i < LPC_ORDER; i++) lpc_refl[i] = ff_lpc_refl_cb[i][get_bits(&gb, sizes[i])]; ff_eval_coefs(ractx->lpc_coef[0], lpc_refl); ractx->lpc_refl_rms[0] = ff_rms(lpc_refl); energy = ff_energy_tab[get_bits(&gb, 5)]; refl_rms[0] = ff_interp(ractx, block_coefs[0], 1, 1, ractx->old_energy); refl_rms[1] = ff_interp(ractx, block_coefs[1], 2, energy <= ractx->old_energy, ff_t_sqrt(energy*ractx->old_energy) >> 12); refl_rms[2] = ff_interp(ractx, block_coefs[2], 3, 0, energy); refl_rms[3] = ff_rescale_rms(ractx->lpc_refl_rms[0], energy); ff_int_to_int16(block_coefs[3], ractx->lpc_coef[0]); for (i=0; i < NBLOCKS; i++) { do_output_subblock(ractx, block_coefs[i], refl_rms[i], &gb); for (j=0; j < BLOCKSIZE; j++) *samples++ = av_clip_int16(ractx->curr_sblock[j + 10] << 2); } ractx->old_energy = energy; ractx->lpc_refl_rms[1] = ractx->lpc_refl_rms[0]; FFSWAP(unsigned int *, ractx->lpc_coef[0], ractx->lpc_coef[1]); *got_frame_ptr = 1; return FRAMESIZE; }
false
FFmpeg
684e3d2e1ce96625eeef63f2564aab66f6715d05
static int ra144_decode_frame(AVCodecContext * avctx, void *data, int *got_frame_ptr, AVPacket *avpkt) { AVFrame *frame = data; const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; static const uint8_t sizes[LPC_ORDER] = {6, 5, 5, 4, 4, 3, 3, 3, 3, 2}; unsigned int refl_rms[NBLOCKS]; uint16_t block_coefs[NBLOCKS][LPC_ORDER]; unsigned int lpc_refl[LPC_ORDER]; int i, j; int ret; int16_t *samples; unsigned int energy; RA144Context *ractx = avctx->priv_data; GetBitContext gb; frame->nb_samples = NBLOCKS * BLOCKSIZE; if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } samples = (int16_t *)frame->data[0]; if(buf_size < FRAMESIZE) { av_log(avctx, AV_LOG_ERROR, "Frame too small (%d bytes). Truncated file?\n", buf_size); *got_frame_ptr = 0; return buf_size; } init_get_bits(&gb, buf, FRAMESIZE * 8); for (i = 0; i < LPC_ORDER; i++) lpc_refl[i] = ff_lpc_refl_cb[i][get_bits(&gb, sizes[i])]; ff_eval_coefs(ractx->lpc_coef[0], lpc_refl); ractx->lpc_refl_rms[0] = ff_rms(lpc_refl); energy = ff_energy_tab[get_bits(&gb, 5)]; refl_rms[0] = ff_interp(ractx, block_coefs[0], 1, 1, ractx->old_energy); refl_rms[1] = ff_interp(ractx, block_coefs[1], 2, energy <= ractx->old_energy, ff_t_sqrt(energy*ractx->old_energy) >> 12); refl_rms[2] = ff_interp(ractx, block_coefs[2], 3, 0, energy); refl_rms[3] = ff_rescale_rms(ractx->lpc_refl_rms[0], energy); ff_int_to_int16(block_coefs[3], ractx->lpc_coef[0]); for (i=0; i < NBLOCKS; i++) { do_output_subblock(ractx, block_coefs[i], refl_rms[i], &gb); for (j=0; j < BLOCKSIZE; j++) *samples++ = av_clip_int16(ractx->curr_sblock[j + 10] << 2); } ractx->old_energy = energy; ractx->lpc_refl_rms[1] = ractx->lpc_refl_rms[0]; FFSWAP(unsigned int *, ractx->lpc_coef[0], ractx->lpc_coef[1]); *got_frame_ptr = 1; return FRAMESIZE; }
{ "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; int VAR_5 = VAR_3->size; static const uint8_t VAR_6[LPC_ORDER] = {6, 5, 5, 4, 4, 3, 3, 3, 3, 2}; unsigned int VAR_7[NBLOCKS]; uint16_t block_coefs[NBLOCKS][LPC_ORDER]; unsigned int VAR_8[LPC_ORDER]; int VAR_9, VAR_10; int VAR_11; int16_t *samples; unsigned int VAR_12; RA144Context *ractx = VAR_0->priv_data; GetBitContext gb; frame->nb_samples = NBLOCKS * BLOCKSIZE; if ((VAR_11 = ff_get_buffer(VAR_0, frame, 0)) < 0) { av_log(VAR_0, AV_LOG_ERROR, "get_buffer() failed\n"); return VAR_11; } samples = (int16_t *)frame->VAR_1[0]; if(VAR_5 < FRAMESIZE) { av_log(VAR_0, AV_LOG_ERROR, "Frame too small (%d bytes). Truncated file?\n", VAR_5); *VAR_2 = 0; return VAR_5; } init_get_bits(&gb, VAR_4, FRAMESIZE * 8); for (VAR_9 = 0; VAR_9 < LPC_ORDER; VAR_9++) VAR_8[VAR_9] = ff_lpc_refl_cb[VAR_9][get_bits(&gb, VAR_6[VAR_9])]; ff_eval_coefs(ractx->lpc_coef[0], VAR_8); ractx->lpc_refl_rms[0] = ff_rms(VAR_8); VAR_12 = ff_energy_tab[get_bits(&gb, 5)]; VAR_7[0] = ff_interp(ractx, block_coefs[0], 1, 1, ractx->old_energy); VAR_7[1] = ff_interp(ractx, block_coefs[1], 2, VAR_12 <= ractx->old_energy, ff_t_sqrt(VAR_12*ractx->old_energy) >> 12); VAR_7[2] = ff_interp(ractx, block_coefs[2], 3, 0, VAR_12); VAR_7[3] = ff_rescale_rms(ractx->lpc_refl_rms[0], VAR_12); ff_int_to_int16(block_coefs[3], ractx->lpc_coef[0]); for (VAR_9=0; VAR_9 < NBLOCKS; VAR_9++) { do_output_subblock(ractx, block_coefs[VAR_9], VAR_7[VAR_9], &gb); for (VAR_10=0; VAR_10 < BLOCKSIZE; VAR_10++) *samples++ = av_clip_int16(ractx->curr_sblock[VAR_10 + 10] << 2); } ractx->old_energy = VAR_12; ractx->lpc_refl_rms[1] = ractx->lpc_refl_rms[0]; FFSWAP(unsigned int *, ractx->lpc_coef[0], ractx->lpc_coef[1]); *VAR_2 = 1; return FRAMESIZE; }
[ "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;", "int VAR_5 = VAR_3->size;", "static const uint8_t VAR_6[LPC_ORDER] = {6, 5, 5, 4, 4, 3, 3, 3, 3, 2};", "unsigned int VAR_7[NBLOCKS];", "uint16_t block_coefs[NBLOCKS][LPC_ORDER];", "unsigned int VAR_8[LPC_ORDER];", "int VAR_9, VAR_10;", "int VAR_11;", "int16_t *samples;", "unsigned int VAR_12;", "RA144Context *ractx = VAR_0->priv_data;", "GetBitContext gb;", "frame->nb_samples = NBLOCKS * BLOCKSIZE;", "if ((VAR_11 = ff_get_buffer(VAR_0, frame, 0)) < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"get_buffer() failed\\n\");", "return VAR_11;", "}", "samples = (int16_t *)frame->VAR_1[0];", "if(VAR_5 < FRAMESIZE) {", "av_log(VAR_0, AV_LOG_ERROR,\n\"Frame too small (%d bytes). Truncated file?\\n\", VAR_5);", "*VAR_2 = 0;", "return VAR_5;", "}", "init_get_bits(&gb, VAR_4, FRAMESIZE * 8);", "for (VAR_9 = 0; VAR_9 < LPC_ORDER; VAR_9++)", "VAR_8[VAR_9] = ff_lpc_refl_cb[VAR_9][get_bits(&gb, VAR_6[VAR_9])];", "ff_eval_coefs(ractx->lpc_coef[0], VAR_8);", "ractx->lpc_refl_rms[0] = ff_rms(VAR_8);", "VAR_12 = ff_energy_tab[get_bits(&gb, 5)];", "VAR_7[0] = ff_interp(ractx, block_coefs[0], 1, 1, ractx->old_energy);", "VAR_7[1] = ff_interp(ractx, block_coefs[1], 2,\nVAR_12 <= ractx->old_energy,\nff_t_sqrt(VAR_12*ractx->old_energy) >> 12);", "VAR_7[2] = ff_interp(ractx, block_coefs[2], 3, 0, VAR_12);", "VAR_7[3] = ff_rescale_rms(ractx->lpc_refl_rms[0], VAR_12);", "ff_int_to_int16(block_coefs[3], ractx->lpc_coef[0]);", "for (VAR_9=0; VAR_9 < NBLOCKS; VAR_9++) {", "do_output_subblock(ractx, block_coefs[VAR_9], VAR_7[VAR_9], &gb);", "for (VAR_10=0; VAR_10 < BLOCKSIZE; VAR_10++)", "*samples++ = av_clip_int16(ractx->curr_sblock[VAR_10 + 10] << 2);", "}", "ractx->old_energy = VAR_12;", "ractx->lpc_refl_rms[1] = ractx->lpc_refl_rms[0];", "FFSWAP(unsigned int *, ractx->lpc_coef[0], ractx->lpc_coef[1]);", "*VAR_2 = 1;", "return FRAMESIZE;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55, 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ], [ 75 ], [ 77 ], [ 81 ], [ 85 ], [ 87, 89, 91 ], [ 93 ], [ 95 ], [ 99 ], [ 103 ], [ 105 ], [ 109 ], [ 111 ], [ 113 ], [ 117 ], [ 119 ], [ 123 ], [ 127 ], [ 131 ], [ 133 ] ]
7,437
static TargetFdDataFunc fd_trans_host_to_target_data(int fd) { if (fd < target_fd_max && target_fd_trans[fd]) { return target_fd_trans[fd]->host_to_target_data; } return NULL; }
false
qemu
861d72cd28b5793fc367c46b7821a5372b66e3f4
static TargetFdDataFunc fd_trans_host_to_target_data(int fd) { if (fd < target_fd_max && target_fd_trans[fd]) { return target_fd_trans[fd]->host_to_target_data; } return NULL; }
{ "code": [], "line_no": [] }
static TargetFdDataFunc FUNC_0(int fd) { if (fd < target_fd_max && target_fd_trans[fd]) { return target_fd_trans[fd]->host_to_target_data; } return NULL; }
[ "static TargetFdDataFunc FUNC_0(int fd)\n{", "if (fd < target_fd_max && target_fd_trans[fd]) {", "return target_fd_trans[fd]->host_to_target_data;", "}", "return NULL;", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ] ]
7,438
static uint64_t arm_sysctl_read(void *opaque, target_phys_addr_t offset, unsigned size) { arm_sysctl_state *s = (arm_sysctl_state *)opaque; switch (offset) { case 0x00: /* ID */ return s->sys_id; case 0x04: /* SW */ /* General purpose hardware switches. We don't have a useful way of exposing these to the user. */ return 0; case 0x08: /* LED */ return s->leds; case 0x20: /* LOCK */ return s->lockval; case 0x0c: /* OSC0 */ case 0x10: /* OSC1 */ case 0x14: /* OSC2 */ case 0x18: /* OSC3 */ case 0x1c: /* OSC4 */ case 0x24: /* 100HZ */ /* ??? Implement these. */ return 0; case 0x28: /* CFGDATA1 */ return s->cfgdata1; case 0x2c: /* CFGDATA2 */ return s->cfgdata2; case 0x30: /* FLAGS */ return s->flags; case 0x38: /* NVFLAGS */ return s->nvflags; case 0x40: /* RESETCTL */ if (board_id(s) == BOARD_ID_VEXPRESS) { /* reserved: RAZ/WI */ return 0; } return s->resetlevel; case 0x44: /* PCICTL */ return 1; case 0x48: /* MCI */ return s->sys_mci; case 0x4c: /* FLASH */ return 0; case 0x50: /* CLCD */ return s->sys_clcd; case 0x54: /* CLCDSER */ return 0; case 0x58: /* BOOTCS */ return 0; case 0x5c: /* 24MHz */ return muldiv64(qemu_get_clock_ns(vm_clock), 24000000, get_ticks_per_sec()); case 0x60: /* MISC */ return 0; case 0x84: /* PROCID0 */ return s->proc_id; case 0x88: /* PROCID1 */ return 0xff000000; case 0x64: /* DMAPSR0 */ case 0x68: /* DMAPSR1 */ case 0x6c: /* DMAPSR2 */ case 0x70: /* IOSEL */ case 0x74: /* PLDCTL */ case 0x80: /* BUSID */ case 0x8c: /* OSCRESET0 */ case 0x90: /* OSCRESET1 */ case 0x94: /* OSCRESET2 */ case 0x98: /* OSCRESET3 */ case 0x9c: /* OSCRESET4 */ case 0xc0: /* SYS_TEST_OSC0 */ case 0xc4: /* SYS_TEST_OSC1 */ case 0xc8: /* SYS_TEST_OSC2 */ case 0xcc: /* SYS_TEST_OSC3 */ case 0xd0: /* SYS_TEST_OSC4 */ return 0; case 0xa0: /* SYS_CFGDATA */ if (board_id(s) != BOARD_ID_VEXPRESS) { goto bad_reg; } return s->sys_cfgdata; case 0xa4: /* SYS_CFGCTRL */ if (board_id(s) != BOARD_ID_VEXPRESS) { goto bad_reg; } return s->sys_cfgctrl; case 0xa8: /* SYS_CFGSTAT */ if (board_id(s) != BOARD_ID_VEXPRESS) { goto bad_reg; } return s->sys_cfgstat; default: bad_reg: printf ("arm_sysctl_read: Bad register offset 0x%x\n", (int)offset); return 0; } }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static uint64_t arm_sysctl_read(void *opaque, target_phys_addr_t offset, unsigned size) { arm_sysctl_state *s = (arm_sysctl_state *)opaque; switch (offset) { case 0x00: return s->sys_id; case 0x04: return 0; case 0x08: return s->leds; case 0x20: return s->lockval; case 0x0c: case 0x10: case 0x14: case 0x18: case 0x1c: case 0x24: return 0; case 0x28: return s->cfgdata1; case 0x2c: return s->cfgdata2; case 0x30: return s->flags; case 0x38: return s->nvflags; case 0x40: if (board_id(s) == BOARD_ID_VEXPRESS) { return 0; } return s->resetlevel; case 0x44: return 1; case 0x48: return s->sys_mci; case 0x4c: return 0; case 0x50: return s->sys_clcd; case 0x54: return 0; case 0x58: return 0; case 0x5c: return muldiv64(qemu_get_clock_ns(vm_clock), 24000000, get_ticks_per_sec()); case 0x60: return 0; case 0x84: return s->proc_id; case 0x88: return 0xff000000; case 0x64: case 0x68: case 0x6c: case 0x70: case 0x74: case 0x80: case 0x8c: case 0x90: case 0x94: case 0x98: case 0x9c: case 0xc0: case 0xc4: case 0xc8: case 0xcc: case 0xd0: return 0; case 0xa0: if (board_id(s) != BOARD_ID_VEXPRESS) { goto bad_reg; } return s->sys_cfgdata; case 0xa4: if (board_id(s) != BOARD_ID_VEXPRESS) { goto bad_reg; } return s->sys_cfgctrl; case 0xa8: if (board_id(s) != BOARD_ID_VEXPRESS) { goto bad_reg; } return s->sys_cfgstat; default: bad_reg: printf ("arm_sysctl_read: Bad register offset 0x%x\n", (int)offset); return 0; } }
{ "code": [], "line_no": [] }
static uint64_t FUNC_0(void *opaque, target_phys_addr_t offset, unsigned size) { arm_sysctl_state *s = (arm_sysctl_state *)opaque; switch (offset) { case 0x00: return s->sys_id; case 0x04: return 0; case 0x08: return s->leds; case 0x20: return s->lockval; case 0x0c: case 0x10: case 0x14: case 0x18: case 0x1c: case 0x24: return 0; case 0x28: return s->cfgdata1; case 0x2c: return s->cfgdata2; case 0x30: return s->flags; case 0x38: return s->nvflags; case 0x40: if (board_id(s) == BOARD_ID_VEXPRESS) { return 0; } return s->resetlevel; case 0x44: return 1; case 0x48: return s->sys_mci; case 0x4c: return 0; case 0x50: return s->sys_clcd; case 0x54: return 0; case 0x58: return 0; case 0x5c: return muldiv64(qemu_get_clock_ns(vm_clock), 24000000, get_ticks_per_sec()); case 0x60: return 0; case 0x84: return s->proc_id; case 0x88: return 0xff000000; case 0x64: case 0x68: case 0x6c: case 0x70: case 0x74: case 0x80: case 0x8c: case 0x90: case 0x94: case 0x98: case 0x9c: case 0xc0: case 0xc4: case 0xc8: case 0xcc: case 0xd0: return 0; case 0xa0: if (board_id(s) != BOARD_ID_VEXPRESS) { goto bad_reg; } return s->sys_cfgdata; case 0xa4: if (board_id(s) != BOARD_ID_VEXPRESS) { goto bad_reg; } return s->sys_cfgctrl; case 0xa8: if (board_id(s) != BOARD_ID_VEXPRESS) { goto bad_reg; } return s->sys_cfgstat; default: bad_reg: printf ("FUNC_0: Bad register offset 0x%x\n", (int)offset); return 0; } }
[ "static uint64_t FUNC_0(void *opaque, target_phys_addr_t offset,\nunsigned size)\n{", "arm_sysctl_state *s = (arm_sysctl_state *)opaque;", "switch (offset) {", "case 0x00:\nreturn s->sys_id;", "case 0x04:\nreturn 0;", "case 0x08:\nreturn s->leds;", "case 0x20:\nreturn s->lockval;", "case 0x0c:\ncase 0x10:\ncase 0x14:\ncase 0x18:\ncase 0x1c:\ncase 0x24:\nreturn 0;", "case 0x28:\nreturn s->cfgdata1;", "case 0x2c:\nreturn s->cfgdata2;", "case 0x30:\nreturn s->flags;", "case 0x38:\nreturn s->nvflags;", "case 0x40:\nif (board_id(s) == BOARD_ID_VEXPRESS) {", "return 0;", "}", "return s->resetlevel;", "case 0x44:\nreturn 1;", "case 0x48:\nreturn s->sys_mci;", "case 0x4c:\nreturn 0;", "case 0x50:\nreturn s->sys_clcd;", "case 0x54:\nreturn 0;", "case 0x58:\nreturn 0;", "case 0x5c:\nreturn muldiv64(qemu_get_clock_ns(vm_clock), 24000000, get_ticks_per_sec());", "case 0x60:\nreturn 0;", "case 0x84:\nreturn s->proc_id;", "case 0x88:\nreturn 0xff000000;", "case 0x64:\ncase 0x68:\ncase 0x6c:\ncase 0x70:\ncase 0x74:\ncase 0x80:\ncase 0x8c:\ncase 0x90:\ncase 0x94:\ncase 0x98:\ncase 0x9c:\ncase 0xc0:\ncase 0xc4:\ncase 0xc8:\ncase 0xcc:\ncase 0xd0:\nreturn 0;", "case 0xa0:\nif (board_id(s) != BOARD_ID_VEXPRESS) {", "goto bad_reg;", "}", "return s->sys_cfgdata;", "case 0xa4:\nif (board_id(s) != BOARD_ID_VEXPRESS) {", "goto bad_reg;", "}", "return s->sys_cfgctrl;", "case 0xa8:\nif (board_id(s) != BOARD_ID_VEXPRESS) {", "goto bad_reg;", "}", "return s->sys_cfgstat;", "default:\nbad_reg:\nprintf (\"FUNC_0: Bad register offset 0x%x\\n\", (int)offset);", "return 0;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13, 15 ], [ 17, 23 ], [ 25, 27 ], [ 29, 31 ], [ 33, 35, 37, 39, 41, 43, 47 ], [ 49, 51 ], [ 53, 55 ], [ 57, 59 ], [ 61, 63 ], [ 65, 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77, 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 ] ]
7,439
void virtio_blk_data_plane_stop(VirtIOBlockDataPlane *s) { BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(s->vdev))); VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus); VirtIOBlock *vblk = VIRTIO_BLK(s->vdev); unsigned i; unsigned nvqs = s->conf->num_queues; if (!vblk->dataplane_started || s->stopping) { return; } /* Better luck next time. */ if (vblk->dataplane_disabled) { vblk->dataplane_disabled = false; vblk->dataplane_started = false; return; } s->stopping = true; trace_virtio_blk_data_plane_stop(s); aio_context_acquire(s->ctx); /* Stop notifications for new requests from guest */ for (i = 0; i < nvqs; i++) { VirtQueue *vq = virtio_get_queue(s->vdev, i); virtio_queue_aio_set_host_notifier_handler(vq, s->ctx, NULL); } /* Drain and switch bs back to the QEMU main loop */ blk_set_aio_context(s->conf->conf.blk, qemu_get_aio_context()); aio_context_release(s->ctx); for (i = 0; i < nvqs; i++) { virtio_bus_set_host_notifier(VIRTIO_BUS(qbus), i, false); } /* Clean up guest notifier (irq) */ k->set_guest_notifiers(qbus->parent, nvqs, false); vblk->dataplane_started = false; s->stopping = false; }
false
qemu
9ffe337c08388d5c587eae1d77db1b0d1a47c7b1
void virtio_blk_data_plane_stop(VirtIOBlockDataPlane *s) { BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(s->vdev))); VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus); VirtIOBlock *vblk = VIRTIO_BLK(s->vdev); unsigned i; unsigned nvqs = s->conf->num_queues; if (!vblk->dataplane_started || s->stopping) { return; } if (vblk->dataplane_disabled) { vblk->dataplane_disabled = false; vblk->dataplane_started = false; return; } s->stopping = true; trace_virtio_blk_data_plane_stop(s); aio_context_acquire(s->ctx); for (i = 0; i < nvqs; i++) { VirtQueue *vq = virtio_get_queue(s->vdev, i); virtio_queue_aio_set_host_notifier_handler(vq, s->ctx, NULL); } blk_set_aio_context(s->conf->conf.blk, qemu_get_aio_context()); aio_context_release(s->ctx); for (i = 0; i < nvqs; i++) { virtio_bus_set_host_notifier(VIRTIO_BUS(qbus), i, false); } k->set_guest_notifiers(qbus->parent, nvqs, false); vblk->dataplane_started = false; s->stopping = false; }
{ "code": [], "line_no": [] }
void FUNC_0(VirtIOBlockDataPlane *VAR_0) { BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(VAR_0->vdev))); VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus); VirtIOBlock *vblk = VIRTIO_BLK(VAR_0->vdev); unsigned VAR_1; unsigned VAR_2 = VAR_0->conf->num_queues; if (!vblk->dataplane_started || VAR_0->stopping) { return; } if (vblk->dataplane_disabled) { vblk->dataplane_disabled = false; vblk->dataplane_started = false; return; } VAR_0->stopping = true; trace_virtio_blk_data_plane_stop(VAR_0); aio_context_acquire(VAR_0->ctx); for (VAR_1 = 0; VAR_1 < VAR_2; VAR_1++) { VirtQueue *vq = virtio_get_queue(VAR_0->vdev, VAR_1); virtio_queue_aio_set_host_notifier_handler(vq, VAR_0->ctx, NULL); } blk_set_aio_context(VAR_0->conf->conf.blk, qemu_get_aio_context()); aio_context_release(VAR_0->ctx); for (VAR_1 = 0; VAR_1 < VAR_2; VAR_1++) { virtio_bus_set_host_notifier(VIRTIO_BUS(qbus), VAR_1, false); } k->set_guest_notifiers(qbus->parent, VAR_2, false); vblk->dataplane_started = false; VAR_0->stopping = false; }
[ "void FUNC_0(VirtIOBlockDataPlane *VAR_0)\n{", "BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(VAR_0->vdev)));", "VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus);", "VirtIOBlock *vblk = VIRTIO_BLK(VAR_0->vdev);", "unsigned VAR_1;", "unsigned VAR_2 = VAR_0->conf->num_queues;", "if (!vblk->dataplane_started || VAR_0->stopping) {", "return;", "}", "if (vblk->dataplane_disabled) {", "vblk->dataplane_disabled = false;", "vblk->dataplane_started = false;", "return;", "}", "VAR_0->stopping = true;", "trace_virtio_blk_data_plane_stop(VAR_0);", "aio_context_acquire(VAR_0->ctx);", "for (VAR_1 = 0; VAR_1 < VAR_2; VAR_1++) {", "VirtQueue *vq = virtio_get_queue(VAR_0->vdev, VAR_1);", "virtio_queue_aio_set_host_notifier_handler(vq, VAR_0->ctx, NULL);", "}", "blk_set_aio_context(VAR_0->conf->conf.blk, qemu_get_aio_context());", "aio_context_release(VAR_0->ctx);", "for (VAR_1 = 0; VAR_1 < VAR_2; VAR_1++) {", "virtio_bus_set_host_notifier(VIRTIO_BUS(qbus), VAR_1, false);", "}", "k->set_guest_notifiers(qbus->parent, VAR_2, false);", "vblk->dataplane_started = false;", "VAR_0->stopping = false;", "}" ]
[ 0, 0, 0, 0, 0, 0, 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 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 63 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 81 ], [ 85 ], [ 87 ], [ 89 ] ]
7,440
static uint32_t scoop_readb(void *opaque, target_phys_addr_t addr) { ScoopInfo *s = (ScoopInfo *) opaque; switch (addr) { case SCOOP_MCR: return s->mcr; case SCOOP_CDR: return s->cdr; case SCOOP_CSR: return s->status; case SCOOP_CPR: return s->power; case SCOOP_CCR: return s->ccr; case SCOOP_IRR_IRM: return s->irr; case SCOOP_IMR: return s->imr; case SCOOP_ISR: return s->isr; case SCOOP_GPCR: return s->gpio_dir; case SCOOP_GPWR: case SCOOP_GPRR: return s->gpio_level; default: zaurus_printf("Bad register offset " REG_FMT "\n", (unsigned long)addr); } return 0; }
false
qemu
aa9438d9f8a19258514c5cc238d2494a2572ff58
static uint32_t scoop_readb(void *opaque, target_phys_addr_t addr) { ScoopInfo *s = (ScoopInfo *) opaque; switch (addr) { case SCOOP_MCR: return s->mcr; case SCOOP_CDR: return s->cdr; case SCOOP_CSR: return s->status; case SCOOP_CPR: return s->power; case SCOOP_CCR: return s->ccr; case SCOOP_IRR_IRM: return s->irr; case SCOOP_IMR: return s->imr; case SCOOP_ISR: return s->isr; case SCOOP_GPCR: return s->gpio_dir; case SCOOP_GPWR: case SCOOP_GPRR: return s->gpio_level; default: zaurus_printf("Bad register offset " REG_FMT "\n", (unsigned long)addr); } return 0; }
{ "code": [], "line_no": [] }
static uint32_t FUNC_0(void *opaque, target_phys_addr_t addr) { ScoopInfo *s = (ScoopInfo *) opaque; switch (addr) { case SCOOP_MCR: return s->mcr; case SCOOP_CDR: return s->cdr; case SCOOP_CSR: return s->status; case SCOOP_CPR: return s->power; case SCOOP_CCR: return s->ccr; case SCOOP_IRR_IRM: return s->irr; case SCOOP_IMR: return s->imr; case SCOOP_ISR: return s->isr; case SCOOP_GPCR: return s->gpio_dir; case SCOOP_GPWR: case SCOOP_GPRR: return s->gpio_level; default: zaurus_printf("Bad register offset " REG_FMT "\n", (unsigned long)addr); } return 0; }
[ "static uint32_t FUNC_0(void *opaque, target_phys_addr_t addr)\n{", "ScoopInfo *s = (ScoopInfo *) opaque;", "switch (addr) {", "case SCOOP_MCR:\nreturn s->mcr;", "case SCOOP_CDR:\nreturn s->cdr;", "case SCOOP_CSR:\nreturn s->status;", "case SCOOP_CPR:\nreturn s->power;", "case SCOOP_CCR:\nreturn s->ccr;", "case SCOOP_IRR_IRM:\nreturn s->irr;", "case SCOOP_IMR:\nreturn s->imr;", "case SCOOP_ISR:\nreturn s->isr;", "case SCOOP_GPCR:\nreturn s->gpio_dir;", "case SCOOP_GPWR:\ncase SCOOP_GPRR:\nreturn s->gpio_level;", "default:\nzaurus_printf(\"Bad register offset \" REG_FMT \"\\n\", (unsigned long)addr);", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11, 13 ], [ 15, 17 ], [ 19, 21 ], [ 23, 25 ], [ 27, 29 ], [ 31, 33 ], [ 35, 37 ], [ 39, 41 ], [ 43, 45 ], [ 47, 49, 51 ], [ 53, 55 ], [ 57 ], [ 61 ], [ 63 ] ]
7,441
static void acpi_build_update(void *build_opaque) { AcpiBuildState *build_state = build_opaque; AcpiBuildTables tables; /* No state to update or already patched? Nothing to do. */ if (!build_state || build_state->patched) { return; } build_state->patched = 1; acpi_build_tables_init(&tables); acpi_build(&tables, MACHINE(qdev_get_machine())); acpi_ram_update(build_state->table_mr, tables.table_data); if (build_state->rsdp) { memcpy(build_state->rsdp, tables.rsdp->data, acpi_data_len(tables.rsdp)); } else { acpi_ram_update(build_state->rsdp_mr, tables.rsdp); } acpi_ram_update(build_state->linker_mr, tables.linker); acpi_build_tables_cleanup(&tables, true); }
false
qemu
0e9b9edae7bebfd31fdbead4ccbbce03876a7edd
static void acpi_build_update(void *build_opaque) { AcpiBuildState *build_state = build_opaque; AcpiBuildTables tables; if (!build_state || build_state->patched) { return; } build_state->patched = 1; acpi_build_tables_init(&tables); acpi_build(&tables, MACHINE(qdev_get_machine())); acpi_ram_update(build_state->table_mr, tables.table_data); if (build_state->rsdp) { memcpy(build_state->rsdp, tables.rsdp->data, acpi_data_len(tables.rsdp)); } else { acpi_ram_update(build_state->rsdp_mr, tables.rsdp); } acpi_ram_update(build_state->linker_mr, tables.linker); acpi_build_tables_cleanup(&tables, true); }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0) { AcpiBuildState *build_state = VAR_0; AcpiBuildTables tables; if (!build_state || build_state->patched) { return; } build_state->patched = 1; acpi_build_tables_init(&tables); acpi_build(&tables, MACHINE(qdev_get_machine())); acpi_ram_update(build_state->table_mr, tables.table_data); if (build_state->rsdp) { memcpy(build_state->rsdp, tables.rsdp->data, acpi_data_len(tables.rsdp)); } else { acpi_ram_update(build_state->rsdp_mr, tables.rsdp); } acpi_ram_update(build_state->linker_mr, tables.linker); acpi_build_tables_cleanup(&tables, true); }
[ "static void FUNC_0(void *VAR_0)\n{", "AcpiBuildState *build_state = VAR_0;", "AcpiBuildTables tables;", "if (!build_state || build_state->patched) {", "return;", "}", "build_state->patched = 1;", "acpi_build_tables_init(&tables);", "acpi_build(&tables, MACHINE(qdev_get_machine()));", "acpi_ram_update(build_state->table_mr, tables.table_data);", "if (build_state->rsdp) {", "memcpy(build_state->rsdp, tables.rsdp->data, acpi_data_len(tables.rsdp));", "} else {", "acpi_ram_update(build_state->rsdp_mr, tables.rsdp);", "}", "acpi_ram_update(build_state->linker_mr, tables.linker);", "acpi_build_tables_cleanup(&tables, true);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 27 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ] ]
7,442
static ssize_t nbd_receive_request(QIOChannel *ioc, NBDRequest *request) { uint8_t buf[NBD_REQUEST_SIZE]; uint32_t magic; ssize_t ret; ret = read_sync(ioc, buf, sizeof(buf), NULL); if (ret < 0) { return ret; } /* Request [ 0 .. 3] magic (NBD_REQUEST_MAGIC) [ 4 .. 5] flags (NBD_CMD_FLAG_FUA, ...) [ 6 .. 7] type (NBD_CMD_READ, ...) [ 8 .. 15] handle [16 .. 23] from [24 .. 27] len */ magic = ldl_be_p(buf); request->flags = lduw_be_p(buf + 4); request->type = lduw_be_p(buf + 6); request->handle = ldq_be_p(buf + 8); request->from = ldq_be_p(buf + 16); request->len = ldl_be_p(buf + 24); TRACE("Got request: { magic = 0x%" PRIx32 ", .flags = %" PRIx16 ", .type = %" PRIx16 ", from = %" PRIu64 ", len = %" PRIu32 " }", magic, request->flags, request->type, request->from, request->len); if (magic != NBD_REQUEST_MAGIC) { LOG("invalid magic (got 0x%" PRIx32 ")", magic); return -EINVAL; } return 0; }
false
qemu
d1fdf257d52822695f5ace6c586e059aa17d4b79
static ssize_t nbd_receive_request(QIOChannel *ioc, NBDRequest *request) { uint8_t buf[NBD_REQUEST_SIZE]; uint32_t magic; ssize_t ret; ret = read_sync(ioc, buf, sizeof(buf), NULL); if (ret < 0) { return ret; } magic = ldl_be_p(buf); request->flags = lduw_be_p(buf + 4); request->type = lduw_be_p(buf + 6); request->handle = ldq_be_p(buf + 8); request->from = ldq_be_p(buf + 16); request->len = ldl_be_p(buf + 24); TRACE("Got request: { magic = 0x%" PRIx32 ", .flags = %" PRIx16 ", .type = %" PRIx16 ", from = %" PRIu64 ", len = %" PRIu32 " }", magic, request->flags, request->type, request->from, request->len); if (magic != NBD_REQUEST_MAGIC) { LOG("invalid magic (got 0x%" PRIx32 ")", magic); return -EINVAL; } return 0; }
{ "code": [], "line_no": [] }
static ssize_t FUNC_0(QIOChannel *ioc, NBDRequest *request) { uint8_t buf[NBD_REQUEST_SIZE]; uint32_t magic; ssize_t ret; ret = read_sync(ioc, buf, sizeof(buf), NULL); if (ret < 0) { return ret; } magic = ldl_be_p(buf); request->flags = lduw_be_p(buf + 4); request->type = lduw_be_p(buf + 6); request->handle = ldq_be_p(buf + 8); request->from = ldq_be_p(buf + 16); request->len = ldl_be_p(buf + 24); TRACE("Got request: { magic = 0x%" PRIx32 ", .flags = %" PRIx16 ", .type = %" PRIx16 ", from = %" PRIu64 ", len = %" PRIu32 " }", magic, request->flags, request->type, request->from, request->len); if (magic != NBD_REQUEST_MAGIC) { LOG("invalid magic (got 0x%" PRIx32 ")", magic); return -EINVAL; } return 0; }
[ "static ssize_t FUNC_0(QIOChannel *ioc, NBDRequest *request)\n{", "uint8_t buf[NBD_REQUEST_SIZE];", "uint32_t magic;", "ssize_t ret;", "ret = read_sync(ioc, buf, sizeof(buf), NULL);", "if (ret < 0) {", "return ret;", "}", "magic = ldl_be_p(buf);", "request->flags = lduw_be_p(buf + 4);", "request->type = lduw_be_p(buf + 6);", "request->handle = ldq_be_p(buf + 8);", "request->from = ldq_be_p(buf + 16);", "request->len = ldl_be_p(buf + 24);", "TRACE(\"Got request: { magic = 0x%\" PRIx32 \", .flags = %\" PRIx16", "\", .type = %\" PRIx16 \", from = %\" PRIu64 \", len = %\" PRIu32 \" }\",", "magic, request->flags, request->type, request->from, request->len);", "if (magic != NBD_REQUEST_MAGIC) {", "LOG(\"invalid magic (got 0x%\" PRIx32 \")\", magic);", "return -EINVAL;", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ] ]
7,443
static void change_parent_backing_link(BlockDriverState *from, BlockDriverState *to) { BdrvChild *c, *next, *to_c; QLIST_FOREACH_SAFE(c, &from->parents, next_parent, next) { if (c->role->stay_at_node) { continue; } if (c->role == &child_backing) { /* @from is generally not allowed to be a backing file, except for * when @to is the overlay. In that case, @from may not be replaced * by @to as @to's backing node. */ QLIST_FOREACH(to_c, &to->children, next) { if (to_c == c) { break; } } if (to_c) { continue; } } assert(c->role != &child_backing); bdrv_ref(to); /* FIXME Are we sure that bdrv_replace_child() can't run into * &error_abort because of permissions? */ bdrv_replace_child(c, to, true); bdrv_unref(from); } }
false
qemu
3e44c8e08a4b84ec1f4f1eb249d33005bb9cf572
static void change_parent_backing_link(BlockDriverState *from, BlockDriverState *to) { BdrvChild *c, *next, *to_c; QLIST_FOREACH_SAFE(c, &from->parents, next_parent, next) { if (c->role->stay_at_node) { continue; } if (c->role == &child_backing) { QLIST_FOREACH(to_c, &to->children, next) { if (to_c == c) { break; } } if (to_c) { continue; } } assert(c->role != &child_backing); bdrv_ref(to); bdrv_replace_child(c, to, true); bdrv_unref(from); } }
{ "code": [], "line_no": [] }
static void FUNC_0(BlockDriverState *VAR_0, BlockDriverState *VAR_1) { BdrvChild *c, *next, *to_c; QLIST_FOREACH_SAFE(c, &VAR_0->parents, next_parent, next) { if (c->role->stay_at_node) { continue; } if (c->role == &child_backing) { QLIST_FOREACH(to_c, &VAR_1->children, next) { if (to_c == c) { break; } } if (to_c) { continue; } } assert(c->role != &child_backing); bdrv_ref(VAR_1); bdrv_replace_child(c, VAR_1, true); bdrv_unref(VAR_0); } }
[ "static void FUNC_0(BlockDriverState *VAR_0,\nBlockDriverState *VAR_1)\n{", "BdrvChild *c, *next, *to_c;", "QLIST_FOREACH_SAFE(c, &VAR_0->parents, next_parent, next) {", "if (c->role->stay_at_node) {", "continue;", "}", "if (c->role == &child_backing) {", "QLIST_FOREACH(to_c, &VAR_1->children, next) {", "if (to_c == c) {", "break;", "}", "}", "if (to_c) {", "continue;", "}", "}", "assert(c->role != &child_backing);", "bdrv_ref(VAR_1);", "bdrv_replace_child(c, VAR_1, true);", "bdrv_unref(VAR_0);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ] ]
7,444
static void test_visitor_in_any(TestInputVisitorData *data, const void *unused) { QObject *res = NULL; Error *err = NULL; Visitor *v; QInt *qint; QBool *qbool; QString *qstring; QDict *qdict; QObject *qobj; v = visitor_input_test_init(data, "-42"); visit_type_any(v, &res, NULL, &err); g_assert(!err); qint = qobject_to_qint(res); g_assert(qint); g_assert_cmpint(qint_get_int(qint), ==, -42); qobject_decref(res); v = visitor_input_test_init(data, "{ 'integer': -42, 'boolean': true, 'string': 'foo' }"); visit_type_any(v, &res, NULL, &err); g_assert(!err); qdict = qobject_to_qdict(res); g_assert(qdict && qdict_size(qdict) == 3); qobj = qdict_get(qdict, "integer"); g_assert(qobj); qint = qobject_to_qint(qobj); g_assert(qint); g_assert_cmpint(qint_get_int(qint), ==, -42); qobj = qdict_get(qdict, "boolean"); g_assert(qobj); qbool = qobject_to_qbool(qobj); g_assert(qbool); g_assert(qbool_get_bool(qbool) == true); qobj = qdict_get(qdict, "string"); g_assert(qobj); qstring = qobject_to_qstring(qobj); g_assert(qstring); g_assert_cmpstr(qstring_get_str(qstring), ==, "foo"); qobject_decref(res); }
false
qemu
3f66f764ee25f10d3e1144ebc057a949421b7728
static void test_visitor_in_any(TestInputVisitorData *data, const void *unused) { QObject *res = NULL; Error *err = NULL; Visitor *v; QInt *qint; QBool *qbool; QString *qstring; QDict *qdict; QObject *qobj; v = visitor_input_test_init(data, "-42"); visit_type_any(v, &res, NULL, &err); g_assert(!err); qint = qobject_to_qint(res); g_assert(qint); g_assert_cmpint(qint_get_int(qint), ==, -42); qobject_decref(res); v = visitor_input_test_init(data, "{ 'integer': -42, 'boolean': true, 'string': 'foo' }"); visit_type_any(v, &res, NULL, &err); g_assert(!err); qdict = qobject_to_qdict(res); g_assert(qdict && qdict_size(qdict) == 3); qobj = qdict_get(qdict, "integer"); g_assert(qobj); qint = qobject_to_qint(qobj); g_assert(qint); g_assert_cmpint(qint_get_int(qint), ==, -42); qobj = qdict_get(qdict, "boolean"); g_assert(qobj); qbool = qobject_to_qbool(qobj); g_assert(qbool); g_assert(qbool_get_bool(qbool) == true); qobj = qdict_get(qdict, "string"); g_assert(qobj); qstring = qobject_to_qstring(qobj); g_assert(qstring); g_assert_cmpstr(qstring_get_str(qstring), ==, "foo"); qobject_decref(res); }
{ "code": [], "line_no": [] }
static void FUNC_0(TestInputVisitorData *VAR_0, const void *VAR_1) { QObject *res = NULL; Error *err = NULL; Visitor *v; QInt *qint; QBool *qbool; QString *qstring; QDict *qdict; QObject *qobj; v = visitor_input_test_init(VAR_0, "-42"); visit_type_any(v, &res, NULL, &err); g_assert(!err); qint = qobject_to_qint(res); g_assert(qint); g_assert_cmpint(qint_get_int(qint), ==, -42); qobject_decref(res); v = visitor_input_test_init(VAR_0, "{ 'integer': -42, 'boolean': true, 'string': 'foo' }"); visit_type_any(v, &res, NULL, &err); g_assert(!err); qdict = qobject_to_qdict(res); g_assert(qdict && qdict_size(qdict) == 3); qobj = qdict_get(qdict, "integer"); g_assert(qobj); qint = qobject_to_qint(qobj); g_assert(qint); g_assert_cmpint(qint_get_int(qint), ==, -42); qobj = qdict_get(qdict, "boolean"); g_assert(qobj); qbool = qobject_to_qbool(qobj); g_assert(qbool); g_assert(qbool_get_bool(qbool) == true); qobj = qdict_get(qdict, "string"); g_assert(qobj); qstring = qobject_to_qstring(qobj); g_assert(qstring); g_assert_cmpstr(qstring_get_str(qstring), ==, "foo"); qobject_decref(res); }
[ "static void FUNC_0(TestInputVisitorData *VAR_0,\nconst void *VAR_1)\n{", "QObject *res = NULL;", "Error *err = NULL;", "Visitor *v;", "QInt *qint;", "QBool *qbool;", "QString *qstring;", "QDict *qdict;", "QObject *qobj;", "v = visitor_input_test_init(VAR_0, \"-42\");", "visit_type_any(v, &res, NULL, &err);", "g_assert(!err);", "qint = qobject_to_qint(res);", "g_assert(qint);", "g_assert_cmpint(qint_get_int(qint), ==, -42);", "qobject_decref(res);", "v = visitor_input_test_init(VAR_0, \"{ 'integer': -42, 'boolean': true, 'string': 'foo' }\");", "visit_type_any(v, &res, NULL, &err);", "g_assert(!err);", "qdict = qobject_to_qdict(res);", "g_assert(qdict && qdict_size(qdict) == 3);", "qobj = qdict_get(qdict, \"integer\");", "g_assert(qobj);", "qint = qobject_to_qint(qobj);", "g_assert(qint);", "g_assert_cmpint(qint_get_int(qint), ==, -42);", "qobj = qdict_get(qdict, \"boolean\");", "g_assert(qobj);", "qbool = qobject_to_qbool(qobj);", "g_assert(qbool);", "g_assert(qbool_get_bool(qbool) == true);", "qobj = qdict_get(qdict, \"string\");", "g_assert(qobj);", "qstring = qobject_to_qstring(qobj);", "g_assert(qstring);", "g_assert_cmpstr(qstring_get_str(qstring), ==, \"foo\");", "qobject_decref(res);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 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 ] ]
7,445
void kvm_remove_all_breakpoints(CPUState *current_env) { struct kvm_sw_breakpoint *bp, *next; KVMState *s = current_env->kvm_state; CPUState *env; QTAILQ_FOREACH_SAFE(bp, &s->kvm_sw_breakpoints, entry, next) { if (kvm_arch_remove_sw_breakpoint(current_env, bp) != 0) { /* Try harder to find a CPU that currently sees the breakpoint. */ for (env = first_cpu; env != NULL; env = env->next_cpu) { if (kvm_arch_remove_sw_breakpoint(env, bp) == 0) break; } } } kvm_arch_remove_all_hw_breakpoints(); for (env = first_cpu; env != NULL; env = env->next_cpu) kvm_update_guest_debug(env, 0); }
false
qemu
a426e122173f36f05ea2cb72dcff77b7408546ce
void kvm_remove_all_breakpoints(CPUState *current_env) { struct kvm_sw_breakpoint *bp, *next; KVMState *s = current_env->kvm_state; CPUState *env; QTAILQ_FOREACH_SAFE(bp, &s->kvm_sw_breakpoints, entry, next) { if (kvm_arch_remove_sw_breakpoint(current_env, bp) != 0) { for (env = first_cpu; env != NULL; env = env->next_cpu) { if (kvm_arch_remove_sw_breakpoint(env, bp) == 0) break; } } } kvm_arch_remove_all_hw_breakpoints(); for (env = first_cpu; env != NULL; env = env->next_cpu) kvm_update_guest_debug(env, 0); }
{ "code": [], "line_no": [] }
void FUNC_0(CPUState *VAR_0) { struct kvm_sw_breakpoint *VAR_1, *VAR_2; KVMState *s = VAR_0->kvm_state; CPUState *env; QTAILQ_FOREACH_SAFE(VAR_1, &s->kvm_sw_breakpoints, entry, VAR_2) { if (kvm_arch_remove_sw_breakpoint(VAR_0, VAR_1) != 0) { for (env = first_cpu; env != NULL; env = env->next_cpu) { if (kvm_arch_remove_sw_breakpoint(env, VAR_1) == 0) break; } } } kvm_arch_remove_all_hw_breakpoints(); for (env = first_cpu; env != NULL; env = env->next_cpu) kvm_update_guest_debug(env, 0); }
[ "void FUNC_0(CPUState *VAR_0)\n{", "struct kvm_sw_breakpoint *VAR_1, *VAR_2;", "KVMState *s = VAR_0->kvm_state;", "CPUState *env;", "QTAILQ_FOREACH_SAFE(VAR_1, &s->kvm_sw_breakpoints, entry, VAR_2) {", "if (kvm_arch_remove_sw_breakpoint(VAR_0, VAR_1) != 0) {", "for (env = first_cpu; env != NULL; env = env->next_cpu) {", "if (kvm_arch_remove_sw_breakpoint(env, VAR_1) == 0)\nbreak;", "}", "}", "}", "kvm_arch_remove_all_hw_breakpoints();", "for (env = first_cpu; env != NULL; env = env->next_cpu)", "kvm_update_guest_debug(env, 0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 19 ], [ 21, 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ] ]
7,447
static void generate_new_codebooks(RoqContext *enc, RoqTempdata *tempData) { int i,j; RoqCodebooks *codebooks = &tempData->codebooks; int max = enc->width*enc->height/16; uint8_t mb2[3*4]; roq_cell *results4 = av_malloc(sizeof(roq_cell)*MAX_CBS_4x4*4); uint8_t *yuvClusters=av_malloc(sizeof(int)*max*6*4); int *points = av_malloc(max*6*4*sizeof(int)); int bias; /* Subsample YUV data */ create_clusters(enc->frame_to_enc, enc->width, enc->height, yuvClusters); /* Cast to integer and apply chroma bias */ for (i=0; i<max*24; i++) { bias = ((i%6)<4) ? 1 : CHROMA_BIAS; points[i] = bias*yuvClusters[i]; } /* Create 4x4 codebooks */ generate_codebook(enc, tempData, points, max, results4, 4, MAX_CBS_4x4); codebooks->numCB4 = MAX_CBS_4x4; tempData->closest_cb2 = av_malloc(max*4*sizeof(int)); /* Create 2x2 codebooks */ generate_codebook(enc, tempData, points, max*4, enc->cb2x2, 2, MAX_CBS_2x2); codebooks->numCB2 = MAX_CBS_2x2; /* Unpack 2x2 codebook clusters */ for (i=0; i<codebooks->numCB2; i++) unpack_roq_cell(enc->cb2x2 + i, codebooks->unpacked_cb2 + i*2*2*3); /* Index all 4x4 entries to the 2x2 entries, unpack, and enlarge */ for (i=0; i<codebooks->numCB4; i++) { for (j=0; j<4; j++) { unpack_roq_cell(&results4[4*i + j], mb2); index_mb(mb2, codebooks->unpacked_cb2, codebooks->numCB2, &enc->cb4x4[i].idx[j], 2); } unpack_roq_qcell(codebooks->unpacked_cb2, enc->cb4x4 + i, codebooks->unpacked_cb4 + i*4*4*3); enlarge_roq_mb4(codebooks->unpacked_cb4 + i*4*4*3, codebooks->unpacked_cb4_enlarged + i*8*8*3); } av_free(yuvClusters); av_free(points); av_free(results4); }
false
FFmpeg
3beb9cbad35218ed1fb3473eeb3cfc97a931bff4
static void generate_new_codebooks(RoqContext *enc, RoqTempdata *tempData) { int i,j; RoqCodebooks *codebooks = &tempData->codebooks; int max = enc->width*enc->height/16; uint8_t mb2[3*4]; roq_cell *results4 = av_malloc(sizeof(roq_cell)*MAX_CBS_4x4*4); uint8_t *yuvClusters=av_malloc(sizeof(int)*max*6*4); int *points = av_malloc(max*6*4*sizeof(int)); int bias; create_clusters(enc->frame_to_enc, enc->width, enc->height, yuvClusters); for (i=0; i<max*24; i++) { bias = ((i%6)<4) ? 1 : CHROMA_BIAS; points[i] = bias*yuvClusters[i]; } generate_codebook(enc, tempData, points, max, results4, 4, MAX_CBS_4x4); codebooks->numCB4 = MAX_CBS_4x4; tempData->closest_cb2 = av_malloc(max*4*sizeof(int)); generate_codebook(enc, tempData, points, max*4, enc->cb2x2, 2, MAX_CBS_2x2); codebooks->numCB2 = MAX_CBS_2x2; for (i=0; i<codebooks->numCB2; i++) unpack_roq_cell(enc->cb2x2 + i, codebooks->unpacked_cb2 + i*2*2*3); for (i=0; i<codebooks->numCB4; i++) { for (j=0; j<4; j++) { unpack_roq_cell(&results4[4*i + j], mb2); index_mb(mb2, codebooks->unpacked_cb2, codebooks->numCB2, &enc->cb4x4[i].idx[j], 2); } unpack_roq_qcell(codebooks->unpacked_cb2, enc->cb4x4 + i, codebooks->unpacked_cb4 + i*4*4*3); enlarge_roq_mb4(codebooks->unpacked_cb4 + i*4*4*3, codebooks->unpacked_cb4_enlarged + i*8*8*3); } av_free(yuvClusters); av_free(points); av_free(results4); }
{ "code": [], "line_no": [] }
static void FUNC_0(RoqContext *VAR_0, RoqTempdata *VAR_1) { int VAR_2,VAR_3; RoqCodebooks *codebooks = &VAR_1->codebooks; int VAR_4 = VAR_0->width*VAR_0->height/16; uint8_t mb2[3*4]; roq_cell *results4 = av_malloc(sizeof(roq_cell)*MAX_CBS_4x4*4); uint8_t *yuvClusters=av_malloc(sizeof(int)*VAR_4*6*4); int *VAR_5 = av_malloc(VAR_4*6*4*sizeof(int)); int VAR_6; create_clusters(VAR_0->frame_to_enc, VAR_0->width, VAR_0->height, yuvClusters); for (VAR_2=0; VAR_2<VAR_4*24; VAR_2++) { VAR_6 = ((VAR_2%6)<4) ? 1 : CHROMA_BIAS; VAR_5[VAR_2] = VAR_6*yuvClusters[VAR_2]; } generate_codebook(VAR_0, VAR_1, VAR_5, VAR_4, results4, 4, MAX_CBS_4x4); codebooks->numCB4 = MAX_CBS_4x4; VAR_1->closest_cb2 = av_malloc(VAR_4*4*sizeof(int)); generate_codebook(VAR_0, VAR_1, VAR_5, VAR_4*4, VAR_0->cb2x2, 2, MAX_CBS_2x2); codebooks->numCB2 = MAX_CBS_2x2; for (VAR_2=0; VAR_2<codebooks->numCB2; VAR_2++) unpack_roq_cell(VAR_0->cb2x2 + VAR_2, codebooks->unpacked_cb2 + VAR_2*2*2*3); for (VAR_2=0; VAR_2<codebooks->numCB4; VAR_2++) { for (VAR_3=0; VAR_3<4; VAR_3++) { unpack_roq_cell(&results4[4*VAR_2 + VAR_3], mb2); index_mb(mb2, codebooks->unpacked_cb2, codebooks->numCB2, &VAR_0->cb4x4[VAR_2].idx[VAR_3], 2); } unpack_roq_qcell(codebooks->unpacked_cb2, VAR_0->cb4x4 + VAR_2, codebooks->unpacked_cb4 + VAR_2*4*4*3); enlarge_roq_mb4(codebooks->unpacked_cb4 + VAR_2*4*4*3, codebooks->unpacked_cb4_enlarged + VAR_2*8*8*3); } av_free(yuvClusters); av_free(VAR_5); av_free(results4); }
[ "static void FUNC_0(RoqContext *VAR_0, RoqTempdata *VAR_1)\n{", "int VAR_2,VAR_3;", "RoqCodebooks *codebooks = &VAR_1->codebooks;", "int VAR_4 = VAR_0->width*VAR_0->height/16;", "uint8_t mb2[3*4];", "roq_cell *results4 = av_malloc(sizeof(roq_cell)*MAX_CBS_4x4*4);", "uint8_t *yuvClusters=av_malloc(sizeof(int)*VAR_4*6*4);", "int *VAR_5 = av_malloc(VAR_4*6*4*sizeof(int));", "int VAR_6;", "create_clusters(VAR_0->frame_to_enc, VAR_0->width, VAR_0->height, yuvClusters);", "for (VAR_2=0; VAR_2<VAR_4*24; VAR_2++) {", "VAR_6 = ((VAR_2%6)<4) ? 1 : CHROMA_BIAS;", "VAR_5[VAR_2] = VAR_6*yuvClusters[VAR_2];", "}", "generate_codebook(VAR_0, VAR_1, VAR_5, VAR_4, results4, 4, MAX_CBS_4x4);", "codebooks->numCB4 = MAX_CBS_4x4;", "VAR_1->closest_cb2 = av_malloc(VAR_4*4*sizeof(int));", "generate_codebook(VAR_0, VAR_1, VAR_5, VAR_4*4, VAR_0->cb2x2, 2, MAX_CBS_2x2);", "codebooks->numCB2 = MAX_CBS_2x2;", "for (VAR_2=0; VAR_2<codebooks->numCB2; VAR_2++)", "unpack_roq_cell(VAR_0->cb2x2 + VAR_2, codebooks->unpacked_cb2 + VAR_2*2*2*3);", "for (VAR_2=0; VAR_2<codebooks->numCB4; VAR_2++) {", "for (VAR_3=0; VAR_3<4; VAR_3++) {", "unpack_roq_cell(&results4[4*VAR_2 + VAR_3], mb2);", "index_mb(mb2, codebooks->unpacked_cb2, codebooks->numCB2,\n&VAR_0->cb4x4[VAR_2].idx[VAR_3], 2);", "}", "unpack_roq_qcell(codebooks->unpacked_cb2, VAR_0->cb4x4 + VAR_2,\ncodebooks->unpacked_cb4 + VAR_2*4*4*3);", "enlarge_roq_mb4(codebooks->unpacked_cb4 + VAR_2*4*4*3,\ncodebooks->unpacked_cb4_enlarged + VAR_2*8*8*3);", "}", "av_free(yuvClusters);", "av_free(VAR_5);", "av_free(results4);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 43 ], [ 47 ], [ 51 ], [ 57 ], [ 61 ], [ 67 ], [ 69 ], [ 75 ], [ 77 ], [ 79 ], [ 81, 83 ], [ 85 ], [ 87, 89 ], [ 91, 93 ], [ 95 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ] ]
7,451
static void breakpoint_handler(CPUX86State *env) { CPUBreakpoint *bp; if (env->watchpoint_hit) { if (env->watchpoint_hit->flags & BP_CPU) { env->watchpoint_hit = NULL; if (check_hw_breakpoints(env, 0)) raise_exception_env(EXCP01_DB, env); else cpu_resume_from_signal(env, NULL); } } else { QTAILQ_FOREACH(bp, &env->breakpoints, entry) if (bp->pc == env->eip) { if (bp->flags & BP_CPU) { check_hw_breakpoints(env, 1); raise_exception_env(EXCP01_DB, env); } break; } } if (prev_debug_excp_handler) prev_debug_excp_handler(env); }
false
qemu
130a03855098a4057c227bc658c0688f8665b71f
static void breakpoint_handler(CPUX86State *env) { CPUBreakpoint *bp; if (env->watchpoint_hit) { if (env->watchpoint_hit->flags & BP_CPU) { env->watchpoint_hit = NULL; if (check_hw_breakpoints(env, 0)) raise_exception_env(EXCP01_DB, env); else cpu_resume_from_signal(env, NULL); } } else { QTAILQ_FOREACH(bp, &env->breakpoints, entry) if (bp->pc == env->eip) { if (bp->flags & BP_CPU) { check_hw_breakpoints(env, 1); raise_exception_env(EXCP01_DB, env); } break; } } if (prev_debug_excp_handler) prev_debug_excp_handler(env); }
{ "code": [], "line_no": [] }
static void FUNC_0(CPUX86State *VAR_0) { CPUBreakpoint *bp; if (VAR_0->watchpoint_hit) { if (VAR_0->watchpoint_hit->flags & BP_CPU) { VAR_0->watchpoint_hit = NULL; if (check_hw_breakpoints(VAR_0, 0)) raise_exception_env(EXCP01_DB, VAR_0); else cpu_resume_from_signal(VAR_0, NULL); } } else { QTAILQ_FOREACH(bp, &VAR_0->breakpoints, entry) if (bp->pc == VAR_0->eip) { if (bp->flags & BP_CPU) { check_hw_breakpoints(VAR_0, 1); raise_exception_env(EXCP01_DB, VAR_0); } break; } } if (prev_debug_excp_handler) prev_debug_excp_handler(VAR_0); }
[ "static void FUNC_0(CPUX86State *VAR_0)\n{", "CPUBreakpoint *bp;", "if (VAR_0->watchpoint_hit) {", "if (VAR_0->watchpoint_hit->flags & BP_CPU) {", "VAR_0->watchpoint_hit = NULL;", "if (check_hw_breakpoints(VAR_0, 0))\nraise_exception_env(EXCP01_DB, VAR_0);", "else\ncpu_resume_from_signal(VAR_0, NULL);", "}", "} else {", "QTAILQ_FOREACH(bp, &VAR_0->breakpoints, entry)\nif (bp->pc == VAR_0->eip) {", "if (bp->flags & BP_CPU) {", "check_hw_breakpoints(VAR_0, 1);", "raise_exception_env(EXCP01_DB, VAR_0);", "}", "break;", "}", "}", "if (prev_debug_excp_handler)\nprev_debug_excp_handler(VAR_0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15, 17 ], [ 19, 21 ], [ 23 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45, 47 ], [ 49 ] ]
7,452
int usb_desc_msos(const USBDesc *desc, USBPacket *p, int index, uint8_t *dest, size_t len) { void *buf = g_malloc0(4096); int length = 0; switch (index) { case 0x0004: length = usb_desc_msos_compat(desc, buf); break; case 0x0005: length = usb_desc_msos_prop(desc, buf); break; } if (length > len) { length = len; } memcpy(dest, buf, length); free(buf); p->actual_length = length; return 0; }
false
qemu
0c6f807f4a98e7e258765dcf22619a582995fce0
int usb_desc_msos(const USBDesc *desc, USBPacket *p, int index, uint8_t *dest, size_t len) { void *buf = g_malloc0(4096); int length = 0; switch (index) { case 0x0004: length = usb_desc_msos_compat(desc, buf); break; case 0x0005: length = usb_desc_msos_prop(desc, buf); break; } if (length > len) { length = len; } memcpy(dest, buf, length); free(buf); p->actual_length = length; return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(const USBDesc *VAR_0, USBPacket *VAR_1, int VAR_2, uint8_t *VAR_3, size_t VAR_4) { void *VAR_5 = g_malloc0(4096); int VAR_6 = 0; switch (VAR_2) { case 0x0004: VAR_6 = usb_desc_msos_compat(VAR_0, VAR_5); break; case 0x0005: VAR_6 = usb_desc_msos_prop(VAR_0, VAR_5); break; } if (VAR_6 > VAR_4) { VAR_6 = VAR_4; } memcpy(VAR_3, VAR_5, VAR_6); free(VAR_5); VAR_1->actual_length = VAR_6; return 0; }
[ "int FUNC_0(const USBDesc *VAR_0, USBPacket *VAR_1,\nint VAR_2, uint8_t *VAR_3, size_t VAR_4)\n{", "void *VAR_5 = g_malloc0(4096);", "int VAR_6 = 0;", "switch (VAR_2) {", "case 0x0004:\nVAR_6 = usb_desc_msos_compat(VAR_0, VAR_5);", "break;", "case 0x0005:\nVAR_6 = usb_desc_msos_prop(VAR_0, VAR_5);", "break;", "}", "if (VAR_6 > VAR_4) {", "VAR_6 = VAR_4;", "}", "memcpy(VAR_3, VAR_5, VAR_6);", "free(VAR_5);", "VAR_1->actual_length = VAR_6;", "return 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 ], [ 43 ], [ 45 ], [ 47 ] ]
7,453
static void qemu_chr_parse_udp(QemuOpts *opts, ChardevBackend *backend, Error **errp) { const char *host = qemu_opt_get(opts, "host"); const char *port = qemu_opt_get(opts, "port"); const char *localaddr = qemu_opt_get(opts, "localaddr"); const char *localport = qemu_opt_get(opts, "localport"); bool has_local = false; SocketAddress *addr; if (host == NULL || strlen(host) == 0) { host = "localhost"; } if (port == NULL || strlen(port) == 0) { error_setg(errp, "chardev: udp: remote port not specified"); return; } if (localport == NULL || strlen(localport) == 0) { localport = "0"; } else { has_local = true; } if (localaddr == NULL || strlen(localaddr) == 0) { localaddr = ""; } else { has_local = true; } backend->udp = g_new0(ChardevUdp, 1); addr = g_new0(SocketAddress, 1); addr->kind = SOCKET_ADDRESS_KIND_INET; addr->inet = g_new0(InetSocketAddress, 1); addr->inet->host = g_strdup(host); addr->inet->port = g_strdup(port); addr->inet->has_ipv4 = qemu_opt_get(opts, "ipv4"); addr->inet->ipv4 = qemu_opt_get_bool(opts, "ipv4", 0); addr->inet->has_ipv6 = qemu_opt_get(opts, "ipv6"); addr->inet->ipv6 = qemu_opt_get_bool(opts, "ipv6", 0); backend->udp->remote = addr; if (has_local) { backend->udp->has_local = true; addr = g_new0(SocketAddress, 1); addr->kind = SOCKET_ADDRESS_KIND_INET; addr->inet = g_new0(InetSocketAddress, 1); addr->inet->host = g_strdup(localaddr); addr->inet->port = g_strdup(localport); backend->udp->local = addr; } }
false
qemu
130257dc443574a9da91dc293665be2cfc40245a
static void qemu_chr_parse_udp(QemuOpts *opts, ChardevBackend *backend, Error **errp) { const char *host = qemu_opt_get(opts, "host"); const char *port = qemu_opt_get(opts, "port"); const char *localaddr = qemu_opt_get(opts, "localaddr"); const char *localport = qemu_opt_get(opts, "localport"); bool has_local = false; SocketAddress *addr; if (host == NULL || strlen(host) == 0) { host = "localhost"; } if (port == NULL || strlen(port) == 0) { error_setg(errp, "chardev: udp: remote port not specified"); return; } if (localport == NULL || strlen(localport) == 0) { localport = "0"; } else { has_local = true; } if (localaddr == NULL || strlen(localaddr) == 0) { localaddr = ""; } else { has_local = true; } backend->udp = g_new0(ChardevUdp, 1); addr = g_new0(SocketAddress, 1); addr->kind = SOCKET_ADDRESS_KIND_INET; addr->inet = g_new0(InetSocketAddress, 1); addr->inet->host = g_strdup(host); addr->inet->port = g_strdup(port); addr->inet->has_ipv4 = qemu_opt_get(opts, "ipv4"); addr->inet->ipv4 = qemu_opt_get_bool(opts, "ipv4", 0); addr->inet->has_ipv6 = qemu_opt_get(opts, "ipv6"); addr->inet->ipv6 = qemu_opt_get_bool(opts, "ipv6", 0); backend->udp->remote = addr; if (has_local) { backend->udp->has_local = true; addr = g_new0(SocketAddress, 1); addr->kind = SOCKET_ADDRESS_KIND_INET; addr->inet = g_new0(InetSocketAddress, 1); addr->inet->host = g_strdup(localaddr); addr->inet->port = g_strdup(localport); backend->udp->local = addr; } }
{ "code": [], "line_no": [] }
static void FUNC_0(QemuOpts *VAR_0, ChardevBackend *VAR_1, Error **VAR_2) { const char *VAR_3 = qemu_opt_get(VAR_0, "VAR_3"); const char *VAR_4 = qemu_opt_get(VAR_0, "VAR_4"); const char *VAR_5 = qemu_opt_get(VAR_0, "VAR_5"); const char *VAR_6 = qemu_opt_get(VAR_0, "VAR_6"); bool has_local = false; SocketAddress *addr; if (VAR_3 == NULL || strlen(VAR_3) == 0) { VAR_3 = "localhost"; } if (VAR_4 == NULL || strlen(VAR_4) == 0) { error_setg(VAR_2, "chardev: udp: remote VAR_4 not specified"); return; } if (VAR_6 == NULL || strlen(VAR_6) == 0) { VAR_6 = "0"; } else { has_local = true; } if (VAR_5 == NULL || strlen(VAR_5) == 0) { VAR_5 = ""; } else { has_local = true; } VAR_1->udp = g_new0(ChardevUdp, 1); addr = g_new0(SocketAddress, 1); addr->kind = SOCKET_ADDRESS_KIND_INET; addr->inet = g_new0(InetSocketAddress, 1); addr->inet->VAR_3 = g_strdup(VAR_3); addr->inet->VAR_4 = g_strdup(VAR_4); addr->inet->has_ipv4 = qemu_opt_get(VAR_0, "ipv4"); addr->inet->ipv4 = qemu_opt_get_bool(VAR_0, "ipv4", 0); addr->inet->has_ipv6 = qemu_opt_get(VAR_0, "ipv6"); addr->inet->ipv6 = qemu_opt_get_bool(VAR_0, "ipv6", 0); VAR_1->udp->remote = addr; if (has_local) { VAR_1->udp->has_local = true; addr = g_new0(SocketAddress, 1); addr->kind = SOCKET_ADDRESS_KIND_INET; addr->inet = g_new0(InetSocketAddress, 1); addr->inet->VAR_3 = g_strdup(VAR_5); addr->inet->VAR_4 = g_strdup(VAR_6); VAR_1->udp->local = addr; } }
[ "static void FUNC_0(QemuOpts *VAR_0, ChardevBackend *VAR_1,\nError **VAR_2)\n{", "const char *VAR_3 = qemu_opt_get(VAR_0, \"VAR_3\");", "const char *VAR_4 = qemu_opt_get(VAR_0, \"VAR_4\");", "const char *VAR_5 = qemu_opt_get(VAR_0, \"VAR_5\");", "const char *VAR_6 = qemu_opt_get(VAR_0, \"VAR_6\");", "bool has_local = false;", "SocketAddress *addr;", "if (VAR_3 == NULL || strlen(VAR_3) == 0) {", "VAR_3 = \"localhost\";", "}", "if (VAR_4 == NULL || strlen(VAR_4) == 0) {", "error_setg(VAR_2, \"chardev: udp: remote VAR_4 not specified\");", "return;", "}", "if (VAR_6 == NULL || strlen(VAR_6) == 0) {", "VAR_6 = \"0\";", "} else {", "has_local = true;", "}", "if (VAR_5 == NULL || strlen(VAR_5) == 0) {", "VAR_5 = \"\";", "} else {", "has_local = true;", "}", "VAR_1->udp = g_new0(ChardevUdp, 1);", "addr = g_new0(SocketAddress, 1);", "addr->kind = SOCKET_ADDRESS_KIND_INET;", "addr->inet = g_new0(InetSocketAddress, 1);", "addr->inet->VAR_3 = g_strdup(VAR_3);", "addr->inet->VAR_4 = g_strdup(VAR_4);", "addr->inet->has_ipv4 = qemu_opt_get(VAR_0, \"ipv4\");", "addr->inet->ipv4 = qemu_opt_get_bool(VAR_0, \"ipv4\", 0);", "addr->inet->has_ipv6 = qemu_opt_get(VAR_0, \"ipv6\");", "addr->inet->ipv6 = qemu_opt_get_bool(VAR_0, \"ipv6\", 0);", "VAR_1->udp->remote = addr;", "if (has_local) {", "VAR_1->udp->has_local = true;", "addr = g_new0(SocketAddress, 1);", "addr->kind = SOCKET_ADDRESS_KIND_INET;", "addr->inet = g_new0(InetSocketAddress, 1);", "addr->inet->VAR_3 = g_strdup(VAR_5);", "addr->inet->VAR_4 = g_strdup(VAR_6);", "VAR_1->udp->local = addr;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ] ]
7,454
static int read_write_object(int fd, char *buf, uint64_t oid, int copies, unsigned int datalen, uint64_t offset, bool write, bool create, bool cache) { SheepdogObjReq hdr; SheepdogObjRsp *rsp = (SheepdogObjRsp *)&hdr; unsigned int wlen, rlen; int ret; memset(&hdr, 0, sizeof(hdr)); if (write) { wlen = datalen; rlen = 0; hdr.flags = SD_FLAG_CMD_WRITE; if (create) { hdr.opcode = SD_OP_CREATE_AND_WRITE_OBJ; } else { hdr.opcode = SD_OP_WRITE_OBJ; } } else { wlen = 0; rlen = datalen; hdr.opcode = SD_OP_READ_OBJ; } if (cache) { hdr.flags |= SD_FLAG_CMD_CACHE; } hdr.oid = oid; hdr.data_length = datalen; hdr.offset = offset; hdr.copies = copies; ret = do_req(fd, (SheepdogReq *)&hdr, buf, &wlen, &rlen); if (ret) { error_report("failed to send a request to the sheep"); return ret; } switch (rsp->result) { case SD_RES_SUCCESS: return 0; default: error_report("%s", sd_strerror(rsp->result)); return -EIO; } }
false
qemu
0e7106d8b5f7ef4f9df10baf1dfb3db482bcd046
static int read_write_object(int fd, char *buf, uint64_t oid, int copies, unsigned int datalen, uint64_t offset, bool write, bool create, bool cache) { SheepdogObjReq hdr; SheepdogObjRsp *rsp = (SheepdogObjRsp *)&hdr; unsigned int wlen, rlen; int ret; memset(&hdr, 0, sizeof(hdr)); if (write) { wlen = datalen; rlen = 0; hdr.flags = SD_FLAG_CMD_WRITE; if (create) { hdr.opcode = SD_OP_CREATE_AND_WRITE_OBJ; } else { hdr.opcode = SD_OP_WRITE_OBJ; } } else { wlen = 0; rlen = datalen; hdr.opcode = SD_OP_READ_OBJ; } if (cache) { hdr.flags |= SD_FLAG_CMD_CACHE; } hdr.oid = oid; hdr.data_length = datalen; hdr.offset = offset; hdr.copies = copies; ret = do_req(fd, (SheepdogReq *)&hdr, buf, &wlen, &rlen); if (ret) { error_report("failed to send a request to the sheep"); return ret; } switch (rsp->result) { case SD_RES_SUCCESS: return 0; default: error_report("%s", sd_strerror(rsp->result)); return -EIO; } }
{ "code": [], "line_no": [] }
static int FUNC_0(int VAR_0, char *VAR_1, uint64_t VAR_2, int VAR_3, unsigned int VAR_4, uint64_t VAR_5, bool VAR_6, bool VAR_7, bool VAR_8) { SheepdogObjReq hdr; SheepdogObjRsp *rsp = (SheepdogObjRsp *)&hdr; unsigned int VAR_9, VAR_10; int VAR_11; memset(&hdr, 0, sizeof(hdr)); if (VAR_6) { VAR_9 = VAR_4; VAR_10 = 0; hdr.flags = SD_FLAG_CMD_WRITE; if (VAR_7) { hdr.opcode = SD_OP_CREATE_AND_WRITE_OBJ; } else { hdr.opcode = SD_OP_WRITE_OBJ; } } else { VAR_9 = 0; VAR_10 = VAR_4; hdr.opcode = SD_OP_READ_OBJ; } if (VAR_8) { hdr.flags |= SD_FLAG_CMD_CACHE; } hdr.VAR_2 = VAR_2; hdr.data_length = VAR_4; hdr.VAR_5 = VAR_5; hdr.VAR_3 = VAR_3; VAR_11 = do_req(VAR_0, (SheepdogReq *)&hdr, VAR_1, &VAR_9, &VAR_10); if (VAR_11) { error_report("failed to send a request to the sheep"); return VAR_11; } switch (rsp->result) { case SD_RES_SUCCESS: return 0; default: error_report("%s", sd_strerror(rsp->result)); return -EIO; } }
[ "static int FUNC_0(int VAR_0, char *VAR_1, uint64_t VAR_2, int VAR_3,\nunsigned int VAR_4, uint64_t VAR_5,\nbool VAR_6, bool VAR_7, bool VAR_8)\n{", "SheepdogObjReq hdr;", "SheepdogObjRsp *rsp = (SheepdogObjRsp *)&hdr;", "unsigned int VAR_9, VAR_10;", "int VAR_11;", "memset(&hdr, 0, sizeof(hdr));", "if (VAR_6) {", "VAR_9 = VAR_4;", "VAR_10 = 0;", "hdr.flags = SD_FLAG_CMD_WRITE;", "if (VAR_7) {", "hdr.opcode = SD_OP_CREATE_AND_WRITE_OBJ;", "} else {", "hdr.opcode = SD_OP_WRITE_OBJ;", "}", "} else {", "VAR_9 = 0;", "VAR_10 = VAR_4;", "hdr.opcode = SD_OP_READ_OBJ;", "}", "if (VAR_8) {", "hdr.flags |= SD_FLAG_CMD_CACHE;", "}", "hdr.VAR_2 = VAR_2;", "hdr.data_length = VAR_4;", "hdr.VAR_5 = VAR_5;", "hdr.VAR_3 = VAR_3;", "VAR_11 = do_req(VAR_0, (SheepdogReq *)&hdr, VAR_1, &VAR_9, &VAR_10);", "if (VAR_11) {", "error_report(\"failed to send a request to the sheep\");", "return VAR_11;", "}", "switch (rsp->result) {", "case SD_RES_SUCCESS:\nreturn 0;", "default:\nerror_report(\"%s\", sd_strerror(rsp->result));", "return -EIO;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 85, 87 ], [ 89, 91 ], [ 93 ], [ 95 ], [ 97 ] ]
7,455
static void vtd_do_iommu_translate(IntelIOMMUState *s, uint8_t bus_num, uint8_t devfn, hwaddr addr, bool is_write, IOMMUTLBEntry *entry) { VTDContextEntry ce; uint64_t slpte; uint32_t level; uint16_t source_id = vtd_make_source_id(bus_num, devfn); int ret_fr; bool is_fpd_set = false; bool reads = true; bool writes = true; /* Check if the request is in interrupt address range */ if (vtd_is_interrupt_addr(addr)) { if (is_write) { /* FIXME: since we don't know the length of the access here, we * treat Non-DWORD length write requests without PASID as * interrupt requests, too. Withoud interrupt remapping support, * we just use 1:1 mapping. */ VTD_DPRINTF(MMU, "write request to interrupt address " "gpa 0x%"PRIx64, addr); entry->iova = addr & VTD_PAGE_MASK_4K; entry->translated_addr = addr & VTD_PAGE_MASK_4K; entry->addr_mask = ~VTD_PAGE_MASK_4K; entry->perm = IOMMU_WO; return; } else { VTD_DPRINTF(GENERAL, "error: read request from interrupt address " "gpa 0x%"PRIx64, addr); vtd_report_dmar_fault(s, source_id, addr, VTD_FR_READ, is_write); return; } } ret_fr = vtd_dev_to_context_entry(s, bus_num, devfn, &ce); is_fpd_set = ce.lo & VTD_CONTEXT_ENTRY_FPD; if (ret_fr) { ret_fr = -ret_fr; if (is_fpd_set && vtd_is_qualified_fault(ret_fr)) { VTD_DPRINTF(FLOG, "fault processing is disabled for DMA requests " "through this context-entry (with FPD Set)"); } else { vtd_report_dmar_fault(s, source_id, addr, ret_fr, is_write); } return; } ret_fr = vtd_gpa_to_slpte(&ce, addr, is_write, &slpte, &level, &reads, &writes); if (ret_fr) { ret_fr = -ret_fr; if (is_fpd_set && vtd_is_qualified_fault(ret_fr)) { VTD_DPRINTF(FLOG, "fault processing is disabled for DMA requests " "through this context-entry (with FPD Set)"); } else { vtd_report_dmar_fault(s, source_id, addr, ret_fr, is_write); } return; } entry->iova = addr & VTD_PAGE_MASK_4K; entry->translated_addr = vtd_get_slpte_addr(slpte) & VTD_PAGE_MASK_4K; entry->addr_mask = ~VTD_PAGE_MASK_4K; entry->perm = (writes ? 2 : 0) + (reads ? 1 : 0); }
false
qemu
d92fa2dc6e42e8bd8470e69d85141176f98feaea
static void vtd_do_iommu_translate(IntelIOMMUState *s, uint8_t bus_num, uint8_t devfn, hwaddr addr, bool is_write, IOMMUTLBEntry *entry) { VTDContextEntry ce; uint64_t slpte; uint32_t level; uint16_t source_id = vtd_make_source_id(bus_num, devfn); int ret_fr; bool is_fpd_set = false; bool reads = true; bool writes = true; if (vtd_is_interrupt_addr(addr)) { if (is_write) { VTD_DPRINTF(MMU, "write request to interrupt address " "gpa 0x%"PRIx64, addr); entry->iova = addr & VTD_PAGE_MASK_4K; entry->translated_addr = addr & VTD_PAGE_MASK_4K; entry->addr_mask = ~VTD_PAGE_MASK_4K; entry->perm = IOMMU_WO; return; } else { VTD_DPRINTF(GENERAL, "error: read request from interrupt address " "gpa 0x%"PRIx64, addr); vtd_report_dmar_fault(s, source_id, addr, VTD_FR_READ, is_write); return; } } ret_fr = vtd_dev_to_context_entry(s, bus_num, devfn, &ce); is_fpd_set = ce.lo & VTD_CONTEXT_ENTRY_FPD; if (ret_fr) { ret_fr = -ret_fr; if (is_fpd_set && vtd_is_qualified_fault(ret_fr)) { VTD_DPRINTF(FLOG, "fault processing is disabled for DMA requests " "through this context-entry (with FPD Set)"); } else { vtd_report_dmar_fault(s, source_id, addr, ret_fr, is_write); } return; } ret_fr = vtd_gpa_to_slpte(&ce, addr, is_write, &slpte, &level, &reads, &writes); if (ret_fr) { ret_fr = -ret_fr; if (is_fpd_set && vtd_is_qualified_fault(ret_fr)) { VTD_DPRINTF(FLOG, "fault processing is disabled for DMA requests " "through this context-entry (with FPD Set)"); } else { vtd_report_dmar_fault(s, source_id, addr, ret_fr, is_write); } return; } entry->iova = addr & VTD_PAGE_MASK_4K; entry->translated_addr = vtd_get_slpte_addr(slpte) & VTD_PAGE_MASK_4K; entry->addr_mask = ~VTD_PAGE_MASK_4K; entry->perm = (writes ? 2 : 0) + (reads ? 1 : 0); }
{ "code": [], "line_no": [] }
static void FUNC_0(IntelIOMMUState *VAR_0, uint8_t VAR_1, uint8_t VAR_2, hwaddr VAR_3, bool VAR_4, IOMMUTLBEntry *VAR_5) { VTDContextEntry ce; uint64_t slpte; uint32_t level; uint16_t source_id = vtd_make_source_id(VAR_1, VAR_2); int VAR_6; bool is_fpd_set = false; bool reads = true; bool writes = true; if (vtd_is_interrupt_addr(VAR_3)) { if (VAR_4) { VTD_DPRINTF(MMU, "write request to interrupt address " "gpa 0x%"PRIx64, VAR_3); VAR_5->iova = VAR_3 & VTD_PAGE_MASK_4K; VAR_5->translated_addr = VAR_3 & VTD_PAGE_MASK_4K; VAR_5->addr_mask = ~VTD_PAGE_MASK_4K; VAR_5->perm = IOMMU_WO; return; } else { VTD_DPRINTF(GENERAL, "error: read request from interrupt address " "gpa 0x%"PRIx64, VAR_3); vtd_report_dmar_fault(VAR_0, source_id, VAR_3, VTD_FR_READ, VAR_4); return; } } VAR_6 = vtd_dev_to_context_entry(VAR_0, VAR_1, VAR_2, &ce); is_fpd_set = ce.lo & VTD_CONTEXT_ENTRY_FPD; if (VAR_6) { VAR_6 = -VAR_6; if (is_fpd_set && vtd_is_qualified_fault(VAR_6)) { VTD_DPRINTF(FLOG, "fault processing is disabled for DMA requests " "through this context-VAR_5 (with FPD Set)"); } else { vtd_report_dmar_fault(VAR_0, source_id, VAR_3, VAR_6, VAR_4); } return; } VAR_6 = vtd_gpa_to_slpte(&ce, VAR_3, VAR_4, &slpte, &level, &reads, &writes); if (VAR_6) { VAR_6 = -VAR_6; if (is_fpd_set && vtd_is_qualified_fault(VAR_6)) { VTD_DPRINTF(FLOG, "fault processing is disabled for DMA requests " "through this context-VAR_5 (with FPD Set)"); } else { vtd_report_dmar_fault(VAR_0, source_id, VAR_3, VAR_6, VAR_4); } return; } VAR_5->iova = VAR_3 & VTD_PAGE_MASK_4K; VAR_5->translated_addr = vtd_get_slpte_addr(slpte) & VTD_PAGE_MASK_4K; VAR_5->addr_mask = ~VTD_PAGE_MASK_4K; VAR_5->perm = (writes ? 2 : 0) + (reads ? 1 : 0); }
[ "static void FUNC_0(IntelIOMMUState *VAR_0, uint8_t VAR_1,\nuint8_t VAR_2, hwaddr VAR_3, bool VAR_4,\nIOMMUTLBEntry *VAR_5)\n{", "VTDContextEntry ce;", "uint64_t slpte;", "uint32_t level;", "uint16_t source_id = vtd_make_source_id(VAR_1, VAR_2);", "int VAR_6;", "bool is_fpd_set = false;", "bool reads = true;", "bool writes = true;", "if (vtd_is_interrupt_addr(VAR_3)) {", "if (VAR_4) {", "VTD_DPRINTF(MMU, \"write request to interrupt address \"\n\"gpa 0x%\"PRIx64, VAR_3);", "VAR_5->iova = VAR_3 & VTD_PAGE_MASK_4K;", "VAR_5->translated_addr = VAR_3 & VTD_PAGE_MASK_4K;", "VAR_5->addr_mask = ~VTD_PAGE_MASK_4K;", "VAR_5->perm = IOMMU_WO;", "return;", "} else {", "VTD_DPRINTF(GENERAL, \"error: read request from interrupt address \"\n\"gpa 0x%\"PRIx64, VAR_3);", "vtd_report_dmar_fault(VAR_0, source_id, VAR_3, VTD_FR_READ, VAR_4);", "return;", "}", "}", "VAR_6 = vtd_dev_to_context_entry(VAR_0, VAR_1, VAR_2, &ce);", "is_fpd_set = ce.lo & VTD_CONTEXT_ENTRY_FPD;", "if (VAR_6) {", "VAR_6 = -VAR_6;", "if (is_fpd_set && vtd_is_qualified_fault(VAR_6)) {", "VTD_DPRINTF(FLOG, \"fault processing is disabled for DMA requests \"\n\"through this context-VAR_5 (with FPD Set)\");", "} else {", "vtd_report_dmar_fault(VAR_0, source_id, VAR_3, VAR_6, VAR_4);", "}", "return;", "}", "VAR_6 = vtd_gpa_to_slpte(&ce, VAR_3, VAR_4, &slpte, &level,\n&reads, &writes);", "if (VAR_6) {", "VAR_6 = -VAR_6;", "if (is_fpd_set && vtd_is_qualified_fault(VAR_6)) {", "VTD_DPRINTF(FLOG, \"fault processing is disabled for DMA requests \"\n\"through this context-VAR_5 (with FPD Set)\");", "} else {", "vtd_report_dmar_fault(VAR_0, source_id, VAR_3, VAR_6, VAR_4);", "}", "return;", "}", "VAR_5->iova = VAR_3 & VTD_PAGE_MASK_4K;", "VAR_5->translated_addr = vtd_get_slpte_addr(slpte) & VTD_PAGE_MASK_4K;", "VAR_5->addr_mask = ~VTD_PAGE_MASK_4K;", "VAR_5->perm = (writes ? 2 : 0) + (reads ? 1 : 0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 29 ], [ 31 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59, 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83, 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99, 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109, 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ] ]
7,456
bool qht_reset_size(struct qht *ht, size_t n_elems) { struct qht_map *new; struct qht_map *map; size_t n_buckets; bool resize = false; n_buckets = qht_elems_to_buckets(n_elems); qemu_mutex_lock(&ht->lock); map = ht->map; if (n_buckets != map->n_buckets) { new = qht_map_create(n_buckets); resize = true; } qht_map_lock_buckets(map); qht_map_reset__all_locked(map); if (resize) { qht_do_resize(ht, new); } qht_map_unlock_buckets(map); qemu_mutex_unlock(&ht->lock); return resize; }
false
qemu
f555a9d0b3c785b698f32e6879e97d0a4b387314
bool qht_reset_size(struct qht *ht, size_t n_elems) { struct qht_map *new; struct qht_map *map; size_t n_buckets; bool resize = false; n_buckets = qht_elems_to_buckets(n_elems); qemu_mutex_lock(&ht->lock); map = ht->map; if (n_buckets != map->n_buckets) { new = qht_map_create(n_buckets); resize = true; } qht_map_lock_buckets(map); qht_map_reset__all_locked(map); if (resize) { qht_do_resize(ht, new); } qht_map_unlock_buckets(map); qemu_mutex_unlock(&ht->lock); return resize; }
{ "code": [], "line_no": [] }
bool FUNC_0(struct qht *ht, size_t n_elems) { struct qht_map *VAR_0; struct qht_map *VAR_1; size_t n_buckets; bool resize = false; n_buckets = qht_elems_to_buckets(n_elems); qemu_mutex_lock(&ht->lock); VAR_1 = ht->VAR_1; if (n_buckets != VAR_1->n_buckets) { VAR_0 = qht_map_create(n_buckets); resize = true; } qht_map_lock_buckets(VAR_1); qht_map_reset__all_locked(VAR_1); if (resize) { qht_do_resize(ht, VAR_0); } qht_map_unlock_buckets(VAR_1); qemu_mutex_unlock(&ht->lock); return resize; }
[ "bool FUNC_0(struct qht *ht, size_t n_elems)\n{", "struct qht_map *VAR_0;", "struct qht_map *VAR_1;", "size_t n_buckets;", "bool resize = false;", "n_buckets = qht_elems_to_buckets(n_elems);", "qemu_mutex_lock(&ht->lock);", "VAR_1 = ht->VAR_1;", "if (n_buckets != VAR_1->n_buckets) {", "VAR_0 = qht_map_create(n_buckets);", "resize = true;", "}", "qht_map_lock_buckets(VAR_1);", "qht_map_reset__all_locked(VAR_1);", "if (resize) {", "qht_do_resize(ht, VAR_0);", "}", "qht_map_unlock_buckets(VAR_1);", "qemu_mutex_unlock(&ht->lock);", "return resize;", "}" ]
[ 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 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ] ]
7,457
ssize_t v9fs_list_xattr(FsContext *ctx, const char *path, void *value, size_t vsize) { ssize_t size = 0; char buffer[PATH_MAX]; void *ovalue = value; XattrOperations *xops; char *orig_value, *orig_value_start; ssize_t xattr_len, parsed_len = 0, attr_len; /* Get the actual len */ xattr_len = llistxattr(rpath(ctx, path, buffer), value, 0); if (xattr_len <= 0) { return xattr_len; } /* Now fetch the xattr and find the actual size */ orig_value = g_malloc(xattr_len); xattr_len = llistxattr(rpath(ctx, path, buffer), orig_value, xattr_len); /* store the orig pointer */ orig_value_start = orig_value; while (xattr_len > parsed_len) { xops = get_xattr_operations(ctx->xops, orig_value); if (!xops) { goto next_entry; } if (!value) { size += xops->listxattr(ctx, path, orig_value, value, vsize); } else { size = xops->listxattr(ctx, path, orig_value, value, vsize); if (size < 0) { goto err_out; } value += size; vsize -= size; } next_entry: /* Got the next entry */ attr_len = strlen(orig_value) + 1; parsed_len += attr_len; orig_value += attr_len; } if (value) { size = value - ovalue; } err_out: g_free(orig_value_start); return size; }
false
qemu
4fa4ce7107c6ec432f185307158c5df91ce54308
ssize_t v9fs_list_xattr(FsContext *ctx, const char *path, void *value, size_t vsize) { ssize_t size = 0; char buffer[PATH_MAX]; void *ovalue = value; XattrOperations *xops; char *orig_value, *orig_value_start; ssize_t xattr_len, parsed_len = 0, attr_len; xattr_len = llistxattr(rpath(ctx, path, buffer), value, 0); if (xattr_len <= 0) { return xattr_len; } orig_value = g_malloc(xattr_len); xattr_len = llistxattr(rpath(ctx, path, buffer), orig_value, xattr_len); orig_value_start = orig_value; while (xattr_len > parsed_len) { xops = get_xattr_operations(ctx->xops, orig_value); if (!xops) { goto next_entry; } if (!value) { size += xops->listxattr(ctx, path, orig_value, value, vsize); } else { size = xops->listxattr(ctx, path, orig_value, value, vsize); if (size < 0) { goto err_out; } value += size; vsize -= size; } next_entry: attr_len = strlen(orig_value) + 1; parsed_len += attr_len; orig_value += attr_len; } if (value) { size = value - ovalue; } err_out: g_free(orig_value_start); return size; }
{ "code": [], "line_no": [] }
ssize_t FUNC_0(FsContext *ctx, const char *path, void *value, size_t vsize) { ssize_t size = 0; char VAR_0[PATH_MAX]; void *VAR_1 = value; XattrOperations *xops; char *VAR_2, *VAR_3; ssize_t xattr_len, parsed_len = 0, attr_len; xattr_len = llistxattr(rpath(ctx, path, VAR_0), value, 0); if (xattr_len <= 0) { return xattr_len; } VAR_2 = g_malloc(xattr_len); xattr_len = llistxattr(rpath(ctx, path, VAR_0), VAR_2, xattr_len); VAR_3 = VAR_2; while (xattr_len > parsed_len) { xops = get_xattr_operations(ctx->xops, VAR_2); if (!xops) { goto next_entry; } if (!value) { size += xops->listxattr(ctx, path, VAR_2, value, vsize); } else { size = xops->listxattr(ctx, path, VAR_2, value, vsize); if (size < 0) { goto err_out; } value += size; vsize -= size; } next_entry: attr_len = strlen(VAR_2) + 1; parsed_len += attr_len; VAR_2 += attr_len; } if (value) { size = value - VAR_1; } err_out: g_free(VAR_3); return size; }
[ "ssize_t FUNC_0(FsContext *ctx, const char *path,\nvoid *value, size_t vsize)\n{", "ssize_t size = 0;", "char VAR_0[PATH_MAX];", "void *VAR_1 = value;", "XattrOperations *xops;", "char *VAR_2, *VAR_3;", "ssize_t xattr_len, parsed_len = 0, attr_len;", "xattr_len = llistxattr(rpath(ctx, path, VAR_0), value, 0);", "if (xattr_len <= 0) {", "return xattr_len;", "}", "VAR_2 = g_malloc(xattr_len);", "xattr_len = llistxattr(rpath(ctx, path, VAR_0), VAR_2, xattr_len);", "VAR_3 = VAR_2;", "while (xattr_len > parsed_len) {", "xops = get_xattr_operations(ctx->xops, VAR_2);", "if (!xops) {", "goto next_entry;", "}", "if (!value) {", "size += xops->listxattr(ctx, path, VAR_2, value, vsize);", "} else {", "size = xops->listxattr(ctx, path, VAR_2, value, vsize);", "if (size < 0) {", "goto err_out;", "}", "value += size;", "vsize -= size;", "}", "next_entry:\nattr_len = strlen(VAR_2) + 1;", "parsed_len += attr_len;", "VAR_2 += attr_len;", "}", "if (value) {", "size = value - VAR_1;", "}", "err_out:\ng_free(VAR_3);", "return 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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 35 ], [ 37 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77, 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 97, 99 ], [ 101 ], [ 103 ] ]
7,459
static int synth_superframe(AVCodecContext *ctx, float *samples, int *data_size) { WMAVoiceContext *s = ctx->priv_data; GetBitContext *gb = &s->gb, s_gb; int n, res, n_samples = 480; double lsps[MAX_FRAMES][MAX_LSPS]; const double *mean_lsf = s->lsps == 16 ? wmavoice_mean_lsf16[s->lsp_def_mode] : wmavoice_mean_lsf10[s->lsp_def_mode]; float excitation[MAX_SIGNAL_HISTORY + MAX_SFRAMESIZE + 12]; float synth[MAX_LSPS + MAX_SFRAMESIZE]; memcpy(synth, s->synth_history, s->lsps * sizeof(*synth)); memcpy(excitation, s->excitation_history, s->history_nsamples * sizeof(*excitation)); if (s->sframe_cache_size > 0) { gb = &s_gb; init_get_bits(gb, s->sframe_cache, s->sframe_cache_size); s->sframe_cache_size = 0; } if ((res = check_bits_for_superframe(gb, s)) == 1) { *data_size = 0; return 1; } /* First bit is speech/music bit, it differentiates between WMAVoice * speech samples (the actual codec) and WMAVoice music samples, which * are really WMAPro-in-WMAVoice-superframes. I've never seen those in * the wild yet. */ if (!get_bits1(gb)) { av_log_missing_feature(ctx, "WMAPro-in-WMAVoice support", 1); return -1; } /* (optional) nr. of samples in superframe; always <= 480 and >= 0 */ if (get_bits1(gb)) { if ((n_samples = get_bits(gb, 12)) > 480) { av_log(ctx, AV_LOG_ERROR, "Superframe encodes >480 samples (%d), not allowed\n", n_samples); return -1; } } /* Parse LSPs, if global for the superframe (can also be per-frame). */ if (s->has_residual_lsps) { double prev_lsps[MAX_LSPS], a1[MAX_LSPS * 2], a2[MAX_LSPS * 2]; for (n = 0; n < s->lsps; n++) prev_lsps[n] = s->prev_lsps[n] - mean_lsf[n]; if (s->lsps == 10) { dequant_lsp10r(gb, lsps[2], prev_lsps, a1, a2, s->lsp_q_mode); } else /* s->lsps == 16 */ dequant_lsp16r(gb, lsps[2], prev_lsps, a1, a2, s->lsp_q_mode); for (n = 0; n < s->lsps; n++) { lsps[0][n] = mean_lsf[n] + (a1[n] - a2[n * 2]); lsps[1][n] = mean_lsf[n] + (a1[s->lsps + n] - a2[n * 2 + 1]); lsps[2][n] += mean_lsf[n]; } for (n = 0; n < 3; n++) stabilize_lsps(lsps[n], s->lsps); } /* Parse frames, optionally preceeded by per-frame (independent) LSPs. */ for (n = 0; n < 3; n++) { if (!s->has_residual_lsps) { int m; if (s->lsps == 10) { dequant_lsp10i(gb, lsps[n]); } else /* s->lsps == 16 */ dequant_lsp16i(gb, lsps[n]); for (m = 0; m < s->lsps; m++) lsps[n][m] += mean_lsf[m]; stabilize_lsps(lsps[n], s->lsps); } if ((res = synth_frame(ctx, gb, n, &samples[n * MAX_FRAMESIZE], lsps[n], n == 0 ? s->prev_lsps : lsps[n - 1], &excitation[s->history_nsamples + n * MAX_FRAMESIZE], &synth[s->lsps + n * MAX_FRAMESIZE]))) { *data_size = 0; return res; } } /* Statistics? FIXME - we don't check for length, a slight overrun * will be caught by internal buffer padding, and anything else * will be skipped, not read. */ if (get_bits1(gb)) { res = get_bits(gb, 4); skip_bits(gb, 10 * (res + 1)); } /* Specify nr. of output samples */ *data_size = n_samples * sizeof(float); /* Update history */ memcpy(s->prev_lsps, lsps[2], s->lsps * sizeof(*s->prev_lsps)); memcpy(s->synth_history, &synth[MAX_SFRAMESIZE], s->lsps * sizeof(*synth)); memcpy(s->excitation_history, &excitation[MAX_SFRAMESIZE], s->history_nsamples * sizeof(*excitation)); if (s->do_apf) memmove(s->zero_exc_pf, &s->zero_exc_pf[MAX_SFRAMESIZE], s->history_nsamples * sizeof(*s->zero_exc_pf)); return 0; }
false
FFmpeg
813907d42483279e767fc84f2d02aa088197a22d
static int synth_superframe(AVCodecContext *ctx, float *samples, int *data_size) { WMAVoiceContext *s = ctx->priv_data; GetBitContext *gb = &s->gb, s_gb; int n, res, n_samples = 480; double lsps[MAX_FRAMES][MAX_LSPS]; const double *mean_lsf = s->lsps == 16 ? wmavoice_mean_lsf16[s->lsp_def_mode] : wmavoice_mean_lsf10[s->lsp_def_mode]; float excitation[MAX_SIGNAL_HISTORY + MAX_SFRAMESIZE + 12]; float synth[MAX_LSPS + MAX_SFRAMESIZE]; memcpy(synth, s->synth_history, s->lsps * sizeof(*synth)); memcpy(excitation, s->excitation_history, s->history_nsamples * sizeof(*excitation)); if (s->sframe_cache_size > 0) { gb = &s_gb; init_get_bits(gb, s->sframe_cache, s->sframe_cache_size); s->sframe_cache_size = 0; } if ((res = check_bits_for_superframe(gb, s)) == 1) { *data_size = 0; return 1; } if (!get_bits1(gb)) { av_log_missing_feature(ctx, "WMAPro-in-WMAVoice support", 1); return -1; } if (get_bits1(gb)) { if ((n_samples = get_bits(gb, 12)) > 480) { av_log(ctx, AV_LOG_ERROR, "Superframe encodes >480 samples (%d), not allowed\n", n_samples); return -1; } } if (s->has_residual_lsps) { double prev_lsps[MAX_LSPS], a1[MAX_LSPS * 2], a2[MAX_LSPS * 2]; for (n = 0; n < s->lsps; n++) prev_lsps[n] = s->prev_lsps[n] - mean_lsf[n]; if (s->lsps == 10) { dequant_lsp10r(gb, lsps[2], prev_lsps, a1, a2, s->lsp_q_mode); } else dequant_lsp16r(gb, lsps[2], prev_lsps, a1, a2, s->lsp_q_mode); for (n = 0; n < s->lsps; n++) { lsps[0][n] = mean_lsf[n] + (a1[n] - a2[n * 2]); lsps[1][n] = mean_lsf[n] + (a1[s->lsps + n] - a2[n * 2 + 1]); lsps[2][n] += mean_lsf[n]; } for (n = 0; n < 3; n++) stabilize_lsps(lsps[n], s->lsps); } for (n = 0; n < 3; n++) { if (!s->has_residual_lsps) { int m; if (s->lsps == 10) { dequant_lsp10i(gb, lsps[n]); } else dequant_lsp16i(gb, lsps[n]); for (m = 0; m < s->lsps; m++) lsps[n][m] += mean_lsf[m]; stabilize_lsps(lsps[n], s->lsps); } if ((res = synth_frame(ctx, gb, n, &samples[n * MAX_FRAMESIZE], lsps[n], n == 0 ? s->prev_lsps : lsps[n - 1], &excitation[s->history_nsamples + n * MAX_FRAMESIZE], &synth[s->lsps + n * MAX_FRAMESIZE]))) { *data_size = 0; return res; } } if (get_bits1(gb)) { res = get_bits(gb, 4); skip_bits(gb, 10 * (res + 1)); } *data_size = n_samples * sizeof(float); memcpy(s->prev_lsps, lsps[2], s->lsps * sizeof(*s->prev_lsps)); memcpy(s->synth_history, &synth[MAX_SFRAMESIZE], s->lsps * sizeof(*synth)); memcpy(s->excitation_history, &excitation[MAX_SFRAMESIZE], s->history_nsamples * sizeof(*excitation)); if (s->do_apf) memmove(s->zero_exc_pf, &s->zero_exc_pf[MAX_SFRAMESIZE], s->history_nsamples * sizeof(*s->zero_exc_pf)); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, float *VAR_1, int *VAR_2) { WMAVoiceContext *s = VAR_0->priv_data; GetBitContext *gb = &s->gb, s_gb; int VAR_3, VAR_4, VAR_5 = 480; double VAR_6[MAX_FRAMES][MAX_LSPS]; const double *VAR_7 = s->VAR_6 == 16 ? wmavoice_mean_lsf16[s->lsp_def_mode] : wmavoice_mean_lsf10[s->lsp_def_mode]; float VAR_8[MAX_SIGNAL_HISTORY + MAX_SFRAMESIZE + 12]; float VAR_9[MAX_LSPS + MAX_SFRAMESIZE]; memcpy(VAR_9, s->synth_history, s->VAR_6 * sizeof(*VAR_9)); memcpy(VAR_8, s->excitation_history, s->history_nsamples * sizeof(*VAR_8)); if (s->sframe_cache_size > 0) { gb = &s_gb; init_get_bits(gb, s->sframe_cache, s->sframe_cache_size); s->sframe_cache_size = 0; } if ((VAR_4 = check_bits_for_superframe(gb, s)) == 1) { *VAR_2 = 0; return 1; } if (!get_bits1(gb)) { av_log_missing_feature(VAR_0, "WMAPro-in-WMAVoice support", 1); return -1; } if (get_bits1(gb)) { if ((VAR_5 = get_bits(gb, 12)) > 480) { av_log(VAR_0, AV_LOG_ERROR, "Superframe encodes >480 VAR_1 (%d), not allowed\VAR_3", VAR_5); return -1; } } if (s->has_residual_lsps) { double VAR_10[MAX_LSPS], a1[MAX_LSPS * 2], a2[MAX_LSPS * 2]; for (VAR_3 = 0; VAR_3 < s->VAR_6; VAR_3++) VAR_10[VAR_3] = s->VAR_10[VAR_3] - VAR_7[VAR_3]; if (s->VAR_6 == 10) { dequant_lsp10r(gb, VAR_6[2], VAR_10, a1, a2, s->lsp_q_mode); } else dequant_lsp16r(gb, VAR_6[2], VAR_10, a1, a2, s->lsp_q_mode); for (VAR_3 = 0; VAR_3 < s->VAR_6; VAR_3++) { VAR_6[0][VAR_3] = VAR_7[VAR_3] + (a1[VAR_3] - a2[VAR_3 * 2]); VAR_6[1][VAR_3] = VAR_7[VAR_3] + (a1[s->VAR_6 + VAR_3] - a2[VAR_3 * 2 + 1]); VAR_6[2][VAR_3] += VAR_7[VAR_3]; } for (VAR_3 = 0; VAR_3 < 3; VAR_3++) stabilize_lsps(VAR_6[VAR_3], s->VAR_6); } for (VAR_3 = 0; VAR_3 < 3; VAR_3++) { if (!s->has_residual_lsps) { int VAR_11; if (s->VAR_6 == 10) { dequant_lsp10i(gb, VAR_6[VAR_3]); } else dequant_lsp16i(gb, VAR_6[VAR_3]); for (VAR_11 = 0; VAR_11 < s->VAR_6; VAR_11++) VAR_6[VAR_3][VAR_11] += VAR_7[VAR_11]; stabilize_lsps(VAR_6[VAR_3], s->VAR_6); } if ((VAR_4 = synth_frame(VAR_0, gb, VAR_3, &VAR_1[VAR_3 * MAX_FRAMESIZE], VAR_6[VAR_3], VAR_3 == 0 ? s->VAR_10 : VAR_6[VAR_3 - 1], &VAR_8[s->history_nsamples + VAR_3 * MAX_FRAMESIZE], &VAR_9[s->VAR_6 + VAR_3 * MAX_FRAMESIZE]))) { *VAR_2 = 0; return VAR_4; } } if (get_bits1(gb)) { VAR_4 = get_bits(gb, 4); skip_bits(gb, 10 * (VAR_4 + 1)); } *VAR_2 = VAR_5 * sizeof(float); memcpy(s->VAR_10, VAR_6[2], s->VAR_6 * sizeof(*s->VAR_10)); memcpy(s->synth_history, &VAR_9[MAX_SFRAMESIZE], s->VAR_6 * sizeof(*VAR_9)); memcpy(s->excitation_history, &VAR_8[MAX_SFRAMESIZE], s->history_nsamples * sizeof(*VAR_8)); if (s->do_apf) memmove(s->zero_exc_pf, &s->zero_exc_pf[MAX_SFRAMESIZE], s->history_nsamples * sizeof(*s->zero_exc_pf)); return 0; }
[ "static int FUNC_0(AVCodecContext *VAR_0,\nfloat *VAR_1, int *VAR_2)\n{", "WMAVoiceContext *s = VAR_0->priv_data;", "GetBitContext *gb = &s->gb, s_gb;", "int VAR_3, VAR_4, VAR_5 = 480;", "double VAR_6[MAX_FRAMES][MAX_LSPS];", "const double *VAR_7 = s->VAR_6 == 16 ?\nwmavoice_mean_lsf16[s->lsp_def_mode] : wmavoice_mean_lsf10[s->lsp_def_mode];", "float VAR_8[MAX_SIGNAL_HISTORY + MAX_SFRAMESIZE + 12];", "float VAR_9[MAX_LSPS + MAX_SFRAMESIZE];", "memcpy(VAR_9, s->synth_history,\ns->VAR_6 * sizeof(*VAR_9));", "memcpy(VAR_8, s->excitation_history,\ns->history_nsamples * sizeof(*VAR_8));", "if (s->sframe_cache_size > 0) {", "gb = &s_gb;", "init_get_bits(gb, s->sframe_cache, s->sframe_cache_size);", "s->sframe_cache_size = 0;", "}", "if ((VAR_4 = check_bits_for_superframe(gb, s)) == 1) {", "*VAR_2 = 0;", "return 1;", "}", "if (!get_bits1(gb)) {", "av_log_missing_feature(VAR_0, \"WMAPro-in-WMAVoice support\", 1);", "return -1;", "}", "if (get_bits1(gb)) {", "if ((VAR_5 = get_bits(gb, 12)) > 480) {", "av_log(VAR_0, AV_LOG_ERROR,\n\"Superframe encodes >480 VAR_1 (%d), not allowed\\VAR_3\",\nVAR_5);", "return -1;", "}", "}", "if (s->has_residual_lsps) {", "double VAR_10[MAX_LSPS], a1[MAX_LSPS * 2], a2[MAX_LSPS * 2];", "for (VAR_3 = 0; VAR_3 < s->VAR_6; VAR_3++)", "VAR_10[VAR_3] = s->VAR_10[VAR_3] - VAR_7[VAR_3];", "if (s->VAR_6 == 10) {", "dequant_lsp10r(gb, VAR_6[2], VAR_10, a1, a2, s->lsp_q_mode);", "} else", "dequant_lsp16r(gb, VAR_6[2], VAR_10, a1, a2, s->lsp_q_mode);", "for (VAR_3 = 0; VAR_3 < s->VAR_6; VAR_3++) {", "VAR_6[0][VAR_3] = VAR_7[VAR_3] + (a1[VAR_3] - a2[VAR_3 * 2]);", "VAR_6[1][VAR_3] = VAR_7[VAR_3] + (a1[s->VAR_6 + VAR_3] - a2[VAR_3 * 2 + 1]);", "VAR_6[2][VAR_3] += VAR_7[VAR_3];", "}", "for (VAR_3 = 0; VAR_3 < 3; VAR_3++)", "stabilize_lsps(VAR_6[VAR_3], s->VAR_6);", "}", "for (VAR_3 = 0; VAR_3 < 3; VAR_3++) {", "if (!s->has_residual_lsps) {", "int VAR_11;", "if (s->VAR_6 == 10) {", "dequant_lsp10i(gb, VAR_6[VAR_3]);", "} else", "dequant_lsp16i(gb, VAR_6[VAR_3]);", "for (VAR_11 = 0; VAR_11 < s->VAR_6; VAR_11++)", "VAR_6[VAR_3][VAR_11] += VAR_7[VAR_11];", "stabilize_lsps(VAR_6[VAR_3], s->VAR_6);", "}", "if ((VAR_4 = synth_frame(VAR_0, gb, VAR_3,\n&VAR_1[VAR_3 * MAX_FRAMESIZE],\nVAR_6[VAR_3], VAR_3 == 0 ? s->VAR_10 : VAR_6[VAR_3 - 1],\n&VAR_8[s->history_nsamples + VAR_3 * MAX_FRAMESIZE],\n&VAR_9[s->VAR_6 + VAR_3 * MAX_FRAMESIZE]))) {", "*VAR_2 = 0;", "return VAR_4;", "}", "}", "if (get_bits1(gb)) {", "VAR_4 = get_bits(gb, 4);", "skip_bits(gb, 10 * (VAR_4 + 1));", "}", "*VAR_2 = VAR_5 * sizeof(float);", "memcpy(s->VAR_10, VAR_6[2],\ns->VAR_6 * sizeof(*s->VAR_10));", "memcpy(s->synth_history, &VAR_9[MAX_SFRAMESIZE],\ns->VAR_6 * sizeof(*VAR_9));", "memcpy(s->excitation_history, &VAR_8[MAX_SFRAMESIZE],\ns->history_nsamples * sizeof(*VAR_8));", "if (s->do_apf)\nmemmove(s->zero_exc_pf, &s->zero_exc_pf[MAX_SFRAMESIZE],\ns->history_nsamples * sizeof(*s->zero_exc_pf));", "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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15, 17 ], [ 19 ], [ 21 ], [ 25, 27 ], [ 29, 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 77 ], [ 79 ], [ 81, 83, 85 ], [ 87 ], [ 89 ], [ 91 ], [ 95 ], [ 97 ], [ 101 ], [ 103 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 137 ], [ 139 ], [ 141 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 165, 167, 169, 171, 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 203 ], [ 209, 211 ], [ 213, 215 ], [ 217, 219 ], [ 221, 223, 225 ], [ 229 ], [ 231 ] ]
7,460
int float64_lt( float64 a, float64 b STATUS_PARAM ) { flag aSign, bSign; if ( ( ( extractFloat64Exp( a ) == 0x7FF ) && extractFloat64Frac( a ) ) || ( ( extractFloat64Exp( b ) == 0x7FF ) && extractFloat64Frac( b ) ) ) { float_raise( float_flag_invalid STATUS_VAR); return 0; } aSign = extractFloat64Sign( a ); bSign = extractFloat64Sign( b ); if ( aSign != bSign ) return aSign && ( (bits64) ( ( a | b )<<1 ) != 0 ); return ( a != b ) && ( aSign ^ ( a < b ) ); }
false
qemu
f090c9d4ad5812fb92843d6470a1111c15190c4c
int float64_lt( float64 a, float64 b STATUS_PARAM ) { flag aSign, bSign; if ( ( ( extractFloat64Exp( a ) == 0x7FF ) && extractFloat64Frac( a ) ) || ( ( extractFloat64Exp( b ) == 0x7FF ) && extractFloat64Frac( b ) ) ) { float_raise( float_flag_invalid STATUS_VAR); return 0; } aSign = extractFloat64Sign( a ); bSign = extractFloat64Sign( b ); if ( aSign != bSign ) return aSign && ( (bits64) ( ( a | b )<<1 ) != 0 ); return ( a != b ) && ( aSign ^ ( a < b ) ); }
{ "code": [], "line_no": [] }
int FUNC_0( float64 VAR_0, float64 VAR_1 STATUS_PARAM ) { flag aSign, bSign; if ( ( ( extractFloat64Exp( VAR_0 ) == 0x7FF ) && extractFloat64Frac( VAR_0 ) ) || ( ( extractFloat64Exp( VAR_1 ) == 0x7FF ) && extractFloat64Frac( VAR_1 ) ) ) { float_raise( float_flag_invalid STATUS_VAR); return 0; } aSign = extractFloat64Sign( VAR_0 ); bSign = extractFloat64Sign( VAR_1 ); if ( aSign != bSign ) return aSign && ( (bits64) ( ( VAR_0 | VAR_1 )<<1 ) != 0 ); return ( VAR_0 != VAR_1 ) && ( aSign ^ ( VAR_0 < VAR_1 ) ); }
[ "int FUNC_0( float64 VAR_0, float64 VAR_1 STATUS_PARAM )\n{", "flag aSign, bSign;", "if ( ( ( extractFloat64Exp( VAR_0 ) == 0x7FF ) && extractFloat64Frac( VAR_0 ) )\n|| ( ( extractFloat64Exp( VAR_1 ) == 0x7FF ) && extractFloat64Frac( VAR_1 ) )\n) {", "float_raise( float_flag_invalid STATUS_VAR);", "return 0;", "}", "aSign = extractFloat64Sign( VAR_0 );", "bSign = extractFloat64Sign( VAR_1 );", "if ( aSign != bSign ) return aSign && ( (bits64) ( ( VAR_0 | VAR_1 )<<1 ) != 0 );", "return ( VAR_0 != VAR_1 ) && ( aSign ^ ( VAR_0 < VAR_1 ) );", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11, 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ] ]
7,461
void bdrv_set_enable_write_cache(BlockDriverState *bs, bool wce) { bs->enable_write_cache = wce; /* so a reopen() will preserve wce */ if (wce) { bs->open_flags |= BDRV_O_CACHE_WB; } else { bs->open_flags &= ~BDRV_O_CACHE_WB; } }
false
qemu
61007b316cd71ee7333ff7a0a749a8949527575f
void bdrv_set_enable_write_cache(BlockDriverState *bs, bool wce) { bs->enable_write_cache = wce; if (wce) { bs->open_flags |= BDRV_O_CACHE_WB; } else { bs->open_flags &= ~BDRV_O_CACHE_WB; } }
{ "code": [], "line_no": [] }
void FUNC_0(BlockDriverState *VAR_0, bool VAR_1) { VAR_0->enable_write_cache = VAR_1; if (VAR_1) { VAR_0->open_flags |= BDRV_O_CACHE_WB; } else { VAR_0->open_flags &= ~BDRV_O_CACHE_WB; } }
[ "void FUNC_0(BlockDriverState *VAR_0, bool VAR_1)\n{", "VAR_0->enable_write_cache = VAR_1;", "if (VAR_1) {", "VAR_0->open_flags |= BDRV_O_CACHE_WB;", "} else {", "VAR_0->open_flags &= ~BDRV_O_CACHE_WB;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]